@vielzeug/refine 2.2.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.
Files changed (136) hide show
  1. package/dist/accordion.cjs +1 -1
  2. package/dist/accordion.cjs.map +1 -1
  3. package/dist/accordion.js +2 -2
  4. package/dist/accordion.js.map +1 -1
  5. package/dist/carousel.cjs +25 -24
  6. package/dist/carousel.cjs.map +1 -1
  7. package/dist/carousel.js +125 -135
  8. package/dist/carousel.js.map +1 -1
  9. package/dist/combobox.cjs +14 -14
  10. package/dist/combobox.cjs.map +1 -1
  11. package/dist/combobox.js +88 -98
  12. package/dist/combobox.js.map +1 -1
  13. package/dist/content/carousel/carousel.d.ts.map +1 -1
  14. package/dist/content/list/_list-item-reveal.cjs +1 -1
  15. package/dist/content/list/_list-item-reveal.cjs.map +1 -1
  16. package/dist/content/list/_list-item-reveal.d.ts +3 -3
  17. package/dist/content/list/_list-item-reveal.d.ts.map +1 -1
  18. package/dist/content/list/_list-item-reveal.js +22 -22
  19. package/dist/content/list/_list-item-reveal.js.map +1 -1
  20. package/dist/content/list/list-item.d.ts.map +1 -1
  21. package/dist/core/focus.cjs +1 -1
  22. package/dist/core/focus.cjs.map +1 -1
  23. package/dist/core/focus.d.ts.map +1 -1
  24. package/dist/core/focus.js +21 -20
  25. package/dist/core/focus.js.map +1 -1
  26. package/dist/core/index.d.ts +2 -3
  27. package/dist/core/index.d.ts.map +1 -1
  28. package/dist/core/nav.cjs +1 -1
  29. package/dist/core/nav.cjs.map +1 -1
  30. package/dist/core/nav.d.ts +3 -62
  31. package/dist/core/nav.d.ts.map +1 -1
  32. package/dist/core/nav.js +41 -124
  33. package/dist/core/nav.js.map +1 -1
  34. package/dist/core/option-list.cjs +1 -1
  35. package/dist/core/option-list.cjs.map +1 -1
  36. package/dist/core/option-list.d.ts +5 -5
  37. package/dist/core/option-list.d.ts.map +1 -1
  38. package/dist/core/option-list.js +14 -13
  39. package/dist/core/option-list.js.map +1 -1
  40. package/dist/core/overlay.cjs +1 -1
  41. package/dist/core/overlay.cjs.map +1 -1
  42. package/dist/core/overlay.d.ts +0 -8
  43. package/dist/core/overlay.d.ts.map +1 -1
  44. package/dist/core/overlay.js +1 -3
  45. package/dist/core/overlay.js.map +1 -1
  46. package/dist/custom-elements.json +3397 -3452
  47. package/dist/drawer.cjs +6 -6
  48. package/dist/drawer.cjs.map +1 -1
  49. package/dist/drawer.js +65 -75
  50. package/dist/drawer.js.map +1 -1
  51. package/dist/feedback/skeleton/skeleton.d.ts.map +1 -1
  52. package/dist/feedback/toast/toast.d.ts.map +1 -1
  53. package/dist/grid.cjs +2 -2
  54. package/dist/grid.cjs.map +1 -1
  55. package/dist/grid.js +42 -41
  56. package/dist/grid.js.map +1 -1
  57. package/dist/layout/grid/grid.d.ts.map +1 -1
  58. package/dist/layout/navbar/navbar.d.ts.map +1 -1
  59. package/dist/layout/sidebar/sidebar.d.ts.map +1 -1
  60. package/dist/list-item.cjs +2 -6
  61. package/dist/list-item.cjs.map +1 -1
  62. package/dist/list-item.js +40 -39
  63. package/dist/list-item.js.map +1 -1
  64. package/dist/list.cjs +1 -1
  65. package/dist/list.cjs.map +1 -1
  66. package/dist/list.js +2 -2
  67. package/dist/list.js.map +1 -1
  68. package/dist/menu.cjs +5 -5
  69. package/dist/menu.cjs.map +1 -1
  70. package/dist/menu.js +59 -59
  71. package/dist/menu.js.map +1 -1
  72. package/dist/navbar.cjs +9 -9
  73. package/dist/navbar.cjs.map +1 -1
  74. package/dist/navbar.js +124 -116
  75. package/dist/navbar.js.map +1 -1
  76. package/dist/otp-input.cjs +1 -1
  77. package/dist/otp-input.cjs.map +1 -1
  78. package/dist/otp-input.js +2 -2
  79. package/dist/otp-input.js.map +1 -1
  80. package/dist/overlay/drawer/drawer.d.ts.map +1 -1
  81. package/dist/overlay/menu/menu.d.ts.map +1 -1
  82. package/dist/radio-group.cjs +1 -1
  83. package/dist/radio-group.cjs.map +1 -1
  84. package/dist/radio-group.js +2 -3
  85. package/dist/radio-group.js.map +1 -1
  86. package/dist/radio.cjs +1 -1
  87. package/dist/radio.cjs.map +1 -1
  88. package/dist/radio.js +12 -11
  89. package/dist/radio.js.map +1 -1
  90. package/dist/rating.cjs +1 -1
  91. package/dist/rating.cjs.map +1 -1
  92. package/dist/rating.js +1 -1
  93. package/dist/rating.js.map +1 -1
  94. package/dist/refine.cjs +188 -195
  95. package/dist/refine.cjs.map +1 -1
  96. package/dist/refine.iife.js +212 -219
  97. package/dist/refine.iife.js.map +1 -1
  98. package/dist/refine.js +392 -399
  99. package/dist/refine.js.map +1 -1
  100. package/dist/select.cjs +1 -1
  101. package/dist/select.cjs.map +1 -1
  102. package/dist/select.js +1 -0
  103. package/dist/select.js.map +1 -1
  104. package/dist/sidebar.cjs +16 -16
  105. package/dist/sidebar.cjs.map +1 -1
  106. package/dist/sidebar.js +106 -91
  107. package/dist/sidebar.js.map +1 -1
  108. package/dist/skeleton.cjs +3 -3
  109. package/dist/skeleton.cjs.map +1 -1
  110. package/dist/skeleton.js +8 -7
  111. package/dist/skeleton.js.map +1 -1
  112. package/dist/stepper.cjs +1 -1
  113. package/dist/stepper.cjs.map +1 -1
  114. package/dist/stepper.js +3 -3
  115. package/dist/stepper.js.map +1 -1
  116. package/dist/tabs.cjs +1 -1
  117. package/dist/tabs.cjs.map +1 -1
  118. package/dist/tabs.js +4 -5
  119. package/dist/tabs.js.map +1 -1
  120. package/dist/toast.cjs +13 -17
  121. package/dist/toast.cjs.map +1 -1
  122. package/dist/toast.js +86 -85
  123. package/dist/toast.js.map +1 -1
  124. package/package.json +9 -6
  125. package/dist/core/swipe.cjs +0 -2
  126. package/dist/core/swipe.cjs.map +0 -1
  127. package/dist/core/swipe.d.ts +0 -40
  128. package/dist/core/swipe.d.ts.map +0 -1
  129. package/dist/core/swipe.js +0 -63
  130. package/dist/core/swipe.js.map +0 -1
  131. package/dist/core/typeahead.cjs +0 -2
  132. package/dist/core/typeahead.cjs.map +0 -1
  133. package/dist/core/typeahead.d.ts +0 -53
  134. package/dist/core/typeahead.d.ts.map +0 -1
  135. package/dist/core/typeahead.js +0 -23
  136. package/dist/core/typeahead.js.map +0 -1
