@itsthecsguy/linework 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +11 -0
  3. package/README.md +206 -2
  4. package/assets/drawio/LICENSE +201 -0
  5. package/assets/drawio/VERSION +1 -0
  6. package/assets/drawio/favicon.ico +0 -0
  7. package/assets/drawio/images/1x1.png +0 -0
  8. package/assets/drawio/images/2x2.png +0 -0
  9. package/assets/drawio/images/3x3.png +0 -0
  10. package/assets/drawio/images/ajax-loader.gif +0 -0
  11. package/assets/drawio/images/android-chrome-512x512.png +0 -0
  12. package/assets/drawio/images/apple-touch-icon.png +0 -0
  13. package/assets/drawio/images/aui-wait.gif +0 -0
  14. package/assets/drawio/images/broken.png +0 -0
  15. package/assets/drawio/images/browserconfig.xml +9 -0
  16. package/assets/drawio/images/close.png +0 -0
  17. package/assets/drawio/images/cloud-connector-atlas.png +0 -0
  18. package/assets/drawio/images/collapsed.gif +0 -0
  19. package/assets/drawio/images/delete.png +0 -0
  20. package/assets/drawio/images/document-google-drive-icon-80.png +0 -0
  21. package/assets/drawio/images/draw-search.png +0 -0
  22. package/assets/drawio/images/drawio.svg +19 -0
  23. package/assets/drawio/images/drawlogo-color.svg +50 -0
  24. package/assets/drawio/images/drawlogo-gray.svg +18 -0
  25. package/assets/drawio/images/drawlogo-text-bottom.svg +75 -0
  26. package/assets/drawio/images/drawlogo.svg +18 -0
  27. package/assets/drawio/images/drawlogo128.png +0 -0
  28. package/assets/drawio/images/drawlogo144.png +0 -0
  29. package/assets/drawio/images/drawlogo256.png +0 -0
  30. package/assets/drawio/images/drawlogo48-gray.png +0 -0
  31. package/assets/drawio/images/drawlogo48.png +0 -0
  32. package/assets/drawio/images/drawlogo80.png +0 -0
  33. package/assets/drawio/images/droptarget.png +0 -0
  34. package/assets/drawio/images/edit.gif +0 -0
  35. package/assets/drawio/images/edit16.png +0 -0
  36. package/assets/drawio/images/edit32.png +0 -0
  37. package/assets/drawio/images/edit80.png +0 -0
  38. package/assets/drawio/images/embed-icon.png +0 -0
  39. package/assets/drawio/images/expanded.gif +0 -0
  40. package/assets/drawio/images/facebook.png +0 -0
  41. package/assets/drawio/images/favicon-16x16.png +0 -0
  42. package/assets/drawio/images/favicon-32x32.png +0 -0
  43. package/assets/drawio/images/file.png +0 -0
  44. package/assets/drawio/images/folder.png +0 -0
  45. package/assets/drawio/images/gadget-screenshot.png +0 -0
  46. package/assets/drawio/images/gadget-thumb.png +0 -0
  47. package/assets/drawio/images/github-logo-white.svg +6 -0
  48. package/assets/drawio/images/github-logo.svg +17 -0
  49. package/assets/drawio/images/gitlab-logo-white.svg +1 -0
  50. package/assets/drawio/images/gitlab-logo.svg +1 -0
  51. package/assets/drawio/images/glyphicons_blogger.png +0 -0
  52. package/assets/drawio/images/glyphicons_facebook.png +0 -0
  53. package/assets/drawio/images/glyphicons_github.png +0 -0
  54. package/assets/drawio/images/glyphicons_google.png +0 -0
  55. package/assets/drawio/images/glyphicons_star.png +0 -0
  56. package/assets/drawio/images/glyphicons_twitter.png +0 -0
  57. package/assets/drawio/images/glyphicons_youtube.png +0 -0
  58. package/assets/drawio/images/google-drive-connector-atlas.png +0 -0
  59. package/assets/drawio/images/google-drive-connector-atlas.svg +121 -0
  60. package/assets/drawio/images/google-drive-logo-white.svg +9 -0
  61. package/assets/drawio/images/google-drive-logo.svg +17 -0
  62. package/assets/drawio/images/google-share.png +0 -0
  63. package/assets/drawio/images/icon-192-maskable.png +0 -0
  64. package/assets/drawio/images/icon-192.png +0 -0
  65. package/assets/drawio/images/icon-512-maskable.png +0 -0
  66. package/assets/drawio/images/icon-512.png +0 -0
  67. package/assets/drawio/images/icon-search.svg +21 -0
  68. package/assets/drawio/images/img-hi-res.png +0 -0
  69. package/assets/drawio/images/img-lo-res.png +0 -0
  70. package/assets/drawio/images/list.svg +16 -0
  71. package/assets/drawio/images/locked.png +0 -0
  72. package/assets/drawio/images/log.png +0 -0
  73. package/assets/drawio/images/logo-confluence.png +0 -0
  74. package/assets/drawio/images/logo-flat-small.png +0 -0
  75. package/assets/drawio/images/logo-flat.png +0 -0
  76. package/assets/drawio/images/logo-jira.png +0 -0
  77. package/assets/drawio/images/logo-small.gif +0 -0
  78. package/assets/drawio/images/logo-white.png +0 -0
  79. package/assets/drawio/images/logo.png +0 -0
  80. package/assets/drawio/images/manifest.json +25 -0
  81. package/assets/drawio/images/move.png +0 -0
  82. package/assets/drawio/images/notion-logo-white.svg +1 -0
  83. package/assets/drawio/images/notion-logo.svg +1 -0
  84. package/assets/drawio/images/onedrive-connector-atlas.png +0 -0
  85. package/assets/drawio/images/onedrive-connector-atlas.svg +248 -0
  86. package/assets/drawio/images/onedrive-logo-white.svg +29 -0
  87. package/assets/drawio/images/onedrive-logo.svg +29 -0
  88. package/assets/drawio/images/osa_database.png +0 -0
  89. package/assets/drawio/images/osa_drive-harddisk.png +0 -0
  90. package/assets/drawio/images/plant-uml-atlas.png +0 -0
  91. package/assets/drawio/images/samepage-icon-color.svg +37 -0
  92. package/assets/drawio/images/save.png +0 -0
  93. package/assets/drawio/images/sidebar-android.png +0 -0
  94. package/assets/drawio/images/sidebar-archimate.png +0 -0
  95. package/assets/drawio/images/sidebar-arrows.png +0 -0
  96. package/assets/drawio/images/sidebar-arrows2.png +0 -0
  97. package/assets/drawio/images/sidebar-basic.png +0 -0
  98. package/assets/drawio/images/sidebar-c4.png +0 -0
  99. package/assets/drawio/images/sidebar-cabinets.png +0 -0
  100. package/assets/drawio/images/sidebar-cumulus.png +0 -0
  101. package/assets/drawio/images/sidebar-dfd.png +0 -0
  102. package/assets/drawio/images/sidebar-dynamics365.png +0 -0
  103. package/assets/drawio/images/sidebar-eip.png +0 -0
  104. package/assets/drawio/images/sidebar-er.png +0 -0
  105. package/assets/drawio/images/sidebar-floorplans.png +0 -0
  106. package/assets/drawio/images/sidebar-flowchart.png +0 -0
  107. package/assets/drawio/images/sidebar-gcp3.png +0 -0
  108. package/assets/drawio/images/sidebar-general.png +0 -0
  109. package/assets/drawio/images/sidebar-kubernetes.png +0 -0
  110. package/assets/drawio/images/sidebar-leanmapping.png +0 -0
  111. package/assets/drawio/images/sidebar-mockups.png +0 -0
  112. package/assets/drawio/images/sidebar-network.png +0 -0
  113. package/assets/drawio/images/sidebar-network2.png +0 -0
  114. package/assets/drawio/images/sidebar-openstack.png +0 -0
  115. package/assets/drawio/images/sidebar-sitemap.png +0 -0
  116. package/assets/drawio/images/sidebar-threatmodeling.png +0 -0
  117. package/assets/drawio/images/sidebar-uml.png +0 -0
  118. package/assets/drawio/images/sketch-logo128.png +0 -0
  119. package/assets/drawio/images/spin.gif +0 -0
  120. package/assets/drawio/images/sprites.png +0 -0
  121. package/assets/drawio/images/stop-flat-icon-80.png +0 -0
  122. package/assets/drawio/images/submenu.gif +0 -0
  123. package/assets/drawio/images/touch-submenu.png +0 -0
  124. package/assets/drawio/images/transparent.gif +0 -0
  125. package/assets/drawio/images/trello-logo-white-orange.svg +6 -0
  126. package/assets/drawio/images/trello-logo-white.svg +6 -0
  127. package/assets/drawio/images/trello-logo.svg +1 -0
  128. package/assets/drawio/images/tweet.png +0 -0
  129. package/assets/drawio/images/update16.png +0 -0
  130. package/assets/drawio/images/update32.png +0 -0
  131. package/assets/drawio/images/update80.png +0 -0
  132. package/assets/drawio/images/youtube.png +0 -0
  133. package/assets/drawio/img/clipart/Battery_0_128x128.png +0 -0
  134. package/assets/drawio/img/clipart/Battery_100_128x128.png +0 -0
  135. package/assets/drawio/img/clipart/Battery_50_128x128.png +0 -0
  136. package/assets/drawio/img/clipart/Battery_75_128x128.png +0 -0
  137. package/assets/drawio/img/clipart/Battery_allstates_128x128.png +0 -0
  138. package/assets/drawio/img/clipart/Bluetooth_128x128.png +0 -0
  139. package/assets/drawio/img/clipart/Earth_globe_128x128.png +0 -0
  140. package/assets/drawio/img/clipart/Empty_Folder_128x128.png +0 -0
  141. package/assets/drawio/img/clipart/Full_Folder_128x128.png +0 -0
  142. package/assets/drawio/img/clipart/Gear_128x128.png +0 -0
  143. package/assets/drawio/img/clipart/Keys_128x128.png +0 -0
  144. package/assets/drawio/img/clipart/Lock_128x128.png +0 -0
  145. package/assets/drawio/img/clipart/Mouse_Pointer_128x128.png +0 -0
  146. package/assets/drawio/img/clipart/Plug_128x128.png +0 -0
  147. package/assets/drawio/img/clipart/Ships_Wheel_128x128.png +0 -0
  148. package/assets/drawio/img/clipart/Star_128x128.png +0 -0
  149. package/assets/drawio/img/clipart/Tire_128x128.png +0 -0
  150. package/assets/drawio/index.html +92 -0
  151. package/assets/drawio/js/PostConfig.js +7 -0
  152. package/assets/drawio/js/PreConfig.js +13 -0
  153. package/assets/drawio/js/app.min.js +18466 -0
  154. package/assets/drawio/js/bootstrap.js +428 -0
  155. package/assets/drawio/js/diagramly/LibavoidRouting.js +4459 -0
  156. package/assets/drawio/js/export-init.js +21 -0
  157. package/assets/drawio/js/extensions.min.js +10478 -0
  158. package/assets/drawio/js/libavoid-js/LICENSE +505 -0
  159. package/assets/drawio/js/libavoid-js/libavoid-routing.js +1633 -0
  160. package/assets/drawio/js/libavoid-js/libavoid.min.js +59 -0
  161. package/assets/drawio/js/main.js +22 -0
  162. package/assets/drawio/js/rough/rough.min.js +1 -0
  163. package/assets/drawio/js/shapes-14-6-5.min.js +3457 -0
  164. package/assets/drawio/js/stencils.min.js +447 -0
  165. package/assets/drawio/mxgraph/css/common.css +147 -0
  166. package/assets/drawio/resources/dia.txt +2901 -0
  167. package/assets/drawio/styles/dark-default.xml +109 -0
  168. package/assets/drawio/styles/default-old.xml +109 -0
  169. package/assets/drawio/styles/default.xml +203 -0
  170. package/assets/drawio/styles/fonts/ArchitectsDaughter-Regular.ttf +0 -0
  171. package/assets/drawio/styles/grapheditor.css +4501 -0
  172. package/assets/drawio/styles/high-contrast.css +128 -0
  173. package/assets/drawio/styles/thumb_horz.png +0 -0
  174. package/assets/drawio/styles/thumb_vertical.png +0 -0
  175. package/assets/fonts/ibm-plex-mono-LICENSE.txt +93 -0
  176. package/assets/fonts/ibm-plex-sans-LICENSE.txt +93 -0
  177. package/assets/fonts/kalam-400.woff2 +0 -0
  178. package/assets/fonts/kalam-700.woff2 +0 -0
  179. package/assets/fonts/kalam-LICENSE.txt +93 -0
  180. package/assets/fonts/plex-mono-400.woff2 +0 -0
  181. package/assets/fonts/plex-mono-600.woff2 +0 -0
  182. package/assets/fonts/plex-sans-400.woff2 +0 -0
  183. package/assets/fonts/plex-sans-600.woff2 +0 -0
  184. package/dist/api.js +218 -0
  185. package/dist/cli.js +275 -0
  186. package/dist/drawio/icons.js +121 -0
  187. package/dist/drawio/merge.js +309 -0
  188. package/dist/drawio/read.js +180 -0
  189. package/dist/drawio/show.js +501 -0
  190. package/dist/drawio/theme.js +425 -0
  191. package/dist/drawio/write.js +300 -0
  192. package/dist/edit/server.js +212 -0
  193. package/dist/git.js +46 -0
  194. package/dist/import/mermaid.js +569 -0
  195. package/dist/layout/layout.js +212 -0
  196. package/dist/layout/sequence.js +333 -0
  197. package/dist/layout/text.js +73 -0
  198. package/dist/lint/check.js +188 -0
  199. package/dist/lint/fixlabels.js +128 -0
  200. package/dist/mcp/server.js +239 -0
  201. package/dist/publish.js +121 -0
  202. package/dist/render/browser.js +236 -0
  203. package/dist/render/fonts.js +66 -0
  204. package/dist/report.js +36 -0
  205. package/dist/spec/model.js +53 -0
  206. package/dist/spec/parse.js +497 -0
  207. package/package.json +71 -4
  208. package/skills/linework/SKILL.md +233 -0
  209. package/skills/linework/examples/billing-er.yaml +31 -0
  210. package/skills/linework/examples/checkout.yaml +28 -0
  211. package/skills/linework/examples/pay-sequence.yaml +28 -0
  212. package/skills/linework/examples/payment-state.yaml +22 -0
  213. package/skills/linework/examples/refund-flow.yaml +29 -0
  214. package/skills/linework/examples/serverless-aws.yaml +23 -0
  215. package/skills/linework/references/google-docs.md +46 -0
  216. package/skills/linework/references/spec.md +312 -0
  217. 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
