@almadar/shell-web 0.1.0 → 1.0.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/{ArbitraryClassCompiler-Mzabq-UB.d.ts → ArbitraryClassCompiler-CO_iASBn.d.ts} +99 -4
- package/dist/AvlGlyph-EPJKFEO3.js +6 -0
- package/dist/AvlStateMachine-RKZIKNGC.js +9 -0
- package/dist/AvlTransitionDetail-63SD6GZF.js +11 -0
- package/dist/AvlTransitionExplainer-ZBTLOM3T.js +12 -0
- package/dist/BehaviorView-YS5G4GNB.js +11 -0
- package/dist/{Canvas3DHost-_Y-5uLM_.d.ts → Canvas3DHost-BkZQB5l2.d.ts} +1 -1
- package/dist/{EventBusProvider-CVwjkV_2.d.ts → EventBusProvider-BFFHfN4O.d.ts} +12 -0
- package/dist/FlowCanvas-AUMTWMNG.js +26 -0
- package/dist/{GameAudioProvider-Cm9BnvmP.d.ts → GameAudioProvider-ceM_n0ey.d.ts} +4 -7
- package/dist/KernelEngineContext-CcxGYtlr.d.ts +33 -0
- package/dist/LayersPanel-M2LHWUFF.js +6 -0
- package/dist/ModuleCard-QHDGK5XK.js +7 -0
- package/dist/OrbInspector-QCPEPUPH.js +26 -0
- package/dist/{Select-mDZIwNqN.d.ts → Select-B-iDdnvE.d.ts} +16 -30
- package/dist/ServerBridge-Bqsj-lOU.d.ts +124 -0
- package/dist/UISlotRenderer-C7WWOK43.js +26 -0
- package/dist/auth/browser/index.js +1 -0
- package/dist/auth/react/index.d.ts +8 -1
- package/dist/auth/react/index.js +40 -2
- package/dist/avl/index.d.ts +89 -79
- package/dist/avl/index.js +38 -38
- package/dist/{avl-3d-context-BIRKWpaL.d.ts → avl-3d-context-BycmO6tG.d.ts} +9 -12
- package/dist/{chunk-GKIFONTE.js → chunk-3S54FWRC.js} +2 -2
- package/dist/{chunk-DYEKAA4L.js → chunk-3VZ36ZKO.js} +240 -252
- package/dist/{chunk-PC7K4SK7.js → chunk-4T3P43NS.js} +18 -269
- package/dist/{chunk-MBQAMMSE.js → chunk-4YXBKHHM.js} +269 -658
- package/dist/{chunk-YDNJLLG6.js → chunk-57DC34LY.js} +19 -10
- package/dist/{chunk-SJGJJKBY.js → chunk-AB3X7QTE.js} +6 -3
- package/dist/{chunk-AILY3XPS.js → chunk-AE7VCQB6.js} +5 -6
- package/dist/{chunk-FAJDTHWC.js → chunk-AGXD77SL.js} +2 -2
- package/dist/chunk-AU7O65OX.js +66 -0
- package/dist/{chunk-L677XGY3.js → chunk-CPLN6NBQ.js} +5 -5
- package/dist/{chunk-DZ42OJQC.js → chunk-DZBQA2OW.js} +1 -1
- package/dist/{chunk-2PY54Z44.js → chunk-E6KA4J6N.js} +5 -5
- package/dist/{chunk-DJ433ET5.js → chunk-GFXCPUMX.js} +11 -4
- package/dist/{chunk-FP3WIKTC.js → chunk-HH5KSMH5.js} +9 -1
- package/dist/{chunk-U6QRZASX.js → chunk-ILQXJ2AR.js} +1 -1
- package/dist/{chunk-B4BU77LT.js → chunk-ILZ7ORX7.js} +1 -1
- package/dist/{chunk-SGM3FASH.js → chunk-K4MOPSEL.js} +14 -12
- package/dist/{chunk-GYTPOFVC.js → chunk-LHP2TK7O.js} +7402 -6970
- package/dist/{chunk-VFF5OO47.js → chunk-PCR37T3U.js} +15 -38
- package/dist/{chunk-R5O5AUPI.js → chunk-PRXQGGCO.js} +93 -86
- package/dist/{chunk-42FY4RYA.js → chunk-REXYVBUO.js} +2 -2
- package/dist/{chunk-DLZF4PVE.js → chunk-ROICKAU7.js} +3 -3
- package/dist/{chunk-KVQS4GXU.js → chunk-SP5CDJ6K.js} +18 -8
- package/dist/{chunk-P4LNHAFI.js → chunk-TUPZWTRE.js} +2 -2
- package/dist/chunk-TXAUOLWZ.js +490 -0
- package/dist/{chunk-EQAMU2ZC.js → chunk-UTDC2NEA.js} +1 -1
- package/dist/{chunk-73SRAB4P.js → chunk-UU57VNS2.js} +2 -2
- package/dist/{chunk-DFNZUYX4.js → chunk-UXLE3IPR.js} +70 -27
- package/dist/{chunk-L2DEKY4J.js → chunk-VO2TTLS5.js} +3 -6
- package/dist/{chunk-TESBIVUA.js → chunk-X3DMMX27.js} +2 -2
- package/dist/components/index.d.ts +331 -125
- package/dist/components/index.js +28 -28
- package/dist/context/index.d.ts +2 -3
- package/dist/context/index.js +4 -3
- package/dist/core.d.ts +93 -17
- package/dist/core.js +2 -1
- package/dist/design-classes/index.cjs +3 -1
- package/dist/design-classes/index.js +3 -1
- package/dist/hooks/index.d.ts +40 -5
- package/dist/hooks/index.js +5 -4
- package/dist/index.d.ts +36 -114
- package/dist/index.js +174 -34
- package/dist/kernel-client-TZKGHJRY.js +516 -0
- package/dist/kernel-wire-wNdAPfhJ.d.ts +88 -0
- package/dist/lib/index.d.ts +3 -3
- package/dist/lib/index.js +5 -4
- package/dist/{paintDispatch-ChW5mVuK.d.ts → paintDispatch-CuJLsr9Y.d.ts} +5 -15
- package/dist/{prism-AIWGN2X5.js → prism-X5YWKXO5.js} +5 -3
- package/dist/providers/index.d.ts +42 -27
- package/dist/providers/index.js +22 -23
- package/dist/renderer/index.d.ts +0 -2
- package/dist/renderer/index.js +1 -0
- package/dist/runtime/index.d.ts +52 -253
- package/dist/runtime/index.js +21 -24
- package/dist/ssr/index.cjs +2643 -535
- package/dist/ssr/index.d.cts +0 -23
- package/dist/ssr/index.d.ts +0 -23
- package/dist/ssr/index.js +2639 -535
- package/dist/storage/browser/index.js +1 -0
- package/dist/test-support.d.ts +15 -8
- package/dist/test-support.js +91 -24
- package/dist/three/index.d.ts +6 -6
- package/dist/three/index.js +49 -37
- package/dist/{verificationRegistry-CabxhfTv.d.ts → verificationRegistry-CVrcxG1s.d.ts} +3 -3
- package/package.json +13 -9
- package/src/core/lib/band-shapes.json +7 -0
- package/src/core/locales/ar.json +18 -5
- package/src/core/locales/en.json +18 -5
- package/src/core/locales/sl.json +18 -5
- package/tailwind-preset.cjs +30 -1
- package/dist/AvlGlyph-JKJOAH23.js +0 -6
- package/dist/AvlStateMachine-PI4YGREK.js +0 -8
- package/dist/AvlTransitionDetail-ZH7V24UG.js +0 -12
- package/dist/AvlTransitionExplainer-ZSRT7L6Y.js +0 -13
- package/dist/BehaviorValueFrame-6RUJXT4A.js +0 -29
- package/dist/BehaviorValueFrame-SSEMEBTG.css +0 -1756
- package/dist/BehaviorView-RFEE5J6E.js +0 -10
- package/dist/FlowCanvas-STDC4OWK.js +0 -27
- package/dist/KernelEngineContext-BOCQoFwk.d.ts +0 -43
- package/dist/LayersPanel-BBQ54IVG.js +0 -7
- package/dist/ModuleCard-3TT2X7IW.js +0 -7
- package/dist/OrbInspector-K6T6O7GI.js +0 -27
- package/dist/ServerBridge-Cm1On51b.d.ts +0 -233
- package/dist/TraitValueFrame-2PJGLLVI.js +0 -28
- package/dist/TraitValueFrame-4G3KOUBR.css +0 -1756
- package/dist/UISlotRenderer-JKFSX24W.js +0 -27
- package/dist/UserContext-DqWeZkUZ.d.ts +0 -100
- package/dist/chunk-2QOH2HWM.js +0 -95
- package/dist/chunk-6P3MWXYE.js +0 -440
- package/dist/chunk-FIW6WN23.js +0 -508
- package/dist/chunk-GAR5TQ5B.js +0 -199
- package/dist/chunk-ZO6MXAS3.js +0 -69
- package/dist/kernel-client-ZH4PSMCN.js +0 -367
- package/dist/kernel-wire-B4S8pnP3.d.ts +0 -65
- package/dist/useKeyboardRouter-Dsq553Ur.d.ts +0 -42
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { resolveThemeColor, parseComputedColor } from './chunk-
|
|
2
|
-
import { updateAssetStatus } from './chunk-
|
|
3
|
-
import {
|
|
1
|
+
import { resolveThemeColor, parseComputedColor } from './chunk-UXLE3IPR.js';
|
|
2
|
+
import { updateAssetStatus } from './chunk-ILZ7ORX7.js';
|
|
3
|
+
import { useTheme, useThemeScope } from './chunk-4YXBKHHM.js';
|
|
4
4
|
import { createContext, useContext, useState, useLayoutEffect, useEffect } from 'react';
|
|
5
5
|
import { createLogger } from '@almadar/logger';
|
|
6
|
-
import { DIAGRAM_TONES, DIAGRAM_TONE_COLOR_KEYS, DIAGRAM_TEXT_SIZES } from '@almadar/core';
|
|
6
|
+
import { DIAGRAM_TONES, kernelEvaluator, DIAGRAM_TONE_COLOR_KEYS, DIAGRAM_TEXT_SIZES } from '@almadar/core';
|
|
7
7
|
|
|
8
8
|
// src/lib/drawable/contract.ts
|
|
9
9
|
function isValidScenePos(pos) {
|
|
@@ -300,97 +300,14 @@ function getOrLoadImage(url, onReady) {
|
|
|
300
300
|
function getImageStatus(url) {
|
|
301
301
|
return cache.get(url)?.status;
|
|
302
302
|
}
|
|
303
|
-
|
|
304
|
-
// src/lib/skinning.ts
|
|
305
|
-
var IDENTITY = [1, 0, 0, 1, 0, 0];
|
|
306
|
-
function composeAffine(a, b) {
|
|
307
|
-
return [
|
|
308
|
-
a[0] * b[0] + a[2] * b[1],
|
|
309
|
-
a[1] * b[0] + a[3] * b[1],
|
|
310
|
-
a[0] * b[2] + a[2] * b[3],
|
|
311
|
-
a[1] * b[2] + a[3] * b[3],
|
|
312
|
-
a[0] * b[4] + a[2] * b[5] + a[4],
|
|
313
|
-
a[1] * b[4] + a[3] * b[5] + a[5]
|
|
314
|
-
];
|
|
315
|
-
}
|
|
316
|
-
function invertAffine(m) {
|
|
317
|
-
const det = m[0] * m[3] - m[1] * m[2];
|
|
318
|
-
if (!Number.isFinite(det) || Math.abs(det) < 1e-12) return IDENTITY;
|
|
319
|
-
const inv = 1 / det;
|
|
320
|
-
return [
|
|
321
|
-
m[3] * inv,
|
|
322
|
-
-m[1] * inv,
|
|
323
|
-
-m[2] * inv,
|
|
324
|
-
m[0] * inv,
|
|
325
|
-
(m[2] * m[5] - m[3] * m[4]) * inv,
|
|
326
|
-
(m[1] * m[4] - m[0] * m[5]) * inv
|
|
327
|
-
];
|
|
328
|
-
}
|
|
329
|
-
function applyAffine(m, x, y) {
|
|
330
|
-
return [m[0] * x + m[2] * y + m[4], m[1] * x + m[3] * y + m[5]];
|
|
331
|
-
}
|
|
332
|
-
function rotationAbout(pivot, degrees) {
|
|
333
|
-
const r = degrees * Math.PI / 180;
|
|
334
|
-
const cos = Math.cos(r);
|
|
335
|
-
const sin = Math.sin(r);
|
|
336
|
-
const [px, py] = pivot;
|
|
337
|
-
return [cos, sin, -sin, cos, px - cos * px + sin * py, py - sin * px - cos * py];
|
|
338
|
-
}
|
|
339
303
|
function computeWorldMatrices(bones, pose) {
|
|
340
|
-
|
|
341
|
-
bones.forEach((b, i) => indexByName.set(b.name, i));
|
|
342
|
-
const world = new Array(bones.length);
|
|
343
|
-
const visiting = /* @__PURE__ */ new Set();
|
|
344
|
-
const resolve = (i) => {
|
|
345
|
-
const cached = world[i];
|
|
346
|
-
if (cached) return cached;
|
|
347
|
-
if (visiting.has(i)) return IDENTITY;
|
|
348
|
-
visiting.add(i);
|
|
349
|
-
const b = bones[i];
|
|
350
|
-
const parentIndex = b.parent === null ? void 0 : indexByName.get(b.parent);
|
|
351
|
-
const parentWorld = parentIndex === void 0 ? IDENTITY : resolve(parentIndex);
|
|
352
|
-
const local = rotationAbout(b.pivot, pose[b.name] ?? 0);
|
|
353
|
-
const m = composeAffine(parentWorld, local);
|
|
354
|
-
visiting.delete(i);
|
|
355
|
-
world[i] = m;
|
|
356
|
-
return m;
|
|
357
|
-
};
|
|
358
|
-
return bones.map((_, i) => resolve(i));
|
|
304
|
+
return JSON.parse(kernelEvaluator().skinWorldMatrices(JSON.stringify(bones), JSON.stringify(pose)));
|
|
359
305
|
}
|
|
360
306
|
function skinVertices(mesh, bindWorld, curWorld) {
|
|
361
|
-
|
|
362
|
-
const skinMat = (bone) => {
|
|
363
|
-
let m = skinMats.get(bone);
|
|
364
|
-
if (!m) {
|
|
365
|
-
m = composeAffine(curWorld[bone] ?? IDENTITY, invertAffine(bindWorld[bone] ?? IDENTITY));
|
|
366
|
-
skinMats.set(bone, m);
|
|
367
|
-
}
|
|
368
|
-
return m;
|
|
369
|
-
};
|
|
370
|
-
return mesh.vertices.map((v) => {
|
|
371
|
-
if (v.weights.length === 0) return [v.x, v.y];
|
|
372
|
-
let x = 0;
|
|
373
|
-
let y = 0;
|
|
374
|
-
for (const { bone, w } of v.weights) {
|
|
375
|
-
const [bx, by] = applyAffine(skinMat(bone), v.x, v.y);
|
|
376
|
-
x += w * bx;
|
|
377
|
-
y += w * by;
|
|
378
|
-
}
|
|
379
|
-
return [x, y];
|
|
380
|
-
});
|
|
307
|
+
return JSON.parse(kernelEvaluator().skinVertices(JSON.stringify(mesh), JSON.stringify(bindWorld), JSON.stringify(curWorld)));
|
|
381
308
|
}
|
|
382
309
|
function triangleAffine(src, dst) {
|
|
383
|
-
|
|
384
|
-
const det = s0[0] * (s1[1] - s2[1]) + s1[0] * (s2[1] - s0[1]) + s2[0] * (s0[1] - s1[1]);
|
|
385
|
-
if (!Number.isFinite(det) || Math.abs(det) < 1e-12) return null;
|
|
386
|
-
const [d0, d1, d2] = dst;
|
|
387
|
-
const a = (d0[0] * (s1[1] - s2[1]) + d1[0] * (s2[1] - s0[1]) + d2[0] * (s0[1] - s1[1])) / det;
|
|
388
|
-
const c = (d0[0] * (s2[0] - s1[0]) + d1[0] * (s0[0] - s2[0]) + d2[0] * (s1[0] - s0[0])) / det;
|
|
389
|
-
const e = (d0[0] * (s1[0] * s2[1] - s2[0] * s1[1]) + d1[0] * (s2[0] * s0[1] - s0[0] * s2[1]) + d2[0] * (s0[0] * s1[1] - s1[0] * s0[1])) / det;
|
|
390
|
-
const b = (d0[1] * (s1[1] - s2[1]) + d1[1] * (s2[1] - s0[1]) + d2[1] * (s0[1] - s1[1])) / det;
|
|
391
|
-
const d = (d0[1] * (s2[0] - s1[0]) + d1[1] * (s0[0] - s2[0]) + d2[1] * (s1[0] - s0[0])) / det;
|
|
392
|
-
const f = (d0[1] * (s1[0] * s2[1] - s2[0] * s1[1]) + d1[1] * (s2[0] * s0[1] - s0[0] * s2[1]) + d2[1] * (s0[0] * s1[1] - s1[0] * s0[1])) / det;
|
|
393
|
-
return [a, b, c, d, e, f];
|
|
310
|
+
return JSON.parse(kernelEvaluator().skinTriangleAffine(JSON.stringify(src), JSON.stringify(dst)));
|
|
394
311
|
}
|
|
395
312
|
var meshCache = /* @__PURE__ */ new Map();
|
|
396
313
|
function isRigBundle(json) {
|
|
@@ -417,18 +334,7 @@ function skinMeshFailed(url) {
|
|
|
417
334
|
return meshCache.get(url) === null;
|
|
418
335
|
}
|
|
419
336
|
function vertexBounds(points) {
|
|
420
|
-
|
|
421
|
-
let minX = Infinity;
|
|
422
|
-
let minY = Infinity;
|
|
423
|
-
let maxX = -Infinity;
|
|
424
|
-
let maxY = -Infinity;
|
|
425
|
-
for (const [x, y] of points) {
|
|
426
|
-
if (x < minX) minX = x;
|
|
427
|
-
if (y < minY) minY = y;
|
|
428
|
-
if (x > maxX) maxX = x;
|
|
429
|
-
if (y > maxY) maxY = y;
|
|
430
|
-
}
|
|
431
|
-
return { minX, minY, maxX, maxY };
|
|
337
|
+
return JSON.parse(kernelEvaluator().skinVertexBounds(JSON.stringify(points)));
|
|
432
338
|
}
|
|
433
339
|
|
|
434
340
|
// src/components/game/atoms/DrawSkinnedMesh.tsx
|
|
@@ -629,174 +535,17 @@ function DrawMesh(props) {
|
|
|
629
535
|
if (register) register({ ...props, type: "draw-mesh" });
|
|
630
536
|
return null;
|
|
631
537
|
}
|
|
632
|
-
|
|
633
|
-
// src/components/game/molecules/DrawFxLayer.tsx
|
|
634
538
|
var DEFAULT_TICK_MS = 500;
|
|
635
539
|
var DEFAULT_TEXT_COLOR = "#ffe066";
|
|
636
|
-
var
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
if (!Number.isFinite(base2.x) || !Number.isFinite(base2.y)) return void 0;
|
|
644
|
-
return {
|
|
645
|
-
x: base2.x + (view.vx ?? 0) * ageSec,
|
|
646
|
-
y: base2.y + (view.vz ?? 0) * ageSec + fall
|
|
647
|
-
};
|
|
648
|
-
}
|
|
649
|
-
const base = view.position ?? { x: view.x, y: view.z ?? 0, z: view.y };
|
|
650
|
-
if (!Number.isFinite(base.x) || !Number.isFinite(base.y)) return void 0;
|
|
651
|
-
return {
|
|
652
|
-
x: base.x + (view.vx ?? 0) * ageSec,
|
|
653
|
-
y: base.y + (view.vz ?? 0) * ageSec,
|
|
654
|
-
...base.z !== void 0 || view.vy !== void 0 || g !== 0 ? { z: (base.z ?? 0) + (view.vy ?? 0) * ageSec - fall } : {}
|
|
655
|
-
};
|
|
656
|
-
}
|
|
657
|
-
function sparkShape(view, pos, i, fade, progress) {
|
|
658
|
-
const size = view.size ?? 0.5;
|
|
659
|
-
const angle = fxHash01(view.id, i * 3) * Math.PI * 2;
|
|
660
|
-
const dist = size * (0.4 + 0.6 * fxHash01(view.id, i * 3 + 1)) * easeOut(progress);
|
|
661
|
-
const r = size * (0.06 + 0.06 * fxHash01(view.id, i * 3 + 2));
|
|
662
|
-
const color = view.color ?? DEFAULT_SPARK_COLOR;
|
|
663
|
-
return {
|
|
664
|
-
type: "draw-shape",
|
|
665
|
-
shape: "ellipse",
|
|
666
|
-
position: { ...pos, x: pos.x + Math.cos(angle) * dist, y: pos.y + Math.sin(angle) * dist },
|
|
667
|
-
anchor: "center",
|
|
668
|
-
radiusX: r,
|
|
669
|
-
fill: color,
|
|
670
|
-
blendMode: "lighter",
|
|
671
|
-
opacity: fade,
|
|
672
|
-
...view.glow ? { shadow: { color, blur: view.glow } } : {}
|
|
540
|
+
var DEFAULT_FONT_FAMILY = "system-ui, sans-serif";
|
|
541
|
+
function expandFxLayer(node, epochNowMs, dim, tileWidth, fontFamily) {
|
|
542
|
+
const layer = {
|
|
543
|
+
...node,
|
|
544
|
+
tickMs: node.tickMs ?? DEFAULT_TICK_MS,
|
|
545
|
+
textColor: node.textColor ?? DEFAULT_TEXT_COLOR,
|
|
546
|
+
fontFamily: fontFamily ?? DEFAULT_FONT_FAMILY
|
|
673
547
|
};
|
|
674
|
-
|
|
675
|
-
function proceduralShapes(view, pos, fade, progress) {
|
|
676
|
-
const size = view.size ?? 0.5;
|
|
677
|
-
const color = view.color ?? DEFAULT_SPARK_COLOR;
|
|
678
|
-
switch (view.shape ?? "spark") {
|
|
679
|
-
case "ring": {
|
|
680
|
-
return [
|
|
681
|
-
{
|
|
682
|
-
type: "draw-shape",
|
|
683
|
-
shape: "ellipse",
|
|
684
|
-
position: pos,
|
|
685
|
-
anchor: "center",
|
|
686
|
-
radiusX: size * easeOut(progress),
|
|
687
|
-
stroke: view.color2 ?? color,
|
|
688
|
-
strokeWidth: 2,
|
|
689
|
-
blendMode: "lighter",
|
|
690
|
-
opacity: fade,
|
|
691
|
-
...view.glow ? { shadow: { color, blur: view.glow } } : {}
|
|
692
|
-
}
|
|
693
|
-
];
|
|
694
|
-
}
|
|
695
|
-
case "puff": {
|
|
696
|
-
const count = view.count ?? 3;
|
|
697
|
-
return Array.from({ length: count }, (_, i) => {
|
|
698
|
-
const angle = fxHash01(view.id, i * 5) * Math.PI * 2;
|
|
699
|
-
const drift = size * 0.3 * fxHash01(view.id, i * 5 + 1) * easeOut(progress);
|
|
700
|
-
return {
|
|
701
|
-
type: "draw-shape",
|
|
702
|
-
shape: "ellipse",
|
|
703
|
-
position: { ...pos, x: pos.x + Math.cos(angle) * drift, y: pos.y + Math.sin(angle) * drift },
|
|
704
|
-
anchor: "center",
|
|
705
|
-
radiusX: size * (0.15 + 0.35 * progress) * (0.7 + 0.6 * fxHash01(view.id, i * 5 + 2)),
|
|
706
|
-
fill: i === 0 && view.color2 ? view.color2 : color,
|
|
707
|
-
opacity: fade * 0.6,
|
|
708
|
-
...view.glow ? { shadow: { color, blur: view.glow } } : {}
|
|
709
|
-
};
|
|
710
|
-
});
|
|
711
|
-
}
|
|
712
|
-
case "streak": {
|
|
713
|
-
const count = view.count ?? 5;
|
|
714
|
-
return Array.from({ length: count }, (_, i) => {
|
|
715
|
-
const angle = fxHash01(view.id, i * 3) * Math.PI * 2;
|
|
716
|
-
const inner = size * (0.2 + 0.8 * easeOut(progress)) * (0.6 + 0.4 * fxHash01(view.id, i * 3 + 1));
|
|
717
|
-
const len = size * 0.35;
|
|
718
|
-
return {
|
|
719
|
-
type: "draw-shape",
|
|
720
|
-
shape: "ellipse",
|
|
721
|
-
position: pos,
|
|
722
|
-
anchor: "center",
|
|
723
|
-
offsetX: inner + len / 2,
|
|
724
|
-
offsetY: 0,
|
|
725
|
-
radiusX: len / 2,
|
|
726
|
-
radiusY: size * 0.04,
|
|
727
|
-
rotate: angle,
|
|
728
|
-
fill: color,
|
|
729
|
-
blendMode: "lighter",
|
|
730
|
-
opacity: fade,
|
|
731
|
-
...view.glow ? { shadow: { color, blur: view.glow } } : {}
|
|
732
|
-
};
|
|
733
|
-
});
|
|
734
|
-
}
|
|
735
|
-
default: {
|
|
736
|
-
const count = view.count ?? 6;
|
|
737
|
-
return Array.from({ length: count }, (_, i) => sparkShape(view, pos, i, fade, progress));
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
function expandFxItem(view, node, epochNowMs, dim, projector, fontFamily) {
|
|
742
|
-
if (view.space === "screen") return [];
|
|
743
|
-
const tickMs = node.tickMs ?? DEFAULT_TICK_MS;
|
|
744
|
-
const { ageMs, progress, fade } = fxLifecycle(view, epochNowMs, tickMs);
|
|
745
|
-
if (progress >= 1) return [];
|
|
746
|
-
const pos = fxPosition(view, dim, ageMs / 1e3);
|
|
747
|
-
if (!pos) return [];
|
|
748
|
-
const out = [];
|
|
749
|
-
const artItems = node.art?.[view.type]?.["idle"];
|
|
750
|
-
const sprite = node.sprites?.[view.type];
|
|
751
|
-
if (Array.isArray(artItems)) {
|
|
752
|
-
out.push({
|
|
753
|
-
type: "draw-group",
|
|
754
|
-
position: pos,
|
|
755
|
-
opacity: fade,
|
|
756
|
-
...view.size !== void 0 ? { scale: view.size } : {},
|
|
757
|
-
items: artItems
|
|
758
|
-
});
|
|
759
|
-
} else if (sprite?.url) {
|
|
760
|
-
const spriteSize = view.size ?? 0.6;
|
|
761
|
-
out.push({
|
|
762
|
-
type: "draw-sprite",
|
|
763
|
-
position: pos,
|
|
764
|
-
asset: sprite,
|
|
765
|
-
anchor: "center",
|
|
766
|
-
width: spriteSize,
|
|
767
|
-
height: spriteSize,
|
|
768
|
-
opacity: fade,
|
|
769
|
-
animation: view.animation ?? sprite.animations?.[0],
|
|
770
|
-
// One-shot fx rows (burst) play from the item's birth, not wall-time.
|
|
771
|
-
clockMs: ageMs
|
|
772
|
-
});
|
|
773
|
-
} else {
|
|
774
|
-
out.push(...proceduralShapes(view, pos, fade, progress));
|
|
775
|
-
}
|
|
776
|
-
if (view.message) {
|
|
777
|
-
const pxSize = projector && view.size !== void 0 ? Math.max(10, Math.round(view.size * projector.tileWidth)) : void 0;
|
|
778
|
-
const family = fontFamily ?? "system-ui, sans-serif";
|
|
779
|
-
const text = {
|
|
780
|
-
type: "draw-text",
|
|
781
|
-
text: view.message,
|
|
782
|
-
position: pos,
|
|
783
|
-
offsetY: -(0.15 + 0.55 * progress),
|
|
784
|
-
color: view.color ?? node.textColor ?? DEFAULT_TEXT_COLOR,
|
|
785
|
-
opacity: fade,
|
|
786
|
-
font: `bold ${pxSize ?? 14}px ${family}`
|
|
787
|
-
};
|
|
788
|
-
out.push(text);
|
|
789
|
-
}
|
|
790
|
-
return out;
|
|
791
|
-
}
|
|
792
|
-
function expandFxLayer(node, epochNowMs, dim, projector, fontFamily) {
|
|
793
|
-
if (!Array.isArray(node.items)) return [];
|
|
794
|
-
const out = [];
|
|
795
|
-
for (const item of node.items) {
|
|
796
|
-
if (!item || typeof item.id !== "string") continue;
|
|
797
|
-
out.push(...expandFxItem(resolveFxView(item, node.presets), node, epochNowMs, dim, projector, fontFamily));
|
|
798
|
-
}
|
|
799
|
-
return out;
|
|
548
|
+
return JSON.parse(kernelEvaluator().expandFxLayer(JSON.stringify(layer), epochNowMs, dim, tileWidth));
|
|
800
549
|
}
|
|
801
550
|
function DrawFxLayer(_props) {
|
|
802
551
|
return null;
|
|
@@ -1151,7 +900,7 @@ function drawMarker(ctx, theme, x1, y1, x2, y2, color, width) {
|
|
|
1151
900
|
}
|
|
1152
901
|
ctx.restore();
|
|
1153
902
|
}
|
|
1154
|
-
function useCanvasTheme(scopeRef) {
|
|
903
|
+
function useCanvasTheme(scopeRef, scopePresent = true) {
|
|
1155
904
|
const { appliedTheme } = useTheme();
|
|
1156
905
|
const scopeKey = JSON.stringify(useThemeScope());
|
|
1157
906
|
const [state, setState] = useState({ theme: null, version: 0 });
|
|
@@ -1160,7 +909,7 @@ function useCanvasTheme(scopeRef) {
|
|
|
1160
909
|
if (!scope) return;
|
|
1161
910
|
const theme = resolveCanvasTheme(scope);
|
|
1162
911
|
setState((prev) => ({ theme, version: prev.version + 1 }));
|
|
1163
|
-
}, [appliedTheme, scopeKey, scopeRef]);
|
|
912
|
+
}, [appliedTheme, scopeKey, scopeRef, scopePresent]);
|
|
1164
913
|
return state;
|
|
1165
914
|
}
|
|
1166
915
|
|