@almadar/ui 2.41.0 → 2.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/avl/index.cjs +608 -109
- package/dist/avl/index.d.cts +13 -0
- package/dist/avl/index.js +610 -111
- package/dist/components/index.cjs +350 -47
- package/dist/components/index.js +349 -49
- package/dist/components/molecules/markdown/CodeBlock.d.ts +2 -0
- package/dist/components/organisms/UISlotRenderer.d.ts +3 -1
- package/dist/components/organisms/avl/FlowCanvas.d.ts +14 -1
- package/dist/hooks/index.cjs +95 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +93 -1
- package/dist/hooks/useDraggable.d.ts +24 -0
- package/dist/hooks/useDropZone.d.ts +23 -0
- package/dist/providers/EntityStoreProvider.d.ts +28 -14
- package/dist/providers/index.cjs +265 -50
- package/dist/providers/index.d.ts +1 -1
- package/dist/providers/index.js +266 -52
- package/dist/runtime/index.cjs +271 -63
- package/dist/runtime/index.js +272 -64
- package/package.json +1 -1
package/dist/runtime/index.cjs
CHANGED
|
@@ -247,13 +247,13 @@ function SelectionProvider({
|
|
|
247
247
|
unsubCancel();
|
|
248
248
|
};
|
|
249
249
|
}, [eventBus, setSelected, clearSelection, debug2]);
|
|
250
|
-
const
|
|
250
|
+
const contextValue2 = {
|
|
251
251
|
selected,
|
|
252
252
|
setSelected,
|
|
253
253
|
clearSelection,
|
|
254
254
|
isSelected
|
|
255
255
|
};
|
|
256
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SelectionContext.Provider, { value:
|
|
256
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SelectionContext.Provider, { value: contextValue2, children });
|
|
257
257
|
}
|
|
258
258
|
React117.createContext(null);
|
|
259
259
|
var queryStores = /* @__PURE__ */ new Map();
|
|
@@ -282,27 +282,27 @@ function useQuerySingleton(query) {
|
|
|
282
282
|
store2.listeners.delete(listener);
|
|
283
283
|
};
|
|
284
284
|
}, [store2]);
|
|
285
|
-
const
|
|
285
|
+
const notifyListeners4 = React117.useCallback(() => {
|
|
286
286
|
store2.listeners.forEach((listener) => listener());
|
|
287
287
|
}, [store2]);
|
|
288
288
|
const setSearch = React117.useCallback((value) => {
|
|
289
289
|
store2.search = value;
|
|
290
|
-
|
|
291
|
-
}, [store2,
|
|
290
|
+
notifyListeners4();
|
|
291
|
+
}, [store2, notifyListeners4]);
|
|
292
292
|
const setFilter = React117.useCallback((key, value) => {
|
|
293
293
|
store2.filters = { ...store2.filters, [key]: value };
|
|
294
|
-
|
|
295
|
-
}, [store2,
|
|
294
|
+
notifyListeners4();
|
|
295
|
+
}, [store2, notifyListeners4]);
|
|
296
296
|
const clearFilters = React117.useCallback(() => {
|
|
297
297
|
store2.filters = {};
|
|
298
298
|
store2.search = "";
|
|
299
|
-
|
|
300
|
-
}, [store2,
|
|
299
|
+
notifyListeners4();
|
|
300
|
+
}, [store2, notifyListeners4]);
|
|
301
301
|
const setSort = React117.useCallback((field, direction) => {
|
|
302
302
|
store2.sortField = field;
|
|
303
303
|
store2.sortDirection = direction;
|
|
304
|
-
|
|
305
|
-
}, [store2,
|
|
304
|
+
notifyListeners4();
|
|
305
|
+
}, [store2, notifyListeners4]);
|
|
306
306
|
return {
|
|
307
307
|
search: store2.search,
|
|
308
308
|
setSearch,
|
|
@@ -760,13 +760,13 @@ function EntitySchemaProvider({
|
|
|
760
760
|
}
|
|
761
761
|
return map;
|
|
762
762
|
}, [entities]);
|
|
763
|
-
const
|
|
763
|
+
const contextValue2 = React117.useMemo(
|
|
764
764
|
() => ({
|
|
765
765
|
entities: entitiesMap
|
|
766
766
|
}),
|
|
767
767
|
[entitiesMap]
|
|
768
768
|
);
|
|
769
|
-
return /* @__PURE__ */ jsxRuntime.jsx(EntitySchemaContext.Provider, { value:
|
|
769
|
+
return /* @__PURE__ */ jsxRuntime.jsx(EntitySchemaContext.Provider, { value: contextValue2, children });
|
|
770
770
|
}
|
|
771
771
|
function useEntitySchema() {
|
|
772
772
|
const context = React117.useContext(EntitySchemaContext);
|
|
@@ -1499,7 +1499,7 @@ function TraitProvider({
|
|
|
1499
1499
|
}
|
|
1500
1500
|
return map;
|
|
1501
1501
|
}, [traitBindings]);
|
|
1502
|
-
const
|
|
1502
|
+
const contextValue2 = React117.useMemo(() => {
|
|
1503
1503
|
return {
|
|
1504
1504
|
traits: traitInstances,
|
|
1505
1505
|
getTrait: (name) => traitInstances.get(name),
|
|
@@ -1515,7 +1515,7 @@ function TraitProvider({
|
|
|
1515
1515
|
}
|
|
1516
1516
|
};
|
|
1517
1517
|
}, [traitInstances]);
|
|
1518
|
-
return /* @__PURE__ */ jsxRuntime.jsx(TraitContext.Provider, { value:
|
|
1518
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TraitContext.Provider, { value: contextValue2, children });
|
|
1519
1519
|
}
|
|
1520
1520
|
function useTraitContext() {
|
|
1521
1521
|
const context = React117.useContext(TraitContext);
|
|
@@ -2084,7 +2084,7 @@ var ThemeProvider = ({
|
|
|
2084
2084
|
const newMode = resolvedMode === "dark" ? "light" : "dark";
|
|
2085
2085
|
setMode(newMode);
|
|
2086
2086
|
}, [resolvedMode, setMode]);
|
|
2087
|
-
const
|
|
2087
|
+
const contextValue2 = React117.useMemo(
|
|
2088
2088
|
() => ({
|
|
2089
2089
|
theme,
|
|
2090
2090
|
mode,
|
|
@@ -2106,7 +2106,7 @@ var ThemeProvider = ({
|
|
|
2106
2106
|
appliedTheme
|
|
2107
2107
|
]
|
|
2108
2108
|
);
|
|
2109
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ThemeContext.Provider, { value:
|
|
2109
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ThemeContext.Provider, { value: contextValue2, children });
|
|
2110
2110
|
};
|
|
2111
2111
|
function useTheme() {
|
|
2112
2112
|
const context = React117.useContext(ThemeContext);
|
|
@@ -2130,25 +2130,92 @@ function useTheme() {
|
|
|
2130
2130
|
var store = /* @__PURE__ */ new Map();
|
|
2131
2131
|
var storeListeners = /* @__PURE__ */ new Set();
|
|
2132
2132
|
var watchCallbacks = /* @__PURE__ */ new Map();
|
|
2133
|
-
function
|
|
2134
|
-
const
|
|
2135
|
-
|
|
2136
|
-
|
|
2133
|
+
function extractId(record) {
|
|
2134
|
+
const r = record;
|
|
2135
|
+
return String(r.id ?? r._id ?? r.key ?? "");
|
|
2136
|
+
}
|
|
2137
|
+
function materialize(snap) {
|
|
2138
|
+
return snap.ids.map((id) => snap.entities.get(id));
|
|
2139
|
+
}
|
|
2140
|
+
function notifyListeners3(entityType, prev) {
|
|
2137
2141
|
for (const listener of storeListeners) {
|
|
2138
2142
|
listener();
|
|
2139
2143
|
}
|
|
2140
2144
|
const cbs = watchCallbacks.get(entityType);
|
|
2141
2145
|
if (cbs) {
|
|
2146
|
+
const oldData = prev ? materialize(prev) : [];
|
|
2147
|
+
const cur = store.get(entityType);
|
|
2148
|
+
const newData = cur ? materialize(cur) : [];
|
|
2142
2149
|
for (const cb of cbs) {
|
|
2143
2150
|
try {
|
|
2144
|
-
cb(oldData,
|
|
2151
|
+
cb(oldData, newData);
|
|
2145
2152
|
} catch {
|
|
2146
2153
|
}
|
|
2147
2154
|
}
|
|
2148
2155
|
}
|
|
2149
2156
|
}
|
|
2157
|
+
function setAll(entityType, records) {
|
|
2158
|
+
const entities = /* @__PURE__ */ new Map();
|
|
2159
|
+
const ids = [];
|
|
2160
|
+
for (const r of records) {
|
|
2161
|
+
const rec = r;
|
|
2162
|
+
const id = extractId(rec);
|
|
2163
|
+
if (id) {
|
|
2164
|
+
entities.set(id, rec);
|
|
2165
|
+
ids.push(id);
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
const prev = store.get(entityType);
|
|
2169
|
+
store.set(entityType, { entities, ids, version: (prev?.version ?? 0) + 1 });
|
|
2170
|
+
notifyListeners3(entityType, prev);
|
|
2171
|
+
}
|
|
2172
|
+
function upsertOne(entityType, record) {
|
|
2173
|
+
const id = extractId(record);
|
|
2174
|
+
if (!id) return;
|
|
2175
|
+
const prev = store.get(entityType);
|
|
2176
|
+
const snapshot = prev ? { entities: new Map(prev.entities), ids: [...prev.ids], version: prev.version } : { entities: /* @__PURE__ */ new Map(), ids: [], version: 0 };
|
|
2177
|
+
snapshot.entities.set(id, record);
|
|
2178
|
+
if (!snapshot.ids.includes(id)) snapshot.ids.push(id);
|
|
2179
|
+
snapshot.version++;
|
|
2180
|
+
store.set(entityType, snapshot);
|
|
2181
|
+
notifyListeners3(entityType, prev);
|
|
2182
|
+
}
|
|
2183
|
+
function addOne(entityType, record) {
|
|
2184
|
+
upsertOne(entityType, record);
|
|
2185
|
+
}
|
|
2186
|
+
function updateOne(entityType, id, changes) {
|
|
2187
|
+
const prev = store.get(entityType);
|
|
2188
|
+
if (!prev?.entities.has(id)) return;
|
|
2189
|
+
const snapshot = {
|
|
2190
|
+
entities: new Map(prev.entities),
|
|
2191
|
+
ids: [...prev.ids],
|
|
2192
|
+
version: prev.version
|
|
2193
|
+
};
|
|
2194
|
+
snapshot.entities.set(id, { ...snapshot.entities.get(id), ...changes });
|
|
2195
|
+
snapshot.version++;
|
|
2196
|
+
store.set(entityType, snapshot);
|
|
2197
|
+
notifyListeners3(entityType, prev);
|
|
2198
|
+
}
|
|
2199
|
+
function removeOne(entityType, id) {
|
|
2200
|
+
const prev = store.get(entityType);
|
|
2201
|
+
if (!prev) return;
|
|
2202
|
+
const snapshot = {
|
|
2203
|
+
entities: new Map(prev.entities),
|
|
2204
|
+
ids: prev.ids.filter((i) => i !== id),
|
|
2205
|
+
version: prev.version
|
|
2206
|
+
};
|
|
2207
|
+
snapshot.entities.delete(id);
|
|
2208
|
+
snapshot.version++;
|
|
2209
|
+
store.set(entityType, snapshot);
|
|
2210
|
+
notifyListeners3(entityType, prev);
|
|
2211
|
+
}
|
|
2150
2212
|
function getSnapshot3(entityType) {
|
|
2151
|
-
|
|
2213
|
+
const snap = store.get(entityType);
|
|
2214
|
+
if (!snap) return [];
|
|
2215
|
+
return materialize(snap);
|
|
2216
|
+
}
|
|
2217
|
+
function getById(entityType, id) {
|
|
2218
|
+
return store.get(entityType)?.entities.get(id) ?? null;
|
|
2152
2219
|
}
|
|
2153
2220
|
function getVersion(entityType) {
|
|
2154
2221
|
return store.get(entityType)?.version ?? 0;
|
|
@@ -2172,15 +2239,21 @@ function useEntityRef(entityType) {
|
|
|
2172
2239
|
}, [entityType]);
|
|
2173
2240
|
return React117.useSyncExternalStore(subscribeToStore, getSnapshotStable, () => []);
|
|
2174
2241
|
}
|
|
2175
|
-
var
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2242
|
+
var contextValue = {
|
|
2243
|
+
setAll,
|
|
2244
|
+
upsertOne,
|
|
2245
|
+
addOne,
|
|
2246
|
+
updateOne,
|
|
2247
|
+
removeOne,
|
|
2248
|
+
getSnapshot: getSnapshot3,
|
|
2249
|
+
getById
|
|
2250
|
+
};
|
|
2251
|
+
var EntityStoreContext = React117.createContext(contextValue);
|
|
2179
2252
|
function useEntityStore() {
|
|
2180
2253
|
return React117.useContext(EntityStoreContext);
|
|
2181
2254
|
}
|
|
2182
2255
|
function EntityStoreProvider({ children }) {
|
|
2183
|
-
return /* @__PURE__ */ jsxRuntime.jsx(EntityStoreContext.Provider, { value:
|
|
2256
|
+
return /* @__PURE__ */ jsxRuntime.jsx(EntityStoreContext.Provider, { value: contextValue, children });
|
|
2184
2257
|
}
|
|
2185
2258
|
var EventBusContext2 = React117.createContext(null);
|
|
2186
2259
|
function EventBusProvider({ children, debug: debug2 = false }) {
|
|
@@ -2280,7 +2353,7 @@ function EventBusProvider({ children, debug: debug2 = false }) {
|
|
|
2280
2353
|
}
|
|
2281
2354
|
};
|
|
2282
2355
|
}, [debug2]);
|
|
2283
|
-
const
|
|
2356
|
+
const contextValue2 = React117.useMemo(
|
|
2284
2357
|
() => ({
|
|
2285
2358
|
emit,
|
|
2286
2359
|
on,
|
|
@@ -2293,12 +2366,12 @@ function EventBusProvider({ children, debug: debug2 = false }) {
|
|
|
2293
2366
|
[emit, on, once, hasListeners, onAny, getSelectedEntity, clearSelectedEntity]
|
|
2294
2367
|
);
|
|
2295
2368
|
React117.useEffect(() => {
|
|
2296
|
-
setGlobalEventBus(
|
|
2369
|
+
setGlobalEventBus(contextValue2);
|
|
2297
2370
|
return () => {
|
|
2298
2371
|
setGlobalEventBus(null);
|
|
2299
2372
|
};
|
|
2300
|
-
}, [
|
|
2301
|
-
return /* @__PURE__ */ jsxRuntime.jsx(EventBusContext2.Provider, { value:
|
|
2373
|
+
}, [contextValue2]);
|
|
2374
|
+
return /* @__PURE__ */ jsxRuntime.jsx(EventBusContext2.Provider, { value: contextValue2, children });
|
|
2302
2375
|
}
|
|
2303
2376
|
var iconAliases = {
|
|
2304
2377
|
"close": LucideIcons__namespace.X,
|
|
@@ -9870,6 +9943,42 @@ var orbStyleOverrides = {
|
|
|
9870
9943
|
"orb-op-async": { color: syntax.ORB_COLORS.dark.async }
|
|
9871
9944
|
};
|
|
9872
9945
|
var orbStyle = { ...dark__default.default, ...orbStyleOverrides };
|
|
9946
|
+
function computeFoldRegions(code) {
|
|
9947
|
+
const lines = code.split("\n");
|
|
9948
|
+
const regions = [];
|
|
9949
|
+
const stack = [];
|
|
9950
|
+
for (let i = 0; i < lines.length; i++) {
|
|
9951
|
+
const line = lines[i];
|
|
9952
|
+
let inString = false;
|
|
9953
|
+
for (let j = 0; j < line.length; j++) {
|
|
9954
|
+
const ch = line[j];
|
|
9955
|
+
if (ch === "\\" && inString) {
|
|
9956
|
+
j++;
|
|
9957
|
+
continue;
|
|
9958
|
+
}
|
|
9959
|
+
if (ch === '"') {
|
|
9960
|
+
inString = !inString;
|
|
9961
|
+
continue;
|
|
9962
|
+
}
|
|
9963
|
+
if (inString) continue;
|
|
9964
|
+
if (ch === "{" || ch === "[") {
|
|
9965
|
+
stack.push({ line: i, bracket: ch });
|
|
9966
|
+
} else if (ch === "}" || ch === "]") {
|
|
9967
|
+
const open = stack.pop();
|
|
9968
|
+
if (open && open.line < i) {
|
|
9969
|
+
regions.push({
|
|
9970
|
+
start: open.line,
|
|
9971
|
+
end: i,
|
|
9972
|
+
closeBracket: ch
|
|
9973
|
+
});
|
|
9974
|
+
}
|
|
9975
|
+
}
|
|
9976
|
+
}
|
|
9977
|
+
}
|
|
9978
|
+
return regions.sort((a, b) => a.start - b.start);
|
|
9979
|
+
}
|
|
9980
|
+
var LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
|
|
9981
|
+
var HIDDEN_LINE_NUMBERS = { display: "none" };
|
|
9873
9982
|
var CodeBlock = React117__namespace.default.memo(
|
|
9874
9983
|
({
|
|
9875
9984
|
code: rawCode,
|
|
@@ -9877,6 +9986,7 @@ var CodeBlock = React117__namespace.default.memo(
|
|
|
9877
9986
|
showCopyButton = true,
|
|
9878
9987
|
showLanguageBadge = true,
|
|
9879
9988
|
maxHeight = "60vh",
|
|
9989
|
+
foldable: foldableProp,
|
|
9880
9990
|
className
|
|
9881
9991
|
}) => {
|
|
9882
9992
|
const code = typeof rawCode === "string" ? rawCode : String(rawCode ?? "");
|
|
@@ -9885,8 +9995,114 @@ var CodeBlock = React117__namespace.default.memo(
|
|
|
9885
9995
|
const eventBus = useEventBus();
|
|
9886
9996
|
const { t: _t } = useTranslate();
|
|
9887
9997
|
const scrollRef = React117.useRef(null);
|
|
9998
|
+
const codeRef = React117.useRef(null);
|
|
9888
9999
|
const savedScrollLeftRef = React117.useRef(0);
|
|
9889
10000
|
const [copied, setCopied] = React117.useState(false);
|
|
10001
|
+
const isFoldable = foldableProp ?? (language === "orb" || language === "json");
|
|
10002
|
+
const [collapsed, setCollapsed] = React117.useState(() => /* @__PURE__ */ new Set());
|
|
10003
|
+
const foldRegions = React117.useMemo(
|
|
10004
|
+
() => isFoldable ? computeFoldRegions(code) : [],
|
|
10005
|
+
[code, isFoldable]
|
|
10006
|
+
);
|
|
10007
|
+
const foldStartMap = React117.useMemo(() => {
|
|
10008
|
+
const m = /* @__PURE__ */ new Map();
|
|
10009
|
+
for (const r of foldRegions) m.set(r.start, r);
|
|
10010
|
+
return m;
|
|
10011
|
+
}, [foldRegions]);
|
|
10012
|
+
const hiddenLines = React117.useMemo(() => {
|
|
10013
|
+
const h = /* @__PURE__ */ new Set();
|
|
10014
|
+
for (const r of foldRegions) {
|
|
10015
|
+
if (!collapsed.has(r.start)) continue;
|
|
10016
|
+
for (let i = r.start + 1; i <= r.end; i++) h.add(i);
|
|
10017
|
+
}
|
|
10018
|
+
return h;
|
|
10019
|
+
}, [foldRegions, collapsed]);
|
|
10020
|
+
const collapsedRef = React117.useRef(collapsed);
|
|
10021
|
+
collapsedRef.current = collapsed;
|
|
10022
|
+
const foldStartMapRef = React117.useRef(foldStartMap);
|
|
10023
|
+
foldStartMapRef.current = foldStartMap;
|
|
10024
|
+
const toggleFold = React117.useCallback((lineNum) => {
|
|
10025
|
+
setCollapsed((prev) => {
|
|
10026
|
+
const next = new Set(prev);
|
|
10027
|
+
if (next.has(lineNum)) next.delete(lineNum);
|
|
10028
|
+
else next.add(lineNum);
|
|
10029
|
+
return next;
|
|
10030
|
+
});
|
|
10031
|
+
}, []);
|
|
10032
|
+
const toggleFoldRef = React117.useRef(toggleFold);
|
|
10033
|
+
toggleFoldRef.current = toggleFold;
|
|
10034
|
+
React117.useEffect(() => {
|
|
10035
|
+
setCollapsed(/* @__PURE__ */ new Set());
|
|
10036
|
+
}, [code]);
|
|
10037
|
+
const highlightedElement = React117.useMemo(
|
|
10038
|
+
() => /* @__PURE__ */ jsxRuntime.jsx(
|
|
10039
|
+
SyntaxHighlighter__default.default,
|
|
10040
|
+
{
|
|
10041
|
+
PreTag: "div",
|
|
10042
|
+
language,
|
|
10043
|
+
style: activeStyle,
|
|
10044
|
+
wrapLines: true,
|
|
10045
|
+
showLineNumbers: true,
|
|
10046
|
+
showInlineLineNumbers: false,
|
|
10047
|
+
lineNumberContainerStyle: HIDDEN_LINE_NUMBERS,
|
|
10048
|
+
lineProps: LINE_PROPS_FN,
|
|
10049
|
+
customStyle: {
|
|
10050
|
+
backgroundColor: "transparent",
|
|
10051
|
+
borderRadius: 0,
|
|
10052
|
+
padding: 0,
|
|
10053
|
+
margin: 0,
|
|
10054
|
+
whiteSpace: "pre",
|
|
10055
|
+
minWidth: "100%"
|
|
10056
|
+
},
|
|
10057
|
+
children: code
|
|
10058
|
+
}
|
|
10059
|
+
),
|
|
10060
|
+
[code, language, activeStyle]
|
|
10061
|
+
);
|
|
10062
|
+
React117.useLayoutEffect(() => {
|
|
10063
|
+
const container = codeRef.current;
|
|
10064
|
+
if (!container) return;
|
|
10065
|
+
container.querySelectorAll(".fold-toggle, .fold-summary").forEach((el) => el.remove());
|
|
10066
|
+
const lineEls = container.querySelectorAll("[data-line]");
|
|
10067
|
+
if (!isFoldable || foldRegions.length === 0) {
|
|
10068
|
+
lineEls.forEach((el) => {
|
|
10069
|
+
el.style.display = "";
|
|
10070
|
+
el.style.position = "";
|
|
10071
|
+
el.style.paddingLeft = "";
|
|
10072
|
+
});
|
|
10073
|
+
return;
|
|
10074
|
+
}
|
|
10075
|
+
lineEls.forEach((el) => {
|
|
10076
|
+
const num = parseInt(el.getAttribute("data-line") ?? "-1", 10);
|
|
10077
|
+
if (hiddenLines.has(num)) {
|
|
10078
|
+
el.style.display = "none";
|
|
10079
|
+
return;
|
|
10080
|
+
}
|
|
10081
|
+
el.style.display = "";
|
|
10082
|
+
el.style.position = "relative";
|
|
10083
|
+
el.style.paddingLeft = "1.2em";
|
|
10084
|
+
const region = foldStartMap.get(num);
|
|
10085
|
+
if (!region) return;
|
|
10086
|
+
const isCollapsed = collapsed.has(num);
|
|
10087
|
+
const toggle = document.createElement("span");
|
|
10088
|
+
toggle.className = "fold-toggle";
|
|
10089
|
+
toggle.textContent = isCollapsed ? "\u25B6" : "\u25BC";
|
|
10090
|
+
toggle.style.cssText = "position:absolute;left:0;top:0;width:1.2em;text-align:center;cursor:pointer;color:#858585;font-size:10px;user-select:none;line-height:inherit;height:100%";
|
|
10091
|
+
toggle.addEventListener("click", (e) => {
|
|
10092
|
+
e.stopPropagation();
|
|
10093
|
+
toggleFoldRef.current(num);
|
|
10094
|
+
});
|
|
10095
|
+
el.insertBefore(toggle, el.firstChild);
|
|
10096
|
+
if (isCollapsed) {
|
|
10097
|
+
const summary = document.createElement("span");
|
|
10098
|
+
summary.className = "fold-summary";
|
|
10099
|
+
summary.style.cssText = "color:#858585;font-style:italic";
|
|
10100
|
+
const count = region.end - region.start - 1;
|
|
10101
|
+
summary.textContent = ` ... ${count} line${count !== 1 ? "s" : ""} ${region.closeBracket}`;
|
|
10102
|
+
el.appendChild(summary);
|
|
10103
|
+
}
|
|
10104
|
+
});
|
|
10105
|
+
}, [collapsed, hiddenLines, foldStartMap, foldRegions, isFoldable]);
|
|
9890
10106
|
React117.useLayoutEffect(() => {
|
|
9891
10107
|
const el = scrollRef.current;
|
|
9892
10108
|
return () => {
|
|
@@ -9917,8 +10133,9 @@ var CodeBlock = React117__namespace.default.memo(
|
|
|
9917
10133
|
eventBus.emit("UI:COPY_CODE", { language, success: false });
|
|
9918
10134
|
}
|
|
9919
10135
|
};
|
|
10136
|
+
const hasHeader = showLanguageBadge || showCopyButton;
|
|
9920
10137
|
return /* @__PURE__ */ jsxRuntime.jsxs(Box, { className: `relative group ${className || ""}`, children: [
|
|
9921
|
-
|
|
10138
|
+
hasHeader && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9922
10139
|
HStack,
|
|
9923
10140
|
{
|
|
9924
10141
|
justify: "between",
|
|
@@ -9953,31 +10170,14 @@ var CodeBlock = React117__namespace.default.memo(
|
|
|
9953
10170
|
touchAction: "pan-x pan-y",
|
|
9954
10171
|
contain: "paint",
|
|
9955
10172
|
backgroundColor: "#1e1e1e",
|
|
9956
|
-
borderRadius:
|
|
9957
|
-
padding: "1rem"
|
|
10173
|
+
borderRadius: hasHeader ? "0 0 0.5rem 0.5rem" : "0.5rem"
|
|
9958
10174
|
},
|
|
9959
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9960
|
-
SyntaxHighlighter__default.default,
|
|
9961
|
-
{
|
|
9962
|
-
PreTag: "div",
|
|
9963
|
-
language,
|
|
9964
|
-
style: activeStyle,
|
|
9965
|
-
customStyle: {
|
|
9966
|
-
backgroundColor: "transparent",
|
|
9967
|
-
borderRadius: 0,
|
|
9968
|
-
padding: 0,
|
|
9969
|
-
margin: 0,
|
|
9970
|
-
whiteSpace: "pre",
|
|
9971
|
-
minWidth: "100%"
|
|
9972
|
-
},
|
|
9973
|
-
children: code
|
|
9974
|
-
}
|
|
9975
|
-
)
|
|
10175
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref: codeRef, style: { padding: "1rem" }, children: highlightedElement })
|
|
9976
10176
|
}
|
|
9977
10177
|
)
|
|
9978
10178
|
] });
|
|
9979
10179
|
},
|
|
9980
|
-
(prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.maxHeight === next.maxHeight
|
|
10180
|
+
(prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable
|
|
9981
10181
|
);
|
|
9982
10182
|
CodeBlock.displayName = "CodeBlock";
|
|
9983
10183
|
function Card2({
|
|
@@ -28913,7 +29113,7 @@ function SequencerBoard({
|
|
|
28913
29113
|
setPlayState("playing");
|
|
28914
29114
|
setCurrentStep(0);
|
|
28915
29115
|
let step = 0;
|
|
28916
|
-
const
|
|
29116
|
+
const advance = () => {
|
|
28917
29117
|
step++;
|
|
28918
29118
|
if (step >= entity.maxSlots) {
|
|
28919
29119
|
const playerSeq = slots.map((s) => s?.id);
|
|
@@ -28944,10 +29144,10 @@ function SequencerBoard({
|
|
|
28944
29144
|
}
|
|
28945
29145
|
} else {
|
|
28946
29146
|
setCurrentStep(step);
|
|
28947
|
-
timerRef.current = setTimeout(
|
|
29147
|
+
timerRef.current = setTimeout(advance, stepDurationMs);
|
|
28948
29148
|
}
|
|
28949
29149
|
};
|
|
28950
|
-
timerRef.current = setTimeout(
|
|
29150
|
+
timerRef.current = setTimeout(advance, stepDurationMs);
|
|
28951
29151
|
}, [canPlay, slots, entity.maxSlots, entity.solutions, stepDurationMs, playEvent, completeEvent, emit]);
|
|
28952
29152
|
const machine = {
|
|
28953
29153
|
name: entity.title,
|
|
@@ -32437,13 +32637,14 @@ function getToastPosition(position) {
|
|
|
32437
32637
|
return "top-4 right-4";
|
|
32438
32638
|
}
|
|
32439
32639
|
}
|
|
32440
|
-
function renderPatternChildren(children, onDismiss, parentId = "root") {
|
|
32640
|
+
function renderPatternChildren(children, onDismiss, parentId = "root", parentPath = "root") {
|
|
32441
32641
|
if (!children || !Array.isArray(children) || children.length === 0) {
|
|
32442
32642
|
return null;
|
|
32443
32643
|
}
|
|
32444
32644
|
return children.map((child, index) => {
|
|
32445
32645
|
if (!child || typeof child !== "object") return null;
|
|
32446
32646
|
const childId = `${parentId}-${index}`;
|
|
32647
|
+
const childPath = parentPath === "root" ? `root.children.${index}` : `${parentPath}.children.${index}`;
|
|
32447
32648
|
const childContent = {
|
|
32448
32649
|
id: childId,
|
|
32449
32650
|
pattern: child.type,
|
|
@@ -32455,7 +32656,8 @@ function renderPatternChildren(children, onDismiss, parentId = "root") {
|
|
|
32455
32656
|
SlotContentRenderer,
|
|
32456
32657
|
{
|
|
32457
32658
|
content: childContent,
|
|
32458
|
-
onDismiss
|
|
32659
|
+
onDismiss,
|
|
32660
|
+
patternPath: childPath
|
|
32459
32661
|
},
|
|
32460
32662
|
childId
|
|
32461
32663
|
);
|
|
@@ -32487,7 +32689,8 @@ function renderPatternProps(props, onDismiss) {
|
|
|
32487
32689
|
}
|
|
32488
32690
|
function SlotContentRenderer({
|
|
32489
32691
|
content,
|
|
32490
|
-
onDismiss
|
|
32692
|
+
onDismiss,
|
|
32693
|
+
patternPath
|
|
32491
32694
|
}) {
|
|
32492
32695
|
const entityProp = content.props.entity;
|
|
32493
32696
|
const entityType = typeof entityProp === "string" ? entityProp : "";
|
|
@@ -32496,7 +32699,8 @@ function SlotContentRenderer({
|
|
|
32496
32699
|
if (PatternComponent) {
|
|
32497
32700
|
const childrenConfig = content.props.children;
|
|
32498
32701
|
const hasChildren = PATTERNS_WITH_CHILDREN.has(content.pattern) || Array.isArray(childrenConfig) && childrenConfig.length > 0;
|
|
32499
|
-
const
|
|
32702
|
+
const myPath = patternPath ?? "root";
|
|
32703
|
+
const renderedChildren = hasChildren ? renderPatternChildren(childrenConfig, onDismiss, content.id, myPath) : void 0;
|
|
32500
32704
|
const { children: _childrenConfig, ...restProps } = content.props;
|
|
32501
32705
|
const renderedProps = renderPatternProps(restProps, onDismiss);
|
|
32502
32706
|
let finalProps;
|
|
@@ -32512,6 +32716,7 @@ function SlotContentRenderer({
|
|
|
32512
32716
|
} else {
|
|
32513
32717
|
finalProps = renderedProps;
|
|
32514
32718
|
}
|
|
32719
|
+
const acceptsChildren = PATTERNS_WITH_CHILDREN.has(content.pattern);
|
|
32515
32720
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
32516
32721
|
Box,
|
|
32517
32722
|
{
|
|
@@ -32520,6 +32725,9 @@ function SlotContentRenderer({
|
|
|
32520
32725
|
"data-id": content.id,
|
|
32521
32726
|
"data-node-id": content.nodeId,
|
|
32522
32727
|
"data-source-trait": content.sourceTrait,
|
|
32728
|
+
"data-pattern-path": myPath,
|
|
32729
|
+
"data-pattern-type": content.pattern,
|
|
32730
|
+
"data-accepts-children": acceptsChildren ? "true" : void 0,
|
|
32523
32731
|
children: /* @__PURE__ */ jsxRuntime.jsx(PatternComponent, { ...finalProps, children: renderedChildren })
|
|
32524
32732
|
}
|
|
32525
32733
|
);
|
|
@@ -32959,7 +33167,7 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate }) {
|
|
|
32959
33167
|
if (responseData) {
|
|
32960
33168
|
for (const [entityType, records] of Object.entries(responseData)) {
|
|
32961
33169
|
if (Array.isArray(records)) {
|
|
32962
|
-
entityStore.
|
|
33170
|
+
entityStore.setAll(entityType, records);
|
|
32963
33171
|
}
|
|
32964
33172
|
}
|
|
32965
33173
|
}
|
|
@@ -33018,7 +33226,7 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate }) {
|
|
|
33018
33226
|
if (initResponseData) {
|
|
33019
33227
|
for (const [entityType, records] of Object.entries(initResponseData)) {
|
|
33020
33228
|
if (Array.isArray(records)) {
|
|
33021
|
-
entityStore.
|
|
33229
|
+
entityStore.setAll(entityType, records);
|
|
33022
33230
|
}
|
|
33023
33231
|
}
|
|
33024
33232
|
}
|
|
@@ -33067,7 +33275,7 @@ function SchemaRunner({ schema, serverUrl, mockData, pageName, onNavigate }) {
|
|
|
33067
33275
|
if (!serverUrl && mockData) {
|
|
33068
33276
|
for (const [entityType, records] of Object.entries(mockData)) {
|
|
33069
33277
|
if (Array.isArray(records)) {
|
|
33070
|
-
entityStore.
|
|
33278
|
+
entityStore.setAll(entityType, records);
|
|
33071
33279
|
}
|
|
33072
33280
|
}
|
|
33073
33281
|
}
|