@almadar/shell-web 1.0.0 → 1.1.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 (70) hide show
  1. package/dist/AvlGlyph-PIXU6QH5.js +5 -0
  2. package/dist/AvlStateMachine-CKGMECMG.js +8 -0
  3. package/dist/{AvlTransitionDetail-63SD6GZF.js → AvlTransitionDetail-QZX6G5KJ.js} +4 -5
  4. package/dist/AvlTransitionExplainer-26WLEIC6.js +11 -0
  5. package/dist/BehaviorView-JLZ4PKWY.js +10 -0
  6. package/dist/{FileTree-BCFnBEuQ.d.ts → FileTree-B3GDAjaQ.d.ts} +131 -4
  7. package/dist/{FlowCanvas-AUMTWMNG.js → FlowCanvas-RPII4V24.js} +10 -13
  8. package/dist/{FlowCanvas-3JRMNJLV.css → FlowCanvas-VWUPMBKB.css} +189 -191
  9. package/dist/{GameAudioProvider-ceM_n0ey.d.ts → GameAudioProvider-D7wo5ryN.d.ts} +1 -1
  10. package/dist/{KernelEngineContext-CcxGYtlr.d.ts → KernelEngineContext-CPeWQMAz.d.ts} +15 -2
  11. package/dist/ModuleCard-NJD6JQGD.js +6 -0
  12. package/dist/{OrbInspector-QCPEPUPH.js → OrbInspector-OWWKPOBF.js} +10 -13
  13. package/dist/{OrbInspector-MHLJ6OEE.css → OrbInspector-VMTMZHNQ.css} +189 -191
  14. package/dist/{Select-B-iDdnvE.d.ts → Select-C2Uq6t86.d.ts} +1 -1
  15. package/dist/{UISlotRenderer-KVFO6J7R.css → UISlotRenderer-BIS6KT7T.css} +189 -191
  16. package/dist/{UISlotRenderer-C7WWOK43.js → UISlotRenderer-PY7FIJXN.js} +10 -13
  17. package/dist/avl/index.css +189 -191
  18. package/dist/avl/index.d.ts +19 -7
  19. package/dist/avl/index.js +157 -26
  20. package/dist/{chunk-TUPZWTRE.js → chunk-2WGR4TDJ.js} +464 -35
  21. package/dist/{chunk-SP5CDJ6K.js → chunk-4YJ53G7S.js} +3 -3
  22. package/dist/{chunk-HH5KSMH5.js → chunk-7N6ZPHQ5.js} +1 -1
  23. package/dist/{chunk-CPLN6NBQ.js → chunk-AGVSO4WY.js} +2 -3
  24. package/dist/{chunk-UXLE3IPR.js → chunk-FAKU5F62.js} +205 -4
  25. package/dist/{chunk-TXAUOLWZ.js → chunk-M74BCDBQ.js} +1 -1
  26. package/dist/{chunk-LHP2TK7O.js → chunk-MS4K3K2R.js} +2908 -4574
  27. package/dist/{chunk-K4MOPSEL.js → chunk-OWNG4JZI.js} +3 -4
  28. package/dist/{chunk-AB3X7QTE.js → chunk-PRLHKBXG.js} +1 -2
  29. package/dist/{chunk-X3DMMX27.js → chunk-VHC2M26B.js} +1 -1
  30. package/dist/{chunk-E6KA4J6N.js → chunk-VUIACGDU.js} +3 -4
  31. package/dist/{chunk-ROICKAU7.js → chunk-YYIHRIDH.js} +1 -1
  32. package/dist/{chunk-3VZ36ZKO.js → chunk-ZDRDJKYB.js} +5 -2
  33. package/dist/components/index.css +189 -191
  34. package/dist/components/index.d.ts +417 -173
  35. package/dist/components/index.js +14 -17
  36. package/dist/core.d.ts +3 -3
  37. package/dist/{fx-CmQjnHmT.d.ts → fx-Br8zjvu9.d.ts} +6 -6
  38. package/dist/index.d.ts +4 -0
  39. package/dist/index.js +2 -2
  40. package/dist/{kernel-client-TZKGHJRY.js → kernel-client-JW6OH5FX.js} +24 -3
  41. package/dist/{kernel-wire-wNdAPfhJ.d.ts → kernel-wire-DGAySGhX.d.ts} +7 -0
  42. package/dist/lib/index.d.ts +2 -3
  43. package/dist/lib/index.js +2 -3
  44. package/dist/providers/index.css +189 -191
  45. package/dist/providers/index.d.ts +6 -8
  46. package/dist/providers/index.js +10 -14
  47. package/dist/runtime/index.css +189 -191
  48. package/dist/runtime/index.d.ts +6 -1
  49. package/dist/runtime/index.js +10 -13
  50. package/dist/test-support.js +2 -2
  51. package/dist/{paintDispatch-CuJLsr9Y.d.ts → verificationRegistry-oopV1J1n.d.ts} +127 -15
  52. package/package.json +8 -36
  53. package/dist/AvlGlyph-EPJKFEO3.js +0 -6
  54. package/dist/AvlStateMachine-RKZIKNGC.js +0 -9
  55. package/dist/AvlTransitionExplainer-ZBTLOM3T.js +0 -12
  56. package/dist/BehaviorView-YS5G4GNB.js +0 -11
  57. package/dist/Canvas3DHost-BkZQB5l2.d.ts +0 -552
  58. package/dist/ModuleCard-QHDGK5XK.js +0 -7
  59. package/dist/avl-3d-context-BycmO6tG.d.ts +0 -201
  60. package/dist/avl-schema-parser-CtJxJ9KU.d.ts +0 -132
  61. package/dist/avl-zoom-state-CKMVuBFg.d.ts +0 -17
  62. package/dist/chunk-4T3P43NS.js +0 -1133
  63. package/dist/chunk-DZBQA2OW.js +0 -176
  64. package/dist/chunk-EOWMARUB.js +0 -16
  65. package/dist/chunk-GFXCPUMX.js +0 -1334
  66. package/dist/chunk-ILZ7ORX7.js +0 -432
  67. package/dist/three/index.css +0 -503
  68. package/dist/three/index.d.ts +0 -1185
  69. package/dist/three/index.js +0 -3908
  70. package/dist/verificationRegistry-CVrcxG1s.d.ts +0 -122
