@nebutra/tokens 0.1.2 → 2.0.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.
Files changed (72) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/brands/README.md +66 -0
  3. package/brands/cosmos/DESIGN.md +356 -0
  4. package/brands/cosmos/brand.json +209 -0
  5. package/brands/cosmos/refero-tokens.json +312 -0
  6. package/brands/gsap/brand.json +18 -91
  7. package/brands/linear/DESIGN.md +478 -0
  8. package/brands/linear/brand.json +20 -76
  9. package/brands/notion/brand.json +20 -90
  10. package/brands/raycast/brand.json +19 -81
  11. package/brands/stripe/brand.json +17 -88
  12. package/brands/vanta/brand.json +17 -101
  13. package/brands/vercel/brand.json +17 -68
  14. package/dist/brand-package/index.d.ts +123 -0
  15. package/dist/brand-package/index.js +2316 -0
  16. package/dist/brand-package/index.js.map +1 -0
  17. package/dist/brand-package/use-brand.d.ts +2 -0
  18. package/dist/brand-package/use-brand.js +963 -0
  19. package/dist/brand-package/use-brand.js.map +1 -0
  20. package/dist/index.d.ts +81 -0
  21. package/dist/index.js +2581 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/use-brand-ClmvK_lC.d.ts +387 -0
  24. package/package.json +41 -10
  25. package/recipe.css +330 -1
  26. package/skins/README.md +2 -4
  27. package/skins/cosmos.css +239 -0
  28. package/skins/gsap.css +62 -138
  29. package/skins/linear.css +85 -132
  30. package/skins/notion.css +62 -141
  31. package/skins/raycast.css +68 -137
  32. package/skins/stripe.css +60 -143
  33. package/skins/vanta.css +60 -151
  34. package/skins/vercel.css +83 -128
  35. package/styles.css +477 -115
  36. package/.turbo/turbo-build.log +0 -8
  37. package/.turbo/turbo-typecheck.log +0 -4
  38. package/AGENTS.md +0 -45
  39. package/DESIGN.md +0 -357
  40. package/scripts/compile-brand-run.ts +0 -79
  41. package/scripts/compile-brand.mjs +0 -25
  42. package/scripts/emit-skins-run.ts +0 -62
  43. package/scripts/emit-skins.mjs +0 -31
  44. package/scripts/sync-styles.mjs +0 -29
  45. package/src/brand-package/__tests__/compile-refero.test.ts +0 -427
  46. package/src/brand-package/__tests__/emit-css.test.ts +0 -130
  47. package/src/brand-package/apply-brand.ts +0 -92
  48. package/src/brand-package/compile-helpers.ts +0 -170
  49. package/src/brand-package/compile-refero.ts +0 -69
  50. package/src/brand-package/emit-css.ts +0 -468
  51. package/src/brand-package/hex-to-hsl.ts +0 -100
  52. package/src/brand-package/index.ts +0 -71
  53. package/src/brand-package/infer-recipe.ts +0 -198
  54. package/src/brand-package/normalize.ts +0 -295
  55. package/src/brand-package/presets/context.ts +0 -17
  56. package/src/brand-package/presets/generic.ts +0 -214
  57. package/src/brand-package/presets/gsap.ts +0 -146
  58. package/src/brand-package/presets/index.ts +0 -31
  59. package/src/brand-package/presets/linear.ts +0 -183
  60. package/src/brand-package/presets/notion.ts +0 -208
  61. package/src/brand-package/presets/raycast.ts +0 -138
  62. package/src/brand-package/presets/recipe.ts +0 -61
  63. package/src/brand-package/presets/stripe.ts +0 -207
  64. package/src/brand-package/presets/vanta.ts +0 -220
  65. package/src/brand-package/presets/vercel.ts +0 -187
  66. package/src/brand-package/types.ts +0 -285
  67. package/src/brand-package/use-brand.ts +0 -207
  68. package/src/brand-package/validate.ts +0 -108
  69. package/src/index.ts +0 -67
  70. package/src/theme-provider.tsx +0 -246
  71. package/tsconfig.json +0 -11
  72. package/turbo.json +0 -15
