@tamagui/style-grammar 0.0.0-bootstrap.0 → 3.0.0-beta.643.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +33 -1
- package/dist/cjs/backgroundFamily.cjs +176 -0
- package/dist/cjs/backgroundFamily.native.cjs +195 -0
- package/dist/cjs/backgroundFamily.native.js +197 -0
- package/dist/cjs/backgroundFamily.native.js.map +1 -0
- package/dist/cjs/borderFamily.cjs +169 -0
- package/dist/cjs/borderFamily.native.cjs +247 -0
- package/dist/cjs/borderFamily.native.js +249 -0
- package/dist/cjs/borderFamily.native.js.map +1 -0
- package/dist/cjs/candidate.cjs +608 -0
- package/dist/cjs/candidate.native.cjs +821 -0
- package/dist/cjs/candidate.native.js +823 -0
- package/dist/cjs/candidate.native.js.map +1 -0
- package/dist/cjs/candidateTarget.cjs +50 -0
- package/dist/cjs/candidateTarget.native.cjs +88 -0
- package/dist/cjs/candidateTarget.native.js +90 -0
- package/dist/cjs/candidateTarget.native.js.map +1 -0
- package/dist/cjs/clauseCapability.cjs +130 -0
- package/dist/cjs/clauseCapability.native.cjs +152 -0
- package/dist/cjs/clauseCapability.native.js +154 -0
- package/dist/cjs/clauseCapability.native.js.map +1 -0
- package/dist/cjs/clausePrecedence.cjs +153 -0
- package/dist/cjs/clausePrecedence.native.cjs +204 -0
- package/dist/cjs/clausePrecedence.native.js +206 -0
- package/dist/cjs/clausePrecedence.native.js.map +1 -0
- package/dist/cjs/clauseSources.cjs +47 -0
- package/dist/cjs/clauseSources.native.cjs +49 -0
- package/dist/cjs/clauseSources.native.js +51 -0
- package/dist/cjs/clauseSources.native.js.map +1 -0
- package/dist/cjs/config.cjs +130 -0
- package/dist/cjs/config.native.cjs +185 -0
- package/dist/cjs/config.native.js +187 -0
- package/dist/cjs/config.native.js.map +1 -0
- package/dist/cjs/evaluateProgram.cjs +65 -0
- package/dist/cjs/evaluateProgram.native.cjs +70 -0
- package/dist/cjs/evaluateProgram.native.js +72 -0
- package/dist/cjs/evaluateProgram.native.js.map +1 -0
- package/dist/cjs/fontShorthand.cjs +207 -0
- package/dist/cjs/fontShorthand.native.cjs +260 -0
- package/dist/cjs/fontShorthand.native.js +262 -0
- package/dist/cjs/fontShorthand.native.js.map +1 -0
- package/dist/cjs/geometricShorthand.cjs +122 -0
- package/dist/cjs/geometricShorthand.native.cjs +128 -0
- package/dist/cjs/geometricShorthand.native.js +130 -0
- package/dist/cjs/geometricShorthand.native.js.map +1 -0
- package/dist/cjs/index.cjs +19 -0
- package/dist/cjs/index.native.cjs +21 -0
- package/dist/cjs/index.native.js +23 -0
- package/dist/cjs/index.native.js.map +1 -0
- package/dist/cjs/lowerProgram.cjs +205 -0
- package/dist/cjs/lowerProgram.native.cjs +257 -0
- package/dist/cjs/lowerProgram.native.js +259 -0
- package/dist/cjs/lowerProgram.native.js.map +1 -0
- package/dist/cjs/mergeFlatValues.cjs +50 -0
- package/dist/cjs/mergeFlatValues.native.cjs +71 -0
- package/dist/cjs/mergeFlatValues.native.js +73 -0
- package/dist/cjs/mergeFlatValues.native.js.map +1 -0
- package/dist/cjs/modifierRegistry.cjs +246 -0
- package/dist/cjs/modifierRegistry.native.cjs +426 -0
- package/dist/cjs/modifierRegistry.native.js +428 -0
- package/dist/cjs/modifierRegistry.native.js.map +1 -0
- package/dist/cjs/payloadShape.cjs +69 -0
- package/dist/cjs/payloadShape.native.cjs +71 -0
- package/dist/cjs/payloadShape.native.js +73 -0
- package/dist/cjs/payloadShape.native.js.map +1 -0
- package/dist/cjs/programEligibility.cjs +46 -0
- package/dist/cjs/programEligibility.native.cjs +48 -0
- package/dist/cjs/programEligibility.native.js +50 -0
- package/dist/cjs/programEligibility.native.js.map +1 -0
- package/dist/cjs/programHash.cjs +86 -0
- package/dist/cjs/programHash.native.cjs +106 -0
- package/dist/cjs/programHash.native.js +108 -0
- package/dist/cjs/programHash.native.js.map +1 -0
- package/dist/cjs/programs.cjs +128 -0
- package/dist/cjs/programs.native.cjs +220 -0
- package/dist/cjs/programs.native.js +222 -0
- package/dist/cjs/programs.native.js.map +1 -0
- package/dist/cjs/registry.cjs +629 -0
- package/dist/cjs/registry.native.cjs +635 -0
- package/dist/cjs/registry.native.js +637 -0
- package/dist/cjs/registry.native.js.map +1 -0
- package/dist/cjs/resolvePayload.cjs +296 -0
- package/dist/cjs/resolvePayload.native.cjs +302 -0
- package/dist/cjs/resolvePayload.native.js +304 -0
- package/dist/cjs/resolvePayload.native.js.map +1 -0
- package/dist/cjs/runtime.cjs +50 -0
- package/dist/cjs/runtime.native.cjs +52 -0
- package/dist/cjs/runtime.native.js +54 -0
- package/dist/cjs/runtime.native.js.map +1 -0
- package/dist/cjs/safeAreaVariables.cjs +42 -0
- package/dist/cjs/safeAreaVariables.native.cjs +44 -0
- package/dist/cjs/safeAreaVariables.native.js +46 -0
- package/dist/cjs/safeAreaVariables.native.js.map +1 -0
- package/dist/cjs/scanFlatValue.cjs +181 -0
- package/dist/cjs/scanFlatValue.native.cjs +183 -0
- package/dist/cjs/scanFlatValue.native.js +185 -0
- package/dist/cjs/scanFlatValue.native.js.map +1 -0
- package/dist/cjs/serializePayload.cjs +149 -0
- package/dist/cjs/serializePayload.native.cjs +187 -0
- package/dist/cjs/serializePayload.native.js +189 -0
- package/dist/cjs/serializePayload.native.js.map +1 -0
- package/dist/cjs/stateModifiers.cjs +43 -0
- package/dist/cjs/stateModifiers.native.cjs +45 -0
- package/dist/cjs/stateModifiers.native.js +47 -0
- package/dist/cjs/stateModifiers.native.js.map +1 -0
- package/dist/cjs/states.cjs +97 -0
- package/dist/cjs/states.native.cjs +131 -0
- package/dist/cjs/states.native.js +133 -0
- package/dist/cjs/states.native.js.map +1 -0
- package/dist/cjs/table.cjs +54 -0
- package/dist/cjs/table.native.cjs +135 -0
- package/dist/cjs/table.native.js +137 -0
- package/dist/cjs/table.native.js.map +1 -0
- package/dist/cjs/textDecorationFamily.cjs +129 -0
- package/dist/cjs/textDecorationFamily.native.cjs +199 -0
- package/dist/cjs/textDecorationFamily.native.js +201 -0
- package/dist/cjs/textDecorationFamily.native.js.map +1 -0
- package/dist/cjs/tooling.cjs +26 -0
- package/dist/cjs/tooling.native.cjs +28 -0
- package/dist/cjs/tooling.native.js +30 -0
- package/dist/cjs/tooling.native.js.map +1 -0
- package/dist/cjs/toolingAnnotations.cjs +105 -0
- package/dist/cjs/toolingAnnotations.native.cjs +133 -0
- package/dist/cjs/toolingAnnotations.native.js +135 -0
- package/dist/cjs/toolingAnnotations.native.js.map +1 -0
- package/dist/cjs/toolingDiagnostics.cjs +459 -0
- package/dist/cjs/toolingDiagnostics.native.cjs +788 -0
- package/dist/cjs/toolingDiagnostics.native.js +790 -0
- package/dist/cjs/toolingDiagnostics.native.js.map +1 -0
- package/dist/cjs/toolingRegistry.cjs +159 -0
- package/dist/cjs/toolingRegistry.native.cjs +164 -0
- package/dist/cjs/toolingRegistry.native.js +166 -0
- package/dist/cjs/toolingRegistry.native.js.map +1 -0
- package/dist/cjs/transformFamily.cjs +425 -0
- package/dist/cjs/transformFamily.native.cjs +517 -0
- package/dist/cjs/transformFamily.native.js +519 -0
- package/dist/cjs/transformFamily.native.js.map +1 -0
- package/dist/cjs/transition.cjs +459 -0
- package/dist/cjs/transition.native.cjs +499 -0
- package/dist/cjs/transition.native.js +501 -0
- package/dist/cjs/transition.native.js.map +1 -0
- package/dist/cjs/transitionAlign.cjs +115 -0
- package/dist/cjs/transitionAlign.native.cjs +154 -0
- package/dist/cjs/transitionAlign.native.js +156 -0
- package/dist/cjs/transitionAlign.native.js.map +1 -0
- package/dist/cjs/transitionLegacy.cjs +217 -0
- package/dist/cjs/transitionLegacy.native.cjs +260 -0
- package/dist/cjs/transitionLegacy.native.js +262 -0
- package/dist/cjs/transitionLegacy.native.js.map +1 -0
- package/dist/cjs/transitionNative.cjs +281 -0
- package/dist/cjs/transitionNative.native.cjs +285 -0
- package/dist/cjs/transitionNative.native.js +287 -0
- package/dist/cjs/transitionNative.native.js.map +1 -0
- package/dist/cjs/unitlessNumbers.cjs +86 -0
- package/dist/cjs/unitlessNumbers.native.cjs +106 -0
- package/dist/cjs/unitlessNumbers.native.js +108 -0
- package/dist/cjs/unitlessNumbers.native.js.map +1 -0
- package/dist/cjs/v6ThemeNames.cjs +47 -0
- package/dist/cjs/v6ThemeNames.native.cjs +53 -0
- package/dist/cjs/v6ThemeNames.native.js +55 -0
- package/dist/cjs/v6ThemeNames.native.js.map +1 -0
- package/dist/cjs/valueParser.cjs +148 -0
- package/dist/cjs/valueParser.native.cjs +150 -0
- package/dist/cjs/valueParser.native.js +152 -0
- package/dist/cjs/valueParser.native.js.map +1 -0
- package/dist/cjs/valueTypes.cjs +38 -0
- package/dist/cjs/valueTypes.native.cjs +40 -0
- package/dist/cjs/valueTypes.native.js +42 -0
- package/dist/cjs/valueTypes.native.js.map +1 -0
- package/dist/esm/backgroundFamily.mjs +150 -0
- package/dist/esm/backgroundFamily.mjs.map +1 -0
- package/dist/esm/backgroundFamily.native.js +167 -0
- package/dist/esm/backgroundFamily.native.js.map +1 -0
- package/dist/esm/borderFamily.mjs +146 -0
- package/dist/esm/borderFamily.mjs.map +1 -0
- package/dist/esm/borderFamily.native.js +222 -0
- package/dist/esm/borderFamily.native.js.map +1 -0
- package/dist/esm/candidate.mjs +581 -0
- package/dist/esm/candidate.mjs.map +1 -0
- package/dist/esm/candidate.native.js +792 -0
- package/dist/esm/candidate.native.js.map +1 -0
- package/dist/esm/candidateTarget.mjs +29 -0
- package/dist/esm/candidateTarget.mjs.map +1 -0
- package/dist/esm/candidateTarget.native.js +65 -0
- package/dist/esm/candidateTarget.native.js.map +1 -0
- package/dist/esm/clauseCapability.mjs +107 -0
- package/dist/esm/clauseCapability.mjs.map +1 -0
- package/dist/esm/clauseCapability.native.js +127 -0
- package/dist/esm/clauseCapability.native.js.map +1 -0
- package/dist/esm/clausePrecedence.mjs +121 -0
- package/dist/esm/clausePrecedence.mjs.map +1 -0
- package/dist/esm/clausePrecedence.native.js +170 -0
- package/dist/esm/clausePrecedence.native.js.map +1 -0
- package/dist/esm/clauseSources.mjs +23 -0
- package/dist/esm/clauseSources.mjs.map +1 -0
- package/dist/esm/clauseSources.native.js +23 -0
- package/dist/esm/clauseSources.native.js.map +1 -0
- package/dist/esm/config.mjs +103 -0
- package/dist/esm/config.mjs.map +1 -0
- package/dist/esm/config.native.js +156 -0
- package/dist/esm/config.native.js.map +1 -0
- package/dist/esm/evaluateProgram.mjs +45 -0
- package/dist/esm/evaluateProgram.mjs.map +1 -0
- package/dist/esm/evaluateProgram.native.js +48 -0
- package/dist/esm/evaluateProgram.native.js.map +1 -0
- package/dist/esm/fontShorthand.mjs +184 -0
- package/dist/esm/fontShorthand.mjs.map +1 -0
- package/dist/esm/fontShorthand.native.js +235 -0
- package/dist/esm/fontShorthand.native.js.map +1 -0
- package/dist/esm/geometricShorthand.mjs +102 -0
- package/dist/esm/geometricShorthand.mjs.map +1 -0
- package/dist/esm/geometricShorthand.native.js +106 -0
- package/dist/esm/geometricShorthand.native.js.map +1 -0
- package/dist/esm/index.mjs +1 -0
- package/dist/esm/index.native.js +1 -0
- package/dist/esm/lowerProgram.mjs +182 -0
- package/dist/esm/lowerProgram.mjs.map +1 -0
- package/dist/esm/lowerProgram.native.js +232 -0
- package/dist/esm/lowerProgram.native.js.map +1 -0
- package/dist/esm/mergeFlatValues.mjs +27 -0
- package/dist/esm/mergeFlatValues.mjs.map +1 -0
- package/dist/esm/mergeFlatValues.native.js +46 -0
- package/dist/esm/mergeFlatValues.native.js.map +1 -0
- package/dist/esm/modifierRegistry.mjs +219 -0
- package/dist/esm/modifierRegistry.mjs.map +1 -0
- package/dist/esm/modifierRegistry.native.js +397 -0
- package/dist/esm/modifierRegistry.native.js.map +1 -0
- package/dist/esm/payloadShape.mjs +49 -0
- package/dist/esm/payloadShape.mjs.map +1 -0
- package/dist/esm/payloadShape.native.js +49 -0
- package/dist/esm/payloadShape.native.js.map +1 -0
- package/dist/esm/programEligibility.mjs +22 -0
- package/dist/esm/programEligibility.mjs.map +1 -0
- package/dist/esm/programEligibility.native.js +22 -0
- package/dist/esm/programEligibility.native.js.map +1 -0
- package/dist/esm/programHash.mjs +62 -0
- package/dist/esm/programHash.mjs.map +1 -0
- package/dist/esm/programHash.native.js +80 -0
- package/dist/esm/programHash.native.js.map +1 -0
- package/dist/esm/programs.mjs +103 -0
- package/dist/esm/programs.mjs.map +1 -0
- package/dist/esm/programs.native.js +193 -0
- package/dist/esm/programs.native.js.map +1 -0
- package/dist/esm/registry.mjs +595 -0
- package/dist/esm/registry.mjs.map +1 -0
- package/dist/esm/registry.native.js +599 -0
- package/dist/esm/registry.native.js.map +1 -0
- package/dist/esm/resolvePayload.mjs +273 -0
- package/dist/esm/resolvePayload.mjs.map +1 -0
- package/dist/esm/resolvePayload.native.js +277 -0
- package/dist/esm/resolvePayload.native.js.map +1 -0
- package/dist/esm/runtime.mjs +63 -0
- package/dist/esm/runtime.native.js +63 -0
- package/dist/esm/safeAreaVariables.mjs +18 -0
- package/dist/esm/safeAreaVariables.mjs.map +1 -0
- package/dist/esm/safeAreaVariables.native.js +18 -0
- package/dist/esm/safeAreaVariables.native.js.map +1 -0
- package/dist/esm/scanFlatValue.mjs +160 -0
- package/dist/esm/scanFlatValue.mjs.map +1 -0
- package/dist/esm/scanFlatValue.native.js +160 -0
- package/dist/esm/scanFlatValue.native.js.map +1 -0
- package/dist/esm/serializePayload.mjs +125 -0
- package/dist/esm/serializePayload.mjs.map +1 -0
- package/dist/esm/serializePayload.native.js +161 -0
- package/dist/esm/serializePayload.native.js.map +1 -0
- package/dist/esm/stateModifiers.mjs +19 -0
- package/dist/esm/stateModifiers.mjs.map +1 -0
- package/dist/esm/stateModifiers.native.js +19 -0
- package/dist/esm/stateModifiers.native.js.map +1 -0
- package/dist/esm/states.mjs +69 -0
- package/dist/esm/states.mjs.map +1 -0
- package/dist/esm/states.native.js +101 -0
- package/dist/esm/states.native.js.map +1 -0
- package/dist/esm/table.mjs +31 -0
- package/dist/esm/table.mjs.map +1 -0
- package/dist/esm/table.native.js +110 -0
- package/dist/esm/table.native.js.map +1 -0
- package/dist/esm/textDecorationFamily.mjs +106 -0
- package/dist/esm/textDecorationFamily.mjs.map +1 -0
- package/dist/esm/textDecorationFamily.native.js +174 -0
- package/dist/esm/textDecorationFamily.native.js.map +1 -0
- package/dist/esm/tooling.mjs +15 -0
- package/dist/esm/tooling.native.js +15 -0
- package/dist/esm/toolingAnnotations.mjs +85 -0
- package/dist/esm/toolingAnnotations.mjs.map +1 -0
- package/dist/esm/toolingAnnotations.native.js +111 -0
- package/dist/esm/toolingAnnotations.native.js.map +1 -0
- package/dist/esm/toolingDiagnostics.mjs +428 -0
- package/dist/esm/toolingDiagnostics.mjs.map +1 -0
- package/dist/esm/toolingDiagnostics.native.js +755 -0
- package/dist/esm/toolingDiagnostics.native.js.map +1 -0
- package/dist/esm/toolingRegistry.mjs +135 -0
- package/dist/esm/toolingRegistry.mjs.map +1 -0
- package/dist/esm/toolingRegistry.native.js +138 -0
- package/dist/esm/toolingRegistry.native.js.map +1 -0
- package/dist/esm/transformFamily.mjs +392 -0
- package/dist/esm/transformFamily.mjs.map +1 -0
- package/dist/esm/transformFamily.native.js +482 -0
- package/dist/esm/transformFamily.native.js.map +1 -0
- package/dist/esm/transition.mjs +434 -0
- package/dist/esm/transition.mjs.map +1 -0
- package/dist/esm/transition.native.js +472 -0
- package/dist/esm/transition.native.js.map +1 -0
- package/dist/esm/transitionAlign.mjs +95 -0
- package/dist/esm/transitionAlign.mjs.map +1 -0
- package/dist/esm/transitionAlign.native.js +132 -0
- package/dist/esm/transitionAlign.native.js.map +1 -0
- package/dist/esm/transitionLegacy.mjs +197 -0
- package/dist/esm/transitionLegacy.mjs.map +1 -0
- package/dist/esm/transitionLegacy.native.js +238 -0
- package/dist/esm/transitionLegacy.native.js.map +1 -0
- package/dist/esm/transitionNative.mjs +257 -0
- package/dist/esm/transitionNative.mjs.map +1 -0
- package/dist/esm/transitionNative.native.js +259 -0
- package/dist/esm/transitionNative.native.js.map +1 -0
- package/dist/esm/unitlessNumbers.mjs +65 -0
- package/dist/esm/unitlessNumbers.mjs.map +1 -0
- package/dist/esm/unitlessNumbers.native.js +83 -0
- package/dist/esm/unitlessNumbers.native.js.map +1 -0
- package/dist/esm/v6ThemeNames.mjs +23 -0
- package/dist/esm/v6ThemeNames.mjs.map +1 -0
- package/dist/esm/v6ThemeNames.native.js +27 -0
- package/dist/esm/v6ThemeNames.native.js.map +1 -0
- package/dist/esm/valueParser.mjs +125 -0
- package/dist/esm/valueParser.mjs.map +1 -0
- package/dist/esm/valueParser.native.js +125 -0
- package/dist/esm/valueParser.native.js.map +1 -0
- package/dist/esm/valueTypes.mjs +14 -0
- package/dist/esm/valueTypes.mjs.map +1 -0
- package/dist/esm/valueTypes.native.js +14 -0
- package/dist/esm/valueTypes.native.js.map +1 -0
- package/package.json +98 -4
- package/src/backgroundFamily.ts +182 -0
- package/src/borderFamily.ts +172 -0
- package/src/candidate.ts +691 -0
- package/src/candidateTarget.ts +67 -0
- package/src/clauseCapability.ts +209 -0
- package/src/clausePrecedence.ts +198 -0
- package/src/clauseSources.ts +29 -0
- package/src/config.ts +169 -0
- package/src/evaluateProgram.ts +91 -0
- package/src/fontShorthand.ts +177 -0
- package/src/geometricShorthand.ts +105 -0
- package/src/index.ts +1 -0
- package/src/lowerProgram.ts +398 -0
- package/src/modifierRegistry.ts +340 -0
- package/src/payloadShape.ts +92 -0
- package/src/programEligibility.ts +46 -0
- package/src/programHash.ts +128 -0
- package/src/programs.ts +95 -0
- package/src/registry.ts +367 -0
- package/src/resolvePayload.ts +480 -0
- package/src/runtime.ts +32 -0
- package/src/safeAreaVariables.ts +19 -0
- package/src/scanFlatValue.ts +327 -0
- package/src/serializePayload.ts +199 -0
- package/src/stateModifiers.ts +36 -0
- package/src/states.ts +128 -0
- package/src/table.ts +47 -0
- package/src/textDecorationFamily.ts +119 -0
- package/src/tooling.ts +8 -0
- package/src/toolingAnnotations.ts +151 -0
- package/src/toolingDiagnostics.ts +735 -0
- package/src/toolingRegistry.ts +130 -0
- package/src/transformFamily.ts +590 -0
- package/src/transition.ts +553 -0
- package/src/transitionAlign.ts +165 -0
- package/src/transitionLegacy.ts +237 -0
- package/src/transitionNative.ts +357 -0
- package/src/unitlessNumbers.ts +61 -0
- package/src/v6ThemeNames.ts +40 -0
- package/src/valueParser.ts +193 -0
- package/src/valueTypes.ts +136 -0
- package/types/backgroundFamily.d.ts +17 -0
- package/types/backgroundFamily.d.ts.map +11 -0
- package/types/borderFamily.d.ts +23 -0
- package/types/borderFamily.d.ts.map +11 -0
- package/types/candidate.d.ts +52 -0
- package/types/candidate.d.ts.map +11 -0
- package/types/candidateTarget.d.ts +32 -0
- package/types/candidateTarget.d.ts.map +11 -0
- package/types/clauseCapability.d.ts +69 -0
- package/types/clauseCapability.d.ts.map +11 -0
- package/types/clausePrecedence.d.ts +30 -0
- package/types/clausePrecedence.d.ts.map +11 -0
- package/types/clauseSources.d.ts +12 -0
- package/types/clauseSources.d.ts.map +11 -0
- package/types/config.d.ts +44 -0
- package/types/config.d.ts.map +11 -0
- package/types/evaluateProgram.d.ts +27 -0
- package/types/evaluateProgram.d.ts.map +11 -0
- package/types/fontShorthand.d.ts +25 -0
- package/types/fontShorthand.d.ts.map +11 -0
- package/types/geometricShorthand.d.ts +21 -0
- package/types/geometricShorthand.d.ts.map +11 -0
- package/types/index.d.ts +3 -0
- package/types/index.d.ts.map +11 -0
- package/types/lowerProgram.d.ts +73 -0
- package/types/lowerProgram.d.ts.map +11 -0
- package/types/mergeFlatValues.d.ts +14 -0
- package/types/mergeFlatValues.d.ts.map +11 -0
- package/types/modifierRegistry.d.ts +70 -0
- package/types/modifierRegistry.d.ts.map +11 -0
- package/types/payloadShape.d.ts +15 -0
- package/types/payloadShape.d.ts.map +11 -0
- package/types/programEligibility.d.ts +23 -0
- package/types/programEligibility.d.ts.map +11 -0
- package/types/programHash.d.ts +20 -0
- package/types/programHash.d.ts.map +11 -0
- package/types/programs.d.ts +18 -0
- package/types/programs.d.ts.map +11 -0
- package/types/registry.d.ts +24 -0
- package/types/registry.d.ts.map +11 -0
- package/types/resolvePayload.d.ts +75 -0
- package/types/resolvePayload.d.ts.map +11 -0
- package/types/runtime.d.ts +34 -0
- package/types/runtime.d.ts.map +11 -0
- package/types/safeAreaVariables.d.ts +5 -0
- package/types/safeAreaVariables.d.ts.map +11 -0
- package/types/scanFlatValue.d.ts +29 -0
- package/types/scanFlatValue.d.ts.map +11 -0
- package/types/serializePayload.d.ts +13 -0
- package/types/serializePayload.d.ts.map +11 -0
- package/types/stateModifiers.d.ts +14 -0
- package/types/stateModifiers.d.ts.map +11 -0
- package/types/states.d.ts +22 -0
- package/types/states.d.ts.map +11 -0
- package/types/table.d.ts +4 -0
- package/types/table.d.ts.map +11 -0
- package/types/textDecorationFamily.d.ts +23 -0
- package/types/textDecorationFamily.d.ts.map +11 -0
- package/types/tooling.d.ts +10 -0
- package/types/tooling.d.ts.map +11 -0
- package/types/toolingAnnotations.d.ts +29 -0
- package/types/toolingAnnotations.d.ts.map +11 -0
- package/types/toolingDiagnostics.d.ts +114 -0
- package/types/toolingDiagnostics.d.ts.map +11 -0
- package/types/toolingRegistry.d.ts +10 -0
- package/types/toolingRegistry.d.ts.map +11 -0
- package/types/transformFamily.d.ts +83 -0
- package/types/transformFamily.d.ts.map +11 -0
- package/types/transition.d.ts +65 -0
- package/types/transition.d.ts.map +11 -0
- package/types/transitionAlign.d.ts +15 -0
- package/types/transitionAlign.d.ts.map +11 -0
- package/types/transitionLegacy.d.ts +9 -0
- package/types/transitionLegacy.d.ts.map +11 -0
- package/types/transitionNative.d.ts +41 -0
- package/types/transitionNative.d.ts.map +11 -0
- package/types/unitlessNumbers.d.ts +3 -0
- package/types/unitlessNumbers.d.ts.map +11 -0
- package/types/v6ThemeNames.d.ts +7 -0
- package/types/v6ThemeNames.d.ts.map +11 -0
- package/types/valueParser.d.ts +36 -0
- package/types/valueParser.d.ts.map +11 -0
- package/types/valueTypes.d.ts +66 -0
- package/types/valueTypes.d.ts.map +11 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { TokenCategory } from './registry'
|
|
2
|
+
|
|
3
|
+
export interface CandidateContribution {
|
|
4
|
+
property: string
|
|
5
|
+
/** the token category this contribution binds through, when config-derived */
|
|
6
|
+
tokenCategory?: TokenCategory
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface CandidatePropertyMismatch {
|
|
10
|
+
code: 'candidate-property-mismatch'
|
|
11
|
+
candidate: string
|
|
12
|
+
property: string
|
|
13
|
+
contributedProperties: readonly string[]
|
|
14
|
+
message: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type CandidateTargetResult<Contribution extends CandidateContribution> =
|
|
18
|
+
| {
|
|
19
|
+
ok: true
|
|
20
|
+
contribution: Contribution
|
|
21
|
+
}
|
|
22
|
+
| {
|
|
23
|
+
ok: false
|
|
24
|
+
diagnostic: CandidatePropertyMismatch
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* selects the contribution addressed by an overloaded family prop.
|
|
29
|
+
*
|
|
30
|
+
* candidate resolution happens before this function, so both the compiler and
|
|
31
|
+
* runtime pass the same family contributions here. A candidate is valid only
|
|
32
|
+
* when it contributes to the authored property itself. This keeps shared
|
|
33
|
+
* families such as `text-*` from accepting a color candidate for `fontSize`,
|
|
34
|
+
* or a font-size candidate for `color`.
|
|
35
|
+
*/
|
|
36
|
+
export function resolveCandidateTarget<Contribution extends CandidateContribution>(
|
|
37
|
+
property: string,
|
|
38
|
+
candidate: string,
|
|
39
|
+
contributions: readonly Contribution[]
|
|
40
|
+
): CandidateTargetResult<Contribution> {
|
|
41
|
+
for (const contribution of contributions) {
|
|
42
|
+
if (contribution.property === property) {
|
|
43
|
+
return { ok: true, contribution }
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const contributedProperties: string[] = []
|
|
48
|
+
for (const contribution of contributions) {
|
|
49
|
+
if (!contributedProperties.includes(contribution.property)) {
|
|
50
|
+
contributedProperties.push(contribution.property)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
ok: false,
|
|
56
|
+
diagnostic: {
|
|
57
|
+
code: 'candidate-property-mismatch',
|
|
58
|
+
candidate,
|
|
59
|
+
property,
|
|
60
|
+
contributedProperties,
|
|
61
|
+
message:
|
|
62
|
+
contributedProperties.length === 0
|
|
63
|
+
? `"${candidate}" does not contribute to "${property}"`
|
|
64
|
+
: `"${candidate}" contributes to ${contributedProperties.map((name) => `"${name}"`).join(', ')}, not "${property}"`,
|
|
65
|
+
},
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
// The platform-clause capability contract and the composed conversion
|
|
2
|
+
// assessment (three-dimension review, 2026-07-31).
|
|
3
|
+
//
|
|
4
|
+
// Three separately-owned dimensions, one composed answer:
|
|
5
|
+
// - PROPERTY: programEligibility (can this prop carry programs at all).
|
|
6
|
+
// - CLAUSE (this file): can a modifier lower on web CSS, and can it evaluate
|
|
7
|
+
// natively. This is the ONE owner of both capability sets — the web side is
|
|
8
|
+
// DERIVED from the lowering selector table and the native side is defined
|
|
9
|
+
// here and consumed by the native evaluator, so the claims cannot drift
|
|
10
|
+
// from what actually runs.
|
|
11
|
+
// - HOST: owned by the validStyles tables in @tamagui/helpers (enforced at
|
|
12
|
+
// runtime by the text-only-prop ruling). NOT mirrored here — the consumer
|
|
13
|
+
// supplies a HostView it already holds (staticConfig for the runtime and
|
|
14
|
+
// codemod, the serialized config for tooling).
|
|
15
|
+
//
|
|
16
|
+
// The composition lives INSIDE assessFlatConversion so no consumer ever
|
|
17
|
+
// combines axes itself: one question, one structured answer, and "clean"
|
|
18
|
+
// means convertible AND evaluable where the author put it.
|
|
19
|
+
|
|
20
|
+
import { legacyPartComposite, programEligibility } from './programEligibility'
|
|
21
|
+
import { defaultStateSelectors } from './lowerProgram'
|
|
22
|
+
import { parseContainerModifier, parseGroupModifier } from './modifierRegistry'
|
|
23
|
+
import { nativeGroupSourceableStates, nativeSourceableStates } from './clauseSources'
|
|
24
|
+
import type { ModifierKind, ModifierRegistryView } from './valueTypes'
|
|
25
|
+
|
|
26
|
+
const nativeGroupSourceable: ReadonlySet<string> = new Set(nativeGroupSourceableStates)
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Web lowerability is DERIVED from the selector table the lowering actually
|
|
30
|
+
* uses, including the lifecycle classes emitted by createComponent.
|
|
31
|
+
*/
|
|
32
|
+
const webLowerableStates: ReadonlySet<string> = new Set(
|
|
33
|
+
Object.keys(defaultStateSelectors)
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
export interface ClauseCapability {
|
|
37
|
+
/** the clause can lower to web CSS */
|
|
38
|
+
web: boolean
|
|
39
|
+
/** the clause can evaluate on native */
|
|
40
|
+
native: boolean
|
|
41
|
+
/** why a side is unsupported, for diagnostics */
|
|
42
|
+
note?: string
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const bothTargets: ClauseCapability = Object.freeze({ web: true, native: true })
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Per-modifier capability. `kind` comes from the same registry the value was
|
|
49
|
+
* parsed against; an unregistered modifier is a parse error upstream and
|
|
50
|
+
* reports unsupported on both targets here.
|
|
51
|
+
*/
|
|
52
|
+
export function clauseCapability(
|
|
53
|
+
modifier: string,
|
|
54
|
+
kind: ModifierKind | undefined
|
|
55
|
+
): ClauseCapability {
|
|
56
|
+
if (kind === 'media' || kind === 'theme' || kind === 'platform') {
|
|
57
|
+
return bothTargets
|
|
58
|
+
}
|
|
59
|
+
if (kind === 'container') {
|
|
60
|
+
return bothTargets
|
|
61
|
+
}
|
|
62
|
+
if (kind === 'state') {
|
|
63
|
+
const web = webLowerableStates.has(modifier)
|
|
64
|
+
const native = nativeSourceableStates.has(modifier)
|
|
65
|
+
if (web && native) return bothTargets
|
|
66
|
+
return {
|
|
67
|
+
web,
|
|
68
|
+
native,
|
|
69
|
+
note: !web
|
|
70
|
+
? `"${modifier}:" cannot lower to web CSS because it has no selector`
|
|
71
|
+
: `"${modifier}:" is a component-tier state with no native source until the behavior packages feed componentState`,
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (kind === 'group') {
|
|
75
|
+
const parsed = parseGroupModifier(modifier)
|
|
76
|
+
if (!parsed)
|
|
77
|
+
return { web: false, native: false, note: `"${modifier}:" is not a group modifier` }
|
|
78
|
+
const web = webLowerableStates.has(parsed.state)
|
|
79
|
+
const native = nativeGroupSourceable.has(parsed.state)
|
|
80
|
+
if (web && native) return bothTargets
|
|
81
|
+
return {
|
|
82
|
+
web,
|
|
83
|
+
native,
|
|
84
|
+
note: `group state "${parsed.state}" has no native source`,
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
web: false,
|
|
89
|
+
native: false,
|
|
90
|
+
note: `"${modifier}:" is not a registered modifier`,
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** file-extension intent: shared files must support BOTH targets */
|
|
95
|
+
export type ConversionTargets = 'shared' | 'web' | 'native'
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Host validity as the consumer already holds it — a projection of the
|
|
99
|
+
* component's staticConfig, never a table of this package's own.
|
|
100
|
+
*/
|
|
101
|
+
export interface HostView {
|
|
102
|
+
/** does this host accept `prop` as a style (validStyles + accept) */
|
|
103
|
+
accepts(prop: string): boolean
|
|
104
|
+
/** for diagnostics: the component label the author sees */
|
|
105
|
+
displayName?: string
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface ConversionReason {
|
|
109
|
+
dimension: 'property' | 'clause' | 'host'
|
|
110
|
+
modifier?: string
|
|
111
|
+
message: string
|
|
112
|
+
/** the action the author takes, stated concretely */
|
|
113
|
+
remedy: string
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface ConversionAssessment {
|
|
117
|
+
/**
|
|
118
|
+
* clean: convertible AND evaluable where authored, with ALL THREE
|
|
119
|
+
* dimensions verified — clean is a promise, so an unchecked dimension can
|
|
120
|
+
* never produce it. needs-relocation: the conversion is syntactically
|
|
121
|
+
* right but this site was DETERMINED unable to evaluate it — the remedy
|
|
122
|
+
* names where it goes. unknown-host: property and clauses verified but the
|
|
123
|
+
* component identity could not be established, so host validity is
|
|
124
|
+
* UNVERIFIED rather than fine — the site needs review, not relocation.
|
|
125
|
+
* ineligible: this property cannot carry the clause spelling at all.
|
|
126
|
+
*/
|
|
127
|
+
verdict: 'clean' | 'needs-relocation' | 'unknown-host' | 'ineligible'
|
|
128
|
+
reasons: readonly ConversionReason[]
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface ConversionInput {
|
|
132
|
+
property: string
|
|
133
|
+
/** modifiers used across the value's clauses, deduplicated by the caller or not */
|
|
134
|
+
modifiers?: readonly string[]
|
|
135
|
+
targets: ConversionTargets
|
|
136
|
+
/**
|
|
137
|
+
* absent means the consumer could NOT establish the component's identity
|
|
138
|
+
* (structural provenance proves only direct View/Text and traceable styled
|
|
139
|
+
* bases today) — the verdict is then at best 'unknown-host', never 'clean'
|
|
140
|
+
*/
|
|
141
|
+
host?: HostView
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const clean: ConversionAssessment = Object.freeze({ verdict: 'clean', reasons: [] })
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* The one call a converter, lint rule, or report makes before claiming a
|
|
148
|
+
* flat-value suggestion is safe. Composes property eligibility, per-target
|
|
149
|
+
* clause capability, and host validity; consumers never combine axes
|
|
150
|
+
* themselves.
|
|
151
|
+
*/
|
|
152
|
+
export function assessFlatConversion(
|
|
153
|
+
input: ConversionInput,
|
|
154
|
+
registry: ModifierRegistryView
|
|
155
|
+
): ConversionAssessment {
|
|
156
|
+
const reasons: ConversionReason[] = []
|
|
157
|
+
|
|
158
|
+
if (programEligibility(input.property) === 'legacy-part') {
|
|
159
|
+
reasons.push({
|
|
160
|
+
dimension: 'property',
|
|
161
|
+
message: `"${input.property}" is a part prop with no flat clause spelling`,
|
|
162
|
+
remedy: `move the condition onto \`${legacyPartComposite[input.property]}\``,
|
|
163
|
+
})
|
|
164
|
+
return { verdict: 'ineligible', reasons }
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
for (const modifier of input.modifiers ?? []) {
|
|
168
|
+
const capability = clauseCapability(modifier, registry.get(modifier))
|
|
169
|
+
const needsWeb = input.targets !== 'native'
|
|
170
|
+
const needsNative = input.targets !== 'web'
|
|
171
|
+
if ((needsWeb && !capability.web) || (needsNative && !capability.native)) {
|
|
172
|
+
const missing = needsWeb && !capability.web ? 'web' : 'native'
|
|
173
|
+
reasons.push({
|
|
174
|
+
dimension: 'clause',
|
|
175
|
+
modifier,
|
|
176
|
+
message: capability.note ?? `"${modifier}:" is not supported on ${missing}`,
|
|
177
|
+
remedy:
|
|
178
|
+
missing === 'web'
|
|
179
|
+
? `keep the driver-evaluated pseudo prop, or move this usage to a .native.tsx file`
|
|
180
|
+
: `move this usage to a .web.tsx file, or drop the clause on native`,
|
|
181
|
+
})
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (input.host && !input.host.accepts(input.property)) {
|
|
186
|
+
reasons.push({
|
|
187
|
+
dimension: 'host',
|
|
188
|
+
message: `"${input.property}" is not a valid style on ${input.host.displayName ?? 'this component'} — the runtime drops it`,
|
|
189
|
+
remedy: `move this style to a component that accepts it (a Text-based component, or html.* on web)`,
|
|
190
|
+
})
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (reasons.length) return { verdict: 'needs-relocation', reasons }
|
|
194
|
+
|
|
195
|
+
if (!input.host) {
|
|
196
|
+
return {
|
|
197
|
+
verdict: 'unknown-host',
|
|
198
|
+
reasons: [
|
|
199
|
+
{
|
|
200
|
+
dimension: 'host',
|
|
201
|
+
message: `the component's identity could not be established, so host validity for "${input.property}" is unverified`,
|
|
202
|
+
remedy: `verify the component accepts this style prop, or supply type-aware provenance so the check can run`,
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return clean
|
|
209
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { grammarPlatformRank } from './config'
|
|
2
|
+
import {
|
|
3
|
+
canonicalClauseModifier,
|
|
4
|
+
parseContainerModifier,
|
|
5
|
+
parseGroupModifier,
|
|
6
|
+
} from './modifierRegistry'
|
|
7
|
+
|
|
8
|
+
export { canonicalClauseModifier } from './modifierRegistry'
|
|
9
|
+
import {
|
|
10
|
+
grammarMaxNonPlatformDepth,
|
|
11
|
+
type ModifierKind,
|
|
12
|
+
type ModifierRegistryView,
|
|
13
|
+
} from './valueTypes'
|
|
14
|
+
|
|
15
|
+
export { grammarMaxNonPlatformDepth } from './valueTypes'
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The CSS emitter deliberately caps a condition chain at five distinct
|
|
19
|
+
* non-platform conditions. The parser can represent longer chains, but they
|
|
20
|
+
* cannot be lowered while also giving platform clauses a finite specificity
|
|
21
|
+
* floor above every platform-less clause, so the shared comparator rejects
|
|
22
|
+
* them consistently on every surface.
|
|
23
|
+
*/
|
|
24
|
+
export type ClausePrecedenceKey = readonly [
|
|
25
|
+
/** no platform = 0; web/native = 1; ios/android/tv = 2; tvos/androidtv = 3 */
|
|
26
|
+
platformRank: number,
|
|
27
|
+
/** number of distinct non-platform conditions */
|
|
28
|
+
depth: number,
|
|
29
|
+
/** media < container < theme < group < state */
|
|
30
|
+
categoryRank: number,
|
|
31
|
+
/** declaration/lifecycle rank inside the highest category */
|
|
32
|
+
withinCategoryRank: number,
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
export type OrderedModifierNames =
|
|
36
|
+
| readonly string[]
|
|
37
|
+
| ReadonlySet<string>
|
|
38
|
+
| Readonly<Record<string, unknown>>
|
|
39
|
+
|
|
40
|
+
export type ClausePrecedenceOrder = ReadonlyMap<string, number>
|
|
41
|
+
|
|
42
|
+
const categoryRanks: Readonly<Record<Exclude<ModifierKind, 'platform'>, number>> = {
|
|
43
|
+
media: 0,
|
|
44
|
+
container: 1,
|
|
45
|
+
theme: 2,
|
|
46
|
+
group: 3,
|
|
47
|
+
state: 4,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Later lifecycle entries win. Component-tier states follow the interaction
|
|
51
|
+
// states in the order of states.ts's component vocabulary.
|
|
52
|
+
const stateRanks: Readonly<Record<string, number>> = Object.freeze({
|
|
53
|
+
hover: 0,
|
|
54
|
+
'focus-within': 1,
|
|
55
|
+
focus: 2,
|
|
56
|
+
'focus-visible': 3,
|
|
57
|
+
press: 4,
|
|
58
|
+
active: 4,
|
|
59
|
+
pressed: 4,
|
|
60
|
+
disabled: 5,
|
|
61
|
+
enter: 6,
|
|
62
|
+
starting: 6,
|
|
63
|
+
exit: 7,
|
|
64
|
+
ending: 7,
|
|
65
|
+
open: 8,
|
|
66
|
+
checked: 9,
|
|
67
|
+
highlighted: 10,
|
|
68
|
+
selected: 11,
|
|
69
|
+
invalid: 12,
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
export function createClausePrecedenceOrder(
|
|
73
|
+
names: OrderedModifierNames | undefined
|
|
74
|
+
): ClausePrecedenceOrder {
|
|
75
|
+
const ranks = new Map<string, number>()
|
|
76
|
+
if (!names) return ranks
|
|
77
|
+
let rank = 0
|
|
78
|
+
if (Array.isArray(names)) {
|
|
79
|
+
for (const name of names) ranks.set(name, rank++)
|
|
80
|
+
} else if (names instanceof Set) {
|
|
81
|
+
for (const name of names) ranks.set(name, rank++)
|
|
82
|
+
} else {
|
|
83
|
+
for (const name in names as Readonly<Record<string, unknown>>) {
|
|
84
|
+
ranks.set(name, rank++)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return ranks
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function withinCategoryRank(
|
|
91
|
+
modifier: string,
|
|
92
|
+
kind: Exclude<ModifierKind, 'platform'>,
|
|
93
|
+
order: ClausePrecedenceOrder
|
|
94
|
+
): number {
|
|
95
|
+
if (kind === 'media') return order.get(modifier) ?? 0
|
|
96
|
+
if (kind === 'container') {
|
|
97
|
+
const container = parseContainerModifier(modifier)
|
|
98
|
+
return container ? (order.get(container.size) ?? 0) : 0
|
|
99
|
+
}
|
|
100
|
+
if (kind === 'theme') return 0
|
|
101
|
+
if (kind === 'group') {
|
|
102
|
+
const group = parseGroupModifier(modifier)
|
|
103
|
+
return group ? (stateRanks[group.state] ?? 0) : 0
|
|
104
|
+
}
|
|
105
|
+
return stateRanks[modifier] ?? 0
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** Order-insensitive set key used by every clause merge/emission slot. */
|
|
109
|
+
export function clauseConditionSetKey(modifiers: readonly string[]): string {
|
|
110
|
+
if (modifiers.length === 0) return ''
|
|
111
|
+
if (modifiers.length === 1) return canonicalClauseModifier(modifiers[0])
|
|
112
|
+
const unique = new Set(modifiers.map(canonicalClauseModifier))
|
|
113
|
+
return [...unique].sort().join(':')
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function getClausePrecedenceKeyFromKinds(
|
|
117
|
+
modifiers: readonly string[],
|
|
118
|
+
kinds: readonly (ModifierKind | undefined)[],
|
|
119
|
+
order: ClausePrecedenceOrder
|
|
120
|
+
): ClausePrecedenceKey {
|
|
121
|
+
let platformRank = 0
|
|
122
|
+
let categoryRank = 0
|
|
123
|
+
let highestWithinCategoryRank = 0
|
|
124
|
+
const nonPlatform = new Set<string>()
|
|
125
|
+
|
|
126
|
+
for (let index = 0; index < modifiers.length; index++) {
|
|
127
|
+
const modifier = canonicalClauseModifier(modifiers[index])
|
|
128
|
+
const kind = kinds[index]
|
|
129
|
+
if (!kind) continue
|
|
130
|
+
if (kind === 'platform') {
|
|
131
|
+
platformRank = Math.max(platformRank, grammarPlatformRank(modifier))
|
|
132
|
+
continue
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
nonPlatform.add(modifier)
|
|
136
|
+
const nextCategoryRank = categoryRanks[kind]
|
|
137
|
+
const nextWithinCategoryRank = withinCategoryRank(modifier, kind, order)
|
|
138
|
+
if (nextCategoryRank > categoryRank) {
|
|
139
|
+
categoryRank = nextCategoryRank
|
|
140
|
+
highestWithinCategoryRank = nextWithinCategoryRank
|
|
141
|
+
} else if (nextCategoryRank === categoryRank) {
|
|
142
|
+
highestWithinCategoryRank = Math.max(
|
|
143
|
+
highestWithinCategoryRank,
|
|
144
|
+
nextWithinCategoryRank
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const depth = nonPlatform.size
|
|
150
|
+
if (depth > grammarMaxNonPlatformDepth) {
|
|
151
|
+
throw new Error(
|
|
152
|
+
`a flat value clause supports at most ${grammarMaxNonPlatformDepth} non-platform conditions; received ${depth} in "${modifiers.join(':')}:"`
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return [platformRank, depth, categoryRank, highestWithinCategoryRank]
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export function getClausePrecedenceKey(
|
|
160
|
+
modifiers: readonly string[],
|
|
161
|
+
registry: ModifierRegistryView,
|
|
162
|
+
order: ClausePrecedenceOrder
|
|
163
|
+
): ClausePrecedenceKey {
|
|
164
|
+
const kinds: (ModifierKind | undefined)[] = []
|
|
165
|
+
for (let index = 0; index < modifiers.length; index++) {
|
|
166
|
+
kinds.push(registry.get(modifiers[index]))
|
|
167
|
+
}
|
|
168
|
+
return getClausePrecedenceKeyFromKinds(modifiers, kinds, order)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** Ascending comparator: a positive result means `left` wins over `right`. */
|
|
172
|
+
export function compareClausePrecedence(
|
|
173
|
+
left: ClausePrecedenceKey,
|
|
174
|
+
right: ClausePrecedenceKey
|
|
175
|
+
): number {
|
|
176
|
+
for (let index = 0; index < 4; index++) {
|
|
177
|
+
const difference = left[index] - right[index]
|
|
178
|
+
if (difference) return difference
|
|
179
|
+
}
|
|
180
|
+
return 0
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** Target CSS class specificity, excluding IDs/elements: (0, result, 0). */
|
|
184
|
+
export function clauseTargetClassSpecificity(key: ClausePrecedenceKey): number {
|
|
185
|
+
return 1 + key[1] + key[0] * (grammarMaxNonPlatformDepth + 1)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Subject-class repetitions needed after self-state selectors contribute
|
|
190
|
+
* their pseudo/attribute specificity naturally. Theme and group scopes use
|
|
191
|
+
* :where(), while media/container wrappers contribute zero.
|
|
192
|
+
*/
|
|
193
|
+
export function clauseSubjectClassRepetitions(
|
|
194
|
+
key: ClausePrecedenceKey,
|
|
195
|
+
selfStateSpecificity: number
|
|
196
|
+
): number {
|
|
197
|
+
return clauseTargetClassSpecificity(key) - selfStateSpecificity
|
|
198
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* states the native evaluator can source from component state and lifecycle.
|
|
3
|
+
* component-tier states stay web-only until their behavior packages feed them
|
|
4
|
+
* into component state.
|
|
5
|
+
*/
|
|
6
|
+
export const nativeSourceableStates: ReadonlySet<string> = new Set([
|
|
7
|
+
'hover',
|
|
8
|
+
'press',
|
|
9
|
+
'active',
|
|
10
|
+
'focus',
|
|
11
|
+
'focus-visible',
|
|
12
|
+
'focus-within',
|
|
13
|
+
'disabled',
|
|
14
|
+
'enter',
|
|
15
|
+
'exit',
|
|
16
|
+
])
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* states a group clause can source natively through componentState.group.
|
|
20
|
+
*/
|
|
21
|
+
export const nativeGroupSourceableStates: readonly string[] = Object.freeze([
|
|
22
|
+
'hover',
|
|
23
|
+
'press',
|
|
24
|
+
'active',
|
|
25
|
+
'focus',
|
|
26
|
+
'focus-visible',
|
|
27
|
+
'focus-within',
|
|
28
|
+
'disabled',
|
|
29
|
+
])
|
package/src/config.ts
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import type { GrammarConfigView } from './candidate'
|
|
2
|
+
import type { TokenCategory } from './registry'
|
|
3
|
+
|
|
4
|
+
type Names = readonly string[] | ReadonlySet<string> | Readonly<Record<string, unknown>>
|
|
5
|
+
|
|
6
|
+
type GrammarFontConfig = {
|
|
7
|
+
size?: Readonly<Record<string, unknown>>
|
|
8
|
+
weight?: Readonly<Record<string, unknown>>
|
|
9
|
+
lineHeight?: Readonly<Record<string, unknown>>
|
|
10
|
+
letterSpacing?: Readonly<Record<string, unknown>>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type GrammarSourceConfig = {
|
|
14
|
+
shorthands?: Readonly<Record<string, string>>
|
|
15
|
+
media?: Names
|
|
16
|
+
themes?: Readonly<Record<string, unknown>>
|
|
17
|
+
tokensParsed?: Partial<
|
|
18
|
+
Record<
|
|
19
|
+
'space' | 'size' | 'radius' | 'zIndex' | 'color',
|
|
20
|
+
Readonly<Record<string, unknown>>
|
|
21
|
+
>
|
|
22
|
+
>
|
|
23
|
+
fontsParsed?: Readonly<Record<string, GrammarFontConfig | undefined>>
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type CreateGrammarConfigViewOptions = {
|
|
27
|
+
platformNames?: Names
|
|
28
|
+
/** overrides the derived container size set (the web adapter's resolved set) */
|
|
29
|
+
containerSizeNames?: readonly string[]
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The one owner of "does this media query measure a size". A `hover` or
|
|
34
|
+
* `pointer` key measures nothing a container has, so it gets no `@` form.
|
|
35
|
+
* Accepts the query TEXT (`(min-width: 900px)`) or the config's media OBJECT
|
|
36
|
+
* (`{ minWidth: 900 }`) — both spellings of the same fact.
|
|
37
|
+
*/
|
|
38
|
+
export function isContainerSizeQuery(query: unknown): boolean {
|
|
39
|
+
if (typeof query === 'string') {
|
|
40
|
+
return (
|
|
41
|
+
query.includes('width') ||
|
|
42
|
+
query.includes('height') ||
|
|
43
|
+
query.includes('inline-size') ||
|
|
44
|
+
query.includes('block-size')
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
if (query && typeof query === 'object') {
|
|
48
|
+
for (const key in query as Readonly<Record<string, unknown>>) {
|
|
49
|
+
if (/width|height|size/i.test(key)) return true
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return false
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const grammarPlatformNames: ReadonlySet<string> = new Set([
|
|
56
|
+
'web',
|
|
57
|
+
'native',
|
|
58
|
+
'android',
|
|
59
|
+
'ios',
|
|
60
|
+
'tv',
|
|
61
|
+
'androidtv',
|
|
62
|
+
'tvos',
|
|
63
|
+
])
|
|
64
|
+
|
|
65
|
+
export const grammarPlatformGroups: ReadonlyMap<string, ReadonlySet<string>> = new Map([
|
|
66
|
+
['native', new Set(['android', 'ios', 'androidtv', 'tvos'])],
|
|
67
|
+
['tv', new Set(['androidtv', 'tvos'])],
|
|
68
|
+
// react-native-tvos reports Platform.OS 'android'/'ios' on TV devices, so the
|
|
69
|
+
// base platform contains its TV variant (matches runtime platformMatches)
|
|
70
|
+
['android', new Set(['androidtv'])],
|
|
71
|
+
['ios', new Set(['tvos'])],
|
|
72
|
+
])
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Platform clause specificity, mirroring the runtime directStyle ranks: a TV
|
|
76
|
+
* variant beats its base platform, which beats `native`, independent of
|
|
77
|
+
* authored order. Non-platform modifiers never rank.
|
|
78
|
+
*/
|
|
79
|
+
export function grammarPlatformRank(modifier: string): number {
|
|
80
|
+
return modifier === 'native' || modifier === 'web'
|
|
81
|
+
? 1
|
|
82
|
+
: modifier === 'androidtv' || modifier === 'tvos'
|
|
83
|
+
? 3
|
|
84
|
+
: 2
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function addNames(target: Set<string>, source: Names | undefined): void {
|
|
88
|
+
if (!source) return
|
|
89
|
+
if (Array.isArray(source)) {
|
|
90
|
+
for (const key of source) target.add(key)
|
|
91
|
+
return
|
|
92
|
+
}
|
|
93
|
+
if (source instanceof Set) {
|
|
94
|
+
for (const key of source) target.add(key)
|
|
95
|
+
return
|
|
96
|
+
}
|
|
97
|
+
for (const key in source) target.add(key)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Creates the dependency-free config projection consumed by the shared style grammar.
|
|
102
|
+
* Runtime and compiler integrations must classify candidates through this same view so
|
|
103
|
+
* a candidate cannot be claimed by one side and emitted by the other.
|
|
104
|
+
*/
|
|
105
|
+
export function createGrammarConfigView(
|
|
106
|
+
config: GrammarSourceConfig,
|
|
107
|
+
options: CreateGrammarConfigViewOptions = {}
|
|
108
|
+
): GrammarConfigView {
|
|
109
|
+
const tokenNames: Record<TokenCategory, Set<string>> = {
|
|
110
|
+
space: new Set(),
|
|
111
|
+
size: new Set(),
|
|
112
|
+
radius: new Set(),
|
|
113
|
+
zIndex: new Set(),
|
|
114
|
+
color: new Set(),
|
|
115
|
+
fontFamily: new Set(),
|
|
116
|
+
fontSize: new Set(),
|
|
117
|
+
fontWeight: new Set(),
|
|
118
|
+
lineHeight: new Set(),
|
|
119
|
+
letterSpacing: new Set(),
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
for (const category of ['space', 'size', 'radius', 'zIndex', 'color'] as const) {
|
|
123
|
+
addNames(tokenNames[category], config.tokensParsed?.[category])
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
for (const themeName in config.themes) {
|
|
127
|
+
const theme = config.themes[themeName]
|
|
128
|
+
if (theme && typeof theme === 'object' && !Array.isArray(theme)) {
|
|
129
|
+
addNames(tokenNames.color, theme as Readonly<Record<string, unknown>>)
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
for (const familyName in config.fontsParsed) {
|
|
134
|
+
tokenNames.fontFamily.add(familyName)
|
|
135
|
+
const font = config.fontsParsed[familyName]
|
|
136
|
+
addNames(tokenNames.fontSize, font?.size)
|
|
137
|
+
addNames(tokenNames.fontWeight, font?.weight)
|
|
138
|
+
addNames(tokenNames.lineHeight, font?.lineHeight)
|
|
139
|
+
addNames(tokenNames.letterSpacing, font?.letterSpacing)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// container size derivation needs query information, which only the
|
|
143
|
+
// record form of `media` carries (values are media objects or query text).
|
|
144
|
+
// a bare name list stays undefined = unknown, and the modifier registry
|
|
145
|
+
// refuses container claims for it rather than guessing
|
|
146
|
+
let containerSizeNames = options.containerSizeNames
|
|
147
|
+
if (
|
|
148
|
+
containerSizeNames === undefined &&
|
|
149
|
+
config.media &&
|
|
150
|
+
!Array.isArray(config.media) &&
|
|
151
|
+
!(config.media instanceof Set)
|
|
152
|
+
) {
|
|
153
|
+
const derived: string[] = []
|
|
154
|
+
const media = config.media as Readonly<Record<string, unknown>>
|
|
155
|
+
for (const key in media) {
|
|
156
|
+
if (isContainerSizeQuery(media[key])) derived.push(key)
|
|
157
|
+
}
|
|
158
|
+
containerSizeNames = derived
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return {
|
|
162
|
+
shorthands: config.shorthands,
|
|
163
|
+
mediaNames: config.media,
|
|
164
|
+
themeNames: config.themes,
|
|
165
|
+
platformNames: options.platformNames ?? grammarPlatformNames,
|
|
166
|
+
tokenNames,
|
|
167
|
+
containerSizeNames,
|
|
168
|
+
}
|
|
169
|
+
}
|