@velarscript/web 0.31.0 → 0.33.0
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/README.md +1 -1
- package/dist/analysis/calls/intrinsics/config.d.ts +10 -0
- package/dist/analysis/calls/intrinsics/config.d.ts.map +1 -0
- package/dist/analysis/calls/intrinsics/config.js +19 -0
- package/dist/analysis/calls/intrinsics/config.js.map +1 -0
- package/dist/analysis/calls/intrinsics/forms.d.ts +10 -0
- package/dist/analysis/calls/intrinsics/forms.d.ts.map +1 -0
- package/dist/analysis/calls/intrinsics/forms.js +38 -0
- package/dist/analysis/calls/intrinsics/forms.js.map +1 -0
- package/dist/analysis/calls/intrinsics/http.d.ts +10 -0
- package/dist/analysis/calls/intrinsics/http.d.ts.map +1 -0
- package/dist/analysis/calls/intrinsics/http.js +37 -0
- package/dist/analysis/calls/intrinsics/http.js.map +1 -0
- package/dist/analysis/calls/intrinsics/reactive.d.ts +10 -0
- package/dist/analysis/calls/intrinsics/reactive.d.ts.map +1 -0
- package/dist/analysis/calls/intrinsics/reactive.js +30 -0
- package/dist/analysis/calls/intrinsics/reactive.js.map +1 -0
- package/dist/analysis/calls/intrinsics/storage.d.ts +16 -0
- package/dist/analysis/calls/intrinsics/storage.d.ts.map +1 -0
- package/dist/analysis/calls/intrinsics/storage.js +91 -0
- package/dist/analysis/calls/intrinsics/storage.js.map +1 -0
- package/dist/analysis/calls/intrinsics/web.d.ts +10 -0
- package/dist/analysis/calls/intrinsics/web.d.ts.map +1 -0
- package/dist/analysis/calls/intrinsics/web.js +100 -0
- package/dist/analysis/calls/intrinsics/web.js.map +1 -0
- package/dist/analysis/calls/intrinsics.d.ts +13 -0
- package/dist/analysis/calls/intrinsics.d.ts.map +1 -0
- package/dist/analysis/calls/intrinsics.js +31 -0
- package/dist/analysis/calls/intrinsics.js.map +1 -0
- package/dist/analysis/components/contracts.d.ts +19 -0
- package/dist/analysis/components/contracts.d.ts.map +1 -0
- package/dist/analysis/components/contracts.js +83 -0
- package/dist/analysis/components/contracts.js.map +1 -0
- package/dist/analysis/components/declaration.d.ts +4 -0
- package/dist/analysis/components/declaration.d.ts.map +1 -0
- package/dist/analysis/components/declaration.js +163 -0
- package/dist/analysis/components/declaration.js.map +1 -0
- package/dist/analysis/components/host.d.ts +61 -0
- package/dist/analysis/components/host.d.ts.map +1 -0
- package/dist/analysis/components/host.js +22 -0
- package/dist/analysis/components/host.js.map +1 -0
- package/dist/analysis/components/lifecycle.d.ts +22 -0
- package/dist/analysis/components/lifecycle.d.ts.map +1 -0
- package/dist/analysis/components/lifecycle.js +33 -0
- package/dist/analysis/components/lifecycle.js.map +1 -0
- package/dist/analysis/components/ownership.d.ts +74 -0
- package/dist/analysis/components/ownership.d.ts.map +1 -0
- package/dist/analysis/components/ownership.js +106 -0
- package/dist/analysis/components/ownership.js.map +1 -0
- package/dist/analysis/declarations.d.ts +99 -0
- package/dist/analysis/declarations.d.ts.map +1 -0
- package/dist/analysis/declarations.js +176 -0
- package/dist/analysis/declarations.js.map +1 -0
- package/dist/analysis/inference.d.ts +75 -0
- package/dist/analysis/inference.d.ts.map +1 -0
- package/dist/analysis/inference.js +257 -0
- package/dist/analysis/inference.js.map +1 -0
- package/dist/analysis/jsx/attributes.d.ts +103 -0
- package/dist/analysis/jsx/attributes.d.ts.map +1 -0
- package/dist/analysis/jsx/attributes.js +601 -0
- package/dist/analysis/jsx/attributes.js.map +1 -0
- package/dist/analysis/jsx/elements.d.ts +17 -0
- package/dist/analysis/jsx/elements.d.ts.map +1 -0
- package/dist/analysis/jsx/elements.js +213 -0
- package/dist/analysis/jsx/elements.js.map +1 -0
- package/dist/analysis/jsx/host.d.ts +61 -0
- package/dist/analysis/jsx/host.d.ts.map +1 -0
- package/dist/analysis/jsx/host.js +15 -0
- package/dist/analysis/jsx/host.js.map +1 -0
- package/dist/analysis/jsx/keys.d.ts +15 -0
- package/dist/analysis/jsx/keys.d.ts.map +1 -0
- package/dist/analysis/jsx/keys.js +67 -0
- package/dist/analysis/jsx/keys.js.map +1 -0
- package/dist/analysis/jsx/security.d.ts +29 -0
- package/dist/analysis/jsx/security.d.ts.map +1 -0
- package/dist/analysis/jsx/security.js +61 -0
- package/dist/analysis/jsx/security.js.map +1 -0
- package/dist/analysis/jsx-detection.d.ts +49 -0
- package/dist/analysis/jsx-detection.d.ts.map +1 -0
- package/dist/analysis/jsx-detection.js +196 -0
- package/dist/analysis/jsx-detection.js.map +1 -0
- package/dist/analysis/keyed-rebuild.d.ts +148 -0
- package/dist/analysis/keyed-rebuild.d.ts.map +1 -0
- package/dist/analysis/keyed-rebuild.js +299 -0
- package/dist/analysis/keyed-rebuild.js.map +1 -0
- package/dist/analysis/keyframes-analysis.d.ts +6 -0
- package/dist/analysis/keyframes-analysis.d.ts.map +1 -0
- package/dist/analysis/keyframes-analysis.js +79 -0
- package/dist/analysis/keyframes-analysis.js.map +1 -0
- package/dist/analysis/look/builders.d.ts +29 -0
- package/dist/analysis/look/builders.d.ts.map +1 -0
- package/dist/analysis/look/builders.js +174 -0
- package/dist/analysis/look/builders.js.map +1 -0
- package/dist/analysis/look/conditions.d.ts +13 -0
- package/dist/analysis/look/conditions.d.ts.map +1 -0
- package/dist/analysis/look/conditions.js +84 -0
- package/dist/analysis/look/conditions.js.map +1 -0
- package/dist/analysis/look/edits.d.ts +36 -0
- package/dist/analysis/look/edits.d.ts.map +1 -0
- package/dist/analysis/look/edits.js +80 -0
- package/dist/analysis/look/edits.js.map +1 -0
- package/dist/analysis/look/entries.d.ts +56 -0
- package/dist/analysis/look/entries.d.ts.map +1 -0
- package/dist/analysis/look/entries.js +223 -0
- package/dist/analysis/look/entries.js.map +1 -0
- package/dist/analysis/look/host.d.ts +47 -0
- package/dist/analysis/look/host.d.ts.map +1 -0
- package/dist/analysis/look/host.js +16 -0
- package/dist/analysis/look/host.js.map +1 -0
- package/dist/analysis/look/tokens.d.ts +75 -0
- package/dist/analysis/look/tokens.d.ts.map +1 -0
- package/dist/analysis/look/tokens.js +156 -0
- package/dist/analysis/look/tokens.js.map +1 -0
- package/dist/analysis/look/values.d.ts +45 -0
- package/dist/analysis/look/values.d.ts.map +1 -0
- package/dist/analysis/look/values.js +148 -0
- package/dist/analysis/look/values.js.map +1 -0
- package/dist/analysis/look-conditions.d.ts +47 -0
- package/dist/analysis/look-conditions.d.ts.map +1 -0
- package/dist/analysis/look-conditions.js +157 -0
- package/dist/analysis/look-conditions.js.map +1 -0
- package/dist/analysis/look-sites.d.ts +62 -0
- package/dist/analysis/look-sites.d.ts.map +1 -0
- package/dist/analysis/look-sites.js +121 -0
- package/dist/analysis/look-sites.js.map +1 -0
- package/dist/analysis/look-values.d.ts +19 -0
- package/dist/analysis/look-values.d.ts.map +1 -1
- package/dist/analysis/look-values.js +38 -0
- package/dist/analysis/look-values.js.map +1 -1
- package/dist/analysis/look-vocabulary-guidance.d.ts +76 -0
- package/dist/analysis/look-vocabulary-guidance.d.ts.map +1 -0
- package/dist/analysis/look-vocabulary-guidance.js +338 -0
- package/dist/analysis/look-vocabulary-guidance.js.map +1 -0
- package/dist/analysis/media-conditions.d.ts +33 -0
- package/dist/analysis/media-conditions.d.ts.map +1 -0
- package/dist/analysis/media-conditions.js +92 -0
- package/dist/analysis/media-conditions.js.map +1 -0
- package/dist/analysis/program-passes.d.ts +106 -0
- package/dist/analysis/program-passes.d.ts.map +1 -0
- package/dist/analysis/program-passes.js +149 -0
- package/dist/analysis/program-passes.js.map +1 -0
- package/dist/analysis/reactivity/bindings.d.ts +37 -0
- package/dist/analysis/reactivity/bindings.d.ts.map +1 -0
- package/dist/analysis/reactivity/bindings.js +88 -0
- package/dist/analysis/reactivity/bindings.js.map +1 -0
- package/dist/analysis/reactivity/derived.d.ts +39 -0
- package/dist/analysis/reactivity/derived.d.ts.map +1 -0
- package/dist/analysis/reactivity/derived.js +80 -0
- package/dist/analysis/reactivity/derived.js.map +1 -0
- package/dist/analysis/reactivity/host.d.ts +38 -0
- package/dist/analysis/reactivity/host.d.ts.map +1 -0
- package/dist/analysis/reactivity/host.js +14 -0
- package/dist/analysis/reactivity/host.js.map +1 -0
- package/dist/analysis/reactivity/retired-accessors.d.ts +82 -0
- package/dist/analysis/reactivity/retired-accessors.d.ts.map +1 -0
- package/dist/analysis/reactivity/retired-accessors.js +118 -0
- package/dist/analysis/reactivity/retired-accessors.js.map +1 -0
- package/dist/analysis/renderable.d.ts +47 -0
- package/dist/analysis/renderable.d.ts.map +1 -0
- package/dist/analysis/renderable.js +105 -0
- package/dist/analysis/renderable.js.map +1 -0
- package/dist/analysis/routes.d.ts +64 -0
- package/dist/analysis/routes.d.ts.map +1 -0
- package/dist/analysis/routes.js +182 -0
- package/dist/analysis/routes.js.map +1 -0
- package/dist/analysis/url-attributes.d.ts +12 -0
- package/dist/analysis/url-attributes.d.ts.map +1 -0
- package/dist/analysis/url-attributes.js +48 -0
- package/dist/analysis/url-attributes.js.map +1 -0
- package/dist/analysis/watch-cycles.d.ts +102 -0
- package/dist/analysis/watch-cycles.d.ts.map +1 -1
- package/dist/analysis/watch-cycles.js +240 -1
- package/dist/analysis/watch-cycles.js.map +1 -1
- package/dist/analysis/watch-subject.d.ts +45 -0
- package/dist/analysis/watch-subject.d.ts.map +1 -0
- package/dist/analysis/watch-subject.js +272 -0
- package/dist/analysis/watch-subject.js.map +1 -0
- package/dist/analysis/web-types.d.ts +27 -0
- package/dist/analysis/web-types.d.ts.map +1 -0
- package/dist/analysis/web-types.js +170 -0
- package/dist/analysis/web-types.js.map +1 -0
- package/dist/analyzer.d.ts +18 -617
- package/dist/analyzer.d.ts.map +1 -1
- package/dist/analyzer.js +211 -4853
- package/dist/analyzer.js.map +1 -1
- package/dist/compiler.d.ts +20 -0
- package/dist/compiler.d.ts.map +1 -1
- package/dist/compiler.js +31 -864
- package/dist/compiler.js.map +1 -1
- package/dist/documentation.d.ts +28 -0
- package/dist/documentation.d.ts.map +1 -0
- package/dist/documentation.js +67 -0
- package/dist/documentation.js.map +1 -0
- package/dist/editor/completions.d.ts +12 -0
- package/dist/editor/completions.d.ts.map +1 -0
- package/dist/editor/completions.js +6 -0
- package/dist/editor/completions.js.map +1 -0
- package/dist/editor/jsx-completion.d.ts +12 -0
- package/dist/editor/jsx-completion.d.ts.map +1 -0
- package/dist/editor/jsx-completion.js +137 -0
- package/dist/editor/jsx-completion.js.map +1 -0
- package/dist/editor/look-completion.d.ts +29 -0
- package/dist/editor/look-completion.d.ts.map +1 -0
- package/dist/editor/look-completion.js +159 -0
- package/dist/editor/look-completion.js.map +1 -0
- package/dist/editor.d.ts.map +1 -1
- package/dist/editor.js +12 -288
- package/dist/editor.js.map +1 -1
- package/dist/emit/components.d.ts +33 -0
- package/dist/emit/components.d.ts.map +1 -0
- package/dist/emit/components.js +135 -0
- package/dist/emit/components.js.map +1 -0
- package/dist/emit/jsx.d.ts +57 -0
- package/dist/emit/jsx.d.ts.map +1 -0
- package/dist/emit/jsx.js +384 -0
- package/dist/emit/jsx.js.map +1 -0
- package/dist/emit/look-css.d.ts +44 -0
- package/dist/emit/look-css.d.ts.map +1 -0
- package/dist/emit/look-css.js +177 -0
- package/dist/emit/look-css.js.map +1 -0
- package/dist/emit/look.d.ts +39 -0
- package/dist/emit/look.d.ts.map +1 -0
- package/dist/emit/look.js +218 -0
- package/dist/emit/look.js.map +1 -0
- package/dist/emit/runtime-imports.d.ts +40 -0
- package/dist/emit/runtime-imports.d.ts.map +1 -0
- package/dist/emit/runtime-imports.js +188 -0
- package/dist/emit/runtime-imports.js.map +1 -0
- package/dist/emitter.d.ts +15 -68
- package/dist/emitter.d.ts.map +1 -1
- package/dist/emitter.js +79 -1008
- package/dist/emitter.js.map +1 -1
- package/dist/look/animation.d.ts +7 -0
- package/dist/look/animation.d.ts.map +1 -0
- package/dist/look/animation.js +13 -0
- package/dist/look/animation.js.map +1 -0
- package/dist/look/builders.d.ts +35 -0
- package/dist/look/builders.d.ts.map +1 -0
- package/dist/look/builders.js +74 -0
- package/dist/look/builders.js.map +1 -0
- package/dist/look/css-functions.d.ts +28 -0
- package/dist/look/css-functions.d.ts.map +1 -0
- package/dist/look/css-functions.js +54 -0
- package/dist/look/css-functions.js.map +1 -0
- package/dist/look/keyword-sets.d.ts +41 -0
- package/dist/look/keyword-sets.d.ts.map +1 -0
- package/dist/look/keyword-sets.js +117 -0
- package/dist/look/keyword-sets.js.map +1 -0
- package/dist/look/keywords.d.ts +55 -0
- package/dist/look/keywords.d.ts.map +1 -0
- package/dist/look/keywords.js +387 -0
- package/dist/look/keywords.js.map +1 -0
- package/dist/look/media.d.ts +19 -0
- package/dist/look/media.d.ts.map +1 -0
- package/dist/look/media.js +27 -0
- package/dist/look/media.js.map +1 -0
- package/dist/look/naming.d.ts +9 -0
- package/dist/look/naming.d.ts.map +1 -0
- package/dist/look/naming.js +45 -0
- package/dist/look/naming.js.map +1 -0
- package/dist/look/properties.d.ts +16 -0
- package/dist/look/properties.d.ts.map +1 -0
- package/dist/look/properties.js +52 -0
- package/dist/look/properties.js.map +1 -0
- package/dist/look/shorthands.d.ts +25 -0
- package/dist/look/shorthands.d.ts.map +1 -0
- package/dist/look/shorthands.js +130 -0
- package/dist/look/shorthands.js.map +1 -0
- package/dist/look/tokens.d.ts +38 -0
- package/dist/look/tokens.d.ts.map +1 -0
- package/dist/look/tokens.js +59 -0
- package/dist/look/tokens.js.map +1 -0
- package/dist/look/units.d.ts +24 -0
- package/dist/look/units.d.ts.map +1 -0
- package/dist/look/units.js +33 -0
- package/dist/look/units.js.map +1 -0
- package/dist/look.d.ts +32 -227
- package/dist/look.d.ts.map +1 -1
- package/dist/look.js +28 -933
- package/dist/look.js.map +1 -1
- package/dist/module-roster.d.ts +16 -0
- package/dist/module-roster.d.ts.map +1 -0
- package/dist/module-roster.js +28 -0
- package/dist/module-roster.js.map +1 -0
- package/dist/modules/app.d.ts +9 -0
- package/dist/modules/app.d.ts.map +1 -0
- package/dist/modules/app.js +20 -0
- package/dist/modules/app.js.map +1 -0
- package/dist/modules/browser-test.d.ts +9 -0
- package/dist/modules/browser-test.d.ts.map +1 -0
- package/dist/modules/browser-test.js +67 -0
- package/dist/modules/browser-test.js.map +1 -0
- package/dist/modules/browser.d.ts +10 -0
- package/dist/modules/browser.d.ts.map +1 -0
- package/dist/modules/browser.js +89 -0
- package/dist/modules/browser.js.map +1 -0
- package/dist/modules/config.d.ts +9 -0
- package/dist/modules/config.d.ts.map +1 -0
- package/dist/modules/config.js +14 -0
- package/dist/modules/config.js.map +1 -0
- package/dist/modules/files.d.ts +9 -0
- package/dist/modules/files.d.ts.map +1 -0
- package/dist/modules/files.js +16 -0
- package/dist/modules/files.js.map +1 -0
- package/dist/modules/forms.d.ts +9 -0
- package/dist/modules/forms.d.ts.map +1 -0
- package/dist/modules/forms.js +26 -0
- package/dist/modules/forms.js.map +1 -0
- package/dist/modules/http.d.ts +9 -0
- package/dist/modules/http.d.ts.map +1 -0
- package/dist/modules/http.js +127 -0
- package/dist/modules/http.js.map +1 -0
- package/dist/modules/look.d.ts +9 -0
- package/dist/modules/look.d.ts.map +1 -0
- package/dist/modules/look.js +58 -0
- package/dist/modules/look.js.map +1 -0
- package/dist/modules/realtime.d.ts +9 -0
- package/dist/modules/realtime.d.ts.map +1 -0
- package/dist/modules/realtime.js +163 -0
- package/dist/modules/realtime.js.map +1 -0
- package/dist/modules/storage.d.ts +9 -0
- package/dist/modules/storage.d.ts.map +1 -0
- package/dist/modules/storage.js +59 -0
- package/dist/modules/storage.js.map +1 -0
- package/dist/modules/types.d.ts +78 -0
- package/dist/modules/types.d.ts.map +1 -0
- package/dist/modules/types.js +154 -0
- package/dist/modules/types.js.map +1 -0
- package/dist/modules/web.d.ts +9 -0
- package/dist/modules/web.d.ts.map +1 -0
- package/dist/modules/web.js +63 -0
- package/dist/modules/web.js.map +1 -0
- package/dist/modules/websocket.d.ts +11 -0
- package/dist/modules/websocket.d.ts.map +1 -0
- package/dist/modules/websocket.js +75 -0
- package/dist/modules/websocket.js.map +1 -0
- package/dist/parser/expressions/jsx.d.ts +17 -0
- package/dist/parser/expressions/jsx.d.ts.map +1 -0
- package/dist/parser/expressions/jsx.js +43 -0
- package/dist/parser/expressions/jsx.js.map +1 -0
- package/dist/parser/expressions/keyframes.d.ts +15 -0
- package/dist/parser/expressions/keyframes.d.ts.map +1 -0
- package/dist/parser/expressions/keyframes.js +33 -0
- package/dist/parser/expressions/keyframes.js.map +1 -0
- package/dist/parser/expressions/look.d.ts +16 -0
- package/dist/parser/expressions/look.d.ts.map +1 -0
- package/dist/parser/expressions/look.js +37 -0
- package/dist/parser/expressions/look.js.map +1 -0
- package/dist/parser/expressions/visual-block.d.ts +17 -0
- package/dist/parser/expressions/visual-block.d.ts.map +1 -0
- package/dist/parser/expressions/visual-block.js +21 -0
- package/dist/parser/expressions/visual-block.js.map +1 -0
- package/dist/parser/keyframes-source.d.ts +24 -0
- package/dist/parser/keyframes-source.d.ts.map +1 -0
- package/dist/parser/keyframes-source.js +133 -0
- package/dist/parser/keyframes-source.js.map +1 -0
- package/dist/parser/look-source.d.ts +25 -0
- package/dist/parser/look-source.d.ts.map +1 -0
- package/dist/parser/look-source.js +189 -0
- package/dist/parser/look-source.js.map +1 -0
- package/dist/parser/spans.d.ts +24 -0
- package/dist/parser/spans.d.ts.map +1 -0
- package/dist/parser/spans.js +113 -0
- package/dist/parser/spans.js.map +1 -0
- package/dist/parser/statements/components.d.ts +37 -0
- package/dist/parser/statements/components.d.ts.map +1 -0
- package/dist/parser/statements/components.js +185 -0
- package/dist/parser/statements/components.js.map +1 -0
- package/dist/parser/statements/heads.d.ts +38 -0
- package/dist/parser/statements/heads.d.ts.map +1 -0
- package/dist/parser/statements/heads.js +55 -0
- package/dist/parser/statements/heads.js.map +1 -0
- package/dist/parser/statements/imports.d.ts +9 -0
- package/dist/parser/statements/imports.d.ts.map +1 -0
- package/dist/parser/statements/imports.js +31 -0
- package/dist/parser/statements/imports.js.map +1 -0
- package/dist/parser/statements/reactive.d.ts +31 -0
- package/dist/parser/statements/reactive.d.ts.map +1 -0
- package/dist/parser/statements/reactive.js +68 -0
- package/dist/parser/statements/reactive.js.map +1 -0
- package/dist/parser/statements/unsafe-css.d.ts +21 -0
- package/dist/parser/statements/unsafe-css.d.ts.map +1 -0
- package/dist/parser/statements/unsafe-css.js +42 -0
- package/dist/parser/statements/unsafe-css.js.map +1 -0
- package/dist/parser.d.ts +37 -50
- package/dist/parser.d.ts.map +1 -1
- package/dist/parser.js +98 -882
- package/dist/parser.js.map +1 -1
- package/dist/runtime-sources.generated.d.ts +1 -1
- package/dist/runtime-sources.generated.d.ts.map +1 -1
- package/dist/runtime-sources.generated.js +4 -4
- package/dist/runtime-sources.generated.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Look condition as the emitter will key it: the lowered atom each term
|
|
3
|
+
* becomes, the scope key a whole condition folds to, and what a module's Look
|
|
4
|
+
* declarations contribute to a property once every branch is read.
|
|
5
|
+
*
|
|
6
|
+
* D115 P4 R3a: the duplicate-property scope and the cascade both ask this, and
|
|
7
|
+
* neither asks it of the analyzer's state, so it is written once here.
|
|
8
|
+
*/
|
|
9
|
+
import {} from "@velarscript/compiler/extension";
|
|
10
|
+
import { isWebExpression, isWebLook } from "../ast.js";
|
|
11
|
+
import { evaluateLookStaticExpression, lookStaticCss } from "../look-static.js";
|
|
12
|
+
import { LOOK_MEDIA_LENGTH_UNITS } from "../look.js";
|
|
13
|
+
import { isViewportComparison, lookKebab, lookRuntimeSignature } from "./media-conditions.js";
|
|
14
|
+
/**
|
|
15
|
+
* VEL5045: the selector/runtime terms one Look condition may expand to. A
|
|
16
|
+
* conjunction multiplies its two sides, so nesting is what the cap is against.
|
|
17
|
+
* Both readings of a condition stop there — the terms folded below, and the
|
|
18
|
+
* count `look-sites.ts` takes — so neither can run away on a written nesting.
|
|
19
|
+
*/
|
|
20
|
+
export const LOOK_CONDITION_TERM_LIMIT = 32;
|
|
21
|
+
const lookOperatorNames = new Map([["<", "lt"], ["<=", "lte"], [">", "gt"], [">=", "gte"]]);
|
|
22
|
+
const lookNegatedOperators = new Map([["<", ">="], ["<=", ">"], [">", "<="], [">=", "<"]]);
|
|
23
|
+
/**
|
|
24
|
+
* LOK-I5: the duplicate-property scope used to key on the *written* condition,
|
|
25
|
+
* while the emitter keys its rules on the *lowered* one. `if scheme.dark:` and
|
|
26
|
+
* `if not scheme.light:` are the same condition by the charter's own words, so
|
|
27
|
+
* one silently overwrote the other and the loser was never reported. These
|
|
28
|
+
* atoms mirror the emitter's lowering exactly — a scheme and a reduced-motion
|
|
29
|
+
* negation name the other side of the query, and a negated breakpoint flips its
|
|
30
|
+
* operator — so the scope key is the token the rule ends up carrying.
|
|
31
|
+
*/
|
|
32
|
+
function lookConditionAtom(expression, negated, staticValues) {
|
|
33
|
+
if (isWebExpression(expression) && expression.kind === "ExtensionExpression:web:look-hook") {
|
|
34
|
+
return `${negated ? "not-" : ""}${lookKebab(expression.name)}`;
|
|
35
|
+
}
|
|
36
|
+
if (expression.kind === "MemberExpression" && expression.object.kind === "IdentifierExpression") {
|
|
37
|
+
if (expression.object.name === "motion") {
|
|
38
|
+
return expression.property === "reduced" ? `motion-${negated ? "no-preference" : "reduce"}` : null;
|
|
39
|
+
}
|
|
40
|
+
if (expression.object.name === "scheme" && (expression.property === "dark" || expression.property === "light")) {
|
|
41
|
+
return `scheme-${negated ? (expression.property === "dark" ? "light" : "dark") : expression.property}`;
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
if (!isViewportComparison(expression))
|
|
46
|
+
return null;
|
|
47
|
+
const comparison = expression;
|
|
48
|
+
const threshold = evaluateLookStaticExpression(comparison.right, staticValues);
|
|
49
|
+
if (threshold?.kind !== "unit" || !LOOK_MEDIA_LENGTH_UNITS.has(threshold.unit))
|
|
50
|
+
return null;
|
|
51
|
+
const property = comparison.left.property;
|
|
52
|
+
const operator = negated ? lookNegatedOperators.get(comparison.operator) : comparison.operator;
|
|
53
|
+
return `viewport-${property}-${lookOperatorNames.get(operator)}-${lookStaticCss(threshold)}`;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* One Look condition as the set of alternatives it lowers to, each alternative
|
|
57
|
+
* being the sorted atoms that must hold together. Two conditions share a
|
|
58
|
+
* duplicate-detection scope exactly when this rendering matches, so a condition
|
|
59
|
+
* written the other way round, negated into its complement, or spelled with its
|
|
60
|
+
* operands swapped lands in the scope its rule will actually occupy.
|
|
61
|
+
*/
|
|
62
|
+
export function lookConditionKey(expression, negated, staticValues) {
|
|
63
|
+
const terms = lookConditionTerms(expression, negated, staticValues);
|
|
64
|
+
return terms.map((term) => [...term].sort().join("+")).sort().join("|");
|
|
65
|
+
}
|
|
66
|
+
function lookConditionTerms(expression, negated, staticValues) {
|
|
67
|
+
if (expression.kind === "UnaryExpression" && expression.operator === "not") {
|
|
68
|
+
return lookConditionTerms(expression.operand, !negated, staticValues);
|
|
69
|
+
}
|
|
70
|
+
if (expression.kind === "BinaryExpression" && (expression.operator === "and" || expression.operator === "or")) {
|
|
71
|
+
const conjunction = (expression.operator === "and") !== negated;
|
|
72
|
+
const left = lookConditionTerms(expression.left, negated, staticValues);
|
|
73
|
+
const right = lookConditionTerms(expression.right, negated, staticValues);
|
|
74
|
+
if (!conjunction)
|
|
75
|
+
return [...left, ...right].slice(0, LOOK_CONDITION_TERM_LIMIT);
|
|
76
|
+
const combined = [];
|
|
77
|
+
for (const first of left) {
|
|
78
|
+
for (const second of right) {
|
|
79
|
+
combined.push([...first, ...second]);
|
|
80
|
+
if (combined.length >= LOOK_CONDITION_TERM_LIMIT)
|
|
81
|
+
return combined;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return combined;
|
|
85
|
+
}
|
|
86
|
+
const atom = lookConditionAtom(expression, negated, staticValues);
|
|
87
|
+
return [[atom ?? `rt:${negated ? "!" : ""}${lookRuntimeSignature(expression)}`]];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Every `const name = look:` in the module, wherever it is written. A name
|
|
91
|
+
* declared twice maps to null: two different Look literals under one name make
|
|
92
|
+
* the composition question unanswerable, so the check that reads this map
|
|
93
|
+
* declines rather than guessing which one an element received.
|
|
94
|
+
*/
|
|
95
|
+
export function collectLookDeclarations(program) {
|
|
96
|
+
const looks = new Map();
|
|
97
|
+
const visit = (value) => {
|
|
98
|
+
if (Array.isArray(value)) {
|
|
99
|
+
for (const item of value)
|
|
100
|
+
visit(item);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (!value || typeof value !== "object")
|
|
104
|
+
return;
|
|
105
|
+
const record = value;
|
|
106
|
+
if (record.kind === "VariableDeclaration") {
|
|
107
|
+
const declaration = record;
|
|
108
|
+
if (declaration.binding === "const" && declaration.pattern.kind === "NameBindingPattern" && isWebLook(declaration.initializer)) {
|
|
109
|
+
looks.set(declaration.pattern.name, looks.has(declaration.pattern.name) ? null : declaration.initializer);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
for (const [key, child] of Object.entries(record))
|
|
113
|
+
if (key !== "span")
|
|
114
|
+
visit(child);
|
|
115
|
+
};
|
|
116
|
+
visit(program.body);
|
|
117
|
+
return looks;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* The properties one Look sets, each keyed by the target it sets them on so a
|
|
121
|
+
* `@before:` colour and an element colour stay two different decisions. The
|
|
122
|
+
* condition is deliberately not part of the key: two looks that set one
|
|
123
|
+
* property under conditions that can both hold are exactly the ambiguity this
|
|
124
|
+
* serves. A `...spread` of another look is followed, and the names followed are
|
|
125
|
+
* reported back, because composing is what makes two looks ordered rather than
|
|
126
|
+
* independent.
|
|
127
|
+
*/
|
|
128
|
+
export function lookContributions(look, looks, visited = new Set()) {
|
|
129
|
+
const properties = new Set();
|
|
130
|
+
const composed = new Set();
|
|
131
|
+
const walk = (entries, target) => {
|
|
132
|
+
for (const entry of entries) {
|
|
133
|
+
if (entry.kind === "LookProperty")
|
|
134
|
+
properties.add(`${target}:${entry.name}`);
|
|
135
|
+
else if (entry.kind === "LookIf") {
|
|
136
|
+
walk(entry.thenEntries, target);
|
|
137
|
+
walk(entry.elseEntries, target);
|
|
138
|
+
}
|
|
139
|
+
else if (entry.kind === "LookTarget")
|
|
140
|
+
walk(entry.entries, entry.name);
|
|
141
|
+
else if (entry.kind === "LookSpread" && entry.value.kind === "IdentifierExpression" && !visited.has(entry.value.name)) {
|
|
142
|
+
const source = looks.get(entry.value.name);
|
|
143
|
+
composed.add(entry.value.name);
|
|
144
|
+
if (!source)
|
|
145
|
+
continue;
|
|
146
|
+
const inner = lookContributions(source, looks, new Set([...visited, entry.value.name]));
|
|
147
|
+
for (const property of inner.properties)
|
|
148
|
+
properties.add(property);
|
|
149
|
+
for (const name of inner.composed)
|
|
150
|
+
composed.add(name);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
walk(look.entries, "");
|
|
155
|
+
return { properties, composed };
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=look-conditions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"look-conditions.js","sourceRoot":"","sources":["../../src/analysis/look-conditions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAiD,MAAM,iCAAiC,CAAC;AAChG,OAAO,EAAE,eAAe,EAAE,SAAS,EAA0B,MAAM,WAAW,CAAC;AAC/E,OAAO,EAAE,4BAA4B,EAAE,aAAa,EAAwB,MAAM,mBAAmB,CAAC;AACtG,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE9F;;;;;GAKG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAE5C,MAAM,iBAAiB,GAAgC,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,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,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBACxF,KAAK,MAAM,QAAQ,IAAI,KAAK,CAAC,UAAU;oBAAE,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;gBAClE,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,QAAQ;oBAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACxD,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IACF,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACvB,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a module's Look values and Look imports are written, and the small
|
|
3
|
+
* readings of one written value a check needs: the builder names in scope, a
|
|
4
|
+
* condition's term count, the first relative CSS asset an unsafe stylesheet
|
|
5
|
+
* addresses, and whether a declared domain mentions a spelled visual unit.
|
|
6
|
+
*
|
|
7
|
+
* D115 P4 R3a: each is a question about a program or a node rather than about
|
|
8
|
+
* the analyzer, so they read as a module.
|
|
9
|
+
*/
|
|
10
|
+
import { type Span } from "@velarscript/compiler";
|
|
11
|
+
import { type Expression, type Program, type ValueType } from "@velarscript/compiler/extension";
|
|
12
|
+
/**
|
|
13
|
+
* D103: where one Look value was written — which property it sets, the span of
|
|
14
|
+
* the whole entry, and the directive spelling if it is one. A migration needs
|
|
15
|
+
* all three, because a `look:property="text"` attribute and a
|
|
16
|
+
* `property = "text"` block entry are rewritten differently.
|
|
17
|
+
*/
|
|
18
|
+
export interface LookValueSite {
|
|
19
|
+
readonly property: string;
|
|
20
|
+
readonly entrySpan: Span;
|
|
21
|
+
readonly directive: "look" | "style" | null;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* D103: where a migration writes a `velar/look` import. `declaration` is the
|
|
25
|
+
* module's existing import of that module when it has one, so the rewrite grows
|
|
26
|
+
* that line rather than adding a second import of the same module; `insertAt`
|
|
27
|
+
* is where a first one goes otherwise — after the last import, or before the
|
|
28
|
+
* first statement of a module with none.
|
|
29
|
+
*/
|
|
30
|
+
export interface LookImportSite {
|
|
31
|
+
readonly declaration: {
|
|
32
|
+
readonly span: Span;
|
|
33
|
+
/**
|
|
34
|
+
* D114 WB-I2: `reads` is how many times this module names the specifier's
|
|
35
|
+
* local — every identifier read of it, the import line itself excluded. A
|
|
36
|
+
* rewrite that consumes the last one leaves the specifier behind naming
|
|
37
|
+
* nothing, so the import edit needs the count to know whether the name it
|
|
38
|
+
* is replacing still has a reader.
|
|
39
|
+
*/
|
|
40
|
+
readonly specifiers: readonly {
|
|
41
|
+
readonly imported: string;
|
|
42
|
+
readonly local: string;
|
|
43
|
+
readonly reads: number;
|
|
44
|
+
}[];
|
|
45
|
+
} | null;
|
|
46
|
+
readonly insertAt: number;
|
|
47
|
+
readonly leadingBlankLine: boolean;
|
|
48
|
+
}
|
|
49
|
+
export declare function collectLookImportSite(program: Program): LookImportSite;
|
|
50
|
+
/** Local names bound to a velar/look builder, including aliased imports. */
|
|
51
|
+
export declare function collectLookBuilderNames(program: Program): ReadonlyMap<string, string>;
|
|
52
|
+
export declare function lookConditionTermCount(expression: Expression, negated?: boolean): number;
|
|
53
|
+
export declare function firstRelativeCssAssetAddress(source: string): {
|
|
54
|
+
readonly value: string;
|
|
55
|
+
readonly syntax: string;
|
|
56
|
+
} | null;
|
|
57
|
+
/** True when a property's declared domain includes a spelled visual unit type. */
|
|
58
|
+
export declare function mentionsLookUnitType(type: ValueType): boolean;
|
|
59
|
+
export declare function lookLiteralZero(expression: Expression): boolean;
|
|
60
|
+
export declare const lookJoin: (left: ValueType, right: ValueType) => ValueType | null;
|
|
61
|
+
export declare function containsCssImport(source: string): boolean;
|
|
62
|
+
//# sourceMappingURL=look-sites.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"look-sites.d.ts","sourceRoot":"","sources":["../../src/analysis/look-sites.ts"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CAAE,GAAG,IAAI,CAWvH;AAED,kFAAkF;AAClF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAK7D;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAI/D;AAED,eAAO,MAAM,QAAQ,SAAU,SAAS,SAAS,SAAS,KAAG,SAAS,GAAG,IACkB,CAAC;AAE5F,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAKzD"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a module's Look values and Look imports are written, and the small
|
|
3
|
+
* readings of one written value a check needs: the builder names in scope, a
|
|
4
|
+
* condition's term count, the first relative CSS asset an unsafe stylesheet
|
|
5
|
+
* addresses, and whether a declared domain mentions a spelled visual unit.
|
|
6
|
+
*
|
|
7
|
+
* D115 P4 R3a: each is a question about a program or a node rather than about
|
|
8
|
+
* the analyzer, so they read as a module.
|
|
9
|
+
*/
|
|
10
|
+
import { semanticTypeIdentity } from "@velarscript/compiler";
|
|
11
|
+
import { astNodesOfKind } from "@velarscript/compiler/extension";
|
|
12
|
+
import { isWebUnit } from "../ast.js";
|
|
13
|
+
import { cssTokens } from "../css-tokens.js";
|
|
14
|
+
import { LOOK_BUILDERS, LOOK_NUMERIC_TYPE_NAMES } from "../look.js";
|
|
15
|
+
import { LOOK_CONDITION_TERM_LIMIT } from "./look-conditions.js";
|
|
16
|
+
import { lookAdditiveType } from "./look-values.js";
|
|
17
|
+
export function collectLookImportSite(program) {
|
|
18
|
+
let lastImportEnd = null;
|
|
19
|
+
for (const statement of program.body) {
|
|
20
|
+
if (statement.kind !== "ImportDeclaration")
|
|
21
|
+
continue;
|
|
22
|
+
lastImportEnd = statement.span.end;
|
|
23
|
+
if (statement.source !== "velar/look" || statement.javascript || statement.specifiers.some((specifier) => specifier.namespace))
|
|
24
|
+
continue;
|
|
25
|
+
const reads = lookIdentifierReadCounts(program);
|
|
26
|
+
return {
|
|
27
|
+
declaration: {
|
|
28
|
+
span: statement.span,
|
|
29
|
+
specifiers: statement.specifiers.map((specifier) => ({
|
|
30
|
+
imported: specifier.imported,
|
|
31
|
+
local: specifier.local,
|
|
32
|
+
reads: reads.get(specifier.local) ?? 0,
|
|
33
|
+
})),
|
|
34
|
+
},
|
|
35
|
+
insertAt: statement.span.end,
|
|
36
|
+
leadingBlankLine: false,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return lastImportEnd === null
|
|
40
|
+
? { declaration: null, insertAt: program.body[0]?.span.start ?? 0, leadingBlankLine: true }
|
|
41
|
+
: { declaration: null, insertAt: lastImportEnd, leadingBlankLine: false };
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* How often each name is read as a value in this module. An import specifier is
|
|
45
|
+
* a declaration rather than an expression, so the import line does not count
|
|
46
|
+
* itself, and a builder passed around (`const make = rgb`) counts like a call.
|
|
47
|
+
*/
|
|
48
|
+
function lookIdentifierReadCounts(program) {
|
|
49
|
+
const counts = new Map();
|
|
50
|
+
for (const read of astNodesOfKind(program, "IdentifierExpression")) {
|
|
51
|
+
counts.set(read.name, (counts.get(read.name) ?? 0) + 1);
|
|
52
|
+
}
|
|
53
|
+
return counts;
|
|
54
|
+
}
|
|
55
|
+
/** Local names bound to a velar/look builder, including aliased imports. */
|
|
56
|
+
export function collectLookBuilderNames(program) {
|
|
57
|
+
const names = new Map();
|
|
58
|
+
for (const statement of program.body) {
|
|
59
|
+
if (statement.kind !== "ImportDeclaration" || statement.source !== "velar/look" || statement.javascript)
|
|
60
|
+
continue;
|
|
61
|
+
for (const specifier of statement.specifiers) {
|
|
62
|
+
if (specifier.namespace || !LOOK_BUILDERS.has(specifier.imported))
|
|
63
|
+
continue;
|
|
64
|
+
names.set(specifier.local, specifier.imported);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return names;
|
|
68
|
+
}
|
|
69
|
+
export function lookConditionTermCount(expression, negated = false) {
|
|
70
|
+
if (expression.kind === "UnaryExpression" && expression.operator === "not")
|
|
71
|
+
return lookConditionTermCount(expression.operand, !negated);
|
|
72
|
+
if (expression.kind === "BinaryExpression" && (expression.operator === "and" || expression.operator === "or")) {
|
|
73
|
+
const conjunction = (expression.operator === "and") !== negated;
|
|
74
|
+
const left = lookConditionTermCount(expression.left, negated);
|
|
75
|
+
const right = lookConditionTermCount(expression.right, negated);
|
|
76
|
+
const total = conjunction ? left * right : left + right;
|
|
77
|
+
return Math.min(LOOK_CONDITION_TERM_LIMIT + 1, total);
|
|
78
|
+
}
|
|
79
|
+
return 1;
|
|
80
|
+
}
|
|
81
|
+
export function firstRelativeCssAssetAddress(source) {
|
|
82
|
+
for (const token of cssTokens(source)) {
|
|
83
|
+
if (token.kind !== "url" && token.kind !== "asset-address")
|
|
84
|
+
continue;
|
|
85
|
+
// A URL parser drops leading and trailing spaces, and an empty url() names
|
|
86
|
+
// the document itself rather than an asset.
|
|
87
|
+
const value = token.value.trim();
|
|
88
|
+
if (value === "")
|
|
89
|
+
continue;
|
|
90
|
+
if (value.startsWith("/") || value.startsWith("#") || /^[a-z][a-z0-9+.-]*:/iu.test(value))
|
|
91
|
+
continue;
|
|
92
|
+
return { value, syntax: token.kind === "url" ? "url" : token.syntax };
|
|
93
|
+
}
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
/** True when a property's declared domain includes a spelled visual unit type. */
|
|
97
|
+
export function mentionsLookUnitType(type) {
|
|
98
|
+
if (type.kind === "named")
|
|
99
|
+
return LOOK_NUMERIC_TYPE_NAMES.has(type.name) || type.name === "Spacing" || type.name === "TrackList" || type.name === "Track";
|
|
100
|
+
if (type.kind === "union")
|
|
101
|
+
return type.members.some(mentionsLookUnitType);
|
|
102
|
+
if (type.kind === "optional")
|
|
103
|
+
return mentionsLookUnitType(type.inner);
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
export function lookLiteralZero(expression) {
|
|
107
|
+
if (expression.kind === "LiteralExpression")
|
|
108
|
+
return expression.value === 0;
|
|
109
|
+
if (expression.kind === "UnaryExpression" && (expression.operator === "-" || expression.operator === "+"))
|
|
110
|
+
return lookLiteralZero(expression.operand);
|
|
111
|
+
return isWebUnit(expression) && expression.value === 0;
|
|
112
|
+
}
|
|
113
|
+
export const lookJoin = (left, right) => lookAdditiveType(left, right, semanticTypeIdentity(left) === semanticTypeIdentity(right));
|
|
114
|
+
export function containsCssImport(source) {
|
|
115
|
+
for (const token of cssTokens(source)) {
|
|
116
|
+
if (token.kind === "at-keyword" && token.name.toLowerCase() === "import")
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=look-sites.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"look-sites.js","sourceRoot":"","sources":["../../src/analysis/look-sites.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,oBAAoB,EAAa,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAiD,MAAM,iCAAiC,CAAC;AAChH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAqCpD,MAAM,UAAU,qBAAqB,CAAC,OAAgB;IACpD,IAAI,aAAa,GAAkB,IAAI,CAAC;IACxC,KAAK,MAAM,SAAS,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACrC,IAAI,SAAS,CAAC,IAAI,KAAK,mBAAmB;YAAE,SAAS;QACrD,aAAa,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC;QACnC,IAAI,SAAS,CAAC,MAAM,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
|
|
103
103
|
*/
|
|
104
104
|
export declare function teachLookLengthSlot(diagnostics: Diagnostic[], builder: string, position: number, declared: ValueType, argument: Expression, literal: number, sites: LookStaticSites): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* D114 F10-web (0.32.0 ledger WB-I1): the other rest builder's slot lesson.
|
|
107
|
+
*
|
|
108
|
+
* `tracks` and `filters` are the two rest builders in the look vocabulary, and
|
|
109
|
+
* the first of them got a lesson in the X wave while the second kept core's bare
|
|
110
|
+
* assignability refusal — `Cannot assign number to Filter`, which names no slot,
|
|
111
|
+
* offers no remedy, and leaves an author who has read `filters(blur(4px), 3)`
|
|
112
|
+
* with nowhere to look up what a `Filter` is made of. One vocabulary, one kind
|
|
113
|
+
* of report.
|
|
114
|
+
*
|
|
115
|
+
* The lesson is the same shape as the length one and taught into the same
|
|
116
|
+
* refusal, so it is still one report for one mistake. It names no rewrite:
|
|
117
|
+
* `blur(4px)` and `grayscale(0.3)` are different pictures, and which of the ten
|
|
118
|
+
* the author meant is not the compiler's to guess — the same reason the
|
|
119
|
+
* length-or-percentage slot offers none.
|
|
120
|
+
*
|
|
121
|
+
* Returns whether the refusal was found and taught.
|
|
122
|
+
*/
|
|
123
|
+
export declare function teachLookFilterSlot(diagnostics: Diagnostic[], builder: string, position: number, declared: ValueType, argument: Expression): boolean;
|
|
105
124
|
//# sourceMappingURL=look-values.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"look-values.d.ts","sourceRoot":"","sources":["../../src/analysis/look-values.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAM7F,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAE1D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB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;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,UAAU,EAAE,EACzB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,SAAS,EACnB,QAAQ,EAAE,UAAU,GACnB,OAAO,CAOT"}
|
|
@@ -177,6 +177,44 @@ export function teachLookLengthSlot(diagnostics, builder, position, declared, ar
|
|
|
177
177
|
diagnostics.push({ code: "VEL5042", message: lesson, span: origin.span });
|
|
178
178
|
return true;
|
|
179
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* D114 F10-web (0.32.0 ledger WB-I1): the other rest builder's slot lesson.
|
|
182
|
+
*
|
|
183
|
+
* `tracks` and `filters` are the two rest builders in the look vocabulary, and
|
|
184
|
+
* the first of them got a lesson in the X wave while the second kept core's bare
|
|
185
|
+
* assignability refusal — `Cannot assign number to Filter`, which names no slot,
|
|
186
|
+
* offers no remedy, and leaves an author who has read `filters(blur(4px), 3)`
|
|
187
|
+
* with nowhere to look up what a `Filter` is made of. One vocabulary, one kind
|
|
188
|
+
* of report.
|
|
189
|
+
*
|
|
190
|
+
* The lesson is the same shape as the length one and taught into the same
|
|
191
|
+
* refusal, so it is still one report for one mistake. It names no rewrite:
|
|
192
|
+
* `blur(4px)` and `grayscale(0.3)` are different pictures, and which of the ten
|
|
193
|
+
* the author meant is not the compiler's to guess — the same reason the
|
|
194
|
+
* length-or-percentage slot offers none.
|
|
195
|
+
*
|
|
196
|
+
* Returns whether the refusal was found and taught.
|
|
197
|
+
*/
|
|
198
|
+
export function teachLookFilterSlot(diagnostics, builder, position, declared, argument) {
|
|
199
|
+
const slot = lookSlotNoun(builder, position);
|
|
200
|
+
const type = lookSlotType(declared, position);
|
|
201
|
+
if (slot === undefined || type?.kind !== "named" || type.name !== filterTypeName)
|
|
202
|
+
return false;
|
|
203
|
+
const lesson = `${builder}${builder.endsWith("s") ? "'" : "'s"} ${slot} is a ${filterTypeName},`
|
|
204
|
+
+ ` and a ${filterTypeName} comes from one of the filter builders: ${filterBuilders.join(", ")}`;
|
|
205
|
+
return teachSlotRefusal(diagnostics, argument, filterTypeName, (item) => ({ ...item, message: lesson }));
|
|
206
|
+
}
|
|
207
|
+
const filterTypeName = "Filter";
|
|
208
|
+
/**
|
|
209
|
+
* The builders that make a `Filter`, read from the one signature table the
|
|
210
|
+
* module interface and the named-argument check already derive from. `filters`
|
|
211
|
+
* composes them and is not one of them, so a lesson about its own slot does not
|
|
212
|
+
* name it as the remedy for that slot.
|
|
213
|
+
*/
|
|
214
|
+
const filterBuilders = [...LOOK_BUILDER_SIGNATURES]
|
|
215
|
+
.filter(([name, signature]) => signature.result === "filter" && name !== "filters")
|
|
216
|
+
.map(([name]) => name)
|
|
217
|
+
.sort();
|
|
180
218
|
/**
|
|
181
219
|
* The published type of the slot an argument lands in: the declared parameter
|
|
182
220
|
* at that position, or — past the last of those — the rest parameter's type,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"look-values.js","sourceRoot":"","sources":["../../src/analysis/look-values.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,aAAa,EAAmB,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAA8C,MAAM,iCAAiC,CAAC;AAC7F,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAE9E,MAAM,oBAAoB,GAAc,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC;AACpF,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,YAAY,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAEpF,MAAM,UAAU,iBAAiB,CAAC,IAAe;IAC/C,OAAO,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,uBAAuB,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAA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AAC,IAAI,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a Look value may be written as, and the sentence that says so when it is
|
|
3
|
+
* written as something else: the multi-token shorthand strings that have a
|
|
4
|
+
* checked builder equivalent, the CSS filter functions that rewrite into filter
|
|
5
|
+
* builders, and the keyword vocabulary a property publishes once a written
|
|
6
|
+
* value falls outside it.
|
|
7
|
+
*
|
|
8
|
+
* D115 P4 R3a: this is the Look *vocabulary* half of the analyzer's Look work —
|
|
9
|
+
* a value and a property name in, a rewrite or a sentence out — and it reads
|
|
10
|
+
* nothing the analyzer is carrying, so it reads as a module.
|
|
11
|
+
*/
|
|
12
|
+
import { type Expression } from "@velarscript/compiler/extension";
|
|
13
|
+
import { type LookPropertyValueKind } from "../look.ts";
|
|
14
|
+
export declare function numericLiteral(expression: Expression | null): number | null;
|
|
15
|
+
export declare function lookDurationLiteral(expression: Expression | null): number | null;
|
|
16
|
+
export declare function lookShorthandStringGuidance(name: string, value: Expression): string | null;
|
|
17
|
+
export interface LookFilterRewrite {
|
|
18
|
+
readonly call: string;
|
|
19
|
+
readonly builders: readonly string[];
|
|
20
|
+
}
|
|
21
|
+
export declare function lookFilterRewrite(text: string): LookFilterRewrite | null;
|
|
22
|
+
/**
|
|
23
|
+
* D104 rule 2 — what a refusal says when two entries in one scope write the
|
|
24
|
+
* same CSS declaration. Written once because two positions raise it: a Look
|
|
25
|
+
* block's entries and an element's `look:` directives lower to the same
|
|
26
|
+
* one-rule-per-property stylesheet, so they have the same defect and deserve
|
|
27
|
+
* the same sentence (D57 rule 134).
|
|
28
|
+
*
|
|
29
|
+
* The message leads with the mechanism, because the pair is legal CSS and the
|
|
30
|
+
* author has every reason to expect source order to settle it. It does not
|
|
31
|
+
* here: see LOOK_SHORTHAND_LONGHANDS for why the winner is decided module-wide.
|
|
32
|
+
*/
|
|
33
|
+
export declare function lookShorthandOverlapMessage(shorthand: string, longhand: string, subject: string): string;
|
|
34
|
+
export declare const lookCssWideKeywords: Set<string>;
|
|
35
|
+
export declare const lookMetricKeywords: Set<string>;
|
|
36
|
+
/**
|
|
37
|
+
* D73 rule 187: what a refusal says the property's *other* half is, so the
|
|
38
|
+
* keyword list it goes on to print reads as the keyword half of a real value
|
|
39
|
+
* space rather than as the whole of it.
|
|
40
|
+
*/
|
|
41
|
+
export declare function lookVocabularyLead(kind: LookPropertyValueKind): string;
|
|
42
|
+
export declare const lookColorKeywords: Set<string>;
|
|
43
|
+
/**
|
|
44
|
+
* D67 rule 174 — what a rejected Look string could have been.
|
|
45
|
+
*
|
|
46
|
+
* The message this replaces said "use one of the closed `name` keywords" and
|
|
47
|
+
* stopped there, so the answer to "which ones?" lived only in the source of the
|
|
48
|
+
* table. The evidence that this is not a hypothetical reader problem is that
|
|
49
|
+
* the usage tour — written by someone who knew the design intent — shipped
|
|
50
|
+
* twelve values no property had, and this diagnostic could not have told him.
|
|
51
|
+
*
|
|
52
|
+
* A near miss gets the one spelling meant, because naming the single correct
|
|
53
|
+
* word is the strongest form of the promise. Otherwise a set small enough to
|
|
54
|
+
* read is written out whole, and a larger one says what it holds. The CSS-wide
|
|
55
|
+
* keywords join the search either way, so a misspelled `inherit` is caught the
|
|
56
|
+
* same as a misspelled `groove`.
|
|
57
|
+
*/
|
|
58
|
+
export declare function lookVocabularyGuidance(property: string, written: string, own: readonly string[], lead: string): LookValueGuidance;
|
|
59
|
+
export interface LookValueGuidance {
|
|
60
|
+
/** The clause that follows "does not accept 'value';". */
|
|
61
|
+
readonly text: string;
|
|
62
|
+
/**
|
|
63
|
+
* Whether the clause named the one spelling the author meant. When it did,
|
|
64
|
+
* the property's recorded exclusion is left off: the record answers "why is
|
|
65
|
+
* my value not here?", and that question is not the one a misspelling asks.
|
|
66
|
+
*/
|
|
67
|
+
readonly named: boolean;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Every string this expression can be when it is written out of literals alone
|
|
71
|
+
* — one literal, or a ternary whose branches are literals all the way down.
|
|
72
|
+
* Answers null when a value is decided anywhere else, which is the signal that
|
|
73
|
+
* a check reading it has nothing static to look at.
|
|
74
|
+
*/
|
|
75
|
+
export declare function literalStringValues(expression: Expression): readonly string[] | null;
|
|
76
|
+
//# sourceMappingURL=look-vocabulary-guidance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"look-vocabulary-guidance.d.ts","sourceRoot":"","sources":["../../src/analysis/look-vocabulary-guidance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EASL,KAAK,qBAAqB,EAC3B,MAAM,YAAY,CAAC;AAmBpB,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAO3E;AAOD,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAWhF;AAkBD,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAmC1F;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AA0HD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CASxE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAGxG;AAED,eAAO,MAAM,mBAAmB,aAAkC,CAAC;AACnE,eAAO,MAAM,kBAAkB,aAAoE,CAAC;AACpG;;;;G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