@nowline/renderer 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.
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by the Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding any notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 Lolay, Inc.
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,94 @@
1
+ # @nowline/renderer
2
+
3
+ SVG renderer for the [Nowline](../../) roadmap DSL.
4
+
5
+ `@nowline/renderer` takes a positioned model from [`@nowline/layout`](../layout)
6
+ and emits a deterministic SVG string. It is palette-dumb (every color comes
7
+ from the positioned model), browser-safe (no `fs`, `path`, `process`, or
8
+ `Buffer`), and has no runtime dependencies beyond `@nowline/layout`.
9
+
10
+ > **Other output formats live in dedicated packages.** PNG, PDF, HTML,
11
+ > Mermaid, XLSX, and MS Project XML are produced by
12
+ > [`@nowline/export-png`](../export-png), [`@nowline/export-pdf`](../export-pdf),
13
+ > [`@nowline/export-html`](../export-html),
14
+ > [`@nowline/export-mermaid`](../export-mermaid),
15
+ > [`@nowline/export-xlsx`](../export-xlsx), and
16
+ > [`@nowline/export-msproj`](../export-msproj) respectively. Each one takes
17
+ > the renderer's SVG (or the AST) as input and adds *only* the runtime
18
+ > dependency it needs — keeping the renderer browser-safe and the per-format
19
+ > install footprint small. See
20
+ > [`specs/handoffs/m2c.md`](../../specs/handoffs/m2c.md) § 1 for the
21
+ > rationale.
22
+
23
+ ## Install
24
+
25
+ ```bash
26
+ pnpm add @nowline/renderer @nowline/layout @nowline/core
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ ```ts
32
+ import { layoutRoadmap } from '@nowline/layout';
33
+ import { renderSvg } from '@nowline/renderer';
34
+
35
+ const model = layoutRoadmap(file, resolved, { theme: 'light' });
36
+ const svg = await renderSvg(model, {
37
+ // optional; used when a roadmap declares a logo path
38
+ assetResolver: async (ref) => {
39
+ const bytes = await fetchLogoBytes(ref); // your IO
40
+ return { bytes, mime: 'image/svg+xml' };
41
+ },
42
+ noLinks: false, // strip link icons when true
43
+ strict: false, // promote asset warnings to errors
44
+ warn: (message) => console.warn(message),
45
+ });
46
+
47
+ svg; // string: <svg ...>...</svg>
48
+ ```
49
+
50
+ The returned string is UTF-8 text ready to write to a file, send over HTTP,
51
+ or inline into HTML.
52
+
53
+ ## Determinism
54
+
55
+ Given identical `(model, options)` inputs, `renderSvg()` returns a byte-identical
56
+ string every call. Guarantees:
57
+
58
+ - IDs come from a counter-based generator (no `Math.random`, no timestamps).
59
+ - Map iteration is stable; arrays are sorted in source-code order upstream.
60
+ - No `Date.now()` or environment-dependent formatting.
61
+
62
+ This makes SVG snapshot tests meaningful: a diff is always a real change, never
63
+ noise.
64
+
65
+ ## Logo embedding
66
+
67
+ - **SVG logos**: read → `sanitizeSvg()` → id-namespaced → embedded as `<g>`.
68
+ - **Raster logos** (`.png`/`.jpg`/`.jpeg`/`.webp`): base64-encoded and embedded
69
+ as `<image href="data:image/<type>;base64,...">`. No re-encoding.
70
+ - **Missing/unsupported/corrupt** → `warn()`, placeholder rendered. `strict:
71
+ true` promotes to an exception.
72
+
73
+ All IO goes through the injected `AssetResolver`. The renderer never touches
74
+ the filesystem.
75
+
76
+ ## Sanitizer
77
+
78
+ `sanitizeSvg(input: string): string` is an in-house allow-list walker designed
79
+ to neutralize hostile SVG payloads embedded as roadmap logos. It:
80
+
81
+ - Rejects `<script>`, `<foreignObject>`, and unknown element types.
82
+ - Strips inline event handlers (`on*` attributes).
83
+ - Rejects external `href` / `xlink:href`; allows fragment-only references.
84
+ - Rejects `data:` URLs inside nested references.
85
+ - Rewrites internal ids under a `nl-logo-*` prefix to prevent collisions.
86
+
87
+ The sanitizer is unit-tested against a corpus of malicious and benign SVGs.
88
+ Zero runtime dependencies.
89
+
90
+ ## Attribution
91
+
92
+ Rendered SVGs include an inline Nowline attribution mark linking to
93
+ `https://nowline.io`. Per project policy, stripping the mark requires a
94
+ commercial license.
@@ -0,0 +1,4 @@
1
+ export type { AssetBytes, AssetResolver, RenderOptions, } from './svg/render.js';
2
+ export { renderSvg } from './svg/render.js';
3
+ export { sanitizeSvg } from './svg/sanitize.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACR,UAAU,EACV,aAAa,EACb,aAAa,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { renderSvg } from './svg/render.js';
2
+ export { sanitizeSvg } from './svg/sanitize.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,26 @@
1
+ export declare const LINK_ICON_PATHS: Record<string, string>;
2
+ export interface CapacityIconSvg {
3
+ /** SVG viewBox attribute. All glyphs are normalized to a 24x24 box. */
4
+ viewBox: string;
5
+ /**
6
+ * Inline SVG fragment — paths/circles/lines using `currentColor` for stroke
7
+ * and `none` (or `currentColor`) for fill. The renderer wraps this in an
8
+ * `<svg>` element whose `width`/`height` set the rendered size and whose
9
+ * `color` (or an enclosing `text`/`g` color) drives the glyph color.
10
+ */
11
+ body: string;
12
+ /** Visible 1-3 ASCII character fallback used when SVG output is constrained
13
+ * to ASCII (e.g. terminal text-mode export). Must match the `Built-in glyph
14
+ * table` in specs/rendering.md. */
15
+ ascii: string;
16
+ }
17
+ export declare const CAPACITY_ICON_SVG: Record<string, CapacityIconSvg>;
18
+ /** Returns true when `name` is a renderer-curated capacity glyph. Useful for
19
+ * differentiating built-ins from custom glyph declarations and inline literals
20
+ * in the upcoming layout/render passes (m6/m7). */
21
+ export declare function hasCapacityIconSvg(name: string): boolean;
22
+ /** ASCII fallbacks for every built-in capacity-icon name, including the ones
23
+ * that render as text (`multiplier`) or render nothing (`none`). The spec's
24
+ * `Built-in glyph table` is the source of truth — keep these in sync. */
25
+ export declare const CAPACITY_ICON_ASCII: Record<string, string>;
26
+ //# sourceMappingURL=icons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/svg/icons.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAUlD,CAAC;AAyBF,MAAM,WAAW,eAAe;IAC5B,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;uCAEmC;IACnC,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAkC7D,CAAC;AAEF;;mDAEmD;AACnD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AAED;;yEAEyE;AACzE,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAOtD,CAAC"}
@@ -0,0 +1,61 @@
1
+ // Built-in link icon paths. All drawn to a 16x16 box; renderer positions them.
2
+ export const LINK_ICON_PATHS = {
3
+ // Generic link/chain icon.
4
+ generic: 'M7 3h2a4 4 0 0 1 0 8H7a4 4 0 0 1 0-8Zm0 2a2 2 0 1 0 0 4h2a2 2 0 1 0 0-4H7Zm6 0h2a4 4 0 0 1 0 8h-2a4 4 0 0 1 0-8Z',
5
+ // Abstract Linear triangle.
6
+ linear: 'M2 8l6-6 6 6-6 6Z',
7
+ // GitHub octocat silhouette (simplified).
8
+ github: 'M8 1C4.14 1 1 4.14 1 8c0 3.1 2 5.7 4.8 6.6.35.07.48-.15.48-.34v-1.2c-1.95.43-2.36-.83-2.36-.83-.32-.82-.78-1.04-.78-1.04-.63-.43.05-.42.05-.42.71.05 1.08.73 1.08.73.62 1.06 1.63.75 2.03.57.06-.45.24-.75.44-.92-1.56-.18-3.2-.78-3.2-3.48 0-.77.27-1.4.72-1.9-.07-.18-.31-.9.07-1.88 0 0 .59-.19 1.93.72.56-.16 1.16-.24 1.76-.24.6 0 1.2.08 1.76.24 1.34-.9 1.93-.72 1.93-.72.38.98.14 1.7.07 1.88.45.5.72 1.13.72 1.9 0 2.7-1.65 3.3-3.22 3.48.25.21.47.63.47 1.27v1.88c0 .19.13.41.49.34C13 13.7 15 11.1 15 8c0-3.86-3.14-7-7-7Z',
9
+ // Jira-ish blue diamond.
10
+ jira: 'M8 1 1 8l7 7 7-7Zm0 3.5L11.5 8 8 11.5 4.5 8Z',
11
+ };
12
+ export const CAPACITY_ICON_SVG = {
13
+ // Lucide `user` — a single figure (head + shoulders).
14
+ person: {
15
+ viewBox: '0 0 24 24',
16
+ body: '<circle cx="12" cy="8" r="4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>' +
17
+ '<path d="M4 21a8 8 0 0 1 16 0" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>',
18
+ ascii: 'p',
19
+ },
20
+ // Lucide `users` — paired figures (foreground + smaller silhouette behind).
21
+ people: {
22
+ viewBox: '0 0 24 24',
23
+ body: '<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>' +
24
+ '<circle cx="9" cy="7" r="4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>' +
25
+ '<path d="M22 21v-2a4 4 0 0 0-3-3.87" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>' +
26
+ '<path d="M16 3.13a4 4 0 0 1 0 7.75" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>',
27
+ ascii: 'P',
28
+ },
29
+ // Lucide `star` — five-pointed star, filled with currentColor for visual weight.
30
+ points: {
31
+ viewBox: '0 0 24 24',
32
+ body: '<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" fill="currentColor" stroke="currentColor" stroke-width="1" stroke-linejoin="round"/>',
33
+ ascii: '*',
34
+ },
35
+ // Lucide `timer` — stopwatch silhouette (face circle, top crown line, hand).
36
+ time: {
37
+ viewBox: '0 0 24 24',
38
+ body: '<line x1="10" x2="14" y1="2" y2="2" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>' +
39
+ '<line x1="12" x2="15" y1="14" y2="11" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>' +
40
+ '<circle cx="12" cy="14" r="8" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>',
41
+ ascii: 't',
42
+ },
43
+ };
44
+ /** Returns true when `name` is a renderer-curated capacity glyph. Useful for
45
+ * differentiating built-ins from custom glyph declarations and inline literals
46
+ * in the upcoming layout/render passes (m6/m7). */
47
+ export function hasCapacityIconSvg(name) {
48
+ return Object.hasOwn(CAPACITY_ICON_SVG, name);
49
+ }
50
+ /** ASCII fallbacks for every built-in capacity-icon name, including the ones
51
+ * that render as text (`multiplier`) or render nothing (`none`). The spec's
52
+ * `Built-in glyph table` is the source of truth — keep these in sync. */
53
+ export const CAPACITY_ICON_ASCII = {
54
+ none: '',
55
+ multiplier: 'x',
56
+ person: CAPACITY_ICON_SVG.person.ascii,
57
+ people: CAPACITY_ICON_SVG.people.ascii,
58
+ points: CAPACITY_ICON_SVG.points.ascii,
59
+ time: CAPACITY_ICON_SVG.time.ascii,
60
+ };
61
+ //# sourceMappingURL=icons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icons.js","sourceRoot":"","sources":["../../src/svg/icons.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAE/E,MAAM,CAAC,MAAM,eAAe,GAA2B;IACnD,2BAA2B;IAC3B,OAAO,EACH,kHAAkH;IACtH,4BAA4B;IAC5B,MAAM,EAAE,mBAAmB;IAC3B,0CAA0C;IAC1C,MAAM,EAAE,ugBAAugB;IAC/gB,yBAAyB;IACzB,IAAI,EAAE,8CAA8C;CACvD,CAAC;AAyCF,MAAM,CAAC,MAAM,iBAAiB,GAAoC;IAC9D,sDAAsD;IACtD,MAAM,EAAE;QACJ,OAAO,EAAE,WAAW;QACpB,IAAI,EACA,kIAAkI;YAClI,oIAAoI;QACxI,KAAK,EAAE,GAAG;KACb;IACD,4EAA4E;IAC5E,MAAM,EAAE;QACJ,OAAO,EAAE,WAAW;QACpB,IAAI,EACA,yJAAyJ;YACzJ,iIAAiI;YACjI,0IAA0I;YAC1I,yIAAyI;QAC7I,KAAK,EAAE,GAAG;KACb;IACD,iFAAiF;IACjF,MAAM,EAAE;QACJ,OAAO,EAAE,WAAW;QACpB,IAAI,EAAE,uMAAuM;QAC7M,KAAK,EAAE,GAAG;KACb;IACD,6EAA6E;IAC7E,IAAI,EAAE;QACF,OAAO,EAAE,WAAW;QACpB,IAAI,EACA,6HAA6H;YAC7H,+HAA+H;YAC/H,mIAAmI;QACvI,KAAK,EAAE,GAAG;KACb;CACJ,CAAC;AAEF;;mDAEmD;AACnD,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC3C,OAAO,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;AAClD,CAAC;AAED;;yEAEyE;AACzE,MAAM,CAAC,MAAM,mBAAmB,GAA2B;IACvD,IAAI,EAAE,EAAE;IACR,UAAU,EAAE,GAAG;IACf,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC,KAAK;IACtC,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC,KAAK;IACtC,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC,KAAK;IACtC,IAAI,EAAE,iBAAiB,CAAC,IAAI,CAAC,KAAK;CACrC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare class IdGenerator {
2
+ private readonly prefix;
3
+ private counter;
4
+ constructor(prefix?: string);
5
+ next(label?: string): string;
6
+ }
7
+ //# sourceMappingURL=ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../src/svg/ids.ts"],"names":[],"mappings":"AAIA,qBAAa,WAAW;IAER,OAAO,CAAC,QAAQ,CAAC,MAAM;IADnC,OAAO,CAAC,OAAO,CAAK;gBACS,MAAM,GAAE,MAAa;IAClD,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM;CAI/B"}
@@ -0,0 +1,15 @@
1
+ // Deterministic id generator. A single counter per renderSvg() call yields
2
+ // ids like `nl-0`, `nl-1`, ... so identical inputs emit identical SVGs.
3
+ // Never uses Math.random, Date.now, or ambient state.
4
+ export class IdGenerator {
5
+ prefix;
6
+ counter = 0;
7
+ constructor(prefix = 'nl') {
8
+ this.prefix = prefix;
9
+ }
10
+ next(label) {
11
+ const id = `${this.prefix}-${this.counter++}`;
12
+ return label ? `${id}-${label}` : id;
13
+ }
14
+ }
15
+ //# sourceMappingURL=ids.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ids.js","sourceRoot":"","sources":["../../src/svg/ids.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,wEAAwE;AACxE,sDAAsD;AAEtD,MAAM,OAAO,WAAW;IAES;IADrB,OAAO,GAAG,CAAC,CAAC;IACpB,YAA6B,SAAiB,IAAI;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IACtD,IAAI,CAAC,KAAc;QACf,MAAM,EAAE,GAAG,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;QAC9C,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACzC,CAAC;CACJ"}
@@ -0,0 +1,28 @@
1
+ import type { PositionedDependencyEdge, PositionedHeader, PositionedItem, PositionedRoadmap, PositionedSwimlane, PositionedTimelineScale, Theme } from '@nowline/layout';
2
+ export interface AssetBytes {
3
+ bytes: Uint8Array;
4
+ mime: string;
5
+ }
6
+ export type AssetResolver = (ref: string) => Promise<AssetBytes>;
7
+ export interface RenderOptions {
8
+ assetResolver?: AssetResolver;
9
+ noLinks?: boolean;
10
+ strict?: boolean;
11
+ warn?: (message: string) => void;
12
+ idPrefix?: string;
13
+ }
14
+ declare function renderHeader(h: PositionedHeader, idPrefix: string, palette: Theme): string;
15
+ declare function renderTimeline(t: PositionedTimelineScale, palette: Theme): string;
16
+ declare function renderItem(i: PositionedItem, options: RenderOptions, idPrefix: string, palette: Theme): string;
17
+ declare function renderSwimlane(s: PositionedSwimlane, options: RenderOptions, idPrefix: string, palette: Theme): string;
18
+ declare function renderEdge(e: PositionedDependencyEdge, palette: Theme): string;
19
+ export declare function renderSvg(model: PositionedRoadmap, options?: RenderOptions): Promise<string>;
20
+ export declare const __internal: {
21
+ renderItem: typeof renderItem;
22
+ renderSwimlane: typeof renderSwimlane;
23
+ renderTimeline: typeof renderTimeline;
24
+ renderHeader: typeof renderHeader;
25
+ renderEdge: typeof renderEdge;
26
+ };
27
+ export {};
28
+ //# sourceMappingURL=render.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/svg/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIR,wBAAwB,EAGxB,gBAAgB,EAEhB,cAAc,EAId,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EAGvB,KAAK,EACR,MAAM,iBAAiB,CAAC;AAsEzB,MAAM,WAAW,UAAU;IACvB,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;AAEjE,MAAM,WAAW,aAAa;IAC1B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAEjC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AA0TD,iBAAS,YAAY,CAAC,CAAC,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,GAAG,MAAM,CAyEnF;AA6ED,iBAAS,cAAc,CAAC,CAAC,EAAE,uBAAuB,EAAE,OAAO,EAAE,KAAK,GAAG,MAAM,CA2G1E;AAoID,iBAAS,UAAU,CACf,CAAC,EAAE,cAAc,EACjB,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,KAAK,GACf,MAAM,CAySR;AAwQD,iBAAS,cAAc,CACnB,CAAC,EAAE,kBAAkB,EACrB,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,KAAK,GACf,MAAM,CAyHR;AAkHD,iBAAS,UAAU,CAAC,CAAC,EAAE,wBAAwB,EAAE,OAAO,EAAE,KAAK,GAAG,MAAM,CAmBvE;AAuYD,wBAAsB,SAAS,CAC3B,KAAK,EAAE,iBAAiB,EACxB,OAAO,GAAE,aAAkB,GAC5B,OAAO,CAAC,MAAM,CAAC,CAmHjB;AAGD,eAAO,MAAM,UAAU;;;;;;CAMtB,CAAC"}