package/dist/grid.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"grid.cjs","names":[],"sources":["../src/layout/grid/grid.ts"],"sourcesContent":["import { define, getHost, html, onMounted, prop, resizeObserver, watchEffect } from '@vielzeug/ore';\n\nimport styles from './grid.css?inline';\n\nconst BREAKPOINTS: ['cols2xl' | 'colsXl' | 'colsLg' | 'colsMd' | 'colsSm', string][] = [\n ['cols2xl', '--size-screen-2xl'],\n ['colsXl', '--size-screen-xl'],\n ['colsLg', '--size-screen-lg'],\n ['colsMd', '--size-screen-md'],\n ['colsSm', '--size-screen-sm'],\n];\n\nconst AREAS_BREAKPOINTS: ['areas2xl' | 'areasXl' | 'areasLg' | 'areasMd' | 'areasSm', string][] = [\n ['areas2xl', '--size-screen-2xl'],\n ['areasXl', '--size-screen-xl'],\n ['areasLg', '--size-screen-lg'],\n ['areasMd', '--size-screen-md'],\n ['areasSm', '--size-screen-sm'],\n];\n\nconst resolveBp = (host: HTMLElement, varName: string, fallback: number): number => {\n const raw = getComputedStyle(host).getPropertyValue(varName).trim();\n const parsed = Number.parseFloat(raw);\n\n return Number.isFinite(parsed) ? parsed : fallback;\n};\n\nconst BP_FALLBACKS: Record<string, number> = {\n '--size-screen-2xl': 1536,\n '--size-screen-lg': 1024,\n '--size-screen-md': 768,\n '--size-screen-sm': 640,\n '--size-screen-xl': 1280,\n};\n\ntype ColCount = '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | 'auto';\n\n/** Grid component properties */\nexport type OreGridProps = {\n /** Align items vertically */\n align?: 'start' | 'center' | 'end' | 'stretch' | 'baseline';\n /** CSS grid-template-areas value */\n areas?: string;\n /** grid-template-areas at 2xl breakpoint (≥1536px) */\n areas2xl?: string;\n /** grid-template-areas at lg breakpoint (≥1024px) */\n areasLg?: string;\n /** grid-template-areas at md breakpoint (≥768px) */\n areasMd?: string;\n /** grid-template-areas at sm breakpoint (≥640px) */\n areasSm?: string;\n /** grid-template-areas at xl breakpoint (≥1280px) */\n areasXl?: string;\n /** Number of columns: '1'-'12' | 'auto' */\n cols?: ColCount;\n /** Columns at 2xl breakpoint (≥1536px) */\n cols2xl?: ColCount;\n /** Columns at lg breakpoint (≥1024px) */\n colsLg?: ColCount;\n /** Columns at md breakpoint (≥768px) */\n colsMd?: ColCount;\n /** Columns at sm breakpoint (≥640px) */\n colsSm?: ColCount;\n /** Columns at xl breakpoint (≥1280px) */\n colsXl?: ColCount;\n /** Grid auto flow direction */\n flow?: 'row' | 'column' | 'row-dense' | 'column-dense';\n /** Stretch the grid to fill its container's full width */\n fullwidth?: boolean;\n /** Gap between items */\n gap?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** Justify items horizontally */\n justify?: 'start' | 'center' | 'end' | 'stretch';\n /** Minimum column width for responsive mode (default: 250px) */\n minColWidth?: string;\n /** Use auto-fit responsive columns */\n responsive?: boolean;\n /** Number of rows: '1'-'12' | 'auto' */\n rows?: '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | 'auto';\n};\n\n/**\n * ore-grid — Flexible grid layout with responsive column control.\n *\n * Columns are computed in JS and applied as `--_cols` inline, so they respond\n * to the element's own width via ResizeObserver. CSS custom properties\n * `--grid-cols`, `--grid-rows`, `--grid-gap`, `--grid-row-gap`, `--grid-col-gap`\n * are honoured as fallbacks when no attribute is set.\n *\n * @element ore-grid\n *\n * @attr {string} cols - Column count: '1'–'12' | 'auto'\n * @attr {string} cols-sm - Columns when width ≥ 640px\n * @attr {string} cols-md - Columns when width ≥ 768px\n * @attr {string} cols-lg - Columns when width ≥ 1024px\n * @attr {string} cols-xl - Columns when width ≥ 1280px\n * @attr {string} cols-2xl - Columns when width ≥ 1536px\n * @attr {string} rows - Row count: '1'–'12' | 'auto'\n * @attr {string} gap - Gap token: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n * @attr {string} align - align-items: 'start' | 'center' | 'end' | 'stretch' | 'baseline'\n * @attr {string} justify - justify-items: 'start' | 'center' | 'end' | 'stretch'\n * @attr {string} flow - grid-auto-flow: 'row' | 'column' | 'row-dense' | 'column-dense'\n * @attr {boolean} responsive - Enables auto-fit columns without a fixed count\n * @attr {string} min-col-width - Min column width for responsive mode (default: 250px)\n * @attr {boolean} fullwidth - Stretch the grid to fill its container's full width\n * @attr {string} areas - CSS grid-template-areas value (e.g. \"'header header' 'nav main'\")\n * @attr {string} areas-sm - grid-template-areas when width ≥ 640px\n * @attr {string} areas-md - grid-template-areas when width ≥ 768px\n * @attr {string} areas-lg - grid-template-areas when width ≥ 1024px\n * @attr {string} areas-xl - grid-template-areas when width ≥ 1280px\n * @attr {string} areas-2xl - grid-template-areas when width ≥ 1536px\n *\n * @slot - Grid items\n *\n * @cssprop --grid-cols - Fallback column template (used when no cols attr is set)\n * @cssprop --grid-rows - Fallback row template\n * @cssprop --grid-gap - Fallback gap\n * @cssprop --grid-row-gap - Fallback row gap\n * @cssprop --grid-col-gap - Fallback column gap\n *\n * @example\n * <ore-grid cols=\"1\" cols-sm=\"2\" cols-lg=\"4\" gap=\"md\">\n * <div>Item</div>\n * </ore-grid>\n *\n * @example\n * <!-- Responsive auto-fit -->\n * <ore-grid responsive min-col-width=\"200px\" gap=\"sm\">\n * <div>Card</div>\n * </ore-grid>\n *\n * @example\n * <!-- Named grid areas -->\n * <ore-grid cols=\"2\" rows=\"2\" areas=\"'header header' 'nav main'\">\n * <header style=\"grid-area: header\">Header</header>\n * <nav style=\"grid-area: nav\">Nav</nav>\n * <main style=\"grid-area: main\">Main</main>\n * </ore-grid>\n */\nexport const GRID_TAG = 'ore-grid' as const;\ndefine<OreGridProps>(GRID_TAG, {\n props: {\n align: prop.string<'start' | 'center' | 'end' | 'stretch' | 'baseline'>(),\n areas: prop.string(),\n areas2xl: prop.string(),\n areasLg: prop.string(),\n areasMd: prop.string(),\n areasSm: prop.string(),\n areasXl: prop.string(),\n cols: prop.string<ColCount>(),\n cols2xl: prop.string<ColCount>(),\n colsLg: prop.string<ColCount>(),\n colsMd: prop.string<ColCount>(),\n colsSm: prop.string<ColCount>(),\n colsXl: prop.string<ColCount>(),\n flow: prop.string<'row' | 'column' | 'row-dense' | 'column-dense'>(),\n fullwidth: prop.bool(false),\n gap: prop.string<'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'>(),\n justify: prop.string<'start' | 'center' | 'end' | 'stretch'>(),\n minColWidth: prop.string(),\n responsive: prop.bool(false),\n rows: prop.string<'1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | 'auto'>(),\n },\n\n setup(props) {\n const el = getHost();\n const watch = watchEffect;\n\n const computeCols = (activeCols: string | undefined, responsive: boolean, minW: string): string | null => {\n if (activeCols === 'auto' || (!activeCols && responsive)) {\n return `repeat(auto-fit, minmax(${minW || '250px'}, 1fr))`;\n }\n\n return activeCols ? `repeat(${activeCols}, 1fr)` : null;\n };\n const updateCols = () => {\n const w = el.offsetWidth;\n const responsive = Boolean(props.responsive.value);\n const minW = props.minColWidth.value ?? '';\n let activeCols: string | undefined;\n\n for (const [key, cssVar] of BREAKPOINTS) {\n if (w >= resolveBp(el, cssVar, BP_FALLBACKS[cssVar]) && props[key].value) {\n activeCols = props[key].value!;\n break;\n }\n }\n activeCols ||= props.cols.value || undefined;\n\n const colsValue = computeCols(activeCols, responsive, minW);\n\n if (colsValue) {\n el.style.setProperty('--_cols', colsValue);\n } else {\n el.style.removeProperty('--_cols');\n }\n };\n\n // Re-run cols whenever any responsive prop changes\n watch(() => {\n void [\n props.cols.value,\n props.colsSm.value,\n props.colsMd.value,\n props.colsLg.value,\n props.colsXl.value,\n props.cols2xl.value,\n props.responsive.value,\n props.minColWidth.value,\n ];\n updateCols();\n });\n\n const updateAreas = () => {\n const w = el.offsetWidth;\n let active = '';\n\n for (const [key, cssVar] of AREAS_BREAKPOINTS) {\n if (w >= resolveBp(el, cssVar, BP_FALLBACKS[cssVar]) && props[key].value) {\n active = props[key].value!;\n break;\n }\n }\n active ||= props.areas.value || '';\n\n if (active) {\n el.style.setProperty('grid-template-areas', active);\n } else {\n el.style.removeProperty('grid-template-areas');\n }\n };\n\n // Rows\n watch(() => {\n const rows = props.rows.value;\n\n if (rows && rows !== 'auto') {\n el.style.setProperty('--_rows', `repeat(${rows}, 1fr)`);\n } else {\n el.style.removeProperty('--_rows');\n }\n });\n // Grid template areas (responsive)\n watch(() => {\n void [\n props.areas.value,\n props.areasSm.value,\n props.areasMd.value,\n props.areasLg.value,\n props.areasXl.value,\n props.areas2xl.value,\n ];\n updateAreas();\n });\n\n // Also, update on element resize (drives breakpoint switching)\n onMounted(() => {\n const size = resizeObserver(el);\n\n watch(() => {\n void size.value;\n updateCols();\n updateAreas();\n });\n });\n\n return html`\n <slot></slot>\n `;\n },\n\n styles: [styles],\n});\n"],"mappings":"gJAIA,IAAM,EAAiF,CACrF,CAAC,UAAW,mBAAmB,EAC/B,CAAC,SAAU,kBAAkB,EAC7B,CAAC,SAAU,kBAAkB,EAC7B,CAAC,SAAU,kBAAkB,EAC7B,CAAC,SAAU,kBAAkB,CAC/B,EAEM,EAA4F,CAChG,CAAC,WAAY,mBAAmB,EAChC,CAAC,UAAW,kBAAkB,EAC9B,CAAC,UAAW,kBAAkB,EAC9B,CAAC,UAAW,kBAAkB,EAC9B,CAAC,UAAW,kBAAkB,CAChC,EAEM,GAAa,EAAmB,EAAiB,IAA6B,CAClF,IAAM,EAAM,iBAAiB,CAAI,CAAC,CAAC,iBAAiB,CAAO,CAAC,CAAC,KAAK,EAC5D,EAAS,OAAO,WAAW,CAAG,EAEpC,OAAO,OAAO,SAAS,CAAM,EAAI,EAAS,CAC5C,EAEM,EAAuC,CAC3C,oBAAqB,KACrB,mBAAoB,KACpB,mBAAoB,IACpB,mBAAo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nC,IAAM,EAAY,EAAY,EAAY,EAAY,CAAI,EAEtD,EACF,EAAG,MAAM,YAAY,UAAW,CAAS,EAEzC,EAAG,MAAM,eAAe,SAAS,CAErC,EAGA,MAAY,CACV,EACQ,KAAK,MACX,EAAM,OAAO,MACb,EAAM,OAAO,MACb,EAAM,OAAO,MACb,EAAM,OAAO,MACb,EAAM,QAAQ,MACd,EAAM,WAAW,MACjB,EAAM,YAAY,MAEpB,EAAW,CACb,CAAC,EAED,IAAM,MAAoB,CACxB,IAAM,EAAI,EAAG,YACT,EAAS,GAEb,IAAK,GAAM,CAAC,EAAK,KAAW,EAC1B,GAAI,GAAK,EAAU,EAAI,EAAQ,EAAa,EAAO,GAAK,EAAM,EAAI,CAAC,MAAO,CACxE,EAAS,EAAM,EAAI,CAAC,MACpB,KACF,CAEF,IAAW,EAAM,MAAM,OAAS,GAE5B,EACF,EAAG,MAAM,YAAY,sBAAuB,CAAM,EAElD,EAAG,MAAM,eAAe,qBAAqB,CAEjD,EAoCA,OAjCA,MAAY,CACV,IAAM,EAAO,EAAM,KAAK,MAEpB,GAAQ,IAAS,OACnB,EAAG,MAAM,YAAY,UAAW,UAAU,EAAK,OAAO,EAEtD,EAAG,MAAM,eAAe,SAAS,CAErC,CAAC,EAED,MAAY,CACV,EACQ,MAAM,MACZ,EAAM,QAAQ,MACd,EAAM,QAAQ,MACd,EAAM,QAAQ,MACd,EAAM,QAAQ,MACd,EAAM,SAAS,MAEjB,EAAY,CACd,CAAC,GAGD,EAAA,EAAA,UAAA,KAAgB,CACd,IAAM,GAAA,EAAO,EAAA,eAAA,CAAe,CAAE,EAE9B,MAAY,CACV,EAAU,MACV,EAAW,EACX,EAAY,CACd,CAAC,CACH,CAAC,EAEM,EAAA,IAAI;;KAGb,EAEA,OAAQ,CAAC,EAAA,OAAM,CACjB,CAAC"}
1
+ {"version":3,"file":"grid.cjs","names":[],"sources":["../src/layout/grid/grid.ts"],"sourcesContent":["import { define, getHost, html, onCleanup, onMounted, prop, watchEffect } from '@vielzeug/ore';\nimport { createElementSize } from '@vielzeug/sentinel';\n\nimport styles from './grid.css?inline';\n\nconst BREAKPOINTS: ['cols2xl' | 'colsXl' | 'colsLg' | 'colsMd' | 'colsSm', string][] = [\n ['cols2xl', '--size-screen-2xl'],\n ['colsXl', '--size-screen-xl'],\n ['colsLg', '--size-screen-lg'],\n ['colsMd', '--size-screen-md'],\n ['colsSm', '--size-screen-sm'],\n];\n\nconst AREAS_BREAKPOINTS: ['areas2xl' | 'areasXl' | 'areasLg' | 'areasMd' | 'areasSm', string][] = [\n ['areas2xl', '--size-screen-2xl'],\n ['areasXl', '--size-screen-xl'],\n ['areasLg', '--size-screen-lg'],\n ['areasMd', '--size-screen-md'],\n ['areasSm', '--size-screen-sm'],\n];\n\nconst resolveBp = (host: HTMLElement, varName: string, fallback: number): number => {\n const raw = getComputedStyle(host).getPropertyValue(varName).trim();\n const parsed = Number.parseFloat(raw);\n\n return Number.isFinite(parsed) ? parsed : fallback;\n};\n\nconst BP_FALLBACKS: Record<string, number> = {\n '--size-screen-2xl': 1536,\n '--size-screen-lg': 1024,\n '--size-screen-md': 768,\n '--size-screen-sm': 640,\n '--size-screen-xl': 1280,\n};\n\ntype ColCount = '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | 'auto';\n\n/** Grid component properties */\nexport type OreGridProps = {\n /** Align items vertically */\n align?: 'start' | 'center' | 'end' | 'stretch' | 'baseline';\n /** CSS grid-template-areas value */\n areas?: string;\n /** grid-template-areas at 2xl breakpoint (≥1536px) */\n areas2xl?: string;\n /** grid-template-areas at lg breakpoint (≥1024px) */\n areasLg?: string;\n /** grid-template-areas at md breakpoint (≥768px) */\n areasMd?: string;\n /** grid-template-areas at sm breakpoint (≥640px) */\n areasSm?: string;\n /** grid-template-areas at xl breakpoint (≥1280px) */\n areasXl?: string;\n /** Number of columns: '1'-'12' | 'auto' */\n cols?: ColCount;\n /** Columns at 2xl breakpoint (≥1536px) */\n cols2xl?: ColCount;\n /** Columns at lg breakpoint (≥1024px) */\n colsLg?: ColCount;\n /** Columns at md breakpoint (≥768px) */\n colsMd?: ColCount;\n /** Columns at sm breakpoint (≥640px) */\n colsSm?: ColCount;\n /** Columns at xl breakpoint (≥1280px) */\n colsXl?: ColCount;\n /** Grid auto flow direction */\n flow?: 'row' | 'column' | 'row-dense' | 'column-dense';\n /** Stretch the grid to fill its container's full width */\n fullwidth?: boolean;\n /** Gap between items */\n gap?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** Justify items horizontally */\n justify?: 'start' | 'center' | 'end' | 'stretch';\n /** Minimum column width for responsive mode (default: 250px) */\n minColWidth?: string;\n /** Use auto-fit responsive columns */\n responsive?: boolean;\n /** Number of rows: '1'-'12' | 'auto' */\n rows?: '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | 'auto';\n};\n\n/**\n * ore-grid — Flexible grid layout with responsive column control.\n *\n * Columns are computed in JS and applied as `--_cols` inline, so they respond\n * to the element's own width via ResizeObserver. CSS custom properties\n * `--grid-cols`, `--grid-rows`, `--grid-gap`, `--grid-row-gap`, `--grid-col-gap`\n * are honoured as fallbacks when no attribute is set.\n *\n * @element ore-grid\n *\n * @attr {string} cols - Column count: '1'–'12' | 'auto'\n * @attr {string} cols-sm - Columns when width ≥ 640px\n * @attr {string} cols-md - Columns when width ≥ 768px\n * @attr {string} cols-lg - Columns when width ≥ 1024px\n * @attr {string} cols-xl - Columns when width ≥ 1280px\n * @attr {string} cols-2xl - Columns when width ≥ 1536px\n * @attr {string} rows - Row count: '1'–'12' | 'auto'\n * @attr {string} gap - Gap token: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n * @attr {string} align - align-items: 'start' | 'center' | 'end' | 'stretch' | 'baseline'\n * @attr {string} justify - justify-items: 'start' | 'center' | 'end' | 'stretch'\n * @attr {string} flow - grid-auto-flow: 'row' | 'column' | 'row-dense' | 'column-dense'\n * @attr {boolean} responsive - Enables auto-fit columns without a fixed count\n * @attr {string} min-col-width - Min column width for responsive mode (default: 250px)\n * @attr {boolean} fullwidth - Stretch the grid to fill its container's full width\n * @attr {string} areas - CSS grid-template-areas value (e.g. \"'header header' 'nav main'\")\n * @attr {string} areas-sm - grid-template-areas when width ≥ 640px\n * @attr {string} areas-md - grid-template-areas when width ≥ 768px\n * @attr {string} areas-lg - grid-template-areas when width ≥ 1024px\n * @attr {string} areas-xl - grid-template-areas when width ≥ 1280px\n * @attr {string} areas-2xl - grid-template-areas when width ≥ 1536px\n *\n * @slot - Grid items\n *\n * @cssprop --grid-cols - Fallback column template (used when no cols attr is set)\n * @cssprop --grid-rows - Fallback row template\n * @cssprop --grid-gap - Fallback gap\n * @cssprop --grid-row-gap - Fallback row gap\n * @cssprop --grid-col-gap - Fallback column gap\n *\n * @example\n * <ore-grid cols=\"1\" cols-sm=\"2\" cols-lg=\"4\" gap=\"md\">\n * <div>Item</div>\n * </ore-grid>\n *\n * @example\n * <!-- Responsive auto-fit -->\n * <ore-grid responsive min-col-width=\"200px\" gap=\"sm\">\n * <div>Card</div>\n * </ore-grid>\n *\n * @example\n * <!-- Named grid areas -->\n * <ore-grid cols=\"2\" rows=\"2\" areas=\"'header header' 'nav main'\">\n * <header style=\"grid-area: header\">Header</header>\n * <nav style=\"grid-area: nav\">Nav</nav>\n * <main style=\"grid-area: main\">Main</main>\n * </ore-grid>\n */\nexport const GRID_TAG = 'ore-grid' as const;\ndefine<OreGridProps>(GRID_TAG, {\n props: {\n align: prop.string<'start' | 'center' | 'end' | 'stretch' | 'baseline'>(),\n areas: prop.string(),\n areas2xl: prop.string(),\n areasLg: prop.string(),\n areasMd: prop.string(),\n areasSm: prop.string(),\n areasXl: prop.string(),\n cols: prop.string<ColCount>(),\n cols2xl: prop.string<ColCount>(),\n colsLg: prop.string<ColCount>(),\n colsMd: prop.string<ColCount>(),\n colsSm: prop.string<ColCount>(),\n colsXl: prop.string<ColCount>(),\n flow: prop.string<'row' | 'column' | 'row-dense' | 'column-dense'>(),\n fullwidth: prop.bool(false),\n gap: prop.string<'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'>(),\n justify: prop.string<'start' | 'center' | 'end' | 'stretch'>(),\n minColWidth: prop.string(),\n responsive: prop.bool(false),\n rows: prop.string<'1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | 'auto'>(),\n },\n\n setup(props) {\n const el = getHost();\n const watch = watchEffect;\n\n const computeCols = (activeCols: string | undefined, responsive: boolean, minW: string): string | null => {\n if (activeCols === 'auto' || (!activeCols && responsive)) {\n return `repeat(auto-fit, minmax(${minW || '250px'}, 1fr))`;\n }\n\n return activeCols ? `repeat(${activeCols}, 1fr)` : null;\n };\n const updateCols = () => {\n const w = el.offsetWidth;\n const responsive = Boolean(props.responsive.value);\n const minW = props.minColWidth.value ?? '';\n let activeCols: string | undefined;\n\n for (const [key, cssVar] of BREAKPOINTS) {\n if (w >= resolveBp(el, cssVar, BP_FALLBACKS[cssVar]) && props[key].value) {\n activeCols = props[key].value!;\n break;\n }\n }\n activeCols ||= props.cols.value || undefined;\n\n const colsValue = computeCols(activeCols, responsive, minW);\n\n if (colsValue) {\n el.style.setProperty('--_cols', colsValue);\n } else {\n el.style.removeProperty('--_cols');\n }\n };\n\n // Re-run cols whenever any responsive prop changes\n watch(() => {\n void [\n props.cols.value,\n props.colsSm.value,\n props.colsMd.value,\n props.colsLg.value,\n props.colsXl.value,\n props.cols2xl.value,\n props.responsive.value,\n props.minColWidth.value,\n ];\n updateCols();\n });\n\n const updateAreas = () => {\n const w = el.offsetWidth;\n let active = '';\n\n for (const [key, cssVar] of AREAS_BREAKPOINTS) {\n if (w >= resolveBp(el, cssVar, BP_FALLBACKS[cssVar]) && props[key].value) {\n active = props[key].value!;\n break;\n }\n }\n active ||= props.areas.value || '';\n\n if (active) {\n el.style.setProperty('grid-template-areas', active);\n } else {\n el.style.removeProperty('grid-template-areas');\n }\n };\n\n // Rows\n watch(() => {\n const rows = props.rows.value;\n\n if (rows && rows !== 'auto') {\n el.style.setProperty('--_rows', `repeat(${rows}, 1fr)`);\n } else {\n el.style.removeProperty('--_rows');\n }\n });\n // Grid template areas (responsive)\n watch(() => {\n void [\n props.areas.value,\n props.areasSm.value,\n props.areasMd.value,\n props.areasLg.value,\n props.areasXl.value,\n props.areas2xl.value,\n ];\n updateAreas();\n });\n\n // Also, update on element resize (drives breakpoint switching)\n onMounted(() => {\n const size = createElementSize(el);\n\n onCleanup(() => size.dispose());\n\n watch(() => {\n const dims = size.value;\n if (dims) {\n updateCols();\n updateAreas();\n }\n });\n });\n\n return html`\n <slot></slot>\n `;\n },\n\n styles: [styles],\n});\n"],"mappings":"gLAKA,IAAM,EAAiF,CACrF,CAAC,UAAW,mBAAmB,EAC/B,CAAC,SAAU,kBAAkB,EAC7B,CAAC,SAAU,kBAAkB,EAC7B,CAAC,SAAU,kBAAkB,EAC7B,CAAC,SAAU,kBAAkB,CAC/B,EAEM,EAA4F,CAChG,CAAC,WAAY,mBAAmB,EAChC,CAAC,UAAW,kBAAkB,EAC9B,CAAC,UAAW,kBAAkB,EAC9B,CAAC,UAAW,kBAAkB,EAC9B,CAAC,UAAW,kBAAkB,CAChC,EAEM,GAAa,EAAmB,EAAiB,IAA6B,CAClF,IAAM,EAAM,iBAAiB,CAAI,CAAC,CAAC,iBAAiB,CAAO,CAAC,CAAC,KAAK,EAC5D,EAAS,OAAO,WAAW,CAAG,EAEpC,OAAO,OAAO,SAAS,CAAM,EAAI,EAAS,CAC5C,EAEM,EAAuC,CAC3C,oBAAqB,KACrB,mBAAoB,KACpB,mBAAoB,IACpB,mBAAoB,IACpB,mBAAoB,IACtB,EA0Ga,EAAW,YACxB,EAAA,EAAA,OAAA,CAAqB,EAAU,CAC7B,MAAO,CACL,MAAO,EAAA,KAAK,OAA4D,EACxE,MAAO,EAAA,KAAK,OAAO,EACnB,SAAU,EAAA,KAAK,OAAO,EACtB,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b,EAAM,OAAO,MACb,EAAM,OAAO,MACb,EAAM,QAAQ,MACd,EAAM,WAAW,MACjB,EAAM,YAAY,MAEpB,EAAW,CACb,CAAC,EAED,IAAM,MAAoB,CACxB,IAAM,EAAI,EAAG,YACT,EAAS,GAEb,IAAK,GAAM,CAAC,EAAK,KAAW,EAC1B,GAAI,GAAK,EAAU,EAAI,EAAQ,EAAa,EAAO,GAAK,EAAM,EAAI,CAAC,MAAO,CACxE,EAAS,EAAM,EAAI,CAAC,MACpB,KACF,CAEF,IAAW,EAAM,MAAM,OAAS,GAE5B,EACF,EAAG,MAAM,YAAY,sBAAuB,CAAM,EAElD,EAAG,MAAM,eAAe,qBAAqB,CAEjD,EAwCA,OArCA,MAAY,CACV,IAAM,EAAO,EAAM,KAAK,MAEpB,GAAQ,IAAS,OACnB,EAAG,MAAM,YAAY,UAAW,UAAU,EAAK,OAAO,EAEtD,EAAG,MAAM,eAAe,SAAS,CAErC,CAAC,EAED,MAAY,CACV,EACQ,MAAM,MACZ,EAAM,QAAQ,MACd,EAAM,QAAQ,MACd,EAAM,QAAQ,MACd,EAAM,QAAQ,MACd,EAAM,SAAS,MAEjB,EAAY,CACd,CAAC,GAGD,EAAA,EAAA,UAAA,KAAgB,CACd,IAAM,GAAA,EAAO,EAAA,kBAAA,CAAkB,CAAE,GAEjC,EAAA,EAAA,UAAA,KAAgB,EAAK,QAAQ,CAAC,EAE9B,MAAY,CACG,EAAK,QAEhB,EAAW,EACX,EAAY,EAEhB,CAAC,CACH,CAAC,EAEM,EAAA,IAAI;;KAGb,EAEA,OAAQ,CAAC,EAAA,OAAM,CACjB,CAAC"}
package/dist/grid.js CHANGED
@@ -1,82 +1,83 @@
1
1
  import e from "./layout/grid/grid.css.js";
