zyzz 0.0.16 → 0.0.18
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/dist/Style.d.ts +4 -3
- package/dist/Style.d.ts.map +1 -1
- package/dist/Style.js +16 -3
- package/dist/Style.js.map +1 -1
- package/dist/internal/Cascade.d.ts +29 -0
- package/dist/internal/Cascade.d.ts.map +1 -1
- package/dist/internal/Cascade.js +45 -0
- package/dist/internal/Cascade.js.map +1 -1
- package/dist/internal/Compound.d.ts +12 -0
- package/dist/internal/Compound.d.ts.map +1 -1
- package/dist/internal/Literal.d.ts +1063 -27
- package/dist/internal/Literal.d.ts.map +1 -1
- package/dist/internal/Literal.js +739 -3
- package/dist/internal/Literal.js.map +1 -1
- package/dist/next/loader.js +43 -17
- package/dist/next/loader.js.map +1 -1
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +19 -7
- package/dist/vite/index.js.map +1 -1
- package/dist/web/Css.d.ts.map +1 -1
- package/dist/web/Css.js +2 -1
- package/dist/web/Css.js.map +1 -1
- package/dist/web/internal/Themes.d.ts +1 -8
- package/dist/web/internal/Themes.d.ts.map +1 -1
- package/dist/web/internal/Themes.js +55 -16
- package/dist/web/internal/Themes.js.map +1 -1
- package/package.json +1 -1
- package/src/Style.ts +39 -17
- package/src/internal/Cascade.ts +45 -0
- package/src/internal/Compound.ts +56 -0
- package/src/internal/Literal.ts +746 -3
- package/src/next/loader.ts +49 -17
- package/src/vite/index.ts +24 -5
- package/src/web/Css.ts +2 -1
- package/src/web/internal/Themes.ts +70 -17
package/package.json
CHANGED
package/src/Style.ts
CHANGED
|
@@ -245,6 +245,17 @@ export function define(
|
|
|
245
245
|
keyof Literal.Properties,
|
|
246
246
|
Map<string | number, Token.Reference>
|
|
247
247
|
>()
|
|
248
|
+
const validatedReferences = new WeakSet<object>()
|
|
249
|
+
|
|
250
|
+
function isReference(value: unknown): value is Token.Reference {
|
|
251
|
+
if (typeof value !== 'object' || value === null) return false
|
|
252
|
+
if (validatedReferences.has(value)) return true
|
|
253
|
+
if (!Token.is(value)) return false
|
|
254
|
+
|
|
255
|
+
// Frozen references can reuse validation across declarations in this definition.
|
|
256
|
+
validatedReferences.add(value)
|
|
257
|
+
return true
|
|
258
|
+
}
|
|
248
259
|
|
|
249
260
|
function report(
|
|
250
261
|
code: Diagnostic['code'],
|
|
@@ -629,7 +640,7 @@ export function define(
|
|
|
629
640
|
theme,
|
|
630
641
|
})
|
|
631
642
|
|
|
632
|
-
if (
|
|
643
|
+
if (isReference(resolved)) {
|
|
633
644
|
let values = references.get(key)
|
|
634
645
|
|
|
635
646
|
if (!values) references.set(key, (values = new Map()))
|
|
@@ -640,8 +651,10 @@ export function define(
|
|
|
640
651
|
return resolved
|
|
641
652
|
})()
|
|
642
653
|
|
|
654
|
+
const reference = isReference(resolved)
|
|
655
|
+
|
|
643
656
|
if (
|
|
644
|
-
|
|
657
|
+
reference &&
|
|
645
658
|
resolved.contract.variableSet &&
|
|
646
659
|
!Token.acceptsReference(resolved, key)
|
|
647
660
|
) {
|
|
@@ -656,7 +669,7 @@ export function define(
|
|
|
656
669
|
if (
|
|
657
670
|
theme &&
|
|
658
671
|
!custom &&
|
|
659
|
-
!
|
|
672
|
+
!reference &&
|
|
660
673
|
Token.mapped(theme, key) &&
|
|
661
674
|
!(Binding.is(resolved) && !resolved.name.startsWith('--z-d')) &&
|
|
662
675
|
!(
|
|
@@ -839,23 +852,32 @@ export type NamedStyle<name extends string = string> = {
|
|
|
839
852
|
|
|
840
853
|
/** Supported literal and token declarations. Unknown properties and undefined values are rejected. */
|
|
841
854
|
export type DeclarationProperties<tokens extends Theme.Tokens = {}> = {
|
|
842
|
-
readonly [property in keyof Literal.Properties]:
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
: [Token.Names<tokens, property>] extends [never]
|
|
846
|
-
? LiteralAtoms[property]
|
|
847
|
-
:
|
|
848
|
-
| Value.Atom<`${string} !custom`>
|
|
849
|
-
| Extract<LiteralAtoms[property], Binding.Reference>)
|
|
850
|
-
| Value.Atom<Token.Names<tokens, property>>
|
|
851
|
-
| {
|
|
852
|
-
[group in Token.Group]: property extends Token.Properties<group>
|
|
853
|
-
? Value.Atom<Token.Reference<group> | Token.Variable<group>>
|
|
854
|
-
: never
|
|
855
|
-
}[Token.Group]
|
|
855
|
+
readonly [property in keyof Literal.Properties]: DeclarationValue<
|
|
856
|
+
tokens,
|
|
857
|
+
property
|
|
856
858
|
>
|
|
857
859
|
}
|
|
858
860
|
|
|
861
|
+
// A named alias caches each property domain without expanding the full declaration map.
|
|
862
|
+
type DeclarationValue<
|
|
863
|
+
tokens extends Theme.Tokens,
|
|
864
|
+
property extends keyof Literal.Properties,
|
|
865
|
+
> = Value.Fallbacks<
|
|
866
|
+
| (property extends `--${string}`
|
|
867
|
+
? LiteralAtoms[property]
|
|
868
|
+
: [Token.Names<tokens, property>] extends [never]
|
|
869
|
+
? LiteralAtoms[property]
|
|
870
|
+
:
|
|
871
|
+
| Value.Atom<`${string} !custom`>
|
|
872
|
+
| Extract<LiteralAtoms[property], Binding.Reference>)
|
|
873
|
+
| Value.Atom<Token.Names<tokens, property>>
|
|
874
|
+
| {
|
|
875
|
+
[group in Token.Group]: property extends Token.Properties<group>
|
|
876
|
+
? Value.Atom<Token.Reference<group> | Token.Variable<group>>
|
|
877
|
+
: never
|
|
878
|
+
}[Token.Group]
|
|
879
|
+
>
|
|
880
|
+
|
|
859
881
|
/** Recursive theme-aware declaration and condition authoring. */
|
|
860
882
|
export type Properties<
|
|
861
883
|
tokens extends Theme.Tokens = {},
|
package/src/internal/Cascade.ts
CHANGED
|
@@ -26,6 +26,7 @@ export const shorthands = {
|
|
|
26
26
|
'backgroundAttachment',
|
|
27
27
|
'backgroundColor',
|
|
28
28
|
],
|
|
29
|
+
backgroundRepeat: ['backgroundRepeatX', 'backgroundRepeatY'],
|
|
29
30
|
border: ['borderWidth', 'borderStyle', 'borderColor', 'borderImage'],
|
|
30
31
|
borderImage: [
|
|
31
32
|
'borderImageSource',
|
|
@@ -34,7 +35,23 @@ export const shorthands = {
|
|
|
34
35
|
'borderImageOutset',
|
|
35
36
|
'borderImageRepeat',
|
|
36
37
|
],
|
|
38
|
+
borderSpacing: [
|
|
39
|
+
'WebkitBorderHorizontalSpacing',
|
|
40
|
+
'WebkitBorderVerticalSpacing',
|
|
41
|
+
],
|
|
37
42
|
caret: ['caretColor', 'caretAnimation', 'caretShape'],
|
|
43
|
+
columnRule: ['columnRuleWidth', 'columnRuleStyle', 'columnRuleColor'],
|
|
44
|
+
columnRuleInset: ['columnRuleInsetCap', 'columnRuleInsetJunction'],
|
|
45
|
+
columnRuleInsetCap: ['columnRuleInsetCapStart', 'columnRuleInsetCapEnd'],
|
|
46
|
+
columnRuleInsetEnd: ['columnRuleInsetCapEnd', 'columnRuleInsetJunctionEnd'],
|
|
47
|
+
columnRuleInsetJunction: [
|
|
48
|
+
'columnRuleInsetJunctionStart',
|
|
49
|
+
'columnRuleInsetJunctionEnd',
|
|
50
|
+
],
|
|
51
|
+
columnRuleInsetStart: [
|
|
52
|
+
'columnRuleInsetCapStart',
|
|
53
|
+
'columnRuleInsetJunctionStart',
|
|
54
|
+
],
|
|
38
55
|
columns: ['columnWidth', 'columnCount', 'columnHeight'],
|
|
39
56
|
container: ['containerName', 'containerType'],
|
|
40
57
|
flex: ['flexGrow', 'flexShrink', 'flexBasis'],
|
|
@@ -80,6 +97,7 @@ export const shorthands = {
|
|
|
80
97
|
'gridTemplateAreas',
|
|
81
98
|
],
|
|
82
99
|
listStyle: ['listStyleType', 'listStylePosition', 'listStyleImage'],
|
|
100
|
+
lineClamp: ['maxLines', 'blockEllipsis', 'continue'],
|
|
83
101
|
mask: [
|
|
84
102
|
'maskImage',
|
|
85
103
|
'maskMode',
|
|
@@ -116,10 +134,31 @@ export const shorthands = {
|
|
|
116
134
|
'offsetAnchor',
|
|
117
135
|
'offsetRotate',
|
|
118
136
|
],
|
|
137
|
+
perspectiveOrigin: ['WebkitPerspectiveOriginX', 'WebkitPerspectiveOriginY'],
|
|
119
138
|
placeContent: ['alignContent', 'justifyContent'],
|
|
120
139
|
placeItems: ['alignItems', 'justifyItems'],
|
|
121
140
|
placeSelf: ['alignSelf', 'justifySelf'],
|
|
122
141
|
positionTry: ['positionTryFallbacks', 'positionTryOrder'],
|
|
142
|
+
rowRule: ['rowRuleWidth', 'rowRuleStyle', 'rowRuleColor'],
|
|
143
|
+
rowRuleInset: ['rowRuleInsetCap', 'rowRuleInsetJunction'],
|
|
144
|
+
rowRuleInsetCap: ['rowRuleInsetCapStart', 'rowRuleInsetCapEnd'],
|
|
145
|
+
rowRuleInsetEnd: ['rowRuleInsetCapEnd', 'rowRuleInsetJunctionEnd'],
|
|
146
|
+
rowRuleInsetJunction: [
|
|
147
|
+
'rowRuleInsetJunctionStart',
|
|
148
|
+
'rowRuleInsetJunctionEnd',
|
|
149
|
+
],
|
|
150
|
+
rowRuleInsetStart: ['rowRuleInsetCapStart', 'rowRuleInsetJunctionStart'],
|
|
151
|
+
rule: ['columnRule', 'rowRule'],
|
|
152
|
+
ruleBreak: ['columnRuleBreak', 'rowRuleBreak'],
|
|
153
|
+
ruleColor: ['columnRuleColor', 'rowRuleColor'],
|
|
154
|
+
ruleInset: ['columnRuleInset', 'rowRuleInset'],
|
|
155
|
+
ruleInsetCap: ['columnRuleInsetCap', 'rowRuleInsetCap'],
|
|
156
|
+
ruleInsetEnd: ['columnRuleInsetEnd', 'rowRuleInsetEnd'],
|
|
157
|
+
ruleInsetJunction: ['columnRuleInsetJunction', 'rowRuleInsetJunction'],
|
|
158
|
+
ruleInsetStart: ['columnRuleInsetStart', 'rowRuleInsetStart'],
|
|
159
|
+
ruleStyle: ['columnRuleStyle', 'rowRuleStyle'],
|
|
160
|
+
ruleVisibilityItems: ['columnRuleVisibilityItems', 'rowRuleVisibilityItems'],
|
|
161
|
+
ruleWidth: ['columnRuleWidth', 'rowRuleWidth'],
|
|
123
162
|
scrollTimeline: ['scrollTimelineName', 'scrollTimelineAxis'],
|
|
124
163
|
textBox: ['textBoxTrim', 'textBoxEdge'],
|
|
125
164
|
textDecoration: [
|
|
@@ -128,6 +167,7 @@ export const shorthands = {
|
|
|
128
167
|
'textDecorationLine',
|
|
129
168
|
'textDecorationThickness',
|
|
130
169
|
],
|
|
170
|
+
textDecorationSkip: ['textDecorationSkipInk', 'textDecorationSkipSpaces'],
|
|
131
171
|
textEmphasis: ['textEmphasisStyle', 'textEmphasisColor'],
|
|
132
172
|
timelineTrigger: [
|
|
133
173
|
'timelineTriggerName',
|
|
@@ -143,6 +183,11 @@ export const shorthands = {
|
|
|
143
183
|
'timelineTriggerActiveRangeStart',
|
|
144
184
|
'timelineTriggerActiveRangeEnd',
|
|
145
185
|
],
|
|
186
|
+
transformOrigin: [
|
|
187
|
+
'WebkitTransformOriginX',
|
|
188
|
+
'WebkitTransformOriginY',
|
|
189
|
+
'WebkitTransformOriginZ',
|
|
190
|
+
],
|
|
146
191
|
transition: [
|
|
147
192
|
'transitionDelay',
|
|
148
193
|
'transitionDuration',
|
package/src/internal/Compound.ts
CHANGED
|
@@ -241,6 +241,15 @@ export type Properties = {
|
|
|
241
241
|
readonly fontVariationSettings:
|
|
242
242
|
| 'normal'
|
|
243
243
|
| List<`${Quoted}${'' | ' '}${number}`>
|
|
244
|
+
/** Legacy vertical glyph orientation accepts only quarter-turn values. */
|
|
245
|
+
readonly glyphOrientationVertical:
|
|
246
|
+
| 'auto'
|
|
247
|
+
| '0deg'
|
|
248
|
+
| '90deg'
|
|
249
|
+
| '0'
|
|
250
|
+
| '90'
|
|
251
|
+
| 0
|
|
252
|
+
| 90
|
|
244
253
|
readonly grid:
|
|
245
254
|
| 'none'
|
|
246
255
|
| Chain<Track | Quoted | 'auto-flow' | 'dense'>
|
|
@@ -400,6 +409,53 @@ export type Properties = {
|
|
|
400
409
|
| 'none'
|
|
401
410
|
| `${Quoted}${'' | ' '}${Quoted}`
|
|
402
411
|
| `${Quoted}${'' | ' '}${Quoted}${string}`
|
|
412
|
+
/** Gap decoration shorthand with optional repetition. */
|
|
413
|
+
readonly rowRule: List<
|
|
414
|
+
| Chain<
|
|
415
|
+
| Exclude<Dimension, `${number}%`>
|
|
416
|
+
| Literal.Color
|
|
417
|
+
| 'thin'
|
|
418
|
+
| 'medium'
|
|
419
|
+
| 'thick'
|
|
420
|
+
| 'none'
|
|
421
|
+
| 'hidden'
|
|
422
|
+
| 'dotted'
|
|
423
|
+
| 'dashed'
|
|
424
|
+
| 'solid'
|
|
425
|
+
| 'double'
|
|
426
|
+
| 'groove'
|
|
427
|
+
| 'ridge'
|
|
428
|
+
| 'inset'
|
|
429
|
+
| 'outset'
|
|
430
|
+
>
|
|
431
|
+
| `repeat(${string})`
|
|
432
|
+
>
|
|
433
|
+
/** Gap decoration colors with optional repetition. */
|
|
434
|
+
readonly rowRuleColor: List<Literal.Color | `repeat(${string})`>
|
|
435
|
+
/** Gap decoration styles with optional repetition. */
|
|
436
|
+
readonly rowRuleStyle: List<
|
|
437
|
+
| 'none'
|
|
438
|
+
| 'hidden'
|
|
439
|
+
| 'dotted'
|
|
440
|
+
| 'dashed'
|
|
441
|
+
| 'solid'
|
|
442
|
+
| 'double'
|
|
443
|
+
| 'groove'
|
|
444
|
+
| 'ridge'
|
|
445
|
+
| 'inset'
|
|
446
|
+
| 'outset'
|
|
447
|
+
| `repeat(${string})`
|
|
448
|
+
>
|
|
449
|
+
/** Gap decoration widths with optional repetition. */
|
|
450
|
+
readonly rowRuleWidth: List<
|
|
451
|
+
| Exclude<Dimension, `${number}%`>
|
|
452
|
+
| 'thin'
|
|
453
|
+
| 'medium'
|
|
454
|
+
| 'thick'
|
|
455
|
+
| `repeat(${string})`
|
|
456
|
+
>
|
|
457
|
+
/** Cap and junction insets separated by an optional slash. */
|
|
458
|
+
readonly ruleInset: Chain<Dimension | Percentage | 'overlap-join'>
|
|
403
459
|
readonly scrollSnapCoordinate: 'none' | List<Position>
|
|
404
460
|
readonly scrollSnapDestination: Position
|
|
405
461
|
readonly scrollSnapPointsX: 'none' | `repeat(${string})`
|