@tenphi/renderer 0.19.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/LICENSE +21 -0
- package/README.md +23 -0
- package/dist/client/appearance.d.ts +12 -0
- package/dist/client/appearance.d.ts.map +1 -0
- package/dist/client/appearance.js +66 -0
- package/dist/client/appearance.js.map +1 -0
- package/dist/client/code-copy.d.ts +1 -0
- package/dist/client/code-copy.js +63 -0
- package/dist/client/code-copy.js.map +1 -0
- package/dist/client/heading-links.d.ts +6 -0
- package/dist/client/heading-links.d.ts.map +1 -0
- package/dist/client/heading-links.js +87 -0
- package/dist/client/heading-links.js.map +1 -0
- package/dist/client/mobile-toc.d.ts +1 -0
- package/dist/client/mobile-toc.js +28 -0
- package/dist/client/mobile-toc.js.map +1 -0
- package/dist/client/navigation.d.ts +1 -0
- package/dist/client/navigation.js +112 -0
- package/dist/client/navigation.js.map +1 -0
- package/dist/client/page-copy.d.ts +1 -0
- package/dist/client/page-copy.js +34 -0
- package/dist/client/page-copy.js.map +1 -0
- package/dist/client/search.d.ts +13 -0
- package/dist/client/search.d.ts.map +1 -0
- package/dist/client/search.js +87 -0
- package/dist/client/search.js.map +1 -0
- package/dist/client/sidebar.d.ts +1 -0
- package/dist/client/sidebar.js +93 -0
- package/dist/client/sidebar.js.map +1 -0
- package/dist/client/tabs.d.ts +6 -0
- package/dist/client/tabs.d.ts.map +1 -0
- package/dist/client/tabs.js +64 -0
- package/dist/client/tabs.js.map +1 -0
- package/dist/components/Callout.astro +15 -0
- package/dist/components/Card.astro +13 -0
- package/dist/components/CodeGroup.astro +47 -0
- package/dist/components/ContrastIcon.astro +29 -0
- package/dist/components/EditLink.astro +11 -0
- package/dist/components/GlobalStyles.js +1675 -0
- package/dist/components/HeaderLinks.astro +84 -0
- package/dist/components/Icon.astro +39 -0
- package/dist/components/LastUpdated.astro +17 -0
- package/dist/components/LayoutComponents.js +866 -0
- package/dist/components/Logo.astro +37 -0
- package/dist/components/MobileNavigationTabs.astro +79 -0
- package/dist/components/MobileTocList.astro +22 -0
- package/dist/components/PackageVersion.astro +25 -0
- package/dist/components/PageActions.astro +29 -0
- package/dist/components/Pagination.astro +29 -0
- package/dist/components/Preview.astro +34 -0
- package/dist/components/SidebarList.astro +122 -0
- package/dist/components/SiteLogo.astro +40 -0
- package/dist/components/SiteTitle.astro +7 -0
- package/dist/components/Steps.astro +6 -0
- package/dist/components/Tab.astro +10 -0
- package/dist/components/TableOfContents.astro +23 -0
- package/dist/components/Tabs.astro +16 -0
- package/dist/components/TastyComponents.js +255 -0
- package/dist/components/VersionSwitcher.astro +44 -0
- package/dist/components/appearance-preferences.test.ts +91 -0
- package/dist/components/appearance-preferences.ts +57 -0
- package/dist/components/component-styles.test.ts +129 -0
- package/dist/components/component-styles.ts +65 -0
- package/dist/components/customize-component.js +8 -0
- package/dist/components/props.d.ts +38 -0
- package/dist/components/props.d.ts.map +1 -0
- package/dist/components/props.js +1 -0
- package/dist/components/props.ts +30 -0
- package/dist/components/svg-icon.test.ts +11 -0
- package/dist/components/svg-icon.ts +11 -0
- package/dist/components/tasty-states.d.ts +2 -0
- package/dist/components/tasty-states.js +42 -0
- package/dist/components-public.d.ts +21 -0
- package/dist/components.d.ts +10 -0
- package/dist/components.js +9 -0
- package/dist/content.d.ts +11 -0
- package/dist/content.d.ts.map +1 -0
- package/dist/content.js +16 -0
- package/dist/content.js.map +1 -0
- package/dist/eslint-plugin.d.ts +32 -0
- package/dist/eslint-plugin.d.ts.map +1 -0
- package/dist/eslint-plugin.js +155 -0
- package/dist/eslint-plugin.js.map +1 -0
- package/dist/icons/arrow-left.svg +1 -0
- package/dist/icons/arrow-right.svg +1 -0
- package/dist/icons/check.svg +1 -0
- package/dist/icons/chevron-down.svg +1 -0
- package/dist/icons/chevron-right.svg +1 -0
- package/dist/icons/close.svg +1 -0
- package/dist/icons/copy.svg +1 -0
- package/dist/icons/device-desktop.svg +1 -0
- package/dist/icons/favicon.svg +11 -0
- package/dist/icons/menu.svg +1 -0
- package/dist/icons/moon.svg +1 -0
- package/dist/icons/palette.svg +1 -0
- package/dist/icons/search.svg +1 -0
- package/dist/icons/sun.svg +1 -0
- package/dist/index-BuX_Sb5c.d.ts +10 -0
- package/dist/index-BuX_Sb5c.d.ts.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1648 -0
- package/dist/index.js.map +1 -0
- package/dist/localization.d.ts +69 -0
- package/dist/localization.d.ts.map +1 -0
- package/dist/localization.js +195 -0
- package/dist/localization.js.map +1 -0
- package/dist/markdown/rendered-content.d.ts +6 -0
- package/dist/markdown/rendered-content.d.ts.map +1 -0
- package/dist/markdown/rendered-content.js +34 -0
- package/dist/markdown/rendered-content.js.map +1 -0
- package/dist/messages-B_3xUzUb.js +14 -0
- package/dist/messages-B_3xUzUb.js.map +1 -0
- package/dist/navigation.d.ts +31 -0
- package/dist/navigation.d.ts.map +1 -0
- package/dist/navigation.js +165 -0
- package/dist/navigation.js.map +1 -0
- package/dist/overrides/DraftContentNotice.astro +8 -0
- package/dist/overrides/EmptyFooter.astro +3 -0
- package/dist/overrides/Footer.astro +23 -0
- package/dist/overrides/Head.astro +59 -0
- package/dist/overrides/Header.astro +139 -0
- package/dist/overrides/Hero.astro +73 -0
- package/dist/overrides/LanguageSelect.astro +63 -0
- package/dist/overrides/MarkdownContent.astro +14 -0
- package/dist/overrides/MobileMenuFooter.astro +15 -0
- package/dist/overrides/MobileMenuToggle.astro +36 -0
- package/dist/overrides/MobileTableOfContents.astro +37 -0
- package/dist/overrides/PageFrame.astro +35 -0
- package/dist/overrides/Search.astro +64 -0
- package/dist/overrides/Sidebar.astro +89 -0
- package/dist/overrides/SocialIcons.astro +27 -0
- package/dist/overrides/ThemeSelect.astro +148 -0
- package/dist/page-metadata.d.ts +13 -0
- package/dist/page-metadata.d.ts.map +1 -0
- package/dist/page-metadata.js +109 -0
- package/dist/page-metadata.js.map +1 -0
- package/dist/route-context.d.ts +85 -0
- package/dist/route-context.d.ts.map +1 -0
- package/dist/route-context.js +116 -0
- package/dist/route-context.js.map +1 -0
- package/dist/routes/DocsPage.astro +91 -0
- package/dist/routes/NotFound.astro +12 -0
- package/dist/routes/Page.astro +120 -0
- package/dist/styling.d.ts +17 -0
- package/dist/styling.d.ts.map +1 -0
- package/dist/styling.js +17 -0
- package/dist/styling.js.map +1 -0
- package/dist/tasty-states-BDKIbfw2.js +65 -0
- package/dist/tasty-states-BDKIbfw2.js.map +1 -0
- package/dist/theme/defaults.d.ts +21 -0
- package/dist/theme/defaults.d.ts.map +1 -0
- package/dist/theme/defaults.js +93 -0
- package/dist/theme/defaults.js.map +1 -0
- package/dist/theme/fonts.ts +64 -0
- package/dist/theme/shiki-theme.d.ts +13 -0
- package/dist/theme/shiki-theme.d.ts.map +1 -0
- package/dist/theme/shiki-theme.js +328 -0
- package/dist/theme/shiki-theme.js.map +1 -0
- package/dist/theme/tasty-config.d.ts +13 -0
- package/dist/theme/tasty-config.d.ts.map +1 -0
- package/dist/theme/tasty-config.js +16 -0
- package/dist/theme/tasty-config.js.map +1 -0
- package/dist/ui.d.ts +6 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +53 -0
- package/dist/ui.js.map +1 -0
- package/dist/versioning.d.ts +11 -0
- package/dist/versioning.d.ts.map +1 -0
- package/dist/versioning.js +38 -0
- package/dist/versioning.js.map +1 -0
- package/package.json +92 -0
- package/tasty.config.mjs +1 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { resolveTypographyPresets } from "./theme/defaults.js";
|
|
2
|
+
import { TASTY_UNITS } from "./theme/tasty-config.js";
|
|
3
|
+
import { COOKBOOK_COMPONENT_NAMES } from "@tenphi/docs";
|
|
4
|
+
import { mergeStyles } from "@tenphi/tasty/core";
|
|
5
|
+
import { configure as configure$1, getGlobalPredefinedStates } from "@tenphi/tasty";
|
|
6
|
+
//#region src/components/component-styles.ts
|
|
7
|
+
const sharedConfiguration = globalThis;
|
|
8
|
+
const cookbookComponentNames = new Set(COOKBOOK_COMPONENT_NAMES);
|
|
9
|
+
function configureComponentStyles(styles) {
|
|
10
|
+
sharedConfiguration.__tenphiCookbookComponentStyles = styles ?? {};
|
|
11
|
+
sharedConfiguration.__tenphiCookbookUsedComponentStyles = /* @__PURE__ */ new Set();
|
|
12
|
+
}
|
|
13
|
+
/** Merge a partial theme override into a built-in or consumer style tree. */
|
|
14
|
+
function resolveComponentStyles(name, baseStyles) {
|
|
15
|
+
sharedConfiguration.__tenphiCookbookUsedComponentStyles?.add(name);
|
|
16
|
+
const configuredStyles = sharedConfiguration.__tenphiCookbookComponentStyles?.[name];
|
|
17
|
+
return configuredStyles ? mergeStyles(baseStyles, configuredStyles) : baseStyles;
|
|
18
|
+
}
|
|
19
|
+
/** Find custom names without a component style resolver or rendered anatomy. */
|
|
20
|
+
function unusedCustomStyleNames(styles, anatomyNames) {
|
|
21
|
+
return Object.keys(styles ?? {}).filter((name) => !sharedConfiguration.__tenphiCookbookUsedComponentStyles?.has(name) && !anatomyNames.has(name));
|
|
22
|
+
}
|
|
23
|
+
/** Preserve custom anatomy names from the pre-component style API. */
|
|
24
|
+
function resolveLegacyAnatomyStyles(styles) {
|
|
25
|
+
if (!styles) return void 0;
|
|
26
|
+
const entries = Object.entries(styles).filter((entry) => !cookbookComponentNames.has(entry[0]) && entry[1] !== void 0).map(([name, value]) => [`[data-tasty-anatomy="${name}"]`, value]);
|
|
27
|
+
return entries.length ? Object.fromEntries(entries) : void 0;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/components/tasty-states.js
|
|
31
|
+
const cookbookStates = {
|
|
32
|
+
"@mobile": "@media(w < 50rem)",
|
|
33
|
+
"@desktop": "@media(w >= 50rem)",
|
|
34
|
+
"@small": "@media(w <= 40rem)",
|
|
35
|
+
"@compact": "@media(w <= 23rem)",
|
|
36
|
+
"@shell-mobile": "@media(w <= 48rem)",
|
|
37
|
+
"@shell-desktop": "@media(w > 48rem)",
|
|
38
|
+
"@narrow-layout": "@media(w < 72rem)",
|
|
39
|
+
"@medium-layout": "@media(w >= 50rem) & @media(w < 72rem)",
|
|
40
|
+
"@reduced-motion": "@media(prefers-reduced-motion: reduce)"
|
|
41
|
+
};
|
|
42
|
+
let configured = false;
|
|
43
|
+
let configuredRuntime;
|
|
44
|
+
/** Configure aliases in the renderer's Tasty module before styles are parsed. */
|
|
45
|
+
function configureCookbookStates() {
|
|
46
|
+
const runtime = globalThis.__tenphiCookbookTastyRuntime;
|
|
47
|
+
if (configured && configuredRuntime === runtime) return;
|
|
48
|
+
configure$1({
|
|
49
|
+
presets: resolveTypographyPresets(),
|
|
50
|
+
...runtime,
|
|
51
|
+
units: {
|
|
52
|
+
...TASTY_UNITS,
|
|
53
|
+
...runtime?.units
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
configuredRuntime = runtime;
|
|
57
|
+
const existingStates = getGlobalPredefinedStates();
|
|
58
|
+
const missingStates = Object.fromEntries(Object.entries(cookbookStates).filter(([name]) => existingStates[name] === void 0));
|
|
59
|
+
if (Object.keys(missingStates).length) configure$1({ states: missingStates });
|
|
60
|
+
configured = true;
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
export { resolveLegacyAnatomyStyles as a, resolveComponentStyles as i, cookbookStates as n, unusedCustomStyleNames as o, configureComponentStyles as r, configureCookbookStates as t };
|
|
64
|
+
|
|
65
|
+
//# sourceMappingURL=tasty-states-BDKIbfw2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasty-states-BDKIbfw2.js","names":[],"sources":["../src/components/component-styles.ts","../src/components/tasty-states.js"],"sourcesContent":["import { mergeStyles, type Styles } from \"@tenphi/tasty/core\";\nimport { COOKBOOK_COMPONENT_NAMES } from \"@tenphi/docs\";\n\n// Astro can load the integration and renderer through separate module graphs.\n// Keep their component configuration on the shared process global.\nconst sharedConfiguration = globalThis as typeof globalThis & {\n __tenphiCookbookComponentStyles?: Record<string, Styles | undefined>;\n __tenphiCookbookUsedComponentStyles?: Set<string>;\n};\nconst cookbookComponentNames = new Set<string>(COOKBOOK_COMPONENT_NAMES);\n\nexport function configureComponentStyles(\n styles: Record<string, Styles | undefined> | undefined,\n): void {\n sharedConfiguration.__tenphiCookbookComponentStyles = styles ?? {};\n sharedConfiguration.__tenphiCookbookUsedComponentStyles = new Set();\n}\n\n/** Merge a partial theme override into a built-in or consumer style tree. */\nexport function resolveComponentStyles(\n name: string,\n baseStyles: Styles,\n): Styles {\n sharedConfiguration.__tenphiCookbookUsedComponentStyles?.add(name);\n const configuredStyles = sharedConfiguration\n .__tenphiCookbookComponentStyles?.[name] as Styles | undefined;\n return configuredStyles\n ? mergeStyles(baseStyles, configuredStyles as Styles)\n : baseStyles;\n}\n\n/** Find custom names without a component style resolver or rendered anatomy. */\nexport function unusedCustomStyleNames(\n styles: Record<string, Styles> | undefined,\n anatomyNames: ReadonlySet<string>,\n): string[] {\n return Object.keys(styles ?? {}).filter(\n (name) =>\n !sharedConfiguration.__tenphiCookbookUsedComponentStyles?.has(name) &&\n !anatomyNames.has(name),\n );\n}\n\nexport function resolveComponentStyleOverride(\n name: string,\n): Styles | undefined {\n return sharedConfiguration.__tenphiCookbookComponentStyles?.[name] as\n Styles | undefined;\n}\n\n/** Preserve custom anatomy names from the pre-component style API. */\nexport function resolveLegacyAnatomyStyles(\n styles: Record<string, Styles | undefined> | undefined,\n): Record<string, Styles> | undefined {\n if (!styles) return undefined;\n const entries = Object.entries(styles)\n .filter(\n (entry): entry is [string, Styles] =>\n !cookbookComponentNames.has(entry[0]) && entry[1] !== undefined,\n )\n .map(([name, value]) => [`[data-tasty-anatomy=\"${name}\"]`, value]);\n return entries.length\n ? (Object.fromEntries(entries) as Record<string, Styles>)\n : undefined;\n}\n","import { configure, getGlobalPredefinedStates } from \"@tenphi/tasty\";\nimport { resolveTypographyPresets } from \"../theme/defaults.js\";\nimport { TASTY_UNITS } from \"../theme/tasty-config.js\";\n\nexport const cookbookStates = {\n \"@mobile\": \"@media(w < 50rem)\",\n \"@desktop\": \"@media(w >= 50rem)\",\n \"@small\": \"@media(w <= 40rem)\",\n \"@compact\": \"@media(w <= 23rem)\",\n \"@shell-mobile\": \"@media(w <= 48rem)\",\n \"@shell-desktop\": \"@media(w > 48rem)\",\n \"@narrow-layout\": \"@media(w < 72rem)\",\n \"@medium-layout\": \"@media(w >= 50rem) & @media(w < 72rem)\",\n \"@reduced-motion\": \"@media(prefers-reduced-motion: reduce)\",\n};\n\nlet configured = false;\nlet configuredRuntime;\n\n/** Configure aliases in the renderer's Tasty module before styles are parsed. */\nexport function configureCookbookStates() {\n // Process-local server configuration shared across Astro/Vite module graphs.\n // The integration prevents this module from entering browser bundles.\n const runtime = globalThis.__tenphiCookbookTastyRuntime;\n if (configured && configuredRuntime === runtime) return;\n configure({\n presets: resolveTypographyPresets(),\n ...runtime,\n units: { ...TASTY_UNITS, ...runtime?.units },\n });\n configuredRuntime = runtime;\n // The integration may have configured this runtime already, including\n // consumer overrides of built-in breakpoints. Only supply missing aliases.\n const existingStates = getGlobalPredefinedStates();\n const missingStates = Object.fromEntries(\n Object.entries(cookbookStates).filter(\n ([name]) => existingStates[name] === undefined,\n ),\n );\n if (Object.keys(missingStates).length) configure({ states: missingStates });\n configured = true;\n}\n"],"mappings":";;;;;;AAKA,MAAM,sBAAsB;AAI5B,MAAM,yBAAyB,IAAI,IAAY,wBAAwB;AAEvE,SAAgB,yBACd,QACM;CACN,oBAAoB,kCAAkC,UAAU,CAAC;CACjE,oBAAoB,sDAAsC,IAAI,IAAI;AACpE;;AAGA,SAAgB,uBACd,MACA,YACQ;CACR,oBAAoB,qCAAqC,IAAI,IAAI;CACjE,MAAM,mBAAmB,oBACtB,kCAAkC;CACrC,OAAO,mBACH,YAAY,YAAY,gBAA0B,IAClD;AACN;;AAGA,SAAgB,uBACd,QACA,cACU;CACV,OAAO,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,QAC9B,SACC,CAAC,oBAAoB,qCAAqC,IAAI,IAAI,KAClE,CAAC,aAAa,IAAI,IAAI,CAC1B;AACF;;AAUA,SAAgB,2BACd,QACoC;CACpC,IAAI,CAAC,QAAQ,OAAO,KAAA;CACpB,MAAM,UAAU,OAAO,QAAQ,MAAM,CAAC,CACnC,QACE,UACC,CAAC,uBAAuB,IAAI,MAAM,EAAE,KAAK,MAAM,OAAO,KAAA,CAC1D,CAAC,CACA,KAAK,CAAC,MAAM,WAAW,CAAC,wBAAwB,KAAK,KAAK,KAAK,CAAC;CACnE,OAAO,QAAQ,SACV,OAAO,YAAY,OAAO,IAC3B,KAAA;AACN;;;AC5DA,MAAa,iBAAiB;CAC5B,WAAW;CACX,YAAY;CACZ,UAAU;CACV,YAAY;CACZ,iBAAiB;CACjB,kBAAkB;CAClB,kBAAkB;CAClB,kBAAkB;CAClB,mBAAmB;AACrB;AAEA,IAAI,aAAa;AACjB,IAAI;;AAGJ,SAAgB,0BAA0B;CAGxC,MAAM,UAAU,WAAW;CAC3B,IAAI,cAAc,sBAAsB,SAAS;CACjD,YAAU;EACR,SAAS,yBAAyB;EAClC,GAAG;EACH,OAAO;GAAE,GAAG;GAAa,GAAG,SAAS;EAAM;CAC7C,CAAC;CACD,oBAAoB;CAGpB,MAAM,iBAAiB,0BAA0B;CACjD,MAAM,gBAAgB,OAAO,YAC3B,OAAO,QAAQ,cAAc,CAAC,CAAC,QAC5B,CAAC,UAAU,eAAe,UAAU,KAAA,CACvC,CACF;CACA,IAAI,OAAO,KAAK,aAAa,CAAC,CAAC,QAAQ,YAAU,EAAE,QAAQ,cAAc,CAAC;CAC1E,aAAa;AACf"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ThemeTokens, TypographyPreset, TypographyPresets } from "@tenphi/docs";
|
|
2
|
+
//#region src/theme/defaults.d.ts
|
|
3
|
+
declare const DEFAULT_THEME_TOKENS: {
|
|
4
|
+
$gap: string;
|
|
5
|
+
$radius: string;
|
|
6
|
+
"$header-control-radius": string;
|
|
7
|
+
"$card-radius": string;
|
|
8
|
+
"$border-width": string;
|
|
9
|
+
"$outline-width": string;
|
|
10
|
+
"$outline-offset": string;
|
|
11
|
+
"$layout-width": string;
|
|
12
|
+
"$content-width": string;
|
|
13
|
+
"$sidebar-width": string;
|
|
14
|
+
"$control-height": string;
|
|
15
|
+
};
|
|
16
|
+
declare const DEFAULT_TYPOGRAPHY_PRESETS: Record<string, TypographyPreset>;
|
|
17
|
+
declare function resolveThemeTokens(tokens?: ThemeTokens): ThemeTokens;
|
|
18
|
+
declare function resolveTypographyPresets(presets?: TypographyPresets, fontFamilies?: Partial<Record<"body" | "heading" | "code", string>>): Record<string, TypographyPreset>;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { DEFAULT_THEME_TOKENS, DEFAULT_TYPOGRAPHY_PRESETS, resolveThemeTokens, resolveTypographyPresets };
|
|
21
|
+
//# sourceMappingURL=defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","names":[],"sources":["../../src/theme/defaults.ts"],"mappings":";;cAMa;;;;;;;;;;;;;cAmBA,4BAA4B,eAAe;iBAiDxC,mBAAmB,SAAQ,cAAmB;iBAI9C,yBACd,UAAS,mBACT,eAAc,QAAQ,+CACrB,eAAe"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
//#region src/theme/defaults.ts
|
|
2
|
+
const DEFAULT_THEME_TOKENS = {
|
|
3
|
+
$gap: "0.5rem",
|
|
4
|
+
$radius: "8px",
|
|
5
|
+
"$header-control-radius": "999px",
|
|
6
|
+
"$card-radius": "16px",
|
|
7
|
+
"$border-width": "1px",
|
|
8
|
+
"$outline-width": "2px",
|
|
9
|
+
"$outline-offset": "2px",
|
|
10
|
+
"$layout-width": "87.5rem",
|
|
11
|
+
"$content-width": "58rem",
|
|
12
|
+
"$sidebar-width": "17.5rem",
|
|
13
|
+
"$control-height": "2.5rem"
|
|
14
|
+
};
|
|
15
|
+
const BODY_FONT = "'Onest Variable', Onest, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif";
|
|
16
|
+
const DEFAULT_TYPOGRAPHY_PRESETS = {
|
|
17
|
+
body: {
|
|
18
|
+
fontFamily: BODY_FONT,
|
|
19
|
+
fontSize: "1rem",
|
|
20
|
+
lineHeight: 1.65,
|
|
21
|
+
letterSpacing: "0",
|
|
22
|
+
fontWeight: 400,
|
|
23
|
+
boldFontWeight: 640
|
|
24
|
+
},
|
|
25
|
+
heading: {
|
|
26
|
+
fontFamily: BODY_FONT,
|
|
27
|
+
fontSize: "1rem",
|
|
28
|
+
lineHeight: 1.15,
|
|
29
|
+
letterSpacing: "-0.006em",
|
|
30
|
+
fontWeight: 610,
|
|
31
|
+
boldFontWeight: 720
|
|
32
|
+
},
|
|
33
|
+
h1: heading("clamp(2.5rem, 5vw, 3.25rem)", 1.05, "-0.015em"),
|
|
34
|
+
h2: heading("clamp(1.75rem, 3vw, 2.125rem)", 1.1, "-0.01em"),
|
|
35
|
+
h3: heading("1.5rem", 1.15, "-0.006em"),
|
|
36
|
+
h4: heading("1.25rem", 1.2, "-0.003em"),
|
|
37
|
+
h5: heading("1.125rem", 1.25, "0"),
|
|
38
|
+
h6: heading("1rem", 1.3, "0"),
|
|
39
|
+
navigation: {
|
|
40
|
+
fontFamily: "var(--body-font-family)",
|
|
41
|
+
fontSize: "0.9375rem",
|
|
42
|
+
lineHeight: 1.4,
|
|
43
|
+
letterSpacing: "0",
|
|
44
|
+
fontWeight: 450,
|
|
45
|
+
boldFontWeight: 580
|
|
46
|
+
},
|
|
47
|
+
small: {
|
|
48
|
+
fontFamily: "var(--body-font-family)",
|
|
49
|
+
fontSize: "0.875rem",
|
|
50
|
+
lineHeight: 1.45,
|
|
51
|
+
letterSpacing: "-0.002em",
|
|
52
|
+
fontWeight: 420,
|
|
53
|
+
boldFontWeight: 600
|
|
54
|
+
},
|
|
55
|
+
code: {
|
|
56
|
+
fontFamily: "'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",
|
|
57
|
+
fontSize: "0.875rem",
|
|
58
|
+
lineHeight: 1.65,
|
|
59
|
+
letterSpacing: "0",
|
|
60
|
+
fontWeight: 400,
|
|
61
|
+
boldFontWeight: 650
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
function resolveThemeTokens(tokens = {}) {
|
|
65
|
+
return {
|
|
66
|
+
...DEFAULT_THEME_TOKENS,
|
|
67
|
+
...tokens
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function resolveTypographyPresets(presets = {}, fontFamilies = {}) {
|
|
71
|
+
const body = DEFAULT_TYPOGRAPHY_PRESETS.body;
|
|
72
|
+
if (!body) throw new Error("The body typography preset is required.");
|
|
73
|
+
const names = /* @__PURE__ */ new Set([...Object.keys(DEFAULT_TYPOGRAPHY_PRESETS), ...Object.keys(presets)]);
|
|
74
|
+
return Object.fromEntries([...names].map((name) => [name, {
|
|
75
|
+
...DEFAULT_TYPOGRAPHY_PRESETS[name] ?? body,
|
|
76
|
+
...name in fontFamilies ? { fontFamily: fontFamilies[name] } : {},
|
|
77
|
+
...presets[name] ?? {}
|
|
78
|
+
}]));
|
|
79
|
+
}
|
|
80
|
+
function heading(fontSize, lineHeight, letterSpacing) {
|
|
81
|
+
return {
|
|
82
|
+
fontFamily: "var(--heading-font-family)",
|
|
83
|
+
fontSize,
|
|
84
|
+
lineHeight,
|
|
85
|
+
letterSpacing,
|
|
86
|
+
fontWeight: "var(--heading-font-weight)",
|
|
87
|
+
boldFontWeight: "var(--heading-bold-font-weight)"
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
export { DEFAULT_THEME_TOKENS, DEFAULT_TYPOGRAPHY_PRESETS, resolveThemeTokens, resolveTypographyPresets };
|
|
92
|
+
|
|
93
|
+
//# sourceMappingURL=defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.js","names":[],"sources":["../../src/theme/defaults.ts"],"sourcesContent":["import type {\n ThemeTokens,\n TypographyPreset,\n TypographyPresets,\n} from \"@tenphi/docs\";\n\nexport const DEFAULT_THEME_TOKENS = {\n $gap: \"0.5rem\",\n $radius: \"8px\",\n \"$header-control-radius\": \"999px\",\n \"$card-radius\": \"16px\",\n \"$border-width\": \"1px\",\n \"$outline-width\": \"2px\",\n \"$outline-offset\": \"2px\",\n \"$layout-width\": \"87.5rem\",\n \"$content-width\": \"58rem\",\n \"$sidebar-width\": \"17.5rem\",\n \"$control-height\": \"2.5rem\",\n} satisfies ThemeTokens;\n\nconst BODY_FONT =\n \"'Onest Variable', Onest, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\";\nconst MONO_FONT =\n \"'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace\";\n\nexport const DEFAULT_TYPOGRAPHY_PRESETS: Record<string, TypographyPreset> = {\n body: {\n fontFamily: BODY_FONT,\n fontSize: \"1rem\",\n lineHeight: 1.65,\n letterSpacing: \"0\",\n fontWeight: 400,\n boldFontWeight: 640,\n },\n heading: {\n fontFamily: BODY_FONT,\n fontSize: \"1rem\",\n lineHeight: 1.15,\n letterSpacing: \"-0.006em\",\n fontWeight: 610,\n boldFontWeight: 720,\n },\n h1: heading(\"clamp(2.5rem, 5vw, 3.25rem)\", 1.05, \"-0.015em\"),\n h2: heading(\"clamp(1.75rem, 3vw, 2.125rem)\", 1.1, \"-0.01em\"),\n h3: heading(\"1.5rem\", 1.15, \"-0.006em\"),\n h4: heading(\"1.25rem\", 1.2, \"-0.003em\"),\n h5: heading(\"1.125rem\", 1.25, \"0\"),\n h6: heading(\"1rem\", 1.3, \"0\"),\n navigation: {\n fontFamily: \"var(--body-font-family)\",\n fontSize: \"0.9375rem\",\n lineHeight: 1.4,\n letterSpacing: \"0\",\n fontWeight: 450,\n boldFontWeight: 580,\n },\n small: {\n fontFamily: \"var(--body-font-family)\",\n fontSize: \"0.875rem\",\n lineHeight: 1.45,\n letterSpacing: \"-0.002em\",\n fontWeight: 420,\n boldFontWeight: 600,\n },\n code: {\n fontFamily: MONO_FONT,\n fontSize: \"0.875rem\",\n lineHeight: 1.65,\n letterSpacing: \"0\",\n fontWeight: 400,\n boldFontWeight: 650,\n },\n};\n\nexport function resolveThemeTokens(tokens: ThemeTokens = {}): ThemeTokens {\n return { ...DEFAULT_THEME_TOKENS, ...tokens };\n}\n\nexport function resolveTypographyPresets(\n presets: TypographyPresets = {},\n fontFamilies: Partial<Record<\"body\" | \"heading\" | \"code\", string>> = {},\n): Record<string, TypographyPreset> {\n const body = DEFAULT_TYPOGRAPHY_PRESETS.body;\n if (!body) throw new Error(\"The body typography preset is required.\");\n const names = new Set([\n ...Object.keys(DEFAULT_TYPOGRAPHY_PRESETS),\n ...Object.keys(presets),\n ]);\n return Object.fromEntries(\n [...names].map((name) => [\n name,\n {\n ...(DEFAULT_TYPOGRAPHY_PRESETS[name] ?? body),\n ...(name in fontFamilies\n ? { fontFamily: fontFamilies[name as keyof typeof fontFamilies] }\n : {}),\n ...(presets[name] ?? {}),\n },\n ]),\n );\n}\n\nfunction heading(\n fontSize: string,\n lineHeight: number,\n letterSpacing: string,\n): TypographyPreset {\n return {\n fontFamily: \"var(--heading-font-family)\",\n fontSize,\n lineHeight,\n letterSpacing,\n fontWeight: \"var(--heading-font-weight)\",\n boldFontWeight: \"var(--heading-bold-font-weight)\",\n };\n}\n"],"mappings":";AAMA,MAAa,uBAAuB;CAClC,MAAM;CACN,SAAS;CACT,0BAA0B;CAC1B,gBAAgB;CAChB,iBAAiB;CACjB,kBAAkB;CAClB,mBAAmB;CACnB,iBAAiB;CACjB,kBAAkB;CAClB,kBAAkB;CAClB,mBAAmB;AACrB;AAEA,MAAM,YACJ;AAIF,MAAa,6BAA+D;CAC1E,MAAM;EACJ,YAAY;EACZ,UAAU;EACV,YAAY;EACZ,eAAe;EACf,YAAY;EACZ,gBAA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YAAY;EACZ,gBAAgB;CAClB;AACF"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { FontLoadingConfig, ThemeFont, ThemeFonts } from "@tenphi/docs";
|
|
2
|
+
import type { FontFaceDescriptors } from "@tenphi/tasty/core";
|
|
3
|
+
|
|
4
|
+
export interface ResolvedFontFace {
|
|
5
|
+
family: string;
|
|
6
|
+
descriptors: FontFaceDescriptors;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const sharedFonts = globalThis as typeof globalThis & {
|
|
10
|
+
__tenphiCookbookFontFaces?: ResolvedFontFace[];
|
|
11
|
+
__tenphiCookbookDefaultFontUsage?: {
|
|
12
|
+
onest: boolean;
|
|
13
|
+
mono: boolean;
|
|
14
|
+
display?: FontLoadingConfig["display"];
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const fallback = {
|
|
19
|
+
body: "system-ui, sans-serif",
|
|
20
|
+
heading: "system-ui, sans-serif",
|
|
21
|
+
code: "ui-monospace, monospace",
|
|
22
|
+
} as const;
|
|
23
|
+
|
|
24
|
+
export function fontFamilies(
|
|
25
|
+
fonts: ThemeFonts = {},
|
|
26
|
+
): Partial<Record<keyof ThemeFonts, string>> {
|
|
27
|
+
return Object.fromEntries(
|
|
28
|
+
(
|
|
29
|
+
Object.entries(fonts).filter(([, font]) => font !== undefined) as [
|
|
30
|
+
keyof ThemeFonts,
|
|
31
|
+
ThemeFont,
|
|
32
|
+
][]
|
|
33
|
+
).map(([role, font]) => [
|
|
34
|
+
role,
|
|
35
|
+
`'${typeof font === "string" ? font : "google" in font ? font.google : font.family}', ${fallback[role]}`,
|
|
36
|
+
]),
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function configureFontFaces(
|
|
41
|
+
faces: ResolvedFontFace[],
|
|
42
|
+
defaults: {
|
|
43
|
+
onest: boolean;
|
|
44
|
+
mono: boolean;
|
|
45
|
+
display?: FontLoadingConfig["display"];
|
|
46
|
+
},
|
|
47
|
+
): void {
|
|
48
|
+
sharedFonts.__tenphiCookbookFontFaces = faces;
|
|
49
|
+
sharedFonts.__tenphiCookbookDefaultFontUsage = defaults;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function getFontFaces(): ResolvedFontFace[] {
|
|
53
|
+
return sharedFonts.__tenphiCookbookFontFaces ?? [];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function getDefaultFontUsage(): {
|
|
57
|
+
onest: boolean;
|
|
58
|
+
mono: boolean;
|
|
59
|
+
display?: FontLoadingConfig["display"];
|
|
60
|
+
} {
|
|
61
|
+
return (
|
|
62
|
+
sharedFonts.__tenphiCookbookDefaultFontUsage ?? { onest: true, mono: true }
|
|
63
|
+
);
|
|
64
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/theme/shiki-theme.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Astro loads fenced-code grammars lazily. MDX embeds TSX, but loading MDX by
|
|
4
|
+
* itself leaves that embedded grammar unavailable and produces partially
|
|
5
|
+
* highlighted imports and JSX. Preload TSX while preserving consumer-supplied
|
|
6
|
+
* languages and transformers.
|
|
7
|
+
*/
|
|
8
|
+
declare function cookbookShikiConfig(config: Record<string, unknown> | undefined): Record<string, unknown>;
|
|
9
|
+
declare function configureCodeHighlighting(config: Record<string, unknown>): void;
|
|
10
|
+
declare function codeGroupHighlighting(): Record<string, unknown>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { codeGroupHighlighting, configureCodeHighlighting, cookbookShikiConfig };
|
|
13
|
+
//# sourceMappingURL=shiki-theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shiki-theme.d.ts","names":[],"sources":["../../src/theme/shiki-theme.ts"],"mappings":";;;;;;;iBA2KgB,oBACd,QAAQ,sCACP;iBAqNa,0BAA0B,QAAQ;iBAGlC,yBAAqB"}
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
//#region src/theme/shiki-theme.ts
|
|
2
|
+
const comment = "var(--syntax-comment-color)";
|
|
3
|
+
const punctuation = "var(--syntax-punctuation-color)";
|
|
4
|
+
const keyword = "var(--syntax-keyword-color)";
|
|
5
|
+
const string = "var(--syntax-string-color)";
|
|
6
|
+
const token = "var(--syntax-token-color)";
|
|
7
|
+
const property = "var(--syntax-property-color)";
|
|
8
|
+
const number = "var(--syntax-number-color)";
|
|
9
|
+
const func = "var(--syntax-function-color)";
|
|
10
|
+
const value = "var(--syntax-value-color)";
|
|
11
|
+
const operator = "var(--syntax-operator-color)";
|
|
12
|
+
const foreground = "var(--syntax-text-color)";
|
|
13
|
+
const background = "var(--syntax-bg-color)";
|
|
14
|
+
const inserted = "var(--green-text-color)";
|
|
15
|
+
const deleted = "var(--red-text-color)";
|
|
16
|
+
const shellLanguages = /* @__PURE__ */ new Set([
|
|
17
|
+
"bash",
|
|
18
|
+
"sh",
|
|
19
|
+
"shell",
|
|
20
|
+
"shellscript",
|
|
21
|
+
"zsh"
|
|
22
|
+
]);
|
|
23
|
+
const shellPlaceholder = /<[A-Za-z][A-Za-z0-9_-]*>/g;
|
|
24
|
+
/**
|
|
25
|
+
* Shell grammars interpret documentation placeholders such as `<plan-id>` as
|
|
26
|
+
* redirections and can split the final character into an unscoped token. Keep
|
|
27
|
+
* the placeholder name visually coherent while retaining the operator color
|
|
28
|
+
* on the angle brackets.
|
|
29
|
+
*/
|
|
30
|
+
const bashPlaceholderTransformer = {
|
|
31
|
+
name: "cookbook:bash-placeholders",
|
|
32
|
+
enforce: "post",
|
|
33
|
+
tokens(lines) {
|
|
34
|
+
if (!this.options.lang || !shellLanguages.has(this.options.lang)) return;
|
|
35
|
+
const ranges = [...this.source.matchAll(shellPlaceholder)].map((match) => ({
|
|
36
|
+
start: (match.index ?? 0) + 1,
|
|
37
|
+
end: (match.index ?? 0) + match[0].length - 1
|
|
38
|
+
}));
|
|
39
|
+
if (ranges.length === 0) return;
|
|
40
|
+
for (const line of lines) for (const highlighted of line) {
|
|
41
|
+
const start = highlighted.offset;
|
|
42
|
+
const end = start + highlighted.content.length;
|
|
43
|
+
if (ranges.some((range) => start < range.end && end > range.start)) highlighted.color = string;
|
|
44
|
+
}
|
|
45
|
+
return lines;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const syntaxColors = new Map([
|
|
49
|
+
comment,
|
|
50
|
+
punctuation,
|
|
51
|
+
keyword,
|
|
52
|
+
string,
|
|
53
|
+
token,
|
|
54
|
+
property,
|
|
55
|
+
number,
|
|
56
|
+
func,
|
|
57
|
+
value,
|
|
58
|
+
operator,
|
|
59
|
+
foreground,
|
|
60
|
+
background,
|
|
61
|
+
inserted,
|
|
62
|
+
deleted
|
|
63
|
+
].map((color) => [color, `td-${color.slice(6, -7)}`]));
|
|
64
|
+
/** Keep grammar classification in Shiki and all presentation in Tasty. */
|
|
65
|
+
const tastyClassesTransformer = {
|
|
66
|
+
name: "cookbook:tasty-classes",
|
|
67
|
+
enforce: "post",
|
|
68
|
+
root(root) {
|
|
69
|
+
const visit = (node) => {
|
|
70
|
+
const style = node.properties?.style;
|
|
71
|
+
if (typeof style === "string") {
|
|
72
|
+
for (const declaration of style.split(";")) {
|
|
73
|
+
if (!declaration.trim()) continue;
|
|
74
|
+
const separator = declaration.indexOf(":");
|
|
75
|
+
const key = declaration.slice(0, separator).trim();
|
|
76
|
+
const value = declaration.slice(separator + 1).trim();
|
|
77
|
+
let className;
|
|
78
|
+
if (key === "color") className = syntaxColors.get(value);
|
|
79
|
+
else if (key === "background-color" && value === background) className = "td-syntax-bg";
|
|
80
|
+
else if (key === "font-style" && value === "italic") className = "td-syntax-italic";
|
|
81
|
+
else if (key === "font-weight" && value === "bold") className = "td-syntax-strong";
|
|
82
|
+
else if (key === "text-decoration" && value === "underline") className = "td-syntax-underline";
|
|
83
|
+
else if (key === "overflow-x" && value === "auto") className = "td-syntax-scroll";
|
|
84
|
+
else if (key === "white-space" && value === "pre-wrap" || key === "word-wrap" && value === "break-word") className = "td-syntax-wrap";
|
|
85
|
+
else if (key === "user-select" && value === "none") className = "td-syntax-marker";
|
|
86
|
+
if (!className) throw new Error(`Unsupported Shiki style ${JSON.stringify(declaration)}. Use semantic classes and theme.styles.SyntaxHighlight for custom transformers.`);
|
|
87
|
+
this.addClassToHast(node, className);
|
|
88
|
+
}
|
|
89
|
+
delete node.properties.style;
|
|
90
|
+
}
|
|
91
|
+
node.children?.forEach(visit);
|
|
92
|
+
};
|
|
93
|
+
visit(root);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
const diffLanguages = /* @__PURE__ */ new Set(["diff", "patch"]);
|
|
97
|
+
/**
|
|
98
|
+
* The diff grammar colors individual tokens, but it does not expose a stable
|
|
99
|
+
* whole-line selector. Add semantic classes so insertions and deletions can
|
|
100
|
+
* receive subtle, full-width surfaces without hiding their +/- markers.
|
|
101
|
+
*/
|
|
102
|
+
const diffLineTransformer = {
|
|
103
|
+
name: "cookbook:diff-lines",
|
|
104
|
+
pre(element) {
|
|
105
|
+
if (this.options.lang && diffLanguages.has(this.options.lang)) this.addClassToHast(element, "td-diff");
|
|
106
|
+
},
|
|
107
|
+
line(element, lineNumber) {
|
|
108
|
+
if (!this.options.lang || !diffLanguages.has(this.options.lang)) return;
|
|
109
|
+
const line = this.source.split(/\r?\n/)[lineNumber - 1] ?? "";
|
|
110
|
+
if (line.startsWith("+") && !line.startsWith("+++")) this.addClassToHast(element, "td-diff-line--inserted");
|
|
111
|
+
else if (line.startsWith("-") && !line.startsWith("---")) this.addClassToHast(element, "td-diff-line--deleted");
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Astro loads fenced-code grammars lazily. MDX embeds TSX, but loading MDX by
|
|
116
|
+
* itself leaves that embedded grammar unavailable and produces partially
|
|
117
|
+
* highlighted imports and JSX. Preload TSX while preserving consumer-supplied
|
|
118
|
+
* languages and transformers.
|
|
119
|
+
*/
|
|
120
|
+
function cookbookShikiConfig(config) {
|
|
121
|
+
const languages = Array.isArray(config?.langs) ? [...config.langs] : [];
|
|
122
|
+
const transformers = Array.isArray(config?.transformers) ? [...config.transformers] : [];
|
|
123
|
+
const hasTsx = languages.some((language) => language === "tsx" || typeof language === "object" && language !== null && "name" in language && language.name === "tsx");
|
|
124
|
+
if (!transformers.includes(bashPlaceholderTransformer)) transformers.push(bashPlaceholderTransformer);
|
|
125
|
+
if (!transformers.includes(diffLineTransformer)) transformers.push(diffLineTransformer);
|
|
126
|
+
if (!transformers.includes(tastyClassesTransformer)) transformers.push(tastyClassesTransformer);
|
|
127
|
+
return {
|
|
128
|
+
...config,
|
|
129
|
+
langs: hasTsx ? languages : [...languages, "tsx"],
|
|
130
|
+
theme: tastyCodeTheme,
|
|
131
|
+
transformers
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Shiki performs the grammatical classification, while every emitted color
|
|
136
|
+
* remains a reference to a Glaze-generated token owned by Tasty.
|
|
137
|
+
*/
|
|
138
|
+
const tastyCodeTheme = {
|
|
139
|
+
name: "tasty-code",
|
|
140
|
+
type: "light",
|
|
141
|
+
fg: foreground,
|
|
142
|
+
bg: background,
|
|
143
|
+
colors: {
|
|
144
|
+
"editor.background": background,
|
|
145
|
+
"editor.foreground": foreground
|
|
146
|
+
},
|
|
147
|
+
settings: [
|
|
148
|
+
{
|
|
149
|
+
scope: [
|
|
150
|
+
"comment",
|
|
151
|
+
"comment.line",
|
|
152
|
+
"comment.block",
|
|
153
|
+
"punctuation.definition.comment"
|
|
154
|
+
],
|
|
155
|
+
settings: {
|
|
156
|
+
foreground: comment,
|
|
157
|
+
fontStyle: "italic"
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
scope: [
|
|
162
|
+
"keyword",
|
|
163
|
+
"keyword.control",
|
|
164
|
+
"keyword.other",
|
|
165
|
+
"storage.type",
|
|
166
|
+
"storage.modifier",
|
|
167
|
+
"keyword.control.at-rule.tasty",
|
|
168
|
+
"keyword.control.at-rule.media.tasty",
|
|
169
|
+
"keyword.control.at-rule.media-type.tasty",
|
|
170
|
+
"keyword.control.at-rule.starting.tasty",
|
|
171
|
+
"keyword.control.state-alias.tasty"
|
|
172
|
+
],
|
|
173
|
+
settings: { foreground: keyword }
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
scope: [
|
|
177
|
+
"string",
|
|
178
|
+
"string.quoted",
|
|
179
|
+
"string.template",
|
|
180
|
+
"string.quoted.attribute-value.tasty",
|
|
181
|
+
"string.unquoted.attribute-value.tasty"
|
|
182
|
+
],
|
|
183
|
+
settings: { foreground: string }
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
scope: [
|
|
187
|
+
"support.constant.color.tasty-token",
|
|
188
|
+
"support.constant.color.tasty-token.builtin",
|
|
189
|
+
"constant.other.color.tasty-token",
|
|
190
|
+
"constant.other.color.tasty",
|
|
191
|
+
"constant.other.color.hex",
|
|
192
|
+
"constant.other.color.rgb-value"
|
|
193
|
+
],
|
|
194
|
+
settings: { foreground: token }
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
scope: [
|
|
198
|
+
"constant.numeric",
|
|
199
|
+
"constant.numeric.tasty",
|
|
200
|
+
"constant.numeric.custom-unit.tasty",
|
|
201
|
+
"constant.numeric.css-with-unit",
|
|
202
|
+
"constant.numeric.bare.tasty",
|
|
203
|
+
"constant.numeric.css",
|
|
204
|
+
"constant.numeric.keyframe-step.tasty",
|
|
205
|
+
"constant.language.boolean.tasty"
|
|
206
|
+
],
|
|
207
|
+
settings: { foreground: number }
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
scope: [
|
|
211
|
+
"support.type.property-name.tasty",
|
|
212
|
+
"variable.other.constant.tasty",
|
|
213
|
+
"entity.other.attribute-name.tsx",
|
|
214
|
+
"entity.other.attribute-name.jsx"
|
|
215
|
+
],
|
|
216
|
+
settings: { foreground: property }
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
scope: ["variable", "variable.other"],
|
|
220
|
+
settings: { foreground }
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
scope: [
|
|
224
|
+
"entity.name.function",
|
|
225
|
+
"support.function",
|
|
226
|
+
"support.function.misc.css",
|
|
227
|
+
"entity.name.tag",
|
|
228
|
+
"entity.name.tag.tsx",
|
|
229
|
+
"support.class.component",
|
|
230
|
+
"entity.name.type.tasty",
|
|
231
|
+
"entity.name.tag.tasty"
|
|
232
|
+
],
|
|
233
|
+
settings: { foreground: func }
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
scope: [
|
|
237
|
+
"support.constant.property-value.tasty",
|
|
238
|
+
"support.constant.property-value.tasty-display",
|
|
239
|
+
"support.constant.property-value.tasty-directional",
|
|
240
|
+
"support.constant.property-value.tasty-preset",
|
|
241
|
+
"support.constant.property-value.tasty-shape",
|
|
242
|
+
"support.constant.property-value.tasty-scrollbar",
|
|
243
|
+
"support.constant.property-value.tasty-state",
|
|
244
|
+
"support.constant.property-value.tasty-cursor",
|
|
245
|
+
"support.constant.property-value.tasty-overflow",
|
|
246
|
+
"support.constant.property-value.tasty-position",
|
|
247
|
+
"support.constant.property-value.tasty-flex",
|
|
248
|
+
"support.constant.property-value.tasty-font",
|
|
249
|
+
"support.constant.property-value.tasty-text",
|
|
250
|
+
"support.constant.property-value.tasty-alignment",
|
|
251
|
+
"support.constant.property-value.tasty-border-style",
|
|
252
|
+
"support.constant.property-value.tasty-whitespace",
|
|
253
|
+
"support.constant.property-value.tasty-global",
|
|
254
|
+
"support.constant.property-value.tasty-transition",
|
|
255
|
+
"support.constant.property-value.css-syntax",
|
|
256
|
+
"entity.other.attribute-name",
|
|
257
|
+
"entity.other.attribute-name.tasty",
|
|
258
|
+
"entity.other.attribute-name.pseudo-class.tasty",
|
|
259
|
+
"entity.other.attribute-name.pseudo-class.css",
|
|
260
|
+
"entity.other.attribute-name.class.tasty",
|
|
261
|
+
"entity.other.attribute-name.pseudo-element.css",
|
|
262
|
+
"punctuation.definition.entity.css"
|
|
263
|
+
],
|
|
264
|
+
settings: { foreground: value }
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
scope: [
|
|
268
|
+
"keyword.operator",
|
|
269
|
+
"keyword.operator.logical.tasty",
|
|
270
|
+
"keyword.operator.arithmetic.css",
|
|
271
|
+
"keyword.operator.assignment",
|
|
272
|
+
"keyword.operator.selector-affix.tasty",
|
|
273
|
+
"keyword.operator.attribute-selector.tasty",
|
|
274
|
+
"keyword.operator.comparison.tasty"
|
|
275
|
+
],
|
|
276
|
+
settings: { foreground: operator }
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
scope: [
|
|
280
|
+
"punctuation.definition.string",
|
|
281
|
+
"punctuation.separator",
|
|
282
|
+
"punctuation.definition.block",
|
|
283
|
+
"punctuation.definition.array",
|
|
284
|
+
"punctuation.section",
|
|
285
|
+
"punctuation.definition.auto-calc",
|
|
286
|
+
"punctuation.definition.attribute-selector",
|
|
287
|
+
"punctuation.definition.tag",
|
|
288
|
+
"punctuation.definition.pseudo-class",
|
|
289
|
+
"punctuation.definition.fallback",
|
|
290
|
+
"meta.brace"
|
|
291
|
+
],
|
|
292
|
+
settings: { foreground: punctuation }
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
scope: ["keyword.control.at-rule", "entity.name.tag.class.css"],
|
|
296
|
+
settings: { foreground: keyword }
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
scope: ["support.type.property-name.css", "meta.property-name.css"],
|
|
300
|
+
settings: { foreground: property }
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
scope: ["punctuation.definition.inserted.diff"],
|
|
304
|
+
settings: {
|
|
305
|
+
foreground: inserted,
|
|
306
|
+
fontStyle: "bold"
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
scope: ["punctuation.definition.deleted.diff"],
|
|
311
|
+
settings: {
|
|
312
|
+
foreground: deleted,
|
|
313
|
+
fontStyle: "bold"
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
]
|
|
317
|
+
};
|
|
318
|
+
const sharedShiki = globalThis;
|
|
319
|
+
function configureCodeHighlighting(config) {
|
|
320
|
+
sharedShiki.__tenphiCookbookShiki = config;
|
|
321
|
+
}
|
|
322
|
+
function codeGroupHighlighting() {
|
|
323
|
+
return sharedShiki.__tenphiCookbookShiki ?? cookbookShikiConfig(void 0);
|
|
324
|
+
}
|
|
325
|
+
//#endregion
|
|
326
|
+
export { codeGroupHighlighting, configureCodeHighlighting, cookbookShikiConfig };
|
|
327
|
+
|
|
328
|
+
//# sourceMappingURL=shiki-theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shiki-theme.js","names":[],"sources":["../../src/theme/shiki-theme.ts"],"sourcesContent":["const comment = \"var(--syntax-comment-color)\";\nconst punctuation = \"var(--syntax-punctuation-color)\";\nconst keyword = \"var(--syntax-keyword-color)\";\nconst string = \"var(--syntax-string-color)\";\nconst token = \"var(--syntax-token-color)\";\nconst property = \"var(--syntax-property-color)\";\nconst number = \"var(--syntax-number-color)\";\nconst func = \"var(--syntax-function-color)\";\nconst value = \"var(--syntax-value-color)\";\nconst operator = \"var(--syntax-operator-color)\";\nconst foreground = \"var(--syntax-text-color)\";\nconst background = \"var(--syntax-bg-color)\";\nconst inserted = \"var(--green-text-color)\";\nconst deleted = \"var(--red-text-color)\";\n\ntype HighlightToken = {\n content: string;\n offset: number;\n color?: string;\n};\n\nconst shellLanguages = new Set([\"bash\", \"sh\", \"shell\", \"shellscript\", \"zsh\"]);\nconst shellPlaceholder = /<[A-Za-z][A-Za-z0-9_-]*>/g;\n\n/**\n * Shell grammars interpret documentation placeholders such as `<plan-id>` as\n * redirections and can split the final character into an unscoped token. Keep\n * the placeholder name visually coherent while retaining the operator color\n * on the angle brackets.\n */\nconst bashPlaceholderTransformer = {\n name: \"cookbook:bash-placeholders\",\n enforce: \"post\" as const,\n tokens(\n this: { source: string; options: { lang?: string } },\n lines: HighlightToken[][],\n ): HighlightToken[][] | undefined {\n if (!this.options.lang || !shellLanguages.has(this.options.lang)) return;\n const ranges = [...this.source.matchAll(shellPlaceholder)].map((match) => ({\n start: (match.index ?? 0) + 1,\n end: (match.index ?? 0) + match[0].length - 1,\n }));\n if (ranges.length === 0) return;\n\n for (const line of lines) {\n for (const highlighted of line) {\n const start = highlighted.offset;\n const end = start + highlighted.content.length;\n if (ranges.some((range) => start < range.end && end > range.start)) {\n highlighted.color = string;\n }\n }\n }\n return lines;\n },\n};\n\ntype HastElement = {\n type?: string;\n tagName?: string;\n properties: Record<string, unknown>;\n children?: HastElement[];\n};\n\nconst syntaxColors = new Map(\n [\n comment,\n punctuation,\n keyword,\n string,\n token,\n property,\n number,\n func,\n value,\n operator,\n foreground,\n background,\n inserted,\n deleted,\n ].map((color) => [color, `td-${color.slice(6, -7)}`]),\n);\n\n/** Keep grammar classification in Shiki and all presentation in Tasty. */\nconst tastyClassesTransformer = {\n name: \"cookbook:tasty-classes\",\n enforce: \"post\" as const,\n root(this: DiffTransformerContext, root: HastElement): void {\n const visit = (node: HastElement) => {\n const style = node.properties?.style;\n if (typeof style === \"string\") {\n for (const declaration of style.split(\";\")) {\n if (!declaration.trim()) continue;\n const separator = declaration.indexOf(\":\");\n const key = declaration.slice(0, separator).trim();\n const value = declaration.slice(separator + 1).trim();\n let className: string | undefined;\n if (key === \"color\") className = syntaxColors.get(value);\n else if (key === \"background-color\" && value === background)\n className = \"td-syntax-bg\";\n else if (key === \"font-style\" && value === \"italic\")\n className = \"td-syntax-italic\";\n else if (key === \"font-weight\" && value === \"bold\")\n className = \"td-syntax-strong\";\n else if (key === \"text-decoration\" && value === \"underline\")\n className = \"td-syntax-underline\";\n else if (key === \"overflow-x\" && value === \"auto\")\n className = \"td-syntax-scroll\";\n else if (\n (key === \"white-space\" && value === \"pre-wrap\") ||\n (key === \"word-wrap\" && value === \"break-word\")\n )\n className = \"td-syntax-wrap\";\n else if (key === \"user-select\" && value === \"none\")\n className = \"td-syntax-marker\";\n if (!className)\n throw new Error(\n `Unsupported Shiki style ${JSON.stringify(declaration)}. Use semantic classes and theme.styles.SyntaxHighlight for custom transformers.`,\n );\n this.addClassToHast(node, className);\n }\n delete node.properties.style;\n }\n node.children?.forEach(visit);\n };\n visit(root);\n },\n};\n\ntype DiffTransformerContext = {\n source: string;\n options: { lang?: string };\n addClassToHast(element: HastElement, className: string): HastElement;\n};\n\nconst diffLanguages = new Set([\"diff\", \"patch\"]);\n\n/**\n * The diff grammar colors individual tokens, but it does not expose a stable\n * whole-line selector. Add semantic classes so insertions and deletions can\n * receive subtle, full-width surfaces without hiding their +/- markers.\n */\nconst diffLineTransformer = {\n name: \"cookbook:diff-lines\",\n pre(this: DiffTransformerContext, element: HastElement): void {\n if (this.options.lang && diffLanguages.has(this.options.lang)) {\n this.addClassToHast(element, \"td-diff\");\n }\n },\n line(\n this: DiffTransformerContext,\n element: HastElement,\n lineNumber: number,\n ): void {\n if (!this.options.lang || !diffLanguages.has(this.options.lang)) return;\n\n const line = this.source.split(/\\r?\\n/)[lineNumber - 1] ?? \"\";\n if (line.startsWith(\"+\") && !line.startsWith(\"+++\")) {\n this.addClassToHast(element, \"td-diff-line--inserted\");\n } else if (line.startsWith(\"-\") && !line.startsWith(\"---\")) {\n this.addClassToHast(element, \"td-diff-line--deleted\");\n }\n },\n};\n\n/**\n * Astro loads fenced-code grammars lazily. MDX embeds TSX, but loading MDX by\n * itself leaves that embedded grammar unavailable and produces partially\n * highlighted imports and JSX. Preload TSX while preserving consumer-supplied\n * languages and transformers.\n */\nexport function cookbookShikiConfig(\n config: Record<string, unknown> | undefined,\n): Record<string, unknown> {\n const languages = Array.isArray(config?.langs) ? [...config.langs] : [];\n const transformers = Array.isArray(config?.transformers)\n ? [...config.transformers]\n : [];\n const hasTsx = languages.some(\n (language) =>\n language === \"tsx\" ||\n (typeof language === \"object\" &&\n language !== null &&\n \"name\" in language &&\n language.name === \"tsx\"),\n );\n\n if (!transformers.includes(bashPlaceholderTransformer)) {\n transformers.push(bashPlaceholderTransformer);\n }\n if (!transformers.includes(diffLineTransformer)) {\n transformers.push(diffLineTransformer);\n }\n if (!transformers.includes(tastyClassesTransformer)) {\n transformers.push(tastyClassesTransformer);\n }\n\n return {\n ...config,\n langs: hasTsx ? languages : [...languages, \"tsx\"],\n theme: tastyCodeTheme,\n transformers,\n };\n}\n\n/**\n * Shiki performs the grammatical classification, while every emitted color\n * remains a reference to a Glaze-generated token owned by Tasty.\n */\nconst tastyCodeTheme = {\n name: \"tasty-code\",\n type: \"light\" as const,\n fg: foreground,\n bg: background,\n colors: {\n \"editor.background\": background,\n \"editor.foreground\": foreground,\n },\n settings: [\n {\n scope: [\n \"comment\",\n \"comment.line\",\n \"comment.block\",\n \"punctuation.definition.comment\",\n ],\n settings: { foreground: comment, fontStyle: \"italic\" },\n },\n {\n scope: [\n \"keyword\",\n \"keyword.control\",\n \"keyword.other\",\n \"storage.type\",\n \"storage.modifier\",\n \"keyword.control.at-rule.tasty\",\n \"keyword.control.at-rule.media.tasty\",\n \"keyword.control.at-rule.media-type.tasty\",\n \"keyword.control.at-rule.starting.tasty\",\n \"keyword.control.state-alias.tasty\",\n ],\n settings: { foreground: keyword },\n },\n {\n scope: [\n \"string\",\n \"string.quoted\",\n \"string.template\",\n \"string.quoted.attribute-value.tasty\",\n \"string.unquoted.attribute-value.tasty\",\n ],\n settings: { foreground: string },\n },\n {\n scope: [\n \"support.constant.color.tasty-token\",\n \"support.constant.color.tasty-token.builtin\",\n \"constant.other.color.tasty-token\",\n \"constant.other.color.tasty\",\n \"constant.other.color.hex\",\n \"constant.other.color.rgb-value\",\n ],\n settings: { foreground: token },\n },\n {\n scope: [\n \"constant.numeric\",\n \"constant.numeric.tasty\",\n \"constant.numeric.custom-unit.tasty\",\n \"constant.numeric.css-with-unit\",\n \"constant.numeric.bare.tasty\",\n \"constant.numeric.css\",\n \"constant.numeric.keyframe-step.tasty\",\n \"constant.language.boolean.tasty\",\n ],\n settings: { foreground: number },\n },\n {\n scope: [\n \"support.type.property-name.tasty\",\n \"variable.other.constant.tasty\",\n \"entity.other.attribute-name.tsx\",\n \"entity.other.attribute-name.jsx\",\n ],\n settings: { foreground: property },\n },\n {\n scope: [\"variable\", \"variable.other\"],\n settings: { foreground },\n },\n {\n scope: [\n \"entity.name.function\",\n \"support.function\",\n \"support.function.misc.css\",\n \"entity.name.tag\",\n \"entity.name.tag.tsx\",\n \"support.class.component\",\n \"entity.name.type.tasty\",\n \"entity.name.tag.tasty\",\n ],\n settings: { foreground: func },\n },\n {\n scope: [\n \"support.constant.property-value.tasty\",\n \"support.constant.property-value.tasty-display\",\n \"support.constant.property-value.tasty-directional\",\n \"support.constant.property-value.tasty-preset\",\n \"support.constant.property-value.tasty-shape\",\n \"support.constant.property-value.tasty-scrollbar\",\n \"support.constant.property-value.tasty-state\",\n \"support.constant.property-value.tasty-cursor\",\n \"support.constant.property-value.tasty-overflow\",\n \"support.constant.property-value.tasty-position\",\n \"support.constant.property-value.tasty-flex\",\n \"support.constant.property-value.tasty-font\",\n \"support.constant.property-value.tasty-text\",\n \"support.constant.property-value.tasty-alignment\",\n \"support.constant.property-value.tasty-border-style\",\n \"support.constant.property-value.tasty-whitespace\",\n \"support.constant.property-value.tasty-global\",\n \"support.constant.property-value.tasty-transition\",\n \"support.constant.property-value.css-syntax\",\n \"entity.other.attribute-name\",\n \"entity.other.attribute-name.tasty\",\n \"entity.other.attribute-name.pseudo-class.tasty\",\n \"entity.other.attribute-name.pseudo-class.css\",\n \"entity.other.attribute-name.class.tasty\",\n \"entity.other.attribute-name.pseudo-element.css\",\n \"punctuation.definition.entity.css\",\n ],\n settings: { foreground: value },\n },\n {\n scope: [\n \"keyword.operator\",\n \"keyword.operator.logical.tasty\",\n \"keyword.operator.arithmetic.css\",\n \"keyword.operator.assignment\",\n \"keyword.operator.selector-affix.tasty\",\n \"keyword.operator.attribute-selector.tasty\",\n \"keyword.operator.comparison.tasty\",\n ],\n settings: { foreground: operator },\n },\n {\n scope: [\n \"punctuation.definition.string\",\n \"punctuation.separator\",\n \"punctuation.definition.block\",\n \"punctuation.definition.array\",\n \"punctuation.section\",\n \"punctuation.definition.auto-calc\",\n \"punctuation.definition.attribute-selector\",\n \"punctuation.definition.tag\",\n \"punctuation.definition.pseudo-class\",\n \"punctuation.definition.fallback\",\n \"meta.brace\",\n ],\n settings: { foreground: punctuation },\n },\n {\n scope: [\"keyword.control.at-rule\", \"entity.name.tag.class.css\"],\n settings: { foreground: keyword },\n },\n {\n scope: [\"support.type.property-name.css\", \"meta.property-name.css\"],\n settings: { foreground: property },\n },\n {\n scope: [\"punctuation.definition.inserted.diff\"],\n settings: { foreground: inserted, fontStyle: \"bold\" },\n },\n {\n scope: [\"punctuation.definition.deleted.diff\"],\n settings: { foreground: deleted, fontStyle: \"bold\" },\n },\n ],\n};\n\n// Astro executes integrations and page modules in separate module graphs.\n// Share server-only transformer functions without serializing them into pages.\nconst sharedShiki = globalThis as typeof globalThis & {\n __tenphiCookbookShiki?: Record<string, unknown>;\n};\nexport function configureCodeHighlighting(config: Record<string, unknown>) {\n sharedShiki.__tenphiCookbookShiki = config;\n}\nexport function codeGroupHighlighting() {\n return sharedShiki.__tenphiCookbookShiki ?? cookbookShikiConfig(undefined);\n}\n"],"mappings":";AAAA,MAAM,UAAU;AAChB,MAAM,cAAc;AACpB,MAAM,UAAU;AAChB,MAAM,SAAS;AACf,MAAM,QAAQ;AACd,MAAM,WAAW;AACjB,MAAM,SAAS;AACf,MAAM,OAAO;AACb,MAAM,QAAQ;AACd,MAAM,WAAW;AACjB,MAAM,aAAa;AACnB,MAAM,aAAa;AACnB,MAAM,WAAW;AACjB,MAAM,UAAU;AAQhB,MAAM,iCAAiB,IAAI,IAAI;CAAC;CAAQ;CAAM;CAAS;CAAe;AAAK,CAAC;AAC5E,MAAM,mBAAmB;;;;;;;AAQzB,MAAM,6BAA6B;CACjC,MAAM;CACN,SAAS;CACT,OAEE,OACgC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GACF;GACA,UAAU,EAAE,YAAY,KAAK;EAC/B;EACA;GACE,OAAO;IACL;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,UAAU,EAAE,YAAY,MAAM;EAChC;EACA;GACE,OAAO;IACL;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,UAAU,EAAE,YAAY,SAAS;EACnC;EACA;GACE,OAAO;IACL;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,UAAU,EAAE,YAAY,YAAY;EACtC;EACA;GACE,OAAO,CAAC,2BAA2B,2BAA2B;GAC9D,UAAU,EAAE,YAAY,QAAQ;EAClC;EACA;GACE,OAAO,CAAC,kCAAkC,wBAAwB;GAClE,UAAU,EAAE,YAAY,SAAS;EACnC;EACA;GACE,OAAO,CAAC,sCAAsC;GAC9C,UAAU;IAAE,YAAY;IAAU,WAAW;GAAO;EACtD;EACA;GACE,OAAO,CAAC,qCAAqC;GAC7C,UAAU;IAAE,YAAY;IAAS,WAAW;GAAO;EACrD;CACF;AACF;AAIA,MAAM,cAAc;AAGpB,SAAgB,0BAA0B,QAAiC;CACzE,YAAY,wBAAwB;AACtC;AACA,SAAgB,wBAAwB;CACtC,OAAO,YAAY,yBAAyB,oBAAoB,KAAA,CAAS;AAC3E"}
|