@almadar/ui 2.13.2 → 2.14.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.
Files changed (34) hide show
  1. package/dist/chunk-4N3BAPDB.js +1667 -0
  2. package/dist/{chunk-PERGHHON.js → chunk-IRIGCHP4.js} +2 -12
  3. package/dist/{chunk-ZW5N4AUU.js → chunk-M7MOIE46.js} +3 -3
  4. package/dist/{chunk-Y7IHEYYE.js → chunk-QU2X55WH.js} +11 -1
  5. package/dist/{chunk-77CBR3Z7.js → chunk-SKWPSQHQ.js} +13448 -2279
  6. package/dist/{chunk-4ZBSL37D.js → chunk-XL7WB2O5.js} +415 -58
  7. package/dist/components/index.css +508 -0
  8. package/dist/components/index.js +769 -11187
  9. package/dist/components/organisms/game/three/index.js +49 -1709
  10. package/dist/hooks/index.js +2 -2
  11. package/dist/lib/index.js +1 -3
  12. package/dist/providers/index.css +599 -0
  13. package/dist/providers/index.js +5 -4
  14. package/dist/runtime/index.css +599 -0
  15. package/dist/runtime/index.js +6 -6
  16. package/package.json +5 -4
  17. package/dist/ThemeContext-D9xUORq5.d.ts +0 -105
  18. package/dist/chunk-42YQ6JVR.js +0 -48
  19. package/dist/chunk-WCTZ7WZX.js +0 -311
  20. package/dist/cn-C_ATNPvi.d.ts +0 -332
  21. package/dist/components/index.d.ts +0 -9788
  22. package/dist/components/organisms/game/three/index.d.ts +0 -1233
  23. package/dist/context/index.d.ts +0 -208
  24. package/dist/event-bus-types-CjJduURa.d.ts +0 -73
  25. package/dist/hooks/index.d.ts +0 -1221
  26. package/dist/isometric-ynNHVPZx.d.ts +0 -111
  27. package/dist/lib/index.d.ts +0 -320
  28. package/dist/locales/index.d.ts +0 -22
  29. package/dist/offline-executor-CHr4uAhf.d.ts +0 -401
  30. package/dist/providers/index.d.ts +0 -465
  31. package/dist/renderer/index.d.ts +0 -525
  32. package/dist/runtime/index.d.ts +0 -280
  33. package/dist/stores/index.d.ts +0 -151
  34. package/dist/useUISlots-BBjNvQtb.d.ts +0 -85
