@itsthecsguy/linework 0.0.0-stage → 0.1.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 +21 -0
- package/NOTICE +11 -0
- package/README.md +164 -2
- package/assets/drawio/LICENSE +201 -0
- package/assets/drawio/VERSION +1 -0
- package/assets/drawio/favicon.ico +0 -0
- package/assets/drawio/images/1x1.png +0 -0
- package/assets/drawio/images/2x2.png +0 -0
- package/assets/drawio/images/3x3.png +0 -0
- package/assets/drawio/images/ajax-loader.gif +0 -0
- package/assets/drawio/images/android-chrome-512x512.png +0 -0
- package/assets/drawio/images/apple-touch-icon.png +0 -0
- package/assets/drawio/images/aui-wait.gif +0 -0
- package/assets/drawio/images/broken.png +0 -0
- package/assets/drawio/images/browserconfig.xml +9 -0
- package/assets/drawio/images/close.png +0 -0
- package/assets/drawio/images/cloud-connector-atlas.png +0 -0
- package/assets/drawio/images/collapsed.gif +0 -0
- package/assets/drawio/images/delete.png +0 -0
- package/assets/drawio/images/document-google-drive-icon-80.png +0 -0
- package/assets/drawio/images/draw-search.png +0 -0
- package/assets/drawio/images/drawio.svg +19 -0
- package/assets/drawio/images/drawlogo-color.svg +50 -0
- package/assets/drawio/images/drawlogo-gray.svg +18 -0
- package/assets/drawio/images/drawlogo-text-bottom.svg +75 -0
- package/assets/drawio/images/drawlogo.svg +18 -0
- package/assets/drawio/images/drawlogo128.png +0 -0
- package/assets/drawio/images/drawlogo144.png +0 -0
- package/assets/drawio/images/drawlogo256.png +0 -0
- package/assets/drawio/images/drawlogo48-gray.png +0 -0
- package/assets/drawio/images/drawlogo48.png +0 -0
- package/assets/drawio/images/drawlogo80.png +0 -0
- package/assets/drawio/images/droptarget.png +0 -0
- package/assets/drawio/images/edit.gif +0 -0
- package/assets/drawio/images/edit16.png +0 -0
- package/assets/drawio/images/edit32.png +0 -0
- package/assets/drawio/images/edit80.png +0 -0
- package/assets/drawio/images/embed-icon.png +0 -0
- package/assets/drawio/images/expanded.gif +0 -0
- package/assets/drawio/images/facebook.png +0 -0
- package/assets/drawio/images/favicon-16x16.png +0 -0
- package/assets/drawio/images/favicon-32x32.png +0 -0
- package/assets/drawio/images/file.png +0 -0
- package/assets/drawio/images/folder.png +0 -0
- package/assets/drawio/images/gadget-screenshot.png +0 -0
- package/assets/drawio/images/gadget-thumb.png +0 -0
- package/assets/drawio/images/github-logo-white.svg +6 -0
- package/assets/drawio/images/github-logo.svg +17 -0
- package/assets/drawio/images/gitlab-logo-white.svg +1 -0
- package/assets/drawio/images/gitlab-logo.svg +1 -0
- package/assets/drawio/images/glyphicons_blogger.png +0 -0
- package/assets/drawio/images/glyphicons_facebook.png +0 -0
- package/assets/drawio/images/glyphicons_github.png +0 -0
- package/assets/drawio/images/glyphicons_google.png +0 -0
- package/assets/drawio/images/glyphicons_star.png +0 -0
- package/assets/drawio/images/glyphicons_twitter.png +0 -0
- package/assets/drawio/images/glyphicons_youtube.png +0 -0
- package/assets/drawio/images/google-drive-connector-atlas.png +0 -0
- package/assets/drawio/images/google-drive-connector-atlas.svg +121 -0
- package/assets/drawio/images/google-drive-logo-white.svg +9 -0
- package/assets/drawio/images/google-drive-logo.svg +17 -0
- package/assets/drawio/images/google-share.png +0 -0
- package/assets/drawio/images/icon-192-maskable.png +0 -0
- package/assets/drawio/images/icon-192.png +0 -0
- package/assets/drawio/images/icon-512-maskable.png +0 -0
- package/assets/drawio/images/icon-512.png +0 -0
- package/assets/drawio/images/icon-search.svg +21 -0
- package/assets/drawio/images/img-hi-res.png +0 -0
- package/assets/drawio/images/img-lo-res.png +0 -0
- package/assets/drawio/images/list.svg +16 -0
- package/assets/drawio/images/locked.png +0 -0
- package/assets/drawio/images/log.png +0 -0
- package/assets/drawio/images/logo-confluence.png +0 -0
- package/assets/drawio/images/logo-flat-small.png +0 -0
- package/assets/drawio/images/logo-flat.png +0 -0
- package/assets/drawio/images/logo-jira.png +0 -0
- package/assets/drawio/images/logo-small.gif +0 -0
- package/assets/drawio/images/logo-white.png +0 -0
- package/assets/drawio/images/logo.png +0 -0
- package/assets/drawio/images/manifest.json +25 -0
- package/assets/drawio/images/move.png +0 -0
- package/assets/drawio/images/notion-logo-white.svg +1 -0
- package/assets/drawio/images/notion-logo.svg +1 -0
- package/assets/drawio/images/onedrive-connector-atlas.png +0 -0
- package/assets/drawio/images/onedrive-connector-atlas.svg +248 -0
- package/assets/drawio/images/onedrive-logo-white.svg +29 -0
- package/assets/drawio/images/onedrive-logo.svg +29 -0
- package/assets/drawio/images/osa_database.png +0 -0
- package/assets/drawio/images/osa_drive-harddisk.png +0 -0
- package/assets/drawio/images/plant-uml-atlas.png +0 -0
- package/assets/drawio/images/samepage-icon-color.svg +37 -0
- package/assets/drawio/images/save.png +0 -0
- package/assets/drawio/images/sidebar-android.png +0 -0
- package/assets/drawio/images/sidebar-archimate.png +0 -0
- package/assets/drawio/images/sidebar-arrows.png +0 -0
- package/assets/drawio/images/sidebar-arrows2.png +0 -0
- package/assets/drawio/images/sidebar-basic.png +0 -0
- package/assets/drawio/images/sidebar-c4.png +0 -0
- package/assets/drawio/images/sidebar-cabinets.png +0 -0
- package/assets/drawio/images/sidebar-cumulus.png +0 -0
- package/assets/drawio/images/sidebar-dfd.png +0 -0
- package/assets/drawio/images/sidebar-dynamics365.png +0 -0
- package/assets/drawio/images/sidebar-eip.png +0 -0
- package/assets/drawio/images/sidebar-er.png +0 -0
- package/assets/drawio/images/sidebar-floorplans.png +0 -0
- package/assets/drawio/images/sidebar-flowchart.png +0 -0
- package/assets/drawio/images/sidebar-gcp3.png +0 -0
- package/assets/drawio/images/sidebar-general.png +0 -0
- package/assets/drawio/images/sidebar-kubernetes.png +0 -0
- package/assets/drawio/images/sidebar-leanmapping.png +0 -0
- package/assets/drawio/images/sidebar-mockups.png +0 -0
- package/assets/drawio/images/sidebar-network.png +0 -0
- package/assets/drawio/images/sidebar-network2.png +0 -0
- package/assets/drawio/images/sidebar-openstack.png +0 -0
- package/assets/drawio/images/sidebar-sitemap.png +0 -0
- package/assets/drawio/images/sidebar-threatmodeling.png +0 -0
- package/assets/drawio/images/sidebar-uml.png +0 -0
- package/assets/drawio/images/sketch-logo128.png +0 -0
- package/assets/drawio/images/spin.gif +0 -0
- package/assets/drawio/images/sprites.png +0 -0
- package/assets/drawio/images/stop-flat-icon-80.png +0 -0
- package/assets/drawio/images/submenu.gif +0 -0
- package/assets/drawio/images/touch-submenu.png +0 -0
- package/assets/drawio/images/transparent.gif +0 -0
- package/assets/drawio/images/trello-logo-white-orange.svg +6 -0
- package/assets/drawio/images/trello-logo-white.svg +6 -0
- package/assets/drawio/images/trello-logo.svg +1 -0
- package/assets/drawio/images/tweet.png +0 -0
- package/assets/drawio/images/update16.png +0 -0
- package/assets/drawio/images/update32.png +0 -0
- package/assets/drawio/images/update80.png +0 -0
- package/assets/drawio/images/youtube.png +0 -0
- package/assets/drawio/img/clipart/Battery_0_128x128.png +0 -0
- package/assets/drawio/img/clipart/Battery_100_128x128.png +0 -0
- package/assets/drawio/img/clipart/Battery_50_128x128.png +0 -0
- package/assets/drawio/img/clipart/Battery_75_128x128.png +0 -0
- package/assets/drawio/img/clipart/Battery_allstates_128x128.png +0 -0
- package/assets/drawio/img/clipart/Bluetooth_128x128.png +0 -0
- package/assets/drawio/img/clipart/Earth_globe_128x128.png +0 -0
- package/assets/drawio/img/clipart/Empty_Folder_128x128.png +0 -0
- package/assets/drawio/img/clipart/Full_Folder_128x128.png +0 -0
- package/assets/drawio/img/clipart/Gear_128x128.png +0 -0
- package/assets/drawio/img/clipart/Keys_128x128.png +0 -0
- package/assets/drawio/img/clipart/Lock_128x128.png +0 -0
- package/assets/drawio/img/clipart/Mouse_Pointer_128x128.png +0 -0
- package/assets/drawio/img/clipart/Plug_128x128.png +0 -0
- package/assets/drawio/img/clipart/Ships_Wheel_128x128.png +0 -0
- package/assets/drawio/img/clipart/Star_128x128.png +0 -0
- package/assets/drawio/img/clipart/Tire_128x128.png +0 -0
- package/assets/drawio/index.html +92 -0
- package/assets/drawio/js/PostConfig.js +7 -0
- package/assets/drawio/js/PreConfig.js +13 -0
- package/assets/drawio/js/app.min.js +18466 -0
- package/assets/drawio/js/bootstrap.js +428 -0
- package/assets/drawio/js/diagramly/LibavoidRouting.js +4459 -0
- package/assets/drawio/js/export-init.js +21 -0
- package/assets/drawio/js/extensions.min.js +10478 -0
- package/assets/drawio/js/libavoid-js/LICENSE +505 -0
- package/assets/drawio/js/libavoid-js/libavoid-routing.js +1633 -0
- package/assets/drawio/js/libavoid-js/libavoid.min.js +59 -0
- package/assets/drawio/js/main.js +22 -0
- package/assets/drawio/js/rough/rough.min.js +1 -0
- package/assets/drawio/js/shapes-14-6-5.min.js +3457 -0
- package/assets/drawio/js/stencils.min.js +447 -0
- package/assets/drawio/mxgraph/css/common.css +147 -0
- package/assets/drawio/resources/dia.txt +2901 -0
- package/assets/drawio/styles/dark-default.xml +109 -0
- package/assets/drawio/styles/default-old.xml +109 -0
- package/assets/drawio/styles/default.xml +203 -0
- package/assets/drawio/styles/fonts/ArchitectsDaughter-Regular.ttf +0 -0
- package/assets/drawio/styles/grapheditor.css +4501 -0
- package/assets/drawio/styles/high-contrast.css +128 -0
- package/assets/drawio/styles/thumb_horz.png +0 -0
- package/assets/drawio/styles/thumb_vertical.png +0 -0
- package/assets/fonts/ibm-plex-mono-LICENSE.txt +93 -0
- package/assets/fonts/ibm-plex-sans-LICENSE.txt +93 -0
- package/assets/fonts/kalam-400.woff2 +0 -0
- package/assets/fonts/kalam-700.woff2 +0 -0
- package/assets/fonts/kalam-LICENSE.txt +93 -0
- package/assets/fonts/plex-mono-400.woff2 +0 -0
- package/assets/fonts/plex-mono-600.woff2 +0 -0
- package/assets/fonts/plex-sans-400.woff2 +0 -0
- package/assets/fonts/plex-sans-600.woff2 +0 -0
- package/dist/api.js +181 -0
- package/dist/cli.js +262 -0
- package/dist/drawio/icons.js +121 -0
- package/dist/drawio/merge.js +309 -0
- package/dist/drawio/read.js +180 -0
- package/dist/drawio/show.js +501 -0
- package/dist/drawio/theme.js +425 -0
- package/dist/drawio/write.js +300 -0
- package/dist/edit/server.js +212 -0
- package/dist/git.js +46 -0
- package/dist/import/mermaid.js +569 -0
- package/dist/layout/layout.js +212 -0
- package/dist/layout/sequence.js +333 -0
- package/dist/layout/text.js +73 -0
- package/dist/lint/check.js +184 -0
- package/dist/lint/fixlabels.js +128 -0
- package/dist/mcp/server.js +239 -0
- package/dist/publish.js +121 -0
- package/dist/render/browser.js +210 -0
- package/dist/render/fonts.js +66 -0
- package/dist/report.js +36 -0
- package/dist/spec/model.js +53 -0
- package/dist/spec/parse.js +497 -0
- package/package.json +71 -4
- package/skills/linework/SKILL.md +214 -0
- package/skills/linework/examples/billing-er.drawio.svg +4 -0
- package/skills/linework/examples/billing-er.yaml +31 -0
- package/skills/linework/examples/checkout.drawio.svg +4 -0
- package/skills/linework/examples/checkout.yaml +28 -0
- package/skills/linework/examples/pay-sequence.drawio.svg +4 -0
- package/skills/linework/examples/pay-sequence.yaml +28 -0
- package/skills/linework/examples/payment-state.drawio.svg +4 -0
- package/skills/linework/examples/payment-state.yaml +22 -0
- package/skills/linework/examples/refund-flow.drawio.svg +4 -0
- package/skills/linework/examples/refund-flow.yaml +29 -0
- package/skills/linework/examples/serverless-aws.drawio.svg +4 -0
- package/skills/linework/examples/serverless-aws.yaml +23 -0
- package/skills/linework/references/google-docs.md +46 -0
- package/skills/linework/references/spec.md +312 -0
- package/skills/linework/references/style-guide.md +53 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--ge-panel-color: #ffffff;
|
|
3
|
+
--border-color: #000000;
|
|
4
|
+
--text-color: #000000;
|
|
5
|
+
--toolbar-color: #ffffff;
|
|
6
|
+
--primary-color: #ffffff;
|
|
7
|
+
--dark-text-color: #ffffff;
|
|
8
|
+
--ge-dark-panel-color: #121212;
|
|
9
|
+
--dark-toolbar-color: #121212;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.geSidebar *:not(svg *, .mxDisabled, [disabled]),
|
|
13
|
+
.geToolbar *:not(svg *, .mxDisabled, [disabled]) {
|
|
14
|
+
opacity: 1 !important;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
*:not(svg *, .mxDisabled, [disabled], .spinner *, .geBackground, .geDragPreview, .geButton) {
|
|
18
|
+
border-color: light-dark(#000000, #FFFFFF) !important;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
button, .geBtn, *::-webkit-scrollbar-thumb {
|
|
22
|
+
border-color: light-dark(#000000, #FFFFFF) !important;
|
|
23
|
+
color: light-dark(#000000, #FFFFFF) !important;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
button, .geBtn {
|
|
27
|
+
border-style: solid !important;
|
|
28
|
+
border-width: 1px !important;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.geSimple .geDiagramContainer {
|
|
32
|
+
border-top-style: none !important;
|
|
33
|
+
border-bottom-style: none !important;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
button:not(:hover), .geBtn:not(:hover) {
|
|
37
|
+
background-color: transparent !important;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.gePrimaryBtn {
|
|
41
|
+
border-width: 3px !important;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.geActivePage, .geActiveFormatTitle {
|
|
45
|
+
text-decoration: underline;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.geActivePage {
|
|
49
|
+
background-color: light-dark(#ffffff, #000000) !important;
|
|
50
|
+
color: inherit !important;
|
|
51
|
+
filter: invert(1);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.geBigButton>img:not(.geDarkMode *) {
|
|
55
|
+
filter: invert(1);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.geEditor,
|
|
59
|
+
.geTitle,
|
|
60
|
+
.geFormatTitle {
|
|
61
|
+
font-size: 15px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.geTab,
|
|
65
|
+
.geFormatContainer,
|
|
66
|
+
.geSearchSidebar input,
|
|
67
|
+
.geSpinnerStatus {
|
|
68
|
+
font-size: 14px !important;
|
|
69
|
+
line-height: 14px !important;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.geEditor div.mxTooltip {
|
|
73
|
+
font-size: 12px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.geHint {
|
|
77
|
+
font-size: 11pt;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* Dialogs: restore solid backgrounds and visible borders */
|
|
81
|
+
.geDialog {
|
|
82
|
+
background-color: light-dark(#ffffff, var(--ge-dark-panel-color)) !important;
|
|
83
|
+
border: 1px solid light-dark(#000000, #FFFFFF) !important;
|
|
84
|
+
box-shadow: none !important;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
html body.geDarkMode .geDialog,
|
|
88
|
+
html body.geDarkMode div.mxWindow,
|
|
89
|
+
html body div.mxWindow.geDarkMode {
|
|
90
|
+
background-color: var(--ge-dark-panel-color) !important;
|
|
91
|
+
border-color: #FFFFFF !important;
|
|
92
|
+
box-shadow: none !important;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.geDialog,
|
|
96
|
+
html div.mxWindow {
|
|
97
|
+
box-shadow: none !important;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* Dialog overlay: solid opaque background */
|
|
101
|
+
.geBackground {
|
|
102
|
+
background-color: light-dark(#ffffff, #000000) !important;
|
|
103
|
+
opacity: 0.9 !important;
|
|
104
|
+
backdrop-filter: none !important;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* Dialog close button: full opacity for visibility */
|
|
108
|
+
.geDialog > .geButton {
|
|
109
|
+
opacity: 1 !important;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* Dialog title and footer: solid visible borders */
|
|
113
|
+
.geDialogTitle {
|
|
114
|
+
border-bottom: 1px solid light-dark(#000000, #FFFFFF) !important;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.geDialogFooter {
|
|
118
|
+
border-top: 1px solid light-dark(#000000, #FFFFFF) !important;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/* Input fields: solid visible borders */
|
|
122
|
+
.geDialog input[type="text"],
|
|
123
|
+
.geDialog input[type="number"],
|
|
124
|
+
.geDialog textarea,
|
|
125
|
+
.geDialog select {
|
|
126
|
+
border: 1px solid light-dark(#000000, #FFFFFF) !important;
|
|
127
|
+
background-color: light-dark(#ffffff, #000000) !important;
|
|
128
|
+
}
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-ThinItalic.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-ExtraLight.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-ExtraLightItalic.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-Light.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-LightItalic.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-Regular.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-Italic.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-Medium.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-MediumItalic.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-SemiBold.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-SemiBoldItalic.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-Bold.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-BoldItalic.ttf: Copyright 2017 IBM Corp. All rights reserved.
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2019 IBM Corp. All rights reserved. IBMPlexSans-Italic[wdth,wght].ttf: Copyright 2019 IBM Corp. All rights reserved.
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright (c) 2014 Indian Type Foundry (info@indiantypefoundry.com) Kalam-Regular.ttf: Copyright (c) 2014 Indian Type Foundry (info@indiantypefoundry.com) Kalam-Bold.ttf: Copyright (c) 2014 Indian Type Foundry (info@indiantypefoundry.com)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/api.js
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
// Programmatic API behind the CLI (and later the MCP server).
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { parseSpecText } from './spec/parse.js';
|
|
5
|
+
import { layout } from './layout/layout.js';
|
|
6
|
+
import { patchEdges, serialize, stampEdgeRoutes, toMxfile } from './drawio/write.js';
|
|
7
|
+
import { absBox, fingerprint, readDrawio, specBase } from './drawio/read.js';
|
|
8
|
+
import { manualEdits, toDiagram, toYaml } from './drawio/show.js';
|
|
9
|
+
import { merge } from './drawio/merge.js';
|
|
10
|
+
import { sequenceScene } from './layout/sequence.js';
|
|
11
|
+
import { resolveIcon, PROVIDERS } from './drawio/icons.js';
|
|
12
|
+
import { DrawioBrowser } from './render/browser.js';
|
|
13
|
+
import { brokenEdges, check } from './lint/check.js';
|
|
14
|
+
import { fixLabels } from './lint/fixlabels.js';
|
|
15
|
+
async function withBrowser(given, fn) {
|
|
16
|
+
const b = given ?? (await DrawioBrowser.launch());
|
|
17
|
+
try {
|
|
18
|
+
return await fn(b);
|
|
19
|
+
}
|
|
20
|
+
finally {
|
|
21
|
+
if (!given)
|
|
22
|
+
await b.close();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export async function build(specText, opts) {
|
|
26
|
+
const { diagram, warnings } = parseSpecText(specText);
|
|
27
|
+
const kind = outputKind(opts.out);
|
|
28
|
+
let old;
|
|
29
|
+
if (fs.existsSync(opts.out)) {
|
|
30
|
+
try {
|
|
31
|
+
old = readDrawio(fs.readFileSync(opts.out, 'utf8'));
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
if (!opts.force)
|
|
35
|
+
throw new Error(`${opts.out} exists and isn't a draw.io file linework can read. Use --force to overwrite it.`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const edits = old ? manualEdits(old) : [];
|
|
39
|
+
// Once a person has touched the layout, every later build merges into it.
|
|
40
|
+
const mode = old && !opts.relayout && (old.meta.aiviz_layout === 'manual' || edits.length > 0) ? 'merge' : 'fresh';
|
|
41
|
+
return withBrowser(opts.browser, async (b) => {
|
|
42
|
+
const measure = (r) => b.measure(r);
|
|
43
|
+
for (const n of diagram.nodes) {
|
|
44
|
+
if (!n.icon)
|
|
45
|
+
continue;
|
|
46
|
+
const r = resolveIcon(n.icon);
|
|
47
|
+
if ('error' in r || !(await b.hasStencil(r.stencil))) {
|
|
48
|
+
warnings.push({ path: `nodes.${n.id}.icon`, message: `no icon named "${n.icon}"; run "linework icons ${n.icon.split('.')[0]} ${n.icon.split('.')[1] ?? ''}" to search. Drawing it without one.` });
|
|
49
|
+
delete n.icon;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (diagram.type === 'sequence') {
|
|
53
|
+
let keepX;
|
|
54
|
+
let keep;
|
|
55
|
+
if (mode === 'merge') {
|
|
56
|
+
const shown = toDiagram(old);
|
|
57
|
+
keepX = new Map();
|
|
58
|
+
keep = new Map();
|
|
59
|
+
for (const [cellId, specId] of shown.idMap) {
|
|
60
|
+
const c = old.byId.get(cellId);
|
|
61
|
+
const box = absBox(old, cellId);
|
|
62
|
+
if (box)
|
|
63
|
+
keepX.set(specId, { x: box.x, w: box.w });
|
|
64
|
+
const prev = shown.diagram.nodes.find((n) => n.id === specId);
|
|
65
|
+
const now = diagram.nodes.find((n) => n.id === specId);
|
|
66
|
+
if (!prev || !now || shown.diagram.theme !== diagram.theme)
|
|
67
|
+
continue;
|
|
68
|
+
const { id: _i, value: _v, aiviz_auto: _a, ...attrs } = c.attrs;
|
|
69
|
+
const sameLook = (prev.color ?? '') === (now.color ?? '') && !!prev.highlight === !!now.highlight;
|
|
70
|
+
const { aiviz_color: _c, aiviz_highlight: _h, ...rest } = attrs;
|
|
71
|
+
keep.set(specId, {
|
|
72
|
+
attrs: rest,
|
|
73
|
+
style: prev.kind === now.kind && sameLook ? c.styleRaw : undefined,
|
|
74
|
+
label: prev.label === now.label && prev.tech === now.tech && sameLook ? (c.attrs.label ?? c.label) : undefined,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const scene = await sequenceScene(diagram, measure, { keepX, keep, extraMeta: mode === 'merge' ? { aiviz_layout: 'manual' } : {} });
|
|
79
|
+
const xml = stampEdgeRoutes(serialize(scene));
|
|
80
|
+
return finish(b, xml, { mode, warnings, direction: 'TB', edits, old });
|
|
81
|
+
}
|
|
82
|
+
const l = await layout(diagram, measure);
|
|
83
|
+
let xml;
|
|
84
|
+
let stats;
|
|
85
|
+
if (mode === 'merge') {
|
|
86
|
+
const m = merge(diagram, old, l, { specIsCurrent: specBase(specText) === fingerprint(old) });
|
|
87
|
+
stats = m.stats;
|
|
88
|
+
xml = serialize(m.scene);
|
|
89
|
+
if (m.reroute.length)
|
|
90
|
+
xml = await rerouteInto(b, xml, m.reroute);
|
|
91
|
+
// Kept routes can already be broken, e.g. stale waypoints after someone moved a node.
|
|
92
|
+
const broken = brokenEdges(check(await b.inspect(xml)));
|
|
93
|
+
if (broken.length) {
|
|
94
|
+
xml = await rerouteInto(b, xml, broken);
|
|
95
|
+
stats.rerouted += broken.filter((id) => !m.reroute.includes(id)).length;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
else
|
|
99
|
+
xml = toMxfile(diagram, l);
|
|
100
|
+
xml = (await fixLabels(b, xml)).xml;
|
|
101
|
+
xml = stampEdgeRoutes(xml);
|
|
102
|
+
return finish(b, xml, { mode, warnings, direction: mode === 'merge' ? (old.meta.aiviz_direction ?? l.direction) : l.direction, edits, old, stats });
|
|
103
|
+
});
|
|
104
|
+
async function finish(b, xml, r) {
|
|
105
|
+
fs.mkdirSync(path.dirname(path.resolve(opts.out)), { recursive: true });
|
|
106
|
+
fs.writeFileSync(opts.out, kind === 'svg' ? await b.renderSvg(xml) : xml);
|
|
107
|
+
if (opts.png)
|
|
108
|
+
await b.renderPng(xml, opts.png);
|
|
109
|
+
return {
|
|
110
|
+
out: opts.out,
|
|
111
|
+
warnings: r.warnings,
|
|
112
|
+
check: check(await b.inspect(xml)),
|
|
113
|
+
direction: r.direction,
|
|
114
|
+
mode: r.mode,
|
|
115
|
+
merge: r.stats,
|
|
116
|
+
discardedLayout: !!(opts.relayout && r.old && (r.old.meta.aiviz_layout === 'manual' || r.edits.length > 0)),
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
async function rerouteInto(b, xml, edgeIds) {
|
|
121
|
+
return patchEdges(xml, await b.reroute(xml, edgeIds), edgeIds);
|
|
122
|
+
}
|
|
123
|
+
/** Reroute only the edges check flags as broken. Nothing else changes. */
|
|
124
|
+
export async function tidy(file, browser) {
|
|
125
|
+
const text = fs.readFileSync(file, 'utf8');
|
|
126
|
+
const m = readDrawio(text);
|
|
127
|
+
return withBrowser(browser, async (b) => {
|
|
128
|
+
const broken = brokenEdges(check(await b.inspect(m.xml)));
|
|
129
|
+
if (!broken.length)
|
|
130
|
+
return { fixed: 0, check: check(await b.inspect(m.xml)) };
|
|
131
|
+
const xml = stampEdgeRoutes(await rerouteInto(b, m.xml, broken));
|
|
132
|
+
fs.writeFileSync(file, file.endsWith('.svg') ? await b.renderSvg(xml) : xml);
|
|
133
|
+
return { fixed: broken.length, check: check(await b.inspect(xml)) };
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
export function show(file, opts = {}) {
|
|
137
|
+
const m = readDrawio(fs.readFileSync(file, 'utf8'));
|
|
138
|
+
const { diagram, notes, idMap } = toDiagram(m);
|
|
139
|
+
let yaml = toYaml(diagram, `linework-base: ${fingerprint(m)} (keep this line; it tells build this spec includes the latest hand edits)`);
|
|
140
|
+
if (opts.geometry) {
|
|
141
|
+
// Positions as comments: invisible to build, but they make `git diff` show moves.
|
|
142
|
+
const lines = ['# geometry (x,y width x height)'];
|
|
143
|
+
for (const [cellId, specId] of idMap) {
|
|
144
|
+
const b = absBox(m, cellId);
|
|
145
|
+
if (b)
|
|
146
|
+
lines.push(`# ${specId}: ${Math.round(b.x)},${Math.round(b.y)} ${Math.round(b.w)}x${Math.round(b.h)}`);
|
|
147
|
+
}
|
|
148
|
+
yaml += lines.join('\n') + '\n';
|
|
149
|
+
}
|
|
150
|
+
return { yaml, notes, edits: manualEdits(m) };
|
|
151
|
+
}
|
|
152
|
+
export async function render(file, out, browser) {
|
|
153
|
+
const m = readDrawio(fs.readFileSync(file, 'utf8'));
|
|
154
|
+
await withBrowser(browser, async (b) => {
|
|
155
|
+
if (out.endsWith('.png'))
|
|
156
|
+
await b.renderPng(m.xml, out);
|
|
157
|
+
else if (out.endsWith('.svg'))
|
|
158
|
+
fs.writeFileSync(out, await b.renderSvg(m.xml));
|
|
159
|
+
else
|
|
160
|
+
throw new Error('render output must end in .png or .svg');
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
export async function checkFile(file, browser) {
|
|
164
|
+
const m = readDrawio(fs.readFileSync(file, 'utf8'));
|
|
165
|
+
return withBrowser(browser, async (b) => check(await b.inspect(m.xml)));
|
|
166
|
+
}
|
|
167
|
+
function outputKind(out) {
|
|
168
|
+
if (out.endsWith('.svg'))
|
|
169
|
+
return 'svg';
|
|
170
|
+
if (out.endsWith('.drawio') || out.endsWith('.xml'))
|
|
171
|
+
return 'xml';
|
|
172
|
+
throw new Error(`output must end in .drawio.svg (recommended), .svg or .drawio, got ${out}`);
|
|
173
|
+
}
|
|
174
|
+
/** Icon names for a provider, optionally filtered. */
|
|
175
|
+
export async function listIcons(provider, filter, browser) {
|
|
176
|
+
return withBrowser(browser, async (b) => {
|
|
177
|
+
const p = PROVIDERS[provider];
|
|
178
|
+
const names = (await b.stencilNames(p.set)).map((n) => n.slice(p.prefix.length));
|
|
179
|
+
return names.filter((n) => !filter || n.includes(filter.toLowerCase())).sort();
|
|
180
|
+
});
|
|
181
|
+
}
|