zyzz 0.0.34 → 0.0.36
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/binding/compiler.wasm +0 -0
- package/binding/wasi/zyzz.wasm32-wasi.wasm +0 -0
- package/binding/zyzz.darwin-arm64.node +0 -0
- package/binding/zyzz.darwin-x64.node +0 -0
- package/binding/zyzz.linux-arm64-gnu.node +0 -0
- package/binding/zyzz.linux-arm64-musl.node +0 -0
- package/binding/zyzz.linux-x64-gnu.node +0 -0
- package/binding/zyzz.linux-x64-musl.node +0 -0
- package/binding/zyzz.win32-arm64-msvc.node +0 -0
- package/binding/zyzz.win32-x64-msvc.node +0 -0
- package/dist/Style.d.ts +3 -2
- package/dist/Style.d.ts.map +1 -1
- package/dist/Style.js.map +1 -1
- package/dist/Vars.d.ts +17 -11
- package/dist/Vars.d.ts.map +1 -1
- package/dist/Vars.js.map +1 -1
- package/dist/babel/index.d.ts.map +1 -1
- package/dist/babel/index.js +10 -1
- package/dist/babel/index.js.map +1 -1
- package/dist/base-ui/react/Config.d.ts +48 -0
- package/dist/base-ui/react/Config.d.ts.map +1 -0
- package/dist/base-ui/react/Config.js +30 -0
- package/dist/base-ui/react/Config.js.map +1 -0
- package/dist/base-ui/react/Style.d.ts +47 -0
- package/dist/base-ui/react/Style.d.ts.map +1 -0
- package/dist/base-ui/react/Style.js +12 -0
- package/dist/base-ui/react/Style.js.map +1 -0
- package/dist/base-ui/react/index.d.ts +13 -0
- package/dist/base-ui/react/index.d.ts.map +1 -0
- package/dist/base-ui/react/index.js +13 -0
- package/dist/base-ui/react/index.js.map +1 -0
- package/dist/base-ui/react/internal/Attributes.generated.d.ts +372 -0
- package/dist/base-ui/react/internal/Attributes.generated.d.ts.map +1 -0
- package/dist/base-ui/react/internal/Attributes.generated.js +403 -0
- package/dist/base-ui/react/internal/Attributes.generated.js.map +1 -0
- package/dist/base-ui/react/internal/Authoring.d.ts +9 -0
- package/dist/base-ui/react/internal/Authoring.d.ts.map +1 -0
- package/dist/base-ui/react/internal/Authoring.js +139 -0
- package/dist/base-ui/react/internal/Authoring.js.map +1 -0
- package/dist/base-ui/react/internal/Types.generated.d.ts +18933 -0
- package/dist/base-ui/react/internal/Types.generated.d.ts.map +1 -0
- package/dist/base-ui/react/internal/Types.generated.js +2 -0
- package/dist/base-ui/react/internal/Types.generated.js.map +1 -0
- package/dist/binding/compiler.wasm +0 -0
- package/dist/compiler/Graph.d.ts +1 -1
- package/dist/compiler/Graph.d.ts.map +1 -1
- package/dist/default.js.zyzz.json +1 -1
- package/dist/internal/Condition.d.ts +12 -1
- package/dist/internal/Condition.d.ts.map +1 -1
- package/dist/internal/Condition.js.map +1 -1
- package/dist/internal/Configuration.d.ts +10 -3
- package/dist/internal/Configuration.d.ts.map +1 -1
- package/dist/internal/Configuration.js.map +1 -1
- package/dist/internal/Value.d.ts +4 -0
- package/dist/internal/Value.d.ts.map +1 -1
- package/dist/internal/Value.js.map +1 -1
- package/dist/internal/VariableSets.d.ts.map +1 -1
- package/dist/internal/VariableSets.js +16 -0
- package/dist/internal/VariableSets.js.map +1 -1
- package/dist/web/internal/Wasm.generated.d.ts.map +1 -1
- package/dist/web/internal/Wasm.generated.js +1 -1
- package/dist/web/internal/Wasm.generated.js.map +1 -1
- package/package.json +10 -1
- package/src/Style.ts +18 -8
- package/src/Vars.ts +41 -21
- package/src/babel/index.ts +13 -1
- package/src/base-ui/react/Config.ts +74 -0
- package/src/base-ui/react/Style.ts +106 -0
- package/src/base-ui/react/index.ts +12 -0
- package/src/base-ui/react/internal/Attributes.generated.ts +403 -0
- package/src/base-ui/react/internal/Authoring.ts +173 -0
- package/src/base-ui/react/internal/Catalog.generated.ts +8088 -0
- package/src/base-ui/react/internal/Types.generated.ts +19016 -0
- package/src/compiler/Graph.ts +1 -1
- package/src/internal/Condition.ts +29 -10
- package/src/internal/Configuration.ts +46 -15
- package/src/internal/Value.ts +5 -0
- package/src/internal/VariableSets.ts +22 -0
- package/src/web/internal/Wasm.generated.ts +1 -1
package/src/compiler/Graph.ts
CHANGED
|
@@ -106,7 +106,7 @@ export declare namespace compile {
|
|
|
106
106
|
readonly [Stylesheets.packed]?: readonly Stylesheets.Resource[]
|
|
107
107
|
/** Independently loaded reset for module-based hosts. */
|
|
108
108
|
readonly [Stylesheets.reset]?: Stylesheets.Resource | undefined
|
|
109
|
-
/** Versioned compiler-only JSON
|
|
109
|
+
/** Versioned compiler-only JSON, including static literal exports. Publish beside the compiled entrypoint as <entry>.zyzz.json. */
|
|
110
110
|
readonly contracts: Readonly<Record<string, string>>
|
|
111
111
|
/** Direct static runtime source and library-contract dependencies, keyed by module identity. */
|
|
112
112
|
readonly dependencies: Readonly<Record<string, readonly string[]>>
|
|
@@ -91,16 +91,35 @@ export type Relationship = symbol & { readonly [relationship]: true }
|
|
|
91
91
|
export type Keys<
|
|
92
92
|
tokens extends Theme.Tokens = {},
|
|
93
93
|
key extends PropertyKey = never,
|
|
94
|
-
> =
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
94
|
+
> = [key] extends [never]
|
|
95
|
+
? Static<tokens>
|
|
96
|
+
: symbol extends key
|
|
97
|
+
? Static<tokens, symbol>
|
|
98
|
+
: Static<tokens, Relationship | Query>
|
|
99
|
+
|
|
100
|
+
/** The part of `Keys` that depends on the authored keys. */
|
|
101
|
+
export type Dynamic<key extends PropertyKey> = [key] extends [never]
|
|
102
|
+
? never
|
|
103
|
+
: symbol extends key
|
|
104
|
+
? symbol
|
|
105
|
+
: Relationship | Query
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The part of `Keys` that depends only on the bound tokens, plus `extra`.
|
|
109
|
+
* The wrapping conditional caches the union by its arguments. A bare union alias is reduced
|
|
110
|
+
* again on every instantiation, which compares each literal against each pattern.
|
|
111
|
+
*/
|
|
112
|
+
export type Static<tokens extends Theme.Tokens, extra = never> = [
|
|
113
|
+
tokens,
|
|
114
|
+
extra,
|
|
115
|
+
] extends [unknown, unknown]
|
|
116
|
+
?
|
|
117
|
+
| extra
|
|
118
|
+
| Raw
|
|
119
|
+
| `@media ${Alias<Names<tokens, 'breakpoint'>>}`
|
|
120
|
+
| `@container ${Alias<Names<tokens, 'container'>>}`
|
|
121
|
+
| `@container ${Containers<tokens>} ${Alias<Names<tokens, 'container'>>}`
|
|
122
|
+
: never
|
|
104
123
|
|
|
105
124
|
/** Recognizes structured rule keys before declaration parsing. */
|
|
106
125
|
export function is(key: string): boolean {
|
|
@@ -19,6 +19,7 @@ import * as VariableSets from './VariableSets.js'
|
|
|
19
19
|
import * as Vars from '../Vars.js'
|
|
20
20
|
import * as Selection from '../runtime/Selection.js'
|
|
21
21
|
import * as Token from './Token.js'
|
|
22
|
+
import type * as Value from './Value.js'
|
|
22
23
|
import type * as Completion from './Completion.js'
|
|
23
24
|
|
|
24
25
|
/** Creates token-free authoring without a configuration file or global state. */
|
|
@@ -673,6 +674,45 @@ type Entry<
|
|
|
673
674
|
|
|
674
675
|
type Keys<styles> = styles extends unknown ? keyof styles : never
|
|
675
676
|
|
|
677
|
+
/**
|
|
678
|
+
* Returns `key` when it names a condition or an allowed `@layer` block, otherwise `never`.
|
|
679
|
+
* Testing the key against the cached `Condition.Static` union avoids building a union per key.
|
|
680
|
+
*/
|
|
681
|
+
export type Nested<
|
|
682
|
+
tokens extends Theme.Tokens,
|
|
683
|
+
key extends PropertyKey,
|
|
684
|
+
layers extends string,
|
|
685
|
+
> = key extends `@layer${string}`
|
|
686
|
+
? key extends '@layer' | `@layer ${layers}`
|
|
687
|
+
? key
|
|
688
|
+
: key extends Exclude<Condition.Static<tokens>, `@layer${string}`>
|
|
689
|
+
? key
|
|
690
|
+
: never
|
|
691
|
+
: key extends Condition.Static<tokens>
|
|
692
|
+
? key
|
|
693
|
+
: key extends Condition.Dynamic<key>
|
|
694
|
+
? key
|
|
695
|
+
: never
|
|
696
|
+
|
|
697
|
+
// The conditional caches this union per configuration. `Body` runs for every style, and the
|
|
698
|
+
// union holds every property name.
|
|
699
|
+
type Reserved<
|
|
700
|
+
tokens extends Theme.Tokens,
|
|
701
|
+
layers extends string,
|
|
702
|
+
mappings extends Shorthands.Map,
|
|
703
|
+
> = [tokens, layers, mappings] extends [unknown, unknown, unknown]
|
|
704
|
+
?
|
|
705
|
+
| keyof mappings
|
|
706
|
+
| 'selectors'
|
|
707
|
+
| 'targets'
|
|
708
|
+
| 'typography'
|
|
709
|
+
| 'vars'
|
|
710
|
+
| keyof Style.DeclarationProperties
|
|
711
|
+
| Exclude<Condition.Static<tokens>, `@layer${string}`>
|
|
712
|
+
| '@layer'
|
|
713
|
+
| `@layer ${layers}`
|
|
714
|
+
: never
|
|
715
|
+
|
|
676
716
|
/** Checked declaration body shared by configured styles and recipe choices. */
|
|
677
717
|
export type Body<
|
|
678
718
|
styles,
|
|
@@ -682,16 +722,8 @@ export type Body<
|
|
|
682
722
|
targets extends boolean = true,
|
|
683
723
|
> = Record<
|
|
684
724
|
Exclude<
|
|
685
|
-
Keys<styles>,
|
|
686
|
-
|
|
687
|
-
| 'selectors'
|
|
688
|
-
| 'targets'
|
|
689
|
-
| 'typography'
|
|
690
|
-
| 'vars'
|
|
691
|
-
| keyof Style.DeclarationProperties
|
|
692
|
-
| Exclude<Condition.Keys<tokens, Keys<styles>>, `@layer${string}`>
|
|
693
|
-
| '@layer'
|
|
694
|
-
| `@layer ${layers}`
|
|
725
|
+
Exclude<Keys<styles>, Reserved<tokens, layers, mappings>>,
|
|
726
|
+
Exclude<Condition.Dynamic<Keys<styles>>, `@layer${string}`>
|
|
695
727
|
>,
|
|
696
728
|
never
|
|
697
729
|
> &
|
|
@@ -735,10 +767,7 @@ export type Body<
|
|
|
735
767
|
: never
|
|
736
768
|
}
|
|
737
769
|
: never
|
|
738
|
-
: key extends
|
|
739
|
-
| Exclude<Condition.Keys<tokens, key>, `@layer${string}`>
|
|
740
|
-
| '@layer'
|
|
741
|
-
| `@layer ${layers}`
|
|
770
|
+
: key extends Nested<tokens, key, layers>
|
|
742
771
|
? styles[key] extends Record<string, unknown>
|
|
743
772
|
? Body<styles[key], tokens, layers, mappings, targets>
|
|
744
773
|
: never
|
|
@@ -753,7 +782,9 @@ export type Body<
|
|
|
753
782
|
: target
|
|
754
783
|
}[mappings[key][number]] extends never
|
|
755
784
|
? styles[key]
|
|
756
|
-
: never
|
|
785
|
+
: [Token.Names<tokens, mappings[key][number]>] extends [never]
|
|
786
|
+
? never
|
|
787
|
+
: Value.Mismatch<tokens, mappings[key][number]>
|
|
757
788
|
: Style.Accepted<Pick<styles, key>, tokens>[key]
|
|
758
789
|
}
|
|
759
790
|
: never)
|
package/src/internal/Value.ts
CHANGED
|
@@ -201,6 +201,11 @@ export type Mismatch<tokens, property extends keyof Literal.Properties> =
|
|
|
201
201
|
>
|
|
202
202
|
: never
|
|
203
203
|
|
|
204
|
+
/** Lists the named sets a property accepts, so mismatch diagnostics name them. */
|
|
205
|
+
export type Unmatched<names> =
|
|
206
|
+
// Without configured names the property is unknown, and `never` reports it as such.
|
|
207
|
+
[names] extends [never] ? never : Expected<names>
|
|
208
|
+
|
|
204
209
|
// An object brand never reduces with a string literal, so the diagnostic keeps the expected values.
|
|
205
210
|
type Expected<values> = { readonly [expected]: values }
|
|
206
211
|
|
|
@@ -82,6 +82,28 @@ export function build(
|
|
|
82
82
|
const conditions: string[][] = []
|
|
83
83
|
const active = new Set<object>()
|
|
84
84
|
function visit(input: unknown, path: string[]) {
|
|
85
|
+
if (input === null && base && path.length) {
|
|
86
|
+
if (options.derived)
|
|
87
|
+
throw new Vars.InvalidError(
|
|
88
|
+
path,
|
|
89
|
+
'Derived variables cannot remove paths.',
|
|
90
|
+
)
|
|
91
|
+
const key = JSON.stringify(path)
|
|
92
|
+
if (!leaves.has(key) && !categories.has(key))
|
|
93
|
+
throw new Vars.InvalidError(
|
|
94
|
+
path,
|
|
95
|
+
'Extensions can only remove existing paths.',
|
|
96
|
+
)
|
|
97
|
+
// A removed category takes every leaf below it, including typography conditions.
|
|
98
|
+
for (const name of Object.keys(values)) {
|
|
99
|
+
const parts = paths[name] ?? name.split('.')
|
|
100
|
+
if (path.every((part, index) => parts[index] === part)) {
|
|
101
|
+
delete values[name]
|
|
102
|
+
delete paths[name]
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return
|
|
106
|
+
}
|
|
85
107
|
if (
|
|
86
108
|
typeof input === 'string' ||
|
|
87
109
|
typeof input === 'number' ||
|