zyzz 0.0.2 → 0.0.5
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 +34 -19
- package/dist/Config.d.ts +16 -167
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +7 -246
- package/dist/Config.js.map +1 -1
- package/dist/Style.d.ts +19 -13
- package/dist/Style.d.ts.map +1 -1
- package/dist/Style.js +73 -7
- package/dist/Style.js.map +1 -1
- package/dist/Vars.d.ts +114 -0
- package/dist/Vars.d.ts.map +1 -0
- package/dist/Vars.js +42 -0
- package/dist/Vars.js.map +1 -0
- package/dist/compiler/Graph.js +11 -8
- package/dist/compiler/Graph.js.map +1 -1
- package/dist/compiler/Native.d.ts +5 -5
- package/dist/compiler/Native.d.ts.map +1 -1
- package/dist/compiler/Native.js +21 -21
- package/dist/compiler/Native.js.map +1 -1
- package/dist/compiler/Source.d.ts +10 -6
- package/dist/compiler/Source.d.ts.map +1 -1
- package/dist/compiler/Source.js +66 -11
- package/dist/compiler/Source.js.map +1 -1
- package/dist/compiler/Transform.d.ts +1 -1
- package/dist/compiler/Transform.d.ts.map +1 -1
- package/dist/compiler/Transform.js +59 -21
- package/dist/compiler/Transform.js.map +1 -1
- package/dist/compiler/internal/Compositions.d.ts +5 -0
- package/dist/compiler/internal/Compositions.d.ts.map +1 -1
- package/dist/compiler/internal/Compositions.js +22 -3
- package/dist/compiler/internal/Compositions.js.map +1 -1
- package/dist/compiler/internal/Configurations.d.ts.map +1 -1
- package/dist/compiler/internal/Configurations.js +73 -12
- package/dist/compiler/internal/Configurations.js.map +1 -1
- package/dist/compiler/internal/Contract.d.ts +1 -1
- package/dist/compiler/internal/Contract.d.ts.map +1 -1
- package/dist/compiler/internal/Contract.js +162 -13
- package/dist/compiler/internal/Contract.js.map +1 -1
- package/dist/compiler/internal/Contributions.js +1 -1
- package/dist/compiler/internal/Contributions.js.map +1 -1
- package/dist/compiler/internal/Dynamic.js +1 -1
- package/dist/compiler/internal/Dynamic.js.map +1 -1
- package/dist/compiler/internal/Expression.d.ts +3 -0
- package/dist/compiler/internal/Expression.d.ts.map +1 -1
- package/dist/compiler/internal/Expression.js +21 -0
- package/dist/compiler/internal/Expression.js.map +1 -1
- package/dist/compiler/internal/Identifiers.d.ts +1 -1
- package/dist/compiler/internal/Identifiers.d.ts.map +1 -1
- package/dist/compiler/internal/Identifiers.js +2 -2
- package/dist/compiler/internal/Identifiers.js.map +1 -1
- package/dist/compiler/internal/NativeBindings.d.ts +1 -1
- package/dist/compiler/internal/NativeBindings.d.ts.map +1 -1
- package/dist/compiler/internal/NativeBindings.js +3 -3
- package/dist/compiler/internal/NativeBindings.js.map +1 -1
- package/dist/compiler/internal/PackedStyles.d.ts +1 -1
- package/dist/compiler/internal/PackedStyles.d.ts.map +1 -1
- package/dist/compiler/internal/PackedStyles.js +15 -25
- package/dist/compiler/internal/PackedStyles.js.map +1 -1
- package/dist/compiler/internal/Recipes.js +1 -1
- package/dist/compiler/internal/Recipes.js.map +1 -1
- package/dist/compiler/internal/Selectors.js +1 -1
- package/dist/compiler/internal/Selectors.js.map +1 -1
- package/dist/compiler/internal/Themes.d.ts +12 -3
- package/dist/compiler/internal/Themes.d.ts.map +1 -1
- package/dist/compiler/internal/Themes.js +192 -52
- package/dist/compiler/internal/Themes.js.map +1 -1
- package/dist/compiler/internal/{Variables.d.ts → Vars.d.ts} +1 -1
- package/dist/compiler/internal/Vars.d.ts.map +1 -0
- package/dist/compiler/internal/{Variables.js → Vars.js} +3 -3
- package/dist/compiler/internal/Vars.js.map +1 -0
- package/dist/default.d.ts +451 -1649
- package/dist/default.d.ts.map +1 -1
- package/dist/default.js +389 -80
- package/dist/default.js.map +2 -2
- package/dist/default.js.zyzz.json +1 -1
- package/dist/esbuild/index.d.ts +3 -0
- package/dist/esbuild/index.d.ts.map +1 -0
- package/dist/esbuild/index.js +5 -0
- package/dist/esbuild/index.js.map +1 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/internal/Authoring.d.ts +1 -1
- package/dist/internal/Authoring.d.ts.map +1 -1
- package/dist/internal/Authoring.js +4 -4
- package/dist/internal/Authoring.js.map +1 -1
- package/dist/internal/Binding.d.ts +1 -1
- package/dist/internal/Binding.d.ts.map +1 -1
- package/dist/internal/Completion.d.ts +19 -0
- package/dist/internal/Completion.d.ts.map +1 -0
- package/dist/internal/Completion.js +2 -0
- package/dist/internal/Completion.js.map +1 -0
- package/dist/internal/Condition.d.ts +3 -1
- package/dist/internal/Condition.d.ts.map +1 -1
- package/dist/internal/Condition.js.map +1 -1
- package/dist/internal/Configuration.d.ts +248 -0
- package/dist/internal/Configuration.d.ts.map +1 -0
- package/dist/internal/Configuration.js +343 -0
- package/dist/internal/Configuration.js.map +1 -0
- package/dist/internal/Shorthands.d.ts +1 -1
- package/dist/internal/Shorthands.d.ts.map +1 -1
- package/dist/internal/Shorthands.js +1 -0
- package/dist/internal/Shorthands.js.map +1 -1
- package/dist/{Theme.d.ts → internal/Theme.d.ts} +24 -19
- package/dist/internal/Theme.d.ts.map +1 -0
- package/dist/{Theme.js → internal/Theme.js} +57 -14
- package/dist/internal/Theme.js.map +1 -0
- package/dist/internal/Token.d.ts +46 -16
- package/dist/internal/Token.d.ts.map +1 -1
- package/dist/internal/Token.js +89 -5
- package/dist/internal/Token.js.map +1 -1
- package/dist/internal/Typography.d.ts +31 -0
- package/dist/internal/Typography.d.ts.map +1 -0
- package/dist/internal/Typography.js +54 -0
- package/dist/internal/Typography.js.map +1 -0
- package/dist/internal/Value.d.ts +6 -1
- package/dist/internal/Value.d.ts.map +1 -1
- package/dist/internal/Value.js.map +1 -1
- package/dist/internal/VariableSets.d.ts +20 -0
- package/dist/internal/VariableSets.d.ts.map +1 -0
- package/dist/internal/VariableSets.js +317 -0
- package/dist/internal/VariableSets.js.map +1 -0
- package/dist/next/loader.js +15 -5
- package/dist/next/loader.js.map +1 -1
- package/dist/node/Host.d.ts.map +1 -1
- package/dist/node/Host.js +1 -1
- package/dist/node/Host.js.map +1 -1
- package/dist/react-native/Host.d.ts +2 -2
- package/dist/react-native/Host.d.ts.map +1 -1
- package/dist/react-native/Host.js +4 -4
- package/dist/react-native/Host.js.map +1 -1
- package/dist/react-native/StyleSheet.d.ts +9 -8
- package/dist/react-native/StyleSheet.d.ts.map +1 -1
- package/dist/react-native/StyleSheet.js +29 -23
- package/dist/react-native/StyleSheet.js.map +1 -1
- package/dist/react-native/Variants.d.ts +3 -3
- package/dist/react-native/Variants.d.ts.map +1 -1
- package/dist/react-native/Variants.js +2 -2
- package/dist/react-native/react.d.ts +1 -1
- package/dist/react-native/react.d.ts.map +1 -1
- package/dist/react-native/react.js +5 -5
- package/dist/react-native/react.js.map +1 -1
- package/dist/rollup/index.d.ts +3 -0
- package/dist/rollup/index.d.ts.map +1 -0
- package/dist/rollup/index.js +5 -0
- package/dist/rollup/index.js.map +1 -0
- package/dist/runtime/Appearance.d.ts +7 -7
- package/dist/runtime/Appearance.d.ts.map +1 -1
- package/dist/runtime/Appearance.js +15 -15
- package/dist/runtime/Appearance.js.map +1 -1
- package/dist/runtime/Dynamic.d.ts.map +1 -1
- package/dist/runtime/Dynamic.js +4 -1
- package/dist/runtime/Dynamic.js.map +1 -1
- package/dist/runtime/NativeContext.d.ts +4 -4
- package/dist/runtime/NativeContext.d.ts.map +1 -1
- package/dist/runtime/NativeContext.js +5 -5
- package/dist/runtime/NativeContext.js.map +1 -1
- package/dist/runtime/NativeDynamic.d.ts +1 -1
- package/dist/runtime/NativeDynamic.d.ts.map +1 -1
- package/dist/runtime/NativeDynamic.js.map +1 -1
- package/dist/runtime/Props.d.ts +1 -1
- package/dist/runtime/Props.js +3 -3
- package/dist/runtime/Props.js.map +1 -1
- package/dist/runtime/Selection.d.ts +14 -10
- package/dist/runtime/Selection.d.ts.map +1 -1
- package/dist/runtime/Selection.js +19 -18
- package/dist/runtime/Selection.js.map +1 -1
- package/dist/styleFunction.d.ts +14 -14
- package/dist/styleFunction.d.ts.map +1 -1
- package/dist/styleFunction.js.map +1 -1
- package/dist/unplugin/index.d.ts +20 -0
- package/dist/unplugin/index.d.ts.map +1 -0
- package/dist/unplugin/index.js +498 -0
- package/dist/unplugin/index.js.map +1 -0
- package/dist/variants.d.ts +3 -3
- package/dist/variants.d.ts.map +1 -1
- package/dist/variants.js.map +1 -1
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +6 -3
- package/dist/vite/index.js.map +1 -1
- package/dist/web/Css.d.ts +4 -3
- package/dist/web/Css.d.ts.map +1 -1
- package/dist/web/Css.js +4 -4
- package/dist/web/Css.js.map +1 -1
- package/dist/web/internal/Themes.d.ts +3 -2
- package/dist/web/internal/Themes.d.ts.map +1 -1
- package/dist/web/internal/Themes.js +42 -6
- package/dist/web/internal/Themes.js.map +1 -1
- package/dist/webpack/index.d.ts +3 -0
- package/dist/webpack/index.d.ts.map +1 -0
- package/dist/webpack/index.js +5 -0
- package/dist/webpack/index.js.map +1 -0
- package/package.json +23 -2
- package/src/Config.ts +43 -684
- package/src/Style.ts +167 -40
- package/src/Vars.ts +299 -0
- package/src/compiler/Graph.ts +14 -9
- package/src/compiler/Native.ts +29 -32
- package/src/compiler/Source.ts +85 -18
- package/src/compiler/Transform.ts +78 -22
- package/src/compiler/internal/Compositions.ts +36 -3
- package/src/compiler/internal/Configurations.ts +83 -11
- package/src/compiler/internal/Contract.ts +223 -17
- package/src/compiler/internal/Contributions.ts +1 -1
- package/src/compiler/internal/Dynamic.ts +1 -1
- package/src/compiler/internal/Expression.ts +26 -0
- package/src/compiler/internal/Identifiers.ts +2 -1
- package/src/compiler/internal/NativeBindings.ts +3 -3
- package/src/compiler/internal/PackedStyles.ts +22 -26
- package/src/compiler/internal/Recipes.ts +1 -1
- package/src/compiler/internal/Selectors.ts +1 -1
- package/src/compiler/internal/Themes.ts +266 -57
- package/src/compiler/internal/{Variables.ts → Vars.ts} +2 -2
- package/src/default.ts +868 -156
- package/src/esbuild/index.ts +5 -0
- package/src/index.ts +4 -4
- package/src/internal/Authoring.ts +5 -7
- package/src/internal/Binding.ts +1 -1
- package/src/internal/Completion.ts +42 -0
- package/src/internal/Condition.ts +31 -1
- package/src/internal/Configuration.ts +970 -0
- package/src/internal/Shorthands.ts +2 -0
- package/src/{Theme.ts → internal/Theme.ts} +174 -48
- package/src/internal/Token.ts +258 -85
- package/src/internal/Typography.ts +106 -0
- package/src/internal/Value.ts +45 -26
- package/src/internal/VariableSets.ts +458 -0
- package/src/next/loader.ts +19 -5
- package/src/node/Host.ts +1 -2
- package/src/react-native/Host.ts +6 -6
- package/src/react-native/StyleSheet.ts +49 -42
- package/src/react-native/Variants.ts +3 -3
- package/src/react-native/react.ts +6 -6
- package/src/rollup/index.ts +5 -0
- package/src/runtime/Appearance.ts +20 -20
- package/src/runtime/Dynamic.ts +4 -1
- package/src/runtime/NativeContext.ts +8 -8
- package/src/runtime/NativeDynamic.ts +2 -4
- package/src/runtime/Props.ts +3 -3
- package/src/runtime/Selection.ts +44 -33
- package/src/styleFunction.ts +22 -19
- package/src/unplugin/index.ts +600 -0
- package/src/variants.ts +7 -5
- package/src/vite/index.ts +5 -4
- package/src/web/Css.ts +10 -7
- package/src/web/internal/Themes.ts +52 -9
- package/src/webpack/index.ts +5 -0
- package/dist/Theme.d.ts.map +0 -1
- package/dist/Theme.js.map +0 -1
- package/dist/compiler/internal/Variables.d.ts.map +0 -1
- package/dist/compiler/internal/Variables.js.map +0 -1
package/src/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Exposes token-free authoring, ordered style definitions, and
|
|
2
|
+
* Exposes token-free authoring, ordered style definitions, and variable contracts.
|
|
3
3
|
* @module
|
|
4
4
|
*/
|
|
5
|
-
/** Explicit
|
|
5
|
+
/** Explicit variable and layer authoring contracts. */
|
|
6
6
|
export * as Config from './Config.js'
|
|
7
7
|
/** Token-free literal authoring; requires a compile-time source transform. */
|
|
8
8
|
export { style } from './styleFunction.js'
|
|
@@ -12,9 +12,9 @@ export { cx } from './cx.js'
|
|
|
12
12
|
export type * as Props from './Props.js'
|
|
13
13
|
/** Typed literal style definitions and validation diagnostics. */
|
|
14
14
|
export * as Style from './Style.js'
|
|
15
|
-
/** Typed theme contracts and compatible token overrides. */
|
|
16
|
-
export * as Theme from './Theme.js'
|
|
17
15
|
/** Typed CSS variable declarations and inline assignments. */
|
|
18
16
|
export { variable } from './variable.js'
|
|
17
|
+
/** Immutable shared values, conditions, and compatible variable sets. */
|
|
18
|
+
export * as Vars from './Vars.js'
|
|
19
19
|
/** Single-element finite recipes compiled ahead of time. */
|
|
20
20
|
export { variants } from './variants.js'
|
|
@@ -4,7 +4,7 @@ import * as Html from '../runtime/CompositionHtml.js'
|
|
|
4
4
|
import * as Identity from './Identity.js'
|
|
5
5
|
import * as Props from '../runtime/Props.js'
|
|
6
6
|
import * as Style from '../Style.js'
|
|
7
|
-
import type * as Theme from '
|
|
7
|
+
import type * as Theme from './Theme.js'
|
|
8
8
|
|
|
9
9
|
/** Private ownership used by uncompiled composition; never spread onto DOM props. */
|
|
10
10
|
export const metadata = Symbol.for('zyzz.authoring')
|
|
@@ -44,7 +44,7 @@ export function body(input: Record<string, unknown>): Record<string, unknown> {
|
|
|
44
44
|
descriptors.web = { ...web, value: body(web.value) }
|
|
45
45
|
return [[key, Object.create(Object.getPrototypeOf(value), descriptors)]]
|
|
46
46
|
}
|
|
47
|
-
if (key === 'selectors' || key === '
|
|
47
|
+
if (key === 'selectors' || key === 'vars')
|
|
48
48
|
return Object.entries(value as Record<string, unknown>).map(
|
|
49
49
|
([name, entry]) => [
|
|
50
50
|
name,
|
|
@@ -84,7 +84,7 @@ export function create(
|
|
|
84
84
|
) => Style.Definition
|
|
85
85
|
)(
|
|
86
86
|
{ style: body(input as Record<string, unknown>) },
|
|
87
|
-
{
|
|
87
|
+
{ vars: options.theme },
|
|
88
88
|
).styles[0]!,
|
|
89
89
|
)
|
|
90
90
|
const props = Props.create({ className })
|
|
@@ -95,7 +95,7 @@ export function create(
|
|
|
95
95
|
...result.style,
|
|
96
96
|
}
|
|
97
97
|
for (const [field, value] of Object.entries(values ?? {})) {
|
|
98
|
-
if (['className', 'style', '
|
|
98
|
+
if (['className', 'style', 'vars'].includes(field)) continue
|
|
99
99
|
style[Identity.slot(id!, field)] =
|
|
100
100
|
value === '' ? ' ' : (value as string | number)
|
|
101
101
|
}
|
|
@@ -107,9 +107,7 @@ export function create(
|
|
|
107
107
|
attributes: [],
|
|
108
108
|
slots: dynamic
|
|
109
109
|
? Object.keys(values ?? {})
|
|
110
|
-
.filter(
|
|
111
|
-
(key) => !['className', 'style', 'variables'].includes(key),
|
|
112
|
-
)
|
|
110
|
+
.filter((key) => !['className', 'style', 'vars'].includes(key))
|
|
113
111
|
.map((key) => Identity.slot(id!, key))
|
|
114
112
|
: [],
|
|
115
113
|
},
|
package/src/internal/Binding.ts
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** Supplies editor hints independently of inferred declaration validation. @module */
|
|
2
|
+
import type * as Theme from './Theme.js'
|
|
3
|
+
import type * as Condition from './Condition.js'
|
|
4
|
+
import type * as Literal from './Literal.js'
|
|
5
|
+
import type * as Token from './Token.js'
|
|
6
|
+
import type * as Typography from './Typography.js'
|
|
7
|
+
|
|
8
|
+
/** Recursive hints do not determine which authored declarations are accepted. */
|
|
9
|
+
export type Properties<
|
|
10
|
+
tokens extends Theme.Tokens = {},
|
|
11
|
+
styles = Record<string, unknown>,
|
|
12
|
+
> = {
|
|
13
|
+
readonly [property in keyof Literal.Properties & keyof styles]?:
|
|
14
|
+
| (string extends Literal.Properties[property]
|
|
15
|
+
? never
|
|
16
|
+
: Literal.Properties[property])
|
|
17
|
+
| Token.Names<tokens, property>
|
|
18
|
+
| (string & {})
|
|
19
|
+
| number
|
|
20
|
+
| object
|
|
21
|
+
} & {
|
|
22
|
+
// Escaped custom-property names can contain nesting characters.
|
|
23
|
+
readonly [key in (`@${string}` | `:${string}` | `${string}&${string}`) &
|
|
24
|
+
keyof styles]?:
|
|
25
|
+
| Nested<tokens>
|
|
26
|
+
| (key extends `${string}&${string}` ? string | number : never)
|
|
27
|
+
} & {
|
|
28
|
+
readonly [key in (
|
|
29
|
+
| Condition.Suggestions
|
|
30
|
+
| Exclude<Condition.Keys<tokens>, Condition.Raw>
|
|
31
|
+
) &
|
|
32
|
+
keyof styles]?: Nested<tokens>
|
|
33
|
+
} & {
|
|
34
|
+
readonly [property in (Typography.Names<tokens> extends never
|
|
35
|
+
? never
|
|
36
|
+
: 'typography') &
|
|
37
|
+
keyof styles]?: Typography.Names<tokens> | (string & {})
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Inferred validation checks extra fields, including vars and configured shorthands.
|
|
41
|
+
type Nested<tokens extends Theme.Tokens> = Properties<tokens> &
|
|
42
|
+
Readonly<Record<string, unknown>>
|
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
/** Typed nested selector and condition keys without a general string index. @module */
|
|
2
|
-
import type * as Theme from '
|
|
2
|
+
import type * as Theme from './Theme.js'
|
|
3
|
+
|
|
4
|
+
/** Concrete suggestions supplement open selector and query patterns. */
|
|
5
|
+
export type Suggestions =
|
|
6
|
+
| '::after'
|
|
7
|
+
| '::backdrop'
|
|
8
|
+
| '::before'
|
|
9
|
+
| '::first-letter'
|
|
10
|
+
| '::first-line'
|
|
11
|
+
| '::marker'
|
|
12
|
+
| '::placeholder'
|
|
13
|
+
| '::selection'
|
|
14
|
+
| ':active'
|
|
15
|
+
| ':checked'
|
|
16
|
+
| ':disabled'
|
|
17
|
+
| ':empty'
|
|
18
|
+
| ':enabled'
|
|
19
|
+
| ':first-child'
|
|
20
|
+
| ':focus'
|
|
21
|
+
| ':focus-visible'
|
|
22
|
+
| ':focus-within'
|
|
23
|
+
| ':hover'
|
|
24
|
+
| ':last-child'
|
|
25
|
+
| ':only-child'
|
|
26
|
+
| ':visited'
|
|
27
|
+
| '@container'
|
|
28
|
+
| '@layer'
|
|
29
|
+
| '@media'
|
|
30
|
+
| '@scope'
|
|
31
|
+
| '@starting-style'
|
|
32
|
+
| '@supports'
|
|
3
33
|
|
|
4
34
|
type Case<text extends string> = text extends `${infer first}${infer rest}`
|
|
5
35
|
? `${Lowercase<first> | Uppercase<first>}${Case<rest>}`
|