@animus-ui/system 0.1.3 → 0.1.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 +31 -6
- package/dist/Animus.d.ts +1 -1
- package/dist/Animus.d.ts.map +1 -1
- package/dist/AnimusExtended.d.ts +1 -1
- package/dist/AnimusExtended.d.ts.map +1 -1
- package/dist/SystemBuilder.d.ts +180 -11
- package/dist/SystemBuilder.d.ts.map +1 -1
- package/dist/assert-root-slot-B83scqPh.js +21 -0
- package/dist/asset.d.ts +25 -0
- package/dist/asset.d.ts.map +1 -0
- package/dist/compose.d.ts +3 -1
- package/dist/compose.d.ts.map +1 -1
- package/dist/compose.js +2 -1
- package/dist/composeWithContext.d.ts +3 -1
- package/dist/composeWithContext.d.ts.map +1 -1
- package/dist/composeWithContext.js +3 -2
- package/dist/conditions.d.ts +52 -4
- package/dist/conditions.d.ts.map +1 -1
- package/dist/{createComposedFamily-DJ2aqfqN.js → createComposedFamily-DhjtkyWd.js} +81 -7
- package/dist/groups/index.js +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +887 -147
- package/dist/runtime/assert-root-slot.d.ts +17 -0
- package/dist/runtime/assert-root-slot.d.ts.map +1 -0
- package/dist/runtime/createComposedFamily.d.ts.map +1 -1
- package/dist/runtime/is-dev.d.ts +46 -0
- package/dist/runtime/is-dev.d.ts.map +1 -0
- package/dist/runtime/resolveClasses.d.ts +15 -7
- package/dist/runtime/resolveClasses.d.ts.map +1 -1
- package/dist/runtime/witness.d.ts +4 -2
- package/dist/runtime/witness.d.ts.map +1 -1
- package/dist/runtime-entry.js +1 -1
- package/dist/selectors.d.ts +5 -1
- package/dist/selectors.d.ts.map +1 -1
- package/dist/{size-CusLCguT.js → size-DHdmBc64.js} +35 -8
- package/dist/theme/createTheme.d.ts +125 -13
- package/dist/theme/createTheme.d.ts.map +1 -1
- package/dist/theme/index.d.ts +1 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/resolveReferences.d.ts +49 -0
- package/dist/theme/resolveReferences.d.ts.map +1 -0
- package/dist/transforms/createTransform.d.ts +22 -0
- package/dist/transforms/createTransform.d.ts.map +1 -1
- package/dist/types/theme.d.ts +28 -4
- package/dist/types/theme.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -15,12 +15,12 @@ Pair with a bundler plugin for extraction:
|
|
|
15
15
|
|
|
16
16
|
## Quick Start
|
|
17
17
|
|
|
18
|
-
### 1. Define
|
|
18
|
+
### 1. Define the theme
|
|
19
19
|
|
|
20
20
|
```tsx
|
|
21
21
|
import { createTheme } from '@animus-ui/system';
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const theme = createTheme()
|
|
24
24
|
.addBreakpoints({ sm: 480, md: 768, lg: 1024 })
|
|
25
25
|
.addColors({
|
|
26
26
|
gray: { 100: '#f0f0f0', 800: '#1a1a1a' },
|
|
@@ -30,11 +30,16 @@ const tokens = createTheme()
|
|
|
30
30
|
dark: { primary: 'blue.400', bg: 'gray.800', text: 'gray.100' },
|
|
31
31
|
light: { primary: 'blue.700', bg: 'gray.100', text: 'gray.800' },
|
|
32
32
|
})
|
|
33
|
-
.addScale({
|
|
33
|
+
.addScale({
|
|
34
|
+
name: 'space',
|
|
35
|
+
values: { sm: '0.5rem', md: '1rem', lg: '1.5rem' },
|
|
36
|
+
})
|
|
34
37
|
.build();
|
|
35
38
|
|
|
39
|
+
type AppTheme = typeof theme;
|
|
40
|
+
|
|
36
41
|
declare module '@animus-ui/system' {
|
|
37
|
-
interface Theme extends
|
|
42
|
+
interface Theme extends AppTheme {}
|
|
38
43
|
}
|
|
39
44
|
```
|
|
40
45
|
|
|
@@ -63,6 +68,26 @@ export const { system: ds, createGlobalStyles } = createSystem()
|
|
|
63
68
|
.build();
|
|
64
69
|
```
|
|
65
70
|
|
|
71
|
+
To build on a published design-system kit, start either chain with
|
|
72
|
+
`.extend()` — it merges the kit's registries/tokens into yours (kit as base,
|
|
73
|
+
your later calls win on conflict), and the extraction pipeline discovers the
|
|
74
|
+
kit through the same edge:
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
import { system as kitSystem, theme as kitTheme } from '@acme/kit';
|
|
78
|
+
|
|
79
|
+
const theme = createTheme().extend(kitTheme).build();
|
|
80
|
+
export const { system: ds } = createSystem()
|
|
81
|
+
.extend(kitSystem)
|
|
82
|
+
// Additive only — the kit's groups/props arrive through the merge.
|
|
83
|
+
.addProps({ cursor: { property: 'cursor' } })
|
|
84
|
+
.build();
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
(`createSystem({ includes: [...] })` and `.from()` are deprecated aliases from
|
|
88
|
+
the pre-merge era; they keep their old no-merge semantics for one more minor
|
|
89
|
+
release.)
|
|
90
|
+
|
|
66
91
|
Each group becomes an opt-in set of props that components can enable via `.system()`:
|
|
67
92
|
|
|
68
93
|
```tsx
|
|
@@ -142,7 +167,7 @@ The type system prevents calling methods out of order. `.variant()` after `.stat
|
|
|
142
167
|
per mode. An optional third argument opts the theme into OS participation:
|
|
143
168
|
|
|
144
169
|
```tsx
|
|
145
|
-
const
|
|
170
|
+
const theme = createTheme()
|
|
146
171
|
.addColors({ gray: { 100: '#f0f0f0', 800: '#1a1a1a' } })
|
|
147
172
|
.addColorModes(
|
|
148
173
|
'dark',
|
|
@@ -229,7 +254,7 @@ theme:
|
|
|
229
254
|
```ts
|
|
230
255
|
import { createAppearanceBootstrap } from '@animus-ui/system/bootstrap';
|
|
231
256
|
|
|
232
|
-
const { code, cspHash } = createAppearanceBootstrap(
|
|
257
|
+
const { code, cspHash } = createAppearanceBootstrap(theme, {
|
|
233
258
|
storageKey: 'animus:appearance', // default
|
|
234
259
|
});
|
|
235
260
|
```
|
package/dist/Animus.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare class AnimusWithAll<PropRegistry extends Record<string, Prop>, Gr
|
|
|
13
13
|
custom: CustomProps;
|
|
14
14
|
compounds: CompoundEntry[];
|
|
15
15
|
constructor(props: PropRegistry, groups: GroupRegistry, base: BaseStyles, variants: Variants, states: States, activeGroups: ActiveGroups, custom: CustomProps, compounds?: CompoundEntry[]);
|
|
16
|
-
extend(): AnimusExtended<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
16
|
+
protected extend(): AnimusExtended<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
17
17
|
asElement<El extends keyof JSX.IntrinsicElements>(component: El): AnimusComponent<El, PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
18
18
|
asComponent<C extends ComponentType<any>>(AsComponent: C): AnimusWrappedComponent<C, PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
19
19
|
asClass(): (props?: Record<string, unknown>) => string;
|
package/dist/Animus.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Animus.d.ts","sourceRoot":"","sources":["../src/Animus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EACL,cAAc,EACd,aAAa,EACb,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,IAAI,EACJ,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,aAAa,EACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAE3B,qBAAa,aAAa,CACxB,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EACzC,aAAa,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,YAAY,CAAC,EAAE,CAAC,EAC5D,UAAU,SAAS,QAAQ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QAC1C,QAAQ,EAAE,gBAAgB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;KACjD;eAJQ,OAAO;yBACG,OAAO,CAAC,MAAM,KAAK,EAAE,MAAM,CAAC;eACtC,cAAc,CAAC,IAAI,EAAE,YAAY,CAAC;kBAC/B,gBAAgB,CAAC,KAAK,EAAE,YAAY,CAAC;QAiBhD;CACF;AAED,qBAAa,MAAM,CACjB,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EACzC,aAAa,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,YAAY,CAAC,EAAE,CAAC,CAC5D,SAAQ,cAAc,CAAC,YAAY,EAAE,aAAa,EAAE,EAAE,CAAC;IACvD,YAAY,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAErD;IACD,MAAM,CAAC,KAAK,SAAS,aAAa,EAChC,MAAM,EAAE,cAAc,CAAC,KAAK,EAAE,YAAY,CAAC,oFAO5C;CACF"}
|
package/dist/AnimusExtended.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare class AnimusExtendedWithAll<PropRegistry extends Record<string, P
|
|
|
12
12
|
custom: CustomProps;
|
|
13
13
|
compounds: CompoundEntry[];
|
|
14
14
|
constructor(props: PropRegistry, groups: GroupRegistry, base: BaseStyles, variants: Variants, states: States, activeGroups: ActiveGroups, custom: CustomProps, compounds?: CompoundEntry[]);
|
|
15
|
-
extend(): AnimusExtended<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
15
|
+
protected extend(): AnimusExtended<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
16
16
|
asElement<El extends keyof JSX.IntrinsicElements>(component: El): AnimusComponent<El, PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
17
17
|
asComponent<C extends ComponentType<any>>(AsComponent: C): AnimusWrappedComponent<C, PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
18
18
|
asClass(): (props?: Record<string, unknown>) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimusExtended.d.ts","sourceRoot":"","sources":["../src/AnimusExtended.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAI3C,OAAO,EACL,cAAc,EACd,aAAa,EACb,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,IAAI,EACJ,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,aAAa,EACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAE3B,qBAAa,qBAAqB,CAChC,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EACzC,aAAa,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,YAAY,CAAC,EAAE,CAAC,EAC5D,UAAU,SAAS,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC,EACvE,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,EAC9C,MAAM,SAAS,UAAU,CAAC,aAAa,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC,EACrE,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EACzC,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC;IAExC,YAAY,EAAS,YAAY,CAAC;IAClC,aAAa,EAAS,aAAa,CAAC;IACpC,UAAU,EAAS,UAAU,CAAC;IAC9B,YAAY,EAAS,MAAM,CAAC;IAC5B,QAAQ,EAAS,QAAQ,CAAC;IAC1B,YAAY,EAAS,YAAY,CAAC;IAClC,MAAM,EAAS,WAAW,CAAC;IAC3B,SAAS,EAAE,aAAa,EAAE,CAAM;IAEhC,YACE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AAM,CAAC,MAAM,EAAE,CAAC,MAAM,YAAY,CAAC,EAAE,CAAC,EAC5D,UAAU,SAAS,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC,EACvE,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,EAC9C,MAAM,SAAS,UAAU,CAAC,aAAa,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC,EACrE,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EACzC,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CACxC,SAAQ,sBAAsB,CAC9B,YAAY,EACZ,aAAa,EACb,UAAU,EACV,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,WAAW,CACZ;IACC,MAAM,CAAC,KAAK,SAAS,aAAa,EAChC,MAAM,EAAE,cAAc,CAAC,KAAK,EAAE,YAAY,CAAC,sJAoB5C;CACF"}
|
package/dist/SystemBuilder.d.ts
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import { Animus } from './Animus';
|
|
2
|
-
import { type
|
|
2
|
+
import { type AssetRef } from './asset.js';
|
|
3
|
+
import { type AtRuleValue, type ConditionAliasMap, type NarrowedAliases, type RegistryBrand, type ReservedByConditionRegistry, type ReservedBySelectorRegistry } from './conditions';
|
|
3
4
|
import { type KeyframeFrameMap, type Keyframes } from './keyframes';
|
|
4
5
|
import { type SelectorAliasMap } from './selectors';
|
|
5
6
|
import { NamedTransform } from './transforms/createTransform';
|
|
6
|
-
import { Prop, ThemedCSSProps } from './types/config';
|
|
7
|
+
import { type BuiltInConditionAlias, type BuiltInSelectorAlias, Prop, ThemedCSSProps } from './types/config';
|
|
7
8
|
import { AbstractProps } from './types/props';
|
|
8
9
|
export type GlobalStyleMap = Record<string, Record<string, any>>;
|
|
9
10
|
/** One `src` descriptor of a font-face resource. */
|
|
10
11
|
export interface FontFaceSrc {
|
|
11
12
|
/**
|
|
12
|
-
*
|
|
13
|
-
* to the host bundler's CSS asset pipeline, not to
|
|
13
|
+
* A literal string is emitted byte-exact as authored — asset resolution
|
|
14
|
+
* and rewriting belong to the host bundler's CSS asset pipeline, not to
|
|
15
|
+
* extraction. An `AssetRef` (from `asset(specifier)`) rides through
|
|
16
|
+
* evaluation and emission as its placeholder string; the host plugin
|
|
17
|
+
* substitutes the bundler-resolved URL after extraction.
|
|
14
18
|
*/
|
|
15
|
-
url: string;
|
|
19
|
+
url: string | AssetRef;
|
|
16
20
|
/** Format hint (`woff2`, `woff`, …), rendered as `format('…')`. */
|
|
17
21
|
format?: string;
|
|
18
22
|
}
|
|
@@ -50,14 +54,153 @@ export type CreateKeyframesFactory<PropReg extends Record<string, Prop> = Record
|
|
|
50
54
|
}>;
|
|
51
55
|
type IncludableSystem = {
|
|
52
56
|
toConfig(): SerializedConfig;
|
|
57
|
+
/**
|
|
58
|
+
* Present on every system built by this version (attached non-enumerably
|
|
59
|
+
* next to `toConfig` — see `build()`). Optional in the type so systems
|
|
60
|
+
* built by an older @animus-ui/system remain structurally acceptable
|
|
61
|
+
* during the deprecation window; `extend()` fails loud at runtime when it
|
|
62
|
+
* is absent (design D7 — no `SerializedConfig` reconstruction).
|
|
63
|
+
*/
|
|
64
|
+
getRegistrySnapshot?(): RegistrySnapshot;
|
|
53
65
|
};
|
|
66
|
+
/**
|
|
67
|
+
* The frozen registry state captured at `build()` (design D7). `toConfig()`
|
|
68
|
+
* serializes from it and `extend()` merges from it, so post-build mutation of
|
|
69
|
+
* the public `propRegistry`/`groupRegistry` fields affects neither. Containers
|
|
70
|
+
* and per-entry objects are frozen shallow copies. Transforms are immutable,
|
|
71
|
+
* cached forwarding wrappers so later mutation of function metadata cannot
|
|
72
|
+
* alter serialization while anonymous transform behavior is retained.
|
|
73
|
+
*/
|
|
74
|
+
export interface RegistrySnapshot {
|
|
75
|
+
props: Record<string, Prop>;
|
|
76
|
+
groups: Record<string, readonly string[]>;
|
|
77
|
+
selectors: SelectorAliasMap;
|
|
78
|
+
conditions: ConditionAliasMap;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* A library bundle groups one export for both builders: the system half is
|
|
82
|
+
* consumed by `createSystem().extend()`, the theme half by
|
|
83
|
+
* `createTheme().extend()`; each builder takes its half and ignores the rest.
|
|
84
|
+
* `tokens` is the pre-D9 name for the theme half — both spellings are
|
|
85
|
+
* accepted (design D9; removal horizon is DEF-8).
|
|
86
|
+
*/
|
|
87
|
+
export interface LibraryBundle {
|
|
88
|
+
system: IncludableSystem;
|
|
89
|
+
theme?: unknown;
|
|
90
|
+
tokens?: unknown;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The one runtime discriminator for a library bundle: `system.toConfig`
|
|
94
|
+
* being callable. A built system instance also has a `.system()` CHAIN
|
|
95
|
+
* METHOD, so presence of a `system` key alone cannot discriminate the two
|
|
96
|
+
* shapes. Both builders' `from()` use this guard; the QuickJS capture
|
|
97
|
+
* script in the Rust system-loader mirrors it by necessity (it cannot
|
|
98
|
+
* import TS) and points back here.
|
|
99
|
+
*/
|
|
100
|
+
export declare function isLibraryBundle(value: unknown): value is LibraryBundle;
|
|
54
101
|
export interface CreateSystemConfig {
|
|
102
|
+
/**
|
|
103
|
+
* @deprecated Use `createSystem().extend(source)` — the single extension
|
|
104
|
+
* verb on both builders, which actually merges the source's registries.
|
|
105
|
+
* The alias keeps its frozen pre-existing semantics (discovery membership
|
|
106
|
+
* via the same source list, NO registry merge, no type-surface admission)
|
|
107
|
+
* for at least one minor release after `extend()` ships.
|
|
108
|
+
*/
|
|
55
109
|
includes?: readonly IncludableSystem[];
|
|
56
110
|
}
|
|
57
|
-
|
|
111
|
+
declare const STAGE_BRAND: unique symbol;
|
|
112
|
+
/**
|
|
113
|
+
* Builder type-state for the inherit-first rule: `extend()` (and the
|
|
114
|
+
* deprecated `from()`) is only callable while the builder is in the
|
|
115
|
+
* `'inherit'` stage; every extension call (`addGroup`, `addProps`,
|
|
116
|
+
* `addSelectors`, `addConditions`) advances to `'extend'`, making "inherit
|
|
117
|
+
* first, then extend" a compile error rather than a lint. Phantom — never
|
|
118
|
+
* present at runtime.
|
|
119
|
+
*/
|
|
120
|
+
export type SystemBuilderStage = 'inherit' | 'extend';
|
|
121
|
+
export declare class SystemBuilder<PropReg extends Record<string, Prop> = {}, GroupReg extends Record<string, (keyof PropReg)[]> = {}, Conds extends string = never, Sels extends string = never, Stage extends SystemBuilderStage = 'inherit'> {
|
|
58
122
|
#private;
|
|
59
|
-
|
|
60
|
-
|
|
123
|
+
readonly [STAGE_BRAND]?: Stage;
|
|
124
|
+
constructor(propRegistry?: PropReg, groupRegistry?: GroupReg, selectorRegistry?: SelectorAliasMap, includesRegistry?: readonly IncludableSystem[], conditionRegistry?: ConditionAliasMap, extendProvenance?: ReadonlyMap<string, number>, extendCount?: number);
|
|
125
|
+
/**
|
|
126
|
+
* Declare inheritance from a consumed library: the source's TYPE surface is
|
|
127
|
+
* admitted (prop/component types for compose/extend interop) and the source
|
|
128
|
+
* joins extraction discovery membership. NO registry merge — consumer
|
|
129
|
+
* configuration remains the singular authority, so props, groups,
|
|
130
|
+
* selectors, and conditions the source registered do not enter this
|
|
131
|
+
* builder's runtime registries. Chainable and repeatable, but only before
|
|
132
|
+
* extension calls ("inherit first, then extend" — enforced by the phantom
|
|
133
|
+
* builder stage). Accepts a built system instance or a library bundle
|
|
134
|
+
* (`{ system, tokens }`), taking the system half and ignoring the rest.
|
|
135
|
+
*
|
|
136
|
+
* @deprecated Use `extend(source)` — the single extension verb on both
|
|
137
|
+
* builders, whose type admission is backed by a real registry merge.
|
|
138
|
+
* `from()` keeps these frozen semantics (type admission + discovery
|
|
139
|
+
* membership, no merge) for at least one minor release.
|
|
140
|
+
*/
|
|
141
|
+
from<SrcProps extends Record<string, Prop>, SrcGroups extends Record<string, (keyof SrcProps)[]>, SrcConds extends string = never, SrcSels extends string = never>(this: SystemBuilder<PropReg, GroupReg, Conds, Sels, 'inherit'>, source: SystemInstance<SrcProps, SrcGroups, SrcConds, SrcSels> | {
|
|
142
|
+
system: SystemInstance<SrcProps, SrcGroups, SrcConds, SrcSels>;
|
|
143
|
+
theme?: unknown;
|
|
144
|
+
tokens?: unknown;
|
|
145
|
+
}): SystemBuilder<PropReg & SrcProps, GroupReg & SrcGroups, Conds | SrcConds, Sels | SrcSels, 'inherit'>;
|
|
146
|
+
/**
|
|
147
|
+
* A value annotated as the exported {@link LibraryBundle} interface has
|
|
148
|
+
* already erased its system half's generics (`system: IncludableSystem`),
|
|
149
|
+
* so there is no type surface to admit — discovery and runtime semantics
|
|
150
|
+
* are identical, and the builder's own type state passes through unchanged.
|
|
151
|
+
*
|
|
152
|
+
* @deprecated Use `extend(source)` — the single extension verb on both
|
|
153
|
+
* builders, whose type admission is backed by a real registry merge.
|
|
154
|
+
* `from()` keeps these frozen semantics (type admission + discovery
|
|
155
|
+
* membership, no merge) for at least one minor release.
|
|
156
|
+
*/
|
|
157
|
+
from(this: SystemBuilder<PropReg, GroupReg, Conds, Sels, 'inherit'>, source: LibraryBundle): SystemBuilder<PropReg, GroupReg, Conds, Sels, 'inherit'>;
|
|
158
|
+
/**
|
|
159
|
+
* Extend this system from a consumed library: the source's prop, group,
|
|
160
|
+
* selector, and condition registries MERGE into the builder (design D1), so
|
|
161
|
+
* the built system's type surface, `toConfig()` output, and extraction
|
|
162
|
+
* reachability describe the same configuration. Identical definitions
|
|
163
|
+
* coalesce; divergent definitions fail loud naming the entry and both
|
|
164
|
+
* origins (design D3), including a post-extend attempt to redefine an
|
|
165
|
+
* inherited prop. Local calls may add new entries and may replace inherited
|
|
166
|
+
* group membership, selectors, or conditions; prop definitions never rebind
|
|
167
|
+
* silently. Chainable and repeatable, but only before extension calls ("inherit first, then
|
|
168
|
+
* extend" — enforced by the phantom builder stage). Accepts a built system
|
|
169
|
+
* instance or a library bundle (`{ system, theme }`), taking the system
|
|
170
|
+
* half and ignoring the rest. The merge consumes the source's registry
|
|
171
|
+
* snapshot captured at its `build()` (design D7), never a serialized
|
|
172
|
+
* round-trip.
|
|
173
|
+
*/
|
|
174
|
+
extend<SrcProps extends Record<string, Prop>, SrcGroups extends Record<string, (keyof SrcProps)[]>, SrcConds extends string = never, SrcSels extends string = never>(this: SystemBuilder<PropReg, GroupReg, Conds, Sels, 'inherit'>, source: SystemInstance<SrcProps, SrcGroups, SrcConds, SrcSels> | {
|
|
175
|
+
system: SystemInstance<SrcProps, SrcGroups, SrcConds, SrcSels>;
|
|
176
|
+
theme?: unknown;
|
|
177
|
+
tokens?: unknown;
|
|
178
|
+
}): SystemBuilder<PropReg & SrcProps, GroupReg & SrcGroups, Conds | SrcConds, Sels | SrcSels, 'inherit'>;
|
|
179
|
+
/**
|
|
180
|
+
* A value annotated as the exported {@link LibraryBundle} interface has
|
|
181
|
+
* already erased its system half's generics (`system: IncludableSystem`),
|
|
182
|
+
* so no source types are admitted — the runtime merge is identical, and
|
|
183
|
+
* the builder's own type state passes through unchanged.
|
|
184
|
+
*/
|
|
185
|
+
extend(this: SystemBuilder<PropReg, GroupReg, Conds, Sels, 'inherit'>, source: LibraryBundle): SystemBuilder<PropReg, GroupReg, Conds, Sels, 'inherit'>;
|
|
186
|
+
/**
|
|
187
|
+
* Register custom selector aliases (`_hoverChild`, …) → `&`-relative selector
|
|
188
|
+
* strings. Overriding a built-in SELECTOR alias is legal; a name owned by the
|
|
189
|
+
* CONDITION registry (built-in or registered earlier in this chain) maps to
|
|
190
|
+
* the branded `ReservedByConditionRegistry` instead of its selector string —
|
|
191
|
+
* the compile-time complement of the cross-registry throw below. The clash is
|
|
192
|
+
* checked in VALUE position so `S` stays a naked inference site; subtracting
|
|
193
|
+
* the reserved names from the KEY position is impossible — `Exclude` is a
|
|
194
|
+
* silent no-op against a template-literal pattern. `NarrowedAliases` keeps a
|
|
195
|
+
* widened `Conds` from swallowing the whole `_` namespace.
|
|
196
|
+
*
|
|
197
|
+
* It wraps the ACCUMULATION too: a widened registration contributes nothing
|
|
198
|
+
* to `Sels` rather than widening it, so the pattern can never reach the
|
|
199
|
+
* published `RegistryBrand` — see `addConditions` for the full argument.
|
|
200
|
+
*/
|
|
201
|
+
addSelectors<S extends Record<`_${string}`, string>>(selectors: S & {
|
|
202
|
+
[K in keyof S]: K extends BuiltInConditionAlias | NarrowedAliases<Conds> ? ReservedByConditionRegistry<K & string> : S[K];
|
|
203
|
+
}): SystemBuilder<PropReg, GroupReg, Conds, Sels | NarrowedAliases<Extract<keyof S, string>>, 'extend'>;
|
|
61
204
|
/**
|
|
62
205
|
* Register condition aliases (`_motionReduce`, `_cardSm`, …) → at-rule
|
|
63
206
|
* condition strings (`@media …` / `@container …` / `@supports …`).
|
|
@@ -67,10 +210,28 @@ export declare class SystemBuilder<PropReg extends Record<string, Prop> = {}, Gr
|
|
|
67
210
|
* with an at-rule name is a compile-time type error (design D9; the runtime
|
|
68
211
|
* `inferConditionKind` throw is defense-in-depth). The registered keys are
|
|
69
212
|
* accumulated into the phantom `Conds` union and surfaced on `build()`.
|
|
213
|
+
*
|
|
214
|
+
* A key owned by the SELECTOR registry (built-in or registered earlier in
|
|
215
|
+
* this chain) maps to the branded `ReservedBySelectorRegistry` — see
|
|
216
|
+
* `addSelectors` for why the clash is checked in value position. Overriding a
|
|
217
|
+
* built-in CONDITION alias stays legal (design D3); only the OPPOSITE
|
|
218
|
+
* registry is subtracted.
|
|
219
|
+
*
|
|
220
|
+
* `NarrowedAliases` wraps the ACCUMULATION, not just the gate: a widened
|
|
221
|
+
* registration (`Record<`_${string}`, …>`) contributes nothing to `Conds`.
|
|
222
|
+
* Accumulating the pattern instead would carry it out through `build()`'s
|
|
223
|
+
* `RegistryBrand`, and a consumer publishing `ConditionsOf` into the
|
|
224
|
+
* augmentable `Conditions` interface would then have every `_` key type as
|
|
225
|
+
* registered — `UnknownConditionAlias` would never fire again, anywhere in
|
|
226
|
+
* that project. The gate keeps its own `NarrowedAliases` regardless:
|
|
227
|
+
* `extend()`-sourced unions can still arrive widened from a system built
|
|
228
|
+
* before this narrowing.
|
|
70
229
|
*/
|
|
71
|
-
addConditions<C extends Record<`_${string}`,
|
|
72
|
-
|
|
73
|
-
|
|
230
|
+
addConditions<C extends Record<`_${string}`, AtRuleValue>>(conditions: C & {
|
|
231
|
+
[K in keyof C]: K extends BuiltInSelectorAlias | NarrowedAliases<Sels> ? ReservedBySelectorRegistry<K & string> : C[K];
|
|
232
|
+
}): SystemBuilder<PropReg, GroupReg, Conds | NarrowedAliases<Extract<keyof C, string>>, Sels, 'extend'>;
|
|
233
|
+
addGroup<Name extends string, Conf extends Record<string, Prop>>(name: Name extends keyof PropReg ? never : Name, config: Conf): SystemBuilder<PropReg & Conf, GroupReg & Record<Name, (keyof Conf)[]>, Conds, Sels, 'extend'>;
|
|
234
|
+
addProps<Conf extends Record<string, Prop> & Partial<Record<Extract<keyof GroupReg, string>, never>>>(config: Conf): SystemBuilder<PropReg & Conf, GroupReg, Conds, Sels, 'extend'>;
|
|
74
235
|
build(): {
|
|
75
236
|
system: SystemInstance<PropReg, GroupReg, Conds, Sels>;
|
|
76
237
|
createGlobalStyles: GlobalStylesFactory<PropReg>;
|
|
@@ -79,6 +240,14 @@ export declare class SystemBuilder<PropReg extends Record<string, Prop> = {}, Gr
|
|
|
79
240
|
}
|
|
80
241
|
export type SystemInstance<PropReg extends Record<string, Prop>, GroupReg extends Record<string, (keyof PropReg)[]>, Conds extends string = never, Sels extends string = never> = Animus<PropReg, GroupReg> & {
|
|
81
242
|
toConfig(): SerializedConfig;
|
|
243
|
+
/**
|
|
244
|
+
* Frozen registry state captured at `build()` (design D7) — what
|
|
245
|
+
* `extend()` merges from. Always present on instances built by this
|
|
246
|
+
* version; optional in the type so systems built by an older
|
|
247
|
+
* @animus-ui/system stay structurally acceptable to `from()` during the
|
|
248
|
+
* deprecation window.
|
|
249
|
+
*/
|
|
250
|
+
getRegistrySnapshot?(): RegistrySnapshot;
|
|
82
251
|
} & RegistryBrand<Conds, Sels>;
|
|
83
252
|
export interface SerializedConfig {
|
|
84
253
|
propConfig: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SystemBuilder.d.ts","sourceRoot":"","sources":["../src/SystemBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,
|
|
1
|
+
{"version":3,"file":"SystemBuilder.d.ts","sourceRoot":"","sources":["../src/SystemBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,iBAAiB,EAEtB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAEhC,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,SAAS,EAEf,MAAM,aAAa,CAAC;AACrB,OAAO,EAGL,KAAK,gBAAgB,EAEtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAEL,cAAc,EAEf,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,IAAI,EACJ,cAAc,EACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAW9C,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;AAEjE,oDAAoD;AACpD,MAAM,WAAW,WAAW;IAC1B;;;;;;OAMG;IACH,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC;IACvB,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,WAAW,EAAE,CAAC;IACnB,MAAM,CAAC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AQ,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,CAgDhE;IAED,KAAK,IAAI;QACP,MAAM,EAAE,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QACvD,kBAAkB,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;QACjD,eAAe,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;KAClD,CAkEA;CACF;AAED,MAAM,MAAM,cAAc,CACxB,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EACpC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,OAAO,CAAC,EAAE,CAAC,EAClD,KAAK,SAAS,MAAM,GAAG,KAAK,EAC5B,IAAI,SAAS,MAAM,GAAG,KAAK,IACzB,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG;IAC9B,QAAQ,IAAI,gBAAgB,CAAC;IAC7B;;;;;;OAMG;IACH,mBAAmB,CAAC,IAAI,gBAAgB,CAAC;CAC1C,GAAG,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AAE/B,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC3C,eAAe,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AA4HD,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,kBAAkB,GAAG,aAAa,CAOvE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/runtime/assert-root-slot.ts
|
|
2
|
+
/**
|
|
3
|
+
* The Root-slot precondition shared by every composition entry point — the two
|
|
4
|
+
* source forms (`compose`, `composeWithContext`) and the two extracted forms
|
|
5
|
+
* the transform emitter writes in their place (`createComposedFamily`,
|
|
6
|
+
* `createComposedFamilyWithContext`).
|
|
7
|
+
*
|
|
8
|
+
* A family without a Root slot has no cascade source: the composed variant
|
|
9
|
+
* rules emitted for its children inherit nothing, and the context transport
|
|
10
|
+
* renders them against the empty default — the silent-drop failure mode this
|
|
11
|
+
* runtime guards against. Source form and extracted form must agree on the
|
|
12
|
+
* contract, so the check and its message live here once.
|
|
13
|
+
*
|
|
14
|
+
* React-free by design: the extracted forms import it from the same module the
|
|
15
|
+
* source forms do, with no cycle through the component runtime.
|
|
16
|
+
*/
|
|
17
|
+
function assertRootSlot(slots, fnName) {
|
|
18
|
+
if (!Object.prototype.propertyIsEnumerable.call(slots, "Root")) throw new Error(`${fnName}(): No "Root" slot found. The root slot key must be exactly "Root" (PascalCase).`);
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { assertRootSlot as t };
|
package/dist/asset.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare const ASSET_REF_BRAND: unique symbol;
|
|
2
|
+
/**
|
|
3
|
+
* A branded package-asset reference for `fontFaces[].src[].url`
|
|
4
|
+
* (global-styles-system). The VALUE is the deterministic placeholder
|
|
5
|
+
* `animus-asset:<specifier>` — a plain string, so it survives the QuickJS
|
|
6
|
+
* sandbox's JSON serialization and the extraction emitter's byte-exact url
|
|
7
|
+
* pass-through untouched. The HOST plugin substitutes the placeholder with
|
|
8
|
+
* the bundler-resolved asset URL after extraction; the sandbox never
|
|
9
|
+
* resolves anything.
|
|
10
|
+
*/
|
|
11
|
+
export type AssetRef = string & {
|
|
12
|
+
readonly [ASSET_REF_BRAND]: true;
|
|
13
|
+
};
|
|
14
|
+
/** The reserved scheme marking an unsubstituted asset reference. */
|
|
15
|
+
export declare const ASSET_PLACEHOLDER_PREFIX = "animus-asset:";
|
|
16
|
+
/**
|
|
17
|
+
* Reference a package-owned asset (e.g. a font file) by module specifier:
|
|
18
|
+
* `asset('@acme/tokens/fonts/inter.woff2')`. Resolution — aliases, exports
|
|
19
|
+
* maps, `base`, content hashing — belongs to the host bundler; this function
|
|
20
|
+
* only brands the specifier into its placeholder form. A literal URL string
|
|
21
|
+
* (`'/fonts/inter.woff2'`) remains the pass-through alternative.
|
|
22
|
+
*/
|
|
23
|
+
export declare function asset(specifier: string): AssetRef;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=asset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset.d.ts","sourceRoot":"","sources":["../src/asset.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,eAAe,EAAE,OAAO,MAAM,CAAC;AAE7C;;;;;;;;GAQG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,CAAC,eAAe,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAErE,oEAAoE;AACpE,eAAO,MAAM,wBAAwB,kBAAkB,CAAC;AAExD;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,CAEjD"}
|
package/dist/compose.d.ts
CHANGED
|
@@ -17,7 +17,9 @@ import type { AnyBrandedComponent, ComposedFamily, SharedConfig } from './types/
|
|
|
17
17
|
* For React context propagation (portal-crossing), use
|
|
18
18
|
* `composeWithContext` from `@animus-ui/system/compose-with-context`.
|
|
19
19
|
*/
|
|
20
|
-
export declare function compose<Slots extends
|
|
20
|
+
export declare function compose<Slots extends {
|
|
21
|
+
Root: AnyBrandedComponent;
|
|
22
|
+
} & Record<string, AnyBrandedComponent>, const Shared extends SharedConfig<Slots>>(slots: Slots, options: {
|
|
21
23
|
shared: Shared;
|
|
22
24
|
name?: string;
|
|
23
25
|
}): ComposedFamily<Slots>;
|
package/dist/compose.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,YAAY,EACb,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,OAAO,CACrB,KAAK,SAAS;IAAE,IAAI,EAAE,mBAAmB,CAAA;CAAE,GAAG,MAAM,CAClD,MAAM,EACN,mBAAmB,CACpB,EACD,KAAK,CAAC,MAAM,SAAS,YAAY,CAAC,KAAK,CAAC,EAExC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GACzC,cAAc,CAAC,KAAK,CAAC,CAoBvB"}
|
package/dist/compose.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as assertRootSlot } from "./assert-root-slot-B83scqPh.js";
|
|
1
2
|
import { createElement, forwardRef } from "react";
|
|
2
3
|
//#region src/compose.ts
|
|
3
4
|
/**
|
|
@@ -19,6 +20,7 @@ import { createElement, forwardRef } from "react";
|
|
|
19
20
|
* `composeWithContext` from `@animus-ui/system/compose-with-context`.
|
|
20
21
|
*/
|
|
21
22
|
function compose(slots, options) {
|
|
23
|
+
assertRootSlot(slots, "compose");
|
|
22
24
|
const familyName = options.name ?? "Composed";
|
|
23
25
|
const result = {};
|
|
24
26
|
for (const [name, SourceComponent] of Object.entries(slots)) {
|
|
@@ -29,7 +31,6 @@ function compose(slots, options) {
|
|
|
29
31
|
Wrapper.displayName = `${familyName}.${name}`;
|
|
30
32
|
result[name] = Wrapper;
|
|
31
33
|
}
|
|
32
|
-
if (!("Root" in result)) throw new Error("compose(): No \"Root\" slot found. The root slot key must be exactly \"Root\" (PascalCase).");
|
|
33
34
|
return result;
|
|
34
35
|
}
|
|
35
36
|
//#endregion
|
|
@@ -10,7 +10,9 @@ import type { AnyBrandedComponent, ComposedFamily, SharedConfig } from './types/
|
|
|
10
10
|
* For CSS-only propagation (RSC-safe), use `compose` from the barrel or
|
|
11
11
|
* `@animus-ui/system/compose`.
|
|
12
12
|
*/
|
|
13
|
-
export declare function composeWithContext<Slots extends
|
|
13
|
+
export declare function composeWithContext<Slots extends {
|
|
14
|
+
Root: AnyBrandedComponent;
|
|
15
|
+
} & Record<string, AnyBrandedComponent>, const Shared extends SharedConfig<Slots>>(slots: Slots, options: {
|
|
14
16
|
shared: Shared;
|
|
15
17
|
name?: string;
|
|
16
18
|
}): ComposedFamily<Slots>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeWithContext.d.ts","sourceRoot":"","sources":["../src/composeWithContext.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,yBAAyB,EAI/B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"composeWithContext.d.ts","sourceRoot":"","sources":["../src/composeWithContext.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,yBAAyB,EAI/B,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,YAAY,EACb,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,SAAS;IAAE,IAAI,EAAE,mBAAmB,CAAA;CAAE,GAAG,MAAM,CAClD,MAAM,EACN,mBAAmB,CACpB,EACD,KAAK,CAAC,MAAM,SAAS,YAAY,CAAC,KAAK,CAAC,EAExC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GACzC,cAAc,CAAC,KAAK,CAAC,CA8DvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,GAAG,CAAC,CAAC,EACrD,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,GAC7C,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,GAAG,CAAC,CAAC,CAuDhD"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { t as assertRootSlot } from "./assert-root-slot-B83scqPh.js";
|
|
2
3
|
import { createContext, createElement, forwardRef, useContext } from "react";
|
|
3
4
|
//#region src/composeWithContext.ts
|
|
4
5
|
/**
|
|
@@ -12,6 +13,7 @@ import { createContext, createElement, forwardRef, useContext } from "react";
|
|
|
12
13
|
* `@animus-ui/system/compose`.
|
|
13
14
|
*/
|
|
14
15
|
function composeWithContext(slots, options) {
|
|
16
|
+
assertRootSlot(slots, "composeWithContext");
|
|
15
17
|
const familyName = options.name ?? "Composed";
|
|
16
18
|
const sharedKeySet = new Set(Object.keys(options.shared));
|
|
17
19
|
const FamilyCtx = createContext({});
|
|
@@ -46,7 +48,6 @@ function composeWithContext(slots, options) {
|
|
|
46
48
|
Wrapper.displayName = `${familyName}.${name}`;
|
|
47
49
|
result[name] = Wrapper;
|
|
48
50
|
}
|
|
49
|
-
if (!("Root" in result)) throw new Error("composeWithContext(): No \"Root\" slot found. The root slot key must be exactly \"Root\" (PascalCase).");
|
|
50
51
|
return result;
|
|
51
52
|
}
|
|
52
53
|
/**
|
|
@@ -59,6 +60,7 @@ function composeWithContext(slots, options) {
|
|
|
59
60
|
* receive a 'use client' directive from the transform emitter.
|
|
60
61
|
*/
|
|
61
62
|
function createComposedFamilyWithContext(slots, config) {
|
|
63
|
+
assertRootSlot(slots, "createComposedFamilyWithContext");
|
|
62
64
|
const { name, sharedKeys } = config;
|
|
63
65
|
const Ctx = createContext({});
|
|
64
66
|
const keySet = new Set(sharedKeys);
|
|
@@ -93,7 +95,6 @@ function createComposedFamilyWithContext(slots, config) {
|
|
|
93
95
|
Wrapper.displayName = `${name}.${slotName}`;
|
|
94
96
|
result[slotName] = Wrapper;
|
|
95
97
|
}
|
|
96
|
-
if (!("Root" in result)) throw new Error("createComposedFamilyWithContext(): No \"Root\" slot found. The root slot key must be exactly \"Root\" (PascalCase).");
|
|
97
98
|
return result;
|
|
98
99
|
}
|
|
99
100
|
//#endregion
|