@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,63 @@
1
+ import { type Box } from '../iso-core/kernel.js';
2
+ import { type KindCatalog } from './kinds.js';
3
+ import { type Layout } from './place.js';
4
+ import { type Routed } from './route.js';
5
+ import { type Assembly } from './assemble.js';
6
+ import type { Steps } from './steps.js';
7
+ import type { Placed, RawScene, Theme } from './types.js';
8
+ /** the colour role a region is drawn in: its own, else its kind's */
9
+ export declare const regionRole: (cat: KindCatalog, r: {
10
+ role?: string;
11
+ kind: string;
12
+ }) => string;
13
+ export interface RenderedScene {
14
+ svg: string;
15
+ viewBox: [number, number, number, number];
16
+ /** text rectangles in screen px, for layout tests */
17
+ texts: {
18
+ x: number;
19
+ y: number;
20
+ w: number;
21
+ h: number;
22
+ text: string;
23
+ owner?: string;
24
+ }[];
25
+ /** each route's path, for the player's tokens; in screen px */
26
+ paths: Record<string, string>;
27
+ /** things drawn worse than asked, e.g. a route label shortened or dropped */
28
+ warnings: RenderWarning[];
29
+ /** the assemble intro's timeline */
30
+ assembly: Assembly;
31
+ /** callout pills in screen px, per step, for layout tests */
32
+ callouts: {
33
+ step: number;
34
+ x: number;
35
+ y: number;
36
+ w: number;
37
+ h: number;
38
+ text: string;
39
+ }[];
40
+ }
41
+ export interface RenderWarning {
42
+ path: string;
43
+ message: string;
44
+ }
45
+ export interface SceneInput {
46
+ scene: RawScene;
47
+ layout: Layout;
48
+ routes: Routed[];
49
+ steps: Steps;
50
+ theme: Theme;
51
+ id: string;
52
+ gridStep?: number;
53
+ }
54
+ export declare function renderScene({ scene, layout, routes, steps, theme, id, gridStep }: SceneInput): RenderedScene;
55
+ /** The walls of a walled region's cage, with a gap where its gate is. */
56
+ export declare function wallsOf(r: Placed): Box[];
57
+ /**
58
+ * A route's floor label: beside one of its level segments (the `along` one, else the longest first), on either side,
59
+ * slid along the segment, wherever nothing drawn over the floor would hide it. If nowhere fits, the text is shortened
60
+ * with an ellipsis; if even that fails, the label is dropped. Either way the caller gets a warning.
61
+ */
62
+ /** label spots weighed in one scene: the busiest diagram here weighs under 200; a drawing with 80 more nodes, 79,000 */
63
+ export declare const LABEL_BUDGET = 20000;
@@ -0,0 +1,90 @@
1
+ import { type P3 } from '../iso-core/kernel.js';
2
+ import { type Diag } from '../iso-core/errors.js';
3
+ import type { Layout, Located } from './place.js';
4
+ import type { Routed } from './route.js';
5
+ import type { RawScene, Theme } from './types.js';
6
+ export interface RawStep {
7
+ id?: string;
8
+ number?: number;
9
+ kind?: string;
10
+ heading: string;
11
+ caption?: string;
12
+ command?: string;
13
+ animate?: (string | Record<string, string> | (string | Record<string, string>)[])[];
14
+ pulse?: string[];
15
+ highlight?: string[];
16
+ show?: string[];
17
+ hide?: string[];
18
+ focus?: string[];
19
+ say?: {
20
+ at: string | number[];
21
+ text: string;
22
+ kind?: string;
23
+ dx?: number;
24
+ dy?: number;
25
+ anchor?: 'start' | 'middle' | 'end';
26
+ }[];
27
+ mark?: {
28
+ on?: string;
29
+ at?: number[];
30
+ }[];
31
+ badge?: boolean | string | number[];
32
+ duration?: 'auto' | number;
33
+ }
34
+ export interface Token {
35
+ route: string;
36
+ kind: string;
37
+ color: string;
38
+ }
39
+ export interface StepData {
40
+ n: number;
41
+ num: number;
42
+ kind: string;
43
+ color: string;
44
+ heading: string;
45
+ caption: string;
46
+ command: string;
47
+ phases: Token[][];
48
+ pulses: [number, number, number, number][];
49
+ lit: string[];
50
+ duration: number;
51
+ /** screen box [x0, y0, x1, y1] to zoom to, from `focus:` */
52
+ focus?: [number, number, number, number];
53
+ }
54
+ /** A callout: (x, y) is where the author asked for it; (ax, ay) is the point it belongs to, for placement. */
55
+ export interface Say {
56
+ step: number;
57
+ x: number;
58
+ y: number;
59
+ ax: number;
60
+ ay: number;
61
+ text: string;
62
+ kind: string;
63
+ anchor: 'start' | 'middle' | 'end';
64
+ }
65
+ export interface Mark {
66
+ step: number;
67
+ p: P3;
68
+ on?: string;
69
+ }
70
+ export interface Badge {
71
+ step: number;
72
+ num: number;
73
+ kind: string;
74
+ p: P3;
75
+ }
76
+ export interface Steps {
77
+ steps: StepData[];
78
+ says: Say[];
79
+ marks: Mark[];
80
+ badges: Badge[];
81
+ /** id → visibility at each step (index 0 = step 1); only for ids whose visibility ever changes */
82
+ vis: Record<string, boolean[]>;
83
+ /** ids of route-bound notes: note index → route id */
84
+ diags: Diag[];
85
+ kindsUsed: string[];
86
+ }
87
+ export declare function durationFor(caption: string): number;
88
+ export declare function resolveSteps(scene: RawScene, scenePath: string, layout: Layout, routes: Routed[], src: Located, theme: Theme): Steps;
89
+ /** The point halfway along a polyline. */
90
+ export declare function midpoint(pts: P3[]): P3;
@@ -0,0 +1,140 @@
1
+ import type { Box } from '../iso-core/kernel.js';
2
+ import type { RawRole, RawKind, Theme } from '../iso-core/theme.js';
3
+ export type { RawRole, RawKind, Theme };
4
+ export type Side = 'n' | 'e' | 's' | 'w';
5
+ export type StepRef = string | number;
6
+ export interface RawPlacement {
7
+ in?: string;
8
+ at?: [number, number];
9
+ 'right-of'?: string;
10
+ 'left-of'?: string;
11
+ below?: string;
12
+ behind?: string;
13
+ gap?: number;
14
+ align?: 'start' | 'center' | 'end';
15
+ shift?: [number, number];
16
+ appears?: StepRef;
17
+ disappears?: StepRef;
18
+ }
19
+ export type RawDeco = string | {
20
+ terminal?: number;
21
+ icon?: string;
22
+ screen?: string;
23
+ };
24
+ export interface RawNode extends RawPlacement {
25
+ id: string;
26
+ asset?: string;
27
+ role?: string;
28
+ label?: string;
29
+ sub?: string;
30
+ size?: number[];
31
+ z?: number;
32
+ deco?: RawDeco[];
33
+ ghost?: boolean;
34
+ face?: string;
35
+ facing?: number;
36
+ 'label-at'?: {
37
+ side?: 'above' | 'right' | 'left' | 'below';
38
+ dx?: number;
39
+ dy?: number;
40
+ };
41
+ nodes?: RawNode[];
42
+ }
43
+ export interface RawGate {
44
+ side: Side;
45
+ at?: number;
46
+ width?: number;
47
+ height?: number;
48
+ node?: string;
49
+ }
50
+ export interface RawRegion extends RawPlacement {
51
+ id: string;
52
+ kind: RegionKindName;
53
+ label?: string;
54
+ 'label-style'?: 'face' | 'face-right' | 'floor' | 'none';
55
+ ghost?: boolean;
56
+ role?: string;
57
+ size?: number[];
58
+ padding?: number;
59
+ height?: number;
60
+ z?: number;
61
+ flow?: 'row' | 'column';
62
+ gate?: RawGate;
63
+ around?: string[];
64
+ regions?: RawRegion[];
65
+ nodes?: RawNode[];
66
+ }
67
+ export interface RawNote {
68
+ floor?: string;
69
+ face?: string;
70
+ label?: string;
71
+ sub?: string;
72
+ at?: number[];
73
+ on?: string;
74
+ kind?: string;
75
+ dir?: 'x' | 'y';
76
+ anchor?: 'start' | 'middle' | 'end';
77
+ dx?: number;
78
+ dy?: number;
79
+ appears?: StepRef;
80
+ disappears?: StepRef;
81
+ }
82
+ export interface RawScene {
83
+ id: string;
84
+ title: string;
85
+ caption?: string;
86
+ aria?: string;
87
+ gap?: number;
88
+ flow?: 'row' | 'column';
89
+ regions?: RawRegion[];
90
+ nodes?: RawNode[];
91
+ routes?: unknown[];
92
+ notes?: RawNote[];
93
+ steps?: unknown[];
94
+ legend?: 'auto' | false | string[];
95
+ badges?: boolean;
96
+ loop?: boolean;
97
+ after?: string;
98
+ grid?: GridDef;
99
+ assemble?: boolean;
100
+ dim?: 'flows' | 'all';
101
+ }
102
+ export interface GridDef {
103
+ snap?: number;
104
+ show?: boolean;
105
+ step?: number;
106
+ }
107
+ export interface RawDiagram {
108
+ isodiag: 1;
109
+ title?: string;
110
+ lede?: string;
111
+ pills?: string[];
112
+ theme?: string;
113
+ roles?: Record<string, RawRole>;
114
+ kinds?: Record<string, RawKind>;
115
+ after?: string;
116
+ footer?: string;
117
+ grid?: GridDef;
118
+ assemble?: boolean;
119
+ scenes: RawScene[];
120
+ }
121
+ /** a region kind's name in the catalogue the drawing is laid out with (src/iso-objects/kinds.ts) */
122
+ export type RegionKindName = string;
123
+ /** Something placed: a region or a node, with its absolute box after layout. */
124
+ export interface Placed {
125
+ id: string;
126
+ type: 'region' | 'node';
127
+ /** JSON path into the source, for diagnostics */
128
+ path: string;
129
+ parent?: Placed;
130
+ children: Placed[];
131
+ box: Box;
132
+ /** the z its children stand on */
133
+ floor: number;
134
+ appears?: StepRef;
135
+ disappears?: StepRef;
136
+ region?: RawRegion;
137
+ node?: RawNode;
138
+ /** set when another item (a walled region's gate) decides this item's box */
139
+ placedBy?: string;
140
+ }
@@ -0,0 +1,4 @@
1
+ import type { KindCatalog, RegionKind } from '../iso-objects/kinds.js';
2
+ /** in this order: the legend's automatic rows follow it (fence, then vm), and so does the kinds' CSS */
3
+ export declare const REGION_KINDS: Record<string, RegionKind>;
4
+ export declare const systems: KindCatalog;
@@ -0,0 +1,6 @@
1
+ import { type Compiled } from '../iso-objects/compile.js';
2
+ export type { Compiled, CompiledScene } from '../iso-objects/compile.js';
3
+ /** opts.snap overrides every scene's grid snap (the editor's snap control). */
4
+ export declare function compile(source: string, themeText: string, opts?: {
5
+ snap?: number;
6
+ }): Compiled;
@@ -0,0 +1,3 @@
1
+ /** without any marks a host registers: for those, drawingCss(systems) / baseCss(systems) after registering */
2
+ export declare const DRAWING_CSS: string;
3
+ export declare const BASE_CSS: string;
@@ -0,0 +1,5 @@
1
+ export { NODE_ASSETS, getAsset } from './nodes.js';
2
+ export { REGION_KINDS, systems } from './catalog.js';
3
+ export { DRAWING_CSS, BASE_CSS } from './css.js';
4
+ export { compile } from './compile.js';
5
+ export type { Compiled, CompiledScene } from './compile.js';
@@ -0,0 +1,3 @@
1
+ import { type NodeAsset } from '../iso-objects/assets.js';
2
+ export declare const NODE_ASSETS: Record<string, NodeAsset>;
3
+ export declare function getAsset(name: string | undefined): NodeAsset | undefined;
@@ -0,0 +1,56 @@
1
+ export type Appear = 'scale' | 'spin' | 'dissolve' | 'inflate';
2
+ export type Idle = 'none' | 'jiggle' | 'pirouette' | 'glow' | 'breathe';
3
+ export interface MotionSettings {
4
+ enabled: boolean;
5
+ appear: Appear;
6
+ idle: Idle;
7
+ }
8
+ export declare const APPEARS: [Appear, string][];
9
+ export declare const IDLES: [Idle, string][];
10
+ /** the domain's cards: their class prefix, as the overlay draws them (PREFIX-float, a card that has gone PREFIX-leaving,
11
+ * in the PREFIX-leaving-layer), and the attributes a card's key is read from: key, else alt (removed when it goes) */
12
+ export interface CardNames {
13
+ prefix: string;
14
+ key: string;
15
+ alt: string;
16
+ }
17
+ export interface MotionHost {
18
+ /** turn a card about its vertical axis (radians), lifted (cells): its faces drawn again */
19
+ spin(card: SVGGElement, theta: number, lift: number): void;
20
+ /** the card as drawn still again */
21
+ restore(card: SVGGElement): void;
22
+ /** where a card that has gone may finish going (outside the state layer, which is reconciled) */
23
+ leavingLayer(): SVGGElement | undefined;
24
+ /** the amber of the cards' edge */
25
+ amber(): string;
26
+ }
27
+ export declare function cardMotion(host: MotionHost, initial: MotionSettings, { prefix, key, alt }: CardNames): {
28
+ readonly settings: {
29
+ enabled: boolean;
30
+ appear: Appear;
31
+ idle: Idle;
32
+ };
33
+ set(next: Partial<MotionSettings>, cards: Iterable<SVGGElement>): void;
34
+ update: (prev: Map<string, SVGGElement>, cur: Map<string, SVGGElement>, gone: Map<string, boolean>, animateOut: boolean, still?: boolean) => void;
35
+ appear: (card: SVGGElement) => Promise<void>;
36
+ disappear: (card: SVGGElement) => Promise<void>;
37
+ startIdle: (card: SVGGElement, period?: number) => void;
38
+ stopIdle: (card: SVGGElement) => void;
39
+ stopAll: (root: ParentNode | undefined) => void;
40
+ /** Preview: on each card, appear, then a few idle cycles, then disappear, then back as it was (still) and idling */
41
+ preview(cards: SVGGElement[]): Promise<void>;
42
+ /** for the tests */
43
+ readonly stats: {
44
+ jobs: number;
45
+ raf: boolean;
46
+ frames: number;
47
+ effects: number;
48
+ };
49
+ setSpeed(n: number): void;
50
+ lastFrame: (card: SVGGElement) => {
51
+ theta: number;
52
+ lift: number;
53
+ scale: number;
54
+ } | undefined;
55
+ };
56
+ export type CardMotion = ReturnType<typeof cardMotion>;
@@ -0,0 +1 @@
1
+ export declare function h<K extends keyof HTMLElementTagNameMap>(tag: K, attrs?: Record<string, unknown> | null, ...kids: (Node | string | null | undefined | false)[]): HTMLElementTagNameMap[K];
@@ -0,0 +1,44 @@
1
+ import type { CompiledScene } from '../iso-objects/compile.js';
2
+ import { type Board, type FlatLayout, type FlatOptions } from '../iso-objects/flat.js';
3
+ import { type FlatStyle } from './flat-view.js';
4
+ import { type ViewMode } from './morph.js';
5
+ export type { ViewMode } from './morph.js';
6
+ export interface DualViewOptions {
7
+ mode?: ViewMode;
8
+ /** the board the 2D view draws; default: boardOf(scene) */
9
+ board?: Board;
10
+ /** link kinds' styles in 2D */
11
+ styles?: Record<string, FlatStyle>;
12
+ flat?: Partial<FlatOptions>;
13
+ /** the svg's label */
14
+ title?: string;
15
+ onSelect?(id: string | undefined): void;
16
+ /** the morph's length, ms */
17
+ duration?: number;
18
+ /** whether a switch animates (0.7.3): 'auto' honours prefers-reduced-motion (the default), 'always' morphs
19
+ * regardless (a host's deliberate choice for a switch the user asked for), 'never' always swaps at once */
20
+ motion?: 'auto' | 'always' | 'never';
21
+ }
22
+ export interface DualView {
23
+ readonly mode: ViewMode;
24
+ readonly layout: FlatLayout;
25
+ readonly root: HTMLElement;
26
+ /** switch view, animated (instant with reduced motion); resolves when the view is shown */
27
+ morph(to: ViewMode): Promise<void>;
28
+ select(id: string | undefined): void;
29
+ readonly selected: string | undefined;
30
+ /** the svg of a view */
31
+ svgOf(mode: ViewMode): SVGSVGElement;
32
+ destroy(): void;
33
+ }
34
+ /** the scene in both views, in `host`: the 3D drawing as the engine rendered it, the 2D one laid out from its board */
35
+ export declare function dualView(host: HTMLElement, scene: CompiledScene, opts?: DualViewOptions): DualView;
36
+ /** the view a page last showed (localStorage), if any */
37
+ export declare function storedMode(key?: string): ViewMode | undefined;
38
+ /** the 3D | 2D switch: two buttons (aria-pressed), the choice remembered in localStorage; it switches every view given */
39
+ export declare function viewToggle(host: HTMLElement, views: DualView | DualView[], opts?: {
40
+ storageKey?: string;
41
+ labels?: [string, string];
42
+ }): HTMLElement;
43
+ /** the switch's and the views' own CSS (unscoped) */
44
+ export declare const DUAL_VIEW_CSS = "\n.view-switch{display:inline-flex;border:1px solid var(--line);border-radius:8px;overflow:hidden;background:var(--surface);font:600 12px/1 system-ui,sans-serif;box-shadow:0 1px 4px rgba(0,0,0,.12)}\n.view-switch button{font:inherit;border:0;background:none;color:var(--ink);padding:6px 10px;cursor:pointer}\n.view-switch button+button{border-left:1px solid var(--line)}\n.view-switch button[aria-pressed=true]{background:var(--accent,#2f6fd6);color:#fff}\n.view-switch button:focus-visible{outline:2px solid var(--accent,#2f6fd6);outline-offset:-2px}\n.dual-view [data-id][tabindex]:focus-visible{outline:none}\n.dual-view .blk.sel polygon{stroke:var(--accent,#2f6fd6);stroke-width:2.4}\n.dual-view [data-a].dim{opacity:.3}\n.dual-view [data-a].hot path{stroke-width:3.4}\n";
@@ -0,0 +1,25 @@
1
+ import type { FlatLayout, FlatRect, Measure } from '../iso-objects/flat.js';
2
+ /** how a link kind is drawn: its ends, its dash, its colour (a theme token, e.g. "send", or any CSS colour) */
3
+ export interface FlatStyle {
4
+ start?: 'arrow' | 'open' | 'diamond' | 'none';
5
+ end?: 'arrow' | 'open' | 'diamond' | 'none';
6
+ dash?: string;
7
+ color?: string;
8
+ width?: number;
9
+ }
10
+ /** the 2D drawing: panels, connectors, cards, then the connectors' labels. `id` prefixes its marker ids. */
11
+ export declare function flatSvg(L: FlatLayout, opts: {
12
+ id: string;
13
+ title?: string;
14
+ styles?: Record<string, FlatStyle>;
15
+ }): string;
16
+ /** the 2D view's stylesheet: its fonts (the ones flat.ts's FLAT_FONTS measures), its faces in the theme's role colours,
17
+ * and each link kind's colour and dash. Unscoped: a page scopes it as it scopes the drawing's (view-css.ts). */
18
+ export declare function flatCss(styles?: Record<string, FlatStyle>): string;
19
+ /** a measure from a page's own rendered text: a hidden 2D svg in `host` (so the view's stylesheet applies), each text
20
+ * measured by getComputedTextLength, remembered */
21
+ export declare function measureIn(host: Element): Measure & {
22
+ dispose(): void;
23
+ };
24
+ /** the rect of a card or panel in a layout */
25
+ export declare const rectOf: (L: FlatLayout, id: string) => FlatRect | undefined;
@@ -0,0 +1,91 @@
1
+ import type { Bin, MetricPoint, MetricRollup, Query, Result, Row, Scope, TimelineEvent, TimelineSource, View, TimelineCatalog, TimelineTypes, AnyTimeline } from './timeline-contract.js';
2
+ import { type Gap, type TimeScale } from './timeline-scale.js';
3
+ export interface TimelineMountOptions<T extends TimelineTypes = AnyTimeline> {
4
+ source: TimelineSource<T>;
5
+ /** the domain's scopes, flags and search links */
6
+ catalog: TimelineCatalog;
7
+ /** classes on the component's root beside its own (the stylesheet it is styled by is scoped to one) */
8
+ rootClass?: string[];
9
+ /** where to start (else the URL's view, else the first host, 1 level down, the last day) */
10
+ view?: Partial<View>;
11
+ /** the owner's time zone (default: the viewer's) */
12
+ tz?: string;
13
+ /** light, dark, or the viewer's (default) */
14
+ theme?: 'light' | 'dark' | 'system';
15
+ /** keep the view in location.hash (#timeline=…) */
16
+ urlState?: boolean;
17
+ /** collapse long empty stretches into time breaks (default true; remembered per view) */
18
+ collapseGaps?: boolean;
19
+ /** animate a time break opening (default: unless the viewer prefers reduced motion) */
20
+ motion?: boolean;
21
+ /** an event's actions, in its detail: a label, and what it does (none: not shown) */
22
+ actions?(e: TimelineEvent<T>): [string, (() => void) | undefined][];
23
+ /** saved views: the host stores them */
24
+ saveView?(v: View): void | Promise<void>;
25
+ views?(): View[] | Promise<View[]>;
26
+ /** the playhead moved: the state recorded there, if any (draw it on a canvas) */
27
+ onPlayhead?(t: number, state: T['state'] | undefined): void;
28
+ /** a recorded state, in words for the canvas's note: when it was observed, and what it belongs to */
29
+ stamp?(state: T['state']): {
30
+ at?: string;
31
+ tag?: string;
32
+ };
33
+ onViewChange?(v: View): void;
34
+ /** an export: the host saves it (else the browser downloads it) */
35
+ onExport?(name: string, text: string, type: string): void;
36
+ }
37
+ type Mode = {
38
+ kind: 'single';
39
+ } | {
40
+ kind: 'binned';
41
+ bin: Bin;
42
+ };
43
+ type Line<T extends TimelineTypes = AnyTimeline> = {
44
+ kind: 'row';
45
+ row: Row<T>;
46
+ } | {
47
+ kind: 'metric';
48
+ series: string;
49
+ unit: string;
50
+ type: 'counter' | 'gauge';
51
+ title: string;
52
+ };
53
+ /** which zoom level a visible span reads at: single events up to a few hours, then minute, hour and day bins */
54
+ export declare function modeFor(span: number, px: number): Mode;
55
+ /** the activity a result shows (for time breaks): marks, span ends, bins with events, metrics that moved */
56
+ export declare function activityOf<T extends TimelineTypes = AnyTimeline>(r: Result<T>, mode: Mode, series?: Map<string, 'counter' | 'gauge'>): [number, number][];
57
+ export declare function mountTimeline<T extends TimelineTypes = AnyTimeline>(el: HTMLElement, o: TimelineMountOptions<T>): {
58
+ el: HTMLElement;
59
+ ready: Promise<void>;
60
+ readonly view: View;
61
+ setView(v: Partial<View>): Promise<void>;
62
+ setRange(t0: number, t1: number): Promise<void>;
63
+ setPlayhead: (t: number | undefined) => Promise<void>;
64
+ setLive: (on: boolean, go?: boolean) => void;
65
+ setTheme: (t?: 'light' | 'dark' | 'system') => void;
66
+ refresh: () => Promise<void>;
67
+ /** for tests and hosts: what is drawn, and the mapping */
68
+ internal: {
69
+ readonly result: Result<T> | undefined;
70
+ readonly mode: Mode;
71
+ readonly scale: TimeScale;
72
+ readonly gaps: Gap[];
73
+ readonly playState: T["state"] | undefined;
74
+ readonly hits: TimelineEvent<T>[];
75
+ readonly selected: TimelineEvent<T> | undefined;
76
+ readonly follow: boolean;
77
+ openCut: (from: number, to: number) => void;
78
+ showTable: (from: number, to: number) => Promise<void>;
79
+ rangeEvents: () => Promise<TimelineEvent<T>[]>;
80
+ exportRange: (kind: 'json' | 'csv') => Promise<void>;
81
+ select: (e: TimelineEvent<T> | undefined) => void;
82
+ stepHit: (dir: 1 | -1) => void;
83
+ drill: (s: Scope) => void;
84
+ findHits: () => Promise<void>;
85
+ paint: () => void;
86
+ lines: () => Line<T>[];
87
+ };
88
+ dispose(): void;
89
+ };
90
+ export type TimelineHandle = ReturnType<typeof mountTimeline>;
91
+ export type { MetricPoint, MetricRollup, Row, Query, Result };
@@ -0,0 +1,31 @@
1
+ export { MIN_ZOOM, viewport, MAX_ZOOM } from './viewport.js';
2
+ export type { View, ViewportOpts, Viewport } from './viewport.js';
3
+ export { CARD, P3, pts, overlayPaint } from './overlay.js';
4
+ export type { Box, Outline, Box3, CardGeo, Glyph, Mark, Ghost, Card, OverlayCtx, OverlayPaint } from './overlay.js';
5
+ export { APPEARS, IDLES, cardMotion } from './card-motion.js';
6
+ export type { Appear, Idle, MotionSettings, CardNames, MotionHost, CardMotion } from './card-motion.js';
7
+ export { n, node, rewrite, prune, cls, attr, extent, unite, fitWithOverlay } from './still.js';
8
+ export { isoVars, scopeSelector, scope } from './view-css.js';
9
+ export { md, stepData, legend, renderPage } from './page.js';
10
+ export type { PageOpts } from './page.js';
11
+ export { h } from './dom.js';
12
+ export { TIMELINE_VERSION, SEGMENT_NAME, SEVERITIES, BINS, BIN_MS, scopePattern } from './timeline-contract.js';
13
+ export type { TimelineTypes, AnyTimeline, Scope, Severity, AttrValue, TimelineEvent, Bin, MetricPoint, MetricRollup, EventBin, Match, AstTerm, SearchAst, Days, Retention, SeriesInfo, KindInfo, SourceInfo, EffectiveRetention, ScopeName, Catalog, Filters, Query, Row, Result, Batch, View as TimelineView, Recording, TimelineSource, TimelineCatalog } from './timeline-contract.js';
14
+ export { scopeRules, escapeName, formatScope, join, levelOf, prefixAt, parentOf, within, hasSegment, kindOf, nameOf, crumbs } from './timeline-scope.js';
15
+ export type { Segment } from './timeline-scope.js';
16
+ export { BASE_FIELDS, readTime, searchFor, rangeOf, highlights, severities } from './timeline-search.js';
17
+ export type { Field, SearchDialect, Term, ParsedSearch, Search } from './timeline-search.js';
18
+ export { offsetAt, isZone, binStart, binNext } from './timeline-time.js';
19
+ export { findGaps, gapLabel, gapKey, timeScale, ticks } from './timeline-scale.js';
20
+ export type { Gap, Cut, TimeScale, Tick } from './timeline-scale.js';
21
+ export { toJSON, toCSV } from './timeline-export.js';
22
+ export { memorySource } from './timeline-engine.js';
23
+ export type { MemorySourceOptions, MemorySource } from './timeline-engine.js';
24
+ export { modeFor, activityOf, mountTimeline } from './history.js';
25
+ export type { TimelineMountOptions, TimelineHandle } from './history.js';
26
+ export { flatSvg, flatCss, measureIn, rectOf } from './flat-view.js';
27
+ export type { FlatStyle } from './flat-view.js';
28
+ export { dualView, storedMode, viewToggle, DUAL_VIEW_CSS } from './dual-view.js';
29
+ export type { ViewMode, DualViewOptions, DualView } from './dual-view.js';
30
+ export { morphSvgs, markConnectors } from './morph.js';
31
+ export type { SvgMorph } from './morph.js';
@@ -0,0 +1,28 @@
1
+ import type { CompiledScene } from '../iso-objects/compile.js';
2
+ import type { Board } from '../iso-objects/flat.js';
3
+ export type ViewMode = '3d' | '2d';
4
+ /** a 3D drawing's connectors marked with the ends they join (data-a, data-b), as the 2D ones are: a board's link may be
5
+ * drawn to a panel, so its ends are the board's when given */
6
+ export declare function markConnectors(svg3: SVGSVGElement, scene: CompiledScene, board?: Board): void;
7
+ /** whether a switch should animate, by the motion option (0.7.3) */
8
+ export declare const morphs: (motion?: 'auto' | 'always' | 'never') => boolean;
9
+ /** A running morph between two drawings already laid out in `root` (positioned): `done` resolves when it ends,
10
+ * `finish()` ends it at once (the layer gone). The caller shows and hides the drawings themselves. */
11
+ export interface SvgMorph {
12
+ readonly done: Promise<void>;
13
+ finish(): void;
14
+ }
15
+ /** The morph dualView runs (0.7.5: for the editor's canvas too), from one view's svg to the other's, over `root`:
16
+ * things move from where they are to where they will be (a 3D top face becoming its 2D card, or back), connectors fade
17
+ * out and draw in. Undefined when the motion option says not to animate (or the duration is 0). */
18
+ export declare function morphSvgs(root: HTMLElement, fromSvg: SVGSVGElement, toSvg: SVGSVGElement, from: ViewMode, o?: {
19
+ duration?: number;
20
+ motion?: 'auto' | 'always' | 'never';
21
+ }): SvgMorph | undefined;
22
+ export declare const clamp: (v: number) => number;
23
+ export declare const ease: (t: number) => number;
24
+ /** the layer a morph draws on: `at(t)` paints it t of the way from one view to the other */
25
+ export declare function buildLayer(root: HTMLElement, fromSvg: SVGSVGElement, toSvg: SVGSVGElement, from: ViewMode): {
26
+ svg: SVGSVGElement;
27
+ at(t: number): void;
28
+ };