@animus-ui/system 0.1.16 → 0.1.18
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 -0
- package/dist/Animus.d.ts +9 -9
- package/dist/Animus.d.ts.map +1 -1
- package/dist/AnimusExtended.d.ts +17 -9
- package/dist/AnimusExtended.d.ts.map +1 -1
- package/dist/SystemBuilder.d.ts +14 -13
- package/dist/SystemBuilder.d.ts.map +1 -1
- package/dist/class-resolver.js +1 -1
- package/dist/createClassResolver-CcCgar2Z.js +360 -0
- package/dist/{createComposedFamily-C4NovMcd.js → createComposedFamily-C9ShrVy6.js} +15 -2
- package/dist/declarations.d.ts +38 -0
- package/dist/declarations.d.ts.map +1 -0
- package/dist/groups/index.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +308 -28
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/resolveClasses.d.ts +33 -6
- package/dist/runtime/resolveClasses.d.ts.map +1 -1
- package/dist/runtime-entry.js +2 -2
- package/dist/{size-C4gOY6lI.js → size-ZhCTPtA-.js} +12 -1
- package/dist/theme/createTheme.d.ts +30 -2
- package/dist/theme/createTheme.d.ts.map +1 -1
- package/dist/theme/resolveReferences.d.ts +6 -0
- package/dist/theme/resolveReferences.d.ts.map +1 -1
- package/dist/transforms/createTransform.d.ts +2 -0
- package/dist/transforms/createTransform.d.ts.map +1 -1
- package/dist/types/component.d.ts +12 -12
- package/dist/types/component.d.ts.map +1 -1
- package/dist/types/config.d.ts +49 -14
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/properties.d.ts +2 -2
- package/dist/types/properties.d.ts.map +1 -1
- package/dist/types/theme.d.ts +9 -1
- package/dist/types/theme.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/createClassResolver-EpwTL9Sa.js +0 -228
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as createClassResolver } from "./createClassResolver-
|
|
2
|
-
import { n as createComponent, t as createComposedFamily } from "./createComposedFamily-
|
|
1
|
+
import { t as createClassResolver } from "./createClassResolver-CcCgar2Z.js";
|
|
2
|
+
import { n as createComponent, t as createComposedFamily } from "./createComposedFamily-C9ShrVy6.js";
|
|
3
3
|
import { compose } from "./compose.js";
|
|
4
|
-
import { a as borderShorthand, c as numericScale, d as createTransform, i as gridItemRatio, l as stringScale, n as size, o as createScale, r as gridItem, s as numericOrStringScale, t as percentageOrAbsolute, u as areTransformsEqual } from "./size-
|
|
4
|
+
import { a as borderShorthand, c as numericScale, d as createTransform, f as linkAuthoredCallable, i as gridItemRatio, l as stringScale, n as size, o as createScale, r as gridItem, s as numericOrStringScale, t as percentageOrAbsolute, u as areTransformsEqual } from "./size-ZhCTPtA-.js";
|
|
5
5
|
//#region src/utils/deepMerge.ts
|
|
6
6
|
const isMergeable = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
7
7
|
function deepMerge(target, source) {
|
|
@@ -70,7 +70,10 @@ var AnimusExtendedWithAll = class {
|
|
|
70
70
|
};
|
|
71
71
|
var AnimusExtendedWithSystem = class extends AnimusExtendedWithAll {
|
|
72
72
|
props(config) {
|
|
73
|
-
return new AnimusExtendedWithAll(this.propRegistry, this.groupRegistry, this.baseStyles, this.variants, this.statesConfig, this.activeGroups,
|
|
73
|
+
return new AnimusExtendedWithAll(this.propRegistry, this.groupRegistry, this.baseStyles, this.variants, this.statesConfig, this.activeGroups, {
|
|
74
|
+
...this.custom,
|
|
75
|
+
...config
|
|
76
|
+
}, this.compounds);
|
|
74
77
|
}
|
|
75
78
|
};
|
|
76
79
|
var AnimusExtendedWithStates = class extends AnimusExtendedWithSystem {
|
|
@@ -347,6 +350,126 @@ function serializeConditionMap(map) {
|
|
|
347
350
|
return conditions;
|
|
348
351
|
}
|
|
349
352
|
//#endregion
|
|
353
|
+
//#region src/declarations.ts
|
|
354
|
+
/**
|
|
355
|
+
* Fields of a value prop. A declaration prop carrying one would imply a
|
|
356
|
+
* primary property, a transform or a negative form it does not have.
|
|
357
|
+
*/
|
|
358
|
+
const VALUE_PROP_FIELDS = [
|
|
359
|
+
"property",
|
|
360
|
+
"properties",
|
|
361
|
+
"transform",
|
|
362
|
+
"negative",
|
|
363
|
+
"strict",
|
|
364
|
+
"variable",
|
|
365
|
+
"currentVar"
|
|
366
|
+
];
|
|
367
|
+
const MEMBER_NAME = /^-?[A-Za-z][A-Za-z0-9-]*$/;
|
|
368
|
+
/** Representation tags, which tell data apart without trusting its type. */
|
|
369
|
+
function tagOf(value) {
|
|
370
|
+
return Object.prototype.toString.call(value);
|
|
371
|
+
}
|
|
372
|
+
function isRecord(value) {
|
|
373
|
+
return tagOf(value) === "[object Object]";
|
|
374
|
+
}
|
|
375
|
+
function isText(value) {
|
|
376
|
+
return tagOf(value) === "[object String]";
|
|
377
|
+
}
|
|
378
|
+
function isFiniteNumber(value) {
|
|
379
|
+
return tagOf(value) === "[object Number]" && Number.isFinite(value);
|
|
380
|
+
}
|
|
381
|
+
function isDeclarationProp(entry) {
|
|
382
|
+
return entry?.kind === "declarations";
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* The camelCase spelling of a CSS property, so `font-size` and `fontSize`
|
|
386
|
+
* name one member; vendor prefixes follow React's spelling (`WebkitX`,
|
|
387
|
+
* `msX`). Custom properties are not members.
|
|
388
|
+
*/
|
|
389
|
+
function canonicalMemberName(name) {
|
|
390
|
+
if (!MEMBER_NAME.test(name) || name.endsWith("-") || name.includes("--")) return;
|
|
391
|
+
if (!name.includes("-")) return name;
|
|
392
|
+
const vendor = name.startsWith("-") ? name.slice(1) : void 0;
|
|
393
|
+
const words = (vendor ?? name).split("-");
|
|
394
|
+
return (vendor === void 0 || words[0] === "ms" ? words[0] : words[0].charAt(0).toUpperCase() + words[0].slice(1)) + words.slice(1).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
|
|
395
|
+
}
|
|
396
|
+
/** Canonical members in authored order; a duplicate spelling throws. */
|
|
397
|
+
function canonicalMembers(label, members) {
|
|
398
|
+
const seen = /* @__PURE__ */ new Set();
|
|
399
|
+
return members.map((member) => {
|
|
400
|
+
const canonical = isText(member) ? canonicalMemberName(member) : void 0;
|
|
401
|
+
if (canonical === void 0) throw new Error(`${label}: member ${JSON.stringify(member)} is not a CSS property name.`);
|
|
402
|
+
if (seen.has(canonical)) throw new Error(`${label}: member '${canonical}' is listed more than once.`);
|
|
403
|
+
seen.add(canonical);
|
|
404
|
+
return canonical;
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* A declaration prop with its members canonicalized. Matching its members
|
|
409
|
+
* against the effective scale happens where the system and theme meet.
|
|
410
|
+
*/
|
|
411
|
+
function validateDeclarationProp(propName, entry) {
|
|
412
|
+
const label = `Declaration prop "${propName}"`;
|
|
413
|
+
for (const field of VALUE_PROP_FIELDS) if (entry[field] !== void 0) throw new Error(`${label}: '${field}' does not apply to a declaration prop — its scale's records name every property it sets.`);
|
|
414
|
+
if (!isText(entry.scale) || entry.scale === "") throw new Error(`${label}: 'scale' must name a scale registered with addDeclarationScale.`);
|
|
415
|
+
if (!Array.isArray(entry.members) || entry.members.length === 0) throw new Error(`${label}: 'members' must list at least one property.`);
|
|
416
|
+
return {
|
|
417
|
+
kind: "declarations",
|
|
418
|
+
scale: entry.scale,
|
|
419
|
+
members: canonicalMembers(label, entry.members)
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
function memberSetKey(record) {
|
|
423
|
+
return Object.keys(record).sort().join(",");
|
|
424
|
+
}
|
|
425
|
+
function describeLeaf(value) {
|
|
426
|
+
if (value === null) return "null";
|
|
427
|
+
if (value === void 0) return "undefined";
|
|
428
|
+
if (Array.isArray(value)) return "an array";
|
|
429
|
+
if (isRecord(value)) return "a nested record";
|
|
430
|
+
if (tagOf(value) === "[object Number]") return String(value);
|
|
431
|
+
return tagOf(value).slice(8, -1).toLowerCase();
|
|
432
|
+
}
|
|
433
|
+
function validateRecord(where, record) {
|
|
434
|
+
if (!isRecord(record) || Object.keys(record).length === 0) throw new Error(`${where} must be a non-empty record of declarations.`);
|
|
435
|
+
const canonical = {};
|
|
436
|
+
for (const [member, value] of Object.entries(record)) {
|
|
437
|
+
const name = canonicalMemberName(member);
|
|
438
|
+
if (name === void 0) throw new Error(`${where}: member '${member}' is not a CSS property name.`);
|
|
439
|
+
if (name in canonical) throw new Error(`${where}: member '${name}' is set more than once.`);
|
|
440
|
+
if (!isText(value) && !isFiniteNumber(value)) throw new Error(`${where}: member '${name}' must be a string or finite number, got ${describeLeaf(value)}.`);
|
|
441
|
+
canonical[name] = value;
|
|
442
|
+
}
|
|
443
|
+
return canonical;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Each record must be flat, with string or finite-number values, and every
|
|
447
|
+
* record of one scale must set the same members. Returns the records with
|
|
448
|
+
* canonical member names.
|
|
449
|
+
*/
|
|
450
|
+
function validateDeclarationRecords(label, scale, values) {
|
|
451
|
+
if (!isRecord(values) || Object.keys(values).length === 0) throw new Error(`${label}: declaration scale '${scale}' must map at least one key to a record.`);
|
|
452
|
+
const result = {};
|
|
453
|
+
for (const [key, record] of Object.entries(values)) result[key] = validateRecord(`${label}: declaration scale '${scale}' key '${key}'`, record);
|
|
454
|
+
assertUniformMembers(label, scale, result);
|
|
455
|
+
return result;
|
|
456
|
+
}
|
|
457
|
+
/** Every record names the members of the first; the diagnostic names the gap. */
|
|
458
|
+
function assertUniformMembers(label, scale, values) {
|
|
459
|
+
const keys = Object.keys(values).sort();
|
|
460
|
+
if (keys.length === 0) return;
|
|
461
|
+
const expected = values[keys[0]];
|
|
462
|
+
const expectedKey = memberSetKey(expected);
|
|
463
|
+
for (const key of keys.slice(1)) {
|
|
464
|
+
const record = values[key];
|
|
465
|
+
if (memberSetKey(record) === expectedKey) continue;
|
|
466
|
+
const missing = Object.keys(expected).filter((member) => !(member in record));
|
|
467
|
+
const extra = Object.keys(record).filter((member) => !(member in expected));
|
|
468
|
+
const gaps = [missing.length > 0 ? `is missing ${missing.map((member) => `'${member}'`).join(", ")}` : "", extra.length > 0 ? `sets extra ${extra.map((member) => `'${member}'`).join(", ")}` : ""].filter(Boolean);
|
|
469
|
+
throw new Error(`${label}: declaration scale '${scale}' key '${key}' ${gaps.join(" and ")} relative to key '${keys[0]}' — every record must set the same members.`);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
//#endregion
|
|
350
473
|
//#region src/keyframes.ts
|
|
351
474
|
const fnv1a = (input) => {
|
|
352
475
|
let hash = 2166136261;
|
|
@@ -592,11 +715,18 @@ function mergeVocabularyEntries(existingEntries, existingCollisions, incoming, i
|
|
|
592
715
|
};
|
|
593
716
|
}
|
|
594
717
|
const snapshotTransformBySource = /* @__PURE__ */ new WeakMap();
|
|
718
|
+
const snapshotTransforms = /* @__PURE__ */ new WeakSet();
|
|
719
|
+
/**
|
|
720
|
+
* A snapshot is already frozen, so re-snapshotting it across `extend()`
|
|
721
|
+
* returns it: the callable keeps one identity however often it is inherited.
|
|
722
|
+
*/
|
|
595
723
|
function snapshotTransform(source) {
|
|
724
|
+
if (snapshotTransforms.has(source)) return source;
|
|
596
725
|
const cached = snapshotTransformBySource.get(source);
|
|
597
726
|
if (cached) return cached;
|
|
598
727
|
const wrapper = (value, property, props) => source(value, property, props);
|
|
599
728
|
Object.defineProperty(wrapper, "name", { value: source.name });
|
|
729
|
+
linkAuthoredCallable(wrapper, source);
|
|
600
730
|
const sourceText = source.toString();
|
|
601
731
|
Object.defineProperty(wrapper, "toString", { value: () => sourceText });
|
|
602
732
|
const named = source;
|
|
@@ -610,6 +740,7 @@ function snapshotTransform(source) {
|
|
|
610
740
|
});
|
|
611
741
|
Object.freeze(wrapper);
|
|
612
742
|
snapshotTransformBySource.set(source, wrapper);
|
|
743
|
+
snapshotTransforms.add(wrapper);
|
|
613
744
|
return wrapper;
|
|
614
745
|
}
|
|
615
746
|
/**
|
|
@@ -638,13 +769,23 @@ function scalesEqual(existing, incoming) {
|
|
|
638
769
|
return orderedMembersEqual(existingKeys, Object.keys(incomingMap).sort()) && existingKeys.every((key) => existingMap[key] === incomingMap[key]);
|
|
639
770
|
}
|
|
640
771
|
function arePropDefinitionsEqual(existing, incoming, structuralScale = false) {
|
|
772
|
+
if (isDeclarationProp(existing) || isDeclarationProp(incoming)) return isDeclarationProp(existing) && isDeclarationProp(incoming) && existing.scale === incoming.scale && orderedMembersEqual(existing.members, incoming.members);
|
|
641
773
|
return existing.property === incoming.property && orderedPropertiesEqual(existing.properties, incoming.properties) && (structuralScale ? scalesEqual(existing.scale, incoming.scale) : existing.scale === incoming.scale) && existing.variable === incoming.variable && existing.negative === incoming.negative && existing.strict === incoming.strict && existing.currentVar === incoming.currentVar && areTransformsEqual(existing.transform, incoming.transform);
|
|
642
774
|
}
|
|
643
775
|
function orderedMembersEqual(existing, incoming) {
|
|
644
776
|
return existing.length === incoming.length && existing.every((member, index) => member === incoming[index]);
|
|
645
777
|
}
|
|
778
|
+
function describePropDefinition(entry) {
|
|
779
|
+
return isDeclarationProp(entry) ? `kind="declarations", scale="${entry.scale}", members="${entry.members.join(",")}"` : `property="${entry.property}", scale="${String(entry.scale)}"`;
|
|
780
|
+
}
|
|
646
781
|
function divergentPropError(key, existing, incoming, existingOrigin, incomingOrigin) {
|
|
647
|
-
return /* @__PURE__ */ new Error(`Prop "${key}" already registered with a different definition. Existing (${existingOrigin}):
|
|
782
|
+
return /* @__PURE__ */ new Error(`Prop "${key}" already registered with a different definition. Existing (${existingOrigin}): ${describePropDefinition(existing)}. Incoming (${incomingOrigin}): ${describePropDefinition(incoming)}.`);
|
|
783
|
+
}
|
|
784
|
+
/** Declaration props with canonical members; value props unchanged. */
|
|
785
|
+
function normalizePropConfig(config) {
|
|
786
|
+
const normalized = {};
|
|
787
|
+
for (const [key, entry] of Object.entries(config)) normalized[key] = isDeclarationProp(entry) ? validateDeclarationProp(key, entry) : entry;
|
|
788
|
+
return normalized;
|
|
648
789
|
}
|
|
649
790
|
var SystemBuilder = class SystemBuilder {
|
|
650
791
|
#propRegistry;
|
|
@@ -793,14 +934,15 @@ var SystemBuilder = class SystemBuilder {
|
|
|
793
934
|
const merged = mergeConditions(this.#conditionRegistry, conditions, new Set(Object.keys(this.#selectorRegistry)));
|
|
794
935
|
return new SystemBuilder(this.#propRegistry, this.#groupRegistry, this.#selectorRegistry, this.#includesRegistry, merged, this.#extendProvenance, this.#extendCount, this.#vocabularyRegistry, this.#vocabularyCollisions, this.#legacyVerbWitnesses);
|
|
795
936
|
}
|
|
796
|
-
addGroup(name,
|
|
937
|
+
addGroup(name, authored) {
|
|
797
938
|
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.`);
|
|
939
|
+
const config = normalizePropConfig(authored);
|
|
798
940
|
for (const key of Object.keys(config)) if (key in this.#propRegistry) {
|
|
799
941
|
const existing = this.#propRegistry[key];
|
|
800
942
|
const incoming = config[key];
|
|
801
943
|
if (!arePropDefinitionsEqual(existing, incoming, this.#extendProvenance.has(`prop:${key}`))) {
|
|
802
944
|
if (this.#extendProvenance.has(`prop:${key}`)) throw divergentPropError(key, existing, incoming, this.#originOf(`prop:${key}`), "builder state");
|
|
803
|
-
throw new Error(`Prop "${key}" already registered with a different definition. Existing:
|
|
945
|
+
throw new Error(`Prop "${key}" already registered with a different definition. Existing: ${describePropDefinition(existing)}. Incoming: ${describePropDefinition(incoming)}.`);
|
|
804
946
|
}
|
|
805
947
|
}
|
|
806
948
|
const nextProps = {
|
|
@@ -814,8 +956,9 @@ var SystemBuilder = class SystemBuilder {
|
|
|
814
956
|
};
|
|
815
957
|
return new SystemBuilder(nextProps, nextGroups, this.#selectorRegistry, this.#includesRegistry, this.#conditionRegistry, this.#extendProvenance, this.#extendCount, this.#vocabularyRegistry, this.#vocabularyCollisions, this.#legacyVerbWitnesses);
|
|
816
958
|
}
|
|
817
|
-
addProps(
|
|
818
|
-
for (const key of Object.keys(
|
|
959
|
+
addProps(authored) {
|
|
960
|
+
for (const key of Object.keys(authored)) 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.`);
|
|
961
|
+
const config = normalizePropConfig(authored);
|
|
819
962
|
for (const key of Object.keys(config)) if (key in this.#propRegistry) {
|
|
820
963
|
const existing = this.#propRegistry[key];
|
|
821
964
|
const incoming = config[key];
|
|
@@ -945,6 +1088,13 @@ var SystemBuilder = class SystemBuilder {
|
|
|
945
1088
|
function createRegistrySnapshot(propRegistry, groupRegistry, selectorRegistry, conditionRegistry) {
|
|
946
1089
|
const props = {};
|
|
947
1090
|
for (const [name, entry] of Object.entries(propRegistry)) {
|
|
1091
|
+
if (isDeclarationProp(entry)) {
|
|
1092
|
+
props[name] = Object.freeze({
|
|
1093
|
+
...entry,
|
|
1094
|
+
members: Object.freeze([...entry.members])
|
|
1095
|
+
});
|
|
1096
|
+
continue;
|
|
1097
|
+
}
|
|
948
1098
|
const copy = { ...entry };
|
|
949
1099
|
if (copy.properties) copy.properties = Object.freeze([...copy.properties]);
|
|
950
1100
|
if (copy.scale && typeof copy.scale === "object") copy.scale = Object.freeze(Array.isArray(copy.scale) ? [...copy.scale] : { ...copy.scale });
|
|
@@ -964,26 +1114,46 @@ function createRegistrySnapshot(propRegistry, groupRegistry, selectorRegistry, c
|
|
|
964
1114
|
conditions: Object.freeze(conditions)
|
|
965
1115
|
});
|
|
966
1116
|
}
|
|
1117
|
+
/**
|
|
1118
|
+
* A configured definition's identity: its system provenance is the first of
|
|
1119
|
+
* its bound props in sorted order, so registration order, unrelated props and
|
|
1120
|
+
* callback edits leave it unchanged. The readable name is carried for
|
|
1121
|
+
* legibility; the prop alone keeps two same-named definitions apart.
|
|
1122
|
+
*/
|
|
1123
|
+
function transformDefinitionId(name, props) {
|
|
1124
|
+
const [owner] = [...props].sort();
|
|
1125
|
+
return `${name}@system.${owner}`;
|
|
1126
|
+
}
|
|
967
1127
|
function serializeInstance(propRegistry, groupRegistry, selectorRegistry, conditionRegistry) {
|
|
968
1128
|
const serialized = {};
|
|
969
|
-
const
|
|
970
|
-
const transformOwners = {};
|
|
1129
|
+
const definitions = /* @__PURE__ */ new Map();
|
|
971
1130
|
for (const [propName, entry] of Object.entries(propRegistry)) {
|
|
1131
|
+
if (isDeclarationProp(entry)) {
|
|
1132
|
+
serialized[propName] = {
|
|
1133
|
+
kind: "declarations",
|
|
1134
|
+
scale: entry.scale,
|
|
1135
|
+
members: [...entry.members]
|
|
1136
|
+
};
|
|
1137
|
+
continue;
|
|
1138
|
+
}
|
|
972
1139
|
const s = { property: entry.property };
|
|
973
1140
|
if (entry.properties && entry.properties.length > 0) s.properties = [...entry.properties];
|
|
974
1141
|
const scale = entry.scale;
|
|
975
1142
|
if (typeof scale === "string") s.scale = scale;
|
|
976
1143
|
else if (scale && typeof scale === "object") s.scale = scale;
|
|
977
1144
|
if (entry.negative) s.negative = true;
|
|
1145
|
+
if (s.scale !== void 0 && entry.strict !== false) s.strict = true;
|
|
978
1146
|
if (entry.transform) {
|
|
979
1147
|
const fn = entry.transform;
|
|
980
1148
|
const name = fn.transformName ?? fn.name;
|
|
981
1149
|
if (name) {
|
|
982
|
-
const existing = transforms[name];
|
|
983
|
-
if (existing && !areTransformsEqual(existing, fn)) throw new Error(`Transform name "${name}" is registered by both props "${transformOwners[name]}" and "${propName}" with different function instances. Share one cached transform instance or give the transforms distinct names.`);
|
|
984
1150
|
s.transform = name;
|
|
985
|
-
|
|
986
|
-
|
|
1151
|
+
const definition = definitions.get(fn);
|
|
1152
|
+
if (definition) definition.props.push(propName);
|
|
1153
|
+
else definitions.set(fn, {
|
|
1154
|
+
name,
|
|
1155
|
+
props: [propName]
|
|
1156
|
+
});
|
|
987
1157
|
}
|
|
988
1158
|
}
|
|
989
1159
|
if (entry.currentVar) s.currentVar = entry.currentVar;
|
|
@@ -991,10 +1161,14 @@ function serializeInstance(propRegistry, groupRegistry, selectorRegistry, condit
|
|
|
991
1161
|
}
|
|
992
1162
|
const { selectors } = serializeSelectorMap(selectorRegistry);
|
|
993
1163
|
const conditions = serializeConditionMap(conditionRegistry);
|
|
1164
|
+
const transforms = {};
|
|
994
1165
|
const transformSources = {};
|
|
995
|
-
for (const [name,
|
|
1166
|
+
for (const [fn, { name, props }] of definitions) {
|
|
1167
|
+
const id = transformDefinitionId(name, props);
|
|
1168
|
+
for (const propName of props) serialized[propName].transformId = id;
|
|
1169
|
+
transforms[id] = fn;
|
|
996
1170
|
const source = fn.transformSource;
|
|
997
|
-
if (source !== void 0) transformSources[
|
|
1171
|
+
if (source !== void 0) transformSources[id] = source;
|
|
998
1172
|
}
|
|
999
1173
|
return {
|
|
1000
1174
|
propConfig: JSON.stringify(serialized),
|
|
@@ -1040,6 +1214,31 @@ function parseReferences(value) {
|
|
|
1040
1214
|
}
|
|
1041
1215
|
return references;
|
|
1042
1216
|
}
|
|
1217
|
+
function applyOpacity(base, opacity) {
|
|
1218
|
+
if (opacity === void 0) return base;
|
|
1219
|
+
const alpha = Number.parseInt(opacity, 10);
|
|
1220
|
+
if (Number.isNaN(alpha)) return base;
|
|
1221
|
+
if (alpha === 0) return "transparent";
|
|
1222
|
+
if (alpha !== 100) return `color-mix(in srgb, ${base} ${alpha}%, transparent)`;
|
|
1223
|
+
return base;
|
|
1224
|
+
}
|
|
1225
|
+
/**
|
|
1226
|
+
* Substitutes `{path}` references in one value from a resolved token map,
|
|
1227
|
+
* whose emitted paths already read `var(--…)`. An unknown path warns and
|
|
1228
|
+
* keeps its literal, as a token's own reference does.
|
|
1229
|
+
*/
|
|
1230
|
+
function resolveValueReferences(value, tokenMap) {
|
|
1231
|
+
if (!value.includes("{")) return value;
|
|
1232
|
+
return value.replace(TOKEN_REF_RE$1, (match) => {
|
|
1233
|
+
const [reference] = parseReferences(match);
|
|
1234
|
+
const target = tokenMap[reference.path];
|
|
1235
|
+
if (target === void 0) {
|
|
1236
|
+
console.warn(`[animus] Token ref {${reference.text}} — path '${reference.path}' not found in token map`);
|
|
1237
|
+
return match;
|
|
1238
|
+
}
|
|
1239
|
+
return applyOpacity(target, reference.opacity);
|
|
1240
|
+
});
|
|
1241
|
+
}
|
|
1043
1242
|
/**
|
|
1044
1243
|
* An unresolvable reference warns and keeps its literal: a kit theme may
|
|
1045
1244
|
* reference tokens its consumer supplies later.
|
|
@@ -1074,14 +1273,7 @@ function resolveReferences(tokenMap, variableMap, variables) {
|
|
|
1074
1273
|
}
|
|
1075
1274
|
const targetVar = variableMap[reference.path];
|
|
1076
1275
|
const targetValue = resolved.get(reference.path);
|
|
1077
|
-
|
|
1078
|
-
if (reference.opacity !== void 0) {
|
|
1079
|
-
const alpha = Number.parseInt(reference.opacity, 10);
|
|
1080
|
-
if (Number.isNaN(alpha)) return base;
|
|
1081
|
-
if (alpha === 0) return "transparent";
|
|
1082
|
-
if (alpha !== 100) return `color-mix(in srgb, ${base} ${alpha}%, transparent)`;
|
|
1083
|
-
}
|
|
1084
|
-
return base;
|
|
1276
|
+
return applyOpacity(targetVar !== void 0 && !targetValue.includes("{") ? `var(${targetVar})` : targetValue, reference.opacity);
|
|
1085
1277
|
};
|
|
1086
1278
|
const resolvePath = (path) => {
|
|
1087
1279
|
const status = state.get(path) ?? UNVISITED;
|
|
@@ -1213,6 +1405,7 @@ const RESERVED_THEME_KEYS = /* @__PURE__ */ new Set([
|
|
|
1213
1405
|
"browserColorScheme",
|
|
1214
1406
|
"modeBases",
|
|
1215
1407
|
"__emitted",
|
|
1408
|
+
"__declarationScales",
|
|
1216
1409
|
"manifest",
|
|
1217
1410
|
"serialize",
|
|
1218
1411
|
"varRef"
|
|
@@ -1317,7 +1510,9 @@ function createState(theme) {
|
|
|
1317
1510
|
extendCount: 0,
|
|
1318
1511
|
inheritedModes: /* @__PURE__ */ new Set(),
|
|
1319
1512
|
inheritedModeAliases: /* @__PURE__ */ new Set(),
|
|
1320
|
-
droppedTokenPaths: /* @__PURE__ */ new Map()
|
|
1513
|
+
droppedTokenPaths: /* @__PURE__ */ new Map(),
|
|
1514
|
+
declarationScales: {},
|
|
1515
|
+
declarationProvenance: /* @__PURE__ */ new Map()
|
|
1321
1516
|
};
|
|
1322
1517
|
}
|
|
1323
1518
|
function copyState(state, nextTheme) {
|
|
@@ -1332,7 +1527,9 @@ function copyState(state, nextTheme) {
|
|
|
1332
1527
|
extendCount: state.extendCount,
|
|
1333
1528
|
inheritedModes: new Set(state.inheritedModes),
|
|
1334
1529
|
inheritedModeAliases: new Set(state.inheritedModeAliases),
|
|
1335
|
-
droppedTokenPaths: new Map(state.droppedTokenPaths)
|
|
1530
|
+
droppedTokenPaths: new Map(state.droppedTokenPaths),
|
|
1531
|
+
declarationScales: { ...state.declarationScales },
|
|
1532
|
+
declarationProvenance: new Map(state.declarationProvenance)
|
|
1336
1533
|
};
|
|
1337
1534
|
for (const [scale, vars] of state.contextualVars) next.contextualVars.set(scale, [...vars]);
|
|
1338
1535
|
return next;
|
|
@@ -1376,6 +1573,20 @@ function plainDataEqual(a, b) {
|
|
|
1376
1573
|
}
|
|
1377
1574
|
return false;
|
|
1378
1575
|
}
|
|
1576
|
+
/** The declaration scales a built theme carries for composition. */
|
|
1577
|
+
function declarationScalesOf(source) {
|
|
1578
|
+
const carried = source?.__declarationScales;
|
|
1579
|
+
return isObject(carried) ? carried : {};
|
|
1580
|
+
}
|
|
1581
|
+
/** Key-level fold: an overlay record replaces the base record whole. */
|
|
1582
|
+
function overlayDeclarationScales(base, overlay) {
|
|
1583
|
+
const result = deepCopyPlain(base);
|
|
1584
|
+
for (const [scale, values] of Object.entries(overlay)) result[scale] = {
|
|
1585
|
+
...result[scale],
|
|
1586
|
+
...deepCopyPlain(values)
|
|
1587
|
+
};
|
|
1588
|
+
return result;
|
|
1589
|
+
}
|
|
1379
1590
|
/**
|
|
1380
1591
|
* Re-seeds emitted scales, contextual vars and the manifest-v2 carry from a
|
|
1381
1592
|
* source manifest — non-enumerable, so key-copy loops never see it.
|
|
@@ -1435,6 +1646,7 @@ var ThemeBuilder = class ThemeBuilder {
|
|
|
1435
1646
|
}
|
|
1436
1647
|
const nextTheme = merge(deepCopyPlain(this._state.theme), deepCopyPlain(raw));
|
|
1437
1648
|
const next = new ThemeBuilder(copyState(this._state, nextTheme));
|
|
1649
|
+
next._state.declarationScales = overlayDeclarationScales(this._state.declarationScales, declarationScalesOf(source));
|
|
1438
1650
|
reseedStateFromManifest(next._state, source.manifest);
|
|
1439
1651
|
return next;
|
|
1440
1652
|
}
|
|
@@ -1478,6 +1690,16 @@ var ThemeBuilder = class ThemeBuilder {
|
|
|
1478
1690
|
const next = new ThemeBuilder(copyState(this._state, nextTheme));
|
|
1479
1691
|
next._state.extendProvenance = provenance;
|
|
1480
1692
|
next._state.extendCount = sourceIndex;
|
|
1693
|
+
const incomingDeclarations = declarationScalesOf(themeHalf);
|
|
1694
|
+
const declarationProvenance = new Map(this._state.declarationProvenance);
|
|
1695
|
+
for (const [scale, values] of Object.entries(incomingDeclarations)) for (const [key, record] of Object.entries(values)) {
|
|
1696
|
+
const path = `${scale}.${key}`;
|
|
1697
|
+
const priorIndex = declarationProvenance.get(path);
|
|
1698
|
+
if (priorIndex === void 0) declarationProvenance.set(path, sourceIndex);
|
|
1699
|
+
else if (!plainDataEqual(this._state.declarationScales[scale]?.[key], record)) throw new Error(`extend: declaration scale '${scale}' key '${key}' is defined divergently by extended theme #${priorIndex} and extended theme #${sourceIndex}. Sibling themes must agree — override intentionally with addDeclarationScale after extend().`);
|
|
1700
|
+
}
|
|
1701
|
+
next._state.declarationScales = overlayDeclarationScales(incomingDeclarations, this._state.declarationScales);
|
|
1702
|
+
next._state.declarationProvenance = declarationProvenance;
|
|
1481
1703
|
if (isObject(raw.modes)) for (const [modeName, modeAliases] of Object.entries(raw.modes)) {
|
|
1482
1704
|
next._state.inheritedModes.add(modeName);
|
|
1483
1705
|
if (!isObject(modeAliases)) continue;
|
|
@@ -1521,6 +1743,7 @@ var ThemeBuilder = class ThemeBuilder {
|
|
|
1521
1743
|
addScale(config) {
|
|
1522
1744
|
const { name, values, emit, replace } = config;
|
|
1523
1745
|
if (RESERVED_THEME_KEYS.has(name)) throw new Error(`addScale: '${name}' is a reserved theme key owned by the builder or built-theme boundary, so a scale by this name cannot survive build(). Choose another scale name.`);
|
|
1746
|
+
if (name in this._state.declarationScales) throw new Error(`addScale: '${name}' is already a declaration scale — a scale is either scalar or declaration-valued.`);
|
|
1524
1747
|
const prior = this._state.theme[name];
|
|
1525
1748
|
let nextTheme;
|
|
1526
1749
|
if (replace) {
|
|
@@ -1535,6 +1758,27 @@ var ThemeBuilder = class ThemeBuilder {
|
|
|
1535
1758
|
}
|
|
1536
1759
|
return next;
|
|
1537
1760
|
}
|
|
1761
|
+
/**
|
|
1762
|
+
* Registers a finite declaration scale: each key maps to a flat record of
|
|
1763
|
+
* CSS declarations, and every record sets the same members. Bind it with a
|
|
1764
|
+
* `{ kind: 'declarations', scale, members }` system or component prop. Keys merge by
|
|
1765
|
+
* record; `replace` makes the scale exactly these keys.
|
|
1766
|
+
*/
|
|
1767
|
+
addDeclarationScale(config) {
|
|
1768
|
+
const { name, values, replace } = config;
|
|
1769
|
+
const label = "addDeclarationScale";
|
|
1770
|
+
if (RESERVED_THEME_KEYS.has(name)) throw new Error(`${label}: '${name}' is a reserved theme key owned by the builder or built-theme boundary. Choose another scale name.`);
|
|
1771
|
+
if (name in this._state.theme) throw new Error(`${label}: '${name}' is already a scalar scale — a scale is either scalar or declaration-valued.`);
|
|
1772
|
+
const records = validateDeclarationRecords(label, name, values);
|
|
1773
|
+
const next = new ThemeBuilder(copyState(this._state, this._state.theme));
|
|
1774
|
+
const merged = replace ? records : {
|
|
1775
|
+
...next._state.declarationScales[name],
|
|
1776
|
+
...records
|
|
1777
|
+
};
|
|
1778
|
+
assertUniformMembers(label, name, merged);
|
|
1779
|
+
next._state.declarationScales[name] = merged;
|
|
1780
|
+
return next;
|
|
1781
|
+
}
|
|
1538
1782
|
declareContextualVars(vars, registrations) {
|
|
1539
1783
|
for (const scale of Object.keys(vars)) if (!(scale in this._state.theme)) throw new Error(`declareContextualVars: scale '${scale}' not found — call addColors or addScale first`);
|
|
1540
1784
|
const next = new ThemeBuilder(copyState(this._state, this._state.theme));
|
|
@@ -1575,6 +1819,8 @@ var ThemeBuilder = class ThemeBuilder {
|
|
|
1575
1819
|
const { tokenMap: flatTokenMap, variableMap, variables: flatVariables, tokenDefinitions } = flattenTheme(theme, emittedScales, effectiveModes);
|
|
1576
1820
|
assertNoDroppedReferences(tokenDefinitions, flatTokenMap, this._state.droppedTokenPaths, this._state.extendProvenance);
|
|
1577
1821
|
const { tokenMap, variables } = resolveReferences(flatTokenMap, variableMap, flatVariables);
|
|
1822
|
+
const declarationScales = this._state.declarationScales;
|
|
1823
|
+
const resolvedDeclarationScales = resolveDeclarationScales(declarationScales, theme, tokenMap);
|
|
1578
1824
|
const { modeVariables, modeTokens } = resolveModeValueMaps(effectiveModes, variableMap, variables, tokenMap);
|
|
1579
1825
|
const bpVariables = {};
|
|
1580
1826
|
if (theme.breakpoints && isObject(theme.breakpoints)) {
|
|
@@ -1649,12 +1895,20 @@ var ThemeBuilder = class ThemeBuilder {
|
|
|
1649
1895
|
configurable: false,
|
|
1650
1896
|
writable: false
|
|
1651
1897
|
});
|
|
1898
|
+
Object.defineProperty(theme, "__declarationScales", {
|
|
1899
|
+
value: deepCopyPlain(declarationScales),
|
|
1900
|
+
enumerable: false,
|
|
1901
|
+
configurable: false,
|
|
1902
|
+
writable: false
|
|
1903
|
+
});
|
|
1904
|
+
const declarationScalesJson = resolvedDeclarationScales ? JSON.stringify(resolvedDeclarationScales) : void 0;
|
|
1652
1905
|
Object.defineProperty(theme, "serialize", {
|
|
1653
1906
|
value: () => ({
|
|
1654
1907
|
scalesJson: JSON.stringify(manifest.tokenMap),
|
|
1655
1908
|
variableMapJson: JSON.stringify(manifest.variableMap),
|
|
1656
1909
|
variableCss: manifest.variableCss,
|
|
1657
|
-
contextualVarsJson: JSON.stringify(manifest.contextualVars ?? {})
|
|
1910
|
+
contextualVarsJson: JSON.stringify(manifest.contextualVars ?? {}),
|
|
1911
|
+
...declarationScalesJson ? { declarationScalesJson } : {}
|
|
1658
1912
|
}),
|
|
1659
1913
|
enumerable: false,
|
|
1660
1914
|
configurable: false,
|
|
@@ -1683,6 +1937,32 @@ var ThemeBuilder = class ThemeBuilder {
|
|
|
1683
1937
|
function createTheme() {
|
|
1684
1938
|
return new ThemeBuilder(createState());
|
|
1685
1939
|
}
|
|
1940
|
+
/**
|
|
1941
|
+
* The effective declaration scales in serialized order, token references
|
|
1942
|
+
* resolved against the final token map; `undefined` when there are none.
|
|
1943
|
+
*/
|
|
1944
|
+
function resolveDeclarationScales(declarationScales, theme, tokenMap) {
|
|
1945
|
+
const names = Object.keys(declarationScales).sort();
|
|
1946
|
+
if (names.length === 0) return void 0;
|
|
1947
|
+
const serialized = {};
|
|
1948
|
+
for (const name of names) {
|
|
1949
|
+
if (name in theme) throw new Error(`build: '${name}' is both a scalar scale and a declaration scale — a scale is either scalar or declaration-valued.`);
|
|
1950
|
+
const values = declarationScales[name];
|
|
1951
|
+
assertUniformMembers("build", name, values);
|
|
1952
|
+
const resolved = {};
|
|
1953
|
+
for (const key of Object.keys(values).sort()) {
|
|
1954
|
+
const record = values[key];
|
|
1955
|
+
resolved[key] = sortRecordByKey(Object.fromEntries(Object.entries(record).map(([member, value]) => [member, typeof value === "string" ? resolveValueReferences(value, tokenMap) : value])));
|
|
1956
|
+
}
|
|
1957
|
+
const [firstKey] = Object.keys(resolved);
|
|
1958
|
+
serialized[name] = {
|
|
1959
|
+
kind: "declarations",
|
|
1960
|
+
members: Object.keys(resolved[firstKey]),
|
|
1961
|
+
values: resolved
|
|
1962
|
+
};
|
|
1963
|
+
}
|
|
1964
|
+
return serialized;
|
|
1965
|
+
}
|
|
1686
1966
|
/** Authored token reference: `{scale.key}` or `{scale.key/opacity}`. */
|
|
1687
1967
|
const TOKEN_REF_RE = /\{([^}]+)\}/g;
|
|
1688
1968
|
/**
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -3,9 +3,11 @@ import { type ClassResolverConfig, type DynamicPropConfig, type SystemPropMap }
|
|
|
3
3
|
interface ComponentConfig extends ClassResolverConfig {
|
|
4
4
|
}
|
|
5
5
|
type ElementType = string | React.ComponentType<any>;
|
|
6
|
+
type Transform = NonNullable<DynamicPropConfig[string]['transform']>;
|
|
6
7
|
type AnimusComponent = ReturnType<typeof forwardRef> & {
|
|
7
8
|
extend: () => never;
|
|
8
9
|
variantDefaults: Readonly<Record<string, string>>;
|
|
10
|
+
customTransforms: Readonly<Record<string, Transform>>;
|
|
9
11
|
};
|
|
10
12
|
export declare function createComponent(element: ElementType, className: string, config: ComponentConfig, systemPropMap?: SystemPropMap, dynamicPropConfig?: DynamicPropConfig): AnimusComponent;
|
|
11
13
|
export {};
|
|
@@ -1 +1 @@
|
|
|
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;AAExD,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;IACpB,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;
|
|
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;AAExD,KAAK,WAAW,GAAG,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;AAErD,KAAK,SAAS,GAAG,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;AAErE,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,GAAG;IACrD,MAAM,EAAE,MAAM,KAAK,CAAC;IACpB,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAClD,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;CACvD,CAAC;AAwHF,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,CA4EjB"}
|
|
@@ -13,17 +13,43 @@ export interface ClassResolverConfig {
|
|
|
13
13
|
systemPropNames?: string[];
|
|
14
14
|
customPropMap?: Record<string, Record<string, string>>;
|
|
15
15
|
customDynamicConfig?: DynamicPropConfig;
|
|
16
|
+
/** Callback props whose `customPropMap` keys are `typedValueKey`s. */
|
|
17
|
+
typedCustomProps?: readonly string[];
|
|
18
|
+
/** System props bound to a configured transform, whose `systemPropMap`
|
|
19
|
+
* keys are `typedValueKey`s. */
|
|
20
|
+
typedSystemProps?: readonly string[];
|
|
16
21
|
}
|
|
17
22
|
export type SystemPropMap = Record<string, Record<string, string>>;
|
|
18
|
-
|
|
23
|
+
interface ValueDynamicPropConfig {
|
|
19
24
|
varName: string;
|
|
20
25
|
slotClass: string;
|
|
21
26
|
property?: string;
|
|
22
27
|
properties?: readonly string[];
|
|
28
|
+
/** The bound transform's readable name, for diagnostics. */
|
|
23
29
|
transformName?: string;
|
|
30
|
+
/** The bound definition's key in the generated `transforms` registry. */
|
|
31
|
+
transformId?: string;
|
|
24
32
|
transform?: (value: string | number) => string | number;
|
|
25
|
-
scaleValues?: Record<string, string>;
|
|
26
|
-
|
|
33
|
+
scaleValues?: Record<string, string | number>;
|
|
34
|
+
negative?: boolean;
|
|
35
|
+
/** Values outside `scaleValues` are dropped, not applied raw. */
|
|
36
|
+
strict?: boolean;
|
|
37
|
+
/** The keywords a strict prop admits beside its tokens. */
|
|
38
|
+
keywords?: readonly string[];
|
|
39
|
+
kind?: never;
|
|
40
|
+
}
|
|
41
|
+
interface DeclarationDynamicPropConfig {
|
|
42
|
+
kind: 'declarations';
|
|
43
|
+
slotClass: string;
|
|
44
|
+
/** Member property → its variable; a breakpoint appends `-{bp}`. */
|
|
45
|
+
memberVars: Record<string, string>;
|
|
46
|
+
/** Scale key → member property → resolved CSS value. */
|
|
47
|
+
declarationScaleValues: Record<string, Record<string, string>>;
|
|
48
|
+
}
|
|
49
|
+
type DeclarationConfig = DeclarationDynamicPropConfig & {
|
|
50
|
+
[K in Exclude<keyof ValueDynamicPropConfig, 'kind' | 'slotClass'>]?: never;
|
|
51
|
+
};
|
|
52
|
+
export type DynamicPropConfig = Record<string, ValueDynamicPropConfig | DeclarationConfig>;
|
|
27
53
|
/**
|
|
28
54
|
* A mixed property set resolves to unitless: a bare number on a length
|
|
29
55
|
* property is dropped by the parser, `px` on a unitless one shifts layout.
|
|
@@ -39,11 +65,12 @@ export declare function serializeValueKey(value: unknown): string;
|
|
|
39
65
|
* or finite number passed here is mislabeled.
|
|
40
66
|
*/
|
|
41
67
|
export declare function describeResultShape(result: unknown): string;
|
|
68
|
+
type DynamicEntryConfig = Pick<ValueDynamicPropConfig, 'varName' | 'property' | 'properties' | 'transform' | 'scaleValues' | 'negative' | 'strict' | 'keywords'>;
|
|
42
69
|
/**
|
|
43
|
-
* `null` means
|
|
44
|
-
*
|
|
70
|
+
* `null` means the value missed a strict scale, or a configured transform
|
|
71
|
+
* threw or returned neither a string nor a finite number.
|
|
45
72
|
*/
|
|
46
|
-
export declare function resolveValue(value: unknown, dc:
|
|
73
|
+
export declare function resolveValue(value: unknown, dc: DynamicEntryConfig): string | null;
|
|
47
74
|
export interface ClassResolution {
|
|
48
75
|
classes: string[];
|
|
49
76
|
dynamicStyle?: Record<string, string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveClasses.d.ts","sourceRoot":"","sources":["../../src/runtime/resolveClasses.ts"],"names":[],"mappings":"AAAA,UAAU,aAAa;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,cAAc;IACtB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IAC9C,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACzC,SAAS,CAAC,EAAE,cAAc,EAAE,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACvD,mBAAmB,CAAC,EAAE,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"resolveClasses.d.ts","sourceRoot":"","sources":["../../src/runtime/resolveClasses.ts"],"names":[],"mappings":"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"}
|
package/dist/runtime-entry.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as createClassResolver } from "./createClassResolver-
|
|
2
|
-
import { n as createComponent, t as createComposedFamily } from "./createComposedFamily-
|
|
1
|
+
import { t as createClassResolver } from "./createClassResolver-CcCgar2Z.js";
|
|
2
|
+
import { n as createComponent, t as createComposedFamily } from "./createComposedFamily-C9ShrVy6.js";
|
|
3
3
|
export { createClassResolver, createComponent, createComposedFamily };
|