@energy8platform/golem 0.1.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.
Files changed (62) hide show
  1. package/README.md +376 -0
  2. package/bin/golem.js +2 -0
  3. package/dist/editor.css +701 -0
  4. package/dist/editor.js +59202 -0
  5. package/dist/lib/cli.d.ts +1 -0
  6. package/dist/lib/cli.js +5521 -0
  7. package/dist/lib/cli.js.map +7 -0
  8. package/dist/lib/editor/api.d.ts +42 -0
  9. package/dist/lib/editor/app.d.ts +13 -0
  10. package/dist/lib/editor/atlas-detect.d.ts +28 -0
  11. package/dist/lib/editor/atlas-panel.d.ts +1 -0
  12. package/dist/lib/editor/atlas.d.ts +39 -0
  13. package/dist/lib/editor/gizmo-math.d.ts +36 -0
  14. package/dist/lib/editor/gizmos.d.ts +185 -0
  15. package/dist/lib/editor/layers.d.ts +1 -0
  16. package/dist/lib/editor/library.d.ts +3 -0
  17. package/dist/lib/editor/panels.d.ts +26 -0
  18. package/dist/lib/editor/props.d.ts +19 -0
  19. package/dist/lib/editor/server.d.ts +11 -0
  20. package/dist/lib/editor/stage.d.ts +222 -0
  21. package/dist/lib/editor/store.d.ts +1053 -0
  22. package/dist/lib/editor/timeline-layout.d.ts +64 -0
  23. package/dist/lib/editor/timeline.d.ts +45 -0
  24. package/dist/lib/editor-entry.d.ts +2 -0
  25. package/dist/lib/editor-entry.js +5490 -0
  26. package/dist/lib/editor-entry.js.map +7 -0
  27. package/dist/lib/harness.js +51012 -0
  28. package/dist/lib/ktx2.d.ts +15 -0
  29. package/dist/lib/mcp-server.d.ts +2 -0
  30. package/dist/lib/preview/harness.d.ts +16 -0
  31. package/dist/lib/preview/render-preview.d.ts +27 -0
  32. package/dist/lib/preview/viewer.d.ts +1 -0
  33. package/dist/lib/rig-anim.d.ts +109 -0
  34. package/dist/lib/rig-api.d.ts +26 -0
  35. package/dist/lib/rig-atlas.d.ts +20 -0
  36. package/dist/lib/rig-check.d.ts +45 -0
  37. package/dist/lib/rig-constraints.d.ts +59 -0
  38. package/dist/lib/rig-deform.d.ts +27 -0
  39. package/dist/lib/rig-format.d.ts +5036 -0
  40. package/dist/lib/rig-history.d.ts +21 -0
  41. package/dist/lib/rig-import-layers.d.ts +32 -0
  42. package/dist/lib/rig-io.d.ts +9 -0
  43. package/dist/lib/rig-mesh-image.d.ts +2 -0
  44. package/dist/lib/rig-mesh.d.ts +143 -0
  45. package/dist/lib/rig-path.d.ts +101 -0
  46. package/dist/lib/rig-presets.d.ts +101 -0
  47. package/dist/lib/rig-queue.d.ts +2 -0
  48. package/dist/lib/rig-runtime.d.ts +70 -0
  49. package/dist/lib/rig-state.d.ts +64 -0
  50. package/dist/lib/rig-symbol.d.ts +60 -0
  51. package/dist/lib/rig-template-library.d.ts +3 -0
  52. package/dist/lib/rig-templates.d.ts +46 -0
  53. package/dist/lib/rig-tools.d.ts +376 -0
  54. package/dist/lib/runtime.d.ts +9 -0
  55. package/dist/lib/runtime.js +1584 -0
  56. package/dist/lib/runtime.js.map +7 -0
  57. package/dist/lib/spine-import.d.ts +68 -0
  58. package/dist/lib/tools.d.ts +2 -0
  59. package/dist/lib/tools.js +5242 -0
  60. package/dist/lib/tools.js.map +7 -0
  61. package/editor.html +3 -0
  62. package/package.json +96 -0
