@plexui/vue 0.24.3 → 0.26.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/es/components/Dialog/Dialog.js +3 -3
- package/dist/es/components/Dialog/Dialog.js.map +1 -1
- package/dist/es/components/Icon/index.js +1 -0
- package/dist/es/components/Icon/index.js.map +1 -1
- package/dist/es/components/Icon/svg/MinusLg.js +10 -0
- package/dist/es/components/Icon/svg/MinusLg.js.map +1 -0
- package/dist/es/components/Page/Page.js +77 -17
- package/dist/es/components/Page/Page.js.map +1 -1
- package/dist/es/components/Slider/Slider.js +34 -8
- package/dist/es/components/Slider/Slider.js.map +1 -1
- package/dist/es/components/TabBar/TabBar.js +3 -3
- package/dist/es/components/TabBar/TabBar.js.map +1 -1
- package/dist/es/components/Tabs/Tabs.js +26 -0
- package/dist/es/components/Tabs/Tabs.js.map +1 -1
- package/dist/es/components/Tabs/segments.js +92 -0
- package/dist/es/components/Tabs/segments.js.map +1 -0
- package/dist/es/components/Toolbar/Toolbar.js +184 -20
- package/dist/es/components/Toolbar/Toolbar.js.map +1 -1
- package/dist/es/components/Toolbar/index.js +1 -1
- package/dist/es/components/Toolbar/index.js.map +1 -1
- package/dist/types/components/Dialog/Dialog.d.ts +5 -5
- package/dist/types/components/Icon/index.d.ts +1 -0
- package/dist/types/components/Icon/svg/MinusLg.d.ts +3 -0
- package/dist/types/components/Page/Page.d.ts +5 -5
- package/dist/types/components/TabBar/TabBar.d.ts +11 -11
- package/dist/types/components/Tabs/segments.d.ts +19 -0
- package/dist/types/components/Toolbar/Toolbar.d.ts +39 -9
- package/dist/types/components/Toolbar/index.d.ts +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One width for the segments of a phone's segmented control. Shared by the React and Vue packages (the Vue copy must
|
|
3
|
+
* match).
|
|
4
|
+
*
|
|
5
|
+
* UISegmentedControl at its own width gives every segment the widest one's width (iOS 27.2); where that does not fit,
|
|
6
|
+
* each segment takes its label and the same air around it, as apportionsSegmentWidthsByContent does (ref-app
|
|
7
|
+
* segmented-hug, 13.11). A grid that hugs its content cannot size its tracks to the widest one by itself (the browser
|
|
8
|
+
* sizes it by the sum of its labels), so the widest is measured here and set as the track. Tabs.module.css asks for it
|
|
9
|
+
* with `--tabs-equal-segments: 1` on a phone's horizontal control that is not `block`; elsewhere nothing is set.
|
|
10
|
+
*/
|
|
11
|
+
const TRACK = "--tabs-segment-track";
|
|
12
|
+
/** The phone block of Tabs.module.css, where a control starts or stops asking for one width */
|
|
13
|
+
const PHONE_QUERY = "(max-width: 767px)";
|
|
14
|
+
/** Slack for the rounding of clientWidth */
|
|
15
|
+
const FIT_TOLERANCE_PX = 1;
|
|
16
|
+
const px = (style, name) => Number.parseFloat(style.getPropertyValue(name)) || 0;
|
|
17
|
+
/** The control's border box as laid out, unscaled and unrounded (offsetWidth rounds to whole pixels) */
|
|
18
|
+
const laidOutWidth = (root, style) => {
|
|
19
|
+
const width = px(style, "width");
|
|
20
|
+
if (!width)
|
|
21
|
+
return root.offsetWidth;
|
|
22
|
+
if (style.getPropertyValue("box-sizing") === "border-box")
|
|
23
|
+
return width;
|
|
24
|
+
const sides = ["padding-left", "padding-right", "border-left-width", "border-right-width"];
|
|
25
|
+
return sides.reduce((sum, side) => sum + px(style, side), width);
|
|
26
|
+
};
|
|
27
|
+
/** Sets the track and says whether it changed, so a thumb on a segment that moved can follow. */
|
|
28
|
+
export function equalizeSegments(root, thumb) {
|
|
29
|
+
if (!root)
|
|
30
|
+
return false;
|
|
31
|
+
const before = root.style.getPropertyValue(TRACK);
|
|
32
|
+
const style = getComputedStyle(root);
|
|
33
|
+
const asked = style.getPropertyValue("--tabs-equal-segments").trim() === "1";
|
|
34
|
+
// The segments of the row: a tab that is not drawn takes no track
|
|
35
|
+
const segments = Array.from(root.children).filter((child) => child instanceof HTMLElement && child !== thumb && getComputedStyle(child).getPropertyValue("display") !== "none");
|
|
36
|
+
if (!asked || root.getAttribute("data-orientation") !== "horizontal" || segments.length < 2 || !root.offsetWidth) {
|
|
37
|
+
root.style.removeProperty(TRACK);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
// Each segment at its label's width, unscaled while the control is held (it grows under the finger)
|
|
41
|
+
root.style.setProperty(TRACK, "max-content");
|
|
42
|
+
const width = laidOutWidth(root, style);
|
|
43
|
+
const scale = width / (root.getBoundingClientRect().width || width);
|
|
44
|
+
const widest = Math.max(...segments.map((segment) => segment.getBoundingClientRect().width * scale));
|
|
45
|
+
root.style.setProperty(TRACK, `minmax(${widest}px, 1fr)`);
|
|
46
|
+
// The row of equal segments against the room the control has, counted: scrollWidth would take in a thumb still
|
|
47
|
+
// standing where its segment was
|
|
48
|
+
const row = widest * segments.length + px(style, "column-gap") * (segments.length - 1);
|
|
49
|
+
const room = root.clientWidth - px(style, "padding-left") - px(style, "padding-right");
|
|
50
|
+
if (row > room + FIT_TOLERANCE_PX)
|
|
51
|
+
root.style.removeProperty(TRACK);
|
|
52
|
+
}
|
|
53
|
+
return root.style.getPropertyValue(TRACK) !== before;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Measures again when the room changes (the segments may fit one width now), when the screen crosses into or out of
|
|
57
|
+
* the phone block (the control starts or stops asking, its room unchanged) and when the font loads and the labels
|
|
58
|
+
* widen. `moved` runs when the track changed, so the thumb can follow its segment, and always once the font has
|
|
59
|
+
* loaded: segments sized by their labels move then with no track and no size changing. Returns the cleanup.
|
|
60
|
+
*/
|
|
61
|
+
export function watchSegments(root, thumb, moved) {
|
|
62
|
+
const refit = () => {
|
|
63
|
+
if (equalizeSegments(root, thumb()))
|
|
64
|
+
moved();
|
|
65
|
+
};
|
|
66
|
+
const box = root.parentElement;
|
|
67
|
+
const observer = box && typeof ResizeObserver !== "undefined" ? new ResizeObserver(refit) : undefined;
|
|
68
|
+
if (box)
|
|
69
|
+
observer?.observe(box);
|
|
70
|
+
const phone = typeof window.matchMedia === "function" ? window.matchMedia(PHONE_QUERY) : undefined;
|
|
71
|
+
// Browsers before 2020 offer only addListener
|
|
72
|
+
if (phone?.addEventListener)
|
|
73
|
+
phone.addEventListener("change", refit);
|
|
74
|
+
else
|
|
75
|
+
phone?.addListener?.(refit);
|
|
76
|
+
let live = true;
|
|
77
|
+
document.fonts?.ready.then(() => {
|
|
78
|
+
if (!live)
|
|
79
|
+
return;
|
|
80
|
+
equalizeSegments(root, thumb());
|
|
81
|
+
moved();
|
|
82
|
+
});
|
|
83
|
+
return () => {
|
|
84
|
+
live = false;
|
|
85
|
+
observer?.disconnect();
|
|
86
|
+
if (phone?.removeEventListener)
|
|
87
|
+
phone.removeEventListener("change", refit);
|
|
88
|
+
else
|
|
89
|
+
phone?.removeListener?.(refit);
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=segments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segments.js","sourceRoot":"","sources":["../../../../src/components/Tabs/segments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,KAAK,GAAG,sBAAsB,CAAA;AAEpC,+FAA+F;AAC/F,MAAM,WAAW,GAAG,oBAAoB,CAAA;AAExC,4CAA4C;AAC5C,MAAM,gBAAgB,GAAG,CAAC,CAAA;AAE1B,MAAM,EAAE,GAAG,CAAC,KAA0B,EAAE,IAAY,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAA;AAE7G,wGAAwG;AACxG,MAAM,YAAY,GAAG,CAAC,IAAiB,EAAE,KAA0B,EAAE,EAAE;IACrE,MAAM,KAAK,GAAG,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAChC,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC,WAAW,CAAA;IACnC,IAAI,KAAK,CAAC,gBAAgB,CAAC,YAAY,CAAC,K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A;IAC9B,MAAM,QAAQ,GAAG,GAAG,IAAI,OAAO,cAAc,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IACrG,IAAI,GAAG;QAAE,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,CAAA;IAC/B,MAAM,KAAK,GAAG,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAClG,8CAA8C;IAC9C,IAAI,KAAK,EAAE,gBAAgB;QAAE,KAAK,CAAC,gBAAgB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;;QAC/D,KAAK,EAAE,WAAW,EAAE,CAAC,KAAK,CAAC,CAAA;IAChC,IAAI,IAAI,GAAG,IAAI,CAAA;IACf,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE;QAC9B,IAAI,CAAC,IAAI;YAAE,OAAM;QACjB,gBAAgB,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;QAC/B,KAAK,EAAE,CAAA;IACT,CAAC,CAAC,CAAA;IACF,OAAO,GAAG,EAAE;QACV,IAAI,GAAG,KAAK,CAAA;QACZ,QAAQ,EAAE,UAAU,EAAE,CAAA;QACtB,IAAI,KAAK,EAAE,mBAAmB;YAAE,KAAK,CAAC,mBAAmB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;;YACrE,KAAK,EAAE,cAAc,EAAE,CAAC,KAAK,CAAC,CAAA;IACrC,CAAC,CAAA;AACH,CAAC","sourcesContent":["/**\n * One width for the segments of a phone's segmented control. Shared by the React and Vue packages (the Vue copy must\n * match).\n *\n * UISegmentedControl at its own width gives every segment the widest one's width (iOS 27.2); where that does not fit,\n * each segment takes its label and the same air around it, as apportionsSegmentWidthsByContent does (ref-app\n * segmented-hug, 13.11). A grid that hugs its content cannot size its tracks to the widest one by itself (the browser\n * sizes it by the sum of its labels), so the widest is measured here and set as the track. Tabs.module.css asks for it\n * with `--tabs-equal-segments: 1` on a phone's horizontal control that is not `block`; elsewhere nothing is set.\n */\n\nconst TRACK = \"--tabs-segment-track\"\n\n/** The phone block of Tabs.module.css, where a control starts or stops asking for one width */\nconst PHONE_QUERY = \"(max-width: 767px)\"\n\n/** Slack for the rounding of clientWidth */\nconst FIT_TOLERANCE_PX = 1\n\nconst px = (style: CSSStyleDeclaration, name: string) => Number.parseFloat(style.getPropertyValue(name)) || 0\n\n/** The control's border box as laid out, unscaled and unrounded (offsetWidth rounds to whole pixels) */\nconst laidOutWidth = (root: HTMLElement, style: CSSStyleDeclaration) => {\n const width = px(style, \"width\")\n if (!width) return root.offsetWidth\n if (style.getPropertyValue(\"box-sizing\") === \"border-box\") return width\n const sides = [\"padding-left\", \"padding-right\", \"border-left-width\", \"border-right-width\"]\n return sides.reduce((sum, side) => sum + px(style, side), width)\n}\n\n/** Sets the track and says whether it changed, so a thumb on a segment that moved can follow. */\nexport function equalizeSegments(root: HTMLElement | null, thumb: HTMLElement | null): boolean {\n if (!root) return false\n const before = root.style.getPropertyValue(TRACK)\n const style = getComputedStyle(root)\n const asked = style.getPropertyValue(\"--tabs-equal-segments\").trim() === \"1\"\n // The segments of the row: a tab that is not drawn takes no track\n const segments = Array.from(root.children).filter(\n (child): child is HTMLElement =>\n child instanceof HTMLElement && child !== thumb && getComputedStyle(child).getPropertyValue(\"display\") !== \"none\",\n )\n if (!asked || root.getAttribute(\"data-orientation\") !== \"horizontal\" || segments.length < 2 || !root.offsetWidth) {\n root.style.removeProperty(TRACK)\n } else {\n // Each segment at its label's width, unscaled while the control is held (it grows under the finger)\n root.style.setProperty(TRACK, \"max-content\")\n const width = laidOutWidth(root, style)\n const scale = width / (root.getBoundingClientRect().width || width)\n const widest = Math.max(...segments.map((segment) => segment.getBoundingClientRect().width * scale))\n root.style.setProperty(TRACK, `minmax(${widest}px, 1fr)`)\n // The row of equal segments against the room the control has, counted: scrollWidth would take in a thumb still\n // standing where its segment was\n const row = widest * segments.length + px(style, \"column-gap\") * (segments.length - 1)\n const room = root.clientWidth - px(style, \"padding-left\") - px(style, \"padding-right\")\n if (row > room + FIT_TOLERANCE_PX) root.style.removeProperty(TRACK)\n }\n return root.style.getPropertyValue(TRACK) !== before\n}\n\n/**\n * Measures again when the room changes (the segments may fit one width now), when the screen crosses into or out of\n * the phone block (the control starts or stops asking, its room unchanged) and when the font loads and the labels\n * widen. `moved` runs when the track changed, so the thumb can follow its segment, and always once the font has\n * loaded: segments sized by their labels move then with no track and no size changing. Returns the cleanup.\n */\nexport function watchSegments(root: HTMLElement, thumb: () => HTMLElement | null, moved: () => void): () => void {\n const refit = () => {\n if (equalizeSegments(root, thumb())) moved()\n }\n const box = root.parentElement\n const observer = box && typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(refit) : undefined\n if (box) observer?.observe(box)\n const phone = typeof window.matchMedia === \"function\" ? window.matchMedia(PHONE_QUERY) : undefined\n // Browsers before 2020 offer only addListener\n if (phone?.addEventListener) phone.addEventListener(\"change\", refit)\n else phone?.addListener?.(refit)\n let live = true\n document.fonts?.ready.then(() => {\n if (!live) return\n equalizeSegments(root, thumb())\n moved()\n })\n return () => {\n live = false\n observer?.disconnect()\n if (phone?.removeEventListener) phone.removeEventListener(\"change\", refit)\n else phone?.removeListener?.(refit)\n }\n}\n"]}
|
|
@@ -1,21 +1,66 @@
|
|
|
1
|
-
import { computed, defineComponent, h, inject, onBeforeUnmount, onMounted, provide, ref, } from "vue";
|
|
1
|
+
import { computed, defineComponent, h, inject, onBeforeUnmount, onMounted, provide, ref, Teleport, watch, } from "vue";
|
|
2
2
|
import s from "@plexui/styles/components/Toolbar/Toolbar.module.css";
|
|
3
|
+
/** The background a bar draws, from its current name or an earlier one. */
|
|
4
|
+
export const barBackground = (background) => background === "edge" ? "soft" : background === "solid" ? "hard" : background;
|
|
3
5
|
export const TOOLBAR_HOST = Symbol("ToolbarHost");
|
|
4
6
|
// The title style of the top bar, which a large title on a page needs to show itself inline once scrolled.
|
|
5
7
|
const TOOLBAR_TITLE_STYLE = Symbol("ToolbarTitleStyle");
|
|
8
|
+
// The bar itself, which a large title in the content marks once it has gone under the bar.
|
|
9
|
+
const TOOLBAR_ELEMENT = Symbol("ToolbarElement");
|
|
10
|
+
// The tokens of a large title a bar can set for itself, which the title in the content no longer inherits from it.
|
|
11
|
+
const LARGE_TITLE_TOKENS = [
|
|
12
|
+
"--toolbar-padding-bottom",
|
|
13
|
+
"--toolbar-large-title-gap",
|
|
14
|
+
"--toolbar-large-title-font-size",
|
|
15
|
+
"--toolbar-large-title-line-height",
|
|
16
|
+
"--toolbar-large-title-descent",
|
|
17
|
+
"--toolbar-large-subtitle-font-size",
|
|
18
|
+
"--toolbar-large-subtitle-line-height",
|
|
19
|
+
"--toolbar-large-subtitle-descent",
|
|
20
|
+
];
|
|
6
21
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
22
|
+
* Follows a large title in the content: it takes the large title tokens the bar sets for itself, and once its last line
|
|
23
|
+
* is at the bar's bottom the bar shows it inline. Scrolling moves it; a change of layout (a wide window turning into a
|
|
24
|
+
* phone's, which shows the bar and the title) or of a class or style on the bar, the content or around them measures it
|
|
25
|
+
* again. A token the bar shares with the content stays inherited, so it follows the page's changes. A hidden title has
|
|
26
|
+
* not gone under anything.
|
|
10
27
|
*/
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
28
|
+
function followLargeTitle(bar, heading, subscribeScroll) {
|
|
29
|
+
const collapse = () => {
|
|
30
|
+
const box = heading.getBoundingClientRect();
|
|
31
|
+
bar.toggleAttribute("data-title-collapsed", box.height > 0 && box.bottom <= bar.getBoundingClientRect().bottom);
|
|
32
|
+
};
|
|
33
|
+
const layout = () => {
|
|
34
|
+
const own = getComputedStyle(bar);
|
|
35
|
+
const place = heading.parentElement ? getComputedStyle(heading.parentElement) : undefined;
|
|
36
|
+
for (const token of LARGE_TITLE_TOKENS) {
|
|
37
|
+
const value = own.getPropertyValue(token).trim();
|
|
38
|
+
if (value && value !== place?.getPropertyValue(token).trim())
|
|
39
|
+
heading.style.setProperty(token, value);
|
|
40
|
+
else
|
|
41
|
+
heading.style.removeProperty(token);
|
|
42
|
+
}
|
|
43
|
+
collapse();
|
|
44
|
+
};
|
|
45
|
+
layout();
|
|
46
|
+
const unsubscribe = subscribeScroll(collapse);
|
|
47
|
+
const observer = typeof ResizeObserver !== "undefined" ? new ResizeObserver(layout) : undefined;
|
|
48
|
+
observer?.observe(bar);
|
|
49
|
+
observer?.observe(heading);
|
|
50
|
+
const mutations = typeof MutationObserver !== "undefined" ? new MutationObserver(layout) : undefined;
|
|
51
|
+
// A token reaches the bar or the content from the class or style of either or of anything around them.
|
|
52
|
+
for (const start of [bar, heading.parentElement]) {
|
|
53
|
+
for (let node = start; node; node = node.parentElement)
|
|
54
|
+
mutations?.observe(node, { attributes: true, attributeFilter: ["class", "style"] });
|
|
55
|
+
}
|
|
56
|
+
return () => {
|
|
57
|
+
unsubscribe();
|
|
58
|
+
observer?.disconnect();
|
|
59
|
+
mutations?.disconnect();
|
|
60
|
+
bar.removeAttribute("data-title-collapsed");
|
|
61
|
+
for (const token of LARGE_TITLE_TOKENS)
|
|
62
|
+
heading.style.removeProperty(token);
|
|
63
|
+
};
|
|
19
64
|
}
|
|
20
65
|
const ToolbarComponent = defineComponent({
|
|
21
66
|
name: "Toolbar",
|
|
@@ -33,6 +78,7 @@ const ToolbarComponent = defineComponent({
|
|
|
33
78
|
const host = inject(TOOLBAR_HOST, null);
|
|
34
79
|
provide(TOOLBAR_TITLE_STYLE, computed(() => (props.placement === "top" ? props.titleStyle : undefined)));
|
|
35
80
|
const element = ref(null);
|
|
81
|
+
provide(TOOLBAR_ELEMENT, element);
|
|
36
82
|
let observer;
|
|
37
83
|
let reported;
|
|
38
84
|
onMounted(() => {
|
|
@@ -46,7 +92,6 @@ const ToolbarComponent = defineComponent({
|
|
|
46
92
|
setHeight(reported, undefined);
|
|
47
93
|
reported = props.placement;
|
|
48
94
|
setHeight(props.placement, bar.offsetHeight || undefined);
|
|
49
|
-
measureLargeTitle(bar);
|
|
50
95
|
};
|
|
51
96
|
update();
|
|
52
97
|
observer = typeof ResizeObserver !== "undefined" ? new ResizeObserver(update) : undefined;
|
|
@@ -64,10 +109,11 @@ const ToolbarComponent = defineComponent({
|
|
|
64
109
|
"data-placement": props.placement,
|
|
65
110
|
"data-title-style": props.placement === "top" ? props.titleStyle : undefined,
|
|
66
111
|
"data-title-align": props.placement === "top" ? props.titleAlign : undefined,
|
|
67
|
-
"data-background":
|
|
112
|
+
"data-background": barBackground(props.background) ?? (props.placement === "bottom" ? "soft" : "glass"),
|
|
68
113
|
"data-host": host?.kind,
|
|
69
114
|
"data-scrolled": props.placement === "top" && host?.scrolled?.value ? "" : undefined,
|
|
70
115
|
"data-content-below": props.placement === "bottom" && host?.contentBelow?.value ? "" : undefined,
|
|
116
|
+
"data-rows-pinned": props.placement === "top" && host?.rowsPinned?.value ? "" : undefined,
|
|
71
117
|
}, slots.default?.());
|
|
72
118
|
},
|
|
73
119
|
});
|
|
@@ -87,6 +133,95 @@ export const ToolbarLeading = part("ToolbarLeading", s.Leading);
|
|
|
87
133
|
export const ToolbarTrailing = part("ToolbarTrailing", s.Trailing);
|
|
88
134
|
/** Buttons that share one capsule (React `Toolbar.Group`). */
|
|
89
135
|
export const ToolbarGroup = part("ToolbarGroup", s.Group, "group");
|
|
136
|
+
const rowOfAnchor = new WeakMap();
|
|
137
|
+
/**
|
|
138
|
+
* Under a large title each row is portaled into the rows' place as it mounts, so a row that comes later (a search field
|
|
139
|
+
* shown over a segmented control already there) would stand last. An empty anchor in the bar keeps the row's place among
|
|
140
|
+
* the bar's rows, and the rows are moved into that order in the content, so the keyboard and a screen reader meet them
|
|
141
|
+
* as they stand (Codex #7); a row added or removed in the bar orders them again.
|
|
142
|
+
* (React's twin)
|
|
143
|
+
*/
|
|
144
|
+
function followRowOrder(anchor, row) {
|
|
145
|
+
const bar = anchor.closest("[data-toolbar]") ?? anchor.parentElement;
|
|
146
|
+
if (!bar)
|
|
147
|
+
return () => { };
|
|
148
|
+
rowOfAnchor.set(anchor, row);
|
|
149
|
+
const place = () => {
|
|
150
|
+
const slot = row.parentElement;
|
|
151
|
+
if (!slot)
|
|
152
|
+
return;
|
|
153
|
+
const rows = Array.from(bar.querySelectorAll("[data-toolbar-row-anchor]"), (mark) => rowOfAnchor.get(mark))
|
|
154
|
+
.filter((each) => each?.parentElement === slot);
|
|
155
|
+
// From the last row back, a row that does not stand before the next one goes right before it: only a row out of
|
|
156
|
+
// place moves (the one that came later), so a field focused in another row keeps its focus (Codex #8); moveBefore,
|
|
157
|
+
// where the browser has it, keeps it even in the row that moves.
|
|
158
|
+
const move = slot.moveBefore;
|
|
159
|
+
for (let index = rows.length - 2; index >= 0; index--) {
|
|
160
|
+
const each = rows[index];
|
|
161
|
+
const next = rows[index + 1];
|
|
162
|
+
if (each.compareDocumentPosition(next) & Node.DOCUMENT_POSITION_FOLLOWING)
|
|
163
|
+
continue;
|
|
164
|
+
try {
|
|
165
|
+
if (move) {
|
|
166
|
+
move.call(slot, each, next);
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
catch {
|
|
171
|
+
// falls back to a plain move
|
|
172
|
+
}
|
|
173
|
+
slot.insertBefore(each, next);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
place();
|
|
177
|
+
const observer = typeof MutationObserver !== "undefined" ? new MutationObserver(place) : undefined;
|
|
178
|
+
observer?.observe(bar, { childList: true, subtree: true });
|
|
179
|
+
return () => {
|
|
180
|
+
observer?.disconnect();
|
|
181
|
+
rowOfAnchor.delete(anchor);
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* A row under the controls, part of the bar: a segmented control that switches the screen's views (a chat list's
|
|
186
|
+
* folders under its bar), or a search field. It spans the bar, and a control in it fills the row; several rows stand in
|
|
187
|
+
* their order (a search field over a segmented control). Under a large title on a page the rows stand under the title,
|
|
188
|
+
* at the top of the content, and once scrolled up to the bar they stay pinned under its controls, as iOS 27.2 pins a
|
|
189
|
+
* safeAreaBar under a large title's bar (React `Toolbar.Row`).
|
|
190
|
+
*/
|
|
191
|
+
export const ToolbarRow = defineComponent({
|
|
192
|
+
name: "ToolbarRow",
|
|
193
|
+
inheritAttrs: false,
|
|
194
|
+
setup(_, { slots, attrs }) {
|
|
195
|
+
const host = inject(TOOLBAR_HOST, null);
|
|
196
|
+
const titleStyle = inject(TOOLBAR_TITLE_STYLE, null);
|
|
197
|
+
const large = computed(() => titleStyle?.value === "large" && host?.kind === "page");
|
|
198
|
+
const slot = computed(() => (large.value ? host?.largeTitleRowSlot?.value ?? null : null));
|
|
199
|
+
let release;
|
|
200
|
+
onMounted(() => { if (large.value)
|
|
201
|
+
release = host?.requestLargeTitleSlot?.(); });
|
|
202
|
+
watch(large, (value) => {
|
|
203
|
+
release?.();
|
|
204
|
+
release = value ? host?.requestLargeTitleSlot?.() : undefined;
|
|
205
|
+
});
|
|
206
|
+
onBeforeUnmount(() => release?.());
|
|
207
|
+
const element = ref(null);
|
|
208
|
+
const anchor = ref(null);
|
|
209
|
+
let stopOrder;
|
|
210
|
+
watch([slot, element, anchor], ([place, row, mark]) => {
|
|
211
|
+
stopOrder?.();
|
|
212
|
+
stopOrder = place && row && mark ? followRowOrder(mark, row) : undefined;
|
|
213
|
+
}, { flush: "post" });
|
|
214
|
+
onBeforeUnmount(() => { stopOrder?.(); stopOrder = undefined; });
|
|
215
|
+
return () => {
|
|
216
|
+
const place = slot.value;
|
|
217
|
+
const row = h("div", { ...attrs, "ref": element, "class": [s.Row, attrs.class], "data-toolbar-row": "", "data-in-content": place ? "" : undefined }, slots.default?.());
|
|
218
|
+
// Under a large title the row waits for its place in the content, as React's does.
|
|
219
|
+
if (large.value)
|
|
220
|
+
return place ? [h(Teleport, { to: place }, [row]), h("span", { "ref": anchor, "data-toolbar-row-anchor": "", "hidden": true })] : null;
|
|
221
|
+
return row;
|
|
222
|
+
};
|
|
223
|
+
},
|
|
224
|
+
});
|
|
90
225
|
/** Custom middle content: a search field, a segmented control or a single centered action (React `Toolbar.Content`). */
|
|
91
226
|
export const ToolbarContent = defineComponent({
|
|
92
227
|
name: "ToolbarContent",
|
|
@@ -115,23 +250,52 @@ export const ToolbarTitle = defineComponent({
|
|
|
115
250
|
setup(props, { slots, attrs }) {
|
|
116
251
|
const host = inject(TOOLBAR_HOST, null);
|
|
117
252
|
const titleStyle = inject(TOOLBAR_TITLE_STYLE, null);
|
|
253
|
+
const bar = inject(TOOLBAR_ELEMENT, null);
|
|
254
|
+
const heading = ref(null);
|
|
255
|
+
const large = computed(() => titleStyle?.value === "large" && host?.kind === "page");
|
|
256
|
+
const slot = computed(() => (large.value ? host?.largeTitleSlot?.value ?? null : null));
|
|
257
|
+
let release;
|
|
258
|
+
onMounted(() => { if (large.value)
|
|
259
|
+
release = host?.requestLargeTitleSlot?.(); });
|
|
260
|
+
watch(large, (value) => {
|
|
261
|
+
release?.();
|
|
262
|
+
release = value ? host?.requestLargeTitleSlot?.() : undefined;
|
|
263
|
+
});
|
|
264
|
+
// In the content the title scrolls with it, on the compositor and through the overscroll, as on iOS 26. Once it has
|
|
265
|
+
// gone under the bar (its last line at the bar's bottom), the bar shows it inline and a hard or glass bar its line.
|
|
266
|
+
// It starts once mounted too: a bar replaced under a page that keeps its content finds the place already there.
|
|
267
|
+
let stopFollowing;
|
|
268
|
+
const follow = () => {
|
|
269
|
+
stopFollowing?.();
|
|
270
|
+
stopFollowing = undefined;
|
|
271
|
+
const element = bar?.value;
|
|
272
|
+
const title = heading.value;
|
|
273
|
+
if (!slot.value || !element || !title || !host?.subscribeScroll)
|
|
274
|
+
return;
|
|
275
|
+
stopFollowing = followLargeTitle(element, title, host.subscribeScroll);
|
|
276
|
+
};
|
|
277
|
+
onMounted(follow);
|
|
278
|
+
watch([slot, () => bar?.value], follow, { flush: "post" });
|
|
279
|
+
onBeforeUnmount(() => { stopFollowing?.(); release?.(); });
|
|
118
280
|
return () => {
|
|
119
281
|
// An empty subtitle, from the prop or a slot that renders nothing, leaves the title on one line, as in React.
|
|
120
282
|
const present = (value) => (Array.isArray(value) ? value.length > 0 : value != null && value !== "");
|
|
121
283
|
const subtitle = slots.subtitle?.() ?? props.subtitle;
|
|
122
|
-
const
|
|
284
|
+
const place = slot.value;
|
|
285
|
+
const title = h("div", { "ref": heading, "class": s.Heading, "aria-hidden": host?.kind === "dialog" ? "true" : undefined, "data-in-content": place ? "" : undefined }, [
|
|
123
286
|
h(props.as, { ...attrs, class: [s.Title, attrs.class] }, slots.default?.()),
|
|
124
287
|
present(subtitle) ? h("p", { class: s.Subtitle }, subtitle) : null,
|
|
125
288
|
]);
|
|
126
|
-
if (
|
|
127
|
-
return
|
|
128
|
-
//
|
|
129
|
-
//
|
|
289
|
+
if (!large.value)
|
|
290
|
+
return title;
|
|
291
|
+
// Until the content has made its place (a server-rendered page before it hydrates), the title stands in the bar
|
|
292
|
+
// where it will stand in the content. The inline copy the row of controls shows once the large title has gone
|
|
293
|
+
// under it keeps a subtitle as a second line, as in the inline title (iOS 26 kit Toolbar - Top - iPhone, Title 2 Line).
|
|
130
294
|
const copySubtitle = slots.subtitle?.() ?? props.subtitle;
|
|
131
295
|
const copy = present(copySubtitle)
|
|
132
296
|
? [h("span", { class: s.CollapsedLine }, slots.default?.()), h("span", { class: s.CollapsedSubtitle }, copySubtitle)]
|
|
133
297
|
: slots.default?.();
|
|
134
|
-
return [
|
|
298
|
+
return [h(Teleport, { to: place ?? "body", disabled: !place }, [title]), h("span", { "class": s.CollapsedTitle, "aria-hidden": "true" }, copy)];
|
|
135
299
|
};
|
|
136
300
|
},
|
|
137
301
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;gBAC3E,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI;aACnE,CAAC,CAAA;YACF,IAAI,UAAU,EAAE,KAAK,KAAK,OAAO,IAAI,IAAI,EAAE,IAAI,KAAK,MAAM;gBAAE,OAAO,OAAO,CAAA;YAC1E,yGAAyG;YACzG,8FAA8F;YAC9F,MAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,EAAE,EAAE,IAAI,KAAK,CAAC,QAAQ,CAAA;YACzD,MAAM,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC;gBAChC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,aAAa,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,iBAAiB,EAAE,EAAE,YAAY,CAAC,CAAC;gBACrH,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAA;YACrB,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,CAAC,CAAA;QACzF,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA","sourcesContent":["import {\n computed,\n defineComponent,\n h,\n inject,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n type ComputedRef,\n type HTMLAttributes,\n type InjectionKey,\n type PropType,\n type Ref,\n} from \"vue\"\nimport s from \"@plexui/styles/components/Toolbar/Toolbar.module.css\"\n\n// Vue port of packages/ui/src/components/Toolbar/Toolbar.tsx. Exports are flat\n// (`ToolbarLeading` for `Toolbar.Leading`, ...).\n\nexport type ToolbarPlacement = \"top\" | \"bottom\"\n/** Title layouts of the phone top bar. */\nexport type ToolbarTitleStyle = \"inline\" | \"large\" | \"compact-large\" | \"compact-medium\"\nexport type ToolbarTitleAlign = \"center\" | \"start\"\n/**\n * How a bar meets the content scrolled under it, after the scroll edge effect of iOS 26:\n * - `\"soft\"` (the default of a bottom bar): at the top, the canvas color covers the content under the bar's controls and fades out past them, over a\n * light blur; at the bottom of a page the content stays clear under and around the controls, as on native iOS 26,\n * and a Sheet's bottom bar fades its content into the panel\n * - `\"hard\"`: an opaque bar of the canvas color with a line once content is under it\n * - `\"glass\"` (the default of a top bar): a translucent, blurred bar with a hairline, shown once content is under it\n * - `\"solid\"`: an opaque bar of the canvas color without a line\n */\nexport type BarBackground = \"soft\" | \"hard\" | \"glass\" | \"solid\"\n/** `\"edge\"` is the earlier name of `\"soft\"`. */\nexport type ToolbarBackground = BarBackground | \"edge\"\n\n/**\n * A surface that places phone toolbars: `Page` puts the top bar over its content\n * and reserves the space; `Dialog` puts it 16px under the Sheet's top edge.\n */\nexport type ToolbarHost = {\n kind: \"page\" | \"dialog\"\n setHeight?: (placement: ToolbarPlacement, height: number | undefined) => void\n /** Content has scrolled under the top bar, so its glass casts a shadow and a hard or glass bar shows its line. */\n scrolled?: Ref<boolean>\n /** Content continues under the bottom bar, so a hard or glass bar shows its line. */\n contentBelow?: Ref<boolean>\n /** Calls the listener with the content's scroll offset on every scroll; returns the unsubscribe. A TabBar minimizes with it. */\n subscribeScroll?: (listener: (scrollTop: number) => void) => () => void\n}\n\nexport const TOOLBAR_HOST: InjectionKey<ToolbarHost> = Symbol(\"ToolbarHost\")\n\n// The title style of the top bar, which a large title on a page needs to show itself inline once scrolled.\nconst TOOLBAR_TITLE_STYLE: InjectionKey<ComputedRef<ToolbarTitleStyle | undefined>> = Symbol(\"ToolbarTitleStyle\")\n\n/**\n * A large title on a page scrolls up with the content under the row of controls; the row shows the\n * title inline once it has gone. The distance it travels (the gap above it and its height) goes to\n * `--toolbar-large-title-travel`, in pixels as a number, as the page's `--page-scroll-y` is.\n */\nfunction measureLargeTitle(bar: HTMLElement) {\n if (bar.dataset.titleStyle !== \"large\") return\n const heading = Array.from(bar.children).find((child): child is HTMLElement => child instanceof HTMLElement && child.classList.contains(s.Heading))\n if (!heading) return\n const gap = Number.parseFloat(getComputedStyle(bar).rowGap) || 0\n bar.style.setProperty(\"--toolbar-large-title-travel\", String(heading.offsetHeight + gap))\n}\n\nconst ToolbarComponent = defineComponent({\n name: \"Toolbar\",\n props: {\n /** @default \"top\" */\n placement: { type: String as PropType<ToolbarPlacement>, default: \"top\" },\n /** Layout of `ToolbarTitle` in a top bar. @default \"inline\" */\n titleStyle: { type: String as PropType<ToolbarTitleStyle>, default: \"inline\" },\n /** Alignment of an inline title. Compact and large titles always start at the leading edge. @default \"center\" */\n titleAlign: { type: String as PropType<ToolbarTitleAlign>, default: \"center\" },\n /** How the bar meets the content scrolled under it on a phone. @default \"glass\" at the top, \"soft\" at the bottom */\n background: { type: String as PropType<ToolbarBackground>, default: undefined },\n },\n setup(props, { slots }) {\n const host = inject(TOOLBAR_HOST, null)\n provide(TOOLBAR_TITLE_STYLE, computed(() => (props.placement === \"top\" ? props.titleStyle : undefined)))\n const element = ref<HTMLElement | null>(null)\n let observer: ResizeObserver | undefined\n let reported: ToolbarPlacement | undefined\n onMounted(() => {\n const bar = element.value\n const setHeight = host?.setHeight\n if (!bar || !setHeight) return\n // A desktop layout hides the bar; its height then leaves the host's own header in charge.\n const update = () => {\n if (reported && reported !== props.placement) setHeight(reported, undefined)\n reported = props.placement\n setHeight(props.placement, bar.offsetHeight || undefined)\n measureLargeTitle(bar)\n }\n update()\n observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n observer?.observe(bar, { box: \"border-box\" })\n })\n onBeforeUnmount(() => {\n observer?.disconnect()\n if (reported) host?.setHeight?.(reported, undefined)\n })\n return () => h(\"div\", {\n \"ref\": element,\n \"class\": s.Toolbar,\n \"data-toolbar\": \"\",\n \"data-placement\": props.placement,\n \"data-title-style\": props.placement === \"top\" ? props.titleStyle : undefined,\n \"data-title-align\": props.placement === \"top\" ? props.titleAlign : undefined,\n \"data-background\": props.background === \"edge\" ? \"soft\" : (props.background ?? (props.placement === \"bottom\" ? \"soft\" : \"glass\")),\n \"data-host\": host?.kind,\n \"data-scrolled\": props.placement === \"top\" && host?.scrolled?.value ? \"\" : undefined,\n \"data-content-below\": props.placement === \"bottom\" && host?.contentBelow?.value ? \"\" : undefined,\n }, slots.default?.())\n },\n})\n\n/** Props of `Toolbar`. */\nexport type ToolbarProps = {\n placement?: ToolbarPlacement\n titleStyle?: ToolbarTitleStyle\n titleAlign?: ToolbarTitleAlign\n /** How the bar meets the content scrolled under it on a phone. @default \"glass\" at the top, \"soft\" at the bottom */\n background?: ToolbarBackground\n} & HTMLAttributes\n\n/** A phone toolbar, top or bottom. It never renders at the desktop breakpoint. */\nexport const Toolbar = ToolbarComponent as typeof ToolbarComponent & { new (): { $props: ToolbarProps } }\n\nfunction part(name: string, className: string, role?: string) {\n return defineComponent({\n name,\n setup(_, { slots }) {\n return () => h(\"div\", { class: className, role }, slots.default?.())\n },\n })\n}\n\n/** Items at the leading edge (React `Toolbar.Leading`). */\nexport const ToolbarLeading = part(\"ToolbarLeading\", s.Leading)\n/** Items at the trailing edge (React `Toolbar.Trailing`). */\nexport const ToolbarTrailing = part(\"ToolbarTrailing\", s.Trailing)\n/** Buttons that share one capsule (React `Toolbar.Group`). */\nexport const ToolbarGroup = part(\"ToolbarGroup\", s.Group, \"group\")\n\n/** Custom middle content: a search field, a segmented control or a single centered action (React `Toolbar.Content`). */\nexport const ToolbarContent = defineComponent({\n name: \"ToolbarContent\",\n props: {\n /** Stretch between the leading and trailing items, as a search field does. */\n fill: { type: Boolean, default: false },\n },\n setup(props, { slots }) {\n return () => h(\"div\", { \"class\": s.Content, \"data-fill\": props.fill ? \"\" : undefined }, slots.default?.())\n },\n})\n\n/** The bar title, with an optional second line (React `Toolbar.Title`). */\nexport const ToolbarTitle = defineComponent({\n name: \"ToolbarTitle\",\n inheritAttrs: false,\n props: {\n /** A second, smaller line below the title. The `subtitle` slot takes precedence. */\n subtitle: { type: String, default: undefined },\n /**\n * Heading level. In a Dialog the dialog's own title names the Sheet, so the bar title is hidden\n * from assistive technology there.\n * @default \"h1\"\n */\n as: { type: String as PropType<\"h1\" | \"h2\" | \"h3\">, default: \"h1\" },\n },\n setup(props, { slots, attrs }) {\n const host = inject(TOOLBAR_HOST, null)\n const titleStyle = inject(TOOLBAR_TITLE_STYLE, null)\n return () => {\n // An empty subtitle, from the prop or a slot that renders nothing, leaves the title on one line, as in React.\n const present = (value: unknown) => (Array.isArray(value) ? value.length > 0 : value != null && value !== \"\")\n const subtitle = slots.subtitle?.() ?? props.subtitle\n const heading = h(\"div\", { \"class\": s.Heading, \"aria-hidden\": host?.kind === \"dialog\" ? \"true\" : undefined }, [\n h(props.as, { ...attrs, class: [s.Title, attrs.class] }, slots.default?.()),\n present(subtitle) ? h(\"p\", { class: s.Subtitle }, subtitle) : null,\n ])\n if (titleStyle?.value !== \"large\" || host?.kind !== \"page\") return heading\n // The inline copy the row of controls shows once the large title has scrolled under it. A subtitle stays\n // as a second line, as in the inline title (iOS 26 kit Toolbar - Top - iPhone, Title 2 Line).\n const copySubtitle = slots.subtitle?.() ?? props.subtitle\n const copy = present(copySubtitle)\n ? [h(\"span\", { class: s.CollapsedLine }, slots.default?.()), h(\"span\", { class: s.CollapsedSubtitle }, copySubtitle)]\n : slots.default?.()\n return [heading, h(\"span\", { \"class\": s.CollapsedTitle, \"aria-hidden\": \"true\" }, copy)]\n }\n },\n})\n"]}
|
|
1
|
+
{"version":3,"file":"Toolbar.js","sourceRoot":"","sources":["../../../../src/components/Toolbar/Toolbar.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAA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,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,iBAAiB,EAAE,EAAE,YAAY,CAAC,CAAC;gBACrH,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAA;YACrB,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,KAAK,IAAI,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,CAAC,CAAA;QACjJ,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA","sourcesContent":["import {\n computed,\n defineComponent,\n h,\n inject,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n Teleport,\n watch,\n type ComputedRef,\n type HTMLAttributes,\n type InjectionKey,\n type PropType,\n type Ref,\n} from \"vue\"\nimport s from \"@plexui/styles/components/Toolbar/Toolbar.module.css\"\n\n// Vue port of packages/ui/src/components/Toolbar/Toolbar.tsx. Exports are flat\n// (`ToolbarLeading` for `Toolbar.Leading`, ...).\n\nexport type ToolbarPlacement = \"top\" | \"bottom\"\n/** Title layouts of the phone top bar. */\nexport type ToolbarTitleStyle = \"inline\" | \"large\" | \"compact-large\" | \"compact-medium\"\nexport type ToolbarTitleAlign = \"center\" | \"start\"\n/**\n * How a bar meets the content scrolled under it, after the scroll edge effect of iOS 26:\n * - `\"soft\"` (the default of a bottom bar): at the top, once content is under the bar, a blur that grows toward the top under a\n * thin veil of the canvas color, with no line, which lets go past the bar; at the bottom of a page the content stays clear\n * under and around the controls, as on native iOS 26, and a Sheet's bottom bar fades its content into the panel\n * - `\"hard\"`: an opaque bar of the canvas color with a hairline once content is under it\n * - `\"glass\"` (the default of a top bar): a translucent, blurred bar with a hairline, shown once content is under it\n * - `\"blur\"`: no fill and no line, once content is under the bar: the content blurred a little over the bar and past it,\n * and heavily toward the screen's edge\n *\n * iOS 27.2 has two scroll edges, soft and hard; glass is the bar of earlier iOS and blur an app's own.\n */\nexport type BarBackground = \"soft\" | \"hard\" | \"glass\" | \"blur\"\n/**\n * `\"solid\"` is the earlier name of `\"hard\"`: iOS has no opaque bar without a line, and it draws the line of a hard edge\n * only once content is under the bar, so at rest the two look the same.\n */\nexport type BarBackgroundAlias = \"solid\"\n/** `\"edge\"` is the earlier name of `\"soft\"`, `\"solid\"` of `\"hard\"`. */\nexport type ToolbarBackground = BarBackground | BarBackgroundAlias | \"edge\"\n\n/** The background a bar draws, from its current name or an earlier one. */\nexport const barBackground = (background: ToolbarBackground | undefined): BarBackground | undefined =>\n background === \"edge\" ? \"soft\" : background === \"solid\" ? \"hard\" : background\n\n/**\n * A surface that places phone toolbars: `Page` puts the top bar over its content\n * and reserves the space; `Dialog` puts it 16px under the Sheet's top edge.\n */\nexport type ToolbarHost = {\n kind: \"page\" | \"dialog\"\n setHeight?: (placement: ToolbarPlacement, height: number | undefined) => void\n /** Content has scrolled under the top bar, so its glass casts a shadow and a hard or glass bar shows its line. */\n scrolled?: Ref<boolean>\n /** Content continues under the bottom bar, so a hard or glass bar shows its line. */\n contentBelow?: Ref<boolean>\n /** Calls the listener with the content's scroll offset on every scroll; returns the unsubscribe. A TabBar minimizes with it. */\n subscribeScroll?: (listener: (scrollTop: number) => void) => () => void\n /** A large title asks for a place in the content; returns the release. */\n requestLargeTitleSlot?: () => () => void\n /** The place at the top of the content where a large title scrolls with it, once the content has made one. */\n largeTitleSlot?: Ref<HTMLElement | null>\n /** The place under a large title where the bar's rows stand, pinned under the bar once scrolled up to it. */\n largeTitleRowSlot?: Ref<HTMLElement | null>\n /** The rows under a large title are pinned under the bar, so its background reaches under them. */\n rowsPinned?: Ref<boolean>\n}\n\nexport const TOOLBAR_HOST: InjectionKey<ToolbarHost> = Symbol(\"ToolbarHost\")\n\n// The title style of the top bar, which a large title on a page needs to show itself inline once scrolled.\nconst TOOLBAR_TITLE_STYLE: InjectionKey<ComputedRef<ToolbarTitleStyle | undefined>> = Symbol(\"ToolbarTitleStyle\")\n// The bar itself, which a large title in the content marks once it has gone under the bar.\nconst TOOLBAR_ELEMENT: InjectionKey<Ref<HTMLElement | null>> = Symbol(\"ToolbarElement\")\n\n// The tokens of a large title a bar can set for itself, which the title in the content no longer inherits from it.\nconst LARGE_TITLE_TOKENS = [\n \"--toolbar-padding-bottom\",\n \"--toolbar-large-title-gap\",\n \"--toolbar-large-title-font-size\",\n \"--toolbar-large-title-line-height\",\n \"--toolbar-large-title-descent\",\n \"--toolbar-large-subtitle-font-size\",\n \"--toolbar-large-subtitle-line-height\",\n \"--toolbar-large-subtitle-descent\",\n]\n\n/**\n * Follows a large title in the content: it takes the large title tokens the bar sets for itself, and once its last line\n * is at the bar's bottom the bar shows it inline. Scrolling moves it; a change of layout (a wide window turning into a\n * phone's, which shows the bar and the title) or of a class or style on the bar, the content or around them measures it\n * again. A token the bar shares with the content stays inherited, so it follows the page's changes. A hidden title has\n * not gone under anything.\n */\nfunction followLargeTitle(bar: HTMLElement, heading: HTMLElement, subscribeScroll: (listener: () => void) => () => void) {\n const collapse = () => {\n const box = heading.getBoundingClientRect()\n bar.toggleAttribute(\"data-title-collapsed\", box.height > 0 && box.bottom <= bar.getBoundingClientRect().bottom)\n }\n const layout = () => {\n const own = getComputedStyle(bar)\n const place = heading.parentElement ? getComputedStyle(heading.parentElement) : undefined\n for (const token of LARGE_TITLE_TOKENS) {\n const value = own.getPropertyValue(token).trim()\n if (value && value !== place?.getPropertyValue(token).trim()) heading.style.setProperty(token, value)\n else heading.style.removeProperty(token)\n }\n collapse()\n }\n layout()\n const unsubscribe = subscribeScroll(collapse)\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(layout) : undefined\n observer?.observe(bar)\n observer?.observe(heading)\n const mutations = typeof MutationObserver !== \"undefined\" ? new MutationObserver(layout) : undefined\n // A token reaches the bar or the content from the class or style of either or of anything around them.\n for (const start of [bar, heading.parentElement]) {\n for (let node = start; node; node = node.parentElement) mutations?.observe(node, { attributes: true, attributeFilter: [\"class\", \"style\"] })\n }\n return () => {\n unsubscribe()\n observer?.disconnect()\n mutations?.disconnect()\n bar.removeAttribute(\"data-title-collapsed\")\n for (const token of LARGE_TITLE_TOKENS) heading.style.removeProperty(token)\n }\n}\n\nconst ToolbarComponent = defineComponent({\n name: \"Toolbar\",\n props: {\n /** @default \"top\" */\n placement: { type: String as PropType<ToolbarPlacement>, default: \"top\" },\n /** Layout of `ToolbarTitle` in a top bar. @default \"inline\" */\n titleStyle: { type: String as PropType<ToolbarTitleStyle>, default: \"inline\" },\n /** Alignment of an inline title. Compact and large titles always start at the leading edge. @default \"center\" */\n titleAlign: { type: String as PropType<ToolbarTitleAlign>, default: \"center\" },\n /** How the bar meets the content scrolled under it on a phone. @default \"glass\" at the top, \"soft\" at the bottom */\n background: { type: String as PropType<ToolbarBackground>, default: undefined },\n },\n setup(props, { slots }) {\n const host = inject(TOOLBAR_HOST, null)\n provide(TOOLBAR_TITLE_STYLE, computed(() => (props.placement === \"top\" ? props.titleStyle : undefined)))\n const element = ref<HTMLElement | null>(null)\n provide(TOOLBAR_ELEMENT, element)\n let observer: ResizeObserver | undefined\n let reported: ToolbarPlacement | undefined\n onMounted(() => {\n const bar = element.value\n const setHeight = host?.setHeight\n if (!bar || !setHeight) return\n // A desktop layout hides the bar; its height then leaves the host's own header in charge.\n const update = () => {\n if (reported && reported !== props.placement) setHeight(reported, undefined)\n reported = props.placement\n setHeight(props.placement, bar.offsetHeight || undefined)\n }\n update()\n observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n observer?.observe(bar, { box: \"border-box\" })\n })\n onBeforeUnmount(() => {\n observer?.disconnect()\n if (reported) host?.setHeight?.(reported, undefined)\n })\n return () => h(\"div\", {\n \"ref\": element,\n \"class\": s.Toolbar,\n \"data-toolbar\": \"\",\n \"data-placement\": props.placement,\n \"data-title-style\": props.placement === \"top\" ? props.titleStyle : undefined,\n \"data-title-align\": props.placement === \"top\" ? props.titleAlign : undefined,\n \"data-background\": barBackground(props.background) ?? (props.placement === \"bottom\" ? \"soft\" : \"glass\"),\n \"data-host\": host?.kind,\n \"data-scrolled\": props.placement === \"top\" && host?.scrolled?.value ? \"\" : undefined,\n \"data-content-below\": props.placement === \"bottom\" && host?.contentBelow?.value ? \"\" : undefined,\n \"data-rows-pinned\": props.placement === \"top\" && host?.rowsPinned?.value ? \"\" : undefined,\n }, slots.default?.())\n },\n})\n\n/** Props of `Toolbar`. */\nexport type ToolbarProps = {\n placement?: ToolbarPlacement\n titleStyle?: ToolbarTitleStyle\n titleAlign?: ToolbarTitleAlign\n /** How the bar meets the content scrolled under it on a phone. @default \"glass\" at the top, \"soft\" at the bottom */\n background?: ToolbarBackground\n} & HTMLAttributes\n\n/** A phone toolbar, top or bottom. It never renders at the desktop breakpoint. */\nexport const Toolbar = ToolbarComponent as typeof ToolbarComponent & { new (): { $props: ToolbarProps } }\n\nfunction part(name: string, className: string, role?: string) {\n return defineComponent({\n name,\n setup(_, { slots }) {\n return () => h(\"div\", { class: className, role }, slots.default?.())\n },\n })\n}\n\n/** Items at the leading edge (React `Toolbar.Leading`). */\nexport const ToolbarLeading = part(\"ToolbarLeading\", s.Leading)\n/** Items at the trailing edge (React `Toolbar.Trailing`). */\nexport const ToolbarTrailing = part(\"ToolbarTrailing\", s.Trailing)\n/** Buttons that share one capsule (React `Toolbar.Group`). */\nexport const ToolbarGroup = part(\"ToolbarGroup\", s.Group, \"group\")\nconst rowOfAnchor = new WeakMap<Element, HTMLElement>()\n\n/**\n * Under a large title each row is portaled into the rows' place as it mounts, so a row that comes later (a search field\n * shown over a segmented control already there) would stand last. An empty anchor in the bar keeps the row's place among\n * the bar's rows, and the rows are moved into that order in the content, so the keyboard and a screen reader meet them\n * as they stand (Codex #7); a row added or removed in the bar orders them again.\n * (React's twin)\n */\nfunction followRowOrder(anchor: HTMLElement, row: HTMLElement) {\n const bar = anchor.closest(\"[data-toolbar]\") ?? anchor.parentElement\n if (!bar) return () => {}\n rowOfAnchor.set(anchor, row)\n const place = () => {\n const slot = row.parentElement\n if (!slot) return\n const rows = Array.from(bar.querySelectorAll(\"[data-toolbar-row-anchor]\"), (mark) => rowOfAnchor.get(mark))\n .filter((each): each is HTMLElement => each?.parentElement === slot)\n // From the last row back, a row that does not stand before the next one goes right before it: only a row out of\n // place moves (the one that came later), so a field focused in another row keeps its focus (Codex #8); moveBefore,\n // where the browser has it, keeps it even in the row that moves.\n const move = (slot as HTMLElement & { moveBefore?: (node: Node, child: Node | null) => void }).moveBefore\n for (let index = rows.length - 2; index >= 0; index--) {\n const each = rows[index]\n const next = rows[index + 1]\n if (each.compareDocumentPosition(next) & Node.DOCUMENT_POSITION_FOLLOWING) continue\n try {\n if (move) {\n move.call(slot, each, next)\n continue\n }\n } catch {\n // falls back to a plain move\n }\n slot.insertBefore(each, next)\n }\n }\n place()\n const observer = typeof MutationObserver !== \"undefined\" ? new MutationObserver(place) : undefined\n observer?.observe(bar, { childList: true, subtree: true })\n return () => {\n observer?.disconnect()\n rowOfAnchor.delete(anchor)\n }\n}\n\n/**\n * A row under the controls, part of the bar: a segmented control that switches the screen's views (a chat list's\n * folders under its bar), or a search field. It spans the bar, and a control in it fills the row; several rows stand in\n * their order (a search field over a segmented control). Under a large title on a page the rows stand under the title,\n * at the top of the content, and once scrolled up to the bar they stay pinned under its controls, as iOS 27.2 pins a\n * safeAreaBar under a large title's bar (React `Toolbar.Row`).\n */\nexport const ToolbarRow = defineComponent({\n name: \"ToolbarRow\",\n inheritAttrs: false,\n setup(_, { slots, attrs }) {\n const host = inject(TOOLBAR_HOST, null)\n const titleStyle = inject(TOOLBAR_TITLE_STYLE, null)\n const large = computed(() => titleStyle?.value === \"large\" && host?.kind === \"page\")\n const slot = computed(() => (large.value ? host?.largeTitleRowSlot?.value ?? null : null))\n let release: (() => void) | undefined\n onMounted(() => { if (large.value) release = host?.requestLargeTitleSlot?.() })\n watch(large, (value) => {\n release?.()\n release = value ? host?.requestLargeTitleSlot?.() : undefined\n })\n onBeforeUnmount(() => release?.())\n const element = ref<HTMLElement | null>(null)\n const anchor = ref<HTMLElement | null>(null)\n let stopOrder: (() => void) | undefined\n watch([slot, element, anchor], ([place, row, mark]) => {\n stopOrder?.()\n stopOrder = place && row && mark ? followRowOrder(mark, row) : undefined\n }, { flush: \"post\" })\n onBeforeUnmount(() => { stopOrder?.(); stopOrder = undefined })\n return () => {\n const place = slot.value\n const row = h(\"div\", { ...attrs, \"ref\": element, \"class\": [s.Row, attrs.class], \"data-toolbar-row\": \"\", \"data-in-content\": place ? \"\" : undefined }, slots.default?.())\n // Under a large title the row waits for its place in the content, as React's does.\n if (large.value) return place ? [h(Teleport, { to: place }, [row]), h(\"span\", { \"ref\": anchor, \"data-toolbar-row-anchor\": \"\", \"hidden\": true })] : null\n return row\n }\n },\n})\n\n/** Custom middle content: a search field, a segmented control or a single centered action (React `Toolbar.Content`). */\nexport const ToolbarContent = defineComponent({\n name: \"ToolbarContent\",\n props: {\n /** Stretch between the leading and trailing items, as a search field does. */\n fill: { type: Boolean, default: false },\n },\n setup(props, { slots }) {\n return () => h(\"div\", { \"class\": s.Content, \"data-fill\": props.fill ? \"\" : undefined }, slots.default?.())\n },\n})\n\n/** The bar title, with an optional second line (React `Toolbar.Title`). */\nexport const ToolbarTitle = defineComponent({\n name: \"ToolbarTitle\",\n inheritAttrs: false,\n props: {\n /** A second, smaller line below the title. The `subtitle` slot takes precedence. */\n subtitle: { type: String, default: undefined },\n /**\n * Heading level. In a Dialog the dialog's own title names the Sheet, so the bar title is hidden\n * from assistive technology there.\n * @default \"h1\"\n */\n as: { type: String as PropType<\"h1\" | \"h2\" | \"h3\">, default: \"h1\" },\n },\n setup(props, { slots, attrs }) {\n const host = inject(TOOLBAR_HOST, null)\n const titleStyle = inject(TOOLBAR_TITLE_STYLE, null)\n const bar = inject(TOOLBAR_ELEMENT, null)\n const heading = ref<HTMLElement | null>(null)\n const large = computed(() => titleStyle?.value === \"large\" && host?.kind === \"page\")\n const slot = computed(() => (large.value ? host?.largeTitleSlot?.value ?? null : null))\n let release: (() => void) | undefined\n onMounted(() => { if (large.value) release = host?.requestLargeTitleSlot?.() })\n watch(large, (value) => {\n release?.()\n release = value ? host?.requestLargeTitleSlot?.() : undefined\n })\n // In the content the title scrolls with it, on the compositor and through the overscroll, as on iOS 26. Once it has\n // gone under the bar (its last line at the bar's bottom), the bar shows it inline and a hard or glass bar its line.\n // It starts once mounted too: a bar replaced under a page that keeps its content finds the place already there.\n let stopFollowing: (() => void) | undefined\n const follow = () => {\n stopFollowing?.()\n stopFollowing = undefined\n const element = bar?.value\n const title = heading.value\n if (!slot.value || !element || !title || !host?.subscribeScroll) return\n stopFollowing = followLargeTitle(element, title, host.subscribeScroll)\n }\n onMounted(follow)\n watch([slot, () => bar?.value], follow, { flush: \"post\" })\n onBeforeUnmount(() => { stopFollowing?.(); release?.() })\n return () => {\n // An empty subtitle, from the prop or a slot that renders nothing, leaves the title on one line, as in React.\n const present = (value: unknown) => (Array.isArray(value) ? value.length > 0 : value != null && value !== \"\")\n const subtitle = slots.subtitle?.() ?? props.subtitle\n const place = slot.value\n const title = h(\"div\", { \"ref\": heading, \"class\": s.Heading, \"aria-hidden\": host?.kind === \"dialog\" ? \"true\" : undefined, \"data-in-content\": place ? \"\" : undefined }, [\n h(props.as, { ...attrs, class: [s.Title, attrs.class] }, slots.default?.()),\n present(subtitle) ? h(\"p\", { class: s.Subtitle }, subtitle) : null,\n ])\n if (!large.value) return title\n // Until the content has made its place (a server-rendered page before it hydrates), the title stands in the bar\n // where it will stand in the content. The inline copy the row of controls shows once the large title has gone\n // under it keeps a subtitle as a second line, as in the inline title (iOS 26 kit Toolbar - Top - iPhone, Title 2 Line).\n const copySubtitle = slots.subtitle?.() ?? props.subtitle\n const copy = present(copySubtitle)\n ? [h(\"span\", { class: s.CollapsedLine }, slots.default?.()), h(\"span\", { class: s.CollapsedSubtitle }, copySubtitle)]\n : slots.default?.()\n return [h(Teleport, { to: place ?? \"body\", disabled: !place }, [title]), h(\"span\", { \"class\": s.CollapsedTitle, \"aria-hidden\": \"true\" }, copy)]\n }\n },\n})\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Toolbar, ToolbarContent, ToolbarGroup, ToolbarLeading, ToolbarTitle, ToolbarTrailing, TOOLBAR_HOST, } from "./Toolbar.js";
|
|
1
|
+
export { Toolbar, ToolbarContent, ToolbarGroup, ToolbarLeading, ToolbarRow, ToolbarTitle, ToolbarTrailing, TOOLBAR_HOST, } from "./Toolbar.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Toolbar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,cAAc,EACd,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,eAAe,EACf,YAAY,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Toolbar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,cAAc,EACd,YAAY,EACZ,cAAc,EACd,UAAU,EACV,YAAY,EACZ,eAAe,EACf,YAAY,GASb,MAAM,cAAc,CAAA","sourcesContent":["export {\n Toolbar,\n ToolbarContent,\n ToolbarGroup,\n ToolbarLeading,\n ToolbarRow,\n ToolbarTitle,\n ToolbarTrailing,\n TOOLBAR_HOST,\n type BarBackground,\n type BarBackgroundAlias,\n type ToolbarBackground,\n type ToolbarHost,\n type ToolbarPlacement,\n type ToolbarProps,\n type ToolbarTitleAlign,\n type ToolbarTitleStyle,\n} from \"./Toolbar.js\"\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CSSProperties, type HTMLAttributes, type PropType, type VNode } from "vue";
|
|
2
|
-
import { type BarBackground } from "../Toolbar/Toolbar.js";
|
|
2
|
+
import { type BarBackground, type BarBackgroundAlias } from "../Toolbar/Toolbar.js";
|
|
3
3
|
/** Modal dialog root. Uncontrolled by default; bind `v-model:open` to control it. */
|
|
4
4
|
export declare const Dialog: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
5
|
open: {
|
|
@@ -173,8 +173,8 @@ export declare const DialogContent: import("vue").DefineComponent<import("vue").
|
|
|
173
173
|
showClose: boolean;
|
|
174
174
|
surface: "plain" | "grouped";
|
|
175
175
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
176
|
-
/** How a Sheet's bar meets the content scrolled under it; see `BarBackground`. */
|
|
177
|
-
export type DialogBarBackground = BarBackground;
|
|
176
|
+
/** How a Sheet's bar meets the content scrolled under it; see `BarBackground`. `"solid"` is the earlier name of `"hard"`. */
|
|
177
|
+
export type DialogBarBackground = BarBackground | BarBackgroundAlias;
|
|
178
178
|
export declare const DialogHeader: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
179
179
|
/** How the bar meets the content scrolled under it in a phone Sheet. @default "glass" */
|
|
180
180
|
background: {
|
|
@@ -192,7 +192,7 @@ export declare const DialogHeader: import("vue").DefineComponent<import("vue").E
|
|
|
192
192
|
default: string;
|
|
193
193
|
};
|
|
194
194
|
}>> & Readonly<{}>, {
|
|
195
|
-
background:
|
|
195
|
+
background: DialogBarBackground;
|
|
196
196
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
197
197
|
export declare const DialogHeaderAction: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
198
198
|
/**
|
|
@@ -250,7 +250,7 @@ export declare const DialogFooter: import("vue").DefineComponent<import("vue").E
|
|
|
250
250
|
default: string;
|
|
251
251
|
};
|
|
252
252
|
}>> & Readonly<{}>, {
|
|
253
|
-
background:
|
|
253
|
+
background: DialogBarBackground;
|
|
254
254
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
255
255
|
export declare const DialogTitle: import("vue").DefineComponent<{}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
256
256
|
[key: string]: any;
|
|
@@ -362,6 +362,7 @@ export { default as MinimizeTop } from "./svg/MinimizeTop.js";
|
|
|
362
362
|
export { default as Minus } from "./svg/Minus.js";
|
|
363
363
|
export { default as MinusCircle } from "./svg/MinusCircle.js";
|
|
364
364
|
export { default as MinusCircleFilled } from "./svg/MinusCircleFilled.js";
|
|
365
|
+
export { default as MinusLg } from "./svg/MinusLg.js";
|
|
365
366
|
export { default as Mobile } from "./svg/Mobile.js";
|
|
366
367
|
export { default as Moon } from "./svg/Moon.js";
|
|
367
368
|
export { default as MoonSun } from "./svg/MoonSun.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type HTMLAttributes, type PropType } from "vue";
|
|
2
|
-
import { type BarBackground } from "../Toolbar/Toolbar.js";
|
|
3
|
-
/** How a phone bar of the page meets the content scrolled under it; see `BarBackground`. */
|
|
4
|
-
export type PageBarBackground = BarBackground;
|
|
2
|
+
import { type BarBackground, type BarBackgroundAlias } from "../Toolbar/Toolbar.js";
|
|
3
|
+
/** How a phone bar of the page meets the content scrolled under it; see `BarBackground`. `"solid"` is the earlier name of `"hard"`. */
|
|
4
|
+
export type PageBarBackground = BarBackground | BarBackgroundAlias;
|
|
5
5
|
export type PageWidth = "full" | "wide" | "column";
|
|
6
6
|
declare const PageComponent: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
7
7
|
/**
|
|
@@ -91,7 +91,7 @@ export declare const PageHeader: import("vue").DefineComponent<import("vue").Ext
|
|
|
91
91
|
default: string;
|
|
92
92
|
};
|
|
93
93
|
}>> & Readonly<{}>, {
|
|
94
|
-
background:
|
|
94
|
+
background: PageBarBackground;
|
|
95
95
|
divider: boolean;
|
|
96
96
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
97
97
|
/** The row of the title and the actions (React `Page.Bar`). */
|
|
@@ -160,7 +160,7 @@ export declare const PageFooter: import("vue").DefineComponent<import("vue").Ext
|
|
|
160
160
|
default: string;
|
|
161
161
|
};
|
|
162
162
|
}>> & Readonly<{}>, {
|
|
163
|
-
background:
|
|
163
|
+
background: PageBarBackground;
|
|
164
164
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
165
165
|
/** Props of the Page parts: native attributes of their element. */
|
|
166
166
|
export type PageSlotProps = HTMLAttributes;
|