@tenphi/renderer 0.22.1 → 0.24.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/dist/client/client-navigation.d.ts +1 -0
- package/dist/client/client-navigation.js +32 -0
- package/dist/client/client-navigation.js.map +1 -0
- package/dist/client/code-copy.js +3 -3
- package/dist/client/code-copy.js.map +1 -1
- package/dist/client/heading-links.js +4 -4
- package/dist/client/heading-links.js.map +1 -1
- package/dist/client/navigation-router.d.ts +2 -0
- package/dist/client/navigation-router.js +36 -0
- package/dist/client/navigation-router.js.map +1 -0
- package/dist/client/navigation.js +3 -3
- package/dist/client/navigation.js.map +1 -1
- package/dist/client/search.d.ts.map +1 -1
- package/dist/client/search.js +16 -2
- package/dist/client/search.js.map +1 -1
- package/dist/client/table-of-contents.js +2 -2
- package/dist/client/table-of-contents.js.map +1 -1
- package/dist/components/AppearanceInit.astro +6 -0
- package/dist/components/Card.styles.js +1 -0
- package/dist/components/CodeGroup.astro +8 -1
- package/dist/components/CodeGroup.styles.js +1 -2
- package/dist/components/Document.styles.js +54 -25
- package/dist/components/EditLink.astro +1 -1
- package/dist/components/Header.styles.js +13 -13
- package/dist/components/HeaderLinks.astro +4 -8
- package/dist/components/HeaderLinks.styles.js +17 -17
- package/dist/components/Hero.styles.js +28 -30
- package/dist/components/Icon.astro +3 -3
- package/dist/components/LanguageSelect.styles.js +8 -8
- package/dist/components/MainContent.styles.js +3 -3
- package/dist/components/MainPane.styles.js +1 -1
- package/dist/components/MarkdownAlert.styles.js +16 -17
- package/dist/components/MarkdownCodeBlock.styles.js +31 -19
- package/dist/components/MarkdownContent.styles.js +47 -89
- package/dist/components/MarkdownHeading.styles.js +23 -24
- package/dist/components/MarkdownInlineCode.styles.js +1 -1
- package/dist/components/MarkdownTable.styles.js +5 -5
- package/dist/components/Mermaid.styles.js +4 -1
- package/dist/components/MermaidSource.styles.js +1 -1
- package/dist/components/MobileMenuFooter.styles.js +1 -1
- package/dist/components/MobileMenuToggle.styles.js +3 -3
- package/dist/components/MobileNavigationTabs.astro +3 -2
- package/dist/components/MobileNavigationTabs.styles.js +3 -3
- package/dist/components/MobileTableOfContents.styles.js +2 -2
- package/dist/components/PackageVersion.styles.js +1 -1
- package/dist/components/PageFrame.styles.js +6 -6
- package/dist/components/Pagination.astro +2 -2
- package/dist/components/Pagination.styles.js +10 -10
- package/dist/components/Preview.astro +3 -4
- package/dist/components/Preview.styles.js +2 -2
- package/dist/components/Search.styles.js +13 -13
- package/dist/components/SearchButton.styles.js +10 -10
- package/dist/components/SearchResults.styles.js +21 -31
- package/dist/components/SelectPopover.astro +18 -9
- package/dist/components/Sidebar.styles.js +58 -49
- package/dist/components/SidebarList.astro +9 -6
- package/dist/components/SiteLogo.astro +2 -2
- package/dist/components/SiteLogo.styles.js +4 -4
- package/dist/components/SyntaxHighlight.styles.js +69 -48
- package/dist/components/TableOfContents.styles.js +1 -1
- package/dist/components/TableOfContentsLayout.styles.js +7 -7
- package/dist/components/ThemeSelect.styles.js +12 -12
- package/dist/components/TopNavigation.styles.js +1 -1
- package/dist/components/VersionSwitcher.styles.js +1 -1
- package/dist/components/appearance-bootstrap.js +21 -0
- package/dist/components/select-popover-styles.js +14 -14
- package/dist/components/tasty-states.js +10 -9
- package/dist/eslint-plugin.js +6 -9
- package/dist/eslint-plugin.js.map +1 -1
- package/dist/index.js +14 -11
- package/dist/index.js.map +1 -1
- package/dist/markdown/rendered-content.js +2 -2
- package/dist/markdown/rendered-content.js.map +1 -1
- package/dist/overrides/Header.astro +8 -12
- package/dist/overrides/Hero.astro +11 -6
- package/dist/overrides/MobileMenuFooter.astro +1 -1
- package/dist/overrides/MobileMenuToggle.astro +6 -5
- package/dist/overrides/PageFrame.astro +4 -3
- package/dist/overrides/Search.astro +22 -15
- package/dist/overrides/Sidebar.astro +2 -3
- package/dist/overrides/ThemeSelect.astro +2 -2
- package/dist/routes/Page.astro +17 -9
- package/dist/styling.js +1 -1
- package/dist/{tasty-states-_JhxFdK1.js → tasty-states-BIgiJQ3N.js} +7 -10
- package/dist/tasty-states-BIgiJQ3N.js.map +1 -0
- package/dist/theme/shiki-theme.d.ts.map +1 -1
- package/dist/theme/shiki-theme.js +37 -19
- package/dist/theme/shiki-theme.js.map +1 -1
- package/package.json +3 -3
- package/dist/tasty-states-_JhxFdK1.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/markdown/rendered-content.ts
|
|
2
|
-
const headingPattern = /<div\b[^>]*\
|
|
2
|
+
const headingPattern = /<div\b[^>]*\bdata-element=["']MarkdownHeading["'][^>]*>[\s\S]*?<\/div>|<h([1-6])\b([^>]*)>([\s\S]*?)<\/h\1>/gi;
|
|
3
3
|
const idPattern = /\sid=(['"])(.*?)\1/i;
|
|
4
4
|
const tags = /<[^>]*>/g;
|
|
5
5
|
/** Wrap rendered headings with a visible, accessible permalink. */
|
|
@@ -9,7 +9,7 @@ function addHeadingPermalinks(html) {
|
|
|
9
9
|
const id = idPattern.exec(attributes)?.[2];
|
|
10
10
|
if (!id) return heading;
|
|
11
11
|
const title = escapeAttribute(decodeEntities(content.replace(tags, "").trim()));
|
|
12
|
-
return `<div class="cookbook-heading-wrapper level
|
|
12
|
+
return `<div class="cookbook-heading-wrapper" data-element="MarkdownHeading" data-heading="" data-level="h${level}">${heading}<a data-element="Anchor" href="#${escapeAttribute(id)}" aria-label="Permalink to “${title}”"><span data-element="AnchorIcon" aria-hidden="true">#</span></a></div>`;
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
15
|
function decodeEntities(value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rendered-content.js","names":[],"sources":["../../src/markdown/rendered-content.ts"],"sourcesContent":["const headingPattern =\n /<div\\b[^>]*\\
|
|
1
|
+
{"version":3,"file":"rendered-content.js","names":[],"sources":["../../src/markdown/rendered-content.ts"],"sourcesContent":["const headingPattern =\n /<div\\b[^>]*\\bdata-element=[\"']MarkdownHeading[\"'][^>]*>[\\s\\S]*?<\\/div>|<h([1-6])\\b([^>]*)>([\\s\\S]*?)<\\/h\\1>/gi;\nconst idPattern = /\\sid=(['\"])(.*?)\\1/i;\nconst tags = /<[^>]*>/g;\n\n/** Wrap rendered headings with a visible, accessible permalink. */\nexport function addHeadingPermalinks(html: string): string {\n return html.replace(\n headingPattern,\n (\n heading,\n level: string | undefined,\n attributes: string | undefined,\n content: string | undefined,\n ) => {\n // Consume an existing heading wrapper unchanged so its inner heading\n // is not matched and wrapped a second time.\n if (!level || attributes === undefined || content === undefined) {\n return heading;\n }\n const id = idPattern.exec(attributes)?.[2];\n if (!id) return heading;\n const title = escapeAttribute(\n decodeEntities(content.replace(tags, \"\").trim()),\n );\n return `<div class=\"cookbook-heading-wrapper\" data-element=\"MarkdownHeading\" data-heading=\"\" data-level=\"h${level}\">${heading}<a data-element=\"Anchor\" href=\"#${escapeAttribute(id)}\" aria-label=\"Permalink to “${title}”\"><span data-element=\"AnchorIcon\" aria-hidden=\"true\">#</span></a></div>`;\n },\n );\n}\n\nfunction decodeEntities(value: string): string {\n const named: Record<string, string> = {\n amp: \"&\",\n apos: \"'\",\n gt: \">\",\n lt: \"<\",\n quot: '\"',\n };\n return value.replace(\n /&(?:#(\\d+)|#x([\\da-f]+)|(amp|apos|gt|lt|quot));/gi,\n (entity, decimal: string, hexadecimal: string, name: string) => {\n const point = decimal\n ? Number.parseInt(decimal, 10)\n : hexadecimal\n ? Number.parseInt(hexadecimal, 16)\n : undefined;\n return point === undefined\n ? (named[name.toLowerCase()] ?? entity)\n : String.fromCodePoint(point);\n },\n );\n}\n\nfunction escapeAttribute(value: string): string {\n return value\n .replaceAll(\"&\", \"&\")\n .replaceAll('\"', \""\")\n .replaceAll(\"'\", \"'\")\n .replaceAll(\"<\", \"<\")\n .replaceAll(\">\", \">\");\n}\n"],"mappings":";AAAA,MAAM,iBACJ;AACF,MAAM,YAAY;AAClB,MAAM,OAAO;;AAGb,SAAgB,qBAAqB,MAAsB;CACzD,OAAO,KAAK,QACV,iBAEE,SACA,OACA,YACA,YACG;EAGH,IAAI,CAAC,SAAS,eAAe,KAAA,KAAa,YAAY,KAAA,GACpD,OAAO;EAET,MAAM,KAAK,UAAU,KAAK,UAAU,CAAC,GAAG;EACxC,IAAI,CAAC,IAAI,OAAO;EAChB,MAAM,QAAQ,gBACZ,eAAe,QAAQ,QAAQ,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CACjD;EACA,OAAO,qGAAqG,MAAM,IAAI,QAAQ,kCAAkC,gBAAgB,EAAE,EAAE,8BAA8B,MAAM;CAC1N,CACF;AACF;AAEA,SAAS,eAAe,OAAuB;CAC7C,MAAM,QAAgC;EACpC,KAAK;EACL,MAAM;EACN,IAAI;EACJ,IAAI;EACJ,MAAM;CACR;CACA,OAAO,MAAM,QACX,sDACC,QAAQ,SAAiB,aAAqB,SAAiB;EAC9D,MAAM,QAAQ,UACV,OAAO,SAAS,SAAS,EAAE,IAC3B,cACE,OAAO,SAAS,aAAa,EAAE,IAC/B,KAAA;EACN,OAAO,UAAU,KAAA,IACZ,MAAM,KAAK,YAAY,MAAM,SAC9B,OAAO,cAAc,KAAK;CAChC,CACF;AACF;AAEA,SAAS,gBAAgB,OAAuB;CAC9C,OAAO,MACJ,WAAW,KAAK,OAAO,CAAC,CACxB,WAAW,MAAK,QAAQ,CAAC,CACzB,WAAW,KAAK,OAAO,CAAC,CACxB,WAAW,KAAK,MAAM,CAAC,CACvB,WAAW,KAAK,MAAM;AAC3B"}
|
|
@@ -50,7 +50,8 @@ const ui = messages(Astro.locals.cookbookRoute?.lang ?? "en", content);
|
|
|
50
50
|
---
|
|
51
51
|
|
|
52
52
|
<HeaderRoot
|
|
53
|
-
className=
|
|
53
|
+
className="td-header"
|
|
54
|
+
data-with-tabs={layout.tabs.length ? "" : undefined}
|
|
54
55
|
data-has-sidebar={Astro.locals.cookbookRoute.hasSidebar ? "" : undefined}
|
|
55
56
|
>
|
|
56
57
|
<div data-element="Primary">
|
|
@@ -93,28 +94,22 @@ const ui = messages(Astro.locals.cookbookRoute?.lang ?? "en", content);
|
|
|
93
94
|
/>
|
|
94
95
|
)
|
|
95
96
|
}
|
|
96
|
-
<div data-element="Search"
|
|
97
|
+
<div data-element="Search" data-print-hidden="">
|
|
97
98
|
{shouldRenderSearch && <Search />}
|
|
98
99
|
</div>
|
|
99
100
|
<HeaderLinks />
|
|
100
|
-
<div
|
|
101
|
-
data-element="MobileTheme"
|
|
102
|
-
class="md:cookbook-hidden cookbook-print-hidden"
|
|
103
|
-
>
|
|
101
|
+
<div data-element="MobileTheme" data-print-hidden="">
|
|
104
102
|
<ThemeSelect />
|
|
105
103
|
</div>
|
|
106
104
|
{
|
|
107
105
|
!Astro.locals.cookbookRoute.hasSidebar &&
|
|
108
106
|
Object.keys(content.locales ?? {}).length > 1 && (
|
|
109
|
-
<div data-element="MobileLanguage"
|
|
107
|
+
<div data-element="MobileLanguage" data-print-hidden="">
|
|
110
108
|
<LanguageSelect compact />
|
|
111
109
|
</div>
|
|
112
110
|
)
|
|
113
111
|
}
|
|
114
|
-
<div
|
|
115
|
-
data-element="Tools"
|
|
116
|
-
class="cookbook-hidden md:cookbook-flex cookbook-print-hidden"
|
|
117
|
-
>
|
|
112
|
+
<div data-element="Tools" data-print-hidden="">
|
|
118
113
|
<div data-element="Social"><SocialIcons /></div>
|
|
119
114
|
<ThemeSelect />
|
|
120
115
|
<LanguageSelect />
|
|
@@ -123,7 +118,8 @@ const ui = messages(Astro.locals.cookbookRoute?.lang ?? "en", content);
|
|
|
123
118
|
{
|
|
124
119
|
layout.tabs.length > 0 && (
|
|
125
120
|
<TopNavigationRoot
|
|
126
|
-
className="td-top-tabs
|
|
121
|
+
className="td-top-tabs"
|
|
122
|
+
data-print-hidden=""
|
|
127
123
|
aria-label={ui.primary}
|
|
128
124
|
>
|
|
129
125
|
{layout.tabs.map((tab, index) => (
|
|
@@ -49,20 +49,25 @@ if (image) {
|
|
|
49
49
|
/>
|
|
50
50
|
)
|
|
51
51
|
}
|
|
52
|
-
{rawHtml && <div
|
|
53
|
-
<div
|
|
54
|
-
<div
|
|
52
|
+
{rawHtml && <div data-element="Visual" set:html={rawHtml} />}
|
|
53
|
+
<div data-element="Stack">
|
|
54
|
+
<div data-element="Copy">
|
|
55
55
|
<h1 id="_top" data-page-title set:html={title} />
|
|
56
56
|
{data.draft && <DraftContentNotice />}
|
|
57
|
-
{tagline && <div
|
|
57
|
+
{tagline && <div data-element="Tagline" set:html={tagline} />}
|
|
58
58
|
</div>
|
|
59
59
|
{
|
|
60
60
|
actions.length > 0 && (
|
|
61
|
-
<div
|
|
61
|
+
<div data-element="Actions">
|
|
62
62
|
{actions.map(({ link: href, text, variant }) => (
|
|
63
63
|
<a
|
|
64
64
|
{href}
|
|
65
|
-
|
|
65
|
+
data-element="Action"
|
|
66
|
+
data-primary={variant === "primary" ? "" : undefined}
|
|
67
|
+
data-secondary={
|
|
68
|
+
!variant || variant === "secondary" ? "" : undefined
|
|
69
|
+
}
|
|
70
|
+
data-minimal={variant === "minimal" ? "" : undefined}
|
|
66
71
|
>
|
|
67
72
|
{text}
|
|
68
73
|
</a>
|
|
@@ -5,7 +5,7 @@ import { MobileMenuFooterRoot } from "../components/MobileMenuFooter.styles.js";
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
<MobileMenuFooterRoot className="td-mobile-preferences">
|
|
8
|
-
<div
|
|
8
|
+
<div data-element="Social">
|
|
9
9
|
<SocialIcons />
|
|
10
10
|
</div>
|
|
11
11
|
<LanguageSelect sidebar />
|
|
@@ -23,15 +23,16 @@ const section = layout.tabs[active]?.label;
|
|
|
23
23
|
---
|
|
24
24
|
|
|
25
25
|
<MobileMenuToggleRoot
|
|
26
|
+
className="td-menu-button cookbook-menu-button"
|
|
26
27
|
type="button"
|
|
27
28
|
popovertarget="cookbook__sidebar"
|
|
28
29
|
aria-controls="cookbook__sidebar"
|
|
29
30
|
aria-expanded="false"
|
|
30
|
-
|
|
31
|
+
data-print-hidden=""
|
|
31
32
|
>
|
|
32
|
-
<Icon name="bars"
|
|
33
|
-
<span
|
|
34
|
-
{section && <span
|
|
33
|
+
<Icon name="bars" data-element="Icon" />
|
|
34
|
+
<span data-sr-only="">{Astro.locals.t("menuButton.accessibleLabel")}</span>
|
|
35
|
+
{section && <span data-element="Section">{section}</span>}
|
|
35
36
|
{section && <Icon name="right-caret" />}
|
|
36
|
-
<span
|
|
37
|
+
<span data-element="Page">{route.entry.data.title}</span>
|
|
37
38
|
</MobileMenuToggleRoot>
|
|
@@ -10,14 +10,15 @@ const { hasSidebar } = Astro.locals.cookbookRoute;
|
|
|
10
10
|
{
|
|
11
11
|
hasSidebar && (
|
|
12
12
|
<SidebarRoot
|
|
13
|
+
className="sidebar-pane"
|
|
13
14
|
id="cookbook__sidebar"
|
|
14
|
-
|
|
15
|
+
data-print-hidden=""
|
|
15
16
|
popover="auto"
|
|
16
17
|
aria-label={Astro.locals.t("sidebarNav.accessibleLabel")}
|
|
17
18
|
tabIndex={-1}
|
|
18
19
|
>
|
|
19
20
|
<nav
|
|
20
|
-
|
|
21
|
+
data-element="Content"
|
|
21
22
|
aria-label={Astro.locals.t("sidebarNav.accessibleLabel")}
|
|
22
23
|
>
|
|
23
24
|
<slot name="sidebar" />
|
|
@@ -25,7 +26,7 @@ const { hasSidebar } = Astro.locals.cookbookRoute;
|
|
|
25
26
|
</SidebarRoot>
|
|
26
27
|
)
|
|
27
28
|
}
|
|
28
|
-
<div
|
|
29
|
+
<div data-element="MainFrame"><slot /></div>
|
|
29
30
|
</PageFrameRoot>
|
|
30
31
|
|
|
31
32
|
<script>
|
|
@@ -18,6 +18,8 @@ const translations = {
|
|
|
18
18
|
|
|
19
19
|
<SearchRoot
|
|
20
20
|
className={Astro.props.class}
|
|
21
|
+
data-search-key={`cookbook-search:${import.meta.env.BASE_URL}:${Astro.locals.cookbookRoute.lang}`}
|
|
22
|
+
data-search-base={import.meta.env.BASE_URL}
|
|
21
23
|
data-translations={JSON.stringify(translations)}
|
|
22
24
|
data-strip-trailing-slash={import.meta.env.TRAILING_SLASH === "never" ||
|
|
23
25
|
undefined}
|
|
@@ -35,7 +37,7 @@ const translations = {
|
|
|
35
37
|
>
|
|
36
38
|
</SearchButtonRoot>
|
|
37
39
|
<dialog aria-label={label}>
|
|
38
|
-
<div
|
|
40
|
+
<div data-element="Frame">
|
|
39
41
|
<button
|
|
40
42
|
type="button"
|
|
41
43
|
data-element="Close"
|
|
@@ -47,13 +49,13 @@ const translations = {
|
|
|
47
49
|
{Astro.locals.t("search.devWarning")}
|
|
48
50
|
</p>
|
|
49
51
|
) : (
|
|
50
|
-
<div
|
|
52
|
+
<div data-element="Container">
|
|
51
53
|
<p data-element="Status" data-search-status role="status" hidden />
|
|
52
54
|
<SearchResultsRoot id="cookbook__search">
|
|
53
|
-
<div
|
|
54
|
-
<div
|
|
55
|
+
<div data-element="UI" role="search" aria-label={label}>
|
|
56
|
+
<div data-element="Field">
|
|
55
57
|
<input
|
|
56
|
-
|
|
58
|
+
data-element="Input"
|
|
57
59
|
data-search-input
|
|
58
60
|
type="text"
|
|
59
61
|
aria-label={label}
|
|
@@ -64,14 +66,14 @@ const translations = {
|
|
|
64
66
|
autofocus
|
|
65
67
|
/>
|
|
66
68
|
<button
|
|
67
|
-
|
|
69
|
+
data-element="Clear"
|
|
68
70
|
data-clear-search
|
|
69
71
|
type="button"
|
|
70
72
|
aria-label={Astro.locals.t("pagefind.clear_search")}
|
|
71
73
|
hidden
|
|
72
74
|
/>
|
|
73
75
|
</div>
|
|
74
|
-
<div data-search-results />
|
|
76
|
+
<div data-element="EngineUI" data-search-results />
|
|
75
77
|
</div>
|
|
76
78
|
</SearchResultsRoot>
|
|
77
79
|
</div>
|
|
@@ -82,12 +84,17 @@ const translations = {
|
|
|
82
84
|
</SearchRoot>
|
|
83
85
|
<script>
|
|
84
86
|
import { initializeSearch } from "../client/search.js";
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
element
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
function initialize(): void {
|
|
88
|
+
document.querySelectorAll<HTMLElement>("site-search").forEach((element) => {
|
|
89
|
+
if (element.dataset.searchBase !== import.meta.env.BASE_URL) return;
|
|
90
|
+
initializeSearch(
|
|
91
|
+
element,
|
|
92
|
+
{},
|
|
93
|
+
import.meta.env.DEV,
|
|
94
|
+
import.meta.env.BASE_URL,
|
|
95
|
+
);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
initialize();
|
|
99
|
+
document.addEventListener("astro:page-load", initialize);
|
|
93
100
|
</script>
|
|
@@ -46,10 +46,9 @@ const sidebar =
|
|
|
46
46
|
const ui = messages(Astro.locals.cookbookRoute?.lang ?? "en", content);
|
|
47
47
|
---
|
|
48
48
|
|
|
49
|
-
<div
|
|
49
|
+
<div data-element="MobileHeading">
|
|
50
50
|
<a
|
|
51
51
|
data-element="HomeLink"
|
|
52
|
-
class="td-sidebar-heading__home"
|
|
53
52
|
href={localeHref(
|
|
54
53
|
(content.logo && content.logo.href) || "/",
|
|
55
54
|
currentPath,
|
|
@@ -83,7 +82,7 @@ const ui = messages(Astro.locals.cookbookRoute?.lang ?? "en", content);
|
|
|
83
82
|
<SidebarList entries={sidebar} />
|
|
84
83
|
</cookbook-sidebar>
|
|
85
84
|
|
|
86
|
-
<div
|
|
85
|
+
<div data-mobile="">
|
|
87
86
|
<MobileMenuFooter />
|
|
88
87
|
</div>
|
|
89
88
|
|
|
@@ -50,7 +50,7 @@ const contrasts = [
|
|
|
50
50
|
/>
|
|
51
51
|
<Icon name={icon} />
|
|
52
52
|
<span>{label}</span>
|
|
53
|
-
<Icon name="approve-check"
|
|
53
|
+
<Icon name="approve-check" data-element="Checkmark" />
|
|
54
54
|
</label>
|
|
55
55
|
))
|
|
56
56
|
}
|
|
@@ -73,7 +73,7 @@ const contrasts = [
|
|
|
73
73
|
<ContrastIcon level={icon} />
|
|
74
74
|
)}
|
|
75
75
|
<span>{label}</span>
|
|
76
|
-
<Icon name="approve-check"
|
|
76
|
+
<Icon name="approve-check" data-element="Checkmark" />
|
|
77
77
|
</label>
|
|
78
78
|
))
|
|
79
79
|
}
|
package/dist/routes/Page.astro
CHANGED
|
@@ -21,6 +21,7 @@ import { MainContentRoot } from "../components/MainContent.styles.js";
|
|
|
21
21
|
import { BannerRoot } from "../components/Banner.styles.js";
|
|
22
22
|
import { TableOfContentsLayoutRoot } from "../components/TableOfContentsLayout.styles.js";
|
|
23
23
|
import { TableOfContentsRoot } from "../components/TableOfContents.styles.js";
|
|
24
|
+
import AppearanceInit from "../components/AppearanceInit.astro";
|
|
24
25
|
|
|
25
26
|
interface Props {
|
|
26
27
|
frontmatter: Record<string, any>;
|
|
@@ -43,7 +44,6 @@ const indexed = route.id !== "/404" && data.pagefind !== false && !data.draft;
|
|
|
43
44
|
<html
|
|
44
45
|
lang={route.lang}
|
|
45
46
|
dir={route.dir}
|
|
46
|
-
data-theme="dark"
|
|
47
47
|
data-has-sidebar={route.hasSidebar ? "" : undefined}
|
|
48
48
|
data-has-toc={route.toc ? "" : undefined}
|
|
49
49
|
data-has-hero={data.hero ? "" : undefined}
|
|
@@ -51,6 +51,9 @@ const indexed = route.id !== "/404" && data.pagefind !== false && !data.draft;
|
|
|
51
51
|
<head>
|
|
52
52
|
<meta charset="utf-8" />
|
|
53
53
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
54
|
+
<AppearanceInit />
|
|
55
|
+
<meta name="astro-view-transitions-enabled" content="true" />
|
|
56
|
+
<meta name="astro-view-transitions-fallback" content="swap" />
|
|
54
57
|
<DocumentStyles />
|
|
55
58
|
<Head />
|
|
56
59
|
</head>
|
|
@@ -64,8 +67,11 @@ const indexed = route.id !== "/404" && data.pagefind !== false && !data.draft;
|
|
|
64
67
|
<div>
|
|
65
68
|
{
|
|
66
69
|
route.toc && (
|
|
67
|
-
<TableOfContentsLayoutRoot
|
|
68
|
-
|
|
70
|
+
<TableOfContentsLayoutRoot
|
|
71
|
+
className="right-sidebar-container"
|
|
72
|
+
data-print-hidden=""
|
|
73
|
+
>
|
|
74
|
+
<div data-element="Content">
|
|
69
75
|
<MobileTableOfContents />
|
|
70
76
|
<TableOfContentsRoot className="right-sidebar-panel">
|
|
71
77
|
<h2>{Astro.locals.t("tableOfContents.onThisPage")}</h2>
|
|
@@ -82,6 +88,7 @@ const indexed = route.id !== "/404" && data.pagefind !== false && !data.draft;
|
|
|
82
88
|
<MainPaneRoot className="main-pane">
|
|
83
89
|
<MainContentRoot
|
|
84
90
|
id="main-content"
|
|
91
|
+
tabIndex={-1}
|
|
85
92
|
data-pagefind-body={indexed ? "" : undefined}
|
|
86
93
|
lang={route.entryMeta.lang}
|
|
87
94
|
dir={route.entryMeta.dir}
|
|
@@ -96,8 +103,8 @@ const indexed = route.id !== "/404" && data.pagefind !== false && !data.draft;
|
|
|
96
103
|
}
|
|
97
104
|
{
|
|
98
105
|
data.hero ? (
|
|
99
|
-
<div
|
|
100
|
-
<div
|
|
106
|
+
<div data-element="Panel">
|
|
107
|
+
<div data-element="Container">
|
|
101
108
|
<Hero />
|
|
102
109
|
<MarkdownContent>
|
|
103
110
|
<slot />
|
|
@@ -107,14 +114,14 @@ const indexed = route.id !== "/404" && data.pagefind !== false && !data.draft;
|
|
|
107
114
|
</div>
|
|
108
115
|
) : (
|
|
109
116
|
<>
|
|
110
|
-
<div
|
|
111
|
-
<div
|
|
117
|
+
<div data-element="Panel">
|
|
118
|
+
<div data-element="Container">
|
|
112
119
|
<h1 id="_top" data-page-title set:html={data.title} />
|
|
113
120
|
{data.draft && <DraftContentNotice />}
|
|
114
121
|
</div>
|
|
115
122
|
</div>
|
|
116
|
-
<div
|
|
117
|
-
<div
|
|
123
|
+
<div data-element="Panel">
|
|
124
|
+
<div data-element="Container">
|
|
118
125
|
<MarkdownContent>
|
|
119
126
|
<slot />
|
|
120
127
|
</MarkdownContent>
|
|
@@ -129,6 +136,7 @@ const indexed = route.id !== "/404" && data.pagefind !== false && !data.draft;
|
|
|
129
136
|
</div>
|
|
130
137
|
</PageFrame>
|
|
131
138
|
<script>
|
|
139
|
+
import "../client/client-navigation.js";
|
|
132
140
|
import "../client/table-of-contents.js";
|
|
133
141
|
</script>
|
|
134
142
|
</body>
|
package/dist/styling.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as resolveComponentStyles } from "./component-styles-DstqPFf3.js";
|
|
2
|
-
import { t as configureCookbookStates } from "./tasty-states-
|
|
2
|
+
import { t as configureCookbookStates } from "./tasty-states-BIgiJQ3N.js";
|
|
3
3
|
import { n as extendComponent, t as defineComponent } from "./define-component-BP4YwMak.js";
|
|
4
4
|
import { mergeStyles, tasty, useGlobalStyles } from "@tenphi/tasty";
|
|
5
5
|
//#region src/components/Button.styles.js
|
|
@@ -9,16 +9,13 @@ const cookbookStates = {
|
|
|
9
9
|
"@system-dark": systemDark,
|
|
10
10
|
"@light": `@root(theme=light) | (!@root(theme) & ${systemLight})`,
|
|
11
11
|
"@dark": `@root(theme=dark) | (!@root(theme) & ${systemDark})`,
|
|
12
|
-
"@
|
|
13
|
-
"@
|
|
14
|
-
"@
|
|
15
|
-
"@compact": "@media(w <= 23rem)",
|
|
16
|
-
"@shell-mobile": "@media(w <= 48rem)",
|
|
17
|
-
"@shell-desktop": "@media(w > 48rem)",
|
|
18
|
-
"@narrow-layout": "@media(w < 72rem)",
|
|
19
|
-
"@medium-layout": "@media(w >= 50rem) & @media(w < 72rem)",
|
|
12
|
+
"@sm": "@media(w > 40rem)",
|
|
13
|
+
"@md": "@media(w >= 50rem)",
|
|
14
|
+
"@lg": "@media(w >= 72rem)",
|
|
20
15
|
"@reduced-motion": "@media(prefers-reduced-motion: reduce)",
|
|
21
|
-
"@
|
|
16
|
+
"@prose": "@own(!:is([data-not-content] *))",
|
|
17
|
+
"@prose-block": "@own(!:is([data-not-content] *)) & (@own(block) | @own(!:is(a,strong,em,del,span,input,code,br,li,dt,dd))) & (@own(:is(:not(a,strong,em,del,span,input,code,br) + *)) | @own(:is([data-block] + *)))",
|
|
18
|
+
"@prose-heading": "@own(!:is([data-not-content] *)) & @own(!:is(h1 + *,h2 + *,h3 + *,h4 + *,h5 + *,h6 + *,[data-heading] + *))"
|
|
22
19
|
};
|
|
23
20
|
let configured = false;
|
|
24
21
|
let configuredRuntime;
|
|
@@ -44,4 +41,4 @@ function configureCookbookStates() {
|
|
|
44
41
|
//#endregion
|
|
45
42
|
export { cookbookStates as n, configureCookbookStates as t };
|
|
46
43
|
|
|
47
|
-
//# sourceMappingURL=tasty-states-
|
|
44
|
+
//# sourceMappingURL=tasty-states-BIgiJQ3N.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasty-states-BIgiJQ3N.js","names":[],"sources":["../src/components/tasty-states.js"],"sourcesContent":["import { configure, getGlobalPredefinedStates } from \"@tenphi/tasty\";\nimport { resolveTypographyPresets } from \"../theme/defaults.js\";\nimport {\n TASTY_UNITS,\n TASTY_SPACING_PROPERTIES,\n} from \"../theme/tasty-config.js\";\n\nconst systemLight = \"@media(prefers-color-scheme: light)\";\nconst systemDark = \"@media(prefers-color-scheme: dark)\";\n\nexport const cookbookStates = {\n \"@system-light\": systemLight,\n \"@system-dark\": systemDark,\n \"@light\": `@root(theme=light) | (!@root(theme) & ${systemLight})`,\n \"@dark\": `@root(theme=dark) | (!@root(theme) & ${systemDark})`,\n \"@sm\": \"@media(w > 40rem)\",\n \"@md\": \"@media(w >= 50rem)\",\n \"@lg\": \"@media(w >= 72rem)\",\n \"@reduced-motion\": \"@media(prefers-reduced-motion: reduce)\",\n // Check each selected element's ancestry so isolated sections do not affect\n // surrounding prose in the same Markdown root.\n \"@prose\": \"@own(!:is([data-not-content] *))\",\n \"@prose-block\":\n \"@own(!:is([data-not-content] *)) & (@own(block) | @own(!:is(a,strong,em,del,span,input,code,br,li,dt,dd))) & (@own(:is(:not(a,strong,em,del,span,input,code,br) + *)) | @own(:is([data-block] + *)))\",\n \"@prose-heading\":\n \"@own(!:is([data-not-content] *)) & @own(!:is(h1 + *,h2 + *,h3 + *,h4 + *,h5 + *,h6 + *,[data-heading] + *))\",\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 properties: TASTY_SPACING_PROPERTIES,\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":";;;;AAOA,MAAM,cAAc;AACpB,MAAM,aAAa;AAEnB,MAAa,iBAAiB;CAC5B,iBAAiB;CACjB,gBAAgB;CAChB,UAAU,yCAAyC,YAAY;CAC/D,SAAS,wCAAwC,WAAW;CAC5D,OAAO;CACP,OAAO;CACP,OAAO;CACP,mBAAmB;CAGnB,UAAU;CACV,gBACE;CACF,kBACE;AACJ;AAEA,IAAI,aAAa;AACjB,IAAI;;AAGJ,SAAgB,0BAA0B;CAGxC,MAAM,UAAU,WAAW;CAC3B,IAAI,cAAc,sBAAsB,SAAS;CACjD,UAAU;EACR,SAAS,yBAAyB;EAClC,YAAY;EACZ,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,UAAU,EAAE,QAAQ,cAAc,CAAC;CAC1E,aAAa;AACf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shiki-theme.d.ts","names":[],"sources":["../../src/theme/shiki-theme.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"shiki-theme.d.ts","names":[],"sources":["../../src/theme/shiki-theme.ts"],"mappings":";;;;;;;iBAmOgB,oBACd,QAAQ,sCACP;iBAqNa,0BAA0B,QAAQ;iBAGlC,yBAAqB"}
|
|
@@ -60,10 +60,10 @@ const syntaxColors = new Map([
|
|
|
60
60
|
background,
|
|
61
61
|
inserted,
|
|
62
62
|
deleted
|
|
63
|
-
].map((color) => [color,
|
|
63
|
+
].map((color) => [color, color.slice(6, -7)]));
|
|
64
64
|
/** Keep grammar classification in Shiki and all presentation in Tasty. */
|
|
65
|
-
const
|
|
66
|
-
name: "cookbook:tasty-
|
|
65
|
+
const tastyModifiersTransformer = {
|
|
66
|
+
name: "cookbook:tasty-modifiers",
|
|
67
67
|
enforce: "post",
|
|
68
68
|
root(root) {
|
|
69
69
|
const visit = (node) => {
|
|
@@ -74,41 +74,59 @@ const tastyClassesTransformer = {
|
|
|
74
74
|
const separator = declaration.indexOf(":");
|
|
75
75
|
const key = declaration.slice(0, separator).trim();
|
|
76
76
|
const value = declaration.slice(separator + 1).trim();
|
|
77
|
-
let
|
|
78
|
-
if (key === "color")
|
|
79
|
-
else if (key === "background-color" && value === background)
|
|
80
|
-
else if (key === "font-style" && value === "italic")
|
|
81
|
-
else if (key === "font-weight" && value === "bold")
|
|
82
|
-
else if (key === "text-decoration" && value === "underline")
|
|
83
|
-
else if (key === "overflow-x" && value === "auto")
|
|
84
|
-
else if (key === "white-space" && value === "pre-wrap" || key === "word-wrap" && value === "break-word")
|
|
85
|
-
else if (key === "user-select" && value === "none")
|
|
86
|
-
if (!
|
|
87
|
-
|
|
77
|
+
let modifier;
|
|
78
|
+
if (key === "color") modifier = syntaxColors.get(value);
|
|
79
|
+
else if (key === "background-color" && value === background) modifier = "syntax-bg";
|
|
80
|
+
else if (key === "font-style" && value === "italic") modifier = "syntax-italic";
|
|
81
|
+
else if (key === "font-weight" && value === "bold") modifier = "syntax-strong";
|
|
82
|
+
else if (key === "text-decoration" && value === "underline") modifier = "syntax-underline";
|
|
83
|
+
else if (key === "overflow-x" && value === "auto") modifier = "syntax-scroll";
|
|
84
|
+
else if (key === "white-space" && value === "pre-wrap" || key === "word-wrap" && value === "break-word") modifier = "syntax-wrap";
|
|
85
|
+
else if (key === "user-select" && value === "none") modifier = "syntax-marker";
|
|
86
|
+
if (!modifier) throw new Error(`Unsupported Shiki style ${JSON.stringify(declaration)}. Use semantic data modifiers and theme.styles.SyntaxHighlight for custom transformers.`);
|
|
87
|
+
node.properties[`data-${modifier}`] = "";
|
|
88
88
|
}
|
|
89
89
|
delete node.properties.style;
|
|
90
90
|
}
|
|
91
|
+
const classValues = [node.properties?.class, node.properties?.className];
|
|
92
|
+
const classes = classValues.flatMap((value) => typeof value === "string" ? value.split(/\s+/).filter(Boolean) : Array.isArray(value) ? value : []);
|
|
93
|
+
if (classValues.some((value) => typeof value === "string" || Array.isArray(value))) {
|
|
94
|
+
for (const name of classes) if (name === "astro-code" || name === "tasty-code" || name === "shiki") node.properties["data-syntax"] = "";
|
|
95
|
+
else if (name === "line") node.properties.dataElement = "Line";
|
|
96
|
+
else if (node.tagName !== "pre") throw new Error(`Unsupported Shiki class ${JSON.stringify(name)}. Use semantic data modifiers and theme.styles.SyntaxHighlight for custom transformers.`);
|
|
97
|
+
delete node.properties.className;
|
|
98
|
+
if (node.tagName === "pre") node.properties.class = ["tasty-code", ...classes.filter((name) => ![
|
|
99
|
+
"astro-code",
|
|
100
|
+
"tasty-code",
|
|
101
|
+
"shiki"
|
|
102
|
+
].includes(name))].join(" ");
|
|
103
|
+
else delete node.properties.class;
|
|
104
|
+
}
|
|
91
105
|
node.children?.forEach(visit);
|
|
106
|
+
if (node.properties?.dataElement === "Line" && node.children?.every(emptyToken)) node.children = [];
|
|
92
107
|
};
|
|
93
108
|
visit(root);
|
|
94
109
|
}
|
|
95
110
|
};
|
|
111
|
+
function emptyToken(node) {
|
|
112
|
+
return node.type === "text" ? node.value === "" : node.tagName === "span" && (node.children ?? []).every(emptyToken);
|
|
113
|
+
}
|
|
96
114
|
const diffLanguages = /* @__PURE__ */ new Set(["diff", "patch"]);
|
|
97
115
|
/**
|
|
98
116
|
* The diff grammar colors individual tokens, but it does not expose a stable
|
|
99
|
-
* whole-line selector. Add semantic
|
|
117
|
+
* whole-line selector. Add semantic modifiers so insertions and deletions can
|
|
100
118
|
* receive subtle, full-width surfaces without hiding their +/- markers.
|
|
101
119
|
*/
|
|
102
120
|
const diffLineTransformer = {
|
|
103
121
|
name: "cookbook:diff-lines",
|
|
104
122
|
pre(element) {
|
|
105
|
-
if (this.options.lang && diffLanguages.has(this.options.lang))
|
|
123
|
+
if (this.options.lang && diffLanguages.has(this.options.lang)) element.properties["data-diff"] = "";
|
|
106
124
|
},
|
|
107
125
|
line(element, lineNumber) {
|
|
108
126
|
if (!this.options.lang || !diffLanguages.has(this.options.lang)) return;
|
|
109
127
|
const line = this.source.split(/\r?\n/)[lineNumber - 1] ?? "";
|
|
110
|
-
if (line.startsWith("+") && !line.startsWith("+++"))
|
|
111
|
-
else if (line.startsWith("-") && !line.startsWith("---"))
|
|
128
|
+
if (line.startsWith("+") && !line.startsWith("+++")) element.properties["data-inserted"] = "";
|
|
129
|
+
else if (line.startsWith("-") && !line.startsWith("---")) element.properties["data-deleted"] = "";
|
|
112
130
|
}
|
|
113
131
|
};
|
|
114
132
|
/**
|
|
@@ -123,7 +141,7 @@ function cookbookShikiConfig(config) {
|
|
|
123
141
|
const hasTsx = languages.some((language) => language === "tsx" || typeof language === "object" && language !== null && "name" in language && language.name === "tsx");
|
|
124
142
|
if (!transformers.includes(bashPlaceholderTransformer)) transformers.push(bashPlaceholderTransformer);
|
|
125
143
|
if (!transformers.includes(diffLineTransformer)) transformers.push(diffLineTransformer);
|
|
126
|
-
if (!transformers.includes(
|
|
144
|
+
if (!transformers.includes(tastyModifiersTransformer)) transformers.push(tastyModifiersTransformer);
|
|
127
145
|
return {
|
|
128
146
|
...config,
|
|
129
147
|
langs: hasTsx ? languages : [...languages, "tsx"],
|