-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(core): css-custom-property feature overall #2216
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
idoros
added
core
Processing and transforming logic
tech debt
Updates, upgrades, stale code and work-arounds
labels
Dec 21, 2021
…property-feature-extraction
- feature file `/features/css-custom-property.ts` - moved `CSSVarSymbol` symbol - export empty diagnostics and hooks - register to stylable meta class
- moved all code related to feature file - new `analyzeDeclaration` feature hook
- `isCSSVarProp` from `stylable-utils` to `helpers/css-custom-property` - `validateAllowedNodesUntil` from `stylable-value-parser` to `helpers/value` - `globalValue` from `utils` to `helpers/global` - deprecate `paramMapping` constant export
- analyze `@st-global-custom-property` to feature - add `toRemove` api to `analyzeAtRule` feature until `rawAst` is immutable
- `transformResolve` - `transformAtRule` - `transformJSExports`
- `transformDeclarationValue` new hook - transform `var()` extract from `functions` to feaure - `stringifyFunction` from `functions` to `helpers/value`
- `transformDeclaration` - move `--X: ;` namespace to feature - `getScopedCSSVar` from `transformer` to `helpers/css-custom-property` - deprecate `transformer.getScopedCSSVar()`
…property-feature-extraction
- refactored to new format with inline tests and `testStylableCore` - add internal `CSSCustomProperty.get(symbolName)`
- `exports.spec` css custom property tests - test for resolving mixed-in property override - moved skipped escape test
- add `alias` field to `CSSVarSymbol` to point to imported symbol - implemented suppurt for aliased in resolver and completion-provider - register `--` prefixed imports as aliased custom property symbols - sort conflicted symbol definitions from import, `@property`, and `@st-custom-global-property`
- import path and file name didn't match
- keep `var()` untransformed - report empty prop name diagnostic
barak007
requested changes
Jan 20, 2022
packages/cli/src/code-mods/st-global-custom-property-to-at-property.ts
Outdated
Show resolved
Hide resolved
barak007
approved these changes
Jan 23, 2022
…property-feature-extraction
idoros
changed the title
refactor(core): css-custom-property feature extraction
fix(core): css-custom-property feature overall
Feb 8, 2022
tzachbon
pushed a commit
that referenced
this pull request
Feb 21, 2022
## fix - resolve behavior between `@property` and `@st-global-custom-property` - collect imported properties during analyze (event if not used) - empty `var()` handle to no crush - wrong transform for empty `@keyframes {}` -> `@keyframesNS__ {}` ## refactor - move CSS custom property code to `CSSCustomProperty` feature ## deprecate - `meta.cssVars` - `paramMapping` export
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix
@st-global-custom-property
overrides the@property
definition regardless of the definitions order see behavior - This PR resolves and tests the definition behavior:@property
and mark property as global@st-import
and override with global symbolprop/var()
usages creates an incorrect symbol - this PR fixes the issue by adding analias
ref to the imported symbol (likeclass
andtype
symbols), and imported custom properties are identified by the--
prefix and added to as an aliased propertyvar()
break the process with:cannot read properties of undefined (reading 'type')
- this PR keepsvar()
untransformed, reportmissing property name
diagnostic and doesn't crush@keyframes {}
->@keyframesNS__ {}
see playgroundrefactor
analyzeAtRule
@property
to feature@st-global-custom-property
to featureanalyzeDeclaration
(new hook)--X: value;
to featureprop: var(--X)
to featuretransformResolve
- movecreateCSSVarsMapping
to featuretransformAtRule
- move@property
namespace/removal to featuretransformDeclaration
- move--X: ;
namespace to featuretransformDeclarationValue
(new hook) - move: var();
namespace to feature (value transformation is part ofevelDeclarationValue
)transformJSExports
- moveexportCSSVars
to featureCSSVarSymbol
to featurevalidate-at-property
tohelpers/css-custom-property
helpers/global
stylable-utils/isCSSVarProp
tohelpers/css-custom-property
deprecate
meta.cssVars
paramMapping
exporttest
css-property.spec
@analayze
&@transform
bug with multiple lines