@tenphi/renderer 0.21.0 → 0.21.2

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.
Files changed (122) hide show
  1. package/dist/component-styles-DstqPFf3.js +21 -0
  2. package/dist/component-styles-DstqPFf3.js.map +1 -0
  3. package/dist/components/Banner.styles.js +19 -0
  4. package/dist/components/Button.styles.d.ts +9 -0
  5. package/dist/components/Button.styles.js +14 -0
  6. package/dist/components/Callout.astro +1 -1
  7. package/dist/components/Callout.styles.js +54 -0
  8. package/dist/components/Card.astro +4 -4
  9. package/dist/components/Card.styles.js +64 -0
  10. package/dist/components/CodeGroup.astro +9 -4
  11. package/dist/components/CodeGroup.styles.js +27 -0
  12. package/dist/components/Document.styles.js +230 -0
  13. package/dist/components/EditLink.astro +1 -1
  14. package/dist/components/Footer.styles.js +45 -0
  15. package/dist/components/Header.styles.js +96 -0
  16. package/dist/components/HeaderFrame.styles.js +20 -0
  17. package/dist/components/HeaderLinks.astro +2 -2
  18. package/dist/components/HeaderLinks.styles.js +149 -0
  19. package/dist/components/Hero.styles.js +129 -0
  20. package/dist/components/LanguageSelect.styles.js +169 -0
  21. package/dist/components/LastUpdated.astro +1 -1
  22. package/dist/components/Logo.astro +4 -8
  23. package/dist/components/Logo.styles.js +27 -0
  24. package/dist/components/MainContent.styles.js +38 -0
  25. package/dist/components/MainPane.styles.js +19 -0
  26. package/dist/components/MarkdownAlert.styles.js +61 -0
  27. package/dist/components/MarkdownCodeBlock.styles.js +131 -0
  28. package/dist/components/MarkdownContent.styles.js +231 -0
  29. package/dist/components/MarkdownHeading.styles.js +117 -0
  30. package/dist/components/MarkdownInlineCode.styles.js +19 -0
  31. package/dist/components/MarkdownTable.styles.js +58 -0
  32. package/dist/components/Mermaid.styles.js +50 -0
  33. package/dist/components/MermaidSource.styles.js +21 -0
  34. package/dist/components/MobileMenuFooter.styles.js +27 -0
  35. package/dist/components/MobileMenuToggle.styles.js +49 -0
  36. package/dist/components/MobileNavigationTabs.astro +1 -2
  37. package/dist/components/MobileNavigationTabs.styles.js +88 -0
  38. package/dist/components/MobileTableOfContents.styles.js +59 -0
  39. package/dist/components/PackageVersion.astro +1 -2
  40. package/dist/components/PackageVersion.styles.js +23 -0
  41. package/dist/components/PageActions.astro +2 -2
  42. package/dist/components/PageActions.styles.js +51 -0
  43. package/dist/components/PageFrame.styles.js +34 -0
  44. package/dist/components/Pagination.astro +3 -2
  45. package/dist/components/Pagination.styles.js +126 -0
  46. package/dist/components/Preview.astro +2 -6
  47. package/dist/components/Preview.styles.js +78 -0
  48. package/dist/components/Search.styles.js +132 -0
  49. package/dist/components/SearchButton.styles.js +68 -0
  50. package/dist/components/SearchResults.styles.js +200 -0
  51. package/dist/components/SelectPopover.astro +1 -0
  52. package/dist/components/Sidebar.styles.js +309 -0
  53. package/dist/components/SiteLogo.astro +1 -2
  54. package/dist/components/SiteLogo.styles.js +32 -0
  55. package/dist/components/SiteTitle.astro +1 -1
  56. package/dist/components/SkipLink.styles.js +24 -0
  57. package/dist/components/SocialIcons.styles.js +36 -0
  58. package/dist/components/Steps.astro +2 -2
  59. package/dist/components/Steps.styles.js +25 -0
  60. package/dist/components/SyntaxHighlight.styles.js +87 -0
  61. package/dist/components/Tab.astro +1 -1
  62. package/dist/components/Tab.styles.js +30 -0
  63. package/dist/components/TableOfContents.styles.js +62 -0
  64. package/dist/components/TableOfContentsLayout.styles.js +38 -0
  65. package/dist/components/Tabs.astro +1 -1
  66. package/dist/components/Tabs.styles.js +60 -0
  67. package/dist/components/ThemeSelect.styles.js +177 -0
  68. package/dist/components/TopNavigation.styles.js +52 -0
  69. package/dist/components/VersionSwitcher.astro +2 -2
  70. package/dist/components/VersionSwitcher.styles.js +45 -0
  71. package/dist/components/component-styles.test.ts +0 -10
  72. package/dist/components/component-styles.ts +0 -7
  73. package/dist/components/inherit-component-parts.d.ts +1 -0
  74. package/dist/components/inherit-component-parts.js +7 -0
  75. package/dist/components/select-popover-styles.js +34 -16
  76. package/dist/components/tasty-states.js +13 -1
  77. package/dist/define-component-BP4YwMak.js +28 -0
  78. package/dist/define-component-BP4YwMak.js.map +1 -0
  79. package/dist/define-component.d.ts +17 -0
  80. package/dist/define-component.d.ts.map +1 -0
  81. package/dist/define-component.js +2 -0
  82. package/dist/eslint-plugin.d.ts +5 -0
  83. package/dist/eslint-plugin.d.ts.map +1 -1
  84. package/dist/eslint-plugin.js +26 -3
  85. package/dist/eslint-plugin.js.map +1 -1
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/index.js +7 -3
  88. package/dist/index.js.map +1 -1
  89. package/dist/overrides/Footer.astro +6 -5
  90. package/dist/overrides/Header.astro +13 -17
  91. package/dist/overrides/Hero.astro +3 -2
  92. package/dist/overrides/LanguageSelect.astro +3 -3
  93. package/dist/overrides/MarkdownContent.astro +7 -1
  94. package/dist/overrides/MobileMenuFooter.astro +2 -5
  95. package/dist/overrides/MobileMenuToggle.astro +4 -3
  96. package/dist/overrides/MobileTableOfContents.astro +2 -2
  97. package/dist/overrides/PageFrame.astro +9 -11
  98. package/dist/overrides/Search.astro +13 -9
  99. package/dist/overrides/Sidebar.astro +4 -1
  100. package/dist/overrides/SocialIcons.astro +2 -2
  101. package/dist/overrides/ThemeSelect.astro +9 -3
  102. package/dist/routes/Page.astro +22 -11
  103. package/dist/styling.d.ts +5 -10
  104. package/dist/styling.d.ts.map +1 -1
  105. package/dist/styling.js +18 -11
  106. package/dist/styling.js.map +1 -1
  107. package/dist/tasty-states-_JhxFdK1.js +47 -0
  108. package/dist/tasty-states-_JhxFdK1.js.map +1 -0
  109. package/dist/theme/defaults.d.ts.map +1 -1
  110. package/dist/theme/defaults.js +22 -1
  111. package/dist/theme/defaults.js.map +1 -1
  112. package/dist/theme/tasty-config.d.ts +23 -1
  113. package/dist/theme/tasty-config.d.ts.map +1 -1
  114. package/dist/theme/tasty-config.js +23 -1
  115. package/dist/theme/tasty-config.js.map +1 -1
  116. package/package.json +4 -4
  117. package/dist/components/GlobalStyles.js +0 -1792
  118. package/dist/components/LayoutComponents.js +0 -872
  119. package/dist/components/TastyComponents.js +0 -269
  120. package/dist/components/customize-component.js +0 -8
  121. package/dist/tasty-states-rTLFy26t.js +0 -57
  122. package/dist/tasty-states-rTLFy26t.js.map +0 -1
