@almadar/ui 1.0.31 → 1.0.33
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/KaTeX_AMS-Regular-CYEKBG2K.woff +0 -0
- package/dist/KaTeX_AMS-Regular-JKX5W2C4.ttf +0 -0
- package/dist/KaTeX_AMS-Regular-U6PRYMIZ.woff2 +0 -0
- package/dist/KaTeX_Caligraphic-Bold-5QL5CMTE.woff2 +0 -0
- package/dist/KaTeX_Caligraphic-Bold-WZ3QSGD3.woff +0 -0
- package/dist/KaTeX_Caligraphic-Bold-ZTS3R3HK.ttf +0 -0
- package/dist/KaTeX_Caligraphic-Regular-3LKEU76G.woff +0 -0
- package/dist/KaTeX_Caligraphic-Regular-A7XRTZ5Q.ttf +0 -0
- package/dist/KaTeX_Caligraphic-Regular-KX5MEWCF.woff2 +0 -0
- package/dist/KaTeX_Fraktur-Bold-2QVFK6NQ.woff2 +0 -0
- package/dist/KaTeX_Fraktur-Bold-T4SWXBMT.woff +0 -0
- package/dist/KaTeX_Fraktur-Bold-WGHVTYOR.ttf +0 -0
- package/dist/KaTeX_Fraktur-Regular-2PEIFJSJ.woff2 +0 -0
- package/dist/KaTeX_Fraktur-Regular-5U4OPH2X.ttf +0 -0
- package/dist/KaTeX_Fraktur-Regular-PQMHCIK6.woff +0 -0
- package/dist/KaTeX_Main-Bold-2GA4IZIN.woff +0 -0
- package/dist/KaTeX_Main-Bold-W5FBVCZM.ttf +0 -0
- package/dist/KaTeX_Main-Bold-YP5VVQRP.woff2 +0 -0
- package/dist/KaTeX_Main-BoldItalic-4P4C7HJH.woff +0 -0
- package/dist/KaTeX_Main-BoldItalic-N4V3DX7S.woff2 +0 -0
- package/dist/KaTeX_Main-BoldItalic-ODMLBJJQ.ttf +0 -0
- package/dist/KaTeX_Main-Italic-I43T2HSR.ttf +0 -0
- package/dist/KaTeX_Main-Italic-RELBIK7M.woff2 +0 -0
- package/dist/KaTeX_Main-Italic-SASNQFN2.woff +0 -0
- package/dist/KaTeX_Main-Regular-ARRPAO67.woff2 +0 -0
- package/dist/KaTeX_Main-Regular-P5I74A2A.woff +0 -0
- package/dist/KaTeX_Main-Regular-W74P5G27.ttf +0 -0
- package/dist/KaTeX_Math-BoldItalic-6EBV3DK5.woff +0 -0
- package/dist/KaTeX_Math-BoldItalic-K4WTGH3J.woff2 +0 -0
- package/dist/KaTeX_Math-BoldItalic-VB447A4D.ttf +0 -0
- package/dist/KaTeX_Math-Italic-6KGCHLFN.woff2 +0 -0
- package/dist/KaTeX_Math-Italic-KKK3USB2.woff +0 -0
- package/dist/KaTeX_Math-Italic-SON4MRCA.ttf +0 -0
- package/dist/KaTeX_SansSerif-Bold-RRNVJFFW.woff2 +0 -0
- package/dist/KaTeX_SansSerif-Bold-STQ6RXC7.ttf +0 -0
- package/dist/KaTeX_SansSerif-Bold-X5M5EMOD.woff +0 -0
- package/dist/KaTeX_SansSerif-Italic-HMPFTM52.woff2 +0 -0
- package/dist/KaTeX_SansSerif-Italic-PSN4QKYX.woff +0 -0
- package/dist/KaTeX_SansSerif-Italic-WTBAZBGY.ttf +0 -0
- package/dist/KaTeX_SansSerif-Regular-2TL3USAE.ttf +0 -0
- package/dist/KaTeX_SansSerif-Regular-OQCII6EP.woff +0 -0
- package/dist/KaTeX_SansSerif-Regular-XIQ62X4E.woff2 +0 -0
- package/dist/KaTeX_Script-Regular-72OLXYNA.ttf +0 -0
- package/dist/KaTeX_Script-Regular-A5IFOEBS.woff +0 -0
- package/dist/KaTeX_Script-Regular-APUWIHLP.woff2 +0 -0
- package/dist/KaTeX_Size1-Regular-4HRHTS65.woff +0 -0
- package/dist/KaTeX_Size1-Regular-5LRUTBFT.woff2 +0 -0
- package/dist/KaTeX_Size1-Regular-7K6AASVL.ttf +0 -0
- package/dist/KaTeX_Size2-Regular-222HN3GT.ttf +0 -0
- package/dist/KaTeX_Size2-Regular-K5ZHAIS6.woff +0 -0
- package/dist/KaTeX_Size2-Regular-LELKET5D.woff2 +0 -0
- package/dist/KaTeX_Size3-Regular-TLFPAHDE.woff +0 -0
- package/dist/KaTeX_Size3-Regular-UFCO6WCA.ttf +0 -0
- package/dist/KaTeX_Size3-Regular-WQRQ47UD.woff2 +0 -0
- package/dist/KaTeX_Size4-Regular-7PGNVPQK.ttf +0 -0
- package/dist/KaTeX_Size4-Regular-CDMV7U5C.woff2 +0 -0
- package/dist/KaTeX_Size4-Regular-PKMWZHNC.woff +0 -0
- package/dist/KaTeX_Typewriter-Regular-3F5K6SQ6.ttf +0 -0
- package/dist/KaTeX_Typewriter-Regular-MJMFSK64.woff +0 -0
- package/dist/KaTeX_Typewriter-Regular-VBYJ4NRC.woff2 +0 -0
- package/dist/chunk-45CTDYBT.js +174 -0
- package/dist/{chunk-WRL6TBOL.js → chunk-BKC4XU44.js} +22 -90
- package/dist/{chunk-LRI6C6UI.js → chunk-BTXQJGFB.js} +25 -2
- package/dist/chunk-FZJ73RDM.js +9501 -0
- package/dist/chunk-N6DJVKZ6.js +747 -0
- package/dist/chunk-PE2H3NAW.js +383 -0
- package/dist/{chunk-RUGU4MSK.js → chunk-YXZM3WCF.js} +37 -1
- package/dist/cn-BoBXsxuX.d.ts +194 -0
- package/dist/components/index.css +1154 -0
- package/dist/components/index.d.ts +804 -329
- package/dist/components/index.js +8095 -15387
- package/dist/components/organisms/game/three/index.d.ts +0 -107
- package/dist/components/organisms/game/three/index.js +1 -1
- package/dist/context/index.d.ts +2 -2
- package/dist/context/index.js +2 -3
- package/dist/{event-bus-types-8-cjyMxw.d.ts → event-bus-types-CjJduURa.d.ts} +8 -0
- package/dist/hooks/index.d.ts +83 -120
- package/dist/hooks/index.js +4 -4
- package/dist/lib/index.d.ts +117 -153
- package/dist/lib/index.js +4 -683
- package/dist/locales/index.d.ts +22 -0
- package/dist/locales/index.js +334 -0
- package/dist/providers/index.css +1154 -0
- package/dist/providers/index.d.ts +79 -3
- package/dist/providers/index.js +158 -10
- package/dist/{useUISlots-mnggE9X9.d.ts → useUISlots-D0mttBSP.d.ts} +0 -20
- package/package.json +23 -10
- package/dist/chunk-VLWZZA6A.js +0 -239
- package/dist/chunk-W5YTXLXL.js +0 -29
- package/dist/cn-mqkxz8Sd.d.ts +0 -9
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React__default, { ReactNode } from 'react';
|
|
2
2
|
import { b as ThemeDefinition } from '../ThemeContext-D9xUORq5.js';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import { E as EventBusContextType } from '../event-bus-types-
|
|
4
|
+
import { E as EventBusContextType } from '../event-bus-types-CjJduURa.js';
|
|
5
5
|
import { U as UseOfflineExecutorResult, a as UseOfflineExecutorOptions } from '../offline-executor-CHr4uAhf.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -255,6 +255,19 @@ interface OrbitalProviderProps {
|
|
|
255
255
|
debug?: boolean;
|
|
256
256
|
/** Initial fetched data */
|
|
257
257
|
initialData?: Record<string, unknown[]>;
|
|
258
|
+
/**
|
|
259
|
+
* Enable Suspense mode. When true, UISlotRenderer wraps each slot in
|
|
260
|
+
* `<ErrorBoundary><Suspense>` with Skeleton fallbacks.
|
|
261
|
+
* Opt-in — existing isLoading prop pattern still works when false/absent.
|
|
262
|
+
*/
|
|
263
|
+
suspense?: boolean;
|
|
264
|
+
/**
|
|
265
|
+
* Enable verification wiring for visual testing.
|
|
266
|
+
* When true, lifecycle events are recorded and exposed via
|
|
267
|
+
* `window.__orbitalVerification` for Playwright/automation.
|
|
268
|
+
* Default: true in development, false in production.
|
|
269
|
+
*/
|
|
270
|
+
verification?: boolean;
|
|
258
271
|
}
|
|
259
272
|
/**
|
|
260
273
|
* OrbitalProvider - Unified context provider for Orbital applications
|
|
@@ -303,11 +316,74 @@ interface OrbitalProviderProps {
|
|
|
303
316
|
* }
|
|
304
317
|
* ```
|
|
305
318
|
*/
|
|
306
|
-
declare function OrbitalProvider({ children, themes, defaultTheme, defaultMode, targetRef, skipTheme, debug, initialData, }: OrbitalProviderProps): React__default.ReactElement;
|
|
319
|
+
declare function OrbitalProvider({ children, themes, defaultTheme, defaultMode, targetRef, skipTheme, debug, initialData, suspense, verification, }: OrbitalProviderProps): React__default.ReactElement;
|
|
307
320
|
declare namespace OrbitalProvider {
|
|
308
321
|
var displayName: string;
|
|
309
322
|
}
|
|
310
323
|
|
|
324
|
+
/**
|
|
325
|
+
* VerificationProvider
|
|
326
|
+
*
|
|
327
|
+
* Wires the verification registry to both compiled and runtime execution paths.
|
|
328
|
+
*
|
|
329
|
+
* **Compiled apps**: Intercepts event bus lifecycle events
|
|
330
|
+
* (`{traitName}:DISPATCH`, `{traitName}:{event}:SUCCESS`, `{traitName}:{event}:ERROR`)
|
|
331
|
+
* emitted by `useOrbitalBridge` and records transitions via `recordTransition()`.
|
|
332
|
+
*
|
|
333
|
+
* **Runtime apps**: Accepts an optional `StateMachineManager` and wires its
|
|
334
|
+
* `TransitionObserver` to `recordTransition()`.
|
|
335
|
+
*
|
|
336
|
+
* **Both**: Calls `bindEventBus()` and `bindTraitStateGetter()` to populate
|
|
337
|
+
* `window.__orbitalVerification` for Playwright/automation.
|
|
338
|
+
*
|
|
339
|
+
* @packageDocumentation
|
|
340
|
+
*/
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Observer interface compatible with `StateMachineManager.setObserver()`.
|
|
344
|
+
* Defined locally to avoid hard dependency on `@almadar/runtime`.
|
|
345
|
+
*/
|
|
346
|
+
interface TransitionObserver {
|
|
347
|
+
onTransition(trace: {
|
|
348
|
+
traitName: string;
|
|
349
|
+
from: string;
|
|
350
|
+
to: string;
|
|
351
|
+
event: string;
|
|
352
|
+
guardResult?: boolean;
|
|
353
|
+
effects: Array<{
|
|
354
|
+
type: string;
|
|
355
|
+
args: unknown[];
|
|
356
|
+
status: 'executed' | 'failed' | 'skipped';
|
|
357
|
+
error?: string;
|
|
358
|
+
durationMs?: number;
|
|
359
|
+
}>;
|
|
360
|
+
}): void;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Minimal interface for StateMachineManager — avoids importing the full runtime.
|
|
364
|
+
*/
|
|
365
|
+
interface StateMachineManagerLike {
|
|
366
|
+
setObserver(observer: TransitionObserver): void;
|
|
367
|
+
getState?(traitName: string): string | undefined;
|
|
368
|
+
}
|
|
369
|
+
interface VerificationProviderProps {
|
|
370
|
+
children: ReactNode;
|
|
371
|
+
/** Enable verification wiring (default: true in dev, false in prod) */
|
|
372
|
+
enabled?: boolean;
|
|
373
|
+
/** Optional runtime StateMachineManager for interpreted mode */
|
|
374
|
+
runtimeManager?: StateMachineManagerLike;
|
|
375
|
+
/** Optional trait state getter for compiled apps (maps traitName → currentState) */
|
|
376
|
+
traitStateGetter?: (traitName: string) => string | undefined;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* VerificationProvider — wires the verification registry to the event bus
|
|
380
|
+
* and optional runtime manager. Renders children unchanged.
|
|
381
|
+
*/
|
|
382
|
+
declare function VerificationProvider({ children, enabled, runtimeManager, traitStateGetter, }: VerificationProviderProps): React__default.ReactElement;
|
|
383
|
+
declare namespace VerificationProvider {
|
|
384
|
+
var displayName: string;
|
|
385
|
+
}
|
|
386
|
+
|
|
311
387
|
/**
|
|
312
388
|
* OfflineModeProvider
|
|
313
389
|
*
|
|
@@ -386,4 +462,4 @@ declare function useOfflineMode(): OfflineModeContextValue;
|
|
|
386
462
|
*/
|
|
387
463
|
declare function useOptionalOfflineMode(): OfflineModeContextValue | null;
|
|
388
464
|
|
|
389
|
-
export { type EntityRecord, EventBusContext, EventBusProvider, FetchedDataContext, type FetchedDataContextValue, FetchedDataProvider, type FetchedDataProviderProps, type FetchedDataState, type OfflineModeContextValue, OfflineModeProvider, type OfflineModeProviderProps, OrbitalProvider, type OrbitalProviderProps, SelectionContext, type SelectionContextType, SelectionProvider, ThemeDefinition, useFetchedData, useFetchedDataContext, useFetchedEntity, useOfflineMode, useOptionalOfflineMode, useSelection, useSelectionOptional };
|
|
465
|
+
export { type EntityRecord, EventBusContext, EventBusProvider, FetchedDataContext, type FetchedDataContextValue, FetchedDataProvider, type FetchedDataProviderProps, type FetchedDataState, type OfflineModeContextValue, OfflineModeProvider, type OfflineModeProviderProps, OrbitalProvider, type OrbitalProviderProps, SelectionContext, type SelectionContextType, SelectionProvider, ThemeDefinition, VerificationProvider, type VerificationProviderProps, useFetchedData, useFetchedDataContext, useFetchedEntity, useOfflineMode, useOptionalOfflineMode, useSelection, useSelectionOptional };
|
package/dist/providers/index.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { SuspenseConfigProvider } from '../chunk-FZJ73RDM.js';
|
|
2
|
+
import { ThemeProvider } from '../chunk-BTXQJGFB.js';
|
|
3
|
+
import { SelectionProvider, EntityDataProvider } from '../chunk-PE2H3NAW.js';
|
|
4
|
+
export { SelectionContext, SelectionProvider, useSelection, useSelectionOptional } from '../chunk-PE2H3NAW.js';
|
|
5
|
+
import { useEventBus, EventBusProvider } from '../chunk-YXZM3WCF.js';
|
|
6
|
+
export { EventBusContext, EventBusProvider } from '../chunk-YXZM3WCF.js';
|
|
7
|
+
import '../chunk-7NEWMNNU.js';
|
|
8
|
+
import { recordTransition, registerCheck, bindEventBus, bindTraitStateGetter } from '../chunk-45CTDYBT.js';
|
|
9
|
+
import '../chunk-KKCVDUK7.js';
|
|
4
10
|
import { useOfflineExecutor } from '../chunk-PL7MD6GF.js';
|
|
5
|
-
import { EventBusProvider } from '../chunk-RUGU4MSK.js';
|
|
6
|
-
export { EventBusContext, EventBusProvider } from '../chunk-RUGU4MSK.js';
|
|
7
11
|
import '../chunk-PKBMQBKP.js';
|
|
8
|
-
import { createContext, useState, useCallback, useMemo, useContext } from 'react';
|
|
9
|
-
import { jsx } from 'react/jsx-runtime';
|
|
12
|
+
import { createContext, useState, useCallback, useMemo, useContext, useRef, useEffect } from 'react';
|
|
13
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
10
14
|
|
|
11
15
|
var FetchedDataContext = createContext(null);
|
|
12
16
|
function FetchedDataProvider({
|
|
@@ -163,6 +167,144 @@ function useFetchedEntity(entityName) {
|
|
|
163
167
|
error: context.error
|
|
164
168
|
};
|
|
165
169
|
}
|
|
170
|
+
var DISPATCH_SUFFIX = ":DISPATCH";
|
|
171
|
+
var SUCCESS_SUFFIX = ":SUCCESS";
|
|
172
|
+
var ERROR_SUFFIX = ":ERROR";
|
|
173
|
+
function parseLifecycleEvent(type) {
|
|
174
|
+
if (type.endsWith(DISPATCH_SUFFIX)) {
|
|
175
|
+
const traitName = type.slice(0, -DISPATCH_SUFFIX.length);
|
|
176
|
+
if (traitName) return { kind: "dispatch", traitName };
|
|
177
|
+
} else if (type.endsWith(SUCCESS_SUFFIX)) {
|
|
178
|
+
const rest = type.slice(0, -SUCCESS_SUFFIX.length);
|
|
179
|
+
const colonIdx = rest.indexOf(":");
|
|
180
|
+
if (colonIdx > 0) {
|
|
181
|
+
return {
|
|
182
|
+
kind: "success",
|
|
183
|
+
traitName: rest.slice(0, colonIdx),
|
|
184
|
+
event: rest.slice(colonIdx + 1)
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
} else if (type.endsWith(ERROR_SUFFIX)) {
|
|
188
|
+
const rest = type.slice(0, -ERROR_SUFFIX.length);
|
|
189
|
+
const colonIdx = rest.indexOf(":");
|
|
190
|
+
if (colonIdx > 0) {
|
|
191
|
+
return {
|
|
192
|
+
kind: "error",
|
|
193
|
+
traitName: rest.slice(0, colonIdx),
|
|
194
|
+
event: rest.slice(colonIdx + 1)
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
function VerificationProvider({
|
|
201
|
+
children,
|
|
202
|
+
enabled,
|
|
203
|
+
runtimeManager,
|
|
204
|
+
traitStateGetter
|
|
205
|
+
}) {
|
|
206
|
+
const isEnabled = enabled ?? (typeof process !== "undefined" && process.env?.NODE_ENV !== "production");
|
|
207
|
+
const eventBus = useEventBus();
|
|
208
|
+
const pendingRef = useRef(/* @__PURE__ */ new Map());
|
|
209
|
+
useEffect(() => {
|
|
210
|
+
if (!isEnabled) return;
|
|
211
|
+
if (!eventBus.onAny) return;
|
|
212
|
+
const unsub = eventBus.onAny((evt) => {
|
|
213
|
+
const parsed = parseLifecycleEvent(evt.type);
|
|
214
|
+
if (!parsed) return;
|
|
215
|
+
const payload = evt.payload ?? {};
|
|
216
|
+
if (parsed.kind === "dispatch") {
|
|
217
|
+
const key = `${parsed.traitName}:${String(payload["event"] ?? "")}`;
|
|
218
|
+
pendingRef.current.set(key, {
|
|
219
|
+
traitName: parsed.traitName,
|
|
220
|
+
event: String(payload["event"] ?? ""),
|
|
221
|
+
from: payload["currentState"],
|
|
222
|
+
timestamp: evt.timestamp
|
|
223
|
+
});
|
|
224
|
+
} else if (parsed.kind === "success" && parsed.event) {
|
|
225
|
+
const key = `${parsed.traitName}:${parsed.event}`;
|
|
226
|
+
const pending = pendingRef.current.get(key);
|
|
227
|
+
pendingRef.current.delete(key);
|
|
228
|
+
const newState = payload["newState"] ?? payload["state"] ?? "unknown";
|
|
229
|
+
const effects = Array.isArray(payload["clientEffects"]) ? payload["clientEffects"].map((e) => ({
|
|
230
|
+
type: String(e["type"] ?? "unknown"),
|
|
231
|
+
args: Array.isArray(e["args"]) ? e["args"] : [],
|
|
232
|
+
status: "executed"
|
|
233
|
+
})) : [];
|
|
234
|
+
recordTransition({
|
|
235
|
+
traitName: parsed.traitName,
|
|
236
|
+
from: pending?.from ?? "unknown",
|
|
237
|
+
to: newState,
|
|
238
|
+
event: parsed.event,
|
|
239
|
+
effects,
|
|
240
|
+
timestamp: Date.now()
|
|
241
|
+
});
|
|
242
|
+
} else if (parsed.kind === "error" && parsed.event) {
|
|
243
|
+
const key = `${parsed.traitName}:${parsed.event}`;
|
|
244
|
+
const pending = pendingRef.current.get(key);
|
|
245
|
+
pendingRef.current.delete(key);
|
|
246
|
+
const errorMsg = payload["error"] ?? "Unknown error";
|
|
247
|
+
recordTransition({
|
|
248
|
+
traitName: parsed.traitName,
|
|
249
|
+
from: pending?.from ?? "unknown",
|
|
250
|
+
to: pending?.from ?? "unknown",
|
|
251
|
+
// state didn't change on error
|
|
252
|
+
event: parsed.event,
|
|
253
|
+
effects: [{
|
|
254
|
+
type: "server-call",
|
|
255
|
+
args: [],
|
|
256
|
+
status: "failed",
|
|
257
|
+
error: errorMsg
|
|
258
|
+
}],
|
|
259
|
+
timestamp: Date.now()
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
registerCheck(
|
|
264
|
+
"verification-provider",
|
|
265
|
+
"VerificationProvider active (compiled path)",
|
|
266
|
+
"pass"
|
|
267
|
+
);
|
|
268
|
+
return unsub;
|
|
269
|
+
}, [isEnabled, eventBus]);
|
|
270
|
+
useEffect(() => {
|
|
271
|
+
if (!isEnabled) return;
|
|
272
|
+
if (!runtimeManager) return;
|
|
273
|
+
runtimeManager.setObserver({
|
|
274
|
+
onTransition(trace) {
|
|
275
|
+
recordTransition({
|
|
276
|
+
traitName: trace.traitName,
|
|
277
|
+
from: trace.from,
|
|
278
|
+
to: trace.to,
|
|
279
|
+
event: trace.event,
|
|
280
|
+
guardResult: trace.guardResult,
|
|
281
|
+
effects: trace.effects,
|
|
282
|
+
timestamp: Date.now()
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
registerCheck(
|
|
287
|
+
"verification-provider",
|
|
288
|
+
"VerificationProvider active (runtime path)",
|
|
289
|
+
"pass"
|
|
290
|
+
);
|
|
291
|
+
}, [isEnabled, runtimeManager]);
|
|
292
|
+
useEffect(() => {
|
|
293
|
+
if (!isEnabled) return;
|
|
294
|
+
bindEventBus(eventBus);
|
|
295
|
+
}, [isEnabled, eventBus]);
|
|
296
|
+
useEffect(() => {
|
|
297
|
+
if (!isEnabled) return;
|
|
298
|
+
if (traitStateGetter) {
|
|
299
|
+
bindTraitStateGetter(traitStateGetter);
|
|
300
|
+
} else if (runtimeManager?.getState) {
|
|
301
|
+
const mgr = runtimeManager;
|
|
302
|
+
bindTraitStateGetter((traitName) => mgr.getState(traitName));
|
|
303
|
+
}
|
|
304
|
+
}, [isEnabled, traitStateGetter, runtimeManager]);
|
|
305
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
306
|
+
}
|
|
307
|
+
VerificationProvider.displayName = "VerificationProvider";
|
|
166
308
|
function FetchedDataBridge({ children }) {
|
|
167
309
|
const fetchedData = useFetchedData();
|
|
168
310
|
const adapter = useMemo(() => ({
|
|
@@ -181,9 +323,15 @@ function OrbitalProvider({
|
|
|
181
323
|
targetRef,
|
|
182
324
|
skipTheme = false,
|
|
183
325
|
debug = false,
|
|
184
|
-
initialData
|
|
326
|
+
initialData,
|
|
327
|
+
suspense = false,
|
|
328
|
+
verification
|
|
185
329
|
}) {
|
|
186
|
-
const
|
|
330
|
+
const suspenseConfig = useMemo(
|
|
331
|
+
() => ({ enabled: suspense }),
|
|
332
|
+
[suspense]
|
|
333
|
+
);
|
|
334
|
+
const inner = /* @__PURE__ */ jsx(FetchedDataProvider, { initialData, children: /* @__PURE__ */ jsx(FetchedDataBridge, { children: /* @__PURE__ */ jsx(EventBusProvider, { debug, children: /* @__PURE__ */ jsx(VerificationProvider, { enabled: verification, children: /* @__PURE__ */ jsx(SelectionProvider, { debug, children: /* @__PURE__ */ jsx(SuspenseConfigProvider, { config: suspenseConfig, children }) }) }) }) }) });
|
|
187
335
|
if (skipTheme) {
|
|
188
336
|
return inner;
|
|
189
337
|
}
|
|
@@ -229,4 +377,4 @@ function useOptionalOfflineMode() {
|
|
|
229
377
|
return useContext(OfflineModeContext);
|
|
230
378
|
}
|
|
231
379
|
|
|
232
|
-
export { FetchedDataContext, FetchedDataProvider, OfflineModeProvider, OrbitalProvider, useFetchedData, useFetchedDataContext, useFetchedEntity, useOfflineMode, useOptionalOfflineMode };
|
|
380
|
+
export { FetchedDataContext, FetchedDataProvider, OfflineModeProvider, OrbitalProvider, VerificationProvider, useFetchedData, useFetchedDataContext, useFetchedEntity, useOfflineMode, useOptionalOfflineMode };
|
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useUISlots Hook
|
|
3
|
-
*
|
|
4
|
-
* Core hook for managing UI slot rendering in the trait-driven architecture.
|
|
5
|
-
* Traits use render_ui effects to dynamically render content into slots.
|
|
6
|
-
*
|
|
7
|
-
* Slots:
|
|
8
|
-
* - main: Primary content area
|
|
9
|
-
* - sidebar: Left/right sidebar
|
|
10
|
-
* - modal: Modal overlay
|
|
11
|
-
* - drawer: Slide-in drawer
|
|
12
|
-
* - overlay: Full-screen overlay
|
|
13
|
-
* - center: Centered popup
|
|
14
|
-
* - toast: Toast notifications
|
|
15
|
-
* - hud-top: Game HUD top bar
|
|
16
|
-
* - hud-bottom: Game HUD bottom bar
|
|
17
|
-
* - floating: Draggable floating panel
|
|
18
|
-
*
|
|
19
|
-
* @packageDocumentation
|
|
20
|
-
*/
|
|
21
1
|
/**
|
|
22
2
|
* Valid UI slot names
|
|
23
3
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@almadar/ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.33",
|
|
4
4
|
"description": "React UI components, hooks, and providers for Almadar",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/components/index.js",
|
|
@@ -56,6 +56,10 @@
|
|
|
56
56
|
"types": "./templates/index.ts"
|
|
57
57
|
},
|
|
58
58
|
"./themes/*.css": "./themes/*.css",
|
|
59
|
+
"./locales": {
|
|
60
|
+
"import": "./dist/locales/index.js",
|
|
61
|
+
"types": "./dist/locales/index.d.ts"
|
|
62
|
+
},
|
|
59
63
|
"./index.css": "./index.css"
|
|
60
64
|
},
|
|
61
65
|
"files": [
|
|
@@ -69,13 +73,18 @@
|
|
|
69
73
|
"clsx": "^2.1.0",
|
|
70
74
|
"tailwind-merge": "^2.2.0",
|
|
71
75
|
"lucide-react": "^0.344.0",
|
|
72
|
-
"
|
|
73
|
-
"
|
|
76
|
+
"react-markdown": "^9.0.0",
|
|
77
|
+
"remark-gfm": "^4.0.0",
|
|
78
|
+
"remark-math": "^6.0.0",
|
|
79
|
+
"rehype-katex": "^7.0.0",
|
|
80
|
+
"react-syntax-highlighter": "^15.6.1",
|
|
81
|
+
"@almadar/evaluator": "1.0.16",
|
|
82
|
+
"@almadar/core": "1.0.18",
|
|
74
83
|
"@almadar/patterns": "1.1.1"
|
|
75
84
|
},
|
|
76
85
|
"peerDependencies": {
|
|
77
|
-
"react": "
|
|
78
|
-
"react-dom": "
|
|
86
|
+
"react": ">=18.0.0",
|
|
87
|
+
"react-dom": ">=18.0.0",
|
|
79
88
|
"react-router-dom": "^7.0.0",
|
|
80
89
|
"@tanstack/react-query": "^5.0.0",
|
|
81
90
|
"three": "^0.160.0",
|
|
@@ -83,12 +92,12 @@
|
|
|
83
92
|
"@react-three/drei": "^9.92.0"
|
|
84
93
|
},
|
|
85
94
|
"devDependencies": {
|
|
86
|
-
"react": "^
|
|
87
|
-
"react-dom": "^
|
|
95
|
+
"react": "^19.0.0",
|
|
96
|
+
"react-dom": "^19.0.0",
|
|
88
97
|
"react-router-dom": "^7.13.0",
|
|
89
98
|
"@tanstack/react-query": "^5.0.0",
|
|
90
|
-
"@types/react": "^
|
|
91
|
-
"@types/react-dom": "^
|
|
99
|
+
"@types/react": "^19.0.0",
|
|
100
|
+
"@types/react-dom": "^19.0.0",
|
|
92
101
|
"@types/three": "^0.160.0",
|
|
93
102
|
"@storybook/addon-links": "^10.2.6",
|
|
94
103
|
"@storybook/addon-themes": "^10.2.6",
|
|
@@ -96,6 +105,8 @@
|
|
|
96
105
|
"@storybook/react-vite": "^10.2.6",
|
|
97
106
|
"storybook": "^10.2.6",
|
|
98
107
|
"@vitejs/plugin-react": "^4.2.0",
|
|
108
|
+
"babel-plugin-react-compiler": "^1.0.0",
|
|
109
|
+
"react-compiler-runtime": "^1.0.0",
|
|
99
110
|
"autoprefixer": "^10.4.0",
|
|
100
111
|
"postcss": "^8.4.35",
|
|
101
112
|
"tailwindcss": "^3.4.0",
|
|
@@ -108,7 +119,9 @@
|
|
|
108
119
|
"@testing-library/jest-dom": "^6.4.0",
|
|
109
120
|
"@vitest/ui": "^1.4.0",
|
|
110
121
|
"jsdom": "^24.0.0",
|
|
111
|
-
"@storybook/addon-docs": "^10.2.6"
|
|
122
|
+
"@storybook/addon-docs": "^10.2.6",
|
|
123
|
+
"@types/react-syntax-highlighter": "^15.5.0",
|
|
124
|
+
"katex": "^0.16.0"
|
|
112
125
|
},
|
|
113
126
|
"repository": {
|
|
114
127
|
"type": "git",
|
package/dist/chunk-VLWZZA6A.js
DELETED
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
import { useEventBus } from './chunk-RUGU4MSK.js';
|
|
2
|
-
import React, { createContext, useContext, useMemo, useState, useEffect, useCallback } from 'react';
|
|
3
|
-
import { jsx } from 'react/jsx-runtime';
|
|
4
|
-
|
|
5
|
-
var EntityDataContext = createContext(null);
|
|
6
|
-
function EntityDataProvider({
|
|
7
|
-
adapter,
|
|
8
|
-
children
|
|
9
|
-
}) {
|
|
10
|
-
return React.createElement(
|
|
11
|
-
EntityDataContext.Provider,
|
|
12
|
-
{ value: adapter },
|
|
13
|
-
children
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
function useEntityDataAdapter() {
|
|
17
|
-
return useContext(EntityDataContext);
|
|
18
|
-
}
|
|
19
|
-
var entityDataKeys = {
|
|
20
|
-
all: ["entities"],
|
|
21
|
-
lists: () => [...entityDataKeys.all, "list"],
|
|
22
|
-
list: (entity, filters) => [...entityDataKeys.lists(), entity, filters],
|
|
23
|
-
details: () => [...entityDataKeys.all, "detail"],
|
|
24
|
-
detail: (entity, id) => [...entityDataKeys.details(), entity, id]
|
|
25
|
-
};
|
|
26
|
-
function useEntityList(entity, options = {}) {
|
|
27
|
-
const { skip = false } = options;
|
|
28
|
-
const adapter = useContext(EntityDataContext);
|
|
29
|
-
const adapterData = useMemo(() => {
|
|
30
|
-
if (!adapter || !entity || skip) return [];
|
|
31
|
-
return adapter.getData(entity);
|
|
32
|
-
}, [adapter, entity, skip, adapter?.isLoading]);
|
|
33
|
-
const [stubData, setStubData] = useState([]);
|
|
34
|
-
const [stubLoading, setStubLoading] = useState(!skip && !!entity && !adapter);
|
|
35
|
-
const [stubError, setStubError] = useState(null);
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
if (adapter || skip || !entity) {
|
|
38
|
-
setStubLoading(false);
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
setStubLoading(true);
|
|
42
|
-
const t = setTimeout(() => {
|
|
43
|
-
setStubData([]);
|
|
44
|
-
setStubLoading(false);
|
|
45
|
-
}, 100);
|
|
46
|
-
return () => clearTimeout(t);
|
|
47
|
-
}, [entity, skip, adapter]);
|
|
48
|
-
if (adapter) {
|
|
49
|
-
return {
|
|
50
|
-
data: adapterData,
|
|
51
|
-
isLoading: adapter.isLoading,
|
|
52
|
-
error: adapter.error ? new Error(adapter.error) : null,
|
|
53
|
-
refetch: () => {
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
return { data: stubData, isLoading: stubLoading, error: stubError, refetch: () => {
|
|
58
|
-
} };
|
|
59
|
-
}
|
|
60
|
-
function useEntity(entity, id) {
|
|
61
|
-
const adapter = useContext(EntityDataContext);
|
|
62
|
-
const adapterData = useMemo(() => {
|
|
63
|
-
if (!adapter || !entity || !id) return null;
|
|
64
|
-
return adapter.getById(entity, id) ?? null;
|
|
65
|
-
}, [adapter, entity, id, adapter?.isLoading]);
|
|
66
|
-
const [stubData, setStubData] = useState(null);
|
|
67
|
-
const [stubLoading, setStubLoading] = useState(!!entity && !!id && !adapter);
|
|
68
|
-
const [stubError, setStubError] = useState(null);
|
|
69
|
-
useEffect(() => {
|
|
70
|
-
if (adapter || !entity || !id) {
|
|
71
|
-
setStubLoading(false);
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
setStubLoading(true);
|
|
75
|
-
const t = setTimeout(() => {
|
|
76
|
-
setStubData(null);
|
|
77
|
-
setStubLoading(false);
|
|
78
|
-
}, 100);
|
|
79
|
-
return () => clearTimeout(t);
|
|
80
|
-
}, [entity, id, adapter]);
|
|
81
|
-
if (adapter) {
|
|
82
|
-
return {
|
|
83
|
-
data: adapterData,
|
|
84
|
-
isLoading: adapter.isLoading,
|
|
85
|
-
error: adapter.error ? new Error(adapter.error) : null
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
return { data: stubData, isLoading: stubLoading, error: stubError };
|
|
89
|
-
}
|
|
90
|
-
function useEntityDetail(entity, id) {
|
|
91
|
-
const result = useEntity(entity, id);
|
|
92
|
-
return { ...result, refetch: () => {
|
|
93
|
-
} };
|
|
94
|
-
}
|
|
95
|
-
function usePaginatedEntityList(entity, params, options = {}) {
|
|
96
|
-
const { skip = false } = options;
|
|
97
|
-
const adapter = useContext(EntityDataContext);
|
|
98
|
-
const adapterResult = useMemo(() => {
|
|
99
|
-
if (!adapter || !entity || skip) {
|
|
100
|
-
return { data: [], totalCount: 0 };
|
|
101
|
-
}
|
|
102
|
-
const all = adapter.getData(entity);
|
|
103
|
-
const start = (params.page - 1) * params.pageSize;
|
|
104
|
-
const paged = all.slice(start, start + params.pageSize);
|
|
105
|
-
return { data: paged, totalCount: all.length };
|
|
106
|
-
}, [adapter, entity, skip, params.page, params.pageSize, adapter?.isLoading]);
|
|
107
|
-
const [stubData, setStubData] = useState([]);
|
|
108
|
-
const [stubLoading, setStubLoading] = useState(!skip && !!entity && !adapter);
|
|
109
|
-
const [stubError, setStubError] = useState(null);
|
|
110
|
-
const [stubTotalCount, setStubTotalCount] = useState(0);
|
|
111
|
-
useEffect(() => {
|
|
112
|
-
if (adapter || skip || !entity) {
|
|
113
|
-
setStubLoading(false);
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
setStubLoading(true);
|
|
117
|
-
const t = setTimeout(() => {
|
|
118
|
-
setStubData([]);
|
|
119
|
-
setStubTotalCount(0);
|
|
120
|
-
setStubLoading(false);
|
|
121
|
-
}, 100);
|
|
122
|
-
return () => clearTimeout(t);
|
|
123
|
-
}, [entity, params.page, params.pageSize, params.search, params.sortBy, params.sortDirection, skip, adapter]);
|
|
124
|
-
const totalCount = adapter ? adapterResult.totalCount : stubTotalCount;
|
|
125
|
-
const totalPages = Math.ceil(totalCount / params.pageSize) || 1;
|
|
126
|
-
if (adapter) {
|
|
127
|
-
return {
|
|
128
|
-
data: adapterResult.data,
|
|
129
|
-
isLoading: adapter.isLoading,
|
|
130
|
-
error: adapter.error ? new Error(adapter.error) : null,
|
|
131
|
-
totalCount: adapterResult.totalCount,
|
|
132
|
-
totalPages,
|
|
133
|
-
hasNextPage: params.page < totalPages,
|
|
134
|
-
hasPreviousPage: params.page > 1,
|
|
135
|
-
refetch: () => {
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
return {
|
|
140
|
-
data: stubData,
|
|
141
|
-
isLoading: stubLoading,
|
|
142
|
-
error: stubError,
|
|
143
|
-
totalCount: stubTotalCount,
|
|
144
|
-
totalPages,
|
|
145
|
-
hasNextPage: params.page < totalPages,
|
|
146
|
-
hasPreviousPage: params.page > 1,
|
|
147
|
-
refetch: () => {
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
var SelectionContext = createContext(null);
|
|
152
|
-
var defaultCompareEntities = (a, b) => {
|
|
153
|
-
if (a === b) return true;
|
|
154
|
-
if (!a || !b) return false;
|
|
155
|
-
if (typeof a === "object" && typeof b === "object") {
|
|
156
|
-
const aId = a.id;
|
|
157
|
-
const bId = b.id;
|
|
158
|
-
return aId !== void 0 && aId === bId;
|
|
159
|
-
}
|
|
160
|
-
return false;
|
|
161
|
-
};
|
|
162
|
-
function SelectionProvider({
|
|
163
|
-
children,
|
|
164
|
-
debug = false,
|
|
165
|
-
compareEntities = defaultCompareEntities
|
|
166
|
-
}) {
|
|
167
|
-
const eventBus = useEventBus();
|
|
168
|
-
const [selected, setSelectedState] = useState(null);
|
|
169
|
-
const setSelected = useCallback(
|
|
170
|
-
(entity) => {
|
|
171
|
-
setSelectedState(entity);
|
|
172
|
-
if (debug) {
|
|
173
|
-
console.log("[SelectionProvider] Selection set:", entity);
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
[debug]
|
|
177
|
-
);
|
|
178
|
-
const clearSelection = useCallback(() => {
|
|
179
|
-
setSelectedState(null);
|
|
180
|
-
if (debug) {
|
|
181
|
-
console.log("[SelectionProvider] Selection cleared");
|
|
182
|
-
}
|
|
183
|
-
}, [debug]);
|
|
184
|
-
const isSelected = useCallback(
|
|
185
|
-
(entity) => {
|
|
186
|
-
return compareEntities(selected, entity);
|
|
187
|
-
},
|
|
188
|
-
[selected, compareEntities]
|
|
189
|
-
);
|
|
190
|
-
useEffect(() => {
|
|
191
|
-
const handleSelect = (event) => {
|
|
192
|
-
const row = event.payload?.row;
|
|
193
|
-
if (row) {
|
|
194
|
-
setSelected(row);
|
|
195
|
-
if (debug) {
|
|
196
|
-
console.log(`[SelectionProvider] ${event.type} received:`, row);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
const handleDeselect = (event) => {
|
|
201
|
-
clearSelection();
|
|
202
|
-
if (debug) {
|
|
203
|
-
console.log(`[SelectionProvider] ${event.type} received - clearing selection`);
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
const unsubView = eventBus.on("UI:VIEW", handleSelect);
|
|
207
|
-
const unsubSelect = eventBus.on("UI:SELECT", handleSelect);
|
|
208
|
-
const unsubClose = eventBus.on("UI:CLOSE", handleDeselect);
|
|
209
|
-
const unsubDeselect = eventBus.on("UI:DESELECT", handleDeselect);
|
|
210
|
-
const unsubCancel = eventBus.on("UI:CANCEL", handleDeselect);
|
|
211
|
-
return () => {
|
|
212
|
-
unsubView();
|
|
213
|
-
unsubSelect();
|
|
214
|
-
unsubClose();
|
|
215
|
-
unsubDeselect();
|
|
216
|
-
unsubCancel();
|
|
217
|
-
};
|
|
218
|
-
}, [eventBus, setSelected, clearSelection, debug]);
|
|
219
|
-
const contextValue = {
|
|
220
|
-
selected,
|
|
221
|
-
setSelected,
|
|
222
|
-
clearSelection,
|
|
223
|
-
isSelected
|
|
224
|
-
};
|
|
225
|
-
return /* @__PURE__ */ jsx(SelectionContext.Provider, { value: contextValue, children });
|
|
226
|
-
}
|
|
227
|
-
function useSelection() {
|
|
228
|
-
const context = useContext(SelectionContext);
|
|
229
|
-
if (!context) {
|
|
230
|
-
throw new Error("useSelection must be used within a SelectionProvider");
|
|
231
|
-
}
|
|
232
|
-
return context;
|
|
233
|
-
}
|
|
234
|
-
function useSelectionOptional() {
|
|
235
|
-
const context = useContext(SelectionContext);
|
|
236
|
-
return context;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
export { EntityDataProvider, SelectionContext, SelectionProvider, entityDataKeys, useEntity, useEntityDataAdapter, useEntityDetail, useEntityList, usePaginatedEntityList, useSelection, useSelectionOptional };
|
package/dist/chunk-W5YTXLXL.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { useUISlotManager } from './chunk-7NEWMNNU.js';
|
|
2
|
-
import { createContext, useMemo, useContext } from 'react';
|
|
3
|
-
import { jsx } from 'react/jsx-runtime';
|
|
4
|
-
|
|
5
|
-
var UISlotContext = createContext(null);
|
|
6
|
-
function UISlotProvider({ children }) {
|
|
7
|
-
const slotManager = useUISlotManager();
|
|
8
|
-
const contextValue = useMemo(() => slotManager, [slotManager]);
|
|
9
|
-
return /* @__PURE__ */ jsx(UISlotContext.Provider, { value: contextValue, children });
|
|
10
|
-
}
|
|
11
|
-
function useUISlots() {
|
|
12
|
-
const context = useContext(UISlotContext);
|
|
13
|
-
if (!context) {
|
|
14
|
-
throw new Error(
|
|
15
|
-
"useUISlots must be used within a UISlotProvider. Make sure your component tree is wrapped with <UISlotProvider>."
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
return context;
|
|
19
|
-
}
|
|
20
|
-
function useSlotContent(slot) {
|
|
21
|
-
const { getContent } = useUISlots();
|
|
22
|
-
return getContent(slot);
|
|
23
|
-
}
|
|
24
|
-
function useSlotHasContent(slot) {
|
|
25
|
-
const { hasContent } = useUISlots();
|
|
26
|
-
return hasContent(slot);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export { UISlotContext, UISlotProvider, useSlotContent, useSlotHasContent, useUISlots };
|
package/dist/cn-mqkxz8Sd.d.ts
DELETED