flowsvg 0.0.0-stage → 0.1.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.
Files changed (61) hide show
  1. package/CHANGELOG.md +121 -0
  2. package/LICENSE +21 -0
  3. package/PATTERNS.md +112 -0
  4. package/README.md +546 -2
  5. package/README.zh-CN.md +547 -0
  6. package/dist/adapters/react.d.ts +48 -0
  7. package/dist/adapters/react.js +126 -0
  8. package/dist/adapters/vue.d.ts +132 -0
  9. package/dist/adapters/vue.js +161 -0
  10. package/dist/adapters/web-component.d.ts +99 -0
  11. package/dist/adapters/web-component.js +396 -0
  12. package/dist/browser/accessibility.d.ts +16 -0
  13. package/dist/browser/accessibility.js +36 -0
  14. package/dist/browser/controls.d.ts +41 -0
  15. package/dist/browser/controls.js +80 -0
  16. package/dist/browser/lifecycle.d.ts +6 -0
  17. package/dist/browser/lifecycle.js +31 -0
  18. package/dist/browser/player.d.ts +69 -0
  19. package/dist/browser/player.js +353 -0
  20. package/dist/browser/svg-dom.d.ts +6 -0
  21. package/dist/browser/svg-dom.js +74 -0
  22. package/dist/browser.d.ts +4 -0
  23. package/dist/browser.js +2 -0
  24. package/dist/core/color.d.ts +3 -0
  25. package/dist/core/color.js +18 -0
  26. package/dist/core/diagram.d.ts +38 -0
  27. package/dist/core/diagram.js +391 -0
  28. package/dist/core/edge-geometry.d.ts +32 -0
  29. package/dist/core/edge-geometry.js +382 -0
  30. package/dist/core/model.d.ts +256 -0
  31. package/dist/core/model.js +1 -0
  32. package/dist/core/node-content-paint.d.ts +10 -0
  33. package/dist/core/node-content-paint.js +45 -0
  34. package/dist/core/node-content.d.ts +184 -0
  35. package/dist/core/node-content.js +554 -0
  36. package/dist/core/svg-number.d.ts +5 -0
  37. package/dist/core/svg-number.js +7 -0
  38. package/dist/core/theme.d.ts +21 -0
  39. package/dist/core/theme.js +17 -0
  40. package/dist/core/timeline.d.ts +56 -0
  41. package/dist/core/timeline.js +148 -0
  42. package/dist/core/validation.d.ts +11 -0
  43. package/dist/core/validation.js +389 -0
  44. package/dist/index.d.ts +5 -0
  45. package/dist/index.js +2 -0
  46. package/dist/react.d.ts +3 -0
  47. package/dist/react.js +2 -0
  48. package/dist/styles.css +47 -0
  49. package/dist/vue.d.ts +3 -0
  50. package/dist/vue.js +2 -0
  51. package/dist/web-component.d.ts +3 -0
  52. package/dist/web-component.js +2 -0
  53. package/docs/images/entity-graph.png +0 -0
  54. package/docs/images/facts-timeline.png +0 -0
  55. package/docs/images/facts-timeline.zh-CN.png +0 -0
  56. package/docs/images/node-content.png +0 -0
  57. package/docs/images/numbered-list.png +0 -0
  58. package/docs/images/numbered-list.zh-CN.png +0 -0
  59. package/docs/images/quick-start.png +0 -0
  60. package/docs/images/record-tags.png +0 -0
  61. package/package.json +88 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,121 @@
