@tenphi/renderer 0.21.1 → 0.21.4

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 (139) hide show
  1. package/dist/client/code-copy.js +1 -1
  2. package/dist/client/heading-links.js +1 -1
  3. package/dist/client/page-copy.js +1 -1
  4. package/dist/component-styles-DstqPFf3.js +21 -0
  5. package/dist/component-styles-DstqPFf3.js.map +1 -0
  6. package/dist/components/Banner.styles.js +19 -0
  7. package/dist/components/Button.styles.d.ts +9 -0
  8. package/dist/components/Button.styles.js +14 -0
  9. package/dist/components/Callout.astro +1 -1
  10. package/dist/components/Callout.styles.js +54 -0
  11. package/dist/components/Card.astro +4 -4
  12. package/dist/components/Card.styles.js +64 -0
  13. package/dist/components/CodeGroup.astro +9 -4
  14. package/dist/components/CodeGroup.styles.js +27 -0
  15. package/dist/components/Document.styles.js +230 -0
  16. package/dist/components/EditLink.astro +1 -1
  17. package/dist/components/Footer.styles.js +45 -0
  18. package/dist/components/Header.styles.js +96 -0
  19. package/dist/components/HeaderFrame.styles.js +20 -0
  20. package/dist/components/HeaderLinks.astro +2 -2
  21. package/dist/components/HeaderLinks.styles.js +149 -0
  22. package/dist/components/Hero.styles.js +129 -0
  23. package/dist/components/LanguageSelect.styles.js +169 -0
  24. package/dist/components/LastUpdated.astro +1 -1
  25. package/dist/components/Logo.astro +4 -8
  26. package/dist/components/Logo.styles.js +27 -0
  27. package/dist/components/MainContent.styles.js +38 -0
  28. package/dist/components/MainPane.styles.js +19 -0
  29. package/dist/components/MarkdownAlert.styles.js +61 -0
  30. package/dist/components/MarkdownCodeBlock.styles.js +131 -0
  31. package/dist/components/MarkdownContent.styles.js +231 -0
  32. package/dist/components/MarkdownHeading.styles.js +117 -0
  33. package/dist/components/MarkdownInlineCode.styles.js +19 -0
  34. package/dist/components/MarkdownTable.styles.js +58 -0
  35. package/dist/components/Mermaid.styles.js +50 -0
  36. package/dist/components/MermaidSource.styles.js +21 -0
  37. package/dist/components/MobileMenuFooter.styles.js +27 -0
  38. package/dist/components/MobileMenuToggle.styles.js +49 -0
  39. package/dist/components/MobileNavigationTabs.astro +1 -2
  40. package/dist/components/MobileNavigationTabs.styles.js +88 -0
  41. package/dist/components/MobileTableOfContents.styles.js +59 -0
  42. package/dist/components/PackageVersion.astro +1 -2
  43. package/dist/components/PackageVersion.styles.js +23 -0
  44. package/dist/components/PageActions.astro +2 -2
  45. package/dist/components/PageActions.styles.js +51 -0
  46. package/dist/components/PageFrame.styles.js +34 -0
  47. package/dist/components/Pagination.astro +3 -2
  48. package/dist/components/Pagination.styles.js +126 -0
  49. package/dist/components/Preview.astro +2 -6
  50. package/dist/components/Preview.styles.js +78 -0
  51. package/dist/components/Search.styles.js +132 -0
  52. package/dist/components/SearchButton.styles.js +68 -0
  53. package/dist/components/SearchResults.styles.js +200 -0
  54. package/dist/components/SelectPopover.astro +1 -0
  55. package/dist/components/Sidebar.styles.js +309 -0
  56. package/dist/components/SiteLogo.astro +1 -2
  57. package/dist/components/SiteLogo.styles.js +32 -0
  58. package/dist/components/SiteTitle.astro +1 -1
  59. package/dist/components/SkipLink.styles.js +24 -0
  60. package/dist/components/SocialIcons.styles.js +36 -0
  61. package/dist/components/Steps.astro +2 -2
  62. package/dist/components/Steps.styles.js +25 -0
  63. package/dist/components/SyntaxHighlight.styles.js +87 -0
  64. package/dist/components/Tab.astro +1 -1
  65. package/dist/components/Tab.styles.js +30 -0
  66. package/dist/components/TableOfContents.styles.js +62 -0
  67. package/dist/components/TableOfContentsLayout.styles.js +38 -0
  68. package/dist/components/Tabs.astro +1 -1
  69. package/dist/components/Tabs.styles.js +60 -0
  70. package/dist/components/ThemeSelect.styles.js +177 -0
  71. package/dist/components/TopNavigation.styles.js +52 -0
  72. package/dist/components/VersionSwitcher.astro +2 -2
  73. package/dist/components/VersionSwitcher.styles.js +45 -0
  74. package/dist/components/component-styles.test.ts +0 -10
  75. package/dist/components/component-styles.ts +0 -7
  76. package/dist/components/inherit-component-parts.d.ts +1 -0
  77. package/dist/components/inherit-component-parts.js +7 -0
  78. package/dist/components/select-popover-styles.js +34 -16
  79. package/dist/components/tasty-states.js +13 -1
  80. package/dist/define-component-BP4YwMak.js +28 -0
  81. package/dist/define-component-BP4YwMak.js.map +1 -0
  82. package/dist/define-component.d.ts +17 -0
  83. package/dist/define-component.d.ts.map +1 -0
  84. package/dist/define-component.js +2 -0
  85. package/dist/eslint-plugin.d.ts +5 -0
  86. package/dist/eslint-plugin.d.ts.map +1 -1
  87. package/dist/eslint-plugin.js +26 -3
  88. package/dist/eslint-plugin.js.map +1 -1
  89. package/dist/index.d.ts.map +1 -1
  90. package/dist/index.js +11 -6
  91. package/dist/index.js.map +1 -1
  92. package/dist/localization.d.ts +2 -42
  93. package/dist/localization.d.ts.map +1 -1
  94. package/dist/localization.js +1 -87
  95. package/dist/localization.js.map +1 -1
  96. package/dist/messages-BqBGDIoP.js +143 -0
  97. package/dist/messages-BqBGDIoP.js.map +1 -0
  98. package/dist/messages-ClTf2nFf.d.ts +52 -0
  99. package/dist/messages-ClTf2nFf.d.ts.map +1 -0
  100. package/dist/{messages-B_3xUzUb.js → messages-bS8G9Pj8.js} +2 -2
  101. package/dist/{messages-B_3xUzUb.js.map → messages-bS8G9Pj8.js.map} +1 -1
  102. package/dist/overrides/Footer.astro +6 -5
  103. package/dist/overrides/Header.astro +13 -17
  104. package/dist/overrides/Hero.astro +3 -2
  105. package/dist/overrides/LanguageSelect.astro +3 -3
  106. package/dist/overrides/MarkdownContent.astro +7 -1
  107. package/dist/overrides/MobileMenuFooter.astro +2 -5
  108. package/dist/overrides/MobileMenuToggle.astro +4 -3
  109. package/dist/overrides/MobileTableOfContents.astro +2 -2
  110. package/dist/overrides/PageFrame.astro +9 -11
  111. package/dist/overrides/Search.astro +13 -9
  112. package/dist/overrides/Sidebar.astro +4 -1
  113. package/dist/overrides/SocialIcons.astro +2 -2
  114. package/dist/overrides/ThemeSelect.astro +9 -3
  115. package/dist/routes/Page.astro +22 -11
  116. package/dist/styling.d.ts +5 -10
  117. package/dist/styling.d.ts.map +1 -1
  118. package/dist/styling.js +18 -11
  119. package/dist/styling.js.map +1 -1
  120. package/dist/tasty-states-_JhxFdK1.js +47 -0
  121. package/dist/tasty-states-_JhxFdK1.js.map +1 -0
  122. package/dist/theme/defaults.d.ts.map +1 -1
  123. package/dist/theme/defaults.js +22 -1
  124. package/dist/theme/defaults.js.map +1 -1
  125. package/dist/theme/tasty-config.d.ts +23 -1
  126. package/dist/theme/tasty-config.d.ts.map +1 -1
  127. package/dist/theme/tasty-config.js +23 -1
  128. package/dist/theme/tasty-config.js.map +1 -1
  129. package/dist/ui.d.ts +2 -6
  130. package/dist/ui.js +1 -58
  131. package/package.json +4 -4
  132. package/dist/components/GlobalStyles.js +0 -1792
  133. package/dist/components/LayoutComponents.js +0 -872
  134. package/dist/components/TastyComponents.js +0 -269
  135. package/dist/components/customize-component.js +0 -8
  136. package/dist/tasty-states-rTLFy26t.js +0 -57
  137. package/dist/tasty-states-rTLFy26t.js.map +0 -1
  138. package/dist/ui.d.ts.map +0 -1
  139. package/dist/ui.js.map +0 -1
