@animus-ui/system 0.1.0-next.38 → 0.1.0-next.40
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 +127 -0
- package/dist/SystemBuilder.d.ts +5 -1
- package/dist/SystemBuilder.d.ts.map +1 -1
- package/dist/compose.d.ts +10 -5
- package/dist/compose.d.ts.map +1 -1
- package/dist/{createClassResolver-u1d160An.js → createClassResolver-Qh7lL0eP.js} +42 -15
- package/dist/groups/index.d.ts +32 -0
- package/dist/groups/index.d.ts.map +1 -1
- package/dist/groups/index.js +47 -15
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +197 -43
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime-entry.js +1 -1
- package/dist/selectors.d.ts +40 -0
- package/dist/selectors.d.ts.map +1 -0
- package/dist/types/component.d.ts +14 -6
- package/dist/types/component.d.ts.map +1 -1
- package/dist/types/config.d.ts +13 -0
- package/dist/types/config.d.ts.map +1 -1
- package/package.json +18 -3
package/dist/groups/index.js
CHANGED
|
@@ -57,122 +57,146 @@ const border = {
|
|
|
57
57
|
border: {
|
|
58
58
|
property: "border",
|
|
59
59
|
scale: "borders",
|
|
60
|
+
strict: false,
|
|
60
61
|
transform: borderShorthand
|
|
61
62
|
},
|
|
62
63
|
borderX: {
|
|
63
64
|
property: "border",
|
|
64
65
|
properties: ["borderLeft", "borderRight"],
|
|
65
66
|
scale: "borders",
|
|
67
|
+
strict: false,
|
|
66
68
|
transform: borderShorthand
|
|
67
69
|
},
|
|
68
70
|
borderY: {
|
|
69
71
|
property: "border",
|
|
70
72
|
properties: ["borderTop", "borderBottom"],
|
|
71
73
|
scale: "borders",
|
|
74
|
+
strict: false,
|
|
72
75
|
transform: borderShorthand
|
|
73
76
|
},
|
|
74
77
|
borderTop: {
|
|
75
78
|
property: "borderTop",
|
|
76
79
|
scale: "borders",
|
|
80
|
+
strict: false,
|
|
77
81
|
transform: borderShorthand
|
|
78
82
|
},
|
|
79
83
|
borderRight: {
|
|
80
84
|
property: "borderRight",
|
|
81
85
|
scale: "borders",
|
|
86
|
+
strict: false,
|
|
82
87
|
transform: borderShorthand
|
|
83
88
|
},
|
|
84
89
|
borderBottom: {
|
|
85
90
|
property: "borderBottom",
|
|
86
91
|
scale: "borders",
|
|
92
|
+
strict: false,
|
|
87
93
|
transform: borderShorthand
|
|
88
94
|
},
|
|
89
95
|
borderLeft: {
|
|
90
96
|
property: "borderLeft",
|
|
91
97
|
scale: "borders",
|
|
98
|
+
strict: false,
|
|
92
99
|
transform: borderShorthand
|
|
93
100
|
},
|
|
94
101
|
borderWidth: {
|
|
95
102
|
property: "borderWidth",
|
|
96
|
-
scale: "borderWidths"
|
|
103
|
+
scale: "borderWidths",
|
|
104
|
+
strict: false
|
|
97
105
|
},
|
|
98
106
|
borderXWidth: {
|
|
99
107
|
property: "borderWidth",
|
|
100
108
|
properties: ["borderLeftWidth", "borderRightWidth"],
|
|
101
|
-
scale: "borderWidths"
|
|
109
|
+
scale: "borderWidths",
|
|
110
|
+
strict: false
|
|
102
111
|
},
|
|
103
112
|
borderYWidth: {
|
|
104
113
|
property: "borderWidth",
|
|
105
114
|
properties: ["borderTopWidth", "borderBottomWidth"],
|
|
106
|
-
scale: "borderWidths"
|
|
115
|
+
scale: "borderWidths",
|
|
116
|
+
strict: false
|
|
107
117
|
},
|
|
108
118
|
borderLeftWidth: {
|
|
109
119
|
property: "borderLeftWidth",
|
|
110
|
-
scale: "borderWidths"
|
|
120
|
+
scale: "borderWidths",
|
|
121
|
+
strict: false
|
|
111
122
|
},
|
|
112
123
|
borderRightWidth: {
|
|
113
124
|
property: "borderRightWidth",
|
|
114
|
-
scale: "borderWidths"
|
|
125
|
+
scale: "borderWidths",
|
|
126
|
+
strict: false
|
|
115
127
|
},
|
|
116
128
|
borderTopWidth: {
|
|
117
129
|
property: "borderTopWidth",
|
|
118
|
-
scale: "borderWidths"
|
|
130
|
+
scale: "borderWidths",
|
|
131
|
+
strict: false
|
|
119
132
|
},
|
|
120
133
|
borderBottomWidth: {
|
|
121
134
|
property: "borderBottomWidth",
|
|
122
|
-
scale: "borderWidths"
|
|
135
|
+
scale: "borderWidths",
|
|
136
|
+
strict: false
|
|
123
137
|
},
|
|
124
138
|
borderRadius: {
|
|
125
139
|
property: "borderRadius",
|
|
126
140
|
scale: "radii",
|
|
141
|
+
strict: false,
|
|
127
142
|
transform: size
|
|
128
143
|
},
|
|
129
144
|
rounded: {
|
|
130
145
|
property: "borderRadius",
|
|
131
146
|
scale: "radii",
|
|
147
|
+
strict: false,
|
|
132
148
|
transform: size
|
|
133
149
|
},
|
|
134
150
|
borderLeftRadius: {
|
|
135
151
|
property: "borderRadius",
|
|
136
152
|
properties: ["borderTopLeftRadius", "borderBottomLeftRadius"],
|
|
137
153
|
scale: "radii",
|
|
154
|
+
strict: false,
|
|
138
155
|
transform: size
|
|
139
156
|
},
|
|
140
157
|
borderTopRadius: {
|
|
141
158
|
property: "borderRadius",
|
|
142
159
|
properties: ["borderTopLeftRadius", "borderTopRightRadius"],
|
|
143
160
|
scale: "radii",
|
|
161
|
+
strict: false,
|
|
144
162
|
transform: size
|
|
145
163
|
},
|
|
146
164
|
borderBottomRadius: {
|
|
147
165
|
property: "borderRadius",
|
|
148
166
|
properties: ["borderBottomLeftRadius", "borderBottomRightRadius"],
|
|
149
167
|
scale: "radii",
|
|
168
|
+
strict: false,
|
|
150
169
|
transform: size
|
|
151
170
|
},
|
|
152
171
|
borderRightRadius: {
|
|
153
172
|
property: "borderRadius",
|
|
154
173
|
properties: ["borderTopRightRadius", "borderBottomRightRadius"],
|
|
155
174
|
scale: "radii",
|
|
175
|
+
strict: false,
|
|
156
176
|
transform: size
|
|
157
177
|
},
|
|
158
178
|
borderTopLeftRadius: {
|
|
159
179
|
property: "borderTopLeftRadius",
|
|
160
180
|
scale: "radii",
|
|
181
|
+
strict: false,
|
|
161
182
|
transform: size
|
|
162
183
|
},
|
|
163
184
|
borderTopRightRadius: {
|
|
164
185
|
property: "borderTopRightRadius",
|
|
165
186
|
scale: "radii",
|
|
187
|
+
strict: false,
|
|
166
188
|
transform: size
|
|
167
189
|
},
|
|
168
190
|
borderBottomRightRadius: {
|
|
169
191
|
property: "borderBottomRightRadius",
|
|
170
192
|
scale: "radii",
|
|
193
|
+
strict: false,
|
|
171
194
|
transform: size
|
|
172
195
|
},
|
|
173
196
|
borderBottomLeftRadius: {
|
|
174
197
|
property: "borderBottomLeftRadius",
|
|
175
198
|
scale: "radii",
|
|
199
|
+
strict: false,
|
|
176
200
|
transform: size
|
|
177
201
|
},
|
|
178
202
|
borderStyle: { property: "borderStyle" },
|
|
@@ -323,25 +347,30 @@ const positioning = {
|
|
|
323
347
|
},
|
|
324
348
|
zIndex: {
|
|
325
349
|
property: "zIndex",
|
|
326
|
-
scale: "zIndices"
|
|
350
|
+
scale: "zIndices",
|
|
351
|
+
strict: false
|
|
327
352
|
},
|
|
328
353
|
opacity: {
|
|
329
354
|
property: "opacity",
|
|
330
|
-
scale: "opacities"
|
|
355
|
+
scale: "opacities",
|
|
356
|
+
strict: false
|
|
331
357
|
}
|
|
332
358
|
};
|
|
333
359
|
const shadows = {
|
|
334
360
|
boxShadow: {
|
|
335
361
|
property: "boxShadow",
|
|
336
|
-
scale: "shadows"
|
|
362
|
+
scale: "shadows",
|
|
363
|
+
strict: false
|
|
337
364
|
},
|
|
338
365
|
shadow: {
|
|
339
366
|
property: "boxShadow",
|
|
340
|
-
scale: "shadows"
|
|
367
|
+
scale: "shadows",
|
|
368
|
+
strict: false
|
|
341
369
|
},
|
|
342
370
|
textShadow: {
|
|
343
371
|
property: "textShadow",
|
|
344
|
-
scale: "shadows"
|
|
372
|
+
scale: "shadows",
|
|
373
|
+
strict: false
|
|
345
374
|
}
|
|
346
375
|
};
|
|
347
376
|
const layout = {
|
|
@@ -414,11 +443,13 @@ const typography = {
|
|
|
414
443
|
},
|
|
415
444
|
fontWeight: {
|
|
416
445
|
property: "fontWeight",
|
|
417
|
-
scale: "fontWeights"
|
|
446
|
+
scale: "fontWeights",
|
|
447
|
+
strict: false
|
|
418
448
|
},
|
|
419
449
|
lineHeight: {
|
|
420
450
|
property: "lineHeight",
|
|
421
|
-
scale: "lineHeights"
|
|
451
|
+
scale: "lineHeights",
|
|
452
|
+
strict: false
|
|
422
453
|
},
|
|
423
454
|
fontSize: {
|
|
424
455
|
property: "fontSize",
|
|
@@ -426,7 +457,8 @@ const typography = {
|
|
|
426
457
|
},
|
|
427
458
|
letterSpacing: {
|
|
428
459
|
property: "letterSpacing",
|
|
429
|
-
scale: "letterSpacings"
|
|
460
|
+
scale: "letterSpacings",
|
|
461
|
+
strict: false
|
|
430
462
|
},
|
|
431
463
|
textAlign: { property: "textAlign" },
|
|
432
464
|
fontStyle: { property: "fontStyle" },
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export { createClassResolver } from './runtime/createClassResolver';
|
|
|
6
6
|
export type { GlobalStyleBlock, GlobalStyleMap, GlobalStylesFactory, SerializedConfig, SystemInstance, } from './SystemBuilder';
|
|
7
7
|
export { createSystem, SystemBuilder } from './SystemBuilder';
|
|
8
8
|
export { createScale, numericOrStringScale, numericScale, stringScale, } from './scales/createScale';
|
|
9
|
+
export { BUILT_IN_SELECTORS, type SelectorAlias, type SelectorAliasMap, } from './selectors';
|
|
9
10
|
export type { Assign, AssignValueIfUnmergable, ColorModeConfig, FindPath, KeyAsVariable, LiteralPaths, Mergable, Merge, MergeTheme, Path, PathToLiteral, PathValue, PrivateThemeKeys, SanitizeKey, } from './theme';
|
|
10
11
|
export { createTheme, ThemeBuilder } from './theme';
|
|
11
12
|
export { borderShorthand } from './transforms/border';
|
|
@@ -13,7 +14,7 @@ export { createTransform, type NamedTransform, type TransformFn, } from './trans
|
|
|
13
14
|
export { gridItem, gridItemRatio } from './transforms/grid';
|
|
14
15
|
export { percentageOrAbsolute, size } from './transforms/size';
|
|
15
16
|
export type { AnimusComponent, AnimusWrappedComponent, AnyBrandedComponent, ComposedFamily, SharedConfig, VariantPropsOf, } from './types/component';
|
|
16
|
-
export type { AbstractParser, CompoundEntry, CSSPropMap, CSSProps, CustomPropConfig, Parser, ParserProps, Prop, PropertyValues, Scale, ScaleValue, SystemProps, ThemedCSSPropMap, ThemedCSSProps, ThemedScale, ThemedScaleValue, VariantConfig, } from './types/config';
|
|
17
|
+
export type { AbstractParser, BuiltInSelectorAlias, CompoundEntry, CSSPropMap, CSSProps, CustomPropConfig, Parser, ParserProps, Prop, PropertyValues, Scale, ScaleValue, SelectorAliasProps, SystemProps, ThemedCSSPropMap, ThemedCSSProps, ThemedScale, ThemedScaleValue, VariantConfig, } from './types/config';
|
|
17
18
|
export type { AbstractProps, MediaQueryMap, ResponsiveProp, ThemeProps, } from './types/props';
|
|
18
19
|
export type { ArrayScale, MapScale } from './types/scales';
|
|
19
20
|
export type { CSSObject } from './types/shared';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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;
|
|
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,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAE/D,YAAY,EACV,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,cAAc,GACf,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,MAAM,EACN,WAAW,EACX,IAAI,EACJ,cAAc,EACd,KAAK,EACL,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,aAAa,GACd,MAAM,gBAAgB,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,4 +1,4 @@
|
|
|
1
|
-
import { n as createComponent, t as createClassResolver } from "./createClassResolver-
|
|
1
|
+
import { n as createComponent, t as createClassResolver } from "./createClassResolver-Qh7lL0eP.js";
|
|
2
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
3
|
import { createContext, createElement, forwardRef, useContext } from "react";
|
|
4
4
|
//#region src/utils/deepMerge.ts
|
|
@@ -229,70 +229,220 @@ var Animus = class extends AnimusWithBase {
|
|
|
229
229
|
};
|
|
230
230
|
//#endregion
|
|
231
231
|
//#region src/compose.ts
|
|
232
|
-
const EMPTY_SHARED = {};
|
|
233
232
|
/**
|
|
234
233
|
* Compose independently-authored Animus components into a sealed,
|
|
235
234
|
* namespaced component family with shared variant propagation via
|
|
236
|
-
*
|
|
235
|
+
* CSS cascade.
|
|
237
236
|
*
|
|
238
237
|
* - **Enforce**: TypeScript ensures shared keys exist on Root (the
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
* - **Wire**:
|
|
242
|
-
*
|
|
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.
|
|
243
246
|
* - **Seal**: Output components are plain ForwardRefExoticComponent —
|
|
244
247
|
* no `.extend()`, no builder methods. One-way door from builder-land
|
|
245
248
|
* to component-land.
|
|
246
249
|
*/
|
|
247
250
|
function compose(slots, options) {
|
|
248
|
-
const sharedKeys = Object.keys(options.shared);
|
|
249
|
-
const FamilyContext = createContext(EMPTY_SHARED);
|
|
250
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;
|
|
251
255
|
const result = {};
|
|
252
|
-
for (const [name, SourceComponent] of Object.entries(slots))
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
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, {
|
|
257
262
|
...props,
|
|
258
263
|
ref
|
|
259
|
-
}));
|
|
264
|
+
}, createElement(FamilyCtx.Provider, { value: shared }, props.children));
|
|
260
265
|
});
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
const knownKeys = SourceComponent.__variantKeys;
|
|
265
|
-
const ChildWrapper = forwardRef((props, ref) => {
|
|
266
|
-
const shared = useContext(FamilyContext);
|
|
267
|
-
let merged;
|
|
268
|
-
if (knownKeys && sharedKeys.length > 0) {
|
|
269
|
-
const filtered = {};
|
|
270
|
-
for (const key of sharedKeys) if (knownKeys.has(key) && key in shared) filtered[key] = shared[key];
|
|
271
|
-
merged = {
|
|
272
|
-
...filtered,
|
|
273
|
-
...props,
|
|
274
|
-
ref
|
|
275
|
-
};
|
|
276
|
-
} else merged = {
|
|
266
|
+
else if (FamilyCtx) Wrapper = forwardRef((props, ref) => {
|
|
267
|
+
return createElement(SourceComponent, {
|
|
268
|
+
...useContext(FamilyCtx),
|
|
277
269
|
...props,
|
|
278
270
|
ref
|
|
279
|
-
};
|
|
280
|
-
return createElement(SourceComponent, merged);
|
|
271
|
+
});
|
|
281
272
|
});
|
|
282
|
-
|
|
283
|
-
|
|
273
|
+
else Wrapper = forwardRef((props, ref) => createElement(SourceComponent, {
|
|
274
|
+
...props,
|
|
275
|
+
ref
|
|
276
|
+
}));
|
|
277
|
+
Wrapper.displayName = `${familyName}.${name}`;
|
|
278
|
+
result[name] = Wrapper;
|
|
284
279
|
}
|
|
285
280
|
if (!("Root" in result)) throw new Error("compose(): No \"Root\" slot found. The root slot key must be exactly \"Root\" (PascalCase).");
|
|
286
281
|
return result;
|
|
287
282
|
}
|
|
288
283
|
//#endregion
|
|
284
|
+
//#region src/selectors.ts
|
|
285
|
+
/**
|
|
286
|
+
* Built-in selector aliases.
|
|
287
|
+
*
|
|
288
|
+
* Compound selectors (e.g. `_disabled`) target multiple CSS selectors
|
|
289
|
+
* via comma-separation to cover native, ARIA, and data attribute conventions.
|
|
290
|
+
*/
|
|
291
|
+
const BUILT_IN_SELECTORS = {
|
|
292
|
+
_link: {
|
|
293
|
+
selector: "&:link",
|
|
294
|
+
order: 10
|
|
295
|
+
},
|
|
296
|
+
_visited: {
|
|
297
|
+
selector: "&:visited",
|
|
298
|
+
order: 20
|
|
299
|
+
},
|
|
300
|
+
_hover: {
|
|
301
|
+
selector: "&:hover",
|
|
302
|
+
order: 30
|
|
303
|
+
},
|
|
304
|
+
_focusWithin: {
|
|
305
|
+
selector: "&:focus-within",
|
|
306
|
+
order: 40
|
|
307
|
+
},
|
|
308
|
+
_focus: {
|
|
309
|
+
selector: "&:focus",
|
|
310
|
+
order: 50
|
|
311
|
+
},
|
|
312
|
+
_focusVisible: {
|
|
313
|
+
selector: "&:focus-visible",
|
|
314
|
+
order: 60
|
|
315
|
+
},
|
|
316
|
+
_active: {
|
|
317
|
+
selector: "&:active",
|
|
318
|
+
order: 70
|
|
319
|
+
},
|
|
320
|
+
_target: {
|
|
321
|
+
selector: "&:target",
|
|
322
|
+
order: 80
|
|
323
|
+
},
|
|
324
|
+
_checked: {
|
|
325
|
+
selector: "&:checked, &[aria-checked=\"true\"], &[data-checked]",
|
|
326
|
+
order: 100
|
|
327
|
+
},
|
|
328
|
+
_invalid: {
|
|
329
|
+
selector: "&:invalid, &[aria-invalid=\"true\"], &[data-invalid]",
|
|
330
|
+
order: 110
|
|
331
|
+
},
|
|
332
|
+
_required: {
|
|
333
|
+
selector: "&:required, &[aria-required=\"true\"]",
|
|
334
|
+
order: 120
|
|
335
|
+
},
|
|
336
|
+
_readOnly: {
|
|
337
|
+
selector: "&:read-only, &[aria-readonly=\"true\"], &[data-readonly]",
|
|
338
|
+
order: 130
|
|
339
|
+
},
|
|
340
|
+
_expanded: {
|
|
341
|
+
selector: "&[aria-expanded=\"true\"], &[data-expanded]",
|
|
342
|
+
order: 140
|
|
343
|
+
},
|
|
344
|
+
_selected: {
|
|
345
|
+
selector: "&[aria-selected=\"true\"], &[data-selected]",
|
|
346
|
+
order: 150
|
|
347
|
+
},
|
|
348
|
+
_pressed: {
|
|
349
|
+
selector: "&[aria-pressed=\"true\"], &[data-pressed]",
|
|
350
|
+
order: 160
|
|
351
|
+
},
|
|
352
|
+
_disabled: {
|
|
353
|
+
selector: "&:disabled, &[disabled], &[aria-disabled=\"true\"], &[data-disabled]",
|
|
354
|
+
order: 200
|
|
355
|
+
},
|
|
356
|
+
_before: {
|
|
357
|
+
selector: "&::before",
|
|
358
|
+
order: 300
|
|
359
|
+
},
|
|
360
|
+
_after: {
|
|
361
|
+
selector: "&::after",
|
|
362
|
+
order: 310
|
|
363
|
+
},
|
|
364
|
+
_placeholder: {
|
|
365
|
+
selector: "&::placeholder",
|
|
366
|
+
order: 320
|
|
367
|
+
},
|
|
368
|
+
_selection: {
|
|
369
|
+
selector: "&::selection",
|
|
370
|
+
order: 330
|
|
371
|
+
},
|
|
372
|
+
_first: {
|
|
373
|
+
selector: "&:first-child",
|
|
374
|
+
order: 400
|
|
375
|
+
},
|
|
376
|
+
_last: {
|
|
377
|
+
selector: "&:last-child",
|
|
378
|
+
order: 410
|
|
379
|
+
},
|
|
380
|
+
_even: {
|
|
381
|
+
selector: "&:nth-child(even)",
|
|
382
|
+
order: 420
|
|
383
|
+
},
|
|
384
|
+
_odd: {
|
|
385
|
+
selector: "&:nth-child(odd)",
|
|
386
|
+
order: 430
|
|
387
|
+
},
|
|
388
|
+
_empty: {
|
|
389
|
+
selector: "&:empty",
|
|
390
|
+
order: 440
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
/**
|
|
394
|
+
* Merge user-provided selectors with built-in defaults.
|
|
395
|
+
* User selectors override built-in aliases of the same name.
|
|
396
|
+
* New aliases get an order value based on their position (500+).
|
|
397
|
+
*/
|
|
398
|
+
function mergeSelectors(base, custom) {
|
|
399
|
+
const merged = { ...base };
|
|
400
|
+
let nextOrder = 500;
|
|
401
|
+
for (const [key, selector] of Object.entries(custom)) if (key in merged) merged[key] = {
|
|
402
|
+
selector,
|
|
403
|
+
order: merged[key].order
|
|
404
|
+
};
|
|
405
|
+
else {
|
|
406
|
+
merged[key] = {
|
|
407
|
+
selector,
|
|
408
|
+
order: nextOrder
|
|
409
|
+
};
|
|
410
|
+
nextOrder += 10;
|
|
411
|
+
}
|
|
412
|
+
return merged;
|
|
413
|
+
}
|
|
414
|
+
/** Get the sorted alias keys for deterministic cascade ordering. */
|
|
415
|
+
function getSortedAliasKeys(map) {
|
|
416
|
+
return Object.keys(map).sort((a, b) => map[a].order - map[b].order);
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Serialize the selector map for the extraction pipeline.
|
|
420
|
+
* Emits a flat `Record<string, string>` (alias → selector) plus
|
|
421
|
+
* the ordered key list for cascade determinism.
|
|
422
|
+
*/
|
|
423
|
+
function serializeSelectorMap(map) {
|
|
424
|
+
const selectors = {};
|
|
425
|
+
const order = getSortedAliasKeys(map);
|
|
426
|
+
for (const key of order) selectors[key] = map[key].selector;
|
|
427
|
+
return {
|
|
428
|
+
selectors,
|
|
429
|
+
order
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
//#endregion
|
|
289
433
|
//#region src/SystemBuilder.ts
|
|
290
434
|
var SystemBuilder = class SystemBuilder {
|
|
291
435
|
#propRegistry;
|
|
292
436
|
#groupRegistry;
|
|
293
|
-
|
|
437
|
+
#selectorRegistry;
|
|
438
|
+
constructor(propRegistry, groupRegistry, selectorRegistry) {
|
|
294
439
|
this.#propRegistry = propRegistry || {};
|
|
295
440
|
this.#groupRegistry = groupRegistry || {};
|
|
441
|
+
this.#selectorRegistry = selectorRegistry || { ...BUILT_IN_SELECTORS };
|
|
442
|
+
}
|
|
443
|
+
addSelectors(selectors) {
|
|
444
|
+
const merged = mergeSelectors(this.#selectorRegistry, selectors);
|
|
445
|
+
return new SystemBuilder(this.#propRegistry, this.#groupRegistry, merged);
|
|
296
446
|
}
|
|
297
447
|
addGroup(name, config) {
|
|
298
448
|
if (name in this.#propRegistry) throw new Error(`Group name "${name}" collides with an existing prop name. Group names and prop names must be disjoint.`);
|
|
@@ -309,7 +459,7 @@ var SystemBuilder = class SystemBuilder {
|
|
|
309
459
|
return new SystemBuilder(nextProps, {
|
|
310
460
|
...this.#groupRegistry,
|
|
311
461
|
...newGroup
|
|
312
|
-
});
|
|
462
|
+
}, this.#selectorRegistry);
|
|
313
463
|
}
|
|
314
464
|
addProps(config) {
|
|
315
465
|
for (const key of Object.keys(config)) if (key in this.#groupRegistry) throw new Error(`Prop name "${key}" collides with an existing group name. Group names and prop names must be disjoint.`);
|
|
@@ -321,17 +471,18 @@ var SystemBuilder = class SystemBuilder {
|
|
|
321
471
|
return new SystemBuilder({
|
|
322
472
|
...this.#propRegistry,
|
|
323
473
|
...config
|
|
324
|
-
}, this.#groupRegistry);
|
|
474
|
+
}, this.#groupRegistry, this.#selectorRegistry);
|
|
325
475
|
}
|
|
326
476
|
includes(_systems) {
|
|
327
|
-
return this;
|
|
477
|
+
return new SystemBuilder(this.#propRegistry, this.#groupRegistry, this.#selectorRegistry);
|
|
328
478
|
}
|
|
329
479
|
build() {
|
|
330
480
|
const animus = new Animus(this.#propRegistry, this.#groupRegistry);
|
|
331
481
|
const propRegistry = this.#propRegistry;
|
|
332
482
|
const groupRegistry = this.#groupRegistry;
|
|
483
|
+
const selectorRegistry = this.#selectorRegistry;
|
|
333
484
|
const system = Object.assign(animus, { toConfig: () => {
|
|
334
|
-
return serializeInstance(propRegistry, groupRegistry);
|
|
485
|
+
return serializeInstance(propRegistry, groupRegistry, selectorRegistry);
|
|
335
486
|
} });
|
|
336
487
|
const createGlobalStyles = (styles) => {
|
|
337
488
|
return {
|
|
@@ -348,7 +499,7 @@ var SystemBuilder = class SystemBuilder {
|
|
|
348
499
|
};
|
|
349
500
|
}
|
|
350
501
|
};
|
|
351
|
-
function serializeInstance(propRegistry, groupRegistry) {
|
|
502
|
+
function serializeInstance(propRegistry, groupRegistry, selectorRegistry) {
|
|
352
503
|
const serialized = {};
|
|
353
504
|
const transforms = {};
|
|
354
505
|
for (const [propName, entry] of Object.entries(propRegistry)) {
|
|
@@ -369,10 +520,13 @@ function serializeInstance(propRegistry, groupRegistry) {
|
|
|
369
520
|
if (entry.currentVar) s.currentVar = entry.currentVar;
|
|
370
521
|
serialized[propName] = s;
|
|
371
522
|
}
|
|
523
|
+
const { selectors, order } = serializeSelectorMap(selectorRegistry);
|
|
372
524
|
return {
|
|
373
525
|
propConfig: JSON.stringify(serialized),
|
|
374
526
|
groupRegistry: JSON.stringify(groupRegistry),
|
|
375
|
-
transforms
|
|
527
|
+
transforms,
|
|
528
|
+
selectorAliases: JSON.stringify(selectors),
|
|
529
|
+
selectorOrder: JSON.stringify(order)
|
|
376
530
|
};
|
|
377
531
|
}
|
|
378
532
|
function createSystem() {
|
|
@@ -755,4 +909,4 @@ function buildVariableCss(rootVariables, breakpointVariables, modeVariables) {
|
|
|
755
909
|
return parts.join("\n\n");
|
|
756
910
|
}
|
|
757
911
|
//#endregion
|
|
758
|
-
export { Animus, AnimusExtended, AnimusExtendedWithAll, AnimusWithAll, SystemBuilder, ThemeBuilder, borderShorthand, compose, createClassResolver, createComponent, createScale, createSystem, createTheme, createTransform, gridItem, gridItemRatio, numericOrStringScale, numericScale, percentageOrAbsolute, size, stringScale };
|
|
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 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
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"}
|
package/dist/runtime-entry.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createComponent, t as createClassResolver } from "./createClassResolver-
|
|
1
|
+
import { n as createComponent, t as createClassResolver } from "./createClassResolver-Qh7lL0eP.js";
|
|
2
2
|
export { createClassResolver, createComponent };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selector alias registry — maps `_`-prefixed alias keys to CSS selectors.
|
|
3
|
+
*
|
|
4
|
+
* Sort order determines cascade precedence within a layer:
|
|
5
|
+
* later entries override earlier ones when specificity is equal.
|
|
6
|
+
* The ordering follows CSS conventions (LVHA) and interaction semantics
|
|
7
|
+
* (disabled beats interaction states, pseudo-elements after states).
|
|
8
|
+
*/
|
|
9
|
+
export interface SelectorAlias {
|
|
10
|
+
/** CSS selector string (comma-separated for compound selectors) */
|
|
11
|
+
selector: string;
|
|
12
|
+
/** Sort index for cascade ordering within a layer */
|
|
13
|
+
order: number;
|
|
14
|
+
}
|
|
15
|
+
export type SelectorAliasMap = Record<string, SelectorAlias>;
|
|
16
|
+
/**
|
|
17
|
+
* Built-in selector aliases.
|
|
18
|
+
*
|
|
19
|
+
* Compound selectors (e.g. `_disabled`) target multiple CSS selectors
|
|
20
|
+
* via comma-separation to cover native, ARIA, and data attribute conventions.
|
|
21
|
+
*/
|
|
22
|
+
export declare const BUILT_IN_SELECTORS: SelectorAliasMap;
|
|
23
|
+
/**
|
|
24
|
+
* Merge user-provided selectors with built-in defaults.
|
|
25
|
+
* User selectors override built-in aliases of the same name.
|
|
26
|
+
* New aliases get an order value based on their position (500+).
|
|
27
|
+
*/
|
|
28
|
+
export declare function mergeSelectors(base: SelectorAliasMap, custom: Record<string, string>): SelectorAliasMap;
|
|
29
|
+
/** Get the sorted alias keys for deterministic cascade ordering. */
|
|
30
|
+
export declare function getSortedAliasKeys(map: SelectorAliasMap): string[];
|
|
31
|
+
/**
|
|
32
|
+
* Serialize the selector map for the extraction pipeline.
|
|
33
|
+
* Emits a flat `Record<string, string>` (alias → selector) plus
|
|
34
|
+
* the ordered key list for cascade determinism.
|
|
35
|
+
*/
|
|
36
|
+
export declare function serializeSelectorMap(map: SelectorAliasMap): {
|
|
37
|
+
selectors: Record<string, string>;
|
|
38
|
+
order: string[];
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=selectors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,aAAa;IAC5B,mEAAmE;IACnE,QAAQ,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAE7D;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,EAAE,gBAyDhC,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,gBAAgB,CAgBlB;AAED,oEAAoE;AACpE,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,gBAAgB,GAAG,MAAM,EAAE,CAElE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,gBAAgB,GAAG;IAC3D,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAOA"}
|