diff --git a/.gitignore b/.gitignore index ed0aa68..fc1c3b7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,12 @@ .DS_Store **/.DS_Store +# ── Design provenance: keep the text artifacts (*.dc.html, store.js, *.md, tokens.json) +# but not the heavy binaries (the raw .zip export + screenshot/thumbnail PNGs). ── +design/_imports/**/*.zip +design/_imports/**/*.png +design/_imports/**/*.thumbnail + # ── Python ── __pycache__/ *.py[cod] diff --git a/AGENTS.md b/AGENTS.md index 1a1e93b..e9f46f9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -107,11 +107,27 @@ Subsystem rules live in `docs/guides/` and lazy-load in Claude Code via `.claude ## Current state -_**Box live at v0.1.0:94**; `main` (pushed through `ee9db64`) ahead by mobile Phases 0–5 + drag-reorder views — **all deploy-pending** (no s9pk built yet). **The fundraising grid + email capture is the canonical system of record.** Active thread: **mobile-first redesign** — **all 4 mobile surfaces done (P0–P5)**, **P6 light theme next** (then P3b name/pill edit + deploy). Per-phase detail + backlog: `ROADMAP.md` / `EVALUATION.md`; history: git log + `start9/0.4/startos/versions/`._ +_**Box live at v0.1.0:94**; `main` (pushed through `ee9db64`) ahead by mobile Phases 0–5 + drag-reorder views + **P6 light theme (uncommitted, this session)** — **all deploy-pending** (no s9pk built yet). **The fundraising grid + email capture is the canonical system of record.** Active thread: **mobile-first redesign** — **all 4 mobile surfaces + the light theme done (P0–P6)**; next is **P3b name/pill edit**, a **full design-conformance pass (new Phase 7)**, then **deploy**. Per-phase detail + backlog: `ROADMAP.md` / `EVALUATION.md`; history: git log + `start9/0.4/startos/versions/`._ - **Mobile redesign — all 4 core surfaces built + committed (Grid · Contacts · Pipeline · Reminders).** Each is a rules-of-hooks-safe `useIsMobile()` wrapper → `Mobile*`/`Desktop*` pair (**desktop untouched**), re-authored against the real API on shared primitives ``/`useIsMobile()`/`StageChip`/`MobileDetailRow`. Foundation: bottom-tab bar + `:root` mobile vars (P1); 4-stage enum + read-only derived grid signals (`existing_investor`/`last_activity_at`/`staleness`/`opportunity_id`) injected on GET, **stripped on write at both points** (P0/P3a `_computed_row_values` + `stripComputedRows`). **Mobile writes use one-row endpoints only — never whole-grid PUT** (BRIEF §3a). Per-phase detail in `ROADMAP.md`. -- **This session (`ee9db64`, no backend change):** **P4 Pipeline** (`MobilePipeline` = CSS scroll-snap swipe-between-stages + segmented control + dots, per-card ‹/› move + tap→detail w/ stage sheet; shares `PATCH /api/opportunities/{id}/stage`; view+advance-only) + **P5 Reminders** (`MobileReminders` = urgency-grouped list over `/api/reminders` + Active/Done/All filter; `ReminderRow` pointer-drag **swipe-left=done / swipe-right=snooze +7d**; tap→create/edit sheet). Verified: render-smoke + jsdom-375px harness (12/12 each); reviewer-passed (notably **P5 `pointercancel` no longer fires a spurious mark-done**). Reusable swipe-test technique noted in memory. +- **This session — P6 light theme (uncommitted, frontend-only).** App-wide light theme behind + `:root[data-theme="light"]`; **dark stays default** (pre-paint boot script in `` reads + `localStorage.venture_crm_theme`; no `prefers-color-scheme`). **App-wide toggle:** labeled control + in the desktop sidebar footer + sun/moon icon in the mobile top bar, both off one `theme` state in + `App`. Color pairs taken from the **full Claude Design export** (`design/_imports/2026-06-19_zip-file/`, + with the previously-missing `store.js` + `*App.dc.html` `DCLogic` palettes) — exact dark+light for + every stage/recency/note/priority/reminder/money tint. **Method = zero dark regression by + construction:** grew `:root` to 44 themed slots whose **dark values == the originals byte-for-byte** + (verified), then migrated **319 hex→`var()`** (script for structural; targeted edits for semantic/ + chip helpers — `StageChip` now className-based, `PIPELINE_STAGE_CHIP` removed). Mobile surfaces + + chrome are fully var-based → **mobile light complete**. **Desktop light rough edges** (bespoke + ` + +
+
Ten31 CRM — Contacts, mobile
+
People-first directory (distinct from the org-centric Grid). Search by name, email, or firm; tap a contact for their detail — email, organization (stage, committed, last-contact staleness), and a quick Log communication. Existing-LP contacts carry a blue avatar ring + the corner earmark on their org. The top-bar pencil opens the same quick-log. Both phones are live; shown in dark and light.
+
+ +
+
Dark mode · default
+
+
+ +
+
+
+ +
+
Light mode
+
+
+ +
+
+
+ +
+
+ + + + diff --git a/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/ContactsApp.dc.html b/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/ContactsApp.dc.html new file mode 100644 index 0000000..40b06b6 --- /dev/null +++ b/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/ContactsApp.dc.html @@ -0,0 +1,489 @@ + + + + + + + + + + + + + +
+ + +
+ 9:41 + 5G ▮▮▮▯ 84% +
+ + +
+ ·Ten31· +
+ + + +
+
+ + +
+
+ Contacts + {{ countLabel }} +
+ +
+ + +
+ +
{{ g.letter }}
+
+ + + +
+
+ +
No contacts match.
+
+
+ + +
+ + + +
+ + + +
+
+
+
Grant Gilliam
+
grant@ten31.xyz
+
+
+
Profile
+
Log out
+
+
+
+
+ + + +
+
+
+
+ +
+ {{ d.initials }} +
+
{{ d.name }}
+
{{ d.org }}
+
+
+ + + + + +
+ + +
+ + +
Organization
+
+
+ + + {{ d.org }} + + {{ d.stage }} +
+
+ + Committed + {{ d.amount }} + + + Last contact + {{ d.last }} + +
+ +
+ {{ d.noteType }} + {{ d.noteSummary }} +
+
+ +
+
+
+
+
+ + + +
+
+
+
+ Log communication + +
+
+ {{ logBody }} +
+
+
+
+ + + +
+ {{ toast }} +
+
+ +
+
+ + + diff --git a/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/Existing-LP Flag Options.dc.html b/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/Existing-LP Flag Options.dc.html new file mode 100644 index 0000000..29e8c38 --- /dev/null +++ b/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/Existing-LP Flag Options.dc.html @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + +
+
Existing-investor flag — three treatments
+
All in the single blue accent, on the same Main Fundraising list (existing LPs: Northwall, Cedarline, Polaris, Meridian, Granite). Pick one and I'll lock it in across both themes; the others stay one prop-flip away.
+
+ +
+
A · Star by name (current)
+
+
+ +
+
+
Inline ★ before the name. Lightest touch, zero extra height, but quietest.
+
+ +
+
B · Corner earmark
+
+
+ +
+
+
Folded blue triangle in the top-left corner. Scannable down the left edge, no height cost.
+
+ +
+
C · Thin top banner
+
+
+ +
+
+
Slim accent bar across the card top. Most assertive — strongest "special to us," heaviest on a dense list.
+
+ +
+
+
+ + + diff --git a/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/Font Options.dc.html b/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/Font Options.dc.html new file mode 100644 index 0000000..fdda520 --- /dev/null +++ b/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/Font Options.dc.html @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + +
+
Type exploration — Fundraising Grid
+
Same screen, three type pairings (UI sans + the mono that carries every number, date and badge). The current IBM Plex on the left; two alternatives that keep the serious, engineered, financial-instrument character. All three are live and identical apart from type — scan the names, the mono $ figures, and the uppercase badges. Nothing else changed.
+ +
+ +
+
+
Current · IBM Plex
+
IBM Plex Sans + IBM Plex Mono
+
+
+
+ +
+
+
+ +
+
+
Option B · Manrope
+
Manrope + JetBrains Mono
+
+
+
+ +
+
+
+ +
+
+
Option C · Hanken Grotesk
+
Hanken Grotesk + Spline Sans Mono
+
+
+
+ +
+
+
+ +
+
+
+ + diff --git a/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/Fundraising Grid Mobile.dc.html b/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/Fundraising Grid Mobile.dc.html new file mode 100644 index 0000000..29f1517 --- /dev/null +++ b/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/Fundraising Grid Mobile.dc.html @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + +
+
Ten31 CRM — Fundraising Grid, mobile
+
Mobile-preferred redesign of the system-of-record grid. Same Ten31 language, IBM Plex faces, tinted badges — re-laid-out as a compact card list → full-screen detail with drag-to-dismiss bottom sheets, behind a 4-tab bottom bar. Both phones are fully live (tap a card, open a view, log a note, add an investor) and carry a one-tap theme toggle (◑) in the top bar — shown here in dark and light.
+
+ +
+
Dark mode · default
+
+
+ +
+
+
+ +
+
Light mode
+
+
+ +
+
+
+ +
+
+
+ + diff --git a/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/GridApp.dc.html b/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/GridApp.dc.html new file mode 100644 index 0000000..caea64f --- /dev/null +++ b/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/GridApp.dc.html @@ -0,0 +1,827 @@ + + + + + + + + + + + + + +
+ + +
+ 9:41 + 5G ▮▮▮▯ 84% +
+ + +
+ ·Ten31· +
+ + + +
+
+ + +
+ + +
+ +
+ {{ listCountLabel }} + +
+ +
+ + +
+ +
+ + + + + +
No investors match this view.
+
+
+
+
+ + +
+
{{ otherIcon }}
+
{{ otherTitle }}
+
This surface is part of the mobile set — designed next, after the Grid is signed off.
+ +
+
+ +
+ + +
+ + + +
+ + + +
+
+
+
Grant Gilliam
+
grant@ten31.xyz
+
+
+
Profile
+
Log out
+
+
+
+
+ + + +
+
+
+
Switch view
+
+ + + +
+
+
+
+ + + +
+
+
+ +
+
+
+
{{ inv.name }}
+ +
+
+ + Priority + + + Existing LP + + Last contact {{ inv.lastText }} +
+ +
+
Pipeline stage
+ +
+ +
+
+ Contacts + +
+
+ + + + +
No contacts yet — add one to enable pipeline linking.
+
+
+
+ +
+
+ Commitments + read-only +
+
+ +
+ {{ f.name }} + {{ f.amt }} +
+
+
+ Total invested + {{ inv.total }} +
+
+
+ +
+
Reminder
+ +
+ +
+
+ Notes / communication + +
+
+ +
+
+ + +
+
+
+ {{ n.type }} + {{ n.date }} +
+
{{ n.summary }}
+
+
+
+ +
No activity logged yet.
+
+
+
+
+
+
+ + + +
+
+
+
+ {{ sheetTitle }} + +
+
+ {{ sheetBody }} +
+
+
+
+ + + +
+ {{ toast }} +
+
+ +
+
+ + + diff --git a/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/Pipeline Mobile.dc.html b/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/Pipeline Mobile.dc.html new file mode 100644 index 0000000..a83523e --- /dev/null +++ b/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/Pipeline Mobile.dc.html @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + +
+
Ten31 CRM — Pipeline, mobile
+
Canonical Pipeline — swipe between stages. Same shell, data, and theme system as the Grid. Both phones are live: tap a stage chip (or swipe) to move between stages, advance a deal with the inline ‹ / ›, or tap a card for its detail — quick stage move, full activity timeline, and + Log to record a communication right here. Shown in dark and light.
+
+ +
+
Swipe stages · dark (default)
+
+
+ +
+
+
One stage fills the screen; horizontal snap + a sticky segmented control. Tap a card to view its activity and log a new communication.
+
+ +
+
Swipe stages · light
+
+
+ +
+
+
Same surface, light theme — toggle in-app with the ☀/☾ control in the top bar.
+
+ +
+
+
+ + diff --git a/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/PipelineApp.dc.html b/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/PipelineApp.dc.html new file mode 100644 index 0000000..2591e3e --- /dev/null +++ b/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/PipelineApp.dc.html @@ -0,0 +1,661 @@ + + + + + + + + + + + + + +
+ + +
+ 9:41 + 5G ▮▮▮▯ 84% +
+ + +
+ ·Ten31· +
+ + +
+
+ + +
+
+ Pipeline + {{ totalLabel }} +
+ +
+ + + + +
+
+ + + +
+
+ + +
+ +
+
+ + {{ col.label }} + {{ col.count }} + + {{ col.sum }} +
+
+ +
+ +
+ + +
+
+
+ +
No investors in this stage.
+
+
+
+
+
+
+ + + +
+
+ + + +
+ +
+ + +
+ +
+ +
+ + +
+
+
+ +
No investors in this stage.
+
+
+
+
+
+
+
+ + +
+ + + +
+ + + +
+
+
+
Grant Gilliam
+
grant@ten31.xyz
+
+
+
Profile
+
Log out
+
+
+
+
+ + + +
+
+
+
+
+ {{ d.name }} + + Priority + Existing LP + Last contact {{ d.last }} + +
+ +
+ +
+
+
+ Committed + {{ d.amount }} +
+
+ Contacts + {{ d.contactLine }} +
+
+ +
Move stage
+
+ + + +
+ +
+ Notes / communication + +
+
+ +
+
+ + +
+
+
+ {{ n.type }} + {{ n.date }} +
+
{{ n.summary }}
+
+
+
+ +
No activity logged yet.
+
+
+ +
Stage moves and logged communications both write to the shared opportunities row — the same data the Grid edits.
+
+
+
+
+ + + +
+
+
+
+ Log communication + +
+
{{ logFor }}
+
+
Type
+
+ + + +
+
Summary
+ +
Details
+ +
+ + +
+
+
+
+
+ + + +
+
+
+
Sort within stage
+
+ + + +
+
+
+
+ + + +
+ {{ toast }} +
+
+ +
+
+ + + diff --git a/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/Reminders Mobile.dc.html b/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/Reminders Mobile.dc.html new file mode 100644 index 0000000..09feb89 --- /dev/null +++ b/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/Reminders Mobile.dc.html @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + +
+
Ten31 CRM — Reminders, mobile
+
Swipe a card left to complete, right to snooze (a checkmark or clock arms as you drag; release past the line to fire) — snooze opens a duration picker. Tap a card to edit (note, due, delete, jump to the investor). Follow-ups are grouped by urgency — Overdue, Today, This week, Later — in the Grid's staleness colors; + adds one against any investor. Both phones live; dark and light.
+
+ +
+
Dark mode · default
+
+
+ +
+
+
+ +
+
Light mode
+
+
+ +
+
+
+ +
+
+
+ + + diff --git a/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/RemindersApp.dc.html b/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/RemindersApp.dc.html new file mode 100644 index 0000000..0dcfa14 --- /dev/null +++ b/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/RemindersApp.dc.html @@ -0,0 +1,474 @@ + + + + + + + + + + + + + +
+ + +
+ 9:41 + 5G ▮▮▮▯ 84% +
+ + +
+ ·Ten31· +
+ + +
+
+ + +
+
+ Reminders + {{ summary }} +
+ +
+ + +
+ +
+
+ + {{ sec.label }} + {{ sec.count }} +
+
+ +
+ +
+ + Snooze +
+ +
+ Complete + +
+ +
+ {{ r.note }} + + {{ r.org }} + {{ r.dueText }} + +
+
+
+
+
+
+ + +
+ + Inbox zero + No open reminders. Nice. +
+
+ + + +
+ + +
+ +
+ + +
+
+
+
+
+
+
+ + +
+ + + +
+ + + +
+
+
+
Grant Gilliam
+
grant@ten31.xyz
+
+
+
Profile
+
Log out
+
+
+
+
+ + + +
+
+
+
+ {{ sheetTitle }} + +
+
+ {{ sheetBody }} +
+
+
+
+ + + +
+ {{ toast }} +
+
+ +
+
+ + + diff --git a/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/Ten31 Mobile.dc.html b/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/Ten31 Mobile.dc.html new file mode 100644 index 0000000..2eeaed4 --- /dev/null +++ b/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/Ten31 Mobile.dc.html @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + +
+
Ten31 CRM — mobile prototype
+
All four surfaces in one navigable app. The bottom tab bar switches between Grid, Pipeline, Reminders, and Contacts; theme and data are shared — a stage move, a logged communication, or a reminder edit on one tab shows up on the others. Tap around.
+
+
+
Ten31 CRM · {{ tabLabel }}
+
+
+ + + + + + + + + + + + +
+
+
+
+
+
+ + + diff --git a/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/store.js b/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/store.js new file mode 100644 index 0000000..913bc3f --- /dev/null +++ b/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/store.js @@ -0,0 +1,145 @@ +/* Ten31 CRM — shared client store (single source of truth across the four mobile surfaces). + Mirrors the server model: investors carry stage/notes/funds/contacts/priority/last_activity; + reminders are their own collection keyed by investor. One canonical copy so a stage move, + logged communication, or reminder edit on any tab is reflected on every other tab. + Installed as a window singleton so it survives child-surface remounts within the shell. */ +(function () { + if (window.T31Store) return; + + var C = function (name, email) { return { name: name, email: email }; }; + + function seedInvestors() { + return [ + { id: 1, name: 'Northwall Capital', priority: true, stage: 'commitment', daysAgo: 2, + contacts: [C('Dana Reyes', 'dana@northwall.com'), C('Per Holt', 'per@northwall.com')], + funds: [['Ten31 Terahash', 1500000], ['Sats and Stats', 600000], ['Join the Fold', 400000]], + views: ['Main Fundraising', 'All Investors'], + notes: [['Email', 'Confirmed $2.5M allocation across funds', '2026-06-17'], ['Meeting', 'DD call — covered redemption terms', '2026-06-10']] }, + { id: 2, name: 'Brightseed Partners', priority: true, stage: 'engaged', daysAgo: 5, + contacts: [C('Omar Said', 'omar@brightseed.vc')], funds: [['Ten31 Terahash', 0]], + views: ['Main Fundraising', 'Follow-up List'], notes: [['Note', 'Intro from Polaris — warm', '2026-06-14']] }, + { id: 3, name: 'Cedarline Family Office', priority: false, stage: 'commitment', daysAgo: 7, + contacts: [C('Lena Cho', 'lena@cedarline.com')], funds: [['Ten31 Terahash', 800000], ['Pawn to F4', 400000]], + views: ['Main Fundraising', 'All Investors', 'Fund II investors'], notes: [['Call', 'Wire received, fully funded', '2026-06-12']] }, + { id: 4, name: 'Vance & Co', priority: false, stage: 'engaged', daysAgo: 3, + contacts: [C('Marcus Vance', 'mv@vanceco.com')], funds: [['Ten31 Terahash', 0]], + views: ['Main Fundraising', 'Follow-up List'], notes: [] }, + { id: 5, name: 'Polaris Endowment', priority: true, stage: 'diligence', daysAgo: 1, + contacts: [C('Ruth Almeida', 'ralmeida@polaris.org')], funds: [['Ten31 Terahash', 3000000], ['Sats and Stats', 2000000]], + views: ['Main Fundraising', 'All Investors', 'Follow-up List', 'Fund II investors'], + notes: [['Meeting', 'IC presentation went well', '2026-06-18'], ['Email', 'Sent data room access', '2026-06-15']] }, + { id: 6, name: 'Hartman Group', priority: false, stage: null, daysAgo: 14, + contacts: [], funds: [['Ten31 Terahash', 0]], views: ['Main Fundraising'], notes: [] }, + { id: 7, name: 'Meridian Trust', priority: false, stage: 'commitment', daysAgo: 4, + contacts: [C('Sofia Marin', 'sofia@meridiantrust.com')], funds: [['Ten31 Terahash', 800000]], + views: ['Main Fundraising', 'All Investors'], notes: [['Note', 'Signed side letter', '2026-06-14']] }, + { id: 8, name: 'Atlas Ventures Fund', priority: false, stage: 'engaged', daysAgo: 6, + contacts: [C('Will Tanaka', 'will@atlasvf.com')], funds: [['Ten31 Terahash', 0]], + views: ['Main Fundraising'], notes: [] }, + { id: 9, name: 'K. Whitfield', priority: false, stage: null, daysAgo: 21, + contacts: [C('Kira Whitfield', 'kira@whitfield.io')], funds: [], + views: ['Graveyard'], notes: [['Note', 'No allocation — parked', '2026-05-28']] }, + { id: 10, name: 'Granite Bay LP', priority: false, stage: 'commitment', daysAgo: 30, + contacts: [C('Tom Becker', 'tom@granitebay.com')], funds: [['Ten31 Terahash', 2000000], ['Sats and Stats', 1300000]], + views: ['Main Fundraising', 'All Investors', 'Fund II investors'], notes: [] }, + { id: 11, name: 'Forsythe Holdings', priority: false, stage: 'lead', daysAgo: 35, + contacts: [], funds: [], views: ['Graveyard'], notes: [] } + ]; + } + + function seedReminders() { + return [ + { id: 1, note: 'Resend deck — bounced', orgId: 4, due: '2026-06-18', done: false }, + { id: 2, note: 'Re-engage — cold 2 weeks', orgId: 6, due: '2026-06-16', done: false }, + { id: 3, note: 'IC memo due', orgId: 5, due: '2026-06-19', done: false }, + { id: 4, note: 'Follow up after intro call', orgId: 2, due: '2026-06-19', done: false }, + { id: 5, note: 'Share data room link', orgId: 8, due: '2026-06-20', done: false }, + { id: 6, note: 'Countersign side letter', orgId: 7, due: '2026-06-21', done: false }, + { id: 7, note: 'Send Q2 update deck', orgId: 1, due: '2026-06-24', done: false }, + { id: 8, note: 'Quarterly check-in call', orgId: 3, due: '2026-07-08', done: false }, + { id: 9, note: 'Thank-you note post-wire', orgId: 10, due: '2026-06-13', done: true } + ]; + } + + var MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; + + var store = { + investors: seedInvestors(), + reminders: seedReminders(), + tab: 'grid', + theme: 'dark', + focusInvestorId: null, + today: new Date(2026, 5, 19), + _subs: [], + + subscribe: function (fn) { + this._subs.push(fn); + var self = this; + return function () { self._subs = self._subs.filter(function (f) { return f !== fn; }); }; + }, + _notify: function () { this._subs.slice().forEach(function (f) { try { f(); } catch (e) {} }); }, + + setTab: function (t) { this.tab = t; this._notify(); }, + openInvestor: function (id) { this.focusInvestorId = id; this.tab = 'grid'; this._notify(); }, + setTheme: function (t) { this.theme = t; this._notify(); }, + toggleTheme: function () { this.theme = this.theme === 'light' ? 'dark' : 'light'; this._notify(); }, + + // ----- investor mutations ----- + updateInvestor: function (id, patch) { + this.investors = this.investors.map(function (i) { return i.id === id ? Object.assign({}, i, patch) : i; }); + this._notify(); + }, + logNote: function (id, entry) { + this.investors = this.investors.map(function (i) { return i.id === id ? Object.assign({}, i, { notes: [entry].concat(i.notes), daysAgo: 0 }) : i; }); + this._notify(); + }, + addInvestor: function (inv) { + var id = this.investors.reduce(function (m, i) { return Math.max(m, i.id); }, 0) + 1; + var ni = Object.assign({ id: id, priority: false, stage: 'lead', daysAgo: 0, contacts: [], funds: [['Ten31 Terahash', 0]], views: ['Main Fundraising'], notes: [] }, inv); + this.investors = [ni].concat(this.investors); + this._notify(); + return id; + }, + + // ----- reminder mutations ----- + addReminder: function (orgId, note, due) { + var id = this.reminders.reduce(function (m, r) { return Math.max(m, r.id); }, 0) + 1; + this.reminders = [{ id: id, note: note, orgId: orgId, due: due, done: false }].concat(this.reminders); + this._notify(); + return id; + }, + updateReminder: function (id, patch) { + this.reminders = this.reminders.map(function (r) { return r.id === id ? Object.assign({}, r, patch) : r; }); + this._notify(); + }, + deleteReminder: function (id) { + this.reminders = this.reminders.filter(function (r) { return r.id !== id; }); + this._notify(); + }, + toggleReminder: function (id) { + this.reminders = this.reminders.map(function (r) { return r.id === id ? Object.assign({}, r, { done: !r.done }) : r; }); + this._notify(); + }, + reminderFor: function (orgId) { + // the soonest open reminder for an investor (used by the Grid detail) + var open = this.reminders.filter(function (r) { return r.orgId === orgId && !r.done; }); + open.sort(function (a, b) { return a.due < b.due ? -1 : 1; }); + return open[0] || null; + }, + + // ----- derived helpers ----- + investorById: function (id) { return this.investors.find(function (i) { return i.id === id; }); }, + committed: function (i) { return (i.funds || []).reduce(function (a, f) { return a + f[1]; }, 0); }, + money: function (n) { + if (!n) return '$0'; + if (n >= 1e6) return '$' + (n / 1e6).toFixed(n % 1e6 === 0 ? 0 : 1) + 'M'; + if (n >= 1e3) return '$' + Math.round(n / 1e3) + 'K'; + return '$' + n; + }, + parseDate: function (iso) { var p = iso.split('-'); return new Date(+p[0], +p[1] - 1, +p[2]); }, + diffDays: function (iso) { return Math.round((this.parseDate(iso) - this.today) / 86400000); }, + monthDay: function (iso) { var d = this.parseDate(iso); return MONTHS[d.getMonth()] + ' ' + d.getDate(); } + }; + + window.T31Store = store; +})(); diff --git a/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/support.js b/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/support.js new file mode 100644 index 0000000..9b71e07 --- /dev/null +++ b/design/_imports/2026-06-19_zip-file/Venture-CRM mobile redesign/support.js @@ -0,0 +1,1513 @@ +// GENERATED from dc-runtime/src/*.ts — do not edit. Rebuild with `cd dc-runtime && bun run build`. +"use strict"; +(() => { + var __defProp = Object.defineProperty; + var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); + + // src/react.ts + function getReact() { + const R = window.React; + if (!R) throw new Error("dc-runtime: window.React is not available yet"); + return R; + } + function getReactDOM() { + const RD = window.ReactDOM; + if (!RD) throw new Error("dc-runtime: window.ReactDOM is not available yet"); + return RD; + } + var h = ((...args) => getReact().createElement( + ...args + )); + + // src/parse.ts + function parseDcDocument(doc) { + const dc = doc.querySelector("x-dc"); + if (!dc) return null; + const scriptEl = doc.querySelector("script[data-dc-script]"); + const { props, preview } = parseDataProps( + scriptEl?.getAttribute("data-props") ?? null + ); + return { + template: dc.innerHTML, + js: scriptEl ? scriptEl.textContent || "" : "", + props, + preview + }; + } + function parseDcText(src) { + const openMatch = /]*)?>/.exec(src); + if (!openMatch) return null; + const close = src.lastIndexOf(""); + if (close === -1 || close < openMatch.index) return null; + const template = src.slice(openMatch.index + openMatch[0].length, close); + const doc = new DOMParser().parseFromString(src, "text/html"); + const scriptEl = doc.querySelector("script[data-dc-script]"); + const { props, preview } = parseDataProps( + scriptEl?.getAttribute("data-props") ?? null + ); + return { + template, + js: scriptEl ? scriptEl.textContent || "" : "", + props, + preview + }; + } + function parseDataProps(raw) { + if (!raw) return { props: null, preview: null }; + let parsed; + try { + parsed = JSON.parse(raw); + } catch { + return { props: null, preview: null }; + } + if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) { + return { props: null, preview: null }; + } + const obj = parsed; + const preview = obj.$preview && typeof obj.$preview === "object" ? obj.$preview : null; + const rest = {}; + for (const k of Object.keys(obj)) { + if (k[0] !== "$") rest[k] = obj[k]; + } + return { props: Object.keys(rest).length ? rest : null, preview }; + } + function dcNameFromPath(pathname) { + let p = pathname || ""; + try { + p = decodeURIComponent(p); + } catch { + } + const base = p.split("/").pop() || "Root"; + return base.replace(/\.dc\.html$/, "").replace(/\.html?$/, "") || "Root"; + } + + // src/boot.ts + var BASE_CSS = ` + .sc-placeholder{background:rgba(255,255,255,.3);border:1px solid rgba(0,0,0,.5); + border-radius:2px;box-sizing:border-box;overflow:hidden} + @keyframes sc-shine{0%{background-position:100% 50%}100%{background-position:0% 50%}} + html.sc-dc-streaming .sc-placeholder, + html.sc-dc-streaming .sc-interp.sc-missing{position:relative; + background:color-mix(in srgb,currentColor 5%,transparent); + border-color:transparent} + html.sc-dc-streaming .sc-placeholder::before, + html.sc-dc-streaming .sc-interp.sc-missing::before{content:''; + position:absolute;inset:0;pointer-events:none; + background:linear-gradient(90deg,rgba(217,119,87,0) 25%,rgba(247,225,211,.95) 37%,rgba(217,119,87,0) 63%); + background-size:400% 100%;animation:sc-shine 1.4s ease infinite} + html.sc-dc-streaming .sc-placeholder:nth-child(n+9 of .sc-placeholder)::before, + html.sc-dc-streaming .sc-interp.sc-missing:nth-child(n+9 of .sc-interp.sc-missing)::before{animation:none; + background:color-mix(in srgb,currentColor 8%,transparent)} + .sc-placeholder-error{padding:4px 8px;font:11px/1.4 ui-monospace,monospace; + color:rgba(0,0,0,.7);word-break:break-word} + .sc-interp.sc-missing{display:inline-block;width:2em;height:1em;overflow:hidden; + vertical-align:text-bottom;background:rgba(255,255,255,.3);border:1px solid rgba(0,0,0,.5); + border-radius:2px;box-sizing:border-box;color:transparent; + user-select:none} + .sc-interp.sc-unresolved{font-family:ui-monospace,monospace;font-size:.85em; + color:rgba(0,0,0,.5);background:rgba(0,0,0,.05);border-radius:3px; + padding:0 3px} + .sc-host.sc-has-error{position:relative} + .sc-logic-error{position:absolute;top:8px;left:8px;z-index:2147483647;max-width:60ch; + padding:6px 10px;background:#b00020;color:#fff;font:12px/1.4 ui-monospace,monospace; + border-radius:4px;white-space:pre-wrap;pointer-events:none} + /* Mirrors PRINT_BASELINE_CSS in apps/web deck-stage-export.ts \u2014 keep both + in sync until dc-runtime regains a build step. */ + @media print { + @page { margin: 0.5cm; } + section, article, figure, table { break-inside: avoid; } + *, *::before, *::after { + print-color-adjust: exact; -webkit-print-color-adjust: exact; + backdrop-filter: none !important; -webkit-backdrop-filter: none !important; + animation-delay: -99s !important; animation-duration: .001s !important; + animation-iteration-count: 1 !important; animation-fill-mode: both !important; + animation-play-state: running !important; transition-duration: 0s !important; + } + } + `; + var FULL_PAGE_CSS = "html,body{height:100%;margin:0}#dc-root,#dc-root>.sc-host{height:100%}"; + function rootNameForDocument(doc, loc) { + let bootPath = loc.pathname || ""; + if (!/\.dc\.html?$/i.test(safeDecode(bootPath))) { + try { + bootPath = new URL(doc.baseURI || "/").pathname; + } catch { + } + } + return dcNameFromPath(bootPath); + } + function safeDecode(s) { + try { + return decodeURIComponent(s); + } catch { + return s; + } + } + function boot(runtime, doc = document) { + const parsed = parseDcDocument(doc); + if (!parsed) return null; + const React = getReact(); + const rootName = rootNameForDocument(doc, location); + runtime.markFetched(rootName); + runtime.adoptParsed(rootName, parsed); + fetch(location.href).then((res) => res.ok ? res.text() : "").then((t) => { + const raw = t ? parseDcText(t) : null; + if (raw?.template) runtime.updateHtml(rootName, raw.template); + }).catch(() => { + }); + const dc = doc.querySelector("x-dc"); + const hostEl = doc.createElement("div"); + hostEl.id = "dc-root"; + dc.replaceWith(hostEl); + if (!parsed.preview) { + const s = doc.createElement("style"); + s.textContent = FULL_PAGE_CSS; + doc.head.appendChild(s); + } + const Root = runtime.getDC(rootName); + const entry = runtime.registry.get(rootName); + function StandaloneRoot() { + const [, setTick] = React.useState(0); + React.useEffect(() => { + const sub = () => setTick((n) => n + 1); + entry.subs.add(sub); + return () => { + entry.subs.delete(sub); + }; + }, []); + return h(Root, entry.propOverrides || null); + } + const ReactDOM = getReactDOM(); + if (ReactDOM.createRoot) + ReactDOM.createRoot(hostEl).render(h(StandaloneRoot)); + else ReactDOM.render(h(StandaloneRoot), hostEl); + return rootName; + } + + // src/expr.ts + var IDENT_RE = /^[A-Za-z_$][A-Za-z0-9_$]*/; + var NUMBER_RE = /^-?\d+(\.\d+)?$/; + function resolve(vals, src) { + const expr = String(src).trim(); + if (!expr) return void 0; + if (expr[0] === "(" && expr[expr.length - 1] === ")" && parensWrapWhole(expr)) { + return resolve(vals, expr.slice(1, -1)); + } + const eq = findTopLevelEquality(expr); + if (eq) { + const lv = resolve(vals, expr.slice(0, eq.index)); + const rv = resolve(vals, expr.slice(eq.index + eq.op.length)); + switch (eq.op) { + case "===": + return lv === rv; + case "!==": + return lv !== rv; + case "==": + return lv == rv; + default: + return lv != rv; + } + } + if (expr[0] === "!") return !resolve(vals, expr.slice(1)); + if (expr === "true") return true; + if (expr === "false") return false; + if (expr === "null") return null; + if (expr === "undefined") return void 0; + if (NUMBER_RE.test(expr)) return Number(expr); + if (expr.length >= 2 && (expr[0] === '"' || expr[0] === "'") && expr[expr.length - 1] === expr[0]) { + return expr.slice(1, -1); + } + return resolvePath(vals, expr); + } + function parensWrapWhole(expr) { + let depth = 0; + for (let i = 0; i < expr.length - 1; i++) { + if (expr[i] === "(") depth++; + else if (expr[i] === ")") { + depth--; + if (depth === 0) return false; + } + } + return true; + } + function findTopLevelEquality(expr) { + let depth = 0; + for (let i = 0; i < expr.length; i++) { + const c = expr[i]; + if (c === "[" || c === "(") depth++; + else if (c === "]" || c === ")") depth--; + else if (depth === 0 && (c === "=" || c === "!") && expr[i + 1] === "=") { + if (i > 0 && (expr[i - 1] === "=" || expr[i - 1] === "!")) continue; + if (!expr.slice(0, i).trim()) continue; + const op = expr[i + 2] === "=" ? c + "==" : c + "="; + return { index: i, op }; + } + } + return null; + } + function resolvePath(vals, expr) { + const head = expr.match(IDENT_RE); + if (!head) return void 0; + let cur = vals == null ? void 0 : vals[head[0]]; + let i = head[0].length; + while (i < expr.length) { + if (expr[i] === ".") { + const m = expr.slice(i + 1).match(IDENT_RE) || expr.slice(i + 1).match(/^\d+/); + if (!m) return void 0; + cur = cur == null ? void 0 : cur[m[0]]; + i += 1 + m[0].length; + } else if (expr[i] === "[") { + let depth = 1; + let j = i + 1; + while (j < expr.length && depth > 0) { + if (expr[j] === "[") depth++; + else if (expr[j] === "]") { + depth--; + if (depth === 0) break; + } + j++; + } + if (depth !== 0) return void 0; + const key = resolve(vals, expr.slice(i + 1, j)); + cur = cur == null ? void 0 : cur[key]; + i = j + 1; + } else { + return void 0; + } + } + return cur; + } + + // src/encode.ts + var CAMEL_ATTR = "sc-camel-"; + var RAW_WRAP = { + select: "sc-raw-select", + table: "sc-raw-table", + tbody: "sc-raw-tbody", + thead: "sc-raw-thead", + tfoot: "sc-raw-tfoot", + tr: "sc-raw-tr", + td: "sc-raw-td", + th: "sc-raw-th", + caption: "sc-raw-caption" + }; + var RAW_UNWRAP = Object.fromEntries( + Object.entries(RAW_WRAP).map(([k, v]) => [v, k]) + ); + var EVENT_MAP = { + onclick: "onClick", + onchange: "onChange", + oninput: "onInput", + onsubmit: "onSubmit", + onkeydown: "onKeyDown", + onkeyup: "onKeyUp", + onkeypress: "onKeyPress", + onmousedown: "onMouseDown", + onmouseup: "onMouseUp", + onmouseenter: "onMouseEnter", + onmouseleave: "onMouseLeave", + onfocus: "onFocus", + onblur: "onBlur", + ondoubleclick: "onDoubleClick", + oncontextmenu: "onContextMenu" + }; + var ATTRS = `(?:[^>"']|"[^"]*"|'[^']*')*`; + var IMPORT_SELF_CLOSE_RE = new RegExp( + "<(x-import|dc-import)(" + ATTRS + ")/>", + "gi" + ); + var CAMEL_ATTR_RE = /(\s)([a-z]+[A-Z][A-Za-z0-9]*)(\s*=)/g; + function encodeCase(html) { + html = html.replace( + IMPORT_SELF_CLOSE_RE, + (_, t, a) => "<" + t + a + ">" + ); + html = html.replace(/)/gi, "/gi, ""); + html = html.replace( + CAMEL_ATTR_RE, + (_, sp, name, eq) => sp + CAMEL_ATTR + name.replace(/[A-Z]/g, (c) => "-" + c.toLowerCase()) + eq + ); + for (const [real, alias] of Object.entries(RAW_WRAP)) { + html = html.replace( + new RegExp("(])", "gi"), + "$1" + alias + ); + } + return html; + } + function kebabToCamel(s) { + return s.replace(/-([a-z])/g, (_, c) => c.toUpperCase()); + } + function cssToObj(css) { + const o = {}; + for (const decl of css.split(";")) { + const i = decl.indexOf(":"); + if (i < 0) continue; + const prop = decl.slice(0, i).trim(); + o[prop.startsWith("--") ? prop : kebabToCamel(prop)] = decl.slice(i + 1).trim(); + } + return o; + } + function compileAttr(raw) { + const whole = raw.match(/^\s*\{\{([\s\S]+?)\}\}\s*$/); + if (whole) { + const path = whole[1]; + return (vals) => resolve(vals, path); + } + if (raw.includes("{{")) { + const parts = raw.split(/\{\{([\s\S]+?)\}\}/g); + return (vals) => parts.map((s, i) => i & 1 ? resolve(vals, s) ?? "" : s).join(""); + } + return () => raw; + } + + // src/compile.ts + function collectProps(node, isComponent, host) { + const propGetters = []; + const pseudoClasses = []; + let hintSize = null; + for (const { name, value } of [...node.attributes]) { + if (name === "sc-name" || name === "data-dc-tpl") continue; + let key = name; + if (key.startsWith(CAMEL_ATTR)) + key = kebabToCamel(key.slice(CAMEL_ATTR.length)); + if (key === "hint-size") { + hintSize = value; + continue; + } + if (key.startsWith("style-")) { + pseudoClasses.push(host.pseudoClass(key.slice(6), value)); + continue; + } + if (isComponent) { + if (key.includes("-")) key = kebabToCamel(key); + } else { + if (key === "class") key = "className"; + else if (key === "for") key = "htmlFor"; + else if (key.startsWith("on")) + key = EVENT_MAP[key] || "on" + key[2].toUpperCase() + key.slice(3); + } + propGetters.push([key, compileAttr(value)]); + } + return { propGetters, pseudoClasses, hintSize }; + } + var HOST_STYLE_PROPS = /* @__PURE__ */ new Set([ + "position", + "left", + "right", + "top", + "bottom", + "inset", + "width", + "height", + "z-index", + "transform" + ]); + function hostPositionStyle(style) { + const all = typeof style === "string" ? cssToObj(style) : style != null && typeof style === "object" ? style : null; + if (!all) return void 0; + const out = {}; + for (const [k, v] of Object.entries(all)) { + const kebab = k.replace(/[A-Z]/g, (c) => "-" + c.toLowerCase()); + if (HOST_STYLE_PROPS.has(kebab)) out[k] = v; + } + return Object.keys(out).length ? out : void 0; + } + function compileTemplate(html, host) { + const tpl = document.createElement("template"); + //! nosemgrep: direct-inner-html-assignment + tpl.innerHTML = encodeCase(html); + let tplN = 0; + (function stamp(node) { + if (node.nodeType === Node.ELEMENT_NODE) { + node.setAttribute("data-dc-tpl", String(tplN++)); + } + for (const c of node.childNodes) stamp(c); + })(tpl.content); + const builders = walkChildren(tpl.content, host); + const render = ((vals, ctx) => builders.map((b, i) => b(vals || {}, ctx, i))); + render.__annotated = tpl.innerHTML; + return render; + } + function walkChildren(node, host) { + return [...node.childNodes].map((c) => walk(c, host)).filter((b) => b != null); + } + function walk(node, host) { + if (node.nodeType === Node.TEXT_NODE) return walkText(node); + if (node.nodeType !== Node.ELEMENT_NODE) return null; + const el = node; + const tag = el.tagName.toLowerCase(); + if (tag === "sc-for") return walkFor(el, host); + if (tag === "sc-if") return walkIf(el, host); + if (tag === "x-import") return walkXImport(el, host); + if (tag === "sc-helmet") return host.helmet(el); + if (tag === "dc-import") return walkComponent(el, host); + return walkElement(el, host); + } + var warnedHoles = /* @__PURE__ */ new Set(); + function warnUnresolved(ctx, what) { + const key = (ctx?.__name || "?") + "\0" + what; + if (warnedHoles.has(key)) return; + warnedHoles.add(key); + console.warn("[dc-runtime] " + (ctx?.__name || "template") + ": " + what); + } + function walkText(node) { + const txt = node.nodeValue ?? ""; + if (!txt.includes("{{")) { + if (!txt.trim() && !txt.includes(" ")) return null; + return () => txt; + } + const parts = txt.split(/\{\{([\s\S]+?)\}\}/g); + return (vals, ctx, key) => h( + getReact().Fragment, + { key }, + ...parts.map((p, i) => { + if (!(i & 1)) return p; + const v = resolve(vals, p); + if (v === void 0) { + if (!ctx?.__streamingNow) { + if (document.body?.hasAttribute("data-dc-editor-on")) { + return h( + "span", + { key: i, className: "sc-interp sc-unresolved" }, + "{{ " + p.trim() + " }}" + ); + } + warnUnresolved( + ctx, + "{{ " + p.trim() + " }} never resolved \u2014 rendered as empty" + ); + return null; + } + return h( + "span", + { key: i, className: "sc-interp sc-missing" }, + p.trim() + ); + } + if (getReact().isValidElement(v) || Array.isArray(v)) { + return h(getReact().Fragment, { key: i }, v); + } + if (v === null || typeof v === "boolean") return null; + return h("span", { key: i, className: "sc-interp" }, String(v)); + }) + ); + } + function walkFor(el, host) { + const listGet = compileAttr(el.getAttribute("list") || ""); + const asName = el.getAttribute("as") || "item"; + const hintN = parseInt(el.getAttribute("hint-placeholder-count") || "0", 10); + const kids = walkChildren(el, host); + const listSrc = el.getAttribute("list") || ""; + return (vals, ctx, key) => { + let list = listGet(vals); + if (!Array.isArray(list)) { + if (!ctx?.__streamingNow) { + if (list !== void 0 && list !== null) { + warnUnresolved( + ctx, + 'sc-for list="' + listSrc + '" is not an array (' + typeof list + ")" + ); + } + list = []; + } else { + list = hintN > 0 ? Array(hintN).fill(void 0) : []; + } + } + return h( + getReact().Fragment, + { key }, + list.map((item, i) => { + const sub = { ...vals, [asName]: item, $index: i }; + return h( + getReact().Fragment, + { key: i }, + kids.map((b, j) => b(sub, ctx, j)) + ); + }) + ); + }; + } + function walkIf(el, host) { + const valGet = compileAttr(el.getAttribute("value") || ""); + const hintRaw = el.getAttribute("hint-placeholder-val"); + const hintGet = hintRaw != null ? compileAttr(hintRaw) : null; + const kids = walkChildren(el, host); + return (vals, ctx, key) => { + let v = valGet(vals); + if (v === void 0 && hintGet && ctx?.__streamingNow) v = hintGet(vals); + return v ? h( + getReact().Fragment, + { key }, + kids.map((b, j) => b(vals, ctx, j)) + ) : null; + }; + } + function walkComponent(el, host) { + const name = el.getAttribute("name") || el.getAttribute("component") || ""; + el.removeAttribute("name"); + el.removeAttribute("component"); + const tplId = el.getAttribute("data-dc-tpl"); + const styleRaw = el.getAttribute("style"); + el.removeAttribute("style"); + const styleGet = styleRaw != null ? compileAttr(styleRaw) : null; + const { propGetters, hintSize } = collectProps(el, true, host); + const kids = walkChildren(el, host); + return (vals, ctx, key) => { + const props = { + key, + __hintSize: hintSize, + __tplId: tplId, + __hostStyle: styleGet ? hostPositionStyle(styleGet(vals)) : void 0 + }; + for (const [k, g] of propGetters) props[k] = g(vals); + if (kids.length) props.children = kids.map((b, j) => b(vals, ctx, j)); + return h(host.component(name), props); + }; + } + function walkXImport(el, host) { + const globalNameGet = compileAttr( + el.getAttribute("component-from-global-scope") || "" + ); + const exportNameGet = compileAttr( + el.getAttribute("component") || el.getAttribute("name") || "" + ); + const url = el.getAttribute("from") || el.getAttribute("src") || el.getAttribute("import") || ""; + const kind = /\.(jsx|tsx)(\?|#|$)/i.test(url) ? "jsx" : "js"; + const tplId = el.getAttribute("data-dc-tpl"); + const styleRaw = el.getAttribute("style"); + el.removeAttribute("style"); + const styleGet = styleRaw != null ? compileAttr(styleRaw) : null; + const wrap = tplId != null || styleGet != null; + const { propGetters, hintSize } = collectProps(el, true, host); + const hasContent = el.children.length > 0 || !!(el.textContent || "").trim(); + const kids = hasContent ? walkChildren(el, host) : []; + const urlBindable = url.includes("{{"); + if (url && !urlBindable) host.loadExternal(kind, url); + const evalName = (g, vals) => { + const v = g(vals); + const s = v == null ? "" : String(v); + return s.includes("{{") ? "" : s; + }; + return (vals, ctx, key) => { + const globalName = evalName(globalNameGet, vals); + const name = globalName || evalName(exportNameGet, vals); + const C = !name || urlBindable ? null : globalName ? host.resolveExternalGlobal(url, globalName) : host.resolveExternal(url, name); + const hostStyle = styleGet ? hostPositionStyle(styleGet(vals)) : void 0; + const wrapper = wrap ? { + key, + className: "sc-host-x", + "data-dc-tpl": tplId, + style: hostStyle || { display: "contents" } + } : null; + if (!C) { + const error = urlBindable ? "x-import `from` cannot contain {{ \u2026 }} \u2014 module URLs are resolved at parse time; use a literal URL" : host.resolveExternalError(url, name); + const ph = host.placeholder({ + key: wrapper ? void 0 : key, + name, + hintSize, + error + }); + return wrapper ? h("div", wrapper, ph) : ph; + } + const props = wrapper ? {} : { key }; + let unresolvedHole = false; + for (const [k, g] of propGetters) { + if (k === "component" || k === "componentFromGlobalScope" || k === "name" || k === "from" || k === "src" || k === "import") { + continue; + } + const v = g(vals); + if (v === void 0) unresolvedHole = true; + props[k] = v; + } + if (unresolvedHole && ctx?.__htmlStreamingNow) { + const ph = host.placeholder({ + key: wrapper ? void 0 : key, + name, + hintSize, + error: null + }); + return wrapper ? h("div", wrapper, ph) : ph; + } + if (kids.length) props.children = kids.map((b, j) => b(vals, ctx, j)); + return wrapper ? h("div", wrapper, h(C, props)) : h(C, props); + }; + } + function walkElement(el, host) { + const realTag = RAW_UNWRAP[el.localName] || el.localName; + const tplId = el.getAttribute("data-dc-tpl"); + const { propGetters, pseudoClasses } = collectProps(el, false, host); + const kids = walkChildren(el, host); + return (vals, ctx, key) => { + const props = { key, "data-dc-tpl": tplId }; + for (const [k, g] of propGetters) { + let v = g(vals); + if (k === "style" && typeof v === "string") v = cssToObj(v); + if ((k === "value" || k === "checked") && v === void 0) { + v = k === "checked" ? false : ""; + } + props[k] = v; + } + if (pseudoClasses.length) { + props.className = [props.className, ...pseudoClasses].filter(Boolean).join(" "); + } + return h(realTag, props, ...kids.map((b, j) => b(vals, ctx, j))); + }; + } + + // src/logic.ts + var StreamableLogic = class { + constructor(props) { + __publicField(this, "props"); + __publicField(this, "state", {}); + /** Back-pointer to the wrapper component, installed after construction. */ + __publicField(this, "__host"); + this.props = props || {}; + } + setState(update, cb) { + this.__host && this.__host.__setLogicState(update, cb); + } + forceUpdate() { + this.__host && this.__host.forceUpdate(); + } + componentDidMount() { + } + componentDidUpdate(_prevProps) { + } + componentWillUnmount() { + } + /** The flat object the template renders against (merged over props). */ + renderVals() { + return {}; + } + }; + function evalDcLogic(src) { + //! nosemgrep: eval-and-function-constructor + const fn = new Function( + "DCLogic", + "StreamableLogic", + "React", + src + '\n;return (typeof Component!=="undefined"&&Component)||undefined;' + ); + return fn(StreamableLogic, StreamableLogic, getReact()); + } + + // src/component.ts + function shallowEqual(a, b) { + if (!b) return false; + const ak = Object.keys(a).filter((k) => k !== "children"); + const bk = Object.keys(b).filter((k) => k !== "children"); + if (ak.length !== bk.length) return false; + for (const k of ak) if (a[k] !== b[k]) return false; + return true; + } + function Placeholder({ + name, + hintSize, + streaming, + error + }) { + const [w, hgt] = (hintSize || "100%,60px").split(","); + return h( + "div", + { + className: "sc-placeholder" + (streaming ? " sc-streaming" : ""), + style: { width: w.trim(), height: hgt && hgt.trim() }, + title: name + }, + error ? h( + "div", + { className: "sc-placeholder-error" }, + (name ? name + ": " : "") + error + ) : null + ); + } + function hintToMin(hint) { + if (!hint) return void 0; + const [w, hgt] = hint.split(","); + return { minWidth: w.trim(), minHeight: hgt && hgt.trim() }; + } + function createComponentFactory(registry, ensureFetched) { + const React = getReact(); + const AncestorContext = React.createContext([]); + class StreamableComponent extends React.Component { + constructor(props) { + super(props); + __publicField(this, "__name"); + __publicField(this, "__sub"); + __publicField(this, "__needsDidMount", false); + /** Snapshot of the registry's streaming flags taken at render time — + * builders read it off the RenderCtx (this) to pick placeholder vs + * render-nothing for unresolved values. */ + __publicField(this, "__streamingNow", false); + __publicField(this, "__htmlStreamingNow", false); + /** When a construct throws, remember the (class, registry.ver, props) + * triple so render-time reconcile doesn't re-attempt it on every parent + * re-render. A registry bump (new class, template, external module + * resolving via bumpAll) changes `ver` and breaks the memo so an + * env-dependent constructor can self-heal. */ + __publicField(this, "__failedLogic", null); + __publicField(this, "__failedUserProps", null); + __publicField(this, "__failedVer", -1); + /** Per-instance constructor error — kept here (not on the registry entry) + * so one instance's successful construct can't hide a sibling's failure, + * and a construct can never wipe an eval error `updateJs` recorded on + * `r.logicError`. */ + __publicField(this, "__ctorError", null); + __publicField(this, "logic"); + this.__name = props.__name; + this.state = { __v: 0, __err: null }; + this.__sub = () => { + if (this.state.__err) this.setState({ __err: null }); + this.forceUpdate(); + }; + this.__makeLogic(registry.get(this.__name).Logic, null); + ensureFetched(this.__name); + } + /** Error-boundary hook: a render crash anywhere in this DC's subtree + * (its own template, an x-import'd component, a child DC without its + * own deeper boundary) lands here instead of unmounting the page. */ + static getDerivedStateFromError(e) { + return { __err: e instanceof Error && e.message ? e.message : String(e) }; + } + componentDidCatch(e, info) { + console.error( + "[dc-runtime] render error in <" + this.__name + ">:", + e, + info?.componentStack || "" + ); + } + /** Instantiate the logic class (or the no-op base) and adopt `prevState` + * over its initial state — used both at mount and on hot-swap. */ + __makeLogic(Logic, prevState) { + const L = Logic || StreamableLogic; + try { + this.logic = new L(this.__userProps()); + this.__failedLogic = null; + this.__failedUserProps = null; + this.__ctorError = null; + } catch (e) { + console.error(e); + this.__failedLogic = Logic; + this.__failedUserProps = this.__userProps(); + this.__failedVer = registry.get(this.__name).ver; + this.__ctorError = this.__name + ": " + (e instanceof Error && e.message ? e.message : String(e)); + this.logic = new StreamableLogic( + this.__userProps() + ); + } + this.logic.__host = this; + if (prevState) + this.logic.state = { ...this.logic.state || {}, ...prevState }; + } + /** The props the author's logic + template see — internal __-prefixed + * wiring stripped. */ + __userProps() { + const { __name, __hintSize, __tplId, __hostStyle, ...rest } = this.props; + return rest; + } + __setLogicState(update, cb) { + const prev = this.logic.state; + const patch = typeof update === "function" ? update(prev) : update; + this.logic.state = { ...prev, ...patch }; + this.setState((s) => ({ __v: s.__v + 1 }), cb); + } + /** Swap the logic instance when the registry's Logic class changed + * (streaming completion, hot reload). State carries over; didMount + * re-fires after the swap commits so refs exist. */ + __reconcileLogic() { + const r = registry.get(this.__name); + const Next = r.Logic; + const Cur = this.logic.constructor; + if (Next === Cur || !Next && Cur === StreamableLogic || Next === this.__failedLogic && r.ver === this.__failedVer && shallowEqual(this.__userProps(), this.__failedUserProps)) { + return; + } + if (!this.__needsDidMount) { + try { + this.logic.componentWillUnmount(); + } catch (e) { + console.error(e); + } + } + this.__makeLogic(Next, this.logic.state); + this.__needsDidMount = true; + } + componentDidMount() { + registry.get(this.__name).subs.add(this.__sub); + try { + this.logic.componentDidMount(); + } catch (e) { + console.error(e); + } + } + componentDidUpdate(prevProps) { + this.logic.props = this.__userProps(); + if (this.__needsDidMount) { + if (this.state.__err || !registry.get(this.__name).tpl) return; + this.__needsDidMount = false; + try { + this.logic.componentDidMount(); + } catch (e) { + console.error(e); + } + } else { + try { + this.logic.componentDidUpdate(prevProps); + } catch (e) { + console.error(e); + } + } + } + componentWillUnmount() { + registry.get(this.__name).subs.delete(this.__sub); + if (!this.__needsDidMount) { + try { + this.logic.componentWillUnmount(); + } catch (e) { + console.error(e); + } + } + } + render() { + const r = registry.get(this.__name); + const cls = "sc-host" + (r.htmlStreaming ? " sc-streaming-html" : "") + (r.jsStreaming ? " sc-streaming-js" : ""); + const hintStyle = r.htmlStreaming ? hintToMin(this.props.__hintSize) : void 0; + const hostStyle = this.props.__hostStyle || hintStyle ? { ...hintStyle || {}, ...this.props.__hostStyle || {} } : void 0; + const hostBase = { + className: cls, + style: hostStyle, + "data-sc-name": this.__name, + "data-dc-tpl": this.props.__tplId + }; + const chain = Array.isArray(this.context) ? this.context : []; + if (chain.includes(this.__name)) { + const cycle = [ + ...chain.slice(chain.indexOf(this.__name)), + this.__name + ].join(" \u2192 "); + return h( + "div", + { ...hostBase, className: cls + " sc-has-error" }, + h(Placeholder, { + name: this.__name, + hintSize: this.props.__hintSize, + error: "circular import: " + cycle + }) + ); + } + if (this.state.__err) { + return h( + "div", + { ...hostBase, className: cls + " sc-has-error" }, + h( + "div", + { className: "sc-logic-error" }, + this.__name + ": " + this.state.__err + ), + h(Placeholder, { + name: this.__name, + hintSize: this.props.__hintSize, + error: this.state.__err + }) + ); + } + this.__reconcileLogic(); + if (!r.tpl) { + return h( + "div", + hostBase, + h(Placeholder, { name: this.__name, hintSize: this.props.__hintSize }) + ); + } + const userProps = this.__userProps(); + this.logic.props = userProps; + let vals = userProps; + let renderErr = r.logicError || this.__ctorError; + try { + vals = { ...userProps, ...this.logic.renderVals() || {} }; + } catch (e) { + console.error(e); + renderErr = this.__name + ".renderVals(): " + (e instanceof Error && e.message ? e.message : String(e)); + } + this.__streamingNow = !!(r.htmlStreaming || r.jsStreaming); + this.__htmlStreamingNow = !!r.htmlStreaming; + return h( + "div", + { ...hostBase, className: cls + (renderErr ? " sc-has-error" : "") }, + renderErr && h("div", { className: "sc-logic-error" }, renderErr), + h( + AncestorContext.Provider, + { value: [...chain, this.__name] }, + r.tpl(vals, this) + ) + ); + } + } + __publicField(StreamableComponent, "contextType", AncestorContext); + const named = /* @__PURE__ */ new Map(); + function getDC(name) { + const hit = named.get(name); + if (hit) return hit; + function Dispatcher(p) { + const [, setTick] = React.useState(0); + React.useEffect(() => { + const sub = () => setTick((n) => n + 1); + registry.get(name).subs.add(sub); + return () => { + registry.get(name).subs.delete(sub); + }; + }, []); + ensureFetched(name); + return h(StreamableComponent, { ...p, __name: name }); + } + Dispatcher.displayName = name; + named.set(name, Dispatcher); + return Dispatcher; + } + return { + getDC, + StreamableComponent + }; + } + + // src/external.ts + var isCustomElementName = (n) => !n.includes(".") && n.includes("-"); + function isRenderableType(g) { + if (typeof g === "function") return !isElementClass(g); + return typeof g === "object" && g !== null && typeof g.$$typeof === "symbol"; + } + function resolveDottedPath(root, name) { + let cur = root; + for (const seg of name.split(".")) { + if (cur == null) return void 0; + cur = cur[seg]; + } + return cur; + } + var BABEL_URL = "https://unpkg.com/@babel/standalone@7.26.4/babel.min.js"; + var GLOBAL_POLL_INTERVAL_MS = 50; + var GLOBAL_POLL_TIMEOUT_MS = 3e4; + function createExternalModules(onResolved) { + const cache = /* @__PURE__ */ new Map(); + let babelLoading = null; + const reportedMissing = /* @__PURE__ */ new Map(); + const polling = /* @__PURE__ */ new Set(); + function ensureBabel() { + if (window.Babel) return Promise.resolve(); + if (babelLoading) return babelLoading; + babelLoading = new Promise((res, rej) => { + const s = document.createElement("script"); + s.src = BABEL_URL; + s.crossOrigin = "anonymous"; + s.onload = () => res(); + s.onerror = rej; + document.head.appendChild(s); + }); + return babelLoading; + } + function load(kind, url) { + if (cache.has(url)) return; + cache.set(url, null); + console.info("[dc-runtime] x-import: loading", url, "(" + kind + ")"); + const ready = kind === "jsx" ? ensureBabel() : Promise.resolve(); + ready.then(() => fetch(url)).then((r) => { + if (!r.ok) throw new Error("HTTP " + r.status); + return r.text(); + }).then((src) => { + const code = kind === "jsx" ? window.Babel.transform(src, { + filename: url, + presets: ["react", "typescript"] + }).code : src; + const module = { exports: {} }; + const before = new Set(Object.keys(window)); + //! nosemgrep: eval-and-function-constructor + new Function("React", "module", "exports", "require", code)( + getReact(), + module, + module.exports, + () => ({}) + ); + const globals = {}; + for (const k of Object.keys(window)) { + if (!before.has(k) && typeof window[k] === "function") { + globals[k] = window[k]; + } + } + cache.set(url, { mod: module.exports, globals }); + console.info( + "[dc-runtime] x-import: loaded", + url, + "\u2014 exports:", + Object.keys(module.exports), + "window globals:", + Object.keys(globals) + ); + onResolved(); + }).catch((e) => { + cache.set(url, { + mod: {}, + globals: {}, + error: "failed to load: " + (e instanceof Error && e.message ? e.message : String(e)) + }); + console.error( + "[dc-runtime] x-import: FAILED to load", + url, + "(" + kind + ")", + e + ); + onResolved(); + }); + } + function resolve2(url, name) { + const entry = cache.get(url); + if (!entry) return null; + const { mod, globals } = entry; + const C = mod && mod[name] || globals && globals[name] || typeof window !== "undefined" && window[name] || mod && mod.default; + if (typeof C === "function") return C; + const key = url + "\0" + name; + if (!reportedMissing.has(key)) { + reportedMissing.set( + key, + entry.error || 'no export named "' + name + '" (has: ' + Object.keys(mod).join(", ") + ")" + ); + console.error( + "[dc-runtime] x-import: module", + url, + "loaded but has no component named", + JSON.stringify(name), + "\u2014 available exports:", + Object.keys(mod), + "window globals:", + Object.keys(globals), + ". The module must `module.exports = {" + name + "}` or set `window." + name + "`." + ); + } + return null; + } + function waitForGlobal(name) { + if (polling.has(name)) return; + polling.add(name); + const started = Date.now(); + const isCE = isCustomElementName(name); + const tick = () => { + const found = isCE ? customElements.get(name) : isRenderableType(resolveDottedPath(window, name)); + if (found) { + polling.delete(name); + onResolved(); + return; + } + if (Date.now() - started >= GLOBAL_POLL_TIMEOUT_MS) { + console.warn( + "[dc-runtime] x-import: global", + JSON.stringify(name), + "never appeared on window after " + GLOBAL_POLL_TIMEOUT_MS + "ms" + ); + return; + } + setTimeout(tick, GLOBAL_POLL_INTERVAL_MS); + }; + setTimeout(tick, GLOBAL_POLL_INTERVAL_MS); + } + function resolveGlobal(url, name) { + const isCE = isCustomElementName(name); + if (!url) { + if (isCE) { + if (customElements.get(name)) return name; + waitForGlobal(name); + return null; + } + const g2 = resolveDottedPath(window, name); + if (isRenderableType(g2)) return g2; + waitForGlobal(name); + return null; + } + const entry = cache.get(url); + if (!entry) return null; + if (isCE && customElements.get(name)) return name; + const g = entry.globals[name] ?? resolveDottedPath(window, name); + if (isRenderableType(g)) return g; + if (name.includes(".")) return null; + const key = url + "\0global\0" + name; + if (!reportedMissing.has(key)) { + reportedMissing.set(key, null); + if (isCE && !customElements.get(name)) { + console.warn( + "[dc-runtime] x-import:", + url, + "loaded but no custom element", + JSON.stringify(name), + "is registered and window." + name + " is not a function \u2014 rendering <" + name + "> as an unknown element." + ); + } + } + return name; + } + function getError(url, name) { + const entry = cache.get(url); + if (entry?.error) return entry.error; + return reportedMissing.get(url + "\0" + name) || null; + } + return { load, resolve: resolve2, resolveGlobal, getError }; + } + function isElementClass(g) { + try { + return typeof g === "function" && typeof HTMLElement !== "undefined" && g.prototype instanceof HTMLElement; + } catch { + return false; + } + } + + // src/helmet.ts + function createHelmetManager(doc, isStreaming) { + const mounted = /* @__PURE__ */ new Set(); + const live = /* @__PURE__ */ new Map(); + function compile(node) { + const raw = [...node.children]; + const helmetClosed = node.nextSibling != null || node.parentNode?.nextSibling != null; + return (_vals, ctx) => { + const name = ctx && ctx.__name || ""; + const streaming = !!(name && isStreaming(name)); + for (let i = 0; i < raw.length; i++) { + const child = raw[i]; + const tag = child.tagName; + const mayBePartial = streaming && !helmetClosed && i === raw.length - 1; + if (tag === "SCRIPT") { + if (mayBePartial) continue; + const key = "SCRIPT|" + (child.getAttribute("src") || child.textContent || ""); + if (mounted.has(key)) continue; + mounted.add(key); + const el = doc.createElement("script"); + for (const { name: an, value } of [...child.attributes]) + el.setAttribute(an, value); + if (child.textContent) el.textContent = child.textContent; + doc.head.appendChild(el); + } else if (tag === "LINK" || tag === "META") { + if (mayBePartial) continue; + const key = tag + "|" + (child.getAttribute("href") || child.getAttribute("src") || child.outerHTML); + if (mounted.has(key)) continue; + mounted.add(key); + doc.head.appendChild(child.cloneNode(true)); + } else { + const key = name + "|" + i; + let el = live.get(key); + if (!el || el.tagName !== tag) { + if (el) el.remove(); + el = doc.createElement(tag.toLowerCase()); + live.set(key, el); + doc.head.appendChild(el); + } + for (const { name: an, value } of [...child.attributes]) { + if (el.getAttribute(an) !== value) el.setAttribute(an, value); + } + if (el.textContent !== child.textContent) + el.textContent = child.textContent; + } + } + return null; + }; + } + return { compile }; + } + + // src/pseudo.ts + function createPseudoSheet(doc) { + let el = null; + const cache = /* @__PURE__ */ new Map(); + let n = 0; + return (pseudo, css) => { + const k = pseudo + "|" + css; + const hit = cache.get(k); + if (hit) return hit; + if (!el) { + el = doc.createElement("style"); + doc.head.appendChild(el); + } + const cls = "scp" + (n++).toString(36); + const sel = pseudo === "before" || pseudo === "after" ? "." + cls + "::" + pseudo : "." + cls + ":" + pseudo; + el.sheet.insertRule(sel + "{" + css + "}", el.sheet.cssRules.length); + cache.set(k, cls); + return cls; + }; + } + + // src/registry.ts + function createRegistry() { + const entries = /* @__PURE__ */ Object.create(null); + function get(name) { + return entries[name] || (entries[name] = { + html: "", + tpl: null, + Logic: null, + jsStreaming: false, + htmlStreaming: false, + ver: 0, + subs: /* @__PURE__ */ new Set(), + fetched: false + }); + } + function bump(name) { + const r = get(name); + r.ver++; + for (const fn of r.subs) fn(); + } + return { + entries, + get, + bump, + bumpAll() { + for (const n in entries) bump(n); + } + }; + } + + // src/runtime.ts + var COMPONENT_DIR = "."; + function createRuntime(doc = document) { + const registry = createRegistry(); + const pseudoClass = createPseudoSheet(doc); + const helmet = createHelmetManager( + doc, + (name) => registry.get(name).htmlStreaming + ); + const external = createExternalModules(() => registry.bumpAll()); + const factory = createComponentFactory(registry, ensureFetched); + const host = { + component: (name) => factory.getDC(name), + placeholder: (props) => h(Placeholder, props), + helmet: (node) => helmet.compile(node), + loadExternal: (kind, url) => external.load(kind, url), + resolveExternal: (url, name) => external.resolve(url, name), + resolveExternalGlobal: (url, name) => external.resolveGlobal(url, name), + resolveExternalError: (url, name) => external.getError(url, name), + pseudoClass + }; + function ensureFetched(name) { + const r = registry.get(name); + if (r.fetched) return; + r.fetched = true; + const url = COMPONENT_DIR + "/" + encodeURIComponent(name) + ".dc.html"; + fetch(url).then((res) => { + if (!res.ok) { + console.error( + "[dc-runtime] sibling fetch for <" + name + "/> failed:", + url, + "returned", + res.status, + "\u2014 the reference renders as an empty placeholder." + ); + return ""; + } + return res.text(); + }).then((t) => { + if (!t) return; + const parsed = parseDcText(t); + if (!parsed) { + console.error( + "[dc-runtime] sibling fetch for <" + name + "/>:", + url, + "has no block \u2014 not a Design Component." + ); + return; + } + if (parsed.props) r.propsMeta = parsed.props; + if (parsed.preview) r.preview = parsed.preview; + if (parsed.template && !r.html) updateHtml(name, parsed.template); + if (parsed.js && !r.Logic) updateJs(name, parsed.js); + }).catch( + (e) => console.error( + "[dc-runtime] sibling fetch for <" + name + "/> threw:", + url, + e + ) + ); + } + function updateHtml(name, html) { + const r = registry.get(name); + r.html = html; + try { + r.tpl = compileTemplate(html, host); + } catch (e) { + console.error("[dc-runtime] template compile FAILED for", name, e); + } + registry.bump(name); + } + function updateJs(name, src) { + const r = registry.get(name); + const seq = r.jsSeq = (r.jsSeq || 0) + 1; + try { + const Cls = evalDcLogic(src); + if (r.jsSeq !== seq) return; + if (typeof Cls !== "function") { + r.logicError = name + ".dc.html: + +