@almadar/ui 2.48.3 → 2.48.5
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 +125 -31
- package/dist/avl/index.js +125 -31
- package/dist/components/index.cjs +37 -177
- package/dist/components/index.js +36 -176
- package/dist/components/organisms/game/three/index.cjs +5 -14
- package/dist/components/organisms/game/three/index.js +5 -14
- package/dist/docs/index.cjs +5 -14
- package/dist/docs/index.js +5 -14
- package/dist/hooks/index.cjs +233 -246
- package/dist/hooks/index.js +8 -21
- package/dist/lib/index.cjs +5 -14
- package/dist/lib/index.js +5 -14
- package/dist/marketing/index.cjs +5 -14
- package/dist/marketing/index.js +5 -14
- package/dist/providers/index.cjs +5 -14
- package/dist/providers/index.js +5 -14
- package/dist/runtime/OrbPreview.d.ts +25 -5
- package/dist/runtime/index.cjs +1180 -1788
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.js +424 -1035
- package/dist/runtime/prepareSchemaForPreview.d.ts +71 -0
- package/package.json +1 -1
package/dist/runtime/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
import { EventBusContext } from '@almadar/ui/providers';
|
|
4
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
1
|
+
import * as React114 from 'react';
|
|
2
|
+
import React114__default, { createContext, useCallback, useState, useRef, useEffect, useMemo, useLayoutEffect, lazy, useContext, Suspense, useId } from 'react';
|
|
3
|
+
import { EventBusContext, OrbitalProvider, useEntityStore, VerificationProvider, useEntityRef } from '@almadar/ui/providers';
|
|
5
4
|
import '@tanstack/react-query';
|
|
6
5
|
import { isCircuitEvent, schemaToIR, getPage, clearSchemaCache as clearSchemaCache$1 } from '@almadar/core';
|
|
7
6
|
import { StateMachineManager, createContextFromBindings, interpolateValue, EffectExecutor } from '@almadar/runtime';
|
|
7
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
8
|
import { clsx } from 'clsx';
|
|
9
9
|
import { twMerge } from 'tailwind-merge';
|
|
10
|
-
import { createPortal } from 'react-dom';
|
|
11
10
|
import { UISlotProvider, useUISlots } from '@almadar/ui/context';
|
|
11
|
+
import { createPortal } from 'react-dom';
|
|
12
12
|
import * as LucideIcons from 'lucide-react';
|
|
13
13
|
import { Loader2, ChevronDown, X, ArrowRight, TrendingDown, TrendingUp, Check, Copy, AlertCircle, AlertTriangle, Info, CheckCircle, ChevronLeft, ChevronRight, FileWarning, Upload, Circle, Clock, CheckCircle2, Sun, Moon, ArrowUp, ArrowDown, MoreVertical, Minus, Star, XCircle, Play, RotateCcw, Pause, SkipForward, Eraser, Search, HelpCircle, ChevronUp, ArrowLeft, Plus, Image as Image$1, ZoomIn, Package, Menu as Menu$1, ZoomOut, Filter, FileQuestion, Inbox, FileText, Download, Printer, Bug, Send, MoreHorizontal, Settings, Bell, LogOut, Trash2, Zap, Sword, Move, Heart, Shield, Code, WrapText, Wrench, List, Calendar, Pencil, Eye, User, Tag, DollarSign } from 'lucide-react';
|
|
14
14
|
import { evaluate, createMinimalContext } from '@almadar/evaluator';
|
|
@@ -48,22 +48,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
48
48
|
// lib/logger.ts
|
|
49
49
|
var LEVEL_PRIORITY = { DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3 };
|
|
50
50
|
var ENV = typeof process !== "undefined" && process.env ? process.env : {};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
try {
|
|
54
|
-
const meta = (0, eval)('typeof import.meta !== "undefined" && import.meta');
|
|
55
|
-
return meta ? meta.env?.[key] : void 0;
|
|
56
|
-
} catch {
|
|
57
|
-
return void 0;
|
|
58
|
-
}
|
|
51
|
+
function envGet(key) {
|
|
52
|
+
return ENV[key] ?? ENV[`VITE_${key}`];
|
|
59
53
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
var NODE_ENV = envGet("NODE_ENV", "VITE_NODE_ENV") ?? "development";
|
|
64
|
-
var CONFIGURED_LEVEL = (envGet("LOG_LEVEL", "VITE_LOG_LEVEL") ?? (NODE_ENV === "production" ? "info" : "debug")).toUpperCase();
|
|
54
|
+
var NODE_ENV = envGet("NODE_ENV") ?? "development";
|
|
55
|
+
var CONFIGURED_LEVEL = (envGet("LOG_LEVEL") ?? (NODE_ENV === "production" ? "info" : "debug")).toUpperCase();
|
|
65
56
|
var MIN_PRIORITY = LEVEL_PRIORITY[CONFIGURED_LEVEL] ?? 0;
|
|
66
|
-
var DEBUG_FILTER = (envGet("ALMADAR_DEBUG"
|
|
57
|
+
var DEBUG_FILTER = (envGet("ALMADAR_DEBUG") ?? "").split(",").map((s) => s.trim()).filter(Boolean);
|
|
67
58
|
function matchesNamespace(namespace) {
|
|
68
59
|
if (DEBUG_FILTER.length === 0) return true;
|
|
69
60
|
return DEBUG_FILTER.some((pattern) => {
|
|
@@ -74,7 +65,7 @@ function matchesNamespace(namespace) {
|
|
|
74
65
|
}
|
|
75
66
|
function createLogger(namespace) {
|
|
76
67
|
const nsAllowed = matchesNamespace(namespace);
|
|
77
|
-
const
|
|
68
|
+
const log3 = (level, message, data, correlationId) => {
|
|
78
69
|
if (LEVEL_PRIORITY[level] < MIN_PRIORITY) return;
|
|
79
70
|
if (level === "DEBUG" && !nsAllowed) return;
|
|
80
71
|
const prefix = `[${namespace}]`;
|
|
@@ -95,21 +86,16 @@ function createLogger(namespace) {
|
|
|
95
86
|
}
|
|
96
87
|
};
|
|
97
88
|
return {
|
|
98
|
-
debug: (msg, data, cid) =>
|
|
99
|
-
info: (msg, data, cid) =>
|
|
100
|
-
warn: (msg, data, cid) =>
|
|
101
|
-
error: (msg, data, cid) =>
|
|
89
|
+
debug: (msg, data, cid) => log3("DEBUG", msg, data, cid),
|
|
90
|
+
info: (msg, data, cid) => log3("INFO", msg, data, cid),
|
|
91
|
+
warn: (msg, data, cid) => log3("WARN", msg, data, cid),
|
|
92
|
+
error: (msg, data, cid) => log3("ERROR", msg, data, cid)
|
|
102
93
|
};
|
|
103
94
|
}
|
|
104
95
|
|
|
105
96
|
// hooks/useEventBus.ts
|
|
106
97
|
var log = createLogger("almadar:eventbus");
|
|
107
98
|
var subLog = createLogger("almadar:eventbus:subscribe");
|
|
108
|
-
function setGlobalEventBus(bus) {
|
|
109
|
-
if (typeof window !== "undefined") {
|
|
110
|
-
window.__kflowEventBus = bus;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
99
|
function getGlobalEventBus() {
|
|
114
100
|
if (typeof window !== "undefined") {
|
|
115
101
|
return window.__kflowEventBus ?? null;
|
|
@@ -197,82 +183,6 @@ function useEventListener(event, handler) {
|
|
|
197
183
|
};
|
|
198
184
|
}, [event, eventBus]);
|
|
199
185
|
}
|
|
200
|
-
var SelectionContext = createContext(null);
|
|
201
|
-
var defaultCompareEntities = (a, b) => {
|
|
202
|
-
if (a === b) return true;
|
|
203
|
-
if (!a || !b) return false;
|
|
204
|
-
if (typeof a === "object" && typeof b === "object") {
|
|
205
|
-
const aId = a.id;
|
|
206
|
-
const bId = b.id;
|
|
207
|
-
return aId !== void 0 && aId === bId;
|
|
208
|
-
}
|
|
209
|
-
return false;
|
|
210
|
-
};
|
|
211
|
-
function SelectionProvider({
|
|
212
|
-
children,
|
|
213
|
-
debug: debug2 = false,
|
|
214
|
-
compareEntities = defaultCompareEntities
|
|
215
|
-
}) {
|
|
216
|
-
const eventBus = useEventBus();
|
|
217
|
-
const [selected, setSelectedState] = useState(null);
|
|
218
|
-
const setSelected = useCallback(
|
|
219
|
-
(entity) => {
|
|
220
|
-
setSelectedState(entity);
|
|
221
|
-
if (debug2) {
|
|
222
|
-
console.log("[SelectionProvider] Selection set:", entity);
|
|
223
|
-
}
|
|
224
|
-
},
|
|
225
|
-
[debug2]
|
|
226
|
-
);
|
|
227
|
-
const clearSelection = useCallback(() => {
|
|
228
|
-
setSelectedState(null);
|
|
229
|
-
if (debug2) {
|
|
230
|
-
console.log("[SelectionProvider] Selection cleared");
|
|
231
|
-
}
|
|
232
|
-
}, [debug2]);
|
|
233
|
-
const isSelected = useCallback(
|
|
234
|
-
(entity) => {
|
|
235
|
-
return compareEntities(selected, entity);
|
|
236
|
-
},
|
|
237
|
-
[selected, compareEntities]
|
|
238
|
-
);
|
|
239
|
-
useEffect(() => {
|
|
240
|
-
const handleSelect = (event) => {
|
|
241
|
-
const row = event.payload?.row;
|
|
242
|
-
if (row) {
|
|
243
|
-
setSelected(row);
|
|
244
|
-
if (debug2) {
|
|
245
|
-
console.log(`[SelectionProvider] ${event.type} received:`, row);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
|
-
const handleDeselect = (event) => {
|
|
250
|
-
clearSelection();
|
|
251
|
-
if (debug2) {
|
|
252
|
-
console.log(`[SelectionProvider] ${event.type} received - clearing selection`);
|
|
253
|
-
}
|
|
254
|
-
};
|
|
255
|
-
const unsubView = eventBus.on("UI:VIEW", handleSelect);
|
|
256
|
-
const unsubSelect = eventBus.on("UI:SELECT", handleSelect);
|
|
257
|
-
const unsubClose = eventBus.on("UI:CLOSE", handleDeselect);
|
|
258
|
-
const unsubDeselect = eventBus.on("UI:DESELECT", handleDeselect);
|
|
259
|
-
const unsubCancel = eventBus.on("UI:CANCEL", handleDeselect);
|
|
260
|
-
return () => {
|
|
261
|
-
unsubView();
|
|
262
|
-
unsubSelect();
|
|
263
|
-
unsubClose();
|
|
264
|
-
unsubDeselect();
|
|
265
|
-
unsubCancel();
|
|
266
|
-
};
|
|
267
|
-
}, [eventBus, setSelected, clearSelection, debug2]);
|
|
268
|
-
const contextValue2 = {
|
|
269
|
-
selected,
|
|
270
|
-
setSelected,
|
|
271
|
-
clearSelection,
|
|
272
|
-
isSelected
|
|
273
|
-
};
|
|
274
|
-
return /* @__PURE__ */ jsx(SelectionContext.Provider, { value: contextValue2, children });
|
|
275
|
-
}
|
|
276
186
|
createContext(null);
|
|
277
187
|
var queryStores = /* @__PURE__ */ new Map();
|
|
278
188
|
function getOrCreateStore(query) {
|
|
@@ -292,43 +202,43 @@ function useQuerySingleton(query) {
|
|
|
292
202
|
if (!query) {
|
|
293
203
|
return null;
|
|
294
204
|
}
|
|
295
|
-
const
|
|
205
|
+
const store = useMemo(() => getOrCreateStore(query), [query]);
|
|
296
206
|
useMemo(() => {
|
|
297
207
|
const listener = () => forceUpdate({});
|
|
298
|
-
|
|
208
|
+
store.listeners.add(listener);
|
|
299
209
|
return () => {
|
|
300
|
-
|
|
210
|
+
store.listeners.delete(listener);
|
|
301
211
|
};
|
|
302
|
-
}, [
|
|
303
|
-
const
|
|
304
|
-
|
|
305
|
-
}, [
|
|
212
|
+
}, [store]);
|
|
213
|
+
const notifyListeners3 = useCallback(() => {
|
|
214
|
+
store.listeners.forEach((listener) => listener());
|
|
215
|
+
}, [store]);
|
|
306
216
|
const setSearch = useCallback((value) => {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
}, [
|
|
217
|
+
store.search = value;
|
|
218
|
+
notifyListeners3();
|
|
219
|
+
}, [store, notifyListeners3]);
|
|
310
220
|
const setFilter = useCallback((key, value) => {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
}, [
|
|
221
|
+
store.filters = { ...store.filters, [key]: value };
|
|
222
|
+
notifyListeners3();
|
|
223
|
+
}, [store, notifyListeners3]);
|
|
314
224
|
const clearFilters = useCallback(() => {
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
}, [
|
|
225
|
+
store.filters = {};
|
|
226
|
+
store.search = "";
|
|
227
|
+
notifyListeners3();
|
|
228
|
+
}, [store, notifyListeners3]);
|
|
319
229
|
const setSort = useCallback((field, direction) => {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
}, [
|
|
230
|
+
store.sortField = field;
|
|
231
|
+
store.sortDirection = direction;
|
|
232
|
+
notifyListeners3();
|
|
233
|
+
}, [store, notifyListeners3]);
|
|
324
234
|
return {
|
|
325
|
-
search:
|
|
235
|
+
search: store.search,
|
|
326
236
|
setSearch,
|
|
327
|
-
filters:
|
|
237
|
+
filters: store.filters,
|
|
328
238
|
setFilter,
|
|
329
239
|
clearFilters,
|
|
330
|
-
sortField:
|
|
331
|
-
sortDirection:
|
|
240
|
+
sortField: store.sortField,
|
|
241
|
+
sortDirection: store.sortDirection,
|
|
332
242
|
setSort
|
|
333
243
|
};
|
|
334
244
|
}
|
|
@@ -778,13 +688,13 @@ function EntitySchemaProvider({
|
|
|
778
688
|
}
|
|
779
689
|
return map;
|
|
780
690
|
}, [entities]);
|
|
781
|
-
const
|
|
691
|
+
const contextValue = useMemo(
|
|
782
692
|
() => ({
|
|
783
693
|
entities: entitiesMap
|
|
784
694
|
}),
|
|
785
695
|
[entitiesMap]
|
|
786
696
|
);
|
|
787
|
-
return /* @__PURE__ */ jsx(EntitySchemaContext.Provider, { value:
|
|
697
|
+
return /* @__PURE__ */ jsx(EntitySchemaContext.Provider, { value: contextValue, children });
|
|
788
698
|
}
|
|
789
699
|
function useEntitySchema() {
|
|
790
700
|
const context = useContext(EntitySchemaContext);
|
|
@@ -995,34 +905,6 @@ function waitForTransition(event, timeoutMs = 1e4) {
|
|
|
995
905
|
});
|
|
996
906
|
});
|
|
997
907
|
}
|
|
998
|
-
function bindEventBus(eventBus) {
|
|
999
|
-
if (typeof window === "undefined") return;
|
|
1000
|
-
log2.info("bindEventBus", { hasOnAny: !!eventBus.onAny });
|
|
1001
|
-
exposeOnWindow();
|
|
1002
|
-
if (window.__orbitalVerification) {
|
|
1003
|
-
window.__orbitalVerification.sendEvent = (event, payload) => {
|
|
1004
|
-
const prefixed = event.startsWith("UI:") ? event : `UI:${event}`;
|
|
1005
|
-
log2.debug("sendEvent", { event: prefixed, payloadKeys: payload ? Object.keys(payload) : [] });
|
|
1006
|
-
eventBus.emit(prefixed, payload);
|
|
1007
|
-
};
|
|
1008
|
-
const eventLog = [];
|
|
1009
|
-
window.__orbitalVerification.eventLog = eventLog;
|
|
1010
|
-
window.__orbitalVerification.clearEventLog = () => {
|
|
1011
|
-
eventLog.length = 0;
|
|
1012
|
-
};
|
|
1013
|
-
if (eventBus.onAny) {
|
|
1014
|
-
eventBus.onAny((event) => {
|
|
1015
|
-
if (eventLog.length < 200) {
|
|
1016
|
-
eventLog.push({
|
|
1017
|
-
type: event.type,
|
|
1018
|
-
payload: event.payload,
|
|
1019
|
-
timestamp: Date.now()
|
|
1020
|
-
});
|
|
1021
|
-
}
|
|
1022
|
-
});
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
}
|
|
1026
908
|
function bindTraitStateGetter(getter) {
|
|
1027
909
|
if (typeof window === "undefined") return;
|
|
1028
910
|
exposeOnWindow();
|
|
@@ -1524,7 +1406,7 @@ function TraitProvider({
|
|
|
1524
1406
|
}
|
|
1525
1407
|
return map;
|
|
1526
1408
|
}, [traitBindings]);
|
|
1527
|
-
const
|
|
1409
|
+
const contextValue = useMemo(() => {
|
|
1528
1410
|
return {
|
|
1529
1411
|
traits: traitInstances,
|
|
1530
1412
|
getTrait: (name) => traitInstances.get(name),
|
|
@@ -1540,7 +1422,7 @@ function TraitProvider({
|
|
|
1540
1422
|
}
|
|
1541
1423
|
};
|
|
1542
1424
|
}, [traitInstances]);
|
|
1543
|
-
return /* @__PURE__ */ jsx(TraitContext.Provider, { value:
|
|
1425
|
+
return /* @__PURE__ */ jsx(TraitContext.Provider, { value: contextValue, children });
|
|
1544
1426
|
}
|
|
1545
1427
|
function useTraitContext() {
|
|
1546
1428
|
const context = useContext(TraitContext);
|
|
@@ -1702,7 +1584,7 @@ var positionStyles = {
|
|
|
1702
1584
|
fixed: "fixed",
|
|
1703
1585
|
sticky: "sticky"
|
|
1704
1586
|
};
|
|
1705
|
-
var Box =
|
|
1587
|
+
var Box = React114__default.forwardRef(
|
|
1706
1588
|
({
|
|
1707
1589
|
padding,
|
|
1708
1590
|
paddingX,
|
|
@@ -1905,512 +1787,6 @@ var Typography = ({
|
|
|
1905
1787
|
);
|
|
1906
1788
|
};
|
|
1907
1789
|
Typography.displayName = "Typography";
|
|
1908
|
-
var BUILT_IN_THEMES = [
|
|
1909
|
-
{
|
|
1910
|
-
name: "wireframe",
|
|
1911
|
-
displayName: "Wireframe",
|
|
1912
|
-
hasLightMode: true,
|
|
1913
|
-
hasDarkMode: true
|
|
1914
|
-
},
|
|
1915
|
-
{
|
|
1916
|
-
name: "minimalist",
|
|
1917
|
-
displayName: "Minimalist",
|
|
1918
|
-
hasLightMode: true,
|
|
1919
|
-
hasDarkMode: true
|
|
1920
|
-
},
|
|
1921
|
-
{
|
|
1922
|
-
name: "almadar",
|
|
1923
|
-
displayName: "Almadar",
|
|
1924
|
-
hasLightMode: true,
|
|
1925
|
-
hasDarkMode: true
|
|
1926
|
-
},
|
|
1927
|
-
{
|
|
1928
|
-
name: "trait-wars",
|
|
1929
|
-
displayName: "Trait Wars",
|
|
1930
|
-
hasLightMode: false,
|
|
1931
|
-
hasDarkMode: true
|
|
1932
|
-
},
|
|
1933
|
-
// Extended themes
|
|
1934
|
-
{
|
|
1935
|
-
name: "ocean",
|
|
1936
|
-
displayName: "Ocean",
|
|
1937
|
-
hasLightMode: true,
|
|
1938
|
-
hasDarkMode: true
|
|
1939
|
-
},
|
|
1940
|
-
{
|
|
1941
|
-
name: "forest",
|
|
1942
|
-
displayName: "Forest",
|
|
1943
|
-
hasLightMode: true,
|
|
1944
|
-
hasDarkMode: true
|
|
1945
|
-
},
|
|
1946
|
-
{
|
|
1947
|
-
name: "sunset",
|
|
1948
|
-
displayName: "Sunset",
|
|
1949
|
-
hasLightMode: true,
|
|
1950
|
-
hasDarkMode: true
|
|
1951
|
-
},
|
|
1952
|
-
{
|
|
1953
|
-
name: "lavender",
|
|
1954
|
-
displayName: "Lavender",
|
|
1955
|
-
hasLightMode: true,
|
|
1956
|
-
hasDarkMode: true
|
|
1957
|
-
},
|
|
1958
|
-
{
|
|
1959
|
-
name: "rose",
|
|
1960
|
-
displayName: "Rose",
|
|
1961
|
-
hasLightMode: true,
|
|
1962
|
-
hasDarkMode: true
|
|
1963
|
-
},
|
|
1964
|
-
{
|
|
1965
|
-
name: "slate",
|
|
1966
|
-
displayName: "Slate",
|
|
1967
|
-
hasLightMode: true,
|
|
1968
|
-
hasDarkMode: true
|
|
1969
|
-
},
|
|
1970
|
-
{
|
|
1971
|
-
name: "ember",
|
|
1972
|
-
displayName: "Ember",
|
|
1973
|
-
hasLightMode: true,
|
|
1974
|
-
hasDarkMode: true
|
|
1975
|
-
},
|
|
1976
|
-
{
|
|
1977
|
-
name: "midnight",
|
|
1978
|
-
displayName: "Midnight",
|
|
1979
|
-
hasLightMode: true,
|
|
1980
|
-
hasDarkMode: true
|
|
1981
|
-
},
|
|
1982
|
-
{
|
|
1983
|
-
name: "sand",
|
|
1984
|
-
displayName: "Sand",
|
|
1985
|
-
hasLightMode: true,
|
|
1986
|
-
hasDarkMode: true
|
|
1987
|
-
},
|
|
1988
|
-
{
|
|
1989
|
-
name: "neon",
|
|
1990
|
-
displayName: "Neon",
|
|
1991
|
-
hasLightMode: true,
|
|
1992
|
-
hasDarkMode: true
|
|
1993
|
-
},
|
|
1994
|
-
{
|
|
1995
|
-
name: "arctic",
|
|
1996
|
-
displayName: "Arctic",
|
|
1997
|
-
hasLightMode: true,
|
|
1998
|
-
hasDarkMode: true
|
|
1999
|
-
},
|
|
2000
|
-
{
|
|
2001
|
-
name: "copper",
|
|
2002
|
-
displayName: "Copper",
|
|
2003
|
-
hasLightMode: true,
|
|
2004
|
-
hasDarkMode: true
|
|
2005
|
-
}
|
|
2006
|
-
];
|
|
2007
|
-
var ThemeContext = createContext(void 0);
|
|
2008
|
-
var THEME_STORAGE_KEY = "theme";
|
|
2009
|
-
var MODE_STORAGE_KEY = "theme-mode";
|
|
2010
|
-
function getSystemMode() {
|
|
2011
|
-
if (typeof window === "undefined") return "light";
|
|
2012
|
-
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
2013
|
-
}
|
|
2014
|
-
function resolveMode(mode) {
|
|
2015
|
-
if (mode === "system") {
|
|
2016
|
-
return getSystemMode();
|
|
2017
|
-
}
|
|
2018
|
-
return mode;
|
|
2019
|
-
}
|
|
2020
|
-
var ThemeProvider = ({
|
|
2021
|
-
children,
|
|
2022
|
-
themes = [],
|
|
2023
|
-
defaultTheme = "wireframe",
|
|
2024
|
-
defaultMode = "system",
|
|
2025
|
-
targetRef
|
|
2026
|
-
}) => {
|
|
2027
|
-
const availableThemes = useMemo(() => {
|
|
2028
|
-
const themeMap = /* @__PURE__ */ new Map();
|
|
2029
|
-
BUILT_IN_THEMES.forEach((t) => themeMap.set(t.name, t));
|
|
2030
|
-
themes.forEach((t) => themeMap.set(t.name, t));
|
|
2031
|
-
return Array.from(themeMap.values());
|
|
2032
|
-
}, [themes]);
|
|
2033
|
-
const isScoped = !!targetRef;
|
|
2034
|
-
const [theme, setThemeState] = useState(() => {
|
|
2035
|
-
if (isScoped || typeof window === "undefined") return defaultTheme;
|
|
2036
|
-
const stored = localStorage.getItem(THEME_STORAGE_KEY);
|
|
2037
|
-
const validThemes = [
|
|
2038
|
-
...BUILT_IN_THEMES.map((t) => t.name),
|
|
2039
|
-
...themes.map((t) => t.name)
|
|
2040
|
-
];
|
|
2041
|
-
if (stored && validThemes.includes(stored)) {
|
|
2042
|
-
return stored;
|
|
2043
|
-
}
|
|
2044
|
-
return defaultTheme;
|
|
2045
|
-
});
|
|
2046
|
-
const [mode, setModeState] = useState(() => {
|
|
2047
|
-
if (isScoped || typeof window === "undefined") return defaultMode;
|
|
2048
|
-
const stored = localStorage.getItem(MODE_STORAGE_KEY);
|
|
2049
|
-
if (stored === "light" || stored === "dark" || stored === "system") {
|
|
2050
|
-
return stored;
|
|
2051
|
-
}
|
|
2052
|
-
return defaultMode;
|
|
2053
|
-
});
|
|
2054
|
-
const [resolvedMode, setResolvedMode] = useState(
|
|
2055
|
-
() => resolveMode(mode)
|
|
2056
|
-
);
|
|
2057
|
-
const appliedTheme = useMemo(
|
|
2058
|
-
() => `${theme}-${resolvedMode}`,
|
|
2059
|
-
[theme, resolvedMode]
|
|
2060
|
-
);
|
|
2061
|
-
useEffect(() => {
|
|
2062
|
-
const updateResolved = () => {
|
|
2063
|
-
setResolvedMode(resolveMode(mode));
|
|
2064
|
-
};
|
|
2065
|
-
updateResolved();
|
|
2066
|
-
if (mode === "system") {
|
|
2067
|
-
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2068
|
-
const handleChange = () => updateResolved();
|
|
2069
|
-
mediaQuery.addEventListener("change", handleChange);
|
|
2070
|
-
return () => mediaQuery.removeEventListener("change", handleChange);
|
|
2071
|
-
}
|
|
2072
|
-
return void 0;
|
|
2073
|
-
}, [mode]);
|
|
2074
|
-
useEffect(() => {
|
|
2075
|
-
if (isScoped) {
|
|
2076
|
-
if (targetRef?.current) {
|
|
2077
|
-
targetRef.current.setAttribute("data-theme", appliedTheme);
|
|
2078
|
-
targetRef.current.classList.remove("light", "dark");
|
|
2079
|
-
targetRef.current.classList.add(resolvedMode);
|
|
2080
|
-
}
|
|
2081
|
-
return;
|
|
2082
|
-
}
|
|
2083
|
-
const root = document.documentElement;
|
|
2084
|
-
root.setAttribute("data-theme", appliedTheme);
|
|
2085
|
-
root.classList.remove("light", "dark");
|
|
2086
|
-
root.classList.add(resolvedMode);
|
|
2087
|
-
}, [appliedTheme, resolvedMode, targetRef, isScoped]);
|
|
2088
|
-
const setTheme = useCallback(
|
|
2089
|
-
(newTheme) => {
|
|
2090
|
-
const validTheme = availableThemes.find((t) => t.name === newTheme);
|
|
2091
|
-
if (validTheme) {
|
|
2092
|
-
setThemeState(newTheme);
|
|
2093
|
-
if (!isScoped && typeof window !== "undefined") {
|
|
2094
|
-
localStorage.setItem(THEME_STORAGE_KEY, newTheme);
|
|
2095
|
-
}
|
|
2096
|
-
} else {
|
|
2097
|
-
console.warn(
|
|
2098
|
-
`Theme "${newTheme}" not found. Available: ${availableThemes.map((t) => t.name).join(", ")}`
|
|
2099
|
-
);
|
|
2100
|
-
}
|
|
2101
|
-
},
|
|
2102
|
-
[availableThemes]
|
|
2103
|
-
);
|
|
2104
|
-
const setMode = useCallback((newMode) => {
|
|
2105
|
-
setModeState(newMode);
|
|
2106
|
-
if (!isScoped && typeof window !== "undefined") {
|
|
2107
|
-
localStorage.setItem(MODE_STORAGE_KEY, newMode);
|
|
2108
|
-
}
|
|
2109
|
-
}, []);
|
|
2110
|
-
const toggleMode = useCallback(() => {
|
|
2111
|
-
const newMode = resolvedMode === "dark" ? "light" : "dark";
|
|
2112
|
-
setMode(newMode);
|
|
2113
|
-
}, [resolvedMode, setMode]);
|
|
2114
|
-
const contextValue2 = useMemo(
|
|
2115
|
-
() => ({
|
|
2116
|
-
theme,
|
|
2117
|
-
mode,
|
|
2118
|
-
resolvedMode,
|
|
2119
|
-
setTheme,
|
|
2120
|
-
setMode,
|
|
2121
|
-
toggleMode,
|
|
2122
|
-
availableThemes,
|
|
2123
|
-
appliedTheme
|
|
2124
|
-
}),
|
|
2125
|
-
[
|
|
2126
|
-
theme,
|
|
2127
|
-
mode,
|
|
2128
|
-
resolvedMode,
|
|
2129
|
-
setTheme,
|
|
2130
|
-
setMode,
|
|
2131
|
-
toggleMode,
|
|
2132
|
-
availableThemes,
|
|
2133
|
-
appliedTheme
|
|
2134
|
-
]
|
|
2135
|
-
);
|
|
2136
|
-
return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: contextValue2, children });
|
|
2137
|
-
};
|
|
2138
|
-
function useTheme() {
|
|
2139
|
-
const context = useContext(ThemeContext);
|
|
2140
|
-
if (context === void 0) {
|
|
2141
|
-
return {
|
|
2142
|
-
theme: "wireframe",
|
|
2143
|
-
mode: "light",
|
|
2144
|
-
resolvedMode: "light",
|
|
2145
|
-
setTheme: () => {
|
|
2146
|
-
},
|
|
2147
|
-
setMode: () => {
|
|
2148
|
-
},
|
|
2149
|
-
toggleMode: () => {
|
|
2150
|
-
},
|
|
2151
|
-
availableThemes: BUILT_IN_THEMES,
|
|
2152
|
-
appliedTheme: "wireframe-light"
|
|
2153
|
-
};
|
|
2154
|
-
}
|
|
2155
|
-
return context;
|
|
2156
|
-
}
|
|
2157
|
-
var storeLog = createLogger("almadar:entity:store");
|
|
2158
|
-
var store = /* @__PURE__ */ new Map();
|
|
2159
|
-
var storeListeners = /* @__PURE__ */ new Set();
|
|
2160
|
-
var watchCallbacks = /* @__PURE__ */ new Map();
|
|
2161
|
-
function extractId(record) {
|
|
2162
|
-
const r = record;
|
|
2163
|
-
return String(r.id ?? r._id ?? r.key ?? "");
|
|
2164
|
-
}
|
|
2165
|
-
function materialize(snap) {
|
|
2166
|
-
return snap.ids.map((id) => snap.entities.get(id));
|
|
2167
|
-
}
|
|
2168
|
-
function notifyListeners3(entityType, prev) {
|
|
2169
|
-
for (const listener of storeListeners) {
|
|
2170
|
-
listener();
|
|
2171
|
-
}
|
|
2172
|
-
const cbs = watchCallbacks.get(entityType);
|
|
2173
|
-
if (cbs) {
|
|
2174
|
-
const oldData = prev ? materialize(prev) : [];
|
|
2175
|
-
const cur = store.get(entityType);
|
|
2176
|
-
const newData = cur ? materialize(cur) : [];
|
|
2177
|
-
for (const cb of cbs) {
|
|
2178
|
-
try {
|
|
2179
|
-
cb(oldData, newData);
|
|
2180
|
-
} catch {
|
|
2181
|
-
}
|
|
2182
|
-
}
|
|
2183
|
-
}
|
|
2184
|
-
}
|
|
2185
|
-
function setAll(entityType, records) {
|
|
2186
|
-
const entities = /* @__PURE__ */ new Map();
|
|
2187
|
-
const ids = [];
|
|
2188
|
-
for (const r of records) {
|
|
2189
|
-
const rec = r;
|
|
2190
|
-
const id = extractId(rec);
|
|
2191
|
-
if (id) {
|
|
2192
|
-
entities.set(id, rec);
|
|
2193
|
-
ids.push(id);
|
|
2194
|
-
}
|
|
2195
|
-
}
|
|
2196
|
-
const prev = store.get(entityType);
|
|
2197
|
-
const newVersion = (prev?.version ?? 0) + 1;
|
|
2198
|
-
store.set(entityType, { entities, ids, version: newVersion });
|
|
2199
|
-
storeLog.debug("setAll", { entityType, recordCount: records.length, version: newVersion });
|
|
2200
|
-
notifyListeners3(entityType, prev);
|
|
2201
|
-
}
|
|
2202
|
-
function upsertOne(entityType, record) {
|
|
2203
|
-
const id = extractId(record);
|
|
2204
|
-
if (!id) return;
|
|
2205
|
-
const prev = store.get(entityType);
|
|
2206
|
-
const snapshot = prev ? { entities: new Map(prev.entities), ids: [...prev.ids], version: prev.version } : { entities: /* @__PURE__ */ new Map(), ids: [], version: 0 };
|
|
2207
|
-
snapshot.entities.set(id, record);
|
|
2208
|
-
if (!snapshot.ids.includes(id)) snapshot.ids.push(id);
|
|
2209
|
-
snapshot.version++;
|
|
2210
|
-
store.set(entityType, snapshot);
|
|
2211
|
-
storeLog.debug("upsertOne", { entityType, id, version: snapshot.version });
|
|
2212
|
-
notifyListeners3(entityType, prev);
|
|
2213
|
-
}
|
|
2214
|
-
function addOne(entityType, record) {
|
|
2215
|
-
upsertOne(entityType, record);
|
|
2216
|
-
}
|
|
2217
|
-
function updateOne(entityType, id, changes) {
|
|
2218
|
-
const prev = store.get(entityType);
|
|
2219
|
-
if (!prev?.entities.has(id)) return;
|
|
2220
|
-
const snapshot = {
|
|
2221
|
-
entities: new Map(prev.entities),
|
|
2222
|
-
ids: [...prev.ids],
|
|
2223
|
-
version: prev.version
|
|
2224
|
-
};
|
|
2225
|
-
snapshot.entities.set(id, { ...snapshot.entities.get(id), ...changes });
|
|
2226
|
-
snapshot.version++;
|
|
2227
|
-
store.set(entityType, snapshot);
|
|
2228
|
-
storeLog.debug("updateOne", { entityType, id, changedFields: Object.keys(changes), version: snapshot.version });
|
|
2229
|
-
notifyListeners3(entityType, prev);
|
|
2230
|
-
}
|
|
2231
|
-
function removeOne(entityType, id) {
|
|
2232
|
-
const prev = store.get(entityType);
|
|
2233
|
-
if (!prev) return;
|
|
2234
|
-
const snapshot = {
|
|
2235
|
-
entities: new Map(prev.entities),
|
|
2236
|
-
ids: prev.ids.filter((i) => i !== id),
|
|
2237
|
-
version: prev.version
|
|
2238
|
-
};
|
|
2239
|
-
snapshot.entities.delete(id);
|
|
2240
|
-
snapshot.version++;
|
|
2241
|
-
store.set(entityType, snapshot);
|
|
2242
|
-
storeLog.debug("removeOne", { entityType, id, remainingCount: snapshot.ids.length, version: snapshot.version });
|
|
2243
|
-
notifyListeners3(entityType, prev);
|
|
2244
|
-
}
|
|
2245
|
-
function getSnapshot3(entityType) {
|
|
2246
|
-
const snap = store.get(entityType);
|
|
2247
|
-
if (!snap) return [];
|
|
2248
|
-
return materialize(snap);
|
|
2249
|
-
}
|
|
2250
|
-
function getById(entityType, id) {
|
|
2251
|
-
return store.get(entityType)?.entities.get(id) ?? null;
|
|
2252
|
-
}
|
|
2253
|
-
function getVersion(entityType) {
|
|
2254
|
-
return store.get(entityType)?.version ?? 0;
|
|
2255
|
-
}
|
|
2256
|
-
function subscribeToStore(listener) {
|
|
2257
|
-
storeListeners.add(listener);
|
|
2258
|
-
return () => {
|
|
2259
|
-
storeListeners.delete(listener);
|
|
2260
|
-
};
|
|
2261
|
-
}
|
|
2262
|
-
function useEntityRef(entityType) {
|
|
2263
|
-
const versionRef = useRef(0);
|
|
2264
|
-
const dataRef = useRef([]);
|
|
2265
|
-
const getSnapshotStable = React117__default.useCallback(() => {
|
|
2266
|
-
const currentVersion = getVersion(entityType);
|
|
2267
|
-
if (currentVersion !== versionRef.current) {
|
|
2268
|
-
versionRef.current = currentVersion;
|
|
2269
|
-
dataRef.current = getSnapshot3(entityType);
|
|
2270
|
-
}
|
|
2271
|
-
return dataRef.current;
|
|
2272
|
-
}, [entityType]);
|
|
2273
|
-
return useSyncExternalStore(subscribeToStore, getSnapshotStable, () => []);
|
|
2274
|
-
}
|
|
2275
|
-
var contextValue = {
|
|
2276
|
-
setAll,
|
|
2277
|
-
upsertOne,
|
|
2278
|
-
addOne,
|
|
2279
|
-
updateOne,
|
|
2280
|
-
removeOne,
|
|
2281
|
-
getSnapshot: getSnapshot3,
|
|
2282
|
-
getById
|
|
2283
|
-
};
|
|
2284
|
-
var EntityStoreContext = createContext(contextValue);
|
|
2285
|
-
function useEntityStore() {
|
|
2286
|
-
return useContext(EntityStoreContext);
|
|
2287
|
-
}
|
|
2288
|
-
function EntityStoreProvider({ children }) {
|
|
2289
|
-
return /* @__PURE__ */ jsx(EntityStoreContext.Provider, { value: contextValue, children });
|
|
2290
|
-
}
|
|
2291
|
-
var busLog = createLogger("almadar:eventbus");
|
|
2292
|
-
var subLog2 = createLogger("almadar:eventbus:subscribe");
|
|
2293
|
-
var EventBusContext2 = createContext(null);
|
|
2294
|
-
function EventBusProvider({ children, debug: debug2 = false }) {
|
|
2295
|
-
const listenersRef = useRef(/* @__PURE__ */ new Map());
|
|
2296
|
-
const anyListenersRef = useRef(/* @__PURE__ */ new Set());
|
|
2297
|
-
const deprecationWarningShown = useRef(false);
|
|
2298
|
-
const getSelectedEntity = useCallback(() => {
|
|
2299
|
-
if (!deprecationWarningShown.current) {
|
|
2300
|
-
console.warn(
|
|
2301
|
-
"[EventBus] getSelectedEntity is deprecated. Use SelectionProvider and useSelection hook instead. See SelectionProvider.tsx for migration guide."
|
|
2302
|
-
);
|
|
2303
|
-
deprecationWarningShown.current = true;
|
|
2304
|
-
}
|
|
2305
|
-
return null;
|
|
2306
|
-
}, []);
|
|
2307
|
-
const clearSelectedEntity = useCallback(() => {
|
|
2308
|
-
if (!deprecationWarningShown.current) {
|
|
2309
|
-
console.warn(
|
|
2310
|
-
"[EventBus] clearSelectedEntity is deprecated. Use SelectionProvider and useSelection hook instead. See SelectionProvider.tsx for migration guide."
|
|
2311
|
-
);
|
|
2312
|
-
deprecationWarningShown.current = true;
|
|
2313
|
-
}
|
|
2314
|
-
}, []);
|
|
2315
|
-
const emit = useCallback((type, payload) => {
|
|
2316
|
-
const event = {
|
|
2317
|
-
type,
|
|
2318
|
-
payload,
|
|
2319
|
-
timestamp: Date.now()
|
|
2320
|
-
};
|
|
2321
|
-
const listeners6 = listenersRef.current.get(type);
|
|
2322
|
-
const listenerCount = (listeners6?.size ?? 0) + anyListenersRef.current.size;
|
|
2323
|
-
busLog.debug("emit", { type, payloadKeys: payload ? Object.keys(payload).length : 0, listenerCount });
|
|
2324
|
-
if (debug2) {
|
|
2325
|
-
if (listenerCount > 0) {
|
|
2326
|
-
console.log(`[EventBus] Emit: ${type} \u2192 ${listenerCount} listener(s)`, payload);
|
|
2327
|
-
} else {
|
|
2328
|
-
console.warn(`[EventBus] Emit: ${type} (NO LISTENERS - event may be lost!)`, payload);
|
|
2329
|
-
}
|
|
2330
|
-
}
|
|
2331
|
-
if (listeners6) {
|
|
2332
|
-
const listenersCopy = Array.from(listeners6);
|
|
2333
|
-
for (const listener of listenersCopy) {
|
|
2334
|
-
try {
|
|
2335
|
-
listener(event);
|
|
2336
|
-
} catch (error) {
|
|
2337
|
-
console.error(`[EventBus] Error in listener for '${type}':`, error);
|
|
2338
|
-
}
|
|
2339
|
-
}
|
|
2340
|
-
}
|
|
2341
|
-
const anyListeners = Array.from(anyListenersRef.current);
|
|
2342
|
-
for (const listener of anyListeners) {
|
|
2343
|
-
try {
|
|
2344
|
-
listener(event);
|
|
2345
|
-
} catch (error) {
|
|
2346
|
-
console.error(`[EventBus] Error in onAny listener for '${type}':`, error);
|
|
2347
|
-
}
|
|
2348
|
-
}
|
|
2349
|
-
}, [debug2]);
|
|
2350
|
-
const on = useCallback((type, listener) => {
|
|
2351
|
-
if (!listenersRef.current.has(type)) {
|
|
2352
|
-
listenersRef.current.set(type, /* @__PURE__ */ new Set());
|
|
2353
|
-
}
|
|
2354
|
-
const listeners6 = listenersRef.current.get(type);
|
|
2355
|
-
listeners6.add(listener);
|
|
2356
|
-
subLog2.debug("subscribe", { type, totalListeners: listeners6.size });
|
|
2357
|
-
if (debug2) {
|
|
2358
|
-
console.log(`[EventBus] Subscribed to '${type}', total: ${listeners6.size}`);
|
|
2359
|
-
}
|
|
2360
|
-
return () => {
|
|
2361
|
-
listeners6.delete(listener);
|
|
2362
|
-
if (debug2) {
|
|
2363
|
-
console.log(`[EventBus] Unsubscribed from '${type}', remaining: ${listeners6.size}`);
|
|
2364
|
-
}
|
|
2365
|
-
if (listeners6.size === 0) {
|
|
2366
|
-
listenersRef.current.delete(type);
|
|
2367
|
-
}
|
|
2368
|
-
};
|
|
2369
|
-
}, [debug2]);
|
|
2370
|
-
const once = useCallback((type, listener) => {
|
|
2371
|
-
const wrappedListener = (event) => {
|
|
2372
|
-
listenersRef.current.get(type)?.delete(wrappedListener);
|
|
2373
|
-
listener(event);
|
|
2374
|
-
};
|
|
2375
|
-
return on(type, wrappedListener);
|
|
2376
|
-
}, [on]);
|
|
2377
|
-
const hasListeners = useCallback((type) => {
|
|
2378
|
-
const listeners6 = listenersRef.current.get(type);
|
|
2379
|
-
return listeners6 !== void 0 && listeners6.size > 0;
|
|
2380
|
-
}, []);
|
|
2381
|
-
const onAny = useCallback((listener) => {
|
|
2382
|
-
anyListenersRef.current.add(listener);
|
|
2383
|
-
subLog2.debug("subscribe:any", { totalAnyListeners: anyListenersRef.current.size });
|
|
2384
|
-
if (debug2) {
|
|
2385
|
-
console.log(`[EventBus] onAny subscribed, total: ${anyListenersRef.current.size}`);
|
|
2386
|
-
}
|
|
2387
|
-
return () => {
|
|
2388
|
-
anyListenersRef.current.delete(listener);
|
|
2389
|
-
if (debug2) {
|
|
2390
|
-
console.log(`[EventBus] onAny unsubscribed, remaining: ${anyListenersRef.current.size}`);
|
|
2391
|
-
}
|
|
2392
|
-
};
|
|
2393
|
-
}, [debug2]);
|
|
2394
|
-
const contextValue2 = useMemo(
|
|
2395
|
-
() => ({
|
|
2396
|
-
emit,
|
|
2397
|
-
on,
|
|
2398
|
-
once,
|
|
2399
|
-
hasListeners,
|
|
2400
|
-
onAny,
|
|
2401
|
-
getSelectedEntity,
|
|
2402
|
-
clearSelectedEntity
|
|
2403
|
-
}),
|
|
2404
|
-
[emit, on, once, hasListeners, onAny, getSelectedEntity, clearSelectedEntity]
|
|
2405
|
-
);
|
|
2406
|
-
useEffect(() => {
|
|
2407
|
-
setGlobalEventBus(contextValue2);
|
|
2408
|
-
return () => {
|
|
2409
|
-
setGlobalEventBus(null);
|
|
2410
|
-
};
|
|
2411
|
-
}, [contextValue2]);
|
|
2412
|
-
return /* @__PURE__ */ jsx(EventBusContext2.Provider, { value: contextValue2, children });
|
|
2413
|
-
}
|
|
2414
1790
|
var iconAliases = {
|
|
2415
1791
|
"close": LucideIcons.X,
|
|
2416
1792
|
"trash": LucideIcons.Trash2,
|
|
@@ -2957,7 +2333,7 @@ function resolveIconProp(value, sizeClass) {
|
|
|
2957
2333
|
const IconComp = value;
|
|
2958
2334
|
return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
|
|
2959
2335
|
}
|
|
2960
|
-
if (
|
|
2336
|
+
if (React114__default.isValidElement(value)) {
|
|
2961
2337
|
return value;
|
|
2962
2338
|
}
|
|
2963
2339
|
if (typeof value === "object" && value !== null && "render" in value) {
|
|
@@ -2966,7 +2342,7 @@ function resolveIconProp(value, sizeClass) {
|
|
|
2966
2342
|
}
|
|
2967
2343
|
return value;
|
|
2968
2344
|
}
|
|
2969
|
-
var Button =
|
|
2345
|
+
var Button = React114__default.forwardRef(
|
|
2970
2346
|
({
|
|
2971
2347
|
className,
|
|
2972
2348
|
variant = "primary",
|
|
@@ -3062,7 +2438,7 @@ var sizeStyles3 = {
|
|
|
3062
2438
|
md: "px-2.5 py-1 text-sm",
|
|
3063
2439
|
lg: "px-3 py-1.5 text-base"
|
|
3064
2440
|
};
|
|
3065
|
-
var Badge =
|
|
2441
|
+
var Badge = React114__default.forwardRef(
|
|
3066
2442
|
({ className, variant = "default", size = "sm", amount, label, icon, children, ...props }, ref) => {
|
|
3067
2443
|
const iconSizes2 = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
|
|
3068
2444
|
const resolvedIcon = typeof icon === "string" ? (() => {
|
|
@@ -3185,7 +2561,7 @@ var Toast = ({
|
|
|
3185
2561
|
);
|
|
3186
2562
|
};
|
|
3187
2563
|
Toast.displayName = "Toast";
|
|
3188
|
-
var Input =
|
|
2564
|
+
var Input = React114__default.forwardRef(
|
|
3189
2565
|
({
|
|
3190
2566
|
className,
|
|
3191
2567
|
inputType,
|
|
@@ -3297,7 +2673,7 @@ var Input = React117__default.forwardRef(
|
|
|
3297
2673
|
}
|
|
3298
2674
|
);
|
|
3299
2675
|
Input.displayName = "Input";
|
|
3300
|
-
var Label =
|
|
2676
|
+
var Label = React114__default.forwardRef(
|
|
3301
2677
|
({ className, required, children, ...props }, ref) => {
|
|
3302
2678
|
return /* @__PURE__ */ jsxs(
|
|
3303
2679
|
"label",
|
|
@@ -3317,7 +2693,7 @@ var Label = React117__default.forwardRef(
|
|
|
3317
2693
|
}
|
|
3318
2694
|
);
|
|
3319
2695
|
Label.displayName = "Label";
|
|
3320
|
-
var Textarea =
|
|
2696
|
+
var Textarea = React114__default.forwardRef(
|
|
3321
2697
|
({ className, error, ...props }, ref) => {
|
|
3322
2698
|
return /* @__PURE__ */ jsx(
|
|
3323
2699
|
"textarea",
|
|
@@ -3340,7 +2716,7 @@ var Textarea = React117__default.forwardRef(
|
|
|
3340
2716
|
}
|
|
3341
2717
|
);
|
|
3342
2718
|
Textarea.displayName = "Textarea";
|
|
3343
|
-
var Select =
|
|
2719
|
+
var Select = React114__default.forwardRef(
|
|
3344
2720
|
({ className, options, placeholder, error, ...props }, ref) => {
|
|
3345
2721
|
return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
3346
2722
|
/* @__PURE__ */ jsxs(
|
|
@@ -3376,7 +2752,7 @@ var Select = React117__default.forwardRef(
|
|
|
3376
2752
|
}
|
|
3377
2753
|
);
|
|
3378
2754
|
Select.displayName = "Select";
|
|
3379
|
-
var Checkbox =
|
|
2755
|
+
var Checkbox = React114__default.forwardRef(
|
|
3380
2756
|
({ className, label, id, ...props }, ref) => {
|
|
3381
2757
|
const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
|
|
3382
2758
|
return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
@@ -3452,7 +2828,7 @@ var shadowStyles2 = {
|
|
|
3452
2828
|
md: "shadow",
|
|
3453
2829
|
lg: "shadow-lg"
|
|
3454
2830
|
};
|
|
3455
|
-
var Card =
|
|
2831
|
+
var Card = React114__default.forwardRef(
|
|
3456
2832
|
({
|
|
3457
2833
|
className,
|
|
3458
2834
|
variant = "bordered",
|
|
@@ -3488,9 +2864,9 @@ var Card = React117__default.forwardRef(
|
|
|
3488
2864
|
}
|
|
3489
2865
|
);
|
|
3490
2866
|
Card.displayName = "Card";
|
|
3491
|
-
var CardHeader =
|
|
2867
|
+
var CardHeader = React114__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
|
|
3492
2868
|
CardHeader.displayName = "CardHeader";
|
|
3493
|
-
var CardTitle =
|
|
2869
|
+
var CardTitle = React114__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
3494
2870
|
"h3",
|
|
3495
2871
|
{
|
|
3496
2872
|
ref,
|
|
@@ -3503,11 +2879,11 @@ var CardTitle = React117__default.forwardRef(({ className, ...props }, ref) => /
|
|
|
3503
2879
|
}
|
|
3504
2880
|
));
|
|
3505
2881
|
CardTitle.displayName = "CardTitle";
|
|
3506
|
-
var CardContent =
|
|
2882
|
+
var CardContent = React114__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
|
|
3507
2883
|
CardContent.displayName = "CardContent";
|
|
3508
2884
|
var CardBody = CardContent;
|
|
3509
2885
|
CardBody.displayName = "CardBody";
|
|
3510
|
-
var CardFooter =
|
|
2886
|
+
var CardFooter = React114__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
3511
2887
|
"div",
|
|
3512
2888
|
{
|
|
3513
2889
|
ref,
|
|
@@ -3522,7 +2898,7 @@ var sizeStyles4 = {
|
|
|
3522
2898
|
md: "h-6 w-6",
|
|
3523
2899
|
lg: "h-8 w-8"
|
|
3524
2900
|
};
|
|
3525
|
-
var Spinner =
|
|
2901
|
+
var Spinner = React114__default.forwardRef(
|
|
3526
2902
|
({ className, size = "md", ...props }, ref) => {
|
|
3527
2903
|
return /* @__PURE__ */ jsx(
|
|
3528
2904
|
"div",
|
|
@@ -3938,7 +3314,7 @@ var ProgressBar = ({
|
|
|
3938
3314
|
return null;
|
|
3939
3315
|
};
|
|
3940
3316
|
ProgressBar.displayName = "ProgressBar";
|
|
3941
|
-
var Radio =
|
|
3317
|
+
var Radio = React114__default.forwardRef(
|
|
3942
3318
|
({
|
|
3943
3319
|
label,
|
|
3944
3320
|
helperText,
|
|
@@ -4042,7 +3418,7 @@ var Radio = React117__default.forwardRef(
|
|
|
4042
3418
|
}
|
|
4043
3419
|
);
|
|
4044
3420
|
Radio.displayName = "Radio";
|
|
4045
|
-
var Switch =
|
|
3421
|
+
var Switch = React114.forwardRef(
|
|
4046
3422
|
({
|
|
4047
3423
|
checked,
|
|
4048
3424
|
defaultChecked = false,
|
|
@@ -4053,10 +3429,10 @@ var Switch = React117.forwardRef(
|
|
|
4053
3429
|
name,
|
|
4054
3430
|
className
|
|
4055
3431
|
}, ref) => {
|
|
4056
|
-
const [isChecked, setIsChecked] =
|
|
3432
|
+
const [isChecked, setIsChecked] = React114.useState(
|
|
4057
3433
|
checked !== void 0 ? checked : defaultChecked
|
|
4058
3434
|
);
|
|
4059
|
-
|
|
3435
|
+
React114.useEffect(() => {
|
|
4060
3436
|
if (checked !== void 0) {
|
|
4061
3437
|
setIsChecked(checked);
|
|
4062
3438
|
}
|
|
@@ -4287,6 +3663,125 @@ var TextHighlight = ({
|
|
|
4287
3663
|
);
|
|
4288
3664
|
};
|
|
4289
3665
|
TextHighlight.displayName = "TextHighlight";
|
|
3666
|
+
var BUILT_IN_THEMES = [
|
|
3667
|
+
{
|
|
3668
|
+
name: "wireframe",
|
|
3669
|
+
displayName: "Wireframe",
|
|
3670
|
+
hasLightMode: true,
|
|
3671
|
+
hasDarkMode: true
|
|
3672
|
+
},
|
|
3673
|
+
{
|
|
3674
|
+
name: "minimalist",
|
|
3675
|
+
displayName: "Minimalist",
|
|
3676
|
+
hasLightMode: true,
|
|
3677
|
+
hasDarkMode: true
|
|
3678
|
+
},
|
|
3679
|
+
{
|
|
3680
|
+
name: "almadar",
|
|
3681
|
+
displayName: "Almadar",
|
|
3682
|
+
hasLightMode: true,
|
|
3683
|
+
hasDarkMode: true
|
|
3684
|
+
},
|
|
3685
|
+
{
|
|
3686
|
+
name: "trait-wars",
|
|
3687
|
+
displayName: "Trait Wars",
|
|
3688
|
+
hasLightMode: false,
|
|
3689
|
+
hasDarkMode: true
|
|
3690
|
+
},
|
|
3691
|
+
// Extended themes
|
|
3692
|
+
{
|
|
3693
|
+
name: "ocean",
|
|
3694
|
+
displayName: "Ocean",
|
|
3695
|
+
hasLightMode: true,
|
|
3696
|
+
hasDarkMode: true
|
|
3697
|
+
},
|
|
3698
|
+
{
|
|
3699
|
+
name: "forest",
|
|
3700
|
+
displayName: "Forest",
|
|
3701
|
+
hasLightMode: true,
|
|
3702
|
+
hasDarkMode: true
|
|
3703
|
+
},
|
|
3704
|
+
{
|
|
3705
|
+
name: "sunset",
|
|
3706
|
+
displayName: "Sunset",
|
|
3707
|
+
hasLightMode: true,
|
|
3708
|
+
hasDarkMode: true
|
|
3709
|
+
},
|
|
3710
|
+
{
|
|
3711
|
+
name: "lavender",
|
|
3712
|
+
displayName: "Lavender",
|
|
3713
|
+
hasLightMode: true,
|
|
3714
|
+
hasDarkMode: true
|
|
3715
|
+
},
|
|
3716
|
+
{
|
|
3717
|
+
name: "rose",
|
|
3718
|
+
displayName: "Rose",
|
|
3719
|
+
hasLightMode: true,
|
|
3720
|
+
hasDarkMode: true
|
|
3721
|
+
},
|
|
3722
|
+
{
|
|
3723
|
+
name: "slate",
|
|
3724
|
+
displayName: "Slate",
|
|
3725
|
+
hasLightMode: true,
|
|
3726
|
+
hasDarkMode: true
|
|
3727
|
+
},
|
|
3728
|
+
{
|
|
3729
|
+
name: "ember",
|
|
3730
|
+
displayName: "Ember",
|
|
3731
|
+
hasLightMode: true,
|
|
3732
|
+
hasDarkMode: true
|
|
3733
|
+
},
|
|
3734
|
+
{
|
|
3735
|
+
name: "midnight",
|
|
3736
|
+
displayName: "Midnight",
|
|
3737
|
+
hasLightMode: true,
|
|
3738
|
+
hasDarkMode: true
|
|
3739
|
+
},
|
|
3740
|
+
{
|
|
3741
|
+
name: "sand",
|
|
3742
|
+
displayName: "Sand",
|
|
3743
|
+
hasLightMode: true,
|
|
3744
|
+
hasDarkMode: true
|
|
3745
|
+
},
|
|
3746
|
+
{
|
|
3747
|
+
name: "neon",
|
|
3748
|
+
displayName: "Neon",
|
|
3749
|
+
hasLightMode: true,
|
|
3750
|
+
hasDarkMode: true
|
|
3751
|
+
},
|
|
3752
|
+
{
|
|
3753
|
+
name: "arctic",
|
|
3754
|
+
displayName: "Arctic",
|
|
3755
|
+
hasLightMode: true,
|
|
3756
|
+
hasDarkMode: true
|
|
3757
|
+
},
|
|
3758
|
+
{
|
|
3759
|
+
name: "copper",
|
|
3760
|
+
displayName: "Copper",
|
|
3761
|
+
hasLightMode: true,
|
|
3762
|
+
hasDarkMode: true
|
|
3763
|
+
}
|
|
3764
|
+
];
|
|
3765
|
+
var ThemeContext = createContext(void 0);
|
|
3766
|
+
function useTheme() {
|
|
3767
|
+
const context = useContext(ThemeContext);
|
|
3768
|
+
if (context === void 0) {
|
|
3769
|
+
return {
|
|
3770
|
+
theme: "wireframe",
|
|
3771
|
+
mode: "light",
|
|
3772
|
+
resolvedMode: "light",
|
|
3773
|
+
setTheme: () => {
|
|
3774
|
+
},
|
|
3775
|
+
setMode: () => {
|
|
3776
|
+
},
|
|
3777
|
+
toggleMode: () => {
|
|
3778
|
+
},
|
|
3779
|
+
availableThemes: BUILT_IN_THEMES,
|
|
3780
|
+
appliedTheme: "wireframe-light"
|
|
3781
|
+
};
|
|
3782
|
+
}
|
|
3783
|
+
return context;
|
|
3784
|
+
}
|
|
4290
3785
|
var sizeClasses4 = {
|
|
4291
3786
|
sm: "p-1.5",
|
|
4292
3787
|
md: "p-2",
|
|
@@ -4421,8 +3916,8 @@ var LawReferenceTooltip = ({
|
|
|
4421
3916
|
position = "top",
|
|
4422
3917
|
className
|
|
4423
3918
|
}) => {
|
|
4424
|
-
const [isVisible, setIsVisible] =
|
|
4425
|
-
const timeoutRef =
|
|
3919
|
+
const [isVisible, setIsVisible] = React114__default.useState(false);
|
|
3920
|
+
const timeoutRef = React114__default.useRef(null);
|
|
4426
3921
|
const handleMouseEnter = () => {
|
|
4427
3922
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
4428
3923
|
timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
|
|
@@ -4431,7 +3926,7 @@ var LawReferenceTooltip = ({
|
|
|
4431
3926
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
4432
3927
|
setIsVisible(false);
|
|
4433
3928
|
};
|
|
4434
|
-
|
|
3929
|
+
React114__default.useEffect(() => {
|
|
4435
3930
|
return () => {
|
|
4436
3931
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
4437
3932
|
};
|
|
@@ -4619,7 +4114,7 @@ var sizeStyles5 = {
|
|
|
4619
4114
|
md: "w-2.5 h-2.5",
|
|
4620
4115
|
lg: "w-3 h-3"
|
|
4621
4116
|
};
|
|
4622
|
-
var StatusDot =
|
|
4117
|
+
var StatusDot = React114__default.forwardRef(
|
|
4623
4118
|
({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
|
|
4624
4119
|
return /* @__PURE__ */ jsx(
|
|
4625
4120
|
"span",
|
|
@@ -4666,7 +4161,7 @@ var iconMap2 = {
|
|
|
4666
4161
|
down: TrendingDown,
|
|
4667
4162
|
flat: ArrowRight
|
|
4668
4163
|
};
|
|
4669
|
-
var TrendIndicator =
|
|
4164
|
+
var TrendIndicator = React114__default.forwardRef(
|
|
4670
4165
|
({
|
|
4671
4166
|
className,
|
|
4672
4167
|
value,
|
|
@@ -4725,7 +4220,7 @@ var thumbSizes = {
|
|
|
4725
4220
|
md: "w-4 h-4",
|
|
4726
4221
|
lg: "w-5 h-5"
|
|
4727
4222
|
};
|
|
4728
|
-
var RangeSlider =
|
|
4223
|
+
var RangeSlider = React114__default.forwardRef(
|
|
4729
4224
|
({
|
|
4730
4225
|
className,
|
|
4731
4226
|
min = 0,
|
|
@@ -5176,7 +4671,7 @@ var paddingClasses = {
|
|
|
5176
4671
|
md: "py-16",
|
|
5177
4672
|
lg: "py-24"
|
|
5178
4673
|
};
|
|
5179
|
-
var ContentSection =
|
|
4674
|
+
var ContentSection = React114__default.forwardRef(
|
|
5180
4675
|
({ children, background = "default", padding = "lg", id, className }, ref) => {
|
|
5181
4676
|
return /* @__PURE__ */ jsx(
|
|
5182
4677
|
Box,
|
|
@@ -5215,7 +4710,7 @@ var animatedStyles = {
|
|
|
5215
4710
|
"scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
|
|
5216
4711
|
"none": {}
|
|
5217
4712
|
};
|
|
5218
|
-
var AnimatedReveal =
|
|
4713
|
+
var AnimatedReveal = React114__default.forwardRef(
|
|
5219
4714
|
({
|
|
5220
4715
|
trigger = "scroll",
|
|
5221
4716
|
animation = "fade-up",
|
|
@@ -5368,7 +4863,7 @@ function applyMorphAnimation(container, animate, duration, delay, easing) {
|
|
|
5368
4863
|
el.style.opacity = animate ? "1" : "0";
|
|
5369
4864
|
});
|
|
5370
4865
|
}
|
|
5371
|
-
var AnimatedGraphic =
|
|
4866
|
+
var AnimatedGraphic = React114__default.forwardRef(
|
|
5372
4867
|
({
|
|
5373
4868
|
src,
|
|
5374
4869
|
svgContent,
|
|
@@ -5391,7 +4886,7 @@ var AnimatedGraphic = React117__default.forwardRef(
|
|
|
5391
4886
|
const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
|
|
5392
4887
|
const resolvedSvg = svgContent ?? fetchedSvg;
|
|
5393
4888
|
const prevAnimateRef = useRef(animate);
|
|
5394
|
-
const setRef =
|
|
4889
|
+
const setRef = React114__default.useCallback(
|
|
5395
4890
|
(node) => {
|
|
5396
4891
|
containerRef.current = node;
|
|
5397
4892
|
if (typeof ref === "function") ref(node);
|
|
@@ -5562,9 +5057,9 @@ function ScoreDisplay({
|
|
|
5562
5057
|
...rest
|
|
5563
5058
|
}) {
|
|
5564
5059
|
const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
|
|
5565
|
-
const [displayValue, setDisplayValue] =
|
|
5566
|
-
const [isAnimating, setIsAnimating] =
|
|
5567
|
-
|
|
5060
|
+
const [displayValue, setDisplayValue] = React114.useState(resolvedValue);
|
|
5061
|
+
const [isAnimating, setIsAnimating] = React114.useState(false);
|
|
5062
|
+
React114.useEffect(() => {
|
|
5568
5063
|
if (!animated || displayValue === resolvedValue) {
|
|
5569
5064
|
setDisplayValue(resolvedValue);
|
|
5570
5065
|
return;
|
|
@@ -5637,9 +5132,9 @@ function ControlButton({
|
|
|
5637
5132
|
className
|
|
5638
5133
|
}) {
|
|
5639
5134
|
const eventBus = useEventBus();
|
|
5640
|
-
const [isPressed, setIsPressed] =
|
|
5135
|
+
const [isPressed, setIsPressed] = React114.useState(false);
|
|
5641
5136
|
const actualPressed = pressed ?? isPressed;
|
|
5642
|
-
const handlePointerDown =
|
|
5137
|
+
const handlePointerDown = React114.useCallback(
|
|
5643
5138
|
(e) => {
|
|
5644
5139
|
e.preventDefault();
|
|
5645
5140
|
if (disabled) return;
|
|
@@ -5649,7 +5144,7 @@ function ControlButton({
|
|
|
5649
5144
|
},
|
|
5650
5145
|
[disabled, pressEvent, eventBus, onPress]
|
|
5651
5146
|
);
|
|
5652
|
-
const handlePointerUp =
|
|
5147
|
+
const handlePointerUp = React114.useCallback(
|
|
5653
5148
|
(e) => {
|
|
5654
5149
|
e.preventDefault();
|
|
5655
5150
|
if (disabled) return;
|
|
@@ -5659,7 +5154,7 @@ function ControlButton({
|
|
|
5659
5154
|
},
|
|
5660
5155
|
[disabled, releaseEvent, eventBus, onRelease]
|
|
5661
5156
|
);
|
|
5662
|
-
const handlePointerLeave =
|
|
5157
|
+
const handlePointerLeave = React114.useCallback(
|
|
5663
5158
|
(e) => {
|
|
5664
5159
|
if (isPressed) {
|
|
5665
5160
|
setIsPressed(false);
|
|
@@ -6449,9 +5944,9 @@ function MiniMap({
|
|
|
6449
5944
|
viewportRect,
|
|
6450
5945
|
className
|
|
6451
5946
|
}) {
|
|
6452
|
-
const canvasRef =
|
|
6453
|
-
const frameRef =
|
|
6454
|
-
|
|
5947
|
+
const canvasRef = React114.useRef(null);
|
|
5948
|
+
const frameRef = React114.useRef(0);
|
|
5949
|
+
React114.useEffect(() => {
|
|
6455
5950
|
const canvas = canvasRef.current;
|
|
6456
5951
|
if (!canvas) return;
|
|
6457
5952
|
const ctx = canvas.getContext("2d");
|
|
@@ -6560,7 +6055,7 @@ var ErrorState = ({
|
|
|
6560
6055
|
);
|
|
6561
6056
|
};
|
|
6562
6057
|
ErrorState.displayName = "ErrorState";
|
|
6563
|
-
var ErrorBoundary = class extends
|
|
6058
|
+
var ErrorBoundary = class extends React114__default.Component {
|
|
6564
6059
|
constructor(props) {
|
|
6565
6060
|
super(props);
|
|
6566
6061
|
__publicField(this, "reset", () => {
|
|
@@ -6943,8 +6438,8 @@ var Tooltip = ({
|
|
|
6943
6438
|
if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
|
|
6944
6439
|
};
|
|
6945
6440
|
}, []);
|
|
6946
|
-
const triggerElement =
|
|
6947
|
-
const trigger =
|
|
6441
|
+
const triggerElement = React114__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
|
|
6442
|
+
const trigger = React114__default.cloneElement(triggerElement, {
|
|
6948
6443
|
ref: triggerRef,
|
|
6949
6444
|
onMouseEnter: handleMouseEnter,
|
|
6950
6445
|
onMouseLeave: handleMouseLeave,
|
|
@@ -7057,8 +6552,8 @@ var Popover = ({
|
|
|
7057
6552
|
onMouseEnter: handleOpen,
|
|
7058
6553
|
onMouseLeave: handleClose
|
|
7059
6554
|
};
|
|
7060
|
-
const childElement =
|
|
7061
|
-
const triggerElement =
|
|
6555
|
+
const childElement = React114__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
|
|
6556
|
+
const triggerElement = React114__default.cloneElement(
|
|
7062
6557
|
childElement,
|
|
7063
6558
|
{
|
|
7064
6559
|
ref: triggerRef,
|
|
@@ -7162,8 +6657,8 @@ var Menu = ({
|
|
|
7162
6657
|
"bottom-start": "top-full left-0 mt-2",
|
|
7163
6658
|
"bottom-end": "top-full right-0 mt-2"
|
|
7164
6659
|
};
|
|
7165
|
-
const triggerChild =
|
|
7166
|
-
const triggerElement =
|
|
6660
|
+
const triggerChild = React114__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
|
|
6661
|
+
const triggerElement = React114__default.cloneElement(
|
|
7167
6662
|
triggerChild,
|
|
7168
6663
|
{
|
|
7169
6664
|
ref: triggerRef,
|
|
@@ -7863,7 +7358,7 @@ function InputPattern({
|
|
|
7863
7358
|
className
|
|
7864
7359
|
}) {
|
|
7865
7360
|
const { emit } = useEventBus();
|
|
7866
|
-
const [localValue, setLocalValue] =
|
|
7361
|
+
const [localValue, setLocalValue] = React114__default.useState(value);
|
|
7867
7362
|
const handleChange = (e) => {
|
|
7868
7363
|
setLocalValue(e.target.value);
|
|
7869
7364
|
if (onChange) {
|
|
@@ -7900,7 +7395,7 @@ function TextareaPattern({
|
|
|
7900
7395
|
className
|
|
7901
7396
|
}) {
|
|
7902
7397
|
const { emit } = useEventBus();
|
|
7903
|
-
const [localValue, setLocalValue] =
|
|
7398
|
+
const [localValue, setLocalValue] = React114__default.useState(value);
|
|
7904
7399
|
const handleChange = (e) => {
|
|
7905
7400
|
setLocalValue(e.target.value);
|
|
7906
7401
|
if (onChange) {
|
|
@@ -7931,7 +7426,7 @@ function SelectPattern({
|
|
|
7931
7426
|
className
|
|
7932
7427
|
}) {
|
|
7933
7428
|
const { emit } = useEventBus();
|
|
7934
|
-
const [localValue, setLocalValue] =
|
|
7429
|
+
const [localValue, setLocalValue] = React114__default.useState(value);
|
|
7935
7430
|
const handleChange = (e) => {
|
|
7936
7431
|
setLocalValue(e.target.value);
|
|
7937
7432
|
if (onChange) {
|
|
@@ -7960,7 +7455,7 @@ function CheckboxPattern({
|
|
|
7960
7455
|
className
|
|
7961
7456
|
}) {
|
|
7962
7457
|
const { emit } = useEventBus();
|
|
7963
|
-
const [localChecked, setLocalChecked] =
|
|
7458
|
+
const [localChecked, setLocalChecked] = React114__default.useState(checked);
|
|
7964
7459
|
const handleChange = (e) => {
|
|
7965
7460
|
setLocalChecked(e.target.checked);
|
|
7966
7461
|
if (onChange) {
|
|
@@ -8161,8 +7656,8 @@ function ActionButtons({
|
|
|
8161
7656
|
disabled
|
|
8162
7657
|
}) {
|
|
8163
7658
|
const eventBus = useEventBus();
|
|
8164
|
-
const [activeButtons, setActiveButtons] =
|
|
8165
|
-
const handlePress =
|
|
7659
|
+
const [activeButtons, setActiveButtons] = React114.useState(/* @__PURE__ */ new Set());
|
|
7660
|
+
const handlePress = React114.useCallback(
|
|
8166
7661
|
(id) => {
|
|
8167
7662
|
setActiveButtons((prev) => new Set(prev).add(id));
|
|
8168
7663
|
if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
|
|
@@ -8170,7 +7665,7 @@ function ActionButtons({
|
|
|
8170
7665
|
},
|
|
8171
7666
|
[actionEvent, eventBus, onAction]
|
|
8172
7667
|
);
|
|
8173
|
-
const handleRelease =
|
|
7668
|
+
const handleRelease = React114.useCallback(
|
|
8174
7669
|
(id) => {
|
|
8175
7670
|
setActiveButtons((prev) => {
|
|
8176
7671
|
const next = new Set(prev);
|
|
@@ -9834,7 +9329,7 @@ var ScaledDiagram = ({
|
|
|
9834
9329
|
);
|
|
9835
9330
|
};
|
|
9836
9331
|
ScaledDiagram.displayName = "ScaledDiagram";
|
|
9837
|
-
var MarkdownContent =
|
|
9332
|
+
var MarkdownContent = React114__default.memo(
|
|
9838
9333
|
({ content, direction, className }) => {
|
|
9839
9334
|
const { t: _t } = useTranslate();
|
|
9840
9335
|
const safeContent = typeof content === "string" ? content : String(content ?? "");
|
|
@@ -10017,7 +9512,7 @@ function computeFoldRegions(code) {
|
|
|
10017
9512
|
}
|
|
10018
9513
|
var LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
|
|
10019
9514
|
var HIDDEN_LINE_NUMBERS = { display: "none" };
|
|
10020
|
-
var CodeBlock =
|
|
9515
|
+
var CodeBlock = React114__default.memo(
|
|
10021
9516
|
({
|
|
10022
9517
|
code: rawCode,
|
|
10023
9518
|
language = "text",
|
|
@@ -11070,7 +10565,7 @@ var StateMachineView = ({
|
|
|
11070
10565
|
style: { top: title ? 30 : 0 },
|
|
11071
10566
|
children: [
|
|
11072
10567
|
entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
|
|
11073
|
-
states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(
|
|
10568
|
+
states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React114__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
|
|
11074
10569
|
StateNode,
|
|
11075
10570
|
{
|
|
11076
10571
|
state,
|
|
@@ -16407,7 +15902,7 @@ function CraftingRecipe({
|
|
|
16407
15902
|
className
|
|
16408
15903
|
}) {
|
|
16409
15904
|
const eventBus = useEventBus();
|
|
16410
|
-
const handleCraft =
|
|
15905
|
+
const handleCraft = React114.useCallback(() => {
|
|
16411
15906
|
onCraft?.();
|
|
16412
15907
|
if (craftEvent) {
|
|
16413
15908
|
eventBus.emit(craftEvent, { output: output.label });
|
|
@@ -16424,7 +15919,7 @@ function CraftingRecipe({
|
|
|
16424
15919
|
children: [
|
|
16425
15920
|
/* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap items-center", children: inputs.map((ingredient, index) => {
|
|
16426
15921
|
const hasSufficient = ingredient.available >= ingredient.required;
|
|
16427
|
-
return /* @__PURE__ */ jsxs(
|
|
15922
|
+
return /* @__PURE__ */ jsxs(React114.Fragment, { children: [
|
|
16428
15923
|
/* @__PURE__ */ jsx(Box, { className: "relative", children: /* @__PURE__ */ jsx(
|
|
16429
15924
|
ItemSlot,
|
|
16430
15925
|
{
|
|
@@ -16703,8 +16198,8 @@ function DPad({
|
|
|
16703
16198
|
}) {
|
|
16704
16199
|
const eventBus = useEventBus();
|
|
16705
16200
|
const sizes = sizeMap15[size];
|
|
16706
|
-
const [activeDirections, setActiveDirections] =
|
|
16707
|
-
const handlePress =
|
|
16201
|
+
const [activeDirections, setActiveDirections] = React114.useState(/* @__PURE__ */ new Set());
|
|
16202
|
+
const handlePress = React114.useCallback(
|
|
16708
16203
|
(direction) => {
|
|
16709
16204
|
setActiveDirections((prev) => new Set(prev).add(direction));
|
|
16710
16205
|
if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
|
|
@@ -16712,7 +16207,7 @@ function DPad({
|
|
|
16712
16207
|
},
|
|
16713
16208
|
[directionEvent, eventBus, onDirection]
|
|
16714
16209
|
);
|
|
16715
|
-
const handleRelease =
|
|
16210
|
+
const handleRelease = React114.useCallback(
|
|
16716
16211
|
(direction) => {
|
|
16717
16212
|
setActiveDirections((prev) => {
|
|
16718
16213
|
const next = new Set(prev);
|
|
@@ -17489,7 +16984,7 @@ var DataList = ({
|
|
|
17489
16984
|
}) => {
|
|
17490
16985
|
const eventBus = useEventBus();
|
|
17491
16986
|
const { t } = useTranslate();
|
|
17492
|
-
const [visibleCount, setVisibleCount] =
|
|
16987
|
+
const [visibleCount, setVisibleCount] = React114__default.useState(pageSize || Infinity);
|
|
17493
16988
|
const fields = fieldsProp ?? columnsProp ?? [];
|
|
17494
16989
|
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
17495
16990
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
@@ -17526,7 +17021,7 @@ var DataList = ({
|
|
|
17526
17021
|
const items2 = data.map((item) => item);
|
|
17527
17022
|
const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
|
|
17528
17023
|
const contentField = titleField?.name ?? fields[0]?.name ?? "";
|
|
17529
|
-
return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(
|
|
17024
|
+
return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
|
|
17530
17025
|
group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
|
|
17531
17026
|
group.items.map((itemData, index) => {
|
|
17532
17027
|
const id = itemData.id || `${gi}-${index}`;
|
|
@@ -17729,7 +17224,7 @@ var DataList = ({
|
|
|
17729
17224
|
className
|
|
17730
17225
|
),
|
|
17731
17226
|
children: [
|
|
17732
|
-
groups.map((group, gi) => /* @__PURE__ */ jsxs(
|
|
17227
|
+
groups.map((group, gi) => /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
|
|
17733
17228
|
group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
|
|
17734
17229
|
group.items.map(
|
|
17735
17230
|
(itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
|
|
@@ -18698,7 +18193,7 @@ var WizardProgress = ({
|
|
|
18698
18193
|
children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: steps.map((step, index) => {
|
|
18699
18194
|
const isActive = index === currentStep;
|
|
18700
18195
|
const isCompleted = index < currentStep;
|
|
18701
|
-
return /* @__PURE__ */ jsxs(
|
|
18196
|
+
return /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
|
|
18702
18197
|
/* @__PURE__ */ jsx(
|
|
18703
18198
|
"button",
|
|
18704
18199
|
{
|
|
@@ -19523,7 +19018,7 @@ function InventoryGrid({
|
|
|
19523
19018
|
const eventBus = useEventBus();
|
|
19524
19019
|
const slotCount = totalSlots ?? items.length;
|
|
19525
19020
|
const emptySlotCount = Math.max(0, slotCount - items.length);
|
|
19526
|
-
const handleSelect =
|
|
19021
|
+
const handleSelect = React114.useCallback(
|
|
19527
19022
|
(id) => {
|
|
19528
19023
|
onSelect?.(id);
|
|
19529
19024
|
if (selectEvent) {
|
|
@@ -19696,15 +19191,15 @@ function GameCanvas2D({
|
|
|
19696
19191
|
fps = 60,
|
|
19697
19192
|
className
|
|
19698
19193
|
}) {
|
|
19699
|
-
const canvasRef =
|
|
19700
|
-
const rafRef =
|
|
19701
|
-
const frameRef =
|
|
19702
|
-
const lastTimeRef =
|
|
19703
|
-
const onDrawRef =
|
|
19194
|
+
const canvasRef = React114.useRef(null);
|
|
19195
|
+
const rafRef = React114.useRef(0);
|
|
19196
|
+
const frameRef = React114.useRef(0);
|
|
19197
|
+
const lastTimeRef = React114.useRef(0);
|
|
19198
|
+
const onDrawRef = React114.useRef(onDraw);
|
|
19704
19199
|
onDrawRef.current = onDraw;
|
|
19705
|
-
const onTickRef =
|
|
19200
|
+
const onTickRef = React114.useRef(onTick);
|
|
19706
19201
|
onTickRef.current = onTick;
|
|
19707
|
-
|
|
19202
|
+
React114.useEffect(() => {
|
|
19708
19203
|
const canvas = canvasRef.current;
|
|
19709
19204
|
if (!canvas) return;
|
|
19710
19205
|
const ctx = canvas.getContext("2d");
|
|
@@ -19957,7 +19452,7 @@ function TurnPanel({
|
|
|
19957
19452
|
className
|
|
19958
19453
|
}) {
|
|
19959
19454
|
const eventBus = useEventBus();
|
|
19960
|
-
const handleAction =
|
|
19455
|
+
const handleAction = React114.useCallback(
|
|
19961
19456
|
(event) => {
|
|
19962
19457
|
if (event) {
|
|
19963
19458
|
eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
|
|
@@ -20082,7 +19577,7 @@ function UnitCommandBar({
|
|
|
20082
19577
|
className
|
|
20083
19578
|
}) {
|
|
20084
19579
|
const eventBus = useEventBus();
|
|
20085
|
-
const handleCommand =
|
|
19580
|
+
const handleCommand = React114.useCallback(
|
|
20086
19581
|
(event) => {
|
|
20087
19582
|
if (event) {
|
|
20088
19583
|
eventBus.emit(event, { unitId: selectedUnitId });
|
|
@@ -20541,7 +20036,7 @@ function GameMenu({
|
|
|
20541
20036
|
} catch {
|
|
20542
20037
|
}
|
|
20543
20038
|
const eventBus = eventBusProp || eventBusFromHook;
|
|
20544
|
-
const handleOptionClick =
|
|
20039
|
+
const handleOptionClick = React114.useCallback(
|
|
20545
20040
|
(option) => {
|
|
20546
20041
|
if (option.event && eventBus) {
|
|
20547
20042
|
eventBus.emit(`UI:${option.event}`, { option });
|
|
@@ -20664,7 +20159,7 @@ function GameOverScreen({
|
|
|
20664
20159
|
} catch {
|
|
20665
20160
|
}
|
|
20666
20161
|
const eventBus = eventBusProp || eventBusFromHook;
|
|
20667
|
-
const handleActionClick =
|
|
20162
|
+
const handleActionClick = React114.useCallback(
|
|
20668
20163
|
(action) => {
|
|
20669
20164
|
if (action.event && eventBus) {
|
|
20670
20165
|
eventBus.emit(`UI:${action.event}`, { action });
|
|
@@ -23764,7 +23259,7 @@ var DocumentViewer = ({
|
|
|
23764
23259
|
};
|
|
23765
23260
|
DocumentViewer.displayName = "DocumentViewer";
|
|
23766
23261
|
function extractTitle(children) {
|
|
23767
|
-
if (!
|
|
23262
|
+
if (!React114__default.isValidElement(children)) return void 0;
|
|
23768
23263
|
const props = children.props;
|
|
23769
23264
|
if (typeof props.title === "string") {
|
|
23770
23265
|
return props.title;
|
|
@@ -23816,7 +23311,7 @@ function LinearView({
|
|
|
23816
23311
|
/* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
|
|
23817
23312
|
const isDone = i < currentIdx;
|
|
23818
23313
|
const isCurrent = i === currentIdx;
|
|
23819
|
-
return /* @__PURE__ */ jsxs(
|
|
23314
|
+
return /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
|
|
23820
23315
|
i > 0 && /* @__PURE__ */ jsx(
|
|
23821
23316
|
Typography,
|
|
23822
23317
|
{
|
|
@@ -24482,7 +23977,7 @@ var Form = ({
|
|
|
24482
23977
|
const normalizedInitialData = initialData ?? {};
|
|
24483
23978
|
const resolvedEntity = entity && typeof entity === "object" && !Array.isArray(entity) ? entity : void 0;
|
|
24484
23979
|
const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
|
|
24485
|
-
const entityDerivedFields =
|
|
23980
|
+
const entityDerivedFields = React114__default.useMemo(() => {
|
|
24486
23981
|
if (fields && fields.length > 0) return void 0;
|
|
24487
23982
|
if (!resolvedEntity) return void 0;
|
|
24488
23983
|
return resolvedEntity.fields.map(
|
|
@@ -24501,14 +23996,14 @@ var Form = ({
|
|
|
24501
23996
|
const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
|
|
24502
23997
|
const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
|
|
24503
23998
|
const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
|
|
24504
|
-
const [formData, setFormData] =
|
|
23999
|
+
const [formData, setFormData] = React114__default.useState(
|
|
24505
24000
|
normalizedInitialData
|
|
24506
24001
|
);
|
|
24507
|
-
const [collapsedSections, setCollapsedSections] =
|
|
24002
|
+
const [collapsedSections, setCollapsedSections] = React114__default.useState(
|
|
24508
24003
|
/* @__PURE__ */ new Set()
|
|
24509
24004
|
);
|
|
24510
24005
|
const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
|
|
24511
|
-
const evalContext =
|
|
24006
|
+
const evalContext = React114__default.useMemo(
|
|
24512
24007
|
() => ({
|
|
24513
24008
|
formValues: formData,
|
|
24514
24009
|
globalVariables: externalContext?.globalVariables ?? {},
|
|
@@ -24517,13 +24012,13 @@ var Form = ({
|
|
|
24517
24012
|
}),
|
|
24518
24013
|
[formData, externalContext]
|
|
24519
24014
|
);
|
|
24520
|
-
|
|
24015
|
+
React114__default.useEffect(() => {
|
|
24521
24016
|
const data = initialData;
|
|
24522
24017
|
if (data && Object.keys(data).length > 0) {
|
|
24523
24018
|
setFormData(data);
|
|
24524
24019
|
}
|
|
24525
24020
|
}, [initialData]);
|
|
24526
|
-
const processCalculations =
|
|
24021
|
+
const processCalculations = React114__default.useCallback(
|
|
24527
24022
|
(changedFieldId, newFormData) => {
|
|
24528
24023
|
if (!hiddenCalculations.length) return;
|
|
24529
24024
|
const context = {
|
|
@@ -24548,7 +24043,7 @@ var Form = ({
|
|
|
24548
24043
|
},
|
|
24549
24044
|
[hiddenCalculations, externalContext, eventBus]
|
|
24550
24045
|
);
|
|
24551
|
-
const checkViolations =
|
|
24046
|
+
const checkViolations = React114__default.useCallback(
|
|
24552
24047
|
(changedFieldId, newFormData) => {
|
|
24553
24048
|
if (!violationTriggers.length) return;
|
|
24554
24049
|
const context = {
|
|
@@ -24585,7 +24080,7 @@ var Form = ({
|
|
|
24585
24080
|
processCalculations(name, newFormData);
|
|
24586
24081
|
checkViolations(name, newFormData);
|
|
24587
24082
|
};
|
|
24588
|
-
const isFieldVisible =
|
|
24083
|
+
const isFieldVisible = React114__default.useCallback(
|
|
24589
24084
|
(fieldName) => {
|
|
24590
24085
|
const condition = conditionalFields[fieldName];
|
|
24591
24086
|
if (!condition) return true;
|
|
@@ -24593,7 +24088,7 @@ var Form = ({
|
|
|
24593
24088
|
},
|
|
24594
24089
|
[conditionalFields, evalContext]
|
|
24595
24090
|
);
|
|
24596
|
-
const isSectionVisible =
|
|
24091
|
+
const isSectionVisible = React114__default.useCallback(
|
|
24597
24092
|
(section) => {
|
|
24598
24093
|
if (!section.condition) return true;
|
|
24599
24094
|
return Boolean(evaluateFormExpression(section.condition, evalContext));
|
|
@@ -24625,7 +24120,7 @@ var Form = ({
|
|
|
24625
24120
|
eventBus.emit(`UI:${onCancel}`);
|
|
24626
24121
|
}
|
|
24627
24122
|
};
|
|
24628
|
-
const renderField =
|
|
24123
|
+
const renderField = React114__default.useCallback(
|
|
24629
24124
|
(field) => {
|
|
24630
24125
|
const fieldName = field.name || field.field;
|
|
24631
24126
|
if (!fieldName) return null;
|
|
@@ -24646,7 +24141,7 @@ var Form = ({
|
|
|
24646
24141
|
[formData, isFieldVisible, relationsData, relationsLoading, isLoading]
|
|
24647
24142
|
);
|
|
24648
24143
|
const effectiveFields = entityDerivedFields ?? fields;
|
|
24649
|
-
const normalizedFields =
|
|
24144
|
+
const normalizedFields = React114__default.useMemo(() => {
|
|
24650
24145
|
if (!effectiveFields || effectiveFields.length === 0) return [];
|
|
24651
24146
|
return effectiveFields.map((field) => {
|
|
24652
24147
|
if (typeof field === "string") {
|
|
@@ -24668,7 +24163,7 @@ var Form = ({
|
|
|
24668
24163
|
return field;
|
|
24669
24164
|
});
|
|
24670
24165
|
}, [effectiveFields, resolvedEntity]);
|
|
24671
|
-
const schemaFields =
|
|
24166
|
+
const schemaFields = React114__default.useMemo(() => {
|
|
24672
24167
|
if (normalizedFields.length === 0) return null;
|
|
24673
24168
|
if (isDebugEnabled()) {
|
|
24674
24169
|
debugGroup(`Form: ${entityName || "unknown"}`);
|
|
@@ -24678,7 +24173,7 @@ var Form = ({
|
|
|
24678
24173
|
}
|
|
24679
24174
|
return normalizedFields.map(renderField).filter(Boolean);
|
|
24680
24175
|
}, [normalizedFields, renderField, entityName, conditionalFields]);
|
|
24681
|
-
const sectionElements =
|
|
24176
|
+
const sectionElements = React114__default.useMemo(() => {
|
|
24682
24177
|
if (!sections || sections.length === 0) return null;
|
|
24683
24178
|
return sections.map((section) => {
|
|
24684
24179
|
if (!isSectionVisible(section)) {
|
|
@@ -26082,7 +25577,7 @@ var List2 = ({
|
|
|
26082
25577
|
if (entity && typeof entity === "object" && "id" in entity) return [entity];
|
|
26083
25578
|
return [];
|
|
26084
25579
|
}, [entity]);
|
|
26085
|
-
const getItemActions =
|
|
25580
|
+
const getItemActions = React114__default.useCallback(
|
|
26086
25581
|
(item) => {
|
|
26087
25582
|
if (!itemActions) return [];
|
|
26088
25583
|
if (typeof itemActions === "function") {
|
|
@@ -26508,7 +26003,7 @@ var MediaGallery = ({
|
|
|
26508
26003
|
[selectable, selectedItems, selectionEvent, eventBus]
|
|
26509
26004
|
);
|
|
26510
26005
|
const entityData = Array.isArray(entity) ? entity : [];
|
|
26511
|
-
const items =
|
|
26006
|
+
const items = React114__default.useMemo(() => {
|
|
26512
26007
|
if (propItems) return propItems;
|
|
26513
26008
|
if (entityData.length === 0) return [];
|
|
26514
26009
|
return entityData.map((record, idx) => ({
|
|
@@ -26670,7 +26165,7 @@ var MediaGallery = ({
|
|
|
26670
26165
|
};
|
|
26671
26166
|
MediaGallery.displayName = "MediaGallery";
|
|
26672
26167
|
function extractTitle2(children) {
|
|
26673
|
-
if (!
|
|
26168
|
+
if (!React114__default.isValidElement(children)) return void 0;
|
|
26674
26169
|
const props = children.props;
|
|
26675
26170
|
if (typeof props.title === "string") {
|
|
26676
26171
|
return props.title;
|
|
@@ -27340,7 +26835,7 @@ var PageHeader = ({
|
|
|
27340
26835
|
info: "bg-info/10 text-info"
|
|
27341
26836
|
};
|
|
27342
26837
|
return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
|
|
27343
|
-
breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ jsx(Box, { as: "nav", className: "mb-4", children: /* @__PURE__ */ jsx(Box, { as: "ol", className: "flex items-center gap-2 text-sm", children: breadcrumbs.map((crumb, idx) => /* @__PURE__ */ jsxs(
|
|
26838
|
+
breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ jsx(Box, { as: "nav", className: "mb-4", children: /* @__PURE__ */ jsx(Box, { as: "ol", className: "flex items-center gap-2 text-sm", children: breadcrumbs.map((crumb, idx) => /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
|
|
27344
26839
|
idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
|
|
27345
26840
|
crumb.href ? /* @__PURE__ */ jsx(
|
|
27346
26841
|
"a",
|
|
@@ -27466,7 +26961,7 @@ function subscribeToDebugEvents(listener) {
|
|
|
27466
26961
|
|
|
27467
26962
|
// components/organisms/debug/hooks/useDebugData.ts
|
|
27468
26963
|
function useDebugData() {
|
|
27469
|
-
const [data, setData] =
|
|
26964
|
+
const [data, setData] = React114.useState(() => ({
|
|
27470
26965
|
traits: [],
|
|
27471
26966
|
ticks: [],
|
|
27472
26967
|
guards: [],
|
|
@@ -27480,7 +26975,7 @@ function useDebugData() {
|
|
|
27480
26975
|
},
|
|
27481
26976
|
lastUpdate: Date.now()
|
|
27482
26977
|
}));
|
|
27483
|
-
|
|
26978
|
+
React114.useEffect(() => {
|
|
27484
26979
|
const updateData = () => {
|
|
27485
26980
|
setData({
|
|
27486
26981
|
traits: getAllTraits(),
|
|
@@ -27573,12 +27068,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
|
|
|
27573
27068
|
return positions;
|
|
27574
27069
|
}
|
|
27575
27070
|
function WalkMinimap() {
|
|
27576
|
-
const [walkStep, setWalkStep] =
|
|
27577
|
-
const [traits2, setTraits] =
|
|
27578
|
-
const [coveredEdges, setCoveredEdges] =
|
|
27579
|
-
const [completedTraits, setCompletedTraits] =
|
|
27580
|
-
const prevTraitRef =
|
|
27581
|
-
|
|
27071
|
+
const [walkStep, setWalkStep] = React114.useState(null);
|
|
27072
|
+
const [traits2, setTraits] = React114.useState([]);
|
|
27073
|
+
const [coveredEdges, setCoveredEdges] = React114.useState([]);
|
|
27074
|
+
const [completedTraits, setCompletedTraits] = React114.useState(/* @__PURE__ */ new Set());
|
|
27075
|
+
const prevTraitRef = React114.useRef(null);
|
|
27076
|
+
React114.useEffect(() => {
|
|
27582
27077
|
const interval = setInterval(() => {
|
|
27583
27078
|
const w = window;
|
|
27584
27079
|
const step = w.__orbitalWalkStep;
|
|
@@ -27997,15 +27492,15 @@ var TYPE_BADGES = {
|
|
|
27997
27492
|
state: { variant: "danger", icon: "\u{1F4CA}" }
|
|
27998
27493
|
};
|
|
27999
27494
|
function EventFlowTab({ events: events2 }) {
|
|
28000
|
-
const [filter, setFilter] =
|
|
28001
|
-
const containerRef =
|
|
28002
|
-
const [autoScroll, setAutoScroll] =
|
|
28003
|
-
|
|
27495
|
+
const [filter, setFilter] = React114.useState("all");
|
|
27496
|
+
const containerRef = React114.useRef(null);
|
|
27497
|
+
const [autoScroll, setAutoScroll] = React114.useState(true);
|
|
27498
|
+
React114.useEffect(() => {
|
|
28004
27499
|
if (autoScroll && containerRef.current) {
|
|
28005
27500
|
containerRef.current.scrollTop = containerRef.current.scrollHeight;
|
|
28006
27501
|
}
|
|
28007
27502
|
}, [events2.length, autoScroll]);
|
|
28008
|
-
const filteredEvents =
|
|
27503
|
+
const filteredEvents = React114.useMemo(() => {
|
|
28009
27504
|
if (filter === "all") return events2;
|
|
28010
27505
|
return events2.filter((e) => e.type === filter);
|
|
28011
27506
|
}, [events2, filter]);
|
|
@@ -28104,7 +27599,7 @@ function EventFlowTab({ events: events2 }) {
|
|
|
28104
27599
|
}
|
|
28105
27600
|
EventFlowTab.displayName = "EventFlowTab";
|
|
28106
27601
|
function GuardsPanel({ guards }) {
|
|
28107
|
-
const [filter, setFilter] =
|
|
27602
|
+
const [filter, setFilter] = React114.useState("all");
|
|
28108
27603
|
if (guards.length === 0) {
|
|
28109
27604
|
return /* @__PURE__ */ jsx(
|
|
28110
27605
|
EmptyState,
|
|
@@ -28117,7 +27612,7 @@ function GuardsPanel({ guards }) {
|
|
|
28117
27612
|
}
|
|
28118
27613
|
const passedCount = guards.filter((g) => g.result).length;
|
|
28119
27614
|
const failedCount = guards.length - passedCount;
|
|
28120
|
-
const filteredGuards =
|
|
27615
|
+
const filteredGuards = React114.useMemo(() => {
|
|
28121
27616
|
if (filter === "all") return guards;
|
|
28122
27617
|
if (filter === "passed") return guards.filter((g) => g.result);
|
|
28123
27618
|
return guards.filter((g) => !g.result);
|
|
@@ -28261,10 +27756,10 @@ function EffectBadge({ effect }) {
|
|
|
28261
27756
|
] });
|
|
28262
27757
|
}
|
|
28263
27758
|
function TransitionTimeline({ transitions }) {
|
|
28264
|
-
const containerRef =
|
|
28265
|
-
const [autoScroll, setAutoScroll] =
|
|
28266
|
-
const [expandedId, setExpandedId] =
|
|
28267
|
-
|
|
27759
|
+
const containerRef = React114.useRef(null);
|
|
27760
|
+
const [autoScroll, setAutoScroll] = React114.useState(true);
|
|
27761
|
+
const [expandedId, setExpandedId] = React114.useState(null);
|
|
27762
|
+
React114.useEffect(() => {
|
|
28268
27763
|
if (autoScroll && containerRef.current) {
|
|
28269
27764
|
containerRef.current.scrollTop = containerRef.current.scrollHeight;
|
|
28270
27765
|
}
|
|
@@ -28525,9 +28020,9 @@ function getAllEvents(traits2) {
|
|
|
28525
28020
|
}
|
|
28526
28021
|
function EventDispatcherTab({ traits: traits2, schema }) {
|
|
28527
28022
|
const eventBus = useEventBus();
|
|
28528
|
-
const [
|
|
28529
|
-
const prevStatesRef =
|
|
28530
|
-
|
|
28023
|
+
const [log3, setLog] = React114.useState([]);
|
|
28024
|
+
const prevStatesRef = React114.useRef(/* @__PURE__ */ new Map());
|
|
28025
|
+
React114.useEffect(() => {
|
|
28531
28026
|
for (const trait of traits2) {
|
|
28532
28027
|
const prev = prevStatesRef.current.get(trait.id);
|
|
28533
28028
|
if (prev && prev !== trait.currentState) {
|
|
@@ -28589,9 +28084,9 @@ function EventDispatcherTab({ traits: traits2, schema }) {
|
|
|
28589
28084
|
/* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Other Events (not available from current state)" }),
|
|
28590
28085
|
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: unavailableEvents.map((event) => /* @__PURE__ */ jsx(Badge, { variant: "default", size: "sm", className: "opacity-50", children: event }, event)) })
|
|
28591
28086
|
] }),
|
|
28592
|
-
|
|
28087
|
+
log3.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
|
|
28593
28088
|
/* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Recent Transitions" }),
|
|
28594
|
-
/* @__PURE__ */ jsx(Stack, { gap: "xs", children:
|
|
28089
|
+
/* @__PURE__ */ jsx(Stack, { gap: "xs", children: log3.map((entry, i) => /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
|
|
28595
28090
|
/* @__PURE__ */ jsx("span", { className: "text-purple-400", children: entry.traitName }),
|
|
28596
28091
|
" ",
|
|
28597
28092
|
/* @__PURE__ */ jsx("span", { className: "text-gray-500", children: entry.from }),
|
|
@@ -28680,9 +28175,9 @@ function VerifyModePanel({
|
|
|
28680
28175
|
serverCount,
|
|
28681
28176
|
localCount
|
|
28682
28177
|
}) {
|
|
28683
|
-
const scrollRef =
|
|
28684
|
-
const prevCountRef =
|
|
28685
|
-
|
|
28178
|
+
const scrollRef = React114.useRef(null);
|
|
28179
|
+
const prevCountRef = React114.useRef(0);
|
|
28180
|
+
React114.useEffect(() => {
|
|
28686
28181
|
if (transitions.length > prevCountRef.current && scrollRef.current) {
|
|
28687
28182
|
scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
|
|
28688
28183
|
}
|
|
@@ -28730,10 +28225,10 @@ function RuntimeDebugger({
|
|
|
28730
28225
|
defaultTab,
|
|
28731
28226
|
schema
|
|
28732
28227
|
}) {
|
|
28733
|
-
const [isCollapsed, setIsCollapsed] =
|
|
28734
|
-
const [isVisible, setIsVisible] =
|
|
28228
|
+
const [isCollapsed, setIsCollapsed] = React114.useState(mode === "verify" ? true : defaultCollapsed);
|
|
28229
|
+
const [isVisible, setIsVisible] = React114.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
|
|
28735
28230
|
const debugData = useDebugData();
|
|
28736
|
-
|
|
28231
|
+
React114.useEffect(() => {
|
|
28737
28232
|
if (mode === "inline") return;
|
|
28738
28233
|
return onDebugToggle((enabled) => {
|
|
28739
28234
|
setIsVisible(enabled);
|
|
@@ -28742,7 +28237,7 @@ function RuntimeDebugger({
|
|
|
28742
28237
|
}
|
|
28743
28238
|
});
|
|
28744
28239
|
}, [mode]);
|
|
28745
|
-
|
|
28240
|
+
React114.useEffect(() => {
|
|
28746
28241
|
if (mode === "inline") return;
|
|
28747
28242
|
const handleKeyDown = (e) => {
|
|
28748
28243
|
if (e.key === "`" && isVisible) {
|
|
@@ -29248,7 +28743,7 @@ function SequenceBar({
|
|
|
29248
28743
|
onSlotRemove(index);
|
|
29249
28744
|
}, [onSlotRemove, playing]);
|
|
29250
28745
|
const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
|
|
29251
|
-
return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(
|
|
28746
|
+
return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
|
|
29252
28747
|
i > 0 && /* @__PURE__ */ jsx(
|
|
29253
28748
|
Typography,
|
|
29254
28749
|
{
|
|
@@ -30486,7 +29981,7 @@ var StatCard = ({
|
|
|
30486
29981
|
const labelToUse = propLabel ?? propTitle;
|
|
30487
29982
|
const eventBus = useEventBus();
|
|
30488
29983
|
const { t } = useTranslate();
|
|
30489
|
-
const handleActionClick =
|
|
29984
|
+
const handleActionClick = React114__default.useCallback(() => {
|
|
30490
29985
|
if (action?.event) {
|
|
30491
29986
|
eventBus.emit(`UI:${action.event}`, {});
|
|
30492
29987
|
}
|
|
@@ -30497,7 +29992,7 @@ var StatCard = ({
|
|
|
30497
29992
|
const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
30498
29993
|
const isLoading = externalLoading ?? false;
|
|
30499
29994
|
const error = externalError;
|
|
30500
|
-
const computeMetricValue =
|
|
29995
|
+
const computeMetricValue = React114__default.useCallback(
|
|
30501
29996
|
(metric, items) => {
|
|
30502
29997
|
if (metric.value !== void 0) {
|
|
30503
29998
|
return metric.value;
|
|
@@ -30536,7 +30031,7 @@ var StatCard = ({
|
|
|
30536
30031
|
},
|
|
30537
30032
|
[]
|
|
30538
30033
|
);
|
|
30539
|
-
const schemaStats =
|
|
30034
|
+
const schemaStats = React114__default.useMemo(() => {
|
|
30540
30035
|
if (!metrics || metrics.length === 0) return null;
|
|
30541
30036
|
return metrics.map((metric) => ({
|
|
30542
30037
|
label: metric.label,
|
|
@@ -30544,7 +30039,7 @@ var StatCard = ({
|
|
|
30544
30039
|
format: metric.format
|
|
30545
30040
|
}));
|
|
30546
30041
|
}, [metrics, data, computeMetricValue]);
|
|
30547
|
-
const calculatedTrend =
|
|
30042
|
+
const calculatedTrend = React114__default.useMemo(() => {
|
|
30548
30043
|
if (manualTrend !== void 0) return manualTrend;
|
|
30549
30044
|
if (previousValue === void 0 || currentValue === void 0)
|
|
30550
30045
|
return void 0;
|
|
@@ -31455,7 +30950,7 @@ var Timeline = ({
|
|
|
31455
30950
|
}) => {
|
|
31456
30951
|
const { t } = useTranslate();
|
|
31457
30952
|
const entityData = Array.isArray(entity) ? entity : [];
|
|
31458
|
-
const items =
|
|
30953
|
+
const items = React114__default.useMemo(() => {
|
|
31459
30954
|
if (propItems) return propItems;
|
|
31460
30955
|
if (entityData.length === 0) return [];
|
|
31461
30956
|
return entityData.map((record, idx) => {
|
|
@@ -31557,7 +31052,7 @@ var Timeline = ({
|
|
|
31557
31052
|
};
|
|
31558
31053
|
Timeline.displayName = "Timeline";
|
|
31559
31054
|
function extractToastProps(children) {
|
|
31560
|
-
if (!
|
|
31055
|
+
if (!React114__default.isValidElement(children)) {
|
|
31561
31056
|
if (typeof children === "string") {
|
|
31562
31057
|
return { message: children };
|
|
31563
31058
|
}
|
|
@@ -31588,7 +31083,7 @@ var ToastSlot = ({
|
|
|
31588
31083
|
eventBus.emit("UI:CLOSE");
|
|
31589
31084
|
};
|
|
31590
31085
|
if (!isVisible) return null;
|
|
31591
|
-
const isCustomContent =
|
|
31086
|
+
const isCustomContent = React114__default.isValidElement(children) && !message;
|
|
31592
31087
|
return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
|
|
31593
31088
|
Toast,
|
|
31594
31089
|
{
|
|
@@ -31832,7 +31327,7 @@ var WizardContainer = ({
|
|
|
31832
31327
|
const isCompleted = index < currentStep;
|
|
31833
31328
|
const stepKey = step.id ?? step.tabId ?? `step-${index}`;
|
|
31834
31329
|
const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
|
|
31835
|
-
return /* @__PURE__ */ jsxs(
|
|
31330
|
+
return /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
|
|
31836
31331
|
/* @__PURE__ */ jsx(
|
|
31837
31332
|
Button,
|
|
31838
31333
|
{
|
|
@@ -32198,12 +31693,12 @@ WorldMapTemplate.displayName = "WorldMapTemplate";
|
|
|
32198
31693
|
|
|
32199
31694
|
// components/organisms/component-registry.generated.ts
|
|
32200
31695
|
function lazyThree(name, loader) {
|
|
32201
|
-
const Lazy =
|
|
31696
|
+
const Lazy = React114__default.lazy(() => loader().then((m) => ({ default: m[name] })));
|
|
32202
31697
|
function ThreeWrapper(props) {
|
|
32203
|
-
return
|
|
32204
|
-
|
|
31698
|
+
return React114__default.createElement(
|
|
31699
|
+
React114__default.Suspense,
|
|
32205
31700
|
{ fallback: null },
|
|
32206
|
-
|
|
31701
|
+
React114__default.createElement(Lazy, props)
|
|
32207
31702
|
);
|
|
32208
31703
|
}
|
|
32209
31704
|
ThreeWrapper.displayName = `Lazy(${name})`;
|
|
@@ -32491,7 +31986,7 @@ function SuspenseConfigProvider({
|
|
|
32491
31986
|
config,
|
|
32492
31987
|
children
|
|
32493
31988
|
}) {
|
|
32494
|
-
return
|
|
31989
|
+
return React114__default.createElement(
|
|
32495
31990
|
SuspenseConfigContext.Provider,
|
|
32496
31991
|
{ value: config },
|
|
32497
31992
|
children
|
|
@@ -33130,215 +32625,6 @@ function UISlotRenderer({
|
|
|
33130
32625
|
return wrapped;
|
|
33131
32626
|
}
|
|
33132
32627
|
UISlotRenderer.displayName = "UISlotRenderer";
|
|
33133
|
-
var log3 = createLogger("almadar:verify");
|
|
33134
|
-
var DISPATCH_SUFFIX = ":DISPATCH";
|
|
33135
|
-
var SUCCESS_SUFFIX = ":SUCCESS";
|
|
33136
|
-
var ERROR_SUFFIX = ":ERROR";
|
|
33137
|
-
function parseLifecycleEvent(type) {
|
|
33138
|
-
if (type.endsWith(DISPATCH_SUFFIX)) {
|
|
33139
|
-
const traitName = type.slice(0, -DISPATCH_SUFFIX.length);
|
|
33140
|
-
if (traitName) return { kind: "dispatch", traitName };
|
|
33141
|
-
} else if (type.endsWith(SUCCESS_SUFFIX)) {
|
|
33142
|
-
const rest = type.slice(0, -SUCCESS_SUFFIX.length);
|
|
33143
|
-
const colonIdx = rest.indexOf(":");
|
|
33144
|
-
if (colonIdx > 0) {
|
|
33145
|
-
return {
|
|
33146
|
-
kind: "success",
|
|
33147
|
-
traitName: rest.slice(0, colonIdx),
|
|
33148
|
-
event: rest.slice(colonIdx + 1)
|
|
33149
|
-
};
|
|
33150
|
-
}
|
|
33151
|
-
} else if (type.endsWith(ERROR_SUFFIX)) {
|
|
33152
|
-
const rest = type.slice(0, -ERROR_SUFFIX.length);
|
|
33153
|
-
const colonIdx = rest.indexOf(":");
|
|
33154
|
-
if (colonIdx > 0) {
|
|
33155
|
-
return {
|
|
33156
|
-
kind: "error",
|
|
33157
|
-
traitName: rest.slice(0, colonIdx),
|
|
33158
|
-
event: rest.slice(colonIdx + 1)
|
|
33159
|
-
};
|
|
33160
|
-
}
|
|
33161
|
-
}
|
|
33162
|
-
return null;
|
|
33163
|
-
}
|
|
33164
|
-
function VerificationProvider({
|
|
33165
|
-
children,
|
|
33166
|
-
enabled,
|
|
33167
|
-
runtimeManager,
|
|
33168
|
-
traitStateGetter
|
|
33169
|
-
}) {
|
|
33170
|
-
const isEnabled = enabled ?? (typeof process !== "undefined" && process.env?.NODE_ENV !== "production");
|
|
33171
|
-
const eventBus = useEventBus();
|
|
33172
|
-
const pendingRef = useRef(/* @__PURE__ */ new Map());
|
|
33173
|
-
useEffect(() => {
|
|
33174
|
-
if (!isEnabled) return;
|
|
33175
|
-
if (!eventBus.onAny) return;
|
|
33176
|
-
const unsub = eventBus.onAny((evt) => {
|
|
33177
|
-
const parsed = parseLifecycleEvent(evt.type);
|
|
33178
|
-
if (!parsed) return;
|
|
33179
|
-
log3.debug("lifecycle:event", { kind: parsed.kind, traitName: parsed.traitName, event: parsed.event, type: evt.type });
|
|
33180
|
-
const payload = evt.payload ?? {};
|
|
33181
|
-
if (parsed.kind === "dispatch") {
|
|
33182
|
-
const key = `${parsed.traitName}:${String(payload["event"] ?? "")}`;
|
|
33183
|
-
pendingRef.current.set(key, {
|
|
33184
|
-
traitName: parsed.traitName,
|
|
33185
|
-
event: String(payload["event"] ?? ""),
|
|
33186
|
-
from: payload["currentState"],
|
|
33187
|
-
timestamp: evt.timestamp
|
|
33188
|
-
});
|
|
33189
|
-
} else if (parsed.kind === "success" && parsed.event) {
|
|
33190
|
-
const key = `${parsed.traitName}:${parsed.event}`;
|
|
33191
|
-
const pending = pendingRef.current.get(key);
|
|
33192
|
-
pendingRef.current.delete(key);
|
|
33193
|
-
const newState = payload["newState"] ?? payload["state"] ?? "unknown";
|
|
33194
|
-
const clientEffectsArr = Array.isArray(payload["clientEffects"]) ? payload["clientEffects"] : [];
|
|
33195
|
-
const effects = clientEffectsArr.map((e) => ({
|
|
33196
|
-
type: String(e["type"] ?? "unknown"),
|
|
33197
|
-
args: Array.isArray(e["args"]) ? e["args"] : [],
|
|
33198
|
-
status: "executed"
|
|
33199
|
-
}));
|
|
33200
|
-
const effectResults = Array.isArray(payload["effectResults"]) ? payload["effectResults"] : [];
|
|
33201
|
-
for (const er of effectResults) {
|
|
33202
|
-
effects.push({
|
|
33203
|
-
type: String(er["type"] ?? er["effect"] ?? "server-effect"),
|
|
33204
|
-
args: [er["entity"] ?? er["service"] ?? ""].filter(Boolean),
|
|
33205
|
-
status: er["error"] ? "failed" : "executed",
|
|
33206
|
-
error: er["error"]
|
|
33207
|
-
});
|
|
33208
|
-
}
|
|
33209
|
-
const dataEntities = {};
|
|
33210
|
-
const responseData = payload["data"];
|
|
33211
|
-
if (responseData && typeof responseData === "object") {
|
|
33212
|
-
for (const [entityName, records] of Object.entries(responseData)) {
|
|
33213
|
-
dataEntities[entityName] = Array.isArray(records) ? records.length : 0;
|
|
33214
|
-
}
|
|
33215
|
-
}
|
|
33216
|
-
recordTransition({
|
|
33217
|
-
traitName: parsed.traitName,
|
|
33218
|
-
from: pending?.from ?? payload["currentState"] ?? newState,
|
|
33219
|
-
to: newState,
|
|
33220
|
-
event: parsed.event,
|
|
33221
|
-
effects,
|
|
33222
|
-
serverResponse: {
|
|
33223
|
-
orbitalName: parsed.traitName,
|
|
33224
|
-
success: true,
|
|
33225
|
-
clientEffects: clientEffectsArr.length,
|
|
33226
|
-
dataEntities,
|
|
33227
|
-
emittedEvents: [],
|
|
33228
|
-
timestamp: Date.now()
|
|
33229
|
-
},
|
|
33230
|
-
timestamp: Date.now()
|
|
33231
|
-
});
|
|
33232
|
-
log3.info("transition:success", { trait: parsed.traitName, event: parsed.event, from: pending?.from, to: newState, effectCount: effects.length });
|
|
33233
|
-
} else if (parsed.kind === "error" && parsed.event) {
|
|
33234
|
-
const key = `${parsed.traitName}:${parsed.event}`;
|
|
33235
|
-
const pending = pendingRef.current.get(key);
|
|
33236
|
-
pendingRef.current.delete(key);
|
|
33237
|
-
const errorMsg = payload["error"] ?? "Unknown error";
|
|
33238
|
-
const fromState = pending?.from ?? payload["currentState"] ?? "unknown";
|
|
33239
|
-
recordTransition({
|
|
33240
|
-
traitName: parsed.traitName,
|
|
33241
|
-
from: fromState,
|
|
33242
|
-
to: fromState,
|
|
33243
|
-
// state didn't change on error
|
|
33244
|
-
event: parsed.event,
|
|
33245
|
-
effects: [{
|
|
33246
|
-
type: "server-call",
|
|
33247
|
-
args: [],
|
|
33248
|
-
status: "failed",
|
|
33249
|
-
error: errorMsg
|
|
33250
|
-
}],
|
|
33251
|
-
serverResponse: {
|
|
33252
|
-
orbitalName: parsed.traitName,
|
|
33253
|
-
success: false,
|
|
33254
|
-
clientEffects: 0,
|
|
33255
|
-
dataEntities: {},
|
|
33256
|
-
emittedEvents: [],
|
|
33257
|
-
error: errorMsg,
|
|
33258
|
-
timestamp: Date.now()
|
|
33259
|
-
},
|
|
33260
|
-
timestamp: Date.now()
|
|
33261
|
-
});
|
|
33262
|
-
log3.warn("transition:error", { trait: parsed.traitName, event: parsed.event, from: fromState, error: errorMsg });
|
|
33263
|
-
}
|
|
33264
|
-
});
|
|
33265
|
-
registerCheck(
|
|
33266
|
-
"verification-provider",
|
|
33267
|
-
"VerificationProvider active (compiled path)",
|
|
33268
|
-
"pass"
|
|
33269
|
-
);
|
|
33270
|
-
return unsub;
|
|
33271
|
-
}, [isEnabled, eventBus]);
|
|
33272
|
-
useEffect(() => {
|
|
33273
|
-
if (!isEnabled) return;
|
|
33274
|
-
if (!runtimeManager) return;
|
|
33275
|
-
runtimeManager.setObserver({
|
|
33276
|
-
onTransition(trace) {
|
|
33277
|
-
recordTransition({
|
|
33278
|
-
traitName: trace.traitName,
|
|
33279
|
-
from: trace.from,
|
|
33280
|
-
to: trace.to,
|
|
33281
|
-
event: trace.event,
|
|
33282
|
-
guardResult: trace.guardResult,
|
|
33283
|
-
effects: trace.effects,
|
|
33284
|
-
timestamp: Date.now()
|
|
33285
|
-
});
|
|
33286
|
-
}
|
|
33287
|
-
});
|
|
33288
|
-
registerCheck(
|
|
33289
|
-
"verification-provider",
|
|
33290
|
-
"VerificationProvider active (runtime path)",
|
|
33291
|
-
"pass"
|
|
33292
|
-
);
|
|
33293
|
-
}, [isEnabled, runtimeManager]);
|
|
33294
|
-
useEffect(() => {
|
|
33295
|
-
if (!isEnabled) return;
|
|
33296
|
-
bindEventBus(eventBus);
|
|
33297
|
-
}, [isEnabled, eventBus]);
|
|
33298
|
-
useEffect(() => {
|
|
33299
|
-
if (!isEnabled) return;
|
|
33300
|
-
if (traitStateGetter) {
|
|
33301
|
-
bindTraitStateGetter(traitStateGetter);
|
|
33302
|
-
} else if (runtimeManager?.getState) {
|
|
33303
|
-
const mgr = runtimeManager;
|
|
33304
|
-
bindTraitStateGetter((traitName) => mgr.getState(traitName));
|
|
33305
|
-
}
|
|
33306
|
-
}, [isEnabled, traitStateGetter, runtimeManager]);
|
|
33307
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
33308
|
-
}
|
|
33309
|
-
VerificationProvider.displayName = "VerificationProvider";
|
|
33310
|
-
function OrbitalProvider({
|
|
33311
|
-
children,
|
|
33312
|
-
themes,
|
|
33313
|
-
defaultTheme = "wireframe",
|
|
33314
|
-
defaultMode = "system",
|
|
33315
|
-
targetRef,
|
|
33316
|
-
skipTheme = false,
|
|
33317
|
-
debug: debug2 = false,
|
|
33318
|
-
initialData,
|
|
33319
|
-
suspense = false,
|
|
33320
|
-
verification
|
|
33321
|
-
}) {
|
|
33322
|
-
const suspenseConfig = useMemo(
|
|
33323
|
-
() => ({ enabled: suspense }),
|
|
33324
|
-
[suspense]
|
|
33325
|
-
);
|
|
33326
|
-
const inner = /* @__PURE__ */ jsx(EntityStoreProvider, { children: /* @__PURE__ */ jsx(EventBusProvider, { debug: debug2, children: /* @__PURE__ */ jsx(VerificationProvider, { enabled: verification, children: /* @__PURE__ */ jsx(SelectionProvider, { debug: debug2, children: /* @__PURE__ */ jsx(SuspenseConfigProvider, { config: suspenseConfig, children }) }) }) }) });
|
|
33327
|
-
if (skipTheme) {
|
|
33328
|
-
return inner;
|
|
33329
|
-
}
|
|
33330
|
-
return /* @__PURE__ */ jsx(
|
|
33331
|
-
ThemeProvider,
|
|
33332
|
-
{
|
|
33333
|
-
themes,
|
|
33334
|
-
defaultTheme,
|
|
33335
|
-
defaultMode,
|
|
33336
|
-
targetRef,
|
|
33337
|
-
children: inner
|
|
33338
|
-
}
|
|
33339
|
-
);
|
|
33340
|
-
}
|
|
33341
|
-
OrbitalProvider.displayName = "OrbitalProvider";
|
|
33342
32628
|
var ServerBridgeContext = createContext(null);
|
|
33343
32629
|
function useServerBridge() {
|
|
33344
32630
|
const ctx = useContext(ServerBridgeContext);
|
|
@@ -33444,6 +32730,97 @@ function ServerBridgeProvider({
|
|
|
33444
32730
|
}, [schema, registerSchema, unregisterSchema]);
|
|
33445
32731
|
return /* @__PURE__ */ jsx(ServerBridgeContext.Provider, { value: { connected, sendEvent }, children });
|
|
33446
32732
|
}
|
|
32733
|
+
|
|
32734
|
+
// runtime/prepareSchemaForPreview.ts
|
|
32735
|
+
function generateEntityRow(entity, idx) {
|
|
32736
|
+
const row = { id: String(idx) };
|
|
32737
|
+
for (const f3 of entity.fields) {
|
|
32738
|
+
if (f3.name === "id") continue;
|
|
32739
|
+
row[f3.name] = generateFieldValue(entity.name, f3, idx);
|
|
32740
|
+
}
|
|
32741
|
+
return row;
|
|
32742
|
+
}
|
|
32743
|
+
function generateFieldValue(entityName, field, idx) {
|
|
32744
|
+
if (field.values && field.values.length > 0) {
|
|
32745
|
+
return field.values[(idx - 1) % field.values.length];
|
|
32746
|
+
}
|
|
32747
|
+
switch (field.type) {
|
|
32748
|
+
case "string":
|
|
32749
|
+
return `${entityName} ${field.name.charAt(0).toUpperCase() + field.name.slice(1)} ${idx}`;
|
|
32750
|
+
case "number":
|
|
32751
|
+
return idx * 10;
|
|
32752
|
+
case "boolean":
|
|
32753
|
+
return idx % 2 === 0;
|
|
32754
|
+
default:
|
|
32755
|
+
return field.default ?? null;
|
|
32756
|
+
}
|
|
32757
|
+
}
|
|
32758
|
+
function buildMockData(schema) {
|
|
32759
|
+
const result = {};
|
|
32760
|
+
for (const orbital of schema.orbitals) {
|
|
32761
|
+
const entity = orbital.entity;
|
|
32762
|
+
if (!entity || typeof entity === "string") continue;
|
|
32763
|
+
const entityName = entity.name;
|
|
32764
|
+
if (!entityName) continue;
|
|
32765
|
+
if (entity.instances && entity.instances.length > 0) {
|
|
32766
|
+
result[entityName] = entity.instances;
|
|
32767
|
+
continue;
|
|
32768
|
+
}
|
|
32769
|
+
const rows = Array.from(
|
|
32770
|
+
{ length: 10 },
|
|
32771
|
+
(_, i) => generateEntityRow(entity, i + 1)
|
|
32772
|
+
);
|
|
32773
|
+
result[entityName] = rows;
|
|
32774
|
+
}
|
|
32775
|
+
return result;
|
|
32776
|
+
}
|
|
32777
|
+
function isInlineTrait(traitRef) {
|
|
32778
|
+
return typeof traitRef === "object" && traitRef !== null && "stateMachine" in traitRef;
|
|
32779
|
+
}
|
|
32780
|
+
function findDataState(sm, initialStateName) {
|
|
32781
|
+
return sm.states.find((s) => {
|
|
32782
|
+
if (s.name === initialStateName) return false;
|
|
32783
|
+
return sm.transitions.some(
|
|
32784
|
+
(t) => t.event === "INIT" && (t.from === s.name || Array.isArray(t.from) && t.from.includes(s.name))
|
|
32785
|
+
);
|
|
32786
|
+
});
|
|
32787
|
+
}
|
|
32788
|
+
function rewriteTraitInitialState(trait, mockData) {
|
|
32789
|
+
const sm = trait.stateMachine;
|
|
32790
|
+
if (!sm) return trait;
|
|
32791
|
+
const linkedEntity = trait.linkedEntity;
|
|
32792
|
+
if (!linkedEntity || !mockData[linkedEntity]?.length) return trait;
|
|
32793
|
+
const initialStateName = sm.states.find((s) => s.isInitial)?.name ?? sm.states[0]?.name;
|
|
32794
|
+
if (!initialStateName) return trait;
|
|
32795
|
+
const dataState = findDataState(sm, initialStateName);
|
|
32796
|
+
if (!dataState) return trait;
|
|
32797
|
+
const updatedStates = sm.states.map((s) => {
|
|
32798
|
+
if (s.name === initialStateName) return { ...s, isInitial: false };
|
|
32799
|
+
if (s.name === dataState.name) return { ...s, isInitial: true };
|
|
32800
|
+
return s;
|
|
32801
|
+
});
|
|
32802
|
+
return { ...trait, stateMachine: { ...sm, states: updatedStates } };
|
|
32803
|
+
}
|
|
32804
|
+
function adjustSchemaForMockData(schema, mockData) {
|
|
32805
|
+
let changed = false;
|
|
32806
|
+
const updatedOrbitals = schema.orbitals.map((orbital) => {
|
|
32807
|
+
const traits2 = orbital.traits ?? [];
|
|
32808
|
+
const updatedTraits = traits2.map((traitRef) => {
|
|
32809
|
+
if (!isInlineTrait(traitRef)) return traitRef;
|
|
32810
|
+
const updated = rewriteTraitInitialState(traitRef, mockData);
|
|
32811
|
+
if (updated !== traitRef) changed = true;
|
|
32812
|
+
return updated;
|
|
32813
|
+
});
|
|
32814
|
+
return changed ? { ...orbital, traits: updatedTraits } : orbital;
|
|
32815
|
+
});
|
|
32816
|
+
return changed ? { ...schema, orbitals: updatedOrbitals } : schema;
|
|
32817
|
+
}
|
|
32818
|
+
function prepareSchemaForPreview(input) {
|
|
32819
|
+
const parsed = typeof input === "string" ? JSON.parse(input) : input;
|
|
32820
|
+
const mockData = buildMockData(parsed);
|
|
32821
|
+
const schema = adjustSchemaForMockData(parsed, mockData);
|
|
32822
|
+
return { schema, mockData };
|
|
32823
|
+
}
|
|
33447
32824
|
function normalizeChild(child) {
|
|
33448
32825
|
const { type, children, ...rest } = child;
|
|
33449
32826
|
const normalizedChildren = Array.isArray(children) ? children.map((c) => normalizeChild(c)) : children;
|
|
@@ -33598,14 +32975,16 @@ function SchemaRunner({ schema, serverUrl, mockData, pageName, onNavigate }) {
|
|
|
33598
32975
|
const entityStore = useEntityStore();
|
|
33599
32976
|
const seededRef = useRef("");
|
|
33600
32977
|
const mockKey = mockData ? Object.keys(mockData).sort().join(",") : "";
|
|
33601
|
-
|
|
33602
|
-
seededRef.current
|
|
33603
|
-
|
|
33604
|
-
|
|
33605
|
-
|
|
32978
|
+
React114__default.useLayoutEffect(() => {
|
|
32979
|
+
if (!serverUrl && mockData && seededRef.current !== mockKey) {
|
|
32980
|
+
seededRef.current = mockKey;
|
|
32981
|
+
for (const [entityType, records] of Object.entries(mockData)) {
|
|
32982
|
+
if (Array.isArray(records)) {
|
|
32983
|
+
entityStore.setAll(entityType, records);
|
|
32984
|
+
}
|
|
33606
32985
|
}
|
|
33607
32986
|
}
|
|
33608
|
-
}
|
|
32987
|
+
}, [mockKey, serverUrl, mockData, entityStore]);
|
|
33609
32988
|
const inner = /* @__PURE__ */ jsx(VerificationProvider, { enabled: true, children: /* @__PURE__ */ jsx(SlotsProvider, { children: /* @__PURE__ */ jsxs(EntitySchemaProvider, { entities: Array.from(allEntities.values()), children: [
|
|
33610
32989
|
/* @__PURE__ */ jsx(TraitInitializer, { traits: allPageTraits, orbitalNames: serverUrl ? orbitalNames : void 0, onNavigate }),
|
|
33611
32990
|
/* @__PURE__ */ jsx(SlotBridge, {}),
|
|
@@ -33618,23 +32997,33 @@ function SchemaRunner({ schema, serverUrl, mockData, pageName, onNavigate }) {
|
|
|
33618
32997
|
}
|
|
33619
32998
|
function OrbPreview({
|
|
33620
32999
|
schema,
|
|
33621
|
-
mockData
|
|
33000
|
+
mockData,
|
|
33001
|
+
autoMock = false,
|
|
33622
33002
|
height = "400px",
|
|
33623
33003
|
className,
|
|
33624
33004
|
serverUrl
|
|
33625
33005
|
}) {
|
|
33626
|
-
const
|
|
33006
|
+
const parseResult = useMemo(() => {
|
|
33007
|
+
let parsed;
|
|
33627
33008
|
if (typeof schema === "string") {
|
|
33628
33009
|
try {
|
|
33629
|
-
|
|
33010
|
+
parsed = JSON.parse(schema);
|
|
33630
33011
|
} catch (e) {
|
|
33631
|
-
return { error: String(e) };
|
|
33012
|
+
return { ok: false, error: String(e) };
|
|
33632
33013
|
}
|
|
33014
|
+
} else {
|
|
33015
|
+
parsed = schema;
|
|
33633
33016
|
}
|
|
33634
|
-
|
|
33635
|
-
|
|
33017
|
+
if (autoMock && !serverUrl) {
|
|
33018
|
+
const prepared = prepareSchemaForPreview(parsed);
|
|
33019
|
+
return { ok: true, schema: prepared.schema, mockData: prepared.mockData };
|
|
33020
|
+
}
|
|
33021
|
+
return { ok: true, schema: parsed, mockData: mockData ?? {} };
|
|
33022
|
+
}, [schema, autoMock, serverUrl, mockData]);
|
|
33023
|
+
const parsedSchema = parseResult.ok ? parseResult.schema : null;
|
|
33024
|
+
const effectiveMockData = parseResult.ok ? parseResult.mockData : {};
|
|
33636
33025
|
const pages = useMemo(() => {
|
|
33637
|
-
if (!parsedSchema
|
|
33026
|
+
if (!parsedSchema) return [];
|
|
33638
33027
|
try {
|
|
33639
33028
|
return getAllPages(parsedSchema);
|
|
33640
33029
|
} catch {
|
|
@@ -33648,10 +33037,10 @@ function OrbPreview({
|
|
|
33648
33037
|
setCurrentPage(match.page.name);
|
|
33649
33038
|
}
|
|
33650
33039
|
}, [pages]);
|
|
33651
|
-
if (
|
|
33040
|
+
if (!parseResult.ok) {
|
|
33652
33041
|
return /* @__PURE__ */ jsx(Box, { className, style: { height }, children: /* @__PURE__ */ jsxs(Typography, { as: "pre", color: "error", variant: "small", className: "font-mono whitespace-pre-wrap break-all m-0 p-4", children: [
|
|
33653
33042
|
"Parse error: ",
|
|
33654
|
-
|
|
33043
|
+
parseResult.error
|
|
33655
33044
|
] }) });
|
|
33656
33045
|
}
|
|
33657
33046
|
const containerRef = useRef(null);
|
|
@@ -33677,10 +33066,10 @@ function OrbPreview({
|
|
|
33677
33066
|
ref: containerRef,
|
|
33678
33067
|
className: `overflow-auto border border-[var(--color-border)] rounded-[var(--radius-md)] ${className ?? ""}`,
|
|
33679
33068
|
style: { height },
|
|
33680
|
-
children: /* @__PURE__ */ jsx(OrbitalProvider, { initialData:
|
|
33069
|
+
children: /* @__PURE__ */ jsx(OrbitalProvider, { initialData: effectiveMockData, skipTheme: true, verification: true, children: /* @__PURE__ */ jsx(UISlotProvider, { children: /* @__PURE__ */ jsx(SchemaRunner, { schema: parsedSchema, serverUrl, mockData: effectiveMockData, pageName: currentPage, onNavigate: handleNavigate }) }) })
|
|
33681
33070
|
}
|
|
33682
33071
|
);
|
|
33683
33072
|
}
|
|
33684
33073
|
OrbPreview.displayName = "OrbPreview";
|
|
33685
33074
|
|
|
33686
|
-
export { EntitySchemaProvider, OrbPreview, ServerBridgeProvider, SlotsProvider, TraitContext, TraitProvider, clearSchemaCache, createClientEffectHandlers, useEntityDefinition, useEntitySchema, useEntitySchemaOptional, useResolvedSchema, useServerBridge, useSlotContent, useSlots, useSlotsActions, useTrait, useTraitContext, useTraitStateMachine };
|
|
33075
|
+
export { EntitySchemaProvider, OrbPreview, ServerBridgeProvider, SlotsProvider, TraitContext, TraitProvider, adjustSchemaForMockData, buildMockData, clearSchemaCache, createClientEffectHandlers, prepareSchemaForPreview, useEntityDefinition, useEntitySchema, useEntitySchemaOptional, useResolvedSchema, useServerBridge, useSlotContent, useSlots, useSlotsActions, useTrait, useTraitContext, useTraitStateMachine };
|