Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ jobs:
- name: Assemble public site
run: |
mkdir -p _site
cp index.html 3d.html embed.js og-image.png favicon.svg favicon.ico apple-touch-icon.png site.webmanifest robots.txt sitemap.xml _site/
cp -R vendor docs examples _site/
cp index.html 3d.html embed.js diagram-styles.json diagram-styles.schema.json og-image.png favicon.svg favicon.ico apple-touch-icon.png site.webmanifest robots.txt sitemap.xml _site/
cp -R vendor docs examples diagram-styles _site/
touch _site/.nojekyll
- uses: actions/configure-pages@v5
- uses: actions/upload-pages-artifact@v3
Expand Down
45 changes: 5 additions & 40 deletions 3d.html
Original file line number Diff line number Diff line change
Expand Up @@ -2195,50 +2195,15 @@ <h2 id="aboutTitle">Flow<br><span>Explainer</span></h2>
}

/* ---------- diagram styles + settings (same block in index.html and 3d.html) ---------- */
// One entry per diagram style. Add a style by copying an entry; both pages read the same fields.
// Source of truth: diagram-styles/*.json (+ pack.json, diagram-styles.schema.json). Edit a style file, then:
// npm run styles:sync
// 2D uses bg/bg2, blocks, neutral, ink, edge, accent, shadow, gridOp, sw, opacity; 3D also uses mat, rough, outline, ground, grid3.
// Optional: chips (flat chip look: inset top square + pins), flat (block height factor), labMono / labUpper (plain monospace capital labels).
/** @typedef {{name:string,desc:string,dark?:boolean,bg:string,bg2:string,blocks:string[],neutral:string,ink:string,edge:string,edge3d:string|null,accent:string,accentFg:string,plate:string,plateFg:string,plateBd:string,on:string,onFg:string,muted:string,zone:string,zoneBd:string,chip:string,labShadow:string,shadow:string,gridOp:number,grid3:number,ground:number,mat:string,rough:number,opacity:number,outline:number,sw:number,chips?:boolean,flat?:number,labMono?:boolean,labUpper?:boolean}} DiagramStyle */
/* ---- begin generated STYLES (from diagram-styles/; run: node tools/sync-styles.mjs) ---- */
/** @type {Record<string,DiagramStyle>} */
const STYLES={
original:{name:'Original',desc:'Pastel blocks on warm paper',
bg:'#f5f0e6',bg2:'#fbf7ee',blocks:['#a9c8f5','#b6e3b1','#cdbdf6','#f7da8c','#f5b9c5','#f8c59b','#a9e0dc'],neutral:'#e6e0d2',
ink:'#1f2430',edge:'#1f2430',edge3d:null,accent:'#ee5a3a',accentFg:'#fff',
plate:'#fffdf8',plateFg:'#1f2430',plateBd:'#1f2430',on:'#1f2430',onFg:'#f5f0e6',muted:'#6b6f7b',
zone:'rgba(31,36,48,.035)',zoneBd:'rgba(31,36,48,.45)',chip:'rgba(245,240,230,.75)',labShadow:'rgba(31,36,48,.2)',shadow:'rgba(31,36,48,.10)',
gridOp:.07,grid3:.075,ground:.2,mat:'standard',rough:.6,opacity:1,outline:0,sw:1},
teal:{name:'Teal',desc:'Teal outlines, amber highlight',
bg:'#f3f8f9',bg2:'#ffffff',blocks:['#e6f4f6','#c4e6eb','#9fd5dd','#fff1cc','#d7eef1','#b8e2e8','#e3f2ee'],neutral:'#eef2f5',
ink:'#475569',edge:'#007c90',edge3d:'#007c90',accent:'#fcaf17',accentFg:'#1f1300',
plate:'#ffffff',plateFg:'#0f172a',plateBd:'#cbd5e1',on:'#007c90',onFg:'#ffffff',muted:'#64748b',
zone:'rgba(0,124,144,.04)',zoneBd:'rgba(0,124,144,.45)',chip:'rgba(255,255,255,.85)',labShadow:'rgba(15,23,42,.08)',shadow:'rgba(15,23,42,.07)',
gridOp:.06,grid3:.06,ground:.1,mat:'standard',rough:.7,opacity:1,outline:0,sw:1},
line:{name:'Line Art',desc:'White blocks, bold outlines',
bg:'#ffffff',bg2:'#ffffff',blocks:['#ffffff'],neutral:'#ffffff',
ink:'#0f172a',edge:'#0f172a',edge3d:'#0f172a',accent:'#007c90',accentFg:'#fff',
plate:'#ffffff',plateFg:'#0f172a',plateBd:'#0f172a',on:'#0f172a',onFg:'#ffffff',muted:'#475569',
zone:'rgba(15,23,42,.02)',zoneBd:'rgba(15,23,42,.5)',chip:'rgba(255,255,255,.9)',labShadow:'rgba(15,23,42,.15)',shadow:'rgba(15,23,42,.06)',
gridOp:.06,grid3:.06,ground:.06,mat:'toon',rough:1,opacity:1,outline:.05,sw:1.5},
blueprint:{name:'Blueprint',desc:'Dark background, wireframe',dark:true,
bg:'#071a2e',bg2:'#0b2540',blocks:['#0e3a52'],neutral:'#0e3a52',
ink:'#5eead4',edge:'#5eead4',edge3d:'#5eead4',accent:'#fcaf17',accentFg:'#1f1300',
plate:'rgba(7,26,46,.92)',plateFg:'#ccfbf1',plateBd:'rgba(94,234,212,.55)',on:'#fcaf17',onFg:'#1f1300',muted:'#7dd3c8',
zone:'rgba(94,234,212,.05)',zoneBd:'rgba(94,234,212,.4)',chip:'rgba(7,26,46,.75)',labShadow:'rgba(0,0,0,.3)',shadow:'rgba(0,0,0,.25)',
gridOp:.12,grid3:.12,ground:0,mat:'basic',rough:1,opacity:.45,outline:0,sw:1},
glass:{name:'Glass',desc:'See-through blocks',
bg:'#eef6f8',bg2:'#fbfeff',blocks:['#7fc9d3','#9fd5dd','#c4e6eb','#fcd27a','#b8e2e8','#a8dbe3','#d4eef2'],neutral:'#d7ecf0',
ink:'#0f4c5c',edge:'#5b9aa6',edge3d:'#ffffff',accent:'#fcaf17',accentFg:'#1f1300',
plate:'rgba(255,255,255,.85)',plateFg:'#0f172a',plateBd:'rgba(15,76,92,.3)',on:'#007c90',onFg:'#ffffff',muted:'#3b6f7b',
zone:'rgba(0,124,144,.05)',zoneBd:'rgba(0,124,144,.35)',chip:'rgba(255,255,255,.75)',labShadow:'rgba(15,23,42,.08)',shadow:'rgba(15,76,92,.10)',
gridOp:.07,grid3:.07,ground:.1,mat:'glass',rough:.15,opacity:.6,outline:0,sw:1},
circuit:{name:'Circuit',desc:'Dark board, flat chips, thin blue lines',dark:true,
bg:'#080c17',bg2:'#0e1527',blocks:['#1a2438','#1b2a42','#172236'],neutral:'#1a2438',
ink:'#4d6a90',edge:'#7393bd',edge3d:'#86a6d0',accent:'#bfe1ff',accentFg:'#0a0e1a',
plate:'transparent',plateFg:'#c9d6e8',plateBd:'transparent',on:'rgba(191,225,255,.12)',onFg:'#ffffff',muted:'#8094ae',
zone:'rgba(115,147,189,.05)',zoneBd:'rgba(115,147,189,.35)',chip:'rgba(8,12,23,.7)',labShadow:'transparent',shadow:'rgba(0,0,0,.35)',
gridOp:.11,grid3:.11,ground:0,mat:'basic',rough:1,opacity:1,outline:0,sw:.8,
chips:true,flat:.42,labMono:true,labUpper:true}
};
const STYLES=/** @type {Record<string,DiagramStyle>} */(JSON.parse("{\"original\":{\"name\":\"Original\",\"desc\":\"Pastel blocks on warm paper\",\"bg\":\"#f5f0e6\",\"bg2\":\"#fbf7ee\",\"blocks\":[\"#a9c8f5\",\"#b6e3b1\",\"#cdbdf6\",\"#f7da8c\",\"#f5b9c5\",\"#f8c59b\",\"#a9e0dc\"],\"neutral\":\"#e6e0d2\",\"ink\":\"#1f2430\",\"edge\":\"#1f2430\",\"edge3d\":null,\"accent\":\"#ee5a3a\",\"accentFg\":\"#fff\",\"plate\":\"#fffdf8\",\"plateFg\":\"#1f2430\",\"plateBd\":\"#1f2430\",\"on\":\"#1f2430\",\"onFg\":\"#f5f0e6\",\"muted\":\"#6b6f7b\",\"zone\":\"rgba(31,36,48,.035)\",\"zoneBd\":\"rgba(31,36,48,.45)\",\"chip\":\"rgba(245,240,230,.75)\",\"labShadow\":\"rgba(31,36,48,.2)\",\"shadow\":\"rgba(31,36,48,.10)\",\"gridOp\":0.07,\"grid3\":0.075,\"ground\":0.2,\"mat\":\"standard\",\"rough\":0.6,\"opacity\":1,\"outline\":0,\"sw\":1},\"teal\":{\"name\":\"Teal\",\"desc\":\"Teal outlines, amber highlight\",\"bg\":\"#f3f8f9\",\"bg2\":\"#ffffff\",\"blocks\":[\"#e6f4f6\",\"#c4e6eb\",\"#9fd5dd\",\"#fff1cc\",\"#d7eef1\",\"#b8e2e8\",\"#e3f2ee\"],\"neutral\":\"#eef2f5\",\"ink\":\"#475569\",\"edge\":\"#007c90\",\"edge3d\":\"#007c90\",\"accent\":\"#fcaf17\",\"accentFg\":\"#1f1300\",\"plate\":\"#ffffff\",\"plateFg\":\"#0f172a\",\"plateBd\":\"#cbd5e1\",\"on\":\"#007c90\",\"onFg\":\"#ffffff\",\"muted\":\"#64748b\",\"zone\":\"rgba(0,124,144,.04)\",\"zoneBd\":\"rgba(0,124,144,.45)\",\"chip\":\"rgba(255,255,255,.85)\",\"labShadow\":\"rgba(15,23,42,.08)\",\"shadow\":\"rgba(15,23,42,.07)\",\"gridOp\":0.06,\"grid3\":0.06,\"ground\":0.1,\"mat\":\"standard\",\"rough\":0.7,\"opacity\":1,\"outline\":0,\"sw\":1},\"line\":{\"name\":\"Line Art\",\"desc\":\"White blocks, bold outlines\",\"bg\":\"#ffffff\",\"bg2\":\"#ffffff\",\"blocks\":[\"#ffffff\"],\"neutral\":\"#ffffff\",\"ink\":\"#0f172a\",\"edge\":\"#0f172a\",\"edge3d\":\"#0f172a\",\"accent\":\"#007c90\",\"accentFg\":\"#fff\",\"plate\":\"#ffffff\",\"plateFg\":\"#0f172a\",\"plateBd\":\"#0f172a\",\"on\":\"#0f172a\",\"onFg\":\"#ffffff\",\"muted\":\"#475569\",\"zone\":\"rgba(15,23,42,.02)\",\"zoneBd\":\"rgba(15,23,42,.5)\",\"chip\":\"rgba(255,255,255,.9)\",\"labShadow\":\"rgba(15,23,42,.15)\",\"shadow\":\"rgba(15,23,42,.06)\",\"gridOp\":0.06,\"grid3\":0.06,\"ground\":0.06,\"mat\":\"toon\",\"rough\":1,\"opacity\":1,\"outline\":0.05,\"sw\":1.5},\"blueprint\":{\"name\":\"Blueprint\",\"desc\":\"Dark background, wireframe\",\"dark\":true,\"bg\":\"#071a2e\",\"bg2\":\"#0b2540\",\"blocks\":[\"#0e3a52\"],\"neutral\":\"#0e3a52\",\"ink\":\"#5eead4\",\"edge\":\"#5eead4\",\"edge3d\":\"#5eead4\",\"accent\":\"#fcaf17\",\"accentFg\":\"#1f1300\",\"plate\":\"rgba(7,26,46,.92)\",\"plateFg\":\"#ccfbf1\",\"plateBd\":\"rgba(94,234,212,.55)\",\"on\":\"#fcaf17\",\"onFg\":\"#1f1300\",\"muted\":\"#7dd3c8\",\"zone\":\"rgba(94,234,212,.05)\",\"zoneBd\":\"rgba(94,234,212,.4)\",\"chip\":\"rgba(7,26,46,.75)\",\"labShadow\":\"rgba(0,0,0,.3)\",\"shadow\":\"rgba(0,0,0,.25)\",\"gridOp\":0.12,\"grid3\":0.12,\"ground\":0,\"mat\":\"basic\",\"rough\":1,\"opacity\":0.45,\"outline\":0,\"sw\":1},\"glass\":{\"name\":\"Glass\",\"desc\":\"See-through blocks\",\"bg\":\"#eef6f8\",\"bg2\":\"#fbfeff\",\"blocks\":[\"#7fc9d3\",\"#9fd5dd\",\"#c4e6eb\",\"#fcd27a\",\"#b8e2e8\",\"#a8dbe3\",\"#d4eef2\"],\"neutral\":\"#d7ecf0\",\"ink\":\"#0f4c5c\",\"edge\":\"#5b9aa6\",\"edge3d\":\"#ffffff\",\"accent\":\"#fcaf17\",\"accentFg\":\"#1f1300\",\"plate\":\"rgba(255,255,255,.85)\",\"plateFg\":\"#0f172a\",\"plateBd\":\"rgba(15,76,92,.3)\",\"on\":\"#007c90\",\"onFg\":\"#ffffff\",\"muted\":\"#3b6f7b\",\"zone\":\"rgba(0,124,144,.05)\",\"zoneBd\":\"rgba(0,124,144,.35)\",\"chip\":\"rgba(255,255,255,.75)\",\"labShadow\":\"rgba(15,23,42,.08)\",\"shadow\":\"rgba(15,76,92,.10)\",\"gridOp\":0.07,\"grid3\":0.07,\"ground\":0.1,\"mat\":\"glass\",\"rough\":0.15,\"opacity\":0.6,\"outline\":0,\"sw\":1},\"circuit\":{\"name\":\"Circuit\",\"desc\":\"Dark board, flat chips, thin blue lines\",\"dark\":true,\"bg\":\"#080c17\",\"bg2\":\"#0e1527\",\"blocks\":[\"#1a2438\",\"#1b2a42\",\"#172236\"],\"neutral\":\"#1a2438\",\"ink\":\"#4d6a90\",\"edge\":\"#7393bd\",\"edge3d\":\"#86a6d0\",\"accent\":\"#bfe1ff\",\"accentFg\":\"#0a0e1a\",\"plate\":\"transparent\",\"plateFg\":\"#c9d6e8\",\"plateBd\":\"transparent\",\"on\":\"rgba(191,225,255,.12)\",\"onFg\":\"#ffffff\",\"muted\":\"#8094ae\",\"zone\":\"rgba(115,147,189,.05)\",\"zoneBd\":\"rgba(115,147,189,.35)\",\"chip\":\"rgba(8,12,23,.7)\",\"labShadow\":\"transparent\",\"shadow\":\"rgba(0,0,0,.35)\",\"gridOp\":0.11,\"grid3\":0.11,\"ground\":0,\"mat\":\"basic\",\"rough\":1,\"opacity\":1,\"outline\":0,\"sw\":0.8,\"chips\":true,\"flat\":0.42,\"labMono\":true,\"labUpper\":true}}"));
/* ---- end generated STYLES ---- */
let DS=STYLES.original,DSK='original';
const UI_ICON={check:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg>',chev:'<svg class="chev" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg>'};
const hashStyle=()=>{const m=location.hash.match(/[#&]s=([\w-]+)/);return m&&STYLES[m[1]]?m[1]:null};
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Turns pasted GitHub markdown (Mermaid flowchart, sequence, state, class, ER, gan
- 3D: `analyse(cam)` computes label/box screen rects analytically (must match `.lab` CSS transforms); export draws HTML labels onto the WebGL frame and crops to content; "Find a clean angle" scores 64 camera angles. `window.__fx` is a test handle.

- Site look: Solution Forest colours (teal `#007c90`, amber `#fcaf17`), Inter / Raleway self-hosted in `vendor/` (OFL). UI CSS uses `--brand`, `--ink`, `--line`… tokens; diagram CSS uses only `--d-*` tokens, which `useStyle()` sets from the active diagram style.
- Diagram styles: `STYLES` (original = default and must stay pixel-identical to the old look, teal, line, blueprint, glass) in the shared block `/* ---------- diagram styles + settings` … `end of diagram styles + settings`, synced to 3d.html by `tools/sync-parser.py`. Chosen style is saved in `localStorage` `flowx.style` and added to client links as `&s=<key>` (`#c=<data>&s=teal`); `restyle()` in each page re-renders. 2D reads `DS.edge/ink/blocks/sw/opacity…` in `prism()`/`render()`; 3D reads `DS.mat/edge3d/outline/ground…` in `blockMat()`/`render()`.
- Diagram styles: source of truth is `diagram-styles/` (one `<id>.json` per style + `pack.json` order; schema `diagram-styles.schema.json`, format `flow-explainer.diagram-styles`). `npm run styles:sync` rebuilds generated `diagram-styles.json` and embeds `STYLES` into pages, then `tools/sync-parser.py`. `original` = default and must stay pixel-identical to the old look. Chosen style is saved in `localStorage` `flowx.style` and added to client links as `&s=<key>` (`#c=<data>&s=teal`); `restyle()` in each page re-renders. 2D reads `DS.edge/ink/blocks/sw/opacity…` in `prism()`/`render()`; 3D reads `DS.mat/edge3d/outline/ground…` in `blockMat()`/`render()`. `npm run check:sync` verifies folder ↔ bundle ↔ HTML ↔ 3d.html.
- UI: ⚙ Settings popover (slide-out sheet ≤820px) with diagram style + 3D/2D; Copy client link opens a popover with the privacy notes (not uploaded / not encrypted); All steps is a `<details>` stepper (`stepsHtml()`), folded by default on phones. Header: **New** (empty editor, `#tplNew` template via “Use template”), **Examples** select (`#exHead`, mirrors `#exSel`), brand button opens the **About** dialog (`#about`, also footer “About”).
- Branding: footer of both pages shows "GitHub · MIT License · Made by Solution Forest" (Solution Forest links to https://solutionforest.net/), plus a GitHub button in the header. No SF logo. Do not add personal demo-site links to the README or repo.
- Live site: https://flow-explainer.laravel.cloud/ (Laravel Cloud, deployed from `main`, served by `server.js`). Backup: https://solutionforest.github.io/flow-explainer/ (GitHub Pages via `.github/workflows/pages.yml`, public files only). SEO/social: `<head>` of both pages has description, canonical, Open Graph + Twitter card (`og-image.png`, 1200×630, made from the README cover), JSON-LD `WebApplication`; root files `favicon.svg/.ico`, `apple-touch-icon.png`, `site.webmanifest`, `robots.txt`, `sitemap.xml` use the Cloud domain. The built-in demo keeps the descriptive `<title>`; loaded diagrams set it to their own title.
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,12 @@ Open **⚙ Settings** to change how the diagram looks. The same style is used in
| Glass | See-through blocks |
| Circuit | Dark board with flat chip-shaped blocks (inset top, pins), thin steel-blue lines and plain capital labels |

Each style is one entry in the `STYLES` list in `index.html` (background, block colours, outline, highlight, label colours, and the 3D material). To add a style, copy an entry, change the values, and run `python3 tools/sync-parser.py` so `3d.html` gets it too. The site itself always uses the Solution Forest colours; only the diagram changes.
Styles live in the **[`diagram-styles/`](diagram-styles/)** folder — **one JSON file per style** (`original.json`, `teal.json`, …) plus [`pack.json`](diagram-styles/pack.json) for order. Schema: [`diagram-styles.schema.json`](diagram-styles.schema.json) (format id `flow-explainer.diagram-styles`). Root [`diagram-styles.json`](diagram-styles.json) is a **generated** bundle for publishing; do not edit it by hand. Pages embed the pack so they stay standalone (no runtime fetch). To add or edit a style:

1. Add or edit `diagram-styles/<id>.json` and list `<id>` in `pack.json` `order` (keep `original` — it must stay pixel-identical to the old look).
2. Run `npm run styles:sync` (rebuilds the bundle, writes into `index.html`, syncs `3d.html`).

Client links still use `&s=<id>` (e.g. `&s=teal`). Loading arbitrary custom JSON in the browser is not supported yet — this ships the file format first. The site chrome always uses Solution Forest colours; only the diagram changes.

**Icons:** the emoji on the blocks (🧑 💳 🗄️ …) are **shown by default**. **⚙ Settings → Icons → Hide** turns them off for a cleaner look. The choice is saved in your browser, and a client link made while they are hidden adds `&i=0` so the client sees the same.

Expand Down Expand Up @@ -346,6 +351,10 @@ tools/sync-parser.py Copies the shared parser and diagram styles from index.htm
tools/*.mjs Code checks (extract scripts, strict type check with baseline, sync check)
server.js Tiny static server used on Laravel Cloud (npm start)
embed.js Standalone script-tag embed loader (GitHub Pages + Cloud)
diagram-styles/ One JSON file per style + pack.json (source of truth)
diagram-styles.json Generated style bundle (do not edit; published on Pages)
diagram-styles.schema.json JSON Schema for the pack / each style
tools/sync-styles.mjs Assembles folder → bundle + embeds into index.html (npm run styles:sync)
.github/workflows/pages.yml GitHub Pages backup (public files only)
docs/images/ Images used in this README
```
Expand Down
Loading
Loading