+ }
@@ -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,218 @@
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 { edgeCellId, 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 = await straightenDetours(b, toMxfile(diagram, l), detourEdges(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
+ /**
121
+ * Edges whose route is far longer than the gap between their ends. Layered layout
122
+ * draws one edge of every cycle backwards, so the reply in a call-and-callback pair
123
+ * (api -> stripe, stripe -> api) can loop around a whole group.
124
+ */
125
+ export function detourEdges(d, l) {
126
+ const out = [];
127
+ for (const e of d.edges) {
128
+ const r = l.edges.get(e.id), a = l.nodes.get(e.from), z = l.nodes.get(e.to);
129
+ if (!r || !a || !z || r.points.length < 2)
130
+ continue;
131
+ let len = 0;
132
+ for (let i = 0; i < r.points.length - 1; i++)
133
+ len += Math.abs(r.points[i + 1].x - r.points[i].x) + Math.abs(r.points[i + 1].y - r.points[i].y);
134
+ const gap = Math.max(0, Math.abs(a.x + a.w / 2 - (z.x + z.w / 2)) - (a.w + z.w) / 2) +
135
+ Math.max(0, Math.abs(a.y + a.h / 2 - (z.y + z.h / 2)) - (a.h + z.h) / 2);
136
+ if (len > 2 * gap + 240)
137
+ out.push(edgeCellId(e.id));
138
+ }
139
+ return out;
140
+ }
141
+ /**
142
+ * Reroute detours with libavoid. Keep the new routes when they're much shorter and
143
+ * cost at most a couple of crossings each: a short hop with a crossing reads better
144
+ * than a line wrapped around half the diagram.
145
+ */
146
+ async function straightenDetours(b, xml, ids) {
147
+ if (!ids.length)
148
+ return xml;
149
+ const candidate = await rerouteInto(b, xml, ids);
150
+ const [before, after] = [await b.inspect(xml), await b.inspect(candidate)];
151
+ const length = (cells) => cells.filter((c) => ids.includes(c.id)).reduce((sum, c) => sum + (c.points ?? []).reduce((s, p, i, a) => (i ? s + Math.abs(p.x - a[i - 1].x) + Math.abs(p.y - a[i - 1].y) : 0), 0), 0);
152
+ const [c0, c1] = [check(before), check(after)];
153
+ const errors = (c) => c.findings.filter((f) => f.level === 'error').length;
154
+ const keep = errors(c1) <= errors(c0) && c1.stats.crossings <= c0.stats.crossings + 2 * ids.length && length(after) < 0.6 * length(before);
155
+ return keep ? candidate : xml;
156
+ }
157
+ async function rerouteInto(b, xml, edgeIds) {
158
+ return patchEdges(xml, await b.reroute(xml, edgeIds), edgeIds);
159
+ }
160
+ /** Reroute only the edges check flags as broken. Nothing else changes. */
161
+ export async function tidy(file, browser) {
162
+ const text = fs.readFileSync(file, 'utf8');
163
+ const m = readDrawio(text);
164
+ return withBrowser(browser, async (b) => {
165
+ const broken = brokenEdges(check(await b.inspect(m.xml)));
166
+ if (!broken.length)
167
+ return { fixed: 0, check: check(await b.inspect(m.xml)) };
168
+ const xml = stampEdgeRoutes(await rerouteInto(b, m.xml, broken));
169
+ fs.writeFileSync(file, file.endsWith('.svg') ? await b.renderSvg(xml) : xml);
170
+ return { fixed: broken.length, check: check(await b.inspect(xml)) };
171
+ });
172
+ }
173
+ export function show(file, opts = {}) {
174
+ const m = readDrawio(fs.readFileSync(file, 'utf8'));
175
+ const { diagram, notes, idMap } = toDiagram(m);
176
+ let yaml = toYaml(diagram, `linework-base: ${fingerprint(m)} (keep this line; it tells build this spec includes the latest hand edits)`);
177
+ if (opts.geometry) {
178
+ // Positions as comments: invisible to build, but they make `git diff` show moves.
179
+ const lines = ['# geometry (x,y width x height)'];
180
+ for (const [cellId, specId] of idMap) {
181
+ const b = absBox(m, cellId);
182
+ if (b)
183
+ lines.push(`# ${specId}: ${Math.round(b.x)},${Math.round(b.y)} ${Math.round(b.w)}x${Math.round(b.h)}`);
184
+ }
185
+ yaml += lines.join('\n') + '\n';
186
+ }
187
+ return { yaml, notes, edits: manualEdits(m) };
188
+ }
189
+ export async function render(file, out, browser) {
190
+ const m = readDrawio(fs.readFileSync(file, 'utf8'));
191
+ await withBrowser(browser, async (b) => {
192
+ if (out.endsWith('.png'))
193
+ await b.renderPng(m.xml, out);
194
+ else if (out.endsWith('.svg'))
195
+ fs.writeFileSync(out, await b.renderSvg(m.xml));
196
+ else
197
+ throw new Error('render output must end in .png or .svg');
198
+ });
199
+ }
200
+ export async function checkFile(file, browser) {
201
+ const m = readDrawio(fs.readFileSync(file, 'utf8'));
202
+ return withBrowser(browser, async (b) => check(await b.inspect(m.xml)));
203
+ }
204
+ function outputKind(out) {
205
+ if (out.endsWith('.svg'))
206
+ return 'svg';
207
+ if (out.endsWith('.drawio') || out.endsWith('.xml'))
208
+ return 'xml';
209
+ throw new Error(`output must end in .drawio.svg (recommended), .svg or .drawio, got ${out}`);
210
+ }
211
+ /** Icon names for a provider, optionally filtered. */
212
+ export async function listIcons(provider, filter, browser) {
213
+ return withBrowser(browser, async (b) => {
214
+ const p = PROVIDERS[provider];
215
+ const names = (await b.stencilNames(p.set)).map((n) => n.slice(p.prefix.length));
216
+ return names.filter((n) => !filter || n.includes(filter.toLowerCase())).sort();
217
+ });
218
+ }