mirror of
https://github.com/hanzoai/site.git
synced 2026-11-20 21:14:28 +00:00
* Type model, templates, reviews and sms pages under strict Props, state, refs and handlers typed; null guards where the types showed a possible null. creativeData exports Slug. Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Type Kai/Mori/Koe/Uta, research, philosophy, press and risk pages under strict Props, state, refs and handlers typed; ref callbacks no longer return the element. Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Type x-tender, solutions, story, tag, startups, support, newsletter and mcp pages under strict Captured-page trees and docs get shared types. Null-safe reads where a figure has no source or a page has no siblings. Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Type open source, platform, products, operative, trust, sdks and o11y pages under strict Captured-page trees, product docs and org data get shared types. Null guards on refs and canvas contexts; product() throws a clear error for a captured page with no API section. Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Type post, pricing, team, slack, skills, security, tabs and proof pages under strict Live pricing uses the lib Rung/Group/Row types. Null guards on refs and canvas contexts. Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Type models, studio, university, science, referral, operator, network and module pages under strict Model and university data tables get explicit row types; the Opener shape is shared by ModelsPage and Studio. Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Narrow the review entry in its test entry() returns Review | null under strict; the test asserts it is set before use. Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Type the Newsletter send button ref as a button Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Fit the callers of the typed pages to their types Product, solutions and tabs-tree callers use the page types; the open-source snapshot reads lib/oss's own Summary and Activity; the O11y card ref is a list item ref. Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk
22 lines
1.1 KiB
TypeScript
22 lines
1.1 KiB
TypeScript
// Self-check for components/pages/tabsTree.js: closing a pane gives its space to the sibling and leaves every other
|
|
// part of the tree as it was. Usage: node scripts/tabs-tree.test.mjs
|
|
import assert from 'node:assert';
|
|
import { leaf, split, close, leaves } from '../components/pages/tabsTree.ts';
|
|
import type { Layout } from '../components/pages/tabsTree.ts';
|
|
|
|
let t: Layout = leaf('a', 'build');
|
|
t = split(t, 'a', 'row', leaf('b', 'work'), 's1');
|
|
t = split(t, 'b', 'col', leaf('c', 'shell 3'), 's2');
|
|
assert.deepEqual(leaves(t).map((l) => l.name), ['build', 'work', 'shell 3']);
|
|
assert.ok(t.dir);
|
|
const right = t.b;
|
|
const t2 = close(t, 'a'); // build closes: the whole right split takes its place, untouched
|
|
assert.equal(t2, right);
|
|
const t3 = close(t, 'c'); // shell 3 closes: work takes its space, build is the same object
|
|
assert.ok(t3.dir && !t3.b.dir);
|
|
assert.equal(t3.a, t.a);
|
|
assert.equal(t3.b.name, 'work');
|
|
assert.equal(close(leaf('z', 'last'), 'z').id, 'z'); // the last shell stays
|
|
assert.equal(split(t, 'nope', 'row', leaf('d', 'x'), 's3'), t); // unknown id changes nothing
|
|
console.log('tabs-tree: OK');
|