@vielzeug/refine 2.1.3 → 2.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.cjs.map +1 -1
- package/dist/accordion.js +2 -2
- package/dist/accordion.js.map +1 -1
- package/dist/carousel.cjs +25 -24
- package/dist/carousel.cjs.map +1 -1
- package/dist/carousel.js +125 -135
- package/dist/carousel.js.map +1 -1
- package/dist/combobox.cjs +14 -14
- package/dist/combobox.cjs.map +1 -1
- package/dist/combobox.js +88 -98
- package/dist/combobox.js.map +1 -1
- package/dist/content/carousel/carousel.d.ts.map +1 -1
- package/dist/content/list/_list-item-reveal.cjs +1 -1
- package/dist/content/list/_list-item-reveal.cjs.map +1 -1
- package/dist/content/list/_list-item-reveal.d.ts +3 -3
- package/dist/content/list/_list-item-reveal.d.ts.map +1 -1
- package/dist/content/list/_list-item-reveal.js +22 -22
- package/dist/content/list/_list-item-reveal.js.map +1 -1
- package/dist/content/list/list-item.d.ts.map +1 -1
- package/dist/core/focus.cjs +1 -1
- package/dist/core/focus.cjs.map +1 -1
- package/dist/core/focus.d.ts.map +1 -1
- package/dist/core/focus.js +21 -20
- package/dist/core/focus.js.map +1 -1
- package/dist/core/index.d.ts +2 -3
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/nav.cjs +1 -1
- package/dist/core/nav.cjs.map +1 -1
- package/dist/core/nav.d.ts +3 -62
- package/dist/core/nav.d.ts.map +1 -1
- package/dist/core/nav.js +41 -124
- package/dist/core/nav.js.map +1 -1
- package/dist/core/option-list.cjs +1 -1
- package/dist/core/option-list.cjs.map +1 -1
- package/dist/core/option-list.d.ts +5 -5
- package/dist/core/option-list.d.ts.map +1 -1
- package/dist/core/option-list.js +14 -13
- package/dist/core/option-list.js.map +1 -1
- package/dist/core/overlay.cjs +1 -1
- package/dist/core/overlay.cjs.map +1 -1
- package/dist/core/overlay.d.ts +0 -8
- package/dist/core/overlay.d.ts.map +1 -1
- package/dist/core/overlay.js +1 -3
- package/dist/core/overlay.js.map +1 -1
- package/dist/custom-elements.json +5636 -5683
- package/dist/drawer.cjs +6 -6
- package/dist/drawer.cjs.map +1 -1
- package/dist/drawer.js +65 -75
- package/dist/drawer.js.map +1 -1
- package/dist/feedback/skeleton/skeleton.css.cjs +1 -1
- package/dist/feedback/skeleton/skeleton.css.cjs.map +1 -1
- package/dist/feedback/skeleton/skeleton.css.js +1 -1
- package/dist/feedback/skeleton/skeleton.css.js.map +1 -1
- package/dist/feedback/skeleton/skeleton.d.ts.map +1 -1
- package/dist/feedback/toast/toast.d.ts.map +1 -1
- package/dist/grid.cjs +2 -2
- package/dist/grid.cjs.map +1 -1
- package/dist/grid.js +42 -41
- package/dist/grid.js.map +1 -1
- package/dist/input.cjs.map +1 -1
- package/dist/input.js.map +1 -1
- package/dist/inputs/input/input.css.cjs +1 -1
- package/dist/inputs/input/input.css.cjs.map +1 -1
- package/dist/inputs/input/input.css.js +1 -1
- package/dist/inputs/input/input.css.js.map +1 -1
- package/dist/inputs/input/input.d.ts +2 -0
- package/dist/inputs/input/input.d.ts.map +1 -1
- package/dist/inputs/select/select.d.ts +2 -2
- package/dist/inputs/select/select.d.ts.map +1 -1
- package/dist/layout/grid/grid.d.ts.map +1 -1
- package/dist/layout/navbar/navbar.d.ts.map +1 -1
- package/dist/layout/sidebar/sidebar.d.ts.map +1 -1
- package/dist/list-item.cjs +2 -6
- package/dist/list-item.cjs.map +1 -1
- package/dist/list-item.js +40 -39
- package/dist/list-item.js.map +1 -1
- package/dist/list.cjs +1 -1
- package/dist/list.cjs.map +1 -1
- package/dist/list.js +2 -2
- package/dist/list.js.map +1 -1
- package/dist/marquee.cjs +1 -1
- package/dist/marquee.cjs.map +1 -1
- package/dist/marquee.js +3 -1
- package/dist/marquee.js.map +1 -1
- package/dist/menu.cjs +5 -5
- package/dist/menu.cjs.map +1 -1
- package/dist/menu.js +59 -59
- package/dist/menu.js.map +1 -1
- package/dist/navbar.cjs +9 -9
- package/dist/navbar.cjs.map +1 -1
- package/dist/navbar.js +124 -116
- package/dist/navbar.js.map +1 -1
- package/dist/otp-input.cjs +1 -1
- package/dist/otp-input.cjs.map +1 -1
- package/dist/otp-input.js +2 -2
- package/dist/otp-input.js.map +1 -1
- package/dist/overlay/drawer/drawer.d.ts.map +1 -1
- package/dist/overlay/menu/menu.d.ts.map +1 -1
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.cjs.map +1 -1
- package/dist/radio-group.js +2 -3
- package/dist/radio-group.js.map +1 -1
- package/dist/radio.cjs +1 -1
- package/dist/radio.cjs.map +1 -1
- package/dist/radio.js +12 -11
- package/dist/radio.js.map +1 -1
- package/dist/rating.cjs +1 -1
- package/dist/rating.cjs.map +1 -1
- package/dist/rating.js +1 -1
- package/dist/rating.js.map +1 -1
- package/dist/refine.cjs +188 -195
- package/dist/refine.cjs.map +1 -1
- package/dist/refine.iife.js +212 -219
- package/dist/refine.iife.js.map +1 -1
- package/dist/refine.js +392 -399
- package/dist/refine.js.map +1 -1
- package/dist/select.cjs +1 -1
- package/dist/select.cjs.map +1 -1
- package/dist/select.js +1 -0
- package/dist/select.js.map +1 -1
- package/dist/sidebar.cjs +16 -16
- package/dist/sidebar.cjs.map +1 -1
- package/dist/sidebar.js +106 -91
- package/dist/sidebar.js.map +1 -1
- package/dist/skeleton.cjs +3 -3
- package/dist/skeleton.cjs.map +1 -1
- package/dist/skeleton.js +8 -7
- package/dist/skeleton.js.map +1 -1
- package/dist/stepper.cjs +1 -1
- package/dist/stepper.cjs.map +1 -1
- package/dist/stepper.js +3 -3
- package/dist/stepper.js.map +1 -1
- package/dist/styles/fouc.css +22 -0
- package/dist/styles/preflight.css +2 -10
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.cjs.map +1 -1
- package/dist/tabs.js +4 -5
- package/dist/tabs.js.map +1 -1
- package/dist/toast.cjs +13 -17
- package/dist/toast.cjs.map +1 -1
- package/dist/toast.js +86 -85
- package/dist/toast.js.map +1 -1
- package/package.json +18 -11
- package/dist/core/swipe.cjs +0 -2
- package/dist/core/swipe.cjs.map +0 -1
- package/dist/core/swipe.d.ts +0 -40
- package/dist/core/swipe.d.ts.map +0 -1
- package/dist/core/swipe.js +0 -63
- package/dist/core/swipe.js.map +0 -1
- package/dist/core/typeahead.cjs +0 -2
- package/dist/core/typeahead.cjs.map +0 -1
- package/dist/core/typeahead.d.ts +0 -53
- package/dist/core/typeahead.d.ts.map +0 -1
- package/dist/core/typeahead.js +0 -23
- package/dist/core/typeahead.js.map +0 -1
package/dist/sidebar.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.cjs","names":[],"sources":["../src/layout/sidebar/sidebar.ts"],"sourcesContent":["import {\n bind,\n createContext,\n define,\n getHost,\n html,\n inject,\n onMounted,\n prop,\n provide,\n resizeObserver,\n useEmit,\n useSlots,\n} from '@vielzeug/ore';\nimport { computed, type Readable, signal, watch } from '@vielzeug/ripple';\n\nimport '../../content/icon/icon';\nimport { coarsePointerMixin, reducedMotionMixin } from '../../styles';\nimport { computeSafeRel } from '../../utils';\nimport sidebarStyles from './sidebar.css?inline';\nimport groupStyles from './sidebar-group.css?inline';\nimport itemStyles from './sidebar-item.css?inline';\n\n// ─── Types ────────────────────────────────────────────────────────────────\n\ntype SidebarVariant = 'floating' | 'inset';\ntype SidebarCollapseSource = 'api' | 'responsive' | 'toggle';\ntype SidebarMobileSource = 'api' | 'responsive' | 'toggle';\ntype SidebarMode = 'bottom-nav' | 'collapsed' | 'default';\n\ntype BottomNavItem = {\n active: boolean;\n disabled: boolean;\n href?: string;\n iconName?: string;\n label: string;\n source: HTMLElement;\n};\n\nconst parseMaxWidthPx = (query: string | undefined): number | undefined => {\n const value = String(query ?? '').trim();\n\n if (!value) return undefined;\n\n const match = /max-width\\s*:\\s*([0-9]+(?:\\.[0-9]+)?)px/i.exec(value);\n\n if (!match) return undefined;\n\n const parsed = Number.parseFloat(match[1]);\n\n return Number.isFinite(parsed) ? parsed : undefined;\n};\n\nconst resolveContainerElement = (el: HTMLElement): HTMLElement | null => {\n let container = el.parentElement;\n\n while (container?.tagName.toLowerCase() === 'ore-grid-item') {\n container = container.parentElement;\n }\n\n return container;\n};\n\nconst readContainerWidth = (el: HTMLElement): number => {\n const parentWidth = resolveContainerElement(el)?.clientWidth ?? 0;\n\n if (parentWidth > 0) return parentWidth;\n\n return el.offsetWidth;\n};\n\n/** Context provided by `ore-sidebar` to its `ore-sidebar-group` and `ore-sidebar-item` children. */\nexport type SidebarContext = {\n collapsed: Readable<boolean>;\n mobileOpen: Readable<boolean>;\n mode: Readable<SidebarMode>;\n variant: Readable<SidebarVariant | undefined>;\n};\n\n/** Injection key for the sidebar context. */\nexport const SIDEBAR_CTX = createContext<SidebarContext>('SidebarContext');\n\n// ─── ore-sidebar styles ──────────────────────────────────────────────────────\n\n/** ore-sidebar element interface */\nexport type SidebarElement = HTMLElement &\n OreSidebarProps & {\n /** Close the drawer in bottom-nav mode. */\n closeMobile(): void;\n /** Open the drawer in bottom-nav mode. */\n openMobile(): void;\n /** Set collapsed state imperatively. */\n setCollapsed(next: boolean): void;\n /** Toggle between collapsed and expanded. */\n toggle(): void;\n /** Toggle the drawer in bottom-nav mode. */\n toggleMobile(): void;\n };\n\n/** Sidebar component properties */\n\nexport type OreSidebarEvents = {\n 'collapsed-change': { collapsed: boolean; source: SidebarCollapseSource };\n 'mobile-open-change': { open: boolean; source: SidebarMobileSource };\n};\n\nexport type OreSidebarGroupEvents = {\n 'open-change': { open: boolean };\n};\n\nexport type OreSidebarProps = {\n /** CSS media query that switches the sidebar to bottom navigation mode */\n 'bottom-nav-at'?: string;\n /** Controlled collapsed state */\n collapsed?: boolean;\n /** Whether the sidebar supports collapsing */\n collapsible?: boolean;\n /** Evaluate responsive and bottom-nav breakpoints against container width only. */\n 'container-breakpoints'?: boolean;\n /** Initial collapsed state in uncontrolled mode */\n 'default-collapsed'?: boolean;\n /**\n * Accessible label for the navigation landmark.\n * Use to distinguish multiple navigation regions on a page.\n * @default 'Sidebar navigation'\n */\n label?: string;\n /**\n * CSS media query that, when it matches, automatically collapses the sidebar.\n * Unset by default — no automatic collapse.\n * @example 'responsive=\"(max-width: 768px)\"'\n */\n responsive?: string;\n /** Visual style variant */\n variant?: SidebarVariant;\n};\n\n/**\n * `ore-sidebar` — A collapsible navigation sidebar with group and item support.\n *\n * @element ore-sidebar\n * @element ore-sidebar-group - Labelled group of navigation items\n * @element ore-sidebar-item - Individual navigation link or button\n *\n * @attr {boolean} collapsed - Controlled collapsed state\n * @attr {boolean} default-collapsed - Initial collapsed state for uncontrolled sidebars\n * @attr {boolean} collapsible - Show the collapse toggle button\n * @attr {string} variant - Visual variant: 'floating' | 'inset'\n * @attr {string} label - Accessible aria-label for the nav landmark\n *\n * @fires collapsed-change - Fired when collapsed state changes. detail: { collapsed: boolean; source: string }\n * @fires mobile-open-change - Fired when mobile overlay open state changes. detail: { open: boolean; source: string }\n *\n * @slot header - Branding or logo content above the nav\n * @slot - Navigation content (ore-sidebar-group / ore-sidebar-item)\n * @slot footer - Footer content below the nav (user info, settings, etc.)\n *\n * @cssprop --sidebar-width - Expanded sidebar width (default: 16rem)\n * @cssprop --sidebar-collapsed-width - Collapsed sidebar width (default: 3.5rem)\n * @cssprop --sidebar-bg - Sidebar background color\n * @cssprop --sidebar-border-color - Border color\n *\n * @part mobile-backdrop - Backdrop shown for mobile overlays.\n * @part nav - Navigation container.\n * @part header - Header container.\n * @part toggle-btn - Shadow part for the `toggle-btn` element.\n * @part content - Content container.\n * @part footer - Footer container.\n * @part bottom-bar - Bottom bar container.\n * @part group - Group container.\n * @part group-header - Group header container.\n * @part group-icon - Group icon container.\n * @part group-label - Group label container.\n * @part group-items - Group items container.\n * @part item-icon - Leading item icon container.\n * @part item-label - Item label container.\n * @part item-end - Trailing item content container.\n * @part item - Item root element.\n * @example\n * ```html\n * <ore-sidebar collapsible label=\"App navigation\">\n * <span slot=\"header\">My App</span>\n * <ore-sidebar-group label=\"Main\">\n * <ore-sidebar-item href=\"/dashboard\" active>Dashboard</ore-sidebar-item>\n * <ore-sidebar-item href=\"/settings\">Settings</ore-sidebar-item>\n * </ore-sidebar-group>\n * </ore-sidebar>\n *\n * <!-- Auto-collapse on mobile -->\n * <ore-sidebar collapsible responsive=\"(max-width: 768px)\">...</ore-sidebar>\n * ```\n */\nexport const SIDEBAR_TAG = 'ore-sidebar' as const;\ndefine<OreSidebarProps>(SIDEBAR_TAG, {\n props: {\n 'bottom-nav-at': prop.string(),\n collapsed: prop.bool(false),\n collapsible: prop.bool(false),\n 'container-breakpoints': prop.bool(false),\n 'default-collapsed': prop.bool(false),\n label: prop.string('Sidebar navigation'),\n responsive: prop.string(),\n variant: prop.string<SidebarVariant>(),\n },\n setup(props) {\n const el = getHost();\n const emit = useEmit<OreSidebarEvents>();\n const slots = useSlots();\n\n const hasHeader = () => slots.has('header').value;\n const hasFooter = () => slots.has('footer').value;\n const hasLogo = () => slots.has('logo').value;\n\n const isControlled = signal(el.hasAttribute('collapsed'));\n const collapsedState = signal(isControlled.value ? el.hasAttribute('collapsed') : props['default-collapsed'].value);\n const isBottomNav = signal(false);\n const isMobileOpen = signal(false);\n const bottomNavItems = signal<BottomNavItem[]>([]);\n const responsiveMediaMatches = signal(false);\n const responsiveSizeMatches = signal(false);\n const responsiveMaxWidthPx = signal<number | undefined>(parseMaxWidthPx(props.responsive.value));\n const hasResponsiveQuery = signal(Boolean(String(props.responsive.value ?? '').trim()));\n const bottomNavMediaMatches = signal(false);\n const bottomNavSizeMatches = signal(false);\n const bottomNavMaxWidthPx = signal<number | undefined>(parseMaxWidthPx(props['bottom-nav-at'].value));\n const isPreviewMode = signal(false);\n\n const isCollapsed = () => collapsedState.value;\n const mode = computed<SidebarMode>(() => {\n if (isBottomNav.value) return 'bottom-nav';\n\n return collapsedState.value ? 'collapsed' : 'default';\n });\n\n const applyResponsiveState = () => {\n const useContainerBreakpoints = props['container-breakpoints'].value;\n const responsiveMatched = useContainerBreakpoints\n ? responsiveSizeMatches.value\n : responsiveMediaMatches.value || responsiveSizeMatches.value;\n const bottomMatched = useContainerBreakpoints\n ? bottomNavSizeMatches.value\n : bottomNavMediaMatches.value || bottomNavSizeMatches.value;\n\n // If the mobile drawer is currently open, stay in bottom-nav mode\n // regardless of the responsive match. This prevents the drawer from\n // disappearing mid-animation or if forced open via the API on desktop.\n if (!isMobileOpen.value) {\n isBottomNav.value = bottomMatched;\n }\n\n if (!bottomMatched && !isMobileOpen.value) {\n setMobileOpen(false, 'responsive');\n }\n\n if (hasResponsiveQuery.value) {\n setCollapsed(responsiveMatched, 'responsive');\n }\n };\n\n const readBottomNavItems = () => {\n const next = slots\n .elements()\n .value.filter(\n (el): el is HTMLElement => el instanceof HTMLElement && el.tagName.toLowerCase() === 'ore-sidebar-item',\n )\n .map((el, index) => {\n const iconSlotEl =\n (el.querySelector(':scope > [slot=\"icon\"]') as HTMLElement | null) ??\n (el.querySelector('[slot=\"icon\"]') as HTMLElement | null);\n const directIconName =\n iconSlotEl?.tagName.toLowerCase() === 'ore-icon' ? iconSlotEl.getAttribute('name') : null;\n const nestedIconName = iconSlotEl?.querySelector('ore-icon')?.getAttribute('name') ?? null;\n const rawLabel = (el.textContent ?? '').trim();\n\n return {\n active: el.hasAttribute('active'),\n disabled: el.hasAttribute('disabled'),\n href: el.getAttribute('href') ?? undefined,\n iconName: directIconName ?? nestedIconName ?? undefined,\n label: rawLabel || `Item ${index + 1}`,\n source: el,\n } satisfies BottomNavItem;\n });\n\n bottomNavItems.value = next;\n };\n\n provide(SIDEBAR_CTX, {\n collapsed: computed(() => !isBottomNav.value && collapsedState.value) as Readable<boolean>,\n mobileOpen: computed(() => isBottomNav.value && isMobileOpen.value) as Readable<boolean>,\n mode: mode as Readable<SidebarMode>,\n variant: props.variant,\n });\n\n const setCollapsed = (next: boolean, source: SidebarCollapseSource) => {\n if (isCollapsed() === next) return;\n\n if (!isControlled.value) {\n collapsedState.value = next;\n }\n\n emit('collapsed-change', { collapsed: next, source });\n };\n\n const setMobileOpen = (next: boolean, source: SidebarMobileSource) => {\n const open = Boolean(next);\n\n if (open && !isBottomNav.value) {\n isBottomNav.value = true;\n }\n\n if (!isBottomNav.value && !open) {\n if (isMobileOpen.value) {\n isMobileOpen.value = false;\n }\n\n return;\n }\n\n if (isMobileOpen.value === open) return;\n\n isMobileOpen.value = open;\n\n // If closing, re-evaluate responsive state to potentially exit forced bottom-nav mode\n if (!open) {\n applyResponsiveState();\n }\n\n emit('mobile-open-change', { open, source });\n };\n\n const doToggle = () => {\n setCollapsed(!isCollapsed(), 'toggle');\n };\n\n const sidebarEl = el as SidebarElement;\n\n sidebarEl.setCollapsed = (next) => setCollapsed(Boolean(next), 'api');\n sidebarEl.toggle = doToggle;\n sidebarEl.openMobile = () => setMobileOpen(true, 'api');\n sidebarEl.closeMobile = () => setMobileOpen(false, 'api');\n sidebarEl.toggleMobile = () => setMobileOpen(!isMobileOpen.value, 'toggle');\n\n bind({\n attr: {\n 'data-bottom-nav': () => (isBottomNav.value ? true : undefined),\n 'data-collapsed': () => (isCollapsed() && !isBottomNav.value ? true : undefined),\n 'data-mobile-open': () => (isBottomNav.value && isMobileOpen.value ? true : undefined),\n 'data-preview-mode': () => (isPreviewMode.value ? true : undefined),\n },\n });\n\n onMounted(() => {\n // Suppress transitions during initial layout so the sidebar doesn't\n // animate from a collapsed/0 state before the first ResizeObserver fires.\n el.setAttribute('data-no-transition', '');\n\n let transitionUnlocked = false;\n const unlockTransition = () => {\n if (transitionUnlocked) return;\n\n transitionUnlocked = true;\n el.removeAttribute('data-no-transition');\n };\n\n // Fallback: unlock after two frames in case ResizeObserver doesn't fire.\n requestAnimationFrame(() => requestAnimationFrame(unlockTransition));\n\n let mediaCleanup: (() => void) | undefined;\n let bottomNavCleanup: (() => void) | undefined;\n const itemObservers = new Map<HTMLElement, MutationObserver>();\n const observer = new MutationObserver(() => {\n if (!el.hasAttribute('collapsed') && !isControlled.value) return;\n\n isControlled.value = true;\n collapsedState.value = el.hasAttribute('collapsed');\n });\n\n observer.observe(el, {\n attributeFilter: ['collapsed'],\n attributes: true,\n });\n\n watch(\n props.responsive,\n (query) => {\n mediaCleanup?.();\n mediaCleanup = undefined;\n\n const mediaQuery = String(query ?? '').trim();\n\n hasResponsiveQuery.value = Boolean(mediaQuery);\n responsiveMaxWidthPx.value = parseMaxWidthPx(mediaQuery);\n responsiveMediaMatches.value = false;\n\n const width = readContainerWidth(el);\n\n responsiveSizeMatches.value =\n width > 0 && responsiveMaxWidthPx.value != null ? width <= responsiveMaxWidthPx.value : false;\n applyResponsiveState();\n\n // For parseable max-width queries, keep behavior container-driven.\n // This avoids preview viewport controls being overridden by window width.\n if (props['container-breakpoints'].value && responsiveMaxWidthPx.value != null) {\n return;\n }\n\n if (!mediaQuery) {\n return;\n }\n\n if (typeof window.matchMedia !== 'function') {\n return;\n }\n\n const mql = window.matchMedia(mediaQuery);\n const onChange = (event: MediaQueryListEvent) => {\n responsiveMediaMatches.value = event.matches;\n applyResponsiveState();\n };\n\n responsiveMediaMatches.value = mql.matches;\n applyResponsiveState();\n mql.addEventListener('change', onChange);\n\n mediaCleanup = () => {\n mql.removeEventListener('change', onChange);\n };\n },\n { immediate: true },\n );\n\n watch(\n props['bottom-nav-at'],\n (query) => {\n bottomNavCleanup?.();\n bottomNavCleanup = undefined;\n\n const mediaQuery = String(query ?? '').trim();\n\n bottomNavMaxWidthPx.value = parseMaxWidthPx(mediaQuery);\n bottomNavMediaMatches.value = false;\n\n const width = readContainerWidth(el);\n\n bottomNavSizeMatches.value =\n width > 0 && bottomNavMaxWidthPx.value != null ? width <= bottomNavMaxWidthPx.value : false;\n applyResponsiveState();\n\n // For parseable max-width queries, keep behavior container-driven.\n // This avoids preview viewport controls being overridden by window width.\n if (props['container-breakpoints'].value && bottomNavMaxWidthPx.value != null) {\n return;\n }\n\n if (!mediaQuery) {\n return;\n }\n\n if (typeof window.matchMedia !== 'function') {\n return;\n }\n\n const mql = window.matchMedia(mediaQuery);\n const onChange = (event: MediaQueryListEvent) => {\n bottomNavMediaMatches.value = event.matches;\n applyResponsiveState();\n };\n\n bottomNavMediaMatches.value = mql.matches;\n applyResponsiveState();\n\n mql.addEventListener('change', onChange);\n bottomNavCleanup = () => {\n mql.removeEventListener('change', onChange);\n };\n },\n { immediate: true },\n );\n\n const stopResizeEffect =\n typeof ResizeObserver === 'function'\n ? (() => {\n const hostSize = resizeObserver(el);\n const wrapperEl = el.parentElement;\n const containerEl = resolveContainerElement(el);\n const wrapperSize = wrapperEl ? resizeObserver(wrapperEl) : undefined;\n const parentSize = containerEl && containerEl !== wrapperEl ? resizeObserver(containerEl) : undefined;\n let rafId: number | undefined;\n\n const onResize = () => {\n if (rafId !== undefined) cancelAnimationFrame(rafId);\n\n rafId = requestAnimationFrame(() => {\n const resolvedContainer = resolveContainerElement(el);\n const width = readContainerWidth(el);\n const responsiveWasMatched = responsiveSizeMatches.value;\n const bottomNavWasMatched = bottomNavSizeMatches.value;\n const parentWidth = resolvedContainer?.clientWidth ?? 0;\n\n isPreviewMode.value = parentWidth > 0 && parentWidth < window.innerWidth;\n\n responsiveSizeMatches.value =\n width > 0 && responsiveMaxWidthPx.value != null ? width <= responsiveMaxWidthPx.value : false;\n bottomNavSizeMatches.value =\n width > 0 && bottomNavMaxWidthPx.value != null ? width <= bottomNavMaxWidthPx.value : false;\n\n if (\n responsiveWasMatched !== responsiveSizeMatches.value ||\n bottomNavWasMatched !== bottomNavSizeMatches.value\n ) {\n applyResponsiveState();\n }\n\n unlockTransition();\n });\n };\n\n return watch(\n computed(() => [\n hostSize.value.width,\n hostSize.value.height,\n wrapperSize?.value.width,\n wrapperSize?.value.height,\n parentSize?.value.width,\n parentSize?.value.height,\n ]),\n onResize,\n );\n })()\n : undefined;\n\n const bindItemObservers = (items: HTMLElement[]) => {\n const set = new Set(items);\n\n for (const [item, cleanup] of itemObservers) {\n if (set.has(item)) continue;\n\n cleanup.disconnect();\n itemObservers.delete(item);\n }\n\n for (const item of items) {\n if (itemObservers.has(item)) continue;\n\n const itemObserver = new MutationObserver(() => {\n // Only update if in bottom-nav mode to minimize re-renders\n if (isBottomNav.value) {\n readBottomNavItems();\n }\n });\n\n // Only watch attributes that affect bottom-nav rendering; skip childList/subtree/characterData\n itemObserver.observe(item, {\n attributeFilter: ['active', 'disabled', 'href'],\n attributes: true,\n });\n itemObservers.set(item, itemObserver);\n }\n };\n\n watch(\n slots.elements(),\n (elements) => {\n const directItems = elements.filter(\n (el): el is HTMLElement => el instanceof HTMLElement && el.tagName.toLowerCase() === 'ore-sidebar-item',\n );\n\n bindItemObservers(directItems);\n readBottomNavItems();\n },\n { immediate: true },\n );\n\n return () => {\n observer.disconnect();\n mediaCleanup?.();\n bottomNavCleanup?.();\n stopResizeEffect?.dispose();\n\n for (const itemObserver of itemObservers.values()) {\n itemObserver.disconnect();\n }\n\n itemObservers.clear();\n };\n });\n\n return html`\n <button\n class=\"mobile-backdrop\"\n part=\"mobile-backdrop\"\n type=\"button\"\n aria-label=\"Close sidebar\"\n ?hidden=${() => !isBottomNav.value || !isMobileOpen.value}\n @click=${() => setMobileOpen(false, 'toggle')}></button>\n <nav aria-label=\"${props.label}\" part=\"nav\">\n <div class=\"sidebar-header\" part=\"header\" ?hidden=${() => !hasHeader() && !props.collapsible.value}>\n <span class=\"sidebar-logo\" ?hidden=${() => !hasLogo()}>\n <slot name=\"logo\"></slot>\n </span>\n <span class=\"sidebar-header-content\">\n <slot name=\"header\"></slot>\n </span>\n <button\n class=\"toggle-btn\"\n part=\"toggle-btn\"\n type=\"button\"\n ?hidden=${() => !props.collapsible.value}\n aria-label=\"${() => (isCollapsed() ? 'Expand sidebar' : 'Collapse sidebar')}\"\n aria-expanded=\"${() => !isCollapsed()}\"\n @click=\"${doToggle}\">\n <span class=\"toggle-icon\" aria-hidden=\"true\">\n <ore-icon name=\"chevron-left\" size=\"16\" stroke-width=\"2\" aria-hidden=\"true\"></ore-icon>\n </span>\n </button>\n </div>\n <div class=\"sidebar-content\" part=\"content\">\n <slot></slot>\n </div>\n <div class=\"sidebar-footer\" part=\"footer\" ?hidden=${() => !hasFooter()}>\n <slot name=\"footer\"></slot>\n </div>\n </nav>\n\n <div class=\"bottom-bar\" part=\"bottom-bar\" ?hidden=${() => !isBottomNav.value}>\n ${() =>\n bottomNavItems.value.map((item) => {\n const className = `bottom-tab${item.active ? ' bottom-tab-active' : ''}`;\n\n if (item.href && !item.disabled) {\n return html`\n <a\n class=\"${className}\"\n href=\"${item.href}\"\n aria-current=\"${item.active ? 'page' : null}\"\n data-active=\"${item.active ? 'true' : null}\">\n <span class=\"bottom-tab-icon\" aria-hidden=\"true\" ?hidden=${() => !item.iconName}>\n <ore-icon name=\"${item.iconName}\" size=\"18\" stroke-width=\"2\"></ore-icon>\n </span>\n <span class=\"bottom-tab-label\">${item.label}</span>\n </a>\n `;\n }\n\n return html`\n <button\n class=\"${className}\"\n type=\"button\"\n ?disabled=${item.disabled}\n aria-current=\"${item.active ? 'page' : null}\"\n data-active=\"${item.active ? 'true' : null}\"\n @click=${() => item.source.click()}>\n <span class=\"bottom-tab-icon\" aria-hidden=\"true\" ?hidden=${() => !item.iconName}>\n <ore-icon name=\"${item.iconName}\" size=\"18\" stroke-width=\"2\"></ore-icon>\n </span>\n <span class=\"bottom-tab-label\">${item.label}</span>\n </button>\n `;\n })}\n </div>\n `;\n },\n styles: [coarsePointerMixin, reducedMotionMixin, sidebarStyles],\n});\n\n// ─── ore-sidebar-group styles ────────────────────────────────────────────────\n\n/** Sidebar group properties */\nexport type OreSidebarGroupProps = {\n /** Whether this group can be collapsed */\n collapsible?: boolean;\n /** Initial open state in uncontrolled mode */\n 'default-open'?: boolean;\n /** Accessible label for the group */\n label?: string;\n /** Controlled open state */\n open?: boolean;\n};\n\n/**\n * `ore-sidebar-group` — A labelled section within `ore-sidebar`.\n *\n * @element ore-sidebar-group\n *\n * @attr {string} label - Group label text\n * @attr {boolean} collapsible - Whether this group can be toggled open/closed\n * @attr {boolean} open - Controlled expanded state\n * @attr {boolean} default-open - Initial expanded state in uncontrolled mode\n *\n * @fires open-change - Fired when the group open state changes (collapsible groups only). detail: { open: boolean }\n *\n * @slot - Navigation items (`ore-sidebar-item`)\n * @slot icon - Icon displayed before the label\n *\n * @example\n * ```html\n * <ore-sidebar-group label=\"Main\" collapsible open>\n * <ore-sidebar-item href=\"/home\">Home</ore-sidebar-item>\n * </ore-sidebar-group>\n * ```\n */\nexport const SIDEBAR_GROUP_TAG = 'ore-sidebar-group' as const;\ndefine<OreSidebarGroupProps>(SIDEBAR_GROUP_TAG, {\n props: {\n collapsible: prop.bool(false),\n 'default-open': prop.bool(true),\n label: prop.string(),\n open: {\n default: undefined as boolean | undefined,\n parse: (value: string | null) => (value == null ? undefined : value === '' || value === 'true'),\n reflect: false,\n },\n },\n setup(props) {\n const slots = useSlots();\n\n const hasIcon = () => slots.has('icon').value;\n const sidebarCtx = inject(SIDEBAR_CTX);\n\n bind({\n attr: {\n 'sidebar-bottom-nav': () =>\n sidebarCtx?.mode.value === 'bottom-nav' && !sidebarCtx?.mobileOpen.value ? true : undefined,\n 'sidebar-collapsed': () => (sidebarCtx?.collapsed.value ? true : undefined),\n },\n });\n\n const isControlled = () => props.open.value !== undefined;\n const openState = signal(props['default-open'].value);\n const isOpen = computed(() => {\n if (!props.collapsible.value) return true;\n\n if (isControlled()) return props.open.value ?? false;\n\n return openState.value;\n });\n\n watch(props.open, (value) => {\n if (value === undefined) return;\n\n openState.value = value;\n });\n\n bind({\n attr: {\n open: () => (isOpen.value ? true : undefined),\n },\n });\n\n return html`\n <details class=\"group\" part=\"group\" ?open=${isOpen}>\n <summary\n class=\"group-header\"\n part=\"group-header\"\n aria-expanded=\"${() => (props.collapsible.value ? String(props.open.value) : null)}\"\n @click=${(e: MouseEvent) => {\n if (!props.collapsible.value) {\n e.preventDefault();\n }\n }}>\n <span class=\"group-icon\" part=\"group-icon\" ?hidden=${() => !hasIcon()} aria-hidden=\"true\">\n <slot name=\"icon\"></slot>\n </span>\n <span class=\"group-label\" part=\"group-label\">${props.label}</span>\n <span class=\"chevron\" ?hidden=${() => !props.collapsible.value} aria-hidden=\"true\">\n <ore-icon name=\"chevron-right\" size=\"12\" stroke-width=\"2\" aria-hidden=\"true\"></ore-icon>\n </span>\n </summary>\n <div class=\"group-items\" part=\"group-items\" role=\"list\">\n <slot></slot>\n </div>\n </details>\n `;\n },\n styles: [reducedMotionMixin, groupStyles],\n});\n\n// ─── ore-sidebar-item styles ─────────────────────────────────────────────────\n\n/** Sidebar item properties */\nexport type OreSidebarItemProps = {\n /** Whether this item represents the current page/section */\n active?: boolean;\n /** Whether this item is disabled */\n disabled?: boolean;\n /** Navigation href — renders an `<a>` when set, otherwise a `<button>` */\n href?: string;\n /**\n * Relationship of the linked URL (`rel` attribute on the inner `<a>`).\n * Only applies when `href` is set.\n */\n rel?: string;\n /**\n * Browsing context for the link (`target` attribute on the inner `<a>`).\n * Only applies when `href` is set.\n */\n target?: string;\n};\n\n/**\n * `ore-sidebar-item` — An individual navigation item in a `ore-sidebar`.\n *\n * Renders as an `<a>` when `href` is provided, otherwise as a `<button>`.\n * Marks the active page via `aria-current=\"page\"` when the `active` attribute is set.\n *\n * @element ore-sidebar-item\n *\n * @attr {string} href - Link URL; renders an anchor when set\n * @attr {boolean} active - Marks the item as the current page\n * @attr {boolean} disabled - Disables the item\n * @attr {string} rel - Anchor `rel` attribute (links only)\n * @attr {string} target - Anchor `target` attribute (links only)\n *\n * @slot - Label text\n * @slot icon - Leading icon\n * @slot end - Trailing content (badge, shortcut, arrow, etc.)\n *\n * @cssprop --sidebar-item-color - Default text color\n * @cssprop --sidebar-item-hover-bg - Hover background\n * @cssprop --sidebar-item-hover-color - Hover text color\n * @cssprop --sidebar-item-active-bg - Active background\n * @cssprop --sidebar-item-active-color - Active text color\n * @cssprop --sidebar-item-indicator - Active indicator bar color\n *\n * @part item - The inner anchor or button element\n * @part item-icon - The icon wrapper\n * @part item-label - The label wrapper\n * @part item-end - The trailing content wrapper\n *\n * @example\n * ```html\n * <ore-sidebar-item href=\"/dashboard\" active>\n * <span slot=\"icon\">🏠</span>\n * Dashboard\n * </ore-sidebar-item>\n *\n * <ore-sidebar-item href=\"/users\">\n * <span slot=\"icon\">👤</span>\n * Users\n * <ore-badge slot=\"end\" color=\"primary\">3</ore-badge>\n * </ore-sidebar-item>\n * ```\n */\nexport const SIDEBAR_ITEM_TAG = 'ore-sidebar-item' as const;\ndefine<OreSidebarItemProps>(SIDEBAR_ITEM_TAG, {\n props: {\n active: prop.bool(false),\n disabled: prop.bool(false),\n href: prop.string(),\n rel: prop.string(),\n target: prop.string(),\n },\n setup(props) {\n const slots = useSlots();\n\n const hasIcon = () => slots.has('icon').value;\n const hasEnd = () => slots.has('end').value;\n const sidebarCtx = inject(SIDEBAR_CTX);\n\n bind({\n attr: {\n 'sidebar-bottom-nav': () =>\n sidebarCtx?.mode.value === 'bottom-nav' && !sidebarCtx?.mobileOpen.value ? true : undefined,\n 'sidebar-collapsed': () => (sidebarCtx?.collapsed.value ? true : undefined),\n },\n });\n\n const isLink = () => !!props.href.value && !props.disabled.value;\n\n // Prevent reverse tabnapping: auto-inject noopener + noreferrer for _blank links.\n const effectiveRel = computed(() => computeSafeRel(props.rel.value, props.target.value));\n\n const renderItemContent = () => html`\n <span class=\"item-icon\" part=\"item-icon\" ?hidden=${() => !hasIcon()} aria-hidden=\"true\">\n <slot name=\"icon\"></slot>\n </span>\n <span class=\"item-label\" part=\"item-label\"><slot></slot></span>\n <span class=\"item-end\" part=\"item-end\" ?hidden=${() => !hasEnd()}>\n <slot name=\"end\"></slot>\n </span>\n `;\n\n return html`\n ${() => {\n if (isLink()) {\n return html`\n <a\n class=\"item\"\n part=\"item\"\n href=\"${props.href}\"\n rel=\"${effectiveRel}\"\n target=\"${props.target}\"\n aria-current=\"${() => (props.active.value ? 'page' : null)}\">\n ${renderItemContent()}\n </a>\n `;\n }\n\n if (props.disabled.value) {\n return html`\n <div\n class=\"item\"\n part=\"item\"\n aria-disabled=\"true\"\n tabindex=\"-1\"\n aria-current=\"${() => (props.active.value ? 'page' : null)}\">\n ${renderItemContent()}\n </div>\n `;\n }\n\n return html`\n <button\n class=\"item\"\n part=\"item\"\n type=\"button\"\n ?disabled=\"${props.disabled}\"\n aria-current=\"${() => (props.active.value ? 'page' : null)}\">\n ${renderItemContent()}\n </button>\n `;\n }}\n `;\n },\n styles: [coarsePointerMixin, itemStyles],\n});\n"],"mappings":"4WAuCA,IAAM,EAAmB,GAAkD,CACzE,IAAM,EAAQ,OAAO,GAAS,EAAE,CAAC,CAAC,KAAK,EAEvC,GAAI,CAAC,EAAO,OAEZ,IAAM,EAAQ,2CAA2C,KAAK,CAAK,EAEnE,GAAI,CAAC,EAAO,OAEZ,IAAM,EAAS,OAAO,WAAW,EAAM,EAAE,EAEzC,OAAO,OAAO,SAAS,CAAM,EAAI,EAAS,IAAA,EAC5C,EAEM,EAA2B,GAAwC,CACvE,IAAI,EAAY,EAAG,cAEnB,KAAO,GAAW,QAAQ,YAAY,IAAM,iBAC1C,EAAY,EAAU,cAGxB,OAAO,CACT,EAEM,EAAsB,GAA4B,CACtD,IAAM,EAAc,EAAwB,CAAE,CAAC,EAAE,aAAe,EAIhE,OAFI,EAAc,EAAU,EAErB,EAAG,WACZ,EAWa,GAAA,EAAc,EAAA,cAAA,CAA8B,gBAAgB,EAgH5D,EAAc,eAC3B,EAAA,EAAA,OAAA,CAAwB,EAAa,CACnC,MAAO,CACL,gBAAiB,EAAA,KAAK,OAAO,EAC7B,UAAW,EAAA,KAAK,KAAK,EAAK,EAC1B,YAAa,EAAA,KAAK,KAAK,EAAK,EAC5B,wBAAyB,EAAA,KAAK,KAAK,EAAK,EACxC,oBAAqB,EAAA,KAAK,KAAK,EAAK,EACpC,MAAO,EAAA,KAAK,OAAO,oBAAoB,EACvC,WAAY,EAAA,KAAK,OAAO,EACxB,QAAS,EAAA,KAAK,OAAuB,CACvC,EACA,MAAM,EAAO,CACX,IAAM,GAAA,E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E;;;MAKnE,MAAO,GAAA,IAAI;YAEH,EAAO,EACF,EAAA,IAAI;;;;sBAIC,EAAM,KAAK;qBACZ,EAAa;wBACV,EAAM,OAAO;kCACA,EAAM,OAAO,MAAQ,OAAS,KAAM;gBACzD,EAAkB,EAAE;;YAKxB,EAAM,SAAS,MACV,EAAA,IAAI;;;;;;kCAMgB,EAAM,OAAO,MAAQ,OAAS,KAAM;gBACzD,EAAkB,EAAE;;YAKrB,EAAA,IAAI;;;;;yBAKM,EAAM,SAAS;gCACL,EAAM,OAAO,MAAQ,OAAS,KAAM;cACzD,EAAkB,EAAE;;UAG1B;KAEN,EACA,OAAQ,CAAC,EAAA,mBAAoB,EAAA,OAAU,CACzC,CAAC"}
|
|
1
|
+
{"version":3,"file":"sidebar.cjs","names":[],"sources":["../src/layout/sidebar/sidebar.ts"],"sourcesContent":["import {\n bind,\n createContext,\n define,\n getHost,\n html,\n inject,\n onCleanup,\n onMounted,\n prop,\n provide,\n useEmit,\n useSlots,\n} from '@vielzeug/ore';\nimport { computed, type Readable, signal, watch } from '@vielzeug/ripple';\nimport { createElementSize, createMediaQuery, SentinelUnavailableError } from '@vielzeug/sentinel';\n\nimport '../../content/icon/icon';\nimport { coarsePointerMixin, reducedMotionMixin } from '../../styles';\nimport { computeSafeRel } from '../../utils';\nimport sidebarStyles from './sidebar.css?inline';\nimport groupStyles from './sidebar-group.css?inline';\nimport itemStyles from './sidebar-item.css?inline';\n\n// ─── Types ────────────────────────────────────────────────────────────────\n\ntype SidebarVariant = 'floating' | 'inset';\ntype SidebarCollapseSource = 'api' | 'responsive' | 'toggle';\ntype SidebarMobileSource = 'api' | 'responsive' | 'toggle';\ntype SidebarMode = 'bottom-nav' | 'collapsed' | 'default';\n\ntype BottomNavItem = {\n active: boolean;\n disabled: boolean;\n href?: string;\n iconName?: string;\n label: string;\n source: HTMLElement;\n};\n\nconst parseMaxWidthPx = (query: string | undefined): number | undefined => {\n const value = String(query ?? '').trim();\n\n if (!value) return undefined;\n\n const match = /max-width\\s*:\\s*([0-9]+(?:\\.[0-9]+)?)px/i.exec(value);\n\n if (!match) return undefined;\n\n const parsed = Number.parseFloat(match[1]);\n\n return Number.isFinite(parsed) ? parsed : undefined;\n};\n\nconst resolveContainerElement = (el: HTMLElement): HTMLElement | null => {\n let container = el.parentElement;\n\n while (container?.tagName.toLowerCase() === 'ore-grid-item') {\n container = container.parentElement;\n }\n\n return container;\n};\n\nconst readContainerWidth = (el: HTMLElement): number => {\n const parentWidth = resolveContainerElement(el)?.clientWidth ?? 0;\n\n if (parentWidth > 0) return parentWidth;\n\n return el.offsetWidth;\n};\n\n/** Context provided by `ore-sidebar` to its `ore-sidebar-group` and `ore-sidebar-item` children. */\nexport type SidebarContext = {\n collapsed: Readable<boolean>;\n mobileOpen: Readable<boolean>;\n mode: Readable<SidebarMode>;\n variant: Readable<SidebarVariant | undefined>;\n};\n\n/** Injection key for the sidebar context. */\nexport const SIDEBAR_CTX = createContext<SidebarContext>('SidebarContext');\n\n// ─── ore-sidebar styles ──────────────────────────────────────────────────────\n\n/** ore-sidebar element interface */\nexport type SidebarElement = HTMLElement &\n OreSidebarProps & {\n /** Close the drawer in bottom-nav mode. */\n closeMobile(): void;\n /** Open the drawer in bottom-nav mode. */\n openMobile(): void;\n /** Set collapsed state imperatively. */\n setCollapsed(next: boolean): void;\n /** Toggle between collapsed and expanded. */\n toggle(): void;\n /** Toggle the drawer in bottom-nav mode. */\n toggleMobile(): void;\n };\n\n/** Sidebar component properties */\n\nexport type OreSidebarEvents = {\n 'collapsed-change': { collapsed: boolean; source: SidebarCollapseSource };\n 'mobile-open-change': { open: boolean; source: SidebarMobileSource };\n};\n\nexport type OreSidebarGroupEvents = {\n 'open-change': { open: boolean };\n};\n\nexport type OreSidebarProps = {\n /** CSS media query that switches the sidebar to bottom navigation mode */\n 'bottom-nav-at'?: string;\n /** Controlled collapsed state */\n collapsed?: boolean;\n /** Whether the sidebar supports collapsing */\n collapsible?: boolean;\n /** Evaluate responsive and bottom-nav breakpoints against container width only. */\n 'container-breakpoints'?: boolean;\n /** Initial collapsed state in uncontrolled mode */\n 'default-collapsed'?: boolean;\n /**\n * Accessible label for the navigation landmark.\n * Use to distinguish multiple navigation regions on a page.\n * @default 'Sidebar navigation'\n */\n label?: string;\n /**\n * CSS media query that, when it matches, automatically collapses the sidebar.\n * Unset by default — no automatic collapse.\n * @example 'responsive=\"(max-width: 768px)\"'\n */\n responsive?: string;\n /** Visual style variant */\n variant?: SidebarVariant;\n};\n\n/**\n * `ore-sidebar` — A collapsible navigation sidebar with group and item support.\n *\n * @element ore-sidebar\n * @element ore-sidebar-group - Labelled group of navigation items\n * @element ore-sidebar-item - Individual navigation link or button\n *\n * @attr {boolean} collapsed - Controlled collapsed state\n * @attr {boolean} default-collapsed - Initial collapsed state for uncontrolled sidebars\n * @attr {boolean} collapsible - Show the collapse toggle button\n * @attr {string} variant - Visual variant: 'floating' | 'inset'\n * @attr {string} label - Accessible aria-label for the nav landmark\n *\n * @fires collapsed-change - Fired when collapsed state changes. detail: { collapsed: boolean; source: string }\n * @fires mobile-open-change - Fired when mobile overlay open state changes. detail: { open: boolean; source: string }\n *\n * @slot header - Branding or logo content above the nav\n * @slot - Navigation content (ore-sidebar-group / ore-sidebar-item)\n * @slot footer - Footer content below the nav (user info, settings, etc.)\n *\n * @cssprop --sidebar-width - Expanded sidebar width (default: 16rem)\n * @cssprop --sidebar-collapsed-width - Collapsed sidebar width (default: 3.5rem)\n * @cssprop --sidebar-bg - Sidebar background color\n * @cssprop --sidebar-border-color - Border color\n *\n * @part mobile-backdrop - Backdrop shown for mobile overlays.\n * @part nav - Navigation container.\n * @part header - Header container.\n * @part toggle-btn - Shadow part for the `toggle-btn` element.\n * @part content - Content container.\n * @part footer - Footer container.\n * @part bottom-bar - Bottom bar container.\n * @part group - Group container.\n * @part group-header - Group header container.\n * @part group-icon - Group icon container.\n * @part group-label - Group label container.\n * @part group-items - Group items container.\n * @part item-icon - Leading item icon container.\n * @part item-label - Item label container.\n * @part item-end - Trailing item content container.\n * @part item - Item root element.\n * @example\n * ```html\n * <ore-sidebar collapsible label=\"App navigation\">\n * <span slot=\"header\">My App</span>\n * <ore-sidebar-group label=\"Main\">\n * <ore-sidebar-item href=\"/dashboard\" active>Dashboard</ore-sidebar-item>\n * <ore-sidebar-item href=\"/settings\">Settings</ore-sidebar-item>\n * </ore-sidebar-group>\n * </ore-sidebar>\n *\n * <!-- Auto-collapse on mobile -->\n * <ore-sidebar collapsible responsive=\"(max-width: 768px)\">...</ore-sidebar>\n * ```\n */\nexport const SIDEBAR_TAG = 'ore-sidebar' as const;\ndefine<OreSidebarProps>(SIDEBAR_TAG, {\n props: {\n 'bottom-nav-at': prop.string(),\n collapsed: prop.bool(false),\n collapsible: prop.bool(false),\n 'container-breakpoints': prop.bool(false),\n 'default-collapsed': prop.bool(false),\n label: prop.string('Sidebar navigation'),\n responsive: prop.string(),\n variant: prop.string<SidebarVariant>(),\n },\n setup(props) {\n const el = getHost();\n const emit = useEmit<OreSidebarEvents>();\n const slots = useSlots();\n\n const hasHeader = () => slots.has('header').value;\n const hasFooter = () => slots.has('footer').value;\n const hasLogo = () => slots.has('logo').value;\n\n const isControlled = signal(el.hasAttribute('collapsed'));\n const collapsedState = signal(isControlled.value ? el.hasAttribute('collapsed') : props['default-collapsed'].value);\n const isBottomNav = signal(false);\n const isMobileOpen = signal(false);\n const bottomNavItems = signal<BottomNavItem[]>([]);\n const responsiveMediaMatches = signal(false);\n const responsiveSizeMatches = signal(false);\n const responsiveMaxWidthPx = signal<number | undefined>(parseMaxWidthPx(props.responsive.value));\n const hasResponsiveQuery = signal(Boolean(String(props.responsive.value ?? '').trim()));\n const bottomNavMediaMatches = signal(false);\n const bottomNavSizeMatches = signal(false);\n const bottomNavMaxWidthPx = signal<number | undefined>(parseMaxWidthPx(props['bottom-nav-at'].value));\n const isPreviewMode = signal(false);\n\n const isCollapsed = () => collapsedState.value;\n const mode = computed<SidebarMode>(() => {\n if (isBottomNav.value) return 'bottom-nav';\n\n return collapsedState.value ? 'collapsed' : 'default';\n });\n\n const applyResponsiveState = () => {\n const useContainerBreakpoints = props['container-breakpoints'].value;\n const responsiveMatched = useContainerBreakpoints\n ? responsiveSizeMatches.value\n : responsiveMediaMatches.value || responsiveSizeMatches.value;\n const bottomMatched = useContainerBreakpoints\n ? bottomNavSizeMatches.value\n : bottomNavMediaMatches.value || bottomNavSizeMatches.value;\n\n // If the mobile drawer is currently open, stay in bottom-nav mode\n // regardless of the responsive match. This prevents the drawer from\n // disappearing mid-animation or if forced open via the API on desktop.\n if (!isMobileOpen.value) {\n isBottomNav.value = bottomMatched;\n }\n\n if (!bottomMatched && !isMobileOpen.value) {\n setMobileOpen(false, 'responsive');\n }\n\n if (hasResponsiveQuery.value) {\n setCollapsed(responsiveMatched, 'responsive');\n }\n };\n\n const readBottomNavItems = () => {\n const next = slots\n .elements()\n .value.filter(\n (el): el is HTMLElement => el instanceof HTMLElement && el.tagName.toLowerCase() === 'ore-sidebar-item',\n )\n .map((el, index) => {\n const iconSlotEl =\n (el.querySelector(':scope > [slot=\"icon\"]') as HTMLElement | null) ??\n (el.querySelector('[slot=\"icon\"]') as HTMLElement | null);\n const directIconName =\n iconSlotEl?.tagName.toLowerCase() === 'ore-icon' ? iconSlotEl.getAttribute('name') : null;\n const nestedIconName = iconSlotEl?.querySelector('ore-icon')?.getAttribute('name') ?? null;\n const rawLabel = (el.textContent ?? '').trim();\n\n return {\n active: el.hasAttribute('active'),\n disabled: el.hasAttribute('disabled'),\n href: el.getAttribute('href') ?? undefined,\n iconName: directIconName ?? nestedIconName ?? undefined,\n label: rawLabel || `Item ${index + 1}`,\n source: el,\n } satisfies BottomNavItem;\n });\n\n bottomNavItems.value = next;\n };\n\n provide(SIDEBAR_CTX, {\n collapsed: computed(() => !isBottomNav.value && collapsedState.value) as Readable<boolean>,\n mobileOpen: computed(() => isBottomNav.value && isMobileOpen.value) as Readable<boolean>,\n mode: mode as Readable<SidebarMode>,\n variant: props.variant,\n });\n\n const setCollapsed = (next: boolean, source: SidebarCollapseSource) => {\n if (isCollapsed() === next) return;\n\n if (!isControlled.value) {\n collapsedState.value = next;\n }\n\n emit('collapsed-change', { collapsed: next, source });\n };\n\n const setMobileOpen = (next: boolean, source: SidebarMobileSource) => {\n const open = Boolean(next);\n\n if (open && !isBottomNav.value) {\n isBottomNav.value = true;\n }\n\n if (!isBottomNav.value && !open) {\n if (isMobileOpen.value) {\n isMobileOpen.value = false;\n }\n\n return;\n }\n\n if (isMobileOpen.value === open) return;\n\n isMobileOpen.value = open;\n\n // If closing, re-evaluate responsive state to potentially exit forced bottom-nav mode\n if (!open) {\n applyResponsiveState();\n }\n\n emit('mobile-open-change', { open, source });\n };\n\n const doToggle = () => {\n setCollapsed(!isCollapsed(), 'toggle');\n };\n\n const sidebarEl = el as SidebarElement;\n\n sidebarEl.setCollapsed = (next) => setCollapsed(Boolean(next), 'api');\n sidebarEl.toggle = doToggle;\n sidebarEl.openMobile = () => setMobileOpen(true, 'api');\n sidebarEl.closeMobile = () => setMobileOpen(false, 'api');\n sidebarEl.toggleMobile = () => setMobileOpen(!isMobileOpen.value, 'toggle');\n\n bind({\n attr: {\n 'data-bottom-nav': () => (isBottomNav.value ? true : undefined),\n 'data-collapsed': () => (isCollapsed() && !isBottomNav.value ? true : undefined),\n 'data-mobile-open': () => (isBottomNav.value && isMobileOpen.value ? true : undefined),\n 'data-preview-mode': () => (isPreviewMode.value ? true : undefined),\n },\n });\n\n onMounted(() => {\n // Suppress transitions during initial layout so the sidebar doesn't\n // animate from a collapsed/0 state before the first ResizeObserver fires.\n el.setAttribute('data-no-transition', '');\n\n let transitionUnlocked = false;\n const unlockTransition = () => {\n if (transitionUnlocked) return;\n\n transitionUnlocked = true;\n el.removeAttribute('data-no-transition');\n };\n\n // Fallback: unlock after two frames in case ResizeObserver doesn't fire.\n requestAnimationFrame(() => requestAnimationFrame(unlockTransition));\n\n let mediaCleanup: (() => void) | undefined;\n let bottomNavCleanup: (() => void) | undefined;\n const itemObservers = new Map<HTMLElement, MutationObserver>();\n const observer = new MutationObserver(() => {\n if (!el.hasAttribute('collapsed') && !isControlled.value) return;\n\n isControlled.value = true;\n collapsedState.value = el.hasAttribute('collapsed');\n });\n\n observer.observe(el, {\n attributeFilter: ['collapsed'],\n attributes: true,\n });\n\n watch(\n props.responsive,\n (query) => {\n mediaCleanup?.();\n mediaCleanup = undefined;\n\n const mediaQuery = String(query ?? '').trim();\n\n hasResponsiveQuery.value = Boolean(mediaQuery);\n responsiveMaxWidthPx.value = parseMaxWidthPx(mediaQuery);\n responsiveMediaMatches.value = false;\n\n const width = readContainerWidth(el);\n\n responsiveSizeMatches.value =\n width > 0 && responsiveMaxWidthPx.value != null ? width <= responsiveMaxWidthPx.value : false;\n applyResponsiveState();\n\n // For parseable max-width queries, keep behavior container-driven.\n // This avoids preview viewport controls being overridden by window width.\n if (props['container-breakpoints'].value && responsiveMaxWidthPx.value != null) {\n return;\n }\n\n if (!mediaQuery) {\n return;\n }\n\n try {\n const mediaHandle = createMediaQuery(mediaQuery);\n const syncMedia = (state: typeof mediaHandle.value) => {\n if (state) {\n responsiveMediaMatches.value = state.matches;\n applyResponsiveState();\n }\n };\n\n syncMedia(mediaHandle.value);\n\n const mediaCleanupFn = watch(mediaHandle, syncMedia);\n mediaCleanup = () => {\n mediaCleanupFn.dispose();\n mediaHandle.dispose();\n };\n } catch (error) {\n if (!(error instanceof SentinelUnavailableError)) throw error;\n }\n },\n { immediate: true },\n );\n\n watch(\n props['bottom-nav-at'],\n (query) => {\n bottomNavCleanup?.();\n bottomNavCleanup = undefined;\n\n const mediaQuery = String(query ?? '').trim();\n\n bottomNavMaxWidthPx.value = parseMaxWidthPx(mediaQuery);\n bottomNavMediaMatches.value = false;\n\n const width = readContainerWidth(el);\n\n bottomNavSizeMatches.value =\n width > 0 && bottomNavMaxWidthPx.value != null ? width <= bottomNavMaxWidthPx.value : false;\n applyResponsiveState();\n\n // For parseable max-width queries, keep behavior container-driven.\n // This avoids preview viewport controls being overridden by window width.\n if (props['container-breakpoints'].value && bottomNavMaxWidthPx.value != null) {\n return;\n }\n\n if (!mediaQuery) {\n return;\n }\n\n try {\n const mediaHandle = createMediaQuery(mediaQuery);\n const syncMedia = (state: typeof mediaHandle.value) => {\n if (state) {\n bottomNavMediaMatches.value = state.matches;\n applyResponsiveState();\n }\n };\n\n syncMedia(mediaHandle.value);\n\n const mediaCleanupFn = watch(mediaHandle, syncMedia);\n bottomNavCleanup = () => {\n mediaCleanupFn.dispose();\n mediaHandle.dispose();\n };\n } catch (error) {\n if (!(error instanceof SentinelUnavailableError)) throw error;\n }\n },\n { immediate: true },\n );\n\n const stopResizeEffect =\n typeof ResizeObserver === 'function'\n ? (() => {\n const hostSize = createElementSize(el);\n onCleanup(() => hostSize.dispose());\n\n const wrapperEl = el.parentElement;\n const containerEl = resolveContainerElement(el);\n const wrapperSize = wrapperEl ? createElementSize(wrapperEl) : undefined;\n const parentSize = containerEl && containerEl !== wrapperEl ? createElementSize(containerEl) : undefined;\n\n if (wrapperSize) {\n onCleanup(() => wrapperSize.dispose());\n }\n if (parentSize) {\n onCleanup(() => parentSize.dispose());\n }\n\n let rafId: number | undefined;\n\n const onResize = () => {\n if (rafId !== undefined) cancelAnimationFrame(rafId);\n\n rafId = requestAnimationFrame(() => {\n const resolvedContainer = resolveContainerElement(el);\n const width = readContainerWidth(el);\n const responsiveWasMatched = responsiveSizeMatches.value;\n const bottomNavWasMatched = bottomNavSizeMatches.value;\n const parentWidth = resolvedContainer?.clientWidth ?? 0;\n\n isPreviewMode.value = parentWidth > 0 && parentWidth < window.innerWidth;\n\n responsiveSizeMatches.value =\n width > 0 && responsiveMaxWidthPx.value != null ? width <= responsiveMaxWidthPx.value : false;\n bottomNavSizeMatches.value =\n width > 0 && bottomNavMaxWidthPx.value != null ? width <= bottomNavMaxWidthPx.value : false;\n\n if (\n responsiveWasMatched !== responsiveSizeMatches.value ||\n bottomNavWasMatched !== bottomNavSizeMatches.value\n ) {\n applyResponsiveState();\n }\n\n unlockTransition();\n });\n };\n\n return watch(\n computed(() => [\n hostSize.value?.width,\n hostSize.value?.height,\n wrapperSize?.value?.width,\n wrapperSize?.value?.height,\n parentSize?.value?.width,\n parentSize?.value?.height,\n ]),\n onResize,\n );\n })()\n : undefined;\n\n const bindItemObservers = (items: HTMLElement[]) => {\n const set = new Set(items);\n\n for (const [item, cleanup] of itemObservers) {\n if (set.has(item)) continue;\n\n cleanup.disconnect();\n itemObservers.delete(item);\n }\n\n for (const item of items) {\n if (itemObservers.has(item)) continue;\n\n const itemObserver = new MutationObserver(() => {\n // Only update if in bottom-nav mode to minimize re-renders\n if (isBottomNav.value) {\n readBottomNavItems();\n }\n });\n\n // Only watch attributes that affect bottom-nav rendering; skip childList/subtree/characterData\n itemObserver.observe(item, {\n attributeFilter: ['active', 'disabled', 'href'],\n attributes: true,\n });\n itemObservers.set(item, itemObserver);\n }\n };\n\n watch(\n slots.elements(),\n (elements) => {\n const directItems = elements.filter(\n (el): el is HTMLElement => el instanceof HTMLElement && el.tagName.toLowerCase() === 'ore-sidebar-item',\n );\n\n bindItemObservers(directItems);\n readBottomNavItems();\n },\n { immediate: true },\n );\n\n return () => {\n observer.disconnect();\n mediaCleanup?.();\n bottomNavCleanup?.();\n stopResizeEffect?.dispose();\n\n for (const itemObserver of itemObservers.values()) {\n itemObserver.disconnect();\n }\n\n itemObservers.clear();\n };\n });\n\n return html`\n <button\n class=\"mobile-backdrop\"\n part=\"mobile-backdrop\"\n type=\"button\"\n aria-label=\"Close sidebar\"\n ?hidden=${() => !isBottomNav.value || !isMobileOpen.value}\n @click=${() => setMobileOpen(false, 'toggle')}></button>\n <nav aria-label=\"${props.label}\" part=\"nav\">\n <div class=\"sidebar-header\" part=\"header\" ?hidden=${() => !hasHeader() && !props.collapsible.value}>\n <span class=\"sidebar-logo\" ?hidden=${() => !hasLogo()}>\n <slot name=\"logo\"></slot>\n </span>\n <span class=\"sidebar-header-content\">\n <slot name=\"header\"></slot>\n </span>\n <button\n class=\"toggle-btn\"\n part=\"toggle-btn\"\n type=\"button\"\n ?hidden=${() => !props.collapsible.value}\n aria-label=\"${() => (isCollapsed() ? 'Expand sidebar' : 'Collapse sidebar')}\"\n aria-expanded=\"${() => !isCollapsed()}\"\n @click=\"${doToggle}\">\n <span class=\"toggle-icon\" aria-hidden=\"true\">\n <ore-icon name=\"chevron-left\" size=\"16\" stroke-width=\"2\" aria-hidden=\"true\"></ore-icon>\n </span>\n </button>\n </div>\n <div class=\"sidebar-content\" part=\"content\">\n <slot></slot>\n </div>\n <div class=\"sidebar-footer\" part=\"footer\" ?hidden=${() => !hasFooter()}>\n <slot name=\"footer\"></slot>\n </div>\n </nav>\n\n <div class=\"bottom-bar\" part=\"bottom-bar\" ?hidden=${() => !isBottomNav.value}>\n ${() =>\n bottomNavItems.value.map((item) => {\n const className = `bottom-tab${item.active ? ' bottom-tab-active' : ''}`;\n\n if (item.href && !item.disabled) {\n return html`\n <a\n class=\"${className}\"\n href=\"${item.href}\"\n aria-current=\"${item.active ? 'page' : null}\"\n data-active=\"${item.active ? 'true' : null}\">\n <span class=\"bottom-tab-icon\" aria-hidden=\"true\" ?hidden=${() => !item.iconName}>\n <ore-icon name=\"${item.iconName}\" size=\"18\" stroke-width=\"2\"></ore-icon>\n </span>\n <span class=\"bottom-tab-label\">${item.label}</span>\n </a>\n `;\n }\n\n return html`\n <button\n class=\"${className}\"\n type=\"button\"\n ?disabled=${item.disabled}\n aria-current=\"${item.active ? 'page' : null}\"\n data-active=\"${item.active ? 'true' : null}\"\n @click=${() => item.source.click()}>\n <span class=\"bottom-tab-icon\" aria-hidden=\"true\" ?hidden=${() => !item.iconName}>\n <ore-icon name=\"${item.iconName}\" size=\"18\" stroke-width=\"2\"></ore-icon>\n </span>\n <span class=\"bottom-tab-label\">${item.label}</span>\n </button>\n `;\n })}\n </div>\n `;\n },\n styles: [coarsePointerMixin, reducedMotionMixin, sidebarStyles],\n});\n\n// ─── ore-sidebar-group styles ────────────────────────────────────────────────\n\n/** Sidebar group properties */\nexport type OreSidebarGroupProps = {\n /** Whether this group can be collapsed */\n collapsible?: boolean;\n /** Initial open state in uncontrolled mode */\n 'default-open'?: boolean;\n /** Accessible label for the group */\n label?: string;\n /** Controlled open state */\n open?: boolean;\n};\n\n/**\n * `ore-sidebar-group` — A labelled section within `ore-sidebar`.\n *\n * @element ore-sidebar-group\n *\n * @attr {string} label - Group label text\n * @attr {boolean} collapsible - Whether this group can be toggled open/closed\n * @attr {boolean} open - Controlled expanded state\n * @attr {boolean} default-open - Initial expanded state in uncontrolled mode\n *\n * @fires open-change - Fired when the group open state changes (collapsible groups only). detail: { open: boolean }\n *\n * @slot - Navigation items (`ore-sidebar-item`)\n * @slot icon - Icon displayed before the label\n *\n * @example\n * ```html\n * <ore-sidebar-group label=\"Main\" collapsible open>\n * <ore-sidebar-item href=\"/home\">Home</ore-sidebar-item>\n * </ore-sidebar-group>\n * ```\n */\nexport const SIDEBAR_GROUP_TAG = 'ore-sidebar-group' as const;\ndefine<OreSidebarGroupProps>(SIDEBAR_GROUP_TAG, {\n props: {\n collapsible: prop.bool(false),\n 'default-open': prop.bool(true),\n label: prop.string(),\n open: {\n default: undefined as boolean | undefined,\n parse: (value: string | null) => (value == null ? undefined : value === '' || value === 'true'),\n reflect: false,\n },\n },\n setup(props) {\n const slots = useSlots();\n\n const hasIcon = () => slots.has('icon').value;\n const sidebarCtx = inject(SIDEBAR_CTX);\n\n bind({\n attr: {\n 'sidebar-bottom-nav': () =>\n sidebarCtx?.mode.value === 'bottom-nav' && !sidebarCtx?.mobileOpen.value ? true : undefined,\n 'sidebar-collapsed': () => (sidebarCtx?.collapsed.value ? true : undefined),\n },\n });\n\n const isControlled = () => props.open.value !== undefined;\n const openState = signal(props['default-open'].value);\n const isOpen = computed(() => {\n if (!props.collapsible.value) return true;\n\n if (isControlled()) return props.open.value ?? false;\n\n return openState.value;\n });\n\n watch(props.open, (value) => {\n if (value === undefined) return;\n\n openState.value = value;\n });\n\n bind({\n attr: {\n open: () => (isOpen.value ? true : undefined),\n },\n });\n\n return html`\n <details class=\"group\" part=\"group\" ?open=${isOpen}>\n <summary\n class=\"group-header\"\n part=\"group-header\"\n aria-expanded=\"${() => (props.collapsible.value ? String(props.open.value) : null)}\"\n @click=${(e: MouseEvent) => {\n if (!props.collapsible.value) {\n e.preventDefault();\n }\n }}>\n <span class=\"group-icon\" part=\"group-icon\" ?hidden=${() => !hasIcon()} aria-hidden=\"true\">\n <slot name=\"icon\"></slot>\n </span>\n <span class=\"group-label\" part=\"group-label\">${props.label}</span>\n <span class=\"chevron\" ?hidden=${() => !props.collapsible.value} aria-hidden=\"true\">\n <ore-icon name=\"chevron-right\" size=\"12\" stroke-width=\"2\" aria-hidden=\"true\"></ore-icon>\n </span>\n </summary>\n <div class=\"group-items\" part=\"group-items\" role=\"list\">\n <slot></slot>\n </div>\n </details>\n `;\n },\n styles: [reducedMotionMixin, groupStyles],\n});\n\n// ─── ore-sidebar-item styles ─────────────────────────────────────────────────\n\n/** Sidebar item properties */\nexport type OreSidebarItemProps = {\n /** Whether this item represents the current page/section */\n active?: boolean;\n /** Whether this item is disabled */\n disabled?: boolean;\n /** Navigation href — renders an `<a>` when set, otherwise a `<button>` */\n href?: string;\n /**\n * Relationship of the linked URL (`rel` attribute on the inner `<a>`).\n * Only applies when `href` is set.\n */\n rel?: string;\n /**\n * Browsing context for the link (`target` attribute on the inner `<a>`).\n * Only applies when `href` is set.\n */\n target?: string;\n};\n\n/**\n * `ore-sidebar-item` — An individual navigation item in a `ore-sidebar`.\n *\n * Renders as an `<a>` when `href` is provided, otherwise as a `<button>`.\n * Marks the active page via `aria-current=\"page\"` when the `active` attribute is set.\n *\n * @element ore-sidebar-item\n *\n * @attr {string} href - Link URL; renders an anchor when set\n * @attr {boolean} active - Marks the item as the current page\n * @attr {boolean} disabled - Disables the item\n * @attr {string} rel - Anchor `rel` attribute (links only)\n * @attr {string} target - Anchor `target` attribute (links only)\n *\n * @slot - Label text\n * @slot icon - Leading icon\n * @slot end - Trailing content (badge, shortcut, arrow, etc.)\n *\n * @cssprop --sidebar-item-color - Default text color\n * @cssprop --sidebar-item-hover-bg - Hover background\n * @cssprop --sidebar-item-hover-color - Hover text color\n * @cssprop --sidebar-item-active-bg - Active background\n * @cssprop --sidebar-item-active-color - Active text color\n * @cssprop --sidebar-item-indicator - Active indicator bar color\n *\n * @part item - The inner anchor or button element\n * @part item-icon - The icon wrapper\n * @part item-label - The label wrapper\n * @part item-end - The trailing content wrapper\n *\n * @example\n * ```html\n * <ore-sidebar-item href=\"/dashboard\" active>\n * <span slot=\"icon\">🏠</span>\n * Dashboard\n * </ore-sidebar-item>\n *\n * <ore-sidebar-item href=\"/users\">\n * <span slot=\"icon\">👤</span>\n * Users\n * <ore-badge slot=\"end\" color=\"primary\">3</ore-badge>\n * </ore-sidebar-item>\n * ```\n */\nexport const SIDEBAR_ITEM_TAG = 'ore-sidebar-item' as const;\ndefine<OreSidebarItemProps>(SIDEBAR_ITEM_TAG, {\n props: {\n active: prop.bool(false),\n disabled: prop.bool(false),\n href: prop.string(),\n rel: prop.string(),\n target: prop.string(),\n },\n setup(props) {\n const slots = useSlots();\n\n const hasIcon = () => slots.has('icon').value;\n const hasEnd = () => slots.has('end').value;\n const sidebarCtx = inject(SIDEBAR_CTX);\n\n bind({\n attr: {\n 'sidebar-bottom-nav': () =>\n sidebarCtx?.mode.value === 'bottom-nav' && !sidebarCtx?.mobileOpen.value ? true : undefined,\n 'sidebar-collapsed': () => (sidebarCtx?.collapsed.value ? true : undefined),\n },\n });\n\n const isLink = () => !!props.href.value && !props.disabled.value;\n\n // Prevent reverse tabnapping: auto-inject noopener + noreferrer for _blank links.\n const effectiveRel = computed(() => computeSafeRel(props.rel.value, props.target.value));\n\n const renderItemContent = () => html`\n <span class=\"item-icon\" part=\"item-icon\" ?hidden=${() => !hasIcon()} aria-hidden=\"true\">\n <slot name=\"icon\"></slot>\n </span>\n <span class=\"item-label\" part=\"item-label\"><slot></slot></span>\n <span class=\"item-end\" part=\"item-end\" ?hidden=${() => !hasEnd()}>\n <slot name=\"end\"></slot>\n </span>\n `;\n\n return html`\n ${() => {\n if (isLink()) {\n return html`\n <a\n class=\"item\"\n part=\"item\"\n href=\"${props.href}\"\n rel=\"${effectiveRel}\"\n target=\"${props.target}\"\n aria-current=\"${() => (props.active.value ? 'page' : null)}\">\n ${renderItemContent()}\n </a>\n `;\n }\n\n if (props.disabled.value) {\n return html`\n <div\n class=\"item\"\n part=\"item\"\n aria-disabled=\"true\"\n tabindex=\"-1\"\n aria-current=\"${() => (props.active.value ? 'page' : null)}\">\n ${renderItemContent()}\n </div>\n `;\n }\n\n return html`\n <button\n class=\"item\"\n part=\"item\"\n type=\"button\"\n ?disabled=\"${props.disabled}\"\n aria-current=\"${() => (props.active.value ? 'page' : null)}\">\n ${renderItemContent()}\n </button>\n `;\n }}\n `;\n },\n styles: [coarsePointerMixin, itemStyles],\n});\n"],"mappings":"4YAwCA,IAAM,EAAmB,GAAkD,CACzE,IAAM,EAAQ,OAAO,GAAS,EAAE,CAAC,CAAC,KAAK,EAEvC,GAAI,CAAC,EAAO,OAEZ,IAAM,EAAQ,2CAA2C,KAAK,CAAK,EAEnE,GAAI,CAAC,EAAO,OAEZ,IAAM,EAAS,OAAO,WAAW,EAAM,EAAE,EAEzC,OAAO,OAAO,SAAS,CAAM,EAAI,EAAS,IAAA,EAC5C,EAEM,EAA2B,GAAwC,CACvE,IAAI,EAAY,EAAG,cAEnB,KAAO,GAAW,QAAQ,YAAY,IAAM,iBAC1C,EAAY,EAAU,cAGxB,OAAO,CACT,EAEM,EAAsB,GAA4B,CACtD,IAAM,EAAc,EAAwB,CAAE,CAAC,EAAE,aAAe,EAIhE,OAFI,EAAc,EAAU,EAErB,EAAG,WACZ,EAWa,GAAA,EAAc,EAAA,cAAA,CAA8B,gBAAgB,EAgH5D,EAAc,eAC3B,EAAA,EAAA,OAAA,CAAwB,EAAa,CACnC,MAAO,CACL,gBAAiB,EA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,OAAQ,EAAA,KAAK,OAAO,CACtB,EACA,MAAM,EAAO,CACX,IAAM,GAAA,EAAQ,EAAA,SAAA,CAAS,EAEjB,MAAgB,EAAM,IAAI,MAAM,CAAC,CAAC,MAClC,MAAe,EAAM,IAAI,KAAK,CAAC,CAAC,MAChC,GAAA,EAAa,EAAA,OAAA,CAAO,CAAW,GAErC,EAAA,EAAA,KAAA,CAAK,CACH,KAAM,CACJ,yBACE,GAAY,KAAK,QAAU,cAAgB,CAAC,GAAY,WAAW,OAAe,IAAA,GACpF,wBAA4B,GAAY,UAAU,MAAQ,GAAO,IAAA,EACnE,CACF,CAAC,EAED,IAAM,MAAe,CAAC,CAAC,EAAM,KAAK,OAAS,CAAC,EAAM,SAAS,MAGrD,GAAA,EAAe,EAAA,SAAA,KAAe,EAAA,eAAe,EAAM,IAAI,MAAO,EAAM,OAAO,KAAK,CAAC,EAEjF,MAA0B,EAAA,IAAI;6DACuB,CAAC,EAAQ,EAAE;;;;2DAIb,CAAC,EAAO,EAAE;;;MAKnE,MAAO,GAAA,IAAI;YAEH,EAAO,EACF,EAAA,IAAI;;;;sBAIC,EAAM,KAAK;qBACZ,EAAa;wBACV,EAAM,OAAO;kCACA,EAAM,OAAO,MAAQ,OAAS,KAAM;gBACzD,EAAkB,EAAE;;YAKxB,EAAM,SAAS,MACV,EAAA,IAAI;;;;;;kCAMgB,EAAM,OAAO,MAAQ,OAAS,KAAM;gBACzD,EAAkB,EAAE;;YAKrB,EAAA,IAAI;;;;;yBAKM,EAAM,SAAS;gCACL,EAAM,OAAO,MAAQ,OAAS,KAAM;cACzD,EAAkB,EAAE;;UAG1B;KAEN,EACA,OAAQ,CAAC,EAAA,mBAAoB,EAAA,OAAU,CACzC,CAAC"}
|
package/dist/sidebar.js
CHANGED
|
@@ -3,40 +3,41 @@ import { computeSafeRel as n } from "./utils/link.js";
|
|
|
3
3
|
import r from "./layout/sidebar/sidebar.css.js";
|
|
4
4
|
import i from "./layout/sidebar/sidebar-group.css.js";
|
|
5
5
|
import a from "./layout/sidebar/sidebar-item.css.js";
|
|
6
|
-
import { bind as o, createContext as s, define as c, getHost as l, html as u, inject as d,
|
|
6
|
+
import { bind as o, createContext as s, define as c, getHost as l, html as u, inject as d, onCleanup as f, onMounted as p, prop as m, provide as h, useEmit as g, useSlots as _ } from "@vielzeug/ore";
|
|
7
7
|
import { computed as v, signal as y, watch as b } from "@vielzeug/ripple";
|
|
8
|
+
import { SentinelUnavailableError as x, createElementSize as S, createMediaQuery as C } from "@vielzeug/sentinel";
|
|
8
9
|
//#region src/layout/sidebar/sidebar.ts
|
|
9
|
-
var
|
|
10
|
+
var w = (e) => {
|
|
10
11
|
let t = String(e ?? "").trim();
|
|
11
12
|
if (!t) return;
|
|
12
13
|
let n = /max-width\s*:\s*([0-9]+(?:\.[0-9]+)?)px/i.exec(t);
|
|
13
14
|
if (!n) return;
|
|
14
15
|
let r = Number.parseFloat(n[1]);
|
|
15
16
|
return Number.isFinite(r) ? r : void 0;
|
|
16
|
-
},
|
|
17
|
+
}, T = (e) => {
|
|
17
18
|
let t = e.parentElement;
|
|
18
19
|
for (; t?.tagName.toLowerCase() === "ore-grid-item";) t = t.parentElement;
|
|
19
20
|
return t;
|
|
20
|
-
},
|
|
21
|
-
let t =
|
|
21
|
+
}, E = (e) => {
|
|
22
|
+
let t = T(e)?.clientWidth ?? 0;
|
|
22
23
|
return t > 0 ? t : e.offsetWidth;
|
|
23
|
-
},
|
|
24
|
-
c(
|
|
24
|
+
}, D = s("SidebarContext"), O = "ore-sidebar";
|
|
25
|
+
c(O, {
|
|
25
26
|
props: {
|
|
26
|
-
"bottom-nav-at":
|
|
27
|
-
collapsed:
|
|
28
|
-
collapsible:
|
|
29
|
-
"container-breakpoints":
|
|
30
|
-
"default-collapsed":
|
|
31
|
-
label:
|
|
32
|
-
responsive:
|
|
33
|
-
variant:
|
|
27
|
+
"bottom-nav-at": m.string(),
|
|
28
|
+
collapsed: m.bool(!1),
|
|
29
|
+
collapsible: m.bool(!1),
|
|
30
|
+
"container-breakpoints": m.bool(!1),
|
|
31
|
+
"default-collapsed": m.bool(!1),
|
|
32
|
+
label: m.string("Sidebar navigation"),
|
|
33
|
+
responsive: m.string(),
|
|
34
|
+
variant: m.string()
|
|
34
35
|
},
|
|
35
36
|
setup(e) {
|
|
36
|
-
let t = l(), n = g(), r = _(), i = () => r.has("header").value, a = () => r.has("footer").value, s = () => r.has("logo").value, c = y(t.hasAttribute("collapsed")), d = y(c.value ? t.hasAttribute("collapsed") : e["default-collapsed"].value),
|
|
37
|
-
let t = e["container-breakpoints"].value, n = t ?
|
|
38
|
-
|
|
39
|
-
},
|
|
37
|
+
let t = l(), n = g(), r = _(), i = () => r.has("header").value, a = () => r.has("footer").value, s = () => r.has("logo").value, c = y(t.hasAttribute("collapsed")), d = y(c.value ? t.hasAttribute("collapsed") : e["default-collapsed"].value), m = y(!1), O = y(!1), k = y([]), A = y(!1), j = y(!1), M = y(w(e.responsive.value)), N = y(!!String(e.responsive.value ?? "").trim()), P = y(!1), F = y(!1), I = y(w(e["bottom-nav-at"].value)), L = y(!1), R = () => d.value, z = v(() => m.value ? "bottom-nav" : d.value ? "collapsed" : "default"), B = () => {
|
|
38
|
+
let t = e["container-breakpoints"].value, n = t ? j.value : A.value || j.value, r = t ? F.value : P.value || F.value;
|
|
39
|
+
O.value || (m.value = r), !r && !O.value && U(!1, "responsive"), N.value && H(n, "responsive");
|
|
40
|
+
}, V = () => {
|
|
40
41
|
let e = r.elements().value.filter((e) => e instanceof HTMLElement && e.tagName.toLowerCase() === "ore-sidebar-item").map((e, t) => {
|
|
41
42
|
let n = e.querySelector(":scope > [slot=\"icon\"]") ?? e.querySelector("[slot=\"icon\"]"), r = n?.tagName.toLowerCase() === "ore-icon" ? n.getAttribute("name") : null, i = n?.querySelector("ore-icon")?.getAttribute("name") ?? null, a = (e.textContent ?? "").trim();
|
|
42
43
|
return {
|
|
@@ -48,38 +49,38 @@ c(T, {
|
|
|
48
49
|
source: e
|
|
49
50
|
};
|
|
50
51
|
});
|
|
51
|
-
|
|
52
|
+
k.value = e;
|
|
52
53
|
};
|
|
53
|
-
|
|
54
|
-
collapsed: v(() => !
|
|
55
|
-
mobileOpen: v(() =>
|
|
56
|
-
mode:
|
|
54
|
+
h(D, {
|
|
55
|
+
collapsed: v(() => !m.value && d.value),
|
|
56
|
+
mobileOpen: v(() => m.value && O.value),
|
|
57
|
+
mode: z,
|
|
57
58
|
variant: e.variant
|
|
58
59
|
});
|
|
59
|
-
let
|
|
60
|
-
|
|
60
|
+
let H = (e, t) => {
|
|
61
|
+
R() !== e && (c.value || (d.value = e), n("collapsed-change", {
|
|
61
62
|
collapsed: e,
|
|
62
63
|
source: t
|
|
63
64
|
}));
|
|
64
|
-
},
|
|
65
|
+
}, U = (e, t) => {
|
|
65
66
|
let r = !!e;
|
|
66
|
-
if (r && !
|
|
67
|
-
|
|
67
|
+
if (r && !m.value && (m.value = !0), !m.value && !r) {
|
|
68
|
+
O.value &&= !1;
|
|
68
69
|
return;
|
|
69
70
|
}
|
|
70
|
-
|
|
71
|
+
O.value !== r && (O.value = r, r || B(), n("mobile-open-change", {
|
|
71
72
|
open: r,
|
|
72
73
|
source: t
|
|
73
74
|
}));
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
},
|
|
77
|
-
return
|
|
78
|
-
"data-bottom-nav": () =>
|
|
79
|
-
"data-collapsed": () =>
|
|
80
|
-
"data-mobile-open": () =>
|
|
81
|
-
"data-preview-mode": () =>
|
|
82
|
-
} }),
|
|
75
|
+
}, W = () => {
|
|
76
|
+
H(!R(), "toggle");
|
|
77
|
+
}, G = t;
|
|
78
|
+
return G.setCollapsed = (e) => H(!!e, "api"), G.toggle = W, G.openMobile = () => U(!0, "api"), G.closeMobile = () => U(!1, "api"), G.toggleMobile = () => U(!O.value, "toggle"), o({ attr: {
|
|
79
|
+
"data-bottom-nav": () => m.value ? !0 : void 0,
|
|
80
|
+
"data-collapsed": () => R() && !m.value ? !0 : void 0,
|
|
81
|
+
"data-mobile-open": () => m.value && O.value ? !0 : void 0,
|
|
82
|
+
"data-preview-mode": () => L.value ? !0 : void 0
|
|
83
|
+
} }), p(() => {
|
|
83
84
|
t.setAttribute("data-no-transition", "");
|
|
84
85
|
let n = !1, i = () => {
|
|
85
86
|
n || (n = !0, t.removeAttribute("data-no-transition"));
|
|
@@ -94,50 +95,64 @@ c(T, {
|
|
|
94
95
|
}), b(e.responsive, (n) => {
|
|
95
96
|
a?.(), a = void 0;
|
|
96
97
|
let r = String(n ?? "").trim();
|
|
97
|
-
|
|
98
|
-
let i =
|
|
99
|
-
if (
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
98
|
+
N.value = !!r, M.value = w(r), A.value = !1;
|
|
99
|
+
let i = E(t);
|
|
100
|
+
if (j.value = i > 0 && M.value != null && i <= M.value, B(), !(e["container-breakpoints"].value && M.value != null) && r) try {
|
|
101
|
+
let e = C(r), t = (e) => {
|
|
102
|
+
e && (A.value = e.matches, B());
|
|
103
|
+
};
|
|
104
|
+
t(e.value);
|
|
105
|
+
let n = b(e, t);
|
|
106
|
+
a = () => {
|
|
107
|
+
n.dispose(), e.dispose();
|
|
108
|
+
};
|
|
109
|
+
} catch (e) {
|
|
110
|
+
if (!(e instanceof x)) throw e;
|
|
111
|
+
}
|
|
106
112
|
}, { immediate: !0 }), b(e["bottom-nav-at"], (n) => {
|
|
107
113
|
o?.(), o = void 0;
|
|
108
114
|
let r = String(n ?? "").trim();
|
|
109
|
-
|
|
110
|
-
let i =
|
|
111
|
-
if (
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
I.value = w(r), P.value = !1;
|
|
116
|
+
let i = E(t);
|
|
117
|
+
if (F.value = i > 0 && I.value != null && i <= I.value, B(), !(e["container-breakpoints"].value && I.value != null) && r) try {
|
|
118
|
+
let e = C(r), t = (e) => {
|
|
119
|
+
e && (P.value = e.matches, B());
|
|
120
|
+
};
|
|
121
|
+
t(e.value);
|
|
122
|
+
let n = b(e, t);
|
|
123
|
+
o = () => {
|
|
124
|
+
n.dispose(), e.dispose();
|
|
125
|
+
};
|
|
126
|
+
} catch (e) {
|
|
127
|
+
if (!(e instanceof x)) throw e;
|
|
128
|
+
}
|
|
118
129
|
}, { immediate: !0 });
|
|
119
130
|
let u = typeof ResizeObserver == "function" ? (() => {
|
|
120
|
-
let e =
|
|
131
|
+
let e = S(t);
|
|
132
|
+
f(() => e.dispose());
|
|
133
|
+
let n = t.parentElement, r = T(t), a = n ? S(n) : void 0, o = r && r !== n ? S(r) : void 0;
|
|
134
|
+
a && f(() => a.dispose()), o && f(() => o.dispose());
|
|
135
|
+
let s;
|
|
121
136
|
return b(v(() => [
|
|
122
|
-
e.value
|
|
123
|
-
e.value
|
|
124
|
-
a?.value
|
|
125
|
-
a?.value
|
|
126
|
-
o?.value
|
|
127
|
-
o?.value
|
|
137
|
+
e.value?.width,
|
|
138
|
+
e.value?.height,
|
|
139
|
+
a?.value?.width,
|
|
140
|
+
a?.value?.height,
|
|
141
|
+
o?.value?.width,
|
|
142
|
+
o?.value?.height
|
|
128
143
|
]), () => {
|
|
129
144
|
s !== void 0 && cancelAnimationFrame(s), s = requestAnimationFrame(() => {
|
|
130
|
-
let e =
|
|
131
|
-
|
|
145
|
+
let e = T(t), n = E(t), r = j.value, a = F.value, o = e?.clientWidth ?? 0;
|
|
146
|
+
L.value = o > 0 && o < window.innerWidth, j.value = n > 0 && M.value != null && n <= M.value, F.value = n > 0 && I.value != null && n <= I.value, (r !== j.value || a !== F.value) && B(), i();
|
|
132
147
|
});
|
|
133
148
|
});
|
|
134
|
-
})() : void 0,
|
|
149
|
+
})() : void 0, p = (e) => {
|
|
135
150
|
let t = new Set(e);
|
|
136
151
|
for (let [e, n] of s) t.has(e) || (n.disconnect(), s.delete(e));
|
|
137
152
|
for (let t of e) {
|
|
138
153
|
if (s.has(t)) continue;
|
|
139
154
|
let e = new MutationObserver(() => {
|
|
140
|
-
|
|
155
|
+
m.value && V();
|
|
141
156
|
});
|
|
142
157
|
e.observe(t, {
|
|
143
158
|
attributeFilter: [
|
|
@@ -151,7 +166,7 @@ c(T, {
|
|
|
151
166
|
};
|
|
152
167
|
return b(r.elements(), (e) => {
|
|
153
168
|
let t = e.filter((e) => e instanceof HTMLElement && e.tagName.toLowerCase() === "ore-sidebar-item");
|
|
154
|
-
|
|
169
|
+
p(t), V();
|
|
155
170
|
}, { immediate: !0 }), () => {
|
|
156
171
|
l.disconnect(), a?.(), o?.(), u?.dispose();
|
|
157
172
|
for (let e of s.values()) e.disconnect();
|
|
@@ -163,8 +178,8 @@ c(T, {
|
|
|
163
178
|
part="mobile-backdrop"
|
|
164
179
|
type="button"
|
|
165
180
|
aria-label="Close sidebar"
|
|
166
|
-
?hidden=${() => !
|
|
167
|
-
@click=${() =>
|
|
181
|
+
?hidden=${() => !m.value || !O.value}
|
|
182
|
+
@click=${() => U(!1, "toggle")}></button>
|
|
168
183
|
<nav aria-label="${e.label}" part="nav">
|
|
169
184
|
<div class="sidebar-header" part="header" ?hidden=${() => !i() && !e.collapsible.value}>
|
|
170
185
|
<span class="sidebar-logo" ?hidden=${() => !s()}>
|
|
@@ -178,9 +193,9 @@ c(T, {
|
|
|
178
193
|
part="toggle-btn"
|
|
179
194
|
type="button"
|
|
180
195
|
?hidden=${() => !e.collapsible.value}
|
|
181
|
-
aria-label="${() =>
|
|
182
|
-
aria-expanded="${() => !
|
|
183
|
-
@click="${
|
|
196
|
+
aria-label="${() => R() ? "Expand sidebar" : "Collapse sidebar"}"
|
|
197
|
+
aria-expanded="${() => !R()}"
|
|
198
|
+
@click="${W}">
|
|
184
199
|
<span class="toggle-icon" aria-hidden="true">
|
|
185
200
|
<ore-icon name="chevron-left" size="16" stroke-width="2" aria-hidden="true"></ore-icon>
|
|
186
201
|
</span>
|
|
@@ -194,8 +209,8 @@ c(T, {
|
|
|
194
209
|
</div>
|
|
195
210
|
</nav>
|
|
196
211
|
|
|
197
|
-
<div class="bottom-bar" part="bottom-bar" ?hidden=${() => !
|
|
198
|
-
${() =>
|
|
212
|
+
<div class="bottom-bar" part="bottom-bar" ?hidden=${() => !m.value}>
|
|
213
|
+
${() => k.value.map((e) => {
|
|
199
214
|
let t = `bottom-tab${e.active ? " bottom-tab-active" : ""}`;
|
|
200
215
|
return e.href && !e.disabled ? u`
|
|
201
216
|
<a
|
|
@@ -232,12 +247,12 @@ c(T, {
|
|
|
232
247
|
r
|
|
233
248
|
]
|
|
234
249
|
});
|
|
235
|
-
var
|
|
236
|
-
c(
|
|
250
|
+
var k = "ore-sidebar-group";
|
|
251
|
+
c(k, {
|
|
237
252
|
props: {
|
|
238
|
-
collapsible:
|
|
239
|
-
"default-open":
|
|
240
|
-
label:
|
|
253
|
+
collapsible: m.bool(!1),
|
|
254
|
+
"default-open": m.bool(!0),
|
|
255
|
+
label: m.string(),
|
|
241
256
|
open: {
|
|
242
257
|
default: void 0,
|
|
243
258
|
parse: (e) => e == null ? void 0 : e === "" || e === "true",
|
|
@@ -245,7 +260,7 @@ c(E, {
|
|
|
245
260
|
}
|
|
246
261
|
},
|
|
247
262
|
setup(e) {
|
|
248
|
-
let t = _(), n = () => t.has("icon").value, r = d(
|
|
263
|
+
let t = _(), n = () => t.has("icon").value, r = d(D);
|
|
249
264
|
o({ attr: {
|
|
250
265
|
"sidebar-bottom-nav": () => r?.mode.value === "bottom-nav" && !r?.mobileOpen.value || void 0,
|
|
251
266
|
"sidebar-collapsed": () => r?.collapsed.value ? !0 : void 0
|
|
@@ -278,17 +293,17 @@ c(E, {
|
|
|
278
293
|
},
|
|
279
294
|
styles: [t, i]
|
|
280
295
|
});
|
|
281
|
-
var
|
|
282
|
-
c(
|
|
296
|
+
var A = "ore-sidebar-item";
|
|
297
|
+
c(A, {
|
|
283
298
|
props: {
|
|
284
|
-
active:
|
|
285
|
-
disabled:
|
|
286
|
-
href:
|
|
287
|
-
rel:
|
|
288
|
-
target:
|
|
299
|
+
active: m.bool(!1),
|
|
300
|
+
disabled: m.bool(!1),
|
|
301
|
+
href: m.string(),
|
|
302
|
+
rel: m.string(),
|
|
303
|
+
target: m.string()
|
|
289
304
|
},
|
|
290
305
|
setup(e) {
|
|
291
|
-
let t = _(), r = () => t.has("icon").value, i = () => t.has("end").value, a = d(
|
|
306
|
+
let t = _(), r = () => t.has("icon").value, i = () => t.has("end").value, a = d(D);
|
|
292
307
|
o({ attr: {
|
|
293
308
|
"sidebar-bottom-nav": () => a?.mode.value === "bottom-nav" && !a?.mobileOpen.value || void 0,
|
|
294
309
|
"sidebar-collapsed": () => a?.collapsed.value ? !0 : void 0
|
|
@@ -337,6 +352,6 @@ c(D, {
|
|
|
337
352
|
styles: [e, a]
|
|
338
353
|
});
|
|
339
354
|
//#endregion
|
|
340
|
-
export {
|
|
355
|
+
export { D as SIDEBAR_CTX, k as SIDEBAR_GROUP_TAG, A as SIDEBAR_ITEM_TAG, O as SIDEBAR_TAG };
|
|
341
356
|
|
|
342
357
|
//# sourceMappingURL=sidebar.js.map
|