@unoverse-platform/studio 0.1.85 → 0.1.86

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.
@@ -0,0 +1,133 @@
1
+ # Playbook: Templates
2
+
3
+ **Read first:** [design/templates](https://docs.unoverse.ai/design/templates.md)
4
+ (the three words, the director, placing one in an app). Deep law:
5
+ [UNOVERSE_TEMPLATE_MODEL](https://docs.unoverse.ai/unoverse/UNOVERSE_TEMPLATE_MODEL.md)
6
+ — §9b is the grammar (RULED 2026-08-29), §5b the fill lanes, §6c the director's
7
+ twelve rules, §12 how a template is placed. Everything in the component playbook
8
+ (closed vocabulary, tokens only, no logic in definitions) applies here too.
9
+ **Study an exemplar before writing**: `design/marketplace/templates/grid-page`
10
+ (two states, the free browse↔detail dance) and
11
+ `design/marketplace/templates/email-digest` (one flat state, all three words,
12
+ template-local components).
13
+
14
+ ## What a template IS
15
+
16
+ | Kind | Authors say | Decides what appears |
17
+ |---|---|---|
18
+ | **component** | `type: component` | itself — one interface with its own states |
19
+ | **template** | `type: template` | an ARRANGEMENT whose sections deliveries fill |
20
+ | **app** | `type: app` (folder `apps/`) | the reader — the surface a template is placed on |
21
+
22
+ ## The file tree (one folder grammar)
23
+
24
+ ```
25
+ design/<org|marketplace>/templates/<name>/
26
+ <name>.yaml # the ENVELOPE: type + name + states (each → its layout path)
27
+ manifest.yaml # discovery meta ONLY: description, whenToUse, category, version
28
+ layouts/<state>.yaml # one arrangement per state — the three-word sections
29
+ components/ # the template's OWN parts (§9b.7): flat files, no
30
+ # manifests, unprefixed (the folder is the namespace)
31
+ ```
32
+
33
+ ## The envelope: states, like every kind
34
+
35
+ ```yaml
36
+ unoverse: "1.0"
37
+ type: template
38
+ name: grid-page
39
+ states:
40
+ grid: # FIRST = the base
41
+ layout: layouts/grid
42
+ page: # the rest = the reaction ladder
43
+ layout: layouts/page
44
+ ```
45
+
46
+ Use the standard names **`grid`** (compact collection) and **`page`** (full detail):
47
+ every card in every org declares them, so any card matches any template with zero
48
+ mapping. Browse and detail are ONE template — a card taps itself into `page`, the
49
+ name-matched state draws, its ✕ writes it back. RETIRED spellings (legacy-read, never
50
+ author): `parts`, `shapes`, `slots`, `accepts`, `prompt: {component}`, root `director:`.
51
+
52
+ ## The layout: three words, each says HOW a section fills
53
+
54
+ ```yaml
55
+ type: Box
56
+ children:
57
+ - static: components/masthead # placed as designed — nothing writes into it
58
+ - copywriter: components/subject # written into through its briefs (must carry briefs)
59
+ - copywriter: components/body
60
+ - director: # NOT linked: decided from what streams in
61
+ state: grid # arrivals SWITCHED into this state and HELD (flat email);
62
+ limit: 3 # omit to let them keep their own (grid↔page dance)
63
+ rules: >- # ONE home: this section. Marketplace = universal wording;
64
+ The items most relevant to the reader, strongest matches first.
65
+ preview: [ card, card, card ] # Studio's stand-ins until a real run
66
+ - copywriter: components/signoff
67
+ - static: components/footer
68
+ ```
69
+
70
+ - **Link what you know; leave open what the delivery decides.** Never name a
71
+ component in the director section — the delivery decides what arrives (any org's
72
+ cards), and a universal template may carry no client words.
73
+ - **ONE `director:` per template.** Two directed regions = two templates, composed
74
+ by the app (the one-mind boundary, law 9.4).
75
+ - **Never author `ComponentSlot`/`select`/`where` in a template** — the three words
76
+ compile to the wire primitives at serve time; the SDK stays dumb.
77
+ - Linked parts preview THEMSELVES (their mock content lives in the component, once);
78
+ `preview:` exists only on the director section.
79
+ - `limit` is the hard cap, machine-enforced; `rules` are soft, brief-style English.
80
+ - **One home for the director's brain: its section.** Marketplace templates ship
81
+ UNIVERSAL rules (the reader's relevance — never client words); an org wanting
82
+ bespoke judgment ships its own template. No placement grant.
83
+
84
+ ## Template-local components
85
+
86
+ Parts that exist only for this template live in its `components/` folder as FLAT
87
+ FILES (`components/masthead.yaml`), unprefixed, with NO manifest — a manifest is
88
+ discovery, and a local part is never discovered — and NO state tree: the face IS
89
+ the filename (`body.yaml` → face `body`), so a one-face part is just props + root. Each is a REAL component (own face
90
+ named for itself; briefed ones compile into the copywriter's MCP tool schema).
91
+ Addressed `<template>/<part>` (`email-digest/masthead`) when a global ref is needed.
92
+ Genuinely universal pieces (`card`) stay in the marketplace.
93
+
94
+ ## `manifest.yaml`
95
+
96
+ ```yaml
97
+ description: "What it is, for a human."
98
+ whenToUse: "Ranked against user intent — outcome-first, in the reader's words."
99
+ category: Communication
100
+ version: 1.0.0
101
+ ```
102
+
103
+ Nothing else. `whenToUse` is embedded and ranked, not read — follow
104
+ [node-discoverability](https://docs.unoverse.ai/nodes/node-discoverability.md).
105
+ Quote any string containing `: ` (a bare colon is a YAML parse error, and per-entry
106
+ isolation makes the template silently vanish from the catalogue).
107
+
108
+ ## Placement: how a template gets used (§12)
109
+
110
+ The template does not name its app; the app places it. In the app state's layout:
111
+
112
+ ```yaml
113
+ - type: Template
114
+ name: courses # the app state this place belongs to
115
+ template: grid-page # WHAT it holds
116
+ appWidth: flex # a place declares its width ONCE
117
+ ```
118
+
119
+ The placement JUST PLACES — the director's rules live in the template (one home).
120
+ An org wanting bespoke judgment ships its own template. (The placement `director:`
121
+ grant is RETIRED; the live BPP mount's grant migrates.)
122
+
123
+ Empty collapses: a place holding nothing draws nothing, frame included.
124
+
125
+ ## Before you're done
126
+
127
+ - [ ] `type: template`, kebab-case name matching the folder; `states:` with explicit layout paths
128
+ - [ ] Every layout section is one of the three words; exactly ONE `director:` in the template
129
+ - [ ] No client words, no component names in the director section, no retired spellings
130
+ - [ ] Copywriter sections link components that actually carry briefs
131
+ - [ ] Template-only parts live in `components/`, unprefixed
132
+ - [ ] `manifest.yaml`: description, whenToUse, category, version — nothing else
133
+ - [ ] Tokens only; previewed in Studio's **Templates** screen at multiple widths