stillwind 0.0.0 → 0.1.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/AGENTS_TEMPLATE.md +5 -0
- package/LICENSE +21 -0
- package/README.md +166 -0
- package/TAILWINDCSS-MIT-LICENSE +21 -0
- package/css/builtin-metadata/sw-motion-properties.css +186 -0
- package/css/builtin-metadata/tw-legacy-metadata.css +36 -0
- package/css/builtin-metadata/tw-properties.css +944 -0
- package/css/builtin-metadata/tw-registry-metadata.css +52 -0
- package/css/builtin-metadata/tw-relationship-metadata.css +10 -0
- package/css/builtin-utilities/sw-motion-contexts.css +1043 -0
- package/css/builtin-utilities/tw-backgrounds.css +606 -0
- package/css/builtin-utilities/tw-borders.css +954 -0
- package/css/builtin-utilities/tw-effects.css +1209 -0
- package/css/builtin-utilities/tw-flex-grid.css +749 -0
- package/css/builtin-utilities/tw-interactivity.css +680 -0
- package/css/builtin-utilities/tw-layout.css +943 -0
- package/css/builtin-utilities/tw-masks.css +1268 -0
- package/css/builtin-utilities/tw-motion.css +142 -0
- package/css/builtin-utilities/tw-spacing-sizing.css +621 -0
- package/css/builtin-utilities/tw-svg.css +50 -0
- package/css/builtin-utilities/tw-transforms.css +652 -0
- package/css/builtin-utilities/tw-typography.css +720 -0
- package/css/builtin-variants/sw-conditional.css +5 -0
- package/css/builtin-variants/sw-document.css +13 -0
- package/css/builtin-variants/tw-conditional.css +187 -0
- package/css/builtin-variants/tw-dynamic-selector.css +49 -0
- package/css/builtin-variants/tw-relationship.css +41 -0
- package/css/builtin-variants/tw-state.css +159 -0
- package/css/builtin-variants/tw-structural.css +121 -0
- package/css/builtins.css +111 -0
- package/css/preflight.css +401 -0
- package/css/templates.css +40 -0
- package/css/theme.css +546 -0
- package/css/utilities.css +9 -0
- package/dist/class-object-D24FFYqO.js +6 -0
- package/dist/class-object-D24FFYqO.js.map +1 -0
- package/dist/class-object-D7ZGJOf_.d.ts +9 -0
- package/dist/class-string-CQHnc9GN.d.ts +9 -0
- package/dist/class-string-Db8-oI4q.js +6 -0
- package/dist/class-string-Db8-oI4q.js.map +1 -0
- package/dist/config.d.ts +1 -0
- package/dist/config.js +2 -0
- package/dist/css.d.ts +100 -0
- package/dist/css.js +143 -0
- package/dist/css.js.map +1 -0
- package/dist/cva-BwX07CFw.js +204 -0
- package/dist/cva-BwX07CFw.js.map +1 -0
- package/dist/cva-DSpDNBYi.d.ts +9 -0
- package/dist/development-DttPQc71.d.ts +27 -0
- package/dist/development-J-JCSIm0.js +111 -0
- package/dist/development-J-JCSIm0.js.map +1 -0
- package/dist/frameworks/alpine.d.ts +20 -0
- package/dist/frameworks/alpine.js +18 -0
- package/dist/frameworks/alpine.js.map +1 -0
- package/dist/frameworks/astro.d.ts +3 -0
- package/dist/frameworks/astro.js +1 -0
- package/dist/frameworks/lit.d.ts +21 -0
- package/dist/frameworks/lit.js +38 -0
- package/dist/frameworks/lit.js.map +1 -0
- package/dist/frameworks/preact.d.ts +3 -0
- package/dist/frameworks/preact.js +1 -0
- package/dist/frameworks/qwik.d.ts +3 -0
- package/dist/frameworks/qwik.js +1 -0
- package/dist/frameworks/react.d.ts +10 -0
- package/dist/frameworks/react.js +6 -0
- package/dist/frameworks/react.js.map +1 -0
- package/dist/frameworks/solid.d.ts +3 -0
- package/dist/frameworks/solid.js +1 -0
- package/dist/frameworks/svelte.d.ts +3 -0
- package/dist/frameworks/svelte.js +1 -0
- package/dist/frameworks/vanilla.d.ts +27 -0
- package/dist/frameworks/vanilla.js +3 -0
- package/dist/frameworks/vue.d.ts +3 -0
- package/dist/frameworks/vue.js +1 -0
- package/dist/index-RwVFpxhE.d.ts +815 -0
- package/dist/macro/index.d.ts +2 -0
- package/dist/macro/index.js +1 -0
- package/dist/module-css.d.ts +30 -0
- package/dist/module-css.js +23 -0
- package/dist/module-css.js.map +1 -0
- package/dist/runtime/class-name-object-development.d.ts +10 -0
- package/dist/runtime/class-name-object-development.js +18 -0
- package/dist/runtime/class-name-object-development.js.map +1 -0
- package/dist/runtime/class-name-object.d.ts +16 -0
- package/dist/runtime/class-name-object.js +31 -0
- package/dist/runtime/class-name-object.js.map +1 -0
- package/dist/runtime/class-object-development.d.ts +10 -0
- package/dist/runtime/class-object-development.js +18 -0
- package/dist/runtime/class-object-development.js.map +1 -0
- package/dist/runtime/class-object.d.ts +16 -0
- package/dist/runtime/class-object.js +31 -0
- package/dist/runtime/class-object.js.map +1 -0
- package/dist/runtime/class-string-development.d.ts +10 -0
- package/dist/runtime/class-string-development.js +18 -0
- package/dist/runtime/class-string-development.js.map +1 -0
- package/dist/runtime/class-string.d.ts +16 -0
- package/dist/runtime/class-string.js +31 -0
- package/dist/runtime/class-string.js.map +1 -0
- package/dist/shared-B9IQXU6P.d.ts +32 -0
- package/dist/style-BV4ctkni.js +78 -0
- package/dist/style-BV4ctkni.js.map +1 -0
- package/dist/style-fTQbsVWZ.js +41 -0
- package/dist/style-fTQbsVWZ.js.map +1 -0
- package/docs/agents.md +76 -0
- package/docs/at-rules/apply.md +93 -0
- package/docs/at-rules/custom-variant.md +127 -0
- package/docs/at-rules/index.md +75 -0
- package/docs/at-rules/plugin.md +71 -0
- package/docs/at-rules/registry-directives.md +181 -0
- package/docs/at-rules/slot.md +58 -0
- package/docs/at-rules/stillwind-css-template.md +126 -0
- package/docs/at-rules/stillwind-property.md +133 -0
- package/docs/at-rules/stillwind-registry.md +115 -0
- package/docs/at-rules/stillwind-require-properties.md +91 -0
- package/docs/at-rules/stillwind-slot.md +85 -0
- package/docs/at-rules/stillwind-undef-arbitrary-property.md +75 -0
- package/docs/at-rules/stillwind-undef-utility.md +87 -0
- package/docs/at-rules/stillwind-undef-variant.md +55 -0
- package/docs/at-rules/theme.md +304 -0
- package/docs/at-rules/utility.md +286 -0
- package/docs/at-rules/variant.md +91 -0
- package/docs/concepts/css-ordering.md +245 -0
- package/docs/concepts/how-styles-compile.md +132 -0
- package/docs/configuration.md +298 -0
- package/docs/errors/SW01001.md +51 -0
- package/docs/errors/SW01002.md +52 -0
- package/docs/errors/SW01003.md +69 -0
- package/docs/errors/SW02001.md +23 -0
- package/docs/errors/SW02002.md +51 -0
- package/docs/errors/SW03001.md +71 -0
- package/docs/errors/SW03002.md +79 -0
- package/docs/errors/SW03003.md +36 -0
- package/docs/errors/SW10001.md +34 -0
- package/docs/errors/SW10002.md +36 -0
- package/docs/errors/SW10003.md +30 -0
- package/docs/errors/SW10004.md +39 -0
- package/docs/errors/SW10005.md +35 -0
- package/docs/errors/SW11001.md +37 -0
- package/docs/errors/SW11002.md +65 -0
- package/docs/errors/SW11003.md +20 -0
- package/docs/errors/SW12001.md +43 -0
- package/docs/errors/SW12002.md +42 -0
- package/docs/errors/SW13001.md +35 -0
- package/docs/errors/SW13002.md +33 -0
- package/docs/errors/SW13003.md +18 -0
- package/docs/errors/SW13004.md +45 -0
- package/docs/errors/SW14001.md +44 -0
- package/docs/errors/SW14002.md +47 -0
- package/docs/errors/SW14003.md +38 -0
- package/docs/errors/SW14004.md +48 -0
- package/docs/errors/SW14005.md +51 -0
- package/docs/errors/SW14006.md +19 -0
- package/docs/errors/SW14007.md +35 -0
- package/docs/errors/SW14008.md +41 -0
- package/docs/errors/SW15001.md +18 -0
- package/docs/errors/SW15002.md +19 -0
- package/docs/errors/SW15003.md +16 -0
- package/docs/errors/SW30001.md +21 -0
- package/docs/errors/SW30002.md +18 -0
- package/docs/errors/SW30003.md +17 -0
- package/docs/errors/SW30004.md +18 -0
- package/docs/errors/SW31001.md +20 -0
- package/docs/errors/SW31002.md +17 -0
- package/docs/errors/SW31003.md +18 -0
- package/docs/errors/SW31004.md +20 -0
- package/docs/errors/SW31005.md +18 -0
- package/docs/errors/SW31006.md +17 -0
- package/docs/errors/SW31007.md +18 -0
- package/docs/errors/SW31008.md +16 -0
- package/docs/errors/SW31009.md +18 -0
- package/docs/errors/SW31010.md +16 -0
- package/docs/errors/SW31011.md +17 -0
- package/docs/errors/SW32001.md +18 -0
- package/docs/errors/SW32002.md +45 -0
- package/docs/errors/SW32003.md +43 -0
- package/docs/errors/SW32004.md +17 -0
- package/docs/errors/SW32005.md +40 -0
- package/docs/errors/SW32006.md +18 -0
- package/docs/errors/SW32007.md +20 -0
- package/docs/errors/SW33001.md +17 -0
- package/docs/errors/SW33002.md +17 -0
- package/docs/errors/SW33003.md +17 -0
- package/docs/errors/SW33004.md +17 -0
- package/docs/errors/SW33005.md +20 -0
- package/docs/errors/SW34001.md +18 -0
- package/docs/errors/SW34002.md +17 -0
- package/docs/errors/SW34003.md +18 -0
- package/docs/errors/SW90001.md +17 -0
- package/docs/errors/SW90002.md +18 -0
- package/docs/errors/SW90003.md +17 -0
- package/docs/errors/SW90004.md +17 -0
- package/docs/errors/SW90005.md +16 -0
- package/docs/errors/SW90006.md +17 -0
- package/docs/errors/SW90007.md +17 -0
- package/docs/errors/SW90008.md +17 -0
- package/docs/errors/index.md +125 -0
- package/docs/guides/animations.md +73 -0
- package/docs/guides/design-systems.md +119 -0
- package/docs/guides/element-relationships.md +136 -0
- package/docs/guides/lint-adoption.md +128 -0
- package/docs/guides/migrating-from-css.md +126 -0
- package/docs/guides/migrating-from-tailwind.md +179 -0
- package/docs/guides/recommended-practices.md +338 -0
- package/docs/guides/responsive-styles.md +103 -0
- package/docs/guides/reusable-styles.md +110 -0
- package/docs/guides/style.md +181 -0
- package/docs/guides/tailwind-compatibility.md +126 -0
- package/docs/guides/view-transitions.md +84 -0
- package/docs/guides/web-components.md +216 -0
- package/docs/index.md +136 -0
- package/docs/integrations.md +190 -0
- package/docs/lints/ambiguous-style-base-order.md +50 -0
- package/docs/lints/bypassed-undefinition.md +50 -0
- package/docs/lints/clamped-value.md +44 -0
- package/docs/lints/conflicting-provider-properties.md +47 -0
- package/docs/lints/conflicting-utilities.md +55 -0
- package/docs/lints/document-scoped-selector.md +45 -0
- package/docs/lints/duplicate-definition.md +44 -0
- package/docs/lints/duplicate-utility.md +44 -0
- package/docs/lints/duplicate-view-transition-name.md +45 -0
- package/docs/lints/ignored-definition-condition.md +51 -0
- package/docs/lints/ignored-tailwind-feature.md +62 -0
- package/docs/lints/incompatible-property-value.md +60 -0
- package/docs/lints/incompatible-theme-value.md +46 -0
- package/docs/lints/index.md +140 -0
- package/docs/lints/ineffective-anchor-scope.md +46 -0
- package/docs/lints/interfering-imported-style-base.md +57 -0
- package/docs/lints/invalid-animation-option.md +47 -0
- package/docs/lints/invalid-css-directive.md +43 -0
- package/docs/lints/invalid-css-import.md +43 -0
- package/docs/lints/invalid-css-input.md +45 -0
- package/docs/lints/invalid-cva-config.md +46 -0
- package/docs/lints/invalid-cva-input.md +50 -0
- package/docs/lints/invalid-keyframes-definition.md +47 -0
- package/docs/lints/invalid-keyframes-use.md +47 -0
- package/docs/lints/invalid-keyframes-variant.md +48 -0
- package/docs/lints/invalid-lint-suppression.md +47 -0
- package/docs/lints/invalid-marker-use.md +53 -0
- package/docs/lints/invalid-media-query.md +52 -0
- package/docs/lints/invalid-ref-input.md +49 -0
- package/docs/lints/invalid-rule-group-input.md +58 -0
- package/docs/lints/invalid-runtime-condition.md +67 -0
- package/docs/lints/invalid-style-composition.md +52 -0
- package/docs/lints/invalid-style-input.md +47 -0
- package/docs/lints/invalid-theme-reference.md +52 -0
- package/docs/lints/invalid-utility.md +44 -0
- package/docs/lints/invalid-variant.md +45 -0
- package/docs/lints/invalid-view-transition-definition.md +46 -0
- package/docs/lints/invalid-view-transition-use.md +46 -0
- package/docs/lints/invalid-view-transition-variant.md +51 -0
- package/docs/lints/mismatched-framework-import.md +47 -0
- package/docs/lints/missing-document-target.md +44 -0
- package/docs/lints/missing-ref-attachment.md +44 -0
- package/docs/lints/missing-view-transition-name.md +46 -0
- package/docs/lints/mutating-macro-argument.md +48 -0
- package/docs/lints/no-arbitrary-breakpoints.md +50 -0
- package/docs/lints/no-arbitrary-colors.md +51 -0
- package/docs/lints/no-arbitrary-spacing.md +57 -0
- package/docs/lints/no-class-property.md +58 -0
- package/docs/lints/no-important.md +50 -0
- package/docs/lints/no-restricted-declarations.md +76 -0
- package/docs/lints/no-restricted-length-units.md +73 -0
- package/docs/lints/no-restricted-theme-tokens.md +73 -0
- package/docs/lints/no-restricted-utilities.md +73 -0
- package/docs/lints/prefer-canonical-utilities.md +69 -0
- package/docs/lints/prefer-direct-styling.md +47 -0
- package/docs/lints/prefer-explicit-nesting-selector.md +42 -0
- package/docs/lints/prefer-logical-properties.md +49 -0
- package/docs/lints/prefer-sorted-utilities.md +46 -0
- package/docs/lints/prefer-typed-relationships.md +48 -0
- package/docs/lints/prefer-typed-variables.md +43 -0
- package/docs/lints/prefer-variant-directive.md +59 -0
- package/docs/lints/redundant-variant.md +50 -0
- package/docs/lints/repeated-nesting-selector.md +59 -0
- package/docs/lints/runtime-condition-requires-css-if.md +59 -0
- package/docs/lints/split-view-transition-class.md +47 -0
- package/docs/lints/suspending-macro-argument.md +46 -0
- package/docs/lints/unknown-utility.md +47 -0
- package/docs/lints/unknown-variant.md +42 -0
- package/docs/lints/unsatisfiable-variants.md +42 -0
- package/docs/lints/unused-lint-suppression.md +57 -0
- package/docs/lints/unverified-style-base.md +64 -0
- package/docs/macros/anchor-scope.md +90 -0
- package/docs/macros/css.md +68 -0
- package/docs/macros/cva.md +153 -0
- package/docs/macros/index.md +30 -0
- package/docs/macros/keyframes.md +98 -0
- package/docs/macros/media.md +65 -0
- package/docs/macros/ref/as-anchor.md +70 -0
- package/docs/macros/ref/as-container.md +64 -0
- package/docs/macros/ref/at.md +68 -0
- package/docs/macros/ref/condition.md +86 -0
- package/docs/macros/ref/in.md +81 -0
- package/docs/macros/ref/index.md +115 -0
- package/docs/macros/ref/position-anchor.md +64 -0
- package/docs/macros/style.md +185 -0
- package/docs/macros/view-transition.md +159 -0
- package/docs/utilities.md +35 -0
- package/docs/why.md +144 -0
- package/index.css +7 -0
- package/package.json +135 -8
- package/skills/migrate-to-stillwind/SKILL.md +81 -0
- package/skills/setup-stillwind/SKILL.md +51 -0
- package/skills/stillwind/SKILL.md +54 -0
- package/index.js +0 -1
|
@@ -0,0 +1,815 @@
|
|
|
1
|
+
/** Identity markers and rule syntax for ref projections. */
|
|
2
|
+
declare const refProjection: unique symbol;
|
|
3
|
+
declare const refIdentity: unique symbol;
|
|
4
|
+
/**
|
|
5
|
+
* Input syntax returned by `ref.asAnchor()`, `ref.asContainer()`,
|
|
6
|
+
* `ref.positionAnchor()`, or `style.anchorScope()`.
|
|
7
|
+
*
|
|
8
|
+
* Use the call directly in `style()` as a rule input, including an array, conditional
|
|
9
|
+
* branch, or variant value at that position. It has no independently materialized value
|
|
10
|
+
* and cannot be stored, exported, passed, or returned for later use. It does not attach
|
|
11
|
+
* a ref marker.
|
|
12
|
+
*/
|
|
13
|
+
export type StyleRefProjection<RefId extends string = string> = {
|
|
14
|
+
/** @internal */
|
|
15
|
+
readonly [refProjection]: true;
|
|
16
|
+
/** @internal */
|
|
17
|
+
readonly [refIdentity]: {
|
|
18
|
+
readonly ref: RefId;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
declare const keyframesIdentity: unique symbol;
|
|
22
|
+
/**
|
|
23
|
+
* Animation use syntax returned by calling a keyframes declaration with options.
|
|
24
|
+
*
|
|
25
|
+
* Write the call directly as a rule input in `style()`, including an array, conditional
|
|
26
|
+
* branch, or variant value at that position. The result has no independently
|
|
27
|
+
* materialized value and cannot be stored or passed for later use.
|
|
28
|
+
*/
|
|
29
|
+
export type StyleKeyframesUse<Id extends string = string> = {
|
|
30
|
+
/** @internal */
|
|
31
|
+
readonly [refProjection]: true;
|
|
32
|
+
/** @internal */
|
|
33
|
+
readonly [keyframesIdentity]: Id;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* A reusable animation declaration created by `style.keyframes()`.
|
|
37
|
+
*
|
|
38
|
+
* Store, export, pass, return, or conditionally select the declaration value.
|
|
39
|
+
* Call it with literal animation options directly inside `style()` to apply it.
|
|
40
|
+
* `Id` carries compiler identity and should be inferred by the checker.
|
|
41
|
+
*/
|
|
42
|
+
export type StyleKeyframes<Id extends string = string> = {
|
|
43
|
+
/** @internal */
|
|
44
|
+
readonly [keyframesIdentity]: Id;
|
|
45
|
+
/**
|
|
46
|
+
* Applies this animation with literal animation options, which are utilities of the
|
|
47
|
+
* `animation` registry context.
|
|
48
|
+
*
|
|
49
|
+
* Use the call directly as a rule input in `style()`. The resulting animation use
|
|
50
|
+
* cannot be stored or passed for later use.
|
|
51
|
+
*
|
|
52
|
+
* @param options - A string literal of options such as
|
|
53
|
+
* `"duration-normal ease-standard both"`.
|
|
54
|
+
* @returns Rule input that supplies animation-name and the requested options.
|
|
55
|
+
*/
|
|
56
|
+
(options: string): StyleKeyframesUse<Id>;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Static frames in a keyframes definition or a conditional replacement body.
|
|
60
|
+
*
|
|
61
|
+
* Write the object directly in `style.keyframes()`. A stored definition object is
|
|
62
|
+
* rejected. Conditional variants must be media or supports conditions.
|
|
63
|
+
*/
|
|
64
|
+
export interface StyleKeyframesFrames {
|
|
65
|
+
/**
|
|
66
|
+
* `from`, `to`, or comma-separated unsigned integer percentage keys accept literal
|
|
67
|
+
* utility strings without utility variants. Keys ending in `:` accept complete
|
|
68
|
+
* replacement frame objects. Replacement bodies do not inherit the enclosing frames.
|
|
69
|
+
*/
|
|
70
|
+
readonly [frameOrVariant: string]: string | StyleKeyframesFrames;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* A static object accepted directly by `style.keyframes()`, with frames and optional
|
|
74
|
+
* conditional replacements. Each body must contain frames or replacement branches.
|
|
75
|
+
*
|
|
76
|
+
* Store and transport the resulting declaration rather than this definition object.
|
|
77
|
+
*/
|
|
78
|
+
export type StyleKeyframesDefinition = {
|
|
79
|
+
/**
|
|
80
|
+
* Optional string literal included in the generated animation name.
|
|
81
|
+
*/
|
|
82
|
+
readonly label?: string;
|
|
83
|
+
} & StyleKeyframesFrames;
|
|
84
|
+
declare const refVariantKind: unique symbol;
|
|
85
|
+
/**
|
|
86
|
+
* An explicit scope written as a literal keyword or a literal array of refs.
|
|
87
|
+
*
|
|
88
|
+
* For a ref that can resolve to several identities, the scope includes all of them,
|
|
89
|
+
* regardless of which one is selected at runtime. Duplicate identities and empty arrays
|
|
90
|
+
* produce lint findings.
|
|
91
|
+
*
|
|
92
|
+
* Write the keyword or array directly in `asAnchor()` or `style.anchorScope()`.
|
|
93
|
+
* A stored scope value does not satisfy the compiler's literal syntax contract.
|
|
94
|
+
*/
|
|
95
|
+
export type AnchorScope = "all" | "none" | readonly StyleRef[];
|
|
96
|
+
/**
|
|
97
|
+
* CSS-wide keywords accepted as literal `container-type` values by `asContainer`.
|
|
98
|
+
*
|
|
99
|
+
* Write the keyword directly as a string literal in the macro call.
|
|
100
|
+
* A stored string does not satisfy that syntax contract.
|
|
101
|
+
*/
|
|
102
|
+
export type CssWideKeyword = "initial" | "inherit" | "unset" | "revert" | "revert-layer" | "revert-rule";
|
|
103
|
+
/**
|
|
104
|
+
* Literal `container-type` values accepted by `asContainer`.
|
|
105
|
+
*
|
|
106
|
+
* A size mode may combine with `scroll-state` in either listed order. Write the string
|
|
107
|
+
* literal directly in the call. A stored string is rejected.
|
|
108
|
+
*/
|
|
109
|
+
export type ContainerType = CssWideKeyword | "normal" | "size" | "inline-size" | "scroll-state" | "size scroll-state" | "scroll-state size" | "inline-size scroll-state" | "scroll-state inline-size";
|
|
110
|
+
/**
|
|
111
|
+
* A DOM identity attached by passing the ref itself to `style()`.
|
|
112
|
+
*
|
|
113
|
+
* `asAnchor` and `asContainer` add CSS that applies only when the same element has this
|
|
114
|
+
* ref's marker. A ref declaration can also supply a scope to `.in()`. The declaration
|
|
115
|
+
* value may be stored, exported, passed, returned, and selected conditionally. Its
|
|
116
|
+
* projection and variant calls must appear directly inside `style()` and cannot be kept
|
|
117
|
+
* as separate values. `RefId` carries compiler identity. Application code should let
|
|
118
|
+
* the checker infer them.
|
|
119
|
+
*/
|
|
120
|
+
export type StyleRef<RefId extends string = string> = {
|
|
121
|
+
/** @internal */
|
|
122
|
+
readonly [refIdentity]: {
|
|
123
|
+
readonly ref: RefId;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Supplies this ref's anchor-name and optional anchor-scope.
|
|
127
|
+
*
|
|
128
|
+
* If `scope` is an array, this ref is included only when listed in that array.
|
|
129
|
+
* Use the call directly in a style input and attach the ref to the same element.
|
|
130
|
+
* The returned projection cannot be stored or passed for later use.
|
|
131
|
+
*
|
|
132
|
+
* @param scope - A literal `"all"`, `"none"`, or array of refs. Empty arrays and
|
|
133
|
+
* duplicate identities produce lint findings. An empty array or omitted argument
|
|
134
|
+
* emits no scope declaration.
|
|
135
|
+
* @returns Rule input that adds this ref's anchor-name when consumed by `style()`.
|
|
136
|
+
*/
|
|
137
|
+
asAnchor(scope?: AnchorScope): StyleRefProjection<RefId>;
|
|
138
|
+
/**
|
|
139
|
+
* Adds this ref's container-name and, if provided, the literal container-type.
|
|
140
|
+
*
|
|
141
|
+
* Omitting `type` emits no container-type, leaving the CSS cascade to determine it.
|
|
142
|
+
* Use the call directly in a style input and attach the ref to the same element.
|
|
143
|
+
* The returned projection cannot be stored or passed for later use.
|
|
144
|
+
*
|
|
145
|
+
* @param type - An optional string literal from {@link ContainerType}.
|
|
146
|
+
* @returns Rule input that adds this ref's container-name and optional container-type.
|
|
147
|
+
*/
|
|
148
|
+
asContainer(type?: ContainerType): StyleRefProjection<RefId>;
|
|
149
|
+
/**
|
|
150
|
+
* Refers to this ref's generated anchor-name from the styled element.
|
|
151
|
+
*
|
|
152
|
+
* Supply an anchor provider with `asAnchor()` on an element carrying this ref.
|
|
153
|
+
* Use the call directly as a rule input in `style()`. The returned projection cannot
|
|
154
|
+
* be stored or passed for later use.
|
|
155
|
+
*
|
|
156
|
+
* @returns Rule input that adds position-anchor to the styled element.
|
|
157
|
+
*/
|
|
158
|
+
positionAnchor(): StyleRefProjection<RefId>;
|
|
159
|
+
/**
|
|
160
|
+
* Tests this ref's presence within the supplied scope. This is shorthand for calling
|
|
161
|
+
* this ref without arguments and then applying `.in(scope)`.
|
|
162
|
+
*
|
|
163
|
+
* Use the complete chain directly as a computed variant key or a variant segment
|
|
164
|
+
* followed by `:` in a utility template inside `style()`.
|
|
165
|
+
*
|
|
166
|
+
* @param scope - A raw ref declaration or an unscoped ref call or static tag.
|
|
167
|
+
* The scope ref must be a strict ancestor of both this ref and the styled target.
|
|
168
|
+
* Any variants on the scope operand test that scope element.
|
|
169
|
+
* @returns Scoped selector syntax that accepts further `.in()` calls.
|
|
170
|
+
* The result cannot be stored or passed for later use.
|
|
171
|
+
*/
|
|
172
|
+
in<const ScopeId extends string>(scope: RefScope<ScopeId>): ScopedRefVariant<RefId, readonly [ScopeId]>;
|
|
173
|
+
/**
|
|
174
|
+
* Selects this ref's named container without a query condition.
|
|
175
|
+
*
|
|
176
|
+
* Supply its container-name with `asContainer()` on an element carrying this ref.
|
|
177
|
+
* Use the call directly as a computed variant key or a complete variant segment
|
|
178
|
+
* followed by `:` in a utility template inside `style()`.
|
|
179
|
+
*
|
|
180
|
+
* @returns Variant syntax that emits `@container <name>` without parentheses.
|
|
181
|
+
* The result cannot be stored or passed as an independent value.
|
|
182
|
+
*/
|
|
183
|
+
at(): ContainerVariant<RefId>;
|
|
184
|
+
/**
|
|
185
|
+
* Applies a literal CSS query to this ref's named container.
|
|
186
|
+
*
|
|
187
|
+
* Supply its container-name with `asContainer()` on an element carrying this ref.
|
|
188
|
+
* Use the call directly as a computed variant key or a complete variant segment
|
|
189
|
+
* followed by `:` in a utility template inside `style()`.
|
|
190
|
+
*
|
|
191
|
+
* @param query - A string literal containing the CSS condition without its outer
|
|
192
|
+
* parentheses. Empty text emits only the container name.
|
|
193
|
+
* @returns Variant syntax for the named container query. The result cannot be
|
|
194
|
+
* stored or passed as an independent value.
|
|
195
|
+
*/
|
|
196
|
+
at(query: string): ContainerVariant<RefId>;
|
|
197
|
+
/**
|
|
198
|
+
* Applies a static tagged query to this ref's named container.
|
|
199
|
+
*
|
|
200
|
+
* Supply its container-name with `asContainer()` on an element carrying this ref.
|
|
201
|
+
* Use the tag directly as a computed variant key or a complete variant segment
|
|
202
|
+
* followed by `:` in a utility template inside `style()`.
|
|
203
|
+
*
|
|
204
|
+
* @param strings - Text from a tag such as ``ref.at`width >= 40rem` ``.
|
|
205
|
+
* Interpolations are rejected. Empty text emits only the container name.
|
|
206
|
+
* @returns Variant syntax for the named container query. The result cannot be
|
|
207
|
+
* stored or passed as an independent value.
|
|
208
|
+
*/
|
|
209
|
+
at(strings: TemplateStringsArray): ContainerVariant<RefId>;
|
|
210
|
+
/**
|
|
211
|
+
* Tests a static variant sequence on the referenced element.
|
|
212
|
+
*
|
|
213
|
+
* Use the tag directly as a computed variant key or a complete variant segment
|
|
214
|
+
* followed by `:` in a utility template inside `style()`. Variants outside the
|
|
215
|
+
* tag apply to the styled target.
|
|
216
|
+
*
|
|
217
|
+
* @param strings - Text from a tag such as ``ref`hover:active` ``. Its final `:`
|
|
218
|
+
* is optional. Interpolations are rejected. Empty text tests ref presence.
|
|
219
|
+
* @returns Ref variant syntax. The result cannot be stored or passed as an
|
|
220
|
+
* independent value.
|
|
221
|
+
*/
|
|
222
|
+
(strings: TemplateStringsArray): RefVariant<RefId>;
|
|
223
|
+
/**
|
|
224
|
+
* Tests ref presence without a state condition. Without `.in()`, this ref must be an
|
|
225
|
+
* ancestor of the styled target. `.in()` scopes the selector explicitly.
|
|
226
|
+
*
|
|
227
|
+
* Use the call directly as a computed variant key or a complete variant segment
|
|
228
|
+
* followed by `:` in a utility template inside `style()`.
|
|
229
|
+
*
|
|
230
|
+
* @returns Ref variant syntax. The result cannot be stored or passed as an
|
|
231
|
+
* independent value.
|
|
232
|
+
*/
|
|
233
|
+
(): RefVariant<RefId>;
|
|
234
|
+
/**
|
|
235
|
+
* Tests a literal variant sequence on the referenced element.
|
|
236
|
+
*
|
|
237
|
+
* Use the call directly as a computed variant key or a complete variant segment
|
|
238
|
+
* followed by `:` in a utility template inside `style()`. Variants outside the
|
|
239
|
+
* call apply to the styled target.
|
|
240
|
+
*
|
|
241
|
+
* @param variants - A string literal such as `"hover:active"`, with an optional
|
|
242
|
+
* final `:`. Empty text tests ref presence.
|
|
243
|
+
* @returns Ref variant syntax. The result cannot be stored or passed as an
|
|
244
|
+
* independent value.
|
|
245
|
+
*/
|
|
246
|
+
(variants: string): RefVariant<RefId>;
|
|
247
|
+
};
|
|
248
|
+
/**
|
|
249
|
+
* A scope operand for `.in()`: a raw ref declaration or an unscoped ref call or static
|
|
250
|
+
* tag. Scoped selectors and container queries cannot supply a scope.
|
|
251
|
+
*
|
|
252
|
+
* Declaration values may be reused. Calls and tags must appear directly in the
|
|
253
|
+
* `.in()` chain consumed by `style()`.
|
|
254
|
+
* `RefId` preserves the possible declaration identities of the scope operand.
|
|
255
|
+
*/
|
|
256
|
+
export type RefScope<RefId extends string = string> = StyleRef<RefId> | RefVariant<RefId>;
|
|
257
|
+
type StyleVariantKey = string & {
|
|
258
|
+
readonly [refProjection]: true;
|
|
259
|
+
readonly at: never;
|
|
260
|
+
};
|
|
261
|
+
/**
|
|
262
|
+
* An unscoped ref selector returned by a ref call or static tag.
|
|
263
|
+
*
|
|
264
|
+
* Without `.in()`, the referenced element must be an ancestor of the styled target.
|
|
265
|
+
* Use the complete call, tag, or `.in()` chain directly as a computed variant key or a
|
|
266
|
+
* variant segment followed by `:` in a utility template inside `style()`.
|
|
267
|
+
* This syntax cannot be stored, exported, passed, or returned for later use.
|
|
268
|
+
* `RefId` preserves the possible identities of the referenced element.
|
|
269
|
+
*/
|
|
270
|
+
export type RefVariant<RefId extends string = string> = StyleVariantKey & {
|
|
271
|
+
/** @internal */
|
|
272
|
+
readonly [refVariantKind]: "unscoped";
|
|
273
|
+
/** @internal */
|
|
274
|
+
readonly [refIdentity]: {
|
|
275
|
+
readonly ref: RefId;
|
|
276
|
+
};
|
|
277
|
+
/**
|
|
278
|
+
* Scopes this selector to a strict ancestor of the referenced element and the styled
|
|
279
|
+
* target. Any variants on the scope operand test that scope element.
|
|
280
|
+
*
|
|
281
|
+
* Use the complete chain directly as a computed key or utility variant segment inside
|
|
282
|
+
* `style()`.
|
|
283
|
+
*
|
|
284
|
+
* @param scope - A raw ref declaration or an unscoped ref call or static tag.
|
|
285
|
+
* @returns Scoped selector syntax that accepts further `.in()` calls.
|
|
286
|
+
* The result cannot be stored or passed for later use.
|
|
287
|
+
*/
|
|
288
|
+
in<const ScopeId extends string>(scope: RefScope<ScopeId>): ScopedRefVariant<RefId, readonly [ScopeId]>;
|
|
289
|
+
};
|
|
290
|
+
/**
|
|
291
|
+
* A ref selector with one or more explicit ancestor scopes.
|
|
292
|
+
*
|
|
293
|
+
* Each further `.in()` adds an independent condition that its scope contains both the
|
|
294
|
+
* referenced element and the styled target. The method may be chained any number of
|
|
295
|
+
* times. Use the complete chain directly as a computed key or a variant segment
|
|
296
|
+
* followed by `:` in a utility template inside `style()`.
|
|
297
|
+
*
|
|
298
|
+
* This syntax cannot be stored, exported, passed, or returned for later use.
|
|
299
|
+
* `RefId` preserves the referenced identities. `ScopeIds` preserves each scope's
|
|
300
|
+
* possible identities in the order of the `.in()` calls.
|
|
301
|
+
*/
|
|
302
|
+
export type ScopedRefVariant<RefId extends string = string, ScopeIds extends readonly string[] = readonly string[]> = StyleVariantKey & {
|
|
303
|
+
/** @internal */
|
|
304
|
+
readonly [refVariantKind]: "scoped";
|
|
305
|
+
/** @internal */
|
|
306
|
+
readonly [refIdentity]: {
|
|
307
|
+
readonly ref: RefId;
|
|
308
|
+
readonly scopes: ScopeIds;
|
|
309
|
+
};
|
|
310
|
+
/**
|
|
311
|
+
* Adds a scope that must be a strict ancestor of the referenced element and the
|
|
312
|
+
* styled target. Each scope condition applies independently. Any variants on
|
|
313
|
+
* the operand test that scope element.
|
|
314
|
+
*
|
|
315
|
+
* Use the complete chain directly as a computed key or utility variant segment
|
|
316
|
+
* inside `style()`.
|
|
317
|
+
*
|
|
318
|
+
* @param scope - A raw ref declaration or an unscoped ref call or static tag.
|
|
319
|
+
* @returns Scoped selector syntax that preserves the existing scopes and accepts
|
|
320
|
+
* further `.in()` calls. The result cannot be stored or passed for later use.
|
|
321
|
+
*/
|
|
322
|
+
in<const ScopeId extends string>(scope: RefScope<ScopeId>): ScopedRefVariant<RefId, readonly [...ScopeIds, ScopeId]>;
|
|
323
|
+
};
|
|
324
|
+
/**
|
|
325
|
+
* A named container query returned by a raw ref's `.at()` call or static tag.
|
|
326
|
+
* Supply the container name with `.asContainer()` on an element carrying that ref.
|
|
327
|
+
*
|
|
328
|
+
* Use the call or tag directly as a computed key or a variant segment followed by
|
|
329
|
+
* `:` in a utility template inside `style()`. This syntax cannot be stored,
|
|
330
|
+
* exported, passed, or returned for later use. It accepts no further macro methods.
|
|
331
|
+
* `RefId` preserves the possible identities of the container provider.
|
|
332
|
+
*/
|
|
333
|
+
export type ContainerVariant<RefId extends string = string> = StyleVariantKey & {
|
|
334
|
+
/** @internal */
|
|
335
|
+
readonly [refVariantKind]: "container";
|
|
336
|
+
/** @internal */
|
|
337
|
+
readonly [refIdentity]: {
|
|
338
|
+
readonly ref: RefId;
|
|
339
|
+
};
|
|
340
|
+
};
|
|
341
|
+
/**
|
|
342
|
+
* A static variant prefix used as an object key in `style()`, including its final `:`.
|
|
343
|
+
* Nested keys compose from outermost to innermost. Raw selector keys must use
|
|
344
|
+
* arbitrary-variant syntax, such as `[&:hover]:`.
|
|
345
|
+
*/
|
|
346
|
+
export type StyleVariant = `${string}:`;
|
|
347
|
+
/**
|
|
348
|
+
* Ordinary values for the external-class entry `{ class: value }` in `style()`.
|
|
349
|
+
*
|
|
350
|
+
* Strings, numbers, and bigints become class text. Arrays are flattened, and object
|
|
351
|
+
* keys are included when their values are truthy. Booleans, null, and undefined add no
|
|
352
|
+
* class text. These values may be stored and passed to other functions.
|
|
353
|
+
*/
|
|
354
|
+
export type StillwindClassValue = string | number | bigint | boolean | null | undefined | readonly StillwindClassValue[] | Readonly<Record<string, unknown>>;
|
|
355
|
+
/**
|
|
356
|
+
* Ordinary values for inline custom properties.
|
|
357
|
+
*
|
|
358
|
+
* These may be stored and passed between functions. Strings are CSS text, numbers have
|
|
359
|
+
* no unit, and URL objects become escaped `url("...")` values. True becomes one space,
|
|
360
|
+
* and false becomes `initial`.
|
|
361
|
+
*/
|
|
362
|
+
export type StyleCustomPropertyValue = URL | string | number | boolean;
|
|
363
|
+
declare const viewTransitionIdentity: unique symbol;
|
|
364
|
+
/**
|
|
365
|
+
* Participant naming syntax returned by `transition.for()`.
|
|
366
|
+
*
|
|
367
|
+
* Write the call directly as a rule input in `style()`, including an array, conditional
|
|
368
|
+
* branch, or variant value at that position. The result has no independently
|
|
369
|
+
* materialized value and cannot be stored or passed for later use.
|
|
370
|
+
*/
|
|
371
|
+
export type StyleViewTransitionUse<Id extends string = string> = {
|
|
372
|
+
/** @internal */
|
|
373
|
+
readonly [refProjection]: true;
|
|
374
|
+
/** @internal */
|
|
375
|
+
readonly [viewTransitionIdentity]: Id;
|
|
376
|
+
};
|
|
377
|
+
/**
|
|
378
|
+
* A reusable view transition declaration created by `style.viewTransition()`.
|
|
379
|
+
*
|
|
380
|
+
* Store, export, pass, return, or conditionally select the declaration value.
|
|
381
|
+
* Passing it to `style()` adds its transition class. Calling `.for()` also names the
|
|
382
|
+
* participant. Calls to `.for()` must be consumed directly inside `style()`.
|
|
383
|
+
* `Id` carries compiler identity and should be inferred by the checker.
|
|
384
|
+
*/
|
|
385
|
+
export type StyleViewTransition<Id extends string = string> = {
|
|
386
|
+
/** @internal */
|
|
387
|
+
readonly [refProjection]: true;
|
|
388
|
+
/** @internal */
|
|
389
|
+
readonly [viewTransitionIdentity]: Id;
|
|
390
|
+
/**
|
|
391
|
+
* Names participants by combining this declaration's class token with a key.
|
|
392
|
+
*
|
|
393
|
+
* The key must obey the purity contract of `style()`. Use this call directly
|
|
394
|
+
* in a supported style input. A literal key produces a name in the stylesheet. A
|
|
395
|
+
* dynamic key writes view-transition-name to inline style unless CSS variants need a
|
|
396
|
+
* custom property to control when the name applies.
|
|
397
|
+
*
|
|
398
|
+
* The returned use cannot be stored or passed for later use. Simultaneously rendered
|
|
399
|
+
* participants need distinct, application-stable keys.
|
|
400
|
+
*
|
|
401
|
+
* @param key - A string or number that forms the pairing name with the
|
|
402
|
+
* declaration's class token. Omitting it uses the empty string.
|
|
403
|
+
* @returns Rule input that supplies view-transition-class and view-transition-name.
|
|
404
|
+
*/
|
|
405
|
+
for(key?: string | number): StyleViewTransitionUse<Id>;
|
|
406
|
+
};
|
|
407
|
+
/**
|
|
408
|
+
* A static object accepted directly by `style.viewTransition()`.
|
|
409
|
+
*
|
|
410
|
+
* Supply at least one phase as a string literal. Phase strings may use media and
|
|
411
|
+
* supports variants. Selector and container variants are rejected.
|
|
412
|
+
* Store and transport the resulting declaration rather than this definition object.
|
|
413
|
+
*/
|
|
414
|
+
export type StyleViewTransitionDefinition = {
|
|
415
|
+
/**
|
|
416
|
+
* Optional string literal included in the generated transition class token.
|
|
417
|
+
*/
|
|
418
|
+
label?: string;
|
|
419
|
+
/**
|
|
420
|
+
* Literal utilities for `::view-transition-group`.
|
|
421
|
+
*/
|
|
422
|
+
group?: string;
|
|
423
|
+
/**
|
|
424
|
+
* Literal utilities for `::view-transition-old`.
|
|
425
|
+
*/
|
|
426
|
+
old?: string;
|
|
427
|
+
/**
|
|
428
|
+
* Literal utilities for `::view-transition-new`.
|
|
429
|
+
*/
|
|
430
|
+
new?: string;
|
|
431
|
+
/**
|
|
432
|
+
* Literal utilities for `::view-transition-image-pair`.
|
|
433
|
+
*/
|
|
434
|
+
imagePair?: string;
|
|
435
|
+
};
|
|
436
|
+
/**
|
|
437
|
+
* Inputs allowed inside a variant wrapper in `style()`.
|
|
438
|
+
*
|
|
439
|
+
* Arrays and nested wrappers compose. False, null, and undefined contribute no rules.
|
|
440
|
+
* Projection and animation-use calls must be written directly in the wrapper. The type
|
|
441
|
+
* does not permit storing those calls for later use. Ref attachments, props
|
|
442
|
+
* composition, external classes, and inline custom properties require positions outside
|
|
443
|
+
* variant wrappers.
|
|
444
|
+
*/
|
|
445
|
+
export type StyleVariantValue = string | StyleRefProjection | StyleViewTransition | StyleViewTransitionUse | StyleKeyframesUse | false | null | undefined | readonly StyleVariantValue[] | StyleVariantObject;
|
|
446
|
+
/**
|
|
447
|
+
* A variant wrapper written directly in `style()`.
|
|
448
|
+
*
|
|
449
|
+
* The wrapper itself is input syntax and cannot be stored for later consumption.
|
|
450
|
+
* Each key applies its conditions to every nested rule, from outermost to innermost.
|
|
451
|
+
* The keys `""` and `":"` retain the enclosing conditions without adding variants.
|
|
452
|
+
*/
|
|
453
|
+
export interface StyleVariantObject {
|
|
454
|
+
/** Rule inputs that retain the enclosing variants. */
|
|
455
|
+
readonly ""?: StyleVariantValue;
|
|
456
|
+
/**
|
|
457
|
+
* Static variant prefixes with a final `:` wrap the associated rule inputs.
|
|
458
|
+
*/
|
|
459
|
+
readonly [variant: StyleVariant]: StyleVariantValue;
|
|
460
|
+
/**
|
|
461
|
+
* Direct ref selectors, scope chains, and container queries provide computed keys
|
|
462
|
+
* for the associated rules.
|
|
463
|
+
*/
|
|
464
|
+
readonly [variant: StyleVariantKey]: StyleVariantValue;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Custom-property entries for an object written directly in `style()` outside variant
|
|
468
|
+
* wrappers. Names start with `--`, and values may be dynamic pure expressions.
|
|
469
|
+
*
|
|
470
|
+
* Store individual values or completed style props for reuse. A stored input object
|
|
471
|
+
* does not replace the macro's direct object syntax.
|
|
472
|
+
*/
|
|
473
|
+
export type StyleCustomProperties = Readonly<Record<`--${string}`, StyleCustomPropertyValue>>;
|
|
474
|
+
type StyleObject = (StyleVariantObject | (StyleVariantObject & Partial<StyleCustomProperties>)) & {
|
|
475
|
+
readonly class?: StillwindClassValue;
|
|
476
|
+
};
|
|
477
|
+
/**
|
|
478
|
+
* Inputs accepted by `style()`, including recursive arrays and conditional branches.
|
|
479
|
+
*
|
|
480
|
+
* Completed style props and declaration values can be stored and passed for reuse.
|
|
481
|
+
* Utility strings and input objects require static syntax. Projection and animation
|
|
482
|
+
* uses require direct calls, and ref variants require computed keys or utility template
|
|
483
|
+
* substitutions. This union does not make every member a portable value.
|
|
484
|
+
*/
|
|
485
|
+
export type StyleArgument = StyleResult<string, object> | string | false | null | undefined | readonly StyleArgument[] | StyleObject | StyleRef | StyleRefProjection | StyleVariantKey | StyleKeyframesUse | StyleViewTransition | StyleViewTransitionUse;
|
|
486
|
+
declare const utilityStringCompletion: unique symbol;
|
|
487
|
+
type UtilityString = string & {
|
|
488
|
+
readonly [utilityStringCompletion]?: never;
|
|
489
|
+
};
|
|
490
|
+
type CheckedString<Input extends string> = {} extends Record<Input, never> ? Input : UtilityString;
|
|
491
|
+
type CheckedVariantInput<Input> = StyleVariantValue extends Input ? StyleVariantValue : Input extends readonly unknown[] ? { [Key in keyof Input]: CheckedVariantInput<Input[Key]>; } : Input extends string | false | null | undefined | StyleRefProjection | StyleKeyframesUse | StyleViewTransition | StyleViewTransitionUse ? Input extends string ? CheckedString<Input> : StyleVariantValue : Input extends object ? { [Key in keyof Input]: string extends Key ? StyleVariantValue : Key extends "" | StyleVariant | StyleVariantKey ? CheckedVariantInput<Input[Key]> : never; } : StyleVariantValue;
|
|
492
|
+
type StyleBaseProperties<Input> = Input extends StyleResult ? Extract<keyof Input, "style"> : never;
|
|
493
|
+
type CheckedStyleInput<Input> = StyleArgument extends Input ? StyleArgument : [StyleBaseProperties<Input>] extends [never] ? CheckedClassInput<Input> : never;
|
|
494
|
+
type CheckedClassInput<Input> = Input extends readonly unknown[] ? { [Key in keyof Input]: CheckedStyleInput<Input[Key]>; } : Input extends StyleResult ? StyleArgument : Input extends StyleRef | StyleRefProjection | StyleKeyframesUse | StyleViewTransition | StyleViewTransitionUse | string | false | null | undefined ? Input extends string ? CheckedString<Input> : StyleArgument : Input extends ((...args: never[]) => unknown) ? never : Input extends object ? { [Key in keyof Input]: string extends Key ? StyleVariantValue : Key extends "" | StyleVariant | StyleVariantKey ? CheckedVariantInput<Input[Key]> : Key extends `--${string}` ? StyleCustomPropertyValue : Key extends "class" ? StillwindClassValue : never; } : StyleArgument;
|
|
495
|
+
type CheckedStyleInputs<Inputs extends readonly unknown[]> = { [Key in keyof Inputs]: CheckedStyleInput<Inputs[Key]>; };
|
|
496
|
+
/**
|
|
497
|
+
* Materialized framework props returned by a completed `style()` call.
|
|
498
|
+
*
|
|
499
|
+
* Store, export, pass, or return this value, spread it onto an element, or pass it to
|
|
500
|
+
* another `style()` call to compose class-only results. The types reject results with
|
|
501
|
+
* inline style as composition bases; at runtime such a base contributes only its class.
|
|
502
|
+
* Directly nesting `style()` calls is rejected. Store the completed result before
|
|
503
|
+
* composing it. `Props` describes the framework's class and style props and `Id` tracks
|
|
504
|
+
* compiler identity.
|
|
505
|
+
*/
|
|
506
|
+
export type StyleResult<Id extends string = string, Props = object> = Props & {
|
|
507
|
+
/**
|
|
508
|
+
* Internal use only. The checker tracks identity through this field. Compiled props
|
|
509
|
+
* contain no such attribute.
|
|
510
|
+
*
|
|
511
|
+
* @internal
|
|
512
|
+
*/
|
|
513
|
+
readonly "data-__stillwindStyleIdentity": Id;
|
|
514
|
+
};
|
|
515
|
+
type HasInlineStyle<Input> = StyleArgument extends Input ? true : StyleVariantValue extends Input ? true : Input extends readonly unknown[] ? HasInlineStyle<Input[number]> : Input extends StyleResult ? "style" extends keyof Input ? true : false : Input extends StyleViewTransition ? false : Input extends StyleViewTransitionUse ? true : Input extends StyleRef | StyleRefProjection | StyleKeyframesUse | string ? false : Input extends object ? Extract<keyof Input, `--${string}`> extends never ? HasInlineStyle<Input[Extract<keyof Input, "" | StyleVariant | StyleVariantKey>]> : true : false;
|
|
516
|
+
type StyleOutput<Props, Inputs extends readonly unknown[]> = Pick<Props, Extract<keyof Props, "class" | "className">> & (true extends HasInlineStyle<Inputs[number]> ? Pick<Props, Extract<keyof Props, "style">> : object);
|
|
517
|
+
/**
|
|
518
|
+
* Static utility input of `style.css()`: utility strings, arrays, and variant groups.
|
|
519
|
+
*
|
|
520
|
+
* `false`, `null`, and `undefined` contribute nothing. Attributes, custom properties,
|
|
521
|
+
* external classes, refs, conditions, and other runtime values are unsupported,
|
|
522
|
+
* because the call is replaced by a string at compile time.
|
|
523
|
+
*/
|
|
524
|
+
export type StyleCssInput = string | false | null | undefined | readonly StyleCssInput[] | StyleCssGroup;
|
|
525
|
+
/**
|
|
526
|
+
* A variant group in `style.css()`. Each key ending in `:` applies its variants to the
|
|
527
|
+
* nested inputs, and the keys `""` and `":"` add none.
|
|
528
|
+
*/
|
|
529
|
+
export interface StyleCssGroup {
|
|
530
|
+
/** Inputs that retain the enclosing variants. */
|
|
531
|
+
readonly ""?: StyleCssInput;
|
|
532
|
+
/** Variant prefixes with a final `:` for the nested inputs. */
|
|
533
|
+
readonly [variant: StyleVariant]: StyleCssInput;
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* Options of `style.css()`, written as a string literal object in the last argument.
|
|
537
|
+
*/
|
|
538
|
+
export interface StyleCssOptions {
|
|
539
|
+
/**
|
|
540
|
+
* Name of the `@stillwind-css-template` that places the output. Defaults to
|
|
541
|
+
* `"default"`.
|
|
542
|
+
*/
|
|
543
|
+
readonly template?: string;
|
|
544
|
+
/**
|
|
545
|
+
* Selector of the element that a utility styles when its own variants select no
|
|
546
|
+
* element, such as `":host"`. A variant such as `[button]:` or `host:` still selects
|
|
547
|
+
* its own element. Without this option, such utilities are omitted.
|
|
548
|
+
*/
|
|
549
|
+
readonly selector?: string;
|
|
550
|
+
}
|
|
551
|
+
/** Static rule inputs accepted by variant keys and the keys `""` and `":"` in a CVA definition. */
|
|
552
|
+
export type CvaRuleInput = string | boolean | null | undefined | readonly CvaRuleInput[] | {
|
|
553
|
+
readonly ""?: CvaRuleInput;
|
|
554
|
+
readonly [variant: StyleVariant]: CvaRuleInput;
|
|
555
|
+
};
|
|
556
|
+
/**
|
|
557
|
+
* Statically written utilities, arrays, CSS variants, and custom properties.
|
|
558
|
+
* The compiler rejects `&&` and ternary expressions in utility inputs, including
|
|
559
|
+
* arrays and CSS variants. TypeScript checks value types and cannot enforce these
|
|
560
|
+
* syntax restrictions. Custom-property values may contain expressions.
|
|
561
|
+
* Custom properties remain inline, including literal values. Stored input objects,
|
|
562
|
+
* spreads, declaration uses, and composed style results are unsupported.
|
|
563
|
+
*/
|
|
564
|
+
export type CvaInput = string | boolean | null | undefined | readonly CvaInput[] | {
|
|
565
|
+
readonly ""?: CvaRuleInput;
|
|
566
|
+
readonly [variant: StyleVariant]: CvaRuleInput;
|
|
567
|
+
readonly [property: `--${string}`]: StyleCustomPropertyValue;
|
|
568
|
+
};
|
|
569
|
+
/** Finite option maps written directly in a CVA configuration. */
|
|
570
|
+
export type CvaVariants = Readonly<Record<string, Readonly<Record<string, CvaInput>>>>;
|
|
571
|
+
type Option<Key> = Key extends "true" | "false" ? boolean : Key;
|
|
572
|
+
/** Variant choices; undefined keeps the default, and null suppresses the option. */
|
|
573
|
+
export type CvaSelection<Variants extends CvaVariants> = { readonly [Key in keyof Variants]?: Option<keyof Variants[Key]> | null | undefined; };
|
|
574
|
+
/** External classes appended after selected options and compound variants. */
|
|
575
|
+
export type CvaClassProps = {
|
|
576
|
+
readonly class?: StillwindClassValue;
|
|
577
|
+
readonly className?: StillwindClassValue;
|
|
578
|
+
};
|
|
579
|
+
/** A conjunction of option conditions and the styles added when all conditions match. */
|
|
580
|
+
export type CvaCompound<Variants extends CvaVariants> = { readonly [Key in keyof Variants]?: Option<keyof Variants[Key]> | null | undefined | readonly (Option<keyof Variants[Key]> | null | undefined)[]; } & {
|
|
581
|
+
readonly class?: CvaInput;
|
|
582
|
+
readonly className?: CvaInput;
|
|
583
|
+
};
|
|
584
|
+
/** Static configuration for a CVA factory. The class prop names cannot be variant axes. */
|
|
585
|
+
export type CvaConfig<Variants extends CvaVariants> = {
|
|
586
|
+
readonly variants?: Variants & {
|
|
587
|
+
readonly class?: never;
|
|
588
|
+
readonly className?: never;
|
|
589
|
+
};
|
|
590
|
+
readonly defaultVariants?: CvaSelection<Variants>;
|
|
591
|
+
readonly compoundVariants?: readonly CvaCompound<Variants>[];
|
|
592
|
+
};
|
|
593
|
+
/** Framework props for an element; CVA results cannot be composed through style(). */
|
|
594
|
+
export type CvaResult<Props> = Pick<Props, Extract<keyof Props, "class" | "className" | "style">>;
|
|
595
|
+
/** Extracts variant choices from a CVA factory, excluding external class inputs. */
|
|
596
|
+
export type VariantProps<Factory extends (...args: never[]) => unknown> = Omit<Exclude<Parameters<Factory>[0], undefined>, "class" | "className">;
|
|
597
|
+
/**
|
|
598
|
+
* Internal use only. The compiler inserts this identity argument in source used by the
|
|
599
|
+
* TypeScript checker. Application code must not construct or pass it.
|
|
600
|
+
*
|
|
601
|
+
* @internal
|
|
602
|
+
*/
|
|
603
|
+
export type StillwindDeclarationIdentity<Id extends string> = {
|
|
604
|
+
readonly __stillwindDeclarationIdentity: Id;
|
|
605
|
+
};
|
|
606
|
+
/**
|
|
607
|
+
* Compile-time UI declarations with pure value expressions.
|
|
608
|
+
*
|
|
609
|
+
* Only completed style calls and declaration macros produce reusable values.
|
|
610
|
+
* Projections require their supported style input positions. Ref variants require
|
|
611
|
+
* computed variant keys or utility template substitutions.
|
|
612
|
+
*
|
|
613
|
+
* Each argument expression must return an equivalent value for the same inputs and must
|
|
614
|
+
* not mutate shared data or perform observable effects, including through callees,
|
|
615
|
+
* getters, or value conversion. Calls need no PURE annotation. Functions may mutate
|
|
616
|
+
* fresh local data used only to compute their result.
|
|
617
|
+
*
|
|
618
|
+
* Evaluation order and count are not API guarantees: unused expressions may be omitted
|
|
619
|
+
* and class/value conversions may be combined. Do not rely on exceptions from unused
|
|
620
|
+
* expressions. Read time/randomness and perform I/O, state updates, Hooks, await/yield,
|
|
621
|
+
* imports, JSX, and class initialization outside the macro. Pass their resulting
|
|
622
|
+
* values. Reactive reads stay in the current computation scope and must not be used
|
|
623
|
+
* only to establish a subscription.
|
|
624
|
+
*
|
|
625
|
+
* Names, utility definitions, animation options, and selector/query arguments are
|
|
626
|
+
* static declarations. Dynamic identity selectors and view-transition keys obey the
|
|
627
|
+
* same value-expression contract. Declaration-identity overloads are internal checker
|
|
628
|
+
* metadata.
|
|
629
|
+
*/
|
|
630
|
+
export type StyleMacro<Props = object> = {
|
|
631
|
+
/**
|
|
632
|
+
* Internal use only. The checker supplies the final identity argument to track the
|
|
633
|
+
* completed props value. Application code must use the overload without it.
|
|
634
|
+
*
|
|
635
|
+
* @param inputs - Style inputs followed by the declaration identity inserted by the compiler.
|
|
636
|
+
* The public overload validates authored inputs. This overload adds identity tracking for the checker.
|
|
637
|
+
* @returns The composed style props with the supplied declaration identity.
|
|
638
|
+
* @internal
|
|
639
|
+
*/
|
|
640
|
+
<Inputs extends readonly StyleArgument[], Id extends string>(...inputs: [...Inputs, StillwindDeclarationIdentity<Id>]): StyleResult<Id, StyleOutput<Props, Inputs>>;
|
|
641
|
+
/**
|
|
642
|
+
* Compiles static utility branches and combines them with inline custom
|
|
643
|
+
* properties, external classes, and completed style props.
|
|
644
|
+
*
|
|
645
|
+
* Value expressions must obey the purity contract of {@link StyleMacro}. Projection
|
|
646
|
+
* and animation-use calls must appear directly at supported input positions. Ref
|
|
647
|
+
* variants require computed keys or utility template substitutions.
|
|
648
|
+
*
|
|
649
|
+
* @param inputs - Rule and class inputs in composition order. Custom properties
|
|
650
|
+
* replace earlier values, and classes are concatenated. Utility construction must be
|
|
651
|
+
* static, and invalid utilities or unsupported syntax cause compilation errors.
|
|
652
|
+
* @returns Framework props that may be stored, exported, passed, returned, or spread
|
|
653
|
+
* onto an element. Store this result before passing it to another `style()` call.
|
|
654
|
+
* Direct nested calls are rejected. The class prop is optional. The optional style
|
|
655
|
+
* prop is present in the type when inputs include custom properties, participant
|
|
656
|
+
* naming, or composed props that may contain inline style. CSS is emitted at build
|
|
657
|
+
* time.
|
|
658
|
+
*/
|
|
659
|
+
<Inputs extends readonly StyleArgument[]>(...inputs: Inputs & CheckedStyleInputs<Inputs>): StyleResult<string, StyleOutput<Props, Inputs>>;
|
|
660
|
+
/**
|
|
661
|
+
* Declares an unlabeled DOM identity in a binding initializer.
|
|
662
|
+
* Passing the declaration to `style()` attaches its marker to that element.
|
|
663
|
+
*
|
|
664
|
+
* @returns A reusable ref declaration that may be stored, exported, passed, returned,
|
|
665
|
+
* or conditionally selected. Its identity belongs to the declaration site. Repeated
|
|
666
|
+
* evaluation does not allocate new CSS identities.
|
|
667
|
+
*/
|
|
668
|
+
ref(): StyleRef;
|
|
669
|
+
/**
|
|
670
|
+
* Declares a labeled DOM identity in a binding initializer.
|
|
671
|
+
* Passing the declaration to `style()` attaches its marker to that element.
|
|
672
|
+
*
|
|
673
|
+
* @param label - A string literal used in generated names. Empty text omits the
|
|
674
|
+
* label. Labels do not determine declaration identity.
|
|
675
|
+
* @returns A reusable ref declaration that may be stored, exported, passed, returned,
|
|
676
|
+
* or conditionally selected. Repeated evaluation keeps its identity.
|
|
677
|
+
*/
|
|
678
|
+
ref(label: string): StyleRef;
|
|
679
|
+
/**
|
|
680
|
+
* Internal use only. The checker supplies identity for an unlabeled ref declaration.
|
|
681
|
+
* Application code must use `ref()` without this argument.
|
|
682
|
+
*
|
|
683
|
+
* @internal
|
|
684
|
+
*/
|
|
685
|
+
ref<const Id extends string>(identity: StillwindDeclarationIdentity<Id>): StyleRef<Id>;
|
|
686
|
+
/**
|
|
687
|
+
* Internal use only. The checker supplies identity for a labeled ref declaration.
|
|
688
|
+
* Application code must use `ref(label)` without the identity argument.
|
|
689
|
+
*
|
|
690
|
+
* @internal
|
|
691
|
+
*/
|
|
692
|
+
ref<const Id extends string>(label: string, identity: StillwindDeclarationIdentity<Id>): StyleRef<Id>;
|
|
693
|
+
/**
|
|
694
|
+
* Declares a local animation in a binding initializer and assigns its CSS name.
|
|
695
|
+
*
|
|
696
|
+
* Apply it by calling the returned declaration with literal options directly inside
|
|
697
|
+
* `style()`. The animation use cannot be stored for later consumption.
|
|
698
|
+
*
|
|
699
|
+
* @param definition - A direct static object with frame utility strings, optional
|
|
700
|
+
* media/supports replacement bodies, and an optional literal label. Invalid frame
|
|
701
|
+
* syntax or utilities cause compilation errors.
|
|
702
|
+
* @returns A reusable keyframes declaration that may be stored, exported, passed,
|
|
703
|
+
* returned, or conditionally selected. Its identity belongs to the declaration site.
|
|
704
|
+
*/
|
|
705
|
+
keyframes(definition: StyleKeyframesDefinition): StyleKeyframes;
|
|
706
|
+
/**
|
|
707
|
+
* Internal use only. The checker supplies identity for a keyframes declaration.
|
|
708
|
+
* Application code must use `keyframes(definition)` without the identity argument.
|
|
709
|
+
*
|
|
710
|
+
* @internal
|
|
711
|
+
*/
|
|
712
|
+
keyframes<const Id extends string>(definition: StyleKeyframesDefinition, identity: StillwindDeclarationIdentity<Id>): StyleKeyframes<Id>;
|
|
713
|
+
/**
|
|
714
|
+
* Declares view transition phases in a binding initializer and assigns their class.
|
|
715
|
+
*
|
|
716
|
+
* Pass the declaration to `style()` to mark participants, or call `.for(key)`
|
|
717
|
+
* directly inside `style()` to also name them. The naming use cannot be stored.
|
|
718
|
+
*
|
|
719
|
+
* @param definition - A direct static object with at least one literal phase
|
|
720
|
+
* string and an optional literal label. Invalid phases, utilities, or condition
|
|
721
|
+
* variants cause compilation errors.
|
|
722
|
+
* @returns A reusable transition declaration that may be stored, exported, passed,
|
|
723
|
+
* returned, or conditionally selected. Its identity belongs to the declaration site.
|
|
724
|
+
*/
|
|
725
|
+
viewTransition(definition: StyleViewTransitionDefinition): StyleViewTransition;
|
|
726
|
+
/**
|
|
727
|
+
* Internal use only. The checker supplies identity for a view transition declaration.
|
|
728
|
+
* Application code must use `viewTransition(definition)` without the identity argument.
|
|
729
|
+
*
|
|
730
|
+
* @internal
|
|
731
|
+
*/
|
|
732
|
+
viewTransition<const Id extends string>(definition: StyleViewTransitionDefinition, identity: StillwindDeclarationIdentity<Id>): StyleViewTransition<Id>;
|
|
733
|
+
/**
|
|
734
|
+
* Adds anchor-scope without requiring a ref marker on the element.
|
|
735
|
+
*
|
|
736
|
+
* Use this call directly in a style input. The argument follows the same literal
|
|
737
|
+
* keyword or array rules as `ref.asAnchor`. An empty array emits no declaration.
|
|
738
|
+
* The returned projection cannot be stored, exported, passed, or returned for later
|
|
739
|
+
* consumption.
|
|
740
|
+
*
|
|
741
|
+
* @param scope - A literal `"all"`, `"none"`, or array of refs. All possible
|
|
742
|
+
* identities of each entry are included. Empty arrays and duplicate identities
|
|
743
|
+
* produce lint findings.
|
|
744
|
+
* @returns Rule input that supplies anchor-scope when consumed by `style()`.
|
|
745
|
+
*/
|
|
746
|
+
anchorScope(scope: AnchorScope): StyleRefProjection;
|
|
747
|
+
/**
|
|
748
|
+
* Returns the media query list of variants, such as for `window.matchMedia()`.
|
|
749
|
+
*
|
|
750
|
+
* The compiler replaces the call with a string, so the result can be stored, exported,
|
|
751
|
+
* and passed. The string has no `@media` or braces. Write the call outside other macro
|
|
752
|
+
* calls.
|
|
753
|
+
*
|
|
754
|
+
* @param variants - String literals of variants whose definitions contain only media
|
|
755
|
+
* conditions, with an optional final `:`. The variants of one argument must all hold,
|
|
756
|
+
* and the arguments are alternatives: `media("sm:motion-reduce", "print")` matches a
|
|
757
|
+
* wide screen with reduced motion, or print. An argument that does not resolve or that
|
|
758
|
+
* contains another kind of condition, such as `hover`, matches nothing and produces a
|
|
759
|
+
* lint finding.
|
|
760
|
+
* @returns A media query list. It is `"not all"` when no argument can match.
|
|
761
|
+
*/
|
|
762
|
+
media(...variants: [string, ...string[]]): string;
|
|
763
|
+
/**
|
|
764
|
+
* Returns a stylesheet built from utilities, such as for a shadow root.
|
|
765
|
+
*
|
|
766
|
+
* The compiler replaces the call with a string, so the result can be stored,
|
|
767
|
+
* exported, and passed, for example to `CSSStyleSheet.replaceSync()`. The call adds
|
|
768
|
+
* nothing to the document stylesheet. The string contains the rules and the theme
|
|
769
|
+
* values, keyframes, and custom-property support that they need, placed by the
|
|
770
|
+
* selected `@stillwind-css-template`. It never contains preflight.
|
|
771
|
+
*
|
|
772
|
+
* A selector-replacing variant, such as `host:`, `[:host]:`, or `[button]:`, selects
|
|
773
|
+
* the element that a utility styles. Utilities without one need the `selector`
|
|
774
|
+
* option, or are omitted with a lint finding. Write the call outside other macro
|
|
775
|
+
* calls.
|
|
776
|
+
*
|
|
777
|
+
* @param inputs - Static utility strings, arrays, and variant groups. A final
|
|
778
|
+
* object whose keys are only `template` and `selector` is the options.
|
|
779
|
+
* @returns Stylesheet text.
|
|
780
|
+
*/
|
|
781
|
+
css(...inputs: StyleCssInput[]): string;
|
|
782
|
+
/**
|
|
783
|
+
* Returns a stylesheet built from utilities, with the options in the last argument.
|
|
784
|
+
*
|
|
785
|
+
* @param inputs - Static utility inputs followed by the options object.
|
|
786
|
+
* @returns Stylesheet text.
|
|
787
|
+
*/
|
|
788
|
+
css(...inputs: [...StyleCssInput[], StyleCssOptions]): string;
|
|
789
|
+
/**
|
|
790
|
+
* Compiles a CVA definition and returns a function that selects element props.
|
|
791
|
+
* Write the configuration and utility inputs directly in the call. Utility inputs
|
|
792
|
+
* cannot contain `&&` or ternary expressions. Pass runtime conditions as variant
|
|
793
|
+
* selections. Custom properties remain inline and value expressions obey this
|
|
794
|
+
* macro's purity contract.
|
|
795
|
+
*
|
|
796
|
+
* @param base - Optional styles included in every selection.
|
|
797
|
+
* @param config - Static variants, defaults, and compound conditions.
|
|
798
|
+
* @returns A reusable factory returning fresh framework class and style props.
|
|
799
|
+
* Its results cannot be passed to style() for composition.
|
|
800
|
+
*/
|
|
801
|
+
cva<Variants extends CvaVariants = Record<never, never>>(base?: CvaInput, config?: CvaConfig<Variants>): (props?: CvaSelection<Variants> & CvaClassProps) => CvaResult<Props>;
|
|
802
|
+
};
|
|
803
|
+
/**
|
|
804
|
+
* Internal use only. Builds the placeholder exported by each framework entrypoint.
|
|
805
|
+
* The compiler replaces supported macro calls before the application runs.
|
|
806
|
+
*
|
|
807
|
+
* @returns A fresh callable object with declaration and scope methods. Calling the
|
|
808
|
+
* object or any of these methods throws an Error about missing integration. Creating
|
|
809
|
+
* the placeholder itself does not execute any macro or generate CSS.
|
|
810
|
+
*
|
|
811
|
+
* @internal
|
|
812
|
+
*/
|
|
813
|
+
export declare function createStyleMacro<Props>(): StyleMacro<Props>;
|
|
814
|
+
export {};
|
|
815
|
+
//# sourceMappingURL=index-RwVFpxhE.d.ts.map
|