@almadar/ui 2.42.0 → 2.45.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/avl/index.cjs +2187 -1392
- package/dist/avl/index.d.cts +17 -0
- package/dist/avl/index.js +1200 -405
- package/dist/components/index.cjs +752 -162
- package/dist/components/index.js +751 -164
- package/dist/components/molecules/markdown/CodeBlock.d.ts +2 -0
- package/dist/components/organisms/UISlotRenderer.d.ts +3 -1
- package/dist/components/organisms/avl/FlowCanvas.d.ts +18 -1
- package/dist/components/organisms/debug/WalkMinimap.d.ts +17 -0
- package/dist/hooks/index.cjs +95 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +93 -1
- package/dist/hooks/useDraggable.d.ts +24 -0
- package/dist/hooks/useDropZone.d.ts +23 -0
- package/dist/providers/EntityStoreProvider.d.ts +28 -14
- package/dist/providers/index.cjs +408 -192
- package/dist/providers/index.d.ts +1 -1
- package/dist/providers/index.js +305 -90
- package/dist/runtime/EntitySchemaContext.d.ts +5 -0
- package/dist/runtime/index.cjs +673 -178
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +674 -180
- package/package.json +1 -1
package/dist/providers/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
1
|
+
import * as React114 from 'react';
|
|
2
|
+
import React114__default, { createContext, useCallback, useState, useRef, useEffect, useMemo, useLayoutEffect, lazy, useContext, useSyncExternalStore } from 'react';
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import { EventBusContext } from '@almadar/ui/providers';
|
|
5
5
|
import 'react-dom';
|
|
@@ -247,7 +247,7 @@ var ThemeProvider = ({
|
|
|
247
247
|
const newMode = resolvedMode === "dark" ? "light" : "dark";
|
|
248
248
|
setMode(newMode);
|
|
249
249
|
}, [resolvedMode, setMode]);
|
|
250
|
-
const
|
|
250
|
+
const contextValue2 = useMemo(
|
|
251
251
|
() => ({
|
|
252
252
|
theme,
|
|
253
253
|
mode,
|
|
@@ -269,30 +269,97 @@ var ThemeProvider = ({
|
|
|
269
269
|
appliedTheme
|
|
270
270
|
]
|
|
271
271
|
);
|
|
272
|
-
return /* @__PURE__ */ jsx(ThemeContext.Provider, { value:
|
|
272
|
+
return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: contextValue2, children });
|
|
273
273
|
};
|
|
274
274
|
var store = /* @__PURE__ */ new Map();
|
|
275
275
|
var storeListeners = /* @__PURE__ */ new Set();
|
|
276
276
|
var watchCallbacks = /* @__PURE__ */ new Map();
|
|
277
|
-
function
|
|
278
|
-
const
|
|
279
|
-
|
|
280
|
-
|
|
277
|
+
function extractId(record) {
|
|
278
|
+
const r = record;
|
|
279
|
+
return String(r.id ?? r._id ?? r.key ?? "");
|
|
280
|
+
}
|
|
281
|
+
function materialize(snap) {
|
|
282
|
+
return snap.ids.map((id) => snap.entities.get(id));
|
|
283
|
+
}
|
|
284
|
+
function notifyListeners(entityType, prev) {
|
|
281
285
|
for (const listener of storeListeners) {
|
|
282
286
|
listener();
|
|
283
287
|
}
|
|
284
288
|
const cbs = watchCallbacks.get(entityType);
|
|
285
289
|
if (cbs) {
|
|
290
|
+
const oldData = prev ? materialize(prev) : [];
|
|
291
|
+
const cur = store.get(entityType);
|
|
292
|
+
const newData = cur ? materialize(cur) : [];
|
|
286
293
|
for (const cb of cbs) {
|
|
287
294
|
try {
|
|
288
|
-
cb(oldData,
|
|
295
|
+
cb(oldData, newData);
|
|
289
296
|
} catch {
|
|
290
297
|
}
|
|
291
298
|
}
|
|
292
299
|
}
|
|
293
300
|
}
|
|
301
|
+
function setAll(entityType, records) {
|
|
302
|
+
const entities = /* @__PURE__ */ new Map();
|
|
303
|
+
const ids = [];
|
|
304
|
+
for (const r of records) {
|
|
305
|
+
const rec = r;
|
|
306
|
+
const id = extractId(rec);
|
|
307
|
+
if (id) {
|
|
308
|
+
entities.set(id, rec);
|
|
309
|
+
ids.push(id);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
const prev = store.get(entityType);
|
|
313
|
+
store.set(entityType, { entities, ids, version: (prev?.version ?? 0) + 1 });
|
|
314
|
+
notifyListeners(entityType, prev);
|
|
315
|
+
}
|
|
316
|
+
function upsertOne(entityType, record) {
|
|
317
|
+
const id = extractId(record);
|
|
318
|
+
if (!id) return;
|
|
319
|
+
const prev = store.get(entityType);
|
|
320
|
+
const snapshot = prev ? { entities: new Map(prev.entities), ids: [...prev.ids], version: prev.version } : { entities: /* @__PURE__ */ new Map(), ids: [], version: 0 };
|
|
321
|
+
snapshot.entities.set(id, record);
|
|
322
|
+
if (!snapshot.ids.includes(id)) snapshot.ids.push(id);
|
|
323
|
+
snapshot.version++;
|
|
324
|
+
store.set(entityType, snapshot);
|
|
325
|
+
notifyListeners(entityType, prev);
|
|
326
|
+
}
|
|
327
|
+
function addOne(entityType, record) {
|
|
328
|
+
upsertOne(entityType, record);
|
|
329
|
+
}
|
|
330
|
+
function updateOne(entityType, id, changes) {
|
|
331
|
+
const prev = store.get(entityType);
|
|
332
|
+
if (!prev?.entities.has(id)) return;
|
|
333
|
+
const snapshot = {
|
|
334
|
+
entities: new Map(prev.entities),
|
|
335
|
+
ids: [...prev.ids],
|
|
336
|
+
version: prev.version
|
|
337
|
+
};
|
|
338
|
+
snapshot.entities.set(id, { ...snapshot.entities.get(id), ...changes });
|
|
339
|
+
snapshot.version++;
|
|
340
|
+
store.set(entityType, snapshot);
|
|
341
|
+
notifyListeners(entityType, prev);
|
|
342
|
+
}
|
|
343
|
+
function removeOne(entityType, id) {
|
|
344
|
+
const prev = store.get(entityType);
|
|
345
|
+
if (!prev) return;
|
|
346
|
+
const snapshot = {
|
|
347
|
+
entities: new Map(prev.entities),
|
|
348
|
+
ids: prev.ids.filter((i) => i !== id),
|
|
349
|
+
version: prev.version
|
|
350
|
+
};
|
|
351
|
+
snapshot.entities.delete(id);
|
|
352
|
+
snapshot.version++;
|
|
353
|
+
store.set(entityType, snapshot);
|
|
354
|
+
notifyListeners(entityType, prev);
|
|
355
|
+
}
|
|
294
356
|
function getSnapshot(entityType) {
|
|
295
|
-
|
|
357
|
+
const snap = store.get(entityType);
|
|
358
|
+
if (!snap) return [];
|
|
359
|
+
return materialize(snap);
|
|
360
|
+
}
|
|
361
|
+
function getById(entityType, id) {
|
|
362
|
+
return store.get(entityType)?.entities.get(id) ?? null;
|
|
296
363
|
}
|
|
297
364
|
function getVersion(entityType) {
|
|
298
365
|
return store.get(entityType)?.version ?? 0;
|
|
@@ -317,7 +384,7 @@ function addWatch(entityType, callback) {
|
|
|
317
384
|
function useEntityRef(entityType) {
|
|
318
385
|
const versionRef = useRef(0);
|
|
319
386
|
const dataRef = useRef([]);
|
|
320
|
-
const getSnapshotStable =
|
|
387
|
+
const getSnapshotStable = React114__default.useCallback(() => {
|
|
321
388
|
const currentVersion = getVersion(entityType);
|
|
322
389
|
if (currentVersion !== versionRef.current) {
|
|
323
390
|
versionRef.current = currentVersion;
|
|
@@ -327,6 +394,20 @@ function useEntityRef(entityType) {
|
|
|
327
394
|
}, [entityType]);
|
|
328
395
|
return useSyncExternalStore(subscribeToStore, getSnapshotStable, () => []);
|
|
329
396
|
}
|
|
397
|
+
function useEntityById(entityType, id) {
|
|
398
|
+
const versionRef = useRef(0);
|
|
399
|
+
const dataRef = useRef(null);
|
|
400
|
+
const getSnapshotStable = React114__default.useCallback(() => {
|
|
401
|
+
if (!id) return null;
|
|
402
|
+
const currentVersion = getVersion(entityType);
|
|
403
|
+
if (currentVersion !== versionRef.current) {
|
|
404
|
+
versionRef.current = currentVersion;
|
|
405
|
+
dataRef.current = getById(entityType, id);
|
|
406
|
+
}
|
|
407
|
+
return dataRef.current;
|
|
408
|
+
}, [entityType, id]);
|
|
409
|
+
return useSyncExternalStore(subscribeToStore, getSnapshotStable, () => null);
|
|
410
|
+
}
|
|
330
411
|
function useEntityWatch(entityType, callback) {
|
|
331
412
|
const callbackRef = useRef(callback);
|
|
332
413
|
callbackRef.current = callback;
|
|
@@ -336,15 +417,21 @@ function useEntityWatch(entityType, callback) {
|
|
|
336
417
|
});
|
|
337
418
|
}, [entityType]);
|
|
338
419
|
}
|
|
339
|
-
var
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
420
|
+
var contextValue = {
|
|
421
|
+
setAll,
|
|
422
|
+
upsertOne,
|
|
423
|
+
addOne,
|
|
424
|
+
updateOne,
|
|
425
|
+
removeOne,
|
|
426
|
+
getSnapshot,
|
|
427
|
+
getById
|
|
428
|
+
};
|
|
429
|
+
var EntityStoreContext = createContext(contextValue);
|
|
343
430
|
function useEntityStore() {
|
|
344
431
|
return useContext(EntityStoreContext);
|
|
345
432
|
}
|
|
346
433
|
function EntityStoreProvider({ children }) {
|
|
347
|
-
return /* @__PURE__ */ jsx(EntityStoreContext.Provider, { value:
|
|
434
|
+
return /* @__PURE__ */ jsx(EntityStoreContext.Provider, { value: contextValue, children });
|
|
348
435
|
}
|
|
349
436
|
function setGlobalEventBus(bus) {
|
|
350
437
|
if (typeof window !== "undefined") {
|
|
@@ -519,7 +606,7 @@ function EventBusProvider({ children, debug: debug2 = false }) {
|
|
|
519
606
|
}
|
|
520
607
|
};
|
|
521
608
|
}, [debug2]);
|
|
522
|
-
const
|
|
609
|
+
const contextValue2 = useMemo(
|
|
523
610
|
() => ({
|
|
524
611
|
emit,
|
|
525
612
|
on,
|
|
@@ -532,12 +619,12 @@ function EventBusProvider({ children, debug: debug2 = false }) {
|
|
|
532
619
|
[emit, on, once, hasListeners, onAny, getSelectedEntity, clearSelectedEntity]
|
|
533
620
|
);
|
|
534
621
|
useEffect(() => {
|
|
535
|
-
setGlobalEventBus(
|
|
622
|
+
setGlobalEventBus(contextValue2);
|
|
536
623
|
return () => {
|
|
537
624
|
setGlobalEventBus(null);
|
|
538
625
|
};
|
|
539
|
-
}, [
|
|
540
|
-
return /* @__PURE__ */ jsx(EventBusContext2.Provider, { value:
|
|
626
|
+
}, [contextValue2]);
|
|
627
|
+
return /* @__PURE__ */ jsx(EventBusContext2.Provider, { value: contextValue2, children });
|
|
541
628
|
}
|
|
542
629
|
var SelectionContext = createContext(null);
|
|
543
630
|
var defaultCompareEntities = (a, b) => {
|
|
@@ -607,13 +694,13 @@ function SelectionProvider({
|
|
|
607
694
|
unsubCancel();
|
|
608
695
|
};
|
|
609
696
|
}, [eventBus, setSelected, clearSelection, debug2]);
|
|
610
|
-
const
|
|
697
|
+
const contextValue2 = {
|
|
611
698
|
selected,
|
|
612
699
|
setSelected,
|
|
613
700
|
clearSelection,
|
|
614
701
|
isSelected
|
|
615
702
|
};
|
|
616
|
-
return /* @__PURE__ */ jsx(SelectionContext.Provider, { value:
|
|
703
|
+
return /* @__PURE__ */ jsx(SelectionContext.Provider, { value: contextValue2, children });
|
|
617
704
|
}
|
|
618
705
|
function useSelection() {
|
|
619
706
|
const context = useContext(SelectionContext);
|
|
@@ -626,6 +713,7 @@ function useSelectionOptional() {
|
|
|
626
713
|
const context = useContext(SelectionContext);
|
|
627
714
|
return context;
|
|
628
715
|
}
|
|
716
|
+
createContext(null);
|
|
629
717
|
function cn(...inputs) {
|
|
630
718
|
return twMerge(clsx(inputs));
|
|
631
719
|
}
|
|
@@ -766,7 +854,7 @@ var positionStyles = {
|
|
|
766
854
|
fixed: "fixed",
|
|
767
855
|
sticky: "sticky"
|
|
768
856
|
};
|
|
769
|
-
var Box =
|
|
857
|
+
var Box = React114__default.forwardRef(
|
|
770
858
|
({
|
|
771
859
|
padding,
|
|
772
860
|
paddingX,
|
|
@@ -1037,7 +1125,7 @@ function resolveIconProp(value, sizeClass) {
|
|
|
1037
1125
|
const IconComp = value;
|
|
1038
1126
|
return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
|
|
1039
1127
|
}
|
|
1040
|
-
if (
|
|
1128
|
+
if (React114__default.isValidElement(value)) {
|
|
1041
1129
|
return value;
|
|
1042
1130
|
}
|
|
1043
1131
|
if (typeof value === "object" && value !== null && "render" in value) {
|
|
@@ -1046,7 +1134,7 @@ function resolveIconProp(value, sizeClass) {
|
|
|
1046
1134
|
}
|
|
1047
1135
|
return value;
|
|
1048
1136
|
}
|
|
1049
|
-
var Button =
|
|
1137
|
+
var Button = React114__default.forwardRef(
|
|
1050
1138
|
({
|
|
1051
1139
|
className,
|
|
1052
1140
|
variant = "primary",
|
|
@@ -1142,7 +1230,7 @@ var sizeStyles3 = {
|
|
|
1142
1230
|
md: "px-2.5 py-1 text-sm",
|
|
1143
1231
|
lg: "px-3 py-1.5 text-base"
|
|
1144
1232
|
};
|
|
1145
|
-
var Badge =
|
|
1233
|
+
var Badge = React114__default.forwardRef(
|
|
1146
1234
|
({ className, variant = "default", size = "sm", amount, label, icon, children, ...props }, ref) => {
|
|
1147
1235
|
const iconSizes2 = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
|
|
1148
1236
|
const resolvedIcon = typeof icon === "string" ? (() => {
|
|
@@ -1169,7 +1257,7 @@ var Badge = React113__default.forwardRef(
|
|
|
1169
1257
|
}
|
|
1170
1258
|
);
|
|
1171
1259
|
Badge.displayName = "Badge";
|
|
1172
|
-
var Input =
|
|
1260
|
+
var Input = React114__default.forwardRef(
|
|
1173
1261
|
({
|
|
1174
1262
|
className,
|
|
1175
1263
|
inputType,
|
|
@@ -1281,7 +1369,7 @@ var Input = React113__default.forwardRef(
|
|
|
1281
1369
|
}
|
|
1282
1370
|
);
|
|
1283
1371
|
Input.displayName = "Input";
|
|
1284
|
-
var Label =
|
|
1372
|
+
var Label = React114__default.forwardRef(
|
|
1285
1373
|
({ className, required, children, ...props }, ref) => {
|
|
1286
1374
|
return /* @__PURE__ */ jsxs(
|
|
1287
1375
|
"label",
|
|
@@ -1301,7 +1389,7 @@ var Label = React113__default.forwardRef(
|
|
|
1301
1389
|
}
|
|
1302
1390
|
);
|
|
1303
1391
|
Label.displayName = "Label";
|
|
1304
|
-
var Textarea =
|
|
1392
|
+
var Textarea = React114__default.forwardRef(
|
|
1305
1393
|
({ className, error, ...props }, ref) => {
|
|
1306
1394
|
return /* @__PURE__ */ jsx(
|
|
1307
1395
|
"textarea",
|
|
@@ -1324,7 +1412,7 @@ var Textarea = React113__default.forwardRef(
|
|
|
1324
1412
|
}
|
|
1325
1413
|
);
|
|
1326
1414
|
Textarea.displayName = "Textarea";
|
|
1327
|
-
var Select =
|
|
1415
|
+
var Select = React114__default.forwardRef(
|
|
1328
1416
|
({ className, options, placeholder, error, ...props }, ref) => {
|
|
1329
1417
|
return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
1330
1418
|
/* @__PURE__ */ jsxs(
|
|
@@ -1360,7 +1448,7 @@ var Select = React113__default.forwardRef(
|
|
|
1360
1448
|
}
|
|
1361
1449
|
);
|
|
1362
1450
|
Select.displayName = "Select";
|
|
1363
|
-
var Checkbox =
|
|
1451
|
+
var Checkbox = React114__default.forwardRef(
|
|
1364
1452
|
({ className, label, id, ...props }, ref) => {
|
|
1365
1453
|
const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
|
|
1366
1454
|
return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
@@ -1436,7 +1524,7 @@ var shadowStyles2 = {
|
|
|
1436
1524
|
md: "shadow",
|
|
1437
1525
|
lg: "shadow-lg"
|
|
1438
1526
|
};
|
|
1439
|
-
var Card =
|
|
1527
|
+
var Card = React114__default.forwardRef(
|
|
1440
1528
|
({
|
|
1441
1529
|
className,
|
|
1442
1530
|
variant = "bordered",
|
|
@@ -1472,9 +1560,9 @@ var Card = React113__default.forwardRef(
|
|
|
1472
1560
|
}
|
|
1473
1561
|
);
|
|
1474
1562
|
Card.displayName = "Card";
|
|
1475
|
-
var CardHeader =
|
|
1563
|
+
var CardHeader = React114__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
|
|
1476
1564
|
CardHeader.displayName = "CardHeader";
|
|
1477
|
-
var CardTitle =
|
|
1565
|
+
var CardTitle = React114__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1478
1566
|
"h3",
|
|
1479
1567
|
{
|
|
1480
1568
|
ref,
|
|
@@ -1487,11 +1575,11 @@ var CardTitle = React113__default.forwardRef(({ className, ...props }, ref) => /
|
|
|
1487
1575
|
}
|
|
1488
1576
|
));
|
|
1489
1577
|
CardTitle.displayName = "CardTitle";
|
|
1490
|
-
var CardContent =
|
|
1578
|
+
var CardContent = React114__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
|
|
1491
1579
|
CardContent.displayName = "CardContent";
|
|
1492
1580
|
var CardBody = CardContent;
|
|
1493
1581
|
CardBody.displayName = "CardBody";
|
|
1494
|
-
var CardFooter =
|
|
1582
|
+
var CardFooter = React114__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1495
1583
|
"div",
|
|
1496
1584
|
{
|
|
1497
1585
|
ref,
|
|
@@ -1506,7 +1594,7 @@ var sizeStyles4 = {
|
|
|
1506
1594
|
md: "h-6 w-6",
|
|
1507
1595
|
lg: "h-8 w-8"
|
|
1508
1596
|
};
|
|
1509
|
-
var Spinner =
|
|
1597
|
+
var Spinner = React114__default.forwardRef(
|
|
1510
1598
|
({ className, size = "md", ...props }, ref) => {
|
|
1511
1599
|
return /* @__PURE__ */ jsx(
|
|
1512
1600
|
"div",
|
|
@@ -1520,7 +1608,7 @@ var Spinner = React113__default.forwardRef(
|
|
|
1520
1608
|
}
|
|
1521
1609
|
);
|
|
1522
1610
|
Spinner.displayName = "Spinner";
|
|
1523
|
-
var Radio =
|
|
1611
|
+
var Radio = React114__default.forwardRef(
|
|
1524
1612
|
({
|
|
1525
1613
|
label,
|
|
1526
1614
|
helperText,
|
|
@@ -1624,7 +1712,7 @@ var Radio = React113__default.forwardRef(
|
|
|
1624
1712
|
}
|
|
1625
1713
|
);
|
|
1626
1714
|
Radio.displayName = "Radio";
|
|
1627
|
-
var Switch =
|
|
1715
|
+
var Switch = React114.forwardRef(
|
|
1628
1716
|
({
|
|
1629
1717
|
checked,
|
|
1630
1718
|
defaultChecked = false,
|
|
@@ -1635,10 +1723,10 @@ var Switch = React113.forwardRef(
|
|
|
1635
1723
|
name,
|
|
1636
1724
|
className
|
|
1637
1725
|
}, ref) => {
|
|
1638
|
-
const [isChecked, setIsChecked] =
|
|
1726
|
+
const [isChecked, setIsChecked] = React114.useState(
|
|
1639
1727
|
checked !== void 0 ? checked : defaultChecked
|
|
1640
1728
|
);
|
|
1641
|
-
|
|
1729
|
+
React114.useEffect(() => {
|
|
1642
1730
|
if (checked !== void 0) {
|
|
1643
1731
|
setIsChecked(checked);
|
|
1644
1732
|
}
|
|
@@ -1796,7 +1884,7 @@ var sizeStyles5 = {
|
|
|
1796
1884
|
md: "w-2.5 h-2.5",
|
|
1797
1885
|
lg: "w-3 h-3"
|
|
1798
1886
|
};
|
|
1799
|
-
var StatusDot =
|
|
1887
|
+
var StatusDot = React114__default.forwardRef(
|
|
1800
1888
|
({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
|
|
1801
1889
|
return /* @__PURE__ */ jsx(
|
|
1802
1890
|
"span",
|
|
@@ -1843,7 +1931,7 @@ var iconMap2 = {
|
|
|
1843
1931
|
down: TrendingDown,
|
|
1844
1932
|
flat: ArrowRight
|
|
1845
1933
|
};
|
|
1846
|
-
var TrendIndicator =
|
|
1934
|
+
var TrendIndicator = React114__default.forwardRef(
|
|
1847
1935
|
({
|
|
1848
1936
|
className,
|
|
1849
1937
|
value,
|
|
@@ -1902,7 +1990,7 @@ var thumbSizes = {
|
|
|
1902
1990
|
md: "w-4 h-4",
|
|
1903
1991
|
lg: "w-5 h-5"
|
|
1904
1992
|
};
|
|
1905
|
-
var RangeSlider =
|
|
1993
|
+
var RangeSlider = React114__default.forwardRef(
|
|
1906
1994
|
({
|
|
1907
1995
|
className,
|
|
1908
1996
|
min = 0,
|
|
@@ -2105,7 +2193,7 @@ var paddingClasses = {
|
|
|
2105
2193
|
md: "py-16",
|
|
2106
2194
|
lg: "py-24"
|
|
2107
2195
|
};
|
|
2108
|
-
var ContentSection =
|
|
2196
|
+
var ContentSection = React114__default.forwardRef(
|
|
2109
2197
|
({ children, background = "default", padding = "lg", id, className }, ref) => {
|
|
2110
2198
|
return /* @__PURE__ */ jsx(
|
|
2111
2199
|
Box,
|
|
@@ -2144,7 +2232,7 @@ var animatedStyles = {
|
|
|
2144
2232
|
"scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
|
|
2145
2233
|
"none": {}
|
|
2146
2234
|
};
|
|
2147
|
-
var AnimatedReveal =
|
|
2235
|
+
var AnimatedReveal = React114__default.forwardRef(
|
|
2148
2236
|
({
|
|
2149
2237
|
trigger = "scroll",
|
|
2150
2238
|
animation = "fade-up",
|
|
@@ -2297,7 +2385,7 @@ function applyMorphAnimation(container, animate, duration, delay, easing) {
|
|
|
2297
2385
|
el.style.opacity = animate ? "1" : "0";
|
|
2298
2386
|
});
|
|
2299
2387
|
}
|
|
2300
|
-
var AnimatedGraphic =
|
|
2388
|
+
var AnimatedGraphic = React114__default.forwardRef(
|
|
2301
2389
|
({
|
|
2302
2390
|
src,
|
|
2303
2391
|
svgContent,
|
|
@@ -2320,7 +2408,7 @@ var AnimatedGraphic = React113__default.forwardRef(
|
|
|
2320
2408
|
const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
|
|
2321
2409
|
const resolvedSvg = svgContent ?? fetchedSvg;
|
|
2322
2410
|
const prevAnimateRef = useRef(animate);
|
|
2323
|
-
const setRef =
|
|
2411
|
+
const setRef = React114__default.useCallback(
|
|
2324
2412
|
(node) => {
|
|
2325
2413
|
containerRef.current = node;
|
|
2326
2414
|
if (typeof ref === "function") ref(node);
|
|
@@ -2562,7 +2650,7 @@ var ErrorState = ({
|
|
|
2562
2650
|
);
|
|
2563
2651
|
};
|
|
2564
2652
|
ErrorState.displayName = "ErrorState";
|
|
2565
|
-
var ErrorBoundary = class extends
|
|
2653
|
+
var ErrorBoundary = class extends React114__default.Component {
|
|
2566
2654
|
constructor(props) {
|
|
2567
2655
|
super(props);
|
|
2568
2656
|
__publicField(this, "reset", () => {
|
|
@@ -3006,13 +3094,13 @@ function getState() {
|
|
|
3006
3094
|
}
|
|
3007
3095
|
return { checks: /* @__PURE__ */ new Map(), transitions: [], bridgeHealth: null, listeners: /* @__PURE__ */ new Set() };
|
|
3008
3096
|
}
|
|
3009
|
-
function
|
|
3097
|
+
function notifyListeners2() {
|
|
3010
3098
|
getState().listeners.forEach((l) => l());
|
|
3011
3099
|
exposeOnWindow();
|
|
3012
3100
|
}
|
|
3013
3101
|
function registerCheck(id, label, status = "pending", details) {
|
|
3014
3102
|
getState().checks.set(id, { id, label, status, details, updatedAt: Date.now() });
|
|
3015
|
-
|
|
3103
|
+
notifyListeners2();
|
|
3016
3104
|
}
|
|
3017
3105
|
function getAllChecks() {
|
|
3018
3106
|
return Array.from(getState().checks.values());
|
|
@@ -3056,7 +3144,7 @@ function recordTransition(trace) {
|
|
|
3056
3144
|
failedEffects.map((e) => `${e.type}: ${e.error}`).join("; ")
|
|
3057
3145
|
);
|
|
3058
3146
|
}
|
|
3059
|
-
|
|
3147
|
+
notifyListeners2();
|
|
3060
3148
|
}
|
|
3061
3149
|
function getTransitions() {
|
|
3062
3150
|
return [...getState().transitions];
|
|
@@ -3155,7 +3243,7 @@ function bindTraitStateGetter(getter) {
|
|
|
3155
3243
|
}
|
|
3156
3244
|
}
|
|
3157
3245
|
exposeOnWindow();
|
|
3158
|
-
var MarkdownContent =
|
|
3246
|
+
var MarkdownContent = React114__default.memo(
|
|
3159
3247
|
({ content, direction, className }) => {
|
|
3160
3248
|
const { t: _t } = useTranslate();
|
|
3161
3249
|
const safeContent = typeof content === "string" ? content : String(content ?? "");
|
|
@@ -3221,7 +3309,7 @@ var MarkdownContent = React113__default.memo(
|
|
|
3221
3309
|
"th",
|
|
3222
3310
|
{
|
|
3223
3311
|
...props,
|
|
3224
|
-
className: "border border-gray-300 dark:border-gray-600 bg-
|
|
3312
|
+
className: "border border-gray-300 dark:border-gray-600 bg-[var(--color-muted)] px-4 py-2 text-left font-semibold",
|
|
3225
3313
|
children
|
|
3226
3314
|
}
|
|
3227
3315
|
);
|
|
@@ -3302,13 +3390,50 @@ var orbStyleOverrides = {
|
|
|
3302
3390
|
"orb-op-async": { color: ORB_COLORS.dark.async }
|
|
3303
3391
|
};
|
|
3304
3392
|
var orbStyle = { ...dark, ...orbStyleOverrides };
|
|
3305
|
-
|
|
3393
|
+
function computeFoldRegions(code) {
|
|
3394
|
+
const lines = code.split("\n");
|
|
3395
|
+
const regions = [];
|
|
3396
|
+
const stack = [];
|
|
3397
|
+
for (let i = 0; i < lines.length; i++) {
|
|
3398
|
+
const line = lines[i];
|
|
3399
|
+
let inString = false;
|
|
3400
|
+
for (let j = 0; j < line.length; j++) {
|
|
3401
|
+
const ch = line[j];
|
|
3402
|
+
if (ch === "\\" && inString) {
|
|
3403
|
+
j++;
|
|
3404
|
+
continue;
|
|
3405
|
+
}
|
|
3406
|
+
if (ch === '"') {
|
|
3407
|
+
inString = !inString;
|
|
3408
|
+
continue;
|
|
3409
|
+
}
|
|
3410
|
+
if (inString) continue;
|
|
3411
|
+
if (ch === "{" || ch === "[") {
|
|
3412
|
+
stack.push({ line: i, bracket: ch });
|
|
3413
|
+
} else if (ch === "}" || ch === "]") {
|
|
3414
|
+
const open = stack.pop();
|
|
3415
|
+
if (open && open.line < i) {
|
|
3416
|
+
regions.push({
|
|
3417
|
+
start: open.line,
|
|
3418
|
+
end: i,
|
|
3419
|
+
closeBracket: ch
|
|
3420
|
+
});
|
|
3421
|
+
}
|
|
3422
|
+
}
|
|
3423
|
+
}
|
|
3424
|
+
}
|
|
3425
|
+
return regions.sort((a, b) => a.start - b.start);
|
|
3426
|
+
}
|
|
3427
|
+
var LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
|
|
3428
|
+
var HIDDEN_LINE_NUMBERS = { display: "none" };
|
|
3429
|
+
var CodeBlock = React114__default.memo(
|
|
3306
3430
|
({
|
|
3307
3431
|
code: rawCode,
|
|
3308
3432
|
language = "text",
|
|
3309
3433
|
showCopyButton = true,
|
|
3310
3434
|
showLanguageBadge = true,
|
|
3311
3435
|
maxHeight = "60vh",
|
|
3436
|
+
foldable: foldableProp,
|
|
3312
3437
|
className
|
|
3313
3438
|
}) => {
|
|
3314
3439
|
const code = typeof rawCode === "string" ? rawCode : String(rawCode ?? "");
|
|
@@ -3317,8 +3442,114 @@ var CodeBlock = React113__default.memo(
|
|
|
3317
3442
|
const eventBus = useEventBus();
|
|
3318
3443
|
const { t: _t } = useTranslate();
|
|
3319
3444
|
const scrollRef = useRef(null);
|
|
3445
|
+
const codeRef = useRef(null);
|
|
3320
3446
|
const savedScrollLeftRef = useRef(0);
|
|
3321
3447
|
const [copied, setCopied] = useState(false);
|
|
3448
|
+
const isFoldable = foldableProp ?? (language === "orb" || language === "json");
|
|
3449
|
+
const [collapsed, setCollapsed] = useState(() => /* @__PURE__ */ new Set());
|
|
3450
|
+
const foldRegions = useMemo(
|
|
3451
|
+
() => isFoldable ? computeFoldRegions(code) : [],
|
|
3452
|
+
[code, isFoldable]
|
|
3453
|
+
);
|
|
3454
|
+
const foldStartMap = useMemo(() => {
|
|
3455
|
+
const m = /* @__PURE__ */ new Map();
|
|
3456
|
+
for (const r of foldRegions) m.set(r.start, r);
|
|
3457
|
+
return m;
|
|
3458
|
+
}, [foldRegions]);
|
|
3459
|
+
const hiddenLines = useMemo(() => {
|
|
3460
|
+
const h = /* @__PURE__ */ new Set();
|
|
3461
|
+
for (const r of foldRegions) {
|
|
3462
|
+
if (!collapsed.has(r.start)) continue;
|
|
3463
|
+
for (let i = r.start + 1; i <= r.end; i++) h.add(i);
|
|
3464
|
+
}
|
|
3465
|
+
return h;
|
|
3466
|
+
}, [foldRegions, collapsed]);
|
|
3467
|
+
const collapsedRef = useRef(collapsed);
|
|
3468
|
+
collapsedRef.current = collapsed;
|
|
3469
|
+
const foldStartMapRef = useRef(foldStartMap);
|
|
3470
|
+
foldStartMapRef.current = foldStartMap;
|
|
3471
|
+
const toggleFold = useCallback((lineNum) => {
|
|
3472
|
+
setCollapsed((prev) => {
|
|
3473
|
+
const next = new Set(prev);
|
|
3474
|
+
if (next.has(lineNum)) next.delete(lineNum);
|
|
3475
|
+
else next.add(lineNum);
|
|
3476
|
+
return next;
|
|
3477
|
+
});
|
|
3478
|
+
}, []);
|
|
3479
|
+
const toggleFoldRef = useRef(toggleFold);
|
|
3480
|
+
toggleFoldRef.current = toggleFold;
|
|
3481
|
+
useEffect(() => {
|
|
3482
|
+
setCollapsed(/* @__PURE__ */ new Set());
|
|
3483
|
+
}, [code]);
|
|
3484
|
+
const highlightedElement = useMemo(
|
|
3485
|
+
() => /* @__PURE__ */ jsx(
|
|
3486
|
+
SyntaxHighlighter,
|
|
3487
|
+
{
|
|
3488
|
+
PreTag: "div",
|
|
3489
|
+
language,
|
|
3490
|
+
style: activeStyle,
|
|
3491
|
+
wrapLines: true,
|
|
3492
|
+
showLineNumbers: true,
|
|
3493
|
+
showInlineLineNumbers: false,
|
|
3494
|
+
lineNumberContainerStyle: HIDDEN_LINE_NUMBERS,
|
|
3495
|
+
lineProps: LINE_PROPS_FN,
|
|
3496
|
+
customStyle: {
|
|
3497
|
+
backgroundColor: "transparent",
|
|
3498
|
+
borderRadius: 0,
|
|
3499
|
+
padding: 0,
|
|
3500
|
+
margin: 0,
|
|
3501
|
+
whiteSpace: "pre",
|
|
3502
|
+
minWidth: "100%"
|
|
3503
|
+
},
|
|
3504
|
+
children: code
|
|
3505
|
+
}
|
|
3506
|
+
),
|
|
3507
|
+
[code, language, activeStyle]
|
|
3508
|
+
);
|
|
3509
|
+
useLayoutEffect(() => {
|
|
3510
|
+
const container = codeRef.current;
|
|
3511
|
+
if (!container) return;
|
|
3512
|
+
container.querySelectorAll(".fold-toggle, .fold-summary").forEach((el) => el.remove());
|
|
3513
|
+
const lineEls = container.querySelectorAll("[data-line]");
|
|
3514
|
+
if (!isFoldable || foldRegions.length === 0) {
|
|
3515
|
+
lineEls.forEach((el) => {
|
|
3516
|
+
el.style.display = "";
|
|
3517
|
+
el.style.position = "";
|
|
3518
|
+
el.style.paddingLeft = "";
|
|
3519
|
+
});
|
|
3520
|
+
return;
|
|
3521
|
+
}
|
|
3522
|
+
lineEls.forEach((el) => {
|
|
3523
|
+
const num = parseInt(el.getAttribute("data-line") ?? "-1", 10);
|
|
3524
|
+
if (hiddenLines.has(num)) {
|
|
3525
|
+
el.style.display = "none";
|
|
3526
|
+
return;
|
|
3527
|
+
}
|
|
3528
|
+
el.style.display = "";
|
|
3529
|
+
el.style.position = "relative";
|
|
3530
|
+
el.style.paddingLeft = "1.2em";
|
|
3531
|
+
const region = foldStartMap.get(num);
|
|
3532
|
+
if (!region) return;
|
|
3533
|
+
const isCollapsed = collapsed.has(num);
|
|
3534
|
+
const toggle = document.createElement("span");
|
|
3535
|
+
toggle.className = "fold-toggle";
|
|
3536
|
+
toggle.textContent = isCollapsed ? "\u25B6" : "\u25BC";
|
|
3537
|
+
toggle.style.cssText = "position:absolute;left:0;top:0;width:1.2em;text-align:center;cursor:pointer;color:#858585;font-size:10px;user-select:none;line-height:inherit;height:100%";
|
|
3538
|
+
toggle.addEventListener("click", (e) => {
|
|
3539
|
+
e.stopPropagation();
|
|
3540
|
+
toggleFoldRef.current(num);
|
|
3541
|
+
});
|
|
3542
|
+
el.insertBefore(toggle, el.firstChild);
|
|
3543
|
+
if (isCollapsed) {
|
|
3544
|
+
const summary = document.createElement("span");
|
|
3545
|
+
summary.className = "fold-summary";
|
|
3546
|
+
summary.style.cssText = "color:#858585;font-style:italic";
|
|
3547
|
+
const count = region.end - region.start - 1;
|
|
3548
|
+
summary.textContent = ` ... ${count} line${count !== 1 ? "s" : ""} ${region.closeBracket}`;
|
|
3549
|
+
el.appendChild(summary);
|
|
3550
|
+
}
|
|
3551
|
+
});
|
|
3552
|
+
}, [collapsed, hiddenLines, foldStartMap, foldRegions, isFoldable]);
|
|
3322
3553
|
useLayoutEffect(() => {
|
|
3323
3554
|
const el = scrollRef.current;
|
|
3324
3555
|
return () => {
|
|
@@ -3349,13 +3580,14 @@ var CodeBlock = React113__default.memo(
|
|
|
3349
3580
|
eventBus.emit("UI:COPY_CODE", { language, success: false });
|
|
3350
3581
|
}
|
|
3351
3582
|
};
|
|
3583
|
+
const hasHeader = showLanguageBadge || showCopyButton;
|
|
3352
3584
|
return /* @__PURE__ */ jsxs(Box, { className: `relative group ${className || ""}`, children: [
|
|
3353
|
-
|
|
3585
|
+
hasHeader && /* @__PURE__ */ jsxs(
|
|
3354
3586
|
HStack,
|
|
3355
3587
|
{
|
|
3356
3588
|
justify: "between",
|
|
3357
3589
|
align: "center",
|
|
3358
|
-
className: "px-3 py-2 bg-
|
|
3590
|
+
className: "px-3 py-2 bg-[var(--color-card)] rounded-t-lg border-b border-gray-700",
|
|
3359
3591
|
children: [
|
|
3360
3592
|
showLanguageBadge && /* @__PURE__ */ jsx(Badge, { variant: "default", size: "sm", children: language }),
|
|
3361
3593
|
showCopyButton && /* @__PURE__ */ jsx(
|
|
@@ -3385,31 +3617,14 @@ var CodeBlock = React113__default.memo(
|
|
|
3385
3617
|
touchAction: "pan-x pan-y",
|
|
3386
3618
|
contain: "paint",
|
|
3387
3619
|
backgroundColor: "#1e1e1e",
|
|
3388
|
-
borderRadius:
|
|
3389
|
-
padding: "1rem"
|
|
3620
|
+
borderRadius: hasHeader ? "0 0 0.5rem 0.5rem" : "0.5rem"
|
|
3390
3621
|
},
|
|
3391
|
-
children: /* @__PURE__ */ jsx(
|
|
3392
|
-
SyntaxHighlighter,
|
|
3393
|
-
{
|
|
3394
|
-
PreTag: "div",
|
|
3395
|
-
language,
|
|
3396
|
-
style: activeStyle,
|
|
3397
|
-
customStyle: {
|
|
3398
|
-
backgroundColor: "transparent",
|
|
3399
|
-
borderRadius: 0,
|
|
3400
|
-
padding: 0,
|
|
3401
|
-
margin: 0,
|
|
3402
|
-
whiteSpace: "pre",
|
|
3403
|
-
minWidth: "100%"
|
|
3404
|
-
},
|
|
3405
|
-
children: code
|
|
3406
|
-
}
|
|
3407
|
-
)
|
|
3622
|
+
children: /* @__PURE__ */ jsx("div", { ref: codeRef, style: { padding: "1rem" }, children: highlightedElement })
|
|
3408
3623
|
}
|
|
3409
3624
|
)
|
|
3410
3625
|
] });
|
|
3411
3626
|
},
|
|
3412
|
-
(prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.maxHeight === next.maxHeight
|
|
3627
|
+
(prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable
|
|
3413
3628
|
);
|
|
3414
3629
|
CodeBlock.displayName = "CodeBlock";
|
|
3415
3630
|
|
|
@@ -3421,12 +3636,12 @@ GameAudioContext.displayName = "GameAudioContext";
|
|
|
3421
3636
|
|
|
3422
3637
|
// components/organisms/component-registry.generated.ts
|
|
3423
3638
|
function lazyThree(name, loader) {
|
|
3424
|
-
const Lazy =
|
|
3639
|
+
const Lazy = React114__default.lazy(() => loader().then((m) => ({ default: m[name] })));
|
|
3425
3640
|
function ThreeWrapper(props) {
|
|
3426
|
-
return
|
|
3427
|
-
|
|
3641
|
+
return React114__default.createElement(
|
|
3642
|
+
React114__default.Suspense,
|
|
3428
3643
|
{ fallback: null },
|
|
3429
|
-
|
|
3644
|
+
React114__default.createElement(Lazy, props)
|
|
3430
3645
|
);
|
|
3431
3646
|
}
|
|
3432
3647
|
ThreeWrapper.displayName = `Lazy(${name})`;
|
|
@@ -3453,7 +3668,7 @@ function SuspenseConfigProvider({
|
|
|
3453
3668
|
config,
|
|
3454
3669
|
children
|
|
3455
3670
|
}) {
|
|
3456
|
-
return
|
|
3671
|
+
return React114__default.createElement(
|
|
3457
3672
|
SuspenseConfigContext.Provider,
|
|
3458
3673
|
{ value: config },
|
|
3459
3674
|
children
|
|
@@ -3682,7 +3897,7 @@ function FetchedDataProvider({
|
|
|
3682
3897
|
},
|
|
3683
3898
|
[state.data]
|
|
3684
3899
|
);
|
|
3685
|
-
const
|
|
3900
|
+
const getById2 = useCallback(
|
|
3686
3901
|
(entityName, id) => {
|
|
3687
3902
|
const records = state.data[entityName];
|
|
3688
3903
|
return records?.find((r) => r.id === id);
|
|
@@ -3746,10 +3961,10 @@ function FetchedDataProvider({
|
|
|
3746
3961
|
const setError = useCallback((error) => {
|
|
3747
3962
|
setState((prev) => ({ ...prev, error, loading: false }));
|
|
3748
3963
|
}, []);
|
|
3749
|
-
const
|
|
3964
|
+
const contextValue2 = useMemo(
|
|
3750
3965
|
() => ({
|
|
3751
3966
|
getData,
|
|
3752
|
-
getById,
|
|
3967
|
+
getById: getById2,
|
|
3753
3968
|
hasData,
|
|
3754
3969
|
getFetchedAt,
|
|
3755
3970
|
setData,
|
|
@@ -3762,7 +3977,7 @@ function FetchedDataProvider({
|
|
|
3762
3977
|
}),
|
|
3763
3978
|
[
|
|
3764
3979
|
getData,
|
|
3765
|
-
|
|
3980
|
+
getById2,
|
|
3766
3981
|
hasData,
|
|
3767
3982
|
getFetchedAt,
|
|
3768
3983
|
setData,
|
|
@@ -3774,7 +3989,7 @@ function FetchedDataProvider({
|
|
|
3774
3989
|
setError
|
|
3775
3990
|
]
|
|
3776
3991
|
);
|
|
3777
|
-
return /* @__PURE__ */ jsx(FetchedDataContext.Provider, { value:
|
|
3992
|
+
return /* @__PURE__ */ jsx(FetchedDataContext.Provider, { value: contextValue2, children });
|
|
3778
3993
|
}
|
|
3779
3994
|
function useFetchedDataContext() {
|
|
3780
3995
|
return useContext(FetchedDataContext);
|
|
@@ -3828,7 +4043,7 @@ function OfflineModeProvider({
|
|
|
3828
4043
|
const [forceOffline, setForceOffline] = useState(false);
|
|
3829
4044
|
const executor = useOfflineExecutor(executorOptions);
|
|
3830
4045
|
const effectivelyOffline = executor.isOffline || forceOffline;
|
|
3831
|
-
const
|
|
4046
|
+
const contextValue2 = useMemo(
|
|
3832
4047
|
() => ({
|
|
3833
4048
|
...executor,
|
|
3834
4049
|
forceOffline,
|
|
@@ -3837,7 +4052,7 @@ function OfflineModeProvider({
|
|
|
3837
4052
|
}),
|
|
3838
4053
|
[executor, forceOffline, effectivelyOffline]
|
|
3839
4054
|
);
|
|
3840
|
-
return /* @__PURE__ */ jsx(OfflineModeContext.Provider, { value:
|
|
4055
|
+
return /* @__PURE__ */ jsx(OfflineModeContext.Provider, { value: contextValue2, children });
|
|
3841
4056
|
}
|
|
3842
4057
|
function useOfflineMode() {
|
|
3843
4058
|
const context = useContext(OfflineModeContext);
|
|
@@ -3850,4 +4065,4 @@ function useOptionalOfflineMode() {
|
|
|
3850
4065
|
return useContext(OfflineModeContext);
|
|
3851
4066
|
}
|
|
3852
4067
|
|
|
3853
|
-
export { EntityStoreContext, EntityStoreProvider, EventBusContext2 as EventBusContext, EventBusProvider, FetchedDataContext, FetchedDataProvider, OfflineModeProvider, OrbitalProvider, SelectionContext, SelectionProvider, VerificationProvider, useEntityRef, useEntityStore, useEntityWatch, useFetchedData, useFetchedDataContext, useFetchedEntity, useOfflineMode, useOptionalOfflineMode, useSelection, useSelectionOptional };
|
|
4068
|
+
export { EntityStoreContext, EntityStoreProvider, EventBusContext2 as EventBusContext, EventBusProvider, FetchedDataContext, FetchedDataProvider, OfflineModeProvider, OrbitalProvider, SelectionContext, SelectionProvider, VerificationProvider, useEntityById, useEntityRef, useEntityStore, useEntityWatch, useFetchedData, useFetchedDataContext, useFetchedEntity, useOfflineMode, useOptionalOfflineMode, useSelection, useSelectionOptional };
|