@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.
Files changed (60) hide show
  1. package/README.md +39 -2
  2. package/catalog/cards/G9Canvas.md +17 -0
  3. package/catalog/cards/G9CanvasStylePanel.md +13 -0
  4. package/catalog/catalog.json +2334 -0
  5. package/catalog/index.md +6 -0
  6. package/dist/.tsbuildinfo +1 -0
  7. package/dist/board-controller.d.ts +161 -0
  8. package/dist/board-controller.d.ts.map +1 -0
  9. package/dist/board-controller.jsx +812 -0
  10. package/dist/board-model.d.ts +42 -0
  11. package/dist/board-model.d.ts.map +1 -0
  12. package/dist/board-model.jsx +66 -0
  13. package/dist/canvas.css +81 -0
  14. package/dist/canvas.css.map +1 -0
  15. package/dist/canvas.d.ts +144 -0
  16. package/dist/canvas.d.ts.map +1 -0
  17. package/dist/canvas.jsx +481 -0
  18. package/dist/element-core.d.ts +155 -0
  19. package/dist/element-core.d.ts.map +1 -0
  20. package/dist/element-core.jsx +1104 -0
  21. package/dist/export.d.ts +7 -0
  22. package/dist/export.d.ts.map +1 -0
  23. package/dist/export.jsx +75 -0
  24. package/dist/index.d.ts +8 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.jsx +7 -0
  27. package/dist/observable.d.ts +5 -0
  28. package/dist/observable.d.ts.map +1 -0
  29. package/dist/observable.jsx +14 -0
  30. package/dist/protocol.d.ts +258 -0
  31. package/dist/protocol.d.ts.map +1 -0
  32. package/dist/protocol.jsx +2 -0
  33. package/dist/scene/edit.d.ts +59 -0
  34. package/dist/scene/edit.d.ts.map +1 -0
  35. package/dist/scene/edit.jsx +895 -0
  36. package/dist/scene/elements.d.ts +160 -0
  37. package/dist/scene/elements.d.ts.map +1 -0
  38. package/dist/scene/elements.jsx +392 -0
  39. package/dist/scene/geometry.d.ts +36 -0
  40. package/dist/scene/geometry.d.ts.map +1 -0
  41. package/dist/scene/geometry.jsx +367 -0
  42. package/dist/scene/index.d.ts +8 -0
  43. package/dist/scene/index.d.ts.map +1 -0
  44. package/dist/scene/index.jsx +6 -0
  45. package/dist/scene/path-data-parser.d.ts +17 -0
  46. package/dist/scene/path-data-parser.d.ts.map +1 -0
  47. package/dist/scene/path-data-parser.jsx +128 -0
  48. package/dist/scene/scene.d.ts +58 -0
  49. package/dist/scene/scene.d.ts.map +1 -0
  50. package/dist/scene/scene.jsx +169 -0
  51. package/dist/scene/shapes.d.ts +24 -0
  52. package/dist/scene/shapes.d.ts.map +1 -0
  53. package/dist/scene/shapes.jsx +807 -0
  54. package/dist/scene/types.d.ts +118 -0
  55. package/dist/scene/types.d.ts.map +1 -0
  56. package/dist/scene/types.jsx +1 -0
  57. package/dist/words.d.ts +100 -0
  58. package/dist/words.d.ts.map +1 -0
  59. package/dist/words.jsx +186 -0
  60. package/package.json +50 -4
package/README.md CHANGED
@@ -1,3 +1,40 @@
1
- # Temporary Holding Version
1
+ # @g9tm/lynxcontrols-canvas
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
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" />`