cascivo 1.8.2 → 1.9.0
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/README.md +1 -0
- package/dist/{app-BhCskK3W.mjs → app-Dt98v4Zq.mjs} +3 -3
- package/dist/{app-BhCskK3W.mjs.map → app-Dt98v4Zq.mjs.map} +1 -1
- package/dist/{blueprint-B6Z8NrCr.mjs → blueprint-BBrlwJhm.mjs} +2 -2
- package/dist/{blueprint-B6Z8NrCr.mjs.map → blueprint-BBrlwJhm.mjs.map} +1 -1
- package/dist/cmdspec.json +310 -1
- package/dist/{create-DIaknp48.mjs → create-BMqDBB8r.mjs} +3 -3
- package/dist/{create-DIaknp48.mjs.map → create-BMqDBB8r.mjs.map} +1 -1
- package/dist/design-CYQqMPQB.mjs +3 -0
- package/dist/design-CYQqMPQB.mjs.map +1 -0
- package/dist/generated/audit-contract.json +3 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +70 -33
- package/dist/index.mjs.map +1 -1
- package/dist/skills/cascivo-design/SKILL.md +44 -0
- package/dist/skills/cascivo-design/references/check-rules.md +37 -0
- package/dist/skills/cascivo-design/references/critique-rubric.md +26 -0
- package/dist/skills/cascivo-design/references/direction.md +113 -0
- package/dist/skills/cascivo-design/references/without-cascivo.md +17 -0
- package/package.json +8 -3
- package/readme.body.md +1 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{t as e}from"./fs-B7O-fNID.mjs";import{n as t,t as n}from"./args-B4PN85cC.mjs";import{fileURLToPath as r}from"node:url";import{existsSync as i,readdirSync as a,rmSync as o}from"node:fs";import{dirname as s,join as c,relative as l,resolve as u}from"node:path";import{mkdir as d,readFile as f,writeFile as p}from"node:fs/promises";const m=`cascivo-design`;function h(){let e=s(r(import.meta.url)),t=[c(e,`skills`,m),c(e,`../../../../skills`,m),c(e,`../../skills`,m)].find(e=>i(c(e,`SKILL.md`)));if(!t)throw Error(`The ${m} skill is missing from this install of cascivo.`);return t}function g(e){return a(e,{withFileTypes:!0}).flatMap(t=>t.isDirectory()?g(c(e,t.name)):[c(e,t.name)])}async function _(t){let r=n(t,`dir`);if(r===void 0&&t.some(e=>e===`--dir`||e===`--dir=`))throw Error(`Usage: cascivo design skill [--dir <skills-dir>] [--force]`);let a=t.includes(`--force`),_=u(process.cwd(),r??`.claude/skills`),v=c(_,m);if(i(v)){if(!a)throw Error(`${l(process.cwd(),v)||v} already exists. Pass --force to replace it.`);o(e(_,v),{recursive:!0,force:!0})}let y=h(),b=[];for(let t of g(y)){let n=e(v,c(v,l(y,t)));await d(s(n),{recursive:!0}),await p(n,await f(t)),b.push(l(v,n))}console.log(`Wrote ${b.length} files to ${l(process.cwd(),v)||v}`),console.log(`Needs @cascivo/design and playwright as dev dependencies.`)}async function v(){try{return await import(`@cascivo/design`)}catch{throw Error(`cascivo design needs @cascivo/design, which is not installed here.
|
|
2
|
+
pnpm add -D @cascivo/design`)}}function y(e,t){let r=n(e,t);if(r===void 0){if(e.includes(`--${t}`))throw Error(`--${t} needs a number`);return}let i=Number(r);if(!Number.isInteger(i)||i<=0)throw Error(`--${t} must be a positive whole number, got "${r}"`);return i}function b(e,t,r){let i=n(e,t);if(i===void 0&&e.some(e=>e===`--${t}`||e===`--${t}=`))throw Error(`Usage: cascivo design ${r}`);return i}const x=[`primary`,`accent`,`background`,`surface`,`text`],S=`init [--theme <name>] [--force] [--accent <colour>] [--primary <colour>] [--background <colour>] [--surface <colour>] [--text <colour>] [--font-display <stack>] [--font-body <stack>] [--signature "<text>"] [--composition "<text>"]`;function C(e,t){if(e===void 0)throw Error(`Usage: cascivo design ${t}`);return e}function w(e,t,n){console.log(t?JSON.stringify(e,null,2):n(e))}async function T(e,r=v){let[a,...o]=e,s=o.includes(`--json`);switch(a){case`check`:{let e=`check <url|path> [--json] [--max N] [--design <path>] [--storage-state <file>]`,n=C(t(o,[`max`,`design`,`storage-state`])[0],e),a=y(o,`max`),c=b(o,`design`,e),l=u(process.cwd(),`DESIGN.md`),d=c??(i(l)?l:void 0),f=b(o,`storage-state`,e),{check:p,formatCheck:m}=await r(),h=await p(n,{...d===void 0?{}:{design:d},...f===void 0?{}:{storageState:f}});console.log(s?JSON.stringify(h,null,2):m(h,a)),h.findings.some(e=>e.level===`error`)&&(process.exitCode=1);break}case`see`:{let e=`see <url|path> [--width N] [--out file.png] [--storage-state <file>]`,i=C(t(o,[`width`,`out`,`storage-state`])[0],e),a=y(o,`width`),s=n(o,`out`),c=b(o,`storage-state`,e),{see:l}=await r(),u=await l(i,{...a===void 0?{}:{width:a},...s===void 0?{}:{out:s},...c===void 0?{}:{storageState:c}});console.log(`screenshot ${u.path} (${u.image.width}×${u.image.height})\n${u.digest}`);break}case`plan`:{let e=C(t(o,[`format`])[0],`plan "<brief>" [--format cv|view] [--json]`),i=n(o,`format`);if(i!==void 0&&i!==`cv`&&i!==`view`)throw Error(`--format must be cv or view, got "${i}"`);let{plan:a}=await r();w(a(e,i===void 0?{}:{format:i}),s,e=>e.output);break}case`init`:{let e=b(o,`theme`,S),t={};for(let e of x){let n=b(o,e,S);n!==void 0&&(t[e]=n)}let n=b(o,`font-display`,S),i=b(o,`font-body`,S),a=b(o,`signature`,S),s=b(o,`composition`,S),c={...Object.keys(t).length===0?{}:{colors:t},...n===void 0?{}:{fontDisplay:n},...i===void 0?{}:{fontBody:i},...a===void 0?{}:{signature:a},...s===void 0?{}:{composition:s}},{init:l}=await r(),u=await l({cwd:process.cwd(),force:o.includes(`--force`),...e===void 0?{}:{theme:e},...Object.keys(c).length===0?{}:{direction:c}});console.log(u.written?`Wrote ${u.path} (${u.theme} theme)`:`Kept existing ${u.path}. Pass --force to replace it.`),u.written&&u.css&&console.log(u.css);break}case`theme`:{let e=n(o,`seed`);if(e===void 0||!/^#?(?:[0-9a-f]{3}|[0-9a-f]{6})$/i.test(e))throw Error(`Usage: cascivo design theme --seed <hex> [--mode light|dark] [--name <name>] (e.g. --seed "#0079bf")`);let t=n(o,`mode`);if(t!==void 0&&t!==`light`&&t!==`dark`)throw Error(`--mode must be light or dark, got "${t}"`);let i=n(o,`name`),{theme:a}=await r(),s=a({seed:e,...t===void 0?{}:{mode:t},...i===void 0?{}:{name:i}});console.log(s.css);break}case`skill`:await _(o);break;default:throw Error(`Unknown design subcommand: ${a??`(none)`}. Use one of: check, see, plan, init, theme, skill.`)}}export{T as design};
|
|
3
|
+
//# sourceMappingURL=design-CYQqMPQB.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"design-CYQqMPQB.mjs","names":["assertInside","positionalArgs","flagValue","NAME","skillSourceDir","here","dirname","fileURLToPath","found","join","existsSync","dir","listFiles","readdirSync","entry","designSkill","args","a","force","skills","resolve","target","relative","rmSync","source","written","file","dest","mkdir","writeFile","readFile","loadDesign","positiveInt","raw","key","value","valued","usage","COLOR_FLAGS","INIT_USAGE","required","print","json","text","design","sub","rest","max","named","fallback","designMd","storageState","load","result","check","formatCheck","f","url","width","out","see","brief","format","plan","r","theme","colors","name","fontDisplay","fontBody","signature","composition","direction","init","seed","mode"],"sources":["../src/commands/design-skill.ts","../src/commands/design.ts"],"sourcesContent":["/**\n * `cascivo design skill` — write the `cascivo-design` agent skill into a project.\n *\n * The skill ships inside this package (copied from `skills/cascivo-design` at build), so the\n * version that is installed matches the CLI that checks the page, with no GitHub access.\n */\nimport { existsSync, readdirSync, rmSync } from 'node:fs'\nimport { mkdir, readFile, writeFile } from 'node:fs/promises'\nimport { dirname, join, relative, resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { flagValue } from '../utils/args.js'\nimport { assertInside } from '../utils/fs.js'\n\nconst NAME = 'cascivo-design'\nconst USAGE = 'skill [--dir <skills-dir>] [--force]'\n\n/** The shipped copy (`dist/skills`), else the repository source when running from `src`. */\nexport function skillSourceDir(): string {\n const here = dirname(fileURLToPath(import.meta.url))\n const candidates = [\n join(here, 'skills', NAME),\n join(here, '../../../../skills', NAME),\n join(here, '../../skills', NAME),\n ]\n const found = candidates.find((dir) => existsSync(join(dir, 'SKILL.md')))\n if (!found) throw new Error(`The ${NAME} skill is missing from this install of cascivo.`)\n return found\n}\n\nfunction listFiles(dir: string): string[] {\n return readdirSync(dir, { withFileTypes: true }).flatMap((entry) =>\n entry.isDirectory() ? listFiles(join(dir, entry.name)) : [join(dir, entry.name)],\n )\n}\n\nexport async function designSkill(args: string[]): Promise<void> {\n const dir = flagValue(args, 'dir')\n if (dir === undefined && args.some((a) => a === '--dir' || a === '--dir=')) {\n throw new Error(`Usage: cascivo design ${USAGE}`)\n }\n const force = args.includes('--force')\n const skills = resolve(process.cwd(), dir ?? '.claude/skills')\n const target = join(skills, NAME)\n if (existsSync(target)) {\n if (!force) {\n throw new Error(\n `${relative(process.cwd(), target) || target} already exists. Pass --force to replace it.`,\n )\n }\n // Only the folder this command owns: a stale reference file must not outlive an update.\n rmSync(assertInside(skills, target), { recursive: true, force: true })\n }\n const source = skillSourceDir()\n const written: string[] = []\n for (const file of listFiles(source)) {\n const dest = assertInside(target, join(target, relative(source, file)))\n await mkdir(dirname(dest), { recursive: true })\n await writeFile(dest, await readFile(file))\n written.push(relative(target, dest))\n }\n console.log(`Wrote ${written.length} files to ${relative(process.cwd(), target) || target}`)\n console.log('Needs @cascivo/design and playwright as dev dependencies.')\n}\n","/**\n * `cascivo design` — the command-line face of `@cascivo/design`.\n *\n * This file only parses arguments and prints: every decision about a page lives in the\n * package, so an agent calling the library and a person running the CLI get the same answer.\n */\nimport { existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport { flagValue, positionalArgs } from '../utils/args.js'\nimport { designSkill } from './design-skill.js'\n\ntype Design = typeof import('@cascivo/design')\n\n/**\n * Load `@cascivo/design` from the caller's project.\n *\n * An optional peer resolved at call time, like `@cascivo/email`: a real dependency would put\n * it (and the question of its Playwright peer) into the download for `cascivo add button`.\n */\nasync function loadDesign(): Promise<Design> {\n try {\n return await import('@cascivo/design')\n } catch {\n throw new Error(\n 'cascivo design needs @cascivo/design, which is not installed here.\\n' +\n ' pnpm add -D @cascivo/design',\n )\n }\n}\n\n/** Read `--<key> N` as a positive integer; `undefined` when the flag is absent. */\nfunction positiveInt(args: string[], key: string): number | undefined {\n const raw = flagValue(args, key)\n if (raw === undefined) {\n if (args.includes(`--${key}`)) throw new Error(`--${key} needs a number`)\n return undefined\n }\n const value = Number(raw)\n if (!Number.isInteger(value) || value <= 0) {\n throw new Error(`--${key} must be a positive whole number, got \"${raw}\"`)\n }\n return value\n}\n\n/** Read `--<key> <value>`; a flag given without a value is an error, not a silent default. */\nfunction valued(args: string[], key: string, usage: string): string | undefined {\n const value = flagValue(args, key)\n if (value === undefined && args.some((a) => a === `--${key}` || a === `--${key}=`)) {\n throw new Error(`Usage: cascivo design ${usage}`)\n }\n return value\n}\n\n/** `init` flags that set one semantic colour of the direction. */\nconst COLOR_FLAGS = ['primary', 'accent', 'background', 'surface', 'text'] as const\n\nconst INIT_USAGE =\n 'init [--theme <name>] [--force] [--accent <colour>] [--primary <colour>] ' +\n '[--background <colour>] [--surface <colour>] [--text <colour>] ' +\n '[--font-display <stack>] [--font-body <stack>] [--signature \"<text>\"] ' +\n '[--composition \"<text>\"]'\n\nfunction required(value: string | undefined, usage: string): string {\n if (value === undefined) throw new Error(`Usage: cascivo design ${usage}`)\n return value\n}\n\nfunction print(value: unknown, json: boolean, text: (v: never) => string): void {\n console.log(json ? JSON.stringify(value, null, 2) : text(value as never))\n}\n\nexport async function design(\n args: string[],\n load: () => Promise<Design> = loadDesign,\n): Promise<void> {\n const [sub, ...rest] = args\n const json = rest.includes('--json')\n\n switch (sub) {\n case 'check': {\n const usage = 'check <url|path> [--json] [--max N] [--design <path>] [--storage-state <file>]'\n const target = required(positionalArgs(rest, ['max', 'design', 'storage-state'])[0], usage)\n const max = positiveInt(rest, 'max')\n // The project's own tokens count as on-scale: a named file must exist, the default\n // one is used only when it is there.\n const named = valued(rest, 'design', usage)\n const fallback = resolve(process.cwd(), 'DESIGN.md')\n const designMd = named ?? (existsSync(fallback) ? fallback : undefined)\n const storageState = valued(rest, 'storage-state', usage)\n const { check, formatCheck } = await load()\n const result = await check(target, {\n ...(designMd === undefined ? {} : { design: designMd }),\n ...(storageState === undefined ? {} : { storageState }),\n })\n // --json is the full report; --max only trims the text an agent reads.\n console.log(json ? JSON.stringify(result, null, 2) : formatCheck(result, max))\n if (result.findings.some((f) => f.level === 'error')) process.exitCode = 1\n break\n }\n case 'see': {\n const usage = 'see <url|path> [--width N] [--out file.png] [--storage-state <file>]'\n const url = required(positionalArgs(rest, ['width', 'out', 'storage-state'])[0], usage)\n const width = positiveInt(rest, 'width')\n const out = flagValue(rest, 'out')\n const storageState = valued(rest, 'storage-state', usage)\n const { see } = await load()\n const result = await see(url, {\n ...(width === undefined ? {} : { width }),\n ...(out === undefined ? {} : { out }),\n ...(storageState === undefined ? {} : { storageState }),\n })\n console.log(\n `screenshot ${result.path} (${result.image.width}×${result.image.height})\\n${result.digest}`,\n )\n break\n }\n case 'plan': {\n const usage = 'plan \"<brief>\" [--format cv|view] [--json]'\n const brief = required(positionalArgs(rest, ['format'])[0], usage)\n const format = flagValue(rest, 'format')\n if (format !== undefined && format !== 'cv' && format !== 'view') {\n throw new Error(`--format must be cv or view, got \"${format}\"`)\n }\n const { plan } = await load()\n const result = plan(brief, format === undefined ? {} : { format })\n print(result, json, (r: typeof result) => r.output)\n break\n }\n case 'init': {\n const theme = valued(rest, 'theme', INIT_USAGE)\n const colors: Record<string, string> = {}\n for (const name of COLOR_FLAGS) {\n const value = valued(rest, name, INIT_USAGE)\n if (value !== undefined) colors[name] = value\n }\n const fontDisplay = valued(rest, 'font-display', INIT_USAGE)\n const fontBody = valued(rest, 'font-body', INIT_USAGE)\n const signature = valued(rest, 'signature', INIT_USAGE)\n const composition = valued(rest, 'composition', INIT_USAGE)\n const direction = {\n ...(Object.keys(colors).length === 0 ? {} : { colors }),\n ...(fontDisplay === undefined ? {} : { fontDisplay }),\n ...(fontBody === undefined ? {} : { fontBody }),\n ...(signature === undefined ? {} : { signature }),\n ...(composition === undefined ? {} : { composition }),\n }\n const { init } = await load()\n const result = await init({\n cwd: process.cwd(),\n force: rest.includes('--force'),\n ...(theme === undefined ? {} : { theme }),\n ...(Object.keys(direction).length === 0 ? {} : { direction }),\n })\n console.log(\n result.written\n ? `Wrote ${result.path} (${result.theme} theme)`\n : `Kept existing ${result.path}. Pass --force to replace it.`,\n )\n // The block that applies the direction; only for a file this run actually wrote.\n if (result.written && result.css) console.log(result.css)\n break\n }\n case 'theme': {\n const usage =\n 'Usage: cascivo design theme --seed <hex> [--mode light|dark] [--name <name>] (e.g. --seed \"#0079bf\")'\n const seed = flagValue(rest, 'seed')\n if (seed === undefined || !/^#?(?:[0-9a-f]{3}|[0-9a-f]{6})$/i.test(seed)) {\n throw new Error(usage)\n }\n const mode = flagValue(rest, 'mode')\n if (mode !== undefined && mode !== 'light' && mode !== 'dark') {\n throw new Error(`--mode must be light or dark, got \"${mode}\"`)\n }\n const name = flagValue(rest, 'name')\n const { theme } = await load()\n const result = theme({\n seed,\n ...(mode === undefined ? {} : { mode }),\n ...(name === undefined ? {} : { name }),\n })\n console.log(result.css)\n break\n }\n case 'skill':\n // Offline and package-local: it must work before @cascivo/design is installed.\n await designSkill(rest)\n break\n default:\n throw new Error(\n `Unknown design subcommand: ${sub ?? '(none)'}. Use one of: check, see, plan, init, theme, skill.`,\n )\n }\n}\n"],"mappings":"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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.12.1",
|
|
3
3
|
"tokens": [
|
|
4
4
|
{ "name": "--cascivo-gray-0", "resolvedDefault": "oklch(1 0 0)" },
|
|
5
5
|
{ "name": "--cascivo-gray-50", "resolvedDefault": "oklch(0.985 0.002 264)" },
|
|
@@ -679,7 +679,7 @@
|
|
|
679
679
|
"props": [
|
|
680
680
|
{
|
|
681
681
|
"name": "variant",
|
|
682
|
-
"type": "'default' | 'secondary' | 'success' | 'warning' | 'destructive' | 'outline'",
|
|
682
|
+
"type": "'default' | 'secondary' | 'success' | 'warning' | 'destructive' | 'outline' | 'info' | 'primary'",
|
|
683
683
|
"required": false
|
|
684
684
|
},
|
|
685
685
|
{ "name": "size", "type": "'sm' | 'md'", "required": false },
|
|
@@ -2317,6 +2317,7 @@
|
|
|
2317
2317
|
{ "name": "rows", "type": "number", "required": false },
|
|
2318
2318
|
{ "name": "resize", "type": "'none' | 'vertical' | 'both'", "required": false },
|
|
2319
2319
|
{ "name": "autosize", "type": "boolean", "required": false },
|
|
2320
|
+
{ "name": "placeholder", "type": "string", "required": false },
|
|
2320
2321
|
{ "name": "disabled", "type": "boolean", "required": false },
|
|
2321
2322
|
{ "name": "value", "type": "string", "required": false },
|
|
2322
2323
|
{ "name": "defaultValue", "type": "string", "required": false },
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/utils/config.ts","../src/index.ts"],"mappings":";;cAYa;KAeD,oBAAoB;KAEpB;EAEN;EAAa,UAAU;EAAwB,SAAS;;UAE7C;;EAEf;;EAEA;;EAEA,OAAO;;EAEP,aAAa,eAAe;;EAE5B;;;;qBCxBW;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/utils/config.ts","../src/index.ts"],"mappings":";;cAYa;KAeD,oBAAoB;KAEpB;EAEN;EAAa,UAAU;EAAwB,SAAS;;UAE7C;;EAEf;;EAEA;;EAEA,OAAO;;EAEP,aAAa,eAAe;;EAE5B;;;;qBCxBW;wBAwSS,IAAI,iBAAiB"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./rolldown-runtime-DT7IzrpZ.mjs";import{a as t,l as n,n as r,o as i,r as a,s as o,t as s}from"./config-CTk7uDrh.mjs";import{i as c,n as l,r as u,t as d}from"./fs-B7O-fNID.mjs";import{r as f,t as p}from"./http-B52v4-hw.mjs";import{a as m,c as h,i as g,l as _,n as v,o as y,r as ee,s as b,t as te}from"./lock-C6ILDVCl.mjs";import{n as x,r as S,t as ne}from"./peer-versions-DIPdOfWj.mjs";import{n as
|
|
3
|
-
Styling: cascivo components read --cascivo-* tokens, which this project does not import yet.`),console.log(` ${o(t,[`@cascivo/themes`])}`),console.log(` import '@cascivo/themes/all' // once, in your entry file`),console.log(` <html data-theme="light"> // or any container`))}function
|
|
4
|
-
`));let e;try{e=await je(t,n,i,{pm:a,...r.noInstall?{noInstall:!0}:{}})}catch(e){console.error(`Failed to install ${t.name}: ${e instanceof Error?e.message:e}`),process.exitCode=1;continue}p=g(p,t.name,{registry:s,version:t.version,installedAt:(/* @__PURE__ */ new Date()).toISOString().slice(0,10),files:e})}if(await m(p,i),l.length===0){
|
|
5
|
-
`)}`)}if(_.size>0&&!r.dryRun&&(r.noInstall?console.log(`\nSkipped install (--no-install). Install with:\n ${o(a,[..._])}`):
|
|
6
|
-
`).some(e=>e.trim().replace(/\/+$/,``)===r))return`"${r}/" is not excluded from your formatter. Running it will rewrite code you own, and \`cascivo update\` will then report drift on files you never edited. Add "${r}/" to ${i}.`}return null}const qe=[`astro.config.mjs`,`astro.config.ts`,`astro.config.js`,`astro.config.mts`];function Je(e){if(/\bresolve\s*\.\s*noExternal\b/.test(e))return!0;for(let t of e.matchAll(/\bresolve\s*:\s*\{/g)){let n=1,r=t.index+t[0].length,i=r;for(;r<e.length&&n>0;){let t=e[r];t===`{`?n++:t===`}`&&n--,r++}if(/\bnoExternal\b/.test(e.slice(i,r)))return!0}return!1}function Ye(e){let t;try{t=JSON.parse(
|
|
7
|
-
`;)n++;else if(i===`/`&&a===`*`){for(n+=2;n<r&&(e[n]!==`*`||e[n+1]!==`/`);)n++;n+=2}else if(i===`'`||i===`"`){for(n++;n<r&&e[n]!==i;)e[n]===`\\`&&n++,n++;n++,t+=i+i}else if(i==="`"){for(n++;n<r&&e[n]!=="`";)e[n]===`\\`&&n++,n++;n++,t+="``"}else t+=i,n++}return t}async function
|
|
8
|
-
`):``}function
|
|
9
|
-
`)}function
|
|
2
|
+
import{t as e}from"./rolldown-runtime-DT7IzrpZ.mjs";import{a as t,l as n,n as r,o as i,r as a,s as o,t as s}from"./config-CTk7uDrh.mjs";import{i as c,n as l,r as u,t as d}from"./fs-B7O-fNID.mjs";import{r as f,t as p}from"./http-B52v4-hw.mjs";import{a as m,c as h,i as g,l as _,n as v,o as y,r as ee,s as b,t as te}from"./lock-C6ILDVCl.mjs";import{n as x,r as S,t as ne}from"./peer-versions-DIPdOfWj.mjs";import{n as C,r as w,t as T}from"./args-B4PN85cC.mjs";import{t as E}from"./merge-D332dc_m.mjs";import{createRequire as D}from"node:module";import{argv as O,stdin as k,stdout as re}from"node:process";import{pathToFileURL as ie}from"node:url";import{existsSync as A,readFileSync as j,readdirSync as M,writeFileSync as N}from"node:fs";import{basename as ae,dirname as oe,join as P,resolve as F}from"node:path";import{spawnSync as se}from"node:child_process";import{readFile as ce}from"node:fs/promises";import{asTemplateMeta as le,buildRegistry as ue,isTemplateItem as I,parseItem as L,parseLegacyRegistry as de,validateIndex as fe,validateItem as pe,validateTemplate as me}from"@cascivo/registry";import{createInterface as R}from"node:readline/promises";function z(e,n=process.cwd(),r={}){if(e.length===0)return!0;let a=r.pm??t(n),[s,c]=i(a,e,{dev:r.dev??!1,...r.floors?{floors:r.floors}:{},...r.pin?{pin:r.pin}:{}});return console.log(`Installing ${e.join(`, `)} with ${s}…`),se(s,c,{cwd:n,stdio:`inherit`,shell:process.platform===`win32`}).status===0||(console.error(`Failed to install: ${e.join(`, `)}`),console.error(`Install them yourself with: ${o(a,e,{dev:r.dev??!1})}`),!1)}const he=/^([^/]+)\/([^/]+)\/([^#]+)(?:#(.+))?$/;function B(e,t=process.env){return e.replace(/\$\{([^}]+)\}/g,(e,n)=>{let r=t[n];if(r===void 0)throw Error(`Environment variable ${n} is not set`);return r})}function V(e,t=process.env){if(e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`./`)||e.startsWith(`/`))return{kind:`url`,name:e,raw:e};if(e.startsWith(`@`)){let t=e.indexOf(`/`,1);if(t===-1)throw Error(`Invalid namespace address: ${e} (expected @ns/name)`);return{kind:`namespace`,namespace:e.slice(0,t),name:e.slice(t+1),raw:e}}let n=e.includes(`#`)?e.slice(0,e.indexOf(`#`)):e,r=he.exec(e);if(r&&!n.includes(`.`)&&n.split(`/`).length>=3){let[,t,n,i,a]=r;return{kind:`github`,name:`${t}/${n}/${i}`,ref:a??`main`,raw:e}}return{kind:`bare`,name:e,raw:e}}function H(e,t,n,r){let i=typeof n==`string`?n:n.url;if(!i.includes(`{name}`))throw Error(`Registry namespace "${e}" URL template must contain {name}: ${i}`);return B(i.replace(`{name}`,t),r)}async function U(e,t,n=process.env,r){switch(e.kind){case`url`:return{url:e.name};case`bare`:return{url:`${t.registry.replace(/\/registry\.json$/,``).replace(/\/r$/,``)}/r/${e.name}.json`};case`github`:{let t=e.name.split(`/`),n=t[0],r=t[1],i=t.slice(2).join(`/`);return{url:`https://raw.githubusercontent.com/${n}/${r}/${e.ref??`main`}/r/${i}.json`}}case`namespace`:{let i=e.namespace,a=e.name;if(t.registries?.[i]){let e=t.registries[i],r=H(i,a,e,n),o=typeof e==`string`?void 0:e.headers,s=typeof e==`string`?void 0:e.params,c=o?Object.fromEntries(Object.entries(o).map(([e,t])=>[e,B(t,n)])):void 0,l=s?Object.fromEntries(Object.entries(s).map(([e,t])=>[e,B(t,n)])):void 0,u={url:r};return c&&(u.headers=c),l&&(u.params=l),u}if(r){let e=await r(i);if(e)return{url:H(i,a,e,n)}}if(i===`@cascivo`||i===`@cascade`)return{url:`${s}/r/${a}.json`};throw Error(`Unknown namespace "${i}". Add it to registries in cascivo.config.ts or check the directory at cascivo.com`)}}}async function ge(e,t,n=process.env,r){let i=/* @__PURE__ */ new Set,a=[...e],o=[];for(;a.length>0;){let e=a.shift(),s=V(e,n),c=s.raw;if(i.has(c))continue;i.add(c);let{url:l,headers:u,params:d}=await U(s,t,n,r),f={};u&&(f.headers=u),d&&(f.params=d);let m=L(await p(l,f),l),h={spec:e,addr:s,itemUrl:l,item:m,registryBase:l.replace(/\/[^/]+\.json$/,``)};u&&(h.headers=u),d&&(h.params=d),o.push(h);for(let e of m.registryDependencies??[])a.push(e)}return{items:o}}const _e=`${s}/r/registries.json`;function ve(e,t){if(typeof e!=`object`||!e)return null;let n=e.registries;if(!Array.isArray(n))return null;for(let e of n){if(typeof e!=`object`||!e)continue;let n=e;if(n.namespace!==t)continue;let r=n.registryUrl;return typeof r!=`string`||!/^https?:\/\//.test(r)?null:r}return null}async function ye(e,t){try{let n;if(t){let e=await t(_e,{headers:{Accept:`application/json`}});if(!e.ok)throw Error(`HTTP ${e.status}`);n=await e.json()}else n=await p(_e);return ve(n,e)}catch(e){let t=e instanceof Error?e.message:String(e);return console.warn(`Could not reach cascivo.com directory: ${t}`),null}}var be=/* @__PURE__ */ e({LAYOUT_ALIASES:()=>W,NAME_NOTES:()=>Te,add:()=>Ae,isThirdParty:()=>Oe,resolveBareClosure:()=>Ee,resolveTemplateTarget:()=>we});const xe=/* @__PURE__ */ new Set([`react`,`react-dom`]);function Se(e){try{let t=JSON.parse(j(P(e,`package.json`),`utf8`));return{...t.dependencies,...t.devDependencies}}catch{return{}}}function Ce(e,t){let n=Se(e);n[`@cascivo/themes`]===void 0&&n[`@cascivo/tokens`]===void 0&&(console.log(`
|
|
3
|
+
Styling: cascivo components read --cascivo-* tokens, which this project does not import yet.`),console.log(` ${o(t,[`@cascivo/themes`])}`),console.log(` import '@cascivo/themes/all' // once, in your entry file`),console.log(` <html data-theme="light"> // or any container`))}function we(e,t){return d(e,F(e,t))}const W={box:`layout/flex`,hstack:`layout/flex`,vstack:`layout/flex`,gap:`spacer`},Te={stack:`Note: cascivo's Stack overlaps children into a card-pile (z-axis), not a vertical spacing layout. For vertical spacing use Flex direction="vertical" (cascivo add flex; aliases: vstack, hstack).`};function Ee(e,t){let n=t.map(e=>({name:e,requested:!0})),r=/* @__PURE__ */ new Set,i=[],a=[];for(;n.length>0;){let{name:t,requested:o}=n.shift(),s=W[t.toLowerCase()]??t,c=h(e,s);if(!c){a.push(t);continue}if(r.has(c.name))continue;r.add(c.name);let l=_(c,t);i.push({entry:c,requested:o,...l?{viaAlias:l}:{}});for(let e of c.registryDependencies??[])n.push({name:e,requested:!1})}return{resolved:i,missing:a}}const De=/^https:\/\/(cascivo\.com|raw\.githubusercontent\.com\/cascivo\/cascivo)\//;function Oe(e){return!De.test(e)}function ke(e){return e.startsWith(`@`)||e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`./`)||e.startsWith(`/`)||e.split(`/`).length>=3}async function Ae(e,n,r={}){if(e.length===0){console.error(`Usage: cascivo add <component...>`);return}let i=r.cwd??process.cwd(),a=r.pm??t(i),s=e.filter(ke),l=e.filter(e=>!ke(e)),d=null;if(l.length>0){d=await y(n.registry);let e=new Set(d.templates.map(e=>e.toLowerCase())),t=l.filter(t=>e.has(t.toLowerCase()));t.length>0&&(l=l.filter(t=>!e.has(t.toLowerCase())),s.push(...t.map(e=>`@cascivo/${e.toLowerCase()}`)))}let p=await v(i)??te();if(s.length>0){let e=await ge(s,n,process.env,ye);if(r.dryRun){console.log(`Dry run — would install:`);for(let t of e.items){let e=I(t.item)?` [template]`:``;console.log(` ${t.spec} (${t.item.name}@${t.item.version})${e} from ${t.itemUrl}`);for(let e of t.item.files){let n=I(t.item)&&e.target?` → ${e.target}`:``;console.log(` ${e.url}${n}`)}t.item.registryDependencies?.length&&console.log(` components: ${t.item.registryDependencies.join(`, `)}`)}return}for(let{item:t,itemUrl:o,registryBase:s}of e.items){Oe(o)&&console.log(`\nReview before use — files from non-directory registry: ${s}\n`+(t.files??[]).map(e=>` ${e.url}`).join(`
|
|
4
|
+
`));let e;try{e=await je(t,n,i,{pm:a,...r.noInstall?{noInstall:!0}:{}})}catch(e){console.error(`Failed to install ${t.name}: ${e instanceof Error?e.message:e}`),process.exitCode=1;continue}p=g(p,t.name,{registry:s,version:t.version,installedAt:(/* @__PURE__ */ new Date()).toISOString().slice(0,10),files:e})}if(await m(p,i),l.length===0){Ce(i,a);return}}if(l.length===0)return;d??=await y(n.registry);let _=/* @__PURE__ */ new Set,x=n.registry.replace(/\/registry\.json$/,``).replace(/\/r$/,``);for(let e of l){let t=Te[e.toLowerCase()];t&&console.log(t);let n=W[e.toLowerCase()];if(!n)continue;let r=h(d,n);r&&console.log(`"${e}" is not a cascivo component — installing ${r.name} (its ${e} primitive).`)}let{resolved:S,missing:C}=Ee(d,l);for(let e of C)console.error(`Component "${e}" not found in registry. Run "cascivo list".`);for(let{entry:e,requested:t,viaAlias:n}of S)t&&n&&console.log(`\n"${n}" is cascivo's "${e.name}" — installing that.`);let w=/* @__PURE__ */ new Set;for(let{entry:e,requested:t}of S)t&&e.install&&!w.has(e.install)&&(w.add(e.install),console.log(`\n"${e.name}" ships in the ${e.install} npm package — no source is copied into your project. Updates come from your package manager, not \`cascivo update\`.`));for(let{entry:e,requested:t}of S){if(!t||!e.deprecated)continue;let{replacement:n,since:r,note:i}=e.deprecated;console.warn(`\n⚠ "${e.name}" is deprecated since ${r}. Use "${n}" instead:\n cascivo add ${n}\n`+(i?` ${i}\n`:``)+` Adding "${e.name}" anyway — it still works.\n`)}let T={};for(let{entry:e}of S)for(let[t,n]of Object.entries(e.peerVersions??{}))T[t]=n;let E=/* @__PURE__ */ new Set,D=[];for(let{entry:e,requested:t}of S){if(e.install){let t=e.install;E.add(t),console.log(`"${e.name}" is distributed as the npm package ${t} — a runtime dependency, not copied source (updates come via your package manager).`),D.push(` import { ${e.meta.name} } from '${t}'`),e.styles&&D.push(` import '${e.styles}' // once, in your entry file`);continue}let r=e.name.includes(`/`)?e.name.split(`/`).pop():e.name,a={},o;try{o=await Promise.all(e.files.map(async e=>({url:e,content:await f(e)})))}catch(t){console.error(`Failed to install ${e.name}: ${t instanceof Error?t.message:t}`),process.exitCode=1;continue}for(let{url:e,content:t}of o){let o=u(n.outputDir,r,b(e),i);await c(o,t),a[o]=ee(t)}for(let t of e.dependencies)xe.has(t)||_.add(t);p=g(p,e.name,{registry:x,version:e.version,installedAt:(/* @__PURE__ */ new Date()).toISOString().slice(0,10),files:a});let s=t?``:` (dependency)`;console.log(`Added ${e.name} to ${n.outputDir}/${r}/${s}`)}if(E.size>0){let e=Se(i),t=[...E].filter(t=>e[t]===void 0);r.dryRun?console.log(`Dry run — would install npm package(s): ${[...E].join(`, `)}`):t.length>0&&(r.noInstall?console.log(`\nSkipped install (--no-install). Install with:\n ${o(a,t)}`):z(t,i,{pm:a})||(process.exitCode=1)),D.length>0&&console.log(`\nImport it:\n${D.join(`
|
|
5
|
+
`)}`)}if(_.size>0&&!r.dryRun&&(r.noInstall?console.log(`\nSkipped install (--no-install). Install with:\n ${o(a,[..._])}`):z([..._],i,{pm:a})),Object.keys(T).length>0){let e=await ne(i,T);for(let t of e)console.error(`\nWarning: ${t.pkg} ${t.installed?`${t.installed} is`:`is not`} installed, but the copied component source needs ${t.pkg} ${t.required}. Run: ${o(a,[`${t.pkg}@latest`])}`),process.exitCode=1}await m(p,i),Ce(i,a)}async function je(e,n,r,i={}){let a={},s=/* @__PURE__ */ new Set,l=I(e),d=e.name.includes(`/`)?e.name.split(`/`).pop():e.name,p=await Promise.all((e.files??[]).map(async e=>({file:e,content:await f(e.url)})));for(let{file:e,content:t}of p){let i=l&&e.target?we(r,e.target):u(n.outputDir,d,b(e.url),r);await c(i,t),a[i]=ee(t)}for(let t of e.dependencies??[])xe.has(t)||s.add(t);if(s.size>0&&(i.noInstall?console.log(`\nSkipped install (--no-install). Install with:\n ${o(i.pm??t(r),[...s])}`):z([...s],r,i.pm?{pm:i.pm}:{})),l){let t=e.files?.filter(e=>e.target).map(e=>e.target)??[];console.log(`Installed template ${e.name} (${t.length} files)`)}else console.log(`Added ${e.name} to ${n.outputDir}/${d}/`);return a}var Me=/* @__PURE__ */ e({checkDuplicateCore:()=>He,checkFormatterIgnore:()=>Ke,checkProjectDependencies:()=>Be,checkSignalsCompat:()=>Ue,checkSsrConfig:()=>Ze,detectInstallPath:()=>G,runDoctor:()=>et,stripCommentsAndStrings:()=>$e});const Ne=[`@cascivo/core`,`@cascivo/tokens`,`@cascivo/themes`,`@preact/signals-react`],Pe=[`@cascivo/react`,`@cascivo/themes`,`@preact/signals-react`],Fe={"@cascivo/core":`AI-RULES.md: never add @cascivo/core to a prebuilt-path app — it is transitive, and everything is re-exported from @cascivo/react`,"@cascivo/tokens":`GETTING-STARTED.md: @cascivo/tokens comes with @cascivo/themes as a direct dependency — never install it by hand`},Ie=[`@cascivo/i18n`,`@cascivo/charts`],Le=[`cascivo.config.ts`,`cascivo.config.js`,`cascivo.config.mjs`];function G(e){let t={},n=!0;try{let n=JSON.parse(j(P(e,`package.json`),`utf8`));t={...n.dependencies,...n.devDependencies}}catch{n=!1}if(!n)return`unknown`;let r=t[`@cascivo/react`]!==void 0,i=Re(e);return r&&i?`hybrid`:r?`prebuilt`:i?`copied`:`unknown`}function Re(e){for(let t of ze(e)){let n=P(e,t);if(A(n))try{if(M(n).some(e=>e.endsWith(`.tsx`)))return!0}catch{}}return!1}function ze(e){let t=/* @__PURE__ */ new Set([`src/components/ui`]);for(let n of Le){let r=P(e,n);if(A(r))try{let e=/outputDir\s*:\s*['"]([^'"]+)['"]/.exec(j(r,`utf8`))?.[1];e!==void 0&&t.add(e)}catch{}}return[...t]}function Be(e){let n={};try{let t=JSON.parse(j(P(e,`package.json`),`utf8`));n={...t.dependencies,...t.devDependencies}}catch{return[]}let r=G(e);if(r===`unknown`)return[];let i=t(e),a=[],s=r===`prebuilt`?Pe:Ne;for(let e of s)n[e]===void 0&&a.push({package:e,required:!0,hint:`detected ${r} install path — ${o(i,[e])}`});if(r===`prebuilt`)for(let[e,t]of Object.entries(Fe))n[e]!==void 0&&a.push({package:e,required:!0,kind:`forbidden`,hint:t});for(let e of Ie)n[e]===void 0&&a.push({package:e,required:!1,hint:o(i,[e])});return a}const Ve=[`@cascivo/react`,`@cascivo/charts`,`@cascivo/flow`,`@cascivo/editor`];async function He(e){let t=await x(e,`@cascivo/core`),n=[];for(let r of Ve){let i=P(e,`node_modules`,r);if(!A(i))continue;let a=await x(i,`@cascivo/core`);a!==null&&a!==t&&n.push(`${r} → ${a}`)}return n.length===0?null:{root:t,nested:n,hint:`Align the @cascivo/* versions (they are released together — see breaking-changes.json) and reinstall. Two copies of @cascivo/core means two signal registries: writes through one are invisible to components subscribed through the other, with no error.`}}async function Ue(e){let[n,r]=await Promise.all([x(e,`@preact/signals-react`),x(e,`react`)]);if(n===null)return null;let i;try{i=S(n,`3.0.0`)<0}catch{return null}if(!i)return null;let a=t(e),s=o(a,[`@preact/signals-react@^3`]),c=null;if(r!==null){let e=/^(\d+)\./.exec(r.trim());c=e?Number(e[1]):null}return c!==null&&c>=19?{severity:`error`,detail:`@preact/signals-react ${n} cannot run on React ${r} — React 19 removed an internal signals 2.x imports, so it fails at module load. Upgrade to signals-react 3.x.`,hint:s}:{severity:`warning`,detail:`@preact/signals-react ${n} is below the required 3.x floor. It works on React 18 today but breaks the moment you move to React 19; upgrade now.`,hint:s}}const We=[`@tanstack/react-start`,`vite-ssr`,`@remix-run/dev`],Ge=[`vite.config.ts`,`vite.config.js`,`vite.config.mjs`,`vite.config.mts`];function Ke(e,t){let n=[{configs:[`.prettierrc`,`.prettierrc.json`,`.prettierrc.js`,`prettier.config.js`],ignore:`.prettierignore`},{configs:[`.oxfmtrc`,`.oxfmtrc.json`],ignore:`.oxfmtignore`}],r=t.replace(/\/+$/,``);for(let{configs:t,ignore:i}of n){if(!t.some(t=>A(P(e,t))))continue;let n=``;try{n=j(P(e,i),`utf8`)}catch{}if(!n.split(`
|
|
6
|
+
`).some(e=>e.trim().replace(/\/+$/,``)===r))return`"${r}/" is not excluded from your formatter. Running it will rewrite code you own, and \`cascivo update\` will then report drift on files you never edited. Add "${r}/" to ${i}.`}return null}const qe=[`astro.config.mjs`,`astro.config.ts`,`astro.config.js`,`astro.config.mts`];function Je(e){if(/\bresolve\s*\.\s*noExternal\b/.test(e))return!0;for(let t of e.matchAll(/\bresolve\s*:\s*\{/g)){let n=1,r=t.index+t[0].length,i=r;for(;r<e.length&&n>0;){let t=e[r];t===`{`?n++:t===`}`&&n--,r++}if(/\bnoExternal\b/.test(e.slice(i,r)))return!0}return!1}function Ye(e){let t;try{t=JSON.parse(j(P(e,`node_modules/@cascivo/react/package.json`),`utf8`))}catch{return!1}if(typeof t!=`object`||!t||!(`keywords`in t))return!1;let{keywords:n}=t;return Array.isArray(n)&&n.includes(`astro-component`)}function Xe(e,t){let n=G(e);if(n!==`prebuilt`&&n!==`hybrid`)return null;let r=j(P(e,t),`utf8`);if(/@cascivo\/astro/.test(r)||Je(r)||Ye(e))return null;let i=/\bssr\s*:\s*\{[^}]*noExternal/.test(r);return`${t} does not use the @cascivo/astro integration, so cascivo's CSS is externalized in Astro's prerender and islands render unstyled with no error`+(i?` (Astro ignores ssr.noExternal; it reads resolve.noExternal)`:``)+". Run `npx astro add @cascivo/astro`. Recipe: https://cascivo.com/docs/using-with-astro.md"}function Ze(e){let t=qe.find(t=>A(P(e,t)));if(t!==void 0)return Xe(e,t);let n={};try{let t=JSON.parse(j(P(e,`package.json`),`utf8`));n={...t.dependencies,...t.devDependencies}}catch{return null}let r=We.find(e=>n[e]!==void 0);if(r===void 0)return null;for(let t of Ge){let n=P(e,t);if(!A(n))continue;let r=j(n,`utf8`);if(/noExternal/.test(r)&&/@cascivo/.test(r)||/cascivoSsr/.test(r))return null}return`${r} is a Vite SSR framework, but no vite config marks the cascivo packages ssr.noExternal — an unconfigured SSR build crashes with \`Unknown file extension ".css"\`. Add \`ssr: { noExternal: [/^@cascivo\\//] }\` (or the cascivoSsr() plugin from @cascivo/vite-plugin). Recipe: https://cascivo.com/docs/using-with-vite-ssr.md`}const Qe=[`useState`,`useEffect`,`useLayoutEffect`,`useContext`,`useReducer`];function $e(e){let t=``,n=0,r=e.length;for(;n<r;){let i=e[n],a=e[n+1];if(i===`/`&&a===`/`)for(;n<r&&e[n]!==`
|
|
7
|
+
`;)n++;else if(i===`/`&&a===`*`){for(n+=2;n<r&&(e[n]!==`*`||e[n+1]!==`/`);)n++;n+=2}else if(i===`'`||i===`"`){for(n++;n<r&&e[n]!==i;)e[n]===`\\`&&n++,n++;n++,t+=i+i}else if(i==="`"){for(n++;n<r&&e[n]!=="`";)e[n]===`\\`&&n++,n++;n++,t+="``"}else t+=i,n++}return t}async function et(e){let t=[],n=P(e,`packages`,`components`,`src`);if(!A(n))return{violations:[],passed:!0};let r=M(n,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>e.name),i=P(e,`packages`,`react`,`src`,`index.ts`),a=A(i)?j(i,`utf8`):``;for(let e of r){let r=P(n,e,`${e}.tsx`);if(!A(r))continue;let i=j(r,`utf8`),o=$e(i);for(let n of Qe)RegExp(`\\b${n}\\b`).test(o)&&t.push({file:r,rule:`no-react-hooks`,detail:`Banned hook '${n}' in ${e}.tsx`});/aria-label="[A-Z]/.test(i)&&t.push({file:r,rule:`no-hardcoded-strings`,detail:`Hardcoded aria-label in ${e}.tsx — use t(builtin.*)`}),RegExp(`from.*components/src/${e}`).test(a)||t.push({file:r,rule:`missing-react-export`,detail:`${e} not exported from @cascivo/react`})}return{violations:t,passed:t.length===0}}const tt={AppFrame:`app-shell`,CardContent:`card`,CardFooter:`card`,CardHeader:`card`,CardTitle:`card`,ListItem:`list`,GridItem:`grid`,RadioCardGroup:`radio-card`};function nt(e){return tt[e]??e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}const rt=/^[A-Z][A-Za-z0-9]*$/,it=/^[A-Za-z_$][\w$]*(?:-[\w$]+)*$/,at=/^[A-Za-z_$][\w$]*$/,ot=/^\$(?:data|actions|state|state\.set|state\.toggle)\.[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/,st=/^[\w-]+(?:\.[\w-]+)*$/;function K(e,t){throw Error(`Invalid ViewConfig at ${e}: ${t}`)}function q(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ct(e,t){q(e)||K(t,`expected an object`);let n={};for(let[r,i]of Object.entries(e))it.test(r)||K(`${t}.${r}`,`not a valid prop name`),(typeof i!=`string`||!ot.test(i))&&K(`${t}.${r}`,`expected a "$data.*", "$actions.*" or "$state.*" reference`),n[r]=i;return n}function lt(e,t){return(typeof e.$t!=`string`||!st.test(e.$t))&&K(`${t}.$t`,`invalid key`),{$t:e.$t}}function ut(e,t){q(e)||K(t,`expected a component node object`);let{component:n,props:r,bind:i,events:a,children:o}=e;(typeof n!=`string`||!rt.test(n))&&K(`${t}.component`,`expected a PascalCase component name`);let s={component:n};if(r!==void 0){q(r)||K(`${t}.props`,`expected an object`);for(let[e,n]of Object.entries(r))it.test(e)||K(`${t}.props.${e}`,`not a valid prop name`),q(n)&&`$t`in n&&(r[e]=lt(n,`${t}.props.${e}`));s.props=r}return i!==void 0&&(s.bind=ct(i,`${t}.bind`)),a!==void 0&&(s.events=ct(a,`${t}.events`)),o!==void 0&&(typeof o==`string`?s.children=o:Array.isArray(o)?s.children=o.map((e,n)=>ut(e,`${t}.children[${n}]`)):q(o)&&`$t`in o?s.children=lt(o,`${t}.children`):K(`${t}.children`,`expected a string, a node array or a { $t } reference`)),s}function dt(e){q(e)||K(`$`,`expected an object`);let{state:t,view:n}=e,r={view:{regions:{}}};if(t!==void 0){q(t)||K(`state`,`expected an object`);let e={};for(let[n,r]of Object.entries(t))at.test(n)||K(`state.${n}`,`not a valid identifier`),r===null||typeof r==`string`||typeof r==`number`||typeof r==`boolean`?e[n]=r:K(`state.${n}`,`expected a string, number, boolean or null`);r.state=e}(!q(n)||!q(n.regions))&&K(`view.regions`,`expected an object`);for(let[e,t]of Object.entries(n.regions))/^[\w-]+$/.test(e)||K(`view.regions.${e}`,`not a valid region name`),Array.isArray(t)||K(`view.regions.${e}`,`expected an array of nodes`),r.view.regions[e]=t.map((t,n)=>ut(t,`view.regions.${e}[${n}]`));return r}function ft(e){return typeof e==`object`&&!!e&&`$t`in e}function pt(e){return typeof e==`string`?`'${e.replace(/'/g,`\\'`)}'`:String(e)}function mt(e){return typeof e==`string`?e.includes(`"`)?`{${JSON.stringify(e)}}`:`"${e}"`:typeof e==`number`||typeof e==`boolean`?`{${e}}`:e===null?`{null}`:ft(e)?`{${JSON.stringify(e.$t)}} {/* i18n: ${e.$t} */}`:`{${JSON.stringify(e)}}`}function ht(e,t,n,r){return e===void 0?``:typeof e==`string`?/[{}<>]/.test(e)?`{${JSON.stringify(e)}}`:e:ft(e)?`{/* i18n: ${e.$t} */}`:Array.isArray(e)?e.map(e=>gt(e,t+` `,n,r)).join(`
|
|
8
|
+
`):``}function gt(e,t,n,r){let i=e.component;r.add(i);let a=[];if(e.props)for(let[t,n]of Object.entries(e.props))a.push(`${t}=${mt(n)}`);if(e.bind)for(let[t,n]of Object.entries(e.bind))n.startsWith(`$state.`)?a.push(`${t}={${n.slice(7)}.value}`):a.push(`${t}={data.${n.replace(/^\$data\./,``)}}`);if(e.events)for(let[t,n]of Object.entries(e.events))if(n.startsWith(`$state.set.`)){let e=n.slice(11);a.push(`${t}={(e) => (${e}.value = coerceValue(e))}`)}else if(n.startsWith(`$state.toggle.`)){let e=n.slice(14);a.push(`${t}={() => (${e}.value = !${e}.value)}`)}else a.push(`${t}={actions.${n.replace(/^\$actions\./,``)}}`);let o=a.length>0?` `+a.join(` `):``,s=e.children===void 0?void 0:ht(e.children,t,[],r);return s!==void 0&&s!==``?`${t}<${i}${o}>\n${t} ${s}\n${t}</${i}>`:`${t}<${i}${o} />`}function _t(e){let t=[],n=[];function r(e){if(e.bind)for(let n of Object.values(e.bind)){if(n.startsWith(`$state.`))continue;let e=n.replace(/^\$data\./,``);t.includes(e)||t.push(e)}if(e.events)for(let t of Object.values(e.events)){if(t.startsWith(`$state.`))continue;let e=t.replace(/^\$actions\./,``);n.includes(e)||n.push(e)}Array.isArray(e.children)&&e.children.forEach(r)}return e.forEach(r),{boundProps:t,actionProps:n}}function vt(e){let t=e=>e.events&&Object.values(e.events).some(e=>e.startsWith(`$state.set.`))?!0:Array.isArray(e.children)?e.children.some(t):!1;return e.some(t)}function yt(e,t){let n=[...e].sort();if(`package`in t)return`import { ${n.join(`, `)} } from '${t.package}'`;let r=/* @__PURE__ */ new Map;for(let e of n){let t=nt(e);r.set(t,[...r.get(t)??[],e])}return[...r].sort(([e],[t])=>e.localeCompare(t)).map(([e,n])=>`import { ${n.join(`, `)} } from '${t.dir}/${e}'`).join(`
|
|
9
|
+
`)}function bt(e,t,n){let r=/* @__PURE__ */ new Set,i=Object.values(e.view.regions).flat(),{boundProps:a,actionProps:o}=_t(i),s=Object.entries(e.state??{}),c=s.length>0,l=vt(i),u=Object.entries(e.view.regions).map(([e,t])=>` <div className="region-${e}">\n${t.map(e=>gt(e,` `,[],r)).join(`
|
|
10
10
|
`)}\n </div>`).join(`
|
|
11
11
|
`),d=a.length>0,f=o.length>0,p=[d?`data: {\n${a.map(e=>` ${e.replace(/\./g,`_`)}: unknown // TODO: type your data`).join(`
|
|
12
12
|
`)}\n }`:``,f?`actions: {\n${o.map(e=>` ${e}: (...args: unknown[]) => unknown`).join(`
|
|
@@ -20,10 +20,10 @@ function coerceValue(e: unknown) {
|
|
|
20
20
|
return e
|
|
21
21
|
}
|
|
22
22
|
`:``,_=c?` useSignals()
|
|
23
|
-
`+s.map(([e,t])=>` const ${e} = useSignal(${
|
|
23
|
+
`+s.map(([e,t])=>` const ${e} = useSignal(${pt(t)})`).join(`
|
|
24
24
|
`)+`
|
|
25
25
|
`:``;return`import React from 'react'${h}
|
|
26
|
-
${
|
|
26
|
+
${yt(r,n)}
|
|
27
27
|
${g}
|
|
28
28
|
interface PageProps ${m}
|
|
29
29
|
|
|
@@ -34,7 +34,7 @@ ${u}
|
|
|
34
34
|
</div>
|
|
35
35
|
)
|
|
36
36
|
}
|
|
37
|
-
`}async function
|
|
37
|
+
`}async function xt(e,t){let n=e.find((t,n)=>e[n-1]===`--out`),r=e.find(e=>!e.startsWith(`--`)),i=e.find((t,n)=>e[n-1]===`--components-dir`),a=e.find((t,n)=>e[n-1]===`--from`);if(!r){console.error(`Usage: cascivo generate <config.json> [--out output.tsx] [--components-dir ./src/components/ui | --from @cascivo/react]`),process.exitCode=1;return}if(a&&i){console.error(`Pass --from or --components-dir, not both.`),process.exitCode=1;return}let{readFileSync:o}=await import(`node:fs`),s;try{s=dt(JSON.parse(o(r,`utf-8`)))}catch(e){console.error(`${r}: ${e instanceof Error?e.message:String(e)}`),process.exitCode=1;return}let c=/* @__PURE__ */ new Map,l=a?{package:a}:{dir:i??t.outputDir??`./src/components/ui`},u=bt(s,c,l),d=n??P(oe(r),`${ae(r,`.json`)}.tsx`);N(d,u,`utf-8`),console.log(`Generated ${d}`);try{let{spawnSync:e}=await import(`node:child_process`);e(`pnpm`,[`exec`,`vp`,`fmt`,d],{encoding:`utf8`,stdio:`inherit`}).status!==0&&e(`npx`,[`--yes`,`prettier`,`--write`,d],{encoding:`utf8`,stdio:`inherit`}).status!==0&&console.log(`(Note: formatter not found — output may need manual formatting)`)}catch{}}const J=[`@cascivo/core`,`@cascivo/tokens`,`@cascivo/themes`,`@preact/signals-react`],Y=[`cascivo`];async function St(){let e=R({input:k,output:re});try{let t=(await e.question(`Theme? (${a.join(`/`)}) [light]: `)).trim().toLowerCase();return a.includes(t)?t:`light`}finally{e.close()}}function Ct(e){return`import type { CascadeConfig } from 'cascivo'
|
|
38
38
|
|
|
39
39
|
const config: CascadeConfig = {
|
|
40
40
|
registry: '${r.registry}',
|
|
@@ -43,26 +43,26 @@ const config: CascadeConfig = {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export default config
|
|
46
|
-
`}const
|
|
47
|
-
ESLint: copied cascivo source may trip a strict host config on stylistic rules.`),console.log(` Scope them off your components dir — see docs/USING-WITH-STRICT-ESLINT.md`))}function
|
|
46
|
+
`}const wt=[`eslint.config.js`,`eslint.config.mjs`,`eslint.config.cjs`,`eslint.config.ts`,`.eslintrc`,`.eslintrc.js`,`.eslintrc.cjs`,`.eslintrc.json`,`.eslintrc.yml`,`.eslintrc.yaml`];function Tt(e){wt.some(t=>A(P(e,t)))&&(console.log(`
|
|
47
|
+
ESLint: copied cascivo source may trip a strict host config on stylistic rules.`),console.log(` Scope them off your components dir — see docs/USING-WITH-STRICT-ESLINT.md`))}function Et(e,t,n){let r=P(e,`package.json`);if(!A(r))return[];let i;try{i=JSON.parse(j(r,`utf8`))}catch{return[]}let a=n.dev?`devDependencies`:`dependencies`,o=i[a]??={},s=[];for(let e of t)o[e]===void 0&&(o[e]=`latest`,s.push(e));return s.length===0?[]:(N(r,`${JSON.stringify(i,null,2)}\n`,`utf8`),s)}const Dt=[{config:[`.prettierrc`,`.prettierrc.json`,`.prettierrc.js`,`prettier.config.js`],ignore:`.prettierignore`},{config:[`.oxfmtrc`,`.oxfmtrc.json`],ignore:`.oxfmtignore`}];function Ot(e,t){let n=`${t.replace(/\/+$/,``)}/`;for(let{config:t,ignore:r}of Dt){if(!(t.some(t=>A(P(e,t)))||kt(e,r)))continue;let i=P(e,r),a=A(i)?j(i,`utf8`):``;if(a.split(`
|
|
48
48
|
`).some(e=>e.trim()===n))continue;let o=`# cascivo: vendored component source — you own it, so do not reformat it
|
|
49
49
|
`,s=a===``?o+n+`
|
|
50
50
|
`:`${a.replace(/\n*$/,`
|
|
51
|
-
`)}\n${o}${n}\n`;
|
|
52
|
-
Astro detected. Next steps:`),console.log(` npx astro add @cascivo/astro # layer order, theme and no-flash script, zero config`),console.log(` Compose compound components (Tabs, Accordion, Popover…) inside one .tsx island:`),console.log(` Astro renders each .astro child separately, so React context cannot reach their parts.`),console.log(` Hydrate only the interactive islands: client:visible or client:load on those,`),console.log(` and leave static pieces without a client: directive.`))}function
|
|
53
|
-
Dependencies`),console.log(` runtime: ${
|
|
54
|
-
Skipped install (--no-install). Install the dependencies yourself:`),console.log(` ${o(d,
|
|
55
|
-
Install failed — cascivo.config.ts was written but the packages are not installed.`),r.length>0?(console.error(`Wrote ${r.length} dependency entries to package.json: ${r.join(`, `)}`),console.error(`Recover with:\n ${d} install`)):console.error(`Recover with:\n ${o(d,
|
|
51
|
+
`)}\n${o}${n}\n`;N(i,s,`utf8`),console.log(`\nAdded "${n}" to ${r} (so your formatter does not rewrite copied source).`)}}function kt(e,t){if(t!==`.prettierignore`)return!1;let n=P(e,`package.json`);if(!A(n))return!1;try{return`prettier`in JSON.parse(j(n,`utf8`))}catch{return!1}}const At=[`astro.config.mjs`,`astro.config.ts`,`astro.config.js`,`astro.config.mts`];function jt(e){At.some(t=>A(P(e,t)))&&(console.log(`
|
|
52
|
+
Astro detected. Next steps:`),console.log(` npx astro add @cascivo/astro # layer order, theme and no-flash script, zero config`),console.log(` Compose compound components (Tabs, Accordion, Popover…) inside one .tsx island:`),console.log(` Astro renders each .astro child separately, so React context cannot reach their parts.`),console.log(` Hydrate only the interactive islands: client:visible or client:load on those,`),console.log(` and leave static pieces without a client: directive.`))}function Mt(){console.log(`
|
|
53
|
+
Dependencies`),console.log(` runtime: ${J.join(` `)}`),console.log(` dev: ${Y.join(` `)} (types for cascivo.config.ts)`),console.log(" on demand: @cascivo/i18n, @cascivo/charts — added by `cascivo add` when a component or chart needs them")}async function Nt(e=[],n=process.cwd()){let i=e.includes(`--yes`)||e.includes(`-y`),s=e.includes(`--no-install`),l=T(e,`theme`)?.toLowerCase();if(l!==void 0&&!a.includes(l)){console.error(`Unknown theme "${l}". Available: ${a.join(`, `)}`),process.exitCode=1;return}let u=w(e);if(`error`in u){console.error(u.error),process.exitCode=1;return}let d=t(n,u.pm?{override:u.pm}:{}),f=l===void 0&&!i&&k.isTTY,p=l??(f?await St():`light`),m=P(n,`cascivo.config.ts`);if(await c(m,Ct(p)),console.log(`\nCreated cascivo.config.ts (theme: ${p})`),s)console.log(`
|
|
54
|
+
Skipped install (--no-install). Install the dependencies yourself:`),console.log(` ${o(d,J)}`),console.log(` ${o(d,Y,{dev:!0})}`);else{let e=z(J,n,{pm:d}),t=z(Y,n,{pm:d,dev:!0});if(!e||!t){let r=[...e?[]:Et(n,J,{dev:!1}),...t?[]:Et(n,Y,{dev:!0})];console.error(`
|
|
55
|
+
Install failed — cascivo.config.ts was written but the packages are not installed.`),r.length>0?(console.error(`Wrote ${r.length} dependency entries to package.json: ${r.join(`, `)}`),console.error(`Recover with:\n ${d} install`)):console.error(`Recover with:\n ${o(d,J)}\n ${o(d,Y,{dev:!0})}`),process.exitCode=1}}console.log(`
|
|
56
56
|
Stylesheets — import these once, in this order, in your entry file:`),console.log(` import '@cascivo/tokens' // primitive tokens — every --cascivo-* value`),console.log(` import '@cascivo/themes/${p}.css'${` `.repeat(Math.max(1,16-p.length))}// the ${p} theme's semantic values`),console.log(" // …then your component CSS (`cascivo add` writes .module.css beside each component)"),console.log(`
|
|
57
57
|
Then set the theme on your root element:`),console.log(` <html data-theme="${p}">`),console.log(`
|
|
58
58
|
Switching themes at runtime? Use a bundle instead of the single theme:`),console.log(` import '@cascivo/themes/light-dark.css' // light + dark — the common case`),console.log(` import '@cascivo/themes/all.css' // all twelve themes`),console.log(` import { ThemeProvider } from '@cascivo/core'`),console.log(`
|
|
59
59
|
In YOUR components, when you read a signal during render:`),console.log(` import { useSignals } from '@cascivo/core'`),console.log(` function MyComponent() {`),console.log(` useSignals() // ← first statement, or the component never re-renders`),console.log(` return <span>{count.value}</span>`),console.log(` }`),console.log(`
|
|
60
|
-
Adding a chart later? Charts ship as an npm package with their own stylesheet:`),console.log(" import '@cascivo/charts/styles.css' // `cascivo add <chart>` reminds you"),
|
|
60
|
+
Adding a chart later? Charts ship as an npm package with their own stylesheet:`),console.log(" import '@cascivo/charts/styles.css' // `cascivo add <chart>` reminds you"),Mt(),Ot(n,r.outputDir),Tt(n),jt(n),console.log(`
|
|
61
61
|
Packages version independently (changesets), so a low number means fewer`),console.log(`releases, not less finished. Pin exact versions, and before upgrading run:`),console.log(` cascivo doctor --drift # reads breaking-changes.json, reports API drift`),console.log(`
|
|
62
|
-
Add components with: cascivo add <name>`)}const
|
|
63
|
-
`)}function
|
|
62
|
+
Add components with: cascivo add <name>`)}const Pt={component:`Components`,layout:`Layouts (copy-paste)`,block:`Blocks (copy-paste)`,section:`Sections (copy-paste)`,chart:`Charts (npm: @cascivo/charts)`,flow:`Flow (npm: @cascivo/flow)`,editor:`Editor (npm: @cascivo/editor)`};function Ft(e){return e.deprecated?` ⚠ deprecated → ${e.deprecated.replacement}`:``}function It(e){let t=e.map(e=>[e.name,e.category,e.description+Ft(e)]),n=[`Name`,`Category`,`Description`],r=n.map((e,n)=>Math.max(e.length,...t.map(e=>(e[n]??``).length))),i=e=>e.map((e,t)=>e.padEnd(r[t]??e.length)).join(` `).trimEnd(),a=r.map(e=>`-`.repeat(e)).join(` `);return[i(n),a,...t.map(i)].join(`
|
|
63
|
+
`)}function Lt(e){if(e.length===0)return`No components found.`;if(!e.some(e=>e.type!==void 0))return It(e);let t=/* @__PURE__ */ new Map;for(let n of e){let e=n.type??`component`;t.has(e)||t.set(e,[]),t.get(e).push(n)}let n=[];for(let[e,r]of t){let t=Pt[e]??e;n.push(`${t}\n${It(r)}`)}return n.join(`
|
|
64
64
|
|
|
65
|
-
`)}async function
|
|
65
|
+
`)}async function Rt(e,t={}){let n=(await y(e.registry)).components;t.installed&&(n=n.filter(t=>{let n=t.name.includes(`/`)?t.name.split(`/`).pop():t.name;return A(P(process.cwd(),e.outputDir,n))})),console.log(Lt(n)),console.log("\nTip: install any entry by its bare name — `cascivo add flex` resolves to `layout/flex`. Layout primitives (Flex, Grid, AutoGrid, Columns, Spacer, Center) replace inline-style layout; see docs/cookbooks/layout-and-spacing.md.")}function zt(e){let t=[],n=[],r=new Set(e.items.map(e=>e.name));for(let i of e.items)if(I(i)){for(let e of me(i))t.push(`template "${i.name}": ${e}`);for(let e of i.registryDependencies??[])!(e.includes(`/`)||e.startsWith(`@`)||e.startsWith(`http`))&&!r.has(e)&&n.push(`template "${i.name}": component "${e}" is not in this index — it must resolve from another registry at install time`)}return{errors:t,warnings:n}}async function Bt(e){let t=`cascade-registry.json`,n=`public/r`;for(let r=0;r<e.length;r++)e[r]===`--in`&&e[r+1]?(t=e[r+1],r++):e[r]===`--out`&&e[r+1]&&(n=e[r+1],r++);let r=F(t);if(!A(r)){console.error(`cascade registry build: file not found: ${r}`),process.exitCode=1;return}let i=JSON.parse(await ce(r,`utf8`));oe(r);let a=typeof i==`object`&&i&&i.schemaVersion===2?i:de(i),o=fe(a);if(o.warnings.length>0)for(let e of o.warnings)console.warn(`warn: ${e}`);if(!o.ok){for(let e of o.errors)console.error(`error: ${e}`);process.exitCode=1;return}let s=zt(a);for(let e of s.warnings)console.warn(`warn: ${e}`);if(s.errors.length>0){for(let e of s.errors)console.error(`error: ${e}`);process.exitCode=1;return}let c=F(n);await ue(a,c),console.log(`cascade registry build: wrote static output to ${c}`)}function Vt(e,t){let n=t.toLowerCase();return e.name.toLowerCase().includes(n)||e.description.toLowerCase().includes(n)||e.tags.some(e=>e.toLowerCase().includes(n))}async function Ht(e,t){let n=e.indexOf(`--registry`),r=n===-1?void 0:e[n+1],i=e.filter((t,n)=>t!==`--registry`&&e[n-1]!==`--registry`).join(` `).trim();if(!i){console.error(`Usage: cascivo search <query> [--registry @ns]`);return}let a=[];if(!r){let e=await y(t.registry);for(let t of e.components)Vt(t,i)&&a.push({name:t.name,version:t.version,description:t.description})}let o=t.registries??{};for(let[e,t]of Object.entries(o))if(!(r&&e!==r))try{let n=(typeof t==`string`?t:t.url).replace(/{name}[^$]*$/,``).replace(/\/$/,``)+`/registry.json`,r=await p(n),o=typeof r==`object`&&r&&Array.isArray(r.items)?r.items??[]:[];for(let t of o){if(!pe(t).ok)continue;let n=t;Vt(n,i)&&a.push({name:`${e}/${n.name}`,version:n.version,description:n.description,registry:e})}}catch{console.warn(` [warn] Could not search ${e} registry`)}if(a.length===0){console.log(`No results found.`);return}for(let e of a){let t=e.registry?` (${e.registry})`:``;console.log(`${e.name}@${e.version}${t} — ${e.description}`)}}const X={baseMode:`light`,accentHue:250,accentChroma:.2,radiusBase:.375,fontFamily:`system`,presetId:`light`};function Ut(e){if(!e)return null;try{let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=atob(t),r=JSON.parse(n);return{baseMode:r.baseMode===`dark`?`dark`:`light`,accentHue:typeof r.accentHue==`number`?r.accentHue:X.accentHue,accentChroma:typeof r.accentChroma==`number`?r.accentChroma:X.accentChroma,radiusBase:typeof r.radiusBase==`number`?r.radiusBase:X.radiusBase,fontFamily:r.fontFamily??X.fontFamily,presetId:r.presetId??null}}catch{return null}}const Wt={geometric:`'Futura', 'Century Gothic', 'Trebuchet MS', ui-sans-serif, sans-serif`,humanist:`'Gill Sans', 'Trebuchet MS', 'Calibri', ui-sans-serif, sans-serif`,transitional:`'Optima', 'Candara', 'Palatino Linotype', ui-sans-serif, sans-serif`,mono:`ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace`};function Gt(e){let t=e.baseMode===`light`,n=e.accentHue,r=e.accentChroma;return{accent:{l:t?.52:.65,c:r,h:n},hover:{l:t?.45:.707,c:r,h:n},active:{l:t?.373:.808,c:Math.min(r,.155),h:n},subtle:{l:t?.97:.623,c:.025,h:n},muted:{l:t?.932:.623,c:t?.055:r*.2,h:n}}}function Kt(e,t={}){let{previewMode:n=!1,themeName:r=`create-custom`}=t,i=e.baseMode===`light`,a=e.accentHue,o=Gt(e),s=e=>`oklch(${o[e].l} ${o[e].c.toFixed(3)} ${a})`,c=[`/* Add to your project CSS after importing the base theme: */`,`/* @import '@cascivo/themes/${e.baseMode}.css'; */`,`/* @import './theme.css'; */`,``,`@layer cascivo.theme {`,` [data-theme="${r}"] {`];return n&&(c.push(i?`
|
|
66
66
|
color-scheme: light;
|
|
67
67
|
--cascivo-color-background: oklch(1 0 0);
|
|
68
68
|
--cascivo-color-surface: oklch(0.985 0.002 264);
|
|
@@ -158,16 +158,16 @@ Add components with: cascivo add <name>`)}const Nt={component:`Components`,layou
|
|
|
158
158
|
--cascivo-ring-width: 2px;
|
|
159
159
|
--cascivo-ring-offset: 0px;
|
|
160
160
|
--cascivo-ring-color: color-mix(in oklch, var(--cascivo-color-accent) 65%, transparent);
|
|
161
|
-
--cascivo-focus-ring: 0 0 0 var(--cascivo-ring-width) var(--cascivo-ring-color);`),c.push(``)),c.push(` /* ── Accent ─────────────────────────────────── */`,` --cascivo-color-accent: ${s(
|
|
162
|
-
`)}const
|
|
163
|
-
Import the base theme and your overlay in your entry CSS:`),console.log(` @import '@cascivo/themes/${a.baseMode}.css';`),console.log(` @import './${n}.theme.css';`),console.log(`Then set it on a container:`),console.log(` <div data-theme="${n}">…</div>`)}async function
|
|
164
|
-
Import the theme in your root CSS or entry file:`),console.log(` import '@cascivo/themes/${n}.css'`),console.log(`Then set it on a container:`),console.log(` <div data-theme="${n}">…</div>`)}function
|
|
161
|
+
--cascivo-focus-ring: 0 0 0 var(--cascivo-ring-width) var(--cascivo-ring-color);`),c.push(``)),c.push(` /* ── Accent ─────────────────────────────────── */`,` --cascivo-color-accent: ${s(`accent`)};`,` --cascivo-color-accent-foreground: ${i?`oklch(1 0 0)`:`oklch(0.145 0.005 ${a})`};`,` --cascivo-color-accent-hover: ${s(`hover`)};`,` --cascivo-color-accent-active: ${s(`active`)};`,` --cascivo-color-accent-subtle: ${s(`subtle`)};`,` --cascivo-color-accent-muted: ${s(`muted`)};`,``,` /* ── Radius ─────────────────────────────────── */`,` --cascivo-radius-base: ${e.radiusBase}rem;`,` --cascivo-radius-control: var(--cascivo-radius-base);`,` --cascivo-radius-surface: calc(var(--cascivo-radius-base) * 1.66);`,` --cascivo-radius-indicator: calc(var(--cascivo-radius-base) / 2);`,` --cascivo-radius-full: 9999px;`,` --cascivo-radius-component: var(--cascivo-radius-base);`,` --cascivo-radius-button: var(--cascivo-radius-base);`,` --cascivo-radius-input: var(--cascivo-radius-base);`,` --cascivo-radius-card: calc(var(--cascivo-radius-base) * 1.66);`,` --cascivo-radius-badge: var(--cascivo-radius-full);`,` --cascivo-radius-modal: calc(var(--cascivo-radius-base) * 2);`),e.fontFamily!==`system`&&(c.push(``),c.push(` /* ── Font ───────────────────────────────────── */`),c.push(` --cascivo-font-sans: ${Wt[e.fontFamily]??Wt.humanist};`)),c.push(` }`),c.push(`}`),c.join(`
|
|
162
|
+
`)}const qt=/^[a-z][a-z0-9-]*$/;function Jt(e,t){let n=e.find(e=>e.startsWith(`--${t}=`));if(n)return n.slice(t.length+3);let r=e.indexOf(`--${t}`),i=r===-1?void 0:e[r+1];return i&&!i.startsWith(`--`)?i:void 0}async function Yt(e,t){let n=e.find(e=>!e.startsWith(`--`)),r=Jt(e,`from`),i=e.includes(`--dry-run`);if(!n||!r){console.error(`Usage: cascivo theme create <name> --from <hash> [--out <path>]`),console.error(`Get <hash> from the theme builder at https://cascivo.com/create (Copy CLI command).`);return}if(!qt.test(n)){console.error(`Invalid theme name "${n}". Use lowercase letters, digits, and dashes.`);return}let a=Ut(r);if(!a){console.error(`Could not decode --from. Copy the command again from the theme builder.`);return}let o=Kt(a,{themeName:n});if(i){console.log(o);return}let s=F(t,Jt(e,`out`)??`${n}.theme.css`);await c(s,o),console.log(`\n✓ Wrote ${n}.theme.css`),console.log(`
|
|
163
|
+
Import the base theme and your overlay in your entry CSS:`),console.log(` @import '@cascivo/themes/${a.baseMode}.css';`),console.log(` @import './${n}.theme.css';`),console.log(`Then set it on a container:`),console.log(` <div data-theme="${n}">…</div>`)}async function Xt(e){let[t,n]=e;if(t===`create`){await Yt(e.slice(1),process.cwd());return}if(t!==`add`||!n){console.error(`Usage: cascivo theme add <${a.join(`|`)}>`),console.error(` cascivo theme create <name> --from <hash>`);return}if(!a.includes(n)){console.error(`Unknown theme "${n}". Available: ${a.join(`, `)}`);return}z([`@cascivo/themes`]),console.log(`
|
|
164
|
+
Import the theme in your root CSS or entry file:`),console.log(` import '@cascivo/themes/${n}.css'`),console.log(`Then set it on a container:`),console.log(` <div data-theme="${n}">…</div>`)}function Zt(e,t){let n=e.split(`
|
|
165
165
|
`),r=t.split(`
|
|
166
|
-
`),i=n.length,a=r.length,o=Array.from({length:i+1},()=>Array.from({length:a+1},()=>0));for(let e=i-1;e>=0;e--)for(let t=a-1;t>=0;t--)o[e][t]=n[e]===r[t]?o[e+1][t+1]+1:Math.max(o[e+1][t],o[e][t+1]);let s=[],c=0,l=0;for(;c<i&&l<a;)n[c]===r[l]?(s.push(` ${n[c]}`),c++,l++):o[c+1][l]>=o[c][l+1]?(s.push(`- ${n[c]}`),c++):(s.push(`+ ${r[l]}`),l++);for(;c<i;)s.push(`- ${n[c++]}`);for(;l<a;)s.push(`+ ${r[l++]}`);return s}function
|
|
167
|
-
`)),i.push({path:a,content:r}))}if(i.length===0){console.log(`${e} is already up to date.`);return}if(r.yes||await
|
|
166
|
+
`),i=n.length,a=r.length,o=Array.from({length:i+1},()=>Array.from({length:a+1},()=>0));for(let e=i-1;e>=0;e--)for(let t=a-1;t>=0;t--)o[e][t]=n[e]===r[t]?o[e+1][t+1]+1:Math.max(o[e+1][t],o[e][t+1]);let s=[],c=0,l=0;for(;c<i&&l<a;)n[c]===r[l]?(s.push(` ${n[c]}`),c++,l++):o[c+1][l]>=o[c][l+1]?(s.push(`- ${n[c]}`),c++):(s.push(`+ ${r[l]}`),l++);for(;c<i;)s.push(`- ${n[c++]}`);for(;l<a;)s.push(`+ ${r[l++]}`);return s}function Qt(e,t){return e!==t}async function $t(e){let t=R({input:k,output:re});try{let n=(await t.question(`${e} (y/N): `)).trim().toLowerCase();return n===`y`||n===`yes`}finally{t.close()}}async function en(e,t,n={}){if(n.check)return nn(t);if(!e){console.error(`Usage: cascivo update <component>`);return}let r=(await v())?.items[e],i=await y(t.registry),a=h(i,e);if(!a){console.error(`Component "${e}" not found in registry. Run "cascivo list".`);return}if(r){let i=r.version,o=`${r.registry}/r/${e}@${i}.json`,s=null;try{s=L(await p(o),o)}catch{console.warn(`Warning: could not fetch base version ${i} from ${o}. Falling back to two-way diff.`)}s?await tn(e,a,s,t,n):await Z(e,a,t,n)}else console.warn(`Warning: "${e}" has no lock entry. Falling back to two-way diff update (pre-v11 install).`),await Z(e,a,t,n)}async function tn(e,t,n,r,i){if(!t)return;let a=e.includes(`/`)?e.split(`/`).pop():e,o=[],s=[];for(let e of t.files){let t=b(e),i=n.files.find(e=>b(e.url)===t),c=u(r.outputDir,a,t),l=await f(e),d=A(c)?await ce(c,`utf8`):``,p=i?await f(i.url):``;if(p===``&&d===``){o.push({file:t,result:`clean`}),s.push({dest:c,content:l,conflicts:0});continue}let{text:m,conflicts:h}=E(p,d,l);if(h>0)o.push({file:t,result:`conflict`});else if(m===d){o.push({file:t,result:`unchanged`});continue}else o.push({file:t,result:`clean`});s.push({dest:c,content:m,conflicts:h})}if(s.length===0){console.log(`${e} is already up to date.`);return}for(let e of o){let t=e.result===`conflict`?`⚠`:e.result===`clean`?`✓`:`·`;console.log(` ${t} ${e.file} (${e.result})`)}let l=s.filter(e=>e.conflicts>0);if((i.yes?l.length===0:await $t(`\nApply ${s.length} change(s) to ${e}?`))||i.yes){let n=await v(),r=n;for(let{dest:e,content:t,conflicts:n}of s){if(i.yes&&n>0){console.log(` skipped (conflicts): ${e}`);continue}await c(e,t)}if(n&&r){let i=l.length>0;r=g(r,e,{...n.items[e],version:t.version,...i?{conflicted:!0}:{}}),await m(r)}console.log(`Updated ${e}.`),l.length>0&&console.log(`${l.length} file(s) have conflict markers — resolve them manually.`)}else console.log(`Aborted. No files changed.`)}async function Z(e,t,n,r){if(!t)return;let i=[];for(let e of t.files){let r;try{r=await f(e)}catch(e){console.error(e instanceof Error?e.message:String(e));return}let a=u(n.outputDir,t.name,b(e)),o=await l(a);o===null?(console.log(`New file: ${a}`),i.push({path:a,content:r})):Qt(o,r)&&(console.log(`\n--- ${a}`),console.log(Zt(o,r).join(`
|
|
167
|
+
`)),i.push({path:a,content:r}))}if(i.length===0){console.log(`${e} is already up to date.`);return}if(r.yes||await $t(`\nApply ${i.length} change(s) to ${e}?`)){for(let{path:e,content:t}of i)await c(e,t);console.log(`Updated ${e}.`)}else console.log(`Aborted. No files changed.`)}async function nn(e){let t=await v();if(!t||Object.keys(t.items).length===0){console.log(`No installed components found in cascivo.lock.`);return}let n=await y(e.registry),r=0;for(let[e,i]of Object.entries(t.items)){let t=h(n,e);if(t){if(t.fileHashes&&Object.keys(t.fileHashes).length>0){let n=new Map(Object.entries(i.files).map(([e,t])=>[e.split(`/`).pop(),t])),a=Object.entries(t.fileHashes).filter(([e,t])=>n.get(e)!==t);a.length>0&&(console.log(`${e}: ${a.length} file(s) changed upstream (${i.version} → ${t.version})`),r++)}else t.version!==i.version&&(console.log(`${e}: ${i.version} → ${t.version}`),r++)}}r>0?(console.log(`${r} component(s) outdated.`),process.exitCode=1):console.log(`All components up to date.`)}function rn(e){let t=[];if(t.push(`\n${e.name} v${e.version}`),t.push(`Type: ${e.type}${e.category?` / ${e.category}`:``}`),t.push(e.description),e.author&&t.push(`Author: ${e.author}`),e.license&&t.push(`License: ${e.license}`),e.homepage&&t.push(`Homepage: ${e.homepage}`),e.install?(t.push(`Distribution: npm package — pnpm add ${e.install}`),e.styles&&t.push(`Stylesheet: import '${e.styles}' (required)`)):I(e)||t.push(`Distribution: copy-paste — npx cascivo add ${e.name}`),I(e))try{let n=le(e.meta);if(t.push(`\nTemplate: ${n.intent}`),t.push(`Framework: ${n.framework}`),n.demoUrl&&t.push(`Demo: ${n.demoUrl}`),n.pages?.length){t.push(`Pages:`);for(let e of n.pages)t.push(` ${e.name} → ${e.target}`)}}catch{}if(e.changelog?.length){t.push(`
|
|
168
168
|
Changelog:`);for(let n of e.changelog.slice(0,5))t.push(` ${n.version}: ${n.note}`)}if(e.files?.length){t.push(`
|
|
169
|
-
Files:`);for(let n of e.files)t.push(` ${n.url}${n.target?` → ${n.target}`:``}`)}if(e.dependencies?.length&&t.push(`\nDependencies: ${e.dependencies.join(`, `)}`),e.registryDependencies?.length){let n=
|
|
170
|
-
`)}async function
|
|
169
|
+
Files:`);for(let n of e.files)t.push(` ${n.url}${n.target?` → ${n.target}`:``}`)}if(e.dependencies?.length&&t.push(`\nDependencies: ${e.dependencies.join(`, `)}`),e.registryDependencies?.length){let n=I(e)?`Components`:`Registry dependencies`;t.push(`${n}: ${e.registryDependencies.join(`, `)}`)}return t.join(`
|
|
170
|
+
`)}async function an(e,t){let n=e[0];if(!n){console.error(`Usage: cascivo view <component-spec>`);return}let{url:r,headers:i,params:a}=await U(V(n),t),o={};i&&(o.headers=i),a&&(o.params=a);let s=L(await p(r,o),r);console.log(rn(s))}const Q=D(import.meta.url)(`../package.json`).version,on=`cascivo ${Q} — the CSS-native, signal-driven, AI-first design system
|
|
171
171
|
|
|
172
172
|
Usage: cascivo <command> [options]
|
|
173
173
|
|
|
@@ -187,13 +187,15 @@ Commands:
|
|
|
187
187
|
generate <config.json> Generate TSX from a ViewConfig JSON file
|
|
188
188
|
doctor [--ci] Check components for rule violations
|
|
189
189
|
audit --ai <paths...> Audit AI-generated code against the cascivo contract
|
|
190
|
+
design <subcommand> Plan a page from a brief and audit the rendered result
|
|
191
|
+
(check | see | plan | init | theme; needs @cascivo/design)
|
|
190
192
|
mcp init Add the cascivo MCP server to your agent's config
|
|
191
193
|
registry build Build a static registry from a cascivo-registry.json file
|
|
192
194
|
template init <name> Scaffold a new template (source + manifest + registry entry)
|
|
193
195
|
tokens import <file> Import external design tokens as cascivo overrides
|
|
194
196
|
email lint <file...> Check rendered email HTML for client support and dead links
|
|
195
197
|
|
|
196
|
-
Run "cascivo <command> --help" for details.`,$=a.join(` | `),
|
|
198
|
+
Run "cascivo <command> --help" for details.`,$=a.join(` | `),sn={app:`Usage: cascivo app add page "<title>" [options]
|
|
197
199
|
cascivo app add example <name>
|
|
198
200
|
cascivo app upgrade
|
|
199
201
|
|
|
@@ -375,7 +377,42 @@ Options:
|
|
|
375
377
|
--json Machine-readable output
|
|
376
378
|
--level <name> Minimum finding level to report (error | warn; default error)
|
|
377
379
|
--contract <path> Use this audit-contract.json instead of the bundled one
|
|
378
|
-
--verbose Report which contract source was used`,
|
|
380
|
+
--verbose Report which contract source was used`,design:`Usage: cascivo design check <url|path> [--json] [--max N] [--design <path>] [--storage-state <file>]
|
|
381
|
+
cascivo design see <url|path> [--width N] [--out file.png] [--storage-state <file>]
|
|
382
|
+
cascivo design plan "<brief>" [--format cv|view] [--json]
|
|
383
|
+
cascivo design init [--theme <name>] [--force] [direction flags]
|
|
384
|
+
cascivo design theme --seed <hex> [--mode light|dark] [--name <name>]
|
|
385
|
+
cascivo design skill [--dir <skills-dir>] [--force]
|
|
386
|
+
|
|
387
|
+
Deterministic UI planning and auditing for AI agents, from @cascivo/design (install it
|
|
388
|
+
in the project first). The same input gives the same output; no model is involved.
|
|
389
|
+
|
|
390
|
+
check Audit a rendered page (a URL or an HTML file). Needs playwright.
|
|
391
|
+
see Print a text digest of a screenshot of the page. Needs playwright.
|
|
392
|
+
plan Turn a brief into a page plan: archetype, slots, components, unmatched words.
|
|
393
|
+
init Write a DESIGN.md (tokens of one theme, then rules). Keeps an existing file.
|
|
394
|
+
theme Derive a theme from one seed colour and print its CSS.
|
|
395
|
+
skill Write the cascivo-design agent skill to .claude/skills/ (offline, version-matched).
|
|
396
|
+
|
|
397
|
+
Options:
|
|
398
|
+
--json Machine-readable output (check, plan)
|
|
399
|
+
--max <n> check: report at most this many findings
|
|
400
|
+
--width <n> see: viewport width in CSS pixels
|
|
401
|
+
--format <f> plan: cv (.cv text) | view (ViewConfig JSON)
|
|
402
|
+
--dir <path> skill: the skills directory to write into (default .claude/skills)
|
|
403
|
+
--seed <hex> theme: the seed colour, e.g. "#0079bf"
|
|
404
|
+
--storage-state <f> check, see: a Playwright storageState JSON (cookies + localStorage) loaded
|
|
405
|
+
into the browser, to audit a page behind a login. Keep it out of git
|
|
406
|
+
(docs/USING-CASCIVO-DESIGN.md shows how to create it).
|
|
407
|
+
--design <p> check: the project's DESIGN.md; its front-matter tokens count as on-scale
|
|
408
|
+
(default ./DESIGN.md when present). Custom properties on :root always count.
|
|
409
|
+
|
|
410
|
+
Direction flags (init): write a chosen look into DESIGN.md and print the :root block for it.
|
|
411
|
+
--accent, --primary, --background, --surface, --text <colour> hex or functional CSS colour
|
|
412
|
+
--font-display <stack> font stack for display and headings
|
|
413
|
+
--font-body <stack> font stack for everything else
|
|
414
|
+
--signature "<text>" the one signature element, in a sentence
|
|
415
|
+
--composition "<text>" the one composition move (the layout default it breaks), in a sentence`,registry:`Usage: cascivo registry build [options]
|
|
379
416
|
|
|
380
417
|
Build a static registry (registry.json + file payloads) from a
|
|
381
418
|
cascivo-registry.json manifest, ready to host on any static file server.
|
|
@@ -393,5 +430,5 @@ Options:
|
|
|
393
430
|
--repo <owner/repo> Repository the template will be hosted in`,tokens:`Usage: cascivo tokens import <file>
|
|
394
431
|
|
|
395
432
|
Import external design tokens (W3C design-tokens JSON) as cascivo token
|
|
396
|
-
overrides.`};async function
|
|
433
|
+
overrides.`};async function cn(e){let[t,...r]=e;if(t!==void 0&&(r.includes(`--help`)||r.includes(`-h`))){let e=sn[t];if(e!==void 0){console.log(e);return}}switch(t){case`create`:let{create:e}=await import(`./create-BMqDBB8r.mjs`);await e(r);break;case`app`:{let{app:e}=await import(`./app-Dt98v4Zq.mjs`);await e(r);break}case`init`:await Nt(r);break;case`add`:{let e=w(r);if(`error`in e){console.error(e.error),process.exitCode=1;break}await Ae(C(r,[`pm`,`package-manager`]),await n(),{dryRun:r.includes(`--dry-run`),yes:r.includes(`--yes`),noInstall:r.includes(`--no-install`),...e.pm?{pm:e.pm}:{}});break}case`list`:await Rt(await n(),{installed:r.includes(`--installed`)});break;case`update`:await en(r.filter(e=>!e.startsWith(`--`))[0],await n(),{check:r.includes(`--check`),yes:r.includes(`--yes`)});break;case`search`:await Ht(r,await n());break;case`view`:await an(r,await n());break;case`theme`:await Xt(r);break;case`eject`:{let{eject:e}=await import(`./eject-CCb1WqVx.mjs`),t=e=>{let t=r.find(t=>t.startsWith(`--${e}=`));if(t)return t.slice(e.length+3);let n=r.indexOf(`--${e}`),i=n===-1?void 0:r[n+1];return i&&!i.startsWith(`--`)?i:void 0},i=t(`tokens`);await e(r,await n(),{...i?{tokens:i.split(`,`).map(e=>e.trim()).filter(Boolean)}:{},...t(`scope`)?{scope:t(`scope`)}:{},...t(`out`)?{out:t(`out`)}:{},dryRun:r.includes(`--dry-run`)});break}case`generate`:await xt(r,await n());break;case`registry`:r[0]===`build`?await Bt(r.slice(1)):(console.error(`Unknown registry subcommand: ${r[0]}`),process.exitCode=1);break;case`template`:if(r[0]===`init`){let{templateInit:e}=await import(`./template-init-BFlRHOxK.mjs`);await e(r.slice(1))}else console.error(`Unknown template subcommand: ${r[0]}`),process.exitCode=1;break;case`doctor`:{let e=r.includes(`--ci`);if(r.includes(`--drift`)){let{runDoctorDrift:e}=await import(`./drift-DiXM2Rag.mjs`);await e(await n())}else{let t=process.cwd(),r=await et(t),{checkDuplicateCore:i,checkFormatterIgnore:a,checkProjectDependencies:o,checkSignalsCompat:s,checkSsrConfig:c,detectInstallPath:l}=await Promise.resolve().then(()=>Me),u=l(t)!==`unknown`,d=u?o(t):[],f=d.filter(e=>e.required),p=u?await s(t):null,m=p?.severity===`error`,h=u?c(t):null,g=u?await i(t):null,_=u?a(t,(await n()).outputDir):null,{runDoctorDrift:v}=await import(`./drift-DiXM2Rag.mjs`),y=u?await v(await n(),t):{ran:!1,reason:`no cascivo install detected`,issues:0};if(r.passed&&d.length===0&&p===null&&h===null&&g===null&&_===null&&y.issues===0)console.log(y.ran?`No violations found.`:`No violations found (drift: not checked — ${y.reason}).`);else{for(let e of r.violations)console.error(`[${e.rule}] ${e.detail}\n ${e.file}`);for(let e of f)console.error(e.kind===`forbidden`?`[forbidden-dependency] ${e.package} must not be a direct dependency here. Remove it — ${e.hint}`:`[missing-dependency] ${e.package} is not in package.json. Install: ${e.hint}`);p&&(m?console.error:console.log)(`[${m?`signals-incompatible`:`signals-outdated`}] ${p.detail} Upgrade: ${p.hint}`),h&&console.log(`[ssr-config] ${h}`),_&&console.log(`[formatter-drift] ${_}`),g&&console.error(`[duplicate-core] More than one @cascivo/core is installed (root: ${g.root??`none`}; ${g.nested.join(`; `)}). `+g.hint);for(let e of d.filter(e=>!e.required))console.log(`[optional] ${e.package} is not installed; add it when a component or chart needs it: ${e.hint}`);e&&(r.violations.length>0||f.length>0||m||g!==null||y.issues>0)&&(process.exitCode=1)}}break}case`mcp`:{let{mcp:e}=await import(`./mcp-CqX_Yi06.mjs`).then(e=>e.t);await e(r);break}case`audit`:{let{audit:e}=await import(`./audit-Boq9kXpR.mjs`);await e(r,await n());break}case`design`:{let{design:e}=await import(`./design-CYQqMPQB.mjs`);await e(r);break}case`email`:{let{email:e}=await import(`./email-Drn2bDlp.mjs`);await e(r);break}case`tokens`:if(r[0]===`import`){let{tokensImport:e}=await import(`./tokens-VSJC9GgT.mjs`);await e(r.slice(1))}else console.error(`Unknown tokens subcommand: ${r[0]}`),process.exitCode=1;break;case void 0:case`--help`:case`-h`:case`help`:console.log(on);break;case`--version`:case`-v`:console.log(Q);break;default:console.error(`Unknown command: ${t}\n`),console.log(on),process.exitCode=1}}O[1]!==void 0&&import.meta.url===ie(O[1]).href&&cn(O.slice(2)).catch(e=>{console.error(e instanceof Error?e.message:String(e)),process.exitCode=1});export{Q as VERSION,cn as run,be as t};
|
|
397
434
|
//# sourceMappingURL=index.mjs.map
|