@@ -1,105 +0,0 @@
1
- import React__default from 'react';
2
-
3
- /**
4
- * Unified ThemeContext - Single provider for theme and color mode
5
- *
6
- * Combines design theme selection (ocean, wireframe, etc.) with
7
- * color mode (light/dark) into a single, simple system.
8
- *
9
- * Uses a single data attribute: data-theme="ocean-light" or data-theme="ocean-dark"
10
- *
11
- * @packageDocumentation
12
- */
13
-
14
- /** Color mode preference */
15
- type ColorMode = "light" | "dark" | "system";
16
- /** Resolved color mode (what's actually applied) */
17
- type ResolvedMode = "light" | "dark";
18
- /** Theme definition */
19
- interface ThemeDefinition {
20
- /** Theme identifier (e.g., "ocean", "wireframe") */
21
- name: string;
22
- /** Display name for UI (e.g., "Ocean Blue") */
23
- displayName?: string;
24
- /** Whether this theme has light mode styles */
25
- hasLightMode?: boolean;
26
- /** Whether this theme has dark mode styles */
27
- hasDarkMode?: boolean;
28
- }
29
- /** Built-in themes available in the design system */
30
- declare const BUILT_IN_THEMES: ThemeDefinition[];
31
- /** Theme context value */
32
- interface ThemeContextValue {
33
- /** Current theme name */
34
- theme: string;
35
- /** Current color mode setting (may be 'system') */
36
- mode: ColorMode;
37
- /** Resolved color mode (always 'light' or 'dark') */
38
- resolvedMode: ResolvedMode;
39
- /** Set the theme */
40
- setTheme: (theme: string) => void;
41
- /** Set the color mode */
42
- setMode: (mode: ColorMode) => void;
43
- /** Toggle between light and dark modes */
44
- toggleMode: () => void;
45
- /** Available themes */
46
- availableThemes: ThemeDefinition[];
47
- /** The full theme string applied to data-theme (e.g., "ocean-light") */
48
- appliedTheme: string;
49
- }
50
- declare const ThemeContext: React__default.Context<ThemeContextValue | undefined>;
51
- interface ThemeProviderProps {
52
- children: React__default.ReactNode;
53
- /** Available themes (will be merged with built-in themes) */
54
- themes?: readonly ThemeDefinition[] | ThemeDefinition[];
55
- /** Default theme name */
56
- defaultTheme?: string;
57
- /** Default color mode */
58
- defaultMode?: ColorMode;
59
- /** Optional target element ref — when provided, theme attributes are applied to this element instead of document.documentElement */
60
- targetRef?: React__default.RefObject<HTMLElement>;
61
- }
62
- /**
63
- * Unified ThemeProvider component
64
- *
65
- * @example
66
- * ```tsx
67
- * // Basic usage with built-in themes
68
- * <ThemeProvider defaultTheme="wireframe" defaultMode="light">
69
- * <App />
70
- * </ThemeProvider>
71
- *
72
- * // With custom themes from orbital schema
73
- * import { THEMES } from './generated/theme-manifest';
74
- * <ThemeProvider themes={THEMES} defaultTheme="ocean" defaultMode="system">
75
- * <App />
76
- * </ThemeProvider>
77
- * ```
78
- */
79
- declare const ThemeProvider: React__default.FC<ThemeProviderProps>;
80
- /**
81
- * Hook for accessing theme context
82
- *
83
- * @returns Theme context value
84
- *
85
- * @example
86
- * ```tsx
87
- * const { theme, resolvedMode, toggleMode, setTheme } = useTheme();
88
- *
89
- * // Toggle dark mode
90
- * <button onClick={toggleMode}>
91
- * {resolvedMode === 'dark' ? 'Light' : 'Dark'}
92
- * </button>
93
- *
94
- * // Change theme
95
- * <select value={theme} onChange={(e) => setTheme(e.target.value)}>
96
- * {availableThemes.map(t => (
97
- * <option key={t.name} value={t.name}>{t.displayName || t.name}</option>
98
- * ))}
99
- * </select>
100
- * ```
101
- */
102
- declare function useTheme(): ThemeContextValue;
103
- type DesignTheme = ThemeDefinition;
104
-
105
- export { BUILT_IN_THEMES as B, type ColorMode as C, type DesignTheme as D, type ResolvedMode as R, type ThemeProviderProps as T, ThemeContext as a, type ThemeDefinition as b, ThemeProvider as c, useTheme as u };
@@ -1,48 +0,0 @@
1
- // lib/traitRegistry.ts
2
- var traits = /* @__PURE__ */ new Map();
3
- var listeners = /* @__PURE__ */ new Set();
4
- function notifyListeners() {
5
- listeners.forEach((listener) => listener());
6
- }
7
- function registerTrait(info) {
8
- traits.set(info.id, info);
9
- notifyListeners();
10
- }
11
- function updateTraitState(id, newState) {
12
- const trait = traits.get(id);
13
- if (trait) {
14
- trait.currentState = newState;
15
- trait.transitionCount++;
16
- notifyListeners();
17
- }
18
- }
19
- function updateGuardResult(traitId, guardName, result) {
20
- const trait = traits.get(traitId);
21
- if (trait) {
22
- const guard = trait.guards.find((g) => g.name === guardName);
23
- if (guard) {
24
- guard.lastResult = result;
25
- notifyListeners();
26
- }
27
- }
28
- }
29
- function unregisterTrait(id) {
30
- traits.delete(id);
31
- notifyListeners();
32
- }
33
- function getAllTraits() {
34
- return Array.from(traits.values());
35
- }
36
- function getTrait(id) {
37
- return traits.get(id);
38
- }
39
- function subscribeToTraitChanges(listener) {
40
- listeners.add(listener);
41
- return () => listeners.delete(listener);
42
- }
43
- function clearTraits() {
44
- traits.clear();
45
- notifyListeners();
46
- }
47
-
48
- export { clearTraits, getAllTraits, getTrait, registerTrait, subscribeToTraitChanges, unregisterTrait, updateGuardResult, updateTraitState };
@@ -1,311 +0,0 @@
1
- import { clsx } from 'clsx';
2
- import { twMerge } from 'tailwind-merge';
3
-
4
- // lib/cn.ts
5
- function cn(...inputs) {
6
- return twMerge(clsx(inputs));
7
- }
8
-
9
- // lib/debug.ts
10
- var DEBUG_ENABLED = typeof window !== "undefined" && (localStorage.getItem("debug") === "true" || process.env.NODE_ENV === "development");
11
- function isDebugEnabled() {
12
- return DEBUG_ENABLED;
13
- }
14
- function debug(...args) {
15
- if (DEBUG_ENABLED) {
16
- console.log("[DEBUG]", ...args);
17
- }
18
- }
19
- function debugGroup(label) {
20
- if (DEBUG_ENABLED) {
21
- console.group(`[DEBUG] ${label}`);
22
- }
23
- }
24
- function debugGroupEnd() {
25
- if (DEBUG_ENABLED) {
26
- console.groupEnd();
27
- }
28
- }
29
- function debugWarn(...args) {
30
- if (DEBUG_ENABLED) {
31
- console.warn("[DEBUG]", ...args);
32
- }
33
- }
34
- function debugError(...args) {
35
- if (DEBUG_ENABLED) {
36
- console.error("[DEBUG]", ...args);
37
- }
38
- }
39
- function debugTable(data) {
40
- if (DEBUG_ENABLED) {
41
- console.table(data);
42
- }
43
- }
44
- function debugTime(label) {
45
- if (DEBUG_ENABLED) {
46
- console.time(`[DEBUG] ${label}`);
47
- }
48
- }
49
- function debugTimeEnd(label) {
50
- if (DEBUG_ENABLED) {
51
- console.timeEnd(`[DEBUG] ${label}`);
52
- }
53
- }
54
- function debugInput(inputType, data) {
55
- if (DEBUG_ENABLED) {
56
- console.log(`[DEBUG:INPUT] ${inputType}:`, data);
57
- }
58
- }
59
- function debugCollision(entityA, entityB, details) {
60
- if (DEBUG_ENABLED) {
61
- console.log(
62
- `[DEBUG:COLLISION] ${entityA.type || entityA.id} <-> ${entityB.type || entityB.id}`,
63
- details ?? ""
64
- );
65
- }
66
- }
67
- function debugPhysics(entityId, physics) {
68
- if (DEBUG_ENABLED) {
69
- console.log(`[DEBUG:PHYSICS] ${entityId}:`, physics);
70
- }
71
- }
72
- function debugGameState(stateName, value) {
73
- if (DEBUG_ENABLED) {
74
- console.log(`[DEBUG:GAME_STATE] ${stateName}:`, value);
75
- }
76
- }
77
-
78
- // lib/verificationRegistry.ts
79
- var checks = /* @__PURE__ */ new Map();
80
- var transitions = [];
81
- var bridgeHealth = null;
82
- var MAX_TRANSITIONS = 500;
83
- var listeners = /* @__PURE__ */ new Set();
84
- function notifyListeners() {
85
- listeners.forEach((l) => l());
86
- exposeOnWindow();
87
- }
88
- function registerCheck(id, label, status = "pending", details) {
89
- checks.set(id, { id, label, status, details, updatedAt: Date.now() });
90
- notifyListeners();
91
- }
92
- function updateCheck(id, status, details) {
93
- const check = checks.get(id);
94
- if (check) {
95
- check.status = status;
96
- if (details !== void 0) check.details = details;
97
- check.updatedAt = Date.now();
98
- } else {
99
- checks.set(id, { id, label: id, status, details, updatedAt: Date.now() });
100
- }
101
- notifyListeners();
102
- }
103
- function getAllChecks() {
104
- return Array.from(checks.values());
105
- }
106
- function recordTransition(trace) {
107
- const entry = {
108
- ...trace,
109
- id: `t-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
110
- };
111
- transitions.push(entry);
112
- if (transitions.length > MAX_TRANSITIONS) {
113
- transitions.shift();
114
- }
115
- if (entry.event === "INIT") {
116
- const hasFetch = entry.effects.some((e) => e.type === "fetch");
117
- const checkId = `init-fetch-${entry.traitName}`;
118
- if (hasFetch) {
119
- registerCheck(
120
- checkId,
121
- `INIT transition for "${entry.traitName}" has fetch effect`,
122
- "pass"
123
- );
124
- } else {
125
- const hasRenderUI = entry.effects.some((e) => e.type === "render-ui");
126
- if (hasRenderUI) {
127
- registerCheck(
128
- checkId,
129
- `INIT transition for "${entry.traitName}" missing fetch effect`,
130
- "fail",
131
- "Entity-bound render-ui without a fetch effect will show empty data"
132
- );
133
- }
134
- }
135
- }
136
- const failedEffects = entry.effects.filter((e) => e.status === "failed");
137
- if (failedEffects.length > 0) {
138
- registerCheck(
139
- `effects-${entry.id}`,
140
- `Effects failed in ${entry.traitName}: ${entry.from} -> ${entry.to}`,
141
- "fail",
142
- failedEffects.map((e) => `${e.type}: ${e.error}`).join("; ")
143
- );
144
- }
145
- notifyListeners();
146
- }
147
- function getTransitions() {
148
- return [...transitions];
149
- }
150
- function getTransitionsForTrait(traitName) {
151
- return transitions.filter((t) => t.traitName === traitName);
152
- }
153
- function updateBridgeHealth(health) {
154
- bridgeHealth = { ...health };
155
- const checkId = "server-bridge";
156
- if (health.connected) {
157
- registerCheck(checkId, "Server bridge connected", "pass");
158
- } else {
159
- registerCheck(
160
- checkId,
161
- "Server bridge disconnected",
162
- "fail",
163
- health.lastError || "Bridge is not connected"
164
- );
165
- }
166
- notifyListeners();
167
- }
168
- function getBridgeHealth() {
169
- return bridgeHealth ? { ...bridgeHealth } : null;
170
- }
171
- function getSummary() {
172
- const allChecks = getAllChecks();
173
- return {
174
- totalChecks: allChecks.length,
175
- passed: allChecks.filter((c) => c.status === "pass").length,
176
- failed: allChecks.filter((c) => c.status === "fail").length,
177
- warnings: allChecks.filter((c) => c.status === "warn").length,
178
- pending: allChecks.filter((c) => c.status === "pending").length
179
- };
180
- }
181
- function getSnapshot() {
182
- return {
183
- checks: getAllChecks(),
184
- transitions: getTransitions(),
185
- bridge: getBridgeHealth(),
186
- summary: getSummary()
187
- };
188
- }
189
- function subscribeToVerification(listener) {
190
- listeners.add(listener);
191
- return () => listeners.delete(listener);
192
- }
193
- function exposeOnWindow() {
194
- if (typeof window === "undefined") return;
195
- if (!window.__orbitalVerification) {
196
- window.__orbitalVerification = {
197
- getSnapshot,
198
- getChecks: getAllChecks,
199
- getTransitions,
200
- getBridge: getBridgeHealth,
201
- getSummary,
202
- waitForTransition
203
- };
204
- }
205
- }
206
- function waitForTransition(event, timeoutMs = 1e4) {
207
- return new Promise((resolve) => {
208
- const existing = transitions.find((t) => t.event === event);
209
- if (existing) {
210
- resolve(existing);
211
- return;
212
- }
213
- const timeout = setTimeout(() => {
214
- unsub();
215
- resolve(null);
216
- }, timeoutMs);
217
- const unsub = subscribeToVerification(() => {
218
- const found = transitions.find((t) => t.event === event);
219
- if (found) {
220
- clearTimeout(timeout);
221
- unsub();
222
- resolve(found);
223
- }
224
- });
225
- });
226
- }
227
- function bindEventBus(eventBus) {
228
- if (typeof window === "undefined") return;
229
- exposeOnWindow();
230
- if (window.__orbitalVerification) {
231
- window.__orbitalVerification.sendEvent = (event, payload) => {
232
- const prefixed = event.startsWith("UI:") ? event : `UI:${event}`;
233
- eventBus.emit(prefixed, payload);
234
- };
235
- const eventLog = [];
236
- window.__orbitalVerification.eventLog = eventLog;
237
- window.__orbitalVerification.clearEventLog = () => {
238
- eventLog.length = 0;
239
- };
240
- if (eventBus.onAny) {
241
- eventBus.onAny((event) => {
242
- if (eventLog.length < 200) {
243
- eventLog.push({
244
- type: event.type,
245
- payload: event.payload,
246
- timestamp: Date.now()
247
- });
248
- }
249
- });
250
- }
251
- }
252
- }
253
- function bindTraitStateGetter(getter) {
254
- if (typeof window === "undefined") return;
255
- exposeOnWindow();
256
- if (window.__orbitalVerification) {
257
- window.__orbitalVerification.getTraitState = getter;
258
- }
259
- }
260
- function bindCanvasCapture(captureFn) {
261
- if (typeof window === "undefined") return;
262
- exposeOnWindow();
263
- if (window.__orbitalVerification) {
264
- window.__orbitalVerification.captureFrame = captureFn;
265
- }
266
- }
267
- function updateAssetStatus(url, status) {
268
- if (typeof window === "undefined") return;
269
- exposeOnWindow();
270
- if (window.__orbitalVerification) {
271
- if (!window.__orbitalVerification.assetStatus) {
272
- window.__orbitalVerification.assetStatus = {};
273
- }
274
- window.__orbitalVerification.assetStatus[url] = status;
275
- }
276
- }
277
- function clearVerification() {
278
- checks.clear();
279
- transitions.length = 0;
280
- bridgeHealth = null;
281
- notifyListeners();
282
- }
283
- exposeOnWindow();
284
-
285
- // lib/getNestedValue.ts
286
- function getNestedValue(obj, path) {
287
- if (obj === null || obj === void 0 || !path) {
288
- return void 0;
289
- }
290
- if (!path.includes(".")) {
291
- return obj[path];
292
- }
293
- const parts = path.split(".");
294
- let value = obj;
295
- for (const part of parts) {
296
- if (value === null || value === void 0) {
297
- return void 0;
298
- }
299
- if (typeof value !== "object") {
300
- return void 0;
301
- }
302
- value = value[part];
303
- }
304
- return value;
305
- }
306
- function formatNestedFieldLabel(path) {
307
- const lastPart = path.includes(".") ? path.split(".").pop() : path;
308
- return lastPart.replace(/([A-Z])/g, " $1").replace(/^./, (str) => str.toUpperCase()).replace(/Id$/, "").trim();
309
- }
310
-
311
- export { bindCanvasCapture, bindEventBus, bindTraitStateGetter, clearVerification, cn, debug, debugCollision, debugError, debugGameState, debugGroup, debugGroupEnd, debugInput, debugPhysics, debugTable, debugTime, debugTimeEnd, debugWarn, formatNestedFieldLabel, getAllChecks, getBridgeHealth, getNestedValue, getSnapshot, getSummary, getTransitions, getTransitionsForTrait, isDebugEnabled, recordTransition, registerCheck, subscribeToVerification, updateAssetStatus, updateBridgeHealth, updateCheck, waitForTransition };