@nebutra/tokens 0.1.2 → 0.1.3
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/brands/gsap/brand.json +17 -64
- package/brands/linear/brand.json +18 -57
- package/brands/notion/brand.json +18 -62
- package/brands/raycast/brand.json +17 -64
- package/brands/stripe/brand.json +16 -72
- package/brands/vanta/brand.json +16 -63
- package/brands/vercel/brand.json +16 -50
- package/dist/brand-package/index.d.ts +123 -0
- package/dist/brand-package/index.js +61 -0
- package/dist/brand-package/index.js.map +1 -0
- package/dist/brand-package/use-brand.d.ts +2 -0
- package/dist/brand-package/use-brand.js +12 -0
- package/dist/brand-package/use-brand.js.map +1 -0
- package/dist/chunk-ALJTP5HL.js +881 -0
- package/dist/chunk-ALJTP5HL.js.map +1 -0
- package/dist/chunk-RGUJQOLH.js +1582 -0
- package/dist/chunk-RGUJQOLH.js.map +1 -0
- package/dist/index.d.ts +81 -0
- package/dist/index.js +187 -0
- package/dist/index.js.map +1 -0
- package/dist/use-brand-C8d4DPqE.d.ts +371 -0
- package/package.json +34 -9
- package/recipe.css +322 -1
- package/skins/README.md +2 -4
- package/skins/gsap.css +31 -119
- package/skins/linear.css +33 -117
- package/skins/notion.css +27 -117
- package/skins/raycast.css +32 -119
- package/skins/stripe.css +27 -129
- package/skins/vanta.css +27 -122
- package/skins/vercel.css +30 -111
- package/styles.css +388 -113
- package/.turbo/turbo-build.log +0 -8
- package/.turbo/turbo-typecheck.log +0 -4
- package/AGENTS.md +0 -45
- package/DESIGN.md +0 -357
- package/scripts/compile-brand-run.ts +0 -79
- package/scripts/compile-brand.mjs +0 -25
- package/scripts/emit-skins-run.ts +0 -62
- package/scripts/emit-skins.mjs +0 -31
- package/scripts/sync-styles.mjs +0 -29
- package/src/brand-package/__tests__/compile-refero.test.ts +0 -427
- package/src/brand-package/__tests__/emit-css.test.ts +0 -130
- package/src/brand-package/apply-brand.ts +0 -92
- package/src/brand-package/compile-helpers.ts +0 -170
- package/src/brand-package/compile-refero.ts +0 -69
- package/src/brand-package/emit-css.ts +0 -468
- package/src/brand-package/hex-to-hsl.ts +0 -100
- package/src/brand-package/index.ts +0 -71
- package/src/brand-package/infer-recipe.ts +0 -198
- package/src/brand-package/normalize.ts +0 -295
- package/src/brand-package/presets/context.ts +0 -17
- package/src/brand-package/presets/generic.ts +0 -214
- package/src/brand-package/presets/gsap.ts +0 -146
- package/src/brand-package/presets/index.ts +0 -31
- package/src/brand-package/presets/linear.ts +0 -183
- package/src/brand-package/presets/notion.ts +0 -208
- package/src/brand-package/presets/raycast.ts +0 -138
- package/src/brand-package/presets/recipe.ts +0 -61
- package/src/brand-package/presets/stripe.ts +0 -207
- package/src/brand-package/presets/vanta.ts +0 -220
- package/src/brand-package/presets/vercel.ts +0 -187
- package/src/brand-package/types.ts +0 -285
- package/src/brand-package/use-brand.ts +0 -207
- package/src/brand-package/validate.ts +0 -108
- package/src/index.ts +0 -67
- package/src/theme-provider.tsx +0 -246
- package/tsconfig.json +0 -11
- package/turbo.json +0 -15
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { C as CompileResult, d as BrandPackage, m as ButtonDefaultStyle, E as ElevationStyle, D as Density, n as BrandPackageInput, o as BrandSemanticColors, a as BrandColorRoles, b as BrandElevationTokens, p as BrandModePalette } from '../use-brand-C8d4DPqE.js';
|
|
2
|
+
export { A as ApplyBrandOptions, B as BRAND_STORAGE_KEY, q as BRAND_STYLE_ELEMENT_ID, s as BadgeDefaultStyle, t as BrandExtensions, c as BrandFontFace, v as BrandFontSource, w as BrandIframePreviewOptions, x as BrandModes, e as BrandRadii, f as BrandRecipe, y as BrandRecipeInput, z as BrandTypography, F as CssColor, H as HslChannels, U as UseBrandIframePreviewResult, G as UseBrandOptions, I as UseBrandResult, g as applyBrandCss, h as applyBrandPackage, i as applyBrandToIframe, j as clearBrand, k as getActiveBrandId, r as restorePersistedBrand, u as useBrand, l as useBrandIframePreview } from '../use-brand-C8d4DPqE.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 };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
compileReferoTokens,
|
|
3
|
+
inferRecipeFromDesignMd,
|
|
4
|
+
validateBrandPackage
|
|
5
|
+
} from "../chunk-RGUJQOLH.js";
|
|
6
|
+
import {
|
|
7
|
+
BRAND_STORAGE_KEY,
|
|
8
|
+
BRAND_STYLE_ELEMENT_ID,
|
|
9
|
+
applyBrandCss,
|
|
10
|
+
applyBrandPackage,
|
|
11
|
+
applyBrandToIframe,
|
|
12
|
+
clearBrand,
|
|
13
|
+
colorToHslChannels,
|
|
14
|
+
elevationPresetToTokens,
|
|
15
|
+
emitBrandCss,
|
|
16
|
+
emitDarkModeSelector,
|
|
17
|
+
emitGlobalSkinSelector,
|
|
18
|
+
emitLightModeSelector,
|
|
19
|
+
getActiveBrandId,
|
|
20
|
+
hexToHslChannels,
|
|
21
|
+
isDualModeBrand,
|
|
22
|
+
normalizeBrandPackage,
|
|
23
|
+
normalizeModePalette,
|
|
24
|
+
restorePersistedBrand,
|
|
25
|
+
rolesFromSemantic,
|
|
26
|
+
semanticFromRoles,
|
|
27
|
+
tryColorToHsl,
|
|
28
|
+
tryHexToHsl,
|
|
29
|
+
useBrand,
|
|
30
|
+
useBrandIframePreview
|
|
31
|
+
} from "../chunk-ALJTP5HL.js";
|
|
32
|
+
export {
|
|
33
|
+
BRAND_STORAGE_KEY,
|
|
34
|
+
BRAND_STYLE_ELEMENT_ID,
|
|
35
|
+
applyBrandCss,
|
|
36
|
+
applyBrandPackage,
|
|
37
|
+
applyBrandToIframe,
|
|
38
|
+
clearBrand,
|
|
39
|
+
colorToHslChannels,
|
|
40
|
+
compileReferoTokens,
|
|
41
|
+
elevationPresetToTokens,
|
|
42
|
+
emitBrandCss,
|
|
43
|
+
emitDarkModeSelector,
|
|
44
|
+
emitGlobalSkinSelector,
|
|
45
|
+
emitLightModeSelector,
|
|
46
|
+
getActiveBrandId,
|
|
47
|
+
hexToHslChannels,
|
|
48
|
+
inferRecipeFromDesignMd,
|
|
49
|
+
isDualModeBrand,
|
|
50
|
+
normalizeBrandPackage,
|
|
51
|
+
normalizeModePalette,
|
|
52
|
+
restorePersistedBrand,
|
|
53
|
+
rolesFromSemantic,
|
|
54
|
+
semanticFromRoles,
|
|
55
|
+
tryColorToHsl,
|
|
56
|
+
tryHexToHsl,
|
|
57
|
+
useBrand,
|
|
58
|
+
useBrandIframePreview,
|
|
59
|
+
validateBrandPackage
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|