@@ -0,0 +1,123 @@
1
+ import { C as CompileResult, e as BrandPackage, o as ButtonDefaultStyle, E as ElevationStyle, D as Density, p as BrandPackageInput, q as BrandSemanticColors, a as BrandColorRoles, b as BrandElevationTokens, s as BrandModePalette } from '../use-brand-ClmvK_lC.js';
2
+ export { A as ApplyBrandOptions, B as BRAND_STORAGE_KEY, t as BRAND_STYLE_ELEMENT_ID, v as BadgeDefaultStyle, w as BrandExtensions, c as BrandFontFace, x as BrandFontSource, d as BrandIframePreviewOptions, y as BrandModes, f as BrandRadii, g as BrandRecipe, z as BrandRecipeInput, F as BrandTypography, G as CssColor, H as HslChannels, I as UseBrandIframePreviewResult, U as UseBrandOptions, h as UseBrandResult, i as applyBrandCss, j as applyBrandPackage, l as clearBrand, m as getActiveBrandId, r as restorePersistedBrand } from '../use-brand-ClmvK_lC.js';
3
+ import 'react';
4
+
5
+ /**
6
+ * Shared helpers for Refero → Brand Package compilation.
7
+ * Preset builders live in compile-refero.ts; keep color/font extraction here.
8
+ */
9
+ type Json = Record<string, unknown>;
10
+
11
+ /**
12
+ * Compile Refero DTCG tokens.json (+ optional DESIGN.md) into a Brand Package.
13
+ *
14
+ * Structure:
15
+ * compile-helpers.ts — detectPreset, color/font leaf helpers
16
+ * presets/* — named fixture builders (linear…notion) + generic
17
+ * compile-refero.ts — orchestration only
18
+ *
19
+ * Named fixtures are stress-test carriers (not mood presets). Prefer extending
20
+ * the generic path + DESIGN.md inference over adding one-off hacks.
21
+ */
22
+
23
+ /**
24
+ * Compile a Refero-style DTCG tokens.json (+ optional DESIGN.md text) into a Brand Package.
25
+ * Known fixtures get opinionated recipes; generic brands get solid CTAs.
26
+ */
27
+ declare function compileReferoTokens(input: {
28
+ tokens: Json;
29
+ id?: string;
30
+ name?: string;
31
+ designMd?: string;
32
+ }): CompileResult;
33
+
34
+ /**
35
+ * Emit carrier CSS from a normalized Brand Package.
36
+ * Components bind: --primary (= action), --brand-mark, --elevation-*, --radius-*.
37
+ */
38
+
39
+ type EmitBrandCssMode =
40
+ /** Single-skin import / Create Center inject — also binds :root (global swap) */
41
+ "global"
42
+ /** Multi-language catalog — only activates under html[data-brand] */
43
+ | "scoped";
44
+ interface EmitBrandCssOptions {
45
+ /**
46
+ * `global` (default): `:root` + `html[data-brand]` — one import recolors the app.
47
+ * Single-mode dark packs also include `.dark`.
48
+ * Dual-mode packs (`modes.light` + `modes.dark`) emit separate light/dark color blocks.
49
+ * `scoped`: only `html[data-brand]` (+ `html.dark[data-brand]` when dual).
50
+ */
51
+ mode?: EmitBrandCssMode;
52
+ }
53
+ /** Global single-skin selector list — single-mode packs only. */
54
+ declare function emitGlobalSkinSelector(brandId: string, darkDefault: boolean): string;
55
+ /** Light mode selector (dual-mode). */
56
+ declare function emitLightModeSelector(brandId: string, mode: EmitBrandCssMode): string;
57
+ /** Dark mode selector (dual-mode) — never paints light colors under .dark. */
58
+ declare function emitDarkModeSelector(brandId: string, mode: EmitBrandCssMode): string;
59
+ /**
60
+ * Emit a single opt-in skin CSS file from a Brand Package.
61
+ */
62
+ declare function emitBrandCss(brand: BrandPackage, options?: EmitBrandCssOptions): string;
63
+
64
+ /** Convert #rgb / #rrggbb to HSL channel triple "H S% L%" for shadcn-style vars. */
65
+ declare function hexToHslChannels(hex: string): string;
66
+ /**
67
+ * Normalize any common color input to HSL channel triple "H S% L%".
68
+ * Accepts: #hex, "H S% L%", hsl()/hsla(), rgb()/rgba().
69
+ */
70
+ declare function colorToHslChannels(color: string): string;
71
+ /** Prefer {@link colorToHslChannels}; hex-only name kept for call sites. */
72
+ declare function tryHexToHsl(hex: string | undefined, fallback: string): string;
73
+ declare function tryColorToHsl(color: string | undefined, fallback: string): string;
74
+
75
+ interface InferredRecipeHints {
76
+ buttonDefault?: ButtonDefaultStyle;
77
+ elevationPreset?: ElevationStyle;
78
+ density?: Density;
79
+ /** Free radii slots from DESIGN.md tables / free-text */
80
+ radii?: {
81
+ button?: string;
82
+ card?: string;
83
+ };
84
+ notes: string[];
85
+ }
86
+ /**
87
+ * Infer control recipe from DESIGN.md / agent prompt text.
88
+ * Used for generic brands and to refine known fixtures.
89
+ */
90
+ declare function inferRecipeFromDesignMd(designMd: string): InferredRecipeHints;
91
+
92
+ /**
93
+ * Normalize Brand Packages into the carrier contract.
94
+ * Accepts legacy recipe fields and missing roles; always outputs full roles + free elev/radii.
95
+ */
96
+
97
+ /** Expand elevation preset → free CSS tokens. */
98
+ declare function elevationPresetToTokens(preset: ElevationStyle | undefined, cardShadow?: string): BrandElevationTokens;
99
+ declare function rolesFromSemantic(s: BrandSemanticColors, brandMark?: {
100
+ brand?: string;
101
+ brandForeground?: string;
102
+ }): BrandColorRoles;
103
+ /** roles → shadcn semantic: primary ALWAYS tracks action (CTA), never brand mark. */
104
+ declare function semanticFromRoles(r: BrandColorRoles): BrandSemanticColors;
105
+ /** Canonicalize one mode palette → full roles + semantic. */
106
+ declare function normalizeModePalette(palette: BrandModePalette, categoryBrand?: string): {
107
+ roles: BrandColorRoles;
108
+ semantic: BrandSemanticColors;
109
+ };
110
+ /** Ensure package has roles + free radii/elev; strip legacy recipe aliases from output. */
111
+ declare function normalizeBrandPackage(brand: BrandPackage | BrandPackageInput): BrandPackage;
112
+ /** True when package has full dual light+dark palettes. */
113
+ declare function isDualModeBrand(brand: BrandPackage): boolean;
114
+
115
+ interface ValidationResult {
116
+ ok: boolean;
117
+ errors: string[];
118
+ warnings: string[];
119
+ }
120
+ /** Validate carrier contract before Create Center publish. */
121
+ declare function validateBrandPackage(brand: unknown): ValidationResult;
122
+
123
+ export { BrandColorRoles, BrandElevationTokens, BrandModePalette, BrandPackage, BrandPackageInput, BrandSemanticColors, ButtonDefaultStyle, CompileResult, Density, ElevationStyle, type EmitBrandCssMode, type EmitBrandCssOptions, type InferredRecipeHints, type ValidationResult, colorToHslChannels, compileReferoTokens, elevationPresetToTokens, emitBrandCss, emitDarkModeSelector, emitGlobalSkinSelector, emitLightModeSelector, hexToHslChannels, inferRecipeFromDesignMd, isDualModeBrand, normalizeBrandPackage, normalizeModePalette, rolesFromSemantic, semanticFromRoles, tryColorToHsl, tryHexToHsl, validateBrandPackage };