@g9tm/lynxcontrols-studio 0.0.0-stage → 2.8.1
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 +184 -2
- package/catalog/cards/G9NleTimeline.md +17 -0
- package/catalog/cards/G9Surface.md +16 -0
- package/catalog/cards/G9TransformBox.md +17 -0
- package/catalog/catalog.json +2255 -0
- package/catalog/index.md +7 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.jsx +3 -0
- package/dist/nle-timeline/core.d.ts +5 -0
- package/dist/nle-timeline/core.d.ts.map +1 -0
- package/dist/nle-timeline/core.js +4 -0
- package/dist/nle-timeline/core.jsx +4 -0
- package/dist/nle-timeline/edits.d.ts +65 -0
- package/dist/nle-timeline/edits.d.ts.map +1 -0
- package/dist/nle-timeline/edits.js +344 -0
- package/dist/nle-timeline/edits.js.map +1 -0
- package/dist/nle-timeline/edits.jsx +342 -0
- package/dist/nle-timeline/engine.d.ts +159 -0
- package/dist/nle-timeline/engine.d.ts.map +1 -0
- package/dist/nle-timeline/engine.js +899 -0
- package/dist/nle-timeline/engine.js.map +1 -0
- package/dist/nle-timeline/engine.jsx +897 -0
- package/dist/nle-timeline/index.d.ts +6 -0
- package/dist/nle-timeline/index.d.ts.map +1 -0
- package/dist/nle-timeline/index.jsx +5 -0
- package/dist/nle-timeline/layout.d.ts +116 -0
- package/dist/nle-timeline/layout.d.ts.map +1 -0
- package/dist/nle-timeline/layout.js +310 -0
- package/dist/nle-timeline/layout.js.map +1 -0
- package/dist/nle-timeline/layout.jsx +308 -0
- package/dist/nle-timeline/model.d.ts +140 -0
- package/dist/nle-timeline/model.d.ts.map +1 -0
- package/dist/nle-timeline/model.js +155 -0
- package/dist/nle-timeline/model.js.map +1 -0
- package/dist/nle-timeline/model.jsx +153 -0
- package/dist/nle-timeline/nle.d.ts +72 -0
- package/dist/nle-timeline/nle.d.ts.map +1 -0
- package/dist/nle-timeline/nle.jsx +92 -0
- package/dist/surface/core.d.ts +2 -0
- package/dist/surface/core.d.ts.map +1 -0
- package/dist/surface/core.js +1 -0
- package/dist/surface/core.jsx +1 -0
- package/dist/surface/index.d.ts +3 -0
- package/dist/surface/index.d.ts.map +1 -0
- package/dist/surface/index.jsx +2 -0
- package/dist/surface/protocol.d.ts +40 -0
- package/dist/surface/protocol.d.ts.map +1 -0
- package/dist/surface/protocol.js +19 -0
- package/dist/surface/protocol.js.map +1 -0
- package/dist/surface/protocol.jsx +17 -0
- package/dist/surface/surface.d.ts +53 -0
- package/dist/surface/surface.d.ts.map +1 -0
- package/dist/surface/surface.jsx +62 -0
- package/dist/transform-box/core.d.ts +3 -0
- package/dist/transform-box/core.d.ts.map +1 -0
- package/dist/transform-box/core.js +2 -0
- package/dist/transform-box/core.jsx +2 -0
- package/dist/transform-box/engine.d.ts +152 -0
- package/dist/transform-box/engine.d.ts.map +1 -0
- package/dist/transform-box/engine.js +636 -0
- package/dist/transform-box/engine.js.map +1 -0
- package/dist/transform-box/engine.jsx +634 -0
- package/dist/transform-box/geometry.d.ts +129 -0
- package/dist/transform-box/geometry.d.ts.map +1 -0
- package/dist/transform-box/geometry.js +506 -0
- package/dist/transform-box/geometry.js.map +1 -0
- package/dist/transform-box/geometry.jsx +504 -0
- package/dist/transform-box/index.d.ts +4 -0
- package/dist/transform-box/index.d.ts.map +1 -0
- package/dist/transform-box/index.jsx +3 -0
- package/dist/transform-box/transform-box.d.ts +65 -0
- package/dist/transform-box/transform-box.d.ts.map +1 -0
- package/dist/transform-box/transform-box.jsx +104 -0
- package/package.json +56 -4
package/README.md
CHANGED
|
@@ -1,3 +1,185 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @g9tm/lynxcontrols-studio
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The editing controls of a studio app: a stage a host draws into, handles over it, and a timeline. They come from
|
|
4
|
+
G9Studio (Plan-V17 §12, group A) and arrived in 2.8.0. An optional package: an app that does not import it never
|
|
5
|
+
bundles it.
|
|
6
|
+
|
|
7
|
+
| Control | What it is | Host element |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `G9Surface` | A viewport a driver registered by the host page draws into. JSON goes in through a port; nothing crosses the threads per frame. | `<g9-surface>` |
|
|
10
|
+
| `G9TransformBox` | Selection boxes and handles over any content: move, scale, rotate, smart guides, safe zones, pinch and wheel zoom. | `<g9-transform-box>` |
|
|
11
|
+
| `G9NleTimeline` | A non-linear editor's timeline on one virtualised canvas: ruler, beat grid, markers, a magnetic main lane, free and keyframe lanes, trim and move with snapping, range, zoom. | `<g9-nle>` |
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npm install @g9tm/lynxcontrols-studio
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The page imports from `@g9tm/lynxcontrols-studio`. Each control also has its own subpath: `/surface`,
|
|
18
|
+
`/transform-box`, `/nle-timeline`.
|
|
19
|
+
|
|
20
|
+
The host page registers the elements from `@g9tm/lynxcontrols-web/studio` before the `<lynx-view>` mounts:
|
|
21
|
+
- `registerG9Surface({ drivers })`;
|
|
22
|
+
- `registerG9TransformBox()`;
|
|
23
|
+
- `registerG9Nle({ thumbs, peaks })`.
|
|
24
|
+
|
|
25
|
+
The engines, geometry and model are plain TypeScript, exported for hosts and tests at `/surface/core`,
|
|
26
|
+
`/transform-box/core` and `/nle-timeline/core`. They hold no JSX and import nothing at run time, so Node loads them.
|
|
27
|
+
|
|
28
|
+
Each handler receives the event's `detail`.
|
|
29
|
+
|
|
30
|
+
Every control follows the library's rules:
|
|
31
|
+
- No Intl and no DOM on the Lynx side.
|
|
32
|
+
- A safe id on everything a person or a test acts on.
|
|
33
|
+
- Colours come from the theme's tokens (`--g9-primary`, `--g9-tertiary`, `--g9-outline`, `--g9-surface-container-*`,
|
|
34
|
+
…). A `theme` prop makes the element read them again after a switch.
|
|
35
|
+
- RTL is supported. On the timeline, the lane heads move to the right while time still runs left to right.
|
|
36
|
+
|
|
37
|
+
Hosts: the web today. Android is not written yet; it will follow `G9CanvasBehaviors` (the engine's view placed over the
|
|
38
|
+
element's box).
|
|
39
|
+
|
|
40
|
+
## G9Surface
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
import { G9Surface, G9SurfacePort } from '@g9tm/lynxcontrols-studio/surface';
|
|
44
|
+
|
|
45
|
+
const port = new G9SurfacePort();
|
|
46
|
+
|
|
47
|
+
<G9Surface
|
|
48
|
+
id="Editor.Stage"
|
|
49
|
+
driver="stage"
|
|
50
|
+
params={{ project }}
|
|
51
|
+
port={port}
|
|
52
|
+
onEvent={(d) => d.name === 'boxes' && onBoxes(d.detail)}
|
|
53
|
+
onError={(d) => console.warn(d.code, d.message)}
|
|
54
|
+
/>;
|
|
55
|
+
port.send({ view: { scale: 0.4, offsetX: 12, offsetY: 0 } }); // a message for the driver
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
import { registerG9Surface } from '@g9tm/lynxcontrols-web/studio';
|
|
60
|
+
|
|
61
|
+
registerG9Surface({
|
|
62
|
+
drivers: {
|
|
63
|
+
// ctx.canvas, ctx.width, ctx.height (CSS px), ctx.dpr, ctx.params, ctx.emit(name, detail)
|
|
64
|
+
stage: (ctx) => ({ resize(w, h, dpr) {}, params(p) {}, message(m) {}, dispose() {} }),
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
| Prop | What it does |
|
|
70
|
+
| --- | --- |
|
|
71
|
+
| `driver` | The name of a driver the host registered. |
|
|
72
|
+
| `params` | JSON given to the driver at mount and again whenever it changes. |
|
|
73
|
+
| `port` | `G9SurfacePort`: `send(message)` reaches the driver's `message`. Messages sent before the mount wait (up to 256). |
|
|
74
|
+
| `id` | A logical id. The element carries its safe form, so tests find `#Editor_Stage`. |
|
|
75
|
+
| `onReady` | `{ driver, width, height, dpr }`: the driver mounted. |
|
|
76
|
+
| `onResize` | `{ width, height, dpr }`. The canvas is already width × dpr by height × dpr. |
|
|
77
|
+
| `onError` | `{ code, driver, message }`, typed: `unknown_driver`, `driver_failed`, `unsupported`. It is never a silent no-op. |
|
|
78
|
+
| `onEvent` | `{ name, detail }`: whatever the driver emits. |
|
|
79
|
+
|
|
80
|
+
The element resets its canvas to its own size on every resize. A driver whose renderer sizes a canvas its own way can
|
|
81
|
+
draw into a canvas of its own and copy each frame into `ctx.canvas`.
|
|
82
|
+
|
|
83
|
+
## G9TransformBox
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
import { G9TransformBox, G9TransformBoxPort } from '@g9tm/lynxcontrols-studio/transform-box';
|
|
87
|
+
|
|
88
|
+
const port = new G9TransformBoxPort();
|
|
89
|
+
port.apply({ stage: { w: 1080, h: 1920 }, boxes, safeZones: [{ x: 54, y: 96, w: 972, h: 1728 }] });
|
|
90
|
+
|
|
91
|
+
<G9TransformBox
|
|
92
|
+
id="Editor.Handles"
|
|
93
|
+
port={port}
|
|
94
|
+
onSelect={(d) => select(d.ids)}
|
|
95
|
+
onTransform={(d) => (d.phase === 'end' ? commit(d.boxes) : preview(d.boxes))}
|
|
96
|
+
onView={(d) => surfacePort.send({ view: d })} // stage units → element px, for what is drawn underneath
|
|
97
|
+
onCommand={(d) => run(d.name)}
|
|
98
|
+
/>;
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
A box is `{ id, x, y, w, h, rotation, locked?, keepAspect? }`. It gives the top-left of the unrotated box, its size, and
|
|
102
|
+
its rotation in degrees clockwise about its centre, all in stage units.
|
|
103
|
+
|
|
104
|
+
| Prop | What it does |
|
|
105
|
+
| --- | --- |
|
|
106
|
+
| `port` | `G9TransformBoxPort.apply(message)`: `stage`, `boxes` (all, bottom to top), `update` / `remove` (by id), `selection`, `safeZones`, `view` (zoom, pan). |
|
|
107
|
+
| `guides` | Smart guides and snapping. Default true. |
|
|
108
|
+
| `safeZones` | Draw the safe zones. Default true. |
|
|
109
|
+
| `editable` | False: select and look only. Default true. |
|
|
110
|
+
| `padding` | px between the fitted stage and the element's edge. Default 16. |
|
|
111
|
+
| `theme` | `light` or `dark`. The colours are `--g9-primary`, `--g9-tertiary` (guides) and `--g9-outline` (safe zones). |
|
|
112
|
+
| `onSelect` | `{ ids }` |
|
|
113
|
+
| `onTransform` | `{ phase: 'move' \| 'end', kind: 'move' \| 'scale' \| 'rotate', via, boxes }`. `move` arrives live while dragging; `end` arrives once, and that is the one to commit. |
|
|
114
|
+
| `onView` | `{ zoom, panX, panY, scale, offsetX, offsetY }`: `scale` and the offset map stage units to element px. |
|
|
115
|
+
| `onCommand` | `{ name }`: undo, redo, delete, duplicate, copy, paste, forward, backward, escape. |
|
|
116
|
+
| `onOpen` | `{ id }`: a double tap on a box (to edit its text in place). |
|
|
117
|
+
| `onTap` | `{ x, y }`: a tap on empty stage, in stage units. |
|
|
118
|
+
|
|
119
|
+
Keys (`TB_KEYS`):
|
|
120
|
+
|
|
121
|
+
| Key | Action |
|
|
122
|
+
| --- | --- |
|
|
123
|
+
| Arrows | Nudge one unit (shift: ten). |
|
|
124
|
+
| `[` and `]` | Rotate one degree (shift: fifteen). |
|
|
125
|
+
| `-` and `=` | Scale. |
|
|
126
|
+
| Tab | Pick the next box. |
|
|
127
|
+
| ctrl+= / ctrl+- / ctrl+0 | Zoom in, zoom out, fit. |
|
|
128
|
+
|
|
129
|
+
Delete, undo, redo, duplicate, copy, paste and the order keys go to the app as commands.
|
|
130
|
+
|
|
131
|
+
## G9NleTimeline
|
|
132
|
+
|
|
133
|
+
```tsx
|
|
134
|
+
import { G9NlePort, G9NleTimeline } from '@g9tm/lynxcontrols-studio/nle-timeline';
|
|
135
|
+
|
|
136
|
+
const port = new G9NlePort();
|
|
137
|
+
port.apply({ duration: 120, fps: 30, lanes, clips, markers, beats: { bpm: 96, offset: 0.4 }, playhead: 0 });
|
|
138
|
+
|
|
139
|
+
<G9NleTimeline
|
|
140
|
+
id="Editor.Timeline"
|
|
141
|
+
port={port}
|
|
142
|
+
tool={blade ? 'blade' : 'select'}
|
|
143
|
+
onEdit={(d) => commit(d)} // move | trim | keys | split | delete, with the changes
|
|
144
|
+
onSeek={(d) => seek(d.time)}
|
|
145
|
+
onAdd={(d) => addAt(d.lane, d.time)}
|
|
146
|
+
/>;
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Filmstrip tiles and waveform peaks never pass through Lynx. The host page registers resolvers once, and a clip names
|
|
150
|
+
its source with a key (`clip.thumbs`, `clip.peaks`):
|
|
151
|
+
|
|
152
|
+
```ts
|
|
153
|
+
import { registerG9Nle } from '@g9tm/lynxcontrols-web/studio';
|
|
154
|
+
|
|
155
|
+
registerG9Nle({
|
|
156
|
+
thumbs: ({ key, time, height }) => drawTile(key, time, height), // a picture, null, or a promise of one
|
|
157
|
+
peaks: ({ key, from, to, columns }) => peaksOf(key, from, to, columns), // numbers 0..1, null, or a promise
|
|
158
|
+
});
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
| Prop | What it does |
|
|
162
|
+
| --- | --- |
|
|
163
|
+
| `port` | `G9NlePort.apply(patch)`: absent fields keep their value. It takes `duration`, `fps`, `lanes`, `clips` / `removeClips`, `keys` / `removeKeys`, `markers`, `beats` (times or a tempo), `range`, `playhead`, `selection` and `view` (see `NlePatch`). |
|
|
164
|
+
| `tool` | `select` (default) or `blade` (a click splits). |
|
|
165
|
+
| `snap` | Snapping to the playhead, edges, beats, markers and the range. Default true. |
|
|
166
|
+
| `editable` | False: look and scrub only. Default true. |
|
|
167
|
+
| `direction` | The side of the lane heads: `rtl` puts them on the right. Time always runs left to right. |
|
|
168
|
+
| `heads` | Show the lane heads' column. Default true. |
|
|
169
|
+
| `theme` | `light` or `dark`; the colours are `--g9-surface-container-*`, `--g9-primary`, … |
|
|
170
|
+
| `onSelect` | `{ ids }` |
|
|
171
|
+
| `onEdit` | `{ op, via, changes?, keys?, splits?, ids?, ripple? }`: one event per finished gesture. |
|
|
172
|
+
| `onAdd` | `{ lane, time, via }`: a double tap on an empty lane, or Insert. |
|
|
173
|
+
| `onOpen` | `{ id }` |
|
|
174
|
+
| `onSeek` | `{ time, scrubbing }` |
|
|
175
|
+
| `onRange` | `{ range }` |
|
|
176
|
+
| `onView` | `{ zoom, scroll, scrollY }` |
|
|
177
|
+
| `onCommand` | `{ name, time }`: undo, redo, duplicate, copy, paste, marker, escape. |
|
|
178
|
+
|
|
179
|
+
`NLE_KEYS` lists the keys, for a help sheet. Clip data is `NleClip`:
|
|
180
|
+
- `start`, `duration`;
|
|
181
|
+
- `sourceIn`, `sourceDuration` (trims stop at it);
|
|
182
|
+
- `speed`, `thumbs`, `peaks`, `locked`.
|
|
183
|
+
|
|
184
|
+
Speed, measured in G9Studio with 200 clips and 300 items: scroll and zoom run at 95 fps on a desktop PC, and at 41–44 fps
|
|
185
|
+
with the CPU slowed six times.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# G9NleTimeline
|
|
2
|
+
|
|
3
|
+
`import { G9NleTimeline } from '@g9tm/lynxcontrols-studio/nle-timeline';`
|
|
4
|
+
|
|
5
|
+
The editing timeline.
|
|
6
|
+
|
|
7
|
+
Props:
|
|
8
|
+
- `port`: object
|
|
9
|
+
- `onSelect?`: (detail: { ids: string[]; }) => void
|
|
10
|
+
- `onAdd?`: (detail: { lane: string; time: number; via: NleVia; }) => void
|
|
11
|
+
- `onCommand?`: (detail: { name: "marker" | "undo" | "redo" | "duplicate" | "copy" | "paste" | "escape"; time: number; }) => void
|
|
12
|
+
- `onEdit?`: (detail: { op: "split" | "trim" | "delete" | "keys" | "move"; via: NleVia; changes?: NleClipChange[]; keys?: { id: string; time: number; }[]; splits?: { id: string; time: number; }[]; ids?: string[]; ripple?: boolean; }) => void
|
|
13
|
+
- `onOpen?`: (detail: { id: string; }) => void
|
|
14
|
+
- `onRange?`: (detail: { range: NleRange | null; }) => void
|
|
15
|
+
- `onSeek?`: (detail: { time: number; scrubbing: boolean; }) => void
|
|
16
|
+
|
|
17
|
+
Example: `<G9NleTimeline port={port} />`
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# G9Surface
|
|
2
|
+
|
|
3
|
+
`import { G9Surface } from '@g9tm/lynxcontrols-studio/surface';`
|
|
4
|
+
|
|
5
|
+
A viewport a driver registered by the host page draws into (`<g9-surface>`): the page names the driver, sends it JSON through the port and hears its events.
|
|
6
|
+
|
|
7
|
+
Props:
|
|
8
|
+
- `driver`: string
|
|
9
|
+
- `onError?`: (detail: { code: G9SurfaceErrorCode; driver: string; message: string; }) => void
|
|
10
|
+
- `onEvent?`: (detail: { name: string; detail: unknown; }) => void
|
|
11
|
+
- `onReady?`: (detail: { driver: string; width: number; height: number; dpr: number; }) => void
|
|
12
|
+
- `onResize?`: (detail: { width: number; height: number; dpr: number; }) => void
|
|
13
|
+
- `params?`: object
|
|
14
|
+
- `port?`: object
|
|
15
|
+
|
|
16
|
+
Example: `<G9Surface driver="driver" />`
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# G9TransformBox
|
|
2
|
+
|
|
3
|
+
`import { G9TransformBox } from '@g9tm/lynxcontrols-studio/transform-box';`
|
|
4
|
+
|
|
5
|
+
Selection boxes and handles over any content (`<g9-transform-box>`): move, scale, rotate, smart guides, safe zones, pinch and wheel zoom.
|
|
6
|
+
|
|
7
|
+
Props:
|
|
8
|
+
- `port`: object
|
|
9
|
+
- `onSelect?`: (detail: { ids: string[]; }) => void
|
|
10
|
+
- `onCommand?`: (detail: { name: "delete" | "forward" | "backward" | "undo" | "redo" | "duplicate" | "copy" | "paste" | "escape"; }) => void
|
|
11
|
+
- `onOpen?`: (detail: { id: string; }) => void
|
|
12
|
+
- `onTap?`: (detail: { x: number; y: number; }) => void
|
|
13
|
+
- `onTransform?`: (detail: { phase: "end" | "move"; kind: TbKind; via: TbVia; boxes: TbBox[]; }) => void
|
|
14
|
+
- `onView?`: (detail: { zoom: number; panX: number; panY: number; scale: number; offsetX: number; offsetY: number; }) => void
|
|
15
|
+
- `editable?`: boolean = true
|
|
16
|
+
|
|
17
|
+
Example: `<G9TransformBox port={port} />`
|