@almadar/ui 2.42.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.
@@ -1,5 +1,5 @@
1
1
  import * as React117 from 'react';
2
- import React117__default, { createContext, useCallback, useState, useRef, useEffect, useLayoutEffect, lazy, useContext, useMemo, Suspense, useSyncExternalStore, useId } from 'react';
2
+ import React117__default, { createContext, useCallback, useState, useRef, useEffect, useMemo, useLayoutEffect, lazy, useContext, Suspense, useSyncExternalStore, useId } from 'react';
3
3
  import { EventBusContext } from '@almadar/ui/providers';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import '@tanstack/react-query';
@@ -201,13 +201,13 @@ function SelectionProvider({
201
201
  unsubCancel();
202
202
  };
203
203
  }, [eventBus, setSelected, clearSelection, debug2]);
204
- const contextValue = {
204
+ const contextValue2 = {
205
205
  selected,
206
206
  setSelected,
207
207
  clearSelection,
208
208
  isSelected
209
209
  };
210
- return /* @__PURE__ */ jsx(SelectionContext.Provider, { value: contextValue, children });
210
+ return /* @__PURE__ */ jsx(SelectionContext.Provider, { value: contextValue2, children });
211
211
  }
212
212
  createContext(null);
213
213
  var queryStores = /* @__PURE__ */ new Map();
@@ -236,27 +236,27 @@ function useQuerySingleton(query) {
236
236
  store2.listeners.delete(listener);
237
237
  };
238
238
  }, [store2]);
239
- const notifyListeners3 = useCallback(() => {
239
+ const notifyListeners4 = useCallback(() => {
240
240
  store2.listeners.forEach((listener) => listener());
241
241
  }, [store2]);
242
242
  const setSearch = useCallback((value) => {
243
243
  store2.search = value;
244
- notifyListeners3();
245
- }, [store2, notifyListeners3]);
244
+ notifyListeners4();
245
+ }, [store2, notifyListeners4]);
246
246
  const setFilter = useCallback((key, value) => {
247
247
  store2.filters = { ...store2.filters, [key]: value };
248
- notifyListeners3();
249
- }, [store2, notifyListeners3]);
248
+ notifyListeners4();
249
+ }, [store2, notifyListeners4]);
250
250
  const clearFilters = useCallback(() => {
251
251
  store2.filters = {};
252
252
  store2.search = "";
253
- notifyListeners3();
254
- }, [store2, notifyListeners3]);
253
+ notifyListeners4();
254
+ }, [store2, notifyListeners4]);
255
255
  const setSort = useCallback((field, direction) => {
256
256
  store2.sortField = field;
257
257
  store2.sortDirection = direction;
258
- notifyListeners3();
259
- }, [store2, notifyListeners3]);
258
+ notifyListeners4();
259
+ }, [store2, notifyListeners4]);
260
260
  return {
261
261
  search: store2.search,
262
262
  setSearch,
@@ -714,13 +714,13 @@ function EntitySchemaProvider({
714
714
  }
715
715
  return map;
716
716
  }, [entities]);
717
- const contextValue = useMemo(
717
+ const contextValue2 = useMemo(
718
718
  () => ({
719
719
  entities: entitiesMap
720
720
  }),
721
721
  [entitiesMap]
722
722
  );
723
- return /* @__PURE__ */ jsx(EntitySchemaContext.Provider, { value: contextValue, children });
723
+ return /* @__PURE__ */ jsx(EntitySchemaContext.Provider, { value: contextValue2, children });
724
724
  }
725
725
  function useEntitySchema() {
726
726
  const context = useContext(EntitySchemaContext);
@@ -1453,7 +1453,7 @@ function TraitProvider({
1453
1453
  }
1454
1454
  return map;
1455
1455
  }, [traitBindings]);
