@entro314labs/iso-engine 0.5.0 → 0.5.2
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/README.md +14 -14
- package/dist/engine/index.d.ts +2 -2
- package/dist/engine/index.js +1 -1
- package/dist/figure.d.ts +1 -1
- package/dist/figure.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/iso.global.js +1 -1
- package/dist/types.d.ts +2 -2
- package/package.json +1 -1
- package/skills/iso-engine/SKILL.md +13 -13
- package/skills/iso-engine/examples/engine.html +1 -1
- package/skills/iso-engine/examples/figure.html +4 -4
- package/skills/iso-engine/examples/loop.html +4 -4
- package/skills/iso-engine/examples/loop.js +2 -2
- package/skills/iso-engine/examples/matcher.js +2 -2
- package/skills/iso-engine/examples/spec.html +1 -1
- package/skills/iso-engine/references/api.md +1 -1
- package/skills/iso-engine/references/figures.md +5 -5
- package/skills/iso-engine/references/loops.md +2 -2
- package/skills/iso-engine/references/style.md +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @entro314labs/iso-engine
|
|
2
2
|
|
|
3
3
|
Interactive isometric figures and autoplaying isometric animations in plain SVG. No framework, no canvas, no
|
|
4
4
|
dependencies.
|
|
@@ -6,18 +6,18 @@ dependencies.
|
|
|
6
6
|
- **Figures**: a small projection kernel (`createKernel`) that turns boxes, planes and face detail into SVG. It comes
|
|
7
7
|
with interaction patterns (tweens, zoom, signal sequences, callouts), a glow kit for lit state, and `mountFigure`,
|
|
8
8
|
which runs a figure in any element.
|
|
9
|
-
- **Engine** (`@
|
|
9
|
+
- **Engine** (`@entro314labs/iso-engine/engine`): the Iso engine. It handles scenes, depth sorting that re-sorts moving parts,
|
|
10
10
|
seekable timelines, travel/drawOn/assemble presets, diagram routing, 35 prefabs (devices, servers, buildings,
|
|
11
11
|
trucks…) and SVG/PNG export.
|
|
12
|
-
- **Loops** (`@
|
|
12
|
+
- **Loops** (`@entro314labs/iso-engine/loops`): helpers for autoplaying engine animations that narrate their beats, with a poster
|
|
13
13
|
frame for reduced motion.
|
|
14
14
|
|
|
15
|
-
See it in use: the [Iso Figures gallery](https://github.com/
|
|
15
|
+
See it in use: the [Iso Figures gallery](https://github.com/entro314-labs/iso-figures) is built on this package.
|
|
16
16
|
|
|
17
17
|
## Install
|
|
18
18
|
|
|
19
19
|
```sh
|
|
20
|
-
pnpm add @
|
|
20
|
+
pnpm add @entro314labs/iso-engine # or npm i @entro314labs/iso-engine
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
Everything is ESM with TypeScript types. Importing is safe during server-side rendering, because the DOM is only
|
|
@@ -28,8 +28,8 @@ touched when you mount something. Mount from client code.
|
|
|
28
28
|
Load the tokens, then the shared figure classes:
|
|
29
29
|
|
|
30
30
|
```js
|
|
31
|
-
import '@
|
|
32
|
-
import '@
|
|
31
|
+
import '@entro314labs/iso-engine/theme.css'; // colour tokens, light and dark (optional: define them yourself)
|
|
32
|
+
import '@entro314labs/iso-engine/figure.css'; // .face, .part, .press, .flow, glow kit, host and stage sizing
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
`theme.css` defines `--page --panel --edge --body --deck --glass --line --detail --live --ink --accent --accent-hi
|
|
@@ -41,7 +41,7 @@ figure, set `--accent` / `--accent-hi` on any of its ancestors.
|
|
|
41
41
|
A figure is an object with a `mount(ctx)` that draws into an empty `<svg>` and reports its state through `readout`:
|
|
42
42
|
|
|
43
43
|
```ts
|
|
44
|
-
import { createKernel, frame, mountFigure, type Figure } from '@
|
|
44
|
+
import { createKernel, frame, mountFigure, type Figure } from '@entro314labs/iso-engine';
|
|
45
45
|
|
|
46
46
|
const lamp: Figure = {
|
|
47
47
|
id: 'lamp',
|
|
@@ -90,7 +90,7 @@ Kernel axes: +x runs down-right, +y down-left, +z up. `box(x, y, z, w, d, h, r?)
|
|
|
90
90
|
## The engine
|
|
91
91
|
|
|
92
92
|
```ts
|
|
93
|
-
import Iso from '@
|
|
93
|
+
import Iso from '@entro314labs/iso-engine/engine';
|
|
94
94
|
|
|
95
95
|
const s = Iso.scene('#app', { theme: 'dark', label: 'A laptop talking to a server' });
|
|
96
96
|
s.add('platform', { size: [240, 180] });
|
|
@@ -106,7 +106,7 @@ With `theme: 'inherit'` a scene takes `--bg` / `--fg` from its host. Inside a `[
|
|
|
106
106
|
Without a bundler, use the classic script, which defines `window.Iso`:
|
|
107
107
|
|
|
108
108
|
```html
|
|
109
|
-
<script src="https://unpkg.com/@
|
|
109
|
+
<script src="https://unpkg.com/@entro314labs/iso-engine/dist/iso.global.js"></script>
|
|
110
110
|
```
|
|
111
111
|
|
|
112
112
|
## Loops
|
|
@@ -114,7 +114,7 @@ Without a bundler, use the classic script, which defines `window.Iso`:
|
|
|
114
114
|
A loop is an engine scene that autoplays a short story and narrates its beats. The host decides when it plays.
|
|
115
115
|
|
|
116
116
|
```ts
|
|
117
|
-
import { beats, loopScene, narrate, type Loop } from '@
|
|
117
|
+
import { beats, loopScene, narrate, type Loop } from '@entro314labs/iso-engine/loops';
|
|
118
118
|
|
|
119
119
|
const loop: Loop = {
|
|
120
120
|
id: 'hello', project: 'Demo', kind: 'flow', name: 'Hello', aria: 'A card lifts and lands.',
|
|
@@ -145,10 +145,10 @@ follows the installed version:
|
|
|
145
145
|
|
|
146
146
|
```sh
|
|
147
147
|
mkdir -p .claude/skills
|
|
148
|
-
ln -s ../../node_modules/@
|
|
148
|
+
ln -s ../../node_modules/@entro314labs/iso-engine/skills/iso-engine .claude/skills/iso-engine
|
|
149
149
|
```
|
|
150
150
|
|
|
151
|
-
The examples load the package's own `dist/`; serve `node_modules/@
|
|
151
|
+
The examples load the package's own `dist/`; serve `node_modules/@entro314labs/iso-engine` over http to open them
|
|
152
152
|
(`skills/iso-engine/examples/figure.html`, `loop.html`, `engine.html`, `spec.html`).
|
|
153
153
|
|
|
154
154
|
## Content Security Policy
|
|
@@ -157,7 +157,7 @@ The engine and `mountFigure` add `<style>` elements at runtime, which a CSP with
|
|
|
157
157
|
blocks. Under a strict CSP:
|
|
158
158
|
|
|
159
159
|
- Link the engine's styles statically, keeping this id. The engine sees it and skips its own injection:
|
|
160
|
-
`<link id="iso-engine-css" rel="stylesheet" href="…/node_modules/@
|
|
160
|
+
`<link id="iso-engine-css" rel="stylesheet" href="…/node_modules/@entro314labs/iso-engine/dist/engine.css">`.
|
|
161
161
|
- Leave `css` off your figure objects and put those rules in your own stylesheet.
|
|
162
162
|
|
|
163
163
|
## Licence
|
package/dist/engine/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Types for the Iso engine (`@
|
|
2
|
+
* Types for the Iso engine (`@entro314labs/iso-engine/engine`). They follow the API reference
|
|
3
3
|
* (skills/iso-engine/references/api.md in this package). Primitive and prefab options stay open
|
|
4
4
|
* records, as in the engine: each type reads its own options (see the reference's Primitives and prefabs.md).
|
|
5
5
|
*/
|
|
@@ -257,7 +257,7 @@ export interface IsoNamespace {
|
|
|
257
257
|
readonly MATERIALS: Readonly<Record<string, unknown>>;
|
|
258
258
|
/** Just the caption frame, without a scene. */
|
|
259
259
|
figure(host: string | Element, opts?: { theme?: ThemeName; index?: string; title?: string; hint?: string; status?: string; maxWidth?: number | string; class?: string }): FigureFrame;
|
|
260
|
-
/** The engine's stylesheet as text (also shipped as `@
|
|
260
|
+
/** The engine's stylesheet as text (also shipped as `@entro314labs/iso-engine/engine.css`). */
|
|
261
261
|
css(): string;
|
|
262
262
|
/** Add the engine's stylesheet to `doc` once; skipped when an element with id `iso-engine-css` is already there. */
|
|
263
263
|
injectCSS(doc?: Document | null): void;
|
package/dist/engine/index.js
CHANGED
package/dist/figure.d.ts
CHANGED
|
@@ -17,6 +17,6 @@ export interface MountedFigure {
|
|
|
17
17
|
* Mount `f` into `host`: install the glow filters and the figure's scoped css (once per document), mark the host
|
|
18
18
|
* `data-fig="<id>"` so that css applies, put an empty, focusable `<svg class="stage">` in it and call `f.mount` with a
|
|
19
19
|
* context whose timers, frames and power haze are all cleared by `destroy()`. The host should be sized (the stage
|
|
20
|
-
* fills it) and the page should load `@
|
|
20
|
+
* fills it) and the page should load `@entro314labs/iso-engine/theme.css` (or define its tokens) and `@entro314labs/iso-engine/figure.css`.
|
|
21
21
|
*/
|
|
22
22
|
export declare function mountFigure(host: HTMLElement, f: Figure, opts?: MountFigureOptions): MountedFigure;
|
package/dist/figure.js
CHANGED
|
@@ -4,7 +4,7 @@ const SVGNS = 'http://www.w3.org/2000/svg';
|
|
|
4
4
|
* Mount `f` into `host`: install the glow filters and the figure's scoped css (once per document), mark the host
|
|
5
5
|
* `data-fig="<id>"` so that css applies, put an empty, focusable `<svg class="stage">` in it and call `f.mount` with a
|
|
6
6
|
* context whose timers, frames and power haze are all cleared by `destroy()`. The host should be sized (the stage
|
|
7
|
-
* fills it) and the page should load `@
|
|
7
|
+
* fills it) and the page should load `@entro314labs/iso-engine/theme.css` (or define its tokens) and `@entro314labs/iso-engine/figure.css`.
|
|
8
8
|
*/
|
|
9
9
|
export function mountFigure(host, f, opts = {}) {
|
|
10
10
|
const doc = host.ownerDocument;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @
|
|
3
|
-
* and `mountFigure`. The animation engine is `@
|
|
2
|
+
* @entro314labs/iso-engine: interactive isometric figures. The projection kernel, the interaction patterns, the figure contract
|
|
3
|
+
* and `mountFigure`. The animation engine is `@entro314labs/iso-engine/engine`; loop helpers are `@entro314labs/iso-engine/loops`.
|
|
4
4
|
*/
|
|
5
5
|
export * from './kernel.js';
|
|
6
6
|
export * from './patterns.js';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @
|
|
3
|
-
* and `mountFigure`. The animation engine is `@
|
|
2
|
+
* @entro314labs/iso-engine: interactive isometric figures. The projection kernel, the interaction patterns, the figure contract
|
|
3
|
+
* and `mountFigure`. The animation engine is `@entro314labs/iso-engine/engine`; loop helpers are `@entro314labs/iso-engine/loops`.
|
|
4
4
|
*/
|
|
5
5
|
export * from './kernel.js';
|
|
6
6
|
export * from './patterns.js';
|
package/dist/iso.global.js
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export interface FigureHandle {
|
|
|
39
39
|
/**
|
|
40
40
|
* An interactive isometric figure drawn with the kernel. `css` is figure-specific styling and must be scoped under
|
|
41
41
|
* `[data-fig="<id>"]`; the shared classes (.face, .detail, .press, .part, .flow, .cut, .hud …) live in
|
|
42
|
-
* `@
|
|
42
|
+
* `@entro314labs/iso-engine/figure.css`.
|
|
43
43
|
*/
|
|
44
44
|
export interface Figure {
|
|
45
45
|
/** Unique id and css scope, kebab-case. */
|
|
@@ -70,7 +70,7 @@ export interface LoopHandle {
|
|
|
70
70
|
destroy?(): void;
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
|
-
* One autoplaying animation built on the Iso engine (`@
|
|
73
|
+
* One autoplaying animation built on the Iso engine (`@entro314labs/iso-engine/engine`). `css` is scoped under
|
|
74
74
|
* `[data-loop="<id>"]`.
|
|
75
75
|
*/
|
|
76
76
|
export interface Loop {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entro314labs/iso-engine",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Interactive isometric figures and autoplaying isometric animations in plain SVG: a projection kernel, interaction patterns, a glow kit and the Iso animation engine. No framework, no canvas, zero dependencies.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Dominikos Pritis",
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: iso-engine
|
|
3
|
-
description: Make isometric line-art illustrations, interactive figures, diagrams and autoplaying animations in plain SVG with the @
|
|
4
|
-
compatibility: Runs in any modern browser. Apps import the @
|
|
3
|
+
description: Make isometric line-art illustrations, interactive figures, diagrams and autoplaying animations in plain SVG with the @entro314labs/iso-engine package — a projection kernel for pressable figures, the Iso engine (depth sorting, timelines, diagrams, 35 prefabs such as devices, servers, buildings and trucks) and loop helpers for animations that narrate their beats. Use it whenever someone wants an isometric drawing, a 3D-looking technical illustration, an isometric architecture or system diagram, an interactive product figure, or an animated hero or explainer for a site, even if they never say the word isometric.
|
|
4
|
+
compatibility: Runs in any modern browser. Apps import the @entro314labs/iso-engine npm package (ES modules with types); pages without a bundler load dist/iso.global.js (the engine as window.Iso) or the ES modules through an import map. No other dependencies.
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Isometric figures and animations
|
|
8
8
|
|
|
9
9
|
Calm technical line drawings in true isometric: 1px hairlines, fills a hair off the background, legible in dark and
|
|
10
10
|
light, and one accent that glows on whatever is live. Everything is plain SVG, with no canvas and no framework. This
|
|
11
|
-
skill ships inside the `@
|
|
11
|
+
skill ships inside the `@entro314labs/iso-engine` package, so its references match the installed version.
|
|
12
12
|
|
|
13
13
|
## Pick the form
|
|
14
14
|
|
|
@@ -17,7 +17,7 @@ skill ships inside the `@entro314-labs/iso-engine` package, so its references ma
|
|
|
17
17
|
| **Interactive figure** | The viewer explores an object: presses parts, picks layers, walks a route, and gets real output | the kernel (`createKernel`) + `mountFigure`, or the engine inside the same contract | `references/figures.md`, `examples/matcher.js` |
|
|
18
18
|
| **Illustration or diorama** | A drawing of a place, product or system; motion is optional | the engine: `Iso.scene`, prefabs, primitives | `references/api.md`, `prefabs.md`, `composition.md`, `examples/engine.html` |
|
|
19
19
|
| **Diagram** | Nodes, edges, zones, packets: an architecture, a pipeline, a workflow | the engine's `diagram` builder, or a JSON spec | `references/diagrams.md`, `spec.md`, `examples/spec.html` |
|
|
20
|
-
| **Autoplaying loop** | It plays by itself: a feature working, a process step by step, a hero or explainer | the engine + `@
|
|
20
|
+
| **Autoplaying loop** | It plays by itself: a feature working, a process step by step, a hero or explainer | the engine + `@entro314labs/iso-engine/loops` | `references/loops.md`, `animation.md`, `examples/loop.js` |
|
|
21
21
|
|
|
22
22
|
Build what was asked, and the number of pieces that was asked. Read `references/style.md` before your first drawing.
|
|
23
23
|
|
|
@@ -26,23 +26,23 @@ Build what was asked, and the number of pieces that was asked. Read `references/
|
|
|
26
26
|
In an app (any framework; mount from client code, the imports are safe during server-side rendering):
|
|
27
27
|
|
|
28
28
|
```sh
|
|
29
|
-
npm i @
|
|
29
|
+
npm i @entro314labs/iso-engine
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
```ts
|
|
33
|
-
import '@
|
|
34
|
-
import '@
|
|
35
|
-
import { createKernel, mountFigure } from '@
|
|
36
|
-
import Iso from '@
|
|
37
|
-
import { loopScene, beats, narrate } from '@
|
|
33
|
+
import '@entro314labs/iso-engine/theme.css'; // colour tokens, light and dark (or define them yourself)
|
|
34
|
+
import '@entro314labs/iso-engine/figure.css'; // figure classes, the glow kit, the engine's accent mapping
|
|
35
|
+
import { createKernel, mountFigure } from '@entro314labs/iso-engine'; // figures
|
|
36
|
+
import Iso from '@entro314labs/iso-engine/engine'; // scenes, prefabs, timelines, diagrams, export
|
|
37
|
+
import { loopScene, beats, narrate } from '@entro314labs/iso-engine/loops'; // autoplaying loops
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
Without a bundler:
|
|
41
41
|
|
|
42
42
|
- **Engine pages** load the engine as a classic script, which defines `window.Iso` and works from `file://`:
|
|
43
|
-
`<script src="node_modules/@
|
|
43
|
+
`<script src="node_modules/@entro314labs/iso-engine/dist/iso.global.js"></script>` (or the same path on a CDN such as jsDelivr).
|
|
44
44
|
`node scripts/build.mjs page.html` inlines it into one self-contained file for sharing, an artifact or an email.
|
|
45
|
-
- **Kernel figures and loops** are ES modules: map `@
|
|
45
|
+
- **Kernel figures and loops** are ES modules: map `@entro314labs/iso-engine` (and `@entro314labs/iso-engine/loops`) to `dist/index.js` (and
|
|
46
46
|
`dist/loops.js`) with an import map and serve the page over http. `examples/figure.html` and `examples/loop.html` do
|
|
47
47
|
exactly this. The global script contains only the engine, not the kernel.
|
|
48
48
|
|
|
@@ -140,4 +140,4 @@ If you couldn't render it, say so plainly.
|
|
|
140
140
|
| `scripts/build.mjs` | Inline the engine (and other local classic scripts) into one self-contained HTML file |
|
|
141
141
|
|
|
142
142
|
The examples load the package's own `dist/` by relative path; copying one elsewhere, point those paths at
|
|
143
|
-
`node_modules/@
|
|
143
|
+
`node_modules/@entro314labs/iso-engine/dist/` or a CDN.
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<body>
|
|
13
13
|
<main id="app"></main>
|
|
14
14
|
<!-- the engine as a classic script (window.Iso), from this package's dist/. Copying this page elsewhere: point
|
|
15
|
-
src at wherever iso.global.js is served (node_modules/@
|
|
15
|
+
src at wherever iso.global.js is served (node_modules/@entro314labs/iso-engine/dist/, or a CDN such as jsDelivr). -->
|
|
16
16
|
<script src="../../../dist/iso.global.js"></script>
|
|
17
17
|
<script>
|
|
18
18
|
/* Laptop and server — world units: x → right-down, y → left-down, z → up. The platform top is z = 0. */
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
6
|
<title>Flatshare matcher</title>
|
|
7
7
|
<!-- Paths point into this package's dist/. Serve the folder over http (ES modules don't load from file://), e.g.
|
|
8
|
-
`npx serve node_modules/@
|
|
9
|
-
elsewhere: point the stylesheets and the import map at node_modules/@
|
|
8
|
+
`npx serve node_modules/@entro314labs/iso-engine` and open /skills/iso-engine/examples/figure.html. Copying this page
|
|
9
|
+
elsewhere: point the stylesheets and the import map at node_modules/@entro314labs/iso-engine/dist/ or a CDN (jsDelivr). -->
|
|
10
10
|
<link rel="stylesheet" href="../../../dist/theme.css">
|
|
11
11
|
<link rel="stylesheet" href="../../../dist/figure.css">
|
|
12
|
-
<script type="importmap">{ "imports": { "@
|
|
12
|
+
<script type="importmap">{ "imports": { "@entro314labs/iso-engine": "../../../dist/index.js" } }</script>
|
|
13
13
|
<style>
|
|
14
14
|
body { margin:0; background:var(--page); color:var(--ink); font:13px/1.4 var(--mono); }
|
|
15
15
|
main { max-width:960px; margin:0 auto; padding:32px 16px; }
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
</figure>
|
|
32
32
|
</main>
|
|
33
33
|
<script type="module">
|
|
34
|
-
import { mountFigure } from '@
|
|
34
|
+
import { mountFigure } from '@entro314labs/iso-engine';
|
|
35
35
|
import matcher from './matcher.js';
|
|
36
36
|
|
|
37
37
|
const $ = sel => document.querySelector(sel);
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
6
|
<title>Card lift</title>
|
|
7
7
|
<!-- Serve over http (ES modules don't load from file://). Copying this page elsewhere: point the stylesheets and the
|
|
8
|
-
import map at node_modules/@
|
|
8
|
+
import map at node_modules/@entro314labs/iso-engine/dist/ or a CDN (jsDelivr). -->
|
|
9
9
|
<link rel="stylesheet" href="../../../dist/theme.css">
|
|
10
10
|
<link rel="stylesheet" href="../../../dist/figure.css">
|
|
11
11
|
<script type="importmap">{ "imports": {
|
|
12
|
-
"@
|
|
13
|
-
"@
|
|
14
|
-
"@
|
|
12
|
+
"@entro314labs/iso-engine": "../../../dist/index.js",
|
|
13
|
+
"@entro314labs/iso-engine/loops": "../../../dist/loops.js",
|
|
14
|
+
"@entro314labs/iso-engine/engine": "../../../dist/engine/index.js"
|
|
15
15
|
} }</script>
|
|
16
16
|
<style>
|
|
17
17
|
body { margin:0; background:var(--page); color:var(--ink); font:13px/1.4 var(--mono); }
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* posterTime }), beats laid end to end, captions narrated from the timeline, one lit moment with a halo behind it.
|
|
5
5
|
* loop.html hosts it: paused on its poster, playing only while visible, click to pause.
|
|
6
6
|
*/
|
|
7
|
-
import { beats, halo, loopScene, narrate } from '@
|
|
7
|
+
import { beats, halo, loopScene, narrate } from '@entro314labs/iso-engine/loops';
|
|
8
8
|
|
|
9
9
|
const ARIA = 'A card lifts off its dock, lights up, and lands again.';
|
|
10
10
|
|
|
11
|
-
/** @type {import('@
|
|
11
|
+
/** @type {import('@entro314labs/iso-engine/loops').Loop} */
|
|
12
12
|
const loop = {
|
|
13
13
|
id: 'card-lift',
|
|
14
14
|
project: 'Example',
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* frame), the glow kit (lit glass with a halo behind it, latched switches, lit bars) and CSS scoped to the figure.
|
|
8
8
|
* figure.html mounts it with mountFigure; in an app, import it the same way.
|
|
9
9
|
*/
|
|
10
|
-
import { createKernel, frame, ln, rep, tx } from '@
|
|
10
|
+
import { createKernel, frame, ln, rep, tx } from '@entro314labs/iso-engine';
|
|
11
11
|
|
|
12
12
|
/** Habits you set. `w` is how much a mismatch matters when sharing a flat. */
|
|
13
13
|
const TRAITS = [
|
|
@@ -39,7 +39,7 @@ const BX = 360, BD = 220, BH = 30; // base slab
|
|
|
39
39
|
const PITCH = 52, SW = 36, SX0 = (BX - (5 * PITCH + SW)) / 2;
|
|
40
40
|
const SCR = { x: 12, y: 12, w: 296, h: 126 }; // the glass, in the housing's FRONT plane
|
|
41
41
|
|
|
42
|
-
/** @type {import('@
|
|
42
|
+
/** @type {import('@entro314labs/iso-engine').Figure} */
|
|
43
43
|
const matcher = {
|
|
44
44
|
id: 'matcher',
|
|
45
45
|
name: 'Flatshare matcher',
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<body>
|
|
13
13
|
<main id="app"></main>
|
|
14
14
|
<!-- the engine as a classic script (window.Iso), from this package's dist/. Copying this page elsewhere: point
|
|
15
|
-
src at wherever iso.global.js is served (node_modules/@
|
|
15
|
+
src at wherever iso.global.js is served (node_modules/@entro314labs/iso-engine/dist/, or a CDN such as jsDelivr). -->
|
|
16
16
|
<script src="../../../dist/iso.global.js"></script>
|
|
17
17
|
<script type="application/json" id="spec">
|
|
18
18
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Iso API reference
|
|
2
2
|
|
|
3
|
-
In an app, `import Iso from '@
|
|
3
|
+
In an app, `import Iso from '@entro314labs/iso-engine/engine'`. Without a bundler, load the package's `dist/iso.global.js` with a
|
|
4
4
|
`<script>` tag; it defines `window.Iso`.
|
|
5
5
|
All lengths are world units (≈ px at the fitted size). Angles are degrees.
|
|
6
6
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# Interactive figures (the kernel)
|
|
2
2
|
|
|
3
3
|
A figure is an isometric line drawing whose parts work: a switch toggles, keys depress, a screen shows what was typed,
|
|
4
|
-
picking a chip lights the buses it talks to. It is plain SVG drawn by the projection kernel from `@
|
|
4
|
+
picking a chip lights the buses it talks to. It is plain SVG drawn by the projection kernel from `@entro314labs/iso-engine`, mounted
|
|
5
5
|
by `mountFigure`, styled by `figure.css`. `examples/matcher.js` is a complete one; read it before starting.
|
|
6
6
|
|
|
7
7
|
## The contract
|
|
8
8
|
|
|
9
9
|
```ts
|
|
10
|
-
import { createKernel, frame, mountFigure, type Figure } from '@
|
|
11
|
-
import '@
|
|
12
|
-
import '@
|
|
10
|
+
import { createKernel, frame, mountFigure, type Figure } from '@entro314labs/iso-engine';
|
|
11
|
+
import '@entro314labs/iso-engine/theme.css'; // colour tokens, light and dark (or define them yourself)
|
|
12
|
+
import '@entro314labs/iso-engine/figure.css'; // .face, .press, .part, .flow, .layer, .cut, .hud, the glow kit
|
|
13
13
|
|
|
14
14
|
const fig: Figure = {
|
|
15
15
|
id: 'lamp', // kebab-case; also the css scope
|
|
@@ -318,7 +318,7 @@ diagrams, depth sorting that handles moving parts, focus rings and Enter/Space o
|
|
|
318
318
|
contract and build in `ctx.host`:
|
|
319
319
|
|
|
320
320
|
```ts
|
|
321
|
-
import Iso from '@
|
|
321
|
+
import Iso from '@entro314labs/iso-engine/engine';
|
|
322
322
|
|
|
323
323
|
mount({ host, readout }) {
|
|
324
324
|
const s = Iso.scene(host, { theme: 'inherit', label: 'What it is and how to operate it.', padding: 22 });
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
A loop is a short animation that plays by itself and tells one story: an email sent and held in its undo window, a
|
|
4
4
|
database going to sleep and waking, an app's interface exploded into its parts. Same look and rigour as a figure; a
|
|
5
5
|
timeline moves the state instead of the viewer. Built on the engine (`api.md`, `animation.md`) with the helpers in
|
|
6
|
-
`@
|
|
6
|
+
`@entro314labs/iso-engine/loops`.
|
|
7
7
|
|
|
8
8
|
## Write the story first
|
|
9
9
|
|
|
@@ -24,7 +24,7 @@ If the request is open ("animate our product"), propose one or two concrete stor
|
|
|
24
24
|
`examples/loop.js` is a complete one and `examples/loop.html` hosts it. The core:
|
|
25
25
|
|
|
26
26
|
```ts
|
|
27
|
-
import { beats, halo, loopScene, narrate, type Loop } from '@
|
|
27
|
+
import { beats, halo, loopScene, narrate, type Loop } from '@entro314labs/iso-engine/loops';
|
|
28
28
|
|
|
29
29
|
const ARIA = 'A card lifts off its dock, lights up, and lands again.';
|
|
30
30
|
const loop: Loop = {
|
|
@@ -27,7 +27,7 @@ glows. Think architectural axonometrics and product cutaways, not 3D-rendered bl
|
|
|
27
27
|
lit surface (a screen, a sheet, a band) stays glass — `material: 'glass'` or the accent at reduced strength with an
|
|
28
28
|
accent edge — with a bloom of light behind it, never a flat accent slab, or it turns into a blob. With `figure.css` and
|
|
29
29
|
the glow filters on the page, a flat shape with `class: 'glow-halo'` just before the lit object gives that bloom
|
|
30
|
-
(`halo()` from `@
|
|
30
|
+
(`halo()` from `@entro314labs/iso-engine/loops` adds one).
|
|
31
31
|
- Pair `material: 'lit'` with `glow: true` on small objects; leave glow off for many tiny lights
|
|
32
32
|
(lit windows, LEDs) — the contrast is enough.
|
|
33
33
|
|