@tenphi/renderer 0.21.1 → 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.
- package/dist/component-styles-DstqPFf3.js +21 -0
- package/dist/component-styles-DstqPFf3.js.map +1 -0
- package/dist/components/Banner.styles.js +19 -0
- package/dist/components/Button.styles.d.ts +9 -0
- package/dist/components/Button.styles.js +14 -0
- package/dist/components/Callout.astro +1 -1
- package/dist/components/Callout.styles.js +54 -0
- package/dist/components/Card.astro +4 -4
- package/dist/components/Card.styles.js +64 -0
- package/dist/components/CodeGroup.astro +9 -4
- package/dist/components/CodeGroup.styles.js +27 -0
- package/dist/components/Document.styles.js +230 -0
- package/dist/components/EditLink.astro +1 -1
- package/dist/components/Footer.styles.js +45 -0
- package/dist/components/Header.styles.js +96 -0
- package/dist/components/HeaderFrame.styles.js +20 -0
- package/dist/components/HeaderLinks.astro +2 -2
- package/dist/components/HeaderLinks.styles.js +149 -0
- package/dist/components/Hero.styles.js +129 -0
- package/dist/components/LanguageSelect.styles.js +169 -0
- package/dist/components/LastUpdated.astro +1 -1
- package/dist/components/Logo.astro +4 -8
- package/dist/components/Logo.styles.js +27 -0
- package/dist/components/MainContent.styles.js +38 -0
- package/dist/components/MainPane.styles.js +19 -0
- package/dist/components/MarkdownAlert.styles.js +61 -0
- package/dist/components/MarkdownCodeBlock.styles.js +131 -0
- package/dist/components/MarkdownContent.styles.js +231 -0
- package/dist/components/MarkdownHeading.styles.js +117 -0
- package/dist/components/MarkdownInlineCode.styles.js +19 -0
- package/dist/components/MarkdownTable.styles.js +58 -0
- package/dist/components/Mermaid.styles.js +50 -0
- package/dist/components/MermaidSource.styles.js +21 -0
- package/dist/components/MobileMenuFooter.styles.js +27 -0
- package/dist/components/MobileMenuToggle.styles.js +49 -0
- package/dist/components/MobileNavigationTabs.astro +1 -2
- package/dist/components/MobileNavigationTabs.styles.js +88 -0
- package/dist/components/MobileTableOfContents.styles.js +59 -0
- package/dist/components/PackageVersion.astro +1 -2
- package/dist/components/PackageVersion.styles.js +23 -0
- package/dist/components/PageActions.astro +2 -2
- package/dist/components/PageActions.styles.js +51 -0
- package/dist/components/PageFrame.styles.js +34 -0
- package/dist/components/Pagination.astro +3 -2
- package/dist/components/Pagination.styles.js +126 -0
- package/dist/components/Preview.astro +2 -6
- package/dist/components/Preview.styles.js +78 -0
- package/dist/components/Search.styles.js +132 -0
- package/dist/components/SearchButton.styles.js +68 -0
- package/dist/components/SearchResults.styles.js +200 -0
- package/dist/components/SelectPopover.astro +1 -0
- package/dist/components/Sidebar.styles.js +309 -0
- package/dist/components/SiteLogo.astro +1 -2
- package/dist/components/SiteLogo.styles.js +32 -0
- package/dist/components/SiteTitle.astro +1 -1
- package/dist/components/SkipLink.styles.js +24 -0
- package/dist/components/SocialIcons.styles.js +36 -0
- package/dist/components/Steps.astro +2 -2
- package/dist/components/Steps.styles.js +25 -0
- package/dist/components/SyntaxHighlight.styles.js +87 -0
- package/dist/components/Tab.astro +1 -1
- package/dist/components/Tab.styles.js +30 -0
- package/dist/components/TableOfContents.styles.js +62 -0
- package/dist/components/TableOfContentsLayout.styles.js +38 -0
- package/dist/components/Tabs.astro +1 -1
- package/dist/components/Tabs.styles.js +60 -0
- package/dist/components/ThemeSelect.styles.js +177 -0
- package/dist/components/TopNavigation.styles.js +52 -0
- package/dist/components/VersionSwitcher.astro +2 -2
- package/dist/components/VersionSwitcher.styles.js +45 -0
- package/dist/components/component-styles.test.ts +0 -10
- package/dist/components/component-styles.ts +0 -7
- package/dist/components/inherit-component-parts.d.ts +1 -0
- package/dist/components/inherit-component-parts.js +7 -0
- package/dist/components/select-popover-styles.js +34 -16
- package/dist/components/tasty-states.js +13 -1
- package/dist/define-component-BP4YwMak.js +28 -0
- package/dist/define-component-BP4YwMak.js.map +1 -0
- package/dist/define-component.d.ts +17 -0
- package/dist/define-component.d.ts.map +1 -0
- package/dist/define-component.js +2 -0
- package/dist/eslint-plugin.d.ts +5 -0
- package/dist/eslint-plugin.d.ts.map +1 -1
- package/dist/eslint-plugin.js +26 -3
- package/dist/eslint-plugin.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/overrides/Footer.astro +6 -5
- package/dist/overrides/Header.astro +13 -17
- package/dist/overrides/Hero.astro +3 -2
- package/dist/overrides/LanguageSelect.astro +3 -3
- package/dist/overrides/MarkdownContent.astro +7 -1
- package/dist/overrides/MobileMenuFooter.astro +2 -5
- package/dist/overrides/MobileMenuToggle.astro +4 -3
- package/dist/overrides/MobileTableOfContents.astro +2 -2
- package/dist/overrides/PageFrame.astro +9 -11
- package/dist/overrides/Search.astro +13 -9
- package/dist/overrides/Sidebar.astro +4 -1
- package/dist/overrides/SocialIcons.astro +2 -2
- package/dist/overrides/ThemeSelect.astro +9 -3
- package/dist/routes/Page.astro +22 -11
- package/dist/styling.d.ts +5 -10
- package/dist/styling.d.ts.map +1 -1
- package/dist/styling.js +18 -11
- package/dist/styling.js.map +1 -1
- package/dist/tasty-states-_JhxFdK1.js +47 -0
- package/dist/tasty-states-_JhxFdK1.js.map +1 -0
- package/dist/theme/defaults.d.ts.map +1 -1
- package/dist/theme/defaults.js +22 -1
- package/dist/theme/defaults.js.map +1 -1
- package/dist/theme/tasty-config.d.ts +23 -1
- package/dist/theme/tasty-config.d.ts.map +1 -1
- package/dist/theme/tasty-config.js +23 -1
- package/dist/theme/tasty-config.js.map +1 -1
- package/package.json +4 -4
- package/dist/components/GlobalStyles.js +0 -1792
- package/dist/components/LayoutComponents.js +0 -872
- package/dist/components/TastyComponents.js +0 -269
- package/dist/components/customize-component.js +0 -8
- package/dist/tasty-states-rTLFy26t.js +0 -57
- package/dist/tasty-states-rTLFy26t.js.map +0 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { configureCookbookStates } from "./tasty-states.js";
|
|
2
|
+
import { defineComponent } from "../define-component.js";
|
|
3
|
+
|
|
4
|
+
configureCookbookStates();
|
|
5
|
+
|
|
6
|
+
export const TableOfContentsLayoutRoot = defineComponent(
|
|
7
|
+
"TableOfContentsLayout",
|
|
8
|
+
{
|
|
9
|
+
as: "aside",
|
|
10
|
+
"data-element": "TableOfContentsLayout",
|
|
11
|
+
styles: {
|
|
12
|
+
display: { "": "", ":has(cookbook-mobile-toc)": "block" },
|
|
13
|
+
hide: {
|
|
14
|
+
"": false,
|
|
15
|
+
"@narrow-layout": true,
|
|
16
|
+
":has(cookbook-mobile-toc)": false,
|
|
17
|
+
},
|
|
18
|
+
order: { "": "2", "@narrow-layout": "0" },
|
|
19
|
+
position: "relative",
|
|
20
|
+
inlineSize: {
|
|
21
|
+
"": "max($sidebar-width, calc($sidebar-width + (100% - $content-width - $sidebar-width) / 2))",
|
|
22
|
+
"@narrow-layout": "100%",
|
|
23
|
+
},
|
|
24
|
+
Content: {
|
|
25
|
+
$: ".right-sidebar",
|
|
26
|
+
position: { "": "sticky", "@narrow-layout": "static" },
|
|
27
|
+
blockInset: "$docs-nav-height start",
|
|
28
|
+
inlineSize: "100%",
|
|
29
|
+
blockSize: {
|
|
30
|
+
"": "(100vh - $docs-nav-height)",
|
|
31
|
+
"@narrow-layout": "auto",
|
|
32
|
+
},
|
|
33
|
+
overflowY: { "": "auto", "@narrow-layout": "visible" },
|
|
34
|
+
scrollbar: "none",
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { configureCookbookStates } from "./tasty-states.js";
|
|
2
|
+
import { defineComponent } from "../define-component.js";
|
|
3
|
+
|
|
4
|
+
configureCookbookStates();
|
|
5
|
+
|
|
6
|
+
export const TabsRoot = defineComponent("Tabs", {
|
|
7
|
+
as: "div",
|
|
8
|
+
"data-element": "Tabs",
|
|
9
|
+
styles: {
|
|
10
|
+
"$margin-block-start": "2x",
|
|
11
|
+
"$margin-block-end": "2x",
|
|
12
|
+
blockMargin: "$margin-block-start $margin-block-end",
|
|
13
|
+
inlineMargin: "0",
|
|
14
|
+
border: true,
|
|
15
|
+
radius: "1cr",
|
|
16
|
+
overflow: "clip",
|
|
17
|
+
fill: "#surface",
|
|
18
|
+
List: {
|
|
19
|
+
padding: "1x",
|
|
20
|
+
display: "flex",
|
|
21
|
+
gap: "1x",
|
|
22
|
+
overflow: "auto",
|
|
23
|
+
fill: "#surface-2",
|
|
24
|
+
},
|
|
25
|
+
Button: {
|
|
26
|
+
$: "> List > button",
|
|
27
|
+
"$margin-block-start": "0",
|
|
28
|
+
"$margin-block-end": "0",
|
|
29
|
+
blockMargin: "$margin-block-start $margin-block-end",
|
|
30
|
+
inlineMargin: "0",
|
|
31
|
+
preset: "navigation",
|
|
32
|
+
padding: "1x 2x",
|
|
33
|
+
border: "0",
|
|
34
|
+
radius: "1r",
|
|
35
|
+
color: "#text",
|
|
36
|
+
fill: "#clear",
|
|
37
|
+
cursor: "pointer",
|
|
38
|
+
whiteSpace: "nowrap",
|
|
39
|
+
},
|
|
40
|
+
SelectedButton: {
|
|
41
|
+
$: "> List > button",
|
|
42
|
+
color: {
|
|
43
|
+
"": null,
|
|
44
|
+
'@own([aria-selected="true"])': "#accent-surface-text",
|
|
45
|
+
},
|
|
46
|
+
fill: {
|
|
47
|
+
"": null,
|
|
48
|
+
'@own([aria-selected="true"])': "#accent-surface",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
FocusedButton: {
|
|
52
|
+
$: "> List > button",
|
|
53
|
+
outline: {
|
|
54
|
+
"": null,
|
|
55
|
+
"@own(:focus-visible)": "2px #focus / -2px",
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
elements: { List: "div" },
|
|
60
|
+
});
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { configureCookbookStates } from "./tasty-states.js";
|
|
2
|
+
import { defineComponent } from "../define-component.js";
|
|
3
|
+
|
|
4
|
+
configureCookbookStates();
|
|
5
|
+
|
|
6
|
+
export const ThemeSelectRoot = defineComponent("ThemeSelect", {
|
|
7
|
+
as: "cookbook-appearance-menu",
|
|
8
|
+
"data-element": "ThemeSelect",
|
|
9
|
+
styles: {
|
|
10
|
+
display: "flex",
|
|
11
|
+
flexShrink: "0",
|
|
12
|
+
"$popover-transition": "120ms",
|
|
13
|
+
Trigger: {
|
|
14
|
+
$: "> button",
|
|
15
|
+
display: "grid",
|
|
16
|
+
placeItems: "center",
|
|
17
|
+
inlineSize: {
|
|
18
|
+
"": "$control-height",
|
|
19
|
+
"@mobile": "$docs-menu-button-size",
|
|
20
|
+
},
|
|
21
|
+
blockSize: {
|
|
22
|
+
"": "$control-height",
|
|
23
|
+
"@mobile": "$docs-menu-button-size",
|
|
24
|
+
},
|
|
25
|
+
padding: "0",
|
|
26
|
+
color: "#text-soft",
|
|
27
|
+
fill: "#clear",
|
|
28
|
+
border: "0",
|
|
29
|
+
radius: "$header-control-radius",
|
|
30
|
+
transition: "color $transition, fill $transition",
|
|
31
|
+
},
|
|
32
|
+
HoverTrigger: {
|
|
33
|
+
$: "> button",
|
|
34
|
+
color: {
|
|
35
|
+
"": null,
|
|
36
|
+
"@own(:hover) | :has([popover]:popover-open)": "#text",
|
|
37
|
+
},
|
|
38
|
+
fill: {
|
|
39
|
+
"": null,
|
|
40
|
+
"@own(:hover) | :has([popover]:popover-open)": "#surface-2-hover",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
ActiveTrigger: {
|
|
44
|
+
$: "> button",
|
|
45
|
+
color: { "": null, "@own(:active)": "#text" },
|
|
46
|
+
fill: { "": null, "@own(:active)": "#surface-2-pressed" },
|
|
47
|
+
},
|
|
48
|
+
Icon: {
|
|
49
|
+
$: "> button svg",
|
|
50
|
+
display: "block",
|
|
51
|
+
inlineSize: { "": "1.25rem", "@mobile": "1.125rem" },
|
|
52
|
+
blockSize: { "": "1.25rem", "@mobile": "1.125rem" },
|
|
53
|
+
},
|
|
54
|
+
Panel: {
|
|
55
|
+
$: "Panel",
|
|
56
|
+
position: "fixed",
|
|
57
|
+
inset: "auto",
|
|
58
|
+
blockInset: { "": "4rem start", "@mobile": "3.5rem start" },
|
|
59
|
+
inlineInset:
|
|
60
|
+
"max($docs-nav-pad-x, ((100vw - $layout-width) / 2 + $docs-sidebar-pad-x)) end",
|
|
61
|
+
inlineSize: "min(15rem, calc(100vw - 2 * $docs-nav-pad-x))",
|
|
62
|
+
blockSize: "max (100dvh - $docs-nav-height - $gap)",
|
|
63
|
+
overflowY: "auto",
|
|
64
|
+
margin: "0",
|
|
65
|
+
padding: "$gap",
|
|
66
|
+
color: "#text",
|
|
67
|
+
fill: "#surface-2",
|
|
68
|
+
border: true,
|
|
69
|
+
radius: "$card-radius",
|
|
70
|
+
shadow: "0 0.75rem 2rem #shadow",
|
|
71
|
+
opacity: "0",
|
|
72
|
+
scale: "1 0.96",
|
|
73
|
+
transformOrigin: "top",
|
|
74
|
+
transition: {
|
|
75
|
+
"": "none",
|
|
76
|
+
"!@reduced-motion":
|
|
77
|
+
"opacity $popover-transition ease-out, scale $popover-transition ease-out, display $popover-transition allow-discrete, overlay $popover-transition allow-discrete",
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
OpenPanel: {
|
|
81
|
+
$: '[data-element="Panel"]',
|
|
82
|
+
opacity: {
|
|
83
|
+
"": null,
|
|
84
|
+
"@own(@popover-open & [data-open])": "1",
|
|
85
|
+
},
|
|
86
|
+
scale: { "": null, "@own(@popover-open & [data-open])": "1" },
|
|
87
|
+
},
|
|
88
|
+
Section: {
|
|
89
|
+
$: "fieldset",
|
|
90
|
+
inlineSize: "min 0",
|
|
91
|
+
margin: "0",
|
|
92
|
+
padding: "0",
|
|
93
|
+
border: "0",
|
|
94
|
+
},
|
|
95
|
+
SectionSpacing: {
|
|
96
|
+
$: "fieldset + fieldset",
|
|
97
|
+
blockMargin: "$gap start",
|
|
98
|
+
blockPadding: "$gap start",
|
|
99
|
+
blockBorder: "$border-width solid #border start",
|
|
100
|
+
},
|
|
101
|
+
SectionLabel: {
|
|
102
|
+
$: "legend",
|
|
103
|
+
float: "inline-start",
|
|
104
|
+
inlineSize: "100%",
|
|
105
|
+
padding: "($gap * 0.75) $gap",
|
|
106
|
+
color: "#text-muted",
|
|
107
|
+
preset: "small / strong",
|
|
108
|
+
},
|
|
109
|
+
Option: {
|
|
110
|
+
$: "label",
|
|
111
|
+
position: "relative",
|
|
112
|
+
display: "flex",
|
|
113
|
+
alignItems: "center",
|
|
114
|
+
gap: "$gap",
|
|
115
|
+
inlineSize: "100%",
|
|
116
|
+
blockSize: "min 2.25rem",
|
|
117
|
+
padding: "($gap * 0.75) $gap",
|
|
118
|
+
color: "#text-soft",
|
|
119
|
+
preset: "small",
|
|
120
|
+
radius: "$radius",
|
|
121
|
+
cursor: "pointer",
|
|
122
|
+
},
|
|
123
|
+
HoverOption: {
|
|
124
|
+
$: "label",
|
|
125
|
+
color: { "": null, "@own(:hover)": "#text" },
|
|
126
|
+
fill: { "": null, "@own(:hover)": "#surface-2-hover" },
|
|
127
|
+
},
|
|
128
|
+
CheckedOption: {
|
|
129
|
+
$: "label",
|
|
130
|
+
color: { "": null, "@own(:has(input:checked))": "#accent-text" },
|
|
131
|
+
fill: {
|
|
132
|
+
"": null,
|
|
133
|
+
"@own(:has(input:checked))": "#accent-surface-2-subtle",
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
FocusedOption: {
|
|
137
|
+
$: "label",
|
|
138
|
+
outline: {
|
|
139
|
+
"": null,
|
|
140
|
+
"@own(:has(input:focus-visible))": "$outline-width solid #focus / -2px",
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
Input: {
|
|
144
|
+
$: "input",
|
|
145
|
+
position: "absolute",
|
|
146
|
+
inlineSize: "1px",
|
|
147
|
+
blockSize: "0 1px",
|
|
148
|
+
padding: "0",
|
|
149
|
+
margin: "0",
|
|
150
|
+
overflow: "hidden",
|
|
151
|
+
clipPath: "inset(50%)",
|
|
152
|
+
whiteSpace: "nowrap",
|
|
153
|
+
},
|
|
154
|
+
OptionIcon: {
|
|
155
|
+
$: "label > svg",
|
|
156
|
+
display: "block",
|
|
157
|
+
flexShrink: "0",
|
|
158
|
+
inlineSize: "1rem",
|
|
159
|
+
blockSize: "1rem",
|
|
160
|
+
},
|
|
161
|
+
Checkmark: {
|
|
162
|
+
$: "label > svg",
|
|
163
|
+
inlineMargin: {
|
|
164
|
+
"": null,
|
|
165
|
+
"@own(:is(label > svg:last-child))": "auto start",
|
|
166
|
+
},
|
|
167
|
+
visibility: { "": null, "@own(:is(label > svg:last-child))": "hidden" },
|
|
168
|
+
},
|
|
169
|
+
SelectedCheckmark: {
|
|
170
|
+
$: "label > svg",
|
|
171
|
+
visibility: {
|
|
172
|
+
"": null,
|
|
173
|
+
"@own(:is(label:has(input:checked) > svg:last-child))": "visible",
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { configureCookbookStates } from "./tasty-states.js";
|
|
2
|
+
import { defineComponent } from "../define-component.js";
|
|
3
|
+
|
|
4
|
+
configureCookbookStates();
|
|
5
|
+
|
|
6
|
+
export const TopNavigationRoot = defineComponent("TopNavigation", {
|
|
7
|
+
as: "nav",
|
|
8
|
+
"data-element": "TopNavigation",
|
|
9
|
+
styles: {
|
|
10
|
+
display: "flex",
|
|
11
|
+
hide: { "": false, "@mobile": true },
|
|
12
|
+
alignItems: "stretch",
|
|
13
|
+
gap: "clamp(1.25rem, 2.5vw, 2.5rem)",
|
|
14
|
+
inlineSize: "100%",
|
|
15
|
+
blockSize: "min 2.75rem",
|
|
16
|
+
blockBorder: "1bw solid #border start",
|
|
17
|
+
overflowX: "auto",
|
|
18
|
+
scrollbar: "none",
|
|
19
|
+
|
|
20
|
+
Scrollbar: { $: "&::-webkit-scrollbar", hide: true },
|
|
21
|
+
Link: {
|
|
22
|
+
$: "a",
|
|
23
|
+
position: "relative",
|
|
24
|
+
display: "inline-flex",
|
|
25
|
+
alignItems: "center",
|
|
26
|
+
flexGrow: "0",
|
|
27
|
+
flexShrink: "0",
|
|
28
|
+
flexBasis: "auto",
|
|
29
|
+
blockPadding: "($gap * 1.25) start, $gap end",
|
|
30
|
+
color: "#text-soft",
|
|
31
|
+
preset: "navigation",
|
|
32
|
+
textDecoration: "none",
|
|
33
|
+
whiteSpace: "nowrap",
|
|
34
|
+
},
|
|
35
|
+
HoverLink: { $: "a", color: { "": null, "@own(:hover)": "#text" } },
|
|
36
|
+
CurrentLink: {
|
|
37
|
+
$: "a",
|
|
38
|
+
color: { "": null, '@own([aria-current="page"])': "#accent-text" },
|
|
39
|
+
},
|
|
40
|
+
ActiveIndicator: {
|
|
41
|
+
// Tasty 3.9.3 appends @own states after pseudo-elements, producing invalid CSS.
|
|
42
|
+
// eslint-disable-next-line tasty/no-state-in-selector
|
|
43
|
+
$: 'a[aria-current="page"]::after',
|
|
44
|
+
content: '""',
|
|
45
|
+
position: "absolute",
|
|
46
|
+
inset: "auto 0 0",
|
|
47
|
+
blockSize: "2px",
|
|
48
|
+
radius: "999px",
|
|
49
|
+
fill: "#accent-surface",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
});
|
|
@@ -3,7 +3,7 @@ import { messages } from "../localization.js";
|
|
|
3
3
|
import { content } from "virtual:cookbook/config";
|
|
4
4
|
import type { DocsRoute, SiteVersion } from "@tenphi/docs";
|
|
5
5
|
import { versionLinks } from "../versioning.js";
|
|
6
|
-
import { VersionSwitcherRoot } from "./
|
|
6
|
+
import { VersionSwitcherRoot } from "./VersionSwitcher.styles.js";
|
|
7
7
|
import SelectPopover from "./SelectPopover.astro";
|
|
8
8
|
|
|
9
9
|
interface Props {
|
|
@@ -23,7 +23,7 @@ const { current, links } = versionLinks(
|
|
|
23
23
|
const ui = messages(Astro.locals.cookbookRoute?.lang ?? "en", content);
|
|
24
24
|
---
|
|
25
25
|
|
|
26
|
-
<VersionSwitcherRoot
|
|
26
|
+
<VersionSwitcherRoot>
|
|
27
27
|
<SelectPopover
|
|
28
28
|
triggerLabel={`${ui.documentationVersion}: ${current?.label ?? ui.versions}`}
|
|
29
29
|
selectedLabel={current?.label ?? ui.versions}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { selectPopoverStyles } from "./select-popover-styles.js";
|
|
2
|
+
import { configureCookbookStates } from "./tasty-states.js";
|
|
3
|
+
import { defineComponent } from "../define-component.js";
|
|
4
|
+
|
|
5
|
+
configureCookbookStates();
|
|
6
|
+
|
|
7
|
+
const versionSelectStyles = selectPopoverStyles({
|
|
8
|
+
option: "Link",
|
|
9
|
+
hoverOption: "HoverLink",
|
|
10
|
+
currentOption: "CurrentLink",
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const VersionSwitcherRoot = defineComponent("VersionSwitcher", {
|
|
14
|
+
as: "div",
|
|
15
|
+
"data-element": "VersionSwitcher",
|
|
16
|
+
styles: {
|
|
17
|
+
// Reuse the shared, server-only popover anatomy.
|
|
18
|
+
// eslint-disable-next-line tasty/no-style-spread
|
|
19
|
+
...versionSelectStyles,
|
|
20
|
+
display: "inline-flex",
|
|
21
|
+
flexShrink: "0",
|
|
22
|
+
Trigger: {
|
|
23
|
+
// Reuse the shared, server-only popover anatomy.
|
|
24
|
+
// eslint-disable-next-line tasty/no-style-spread
|
|
25
|
+
...versionSelectStyles.Trigger,
|
|
26
|
+
blockSize: "min $control-height",
|
|
27
|
+
inlinePadding: "$gap",
|
|
28
|
+
fill: "#surface-2",
|
|
29
|
+
border: true,
|
|
30
|
+
preset: "small / strong",
|
|
31
|
+
anchorName: "--version-trigger",
|
|
32
|
+
},
|
|
33
|
+
Panel: {
|
|
34
|
+
// Reuse the shared, server-only popover anatomy.
|
|
35
|
+
// eslint-disable-next-line tasty/no-style-spread
|
|
36
|
+
...versionSelectStyles.Panel,
|
|
37
|
+
positionAnchor: "--version-trigger",
|
|
38
|
+
blockInset: "(anchor(bottom) + $gap) start, auto end",
|
|
39
|
+
inlineInset: {
|
|
40
|
+
"": "anchor(left) start, auto end",
|
|
41
|
+
"@mobile": "auto start, anchor(right) end",
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { afterEach, describe, expect, it } from "vitest";
|
|
2
2
|
import {
|
|
3
3
|
configureComponentStyles,
|
|
4
|
-
resolveComponentStyleOverride,
|
|
5
4
|
resolveComponentStyles,
|
|
6
5
|
unusedCustomStyleNames,
|
|
7
6
|
} from "./component-styles.js";
|
|
@@ -27,15 +26,6 @@ describe("component style configuration", () => {
|
|
|
27
26
|
});
|
|
28
27
|
});
|
|
29
28
|
|
|
30
|
-
it("returns the user override for Tasty component composition", () => {
|
|
31
|
-
expect(resolveComponentStyleOverride("Card")).toBeUndefined();
|
|
32
|
-
|
|
33
|
-
configureComponentStyles({ Card: { padding: "3x" } });
|
|
34
|
-
expect(resolveComponentStyleOverride("Card")).toEqual({
|
|
35
|
-
padding: "3x",
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
|
|
39
29
|
it("merges configuration into bridged component style trees", () => {
|
|
40
30
|
configureComponentStyles({
|
|
41
31
|
MarkdownTable: { Table: { radius: "0" } },
|
|
@@ -36,10 +36,3 @@ export function unusedCustomStyleNames(
|
|
|
36
36
|
!sharedConfiguration.__tenphiCookbookUsedComponentStyles?.has(name),
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
export function resolveComponentStyleOverride(
|
|
41
|
-
name: string,
|
|
42
|
-
): Styles | undefined {
|
|
43
|
-
return sharedConfiguration.__tenphiCookbookComponentStyles?.[name] as
|
|
44
|
-
Styles | undefined;
|
|
45
|
-
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function inheritComponentParts<T>(base: object, extended: T): T;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Tasty wrappers forward styles but do not copy compound component exports. */
|
|
2
|
+
export function inheritComponentParts(base, extended) {
|
|
3
|
+
for (const [name, part] of Object.entries(base)) {
|
|
4
|
+
if (/^[A-Z]/.test(name)) extended[name] = part;
|
|
5
|
+
}
|
|
6
|
+
return extended;
|
|
7
|
+
}
|
|
@@ -18,9 +18,15 @@ export function selectPopoverStyles({
|
|
|
18
18
|
cursor: "pointer",
|
|
19
19
|
},
|
|
20
20
|
HoverTrigger: {
|
|
21
|
-
$: "> button
|
|
22
|
-
color:
|
|
23
|
-
|
|
21
|
+
$: "> button",
|
|
22
|
+
color: {
|
|
23
|
+
"": null,
|
|
24
|
+
"@own(:hover) | :has([popover]:popover-open)": "#text",
|
|
25
|
+
},
|
|
26
|
+
fill: {
|
|
27
|
+
"": null,
|
|
28
|
+
"@own(:hover) | :has([popover]:popover-open)": "#surface-2-hover",
|
|
29
|
+
},
|
|
24
30
|
},
|
|
25
31
|
TriggerLabel: {
|
|
26
32
|
$: ".trigger-label",
|
|
@@ -35,7 +41,7 @@ export function selectPopoverStyles({
|
|
|
35
41
|
blockSize: "0.875rem",
|
|
36
42
|
},
|
|
37
43
|
Panel: {
|
|
38
|
-
$:
|
|
44
|
+
$: '> [data-element="Panel"]',
|
|
39
45
|
position: "fixed",
|
|
40
46
|
inset: "auto",
|
|
41
47
|
inlineSize: "min(15rem, calc(100vw - 2 * $docs-nav-pad-x))",
|
|
@@ -58,9 +64,12 @@ export function selectPopoverStyles({
|
|
|
58
64
|
},
|
|
59
65
|
},
|
|
60
66
|
OpenPanel: {
|
|
61
|
-
$:
|
|
62
|
-
opacity:
|
|
63
|
-
|
|
67
|
+
$: '> [data-element="Panel"]',
|
|
68
|
+
opacity: {
|
|
69
|
+
"": null,
|
|
70
|
+
"@own(@popover-open & [data-open])": "1",
|
|
71
|
+
},
|
|
72
|
+
scale: { "": null, "@own(@popover-open & [data-open])": "1" },
|
|
64
73
|
},
|
|
65
74
|
PanelTitle: {
|
|
66
75
|
$: ".panel-title",
|
|
@@ -74,7 +83,7 @@ export function selectPopoverStyles({
|
|
|
74
83
|
display: "flex",
|
|
75
84
|
alignItems: "center",
|
|
76
85
|
gap: "$gap",
|
|
77
|
-
|
|
86
|
+
blockSize: "min 2.25rem",
|
|
78
87
|
padding: "($gap * 0.75) $gap",
|
|
79
88
|
color: "#text-soft",
|
|
80
89
|
preset: "small",
|
|
@@ -82,14 +91,20 @@ export function selectPopoverStyles({
|
|
|
82
91
|
radius: "$radius",
|
|
83
92
|
},
|
|
84
93
|
[hoverOption]: {
|
|
85
|
-
$: "nav a
|
|
86
|
-
color: "#text",
|
|
87
|
-
fill: "#surface-2-hover",
|
|
94
|
+
$: "nav a",
|
|
95
|
+
color: { "": null, "@own(:is(nav a:hover))": "#text" },
|
|
96
|
+
fill: { "": null, "@own(:is(nav a:hover))": "#surface-2-hover" },
|
|
88
97
|
},
|
|
89
98
|
[currentOption]: {
|
|
90
|
-
$:
|
|
91
|
-
color:
|
|
92
|
-
|
|
99
|
+
$: "nav a",
|
|
100
|
+
color: {
|
|
101
|
+
"": null,
|
|
102
|
+
'@own(:is(nav a[aria-current="page"]))': "#accent-text",
|
|
103
|
+
},
|
|
104
|
+
fill: {
|
|
105
|
+
"": null,
|
|
106
|
+
'@own(:is(nav a[aria-current="page"]))': "#accent-surface-2-subtle",
|
|
107
|
+
},
|
|
93
108
|
},
|
|
94
109
|
Checkmark: {
|
|
95
110
|
$: "nav a > .checkmark",
|
|
@@ -100,8 +115,11 @@ export function selectPopoverStyles({
|
|
|
100
115
|
visibility: "hidden",
|
|
101
116
|
},
|
|
102
117
|
SelectedCheckmark: {
|
|
103
|
-
$:
|
|
104
|
-
visibility:
|
|
118
|
+
$: "nav a > .checkmark",
|
|
119
|
+
visibility: {
|
|
120
|
+
"": null,
|
|
121
|
+
'@own(:is(nav a[aria-current="page"] > .checkmark))': "visible",
|
|
122
|
+
},
|
|
105
123
|
},
|
|
106
124
|
};
|
|
107
125
|
}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { configure, getGlobalPredefinedStates } from "@tenphi/tasty";
|
|
2
2
|
import { resolveTypographyPresets } from "../theme/defaults.js";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
TASTY_UNITS,
|
|
5
|
+
TASTY_SPACING_PROPERTIES,
|
|
6
|
+
} from "../theme/tasty-config.js";
|
|
7
|
+
|
|
8
|
+
const systemLight = "@media(prefers-color-scheme: light)";
|
|
9
|
+
const systemDark = "@media(prefers-color-scheme: dark)";
|
|
4
10
|
|
|
5
11
|
export const cookbookStates = {
|
|
12
|
+
"@system-light": systemLight,
|
|
13
|
+
"@system-dark": systemDark,
|
|
14
|
+
"@light": `@root(theme=light) | (!@root(theme) & ${systemLight})`,
|
|
15
|
+
"@dark": `@root(theme=dark) | (!@root(theme) & ${systemDark})`,
|
|
6
16
|
"@mobile": "@media(w < 50rem)",
|
|
7
17
|
"@desktop": "@media(w >= 50rem)",
|
|
8
18
|
"@small": "@media(w <= 40rem)",
|
|
@@ -12,6 +22,7 @@ export const cookbookStates = {
|
|
|
12
22
|
"@narrow-layout": "@media(w < 72rem)",
|
|
13
23
|
"@medium-layout": "@media(w >= 50rem) & @media(w < 72rem)",
|
|
14
24
|
"@reduced-motion": "@media(prefers-reduced-motion: reduce)",
|
|
25
|
+
"@popover-open": ":is(:popover-open)",
|
|
15
26
|
};
|
|
16
27
|
|
|
17
28
|
let configured = false;
|
|
@@ -25,6 +36,7 @@ export function configureCookbookStates() {
|
|
|
25
36
|
if (configured && configuredRuntime === runtime) return;
|
|
26
37
|
configure({
|
|
27
38
|
presets: resolveTypographyPresets(),
|
|
39
|
+
properties: TASTY_SPACING_PROPERTIES,
|
|
28
40
|
...runtime,
|
|
29
41
|
units: { ...TASTY_UNITS, ...runtime?.units },
|
|
30
42
|
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { n as resolveComponentStyles } from "./component-styles-DstqPFf3.js";
|
|
2
|
+
import { tasty } from "@tenphi/tasty";
|
|
3
|
+
//#region src/components/inherit-component-parts.js
|
|
4
|
+
/** Tasty wrappers forward styles but do not copy compound component exports. */
|
|
5
|
+
function inheritComponentParts(base, extended) {
|
|
6
|
+
for (const [name, part] of Object.entries(base)) if (/^[A-Z]/.test(name)) extended[name] = part;
|
|
7
|
+
return extended;
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/define-component.ts
|
|
11
|
+
/** Extend a component's styles and defaults, preserving its props and compound parts. */
|
|
12
|
+
function extendComponent(name, base, options) {
|
|
13
|
+
return inheritComponentParts(base, tasty(base, {
|
|
14
|
+
...options,
|
|
15
|
+
styles: resolveComponentStyles(name, options.styles ?? {})
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
/** Create a named component with its built-in or custom theme styles merged into its defaults. */
|
|
19
|
+
function defineComponent(name, options) {
|
|
20
|
+
return tasty({
|
|
21
|
+
...options,
|
|
22
|
+
styles: resolveComponentStyles(name, options.styles ?? {})
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { extendComponent as n, defineComponent as t };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=define-component-BP4YwMak.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-component-BP4YwMak.js","names":[],"sources":["../src/components/inherit-component-parts.js","../src/define-component.ts"],"sourcesContent":["/** Tasty wrappers forward styles but do not copy compound component exports. */\nexport function inheritComponentParts(base, extended) {\n for (const [name, part] of Object.entries(base)) {\n if (/^[A-Z]/.test(name)) extended[name] = part;\n }\n return extended;\n}\n","import {\n tasty,\n type ElementsDefinition,\n type ModPropsInput,\n type StylesInterface,\n type Styles,\n type SubElementProps,\n type TastyElementOptions,\n type TastyPolymorphicComponent,\n type TokenPropsInput,\n type VariantMap,\n} from \"@tenphi/tasty\";\nimport type {\n ComponentProps,\n ComponentType,\n ElementType,\n ForwardRefExoticComponent,\n JSX,\n PropsWithoutRef,\n RefAttributes,\n} from \"react\";\nimport { resolveComponentStyles } from \"./components/component-styles.js\";\nimport { inheritComponentParts } from \"./components/inherit-component-parts.js\";\n\ntype InheritedParts<C> = {\n [\n Name in keyof C as Name extends string\n ? Name extends Capitalize<Name>\n ? C[Name] extends ComponentType<any>\n ? Name\n : never\n : never\n : never\n ]: C[Name];\n};\n\ntype SubElementTag<Definition extends ElementsDefinition[string]> =\n Definition extends string\n ? Definition\n : Definition extends { as?: infer Tag }\n ? Tag extends keyof JSX.IntrinsicElements\n ? Tag\n : \"div\"\n : \"div\";\n\n// Use public Tasty types so declarations do not leak its private sub-element aliases.\ntype SubElements<E extends ElementsDefinition> = {\n [Name in keyof E]: ForwardRefExoticComponent<\n PropsWithoutRef<SubElementProps<SubElementTag<E[Name]>>> &\n RefAttributes<\n SubElementTag<E[Name]> extends keyof HTMLElementTagNameMap\n ? HTMLElementTagNameMap[SubElementTag<E[Name]>]\n : unknown\n >\n >;\n};\n\n/** Extend a component's styles and defaults, preserving its props and compound parts. */\nexport function extendComponent<C extends ComponentType<any>>(\n name: string,\n base: C,\n options: Partial<Omit<ComponentProps<C>, \"as\" | \"styles\">> & {\n styles?: Styles;\n },\n): ComponentType<ComponentProps<C>> & InheritedParts<C> {\n const extended = tasty(base, {\n ...options,\n styles: resolveComponentStyles(name, options.styles ?? {}),\n });\n // Tasty's wrapper type erases compound exports and makes every prop optional.\n // Restore the copied parts and conservatively keep the base's required props.\n return inheritComponentParts(base, extended) as unknown as ComponentType<\n ComponentProps<C>\n > &\n InheritedParts<C>;\n}\n\n/** Create a named component with its built-in or custom theme styles merged into its defaults. */\nexport function defineComponent<\n K extends readonly (keyof StylesInterface)[],\n V extends VariantMap,\n E extends ElementsDefinition = Record<string, never>,\n AsType extends ElementType = \"div\",\n M extends ModPropsInput = readonly never[],\n TP extends TokenPropsInput = readonly never[],\n>(\n name: string,\n options: TastyElementOptions<K, V, E, AsType, M, TP>,\n): TastyPolymorphicComponent<AsType, K, V, M, TP> & SubElements<E> {\n return tasty<K, V, E, AsType, M, TP>({\n ...options,\n styles: resolveComponentStyles(name, options.styles ?? {}),\n }) as TastyPolymorphicComponent<AsType, K, V, M, TP> & SubElements<E>;\n}\n"],"mappings":";;;;AACA,SAAgB,sBAAsB,MAAM,UAAU;CACpD,KAAK,MAAM,CAAC,MAAM,SAAS,OAAO,QAAQ,IAAI,GAC5C,IAAI,SAAS,KAAK,IAAI,GAAG,SAAS,QAAQ;CAE5C,OAAO;AACT;;;;ACoDA,SAAgB,gBACd,MACA,MACA,SAGsD;CAOtD,OAAO,sBAAsB,MANZ,MAAM,MAAM;EAC3B,GAAG;EACH,QAAQ,uBAAuB,MAAM,QAAQ,UAAU,CAAC,CAAC;CAC3D,CAGmC,CAAQ;AAI7C;;AAGA,SAAgB,gBAQd,MACA,SACiE;CACjE,OAAO,MAA8B;EACnC,GAAG;EACH,QAAQ,uBAAuB,MAAM,QAAQ,UAAU,CAAC,CAAC;CAC3D,CAAC;AACH"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ElementsDefinition, ModPropsInput, Styles, StylesInterface, SubElementProps, TastyElementOptions, TastyPolymorphicComponent, TokenPropsInput, VariantMap } from "@tenphi/tasty";
|
|
2
|
+
import { ComponentProps, ComponentType, ElementType, ForwardRefExoticComponent, JSX, PropsWithoutRef, RefAttributes } from "react";
|
|
3
|
+
//#region src/define-component.d.ts
|
|
4
|
+
type InheritedParts<C> = { [Name in keyof C as Name extends string ? Name extends Capitalize<Name> ? C[Name] extends ComponentType<any> ? Name : never : never : never]: C[Name]; };
|
|
5
|
+
type SubElementTag<Definition extends ElementsDefinition[string]> = Definition extends string ? Definition : Definition extends {
|
|
6
|
+
as?: infer Tag;
|
|
7
|
+
} ? Tag extends keyof JSX.IntrinsicElements ? Tag : "div" : "div";
|
|
8
|
+
type SubElements<E extends ElementsDefinition> = { [Name in keyof E]: ForwardRefExoticComponent<PropsWithoutRef<SubElementProps<SubElementTag<E[Name]>>> & RefAttributes<SubElementTag<E[Name]> extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[SubElementTag<E[Name]>] : unknown>>; };
|
|
9
|
+
/** Extend a component's styles and defaults, preserving its props and compound parts. */
|
|
10
|
+
declare function extendComponent<C extends ComponentType<any>>(name: string, base: C, options: Partial<Omit<ComponentProps<C>, "as" | "styles">> & {
|
|
11
|
+
styles?: Styles;
|
|
12
|
+
}): ComponentType<ComponentProps<C>> & InheritedParts<C>;
|
|
13
|
+
/** Create a named component with its built-in or custom theme styles merged into its defaults. */
|
|
14
|
+
declare function defineComponent<K extends readonly (keyof StylesInterface)[], V extends VariantMap, E extends ElementsDefinition = Record<string, never>, AsType extends ElementType = "div", M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[]>(name: string, options: TastyElementOptions<K, V, E, AsType, M, TP>): TastyPolymorphicComponent<AsType, K, V, M, TP> & SubElements<E>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { defineComponent, extendComponent };
|
|
17
|
+
//# sourceMappingURL=define-component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-component.d.ts","names":[],"sources":["../src/define-component.ts"],"mappings":";;;KAwBK,eAAe,QAEhB,cAAc,KAAK,sBACf,aAAa,WAAW,QACtB,EAAE,cAAc,qBACd,+BAIP,EAAE;KAGF,cAAc,mBAAmB,8BACpC,4BACI,aACA;EAAqB,WAAW;IAC9B,kBAAkB,IAAI,oBACpB;KAKL,YAAY,UAAU,yBACxB,cAAc,IAAI,0BACjB,gBAAgB,gBAAgB,cAAc,EAAE,WAC9C,cACE,cAAc,EAAE,qBAAqB,wBACjC,sBAAsB,cAAc,EAAE;;iBAOlC,gBAAgB,UAAU,oBACxC,cACA,MAAM,GACN,SAAS,QAAQ,KAAK,eAAe;EACnC,SAAS;IAEV,cAAc,eAAe,MAAM,eAAe;;iBAcrC,gBACd,0BAA0B,oBAC1B,UAAU,YACV,UAAU,qBAAqB,uBAC/B,eAAe,qBACf,UAAU,kCACV,WAAW,oCAEX,cACA,SAAS,oBAAoB,GAAG,GAAG,GAAG,QAAQ,GAAG,MAChD,0BAA0B,QAAQ,GAAG,GAAG,GAAG,MAAM,YAAY"}
|
package/dist/eslint-plugin.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint-plugin.d.ts","names":[],"sources":["../src/tasty.config.ts","../src/eslint-plugin.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"eslint-plugin.d.ts","names":[],"sources":["../src/tasty.config.ts","../src/eslint-plugin.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCagB,uBACd,QAAO,cACN"}
|