@@ -0,0 +1,49 @@
1
+ import { configureCookbookStates } from "./tasty-states.js";
2
+ import { extendComponent } from "../define-component.js";
3
+ import { Button } from "./Button.styles.js";
4
+
5
+ configureCookbookStates();
6
+
7
+ export const MobileMenuToggleRoot = extendComponent(
8
+ "MobileMenuToggle",
9
+ Button,
10
+ {
11
+ "data-element": "MobileMenuToggle",
12
+ styles: {
13
+ color: { ":hover": "#text", ":active": "#accent-text" },
14
+ display: { "": "none", "@mobile": "flex" },
15
+ inlineSize: "(100% + ($docs-nav-pad-x * 2))",
16
+ inlineMargin: "(-1 * $docs-nav-pad-x)",
17
+ blockSize: "0 3rem initial",
18
+ flexShrink: "0",
19
+ padding: "0 $docs-nav-pad-x",
20
+ border: "0",
21
+ blockBorder: "$border-width solid #border start",
22
+ radius: "0",
23
+ fill: "#clear",
24
+ preset: "navigation",
25
+ textAlign: "start",
26
+ Icon: {
27
+ $: "> svg",
28
+ flexShrink: "0",
29
+ inlineSize: "1.125rem",
30
+ blockSize: "1.125rem",
31
+ },
32
+ Section: {
33
+ $: ".td-menu-button__section",
34
+ overflow: "hidden",
35
+ textOverflow: "ellipsis",
36
+ whiteSpace: "nowrap",
37
+ inlineSize: "max 40%",
38
+ },
39
+ Page: {
40
+ $: ".td-menu-button__page",
41
+ overflow: "hidden",
42
+ textOverflow: "ellipsis",
43
+ whiteSpace: "nowrap",
44
+ color: "#text",
45
+ preset: "navigation / strong",
46
+ },
47
+ },
48
+ },
49
+ );
@@ -8,7 +8,7 @@ import { messages } from "../localization.js";
8
8
  import { content } from "virtual:cookbook/config";
