@energy8platform/golem 0.6.0 → 0.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/README.md +14 -0
- package/dist/editor.css +3 -4
- package/dist/editor.js +108 -61
- package/dist/lib/cli.js +101 -70
- package/dist/lib/cli.js.map +4 -4
- package/dist/lib/e8/agent.d.ts +35 -0
- package/dist/lib/e8/host.d.ts +22 -0
- package/dist/lib/e8/node.d.ts +66 -0
- package/dist/lib/e8/runtime.d.ts +10 -0
- package/dist/lib/e8/schema.d.ts +3 -0
- package/dist/lib/e8/types.d.ts +80 -0
- package/dist/lib/e8-agent.js +6781 -0
- package/dist/lib/e8-agent.js.map +7 -0
- package/dist/lib/e8-client.js +116 -0
- package/dist/lib/e8-host.js +6929 -0
- package/dist/lib/e8-host.js.map +7 -0
- package/dist/lib/e8-runtime.js +2024 -0
- package/dist/lib/e8-runtime.js.map +7 -0
- package/dist/lib/e8-schema.js +7 -0
- package/dist/lib/e8-schema.js.map +7 -0
- package/dist/lib/editor/api.d.ts +1 -0
- package/dist/lib/editor/embed.d.ts +9 -0
- package/dist/lib/editor/server.d.ts +23 -1
- package/dist/lib/editor/store.d.ts +2 -0
- package/dist/lib/editor/timeline.d.ts +15 -0
- package/dist/lib/editor-entry.d.ts +1 -1
- package/dist/lib/editor-entry.js +102 -70
- package/dist/lib/editor-entry.js.map +4 -4
- package/dist/lib/rig-import-layers.d.ts +2 -0
- package/dist/lib/rig-version.d.ts +12 -0
- package/dist/lib/tool-schema.d.ts +3 -0
- package/dist/lib/tools.d.ts +2 -0
- package/dist/lib/tools.js +49 -10
- package/dist/lib/tools.js.map +4 -4
- package/editor.html +2 -2
- package/package.json +38 -3
- package/skills/e8-golem/SKILL.md +71 -0
- package/skills/golem-symbol-animation/SKILL.md +87 -0
- package/skills/golem-symbol-animation/agents/openai.yaml +4 -0
- package/skills/golem-symbol-animation/references/facial-controls.md +48 -0
- package/skills/golem-symbol-animation/references/game-engine-integration.md +133 -0
- package/skills/golem-symbol-animation/references/golem-authoring.md +138 -0
- package/skills/golem-symbol-animation/references/interactive-editor.md +17 -0
- package/skills/golem-symbol-animation/references/motion-craft.md +113 -0
- package/skills/golem-symbol-animation/references/packed-delivery.md +88 -0
- package/skills/golem-symbol-animation/references/quantitative-qa.md +106 -0
- package/skills/golem-symbol-animation/references/spine-rive-study.md +87 -0
- package/skills/golem-symbol-animation/scripts/atlas_parts.py +87 -0
- package/skills/golem-symbol-animation/scripts/check_package.py +71 -0
- package/skills/golem-symbol-animation/scripts/image_gates.py +143 -0
- package/skills/golem-symbol-cutting/SKILL.md +70 -0
- package/skills/golem-symbol-cutting/agents/openai.yaml +4 -0
- package/skills/golem-symbol-cutting/assets/h1/h1.atlas.png +0 -0
- package/skills/golem-symbol-cutting/assets/h1/h1.png +0 -0
- package/skills/golem-symbol-cutting/references/cutting-workflow.md +92 -0
- package/skills/golem-symbol-cutting/references/facial-layers.md +44 -0
- package/skills/golem-symbol-cutting/references/generation-workflow.md +109 -0
- package/skills/golem-symbol-cutting/references/golem-handoff.md +62 -0
- package/skills/golem-symbol-cutting/references/h1-example.md +46 -0
- package/skills/golem-symbol-cutting/references/hybrid-workflow.md +119 -0
- package/skills/golem-symbol-cutting/references/registration-and-motion.md +89 -0
- package/skills/golem-symbol-cutting/references/spine-rive-construction.md +73 -0
- package/skills/golem-symbol-cutting/scripts/atlas_parts.py +87 -0
- package/skills/golem-symbol-cutting/scripts/hybrid_parts.py +279 -0
package/README.md
CHANGED
|
@@ -200,6 +200,20 @@ for p in symbol_idle symbol_win dim; do npm run rig -- rig_apply_preset '{"path"
|
|
|
200
200
|
npm run rig -- rig_render_preview '{"path":"'$S'","animation":"win","fps":10,"onionSkin":true,"scale":0.5,"saveTo":"examples/symbol/out/win.png"}'
|
|
201
201
|
```
|
|
202
202
|
|
|
203
|
+
## Модуль e8-engine
|
|
204
|
+
|
|
205
|
+
golem — e8-row `golem1` (`@energy8platform/golem`). Что даёт: тулы `rig_*` в MCP e8, node `golem` в сцене, вкладка
|
|
206
|
+
редактора для `rig.json` в IDE, undo через историю golem. Риги лежат в `assets/rigs/<name>/`.
|
|
207
|
+
|
|
208
|
+
Node `golem` в игре, тулы `rig_*` и skills приходят со строкой `golem1` бандла `e8-base` (проект без него добавляет ту же
|
|
209
|
+
строку в `e8.patch.yml`). Строка в `e8.yml` добавляет вкладку редактора `rig.json` в IDE и мост undo:
|
|
210
|
+
|
|
211
|
+
```yaml
|
|
212
|
+
- id: golem1
|
|
213
|
+
name: '@energy8platform/golem'
|
|
214
|
+
config: {}
|
|
215
|
+
```
|
|
216
|
+
|
|
203
217
|
## Шаг 3 — слои (риск №1 закрыт)
|
|
204
218
|
|
|
205
219
|
Спайк сегментации на `cashier.png` (артефакты удалены при чистке репозитория): вырезание из плоской картинки + bleed 6 px даёт чистый
|
package/dist/editor.css
CHANGED
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
--ctl-line:#3C3C3C;
|
|
14
14
|
--err:#F14C4C;
|
|
15
15
|
--warn:#CCA700;
|
|
16
|
+
--font:-apple-system,"Segoe UI",sans-serif;
|
|
17
|
+
--size:13px;
|
|
16
18
|
--r-xs:2px;
|
|
17
19
|
--r-s:4px;
|
|
18
20
|
--r-m:6px;
|
|
@@ -26,10 +28,7 @@ body {
|
|
|
26
28
|
height: 100%;
|
|
27
29
|
background: var(--chrome);
|
|
28
30
|
color: var(--fg);
|
|
29
|
-
font:
|
|
30
|
-
13px -apple-system,
|
|
31
|
-
"Segoe UI",
|
|
32
|
-
sans-serif;
|
|
31
|
+
font: var(--size) var(--font);
|
|
33
32
|
user-select: none;
|
|
34
33
|
}
|
|
35
34
|
#app {
|
package/dist/editor.js
CHANGED
|
@@ -43308,7 +43308,7 @@ var require_gifenc = __commonJS({
|
|
|
43308
43308
|
bins[nb.fw].bk = nb.bk;
|
|
43309
43309
|
nb.mtm = bincountMinusOne;
|
|
43310
43310
|
}
|
|
43311
|
-
let
|
|
43311
|
+
let palette2 = [];
|
|
43312
43312
|
var k4 = 0;
|
|
43313
43313
|
for (i6 = 0; ; ++k4) {
|
|
43314
43314
|
let r5 = clamp3(Math.round(bins[i6].rc), 0, 255);
|
|
@@ -43327,17 +43327,17 @@ var require_gifenc = __commonJS({
|
|
|
43327
43327
|
}
|
|
43328
43328
|
}
|
|
43329
43329
|
const color = hasAlpha ? [r5, g4, b4, a5] : [r5, g4, b4];
|
|
43330
|
-
const exists = existsInPalette(
|
|
43330
|
+
const exists = existsInPalette(palette2, color);
|
|
43331
43331
|
if (!exists)
|
|
43332
|
-
|
|
43332
|
+
palette2.push(color);
|
|
43333
43333
|
if ((i6 = bins[i6].fw) == 0)
|
|
43334
43334
|
break;
|
|
43335
43335
|
}
|
|
43336
|
-
return
|
|
43336
|
+
return palette2;
|
|
43337
43337
|
}
|
|
43338
|
-
function existsInPalette(
|
|
43339
|
-
for (let i6 = 0; i6 <
|
|
43340
|
-
const p6 =
|
|
43338
|
+
function existsInPalette(palette2, color) {
|
|
43339
|
+
for (let i6 = 0; i6 < palette2.length; i6++) {
|
|
43340
|
+
const p6 = palette2[i6];
|
|
43341
43341
|
let matchesRGB = p6[0] === color[0] && p6[1] === color[1] && p6[2] === color[2];
|
|
43342
43342
|
let matchesAlpha = p6.length >= 4 && color.length >= 4 ? p6[3] === color[3] : true;
|
|
43343
43343
|
if (matchesRGB && matchesAlpha)
|
|
@@ -43376,14 +43376,14 @@ var require_gifenc = __commonJS({
|
|
|
43376
43376
|
data[i6] = a5 << 24 | b4 << 16 | g4 << 8 | r5 << 0;
|
|
43377
43377
|
}
|
|
43378
43378
|
}
|
|
43379
|
-
function applyPalette2(rgba,
|
|
43379
|
+
function applyPalette2(rgba, palette2, format = "rgb565") {
|
|
43380
43380
|
if (!rgba || !rgba.buffer) {
|
|
43381
43381
|
throw new Error("quantize() expected RGBA Uint8Array data");
|
|
43382
43382
|
}
|
|
43383
43383
|
if (!(rgba instanceof Uint8Array) && !(rgba instanceof Uint8ClampedArray)) {
|
|
43384
43384
|
throw new Error("quantize() expected RGBA Uint8Array data");
|
|
43385
43385
|
}
|
|
43386
|
-
if (
|
|
43386
|
+
if (palette2.length > 256) {
|
|
43387
43387
|
throw new Error("applyPalette() only works with 256 colors or less");
|
|
43388
43388
|
}
|
|
43389
43389
|
const data = new Uint32Array(rgba.buffer);
|
|
@@ -43400,7 +43400,7 @@ var require_gifenc = __commonJS({
|
|
|
43400
43400
|
const g4 = color >> 8 & 255;
|
|
43401
43401
|
const r5 = color & 255;
|
|
43402
43402
|
const key = rgba8888_to_rgba4444(r5, g4, b4, a5);
|
|
43403
|
-
const idx = key in cache ? cache[key] : cache[key] = nearestColorIndexRGBA(r5, g4, b4, a5,
|
|
43403
|
+
const idx = key in cache ? cache[key] : cache[key] = nearestColorIndexRGBA(r5, g4, b4, a5, palette2);
|
|
43404
43404
|
index[i6] = idx;
|
|
43405
43405
|
}
|
|
43406
43406
|
} else {
|
|
@@ -43411,17 +43411,17 @@ var require_gifenc = __commonJS({
|
|
|
43411
43411
|
const g4 = color >> 8 & 255;
|
|
43412
43412
|
const r5 = color & 255;
|
|
43413
43413
|
const key = rgb888_to_key(r5, g4, b4);
|
|
43414
|
-
const idx = key in cache ? cache[key] : cache[key] = nearestColorIndexRGB(r5, g4, b4,
|
|
43414
|
+
const idx = key in cache ? cache[key] : cache[key] = nearestColorIndexRGB(r5, g4, b4, palette2);
|
|
43415
43415
|
index[i6] = idx;
|
|
43416
43416
|
}
|
|
43417
43417
|
}
|
|
43418
43418
|
return index;
|
|
43419
43419
|
}
|
|
43420
|
-
function nearestColorIndexRGBA(r5, g4, b4, a5,
|
|
43420
|
+
function nearestColorIndexRGBA(r5, g4, b4, a5, palette2) {
|
|
43421
43421
|
let k4 = 0;
|
|
43422
43422
|
let mindist = 1e100;
|
|
43423
|
-
for (let i6 = 0; i6 <
|
|
43424
|
-
const px2 =
|
|
43423
|
+
for (let i6 = 0; i6 < palette2.length; i6++) {
|
|
43424
|
+
const px2 = palette2[i6];
|
|
43425
43425
|
const a22 = px2[3];
|
|
43426
43426
|
let curdist = sqr2(a22 - a5);
|
|
43427
43427
|
if (curdist > mindist)
|
|
@@ -43443,11 +43443,11 @@ var require_gifenc = __commonJS({
|
|
|
43443
43443
|
}
|
|
43444
43444
|
return k4;
|
|
43445
43445
|
}
|
|
43446
|
-
function nearestColorIndexRGB(r5, g4, b4,
|
|
43446
|
+
function nearestColorIndexRGB(r5, g4, b4, palette2) {
|
|
43447
43447
|
let k4 = 0;
|
|
43448
43448
|
let mindist = 1e100;
|
|
43449
|
-
for (let i6 = 0; i6 <
|
|
43450
|
-
const px2 =
|
|
43449
|
+
for (let i6 = 0; i6 < palette2.length; i6++) {
|
|
43450
|
+
const px2 = palette2[i6];
|
|
43451
43451
|
const r22 = px2[0];
|
|
43452
43452
|
let curdist = sqr2(r22 - r5);
|
|
43453
43453
|
if (curdist > mindist)
|
|
@@ -43465,12 +43465,12 @@ var require_gifenc = __commonJS({
|
|
|
43465
43465
|
}
|
|
43466
43466
|
return k4;
|
|
43467
43467
|
}
|
|
43468
|
-
function snapColorsToPalette(
|
|
43469
|
-
if (!
|
|
43468
|
+
function snapColorsToPalette(palette2, knownColors, threshold = 5) {
|
|
43469
|
+
if (!palette2.length || !knownColors.length)
|
|
43470
43470
|
return;
|
|
43471
|
-
const paletteRGB =
|
|
43471
|
+
const paletteRGB = palette2.map((p6) => p6.slice(0, 3));
|
|
43472
43472
|
const thresholdSq = threshold * threshold;
|
|
43473
|
-
const dim2 =
|
|
43473
|
+
const dim2 = palette2[0].length;
|
|
43474
43474
|
for (let i6 = 0; i6 < knownColors.length; i6++) {
|
|
43475
43475
|
let color = knownColors[i6];
|
|
43476
43476
|
if (color.length < dim2) {
|
|
@@ -43484,7 +43484,7 @@ var require_gifenc = __commonJS({
|
|
|
43484
43484
|
const idx = r5[0];
|
|
43485
43485
|
const distanceSq = r5[1];
|
|
43486
43486
|
if (distanceSq > 0 && distanceSq <= thresholdSq) {
|
|
43487
|
-
|
|
43487
|
+
palette2[idx] = color;
|
|
43488
43488
|
}
|
|
43489
43489
|
}
|
|
43490
43490
|
}
|
|
@@ -43554,7 +43554,7 @@ var require_gifenc = __commonJS({
|
|
|
43554
43554
|
transparent = false,
|
|
43555
43555
|
transparentIndex = 0,
|
|
43556
43556
|
delay = 0,
|
|
43557
|
-
palette = null,
|
|
43557
|
+
palette: palette2 = null,
|
|
43558
43558
|
repeat = 0,
|
|
43559
43559
|
colorDepth = 8,
|
|
43560
43560
|
dispose = -1
|
|
@@ -43572,21 +43572,21 @@ var require_gifenc = __commonJS({
|
|
|
43572
43572
|
width = Math.max(0, Math.floor(width));
|
|
43573
43573
|
height = Math.max(0, Math.floor(height));
|
|
43574
43574
|
if (first) {
|
|
43575
|
-
if (!
|
|
43575
|
+
if (!palette2) {
|
|
43576
43576
|
throw new Error("First frame must include a { palette } option");
|
|
43577
43577
|
}
|
|
43578
|
-
encodeLogicalScreenDescriptor(stream, width, height,
|
|
43579
|
-
encodeColorTable(stream,
|
|
43578
|
+
encodeLogicalScreenDescriptor(stream, width, height, palette2, colorDepth);
|
|
43579
|
+
encodeColorTable(stream, palette2);
|
|
43580
43580
|
if (repeat >= 0) {
|
|
43581
43581
|
encodeNetscapeExt(stream, repeat);
|
|
43582
43582
|
}
|
|
43583
43583
|
}
|
|
43584
43584
|
const delayTime = Math.round(delay / 10);
|
|
43585
43585
|
encodeGraphicControlExt(stream, dispose, delayTime, transparent, transparentIndex);
|
|
43586
|
-
const useLocalColorTable = Boolean(
|
|
43587
|
-
encodeImageDescriptor(stream, width, height, useLocalColorTable ?
|
|
43586
|
+
const useLocalColorTable = Boolean(palette2) && !first;
|
|
43587
|
+
encodeImageDescriptor(stream, width, height, useLocalColorTable ? palette2 : null);
|
|
43588
43588
|
if (useLocalColorTable)
|
|
43589
|
-
encodeColorTable(stream,
|
|
43589
|
+
encodeColorTable(stream, palette2);
|
|
43590
43590
|
encodePixels(stream, index, width, height, colorDepth, accum, htab, codetab);
|
|
43591
43591
|
}
|
|
43592
43592
|
};
|
|
@@ -43620,10 +43620,10 @@ var require_gifenc = __commonJS({
|
|
|
43620
43620
|
stream.writeByte(transparentIndex || 0);
|
|
43621
43621
|
stream.writeByte(0);
|
|
43622
43622
|
}
|
|
43623
|
-
function encodeLogicalScreenDescriptor(stream, width, height,
|
|
43623
|
+
function encodeLogicalScreenDescriptor(stream, width, height, palette2, colorDepth = 8) {
|
|
43624
43624
|
const globalColorTableFlag = 1;
|
|
43625
43625
|
const sortFlag = 0;
|
|
43626
|
-
const globalColorTableSize = colorTableSize(
|
|
43626
|
+
const globalColorTableSize = colorTableSize(palette2.length) - 1;
|
|
43627
43627
|
const fields = globalColorTableFlag << 7 | colorDepth - 1 << 4 | sortFlag << 3 | globalColorTableSize;
|
|
43628
43628
|
const backgroundColorIndex = 0;
|
|
43629
43629
|
const pixelAspectRatio = 0;
|
|
@@ -43641,12 +43641,12 @@ var require_gifenc = __commonJS({
|
|
|
43641
43641
|
writeUInt16(stream, repeat);
|
|
43642
43642
|
stream.writeByte(0);
|
|
43643
43643
|
}
|
|
43644
|
-
function encodeColorTable(stream,
|
|
43645
|
-
const colorTableLength = 1 << colorTableSize(
|
|
43644
|
+
function encodeColorTable(stream, palette2) {
|
|
43645
|
+
const colorTableLength = 1 << colorTableSize(palette2.length);
|
|
43646
43646
|
for (let i6 = 0; i6 < colorTableLength; i6++) {
|
|
43647
43647
|
let color = [0, 0, 0];
|
|
43648
|
-
if (i6 <
|
|
43649
|
-
color =
|
|
43648
|
+
if (i6 < palette2.length) {
|
|
43649
|
+
color = palette2[i6];
|
|
43650
43650
|
}
|
|
43651
43651
|
stream.writeByte(color[0]);
|
|
43652
43652
|
stream.writeByte(color[1]);
|
|
@@ -49210,8 +49210,8 @@ function validate(doc2) {
|
|
|
49210
49210
|
if (tracks.has(tid)) errs.push(`animation "${a5.id}": duplicate track ${tid}`);
|
|
49211
49211
|
tracks.add(tid);
|
|
49212
49212
|
if (driven.has(tid)) errs.push(`animation "${a5.id}": ${tid} is controlled by a binding; animate its control instead`);
|
|
49213
|
-
const
|
|
49214
|
-
if (!
|
|
49213
|
+
const known2 = t5.target === "bone" ? bones.has(t5.id) : t5.target === "slot" ? slots.has(t5.id) : t5.target === "deform" ? attachments.has(t5.id) : t5.target === "ik" ? iks.has(t5.id) : t5.target === "transform" ? transforms.has(t5.id) : t5.target === "path" ? paths.has(t5.id) : t5.target === "control" ? controls.has(t5.id) : true;
|
|
49214
|
+
if (!known2) errs.push(`animation "${a5.id}": unknown ${t5.target} "${t5.id}"`);
|
|
49215
49215
|
const bound = t5.target === "deform" ? DEFORM_BOUNDS[t5.prop] : void 0;
|
|
49216
49216
|
const att = t5.target === "deform" ? attachments.get(t5.id) : void 0;
|
|
49217
49217
|
let prev = -1;
|
|
@@ -50958,12 +50958,12 @@ var json = async (res) => {
|
|
|
50958
50958
|
return body;
|
|
50959
50959
|
};
|
|
50960
50960
|
async function getDoc(rig) {
|
|
50961
|
-
const r5 = await json(await fetch(
|
|
50961
|
+
const r5 = await json(await fetch(`api/doc?rig=${encodeURIComponent(rig)}`));
|
|
50962
50962
|
if (r5.isError) throw new Error(String(r5.text).replace(/^ERROR: /, ""));
|
|
50963
50963
|
return r5;
|
|
50964
50964
|
}
|
|
50965
50965
|
async function callTool(rig, name, args, baseVersion) {
|
|
50966
|
-
const res = await fetch(
|
|
50966
|
+
const res = await fetch(`api/tool/${encodeURIComponent(name)}`, {
|
|
50967
50967
|
method: "POST",
|
|
50968
50968
|
headers: { "content-type": "application/json" },
|
|
50969
50969
|
body: JSON.stringify({ rig, args, baseVersion })
|
|
@@ -50971,25 +50971,25 @@ async function callTool(rig, name, args, baseVersion) {
|
|
|
50971
50971
|
return { ...await json(res), status: res.status };
|
|
50972
50972
|
}
|
|
50973
50973
|
function subscribe(rig, onChanged, onState) {
|
|
50974
|
-
const es = new EventSource(
|
|
50974
|
+
const es = new EventSource(`api/events?rig=${encodeURIComponent(rig)}`);
|
|
50975
50975
|
es.addEventListener("changed", (e5) => onChanged(JSON.parse(e5.data).version));
|
|
50976
50976
|
es.onopen = () => onState(true);
|
|
50977
50977
|
es.onerror = () => onState(false);
|
|
50978
50978
|
return () => es.close();
|
|
50979
50979
|
}
|
|
50980
|
-
var assetUrl = (rigDir2, src) =>
|
|
50980
|
+
var assetUrl = (rigDir2, src) => `rig/${rigDir2 ? rigDir2 + "/" : ""}${src}`;
|
|
50981
50981
|
async function listRigs() {
|
|
50982
|
-
return json(await fetch("
|
|
50982
|
+
return json(await fetch("api/rigs"));
|
|
50983
50983
|
}
|
|
50984
50984
|
async function createRig(rig, name, width, height) {
|
|
50985
|
-
const res = await fetch("
|
|
50985
|
+
const res = await fetch("api/rigs", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ rig, name, width, height }) });
|
|
50986
50986
|
return { ...await json(res), status: res.status };
|
|
50987
50987
|
}
|
|
50988
50988
|
async function listFiles(rig) {
|
|
50989
|
-
return json(await fetch(
|
|
50989
|
+
return json(await fetch(`api/files?rig=${encodeURIComponent(rig)}`));
|
|
50990
50990
|
}
|
|
50991
50991
|
async function upload(rig, file) {
|
|
50992
|
-
const res = await fetch(
|
|
50992
|
+
const res = await fetch(`api/upload?rig=${encodeURIComponent(rig)}&name=${encodeURIComponent(file.name)}`, { method: "POST", headers: { "content-type": "image/png" }, body: file });
|
|
50993
50993
|
const r5 = await json(res);
|
|
50994
50994
|
if (r5.isError) throw new Error(String(r5.text).replace(/^ERROR: /, ""));
|
|
50995
50995
|
return r5;
|
|
@@ -51409,6 +51409,7 @@ __export(store_exports, {
|
|
|
51409
51409
|
drawOrderFront: () => drawOrderFront,
|
|
51410
51410
|
drivenBy: () => drivenBy,
|
|
51411
51411
|
editable: () => editable,
|
|
51412
|
+
embedded: () => embedded,
|
|
51412
51413
|
ensureTemplate: () => ensureTemplate,
|
|
51413
51414
|
externalChange: () => externalChange,
|
|
51414
51415
|
files: () => files,
|
|
@@ -51595,6 +51596,7 @@ function hitMesh(v6, tri, px, py) {
|
|
|
51595
51596
|
var params = new URLSearchParams(typeof location === "undefined" ? "" : location.search);
|
|
51596
51597
|
var rigPath = params.get("rig") || "examples/hero/rig.json";
|
|
51597
51598
|
var rigDir = rigPath.slice(0, Math.max(0, rigPath.lastIndexOf("/")));
|
|
51599
|
+
var embedded = params.get("embed") === "1";
|
|
51598
51600
|
var doc = y3(void 0);
|
|
51599
51601
|
var draft = y3(void 0);
|
|
51600
51602
|
var shown = g2(() => draft.value ?? doc.value);
|
|
@@ -58880,8 +58882,8 @@ var Stage = class {
|
|
|
58880
58882
|
void p6.play(anim.id, { loop: false, mix: 0 });
|
|
58881
58883
|
p6.tick(i6 / fps);
|
|
58882
58884
|
const { pixels } = this.app.renderer.extract.pixels({ target: this.camera, frame });
|
|
58883
|
-
const
|
|
58884
|
-
gif.writeFrame((0, import_gifenc.applyPalette)(pixels,
|
|
58885
|
+
const palette2 = (0, import_gifenc.quantize)(pixels, 256);
|
|
58886
|
+
gif.writeFrame((0, import_gifenc.applyPalette)(pixels, palette2), w5, h6, { palette: palette2, delay: 1e3 / fps });
|
|
58885
58887
|
setStatus(`gif: frame ${i6 + 1}/${n4}`);
|
|
58886
58888
|
await new Promise((r5) => setTimeout(r5));
|
|
58887
58889
|
}
|
|
@@ -59695,9 +59697,9 @@ var KEY_HIT = 5;
|
|
|
59695
59697
|
var times2 = (ts) => [...new Set(ts.flatMap((t5) => t5.keys.map((k4) => k4.t)))].sort((a5, b4) => a5 - b4);
|
|
59696
59698
|
function rows(doc2, anim) {
|
|
59697
59699
|
const out2 = [{ kind: "all", label: "all keys", keys: times2(anim.tracks), depth: 0 }];
|
|
59698
|
-
const push = (target,
|
|
59700
|
+
const push = (target, known2) => {
|
|
59699
59701
|
const mine = anim.tracks.filter((t5) => t5.target === target);
|
|
59700
|
-
const ids = [.../* @__PURE__ */ new Set([...
|
|
59702
|
+
const ids = [.../* @__PURE__ */ new Set([...known2.filter((id) => mine.some((t5) => t5.id === id)), ...mine.map((t5) => t5.id)])];
|
|
59701
59703
|
for (const id of ids) {
|
|
59702
59704
|
const own = mine.filter((t5) => t5.id === id);
|
|
59703
59705
|
out2.push({ kind: "group", label: id, keys: times2(own), depth: 0 });
|
|
@@ -59763,14 +59765,19 @@ function clampDuration(requested, lastKeyOrEventTime, fps) {
|
|
|
59763
59765
|
}
|
|
59764
59766
|
|
|
59765
59767
|
// src/editor/timeline.ts
|
|
59766
|
-
var
|
|
59767
|
-
|
|
59768
|
-
|
|
59769
|
-
|
|
59770
|
-
|
|
59771
|
-
|
|
59772
|
-
|
|
59773
|
-
|
|
59768
|
+
var TOKENS = {
|
|
59769
|
+
PANEL: ["--chrome", "#181818"],
|
|
59770
|
+
ALT: ["--bg", "#1E1E1E"],
|
|
59771
|
+
LINE: ["--line", "#2B2B2B"],
|
|
59772
|
+
CTL_LINE: ["--ctl-line", "#3C3C3C"],
|
|
59773
|
+
ACCENT: ["--accent", "#0078D4"],
|
|
59774
|
+
FG: ["--fg", "#CCCCCC"],
|
|
59775
|
+
FG2: ["--fg2", "#9D9D9D"],
|
|
59776
|
+
ERR: ["--err", "#F14C4C"]
|
|
59777
|
+
};
|
|
59778
|
+
function palette(style) {
|
|
59779
|
+
return Object.fromEntries(Object.entries(TOKENS).map(([k4, [token, fallback]]) => [k4, style.getPropertyValue(token).trim() || fallback]));
|
|
59780
|
+
}
|
|
59774
59781
|
var LEFT = 220;
|
|
59775
59782
|
var ROW_H = 20;
|
|
59776
59783
|
var HEADER_H = 24;
|
|
@@ -59800,6 +59807,9 @@ var Timeline = class {
|
|
|
59800
59807
|
selectedKeys.value;
|
|
59801
59808
|
f3(() => this.draw());
|
|
59802
59809
|
}));
|
|
59810
|
+
const retheme = () => f3(() => this.draw());
|
|
59811
|
+
window.addEventListener("golem:theme", retheme);
|
|
59812
|
+
this.dispose.push(() => window.removeEventListener("golem:theme", retheme));
|
|
59803
59813
|
this.bindPointer();
|
|
59804
59814
|
this.resize();
|
|
59805
59815
|
}
|
|
@@ -59870,6 +59880,7 @@ var Timeline = class {
|
|
|
59870
59880
|
g4.fill();
|
|
59871
59881
|
}
|
|
59872
59882
|
draw() {
|
|
59883
|
+
const { PANEL, ALT, LINE, CTL_LINE, ACCENT: ACCENT4, FG, FG2, ERR } = palette(getComputedStyle(document.documentElement));
|
|
59873
59884
|
const g4 = this.g, w5 = this.w, h6 = this.h, l6 = this.layout();
|
|
59874
59885
|
const anim = currentAnim.value, rs = this.rowsNow(), d6 = this.drag;
|
|
59875
59886
|
const dur = d6?.kind === "duration" ? d6.duration : anim?.duration ?? 0;
|
|
@@ -60300,6 +60311,41 @@ function ControlForms() {
|
|
|
60300
60311
|
] });
|
|
60301
60312
|
}
|
|
60302
60313
|
|
|
60314
|
+
// src/editor/embed.ts
|
|
60315
|
+
var THEME_TOKENS = [
|
|
60316
|
+
"--bg",
|
|
60317
|
+
"--panel",
|
|
60318
|
+
"--chrome",
|
|
60319
|
+
"--line",
|
|
60320
|
+
"--accent",
|
|
60321
|
+
"--accent-hover",
|
|
60322
|
+
"--fg",
|
|
60323
|
+
"--fg2",
|
|
60324
|
+
"--ctl",
|
|
60325
|
+
"--ctl-hover",
|
|
60326
|
+
"--ctl-line",
|
|
60327
|
+
"--err",
|
|
60328
|
+
"--warn",
|
|
60329
|
+
"--font",
|
|
60330
|
+
"--size"
|
|
60331
|
+
];
|
|
60332
|
+
var known = new Set(THEME_TOKENS);
|
|
60333
|
+
function themeVars(data) {
|
|
60334
|
+
if (!data || typeof data !== "object" || data.type !== "golem:theme") return [];
|
|
60335
|
+
const vars = data.vars;
|
|
60336
|
+
if (!vars || typeof vars !== "object") return [];
|
|
60337
|
+
return Object.entries(vars).filter((e5) => known.has(e5[0]) && typeof e5[1] === "string");
|
|
60338
|
+
}
|
|
60339
|
+
function listenForTheme(win = window) {
|
|
60340
|
+
const on = (e5) => {
|
|
60341
|
+
if (e5.origin !== win.location.origin) return;
|
|
60342
|
+
for (const [name, value] of themeVars(e5.data)) win.document.documentElement.style.setProperty(name, value);
|
|
60343
|
+
win.dispatchEvent(new Event("golem:theme"));
|
|
60344
|
+
};
|
|
60345
|
+
win.addEventListener("message", on);
|
|
60346
|
+
return () => win.removeEventListener("message", on);
|
|
60347
|
+
}
|
|
60348
|
+
|
|
60303
60349
|
// src/editor/app.tsx
|
|
60304
60350
|
var stage;
|
|
60305
60351
|
var timeline;
|
|
@@ -60461,7 +60507,7 @@ function OpenList() {
|
|
|
60461
60507
|
const body = rigsLoading.value ? /* @__PURE__ */ u4("div", { class: "rig", children: "loading\u2026" }) : rigsError.value ? /* @__PURE__ */ u4("div", { class: "rig error", children: [
|
|
60462
60508
|
"open: ",
|
|
60463
60509
|
rigsError.value
|
|
60464
|
-
] }) : rigs.value.length ? rigs.value.map((r5) => /* @__PURE__ */ u4("a", { class: "rig", "data-rig": r5.rig, href:
|
|
60510
|
+
] }) : rigs.value.length ? rigs.value.map((r5) => /* @__PURE__ */ u4("a", { class: "rig", "data-rig": r5.rig, href: `editor.html?rig=${encodeURIComponent(r5.rig)}`, children: [
|
|
60465
60511
|
/* @__PURE__ */ u4("b", { children: r5.name }),
|
|
60466
60512
|
" ",
|
|
60467
60513
|
/* @__PURE__ */ u4("span", { class: "path", children: r5.rig }),
|
|
@@ -60493,7 +60539,7 @@ function NewForm() {
|
|
|
60493
60539
|
setStatus(String(r5.text).replace(/^ERROR: /, ""), "error");
|
|
60494
60540
|
return;
|
|
60495
60541
|
}
|
|
60496
|
-
location.href =
|
|
60542
|
+
location.href = `editor.html?rig=${encodeURIComponent(`${dir}/rig.json`)}`;
|
|
60497
60543
|
} catch (e5) {
|
|
60498
60544
|
setStatus(`new: ${e5.message}`, "error");
|
|
60499
60545
|
}
|
|
@@ -60633,8 +60679,8 @@ function TopBar() {
|
|
|
60633
60679
|
/* @__PURE__ */ u4("input", { class: "lock", type: "checkbox", checked: lockImages.value, onChange: (e5) => lockImages.value = e5.target.checked }),
|
|
60634
60680
|
"lock images"
|
|
60635
60681
|
] }),
|
|
60636
|
-
/* @__PURE__ */ u4("button", { class: "new", onClick: click(() => popover.value = popover.peek() === "new" ? void 0 : "new"), children: "new" }),
|
|
60637
|
-
/* @__PURE__ */ u4("button", { class: "open", onClick: click(() => {
|
|
60682
|
+
!embedded && /* @__PURE__ */ u4("button", { class: "new", onClick: click(() => popover.value = popover.peek() === "new" ? void 0 : "new"), children: "new" }),
|
|
60683
|
+
!embedded && /* @__PURE__ */ u4("button", { class: "open", onClick: click(() => {
|
|
60638
60684
|
if (popover.peek() === "open") {
|
|
60639
60685
|
closePopover();
|
|
60640
60686
|
return;
|
|
@@ -60894,6 +60940,7 @@ function App() {
|
|
|
60894
60940
|
/* @__PURE__ */ u4(Splitter, { edge: "tl" })
|
|
60895
60941
|
] });
|
|
60896
60942
|
}
|
|
60943
|
+
if (embedded) listenForTheme();
|
|
60897
60944
|
restoreLayout();
|
|
60898
60945
|
R(/* @__PURE__ */ u4(App, {}), document.getElementById("app"));
|
|
60899
60946
|
await reload();
|