stickyflow 0.0.0-stage → 0.2.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 (52) hide show
  1. package/CHANGELOG.md +157 -0
  2. package/LICENSE +202 -0
  3. package/README.md +167 -2
  4. package/dist/chunk-34PK7HEU.cjs +842 -0
  5. package/dist/chunk-34PK7HEU.cjs.map +1 -0
  6. package/dist/chunk-6JKNT2YC.js +4685 -0
  7. package/dist/chunk-6JKNT2YC.js.map +1 -0
  8. package/dist/chunk-6LQJUAD4.js +801 -0
  9. package/dist/chunk-6LQJUAD4.js.map +1 -0
  10. package/dist/chunk-IIOJFR73.cjs +3671 -0
  11. package/dist/chunk-IIOJFR73.cjs.map +1 -0
  12. package/dist/chunk-KFJIFHXG.js +8559 -0
  13. package/dist/chunk-KFJIFHXG.js.map +1 -0
  14. package/dist/chunk-N6WVHOUQ.js +3665 -0
  15. package/dist/chunk-N6WVHOUQ.js.map +1 -0
  16. package/dist/chunk-S5BVAAEF.cjs +8568 -0
  17. package/dist/chunk-S5BVAAEF.cjs.map +1 -0
  18. package/dist/chunk-YM3XFBI4.cjs +4814 -0
  19. package/dist/chunk-YM3XFBI4.cjs.map +1 -0
  20. package/dist/index.cjs +1167 -0
  21. package/dist/index.cjs.map +1 -0
  22. package/dist/index.d.cts +335 -0
  23. package/dist/index.d.ts +335 -0
  24. package/dist/index.js +1097 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/interaction/index.cjs +7358 -0
  27. package/dist/interaction/index.cjs.map +1 -0
  28. package/dist/interaction/index.d.cts +273 -0
  29. package/dist/interaction/index.d.ts +273 -0
  30. package/dist/interaction/index.js +7333 -0
  31. package/dist/interaction/index.js.map +1 -0
  32. package/dist/render-r1GYvjNm.d.cts +970 -0
  33. package/dist/render-r1GYvjNm.d.ts +970 -0
  34. package/dist/runtimeTypes-ByiafBwg.d.ts +239 -0
  35. package/dist/runtimeTypes-DwLeD-em.d.cts +239 -0
  36. package/dist/stickyflow-diagram.global.js +1442 -0
  37. package/dist/stickyflow-diagram.global.js.map +1 -0
  38. package/dist/types-T7W2yTQF.d.cts +116 -0
  39. package/dist/types-ndGA1kbl.d.ts +116 -0
  40. package/dist/viewer/index.cjs +31 -0
  41. package/dist/viewer/index.cjs.map +1 -0
  42. package/dist/viewer/index.d.cts +44 -0
  43. package/dist/viewer/index.d.ts +44 -0
  44. package/dist/viewer/index.js +6 -0
  45. package/dist/viewer/index.js.map +1 -0
  46. package/dist/web-component/index.cjs +144 -0
  47. package/dist/web-component/index.cjs.map +1 -0
  48. package/dist/web-component/index.d.cts +31 -0
  49. package/dist/web-component/index.d.ts +31 -0
  50. package/dist/web-component/index.js +141 -0
  51. package/dist/web-component/index.js.map +1 -0
  52. package/package.json +81 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,157 @@