9
9
  import { layout as configuredLayout } from "virtual:cookbook/layout";
10
10
  import { activeNavigationTab, navigationPath } from "../navigation.js";
11
- import { MobileNavigationTabsRoot } from "./LayoutComponents.js";
11
+ import { MobileNavigationTabsRoot } from "./MobileNavigationTabs.styles.js";
12
12
 
13
13
  interface Props {
14
14
  base?: string;
@@ -45,7 +45,6 @@ const ui = messages(Astro.locals.cookbookRoute?.lang ?? "en", content);
45
45
  <MobileNavigationTabsRoot
46
46
  className="td-mobile-tabs cookbook-print-hidden"
47
47
  aria-label={ui.sections}
48
- data-tasty-anatomy="MobileNavigationTabs"
49
48
  >
50
49
  <details>
51
50
  <summary aria-label={ui.chooseSection}>
@@ -0,0 +1,88 @@
1
+ import { configureCookbookStates } from "./tasty-states.js";
2
+ import { defineComponent } from "../define-component.js";
3
+
4
+ configureCookbookStates();
5
+
6
+ export const MobileNavigationTabsRoot = defineComponent(
7
+ "MobileNavigationTabs",
8
+ {
9
+ as: "nav",
10
+ "data-element": "MobileNavigationTabs",
11
+ styles: {
12
+ display: "grid",
13
+ hide: { "": false, "@desktop": true },
14
+ gap: "$gap",
15
+ blockMargin: "0",
16
+ Label: {
17
+ $: ".td-mobile-tabs__label",
18
+ overflow: "hidden",
19
+ textOverflow: "ellipsis",
20
+ whiteSpace: "nowrap",
21
+ },
22
+ Trigger: {
23
+ $: "summary",
24
+ display: "flex",
25
+ alignItems: "center",
26
+ justifyContent: "space-between",
27
+ gap: "$gap",
28
+ blockSize: "min 2.75rem",
29
+ padding: "$gap ($gap * 1.25)",
30
+ border: true,
31
+ radius: "$radius",
32
+ color: "#text-soft",
33
+ fill: "#surface",
34
+ preset: "navigation",
35
+ listStyle: "none",
36
+ },
37
+ Marker: {
38
+ $: "summary::marker, summary::-webkit-details-marker",
39
+ hide: true,
40
+ },
41
+ Caret: { $: "summary > svg", flexShrink: "0" },
42
+ ExpandedCaret: {
43
+ $: "details > summary > svg",
44
+ rotate: {
45
+ "": null,
46
+ "@own(:is(details[open] > summary > svg))": "180deg",
47
+ },
48
+ },
49
+ List: {
50
+ $: "ul",
51
+ display: "grid",
52
+ gap: "1bw",
53
+ padding: "$gap",
54
+ blockMargin: "$gap start",
55
+ margin: "$gap 0 0",
56
+ listStyle: "none",
57
+ border: true,
58
+ radius: "$radius",
59
+ fill: "#surface",
60
+ },
61
+ Item: { $: "li", margin: "0" },
62
+ Link: {
63
+ $: "a",
64
+ display: "flex",
65
+ alignItems: "center",
66
+ blockSize: "min 2.25rem",
67
+ padding: "($gap * 0.75) ($gap * 1.25)",
68
+ color: "#text-soft",
69
+ preset: "navigation",
70
+ textDecoration: "none",
71
+ radius: "$radius",
72
+ },
73
+ HoverLink: {
74
+ $: "a",
75
+ color: { "": null, "@own(:hover)": "#text" },
76
+ fill: { "": null, "@own(:hover)": "#surface-2-hover" },
77
+ },
78
+ CurrentLink: {
79
+ $: "a",
80
+ color: { "": null, '@own([aria-current="page"])': "#accent-text" },
81
+ fill: {
82
+ "": null,
83
+ '@own([aria-current="page"])': "#accent-surface-subtle",
84
+ },
85
+ },
86
+ },
87
+ },
88
+ );
@@ -0,0 +1,59 @@
1
+ import { configureCookbookStates } from "./tasty-states.js";
2
+ import { defineComponent } from "../define-component.js";
3
+
4
+ configureCookbookStates();
5
+
6
+ export const MobileTableOfContentsRoot = defineComponent(
7
+ "MobileTableOfContents",
8
+ {
9
+ as: "cookbook-mobile-toc",
10
+ "data-element": "MobileTableOfContents",
11
+ styles: {
12
+ display: "block",
13
+ hide: { "": true, "@narrow-layout": false },
14
+ padding: "$gap $docs-sidebar-pad-x",
15
+ blockBorder: "$border-width solid #border end",
16
+ fill: "#surface",
17
+ Summary: {
18
+ $: "summary",
19
+ padding: "$gap",
20
+ color: "#text",
21
+ preset: "small / strong",
22
+ cursor: "pointer",
23
+ radius: "$radius",
24
+ },
25
+ List: {
26
+ $: "ul",
27
+ listStyle: "none",
28
+ padding: "0",
29
+ margin: "0",
30
+ display: "grid",
31
+ gap: "2px",
32
+ },
33
+ NestedList: { $: "ul ul", inlinePadding: "($gap * 2) start" },
34
+ Item: { $: "li", listStyle: "none", margin: "0", padding: "0" },
35
+ Link: {
36
+ $: "a",
37
+ display: "block",
38
+ padding: "$gap",
39
+ color: "#text-soft",
40
+ preset: "small",
41
+ radius: "$radius",
42
+ textDecoration: "none",
43
+ },
44
+ HoverLink: {
45
+ $: "a",
46
+ fill: { "": null, "@own(:hover)": "#surface-2" },
47
+ color: { "": null, "@own(:hover)": "#text" },
48
+ },
49
+ Focus: {
50
+ $: "a, summary",
51
+ outline: {
52
+ "": null,
53
+ "@own(:is(a:focus-visible)) | @own(:is(summary:focus-visible))":
54
+ "2px solid #focus / 2px",
55
+ },
56
+ },
57
+ },
58
+ },
59
+ );
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  import { messages } from "../localization.js";
3
3
  import { content } from "virtual:cookbook/config";
4
- import { PackageVersionRoot } from "./LayoutComponents.js";
4
+ import { PackageVersionRoot } from "./PackageVersion.styles.js";
5
5
 
6
6
  interface Props {
7
7
  version?: string;
@@ -17,7 +17,6 @@ const ui = messages(Astro.locals.cookbookRoute?.lang ?? "en", content);
17
17
  <PackageVersionRoot
18
18
  className="td-package-version"
19
19
  aria-label={`${ui.version} ${version}`}
20
- data-tasty-anatomy="PackageVersion"
21
20
  >
22
21
  {label}
23
22
  </PackageVersionRoot>
@@ -0,0 +1,23 @@
1
+ import { configureCookbookStates } from "./tasty-states.js";
2
+ import { defineComponent } from "../define-component.js";
3
+
4
+ configureCookbookStates();
5
+
6
+ export const PackageVersionRoot = defineComponent("PackageVersion", {
7
+ as: "span",
8
+ "data-element": "PackageVersion",
9
+ styles: {
10
+ display: "inline-flex",
11
+ hide: { "": false, "@compact": true },
12
+ alignItems: "center",
13
+ flexShrink: "0",
14
+ blockSize: "min 1.5rem",
15
+ inlinePadding: "($gap * 0.75)",
16
+ color: "#text-soft",
17
+ fill: "#surface-2",
18
+ border: true,
19
+ radius: "999px",
20
+ preset: "small",
21
+ whiteSpace: "nowrap",
22
+ },
23
+ });
@@ -1,5 +1,5 @@
1
1
  ---
2
- import { PageActionsRoot } from "./LayoutComponents.js";
2
+ import { PageActionsRoot } from "./PageActions.styles.js";
3
3
  import { content } from "virtual:cookbook/config";
4
4
  import { navigationPath } from "../navigation.js";
5
5
  import { agentPagePath } from "../page-metadata.js";
@@ -13,7 +13,7 @@ const enabled =
13
13
 
14
14
  {
15
15
  enabled && (
16
- <PageActionsRoot data-tasty-anatomy="PageActions">
16
+ <PageActionsRoot>
17
17
  <button type="button" data-copy-page={agentPagePath(route, content.base)}>
18
18
  {ui.copyPage}
19
19
  </button>
@@ -0,0 +1,51 @@
1
+ import { configureCookbookStates } from "./tasty-states.js";
2
+ import { defineComponent } from "../define-component.js";
3
+
4
+ configureCookbookStates();
5
+
6
+ export const PageActionsRoot = defineComponent("PageActions", {
7
+ as: "cookbook-page-actions",
8
+ "data-element": "PageActions",
9
+ styles: {
10
+ display: "flex",
11
+ flow: "row wrap",
12
+ alignItems: "center",
13
+ gap: "$gap",
14
+ preset: "small",
15
+ Control: {
16
+ $: "button, a",
17
+ display: "inline-flex",
18
+ alignItems: "center",
19
+ padding: "$gap ($gap * 1.5)",
20
+ border: true,
21
+ radius: "$radius",
22
+ color: "#text",
23
+ fill: "#surface",
24
+ preset: "small",
25
+ textDecoration: "none",
26
+ cursor: "pointer",
27
+ },
28
+ Hover: {
29
+ $: "button, a",
30
+ fill: {
31
+ "": null,
32
+ "@own(:hover)": "#surface-2",
33
+ },
34
+ },
35
+ Focus: {
36
+ $: "button, a",
37
+ outline: {
38
+ "": null,
39
+ "@own(:focus-visible)": "2px solid #focus / 2px",
40
+ },
41
+ },
42
+ Pending: {
43
+ $: "button",
44
+ cursor: { "": null, '@own([aria-disabled="true"])': "wait" },
45
+ },
46
+ Status: {
47
+ $: "*",
48
+ color: { "": null, "@own([role=status])": "#text-soft" },
49
+ },
50
+ },
51
+ });
@@ -0,0 +1,34 @@
1
+ import { configureCookbookStates } from "./tasty-states.js";
2
+ import { defineComponent } from "../define-component.js";
3
+
4
+ configureCookbookStates();
5
+
6
+ export const PageFrameRoot = defineComponent("PageFrame", {
7
+ as: "div",
8
+ "data-element": "PageFrame",
9
+ styles: {
10
+ display: "flex",
11
+ flow: "column",
12
+ blockSize: "min 100vh",
13
+ MainFrame: {
14
+ $: "> .main-frame",
15
+ inlineSize: { "": "0 100%", "@desktop": "min(100%, $layout-width)" },
16
+ inlineMargin: "auto",
17
+ blockPadding: "$docs-nav-height start",
18
+ inlinePadding: "0 start",
19
+ },
20
+ SidebarFrame: {
21
+ $: "& > .main-frame",
22
+ inlinePadding: {
23
+ "": null,
24
+ "[data-has-sidebar]": "$sidebar-width start",
25
+ "([data-has-sidebar]) & (@mobile)": "0 start",
26
+ },
27
+ },
28
+ Columns: {
29
+ $: "> .main-frame > div",
30
+ display: { "": "flex", "@narrow-layout": "block" },
31
+ inlineSize: "min 0",
32
+ },
33
+ },
34
+ });
@@ -1,11 +1,12 @@
1
1
  ---
2
+ import { PaginationRoot } from "./Pagination.styles.js";
2
3
  const { dir, pagination } = Astro.locals.cookbookRoute;
3
4
  const { prev, next } = pagination;
4
5
  ---
5
6
 
6
7
  {
7
8
  (next || prev) && (
8
- <div class="pagination-links" dir={dir} data-tasty-anatomy="Pagination">
9
+ <PaginationRoot className="pagination-links" dir={dir}>
9
10
  {next && (
10
11
  <a href={next.href} rel="next">
11
12
  <span>
@@ -24,6 +25,6 @@ const { prev, next } = pagination;
24
25
  </span>
25
26
  </a>
26
27
  )}
27
- </div>
28
+ </PaginationRoot>
28
29
  )
29
30
  }
@@ -0,0 +1,126 @@
1
+ import arrowLeftIcon from "../icons/arrow-left.svg?raw";
2
+ import arrowRightIcon from "../icons/arrow-right.svg?raw";
3
+ import { svgIconUrl } from "./svg-icon.js";
4
+ import { configureCookbookStates } from "./tasty-states.js";
5
+ import { defineComponent } from "../define-component.js";
6
+
7
+ configureCookbookStates();
8
+
9
+ export const PaginationRoot = defineComponent("Pagination", {
10
+ as: "div",
11
+ "data-element": "Pagination",
12
+ styles: {
13
+ display: { "": "grid", "@media:print": "none" },
14
+ gap: "($gap * 2)",
15
+ gridColumns: { "": "repeat(2, minmax(0, 1fr))", "@small": "1fr" },
16
+ Link: {
17
+ $: "a",
18
+ radius: "$radius",
19
+ display: "flex",
20
+ alignItems: "center",
21
+ justifyContent: "flex-start",
22
+ gap: "$gap",
23
+ inlineSize: "100%",
24
+ padding: "($gap * 2)",
25
+ // Recolor only; Link owns the border width and style, including theme overrides.
26
+ // eslint-disable-next-line tasty/prefer-shorthand-property
27
+ borderColor: "#border",
28
+ color: "#text-soft",
29
+ fill: "#surface-2",
30
+ shadow: "none",
31
+ transition: "color $transition, background-color $transition",
32
+ textDecoration: "none",
33
+ overflowWrap: "anywhere",
34
+ },
35
+ PreviousLink: {
36
+ $: "a",
37
+ gridColumn: {
38
+ "": null,
39
+ '@own([rel="prev"])': "1",
40
+ '(@own([rel="prev"])) & (@small)': "auto",
41
+ },
42
+ gridRow: {
43
+ "": null,
44
+ '@own([rel="prev"])': "1",
45
+ '(@own([rel="prev"])) & (@small)': "auto",
46
+ },
47
+ },
48
+ NextLink: {
49
+ $: "a",
50
+ justifyContent: { "": null, '@own([rel="next"])': "flex-start" },
51
+ textAlign: { "": null, '@own([rel="next"])': "end" },
52
+ gridColumn: {
53
+ "": null,
54
+ '@own([rel="next"])': "2",
55
+ '(@own([rel="next"])) & (@small)': "auto",
56
+ },
57
+ gridRow: {
58
+ "": null,
59
+ '@own([rel="next"])': "1",
60
+ '(@own([rel="next"])) & (@small)': "auto",
61
+ },
62
+ },
63
+ NextIcon: {
64
+ // Tasty 3.9.3 appends @own states after pseudo-elements, producing invalid CSS.
65
+ // eslint-disable-next-line tasty/no-state-in-selector
66
+ $: 'a[rel="next"]::before',
67
+ order: "1",
68
+ // The imported SVG is encoded at build time and never evaluated in the browser.
69
+ // eslint-disable-next-line tasty/no-runtime-styles-mutation
70
+ mask: `url("${svgIconUrl(arrowRightIcon)}") center / contain no-repeat`,
71
+ },
72
+ NextLabel: {
73
+ $: "a > span",
74
+ inlineMargin: {
75
+ "": null,
76
+ '@own(:is(a[rel="next"] > span))': "auto start",
77
+ },
78
+ textAlign: { "": null, '@own(:is(a[rel="next"] > span))': "end" },
79
+ },
80
+ HoverLink: {
81
+ $: "a",
82
+ border: { "": null, "@own(:hover)": "$border-width solid #border" },
83
+ fill: { "": null, "@own(:hover)": "#surface-2-hover" },
84
+ },
85
+ ActiveLink: {
86
+ $: "a",
87
+ fill: { "": null, "@own(:active)": "#surface-2-pressed" },
88
+ },
89
+ Title: { $: ".link-title", color: "#heading", preset: "h5" },
90
+ LoneNextLink: {
91
+ // Preserve the conditional scope of this empty legacy customization hook.
92
+ // eslint-disable-next-line tasty/no-state-in-selector
93
+ $: 'a[rel="next"]:only-child',
94
+ },
95
+ Icon: {
96
+ $: "a::before",
97
+ content: '""',
98
+ display: "block",
99
+ flexGrow: "0",
100
+ flexShrink: "0",
101
+ flexBasis: "auto",
102
+ inlineSize: "1.25rem",
103
+ blockSize: "1.25rem",
104
+ fill: "#current",
105
+ // The imported SVG is encoded at build time and never evaluated in the browser.
106
+ // eslint-disable-next-line tasty/no-runtime-styles-mutation
107
+ mask: `url("${svgIconUrl(arrowLeftIcon)}") center / contain no-repeat`,
108
+ },
109
+ PreviousIconRtl: {
110
+ // Tasty 3.9.3 appends @own states after pseudo-elements, producing invalid CSS.
111
+ // eslint-disable-next-line tasty/no-state-in-selector
112
+ $: '&:is([dir="rtl"] *) a[rel="prev"]::before',
113
+ // The imported SVG is encoded at build time and never evaluated in the browser.
114
+ // eslint-disable-next-line tasty/no-runtime-styles-mutation
115
+ mask: `url("${svgIconUrl(arrowRightIcon)}") center / contain no-repeat`,
116
+ },
117
+ NextIconRtl: {
118
+ // Tasty 3.9.3 appends @own states after pseudo-elements, producing invalid CSS.
119
+ // eslint-disable-next-line tasty/no-state-in-selector
120
+ $: '&:is([dir="rtl"] *) a[rel="next"]::before',
121
+ // The imported SVG is encoded at build time and never evaluated in the browser.
122
+ // eslint-disable-next-line tasty/no-runtime-styles-mutation
123
+ mask: `url("${svgIconUrl(arrowLeftIcon)}") center / contain no-repeat`,
124
+ },
125
+ },
126
+ });
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  import { messages, requestLanguage } from "../localization.js";
3
3
  import { content } from "virtual:cookbook/config";
4
- import { PreviewRoot } from "./TastyComponents.js";
4
+ import { PreviewRoot } from "./Preview.styles.js";
5
5
 
6
6
  import type { PreviewProps as Props } from "./props.js";
7
7
 
@@ -13,11 +13,7 @@ const ui = messages(
13
13
  );
14
14
  ---
15
15
 
16
- <PreviewRoot
17
- className="td-preview not-content"
18
- aria-label={title}
19
- data-tasty-anatomy="Preview"
20
- >
16
+ <PreviewRoot className="td-preview not-content" aria-label={title}>
21
17
  <PreviewRoot.Caption><strong>{title}</strong></PreviewRoot.Caption>
22
18
  <PreviewRoot.Stage className="td-preview__stage">
23
19
  <PreviewRoot.Frame
@@ -0,0 +1,78 @@
1
+ import { configureCookbookStates } from "./tasty-states.js";
2
+ import { defineComponent } from "../define-component.js";
3
+
4
+ configureCookbookStates();
5
+
6
+ const previewElements = {
7
+ Caption: "figcaption",
8
+ Stage: "div",
9
+ Frame: "iframe",
10
+ Code: "details",
11
+ Summary: "summary",
12
+ Pre: "pre",
13
+ };
14
+
15
+ export const PreviewRoot = defineComponent("Preview", {
16
+ as: "figure",
17
+ "data-element": "Preview",
18
+ styles: {
19
+ margin: "0",
20
+ overflow: "clip",
21
+ color: "#text",
22
+ border: true,
23
+ radius: "1cr",
24
+ fill: "#surface",
25
+ shadow: "0 1px 2px #shadow",
26
+
27
+ Caption: {
28
+ padding: "1.5x 2x",
29
+ preset: "small",
30
+ fill: "#surface-2",
31
+ },
32
+ Stage: {
33
+ padding: "2x",
34
+ fill: "#surface",
35
+ },
36
+ Frame: {
37
+ display: "block",
38
+ width: "100%",
39
+ height: "min 10rem",
40
+ border: "0",
41
+ fill: "#surface",
42
+ },
43
+ Code: {
44
+ border: "1bw top #border",
45
+ },
46
+ Summary: {
47
+ padding: "1.5x 2x",
48
+ preset: "small",
49
+ fill: "#surface-2",
50
+ cursor: "pointer",
51
+ transition: "fill $transition",
52
+ },
53
+ HoverSummary: {
54
+ $: "> details > summary",
55
+ fill: {
56
+ "": null,
57
+ "@own(:is(details > summary:hover))": "#surface-2-hover",
58
+ },
59
+ },
60
+ ActiveSummary: {
61
+ $: "> details > summary",
62
+ fill: {
63
+ "": null,
64
+ "@own(:is(details > summary:active))": "#surface-2-pressed",
65
+ },
66
+ },
67
+ Pre: {
68
+ margin: "0",
69
+ padding: "2x",
70
+ overflowX: "auto",
71
+ color: "#syntax-text",
72
+ fill: "#syntax-bg",
73
+ preset: "code",
74
+ radius: "0",
75
+ },
76
+ },
77
+ elements: previewElements,
78
+ });