zazz-ui 0.3.1 → 0.3.2

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/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  Notable changes to the `zazz-ui` CLI. The CLI versions independently of `@zazz-ui/core` (ADR-0010); the kit's own changelog is the one `update` and `diff` print.
4
4
 
5
+ ## 0.3.2 (2026-10-26)
6
+
7
+ - `init --ts` vendors the kit's `globals.d.ts`, the ambient types the TypeScript sources check against (`window.Utils`, `Signals`, `Toaster`, `CommandEvent`). A full `update` adds it to an existing `--ts` project and keeps it current. If you copied the file in by hand, delete your copy after updating, or TypeScript reports a duplicate `EmblaCarouselType`.
8
+ - The CSP fallback check in the generated `index.js`/`index.ts` reads `style` only after narrowing to `HTMLElement`, so a TypeScript entry (or `checkJs`) no longer flags `el.style` on an `Element`.
9
+
5
10
  ## 0.3.1 (2026-10-13)
6
11
 
7
12
  - `init` vendors the kit's runtime fallbacks (`CORE_FALLBACKS`, from core 0.6.3: the Content Security Policy fallback `base/csp.js` and the `style` parser it imports) and writes their document check into `index.js`, the way the kit's own entry does. A fallback with a gate this CLI does not know is skipped, so a newer kit still vendors.
package/README.md CHANGED
@@ -13,7 +13,7 @@ pnpm dlx zazz-ui add button combobox
13
13
 
14
14
  `init` vendors the base platform into `zazz/` (or `--dir <path>`): the css layers (tokens, reset, typography, generated utilities), the core runtime scripts (plus the scroll-state polyfill, which `index.js` loads only in browsers without container scroll-state queries), an `index.css` and `index.js` entry pair, and a `head.html` snippet to paste into your `<head>` (fonts, import map, polyfills, theme persistence). It also writes `zazz.json`, which records the kit version and a hash of every vendored file's original bytes.
15
15
 
