@johnoscott/isometric-engine 0.0.0-stage → 0.9.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.
Files changed (310) hide show
  1. package/EDITOR-GUIDE.md +317 -0
  2. package/LICENSE +21 -0
  3. package/LICENSES/ajv.txt +22 -0
  4. package/LICENSES/lucide-static.txt +43 -0
  5. package/LICENSES/yaml.txt +13 -0
  6. package/README.md +62 -2
  7. package/assets/app.css +265 -0
  8. package/assets/default-theme.yaml +99 -0
  9. package/assets/icons.svg +1 -0
  10. package/assets/marks.css +35 -0
  11. package/assets/skin.css +181 -0
  12. package/iso-editor.d.ts +4 -0
  13. package/iso-editor.js +550 -0
  14. package/iso-render.d.ts +3 -0
  15. package/iso-render.js +388 -0
  16. package/iso-systems.d.ts +4 -0
  17. package/iso-systems.js +389 -0
  18. package/js/iso-core/compile-schema.js +22 -0
  19. package/js/iso-core/depth.js +55 -0
  20. package/js/iso-core/errors.js +65 -0
  21. package/js/iso-core/glyphs.js +100 -0
  22. package/js/iso-core/index.js +55 -0
  23. package/js/iso-core/kernel.js +158 -0
  24. package/js/iso-core/metrics.json +1 -0
  25. package/js/iso-core/package.json +6 -0
  26. package/js/iso-core/parse.js +79 -0
  27. package/js/iso-core/schema-errors.js +170 -0
  28. package/js/iso-core/shims/crypto.js +125 -0
  29. package/js/iso-core/shims/path.js +49 -0
  30. package/js/iso-core/svg-dom.js +144 -0
  31. package/js/iso-core/theme.js +48 -0
  32. package/js/iso-core/vdom.js +48 -0
  33. package/js/iso-editor/adapter.js +0 -0
  34. package/js/iso-editor/clipboard.js +152 -0
  35. package/js/iso-editor/commands.js +173 -0
  36. package/js/iso-editor/complete.js +55 -0
  37. package/js/iso-editor/doc.js +182 -0
  38. package/js/iso-editor/index.js +105 -0
  39. package/js/iso-editor/model.js +210 -0
  40. package/js/iso-editor/outline.js +111 -0
  41. package/js/iso-editor/package.json +6 -0
  42. package/js/iso-editor/path.js +19 -0
  43. package/js/iso-editor/providers.js +96 -0
  44. package/js/iso-editor/schema-nav.js +117 -0
  45. package/js/iso-editor/splice.js +441 -0
  46. package/js/iso-editor/storage-keys.js +6 -0
  47. package/js/iso-editor/ui/actions.js +116 -0
  48. package/js/iso-editor/ui/canvas-layer.js +0 -0
  49. package/js/iso-editor/ui/canvas.js +1205 -0
  50. package/js/iso-editor/ui/clip.js +133 -0
  51. package/js/iso-editor/ui/dialog.js +26 -0
  52. package/js/iso-editor/ui/flat-canvas.js +54 -0
  53. package/js/iso-editor/ui/icons.js +15 -0
  54. package/js/iso-editor/ui/keys.js +26 -0
  55. package/js/iso-editor/ui/later.js +28 -0
  56. package/js/iso-editor/ui/layer.js +11 -0
  57. package/js/iso-editor/ui/menu.js +105 -0
  58. package/js/iso-editor/ui/monaco-entry.js +2 -0
  59. package/js/iso-editor/ui/mount-kit.js +0 -0
  60. package/js/iso-editor/ui/mount.js +767 -0
  61. package/js/iso-editor/ui/pane.js +0 -0
  62. package/js/iso-editor/ui/part.js +0 -0
  63. package/js/iso-editor/ui/plain-icons.js +34 -0
  64. package/js/iso-editor/ui/props.js +314 -0
  65. package/js/iso-editor/ui/scope-css.js +81 -0
  66. package/js/iso-editor/ui/setup.js +145 -0
  67. package/js/iso-editor/ui/text.js +323 -0
  68. package/js/iso-editor/ui/tree.js +728 -0
  69. package/js/iso-editor/validate.js +33 -0
  70. package/js/iso-editor/window/protocol.js +8 -0
  71. package/js/iso-objects/assemble.js +43 -0
  72. package/js/iso-objects/assets.js +88 -0
  73. package/js/iso-objects/board.js +162 -0
  74. package/js/iso-objects/compile.js +60 -0
  75. package/js/iso-objects/css.js +154 -0
  76. package/js/iso-objects/flat.js +696 -0
  77. package/js/iso-objects/focus.js +16 -0
  78. package/js/iso-objects/geometry.js +76 -0
  79. package/js/iso-objects/index.js +93 -0
  80. package/js/iso-objects/kinds.js +12 -0
  81. package/js/iso-objects/labels.js +325 -0
  82. package/js/iso-objects/package.json +6 -0
  83. package/js/iso-objects/place.js +347 -0
  84. package/js/iso-objects/route.js +461 -0
  85. package/js/iso-objects/scene.js +350 -0
  86. package/js/iso-objects/steps.js +246 -0
  87. package/js/iso-objects/types.js +0 -0
  88. package/js/iso-systems/catalog.js +42 -0
  89. package/js/iso-systems/compile.js +34 -0
  90. package/js/iso-systems/css.js +8 -0
  91. package/js/iso-systems/index.js +16 -0
  92. package/js/iso-systems/nodes.js +124 -0
  93. package/js/iso-systems/package.json +6 -0
  94. package/js/iso-systems/schema.json +311 -0
  95. package/js/iso-systems/validate.js +35 -0
  96. package/js/iso-viewer/bundle.js +20 -0
  97. package/js/iso-viewer/card-motion.js +228 -0
  98. package/js/iso-viewer/dom.js +14 -0
  99. package/js/iso-viewer/dual-view.js +212 -0
  100. package/js/iso-viewer/flat-view.js +124 -0
  101. package/js/iso-viewer/history.js +990 -0
  102. package/js/iso-viewer/index.js +98 -0
  103. package/js/iso-viewer/morph.js +192 -0
  104. package/js/iso-viewer/overlay.js +199 -0
  105. package/js/iso-viewer/package.json +6 -0
  106. package/js/iso-viewer/page.js +138 -0
  107. package/js/iso-viewer/player.js +409 -0
  108. package/js/iso-viewer/still.js +81 -0
  109. package/js/iso-viewer/timeline-contract.js +14 -0
  110. package/js/iso-viewer/timeline-engine.js +475 -0
  111. package/js/iso-viewer/timeline-export.js +36 -0
  112. package/js/iso-viewer/timeline-scale.js +116 -0
  113. package/js/iso-viewer/timeline-scope.js +58 -0
  114. package/js/iso-viewer/timeline-search.js +216 -0
  115. package/js/iso-viewer/timeline-time.js +55 -0
  116. package/js/iso-viewer/view-css.js +68 -0
  117. package/js/iso-viewer/viewport.js +177 -0
  118. package/package.json +502 -4
  119. package/src/iso-core/compile-schema.ts +23 -0
  120. package/src/iso-core/depth.ts +56 -0
  121. package/src/iso-core/errors.ts +73 -0
  122. package/src/iso-core/glyphs.ts +108 -0
  123. package/src/iso-core/index.ts +27 -0
  124. package/src/iso-core/kernel.ts +163 -0
  125. package/src/iso-core/metrics.json +1 -0
  126. package/src/iso-core/package.json +6 -0
  127. package/src/iso-core/parse.ts +91 -0
  128. package/src/iso-core/schema-errors.ts +163 -0
  129. package/src/iso-core/shims/crypto.ts +37 -0
  130. package/src/iso-core/shims/path.ts +24 -0
  131. package/src/iso-core/svg-dom.ts +103 -0
  132. package/src/iso-core/theme.ts +64 -0
  133. package/src/iso-core/vdom.ts +41 -0
  134. package/src/iso-editor/adapter.ts +128 -0
  135. package/src/iso-editor/clipboard.ts +163 -0
  136. package/src/iso-editor/commands.ts +191 -0
  137. package/src/iso-editor/complete.ts +73 -0
  138. package/src/iso-editor/doc.ts +207 -0
  139. package/src/iso-editor/index.ts +67 -0
  140. package/src/iso-editor/model.ts +234 -0
  141. package/src/iso-editor/outline.ts +126 -0
  142. package/src/iso-editor/package.json +6 -0
  143. package/src/iso-editor/path.ts +18 -0
  144. package/src/iso-editor/providers.ts +113 -0
  145. package/src/iso-editor/schema-nav.ts +129 -0
  146. package/src/iso-editor/splice.ts +472 -0
  147. package/src/iso-editor/storage-keys.ts +6 -0
  148. package/src/iso-editor/ui/actions.ts +119 -0
  149. package/src/iso-editor/ui/app.css +230 -0
  150. package/src/iso-editor/ui/canvas-layer.ts +56 -0
  151. package/src/iso-editor/ui/canvas.ts +1071 -0
  152. package/src/iso-editor/ui/clip.ts +97 -0
  153. package/src/iso-editor/ui/dialog.ts +25 -0
  154. package/src/iso-editor/ui/flat-canvas.ts +51 -0
  155. package/src/iso-editor/ui/icons.ts +21 -0
  156. package/src/iso-editor/ui/keys.ts +30 -0
  157. package/src/iso-editor/ui/later.ts +22 -0
  158. package/src/iso-editor/ui/layer.ts +7 -0
  159. package/src/iso-editor/ui/marks.css +35 -0
  160. package/src/iso-editor/ui/menu.ts +67 -0
  161. package/src/iso-editor/ui/monaco-entry.ts +6 -0
  162. package/src/iso-editor/ui/mount-kit.ts +35 -0
  163. package/src/iso-editor/ui/mount.ts +684 -0
  164. package/src/iso-editor/ui/pane.ts +45 -0
  165. package/src/iso-editor/ui/part.ts +45 -0
  166. package/src/iso-editor/ui/plain-icons.ts +83 -0
  167. package/src/iso-editor/ui/props.ts +347 -0
  168. package/src/iso-editor/ui/scope-css.ts +65 -0
  169. package/src/iso-editor/ui/setup.ts +144 -0
  170. package/src/iso-editor/ui/skin.css +181 -0
  171. package/src/iso-editor/ui/text.ts +262 -0
  172. package/src/iso-editor/ui/tree.ts +657 -0
  173. package/src/iso-editor/validate.ts +62 -0
  174. package/src/iso-editor/window/protocol.ts +33 -0
  175. package/src/iso-objects/assemble.ts +57 -0
  176. package/src/iso-objects/assets.ts +122 -0
  177. package/src/iso-objects/board.ts +169 -0
  178. package/src/iso-objects/compile.ts +76 -0
  179. package/src/iso-objects/css.ts +163 -0
  180. package/src/iso-objects/flat.ts +653 -0
  181. package/src/iso-objects/focus.ts +14 -0
  182. package/src/iso-objects/geometry.ts +86 -0
  183. package/src/iso-objects/index.ts +33 -0
  184. package/src/iso-objects/kinds.ts +56 -0
  185. package/src/iso-objects/labels.ts +310 -0
  186. package/src/iso-objects/package.json +6 -0
  187. package/src/iso-objects/place.ts +318 -0
  188. package/src/iso-objects/route.ts +444 -0
  189. package/src/iso-objects/scene.ts +376 -0
  190. package/src/iso-objects/steps.ts +234 -0
  191. package/src/iso-objects/types.ts +68 -0
  192. package/src/iso-systems/catalog.ts +31 -0
  193. package/src/iso-systems/compile.ts +39 -0
  194. package/src/iso-systems/css.ts +9 -0
  195. package/src/iso-systems/index.ts +12 -0
  196. package/src/iso-systems/nodes.ts +126 -0
  197. package/src/iso-systems/package.json +6 -0
  198. package/src/iso-systems/schema.json +311 -0
  199. package/src/iso-systems/validate.ts +34 -0
  200. package/src/iso-viewer/bundle.ts +15 -0
  201. package/src/iso-viewer/card-motion.ts +237 -0
  202. package/src/iso-viewer/dom.ts +13 -0
  203. package/src/iso-viewer/dual-view.ts +212 -0
  204. package/src/iso-viewer/flat-view.ts +127 -0
  205. package/src/iso-viewer/history.ts +781 -0
  206. package/src/iso-viewer/index.ts +40 -0
  207. package/src/iso-viewer/morph.ts +191 -0
  208. package/src/iso-viewer/overlay.ts +212 -0
  209. package/src/iso-viewer/package.json +6 -0
  210. package/src/iso-viewer/page.ts +150 -0
  211. package/src/iso-viewer/player.ts +321 -0
  212. package/src/iso-viewer/still.ts +74 -0
  213. package/src/iso-viewer/timeline-contract.ts +342 -0
  214. package/src/iso-viewer/timeline-engine.ts +420 -0
  215. package/src/iso-viewer/timeline-export.ts +31 -0
  216. package/src/iso-viewer/timeline-scale.ts +129 -0
  217. package/src/iso-viewer/timeline-scope.ts +56 -0
  218. package/src/iso-viewer/timeline-search.ts +198 -0
  219. package/src/iso-viewer/timeline-time.ts +54 -0
  220. package/src/iso-viewer/view-css.ts +59 -0
  221. package/src/iso-viewer/viewport.ts +142 -0
  222. package/types/iso-core/compile-schema.d.ts +11 -0
  223. package/types/iso-core/depth.d.ts +6 -0
  224. package/types/iso-core/errors.d.ts +24 -0
  225. package/types/iso-core/glyphs.d.ts +19 -0
  226. package/types/iso-core/index.d.ts +17 -0
  227. package/types/iso-core/kernel.d.ts +130 -0
  228. package/types/iso-core/metrics.json +1 -0
  229. package/types/iso-core/parse.d.ts +18 -0
  230. package/types/iso-core/schema-errors.d.ts +14 -0
  231. package/types/iso-core/shims/crypto.d.ts +9 -0
  232. package/types/iso-core/svg-dom.d.ts +15 -0
  233. package/types/iso-core/theme.d.ts +38 -0
  234. package/types/iso-core/vdom.d.ts +26 -0
  235. package/types/iso-editor/adapter.d.ts +145 -0
  236. package/types/iso-editor/clipboard.d.ts +23 -0
  237. package/types/iso-editor/commands.d.ts +32 -0
  238. package/types/iso-editor/complete.d.ts +25 -0
  239. package/types/iso-editor/doc.d.ts +50 -0
  240. package/types/iso-editor/index.d.ts +57 -0
  241. package/types/iso-editor/model.d.ts +96 -0
  242. package/types/iso-editor/outline.d.ts +28 -0
  243. package/types/iso-editor/path.d.ts +7 -0
  244. package/types/iso-editor/providers.d.ts +43 -0
  245. package/types/iso-editor/schema-nav.d.ts +34 -0
  246. package/types/iso-editor/splice.d.ts +53 -0
  247. package/types/iso-editor/storage-keys.d.ts +5 -0
  248. package/types/iso-editor/ui/actions.d.ts +23 -0
  249. package/types/iso-editor/ui/canvas-layer.d.ts +65 -0
  250. package/types/iso-editor/ui/canvas.d.ts +279 -0
  251. package/types/iso-editor/ui/clip.d.ts +14 -0
  252. package/types/iso-editor/ui/dialog.d.ts +7 -0
  253. package/types/iso-editor/ui/flat-canvas.d.ts +2 -0
  254. package/types/iso-editor/ui/icons.d.ts +5 -0
  255. package/types/iso-editor/ui/keys.d.ts +7 -0
  256. package/types/iso-editor/ui/later.d.ts +12 -0
  257. package/types/iso-editor/ui/layer.d.ts +2 -0
  258. package/types/iso-editor/ui/menu.d.ts +21 -0
  259. package/types/iso-editor/ui/mount-kit.d.ts +31 -0
  260. package/types/iso-editor/ui/mount.d.ts +146 -0
  261. package/types/iso-editor/ui/pane.d.ts +60 -0
  262. package/types/iso-editor/ui/part.d.ts +40 -0
  263. package/types/iso-editor/ui/plain-icons.d.ts +10 -0
  264. package/types/iso-editor/ui/props.d.ts +57 -0
  265. package/types/iso-editor/ui/scope-css.d.ts +5 -0
  266. package/types/iso-editor/ui/setup.d.ts +40 -0
  267. package/types/iso-editor/ui/text.d.ts +19 -0
  268. package/types/iso-editor/ui/tree.d.ts +100 -0
  269. package/types/iso-editor/validate.d.ts +36 -0
  270. package/types/iso-editor/window/protocol.d.ts +60 -0
  271. package/types/iso-objects/assemble.d.ts +35 -0
  272. package/types/iso-objects/assets.d.ts +49 -0
  273. package/types/iso-objects/board.d.ts +36 -0
  274. package/types/iso-objects/compile.d.ts +35 -0
  275. package/types/iso-objects/css.d.ts +16 -0
  276. package/types/iso-objects/flat.d.ts +130 -0
  277. package/types/iso-objects/focus.d.ts +1 -0
  278. package/types/iso-objects/geometry.d.ts +59 -0
  279. package/types/iso-objects/index.d.ts +26 -0
  280. package/types/iso-objects/kinds.d.ts +53 -0
  281. package/types/iso-objects/labels.d.ts +92 -0
  282. package/types/iso-objects/place.d.ts +25 -0
  283. package/types/iso-objects/route.d.ts +67 -0
  284. package/types/iso-objects/scene.d.ts +63 -0
  285. package/types/iso-objects/steps.d.ts +90 -0
  286. package/types/iso-objects/types.d.ts +140 -0
  287. package/types/iso-systems/catalog.d.ts +4 -0
  288. package/types/iso-systems/compile.d.ts +6 -0
  289. package/types/iso-systems/css.d.ts +3 -0
  290. package/types/iso-systems/index.d.ts +5 -0
  291. package/types/iso-systems/nodes.d.ts +3 -0
  292. package/types/iso-viewer/card-motion.d.ts +56 -0
  293. package/types/iso-viewer/dom.d.ts +1 -0
  294. package/types/iso-viewer/dual-view.d.ts +44 -0
  295. package/types/iso-viewer/flat-view.d.ts +25 -0
  296. package/types/iso-viewer/history.d.ts +91 -0
  297. package/types/iso-viewer/index.d.ts +31 -0
  298. package/types/iso-viewer/morph.d.ts +28 -0
  299. package/types/iso-viewer/overlay.d.ts +135 -0
  300. package/types/iso-viewer/page.d.ts +13 -0
  301. package/types/iso-viewer/still.d.ts +26 -0
  302. package/types/iso-viewer/timeline-contract.d.ts +345 -0
  303. package/types/iso-viewer/timeline-engine.d.ts +20 -0
  304. package/types/iso-viewer/timeline-export.d.ts +5 -0
  305. package/types/iso-viewer/timeline-scale.d.ts +44 -0
  306. package/types/iso-viewer/timeline-scope.d.ts +33 -0
  307. package/types/iso-viewer/timeline-search.d.ts +52 -0
  308. package/types/iso-viewer/timeline-time.d.ts +8 -0
  309. package/types/iso-viewer/view-css.d.ts +7 -0
  310. package/types/iso-viewer/viewport.d.ts +50 -0