1
+ # Changelog
2
+
3
+ ## 0.1.1 - 2026-10-20
4
+
5
+ - Adopted thin neutral node borders, gray edges and blue emphasis in both themes. Separate highlight fills from borders and flow markers, remove the node-label halo, and refresh README previews.
6
+
7
+ - Expanded the quick-start document to a six-node order workflow with authorization, persistence, asynchronous events and reverse responses.
8
+
9
+ - Added SDK-rendered previews beside the quick-start, structured-content, list, entity-graph and Facts timeline examples in both package READMEs.
10
+
11
+ - Include the eight README preview images in the npm tarball. Source READMEs use relative image paths for local previews; the release verifier prepares staged README copies with versioned npm CDN URLs for public readers. Release verification requires every preview and rejects undeclared documentation assets.
12
+
13
+ - Removed local build, source-layout and release instructions from the package READMEs; repository documentation retains the contributor workflow.
14
+
15
+ - Completed bilingual module navigation, updated migrated test links, and consolidated architecture implementation and verification records.
16
+
17
+ - Grouped React, Vue, and Web Component implementations under `src/adapters/` while keeping explicit root entries, shared Web Component registration identity, SSR-safe imports, lifecycle behavior, and cross-host integration tests. Updated nested release artifacts and consumer references.
18
+
19
+ - Grouped the browser player implementation and its controls, accessibility, lifecycle, and SVG DOM modules under `src/browser/` while preserving the `flowsvg/browser` entry, lifecycle behavior, DOM-free imports, and public player contract. Updated browser tests and release allowlists for nested build output.
20
+
21
+ - Moved shared hexadecimal color interpolation to the pure `src/core/color.ts` module. Timeline evaluation and diagram paint share the same runtime helper; content painting checks contrast without a timeline dependency.
22
+
23
+ - Centralized edge routing, path sampling, distance queries, label anchors, hit testing, and SVG number formatting in `src/core/edge-geometry.ts` and `src/core/svg-number.ts` while preserving the existing public frames and SVG output.
24
+
25
+ - Organized the platform-independent core into shared model, document validation and diagram orchestration modules. Preserved all public values/types, error identity and evaluation behavior; grouped core tests with their implementation.
26
+ - Preserved nested JavaScript and declaration build output and replaced the release file pattern with an explicit module allowlist that rejects source, tests and unrelated files.
27
+
28
+ ## 0.1.0 - 2026-10-17
29
+
30
+ - Added a release CLI that runs type checks, SDK and release-script tests, tarball consumer verification, example builds and npm publication preview. Default to preview; require `--publish` for upload, and publish the exact verified tarball retained in `dist/releases/`.
31
+
32
+ - Require Vue 3.5+ and build its declarations against Vue 3.5.0. Verify strict consumer types and server rendering with minimum supported React 18.0.0 / Vue 3.5.0 as well as current framework releases.
33
+
34
+ - Prepared the first npm release with repository metadata, public registry settings, bilingual package documentation, automatic prepack builds and prepublish type/test checks.
35
+ - Verify packaging from a missing `dist`, every exported JavaScript/type/CSS target, the file allowlist, framework-free imports, strict consumer types and all four host lifecycles.
36
+
37
+ - Renamed the package and SDK directory to `flowsvg`. Player exports now use the `Flow` prefix: `FlowPlayer`, `FlowPlayerProps`, `FlowPlayerHandle`, `FlowPlayerElement`, `defineFlowPlayer()` and `FLOW_PLAYER_TAG`. The default element is `<flowsvg-player>`; CSS classes and control variables use `flowsvg-` and `--flowsvg-`. Imports, selectors and public API references must use the new names.
38
+
39
+ - Fixed cylinder SVG fills by rendering the top cap as a separate filled ellipse inside the same node interaction group, so the cap no longer appears hollow.
40
+
41
+ - Default hover now highlights only borders for all nodes and groups, preserving timeline fill and content paint. Enable background hover with `hoverFill: true` in native/React/Vue integrations or `hover-fill` on the Web Component.
42
+
43
+ - Added group-boundary edge endpoints and decorative, fixed-coordinate entity graphs inside structured node content.
44
+ - Preserve graph selection during parent highlights and report local graph overflow without shifting following content blocks.
45
+
46
+ - Added shared content-story acceptance through all four hosts, complete bilingual Facts authoring examples and packed NodeContent replacement/clear checks, including Vue handle and cleanup assertions.
47
+
48
+
49
+ - Kept structured-content role colors readable under explicit, flow and browser hover highlights, including intermediate fill transitions. Shared paint preserves authored colors/fills and all text/clip geometry. Added core and DOM regression coverage plus a real-pointer fixture for content/tag hits, clipped bounds, stationary content/mode/size updates, theme reload and destruction.
50
+
51
+ - Added Facts text tags, multiple tag rows and right-aligned status, shared mixed-font baselines, theme defaults, explicit fill/text provenance, strict nested validation, padded tag geometry and escaped SVG backgrounds. Narrow metadata wraps before body/auxiliary text without resizing nodes.
52
+
53
+ - Added fixed-node unmarked, bulleted and numbered lists with shared marker columns, wrapped body indentation, optional muted auxiliary text, controlled item styles/spacing, exact nested validation paths and public list indices. Width warnings include reduced body columns, even for right-aligned oversized glyphs. Browser and static SVG reuse the same evaluated lines.
54
+
55
+ - Added whole `updateNode.value.content` replacement at the beat start, inherited across beats and scenes. Label/content updates switch display modes; `content: null` clears text without restoring historical labels or resizing nodes. Strict validation rejects dual-mode and conflicting beat assignments.
56
+
57
+ - Added inline text spans with controlled font size, weight and color, shared baselines, per-line heights, public evaluated span geometry, and escaped SVG tspans. Wrapping preserves full Unicode graphemes across source spans, explicit blank lines, English word boundaries, CJK and long URLs without DOM font measurement.
58
+
59
+ - Added fixed-size content on rounded rectangles and cylinders, with contour clearance before authored padding, current-geometry safe areas during node/group movement and resize, and nonnegative clipping for tiny shapes. Verified that ports, straight/orthogonal/curved routes, focus, and transfers keep their geometry.
60
+
61
+ - Added initial fixed-size rectangle `content` with ordered titles, paragraphs, auxiliary text, controlled typography/spacing, strict nested validation, evaluated content geometry, safe-area clipping, and directional overflow warnings. Preserved simple-label behavior and added a standalone native example for both themes.
62
+
63
+ - Preserved collinear cubic reversals in shared geometry so flow distance, hit tests, focus bounds, and labels follow the visible curve. Explicit orthogonal ports now reserve outward endpoint segments and route around endpoint bodies without changing automatic routes. Refreshed public geometry, inherited-state, and reduced-motion JSDoc contracts.
64
+
65
+ - Replaced the native story with a fixed-view request/response example using curved ports, three-then-two synchronized transfers, dots, text capsules, reverse messages, shared participants, and hover. Added a shared-document integration check through native, Web Component, React, and Vue public controls for both themes and reduced motion.
66
+
67
+ - Added browser node hover highlights across shapes and nonempty labels, including overflowing wide Unicode glyphs. Hover combines with flow and explicit highlights, follows stationary pointers across frame updates, and clears on leave, cancellation, document replacement, and destruction without changing core frames or SVG exports.
68
+ - Rendered optional `flow.text` messages as horizontal text capsules with deterministic Unicode width estimates, escaped SVG text, and decorative pointer behavior. Message text stays local to its beat; omitted text retains the solid dot. Added browser export and theme checks for request/response capsules.
69
+
70
+ - Verified parallel transfer groups across beats and scenes, including mixed directions, unequal path lengths, shared-node highlights, seeking, playback speed, reduced motion, and final cleanup. Duplicate flow targets are now reported even when another field on the first flow is invalid.
71
+
72
+ - Added beat-local `flow` actions for deterministic forward or reverse transfer markers on existing edges. Active transfers highlight the edge and both endpoint nodes, respect visibility and reduced-motion options, and are included in static SVG exports.
73
+ - Added curved edge routing with automatic or explicit cardinal ports. Curved path geometry is shared by SVG output, labels, focus bounds, hit testing, and deterministic opposite-direction separation; endpoint tangents follow the selected port normals.
74
+
75
+ - Unified evaluated straight and orthogonal edge geometry for SVG paths, labels, focus bounds, hit testing, and distance-based sampling while preserving the existing public path output.
76
+
77
+ - Improved SVG readability: edge labels use the longest route segment with a background halo, micro-detour turns are widened when safe, and group borders can render as dashed lines. Refined the native example layout to avoid overlapping nodes and response edges.
78
+
79
+ - Expanded the native browser example into a five-scene order request story covering authentication, cache/database persistence, asynchronous queue processing, analytics, and response handling. Added focus, dynamic label/style updates, and live playback status.
80
+
81
+ - Fixed focused SVG backgrounds so they cover offset cameras in both the browser and static exports.
82
+ - Matched hit-test priority to SVG paint layers so group backgrounds cannot intercept foreground nodes or edges.
83
+ - Attached straight edges to ellipse contours instead of their rectangular bounds.
84
+ - Preserved Unicode surrogate pairs when wrapping narrow node and edge labels.
85
+ - Kept the React speed prop applied when theme, controls or motion options recreate the player.
86
+ - Removed duplicate Vue onError notifications for a single failed document load.
87
+ - Prevented duplicate animation loops when playback restarts synchronously from player event listeners.
88
+ - Preserved paused and playing Web Component states across visual-option rebuilds instead of reapplying autoplay.
89
+ - Gave each exported or mounted SVG its own accessible name without duplicate title ID references.
90
+ - Added real React mount, props, playback, reload and unmount assertions to tarball release verification.
91
+
92
+ - 补充核心、时间线、播放器及框架接入的职责和契约注释,展开密集声明与语句,便于源码阅读及编辑器类型提示。
93
+
94
+ - Strengthened tarball release verification with a real `<flowsvg-player>` lifecycle smoke test that mounts an object document, plays, reloads, inspects state, removes the element, and confirms cleanup.
95
+ - Prepared the public npm package with root, browser, element, Web Component, React, Vue and stylesheet exports, MIT metadata, Node/browser support guidance, performance guidance, and a clean tarball release verification command.
96
+ - Added the SSR-safe `flowsvg/vue` entry with typed props, player events, exposed controls, client lifecycle cleanup, document reloads, and optional Vue peer dependency metadata. Added a built-artifact Vue example.
97
+
98
+ - Added the SSR-safe `flowsvg/react` entry with typed props, event callbacks, an imperative ref handle, client lifecycle cleanup, document reloads, and optional React peer dependency metadata.
99
+
100
+
101
+ - Added interpolated focus cameras with aspect-preserving viewBox snapshots, document-coordinate hit testing, and browser hover/click interaction events that exclude hidden objects.
102
+ - Added the explicit `flowsvg` Web Component entry. `defineFlowPlayer()` is SSR-safe and idempotent; the element accepts object or JSON documents, URL sources with stale-request cancellation, autoplay, controls, speed, theme and reduced-motion attributes, forwards typed player events, and tears down on disconnect.
103
+ - Added explicit light/dark visual options, fully resolved evaluated styles, self-contained accessible SVG titles and the `flowsvg/styles.css` control stylesheet.
104
+ - Added canvas keyboard playback/stepping, visible focus styles, and automatic reduced-motion preference updates with explicit overrides and listener cleanup.
105
+
106
+ - Added deterministic node and edge visual updates with cubic geometry, numeric style and RGBA color interpolation, immediate label changes, and exact numeric transition endpoints.
107
+ - Preserve ordinary styles beneath highlights, recompute nested group geometry and orthogonal routes for every frame, and verify dynamic SVG equality in a real browser.
108
+
109
+ - Added transactional document reloads, visibility-driven pause, silent idempotent teardown, and responsive aspect-preserving container sizing.
110
+ - Verified repeated creation/reloads/destruction, disabled controls, error field paths and event consistency in Chromium.
111
+
112
+ - Added progress, adjacent beat stepping, scene selection and playback speed controls with synchronized typed timeline events.
113
+ - Preserve rendered SVG object elements across frame updates and verify seek/playback/static-export equality in a real browser.
114
+
115
+ - Added a compiled continuous narrative timeline, inherited scene state, synchronized visibility fades, highlight transitions, and browser play/pause captions.
116
+
117
+ - Added the platform-independent static diagram compiler, evaluator, and SVG exporter.
118
+ - Added the browser `createPlayer` entry and native static example.
119
+ - Added nested group coordinate resolution, all first-release node shapes, deterministic label wrapping, and layout overflow warnings.
120
+ - Added strict document validation for schema fields, references, timeline values, styles, and actions.
121
+ - Restored deterministic orthogonal edge routing with boundary attachments, obstacle avoidance, stable fallback paths, and SVG direction markers after integrating shape and text layout.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 zac_ma
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/PATTERNS.md ADDED
@@ -0,0 +1,112 @@
1
+ # Patterns
2
+
3
+ - Keep default diagram colors and line metrics in the core theme. Use separate highlight fill, border/marker and marker-text colors so active nodes retain readable text in both themes. Browser hover consumes the same theme values; preserve border-only hover by default. Node labels have no halo; edge labels retain background isolation where paths cross text.
4
+
5
+ - Keep README previews in `docs/images/` inside the SDK package. Package only PNG assets and enumerate the expected images in the release verifier; require each image and reject undeclared files. Use relative image paths in source READMEs for local previews. The release verifier unpacks the built package into a temporary directory and converts only its README copies to npm CDN URLs with the package version. Repack without lifecycle scripts, require the packed file set to remain unchanged, then verify and retain that final tarball. Source READMEs must remain unchanged by release verification.
6
+
7
+ - Keep shared document/frame types in `src/core/model.ts`, document validation and its single error class in `validation.ts`, and compilation, cloning/freezing, evaluation, SVG and hit-test orchestration in `diagram.ts`. Node-content types and nested validation remain in `node-content.ts`. Import runtime owners directly; use type imports for shared model dependencies.
8
+ - Enumerate public values and types in the root entry, including `wrapText`, `Diagram` and all node-content types. Keep core contract tests in `src/core/` and consume public entries. Four entry-specific TypeScript builds preserve the internal directory hierarchy under `dist`; enumerate each emitted module in the release allowlist instead of accepting arbitrary files below `dist`.
9
+ - Keep the browser player implementation under `src/browser/player.ts`, with controls, accessibility, lifecycle, and SVG DOM synchronization beside it. Keep `src/browser.ts` as the explicit public entry; browser tests use that entry while core remains DOM-free.
10
+ - Keep React, Vue, and Web Component implementations under `src/adapters/`; root adapter files are explicit public entries that export the single implementation and preserve runtime identity. Adapter tests live beside their implementations and cross-host business scenarios live under `tests/integration/`; imports use public entries.
11
+ - Keep color interpolation in the pure `src/core/color.ts` module. Timeline and diagram painting import it directly so generic color rules do not depend on timeline semantics. Content highlight paint retains theme-specific semantic colors and adjusts default ink only when the evaluated fill requires more contrast.
12
+ - Keep route construction, path measurements, label anchors, and path hit testing in `src/core/edge-geometry.ts`; share integer and three-decimal formatting through `src/core/svg-number.ts`. Diagram orchestration consumes these internal results without exposing geometry.
13
+
14
+ - Run release gates sequentially through the root release CLI. Default to a preview without authentication; check authentication before the gates only for explicit publication. Copy the verified tarball after all consumer checks pass, then preview and publish that file without repacking. Stop on any command failure and keep npm stdio attached for authentication prompts.
15
+
16
+ - Build Vue declarations against the pinned minimum supported version, 3.5.0; newer Vue patch releases can add inferred `DefineComponent` type parameters that older consumers cannot read. Verify both minimum and current framework versions in the packed-package consumer.
17
+
18
+ - Build through `prepack` so `npm pack` and directory publishing cannot use missing or stale artifacts. Keep publish-only type/test checks separate from packaging to avoid recursive release verification. Verify the packed exports and strict consumer types before publishing.
19
+
20
+ - Use FlowSVG as the display name. Publish the SDK as `flowsvg` from `packages/flowsvg`. Use the `Flow` prefix for player exports, `<flowsvg-player>` for the default custom element, and `flowsvg-` / `--flowsvg-` for CSS classes and control variables. Keep package imports, declarations, examples and release verification aligned with these names.
21
+
22
+ - Apply hover to stroke only by default for every node and group. Preserve core fill and content paint, including active flow or explicit highlights. With `hoverFill: true`, paint fill and readable content as well. Forward the same option through every adapter and restore the current core SVG when the pointer leaves.
23
+
24
+ - Serialize cylinders as one keyed interaction group containing a filled body and a filled top ellipse. Keep the cap separate from the body path so SVG fill rules cannot create an interior hole, while shared group paint keeps hover and timeline updates consistent.
25
+
26
+ - Use evaluated group rectangles as ordinary edge endpoints. Keep group frames out of global routing obstacles; apply endpoint/ancestor masking and beat-local flow highlights to the group itself.
27
+ - Keep entity graph IDs local to a content block. Derive absolute primitives and text from authored local coordinates, serialize inside the parent clip, and retain the parent node as the sole interaction identity.
28
+ - Preserve local graph selection in evaluated primitives. Parent timeline/hover paint must keep selected and ordinary entities distinguishable, and graph overflow must not change the following block's authored position.
29
+
30
+ - Verify combinations through one authored content story and public host handles. Compare core frames/SVG across theme and motion options; assert record replacement/mode semantics independently. Packed release smoke must inspect Vue mounting and content updates, not only mount/unmount.
31
+
32
+
33
+ - Apply one content-paint function after core layout for timeline highlights and again to current DOM children for browser hover. Preserve explicit color/fill provenance and reuse current geometry. During fill transitions, check default ink against the evaluated node or tag fill and select contrasting ink when interpolated colors lose readability. Restore the current core SVG before hover paint; never restore saved markup or mutate core frames. Content children remain decorative within one node target.
34
+
35
+ - Lay out tags in authored rows before status and body. Share a metadata baseline only when natural widths fit, preserve grapheme wrapping inside padded tag boxes, and expose background geometry and explicit-fill provenance alongside text spans. Serialize decorative backgrounds inside the same clip without extra node identities.
36
+
37
+ - Lay out list entries through the shared deterministic text-part function. Reserve one list-wide marker column and align each marker with the first present text baseline; preserve source item indices and omit height/gaps for absent entries. Aggregate text-part width overflow before checking the outer clip, so alignment cannot conceal an insufficient body column. Include indentation when checking width overflow, and inherit only controlled text fields without allowing undefined item overrides to discard list defaults.
38
+
39
+ - Store node content in inherited timeline snapshots. Clear the other display mode when applying label/content updates, including `content: null`. Use target text values even at zero transition progress; geometry and paint continue interpolating. Reserve one shared beat assignment key for both node text modes, and validate content with the same nested schema used by initial nodes.
40
+
41
+ - Segment combined content with `Intl.Segmenter` before applying source styles, so inline boundaries cannot split graphemes or create extra wrapping opportunities. Use the cluster start style for cross-span clusters. Resolve each line's maximum font, shared baseline and left-positioned spans once in the core; preserve author-color provenance and serialize escaped tspans from those results.
42
+
43
+ - Compute content safe areas from current absolute node geometry. Reserve rounded-corner or cylinder-cap clearance before authored padding, clamp empty dimensions to zero, and use the same area for public layout and SVG clipping. Share the supported-shape predicate between initial content and timeline content validation; keep content separate from node-parent, port, route, focus, and transfer geometry.
44
+
45
+ - Keep structured node content in a deterministic module that accepts current absolute geometry and a resolved theme. Return the complete layout plus a nonnegative safe area, then consume those same lines and clip geometry in SVG. Keep content child groups keyed separately from the node shape; only the shape uses its node `data-id`. Validate controlled nested fields before cloning, and preserve simple-label overflow behavior.
46
+
47
+ - Preserve collinear extrema when compacting path points: a reversal contributes distance and bounds even when all samples lie on one axis. For explicit orthogonal ports, reserve outward endpoint stubs before grid search and include inflated endpoint bodies among middle-route obstacles; leave fully automatic routing unchanged.
48
+
49
+ - Keep hover in the browser paint layer: restore the current core SVG before applying a hovered node's shared-theme highlight colors. Re-hit the saved screen position through the updated camera after each frame. Include nonempty node label bounds using the capsule's shared width estimate for wide characters. Clear interaction causes on pointer cancellation, successful load, and destroy. Never write hover into the core frame or timeline; removing hover must expose the current explicit/flow highlight or ordinary style.
50
+ - Render transfer text from the evaluated beat-local `flow.text`, without changing the edge label. Estimate capsule width by Unicode code points with full-em space for wide characters, retain horizontal text, escape plain SVG content, and disable marker pointer handling. Verify current browser messages and static SVG equality with `tests/browser-flow-text.html`.
51
+
52
+ - Treat each beat’s transfers as a synchronized group: derive all marker positions from the same linear progress and union endpoint highlight reasons. Reject a second flow for the same edge regardless of direction or other field errors; keep flow assignments separate from visibility, explicit highlights, and base updates.
53
+
54
+ - Compile `flow` actions as beat-local state: use the full beat progress for distance-based marker sampling, keep static edge arrows unchanged for reverse transfers, and derive temporary edge/endpoint highlights during frame evaluation so they expire without overwriting explicit highlights or ordinary style updates.
55
+ - Generate curved routes from cardinal port normals and use the same sampled geometry for path consumers. Keep endpoint control points on the outward side of each port so the path enters the target along the inverse normal; separate reverse relationships with a deterministic perpendicular lane.
56
+
57
+ - Keep the native business example in a fixed view: use the same document across public integration checks, synchronize three request paths then two processing paths, and return messages through reverse flows and a separate response relationship. Compare public frame/SVG output at beat boundaries rather than adding adapter clocks or test-only APIs.
58
+ - Place labels on the longest segment of a routed edge and give them a background halo; remove only collision-free micro-turns so arrow paths remain orthogonal and readable.
59
+
60
+ - Draw the SVG background at the evaluated camera's x/y/width/height; percentage dimensions at the document origin do not cover an offset viewBox.
61
+ - Hit-test ordinary nodes, edges, then group backgrounds, reversing document order within each layer to match SVG paint priority.
62
+ - Project straight edge endpoints onto ellipse contours with normalized ellipse coordinates; preserve cardinal attachment sides for orthogonal routes.
63
+ - Estimate and slice wrapped text by Unicode code point, so narrow labels cannot split surrogate pairs before SVG export.
64
+ - Apply current playback props to every newly created framework player; an effect keyed only by speed cannot initialize replacements when speed is unchanged.
65
+ - Vue's emitted `error` event already calls `onError`; do not call the same prop manually after emitting it.
66
+ - A player owns at most one pending RAF: clear the consumed handle on tick entry and reuse guarded scheduling after events, because listeners can pause and restart synchronously.
67
+ - Web Component option rebuilds restore the prior time/playback state before starting playback; autoplay governs fresh mounts, not rebuilds of a user-paused instance.
68
+ - Name SVG images directly with escaped `aria-label` and retain a readable `<title>`; document-wide ID references must not couple independent deterministic exports.
69
+ - Release smoke tests await React `act` to flush mounting and cleanup, assert SVG and ref state, exercise playback/reload, then verify unmount cleanup; scheduling a render alone proves no client behavior.
70
+
71
+ - 源码注释遵循 [注释维护规范](https://github.com/yokingma/FlowSVG/blob/HEAD/docs/agents/code-comments.md):公开 API 说明行为契约,内部实现说明原因与约束,重要模块说明职责;修改实现时同步核对相邻说明。
72
+
73
+ - Keep release verification outside the published files: build once, pack the exact tarball, install it in a temporary project with each optional framework peer, import every public entry in Node, create a real `<flowsvg-player>` element to exercise object-document assignment, play/load/state, removal and cleanup, and mount/unmount the native, React and Vue adapters in a DOM smoke test. Keep the package ESM-only and declare CSS as a side effect so bundlers retain control styles.
74
+
75
+ - Derive focus camera bounds from evaluated geometry and interpolate camera state with the same transition progress as visual values; serialize that camera into the SVG viewBox so static export and browser frames stay equal. Map browser pointer coordinates through the live SVG viewBox before calling the core hit-test seam, and ignore objects whose effective opacity is zero.
76
+ - Keep Web Component registration explicit and idempotent; never touch `customElements` or instantiate a browser player during module evaluation. Convert object/JSON attributes at the element boundary, validate before replacing the current document, and guard URL responses with an abort controller plus request token so stale loads cannot win. Forward player events with bubbling/composed details and destroy the wrapped player on disconnect.
77
+
78
+ - Keep the React entry as a lifecycle adapter around `createPlayer`: instantiate only from an effect, remove event listeners before destroying a replaced player, and expose the browser player's methods through `useImperativeHandle`. Importing the entry must remain DOM-free for SSR; `initialTimeMs` applies once per mounted component.
79
+ - Keep the Vue entry as a `defineComponent` lifecycle adapter around `createPlayer`: instantiate only from `onMounted`, detach events before `onBeforeUnmount`, and expose the browser player methods with setup `expose`. Importing the entry must remain DOM-free for SSR; `initialTimeMs` applies once per mounted component and option changes recreate the browser player.
80
+
81
+ - Pass serializable theme and reduced-motion values from the browser to the core; explicit options override document theme and browser motion preferences. With no theme, use light without reading the system color scheme.
82
+ - Resolve all diagram paint and typography in the core SVG; CSS variables customize controls only. Give each SVG its own accessible name without cross-player title ID references.
83
+ - Scope Space/Arrow shortcuts to the focusable canvas and preserve editable/native control keys, key modifiers and repeated key behavior. Own keyboard/media-query listeners and detach them on destroy.
84
+ - Verify automatic reduced motion with real browser media emulation at a fixed transition midpoint; compare player SVG with the core export using the same options. Accessibility checks live in `tests/browser-accessibility.html`.
85
+
86
+ - Compile ordinary visual values independently of visibility/highlight layers; interpolate base colors first and apply the highlight color afterward, regardless of action order within a beat.
87
+ - Keep theme defaults unresolved until evaluation so interpolated source colors follow the caller's theme. Labels change at beat start; numeric endpoints return exact values and weighted interpolation avoids overflowing a finite endpoint difference.
88
+ - Resolve parent-relative positions and text dimensions from current visual values on each frame before routing against effective visible obstacles; reveal begins blocking at zero opacity and hide stops blocking only when its transition finishes.
89
+ - Validate dynamic browser/core/export equality with `tests/browser-visual-updates.html` at transition starts, middles and ends for both themes and reduced motion settings.
90
+
91
+ - Validate and compile replacement documents before pausing or replacing a valid player; a failed load reports the retained state with validation field paths.
92
+ - Mark players destroyed before cancelling scheduled work and detaching document listeners; guard event dispatch and rescheduling against destruction during event handlers.
93
+ - Use native flex layout and SVG aspect-preserving scaling for responsive containment, so container changes need no ResizeObserver or resize listener. Restore host styles when tearing down.
94
+ - Run lifecycle checks from `tests/browser-lifecycle.html` in Chromium after building; observe public state, events, rendered geometry and post-destroy behavior.
95
+
96
+ - Derive controls, captions and typed `stepchange`/`timeupdate`/`playstatechange` events from one evaluated player state; error details include that same state and a typed error.
97
+ - Step to the closest beat start strictly before/after the current time and pause; previous from inside a beat returns to that beat start, while previous at its exact start selects the preceding beat.
98
+ - Apply the core SVG serialization to retained DOM elements keyed by object ID; preserve live object interactions while synchronizing attributes, labels and paint order.
99
+ - Browser behavior checks live in `tests/browser-controls.html`; build first, serve the repository root and inspect `window.browserTestResults` in a real browser.
100
+
101
+ - Compile beat offsets and before/after visibility and highlight layers once; evaluate the active beat with a binary time lookup and fixed cubic transitions.
102
+ - Keep edge visibility independent from endpoint masking; effective opacity is the minimum of the object, ancestor groups, and endpoints, never multiplied.
103
+ - Derive browser SVG and captions from the same compiled core timeline used by static export.
104
+
105
+ - Keep document compilation and SVG serialization platform independent. The core package does not read browser globals, use a clock, or make network requests.
106
+ - Compile by cloning and freezing serializable input so later caller mutations cannot change a `Diagram` result.
107
+ - Test the public seams (`createDiagram`, `Diagram.evaluateAt`, `renderSvg`, and browser entry imports) rather than private rendering helpers.
108
+ - Resolve child geometry and inherited visibility during frame construction; SVG serialization consumes the same evaluated lines and geometry as browser output.
109
+ - Keep text wrapping deterministic with fixed typography metrics and retain all lines, reporting overflow through `LayoutWarning` entries with object identifiers.
110
+ - Validate every document field and reference before compilation; reject unsafe colors and duplicate timeline assignments with field paths.
111
+ - Route orthogonal edges against evaluated absolute geometry and inherited visibility; exclude group frames from obstacles and serialize direction markers with the same paths.
112
+ - Build each evaluated edge once as internal path geometry with its serialized path, points, length, bounds, and distance-based sampling; use that geometry for labels, focus bounds, hit testing, and active flow sampling so consumers cannot drift apart.