@@ -0,0 +1,38 @@
1
+ import { TASTY_SPACING_PROPERTIES } from "../theme/tasty-config.js";
2
+ import { configureCookbookStates } from "./tasty-states.js";
3
+ import { defineComponent } from "../define-component.js";
4
+
5
+ configureCookbookStates();
6
+
7
+ export const MainContentRoot = defineComponent("MainContent", {
8
+ as: "main",
9
+ "data-element": "MainContent",
10
+ styles: {
11
+ "@property": TASTY_SPACING_PROPERTIES,
12
+ padding: "0 0 5rem",
13
+ // Layout spacing is a default; generated Markdown owns prose spacing.
14
+ ContentSpacing: {
15
+ $: ":where(.content-panel > .cookbook-container) > * + *",
16
+ blockMargin: "$margin-block-start $margin-block-end",
17
+ "$margin-block-start": "($gap * 3)",
18
+ },
19
+ Container: {
20
+ $: ".content-panel > .cookbook-container",
21
+ inlineMargin: { "": "auto", "@narrow-layout": "0" },
22
+ inlineSize: "max $content-width",
23
+ },
24
+ Panel: {
25
+ $: ".content-panel",
26
+ "$padding-block-start": {
27
+ "": "($gap * 3)",
28
+ "@own(:nth-of-type(2))": "($gap * 2)",
29
+ },
30
+ "$padding-block-end": {
31
+ "": "($gap * 3)",
32
+ "@own(:first-of-type)": "($gap * 2)",
33
+ },
34
+ blockPadding: "$padding-block-start $padding-block-end",
35
+ inlinePadding: "$docs-content-pad-x",
36
+ },
37
+ },
38
+ });
@@ -0,0 +1,19 @@
1
+ import { configureCookbookStates } from "./tasty-states.js";
2
+ import { defineComponent } from "../define-component.js";
3
+
4
+ configureCookbookStates();
5
+
6
+ export const MainPaneRoot = defineComponent("MainPane", {
7
+ as: "div",
8
+ "data-element": "MainPane",
9
+ styles: {
10
+ order: { "": null, "[data-has-sidebar] & [data-has-toc]": "1" },
11
+ isolation: "isolate",
12
+ inlineSize: {
13
+ "": "0 100% initial",
14
+ "[data-has-sidebar] & [data-has-toc]":
15
+ "min(calc(100% - $sidebar-width), calc($content-width + (100% - $content-width - $sidebar-width) / 2))",
16
+ "([data-has-sidebar] & [data-has-toc]) & (@narrow-layout)": "100%",
17
+ },
18
+ },
19
+ });
@@ -0,0 +1,61 @@
1
+ import { useGlobalStyles } from "@tenphi/tasty";
2
+ import { resolveComponentStyles } from "./component-styles.js";
3
+ import { configureCookbookStates } from "./tasty-states.js";
4
+
5
+ configureCookbookStates();
6
+
7
+ export function MarkdownAlertStyles() {
8
+ useGlobalStyles(
9
+ ".cookbook-alert",
10
+ resolveComponentStyles("MarkdownAlert", {
11
+ padding: "($gap * 2) ($gap * 2.5)",
12
+ color: {
13
+ "": "#text-soft",
14
+ ".cookbook-alert--note": "#blue-text",
15
+ ".cookbook-alert--tip": "#green-text",
16
+ ".cookbook-alert--caution": "#warning-text",
17
+ ".cookbook-alert--danger": "#red-text",
18
+ },
19
+ border: {
20
+ "": true,
21
+ ".cookbook-alert--note": "#blue",
22
+ ".cookbook-alert--tip": "#green",
23
+ ".cookbook-alert--caution": "#warning",
24
+ ".cookbook-alert--danger": "#red",
25
+ },
26
+ radius: "$card-radius",
27
+ fill: {
28
+ "": "#surface-2",
29
+ ".cookbook-alert--note": "#blue-surface",
30
+ ".cookbook-alert--tip": "#green-surface",
31
+ ".cookbook-alert--caution": "#warning-surface",
32
+ ".cookbook-alert--danger": "#red-surface",
33
+ },
34
+ Title: {
35
+ $: ".cookbook-alert__title",
36
+ display: "flex",
37
+ alignItems: "center",
38
+ gap: "$gap",
39
+ "$margin-block-start": "0",
40
+ "$margin-block-end": "$gap",
41
+ blockMargin: "$margin-block-start $margin-block-end",
42
+ inlineMargin: "0",
43
+ color: "inherit",
44
+ preset: "strong",
45
+ },
46
+ FirstContent: {
47
+ $: ".cookbook-alert__content > *",
48
+ blockMargin: {
49
+ "": null,
50
+ "@own(:is(.cookbook-alert__content > :first-child))":
51
+ "$margin-block-start $margin-block-end",
52
+ },
53
+ "$margin-block-start": {
54
+ "": null,
55
+ "@own(:is(.cookbook-alert__content > :first-child))": "0",
56
+ },
57
+ },
58
+ }),
59
+ );
60
+ return null;
61
+ }
@@ -0,0 +1,131 @@
1
+ import { useGlobalStyles } from "@tenphi/tasty";
2
+ import checkIcon from "../icons/check.svg?raw";
3
+ import copyIcon from "../icons/copy.svg?raw";
4
+ import { resolveComponentStyles } from "./component-styles.js";
5
+ import { svgIconUrl } from "./svg-icon.js";
6
+ import { configureCookbookStates } from "./tasty-states.js";
7
+
8
+ configureCookbookStates();
9
+
10
+ export function MarkdownCodeBlockStyles() {
11
+ useGlobalStyles(
12
+ ':is(.cookbook-markdown-content .td-code-block, .td-code-block[data-element="MarkdownCodeBlock"])',
13
+ resolveComponentStyles("MarkdownCodeBlock", {
14
+ "$copy-button-size": "2rem",
15
+ display: "block",
16
+ position: "relative",
17
+ inlineSize: "min 0",
18
+ Pre: {
19
+ $: "> pre",
20
+ "$margin-block-start": "0",
21
+ "$margin-block-end": "0",
22
+ blockMargin: "$margin-block-start $margin-block-end",
23
+ inlineMargin: "0",
24
+ padding: "0 3.75rem 0 1rem",
25
+ // Balance a single code line around the copy control, including the border.
26
+ blockPadding:
27
+ "max(0px, ($copy-button-size - 1lh) / 2 + $gap - $border-width)",
28
+ overflowX: "auto",
29
+ color: "#syntax-text",
30
+ border: true,
31
+ fill: "#syntax-bg",
32
+ radius: "$card-radius",
33
+ tabSize: "2",
34
+ },
35
+ CopyButton: {
36
+ $: "> CopyButton",
37
+ position: "absolute",
38
+ zIndex: "1",
39
+ blockInset: "$gap start",
40
+ inlineInset: "$gap end",
41
+ "$margin-block-start": "0",
42
+ "$margin-block-end": "0",
43
+ blockMargin: "$margin-block-start $margin-block-end",
44
+ inlineMargin: "0",
45
+ display: "grid",
46
+ placeItems: "center",
47
+ inlineSize: "$copy-button-size $copy-button-size initial",
48
+ blockSize: "$copy-button-size $copy-button-size initial",
49
+ padding: "0",
50
+ color: "#text-soft",
51
+ border: true,
52
+ fill: "#surface-2",
53
+ radius: "$radius",
54
+ preset: "small / strong",
55
+ cursor: "pointer",
56
+ transition: "color $transition, fill $transition",
57
+ },
58
+ HoverCopyButton: {
59
+ $: '> [data-element="CopyButton"]',
60
+ color: { "": null, "@own(:hover)": "#text" },
61
+ fill: {
62
+ "": null,
63
+ "@own(:hover)": "#surface-2-hover",
64
+ },
65
+ },
66
+ CopiedButton: {
67
+ $: '> [data-element="CopyButton"]',
68
+ color: {
69
+ "": null,
70
+ '@own([data-copy-state="copied"])': "#green-text",
71
+ },
72
+ // Recolor only; CopyButton owns the border width and style, including theme overrides.
73
+ // eslint-disable-next-line tasty/prefer-shorthand-property
74
+ borderColor: {
75
+ "": null,
76
+ '@own([data-copy-state="copied"])': "#green",
77
+ },
78
+ },
79
+ CopyIcon: {
80
+ $: "> CopyButton > CopyIcon",
81
+ display: "block",
82
+ inlineSize: "1rem",
83
+ blockSize: "1rem",
84
+ fill: "#current",
85
+ // The imported SVG is encoded at build time and never evaluated in the browser.
86
+ // eslint-disable-next-line tasty/no-runtime-styles-mutation
87
+ mask: `url("${svgIconUrl(copyIcon)}") center / contain no-repeat`,
88
+ },
89
+ CopiedIcon: {
90
+ $: '> CopyButton > [data-element="CopyIcon"]',
91
+ mask: {
92
+ "": null,
93
+ // SVG encoding runs only during the server build.
94
+ // eslint-disable-next-line tasty/no-runtime-styles-mutation
95
+ '@own(:is([data-element="CopyButton"][data-copy-state="copied"] > [data-element="CopyIcon"]))': `url("${svgIconUrl(checkIcon)}") center / contain no-repeat`,
96
+ },
97
+ },
98
+ Code: { $: "pre code", padding: "0", color: "inherit", fill: "#clear" },
99
+ Diff: { $: "pre.td-diff", inlinePadding: "0" },
100
+ DiffCode: {
101
+ $: "pre.td-diff code",
102
+ display: "block",
103
+ inlineSize: "100% max-content initial",
104
+ // Zero line height removes gaps between block diff lines; the tight modifier would not.
105
+ // eslint-disable-next-line tasty/prefer-shorthand-property
106
+ lineHeight: "0",
107
+ },
108
+ DiffLine: {
109
+ $: "pre.td-diff > code > :is(.line)",
110
+ display: "block",
111
+ inlinePadding: "1rem",
112
+ preset: "code",
113
+ },
114
+ EmptyDiffLine: {
115
+ // Tasty 3.9.3 appends @own states after pseudo-elements, producing invalid CSS.
116
+ // eslint-disable-next-line tasty/no-state-in-selector
117
+ $: "pre.td-diff > code > .line:empty::before",
118
+ content: '"\\200b"',
119
+ },
120
+ InsertedLine: {
121
+ $: "pre.td-diff > code > .td-diff-line--inserted",
122
+ fill: "#green-surface",
123
+ },
124
+ DeletedLine: {
125
+ $: "pre.td-diff > code > .td-diff-line--deleted",
126
+ fill: "#red-surface",
127
+ },
128
+ }),
129
+ );
130
+ return null;
131
+ }
@@ -0,0 +1,231 @@
1
+ import { useGlobalStyles } from "@tenphi/tasty";
2
+ import { resolveComponentStyles } from "./component-styles.js";
3
+ import { MarkdownInlineCodeStyles } from "./MarkdownInlineCode.styles.js";
4
+ import { SyntaxHighlightStyles } from "./SyntaxHighlight.styles.js";
5
+ import { MarkdownCodeBlockStyles } from "./MarkdownCodeBlock.styles.js";
6
+ import { MermaidSourceStyles } from "./MermaidSource.styles.js";
7
+ import { MermaidStyles } from "./Mermaid.styles.js";
8
+ import { MarkdownHeadingStyles } from "./MarkdownHeading.styles.js";
9
+ import { MarkdownAlertStyles } from "./MarkdownAlert.styles.js";
10
+ import { MarkdownTableStyles } from "./MarkdownTable.styles.js";
11
+ import chevronRightIcon from "../icons/chevron-right.svg?raw";
12
+ import { svgIconUrl } from "./svg-icon.js";
13
+ import { configureCookbookStates } from "./tasty-states.js";
14
+
15
+ configureCookbookStates();
16
+
17
+ export default function MarkdownStyles() {
18
+ // Match component-root specificity so prose owns spacing inside Markdown.
19
+ useGlobalStyles(
20
+ ".cookbook-markdown-content.cookbook-markdown-content",
21
+ resolveComponentStyles("Markdown", {
22
+ preset: "prose",
23
+ Block: {
24
+ $: ":where(p), :where(ul), :where(ol), :where(dl), :where(blockquote), :where(pre), :where(table), :where(hr), :where(details)",
25
+ "$margin-block-start": { "": null, "@own(!:is(.not-content *))": "0" },
26
+ "$margin-block-end": { "": null, "@own(!:is(.not-content *))": "0" },
27
+ blockMargin: {
28
+ "": null,
29
+ "@own(!:is(.not-content *))": "$margin-block-start $margin-block-end",
30
+ },
31
+ },
32
+ // Linked Cards are block content even though their root is an anchor.
33
+ BlockSpacing: {
34
+ // Prose spacing must win over each block component's root margin.
35
+ $: "&.cookbook-markdown-content * + *",
36
+ blockMargin: {
37
+ "": null,
38
+ "(@own(:is(:not(a,strong,em,del,span,input,code,br) + *)) | @own(:is(a.td-card + *))) & (@own(!:is(a,strong,em,del,span,input,code,br,li,dt,dd,.not-content *)) | @own(:is(a.td-card)))":
39
+ "$margin-block-start $margin-block-end",
40
+ },
41
+ "$margin-block-start": {
42
+ "": null,
43
+ "(@own(:is(:not(a,strong,em,del,span,input,code,br) + *)) | @own(:is(a.td-card + *))) & (@own(!:is(a,strong,em,del,span,input,code,br,li,dt,dd,.not-content *)) | @own(:is(a.td-card)))":
44
+ "($gap * 3)",
45
+ },
46
+ },
47
+ HeadingSpacing: {
48
+ $: "* + h1, * + h2, * + h3, * + h4, * + h5, * + h6, * + .cookbook-heading-wrapper",
49
+ "$margin-block-start": {
50
+ "": null,
51
+ "@own(:is(:not(h1,h2,h3,h4,h5,h6,.cookbook-heading-wrapper) + *)) & @own(!:is(.not-content *))":
52
+ "1.5em",
53
+ },
54
+ "$margin-block-end": {
55
+ "": null,
56
+ "@own(:is(:not(h1,h2,h3,h4,h5,h6,.cookbook-heading-wrapper) + *)) & @own(!:is(.not-content *))":
57
+ "0",
58
+ },
59
+ blockMargin: {
60
+ "": null,
61
+ "@own(:is(:not(h1,h2,h3,h4,h5,h6,.cookbook-heading-wrapper) + *)) & @own(!:is(.not-content *))":
62
+ "$margin-block-start $margin-block-end",
63
+ },
64
+ },
65
+ List: {
66
+ $: ":where(ul), :where(ol)",
67
+ inlinePadding: {
68
+ "": null,
69
+ "@own(!:is(.not-content *))": "1.5rem start",
70
+ },
71
+ },
72
+ CompactItem: {
73
+ $: ":where(li + li), :where(dt + dt), :where(dt + dd), :where(dd + dd)",
74
+ "$margin-block-start": {
75
+ "": null,
76
+ "@own(!:is(.not-content *))": "($gap * 0.5)",
77
+ },
78
+ "$margin-block-end": { "": null, "@own(!:is(.not-content *))": "0" },
79
+ blockMargin: {
80
+ "": null,
81
+ "@own(!:is(.not-content *))": "$margin-block-start $margin-block-end",
82
+ },
83
+ },
84
+ ListItem: {
85
+ $: "li",
86
+ overflowWrap: { "": null, "@own(!:is(.not-content *))": "anywhere" },
87
+ },
88
+ DefinitionTerm: {
89
+ $: "dt",
90
+ preset: { "": null, "@own(!:is(.not-content *))": "strong" },
91
+ },
92
+ DefinitionDescription: {
93
+ $: "dd",
94
+ inlinePadding: {
95
+ "": null,
96
+ "@own(!:is(.not-content *))": "($gap * 2) start",
97
+ },
98
+ },
99
+ Link: {
100
+ $: "a",
101
+ color: { "": null, "@own(!:is(.not-content *))": "#accent-text" },
102
+ textUnderlineOffset: {
103
+ "": null,
104
+ "@own(!:is(.not-content *))": "0.15em",
105
+ },
106
+ },
107
+ HoverLink: {
108
+ $: "a",
109
+ color: {
110
+ "": null,
111
+ "@own(:hover) & @own(!:is(.not-content *))": "#text",
112
+ },
113
+ },
114
+ Quote: {
115
+ $: "blockquote",
116
+ inlinePadding: { "": null, "@own(!:is(.not-content *))": "2x start" },
117
+ color: { "": null, "@own(!:is(.not-content *))": "#text-soft" },
118
+ inlineBorder: {
119
+ "": null,
120
+ "@own(!:is(.not-content *))": "1bw solid #border start",
121
+ },
122
+ },
123
+ Rule: {
124
+ $: "hr",
125
+ border: { "": null, "@own(!:is(.not-content *))": "0" },
126
+ blockBorder: {
127
+ "": null,
128
+ "@own(!:is(.not-content *))": "$border-width solid #border end",
129
+ },
130
+ },
131
+ Details: {
132
+ $: "details",
133
+ inlinePadding: {
134
+ "": null,
135
+ "@own(!:is(.not-content *))": "($gap * 2) start",
136
+ },
137
+ inlineBorder: {
138
+ "": null,
139
+ "@own(!:is(.not-content *))": "2px solid #border start",
140
+ },
141
+ // Change only color; border widths and styles belong to other rules or theme overrides.
142
+ // eslint-disable-next-line tasty/prefer-shorthand-property
143
+ borderColor: { "": null, "@own(!:is(.not-content *))": "#border" },
144
+ },
145
+ HoverDetails: {
146
+ $: "details",
147
+ // Change only color; border widths and styles belong to other rules or theme overrides.
148
+ // eslint-disable-next-line tasty/prefer-shorthand-property
149
+ borderColor: {
150
+ "": null,
151
+ "(@own(![open] & :hover) | @own(:has(> summary:hover))) & @own(!:is(.not-content *))":
152
+ "#accent-text",
153
+ },
154
+ },
155
+ Summary: {
156
+ $: "summary",
157
+ display: { "": "", "@own(!:is(.not-content *))": "block" },
158
+ inlineMargin: {
159
+ "": null,
160
+ "@own(!:is(.not-content *))": "-0.5rem start",
161
+ },
162
+ inlinePadding: {
163
+ "": null,
164
+ "@own(!:is(.not-content *))": "0.5rem start",
165
+ },
166
+ color: { "": null, "@own(!:is(.not-content *))": "#text" },
167
+ preset: { "": null, "@own(!:is(.not-content *))": "strong" },
168
+ },
169
+ OpenSummary: {
170
+ $: "details > summary",
171
+ "$margin-block-start": {
172
+ "": null,
173
+ "@own(:is(details[open] > summary)) & @own(!:is(.not-content *))":
174
+ "0",
175
+ },
176
+ "$margin-block-end": {
177
+ "": null,
178
+ "@own(:is(details[open] > summary)) & @own(!:is(.not-content *))":
179
+ "($gap * 2)",
180
+ },
181
+ blockMargin: {
182
+ "": null,
183
+ "@own(:is(details[open] > summary)) & @own(!:is(.not-content *))":
184
+ "$margin-block-start $margin-block-end",
185
+ },
186
+ },
187
+ SummaryMarker: {
188
+ // Tasty 3.9.3 appends @own states after pseudo-elements, producing invalid CSS.
189
+ // eslint-disable-next-line tasty/no-state-in-selector
190
+ $: "summary:not(.not-content *)::marker, summary:not(.not-content *)::-webkit-details-marker",
191
+ hide: true,
192
+ },
193
+ SummaryIcon: {
194
+ // Tasty 3.9.3 appends @own states after pseudo-elements, producing invalid CSS.
195
+ // eslint-disable-next-line tasty/no-state-in-selector
196
+ $: "summary:not(.not-content *)::before",
197
+ content: '""',
198
+ display: "inline-block",
199
+ inlineSize: "1.25rem",
200
+ blockSize: "1.25rem",
201
+ inlineMargin: "($gap * 0.5) end",
202
+ verticalAlign: "middle",
203
+ fill: "#current",
204
+ // The imported SVG is encoded at build time and never evaluated in the browser.
205
+ // eslint-disable-next-line tasty/no-runtime-styles-mutation
206
+ mask: `url("${svgIconUrl(chevronRightIcon)}") center / contain no-repeat`,
207
+ transition: "rotate $transition",
208
+ },
209
+ OpenSummaryIcon: {
210
+ // Tasty 3.9.3 appends @own states after pseudo-elements, producing invalid CSS.
211
+ // eslint-disable-next-line tasty/no-state-in-selector
212
+ $: "details[open] > summary:not(.not-content *)::before",
213
+ rotate: "90deg",
214
+ },
215
+ Code: {
216
+ $: ":where(code)",
217
+ radius: { "": null, "@own(!:is(.not-content *))": "($radius * 0.65)" },
218
+ },
219
+ }),
220
+ );
221
+
222
+ MarkdownInlineCodeStyles();
223
+ SyntaxHighlightStyles();
224
+ MarkdownCodeBlockStyles();
225
+ MermaidSourceStyles();
226
+ MermaidStyles();
227
+ MarkdownHeadingStyles();
228
+ MarkdownAlertStyles();
229
+ MarkdownTableStyles();
230
+ return null;
231
+ }
@@ -0,0 +1,117 @@
1
+ import { useGlobalStyles } from "@tenphi/tasty";
2
+ import checkIcon from "../icons/check.svg?raw";
3
+ import { resolveComponentStyles } from "./component-styles.js";
4
+ import { svgIconUrl } from "./svg-icon.js";
5
+ import { configureCookbookStates } from "./tasty-states.js";
6
+
7
+ configureCookbookStates();
8
+
9
+ export function MarkdownHeadingStyles() {
10
+ useGlobalStyles(
11
+ ".cookbook-markdown-content .cookbook-heading-wrapper",
12
+ resolveComponentStyles("MarkdownHeading", {
13
+ position: "relative",
14
+ color: "#heading",
15
+ preset: {
16
+ "": "heading",
17
+ ".level-h1": "h1",
18
+ ".level-h2": "h2",
19
+ ".level-h3": "h3",
20
+ ".level-h4": "h4",
21
+ ".level-h5": "h5",
22
+ ".level-h6": "h6",
23
+ },
24
+ Heading: {
25
+ $: "> *",
26
+ color: { "": null, "@own(:first-child)": "inherit" },
27
+ display: { "": "", "@own(:first-child)": "inline" },
28
+ inlinePadding: {
29
+ "": null,
30
+ "@own(:first-child)": "0 end",
31
+ "(@own(:first-child)) & (@mobile)": "1.75rem end",
32
+ },
33
+ },
34
+ Link: {
35
+ $: "> .cookbook-anchor-link",
36
+ position: { "": "absolute", "@mobile": "relative" },
37
+ blockInset: {
38
+ "": "((1lh - 1.75rem) / 2) start",
39
+ "@mobile": "auto start",
40
+ },
41
+ inlineInset: { "": "-2rem start", "@mobile": "auto start" },
42
+ display: "inline-grid",
43
+ placeItems: "center",
44
+ inlineSize: { "": "1.75rem", "@mobile": "1.5rem" },
45
+ blockSize: { "": "1.75rem", "@mobile": "1.5rem" },
46
+ inlineMargin: { "": "0 start", "@mobile": "-1.5rem start" },
47
+ verticalAlign: { "": "baseline", "@mobile": "middle" },
48
+ color: "#text-muted",
49
+ opacity: {
50
+ "": "1",
51
+ "@media(hover: hover)": "0",
52
+ "@mobile": "1",
53
+ },
54
+ radius: "$radius",
55
+ userSelect: "none",
56
+ textDecoration: "none",
57
+ transition: "color $transition, fill $transition, opacity $transition",
58
+ },
59
+ RevealedLink: {
60
+ $: "> .cookbook-anchor-link",
61
+ opacity: {
62
+ "": null,
63
+ ":hover | @own(:focus-visible)": "1",
64
+ },
65
+ },
66
+ HoverLink: {
67
+ $: "> .cookbook-anchor-link",
68
+ color: {
69
+ "": null,
70
+ "@own(:hover | :focus-visible)": "#accent-text",
71
+ },
72
+ fill: {
73
+ "": null,
74
+ "@own(:hover | :focus-visible)": "#surface-2-hover",
75
+ },
76
+ },
77
+ LinkIcon: {
78
+ $: "> .cookbook-anchor-link > .cookbook-anchor-icon",
79
+ display: "block",
80
+ preset: "inherit / tight",
81
+ // Scale with the current heading without replacing its inherited typography.
82
+ // eslint-disable-next-line tasty/prefer-shorthand-property
83
+ fontSize: "clamp(1rem, 0.65em, 1.5rem)",
84
+ textAlign: "center",
85
+ inlineSize: "1em",
86
+ blockSize: "1em",
87
+ },
88
+ CopiedLink: {
89
+ $: "> .cookbook-anchor-link",
90
+ color: { "": null, '@own([data-copy-state="copied"])': "#green-text" },
91
+ opacity: { "": null, '@own([data-copy-state="copied"])': "1" },
92
+ },
93
+ CopiedLinkIcon: {
94
+ $: "> .cookbook-anchor-link > .cookbook-anchor-icon",
95
+ visibility: {
96
+ "": null,
97
+ '@own(:is(.cookbook-anchor-link[data-copy-state="copied"] > .cookbook-anchor-icon))':
98
+ "hidden",
99
+ },
100
+ },
101
+ CopiedIcon: {
102
+ // Tasty 3.9.3 appends @own states after pseudo-elements, producing invalid CSS.
103
+ // eslint-disable-next-line tasty/no-state-in-selector
104
+ $: '> .cookbook-anchor-link[data-copy-state="copied"]::after',
105
+ content: '""',
106
+ position: "absolute",
107
+ inlineSize: "clamp(1rem, 0.65em, 1.5rem)",
108
+ blockSize: "clamp(1rem, 0.65em, 1.5rem)",
109
+ fill: "#current",
110
+ // The imported SVG is encoded at build time and never evaluated in the browser.
111
+ // eslint-disable-next-line tasty/no-runtime-styles-mutation
112
+ mask: `url("${svgIconUrl(checkIcon)}") center / contain no-repeat`,
113
+ },
114
+ }),
115
+ );
116
+ return null;
117
+ }
@@ -0,0 +1,19 @@
1
+ import { useGlobalStyles } from "@tenphi/tasty";
2
+ import { resolveComponentStyles } from "./component-styles.js";
3
+ import { configureCookbookStates } from "./tasty-states.js";
4
+
5
+ configureCookbookStates();
6
+
7
+ export function MarkdownInlineCodeStyles() {
8
+ useGlobalStyles(
9
+ ".cookbook-markdown-content code:not(:where(pre *, .not-content *))",
10
+ resolveComponentStyles("MarkdownInlineCode", {
11
+ padding: "0.125rem 0.375rem",
12
+ color: "#text-soft",
13
+ fill: "#surface-3",
14
+ preset: "inline-code",
15
+ radius: "($radius * 0.65)",
16
+ }),
17
+ );
18
+ return null;
19
+ }
@@ -0,0 +1,58 @@
1
+ import { useGlobalStyles } from "@tenphi/tasty";
2
+ import { resolveComponentStyles } from "./component-styles.js";
3
+ import { configureCookbookStates } from "./tasty-states.js";
4
+
5
+ configureCookbookStates();
6
+
7
+ export function MarkdownTableStyles() {
8
+ useGlobalStyles(
9
+ ".cookbook-markdown-content:where(*)",
10
+ resolveComponentStyles("MarkdownTable", {
11
+ Table: {
12
+ $: "table",
13
+ inlineSize: "100%",
14
+ borderCollapse: "separate",
15
+ borderSpacing: "0",
16
+ color: "#text-soft",
17
+ preset: "small",
18
+ border: "$border-width solid #border",
19
+ radius: "$card-radius",
20
+ },
21
+ Cell: {
22
+ $: "th, td",
23
+ padding: "($gap * 1.5) ($gap * 2)",
24
+ verticalAlign: "top",
25
+ // Change only color; border widths and styles belong to other rules or theme overrides.
26
+ // eslint-disable-next-line tasty/prefer-shorthand-property
27
+ borderColor: "#border",
28
+ },
29
+ LastBodyRowCell: {
30
+ $: "tbody td",
31
+ // Clear only the last row's end border; the theme may configure its start border.
32
+ // eslint-disable-next-line tasty/prefer-shorthand-property
33
+ borderBlockEnd: { "@own(:is(tbody tr:last-child > td))": "0" },
34
+ },
35
+ HeaderCell: {
36
+ $: "th",
37
+ color: "#text",
38
+ fill: "#surface-2",
39
+ textAlign: "start",
40
+ radius: {
41
+ "@own(:is(thead:first-child tr:first-child > th) & :first-child & !:last-child)":
42
+ "($card-radius - $border-width) top-left",
43
+ "@own(:is(thead:first-child tr:first-child > th) & !:first-child & :last-child)":
44
+ "($card-radius - $border-width) top-right",
45
+ "@own(:is(thead:first-child tr:first-child > th) & :first-child & :last-child)":
46
+ "($card-radius - $border-width) top",
47
+ },
48
+ },
49
+ Scroll: {
50
+ $: ".td-table-scroll",
51
+ inlineSize: "initial 100% 100%",
52
+ overflow: "auto",
53
+ scrollbar: "thin",
54
+ },
55
+ }),
56
+ );
57
+ return null;
58
+ }