2
- import { define as t, getHost as n, html as r, onMounted as i, prop as a, resizeObserver as o, watchEffect as s } from "@vielzeug/ore";
2
+ import { define as t, getHost as n, html as r, onCleanup as i, onMounted as a, prop as o, watchEffect as s } from "@vielzeug/ore";
3
+ import { createElementSize as c } from "@vielzeug/sentinel";
3
4
  //#region src/layout/grid/grid.ts
4
- var c = [
5
+ var l = [
5
6
  ["cols2xl", "--size-screen-2xl"],
6
7
  ["colsXl", "--size-screen-xl"],
7
8
  ["colsLg", "--size-screen-lg"],
8
9
  ["colsMd", "--size-screen-md"],
9
10
  ["colsSm", "--size-screen-sm"]
10
- ], l = [
11
+ ], u = [
11
12
  ["areas2xl", "--size-screen-2xl"],
12
13
  ["areasXl", "--size-screen-xl"],
13
14
  ["areasLg", "--size-screen-lg"],
14
15
  ["areasMd", "--size-screen-md"],
15
16
  ["areasSm", "--size-screen-sm"]
16
- ], u = (e, t, n) => {
17
+ ], d = (e, t, n) => {
17
18
  let r = getComputedStyle(e).getPropertyValue(t).trim(), i = Number.parseFloat(r);
18
19
  return Number.isFinite(i) ? i : n;
19
- }, d = {
20
+ }, f = {
20
21
  "--size-screen-2xl": 1536,
21
22
  "--size-screen-lg": 1024,
22
23
  "--size-screen-md": 768,
23
24
  "--size-screen-sm": 640,
24
25
  "--size-screen-xl": 1280
25
- }, f = "ore-grid";
26
- t(f, {
26
+ }, p = "ore-grid";
27
+ t(p, {
27
28
  props: {
28
- align: a.string(),
29
- areas: a.string(),
30
- areas2xl: a.string(),
31
- areasLg: a.string(),
32
- areasMd: a.string(),
33
- areasSm: a.string(),
34
- areasXl: a.string(),
35
- cols: a.string(),
36
- cols2xl: a.string(),
37
- colsLg: a.string(),
38
- colsMd: a.string(),
39
- colsSm: a.string(),
40
- colsXl: a.string(),
41
- flow: a.string(),
42
- fullwidth: a.bool(!1),
43
- gap: a.string(),
44
- justify: a.string(),
45
- minColWidth: a.string(),
46
- responsive: a.bool(!1),
47
- rows: a.string()
29
+ align: o.string(),
30
+ areas: o.string(),
31
+ areas2xl: o.string(),
32
+ areasLg: o.string(),
33
+ areasMd: o.string(),
34
+ areasSm: o.string(),
35
+ areasXl: o.string(),
36
+ cols: o.string(),
37
+ cols2xl: o.string(),
38
+ colsLg: o.string(),
39
+ colsMd: o.string(),
40
+ colsSm: o.string(),
41
+ colsXl: o.string(),
42
+ flow: o.string(),
43
+ fullwidth: o.bool(!1),
44
+ gap: o.string(),
45
+ justify: o.string(),
46
+ minColWidth: o.string(),
47
+ responsive: o.bool(!1),
48
+ rows: o.string()
48
49
  },
49
50
  setup(e) {
50
- let t = n(), a = s, f = (e, t, n) => e === "auto" || !e && t ? `repeat(auto-fit, minmax(${n || "250px"}, 1fr))` : e ? `repeat(${e}, 1fr)` : null, p = () => {
51
+ let t = n(), o = s, p = (e, t, n) => e === "auto" || !e && t ? `repeat(auto-fit, minmax(${n || "250px"}, 1fr))` : e ? `repeat(${e}, 1fr)` : null, m = () => {
51
52
  let n = t.offsetWidth, r = !!e.responsive.value, i = e.minColWidth.value ?? "", a;
52
- for (let [r, i] of c) if (n >= u(t, i, d[i]) && e[r].value) {
53
+ for (let [r, i] of l) if (n >= d(t, i, f[i]) && e[r].value) {
53
54
  a = e[r].value;
54
55
  break;
55
56
  }
56
57
  a ||= e.cols.value || void 0;
57
- let o = f(a, r, i);
58
+ let o = p(a, r, i);
58
59
  o ? t.style.setProperty("--_cols", o) : t.style.removeProperty("--_cols");
59
60
  };
60
- a(() => {
61
- e.cols.value, e.colsSm.value, e.colsMd.value, e.colsLg.value, e.colsXl.value, e.cols2xl.value, e.responsive.value, e.minColWidth.value, p();
61
+ o(() => {
62
+ e.cols.value, e.colsSm.value, e.colsMd.value, e.colsLg.value, e.colsXl.value, e.cols2xl.value, e.responsive.value, e.minColWidth.value, m();
62
63
  });
63
- let m = () => {
64
+ let h = () => {
64
65
  let n = t.offsetWidth, r = "";
65
- for (let [i, a] of l) if (n >= u(t, a, d[a]) && e[i].value) {
66
+ for (let [i, a] of u) if (n >= d(t, a, f[a]) && e[i].value) {
66
67
  r = e[i].value;
67
68
  break;
68
69
  }
69
70
  r ||= e.areas.value || "", r ? t.style.setProperty("grid-template-areas", r) : t.style.removeProperty("grid-template-areas");
70
71
  };
71
- return a(() => {
72
+ return o(() => {
72
73
  let n = e.rows.value;
73
74
  n && n !== "auto" ? t.style.setProperty("--_rows", `repeat(${n}, 1fr)`) : t.style.removeProperty("--_rows");
75
+ }), o(() => {
76
+ e.areas.value, e.areasSm.value, e.areasMd.value, e.areasLg.value, e.areasXl.value, e.areas2xl.value, h();
74
77
  }), a(() => {
75
- e.areas.value, e.areasSm.value, e.areasMd.value, e.areasLg.value, e.areasXl.value, e.areas2xl.value, m();
76
- }), i(() => {
77
- let e = o(t);
78
- a(() => {
79
- e.value, p(), m();
78
+ let e = c(t);
79
+ i(() => e.dispose()), o(() => {
80
+ e.value && (m(), h());
80
81
  });
81
82
  }), r`
82
83
  <slot></slot>
@@ -85,6 +86,6 @@ t(f, {
85
86
  styles: [e]
86
87
  });
87
88
  //#endregion
88
- export { f as GRID_TAG };
89
+ export { p as GRID_TAG };
89
90
 
90
91
  //# sourceMappingURL=grid.js.map
package/dist/grid.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"grid.js","names":[],"sources":["../src/layout/grid/grid.ts"],"sourcesContent":["import { define, getHost, html, onMounted, prop, resizeObserver, watchEffect } from '@vielzeug/ore';\n\nimport styles from './grid.css?inline';\n\nconst BREAKPOINTS: ['cols2xl' | 'colsXl' | 'colsLg' | 'colsMd' | 'colsSm', string][] = [\n ['cols2xl', '--size-screen-2xl'],\n ['colsXl', '--size-screen-xl'],\n ['colsLg', '--size-screen-lg'],\n ['colsMd', '--size-screen-md'],\n ['colsSm', '--size-screen-sm'],\n];\n\nconst AREAS_BREAKPOINTS: ['areas2xl' | 'areasXl' | 'areasLg' | 'areasMd' | 'areasSm', string][] = [\n ['areas2xl', '--size-screen-2xl'],\n ['areasXl', '--size-screen-xl'],\n ['areasLg', '--size-screen-lg'],\n ['areasMd', '--size-screen-md'],\n ['areasSm', '--size-screen-sm'],\n];\n\nconst resolveBp = (host: HTMLElement, varName: string, fallback: number): number => {\n const raw = getComputedStyle(host).getPropertyValue(varName).trim();\n const parsed = Number.parseFloat(raw);\n\n return Number.isFinite(parsed) ? parsed : fallback;\n};\n\nconst BP_FALLBACKS: Record<string, number> = {\n '--size-screen-2xl': 1536,\n '--size-screen-lg': 1024,\n '--size-screen-md': 768,\n '--size-screen-sm': 640,\n '--size-screen-xl': 1280,\n};\n\ntype ColCount = '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | 'auto';\n\n/** Grid component properties */\nexport type OreGridProps = {\n /** Align items vertically */\n align?: 'start' | 'center' | 'end' | 'stretch' | 'baseline';\n /** CSS grid-template-areas value */\n areas?: string;\n /** grid-template-areas at 2xl breakpoint (≥1536px) */\n areas2xl?: string;\n /** grid-template-areas at lg breakpoint (≥1024px) */\n areasLg?: string;\n /** grid-template-areas at md breakpoint (≥768px) */\n areasMd?: string;\n /** grid-template-areas at sm breakpoint (≥640px) */\n areasSm?: string;\n /** grid-template-areas at xl breakpoint (≥1280px) */\n areasXl?: string;\n /** Number of columns: '1'-'12' | 'auto' */\n cols?: ColCount;\n /** Columns at 2xl breakpoint (≥1536px) */\n cols2xl?: ColCount;\n /** Columns at lg breakpoint (≥1024px) */\n colsLg?: ColCount;\n /** Columns at md breakpoint (≥768px) */\n colsMd?: ColCount;\n /** Columns at sm breakpoint (≥640px) */\n colsSm?: ColCount;\n /** Columns at xl breakpoint (≥1280px) */\n colsXl?: ColCount;\n /** Grid auto flow direction */\n flow?: 'row' | 'column' | 'row-dense' | 'column-dense';\n /** Stretch the grid to fill its container's full width */\n fullwidth?: boolean;\n /** Gap between items */\n gap?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** Justify items horizontally */\n justify?: 'start' | 'center' | 'end' | 'stretch';\n /** Minimum column width for responsive mode (default: 250px) */\n minColWidth?: string;\n /** Use auto-fit responsive columns */\n responsive?: boolean;\n /** Number of rows: '1'-'12' | 'auto' */\n rows?: '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | 'auto';\n};\n\n/**\n * ore-grid — Flexible grid layout with responsive column control.\n *\n * Columns are computed in JS and applied as `--_cols` inline, so they respond\n * to the element's own width via ResizeObserver. CSS custom properties\n * `--grid-cols`, `--grid-rows`, `--grid-gap`, `--grid-row-gap`, `--grid-col-gap`\n * are honoured as fallbacks when no attribute is set.\n *\n * @element ore-grid\n *\n * @attr {string} cols - Column count: '1'–'12' | 'auto'\n * @attr {string} cols-sm - Columns when width ≥ 640px\n * @attr {string} cols-md - Columns when width ≥ 768px\n * @attr {string} cols-lg - Columns when width ≥ 1024px\n * @attr {string} cols-xl - Columns when width ≥ 1280px\n * @attr {string} cols-2xl - Columns when width ≥ 1536px\n * @attr {string} rows - Row count: '1'–'12' | 'auto'\n * @attr {string} gap - Gap token: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n * @attr {string} align - align-items: 'start' | 'center' | 'end' | 'stretch' | 'baseline'\n * @attr {string} justify - justify-items: 'start' | 'center' | 'end' | 'stretch'\n * @attr {string} flow - grid-auto-flow: 'row' | 'column' | 'row-dense' | 'column-dense'\n * @attr {boolean} responsive - Enables auto-fit columns without a fixed count\n * @attr {string} min-col-width - Min column width for responsive mode (default: 250px)\n * @attr {boolean} fullwidth - Stretch the grid to fill its container's full width\n * @attr {string} areas - CSS grid-template-areas value (e.g. \"'header header' 'nav main'\")\n * @attr {string} areas-sm - grid-template-areas when width ≥ 640px\n * @attr {string} areas-md - grid-template-areas when width ≥ 768px\n * @attr {string} areas-lg - grid-template-areas when width ≥ 1024px\n * @attr {string} areas-xl - grid-template-areas when width ≥ 1280px\n * @attr {string} areas-2xl - grid-template-areas when width ≥ 1536px\n *\n * @slot - Grid items\n *\n * @cssprop --grid-cols - Fallback column template (used when no cols attr is set)\n * @cssprop --grid-rows - Fallback row template\n * @cssprop --grid-gap - Fallback gap\n * @cssprop --grid-row-gap - Fallback row gap\n * @cssprop --grid-col-gap - Fallback column gap\n *\n * @example\n * <ore-grid cols=\"1\" cols-sm=\"2\" cols-lg=\"4\" gap=\"md\">\n * <div>Item</div>\n * </ore-grid>\n *\n * @example\n * <!-- Responsive auto-fit -->\n * <ore-grid responsive min-col-width=\"200px\" gap=\"sm\">\n * <div>Card</div>\n * </ore-grid>\n *\n * @example\n * <!-- Named grid areas -->\n * <ore-grid cols=\"2\" rows=\"2\" areas=\"'header header' 'nav main'\">\n * <header style=\"grid-area: header\">Header</header>\n * <nav style=\"grid-area: nav\">Nav</nav>\n * <main style=\"grid-area: main\">Main</main>\n * </ore-grid>\n */\nexport const GRID_TAG = 'ore-grid' as const;\ndefine<OreGridProps>(GRID_TAG, {\n props: {\n align: prop.string<'start' | 'center' | 'end' | 'stretch' | 'baseline'>(),\n areas: prop.string(),\n areas2xl: prop.string(),\n areasLg: prop.string(),\n areasMd: prop.string(),\n areasSm: prop.string(),\n areasXl: prop.string(),\n cols: prop.string<ColCount>(),\n cols2xl: prop.string<ColCount>(),\n colsLg: prop.string<ColCount>(),\n colsMd: prop.string<ColCount>(),\n colsSm: prop.string<ColCount>(),\n colsXl: prop.string<ColCount>(),\n flow: prop.string<'row' | 'column' | 'row-dense' | 'column-dense'>(),\n fullwidth: prop.bool(false),\n gap: prop.string<'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'>(),\n justify: prop.string<'start' | 'center' | 'end' | 'stretch'>(),\n minColWidth: prop.string(),\n responsive: prop.bool(false),\n rows: prop.string<'1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | 'auto'>(),\n },\n\n setup(props) {\n const el = getHost();\n const watch = watchEffect;\n\n const computeCols = (activeCols: string | undefined, responsive: boolean, minW: string): string | null => {\n if (activeCols === 'auto' || (!activeCols && responsive)) {\n return `repeat(auto-fit, minmax(${minW || '250px'}, 1fr))`;\n }\n\n return activeCols ? `repeat(${activeCols}, 1fr)` : null;\n };\n const updateCols = () => {\n const w = el.offsetWidth;\n const responsive = Boolean(props.responsive.value);\n const minW = props.minColWidth.value ?? '';\n let activeCols: string | undefined;\n\n for (const [key, cssVar] of BREAKPOINTS) {\n if (w >= resolveBp(el, cssVar, BP_FALLBACKS[cssVar]) && props[key].value) {\n activeCols = props[key].value!;\n break;\n }\n }\n activeCols ||= props.cols.value || undefined;\n\n const colsValue = computeCols(activeCols, responsive, minW);\n\n if (colsValue) {\n el.style.setProperty('--_cols', colsValue);\n } else {\n el.style.removeProperty('--_cols');\n }\n };\n\n // Re-run cols whenever any responsive prop changes\n watch(() => {\n void [\n props.cols.value,\n props.colsSm.value,\n props.colsMd.value,\n props.colsLg.value,\n props.colsXl.value,\n props.cols2xl.value,\n props.responsive.value,\n props.minColWidth.value,\n ];\n updateCols();\n });\n\n const updateAreas = () => {\n const w = el.offsetWidth;\n let active = '';\n\n for (const [key, cssVar] of AREAS_BREAKPOINTS) {\n if (w >= resolveBp(el, cssVar, BP_FALLBACKS[cssVar]) && props[key].value) {\n active = props[key].value!;\n break;\n }\n }\n active ||= props.areas.value || '';\n\n if (active) {\n el.style.setProperty('grid-template-areas', active);\n } else {\n el.style.removeProperty('grid-template-areas');\n }\n };\n\n // Rows\n watch(() => {\n const rows = props.rows.value;\n\n if (rows && rows !== 'auto') {\n el.style.setProperty('--_rows', `repeat(${rows}, 1fr)`);\n } else {\n el.style.removeProperty('--_rows');\n }\n });\n // Grid template areas (responsive)\n watch(() => {\n void [\n props.areas.value,\n props.areasSm.value,\n props.areasMd.value,\n props.areasLg.value,\n props.areasXl.value,\n props.areas2xl.value,\n ];\n updateAreas();\n });\n\n // Also, update on element resize (drives breakpoint switching)\n onMounted(() => {\n const size = resizeObserver(el);\n\n watch(() => {\n void size.value;\n updateCols();\n updateAreas();\n });\n });\n\n return html`\n <slot></slot>\n `;\n },\n\n styles: [styles],\n});\n"],"mappings":";;;AAIA,IAAM,IAAiF;CACrF,CAAC,WAAW,mBAAmB;CAC/B,CAAC,UAAU,kBAAkB;CAC7B,CAAC,UAAU,kBAAkB;CAC7B,CAAC,UAAU,kBAAkB;CAC7B,CAAC,UAAU,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;GACd,IAAM,IAAO,EAAe,CAAE;GAE9B,QAAY;IAGV,AAFA,EAAU,OACV,EAAW,GACX,EAAY;GACd,CAAC;EACH,CAAC,GAEM,CAAI;;;CAGb;CAEA,QAAQ,CAAC,CAAM;AACjB,CAAC"}
1
+ {"version":3,"file":"grid.js","names":[],"sources":["../src/layout/grid/grid.ts"],"sourcesContent":["import { define, getHost, html, onCleanup, onMounted, prop, watchEffect } from '@vielzeug/ore';\nimport { createElementSize } from '@vielzeug/sentinel';\n\nimport styles from './grid.css?inline';\n\nconst BREAKPOINTS: ['cols2xl' | 'colsXl' | 'colsLg' | 'colsMd' | 'colsSm', string][] = [\n ['cols2xl', '--size-screen-2xl'],\n ['colsXl', '--size-screen-xl'],\n ['colsLg', '--size-screen-lg'],\n ['colsMd', '--size-screen-md'],\n ['colsSm', '--size-screen-sm'],\n];\n\nconst AREAS_BREAKPOINTS: ['areas2xl' | 'areasXl' | 'areasLg' | 'areasMd' | 'areasSm', string][] = [\n ['areas2xl', '--size-screen-2xl'],\n ['areasXl', '--size-screen-xl'],\n ['areasLg', '--size-screen-lg'],\n ['areasMd', '--size-screen-md'],\n ['areasSm', '--size-screen-sm'],\n];\n\nconst resolveBp = (host: HTMLElement, varName: string, fallback: number): number => {\n const raw = getComputedStyle(host).getPropertyValue(varName).trim();\n const parsed = Number.parseFloat(raw);\n\n return Number.isFinite(parsed) ? parsed : fallback;\n};\n\nconst BP_FALLBACKS: Record<string, number> = {\n '--size-screen-2xl': 1536,\n '--size-screen-lg': 1024,\n '--size-screen-md': 768,\n '--size-screen-sm': 640,\n '--size-screen-xl': 1280,\n};\n\ntype ColCount = '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | 'auto';\n\n/** Grid component properties */\nexport type OreGridProps = {\n /** Align items vertically */\n align?: 'start' | 'center' | 'end' | 'stretch' | 'baseline';\n /** CSS grid-template-areas value */\n areas?: string;\n /** grid-template-areas at 2xl breakpoint (≥1536px) */\n areas2xl?: string;\n /** grid-template-areas at lg breakpoint (≥1024px) */\n areasLg?: string;\n /** grid-template-areas at md breakpoint (≥768px) */\n areasMd?: string;\n /** grid-template-areas at sm breakpoint (≥640px) */\n areasSm?: string;\n /** grid-template-areas at xl breakpoint (≥1280px) */\n areasXl?: string;\n /** Number of columns: '1'-'12' | 'auto' */\n cols?: ColCount;\n /** Columns at 2xl breakpoint (≥1536px) */\n cols2xl?: ColCount;\n /** Columns at lg breakpoint (≥1024px) */\n colsLg?: ColCount;\n /** Columns at md breakpoint (≥768px) */\n colsMd?: ColCount;\n /** Columns at sm breakpoint (≥640px) */\n colsSm?: ColCount;\n /** Columns at xl breakpoint (≥1280px) */\n colsXl?: ColCount;\n /** Grid auto flow direction */\n flow?: 'row' | 'column' | 'row-dense' | 'column-dense';\n /** Stretch the grid to fill its container's full width */\n fullwidth?: boolean;\n /** Gap between items */\n gap?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** Justify items horizontally */\n justify?: 'start' | 'center' | 'end' | 'stretch';\n /** Minimum column width for responsive mode (default: 250px) */\n minColWidth?: string;\n /** Use auto-fit responsive columns */\n responsive?: boolean;\n /** Number of rows: '1'-'12' | 'auto' */\n rows?: '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | 'auto';\n};\n\n/**\n * ore-grid — Flexible grid layout with responsive column control.\n *\n * Columns are computed in JS and applied as `--_cols` inline, so they respond\n * to the element's own width via ResizeObserver. CSS custom properties\n * `--grid-cols`, `--grid-rows`, `--grid-gap`, `--grid-row-gap`, `--grid-col-gap`\n * are honoured as fallbacks when no attribute is set.\n *\n * @element ore-grid\n *\n * @attr {string} cols - Column count: '1'–'12' | 'auto'\n * @attr {string} cols-sm - Columns when width ≥ 640px\n * @attr {string} cols-md - Columns when width ≥ 768px\n * @attr {string} cols-lg - Columns when width ≥ 1024px\n * @attr {string} cols-xl - Columns when width ≥ 1280px\n * @attr {string} cols-2xl - Columns when width ≥ 1536px\n * @attr {string} rows - Row count: '1'–'12' | 'auto'\n * @attr {string} gap - Gap token: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n * @attr {string} align - align-items: 'start' | 'center' | 'end' | 'stretch' | 'baseline'\n * @attr {string} justify - justify-items: 'start' | 'center' | 'end' | 'stretch'\n * @attr {string} flow - grid-auto-flow: 'row' | 'column' | 'row-dense' | 'column-dense'\n * @attr {boolean} responsive - Enables auto-fit columns without a fixed count\n * @attr {string} min-col-width - Min column width for responsive mode (default: 250px)\n * @attr {boolean} fullwidth - Stretch the grid to fill its container's full width\n * @attr {string} areas - CSS grid-template-areas value (e.g. \"'header header' 'nav main'\")\n * @attr {string} areas-sm - grid-template-areas when width ≥ 640px\n * @attr {string} areas-md - grid-template-areas when width ≥ 768px\n * @attr {string} areas-lg - grid-template-areas when width ≥ 1024px\n * @attr {string} areas-xl - grid-template-areas when width ≥ 1280px\n * @attr {string} areas-2xl - grid-template-areas when width ≥ 1536px\n *\n * @slot - Grid items\n *\n * @cssprop --grid-cols - Fallback column template (used when no cols attr is set)\n * @cssprop --grid-rows - Fallback row template\n * @cssprop --grid-gap - Fallback gap\n * @cssprop --grid-row-gap - Fallback row gap\n * @cssprop --grid-col-gap - Fallback column gap\n *\n * @example\n * <ore-grid cols=\"1\" cols-sm=\"2\" cols-lg=\"4\" gap=\"md\">\n * <div>Item</div>\n * </ore-grid>\n *\n * @example\n * <!-- Responsive auto-fit -->\n * <ore-grid responsive min-col-width=\"200px\" gap=\"sm\">\n * <div>Card</div>\n * </ore-grid>\n *\n * @example\n * <!-- Named grid areas -->\n * <ore-grid cols=\"2\" rows=\"2\" areas=\"'header header' 'nav main'\">\n * <header style=\"grid-area: header\">Header</header>\n * <nav style=\"grid-area: nav\">Nav</nav>\n * <main style=\"grid-area: main\">Main</main>\n * </ore-grid>\n */\nexport const GRID_TAG = 'ore-grid' as const;\ndefine<OreGridProps>(GRID_TAG, {\n props: {\n align: prop.string<'start' | 'center' | 'end' | 'stretch' | 'baseline'>(),\n areas: prop.string(),\n areas2xl: prop.string(),\n areasLg: prop.string(),\n areasMd: prop.string(),\n areasSm: prop.string(),\n areasXl: prop.string(),\n cols: prop.string<ColCount>(),\n cols2xl: prop.string<ColCount>(),\n colsLg: prop.string<ColCount>(),\n colsMd: prop.string<ColCount>(),\n colsSm: prop.string<ColCount>(),\n colsXl: prop.string<ColCount>(),\n flow: prop.string<'row' | 'column' | 'row-dense' | 'column-dense'>(),\n fullwidth: prop.bool(false),\n gap: prop.string<'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'>(),\n justify: prop.string<'start' | 'center' | 'end' | 'stretch'>(),\n minColWidth: prop.string(),\n responsive: prop.bool(false),\n rows: prop.string<'1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | 'auto'>(),\n },\n\n setup(props) {\n const el = getHost();\n const watch = watchEffect;\n\n const computeCols = (activeCols: string | undefined, responsive: boolean, minW: string): string | null => {\n if (activeCols === 'auto' || (!activeCols && responsive)) {\n return `repeat(auto-fit, minmax(${minW || '250px'}, 1fr))`;\n }\n\n return activeCols ? `repeat(${activeCols}, 1fr)` : null;\n };\n const updateCols = () => {\n const w = el.offsetWidth;\n const responsive = Boolean(props.responsive.value);\n const minW = props.minColWidth.value ?? '';\n let activeCols: string | undefined;\n\n for (const [key, cssVar] of BREAKPOINTS) {\n if (w >= resolveBp(el, cssVar, BP_FALLBACKS[cssVar]) && props[key].value) {\n activeCols = props[key].value!;\n break;\n }\n }\n activeCols ||= props.cols.value || undefined;\n\n const colsValue = computeCols(activeCols, responsive, minW);\n\n if (colsValue) {\n el.style.setProperty('--_cols', colsValue);\n } else {\n el.style.removeProperty('--_cols');\n }\n };\n\n // Re-run cols whenever any responsive prop changes\n watch(() => {\n void [\n props.cols.value,\n props.colsSm.value,\n props.colsMd.value,\n props.colsLg.value,\n props.colsXl.value,\n props.cols2xl.value,\n props.responsive.value,\n props.minColWidth.value,\n ];\n updateCols();\n });\n\n const updateAreas = () => {\n const w = el.offsetWidth;\n let active = '';\n\n for (const [key, cssVar] of AREAS_BREAKPOINTS) {\n if (w >= resolveBp(el, cssVar, BP_FALLBACKS[cssVar]) && props[key].value) {\n active = props[key].value!;\n break;\n }\n }\n active ||= props.areas.value || '';\n\n if (active) {\n el.style.setProperty('grid-template-areas', active);\n } else {\n el.style.removeProperty('grid-template-areas');\n }\n };\n\n // Rows\n watch(() => {\n const rows = props.rows.value;\n\n if (rows && rows !== 'auto') {\n el.style.setProperty('--_rows', `repeat(${rows}, 1fr)`);\n } else {\n el.style.removeProperty('--_rows');\n }\n });\n // Grid template areas (responsive)\n watch(() => {\n void [\n props.areas.value,\n props.areasSm.value,\n props.areasMd.value,\n props.areasLg.value,\n props.areasXl.value,\n props.areas2xl.value,\n ];\n updateAreas();\n });\n\n // Also, update on element resize (drives breakpoint switching)\n onMounted(() => {\n const size = createElementSize(el);\n\n onCleanup(() => size.dispose());\n\n watch(() => {\n const dims = size.value;\n if (dims) {\n updateCols();\n updateAreas();\n }\n });\n });\n\n return html`\n <slot></slot>\n `;\n },\n\n styles: [styles],\n});\n"],"mappings":";;;;AAKA,IAAM,IAAiF;CACrF,CAAC,WAAW,mBAAmB;CAC/B,CAAC,UAAU,kBAAkB;CAC7B,CAAC,UAAU,kBAAkB;CAC7B,CAAC,UAAU,kBAAkB;CAC7B,CAAC,UAAU,kBAAkB;AAC/B,GAEM,IAA4F;CAChG,CAAC,YAAY,mBAAmB;CAChC,CAAC,WAAW,kBAAkB;CAC9B,CAAC,WAAW,kBAAkB;CAC9B,CAAC,WAAW,kBAAkB;CAC9B,CAAC,WAAW,kBAAkB;AAChC,GAEM,KAAa,GAAmB,GAAiB,MAA6B;CAClF,IAAM,IAAM,iBAAiB,CAAI,CAAC,CAAC,iBAAiB,CAAO,CAAC,CAAC,KAAK,GAC5D,IAAS,OAAO,WAAW,CAAG;CAEpC,OAAO,OAAO,SAAS,CAAM,IAAI,IAAS;A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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,eAAO,MAAM,WAAW,EAAG,aAAsB,CAAC;AA0elD,+BAA+B;AAC/B,MAAM,MAAM,oBAAoB,GAAG;IACjC,0CAA0C;IAC1C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,8CAA8C;IAC9C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,iBAAiB,EAAG,mBAA4B,CAAC;AA8E9D,8BAA8B;AAC9B,MAAM,MAAM,mBAAmB,GAAG;IAChC,4DAA4D;IAC5D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,eAAO,MAAM,gBAAgB,EAAG,kBAA2B,CAAC"}
@@ -1,14 +1,10 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./styles/mixins/accessibility.css.cjs"),t=require("./shared/prop-bundles.cjs"),n=require("./list.cjs"),r=require("./content/list/_list-item-reveal.cjs"),i=require("./content/list/list-item.css.cjs");let a=require("@vielzeug/ore"),o=require("@vielzeug/ripple");var s=e=>e===`left`?`actions-left`:`actions-right`,c=`ore-list-item`;(0,a.define)(c,{props:{...t.disablableBundle,revealed:a.prop.oneOf([`left`,`right`],void 0),value:a.prop.string()},setup(e){let t=(0,a.getHost)(),i=(0,a.useEmit)(),c=(0,a.useSlots)(),l=(0,a.inject)(n.LIST_CTX),u=(0,o.computed)(()=>!!l?.selectable.value),d=(0,o.computed)(()=>e.value.value!=null&&l!=null&&l.value.value===e.value.value),f=r.createRevealState(t,{disabled:(0,o.computed)(()=>e.disabled.value||!!e.revealed.value),hasActions:e=>c.has(s(e)).value,onConfirm:e=>{let n=c.elements(s(e)).value[0];i(`confirm`,{item:t,side:e}),n?.click()}});(0,a.onCleanup)(()=>f.dispose()),(0,a.watchEffect)(()=>{t.toggleAttribute(`selected`,d.value)});let p=d.value;(0,a.watchEffect)(()=>{let n=d.value;n!==p&&(p=n,i(n?`select`:`deselect`,{item:t,value:e.value.value??null}))});let m=e.revealed.value??null;(0,a.watchEffect)(()=>{let n=e.revealed.value??null;n!==m&&(m=n,n?(l?.requestReveal(t),i(`reveal`,{item:t,side:n})):i(`conceal`,{item:t}))});let h=n=>{if(e.disabled.value)return;if(e.revealed.value){n.preventDefault(),n.stopPropagation(),t.removeAttribute(`revealed`);return}if(!u.value)return;let r=e.value.value;r!=null&&l?.select(d.value?void 0:r)};return(0,a.bind)({attr:{"aria-disabled":()=>e.disabled.value?`true`:null,"aria-selected":()=>u.value?String(d.value):null,role:()=>u.value?`option`:`listitem`}}),a.html`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./styles/mixins/accessibility.css.cjs"),t=require("./shared/prop-bundles.cjs"),n=require("./list.cjs"),r=require("./content/list/_list-item-reveal.cjs"),i=require("./content/list/list-item.css.cjs");let a=require("@vielzeug/ore"),o=require("@vielzeug/ripple");var s=e=>e===`left`?`actions-left`:`actions-right`,c=`ore-list-item`;(0,a.define)(c,{props:{...t.disablableBundle,revealed:a.prop.oneOf([`left`,`right`],void 0),value:a.prop.string()},setup(e){let t=(0,a.getHost)(),i=(0,a.useEmit)(),c=(0,a.useSlots)(),l=(0,a.inject)(n.LIST_CTX),u=(0,o.computed)(()=>!!l?.selectable.value),d=(0,o.computed)(()=>e.value.value!=null&&l!=null&&l.value.value===e.value.value),f=e=>c.has(s(e)).value;(0,a.onMounted)(()=>{let n=t.shadowRoot?.querySelector(`.row`);if(!n)return;let l=r.createRevealState(t,n,{disabled:(0,o.computed)(()=>e.disabled.value||!!e.revealed.value),hasActions:f,onConfirm:e=>{let n=c.elements(s(e)).value[0];i(`confirm`,{item:t,side:e}),n?.click()}});(0,a.onCleanup)(()=>l.dispose())}),(0,a.watchEffect)(()=>{t.toggleAttribute(`selected`,d.value)});let p=d.value;(0,a.watchEffect)(()=>{let n=d.value;n!==p&&(p=n,i(n?`select`:`deselect`,{item:t,value:e.value.value??null}))});let m=e.revealed.value??null;(0,a.watchEffect)(()=>{let n=e.revealed.value??null;n!==m&&(m=n,n?(l?.requestReveal(t),i(`reveal`,{item:t,side:n})):i(`conceal`,{item:t}))});let h=n=>{if(e.disabled.value)return;if(e.revealed.value){n.preventDefault(),n.stopPropagation(),t.removeAttribute(`revealed`);return}if(!u.value)return;let r=e.value.value;r!=null&&l?.select(d.value?void 0:r)};return(0,a.bind)({attr:{"aria-disabled":()=>e.disabled.value?`true`:null,"aria-selected":()=>u.value?String(d.value):null,role:()=>u.value?`option`:`listitem`}}),a.html`
2
2
  <div
3
3
  class="row"
4
4
  part="row"
5
5
  tabindex="${()=>e.disabled.value?`-1`:`0`}"
6
6
  @click="${h}"
7
- @keydown="${t=>{(t.key===`Enter`||t.key===` `)&&(e.disabled.value||!e.revealed.value&&!u.value||(t.preventDefault(),h(t)))}}"
8
- @pointercancel="${e=>f.handlePointerCancel(e)}"
9
- @pointerdown="${e=>f.handlePointerDown(e)}"
10
- @pointermove="${e=>f.handlePointerMove(e)}"
11
- @pointerup="${e=>f.handlePointerUp(e)}">
7
+ @keydown="${t=>{(t.key===`Enter`||t.key===` `)&&(e.disabled.value||!e.revealed.value&&!u.value||(t.preventDefault(),h(t)))}}">
12
8
  <span class="leading" part="leading"><slot name="leading"></slot></span>
13
9
  <span class="content" part="content">
14
10
  <span class="title" part="title"><slot></slot></span>
@@ -1 +1 @@
1
- {"version":3,"file":"list-item.cjs","names":[],"sources":["../src/content/list/list-item.ts"],"sourcesContent":["import { bind, define, getHost, html, inject, onCleanup, prop, useEmit, useSlots, watchEffect } from '@vielzeug/ore';\nimport { computed } from '@vielzeug/ripple';\n\nimport { disablableBundle } from '../../shared';\nimport { reducedMotionMixin } from '../../styles';\nimport { createRevealState } from './_list-item-reveal';\nimport { LIST_CTX } from './list';\nimport componentStyles from './list-item.css?inline';\n\n/** Which side's action panel is currently revealed on a list item. */\nexport type ListItemRevealSide = 'left' | 'right';\n\n/** Events emitted by the list-item component */\nexport type OreListItemEvents = {\n /** Emitted when the revealed action panel closes (gesture, tap, or programmatic). */\n conceal: { item: HTMLElement };\n /**\n * Emitted when a swipe crosses the full-swipe-through distance — the \"swiped all the way\"\n * confirm gesture. Fired just before the slotted action's own click (if any).\n */\n confirm: { item: HTMLElement; side: ListItemRevealSide };\n /** Emitted when the item becomes deselected. */\n deselect: { item: HTMLElement; value: null | string };\n /** Emitted when a swipe/focus reveals an action panel. */\n reveal: { item: HTMLElement; side: ListItemRevealSide };\n /** Emitted when the item becomes selected (only meaningful inside a `selectable` `ore-list`). */\n select: { item: HTMLElement; value: null | string };\n};\n\n/** List-item component properties */\nexport type OreListItemProps = {\n /** Disable this item — blocks pointer interaction, swipe actions, and selection */\n disabled?: boolean;\n /** Which action panel is revealed: 'left' | 'right' (absent = closed). Settable programmatically. */\n revealed?: ListItemRevealSide;\n /**\n * Opaque value compared against the parent `selectable` `ore-list`'s own `value` to derive\n * `selected` — required for selection to work. There's no separate `selected` prop: the parent\n * list's `value` is the single source of truth, so this item's selected state can't drift from\n * it. Also reported in `select`/`deselect`/the parent's `change` event.\n */\n value?: string;\n};\n\n/** Maps a reveal side to its slot name — the one place this pairing is spelled out. */\nconst actionSlot = (side: ListItemRevealSide): 'actions-left' | 'actions-right' =>\n side === 'left' ? 'actions-left' : 'actions-right';\n\n/**\n * A single row inside `ore-list`. Renders `leading`/default (title)/`description`/`trailing`\n * content plus two off-canvas action panels (`actions-left`, `actions-right`) that a horizontal\n * pointer/touch swipe reveals — useful for mobile-style row actions (archive, delete, …). An\n * action panel only opens if it actually has slotted content; swiping the other direction is a\n * no-op. Revealed actions stay reachable from the keyboard (Tab focus on a slotted action button\n * reveals its panel via `:focus-within`, independent of any gesture).\n *\n * Swiping past the reveal distance snaps the panel fully open on release; swiping further still —\n * past the full-swipe-through distance — auto-confirms that side's action immediately (fires\n * `confirm` and clicks the slot's first element), the same \"swipe all the way\" shortcut as iOS\n * Mail's delete gesture.\n *\n * Closing a revealed panel is deliberately one-directional: tap/click the row itself, tap outside\n * the item, or open a different item's panel. Reverse-swiping an already-open item is not\n * supported — see `ore-list`'s docs for the reasoning.\n *\n * @element ore-list-item\n *\n * @attr {boolean} disabled - Disable this item\n * @attr {boolean} selected - Read-only reflected attribute: `true` when this item's `value` matches the parent `ore-list`'s `value`. Not independently settable.\n * @attr {string} value - Opaque value compared against the parent list's `value` to derive `selected`; also reported in select/change events\n * @attr {string} revealed - Which action panel is revealed: 'left' | 'right'\n *\n * @fires select - Item becomes selected. detail: { item: HTMLElement, value: string | null }\n * @fires deselect - Item becomes deselected. detail: { item: HTMLElement, value: string | null }\n * @fires reveal - An action panel opens. detail: { item: HTMLElement, side: 'left' | 'right' }\n * @fires conceal - The revealed action panel closes. detail: { item: HTMLElement }\n * @fires confirm - Swiped all the way through — fires before the slotted action's own click. detail: { item: HTMLElement, side: 'left' | 'right' }\n *\n * @slot leading - Content before the title (e.g. icon, avatar)\n * @slot - Item title\n * @slot description - Secondary line below the title\n * @slot trailing - Content after the title (e.g. meta text, chevron)\n * @slot actions-left - Buttons revealed by swiping right (or focusing into this slot)\n * @slot actions-right - Buttons revealed by swiping left (or focusing into this slot)\n *\n * @cssprop --list-item-actions-width - Width of each action panel (default 6rem)\n * @cssprop --list-item-bg - Row background color\n * @cssprop --list-item-hover-bg - Row background on hover\n * @cssprop --list-item-selected-bg - Row background when selected\n * @part row - The row wrapper (focusable, swipeable)\n * @part leading - The leading slot container\n * @part content - The title + description container\n * @part title - The title slot container\n * @part description - The description slot container\n * @part trailing - The trailing slot container\n * @part actions-start - The left action panel container\n * @part actions-end - The right action panel container\n * @example\n * ```html\n * <ore-list-item>\n * <ore-icon slot=\"leading\" name=\"mail\"></ore-icon>\n * Inbox\n * <span slot=\"trailing\">12</span>\n * </ore-list-item>\n * <ore-list-item>\n * Newsletter\n * <span slot=\"description\">From Acme Inc.</span>\n * <ore-button slot=\"actions-right\" color=\"error\">Delete</ore-button>\n * </ore-list-item>\n * ```\n */\nexport const LIST_ITEM_TAG = 'ore-list-item' as const;\ndefine<OreListItemProps>(LIST_ITEM_TAG, {\n props: {\n ...disablableBundle,\n revealed: prop.oneOf<ListItemRevealSide | undefined>(['left', 'right'], undefined),\n value: prop.string(),\n },\n\n setup(props) {\n const el = getHost();\n const emit = useEmit<OreListItemEvents>();\n const slots = useSlots<'actions-left' | 'actions-right' | 'description' | 'leading' | 'trailing'>();\n\n const listCtx = inject(LIST_CTX);\n const isSelectable = computed(() => Boolean(listCtx?.selectable.value));\n // Derived, not owned: `ore-list`'s `value` is the single source of truth, so this can never\n // drift out of sync with a sibling the way an independently-settable `selected` prop could.\n const isSelected = computed(\n () => props.value.value != null && listCtx != null && listCtx.value.value === props.value.value,\n );\n\n const hasActions = (side: ListItemRevealSide): boolean => slots.has(actionSlot(side)).value;\n\n const swipe = createRevealState(el, {\n disabled: computed(() => props.disabled.value || Boolean(props.revealed.value)),\n hasActions,\n // Clicks the slot's own first element (the common case: a single action button) so its own\n // click handler runs the real action — `confirm` covers slots without a clickable element.\n onConfirm: (side) => {\n const target = slots.elements(actionSlot(side)).value[0] as HTMLElement | undefined;\n\n emit('confirm', { item: el, side });\n target?.click();\n },\n });\n\n onCleanup(() => swipe.dispose());\n\n // Reflects the derived `selected` state as a plain boolean attribute — the styling/\n // `[selected]`-selector hook — the same way `prop.bool()`'s own reflection would, since it\n // isn't a real settable prop anymore.\n watchEffect(() => {\n el.toggleAttribute('selected', isSelected.value);\n });\n\n // Emits select/deselect/reveal/conceal for both gesture-driven AND externally-set (attribute,\n // or the parent list's `value`) state changes — the plain-reflected-prop equivalent of\n // ore-accordion-item's native <details> `toggle`-event listener (there's no backing native\n // element here to piggyback on).\n let lastSelected = isSelected.value;\n\n watchEffect(() => {\n const current = isSelected.value;\n\n if (current === lastSelected) return;\n\n lastSelected = current;\n emit(current ? 'select' : 'deselect', { item: el, value: props.value.value ?? null });\n });\n\n let lastRevealed = props.revealed.value ?? null;\n\n watchEffect(() => {\n const current = props.revealed.value ?? null;\n\n if (current === lastRevealed) return;\n\n lastRevealed = current;\n\n if (current) {\n // Only one item may have its swipe actions revealed at a time — tell the list directly\n // instead of dispatching an event for it to listen for.\n listCtx?.requestReveal(el);\n emit('reveal', { item: el, side: current });\n } else {\n emit('conceal', { item: el });\n }\n });\n\n const handleActivate = (event: Event): void => {\n if (props.disabled.value) return;\n\n if (props.revealed.value) {\n event.preventDefault();\n event.stopPropagation();\n el.removeAttribute('revealed');\n\n return;\n }\n\n if (!isSelectable.value) return;\n\n const value = props.value.value;\n\n // Re-clicking an already-selected item deselects it; a value is required to select at all\n // (undefined would otherwise match every valueless item at once).\n if (value != null) listCtx?.select(isSelected.value ? undefined : value);\n };\n\n const handleRowKeydown = (event: KeyboardEvent): void => {\n if (event.key !== 'Enter' && event.key !== ' ') return;\n\n if (props.disabled.value || (!props.revealed.value && !isSelectable.value)) return;\n\n event.preventDefault();\n handleActivate(event);\n };\n\n bind({\n attr: {\n 'aria-disabled': () => (props.disabled.value ? 'true' : null),\n 'aria-selected': () => (isSelectable.value ? String(isSelected.value) : null),\n role: () => (isSelectable.value ? 'option' : 'listitem'),\n },\n });\n\n return html`\n <div\n class=\"row\"\n part=\"row\"\n tabindex=\"${() => (props.disabled.value ? '-1' : '0')}\"\n @click=\"${handleActivate}\"\n @keydown=\"${handleRowKeydown}\"\n @pointercancel=\"${(e: PointerEvent) => swipe.handlePointerCancel(e)}\"\n @pointerdown=\"${(e: PointerEvent) => swipe.handlePointerDown(e)}\"\n @pointermove=\"${(e: PointerEvent) => swipe.handlePointerMove(e)}\"\n @pointerup=\"${(e: PointerEvent) => swipe.handlePointerUp(e)}\">\n <span class=\"leading\" part=\"leading\"><slot name=\"leading\"></slot></span>\n <span class=\"content\" part=\"content\">\n <span class=\"title\" part=\"title\"><slot></slot></span>\n <span class=\"description\" part=\"description\"><slot name=\"description\"></slot></span>\n </span>\n <span class=\"trailing\" part=\"trailing\"><slot name=\"trailing\"></slot></span>\n </div>\n <span class=\"actions actions-left\" part=\"actions-start\"><slot name=\"actions-left\"></slot></span>\n <span class=\"actions actions-right\" part=\"actions-end\"><slot name=\"actions-right\"></slot></span>\n `;\n },\n\n shadow: { delegatesFocus: true },\n styles: [reducedMotionMixin, componentStyles],\n});\n"],"mappings":"wVA6CA,IAAM,EAAc,GAClB,IAAS,OAAS,eAAiB,gBAiExB,EAAgB,iBAC7B,EAAA,EAAA,OAAA,CAAyB,EAAe,CACtC,MAAO,CACL,GAAG,EAAA,iBACH,SAAU,EAAA,KAAK,MAAsC,CAAC,OAAQ,OAAO,EAAG,IAAA,EAAS,EACjF,MAAO,EAAA,KAAK,OAAO,CACrB,EAEA,MAAM,EAAO,CACX,IAAM,GAAA,EAAK,EAAA,QAAA,CAAQ,EACb,GAAA,EAAO,EAAA,QAAA,CAA2B,EAClC,GAAA,EAAQ,EAAA,SAAA,CAAoF,EAE5F,GAAA,EAAU,EAAA,OAAA,CAAO,EAAA,QAAQ,EACzB,GAAA,EAAe,EAAA,SAAA,KAAe,EAAQ,GAAS,WAAW,KAAM,EAGhE,GAAA,EAAa,EAAA,SAAA,KACX,EAAM,MAAM,OAAS,MAAQ,GAAW,MAAQ,EAAQ,MAAM,QAAU,EAAM,MAAM,KAC5F,EAIM,EAAQ,EAAA,kBAAkB,EAAI,CAClC,UAAA,EAAU,EAAA,SAAA,KAAe,EAAM,SAAS,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M,SAAS,MAAQ,OAAS,KACxD,oBAAwB,EAAa,MAAQ,OAAO,EAAW,KAAK,EAAI,KACxE,SAAa,EAAa,MAAQ,SAAW,UAC/C,CACF,CAAC,EAEM,EAAA,IAAI;;;;wBAIY,EAAM,SAAS,MAAQ,KAAO,IAAK;kBAC5C,EAAe;oBAtBH,GAA+B,EACnD,EAAM,MAAQ,SAAW,EAAM,MAAQ,OAEvC,EAAM,SAAS,OAAU,CAAC,EAAM,SAAS,OAAS,CAAC,EAAa,QAEpE,EAAM,eAAe,EACrB,EAAe,CAAK,GACtB,EAgBiC;0BACV,GAAoB,EAAM,oBAAoB,CAAC,EAAE;wBACnD,GAAoB,EAAM,kBAAkB,CAAC,EAAE;wBAC/C,GAAoB,EAAM,kBAAkB,CAAC,EAAE;sBACjD,GAAoB,EAAM,gBAAgB,CAAC,EAAE;;;;;;;;;;KAWlE,EAEA,OAAQ,CAAE,eAAgB,EAAK,EAC/B,OAAQ,CAAC,EAAA,mBAAoB,EAAA,OAAe,CAC9C,CAAC"}
1
+ {"version":3,"file":"list-item.cjs","names":[],"sources":["../src/content/list/list-item.ts"],"sourcesContent":["import {\n bind,\n define,\n getHost,\n html,\n inject,\n onCleanup,\n onMounted,\n prop,\n useEmit,\n useSlots,\n watchEffect,\n} from '@vielzeug/ore';\nimport { computed } from '@vielzeug/ripple';\n\nimport { disablableBundle } from '../../shared';\nimport { reducedMotionMixin } from '../../styles';\nimport { createRevealState } from './_list-item-reveal';\nimport { LIST_CTX } from './list';\nimport componentStyles from './list-item.css?inline';\n\n/** Which side's action panel is currently revealed on a list item. */\nexport type ListItemRevealSide = 'left' | 'right';\n\n/** Events emitted by the list-item component */\nexport type OreListItemEvents = {\n /** Emitted when the revealed action panel closes (gesture, tap, or programmatic). */\n conceal: { item: HTMLElement };\n /**\n * Emitted when a swipe crosses the full-swipe-through distance — the \"swiped all the way\"\n * confirm gesture. Fired just before the slotted action's own click (if any).\n */\n confirm: { item: HTMLElement; side: ListItemRevealSide };\n /** Emitted when the item becomes deselected. */\n deselect: { item: HTMLElement; value: null | string };\n /** Emitted when a swipe/focus reveals an action panel. */\n reveal: { item: HTMLElement; side: ListItemRevealSide };\n /** Emitted when the item becomes selected (only meaningful inside a `selectable` `ore-list`). */\n select: { item: HTMLElement; value: null | string };\n};\n\n/** List-item component properties */\nexport type OreListItemProps = {\n /** Disable this item — blocks pointer interaction, swipe actions, and selection */\n disabled?: boolean;\n /** Which action panel is revealed: 'left' | 'right' (absent = closed). Settable programmatically. */\n revealed?: ListItemRevealSide;\n /**\n * Opaque value compared against the parent `selectable` `ore-list`'s own `value` to derive\n * `selected` — required for selection to work. There's no separate `selected` prop: the parent\n * list's `value` is the single source of truth, so this item's selected state can't drift from\n * it. Also reported in `select`/`deselect`/the parent's `change` event.\n */\n value?: string;\n};\n\n/** Maps a reveal side to its slot name — the one place this pairing is spelled out. */\nconst actionSlot = (side: ListItemRevealSide): 'actions-left' | 'actions-right' =>\n side === 'left' ? 'actions-left' : 'actions-right';\n\n/**\n * A single row inside `ore-list`. Renders `leading`/default (title)/`description`/`trailing`\n * content plus two off-canvas action panels (`actions-left`, `actions-right`) that a horizontal\n * pointer/touch swipe reveals — useful for mobile-style row actions (archive, delete, …). An\n * action panel only opens if it actually has slotted content; swiping the other direction is a\n * no-op. Revealed actions stay reachable from the keyboard (Tab focus on a slotted action button\n * reveals its panel via `:focus-within`, independent of any gesture).\n *\n * Swiping past the reveal distance snaps the panel fully open on release; swiping further still —\n * past the full-swipe-through distance — auto-confirms that side's action immediately (fires\n * `confirm` and clicks the slot's first element), the same \"swipe all the way\" shortcut as iOS\n * Mail's delete gesture.\n *\n * Closing a revealed panel is deliberately one-directional: tap/click the row itself, tap outside\n * the item, or open a different item's panel. Reverse-swiping an already-open item is not\n * supported — see `ore-list`'s docs for the reasoning.\n *\n * @element ore-list-item\n *\n * @attr {boolean} disabled - Disable this item\n * @attr {boolean} selected - Read-only reflected attribute: `true` when this item's `value` matches the parent `ore-list`'s `value`. Not independently settable.\n * @attr {string} value - Opaque value compared against the parent list's `value` to derive `selected`; also reported in select/change events\n * @attr {string} revealed - Which action panel is revealed: 'left' | 'right'\n *\n * @fires select - Item becomes selected. detail: { item: HTMLElement, value: string | null }\n * @fires deselect - Item becomes deselected. detail: { item: HTMLElement, value: string | null }\n * @fires reveal - An action panel opens. detail: { item: HTMLElement, side: 'left' | 'right' }\n * @fires conceal - The revealed action panel closes. detail: { item: HTMLElement }\n * @fires confirm - Swiped all the way through — fires before the slotted action's own click. detail: { item: HTMLElement, side: 'left' | 'right' }\n *\n * @slot leading - Content before the title (e.g. icon, avatar)\n * @slot - Item title\n * @slot description - Secondary line below the title\n * @slot trailing - Content after the title (e.g. meta text, chevron)\n * @slot actions-left - Buttons revealed by swiping right (or focusing into this slot)\n * @slot actions-right - Buttons revealed by swiping left (or focusing into this slot)\n *\n * @cssprop --list-item-actions-width - Width of each action panel (default 6rem)\n * @cssprop --list-item-bg - Row background color\n * @cssprop --list-item-hover-bg - Row background on hover\n * @cssprop --list-item-selected-bg - Row background when selected\n * @part row - The row wrapper (focusable, swipeable)\n * @part leading - The leading slot container\n * @part content - The title + description container\n * @part title - The title slot container\n * @part description - The description slot container\n * @part trailing - The trailing slot container\n * @part actions-start - The left action panel container\n * @part actions-end - The right action panel container\n * @example\n * ```html\n * <ore-list-item>\n * <ore-icon slot=\"leading\" name=\"mail\"></ore-icon>\n * Inbox\n * <span slot=\"trailing\">12</span>\n * </ore-list-item>\n * <ore-list-item>\n * Newsletter\n * <span slot=\"description\">From Acme Inc.</span>\n * <ore-button slot=\"actions-right\" color=\"error\">Delete</ore-button>\n * </ore-list-item>\n * ```\n */\nexport const LIST_ITEM_TAG = 'ore-list-item' as const;\ndefine<OreListItemProps>(LIST_ITEM_TAG, {\n props: {\n ...disablableBundle,\n revealed: prop.oneOf<ListItemRevealSide | undefined>(['left', 'right'], undefined),\n value: prop.string(),\n },\n\n setup(props) {\n const el = getHost();\n const emit = useEmit<OreListItemEvents>();\n const slots = useSlots<'actions-left' | 'actions-right' | 'description' | 'leading' | 'trailing'>();\n\n const listCtx = inject(LIST_CTX);\n const isSelectable = computed(() => Boolean(listCtx?.selectable.value));\n // Derived, not owned: `ore-list`'s `value` is the single source of truth, so this can never\n // drift out of sync with a sibling the way an independently-settable `selected` prop could.\n const isSelected = computed(\n () => props.value.value != null && listCtx != null && listCtx.value.value === props.value.value,\n );\n\n const hasActions = (side: ListItemRevealSide): boolean => slots.has(actionSlot(side)).value;\n\n onMounted(() => {\n const row = el.shadowRoot?.querySelector<HTMLElement>('.row');\n\n if (!row) return;\n\n const pan = createRevealState(el, row, {\n disabled: computed(() => props.disabled.value || Boolean(props.revealed.value)),\n hasActions,\n // Clicks the slot's own first element (the common case: a single action button) so its own\n // click handler runs the real action — `confirm` covers slots without a clickable element.\n onConfirm: (side) => {\n const target = slots.elements(actionSlot(side)).value[0] as HTMLElement | undefined;\n\n emit('confirm', { item: el, side });\n target?.click();\n },\n });\n\n onCleanup(() => pan.dispose());\n });\n\n // Reflects the derived `selected` state as a plain boolean attribute — the styling/\n // `[selected]`-selector hook — the same way `prop.bool()`'s own reflection would, since it\n // isn't a real settable prop anymore.\n watchEffect(() => {\n el.toggleAttribute('selected', isSelected.value);\n });\n\n // Emits select/deselect/reveal/conceal for both gesture-driven AND externally-set (attribute,\n // or the parent list's `value`) state changes — the plain-reflected-prop equivalent of\n // ore-accordion-item's native <details> `toggle`-event listener (there's no backing native\n // element here to piggyback on).\n let lastSelected = isSelected.value;\n\n watchEffect(() => {\n const current = isSelected.value;\n\n if (current === lastSelected) return;\n\n lastSelected = current;\n emit(current ? 'select' : 'deselect', { item: el, value: props.value.value ?? null });\n });\n\n let lastRevealed = props.revealed.value ?? null;\n\n watchEffect(() => {\n const current = props.revealed.value ?? null;\n\n if (current === lastRevealed) return;\n\n lastRevealed = current;\n\n if (current) {\n // Only one item may have its swipe actions revealed at a time — tell the list directly\n // instead of dispatching an event for it to listen for.\n listCtx?.requestReveal(el);\n emit('reveal', { item: el, side: current });\n } else {\n emit('conceal', { item: el });\n }\n });\n\n const handleActivate = (event: Event): void => {\n if (props.disabled.value) return;\n\n if (props.revealed.value) {\n event.preventDefault();\n event.stopPropagation();\n el.removeAttribute('revealed');\n\n return;\n }\n\n if (!isSelectable.value) return;\n\n const value = props.value.value;\n\n // Re-clicking an already-selected item deselects it; a value is required to select at all\n // (undefined would otherwise match every valueless item at once).\n if (value != null) listCtx?.select(isSelected.value ? undefined : value);\n };\n\n const handleRowKeydown = (event: KeyboardEvent): void => {\n if (event.key !== 'Enter' && event.key !== ' ') return;\n\n if (props.disabled.value || (!props.revealed.value && !isSelectable.value)) return;\n\n event.preventDefault();\n handleActivate(event);\n };\n\n bind({\n attr: {\n 'aria-disabled': () => (props.disabled.value ? 'true' : null),\n 'aria-selected': () => (isSelectable.value ? String(isSelected.value) : null),\n role: () => (isSelectable.value ? 'option' : 'listitem'),\n },\n });\n\n return html`\n <div\n class=\"row\"\n part=\"row\"\n tabindex=\"${() => (props.disabled.value ? '-1' : '0')}\"\n @click=\"${handleActivate}\"\n @keydown=\"${handleRowKeydown}\">\n <span class=\"leading\" part=\"leading\"><slot name=\"leading\"></slot></span>\n <span class=\"content\" part=\"content\">\n <span class=\"title\" part=\"title\"><slot></slot></span>\n <span class=\"description\" part=\"description\"><slot name=\"description\"></slot></span>\n </span>\n <span class=\"trailing\" part=\"trailing\"><slot name=\"trailing\"></slot></span>\n </div>\n <span class=\"actions actions-left\" part=\"actions-start\"><slot name=\"actions-left\"></slot></span>\n <span class=\"actions actions-right\" part=\"actions-end\"><slot name=\"actions-right\"></slot></span>\n `;\n },\n\n shadow: { delegatesFocus: true },\n styles: [reducedMotionMixin, componentStyles],\n});\n"],"mappings":"wVAyDA,IAAM,EAAc,GAClB,IAAS,OAAS,eAAiB,gBAiExB,EAAgB,iBAC7B,EAAA,EAAA,OAAA,CAAyB,EAAe,CACtC,MAAO,CACL,GAAG,EAAA,iBACH,SAAU,EAAA,KAAK,MAAsC,C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F,CAAC,EAED,IAAI,EAAe,EAAM,SAAS,OAAS,MAE3C,EAAA,EAAA,YAAA,KAAkB,CAChB,IAAM,EAAU,EAAM,SAAS,OAAS,KAEpC,IAAY,IAEhB,EAAe,EAEX,GAGF,GAAS,cAAc,CAAE,EACzB,EAAK,SAAU,CAAE,KAAM,EAAI,KAAM,CAAQ,CAAC,GAE1C,EAAK,UAAW,CAAE,KAAM,CAAG,CAAC,EAEhC,CAAC,EAED,IAAM,EAAkB,GAAuB,CAC7C,GAAI,EAAM,SAAS,MAAO,OAE1B,GAAI,EAAM,SAAS,MAAO,CACxB,EAAM,eAAe,EACrB,EAAM,gBAAgB,EACtB,EAAG,gBAAgB,UAAU,EAE7B,MACF,CAEA,GAAI,CAAC,EAAa,MAAO,OAEzB,IAAM,EAAQ,EAAM,MAAM,MAItB,GAAS,MAAM,GAAS,OAAO,EAAW,MAAQ,IAAA,GAAY,CAAK,CACzE,EAmBA,OARA,EAAA,EAAA,KAAA,CAAK,CACH,KAAM,CACJ,oBAAwB,EAAM,SAAS,MAAQ,OAAS,KACxD,oBAAwB,EAAa,MAAQ,OAAO,EAAW,KAAK,EAAI,KACxE,SAAa,EAAa,MAAQ,SAAW,UAC/C,CACF,CAAC,EAEM,EAAA,IAAI;;;;wBAIY,EAAM,SAAS,MAAQ,KAAO,IAAK;kBAC5C,EAAe;oBAtBH,GAA+B,EACnD,EAAM,MAAQ,SAAW,EAAM,MAAQ,OAEvC,EAAM,SAAS,OAAU,CAAC,EAAM,SAAS,OAAS,CAAC,EAAa,QAEpE,EAAM,eAAe,EACrB,EAAe,CAAK,GACtB,EAgBiC;;;;;;;;;;KAWnC,EAEA,OAAQ,CAAE,eAAgB,EAAK,EAC/B,OAAQ,CAAC,EAAA,mBAAoB,EAAA,OAAe,CAC9C,CAAC"}
package/dist/list-item.js CHANGED
@@ -3,74 +3,75 @@ import { disablableBundle as t } from "./shared/prop-bundles.js";
3
3
  import { LIST_CTX as n } from "./list.js";
4
4
  import { createRevealState as r } from "./content/list/_list-item-reveal.js";
5
5
  import i from "./content/list/list-item.css.js";
6
- import { bind as a, define as o, getHost as s, html as c, inject as l, onCleanup as u, prop as d, useEmit as f, useSlots as p, watchEffect as m } from "@vielzeug/ore";
7
- import { computed as h } from "@vielzeug/ripple";
6
+ import { bind as a, define as o, getHost as s, html as c, inject as l, onCleanup as u, onMounted as d, prop as f, useEmit as p, useSlots as m, watchEffect as h } from "@vielzeug/ore";
7
+ import { computed as g } from "@vielzeug/ripple";
8
8
  //#region src/content/list/list-item.ts
9
- var g = (e) => e === "left" ? "actions-left" : "actions-right", _ = "ore-list-item";
10
- o(_, {
9
+ var _ = (e) => e === "left" ? "actions-left" : "actions-right", v = "ore-list-item";
10
+ o(v, {
11
11
  props: {
12
12
  ...t,
13
- revealed: d.oneOf(["left", "right"], void 0),
14
- value: d.string()
13
+ revealed: f.oneOf(["left", "right"], void 0),
14
+ value: f.string()
15
15
  },
16
16
  setup(e) {
17
- let t = s(), i = f(), o = p(), d = l(n), _ = h(() => !!d?.selectable.value), v = h(() => e.value.value != null && d != null && d.value.value === e.value.value), y = r(t, {
18
- disabled: h(() => e.disabled.value || !!e.revealed.value),
19
- hasActions: (e) => o.has(g(e)).value,
20
- onConfirm: (e) => {
21
- let n = o.elements(g(e)).value[0];
22
- i("confirm", {
23
- item: t,
24
- side: e
25
- }), n?.click();
26
- }
27
- });
28
- u(() => y.dispose()), m(() => {
29
- t.toggleAttribute("selected", v.value);
17
+ let t = s(), i = p(), o = m(), f = l(n), v = g(() => !!f?.selectable.value), y = g(() => e.value.value != null && f != null && f.value.value === e.value.value), b = (e) => o.has(_(e)).value;
18
+ d(() => {
19
+ let n = t.shadowRoot?.querySelector(".row");
20
+ if (!n) return;
21
+ let a = r(t, n, {
22
+ disabled: g(() => e.disabled.value || !!e.revealed.value),
23
+ hasActions: b,
24
+ onConfirm: (e) => {
25
+ let n = o.elements(_(e)).value[0];
26
+ i("confirm", {
27
+ item: t,
28
+ side: e
29
+ }), n?.click();
30
+ }
31
+ });
32
+ u(() => a.dispose());
33
+ }), h(() => {
34
+ t.toggleAttribute("selected", y.value);
30
35
  });
31
- let b = v.value;
32
- m(() => {
33
- let n = v.value;
34
- n !== b && (b = n, i(n ? "select" : "deselect", {
36
+ let x = y.value;
37
+ h(() => {
38
+ let n = y.value;
39
+ n !== x && (x = n, i(n ? "select" : "deselect", {
35
40
  item: t,
36
41
  value: e.value.value ?? null
37
42
  }));
38
43
  });
39
- let x = e.revealed.value ?? null;
40
- m(() => {
44
+ let S = e.revealed.value ?? null;
45
+ h(() => {
41
46
  let n = e.revealed.value ?? null;
42
- n !== x && (x = n, n ? (d?.requestReveal(t), i("reveal", {
47
+ n !== S && (S = n, n ? (f?.requestReveal(t), i("reveal", {
43
48
  item: t,
44
49
  side: n
45
50
  })) : i("conceal", { item: t }));
46
51
  });
47
- let S = (n) => {
52
+ let C = (n) => {
48
53
  if (e.disabled.value) return;
49
54
  if (e.revealed.value) {
50
55
  n.preventDefault(), n.stopPropagation(), t.removeAttribute("revealed");
51
56
  return;
52
57
  }
53
- if (!_.value) return;
58
+ if (!v.value) return;
54
59
  let r = e.value.value;
55
- r != null && d?.select(v.value ? void 0 : r);
60
+ r != null && f?.select(y.value ? void 0 : r);
56
61
  };
57
62
  return a({ attr: {
58
63
  "aria-disabled": () => e.disabled.value ? "true" : null,
59
- "aria-selected": () => _.value ? String(v.value) : null,
60
- role: () => _.value ? "option" : "listitem"
64
+ "aria-selected": () => v.value ? String(y.value) : null,
65
+ role: () => v.value ? "option" : "listitem"
61
66
  } }), c`
62
67
  <div
63
68
  class="row"
64
69
  part="row"
65
70
  tabindex="${() => e.disabled.value ? "-1" : "0"}"
66
- @click="${S}"
71
+ @click="${C}"
67
72
  @keydown="${(t) => {
68
- (t.key === "Enter" || t.key === " ") && (e.disabled.value || !e.revealed.value && !_.value || (t.preventDefault(), S(t)));
69
- }}"
70
- @pointercancel="${(e) => y.handlePointerCancel(e)}"
71
- @pointerdown="${(e) => y.handlePointerDown(e)}"
72
- @pointermove="${(e) => y.handlePointerMove(e)}"
73
- @pointerup="${(e) => y.handlePointerUp(e)}">
73
+ (t.key === "Enter" || t.key === " ") && (e.disabled.value || !e.revealed.value && !v.value || (t.preventDefault(), C(t)));
74
+ }}">
74
75
  <span class="leading" part="leading"><slot name="leading"></slot></span>
75
76
  <span class="content" part="content">
76
77
  <span class="title" part="title"><slot></slot></span>
@@ -86,6 +87,6 @@ o(_, {
86
87
  styles: [e, i]
87
88
  });
88
89
  //#endregion
89
- export { _ as LIST_ITEM_TAG };
90
+ export { v as LIST_ITEM_TAG };
90
91
 
91
92
  //# sourceMappingURL=list-item.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"list-item.js","names":[],"sources":["../src/content/list/list-item.ts"],"sourcesContent":["import { bind, define, getHost, html, inject, onCleanup, prop, useEmit, useSlots, watchEffect } from '@vielzeug/ore';\nimport { computed } from '@vielzeug/ripple';\n\nimport { disablableBundle } from '../../shared';\nimport { reducedMotionMixin } from '../../styles';\nimport { createRevealState } from './_list-item-reveal';\nimport { LIST_CTX } from './list';\nimport componentStyles from './list-item.css?inline';\n\n/** Which side's action panel is currently revealed on a list item. */\nexport type ListItemRevealSide = 'left' | 'right';\n\n/** Events emitted by the list-item component */\nexport type OreListItemEvents = {\n /** Emitted when the revealed action panel closes (gesture, tap, or programmatic). */\n conceal: { item: HTMLElement };\n /**\n * Emitted when a swipe crosses the full-swipe-through distance — the \"swiped all the way\"\n * confirm gesture. Fired just before the slotted action's own click (if any).\n */\n confirm: { item: HTMLElement; side: ListItemRevealSide };\n /** Emitted when the item becomes deselected. */\n deselect: { item: HTMLElement; value: null | string };\n /** Emitted when a swipe/focus reveals an action panel. */\n reveal: { item: HTMLElement; side: ListItemRevealSide };\n /** Emitted when the item becomes selected (only meaningful inside a `selectable` `ore-list`). */\n select: { item: HTMLElement; value: null | string };\n};\n\n/** List-item component properties */\nexport type OreListItemProps = {\n /** Disable this item — blocks pointer interaction, swipe actions, and selection */\n disabled?: boolean;\n /** Which action panel is revealed: 'left' | 'right' (absent = closed). Settable programmatically. */\n revealed?: ListItemRevealSide;\n /**\n * Opaque value compared against the parent `selectable` `ore-list`'s own `value` to derive\n * `selected` — required for selection to work. There's no separate `selected` prop: the parent\n * list's `value` is the single source of truth, so this item's selected state can't drift from\n * it. Also reported in `select`/`deselect`/the parent's `change` event.\n */\n value?: string;\n};\n\n/** Maps a reveal side to its slot name — the one place this pairing is spelled out. */\nconst actionSlot = (side: ListItemRevealSide): 'actions-left' | 'actions-right' =>\n side === 'left' ? 'actions-left' : 'actions-right';\n\n/**\n * A single row inside `ore-list`. Renders `leading`/default (title)/`description`/`trailing`\n * content plus two off-canvas action panels (`actions-left`, `actions-right`) that a horizontal\n * pointer/touch swipe reveals — useful for mobile-style row actions (archive, delete, …). An\n * action panel only opens if it actually has slotted content; swiping the other direction is a\n * no-op. Revealed actions stay reachable from the keyboard (Tab focus on a slotted action button\n * reveals its panel via `:focus-within`, independent of any gesture).\n *\n * Swiping past the reveal distance snaps the panel fully open on release; swiping further still —\n * past the full-swipe-through distance — auto-confirms that side's action immediately (fires\n * `confirm` and clicks the slot's first element), the same \"swipe all the way\" shortcut as iOS\n * Mail's delete gesture.\n *\n * Closing a revealed panel is deliberately one-directional: tap/click the row itself, tap outside\n * the item, or open a different item's panel. Reverse-swiping an already-open item is not\n * supported — see `ore-list`'s docs for the reasoning.\n *\n * @element ore-list-item\n *\n * @attr {boolean} disabled - Disable this item\n * @attr {boolean} selected - Read-only reflected attribute: `true` when this item's `value` matches the parent `ore-list`'s `value`. Not independently settable.\n * @attr {string} value - Opaque value compared against the parent list's `value` to derive `selected`; also reported in select/change events\n * @attr {string} revealed - Which action panel is revealed: 'left' | 'right'\n *\n * @fires select - Item becomes selected. detail: { item: HTMLElement, value: string | null }\n * @fires deselect - Item becomes deselected. detail: { item: HTMLElement, value: string | null }\n * @fires reveal - An action panel opens. detail: { item: HTMLElement, side: 'left' | 'right' }\n * @fires conceal - The revealed action panel closes. detail: { item: HTMLElement }\n * @fires confirm - Swiped all the way through — fires before the slotted action's own click. detail: { item: HTMLElement, side: 'left' | 'right' }\n *\n * @slot leading - Content before the title (e.g. icon, avatar)\n * @slot - Item title\n * @slot description - Secondary line below the title\n * @slot trailing - Content after the title (e.g. meta text, chevron)\n * @slot actions-left - Buttons revealed by swiping right (or focusing into this slot)\n * @slot actions-right - Buttons revealed by swiping left (or focusing into this slot)\n *\n * @cssprop --list-item-actions-width - Width of each action panel (default 6rem)\n * @cssprop --list-item-bg - Row background color\n * @cssprop --list-item-hover-bg - Row background on hover\n * @cssprop --list-item-selected-bg - Row background when selected\n * @part row - The row wrapper (focusable, swipeable)\n * @part leading - The leading slot container\n * @part content - The title + description container\n * @part title - The title slot container\n * @part description - The description slot container\n * @part trailing - The trailing slot container\n * @part actions-start - The left action panel container\n * @part actions-end - The right action panel container\n * @example\n * ```html\n * <ore-list-item>\n * <ore-icon slot=\"leading\" name=\"mail\"></ore-icon>\n * Inbox\n * <span slot=\"trailing\">12</span>\n * </ore-list-item>\n * <ore-list-item>\n * Newsletter\n * <span slot=\"description\">From Acme Inc.</span>\n * <ore-button slot=\"actions-right\" color=\"error\">Delete</ore-button>\n * </ore-list-item>\n * ```\n */\nexport const LIST_ITEM_TAG = 'ore-list-item' as const;\ndefine<OreListItemProps>(LIST_ITEM_TAG, {\n props: {\n ...disablableBundle,\n revealed: prop.oneOf<ListItemRevealSide | undefined>(['left', 'right'], undefined),\n value: prop.string(),\n },\n\n setup(props) {\n const el = getHost();\n const emit = useEmit<OreListItemEvents>();\n const slots = useSlots<'actions-left' | 'actions-right' | 'description' | 'leading' | 'trailing'>();\n\n const listCtx = inject(LIST_CTX);\n const isSelectable = computed(() => Boolean(listCtx?.selectable.value));\n // Derived, not owned: `ore-list`'s `value` is the single source of truth, so this can never\n // drift out of sync with a sibling the way an independently-settable `selected` prop could.\n const isSelected = computed(\n () => props.value.value != null && listCtx != null && listCtx.value.value === props.value.value,\n );\n\n const hasActions = (side: ListItemRevealSide): boolean => slots.has(actionSlot(side)).value;\n\n const swipe = createRevealState(el, {\n disabled: computed(() => props.disabled.value || Boolean(props.revealed.value)),\n hasActions,\n // Clicks the slot's own first element (the common case: a single action button) so its own\n // click handler runs the real action — `confirm` covers slots without a clickable element.\n onConfirm: (side) => {\n const target = slots.elements(actionSlot(side)).value[0] as HTMLElement | undefined;\n\n emit('confirm', { item: el, side });\n target?.click();\n },\n });\n\n onCleanup(() => swipe.dispose());\n\n // Reflects the derived `selected` state as a plain boolean attribute — the styling/\n // `[selected]`-selector hook — the same way `prop.bool()`'s own reflection would, since it\n // isn't a real settable prop anymore.\n watchEffect(() => {\n el.toggleAttribute('selected', isSelected.value);\n });\n\n // Emits select/deselect/reveal/conceal for both gesture-driven AND externally-set (attribute,\n // or the parent list's `value`) state changes — the plain-reflected-prop equivalent of\n // ore-accordion-item's native <details> `toggle`-event listener (there's no backing native\n // element here to piggyback on).\n let lastSelected = isSelected.value;\n\n watchEffect(() => {\n const current = isSelected.value;\n\n if (current === lastSelected) return;\n\n lastSelected = current;\n emit(current ? 'select' : 'deselect', { item: el, value: props.value.value ?? null });\n });\n\n let lastRevealed = props.revealed.value ?? null;\n\n watchEffect(() => {\n const current = props.revealed.value ?? null;\n\n if (current === lastRevealed) return;\n\n lastRevealed = current;\n\n if (current) {\n // Only one item may have its swipe actions revealed at a time — tell the list directly\n // instead of dispatching an event for it to listen for.\n listCtx?.requestReveal(el);\n emit('reveal', { item: el, side: current });\n } else {\n emit('conceal', { item: el });\n }\n });\n\n const handleActivate = (event: Event): void => {\n if (props.disabled.value) return;\n\n if (props.revealed.value) {\n event.preventDefault();\n event.stopPropagation();\n el.removeAttribute('revealed');\n\n return;\n }\n\n if (!isSelectable.value) return;\n\n const value = props.value.value;\n\n // Re-clicking an already-selected item deselects it; a value is required to select at all\n // (undefined would otherwise match every valueless item at once).\n if (value != null) listCtx?.select(isSelected.value ? undefined : value);\n };\n\n const handleRowKeydown = (event: KeyboardEvent): void => {\n if (event.key !== 'Enter' && event.key !== ' ') return;\n\n if (props.disabled.value || (!props.revealed.value && !isSelectable.value)) return;\n\n event.preventDefault();\n handleActivate(event);\n };\n\n bind({\n attr: {\n 'aria-disabled': () => (props.disabled.value ? 'true' : null),\n 'aria-selected': () => (isSelectable.value ? String(isSelected.value) : null),\n role: () => (isSelectable.value ? 'option' : 'listitem'),\n },\n });\n\n return html`\n <div\n class=\"row\"\n part=\"row\"\n tabindex=\"${() => (props.disabled.value ? '-1' : '0')}\"\n @click=\"${handleActivate}\"\n @keydown=\"${handleRowKeydown}\"\n @pointercancel=\"${(e: PointerEvent) => swipe.handlePointerCancel(e)}\"\n @pointerdown=\"${(e: PointerEvent) => swipe.handlePointerDown(e)}\"\n @pointermove=\"${(e: PointerEvent) => swipe.handlePointerMove(e)}\"\n @pointerup=\"${(e: PointerEvent) => swipe.handlePointerUp(e)}\">\n <span class=\"leading\" part=\"leading\"><slot name=\"leading\"></slot></span>\n <span class=\"content\" part=\"content\">\n <span class=\"title\" part=\"title\"><slot></slot></span>\n <span class=\"description\" part=\"description\"><slot name=\"description\"></slot></span>\n </span>\n <span class=\"trailing\" part=\"trailing\"><slot name=\"trailing\"></slot></span>\n </div>\n <span class=\"actions actions-left\" part=\"actions-start\"><slot name=\"actions-left\"></slot></span>\n <span class=\"actions actions-right\" part=\"actions-end\"><slot name=\"actions-right\"></slot></span>\n `;\n },\n\n shadow: { delegatesFocus: true },\n styles: [reducedMotionMixin, componentStyles],\n});\n"],"mappings":";;;;;;;;AA6CA,IAAM,KAAc,MAClB,MAAS,SAAS,iBAAiB,iBAiExB,IAAgB;AAC7B,EAAyB,GAAe;CACtC,OAAO;EACL,GAAG;EACH,UAAU,EAAK,MAAsC,CAAC,QAAQ,OAAO,GAAG,KAAA,CAAS;EACjF,OAAO,EAAK,OAAO;CACrB;CAEA,MAAM,GAAO;EACX,IAAM,IAAK,EAAQ,GACb,IAAO,EAA2B,GAClC,IAAQ,EAAoF,GAE5F,IA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IAAM,IAAQ,EAAM,MAAM;GAI1B,AAAI,KAAS,QAAM,GAAS,OAAO,EAAW,QAAQ,KAAA,IAAY,CAAK;EACzE;EAmBA,OARA,EAAK,EACH,MAAM;GACJ,uBAAwB,EAAM,SAAS,QAAQ,SAAS;GACxD,uBAAwB,EAAa,QAAQ,OAAO,EAAW,KAAK,IAAI;GACxE,YAAa,EAAa,QAAQ,WAAW;EAC/C,EACF,CAAC,GAEM,CAAI;;;;0BAIY,EAAM,SAAS,QAAQ,OAAO,IAAK;kBAC5C,EAAe;qBAtBH,MAA+B;GACnD,GAAM,QAAQ,WAAW,EAAM,QAAQ,SAEvC,EAAM,SAAS,SAAU,CAAC,EAAM,SAAS,SAAS,CAAC,EAAa,UAEpE,EAAM,eAAe,GACrB,EAAe,CAAK;EACtB,EAgBiC;2BACV,MAAoB,EAAM,oBAAoB,CAAC,EAAE;yBACnD,MAAoB,EAAM,kBAAkB,CAAC,EAAE;yBAC/C,MAAoB,EAAM,kBAAkB,CAAC,EAAE;uBACjD,MAAoB,EAAM,gBAAgB,CAAC,EAAE;;;;;;;;;;;CAWlE;CAEA,QAAQ,EAAE,gBAAgB,GAAK;CAC/B,QAAQ,CAAC,GAAoB,CAAe;AAC9C,CAAC"}
1
+ {"version":3,"file":"list-item.js","names":[],"sources":["../src/content/list/list-item.ts"],"sourcesContent":["import {\n bind,\n define,\n getHost,\n html,\n inject,\n onCleanup,\n onMounted,\n prop,\n useEmit,\n useSlots,\n watchEffect,\n} from '@vielzeug/ore';\nimport { computed } from '@vielzeug/ripple';\n\nimport { disablableBundle } from '../../shared';\nimport { reducedMotionMixin } from '../../styles';\nimport { createRevealState } from './_list-item-reveal';\nimport { LIST_CTX } from './list';\nimport componentStyles from './list-item.css?inline';\n\n/** Which side's action panel is currently revealed on a list item. */\nexport type ListItemRevealSide = 'left' | 'right';\n\n/** Events emitted by the list-item component */\nexport type OreListItemEvents = {\n /** Emitted when the revealed action panel closes (gesture, tap, or programmatic). */\n conceal: { item: HTMLElement };\n /**\n * Emitted when a swipe crosses the full-swipe-through distance — the \"swiped all the way\"\n * confirm gesture. Fired just before the slotted action's own click (if any).\n */\n confirm: { item: HTMLElement; side: ListItemRevealSide };\n /** Emitted when the item becomes deselected. */\n deselect: { item: HTMLElement; value: null | string };\n /** Emitted when a swipe/focus reveals an action panel. */\n reveal: { item: HTMLElement; side: ListItemRevealSide };\n /** Emitted when the item becomes selected (only meaningful inside a `selectable` `ore-list`). */\n select: { item: HTMLElement; value: null | string };\n};\n\n/** List-item component properties */\nexport type OreListItemProps = {\n /** Disable this item — blocks pointer interaction, swipe actions, and selection */\n disabled?: boolean;\n /** Which action panel is revealed: 'left' | 'right' (absent = closed). Settable programmatically. */\n revealed?: ListItemRevealSide;\n /**\n * Opaque value compared against the parent `selectable` `ore-list`'s own `value` to derive\n * `selected` — required for selection to work. There's no separate `selected` prop: the parent\n * list's `value` is the single source of truth, so this item's selected state can't drift from\n * it. Also reported in `select`/`deselect`/the parent's `change` event.\n */\n value?: string;\n};\n\n/** Maps a reveal side to its slot name — the one place this pairing is spelled out. */\nconst actionSlot = (side: ListItemRevealSide): 'actions-left' | 'actions-right' =>\n side === 'left' ? 'actions-left' : 'actions-right';\n\n/**\n * A single row inside `ore-list`. Renders `leading`/default (title)/`description`/`trailing`\n * content plus two off-canvas action panels (`actions-left`, `actions-right`) that a horizontal\n * pointer/touch swipe reveals — useful for mobile-style row actions (archive, delete, …). An\n * action panel only opens if it actually has slotted content; swiping the other direction is a\n * no-op. Revealed actions stay reachable from the keyboard (Tab focus on a slotted action button\n * reveals its panel via `:focus-within`, independent of any gesture).\n *\n * Swiping past the reveal distance snaps the panel fully open on release; swiping further still —\n * past the full-swipe-through distance — auto-confirms that side's action immediately (fires\n * `confirm` and clicks the slot's first element), the same \"swipe all the way\" shortcut as iOS\n * Mail's delete gesture.\n *\n * Closing a revealed panel is deliberately one-directional: tap/click the row itself, tap outside\n * the item, or open a different item's panel. Reverse-swiping an already-open item is not\n * supported — see `ore-list`'s docs for the reasoning.\n *\n * @element ore-list-item\n *\n * @attr {boolean} disabled - Disable this item\n * @attr {boolean} selected - Read-only reflected attribute: `true` when this item's `value` matches the parent `ore-list`'s `value`. Not independently settable.\n * @attr {string} value - Opaque value compared against the parent list's `value` to derive `selected`; also reported in select/change events\n * @attr {string} revealed - Which action panel is revealed: 'left' | 'right'\n *\n * @fires select - Item becomes selected. detail: { item: HTMLElement, value: string | null }\n * @fires deselect - Item becomes deselected. detail: { item: HTMLElement, value: string | null }\n * @fires reveal - An action panel opens. detail: { item: HTMLElement, side: 'left' | 'right' }\n * @fires conceal - The revealed action panel closes. detail: { item: HTMLElement }\n * @fires confirm - Swiped all the way through — fires before the slotted action's own click. detail: { item: HTMLElement, side: 'left' | 'right' }\n *\n * @slot leading - Content before the title (e.g. icon, avatar)\n * @slot - Item title\n * @slot description - Secondary line below the title\n * @slot trailing - Content after the title (e.g. meta text, chevron)\n * @slot actions-left - Buttons revealed by swiping right (or focusing into this slot)\n * @slot actions-right - Buttons revealed by swiping left (or focusing into this slot)\n *\n * @cssprop --list-item-actions-width - Width of each action panel (default 6rem)\n * @cssprop --list-item-bg - Row background color\n * @cssprop --list-item-hover-bg - Row background on hover\n * @cssprop --list-item-selected-bg - Row background when selected\n * @part row - The row wrapper (focusable, swipeable)\n * @part leading - The leading slot container\n * @part content - The title + description container\n * @part title - The title slot container\n * @part description - The description slot container\n * @part trailing - The trailing slot container\n * @part actions-start - The left action panel container\n * @part actions-end - The right action panel container\n * @example\n * ```html\n * <ore-list-item>\n * <ore-icon slot=\"leading\" name=\"mail\"></ore-icon>\n * Inbox\n * <span slot=\"trailing\">12</span>\n * </ore-list-item>\n * <ore-list-item>\n * Newsletter\n * <span slot=\"description\">From Acme Inc.</span>\n * <ore-button slot=\"actions-right\" color=\"error\">Delete</ore-button>\n * </ore-list-item>\n * ```\n */\nexport const LIST_ITEM_TAG = 'ore-list-item' as const;\ndefine<OreListItemProps>(LIST_ITEM_TAG, {\n props: {\n ...disablableBundle,\n revealed: prop.oneOf<ListItemRevealSide | undefined>(['left', 'right'], undefined),\n value: prop.string(),\n },\n\n setup(props) {\n const el = getHost();\n const emit = useEmit<OreListItemEvents>();\n const slots = useSlots<'actions-left' | 'actions-right' | 'description' | 'leading' | 'trailing'>();\n\n const listCtx = inject(LIST_CTX);\n const isSelectable = computed(() => Boolean(listCtx?.selectable.value));\n // Derived, not owned: `ore-list`'s `value` is the single source of truth, so this can never\n // drift out of sync with a sibling the way an independently-settable `selected` prop could.\n const isSelected = computed(\n () => props.value.value != null && listCtx != null && listCtx.value.value === props.value.value,\n );\n\n const hasActions = (side: ListItemRevealSide): boolean => slots.has(actionSlot(side)).value;\n\n onMounted(() => {\n const row = el.shadowRoot?.querySelector<HTMLElement>('.row');\n\n if (!row) return;\n\n const pan = createRevealState(el, row, {\n disabled: computed(() => props.disabled.value || Boolean(props.revealed.value)),\n hasActions,\n // Clicks the slot's own first element (the common case: a single action button) so its own\n // click handler runs the real action — `confirm` covers slots without a clickable element.\n onConfirm: (side) => {\n const target = slots.elements(actionSlot(side)).value[0] as HTMLElement | undefined;\n\n emit('confirm', { item: el, side });\n target?.click();\n },\n });\n\n onCleanup(() => pan.dispose());\n });\n\n // Reflects the derived `selected` state as a plain boolean attribute — the styling/\n // `[selected]`-selector hook — the same way `prop.bool()`'s own reflection would, since it\n // isn't a real settable prop anymore.\n watchEffect(() => {\n el.toggleAttribute('selected', isSelected.value);\n });\n\n // Emits select/deselect/reveal/conceal for both gesture-driven AND externally-set (attribute,\n // or the parent list's `value`) state changes — the plain-reflected-prop equivalent of\n // ore-accordion-item's native <details> `toggle`-event listener (there's no backing native\n // element here to piggyback on).\n let lastSelected = isSelected.value;\n\n watchEffect(() => {\n const current = isSelected.value;\n\n if (current === lastSelected) return;\n\n lastSelected = current;\n emit(current ? 'select' : 'deselect', { item: el, value: props.value.value ?? null });\n });\n\n let lastRevealed = props.revealed.value ?? null;\n\n watchEffect(() => {\n const current = props.revealed.value ?? null;\n\n if (current === lastRevealed) return;\n\n lastRevealed = current;\n\n if (current) {\n // Only one item may have its swipe actions revealed at a time — tell the list directly\n // instead of dispatching an event for it to listen for.\n listCtx?.requestReveal(el);\n emit('reveal', { item: el, side: current });\n } else {\n emit('conceal', { item: el });\n }\n });\n\n const handleActivate = (event: Event): void => {\n if (props.disabled.value) return;\n\n if (props.revealed.value) {\n event.preventDefault();\n event.stopPropagation();\n el.removeAttribute('revealed');\n\n return;\n }\n\n if (!isSelectable.value) return;\n\n const value = props.value.value;\n\n // Re-clicking an already-selected item deselects it; a value is required to select at all\n // (undefined would otherwise match every valueless item at once).\n if (value != null) listCtx?.select(isSelected.value ? undefined : value);\n };\n\n const handleRowKeydown = (event: KeyboardEvent): void => {\n if (event.key !== 'Enter' && event.key !== ' ') return;\n\n if (props.disabled.value || (!props.revealed.value && !isSelectable.value)) return;\n\n event.preventDefault();\n handleActivate(event);\n };\n\n bind({\n attr: {\n 'aria-disabled': () => (props.disabled.value ? 'true' : null),\n 'aria-selected': () => (isSelectable.value ? String(isSelected.value) : null),\n role: () => (isSelectable.value ? 'option' : 'listitem'),\n },\n });\n\n return html`\n <div\n class=\"row\"\n part=\"row\"\n tabindex=\"${() => (props.disabled.value ? '-1' : '0')}\"\n @click=\"${handleActivate}\"\n @keydown=\"${handleRowKeydown}\">\n <span class=\"leading\" part=\"leading\"><slot name=\"leading\"></slot></span>\n <span class=\"content\" part=\"content\">\n <span class=\"title\" part=\"title\"><slot></slot></span>\n <span class=\"description\" part=\"description\"><slot name=\"description\"></slot></span>\n </span>\n <span class=\"trailing\" part=\"trailing\"><slot name=\"trailing\"></slot></span>\n </div>\n <span class=\"actions actions-left\" part=\"actions-start\"><slot name=\"actions-left\"></slot></span>\n <span class=\"actions actions-right\" part=\"actions-end\"><slot name=\"actions-right\"></slot></span>\n `;\n },\n\n shadow: { delegatesFocus: true },\n styles: [reducedMotionMixin, componentStyles],\n});\n"],"mappings":";;;;;;;;AAyDA,IAAM,KAAc,MAClB,M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