16
- Flags: `--dir <path>`, `--ts` (vendor TypeScript sources instead of compiled js), `--legacy <path>` (wire an existing stylesheet into the `legacy.imports` cascade sublayer), `--no-fonts`, `--no-theme-script`. Re-running `init` repairs the tree: missing files come back, files you edited are left alone.
16
+ Flags: `--dir <path>`, `--ts` (vendor TypeScript sources instead of compiled js, plus the kit's ambient `globals.d.ts`), `--legacy <path>` (wire an existing stylesheet into the `legacy.imports` cascade sublayer), `--no-fonts`, `--no-theme-script`. Re-running `init` repairs the tree: missing files come back, files you edited are left alone.
17
17
 
18
18
  ## What add does
19
19
 
@@ -33,7 +33,7 @@ There is no runtime dependency on `@zazz-ui/core`. The files in `zazz/` are your
33
33
 
34
34
  ## Requirements
35
35
 
36
- Node 22.22+ (or 24.15+). Works with `@zazz-ui/core` 0.1 through 0.6 (manifest v1–v2); given a newer kit, the CLI tells you to upgrade it. Works offline once a kit version is cached; respects your `.npmrc` (registries, proxies, auth). `--registry`, `--offline`, and `--prefer-offline` are available on every command.
36
+ Node 22.22+ (or 24.15+). Works with `@zazz-ui/core` 0.1 through 0.8 (manifest v1–v2); given a newer kit, the CLI tells you to upgrade it. Works offline once a kit version is cached; respects your `.npmrc` (registries, proxies, auth). `--registry`, `--offline`, and `--prefer-offline` are available on every command.
37
37
 
38
38
  ## License
39
39
 
@@ -1,5 +1,5 @@
1
1
  import { t as ZazzError } from "./errors-DC2U2USS.js";
2
- import { _ as resolveKit, a as renderIndexJs, c as createUi, d as baseCssSplit, g as kitSpec, h as loadFetchOptions, i as renderIndexCss, l as apply, m as primitiveFiles, n as insertCssImports, o as sha256, p as baseScriptFiles, r as renderHead, s as vendorFiles, t as appendJsImports, u as describe, v as loadConfig, y as filterCollisions } from "./wiring-C77bl5LR.js";
2
+ import { _ as resolveKit, a as renderIndexJs, c as createUi, d as baseCssSplit, g as kitSpec, h as loadFetchOptions, i as renderIndexCss, l as apply, m as primitiveFiles, n as insertCssImports, o as sha256, p as baseScriptFiles, r as renderHead, s as vendorFiles, t as appendJsImports, u as describe, v as loadConfig, y as filterCollisions } from "./wiring-CWDMdCmo.js";
3
3
  import { existsSync } from "node:fs";
4
4
  import { readFile } from "node:fs/promises";
5
5
  import path from "node:path";
@@ -45,14 +45,17 @@ async function runAdd(names, flags, global) {
45
45
  for (const name of fresh) {
46
46
  const entry = kit.manifest.primitives[name];
47
47
  if (!entry) continue;
48
- const { writes, hashes } = await vendorFiles(kit, primitiveFiles(entry, config.language, { examples: flags.examples === true && names.includes(name) }), destRoot);
48
+ const files = primitiveFiles(entry, config.language, { examples: flags.examples === true && names.includes(name) });
49
+ const { writes, hashes } = await vendorFiles(kit, files, destRoot);
49
50
  vendorWrites.push(...writes);
50
51
  config.primitives[name] = {
51
52
  version: kit.version,
52
53
  files: hashes
53
54
  };
54
55
  }
55
- const base = await vendorFiles(kit, baseScriptFiles(fresh.flatMap((name) => kit.manifest.primitives[name] ?? []), config.language).filter((file) => !(file in config.base.files)), destRoot);
56
+ const freshEntries = fresh.flatMap((name) => kit.manifest.primitives[name] ?? []);
57
+ const neededBase = baseScriptFiles(freshEntries, config.language).filter((file) => !(file in config.base.files));
58
+ const base = await vendorFiles(kit, neededBase, destRoot);
56
59
  vendorWrites.push(...base.writes);
57
60
  Object.assign(config.base.files, base.hashes);
58
61
  const { kept, skipped } = await filterCollisions(vendorWrites, {
package/dist/cli.js CHANGED
@@ -15,19 +15,19 @@ import { Command, Option } from "commander";
15
15
  const { version } = createRequire(import.meta.url)("../package.json");
16
16
  const program = new Command("zazz-ui").description("Vendor Zazz Design Framework primitives into your project").version(version).option("-c, --cwd <path>", "run as if started in <path>", process.cwd()).option("-y, --yes", "answer prompts with their defaults; never block").option("--silent", "no output except errors").option("--registry <url>", "npm registry override").option("--offline", "cache only; never touch the network").option("--prefer-offline", "use cached data without revalidating");
17
17
  program.command("init").description("vendor the Zazz base (tokens, reset, runtime) into this project").argument("[version]", "kit version, @-prefixed (e.g. @0.5.0); default latest").option("--dir <path>", "target directory for vendored files", "zazz").option("--ts", "vendor TypeScript sources instead of compiled .js").option("--legacy <path>", "wire an existing stylesheet into the legacy.imports cascade sublayer").option("--no-fonts", "omit the Geist fonts block from head.html").option("--no-theme-script", "omit the theme-persistence script from head.html").option("--force", "overwrite existing files without asking").option("--dry-run", "print the plan without writing").action(async (versionArg, options) => {
18
- const { runInit } = await import("./init-OVodXfKt.js");
18
+ const { runInit } = await import("./init-DqkIVXKV.js");
19
19
  await runInit(versionArg, options, program.opts());
20
20
  });
21
21
  program.command("update").description("move vendored files to a new kit version with 3-way merges").argument("[args...]", "target version @-prefixed (default @latest) and/or primitive names to narrow to").addOption(new Option("--keep", "resolve every conflict by keeping your version").conflicts(["theirs", "markers"])).addOption(new Option("--theirs", "resolve every conflict by taking the new version").conflicts(["keep", "markers"])).addOption(new Option("--markers", "write diff3 conflict markers for every conflict").conflicts(["keep", "theirs"])).option("--force", "overwrite stray files without asking").option("--dry-run", "print the plan without writing").action(async (args, options) => {
22
- const { runUpdate } = await import("./update-CTuqOys3.js");
22
+ const { runUpdate } = await import("./update-BPtPsPr7.js");
23
23
  await runUpdate(args, options, program.opts());
24
24
  });
25
25
  program.command("diff").description("preview what an update would change (read-only)").argument("[args...]", "target version @-prefixed (default @latest) and/or names to narrow to (base, button, …)").option("--upstream", "compare pristine recorded vs target instead of your files vs target").action(async (args, options) => {
26
- const { runDiff } = await import("./diff-B38wvndQ.js");
26
+ const { runDiff } = await import("./diff-BRTyzqhQ.js");
27
27
  await runDiff(args, options, program.opts());
28
28
  });
29
29
  program.command("add").description("vendor primitives (and their dependencies) at the project's kit version").argument("<primitive...>", "primitive names (e.g. button combobox)").option("--examples", "also copy the primitives' example html").option("--force", "overwrite existing files without asking").option("--dry-run", "print the closure and file plan without writing").action(async (names, options) => {
30
- const { runAdd } = await import("./add-Bm5kc6TG.js");
30
+ const { runAdd } = await import("./add-Cvilkl7S.js");
31
31
  await runAdd(names, options, program.opts());
32
32
  });
33
33
  try {
@@ -1,6 +1,6 @@
1
1
  import { t as ZazzError } from "./errors-DC2U2USS.js";
2
- import { _ as resolveKit, a as renderIndexJs, c as createUi, f as baseFiles, g as kitSpec, h as loadFetchOptions, i as renderIndexCss, m as primitiveFiles, o as sha256, r as renderHead, t as appendJsImports, v as loadConfig } from "./wiring-C77bl5LR.js";
3
- import { a as compareVersions, i as isBinary, o as sliceChangelog, r as splitVersionArgs, t as readChangelog } from "./update-BAfhUb3N.js";
2
+ import { _ as resolveKit, a as renderIndexJs, c as createUi, f as baseFiles, g as kitSpec, h as loadFetchOptions, i as renderIndexCss, m as primitiveFiles, o as sha256, r as renderHead, t as appendJsImports, v as loadConfig } from "./wiring-CWDMdCmo.js";
3
+ import { a as compareVersions, i as isBinary, o as sliceChangelog, r as splitVersionArgs, t as readChangelog } from "./update-CaIG25mx.js";
4
4
  import chalk from "chalk";
5
5
  import { existsSync } from "node:fs";
6
6
  import { readFile } from "node:fs/promises";
@@ -0,0 +1,3 @@
1
+ import { n as runInit, t as parseVersionArg } from "./init-m26gsqEa.js";
2
+
3
+ export { runInit };
@@ -1,5 +1,5 @@
1
1
  import { t as ZazzError } from "./errors-DC2U2USS.js";
2
- import { _ as resolveKit, a as renderIndexJs, c as createUi, f as baseFiles, g as kitSpec, h as loadFetchOptions, i as renderIndexCss, l as apply, o as sha256, r as renderHead, s as vendorFiles, t as appendJsImports, u as describe, v as loadConfig, y as filterCollisions } from "./wiring-C77bl5LR.js";
2
+ import { _ as resolveKit, a as renderIndexJs, c as createUi, f as baseFiles, g as kitSpec, h as loadFetchOptions, i as renderIndexCss, l as apply, o as sha256, r as renderHead, s as vendorFiles, t as appendJsImports, u as describe, v as loadConfig, y as filterCollisions } from "./wiring-CWDMdCmo.js";
3
3
  import { existsSync } from "node:fs";
4
4
  import { readFile } from "node:fs/promises";
5
5
  import path from "node:path";
@@ -142,7 +142,8 @@ async function repair(config, root, context) {
142
142
  });
143
143
  continue;
144
144
  }
145
- if (sha256(await readFile(dest)) === recordedHash) intact += 1;
145
+ const onDisk = await readFile(dest);
146
+ if (sha256(onDisk) === recordedHash) intact += 1;
146
147
  else if (context.force) writes.push({
147
148
  dest,
148
149
  content,
@@ -1,3 +1,3 @@
1
- import { n as runUpdate, r as splitVersionArgs, t as readChangelog } from "./update-BAfhUb3N.js";
1
+ import { n as runUpdate, r as splitVersionArgs, t as readChangelog } from "./update-CaIG25mx.js";
2
2
 
3
3
  export { runUpdate };
@@ -1,6 +1,6 @@
1
1
  import { t as ZazzError } from "./errors-DC2U2USS.js";
2
- import { _ as resolveKit, a as renderIndexJs, c as createUi, f as baseFiles, g as kitSpec, h as loadFetchOptions, i as renderIndexCss, l as apply, m as primitiveFiles, o as sha256, p as baseScriptFiles, r as renderHead, t as appendJsImports, u as describe, v as loadConfig, y as filterCollisions } from "./wiring-C77bl5LR.js";
3
- import { t as parseVersionArg } from "./init-CXljM6FO.js";
2
+ import { _ as resolveKit, a as renderIndexJs, c as createUi, f as baseFiles, g as kitSpec, h as loadFetchOptions, i as renderIndexCss, l as apply, m as primitiveFiles, o as sha256, p as baseScriptFiles, r as renderHead, t as appendJsImports, u as describe, v as loadConfig, y as filterCollisions } from "./wiring-CWDMdCmo.js";
3
+ import { t as parseVersionArg } from "./init-m26gsqEa.js";
4
4
  import chalk from "chalk";
5
5
  import { existsSync } from "node:fs";
6
6
  import { readFile } from "node:fs/promises";
@@ -395,13 +395,21 @@ function scriptVariants(jsPath, language) {
395
395
  if (language === "ts") return [jsPath.replace(/\.js$/, ".ts")];
396
396
  return [jsPath, jsPath.replace(/\.js$/, ".d.ts")];
397
397
  }
398
- /** Everything `init` vendors: base css + core runtime, its polyfills, and its fallbacks, per language. */
398
+ /**
399
+ * Everything `init` vendors: base css + core runtime, its polyfills, and its
400
+ * fallbacks, per language. TypeScript also gets the ambient `globals.d.ts`
401
+ * the sources type-check against (the emitted `.d.ts` files don't need it).
402
+ */
399
403
  function baseFiles(manifest, language) {
400
- return [...baseCss(manifest), ...[
401
- ...coreRuntime(manifest),
402
- ...corePolyfills(manifest).map((polyfill) => polyfill.file),
403
- ...coreFallbacks(manifest).flatMap((fallback) => [fallback.file, ...fallback.requires])
404
- ].flatMap((jsPath) => scriptVariants(jsPath, language))];
404
+ return [
405
+ ...language === "ts" ? ["globals.d.ts"] : [],
406
+ ...baseCss(manifest),
407
+ ...[
408
+ ...coreRuntime(manifest),
409
+ ...corePolyfills(manifest).map((polyfill) => polyfill.file),
410
+ ...coreFallbacks(manifest).flatMap((fallback) => [fallback.file, ...fallback.requires])
411
+ ].flatMap((jsPath) => scriptVariants(jsPath, language))
412
+ ];
405
413
  }
406
414
  /** Everything `add` vendors for one primitive (dependencies resolved by the caller). */
407
415
  function primitiveFiles(entry, language, options) {
@@ -645,7 +653,7 @@ const FALLBACK_SNIPPETS = { "blocked-inline-styles": (specifier) => `// A Conten
645
653
  function blockedInlineStyles() {
646
654
  for (const el of document.querySelectorAll("[style]")) {
647
655
  const text = el.getAttribute("style");
648
- if (text && text.includes(":") && el.style.length === 0) return true;
656
+ if (text && text.includes(":") && el instanceof HTMLElement && el.style.length === 0) return true;
649
657
  }
650
658
  return false;
651
659
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zazz-ui",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "CLI for the Zazz Design Framework — vendors primitives from @zazz-ui/core into your project, with provenance-tracked updates.",
5
5
  "keywords": [
6
6
  "cli",
@@ -32,22 +32,22 @@
32
32
  "access": "public"
33
33
  },
34
34
  "dependencies": {
35
- "@clack/prompts": "^1.7.0",
36
- "@npmcli/config": "^11.0.1",
37
- "chalk": "^6.0.0",
35
+ "@clack/prompts": "^1.8.1",
36
+ "@npmcli/config": "^11.2.0",
37
+ "chalk": "^6.0.1",
38
38
  "commander": "^15.0.0",
39
39
  "diff": "^9.0.0",
40
40
  "node-diff3": "^3.2.1",
41
41
  "pacote": "^22.0.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@types/node": "^26.2.0",
44
+ "@types/node": "^26.6.5",
45
45
  "@types/pacote": "^11.1.8",
46
46
  "tar": "^7.5.22",
47
47
  "typescript": "^7.0.2",
48
- "vite": "npm:@voidzero-dev/vite-plus-core@0.2.4",
49
- "vite-plus": "0.2.4",
50
- "vitest": "4.1.10"
48
+ "vite": "npm:@voidzero-dev/vite-plus-core@1.3.0",
49
+ "vite-plus": "1.3.0",
50
+ "vitest": "5.0.5"
51
51
  },
52
52
  "engines": {
53
53
  "node": "^22.22.2 || ^24.15.0 || >=26.0.0"
@@ -1,3 +0,0 @@
1
- import { n as runInit, t as parseVersionArg } from "./init-CXljM6FO.js";
2
-
3
- export { runInit };