@@ -0,0 +1,64 @@
1
+ import type { Animation, RigDocument } from "../rig-format";
2
+ import type { TrackRef } from "./store";
3
+ export interface Row {
4
+ kind: "all" | "group" | "track";
5
+ label: string;
6
+ /** only on `track` rows — the track this row edits */
7
+ track?: TrackRef;
8
+ /** key times, ascending; on `all` / `group` rows the union of the tracks below it */
9
+ keys: number[];
10
+ depth: number;
11
+ }
12
+ /** how close (px) the pointer must be to a diamond to grab it */
13
+ export declare const KEY_HIT = 5;
14
+ /**
15
+ * Rows for one animation: the "all keys" summary, then one group per animated target followed by its tracks.
16
+ * Groups come in the order the rig reads: bones parent-first, then slots, deform (by attachment), ik, transform,
17
+ * path and drawOrder — each filtered to the targets that actually have keys, ids the document no longer knows
18
+ * kept at the end of their kind so an orphaned track is still visible (and deletable).
19
+ */
20
+ export declare function rows(doc: RigDocument, anim: Animation): Row[];
21
+ /** where the rows start (`left` px of labels, `headerH` px of ruler) and how far a second and a row reach */
22
+ export interface Layout {
23
+ left: number;
24
+ rowH: number;
25
+ headerH: number;
26
+ pxPerSec: number;
27
+ scrollX: number;
28
+ scrollY: number;
29
+ }
30
+ export declare const xOfTime: (l: Layout, t: number) => number;
31
+ export declare const timeOfX: (l: Layout, x: number) => number;
32
+ /** row index at a canvas y — negative inside the header, past the last row below the sheet */
33
+ export declare const rowAtY: (l: Layout, y: number) => number;
34
+ /** the key under (x, y): the nearest diamond of that row within `KEY_HIT` px, or nothing */
35
+ export declare function keyAt(l: Layout, rs: Row[], x: number, y: number): {
36
+ row: number;
37
+ t: number;
38
+ } | undefined;
39
+ /** the nearest frame boundary — the grid every human edit lands on */
40
+ export declare const snap: (t: number, fps: number) => number;
41
+ /** written key times live on a 1e-6 grid: float drift never turns one key into two */
42
+ export declare const roundTime: (t: number) => number;
43
+ /** two keys of one track are "the same key" this close — the format wants strictly increasing times */
44
+ export declare const COLLIDE = 0.000001;
45
+ /**
46
+ * How close a dragged key may come to a key that stays put. Comfortably above `roundTime`'s 1e-6 grid, so
47
+ * rounding a clamped time can never push it onto its neighbour (the reason this is not simply `COLLIDE`).
48
+ */
49
+ export declare const MIN_GAP = 0.0001;
50
+ /**
51
+ * Where the selected keys of one track land when the pointer asks for `dt` seconds.
52
+ *
53
+ * `all` is every key time of the track, `selected` the ones being dragged; the result gives their new times in
54
+ * the same order, rounded to the written grid. Δt is clamped as a whole (so the selection keeps its shape): the
55
+ * earliest key stays ≥ 0, the latest ≤ `duration`, and no moved key crosses — or lands within `minGap` of — a key
56
+ * that stays put. `snapFps` snaps each moved time to that frame grid, unless snapping would break one of those
57
+ * rules, in which case the unsnapped positions are used.
58
+ */
59
+ export declare function moveKeyTimes(all: number[], selected: number[], dt: number, duration: number, opts?: {
60
+ snapFps?: number;
61
+ minGap?: number;
62
+ }): number[];
63
+ /** the duration a drag asks for, floored by the last key/event (the registry refuses less) and by one frame */
64
+ export declare function clampDuration(requested: number, lastKeyOrEventTime: number, fps: number): number;
@@ -0,0 +1,45 @@
1
+ export declare class Timeline {
2
+ private host;
3
+ private canvas;
4
+ private g;
5
+ private dispose;
6
+ private w;
7
+ private h;
8
+ private dpr;
9
+ private pxPerSec;
10
+ private scrollX;
11
+ private scrollY;
12
+ private drag?;
13
+ constructor(host: HTMLElement);
14
+ destroy(): void;
15
+ private layout;
16
+ /**
17
+ * The rows of the animation shown right now. `peek` so pointer handlers never subscribe to anything, and
18
+ * memoized on identity — this runs on every redraw (60/s while playing) and on every hover.
19
+ */
20
+ private rowsMemo?;
21
+ private rowsNow;
22
+ /** canvas-relative CSS px of a `track` row's centre (the first one, or `ref`'s) and of t = 0.3 — the e2e drives the sheet through this */
23
+ debugTrackRow(ref?: {
24
+ target: string;
25
+ id: string;
26
+ prop: string;
27
+ }): {
28
+ y: number;
29
+ xEmpty: number;
30
+ };
31
+ /** canvas-relative CSS x of a time */
32
+ debugX(t: number): number;
33
+ private resize;
34
+ private diamond;
35
+ private draw;
36
+ private seek;
37
+ /** where the selected keys of the dragged track land for a raw Δt (all the arithmetic is in timeline-layout) */
38
+ private moveKeys;
39
+ /** one gesture, one tool call: the moved track's full key list with new times, `v` and `ease` untouched */
40
+ private endKeyDrag;
41
+ private endDurationDrag;
42
+ /** a double-click on free space keys the value already shown there, so the pose does not jump */
43
+ private addKey;
44
+ private bindPointer;
45
+ }
@@ -0,0 +1,2 @@
1
+ /** `@energy8platform/golem/editor` — the editor's HTTP/SSE server (node). */
2
+ export { startEditorServer, type EditorServer } from "./editor/server";