@almadar/ui 6.59.0 → 6.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BehaviorValueFrame-3ORZHPWQ.css +1252 -0
- package/dist/BehaviorValueFrame-QTD7BWOI.js +18 -0
- package/dist/TraitValueFrame-2WMYJOA5.css +1252 -0
- package/dist/TraitValueFrame-WOXNLLMM.js +17 -0
- package/dist/Typography-BY4A2NBY.js +5 -0
- package/dist/{UISlotRenderer-YNY7V2UJ.js → UISlotRenderer-EEOXSJCI.js} +10 -8
- package/dist/avl/index.cjs +31974 -27856
- package/dist/avl/index.d.ts +36 -13
- package/dist/avl/index.js +296 -6128
- package/dist/{avl-3d-context-BpBKZIbc.d.ts → avl-3d-context-Dxun3-ri.d.ts} +2 -0
- package/dist/{chunk-E6MWYQVZ.js → chunk-6PV4LASE.js} +9493 -641
- package/dist/{chunk-723MJUU3.js → chunk-6ZCU3BQN.js} +1 -1
- package/dist/{chunk-7CVXM2KS.js → chunk-7NIU5GDC.js} +2 -2
- package/dist/{chunk-YYYHH5BA.js → chunk-CB64IOYD.js} +0 -4
- package/dist/{chunk-MZIDOJMD.js → chunk-EIIQGOZW.js} +2 -1
- package/dist/chunk-F7NZ3KZQ.js +434 -0
- package/dist/{chunk-LZRW6GXG.js → chunk-FYX64CDL.js} +0 -2
- package/dist/{chunk-4ZGXIW3B.js → chunk-KZRAMPM6.js} +1 -1
- package/dist/chunk-LUREMDI3.js +49 -0
- package/dist/{chunk-J755QADM.js → chunk-MGN6B6OQ.js} +318 -18
- package/dist/{chunk-Q47ZN2DW.js → chunk-N23SVGTH.js} +83 -1
- package/dist/{chunk-KJGVLXEN.js → chunk-N4IJS5DD.js} +50 -116
- package/dist/{chunk-I5QOYW2Z.js → chunk-UTSDPJUP.js} +205 -2
- package/dist/{chunk-V3FGTQUE.js → chunk-ZR45FGW3.js} +7 -1
- package/dist/{cn-DIql5232.d.ts → cn-CDIhHCUC.d.ts} +40 -16
- package/dist/components/index.cjs +14423 -4100
- package/dist/components/index.d.ts +160 -172
- package/dist/components/index.js +14 -15
- package/dist/context/index.cjs +9 -1
- package/dist/context/index.js +3 -1
- package/dist/hooks/index.cjs +72 -6
- package/dist/hooks/index.d.ts +43 -2
- package/dist/hooks/index.js +6 -7
- package/dist/lib/drawable/three/index.cjs +350 -26
- package/dist/lib/drawable/three/index.d.ts +2 -2
- package/dist/lib/drawable/three/index.js +28 -7
- package/dist/lib/index.cjs +90 -4
- package/dist/lib/index.d.ts +2 -2
- package/dist/lib/index.js +74 -6
- package/dist/locales/index.cjs +0 -6
- package/dist/locales/index.js +2 -2
- package/dist/providers/index.cjs +13846 -1062
- package/dist/providers/index.d.ts +36 -4
- package/dist/providers/index.js +35 -15
- package/dist/runtime/index.cjs +28395 -18308
- package/dist/runtime/index.d.ts +65 -3
- package/dist/runtime/index.js +13 -379
- package/dist/ssr/index.cjs +506 -133
- package/dist/ssr/index.d.cts +56 -4
- package/dist/ssr/index.d.ts +56 -4
- package/dist/ssr/index.js +444 -71
- package/dist/{verificationRegistry-B3dj1Zl8.d.ts → verificationRegistry-B5aGl7WF.d.ts} +2 -1
- package/locales/ar.json +0 -2
- package/locales/en.json +0 -2
- package/locales/sl.json +0 -2
- package/package.json +7 -7
- package/tailwind-preset.cjs +78 -8
- package/themes/_contract.md +6 -0
- package/themes/_fonts.css +4 -4
- package/themes/_foundation.css +11 -0
- package/themes/_presets.css +2 -0
- package/themes/almadar-website.css +10 -0
- package/themes/almadar.css +10 -0
- package/themes/atelier.css +10 -0
- package/themes/bauhaus.css +10 -0
- package/themes/bloomberg-dense.css +10 -0
- package/themes/clay.css +10 -0
- package/themes/corporate.css +10 -0
- package/themes/gazette.css +10 -0
- package/themes/glass.css +10 -0
- package/themes/kflow.css +5 -0
- package/themes/kiosk.css +10 -0
- package/themes/linear-clean.css +10 -0
- package/themes/material.css +10 -0
- package/themes/minimalist.css +10 -0
- package/themes/nata.css +304 -0
- package/themes/neon.css +10 -0
- package/themes/notion-editorial.css +10 -0
- package/themes/orb.css +10 -0
- package/themes/prism.css +10 -0
- package/themes/rawi.css +304 -0
- package/themes/retro.css +10 -0
- package/themes/risograph.css +10 -0
- package/themes/scandi.css +10 -0
- package/themes/solarpunk.css +10 -0
- package/themes/terminal.css +138 -128
- package/dist/Typography-LZTP72Y4.js +0 -5
- package/dist/chunk-D2E44ODB.js +0 -350
- package/dist/chunk-N7JIG57B.js +0 -138
- package/dist/chunk-QJIAJ6EH.js +0 -2256
package/dist/chunk-D2E44ODB.js
DELETED
|
@@ -1,350 +0,0 @@
|
|
|
1
|
-
// lib/design-classes.ts
|
|
2
|
-
var DESIGN_COLOR_TOKENS = [
|
|
3
|
-
"primary",
|
|
4
|
-
"primary-foreground",
|
|
5
|
-
"primary-hover",
|
|
6
|
-
"secondary",
|
|
7
|
-
"secondary-foreground",
|
|
8
|
-
"secondary-hover",
|
|
9
|
-
"muted",
|
|
10
|
-
"muted-foreground",
|
|
11
|
-
"accent",
|
|
12
|
-
"accent-foreground",
|
|
13
|
-
"background",
|
|
14
|
-
"foreground",
|
|
15
|
-
"card",
|
|
16
|
-
"card-foreground",
|
|
17
|
-
"surface",
|
|
18
|
-
"border",
|
|
19
|
-
"input",
|
|
20
|
-
"ring",
|
|
21
|
-
"error",
|
|
22
|
-
"error-foreground",
|
|
23
|
-
"success",
|
|
24
|
-
"success-foreground",
|
|
25
|
-
"warning",
|
|
26
|
-
"warning-foreground",
|
|
27
|
-
"info",
|
|
28
|
-
"info-foreground"
|
|
29
|
-
];
|
|
30
|
-
var DESIGN_COLOR_UTILITIES = ["bg", "text", "border"];
|
|
31
|
-
var DESIGN_RADIUS_TOKENS = ["none", "sm", "md", "lg", "xl", "full"];
|
|
32
|
-
var DESIGN_SPACING_SCALE = [
|
|
33
|
-
0,
|
|
34
|
-
0.5,
|
|
35
|
-
1,
|
|
36
|
-
1.5,
|
|
37
|
-
2,
|
|
38
|
-
2.5,
|
|
39
|
-
3,
|
|
40
|
-
3.5,
|
|
41
|
-
4,
|
|
42
|
-
5,
|
|
43
|
-
6,
|
|
44
|
-
7,
|
|
45
|
-
8,
|
|
46
|
-
9,
|
|
47
|
-
10,
|
|
48
|
-
11,
|
|
49
|
-
12,
|
|
50
|
-
14,
|
|
51
|
-
16,
|
|
52
|
-
20,
|
|
53
|
-
24,
|
|
54
|
-
28,
|
|
55
|
-
32,
|
|
56
|
-
36,
|
|
57
|
-
40,
|
|
58
|
-
44,
|
|
59
|
-
48,
|
|
60
|
-
52,
|
|
61
|
-
56,
|
|
62
|
-
60,
|
|
63
|
-
64,
|
|
64
|
-
72,
|
|
65
|
-
80,
|
|
66
|
-
96
|
|
67
|
-
];
|
|
68
|
-
var DESIGN_SPACING_UTILITIES = [
|
|
69
|
-
"w",
|
|
70
|
-
"h",
|
|
71
|
-
"min-w",
|
|
72
|
-
"max-w",
|
|
73
|
-
"min-h",
|
|
74
|
-
"max-h",
|
|
75
|
-
"p",
|
|
76
|
-
"px",
|
|
77
|
-
"py",
|
|
78
|
-
"pt",
|
|
79
|
-
"pr",
|
|
80
|
-
"pb",
|
|
81
|
-
"pl",
|
|
82
|
-
"m",
|
|
83
|
-
"mx",
|
|
84
|
-
"my",
|
|
85
|
-
"gap"
|
|
86
|
-
];
|
|
87
|
-
var DESIGN_SPACING_STEP_PX = 4;
|
|
88
|
-
var defaultSpacingStepPx = (step) => step * DESIGN_SPACING_STEP_PX;
|
|
89
|
-
var DESIGN_SPACING_TOKEN_STEPS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
|
|
90
|
-
function spacingTokenOf(step) {
|
|
91
|
-
return DESIGN_SPACING_TOKEN_STEPS.includes(step) ? `--space-${step}` : null;
|
|
92
|
-
}
|
|
93
|
-
function snapToSpacingStep(px, pxOf = defaultSpacingStepPx) {
|
|
94
|
-
const target = Math.max(0, px);
|
|
95
|
-
let best = DESIGN_SPACING_SCALE[0];
|
|
96
|
-
for (const step of DESIGN_SPACING_SCALE) {
|
|
97
|
-
const d = Math.abs(pxOf(step) - target);
|
|
98
|
-
const bestD = Math.abs(pxOf(best) - target);
|
|
99
|
-
if (d < bestD || d === bestD && spacingTokenOf(step) !== null && spacingTokenOf(best) === null) best = step;
|
|
100
|
-
}
|
|
101
|
-
return best;
|
|
102
|
-
}
|
|
103
|
-
var SPACING_STEP_BY_TEXT = new Map(
|
|
104
|
-
DESIGN_SPACING_SCALE.map((step) => [String(step), step])
|
|
105
|
-
);
|
|
106
|
-
function stepOf(className, utility) {
|
|
107
|
-
if (!className.startsWith(`${utility}-`)) return void 0;
|
|
108
|
-
return SPACING_STEP_BY_TEXT.get(className.slice(utility.length + 1));
|
|
109
|
-
}
|
|
110
|
-
function isAxisSizeClass(className, axis) {
|
|
111
|
-
return className.startsWith(`${axis}-`);
|
|
112
|
-
}
|
|
113
|
-
function sizingOf(classes, axis) {
|
|
114
|
-
for (const c of classes) {
|
|
115
|
-
if (c === `${axis}-full`) return { mode: "fill" };
|
|
116
|
-
if (c === `${axis}-fit`) return { mode: "hug" };
|
|
117
|
-
const step = stepOf(c, axis);
|
|
118
|
-
if (step !== void 0) return { mode: "fixed", step };
|
|
119
|
-
}
|
|
120
|
-
return { mode: "hug" };
|
|
121
|
-
}
|
|
122
|
-
function withSizing(classes, axis, sizing) {
|
|
123
|
-
const kept = classes.filter((c) => !isAxisSizeClass(c, axis));
|
|
124
|
-
const next = sizing.mode === "fixed" ? `${axis}-${sizing.step}` : sizing.mode === "hug" ? `${axis}-fit` : `${axis}-full`;
|
|
125
|
-
return [...kept, next];
|
|
126
|
-
}
|
|
127
|
-
function sizeLimitOf(classes, axis, limit) {
|
|
128
|
-
for (const c of classes) {
|
|
129
|
-
const step = stepOf(c, `${limit}-${axis}`);
|
|
130
|
-
if (step !== void 0) return step;
|
|
131
|
-
}
|
|
132
|
-
return null;
|
|
133
|
-
}
|
|
134
|
-
function withSizeLimit(classes, axis, limit, step) {
|
|
135
|
-
const kept = classes.filter((c) => !c.startsWith(`${limit}-${axis}-`));
|
|
136
|
-
return step === null ? kept : [...kept, `${limit}-${axis}-${step}`];
|
|
137
|
-
}
|
|
138
|
-
var PADDING_UTILITIES = ["p", "px", "py", "pt", "pr", "pb", "pl"];
|
|
139
|
-
function isSpacingClass(className) {
|
|
140
|
-
return stepOf(className, "gap") !== void 0 || PADDING_UTILITIES.some((u) => stepOf(className, u) !== void 0);
|
|
141
|
-
}
|
|
142
|
-
function spacingOf(classes) {
|
|
143
|
-
const find = (utility) => {
|
|
144
|
-
for (const c of classes) {
|
|
145
|
-
const step = stepOf(c, utility);
|
|
146
|
-
if (step !== void 0) return step;
|
|
147
|
-
}
|
|
148
|
-
return void 0;
|
|
149
|
-
};
|
|
150
|
-
const all = find("p") ?? 0;
|
|
151
|
-
const x = find("px") ?? all;
|
|
152
|
-
const y = find("py") ?? all;
|
|
153
|
-
return {
|
|
154
|
-
gap: find("gap") ?? 0,
|
|
155
|
-
top: find("pt") ?? y,
|
|
156
|
-
right: find("pr") ?? x,
|
|
157
|
-
bottom: find("pb") ?? y,
|
|
158
|
-
left: find("pl") ?? x
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
function withSpacing(classes, change) {
|
|
162
|
-
const next = { ...spacingOf(classes), ...change };
|
|
163
|
-
const kept = classes.filter((c) => !isSpacingClass(c));
|
|
164
|
-
const out = [...kept];
|
|
165
|
-
if (next.gap !== 0) out.push(`gap-${next.gap}`);
|
|
166
|
-
const { top, right, bottom, left } = next;
|
|
167
|
-
if (top === right && right === bottom && bottom === left) {
|
|
168
|
-
if (top !== 0) out.push(`p-${top}`);
|
|
169
|
-
} else if (top === bottom && left === right) {
|
|
170
|
-
out.push(`px-${left}`, `py-${top}`);
|
|
171
|
-
} else {
|
|
172
|
-
out.push(`pt-${top}`, `pr-${right}`, `pb-${bottom}`, `pl-${left}`);
|
|
173
|
-
}
|
|
174
|
-
return out;
|
|
175
|
-
}
|
|
176
|
-
var DIRECTION_CLASSES = ["flex-row", "flex-row-reverse", "flex-col", "flex-col-reverse"];
|
|
177
|
-
var ALIGNMENTS = ["start", "center", "end"];
|
|
178
|
-
var JUSTIFIES = [...ALIGNMENTS, "between"];
|
|
179
|
-
var WRAP_CLASSES = ["flex-wrap", "flex-nowrap", "flex-wrap-reverse"];
|
|
180
|
-
function firstOf(classes, utility, values) {
|
|
181
|
-
for (const c of classes) {
|
|
182
|
-
for (const v of values) if (c === `${utility}-${v}`) return v;
|
|
183
|
-
}
|
|
184
|
-
return null;
|
|
185
|
-
}
|
|
186
|
-
function layoutOf(classes) {
|
|
187
|
-
const direction = classes.find((c) => DIRECTION_CLASSES.includes(c));
|
|
188
|
-
return {
|
|
189
|
-
direction: direction === void 0 ? null : direction.startsWith("flex-row") ? "horizontal" : "vertical",
|
|
190
|
-
align: firstOf(classes, "items", ALIGNMENTS),
|
|
191
|
-
justify: firstOf(classes, "justify", JUSTIFIES),
|
|
192
|
-
wrap: classes.includes("flex-wrap")
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
function withLayout(classes, change) {
|
|
196
|
-
let next = [...classes];
|
|
197
|
-
if (change.direction) {
|
|
198
|
-
next = next.filter((c) => !DIRECTION_CLASSES.includes(c));
|
|
199
|
-
next.push(change.direction === "horizontal" ? "flex-row" : "flex-col");
|
|
200
|
-
}
|
|
201
|
-
if (change.align) {
|
|
202
|
-
next = next.filter((c) => !c.startsWith("items-"));
|
|
203
|
-
next.push(`items-${change.align}`);
|
|
204
|
-
}
|
|
205
|
-
if (change.justify) {
|
|
206
|
-
next = next.filter((c) => !c.startsWith("justify-"));
|
|
207
|
-
next.push(`justify-${change.justify}`);
|
|
208
|
-
}
|
|
209
|
-
if (change.wrap !== void 0) {
|
|
210
|
-
next = next.filter((c) => !WRAP_CLASSES.includes(c));
|
|
211
|
-
if (change.wrap) next.push("flex-wrap");
|
|
212
|
-
}
|
|
213
|
-
return next;
|
|
214
|
-
}
|
|
215
|
-
var AXIS_SIDES = { x: ["left", "right"], y: ["top", "bottom"] };
|
|
216
|
-
var CENTER_CLASSES = { x: ["left-1/2", "-translate-x-1/2"], y: ["top-1/2", "-translate-y-1/2"] };
|
|
217
|
-
function offsetOf(classes, side) {
|
|
218
|
-
for (const c of classes) {
|
|
219
|
-
if (!c.startsWith(`${side}-`)) continue;
|
|
220
|
-
const step = stepOf(c, side);
|
|
221
|
-
if (step !== void 0) return { value: defaultSpacingStepPx(step), unit: "px" };
|
|
222
|
-
const m = /^\[(-?\d+(?:\.\d+)?)(px|%)\]$/.exec(c.slice(side.length + 1));
|
|
223
|
-
if (m) return { value: Number(m[1]), unit: m[2] === "%" ? "%" : "px" };
|
|
224
|
-
}
|
|
225
|
-
return null;
|
|
226
|
-
}
|
|
227
|
-
function centerOffsetOf(classes, side) {
|
|
228
|
-
for (const c of classes) {
|
|
229
|
-
if (c === `${side}-1/2`) return 0;
|
|
230
|
-
const m = new RegExp(`^${side}-\\[calc\\(50%([+-])(\\d+(?:\\.\\d+)?)px\\)\\]$`).exec(c);
|
|
231
|
-
if (m) return (m[1] === "-" ? -1 : 1) * Number(m[2]);
|
|
232
|
-
}
|
|
233
|
-
return null;
|
|
234
|
-
}
|
|
235
|
-
function axisPositionOf(classes, axis) {
|
|
236
|
-
const [startSide, endSide] = AXIS_SIDES[axis];
|
|
237
|
-
const center = centerOffsetOf(classes, startSide);
|
|
238
|
-
if (center !== null && classes.includes(CENTER_CLASSES[axis][1])) return { constraint: "center", start: center, end: 0 };
|
|
239
|
-
const start = offsetOf(classes, startSide);
|
|
240
|
-
const end = offsetOf(classes, endSide);
|
|
241
|
-
if (start?.unit === "%" || end?.unit === "%") {
|
|
242
|
-
return { constraint: "scale", start: start?.value ?? 0, end: end?.value ?? 0 };
|
|
243
|
-
}
|
|
244
|
-
if (start && end) return { constraint: "both", start: start.value, end: end.value };
|
|
245
|
-
if (end) return { constraint: "end", start: 0, end: end.value };
|
|
246
|
-
return { constraint: "start", start: start?.value ?? 0, end: 0 };
|
|
247
|
-
}
|
|
248
|
-
function positionOf(classes) {
|
|
249
|
-
return {
|
|
250
|
-
absolute: classes.includes("absolute"),
|
|
251
|
-
x: axisPositionOf(classes, "x"),
|
|
252
|
-
y: axisPositionOf(classes, "y")
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
function isPositionClass(className) {
|
|
256
|
-
if (className === "absolute") return true;
|
|
257
|
-
if (CENTER_CLASSES.x.some((c) => c === className) || CENTER_CLASSES.y.some((c) => c === className)) return true;
|
|
258
|
-
return [...AXIS_SIDES.x, ...AXIS_SIDES.y].some((side) => className.startsWith(`${side}-`));
|
|
259
|
-
}
|
|
260
|
-
function offsetClass(side, value, unit) {
|
|
261
|
-
const rounded = unit === "%" ? Math.round(value * 10) / 10 : Math.round(value);
|
|
262
|
-
return rounded === 0 ? `${side}-0` : `${side}-[${rounded}${unit}]`;
|
|
263
|
-
}
|
|
264
|
-
function axisClasses(axis, p) {
|
|
265
|
-
const [startSide, endSide] = AXIS_SIDES[axis];
|
|
266
|
-
switch (p.constraint) {
|
|
267
|
-
case "center": {
|
|
268
|
-
const offset = Math.round(p.start);
|
|
269
|
-
const pin = offset === 0 ? CENTER_CLASSES[axis][0] : `${startSide}-[calc(50%${offset < 0 ? "-" : "+"}${Math.abs(offset)}px)]`;
|
|
270
|
-
return [pin, CENTER_CLASSES[axis][1]];
|
|
271
|
-
}
|
|
272
|
-
case "end":
|
|
273
|
-
return [offsetClass(endSide, p.end, "px")];
|
|
274
|
-
case "both":
|
|
275
|
-
return [offsetClass(startSide, p.start, "px"), offsetClass(endSide, p.end, "px")];
|
|
276
|
-
case "scale":
|
|
277
|
-
return [offsetClass(startSide, p.start, "%"), offsetClass(endSide, p.end, "%")];
|
|
278
|
-
case "start":
|
|
279
|
-
return [offsetClass(startSide, p.start, "px")];
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
function withPosition(classes, position) {
|
|
283
|
-
const kept = classes.filter((c) => !isPositionClass(c));
|
|
284
|
-
if (!position.absolute) return kept;
|
|
285
|
-
return [...kept, "absolute", ...axisClasses("x", position.x), ...axisClasses("y", position.y)];
|
|
286
|
-
}
|
|
287
|
-
var COLOR_TOKEN_SET = new Set(DESIGN_COLOR_TOKENS);
|
|
288
|
-
var RADIUS_TOKEN_SET = new Set(DESIGN_RADIUS_TOKENS);
|
|
289
|
-
function isColorToken(value) {
|
|
290
|
-
return COLOR_TOKEN_SET.has(value);
|
|
291
|
-
}
|
|
292
|
-
function isRadiusToken(value) {
|
|
293
|
-
return RADIUS_TOKEN_SET.has(value);
|
|
294
|
-
}
|
|
295
|
-
function tokenOfDesignClass(className) {
|
|
296
|
-
const base = className.slice(className.lastIndexOf(":") + 1);
|
|
297
|
-
if (base.startsWith("rounded-")) {
|
|
298
|
-
const key = base.slice("rounded-".length);
|
|
299
|
-
return isRadiusToken(key) ? { group: "radii", key } : null;
|
|
300
|
-
}
|
|
301
|
-
for (const utility of DESIGN_COLOR_UTILITIES) {
|
|
302
|
-
const prefix = `${utility}-`;
|
|
303
|
-
if (!base.startsWith(prefix)) continue;
|
|
304
|
-
const key = base.slice(prefix.length);
|
|
305
|
-
if (isColorToken(key)) return { group: "colors", key };
|
|
306
|
-
}
|
|
307
|
-
for (const utility of DESIGN_SPACING_UTILITIES) {
|
|
308
|
-
const step = stepOf(base, utility);
|
|
309
|
-
if (step !== void 0 && spacingTokenOf(step) !== null) return { group: "spacing", key: String(step) };
|
|
310
|
-
}
|
|
311
|
-
return null;
|
|
312
|
-
}
|
|
313
|
-
function isArbitraryClass(className) {
|
|
314
|
-
return /^[a-z0-9:@/-]*-\[[^\]\s]+\]$/i.test(className);
|
|
315
|
-
}
|
|
316
|
-
function collectClasses(value, found) {
|
|
317
|
-
if (Array.isArray(value)) {
|
|
318
|
-
for (const item of value) collectClasses(item, found);
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
|
-
if (value === null || typeof value !== "object") return;
|
|
322
|
-
for (const [key, child] of Object.entries(value)) {
|
|
323
|
-
if (key === "className" && typeof child === "string") {
|
|
324
|
-
for (const cls of child.split(/\s+/)) if (cls && isArbitraryClass(cls)) found.add(cls);
|
|
325
|
-
} else {
|
|
326
|
-
collectClasses(child, found);
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
function classesOfPart(part) {
|
|
331
|
-
const found = /* @__PURE__ */ new Set();
|
|
332
|
-
collectClasses(JSON.parse(JSON.stringify(part)), found);
|
|
333
|
-
return [...found];
|
|
334
|
-
}
|
|
335
|
-
var classesByOrbital = /* @__PURE__ */ new WeakMap();
|
|
336
|
-
function arbitraryClassesOf(schema) {
|
|
337
|
-
const { orbitals, _metadata: _provenance, ledger: _identities, ...rest } = schema;
|
|
338
|
-
const found = new Set(classesOfPart(rest));
|
|
339
|
-
for (const orbital of orbitals ?? []) {
|
|
340
|
-
let classes = classesByOrbital.get(orbital);
|
|
341
|
-
if (!classes) {
|
|
342
|
-
classes = classesOfPart(orbital);
|
|
343
|
-
classesByOrbital.set(orbital, classes);
|
|
344
|
-
}
|
|
345
|
-
for (const cls of classes) found.add(cls);
|
|
346
|
-
}
|
|
347
|
-
return [...found].sort();
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
export { DESIGN_COLOR_TOKENS, DESIGN_RADIUS_TOKENS, DESIGN_SPACING_SCALE, arbitraryClassesOf, defaultSpacingStepPx, isArbitraryClass, layoutOf, positionOf, sizeLimitOf, sizingOf, snapToSpacingStep, spacingOf, spacingTokenOf, tokenOfDesignClass, withLayout, withPosition, withSizeLimit, withSizing, withSpacing };
|
package/dist/chunk-N7JIG57B.js
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { ar_default, sl_default } from './chunk-YYYHH5BA.js';
|
|
2
|
-
import { DEFAULT_CURRENCY } from './chunk-723MJUU3.js';
|
|
3
|
-
import { en_default } from './chunk-LZRW6GXG.js';
|
|
4
|
-
import React, { createContext, useEffect, useContext, useMemo, useRef, useSyncExternalStore } from 'react';
|
|
5
|
-
import { mergeEntityFrame } from '@almadar/core';
|
|
6
|
-
import { createLogger } from '@almadar/logger';
|
|
7
|
-
|
|
8
|
-
var { $meta: _meta, ...coreMessages } = en_default;
|
|
9
|
-
var coreLocale = coreMessages;
|
|
10
|
-
var { $meta: _arMeta, ...arMessages } = ar_default;
|
|
11
|
-
var { $meta: _slMeta, ...slMessages } = sl_default;
|
|
12
|
-
var uiLocales = { en: coreLocale, ar: arMessages, sl: slMessages };
|
|
13
|
-
var I18nContext = createContext({
|
|
14
|
-
locale: "en",
|
|
15
|
-
direction: "ltr",
|
|
16
|
-
t: (key, params) => {
|
|
17
|
-
let msg = coreLocale[key] ?? key;
|
|
18
|
-
if (params) {
|
|
19
|
-
for (const [k, v] of Object.entries(params)) {
|
|
20
|
-
msg = msg.split(`{{${k}}}`).join(String(v));
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return msg;
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
I18nContext.displayName = "I18nContext";
|
|
27
|
-
function I18nProvider({ value, children, documentRoot }) {
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
if (!documentRoot) return;
|
|
30
|
-
document.documentElement.lang = value.locale;
|
|
31
|
-
document.documentElement.dir = value.direction;
|
|
32
|
-
}, [documentRoot, value.locale, value.direction]);
|
|
33
|
-
return React.createElement(I18nContext.Provider, { value }, children);
|
|
34
|
-
}
|
|
35
|
-
function useTranslate() {
|
|
36
|
-
return useContext(I18nContext);
|
|
37
|
-
}
|
|
38
|
-
function useRenderI18n() {
|
|
39
|
-
const { locale, messages } = useContext(I18nContext);
|
|
40
|
-
return useMemo(() => messages !== void 0 ? { locale, messages } : void 0, [locale, messages]);
|
|
41
|
-
}
|
|
42
|
-
function useFormatContext() {
|
|
43
|
-
const { t, locale, currency } = useContext(I18nContext);
|
|
44
|
-
return useMemo(
|
|
45
|
-
() => ({ locale, currency: currency ?? DEFAULT_CURRENCY, booleanLabels: { yes: t("common.yes"), no: t("common.no") } }),
|
|
46
|
-
[t, locale, currency]
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
function createTranslate(messages, locale) {
|
|
50
|
-
const uiCatalog = locale !== void 0 ? uiLocales[locale] : void 0;
|
|
51
|
-
return (key, params) => {
|
|
52
|
-
let msg = messages[key] ?? uiCatalog?.[key] ?? coreLocale[key] ?? key;
|
|
53
|
-
if (params) {
|
|
54
|
-
for (const [k, v] of Object.entries(params)) {
|
|
55
|
-
msg = msg.split(`{{${k}}}`).join(String(v));
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return msg;
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
var log = createLogger("almadar:ui:shared-entity-store");
|
|
62
|
-
var EMPTY_ENTITY_STATE = {};
|
|
63
|
-
function createSharedEntityStore() {
|
|
64
|
-
const states = /* @__PURE__ */ new Map();
|
|
65
|
-
const subscribers = /* @__PURE__ */ new Map();
|
|
66
|
-
const getSnapshot = (entityId) => states.get(entityId) ?? EMPTY_ENTITY_STATE;
|
|
67
|
-
const subscribe = (entityId, callback) => {
|
|
68
|
-
let set = subscribers.get(entityId);
|
|
69
|
-
if (!set) {
|
|
70
|
-
set = /* @__PURE__ */ new Set();
|
|
71
|
-
subscribers.set(entityId, set);
|
|
72
|
-
}
|
|
73
|
-
set.add(callback);
|
|
74
|
-
return () => {
|
|
75
|
-
const current = subscribers.get(entityId);
|
|
76
|
-
if (!current) return;
|
|
77
|
-
current.delete(callback);
|
|
78
|
-
if (current.size === 0) {
|
|
79
|
-
subscribers.delete(entityId);
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
const commit = (entityId, nextState) => {
|
|
84
|
-
states.set(entityId, nextState);
|
|
85
|
-
const set = subscribers.get(entityId);
|
|
86
|
-
if (!set) return;
|
|
87
|
-
set.forEach((callback) => {
|
|
88
|
-
try {
|
|
89
|
-
callback();
|
|
90
|
-
} catch (error) {
|
|
91
|
-
log.error("Shared entity subscriber error", {
|
|
92
|
-
entityId,
|
|
93
|
-
error: error instanceof Error ? error : String(error)
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
};
|
|
98
|
-
const seed = (entityId, initialState) => {
|
|
99
|
-
if (!states.has(entityId)) {
|
|
100
|
-
states.set(entityId, initialState);
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
return { getSnapshot, subscribe, commit, seed };
|
|
104
|
-
}
|
|
105
|
-
function useSharedEntityStore() {
|
|
106
|
-
const storeRef = useRef(null);
|
|
107
|
-
if (storeRef.current === null) {
|
|
108
|
-
storeRef.current = createSharedEntityStore();
|
|
109
|
-
}
|
|
110
|
-
return storeRef.current;
|
|
111
|
-
}
|
|
112
|
-
var SharedEntityStoreContext = createContext(null);
|
|
113
|
-
function useSharedEntityStoreContext() {
|
|
114
|
-
const store = useContext(SharedEntityStoreContext);
|
|
115
|
-
if (!store) {
|
|
116
|
-
throw new Error(
|
|
117
|
-
"useSharedEntityStoreContext: no SharedEntityStoreContext.Provider found in the component tree"
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
return store;
|
|
121
|
-
}
|
|
122
|
-
function useSharedEntitySnapshot(store, entityId) {
|
|
123
|
-
return useSyncExternalStore(
|
|
124
|
-
(onStoreChange) => store.subscribe(entityId, onStoreChange),
|
|
125
|
-
() => store.getSnapshot(entityId)
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
function runTickFrame(entityId, orderedWriters, store) {
|
|
129
|
-
let scratch = store.getSnapshot(entityId);
|
|
130
|
-
for (const writer of orderedWriters) {
|
|
131
|
-
const writes = writer(scratch);
|
|
132
|
-
scratch = mergeEntityFrame(scratch, writes);
|
|
133
|
-
}
|
|
134
|
-
store.commit(entityId, scratch);
|
|
135
|
-
return scratch;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export { I18nProvider, SharedEntityStoreContext, createSharedEntityStore, createTranslate, runTickFrame, useFormatContext, useRenderI18n, useSharedEntitySnapshot, useSharedEntityStore, useSharedEntityStoreContext, useTranslate };
|