@plexui/vue 0.24.3 → 0.25.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/Page/Page.js +77 -17
- package/dist/es/components/Page/Page.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/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/Page/Page.d.ts +5 -5
- package/dist/types/components/TabBar/TabBar.d.ts +11 -11
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Page.js","sourceRoot":"","sources":["../../../../src/components/Page/Page.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,CAAC,EACD,MAAM,EACN,UAAU,EACV,SAAS,EACT,eAAe,EACf,OAAO,EACP,GAAG,GAKJ,MAAM,KAAK,CAAA;AACZ,OAAO,EAAE,4BAA4B,EAAE,+BAA+B,EAAE,MAAM,0CAA0C,CAAA;AACxH,OAAO,EAAE,YAAY,EAA6C,MAAM,uBAAuB,CAAA;AAC/F,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,CAAC,MAAM,gDAAgD,CAAA;AAuB9D,MAAM,YAAY,GAA8B,MAAM,CAAC,MAAM,CAAC,CAAA;AAE9D,SAAS,iBAAiB,CAAC,IAAY;IACrC,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;IAC3C,IA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C,CAAC,CAAA;QACF,eAAe,CAAC,GAAG,EAAE,GAAG,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC,YAAY,CAAC,KAAK,GAAG,CAAC,CAAA,CAAC,CAAC,CAAC,CAAA;QACzE,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,iBAAiB,EAAE,KAAK,CAAC,UAAU,EAAE,oBAAoB,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,EAAE;YACzJ,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,aAAa,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;SACxD,CAAC,CAAA;IACJ,CAAC;CACF,CAAC,CAAA","sourcesContent":["import {\n defineComponent,\n h,\n inject,\n mergeProps,\n onMounted,\n onBeforeUnmount,\n provide,\n ref,\n type HTMLAttributes,\n type InjectionKey,\n type PropType,\n type Ref,\n} from \"vue\"\nimport { provideFloatingBoundaryScope, useFloatingBoundaryRegistration } from \"../../composables/useFloatingBoundary.js\"\nimport { TOOLBAR_HOST, type BarBackground, type ToolbarPlacement } from \"../Toolbar/Toolbar.js\"\nimport { observeScrollEdges } from \"../../lib/scrollEdges.js\"\nimport s from \"@plexui/styles/components/Page/Page.module.css\"\n\n// Vue port of packages/ui/src/components/Page/Page.tsx. Exports are flat\n// (`PageHeader` for `Page.Header`, ...). As in React, caller attributes are\n// applied after the page's own (`class` is merged), so they win.\n\n/** How a phone bar of the page meets the content scrolled under it; see `BarBackground`. */\nexport type PageBarBackground = BarBackground\n\nexport type PageWidth = \"full\" | \"wide\" | \"column\"\n\ntype PageContext = {\n /** Content has scrolled under the header. */\n scrolled: Ref<boolean>\n /** Content continues under the footer. */\n contentBelow: Ref<boolean>\n footerHeight: Ref<number>\n headerHeight: Ref<number | undefined>\n /** Writes the content's scroll offset to the page as `--page-scroll-y`, which a large Toolbar title follows. */\n setScrollY: (scrollY: number) => void\n /** Tells the bars that follow the scroll, such as a minimizing TabBar, the content's scroll offset. */\n notifyScroll: (scrollY: number) => void\n}\nconst PAGE_CONTEXT: InjectionKey<PageContext> = Symbol(\"Page\")\n\nfunction injectPageContext(part: string): PageContext {\n const scrolled = inject(PAGE_CONTEXT, null)\n if (!scrolled) {\n throw new Error(`${part} must be used within Page`)\n }\n return scrolled\n}\n\nconst PageComponent = defineComponent({\n name: \"Page\",\n props: {\n /**\n * Width of the column that header and content share: `\"full\"` (edge to\n * edge, for tables), `\"wide\"` (1280px, centred, for overviews) or `\"column\"`\n * (768px, centred, for settings and forms). Set `--page-width` on the page\n * for any other width.\n * @default \"full\"\n */\n width: { type: String as PropType<PageWidth>, default: \"full\" },\n /** Mobile canvas and grouped-field palette. @default \"plain\" */\n surface: { type: String as PropType<\"plain\" | \"grouped\">, default: \"plain\" },\n },\n setup(props, { slots }) {\n const boundary = provideFloatingBoundaryScope()\n let root: HTMLElement | null = null\n const setRoot = (node: unknown) => {\n root = node instanceof HTMLElement ? node : null\n boundary.setRoot(node)\n }\n // Written straight to the element: a scroll frame must not render the page again.\n const setScrollY = (scrollY: number) => root?.style.setProperty(\"--page-scroll-y\", String(Math.max(0, scrollY)))\n const scrollListeners = new Set<(scrollTop: number) => void>()\n const notifyScroll = (scrollY: number) => scrollListeners.forEach((listener) => listener(scrollY))\n const subscribeScroll = (listener: (scrollTop: number) => void) => {\n scrollListeners.add(listener)\n return () => { scrollListeners.delete(listener) }\n }\n const context = { scrolled: ref(false), contentBelow: ref(false), footerHeight: ref(0), headerHeight: ref<number>(), setScrollY, notifyScroll }\n provide(PAGE_CONTEXT, context)\n // A phone Toolbar replaces the header and footer bars; it reports its own heights.\n const toolbarTop = ref<number>()\n const toolbarBottom = ref<number>()\n provide(TOOLBAR_HOST, {\n kind: \"page\",\n scrolled: context.scrolled,\n contentBelow: context.contentBelow,\n subscribeScroll,\n setHeight: (placement: ToolbarPlacement, height: number | undefined) => { (placement === \"top\" ? toolbarTop : toolbarBottom).value = height },\n })\n return () => h(\"div\", { \"ref\": setRoot, \"class\": s.Page, \"data-width\": props.width, \"data-surface\": props.surface,\n style: {\n \"--page-footer-height\": `${context.footerHeight.value}px`,\n ...(context.headerHeight.value !== undefined ? { \"--page-header-height\": `${context.headerHeight.value}px` } : {}),\n ...(toolbarTop.value !== undefined ? { \"--page-toolbar-height\": `${toolbarTop.value}px` } : {}),\n ...(toolbarBottom.value !== undefined ? { \"--page-toolbar-bottom-height\": `${toolbarBottom.value}px` } : {}),\n } }, slots.default?.())\n },\n})\n\n/** Props of `Page`. */\nexport type PageProps = { width?: PageWidth; surface?: \"plain\" | \"grouped\" } & HTMLAttributes\n\nexport const Page = PageComponent as typeof PageComponent & { new (): { $props: PageProps } }\n\n/** The band above the content, one column with it (React `Page.Header`). */\nexport const PageHeader = defineComponent({\n name: \"PageHeader\",\n props: {\n /**\n * Shows a divider once the content has scrolled under the header: on a\n * desktop layout, and on a phone with a `\"hard\"` or `\"glass\"` background.\n * Turn it off when the content already draws a line of\n * its own at that place.\n * @default true\n */\n divider: { type: Boolean, default: true },\n /** How the bar meets the content scrolled under it on a phone. @default \"glass\" */\n background: { type: String as PropType<PageBarBackground>, default: \"glass\" },\n },\n setup(props, { slots }) {\n const { scrolled, headerHeight } = injectPageContext(\"PageHeader\")\n const element = ref<HTMLElement | null>(null)\n let observer: ResizeObserver | undefined\n onMounted(() => {\n const header = element.value\n if (!header) return\n const update = () => { headerHeight.value = header.offsetHeight }\n update()\n observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n observer?.observe(header, { box: \"border-box\" })\n })\n onBeforeUnmount(() => { observer?.disconnect(); headerHeight.value = undefined })\n\n return () =>\n h(\"div\", { \"ref\": element, \"class\": s.Header, \"data-background\": props.background, \"data-scrolled\": scrolled.value ? \"\" : undefined, \"data-divider\": props.divider ? \"\" : undefined }, [\n h(\"div\", { class: s.Head }, slots.default?.()),\n ])\n },\n})\n\nfunction part(name: string, tag: string, className: string) {\n return defineComponent({\n name,\n setup(_, { slots }) {\n return () => h(tag, { class: className }, slots.default?.())\n },\n })\n}\n\n/** The row of the title and the actions (React `Page.Bar`). */\nexport const PageBar = defineComponent({\n name: \"PageBar\",\n setup(_, { slots }) {\n const element = ref<HTMLElement | null>(null)\n let observer: ResizeObserver | undefined\n let children: MutationObserver | undefined\n onMounted(() => {\n const bar = element.value\n if (!bar) return\n const sides = () => bar.querySelectorAll<HTMLElement>(`:scope > .${s.Leading}, :scope > .${s.Actions}`)\n const update = () => {\n const width = Math.max(44, ...Array.from(sides(), (side) => side.offsetWidth))\n bar.style.setProperty(\"--page-bar-side-width\", `${width}px`)\n }\n observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n const observeSides = () => { observer?.disconnect(); sides().forEach((side) => observer?.observe(side, { box: \"border-box\" })); update() }\n observeSides()\n children = new MutationObserver(observeSides)\n children.observe(bar, { childList: true })\n })\n onBeforeUnmount(() => { observer?.disconnect(); children?.disconnect() })\n return () => h(\"div\", { ref: element, class: s.Bar }, slots.default?.())\n },\n})\n/** Navigation controls on the leading side (React `Page.Leading`). */\nexport const PageLeading = part(\"PageLeading\", \"div\", s.Leading)\n/** Title with what stands beside it, a subtitle under it on a phone (React `Page.Heading`). */\nexport const PageHeading = part(\"PageHeading\", \"div\", s.Heading)\n/** Page heading, an `<h1>` (React `Page.Title`). */\nexport const PageTitle = part(\"PageTitle\", \"h1\", s.Title)\n/** Status of the page, a flow container for badges and text (React `Page.Subtitle`). */\nexport const PageSubtitle = part(\"PageSubtitle\", \"div\", s.Subtitle)\n/** Buttons on the trailing side of the bar (React `Page.Actions`). */\nexport const PageActions = part(\"PageActions\", \"div\", s.Actions)\n\n/** The part of the page that scrolls (React `Page.Content`). */\nexport const PageContent = defineComponent({\n name: \"PageContent\",\n inheritAttrs: false,\n props: {\n /**\n * The content fills the page and scrolls inside itself, as a table does:\n * the page stops scrolling from 768px up.\n * @default false\n */\n fill: { type: Boolean, default: false },\n },\n setup(props, { attrs, slots }) {\n const { scrolled, contentBelow, setScrollY, notifyScroll } = injectPageContext(\"PageContent\")\n const element = ref<HTMLElement | null>(null)\n let stop: (() => void) | undefined\n onMounted(() => {\n if (!element.value) return\n stop = observeScrollEdges(element.value, (edges) => {\n scrolled.value = edges.scrolled\n contentBelow.value = edges.contentBelow\n })\n })\n onBeforeUnmount(() => { stop?.(); scrolled.value = false; contentBelow.value = false })\n\n const onScroll = (event: Event) => {\n const top = (event.currentTarget as HTMLElement).scrollTop\n setScrollY(top)\n notifyScroll(top)\n }\n\n return () =>\n h(\n \"div\",\n mergeProps(\n { \"ref\": element, \"class\": s.Content, \"data-fill\": props.fill ? \"\" : undefined, onScroll },\n attrs,\n ),\n [h(\"div\", { class: s.Column }, slots.default?.())],\n )\n },\n})\n\n/** Actions that remain below the scrolling content (React `Page.Footer`). */\nexport const PageFooter = defineComponent({\n name: \"PageFooter\",\n props: {\n /** How the bar meets the content scrolled under it on a phone. @default \"soft\" */\n background: { type: String as PropType<PageBarBackground>, default: \"soft\" },\n },\n setup(props, { slots }) {\n const element = ref<HTMLElement | null>(null)\n const { contentBelow, footerHeight } = injectPageContext(\"PageFooter\")\n const boundary = useFloatingBoundaryRegistration()\n const setFooter = (node: unknown) => {\n element.value = node instanceof HTMLElement ? node : null\n boundary?.setFooter(node)\n }\n let observer: ResizeObserver | undefined\n onMounted(() => {\n const footer = element.value\n if (!footer) return\n const update = () => { footerHeight.value = footer.offsetHeight }\n update()\n if (typeof ResizeObserver === \"undefined\") return\n observer = new ResizeObserver(update)\n observer.observe(footer, { box: \"border-box\" })\n })\n onBeforeUnmount(() => { observer?.disconnect(); footerHeight.value = 0 })\n return () => h(\"div\", { ref: setFooter, class: s.Footer, \"data-background\": props.background, \"data-content-below\": contentBelow.value ? \"\" : undefined }, [\n h(\"div\", { class: s.FooterContent }, slots.default?.()),\n ])\n },\n})\n\n/** Props of the Page parts: native attributes of their element. */\nexport type PageSlotProps = HTMLAttributes\n\nexport type PageFooterProps = PageSlotProps & { background?: PageBarBackground }\n"]}
|
|
1
|
+
{"version":3,"file":"Page.js","sourceRoot":"","sources":["../../../../src/components/Page/Page.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,CAAC,EACD,MAAM,EACN,UAAU,EACV,SAAS,EACT,eAAe,EACf,OAAO,EACP,GAAG,EACH,UAAU,EACV,KAAK,GAKN,MAAM,KAAK,CAAA;AACZ,OAAO,EAAE,4BAA4B,EAAE,+BAA+B,EAAE,MAAM,0CAA0C,CAAA;AACxH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAsE,MAAM,uBAAuB,CAAA;AACvI,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,CAAC,MAAM,gDAAgD,CAAA;AA+B9D;;;;;GAKG;AACH,SAAS,eAAe,CAAC,OAAoB,EAAE,IAAiB,EAAE,MAAiD;IACjH,IAAI,IAAI,GAAG,EAAE,CAAA;IACb,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAA;QAChC,MAAM,KAAK,GAAG,IAAI,CAAC,sBAAsB,CAAA;QACzC,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC,GAAG,GAAG,KAAK,CAAC,qBAAqB,EAAE,CAAC,MAAM,GAAG,GAAG,CAAA;QACrH,IAAI,GAAG,MAAM,IAAI,MAAM,EAAE,KAAK,IAAI;YAAE,OAAM;QAC1C,IAAI,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAA;QAC5B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxB,CAAC,CAAA;IACD,MAAM,EAAE,CAAA;IACR,OAAO,CAAC,gBAAgB,CA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,\n type HTMLAttributes,\n type InjectionKey,\n type PropType,\n type Ref,\n} from \"vue\"\nimport { provideFloatingBoundaryScope, useFloatingBoundaryRegistration } from \"../../composables/useFloatingBoundary.js\"\nimport { barBackground, TOOLBAR_HOST, type BarBackground, type BarBackgroundAlias, type ToolbarPlacement } from \"../Toolbar/Toolbar.js\"\nimport { observeScrollEdges } from \"../../lib/scrollEdges.js\"\nimport s from \"@plexui/styles/components/Page/Page.module.css\"\n\n// Vue port of packages/ui/src/components/Page/Page.tsx. Exports are flat\n// (`PageHeader` for `Page.Header`, ...). As in React, caller attributes are\n// applied after the page's own (`class` is merged), so they win.\n\n/** How a phone bar of the page meets the content scrolled under it; see `BarBackground`. `\"solid\"` is the earlier name of `\"hard\"`. */\nexport type PageBarBackground = BarBackground | BarBackgroundAlias\n\nexport type PageWidth = \"full\" | \"wide\" | \"column\"\n\ntype PageContext = {\n /** Content has scrolled under the header. */\n scrolled: Ref<boolean>\n /** Content continues under the footer. */\n contentBelow: Ref<boolean>\n footerHeight: Ref<number>\n headerHeight: Ref<number | undefined>\n /** Tells the bars that follow the scroll, such as a minimizing TabBar or a large title, the content's scroll offset. */\n notifyScroll: (scrollY: number) => void\n /** A large Toolbar title asks for a place at the top of the content, where it scrolls with the content. */\n largeTitle: Ref<boolean>\n setLargeTitleSlot: (slot: unknown) => void\n /** The place of the bar's rows under a large title, which pins them under the bar. */\n largeTitleRowSlot: Ref<HTMLElement | null>\n setLargeTitleRowSlot: (slot: unknown) => void\n /** The rows under a large title are pinned under the bar, and their height, which the bar's background takes in. */\n titleRowsPinned: Ref<boolean>\n titleRowsHeight: Ref<number>\n}\n\n/**\n * Follows the rows of a large title's bar (Toolbar.Row) in the content. They stand under the title and, scrolled up to\n * the bar, stay under its controls (`position: sticky`): they are pinned once the sticky offset moves them off the\n * title's bottom, where they would stand. It reports that and their height, which the bar's background takes in. React's\n * twin.\n */\nfunction followTitleRows(content: HTMLElement, rows: HTMLElement, report: (pinned: boolean, height: number) => void) {\n let last = \"\"\n const update = () => {\n const height = rows.offsetHeight\n const title = rows.previousElementSibling\n const pinned = height > 0 && !!title && rows.getBoundingClientRect().top - title.getBoundingClientRect().bottom > 0.5\n if (`${pinned} ${height}` === last) return\n last = `${pinned} ${height}`\n report(pinned, height)\n }\n update()\n content.addEventListener(\"scroll\", update, { passive: true })\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n observer?.observe(rows)\n observer?.observe(content)\n // The title changing its height (a subtitle shown or gone) moves the rows with no scroll (Codex #7).\n const title = rows.previousElementSibling\n if (title) observer?.observe(title)\n return () => {\n content.removeEventListener(\"scroll\", update)\n observer?.disconnect()\n report(false, 0)\n }\n}\nconst PAGE_CONTEXT: InjectionKey<PageContext> = Symbol(\"Page\")\n\nfunction injectPageContext(part: string): PageContext {\n const scrolled = inject(PAGE_CONTEXT, null)\n if (!scrolled) {\n throw new Error(`${part} must be used within Page`)\n }\n return scrolled\n}\n\nconst PageComponent = defineComponent({\n name: \"Page\",\n props: {\n /**\n * Width of the column that header and content share: `\"full\"` (edge to\n * edge, for tables), `\"wide\"` (1280px, centred, for overviews) or `\"column\"`\n * (768px, centred, for settings and forms). Set `--page-width` on the page\n * for any other width.\n * @default \"full\"\n */\n width: { type: String as PropType<PageWidth>, default: \"full\" },\n /** Mobile canvas and grouped-field palette. @default \"plain\" */\n surface: { type: String as PropType<\"plain\" | \"grouped\">, default: \"plain\" },\n },\n setup(props, { slots }) {\n const boundary = provideFloatingBoundaryScope()\n const setRoot = (node: unknown) => boundary.setRoot(node)\n const scrollListeners = new Set<(scrollTop: number) => void>()\n const notifyScroll = (scrollY: number) => scrollListeners.forEach((listener) => listener(scrollY))\n const subscribeScroll = (listener: (scrollTop: number) => void) => {\n scrollListeners.add(listener)\n return () => { scrollListeners.delete(listener) }\n }\n // A large Toolbar title lives in the content, where the browser scrolls it with the content and its overscroll;\n // PageContent keeps a place for it at its top while a title asks for one.\n const largeTitleRequests = ref(0)\n const largeTitle = computed(() => largeTitleRequests.value > 0)\n const largeTitleSlot = shallowRef<HTMLElement | null>(null)\n const setLargeTitleSlot = (slot: unknown) => { largeTitleSlot.value = slot instanceof HTMLElement ? slot : null }\n const requestLargeTitleSlot = () => {\n largeTitleRequests.value += 1\n return () => { largeTitleRequests.value -= 1 }\n }\n // The bar's rows under a large title have a place of their own under it, which pins them under the bar once scrolled.\n const largeTitleRowSlot = shallowRef<HTMLElement | null>(null)\n const setLargeTitleRowSlot = (slot: unknown) => { largeTitleRowSlot.value = slot instanceof HTMLElement ? slot : null }\n const titleRowsPinned = ref(false)\n const titleRowsHeight = ref(0)\n const context = {\n scrolled: ref(false), contentBelow: ref(false), footerHeight: ref(0), headerHeight: ref<number>(), notifyScroll, largeTitle,\n setLargeTitleSlot, largeTitleRowSlot, setLargeTitleRowSlot, titleRowsPinned, titleRowsHeight,\n }\n provide(PAGE_CONTEXT, context)\n // A phone Toolbar replaces the header and footer bars; it reports its own heights.\n const toolbarTop = ref<number>()\n const toolbarBottom = ref<number>()\n provide(TOOLBAR_HOST, {\n kind: \"page\",\n scrolled: context.scrolled,\n contentBelow: context.contentBelow,\n subscribeScroll,\n requestLargeTitleSlot,\n largeTitleSlot: computed(() => (largeTitle.value ? largeTitleSlot.value : null)),\n largeTitleRowSlot: computed(() => (largeTitle.value ? largeTitleRowSlot.value : null)),\n rowsPinned: computed(() => largeTitle.value && titleRowsPinned.value),\n setHeight: (placement: ToolbarPlacement, height: number | undefined) => { (placement === \"top\" ? toolbarTop : toolbarBottom).value = height },\n })\n return () => h(\"div\", { \"ref\": setRoot, \"class\": s.Page, \"data-width\": props.width, \"data-surface\": props.surface,\n style: {\n \"--page-footer-height\": `${context.footerHeight.value}px`,\n ...(context.headerHeight.value !== undefined ? { \"--page-header-height\": `${context.headerHeight.value}px` } : {}),\n ...(toolbarTop.value !== undefined ? { \"--page-toolbar-height\": `${toolbarTop.value}px` } : {}),\n ...(toolbarBottom.value !== undefined ? { \"--page-toolbar-bottom-height\": `${toolbarBottom.value}px` } : {}),\n ...(titleRowsHeight.value > 0 ? { \"--page-toolbar-rows-height\": `${titleRowsHeight.value}px` } : {}),\n } }, slots.default?.())\n },\n})\n\n/** Props of `Page`. */\nexport type PageProps = { width?: PageWidth; surface?: \"plain\" | \"grouped\" } & HTMLAttributes\n\nexport const Page = PageComponent as typeof PageComponent & { new (): { $props: PageProps } }\n\n/** The band above the content, one column with it (React `Page.Header`). */\nexport const PageHeader = defineComponent({\n name: \"PageHeader\",\n props: {\n /**\n * Shows a divider once the content has scrolled under the header: on a\n * desktop layout, and on a phone with a `\"hard\"` or `\"glass\"` background.\n * Turn it off when the content already draws a line of\n * its own at that place.\n * @default true\n */\n divider: { type: Boolean, default: true },\n /** How the bar meets the content scrolled under it on a phone. @default \"glass\" */\n background: { type: String as PropType<PageBarBackground>, default: \"glass\" },\n },\n setup(props, { slots }) {\n const { scrolled, headerHeight } = injectPageContext(\"PageHeader\")\n const element = ref<HTMLElement | null>(null)\n let observer: ResizeObserver | undefined\n onMounted(() => {\n const header = element.value\n if (!header) return\n const update = () => { headerHeight.value = header.offsetHeight }\n update()\n observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n observer?.observe(header, { box: \"border-box\" })\n })\n onBeforeUnmount(() => { observer?.disconnect(); headerHeight.value = undefined })\n\n return () =>\n h(\"div\", { \"ref\": element, \"class\": s.Header, \"data-background\": barBackground(props.background), \"data-scrolled\": scrolled.value ? \"\" : undefined, \"data-divider\": props.divider ? \"\" : undefined }, [\n h(\"div\", { class: s.Head }, slots.default?.()),\n ])\n },\n})\n\nfunction part(name: string, tag: string, className: string) {\n return defineComponent({\n name,\n setup(_, { slots }) {\n return () => h(tag, { class: className }, slots.default?.())\n },\n })\n}\n\n/** The row of the title and the actions (React `Page.Bar`). */\nexport const PageBar = defineComponent({\n name: \"PageBar\",\n setup(_, { slots }) {\n const element = ref<HTMLElement | null>(null)\n let observer: ResizeObserver | undefined\n let children: MutationObserver | undefined\n onMounted(() => {\n const bar = element.value\n if (!bar) return\n const sides = () => bar.querySelectorAll<HTMLElement>(`:scope > .${s.Leading}, :scope > .${s.Actions}`)\n const update = () => {\n const width = Math.max(44, ...Array.from(sides(), (side) => side.offsetWidth))\n bar.style.setProperty(\"--page-bar-side-width\", `${width}px`)\n }\n observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n const observeSides = () => { observer?.disconnect(); sides().forEach((side) => observer?.observe(side, { box: \"border-box\" })); update() }\n observeSides()\n children = new MutationObserver(observeSides)\n children.observe(bar, { childList: true })\n })\n onBeforeUnmount(() => { observer?.disconnect(); children?.disconnect() })\n return () => h(\"div\", { ref: element, class: s.Bar }, slots.default?.())\n },\n})\n/** Navigation controls on the leading side (React `Page.Leading`). */\nexport const PageLeading = part(\"PageLeading\", \"div\", s.Leading)\n/** Title with what stands beside it, a subtitle under it on a phone (React `Page.Heading`). */\nexport const PageHeading = part(\"PageHeading\", \"div\", s.Heading)\n/** Page heading, an `<h1>` (React `Page.Title`). */\nexport const PageTitle = part(\"PageTitle\", \"h1\", s.Title)\n/** Status of the page, a flow container for badges and text (React `Page.Subtitle`). */\nexport const PageSubtitle = part(\"PageSubtitle\", \"div\", s.Subtitle)\n/** Buttons on the trailing side of the bar (React `Page.Actions`). */\nexport const PageActions = part(\"PageActions\", \"div\", s.Actions)\n\n/** The part of the page that scrolls (React `Page.Content`). */\nexport const PageContent = defineComponent({\n name: \"PageContent\",\n inheritAttrs: false,\n props: {\n /**\n * The content fills the page and scrolls inside itself, as a table does:\n * the page stops scrolling from 768px up.\n * @default false\n */\n fill: { type: Boolean, default: false },\n },\n setup(props, { attrs, slots }) {\n const { scrolled, contentBelow, notifyScroll, largeTitle, setLargeTitleSlot, largeTitleRowSlot, setLargeTitleRowSlot, titleRowsPinned, titleRowsHeight } = injectPageContext(\"PageContent\")\n const element = ref<HTMLElement | null>(null)\n let stop: (() => void) | undefined\n onMounted(() => {\n if (!element.value) return\n stop = observeScrollEdges(element.value, (edges) => {\n scrolled.value = edges.scrolled\n contentBelow.value = edges.contentBelow\n })\n })\n onBeforeUnmount(() => { stop?.(); scrolled.value = false; contentBelow.value = false })\n // The rows of a large title's bar pin under it once scrolled up to it.\n let stopRows: (() => void) | undefined\n watch([element, largeTitleRowSlot], ([content, rows]) => {\n stopRows?.()\n stopRows = content && rows\n ? followTitleRows(content, rows, (pinned, height) => { titleRowsPinned.value = pinned; titleRowsHeight.value = height })\n : undefined\n }, { flush: \"post\" })\n onBeforeUnmount(() => { stopRows?.(); stopRows = undefined })\n\n const onScroll = (event: Event) => {\n notifyScroll((event.currentTarget as HTMLElement).scrollTop)\n }\n\n return () =>\n h(\n \"div\",\n mergeProps(\n { \"ref\": element, \"class\": s.Content, \"data-fill\": props.fill ? \"\" : undefined, onScroll },\n attrs,\n ),\n [h(\"div\", { class: s.Column }, [\n largeTitle.value ? h(\"div\", { ref: setLargeTitleSlot, class: s.LargeTitle }) : null,\n largeTitle.value ? h(\"div\", { ref: setLargeTitleRowSlot, class: s.LargeTitleRows }) : null,\n slots.default?.(),\n ])],\n )\n },\n})\n\n/** Actions that remain below the scrolling content (React `Page.Footer`). */\nexport const PageFooter = defineComponent({\n name: \"PageFooter\",\n props: {\n /** How the bar meets the content scrolled under it on a phone. @default \"soft\" */\n background: { type: String as PropType<PageBarBackground>, default: \"soft\" },\n },\n setup(props, { slots }) {\n const element = ref<HTMLElement | null>(null)\n const { contentBelow, footerHeight } = injectPageContext(\"PageFooter\")\n const boundary = useFloatingBoundaryRegistration()\n const setFooter = (node: unknown) => {\n element.value = node instanceof HTMLElement ? node : null\n boundary?.setFooter(node)\n }\n let observer: ResizeObserver | undefined\n onMounted(() => {\n const footer = element.value\n if (!footer) return\n const update = () => { footerHeight.value = footer.offsetHeight }\n update()\n if (typeof ResizeObserver === \"undefined\") return\n observer = new ResizeObserver(update)\n observer.observe(footer, { box: \"border-box\" })\n })\n onBeforeUnmount(() => { observer?.disconnect(); footerHeight.value = 0 })\n return () => h(\"div\", { ref: setFooter, class: s.Footer, \"data-background\": barBackground(props.background), \"data-content-below\": contentBelow.value ? \"\" : undefined }, [\n h(\"div\", { class: s.FooterContent }, slots.default?.()),\n ])\n },\n})\n\n/** Props of the Page parts: native attributes of their element. */\nexport type PageSlotProps = HTMLAttributes\n\nexport type PageFooterProps = PageSlotProps & { background?: PageBarBackground }\n"]}
|
|
@@ -2,7 +2,7 @@ import { computed, defineComponent, h, inject, onBeforeUnmount, onMounted, provi
|
|
|
2
2
|
import s from "@plexui/styles/components/TabBar/TabBar.module.css";
|
|
3
3
|
import { Search as SearchIcon } from "../Icon/index.js";
|
|
4
4
|
import { hasContent } from "../../lib/slotContent.js";
|
|
5
|
-
import { TOOLBAR_HOST } from "../Toolbar/Toolbar.js";
|
|
5
|
+
import { barBackground, TOOLBAR_HOST } from "../Toolbar/Toolbar.js";
|
|
6
6
|
// Vue port of packages/ui/src/components/TabBar/TabBar.tsx. Exports are flat (`TabBarItem` for `TabBar.Item`);
|
|
7
7
|
// the symbol of an item is its `icon` slot, and React's `accessory` is the bar's `accessory` slot. React's
|
|
8
8
|
// `value` + `onValueChange` become `value` + `update:value` (`v-model:value`), `minimized` + `onMinimizedChange`
|
|
@@ -104,7 +104,7 @@ const TabBarComponent = defineComponent({
|
|
|
104
104
|
minimized: { type: Boolean, default: undefined },
|
|
105
105
|
/** The minimized state when it is initially rendered. @default false */
|
|
106
106
|
defaultMinimized: { type: Boolean, default: false },
|
|
107
|
-
/** How the bar meets the content scrolled under it; see `BarBackground
|
|
107
|
+
/** How the bar meets the content scrolled under it; see `BarBackground` (`"solid"` is the earlier name of `"hard"`). @default "soft" */
|
|
108
108
|
background: { type: String, default: "soft" },
|
|
109
109
|
/** Accessible name of the navigation. @default "Tabs" */
|
|
110
110
|
ariaLabel: { type: String, default: "Tabs" },
|
|
@@ -216,7 +216,7 @@ const TabBarComponent = defineComponent({
|
|
|
216
216
|
"aria-label": props.ariaLabel,
|
|
217
217
|
"class": [s.TabBar, attrs.class],
|
|
218
218
|
"data-host": host?.kind,
|
|
219
|
-
"data-background": props.background,
|
|
219
|
+
"data-background": barBackground(props.background),
|
|
220
220
|
"data-content-below": host?.contentBelow?.value ? "" : undefined,
|
|
221
221
|
"data-minimized": minimized.value ? "" : undefined,
|
|
222
222
|
"data-search": props.search && !props.prominent ? "" : undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabBar.js","sourceRoot":"","sources":["../../../../src/components/TabBar/TabBar.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,CAAC,EACD,MAAM,EACN,eAAe,EACf,SAAS,EACT,OAAO,EACP,GAAG,EACH,KAAK,GAIN,MAAM,KAAK,CAAA;AACZ,OAAO,CAAC,MAAM,oDAAoD,CAAA;AAClE,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,YAAY,EAAsB,MAAM,uBAAuB,CAAA;AAExE,+GAA+G;AAC/G,2GAA2G;AAC3G,iHAAiH;AACjH,2CAA2C;AAE3C,2FAA2F;AAC3F,MAAM,cAAc,GAAG,CAAC,CAAA;AASxB,MAAM,OAAO,GAAgC,MAAM,CAAC,QAAQ,CAAC,CAAA;AAiB7D,yGAAyG;AACzG,MAAM,QAAQ,GAAG,CAAC,KAAyC,EAAE,EAAE,CAAC,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,CAAC,CAAA;AAE5G,MAAM,mBAAmB,GAAG,eAAe,CAAC;IAC1C,IAAI,EAAE,YAAY;IAClB,YAAY,EAAE,KAAK;IACnB,KAAK,EAAE;QACL,4BAA4B;QAC5B,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;QACvC,sEAAsE;QACtE,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAA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CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;gBAClD,aAAa,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;gBAChE,gBAAgB,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;gBAClD,gBAAgB,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;aACpD,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAA;QAC3F,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAKF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,eAAe,CAAA","sourcesContent":["import {\n computed,\n defineComponent,\n h,\n inject,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n watch,\n type ComputedRef,\n type InjectionKey,\n type PropType,\n} from \"vue\"\nimport s from \"@plexui/styles/components/TabBar/TabBar.module.css\"\nimport { Search as SearchIcon } from \"../Icon/index.js\"\nimport { hasContent } from \"../../lib/slotContent.js\"\nimport { TOOLBAR_HOST, type BarBackground } from \"../Toolbar/Toolbar.js\"\n\n// Vue port of packages/ui/src/components/TabBar/TabBar.tsx. Exports are flat (`TabBarItem` for `TabBar.Item`);\n// the symbol of an item is its `icon` slot, and React's `accessory` is the bar's `accessory` slot. React's\n// `value` + `onValueChange` become `value` + `update:value` (`v-model:value`), `minimized` + `onMinimizedChange`\n// become `minimized` + `update:minimized`.\n\n/** A scroll of at least this many pixels in one direction minimizes or expands the bar. */\nconst MINIMIZE_AFTER = 8\n\ntype TabBarContext = {\n value: ComputedRef<string | undefined>\n minimized: ComputedRef<boolean>\n select: (value: string) => void\n expand: () => void\n}\n\nconst TAB_BAR: InjectionKey<TabBarContext> = Symbol(\"TabBar\")\n\nexport type TabBarSearch = {\n /** The value of the search tab. */\n value: string\n /** Accessible name of the search tab. @default \"Search\" */\n label?: string\n}\n\n/** The prominent tab of a `TabBar`; its symbol is the `prominent-icon` slot of the bar (React `prominent.icon`). */\nexport type TabBarProminent = {\n /** The value of the prominent tab. */\n value: string\n /** Accessible name of the prominent tab: its circle shows the symbol only. */\n label: string\n}\n\n/** A badge shows unless it is empty: no value, an empty text or a count of 0 (iOS hides `.badge(0)`). */\nconst hasBadge = (badge: string | number | null | undefined) => badge != null && badge !== \"\" && badge !== 0\n\nconst TabBarItemComponent = defineComponent({\n name: \"TabBarItem\",\n inheritAttrs: false,\n props: {\n /** The value of the tab. */\n value: { type: String, required: true },\n /** The label under the symbol, and the accessible name of the tab. */\n label: { type: String, required: true },\n /** Makes the tab a link to this URL. */\n href: String,\n /**\n * A count or a short word in a red capsule over the symbol, as an iOS tab badge; it is read after the label.\n * A count of 0 shows none, as on iOS.\n */\n badge: { type: [String, Number], default: undefined },\n /** When `true`, the tab cannot be selected. */\n disabled: { type: Boolean, default: false },\n /** @internal The search and the prominent tab show their symbol only. */\n hideLabel: { type: Boolean, default: false },\n },\n emits: {\n /** The tab was pressed, before it is selected */\n click: (event: MouseEvent) => event instanceof MouseEvent,\n },\n setup(props, { attrs, emit, slots }) {\n const context = inject(TAB_BAR, null)\n if (!context) throw new Error(\"TabBarItem must be used within TabBar\")\n const selected = computed(() => context.value.value === props.value)\n // A minimized bar shows the selected tab only; pressing it brings the other tabs back.\n const collapsed = computed(() => context.minimized.value && selected.value && !props.hideLabel)\n const handleClick = (event: MouseEvent) => {\n emit(\"click\", event)\n if (event.defaultPrevented || props.disabled) return\n if (collapsed.value) {\n event.preventDefault()\n return context.expand()\n }\n context.select(props.value)\n }\n return () => {\n const content = [\n h(\"span\", { \"class\": s.Icon, \"aria-hidden\": \"true\" }, slots.icon?.()),\n props.hideLabel ? null : h(\"span\", { class: s.Label }, props.label),\n // The space keeps the accessible name \"Inbox 3\", not \"Inbox3\".\n ...(hasBadge(props.badge) ? [\" \", h(\"span\", { class: s.Badge }, props.badge)] : []),\n ]\n const shared = {\n \"class\": [s.Item, attrs.class],\n \"aria-current\": selected.value ? \"page\" : undefined,\n \"aria-label\": props.hideLabel ? props.label : undefined,\n \"aria-expanded\": collapsed.value ? false : undefined,\n \"data-selected\": selected.value ? \"\" : undefined,\n \"data-disabled\": props.disabled ? \"\" : undefined,\n \"data-value\": props.value,\n \"onClick\": handleClick,\n }\n if (props.href !== undefined && !props.disabled) return h(\"a\", { href: props.href, ...shared }, content)\n return h(\"button\", { type: \"button\", disabled: props.disabled, ...shared }, content)\n }\n },\n})\n\n/** Props of `TabBarItem`. */\nexport type TabBarItemProps = InstanceType<typeof TabBarItemComponent>[\"$props\"]\n\n/** One tab of a `TabBar` (React `TabBar.Item`): its `icon` slot holds the symbol, a PlexUI icon. */\nexport const TabBarItem = TabBarItemComponent\n\nconst TabBarComponent = defineComponent({\n name: \"TabBar\",\n inheritAttrs: false,\n props: {\n /** The controlled value of the selected tab. Bind with `v-model:value`. */\n value: { type: String, default: undefined },\n /** The selected tab when it is initially rendered. */\n defaultValue: { type: String, default: undefined },\n /** A search tab in a glass circle of its own at the trailing end, as the iOS 26 separate search tab. */\n search: { type: Object as PropType<TabBarSearch>, default: undefined },\n /**\n * The one destination the app lifts out of the capsule, a cart or a library, in a glass circle of its own at\n * the trailing end, as the iOS 27 prominent tab role; its symbol is the `prominent-icon` slot. It takes the\n * circle of the search tab: with both, search is the last tab of the capsule, as iOS gives search that place\n * only when no other tab is prominent.\n */\n prominent: { type: Object as PropType<TabBarProminent>, default: undefined },\n /**\n * `onScrollDown` minimizes the bar to the selected tab while the content of the `Page` scrolls down and\n * expands it when the content scrolls back up; a tap on the minimized tab expands it too. @default \"never\"\n */\n minimizeBehavior: { type: String as PropType<\"never\" | \"onScrollDown\">, default: \"never\" },\n /** Controlled minimized state. Bind with `v-model:minimized`. */\n minimized: { type: Boolean, default: undefined },\n /** The minimized state when it is initially rendered. @default false */\n defaultMinimized: { type: Boolean, default: false },\n /** How the bar meets the content scrolled under it; see `BarBackground`. @default \"soft\" */\n background: { type: String as PropType<BarBackground>, default: \"soft\" },\n /** Accessible name of the navigation. @default \"Tabs\" */\n ariaLabel: { type: String, default: \"Tabs\" },\n },\n emits: {\n /** A tab was selected */\n \"update:value\": (value: string) => typeof value === \"string\",\n /** A tab was selected (React `onValueChange`) */\n \"valueChange\": (value: string) => typeof value === \"string\",\n /** The bar minimized or expanded */\n \"update:minimized\": (minimized: boolean) => typeof minimized === \"boolean\",\n },\n setup(props, { attrs, emit, slots }) {\n const host = inject(TOOLBAR_HOST, null)\n const internalValue = ref(props.defaultValue)\n const value = computed(() => props.value ?? internalValue.value)\n const internalMinimized = ref(props.defaultMinimized)\n const minimized = computed(() => props.minimized ?? internalMinimized.value)\n\n const select = (next: string) => {\n if (props.value === undefined) internalValue.value = next\n emit(\"update:value\", next)\n emit(\"valueChange\", next)\n }\n const setMinimized = (next: boolean) => {\n if (next === minimized.value) return\n if (props.minimized === undefined) internalMinimized.value = next\n emit(\"update:minimized\", next)\n }\n provide(TAB_BAR, { value, minimized, select, expand: () => setMinimized(false) })\n\n // The bar follows the Page content: down by MINIMIZE_AFTER minimizes it, up by as much (or the top) expands it.\n let unsubscribe: (() => void) | undefined\n const follow = () => {\n unsubscribe?.()\n unsubscribe = undefined\n if (props.minimizeBehavior !== \"onScrollDown\" || !host?.subscribeScroll) return\n let anchor = 0\n unsubscribe = host.subscribeScroll((scrollTop) => {\n if (scrollTop <= 0) {\n anchor = 0\n return setMinimized(false)\n }\n const delta = scrollTop - anchor\n if (minimized.value ? delta < 0 : delta > 0) {\n if (Math.abs(delta) >= MINIMIZE_AFTER) {\n anchor = scrollTop\n setMinimized(!minimized.value)\n }\n return\n }\n anchor = scrollTop\n })\n }\n watch(() => props.minimizeBehavior, follow, { immediate: true })\n\n // Like a bottom Toolbar, the bar reserves its height on the Page; a desktop layout hides it.\n const element = ref<HTMLElement | null>(null)\n let observer: ResizeObserver | undefined\n onMounted(() => {\n const bar = element.value\n const setHeight = host?.setHeight\n if (!bar || !setHeight) return\n const update = () => setHeight(\"bottom\", bar.offsetHeight || undefined)\n update()\n observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n observer?.observe(bar, { box: \"border-box\" })\n })\n onBeforeUnmount(() => {\n unsubscribe?.()\n observer?.disconnect()\n host?.setHeight?.(\"bottom\", undefined)\n })\n\n // Minimizing or expanding moves the accessory past the tabs. A keyed diff moves the DOM node, and a moved node\n // that holds the focus sends it to the body (React restores it after its commit); the bar puts it back.\n let focused: HTMLElement | null = null\n watch(minimized, () => {\n const active = document.activeElement\n focused = active instanceof HTMLElement && element.value?.contains(active) ? active : null\n }, { flush: \"pre\" })\n watch(minimized, () => {\n const target = focused\n focused = null\n if (target?.isConnected && document.activeElement !== target) target.focus({ preventScroll: true })\n }, { flush: \"post\" })\n\n return () => {\n // An accessory slot that renders nothing (a `v-if` inside it) leaves no empty capsule, as React's `false`.\n const accessory = slots.accessory?.()\n const accessoryCapsule = hasContent(accessory) ? h(\"div\", { key: \"accessory\", class: s.Accessory }, accessory) : null\n const tabs = h(\"div\", { key: \"tabs\", class: s.Tabs }, [\n slots.default?.(),\n props.search && props.prominent\n ? h(TabBarItem, { value: props.search.value, label: props.search.label ?? \"Search\" }, { icon: () => h(SearchIcon) })\n : null,\n ])\n const circle = props.prominent\n ? h(TabBarItem, { key: \"prominent\", class: s.Prominent, value: props.prominent.value, label: props.prominent.label, hideLabel: true }, { icon: () => slots[\"prominent-icon\"]?.() })\n : props.search\n ? h(TabBarItem, { key: \"search\", class: s.Search, value: props.search.value, label: props.search.label ?? \"Search\", hideLabel: true }, { icon: () => h(SearchIcon) })\n : null\n // The accessory is read where it stands: above the tabs, and minimized between the two circles. The keys move\n // it there without remounting its content.\n return h(\"nav\", {\n ...attrs,\n \"ref\": element,\n \"aria-label\": props.ariaLabel,\n \"class\": [s.TabBar, attrs.class],\n \"data-host\": host?.kind,\n \"data-background\": props.background,\n \"data-content-below\": host?.contentBelow?.value ? \"\" : undefined,\n \"data-minimized\": minimized.value ? \"\" : undefined,\n \"data-search\": props.search && !props.prominent ? \"\" : undefined,\n \"data-prominent\": props.prominent ? \"\" : undefined,\n \"data-accessory\": accessoryCapsule ? \"\" : undefined,\n }, minimized.value ? [tabs, accessoryCapsule, circle] : [accessoryCapsule, tabs, circle])\n }\n },\n})\n\n/** Props of `TabBar`. */\nexport type TabBarProps = InstanceType<typeof TabBarComponent>[\"$props\"]\n\n/**\n * The tab bar of a phone screen after the iOS 26 kit Tab Bar - iPhone (507:24689): two to five tabs, each a\n * symbol over a label, in a floating glass capsule at the bottom, the selected tab on a pill, and an optional\n * search or prominent tab in a circle of its own. It minimizes to the selected tab while the content scrolls\n * down. A desktop layout navigates with a Sidebar or Tabs, so the bar never renders from 768px up.\n */\nexport const TabBar = TabBarComponent\n"]}
|
|
1
|
+
{"version":3,"file":"TabBar.js","sourceRoot":"","sources":["../../../../src/components/TabBar/TabBar.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,CAAC,EACD,MAAM,EACN,eAAe,EACf,SAAS,EACT,OAAO,EACP,GAAG,EACH,KAAK,GAIN,MAAM,KAAK,CAAA;AACZ,OAAO,CAAC,MAAM,oDAAoD,CAAA;AAClE,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,YAAY,EAA+C,MAAM,uBAAuB,CAAA;AAEhH,+GAA+G;AAC/G,2GAA2G;AAC3G,iHAAiH;AACjH,2CAA2C;AAE3C,2FAA2F;AAC3F,MAAM,cAAc,GAAG,CAAC,CAAA;AASxB,MAAM,OAAO,GAAgC,MAAM,CAAC,QAAQ,CAAC,CAAA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;YAC3C,OAAO,CAAC,CAAC,KAAK,EAAE;gBACd,GAAG,KAAK;gBACR,KAAK,EAAE,OAAO;gBACd,YAAY,EAAE,KAAK,CAAC,SAAS;gBAC7B,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC;gBAChC,WAAW,EAAE,IAAI,EAAE,IAAI;gBACvB,iBAAiB,EAAE,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC;gBAClD,oBAAoB,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;gBAChE,gBAAgB,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;gBAClD,aAAa,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;gBAChE,gBAAgB,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;gBAClD,gBAAgB,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;aACpD,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAA;QAC3F,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAKF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,eAAe,CAAA","sourcesContent":["import {\n computed,\n defineComponent,\n h,\n inject,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n watch,\n type ComputedRef,\n type InjectionKey,\n type PropType,\n} from \"vue\"\nimport s from \"@plexui/styles/components/TabBar/TabBar.module.css\"\nimport { Search as SearchIcon } from \"../Icon/index.js\"\nimport { hasContent } from \"../../lib/slotContent.js\"\nimport { barBackground, TOOLBAR_HOST, type BarBackground, type BarBackgroundAlias } from \"../Toolbar/Toolbar.js\"\n\n// Vue port of packages/ui/src/components/TabBar/TabBar.tsx. Exports are flat (`TabBarItem` for `TabBar.Item`);\n// the symbol of an item is its `icon` slot, and React's `accessory` is the bar's `accessory` slot. React's\n// `value` + `onValueChange` become `value` + `update:value` (`v-model:value`), `minimized` + `onMinimizedChange`\n// become `minimized` + `update:minimized`.\n\n/** A scroll of at least this many pixels in one direction minimizes or expands the bar. */\nconst MINIMIZE_AFTER = 8\n\ntype TabBarContext = {\n value: ComputedRef<string | undefined>\n minimized: ComputedRef<boolean>\n select: (value: string) => void\n expand: () => void\n}\n\nconst TAB_BAR: InjectionKey<TabBarContext> = Symbol(\"TabBar\")\n\nexport type TabBarSearch = {\n /** The value of the search tab. */\n value: string\n /** Accessible name of the search tab. @default \"Search\" */\n label?: string\n}\n\n/** The prominent tab of a `TabBar`; its symbol is the `prominent-icon` slot of the bar (React `prominent.icon`). */\nexport type TabBarProminent = {\n /** The value of the prominent tab. */\n value: string\n /** Accessible name of the prominent tab: its circle shows the symbol only. */\n label: string\n}\n\n/** A badge shows unless it is empty: no value, an empty text or a count of 0 (iOS hides `.badge(0)`). */\nconst hasBadge = (badge: string | number | null | undefined) => badge != null && badge !== \"\" && badge !== 0\n\nconst TabBarItemComponent = defineComponent({\n name: \"TabBarItem\",\n inheritAttrs: false,\n props: {\n /** The value of the tab. */\n value: { type: String, required: true },\n /** The label under the symbol, and the accessible name of the tab. */\n label: { type: String, required: true },\n /** Makes the tab a link to this URL. */\n href: String,\n /**\n * A count or a short word in a red capsule over the symbol, as an iOS tab badge; it is read after the label.\n * A count of 0 shows none, as on iOS.\n */\n badge: { type: [String, Number], default: undefined },\n /** When `true`, the tab cannot be selected. */\n disabled: { type: Boolean, default: false },\n /** @internal The search and the prominent tab show their symbol only. */\n hideLabel: { type: Boolean, default: false },\n },\n emits: {\n /** The tab was pressed, before it is selected */\n click: (event: MouseEvent) => event instanceof MouseEvent,\n },\n setup(props, { attrs, emit, slots }) {\n const context = inject(TAB_BAR, null)\n if (!context) throw new Error(\"TabBarItem must be used within TabBar\")\n const selected = computed(() => context.value.value === props.value)\n // A minimized bar shows the selected tab only; pressing it brings the other tabs back.\n const collapsed = computed(() => context.minimized.value && selected.value && !props.hideLabel)\n const handleClick = (event: MouseEvent) => {\n emit(\"click\", event)\n if (event.defaultPrevented || props.disabled) return\n if (collapsed.value) {\n event.preventDefault()\n return context.expand()\n }\n context.select(props.value)\n }\n return () => {\n const content = [\n h(\"span\", { \"class\": s.Icon, \"aria-hidden\": \"true\" }, slots.icon?.()),\n props.hideLabel ? null : h(\"span\", { class: s.Label }, props.label),\n // The space keeps the accessible name \"Inbox 3\", not \"Inbox3\".\n ...(hasBadge(props.badge) ? [\" \", h(\"span\", { class: s.Badge }, props.badge)] : []),\n ]\n const shared = {\n \"class\": [s.Item, attrs.class],\n \"aria-current\": selected.value ? \"page\" : undefined,\n \"aria-label\": props.hideLabel ? props.label : undefined,\n \"aria-expanded\": collapsed.value ? false : undefined,\n \"data-selected\": selected.value ? \"\" : undefined,\n \"data-disabled\": props.disabled ? \"\" : undefined,\n \"data-value\": props.value,\n \"onClick\": handleClick,\n }\n if (props.href !== undefined && !props.disabled) return h(\"a\", { href: props.href, ...shared }, content)\n return h(\"button\", { type: \"button\", disabled: props.disabled, ...shared }, content)\n }\n },\n})\n\n/** Props of `TabBarItem`. */\nexport type TabBarItemProps = InstanceType<typeof TabBarItemComponent>[\"$props\"]\n\n/** One tab of a `TabBar` (React `TabBar.Item`): its `icon` slot holds the symbol, a PlexUI icon. */\nexport const TabBarItem = TabBarItemComponent\n\nconst TabBarComponent = defineComponent({\n name: \"TabBar\",\n inheritAttrs: false,\n props: {\n /** The controlled value of the selected tab. Bind with `v-model:value`. */\n value: { type: String, default: undefined },\n /** The selected tab when it is initially rendered. */\n defaultValue: { type: String, default: undefined },\n /** A search tab in a glass circle of its own at the trailing end, as the iOS 26 separate search tab. */\n search: { type: Object as PropType<TabBarSearch>, default: undefined },\n /**\n * The one destination the app lifts out of the capsule, a cart or a library, in a glass circle of its own at\n * the trailing end, as the iOS 27 prominent tab role; its symbol is the `prominent-icon` slot. It takes the\n * circle of the search tab: with both, search is the last tab of the capsule, as iOS gives search that place\n * only when no other tab is prominent.\n */\n prominent: { type: Object as PropType<TabBarProminent>, default: undefined },\n /**\n * `onScrollDown` minimizes the bar to the selected tab while the content of the `Page` scrolls down and\n * expands it when the content scrolls back up; a tap on the minimized tab expands it too. @default \"never\"\n */\n minimizeBehavior: { type: String as PropType<\"never\" | \"onScrollDown\">, default: \"never\" },\n /** Controlled minimized state. Bind with `v-model:minimized`. */\n minimized: { type: Boolean, default: undefined },\n /** The minimized state when it is initially rendered. @default false */\n defaultMinimized: { type: Boolean, default: false },\n /** How the bar meets the content scrolled under it; see `BarBackground` (`\"solid\"` is the earlier name of `\"hard\"`). @default \"soft\" */\n background: { type: String as PropType<BarBackground | BarBackgroundAlias>, default: \"soft\" },\n /** Accessible name of the navigation. @default \"Tabs\" */\n ariaLabel: { type: String, default: \"Tabs\" },\n },\n emits: {\n /** A tab was selected */\n \"update:value\": (value: string) => typeof value === \"string\",\n /** A tab was selected (React `onValueChange`) */\n \"valueChange\": (value: string) => typeof value === \"string\",\n /** The bar minimized or expanded */\n \"update:minimized\": (minimized: boolean) => typeof minimized === \"boolean\",\n },\n setup(props, { attrs, emit, slots }) {\n const host = inject(TOOLBAR_HOST, null)\n const internalValue = ref(props.defaultValue)\n const value = computed(() => props.value ?? internalValue.value)\n const internalMinimized = ref(props.defaultMinimized)\n const minimized = computed(() => props.minimized ?? internalMinimized.value)\n\n const select = (next: string) => {\n if (props.value === undefined) internalValue.value = next\n emit(\"update:value\", next)\n emit(\"valueChange\", next)\n }\n const setMinimized = (next: boolean) => {\n if (next === minimized.value) return\n if (props.minimized === undefined) internalMinimized.value = next\n emit(\"update:minimized\", next)\n }\n provide(TAB_BAR, { value, minimized, select, expand: () => setMinimized(false) })\n\n // The bar follows the Page content: down by MINIMIZE_AFTER minimizes it, up by as much (or the top) expands it.\n let unsubscribe: (() => void) | undefined\n const follow = () => {\n unsubscribe?.()\n unsubscribe = undefined\n if (props.minimizeBehavior !== \"onScrollDown\" || !host?.subscribeScroll) return\n let anchor = 0\n unsubscribe = host.subscribeScroll((scrollTop) => {\n if (scrollTop <= 0) {\n anchor = 0\n return setMinimized(false)\n }\n const delta = scrollTop - anchor\n if (minimized.value ? delta < 0 : delta > 0) {\n if (Math.abs(delta) >= MINIMIZE_AFTER) {\n anchor = scrollTop\n setMinimized(!minimized.value)\n }\n return\n }\n anchor = scrollTop\n })\n }\n watch(() => props.minimizeBehavior, follow, { immediate: true })\n\n // Like a bottom Toolbar, the bar reserves its height on the Page; a desktop layout hides it.\n const element = ref<HTMLElement | null>(null)\n let observer: ResizeObserver | undefined\n onMounted(() => {\n const bar = element.value\n const setHeight = host?.setHeight\n if (!bar || !setHeight) return\n const update = () => setHeight(\"bottom\", bar.offsetHeight || undefined)\n update()\n observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n observer?.observe(bar, { box: \"border-box\" })\n })\n onBeforeUnmount(() => {\n unsubscribe?.()\n observer?.disconnect()\n host?.setHeight?.(\"bottom\", undefined)\n })\n\n // Minimizing or expanding moves the accessory past the tabs. A keyed diff moves the DOM node, and a moved node\n // that holds the focus sends it to the body (React restores it after its commit); the bar puts it back.\n let focused: HTMLElement | null = null\n watch(minimized, () => {\n const active = document.activeElement\n focused = active instanceof HTMLElement && element.value?.contains(active) ? active : null\n }, { flush: \"pre\" })\n watch(minimized, () => {\n const target = focused\n focused = null\n if (target?.isConnected && document.activeElement !== target) target.focus({ preventScroll: true })\n }, { flush: \"post\" })\n\n return () => {\n // An accessory slot that renders nothing (a `v-if` inside it) leaves no empty capsule, as React's `false`.\n const accessory = slots.accessory?.()\n const accessoryCapsule = hasContent(accessory) ? h(\"div\", { key: \"accessory\", class: s.Accessory }, accessory) : null\n const tabs = h(\"div\", { key: \"tabs\", class: s.Tabs }, [\n slots.default?.(),\n props.search && props.prominent\n ? h(TabBarItem, { value: props.search.value, label: props.search.label ?? \"Search\" }, { icon: () => h(SearchIcon) })\n : null,\n ])\n const circle = props.prominent\n ? h(TabBarItem, { key: \"prominent\", class: s.Prominent, value: props.prominent.value, label: props.prominent.label, hideLabel: true }, { icon: () => slots[\"prominent-icon\"]?.() })\n : props.search\n ? h(TabBarItem, { key: \"search\", class: s.Search, value: props.search.value, label: props.search.label ?? \"Search\", hideLabel: true }, { icon: () => h(SearchIcon) })\n : null\n // The accessory is read where it stands: above the tabs, and minimized between the two circles. The keys move\n // it there without remounting its content.\n return h(\"nav\", {\n ...attrs,\n \"ref\": element,\n \"aria-label\": props.ariaLabel,\n \"class\": [s.TabBar, attrs.class],\n \"data-host\": host?.kind,\n \"data-background\": barBackground(props.background),\n \"data-content-below\": host?.contentBelow?.value ? \"\" : undefined,\n \"data-minimized\": minimized.value ? \"\" : undefined,\n \"data-search\": props.search && !props.prominent ? \"\" : undefined,\n \"data-prominent\": props.prominent ? \"\" : undefined,\n \"data-accessory\": accessoryCapsule ? \"\" : undefined,\n }, minimized.value ? [tabs, accessoryCapsule, circle] : [accessoryCapsule, tabs, circle])\n }\n },\n})\n\n/** Props of `TabBar`. */\nexport type TabBarProps = InstanceType<typeof TabBarComponent>[\"$props\"]\n\n/**\n * The tab bar of a phone screen after the iOS 26 kit Tab Bar - iPhone (507:24689): two to five tabs, each a\n * symbol over a label, in a floating glass capsule at the bottom, the selected tab on a pill, and an optional\n * search or prominent tab in a circle of its own. It minimizes to the selected tab while the content scrolls\n * down. A desktop layout navigates with a Sidebar or Tabs, so the bar never renders from 768px up.\n */\nexport const TabBar = TabBarComponent\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
|
});
|