@johnoscott/isometric-engine 0.0.0-stage → 0.10.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.
- package/EDITOR-GUIDE.md +355 -0
- package/LICENSE +21 -0
- package/LICENSES/ajv.txt +22 -0
- package/LICENSES/lucide-static.txt +43 -0
- package/LICENSES/yaml.txt +13 -0
- package/README.md +62 -2
- package/assets/app.css +269 -0
- package/assets/default-theme.yaml +99 -0
- package/assets/icons.svg +1 -0
- package/assets/marks.css +39 -0
- package/assets/skin.css +181 -0
- package/iso-editor.d.ts +4 -0
- package/iso-editor.js +550 -0
- package/iso-render.d.ts +3 -0
- package/iso-render.js +388 -0
- package/iso-systems.d.ts +4 -0
- package/iso-systems.js +389 -0
- package/js/iso-core/compile-schema.js +22 -0
- package/js/iso-core/depth.js +55 -0
- package/js/iso-core/errors.js +65 -0
- package/js/iso-core/glyphs.js +100 -0
- package/js/iso-core/index.js +55 -0
- package/js/iso-core/kernel.js +158 -0
- package/js/iso-core/metrics.json +1 -0
- package/js/iso-core/package.json +6 -0
- package/js/iso-core/parse.js +79 -0
- package/js/iso-core/schema-errors.js +170 -0
- package/js/iso-core/shims/crypto.js +125 -0
- package/js/iso-core/shims/path.js +49 -0
- package/js/iso-core/svg-dom.js +144 -0
- package/js/iso-core/theme.js +48 -0
- package/js/iso-core/vdom.js +48 -0
- package/js/iso-editor/adapter.js +0 -0
- package/js/iso-editor/clipboard.js +152 -0
- package/js/iso-editor/commands.js +173 -0
- package/js/iso-editor/complete.js +55 -0
- package/js/iso-editor/doc.js +182 -0
- package/js/iso-editor/index.js +105 -0
- package/js/iso-editor/model.js +210 -0
- package/js/iso-editor/outline.js +111 -0
- package/js/iso-editor/package.json +6 -0
- package/js/iso-editor/path.js +19 -0
- package/js/iso-editor/providers.js +96 -0
- package/js/iso-editor/schema-nav.js +117 -0
- package/js/iso-editor/splice.js +443 -0
- package/js/iso-editor/storage-keys.js +6 -0
- package/js/iso-editor/ui/actions.js +116 -0
- package/js/iso-editor/ui/canvas-layer.js +0 -0
- package/js/iso-editor/ui/canvas.js +1403 -0
- package/js/iso-editor/ui/clip.js +133 -0
- package/js/iso-editor/ui/dialog.js +26 -0
- package/js/iso-editor/ui/flat-canvas.js +54 -0
- package/js/iso-editor/ui/icons.js +15 -0
- package/js/iso-editor/ui/keys.js +26 -0
- package/js/iso-editor/ui/later.js +28 -0
- package/js/iso-editor/ui/layer.js +11 -0
- package/js/iso-editor/ui/menu.js +105 -0
- package/js/iso-editor/ui/monaco-entry.js +2 -0
- package/js/iso-editor/ui/mount-kit.js +0 -0
- package/js/iso-editor/ui/mount.js +767 -0
- package/js/iso-editor/ui/pane.js +0 -0
- package/js/iso-editor/ui/part.js +0 -0
- package/js/iso-editor/ui/plain-icons.js +34 -0
- package/js/iso-editor/ui/props.js +314 -0
- package/js/iso-editor/ui/scope-css.js +81 -0
- package/js/iso-editor/ui/setup.js +149 -0
- package/js/iso-editor/ui/text.js +323 -0
- package/js/iso-editor/ui/tree.js +728 -0
- package/js/iso-editor/validate.js +33 -0
- package/js/iso-editor/window/protocol.js +8 -0
- package/js/iso-objects/assemble.js +43 -0
- package/js/iso-objects/assets.js +88 -0
- package/js/iso-objects/board.js +162 -0
- package/js/iso-objects/compile.js +60 -0
- package/js/iso-objects/css.js +154 -0
- package/js/iso-objects/flat.js +696 -0
- package/js/iso-objects/focus.js +16 -0
- package/js/iso-objects/geometry.js +76 -0
- package/js/iso-objects/index.js +93 -0
- package/js/iso-objects/kinds.js +12 -0
- package/js/iso-objects/labels.js +325 -0
- package/js/iso-objects/package.json +6 -0
- package/js/iso-objects/place.js +347 -0
- package/js/iso-objects/route.js +461 -0
- package/js/iso-objects/scene.js +350 -0
- package/js/iso-objects/steps.js +246 -0
- package/js/iso-objects/types.js +0 -0
- package/js/iso-systems/catalog.js +42 -0
- package/js/iso-systems/compile.js +34 -0
- package/js/iso-systems/css.js +8 -0
- package/js/iso-systems/index.js +16 -0
- package/js/iso-systems/nodes.js +124 -0
- package/js/iso-systems/package.json +6 -0
- package/js/iso-systems/schema.json +311 -0
- package/js/iso-systems/validate.js +35 -0
- package/js/iso-viewer/bundle.js +20 -0
- package/js/iso-viewer/card-motion.js +228 -0
- package/js/iso-viewer/dom.js +14 -0
- package/js/iso-viewer/dual-view.js +212 -0
- package/js/iso-viewer/flat-view.js +124 -0
- package/js/iso-viewer/history.js +990 -0
- package/js/iso-viewer/index.js +98 -0
- package/js/iso-viewer/morph.js +192 -0
- package/js/iso-viewer/overlay.js +199 -0
- package/js/iso-viewer/package.json +6 -0
- package/js/iso-viewer/page.js +138 -0
- package/js/iso-viewer/player.js +409 -0
- package/js/iso-viewer/still.js +81 -0
- package/js/iso-viewer/timeline-contract.js +14 -0
- package/js/iso-viewer/timeline-engine.js +475 -0
- package/js/iso-viewer/timeline-export.js +36 -0
- package/js/iso-viewer/timeline-scale.js +116 -0
- package/js/iso-viewer/timeline-scope.js +58 -0
- package/js/iso-viewer/timeline-search.js +216 -0
- package/js/iso-viewer/timeline-time.js +55 -0
- package/js/iso-viewer/view-css.js +68 -0
- package/js/iso-viewer/viewport.js +177 -0
- package/package.json +511 -4
- package/src/iso-core/compile-schema.ts +23 -0
- package/src/iso-core/depth.ts +56 -0
- package/src/iso-core/errors.ts +73 -0
- package/src/iso-core/glyphs.ts +108 -0
- package/src/iso-core/index.ts +27 -0
- package/src/iso-core/kernel.ts +163 -0
- package/src/iso-core/metrics.json +1 -0
- package/src/iso-core/package.json +6 -0
- package/src/iso-core/parse.ts +91 -0
- package/src/iso-core/schema-errors.ts +163 -0
- package/src/iso-core/shims/crypto.ts +37 -0
- package/src/iso-core/shims/path.ts +24 -0
- package/src/iso-core/svg-dom.ts +103 -0
- package/src/iso-core/theme.ts +64 -0
- package/src/iso-core/vdom.ts +41 -0
- package/src/iso-editor/adapter.ts +147 -0
- package/src/iso-editor/clipboard.ts +163 -0
- package/src/iso-editor/commands.ts +191 -0
- package/src/iso-editor/complete.ts +73 -0
- package/src/iso-editor/doc.ts +207 -0
- package/src/iso-editor/index.ts +67 -0
- package/src/iso-editor/model.ts +234 -0
- package/src/iso-editor/outline.ts +126 -0
- package/src/iso-editor/package.json +6 -0
- package/src/iso-editor/path.ts +18 -0
- package/src/iso-editor/providers.ts +113 -0
- package/src/iso-editor/schema-nav.ts +129 -0
- package/src/iso-editor/splice.ts +477 -0
- package/src/iso-editor/storage-keys.ts +6 -0
- package/src/iso-editor/ui/actions.ts +119 -0
- package/src/iso-editor/ui/app.css +230 -0
- package/src/iso-editor/ui/canvas-layer.ts +56 -0
- package/src/iso-editor/ui/canvas.ts +1227 -0
- package/src/iso-editor/ui/clip.ts +97 -0
- package/src/iso-editor/ui/dialog.ts +25 -0
- package/src/iso-editor/ui/flat-canvas.ts +51 -0
- package/src/iso-editor/ui/icons.ts +21 -0
- package/src/iso-editor/ui/keys.ts +30 -0
- package/src/iso-editor/ui/later.ts +22 -0
- package/src/iso-editor/ui/layer.ts +7 -0
- package/src/iso-editor/ui/marks.css +39 -0
- package/src/iso-editor/ui/menu.ts +67 -0
- package/src/iso-editor/ui/monaco-entry.ts +6 -0
- package/src/iso-editor/ui/mount-kit.ts +35 -0
- package/src/iso-editor/ui/mount.ts +684 -0
- package/src/iso-editor/ui/pane.ts +45 -0
- package/src/iso-editor/ui/part.ts +45 -0
- package/src/iso-editor/ui/plain-icons.ts +83 -0
- package/src/iso-editor/ui/props.ts +347 -0
- package/src/iso-editor/ui/scope-css.ts +65 -0
- package/src/iso-editor/ui/setup.ts +153 -0
- package/src/iso-editor/ui/skin.css +181 -0
- package/src/iso-editor/ui/text.ts +262 -0
- package/src/iso-editor/ui/tree.ts +657 -0
- package/src/iso-editor/validate.ts +62 -0
- package/src/iso-editor/window/protocol.ts +33 -0
- package/src/iso-objects/assemble.ts +57 -0
- package/src/iso-objects/assets.ts +122 -0
- package/src/iso-objects/board.ts +169 -0
- package/src/iso-objects/compile.ts +76 -0
- package/src/iso-objects/css.ts +163 -0
- package/src/iso-objects/flat.ts +653 -0
- package/src/iso-objects/focus.ts +14 -0
- package/src/iso-objects/geometry.ts +86 -0
- package/src/iso-objects/index.ts +33 -0
- package/src/iso-objects/kinds.ts +56 -0
- package/src/iso-objects/labels.ts +310 -0
- package/src/iso-objects/package.json +6 -0
- package/src/iso-objects/place.ts +318 -0
- package/src/iso-objects/route.ts +444 -0
- package/src/iso-objects/scene.ts +376 -0
- package/src/iso-objects/steps.ts +234 -0
- package/src/iso-objects/types.ts +68 -0
- package/src/iso-systems/catalog.ts +31 -0
- package/src/iso-systems/compile.ts +39 -0
- package/src/iso-systems/css.ts +9 -0
- package/src/iso-systems/index.ts +12 -0
- package/src/iso-systems/nodes.ts +126 -0
- package/src/iso-systems/package.json +6 -0
- package/src/iso-systems/schema.json +311 -0
- package/src/iso-systems/validate.ts +34 -0
- package/src/iso-viewer/bundle.ts +15 -0
- package/src/iso-viewer/card-motion.ts +237 -0
- package/src/iso-viewer/dom.ts +13 -0
- package/src/iso-viewer/dual-view.ts +212 -0
- package/src/iso-viewer/flat-view.ts +127 -0
- package/src/iso-viewer/history.ts +781 -0
- package/src/iso-viewer/index.ts +40 -0
- package/src/iso-viewer/morph.ts +191 -0
- package/src/iso-viewer/overlay.ts +212 -0
- package/src/iso-viewer/package.json +6 -0
- package/src/iso-viewer/page.ts +150 -0
- package/src/iso-viewer/player.ts +321 -0
- package/src/iso-viewer/still.ts +74 -0
- package/src/iso-viewer/timeline-contract.ts +342 -0
- package/src/iso-viewer/timeline-engine.ts +420 -0
- package/src/iso-viewer/timeline-export.ts +31 -0
- package/src/iso-viewer/timeline-scale.ts +129 -0
- package/src/iso-viewer/timeline-scope.ts +56 -0
- package/src/iso-viewer/timeline-search.ts +198 -0
- package/src/iso-viewer/timeline-time.ts +54 -0
- package/src/iso-viewer/view-css.ts +59 -0
- package/src/iso-viewer/viewport.ts +142 -0
- package/types/iso-core/compile-schema.d.ts +11 -0
- package/types/iso-core/depth.d.ts +6 -0
- package/types/iso-core/errors.d.ts +24 -0
- package/types/iso-core/glyphs.d.ts +19 -0
- package/types/iso-core/index.d.ts +17 -0
- package/types/iso-core/kernel.d.ts +130 -0
- package/types/iso-core/metrics.json +1 -0
- package/types/iso-core/parse.d.ts +18 -0
- package/types/iso-core/schema-errors.d.ts +14 -0
- package/types/iso-core/shims/crypto.d.ts +9 -0
- package/types/iso-core/svg-dom.d.ts +15 -0
- package/types/iso-core/theme.d.ts +38 -0
- package/types/iso-core/vdom.d.ts +26 -0
- package/types/iso-editor/adapter.d.ts +178 -0
- package/types/iso-editor/clipboard.d.ts +23 -0
- package/types/iso-editor/commands.d.ts +32 -0
- package/types/iso-editor/complete.d.ts +25 -0
- package/types/iso-editor/doc.d.ts +50 -0
- package/types/iso-editor/index.d.ts +57 -0
- package/types/iso-editor/model.d.ts +96 -0
- package/types/iso-editor/outline.d.ts +28 -0
- package/types/iso-editor/path.d.ts +7 -0
- package/types/iso-editor/providers.d.ts +43 -0
- package/types/iso-editor/schema-nav.d.ts +34 -0
- package/types/iso-editor/splice.d.ts +53 -0
- package/types/iso-editor/storage-keys.d.ts +5 -0
- package/types/iso-editor/ui/actions.d.ts +23 -0
- package/types/iso-editor/ui/canvas-layer.d.ts +65 -0
- package/types/iso-editor/ui/canvas.d.ts +307 -0
- package/types/iso-editor/ui/clip.d.ts +14 -0
- package/types/iso-editor/ui/dialog.d.ts +7 -0
- package/types/iso-editor/ui/flat-canvas.d.ts +2 -0
- package/types/iso-editor/ui/icons.d.ts +5 -0
- package/types/iso-editor/ui/keys.d.ts +7 -0
- package/types/iso-editor/ui/later.d.ts +12 -0
- package/types/iso-editor/ui/layer.d.ts +2 -0
- package/types/iso-editor/ui/menu.d.ts +21 -0
- package/types/iso-editor/ui/mount-kit.d.ts +31 -0
- package/types/iso-editor/ui/mount.d.ts +146 -0
- package/types/iso-editor/ui/pane.d.ts +60 -0
- package/types/iso-editor/ui/part.d.ts +40 -0
- package/types/iso-editor/ui/plain-icons.d.ts +10 -0
- package/types/iso-editor/ui/props.d.ts +57 -0
- package/types/iso-editor/ui/scope-css.d.ts +5 -0
- package/types/iso-editor/ui/setup.d.ts +49 -0
- package/types/iso-editor/ui/text.d.ts +19 -0
- package/types/iso-editor/ui/tree.d.ts +100 -0
- package/types/iso-editor/validate.d.ts +36 -0
- package/types/iso-editor/window/protocol.d.ts +60 -0
- package/types/iso-objects/assemble.d.ts +35 -0
- package/types/iso-objects/assets.d.ts +49 -0
- package/types/iso-objects/board.d.ts +36 -0
- package/types/iso-objects/compile.d.ts +35 -0
- package/types/iso-objects/css.d.ts +16 -0
- package/types/iso-objects/flat.d.ts +130 -0
- package/types/iso-objects/focus.d.ts +1 -0
- package/types/iso-objects/geometry.d.ts +59 -0
- package/types/iso-objects/index.d.ts +26 -0
- package/types/iso-objects/kinds.d.ts +53 -0
- package/types/iso-objects/labels.d.ts +92 -0
- package/types/iso-objects/place.d.ts +25 -0
- package/types/iso-objects/route.d.ts +67 -0
- package/types/iso-objects/scene.d.ts +63 -0
- package/types/iso-objects/steps.d.ts +90 -0
- package/types/iso-objects/types.d.ts +140 -0
- package/types/iso-systems/catalog.d.ts +4 -0
- package/types/iso-systems/compile.d.ts +6 -0
- package/types/iso-systems/css.d.ts +3 -0
- package/types/iso-systems/index.d.ts +5 -0
- package/types/iso-systems/nodes.d.ts +3 -0
- package/types/iso-viewer/card-motion.d.ts +56 -0
- package/types/iso-viewer/dom.d.ts +1 -0
- package/types/iso-viewer/dual-view.d.ts +44 -0
- package/types/iso-viewer/flat-view.d.ts +25 -0
- package/types/iso-viewer/history.d.ts +91 -0
- package/types/iso-viewer/index.d.ts +31 -0
- package/types/iso-viewer/morph.d.ts +28 -0
- package/types/iso-viewer/overlay.d.ts +135 -0
- package/types/iso-viewer/page.d.ts +13 -0
- package/types/iso-viewer/still.d.ts +26 -0
- package/types/iso-viewer/timeline-contract.d.ts +345 -0
- package/types/iso-viewer/timeline-engine.d.ts +20 -0
- package/types/iso-viewer/timeline-export.d.ts +5 -0
- package/types/iso-viewer/timeline-scale.d.ts +44 -0
- package/types/iso-viewer/timeline-scope.d.ts +33 -0
- package/types/iso-viewer/timeline-search.d.ts +52 -0
- package/types/iso-viewer/timeline-time.d.ts +8 -0
- package/types/iso-viewer/view-css.d.ts +7 -0
- package/types/iso-viewer/viewport.d.ts +50 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { EditorDoc } from "./doc.js";
|
|
2
|
+
import { fromPointer } from "./path.js";
|
|
3
|
+
function analyse(a, text, opts) {
|
|
4
|
+
const d = new EditorDoc(text);
|
|
5
|
+
const r = a.read(text, { fileName: opts.fileName, defaults: opts.defaults, profiles: opts.profiles, role: a.role(text) });
|
|
6
|
+
const all = [...opts.extendsDiags ?? [], ...r.diags];
|
|
7
|
+
return { problems: all.map((x) => place(a, d, x, opts.fileName)), tags: r.tags ?? /* @__PURE__ */ new Map(), read: r.read };
|
|
8
|
+
}
|
|
9
|
+
function place(a, d, x, fileName) {
|
|
10
|
+
const base = { severity: x.severity, message: x.message, hint: x.hint, path: x.path };
|
|
11
|
+
if (x.file && x.file !== fileName) {
|
|
12
|
+
const r2 = d.rangeOf(["extends"]) ?? [0, 0];
|
|
13
|
+
const a2 = d.pos(r2[0]), b = d.pos(r2[1]);
|
|
14
|
+
return { ...base, message: `${x.file}:${x.line}: ${x.message}`, file: x.file, startLine: a2.line, startCol: a2.col, endLine: b.line, endCol: b.col };
|
|
15
|
+
}
|
|
16
|
+
const path = fromPointer(x.path);
|
|
17
|
+
const whole = a.objectOf(x.path)?.path === x.path;
|
|
18
|
+
const r = path.length ? d.rangeOf(path, whole || a.keyMessage.test(x.message) ? "key" : "value") : void 0;
|
|
19
|
+
if (r && r[1] > r[0]) {
|
|
20
|
+
const nl = d.text.indexOf("\n", r[0]);
|
|
21
|
+
const end = nl >= 0 && nl < r[1] ? nl : r[1];
|
|
22
|
+
const a2 = d.pos(r[0]), b = d.pos(Math.max(end, r[0] + 1));
|
|
23
|
+
return { ...base, startLine: a2.line, startCol: a2.col, endLine: b.line, endCol: b.col };
|
|
24
|
+
}
|
|
25
|
+
const line = Math.max(1, x.line), col = Math.max(1, x.col);
|
|
26
|
+
const off = d.offset(line, col);
|
|
27
|
+
const m = /^[^\s,:{}[\]]+/.exec(d.text.slice(off));
|
|
28
|
+
return { ...base, startLine: line, startCol: col, endLine: line, endCol: col + Math.max(1, m ? m[0].length : 1) };
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
analyse,
|
|
32
|
+
place
|
|
33
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { polyBounds, silhouette } from "./labels.js";
|
|
2
|
+
const MARGIN = 24;
|
|
3
|
+
function offscreen(b, vb) {
|
|
4
|
+
const [vx, vy, vw, vh] = vb, cx = b.x + b.w / 2, cy = b.y + b.h / 2;
|
|
5
|
+
const d = [["left", cx - vx], ["right", vx + vw - cx], ["top", cy - vy], ["bottom", vy + vh - cy]];
|
|
6
|
+
d.sort((p, q) => p[1] - q[1]);
|
|
7
|
+
const edge = d[0][0];
|
|
8
|
+
if (edge === "left") return { edge, dx: -(b.x + b.w - vx) - MARGIN, dy: 0 };
|
|
9
|
+
if (edge === "right") return { edge, dx: vx + vw - b.x + MARGIN, dy: 0 };
|
|
10
|
+
if (edge === "top") return { edge, dx: 0, dy: -(b.y + b.h - vy) - MARGIN };
|
|
11
|
+
return { edge, dx: 0, dy: vy + vh - b.y + MARGIN };
|
|
12
|
+
}
|
|
13
|
+
function assembly(layout, routes, vb) {
|
|
14
|
+
const depth = (p) => {
|
|
15
|
+
let d = 0;
|
|
16
|
+
for (let a = p.parent; a; a = a.parent) d++;
|
|
17
|
+
return d;
|
|
18
|
+
};
|
|
19
|
+
const key = (p) => p.box.x0 + p.box.y0 + p.box.z0 * 0.01;
|
|
20
|
+
const regions = layout.items.filter((p) => p.type === "region").sort((a, b) => depth(a) - depth(b) || key(a) - key(b));
|
|
21
|
+
const nodes = layout.items.filter((p) => p.type === "node").sort((a, b) => key(a) - key(b) || a.box.z0 - b.box.z0);
|
|
22
|
+
const pieces = [];
|
|
23
|
+
const rStep = Math.min(90, 400 / Math.max(1, regions.length)), rDur = 650;
|
|
24
|
+
regions.forEach((p, i) => {
|
|
25
|
+
const bbox = polyBounds(silhouette(p.box));
|
|
26
|
+
pieces.push({ id: p.id, kind: "region", ...offscreen(bbox, vb), delay: Math.round(i * rStep), dur: rDur, bbox });
|
|
27
|
+
});
|
|
28
|
+
const nStart = 250 + Math.round(rStep * regions.length), nStep = Math.min(70, 700 / Math.max(1, nodes.length)), nDur = 600;
|
|
29
|
+
nodes.forEach((p, i) => {
|
|
30
|
+
const bbox = polyBounds(silhouette(p.box));
|
|
31
|
+
pieces.push({ id: p.id, kind: "node", ...offscreen(bbox, vb), delay: Math.round(nStart + i * nStep), dur: nDur, bbox });
|
|
32
|
+
});
|
|
33
|
+
const lastNode = nodes.length ? nStart + (nodes.length - 1) * nStep : nStart;
|
|
34
|
+
const rtStart = Math.round(lastNode + 300), rtStep = Math.min(30, 300 / Math.max(1, routes.length)), rtDur = 400;
|
|
35
|
+
const rts = routes.filter((r) => r.points.length >= 2).map((r, i) => ({ id: r.id, delay: Math.round(rtStart + i * rtStep), dur: rtDur }));
|
|
36
|
+
const labels = { delay: rtStart + 200, dur: 400 };
|
|
37
|
+
const total = Math.max(...pieces.map((p) => p.delay + p.dur), ...rts.map((r) => r.delay + r.dur), labels.delay + labels.dur);
|
|
38
|
+
return { pieces, routes: rts, labels, total };
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
assembly,
|
|
42
|
+
offscreen
|
|
43
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { iso, tag, S, C, center } from "../iso-core/kernel.js";
|
|
2
|
+
import * as D from "../iso-core/glyphs.js";
|
|
3
|
+
const ICONS = /* @__PURE__ */ Object.create(null);
|
|
4
|
+
const CSS = [];
|
|
5
|
+
function registerMarks(marks) {
|
|
6
|
+
Object.assign(ICONS, marks.icons ?? {});
|
|
7
|
+
Object.assign(D.screenFaces, marks.faces ?? {});
|
|
8
|
+
if (marks.css && !CSS.includes(marks.css)) CSS.push(marks.css);
|
|
9
|
+
}
|
|
10
|
+
const markCss = () => CSS.join("");
|
|
11
|
+
const iconPainter = (name) => Object.hasOwn(ICONS, name) ? ICONS[name] : void 0;
|
|
12
|
+
const facePainter = (name) => Object.hasOwn(D.screenFaces, name) ? D.screenFaces[name] : void 0;
|
|
13
|
+
function placeholderIcon(k, b) {
|
|
14
|
+
const cx = (b.x0 + b.x1) / 2, cy = (b.y0 + b.y1) / 2, z = b.z1 + 5e-3, r = Math.min(0.6, (b.x1 - b.x0) * 0.24, (b.y1 - b.y0) * 0.24);
|
|
15
|
+
const q = [[cx - r, cy - r, z], [cx + r, cy - r, z], [cx + r, cy + r, z], [cx - r, cy + r, z]];
|
|
16
|
+
return k.poly(q, "ico-unknown") + k.line3([cx - r * 0.3, cy - r * 0.35, z], [cx + r * 0.3, cy - r * 0.35, z], "ico-unknown-q") + k.line3([cx + r * 0.3, cy - r * 0.35, z], [cx, cy + r * 0.1, z], "ico-unknown-q") + k.line3([cx, cy + r * 0.45, z], [cx, cy + r * 0.5, z], "ico-unknown-q");
|
|
17
|
+
}
|
|
18
|
+
function drawDecos(k, b, decos) {
|
|
19
|
+
let s = "";
|
|
20
|
+
for (const d of decos ?? []) {
|
|
21
|
+
if (d === "terminal") s += D.termLines(k, b, 3);
|
|
22
|
+
else if (d === "envelope") s += D.envelope(k, b);
|
|
23
|
+
else if (d === "bubble") s += D.bubble(k, b);
|
|
24
|
+
else if (d === "file-lines") s += D.fileLines(k, b);
|
|
25
|
+
else if (typeof d === "object") {
|
|
26
|
+
if (d.terminal) s += D.termLines(k, b, d.terminal);
|
|
27
|
+
if (d.icon) s += (iconPainter(d.icon) ?? placeholderIcon)(k, b);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return s;
|
|
31
|
+
}
|
|
32
|
+
const decosOf = (n, a) => (n.deco ?? a.deco ?? []).filter((d) => d !== "ghost");
|
|
33
|
+
function boxAsset(name, description, size, role, deco, extra) {
|
|
34
|
+
const a = {
|
|
35
|
+
name,
|
|
36
|
+
description,
|
|
37
|
+
size,
|
|
38
|
+
role,
|
|
39
|
+
deco,
|
|
40
|
+
draw: (k, b, n) => k.blockFaces(b) + drawDecos(k, b, decosOf(n, a)) + (extra ? extra(k, b) : "")
|
|
41
|
+
};
|
|
42
|
+
return a;
|
|
43
|
+
}
|
|
44
|
+
function plate(b) {
|
|
45
|
+
const [cx, cy] = center(b);
|
|
46
|
+
return { x0: cx - 0.75, y0: cy - 0.75, x1: cx + 0.75, y1: cy + 0.75, z0: b.z0, z1: b.z0 + 0.18 };
|
|
47
|
+
}
|
|
48
|
+
function cloudPath(w, h) {
|
|
49
|
+
const r = Math.max(8, Math.min(w, h) * 0.18), ins = r * 0.55;
|
|
50
|
+
const x0 = ins, y0 = ins, x1 = w - ins, y1 = h - ins;
|
|
51
|
+
const edge = (ax, ay, bx, by) => {
|
|
52
|
+
const len = Math.hypot(bx - ax, by - ay), n = Math.max(1, Math.round(len / (r * 1.7)));
|
|
53
|
+
let d = "";
|
|
54
|
+
for (let i = 1; i <= n; i++) {
|
|
55
|
+
const x = ax + (bx - ax) * i / n, y = ay + (by - ay) * i / n, rr = len / n / 2 * 1.08;
|
|
56
|
+
d += ` A${rr.toFixed(1)},${rr.toFixed(1)} 0 0 1 ${x.toFixed(1)},${y.toFixed(1)}`;
|
|
57
|
+
}
|
|
58
|
+
return d;
|
|
59
|
+
};
|
|
60
|
+
return `M${x0.toFixed(1)},${y0.toFixed(1)}` + edge(x0, y0, x1, y0) + edge(x1, y0, x1, y1) + edge(x1, y1, x0, y1) + edge(x0, y1, x0, y0) + "Z";
|
|
61
|
+
}
|
|
62
|
+
function drawCloud(k, b) {
|
|
63
|
+
const top = { ...b, z0: b.z1 };
|
|
64
|
+
const f = (z) => {
|
|
65
|
+
const [X, Y] = iso(b.x0, b.y0, z);
|
|
66
|
+
return [C, 0.5, -C, 0.5, X, Y];
|
|
67
|
+
};
|
|
68
|
+
const w = (b.x1 - b.x0) * S, h = (b.y1 - b.y0) * S, d = cloudPath(w, h);
|
|
69
|
+
void top;
|
|
70
|
+
return k.onMatrix(f(b.z0), w, h, () => tag("path", { d, class: "lft cloud-side" })) + k.onMatrix(f(b.z1), w, h, () => tag("path", { d, class: "top cloud-top" }));
|
|
71
|
+
}
|
|
72
|
+
function defaultLabel(b, hasSub) {
|
|
73
|
+
const [X, Y] = iso((b.x0 + b.x1) / 2, (b.y0 + b.y1) / 2, b.z1 + 0.75);
|
|
74
|
+
return { x: X, y: Y - 18 + (hasSub ? 0 : 6), anchor: "middle" };
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
boxAsset,
|
|
78
|
+
cloudPath,
|
|
79
|
+
defaultLabel,
|
|
80
|
+
drawCloud,
|
|
81
|
+
drawDecos,
|
|
82
|
+
facePainter,
|
|
83
|
+
iconPainter,
|
|
84
|
+
markCss,
|
|
85
|
+
placeholderIcon,
|
|
86
|
+
plate,
|
|
87
|
+
registerMarks
|
|
88
|
+
};
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { FONTS } from "../iso-core/kernel.js";
|
|
2
|
+
import { nodeKindOr, regionKind } from "./kinds.js";
|
|
3
|
+
import { parseEnd } from "./route.js";
|
|
4
|
+
import { placeBoard } from "./flat.js";
|
|
5
|
+
function boardOf(scene, visible = () => true) {
|
|
6
|
+
const items = scene.layout.items.filter((p) => visible(p.id));
|
|
7
|
+
const cat = scene.layout.catalog;
|
|
8
|
+
const isCard = (p) => p.type === "node" && !p.children.some((c) => c.type === "node" && visible(c.id));
|
|
9
|
+
const cardsP = items.filter(isCard);
|
|
10
|
+
const line = (p) => {
|
|
11
|
+
const a = [];
|
|
12
|
+
for (let q = p; q; q = q.parent) a.unshift(q);
|
|
13
|
+
return a;
|
|
14
|
+
};
|
|
15
|
+
const lines = new Map(cardsP.map((p) => [p.id, line(p)]));
|
|
16
|
+
const parted = (q, p) => {
|
|
17
|
+
const A = lines.get(q.id), B = lines.get(p.id);
|
|
18
|
+
let i = 0;
|
|
19
|
+
while (i < A.length && i < B.length && A[i] === B[i]) i++;
|
|
20
|
+
return [A[i].box, B[i].box];
|
|
21
|
+
};
|
|
22
|
+
const e = 1e-6;
|
|
23
|
+
const above = (q, p) => {
|
|
24
|
+
const [a, b] = parted(q, p);
|
|
25
|
+
return a.y1 <= b.y0 + e && a.x0 < b.x1 - e && b.x0 < a.x1 - e;
|
|
26
|
+
};
|
|
27
|
+
const leftOf = (q, p) => {
|
|
28
|
+
const [a, b] = parted(q, p);
|
|
29
|
+
return a.x1 <= b.x0 + e && a.y0 < b.y1 - e && b.y0 < a.y1 - e;
|
|
30
|
+
};
|
|
31
|
+
const longest = (rel, key) => {
|
|
32
|
+
const out = /* @__PURE__ */ new Map(), done = [];
|
|
33
|
+
for (const p of [...cardsP].sort((a, b) => key(a) - key(b))) {
|
|
34
|
+
let r = 0;
|
|
35
|
+
for (const q of done) if (out.get(q.id) + 1 > r && rel(q, p)) r = out.get(q.id) + 1;
|
|
36
|
+
out.set(p.id, r);
|
|
37
|
+
done.push(p);
|
|
38
|
+
}
|
|
39
|
+
return out;
|
|
40
|
+
};
|
|
41
|
+
const rowOf = longest(above, (p) => p.box.y0), colOf = longest(leftOf, (p) => p.box.x0);
|
|
42
|
+
const tolX = Math.min(...cardsP.map((p) => p.box.x1 - p.box.x0)) / 2;
|
|
43
|
+
for (const p of cardsP) if (!p.parent) {
|
|
44
|
+
for (const q of cardsP) if (q.parent && q.box.x0 <= p.box.x0 + tolX) colOf.set(p.id, Math.max(colOf.get(p.id), colOf.get(q.id)));
|
|
45
|
+
}
|
|
46
|
+
const cell = /* @__PURE__ */ new Map();
|
|
47
|
+
for (const p of cardsP) cell.set(p.id, [colOf.get(p.id), rowOf.get(p.id)]);
|
|
48
|
+
const taken = /* @__PURE__ */ new Map();
|
|
49
|
+
for (const p of cardsP) {
|
|
50
|
+
const c = cell.get(p.id);
|
|
51
|
+
const was = taken.get(String(c));
|
|
52
|
+
if (was !== void 0 && was !== p.id) {
|
|
53
|
+
for (const [, k] of cell) if (k[0] > c[0] && k !== c) k[0]++;
|
|
54
|
+
c[0]++;
|
|
55
|
+
taken.clear();
|
|
56
|
+
for (const q of cardsP) taken.set(String(cell.get(q.id)), q.id);
|
|
57
|
+
} else taken.set(String(c), p.id);
|
|
58
|
+
}
|
|
59
|
+
const cards = cardsP.map((p) => {
|
|
60
|
+
const n = p.node, a = nodeKindOr(cat, n.asset);
|
|
61
|
+
return { id: p.id, label: n.label ?? p.id, sub: n.sub, role: n.role ?? a.role, ghost: n.ghost || void 0, cell: cell.get(p.id) };
|
|
62
|
+
});
|
|
63
|
+
const panels = [];
|
|
64
|
+
for (const p of items) {
|
|
65
|
+
if (isCard(p)) continue;
|
|
66
|
+
const inner = [];
|
|
67
|
+
const walk = (q) => {
|
|
68
|
+
for (const c of q.children) {
|
|
69
|
+
const k = cell.get(c.id);
|
|
70
|
+
if (k) inner.push(k);
|
|
71
|
+
walk(c);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
walk(p);
|
|
75
|
+
if (!inner.length) continue;
|
|
76
|
+
const xs = inner.map((k) => k[0]), ys = inner.map((k) => k[1]);
|
|
77
|
+
const label = p.type === "region" ? p.region.label : p.node.label ?? p.id;
|
|
78
|
+
const role = p.type === "region" ? p.region.role ?? regionKind(cat, p.region.kind)?.role : p.node.role ?? nodeKindOr(cat, p.node.asset).role;
|
|
79
|
+
panels.push({ id: p.id, label, sub: p.type === "node" ? p.node.sub : void 0, role, cells: [Math.min(...xs), Math.min(...ys), Math.max(...xs), Math.max(...ys)] });
|
|
80
|
+
}
|
|
81
|
+
const ends = /* @__PURE__ */ new Set([...cards.map((c) => c.id), ...panels.map((p) => p.id)]);
|
|
82
|
+
const links = [];
|
|
83
|
+
for (const r of scene.routes) {
|
|
84
|
+
if (!visible(r.id)) continue;
|
|
85
|
+
const a = parseEnd(r.raw.from).id, b = parseEnd(r.raw.to).id;
|
|
86
|
+
if (!ends.has(a) || !ends.has(b)) continue;
|
|
87
|
+
const label = typeof r.raw.label === "string" ? r.raw.label : r.raw.label?.text;
|
|
88
|
+
links.push({ id: r.id, a, b, kind: r.kind, label });
|
|
89
|
+
}
|
|
90
|
+
return { cards, panels, links };
|
|
91
|
+
}
|
|
92
|
+
const BOARD_3D = { W: 4, D: 2, H: 0.9, GX: 2, GY: 2.4, PAD: 0.6, CH: 2.2, PANEL_H: 0.3 };
|
|
93
|
+
const BOARD_CSS = `
|
|
94
|
+
.blk .card-name{font-size:13px;font-weight:600;fill:var(--ink)}
|
|
95
|
+
.blk .card-sub{font-size:10px;fill:var(--ink);opacity:.75}
|
|
96
|
+
.blk.ghost .card-name,.blk.ghost .card-sub{fill:var(--muted)}
|
|
97
|
+
`;
|
|
98
|
+
function cardAsset(text) {
|
|
99
|
+
return {
|
|
100
|
+
name: "card",
|
|
101
|
+
description: "A card: a slab with its name on its front face",
|
|
102
|
+
size: [BOARD_3D.W, BOARD_3D.D, BOARD_3D.H],
|
|
103
|
+
role: "grey",
|
|
104
|
+
draw(k, b, n) {
|
|
105
|
+
const t = text(n.id);
|
|
106
|
+
let s = k.blockFaces(b);
|
|
107
|
+
if (!t) return s;
|
|
108
|
+
const h = b.z1 - b.z0;
|
|
109
|
+
s += k.faceText(b.x0 + 0.2, b.y1, b.z0 + (t.sub ? h * 0.52 : h * 0.34), t.label, "card-name", FONTS.lbl, "left", "start");
|
|
110
|
+
if (t.sub) s += k.faceText(b.x0 + 0.2, b.y1, b.z0 + h * 0.14, t.sub, "card-sub", FONTS.sub, "left", "start");
|
|
111
|
+
return s;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function boardCatalog(board) {
|
|
116
|
+
const text = new Map(board.cards.map((c) => [c.id, { label: c.label, sub: c.sub }]));
|
|
117
|
+
return {
|
|
118
|
+
regions: { panel: { shape: "slab", pad: BOARD_3D.PAD, z: [BOARD_3D.PANEL_H, 0], floor: true, role: "grey", labelStyle: "floor" } },
|
|
119
|
+
nodes: { card: cardAsset((id) => text.get(id)) },
|
|
120
|
+
defaultNode: "card"
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function boardDiagram(board, opts = {}) {
|
|
124
|
+
const g = BOARD_3D;
|
|
125
|
+
const { prect, parentIx, cardAt } = placeBoard(board, { W: g.W, H: g.D, GX: g.GX, GY: g.GY, PAD: g.PAD, TITLE: 0, CH: g.CH });
|
|
126
|
+
const PL = board.panels ?? [];
|
|
127
|
+
const r1 = (v) => Math.round(v * 1e3) / 1e3;
|
|
128
|
+
const area = (p) => (p.cells[2] - p.cells[0] + 1) * (p.cells[3] - p.cells[1] + 1);
|
|
129
|
+
const holder = (c) => {
|
|
130
|
+
let best = -1;
|
|
131
|
+
PL.forEach((p, n) => {
|
|
132
|
+
const k = p.cells;
|
|
133
|
+
if (c.cell[0] >= k[0] && c.cell[0] <= k[2] && c.cell[1] >= k[1] && c.cell[1] <= k[3] && (best < 0 || area(p) <= area(PL[best]))) best = n;
|
|
134
|
+
});
|
|
135
|
+
return best;
|
|
136
|
+
};
|
|
137
|
+
const regions = PL.map((p, n) => {
|
|
138
|
+
const r = prect[n], par = parentIx[n] >= 0 ? prect[parentIx[n]] : { l: 0, t: 0 };
|
|
139
|
+
return { id: p.id, kind: "panel", label: p.label, role: p.role, at: [r1(r.l - par.l), r1(r.t - par.t)], size: [r1(r.r - r.l), r1(r.b - r.t)], regions: [], nodes: [] };
|
|
140
|
+
});
|
|
141
|
+
const top = [], topNodes = [];
|
|
142
|
+
regions.forEach((r, n) => parentIx[n] >= 0 ? regions[parentIx[n]].regions.push(r) : top.push(r));
|
|
143
|
+
for (const c of board.cards) {
|
|
144
|
+
const [x, y] = cardAt(board.cards.indexOf(c)), h = holder(c), par = h >= 0 ? prect[h] : { l: 0, t: 0 };
|
|
145
|
+
const node = { id: c.id, asset: "card", role: c.role, ghost: c.ghost || void 0, at: [r1(x - par.l), r1(y - par.t)], size: [g.W, g.D, g.H] };
|
|
146
|
+
(h >= 0 ? regions[h].nodes : topNodes).push(node);
|
|
147
|
+
}
|
|
148
|
+
for (const r of regions) {
|
|
149
|
+
if (!r.regions.length) delete r.regions;
|
|
150
|
+
if (!r.nodes.length) delete r.nodes;
|
|
151
|
+
}
|
|
152
|
+
const routes = (board.links ?? []).map((l, i) => ({ id: l.id ?? `link-${i}`, from: l.aOn ?? l.a, to: l.bOn ?? l.b, kind: l.kind, label: l.label }));
|
|
153
|
+
return { isodiag: 1, title: opts.title, kinds: opts.kinds, roles: opts.roles, scenes: [{ id: "board", title: opts.title ?? "board", regions: top, nodes: topNodes, routes }] };
|
|
154
|
+
}
|
|
155
|
+
export {
|
|
156
|
+
BOARD_3D,
|
|
157
|
+
BOARD_CSS,
|
|
158
|
+
boardCatalog,
|
|
159
|
+
boardDiagram,
|
|
160
|
+
boardOf,
|
|
161
|
+
cardAsset
|
|
162
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { place } from "./place.js";
|
|
2
|
+
import { renderScene } from "./scene.js";
|
|
3
|
+
import { routeAll } from "./route.js";
|
|
4
|
+
import { resolveSteps } from "./steps.js";
|
|
5
|
+
import { extendTheme, loadTheme } from "../iso-core/theme.js";
|
|
6
|
+
import { nodeKindOr } from "./kinds.js";
|
|
7
|
+
import { facePainter, iconPainter } from "./assets.js";
|
|
8
|
+
const noSource = (data) => ({ data, locate: () => ({ line: 0, col: 0 }), span: () => void 0, diags: [] });
|
|
9
|
+
function compileRaw(doc, themeText, catalog, parsed = noSource(doc), source, opts = {}, diags = []) {
|
|
10
|
+
const theme = extendTheme(loadTheme(themeText), doc.roles, doc.kinds);
|
|
11
|
+
const scenes = [];
|
|
12
|
+
const sceneIds = /* @__PURE__ */ new Map();
|
|
13
|
+
doc.scenes.forEach((raw, i) => {
|
|
14
|
+
const path = `/scenes/${i}`;
|
|
15
|
+
if (sceneIds.has(raw.id)) {
|
|
16
|
+
const p = parsed.locate(path + "/id");
|
|
17
|
+
diags.push({ severity: "error", message: `duplicate scene id "${raw.id}"`, line: p.line, col: p.col, path: path + "/id" });
|
|
18
|
+
}
|
|
19
|
+
sceneIds.set(raw.id, i);
|
|
20
|
+
const grid = { ...doc.grid, ...raw.grid, ...opts.snap ? { snap: opts.snap } : {} };
|
|
21
|
+
const layout = place(raw, path, parsed, theme, catalog, doc.roles, grid.snap);
|
|
22
|
+
diags.push(...layout.diags);
|
|
23
|
+
const routed = routeAll(raw, path, layout, parsed, new Set(Object.keys(theme.kinds)), grid.snap);
|
|
24
|
+
diags.push(...routed.diags);
|
|
25
|
+
const steps = resolveSteps(raw, path, layout, routed.routes, parsed, theme);
|
|
26
|
+
diags.push(...steps.diags);
|
|
27
|
+
diags.push(...unknownMarks(raw, path, catalog, parsed));
|
|
28
|
+
const rendered = renderScene({ scene: raw, layout, routes: routed.routes, steps, theme, id: raw.id, gridStep: grid.step ?? grid.snap ?? 1 });
|
|
29
|
+
for (const w of rendered.warnings) {
|
|
30
|
+
const p = parsed.locate(w.path);
|
|
31
|
+
diags.push({ severity: "warning", message: w.message, line: p.line, col: p.col, path: w.path });
|
|
32
|
+
}
|
|
33
|
+
scenes.push({ id: raw.id, raw, layout, routes: routed.routes, steps, rendered, grid, assemble: raw.assemble ?? doc.assemble ?? false });
|
|
34
|
+
});
|
|
35
|
+
diags.sort((a, b) => a.line - b.line || a.col - b.col);
|
|
36
|
+
return { ok: !diags.some((d) => d.severity === "error"), diags, doc, theme, catalog, scenes, parsed, source };
|
|
37
|
+
}
|
|
38
|
+
function unknownMarks(scene, path, catalog, parsed) {
|
|
39
|
+
const out = [];
|
|
40
|
+
const warn = (at, message) => {
|
|
41
|
+
const p = parsed.locate(at);
|
|
42
|
+
out.push({ severity: "warning", message, line: p.line, col: p.col, path: at });
|
|
43
|
+
};
|
|
44
|
+
const walk = (holder, at) => {
|
|
45
|
+
holder.nodes?.forEach((n, j) => {
|
|
46
|
+
const np = `${at}/nodes/${j}`;
|
|
47
|
+
(n.deco ?? nodeKindOr(catalog, n.asset).deco ?? []).forEach((d, i) => {
|
|
48
|
+
if (typeof d === "object" && d.icon && !iconPainter(d.icon)) warn(n.deco ? `${np}/deco/${i}/icon` : np, `node "${n.id}": no icon "${d.icon}" is registered here, so it is drawn as a placeholder`);
|
|
49
|
+
});
|
|
50
|
+
if (n.face !== void 0 && !facePainter(n.face)) warn(`${np}/face`, `node "${n.id}": no screen face "${n.face}" is registered here, so it is drawn as a placeholder`);
|
|
51
|
+
});
|
|
52
|
+
holder.regions?.forEach((r, i) => walk(r, `${at}/regions/${i}`));
|
|
53
|
+
};
|
|
54
|
+
walk(scene, path);
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
compileRaw,
|
|
59
|
+
noSource
|
|
60
|
+
};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { kindsCss } from "./kinds.js";
|
|
2
|
+
import { markCss } from "./assets.js";
|
|
3
|
+
const PAGE_CSS = `
|
|
4
|
+
*{box-sizing:border-box}
|
|
5
|
+
html,body{margin:0}
|
|
6
|
+
body{background:var(--bg);color:var(--ink);font:15px/1.55 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;-webkit-font-smoothing:antialiased;overflow-x:hidden}
|
|
7
|
+
code,pre,.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
|
|
8
|
+
code{font-size:.92em;background:var(--code-bg);padding:1px 5px;border-radius:5px;overflow-wrap:anywhere}
|
|
9
|
+
.wrap{max-width:1180px;margin:0 auto;padding:32px 16px 64px}
|
|
10
|
+
header.page{display:flex;flex-wrap:wrap;gap:12px 24px;align-items:flex-end;justify-content:space-between;margin-bottom:8px}
|
|
11
|
+
h1{font-size:clamp(24px,4vw,34px);line-height:1.15;margin:0;letter-spacing:-.01em}
|
|
12
|
+
.lede{color:var(--muted);max-width:76ch;margin:8px 0 0}
|
|
13
|
+
.pills{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
|
|
14
|
+
.pill{display:inline-block;font-size:12px;font-weight:600;padding:3px 10px;border-radius:99px;border:1px solid var(--line);color:var(--muted);background:var(--surface)}
|
|
15
|
+
.theme{font:inherit;font-size:12px;border:1px solid var(--line);background:var(--surface);color:var(--muted);border-radius:99px;padding:3px 10px;cursor:pointer}
|
|
16
|
+
h2{font-size:20px;margin:44px 0 4px;letter-spacing:-.005em;text-wrap:balance}
|
|
17
|
+
.sec-sub{color:var(--muted);margin:0 0 14px;font-size:14px;max-width:84ch}
|
|
18
|
+
.figure{background:var(--surface);border:1px solid var(--line);border-radius:16px;margin:12px 0 10px;overflow:hidden}
|
|
19
|
+
.scroller{overflow-x:auto;-webkit-overflow-scrolling:touch}
|
|
20
|
+
.scroller svg{display:block;width:100%;min-width:720px;height:auto}
|
|
21
|
+
.legend{display:flex;flex-wrap:wrap;gap:6px 18px;padding:10px 18px;border-top:1px solid var(--line);font-size:12.5px;color:var(--muted)}
|
|
22
|
+
.legend:empty{display:none}
|
|
23
|
+
.legend span{display:inline-flex;align-items:center;gap:8px}
|
|
24
|
+
.legend i{display:inline-block;width:26px;height:0;border-top:3px solid}
|
|
25
|
+
.legend i.box{height:10px;border-width:1.5px;border-style:solid;border-radius:2px}
|
|
26
|
+
footer{margin-top:40px;font-size:12.5px;color:var(--muted)}
|
|
27
|
+
`;
|
|
28
|
+
const drawingCss = (cat) => DRAWING_CSS_A + kindsCss(cat) + DRAWING_CSS_B + markCss();
|
|
29
|
+
const DRAWING_CSS_A = `
|
|
30
|
+
/* blocks: hue per role, lightness per face and theme */
|
|
31
|
+
.blk .top{fill:hsl(var(--h) var(--s) var(--l-top))}
|
|
32
|
+
.blk .lft{fill:hsl(var(--h) var(--s) var(--l-left))}
|
|
33
|
+
.blk .rgt{fill:hsl(var(--h) var(--s) var(--l-right))}
|
|
34
|
+
.blk polygon,.blk path.top,.blk path.lft{stroke:hsl(var(--h) var(--s) var(--l-edge));stroke-width:.8;stroke-linejoin:round}
|
|
35
|
+
.blk .det{stroke:hsl(var(--h) var(--s) var(--l-edge));stroke-width:1.4;fill:none;stroke-linecap:round;opacity:.7}
|
|
36
|
+
.k-slab .top{fill:var(--slab-top)} .k-slab .lft{fill:var(--slab-l)} .k-slab .rgt{fill:var(--slab-r)}
|
|
37
|
+
.k-pad .top{fill:var(--pad-top)}
|
|
38
|
+
.wall polygon{fill-opacity:.34}
|
|
39
|
+
.zone polygon{fill:hsl(var(--h) var(--s) 50% / .12);stroke:hsl(var(--h) var(--s) 45% / .55);stroke-dasharray:5 4;stroke-width:1.2}
|
|
40
|
+
.ghost polygon{fill:transparent!important;stroke:var(--muted);stroke-dasharray:4 4;stroke-width:1.2}
|
|
41
|
+
.ghost .det{opacity:.45}
|
|
42
|
+
.blk polygon.ico-unknown{fill:none;stroke:hsl(var(--h) var(--s) var(--l-edge));stroke-width:1.2;stroke-dasharray:3 2.5}
|
|
43
|
+
.blk .ico-unknown-q{stroke:hsl(var(--h) var(--s) var(--l-edge));stroke-width:1.6;stroke-linecap:round;fill:none}
|
|
44
|
+
.blk polygon.sock-hole{fill:hsl(var(--h) var(--s) 18%);opacity:.8}
|
|
45
|
+
.scr .t{fill:#1d1f27;stroke:#3a3b44;stroke-width:.6}
|
|
46
|
+
.scr .ln{stroke:#8fd3b0;stroke-width:1.2;stroke-linecap:round}
|
|
47
|
+
.scr .bar{fill:#2a2c36}
|
|
48
|
+
.scr .win{fill:#e9e9ee}
|
|
49
|
+
.scr .wall{fill:#3b5bbd}
|
|
50
|
+
.scr .glass{fill:#0d0e12;stroke:#3a3b44;stroke-width:1}
|
|
51
|
+
.scr .w{fill:#f4f4f2}
|
|
52
|
+
.scr .d{fill:#0b0b0d}
|
|
53
|
+
.scr .m{fill:#3a3934}
|
|
54
|
+
.scr .unk{fill:none;stroke:#8a8d99;stroke-width:1;stroke-dasharray:3 2.5}
|
|
55
|
+
.scr .unk-q{fill:none;stroke:#8a8d99;stroke-width:1.4;stroke-linecap:round}
|
|
56
|
+
.scr .unk-dot{fill:#8a8d99}
|
|
57
|
+
.orb .ball{fill:url(#orbG);stroke:#8a8b93;stroke-width:.8}
|
|
58
|
+
.orb .shade{fill:#000;opacity:.18}
|
|
59
|
+
.orb .eye{fill:#0b0b0d}
|
|
60
|
+
.person .body{fill:hsl(var(--h) var(--s) var(--l-left));stroke:hsl(var(--h) var(--s) var(--l-edge));stroke-width:.8}
|
|
61
|
+
.person .head{fill:hsl(var(--h) var(--s) var(--l-top));stroke:hsl(var(--h) var(--s) var(--l-edge));stroke-width:.8}
|
|
62
|
+
|
|
63
|
+
/* text */
|
|
64
|
+
.lbl{font-size:13px;font-weight:700;fill:var(--ink);paint-order:stroke;stroke:var(--surface);stroke-width:4px;stroke-linejoin:round}
|
|
65
|
+
.sub{font-size:11px;fill:var(--muted);font-weight:400;paint-order:stroke;stroke:var(--surface);stroke-width:4px;stroke-linejoin:round}
|
|
66
|
+
.floor{font-size:11px;font-weight:600;letter-spacing:.01em}
|
|
67
|
+
.floor.t-control{fill:var(--muted)}
|
|
68
|
+
.slabname{font-size:15px;font-weight:800;fill:var(--muted);letter-spacing:.12em;opacity:.8}
|
|
69
|
+
.slabname.sm{font-size:10.5px;letter-spacing:.1em;opacity:1}
|
|
70
|
+
`;
|
|
71
|
+
const DRAWING_CSS_B = `.tunnel polygon{fill:hsl(205 85% 55% / .17);stroke:hsl(205 75% 45% / .8);stroke-width:1.3;stroke-linejoin:round}
|
|
72
|
+
.tunnel .top{fill:hsl(205 85% 65% / .22)}
|
|
73
|
+
.tunnel .rib{fill:none;stroke:hsl(205 75% 45% / .5);stroke-width:1}
|
|
74
|
+
.tunname{font-size:12px;font-weight:800;letter-spacing:.14em;fill:var(--tunnel-text);paint-order:stroke;stroke:var(--surface);stroke-width:3px;stroke-linejoin:round}
|
|
75
|
+
|
|
76
|
+
/* flows */
|
|
77
|
+
.flow{fill:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
|
|
78
|
+
`;
|
|
79
|
+
const baseCss = (cat) => PAGE_CSS + drawingCss(cat);
|
|
80
|
+
const MARKS_CSS = `
|
|
81
|
+
/* step marks */
|
|
82
|
+
.xm circle{fill:var(--surface);stroke:var(--blocked);stroke-width:2.5}
|
|
83
|
+
.xm path{stroke:var(--blocked);stroke-width:3;stroke-linecap:round}
|
|
84
|
+
.say rect{fill:var(--surface);stroke-width:1.5}
|
|
85
|
+
.say text{font-size:12px;font-weight:600}
|
|
86
|
+
.badge{cursor:pointer}
|
|
87
|
+
.badge circle{fill:var(--c);stroke:var(--surface);stroke-width:2.5}
|
|
88
|
+
.badge text{font-size:11.5px;font-weight:800;fill:var(--on);text-anchor:middle;dominant-baseline:central;pointer-events:none}
|
|
89
|
+
.tok{stroke:var(--surface);stroke-width:2.5}
|
|
90
|
+
.pulse{fill:none;stroke-width:2.5;transform-box:fill-box;transform-origin:center;animation:pulse 1.5s ease-out infinite}
|
|
91
|
+
@keyframes pulse{from{transform:scale(.35);opacity:.95}to{transform:scale(1.5);opacity:0}}
|
|
92
|
+
.sub{stroke-width:5px}
|
|
93
|
+
|
|
94
|
+
/* step focus: what a step does not touch dims; things that appear later are hidden */
|
|
95
|
+
[data-hl],[data-id],[data-step]{transition:opacity .25s}
|
|
96
|
+
svg.focus [data-hl]:not(.hl){opacity:.12}
|
|
97
|
+
svg.focus.dim-all [data-dim]:not(.hl){opacity:.14}
|
|
98
|
+
svg.focus .badge:not(.on){opacity:.14}
|
|
99
|
+
svg.all .badge{opacity:1}
|
|
100
|
+
svg.focus.all [data-hl]:not(.hl),svg.focus.all.dim-all [data-dim]:not(.hl){opacity:.9}
|
|
101
|
+
svg [data-step]:not(.on),svg.all [data-step]{opacity:0!important;pointer-events:none}
|
|
102
|
+
.pre{opacity:0!important;pointer-events:none}
|
|
103
|
+
`;
|
|
104
|
+
const PLAYER_UI_CSS = `
|
|
105
|
+
/* player */
|
|
106
|
+
.player{display:flex;align-items:flex-start;gap:10px 14px;padding:12px 16px;border-top:1px solid var(--line);flex-wrap:wrap}
|
|
107
|
+
.ctrls{display:flex;gap:6px;flex:none}
|
|
108
|
+
.pbtn{font:inherit;font-size:13px;font-weight:700;display:inline-flex;align-items:center;gap:6px;border:1px solid var(--line);background:var(--bg);color:var(--ink);border-radius:99px;padding:6px 14px;cursor:pointer}
|
|
109
|
+
.pbtn.icon{padding:6px 11px}
|
|
110
|
+
.pbtn:hover{border-color:var(--muted)}
|
|
111
|
+
.pbtn:disabled{opacity:.6;cursor:default}
|
|
112
|
+
.pbtn.primary{background:var(--ink);color:var(--surface);border-color:var(--ink);min-width:92px;justify-content:center}
|
|
113
|
+
.pbtn:focus-visible,.dot:focus-visible,.badge:focus-visible{outline:2px solid var(--send);outline-offset:2px}
|
|
114
|
+
.cap{flex:1 1 360px;min-width:0}
|
|
115
|
+
.cap-h{font-size:14.5px;font-weight:700;display:flex;align-items:center;gap:8px}
|
|
116
|
+
.cap-h .cnt{margin-left:auto;font-weight:500;color:var(--muted);font-size:12px;white-space:nowrap}
|
|
117
|
+
.num{flex:none;display:inline-grid;place-items:center;width:22px;height:22px;border-radius:50%;background:var(--c,var(--control));color:var(--on);font-size:11px;font-weight:800}
|
|
118
|
+
.cap-t{font-size:13.5px;color:var(--ink);margin:4px 0 0;max-width:92ch;min-height:3.1em}
|
|
119
|
+
.cap-c{margin:8px 0 0;background:var(--code-bg);border-radius:8px;padding:7px 10px;font-size:12px;line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere;max-height:9.5em;overflow-y:auto;color:var(--ink)}
|
|
120
|
+
.cap-c:empty{display:none}
|
|
121
|
+
.prog{height:3px;background:var(--line);border-radius:3px;overflow:hidden;margin-top:9px}
|
|
122
|
+
.prog i{display:block;height:100%;width:0;background:var(--c,var(--ink))}
|
|
123
|
+
.dots{display:flex;gap:5px;flex-wrap:wrap;flex-basis:100%;padding-left:2px;order:4}
|
|
124
|
+
.dot{width:10px;height:10px;border-radius:50%;background:var(--line);border:0;padding:0;cursor:pointer}
|
|
125
|
+
.dot.on{background:var(--ink)} .dot.done{background:var(--muted)}
|
|
126
|
+
details.steps{margin:0 0 8px;font-size:13.5px}
|
|
127
|
+
details.steps summary{cursor:pointer;color:var(--muted);font-size:13px}
|
|
128
|
+
details.steps ol{margin:8px 0 0;padding-left:22px;max-width:92ch}
|
|
129
|
+
details.steps li{margin:6px 0}
|
|
130
|
+
details.steps li code{font-size:11.5px}
|
|
131
|
+
@media (prefers-reduced-motion:reduce){.pulse{animation:none;opacity:.8}}
|
|
132
|
+
@media (max-width:560px){.cap{flex-basis:100%}}
|
|
133
|
+
.still .pulse{animation:none;opacity:.85}
|
|
134
|
+
.still *,.still *::before{transition:none!important}
|
|
135
|
+
.still .prog{display:none}
|
|
136
|
+
.still .ctrls,.still .tools{display:none}
|
|
137
|
+
.tools{display:flex;gap:6px;flex:none;order:3;margin-left:auto}
|
|
138
|
+
.pbtn.small{font-size:12px;padding:4px 11px;font-weight:600;color:var(--muted)}
|
|
139
|
+
.pbtn.small[aria-pressed="true"]{color:var(--ink);border-color:var(--muted);background:var(--surface)}`;
|
|
140
|
+
const GRID_CSS = `
|
|
141
|
+
.grid{display:none;fill:none;stroke:var(--ink);stroke-width:.6;opacity:.16;pointer-events:none}
|
|
142
|
+
svg.show-grid .grid{display:inline}
|
|
143
|
+
svg.pre-assemble > g:not(.g-anim){opacity:0}
|
|
144
|
+
`;
|
|
145
|
+
const PLAYER_CSS = MARKS_CSS + PLAYER_UI_CSS + GRID_CSS;
|
|
146
|
+
export {
|
|
147
|
+
GRID_CSS,
|
|
148
|
+
MARKS_CSS,
|
|
149
|
+
PAGE_CSS,
|
|
150
|
+
PLAYER_CSS,
|
|
151
|
+
PLAYER_UI_CSS,
|
|
152
|
+
baseCss,
|
|
153
|
+
drawingCss
|
|
154
|
+
};
|