@almadar/ui 2.5.2 → 2.7.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.
- package/dist/{chunk-2UMN2BLO.js → chunk-2QM732NQ.js} +47 -4
- package/dist/{chunk-45CTDYBT.js → chunk-RPYMP7ZC.js} +137 -1
- package/dist/{chunk-AL6BLHMG.js → chunk-VJP2HCLY.js} +2952 -461
- package/dist/{chunk-GOZKH7QW.js → chunk-WGJIL4YR.js} +267 -2
- package/dist/components/index.d.ts +527 -68
- package/dist/components/index.js +226 -321
- package/dist/hooks/index.d.ts +133 -3
- package/dist/hooks/index.js +3 -3
- package/dist/lib/index.d.ts +33 -2
- package/dist/lib/index.js +1 -2
- package/dist/providers/index.js +4 -5
- package/package.json +1 -1
- package/dist/chunk-KKCVDUK7.js +0 -104
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { apiClient } from './chunk-3HJHHULT.js';
|
|
2
|
-
import {
|
|
3
|
-
import { SelectionContext, entityDataKeys, useEntityList } from './chunk-GOZKH7QW.js';
|
|
2
|
+
import { SelectionContext, entityDataKeys, useEntityList } from './chunk-WGJIL4YR.js';
|
|
4
3
|
import { useEventBus } from './chunk-YXZM3WCF.js';
|
|
5
|
-
import {
|
|
4
|
+
import { subscribe, getSnapshot, clearEntities, removeEntity, updateSingleton, updateEntity, spawnEntity, getSingleton, getAllEntities, getByType, getEntity } from './chunk-N7MVUW4R.js';
|
|
5
|
+
import { useCallback, useState, useEffect, useMemo, useContext, useSyncExternalStore, useRef } from 'react';
|
|
6
6
|
import { useQueryClient, useMutation, useQuery } from '@tanstack/react-query';
|
|
7
7
|
|
|
8
8
|
function useOrbitalHistory(options) {
|
|
@@ -1353,6 +1353,49 @@ function useAuthContext() {
|
|
|
1353
1353
|
signOut: void 0
|
|
1354
1354
|
};
|
|
1355
1355
|
}
|
|
1356
|
+
function getDistance(touches) {
|
|
1357
|
+
const dx = touches[0].clientX - touches[1].clientX;
|
|
1358
|
+
const dy = touches[0].clientY - touches[1].clientY;
|
|
1359
|
+
return Math.sqrt(dx * dx + dy * dy);
|
|
1360
|
+
}
|
|
1361
|
+
function usePinchZoom(options = {}) {
|
|
1362
|
+
const { minScale = 0.5, maxScale = 4 } = options;
|
|
1363
|
+
const [scale, setScale] = useState(1);
|
|
1364
|
+
const [isPinching, setIsPinching] = useState(false);
|
|
1365
|
+
const initialDistance = useRef(0);
|
|
1366
|
+
const initialScale = useRef(1);
|
|
1367
|
+
const onTouchStart = useCallback((e) => {
|
|
1368
|
+
if (e.touches.length === 2) {
|
|
1369
|
+
initialDistance.current = getDistance(e.touches);
|
|
1370
|
+
initialScale.current = scale;
|
|
1371
|
+
setIsPinching(true);
|
|
1372
|
+
}
|
|
1373
|
+
}, [scale]);
|
|
1374
|
+
const onTouchMove = useCallback((e) => {
|
|
1375
|
+
if (e.touches.length !== 2 || !isPinching) return;
|
|
1376
|
+
e.preventDefault();
|
|
1377
|
+
const currentDistance = getDistance(e.touches);
|
|
1378
|
+
const ratio = currentDistance / initialDistance.current;
|
|
1379
|
+
const newScale = Math.min(maxScale, Math.max(minScale, initialScale.current * ratio));
|
|
1380
|
+
setScale(newScale);
|
|
1381
|
+
}, [isPinching, minScale, maxScale]);
|
|
1382
|
+
const onTouchEnd = useCallback(() => {
|
|
1383
|
+
setIsPinching(false);
|
|
1384
|
+
}, []);
|
|
1385
|
+
const resetZoom = useCallback(() => {
|
|
1386
|
+
setScale(1);
|
|
1387
|
+
}, []);
|
|
1388
|
+
return {
|
|
1389
|
+
scale,
|
|
1390
|
+
isPinching,
|
|
1391
|
+
gestureProps: {
|
|
1392
|
+
onTouchStart,
|
|
1393
|
+
onTouchMove,
|
|
1394
|
+
onTouchEnd
|
|
1395
|
+
},
|
|
1396
|
+
resetZoom
|
|
1397
|
+
};
|
|
1398
|
+
}
|
|
1356
1399
|
var API_BASE = typeof process !== "undefined" && process.env?.VITE_API_URL ? process.env.VITE_API_URL : "http://localhost:3000";
|
|
1357
1400
|
function getUserId() {
|
|
1358
1401
|
return localStorage.getItem("userId") || "anonymous";
|
|
@@ -1429,4 +1472,4 @@ function useGitHubBranches(owner, repo, enabled = true) {
|
|
|
1429
1472
|
});
|
|
1430
1473
|
}
|
|
1431
1474
|
|
|
1432
|
-
export { ENTITY_EVENTS, useAgentChat, useAuthContext, useCompile, useConnectGitHub, useCreateEntity, useDeepAgentGeneration, useDeleteEntity, useDisconnectGitHub, useEntities, useEntitiesByType, useEntity, useEntityMutations, useExtensions, useFileEditor, useFileSystem, useGitHubBranches, useGitHubRepo, useGitHubRepos, useGitHubStatus, useInput, useOrbitalHistory, useOrbitalMutations, usePhysics, usePlayer, usePreview, useResolvedEntity, useSelectedEntity, useSendOrbitalEvent, useSingletonEntity, useUIEvents, useUpdateEntity, useValidation };
|
|
1475
|
+
export { ENTITY_EVENTS, useAgentChat, useAuthContext, useCompile, useConnectGitHub, useCreateEntity, useDeepAgentGeneration, useDeleteEntity, useDisconnectGitHub, useEntities, useEntitiesByType, useEntity, useEntityMutations, useExtensions, useFileEditor, useFileSystem, useGitHubBranches, useGitHubRepo, useGitHubRepos, useGitHubStatus, useInput, useOrbitalHistory, useOrbitalMutations, usePhysics, usePinchZoom, usePlayer, usePreview, useResolvedEntity, useSelectedEntity, useSendOrbitalEvent, useSingletonEntity, useUIEvents, useUpdateEntity, useValidation };
|
|
@@ -1,3 +1,106 @@
|
|
|
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/getNestedValue.ts
|
|
79
|
+
function getNestedValue(obj, path) {
|
|
80
|
+
if (obj === null || obj === void 0) {
|
|
81
|
+
return void 0;
|
|
82
|
+
}
|
|
83
|
+
if (!path.includes(".")) {
|
|
84
|
+
return obj[path];
|
|
85
|
+
}
|
|
86
|
+
const parts = path.split(".");
|
|
87
|
+
let value = obj;
|
|
88
|
+
for (const part of parts) {
|
|
89
|
+
if (value === null || value === void 0) {
|
|
90
|
+
return void 0;
|
|
91
|
+
}
|
|
92
|
+
if (typeof value !== "object") {
|
|
93
|
+
return void 0;
|
|
94
|
+
}
|
|
95
|
+
value = value[part];
|
|
96
|
+
}
|
|
97
|
+
return value;
|
|
98
|
+
}
|
|
99
|
+
function formatNestedFieldLabel(path) {
|
|
100
|
+
const lastPart = path.includes(".") ? path.split(".").pop() : path;
|
|
101
|
+
return lastPart.replace(/([A-Z])/g, " $1").replace(/^./, (str) => str.toUpperCase()).replace(/Id$/, "").trim();
|
|
102
|
+
}
|
|
103
|
+
|
|
1
104
|
// lib/verificationRegistry.ts
|
|
2
105
|
var checks = /* @__PURE__ */ new Map();
|
|
3
106
|
var transitions = [];
|
|
@@ -154,6 +257,22 @@ function bindEventBus(eventBus) {
|
|
|
154
257
|
window.__orbitalVerification.sendEvent = (event, payload) => {
|
|
155
258
|
eventBus.emit(event, payload);
|
|
156
259
|
};
|
|
260
|
+
const eventLog = [];
|
|
261
|
+
window.__orbitalVerification.eventLog = eventLog;
|
|
262
|
+
window.__orbitalVerification.clearEventLog = () => {
|
|
263
|
+
eventLog.length = 0;
|
|
264
|
+
};
|
|
265
|
+
if (eventBus.onAny) {
|
|
266
|
+
eventBus.onAny((event) => {
|
|
267
|
+
if (eventLog.length < 200) {
|
|
268
|
+
eventLog.push({
|
|
269
|
+
type: event.type,
|
|
270
|
+
payload: event.payload,
|
|
271
|
+
timestamp: Date.now()
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
}
|
|
157
276
|
}
|
|
158
277
|
}
|
|
159
278
|
function bindTraitStateGetter(getter) {
|
|
@@ -163,6 +282,23 @@ function bindTraitStateGetter(getter) {
|
|
|
163
282
|
window.__orbitalVerification.getTraitState = getter;
|
|
164
283
|
}
|
|
165
284
|
}
|
|
285
|
+
function bindCanvasCapture(captureFn) {
|
|
286
|
+
if (typeof window === "undefined") return;
|
|
287
|
+
exposeOnWindow();
|
|
288
|
+
if (window.__orbitalVerification) {
|
|
289
|
+
window.__orbitalVerification.captureFrame = captureFn;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
function updateAssetStatus(url, status) {
|
|
293
|
+
if (typeof window === "undefined") return;
|
|
294
|
+
exposeOnWindow();
|
|
295
|
+
if (window.__orbitalVerification) {
|
|
296
|
+
if (!window.__orbitalVerification.assetStatus) {
|
|
297
|
+
window.__orbitalVerification.assetStatus = {};
|
|
298
|
+
}
|
|
299
|
+
window.__orbitalVerification.assetStatus[url] = status;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
166
302
|
function clearVerification() {
|
|
167
303
|
checks.clear();
|
|
168
304
|
transitions.length = 0;
|
|
@@ -171,4 +307,4 @@ function clearVerification() {
|
|
|
171
307
|
}
|
|
172
308
|
exposeOnWindow();
|
|
173
309
|
|
|
174
|
-
export { bindEventBus, bindTraitStateGetter, clearVerification, getAllChecks, getBridgeHealth, getSnapshot, getSummary, getTransitions, getTransitionsForTrait, recordTransition, registerCheck, subscribeToVerification, updateBridgeHealth, updateCheck, waitForTransition };
|
|
310
|
+
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 };
|