@velarscript/web 0.30.0 → 0.30.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/README.md +10 -2
- package/dist/analysis/look-values.d.ts +56 -19
- package/dist/analysis/look-values.d.ts.map +1 -1
- package/dist/analysis/look-values.js +138 -31
- package/dist/analysis/look-values.js.map +1 -1
- package/dist/analyzer.d.ts +1 -1
- package/dist/analyzer.d.ts.map +1 -1
- package/dist/analyzer.js +19 -18
- package/dist/analyzer.js.map +1 -1
- package/dist/look-static.d.ts +15 -1
- package/dist/look-static.d.ts.map +1 -1
- package/dist/look-static.js +10 -4
- package/dist/look-static.js.map +1 -1
- package/dist/parser.js +1 -2
- package/dist/parser.js.map +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
package/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# @velarscript/web
|
|
2
2
|
|
|
3
|
+
**VelarScript 0.30.1 · Web surface `web@0.14`.** The counter is what a project
|
|
4
|
+
declares in `velar.json`'s `surfaces` and what a mismatch is refused by; the
|
|
5
|
+
release number every toolchain package steps to says only what you installed.
|
|
6
|
+
|
|
3
7
|
The official Web framework for VelarScript. This package is the versioned
|
|
4
8
|
authority for the `velar/look`, `velar/app`, `velar/config`, `velar/web`, `velar/forms`,
|
|
5
9
|
`velar/http`, `velar/storage`, `velar/browser`, `velar/files`,
|
|
@@ -20,15 +24,19 @@ checked symbols and members.
|
|
|
20
24
|
Applications keep the language-level imports:
|
|
21
25
|
|
|
22
26
|
```velar
|
|
23
|
-
|
|
24
27
|
import {Head, Link, Router, route} from "velar/web"
|
|
25
28
|
import {http} from "velar/http"
|
|
26
|
-
import {rgb, spacing} from "velar/look"
|
|
29
|
+
import {hsl, rgb, spacing} from "velar/look"
|
|
27
30
|
|
|
28
31
|
const accent = rgb(45, 79, 190)
|
|
32
|
+
const accentTint = hsl(224, 62%, 95%)
|
|
29
33
|
const pagePadding = spacing(24px, 16px)
|
|
30
34
|
```
|
|
31
35
|
|
|
36
|
+
`hsl`'s saturation and lightness are a `Percentage`, the spelling CSS uses for
|
|
37
|
+
those two slots; a bare number is refused with the percentage it meant, and
|
|
38
|
+
`velar fix` writes it where the argument is a literal. The hue stays a number.
|
|
39
|
+
|
|
32
40
|
One-off base properties use the same checked table through JSX directives, and
|
|
33
41
|
remain ordered after any composed Look:
|
|
34
42
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* once here rather than twice in the middle of the Web analyzer.
|
|
7
7
|
*/
|
|
8
8
|
import { type Diagnostic } from "@velarscript/compiler";
|
|
9
|
-
import { type Expression, type ValueType } from "@velarscript/compiler/extension";
|
|
9
|
+
import { type Expression, type Span, type ValueType } from "@velarscript/compiler/extension";
|
|
10
10
|
export declare function isLookNumericType(type: ValueType): boolean;
|
|
11
11
|
/**
|
|
12
12
|
* The type two visual operands add up to: the same kind on both sides keeps it,
|
|
@@ -28,6 +28,19 @@ export declare function lookAdditiveType(left: ValueType, right: ValueType, same
|
|
|
28
28
|
export declare function foldedLengthPercentage(expression: Extract<Expression, {
|
|
29
29
|
kind: "CallExpression";
|
|
30
30
|
}>, builderOf: (name: string) => string | undefined, inferSlot: (argument: Expression) => ValueType, join: (left: ValueType, right: ValueType) => ValueType | null): ValueType | null;
|
|
31
|
+
/**
|
|
32
|
+
* Where the bare number a builder slot refused is actually written, and the
|
|
33
|
+
* binding it came through when that is not the argument itself.
|
|
34
|
+
*
|
|
35
|
+
* D114 F9-web (WB-I7): `hsl(210, sat, 45%)` under `const sat = 70` folds to a
|
|
36
|
+
* number, and the report was drawn under `sat` while its remedy said `70%` — so
|
|
37
|
+
* an author editing at the caret replaced the binding's use with a literal. The
|
|
38
|
+
* number is written in the binding's initializer, so that is where the caret
|
|
39
|
+
* goes, and the sentence names the binding so the line it lands on is explained.
|
|
40
|
+
* A constant imported from another module has no site here and keeps the
|
|
41
|
+
* argument's own span, which is the only position this compile can point at.
|
|
42
|
+
*/
|
|
43
|
+
export type LookStaticSites = ReadonlyMap<string, Span>;
|
|
31
44
|
/**
|
|
32
45
|
* D114 P6 item 2 (LK-I3): a bare number written where a builder slot takes a
|
|
33
46
|
* `Percentage`.
|
|
@@ -37,32 +50,56 @@ export declare function foldedLengthPercentage(expression: Extract<Expression, {
|
|
|
37
50
|
* instead of adding a second report of one mistake. The message names the
|
|
38
51
|
* percentage the author meant, and `velar fix` writes it where the argument is
|
|
39
52
|
* a literal; an identifier that folded to a number is a binding whose
|
|
40
|
-
* declaration is the place to change, so it earns the sentence and no
|
|
53
|
+
* declaration is the place to change, so it earns the sentence there and no
|
|
54
|
+
* rewrite — retyping the binding is not a mechanical edit, because every other
|
|
55
|
+
* use of it is part of the answer.
|
|
41
56
|
*
|
|
42
57
|
* Returns whether the refusal was found and taught.
|
|
43
58
|
*/
|
|
44
|
-
export declare function teachLookPercentageSlot(diagnostics: Diagnostic[], slot: string, argument: Expression, literal: number): boolean;
|
|
59
|
+
export declare function teachLookPercentageSlot(diagnostics: Diagnostic[], slot: string, argument: Expression, literal: number, sites: LookStaticSites): boolean;
|
|
45
60
|
/**
|
|
46
|
-
* D114 F7-web
|
|
47
|
-
*
|
|
48
|
-
* reports
|
|
49
|
-
*
|
|
50
|
-
*
|
|
61
|
+
* D114 F7-web-b: a bare number written in a builder slot that will not take
|
|
62
|
+
* one — the mistake LK-I3 found on `hsl`, which on the length builders had been
|
|
63
|
+
* left drawing two reports about one number: core's `Cannot assign number to
|
|
64
|
+
* Length` and this analyzer's unit advice, side by side.
|
|
65
|
+
*
|
|
66
|
+
* Which slots those are is the builder's own published type, handed in by the
|
|
67
|
+
* caller, so there is no second table of builder positions kept in step by
|
|
68
|
+
* hand. Three shapes, three lessons:
|
|
69
|
+
*
|
|
70
|
+
* - a slot whose type is exactly `Length` — `blur`'s radius, `border`'s
|
|
71
|
+
* width, the offsets and spread of `shadow` and `dropShadow` — has one
|
|
72
|
+
* natural unit, so the sentence names it and `velar fix` writes `4px`;
|
|
73
|
+
* - a slot that takes a length *or* a percentage — `min`, `max` and `clamp`,
|
|
74
|
+
* the three builders that exist to mix them — names both spellings and
|
|
75
|
+
* offers no rewrite, because `100px` and `100%` are different pictures and
|
|
76
|
+
* the one the author meant is not the compiler's to guess;
|
|
77
|
+
* - a slot whose union admits `number` as well — `spacing`, `tracks`,
|
|
78
|
+
* `minmax` — draws no refusal from core at all, so the unit advice is the
|
|
79
|
+
* whole diagnosis, and zero passes because that union really does take it.
|
|
80
|
+
*
|
|
81
|
+
* D114 F9-web (WB-I2): all three sentences are one sentence, built from the
|
|
82
|
+
* slot's own published type, because the advice used to be written twice. The
|
|
83
|
+
* unit advice said "(only 0 is unitless)" for every builder that composes
|
|
84
|
+
* lengths — true of the third shape, whose union takes a bare `0`, and a
|
|
85
|
+
* falsehood on `blur` and `shadow`, where `blur(0)` is refused. A slot cannot
|
|
86
|
+
* now be told what it takes by anything but its type: `slotAccepts` reads it,
|
|
87
|
+
* and the "or 0" clause exists exactly where a bare number is accepted.
|
|
51
88
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* also no `velar fix` edit: `100px` and `100%` are different pictures, and the
|
|
57
|
-
* one the author meant is not the compiler's to guess.
|
|
89
|
+
* Zero is refused in the first two: `blur(0)` and `min(0, 600px)` are not CSS,
|
|
90
|
+
* so the slot says what to write. A slot that admits no length at all — a
|
|
91
|
+
* colour, a border style, `inset` — is not this rule's business and earns
|
|
92
|
+
* nothing here.
|
|
58
93
|
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
94
|
+
* D114 WB-X1: `declared` is the builder's whole published type rather than one
|
|
95
|
+
* slot of it, because a rest parameter's type is the type of every position it
|
|
96
|
+
* collects and reading `parameters[position]` stopped at the last named one.
|
|
97
|
+
* `tracks(4, 8px)` was refused and `tracks(8px, 4)` drew nothing at all — the
|
|
98
|
+
* second argument of a builder whose signature declares one parameter had no
|
|
99
|
+
* published type to read, so the lesson never ran there.
|
|
63
100
|
*
|
|
64
101
|
* Returns whether the argument was refused here, which is the caller's record
|
|
65
102
|
* that this call failed its own argument check.
|
|
66
103
|
*/
|
|
67
|
-
export declare function teachLookLengthSlot(diagnostics: Diagnostic[], builder: string, position: number, argument: Expression, literal: number): boolean;
|
|
104
|
+
export declare function teachLookLengthSlot(diagnostics: Diagnostic[], builder: string, position: number, declared: ValueType, argument: Expression, literal: number, sites: LookStaticSites): boolean;
|
|
68
105
|
//# 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,SAAS,EAAE,MAAM,iCAAiC,CAAC;
|
|
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,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,CAO3G;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,CAAC,EAC3D,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,EAC/C,SAAS,EAAE,CAAC,QAAQ,EAAE,UAAU,KAAK,SAAS,EAC9C,IAAI,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,KAAK,SAAS,GAAG,IAAI,GAC5D,SAAS,GAAG,IAAI,CAclB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAkBxD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,UAAU,EAAE,EACzB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,eAAe,GACrB,OAAO,CAUT;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,UAAU,EAAE,EACzB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,SAAS,EACnB,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,eAAe,GACrB,OAAO,CAiCT"}
|
|
@@ -59,6 +59,16 @@ export function foldedLengthPercentage(expression, builderOf, inferSlot, join) {
|
|
|
59
59
|
}
|
|
60
60
|
return folded;
|
|
61
61
|
}
|
|
62
|
+
function lookSlotOrigin(argument, sites) {
|
|
63
|
+
if (argument.kind !== "IdentifierExpression")
|
|
64
|
+
return { span: argument.span, binding: null };
|
|
65
|
+
const site = sites.get(argument.name);
|
|
66
|
+
return site === undefined ? { span: argument.span, binding: null } : { span: site, binding: argument.name };
|
|
67
|
+
}
|
|
68
|
+
/** "4 is a number", or "'n' holds 4, a number" where the argument folded through a binding. */
|
|
69
|
+
function heldNumber(origin, written, refused) {
|
|
70
|
+
return origin.binding === null ? `${written} is ${refused}` : `'${origin.binding}' holds ${written}, ${refused}`;
|
|
71
|
+
}
|
|
62
72
|
/**
|
|
63
73
|
* D114 P6 item 2 (LK-I3): a bare number written where a builder slot takes a
|
|
64
74
|
* `Percentage`.
|
|
@@ -68,61 +78,158 @@ export function foldedLengthPercentage(expression, builderOf, inferSlot, join) {
|
|
|
68
78
|
* instead of adding a second report of one mistake. The message names the
|
|
69
79
|
* percentage the author meant, and `velar fix` writes it where the argument is
|
|
70
80
|
* a literal; an identifier that folded to a number is a binding whose
|
|
71
|
-
* declaration is the place to change, so it earns the sentence and no
|
|
81
|
+
* declaration is the place to change, so it earns the sentence there and no
|
|
82
|
+
* rewrite — retyping the binding is not a mechanical edit, because every other
|
|
83
|
+
* use of it is part of the answer.
|
|
72
84
|
*
|
|
73
85
|
* Returns whether the refusal was found and taught.
|
|
74
86
|
*/
|
|
75
|
-
export function teachLookPercentageSlot(diagnostics, slot, argument, literal) {
|
|
87
|
+
export function teachLookPercentageSlot(diagnostics, slot, argument, literal, sites) {
|
|
76
88
|
const written = `${Number(literal.toPrecision(12))}%`;
|
|
89
|
+
const origin = lookSlotOrigin(argument, sites);
|
|
77
90
|
const rewritable = argument.kind === "LiteralExpression" && typeof argument.value === "number";
|
|
78
91
|
return teachSlotRefusal(diagnostics, argument, "Percentage", (item) => ({
|
|
79
92
|
...item,
|
|
80
|
-
|
|
93
|
+
span: origin.span,
|
|
94
|
+
message: `${slot} is a percentage, and ${heldNumber(origin, String(literal), "a number")}; write ${written}`,
|
|
81
95
|
...(rewritable ? { fix: mechanicalFix(argument.span, written, `Write ${written}`) } : {}),
|
|
82
96
|
}));
|
|
83
97
|
}
|
|
84
98
|
/**
|
|
85
|
-
* D114 F7-web
|
|
86
|
-
*
|
|
87
|
-
* reports
|
|
88
|
-
*
|
|
89
|
-
*
|
|
99
|
+
* D114 F7-web-b: a bare number written in a builder slot that will not take
|
|
100
|
+
* one — the mistake LK-I3 found on `hsl`, which on the length builders had been
|
|
101
|
+
* left drawing two reports about one number: core's `Cannot assign number to
|
|
102
|
+
* Length` and this analyzer's unit advice, side by side.
|
|
103
|
+
*
|
|
104
|
+
* Which slots those are is the builder's own published type, handed in by the
|
|
105
|
+
* caller, so there is no second table of builder positions kept in step by
|
|
106
|
+
* hand. Three shapes, three lessons:
|
|
107
|
+
*
|
|
108
|
+
* - a slot whose type is exactly `Length` — `blur`'s radius, `border`'s
|
|
109
|
+
* width, the offsets and spread of `shadow` and `dropShadow` — has one
|
|
110
|
+
* natural unit, so the sentence names it and `velar fix` writes `4px`;
|
|
111
|
+
* - a slot that takes a length *or* a percentage — `min`, `max` and `clamp`,
|
|
112
|
+
* the three builders that exist to mix them — names both spellings and
|
|
113
|
+
* offers no rewrite, because `100px` and `100%` are different pictures and
|
|
114
|
+
* the one the author meant is not the compiler's to guess;
|
|
115
|
+
* - a slot whose union admits `number` as well — `spacing`, `tracks`,
|
|
116
|
+
* `minmax` — draws no refusal from core at all, so the unit advice is the
|
|
117
|
+
* whole diagnosis, and zero passes because that union really does take it.
|
|
90
118
|
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
119
|
+
* D114 F9-web (WB-I2): all three sentences are one sentence, built from the
|
|
120
|
+
* slot's own published type, because the advice used to be written twice. The
|
|
121
|
+
* unit advice said "(only 0 is unitless)" for every builder that composes
|
|
122
|
+
* lengths — true of the third shape, whose union takes a bare `0`, and a
|
|
123
|
+
* falsehood on `blur` and `shadow`, where `blur(0)` is refused. A slot cannot
|
|
124
|
+
* now be told what it takes by anything but its type: `slotAccepts` reads it,
|
|
125
|
+
* and the "or 0" clause exists exactly where a bare number is accepted.
|
|
97
126
|
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
127
|
+
* Zero is refused in the first two: `blur(0)` and `min(0, 600px)` are not CSS,
|
|
128
|
+
* so the slot says what to write. A slot that admits no length at all — a
|
|
129
|
+
* colour, a border style, `inset` — is not this rule's business and earns
|
|
130
|
+
* nothing here.
|
|
131
|
+
*
|
|
132
|
+
* D114 WB-X1: `declared` is the builder's whole published type rather than one
|
|
133
|
+
* slot of it, because a rest parameter's type is the type of every position it
|
|
134
|
+
* collects and reading `parameters[position]` stopped at the last named one.
|
|
135
|
+
* `tracks(4, 8px)` was refused and `tracks(8px, 4)` drew nothing at all — the
|
|
136
|
+
* second argument of a builder whose signature declares one parameter had no
|
|
137
|
+
* published type to read, so the lesson never ran there.
|
|
102
138
|
*
|
|
103
139
|
* Returns whether the argument was refused here, which is the caller's record
|
|
104
140
|
* that this call failed its own argument check.
|
|
105
141
|
*/
|
|
106
|
-
export function teachLookLengthSlot(diagnostics, builder, position, argument, literal) {
|
|
107
|
-
const
|
|
108
|
-
const
|
|
142
|
+
export function teachLookLengthSlot(diagnostics, builder, position, declared, argument, literal, sites) {
|
|
143
|
+
const slot = lookSlotNoun(builder, position);
|
|
144
|
+
const accepts = slotAccepts(lookSlotType(declared, position));
|
|
145
|
+
if (slot === undefined || accepts === null)
|
|
146
|
+
return false;
|
|
109
147
|
const written = `${Number(literal.toPrecision(12))}`;
|
|
110
|
-
|
|
148
|
+
const origin = lookSlotOrigin(argument, sites);
|
|
149
|
+
const spellings = accepts === "a Length" ? `${written}px`
|
|
150
|
+
: accepts === "a Percentage" ? `${written}%` : `${written}px or ${written}%`;
|
|
151
|
+
// `tracks` is the one length builder whose name ends in an s, and "tracks's"
|
|
152
|
+
// is not how the possessive is written.
|
|
153
|
+
const lesson = `${builder}${builder.endsWith("s") ? "'" : "'s"} ${slot} is ${accepts},`
|
|
154
|
+
+ ` and ${heldNumber(origin, written, accepts.endsWith("or 0") ? "none of those" : "a number")}; write ${spellings}`;
|
|
155
|
+
if (accepts === "a Length" && teachSlotRefusal(diagnostics, argument, "Length", (item) => ({
|
|
111
156
|
...item,
|
|
112
|
-
|
|
113
|
-
|
|
157
|
+
span: origin.span,
|
|
158
|
+
message: lesson,
|
|
159
|
+
...(argument.kind === "LiteralExpression" && typeof argument.value === "number"
|
|
160
|
+
? { fix: mechanicalFix(argument.span, `${written}px`, `Write ${written}px`) }
|
|
161
|
+
: {}),
|
|
114
162
|
})))
|
|
115
163
|
return true;
|
|
116
|
-
|
|
164
|
+
// The refused type is the slot's own, so a slot that takes only a percentage
|
|
165
|
+
// finds its refusal too rather than falling through and reporting twice.
|
|
166
|
+
if (accepts !== "a Length" && teachSlotRefusal(diagnostics, argument, accepts === "a Percentage" ? "Percentage" : "LengthPercentage", (item) => ({
|
|
167
|
+
...item,
|
|
168
|
+
span: origin.span,
|
|
169
|
+
message: lesson,
|
|
170
|
+
})))
|
|
171
|
+
return true;
|
|
172
|
+
// A slot whose union takes a bare number takes `0`, and CSS writes that one
|
|
173
|
+
// length without a unit; every other number in it is the dead declaration
|
|
174
|
+
// this report exists for.
|
|
175
|
+
if (literal === 0 && accepts.endsWith("or 0"))
|
|
117
176
|
return false;
|
|
118
|
-
diagnostics.push({
|
|
119
|
-
code: "VEL5042",
|
|
120
|
-
message: `${builder} composes CSS lengths, so ${literal} requires a unit;`
|
|
121
|
-
+ ` write a unit value such as ${literal}px or ${literal}rem (only 0 is unitless)`,
|
|
122
|
-
span: argument.span,
|
|
123
|
-
});
|
|
177
|
+
diagnostics.push({ code: "VEL5042", message: lesson, span: origin.span });
|
|
124
178
|
return true;
|
|
125
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* The published type of the slot an argument lands in: the declared parameter
|
|
182
|
+
* at that position, or — past the last of those — the rest parameter's type,
|
|
183
|
+
* which is the type of every position it collects.
|
|
184
|
+
*/
|
|
185
|
+
function lookSlotType(declared, position) {
|
|
186
|
+
if (position < 0 || declared.kind !== "function")
|
|
187
|
+
return undefined;
|
|
188
|
+
return declared.parameters[position] ?? declared.rest;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* How the lesson refers to the slot an argument lands in, or undefined where
|
|
192
|
+
* the builder has no slot there at all.
|
|
193
|
+
*
|
|
194
|
+
* D114 WB-X1: a rest parameter collects every position from its own onward, and
|
|
195
|
+
* the signature has a name for only the first of them — so `tracks(8px, 4)`
|
|
196
|
+
* used to read past the end of the name table and teach nothing, while
|
|
197
|
+
* `tracks(4, 8px)` was refused. The collected positions are named by their
|
|
198
|
+
* number rather than by the rest parameter's name, because "tracks' first
|
|
199
|
+
* argument" pointing at the second argument would be a sentence that is not
|
|
200
|
+
* true. The named positions keep the wording F9-web gave them exactly.
|
|
201
|
+
*/
|
|
202
|
+
function lookSlotNoun(builder, position) {
|
|
203
|
+
if (position < 0)
|
|
204
|
+
return undefined;
|
|
205
|
+
const signature = LOOK_BUILDER_SIGNATURES.get(builder);
|
|
206
|
+
if (signature === undefined)
|
|
207
|
+
return undefined;
|
|
208
|
+
const named = signature.parameters[position];
|
|
209
|
+
if (named !== undefined)
|
|
210
|
+
return `${named} argument`;
|
|
211
|
+
return signature.rest === true ? `argument ${position + 1}` : undefined;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* What a slot's published type accepts, in the words the lesson names it with,
|
|
215
|
+
* or null where the slot carries no length at all. The "or 0" tail is the one
|
|
216
|
+
* fact a reader has to be able to trust in both directions, so it is read from
|
|
217
|
+
* the type rather than written into a sentence by hand.
|
|
218
|
+
*/
|
|
219
|
+
function slotAccepts(type) {
|
|
220
|
+
if (type === undefined)
|
|
221
|
+
return null;
|
|
222
|
+
if (type.kind === "named") {
|
|
223
|
+
if (!lengthPercentageNames.has(type.name))
|
|
224
|
+
return null;
|
|
225
|
+
return type.name === "Length" ? "a Length" : type.name === "Percentage" ? "a Percentage" : "a Length or a Percentage";
|
|
226
|
+
}
|
|
227
|
+
if (type.kind !== "union")
|
|
228
|
+
return null;
|
|
229
|
+
if (!type.members.some((member) => member.kind === "named" && lengthPercentageNames.has(member.name)))
|
|
230
|
+
return null;
|
|
231
|
+
return type.members.some((member) => member.kind === "number") ? "a Length, a Percentage, or 0" : "a Length or a Percentage";
|
|
232
|
+
}
|
|
126
233
|
/**
|
|
127
234
|
* The search both slot lessons make: core's assignability refusal for exactly
|
|
128
235
|
* this argument, rewritten in place. Diagnostics are collected in source order,
|
|
@@ -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,
|
|
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,gBAAgB,CAAC,IAAe,EAAE,KAAgB,EAAE,YAAqB;IACvF,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACvE,IAAI,YAAY;QAAE,OAAO,IAAI,CAAC;IAC9B,OAAO,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO;WACjD,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K,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/analyzer.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare class VelarWebAnalyzer extends Analyzer {
|
|
|
22
22
|
private readonly unsafeCssImports;
|
|
23
23
|
private readonly probedOperandTypes;
|
|
24
24
|
private readonly importedLookStaticValues;
|
|
25
|
-
private
|
|
25
|
+
private lookStatic;
|
|
26
26
|
private readonly lookEntryScopes;
|
|
27
27
|
private readonly derivedReactiveNames;
|
|
28
28
|
private readonly checkedBuilderCalls;
|
package/dist/analyzer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../src/analyzer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwD,KAAK,UAAU,EAA2C,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClK,OAAO,EACL,QAAQ,EAgBR,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,gCAAgC,EACrC,KAAK,UAAU,EAEf,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,iCAAiC,CAAC;AA+GzC,eAAO,MAAM,oBAAoB,iDAAiD,CAAC;AAmHnF,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,gCAAgC,GAAG,SAAS,GAAG,SAAS,CAsLlG;AAq1CD,qBAAa,gBAAiB,SAAQ,QAAQ;IAC5C,OAAO,CAAC,eAAe,CAA4B;IACnD,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,YAAY,CAAK;IACzB,iHAAiH;IACjH,OAAO,CAAC,cAAc,CAAK;IAC3B,4FAA4F;IAC5F,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAqB;IACtD,wFAAwF;IACxF,OAAO,CAAC,QAAQ,CAAC,iBA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AAQ;IAiEhB;;;;;;;;OAQG;IACH,OAAO,CAAC,yBAAyB;IAwBjC;;;;;OAKG;IACH,OAAO,CAAC,wBAAwB;IAmBhC,OAAO,CAAC,uBAAuB;IAoB/B,OAAO,CAAC,wBAAwB;IAuBhC,OAAO,CAAC,uBAAuB;IAqF/B;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;IAuB/B;;;;;;;;OAQG;IACH,OAAO,CAAC,+BAA+B;IA6BvC,OAAO,CAAC,mBAAmB;IA4B3B,OAAO,CAAC,yBAAyB;IAyJjC;;;;;;;;;OASG;IACH,OAAO,CAAC,iCAAiC;IA4BzC,uFAAuF;IACvF,OAAO,CAAC,wBAAwB;IAQhC;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,OAAO,CAAC,6BAA6B;IAwFrC;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;IAc/B;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;IAM5B;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAwBpB;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IA0BxB,OAAO,CAAC,yBAAyB;IAcjC,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,eAAe;IAWvB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,mBAAmB;IAU3B,OAAO,CAAC,gBAAgB;IAQxB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,OAAO,CAAC,oBAAoB;IA6B5B,OAAO,CAAC,sBAAsB;IAe9B,OAAO,CAAC,4BAA4B;CAmBrC"}
|
package/dist/analyzer.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Analyzer, anyType, boolType, describeType, expressionContainsDirectAwai
|
|
|
3
3
|
import { BROWSER_TEST_MODULE, BROWSER_TEST_SOURCE_SUFFIX, browserTestImportGuidance } from "./browser-test.js";
|
|
4
4
|
import { cssTokens } from "./css-tokens.js";
|
|
5
5
|
import { LOOK_ABSENT_MEDIA_SUBJECTS, LOOK_ARITHMETIC_HINT, LOOK_ANIMATION_DIRECTIONS, LOOK_ANIMATION_EASINGS, LOOK_ANIMATION_FILLS, LOOK_BORDER_STYLE_NAMES, LOOK_BUILDER_NUMERIC_RANGES, LOOK_BUILDER_SIGNATURES, LOOK_BUILDERS, LOOK_EXCLUDED_PROPERTIES, LOOK_HOOKS, LOOK_CSS_WIDE_KEYWORDS, LOOK_COLOR_KEYWORDS, LOOK_LARGE_KEYWORD_SETS, LOOK_LENGTH_BUILDERS, LOOK_MEDIA_LENGTH_UNITS, LOOK_MEDIA_SUBJECTS, LOOK_NUMERIC_TYPE_NAMES, LOOK_NON_ANIMATABLE_PROPERTIES, LOOK_PARTIAL_KEYWORD_PROPERTIES, LOOK_PROPERTIES, LOOK_PROPERTY_KEYWORDS, LOOK_PROPERTY_VALUE_KINDS, LOOK_SHARED_METRIC_KEYWORDS, LOOK_TARGETS, LOOK_TOKEN_NAME_RULE, LOOK_TOKEN_NO_FALLBACK_GUIDANCE, LOOK_UNIT_TYPES, LOOK_UNITLESS_PROPERTIES, isLookTokenName, isLookVarReference, lookOwnKeywords, lookShorthandOverlap, lookShorthandParts, lookTokenReference, lookVarReferenceName, nearestLookName, } from "./look.js";
|
|
6
|
-
import {
|
|
6
|
+
import { collectLookStaticScope, evaluateLookStaticExpression, isLookStaticValue, lookStaticCss } from "./look-static.js";
|
|
7
7
|
import { keyframeCssValue } from "./keyframes.js";
|
|
8
8
|
import { componentCallRefusal, componentRefHandleRefusal, componentSectionCountDiagnostics, watchedResourceSurfaceRefusal } from "./analysis/component-guidance.js";
|
|
9
9
|
import { foldedLengthPercentage, isLookNumericType, lookAdditiveType, teachLookLengthSlot, teachLookPercentageSlot } from "./analysis/look-values.js";
|
|
@@ -1715,7 +1715,7 @@ export class VelarWebAnalyzer extends Analyzer {
|
|
|
1715
1715
|
unsafeCssImports = new Set();
|
|
1716
1716
|
probedOperandTypes = new Map();
|
|
1717
1717
|
importedLookStaticValues;
|
|
1718
|
-
|
|
1718
|
+
lookStatic = { values: new Map(), sites: new Map() };
|
|
1719
1719
|
lookEntryScopes = new Map();
|
|
1720
1720
|
derivedReactiveNames = new Set();
|
|
1721
1721
|
checkedBuilderCalls = new Set();
|
|
@@ -1784,7 +1784,7 @@ export class VelarWebAnalyzer extends Analyzer {
|
|
|
1784
1784
|
this.importedComputedNames = new Set(webImports.filter(([, value]) => isWebComputedExport(value)).map(([name]) => name));
|
|
1785
1785
|
}
|
|
1786
1786
|
analyze(program) {
|
|
1787
|
-
this.
|
|
1787
|
+
this.lookStatic = collectLookStaticScope(program, this.importedLookStaticValues);
|
|
1788
1788
|
this.lookBuilderNames = collectLookBuilderNames(program);
|
|
1789
1789
|
this.publicConfigNames = collectPublicConfigNames(program);
|
|
1790
1790
|
this.lookImport = collectLookImportSite(program);
|
|
@@ -3242,8 +3242,8 @@ export class VelarWebAnalyzer extends Analyzer {
|
|
|
3242
3242
|
if (inheritedTerms * Math.max(thenTerms, elseTerms) > LOOK_CONDITION_TERM_LIMIT) {
|
|
3243
3243
|
this.diagnostics.push(diagnostic("VEL5045", `A Look condition may expand to at most ${LOOK_CONDITION_TERM_LIMIT} selector/runtime terms; split this visual decision into ordinary values`, entry.condition.span));
|
|
3244
3244
|
}
|
|
3245
|
-
const thenKey = lookConditionKey(entry.condition, false, this.
|
|
3246
|
-
const elseKey = lookConditionKey(entry.condition, true, this.
|
|
3245
|
+
const thenKey = lookConditionKey(entry.condition, false, this.lookStatic.values);
|
|
3246
|
+
const elseKey = lookConditionKey(entry.condition, true, this.lookStatic.values);
|
|
3247
3247
|
this.analyzeLookEntries(entry.thenEntries, insideTarget, true, Math.min(LOOK_CONDITION_TERM_LIMIT, inheritedTerms * thenTerms), `${scopeKey}&${thenKey}`);
|
|
3248
3248
|
this.analyzeLookEntries(entry.elseEntries, insideTarget, true, Math.min(LOOK_CONDITION_TERM_LIMIT, inheritedTerms * elseTerms), `${scopeKey}&${elseKey}`);
|
|
3249
3249
|
continue;
|
|
@@ -3343,9 +3343,8 @@ export class VelarWebAnalyzer extends Analyzer {
|
|
|
3343
3343
|
* module compiles; dynamic arguments keep the runtime guard.
|
|
3344
3344
|
*/
|
|
3345
3345
|
checkLookBuilderCall(expression) {
|
|
3346
|
-
const
|
|
3347
|
-
|
|
3348
|
-
: undefined;
|
|
3346
|
+
const callee = expression.callee.kind === "IdentifierExpression" ? expression.callee.name : "";
|
|
3347
|
+
const builder = this.lookBuilderNames.get(callee);
|
|
3349
3348
|
if (!builder)
|
|
3350
3349
|
return;
|
|
3351
3350
|
const key = spanIdentity(expression.span);
|
|
@@ -3369,6 +3368,10 @@ export class VelarWebAnalyzer extends Analyzer {
|
|
|
3369
3368
|
// table: `rgba(0, 0, 0, alpha=2)` compiled clean while `rgba(0, 0, 0, 2)`
|
|
3370
3369
|
// was refused.
|
|
3371
3370
|
const parameters = LOOK_BUILDER_SIGNATURES.get(builder)?.parameters;
|
|
3371
|
+
// LOK-D3: which slots take a length is the builder's own published type,
|
|
3372
|
+
// read from the binding this call resolved through — the declaration core's
|
|
3373
|
+
// assignability check refused against — and not a second table of positions.
|
|
3374
|
+
const declared = this.expandAliases(this.lookup(callee)?.type ?? { kind: "unknown" });
|
|
3372
3375
|
const before = this.diagnostics.length;
|
|
3373
3376
|
let taught = false;
|
|
3374
3377
|
for (const [index, argument] of expression.arguments.entries()) {
|
|
@@ -3380,7 +3383,7 @@ export class VelarWebAnalyzer extends Analyzer {
|
|
|
3380
3383
|
// folded value rather than the literal node is what makes the promise
|
|
3381
3384
|
// "a computed argument keeps the same check" true where the run time the
|
|
3382
3385
|
// charter names does not exist.
|
|
3383
|
-
const folded = evaluateLookStaticExpression(argument, this.
|
|
3386
|
+
const folded = evaluateLookStaticExpression(argument, this.lookStatic.values);
|
|
3384
3387
|
const literal = folded?.kind === "number" ? folded.value : null;
|
|
3385
3388
|
// D114 P6 item 2 (LK-I3): a slot whose domain carries a unit states its
|
|
3386
3389
|
// bound in that unit and reads the value out of the unit's own number, so
|
|
@@ -3393,7 +3396,7 @@ export class VelarWebAnalyzer extends Analyzer {
|
|
|
3393
3396
|
const unit = rangeUnit ?? "";
|
|
3394
3397
|
this.diagnostics.push(diagnostic("VEL5042", `${range[0]} must be from ${range[1]}${unit} through ${range[2]}${unit}; ${builder} received ${ranged}${unit}`, argument.span));
|
|
3395
3398
|
}
|
|
3396
|
-
if (rangeUnit === "%" && literal !== null && teachLookPercentageSlot(this.diagnostics, range[0], argument, literal))
|
|
3399
|
+
if (rangeUnit === "%" && literal !== null && teachLookPercentageSlot(this.diagnostics, range[0], argument, literal, this.lookStatic.sites))
|
|
3397
3400
|
taught = true;
|
|
3398
3401
|
const nonNegativeBlur = (builder === "blur" && position === 0) || (builder === "dropShadow" && position === 2);
|
|
3399
3402
|
if (nonNegativeBlur && folded?.kind === "unit" && folded.value < 0) {
|
|
@@ -3401,12 +3404,10 @@ export class VelarWebAnalyzer extends Analyzer {
|
|
|
3401
3404
|
}
|
|
3402
3405
|
// LOK-D3, builder half: a unitless number in a length position is dead
|
|
3403
3406
|
// CSS exactly as it is on a property — except in a slot whose own type
|
|
3404
|
-
//
|
|
3405
|
-
//
|
|
3407
|
+
// refuses the number outright, where core's refusal is already the report
|
|
3408
|
+
// and gains the remedy rather than a neighbour.
|
|
3406
3409
|
if (LOOK_LENGTH_BUILDERS.has(builder) && literal !== null
|
|
3407
|
-
&&
|
|
3408
|
-
&& !(builder === "dropShadow" && position === 3)
|
|
3409
|
-
&& teachLookLengthSlot(this.diagnostics, builder, position, argument, literal))
|
|
3410
|
+
&& teachLookLengthSlot(this.diagnostics, builder, position, declared, argument, literal, this.lookStatic.sites))
|
|
3410
3411
|
taught = true;
|
|
3411
3412
|
if (builder === "border" && position === 2 && argument.kind === "LiteralExpression" && typeof argument.value === "string"
|
|
3412
3413
|
&& !LOOK_BORDER_STYLE_NAMES.has(argument.value)) {
|
|
@@ -3580,7 +3581,7 @@ export class VelarWebAnalyzer extends Analyzer {
|
|
|
3580
3581
|
// is wrong with it, and "does not resolve to static CSS" is only the consequence —
|
|
3581
3582
|
// a sentence that sends its author looking for a rule against named arguments in
|
|
3582
3583
|
// a stop, which there is not (`spread=2px` in range compiles).
|
|
3583
|
-
if (keyframeCssValue(entry.value, this.
|
|
3584
|
+
if (keyframeCssValue(entry.value, this.lookStatic.values) === null && !this.refusedBuilderCallWithin(entry.value.span)) {
|
|
3584
3585
|
this.diagnostics.push(diagnostic("VEL5060", "A keyframe value must resolve to static CSS from literals, unit values, arithmetic, velar/look builders, or const bindings — local or imported — that hold any of those, and the text it resolves to must read as one declaration value: no ';', '{', '}', or '@' outside a string, with parentheses, strings, and comments all closed", entry.value.span));
|
|
3585
3586
|
}
|
|
3586
3587
|
if (mentionsLookUnitType(expected) && lookLiteralZero(entry.value))
|
|
@@ -3929,7 +3930,7 @@ export class VelarWebAnalyzer extends Analyzer {
|
|
|
3929
3930
|
foldedLookKeyword(value) {
|
|
3930
3931
|
if (value.kind !== "IdentifierExpression" && value.kind !== "MemberExpression")
|
|
3931
3932
|
return null;
|
|
3932
|
-
const folded = evaluateLookStaticExpression(value, this.
|
|
3933
|
+
const folded = evaluateLookStaticExpression(value, this.lookStatic.values);
|
|
3933
3934
|
if (folded?.kind !== "css" || !/^[A-Za-z][A-Za-z0-9-]*$/u.test(folded.value))
|
|
3934
3935
|
return null;
|
|
3935
3936
|
return [folded.value];
|
|
@@ -4007,7 +4008,7 @@ export class VelarWebAnalyzer extends Analyzer {
|
|
|
4007
4008
|
return boolType;
|
|
4008
4009
|
}
|
|
4009
4010
|
checkViewportThreshold(value) {
|
|
4010
|
-
const threshold = evaluateLookStaticExpression(value, this.
|
|
4011
|
+
const threshold = evaluateLookStaticExpression(value, this.lookStatic.values);
|
|
4011
4012
|
if (threshold?.kind !== "unit") {
|
|
4012
4013
|
this.diagnostics.push(diagnostic("VEL5052", "A viewport breakpoint must resolve at compile time to a px, rem, or em value; use a const unit token or an imported const unit token", value.span));
|
|
4013
4014
|
}
|