@@ -1,432 +0,0 @@
1
- import { createLogger } from '@almadar/logger';
2
-
3
- // src/lib/keyMapEvent.ts
4
- function isEditableTarget(target) {
5
- if (!(target instanceof HTMLElement)) return false;
6
- const tag = target.tagName;
7
- if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT") return true;
8
- if (target.isContentEditable || target.contentEditable === "true") return true;
9
- const attr = target.getAttribute("contenteditable");
10
- return attr === "" || attr === "true" || attr === "plaintext-only";
11
- }
12
- function keyMapCode(e) {
13
- let code = e.code;
14
- if (e.altKey) code = `Alt+${code}`;
15
- if (e.shiftKey) code = `Shift+${code}`;
16
- if (e.metaKey || e.ctrlKey) code = `Mod+${code}`;
17
- return code;
18
- }
19
- function resolveKeyMapEvent(map, e) {
20
- if (!map || isEditableTarget(e.target)) return void 0;
21
- return map[keyMapCode(e)] ?? map[e.code];
22
- }
23
- var log = createLogger("almadar:bridge");
24
- var MAX_TRANSITIONS = 500;
25
- function getState() {
26
- if (typeof window !== "undefined") {
27
- const w = window;
28
- if (!w.__verificationRegistryState) {
29
- w.__verificationRegistryState = {
30
- checks: /* @__PURE__ */ new Map(),
31
- transitions: [],
32
- bridgeHealth: null,
33
- listeners: /* @__PURE__ */ new Set(),
34
- traitSnapshots: /* @__PURE__ */ new Map()
35
- };
36
- }
37
- return w.__verificationRegistryState;
38
- }
39
- return {
40
- checks: /* @__PURE__ */ new Map(),
41
- transitions: [],
42
- bridgeHealth: null,
43
- listeners: /* @__PURE__ */ new Set(),
44
- traitSnapshots: /* @__PURE__ */ new Map()
45
- };
46
- }
47
- function notifyListeners() {
48
- getState().listeners.forEach((l) => l());
49
- exposeOnWindow();
50
- }
51
- function registerCheck(id, label, status = "pending", details) {
52
- getState().checks.set(id, { id, label, status, details, updatedAt: Date.now() });
53
- notifyListeners();
54
- }
55
- function updateCheck(id, status, details) {
56
- const check = getState().checks.get(id);
57
- if (check) {
58
- check.status = status;
59
- if (details !== void 0) check.details = details;
60
- check.updatedAt = Date.now();
61
- } else {
62
- getState().checks.set(id, { id, label: id, status, details, updatedAt: Date.now() });
63
- }
64
- notifyListeners();
65
- }
66
- function getAllChecks() {
67
- return Array.from(getState().checks.values());
68
- }
69
- function recordTransition(trace) {
70
- const entry = {
71
- ...trace,
72
- id: `t-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
73
- };
74
- log.debug("transition:recorded", { trait: trace.traitName, from: trace.from, to: trace.to, event: trace.event, effectCount: trace.effects.length });
75
- getState().transitions.push(entry);
76
- if (getState().transitions.length > MAX_TRANSITIONS) {
77
- getState().transitions.shift();
78
- }
79
- if (entry.event === "INIT") {
80
- const hasFetch = entry.effects.some((e) => e.type === "fetch");
81
- const hasEntitySeed = entry.effects.some(
82
- (e) => e.type === "set" && typeof e.args[0] === "string" && e.args[0].startsWith("@entity.")
83
- );
84
- const checkId = `init-fetch-${entry.traitName}`;
85
- if (hasFetch || hasEntitySeed) {
86
- registerCheck(
87
- checkId,
88
- `INIT transition for "${entry.traitName}" has fetch or entity-seed effect`,
89
- "pass"
90
- );
91
- } else {
92
- const rendersEntityData = entry.effects.some(
93
- (e) => e.type === "render-ui" && JSON.stringify(e.args).includes("@entity.")
94
- );
95
- if (rendersEntityData) {
96
- const siblingSeeds = getState().transitions.some(
97
- (t) => t.event === "INIT" && t.effects.some(
98
- (e) => e.type === "fetch" || e.type === "set" && typeof e.args[0] === "string" && e.args[0].startsWith("@entity.")
99
- )
100
- );
101
- if (siblingSeeds) {
102
- registerCheck(
103
- checkId,
104
- `INIT transition for "${entry.traitName}" has sibling entity-seed (shared entity)`,
105
- "pass"
106
- );
107
- } else {
108
- registerCheck(
109
- checkId,
110
- `INIT transition for "${entry.traitName}" missing fetch effect`,
111
- "fail",
112
- "Entity-bound render-ui without a fetch effect will show empty data"
113
- );
114
- }
115
- }
116
- }
117
- }
118
- const failedEffects = entry.effects.filter((e) => e.status === "failed");
119
- if (failedEffects.length > 0) {
120
- registerCheck(
121
- `effects-${entry.id}`,
122
- `Effects failed in ${entry.traitName}: ${entry.from} -> ${entry.to}`,
123
- "fail",
124
- failedEffects.map((e) => `${e.type}: ${e.error}`).join("; ")
125
- );
126
- }
127
- notifyListeners();
128
- }
129
- function getTransitions() {
130
- return [...getState().transitions];
131
- }
132
- function getTransitionsForTrait(traitName) {
133
- return getState().transitions.filter((t) => t.traitName === traitName);
134
- }
135
- function recordServerResponse(orbitalName, event, response) {
136
- const { effectResults, ...responseFields } = response;
137
- const serverResponse = {
138
- ...responseFields,
139
- orbitalName,
140
- timestamp: Date.now()
141
- };
142
- const entry = {
143
- id: `srv-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
144
- traitName: `server:${orbitalName}`,
145
- from: "server",
146
- to: "server",
147
- event,
148
- effects: effectResults ?? [],
149
- serverResponse,
150
- timestamp: Date.now()
151
- };
152
- getState().transitions.push(entry);
153
- if (getState().transitions.length > MAX_TRANSITIONS) {
154
- getState().transitions.shift();
155
- }
156
- if (!response.success && response.error) {
157
- registerCheck(
158
- `server-error-${entry.id}`,
159
- `Server error for ${orbitalName}:${event}`,
160
- "fail",
161
- response.error
162
- );
163
- }
164
- notifyListeners();
165
- }
166
- function serverEffectTraces(results) {
167
- if (!results) return [];
168
- return results.map((r) => {
169
- const resultId = typeof r.data === "object" && r.data !== null && !Array.isArray(r.data) && "id" in r.data && typeof r.data.id === "string" ? r.data.id : void 0;
170
- const outcome = r.denied ? "denied" : r.success ? "success" : "failed";
171
- return {
172
- type: r.effect,
173
- ...r.entityType !== void 0 ? { entityName: r.entityType } : {},
174
- ...r.action === "create" || r.action === "update" || r.action === "delete" || r.action === "batch" ? { action: r.action } : {},
175
- ...resultId !== void 0 ? { resultId } : {},
176
- outcome,
177
- args: [],
178
- status: outcome === "success" ? "executed" : "failed",
179
- ...r.error !== void 0 ? { error: r.error } : {},
180
- ...r.target !== void 0 ? { target: r.target } : {},
181
- ...r.routed !== void 0 ? { routed: r.routed } : {}
182
- };
183
- });
184
- }
185
- function recordOrbitalResponse(orbitalName, request, response) {
186
- recordServerResponse(orbitalName, request.event, {
187
- success: response.success,
188
- transitioned: response.transitioned,
189
- emitted: response.emittedEvents.map((e) => ({ event: e.event, ...e.payload !== void 0 ? { payload: e.payload } : {} })),
190
- emittedEvents: response.emittedEvents.map((e) => e.event),
191
- clientEffects: response.clientEffectsByTrait?.length ?? 0,
192
- dataEntities: Object.fromEntries(Object.entries(response.data ?? {}).map(([name, rows]) => [name, rows.length])),
193
- ...response.error !== void 0 ? { error: response.error } : {},
194
- effectResults: serverEffectTraces(response.effectResults)
195
- });
196
- }
197
- function recordingTransport(transport) {
198
- const subscribe = transport.subscribe?.bind(transport);
199
- const subscribeHostDispatches = transport.subscribeHostDispatches?.bind(transport);
200
- return {
201
- ...transport.hostsBrowserStore !== void 0 ? { hostsBrowserStore: transport.hostsBrowserStore } : {},
202
- register: (schema) => transport.register(schema),
203
- unregister: () => transport.unregister(),
204
- send: async (orbitalName, request) => {
205
- const response = await transport.send(orbitalName, request);
206
- recordOrbitalResponse(orbitalName, request, response);
207
- return response;
208
- },
209
- ...subscribe !== void 0 ? { subscribe } : {},
210
- ...subscribeHostDispatches !== void 0 ? { subscribeHostDispatches } : {}
211
- };
212
- }
213
- function updateBridgeHealth(health) {
214
- getState().bridgeHealth = { ...health };
215
- const checkId = "server-bridge";
216
- if (health.connected) {
217
- registerCheck(checkId, "Server bridge connected", "pass");
218
- } else {
219
- registerCheck(
220
- checkId,
221
- "Server bridge disconnected",
222
- "fail",
223
- health.lastError || "Bridge is not connected"
224
- );
225
- }
226
- notifyListeners();
227
- }
228
- function getBridgeHealth() {
229
- const bh = getState().bridgeHealth;
230
- return bh ? { ...bh } : null;
231
- }
232
- function getSummary() {
233
- const allChecks = getAllChecks();
234
- return {
235
- totalChecks: allChecks.length,
236
- passed: allChecks.filter((c) => c.status === "pass").length,
237
- failed: allChecks.filter((c) => c.status === "fail").length,
238
- warnings: allChecks.filter((c) => c.status === "warn").length,
239
- pending: allChecks.filter((c) => c.status === "pending").length
240
- };
241
- }
242
- function getSnapshot() {
243
- return {
244
- checks: getAllChecks(),
245
- transitions: getTransitions(),
246
- bridge: getBridgeHealth(),
247
- summary: getSummary(),
248
- traits: getTraitSnapshots()
249
- };
250
- }
251
- function getTraitSnapshots() {
252
- const snapshots = [];
253
- for (const [traitName, getter] of getState().traitSnapshots.entries()) {
254
- try {
255
- snapshots.push(getter());
256
- } catch (err) {
257
- log.error("traitSnapshot getter failed", { trait: traitName, err: String(err) });
258
- }
259
- }
260
- return snapshots;
261
- }
262
- function subscribeToVerification(listener) {
263
- getState().listeners.add(listener);
264
- return () => getState().listeners.delete(listener);
265
- }
266
- function defaultGetTraitState(traitName) {
267
- const getter = getState().traitSnapshots.get(traitName);
268
- if (getter === void 0) return void 0;
269
- try {
270
- return getter().currentState;
271
- } catch {
272
- return void 0;
273
- }
274
- }
275
- function verifierAttached() {
276
- return typeof window !== "undefined" && window.__ALMADAR_VERIFY__ === true;
277
- }
278
- function exposeOnWindow() {
279
- if (typeof window === "undefined") return;
280
- if (!window.__orbitalVerification) {
281
- window.__orbitalVerification = {
282
- getSnapshot,
283
- getChecks: getAllChecks,
284
- getTransitions,
285
- getBridge: getBridgeHealth,
286
- getSummary,
287
- waitForTransition,
288
- getTraitSnapshots,
289
- getTraitState: defaultGetTraitState
290
- };
291
- } else {
292
- if (!window.__orbitalVerification.getTraitSnapshots) {
293
- window.__orbitalVerification.getTraitSnapshots = getTraitSnapshots;
294
- }
295
- if (!window.__orbitalVerification.getTraitState) {
296
- window.__orbitalVerification.getTraitState = defaultGetTraitState;
297
- }
298
- }
299
- }
300
- function waitForTransition(event, timeoutMs = 1e4) {
301
- return new Promise((resolve) => {
302
- const existing = getState().transitions.find((t) => t.event === event);
303
- if (existing) {
304
- resolve(existing);
305
- return;
306
- }
307
- const timeout = setTimeout(() => {
308
- unsub();
309
- resolve(null);
310
- }, timeoutMs);
311
- const unsub = subscribeToVerification(() => {
312
- const found = getState().transitions.find((t) => t.event === event);
313
- if (found) {
314
- clearTimeout(timeout);
315
- unsub();
316
- resolve(found);
317
- }
318
- });
319
- });
320
- }
321
- function bindEventBus(eventBus) {
322
- if (typeof window === "undefined") return;
323
- log.info("bindEventBus", { hasOnAny: !!eventBus.onAny });
324
- exposeOnWindow();
325
- if (window.__orbitalVerification) {
326
- window.__orbitalVerification.sendEvent = (event, payload, traitScope) => {
327
- const prefixed = event.startsWith("UI:") ? event : traitScope ? `UI:${traitScope}.${event}` : `UI:${event}`;
328
- log.debug("sendEvent", { event: prefixed, traitScope, payloadKeys: payload ? Object.keys(payload) : [] });
329
- eventBus.emit(prefixed, payload);
330
- };
331
- const MAX_EVENT_LOG = 5e3;
332
- const eventLog = [];
333
- let eventLogDropped = 0;
334
- const bumpEpoch = () => {
335
- window.__orbitalVerification.eventLogEpoch = `${Date.now()}-${Math.random().toString(36).slice(2)}`;
336
- };
337
- window.__orbitalVerification.eventLog = eventLog;
338
- window.__orbitalVerification.eventLogDropped = 0;
339
- bumpEpoch();
340
- window.__orbitalVerification.clearEventLog = () => {
341
- eventLog.length = 0;
342
- eventLogDropped = 0;
343
- window.__orbitalVerification.eventLogDropped = 0;
344
- bumpEpoch();
345
- };
346
- if (eventBus.onAny) {
347
- const verificationRegistryEventLogger = (event) => {
348
- eventLog.push({
349
- type: event.type,
350
- payload: event.payload,
351
- ...event.source === void 0 ? {} : { source: event.source },
352
- timestamp: Date.now()
353
- });
354
- if (eventLog.length > MAX_EVENT_LOG) {
355
- eventLog.shift();
356
- eventLogDropped += 1;
357
- window.__orbitalVerification.eventLogDropped = eventLogDropped;
358
- }
359
- };
360
- Object.defineProperty(verificationRegistryEventLogger, "name", {
361
- value: "verificationRegistry:eventLog"
362
- });
363
- eventBus.onAny(verificationRegistryEventLogger);
364
- }
365
- }
366
- }
367
- function bindConfigApplier(applyConfig) {
368
- if (typeof window === "undefined") return () => {
369
- };
370
- exposeOnWindow();
371
- const bridge = window.__orbitalVerification;
372
- if (!bridge) return () => {
373
- };
374
- bridge.applyConfig = applyConfig;
375
- return () => {
376
- if (bridge.applyConfig === applyConfig) delete bridge.applyConfig;
377
- };
378
- }
379
- function bindTraitStateGetter(getter) {
380
- if (typeof window === "undefined") return;
381
- exposeOnWindow();
382
- if (window.__orbitalVerification) {
383
- window.__orbitalVerification.getTraitState = getter;
384
- }
385
- }
386
- function registerTraitSnapshot(traitName, getter) {
387
- if (typeof window === "undefined") return () => {
388
- };
389
- getState().traitSnapshots.set(traitName, getter);
390
- exposeOnWindow();
391
- notifyListeners();
392
- return () => {
393
- const s = getState();
394
- if (s.traitSnapshots.get(traitName) === getter) {
395
- s.traitSnapshots.delete(traitName);
396
- notifyListeners();
397
- }
398
- };
399
- }
400
- function bindCanvasCapture(captureFn) {
401
- if (typeof window === "undefined") return;
402
- exposeOnWindow();
403
- if (window.__orbitalVerification) {
404
- window.__orbitalVerification.captureFrame = captureFn;
405
- }
406
- }
407
- function bindLastDrawables(getDrawables) {
408
- if (typeof window === "undefined") return;
409
- exposeOnWindow();
410
- if (window.__orbitalVerification) {
411
- window.__orbitalVerification.getLastDrawables = getDrawables;
412
- }
413
- }
414
- function updateAssetStatus(url, status) {
415
- if (typeof window === "undefined") return;
416
- exposeOnWindow();
417
- if (window.__orbitalVerification) {
418
- if (!window.__orbitalVerification.assetStatus) {
419
- window.__orbitalVerification.assetStatus = {};
420
- }
421
- window.__orbitalVerification.assetStatus[url] = status;
422
- }
423
- }
424
- function clearVerification() {
425
- getState().checks.clear();
426
- getState().transitions.length = 0;
427
- getState().bridgeHealth = null;
428
- notifyListeners();
429
- }
430
- exposeOnWindow();
431
-
432
- export { bindCanvasCapture, bindConfigApplier, bindEventBus, bindLastDrawables, bindTraitStateGetter, clearVerification, getAllChecks, getBridgeHealth, getSnapshot, getSummary, getTraitSnapshots, getTransitions, getTransitionsForTrait, isEditableTarget, keyMapCode, recordOrbitalResponse, recordServerResponse, recordTransition, recordingTransport, registerCheck, registerTraitSnapshot, resolveKeyMapEvent, serverEffectTraces, subscribeToVerification, updateAssetStatus, updateBridgeHealth, updateCheck, verifierAttached, waitForTransition };