@shortwind/cli 0.1.0-beta.13 → 0.1.0-beta.14

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.
@@ -168,7 +168,7 @@ const BUNDLED_ORIGIN = "bundled:@shortwind/catalog";
168
168
  function bundledSource() {
169
169
  let cache = null;
170
170
  const load = () => {
171
- cache ??= import("./catalog.generated-BdZstlkf.js");
171
+ cache ??= import("./catalog.generated-fXJjJvJ2.js");
172
172
  return cache;
173
173
  };
174
174
  return {
@@ -464,6 +464,54 @@ function buildThemeSupplement(css, missing) {
464
464
  lines.push("@theme inline {", ...mapping, "}", "/* end shortwind theme-supplement */");
465
465
  return lines.join("\n");
466
466
  }
467
+ const TONE_MARKER = "/* shortwind:tones";
468
+ const TONES = [
469
+ {
470
+ name: "neutral",
471
+ bg: "var(--muted)",
472
+ fg: "var(--muted-foreground)"
473
+ },
474
+ {
475
+ name: "success",
476
+ bg: "oklch(0.962 0.044 156.743)",
477
+ fg: "oklch(0.448 0.119 151.328)",
478
+ darkBg: "oklch(0.393 0.095 152.535)",
479
+ darkFg: "oklch(0.925 0.084 155.995)"
480
+ },
481
+ {
482
+ name: "warning",
483
+ bg: "oklch(0.962 0.059 95.617)",
484
+ fg: "oklch(0.473 0.137 46.201)",
485
+ darkBg: "oklch(0.414 0.112 45.904)",
486
+ darkFg: "oklch(0.924 0.12 95.746)"
487
+ },
488
+ {
489
+ name: "danger",
490
+ bg: "color-mix(in oklab, var(--destructive) 15%, transparent)",
491
+ fg: "var(--destructive)"
492
+ },
493
+ {
494
+ name: "info",
495
+ bg: "color-mix(in oklab, var(--primary) 15%, transparent)",
496
+ fg: "var(--primary)"
497
+ }
498
+ ];
499
+ function buildToneBlock(css) {
500
+ const rule = (name, bg, fg) => `[data-tone="${name}"] { --tone-bg: ${bg}; --tone-fg: ${fg}; }`;
501
+ const lines = [
502
+ `${TONE_MARKER} — semantic tones for tone-aware recipes (@badge, …). Set on an element:`,
503
+ ` <span class="@badge" data-tone="success">. Add your own: [data-tone="sev1"] { --tone-bg: …; --tone-fg: … } */`,
504
+ ...TONES.map((t) => rule(t.name, t.bg, t.fg))
505
+ ];
506
+ const darkTones = TONES.filter((t) => t.darkBg && t.darkFg);
507
+ if (darkTones.length > 0) {
508
+ const darkRules = darkTones.map((t) => " " + rule(t.name, t.darkBg, t.darkFg));
509
+ if (/@custom-variant\s+dark|\.dark\s*\{/.test(css)) lines.push(".dark {", ...darkRules, "}");
510
+ else if (/@media\s*\(\s*prefers-color-scheme\s*:\s*dark\s*\)/.test(css)) lines.push("@media (prefers-color-scheme: dark) {", ...darkRules, "}");
511
+ }
512
+ lines.push("/* end shortwind tones */");
513
+ return lines.join("\n");
514
+ }
467
515
  const COLOR_UTILITY_RE = /^(?:bg|text|border|ring|outline|fill|stroke|divide|accent|caret|decoration|shadow|from|via|to|placeholder)-(.+)$/;
468
516
  function referencedThemeTokens(flattened) {
469
517
  const out = /* @__PURE__ */ new Set();
@@ -660,6 +708,16 @@ async function init(options) {
660
708
  themeAction = "supplemented";
661
709
  }
662
710
  }
711
+ let tonesPath = null;
712
+ let tonesAction = "skipped";
713
+ if (theme.themePath) {
714
+ const css = await readFile(theme.themePath, "utf8");
715
+ tonesPath = theme.themePath;
716
+ if (!css.includes("/* shortwind:tones")) {
717
+ await writeFile(theme.themePath, `${css.replace(/\s*$/, "")}\n\n${buildToneBlock(css)}\n`);
718
+ tonesAction = "written";
719
+ }
720
+ }
663
721
  const safelistCssPaths = [];
664
722
  if (shape.bundler !== "vite" && shape.bundler !== "astro" && skillRegistry) for (const file of findTailwindEntryCssFiles(cwd)) {
665
723
  syncSourceDirectiveToFile(file, skillRegistry);
@@ -682,6 +740,8 @@ async function init(options) {
682
740
  skillPath,
683
741
  themePath: theme.themePath,
684
742
  themeAction,
743
+ tonesPath,
744
+ tonesAction,
685
745
  supplementedThemeTokens,
686
746
  safelistCssPaths,
687
747
  missingThemeTokens,
@@ -2495,4 +2555,4 @@ function formatBenchTable(result) {
2495
2555
  //#endregion
2496
2556
  export { createRegistrySource as A, readConfig as C, init as D, cliVersion as E, extractHeader as F, rewriteHeaderSha as I, sealRecipeFile as L, detectProject as M, buildHeaderLine as N, readLockfile as O, computeBodySha as P, verifyFetchedFamily as R, installedFamilies as S, DEFAULT_REGISTRY as T, reseal as _, extractClassUsages as a, remove as b, verify as c, dev as d, BuildError as f, preset as g, ls as h, DEFAULT_CONTENT as i, resolvePresetFamilies as j, writeLockfile as k, UpgradeError as l, formatLsText as m, formatBenchTable as n, formatFindingsText as o, build as p, ALL_RULES as r, lint as s, bench as t, upgrade as u, NewFamilyError as v, renameFamilyInSource as w, add as x, newFamily as y };
2497
2557
 
2498
- //# sourceMappingURL=bench-B7SxNGiU.js.map
2558
+ //# sourceMappingURL=bench-DQtfv5aq.js.map