@animus-ui/system 0.1.0-next.49 → 0.1.0-next.59

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 CHANGED
@@ -65,38 +65,47 @@ const Box = ds.styles({}).system({ surface: true, space: true }).asElement('div'
65
65
  ### 3. Build components
66
66
 
67
67
  ```tsx
68
- const Button = ds
68
+ export const Alert = ds
69
69
  .styles({
70
- display: 'inline-flex',
71
- alignItems: 'center',
72
- cursor: 'pointer',
73
- border: 'none',
74
- borderRadius: 4,
75
- fontFamily: '{fonts.body}',
70
+ display: 'flex',
71
+ alignItems: 'flex-start',
72
+ p: 12,
73
+ borderRadius: '4px',
74
+ fontSize: 14,
75
+ lineHeight: '1.5',
76
76
  })
77
77
  .variant({
78
- size: {
79
- prop: 'size',
80
- variants: {
81
- small: { fontSize: 14, padding: '{space.sm}' },
82
- large: { fontSize: 18, padding: '{space.md} {space.lg}' },
83
- },
84
- },
85
- intent: {
86
- prop: 'intent',
87
- variants: {
88
- primary: { backgroundColor: '{colors.primary}', color: 'white' },
89
- ghost: { backgroundColor: 'transparent', color: '{colors.primary}' },
90
- },
78
+ prop: 'variant',
79
+ variants: {
80
+ filled: { color: 'background' },
81
+ outline: { bg: 'transparent', borderWidth: '1px', borderStyle: 'solid' },
91
82
  },
92
83
  })
93
- .states({
94
- disabled: { opacity: 0.5, pointerEvents: 'none' },
84
+ .variant({
85
+ prop: 'intent',
86
+ variants: {
87
+ info: { bg: 'primary' },
88
+ danger: { bg: 'danger' },
89
+ success: { bg: 'secondary' },
90
+ },
95
91
  })
96
- .system({ space: true })
97
- .asElement('button');
98
-
99
- <Button size="large" intent="primary" m={8} disabled />;
92
+ .compound(
93
+ { variant: 'outline', intent: 'info' },
94
+ { borderColor: 'primary', color: 'primary' }
95
+ )
96
+ .compound(
97
+ { variant: 'outline', intent: 'danger' },
98
+ { borderColor: 'danger', color: 'danger' }
99
+ )
100
+ .compound(
101
+ { variant: 'outline', intent: 'success' },
102
+ { borderColor: 'secondary', color: 'secondary' }
103
+ )
104
+ .surface({ space: true })
105
+ .asElement('div');
106
+
107
+
108
+ <Alert variant="filled" intent="success" m={8} disabled />;
100
109
  ```
101
110
 
102
111
  ## Builder Chain
package/dist/compose.d.ts CHANGED
@@ -10,16 +10,15 @@ import type { AnyBrandedComponent, ComposedFamily, SharedConfig } from './types/
10
10
  * - **Wire**: The extraction pipeline emits composed variant CSS
11
11
  * rules — two per shared variant option per child (inheritance +
12
12
  * override) within @layer variants.
13
- * - **Context**: When `context: true`, shared variant prop values
14
- * are also propagated via React context for portal-mounted children
15
- * that CSS descendant selectors cannot reach.
16
13
  * - **Seal**: Output components are plain ForwardRefExoticComponent —
17
14
  * no `.extend()`, no builder methods. One-way door from builder-land
18
15
  * to component-land.
16
+ *
17
+ * For React context propagation (portal-crossing), use
18
+ * `composeWithContext` from `@animus-ui/system/compose-with-context`.
19
19
  */
20
20
  export declare function compose<Slots extends Record<string, AnyBrandedComponent>, const Shared extends SharedConfig<Slots>>(slots: Slots, options: {
21
21
  shared: Shared;
22
22
  name?: string;
23
- context?: boolean;
24
23
  }): ComposedFamily<Slots>;
25
24
  //# sourceMappingURL=compose.d.ts.map
@@ -1 +1 @@
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,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,EACjD,KAAK,CAAC,MAAM,SAAS,YAAY,CAAC,KAAK,CAAC,EAExC,KAAK,EAAE,KAAK,EAKZ,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAC5D,cAAc,CAAC,KAAK,CAAC,CA0DvB"}
1
+ {"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,YAAY,EACb,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,OAAO,CACrB,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,EACjD,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,CAyBvB"}
@@ -0,0 +1,36 @@
1
+ import { createElement, forwardRef } from "react";
2
+ //#region src/compose.ts
3
+ /**
4
+ * Compose independently-authored Animus components into a sealed,
5
+ * namespaced component family with shared variant propagation via
6
+ * CSS cascade.
7
+ *
8
+ * - **Enforce**: TypeScript ensures shared keys exist on Root (the
9
+ * cascade source). Non-Root slots that have the key consume it from
10
+ * CSS inheritance; slots without the key are unaffected.
11
+ * - **Wire**: The extraction pipeline emits composed variant CSS
12
+ * rules — two per shared variant option per child (inheritance +
13
+ * override) within @layer variants.
14
+ * - **Seal**: Output components are plain ForwardRefExoticComponent —
15
+ * no `.extend()`, no builder methods. One-way door from builder-land
16
+ * to component-land.
17
+ *
18
+ * For React context propagation (portal-crossing), use
19
+ * `composeWithContext` from `@animus-ui/system/compose-with-context`.
20
+ */
21
+ function compose(slots, options) {
22
+ const familyName = options.name ?? "Composed";
23
+ const result = {};
24
+ for (const [name, SourceComponent] of Object.entries(slots)) {
25
+ const Wrapper = forwardRef((props, ref) => createElement(SourceComponent, {
26
+ ...props,
27
+ ref
28
+ }, props.children));
29
+ Wrapper.displayName = `${familyName}.${name}`;
30
+ result[name] = Wrapper;
31
+ }
32
+ if (!("Root" in result)) throw new Error("compose(): No \"Root\" slot found. The root slot key must be exactly \"Root\" (PascalCase).");
33
+ return result;
34
+ }
35
+ //#endregion
36
+ export { compose };
@@ -0,0 +1,30 @@
1
+ import { type ForwardRefExoticComponent } from 'react';
2
+ import type { AnyBrandedComponent, ComposedFamily, SharedConfig } from './types/component';
3
+ /**
4
+ * Compose components into a sealed family with shared variant propagation
5
+ * via React context. Use this when children may be rendered in portals
6
+ * or other React subtrees that escape the DOM hierarchy (where CSS
7
+ * descendant selectors cannot reach).
8
+ *
9
+ * This function uses `createContext` and `useContext` — it is client-only.
10
+ * For CSS-only propagation (RSC-safe), use `compose` from the barrel or
11
+ * `@animus-ui/system/compose`.
12
+ */
13
+ export declare function composeWithContext<Slots extends Record<string, AnyBrandedComponent>, const Shared extends SharedConfig<Slots>>(slots: Slots, options: {
14
+ shared: Shared;
15
+ name?: string;
16
+ }): ComposedFamily<Slots>;
17
+ /**
18
+ * createComposedFamilyWithContext — extraction-time replacement for composeWithContext().
19
+ *
20
+ * The transform emitter replaces `composeWithContext({ Root, Body }, { shared, name })`
21
+ * with `createComposedFamilyWithContext({ Root, Body }, { name, sharedKeys })`.
22
+ *
23
+ * Client-only: uses createContext and useContext. Files containing this function
24
+ * receive a 'use client' directive from the transform emitter.
25
+ */
26
+ export declare function createComposedFamilyWithContext(slots: Record<string, ForwardRefExoticComponent<any>>, config: {
27
+ name: string;
28
+ sharedKeys: string[];
29
+ }): Record<string, ForwardRefExoticComponent<any>>;
30
+ //# sourceMappingURL=composeWithContext.d.ts.map
@@ -0,0 +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;AAEf,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,YAAY,EACb,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,EACjD,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,CA8CvB;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,CAqChD"}
@@ -0,0 +1,79 @@
1
+ "use client";
2
+ import { createContext, createElement, forwardRef, useContext } from "react";
3
+ //#region src/composeWithContext.ts
4
+ /**
5
+ * Compose components into a sealed family with shared variant propagation
6
+ * via React context. Use this when children may be rendered in portals
7
+ * or other React subtrees that escape the DOM hierarchy (where CSS
8
+ * descendant selectors cannot reach).
9
+ *
10
+ * This function uses `createContext` and `useContext` — it is client-only.
11
+ * For CSS-only propagation (RSC-safe), use `compose` from the barrel or
12
+ * `@animus-ui/system/compose`.
13
+ */
14
+ function composeWithContext(slots, options) {
15
+ const familyName = options.name ?? "Composed";
16
+ const sharedKeySet = new Set(Object.keys(options.shared));
17
+ const FamilyCtx = createContext({});
18
+ const result = {};
19
+ for (const [name, SourceComponent] of Object.entries(slots)) {
20
+ let Wrapper;
21
+ if (name === "Root") Wrapper = forwardRef((props, ref) => {
22
+ const shared = {};
23
+ for (const key of sharedKeySet) if (key in props) shared[key] = props[key];
24
+ return createElement(SourceComponent, {
25
+ ...props,
26
+ ref
27
+ }, createElement(FamilyCtx.Provider, { value: shared }, props.children));
28
+ });
29
+ else Wrapper = forwardRef((props, ref) => {
30
+ return createElement(SourceComponent, {
31
+ ...useContext(FamilyCtx),
32
+ ...props,
33
+ ref
34
+ });
35
+ });
36
+ Wrapper.displayName = `${familyName}.${name}`;
37
+ result[name] = Wrapper;
38
+ }
39
+ if (!("Root" in result)) throw new Error("composeWithContext(): No \"Root\" slot found. The root slot key must be exactly \"Root\" (PascalCase).");
40
+ return result;
41
+ }
42
+ /**
43
+ * createComposedFamilyWithContext — extraction-time replacement for composeWithContext().
44
+ *
45
+ * The transform emitter replaces `composeWithContext({ Root, Body }, { shared, name })`
46
+ * with `createComposedFamilyWithContext({ Root, Body }, { name, sharedKeys })`.
47
+ *
48
+ * Client-only: uses createContext and useContext. Files containing this function
49
+ * receive a 'use client' directive from the transform emitter.
50
+ */
51
+ function createComposedFamilyWithContext(slots, config) {
52
+ const { name, sharedKeys } = config;
53
+ const Ctx = createContext({});
54
+ const keySet = new Set(sharedKeys);
55
+ const result = {};
56
+ for (const [slotName, SourceComponent] of Object.entries(slots)) {
57
+ let Wrapper;
58
+ if (slotName === "Root") Wrapper = forwardRef((props, ref) => {
59
+ const shared = {};
60
+ for (const key of keySet) if (key in props) shared[key] = props[key];
61
+ return createElement(SourceComponent, {
62
+ ...props,
63
+ ref
64
+ }, createElement(Ctx.Provider, { value: shared }, props.children));
65
+ });
66
+ else Wrapper = forwardRef((props, ref) => {
67
+ return createElement(SourceComponent, {
68
+ ...useContext(Ctx),
69
+ ...props,
70
+ ref
71
+ });
72
+ });
73
+ Wrapper.displayName = `${name}.${slotName}`;
74
+ result[slotName] = Wrapper;
75
+ }
76
+ return result;
77
+ }
78
+ //#endregion
79
+ export { composeWithContext, createComposedFamilyWithContext };
@@ -212,4 +212,28 @@ function createClassResolver(className, config, systemPropMap, dynamicPropConfig
212
212
  };
213
213
  }