1
+ # Changelog
2
+
3
+ All notable changes to this package are documented here.
4
+
5
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ **While the version is below `1.0.0`, the minor slot carries breaking changes** —
9
+ `0.1.x` → `0.2.0` may break the API. Pin an exact version if that matters to you.
10
+
11
+ Two things count as breaking here that are easy to overlook:
12
+
13
+ - **A change in rendered SVG output.** The golden suite (`test/__golden__/`) exists
14
+ precisely to make those visible; regenerating a golden is never a silent act.
15
+ - **A bump of `DOM_CONTRACT_VERSION`.** Renderer and viewer negotiate on it, so a
16
+ mismatch makes `createViewer()` refuse to mount.
17
+
18
+ ## [Unreleased]
19
+
20
+ ## [0.2.0] - 2026-10-15
21
+
22
+ ### Added
23
+
24
+ - **Data binding.** A document can declare `DataSource` blocks with typed fields
25
+ and bind properties to them with `key: <- expression`. The runtime
26
+ (`createBindingRuntime`, `renderBound`, `createDataSource`) validates the
27
+ bindings against the declared types, re-renders only what changed, and reports
28
+ problems as diagnostics. Expressions support arithmetic, comparisons,
29
+ `&&` / `||`, boolean literals and number functions such as `moveToward`.
30
+ - **Events and handlers.** `onPress`, `onRelease`, `onTap` and `onDrag` on
31
+ Shapes, Texts and Widgets, and `onTick` on a record `DataSource`, write to
32
+ data sources (`onTap: counter.value <- counter.value + 1`). Element state is
33
+ readable in expressions as `id.pressed`, `id.hovered` and `id.pointer`.
34
+ `connectInteraction(viewer, runtime)` from `stickyflow/viewer` wires pointer
35
+ input to the runtime; `viewer.setPaused()` freezes shader time and ticks.
36
+ - **Shaders and widgets.** A `Shader` block with parameters that can be bound to
37
+ data, new built-in shaders (`plasmaGauge`, `tickScale`, `button`,
38
+ `chromaticGlassPlate`, orb and halo effects), `shaderProgram` and
39
+ `SHADER_DEFAULTS` as exports, a native `RollingNumber` widget, a `tickScale`
40
+ widget with numbers and a `ruler` widget with a bending wire and a knob.
41
+ - **Text block** with wider font weights and letter spacing, and editable
42
+ `Shader` blocks.
43
+ - **Line charts:** `lineWidth`, `lineGlow`, `pointSize`, `pointFill`,
44
+ `pointStrokeWidth`, per-series `dash` and `strokeWidth`, gradient strokes,
45
+ and `highlightPoints` with a guide and a label.
46
+ - **Pie charts:** `pieStartAngle`, `pieSweep`, `pieExplode` (and a per-series
47
+ `offset`), `pieGlow`, `pieStroke`, `pieStrokeWidth`, `pieLabelPosition`,
48
+ `pieLabelContent`, `pieLabelColor` and `pieCenterText`.
49
+ - **Bar charts:** horizontal bars, segmented bars with gap and snap, tracks with
50
+ hatching, photo backgrounds with frosted glass, per-bar gradients, glow, value
51
+ labels, axis lines and ticks.
52
+ - Change-highlighting: `viewer.update()` takes an opt-in `highlightChanges` flag
53
+ that briefly flashes the shapes an update added or changed, plus a `sceneDiff`
54
+ event (always emitted) with added, removed and changed owner ids.
55
+ `highlightChanges` also accepts `{ color }`.
56
+ - Bending orthogonal links with segment handles, editable frame titles, move and
57
+ resize of widgets, an isometric snap grid for move and axis resize.
58
+ - Circular `radial` charts and configurable polar `areaOpacity`.
59
+ - Tier layering, viewer encapsulation and the headless guarantee are enforced by
60
+ `test/boundary.test.ts`. A jsdom-based test project (`npm run test:dom`) covers
61
+ the DOM-bound interaction tier.
62
+
63
+ ### Changed
64
+
65
+ - **Breaking (terminology).** Runtime and interaction APIs use the canvas-object
66
+ vocabulary: `entityClick` is `canvasObjectClick`, and the pure patch helpers
67
+ are `insertCanvasObject` / `removeCanvasObject`. Diagnostic ownership is
68
+ exposed as `ownerId` instead of `entityId`. The legacy SFL `Entity` block and
69
+ the version-1 `data-sf-role="entity"` value remain supported.
70
+ - **Breaking (isometric objects).** One `fill` replaces `topFill`, `frontFill`
71
+ and `sideFill`; the shaded sides are derived from it.
72
+ - **Breaking (internal module layout).** `rendering/renderScene` is split into
73
+ `rendering/scene`, `rendering/renderInput` and `rendering/domContractVersion`.
74
+ Only deep imports into `dist/rendering/renderScene` are affected.
75
+ - **Breaking (`Token`).** Lexer tokens carry required `endLine` and `endCol`.
76
+ - DOM-contract access moved into its own `domContract` tier, used by both the
77
+ viewer and the interaction tier. `stickyflow/interaction` uses only the public
78
+ `stickyflow/viewer` API.
79
+ - A pie label drag writes `labelOffsetX` and `labelOffsetY` instead of a
80
+ `labelPulled` flag.
81
+ - The legend is off by default; `showLegend: true` turns it on.
82
+ - The package contains no comments in its sources, and the largest functions are
83
+ split into small ones. Rendered output is byte-identical.
84
+
85
+ ### Fixed
86
+
87
+ - `stickyflow/web-component` can be imported where there is no DOM (SSR). It no
88
+ longer throws at import time, and `defineStickyflowDiagram()` does nothing
89
+ without `customElements`.
90
+ - A property change on a chart no longer lands in a nested block that happens
91
+ to share the key (for example the `text` of a `Rule`).
92
+ - A pie label can be pulled out of the ring again; its offset was clamped to zero.
93
+ - Pie and polar-area labels on black or gray slices stay readable.
94
+ - A glow on a small element is no longer cut to a box by the filter region.
95
+ - SFL patching no longer corrupts documents containing `"""` multiline strings.
96
+ Block and property positions come from the real lexer, so there is a single
97
+ SFL grammar.
98
+ - Property values that span multiple lines are replaced as a whole.
99
+ - A throwing host event handler no longer prevents the remaining handlers from
100
+ running; the error is rethrown asynchronously.
101
+ - A press that the document handles no longer selects the element afterwards.
102
+ - Widget digits follow a changed value on update; shader surfaces render at the
103
+ size shown on screen, so zoomed widgets stay sharp.
104
+
105
+ ## [0.1.0] - 2026-07-26
106
+
107
+ First versioned release. Not yet published to npm.
108
+
109
+ ### Added
110
+
111
+ - **`stickyflow`** — the static tier. `render()` / `renderCanvas()` turn SFL text
112
+ into a self-contained SVG string with no DOM involved, so it runs in Node, in
113
+ SSR, or in a build step. Also exposes the staged pipeline behind it
114
+ (`parse`, `canonicalize`, `sflToCanvasState`, `sflToImportJson`,
115
+ `sflToRenderInput`) for tools that need an intermediate representation.
116
+ - **`stickyflow/viewer`** — the read-only interactive tier. `createViewer()`
117
+ mounts a diagram into a container element with select, hover, pan and zoom, and
118
+ emits serializable events. Never mutates its own model.
119
+ - **`stickyflow/interaction`** — the editing tier, layered on top of the viewer.
120
+ Two halves that can be used independently:
121
+ - `bindEditing()` binds DOM gestures — double-click text edit, drag-to-move
122
+ (including multi-selection), drag-to-resize, and drag-to-reconnect link
123
+ endpoints — each reporting a serializable event rather than mutating anything.
124
+ - Pure patch functions with no DOM dependency, usable from Node:
125
+ `applyTextChange`, `applyMoveChange`, `applyResizeChange`,
126
+ `applyLinkReconnectChange` turn a gesture's event into updated SFL text;
127
+ `insertEntity`, `removeEntity`, `insertLink`, `removeLink` cover structural
128
+ changes that no gesture produces.
129
+ - **`stickyflow/web-component`** — `defineStickyflowDiagram()` registers a drop-in
130
+ `<stickyflow-diagram>` element.
131
+ - **`Table` as a first-class SFL block kind.** `Table t { … }` alongside the
132
+ existing `Container t { kind: table … }`, which keeps working.
133
+ - **Interactive DOM contract** (`DOM_CONTRACT_VERSION`, currently `1`) — every
134
+ rendered node carries its owner's role and id, so an interaction layer can map
135
+ any sub-node back to the entity it belongs to.
136
+ - **Committed golden renders** (`test/__golden__/`) locking the pipeline's output,
137
+ plus a repeat-render check asserting byte-identical results.
138
+
139
+ ### Fixed
140
+
141
+ - **Link `segments:` were silently dropped.** A list-valued property never reached
142
+ the renderer, because the generic string-props reader used for every other link
143
+ property cannot stringify a list. Manually adjusted orthogonal routes now
144
+ survive the round trip and render as authored.
145
+ - **Single-line blocks were mis-measured when patching SFL.** Block ranges were
146
+ found by counting braces per line as a net delta, which cannot tell a block that
147
+ opens and closes on one line apart from a line with no braces at all — so an
148
+ edit could swallow the following sibling block. Brace matching is now a real
149
+ character scan.
150
+ - **`Table` was missing from the patcher's block-header pattern**, making every
151
+ `apply*Change` call a silent no-op for tables declared with the new keyword.
152
+ - **Locale-dependent node ordering.** Equal-order scene nodes were tie-broken with
153
+ `localeCompare`, which is host- and ICU-dependent and could reorder output
154
+ across machines. Now a locale-independent code-point compare.
155
+
156
+ [Unreleased]: https://github.com/D-Queck/stickyflow.js/compare/v0.1.0...HEAD
157
+ [0.1.0]: https://github.com/D-Queck/stickyflow.js/releases/tag/v0.1.0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,168 @@
1
- # Temporary Holding Version
1
+ ```text
2
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
3
+ @@*- - * = . *@
4
+ @@*++-::-::-:::::---::.:.:::::::::::-:::::-::::-:---:-:. .@@@@@@@. ::::::---:-:::::::::---::::::--:--:-:::::---:: %@
5
+ @@ .::---::::::-::::::::::-:::::::::::::::-:::::::::. -@@@@@: -@@@@@+ :::------:-::-::-:::.:::::::::::-::---::-:: #@
6
+ @@*-::::.:::-::::::::-----::::::::-::::::::-:-:::. *@@@@@ -*+-+@@@@@* .::::-::::--:::::-:::::-:-::::-:-::::::: %@
7
+ @@.----:--::::::::::::::::-:::::::::.::::--::. .%@@@@% .::.-%***+-+@@@@@%. ::::----:::::::::::::-::::::::::::-: %@
8
+ @@ ------:-:::-::::::-::::-:-::::::-::-::.. +@@@@@@ .-:::::-%*%*%**: %@@@@@+ :::-:---::-::::::::::.:::::::-::- *@
9
+ @@ .:-:-::-:-::::::-:::-::::::::::::::: *@@@@@*@@@-.-:-::::.-%%*%**%-.: +@@@@@* .--::::::-::::::::::::::::::.: %@
10
+ @@.:.-:---:::::::-::-::::::::::::::. @@@@@%+. +@@@-:-::-::.:+**%*%%**.-::. @@@@@@@@% .::::-:::::::::::::::-::.:: %@
11
+ @@:-----::-::::::::-::.:::::::::. -@@@@@*-- +@@@-.:::-:+*.+=%%**%%+::--: @@@@@@@@@@@@ .:.::::::.:--::-::-:---- %@
12
+ @@ .:::.-:::::::::::---:::::: -@@@@@.:-. . +@@@-.---:. *-+*=*%%%%-.:-::.@@@@@@@@@%@@@@@ ::::::-:::::--:::::: %@
13
+ @@ ::::::::-::::::--:::::. %@@@@@ :+-: .-%%@ =@@@+.::..*%:-@*#*+%*%+.::::.@@@@@@*@@@@@#@@@@@. .::-:-:-::::::::: %@
14
+ @@:::::::::::::::-::-:. -@@@@@* -++ +@%@**%@ *@@@-.-:*%*+#%+*+*%%%%+.:-::.@@@@@@@@@@@@@@@@@@@@@+ .:--:::::::::: %@
15
+ @@ .::::::-::.::::.. *@@@@@*.--- . -@@@*%*- *@@@-.:.. +*%**%#***##+.---:.@@@@@@@@+ -@@@@@@#@@@@% .:::::::::: %@
16
+ @@ ::::-:::::::. #@@@@#- :-*@@ .+@%.@%:-. *@@@. .. -*+%##@#@=.-:-:.@@@@@@% ::.***@@@@ %@@@@#. .::--:: %@
17
+ @@ :::-:-:::. .@@@@@@ ::: . #@@ %@@++ -@--:*@@@%@@@@ .:*=**-*%%#@+.:--..@@@@@@: ::..%%*@@@@ ... :@@@@@- .::: %@
18
+ @@ .:::-:: -@@@@@@@@@ ::--- . @@@- -##-+@*- *@@@@@@@@: - - *%%%#+.--:::@@@@@@:.-:- %%*@@@@...-+- **+@@@@@+ . %@
19
+ @@ ::: +@@@@#@@@@@@@ -----.. %@@+ *@@+ % *@@@ #= @@%.- *%*@@=.::::.@@@@@@: :-:.%%%@@@@ ..-=* #***+-@@@@@= *@
20
+ @@ . %@@@@%%@@@@@@@@@ -----.... .-@@**- -@: =@@@. @@@@+ . -@@@::-=+-:..@@@@@@@ .:: %*%@@@@ :.+=+ #%*%*%+* #@@@@@@
21
+ @@ *@@@@@* @@@@@@@@@@ ::--+ ...%@@: *@%+ @+#@@@%@@@ @@@@@@@@@----+----%+:@@@@@@@@ . %%%@@@@...++*.%*%*%*%%- *@
22
+ @@ -%@- :--:@@@@@@@@@@ ----- . + *@@.+@@@@@@@%*+ @@@@@@@@@@@@ -+*%*@@*@#%#@@@@@@@* %*%@@@@ ..-**.%*%*%*%%+.:.- %@
23
+ @@ : ---+-+--@@@@@@@@@@ ---:-.. .@% %@#++:...+*+ #@@@@@@@@@@@@@ :. .@%-*%@@@%%%%#@@@@@ +**@@@@...=*% %%*%%%-+-:::: *@
24
+ @@ -.-*+-+-+:@@@@@@@@@@ ::-*- . @**-+-++- :@@@@@@@@@@@@@@@@@#+ %+ ..-+*@@##%%*@@@@@#+%@@@...=%*.%%%%+-=+--::- %@
25
+ @@ -.++---+::@@@%@@@@@@ ::. .+-*-+ @@@@@@@@@@#@@@@*:*%#@@@@%%%%**++ .--*@@@#%%%*@@@@@@@...+*% %*%%:-::-::-- %@
26
+ @@ -.+-+--+-:#@@@@@@@@@ . %@@@@* %@@@@@@@@@@@@@@@@@@% :-+*%%***+#@@@@@- ..:--@@@##%%%@@@@...*%%.#*-*@%:+-:::- %@
27
+ @@ :.-+:-+---@@@@@@@@@@ :@@@@@@@@@@@@@@@@@@@@@@@@@@@@***% ....:%- %@@@+ @@@@-. .--+#@@%...-@:. +*% -::-+-.-+.::- %@
28
+ @@ ::+-+-----@@@@@@@@@@ .%==*@@@@@@@@@@@*@@@@@@@@***%%%%*:-.:.- +@@@@#*@@@@@*%%*- :--**+--=+*:*%%.%-:.---+-:::- %@
29
+ @@ :.*-+-+--:@@@@@@@@@@ .@@@@@%+#@@@@@@@@@@@@@@@@@%**%%%*.=:..+ :*-** -@@@@%. *%*%*%%*-. . +*%-+. *%%.#+:+.:---:-:- %@
30
+ @@ ::+----+--@@@@@@@@@@ + .%@@@@%*#@@@@@@@@@@@@@@@@@***#%=- : :+%% -##@@%%%%%%%+. . ...: *##::.*#* %%:::-- %@
31
+ @@ :.+++-----@@@@@@@@@.@@@@@ -@@@@* #@@@@@@@@@@@%@@@@**%%#%*%%%%*=. .. -=-- -%%%*%%%- :::: *%#.-*%%%*@*:..-- %@
32
+ @@ :.+:-++--:@@@@@@@@@@ *@@@@% *@@@@@@@@@@@@@@@@%+*%%%*%##%******%%%:. +#%%*%**%***:+-.:.*%%-*+. #@**@%--- %@
33
+ @@ ::=+------@@@@@@* %@@@@+ @@@*-....--: -@@@@@@@@+ @@@@@%+*%*%%%##@##%%%% . :****%*%*+=-#*.:: *% :-#@%%*@%.:-- *@
34
+ @@ ::-+-+-+--@@@@@@@@+ -@@@@@+ :-....-----:. .@% . @@@@@@***%%%%%%%*%*+-+*%*#**=*%@@@@% ::.*@%-+:-:-%+-:.::-.%@
35
+ @@ .:+-------@@@@ .@@@@@- @%----+ ...---+----:.. .::.---:: #@@@@@%+**%*%*%*++-=**+%#@@@@@@@% :: *@@@@***-#-*%*-:- %@
36
+ @@ :.+--+-+-:@@%@@@@: %@@@@- :--:- .-+--+------::.::--=+---: *@@@@@#+-+*%*%-+=@@@@@@@@@@@@+ .*@@@#: :+**- -:- %@
37
+ @@ ..*-------@@: *@@@@% . -:-:..:-%%+**+--+-+-+-:::::-- -+--::: -@@@@@@*--@@@@@@@@@@@% *##%*****%*#%:.. + .::-:- %@
38
+ @@ ::*+-+--. *@@@@% -@@@#--:...#@%: --+++--+--+.-:::-:.@- :---:-: :@@@@@@@@@@@@@%- - :.-%%%%*%#@%% . + . %*- %@
39
+ @@ :-*+---+@@% .@@@@@ @@*:.: ...+:-----.-+-::-::-:-@ %%. ---:::: @@@@@@@.- -+-* --: ..%###%*%*+. - -%*-.: %@
40
+ @@ .:*--. :@@@@@ @@- .*@@@@@ :-+ ...-+-.:%@%::+:::::::+%.@@@%+**--+----:. * .:*.-*+-*:% .::..:*##%**%*@*:...:: %@
41
+ @@ .-*:-@@@@* @@@@@+:#@@@@@@@@ ---....--:%@@@@@#-.:::.-. -+ + --* .-------::..++% +*+-% @@@%:.:---:.*@%-. ..::::: %@
42
+ @@ .:***. -@@@@% .@@@@@@@@@@@@@ -:+ ...+-:%@@@@@@-:::..-: @*#- -+:*%@ .. -+ ....+-%.-*+-* @@@@@@:-+----: ..:::::::: %@
43
+ @@ ..*@@@@@- :@@@@@@@@@@@*:@@@@ ---.. .---:%@@@*--..:..--.%#@@ %% -@.+: . *@@@- ++% +**+* @@@@@@.--+-+---::::-:-::- %@
44
+ @@ :.@+ *@@@@@@@@@@@%=--=-@@@@ --+ ...-+-- :--.-++-::-. +=-@@@@+ --.. *@@@@@%++% +*+-% @@@@@% *=+-+-+:::::-:::-- %@
45
+ @@...+%@@@@#@@@@@@*---==**+@@@@ ---....---------**%%+-@@-.:--- +%@*-..: . *@@@@@@*+% +**-* @@@@@# -::+=---::--:----- %@
46
+ @@ ::. -@@@@@@@ :.:++****+@@@@ --- .-::-++**%*- :@@@@@:**=+- -%.-- . *@@@@@@--%.-*+-* @@@@@# : -**::--------- %@
47
+ @@ ::-: *@@@@@@@+@@@#+****+@@@@ :---+++-*+-%** *@@@@: ..-****+. -: . %@@@@@@-*%.+=-**-@@@@@%*@@@@@ .--::-:-:--- *@
48
+ @@ ::-:.*@@@@@@@-@@@@#****-@@@@ *%%+=**##%.%* .+#@%*=*@+ . .-*****+++:.*@@@@@-=*.:*+-*-%@@@@%@@%#@@@*.+--:---:-- %@
49
+ @@ .--:.*@@@@@@@-@@@@@***%-@@@@-=+-*@@@@@+ += +*@@@@##@#%%%##*- ..-=**+--++:.-@@-=**:*%=**@#%@@%@@@@@@##- :+:::---- %@
50
+ @@ :--:.%@@@@@@@-@@@@@****-@@@@++++-+. *@#@%%@@%*: +%@######%- ..:-%*******-*+**%****+*@@@@*.@@@@@@@@@ ---::-- #@
51
+ @@ ::-:.*@@@@@@@-@@@@@****+@@@@-**%.-. -=@@@@#+. .*. +%@@@#@#@%+ -*%-: ***-*%**#+@%%@@% *@@@@#%@@@= -+-::- %@
52
+ @@ ::-:.%@@@@@@@-@@@@*****+@@@@:%%%*- .: .=*%%****. -#@@@%%%@#%#@@+. . ****-*%***@%--@% #@@@@@@@@ -+.- %@
53
+ @@ .-+:.*@@@@@@@-@@@%+++-*@@ ---.*%**+: . :%***+. +*****. .%@@#@%@@%--*-... **%+-#++%+@%@@@% :. +@#@@@@@@@-..=- *@
54
+ @@ :.--:*@@@@@@@-@@::+%@@@.- -=++@#%%%%**#%***-:+@@#+--*%**%*. :#@#%*- .: .. *** -+-=+.@@@@@% -:: %@@@@@#@@* :- %@
55
+ @@ ::--:%@@@@@@@::*@@@%..-.-*.-#* @@*-+%###**--+:@@@@@@%::.+***%**: -%%...:: :%-*.:+--*--.*@@* . .=##@@@@@@@ - %@
56
+ @@ .:+:.*@@@@@@@@@@*::--+-.*@@@@% @@%+++***++*+-- :*@*---=*%*%**- . -+**=***+.---*-+- .@* -#@@@%. @@@#@@@@@* %@
57
+ @@ ::--.*@@@@%%*::-+-+-:%@@@@@@@* @@%*%*#%* -+*=+--@@@@%*#*+++++%*%*%++.-=++++=*%*%=*%=.+: :@@@@@+ =*--@@@@@@@@*- %@
58
+ @@ .-+.:%@@#+ -***+-@@@@@@@@@@@* @::*%%*%*=- .=**%@@@+*+*+: :%*%%*%%***#%**+-+********:+@@@@+. -+.-**@@#@. . %@
59
+ @@ ::-:.**:+=. *#%%@@@@@@@@@@@@% ---%%*%%%%%*+- .-+-+*+ +%%**=++-*#**%=##++**#%%*@@@@@- :+**:****+-+%+.::: *@
60
+ @@ ::---#+ *@* @@@@@@@@@. ::*%*#%%**%**%%%*=- . :+*@%=+*%**%*@%#@##**%###%*#*. @@@@@= +###%**%: ..:.: %@
61
+ @@ --+--#* .. ... @@@@@@ .:-=+-*+-**%%%%%%*%%%%%**- . -%%%%+-=*%%%*%*%**%**=-%%%%%%%%*--: @@@@@* -**+. .::::: %@
62
+ @@ ::::.** .::...:@@* --+***==+#*%++=+*%%*%*%*%%%%%%%%@%**==%%%%**%%%+--++-*+--:+%%%%%%.:---: @@@@%+=@**%=-. ..- %@
63
+ @@.--*%@#*+:. ..-- .-*%@*****%**%*+***%*=*%%%%%*%*%%***-*%%%%*: +**-. :-++= ++++---:+*@%*+-::---.:@@@: .+- .%#*+.- #@
64
+ @@ ..-*@#%**+-..:-*%#@@##%*%%**++*****%*%*%+*=*%%%%-***%%%**+ .---: *#*..-* ++++=*=++ +%++=**-...-@@@- .-.. .*##@%: %@
65
+ @@@# .:%###%*%#%@@@##@#**++=****+**%**%%*****+++*%%%#* *#*=+++++-@@@@@@@-+ -++**+ *%*-@-+-+-***:-@@@*. . -*@*: . %@
66
+ @@@@@@@ -%@##%*##@@#@#*=*-++***#%***%**%%*%**%%%*: :--+--+-++- *@@@* +***% -#*@%-@+*++-*+=**@@@*%*###-. .@@
67
+ @@@@@@@@@* :##@%%%%#%%%++*=*%*****#%*#%***%%*%*%%-**=++-+++-++++- -** .. :%%%-@*:@**%++++=%*%%#@#%. ... +@@@@@
68
+ @@@@@@@@@@@@* :#####%#*****=+******%%%#@%%*%*%==++++-+++++++++-+=**%*+ -**%*+#%**+#*+@*%****++%%@#+ :@@@@@@@@@
69
+ @@@@@@@@@@@@@@@% =%@##%%%*+****%**%%%#####%%%+ ::+=+++++++++++=**+: :*%*-%@@:%+-+ #*-%*%*%*%*%*- .*@@@@@@@@@@@@
70
+ @@@@@@@@@@@@@@@@@@* +%#%*%%%****%%%*%###@%%%%*.@# -***++-=+*+:- +*%*: ..:--.:= ++=#%%##%*:.. -@@@@@@@@@@@@@@@@
71
+ @@@@@@@@@@@@@@@@@@@@@* .-@#%*##%****%*#@#%%*%%*.@%-@*: -***-:.-**+%%%%**-:-::-++*% %%*@@*+. *@@@@@@@@@@@@@@@@@@@
72
+ @@@@@@@@@@@@@@@@@@@@@@@@* +#@#%%%%**####%%@%#* @#.*%#*++.+%#+%@@*+%*%-.*+--.:-+*%*@#*- . @@@@@@@@@@@@@@@@@@@@@@@
73
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@: +@##%#@@%%%%%%%#*.%*=#%*--- -**.: -*=-:++ =-+++.***#- ... -@@@@@@@@@@@@@@@@@@@@@@@@@@
74
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ *@@#@#@#%*%%%*+@%-***--+ -++:+-..++=+-.*-+=*%#-... %@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
75
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@- %@@@#@#%*%*+%+-**=--+ *%*----.+--++-%%**: .. -@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
76
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+ .%@@#@##%:***+-****.+*****+.:-+=**+ :. .*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
77
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@. -%@@#%%%%++*****-***+-+=*%%+-:: +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
78
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@# -%##%*%**+-=+-***%***+. . %@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
79
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@% -#@%*%*%++*%%#*-:.. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
80
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@* +##%*%%#*... .@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
81
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@- .%#-. . *@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
82
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@- -#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
83
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
2
84
 
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.
85
+ -------------------------------------------------- StickyFlow.js----------------------------------------------------------
86
+ ```
87
+
88
+ SFL parser, scene builder, SVG renderer, interactive viewer and editing runtime in one package. No runtime dependencies, no React, no Konva. The static tier is DOM-free and runs in Node.
89
+
90
+ ## Install
91
+
92
+ ```bash
93
+ npm install stickyflow
94
+ ```
95
+
96
+ Node 18 or newer. The package ships ESM, CJS and TypeScript types.
97
+
98
+ ## Quick start
99
+
100
+ ```ts
101
+ import { render } from 'stickyflow'
102
+
103
+ const { svg, width, height, diagnostics } = render(sfl)
104
+ // A complete, deterministic SVG string. render() never touches the DOM.
105
+ ```
106
+
107
+ ## Four entry points
108
+
109
+ | Import | What it is |
110
+ |---|---|
111
+ | `stickyflow` | Static tier. SFL text in, SVG string out. Node, SSR, CLI. |
112
+ | `stickyflow/viewer` | Read-only viewer in the DOM: select, hover, pan, zoom, typed events. |
113
+ | `stickyflow/interaction` | Editing gestures on a viewer. Reports what changed; the host applies the patch to the SFL text. |
114
+ | `stickyflow/web-component` | `<stickyflow-diagram>` custom element in Shadow DOM, no build step. |
115
+
116
+ Each tier only depends on the one below it; `test/boundary.test.ts` enforces that.
117
+
118
+ ```ts
119
+ import { createViewer } from 'stickyflow/viewer'
120
+ import { bindEditing, applyMoveChange } from 'stickyflow/interaction'
121
+
122
+ const viewer = createViewer({ container, source: sfl, interactive: true })
123
+ const editing = bindEditing(viewer)
124
+
125
+ editing.on('moveChange', (event) => {
126
+ sfl = applyMoveChange(sfl, event) // the text changes, nothing else does
127
+ viewer.update({ source: sfl })
128
+ })
129
+ ```
130
+
131
+ ## What it draws
132
+
133
+ Shapes, links, frames, swimlanes, paths and text. Fifteen chart types. Isometric objects. Shader surfaces and widgets. Data sources with bindings, and events with handlers, so a document can react to data and input.
134
+
135
+ ## Principles
136
+
137
+ - **Deterministic.** The same SFL gives the same SVG, byte for byte.
138
+ - **Text stays the source.** Edits patch the SFL text; comments and order survive.
139
+ - **Layered.** Language, semantic, render input, scene, SVG, runtime, each with one job and one direction.
140
+
141
+ ```
142
+ src/
143
+ sflLanguage/ AST, lexer, parser, canonical emitter
144
+ sflSemantic/ SFL AST to canvas state
145
+ renderInput/ renderer contract and style decoding
146
+ renderScene/ deterministic scene construction
147
+ svg/ SVG serialization and the DOM contract
148
+ runtime/ viewer, interaction, web component
149
+ ```
150
+
151
+ ## Develop
152
+
153
+ ```bash
154
+ npm run ci # lint, typecheck, tests, build, smoke
155
+ npm run build # tsup
156
+ ```
157
+
158
+ Adding a new placeable object: [docs/ADDING_CANVAS_OBJECT.md](docs/ADDING_CANVAS_OBJECT.md). Changes: [CHANGELOG.md](CHANGELOG.md).
159
+
160
+ ## More
161
+
162
+ - Docs and examples: [stickyflow.org/docs](https://stickyflow.org/docs)
163
+ - The language: [stickyflow.org/sfl-language](https://stickyflow.org/sfl-language)
164
+ - Playground: [stickyflow.org/playground](https://stickyflow.org/playground)
165
+
166
+ ## License
167
+
168
+ [Apache-2.0](LICENSE)