@nebutra/theme 0.2.2 → 3.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.
- package/CHANGELOG.md +14 -0
- package/dist/brand-package-surface.d.ts +2 -1
- package/dist/brand-package-surface.js +5 -3
- package/dist/brand-package-surface.js.map +1 -1
- package/dist/{chunk-YJGDBU5Y.js → chunk-4CNXYWPJ.js} +45 -1
- package/dist/chunk-4CNXYWPJ.js.map +1 -0
- package/dist/{chunk-ZSOVG5W4.js → chunk-XDRU7ACJ.js} +4 -2
- package/dist/chunk-XDRU7ACJ.js.map +1 -0
- package/dist/client.d.ts +44 -2
- package/dist/client.js +2 -2
- package/dist/index.d.ts +6 -40
- package/dist/index.js +32 -2
- package/dist/index.js.map +1 -1
- package/dist/language-switcher.d.ts +62 -0
- package/dist/language-switcher.js +242 -0
- package/dist/language-switcher.js.map +1 -0
- package/dist/languages.d.ts +8 -0
- package/dist/languages.js +1 -1
- package/morph.css +99 -0
- package/package.json +20 -5
- package/skins.css +520 -144
- package/src/languages.json +44 -0
- package/styles/sources.css +16 -0
- package/dist/chunk-YJGDBU5Y.js.map +0 -1
- package/dist/chunk-ZSOVG5W4.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @nebutra/theme
|
|
2
2
|
|
|
3
|
+
## 3.0.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies []:
|
|
8
|
+
- @nebutra/tokens@3.0.0
|
|
9
|
+
|
|
10
|
+
## 2.0.0
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies []:
|
|
15
|
+
- @nebutra/tokens@2.0.0
|
|
16
|
+
|
|
3
17
|
## 0.2.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { BRAND_STORAGE_KEY, BrandPackage, BrandPackageInput, BrandRecipe, BrandRecipeInput, CompileResult, EmitBrandCssMode, EmitBrandCssOptions, ValidationResult, applyBrandCss, applyBrandPackage,
|
|
1
|
+
export { BRAND_STORAGE_KEY, BrandPackage, BrandPackageInput, BrandRecipe, BrandRecipeInput, CompileResult, EmitBrandCssMode, EmitBrandCssOptions, ValidationResult, applyBrandCss, applyBrandPackage, clearBrand, compileReferoTokens, emitBrandCss, emitGlobalSkinSelector, getActiveBrandId, normalizeBrandPackage, restorePersistedBrand, validateBrandPackage } from '@nebutra/tokens/brand-package';
|
|
2
|
+
export { applyBrandToIframe, useBrand, useBrandIframePreview } from '@nebutra/tokens/use-brand';
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import {
|
|
3
3
|
applyBrandCss,
|
|
4
4
|
applyBrandPackage,
|
|
5
|
-
applyBrandToIframe,
|
|
6
5
|
BRAND_STORAGE_KEY,
|
|
7
6
|
clearBrand,
|
|
8
7
|
compileReferoTokens,
|
|
@@ -11,10 +10,13 @@ import {
|
|
|
11
10
|
getActiveBrandId,
|
|
12
11
|
normalizeBrandPackage,
|
|
13
12
|
restorePersistedBrand,
|
|
14
|
-
useBrand,
|
|
15
|
-
useBrandIframePreview,
|
|
16
13
|
validateBrandPackage
|
|
17
14
|
} from "@nebutra/tokens/brand-package";
|
|
15
|
+
import {
|
|
16
|
+
applyBrandToIframe,
|
|
17
|
+
useBrand,
|
|
18
|
+
useBrandIframePreview
|
|
19
|
+
} from "@nebutra/tokens/use-brand";
|
|
18
20
|
export {
|
|
19
21
|
BRAND_STORAGE_KEY,
|
|
20
22
|
applyBrandCss,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/brand-package-surface.ts"],"sourcesContent":["/**\n * Tooling / Create Center surface — compile + iframe preview + emit.\n * Prefer `@nebutra/tokens/brand-package` in new code; this re-export keeps\n * historical `@nebutra/theme` compile entry points without bloating the root.\n */\n\nexport {\n applyBrandCss,\n applyBrandPackage,\n
|
|
1
|
+
{"version":3,"sources":["../src/brand-package-surface.ts"],"sourcesContent":["/**\n * Tooling / Create Center surface — compile + iframe preview + emit.\n * Prefer `@nebutra/tokens/brand-package` in new code; this re-export keeps\n * historical `@nebutra/theme` compile entry points without bloating the root.\n */\n\nexport {\n applyBrandCss,\n applyBrandPackage,\n BRAND_STORAGE_KEY,\n type BrandPackage,\n type BrandPackageInput,\n type BrandRecipe,\n type BrandRecipeInput,\n type CompileResult,\n clearBrand,\n compileReferoTokens,\n type EmitBrandCssMode,\n type EmitBrandCssOptions,\n emitBrandCss,\n emitGlobalSkinSelector,\n getActiveBrandId,\n normalizeBrandPackage,\n restorePersistedBrand,\n type ValidationResult,\n validateBrandPackage,\n} from \"@nebutra/tokens/brand-package\";\n\nexport {\n applyBrandToIframe,\n useBrand,\n useBrandIframePreview,\n} from \"@nebutra/tokens/use-brand\";\n"],"mappings":";AAMA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EAMA;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":[]}
|
|
@@ -10,6 +10,8 @@ var languages_default = {
|
|
|
10
10
|
name: "Nebutra Factory",
|
|
11
11
|
kind: "design-language",
|
|
12
12
|
description: "Default product chrome from @nebutra/tokens (no skin). Clear data-brand to restore.",
|
|
13
|
+
tagline: "the token source, unskinned",
|
|
14
|
+
shortName: "Factory",
|
|
13
15
|
proves: ["factory HSL SSOT", "recipe defaults", "action\u2261brand-mark until skin"],
|
|
14
16
|
darkDefault: true,
|
|
15
17
|
brandPath: null,
|
|
@@ -25,11 +27,41 @@ var languages_default = {
|
|
|
25
27
|
dataBrand: true
|
|
26
28
|
}
|
|
27
29
|
},
|
|
30
|
+
{
|
|
31
|
+
id: "cosmos",
|
|
32
|
+
name: "Cosmos",
|
|
33
|
+
kind: "design-language",
|
|
34
|
+
description: "Linen gallery canvas with a monochrome chrome: the filled Ink button and the brand mark are the same colour, there is no accent role at all. One 16px radius everywhere, zero elevation, serif display at weight 350.",
|
|
35
|
+
tagline: "images sit; chrome recedes",
|
|
36
|
+
shortName: "Cosmos",
|
|
37
|
+
proves: [
|
|
38
|
+
"monochrome chrome (action \u2261 brand-mark, no accent role)",
|
|
39
|
+
"single-radius system (16px everywhere; 9999px only for the floating nav)",
|
|
40
|
+
"elevation=none by contract (flat surfaces, contrast-only depth)",
|
|
41
|
+
"serif display below weight 400 (headingWeight 350)",
|
|
42
|
+
"light-first dual mode (dark inverts the gallery)"
|
|
43
|
+
],
|
|
44
|
+
darkDefault: false,
|
|
45
|
+
brandPath: "brands/cosmos/brand.json",
|
|
46
|
+
skinPath: "skins/cosmos.css",
|
|
47
|
+
install: {
|
|
48
|
+
command: "nebutra theme use cosmos",
|
|
49
|
+
cssImport: "@nebutra/tokens/skins/cosmos.css"
|
|
50
|
+
},
|
|
51
|
+
compatibility: {
|
|
52
|
+
tailwind: "4",
|
|
53
|
+
cssVariables: true,
|
|
54
|
+
brandPackage: true,
|
|
55
|
+
dataBrand: true
|
|
56
|
+
}
|
|
57
|
+
},
|
|
28
58
|
{
|
|
29
59
|
id: "gsap",
|
|
30
60
|
name: "GSAP",
|
|
31
61
|
kind: "design-language",
|
|
32
62
|
description: "Dark cream-on-void; shockingly-green is accent \u2014 CTA is gradient-stroke/outline, not solid green fill.",
|
|
63
|
+
tagline: "saturated, fast easing",
|
|
64
|
+
shortName: "GSAP",
|
|
33
65
|
proves: [
|
|
34
66
|
"outline / gradient-stroke recipe",
|
|
35
67
|
"category extensions",
|
|
@@ -54,6 +86,8 @@ var languages_default = {
|
|
|
54
86
|
name: "Linear",
|
|
55
87
|
kind: "design-language",
|
|
56
88
|
description: "Dual-mode: dark void default + light paper; solid acid-lime CTA, compact density.",
|
|
89
|
+
tagline: "tight radii, low-contrast chrome",
|
|
90
|
+
shortName: "Linear",
|
|
57
91
|
proves: ["chromatic solid action", "dark product chrome", "dual-mode light/dark palettes"],
|
|
58
92
|
darkDefault: true,
|
|
59
93
|
brandPath: "brands/linear/brand.json",
|
|
@@ -74,6 +108,8 @@ var languages_default = {
|
|
|
74
108
|
name: "Notion",
|
|
75
109
|
kind: "design-language",
|
|
76
110
|
description: "Warm paper notebook; Notion Blue sole filled CTA \u2260 Ink brand-mark; 8px buttons / 12px cards; elev=none + hairline; accent hues decorative only.",
|
|
111
|
+
tagline: "paper surfaces, muted ink",
|
|
112
|
+
shortName: "Notion",
|
|
77
113
|
proves: [
|
|
78
114
|
"action \u2260 brand-mark (blue vs ink)",
|
|
79
115
|
"canvas\u2260card (paper-warmth vs pure-white)",
|
|
@@ -100,6 +136,8 @@ var languages_default = {
|
|
|
100
136
|
name: "Raycast",
|
|
101
137
|
kind: "design-language",
|
|
102
138
|
description: "Neutral Mist/Iron filled CTA; Coral is brand-mark only. Key elevation stack.",
|
|
139
|
+
tagline: "dark glass and a coloured halo",
|
|
140
|
+
shortName: "Raycast",
|
|
103
141
|
proves: ["action \u2260 brand-mark", "elevation=key free CSS"],
|
|
104
142
|
darkDefault: true,
|
|
105
143
|
brandPath: "brands/raycast/brand.json",
|
|
@@ -120,6 +158,8 @@ var languages_default = {
|
|
|
120
158
|
name: "Stripe",
|
|
121
159
|
kind: "design-language",
|
|
122
160
|
description: "Indigo-ink ledger on frost glass; Indigo action \u2260 Midnight brand-mark; 4px controls; elevation=none (tint + frost rules).",
|
|
161
|
+
tagline: "soft elevation, generous type",
|
|
162
|
+
shortName: "Stripe",
|
|
123
163
|
proves: [
|
|
124
164
|
"action \u2260 brand-mark (chromatic indigo vs midnight)",
|
|
125
165
|
"elevation=none tint-ladder depth",
|
|
@@ -145,6 +185,8 @@ var languages_default = {
|
|
|
145
185
|
name: "Vanta",
|
|
146
186
|
kind: "design-language",
|
|
147
187
|
description: "Editorial violet on parchment; Vivid Violet action \u2260 Indigo Ink brand-mark; full pills; elevation=none (carbon hairlines).",
|
|
188
|
+
tagline: "high-trust enterprise blues",
|
|
189
|
+
shortName: "Vanta",
|
|
148
190
|
proves: [
|
|
149
191
|
"action \u2260 brand-mark (chromatic)",
|
|
150
192
|
"elevation=none border-only",
|
|
@@ -170,6 +212,8 @@ var languages_default = {
|
|
|
170
212
|
name: "Vercel",
|
|
171
213
|
kind: "design-language",
|
|
172
214
|
description: "Monochrome dual-mode: light paper + Obsidian CTA; dark carbon + white CTA; hairline elevation (no chromatic CTA).",
|
|
215
|
+
tagline: "monochrome, hard edges, lit top edge",
|
|
216
|
+
shortName: "Vercel",
|
|
173
217
|
proves: ["light monochrome action", "elevation=hairline", "dual-mode light/dark palettes"],
|
|
174
218
|
darkDefault: false,
|
|
175
219
|
brandPath: "brands/vercel/brand.json",
|
|
@@ -212,4 +256,4 @@ export {
|
|
|
212
256
|
getLanguageById,
|
|
213
257
|
listSkinLanguages
|
|
214
258
|
};
|
|
215
|
-
//# sourceMappingURL=chunk-
|
|
259
|
+
//# sourceMappingURL=chunk-4CNXYWPJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/languages.json","../src/languages.ts"],"sourcesContent":["{\n \"$schema\": \"https://nebutra.com/schemas/design-language-registry.json\",\n \"version\": \"2026.07\",\n \"defaultLanguage\": \"factory\",\n \"description\": \"Design-language catalog for global product chrome swap (Create Center / SaaS theme). Not color moods — full Brand Packages (roles + recipe + elev + zones).\",\n \"languages\": [\n {\n \"id\": \"factory\",\n \"name\": \"Nebutra Factory\",\n \"kind\": \"design-language\",\n \"description\": \"Default product chrome from @nebutra/tokens (no skin). Clear data-brand to restore.\",\n \"tagline\": \"the token source, unskinned\",\n \"shortName\": \"Factory\",\n \"proves\": [\"factory HSL SSOT\", \"recipe defaults\", \"action≡brand-mark until skin\"],\n \"darkDefault\": true,\n \"brandPath\": null,\n \"skinPath\": null,\n \"install\": {\n \"command\": \"nebutra theme use factory\",\n \"cssImport\": null\n },\n \"compatibility\": {\n \"tailwind\": \"4\",\n \"cssVariables\": true,\n \"brandPackage\": true,\n \"dataBrand\": true\n }\n },\n {\n \"id\": \"cosmos\",\n \"name\": \"Cosmos\",\n \"kind\": \"design-language\",\n \"description\": \"Linen gallery canvas with a monochrome chrome: the filled Ink button and the brand mark are the same colour, there is no accent role at all. One 16px radius everywhere, zero elevation, serif display at weight 350.\",\n \"tagline\": \"images sit; chrome recedes\",\n \"shortName\": \"Cosmos\",\n \"proves\": [\n \"monochrome chrome (action ≡ brand-mark, no accent role)\",\n \"single-radius system (16px everywhere; 9999px only for the floating nav)\",\n \"elevation=none by contract (flat surfaces, contrast-only depth)\",\n \"serif display below weight 400 (headingWeight 350)\",\n \"light-first dual mode (dark inverts the gallery)\"\n ],\n \"darkDefault\": false,\n \"brandPath\": \"brands/cosmos/brand.json\",\n \"skinPath\": \"skins/cosmos.css\",\n \"install\": {\n \"command\": \"nebutra theme use cosmos\",\n \"cssImport\": \"@nebutra/tokens/skins/cosmos.css\"\n },\n \"compatibility\": {\n \"tailwind\": \"4\",\n \"cssVariables\": true,\n \"brandPackage\": true,\n \"dataBrand\": true\n }\n },\n {\n \"id\": \"gsap\",\n \"name\": \"GSAP\",\n \"kind\": \"design-language\",\n \"description\": \"Dark cream-on-void; shockingly-green is accent — CTA is gradient-stroke/outline, not solid green fill.\",\n \"tagline\": \"saturated, fast easing\",\n \"shortName\": \"GSAP\",\n \"proves\": [\n \"outline / gradient-stroke recipe\",\n \"category extensions\",\n \"marketing display zone\"\n ],\n \"darkDefault\": true,\n \"brandPath\": \"brands/gsap/brand.json\",\n \"skinPath\": \"skins/gsap.css\",\n \"install\": {\n \"command\": \"nebutra theme use gsap\",\n \"cssImport\": \"@nebutra/tokens/skins/gsap.css\"\n },\n \"compatibility\": {\n \"tailwind\": \"4\",\n \"cssVariables\": true,\n \"brandPackage\": true,\n \"dataBrand\": true\n }\n },\n {\n \"id\": \"linear\",\n \"name\": \"Linear\",\n \"kind\": \"design-language\",\n \"description\": \"Dual-mode: dark void default + light paper; solid acid-lime CTA, compact density.\",\n \"tagline\": \"tight radii, low-contrast chrome\",\n \"shortName\": \"Linear\",\n \"proves\": [\"chromatic solid action\", \"dark product chrome\", \"dual-mode light/dark palettes\"],\n \"darkDefault\": true,\n \"brandPath\": \"brands/linear/brand.json\",\n \"skinPath\": \"skins/linear.css\",\n \"install\": {\n \"command\": \"nebutra theme use linear\",\n \"cssImport\": \"@nebutra/tokens/skins/linear.css\"\n },\n \"compatibility\": {\n \"tailwind\": \"4\",\n \"cssVariables\": true,\n \"brandPackage\": true,\n \"dataBrand\": true\n }\n },\n {\n \"id\": \"notion\",\n \"name\": \"Notion\",\n \"kind\": \"design-language\",\n \"description\": \"Warm paper notebook; Notion Blue sole filled CTA ≠ Ink brand-mark; 8px buttons / 12px cards; elev=none + hairline; accent hues decorative only.\",\n \"tagline\": \"paper surfaces, muted ink\",\n \"shortName\": \"Notion\",\n \"proves\": [\n \"action ≠ brand-mark (blue vs ink)\",\n \"canvas≠card (paper-warmth vs pure-white)\",\n \"elevation=none content cards + raised nav shadow slot\",\n \"table radius priority (8/12 over tertiary 4px)\",\n \"decorative accents never product CTA\"\n ],\n \"darkDefault\": false,\n \"brandPath\": \"brands/notion/brand.json\",\n \"skinPath\": \"skins/notion.css\",\n \"install\": {\n \"command\": \"nebutra theme use notion\",\n \"cssImport\": \"@nebutra/tokens/skins/notion.css\"\n },\n \"compatibility\": {\n \"tailwind\": \"4\",\n \"cssVariables\": true,\n \"brandPackage\": true,\n \"dataBrand\": true\n }\n },\n {\n \"id\": \"raycast\",\n \"name\": \"Raycast\",\n \"kind\": \"design-language\",\n \"description\": \"Neutral Mist/Iron filled CTA; Coral is brand-mark only. Key elevation stack.\",\n \"tagline\": \"dark glass and a coloured halo\",\n \"shortName\": \"Raycast\",\n \"proves\": [\"action ≠ brand-mark\", \"elevation=key free CSS\"],\n \"darkDefault\": true,\n \"brandPath\": \"brands/raycast/brand.json\",\n \"skinPath\": \"skins/raycast.css\",\n \"install\": {\n \"command\": \"nebutra theme use raycast\",\n \"cssImport\": \"@nebutra/tokens/skins/raycast.css\"\n },\n \"compatibility\": {\n \"tailwind\": \"4\",\n \"cssVariables\": true,\n \"brandPackage\": true,\n \"dataBrand\": true\n }\n },\n {\n \"id\": \"stripe\",\n \"name\": \"Stripe\",\n \"kind\": \"design-language\",\n \"description\": \"Indigo-ink ledger on frost glass; Indigo action ≠ Midnight brand-mark; 4px controls; elevation=none (tint + frost rules).\",\n \"tagline\": \"soft elevation, generous type\",\n \"shortName\": \"Stripe\",\n \"proves\": [\n \"action ≠ brand-mark (chromatic indigo vs midnight)\",\n \"elevation=none tint-ladder depth\",\n \"4px squared controls (not pill)\",\n \"whisper heading weight 300\"\n ],\n \"darkDefault\": false,\n \"brandPath\": \"brands/stripe/brand.json\",\n \"skinPath\": \"skins/stripe.css\",\n \"install\": {\n \"command\": \"nebutra theme use stripe\",\n \"cssImport\": \"@nebutra/tokens/skins/stripe.css\"\n },\n \"compatibility\": {\n \"tailwind\": \"4\",\n \"cssVariables\": true,\n \"brandPackage\": true,\n \"dataBrand\": true\n }\n },\n {\n \"id\": \"vanta\",\n \"name\": \"Vanta\",\n \"kind\": \"design-language\",\n \"description\": \"Editorial violet on parchment; Vivid Violet action ≠ Indigo Ink brand-mark; full pills; elevation=none (carbon hairlines).\",\n \"tagline\": \"high-trust enterprise blues\",\n \"shortName\": \"Vanta\",\n \"proves\": [\n \"action ≠ brand-mark (chromatic)\",\n \"elevation=none border-only\",\n \"999px pill controls\",\n \"serif display + sans UI zones\"\n ],\n \"darkDefault\": false,\n \"brandPath\": \"brands/vanta/brand.json\",\n \"skinPath\": \"skins/vanta.css\",\n \"install\": {\n \"command\": \"nebutra theme use vanta\",\n \"cssImport\": \"@nebutra/tokens/skins/vanta.css\"\n },\n \"compatibility\": {\n \"tailwind\": \"4\",\n \"cssVariables\": true,\n \"brandPackage\": true,\n \"dataBrand\": true\n }\n },\n {\n \"id\": \"vercel\",\n \"name\": \"Vercel\",\n \"kind\": \"design-language\",\n \"description\": \"Monochrome dual-mode: light paper + Obsidian CTA; dark carbon + white CTA; hairline elevation (no chromatic CTA).\",\n \"tagline\": \"monochrome, hard edges, lit top edge\",\n \"shortName\": \"Vercel\",\n \"proves\": [\"light monochrome action\", \"elevation=hairline\", \"dual-mode light/dark palettes\"],\n \"darkDefault\": false,\n \"brandPath\": \"brands/vercel/brand.json\",\n \"skinPath\": \"skins/vercel.css\",\n \"install\": {\n \"command\": \"nebutra theme use vercel\",\n \"cssImport\": \"@nebutra/tokens/skins/vercel.css\"\n },\n \"compatibility\": {\n \"tailwind\": \"4\",\n \"cssVariables\": true,\n \"brandPackage\": true,\n \"dataBrand\": true\n }\n }\n ]\n}\n","/**\n * Design-language catalog — the real product surface of @nebutra/theme.\n *\n * A \"language\" is a full Brand Package (roles + recipe + elev), proven by\n * external DS stress tests (Linear / GSAP / Raycast / Vercel / Vanta / Stripe / Notion).\n * Swapping `html[data-brand]` (or applyLanguage) recolors product chrome without\n * call-site edits.\n *\n * Multi-mood oklch catalog was removed. Use LANGUAGE_REGISTRY / isLanguageId only.\n */\n\n/** Generated by scripts/sync-languages.mjs from brands + languages.meta.json */\nimport languagesJson from \"./languages.json\" with { type: \"json\" };\n\nexport interface DesignLanguageInstall {\n command: string;\n /** Single-skin import for demos; null for factory */\n cssImport: string | null;\n}\n\nexport interface DesignLanguageCompatibility {\n tailwind: \"4\";\n cssVariables: boolean;\n brandPackage: boolean;\n dataBrand: boolean;\n}\n\nexport interface DesignLanguageEntry {\n id: string;\n name: string;\n kind: \"design-language\";\n description: string;\n /**\n * One line naming what this language does, for a picker's caption. Short on\n * purpose — `description` is the catalog entry, this is the label under eight\n * buttons. Null for a language whose meta has not written one.\n */\n tagline: string | null;\n /** Button-width label. Falls back to `name` for the languages that fit. */\n shortName: string;\n /** Contract proofs this fixture exercises */\n proves: string[];\n darkDefault: boolean;\n /** Relative to @nebutra/tokens package root; null = factory (no override) */\n brandPath: string | null;\n skinPath: string | null;\n install: DesignLanguageInstall;\n compatibility: DesignLanguageCompatibility;\n}\n\nexport interface DesignLanguageRegistry {\n $schema: string;\n version: string;\n defaultLanguage: string;\n description: string;\n languages: DesignLanguageEntry[];\n}\n\nexport const LANGUAGE_REGISTRY = languagesJson as DesignLanguageRegistry;\nexport const LANGUAGE_IDS = LANGUAGE_REGISTRY.languages.map((l) => l.id);\nexport const DEFAULT_LANGUAGE = LANGUAGE_REGISTRY.defaultLanguage;\n/** Alias — “theme” in product speak = design language */\nexport const BUILT_IN_LANGUAGE_IDS = LANGUAGE_IDS;\n\nexport type LanguageId = string;\n\nexport function isLanguageId(id: string): boolean {\n return LANGUAGE_IDS.includes(id);\n}\n\nexport function getLanguageById(id: string): DesignLanguageEntry | undefined {\n return LANGUAGE_REGISTRY.languages.find((l) => l.id === id);\n}\n\n/** Fixture languages that ship a Brand Package (excludes factory). */\nexport function listSkinLanguages(): DesignLanguageEntry[] {\n return LANGUAGE_REGISTRY.languages.filter((l) => l.brandPath != null);\n}\n"],"mappings":";AAAA;AAAA,EACE,SAAW;AAAA,EACX,SAAW;AAAA,EACX,iBAAmB;AAAA,EACnB,aAAe;AAAA,EACf,WAAa;AAAA,IACX;AAAA,MACE,IAAM;AAAA,MACN,MAAQ;AAAA,MACR,MAAQ;AAAA,MACR,aAAe;AAAA,MACf,SAAW;AAAA,MACX,WAAa;AAAA,MACb,QAAU,CAAC,oBAAoB,mBAAmB,mCAA8B;AAAA,MAChF,aAAe;AAAA,MACf,WAAa;AAAA,MACb,UAAY;AAAA,MACZ,SAAW;AAAA,QACT,SAAW;AAAA,QACX,WAAa;AAAA,MACf;AAAA,MACA,eAAiB;AAAA,QACf,UAAY;AAAA,QACZ,cAAgB;AAAA,QAChB,cAAgB;AAAA,QAChB,WAAa;AAAA,MACf;AAAA,IACF;AAAA,IACA;AAAA,MACE,IAAM;AAAA,MACN,MAAQ;AAAA,MACR,MAAQ;AAAA,MACR,aAAe;AAAA,MACf,SAAW;AAAA,MACX,WAAa;AAAA,MACb,QAA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;AAAA,QACA;AAAA,MACF;AAAA,MACA,aAAe;AAAA,MACf,WAAa;AAAA,MACb,UAAY;AAAA,MACZ,SAAW;AAAA,QACT,SAAW;AAAA,QACX,WAAa;AAAA,MACf;AAAA,MACA,eAAiB;AAAA,QACf,UAAY;AAAA,QACZ,cAAgB;AAAA,QAChB,cAAgB;AAAA,QAChB,WAAa;AAAA,MACf;AAAA,IACF;AAAA,IACA;AAAA,MACE,IAAM;AAAA,MACN,MAAQ;AAAA,MACR,MAAQ;AAAA,MACR,aAAe;AAAA,MACf,SAAW;AAAA,MACX,WAAa;AAAA,MACb,QAAU,CAAC,2BAA2B,sBAAsB,+BAA+B;AAAA,MAC3F,aAAe;AAAA,MACf,WAAa;AAAA,MACb,UAAY;AAAA,MACZ,SAAW;AAAA,QACT,SAAW;AAAA,QACX,WAAa;AAAA,MACf;AAAA,MACA,eAAiB;AAAA,QACf,UAAY;AAAA,QACZ,cAAgB;AAAA,QAChB,cAAgB;AAAA,QAChB,WAAa;AAAA,MACf;AAAA,IACF;AAAA,EACF;AACF;;;AC7KO,IAAM,oBAAoB;AAC1B,IAAM,eAAe,kBAAkB,UAAU,IAAI,CAAC,MAAM,EAAE,EAAE;AAChE,IAAM,mBAAmB,kBAAkB;AAE3C,IAAM,wBAAwB;AAI9B,SAAS,aAAa,IAAqB;AAChD,SAAO,aAAa,SAAS,EAAE;AACjC;AAEO,SAAS,gBAAgB,IAA6C;AAC3E,SAAO,kBAAkB,UAAU,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE;AAC5D;AAGO,SAAS,oBAA2C;AACzD,SAAO,kBAAkB,UAAU,OAAO,CAAC,MAAM,EAAE,aAAa,IAAI;AACtE;","names":[]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getLanguageById
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4CNXYWPJ.js";
|
|
4
4
|
|
|
5
5
|
// src/built-in-packages.generated.ts
|
|
6
6
|
import { normalizeBrandPackage } from "@nebutra/tokens/brand-package";
|
|
7
|
+
import cosmos from "@nebutra/tokens/brands/cosmos/brand.json";
|
|
7
8
|
import gsap from "@nebutra/tokens/brands/gsap/brand.json";
|
|
8
9
|
import linear from "@nebutra/tokens/brands/linear/brand.json";
|
|
9
10
|
import notion from "@nebutra/tokens/brands/notion/brand.json";
|
|
@@ -12,6 +13,7 @@ import stripe from "@nebutra/tokens/brands/stripe/brand.json";
|
|
|
12
13
|
import vanta from "@nebutra/tokens/brands/vanta/brand.json";
|
|
13
14
|
import vercel from "@nebutra/tokens/brands/vercel/brand.json";
|
|
14
15
|
var RAW_BUILT_IN = {
|
|
16
|
+
cosmos,
|
|
15
17
|
gsap,
|
|
16
18
|
linear,
|
|
17
19
|
notion,
|
|
@@ -86,4 +88,4 @@ export {
|
|
|
86
88
|
clearLanguage,
|
|
87
89
|
getActiveLanguageId
|
|
88
90
|
};
|
|
89
|
-
//# sourceMappingURL=chunk-
|
|
91
|
+
//# sourceMappingURL=chunk-XDRU7ACJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/built-in-packages.generated.ts","../src/apply-language.ts"],"sourcesContent":["/**\n * AUTO-GENERATED by scripts/sync-languages.mjs — DO NOT EDIT.\n * Built-in Brand Packages for applyLanguage(id) without manual JSON import.\n * Source: packages/design/tokens/brands/<id>/brand.json\n */\n\nimport { type BrandPackage, normalizeBrandPackage } from \"@nebutra/tokens/brand-package\";\nimport cosmos from \"@nebutra/tokens/brands/cosmos/brand.json\" with { type: \"json\" };\nimport gsap from \"@nebutra/tokens/brands/gsap/brand.json\" with { type: \"json\" };\nimport linear from \"@nebutra/tokens/brands/linear/brand.json\" with { type: \"json\" };\nimport notion from \"@nebutra/tokens/brands/notion/brand.json\" with { type: \"json\" };\nimport raycast from \"@nebutra/tokens/brands/raycast/brand.json\" with { type: \"json\" };\nimport stripe from \"@nebutra/tokens/brands/stripe/brand.json\" with { type: \"json\" };\nimport vanta from \"@nebutra/tokens/brands/vanta/brand.json\" with { type: \"json\" };\nimport vercel from \"@nebutra/tokens/brands/vercel/brand.json\" with { type: \"json\" };\n\nconst RAW_BUILT_IN: Record<string, BrandPackage> = {\n cosmos: cosmos as BrandPackage,\n gsap: gsap as BrandPackage,\n linear: linear as BrandPackage,\n notion: notion as BrandPackage,\n raycast: raycast as BrandPackage,\n stripe: stripe as BrandPackage,\n vanta: vanta as BrandPackage,\n vercel: vercel as BrandPackage,\n};\n\n/** Normalized package for a shipped design-language id, or undefined. */\nexport function getBuiltInBrandPackage(id: string): BrandPackage | undefined {\n const raw = RAW_BUILT_IN[id];\n if (!raw) return undefined;\n return normalizeBrandPackage({ ...raw, id });\n}\n\nexport function listBuiltInBrandIds(): string[] {\n return Object.keys(RAW_BUILT_IN);\n}\n\nexport function hasBuiltInBrandPackage(id: string): boolean {\n return id in RAW_BUILT_IN;\n}\n","/**\n * Runtime design-language switch — Create Center / SaaS global theme swap.\n *\n * Light/dark remains class=\"dark\" on @nebutra/tokens ThemeProvider.\n * Design language is html[data-brand] + Brand Package CSS inject.\n *\n * Built-in languages load Brand Packages automatically; pass `package` only for\n * custom / compile-time packages (Create Center preview).\n */\n\nimport {\n type ApplyBrandOptions,\n applyBrandPackage,\n type BrandPackage,\n clearBrand,\n getActiveBrandId,\n normalizeBrandPackage,\n validateBrandPackage,\n} from \"@nebutra/tokens/brand-package\";\nimport { getBuiltInBrandPackage } from \"./built-in-packages\";\nimport { type DesignLanguageEntry, getLanguageById } from \"./languages\";\n\nexport type { ApplyBrandOptions };\n\nexport interface ApplyLanguageOptions extends ApplyBrandOptions {\n /**\n * Preloaded Brand Package (Create Center compile result or override).\n * When omitted, built-in languages resolve from brands/<id>/brand.json.\n */\n package?: BrandPackage;\n}\n\n/**\n * Apply a design language by id.\n * - `factory` / unknown without package → clearBrand (tokens SSOT)\n * - built-in id without package → load shipped Brand Package\n * - with `package` → applyBrandPackage (full carrier swap)\n */\nexport function applyLanguage(\n languageId: string,\n options: ApplyLanguageOptions = {},\n): DesignLanguageEntry | null {\n const entry = getLanguageById(languageId);\n\n if (!entry || entry.id === \"factory\" || entry.brandPath == null) {\n if (options.package) {\n const v = validateBrandPackage(options.package);\n if (!v.ok) {\n throw new Error(`Invalid Brand Package: ${v.errors.join(\"; \")}`);\n }\n applyBrandPackage(normalizeBrandPackage(options.package), options);\n return entry ?? null;\n }\n clearBrand(options);\n return entry ?? getLanguageById(\"factory\") ?? null;\n }\n\n const pkg = options.package ?? getBuiltInBrandPackage(languageId);\n if (!pkg) {\n throw new Error(\n `Language \"${languageId}\" has no built-in Brand Package and no options.package. ` +\n `Load @nebutra/tokens/${entry.brandPath} or compileReferoTokens(), then ` +\n `applyLanguage(\"${languageId}\", { package }). ` +\n `Or import the single skin CSS: ${entry.install.cssImport ?? \"(none)\"}.`,\n );\n }\n\n const v = validateBrandPackage(pkg);\n if (!v.ok) {\n throw new Error(`Invalid Brand Package for ${languageId}: ${v.errors.join(\"; \")}`);\n }\n const normalized = normalizeBrandPackage({\n ...pkg,\n id: languageId,\n });\n applyBrandPackage(normalized, options);\n return entry;\n}\n\n/** Restore factory product chrome (clear data-brand + injected skin). */\nexport function clearLanguage(options: ApplyBrandOptions = {}): void {\n clearBrand(options);\n}\n\nexport function getActiveLanguageId(doc?: Document): string {\n return getActiveBrandId(doc) ?? \"factory\";\n}\n"],"mappings":";;;;;AAMA,SAA4B,6BAA6B;AACzD,OAAO,YAAY;AACnB,OAAO,UAAU;AACjB,OAAO,YAAY;AACnB,OAAO,YAAY;AACnB,OAAO,aAAa;AACpB,OAAO,YAAY;AACnB,OAAO,WAAW;AAClB,OAAO,YAAY;AAEnB,IAAM,eAA6C;AAAA,EACjD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGO,SAAS,uBAAuB,IAAsC;AAC3E,QAAM,MAAM,aAAa,EAAE;AAC3B,MAAI,CAAC,IAAK,QAAO;AACjB,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;AACpB;AAEO,SAAS,oBAAoB,KAAwB;AAC1D,SAAO,iBAAiB,GAAG,KAAK;AAClC;","names":["normalizeBrandPackage","v","normalizeBrandPackage"]}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
1
|
+
import { ApplyBrandOptions, BrandPackage } from '@nebutra/tokens/brand-package';
|
|
1
2
|
export { BrandPackage, applyBrandPackage, clearBrand, normalizeBrandPackage } from '@nebutra/tokens/brand-package';
|
|
2
|
-
|
|
3
|
-
export { BUILT_IN_LANGUAGE_IDS, DEFAULT_LANGUAGE,
|
|
3
|
+
import { DesignLanguageEntry } from './languages.js';
|
|
4
|
+
export { BUILT_IN_LANGUAGE_IDS, DEFAULT_LANGUAGE, DesignLanguageRegistry, LANGUAGE_IDS, LANGUAGE_REGISTRY, getLanguageById, isLanguageId, listSkinLanguages } from './languages.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Runtime design-language switch — Create Center / SaaS global theme swap.
|
|
8
|
+
*
|
|
9
|
+
* Light/dark remains class="dark" on @nebutra/tokens ThemeProvider.
|
|
10
|
+
* Design language is html[data-brand] + Brand Package CSS inject.
|
|
11
|
+
*
|
|
12
|
+
* Built-in languages load Brand Packages automatically; pass `package` only for
|
|
13
|
+
* custom / compile-time packages (Create Center preview).
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
interface ApplyLanguageOptions extends ApplyBrandOptions {
|
|
17
|
+
/**
|
|
18
|
+
* Preloaded Brand Package (Create Center compile result or override).
|
|
19
|
+
* When omitted, built-in languages resolve from brands/<id>/brand.json.
|
|
20
|
+
*/
|
|
21
|
+
package?: BrandPackage;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Apply a design language by id.
|
|
25
|
+
* - `factory` / unknown without package → clearBrand (tokens SSOT)
|
|
26
|
+
* - built-in id without package → load shipped Brand Package
|
|
27
|
+
* - with `package` → applyBrandPackage (full carrier swap)
|
|
28
|
+
*/
|
|
29
|
+
declare function applyLanguage(languageId: string, options?: ApplyLanguageOptions): DesignLanguageEntry | null;
|
|
30
|
+
/** Restore factory product chrome (clear data-brand + injected skin). */
|
|
31
|
+
declare function clearLanguage(options?: ApplyBrandOptions): void;
|
|
32
|
+
declare function getActiveLanguageId(doc?: Document): string;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* AUTO-GENERATED by scripts/sync-languages.mjs — DO NOT EDIT.
|
|
36
|
+
* Built-in Brand Packages for applyLanguage(id) without manual JSON import.
|
|
37
|
+
* Source: packages/design/tokens/brands/<id>/brand.json
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/** Normalized package for a shipped design-language id, or undefined. */
|
|
41
|
+
declare function getBuiltInBrandPackage(id: string): BrandPackage | undefined;
|
|
42
|
+
declare function listBuiltInBrandIds(): string[];
|
|
43
|
+
declare function hasBuiltInBrandPackage(id: string): boolean;
|
|
44
|
+
|
|
45
|
+
export { type ApplyLanguageOptions, DesignLanguageEntry, applyLanguage, clearLanguage, getActiveLanguageId, getBuiltInBrandPackage, hasBuiltInBrandPackage, listBuiltInBrandIds };
|
package/dist/client.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
getBuiltInBrandPackage,
|
|
6
6
|
hasBuiltInBrandPackage,
|
|
7
7
|
listBuiltInBrandIds
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-XDRU7ACJ.js";
|
|
9
9
|
import {
|
|
10
10
|
BUILT_IN_LANGUAGE_IDS,
|
|
11
11
|
DEFAULT_LANGUAGE,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
getLanguageById,
|
|
15
15
|
isLanguageId,
|
|
16
16
|
listSkinLanguages
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-4CNXYWPJ.js";
|
|
18
18
|
|
|
19
19
|
// src/client.ts
|
|
20
20
|
import {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,45 +1,11 @@
|
|
|
1
|
-
import { ApplyBrandOptions, BrandPackage } from '@nebutra/tokens/brand-package';
|
|
2
1
|
export { ApplyBrandOptions, BrandPackage, ValidationResult, applyBrandPackage, clearBrand, getActiveBrandId, normalizeBrandPackage, validateBrandPackage } from '@nebutra/tokens/brand-package';
|
|
3
|
-
|
|
4
|
-
export { BUILT_IN_LANGUAGE_IDS, DEFAULT_LANGUAGE, DesignLanguageCompatibility, DesignLanguageInstall, DesignLanguageRegistry, LANGUAGE_IDS, LANGUAGE_REGISTRY, LanguageId, getLanguageById, isLanguageId, listSkinLanguages } from './languages.js';
|
|
2
|
+
export { ApplyLanguageOptions, applyLanguage, clearLanguage, getActiveLanguageId, getBuiltInBrandPackage, hasBuiltInBrandPackage, listBuiltInBrandIds } from './client.js';
|
|
3
|
+
export { BUILT_IN_LANGUAGE_IDS, DEFAULT_LANGUAGE, DesignLanguageCompatibility, DesignLanguageEntry, DesignLanguageInstall, DesignLanguageRegistry, LANGUAGE_IDS, LANGUAGE_REGISTRY, LanguageId, getLanguageById, isLanguageId, listSkinLanguages } from './languages.js';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* Light/dark remains class="dark" on @nebutra/tokens ThemeProvider.
|
|
10
|
-
* Design language is html[data-brand] + Brand Package CSS inject.
|
|
11
|
-
*
|
|
12
|
-
* Built-in languages load Brand Packages automatically; pass `package` only for
|
|
13
|
-
* custom / compile-time packages (Create Center preview).
|
|
6
|
+
* `null` until mounted, so a caller can hold the server markup for one paint
|
|
7
|
+
* rather than guess and flip. The channels only exist once CSS has applied.
|
|
14
8
|
*/
|
|
9
|
+
declare function useDarkSurface(): boolean | null;
|
|
15
10
|
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Preloaded Brand Package (Create Center compile result or override).
|
|
19
|
-
* When omitted, built-in languages resolve from brands/<id>/brand.json.
|
|
20
|
-
*/
|
|
21
|
-
package?: BrandPackage;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Apply a design language by id.
|
|
25
|
-
* - `factory` / unknown without package → clearBrand (tokens SSOT)
|
|
26
|
-
* - built-in id without package → load shipped Brand Package
|
|
27
|
-
* - with `package` → applyBrandPackage (full carrier swap)
|
|
28
|
-
*/
|
|
29
|
-
declare function applyLanguage(languageId: string, options?: ApplyLanguageOptions): DesignLanguageEntry | null;
|
|
30
|
-
/** Restore factory product chrome (clear data-brand + injected skin). */
|
|
31
|
-
declare function clearLanguage(options?: ApplyBrandOptions): void;
|
|
32
|
-
declare function getActiveLanguageId(doc?: Document): string;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* AUTO-GENERATED by scripts/sync-languages.mjs — DO NOT EDIT.
|
|
36
|
-
* Built-in Brand Packages for applyLanguage(id) without manual JSON import.
|
|
37
|
-
* Source: packages/design/tokens/brands/<id>/brand.json
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
/** Normalized package for a shipped design-language id, or undefined. */
|
|
41
|
-
declare function getBuiltInBrandPackage(id: string): BrandPackage | undefined;
|
|
42
|
-
declare function listBuiltInBrandIds(): string[];
|
|
43
|
-
declare function hasBuiltInBrandPackage(id: string): boolean;
|
|
44
|
-
|
|
45
|
-
export { type ApplyLanguageOptions, DesignLanguageEntry, applyLanguage, clearLanguage, getActiveLanguageId, getBuiltInBrandPackage, hasBuiltInBrandPackage, listBuiltInBrandIds };
|
|
11
|
+
export { useDarkSurface };
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
getBuiltInBrandPackage,
|
|
6
6
|
hasBuiltInBrandPackage,
|
|
7
7
|
listBuiltInBrandIds
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-XDRU7ACJ.js";
|
|
9
9
|
import {
|
|
10
10
|
BUILT_IN_LANGUAGE_IDS,
|
|
11
11
|
DEFAULT_LANGUAGE,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
getLanguageById,
|
|
15
15
|
isLanguageId,
|
|
16
16
|
listSkinLanguages
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-4CNXYWPJ.js";
|
|
18
18
|
|
|
19
19
|
// src/index.ts
|
|
20
20
|
import {
|
|
@@ -24,6 +24,35 @@ import {
|
|
|
24
24
|
normalizeBrandPackage,
|
|
25
25
|
validateBrandPackage
|
|
26
26
|
} from "@nebutra/tokens/brand-package";
|
|
27
|
+
|
|
28
|
+
// src/use-dark-surface.ts
|
|
29
|
+
import * as React from "react";
|
|
30
|
+
var DARK_THRESHOLD = 50;
|
|
31
|
+
function readCanvasLightness() {
|
|
32
|
+
if (typeof document === "undefined") return null;
|
|
33
|
+
const raw = getComputedStyle(document.documentElement).getPropertyValue("--background").trim();
|
|
34
|
+
const lightness = raw.split(/\s+/)[2];
|
|
35
|
+
if (!lightness) return null;
|
|
36
|
+
const parsed = Number.parseFloat(lightness);
|
|
37
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
38
|
+
}
|
|
39
|
+
function useDarkSurface() {
|
|
40
|
+
const [isDark, setIsDark] = React.useState(null);
|
|
41
|
+
React.useEffect(() => {
|
|
42
|
+
const sync = () => {
|
|
43
|
+
const lightness = readCanvasLightness();
|
|
44
|
+
setIsDark(lightness === null ? null : lightness < DARK_THRESHOLD);
|
|
45
|
+
};
|
|
46
|
+
sync();
|
|
47
|
+
const observer = new MutationObserver(sync);
|
|
48
|
+
observer.observe(document.documentElement, {
|
|
49
|
+
attributes: true,
|
|
50
|
+
attributeFilter: ["class", "data-brand", "data-theme", "style"]
|
|
51
|
+
});
|
|
52
|
+
return () => observer.disconnect();
|
|
53
|
+
}, []);
|
|
54
|
+
return isDark;
|
|
55
|
+
}
|
|
27
56
|
export {
|
|
28
57
|
BUILT_IN_LANGUAGE_IDS,
|
|
29
58
|
DEFAULT_LANGUAGE,
|
|
@@ -42,6 +71,7 @@ export {
|
|
|
42
71
|
listBuiltInBrandIds,
|
|
43
72
|
listSkinLanguages,
|
|
44
73
|
normalizeBrandPackage,
|
|
74
|
+
useDarkSurface,
|
|
45
75
|
validateBrandPackage
|
|
46
76
|
};
|
|
47
77
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @nebutra/theme — Design-language switch surface (client-safe root)\n *\n * Root exports are intentionally lean for app bundles:\n * applyLanguage / LANGUAGE_REGISTRY / built-in packages\n *\n * Light/dark ThemeProvider: import from `@nebutra/tokens` only (not here).\n *\n * Compile & Create Center tooling:\n * @nebutra/tokens/brand-package (preferred)\n * @nebutra/theme/brand-package (re-export alias)\n *\n * Layers:\n * @nebutra/tokens product chrome SSOT (styles.css + recipe.css + ThemeProvider)\n * @nebutra/theme LANGUAGE_REGISTRY + applyLanguage + skins.css\n */\n\n// Re-export apply helpers used with applyLanguage({ package })\nexport {\n type ApplyBrandOptions,\n applyBrandPackage,\n type BrandPackage,\n clearBrand,\n getActiveBrandId,\n normalizeBrandPackage,\n type ValidationResult,\n validateBrandPackage,\n} from \"@nebutra/tokens/brand-package\";\nexport {\n type ApplyLanguageOptions,\n applyLanguage,\n clearLanguage,\n getActiveLanguageId,\n} from \"./apply-language\";\nexport {\n getBuiltInBrandPackage,\n hasBuiltInBrandPackage,\n listBuiltInBrandIds,\n} from \"./built-in-packages\";\nexport {\n BUILT_IN_LANGUAGE_IDS,\n DEFAULT_LANGUAGE,\n type DesignLanguageCompatibility,\n type DesignLanguageEntry,\n type DesignLanguageInstall,\n type DesignLanguageRegistry,\n getLanguageById,\n isLanguageId,\n LANGUAGE_IDS,\n LANGUAGE_REGISTRY,\n type LanguageId,\n listSkinLanguages,\n} from \"./languages\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA;AAAA,EAEE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,OACK;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/use-dark-surface.ts"],"sourcesContent":["/**\n * @nebutra/theme — Design-language switch surface (client-safe root)\n *\n * Root exports are intentionally lean for app bundles:\n * applyLanguage / LANGUAGE_REGISTRY / built-in packages\n *\n * Light/dark ThemeProvider: import from `@nebutra/tokens` only (not here).\n *\n * Compile & Create Center tooling:\n * @nebutra/tokens/brand-package (preferred)\n * @nebutra/theme/brand-package (re-export alias)\n *\n * Layers:\n * @nebutra/tokens product chrome SSOT (styles.css + recipe.css + ThemeProvider)\n * @nebutra/theme LANGUAGE_REGISTRY + applyLanguage + skins.css\n */\n\n// Re-export apply helpers used with applyLanguage({ package })\nexport {\n type ApplyBrandOptions,\n applyBrandPackage,\n type BrandPackage,\n clearBrand,\n getActiveBrandId,\n normalizeBrandPackage,\n type ValidationResult,\n validateBrandPackage,\n} from \"@nebutra/tokens/brand-package\";\nexport {\n type ApplyLanguageOptions,\n applyLanguage,\n clearLanguage,\n getActiveLanguageId,\n} from \"./apply-language\";\nexport {\n getBuiltInBrandPackage,\n hasBuiltInBrandPackage,\n listBuiltInBrandIds,\n} from \"./built-in-packages\";\nexport {\n BUILT_IN_LANGUAGE_IDS,\n DEFAULT_LANGUAGE,\n type DesignLanguageCompatibility,\n type DesignLanguageEntry,\n type DesignLanguageInstall,\n type DesignLanguageRegistry,\n getLanguageById,\n isLanguageId,\n LANGUAGE_IDS,\n LANGUAGE_REGISTRY,\n type LanguageId,\n listSkinLanguages,\n} from \"./languages\";\nexport { useDarkSurface } from \"./use-dark-surface\";\n","\"use client\";\n\n/**\n * Is the surface actually dark, whatever the theme is called?\n *\n * Components that flip an asset for a dark background — an inverted wordmark, a\n * mono logomark — asked `resolvedTheme !== \"light\"`. That was the same question\n * as long as the only way to get a dark canvas was the theme toggle. Design\n * languages broke the equivalence: gsap, linear and raycast paint a dark canvas\n * while the theme is still light, so the navbar rendered the dark wordmark on\n * the dark canvas and the logo disappeared.\n *\n * The canvas knows. `--background` holds the bare HSL channels the active skin\n * resolved to, and its third component is the lightness — one reading answers\n * for the theme, the design language, and any combination of the two, including\n * ones that do not exist yet.\n */\n\nimport * as React from \"react\";\n\n/** Lightness below this reads as a dark surface. */\nconst DARK_THRESHOLD = 50;\n\nfunction readCanvasLightness(): number | null {\n if (typeof document === \"undefined\") return null;\n const raw = getComputedStyle(document.documentElement).getPropertyValue(\"--background\").trim();\n // \"222 47% 11%\" — the shadcn-style tokens are channels, not colours.\n const lightness = raw.split(/\\s+/)[2];\n if (!lightness) return null;\n const parsed = Number.parseFloat(lightness);\n return Number.isFinite(parsed) ? parsed : null;\n}\n\n/**\n * `null` until mounted, so a caller can hold the server markup for one paint\n * rather than guess and flip. The channels only exist once CSS has applied.\n */\nexport function useDarkSurface(): boolean | null {\n const [isDark, setIsDark] = React.useState<boolean | null>(null);\n\n React.useEffect(() => {\n const sync = () => {\n const lightness = readCanvasLightness();\n setIsDark(lightness === null ? null : lightness < DARK_THRESHOLD);\n };\n sync();\n\n // Both switches land on <html>: next-themes writes `class`, the language\n // switcher writes `data-brand`. Watching the element covers either without\n // knowing which one moved.\n const observer = new MutationObserver(sync);\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [\"class\", \"data-brand\", \"data-theme\", \"style\"],\n });\n return () => observer.disconnect();\n }, []);\n\n return isDark;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA;AAAA,EAEE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,OACK;;;ACTP,YAAY,WAAW;AAGvB,IAAM,iBAAiB;AAEvB,SAAS,sBAAqC;AAC5C,MAAI,OAAO,aAAa,YAAa,QAAO;AAC5C,QAAM,MAAM,iBAAiB,SAAS,eAAe,EAAE,iBAAiB,cAAc,EAAE,KAAK;AAE7F,QAAM,YAAY,IAAI,MAAM,KAAK,EAAE,CAAC;AACpC,MAAI,CAAC,UAAW,QAAO;AACvB,QAAM,SAAS,OAAO,WAAW,SAAS;AAC1C,SAAO,OAAO,SAAS,MAAM,IAAI,SAAS;AAC5C;AAMO,SAAS,iBAAiC;AAC/C,QAAM,CAAC,QAAQ,SAAS,IAAU,eAAyB,IAAI;AAE/D,EAAM,gBAAU,MAAM;AACpB,UAAM,OAAO,MAAM;AACjB,YAAM,YAAY,oBAAoB;AACtC,gBAAU,cAAc,OAAO,OAAO,YAAY,cAAc;AAAA,IAClE;AACA,SAAK;AAKL,UAAM,WAAW,IAAI,iBAAiB,IAAI;AAC1C,aAAS,QAAQ,SAAS,iBAAiB;AAAA,MACzC,YAAY;AAAA,MACZ,iBAAiB,CAAC,SAAS,cAAc,cAAc,OAAO;AAAA,IAChE,CAAC;AACD,WAAO,MAAM,SAAS,WAAW;AAAA,EACnC,GAAG,CAAC,CAAC;AAEL,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { DesignLanguageEntry } from './languages.js';
|
|
3
|
+
|
|
4
|
+
/** Catalog order, factory first — it is the way back. */
|
|
5
|
+
declare const LANGUAGES: DesignLanguageEntry[];
|
|
6
|
+
/**
|
|
7
|
+
* Flip the language, with the change animated rather than cut.
|
|
8
|
+
*
|
|
9
|
+
* The attribute swap rewrites some two hundred custom properties in one frame,
|
|
10
|
+
* and custom properties do not interpolate — so the whole page used to change
|
|
11
|
+
* between two frames and read as a reload. The properties that *read* those
|
|
12
|
+
* variables do interpolate, so a blanket transition is armed just before the
|
|
13
|
+
* flip and disarmed after: alive for the length of the change and no longer,
|
|
14
|
+
* because leaving it on would put 400ms of lag on every hover afterwards.
|
|
15
|
+
*
|
|
16
|
+
* Where the browser has view transitions, they replace that entirely. A
|
|
17
|
+
* cross-fade carries the discrete changes a property transition cannot — the
|
|
18
|
+
* typeface, gradients with different stop counts, shadow stacks of different
|
|
19
|
+
* lengths — because by then they are pixels rather than properties. Only one of
|
|
20
|
+
* the two ever runs: both together animate the same change twice, and two clocks
|
|
21
|
+
* beating against each other is its own kind of jitter.
|
|
22
|
+
*
|
|
23
|
+
* `requestAnimationFrame` before writing the attribute matters on the fallback
|
|
24
|
+
* path — set the class and the attribute in the same frame and the browser has
|
|
25
|
+
* no previous computed value to transition from, so it cuts anyway.
|
|
26
|
+
*/
|
|
27
|
+
declare function applyLanguageAttribute(id: string, animate?: boolean): void;
|
|
28
|
+
/**
|
|
29
|
+
* Shared state for every mounted switcher.
|
|
30
|
+
*
|
|
31
|
+
* The state lives on the document element rather than in any one component, so
|
|
32
|
+
* two mounted controls broadcast to each other instead of each keeping a private
|
|
33
|
+
* copy that goes stale the moment the other is clicked.
|
|
34
|
+
*/
|
|
35
|
+
declare function useDesignLanguage(): {
|
|
36
|
+
active: string;
|
|
37
|
+
select: (id: string) => void;
|
|
38
|
+
ready: boolean;
|
|
39
|
+
};
|
|
40
|
+
interface DesignLanguageSwitcherProps {
|
|
41
|
+
className?: string;
|
|
42
|
+
/** `compact` for a header rail, `picker` for a primary on-page control. */
|
|
43
|
+
variant?: "compact" | "picker";
|
|
44
|
+
/** Shown under a `picker`: names the active language and what it changes. */
|
|
45
|
+
caption?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Visible "Design language" label. Off where the surrounding surface already
|
|
48
|
+
* says it — on the marketing card the legend sat directly under a heading
|
|
49
|
+
* reading the same thing. Still rendered for assistive tech either way.
|
|
50
|
+
*/
|
|
51
|
+
showLegend?: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Eight buttons and, optionally, a line saying what the current one does.
|
|
55
|
+
*
|
|
56
|
+
* Deliberately built from plain elements rather than the component library: this
|
|
57
|
+
* ships inside the package that defines the languages, and a control that
|
|
58
|
+
* re-skins itself mid-press is a distraction from the page it is re-skinning.
|
|
59
|
+
*/
|
|
60
|
+
declare function DesignLanguageSwitcher({ className, variant, caption, showLegend, }: DesignLanguageSwitcherProps): react_jsx_runtime.JSX.Element;
|
|
61
|
+
|
|
62
|
+
export { DesignLanguageSwitcher, type DesignLanguageSwitcherProps, LANGUAGES, applyLanguageAttribute, useDesignLanguage };
|