@unoverse-platform/studio 0.1.87 → 0.1.89
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/package.json
CHANGED
|
@@ -201,28 +201,53 @@ export function TemplatesLibraryView({ theme, org }: { theme: ResolvedTheme; org
|
|
|
201
201
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
202
202
|
}, [storeVersion, store, current]);
|
|
203
203
|
|
|
204
|
+
// GROUPED BY CATEGORY, exactly as Components groups its rail — the shelf is no longer a
|
|
205
|
+
// flat list the moment small templates land on it (the `Blocks` shelf: pair, feature,
|
|
206
|
+
// single, rail, stack, statement) and a page has to be found among them. The category is
|
|
207
|
+
// the DOMAIN of the job, so the grouping reads as what a template is FOR. Within a
|
|
208
|
+
// category the developer's own list first, ownership marked per item rather than by
|
|
209
|
+
// section — the org chip says "yours"; no chip means the base shelf.
|
|
210
|
+
const byCategory = Object.entries(
|
|
211
|
+
templates.reduce<Record<string, TemplateDef[]>>((acc, t) => {
|
|
212
|
+
(acc[t.category ?? "Uncategorized"] ??= []).push(t);
|
|
213
|
+
return acc;
|
|
214
|
+
}, {}),
|
|
215
|
+
).sort(([a], [b]) => a.localeCompare(b));
|
|
216
|
+
for (const [, items] of byCategory) items.sort((a, b) => (a.org ? 0 : 1) - (b.org ? 0 : 1));
|
|
217
|
+
|
|
204
218
|
return (
|
|
205
219
|
<div className={SCREEN}>
|
|
206
|
-
{/* NAVIGATOR — per-item org chip
|
|
220
|
+
{/* NAVIGATOR — grouped by category, per-item org chip: no chip = BASE shelf. */}
|
|
207
221
|
<nav className={NAV}>
|
|
208
222
|
{templates.length === 0 && (
|
|
209
223
|
<div className="p-2 text-xs text-gray-400">
|
|
210
224
|
No templates — restart the Unoverse server so /dev/templates is available.
|
|
211
225
|
</div>
|
|
212
226
|
)}
|
|
213
|
-
{
|
|
214
|
-
<div key={
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
>
|
|
219
|
-
<span className="
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
227
|
+
{byCategory.map(([cat, items]) => (
|
|
228
|
+
<div key={cat} className="mb-3">
|
|
229
|
+
{/* The same group header Components draws: a hairline that fades right lifts the
|
|
230
|
+
label without adding weight, and wider tracking reads as a label rather than
|
|
231
|
+
another item. One anatomy across the workbench's rails. */}
|
|
232
|
+
<div className="mb-1 mt-1 flex items-center gap-2 px-2">
|
|
233
|
+
<span className="text-[10px] font-medium uppercase tracking-[0.14em] text-gray-400">{cat}</span>
|
|
234
|
+
<span className="h-px flex-1 bg-gradient-to-r from-gray-500/40 to-transparent" />
|
|
235
|
+
</div>
|
|
236
|
+
{items.map((t) => (
|
|
237
|
+
<div key={refOf(t)}>
|
|
238
|
+
<button
|
|
239
|
+
onClick={() => setSelected(refOf(t))}
|
|
240
|
+
className={`flex w-full items-center gap-2 rounded px-2 py-1 text-left text-sm transition ${navItem(selected === refOf(t))}`}
|
|
241
|
+
>
|
|
242
|
+
<span className="truncate">{t.title ?? t.name}</span>
|
|
243
|
+
{t.org && (
|
|
244
|
+
<span className="ml-auto shrink-0 rounded bg-emerald-900/50 px-1.5 py-0.5 text-[10px] text-emerald-300">
|
|
245
|
+
{t.org}
|
|
246
|
+
</span>
|
|
247
|
+
)}
|
|
248
|
+
</button>
|
|
249
|
+
</div>
|
|
250
|
+
))}
|
|
226
251
|
</div>
|
|
227
252
|
))}
|
|
228
253
|
</nav>
|
package/vendor/sdk/lib/app.tsx
CHANGED
|
@@ -144,10 +144,10 @@ function collectSlotPointers(node: unknown, store: ComponentStore, scope?: Set<s
|
|
|
144
144
|
const out: string[] = [];
|
|
145
145
|
const walk = (n: unknown): void => {
|
|
146
146
|
if (!n || typeof n !== "object") return;
|
|
147
|
-
const un = n as UnoverseNode & { children?: unknown[];
|
|
147
|
+
const un = n as UnoverseNode & { children?: unknown[]; item?: unknown; frame?: unknown; cases?: Record<string, unknown> };
|
|
148
148
|
if (un.type === "ComponentSlot") out.push(...selectPointers(store, un, scope));
|
|
149
149
|
(un.children ?? []).forEach(walk);
|
|
150
|
-
if (un.
|
|
150
|
+
if (un.item) walk(un.item);
|
|
151
151
|
if (un.frame) walk(un.frame);
|
|
152
152
|
if (un.cases) Object.values(un.cases).forEach(walk);
|
|
153
153
|
};
|
|
@@ -331,11 +331,11 @@ export function StreamedUnoverseApp({ client, store, uri, onAction, theme: theme
|
|
|
331
331
|
*/
|
|
332
332
|
const tstate = store.getAppState() as Record<string, unknown>;
|
|
333
333
|
const dismissedRaw = tstate.latchDismissed;
|
|
334
|
-
const held = def ? resolveLatch(def, store, typeof dismissedRaw === "string" ? dismissedRaw : undefined) : null;
|
|
334
|
+
const held = def ? resolveLatch(def, store, ladder.view, typeof dismissedRaw === "string" ? dismissedRaw : undefined) : null;
|
|
335
335
|
useEffect(() => {
|
|
336
336
|
if (dismissedRaw === true) {
|
|
337
337
|
// Resolve the bare flag against whoever holds it RIGHT NOW, then re-derive.
|
|
338
|
-
const current = def ? resolveLatch(def, store) : null;
|
|
338
|
+
const current = def ? resolveLatch(def, store, ladder.view) : null;
|
|
339
339
|
store.mergeAppState({ latchDismissed: current ? current.key : "" });
|
|
340
340
|
return;
|
|
341
341
|
}
|
|
@@ -353,6 +353,7 @@ export function StreamedUnoverseApp({ client, store, uri, onAction, theme: theme
|
|
|
353
353
|
held?.key,
|
|
354
354
|
held?.latch,
|
|
355
355
|
dismissedRaw,
|
|
356
|
+
ladder.view,
|
|
356
357
|
def,
|
|
357
358
|
store,
|
|
358
359
|
tstate.latched,
|
|
@@ -279,11 +279,17 @@ export function resolveActiveView(
|
|
|
279
279
|
* holder or null, so two latches are not a bug to prevent but a state that cannot be
|
|
280
280
|
* represented.
|
|
281
281
|
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
*
|
|
282
|
+
* THE HOLDER MUST BE THE STATE ON SCREEN, which is why `active` is a required argument
|
|
283
|
+
* rather than something derived again here. Being ON the ladder is not enough: an app whose
|
|
284
|
+
* ladder is [page, perfect-day] shows `page` the moment a card arrives wearing that face,
|
|
285
|
+
* and the composed page — still live, still ranked, just not showing — went on holding the
|
|
286
|
+
* latch. The guest then reads a pill naming a page that is nowhere on screen and types into
|
|
287
|
+
* it (observed live 2026-08-31: three search cards took the surface and "Your Perfect Day"
|
|
288
|
+
* stayed up over them). A pill is a promise about what the words will reach.
|
|
289
|
+
*
|
|
290
|
+
* SAME WALK AS `resolveActiveView` otherwise: the highest-ranked wins, ties going to the
|
|
291
|
+
* most recent write. So a page retracted to `inline` (superseded by an arrival, released by
|
|
292
|
+
* `cancelBelow`, closed by the guest) silently stops holding it too.
|
|
287
293
|
*
|
|
288
294
|
* Returns the FULL key. `chatId` alone reaches the turn, not the component inside it: a
|
|
289
295
|
* turn carrying two components would hydrate the wrong one.
|
|
@@ -291,12 +297,18 @@ export function resolveActiveView(
|
|
|
291
297
|
export function resolveLatch(
|
|
292
298
|
def: UnoverseDefinition | null | undefined,
|
|
293
299
|
store: ComponentStore,
|
|
300
|
+
/** The state the app is ACTUALLY showing (`resolveActiveView().view`). Empty = nothing is
|
|
301
|
+
* surfaced, so nothing can be addressed. */
|
|
302
|
+
active: string,
|
|
294
303
|
dismissed?: string,
|
|
295
304
|
): { key: string; chatId: string; nodeId: string; latch: { title: string; icon?: string }; view: string } | null {
|
|
296
305
|
const order = def?.stateOrder?.length ? def.stateOrder : undefined;
|
|
297
306
|
if (!order) return null; // no ladder, no ranking — abstain rather than guess a holder
|
|
298
307
|
const latches = def?.latches;
|
|
299
308
|
if (!latches || !Object.keys(latches).length) return null; // no state is addressable here
|
|
309
|
+
// WHAT IS ON SCREEN, first: an addressable state that is not the active one is not being
|
|
310
|
+
// shown, and a pill over someone else's surface points at nothing the guest can see.
|
|
311
|
+
if (!active || !latches[active]) return null;
|
|
300
312
|
// `key` is the component key this candidate came from, carried so the return can name the
|
|
301
313
|
// FULL key (line 269) rather than re-deriving it from chatId, which reaches the turn and
|
|
302
314
|
// not the component inside it.
|
|
@@ -316,9 +328,11 @@ export function resolveLatch(
|
|
|
316
328
|
if (!view) continue;
|
|
317
329
|
const rank = order.indexOf(view);
|
|
318
330
|
if (rank < 0) continue; // not on the surface (inline/retracted): holds nothing
|
|
319
|
-
// THE STATE DECIDES. Same lookup for every instance,
|
|
320
|
-
// addressable and nothing has to be untold — the face
|
|
321
|
-
// question, and a face
|
|
331
|
+
// THE STATE DECIDES, and it must be the state SHOWING. Same lookup for every instance,
|
|
332
|
+
// so nothing has to be told it is addressable and nothing has to be untold — the face
|
|
333
|
+
// it currently wears is the whole question, and a face that is not the active one is
|
|
334
|
+
// not on screen to be addressed.
|
|
335
|
+
if (view !== active) continue;
|
|
322
336
|
const latch = latches[view];
|
|
323
337
|
if (!latch) continue;
|
|
324
338
|
const at = store.touchOf(p);
|
|
@@ -65,7 +65,7 @@ function remapFields(node: AnyNode, propMap: Record<string, string>): void {
|
|
|
65
65
|
for (const v of when as { field?: string }[]) if (v && typeof v.field === "string" && propMap[v.field]) v.field = propMap[v.field];
|
|
66
66
|
}
|
|
67
67
|
if (Array.isArray(node.children)) node.children.forEach((c: AnyNode) => remapFields(c, propMap));
|
|
68
|
-
if (node.
|
|
68
|
+
if (node.item) remapFields(node.item as AnyNode, propMap);
|
|
69
69
|
if (node.cases && typeof node.cases === "object") for (const k of Object.keys(node.cases)) remapFields(node.cases[k] as AnyNode, propMap);
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -102,7 +102,7 @@ function applyLiterals(node: AnyNode, lits: Record<string, unknown>): void {
|
|
|
102
102
|
}
|
|
103
103
|
if (node.style && typeof node.style === "object") applyStyleLiterals(node.style as AnyNode, lits);
|
|
104
104
|
if (Array.isArray(node.children)) node.children.forEach((c: AnyNode) => applyLiterals(c, lits));
|
|
105
|
-
if (node.
|
|
105
|
+
if (node.item) applyLiterals(node.item as AnyNode, lits);
|
|
106
106
|
if (node.cases && typeof node.cases === "object") for (const k of Object.keys(node.cases)) applyLiterals(node.cases[k] as AnyNode, lits);
|
|
107
107
|
}
|
|
108
108
|
|
|
@@ -78,15 +78,18 @@ export interface UnoverseNode {
|
|
|
78
78
|
user?: UnoverseNode;
|
|
79
79
|
/** Timeline: data sub-tree rendered for an assistant turn (its ComponentSlot is scoped to that turn). */
|
|
80
80
|
assistant?: UnoverseNode;
|
|
81
|
-
/**
|
|
82
|
-
*
|
|
83
|
-
* Each: the per-item subtree, rendered once per element of the bound array (`bind.items`),
|
|
81
|
+
/** Each: the per-item subtree, drawn once per element of the bound array (`bind.items`),
|
|
84
82
|
* with that element as its data scope. The node's own `style` is the list container.
|
|
85
83
|
*
|
|
86
|
-
*
|
|
84
|
+
* RENAMED FROM `template` (2026-09-01). One word named two unrelated things — an Each's
|
|
85
|
+
* repeated drawing and a mounted TEMPLATE — and the only way to tell them apart was the
|
|
86
|
+
* shape of the value, which this type spelled out as `UnoverseNode | string`. A reader
|
|
87
|
+
* hitting it in a layout had to work out which; an author writing one had to know both. */
|
|
88
|
+
item?: UnoverseNode;
|
|
89
|
+
/** Template: a STRING naming what the place holds (UNOVERSE_TEMPLATE_MODEL.md — holder
|
|
87
90
|
* grammar, deliberately the same shape as `interface:`), e.g. `template: grid-page`.
|
|
88
|
-
*
|
|
89
|
-
template?:
|
|
91
|
+
* Unmoved by the rename above: here the word names a template. */
|
|
92
|
+
template?: string;
|
|
90
93
|
/** Template: the judgment granted to THIS placement — which items the director may select,
|
|
91
94
|
* whether it may order them, and the rules it works to. Opaque to the renderer, which
|
|
92
95
|
* carries it to the loader rather than reading into it; the placed node owns the mount,
|
|
@@ -173,21 +173,21 @@ export function renderNode(
|
|
|
173
173
|
return branch ? renderNode(branch, data, onAction, theme, key, slot, defs) : null;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
// `Each` — control flow: map a bound array (bind.items) → the `
|
|
176
|
+
// `Each` — control flow: map a bound array (bind.items) → the `item` subtree once
|
|
177
177
|
// per item (that item as the data scope), inside the node's own container (a Box).
|
|
178
178
|
// A PRIMITIVE item (string/number — e.g. a `string[]` of follow-up questions) is exposed
|
|
179
|
-
// as `{ value: item }`, so the
|
|
179
|
+
// as `{ value: item }`, so the item binds `value` like any field; object items pass
|
|
180
180
|
// through unchanged. This is what lets an `Each` iterate a plain list of strings.
|
|
181
181
|
if (node.type === "Each") {
|
|
182
182
|
// Literal `items` fallback: a microapp component hardcodes its static option lists
|
|
183
183
|
// in the def (props exist only for state — UNOVERSE_AUTHORING.md). bind wins.
|
|
184
184
|
const src = node.bind?.items ? data[node.bind.items] : node.items;
|
|
185
185
|
const items = Array.isArray(src) ? src : [];
|
|
186
|
-
// `
|
|
186
|
+
// `item` is the Each's repeated drawing (renamed from `template` 2026-09-01: one word for
|
|
187
187
|
// a holder NAME (string) on Template, which this branch never sees. Narrow rather than
|
|
188
188
|
// assert, so a definition that puts the wrong one here renders nothing instead of
|
|
189
189
|
// throwing inside the map.
|
|
190
|
-
const tpl = typeof node.
|
|
190
|
+
const tpl = typeof node.item === "object" ? node.item : undefined;
|
|
191
191
|
// WHERE AN ITEM SITS is something only the renderer knows, and a numbered list cannot
|
|
192
192
|
// be authored without it: the data carries no ordinal, and a template cannot count.
|
|
193
193
|
// `index` is 0-based for logic, `position` 1-based because that is what a reader sees.
|