@g9tm/lynxcontrols-canvas 0.0.0-stage → 2.5.8
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 +39 -2
- package/catalog/cards/G9Canvas.md +17 -0
- package/catalog/cards/G9CanvasStylePanel.md +13 -0
- package/catalog/catalog.json +2334 -0
- package/catalog/index.md +6 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/board-controller.d.ts +161 -0
- package/dist/board-controller.d.ts.map +1 -0
- package/dist/board-controller.jsx +812 -0
- package/dist/board-model.d.ts +42 -0
- package/dist/board-model.d.ts.map +1 -0
- package/dist/board-model.jsx +66 -0
- package/dist/canvas.css +81 -0
- package/dist/canvas.css.map +1 -0
- package/dist/canvas.d.ts +144 -0
- package/dist/canvas.d.ts.map +1 -0
- package/dist/canvas.jsx +481 -0
- package/dist/element-core.d.ts +155 -0
- package/dist/element-core.d.ts.map +1 -0
- package/dist/element-core.jsx +1104 -0
- package/dist/export.d.ts +7 -0
- package/dist/export.d.ts.map +1 -0
- package/dist/export.jsx +75 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.jsx +7 -0
- package/dist/observable.d.ts +5 -0
- package/dist/observable.d.ts.map +1 -0
- package/dist/observable.jsx +14 -0
- package/dist/protocol.d.ts +258 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.jsx +2 -0
- package/dist/scene/edit.d.ts +59 -0
- package/dist/scene/edit.d.ts.map +1 -0
- package/dist/scene/edit.jsx +895 -0
- package/dist/scene/elements.d.ts +160 -0
- package/dist/scene/elements.d.ts.map +1 -0
- package/dist/scene/elements.jsx +392 -0
- package/dist/scene/geometry.d.ts +36 -0
- package/dist/scene/geometry.d.ts.map +1 -0
- package/dist/scene/geometry.jsx +367 -0
- package/dist/scene/index.d.ts +8 -0
- package/dist/scene/index.d.ts.map +1 -0
- package/dist/scene/index.jsx +6 -0
- package/dist/scene/path-data-parser.d.ts +17 -0
- package/dist/scene/path-data-parser.d.ts.map +1 -0
- package/dist/scene/path-data-parser.jsx +128 -0
- package/dist/scene/scene.d.ts +58 -0
- package/dist/scene/scene.d.ts.map +1 -0
- package/dist/scene/scene.jsx +169 -0
- package/dist/scene/shapes.d.ts +24 -0
- package/dist/scene/shapes.d.ts.map +1 -0
- package/dist/scene/shapes.jsx +807 -0
- package/dist/scene/types.d.ts +118 -0
- package/dist/scene/types.d.ts.map +1 -0
- package/dist/scene/types.jsx +1 -0
- package/dist/words.d.ts +100 -0
- package/dist/words.d.ts.map +1 -0
- package/dist/words.jsx +186 -0
- package/package.json +50 -4
package/README.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @g9tm/lynxcontrols-canvas
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A whiteboard for G9LynxControls (from G9Hub's boards): Excalidraw's element model and drawing (rough shapes, free
|
|
4
|
+
drawing, arrows bound to shapes, labels, frames, pictures), the editing rules, and a board UI over the host's
|
|
5
|
+
`<g9-canvas>` element, which runs the gestures natively and draws the items. Opt-in: none of it is in the cost of
|
|
6
|
+
`@g9tm/lynxcontrols`.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { G9BoardController, G9Canvas, G9CanvasPort, G9CanvasStylePanel, useG9CanvasState } from '@g9tm/lynxcontrols-canvas';
|
|
10
|
+
import { Scene } from '@g9tm/lynxcontrols-canvas/scene';
|
|
11
|
+
|
|
12
|
+
const scene = new Scene(savedElements);
|
|
13
|
+
const port = new G9CanvasPort();
|
|
14
|
+
const controller = new G9BoardController({ scene, send: port.send, identify: () => me });
|
|
15
|
+
|
|
16
|
+
function Board() {
|
|
17
|
+
const state = useG9CanvasState(controller); // the tool, the selection and its style, the text being edited
|
|
18
|
+
const selected = state.selected.map((id) => scene.get(id)).filter(Boolean);
|
|
19
|
+
return (
|
|
20
|
+
<view>
|
|
21
|
+
<G9Canvas controller={controller} port={port} tool={state.tool} editable={state.editable} stroke={strokeOf(state.style)} />
|
|
22
|
+
{selected.length ? <G9CanvasStylePanel controller={controller} style={state.style} tool={state.tool} selected={selected} /> : null}
|
|
23
|
+
</view>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
| Part | What it is |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| **`G9Canvas`** | The board: the `<g9-canvas>` element bound to a controller, the tools, the text being typed, zoom and undo. |
|
|
31
|
+
| **`G9CanvasStylePanel`** | The selection's style: stroke and fill colours, fill style, stroke width and style, roughness, edges, fonts, arrowheads, opacity, order, lock. |
|
|
32
|
+
| **`useG9CanvasState`** | The controller's state, re-rendering on every change. |
|
|
33
|
+
| **`G9BoardController`** | Drives a board: the element's events (taps, drags, shapes, lines, strokes, the eraser, transforms), styles, history, collaborators' pointers and the order. |
|
|
34
|
+
| **`./scene`** | The model: `Scene` (elements, order, undo, remote changes), the factories, the edits (move, resize, rotate, bind, group, erase, duplicate) and `elementOps` (each element as drawing operations). |
|
|
35
|
+
| **`./protocol`** | The element's contract (`CvMessage`, `CvItem`, the `cv*` events) for an app with its own model. |
|
|
36
|
+
| **`./element-core`** | `CanvasCore`: the element's gestures, shared by every host (the web element runs it unchanged). |
|
|
37
|
+
|
|
38
|
+
`boardSvg` exports a board as SVG; `boardText` lists its words (search). The element: Android
|
|
39
|
+
`G9CanvasBehaviors.create()` and iOS `G9LCCanvasUI` in `@g9tm/lynxcontrols-native`, web `registerG9Canvas({ fonts })`
|
|
40
|
+
in `@g9tm/lynxcontrols-web`.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# G9Canvas
|
|
2
|
+
|
|
3
|
+
`import { G9Canvas } from '@g9tm/lynxcontrols-canvas';`
|
|
4
|
+
|
|
5
|
+
A whiteboard on the host's `<g9-canvas>` (or the desktop's page).
|
|
6
|
+
|
|
7
|
+
Props:
|
|
8
|
+
- `controller`: object
|
|
9
|
+
- `editable`: boolean
|
|
10
|
+
- `port`: object
|
|
11
|
+
- `stroke`: object
|
|
12
|
+
- `tool`: 'text' | 'image' | 'line' | 'selection' | 'arrow' | 'diamond' | 'rectangle' | 'ellipse' | 'frame' | 'hand' | 'freedraw' | 'eraser' | 'laser'
|
|
13
|
+
- `accent?`: string
|
|
14
|
+
- `background?`: color
|
|
15
|
+
- `dark?`: boolean
|
|
16
|
+
|
|
17
|
+
Example: `<G9Canvas controller={controller} editable port={port} stroke={stroke} tool="text" />`
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# G9CanvasStylePanel
|
|
2
|
+
|
|
3
|
+
`import { G9CanvasStylePanel } from '@g9tm/lynxcontrols-canvas';`
|
|
4
|
+
|
|
5
|
+
The style of the tool in hand or the selection: colours, fill, stroke, sloppiness, edges, text, arrows, layers.
|
|
6
|
+
|
|
7
|
+
Props:
|
|
8
|
+
- `controller`: object
|
|
9
|
+
- `selected`: object[]
|
|
10
|
+
- `tool`: string
|
|
11
|
+
- `words?`: object
|
|
12
|
+
|
|
13
|
+
Example: `<G9CanvasStylePanel controller={controller} selected={selected} style={style} tool="tool" />`
|