214
214
  //#endregion
215
- export { createComponent as n, createClassResolver as t };
215
+ //#region src/runtime/createComposedFamily.ts
216
+ /**
217
+ * createComposedFamily — extraction-time replacement for compose().
218
+ *
219
+ * The transform emitter replaces `compose({ Root, Body }, { shared, name })`
220
+ * with `createComposedFamily({ Root, Body }, { name })`.
221
+ *
222
+ * RSC-safe: uses only forwardRef and createElement — no createContext,
223
+ * no useContext, no hooks.
224
+ */
225
+ function createComposedFamily(slots, config) {
226
+ const { name } = config;
227
+ const result = {};
228
+ for (const [slotName, SourceComponent] of Object.entries(slots)) {
229
+ const Wrapper = forwardRef((props, ref) => createElement(SourceComponent, {
230
+ ...props,
231
+ ref
232
+ }, props.children));
233
+ Wrapper.displayName = `${name}.${slotName}`;
234
+ result[slotName] = Wrapper;
235
+ }
236
+ return result;
237
+ }
238
+ //#endregion
239
+ export { createClassResolver as n, createComponent as r, createComposedFamily as t };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/groups/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyBR,CAAC;AAEX,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2IT,CAAC;AA8BX,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQP,CAAC;AAWX,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCP,CAAC;AAEX,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUb,CAAC;AAEX,eAAO,MAAM,WAAW;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCP,CAAC;AAEX,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUb,CAAC;AAEX,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAed,CAAC;AAEX,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;CAIV,CAAC;AAEX,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+CT,CAAC;AAEX,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Bb,CAAC;AAwCX,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGR,CAAC;AAEX,eAAO,MAAM,WAAW;;;;;;;;;;;CAWd,CAAC;AAEX,eAAO,MAAM,IAAI;;;;;CAEP,CAAC;AAEX,eAAO,MAAM,IAAI;;;;CAEP,CAAC"}
@@ -1,4 +1,4 @@
1
- import { a as borderShorthand, i as gridItemRatio, n as size, r as gridItem, s as createScale } from "../size-BjymBo7z.js";
1
+ import { a as borderShorthand, i as gridItemRatio, n as size, r as gridItem, s as createScale } from "../size-DzHm9Iw0.js";
2
2
  //#region src/groups/index.ts
