@almadar/ui 2.24.5 → 2.24.8
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 +43 -43
- package/dist/avl/index.js +43 -43
- package/dist/components/index.cjs +995 -931
- package/dist/components/index.js +995 -931
- package/dist/components/organisms/debug/RuntimeDebugger.d.ts +2 -2
- package/dist/components/organisms/game/three/index.cjs +41 -41
- package/dist/components/organisms/game/three/index.js +41 -41
- package/dist/docs/index.cjs +143 -142
- package/dist/docs/index.js +143 -142
- package/dist/illustrations/index.cjs +17 -17
- package/dist/illustrations/index.js +17 -17
- package/dist/lib/index.cjs +62 -50
- package/dist/lib/index.js +62 -50
- package/dist/marketing/index.cjs +168 -167
- package/dist/marketing/index.js +168 -167
- package/dist/providers/index.cjs +220 -206
- package/dist/providers/index.js +220 -206
- package/dist/runtime/index.cjs +978 -882
- package/dist/runtime/index.js +978 -882
- package/package.json +1 -1
- package/tailwind-preset.cjs +32 -134
package/dist/lib/index.js
CHANGED
|
@@ -426,41 +426,52 @@ function clearTraits() {
|
|
|
426
426
|
}
|
|
427
427
|
|
|
428
428
|
// lib/verificationRegistry.ts
|
|
429
|
-
var checks = /* @__PURE__ */ new Map();
|
|
430
|
-
var transitions = [];
|
|
431
|
-
var bridgeHealth = null;
|
|
432
429
|
var MAX_TRANSITIONS = 500;
|
|
433
|
-
|
|
430
|
+
function getState() {
|
|
431
|
+
if (typeof window !== "undefined") {
|
|
432
|
+
const w = window;
|
|
433
|
+
if (!w.__verificationRegistryState) {
|
|
434
|
+
w.__verificationRegistryState = {
|
|
435
|
+
checks: /* @__PURE__ */ new Map(),
|
|
436
|
+
transitions: [],
|
|
437
|
+
bridgeHealth: null,
|
|
438
|
+
listeners: /* @__PURE__ */ new Set()
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
return w.__verificationRegistryState;
|
|
442
|
+
}
|
|
443
|
+
return { checks: /* @__PURE__ */ new Map(), transitions: [], bridgeHealth: null, listeners: /* @__PURE__ */ new Set() };
|
|
444
|
+
}
|
|
434
445
|
function notifyListeners5() {
|
|
435
|
-
|
|
446
|
+
getState().listeners.forEach((l) => l());
|
|
436
447
|
exposeOnWindow();
|
|
437
448
|
}
|
|
438
449
|
function registerCheck(id, label, status = "pending", details) {
|
|
439
|
-
checks.set(id, { id, label, status, details, updatedAt: Date.now() });
|
|
450
|
+
getState().checks.set(id, { id, label, status, details, updatedAt: Date.now() });
|
|
440
451
|
notifyListeners5();
|
|
441
452
|
}
|
|
442
453
|
function updateCheck(id, status, details) {
|
|
443
|
-
const check = checks.get(id);
|
|
454
|
+
const check = getState().checks.get(id);
|
|
444
455
|
if (check) {
|
|
445
456
|
check.status = status;
|
|
446
457
|
if (details !== void 0) check.details = details;
|
|
447
458
|
check.updatedAt = Date.now();
|
|
448
459
|
} else {
|
|
449
|
-
checks.set(id, { id, label: id, status, details, updatedAt: Date.now() });
|
|
460
|
+
getState().checks.set(id, { id, label: id, status, details, updatedAt: Date.now() });
|
|
450
461
|
}
|
|
451
462
|
notifyListeners5();
|
|
452
463
|
}
|
|
453
464
|
function getAllChecks() {
|
|
454
|
-
return Array.from(checks.values());
|
|
465
|
+
return Array.from(getState().checks.values());
|
|
455
466
|
}
|
|
456
467
|
function recordTransition(trace) {
|
|
457
468
|
const entry = {
|
|
458
469
|
...trace,
|
|
459
470
|
id: `t-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
|
|
460
471
|
};
|
|
461
|
-
transitions.push(entry);
|
|
462
|
-
if (transitions.length > MAX_TRANSITIONS) {
|
|
463
|
-
transitions.shift();
|
|
472
|
+
getState().transitions.push(entry);
|
|
473
|
+
if (getState().transitions.length > MAX_TRANSITIONS) {
|
|
474
|
+
getState().transitions.shift();
|
|
464
475
|
}
|
|
465
476
|
if (entry.event === "INIT") {
|
|
466
477
|
const hasFetch = entry.effects.some((e) => e.type === "fetch");
|
|
@@ -495,13 +506,13 @@ function recordTransition(trace) {
|
|
|
495
506
|
notifyListeners5();
|
|
496
507
|
}
|
|
497
508
|
function getTransitions() {
|
|
498
|
-
return [...transitions];
|
|
509
|
+
return [...getState().transitions];
|
|
499
510
|
}
|
|
500
511
|
function getTransitionsForTrait(traitName) {
|
|
501
|
-
return transitions.filter((t) => t.traitName === traitName);
|
|
512
|
+
return getState().transitions.filter((t) => t.traitName === traitName);
|
|
502
513
|
}
|
|
503
514
|
function updateBridgeHealth(health) {
|
|
504
|
-
bridgeHealth = { ...health };
|
|
515
|
+
getState().bridgeHealth = { ...health };
|
|
505
516
|
const checkId = "server-bridge";
|
|
506
517
|
if (health.connected) {
|
|
507
518
|
registerCheck(checkId, "Server bridge connected", "pass");
|
|
@@ -516,7 +527,8 @@ function updateBridgeHealth(health) {
|
|
|
516
527
|
notifyListeners5();
|
|
517
528
|
}
|
|
518
529
|
function getBridgeHealth() {
|
|
519
|
-
|
|
530
|
+
const bh = getState().bridgeHealth;
|
|
531
|
+
return bh ? { ...bh } : null;
|
|
520
532
|
}
|
|
521
533
|
function getSummary() {
|
|
522
534
|
const allChecks = getAllChecks();
|
|
@@ -537,8 +549,8 @@ function getSnapshot() {
|
|
|
537
549
|
};
|
|
538
550
|
}
|
|
539
551
|
function subscribeToVerification(listener) {
|
|
540
|
-
|
|
541
|
-
return () =>
|
|
552
|
+
getState().listeners.add(listener);
|
|
553
|
+
return () => getState().listeners.delete(listener);
|
|
542
554
|
}
|
|
543
555
|
function exposeOnWindow() {
|
|
544
556
|
if (typeof window === "undefined") return;
|
|
@@ -555,7 +567,7 @@ function exposeOnWindow() {
|
|
|
555
567
|
}
|
|
556
568
|
function waitForTransition(event, timeoutMs = 1e4) {
|
|
557
569
|
return new Promise((resolve) => {
|
|
558
|
-
const existing = transitions.find((t) => t.event === event);
|
|
570
|
+
const existing = getState().transitions.find((t) => t.event === event);
|
|
559
571
|
if (existing) {
|
|
560
572
|
resolve(existing);
|
|
561
573
|
return;
|
|
@@ -565,7 +577,7 @@ function waitForTransition(event, timeoutMs = 1e4) {
|
|
|
565
577
|
resolve(null);
|
|
566
578
|
}, timeoutMs);
|
|
567
579
|
const unsub = subscribeToVerification(() => {
|
|
568
|
-
const found = transitions.find((t) => t.event === event);
|
|
580
|
+
const found = getState().transitions.find((t) => t.event === event);
|
|
569
581
|
if (found) {
|
|
570
582
|
clearTimeout(timeout);
|
|
571
583
|
unsub();
|
|
@@ -625,9 +637,9 @@ function updateAssetStatus(url, status) {
|
|
|
625
637
|
}
|
|
626
638
|
}
|
|
627
639
|
function clearVerification() {
|
|
628
|
-
checks.clear();
|
|
629
|
-
transitions.length = 0;
|
|
630
|
-
bridgeHealth = null;
|
|
640
|
+
getState().checks.clear();
|
|
641
|
+
getState().transitions.length = 0;
|
|
642
|
+
getState().bridgeHealth = null;
|
|
631
643
|
notifyListeners5();
|
|
632
644
|
}
|
|
633
645
|
exposeOnWindow();
|
|
@@ -810,9 +822,9 @@ function getEffectSummary(effects) {
|
|
|
810
822
|
});
|
|
811
823
|
return summaries.join(" | ");
|
|
812
824
|
}
|
|
813
|
-
function extractOutputsFromTransitions(
|
|
825
|
+
function extractOutputsFromTransitions(transitions) {
|
|
814
826
|
const outputs = /* @__PURE__ */ new Set();
|
|
815
|
-
|
|
827
|
+
transitions.forEach((t) => {
|
|
816
828
|
if (t.effects) {
|
|
817
829
|
t.effects.forEach((effect) => {
|
|
818
830
|
if (Array.isArray(effect)) {
|
|
@@ -837,7 +849,7 @@ function getNodeRadius(stateName, config) {
|
|
|
837
849
|
if (textLength > 6) return baseRadius + 8;
|
|
838
850
|
return baseRadius;
|
|
839
851
|
}
|
|
840
|
-
function calculateLayout(states,
|
|
852
|
+
function calculateLayout(states, transitions, options, config) {
|
|
841
853
|
const positions = {};
|
|
842
854
|
const entityBoxWidth = options.hasEntity ? 200 : 0;
|
|
843
855
|
const outputBoxWidth = options.hasOutputs ? 200 : 0;
|
|
@@ -846,7 +858,7 @@ function calculateLayout(states, transitions2, options, config) {
|
|
|
846
858
|
states.filter((s) => s.isFinal);
|
|
847
859
|
states.filter((s) => !s.isInitial && !s.isFinal);
|
|
848
860
|
let maxLabelLength = 0;
|
|
849
|
-
|
|
861
|
+
transitions.forEach((t) => {
|
|
850
862
|
if (t.effects && t.effects.length > 0) {
|
|
851
863
|
const summary = getEffectSummary(t.effects);
|
|
852
864
|
maxLabelLength = Math.max(maxLabelLength, summary.length);
|
|
@@ -872,7 +884,7 @@ function calculateLayout(states, transitions2, options, config) {
|
|
|
872
884
|
if (stateColumn[name] === void 0) {
|
|
873
885
|
stateColumn[name] = col;
|
|
874
886
|
}
|
|
875
|
-
|
|
887
|
+
transitions.forEach((t) => {
|
|
876
888
|
if (t.from === name && t.from !== t.to && !visited.has(t.to)) {
|
|
877
889
|
queue.push({ name: t.to, col: col + 1 });
|
|
878
890
|
}
|
|
@@ -952,11 +964,11 @@ function drawStateSvg(name, x, y, state, config) {
|
|
|
952
964
|
svg += `</g>`;
|
|
953
965
|
return svg;
|
|
954
966
|
}
|
|
955
|
-
function drawTransitionPathSvg(from, to,
|
|
967
|
+
function drawTransitionPathSvg(from, to, transitions, positions, config) {
|
|
956
968
|
const fromPos = positions[from];
|
|
957
969
|
const toPos = positions[to];
|
|
958
970
|
if (!fromPos || !toPos) return "";
|
|
959
|
-
const relevantTransitions =
|
|
971
|
+
const relevantTransitions = transitions.filter((t) => t.from === from && t.to === to);
|
|
960
972
|
if (relevantTransitions.length === 0) return "";
|
|
961
973
|
const fromRadius = getNodeRadius(from, config);
|
|
962
974
|
const toRadius = getNodeRadius(to, config);
|
|
@@ -970,7 +982,7 @@ function drawTransitionPathSvg(from, to, transitions2, positions, config) {
|
|
|
970
982
|
const startY = fromPos.y + ny * fromRadius;
|
|
971
983
|
const endX = toPos.x - nx * (toRadius + 5);
|
|
972
984
|
const endY = toPos.y - ny * (toRadius + 5);
|
|
973
|
-
const hasReverse =
|
|
985
|
+
const hasReverse = transitions.some((t) => t.from === to && t.to === from);
|
|
974
986
|
const isReverse = hasReverse && from > to;
|
|
975
987
|
const baseOffset = hasReverse ? 50 : 30;
|
|
976
988
|
const curveOffset = baseOffset + (relevantTransitions.length > 1 ? 20 : 0);
|
|
@@ -979,11 +991,11 @@ function drawTransitionPathSvg(from, to, transitions2, positions, config) {
|
|
|
979
991
|
const midY = (startY + endY) / 2 + curveOffset * curveDirection;
|
|
980
992
|
return `<path class="transition-path" data-from="${from}" data-to="${to}" d="M ${startX} ${startY} Q ${midX} ${midY} ${endX} ${endY}" stroke="${config.colors.arrow}" stroke-width="1.5" fill="none" marker-end="url(#arrow)"/>`;
|
|
981
993
|
}
|
|
982
|
-
function drawTransitionLabelsSvg(from, to,
|
|
994
|
+
function drawTransitionLabelsSvg(from, to, transitions, positions, config) {
|
|
983
995
|
const fromPos = positions[from];
|
|
984
996
|
const toPos = positions[to];
|
|
985
997
|
if (!fromPos || !toPos) return "";
|
|
986
|
-
const relevantTransitions =
|
|
998
|
+
const relevantTransitions = transitions.filter((t) => t.from === from && t.to === to);
|
|
987
999
|
if (relevantTransitions.length === 0) return "";
|
|
988
1000
|
const fromRadius = getNodeRadius(from, config);
|
|
989
1001
|
const toRadius = getNodeRadius(to, config);
|
|
@@ -997,7 +1009,7 @@ function drawTransitionLabelsSvg(from, to, transitions2, positions, config) {
|
|
|
997
1009
|
const startY = fromPos.y + ny * fromRadius;
|
|
998
1010
|
const endX = toPos.x - nx * (toRadius + 5);
|
|
999
1011
|
const endY = toPos.y - ny * (toRadius + 5);
|
|
1000
|
-
const hasReverse =
|
|
1012
|
+
const hasReverse = transitions.some((t) => t.from === to && t.to === from);
|
|
1001
1013
|
const isReverse = hasReverse && from > to;
|
|
1002
1014
|
const baseOffset = hasReverse ? 50 : 40;
|
|
1003
1015
|
const curveOffset = baseOffset + (relevantTransitions.length > 1 ? 25 : 0);
|
|
@@ -1102,15 +1114,15 @@ function drawLegendSvg(y, config) {
|
|
|
1102
1114
|
}
|
|
1103
1115
|
function renderStateMachineToSvg(stateMachine, options = {}, config = DEFAULT_CONFIG) {
|
|
1104
1116
|
const states = stateMachine.states || [];
|
|
1105
|
-
const
|
|
1117
|
+
const transitions = stateMachine.transitions || [];
|
|
1106
1118
|
const title = options.title || "";
|
|
1107
1119
|
const entity = options.entity;
|
|
1108
|
-
const outputs = extractOutputsFromTransitions(
|
|
1120
|
+
const outputs = extractOutputsFromTransitions(transitions);
|
|
1109
1121
|
const layoutOptions = {
|
|
1110
1122
|
hasEntity: !!entity,
|
|
1111
1123
|
hasOutputs: outputs.length > 0
|
|
1112
1124
|
};
|
|
1113
|
-
const { positions, width, height } = calculateLayout(states,
|
|
1125
|
+
const { positions, width, height } = calculateLayout(states, transitions, layoutOptions, config);
|
|
1114
1126
|
let svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height + 40}" viewBox="0 0 ${width} ${height + 40}" class="orbital-state-machine" style="display: block; max-width: none;">`;
|
|
1115
1127
|
svg += `<defs>`;
|
|
1116
1128
|
svg += createArrowMarkerSvg("arrow", config.colors.arrow, config);
|
|
@@ -1128,22 +1140,22 @@ function renderStateMachineToSvg(stateMachine, options = {}, config = DEFAULT_CO
|
|
|
1128
1140
|
svg += drawEntityInputSvg(entity, 20, height / 2);
|
|
1129
1141
|
}
|
|
1130
1142
|
const drawnPairs = /* @__PURE__ */ new Set();
|
|
1131
|
-
|
|
1143
|
+
transitions.forEach((transition) => {
|
|
1132
1144
|
const pairKey = `${transition.from}->${transition.to}`;
|
|
1133
1145
|
if (!drawnPairs.has(pairKey)) {
|
|
1134
1146
|
drawnPairs.add(pairKey);
|
|
1135
|
-
svg += drawTransitionPathSvg(transition.from, transition.to,
|
|
1147
|
+
svg += drawTransitionPathSvg(transition.from, transition.to, transitions, positions, config);
|
|
1136
1148
|
}
|
|
1137
1149
|
});
|
|
1138
1150
|
for (const [name, pos] of Object.entries(positions)) {
|
|
1139
1151
|
svg += drawStateSvg(name, pos.x, pos.y, pos.state, config);
|
|
1140
1152
|
}
|
|
1141
1153
|
drawnPairs.clear();
|
|
1142
|
-
|
|
1154
|
+
transitions.forEach((transition) => {
|
|
1143
1155
|
const pairKey = `${transition.from}->${transition.to}`;
|
|
1144
1156
|
if (!drawnPairs.has(pairKey)) {
|
|
1145
1157
|
drawnPairs.add(pairKey);
|
|
1146
|
-
svg += drawTransitionLabelsSvg(transition.from, transition.to,
|
|
1158
|
+
svg += drawTransitionLabelsSvg(transition.from, transition.to, transitions, positions, config);
|
|
1147
1159
|
}
|
|
1148
1160
|
});
|
|
1149
1161
|
if (outputs.length > 0) {
|
|
@@ -1174,11 +1186,11 @@ function extractStateMachine(data) {
|
|
|
1174
1186
|
}
|
|
1175
1187
|
return null;
|
|
1176
1188
|
}
|
|
1177
|
-
function calculateTransitionPathData(from, to,
|
|
1189
|
+
function calculateTransitionPathData(from, to, transitions, positions, config) {
|
|
1178
1190
|
const fromPos = positions[from];
|
|
1179
1191
|
const toPos = positions[to];
|
|
1180
1192
|
if (!fromPos || !toPos) return null;
|
|
1181
|
-
const relevantTransitions =
|
|
1193
|
+
const relevantTransitions = transitions.filter((t) => t.from === from && t.to === to);
|
|
1182
1194
|
if (relevantTransitions.length === 0) return null;
|
|
1183
1195
|
const fromRadius = getNodeRadius(from, config);
|
|
1184
1196
|
const toRadius = getNodeRadius(to, config);
|
|
@@ -1209,7 +1221,7 @@ function calculateTransitionPathData(from, to, transitions2, positions, config)
|
|
|
1209
1221
|
const startY = fromPos.y + ny * fromRadius;
|
|
1210
1222
|
const endX = toPos.x - nx * (toRadius + 5);
|
|
1211
1223
|
const endY = toPos.y - ny * (toRadius + 5);
|
|
1212
|
-
const hasReverse =
|
|
1224
|
+
const hasReverse = transitions.some((t) => t.from === to && t.to === from);
|
|
1213
1225
|
const isReverse = hasReverse && from > to;
|
|
1214
1226
|
const baseOffset = hasReverse ? 50 : 30;
|
|
1215
1227
|
const curveOffset = baseOffset + (relevantTransitions.length > 1 ? 20 : 0);
|
|
@@ -1224,15 +1236,15 @@ function calculateTransitionPathData(from, to, transitions2, positions, config)
|
|
|
1224
1236
|
}
|
|
1225
1237
|
function renderStateMachineToDomData(stateMachine, options = {}, config = DEFAULT_CONFIG) {
|
|
1226
1238
|
const states = stateMachine.states || [];
|
|
1227
|
-
const
|
|
1239
|
+
const transitions = stateMachine.transitions || [];
|
|
1228
1240
|
const title = options.title || "";
|
|
1229
1241
|
const entity = options.entity;
|
|
1230
|
-
const outputs = extractOutputsFromTransitions(
|
|
1242
|
+
const outputs = extractOutputsFromTransitions(transitions);
|
|
1231
1243
|
const layoutOptions = {
|
|
1232
1244
|
hasEntity: !!entity,
|
|
1233
1245
|
hasOutputs: outputs.length > 0
|
|
1234
1246
|
};
|
|
1235
|
-
const { positions, width, height } = calculateLayout(states,
|
|
1247
|
+
const { positions, width, height } = calculateLayout(states, transitions, layoutOptions, config);
|
|
1236
1248
|
const domStates = Object.entries(positions).map(([name, pos]) => ({
|
|
1237
1249
|
id: `state-${name}`,
|
|
1238
1250
|
name,
|
|
@@ -1246,14 +1258,14 @@ function renderStateMachineToDomData(stateMachine, options = {}, config = DEFAUL
|
|
|
1246
1258
|
const domPaths = [];
|
|
1247
1259
|
const domLabels = [];
|
|
1248
1260
|
const drawnPairs = /* @__PURE__ */ new Set();
|
|
1249
|
-
|
|
1261
|
+
transitions.forEach((transition, idx) => {
|
|
1250
1262
|
const pairKey = `${transition.from}->${transition.to}`;
|
|
1251
1263
|
if (!drawnPairs.has(pairKey)) {
|
|
1252
1264
|
drawnPairs.add(pairKey);
|
|
1253
1265
|
const pathData2 = calculateTransitionPathData(
|
|
1254
1266
|
transition.from,
|
|
1255
1267
|
transition.to,
|
|
1256
|
-
|
|
1268
|
+
transitions,
|
|
1257
1269
|
positions,
|
|
1258
1270
|
config
|
|
1259
1271
|
);
|
|
@@ -1274,7 +1286,7 @@ function renderStateMachineToDomData(stateMachine, options = {}, config = DEFAUL
|
|
|
1274
1286
|
const pathData = calculateTransitionPathData(
|
|
1275
1287
|
transition.from,
|
|
1276
1288
|
transition.to,
|
|
1277
|
-
|
|
1289
|
+
transitions,
|
|
1278
1290
|
positions,
|
|
1279
1291
|
config
|
|
1280
1292
|
);
|