@almadar/ui 2.47.0 → 2.48.2
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 +8 -7
- package/dist/avl/index.js +8 -7
- package/dist/components/index.cjs +15 -55
- package/dist/components/index.js +15 -55
- package/dist/components/molecules/DataGrid.d.ts +7 -0
- package/dist/components/molecules/DataList.d.ts +7 -0
- package/dist/hooks/index.cjs +15 -55
- package/dist/hooks/index.js +15 -55
- package/dist/runtime/index.cjs +8 -7
- package/dist/runtime/index.js +8 -7
- package/package.json +1 -1
package/dist/avl/index.cjs
CHANGED
|
@@ -47219,15 +47219,16 @@ function SchemaRunner({ schema, serverUrl, mockData, pageName, onNavigate }) {
|
|
|
47219
47219
|
return orbitals.filter((o) => typeof o.name === "string").map((o) => o.name);
|
|
47220
47220
|
}, [schema]);
|
|
47221
47221
|
const entityStore = useEntityStore();
|
|
47222
|
-
React125.
|
|
47223
|
-
|
|
47224
|
-
|
|
47225
|
-
|
|
47226
|
-
|
|
47227
|
-
|
|
47222
|
+
const seededRef = React125.useRef("");
|
|
47223
|
+
const mockKey = mockData ? Object.keys(mockData).sort().join(",") : "";
|
|
47224
|
+
if (!serverUrl && mockData && seededRef.current !== mockKey) {
|
|
47225
|
+
seededRef.current = mockKey;
|
|
47226
|
+
for (const [entityType, records] of Object.entries(mockData)) {
|
|
47227
|
+
if (Array.isArray(records)) {
|
|
47228
|
+
entityStore.setAll(entityType, records);
|
|
47228
47229
|
}
|
|
47229
47230
|
}
|
|
47230
|
-
}
|
|
47231
|
+
}
|
|
47231
47232
|
const inner = /* @__PURE__ */ jsxRuntime.jsx(VerificationProvider, { enabled: true, children: /* @__PURE__ */ jsxRuntime.jsx(SlotsProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(EntitySchemaProvider, { entities: Array.from(allEntities.values()), children: [
|
|
47232
47233
|
/* @__PURE__ */ jsxRuntime.jsx(TraitInitializer, { traits: allPageTraits, orbitalNames: serverUrl ? orbitalNames : void 0, onNavigate }),
|
|
47233
47234
|
/* @__PURE__ */ jsxRuntime.jsx(SlotBridge, {}),
|
package/dist/avl/index.js
CHANGED
|
@@ -47171,15 +47171,16 @@ function SchemaRunner({ schema, serverUrl, mockData, pageName, onNavigate }) {
|
|
|
47171
47171
|
return orbitals.filter((o) => typeof o.name === "string").map((o) => o.name);
|
|
47172
47172
|
}, [schema]);
|
|
47173
47173
|
const entityStore = useEntityStore();
|
|
47174
|
-
|
|
47175
|
-
|
|
47176
|
-
|
|
47177
|
-
|
|
47178
|
-
|
|
47179
|
-
|
|
47174
|
+
const seededRef = useRef("");
|
|
47175
|
+
const mockKey = mockData ? Object.keys(mockData).sort().join(",") : "";
|
|
47176
|
+
if (!serverUrl && mockData && seededRef.current !== mockKey) {
|
|
47177
|
+
seededRef.current = mockKey;
|
|
47178
|
+
for (const [entityType, records] of Object.entries(mockData)) {
|
|
47179
|
+
if (Array.isArray(records)) {
|
|
47180
|
+
entityStore.setAll(entityType, records);
|
|
47180
47181
|
}
|
|
47181
47182
|
}
|
|
47182
|
-
}
|
|
47183
|
+
}
|
|
47183
47184
|
const inner = /* @__PURE__ */ jsx(VerificationProvider, { enabled: true, children: /* @__PURE__ */ jsx(SlotsProvider, { children: /* @__PURE__ */ jsxs(EntitySchemaProvider, { entities: Array.from(allEntities.values()), children: [
|
|
47184
47185
|
/* @__PURE__ */ jsx(TraitInitializer, { traits: allPageTraits, orbitalNames: serverUrl ? orbitalNames : void 0, onNavigate }),
|
|
47185
47186
|
/* @__PURE__ */ jsx(SlotBridge, {}),
|
|
@@ -36914,31 +36914,7 @@ function useUISlotManager() {
|
|
|
36914
36914
|
var SelectionContext = React90.createContext(null);
|
|
36915
36915
|
|
|
36916
36916
|
// hooks/useUIEvents.ts
|
|
36917
|
-
var
|
|
36918
|
-
// Form/CRUD events
|
|
36919
|
-
"UI:SAVE": "SAVE",
|
|
36920
|
-
"UI:CANCEL": "CANCEL",
|
|
36921
|
-
"UI:CLOSE": "CLOSE",
|
|
36922
|
-
"UI:VIEW": "VIEW",
|
|
36923
|
-
"UI:EDIT": "EDIT",
|
|
36924
|
-
"UI:DELETE": "DELETE",
|
|
36925
|
-
"UI:CREATE": "CREATE",
|
|
36926
|
-
"UI:SELECT": "SELECT",
|
|
36927
|
-
"UI:DESELECT": "DESELECT",
|
|
36928
|
-
"UI:SUBMIT": "SAVE",
|
|
36929
|
-
"UI:UPDATE_STATUS": "UPDATE_STATUS",
|
|
36930
|
-
"UI:SEARCH": "SEARCH",
|
|
36931
|
-
"UI:CLEAR_SEARCH": "CLEAR_SEARCH",
|
|
36932
|
-
"UI:ADD": "CREATE",
|
|
36933
|
-
// Game events (for closed circuit with GameMenu, GamePauseOverlay, GameOverScreen)
|
|
36934
|
-
"UI:PAUSE": "PAUSE",
|
|
36935
|
-
"UI:RESUME": "RESUME",
|
|
36936
|
-
"UI:RESTART": "RESTART",
|
|
36937
|
-
"UI:GAME_OVER": "GAME_OVER",
|
|
36938
|
-
"UI:START": "START",
|
|
36939
|
-
"UI:QUIT": "QUIT",
|
|
36940
|
-
"UI:INIT": "INIT"
|
|
36941
|
-
};
|
|
36917
|
+
var UI_PREFIX = "UI:";
|
|
36942
36918
|
function useUIEvents(dispatch, validEvents, eventBusInstance) {
|
|
36943
36919
|
const defaultEventBus = useEventBus();
|
|
36944
36920
|
const eventBus = eventBusInstance ?? defaultEventBus;
|
|
@@ -36950,15 +36926,18 @@ function useUIEvents(dispatch, validEvents, eventBusInstance) {
|
|
|
36950
36926
|
);
|
|
36951
36927
|
React90.useEffect(() => {
|
|
36952
36928
|
const unsubscribes = [];
|
|
36953
|
-
|
|
36954
|
-
const
|
|
36955
|
-
|
|
36929
|
+
if (stableValidEvents) {
|
|
36930
|
+
for (const smEvent of stableValidEvents) {
|
|
36931
|
+
const prefixedHandler = (event) => {
|
|
36956
36932
|
dispatch(smEvent, event.payload);
|
|
36957
|
-
}
|
|
36958
|
-
|
|
36959
|
-
|
|
36960
|
-
|
|
36961
|
-
|
|
36933
|
+
};
|
|
36934
|
+
unsubscribes.push(eventBus.on(`${UI_PREFIX}${smEvent}`, prefixedHandler));
|
|
36935
|
+
const directHandler = (event) => {
|
|
36936
|
+
dispatch(smEvent, event.payload);
|
|
36937
|
+
};
|
|
36938
|
+
unsubscribes.push(eventBus.on(smEvent, directHandler));
|
|
36939
|
+
}
|
|
36940
|
+
}
|
|
36962
36941
|
const genericHandler = (event) => {
|
|
36963
36942
|
const eventName = event.payload?.event;
|
|
36964
36943
|
if (eventName) {
|
|
@@ -36968,30 +36947,11 @@ function useUIEvents(dispatch, validEvents, eventBusInstance) {
|
|
|
36968
36947
|
}
|
|
36969
36948
|
}
|
|
36970
36949
|
};
|
|
36971
|
-
|
|
36972
|
-
unsubscribes.push(genericUnsubscribe);
|
|
36973
|
-
if (stableValidEvents) {
|
|
36974
|
-
stableValidEvents.forEach((smEvent) => {
|
|
36975
|
-
const uiPrefixedEvent = `UI:${smEvent}`;
|
|
36976
|
-
const alreadyMapped = Object.keys(UI_EVENT_MAP).includes(uiPrefixedEvent);
|
|
36977
|
-
if (!alreadyMapped) {
|
|
36978
|
-
const directHandler = (event) => {
|
|
36979
|
-
dispatch(smEvent, event.payload);
|
|
36980
|
-
};
|
|
36981
|
-
const unsubscribePrefixed = eventBus.on(
|
|
36982
|
-
uiPrefixedEvent,
|
|
36983
|
-
directHandler
|
|
36984
|
-
);
|
|
36985
|
-
unsubscribes.push(unsubscribePrefixed);
|
|
36986
|
-
const unsubscribeDirect = eventBus.on(smEvent, directHandler);
|
|
36987
|
-
unsubscribes.push(unsubscribeDirect);
|
|
36988
|
-
}
|
|
36989
|
-
});
|
|
36990
|
-
}
|
|
36950
|
+
unsubscribes.push(eventBus.on(`${UI_PREFIX}DISPATCH`, genericHandler));
|
|
36991
36951
|
return () => {
|
|
36992
|
-
|
|
36952
|
+
for (const unsub of unsubscribes) {
|
|
36993
36953
|
if (typeof unsub === "function") unsub();
|
|
36994
|
-
}
|
|
36954
|
+
}
|
|
36995
36955
|
};
|
|
36996
36956
|
}, [eventBus, dispatch, stableValidEvents]);
|
|
36997
36957
|
}
|
package/dist/components/index.js
CHANGED
|
@@ -36867,31 +36867,7 @@ function useUISlotManager() {
|
|
|
36867
36867
|
var SelectionContext = createContext(null);
|
|
36868
36868
|
|
|
36869
36869
|
// hooks/useUIEvents.ts
|
|
36870
|
-
var
|
|
36871
|
-
// Form/CRUD events
|
|
36872
|
-
"UI:SAVE": "SAVE",
|
|
36873
|
-
"UI:CANCEL": "CANCEL",
|
|
36874
|
-
"UI:CLOSE": "CLOSE",
|
|
36875
|
-
"UI:VIEW": "VIEW",
|
|
36876
|
-
"UI:EDIT": "EDIT",
|
|
36877
|
-
"UI:DELETE": "DELETE",
|
|
36878
|
-
"UI:CREATE": "CREATE",
|
|
36879
|
-
"UI:SELECT": "SELECT",
|
|
36880
|
-
"UI:DESELECT": "DESELECT",
|
|
36881
|
-
"UI:SUBMIT": "SAVE",
|
|
36882
|
-
"UI:UPDATE_STATUS": "UPDATE_STATUS",
|
|
36883
|
-
"UI:SEARCH": "SEARCH",
|
|
36884
|
-
"UI:CLEAR_SEARCH": "CLEAR_SEARCH",
|
|
36885
|
-
"UI:ADD": "CREATE",
|
|
36886
|
-
// Game events (for closed circuit with GameMenu, GamePauseOverlay, GameOverScreen)
|
|
36887
|
-
"UI:PAUSE": "PAUSE",
|
|
36888
|
-
"UI:RESUME": "RESUME",
|
|
36889
|
-
"UI:RESTART": "RESTART",
|
|
36890
|
-
"UI:GAME_OVER": "GAME_OVER",
|
|
36891
|
-
"UI:START": "START",
|
|
36892
|
-
"UI:QUIT": "QUIT",
|
|
36893
|
-
"UI:INIT": "INIT"
|
|
36894
|
-
};
|
|
36870
|
+
var UI_PREFIX = "UI:";
|
|
36895
36871
|
function useUIEvents(dispatch, validEvents, eventBusInstance) {
|
|
36896
36872
|
const defaultEventBus = useEventBus();
|
|
36897
36873
|
const eventBus = eventBusInstance ?? defaultEventBus;
|
|
@@ -36903,15 +36879,18 @@ function useUIEvents(dispatch, validEvents, eventBusInstance) {
|
|
|
36903
36879
|
);
|
|
36904
36880
|
useEffect(() => {
|
|
36905
36881
|
const unsubscribes = [];
|
|
36906
|
-
|
|
36907
|
-
const
|
|
36908
|
-
|
|
36882
|
+
if (stableValidEvents) {
|
|
36883
|
+
for (const smEvent of stableValidEvents) {
|
|
36884
|
+
const prefixedHandler = (event) => {
|
|
36909
36885
|
dispatch(smEvent, event.payload);
|
|
36910
|
-
}
|
|
36911
|
-
|
|
36912
|
-
|
|
36913
|
-
|
|
36914
|
-
|
|
36886
|
+
};
|
|
36887
|
+
unsubscribes.push(eventBus.on(`${UI_PREFIX}${smEvent}`, prefixedHandler));
|
|
36888
|
+
const directHandler = (event) => {
|
|
36889
|
+
dispatch(smEvent, event.payload);
|
|
36890
|
+
};
|
|
36891
|
+
unsubscribes.push(eventBus.on(smEvent, directHandler));
|
|
36892
|
+
}
|
|
36893
|
+
}
|
|
36915
36894
|
const genericHandler = (event) => {
|
|
36916
36895
|
const eventName = event.payload?.event;
|
|
36917
36896
|
if (eventName) {
|
|
@@ -36921,30 +36900,11 @@ function useUIEvents(dispatch, validEvents, eventBusInstance) {
|
|
|
36921
36900
|
}
|
|
36922
36901
|
}
|
|
36923
36902
|
};
|
|
36924
|
-
|
|
36925
|
-
unsubscribes.push(genericUnsubscribe);
|
|
36926
|
-
if (stableValidEvents) {
|
|
36927
|
-
stableValidEvents.forEach((smEvent) => {
|
|
36928
|
-
const uiPrefixedEvent = `UI:${smEvent}`;
|
|
36929
|
-
const alreadyMapped = Object.keys(UI_EVENT_MAP).includes(uiPrefixedEvent);
|
|
36930
|
-
if (!alreadyMapped) {
|
|
36931
|
-
const directHandler = (event) => {
|
|
36932
|
-
dispatch(smEvent, event.payload);
|
|
36933
|
-
};
|
|
36934
|
-
const unsubscribePrefixed = eventBus.on(
|
|
36935
|
-
uiPrefixedEvent,
|
|
36936
|
-
directHandler
|
|
36937
|
-
);
|
|
36938
|
-
unsubscribes.push(unsubscribePrefixed);
|
|
36939
|
-
const unsubscribeDirect = eventBus.on(smEvent, directHandler);
|
|
36940
|
-
unsubscribes.push(unsubscribeDirect);
|
|
36941
|
-
}
|
|
36942
|
-
});
|
|
36943
|
-
}
|
|
36903
|
+
unsubscribes.push(eventBus.on(`${UI_PREFIX}DISPATCH`, genericHandler));
|
|
36944
36904
|
return () => {
|
|
36945
|
-
|
|
36905
|
+
for (const unsub of unsubscribes) {
|
|
36946
36906
|
if (typeof unsub === "function") unsub();
|
|
36947
|
-
}
|
|
36907
|
+
}
|
|
36948
36908
|
};
|
|
36949
36909
|
}, [eventBus, dispatch, stableValidEvents]);
|
|
36950
36910
|
}
|
|
@@ -69,6 +69,13 @@ export interface DataGridProps {
|
|
|
69
69
|
hasMore?: boolean;
|
|
70
70
|
/** Render prop for custom per-item content. When provided, `fields` and `itemActions` are ignored. */
|
|
71
71
|
children?: (item: Record<string, unknown>, index: number) => React.ReactNode;
|
|
72
|
+
/**
|
|
73
|
+
* Per-item render function (schema-level alias for children render prop).
|
|
74
|
+
* In .orb schemas: ["fn", "item", { pattern tree with @item.field bindings }]
|
|
75
|
+
* The compiler converts this to the children render prop.
|
|
76
|
+
* @deprecated Use children render prop in React code. This prop exists for pattern registry sync.
|
|
77
|
+
*/
|
|
78
|
+
renderItem?: (item: Record<string, unknown>, index: number) => React.ReactNode;
|
|
72
79
|
/** Max items to show before "Show More" button. Defaults to 0 (disabled). */
|
|
73
80
|
pageSize?: number;
|
|
74
81
|
}
|
|
@@ -89,6 +89,13 @@ export interface DataListProps {
|
|
|
89
89
|
hasMore?: boolean;
|
|
90
90
|
/** Render prop for custom per-item content. When provided, `fields` and `itemActions` are ignored. */
|
|
91
91
|
children?: (item: Record<string, unknown>, index: number) => React.ReactNode;
|
|
92
|
+
/**
|
|
93
|
+
* Per-item render function (schema-level alias for children render prop).
|
|
94
|
+
* In .orb schemas: ["fn", "item", { pattern tree with @item.field bindings }]
|
|
95
|
+
* The compiler converts this to the children render prop.
|
|
96
|
+
* @deprecated Use children render prop in React code. This prop exists for pattern registry sync.
|
|
97
|
+
*/
|
|
98
|
+
renderItem?: (item: Record<string, unknown>, index: number) => React.ReactNode;
|
|
92
99
|
/** Max items to show before "Show More" button. Defaults to 5. Set to 0 to disable. */
|
|
93
100
|
pageSize?: number;
|
|
94
101
|
}
|
package/dist/hooks/index.cjs
CHANGED
|
@@ -1177,31 +1177,7 @@ function useUISlotManager() {
|
|
|
1177
1177
|
var SelectionContext = React2.createContext(null);
|
|
1178
1178
|
|
|
1179
1179
|
// hooks/useUIEvents.ts
|
|
1180
|
-
var
|
|
1181
|
-
// Form/CRUD events
|
|
1182
|
-
"UI:SAVE": "SAVE",
|
|
1183
|
-
"UI:CANCEL": "CANCEL",
|
|
1184
|
-
"UI:CLOSE": "CLOSE",
|
|
1185
|
-
"UI:VIEW": "VIEW",
|
|
1186
|
-
"UI:EDIT": "EDIT",
|
|
1187
|
-
"UI:DELETE": "DELETE",
|
|
1188
|
-
"UI:CREATE": "CREATE",
|
|
1189
|
-
"UI:SELECT": "SELECT",
|
|
1190
|
-
"UI:DESELECT": "DESELECT",
|
|
1191
|
-
"UI:SUBMIT": "SAVE",
|
|
1192
|
-
"UI:UPDATE_STATUS": "UPDATE_STATUS",
|
|
1193
|
-
"UI:SEARCH": "SEARCH",
|
|
1194
|
-
"UI:CLEAR_SEARCH": "CLEAR_SEARCH",
|
|
1195
|
-
"UI:ADD": "CREATE",
|
|
1196
|
-
// Game events (for closed circuit with GameMenu, GamePauseOverlay, GameOverScreen)
|
|
1197
|
-
"UI:PAUSE": "PAUSE",
|
|
1198
|
-
"UI:RESUME": "RESUME",
|
|
1199
|
-
"UI:RESTART": "RESTART",
|
|
1200
|
-
"UI:GAME_OVER": "GAME_OVER",
|
|
1201
|
-
"UI:START": "START",
|
|
1202
|
-
"UI:QUIT": "QUIT",
|
|
1203
|
-
"UI:INIT": "INIT"
|
|
1204
|
-
};
|
|
1180
|
+
var UI_PREFIX = "UI:";
|
|
1205
1181
|
function useUIEvents(dispatch, validEvents, eventBusInstance) {
|
|
1206
1182
|
const defaultEventBus = useEventBus();
|
|
1207
1183
|
const eventBus = eventBusInstance ?? defaultEventBus;
|
|
@@ -1213,15 +1189,18 @@ function useUIEvents(dispatch, validEvents, eventBusInstance) {
|
|
|
1213
1189
|
);
|
|
1214
1190
|
React2.useEffect(() => {
|
|
1215
1191
|
const unsubscribes = [];
|
|
1216
|
-
|
|
1217
|
-
const
|
|
1218
|
-
|
|
1192
|
+
if (stableValidEvents) {
|
|
1193
|
+
for (const smEvent of stableValidEvents) {
|
|
1194
|
+
const prefixedHandler = (event) => {
|
|
1219
1195
|
dispatch(smEvent, event.payload);
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1196
|
+
};
|
|
1197
|
+
unsubscribes.push(eventBus.on(`${UI_PREFIX}${smEvent}`, prefixedHandler));
|
|
1198
|
+
const directHandler = (event) => {
|
|
1199
|
+
dispatch(smEvent, event.payload);
|
|
1200
|
+
};
|
|
1201
|
+
unsubscribes.push(eventBus.on(smEvent, directHandler));
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1225
1204
|
const genericHandler = (event) => {
|
|
1226
1205
|
const eventName = event.payload?.event;
|
|
1227
1206
|
if (eventName) {
|
|
@@ -1231,30 +1210,11 @@ function useUIEvents(dispatch, validEvents, eventBusInstance) {
|
|
|
1231
1210
|
}
|
|
1232
1211
|
}
|
|
1233
1212
|
};
|
|
1234
|
-
|
|
1235
|
-
unsubscribes.push(genericUnsubscribe);
|
|
1236
|
-
if (stableValidEvents) {
|
|
1237
|
-
stableValidEvents.forEach((smEvent) => {
|
|
1238
|
-
const uiPrefixedEvent = `UI:${smEvent}`;
|
|
1239
|
-
const alreadyMapped = Object.keys(UI_EVENT_MAP).includes(uiPrefixedEvent);
|
|
1240
|
-
if (!alreadyMapped) {
|
|
1241
|
-
const directHandler = (event) => {
|
|
1242
|
-
dispatch(smEvent, event.payload);
|
|
1243
|
-
};
|
|
1244
|
-
const unsubscribePrefixed = eventBus.on(
|
|
1245
|
-
uiPrefixedEvent,
|
|
1246
|
-
directHandler
|
|
1247
|
-
);
|
|
1248
|
-
unsubscribes.push(unsubscribePrefixed);
|
|
1249
|
-
const unsubscribeDirect = eventBus.on(smEvent, directHandler);
|
|
1250
|
-
unsubscribes.push(unsubscribeDirect);
|
|
1251
|
-
}
|
|
1252
|
-
});
|
|
1253
|
-
}
|
|
1213
|
+
unsubscribes.push(eventBus.on(`${UI_PREFIX}DISPATCH`, genericHandler));
|
|
1254
1214
|
return () => {
|
|
1255
|
-
|
|
1215
|
+
for (const unsub of unsubscribes) {
|
|
1256
1216
|
if (typeof unsub === "function") unsub();
|
|
1257
|
-
}
|
|
1217
|
+
}
|
|
1258
1218
|
};
|
|
1259
1219
|
}, [eventBus, dispatch, stableValidEvents]);
|
|
1260
1220
|
}
|
package/dist/hooks/index.js
CHANGED
|
@@ -1170,31 +1170,7 @@ function useUISlotManager() {
|
|
|
1170
1170
|
var SelectionContext = createContext(null);
|
|
1171
1171
|
|
|
1172
1172
|
// hooks/useUIEvents.ts
|
|
1173
|
-
var
|
|
1174
|
-
// Form/CRUD events
|
|
1175
|
-
"UI:SAVE": "SAVE",
|
|
1176
|
-
"UI:CANCEL": "CANCEL",
|
|
1177
|
-
"UI:CLOSE": "CLOSE",
|
|
1178
|
-
"UI:VIEW": "VIEW",
|
|
1179
|
-
"UI:EDIT": "EDIT",
|
|
1180
|
-
"UI:DELETE": "DELETE",
|
|
1181
|
-
"UI:CREATE": "CREATE",
|
|
1182
|
-
"UI:SELECT": "SELECT",
|
|
1183
|
-
"UI:DESELECT": "DESELECT",
|
|
1184
|
-
"UI:SUBMIT": "SAVE",
|
|
1185
|
-
"UI:UPDATE_STATUS": "UPDATE_STATUS",
|
|
1186
|
-
"UI:SEARCH": "SEARCH",
|
|
1187
|
-
"UI:CLEAR_SEARCH": "CLEAR_SEARCH",
|
|
1188
|
-
"UI:ADD": "CREATE",
|
|
1189
|
-
// Game events (for closed circuit with GameMenu, GamePauseOverlay, GameOverScreen)
|
|
1190
|
-
"UI:PAUSE": "PAUSE",
|
|
1191
|
-
"UI:RESUME": "RESUME",
|
|
1192
|
-
"UI:RESTART": "RESTART",
|
|
1193
|
-
"UI:GAME_OVER": "GAME_OVER",
|
|
1194
|
-
"UI:START": "START",
|
|
1195
|
-
"UI:QUIT": "QUIT",
|
|
1196
|
-
"UI:INIT": "INIT"
|
|
1197
|
-
};
|
|
1173
|
+
var UI_PREFIX = "UI:";
|
|
1198
1174
|
function useUIEvents(dispatch, validEvents, eventBusInstance) {
|
|
1199
1175
|
const defaultEventBus = useEventBus();
|
|
1200
1176
|
const eventBus = eventBusInstance ?? defaultEventBus;
|
|
@@ -1206,15 +1182,18 @@ function useUIEvents(dispatch, validEvents, eventBusInstance) {
|
|
|
1206
1182
|
);
|
|
1207
1183
|
useEffect(() => {
|
|
1208
1184
|
const unsubscribes = [];
|
|
1209
|
-
|
|
1210
|
-
const
|
|
1211
|
-
|
|
1185
|
+
if (stableValidEvents) {
|
|
1186
|
+
for (const smEvent of stableValidEvents) {
|
|
1187
|
+
const prefixedHandler = (event) => {
|
|
1212
1188
|
dispatch(smEvent, event.payload);
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1189
|
+
};
|
|
1190
|
+
unsubscribes.push(eventBus.on(`${UI_PREFIX}${smEvent}`, prefixedHandler));
|
|
1191
|
+
const directHandler = (event) => {
|
|
1192
|
+
dispatch(smEvent, event.payload);
|
|
1193
|
+
};
|
|
1194
|
+
unsubscribes.push(eventBus.on(smEvent, directHandler));
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1218
1197
|
const genericHandler = (event) => {
|
|
1219
1198
|
const eventName = event.payload?.event;
|
|
1220
1199
|
if (eventName) {
|
|
@@ -1224,30 +1203,11 @@ function useUIEvents(dispatch, validEvents, eventBusInstance) {
|
|
|
1224
1203
|
}
|
|
1225
1204
|
}
|
|
1226
1205
|
};
|
|
1227
|
-
|
|
1228
|
-
unsubscribes.push(genericUnsubscribe);
|
|
1229
|
-
if (stableValidEvents) {
|
|
1230
|
-
stableValidEvents.forEach((smEvent) => {
|
|
1231
|
-
const uiPrefixedEvent = `UI:${smEvent}`;
|
|
1232
|
-
const alreadyMapped = Object.keys(UI_EVENT_MAP).includes(uiPrefixedEvent);
|
|
1233
|
-
if (!alreadyMapped) {
|
|
1234
|
-
const directHandler = (event) => {
|
|
1235
|
-
dispatch(smEvent, event.payload);
|
|
1236
|
-
};
|
|
1237
|
-
const unsubscribePrefixed = eventBus.on(
|
|
1238
|
-
uiPrefixedEvent,
|
|
1239
|
-
directHandler
|
|
1240
|
-
);
|
|
1241
|
-
unsubscribes.push(unsubscribePrefixed);
|
|
1242
|
-
const unsubscribeDirect = eventBus.on(smEvent, directHandler);
|
|
1243
|
-
unsubscribes.push(unsubscribeDirect);
|
|
1244
|
-
}
|
|
1245
|
-
});
|
|
1246
|
-
}
|
|
1206
|
+
unsubscribes.push(eventBus.on(`${UI_PREFIX}DISPATCH`, genericHandler));
|
|
1247
1207
|
return () => {
|
|
1248
|
-
|
|
1208
|
+
for (const unsub of unsubscribes) {
|
|
1249
1209
|
if (typeof unsub === "function") unsub();
|
|
1250
|
-
}
|
|
1210
|
+
}
|
|
1251
1211
|
};
|
|
1252
1212
|
}, [eventBus, dispatch, stableValidEvents]);
|
|
1253
1213
|
}
|
package/dist/runtime/index.cjs
CHANGED
|
@@ -33643,15 +33643,16 @@ function SchemaRunner({ schema, serverUrl, mockData, pageName, onNavigate }) {
|
|
|
33643
33643
|
return orbitals.filter((o) => typeof o.name === "string").map((o) => o.name);
|
|
33644
33644
|
}, [schema]);
|
|
33645
33645
|
const entityStore = useEntityStore();
|
|
33646
|
-
React117.
|
|
33647
|
-
|
|
33648
|
-
|
|
33649
|
-
|
|
33650
|
-
|
|
33651
|
-
|
|
33646
|
+
const seededRef = React117.useRef("");
|
|
33647
|
+
const mockKey = mockData ? Object.keys(mockData).sort().join(",") : "";
|
|
33648
|
+
if (!serverUrl && mockData && seededRef.current !== mockKey) {
|
|
33649
|
+
seededRef.current = mockKey;
|
|
33650
|
+
for (const [entityType, records] of Object.entries(mockData)) {
|
|
33651
|
+
if (Array.isArray(records)) {
|
|
33652
|
+
entityStore.setAll(entityType, records);
|
|
33652
33653
|
}
|
|
33653
33654
|
}
|
|
33654
|
-
}
|
|
33655
|
+
}
|
|
33655
33656
|
const inner = /* @__PURE__ */ jsxRuntime.jsx(VerificationProvider, { enabled: true, children: /* @__PURE__ */ jsxRuntime.jsx(SlotsProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(EntitySchemaProvider, { entities: Array.from(allEntities.values()), children: [
|
|
33656
33657
|
/* @__PURE__ */ jsxRuntime.jsx(TraitInitializer, { traits: allPageTraits, orbitalNames: serverUrl ? orbitalNames : void 0, onNavigate }),
|
|
33657
33658
|
/* @__PURE__ */ jsxRuntime.jsx(SlotBridge, {}),
|
package/dist/runtime/index.js
CHANGED
|
@@ -33596,15 +33596,16 @@ function SchemaRunner({ schema, serverUrl, mockData, pageName, onNavigate }) {
|
|
|
33596
33596
|
return orbitals.filter((o) => typeof o.name === "string").map((o) => o.name);
|
|
33597
33597
|
}, [schema]);
|
|
33598
33598
|
const entityStore = useEntityStore();
|
|
33599
|
-
|
|
33600
|
-
|
|
33601
|
-
|
|
33602
|
-
|
|
33603
|
-
|
|
33604
|
-
|
|
33599
|
+
const seededRef = useRef("");
|
|
33600
|
+
const mockKey = mockData ? Object.keys(mockData).sort().join(",") : "";
|
|
33601
|
+
if (!serverUrl && mockData && seededRef.current !== mockKey) {
|
|
33602
|
+
seededRef.current = mockKey;
|
|
33603
|
+
for (const [entityType, records] of Object.entries(mockData)) {
|
|
33604
|
+
if (Array.isArray(records)) {
|
|
33605
|
+
entityStore.setAll(entityType, records);
|
|
33605
33606
|
}
|
|
33606
33607
|
}
|
|
33607
|
-
}
|
|
33608
|
+
}
|
|
33608
33609
|
const inner = /* @__PURE__ */ jsx(VerificationProvider, { enabled: true, children: /* @__PURE__ */ jsx(SlotsProvider, { children: /* @__PURE__ */ jsxs(EntitySchemaProvider, { entities: Array.from(allEntities.values()), children: [
|
|
33609
33610
|
/* @__PURE__ */ jsx(TraitInitializer, { traits: allPageTraits, orbitalNames: serverUrl ? orbitalNames : void 0, onNavigate }),
|
|
33610
33611
|
/* @__PURE__ */ jsx(SlotBridge, {}),
|