@almadar/ui 6.12.0 → 6.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.
- package/dist/{UserContext-g_LcDiGN.d.cts → CurrentPagePathContext-J1lqjvAq.d.cts} +2 -97
- package/dist/{UserContext-g_LcDiGN.d.ts → CurrentPagePathContext-J1lqjvAq.d.ts} +2 -97
- package/dist/{EntityBindingContext-D5lRu6p1.d.cts → EntityBindingContext-BMz9xiBa.d.cts} +2 -3
- package/dist/{EntityBindingContext-D5lRu6p1.d.ts → EntityBindingContext-BMz9xiBa.d.ts} +2 -3
- package/dist/{GameAudioProvider-D8GynTNq.d.cts → GameAudioProvider-Cpw_lMPY.d.cts} +1 -1
- package/dist/{GameAudioProvider-Dozqx4sL.d.ts → GameAudioProvider-DIjFiy70.d.ts} +1 -1
- package/dist/UserContext-D566nfWA.d.cts +99 -0
- package/dist/UserContext-D566nfWA.d.ts +99 -0
- package/dist/avl/index.cjs +571 -70
- package/dist/avl/index.d.cts +1 -1
- package/dist/avl/index.d.ts +1 -1
- package/dist/avl/index.js +573 -72
- package/dist/{avl-schema-parser-PVu8rgsy.d.cts → avl-schema-parser-B25PL-a8.d.cts} +1 -1
- package/dist/{avl-schema-parser-DX-aVCCm.d.ts → avl-schema-parser-CM0pQo8E.d.ts} +1 -1
- package/dist/components/index.cjs +564 -117
- package/dist/components/index.d.cts +8 -24
- package/dist/components/index.d.ts +8 -24
- package/dist/components/index.js +566 -118
- package/dist/context/index.d.cts +2 -1
- package/dist/context/index.d.ts +2 -1
- package/dist/lib/drawable/three/index.cjs +126 -3
- package/dist/lib/drawable/three/index.d.cts +3 -3
- package/dist/lib/drawable/three/index.d.ts +3 -3
- package/dist/lib/drawable/three/index.js +126 -3
- package/dist/lib/index.cjs +1 -4
- package/dist/lib/index.d.cts +2 -2
- package/dist/lib/index.d.ts +2 -2
- package/dist/lib/index.js +1 -4
- package/dist/{offline-executor-QUdKOj7f.d.cts → offline-executor-DdV2o0Zu.d.cts} +4 -19
- package/dist/{offline-executor-QUdKOj7f.d.ts → offline-executor-DdV2o0Zu.d.ts} +4 -19
- package/dist/{paintDispatch-CK5uwYEq.d.cts → paintDispatch-Dh1pgljl.d.cts} +79 -1
- package/dist/{paintDispatch-CK5uwYEq.d.ts → paintDispatch-Dh1pgljl.d.ts} +79 -1
- package/dist/providers/index.cjs +558 -62
- package/dist/providers/index.d.cts +10 -9
- package/dist/providers/index.d.ts +10 -9
- package/dist/providers/index.js +559 -63
- package/dist/renderer/index.cjs +0 -15
- package/dist/renderer/index.d.cts +4 -9
- package/dist/renderer/index.d.ts +4 -9
- package/dist/renderer/index.js +1 -15
- package/dist/runtime/index.cjs +573 -81
- package/dist/runtime/index.d.cts +14 -11
- package/dist/runtime/index.d.ts +14 -11
- package/dist/runtime/index.js +575 -83
- package/dist/{verificationRegistry-D8bHWD8Q.d.ts → verificationRegistry-Cwa52VyK.d.ts} +1 -1
- package/dist/{verificationRegistry-BLsjb1oU.d.cts → verificationRegistry-DTrKDRoa.d.cts} +1 -1
- package/package.json +4 -4
package/dist/context/index.d.cts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { U as UISlotContext, a as UISlotProvider, u as useSlotContent, b as useSlotHasContent, c as useUISlots } from '../UISlotContext-BlRDbHDy.cjs';
|
|
2
|
-
export { B as BUILT_IN_THEMES, C as ColorMode, a as CurrentPagePathContext, b as CurrentPagePathProvider, c as CurrentPagePathProviderProps, D as DesignTheme, d as DesignThemeProvider, O as OrbitalThemeProvider, e as OrbitalThemeProviderProps, R as ResolvedMode, T as ThemeContext, f as ThemeProvider, g as ThemeProviderProps, U as UIThemeDefinition,
|
|
2
|
+
export { B as BUILT_IN_THEMES, C as ColorMode, a as CurrentPagePathContext, b as CurrentPagePathProvider, c as CurrentPagePathProviderProps, D as DesignTheme, d as DesignThemeProvider, O as OrbitalThemeProvider, e as OrbitalThemeProviderProps, R as ResolvedMode, T as ThemeContext, f as ThemeProvider, g as ThemeProviderProps, U as UIThemeDefinition, u as useCurrentPagePath, h as useDesignTheme, i as useTheme } from '../CurrentPagePathContext-J1lqjvAq.cjs';
|
|
3
3
|
import { ThemeRef, ThemeDefinition, ThemeTokens, ThemeVariant } from '@almadar/core';
|
|
4
4
|
export { ANONYMOUS_USER, UISlot } from '@almadar/core';
|
|
5
|
+
export { U as UserContext, a as UserContextValue, b as UserData, c as UserProvider, d as UserProviderProps, u as useHasPermission, e as useHasRole, f as useUser, g as useUserForEvaluation } from '../UserContext-D566nfWA.cjs';
|
|
5
6
|
export { S as SlotAnimation, a as SlotChangeCallback, b as SlotContent, c as SlotRenderConfig, U as UISlotManager } from '../useUISlots-GNwGLlW2.cjs';
|
|
6
7
|
import 'react';
|
|
7
8
|
|
package/dist/context/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { U as UISlotContext, a as UISlotProvider, u as useSlotContent, b as useSlotHasContent, c as useUISlots } from '../UISlotContext-CB89mv7N.js';
|
|
2
|
-
export { B as BUILT_IN_THEMES, C as ColorMode, a as CurrentPagePathContext, b as CurrentPagePathProvider, c as CurrentPagePathProviderProps, D as DesignTheme, d as DesignThemeProvider, O as OrbitalThemeProvider, e as OrbitalThemeProviderProps, R as ResolvedMode, T as ThemeContext, f as ThemeProvider, g as ThemeProviderProps, U as UIThemeDefinition,
|
|
2
|
+
export { B as BUILT_IN_THEMES, C as ColorMode, a as CurrentPagePathContext, b as CurrentPagePathProvider, c as CurrentPagePathProviderProps, D as DesignTheme, d as DesignThemeProvider, O as OrbitalThemeProvider, e as OrbitalThemeProviderProps, R as ResolvedMode, T as ThemeContext, f as ThemeProvider, g as ThemeProviderProps, U as UIThemeDefinition, u as useCurrentPagePath, h as useDesignTheme, i as useTheme } from '../CurrentPagePathContext-J1lqjvAq.js';
|
|
3
3
|
import { ThemeRef, ThemeDefinition, ThemeTokens, ThemeVariant } from '@almadar/core';
|
|
4
4
|
export { ANONYMOUS_USER, UISlot } from '@almadar/core';
|
|
5
|
+
export { U as UserContext, a as UserContextValue, b as UserData, c as UserProvider, d as UserProviderProps, u as useHasPermission, e as useHasRole, f as useUser, g as useUserForEvaluation } from '../UserContext-D566nfWA.js';
|
|
5
6
|
export { S as SlotAnimation, a as SlotChangeCallback, b as SlotContent, c as SlotRenderConfig, U as UISlotManager } from '../useUISlots-GNwGLlW2.js';
|
|
6
7
|
import 'react';
|
|
7
8
|
|
|
@@ -179,11 +179,130 @@ function isValidScenePos(pos) {
|
|
|
179
179
|
return Number.isFinite(pos?.x) && Number.isFinite(pos?.y);
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
+
// lib/skinning.ts
|
|
183
|
+
var IDENTITY = [1, 0, 0, 1, 0, 0];
|
|
184
|
+
function composeAffine(a, b) {
|
|
185
|
+
return [
|
|
186
|
+
a[0] * b[0] + a[2] * b[1],
|
|
187
|
+
a[1] * b[0] + a[3] * b[1],
|
|
188
|
+
a[0] * b[2] + a[2] * b[3],
|
|
189
|
+
a[1] * b[2] + a[3] * b[3],
|
|
190
|
+
a[0] * b[4] + a[2] * b[5] + a[4],
|
|
191
|
+
a[1] * b[4] + a[3] * b[5] + a[5]
|
|
192
|
+
];
|
|
193
|
+
}
|
|
194
|
+
function invertAffine(m) {
|
|
195
|
+
const det = m[0] * m[3] - m[1] * m[2];
|
|
196
|
+
if (!Number.isFinite(det) || Math.abs(det) < 1e-12) return IDENTITY;
|
|
197
|
+
const inv = 1 / det;
|
|
198
|
+
return [
|
|
199
|
+
m[3] * inv,
|
|
200
|
+
-m[1] * inv,
|
|
201
|
+
-m[2] * inv,
|
|
202
|
+
m[0] * inv,
|
|
203
|
+
(m[2] * m[5] - m[3] * m[4]) * inv,
|
|
204
|
+
(m[1] * m[4] - m[0] * m[5]) * inv
|
|
205
|
+
];
|
|
206
|
+
}
|
|
207
|
+
function applyAffine(m, x, y) {
|
|
208
|
+
return [m[0] * x + m[2] * y + m[4], m[1] * x + m[3] * y + m[5]];
|
|
209
|
+
}
|
|
210
|
+
function rotationAbout(pivot, degrees) {
|
|
211
|
+
const r = degrees * Math.PI / 180;
|
|
212
|
+
const cos = Math.cos(r);
|
|
213
|
+
const sin = Math.sin(r);
|
|
214
|
+
const [px, py] = pivot;
|
|
215
|
+
return [cos, sin, -sin, cos, px - cos * px + sin * py, py - sin * px - cos * py];
|
|
216
|
+
}
|
|
217
|
+
function computeWorldMatrices(bones, pose) {
|
|
218
|
+
const indexByName = /* @__PURE__ */ new Map();
|
|
219
|
+
bones.forEach((b, i) => indexByName.set(b.name, i));
|
|
220
|
+
const world = new Array(bones.length);
|
|
221
|
+
const visiting = /* @__PURE__ */ new Set();
|
|
222
|
+
const resolve = (i) => {
|
|
223
|
+
const cached = world[i];
|
|
224
|
+
if (cached) return cached;
|
|
225
|
+
if (visiting.has(i)) return IDENTITY;
|
|
226
|
+
visiting.add(i);
|
|
227
|
+
const b = bones[i];
|
|
228
|
+
const parentIndex = b.parent === null ? void 0 : indexByName.get(b.parent);
|
|
229
|
+
const parentWorld = parentIndex === void 0 ? IDENTITY : resolve(parentIndex);
|
|
230
|
+
const local = rotationAbout(b.pivot, pose[b.name] ?? 0);
|
|
231
|
+
const m = composeAffine(parentWorld, local);
|
|
232
|
+
visiting.delete(i);
|
|
233
|
+
world[i] = m;
|
|
234
|
+
return m;
|
|
235
|
+
};
|
|
236
|
+
return bones.map((_, i) => resolve(i));
|
|
237
|
+
}
|
|
238
|
+
function skinVertices(mesh, bindWorld, curWorld) {
|
|
239
|
+
const skinMats = /* @__PURE__ */ new Map();
|
|
240
|
+
const skinMat = (bone) => {
|
|
241
|
+
let m = skinMats.get(bone);
|
|
242
|
+
if (!m) {
|
|
243
|
+
m = composeAffine(curWorld[bone] ?? IDENTITY, invertAffine(bindWorld[bone] ?? IDENTITY));
|
|
244
|
+
skinMats.set(bone, m);
|
|
245
|
+
}
|
|
246
|
+
return m;
|
|
247
|
+
};
|
|
248
|
+
return mesh.vertices.map((v) => {
|
|
249
|
+
if (v.weights.length === 0) return [v.x, v.y];
|
|
250
|
+
let x = 0;
|
|
251
|
+
let y = 0;
|
|
252
|
+
for (const { bone, w } of v.weights) {
|
|
253
|
+
const [bx, by] = applyAffine(skinMat(bone), v.x, v.y);
|
|
254
|
+
x += w * bx;
|
|
255
|
+
y += w * by;
|
|
256
|
+
}
|
|
257
|
+
return [x, y];
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
function vertexBounds(points) {
|
|
261
|
+
if (points.length === 0) return null;
|
|
262
|
+
let minX = Infinity;
|
|
263
|
+
let minY = Infinity;
|
|
264
|
+
let maxX = -Infinity;
|
|
265
|
+
let maxY = -Infinity;
|
|
266
|
+
for (const [x, y] of points) {
|
|
267
|
+
if (x < minX) minX = x;
|
|
268
|
+
if (y < minY) minY = y;
|
|
269
|
+
if (x > maxX) maxX = x;
|
|
270
|
+
if (y > maxY) maxY = y;
|
|
271
|
+
}
|
|
272
|
+
return { minX, minY, maxX, maxY };
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// components/game/atoms/DrawSkinnedMesh.tsx
|
|
276
|
+
logger.createLogger("almadar:ui:draw-skinned-mesh");
|
|
277
|
+
Array.from({ length: 10 }, (_, i) => `hsl(${i * 36 % 360}, 70%, 55%)`);
|
|
278
|
+
function resolveSkinPose(node, clip) {
|
|
279
|
+
const effectiveClip = node.clip;
|
|
280
|
+
if (effectiveClip && node.frame !== void 0 && effectiveClip.frames.length > 0) {
|
|
281
|
+
return effectiveClip.frames[node.frame % effectiveClip.frames.length];
|
|
282
|
+
}
|
|
283
|
+
return node.pose ?? {};
|
|
284
|
+
}
|
|
285
|
+
|
|
182
286
|
// lib/drawable/hitTest.ts
|
|
183
287
|
function shapeDrawnItem(n) {
|
|
184
288
|
if (n.shape !== "rect") return { pos: n.position, id: n.id };
|
|
185
289
|
return { pos: n.position, id: n.id, anchor: n.anchor, width: n.width, height: n.height, rotation: n.rotate };
|
|
186
290
|
}
|
|
291
|
+
function skinnedMeshDrawnItem(n) {
|
|
292
|
+
const mesh = n.mesh;
|
|
293
|
+
if (!mesh || n.bones.length === 0) return { pos: n.position, id: n.id };
|
|
294
|
+
const bindWorld = computeWorldMatrices(n.bones, {});
|
|
295
|
+
const curWorld = computeWorldMatrices(n.bones, resolveSkinPose(n));
|
|
296
|
+
const bounds = vertexBounds(skinVertices(mesh, bindWorld, curWorld));
|
|
297
|
+
if (!bounds) return { pos: n.position, id: n.id };
|
|
298
|
+
return {
|
|
299
|
+
pos: { ...n.position, x: n.position.x + bounds.minX, y: n.position.y + bounds.minY },
|
|
300
|
+
id: n.id,
|
|
301
|
+
anchor: "top-left",
|
|
302
|
+
width: bounds.maxX - bounds.minX,
|
|
303
|
+
height: bounds.maxY - bounds.minY
|
|
304
|
+
};
|
|
305
|
+
}
|
|
187
306
|
function collectDrawnItems(nodes) {
|
|
188
307
|
const out = [];
|
|
189
308
|
for (const n of nodes) {
|
|
@@ -194,6 +313,9 @@ function collectDrawnItems(nodes) {
|
|
|
194
313
|
case "draw-shape":
|
|
195
314
|
if (isValidScenePos(n.position)) out.push(shapeDrawnItem(n));
|
|
196
315
|
break;
|
|
316
|
+
case "draw-skinned-mesh":
|
|
317
|
+
if (isValidScenePos(n.position)) out.push(skinnedMeshDrawnItem(n));
|
|
318
|
+
break;
|
|
197
319
|
case "draw-text":
|
|
198
320
|
case "draw-group":
|
|
199
321
|
case "draw-mesh":
|
|
@@ -1806,6 +1928,9 @@ function Drawable3D({ node, projector, groupOpacity = 1 }) {
|
|
|
1806
1928
|
}
|
|
1807
1929
|
case "draw-fx-layer":
|
|
1808
1930
|
return /* @__PURE__ */ jsxRuntime.jsx(FxLayer3D, { node, projector, groupOpacity });
|
|
1931
|
+
case "draw-skinned-mesh":
|
|
1932
|
+
warnUnsupported3d("draw-skinned-mesh");
|
|
1933
|
+
return null;
|
|
1809
1934
|
}
|
|
1810
1935
|
})();
|
|
1811
1936
|
return node.id ? /* @__PURE__ */ jsxRuntime.jsx("group", { userData: { drawableId: node.id }, children: rendered }) : rendered;
|
|
@@ -5598,8 +5723,6 @@ function effectTypeColor(type) {
|
|
|
5598
5723
|
return "#a78bda";
|
|
5599
5724
|
case "navigate":
|
|
5600
5725
|
return "#40c8aa";
|
|
5601
|
-
case "notify":
|
|
5602
|
-
return "#f0c040";
|
|
5603
5726
|
case "call-service":
|
|
5604
5727
|
return "#a78bda";
|
|
5605
5728
|
case "spawn":
|
|
@@ -5739,7 +5862,7 @@ var Avl3DTransitionArc = ({
|
|
|
5739
5862
|
if (!pt) return null;
|
|
5740
5863
|
const eColor = effectTypeColor(effectType);
|
|
5741
5864
|
return /* @__PURE__ */ jsxRuntime.jsx("group", { position: pt, children: /* @__PURE__ */ jsxRuntime.jsxs("mesh", { scale: 0.06, children: [
|
|
5742
|
-
effectType === "render-ui" ? /* @__PURE__ */ jsxRuntime.jsx("boxGeometry", { args: [1.5, 1.5, 0.3] }) : effectType === "persist" ? /* @__PURE__ */ jsxRuntime.jsx("cylinderGeometry", { args: [0.6, 0.6, 1.5, 8] }) : effectType === "emit" ? /* @__PURE__ */ jsxRuntime.jsx("sphereGeometry", { args: [1, 8, 8] }) : effectType === "navigate" ? /* @__PURE__ */ jsxRuntime.jsx("coneGeometry", { args: [0.8, 1.5, 6] }) : effectType === "set" ? /* @__PURE__ */ jsxRuntime.jsx("tetrahedronGeometry", { args: [1, 0] }) : effectType === "
|
|
5865
|
+
effectType === "render-ui" ? /* @__PURE__ */ jsxRuntime.jsx("boxGeometry", { args: [1.5, 1.5, 0.3] }) : effectType === "persist" ? /* @__PURE__ */ jsxRuntime.jsx("cylinderGeometry", { args: [0.6, 0.6, 1.5, 8] }) : effectType === "emit" ? /* @__PURE__ */ jsxRuntime.jsx("sphereGeometry", { args: [1, 8, 8] }) : effectType === "navigate" ? /* @__PURE__ */ jsxRuntime.jsx("coneGeometry", { args: [0.8, 1.5, 6] }) : effectType === "set" ? /* @__PURE__ */ jsxRuntime.jsx("tetrahedronGeometry", { args: [1, 0] }) : effectType === "call-service" ? /* @__PURE__ */ jsxRuntime.jsx("torusGeometry", { args: [0.8, 0.3, 6, 12] }) : /* @__PURE__ */ jsxRuntime.jsx("octahedronGeometry", { args: [0.8, 0] }),
|
|
5743
5866
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5744
5867
|
"meshStandardMaterial",
|
|
5745
5868
|
{
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { C as CanvasPointLightConfig, I as IsometricTile, a as IsometricUnit, b as IsometricFeature, A as ApplicationLevelData, O as OrbitalLevelData, T as TraitLevelData, c as TransitionLevelData } from '../../../avl-schema-parser-
|
|
2
|
-
export { d as Canvas3DHost, e as Canvas3DHostHandle, f as Canvas3DHostProps, d as GameCanvas3D, U as UnitAnimationState } from '../../../avl-schema-parser-
|
|
1
|
+
import { C as CanvasPointLightConfig, I as IsometricTile, a as IsometricUnit, b as IsometricFeature, A as ApplicationLevelData, O as OrbitalLevelData, T as TraitLevelData, c as TransitionLevelData } from '../../../avl-schema-parser-B25PL-a8.cjs';
|
|
2
|
+
export { d as Canvas3DHost, e as Canvas3DHostHandle, f as Canvas3DHostProps, d as GameCanvas3D, U as UnitAnimationState } from '../../../avl-schema-parser-B25PL-a8.cjs';
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
4
|
import React__default, { Component, ReactNode, ErrorInfo } from 'react';
|
|
5
5
|
import * as THREE from 'three';
|
|
6
6
|
import { QuadraticBezierCurve3 } from 'three';
|
|
7
7
|
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';
|
|
8
8
|
import { JsonObject, EventEmit, OrbitalSchema } from '@almadar/core';
|
|
9
|
-
import '../../../paintDispatch-
|
|
9
|
+
import '../../../paintDispatch-Dh1pgljl.cjs';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Scene3D
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { C as CanvasPointLightConfig, I as IsometricTile, a as IsometricUnit, b as IsometricFeature, A as ApplicationLevelData, O as OrbitalLevelData, T as TraitLevelData, c as TransitionLevelData } from '../../../avl-schema-parser-
|
|
2
|
-
export { d as Canvas3DHost, e as Canvas3DHostHandle, f as Canvas3DHostProps, d as GameCanvas3D, U as UnitAnimationState } from '../../../avl-schema-parser-
|
|
1
|
+
import { C as CanvasPointLightConfig, I as IsometricTile, a as IsometricUnit, b as IsometricFeature, A as ApplicationLevelData, O as OrbitalLevelData, T as TraitLevelData, c as TransitionLevelData } from '../../../avl-schema-parser-CM0pQo8E.js';
|
|
2
|
+
export { d as Canvas3DHost, e as Canvas3DHostHandle, f as Canvas3DHostProps, d as GameCanvas3D, U as UnitAnimationState } from '../../../avl-schema-parser-CM0pQo8E.js';
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
4
|
import React__default, { Component, ReactNode, ErrorInfo } from 'react';
|
|
5
5
|
import * as THREE from 'three';
|
|
6
6
|
import { QuadraticBezierCurve3 } from 'three';
|
|
7
7
|
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';
|
|
8
8
|
import { JsonObject, EventEmit, OrbitalSchema } from '@almadar/core';
|
|
9
|
-
import '../../../paintDispatch-
|
|
9
|
+
import '../../../paintDispatch-Dh1pgljl.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Scene3D
|
|
@@ -155,11 +155,130 @@ function isValidScenePos(pos) {
|
|
|
155
155
|
return Number.isFinite(pos?.x) && Number.isFinite(pos?.y);
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
// lib/skinning.ts
|
|
159
|
+
var IDENTITY = [1, 0, 0, 1, 0, 0];
|
|
160
|
+
function composeAffine(a, b) {
|
|
161
|
+
return [
|
|
162
|
+
a[0] * b[0] + a[2] * b[1],
|
|
163
|
+
a[1] * b[0] + a[3] * b[1],
|
|
164
|
+
a[0] * b[2] + a[2] * b[3],
|
|
165
|
+
a[1] * b[2] + a[3] * b[3],
|
|
166
|
+
a[0] * b[4] + a[2] * b[5] + a[4],
|
|
167
|
+
a[1] * b[4] + a[3] * b[5] + a[5]
|
|
168
|
+
];
|
|
169
|
+
}
|
|
170
|
+
function invertAffine(m) {
|
|
171
|
+
const det = m[0] * m[3] - m[1] * m[2];
|
|
172
|
+
if (!Number.isFinite(det) || Math.abs(det) < 1e-12) return IDENTITY;
|
|
173
|
+
const inv = 1 / det;
|
|
174
|
+
return [
|
|
175
|
+
m[3] * inv,
|
|
176
|
+
-m[1] * inv,
|
|
177
|
+
-m[2] * inv,
|
|
178
|
+
m[0] * inv,
|
|
179
|
+
(m[2] * m[5] - m[3] * m[4]) * inv,
|
|
180
|
+
(m[1] * m[4] - m[0] * m[5]) * inv
|
|
181
|
+
];
|
|
182
|
+
}
|
|
183
|
+
function applyAffine(m, x, y) {
|
|
184
|
+
return [m[0] * x + m[2] * y + m[4], m[1] * x + m[3] * y + m[5]];
|
|
185
|
+
}
|
|
186
|
+
function rotationAbout(pivot, degrees) {
|
|
187
|
+
const r = degrees * Math.PI / 180;
|
|
188
|
+
const cos = Math.cos(r);
|
|
189
|
+
const sin = Math.sin(r);
|
|
190
|
+
const [px, py] = pivot;
|
|
191
|
+
return [cos, sin, -sin, cos, px - cos * px + sin * py, py - sin * px - cos * py];
|
|
192
|
+
}
|
|
193
|
+
function computeWorldMatrices(bones, pose) {
|
|
194
|
+
const indexByName = /* @__PURE__ */ new Map();
|
|
195
|
+
bones.forEach((b, i) => indexByName.set(b.name, i));
|
|
196
|
+
const world = new Array(bones.length);
|
|
197
|
+
const visiting = /* @__PURE__ */ new Set();
|
|
198
|
+
const resolve = (i) => {
|
|
199
|
+
const cached = world[i];
|
|
200
|
+
if (cached) return cached;
|
|
201
|
+
if (visiting.has(i)) return IDENTITY;
|
|
202
|
+
visiting.add(i);
|
|
203
|
+
const b = bones[i];
|
|
204
|
+
const parentIndex = b.parent === null ? void 0 : indexByName.get(b.parent);
|
|
205
|
+
const parentWorld = parentIndex === void 0 ? IDENTITY : resolve(parentIndex);
|
|
206
|
+
const local = rotationAbout(b.pivot, pose[b.name] ?? 0);
|
|
207
|
+
const m = composeAffine(parentWorld, local);
|
|
208
|
+
visiting.delete(i);
|
|
209
|
+
world[i] = m;
|
|
210
|
+
return m;
|
|
211
|
+
};
|
|
212
|
+
return bones.map((_, i) => resolve(i));
|
|
213
|
+
}
|
|
214
|
+
function skinVertices(mesh, bindWorld, curWorld) {
|
|
215
|
+
const skinMats = /* @__PURE__ */ new Map();
|
|
216
|
+
const skinMat = (bone) => {
|
|
217
|
+
let m = skinMats.get(bone);
|
|
218
|
+
if (!m) {
|
|
219
|
+
m = composeAffine(curWorld[bone] ?? IDENTITY, invertAffine(bindWorld[bone] ?? IDENTITY));
|
|
220
|
+
skinMats.set(bone, m);
|
|
221
|
+
}
|
|
222
|
+
return m;
|
|
223
|
+
};
|
|
224
|
+
return mesh.vertices.map((v) => {
|
|
225
|
+
if (v.weights.length === 0) return [v.x, v.y];
|
|
226
|
+
let x = 0;
|
|
227
|
+
let y = 0;
|
|
228
|
+
for (const { bone, w } of v.weights) {
|
|
229
|
+
const [bx, by] = applyAffine(skinMat(bone), v.x, v.y);
|
|
230
|
+
x += w * bx;
|
|
231
|
+
y += w * by;
|
|
232
|
+
}
|
|
233
|
+
return [x, y];
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
function vertexBounds(points) {
|
|
237
|
+
if (points.length === 0) return null;
|
|
238
|
+
let minX = Infinity;
|
|
239
|
+
let minY = Infinity;
|
|
240
|
+
let maxX = -Infinity;
|
|
241
|
+
let maxY = -Infinity;
|
|
242
|
+
for (const [x, y] of points) {
|
|
243
|
+
if (x < minX) minX = x;
|
|
244
|
+
if (y < minY) minY = y;
|
|
245
|
+
if (x > maxX) maxX = x;
|
|
246
|
+
if (y > maxY) maxY = y;
|
|
247
|
+
}
|
|
248
|
+
return { minX, minY, maxX, maxY };
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// components/game/atoms/DrawSkinnedMesh.tsx
|
|
252
|
+
createLogger("almadar:ui:draw-skinned-mesh");
|
|
253
|
+
Array.from({ length: 10 }, (_, i) => `hsl(${i * 36 % 360}, 70%, 55%)`);
|
|
254
|
+
function resolveSkinPose(node, clip) {
|
|
255
|
+
const effectiveClip = node.clip;
|
|
256
|
+
if (effectiveClip && node.frame !== void 0 && effectiveClip.frames.length > 0) {
|
|
257
|
+
return effectiveClip.frames[node.frame % effectiveClip.frames.length];
|
|
258
|
+
}
|
|
259
|
+
return node.pose ?? {};
|
|
260
|
+
}
|
|
261
|
+
|
|
158
262
|
// lib/drawable/hitTest.ts
|
|
159
263
|
function shapeDrawnItem(n) {
|
|
160
264
|
if (n.shape !== "rect") return { pos: n.position, id: n.id };
|
|
161
265
|
return { pos: n.position, id: n.id, anchor: n.anchor, width: n.width, height: n.height, rotation: n.rotate };
|
|
162
266
|
}
|
|
267
|
+
function skinnedMeshDrawnItem(n) {
|
|
268
|
+
const mesh = n.mesh;
|
|
269
|
+
if (!mesh || n.bones.length === 0) return { pos: n.position, id: n.id };
|
|
270
|
+
const bindWorld = computeWorldMatrices(n.bones, {});
|
|
271
|
+
const curWorld = computeWorldMatrices(n.bones, resolveSkinPose(n));
|
|
272
|
+
const bounds = vertexBounds(skinVertices(mesh, bindWorld, curWorld));
|
|
273
|
+
if (!bounds) return { pos: n.position, id: n.id };
|
|
274
|
+
return {
|
|
275
|
+
pos: { ...n.position, x: n.position.x + bounds.minX, y: n.position.y + bounds.minY },
|
|
276
|
+
id: n.id,
|
|
277
|
+
anchor: "top-left",
|
|
278
|
+
width: bounds.maxX - bounds.minX,
|
|
279
|
+
height: bounds.maxY - bounds.minY
|
|
280
|
+
};
|
|
281
|
+
}
|
|
163
282
|
function collectDrawnItems(nodes) {
|
|
164
283
|
const out = [];
|
|
165
284
|
for (const n of nodes) {
|
|
@@ -170,6 +289,9 @@ function collectDrawnItems(nodes) {
|
|
|
170
289
|
case "draw-shape":
|
|
171
290
|
if (isValidScenePos(n.position)) out.push(shapeDrawnItem(n));
|
|
172
291
|
break;
|
|
292
|
+
case "draw-skinned-mesh":
|
|
293
|
+
if (isValidScenePos(n.position)) out.push(skinnedMeshDrawnItem(n));
|
|
294
|
+
break;
|
|
173
295
|
case "draw-text":
|
|
174
296
|
case "draw-group":
|
|
175
297
|
case "draw-mesh":
|
|
@@ -1782,6 +1904,9 @@ function Drawable3D({ node, projector, groupOpacity = 1 }) {
|
|
|
1782
1904
|
}
|
|
1783
1905
|
case "draw-fx-layer":
|
|
1784
1906
|
return /* @__PURE__ */ jsx(FxLayer3D, { node, projector, groupOpacity });
|
|
1907
|
+
case "draw-skinned-mesh":
|
|
1908
|
+
warnUnsupported3d("draw-skinned-mesh");
|
|
1909
|
+
return null;
|
|
1785
1910
|
}
|
|
1786
1911
|
})();
|
|
1787
1912
|
return node.id ? /* @__PURE__ */ jsx("group", { userData: { drawableId: node.id }, children: rendered }) : rendered;
|
|
@@ -5574,8 +5699,6 @@ function effectTypeColor(type) {
|
|
|
5574
5699
|
return "#a78bda";
|
|
5575
5700
|
case "navigate":
|
|
5576
5701
|
return "#40c8aa";
|
|
5577
|
-
case "notify":
|
|
5578
|
-
return "#f0c040";
|
|
5579
5702
|
case "call-service":
|
|
5580
5703
|
return "#a78bda";
|
|
5581
5704
|
case "spawn":
|
|
@@ -5715,7 +5838,7 @@ var Avl3DTransitionArc = ({
|
|
|
5715
5838
|
if (!pt) return null;
|
|
5716
5839
|
const eColor = effectTypeColor(effectType);
|
|
5717
5840
|
return /* @__PURE__ */ jsx("group", { position: pt, children: /* @__PURE__ */ jsxs("mesh", { scale: 0.06, children: [
|
|
5718
|
-
effectType === "render-ui" ? /* @__PURE__ */ jsx("boxGeometry", { args: [1.5, 1.5, 0.3] }) : effectType === "persist" ? /* @__PURE__ */ jsx("cylinderGeometry", { args: [0.6, 0.6, 1.5, 8] }) : effectType === "emit" ? /* @__PURE__ */ jsx("sphereGeometry", { args: [1, 8, 8] }) : effectType === "navigate" ? /* @__PURE__ */ jsx("coneGeometry", { args: [0.8, 1.5, 6] }) : effectType === "set" ? /* @__PURE__ */ jsx("tetrahedronGeometry", { args: [1, 0] }) : effectType === "
|
|
5841
|
+
effectType === "render-ui" ? /* @__PURE__ */ jsx("boxGeometry", { args: [1.5, 1.5, 0.3] }) : effectType === "persist" ? /* @__PURE__ */ jsx("cylinderGeometry", { args: [0.6, 0.6, 1.5, 8] }) : effectType === "emit" ? /* @__PURE__ */ jsx("sphereGeometry", { args: [1, 8, 8] }) : effectType === "navigate" ? /* @__PURE__ */ jsx("coneGeometry", { args: [0.8, 1.5, 6] }) : effectType === "set" ? /* @__PURE__ */ jsx("tetrahedronGeometry", { args: [1, 0] }) : effectType === "call-service" ? /* @__PURE__ */ jsx("torusGeometry", { args: [0.8, 0.3, 6, 12] }) : /* @__PURE__ */ jsx("octahedronGeometry", { args: [0.8, 0] }),
|
|
5719
5842
|
/* @__PURE__ */ jsx(
|
|
5720
5843
|
"meshStandardMaterial",
|
|
5721
5844
|
{
|
package/dist/lib/index.cjs
CHANGED
|
@@ -1073,9 +1073,6 @@ function getEffectSummary(effects) {
|
|
|
1073
1073
|
case "emit":
|
|
1074
1074
|
summaries.push(`\u2191 ${effect[1] || "event"}`);
|
|
1075
1075
|
break;
|
|
1076
|
-
case "notify":
|
|
1077
|
-
summaries.push(`\u{1F4E7} ${effect[1] || ""}`);
|
|
1078
|
-
break;
|
|
1079
1076
|
case "persist":
|
|
1080
1077
|
summaries.push(`\u{1F4BE} ${effect[1] || "save"}`);
|
|
1081
1078
|
break;
|
|
@@ -1101,7 +1098,7 @@ function extractOutputsFromTransitions(transitions) {
|
|
|
1101
1098
|
t.effects.forEach((effect) => {
|
|
1102
1099
|
if (Array.isArray(effect)) {
|
|
1103
1100
|
const op = effect[0];
|
|
1104
|
-
if (["emit", "
|
|
1101
|
+
if (["emit", "persist", "navigate", "call-service"].includes(op)) {
|
|
1105
1102
|
if (isArraySExpr(effect)) {
|
|
1106
1103
|
const humanText = formatSExprEffectToDomain(effect);
|
|
1107
1104
|
outputs.add(humanText);
|
package/dist/lib/index.d.cts
CHANGED
|
@@ -2,11 +2,11 @@ export { A as ApplyOperatorInput, a as ApplyOperatorResult, C as ContentSegment,
|
|
|
2
2
|
import { FieldValue, EntityRow } from '@almadar/core';
|
|
3
3
|
export { AssetLoadStatus, BridgeHealth, CheckStatus, EffectTrace, EventLogEntry, OrbitalVerificationAPI, ServerResponseTrace, TraitStateSnapshot, TransitionTrace, VerificationCheck, VerificationSnapshot, VerificationSummary, getNestedValue } from '@almadar/core';
|
|
4
4
|
export { p as profilerOnRender, u as usePerfBuffer } from '../perf-DaVdsbU0.cjs';
|
|
5
|
-
export { T as TraitSnapshotGetter, b as bindCanvasCapture, a as bindEventBus, c as bindLastDrawables, d as bindTraitStateGetter, e as clearVerification, g as getAllChecks, f as getBridgeHealth, h as getSnapshot, i as getSummary, j as getTraitSnapshots, k as getTransitions, l as getTransitionsForTrait, r as recordServerResponse, m as recordTransition, n as registerCheck, o as registerTraitSnapshot, s as subscribeToVerification, u as updateAssetStatus, p as updateBridgeHealth, q as updateCheck, w as waitForTransition } from '../verificationRegistry-
|
|
5
|
+
export { T as TraitSnapshotGetter, b as bindCanvasCapture, a as bindEventBus, c as bindLastDrawables, d as bindTraitStateGetter, e as clearVerification, g as getAllChecks, f as getBridgeHealth, h as getSnapshot, i as getSummary, j as getTraitSnapshots, k as getTransitions, l as getTransitionsForTrait, r as recordServerResponse, m as recordTransition, n as registerCheck, o as registerTraitSnapshot, s as subscribeToVerification, u as updateAssetStatus, p as updateBridgeHealth, q as updateCheck, w as waitForTransition } from '../verificationRegistry-DTrKDRoa.cjs';
|
|
6
6
|
export { PERF_NAMESPACE, PerfEntry, clearPerf, perfEnd, perfGauge, perfStart, perfTime, perfTimeAsync } from '@almadar/runtime/ui';
|
|
7
7
|
import 'react';
|
|
8
8
|
import 'clsx';
|
|
9
|
-
import '../paintDispatch-
|
|
9
|
+
import '../paintDispatch-Dh1pgljl.cjs';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Trait Registry - Tracks active traits and their state machines for debugging
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ export { A as ApplyOperatorInput, a as ApplyOperatorResult, C as ContentSegment,
|
|
|
2
2
|
import { FieldValue, EntityRow } from '@almadar/core';
|
|
3
3
|
export { AssetLoadStatus, BridgeHealth, CheckStatus, EffectTrace, EventLogEntry, OrbitalVerificationAPI, ServerResponseTrace, TraitStateSnapshot, TransitionTrace, VerificationCheck, VerificationSnapshot, VerificationSummary, getNestedValue } from '@almadar/core';
|
|
4
4
|
export { p as profilerOnRender, u as usePerfBuffer } from '../perf-DaVdsbU0.js';
|
|
5
|
-
export { T as TraitSnapshotGetter, b as bindCanvasCapture, a as bindEventBus, c as bindLastDrawables, d as bindTraitStateGetter, e as clearVerification, g as getAllChecks, f as getBridgeHealth, h as getSnapshot, i as getSummary, j as getTraitSnapshots, k as getTransitions, l as getTransitionsForTrait, r as recordServerResponse, m as recordTransition, n as registerCheck, o as registerTraitSnapshot, s as subscribeToVerification, u as updateAssetStatus, p as updateBridgeHealth, q as updateCheck, w as waitForTransition } from '../verificationRegistry-
|
|
5
|
+
export { T as TraitSnapshotGetter, b as bindCanvasCapture, a as bindEventBus, c as bindLastDrawables, d as bindTraitStateGetter, e as clearVerification, g as getAllChecks, f as getBridgeHealth, h as getSnapshot, i as getSummary, j as getTraitSnapshots, k as getTransitions, l as getTransitionsForTrait, r as recordServerResponse, m as recordTransition, n as registerCheck, o as registerTraitSnapshot, s as subscribeToVerification, u as updateAssetStatus, p as updateBridgeHealth, q as updateCheck, w as waitForTransition } from '../verificationRegistry-Cwa52VyK.js';
|
|
6
6
|
export { PERF_NAMESPACE, PerfEntry, clearPerf, perfEnd, perfGauge, perfStart, perfTime, perfTimeAsync } from '@almadar/runtime/ui';
|
|
7
7
|
import 'react';
|
|
8
8
|
import 'clsx';
|
|
9
|
-
import '../paintDispatch-
|
|
9
|
+
import '../paintDispatch-Dh1pgljl.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Trait Registry - Tracks active traits and their state machines for debugging
|
package/dist/lib/index.js
CHANGED
|
@@ -1073,9 +1073,6 @@ function getEffectSummary(effects) {
|
|
|
1073
1073
|
case "emit":
|
|
1074
1074
|
summaries.push(`\u2191 ${effect[1] || "event"}`);
|
|
1075
1075
|
break;
|
|
1076
|
-
case "notify":
|
|
1077
|
-
summaries.push(`\u{1F4E7} ${effect[1] || ""}`);
|
|
1078
|
-
break;
|
|
1079
1076
|
case "persist":
|
|
1080
1077
|
summaries.push(`\u{1F4BE} ${effect[1] || "save"}`);
|
|
1081
1078
|
break;
|
|
@@ -1101,7 +1098,7 @@ function extractOutputsFromTransitions(transitions) {
|
|
|
1101
1098
|
t.effects.forEach((effect) => {
|
|
1102
1099
|
if (Array.isArray(effect)) {
|
|
1103
1100
|
const op = effect[0];
|
|
1104
|
-
if (["emit", "
|
|
1101
|
+
if (["emit", "persist", "navigate", "call-service"].includes(op)) {
|
|
1105
1102
|
if (isArraySExpr(effect)) {
|
|
1106
1103
|
const humanText = formatSExprEffectToDomain(effect);
|
|
1107
1104
|
outputs.add(humanText);
|
|
@@ -170,14 +170,7 @@ declare function useNavigationId(): number;
|
|
|
170
170
|
* @packageDocumentation
|
|
171
171
|
*/
|
|
172
172
|
|
|
173
|
-
type ClientEffect = ['render-ui', string, PatternConfig | null] | ['navigate', string, Record<string, FieldValue>?] | ['
|
|
174
|
-
/**
|
|
175
|
-
* Options for notify effect
|
|
176
|
-
*/
|
|
177
|
-
interface NotifyOptions {
|
|
178
|
-
type?: 'success' | 'error' | 'info' | 'warning';
|
|
179
|
-
duration?: number;
|
|
180
|
-
}
|
|
173
|
+
type ClientEffect = ['render-ui', string, PatternConfig | null] | ['navigate', string, Record<string, FieldValue>?] | ['emit', string, FieldValue?];
|
|
181
174
|
/**
|
|
182
175
|
* Resolved pattern with component information from component-mapping.json
|
|
183
176
|
*/
|
|
@@ -202,7 +195,7 @@ interface EventResponse {
|
|
|
202
195
|
newState?: string;
|
|
203
196
|
/** Data fetched by server effects (e.g., { Task: [...] }) */
|
|
204
197
|
data?: Record<string, EntityRow[]>;
|
|
205
|
-
/** Client effects to execute (render-ui, navigate,
|
|
198
|
+
/** Client effects to execute (render-ui, navigate, emit) */
|
|
206
199
|
clientEffects?: ClientEffect[];
|
|
207
200
|
/** Results of individual effect executions (for debugging) */
|
|
208
201
|
effectResults?: Array<{
|
|
@@ -229,11 +222,6 @@ interface ClientEffectExecutorConfig {
|
|
|
229
222
|
* Called for 'navigate' effects.
|
|
230
223
|
*/
|
|
231
224
|
navigate: (path: string, params?: Record<string, FieldValue>) => void;
|
|
232
|
-
/**
|
|
233
|
-
* Show a notification.
|
|
234
|
-
* Called for 'notify' effects.
|
|
235
|
-
*/
|
|
236
|
-
notify: (message: string, options?: NotifyOptions) => void;
|
|
237
225
|
/**
|
|
238
226
|
* Emit an event to the event bus.
|
|
239
227
|
* Called for 'emit' effects.
|
|
@@ -376,7 +364,7 @@ interface OfflineExecutorState {
|
|
|
376
364
|
* OfflineExecutor - Handles effects in offline/client-only mode.
|
|
377
365
|
*
|
|
378
366
|
* Features:
|
|
379
|
-
* - Executes client effects immediately (render-ui, navigate,
|
|
367
|
+
* - Executes client effects immediately (render-ui, navigate, emit)
|
|
380
368
|
* - Queues server effects (persist, fetch, call-service) for later sync
|
|
381
369
|
* - Provides mock data for fetch effects when offline
|
|
382
370
|
* - Syncs queued effects when connection is restored
|
|
@@ -386,7 +374,6 @@ interface OfflineExecutorState {
|
|
|
386
374
|
* const executor = new OfflineExecutor({
|
|
387
375
|
* renderToSlot: (slot, pattern) => slotManager.render(slot, pattern),
|
|
388
376
|
* navigate: (path) => router.push(path),
|
|
389
|
-
* notify: (message, opts) => toast.show(message, opts),
|
|
390
377
|
* eventBus: { emit: (event, payload) => bus.emit(event, payload) },
|
|
391
378
|
* mockDataProvider: (entityName) => mockStore.getAll(entityName),
|
|
392
379
|
* });
|
|
@@ -472,7 +459,6 @@ declare class OfflineExecutor {
|
|
|
472
459
|
* const executor = createOfflineExecutor({
|
|
473
460
|
* renderToSlot: slotManager.render,
|
|
474
461
|
* navigate: router.push,
|
|
475
|
-
* notify: toast.show,
|
|
476
462
|
* eventBus: { emit: bus.emit },
|
|
477
463
|
* mockDataProvider: (entity) => store.getAll(entity),
|
|
478
464
|
* });
|
|
@@ -518,7 +504,6 @@ interface UseOfflineExecutorResult {
|
|
|
518
504
|
* const { isOffline, pendingCount, processEventOffline, sync } = useOfflineExecutor({
|
|
519
505
|
* renderToSlot: slotManager.render,
|
|
520
506
|
* navigate: router.push,
|
|
521
|
-
* notify: toast.show,
|
|
522
507
|
* eventBus: { emit: bus.emit },
|
|
523
508
|
* serverUrl: '/api/orbitals',
|
|
524
509
|
* autoSync: true,
|
|
@@ -535,4 +520,4 @@ interface UseOfflineExecutorResult {
|
|
|
535
520
|
*/
|
|
536
521
|
declare function useOfflineExecutor(options: UseOfflineExecutorOptions): UseOfflineExecutorResult;
|
|
537
522
|
|
|
538
|
-
export {
|
|
523
|
+
export { type ClientEffect as C, type DataContext as D, type EventResponse as E, type MappedPattern as M, type NavigationContextValue as N, OfflineExecutor as O, type PendingSyncEffect as P, type SlotDefinition as S, type UseOfflineExecutorOptions as U, type ClientEffectExecutorConfig as a, type DataResolution as b, NavigationProvider as c, type NavigationProviderProps as d, type NavigationState as e, type OfflineExecutorConfig as f, type OfflineExecutorState as g, type SlotType as h, type UseOfflineExecutorResult as i, comparePathSpecificity as j, createOfflineExecutor as k, extractRouteParams as l, findPageByName as m, findPageByPath as n, getAllPages as o, getDefaultPage as p, matchPath as q, matchPathAmong as r, pathMatches as s, useInitPayload as t, useActivePage as u, useNavigateTo as v, useNavigation as w, useNavigationId as x, useNavigationState as y, useOfflineExecutor as z };
|
|
@@ -170,14 +170,7 @@ declare function useNavigationId(): number;
|
|
|
170
170
|
* @packageDocumentation
|
|
171
171
|
*/
|
|
172
172
|
|
|
173
|
-
type ClientEffect = ['render-ui', string, PatternConfig | null] | ['navigate', string, Record<string, FieldValue>?] | ['
|
|
174
|
-
/**
|
|
175
|
-
* Options for notify effect
|
|
176
|
-
*/
|
|
177
|
-
interface NotifyOptions {
|
|
178
|
-
type?: 'success' | 'error' | 'info' | 'warning';
|
|
179
|
-
duration?: number;
|
|
180
|
-
}
|
|
173
|
+
type ClientEffect = ['render-ui', string, PatternConfig | null] | ['navigate', string, Record<string, FieldValue>?] | ['emit', string, FieldValue?];
|
|
181
174
|
/**
|
|
182
175
|
* Resolved pattern with component information from component-mapping.json
|
|
183
176
|
*/
|
|
@@ -202,7 +195,7 @@ interface EventResponse {
|
|
|
202
195
|
newState?: string;
|
|
203
196
|
/** Data fetched by server effects (e.g., { Task: [...] }) */
|
|
204
197
|
data?: Record<string, EntityRow[]>;
|
|
205
|
-
/** Client effects to execute (render-ui, navigate,
|
|
198
|
+
/** Client effects to execute (render-ui, navigate, emit) */
|
|
206
199
|
clientEffects?: ClientEffect[];
|
|
207
200
|
/** Results of individual effect executions (for debugging) */
|
|
208
201
|
effectResults?: Array<{
|
|
@@ -229,11 +222,6 @@ interface ClientEffectExecutorConfig {
|
|
|
229
222
|
* Called for 'navigate' effects.
|
|
230
223
|
*/
|
|
231
224
|
navigate: (path: string, params?: Record<string, FieldValue>) => void;
|
|
232
|
-
/**
|
|
233
|
-
* Show a notification.
|
|
234
|
-
* Called for 'notify' effects.
|
|
235
|
-
*/
|
|
236
|
-
notify: (message: string, options?: NotifyOptions) => void;
|
|
237
225
|
/**
|
|
238
226
|
* Emit an event to the event bus.
|
|
239
227
|
* Called for 'emit' effects.
|
|
@@ -376,7 +364,7 @@ interface OfflineExecutorState {
|
|
|
376
364
|
* OfflineExecutor - Handles effects in offline/client-only mode.
|
|
377
365
|
*
|
|
378
366
|
* Features:
|
|
379
|
-
* - Executes client effects immediately (render-ui, navigate,
|
|
367
|
+
* - Executes client effects immediately (render-ui, navigate, emit)
|
|
380
368
|
* - Queues server effects (persist, fetch, call-service) for later sync
|
|
381
369
|
* - Provides mock data for fetch effects when offline
|
|
382
370
|
* - Syncs queued effects when connection is restored
|
|
@@ -386,7 +374,6 @@ interface OfflineExecutorState {
|
|
|
386
374
|
* const executor = new OfflineExecutor({
|
|
387
375
|
* renderToSlot: (slot, pattern) => slotManager.render(slot, pattern),
|
|
388
376
|
* navigate: (path) => router.push(path),
|
|
389
|
-
* notify: (message, opts) => toast.show(message, opts),
|
|
390
377
|
* eventBus: { emit: (event, payload) => bus.emit(event, payload) },
|
|
391
378
|
* mockDataProvider: (entityName) => mockStore.getAll(entityName),
|
|
392
379
|
* });
|
|
@@ -472,7 +459,6 @@ declare class OfflineExecutor {
|
|
|
472
459
|
* const executor = createOfflineExecutor({
|
|
473
460
|
* renderToSlot: slotManager.render,
|
|
474
461
|
* navigate: router.push,
|
|
475
|
-
* notify: toast.show,
|
|
476
462
|
* eventBus: { emit: bus.emit },
|
|
477
463
|
* mockDataProvider: (entity) => store.getAll(entity),
|
|
478
464
|
* });
|
|
@@ -518,7 +504,6 @@ interface UseOfflineExecutorResult {
|
|
|
518
504
|
* const { isOffline, pendingCount, processEventOffline, sync } = useOfflineExecutor({
|
|
519
505
|
* renderToSlot: slotManager.render,
|
|
520
506
|
* navigate: router.push,
|
|
521
|
-
* notify: toast.show,
|
|
522
507
|
* eventBus: { emit: bus.emit },
|
|
523
508
|
* serverUrl: '/api/orbitals',
|
|
524
509
|
* autoSync: true,
|
|
@@ -535,4 +520,4 @@ interface UseOfflineExecutorResult {
|
|
|
535
520
|
*/
|
|
536
521
|
declare function useOfflineExecutor(options: UseOfflineExecutorOptions): UseOfflineExecutorResult;
|
|
537
522
|
|
|
538
|
-
export {
|
|
523
|
+
export { type ClientEffect as C, type DataContext as D, type EventResponse as E, type MappedPattern as M, type NavigationContextValue as N, OfflineExecutor as O, type PendingSyncEffect as P, type SlotDefinition as S, type UseOfflineExecutorOptions as U, type ClientEffectExecutorConfig as a, type DataResolution as b, NavigationProvider as c, type NavigationProviderProps as d, type NavigationState as e, type OfflineExecutorConfig as f, type OfflineExecutorState as g, type SlotType as h, type UseOfflineExecutorResult as i, comparePathSpecificity as j, createOfflineExecutor as k, extractRouteParams as l, findPageByName as m, findPageByPath as n, getAllPages as o, getDefaultPage as p, matchPath as q, matchPathAmong as r, pathMatches as s, useInitPayload as t, useActivePage as u, useNavigateTo as v, useNavigation as w, useNavigationId as x, useNavigationState as y, useOfflineExecutor as z };
|