@@ -0,0 +1,230 @@
1
+ /* The editor's own layout, on its skin's tokens and blocks (L3's plain skin, or a domain's layered over it). No colour
2
+ here that isn't a token. Laid out as a page: a title bar, a sidebar, the centre, a status bar. */
3
+ @layer views {
4
+ html, body { height: 100%; }
5
+ body { display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
6
+
7
+ .titlebar { display: flex; align-items: center; gap: var(--sp-3); height: var(--title-bar-h); padding: 0 var(--sp-5);
8
+ background: var(--surface); border-bottom: var(--bw) solid var(--line); flex: none; }
9
+ .titlebar .brand { color: var(--ink-2); font-size: var(--fs-md); white-space: nowrap; }
10
+ .titlebar .brand b { color: var(--ink); font-weight: var(--fw-strong); }
11
+ .titlebar .file { font-family: var(--mono); font-size: var(--fs-mono); color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
12
+ padding-left: var(--sp-3); border-left: var(--bw) solid var(--line); }
13
+ #se-fname.dirty::after { content: " ●"; color: var(--accent); }
14
+ .spacer { flex: 1; }
15
+
16
+ .body { flex: 1; display: flex; min-height: 0; }
17
+ .side { width: var(--side-w, 260px); flex: none; display: flex; flex-direction: column; background: var(--surface); border-right: var(--bw) solid var(--line); min-height: 0; }
18
+ .side-head { padding: var(--sp-3) var(--sp-4) var(--sp-2); font-size: var(--fs-xs); font-weight: var(--fw-strong); color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
19
+ .side-head .root { display: block; text-transform: none; letter-spacing: 0; font-weight: var(--fw-regular); font-family: var(--mono); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: var(--sp-0); }
20
+ #se-files { list-style: none; margin: 0; padding: 0 var(--sp-2) var(--sp-3); overflow: auto; }
21
+ .frow { display: flex; align-items: center; gap: var(--sp-2); width: 100%; min-height: var(--ctl-md); padding: 0 var(--sp-2) 0 calc(var(--sp-2) + var(--depth, 0) * var(--tree-indent));
22
+ border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
23
+ .frow:hover { background: var(--state-hover); }
24
+ .frow.current { background: var(--accent-tint); }
25
+ .frow .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: var(--fs-mono); }
26
+ .frow .kind { font-size: var(--fs-xs); color: var(--ink-3); border: var(--bw) solid var(--line); border-radius: var(--r-pill); padding: 0 var(--sp-2); }
27
+
28
+ .center { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; background: var(--surface); }
29
+ #se-code { flex: 1 1 0; min-width: 0; min-height: 0; position: relative; }
30
+
31
+ /* E7: the keyboard sheet */
32
+ dialog.dlg.keys-dlg { width: min(720px, calc(100vw - 32px)); }
33
+ .keys { columns: 2 280px; column-gap: var(--sp-6); display: block; }
34
+ .keys-h { font-size: var(--fs-sm); font-weight: var(--fw-strong); color: var(--ink-2); margin: var(--sp-2) 0 var(--sp-1); break-after: avoid; }
35
+ .keys-list { display: grid; grid-template-columns: auto 1fr; column-gap: var(--sp-3); row-gap: var(--sp-1); margin: 0 0 var(--sp-4); break-inside: avoid; font-size: var(--fs-sm); }
36
+ .keys-list dt { white-space: nowrap; color: var(--ink-2); }
37
+ .keys-list dd { margin: 0; }
38
+ .keys-list kbd { font-family: var(--mono); font-size: var(--fs-xs); padding: 0 var(--sp-1); border: var(--bw) solid var(--line); border-bottom-width: 2px; border-radius: var(--r-xs); background: var(--surface-2); color: var(--ink); }
39
+ @media (prefers-reduced-motion: reduce) { .problems-toggle .icon { transition: none; } }
40
+
41
+ /* E6: files */
42
+ .filebar { margin: var(--sp-2) var(--sp-3) 0; flex: none; }
43
+ .filebar .c-body { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
44
+ #se-files .files-head { padding: var(--sp-2) var(--sp-2) var(--sp-1); font-size: var(--fs-xs); font-weight: var(--fw-strong); color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
45
+ #se-files .files-empty { padding: var(--sp-3) var(--sp-2); display: flex; flex-direction: column; gap: var(--sp-3); align-items: flex-start; }
46
+ body[data-store="browser"] .side-head .root { color: var(--accent); }
47
+
48
+ /* E4: the work area, the canvas beside the text (or either alone) */
49
+ .work { flex: 1; min-height: 0; display: flex; }
50
+ #se-canvas { flex: 0 0 var(--canvas-w, 55%); min-width: 0; position: relative; background: var(--bg); border-right: var(--bw) solid var(--line); overflow: hidden; }
51
+ body[data-view="canvas"] #se-canvas { flex: 1 1 auto; border-right: 0; }
52
+ body[data-view="canvas"] #se-code, body[data-view="canvas"] #se-work-grip { display: none; }
53
+ body[data-view="text"] #se-canvas, body[data-view="text"] #se-work-grip { display: none; }
54
+ /* the stage (canvas.css styles the drawing in it); focused by a click, a quieter ring than the keyboard's */
55
+ .canvas.has-focus .canvas-stage:not(:focus-visible) { outline: 2px solid color-mix(in srgb, var(--focus) 50%, transparent); outline-offset: -2px; }
56
+ .canvas-tools { position: absolute; right: var(--sp-3); bottom: var(--sp-3); display: flex; gap: var(--sp-0); padding: var(--sp-0); background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-1, none); }
57
+ .canvas-tools .segmented { margin-right: var(--sp-1); }
58
+ .status .hint-mode { color: var(--ink-3); }
59
+ body[data-view="text"] .status .hint-mode { display: none; }
60
+ .canvas-tools .zoom-label { min-width: 52px; font-variant-numeric: tabular-nums; }
61
+ .canvas-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: var(--sp-6); color: var(--ink-2); text-align: center; background: var(--bg); }
62
+ .canvas-empty[hidden] { display: none; }
63
+
64
+ /* E4: the properties panel */
65
+ .sel-headrow { display: flex; align-items: center; gap: var(--sp-2); }
66
+ .sel-headrow .sel-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
67
+ .props { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-2); }
68
+ /* the label above the field, the field the row's whole width; a wide panel puts them side by side */
69
+ .prow { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--sp-2); row-gap: var(--sp-0); align-items: center; padding: var(--sp-1); border-radius: var(--r-sm); }
70
+ .prow .plabel { grid-column: 1 / -1; }
71
+ @container (min-width: 480px) {
72
+ .prow { grid-template-columns: 120px minmax(0, 1fr) auto; }
73
+ .prow .plabel { grid-column: 1; }
74
+ .prow .pfrom, .prow .pprob, .prow .pinherit, .prow .poverride { grid-column: 2 / -1; }
75
+ }
76
+ .prow .pinherit { grid-column: 1 / -1; font-family: var(--mono); font-size: var(--fs-mono); color: var(--ink-3); overflow-wrap: anywhere; padding: var(--sp-0) 0; }
77
+ .prow .poverride { grid-column: 1 / -1; justify-self: start; }
78
+ .padd { margin-top: var(--sp-2); align-self: flex-start; min-height: var(--ctl-sm); font-size: var(--fs-sm); color: var(--accent); }
79
+ .prow.focus-row { background: var(--accent-tint); }
80
+ .prow .plabel { font-family: var(--mono); font-size: var(--fs-mono); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
81
+ .prow.unset .plabel { color: var(--ink-3); }
82
+ .prow .pinput { width: 100%; min-height: var(--ctl-sm); font-size: var(--fs-sm); }
83
+ .prow input.pinput, .prow .pinput.mono { font-family: var(--mono); font-size: var(--fs-mono); }
84
+ .prow textarea.pinput { grid-column: 1 / -1; min-height: 72px; }
85
+ .prow .pacts { display: inline-flex; gap: var(--sp-0); }
86
+ .prow .pfrom, .prow .pprob { grid-column: 1 / -1; font-size: var(--fs-xs); color: var(--ink-3); overflow-wrap: anywhere; }
87
+ .prow .pprob { display: flex; gap: var(--sp-1); align-items: center; color: var(--bad); } .prow .pprob.warning { color: var(--warn); }
88
+ .prow .pprob .icon { width: 12px; height: 12px; }
89
+ .chips { display: flex; flex-wrap: wrap; gap: var(--sp-1); align-items: center; }
90
+ .chip { display: inline-flex; align-items: center; gap: var(--sp-0); height: 22px; padding: 0 var(--sp-1) 0 var(--sp-2); border-radius: var(--r-pill); background: var(--surface-2); border: var(--bw) solid var(--line); font: var(--fs-mono)/1 var(--mono); }
91
+ .chip-x { border: 0; background: none; color: var(--ink-3); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; }
92
+ .chip-x:hover { color: var(--bad); }
93
+ .chip-add { width: auto !important; min-width: 80px; }
94
+ .props-delete { margin-top: var(--sp-4); align-self: flex-start; }
95
+ .mono-input { font-family: var(--mono); }
96
+ #se-grip { height: 6px; margin: -3px 0; cursor: row-resize; z-index: 2; position: relative; }
97
+ #se-grip:hover, #se-grip:focus-visible { background: color-mix(in srgb, var(--accent) 30%, transparent); }
98
+ #se-problems { height: var(--problems-h, 160px); flex: none; overflow: auto; border-top: var(--bw) solid var(--line); background: var(--bg); font-size: var(--fs-sm); }
99
+ #se-problems.collapsed { height: auto; overflow: hidden; }
100
+ #se-problems.collapsed #se-problems-list { display: none; }
101
+ .center:has(#se-problems.collapsed) #se-grip { display: none; }
102
+ .problems-toggle { display: inline-flex; align-items: center; gap: var(--sp-1); border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
103
+ .problems-toggle .icon { width: 14px; height: 14px; transition: transform var(--dur-1, 0ms); }
104
+ .problems-toggle[aria-expanded="true"] .icon { transform: rotate(90deg); }
105
+ #se-problems.collapsed .problems-head { border-bottom: 0; }
106
+ .problems-head { position: sticky; top: 0; padding: var(--sp-1) var(--sp-4); background: var(--bg); color: var(--ink-2); font-weight: var(--fw-strong); border-bottom: var(--bw) solid var(--line); }
107
+ .prob { display: grid; grid-template-columns: 80px minmax(0, 1fr); column-gap: var(--sp-3); width: 100%; padding: var(--sp-1) var(--sp-4); border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
108
+ .prob:hover { background: var(--state-hover); }
109
+ .prob .where { font-family: var(--mono); font-size: var(--fs-mono); color: var(--ink-3); }
110
+ .prob.error .where { color: var(--bad); }
111
+ .prob.warning .where { color: var(--warn); }
112
+ .prob .hint { grid-column: 2; color: var(--ink-2); }
113
+ #se-note { position: absolute; right: var(--sp-5); bottom: calc(var(--problems-h, 160px) + var(--sp-4)); max-width: 520px; z-index: 5; box-shadow: var(--shadow-2, none); }
114
+
115
+ .status { display: flex; align-items: center; gap: var(--sp-4); height: var(--status-h); padding: 0 var(--sp-5); flex: none;
116
+ background: var(--surface); border-top: var(--bw) solid var(--line); color: var(--ink-2); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
117
+ .status .path { font-family: var(--mono); font-size: var(--fs-mono); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
118
+ #se-st-problems.bad { color: var(--bad); } #se-st-problems.warn { color: var(--warn); } #se-st-problems.ok { color: var(--ok); }
119
+
120
+ /* E3: the sidebar's tabs and the tree */
121
+ .side-tabs { margin: var(--sp-3) var(--sp-3) var(--sp-2); display: flex; }
122
+ .side-tabs .seg { flex: 1; justify-content: center; }
123
+ #se-outline { flex: 1; min-height: 0; overflow: auto; padding: 0 var(--sp-2) var(--sp-4); }
124
+ #se-files-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
125
+ #se-files-pane[hidden], #se-outline[hidden] { display: none; }
126
+ .tree:focus-within .trow.selected { background: var(--accent-tint); }
127
+ .trow { display: flex; align-items: center; gap: var(--sp-1); min-height: var(--ctl-sm); padding: 0 var(--sp-1) 0 calc(var(--sp-1) + var(--depth, 0) * var(--tree-indent));
128
+ border-radius: var(--r-sm); cursor: default; position: relative; color: var(--ink); white-space: nowrap; }
129
+ .trow:hover { background: var(--state-hover); }
130
+ .trow.selected { background: color-mix(in srgb, var(--accent-tint) 70%, transparent); }
131
+ .trow:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
132
+ .trow .twisty { width: 16px; height: 16px; flex: none; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-3); cursor: pointer; }
133
+ .trow .twisty .icon { width: 14px; height: 14px; }
134
+ .trow .ticon { width: 14px; height: 14px; color: var(--ink-2); }
135
+ .trow.k-group > .ticon, .trow.k-resource > .ticon { color: var(--accent); }
136
+ .trow .tlabel { font-size: var(--fs-md); flex: none; max-width: 60%; overflow: hidden; text-overflow: ellipsis; }
137
+ .sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
138
+ .trow.k-group > .tlabel { font-weight: var(--fw-strong); }
139
+ .trow.k-key > .tlabel, .trow.k-item > .tlabel { font-family: var(--mono); font-size: var(--fs-mono); }
140
+ .trow.ext > .tlabel { color: var(--ink-2); font-style: italic; }
141
+ .trow .tval { font-family: var(--mono); font-size: var(--fs-mono); color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; margin-left: var(--sp-1); }
142
+ .trow .tval.none, .trow.missing > .tlabel { color: var(--ink-3); }
143
+ .trow .tcount { font-size: var(--fs-xs); color: var(--ink-3); }
144
+ .trow .tpill { font-size: var(--fs-xs); border-radius: var(--r-pill); padding: 0 var(--sp-2); border: var(--bw) solid var(--line); color: var(--ink-2); flex: none; }
145
+ .trow .tpill.l-external { border-style: dashed; }
146
+ .trow .count { margin-left: auto; }
147
+ .trow .tadd { margin-left: auto; visibility: hidden; height: 20px; width: 20px; }
148
+ .trow .count + .tadd { margin-left: 0; }
149
+ .trow:hover .tadd, .trow:focus-visible .tadd, .trow.selected .tadd { visibility: visible; }
150
+ .trow .tedit { height: 22px; min-height: 22px; padding: 0 var(--sp-2); font-family: var(--mono); font-size: var(--fs-mono); flex: 1 1 auto; min-width: 60px; }
151
+ .trow .tedit[aria-invalid="true"] { border-color: var(--bad); }
152
+ .trow.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
153
+ .trow.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
154
+ .tree-note { margin: var(--sp-2) 0; }
155
+ .ref-list { margin: 0; padding-left: var(--sp-5); font-size: var(--fs-sm); }
156
+ .ref-list code { font-size: var(--fs-mono); }
157
+
158
+ /* the panels' grips, and the selection panel */
159
+ .vgrip { width: 6px; margin: 0 -3px; cursor: col-resize; z-index: 3; flex: none; position: relative; }
160
+ .vgrip:hover, .vgrip:focus-visible { background: color-mix(in srgb, var(--accent) 30%, transparent); }
161
+ .right { width: var(--right-w, 340px); overflow-x: hidden; container-type: inline-size; flex: none; display: flex; flex-direction: column; background: var(--surface); border-left: var(--bw) solid var(--line); min-height: 0; overflow: auto; }
162
+ body.no-right .right, body.no-right #se-right-grip { display: none; }
163
+ .sel-body { padding: 0 var(--sp-4) var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); font-size: var(--fs-md); }
164
+ .sel-title { font-weight: var(--fw-strong); font-size: var(--fs-lg); }
165
+ .sel-path { font-size: var(--fs-mono); color: var(--ink-2); overflow-wrap: anywhere; }
166
+ .sel-row { display: flex; gap: var(--sp-3); align-items: baseline; } .sel-row > span { color: var(--ink-2); min-width: 48px; }
167
+ .sel-doc { margin: 0; color: var(--ink-2); font-size: var(--fs-sm); }
168
+ .sel-head { margin-top: var(--sp-3); font-size: var(--fs-xs); font-weight: var(--fw-strong); color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
169
+ .sel-refs { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--sp-1); }
170
+ .linkish { border: 0; background: none; padding: 0; color: var(--accent); font: var(--fs-mono)/1.3 var(--mono); cursor: pointer; text-align: left; }
171
+ .linkish:hover { text-decoration: underline; }
172
+ .hint { color: var(--ink-2); font-size: var(--fs-sm); margin: 0; }
173
+ .sel-prob { display: flex; gap: var(--sp-2); align-items: flex-start; font-size: var(--fs-sm); }
174
+ .sel-prob.error .icon { color: var(--bad); } .sel-prob.warning .icon { color: var(--warn); }
175
+ ul.plain { margin: 0; padding-left: var(--sp-5); }
176
+ .icon.flip { transform: scaleX(-1); }
177
+ .monaco-editor .sel-range { background: color-mix(in srgb, var(--accent-tint) 80%, transparent); border-radius: 2px; }
178
+
179
+ /* v0.4.1: narrow (the editor's own width ≤ 760 px, wherever the host puts it): the canvas takes the full width; the
180
+ outline is a drawer over it, opened by the titlebar's outline button; the properties and the grips are not shown */
181
+ body { container: se-root / inline-size; }
182
+ #se-tree { display: none; }
183
+ .scrim { display: none; }
184
+ @container se-root (max-width: 760px) {
185
+ .right, .vgrip, #se-panel { display: none; }
186
+ .titlebar { overflow: hidden; }
187
+ /* the canvas's toolbar wraps onto rows inside the canvas, right-aligned: nothing clipped */
188
+ .canvas-tools { left: var(--sp-2); right: var(--sp-2); bottom: var(--sp-2); flex-wrap: wrap; justify-content: flex-end; width: fit-content; margin-left: auto; max-width: calc(100% - 2 * var(--sp-2)); }
189
+ .titlebar { padding: 0 var(--sp-4); } .titlebar .brand { display: none; }
190
+ #se-tree { display: inline-flex; }
191
+ .body { position: relative; }
192
+ .side { position: absolute; left: 0; top: 0; bottom: 0; z-index: 20; width: min(var(--side-w, 300px), 85%); visibility: hidden; transform: translateX(-100%); transition: transform .18s ease, visibility 0s linear .18s; box-shadow: var(--shadow-2, 0 8px 24px rgb(0 0 0 / .18)); }
193
+ body.side-open .side { visibility: visible; transform: none; transition: transform .18s ease; }
194
+ body.side-open .scrim { display: block; position: absolute; inset: 0; z-index: 19; background: color-mix(in srgb, var(--ink) 18%, transparent); }
195
+ }
196
+ @media (prefers-reduced-motion: reduce) { .side { transition: none !important; } }
197
+ }
198
+
199
+ /* the component (mount.ts): its root fills the host's element; read-only; a problem in another file isn't a link */
200
+ @layer views {
201
+ body { position: relative; height: 100%; min-height: 0; font: var(--fw-regular) var(--fs-md)/var(--lh) var(--font); color: var(--ink); }
202
+ .title-start { display: contents; }
203
+ [hidden] { display: none !important; }
204
+ .pill.ro { font-size: var(--fs-xs); color: var(--warn); border: var(--bw) solid color-mix(in srgb, var(--warn) 45%, transparent); border-radius: var(--r-pill, 999px); padding: 0 var(--sp-2); }
205
+ .prob.other-file { cursor: default; }
206
+ .prob.other-file .where { font-style: italic; }
207
+ .sprite { display: none; }
208
+ }
209
+
210
+ /* the panel beside Problems (a host's deeper check): its tab and its label */
211
+ @layer views {
212
+ .problems-head { display: flex; align-items: center; gap: var(--sp-3); }
213
+ .bottom-tabs .seg { height: 22px; font-size: var(--fs-xs); }
214
+ .plan-label { font-size: var(--fs-xs); font-weight: var(--fw-medium); }
215
+ .plan-label.ok { color: var(--ok); } .plan-label.bad { color: var(--bad); }
216
+ #se-problems.collapsed #se-plan { display: none; }
217
+ }
218
+ /* E11: the palette, on the canvas: click to add, or drag onto the canvas */
219
+ @layer views {
220
+ .palette { position: absolute; left: var(--sp-3); top: var(--sp-3); display: flex; flex-direction: column; gap: 2px; padding: var(--sp-0); background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-1, none); z-index: 2; }
221
+ .pal-item { display: flex; align-items: center; gap: var(--sp-2); height: var(--ctl-sm); padding: 0 var(--sp-2); border: 0; border-radius: var(--r-sm); background: none; color: var(--ink-2); font: inherit; font-size: var(--fs-sm); cursor: grab; text-align: left; touch-action: none; user-select: none; }
222
+ .pal-item:hover { background: var(--state-hover); color: var(--ink); }
223
+ .pal-item:active { cursor: grabbing; }
224
+ .pal-item .icon { width: 14px; height: 14px; }
225
+ body.read-only .palette { display: none; }
226
+ .pal-ghost { position: absolute; z-index: 5; pointer-events: none; display: flex; align-items: center; gap: var(--sp-1); padding: 2px var(--sp-2); border: var(--bw) solid var(--accent); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font-size: var(--fs-sm); box-shadow: var(--shadow-2, none); }
227
+ .pal-ghost .icon { width: 14px; height: 14px; }
228
+ .pal-ghost.bad { border-color: var(--bad); color: var(--bad); }
229
+ }
230
+
@@ -0,0 +1,56 @@
1
+ // A canvas layer: what draws over the canvas's drawing without being the drawing (a domain's state, cards, marks).
2
+ // It is given what the canvas knows (CanvasCtx: the drawing, its elements and boxes, the scale, the view), and gives
3
+ // its own controls for the toolbar, marks over the stage, groups after the selection's, a paint after each of the
4
+ // canvas's, the boxes a fit takes in, a press, a menu or a key it takes first, and its own calls on what the canvas
5
+ // returns. The canvas carries none of a layer's code: the host passes the layer in.
6
+
7
+ import type { EditorModel } from '../model.ts';
8
+ import type { Path } from '../path.ts';
9
+
10
+ export interface Box { x: number; y: number; w: number; h: number }
11
+ export type Outline = { kind: 'poly'; id: string; points: [number, number][] } | { kind: 'route'; d: string };
12
+
13
+ /** what the canvas gives a layer (D: the domain's drawn document) */
14
+ export interface CanvasCtx<D> {
15
+ host: HTMLElement;
16
+ doc: EditorModel;
17
+ cd(): D | undefined;
18
+ svg(): SVGSVGElement | undefined;
19
+ elementsFor(ptr: string): SVGGraphicsElement[];
20
+ boxOf(e: SVGGraphicsElement): Box;
21
+ union(bs: Box[]): Box | undefined;
22
+ outlinesFor(ptr: string): Outline[];
23
+ scale(): number;
24
+ /** the whole drawing's box */
25
+ full(): Box | undefined;
26
+ toSvg(x: number, y: number): { x: number; y: number };
27
+ autoFit(): void;
28
+ /** paint the overlay again (the layer's paint() runs in it) */
29
+ paint(): void;
30
+ /** pan to it, if it is outside the view */
31
+ reveal(p: Path): void;
32
+ note(t: string, tone?: 'info' | 'warn' | 'bad'): void;
33
+ }
34
+
35
+ /** what a layer gives the canvas; A: its calls, added to what the canvas returns */
36
+ export interface CanvasLayer<A extends object> {
37
+ tools?: HTMLElement[];
38
+ marks?: HTMLElement[];
39
+ /** each new drawing: the layer's groups, put after the overlay's */
40
+ groups?(): SVGGElement[];
41
+ /** a new drawing is on the stage */
42
+ drawn?(): void;
43
+ /** what a fit takes in besides the drawing */
44
+ extent?(): Box[];
45
+ /** the layer shows marks (the view keeps them in a fit) */
46
+ showing?(): boolean;
47
+ /** after the overlay's own marks */
48
+ paint?(d: Document): void;
49
+ /** a press the layer takes (true: the canvas does nothing more) */
50
+ down?(e: PointerEvent): boolean;
51
+ /** a menu the layer opens (true: the canvas's own isn't) */
52
+ context?(e: MouseEvent, at: { x: number; y: number }): boolean;
53
+ /** a key: handled (the canvas stops it), ignore (the canvas leaves it be), or not the layer's */
54
+ key?(e: KeyboardEvent): 'handled' | 'ignore' | undefined;
55
+ api: A;
56
+ }