v0.6: template-manager owns the product catalog

The host no longer carries a runtime product catalog. products.js
shrinks to a legacy single-product stub; the canonical catalog lives in
template-manager's productsStore, seeded ONCE on first boot from the
new seedProducts.js (after that the store under templates/ is
authoritative and the seed is ignored — intentional, so restarts never
rewrite an admin-managed catalog). phoneModels.js and
templateCategories.js are the supporting constant sets, and
docs/template-schema.md documents the v4 schema.

templates/ is the admin-managed store itself (_products_index.json +
products/<id>/product.json, JSON only) — committed so the configured
catalog (sizes, pricing, options built up in the admin UI) survives a
fresh checkout rather than regressing to the seed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
khalid@traclabs.com
2026-09-01 23:28:48 -05:00
parent b5b8808251
commit aba2dbedfb
17 changed files with 1549 additions and 76 deletions

View File

@@ -2,6 +2,12 @@
This document describes the template structure for creating custom t-shirt design templates.
> **Note (2026-07-06):** this doc predates the goods-editor extraction and the
> v4 multi-view template schema. The authoritative element schema lives in
> `goods-editor-module/CLAUDE.md` ("Element schema") and the accepted payload
> shape in `template-manager/src/server/lib/validation.js`. The property
> tables below are still accurate for the fields they list.
## Template Structure
```json
@@ -42,6 +48,27 @@ This document describes the template structure for creating custom t-shirt desig
| `fontFamily`| string| No | Google Font name (default: "DM Sans") |
| `fill` | string | No | Hex color (default: "#0f172a") |
| `rotation` | number | No | Rotation in degrees (default: 0) |
| `arc` | number | No | Curve amount (default: 0 = flat). `> 0` arcs up (rainbow), `< 0` arcs down (smile). See "Curved text" below. |
| `align` | string | No | `left` \| `center` \| `right` (default: `center`; multi-line) |
| `lineHeight` | number | No | Line-box ratio of fontSize (default: 1.2) |
| `letterSpacing` | number | No | Absolute tracking in canvas units (default: 0; suspended while curved) |
#### Curved text (`arc`)
- The editor's Curve slider writes values in **−100..100**; hand-authored
templates should stay in that range.
- The stored value up to **±200** is honored by the renderer and the print
exporter (`ARC_MODEL_MAX` in the goods-editor module, 2026-07-06): the
editor itself *derives* values above 100 when preserving an authored
curve on long customer text whose font size auto-shrank. Don't hand-author
above ±100 — the headroom exists for derived values.
- What is visually preserved across customer edits is the curve's
**density** (`arc · fontSize / width`), not the raw number: the editor
rescales `arc` as text, font, or size changes so the perceived sweep the
template author designed stays constant. Expect saved customer designs to
carry arc values that differ from the authored one.
- `letterSpacing` has no effect while `|arc| > 0.5` (suspension rule); the
stored value survives and reapplies when the text goes flat.
### Image Element