1456
- const contextValue = useMemo(() => {
1456
+ const contextValue2 = useMemo(() => {
1457
1457
  return {
1458
1458
  traits: traitInstances,
1459
1459
  getTrait: (name) => traitInstances.get(name),
@@ -1469,7 +1469,7 @@ function TraitProvider({
1469
1469
  }
1470
1470
  };
1471
1471
  }, [traitInstances]);
1472
- return /* @__PURE__ */ jsx(TraitContext.Provider, { value: contextValue, children });
1472
+ return /* @__PURE__ */ jsx(TraitContext.Provider, { value: contextValue2, children });
1473
1473
  }
1474
1474
  function useTraitContext() {
1475
1475
  const context = useContext(TraitContext);
@@ -2038,7 +2038,7 @@ var ThemeProvider = ({
2038
2038
  const newMode = resolvedMode === "dark" ? "light" : "dark";
2039
2039
  setMode(newMode);
2040
2040
  }, [resolvedMode, setMode]);
2041
- const contextValue = useMemo(
2041
+ const contextValue2 = useMemo(
2042
2042
  () => ({
2043
2043
  theme,
2044
2044
  mode,
@@ -2060,7 +2060,7 @@ var ThemeProvider = ({
2060
2060
  appliedTheme
2061
2061
  ]
2062
2062
  );
2063
- return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: contextValue, children });
2063
+ return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: contextValue2, children });
2064
2064
  };
2065
2065
  function useTheme() {
2066
2066
  const context = useContext(ThemeContext);
@@ -2084,25 +2084,92 @@ function useTheme() {
2084
2084
  var store = /* @__PURE__ */ new Map();
2085
2085
  var storeListeners = /* @__PURE__ */ new Set();
2086
2086
  var watchCallbacks = /* @__PURE__ */ new Map();
2087
- function advance(entityType, data) {
2088
- const prev = store.get(entityType);
2089
- const oldData = prev?.data ?? [];
2090
- store.set(entityType, { data, version: (prev?.version ?? 0) + 1 });
2087
+ function extractId(record) {
2088
+ const r = record;
2089
+ return String(r.id ?? r._id ?? r.key ?? "");
2090
+ }
2091
+ function materialize(snap) {
2092
+ return snap.ids.map((id) => snap.entities.get(id));
2093
+ }
2094
+ function notifyListeners3(entityType, prev) {
2091
2095
  for (const listener of storeListeners) {
2092
2096
  listener();
2093
2097
  }
2094
2098
  const cbs = watchCallbacks.get(entityType);
2095
2099
  if (cbs) {
2100
+ const oldData = prev ? materialize(prev) : [];
2101
+ const cur = store.get(entityType);
2102
+ const newData = cur ? materialize(cur) : [];
2096
2103
  for (const cb of cbs) {
2097
2104
  try {
2098
- cb(oldData, data);
2105
+ cb(oldData, newData);
2099
2106
  } catch {
2100
2107
  }
2101
2108
  }
2102
2109
  }
2103
2110
  }
2111
+ function setAll(entityType, records) {
2112
+ const entities = /* @__PURE__ */ new Map();
2113
+ const ids = [];
2114
+ for (const r of records) {
2115
+ const rec = r;
2116
+ const id = extractId(rec);
2117
+ if (id) {
2118
+ entities.set(id, rec);
2119
+ ids.push(id);
2120
+ }
2121
+ }
2122
+ const prev = store.get(entityType);
2123
+ store.set(entityType, { entities, ids, version: (prev?.version ?? 0) + 1 });
2124
+ notifyListeners3(entityType, prev);
2125
+ }
2126
+ function upsertOne(entityType, record) {
2127
+ const id = extractId(record);
2128
+ if (!id) return;
2129
+ const prev = store.get(entityType);
2130
+ const snapshot = prev ? { entities: new Map(prev.entities), ids: [...prev.ids], version: prev.version } : { entities: /* @__PURE__ */ new Map(), ids: [], version: 0 };
2131
+ snapshot.entities.set(id, record);
2132
+ if (!snapshot.ids.includes(id)) snapshot.ids.push(id);
2133
+ snapshot.version++;
2134
+ store.set(entityType, snapshot);
2135
+ notifyListeners3(entityType, prev);
2136
+ }
2137
+ function addOne(entityType, record) {
2138
+ upsertOne(entityType, record);
2139
+ }
2140
+ function updateOne(entityType, id, changes) {
2141
+ const prev = store.get(entityType);
2142
+ if (!prev?.entities.has(id)) return;
2143
+ const snapshot = {
2144
+ entities: new Map(prev.entities),
2145
+ ids: [...prev.ids],
2146
+ version: prev.version
2147
+ };
2148
+ snapshot.entities.set(id, { ...snapshot.entities.get(id), ...changes });
2149
+ snapshot.version++;
2150
+ store.set(entityType, snapshot);
2151
+ notifyListeners3(entityType, prev);
2152
+ }
2153
+ function removeOne(entityType, id) {
2154
+ const prev = store.get(entityType);
2155
+ if (!prev) return;
2156
+ const snapshot = {
2157
+ entities: new Map(prev.entities),
2158
+ ids: prev.ids.filter((i) => i !== id),
2159
+ version: prev.version
2160
+ };
2161
+ snapshot.entities.delete(id);
2162
+ snapshot.version++;
2163
+ store.set(entityType, snapshot);
2164
+ notifyListeners3(entityType, prev);
2165
+ }
2104
2166
  function getSnapshot3(entityType) {
2105
- return store.get(entityType)?.data ?? [];
2167
+ const snap = store.get(entityType);
2168
+ if (!snap) return [];
2169
+ return materialize(snap);
2170
+ }
2171
+ function getById(entityType, id) {
2172
+ return store.get(entityType)?.entities.get(id) ?? null;
2106
2173
  }
2107
2174
  function getVersion(entityType) {
2108
2175
  return store.get(entityType)?.version ?? 0;
@@ -2126,15 +2193,21 @@ function useEntityRef(entityType) {
2126
2193
  }, [entityType]);
2127
2194
  return useSyncExternalStore(subscribeToStore, getSnapshotStable, () => []);
2128
2195
  }
2129
- var EntityStoreContext = createContext({
2130
- advance,
2131
- getSnapshot: getSnapshot3
2132
- });
2196
+ var contextValue = {
2197
+ setAll,
2198
+ upsertOne,
2199
+ addOne,
2200
+ updateOne,
2201
+ removeOne,
2202
+ getSnapshot: getSnapshot3,
2203
+ getById
2204
+ };
2205
+ var EntityStoreContext = createContext(contextValue);
2133
2206
  function useEntityStore() {
2134
2207
  return useContext(EntityStoreContext);
2135
2208
  }
2136
2209
  function EntityStoreProvider({ children }) {
2137
- return /* @__PURE__ */ jsx(EntityStoreContext.Provider, { value: { advance, getSnapshot: getSnapshot3 }, children });
2210
+ return /* @__PURE__ */ jsx(EntityStoreContext.Provider, { value: contextValue, children });
2138
2211
  }
2139
2212
  var EventBusContext2 = createContext(null);
2140
2213
  function EventBusProvider({ children, debug: debug2 = false }) {
@@ -2234,7 +2307,7 @@ function EventBusProvider({ children, debug: debug2 = false }) {
2234
2307
  }
2235
2308
  };
2236
2309
  }, [debug2]);
2237
- const contextValue = useMemo(
2310
+ const contextValue2 = useMemo(
2238
2311
  () => ({
2239
2312
  emit,
2240
2313
  on,
@@ -2247,12 +2320,12 @@ function EventBusProvider({ children, debug: debug2 = false }) {
2247
2320
  [emit, on, once, hasListeners, onAny, getSelectedEntity, clearSelectedEntity]
2248
2321
  );
2249
2322
  useEffect(() => {
2250
- setGlobalEventBus(contextValue);
2323
+ setGlobalEventBus(contextValue2);
2251
2324
  return () => {
2252
2325
  setGlobalEventBus(null);
2253
2326
  };
2254
- }, [contextValue]);
2255
- return /* @__PURE__ */ jsx(EventBusContext2.Provider, { value: contextValue, children });
2327
+ }, [contextValue2]);
2328
+ return /* @__PURE__ */ jsx(EventBusContext2.Provider, { value: contextValue2, children });
2256
2329
  }
2257
2330
  var iconAliases = {
2258
2331
  "close": LucideIcons.X,
@@ -9824,6 +9897,42 @@ var orbStyleOverrides = {
9824
9897
  "orb-op-async": { color: ORB_COLORS.dark.async }
9825
9898
  };
9826
9899
  var orbStyle = { ...dark, ...orbStyleOverrides };
9900
+ function computeFoldRegions(code) {
9901
+ const lines = code.split("\n");
9902
+ const regions = [];
9903
+ const stack = [];
9904
+ for (let i = 0; i < lines.length; i++) {
9905
+ const line = lines[i];
9906
+ let inString = false;
9907
+ for (let j = 0; j < line.length; j++) {
9908
+ const ch = line[j];
9909
+ if (ch === "\\" && inString) {
9910
+ j++;
9911
+ continue;
9912
+ }
9913
+ if (ch === '"') {
9914
+ inString = !inString;
9915
+ continue;
9916
+ }
9917
+ if (inString) continue;
9918
+ if (ch === "{" || ch === "[") {
9919
+ stack.push({ line: i, bracket: ch });
9920
+ } else if (ch === "}" || ch === "]") {
9921
+ const open = stack.pop();
9922
+ if (open && open.line < i) {
9923
+ regions.push({
9924
+ start: open.line,
9925
+ end: i,
9926
+ closeBracket: ch
9927
+ });
9928
+ }
9929
+ }
9930
+ }
9931
+ }
9932
+ return regions.sort((a, b) => a.start - b.start);
9933
+ }
9934
+ var LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
9935
+ var HIDDEN_LINE_NUMBERS = { display: "none" };
9827
9936
  var CodeBlock = React117__default.memo(
9828
9937
  ({
9829
9938
  code: rawCode,
@@ -9831,6 +9940,7 @@ var CodeBlock = React117__default.memo(
9831
9940
  showCopyButton = true,
9832
9941
  showLanguageBadge = true,
9833
9942
  maxHeight = "60vh",
9943
+ foldable: foldableProp,
9834
9944
  className
9835
9945
  }) => {
9836
9946
  const code = typeof rawCode === "string" ? rawCode : String(rawCode ?? "");
@@ -9839,8 +9949,114 @@ var CodeBlock = React117__default.memo(
9839
9949
  const eventBus = useEventBus();
9840
9950
  const { t: _t } = useTranslate();
9841
9951
  const scrollRef = useRef(null);
9952
+ const codeRef = useRef(null);
9842
9953
  const savedScrollLeftRef = useRef(0);
9843
9954
  const [copied, setCopied] = useState(false);
9955
+ const isFoldable = foldableProp ?? (language === "orb" || language === "json");
9956
+ const [collapsed, setCollapsed] = useState(() => /* @__PURE__ */ new Set());
9957
+ const foldRegions = useMemo(
9958
+ () => isFoldable ? computeFoldRegions(code) : [],
9959
+ [code, isFoldable]
9960
+ );
9961
+ const foldStartMap = useMemo(() => {
9962
+ const m = /* @__PURE__ */ new Map();
9963
+ for (const r of foldRegions) m.set(r.start, r);
9964
+ return m;
9965
+ }, [foldRegions]);
9966
+ const hiddenLines = useMemo(() => {
9967
+ const h = /* @__PURE__ */ new Set();
9968
+ for (const r of foldRegions) {
9969
+ if (!collapsed.has(r.start)) continue;
9970
+ for (let i = r.start + 1; i <= r.end; i++) h.add(i);
9971
+ }
9972
+ return h;
9973
+ }, [foldRegions, collapsed]);
9974
+ const collapsedRef = useRef(collapsed);
9975
+ collapsedRef.current = collapsed;
9976
+ const foldStartMapRef = useRef(foldStartMap);
9977
+ foldStartMapRef.current = foldStartMap;
9978
+ const toggleFold = useCallback((lineNum) => {
9979
+ setCollapsed((prev) => {
9980
+ const next = new Set(prev);
9981
+ if (next.has(lineNum)) next.delete(lineNum);
9982
+ else next.add(lineNum);
9983
+ return next;
9984
+ });
9985
+ }, []);
9986
+ const toggleFoldRef = useRef(toggleFold);
9987
+ toggleFoldRef.current = toggleFold;
9988
+ useEffect(() => {
9989
+ setCollapsed(/* @__PURE__ */ new Set());
9990
+ }, [code]);
9991
+ const highlightedElement = useMemo(
9992
+ () => /* @__PURE__ */ jsx(
9993
+ SyntaxHighlighter,
9994
+ {
9995
+ PreTag: "div",
9996
+ language,
9997
+ style: activeStyle,
9998
+ wrapLines: true,
9999
+ showLineNumbers: true,
10000
+ showInlineLineNumbers: false,
10001
+ lineNumberContainerStyle: HIDDEN_LINE_NUMBERS,
10002
+ lineProps: LINE_PROPS_FN,
10003
+ customStyle: {
10004
+ backgroundColor: "transparent",
10005
+ borderRadius: 0,
10006
+ padding: 0,
10007
+ margin: 0,
10008
+ whiteSpace: "pre",
10009
+ minWidth: "100%"
10010
+ },
10011
+ children: code
10012
+ }
10013
+ ),
10014
+ [code, language, activeStyle]
10015
+ );
10016
+ useLayoutEffect(() => {
10017
+ const container = codeRef.current;
10018
+ if (!container) return;
10019
+ container.querySelectorAll(".fold-toggle, .fold-summary").forEach((el) => el.remove());
10020
+ const lineEls = container.querySelectorAll("[data-line]");
10021
+ if (!isFoldable || foldRegions.length === 0) {
10022
+ lineEls.forEach((el) => {
10023
+ el.style.display = "";
10024
+ el.style.position = "";
10025
+ el.style.paddingLeft = "";
10026
+ });
10027
+ return;
10028
+ }
10029
+ lineEls.forEach((el) => {
10030
+ const num = parseInt(el.getAttribute("data-line") ?? "-1", 10);
10031
+ if (hiddenLines.has(num)) {
10032
+ el.style.display = "none";
10033
+ return;
10034
+ }
10035
+ el.style.display = "";
10036
+ el.style.position = "relative";
10037
+ el.style.paddingLeft = "1.2em";
10038
+ const region = foldStartMap.get(num);
10039
+ if (!region) return;
10040
+ const isCollapsed = collapsed.has(num);
10041
+ const toggle = document.createElement("span");
10042
+ toggle.className = "fold-toggle";
10043
+ toggle.textContent = isCollapsed ? "\u25B6" : "\u25BC";
10044
+ 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%";
10045
+ toggle.addEventListener("click", (e) => {
10046
+ e.stopPropagation();
10047
+ toggleFoldRef.current(num);
10048
+ });
10049
+ el.insertBefore(toggle, el.firstChild);
10050
+ if (isCollapsed) {
10051
+ const summary = document.createElement("span");
10052
+ summary.className = "fold-summary";
10053
+ summary.style.cssText = "color:#858585;font-style:italic";
10054
+ const count = region.end - region.start - 1;
10055
+ summary.textContent = ` ... ${count} line${count !== 1 ? "s" : ""} ${region.closeBracket}`;
10056
+ el.appendChild(summary);
10057
+ }
10058
+ });
10059
+ }, [collapsed, hiddenLines, foldStartMap, foldRegions, isFoldable]);
9844
10060
  useLayoutEffect(() => {
9845
10061
  const el = scrollRef.current;
9846
10062
  return () => {
@@ -9871,8 +10087,9 @@ var CodeBlock = React117__default.memo(
9871
10087
  eventBus.emit("UI:COPY_CODE", { language, success: false });
9872
10088
  }
9873
10089
  };
10090
+ const hasHeader = showLanguageBadge || showCopyButton;
9874
10091
  return /* @__PURE__ */ jsxs(Box, { className: `relative group ${className || ""}`, children: [
9875
- (showLanguageBadge || showCopyButton) && /* @__PURE__ */ jsxs(
10092
+ hasHeader && /* @__PURE__ */ jsxs(
9876
10093
  HStack,
9877
10094
  {
9878
10095
  justify: "between",
@@ -9907,31 +10124,14 @@ var CodeBlock = React117__default.memo(
9907
10124
  touchAction: "pan-x pan-y",
9908
10125
  contain: "paint",
9909
10126
  backgroundColor: "#1e1e1e",
9910
- borderRadius: showLanguageBadge || showCopyButton ? "0 0 0.5rem 0.5rem" : "0.5rem",
9911
- padding: "1rem"
10127
+ borderRadius: hasHeader ? "0 0 0.5rem 0.5rem" : "0.5rem"
9912
10128
  },
9913
- children: /* @__PURE__ */ jsx(
9914
- SyntaxHighlighter,
9915
- {
9916
- PreTag: "div",
9917
- language,
9918
- style: activeStyle,
9919
- customStyle: {
9920
- backgroundColor: "transparent",
9921
- borderRadius: 0,
9922
- padding: 0,
9923
- margin: 0,
9924
- whiteSpace: "pre",
9925
- minWidth: "100%"
9926
- },
9927
- children: code
9928
- }
9929
- )
10129
+ children: /* @__PURE__ */ jsx("div", { ref: codeRef, style: { padding: "1rem" }, children: highlightedElement })
9930
10130
  }
9931
10131
  )
9932
10132
  ] });
9933
10133
  },
9934
- (prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.maxHeight === next.maxHeight
10134
+ (prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable
9935
10135
  );
9936
10136
  CodeBlock.displayName = "CodeBlock";
9937
10137
  function Card2({
@@ -28867,7 +29067,7 @@ function SequencerBoard({
28867
29067
  setPlayState("playing");
28868
29068
  setCurrentStep(0);
28869
29069
  let step = 0;
28870
- const advance2 = () => {
29070
+ const advance = () => {
28871
29071
  step++;
28872
29072
  if (step >= entity.maxSlots) {
28873
29073
  const playerSeq = slots.map((s) => s?.id);
@@ -28898,10 +29098,10 @@ function SequencerBoard({
28898
29098
  }
28899
29099
  } else {
28900
29100
  setCurrentStep(step);
28901
- timerRef.current = setTimeout(advance2, stepDurationMs);
29101
+ timerRef.current = setTimeout(advance, stepDurationMs);
28902
29102
  }
28903
29103
  };
28904
- timerRef.current = setTimeout(advance2, stepDurationMs);
29104
+ timerRef.current = setTimeout(advance, stepDurationMs);
28905
29105
  }, [canPlay, slots, entity.maxSlots, entity.solutions, stepDurationMs, playEvent, completeEvent, emit]);
28906
29106
  const machine = {
28907
29107
  name: entity.title,
@@ -32391,13 +32591,14 @@ function getToastPosition(position) {
32391
32591
  return "top-4 right-4";
32392
32592
  }
32393
32593
  }
32394
- function renderPatternChildren(children, onDismiss, parentId = "root") {
32594
+ function renderPatternChildren(children, onDismiss, parentId = "root", parentPath = "root") {
32395
32595
  if (!children || !Array.isArray(children) || children.length === 0) {
32396
32596
  return null;
32397
32597
  }
32398
32598
  return children.map((child, index) => {
32399
32599
  if (!child || typeof child !== "object") return null;
32400
32600
  const childId = `${parentId}-${index}`;
32601
+ const childPath = parentPath === "root" ? `root.children.${index}` : `${parentPath}.children.${index}`;
32401
32602
  const childContent = {
32402
32603
  id: childId,
32403
32604
  pattern: child.type,
@@ -32409,7 +32610,8 @@ function renderPatternChildren(children, onDismiss, parentId = "root") {
32409
32610
  SlotContentRenderer,
32410
32611
  {
32411
32612
  content: childContent,
32412
- onDismiss
32613
+ onDismiss,
32614
+ patternPath: childPath
32413
32615
  },
32414
32616
  childId
32415
32617
  );
@@ -32441,7 +32643,8 @@ function renderPatternProps(props, onDismiss) {
32441
32643
  }
32442
32644
  function SlotContentRenderer({
32443
32645
  content,
32444
- onDismiss
32646
+ onDismiss,
32647
+ patternPath
32445
32648
  }) {
32446
32649
  const entityProp = content.props.entity;
32447
32650
  const entityType = typeof entityProp === "string" ? entityProp : "";
@@ -32450,7 +32653,8 @@ function SlotContentRenderer({
32450
32653
  if (PatternComponent) {
32451
32654
  const childrenConfig = content.props.children;
32452
32655
  const hasChildren = PATTERNS_WITH_CHILDREN.has(content.pattern) || Array.isArray(childrenConfig) && childrenConfig.length > 0;
32453
- const renderedChildren = hasChildren ? renderPatternChildren(childrenConfig, onDismiss, content.id) : void 0;
32656
+ const myPath = patternPath ?? "root";
32657
+ const renderedChildren = hasChildren ? renderPatternChildren(childrenConfig, onDismiss, content.id, myPath) : void 0;
32454
32658
  const { children: _childrenConfig, ...restProps } = content.props;
32455
32659
  const renderedProps = renderPatternProps(restProps, onDismiss);
32456
32660
  let finalProps;
@@ -32466,6 +32670,7 @@ function SlotContentRenderer({
32466
32670
  } else {
32467
32671
  finalProps = renderedProps;
32468
32672
  }
32673
+ const acceptsChildren = PATTERNS_WITH_CHILDREN.has(content.pattern);
32469
32674
  return /* @__PURE__ */ jsx(
32470
32675
  Box,
32471
32676
  {
@@ -32474,6 +32679,9 @@ function SlotContentRenderer({
32474
32679
  "data-id": content.id,
32475
32680
  "data-node-id": content.nodeId,
32476
32681
  "data-source-trait": content.sourceTrait,
32682
+ "data-pattern-path": myPath,
32683
+ "data-pattern-type": content.pattern,
32684
+ "data-accepts-children": acceptsChildren ? "true" : void 0,
32477
32685
  children: /* @__PURE__ */ jsx(PatternComponent, { ...finalProps, children: renderedChildren })
32478
32686
  }
32479
32687
  );
@@ -32913,7 +33121,7 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate }) {
32913
33121
  if (responseData) {
32914
33122
  for (const [entityType, records] of Object.entries(responseData)) {
32915
33123
  if (Array.isArray(records)) {
32916
- entityStore.advance(entityType, records);
33124
+ entityStore.setAll(entityType, records);
32917
33125
  }
32918
33126
  }
32919
33127
  }
@@ -32972,7 +33180,7 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate }) {
32972
33180
  if (initResponseData) {
32973
33181
  for (const [entityType, records] of Object.entries(initResponseData)) {
32974
33182
  if (Array.isArray(records)) {
32975
- entityStore.advance(entityType, records);
33183
+ entityStore.setAll(entityType, records);
32976
33184
  }
32977
33185
  }
32978
33186
  }
@@ -33021,7 +33229,7 @@ function SchemaRunner({ schema, serverUrl, mockData, pageName, onNavigate }) {
33021
33229
  if (!serverUrl && mockData) {
33022
33230
  for (const [entityType, records] of Object.entries(mockData)) {
33023
33231
  if (Array.isArray(records)) {
33024
- entityStore.advance(entityType, records);
33232
+ entityStore.setAll(entityType, records);
33025
33233
  }
33026
33234
  }
33027
33235
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "2.42.0",
3
+ "version": "2.43.0",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "main": "./dist/components/index.js",