@puzzle-ui/theme 0.4.0 → 0.5.1
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/README.md +99 -64
- package/dist/cli.cjs +96 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +97 -0
- package/dist/cli.js.map +1 -0
- package/dist/constants.cjs +21 -21
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.d.cts +8 -8
- package/dist/constants.d.ts +8 -8
- package/dist/constants.js +21 -21
- package/dist/constants.js.map +1 -1
- package/dist/fonts/constants.cjs +3 -3
- package/dist/fonts/constants.cjs.map +1 -1
- package/dist/fonts/constants.js +3 -3
- package/dist/fonts/constants.js.map +1 -1
- package/dist/fonts/create-font-preload-filename.cjs +9 -0
- package/dist/fonts/create-font-preload-filename.cjs.map +1 -0
- package/dist/fonts/create-font-preload-filename.js +9 -0
- package/dist/fonts/create-font-preload-filename.js.map +1 -0
- package/dist/fonts/create-google-font-url.cjs +3 -2
- package/dist/fonts/create-google-font-url.cjs.map +1 -1
- package/dist/fonts/create-google-font-url.js +3 -2
- package/dist/fonts/create-google-font-url.js.map +1 -1
- package/dist/fonts/create-local-font-stylesheet-url.cjs +10 -0
- package/dist/fonts/create-local-font-stylesheet-url.cjs.map +1 -0
- package/dist/fonts/create-local-font-stylesheet-url.js +10 -0
- package/dist/fonts/create-local-font-stylesheet-url.js.map +1 -0
- package/dist/fonts/download-google-fonts.cjs +138 -0
- package/dist/fonts/download-google-fonts.cjs.map +1 -0
- package/dist/fonts/download-google-fonts.js +138 -0
- package/dist/fonts/download-google-fonts.js.map +1 -0
- package/dist/fonts/google-font.cjs +18 -8
- package/dist/fonts/google-font.cjs.map +1 -1
- package/dist/fonts/google-font.d.cts +11 -3
- package/dist/fonts/google-font.d.ts +11 -3
- package/dist/fonts/google-font.js +18 -8
- package/dist/fonts/google-font.js.map +1 -1
- package/dist/fonts/index.d.cts +2 -2
- package/dist/fonts/resolve-font-config.cjs +4 -1
- package/dist/fonts/resolve-font-config.cjs.map +1 -1
- package/dist/fonts/resolve-font-config.js +4 -1
- package/dist/fonts/resolve-font-config.js.map +1 -1
- package/dist/fonts/resolve-font-stylesheets.cjs +7 -1
- package/dist/fonts/resolve-font-stylesheets.cjs.map +1 -1
- package/dist/fonts/resolve-font-stylesheets.js +7 -1
- package/dist/fonts/resolve-font-stylesheets.js.map +1 -1
- package/dist/fonts/types.d.cts +12 -1
- package/dist/fonts/types.d.ts +12 -1
- package/dist/global.css +24 -24
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/theme-scopes.css +3 -3
- package/dist/theme.cjs +26 -4
- package/dist/theme.cjs.map +1 -1
- package/dist/theme.css +16 -16
- package/dist/theme.d.cts +27 -3
- package/dist/theme.d.ts +27 -3
- package/dist/theme.js +26 -4
- package/dist/theme.js.map +1 -1
- package/package.json +15 -4
|
@@ -7,7 +7,9 @@ const validateFamilyName = (value) => {
|
|
|
7
7
|
};
|
|
8
8
|
const resolveFontConfig = (input) => {
|
|
9
9
|
const family = validateFamilyName(input.family);
|
|
10
|
-
const
|
|
10
|
+
const weightRange = input.weightRange;
|
|
11
|
+
if (weightRange !== void 0 && (!Array.isArray(weightRange) || weightRange.length !== 2 || weightRange.some((weight) => !Number.isInteger(weight) || weight < 1 || weight > 1e3) || weightRange[0] > weightRange[1])) throw new RangeError(`font ${family}.weightRange must be an ascending pair of integers between 1 and 1000.`);
|
|
12
|
+
const rawWeights = weightRange ?? input.weights ?? [400, 700];
|
|
11
13
|
const rawStyles = input.styles ?? ["normal"];
|
|
12
14
|
const display = input.display ?? "swap";
|
|
13
15
|
const fallback = input.fallback ?? [...require_constants.DEFAULT_FONT_FALLBACKS[input.role ?? "body"]];
|
|
@@ -16,6 +18,7 @@ const resolveFontConfig = (input) => {
|
|
|
16
18
|
if (fallback.length === 0 || fallback.some((value) => typeof value !== "string" || !value.trim() || /[\u0000-\u001f\u007f<>;]/.test(value))) throw new TypeError(`font ${family}.fallback must be a non-empty array of font-family names.`);
|
|
17
19
|
return {
|
|
18
20
|
family,
|
|
21
|
+
weightRange,
|
|
19
22
|
weights: [...new Set(rawWeights)].sort((a, b) => a - b),
|
|
20
23
|
styles: [...new Set(rawStyles)].sort((a, b) => (a === "normal" ? 0 : 1) - (b === "normal" ? 0 : 1)),
|
|
21
24
|
display,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-font-config.cjs","names":["DEFAULT_FONT_FALLBACKS"],"sources":["../../src/fonts/resolve-font-config.ts"],"sourcesContent":["import { DEFAULT_FONT_FALLBACKS } from \"./constants\";\nimport type { FontConfig, ResolvedFontConfig } from \"./types\";\n\nconst validateFamilyName = (\n value: FontConfig[\"family\"],\n): FontConfig[\"family\"] => {\n const family = value.trim();\n if (!family || /[\\u0000-\\u001f\\u007f<>;]/.test(family)) {\n throw new TypeError(\n `fontFamily '${family}' must be non-empty and must not contain control characters, angle brackets, or semicolons.`,\n );\n }\n return family as FontConfig[\"family\"];\n};\n\nexport const resolveFontConfig = (\n input: FontConfig,\n): ResolvedFontConfig => {\n const family = validateFamilyName(input.family);\n const rawWeights = input.weights ?? [400, 700];\n const rawStyles = input.styles ?? [\"normal\"];\n const display = input.display ?? \"swap\";\n const fallback = input.fallback ?? [\n ...DEFAULT_FONT_FALLBACKS[input.role ?? \"body\"],\n ];\n\n if (\n rawWeights.length === 0 ||\n rawWeights.some(\n (weight) => !Number.isInteger(weight) || weight < 1 || weight > 1000,\n )\n ) {\n throw new RangeError(\n `font ${family}.weights must be a non-empty array of integers between 1 and 1000.`,\n );\n }\n\n if (rawStyles.length === 0) {\n throw new TypeError(\n `font ${family}.styles must contain \"normal\" and/or \"italic\".`,\n );\n }\n\n if (\n fallback.length === 0 ||\n fallback.some(\n (value) =>\n typeof value !== \"string\" ||\n !value.trim() ||\n /[\\u0000-\\u001f\\u007f<>;]/.test(value),\n )\n ) {\n throw new TypeError(\n `font ${family}.fallback must be a non-empty array of font-family names.`,\n );\n }\n\n return {\n family,\n weights: [...new Set(rawWeights)].sort((a, b) => a - b),\n styles: [...new Set(rawStyles)].sort(\n (a, b) => (a === \"normal\" ? 0 : 1) - (b === \"normal\" ? 0 : 1),\n ),\n display,\n fallback: fallback.map((name) => name.trim()),\n role: input.role ?? \"body\",\n };\n};\n"],"mappings":";;AAGA,MAAM,sBACJ,UACyB;CACzB,MAAM,SAAS,MAAM,KAAK;CAC1B,IAAI,CAAC,UAAU,2BAA2B,KAAK,MAAM,GACnD,MAAM,IAAI,UACR,eAAe,OAAO,4FACxB;CAEF,OAAO;AACT;AAEA,MAAa,qBACX,UACuB;CACvB,MAAM,SAAS,mBAAmB,MAAM,MAAM;CAC9C,MAAM,aAAa,MAAM,WAAW,CAAC,KAAK,GAAG;
|
|
1
|
+
{"version":3,"file":"resolve-font-config.cjs","names":["DEFAULT_FONT_FALLBACKS"],"sources":["../../src/fonts/resolve-font-config.ts"],"sourcesContent":["import { DEFAULT_FONT_FALLBACKS } from \"./constants\";\nimport type { FontConfig, ResolvedFontConfig } from \"./types\";\n\nconst validateFamilyName = (\n value: FontConfig[\"family\"],\n): FontConfig[\"family\"] => {\n const family = value.trim();\n if (!family || /[\\u0000-\\u001f\\u007f<>;]/.test(family)) {\n throw new TypeError(\n `fontFamily '${family}' must be non-empty and must not contain control characters, angle brackets, or semicolons.`,\n );\n }\n return family as FontConfig[\"family\"];\n};\n\nexport const resolveFontConfig = (\n input: FontConfig,\n): ResolvedFontConfig => {\n const family = validateFamilyName(input.family);\n const weightRange = input.weightRange;\n if (\n weightRange !== undefined &&\n (!Array.isArray(weightRange) ||\n weightRange.length !== 2 ||\n weightRange.some((weight) => !Number.isInteger(weight) || weight < 1 || weight > 1000) ||\n weightRange[0] > weightRange[1])\n ) {\n throw new RangeError(`font ${family}.weightRange must be an ascending pair of integers between 1 and 1000.`);\n }\n const rawWeights = weightRange ?? input.weights ?? [400, 700];\n const rawStyles = input.styles ?? [\"normal\"];\n const display = input.display ?? \"swap\";\n const fallback = input.fallback ?? [\n ...DEFAULT_FONT_FALLBACKS[input.role ?? \"body\"],\n ];\n\n if (\n rawWeights.length === 0 ||\n rawWeights.some(\n (weight) => !Number.isInteger(weight) || weight < 1 || weight > 1000,\n )\n ) {\n throw new RangeError(\n `font ${family}.weights must be a non-empty array of integers between 1 and 1000.`,\n );\n }\n\n if (rawStyles.length === 0) {\n throw new TypeError(\n `font ${family}.styles must contain \"normal\" and/or \"italic\".`,\n );\n }\n\n if (\n fallback.length === 0 ||\n fallback.some(\n (value) =>\n typeof value !== \"string\" ||\n !value.trim() ||\n /[\\u0000-\\u001f\\u007f<>;]/.test(value),\n )\n ) {\n throw new TypeError(\n `font ${family}.fallback must be a non-empty array of font-family names.`,\n );\n }\n\n return {\n family,\n weightRange,\n weights: [...new Set(rawWeights)].sort((a, b) => a - b),\n styles: [...new Set(rawStyles)].sort(\n (a, b) => (a === \"normal\" ? 0 : 1) - (b === \"normal\" ? 0 : 1),\n ),\n display,\n fallback: fallback.map((name) => name.trim()),\n role: input.role ?? \"body\",\n };\n};\n"],"mappings":";;AAGA,MAAM,sBACJ,UACyB;CACzB,MAAM,SAAS,MAAM,KAAK;CAC1B,IAAI,CAAC,UAAU,2BAA2B,KAAK,MAAM,GACnD,MAAM,IAAI,UACR,eAAe,OAAO,4FACxB;CAEF,OAAO;AACT;AAEA,MAAa,qBACX,UACuB;CACvB,MAAM,SAAS,mBAAmB,MAAM,MAAM;CAC9C,MAAM,cAAc,MAAM;CAC1B,IACE,gBAAgB,KAAA,MACf,CAAC,MAAM,QAAQ,WAAW,KACzB,YAAY,WAAW,KACvB,YAAY,MAAM,WAAW,CAAC,OAAO,UAAU,MAAM,KAAK,SAAS,KAAK,SAAS,GAAI,KACrF,YAAY,KAAK,YAAY,KAE/B,MAAM,IAAI,WAAW,QAAQ,OAAO,uEAAuE;CAE7G,MAAM,aAAa,eAAe,MAAM,WAAW,CAAC,KAAK,GAAG;CAC5D,MAAM,YAAY,MAAM,UAAU,CAAC,QAAQ;CAC3C,MAAM,UAAU,MAAM,WAAW;CACjC,MAAM,WAAW,MAAM,YAAY,CACjC,GAAGA,kBAAAA,uBAAuB,MAAM,QAAQ,OAC1C;CAEA,IACE,WAAW,WAAW,KACtB,WAAW,MACR,WAAW,CAAC,OAAO,UAAU,MAAM,KAAK,SAAS,KAAK,SAAS,GAClE,GAEA,MAAM,IAAI,WACR,QAAQ,OAAO,mEACjB;CAGF,IAAI,UAAU,WAAW,GACvB,MAAM,IAAI,UACR,QAAQ,OAAO,+CACjB;CAGF,IACE,SAAS,WAAW,KACpB,SAAS,MACN,UACC,OAAO,UAAU,YACjB,CAAC,MAAM,KAAK,KACZ,2BAA2B,KAAK,KAAK,CACzC,GAEA,MAAM,IAAI,UACR,QAAQ,OAAO,0DACjB;CAGF,OAAO;EACL;EACA;EACA,SAAS,CAAC,GAAG,IAAI,IAAI,UAAU,CAAC,CAAC,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC;EACtD,QAAQ,CAAC,GAAG,IAAI,IAAI,SAAS,CAAC,CAAC,CAAC,MAC7B,GAAG,OAAO,MAAM,WAAW,IAAI,MAAM,MAAM,WAAW,IAAI,EAC7D;EACA;EACA,UAAU,SAAS,KAAK,SAAS,KAAK,KAAK,CAAC;EAC5C,MAAM,MAAM,QAAQ;CACtB;AACF"}
|
|
@@ -7,7 +7,9 @@ const validateFamilyName = (value) => {
|
|
|
7
7
|
};
|
|
8
8
|
const resolveFontConfig = (input) => {
|
|
9
9
|
const family = validateFamilyName(input.family);
|
|
10
|
-
const
|
|
10
|
+
const weightRange = input.weightRange;
|
|
11
|
+
if (weightRange !== void 0 && (!Array.isArray(weightRange) || weightRange.length !== 2 || weightRange.some((weight) => !Number.isInteger(weight) || weight < 1 || weight > 1e3) || weightRange[0] > weightRange[1])) throw new RangeError(`font ${family}.weightRange must be an ascending pair of integers between 1 and 1000.`);
|
|
12
|
+
const rawWeights = weightRange ?? input.weights ?? [400, 700];
|
|
11
13
|
const rawStyles = input.styles ?? ["normal"];
|
|
12
14
|
const display = input.display ?? "swap";
|
|
13
15
|
const fallback = input.fallback ?? [...DEFAULT_FONT_FALLBACKS[input.role ?? "body"]];
|
|
@@ -16,6 +18,7 @@ const resolveFontConfig = (input) => {
|
|
|
16
18
|
if (fallback.length === 0 || fallback.some((value) => typeof value !== "string" || !value.trim() || /[\u0000-\u001f\u007f<>;]/.test(value))) throw new TypeError(`font ${family}.fallback must be a non-empty array of font-family names.`);
|
|
17
19
|
return {
|
|
18
20
|
family,
|
|
21
|
+
weightRange,
|
|
19
22
|
weights: [...new Set(rawWeights)].sort((a, b) => a - b),
|
|
20
23
|
styles: [...new Set(rawStyles)].sort((a, b) => (a === "normal" ? 0 : 1) - (b === "normal" ? 0 : 1)),
|
|
21
24
|
display,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-font-config.js","names":[],"sources":["../../src/fonts/resolve-font-config.ts"],"sourcesContent":["import { DEFAULT_FONT_FALLBACKS } from \"./constants\";\nimport type { FontConfig, ResolvedFontConfig } from \"./types\";\n\nconst validateFamilyName = (\n value: FontConfig[\"family\"],\n): FontConfig[\"family\"] => {\n const family = value.trim();\n if (!family || /[\\u0000-\\u001f\\u007f<>;]/.test(family)) {\n throw new TypeError(\n `fontFamily '${family}' must be non-empty and must not contain control characters, angle brackets, or semicolons.`,\n );\n }\n return family as FontConfig[\"family\"];\n};\n\nexport const resolveFontConfig = (\n input: FontConfig,\n): ResolvedFontConfig => {\n const family = validateFamilyName(input.family);\n const rawWeights = input.weights ?? [400, 700];\n const rawStyles = input.styles ?? [\"normal\"];\n const display = input.display ?? \"swap\";\n const fallback = input.fallback ?? [\n ...DEFAULT_FONT_FALLBACKS[input.role ?? \"body\"],\n ];\n\n if (\n rawWeights.length === 0 ||\n rawWeights.some(\n (weight) => !Number.isInteger(weight) || weight < 1 || weight > 1000,\n )\n ) {\n throw new RangeError(\n `font ${family}.weights must be a non-empty array of integers between 1 and 1000.`,\n );\n }\n\n if (rawStyles.length === 0) {\n throw new TypeError(\n `font ${family}.styles must contain \"normal\" and/or \"italic\".`,\n );\n }\n\n if (\n fallback.length === 0 ||\n fallback.some(\n (value) =>\n typeof value !== \"string\" ||\n !value.trim() ||\n /[\\u0000-\\u001f\\u007f<>;]/.test(value),\n )\n ) {\n throw new TypeError(\n `font ${family}.fallback must be a non-empty array of font-family names.`,\n );\n }\n\n return {\n family,\n weights: [...new Set(rawWeights)].sort((a, b) => a - b),\n styles: [...new Set(rawStyles)].sort(\n (a, b) => (a === \"normal\" ? 0 : 1) - (b === \"normal\" ? 0 : 1),\n ),\n display,\n fallback: fallback.map((name) => name.trim()),\n role: input.role ?? \"body\",\n };\n};\n"],"mappings":";;AAGA,MAAM,sBACJ,UACyB;CACzB,MAAM,SAAS,MAAM,KAAK;CAC1B,IAAI,CAAC,UAAU,2BAA2B,KAAK,MAAM,GACnD,MAAM,IAAI,UACR,eAAe,OAAO,4FACxB;CAEF,OAAO;AACT;AAEA,MAAa,qBACX,UACuB;CACvB,MAAM,SAAS,mBAAmB,MAAM,MAAM;CAC9C,MAAM,aAAa,MAAM,WAAW,CAAC,KAAK,GAAG;
|
|
1
|
+
{"version":3,"file":"resolve-font-config.js","names":[],"sources":["../../src/fonts/resolve-font-config.ts"],"sourcesContent":["import { DEFAULT_FONT_FALLBACKS } from \"./constants\";\nimport type { FontConfig, ResolvedFontConfig } from \"./types\";\n\nconst validateFamilyName = (\n value: FontConfig[\"family\"],\n): FontConfig[\"family\"] => {\n const family = value.trim();\n if (!family || /[\\u0000-\\u001f\\u007f<>;]/.test(family)) {\n throw new TypeError(\n `fontFamily '${family}' must be non-empty and must not contain control characters, angle brackets, or semicolons.`,\n );\n }\n return family as FontConfig[\"family\"];\n};\n\nexport const resolveFontConfig = (\n input: FontConfig,\n): ResolvedFontConfig => {\n const family = validateFamilyName(input.family);\n const weightRange = input.weightRange;\n if (\n weightRange !== undefined &&\n (!Array.isArray(weightRange) ||\n weightRange.length !== 2 ||\n weightRange.some((weight) => !Number.isInteger(weight) || weight < 1 || weight > 1000) ||\n weightRange[0] > weightRange[1])\n ) {\n throw new RangeError(`font ${family}.weightRange must be an ascending pair of integers between 1 and 1000.`);\n }\n const rawWeights = weightRange ?? input.weights ?? [400, 700];\n const rawStyles = input.styles ?? [\"normal\"];\n const display = input.display ?? \"swap\";\n const fallback = input.fallback ?? [\n ...DEFAULT_FONT_FALLBACKS[input.role ?? \"body\"],\n ];\n\n if (\n rawWeights.length === 0 ||\n rawWeights.some(\n (weight) => !Number.isInteger(weight) || weight < 1 || weight > 1000,\n )\n ) {\n throw new RangeError(\n `font ${family}.weights must be a non-empty array of integers between 1 and 1000.`,\n );\n }\n\n if (rawStyles.length === 0) {\n throw new TypeError(\n `font ${family}.styles must contain \"normal\" and/or \"italic\".`,\n );\n }\n\n if (\n fallback.length === 0 ||\n fallback.some(\n (value) =>\n typeof value !== \"string\" ||\n !value.trim() ||\n /[\\u0000-\\u001f\\u007f<>;]/.test(value),\n )\n ) {\n throw new TypeError(\n `font ${family}.fallback must be a non-empty array of font-family names.`,\n );\n }\n\n return {\n family,\n weightRange,\n weights: [...new Set(rawWeights)].sort((a, b) => a - b),\n styles: [...new Set(rawStyles)].sort(\n (a, b) => (a === \"normal\" ? 0 : 1) - (b === \"normal\" ? 0 : 1),\n ),\n display,\n fallback: fallback.map((name) => name.trim()),\n role: input.role ?? \"body\",\n };\n};\n"],"mappings":";;AAGA,MAAM,sBACJ,UACyB;CACzB,MAAM,SAAS,MAAM,KAAK;CAC1B,IAAI,CAAC,UAAU,2BAA2B,KAAK,MAAM,GACnD,MAAM,IAAI,UACR,eAAe,OAAO,4FACxB;CAEF,OAAO;AACT;AAEA,MAAa,qBACX,UACuB;CACvB,MAAM,SAAS,mBAAmB,MAAM,MAAM;CAC9C,MAAM,cAAc,MAAM;CAC1B,IACE,gBAAgB,KAAA,MACf,CAAC,MAAM,QAAQ,WAAW,KACzB,YAAY,WAAW,KACvB,YAAY,MAAM,WAAW,CAAC,OAAO,UAAU,MAAM,KAAK,SAAS,KAAK,SAAS,GAAI,KACrF,YAAY,KAAK,YAAY,KAE/B,MAAM,IAAI,WAAW,QAAQ,OAAO,uEAAuE;CAE7G,MAAM,aAAa,eAAe,MAAM,WAAW,CAAC,KAAK,GAAG;CAC5D,MAAM,YAAY,MAAM,UAAU,CAAC,QAAQ;CAC3C,MAAM,UAAU,MAAM,WAAW;CACjC,MAAM,WAAW,MAAM,YAAY,CACjC,GAAG,uBAAuB,MAAM,QAAQ,OAC1C;CAEA,IACE,WAAW,WAAW,KACtB,WAAW,MACR,WAAW,CAAC,OAAO,UAAU,MAAM,KAAK,SAAS,KAAK,SAAS,GAClE,GAEA,MAAM,IAAI,WACR,QAAQ,OAAO,mEACjB;CAGF,IAAI,UAAU,WAAW,GACvB,MAAM,IAAI,UACR,QAAQ,OAAO,+CACjB;CAGF,IACE,SAAS,WAAW,KACpB,SAAS,MACN,UACC,OAAO,UAAU,YACjB,CAAC,MAAM,KAAK,KACZ,2BAA2B,KAAK,KAAK,CACzC,GAEA,MAAM,IAAI,UACR,QAAQ,OAAO,0DACjB;CAGF,OAAO;EACL;EACA;EACA,SAAS,CAAC,GAAG,IAAI,IAAI,UAAU,CAAC,CAAC,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC;EACtD,QAAQ,CAAC,GAAG,IAAI,IAAI,SAAS,CAAC,CAAC,CAAC,MAC7B,GAAG,OAAO,MAAM,WAAW,IAAI,MAAM,MAAM,WAAW,IAAI,EAC7D;EACA;EACA,UAAU,SAAS,KAAK,SAAS,KAAK,KAAK,CAAC;EAC5C,MAAM,MAAM,QAAQ;CACtB;AACF"}
|
|
@@ -24,11 +24,16 @@ const resolveFontStylesheets = (fonts) => {
|
|
|
24
24
|
family: font.family,
|
|
25
25
|
display: font.display,
|
|
26
26
|
weights: /* @__PURE__ */ new Set(),
|
|
27
|
-
styles: /* @__PURE__ */ new Set()
|
|
27
|
+
styles: /* @__PURE__ */ new Set(),
|
|
28
|
+
variable: false
|
|
28
29
|
};
|
|
29
30
|
groups.set(key, group);
|
|
30
31
|
}
|
|
31
32
|
font.weights.forEach((weight) => group.weights.add(weight));
|
|
33
|
+
if (font.weightRange) {
|
|
34
|
+
group.variable = true;
|
|
35
|
+
font.weightRange.forEach((weight) => group.weights.add(weight));
|
|
36
|
+
}
|
|
32
37
|
font.styles.forEach((style) => group.styles.add(style));
|
|
33
38
|
}
|
|
34
39
|
return [...groups.values()].map((group) => ({
|
|
@@ -37,6 +42,7 @@ const resolveFontStylesheets = (fonts) => {
|
|
|
37
42
|
href: require_create_google_font_url.createGoogleFontUrl({
|
|
38
43
|
family: group.family,
|
|
39
44
|
weights: [...group.weights].sort((a, b) => a - b),
|
|
45
|
+
weightRange: group.variable ? [Math.min(...group.weights), Math.max(...group.weights)] : void 0,
|
|
40
46
|
styles: [...group.styles].sort((a, b) => (a === "normal" ? 0 : 1) - (b === "normal" ? 0 : 1)),
|
|
41
47
|
display: group.display
|
|
42
48
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-font-stylesheets.cjs","names":["resolveFontConfig","createGoogleFontUrl"],"sources":["../../src/fonts/resolve-font-stylesheets.ts"],"sourcesContent":["import { createGoogleFontUrl } from \"./create-google-font-url\";\nimport { resolveFontConfig } from \"./resolve-font-config\";\nimport type {\n FontStylesheet,\n ResolvedFontConfig,\n ThemeFonts,\n FontDisplay,\n FontStyle,\n} from \"./types\";\n\nexport const resolveFontStylesheets = (\n fonts?: ThemeFonts,\n): FontStylesheet[] => {\n if (fonts === undefined) return [];\n\n const resolved: ResolvedFontConfig[] = [];\n for (const role of [\"heading\", \"body\", \"accent\"] as const) {\n const font = fonts[role];\n if (font !== undefined) {\n resolved.push(resolveFontConfig({ ...font, role }));\n }\n }\n\n // Merge requests for the same family and display mode. This avoids loading\n // separate stylesheets when roles share a family but need different weights.\n const groups = new Map<\n string,\n {\n family: ResolvedFontConfig[\"family\"];\n display: FontDisplay;\n weights: Set<number>;\n styles: Set<FontStyle>;\n }\n >();\n\n for (const font of resolved) {\n const key = `${font.family.toLocaleLowerCase(\"en-US\")}\\u0000${font.display}`;\n let group = groups.get(key);\n if (!group) {\n group = {\n family: font.family,\n display: font.display,\n weights: new Set<number>(),\n styles: new Set<FontStyle>(),\n };\n groups.set(key, group);\n }\n font.weights.forEach((weight) => group!.weights.add(weight));\n font.styles.forEach((style) => group!.styles.add(style));\n }\n\n return [...groups.values()].map((group) => ({\n family: group.family,\n display: group.display,\n href: createGoogleFontUrl({\n family: group.family,\n weights: [...group.weights].sort((a, b) => a - b),\n styles: [...group.styles].sort(\n (a, b) => (a === \"normal\" ? 0 : 1) - (b === \"normal\" ? 0 : 1),\n ),\n display: group.display,\n }),\n }));\n};\n"],"mappings":";;;AAUA,MAAa,0BACX,UACqB;CACrB,IAAI,UAAU,KAAA,GAAW,OAAO,CAAC;CAEjC,MAAM,WAAiC,CAAC;CACxC,KAAK,MAAM,QAAQ;EAAC;EAAW;EAAQ;CAAQ,GAAY;EACzD,MAAM,OAAO,MAAM;EACnB,IAAI,SAAS,KAAA,GACX,SAAS,KAAKA,4BAAAA,kBAAkB;GAAE,GAAG;GAAM;EAAK,CAAC,CAAC;CAEtD;CAIA,MAAM,yBAAS,IAAI,
|
|
1
|
+
{"version":3,"file":"resolve-font-stylesheets.cjs","names":["resolveFontConfig","createGoogleFontUrl"],"sources":["../../src/fonts/resolve-font-stylesheets.ts"],"sourcesContent":["import { createGoogleFontUrl } from \"./create-google-font-url\";\nimport { resolveFontConfig } from \"./resolve-font-config\";\nimport type {\n FontStylesheet,\n ResolvedFontConfig,\n ThemeFonts,\n FontDisplay,\n FontStyle,\n} from \"./types\";\n\nexport const resolveFontStylesheets = (\n fonts?: ThemeFonts,\n): FontStylesheet[] => {\n if (fonts === undefined) return [];\n\n const resolved: ResolvedFontConfig[] = [];\n for (const role of [\"heading\", \"body\", \"accent\"] as const) {\n const font = fonts[role];\n if (font !== undefined) {\n resolved.push(resolveFontConfig({ ...font, role }));\n }\n }\n\n // Merge requests for the same family and display mode. This avoids loading\n // separate stylesheets when roles share a family but need different weights.\n const groups = new Map<\n string,\n {\n family: ResolvedFontConfig[\"family\"];\n display: FontDisplay;\n weights: Set<number>;\n styles: Set<FontStyle>;\n variable: boolean;\n }\n >();\n\n for (const font of resolved) {\n const key = `${font.family.toLocaleLowerCase(\"en-US\")}\\u0000${font.display}`;\n let group = groups.get(key);\n if (!group) {\n group = {\n family: font.family,\n display: font.display,\n weights: new Set<number>(),\n styles: new Set<FontStyle>(),\n variable: false,\n };\n groups.set(key, group);\n }\n font.weights.forEach((weight) => group!.weights.add(weight));\n if (font.weightRange) {\n group.variable = true;\n font.weightRange.forEach((weight) => group!.weights.add(weight));\n }\n font.styles.forEach((style) => group!.styles.add(style));\n }\n\n return [...groups.values()].map((group) => ({\n family: group.family,\n display: group.display,\n href: createGoogleFontUrl({\n family: group.family,\n weights: [...group.weights].sort((a, b) => a - b),\n weightRange: group.variable\n ? [Math.min(...group.weights), Math.max(...group.weights)]\n : undefined,\n styles: [...group.styles].sort(\n (a, b) => (a === \"normal\" ? 0 : 1) - (b === \"normal\" ? 0 : 1),\n ),\n display: group.display,\n }),\n }));\n};\n"],"mappings":";;;AAUA,MAAa,0BACX,UACqB;CACrB,IAAI,UAAU,KAAA,GAAW,OAAO,CAAC;CAEjC,MAAM,WAAiC,CAAC;CACxC,KAAK,MAAM,QAAQ;EAAC;EAAW;EAAQ;CAAQ,GAAY;EACzD,MAAM,OAAO,MAAM;EACnB,IAAI,SAAS,KAAA,GACX,SAAS,KAAKA,4BAAAA,kBAAkB;GAAE,GAAG;GAAM;EAAK,CAAC,CAAC;CAEtD;CAIA,MAAM,yBAAS,IAAI,IASjB;CAEF,KAAK,MAAM,QAAQ,UAAU;EAC3B,MAAM,MAAM,GAAG,KAAK,OAAO,kBAAkB,OAAO,EAAE,QAAQ,KAAK;EACnE,IAAI,QAAQ,OAAO,IAAI,GAAG;EAC1B,IAAI,CAAC,OAAO;GACV,QAAQ;IACN,QAAQ,KAAK;IACb,SAAS,KAAK;IACd,yBAAS,IAAI,IAAY;IACzB,wBAAQ,IAAI,IAAe;IAC3B,UAAU;GACZ;GACA,OAAO,IAAI,KAAK,KAAK;EACvB;EACA,KAAK,QAAQ,SAAS,WAAW,MAAO,QAAQ,IAAI,MAAM,CAAC;EAC3D,IAAI,KAAK,aAAa;GACpB,MAAM,WAAW;GACjB,KAAK,YAAY,SAAS,WAAW,MAAO,QAAQ,IAAI,MAAM,CAAC;EACjE;EACA,KAAK,OAAO,SAAS,UAAU,MAAO,OAAO,IAAI,KAAK,CAAC;CACzD;CAEA,OAAO,CAAC,GAAG,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,WAAW;EAC1C,QAAQ,MAAM;EACd,SAAS,MAAM;EACf,MAAMC,+BAAAA,oBAAoB;GACxB,QAAQ,MAAM;GACd,SAAS,CAAC,GAAG,MAAM,OAAO,CAAC,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC;GAChD,aAAa,MAAM,WACf,CAAC,KAAK,IAAI,GAAG,MAAM,OAAO,GAAG,KAAK,IAAI,GAAG,MAAM,OAAO,CAAC,IACvD,KAAA;GACJ,QAAQ,CAAC,GAAG,MAAM,MAAM,CAAC,CAAC,MACvB,GAAG,OAAO,MAAM,WAAW,IAAI,MAAM,MAAM,WAAW,IAAI,EAC7D;GACA,SAAS,MAAM;EACjB,CAAC;CACH,EAAE;AACJ"}
|
|
@@ -24,11 +24,16 @@ const resolveFontStylesheets = (fonts) => {
|
|
|
24
24
|
family: font.family,
|
|
25
25
|
display: font.display,
|
|
26
26
|
weights: /* @__PURE__ */ new Set(),
|
|
27
|
-
styles: /* @__PURE__ */ new Set()
|
|
27
|
+
styles: /* @__PURE__ */ new Set(),
|
|
28
|
+
variable: false
|
|
28
29
|
};
|
|
29
30
|
groups.set(key, group);
|
|
30
31
|
}
|
|
31
32
|
font.weights.forEach((weight) => group.weights.add(weight));
|
|
33
|
+
if (font.weightRange) {
|
|
34
|
+
group.variable = true;
|
|
35
|
+
font.weightRange.forEach((weight) => group.weights.add(weight));
|
|
36
|
+
}
|
|
32
37
|
font.styles.forEach((style) => group.styles.add(style));
|
|
33
38
|
}
|
|
34
39
|
return [...groups.values()].map((group) => ({
|
|
@@ -37,6 +42,7 @@ const resolveFontStylesheets = (fonts) => {
|
|
|
37
42
|
href: createGoogleFontUrl({
|
|
38
43
|
family: group.family,
|
|
39
44
|
weights: [...group.weights].sort((a, b) => a - b),
|
|
45
|
+
weightRange: group.variable ? [Math.min(...group.weights), Math.max(...group.weights)] : void 0,
|
|
40
46
|
styles: [...group.styles].sort((a, b) => (a === "normal" ? 0 : 1) - (b === "normal" ? 0 : 1)),
|
|
41
47
|
display: group.display
|
|
42
48
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-font-stylesheets.js","names":[],"sources":["../../src/fonts/resolve-font-stylesheets.ts"],"sourcesContent":["import { createGoogleFontUrl } from \"./create-google-font-url\";\nimport { resolveFontConfig } from \"./resolve-font-config\";\nimport type {\n FontStylesheet,\n ResolvedFontConfig,\n ThemeFonts,\n FontDisplay,\n FontStyle,\n} from \"./types\";\n\nexport const resolveFontStylesheets = (\n fonts?: ThemeFonts,\n): FontStylesheet[] => {\n if (fonts === undefined) return [];\n\n const resolved: ResolvedFontConfig[] = [];\n for (const role of [\"heading\", \"body\", \"accent\"] as const) {\n const font = fonts[role];\n if (font !== undefined) {\n resolved.push(resolveFontConfig({ ...font, role }));\n }\n }\n\n // Merge requests for the same family and display mode. This avoids loading\n // separate stylesheets when roles share a family but need different weights.\n const groups = new Map<\n string,\n {\n family: ResolvedFontConfig[\"family\"];\n display: FontDisplay;\n weights: Set<number>;\n styles: Set<FontStyle>;\n }\n >();\n\n for (const font of resolved) {\n const key = `${font.family.toLocaleLowerCase(\"en-US\")}\\u0000${font.display}`;\n let group = groups.get(key);\n if (!group) {\n group = {\n family: font.family,\n display: font.display,\n weights: new Set<number>(),\n styles: new Set<FontStyle>(),\n };\n groups.set(key, group);\n }\n font.weights.forEach((weight) => group!.weights.add(weight));\n font.styles.forEach((style) => group!.styles.add(style));\n }\n\n return [...groups.values()].map((group) => ({\n family: group.family,\n display: group.display,\n href: createGoogleFontUrl({\n family: group.family,\n weights: [...group.weights].sort((a, b) => a - b),\n styles: [...group.styles].sort(\n (a, b) => (a === \"normal\" ? 0 : 1) - (b === \"normal\" ? 0 : 1),\n ),\n display: group.display,\n }),\n }));\n};\n"],"mappings":";;;AAUA,MAAa,0BACX,UACqB;CACrB,IAAI,UAAU,KAAA,GAAW,OAAO,CAAC;CAEjC,MAAM,WAAiC,CAAC;CACxC,KAAK,MAAM,QAAQ;EAAC;EAAW;EAAQ;CAAQ,GAAY;EACzD,MAAM,OAAO,MAAM;EACnB,IAAI,SAAS,KAAA,GACX,SAAS,KAAK,kBAAkB;GAAE,GAAG;GAAM;EAAK,CAAC,CAAC;CAEtD;CAIA,MAAM,yBAAS,IAAI,
|
|
1
|
+
{"version":3,"file":"resolve-font-stylesheets.js","names":[],"sources":["../../src/fonts/resolve-font-stylesheets.ts"],"sourcesContent":["import { createGoogleFontUrl } from \"./create-google-font-url\";\nimport { resolveFontConfig } from \"./resolve-font-config\";\nimport type {\n FontStylesheet,\n ResolvedFontConfig,\n ThemeFonts,\n FontDisplay,\n FontStyle,\n} from \"./types\";\n\nexport const resolveFontStylesheets = (\n fonts?: ThemeFonts,\n): FontStylesheet[] => {\n if (fonts === undefined) return [];\n\n const resolved: ResolvedFontConfig[] = [];\n for (const role of [\"heading\", \"body\", \"accent\"] as const) {\n const font = fonts[role];\n if (font !== undefined) {\n resolved.push(resolveFontConfig({ ...font, role }));\n }\n }\n\n // Merge requests for the same family and display mode. This avoids loading\n // separate stylesheets when roles share a family but need different weights.\n const groups = new Map<\n string,\n {\n family: ResolvedFontConfig[\"family\"];\n display: FontDisplay;\n weights: Set<number>;\n styles: Set<FontStyle>;\n variable: boolean;\n }\n >();\n\n for (const font of resolved) {\n const key = `${font.family.toLocaleLowerCase(\"en-US\")}\\u0000${font.display}`;\n let group = groups.get(key);\n if (!group) {\n group = {\n family: font.family,\n display: font.display,\n weights: new Set<number>(),\n styles: new Set<FontStyle>(),\n variable: false,\n };\n groups.set(key, group);\n }\n font.weights.forEach((weight) => group!.weights.add(weight));\n if (font.weightRange) {\n group.variable = true;\n font.weightRange.forEach((weight) => group!.weights.add(weight));\n }\n font.styles.forEach((style) => group!.styles.add(style));\n }\n\n return [...groups.values()].map((group) => ({\n family: group.family,\n display: group.display,\n href: createGoogleFontUrl({\n family: group.family,\n weights: [...group.weights].sort((a, b) => a - b),\n weightRange: group.variable\n ? [Math.min(...group.weights), Math.max(...group.weights)]\n : undefined,\n styles: [...group.styles].sort(\n (a, b) => (a === \"normal\" ? 0 : 1) - (b === \"normal\" ? 0 : 1),\n ),\n display: group.display,\n }),\n }));\n};\n"],"mappings":";;;AAUA,MAAa,0BACX,UACqB;CACrB,IAAI,UAAU,KAAA,GAAW,OAAO,CAAC;CAEjC,MAAM,WAAiC,CAAC;CACxC,KAAK,MAAM,QAAQ;EAAC;EAAW;EAAQ;CAAQ,GAAY;EACzD,MAAM,OAAO,MAAM;EACnB,IAAI,SAAS,KAAA,GACX,SAAS,KAAK,kBAAkB;GAAE,GAAG;GAAM;EAAK,CAAC,CAAC;CAEtD;CAIA,MAAM,yBAAS,IAAI,IASjB;CAEF,KAAK,MAAM,QAAQ,UAAU;EAC3B,MAAM,MAAM,GAAG,KAAK,OAAO,kBAAkB,OAAO,EAAE,QAAQ,KAAK;EACnE,IAAI,QAAQ,OAAO,IAAI,GAAG;EAC1B,IAAI,CAAC,OAAO;GACV,QAAQ;IACN,QAAQ,KAAK;IACb,SAAS,KAAK;IACd,yBAAS,IAAI,IAAY;IACzB,wBAAQ,IAAI,IAAe;IAC3B,UAAU;GACZ;GACA,OAAO,IAAI,KAAK,KAAK;EACvB;EACA,KAAK,QAAQ,SAAS,WAAW,MAAO,QAAQ,IAAI,MAAM,CAAC;EAC3D,IAAI,KAAK,aAAa;GACpB,MAAM,WAAW;GACjB,KAAK,YAAY,SAAS,WAAW,MAAO,QAAQ,IAAI,MAAM,CAAC;EACjE;EACA,KAAK,OAAO,SAAS,UAAU,MAAO,OAAO,IAAI,KAAK,CAAC;CACzD;CAEA,OAAO,CAAC,GAAG,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,WAAW;EAC1C,QAAQ,MAAM;EACd,SAAS,MAAM;EACf,MAAM,oBAAoB;GACxB,QAAQ,MAAM;GACd,SAAS,CAAC,GAAG,MAAM,OAAO,CAAC,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC;GAChD,aAAa,MAAM,WACf,CAAC,KAAK,IAAI,GAAG,MAAM,OAAO,GAAG,KAAK,IAAI,GAAG,MAAM,OAAO,CAAC,IACvD,KAAA;GACJ,QAAQ,CAAC,GAAG,MAAM,MAAM,CAAC,CAAC,MACvB,GAAG,OAAO,MAAM,WAAW,IAAI,MAAM,MAAM,WAAW,IAAI,EAC7D;GACA,SAAS,MAAM;EACjB,CAAC;CACH,EAAE;AACJ"}
|
package/dist/fonts/types.d.cts
CHANGED
|
@@ -2,21 +2,32 @@ import { GoogleFontFamily } from "./google-font-familiy.cjs";
|
|
|
2
2
|
export type FontRole = "heading" | "body" | "accent";
|
|
3
3
|
export type FontStyle = "normal" | "italic";
|
|
4
4
|
export type FontDisplay = "auto" | "block" | "swap" | "fallback" | "optional";
|
|
5
|
+
export type FontPreload = FontRole | false;
|
|
6
|
+
/**
|
|
7
|
+
* Determines where configured fonts are loaded from.
|
|
8
|
+
*
|
|
9
|
+
* - google: Load stylesheets directly from Google Fonts.
|
|
10
|
+
* - local: Load the generated stylesheet from the application's public directory.
|
|
11
|
+
*/
|
|
12
|
+
export type FontSource = "google" | "local";
|
|
5
13
|
export type FontConfig = {
|
|
6
14
|
family: GoogleFontFamily;
|
|
7
15
|
role?: FontRole;
|
|
8
16
|
weights?: readonly number[];
|
|
17
|
+
weightRange?: readonly [number, number];
|
|
9
18
|
styles?: readonly FontStyle[];
|
|
10
19
|
display?: FontDisplay;
|
|
11
20
|
fallback?: readonly string[];
|
|
12
21
|
nonce?: string;
|
|
13
22
|
};
|
|
14
|
-
export type ResolvedFontConfig = Required<Omit<FontConfig, "nonce">> & {
|
|
23
|
+
export type ResolvedFontConfig = Required<Omit<FontConfig, "nonce" | "weightRange">> & {
|
|
15
24
|
nonce?: string;
|
|
25
|
+
weightRange?: readonly [number, number];
|
|
16
26
|
};
|
|
17
27
|
export type CreateGoogleFontUrlOptions = {
|
|
18
28
|
family: GoogleFontFamily;
|
|
19
29
|
weights?: readonly number[];
|
|
30
|
+
weightRange?: readonly [number, number];
|
|
20
31
|
styles?: readonly FontStyle[];
|
|
21
32
|
display?: FontDisplay;
|
|
22
33
|
};
|
package/dist/fonts/types.d.ts
CHANGED
|
@@ -2,21 +2,32 @@ import { GoogleFontFamily } from "./google-font-familiy.js";
|
|
|
2
2
|
export type FontRole = "heading" | "body" | "accent";
|
|
3
3
|
export type FontStyle = "normal" | "italic";
|
|
4
4
|
export type FontDisplay = "auto" | "block" | "swap" | "fallback" | "optional";
|
|
5
|
+
export type FontPreload = FontRole | false;
|
|
6
|
+
/**
|
|
7
|
+
* Determines where configured fonts are loaded from.
|
|
8
|
+
*
|
|
9
|
+
* - google: Load stylesheets directly from Google Fonts.
|
|
10
|
+
* - local: Load the generated stylesheet from the application's public directory.
|
|
11
|
+
*/
|
|
12
|
+
export type FontSource = "google" | "local";
|
|
5
13
|
export type FontConfig = {
|
|
6
14
|
family: GoogleFontFamily;
|
|
7
15
|
role?: FontRole;
|
|
8
16
|
weights?: readonly number[];
|
|
17
|
+
weightRange?: readonly [number, number];
|
|
9
18
|
styles?: readonly FontStyle[];
|
|
10
19
|
display?: FontDisplay;
|
|
11
20
|
fallback?: readonly string[];
|
|
12
21
|
nonce?: string;
|
|
13
22
|
};
|
|
14
|
-
export type ResolvedFontConfig = Required<Omit<FontConfig, "nonce">> & {
|
|
23
|
+
export type ResolvedFontConfig = Required<Omit<FontConfig, "nonce" | "weightRange">> & {
|
|
15
24
|
nonce?: string;
|
|
25
|
+
weightRange?: readonly [number, number];
|
|
16
26
|
};
|
|
17
27
|
export type CreateGoogleFontUrlOptions = {
|
|
18
28
|
family: GoogleFontFamily;
|
|
19
29
|
weights?: readonly number[];
|
|
30
|
+
weightRange?: readonly [number, number];
|
|
20
31
|
styles?: readonly FontStyle[];
|
|
21
32
|
display?: FontDisplay;
|
|
22
33
|
};
|
package/dist/global.css
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
:root
|
|
1
|
+
:root *, :root :before, :root :after {
|
|
2
2
|
box-sizing: border-box;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
:root
|
|
5
|
+
:root {
|
|
6
6
|
color-scheme: light;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
:root
|
|
9
|
+
:root body {
|
|
10
10
|
-webkit-text-size-adjust: 100%;
|
|
11
11
|
text-size-adjust: 100%;
|
|
12
12
|
color: var(--puzzle-color-text, #171717);
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
margin: 0;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
:
|
|
22
|
+
:where(input, textarea, select, button) {
|
|
23
23
|
font: inherit;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
:
|
|
26
|
+
:where(button) {
|
|
27
27
|
cursor: pointer;
|
|
28
28
|
font-family: var(--puzzle-font-family-button, inherit);
|
|
29
29
|
font-size: var(--puzzle-font-size-button, inherit);
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
letter-spacing: var(--puzzle-font-letter-spacing-button, inherit);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
:
|
|
35
|
+
:where(button:disabled, input:disabled, textarea:disabled, select:disabled) {
|
|
36
36
|
cursor: not-allowed;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
:
|
|
39
|
+
:where(h1, h2, h3, h4, p) {
|
|
40
40
|
margin-block: 0;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
:
|
|
43
|
+
:where(h1) {
|
|
44
44
|
font-family: var(--puzzle-font-family-headline1, inherit);
|
|
45
45
|
font-size: var(--puzzle-font-size-headline1, 2.25rem);
|
|
46
46
|
font-weight: var(--puzzle-font-weight-headline1, 700);
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
letter-spacing: var(--puzzle-font-letter-spacing-headline1, -.025em);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
:
|
|
51
|
+
:where(h2) {
|
|
52
52
|
font-family: var(--puzzle-font-family-headline2, inherit);
|
|
53
53
|
font-size: var(--puzzle-font-size-headline2, 1.875rem);
|
|
54
54
|
font-weight: var(--puzzle-font-weight-headline2, 700);
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
letter-spacing: var(--puzzle-font-letter-spacing-headline2, -.025em);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
:
|
|
59
|
+
:where(h3) {
|
|
60
60
|
font-family: var(--puzzle-font-family-headline3, inherit);
|
|
61
61
|
font-size: var(--puzzle-font-size-headline3, 1.5rem);
|
|
62
62
|
font-weight: var(--puzzle-font-weight-headline3, 600);
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
letter-spacing: var(--puzzle-font-letter-spacing-headline3, 0);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
:
|
|
67
|
+
:where(h4) {
|
|
68
68
|
font-family: var(--puzzle-font-family-headline4, inherit);
|
|
69
69
|
font-size: var(--puzzle-font-size-headline4, 1.25rem);
|
|
70
70
|
font-weight: var(--puzzle-font-weight-headline4, 600);
|
|
@@ -72,33 +72,33 @@
|
|
|
72
72
|
letter-spacing: var(--puzzle-font-letter-spacing-headline4, 0);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
:
|
|
75
|
+
:where(h1, h2, h3, h4) + :where(h1, h2, h3, h4) {
|
|
76
76
|
margin-block-start: var(--puzzle-font-gap-heading-stack-gap, .3em);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
:
|
|
79
|
+
:where(h1, h2, h3, h4) + :where(p) {
|
|
80
80
|
margin-block-start: var(--puzzle-font-gap-heading-paragraph-gap, .65em);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
:
|
|
83
|
+
:where(p) + :where(p) {
|
|
84
84
|
margin-block-start: var(--puzzle-font-gap-paragraph-gap, 1em);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
:
|
|
87
|
+
:where(p) + :where(h1, h2, h3, h4) {
|
|
88
88
|
margin-block-start: var(--puzzle-font-gap-section-gap, 1.5em);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
:where(:root
|
|
91
|
+
:where(:root) :where(a) {
|
|
92
92
|
color: var(--puzzle-color-primary, #2563eb);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
:
|
|
95
|
+
:where(:focus-visible) {
|
|
96
96
|
outline: 2px solid var(--puzzle-color-ring, #2563eb);
|
|
97
97
|
outline-offset: 2px;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
@media (prefers-reduced-motion: reduce) {
|
|
101
|
-
:root
|
|
101
|
+
:root *, :root :before, :root :after {
|
|
102
102
|
scroll-behavior: auto !important;
|
|
103
103
|
transition-duration: .01ms !important;
|
|
104
104
|
animation-duration: .01ms !important;
|
|
@@ -107,29 +107,29 @@
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
@media (forced-colors: active) {
|
|
110
|
-
:
|
|
110
|
+
:where(:focus-visible) {
|
|
111
111
|
outline-offset: 2px;
|
|
112
112
|
outline: 2px solid highlight;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
:
|
|
115
|
+
:where(a) {
|
|
116
116
|
color: linktext;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
:
|
|
119
|
+
:where(button, input, textarea, select, [role="button"], [role="option"]) {
|
|
120
120
|
forced-color-adjust: auto;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
:
|
|
123
|
+
:where(input, textarea, select) {
|
|
124
124
|
border-color: buttontext;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
:
|
|
127
|
+
:where(button:disabled, input:disabled, textarea:disabled, select:disabled) {
|
|
128
128
|
color: graytext;
|
|
129
129
|
border-color: graytext;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
:
|
|
132
|
+
:where([aria-invalid="true"], [data-invalid="true"]) {
|
|
133
133
|
outline-color: mark;
|
|
134
134
|
}
|
|
135
135
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FontConfig, FontDisplay, FontRole, FontStyle, FontStylesheet, ResolvedFontConfig, ThemeFonts } from "./fonts/types.cjs";
|
|
1
|
+
import { FontConfig, FontDisplay, FontPreload, FontRole, FontSource, FontStyle, FontStylesheet, ResolvedFontConfig, ThemeFonts } from "./fonts/types.cjs";
|
|
2
2
|
import { createGoogleFontUrl } from "./fonts/create-google-font-url.cjs";
|
|
3
3
|
import { GoogleFont } from "./fonts/google-font.cjs";
|
|
4
4
|
import "./fonts/index.cjs";
|
|
@@ -7,4 +7,4 @@ import "./fonts/typography.cjs";
|
|
|
7
7
|
import { BREAKPOINTS, Breakpoint } from "./breakpoints.cjs";
|
|
8
8
|
import { ColorTheme, ThemeColorSchemeTokens, ThemeMode, ThemeTokenOverrides, ThemeTokens, ThemeTypographyFontRole, ThemeTypographyRoleTokens, TypographyStyle } from "./types.cjs";
|
|
9
9
|
import { ThemeComponents, ThemeImageComponent, ThemeLinkComponent, ThemeLinkComponentConfig } from "./components.types.cjs";
|
|
10
|
-
export { BREAKPOINTS, type Breakpoint, type ColorTheme, type FontConfig, type FontDisplay, type FontRole, type FontStyle, type FontStylesheet, GoogleFont, type ResolvedFontConfig, Theme, type ThemeColorSchemeTokens, type ThemeComponents, type ThemeFonts, type ThemeImageComponent, type ThemeLinkComponent, type ThemeLinkComponentConfig, type ThemeMode, type ThemeProps, type ThemeScope, type ThemeTokenOverrides, type ThemeTokens, type ThemeTypographyFontRole, type ThemeTypographyRoleTokens, type TypographyStyle, createGoogleFontUrl };
|
|
10
|
+
export { BREAKPOINTS, type Breakpoint, type ColorTheme, type FontConfig, type FontDisplay, type FontPreload, type FontRole, type FontSource, type FontStyle, type FontStylesheet, GoogleFont, type ResolvedFontConfig, Theme, type ThemeColorSchemeTokens, type ThemeComponents, type ThemeFonts, type ThemeImageComponent, type ThemeLinkComponent, type ThemeLinkComponentConfig, type ThemeMode, type ThemeProps, type ThemeScope, type ThemeTokenOverrides, type ThemeTokens, type ThemeTypographyFontRole, type ThemeTypographyRoleTokens, type TypographyStyle, createGoogleFontUrl };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createGoogleFontUrl } from "./fonts/create-google-font-url.js";
|
|
2
2
|
import { GoogleFont } from "./fonts/google-font.js";
|
|
3
|
-
import { FontConfig, FontDisplay, FontRole, FontStyle, FontStylesheet, ResolvedFontConfig, ThemeFonts } from "./fonts/types.js";
|
|
3
|
+
import { FontConfig, FontDisplay, FontPreload, FontRole, FontSource, FontStyle, FontStylesheet, ResolvedFontConfig, ThemeFonts } from "./fonts/types.js";
|
|
4
4
|
import { Theme, ThemeProps, ThemeScope } from "./theme.js";
|
|
5
5
|
import "./fonts/typography.js";
|
|
6
6
|
import { BREAKPOINTS, Breakpoint } from "./breakpoints.js";
|
|
7
7
|
import { ColorTheme, ThemeColorSchemeTokens, ThemeMode, ThemeTokenOverrides, ThemeTokens, ThemeTypographyFontRole, ThemeTypographyRoleTokens, TypographyStyle } from "./types.js";
|
|
8
8
|
import { ThemeComponents, ThemeImageComponent, ThemeLinkComponent, ThemeLinkComponentConfig } from "./components.types.js";
|
|
9
|
-
export { BREAKPOINTS, type Breakpoint, type ColorTheme, type FontConfig, type FontDisplay, type FontRole, type FontStyle, type FontStylesheet, GoogleFont, type ResolvedFontConfig, Theme, type ThemeColorSchemeTokens, type ThemeComponents, type ThemeFonts, type ThemeImageComponent, type ThemeLinkComponent, type ThemeLinkComponentConfig, type ThemeMode, type ThemeProps, type ThemeScope, type ThemeTokenOverrides, type ThemeTokens, type ThemeTypographyFontRole, type ThemeTypographyRoleTokens, type TypographyStyle, createGoogleFontUrl };
|
|
9
|
+
export { BREAKPOINTS, type Breakpoint, type ColorTheme, type FontConfig, type FontDisplay, type FontPreload, type FontRole, type FontSource, type FontStyle, type FontStylesheet, GoogleFont, type ResolvedFontConfig, Theme, type ThemeColorSchemeTokens, type ThemeComponents, type ThemeFonts, type ThemeImageComponent, type ThemeLinkComponent, type ThemeLinkComponentConfig, type ThemeMode, type ThemeProps, type ThemeScope, type ThemeTokenOverrides, type ThemeTokens, type ThemeTypographyFontRole, type ThemeTypographyRoleTokens, type TypographyStyle, createGoogleFontUrl };
|
package/dist/theme-scopes.css
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
--puzzle-color-ring: var(--puzzle-color-scheme-light-ring, #2563eb);
|
|
24
24
|
--puzzle-color-success: var(--puzzle-color-scheme-light-success, #15803d);
|
|
25
25
|
--puzzle-color-success-foreground: var(--puzzle-color-scheme-light-success-foreground, #fff);
|
|
26
|
-
--puzzle-color-warning: var(--puzzle-color-scheme-light-warning, #
|
|
26
|
+
--puzzle-color-warning: var(--puzzle-color-scheme-light-warning, #fabc0a);
|
|
27
27
|
--puzzle-color-warning-foreground: var(--puzzle-color-scheme-light-warning-foreground, #fff);
|
|
28
28
|
--puzzle-color-danger: var(--puzzle-color-scheme-light-danger, #b91c1c);
|
|
29
29
|
--puzzle-color-danger-foreground: var(--puzzle-color-scheme-light-danger-foreground, #fff);
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
--puzzle-color-ring: var(--puzzle-color-scheme-dark-ring, #93c5fd);
|
|
52
52
|
--puzzle-color-success: var(--puzzle-color-scheme-dark-success, #4ade80);
|
|
53
53
|
--puzzle-color-success-foreground: var(--puzzle-color-scheme-dark-success-foreground, #052e16);
|
|
54
|
-
--puzzle-color-warning: var(--puzzle-color-scheme-dark-warning, #
|
|
54
|
+
--puzzle-color-warning: var(--puzzle-color-scheme-dark-warning, #fabc0a);
|
|
55
55
|
--puzzle-color-warning-foreground: var(--puzzle-color-scheme-dark-warning-foreground, #422006);
|
|
56
56
|
--puzzle-color-danger: var(--puzzle-color-scheme-dark-danger, #f87171);
|
|
57
57
|
--puzzle-color-danger-foreground: var(--puzzle-color-scheme-dark-danger-foreground, #450a0a);
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
--puzzle-color-ring: var(--puzzle-color-scheme-dark-ring, #93c5fd);
|
|
81
81
|
--puzzle-color-success: var(--puzzle-color-scheme-dark-success, #4ade80);
|
|
82
82
|
--puzzle-color-success-foreground: var(--puzzle-color-scheme-dark-success-foreground, #052e16);
|
|
83
|
-
--puzzle-color-warning: var(--puzzle-color-scheme-dark-warning, #
|
|
83
|
+
--puzzle-color-warning: var(--puzzle-color-scheme-dark-warning, #fabc0a);
|
|
84
84
|
--puzzle-color-warning-foreground: var(--puzzle-color-scheme-dark-warning-foreground, #422006);
|
|
85
85
|
--puzzle-color-danger: var(--puzzle-color-scheme-dark-danger, #f87171);
|
|
86
86
|
--puzzle-color-danger-foreground: var(--puzzle-color-scheme-dark-danger-foreground, #450a0a);
|
package/dist/theme.cjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const require_components_context = require("./components-context.cjs");
|
|
2
2
|
const require_scope_context = require("./scope-context.cjs");
|
|
3
3
|
const require_resolve_font_stylesheets = require("./fonts/resolve-font-stylesheets.cjs");
|
|
4
|
+
const require_create_local_font_stylesheet_url = require("./fonts/create-local-font-stylesheet-url.cjs");
|
|
5
|
+
const require_create_font_preload_filename = require("./fonts/create-font-preload-filename.cjs");
|
|
4
6
|
const require_create_theme_variables = require("./create-theme-variables.cjs");
|
|
5
7
|
const require_create_theme_css = require("./create-theme-css.cjs");
|
|
6
8
|
;/* empty css */
|
|
@@ -9,9 +11,16 @@ const require_create_theme_css = require("./create-theme-css.cjs");
|
|
|
9
11
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
12
|
let react = require("react");
|
|
11
13
|
// src/theme.tsx
|
|
12
|
-
const
|
|
14
|
+
const normalizeFontBasePath = (path) => {
|
|
15
|
+
return path.replace(/\/+$/, "");
|
|
16
|
+
};
|
|
17
|
+
const Theme = ({ nonce, fonts, fontSource = "google", fontBasePath = "/fonts", fontPreload = "body", theme = "system", scope = "root", globalStyles, tokens, colorTheme, components, children }) => {
|
|
13
18
|
const scopeId = (0, react.useId)();
|
|
14
19
|
const fontStylesheets = require_resolve_font_stylesheets.resolveFontStylesheets(fonts);
|
|
20
|
+
const localFontStylesheet = fontSource === "local" && fontStylesheets.length > 0 ? require_create_local_font_stylesheet_url.createLocalFontStylesheetUrl(fontBasePath) : null;
|
|
21
|
+
const preloadFont = fontPreload !== false ? fonts?.[fontPreload] : void 0;
|
|
22
|
+
const normalizedFontBasePath = normalizeFontBasePath(fontBasePath);
|
|
23
|
+
const fontPreloadHref = fontSource === "local" && preloadFont?.family ? `${normalizedFontBasePath}/${require_create_font_preload_filename.createFontPreloadFilename(preloadFont.family)}` : null;
|
|
15
24
|
const cssVariables = require_create_theme_variables.createThemeVariables(fonts, tokens, theme, colorTheme);
|
|
16
25
|
const css = `${scope === "root" ? ":root" : `[data-puzzle-theme-scope="${scopeId}"]`} {\n${require_create_theme_css.createThemeCss(cssVariables)}\n}`;
|
|
17
26
|
const shouldApplyGlobalStyles = scope === "root" && (globalStyles ?? true);
|
|
@@ -23,8 +32,16 @@ const Theme = ({ nonce, fonts, theme = "system", scope = "root", globalStyles, t
|
|
|
23
32
|
children
|
|
24
33
|
})
|
|
25
34
|
});
|
|
35
|
+
const usesGoogleFonts = fontSource === "google" && fontStylesheets.length > 0;
|
|
26
36
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
27
|
-
|
|
37
|
+
fontPreloadHref ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("link", {
|
|
38
|
+
rel: "preload",
|
|
39
|
+
href: fontPreloadHref,
|
|
40
|
+
as: "font",
|
|
41
|
+
type: "font/woff2",
|
|
42
|
+
crossOrigin: "anonymous"
|
|
43
|
+
}) : null,
|
|
44
|
+
usesGoogleFonts ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("link", {
|
|
28
45
|
rel: "preconnect",
|
|
29
46
|
href: "https://fonts.googleapis.com"
|
|
30
47
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("link", {
|
|
@@ -32,11 +49,16 @@ const Theme = ({ nonce, fonts, theme = "system", scope = "root", globalStyles, t
|
|
|
32
49
|
href: "https://fonts.gstatic.com",
|
|
33
50
|
crossOrigin: "anonymous"
|
|
34
51
|
})] }) : null,
|
|
35
|
-
fontStylesheets.map(({ href }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("link", {
|
|
52
|
+
fontSource === "google" ? fontStylesheets.map(({ href }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("link", {
|
|
36
53
|
rel: "stylesheet",
|
|
37
54
|
href,
|
|
38
55
|
precedence: "default"
|
|
39
|
-
}, href)),
|
|
56
|
+
}, href)) : null,
|
|
57
|
+
localFontStylesheet ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("link", {
|
|
58
|
+
rel: "stylesheet",
|
|
59
|
+
href: localFontStylesheet,
|
|
60
|
+
precedence: "default"
|
|
61
|
+
}, localFontStylesheet) : null,
|
|
40
62
|
shouldApplyGlobalStyles ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", {
|
|
41
63
|
nonce,
|
|
42
64
|
"data-puzzle-global-styles": ""
|
package/dist/theme.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.cjs","names":["useId","resolveFontStylesheets","createThemeVariables","createThemeCss","ThemeScopeProvider","ThemeComponentsProvider"],"sources":["../src/theme.tsx"],"sourcesContent":["import { useId, type PropsWithChildren } from \"react\";\n\nimport type { FontRole, FontConfig } from \"./fonts\";\nimport type { ColorThemes, ThemeMode, ThemeTokenOverrides } from \"./types\";\nimport type { ThemeComponents } from \"./components.types\";\n\nimport { ThemeComponentsProvider } from \"./components-context\";\nimport { ThemeScopeProvider } from \"./scope-context\";\n\nimport { resolveFontStylesheets } from \"./fonts/resolve-font-stylesheets\";\nimport { createThemeVariables } from \"./create-theme-variables\";\nimport { createThemeCss } from \"./create-theme-css\";\n\nimport \"./theme.css\";\nimport \"./theme-scopes.css\";\nimport \"./global.css\";\n\nexport type ThemeScope = \"root\" | \"local\";\n\nexport type ThemeProps = {\n nonce?: string;\n theme?: ThemeMode;\n scope?: ThemeScope;\n globalStyles?: boolean;\n fonts?: Partial<Record<FontRole, FontConfig
|
|
1
|
+
{"version":3,"file":"theme.cjs","names":["useId","resolveFontStylesheets","createLocalFontStylesheetUrl","createFontPreloadFilename","createThemeVariables","createThemeCss","ThemeScopeProvider","ThemeComponentsProvider"],"sources":["../src/theme.tsx"],"sourcesContent":["import { useId, type PropsWithChildren } from \"react\";\n\nimport type { FontRole, FontConfig, FontSource } from \"./fonts\";\n\nimport type { ColorThemes, ThemeMode, ThemeTokenOverrides } from \"./types\";\n\nimport type { ThemeComponents } from \"./components.types\";\n\nimport { ThemeComponentsProvider } from \"./components-context\";\nimport { ThemeScopeProvider } from \"./scope-context\";\n\nimport { resolveFontStylesheets } from \"./fonts/resolve-font-stylesheets\";\nimport { createLocalFontStylesheetUrl } from \"./fonts/create-local-font-stylesheet-url\";\nimport { createFontPreloadFilename } from \"./fonts/create-font-preload-filename\";\n\nimport { createThemeVariables } from \"./create-theme-variables\";\nimport { createThemeCss } from \"./create-theme-css\";\n\nimport \"./theme.css\";\nimport \"./theme-scopes.css\";\nimport \"./global.css\";\n\nexport type ThemeScope = \"root\" | \"local\";\n\nexport type ThemeProps = {\n nonce?: string;\n theme?: ThemeMode;\n scope?: ThemeScope;\n globalStyles?: boolean;\n\n fonts?: Partial<Record<FontRole, FontConfig>> | Record<string, unknown>;\n\n /**\n * Determines how configured fonts are loaded.\n *\n * - google: Load stylesheets directly from Google Fonts (default).\n * - local: Load the generated stylesheet from the application's public directory.\n */\n fontSource?: FontSource;\n\n /**\n * Public URL directory containing puzzle-fonts.css.\n *\n * Defaults to \"/fonts\".\n */\n fontBasePath?: string;\n\n /**\n * Determines which local font is preloaded.\n *\n * - body: Preload the body font (default).\n * - heading: Preload the heading font.\n * - accent: Preload the accent font.\n * - false: Disable font preloading.\n *\n * Only applies when fontSource=\"local\".\n */\n fontPreload?: FontRole | false;\n\n tokens?: ThemeTokenOverrides;\n colorTheme?: ColorThemes;\n components?: ThemeComponents;\n};\n\nconst normalizeFontBasePath = (path: string): string => {\n return path.replace(/\\/+$/, \"\");\n};\n\nconst Theme = ({\n nonce,\n fonts,\n fontSource = \"google\",\n fontBasePath = \"/fonts\",\n fontPreload = \"body\",\n theme = \"system\",\n scope = \"root\",\n globalStyles,\n tokens,\n colorTheme,\n components,\n children,\n}: PropsWithChildren<ThemeProps>) => {\n const scopeId = useId();\n\n const fontStylesheets = resolveFontStylesheets(fonts);\n\n const localFontStylesheet =\n fontSource === \"local\" && fontStylesheets.length > 0\n ? createLocalFontStylesheetUrl(fontBasePath)\n : null;\n\n const preloadFont =\n fontPreload !== false\n ? (fonts?.[fontPreload] as FontConfig | undefined)\n : undefined;\n\n const normalizedFontBasePath = normalizeFontBasePath(fontBasePath);\n\n const fontPreloadHref =\n fontSource === \"local\" && preloadFont?.family\n ? `${normalizedFontBasePath}/${createFontPreloadFilename(preloadFont.family)}`\n : null;\n\n const cssVariables = createThemeVariables(fonts, tokens, theme, colorTheme);\n\n const cssSelector =\n scope === \"root\" ? \":root\" : `[data-puzzle-theme-scope=\"${scopeId}\"]`;\n\n const css = `${cssSelector} {\\n${createThemeCss(cssVariables)}\\n}`;\n\n const shouldApplyGlobalStyles = scope === \"root\" && (globalStyles ?? true);\n\n const content =\n components === undefined ? (\n children\n ) : (\n <ThemeComponentsProvider components={components}>\n {children}\n </ThemeComponentsProvider>\n );\n\n const scopedContent = (\n <ThemeScopeProvider\n scopeId={scope === \"local\" ? scopeId : null}\n theme={theme}\n >\n {content}\n </ThemeScopeProvider>\n );\n\n const usesGoogleFonts = fontSource === \"google\" && fontStylesheets.length > 0;\n\n return (\n <>\n {fontPreloadHref ? (\n <link\n rel=\"preload\"\n href={fontPreloadHref}\n as=\"font\"\n type=\"font/woff2\"\n crossOrigin=\"anonymous\"\n />\n ) : null}\n\n {usesGoogleFonts ? (\n <>\n <link rel=\"preconnect\" href=\"https://fonts.googleapis.com\" />\n\n <link\n rel=\"preconnect\"\n href=\"https://fonts.gstatic.com\"\n crossOrigin=\"anonymous\"\n />\n </>\n ) : null}\n\n {fontSource === \"google\"\n ? fontStylesheets.map(({ href }) => (\n <link\n key={href}\n rel=\"stylesheet\"\n href={href}\n precedence=\"default\"\n />\n ))\n : null}\n\n {localFontStylesheet ? (\n <link\n key={localFontStylesheet}\n rel=\"stylesheet\"\n href={localFontStylesheet}\n precedence=\"default\"\n />\n ) : null}\n\n {shouldApplyGlobalStyles ? (\n <style nonce={nonce} data-puzzle-global-styles=\"\" />\n ) : null}\n\n <style\n nonce={nonce}\n data-theme={theme}\n data-puzzle-theme={scope === \"root\" ? \"true\" : undefined}\n data-puzzle-theme-scope-style={scope === \"local\" ? scopeId : undefined}\n >\n {css}\n </style>\n\n {scopedContent}\n </>\n );\n};\n\nexport { Theme };\n"],"mappings":";;;;;;;;;;;;;AAgEA,MAAM,yBAAyB,SAAyB;CACtD,OAAO,KAAK,QAAQ,QAAQ,EAAE;AAChC;AAEA,MAAM,SAAS,EACb,OACA,OACA,aAAa,UACb,eAAe,UACf,cAAc,QACd,QAAQ,UACR,QAAQ,QACR,cACA,QACA,YACA,YACA,eACmC;CACnC,MAAM,WAAA,GAAUA,MAAAA,MAAAA,CAAM;CAEtB,MAAM,kBAAkBC,iCAAAA,uBAAuB,KAAK;CAEpD,MAAM,sBACJ,eAAe,WAAW,gBAAgB,SAAS,IAC/CC,yCAAAA,6BAA6B,YAAY,IACzC;CAEN,MAAM,cACJ,gBAAgB,QACX,QAAQ,eACT,KAAA;CAEN,MAAM,yBAAyB,sBAAsB,YAAY;CAEjE,MAAM,kBACJ,eAAe,WAAW,aAAa,SACnC,GAAG,uBAAuB,GAAGC,qCAAAA,0BAA0B,YAAY,MAAM,MACzE;CAEN,MAAM,eAAeC,+BAAAA,qBAAqB,OAAO,QAAQ,OAAO,UAAU;CAK1E,MAAM,MAAM,GAFV,UAAU,SAAS,UAAU,6BAA6B,QAAQ,IAEzC,MAAMC,yBAAAA,eAAe,YAAY,EAAE;CAE9D,MAAM,0BAA0B,UAAU,WAAW,gBAAgB;CAWrE,MAAM,gBACJ,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,oBAAD;EACE,SAAS,UAAU,UAAU,UAAU;EAChC;EAXT,UAAA,eAAe,KAAA,IACb,WAEA,iBAAA,GAAA,kBAAA,IAAA,CAACC,2BAAAA,yBAAD;GAAqC;GAClC;EACsB,CAAA;CASP,CAAA;CAGtB,MAAM,kBAAkB,eAAe,YAAY,gBAAgB,SAAS;CAE5E,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA;EACG,kBACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;GACE,KAAI;GACJ,MAAM;GACN,IAAG;GACH,MAAK;GACL,aAAY;EACb,CAAA,IACC;EAEH,kBACC,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;GAAM,KAAI;GAAa,MAAK;EAAgC,CAAA,GAE5D,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;GACE,KAAI;GACJ,MAAK;GACL,aAAY;EACb,CAAA,CACD,EAAA,CAAA,IACA;EAEH,eAAe,WACZ,gBAAgB,KAAK,EAAE,WACrB,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;GAEE,KAAI;GACE;GACN,YAAW;EACZ,GAJM,IAIN,CACF,IACD;EAEH,sBACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;GAEE,KAAI;GACJ,MAAM;GACN,YAAW;EACZ,GAJM,mBAIN,IACC;EAEH,0BACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,SAAD;GAAc;GAAO,6BAA0B;EAAI,CAAA,IACjD;EAEJ,iBAAA,GAAA,kBAAA,IAAA,CAAC,SAAD;GACS;GACP,cAAY;GACZ,qBAAmB,UAAU,SAAS,SAAS,KAAA;GAC/C,iCAA+B,UAAU,UAAU,UAAU,KAAA;GAE5D,UAAA;EACI,CAAA;EAEN;CACD,EAAA,CAAA;AAEN"}
|