3
3
  const color = {
4
4
  color: {
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export { AnimusExtended, AnimusExtendedWithAll } from './AnimusExtended';
3
3
  export { compose } from './compose';
4
4
  export { createComponent } from './runtime';
5
5
  export { createClassResolver } from './runtime/createClassResolver';
6
+ export { createComposedFamily } from './runtime/createComposedFamily';
6
7
  export type { GlobalStyleBlock, GlobalStyleMap, GlobalStylesFactory, SerializedConfig, SystemInstance, } from './SystemBuilder';
7
8
  export { createSystem, SystemBuilder } from './SystemBuilder';
8
9
  export { createScale, numericOrStringScale, numericScale, stringScale, } from './scales/createScale';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,YAAY,EACZ,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,kBAAkB,EAClB,KAAK,aAAa,EAClB,KAAK,gBAAgB,GACtB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,MAAM,EACN,uBAAuB,EACvB,eAAe,EACf,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,UAAU,EACV,IAAI,EACJ,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,WAAW,GACZ,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EACL,eAAe,EACf,KAAK,cAAc,EACnB,KAAK,WAAW,GACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,aA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CAAC;AACxB,YAAY,EACV,aAAa,EACb,aAAa,EACb,cAAc,EACd,UAAU,GACX,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC3D,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,YAAY,EACV,aAAa,EACb,SAAS,EACT,aAAa,EACb,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,KAAK,EACL,aAAa,EACb,WAAW,GACZ,MAAM,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { n as createComponent, t as createClassResolver } from "./createClassResolver-BnSwnxrG.js";
2
- import { a as borderShorthand, c as numericOrStringScale, i as gridItemRatio, l as numericScale, n as size, o as createTransform, r as gridItem, s as createScale, t as percentageOrAbsolute, u as stringScale } from "./size-BjymBo7z.js";
3
- import { createContext, createElement, forwardRef, useContext } from "react";
1
+ import { n as createClassResolver, r as createComponent, t as createComposedFamily } from "./createComposedFamily-DaXNK-0M.js";
2
+ import { compose } from "./compose.js";
3
+ import { a as borderShorthand, c as numericOrStringScale, i as gridItemRatio, l as numericScale, n as size, o as createTransform, r as gridItem, s as createScale, t as percentageOrAbsolute, u as stringScale } from "./size-DzHm9Iw0.js";
4
4
  //#region src/utils/deepMerge.ts
5
5
  /**
6
6
  * Deep merge utility — replaces lodash.merge for variant accumulation.
@@ -228,59 +228,6 @@ var Animus = class extends AnimusWithBase {
228
228
  }
229
229
  };
230
230
  //#endregion
231
- //#region src/compose.ts
232
- /**
233
- * Compose independently-authored Animus components into a sealed,
234
- * namespaced component family with shared variant propagation via
235
- * CSS cascade.
236
- *
237
- * - **Enforce**: TypeScript ensures shared keys exist on Root (the
238
- * cascade source). Non-Root slots that have the key consume it from
239
- * CSS inheritance; slots without the key are unaffected.
240
- * - **Wire**: The extraction pipeline emits composed variant CSS
241
- * rules — two per shared variant option per child (inheritance +
242
- * override) within @layer variants.
243
- * - **Context**: When `context: true`, shared variant prop values
244
- * are also propagated via React context for portal-mounted children
245
- * that CSS descendant selectors cannot reach.
246
- * - **Seal**: Output components are plain ForwardRefExoticComponent —
247
- * no `.extend()`, no builder methods. One-way door from builder-land
248
- * to component-land.
249
- */
250
- function compose(slots, options) {
251
- const familyName = options.name ?? "Composed";
252
- const useCtx = options.context ?? false;
253
- const FamilyCtx = useCtx ? createContext({}) : null;
254
- const sharedKeySet = useCtx ? new Set(Object.keys(options.shared)) : null;
255
- const result = {};
256
- for (const [name, SourceComponent] of Object.entries(slots)) {
257
- let Wrapper;
258
- if (name === "Root" && FamilyCtx && sharedKeySet) Wrapper = forwardRef((props, ref) => {
259
- const shared = {};
260
- for (const key of sharedKeySet) if (key in props) shared[key] = props[key];
261
- return createElement(SourceComponent, {
262
- ...props,
263
- ref
264
- }, createElement(FamilyCtx.Provider, { value: shared }, props.children));
265
- });
266
- else if (FamilyCtx) Wrapper = forwardRef((props, ref) => {
267
- return createElement(SourceComponent, {
268
- ...useContext(FamilyCtx),
269
- ...props,
270
- ref
271
- });
272
- });
273
- else Wrapper = forwardRef((props, ref) => createElement(SourceComponent, {
274
- ...props,
275
- ref
276
- }));
277
- Wrapper.displayName = `${familyName}.${name}`;
278
- result[name] = Wrapper;
279
- }
280
- if (!("Root" in result)) throw new Error("compose(): No \"Root\" slot found. The root slot key must be exactly \"Root\" (PascalCase).");
281
- return result;
282
- }
283
- //#endregion
284
231
  //#region src/selectors.ts
285
232
  /**
286
233
  * Built-in selector aliases.
@@ -909,4 +856,4 @@ function buildVariableCss(rootVariables, breakpointVariables, modeVariables) {
909
856
  return parts.join("\n\n");
910
857
  }
911
858
  //#endregion
912
- export { Animus, AnimusExtended, AnimusExtendedWithAll, AnimusWithAll, BUILT_IN_SELECTORS, SystemBuilder, ThemeBuilder, borderShorthand, compose, createClassResolver, createComponent, createScale, createSystem, createTheme, createTransform, gridItem, gridItemRatio, numericOrStringScale, numericScale, percentageOrAbsolute, size, stringScale };
859
+ export { Animus, AnimusExtended, AnimusExtendedWithAll, AnimusWithAll, BUILT_IN_SELECTORS, SystemBuilder, ThemeBuilder, borderShorthand, compose, createClassResolver, createComponent, createComposedFamily, createScale, createSystem, createTheme, createTransform, gridItem, gridItemRatio, numericOrStringScale, numericScale, percentageOrAbsolute, size, stringScale };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * createComposedFamily — extraction-time replacement for compose().
3
+ *
4
+ * The transform emitter replaces `compose({ Root, Body }, { shared, name })`
5
+ * with `createComposedFamily({ Root, Body }, { name })`.
6
+ *
7
+ * RSC-safe: uses only forwardRef and createElement — no createContext,
8
+ * no useContext, no hooks.
9
+ */
10
+ import { type ForwardRefExoticComponent } from 'react';
11
+ interface ComposedFamilyConfig {
12
+ name: string;
13
+ }
14
+ export declare function createComposedFamily(slots: Record<string, ForwardRefExoticComponent<any>>, config: ComposedFamilyConfig): Record<string, ForwardRefExoticComponent<any>>;
15
+ export {};
16
+ //# sourceMappingURL=createComposedFamily.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createComposedFamily.d.ts","sourceRoot":"","sources":["../../src/runtime/createComposedFamily.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAEL,KAAK,yBAAyB,EAG/B,MAAM,OAAO,CAAC;AAEf,UAAU,oBAAoB;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,GAAG,CAAC,CAAC,EACrD,MAAM,EAAE,oBAAoB,GAC3B,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,GAAG,CAAC,CAAC,CAiBhD"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAyC,UAAU,EAAkB,MAAM,OAAO,CAAC;AAE1F,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EAEtB,KAAK,aAAa,EACnB,MAAM,kBAAkB,CAAC;AAE1B,UAAU,eAAgB,SAAQ,mBAAmB;CAAG;AAIxD,KAAK,WAAW,GAAG,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;AAErD,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,GAAG;IACrD,MAAM,EAAE,MAAM,KAAK,CAAC;CACrB,CAAC;AAgBF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,eAAe,EACvB,aAAa,CAAC,EAAE,aAAa,EAC7B,iBAAiB,CAAC,EAAE,iBAAiB,GACpC,eAAe,CAiIjB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,UAAU,EAEX,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EAEtB,KAAK,aAAa,EACnB,MAAM,kBAAkB,CAAC;AAE1B,UAAU,eAAgB,SAAQ,mBAAmB;CAAG;AAIxD,KAAK,WAAW,GAAG,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;AAErD,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,GAAG;IACrD,MAAM,EAAE,MAAM,KAAK,CAAC;CACrB,CAAC;AAgBF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,eAAe,EACvB,aAAa,CAAC,EAAE,aAAa,EAC7B,iBAAiB,CAAC,EAAE,iBAAiB,GACpC,eAAe,CAmIjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"resolveClasses.d.ts","sourceRoot":"","sources":["../../src/runt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B;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1B,MAAM,EAAE,mBAAmB,EAC3B,aAAa,CAAC,EAAE,aAAa,EAC7B,iBAAiB,CAAC,EAAE,iBAAiB,GACpC,eAAe,CAyGjB"}
@@ -6,4 +6,5 @@
6
6
  */
7
7
  export { createComponent } from './runtime';
8
8
  export { createClassResolver } from './runtime/createClassResolver';
9
+ export { createComposedFamily } from './runtime/createComposedFamily';
9
10
  //# sourceMappingURL=runtime-entry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-entry.d.ts","sourceRoot":"","sources":["../src/runtime-entry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC"}
1
+ {"version":3,"file":"runtime-entry.d.ts","sourceRoot":"","sources":["../src/runtime-entry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC"}
@@ -1,2 +1,2 @@
1
- import { n as createComponent, t as createClassResolver } from "./createClassResolver-BnSwnxrG.js";
2
- export { createClassResolver, createComponent };
1
+ import { n as createClassResolver, r as createComponent, t as createComposedFamily } from "./createComposedFamily-DaXNK-0M.js";
2
+ export { createClassResolver, createComponent, createComposedFamily };
@@ -0,0 +1,93 @@
1
+ //#region src/scales/createScale.ts
2
+ const createScale = () => [];
3
+ const numericScale = [];
4
+ const stringScale = [];
5
+ const numericOrStringScale = [];
6
+ //#endregion
7
+ //#region src/transforms/createTransform.ts
8
+ function createTransform(name, fn) {
9
+ const wrapper = (value, property, props) => fn(value, property, props);
10
+ Object.defineProperty(wrapper, "name", { value: name });
11
+ return Object.assign(wrapper, { transformName: name });
12
+ }
13
+ //#endregion
14
+ //#region src/transforms/border.ts
15
+ /**
16
+ * Self-contained transform: all logic inlined in the callback.
17
+ * No external references — satisfies the extraction constraint.
18
+ */
19
+ const borderShorthand = createTransform("borderShorthand", (val) => typeof val === "number" ? `${val}px solid currentColor` : val);
20
+ //#endregion
21
+ //#region src/transforms/grid.ts
22
+ /**
23
+ * Self-contained transform: all logic inlined in the callback.
24
+ * No external references — satisfies the extraction constraint.
25
+ */
26
+ const gridItem = createTransform("gridItem", (item) => {
27
+ const map = {
28
+ max: "max-content",
29
+ min: "min-content"
30
+ };
31
+ const strItem = String(item);
32
+ return `minmax(0, ${/^[0-9]*$/.test(strItem) ? `${strItem}fr` : map[strItem] ?? strItem})`;
33
+ });
34
+ /**
35
+ * Self-contained transform: all logic inlined in the callback.
36
+ * Duplicates grid-item-to-template logic to avoid cross-transform reference.
37
+ */
38
+ const gridItemRatio = createTransform("gridItemRatio", (val) => {
39
+ const toTemplate = (item) => {
40
+ return `minmax(0, ${/^[0-9]*$/.test(item) ? `${item}fr` : {
41
+ max: "max-content",
42
+ min: "min-content"
43
+ }[item] ?? item})`;
44
+ };
45
+ const repeat = (item, count) => {
46
+ const template = toTemplate(item);
47
+ return count > 1 ? `repeat(${count}, ${template})` : template;
48
+ };
49
+ if (typeof val === "number") return repeat("1", val);
50
+ const items = String(val).split(":");
51
+ let repeated = ["", 0];
52
+ let gridStyle = "";
53
+ for (let i = 0; i < items.length + 1; i += 1) {
54
+ const delimiter = gridStyle.length > 0 ? " " : "";
55
+ const curr = items[i];
56
+ if (repeated?.[0] !== curr) {
57
+ if (repeated[0].length) gridStyle += delimiter + repeat(repeated[0], repeated[1]);
58
+ if (curr) repeated = [curr, 1];
59
+ } else repeated[1] += 1;
60
+ }
61
+ return gridStyle;
62
+ });
63
+ //#endregion
64
+ //#region src/transforms/size.ts
65
+ /**
66
+ * Convert a numeric coordinate to a CSS value.
67
+ * Exported for non-extraction use — NOT referenced from the createTransform callback.
68
+ */
69
+ const percentageOrAbsolute = (coordinate) => {
70
+ if (coordinate === 0) return coordinate;
71
+ if (coordinate <= 1 && coordinate >= -1) return `${coordinate * 100}%`;
72
+ return `${coordinate}px`;
73
+ };
74
+ /**
75
+ * Self-contained transform: all logic inlined in the callback.
76
+ * No external references — satisfies the extraction constraint.
77
+ */
78
+ const size = createTransform("size", (value) => {
79
+ const toSize = (n) => {
80
+ if (n === 0) return n;
81
+ if (n <= 1 && n >= -1) return `${n * 100}%`;
82
+ return `${n}px`;
83
+ };
84
+ if (typeof value === "number") return toSize(value);
85
+ const strValue = value;
86
+ if (strValue.includes("calc")) return strValue;
87
+ const [match, number, unit] = /(-?\d*\.?\d+)(%|\w*)/.exec(strValue) || [];
88
+ if (match === void 0) return strValue;
89
+ const numericValue = parseFloat(number);
90
+ return !unit ? toSize(numericValue) : `${numericValue}${unit}`;
91
+ });
92
+ //#endregion
93
+ export { borderShorthand as a, numericOrStringScale as c, gridItemRatio as i, numericScale as l, size as n, createTransform as o, gridItem as r, createScale as s, percentageOrAbsolute as t, stringScale as u };
@@ -1,2 +1,6 @@
1
+ /**
2
+ * Self-contained transform: all logic inlined in the callback.
3
+ * No external references — satisfies the extraction constraint.
4
+ */
1
5
  export declare const borderShorthand: import("./createTransform").NamedTransform;
2
6
  //# sourceMappingURL=border.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"border.d.ts","sourceRoot":"","sources":["../../src/transforms/border.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,4CAE3B,CAAC"}
1
+ {"version":3,"file":"border.d.ts","sourceRoot":"","sources":["../../src/transforms/border.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,eAAe,4CAE3B,CAAC"}
@@ -1,5 +1,18 @@
1
+ /**
2
+ * Self-contained transform: all logic inlined in the callback.
3
+ * No external references — satisfies the extraction constraint.
4
+ */
1
5
  export declare const gridItem: import("./createTransform").NamedTransform;
6
+ /**
7
+ * Convert a grid item value to a CSS template string.
8
+ * Exported for non-extraction use — NOT referenced from createTransform callbacks.
9
+ */
10
+ export declare const toGridTemplate: (item: string) => string;
2
11
  export declare const repeatGridItem: (item: string, count: number) => string;
3
12
  export declare const parseGridRatio: (val: string) => string;
13
+ /**
14
+ * Self-contained transform: all logic inlined in the callback.
15
+ * Duplicates grid-item-to-template logic to avoid cross-transform reference.
16
+ */
4
17
  export declare const gridItemRatio: import("./createTransform").NamedTransform;
5
18
  //# sourceMappingURL=grid.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../src/transforms/grid.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,QAAQ,4CAMnB,CAAC;AAEH,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,WAGzD,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,WAkBzC,CAAC;AAEF,eAAO,MAAM,aAAa,4CAIxB,CAAC"}
1
+ {"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../src/transforms/grid.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,QAAQ,4CAUnB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,KAAG,MAO7C,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,WAGzD,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,WAkBzC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,4CAoCxB,CAAC"}
@@ -1,3 +1,11 @@
1
+ /**
2
+ * Convert a numeric coordinate to a CSS value.
3
+ * Exported for non-extraction use — NOT referenced from the createTransform callback.
4
+ */
1
5
  export declare const percentageOrAbsolute: (coordinate: number) => string | 0;
6
+ /**
7
+ * Self-contained transform: all logic inlined in the callback.
8
+ * No external references — satisfies the extraction constraint.
9
+ */
2
10
  export declare const size: import("./createTransform").NamedTransform;
3
11
  //# sourceMappingURL=size.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"size.d.ts","sourceRoot":"","sources":["../../src/transforms/size.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,GAAI,YAAY,MAAM,eAQtD,CAAC;AAIF,eAAO,MAAM,IAAI,4CAoBf,CAAC"}
1
+ {"version":3,"file":"size.d.ts","sourceRoot":"","sources":["../../src/transforms/size.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAAI,YAAY,MAAM,eAQtD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,IAAI,4CA0Bf,CAAC"}
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@animus-ui/system",
3
- "version": "0.1.0-next.49",
3
+ "version": "0.1.0-next.59",
4
4
  "description": "Animus design system builder — tokens, prop groups, global styles",
5
5
  "author": "codecaaron <airrobb@gmail.com>",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
+ "sideEffects": false,
8
9
  "main": "./dist/index.js",
9
10
  "module": "./dist/index.js",
10
11
  "types": "./dist/index.d.ts",
@@ -17,6 +18,14 @@
17
18
  "types": "./dist/groups/index.d.ts",
18
19
  "import": "./dist/groups/index.js"
19
20
  },
21
+ "./compose": {
22
+ "types": "./dist/compose.d.ts",
23
+ "import": "./dist/compose.js"
24
+ },
25
+ "./compose-with-context": {
26
+ "types": "./dist/composeWithContext.d.ts",
27
+ "import": "./dist/composeWithContext.js"
28
+ },
20
29
  "./runtime": {
21
30
  "types": "./dist/runtime-entry.d.ts",
22
31
  "import": "./dist/runtime-entry.js",
@@ -54,7 +63,7 @@
54
63
  "compile": "tsc --noEmit"
55
64
  },
56
65
  "dependencies": {
57
- "@animus-ui/properties": "0.1.0-next.49"
66
+ "@animus-ui/properties": "0.1.0-next.59"
58
67
  },
59
68
  "peerDependencies": {
60
69
  "react": "^18.0.0 || ^19.0.0"
@@ -1,70 +0,0 @@
1
- //#region src/scales/createScale.ts
2
- const createScale = () => [];
3
- const numericScale = [];
4
- const stringScale = [];
5
- const numericOrStringScale = [];
6
- //#endregion
7
- //#region src/transforms/createTransform.ts
8
- function createTransform(name, fn) {
9
- const wrapper = (value, property, props) => fn(value, property, props);
10
- Object.defineProperty(wrapper, "name", { value: name });
11
- return Object.assign(wrapper, { transformName: name });
12
- }
13
- //#endregion
14
- //#region src/transforms/utils.ts
15
- const numberToTemplate = (val, template) => typeof val === "number" ? template(val) : val;
16
- //#endregion
17
- //#region src/transforms/border.ts
18
- const borderShorthand = createTransform("borderShorthand", (val) => numberToTemplate(val, (width) => `${width}px solid currentColor`));
19
- //#endregion
20
- //#region src/transforms/grid.ts
21
- const gridItemMap = {
22
- max: "max-content",
23
- min: "min-content"
24
- };
25
- const unitlessNumber = /* @__PURE__ */ new RegExp(/^[0-9]*$/);
26
- const isUnitlessNumber = (val) => unitlessNumber.test(val);
27
- const gridItem = createTransform("gridItem", (item) => {
28
- const strItem = String(item);
29
- return `minmax(0, ${isUnitlessNumber(strItem) ? `${strItem}fr` : gridItemMap[strItem] ?? strItem})`;
30
- });
31
- const repeatGridItem = (item, count) => {
32
- const template = gridItem(item);
33
- return count > 1 ? `repeat(${count}, ${template})` : template;
34
- };
35
- const parseGridRatio = (val) => {
36
- const items = val.split(":");
37
- let repeated = ["", 0];
38
- let gridStyle = "";
39
- for (let i = 0; i < items.length + 1; i += 1) {
40
- const delimiter = gridStyle.length > 0 ? " " : "";
41
- const curr = items[i];
42
- if (repeated?.[0] !== curr) {
43
- if (repeated[0].length) gridStyle += delimiter + repeatGridItem(...repeated);
44
- if (curr) repeated = [curr, 1];
45
- } else repeated[1] += 1;
46
- }
47
- return gridStyle;
48
- };
49
- const gridItemRatio = createTransform("gridItemRatio", (val) => {
50
- return typeof val === "number" ? repeatGridItem("1", val) : parseGridRatio(val);
51
- });
52
- //#endregion
53
- //#region src/transforms/size.ts
54
- const percentageOrAbsolute = (coordinate) => {
55
- if (coordinate === 0) return coordinate;
56
- if (coordinate <= 1 && coordinate >= -1) return `${coordinate * 100}%`;
57
- return `${coordinate}px`;
58
- };
59
- const valueWithUnit = /(-?\d*\.?\d+)(%|\w*)/;
60
- const size = createTransform("size", (value) => {
61
- if (typeof value === "number") return percentageOrAbsolute(value);
62
- const strValue = value;
63
- if (strValue.includes("calc")) return strValue;
64
- const [match, number, unit] = valueWithUnit.exec(strValue) || [];
65
- if (match === void 0) return strValue;
66
- const numericValue = parseFloat(number);
67
- return !unit ? percentageOrAbsolute(numericValue) : `${numericValue}${unit}`;
68
- });
69
- //#endregion
70
- export { borderShorthand as a, numericOrStringScale as c, gridItemRatio as i, numericScale as l, size as n, createTransform as o, gridItem as r, createScale as s, percentageOrAbsolute as t, stringScale as u };