mermaid 13.0.0-alpha.1 → 13.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/THIRD_PARTY_NOTICES +225 -0
- package/dist/api.d.ts +6 -0
- package/dist/api.js +34 -50
- package/dist/chunks/{chunk-H2OXJVDR.mjs → chunk-2SBABYQO.mjs} +2 -2
- package/dist/chunks/chunk-3QHCWLG2.mjs +12 -0
- package/dist/chunks/chunk-3QHCWLG2.mjs.map +1 -0
- package/dist/chunks/{chunk-MCN35FLZ.mjs → chunk-3SMLKEUJ.mjs} +2 -2
- package/dist/chunks/chunk-7PKX7UKH.mjs +2 -0
- package/dist/chunks/chunk-7PKX7UKH.mjs.map +1 -0
- package/dist/chunks/chunk-BBQQRPRV.mjs +3 -0
- package/dist/chunks/chunk-BBQQRPRV.mjs.map +1 -0
- package/dist/chunks/chunk-BFIZPEAM.mjs +6 -0
- package/dist/chunks/chunk-BFIZPEAM.mjs.map +1 -0
- package/dist/chunks/{chunk-TEM3V5TI.mjs → chunk-DTOBFHMA.mjs} +2 -2
- package/dist/chunks/chunk-DUKAL7EW.mjs +7 -0
- package/dist/chunks/chunk-DUKAL7EW.mjs.map +1 -0
- package/dist/chunks/{chunk-S567NRAG.mjs → chunk-FSN3B5SH.mjs} +2 -2
- package/dist/chunks/{chunk-S567NRAG.mjs.map → chunk-FSN3B5SH.mjs.map} +1 -1
- package/dist/chunks/{chunk-DBYKR6N5.mjs → chunk-FYF7T3FM.mjs} +2 -2
- package/dist/chunks/{chunk-VF2HPT64.mjs → chunk-G5JCFFZO.mjs} +2 -2
- package/dist/chunks/chunk-HVRHH7BT.mjs +6 -0
- package/dist/chunks/chunk-HVRHH7BT.mjs.map +1 -0
- package/dist/chunks/chunk-ICB73T2E.mjs +25 -0
- package/dist/chunks/chunk-ICB73T2E.mjs.map +1 -0
- package/dist/chunks/{chunk-UYRMWGUL.mjs → chunk-IOHHGREU.mjs} +2 -2
- package/dist/chunks/{chunk-UYRMWGUL.mjs.map → chunk-IOHHGREU.mjs.map} +1 -1
- package/dist/chunks/chunk-IY435URU.mjs +2 -0
- package/dist/chunks/chunk-IY435URU.mjs.map +1 -0
- package/dist/chunks/chunk-J2CYG3BU.mjs +2 -0
- package/dist/chunks/chunk-J2CYG3BU.mjs.map +1 -0
- package/dist/chunks/{chunk-3RTA5CBW.mjs → chunk-JL46TWOM.mjs} +2 -2
- package/dist/chunks/chunk-JN7HU5Z4.mjs +6 -0
- package/dist/chunks/chunk-JN7HU5Z4.mjs.map +1 -0
- package/dist/chunks/chunk-KHWLAZE2.mjs +6 -0
- package/dist/chunks/chunk-KHWLAZE2.mjs.map +1 -0
- package/dist/chunks/chunk-MTHJHLUH.mjs +2 -0
- package/dist/chunks/chunk-MTHJHLUH.mjs.map +1 -0
- package/dist/chunks/chunk-NGL2KHQW.mjs +2 -0
- package/dist/chunks/chunk-NGL2KHQW.mjs.map +1 -0
- package/dist/chunks/chunk-NM2RNLMZ.mjs +5 -0
- package/dist/chunks/chunk-NM2RNLMZ.mjs.map +1 -0
- package/dist/chunks/{chunk-UVUAPY3L.mjs → chunk-RUW4Q76Y.mjs} +2 -2
- package/dist/chunks/chunk-SNYNP3PS.mjs +5 -0
- package/dist/chunks/chunk-SNYNP3PS.mjs.map +1 -0
- package/dist/chunks/{chunk-D2SPINQ5.mjs → chunk-TJOE3FON.mjs} +2 -2
- package/dist/chunks/chunk-VRD5GZ6G.mjs +9 -0
- package/dist/chunks/chunk-VRD5GZ6G.mjs.map +1 -0
- package/dist/chunks/chunk-WBKKKHXZ.mjs +8 -0
- package/dist/chunks/chunk-WBKKKHXZ.mjs.map +1 -0
- package/dist/chunks/chunk-WINJRA54.mjs +7 -0
- package/dist/chunks/chunk-WINJRA54.mjs.map +1 -0
- package/dist/chunks/chunk-WJD3LR33.mjs +5 -0
- package/dist/chunks/chunk-WJD3LR33.mjs.map +1 -0
- package/dist/chunks/{chunk-VXHU4YGB.mjs → chunk-X3UAU7VF.mjs} +2 -2
- package/dist/chunks/chunk-X3VGHK3G.mjs +6 -0
- package/dist/chunks/chunk-X3VGHK3G.mjs.map +1 -0
- package/dist/chunks/chunk-ZOQOZJZV.mjs +2 -0
- package/dist/chunks/chunk-ZOQOZJZV.mjs.map +1 -0
- package/dist/chunks/chunk-ZVYEDT2M.mjs +3 -0
- package/dist/chunks/chunk-ZVYEDT2M.mjs.map +1 -0
- package/dist/chunks/core-layout-tree-index.mjs +2 -0
- package/dist/chunks/core-layout-tree-index.mjs.map +1 -0
- package/dist/chunks/core-theme-specs-base.mjs +1 -1
- package/dist/chunks/core-theme-specs-base.mjs.map +1 -1
- package/dist/chunks/core-theme-specs-dark.mjs +1 -1
- package/dist/chunks/core-theme-specs-dark.mjs.map +1 -1
- package/dist/chunks/core-theme-specs-default.mjs +1 -1
- package/dist/chunks/core-theme-specs-default.mjs.map +1 -1
- package/dist/chunks/core-theme-specs-forest.mjs +1 -1
- package/dist/chunks/core-theme-specs-forest.mjs.map +1 -1
- package/dist/chunks/core-theme-specs-neo-dark.mjs +1 -1
- package/dist/chunks/core-theme-specs-neo-dark.mjs.map +1 -1
- package/dist/chunks/core-theme-specs-neo.mjs +1 -1
- package/dist/chunks/core-theme-specs-neo.mjs.map +1 -1
- package/dist/chunks/core-theme-specs-neutral.mjs +1 -1
- package/dist/chunks/core-theme-specs-neutral.mjs.map +1 -1
- package/dist/chunks/core-theme-specs-redux-dark-color.mjs +1 -1
- package/dist/chunks/core-theme-specs-redux-dark-color.mjs.map +1 -1
- package/dist/chunks/core-theme-specs-redux-dark.mjs +1 -1
- package/dist/chunks/core-theme-specs-redux-dark.mjs.map +1 -1
- package/dist/chunks/diagram-class-language.mjs +9 -9
- package/dist/chunks/diagram-class-language.mjs.map +1 -1
- package/dist/chunks/diagram-class.mjs +1 -1
- package/dist/chunks/diagram-class.mjs.map +1 -1
- package/dist/chunks/diagram-cynefin-language.mjs +6 -0
- package/dist/chunks/diagram-cynefin-language.mjs.map +1 -0
- package/dist/chunks/diagram-cynefin.mjs +2 -0
- package/dist/chunks/diagram-cynefin.mjs.map +1 -0
- package/dist/chunks/diagram-er-ascii.mjs +3 -3
- package/dist/chunks/diagram-er-ascii.mjs.map +1 -1
- package/dist/chunks/diagram-er-language.mjs +1 -1
- package/dist/chunks/diagram-er-language.mjs.map +1 -1
- package/dist/chunks/diagram-er.mjs +1 -1
- package/dist/chunks/diagram-er.mjs.map +1 -1
- package/dist/chunks/diagram-flowchart-ascii.mjs +3 -3
- package/dist/chunks/diagram-flowchart-ascii.mjs.map +1 -1
- package/dist/chunks/diagram-flowchart-language.mjs +1 -1
- package/dist/chunks/diagram-flowchart-language.mjs.map +1 -1
- package/dist/chunks/diagram-flowchart.mjs +1 -1
- package/dist/chunks/diagram-gantt-language.mjs +12 -0
- package/dist/chunks/diagram-gantt-language.mjs.map +1 -0
- package/dist/chunks/diagram-gantt.mjs +2 -0
- package/dist/chunks/diagram-gantt.mjs.map +1 -0
- package/dist/chunks/diagram-gitgraph-language.mjs +22 -0
- package/dist/chunks/diagram-gitgraph-language.mjs.map +1 -0
- package/dist/chunks/diagram-gitgraph.mjs +3 -0
- package/dist/chunks/diagram-gitgraph.mjs.map +1 -0
- package/dist/chunks/diagram-info-ascii.mjs +2 -0
- package/dist/chunks/diagram-info-ascii.mjs.map +1 -0
- package/dist/chunks/diagram-info-language.mjs +4 -0
- package/dist/chunks/diagram-info-language.mjs.map +1 -0
- package/dist/chunks/diagram-info.mjs +2 -0
- package/dist/chunks/diagram-info.mjs.map +1 -0
- package/dist/chunks/diagram-journey-language.mjs +6 -6
- package/dist/chunks/diagram-journey-language.mjs.map +1 -1
- package/dist/chunks/diagram-journey.mjs +1 -1
- package/dist/chunks/diagram-journey.mjs.map +1 -1
- package/dist/chunks/diagram-kanban-ascii.mjs +4 -0
- package/dist/chunks/diagram-kanban-ascii.mjs.map +1 -0
- package/dist/chunks/diagram-kanban-language.mjs +20 -0
- package/dist/chunks/diagram-kanban-language.mjs.map +1 -0
- package/dist/chunks/diagram-kanban.mjs +2 -0
- package/dist/chunks/diagram-kanban.mjs.map +1 -0
- package/dist/chunks/diagram-mindmap-language.mjs +20 -0
- package/dist/chunks/diagram-mindmap-language.mjs.map +1 -0
- package/dist/chunks/diagram-mindmap.mjs +2 -0
- package/dist/chunks/diagram-mindmap.mjs.map +1 -0
- package/dist/chunks/diagram-packet-ascii.mjs +6 -0
- package/dist/chunks/diagram-packet-ascii.mjs.map +1 -0
- package/dist/chunks/diagram-packet-language.mjs +9 -0
- package/dist/chunks/diagram-packet-language.mjs.map +1 -0
- package/dist/chunks/diagram-packet.mjs +2 -0
- package/dist/chunks/diagram-packet.mjs.map +1 -0
- package/dist/chunks/diagram-pie-language.mjs +4 -4
- package/dist/chunks/diagram-pie-language.mjs.map +1 -1
- package/dist/chunks/diagram-pie.mjs +1 -1
- package/dist/chunks/diagram-pie.mjs.map +1 -1
- package/dist/chunks/diagram-quadrant-language.mjs +5 -5
- package/dist/chunks/diagram-quadrant-language.mjs.map +1 -1
- package/dist/chunks/diagram-quadrant.mjs +1 -1
- package/dist/chunks/diagram-quadrant.mjs.map +1 -1
- package/dist/chunks/diagram-radar-language.mjs +15 -0
- package/dist/chunks/diagram-radar-language.mjs.map +1 -0
- package/dist/chunks/diagram-radar.mjs +2 -0
- package/dist/chunks/diagram-radar.mjs.map +1 -0
- package/dist/chunks/diagram-sankey-language.mjs +14 -0
- package/dist/chunks/diagram-sankey-language.mjs.map +1 -0
- package/dist/chunks/diagram-sankey.mjs +2 -0
- package/dist/chunks/diagram-sankey.mjs.map +1 -0
- package/dist/chunks/diagram-sequence-ascii.mjs +3 -3
- package/dist/chunks/diagram-sequence-ascii.mjs.map +1 -1
- package/dist/chunks/diagram-sequence-language.mjs +1 -1
- package/dist/chunks/diagram-sequence-language.mjs.map +1 -1
- package/dist/chunks/diagram-sequence.mjs +1 -1
- package/dist/chunks/diagram-sequence.mjs.map +1 -1
- package/dist/chunks/diagram-state-language.mjs +1 -1
- package/dist/chunks/diagram-state-language.mjs.map +1 -1
- package/dist/chunks/diagram-state.mjs +3 -3
- package/dist/chunks/diagram-state.mjs.map +1 -1
- package/dist/chunks/diagram-timeline-language.mjs +1 -1
- package/dist/chunks/diagram-timeline-language.mjs.map +1 -1
- package/dist/chunks/diagram-timeline.mjs +1 -1
- package/dist/chunks/diagram-timeline.mjs.map +1 -1
- package/dist/chunks/diagram-treemap-language.mjs +23 -0
- package/dist/chunks/diagram-treemap-language.mjs.map +1 -0
- package/dist/chunks/diagram-treemap.mjs +2 -0
- package/dist/chunks/diagram-treemap.mjs.map +1 -0
- package/dist/chunks/diagram-venn-language.mjs +10 -0
- package/dist/chunks/diagram-venn-language.mjs.map +1 -0
- package/dist/chunks/diagram-venn.mjs +2 -0
- package/dist/chunks/diagram-venn.mjs.map +1 -0
- package/dist/chunks/diagram-wardley-language.mjs +17 -0
- package/dist/chunks/diagram-wardley-language.mjs.map +1 -0
- package/dist/chunks/diagram-wardley.mjs +2 -0
- package/dist/chunks/diagram-wardley.mjs.map +1 -0
- package/dist/chunks/diagram-xychart-language.mjs +13 -0
- package/dist/chunks/diagram-xychart-language.mjs.map +1 -0
- package/dist/chunks/diagram-xychart.mjs +2 -0
- package/dist/chunks/diagram-xychart.mjs.map +1 -0
- package/dist/chunks/mermaid-ascii.mjs +1 -1
- package/dist/config-snapshot.js +4 -1
- package/dist/errors.d.ts +8 -1
- package/dist/errors.js +20 -0
- package/dist/generated/detectors.gen.js +13 -13
- package/dist/generated/registry.gen.js +94 -13
- package/dist/mermaid.esm.min.mjs +3 -7
- package/dist/mermaid.esm.min.mjs.map +1 -1
- package/dist/registry.d.ts +18 -7
- package/dist/registry.js +41 -32
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +24 -11
- package/dist/chunks/chunk-2I3H3N3U.mjs +0 -2
- package/dist/chunks/chunk-2I3H3N3U.mjs.map +0 -1
- package/dist/chunks/chunk-4EAMXXRE.mjs +0 -2
- package/dist/chunks/chunk-4EAMXXRE.mjs.map +0 -1
- package/dist/chunks/chunk-EWT4247V.mjs +0 -2
- package/dist/chunks/chunk-EWT4247V.mjs.map +0 -1
- package/dist/chunks/chunk-JWRERZWU.mjs +0 -20
- package/dist/chunks/chunk-JWRERZWU.mjs.map +0 -1
- package/dist/chunks/chunk-KI6PG6XD.mjs +0 -2
- package/dist/chunks/chunk-KI6PG6XD.mjs.map +0 -1
- package/dist/chunks/chunk-WAQR5J2G.mjs +0 -3
- package/dist/chunks/chunk-WAQR5J2G.mjs.map +0 -1
- package/dist/chunks/chunk-WY5VJHG2.mjs +0 -6
- package/dist/chunks/chunk-WY5VJHG2.mjs.map +0 -1
- /package/dist/chunks/{chunk-H2OXJVDR.mjs.map → chunk-2SBABYQO.mjs.map} +0 -0
- /package/dist/chunks/{chunk-MCN35FLZ.mjs.map → chunk-3SMLKEUJ.mjs.map} +0 -0
- /package/dist/chunks/{chunk-TEM3V5TI.mjs.map → chunk-DTOBFHMA.mjs.map} +0 -0
- /package/dist/chunks/{chunk-DBYKR6N5.mjs.map → chunk-FYF7T3FM.mjs.map} +0 -0
- /package/dist/chunks/{chunk-VF2HPT64.mjs.map → chunk-G5JCFFZO.mjs.map} +0 -0
- /package/dist/chunks/{chunk-3RTA5CBW.mjs.map → chunk-JL46TWOM.mjs.map} +0 -0
- /package/dist/chunks/{chunk-UVUAPY3L.mjs.map → chunk-RUW4Q76Y.mjs.map} +0 -0
- /package/dist/chunks/{chunk-D2SPINQ5.mjs.map → chunk-TJOE3FON.mjs.map} +0 -0
- /package/dist/chunks/{chunk-VXHU4YGB.mjs.map → chunk-X3UAU7VF.mjs.map} +0 -0
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ const { text } = await mermaid.render('id', 'flowchart LR\n A --> B', { format:
|
|
|
20
20
|
|
|
21
21
|
Every first-party diagram type is included. Bundlers split each type into its own chunk, so a page downloads only the types it renders.
|
|
22
22
|
|
|
23
|
-
The size budget is in [`size-budget.json`](./size-budget.json): core, everything the `mermaid` entry loads before any diagram chunk, is at most
|
|
23
|
+
The size budget is in [`size-budget.json`](./size-budget.json): core, everything the `mermaid` entry loads before any diagram chunk, is at most 96 KB gzip, and core plus flowchart, as loaded for one flowchart render, at most 128 KB gzip.
|
|
24
24
|
|
|
25
25
|
## Pick your diagrams
|
|
26
26
|
|
package/THIRD_PARTY_NOTICES
CHANGED
|
@@ -31,3 +31,228 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
31
31
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
32
32
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
33
|
SOFTWARE.
|
|
34
|
+
|
|
35
|
+
d3-sankey
|
|
36
|
+
---------
|
|
37
|
+
|
|
38
|
+
The CDN build (dist/mermaid.min.js, dist/mermaid.esm.min.mjs and its chunks) bundles
|
|
39
|
+
@mermaid-js/diagram-sankey without its legal comments. That package's layout/d3-sankey.ts
|
|
40
|
+
re-implements, step for step, d3-sankey's `sankey` layout and its four node aligns
|
|
41
|
+
(https://github.com/d3/d3-sankey, release 0.12.3). d3-sankey is used under the
|
|
42
|
+
BSD 3-Clause License:
|
|
43
|
+
|
|
44
|
+
Copyright 2015, Mike Bostock
|
|
45
|
+
All rights reserved.
|
|
46
|
+
|
|
47
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
48
|
+
are permitted provided that the following conditions are met:
|
|
49
|
+
|
|
50
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
51
|
+
list of conditions and the following disclaimer.
|
|
52
|
+
|
|
53
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
54
|
+
this list of conditions and the following disclaimer in the documentation
|
|
55
|
+
and/or other materials provided with the distribution.
|
|
56
|
+
|
|
57
|
+
* Neither the name of the author nor the names of contributors may be used to
|
|
58
|
+
endorse or promote products derived from this software without specific prior
|
|
59
|
+
written permission.
|
|
60
|
+
|
|
61
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
62
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
63
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
64
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
65
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
66
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
67
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
68
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
69
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
70
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
71
|
+
|
|
72
|
+
d3-array
|
|
73
|
+
--------
|
|
74
|
+
|
|
75
|
+
The same bundled file copies d3-array's `sum`, `min` and `max` with their semantics
|
|
76
|
+
(https://github.com/d3/d3-array, release 2.12.1). d3-array is used under the
|
|
77
|
+
BSD 3-Clause License:
|
|
78
|
+
|
|
79
|
+
Copyright 2010-2020 Mike Bostock
|
|
80
|
+
All rights reserved.
|
|
81
|
+
|
|
82
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
83
|
+
are permitted provided that the following conditions are met:
|
|
84
|
+
|
|
85
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
86
|
+
list of conditions and the following disclaimer.
|
|
87
|
+
|
|
88
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
89
|
+
this list of conditions and the following disclaimer in the documentation
|
|
90
|
+
and/or other materials provided with the distribution.
|
|
91
|
+
|
|
92
|
+
* Neither the name of the author nor the names of contributors may be used to
|
|
93
|
+
endorse or promote products derived from this software without specific prior
|
|
94
|
+
written permission.
|
|
95
|
+
|
|
96
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
97
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
98
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
99
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
100
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
101
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
102
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
103
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
104
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
105
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
106
|
+
|
|
107
|
+
d3-shape
|
|
108
|
+
--------
|
|
109
|
+
|
|
110
|
+
The bundled @mermaid-js/diagram-sankey's layout/layout.ts re-implements d3-shape's
|
|
111
|
+
`linkHorizontal` (https://github.com/d3/d3-shape, release 1.3.7). d3-shape is used under the
|
|
112
|
+
BSD 3-Clause License:
|
|
113
|
+
|
|
114
|
+
Copyright 2010-2015 Mike Bostock
|
|
115
|
+
All rights reserved.
|
|
116
|
+
|
|
117
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
118
|
+
are permitted provided that the following conditions are met:
|
|
119
|
+
|
|
120
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
121
|
+
list of conditions and the following disclaimer.
|
|
122
|
+
|
|
123
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
124
|
+
this list of conditions and the following disclaimer in the documentation
|
|
125
|
+
and/or other materials provided with the distribution.
|
|
126
|
+
|
|
127
|
+
* Neither the name of the author nor the names of contributors may be used to
|
|
128
|
+
endorse or promote products derived from this software without specific prior
|
|
129
|
+
written permission.
|
|
130
|
+
|
|
131
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
132
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
133
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
134
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
135
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
136
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
137
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
138
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
139
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
140
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
141
|
+
|
|
142
|
+
d3-hierarchy
|
|
143
|
+
------------
|
|
144
|
+
|
|
145
|
+
The CDN build also bundles @mermaid-js/diagram-treemap without its legal comments. That
|
|
146
|
+
package's layout/tiles.ts and sum.ts re-implement, step for step, d3-hierarchy's `hierarchy`,
|
|
147
|
+
`sum`, `sort` and `treemap` with `treemapSquarify`, `treemapDice`, `treemapSlice` and
|
|
148
|
+
`treemapRound` (https://github.com/d3/d3-hierarchy, release 3.1.2). d3-hierarchy is used under
|
|
149
|
+
the ISC License:
|
|
150
|
+
|
|
151
|
+
ISC License
|
|
152
|
+
|
|
153
|
+
Copyright 2010-2021 Mike Bostock
|
|
154
|
+
|
|
155
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
156
|
+
with or without fee is hereby granted, provided that the above copyright notice
|
|
157
|
+
and this permission notice appear in all copies.
|
|
158
|
+
|
|
159
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
160
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
161
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
162
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
163
|
+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
164
|
+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
165
|
+
THIS SOFTWARE.
|
|
166
|
+
|
|
167
|
+
d3-format
|
|
168
|
+
---------
|
|
169
|
+
|
|
170
|
+
The same package's format/d3-format.ts re-implements d3-format's `format` in its default
|
|
171
|
+
locale (https://github.com/d3/d3-format, release 3.1.2). d3-format is used under the ISC
|
|
172
|
+
License:
|
|
173
|
+
|
|
174
|
+
ISC License
|
|
175
|
+
|
|
176
|
+
Copyright 2010-2026 Mike Bostock
|
|
177
|
+
|
|
178
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
179
|
+
with or without fee is hereby granted, provided that the above copyright notice
|
|
180
|
+
and this permission notice appear in all copies.
|
|
181
|
+
|
|
182
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
183
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
184
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
185
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
186
|
+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
187
|
+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
188
|
+
THIS SOFTWARE.
|
|
189
|
+
|
|
190
|
+
venn.js
|
|
191
|
+
-------
|
|
192
|
+
|
|
193
|
+
The CDN build also bundles @mermaid-js/diagram-venn without its legal comments. That
|
|
194
|
+
package's solver (solver/circles.ts, fmin.ts, index.ts, normalize.ts, regions.ts and solve.ts)
|
|
195
|
+
is ported from venn.js's area-proportional circle layout, circle intersection areas, solution
|
|
196
|
+
normalising and scaling, text centres and region paths (https://github.com/upsetjs/venn.js,
|
|
197
|
+
release 2.0.0). venn.js is used under the MIT License:
|
|
198
|
+
|
|
199
|
+
MIT License
|
|
200
|
+
|
|
201
|
+
Copyright (c) 2013 Ben Frederickson
|
|
202
|
+
Copyright (c) 2021 Samuel Gratzl
|
|
203
|
+
|
|
204
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
205
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
206
|
+
in the Software without restriction, including without limitation the rights
|
|
207
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
208
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
209
|
+
furnished to do so, subject to the following conditions:
|
|
210
|
+
|
|
211
|
+
The above copyright notice and this permission notice shall be included in all
|
|
212
|
+
copies or substantial portions of the Software.
|
|
213
|
+
|
|
214
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
215
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
216
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
217
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
218
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
219
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
220
|
+
SOFTWARE.
|
|
221
|
+
|
|
222
|
+
fmin
|
|
223
|
+
----
|
|
224
|
+
|
|
225
|
+
The same package's solver/fmin.ts is ported from fmin's `bisect`, `nelderMead` and
|
|
226
|
+
`conjugateGradient` with its Wolfe line search, as venn.js 2.0.0 bundles them
|
|
227
|
+
(https://github.com/benfred/fmin, release 0.0.4). fmin is used under the
|
|
228
|
+
BSD 3-Clause License:
|
|
229
|
+
|
|
230
|
+
BSD 3-Clause License
|
|
231
|
+
|
|
232
|
+
Copyright 2016, Ben Frederickson
|
|
233
|
+
All rights reserved.
|
|
234
|
+
|
|
235
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
236
|
+
are permitted provided that the following conditions are met:
|
|
237
|
+
|
|
238
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
239
|
+
list of conditions and the following disclaimer.
|
|
240
|
+
|
|
241
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
242
|
+
this list of conditions and the following disclaimer in the documentation
|
|
243
|
+
and/or other materials provided with the distribution.
|
|
244
|
+
|
|
245
|
+
* Neither the name of the author nor the names of contributors may be used to
|
|
246
|
+
endorse or promote products derived from this software without specific prior
|
|
247
|
+
written permission.
|
|
248
|
+
|
|
249
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
250
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
251
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
252
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
253
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
254
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
255
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
256
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
257
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
258
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/dist/api.d.ts
CHANGED
|
@@ -35,6 +35,12 @@ export interface RenderOptions {
|
|
|
35
35
|
* element's width. SVG only: text output fits `ascii.maxWidth` columns instead (D84).
|
|
36
36
|
*/
|
|
37
37
|
availableWidth?: number;
|
|
38
|
+
/**
|
|
39
|
+
* The instant the diagram treats as now (D270): gantt's `today` line and `today`-relative
|
|
40
|
+
* dates. Defaults to `Date.now()` at each call (D275). Not a config key: diagram text
|
|
41
|
+
* cannot set it.
|
|
42
|
+
*/
|
|
43
|
+
now?: number | Date;
|
|
38
44
|
}
|
|
39
45
|
/** Options of an SVG render (`format` absent or `svg`). */
|
|
40
46
|
export interface SvgRenderOptions extends RenderOptions {
|
package/dist/api.js
CHANGED
|
@@ -15,33 +15,13 @@ import { createTheme, DEFAULT_THEME, loadedTheme, loadTheme, resolveThemeName, }
|
|
|
15
15
|
import { stageEnd, stageStart } from '@mermaid-js/core/timing';
|
|
16
16
|
import { defaultIdPrefix, directiveConfig, isPlain, mergeInto, optionsKey, Overlays, SiteConfigs, snapshot, } from "./config-snapshot.js";
|
|
17
17
|
import { createDomAdapter } from "./dom.js";
|
|
18
|
-
import { toMermaidError } from "./errors.js";
|
|
18
|
+
import { toMermaidError, toWarning } from "./errors.js";
|
|
19
19
|
import { iconPackRegistry, packsUnsupported } from "./icon-packs.js";
|
|
20
20
|
import { selectMeasurer } from "./measurer.js";
|
|
21
|
-
import { builtIn, isElkName, Registry, } from "./registry.js";
|
|
21
|
+
import { builtIn, isElkName, Registry, layoutName, } from "./registry.js";
|
|
22
22
|
import { DiscoveryQueue, registerSeam } from "./seam.js";
|
|
23
23
|
import { VERSION } from "./version.js";
|
|
24
24
|
export { defaultIdPrefix } from "./config-snapshot.js";
|
|
25
|
-
const WARNING_KEYS = ['path', 'source', 'feature', 'shapes', 'astIds'];
|
|
26
|
-
/**
|
|
27
|
-
* A copy of a warning with only the `Warning` keys (text output adds `feature`, `shapes`, `astIds`).
|
|
28
|
-
* `LOOK_REMOVED` names the hand-drawn package here, core never names one (D153, as D173), and
|
|
29
|
-
* only while no registered fragment declares `handDrawn` (the plugin's, or any that takes it).
|
|
30
|
-
*/
|
|
31
|
-
const toWarning = (w, fragments) => {
|
|
32
|
-
const out = {
|
|
33
|
-
code: w.code,
|
|
34
|
-
message: w.code === 'LOOK_REMOVED' && !fragments.some((f) => 'handDrawn' in f.keys)
|
|
35
|
-
? `${w.message} For handDrawn, register @mermaid-js/plugin-hand-drawn.`
|
|
36
|
-
: w.message,
|
|
37
|
-
};
|
|
38
|
-
for (const k of WARNING_KEYS) {
|
|
39
|
-
const v = w[k];
|
|
40
|
-
if (v !== undefined)
|
|
41
|
-
out[k] = Array.isArray(v) ? [...v] : v;
|
|
42
|
-
}
|
|
43
|
-
return out;
|
|
44
|
-
};
|
|
45
25
|
/** `render`'s third argument: v12's container element, or an options object (D80). */
|
|
46
26
|
function renderOptions(arg) {
|
|
47
27
|
if (!isPlain(arg) || typeof arg.nodeType === 'number')
|
|
@@ -66,9 +46,6 @@ class AnalysisCache {
|
|
|
66
46
|
this.entries.clear();
|
|
67
47
|
}
|
|
68
48
|
}
|
|
69
|
-
function layoutName(config) {
|
|
70
|
-
return String(config.layout ?? 'layered');
|
|
71
|
-
}
|
|
72
49
|
function themeNames(config) {
|
|
73
50
|
const choice = resolveThemeName(config.theme);
|
|
74
51
|
return choice.dark ? [choice.name, choice.dark] : [choice.name];
|
|
@@ -79,9 +56,9 @@ function missingFor(registry, a, text = false) {
|
|
|
79
56
|
const { config } = a.prepared;
|
|
80
57
|
// Text output lays out with core's own `layered`, never a registered engine (D179).
|
|
81
58
|
if (a.plugin.layoutKind === 'graph' && !text) {
|
|
82
|
-
const
|
|
83
|
-
if (
|
|
84
|
-
missing.push({ kind: 'layout', name });
|
|
59
|
+
const { need } = registry.layout(layoutName(config, a.plugin), a.plugin.layoutEngine);
|
|
60
|
+
if (need !== undefined)
|
|
61
|
+
missing.push({ kind: 'layout', name: need });
|
|
85
62
|
}
|
|
86
63
|
// Text output draws no colours, so it needs no theme (D82).
|
|
87
64
|
for (const name of text ? [] : themeNames(config)) {
|
|
@@ -103,14 +80,13 @@ async function loadResources(registry, missing) {
|
|
|
103
80
|
}));
|
|
104
81
|
}
|
|
105
82
|
/** The theme a draw paints with: the config's choice, or the default when it is not loaded. */
|
|
106
|
-
function themeFor(config, s, warn,
|
|
83
|
+
function themeFor(config, s, warn, tables, idPrefix) {
|
|
107
84
|
const choice = resolveThemeName(config.theme, warn);
|
|
108
85
|
const spec = loadedTheme(choice.name) ?? loadedTheme(DEFAULT_THEME);
|
|
109
|
-
const dark = choice.dark ? loadedTheme(choice.dark) : undefined;
|
|
110
86
|
return createTheme(spec, {
|
|
111
87
|
themeVariables: config.themeVariables,
|
|
112
|
-
dark,
|
|
113
|
-
...
|
|
88
|
+
dark: choice.dark ? loadedTheme(choice.dark) : undefined,
|
|
89
|
+
...tables,
|
|
114
90
|
cssVariables: s.options.output?.cssVariables,
|
|
115
91
|
warn,
|
|
116
92
|
idPrefix,
|
|
@@ -146,7 +122,7 @@ export function createMermaid(firstParty, firstPartyNames) {
|
|
|
146
122
|
// Text output never runs a layout's hooks: no registered engine lays it out (D179).
|
|
147
123
|
if (text || analysis.plugin.layoutKind !== 'graph')
|
|
148
124
|
return hooks;
|
|
149
|
-
const own = registry.layoutExtension(layoutName(analysis.prepared.config));
|
|
125
|
+
const own = registry.layoutExtension(layoutName(analysis.prepared.config, analysis.plugin));
|
|
150
126
|
if (!own)
|
|
151
127
|
return hooks;
|
|
152
128
|
let runner = layoutRunners.get(own);
|
|
@@ -178,7 +154,7 @@ export function createMermaid(firstParty, firstPartyNames) {
|
|
|
178
154
|
// `core/ascii`'s cell measurer and width, loaded by the first text `prepare` (D87).
|
|
179
155
|
let textBackend;
|
|
180
156
|
function sectionOf(detected, plugin) {
|
|
181
|
-
return plugin?.id ?? detected.id;
|
|
157
|
+
return plugin?.configSection ?? plugin?.id ?? detected.id;
|
|
182
158
|
}
|
|
183
159
|
// Detect, resolve config and parse with a loaded plugin (DESIGN §3 steps 1–4).
|
|
184
160
|
function analyse(text, snap, plugin, detected, pre) {
|
|
@@ -343,6 +319,10 @@ export function createMermaid(firstParty, firstPartyNames) {
|
|
|
343
319
|
function contextFor(text, s, options, analysis, { units, measurer, width, text: textOnly }) {
|
|
344
320
|
const { prepared, plugin } = analysis;
|
|
345
321
|
const { config } = prepared;
|
|
322
|
+
// A usage error, as a bad `limits` option is: `+now` of a bad Date or a string is NaN.
|
|
323
|
+
const now = +(options?.now ?? Date.now());
|
|
324
|
+
if (!Number.isFinite(now))
|
|
325
|
+
throw new TypeError(`RenderOptions.now is no instant: ${String(options?.now)}`);
|
|
346
326
|
const textOutput = units.id === 'cell';
|
|
347
327
|
const warnings = [...skipped, ...prepared.warnings];
|
|
348
328
|
const warn = (w) => void warnings.push(toWarning(w, registry.fragments()));
|
|
@@ -367,7 +347,7 @@ export function createMermaid(firstParty, firstPartyNames) {
|
|
|
367
347
|
let engine;
|
|
368
348
|
let elkName;
|
|
369
349
|
if (plugin.layoutKind === 'graph') {
|
|
370
|
-
const asked = layoutName(config);
|
|
350
|
+
const asked = layoutName(config, plugin);
|
|
371
351
|
// D179: no other engine knows cells (ELK ignores `grid`), so the name only warns. Text
|
|
372
352
|
// output never loads it, and gives no ELK_NOT_INSTALLED or LAYOUT_UNKNOWN for it.
|
|
373
353
|
if (textOutput && !builtIn(asked)) {
|
|
@@ -381,7 +361,8 @@ export function createMermaid(firstParty, firstPartyNames) {
|
|
|
381
361
|
const name = textOutput ? 'layered' : asked;
|
|
382
362
|
const found = textOutput
|
|
383
363
|
? { engine: layered, state: 'ready' }
|
|
384
|
-
: registry.layout(name);
|
|
364
|
+
: registry.layout(name, plugin.layoutEngine);
|
|
365
|
+
const using = `using the built-in ${found.standIn ?? 'layered'} engine`;
|
|
385
366
|
// Only when ELK lays the graph out: with LAYOUT_UNKNOWN or ELK_NOT_INSTALLED, layered
|
|
386
367
|
// draws every group, as that warning says.
|
|
387
368
|
if (isElkName(name) && (found.state === 'ready' || found.state === 'missing'))
|
|
@@ -389,20 +370,21 @@ export function createMermaid(firstParty, firstPartyNames) {
|
|
|
389
370
|
if (found.state === 'unknown') {
|
|
390
371
|
warn({
|
|
391
372
|
code: 'LAYOUT_UNKNOWN',
|
|
392
|
-
message: `Unknown layout "${name}"; using
|
|
373
|
+
message: `Unknown layout "${name}"; ${using}.`,
|
|
393
374
|
});
|
|
394
375
|
}
|
|
395
376
|
else if (found.state === 'elk') {
|
|
396
377
|
// D173: `mermaid` names the package; core never does (D153).
|
|
397
378
|
warn({
|
|
398
379
|
code: 'ELK_NOT_INSTALLED',
|
|
399
|
-
message: `Layout "${name}" needs @mermaid-js/layout-elk, which is not registered; using
|
|
380
|
+
message: `Layout "${name}" needs @mermaid-js/layout-elk, which is not registered; ${using}.`,
|
|
400
381
|
});
|
|
401
382
|
}
|
|
402
383
|
engine = found.engine;
|
|
403
384
|
}
|
|
404
385
|
// The theme reads the id prefix only for the gradient (D182), after ctx exists.
|
|
405
|
-
const
|
|
386
|
+
const tables = { rules: registry.themeRules(), diagram: plugin.theme };
|
|
387
|
+
const theme = themeFor(config, s, warn, tables, () => ctx.idPrefix);
|
|
406
388
|
let idPrefix;
|
|
407
389
|
// Inline boxes (D177) are SVG only: text output shows every span as written, and warns
|
|
408
390
|
// ASCII_DROPPED once per feature (D179). Glyphs (D293) are SVG only too, absent without an
|
|
@@ -423,6 +405,8 @@ export function createMermaid(firstParty, firstPartyNames) {
|
|
|
423
405
|
version: VERSION,
|
|
424
406
|
linkSchemes: s.options.linkSchemes,
|
|
425
407
|
limits: s.limits,
|
|
408
|
+
now,
|
|
409
|
+
availableWidth: width,
|
|
426
410
|
iconPacks: packs,
|
|
427
411
|
layout: (graph) => {
|
|
428
412
|
if (!engine)
|
|
@@ -604,11 +588,22 @@ export function createMermaid(firstParty, firstPartyNames) {
|
|
|
604
588
|
if (discovery.pending)
|
|
605
589
|
await discovery.settle();
|
|
606
590
|
const tasks = [];
|
|
591
|
+
const ascii = req.formats?.includes('ascii');
|
|
592
|
+
if (ascii)
|
|
593
|
+
tasks.push(import("./ascii.js").then((b) => void (textBackend = b)));
|
|
607
594
|
for (const t of req.types ?? []) {
|
|
608
595
|
tasks.push(registry.load(t).then((p) => {
|
|
609
596
|
if (!p)
|
|
610
597
|
throw new MermaidError('UNSUPPORTED_DIAGRAM', `Diagram type "${t}" is not supported.`);
|
|
598
|
+
// The plugin's own default engine (D284) comes with it, as `layered` does.
|
|
599
|
+
if (p.layoutEngine)
|
|
600
|
+
return registry.loadLayout(p.layoutEngine.default);
|
|
611
601
|
}));
|
|
602
|
+
if (ascii)
|
|
603
|
+
tasks.push(registry.loadAscii(t).then((hook) => {
|
|
604
|
+
if (!hook)
|
|
605
|
+
throw new UnsupportedFormatError(t, 'ascii');
|
|
606
|
+
}));
|
|
612
607
|
}
|
|
613
608
|
for (const l of req.layouts ?? [])
|
|
614
609
|
tasks.push(registry.loadLayout(l));
|
|
@@ -625,17 +620,6 @@ export function createMermaid(firstParty, firstPartyNames) {
|
|
|
625
620
|
tasks.push(n.load());
|
|
626
621
|
for (const name of req.iconPacks ?? [])
|
|
627
622
|
tasks.push(iconPacks.load(name));
|
|
628
|
-
if (req.formats?.includes('ascii')) {
|
|
629
|
-
tasks.push(import("./ascii.js").then((b) => {
|
|
630
|
-
textBackend = b;
|
|
631
|
-
}));
|
|
632
|
-
for (const t of req.types ?? []) {
|
|
633
|
-
tasks.push(registry.loadAscii(t).then((hook) => {
|
|
634
|
-
if (!hook)
|
|
635
|
-
throw new UnsupportedFormatError(t, 'ascii');
|
|
636
|
-
}));
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
623
|
try {
|
|
640
624
|
await Promise.all(tasks);
|
|
641
625
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{a,b as J,c as Z,e as w,j as q,l as tt,m as et,o as it,p as rt,q as S,r as N,s as C,t as st,u as nt}from"./chunk-
|
|
1
|
+
import{a,b as J,c as Z,e as w,j as q,l as tt,m as et,o as it,p as rt,q as S,r as N,s as C,t as st,u as nt}from"./chunk-3SMLKEUJ.mjs";import{B as g,C as Q,i as Y,l as z,p as u,q as m,r as T,s as E,x as X,y as x}from"./chunk-ICB73T2E.mjs";var f=J,o={ShowData:f,Pie:f+1,Colon:f+2,Number:f+3,AccDescr:f+4,AccTitle:f+5,Title:f+6,String:f+7,Yaml:f+8},R=w(a.Comment,a.Directive,a.Space,o.Yaml),pt={[o.ShowData]:"showData",[o.Pie]:"pie",[o.Colon]:":",[o.Number]:"NUMBER_PIE",[o.AccDescr]:"ACC_DESCR",[o.AccTitle]:"ACC_TITLE",[o.Title]:"TITLE",[o.String]:"STRING",[a.Newline]:"NEWLINE",[o.Yaml]:"YAML",[a.Directive]:"DIRECTIVE",[a.Comment]:"SINGLE_LINE_COMMENT",[a.Error]:"LEXICAL_ERROR"};var mt={b:"\b",f:"\f",n:`
|
|
2
2
|
`,r:"\r",t:" ",v:"\v",0:"\0"};function ot(n){let t=n.slice(1,-1);if(!t.includes("\\"))return t;let e="";for(let i=0;i<t.length;i++){let r=t[i]??"";if(r.charCodeAt(0)!==92){e+=r;continue}let s=t[++i]??"";e+=mt[s]??s}return e}function _(n){let t=n.trim();return/[\t ]{2}/.test(t)?t.replace(/[\t ]{2,}/g," "):t}function ct(n){return _(n.slice(n.indexOf("title")+5))}function at(n){return _(n.slice(n.indexOf(":",n.indexOf("accTitle"))+1))}function ht(n){let t=n.indexOf("accDescr")+8;for(;m(n.charCodeAt(t));)t++;if(n[t]===":")return _(n.slice(t+1));let e=n.slice(n.indexOf("{",t)+1,n.lastIndexOf("}"));return gt(bt(e)).replace(/[\t ]{2,}/g," ").replace(/[\n\r]{2,}/g,`
|
|
3
3
|
`)}function bt(n){let t="",e=0,i=n.length;for(;;){for(;e<i&&u(n.charCodeAt(e));)e++;let r=e;for(;e<i&&!T(n.charCodeAt(e));)e++;if(e>=i)return t+n.slice(r);t+=n.slice(r,++e)}}function gt(n){let t="",e=0,i=n.length;for(;e<i;){let r=e;for(;e<i&&!u(n.charCodeAt(e));)e++;if(t+=n.slice(r,e),e>=i)break;let s=e,c=-1;for(;e<i&&u(n.charCodeAt(e));e++)e>s&&T(n.charCodeAt(e))&&(c=e);if(e===i)break;t+=n.slice(c<0?s:c,e)}return t}var V=-1,dt=-2,P=n=>n===10||n===13;function y(n,t,e){return new $(n,t,e).run()}var $=class{constructor(t,e,i){this.src=t;let r=i.mask?wt(i):i.text;this.text=r+`
|
|
4
4
|
`,this.len=r.length,this.n=this.text.length,this.offsets=i.runs&&new N(i.runs),this.holes=i.holes,this.hole=nt(i,e),this.p=st(i,e),this.w=new Z((this.len-this.p>>3)+8)}text;len;n;offsets;holes;hole;w;p;kind=V;digitsFrom=-1;digitsTo=-1;stringFails=[-1,-1];braceFrom=-1;braceAt=dt;yamlFails=1/0;directiveFails=1/0;run(){let{text:t,n:e}=this;for(;this.p<this.len&&u(t.charCodeAt(this.p));)this.p++;let i=-1;for(;this.p<e;){let r=this.p,s=this.scan(r);if(s<0){i<0&&(i=r),this.p=X(t,r);continue}i>=0&&(this.emit(a.Error,i,r),i=-1),this.kind!==V&&this.emit(this.kind,r,s),this.p=s}return this.trivia(this.src.length+1),this.w.finish(this.src)}scan(t){let e=this.text.charCodeAt(t),i=this.keyword("showData",t,o.ShowData);return i<0&&(i=this.keyword("pie",t,o.Pie)),i<0&&e===58&&(i=this.match(o.Colon,t+1)),i<0&&(e===45||E(e))&&(i=this.number(t)),i<0&&(i=this.accessibility(t)),i<0&&(e===34||e===39)&&(i=this.string(t,e)),i<0&&P(e)&&(i=this.match(a.Newline,t+x(this.text,t))),i<0&&m(e)&&(i=this.match(V,this.blanks(t))),i<0&&e===45&&(i=this.yaml(t)),i<0&&e===37&&this.text.charCodeAt(t+1)===37&&(i=this.directive(t),i<0&&(i=this.match(a.Comment,this.lineEnd(t+2)))),i}match(t,e){return this.kind=t,e}keyword(t,e,i){if(!this.text.startsWith(t,e))return-1;let r=e+t.length,s=this.text.charCodeAt(r);return r>=this.n||u(s)||s===37&&this.text.charCodeAt(r+1)===37?this.match(i,r):-1}number(t){let{text:e}=this,i=e.charCodeAt(t)===45?t+1:t;if(!E(e.charCodeAt(i)))return-1;let r=this.digits(i);if(e.charCodeAt(r)===46&&E(e.charCodeAt(r+1))){let s=this.digits(r+1);if(e.charCodeAt(s)!==46)return this.match(o.Number,s);if(s-(r+1)>=2)return this.match(o.Number,s-1)}return e.charCodeAt(i)===48?e.charCodeAt(i+1)===46?-1:this.match(o.Number,i+1):e.charCodeAt(r)!==46?this.match(o.Number,r):r-i>=2?this.match(o.Number,r-1):-1}accessibility(t){let{text:e}=this,i=m(e.charCodeAt(t))?this.blanks(t):t;if(e.startsWith("accDescr",i)){let r=this.accDescr(i+8);if(r>=0)return this.match(o.AccDescr,r)}if(e.startsWith("accTitle",i)){let r=this.blanks(i+8);if(e.charCodeAt(r)===58)return this.match(o.AccTitle,this.lineTail(r+1))}if(e.startsWith("title",i)){let r=i+5;return this.match(o.Title,m(e.charCodeAt(r))?this.lineTail(r+1):r)}return-1}accDescr(t){let{text:e}=this,i=this.blanks(t);if(e.charCodeAt(i)===58)return this.lineTail(i+1);let r=t;for(;r<this.n&&u(e.charCodeAt(r));)r++;if(e.charCodeAt(r)!==123)return-1;let s=this.brace(r+1);return s<0?-1:s+1}string(t,e){let i=e===34?0:1;if(t<(this.stringFails[i]??-1))return-1;let{text:r,n:s}=this,c=t+1;for(;c<s;){let h=r.charCodeAt(c);if(h===e)return this.match(o.String,c+1);if(h===92){if(c+1>=s||T(r.charCodeAt(c+1)))break;c+=2}else c++}return this.stringFails[i]=c,-1}yaml(t){let{text:e,n:i}=this;if(!e.startsWith("---",t))return-1;let r=this.blanks(t+3),s=x(e,r);if(s===0)return-1;let c=r+s;if(c>=this.yamlFails)return-1;for(let l=c+1;l<i;l++){if(!P(e.charCodeAt(l-1))||!e.startsWith("---",l))continue;let d=this.closer(l+3);if(d>=0)return this.match(o.Yaml,d)}let h=e.startsWith("---",c)?this.closer(c+3):-1;return h>=0?this.match(o.Yaml,h):(this.yamlFails=c,-1)}directive(t){let{text:e}=this;if(e.charCodeAt(t+2)!==123)return-1;let i=t+3;if(i>=this.directiveFails)return-1;for(let r=e.indexOf("}%%",i);r!==-1;r=e.indexOf("}%%",r+1)){let s=this.closer(r+3);if(s>=0)return this.match(a.Directive,s)}return this.directiveFails=i,-1}closer(t){let e=x(this.text,t);return e>0?t+e:t>=this.n||u(this.text.charCodeAt(t))?t:-1}blanks(t){let e=t;for(;e<this.n&&m(this.text.charCodeAt(e));)e++;return e}digits(t){if(t>=this.digitsFrom&&t<this.digitsTo)return this.digitsTo;let e=t;for(;e<this.n&&E(this.text.charCodeAt(e));)e++;return this.digitsFrom=t,this.digitsTo=e,e}lineEnd(t){let e=t;for(;e<this.n&&!P(this.text.charCodeAt(e));)e++;return e}lineTail(t){let{text:e,n:i}=this,r=t;for(;r<i;){let s=e.charCodeAt(r);if(P(s)||s===37&&e.charCodeAt(r+1)===37)break;r++}return r}brace(t){let e=this.braceAt;return e!==dt&&t>=this.braceFrom&&(e===-1||t<=e)?e:(this.braceFrom=t,this.braceAt=this.text.indexOf(String.fromCharCode(125),t),this.braceAt)}source(t){return t>=this.len?this.src.length:this.offsets?this.offsets.source(t):t}trivia(t){let e=this.holes;for(let i=e[this.hole];i&&i.start<t;i=e[++this.hole])i.kind==="comment"?this.w.push(a.Comment,i.start,i.end):i.kind==="directive"&&this.w.push(a.Directive,i.start,i.end)}emit(t,e,i){let r=this.source(e),s=Math.min(i,this.len),c=s>e?this.source(s-1)+1:r;this.holes.length>0&&(this.trivia(r),c>r&&(c=this.dropAt(c))),this.w.push(t,r,c)}dropAt(t){let e=this.holes,i=this.hole;for(;i<e.length&&(e[i]?.start??t)<t;)i++;let r=e[i];return r&&r.start===t&&r.kind==="drop"?r.end:t}};function wt(n){let{text:t,mask:e,runs:i}=n;if(!e)return t;let r=i?new N(i):void 0,s="",c=0;for(let h=t.indexOf('"');h!==-1;h=t.indexOf('"',h+1))((e[r?r.source(h):h]??0)&rt)!==0&&(s+=t.slice(c,h)+"'",c=h+1);return s+t.slice(c)}var B=[o.Title,o.AccTitle,o.AccDescr],j=[o.String,...B],W=[...j,a.Newline,a.EOF],xt=[o.ShowData,...W],ut=[a.Newline,a.EOF],St=[o.Pie,a.Newline],Ct=w(a.Newline,a.EOF),Dt=w(o.Colon,o.String),Pt={[o.Title]:"title",[o.AccTitle]:"accTitle",[o.AccDescr]:"accDescr"};function kt(n,t,e){for(let i=0;i<t.length;i++){let r=t.start[i]??0,s=t.end[i]??0;if(r>=e)break;if(s<e)continue;let c=t.kind[i]??a.EOF,h=n.charCodeAt(r);if(c===o.String&&e<s||c===a.Error&&(h===34||h===39))return"string";let l=Pt[c];if(!l)continue;let d=r;for(;/[\t ]/.test(n.charAt(d));)d++;d+=l.length;let p=c===o.AccDescr&&/^\s*\{/.test(n.slice(d,s));if(e>d&&(e<s||!p))return l}return"INITIAL"}var yt=new z([["`pie`",[o.Pie]],["`showData`",[o.ShowData]],['a section such as `"Dogs" : 42`',[o.String]],["`title`, `accTitle:` or `accDescr`",B],["`:` and a value",[o.Colon]],["a value such as `42` or `3.5`",[o.Number]],["a line break",[a.Newline]],["the end of the text",[a.EOF]]]),Ot={[o.Title]:"Title",[o.AccTitle]:"AccTitle",[o.AccDescr]:"AccDescr"},Nt={Title:"title",AccTitle:"accTitle",AccDescr:"accDescr"},M="put each section and statement on a line of its own",H=class extends Error{},A=new H,ft="%>@#\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f\\ud800-\\udfff\\ufffe\\uffff",Rt=new RegExp(`[${ft}]`,"u"),It=new RegExp(`[${ft}]`,"gu"),_t=128;function Lt(n){return Rt.test(n)?n.replace(It,t=>{let e=t.charCodeAt(0);return`%${e.toString(16).toUpperCase().padStart(e<_t?2:4,"0")}`}):n}function Ft(n,t={}){return new G(n,t).parse()}var G=class{constructor(t,e){this.src=t;this.options=e;let i=this.pre=e.preprocessed??g(t);if(e.preprocessed||this.st.diagnostics.list.push(...i.diagnostics),this.view=S(t,i.bodyStart,i.directives.map(r=>r.range)),this.full=y(t,i.bodyStart,this.view),this.t=tt(this.full,R),e.probe!==void 0){let r=this.probe=new q(t,e.probe,Dt);i.frontMatter&&r.offset<i.bodyStart?r.outside("frontMatter"):r.trivia(this.full),r.lexed(r.offset,r.offset,kt(t,this.full,r.offset))}}pre;view;full;t;i=0;st=new it;probe;children=[];lines;mentions=new Map;byLabel=new Map;sections=[];showData=!1;title="";accTitle="";accDescr="";parse(){let{st:t,src:e}=this;this.statement(()=>this.header()),this.document();let i=t.diagnostics.list.filter(h=>h.severity==="warning"),r=this.title||this.pre.frontMatter?.title,s=Object.freeze({showData:this.showData,sections:Object.freeze(this.sections),...r?{title:r}:{},accTitle:this.accTitle,accDescr:this.accDescr,warnings:Object.freeze(i)}),c={id:"doc",type:"Document",range:{start:this.pre.bodyStart,end:e.length},children:this.children};return t.result(s,c,this.full,this.options,this.probe)}kind(t=this.i){return this.t.kind[t]??a.EOF}range(t=this.i){return{start:this.t.start[t]??0,end:this.t.end[t]??0}}raw(t=this.i){let{start:e,end:i}=this.range(t);return C(this.src,e,i,this.view)}tested(t){let e=this.probe;e?.isAt(this.t,this.i,this.pre.bodyStart)&&e.tested(t,this.range().start)}expect(t,e){return this.tested([t]),this.kind()!==t&&this.fail([t],e),this.i++}id(t){let e=(this.mentions.get(t)??0)+1;return this.mentions.set(t,e),e===1?t:`${t}@${e}`}repeated(t){return(this.mentions.get(t)??0)>1}lineOf(t){return(this.lines??=new Y(this.src)).position(t).line+1}found(){let t=this.kind();if(t===a.EOF)return"the end of the text";if(t===a.Newline)return"a line break";let e=this.raw().trim(),i=e.split(`
|
|
5
5
|
`,1)[0]??"";return i.length>24||i!==e?`\`${i.slice(0,24)}\u2026\``:`\`${i}\``}fail(t,e){let{st:i}=this,r=this.range();this.kind()===a.Error&&this.badCharacters(r);let s=i.diagnostics.unexpected("UNEXPECTED",r,yt.names(t),this.found()),c=e??this.explain();throw c&&(s.message=`${s.message.slice(0,-1)}; ${c}.`),A}badCharacters(t){let{st:e}=this,i=this.raw(),r=this.lineOf(t.start);if(i.startsWith('"')||i.startsWith("'")){let l=i[0]??'"';throw e.diagnostics.error("UNCLOSED_STRING",`Unclosed label: the \`${l}\` at line ${r} has no closing \`${l}\`. Add \`${l}\` after the label.`,t,{expected:[`\`${l}\``]}),A}let s=/^[\t ]*(accDescr|accTitle)/.exec(i)?.[1];if(s==="accDescr")throw e.diagnostics.error("UNCLOSED_ACC_DESCR",`Unclosed accessible description: the \`accDescr {\` at line ${r} has no closing \`}\`, and \`accDescr\` without \`{\` takes a \`:\`. Write \`accDescr: \u2026\` or \`accDescr { \u2026 }\`.`,t),A;if(s==="accTitle")throw e.diagnostics.error("UNEXPECTED_CHARACTER","Expected `:` after `accTitle`; write it as `accTitle: \u2026`.",t,{expected:["`:`"]}),A;let c=i.length>24?`${i.slice(0,24)}\u2026`:i,h="";throw i===";"?h=`; \`;\` does not end a statement in a pie chart: ${M}`:/^[0-9]/.test(i)&&(h="; a value is a number such as `42` or `3.5`, with digits on both sides of a `.`"),e.diagnostics.error("UNEXPECTED_CHARACTER",`Unexpected character \`${c}\`${h}.`,t),A}explain(){let t=this.kind();if(t===o.Number)return"a value has no leading zeros, and only one per section";if(t===o.ShowData)return"`showData` goes on the `pie` line, right after `pie`";if(t===o.Pie)return"a chart has one `pie`, at its start";if(j.includes(t))return M}recover(){this.probe?.freeze(),this.i=et(this.t,this.i,Ct)}statement(t){try{t()}catch(e){if(e!==A)throw e;this.recover()}}header(){for(;this.tested(St),this.kind()===a.Newline;)this.i++;let t=this.expect(o.Pie),e=this.range(t);this.tested(xt),this.kind()===o.ShowData&&(e.end=this.range(this.i++).end,this.showData=!0),this.st.statement("header",e),this.children.push({id:"pie",type:"Header",range:e,showData:this.showData})}document(){for(;;){this.tested(W);let t=this.kind();if(t===a.EOF)return;if(t===a.Newline){this.i++;continue}this.statement(()=>{t===o.String?this.section():B.includes(t)?this.text(t):this.fail(W)})}}eol(){this.tested(ut);let t=this.kind();t!==a.EOF&&(t!==a.Newline&&this.fail(ut,j.includes(t)?M:void 0),this.i++)}section(){let t=this.i++;this.expect(o.Colon,'write a section as `"label" : value`, e.g. `"Dogs" : 42`');let e=this.expect(o.Number),i=this.range(t),r=this.range(e),s=ot(this.raw(t)),c=Number(this.raw(e)),h={start:i.start,end:r.end},l=`slice:${Lt(s)}`,d=this.id(l),p={id:d,type:"Slice",range:h,label:s,labelRange:i,value:c,valueRange:r};this.children.push(p),this.st.statement("slice",h),this.st.symbol(s,"slice",i,this.repeated(l)?"ref":"def");let{diagnostics:b}=this.st;if(c<0)b.error("PIE_NEGATIVE_VALUE",`"${s}" has invalid value: ${c}. Negative values are not allowed in pie charts. All slice values must be >= 0.`,r);else if(!Number.isFinite(c))b.warning("PIE_VALUE_TOO_LARGE",`"${s}" has a value too large to draw: the section is left out. Slice values must be below 1.8e308.`,r);else{let O=this.byLabel.get(s);if(O)b.warning("PIE_DUPLICATE_SLICE",`Section "${s}" is repeated: the value ${c} is ignored and the first value, ${O.value}, is kept. Give each section its own label.`,h);else{let K=Object.freeze({label:s,value:c,astId:d});this.byLabel.set(s,K),this.sections.push(K)}}this.eol()}text(t){let e=this.i++,i=this.raw(e),r=Ot[t]??"Title",s=this.range(e);for(;s.start<s.end&&/[\t ]/.test(this.src[s.start]??"");)s.start++;let c;r==="Title"?c=this.title=ct(i):r==="AccTitle"?c=this.accTitle=at(i):c=this.accDescr=ht(i);let h=Nt[r];this.children.push({id:this.id(h),type:r,range:s,text:c}),this.st.statement(h,s),this.eol()}};function Vt(n,t=g(n)){return n.startsWith("pie",Q(n,t))}function ie(n){let t=g(n),e=S(n,t.bodyStart,t.directives.map(h=>h.range)),i=y(n,t.bodyStart,e),r=e.holes.filter(h=>h.kind!=="drop"),s=0,c=[];for(let h=0;h<i.length;h++){let l=i.kind[h]??a.EOF,d=i.start[h]??0,p=i.end[h]??0;if(l===a.EOF)continue;for(;(r[s]?.start??1/0)<d;)s++;let b=r[s];(l===a.Comment||l===a.Directive)&&b?.start===d&&b.end===p||c.push({kind:l,text:C(n,d,p,e),range:{start:d,end:p}})}return c}function ce(n){let t=0,e=0;for(let r of n)t+=r,r>e&&(e=r);if(Number.isFinite(t))return{unit:1,sum:t};let i=0;for(let r of n)i+=r/e;return{unit:e,sum:i}}export{ce as a,o as b,Ft as c,Vt as d,ie as e};
|
|
6
|
-
//# sourceMappingURL=chunk-
|
|
6
|
+
//# sourceMappingURL=chunk-2SBABYQO.mjs.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{a as mt,b as ft,c as gt,d as St}from"./chunk-7PKX7UKH.mjs";import{a as h,b as it,c as rt,e as y,f as M,h as at,i as ot,j as dt,o as ht,q as O,r as ct,s as lt,t as pt,u as ut}from"./chunk-3SMLKEUJ.mjs";import{A as nt,B as D,C as st,a as z,b as Z,i as q,p as k,r as tt,v as et,z as F}from"./chunk-ICB73T2E.mjs";var p=it,r={Kanban:p,SpaceLine:p+1,SpaceList:p+2,NodeId:p+3,NodeDStart:p+4,NodeDescr:p+5,NodeDEnd:p+6,IconStart:p+7,Icon:p+8,IconEnd:p+9,ClassStart:p+10,Class:p+11,ClassEnd:p+12,StringStart:p+13,StringEnd:p+14,MdStringStart:p+15,MdStringEnd:p+16,ShapeDataStart:p+17,ShapeData:p+18,ShapeDataQuote:p+19,ShapeDataStr:p+20,ShapeDataEnd:p+21,Eof:p+22},Lt={[r.Kanban]:"KANBAN",[r.SpaceLine]:"SPACELINE",[r.SpaceList]:"SPACELIST",[r.NodeId]:"NODE_ID",[r.NodeDStart]:"NODE_DSTART",[r.NodeDescr]:"NODE_DESCR",[r.NodeDEnd]:"NODE_DEND",[r.Icon]:"ICON",[r.Class]:"CLASS",[r.ShapeDataStart]:"SHAPE_DATA",[r.ShapeData]:"SHAPE_DATA",[r.ShapeDataQuote]:"SHAPE_DATA",[r.ShapeDataStr]:"SHAPE_DATA",[r.Eof]:"EOF",[h.Newline]:"NL",[h.Error]:"LEXICAL_ERROR"};var m={INITIAL:0,NODE:1,NSTR:2,NSTR2:3,ICON:4,CLASS:5,SHAPE_DATA:6,SHAPE_DATA_STR:7},Et=Object.entries(m).sort((o,t)=>o[1]-t[1]).map(([o])=>o),_t=[`
|
|
2
|
+
`,"\u2028","\u2029"],vt=o=>o>=65&&o<=90?o+32:o;function R(o,t,n,e){let s=new B(o,t,n),i=s.run(e),a=s.openRun;return{tokens:i,text(d){let c=i.kind[d];if(c===r.ShapeDataStart)return"";let l=i.start[d]??0,u=lt(o,l,i.end[d]??0,n);return c!==r.ShapeDataStr?u:(l===a?u+`
|
|
3
|
+
`:u).replace(/\n\s*/g,"<br/>")}}}var B=class{constructor(t,n,e){this.src=t;this.offsets=e.runs&&new ct(e.runs),this.holes=e.holes,this.hole=ut(e,n);let s=pt(e,n),{text:i,at:a}=this.v12Text(e.text,s);this.at=a,this.len=i.length,this.text=i+`
|
|
4
|
+
`,this.n=this.text.length,this.p=s,this.w=new rt(((this.len-this.p)/6|0)+8)}text;len;n;at;offsets;holes;hole;covered=0;w;stack=[];state=m.INITIAL;p;nextEnd=[-2,-2,-2];openRun=-1;v12Text(t,n){if(!t.includes("\r",n))return{text:t,at:void 0};let e=new Uint32Array(t.length+1),s=[],i=0,a=0;for(let d=0;d<t.length;d++)e[i++]=d,t.charCodeAt(d)===13&&(s.push(t.slice(a,d),`
|
|
5
|
+
`),a=d+1,d>=n&&t.charCodeAt(d+1)===10&&this.adjacent(d)&&(d++,a=d+1));return s.push(t.slice(a)),e[i]=t.length,{text:s.join(""),at:e.subarray(0,i+1)}}adjacent(t){let n=this.offsets;return!n||n.source(t+1)===n.source(t)+1}run(t){let{text:n,n:e}=this;for(;this.p<this.len&&k(n.charCodeAt(this.p));)this.p++;if(t===void 0)for(;this.p<e;)this.step(n.charCodeAt(this.p));else{for(;this.p<e;){let s=this.source(this.p),i=this.state;this.step(n.charCodeAt(this.p)),t.lexed(s,this.source(this.p),Et[i]??"")}t.lexed(this.src.length,this.src.length,Et[this.state]??"")}return this.state===m.INITIAL&&this.emit(r.Eof,this.len,this.len),this.trivia(this.src.length+1),this.w.finish(this.src)}view(t){return this.at?this.at[t]??0:t}source(t){if(t>=this.len)return this.src.length;let n=this.view(t);return this.offsets?this.offsets.source(n):n}sourceEnd(t){let n=this.view(t+1)-1;return(this.offsets?this.offsets.source(n):n)+1}trivia(t){let n=this.holes;for(let e=n[this.hole];e&&e.start<t;e=n[++this.hole])e.kind==="comment"?this.w.push(h.Comment,e.start,e.end):e.kind==="directive"?this.w.push(h.Directive,e.start,e.end):e.start>=this.covered&&this.w.push(h.Space,e.start,e.end)}emit(t,n,e){let s=this.source(n),i=Math.min(e,this.len),a=i>n?this.sourceEnd(i-1):s;this.holes.length>0&&(this.trivia(s),a>s&&(a=this.dropAt(a))),this.w.push(t,s,a),a>this.covered&&(this.covered=a),this.p=e}dropAt(t){let n=this.holes,e=this.hole;for(;e<n.length&&(n[e]?.start??t)<t;)e++;let s=n[e];return s&&s.start===t&&s.kind==="drop"?s.end:t}begin(t,n,e){this.emit(t,this.p,n),this.stack.push(this.state),this.state=e}pop(t,n){this.emit(t,this.p,n),this.state=this.stack.pop()??m.INITIAL}dotEnd(t){let n=this.n;for(let e=0;e<3;e++){let s=this.nextEnd[e]??-1;s!==-1&&s<t&&(this.nextEnd[e]=s=this.text.indexOf(_t[e]??"",t)),s!==-1&&s<n&&(n=s)}return n}blanks(t){let n=t;for(;n<this.n&&k(this.text.charCodeAt(n));)n++;return n}literal(t,n){if(n+t.length>this.n)return!1;for(let e=0;e<t.length;e++)if(vt(this.text.charCodeAt(n+e))!==t.charCodeAt(e))return!1;return!0}pair(t,n,e){return this.text.charCodeAt(t)===n&&this.text.charCodeAt(t+1)===e}step(t){switch(this.state){case m.INITIAL:this.initial(t);return;case m.NODE:this.node(t);return;case m.NSTR:this.nstr(t);return;case m.NSTR2:this.nstr2(t);return;case m.ICON:this.icon(t);return;case m.CLASS:this.classState(t);return;case m.SHAPE_DATA:this.shapeData(t);return;default:this.shapeDataStr(t)}}initial(t){let{text:n,p:e}=this;if(t===64&&n.charCodeAt(e+1)===123){this.begin(r.ShapeDataStart,e+2,m.SHAPE_DATA);return}let s=k(t)?this.blanks(e):e;if(this.pair(s,37,37)){this.emit(r.SpaceLine,e,this.dotEnd(s+2));return}if(vt(t)===107&&this.literal("kanban",e)&&!et(n.charCodeAt(e+6))){this.emit(r.Kanban,e,e+6);return}if(t===58){if(this.pair(e+1,58,58)){this.begin(r.ClassStart,e+3,m.CLASS);return}if(this.literal("::icon(",e)){this.begin(r.IconStart,e+7,m.ICON);return}}if(k(t)){let d=s-1;for(;d>e&&n.charCodeAt(d)!==10;)d--;if(d>e){this.emit(r.SpaceLine,e,d+1);return}if(t===10){let c=e+1;for(;n.charCodeAt(c)===10;)c++;this.emit(h.Newline,e,c);return}}let i=Mt(t,n.charCodeAt(e+1));if(i>0){this.begin(r.NodeDStart,e+i,m.NODE);return}if(k(t)){this.emit(r.SpaceList,e,s);return}let a=e;for(;a<this.n&&!Pt(n.charCodeAt(a));)a++;a>e?this.emit(r.NodeId,e,a):this.emit(h.Error,e,e+1)}node(t){let{text:n,p:e}=this,s=n.charCodeAt(e+1);if(t===34){s===96?this.begin(r.MdStringStart,e+2,m.NSTR2):this.begin(r.StringStart,e+1,m.NSTR);return}let i=Ht(t,s);if(i>0){this.pop(r.NodeDEnd,e+i);return}if(t!==125){let a=e+1;for(;a<this.n&&!Ft(n.charCodeAt(a));)a++;this.emit(r.NodeDescr,e,a);return}this.emit(r.NodeDescr,e,this.dotEnd(e))}nstr(t){if(t===34){this.pop(r.StringEnd,this.p+1);return}let n=this.text.indexOf('"',this.p);this.emit(r.NodeDescr,this.p,n===-1?this.n:n)}nstr2(t){let{text:n,p:e}=this;if(t!==96&&t!==34){let s=e+1;for(;s<this.n&&n.charCodeAt(s)!==96&&n.charCodeAt(s)!==34;)s++;this.emit(r.NodeDescr,e,s);return}this.pair(e,96,34)?this.pop(r.MdStringEnd,e+2):this.emit(h.Error,e,e+1)}icon(t){if(t===41){this.pop(r.IconEnd,this.p+1);return}let n=this.text.indexOf(")",this.p);this.emit(r.Icon,this.p,n===-1?this.n:n)}shapeData(t){let{text:n,p:e}=this;if(t===34){this.begin(r.ShapeDataQuote,e+1,m.SHAPE_DATA_STR);return}if(t===125){this.pop(r.ShapeDataEnd,e+1);return}if(t===94){this.emit(h.Error,e,e+1);return}let s=e+1;for(;s<this.n&&!Kt(n.charCodeAt(s));)s++;this.emit(r.ShapeData,e,s)}shapeDataStr(t){if(t===34){this.pop(r.ShapeDataQuote,this.p+1);return}let n=this.text.indexOf('"',this.p);n===-1&&(this.openRun=this.source(this.p)),this.emit(r.ShapeDataStr,this.p,n===-1?this.n:n)}classState(t){tt(t)?t===10?this.pop(r.ClassEnd,this.p+1):this.emit(h.Error,this.p,this.p+1):this.pop(r.Class,this.dotEnd(this.p))}},Pt=o=>o===40||o===91||o===10||o===41||o===123||o===125||o===64,Kt=o=>o===125||o===94||o===34,Ft=o=>o===41||o===93||o===40||o===125;function Mt(o,t){switch(o){case 45:return t===41?2:0;case 40:return t===45||t===40?2:1;case 41:return t===41?2:1;case 123:return t===123?2:0;case 91:return 1;default:return 0}}function Ht(o,t){switch(o){case 41:return t===41?2:1;case 93:return 1;case 125:return t===125?2:0;case 40:return t===45||t===40?2:1;case 45:return t===41?2:0;default:return 0}}function Nt(o,t,n,e){let s=n??z.maxNodes,i=t>s,a=t-1>s;!i||a||o.diagnostics.error(Z.maxNodes,`The board has more than ${s} items (columns and cards), the limit. The limit is set by the page or app that renders the diagram.`,e)}var It=/[\t\n\f\r ]/,Bt=/[^\t\n\f\r ]+/g;function $(o){return[...o.matchAll(Bt)].map(t=>({word:t[0],at:t.index}))}var Ee=/[\n\r\u2028\u2029]/,j=/^[^\n\r\u2028\u2029]*/,Yt=8232,$t=8233,Rt=o=>o===10||o===13||o===Yt||o===$t,Tt=o=>/[\n\r]/.test(o);function yt(o,t){let{holes:n}=o,e=0,s=n.length;for(;e<s;){let a=e+s>>1;(n[a]?.end??0)<=t.start?e=a+1:s=a}let i=e;for(;i<n.length&&(n[i]?.start??0)<t.end;)i++;return n.slice(e,i)}function Ot(o,t,n,e,s){let i=o.slice(e.start,e.end),a=(d,c)=>d===(c<0?e.start:e.end)||It.test(o.charAt(c<0?d-1:d))||s.some(l=>(c<0?l.end:l.start)===d);for(let d=i.indexOf(t,n-e.start);d>=0;d=i.indexOf(t,d+1)){let c=e.start+d,l=c+t.length;if(!s.some(u=>u.start<l&&c<u.end)&&a(c,-1)&&a(l,1))return c}return-1}function U(o,t,n,e,s){let i=0,a=t;for(;i<s;){if(a>=n)return-1;let d=e.charCodeAt(i),c=o.charCodeAt(a);if(d===c)i++,a++;else if(c===13&&d===10)o.charCodeAt(a+1)===10||i++,a++;else return-1}return a}var _=y(h.Comment,h.Directive,h.Space,r.IconStart,r.IconEnd,r.ClassStart,r.ClassEnd,r.StringStart,r.StringEnd,r.MdStringStart,r.MdStringEnd,r.ShapeDataEnd),V=[r.SpaceList,r.NodeId,r.NodeDStart,r.Icon,r.Class,r.SpaceLine],jt=[r.NodeId,r.NodeDStart,r.Icon,r.Class],Ut=[h.Newline,r.Eof,r.SpaceLine],Vt=[r.NodeDStart,r.ShapeDataStart],Wt=y(r.SpaceList,r.SpaceLine,r.NodeDStart,r.NodeDescr,r.NodeDEnd,r.ShapeDataStart),Qt=y(r.ShapeDataStart,r.ShapeData,r.ShapeDataQuote,r.ShapeDataStr),Ct={"[":"]","(":")","((":"))",")":"(","))":"((","{{":"}}","-)":"(-","(-":"-)"},Xt=["`kanban`"],Gt=["an item such as `todo` or `id[text]`","a `::icon(\u2026)` or `:::class` line"],P=["a line break"],Jt=["the text of the item"],zt="a kanban board starts with `kanban`",Zt="`kanban` starts the diagram and comes only once",qt="a `{` starts a shape only as `{{text}}`, and shape data as `@{ \u2026 }`",te="an `@` starts shape data only as `@{ \u2026 }`",ee="an `::icon(\u2026)` or `:::class` goes on a line of its own, after its item",ne="each item goes on a line of its own",se="shape data goes right after an item, as in `id@{ ticket: T-1 }`",wt="a bare `:::` takes the line break after it",ie="remove a blank or comment line above it: a line may not follow two of them in a row, or one right after `kanban`",re=/&(#?)(\w+);/g,ae=/fl°°|fl°|¶ß/g,oe={"\uFB02\xB0\xB0":"&#","\uFB02\xB0":"&","\xB6\xDF":";"},W=class extends Error{},A=new W;function de(o,t={}){return new Q(o,t).parse()}var Q=class{constructor(t,n){this.src=t;this.options=n;let e=this.pre=n.preprocessed??D(t);if(n.preprocessed||this.st.diagnostics.list.push(...e.diagnostics),this.view=O(t,e.bodyStart,e.directives.map(i=>i.range)),n.probe===void 0){this.lexed=R(t,e.bodyStart,this.view),this.c=new at(this.lexed.tokens,_);return}let s=this.probe=new dt(t,n.probe,Wt);e.frontMatter&&s.offset<e.bodyStart&&s.outside("frontMatter"),this.lexed=R(t,e.bodyStart,this.view,s),this.c=new ot(this.lexed.tokens,s,_)}pre;view;lexed;st=new ht;c;probe;assignees=new Map;children=[];items=[];columns=[];columnSpan;shallow=[];base=0;last;lastAst;afterBlank=!1;lineEnded=!1;headerSeen=!1;lines;parse(){this.start(),this.document(),this.columnSpan&&this.st.endStatement(this.columnSpan,this.src.length);let{st:t,pre:n,src:e}=this;t.diagnostics.list.sort((a,d)=>a.range.start-d.range.start);let s={items:this.items,columns:this.columns,warnings:t.diagnostics.list.filter(a=>a.severity==="warning")},i={id:"doc",type:"Document",range:{start:n.bodyStart,end:e.length},children:this.children};return t.result(s,i,this.c.tokens,this.options,this.probe)}raw(t=this.c.pos){return this.lexed.text(t)}range(t){let n=this.c.tokens;return{start:n.start[t]??0,end:n.end[t]??0}}exact(t,n,e=0,s=n.length){let i=this.range(t);return this.src.slice(i.start,i.end)!==n?i:{start:i.start+e,end:i.start+s}}idSymbol(t,n){let e=t.trim();if(e==="")return;let s=t.length-t.trimStart().length;this.st.symbol(e,"node",this.exact(n,t,s,s+e.length),"def")}classSymbols(t,n){let e=this.range(n),s=this.src.slice(e.start,e.end)===t,i=s?[]:yt(this.view,e),a=e.start;for(let{word:d,at:c}of $(t)){let l=e;if(s)l={start:e.start+c,end:e.start+c+d.length};else if(a>=0){let u=Ot(this.src,d,a,e,i);u>=0?l={start:u,end:a=u+d.length}:a=-1}this.st.symbol(d,"class",l,"ref")}}assigneeSymbol(t,n,e){let{root:s,read:i}=n,d=(s?.kind==="map"?s.pairs.find(u=>u.key==="assigned"):void 0)?.value?.range,c=(d&&this.sourceRangeOf(i,d))??e,l=(this.assignees.get(t)??0)+1;this.assignees.set(t,l),this.st.symbol(t,"assignee",c,l===1?"def":"ref")}sourceRangeOf(t,n){if(t.inPlace)return n;if(t.placed||n.start<t.shift||n.end<=n.start)return;let{src:e}=this,{data:s,inner:i}=t,a=U(e,i.start,i.end,s,n.start-t.shift),d=U(e,i.start,i.end,s,n.end-t.shift-1);return a<0||d<0?void 0:{start:a,end:d+1}}probePassed(){let{probe:t,c:n}=this;if(!t)return;let e=n.pos;for(;e<n.tokens.length-1&&!this.isStop(n.tokens.kind[e]??h.EOF);)e++;t.targetIn(n.tokens,0,_)<=e&&t.freeze(!0)}beside(t,n,e){let s=this.c.tokens;for(let i=t+n;i>=0&&i<s.length;i+=n){let a=s.kind[i];if(a===e)return i;if(a!==h.Comment&&a!==h.Directive)return-1}return-1}decorationRange(t){let n=this.c.tokens.kind[t]===r.Icon,e=this.range(t),s=this.beside(t,-1,n?r.IconStart:r.ClassStart),i=n?this.beside(t,1,r.IconEnd):-1;return{start:s<0?e.start:this.range(s).start,end:i<0?e.end:this.range(i).end}}afterIndent(){let{c:t}=this;return t.kind!==r.SpaceList?t.kind:this.c.tokens.kind[this.nextSignificant(t.pos)]??h.EOF}nextSignificant(t){let n=this.c.tokens,e=t+1;for(;e<n.length-1&&M(_,n.kind[e]??0);)e++;return e}onlySeparatorsFrom(t){let n=this.c.tokens;for(let e=t;e<n.length;e=this.nextSignificant(e)){let s=n.kind[e]??h.EOF;if(s===h.EOF)return!0;if(s!==h.Newline&&s!==r.Eof&&!(s===r.SpaceLine&&!this.raw(e).includes("%%")))return!1;if(e===n.length-1)return!0}return!0}isStop(t){return t===h.Newline||t===r.Eof||t===r.SpaceLine}isNodeStart(t){return t===r.NodeId||t===r.NodeDStart}isData(t){return M(Qt,t)}lineOf(t){return(this.lines??=new q(this.src)).position(t).line+1}namedToken(){let{c:t}=this,n=t.pos;if(t.kind===r.SpaceList){let e=this.nextSignificant(n),s=t.tokens.kind[e]??h.EOF;!this.isStop(s)&&s!==h.EOF&&(n=e)}return n}namedRange(t){let n=this.c.tokens.kind[t]??h.EOF;return n===r.Icon||n===r.Class?this.decorationRange(t):this.isData(n)?{start:this.range(t).start,end:this.dataEnd(t)}:this.range(t)}found(t){let{c:n}=this,e=n.tokens.kind[t]??h.EOF;if(e===h.EOF||e===r.Eof||this.onlySeparatorsFrom(t))return"the end of the text";if(e===h.Newline)return"a line break";let s=this.raw(t).trim();if(e===r.Icon||e===r.Class){let d=this.decorationRange(t);s=this.src.slice(d.start,d.end).trim()}else this.isData(e)&&(s=this.src.slice(this.range(t).start,this.dataEnd(t)).trim());if(e===r.SpaceLine)return s.includes("%%")?"a comment":"a blank line";if(s==="")return"blanks";let i=j.exec(s)?.[0]??"",a=i.length>24?i.slice(0,24):i;return a.length<s.length?`\`${a}\u2026\``:`\`${s}\``}dataEnd(t){let n=this.c.tokens,e=this.range(t).end;for(let s=t;s<n.length;s++){let i=n.kind[s]??h.EOF;if(!this.isData(i)&&i!==r.ShapeDataEnd&&i!==h.Comment&&i!==h.Directive)break;e=n.end[s]??e}return e}fail(t,n,e){throw this.report(t,n,e),A}report(t,n,e){let s=this.namedToken(),i=this.st.diagnostics.unexpected("UNEXPECTED",e??this.namedRange(s),t,this.found(s));n&&(i.message=`${i.message.slice(0,-1)}; ${n}.`)}recover(){let{c:t}=this;for(t.recovering();t.kind!==h.EOF&&!this.isStop(t.kind);)t.next();this.separator()}guarded(t){try{t()}catch(n){if(n!==A)throw n;this.recover()}}hintFor(t){if(t===r.Kanban)return Zt;if(this.isData(t))return se;if(t===h.Error)return this.src.charAt(this.c.start)==="@"?te:qt}start(){let{c:t}=this;if(t.kind===r.SpaceLine)for(t.next();t.kind===r.SpaceLine||t.kind===h.Newline;)t.next();t.tested(r.Kanban),t.kind===r.Kanban?this.header():this.report(Xt,zt)}header(){let{c:t}=this;this.headerSeen=!0,this.st.statement("header",t.range),t.next(),t.eat(h.Newline)}document(){let{c:t}=this;for(;this.headerSeen&&t.tested(V),t.kind!==h.EOF;){if(!this.headerSeen&&t.kind===r.Kanban){this.header();continue}if(!this.headerSeen&&this.isStop(t.kind)){this.separator();continue}this.guarded(()=>{this.statement(),this.stop()})}}stop(){let{c:t}=this;if(this.lineEnded){this.lineEnded=!1;return}if(t.tested(Ut),this.isStop(t.kind)){this.separator();return}t.kind===h.EOF&&this.endsOpen();let n=t.kind,e=this.beside(t.pos,-1,r.ClassEnd)>=0;if(this.afterBlank||e){this.report(P,this.afterBlank?ie:wt),this.probePassed();return}let s=this.hintFor(n),i=this.afterIndent();i===r.Icon||i===r.Class?s=ee:this.isNodeStart(i)&&(s=ne),this.fail(P,s)}separator(){let{c:t}=this;if(t.kind!==h.EOF)for(t.next();t.kind===h.Newline||t.kind===r.Eof;)this.headerSeen&&t.tested(V),t.next()}endsOpen(){let t=this.c.tokens;for(let n=t.length-1;n>=0;n--){let e=t.kind[n]??0;if(e===r.IconStart)return this.unclosed("UNCLOSED_ICON","icon","::icon(",")",n);if(e===r.StringStart)return this.unclosed("UNCLOSED_STRING","string",'"','"',n);if(e===r.MdStringStart)return this.unclosed("UNCLOSED_STRING","string",'"`','`"',n);if(e===r.ShapeDataStart)return this.unclosed("UNCLOSED_SHAPE_DATA","shape data","@{","}",n);if(e===r.NodeDStart){let s=this.raw(n);return this.unclosed("UNCLOSED_SHAPE","shape",s,Ct[s]??")",n)}if(e===r.IconEnd||e===r.StringEnd||e===r.MdStringEnd||e===r.NodeDEnd||e===r.ShapeDataEnd)break}this.fail(P)}unclosed(t,n,e,s,i){let a=this.range(i);throw this.st.diagnostics.error(t,`Unclosed ${n}: the \`${e}\` at line ${this.lineOf(a.start)} has no closing \`${s}\`. Add \`${s}\` after its text.`,a),A}statement(){let{c:t}=this;t.tested(V);let n=t.kind;if(this.afterBlank=!1,n===r.SpaceList){let e=t.next(),s=this.raw(e).length;t.tested(jt);let i=t.kind;this.isNodeStart(i)?this.item(s):i===r.Icon||i===r.Class?this.decoration():i===r.SpaceList&&this.beside(t.pos,-1,r.ClassEnd)>=0?(this.report(P,wt),this.lineEnded=!0):!this.isStop(i)&&i!==h.EOF&&this.badStatement();return}if(n===r.SpaceLine){t.next(),this.afterBlank=!0;return}this.isNodeStart(n)?this.item(0):n===r.Icon||n===r.Class?this.decoration():this.badStatement()}badStatement(){this.fail(Gt,this.hintFor(this.c.kind))}item(t){let{c:n}=this,e,s=n.pos;if(n.kind===r.NodeId){let d=n.next();e=this.raw(d),this.idSymbol(e,d),n.tested(Vt)}let i={nodeId:e,text:e??"",indent:t,range:this.range(s)},a=!1;try{n.kind===r.NodeDStart&&(this.shape(i),n.tested(r.ShapeDataStart)),this.isData(n.kind)&&this.shapeData(i)}catch(d){if(d!==A)throw d;a=!0}if(this.addItem(i),a)throw A}shape(t){let{c:n}=this,e=n.next(),s=this.raw(e);t.range={start:t.range.start,end:this.range(e).end},n.tested(r.NodeDescr),n.kind!==r.NodeDescr&&(n.kind===h.EOF&&this.endsOpen(),this.fail(Jt));let i=n.next();if(t.text=this.raw(i),t.range={start:t.range.start,end:this.range(i).end},n.tested(r.NodeDEnd),n.kind!==r.NodeDEnd){let d=`\`${Ct[s]??")"}\``;this.raw(i).startsWith("}")&&this.swallowed(d,i),n.kind===r.NodeDescr&&this.raw(n.pos).startsWith("}")&&this.swallowed(d,n.pos),n.kind===h.EOF&&this.endsOpen(),this.fail([d])}let a=n.next();t.range={start:t.range.start,end:this.range(a).end}}swallowed(t,n){let e=this.c.tokens,s=n;for(let g=this.nextSignificant(n);e.kind[g]===r.NodeDescr;g=this.nextSignificant(g))s=g;let i={start:this.range(n).start,end:this.range(s).end},a=this.lineOf(i.end)-this.lineOf(i.start),d=e.kind[this.nextSignificant(s)],c="the end of its line";a>0&&(c=d===r.NodeDEnd?`the closer on line ${this.lineOf(i.end)}, taking in the items before it`:"the end of the board, taking in every item after it");let l=j.exec(this.src.slice(i.start,i.end))?.[0]??"",u=l.length>24?`${l.slice(0,24)}\u2026`:l;throw this.st.diagnostics.error("UNEXPECTED",`Expected ${t}, got \`${u}\`: a \`}\` in an item's text takes the rest of its line into the text, as in mermaid@12, so the shape is not closed and its text runs on to ${c}. Write the text in quotes, as \`["a}b"]\`, or close the shape before the \`}\`.`,i,{expected:[t]}),A}shapeData(t){let{c:n}=this,e=this.range(n.pos),s="",i=e.end,a=!1;for(;this.isData(n.kind);){s+=this.raw(n.pos),i=n.end,n.next();let c=this.beside(n.pos,-1,r.ShapeDataEnd);a=c>=0,a&&(i=this.range(c).end)}let d={start:e.start,end:i};t.data={text:s,range:d},t.range={start:t.range.start,end:i},a||(n.kind===h.EOF&&this.endsOpen(),this.fail(["`}`"])),t.value=this.readData(s,d)}readData(t,n){let e=this.yamlInput(t,n),s=F(e.text,{...e.options,tree:!0}),i=s.diagnostics.some(d=>d.severity==="error")?F(e.text,e.options):s;if(this.yamlErrors(i,e,n))return;let a=e.placed?G(i.value):i.value;if(a===null){this.st.diagnostics.error(gt,"The `@{ \u2026 }` data is empty or `null`. Write `key: value` pairs in it, such as `ticket: T-1`, or remove it.",n);return}if(!(!nt(a)||!this.shapeOk(a.shape,n)))return{value:a,read:e,root:s.root}}yamlInput(t,n){let{src:e}=this,s={start:n.start+2,end:n.end-1},i=Tt(t);if(e.slice(s.start,s.end)===t&&!t.includes("#")){let u=i?s:{start:n.start+1,end:n.end};return{text:e,options:u,inPlace:!0,placed:!1,data:t,inner:s,shift:0}}let a=/#\w+;/.test(e.slice(n.start,n.end)),d=a?t.replace(re,(u,g,f)=>g?`\uFB02\xB0\xB0${f}\xB6\xDF`:`\uFB02\xB0${f}\xB6\xDF`):t;return{text:i?d+`
|
|
6
|
+
`:`{
|
|
7
|
+
${d}
|
|
8
|
+
}`,options:{},inPlace:!1,placed:a,data:t,inner:s,shift:i?0:2}}yamlErrors(t,n,e){let s=!1;for(let i of t.diagnostics){let a=n.inPlace?i.range:e;i.severity==="error"?(this.st.diagnostics.error("SHAPE_DATA",i.message,a),s=!0):this.st.diagnostics.warning(i.code,i.message,a)}return s}shapeOk(t,n){return t===void 0||!N(t)||typeof t=="string"&&t===t.toLowerCase()&&!t.includes("_")?!0:(this.st.diagnostics.error(St,`No such shape: ${I(t)}. Shape names are lower case, with no \`_\`; a card's shape is ignored, so the \`shape\` key can be removed.`,n),!1)}priorityText({read:t,root:n}){let s=(n?.kind==="map"?n.pairs.find(a=>a.key==="priority"):void 0)?.value?.range;if(!s)return"";let i=ce(t.text,s.start,s.end);return t.placed?X(i):i}addItem(t){let{nodeId:n,text:e,indent:s,range:i,data:a,value:d}=t,c=n??e,l={id:this.st.ids.node(c.trim()),type:"Item",range:i,text:e,indent:s,decorations:[]};n!==void 0&&(l.nodeId=n),a&&(l.data=a),this.children.push(l),this.lastAst=l;let u=this.items.length===0;u&&(this.base=s);for(let T of this.shallow.splice(0))this.st.diagnostics.error(mt,`Items without section detected, found section ("${T.label}"): it is indented less than the first column. Indent it as deep as the columns, or deeper for a card.`,T.range,{related:[{message:"mermaid@12 rejects the board from this item on",range:i}]});let g=u||s===this.base,f={ast:l.id,id:c,label:e,level:s,isColumn:g,column:g?this.columns.length:this.columns.length-1,classes:[]};d&&(he(f,d.value,()=>this.priorityText(d)),f.assigned!==void 0&&a&&this.assigneeSymbol(f.assigned,d,a.range)),s<this.base&&this.shallow.push({label:f.label,range:i});let J=this.items.length;if(this.items.push(f),this.last=f,Nt(this.st,this.items.length,this.options.maxNodes,i),g){this.columnSpan&&this.endColumn(this.columnSpan,i.start),this.columns.push({item:J,cards:[]});let T=this.columnSpan=this.st.beginStatement("column",i.start);T.range.end=i.end;return}let K=this.columns[f.column];K&&(f.parentId=this.items[K.item]?.id,K.cards.push(J)),this.st.statement("card",i)}endColumn(t,n){let e=n;for(;e>t.range.end&&!Rt(this.src.charCodeAt(e-1));)e--;this.st.endStatement(t,Math.max(e,t.range.end))}decoration(){let{c:t}=this,n=t.kind===r.Icon,e=t.next(),s=this.raw(e),i=this.decorationRange(e);n||this.classSymbols(s,e);let a=this.lastAst,d=this.last;if(!a||!d){this.st.diagnostics.error(ft,`${n?"An `::icon(\u2026)`":"A `:::class`"} line decorates the item before it, and there is none here. Write it on the line after its item.`,i);return}let c={type:n?"Icon":"Class",text:s,range:i};a.decorations.push(c),this.st.statement(n?"icon":"class",i),n?d.icon=s:d.classes=$(s).map(l=>l.word)}},N=o=>o!=null&&o!==!1&&o!==0&&o!==""&&!Number.isNaN(o);function I(o){return Array.isArray(o)?o.map(t=>t===null?"":I(t)).join(","):typeof o=="object"&&o!==null?"[object Object]":String(o)}function he(o,t,n){N(t.label)&&(o.label=I(t.label??"")),N(t.icon)&&(o.icon=I(t.icon??"")),N(t.assigned)&&(o.assigned=I(t.assigned??"")),N(t.ticket)&&(o.ticket=I(t.ticket??""));let e=t.priority;if(e===void 0||!N(e))return;let s=typeof e=="string";o.priority=s?e:n(),o.priorityKind=s?"text":"other"}function ce(o,t,n){let e=t-(o.lastIndexOf(`
|
|
9
|
+
`,t-1)+1),s=(" ".repeat(e)+o.slice(t,n)).split(`
|
|
10
|
+
`),i=s.filter(d=>d.trim()!=="").map(d=>d.length-d.trimStart().length),a=Math.min(...i);return s.map(d=>d.slice(a)).join(`
|
|
11
|
+
`)}var X=o=>o.replace(ae,t=>oe[t]??t);function G(o){if(typeof o=="string")return X(o);if(Array.isArray(o))return o.map(G);if(typeof o!="object"||o===null)return o;let t={};for(let[n,e]of Object.entries(o))t[X(n)]=G(e);return t}function le(o,t=D(o)){return o.startsWith("kanban",st(o,t))}function Fe(o){let t=D(o),n=O(o,t.bodyStart,t.directives.map(a=>a.range)),e=R(o,t.bodyStart,n),{tokens:s}=e,i=[];for(let a=0;a<s.length;a++){let d=s.kind[a]??h.EOF;if(d===h.Comment||d===h.Directive||d===h.Space||d===h.EOF)continue;let c={start:s.start[a]??0,end:s.end[a]??0};i.push({kind:d,text:e.text(a),range:c})}return i}export{r as a,Lt as b,It as c,Ee as d,j as e,Tt as f,de as g,le as h,Fe as i};
|
|
12
|
+
//# sourceMappingURL=chunk-3QHCWLG2.mjs.map
|