@vielzeug/refine 2.1.0 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion-item.cjs +1 -1
- package/dist/accordion-item.cjs.map +1 -1
- package/dist/accordion-item.js +1 -1
- package/dist/accordion-item.js.map +1 -1
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.cjs.map +1 -1
- package/dist/accordion.js +1 -1
- package/dist/accordion.js.map +1 -1
- package/dist/alert.cjs.map +1 -1
- package/dist/alert.js.map +1 -1
- package/dist/async.cjs.map +1 -1
- package/dist/async.js.map +1 -1
- package/dist/avatar-group.cjs.map +1 -1
- package/dist/avatar-group.js.map +1 -1
- package/dist/avatar.cjs +6 -6
- package/dist/avatar.cjs.map +1 -1
- package/dist/avatar.js +1 -2
- package/dist/avatar.js.map +1 -1
- package/dist/badge.cjs.map +1 -1
- package/dist/badge.js.map +1 -1
- package/dist/box.cjs.map +1 -1
- package/dist/box.js.map +1 -1
- package/dist/breadcrumb.cjs +3 -3
- package/dist/breadcrumb.cjs.map +1 -1
- package/dist/breadcrumb.js +4 -4
- package/dist/breadcrumb.js.map +1 -1
- package/dist/button-group.cjs +1 -1
- package/dist/button-group.cjs.map +1 -1
- package/dist/button-group.js +0 -1
- package/dist/button-group.js.map +1 -1
- package/dist/button.cjs.map +1 -1
- package/dist/button.js.map +1 -1
- package/dist/calendar.cjs.map +1 -1
- package/dist/calendar.js.map +1 -1
- package/dist/card.cjs +7 -7
- package/dist/card.cjs.map +1 -1
- package/dist/card.js +27 -27
- package/dist/card.js.map +1 -1
- package/dist/carousel.cjs +20 -20
- package/dist/carousel.cjs.map +1 -1
- package/dist/carousel.js +7 -8
- package/dist/carousel.js.map +1 -1
- package/dist/chat-message.cjs +10 -10
- package/dist/chat-message.cjs.map +1 -1
- package/dist/chat-message.js +1 -2
- package/dist/chat-message.js.map +1 -1
- package/dist/checkbox-group.cjs +7 -7
- package/dist/checkbox-group.cjs.map +1 -1
- package/dist/checkbox-group.js +26 -26
- package/dist/checkbox-group.js.map +1 -1
- package/dist/checkbox.cjs +2 -2
- package/dist/checkbox.cjs.map +1 -1
- package/dist/checkbox.js +33 -33
- package/dist/checkbox.js.map +1 -1
- package/dist/chip.cjs +16 -16
- package/dist/chip.cjs.map +1 -1
- package/dist/chip.js +1 -2
- package/dist/chip.js.map +1 -1
- package/dist/combobox.cjs +28 -28
- package/dist/combobox.cjs.map +1 -1
- package/dist/combobox.js +211 -211
- package/dist/combobox.js.map +1 -1
- package/dist/command-palette.cjs +21 -21
- package/dist/command-palette.cjs.map +1 -1
- package/dist/command-palette.js +27 -28
- package/dist/command-palette.js.map +1 -1
- package/dist/content/avatar/avatar.css.cjs +1 -1
- package/dist/content/avatar/avatar.css.js +1 -1
- package/dist/content/avatar/avatar.d.ts.map +1 -1
- package/dist/content/breadcrumb/breadcrumb.d.ts.map +1 -1
- package/dist/content/card/card.css.cjs +1 -1
- package/dist/content/card/card.css.cjs.map +1 -1
- package/dist/content/card/card.css.js +1 -1
- package/dist/content/card/card.css.js.map +1 -1
- package/dist/content/card/card.d.ts.map +1 -1
- package/dist/content/carousel/carousel-slide.cjs.map +1 -1
- package/dist/content/carousel/carousel-slide.js.map +1 -1
- package/dist/content/carousel/carousel.css.cjs +1 -1
- package/dist/content/carousel/carousel.css.cjs.map +1 -1
- package/dist/content/carousel/carousel.css.js +1 -1
- package/dist/content/carousel/carousel.css.js.map +1 -1
- package/dist/content/carousel/carousel.d.ts.map +1 -1
- package/dist/content/carousel/index.d.ts +1 -1
- package/dist/content/carousel/index.d.ts.map +1 -1
- package/dist/content/chat-message/chat-message.css.cjs +1 -1
- package/dist/content/chat-message/chat-message.css.js +1 -1
- package/dist/content/chat-message/chat-message.d.ts.map +1 -1
- package/dist/content/code-window/code-window.css.cjs +1 -1
- package/dist/content/code-window/code-window.css.js +1 -1
- package/dist/content/copy-command/copy-command.css.cjs +1 -1
- package/dist/content/copy-command/copy-command.css.js +1 -1
- package/dist/content/copy-command/copy-command.d.ts.map +1 -1
- package/dist/content/index.d.ts +22 -22
- package/dist/content/index.d.ts.map +1 -1
- package/dist/content/list/_list-item-reveal.cjs.map +1 -1
- package/dist/content/list/_list-item-reveal.d.ts +1 -1
- package/dist/content/list/_list-item-reveal.d.ts.map +1 -1
- package/dist/content/list/_list-item-reveal.js.map +1 -1
- package/dist/content/list/list-item.css.cjs +1 -1
- package/dist/content/list/list-item.css.cjs.map +1 -1
- package/dist/content/list/list-item.css.js +1 -1
- package/dist/content/list/list-item.css.js.map +1 -1
- package/dist/content/list/list.d.ts.map +1 -1
- package/dist/content/marquee/marquee.css.cjs +1 -1
- package/dist/content/marquee/marquee.css.js +1 -1
- package/dist/content/pagination/pagination.css.cjs +1 -1
- package/dist/content/pagination/pagination.css.js +1 -1
- package/dist/content/pagination/pagination.d.ts.map +1 -1
- package/dist/content/separator/separator.css.cjs +1 -1
- package/dist/content/separator/separator.css.js +1 -1
- package/dist/content/separator/separator.d.ts.map +1 -1
- package/dist/content/stepper/step.css.cjs.map +1 -1
- package/dist/content/stepper/step.css.js.map +1 -1
- package/dist/content/stepper/stepper.d.ts.map +1 -1
- package/dist/content/table/table.css.cjs +1 -1
- package/dist/content/table/table.css.js +1 -1
- package/dist/content/text/text.css.cjs +1 -1
- package/dist/content/text/text.css.js +1 -1
- package/dist/copy-command.cjs.map +1 -1
- package/dist/copy-command.js.map +1 -1
- package/dist/core/checkable.cjs +1 -1
- package/dist/core/checkable.cjs.map +1 -1
- package/dist/core/checkable.d.ts.map +1 -1
- package/dist/core/checkable.js +4 -4
- package/dist/core/checkable.js.map +1 -1
- package/dist/core/choice-field.cjs +1 -1
- package/dist/core/choice-field.cjs.map +1 -1
- package/dist/core/choice-field.d.ts.map +1 -1
- package/dist/core/choice-field.js +1 -2
- package/dist/core/choice-field.js.map +1 -1
- package/dist/core/date-picker.cjs +1 -1
- package/dist/core/date-picker.cjs.map +1 -1
- package/dist/core/date-picker.d.ts.map +1 -1
- package/dist/core/date-picker.js +3 -3
- package/dist/core/date-picker.js.map +1 -1
- package/dist/core/index.d.ts +17 -17
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/option-list.cjs +1 -1
- package/dist/core/option-list.cjs.map +1 -1
- package/dist/core/option-list.d.ts.map +1 -1
- package/dist/core/option-list.js +4 -4
- package/dist/core/option-list.js.map +1 -1
- package/dist/core/ref-callback.cjs +1 -1
- package/dist/core/ref-callback.cjs.map +1 -1
- package/dist/core/ref-callback.d.ts.map +1 -1
- package/dist/core/ref-callback.js +1 -1
- package/dist/core/ref-callback.js.map +1 -1
- package/dist/core/signals.cjs +1 -1
- package/dist/core/signals.cjs.map +1 -1
- package/dist/core/signals.d.ts.map +1 -1
- package/dist/core/signals.js +1 -2
- package/dist/core/signals.js.map +1 -1
- package/dist/core/slider.cjs.map +1 -1
- package/dist/core/slider.d.ts.map +1 -1
- package/dist/core/slider.js.map +1 -1
- package/dist/core/spinner.cjs.map +1 -1
- package/dist/core/spinner.d.ts.map +1 -1
- package/dist/core/spinner.js.map +1 -1
- package/dist/core/text-field.cjs +1 -1
- package/dist/core/text-field.cjs.map +1 -1
- package/dist/core/text-field.js +1 -1
- package/dist/core/text-field.js.map +1 -1
- package/dist/custom-elements.json +4253 -4253
- package/dist/datagrid.cjs +114 -114
- package/dist/datagrid.cjs.map +1 -1
- package/dist/datagrid.js +42 -43
- package/dist/datagrid.js.map +1 -1
- package/dist/date-picker.cjs.map +1 -1
- package/dist/date-picker.js.map +1 -1
- package/dist/dialog.cjs.map +1 -1
- package/dist/dialog.js.map +1 -1
- package/dist/disclosure/accordion/accordion.d.ts.map +1 -1
- package/dist/disclosure/accordion-item/accordion-item.css.cjs +1 -1
- package/dist/disclosure/accordion-item/accordion-item.css.cjs.map +1 -1
- package/dist/disclosure/accordion-item/accordion-item.css.js +1 -1
- package/dist/disclosure/accordion-item/accordion-item.css.js.map +1 -1
- package/dist/disclosure/index.d.ts +6 -6
- package/dist/disclosure/index.d.ts.map +1 -1
- package/dist/disclosure/tab-item/tab-item.css.cjs.map +1 -1
- package/dist/disclosure/tab-item/tab-item.css.js.map +1 -1
- package/dist/disclosure/tab-item/tab-item.d.ts.map +1 -1
- package/dist/disclosure/tabs/tabs.css.cjs +1 -1
- package/dist/disclosure/tabs/tabs.css.cjs.map +1 -1
- package/dist/disclosure/tabs/tabs.css.js +1 -1
- package/dist/disclosure/tabs/tabs.css.js.map +1 -1
- package/dist/disclosure/tabs/tabs.d.ts.map +1 -1
- package/dist/drawer.cjs +5 -5
- package/dist/drawer.cjs.map +1 -1
- package/dist/drawer.js +26 -26
- package/dist/drawer.js.map +1 -1
- package/dist/feedback/alert/alert.css.cjs +1 -1
- package/dist/feedback/alert/alert.css.js +1 -1
- package/dist/feedback/async/async.d.ts +1 -1
- package/dist/feedback/async/async.d.ts.map +1 -1
- package/dist/feedback/badge/badge.css.cjs +1 -1
- package/dist/feedback/badge/badge.css.js +1 -1
- package/dist/feedback/badge/badge.d.ts.map +1 -1
- package/dist/feedback/chip/chip.css.cjs.map +1 -1
- package/dist/feedback/chip/chip.css.js.map +1 -1
- package/dist/feedback/chip/chip.d.ts.map +1 -1
- package/dist/feedback/index.d.ts +12 -12
- package/dist/feedback/index.d.ts.map +1 -1
- package/dist/feedback/progress/progress.d.ts.map +1 -1
- package/dist/feedback/skeleton/skeleton.d.ts.map +1 -1
- package/dist/feedback/toast/index.d.ts +1 -1
- package/dist/feedback/toast/index.d.ts.map +1 -1
- package/dist/feedback/toast/toast.css.cjs +1 -1
- package/dist/feedback/toast/toast.css.cjs.map +1 -1
- package/dist/feedback/toast/toast.css.js +1 -1
- package/dist/feedback/toast/toast.css.js.map +1 -1
- package/dist/feedback/toast/toast.d.ts +1 -1
- package/dist/feedback/toast/toast.d.ts.map +1 -1
- package/dist/feedback/typing-indicator/typing-indicator.d.ts.map +1 -1
- package/dist/file-input.cjs +67 -67
- package/dist/file-input.cjs.map +1 -1
- package/dist/file-input.js +129 -130
- package/dist/file-input.js.map +1 -1
- package/dist/grid.cjs.map +1 -1
- package/dist/grid.js.map +1 -1
- package/dist/icon.cjs.map +1 -1
- package/dist/icon.js.map +1 -1
- package/dist/input.cjs +21 -21
- package/dist/input.cjs.map +1 -1
- package/dist/input.js +58 -58
- package/dist/input.js.map +1 -1
- package/dist/inputs/button/button.css.cjs +1 -1
- package/dist/inputs/button/button.css.js +1 -1
- package/dist/inputs/button/button.d.ts.map +1 -1
- package/dist/inputs/button-group/button-group.css.cjs.map +1 -1
- package/dist/inputs/button-group/button-group.css.js.map +1 -1
- package/dist/inputs/button-group/button-group.d.ts +1 -1
- package/dist/inputs/button-group/button-group.d.ts.map +1 -1
- package/dist/inputs/calendar/calendar.css.cjs +1 -1
- package/dist/inputs/calendar/calendar.css.cjs.map +1 -1
- package/dist/inputs/calendar/calendar.css.js +1 -1
- package/dist/inputs/calendar/calendar.css.js.map +1 -1
- package/dist/inputs/calendar/calendar.d.ts.map +1 -1
- package/dist/inputs/checkbox/checkbox.css.cjs +1 -1
- package/dist/inputs/checkbox/checkbox.css.js +1 -1
- package/dist/inputs/checkbox/checkbox.d.ts.map +1 -1
- package/dist/inputs/checkbox-group/checkbox-group.d.ts +1 -1
- package/dist/inputs/checkbox-group/checkbox-group.d.ts.map +1 -1
- package/dist/inputs/combobox/combobox.css.cjs +1 -1
- package/dist/inputs/combobox/combobox.css.js +1 -1
- package/dist/inputs/combobox/combobox.d.ts.map +1 -1
- package/dist/inputs/datagrid/datagrid-column.cjs.map +1 -1
- package/dist/inputs/datagrid/datagrid-column.d.ts.map +1 -1
- package/dist/inputs/datagrid/datagrid-column.js.map +1 -1
- package/dist/inputs/datagrid/datagrid-model.cjs +1 -1
- package/dist/inputs/datagrid/datagrid-model.cjs.map +1 -1
- package/dist/inputs/datagrid/datagrid-model.d.ts.map +1 -1
- package/dist/inputs/datagrid/datagrid-model.js +1 -2
- package/dist/inputs/datagrid/datagrid-model.js.map +1 -1
- package/dist/inputs/datagrid/datagrid.css.cjs +1 -1
- package/dist/inputs/datagrid/datagrid.css.cjs.map +1 -1
- package/dist/inputs/datagrid/datagrid.css.js +1 -1
- package/dist/inputs/datagrid/datagrid.css.js.map +1 -1
- package/dist/inputs/datagrid/datagrid.d.ts +1 -1
- package/dist/inputs/datagrid/datagrid.d.ts.map +1 -1
- package/dist/inputs/date-picker/date-picker.css.cjs +1 -1
- package/dist/inputs/date-picker/date-picker.css.cjs.map +1 -1
- package/dist/inputs/date-picker/date-picker.css.js +1 -1
- package/dist/inputs/date-picker/date-picker.css.js.map +1 -1
- package/dist/inputs/date-picker/date-picker.d.ts.map +1 -1
- package/dist/inputs/file-input/file-input-upload.cjs +1 -1
- package/dist/inputs/file-input/file-input-upload.cjs.map +1 -1
- package/dist/inputs/file-input/file-input-upload.d.ts.map +1 -1
- package/dist/inputs/file-input/file-input-upload.js +2 -3
- package/dist/inputs/file-input/file-input-upload.js.map +1 -1
- package/dist/inputs/file-input/file-input.css.cjs +1 -1
- package/dist/inputs/file-input/file-input.css.js +1 -1
- package/dist/inputs/file-input/file-input.d.ts.map +1 -1
- package/dist/inputs/index.d.ts +28 -28
- package/dist/inputs/index.d.ts.map +1 -1
- package/dist/inputs/input/input.css.cjs +1 -1
- package/dist/inputs/input/input.css.js +1 -1
- package/dist/inputs/input/input.d.ts.map +1 -1
- package/dist/inputs/message-composer/message-composer.css.cjs +1 -1
- package/dist/inputs/message-composer/message-composer.css.js +1 -1
- package/dist/inputs/message-composer/message-composer.d.ts +1 -1
- package/dist/inputs/message-composer/message-composer.d.ts.map +1 -1
- package/dist/inputs/number-input/number-input.d.ts.map +1 -1
- package/dist/inputs/otp-input/otp-input.d.ts.map +1 -1
- package/dist/inputs/radio/radio.css.cjs +1 -1
- package/dist/inputs/radio/radio.css.js +1 -1
- package/dist/inputs/radio/radio.d.ts.map +1 -1
- package/dist/inputs/radio-group/radio-group.d.ts +2 -2
- package/dist/inputs/radio-group/radio-group.d.ts.map +1 -1
- package/dist/inputs/rating/rating.d.ts.map +1 -1
- package/dist/inputs/select/select.css.cjs +1 -1
- package/dist/inputs/select/select.css.js +1 -1
- package/dist/inputs/select/select.d.ts.map +1 -1
- package/dist/inputs/shared/field-binding.cjs.map +1 -1
- package/dist/inputs/shared/field-binding.d.ts.map +1 -1
- package/dist/inputs/shared/field-binding.js.map +1 -1
- package/dist/inputs/shared/templates.cjs.map +1 -1
- package/dist/inputs/shared/templates.d.ts.map +1 -1
- package/dist/inputs/shared/templates.js.map +1 -1
- package/dist/inputs/slider/slider.d.ts.map +1 -1
- package/dist/inputs/switch/switch.css.cjs +1 -1
- package/dist/inputs/switch/switch.css.js +1 -1
- package/dist/inputs/switch/switch.d.ts.map +1 -1
- package/dist/inputs/textarea/textarea.css.cjs +1 -1
- package/dist/inputs/textarea/textarea.css.js +1 -1
- package/dist/inputs/textarea/textarea.d.ts.map +1 -1
- package/dist/inputs/time-picker/time-picker.css.cjs +1 -1
- package/dist/inputs/time-picker/time-picker.css.cjs.map +1 -1
- package/dist/inputs/time-picker/time-picker.css.js +1 -1
- package/dist/inputs/time-picker/time-picker.css.js.map +1 -1
- package/dist/inputs/time-picker/time-picker.d.ts.map +1 -1
- package/dist/layout/box/box.d.ts.map +1 -1
- package/dist/layout/grid/grid.d.ts.map +1 -1
- package/dist/layout/index.d.ts +6 -6
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/layout/navbar/navbar.css.cjs +1 -1
- package/dist/layout/navbar/navbar.css.js +1 -1
- package/dist/layout/navbar/navbar.d.ts.map +1 -1
- package/dist/layout/sidebar/sidebar-group.css.cjs +1 -1
- package/dist/layout/sidebar/sidebar-group.css.cjs.map +1 -1
- package/dist/layout/sidebar/sidebar-group.css.js +1 -1
- package/dist/layout/sidebar/sidebar-group.css.js.map +1 -1
- package/dist/layout/sidebar/sidebar.css.cjs +1 -1
- package/dist/layout/sidebar/sidebar.css.cjs.map +1 -1
- package/dist/layout/sidebar/sidebar.css.js +1 -1
- package/dist/layout/sidebar/sidebar.css.js.map +1 -1
- package/dist/layout/sidebar/sidebar.d.ts.map +1 -1
- package/dist/list-item.cjs.map +1 -1
- package/dist/list-item.js.map +1 -1
- package/dist/list.cjs +2 -2
- package/dist/list.cjs.map +1 -1
- package/dist/list.js +15 -16
- package/dist/list.js.map +1 -1
- package/dist/marquee.cjs +1 -1
- package/dist/marquee.cjs.map +1 -1
- package/dist/marquee.js +1 -1
- package/dist/marquee.js.map +1 -1
- package/dist/menu.cjs +5 -5
- package/dist/menu.cjs.map +1 -1
- package/dist/menu.js +38 -39
- package/dist/menu.js.map +1 -1
- package/dist/message-composer.cjs +16 -16
- package/dist/message-composer.cjs.map +1 -1
- package/dist/message-composer.js +61 -61
- package/dist/message-composer.js.map +1 -1
- package/dist/navbar.cjs +9 -9
- package/dist/navbar.cjs.map +1 -1
- package/dist/navbar.js +1 -2
- package/dist/navbar.js.map +1 -1
- package/dist/navigation-menu.cjs +5 -5
- package/dist/navigation-menu.cjs.map +1 -1
- package/dist/navigation-menu.js +33 -34
- package/dist/navigation-menu.js.map +1 -1
- package/dist/number-input.cjs +24 -24
- package/dist/number-input.cjs.map +1 -1
- package/dist/number-input.js +41 -42
- package/dist/number-input.js.map +1 -1
- package/dist/otp-input.cjs +13 -13
- package/dist/otp-input.cjs.map +1 -1
- package/dist/otp-input.js +32 -33
- package/dist/otp-input.js.map +1 -1
- package/dist/overlay/command-palette/command-palette-items.cjs.map +1 -1
- package/dist/overlay/command-palette/command-palette-items.d.ts.map +1 -1
- package/dist/overlay/command-palette/command-palette-items.js.map +1 -1
- package/dist/overlay/command-palette/command-palette.css.cjs +1 -1
- package/dist/overlay/command-palette/command-palette.css.cjs.map +1 -1
- package/dist/overlay/command-palette/command-palette.css.js +1 -1
- package/dist/overlay/command-palette/command-palette.css.js.map +1 -1
- package/dist/overlay/command-palette/command-palette.d.ts.map +1 -1
- package/dist/overlay/dialog/dialog.css.cjs +1 -1
- package/dist/overlay/dialog/dialog.css.js +1 -1
- package/dist/overlay/dialog/dialog.d.ts.map +1 -1
- package/dist/overlay/drawer/drawer.css.cjs +1 -1
- package/dist/overlay/drawer/drawer.css.js +1 -1
- package/dist/overlay/drawer/drawer.d.ts +2 -2
- package/dist/overlay/drawer/drawer.d.ts.map +1 -1
- package/dist/overlay/index.d.ts +6 -6
- package/dist/overlay/index.d.ts.map +1 -1
- package/dist/overlay/menu/menu.css.cjs +1 -1
- package/dist/overlay/menu/menu.css.js +1 -1
- package/dist/overlay/menu/menu.d.ts +2 -2
- package/dist/overlay/menu/menu.d.ts.map +1 -1
- package/dist/overlay/navigation-menu/navigation-menu.d.ts.map +1 -1
- package/dist/overlay/popover/popover.d.ts +1 -1
- package/dist/overlay/popover/popover.d.ts.map +1 -1
- package/dist/overlay/shared/use-dialog.cjs +1 -1
- package/dist/overlay/shared/use-dialog.cjs.map +1 -1
- package/dist/overlay/shared/use-dialog.d.ts.map +1 -1
- package/dist/overlay/shared/use-dialog.js +4 -5
- package/dist/overlay/shared/use-dialog.js.map +1 -1
- package/dist/overlay/shared/use-floating-trigger.cjs +1 -1
- package/dist/overlay/shared/use-floating-trigger.cjs.map +1 -1
- package/dist/overlay/shared/use-floating-trigger.d.ts.map +1 -1
- package/dist/overlay/shared/use-floating-trigger.js +1 -2
- package/dist/overlay/shared/use-floating-trigger.js.map +1 -1
- package/dist/overlay/tooltip/tooltip.d.ts +1 -1
- package/dist/overlay/tooltip/tooltip.d.ts.map +1 -1
- package/dist/pagination.cjs.map +1 -1
- package/dist/pagination.js.map +1 -1
- package/dist/popover.cjs +1 -1
- package/dist/popover.cjs.map +1 -1
- package/dist/popover.js +0 -1
- package/dist/popover.js.map +1 -1
- package/dist/progress.cjs.map +1 -1
- package/dist/progress.js.map +1 -1
- package/dist/radio-group.cjs +5 -5
- package/dist/radio-group.cjs.map +1 -1
- package/dist/radio-group.js +26 -27
- package/dist/radio-group.js.map +1 -1
- package/dist/radio.cjs +2 -2
- package/dist/radio.cjs.map +1 -1
- package/dist/radio.js +41 -41
- package/dist/radio.js.map +1 -1
- package/dist/rating.cjs +4 -4
- package/dist/rating.cjs.map +1 -1
- package/dist/rating.js +36 -36
- package/dist/rating.js.map +1 -1
- package/dist/refine.cjs +686 -686
- package/dist/refine.cjs.map +1 -1
- package/dist/refine.iife.js +686 -686
- package/dist/refine.iife.js.map +1 -1
- package/dist/refine.js +737 -737
- package/dist/refine.js.map +1 -1
- package/dist/select.cjs +42 -42
- package/dist/select.cjs.map +1 -1
- package/dist/select.js +146 -147
- package/dist/select.js.map +1 -1
- package/dist/separator.cjs.map +1 -1
- package/dist/separator.js.map +1 -1
- package/dist/sidebar.cjs +17 -17
- package/dist/sidebar.cjs.map +1 -1
- package/dist/sidebar.js +7 -8
- package/dist/sidebar.js.map +1 -1
- package/dist/skeleton.cjs +3 -3
- package/dist/skeleton.cjs.map +1 -1
- package/dist/skeleton.js +1 -2
- package/dist/skeleton.js.map +1 -1
- package/dist/slider.cjs +12 -12
- package/dist/slider.cjs.map +1 -1
- package/dist/slider.js +54 -55
- package/dist/slider.js.map +1 -1
- package/dist/step.cjs.map +1 -1
- package/dist/step.js.map +1 -1
- package/dist/stepper.cjs +2 -2
- package/dist/stepper.cjs.map +1 -1
- package/dist/stepper.js +8 -7
- package/dist/stepper.js.map +1 -1
- package/dist/styles/index.d.ts +2 -2
- package/dist/styles/index.d.ts.map +1 -1
- package/dist/styles/preflight.css +1 -1
- package/dist/styles/theme.css +15 -30
- package/dist/switch.cjs +3 -3
- package/dist/switch.cjs.map +1 -1
- package/dist/switch.js +28 -28
- package/dist/switch.js.map +1 -1
- package/dist/tab-item.cjs +2 -2
- package/dist/tab-item.cjs.map +1 -1
- package/dist/tab-item.js +21 -21
- package/dist/tab-item.js.map +1 -1
- package/dist/tab-panel.cjs +2 -2
- package/dist/tab-panel.cjs.map +1 -1
- package/dist/tab-panel.js +9 -9
- package/dist/tab-panel.js.map +1 -1
- package/dist/table.cjs +1 -1
- package/dist/table.cjs.map +1 -1
- package/dist/table.js +1 -1
- package/dist/table.js.map +1 -1
- package/dist/tabs.cjs +6 -6
- package/dist/tabs.cjs.map +1 -1
- package/dist/tabs.js +14 -15
- package/dist/tabs.js.map +1 -1
- package/dist/textarea.cjs +11 -11
- package/dist/textarea.cjs.map +1 -1
- package/dist/textarea.js +59 -59
- package/dist/textarea.js.map +1 -1
- package/dist/time-picker.cjs.map +1 -1
- package/dist/time-picker.js.map +1 -1
- package/dist/toast.cjs +16 -16
- package/dist/toast.cjs.map +1 -1
- package/dist/toast.js +20 -21
- package/dist/toast.js.map +1 -1
- package/dist/tooltip.cjs.map +1 -1
- package/dist/tooltip.js.map +1 -1
- package/dist/typing-indicator.cjs +1 -1
- package/dist/typing-indicator.cjs.map +1 -1
- package/dist/typing-indicator.js +1 -1
- package/dist/typing-indicator.js.map +1 -1
- package/package.json +96 -97
package/dist/tab-item.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-item.cjs","names":[],"sources":["../src/disclosure/tab-item/tab-item.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"tab-item.cjs","names":[],"sources":["../src/disclosure/tab-item/tab-item.ts"],"sourcesContent":["import { bind, define, getHost, html, inject, onMounted, prop, ref, watchEffect } from '@vielzeug/ore';\nimport { computed } from '@vielzeug/ripple';\nimport { setAriaReflection } from '../../core';\nimport { disablableBundle } from '../../shared';\nimport { coarsePointerMixin, colorThemeMixin, forcedColorsFocusMixin } from '../../styles';\nimport type { ComponentSize, SurfaceVariant, ThemeColor } from '../../types';\nimport { TABS_CTX } from '../tabs/tabs';\nimport styles from './tab-item.css?inline';\n\nexport type OreTabItemProps = {\n /** Whether this tab is currently selected (set by ore-tabs) */\n active?: boolean;\n /** Theme color (inherited from ore-tabs) */\n color?: ThemeColor;\n /** Disable this tab */\n disabled?: boolean;\n /** Size (inherited from ore-tabs) */\n size?: ComponentSize;\n /** Unique value identifier — must match a ore-tab-panel value */\n value: string;\n /** Visual variant (inherited from ore-tabs) */\n variant?: SurfaceVariant;\n};\n\n/**\n * Individual tab trigger. Must be placed in the `tabs` slot of `ore-tabs`.\n *\n * @element ore-tab-item\n *\n * @attr {string} value - Unique identifier, matches the corresponding ore-tab-panel value\n * @attr {boolean} active - Set by the parent ore-tabs when this tab is selected\n * @attr {boolean} disabled - Prevents selection\n * @attr {string} size - 'sm' | 'md' | 'lg'\n * @attr {string} variant - Inherited from ore-tabs: 'solid' | 'flat' | 'bordered' | 'ghost' | 'glass' | 'frost'\n * @attr {string} color - Inherited from ore-tabs: 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'error'\n *\n * @slot prefix - Icon or content before the label\n * @slot - Tab label\n * @slot suffix - Badge or count after the label\n *\n * @cssprop --tab-item-radius - Button border radius\n * @cssprop --tab-item-transition - Transition duration/easing\n * @cssprop --tab-item-padding - Button padding\n * @cssprop --tab-item-font-size - Button font size\n * @cssprop --tab-item-color - Default text color\n * @cssprop --tab-item-hover-bg - Background on hover\n * @cssprop --tab-item-active-bg - Background when active/selected\n * @cssprop --tab-item-active-color - Text color when active/selected\n * @cssprop --tab-item-active-shadow - Box shadow when active/selected\n * @part tab - Tab trigger element.\n * @example\n * ```html\n * <ore-tab-item slot=\"tabs\" value=\"overview\">Overview</ore-tab-item>\n * <ore-tab-item slot=\"tabs\" value=\"settings\" disabled>Settings</ore-tab-item>\n * ```\n */\nexport const TAB_ITEM_TAG = 'ore-tab-item' as const;\ndefine<OreTabItemProps>(TAB_ITEM_TAG, {\n props: {\n ...disablableBundle,\n active: prop.bool(false),\n color: prop.string<ThemeColor>(),\n size: prop.string<ComponentSize>(),\n value: prop.string(''),\n variant: prop.string<SurfaceVariant>(),\n },\n setup(props) {\n const el = getHost();\n const watch = watchEffect;\n\n const tabsCtx = inject(TABS_CTX);\n\n if (tabsCtx) {\n watch(() => {\n const color = tabsCtx.color.value;\n const size = tabsCtx.size.value;\n const variant = tabsCtx.variant.value;\n\n if (color !== undefined) el.setAttribute('color', color);\n\n if (size !== undefined) el.setAttribute('size', size);\n\n if (variant !== undefined) el.setAttribute('variant', variant);\n });\n }\n\n const isActive = computed(() =>\n tabsCtx ? !!tabsCtx.value.value && tabsCtx.value.value === props.value.value : props.active.value,\n );\n const isDisabled = () => Boolean(props.disabled.value);\n\n bind({\n attr: {\n active: () => (isActive.value ? true : undefined),\n },\n });\n\n const handleClick = (event: MouseEvent) => {\n event.stopPropagation();\n\n if (isDisabled()) {\n event.preventDefault();\n\n return;\n }\n\n el.dispatchEvent(new CustomEvent('click', { bubbles: true, detail: { value: props.value.value } }));\n };\n\n const tabId = () => `tab-${props.value.value}`;\n const buttonRef = ref<HTMLButtonElement>();\n\n // `aria-controls` as a plain IDREF attribute cannot resolve across shadow-tree boundaries\n // (the matching `id` lives inside <ore-tab-panel>'s own shadow root) — see\n // `setAriaReflection()`'s doc comment. Deferred to `onMounted()`: sibling custom elements\n // (including the peer `<ore-tab-panel>`) connect in tree order within the same synchronous\n // insertion, so a sibling's shadow content may not exist yet during this element's own\n // `setup()` — `onMounted()`'s microtask runs after the whole subtree has connected.\n onMounted(() => {\n watchEffect(() => {\n const button = buttonRef.value;\n const value = props.value.value;\n\n if (!button) return;\n\n const tabsEl = value ? el.closest('ore-tabs') : null;\n const panelEl = tabsEl?.querySelector<HTMLElement>(`:scope > ore-tab-panel[value=\"${value}\"]`);\n const panel = panelEl?.shadowRoot?.querySelector<HTMLElement>('.panel') ?? null;\n\n setAriaReflection(button, 'ariaControlsElements', panel ? [panel] : []);\n });\n });\n\n return html`\n <button\n role=\"tab\"\n type=\"button\"\n part=\"tab\"\n ref=\"${buttonRef}\"\n id=\"${tabId}\"\n aria-selected=\"${isActive}\"\n tabindex=\"${() => (isActive.value ? '0' : '-1')}\"\n aria-disabled=\"${isDisabled}\"\n @click=\"${handleClick}\">\n <slot name=\"prefix\"></slot>\n <slot></slot>\n <slot name=\"suffix\"></slot>\n </button>\n `;\n },\n styles: [colorThemeMixin, forcedColorsFocusMixin('button'), coarsePointerMixin, styles],\n});\n"],"mappings":"+XAwDA,IAAa,EAAe,gBAC5B,EAA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B,CAChB,IAAM,EAAS,EAAU,MACnB,EAAQ,EAAM,MAAM,MAE1B,GAAI,CAAC,EAAQ,OAIb,IAAM,IAFS,EAAQ,EAAG,QAAQ,UAAU,EAAI,KAAA,EACxB,cAA2B,iCAAiC,EAAM,GAAG,EAAA,EACtE,YAAY,cAA2B,QAAQ,GAAK,KAE3E,EAAA,kBAAkB,EAAQ,uBAAwB,EAAQ,CAAC,CAAK,EAAI,CAAC,CAAC,CACxE,CAAC,CACH,CAAC,EAEM,EAAA,IAAI;;;;;eAKA,EAAU;cACX,EAAM;yBACK,EAAS;wBACP,EAAS,MAAQ,IAAM,KAAM;yBAC/B,EAAW;kBAClB,EAAY;;;;;KAM5B,EACA,OAAQ,CAAC,EAAA,gBAAiB,EAAA,uBAAuB,QAAQ,EAAG,EAAA,mBAAoB,EAAA,OAAM,CACxF,CAAC"}
|
package/dist/tab-item.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { coarsePointerMixin as e } from "./styles/mixins/accessibility.css.js";
|
|
2
|
+
import { colorThemeMixin as t, forcedColorsFocusMixin as n } from "./styles/mixins/theme.css.js";
|
|
3
|
+
import { setAriaReflection as r } from "./core/aria-reflection.js";
|
|
4
4
|
import { disablableBundle as i } from "./shared/prop-bundles.js";
|
|
5
5
|
import { TABS_CTX as a } from "./tabs.js";
|
|
6
6
|
import o from "./disclosure/tab-item/tab-item.css.js";
|
|
@@ -17,30 +17,30 @@ c(_, {
|
|
|
17
17
|
value: p.string(""),
|
|
18
18
|
variant: p.string()
|
|
19
19
|
},
|
|
20
|
-
setup(
|
|
21
|
-
let
|
|
22
|
-
i &&
|
|
23
|
-
let e = i.color.value,
|
|
24
|
-
e !== void 0 &&
|
|
20
|
+
setup(e) {
|
|
21
|
+
let t = l(), n = h, i = d(a);
|
|
22
|
+
i && n(() => {
|
|
23
|
+
let e = i.color.value, n = i.size.value, r = i.variant.value;
|
|
24
|
+
e !== void 0 && t.setAttribute("color", e), n !== void 0 && t.setAttribute("size", n), r !== void 0 && t.setAttribute("variant", r);
|
|
25
25
|
});
|
|
26
|
-
let o = g(() => i ? !!i.value.value && i.value.value ===
|
|
26
|
+
let o = g(() => i ? !!i.value.value && i.value.value === e.value.value : e.active.value), c = () => !!e.disabled.value;
|
|
27
27
|
s({ attr: { active: () => o.value ? !0 : void 0 } });
|
|
28
|
-
let p = (
|
|
29
|
-
if (
|
|
30
|
-
|
|
28
|
+
let p = (n) => {
|
|
29
|
+
if (n.stopPropagation(), c()) {
|
|
30
|
+
n.preventDefault();
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
t.dispatchEvent(new CustomEvent("click", {
|
|
34
34
|
bubbles: !0,
|
|
35
|
-
detail: { value:
|
|
35
|
+
detail: { value: e.value.value }
|
|
36
36
|
}));
|
|
37
|
-
}, _ = () => `tab-${
|
|
37
|
+
}, _ = () => `tab-${e.value.value}`, v = m();
|
|
38
38
|
return f(() => {
|
|
39
39
|
h(() => {
|
|
40
|
-
let
|
|
41
|
-
if (!
|
|
42
|
-
let a = ((i ?
|
|
43
|
-
|
|
40
|
+
let n = v.value, i = e.value.value;
|
|
41
|
+
if (!n) return;
|
|
42
|
+
let a = ((i ? t.closest("ore-tabs") : null)?.querySelector(`:scope > ore-tab-panel[value="${i}"]`))?.shadowRoot?.querySelector(".panel") ?? null;
|
|
43
|
+
r(n, "ariaControlsElements", a ? [a] : []);
|
|
44
44
|
});
|
|
45
45
|
}), u`
|
|
46
46
|
<button
|
|
@@ -60,9 +60,9 @@ c(_, {
|
|
|
60
60
|
`;
|
|
61
61
|
},
|
|
62
62
|
styles: [
|
|
63
|
-
n,
|
|
64
|
-
r("button"),
|
|
65
63
|
t,
|
|
64
|
+
n("button"),
|
|
65
|
+
e,
|
|
66
66
|
o
|
|
67
67
|
]
|
|
68
68
|
});
|
package/dist/tab-item.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-item.js","names":[],"sources":["../src/disclosure/tab-item/tab-item.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"tab-item.js","names":[],"sources":["../src/disclosure/tab-item/tab-item.ts"],"sourcesContent":["import { bind, define, getHost, html, inject, onMounted, prop, ref, watchEffect } from '@vielzeug/ore';\nimport { computed } from '@vielzeug/ripple';\nimport { setAriaReflection } from '../../core';\nimport { disablableBundle } from '../../shared';\nimport { coarsePointerMixin, colorThemeMixin, forcedColorsFocusMixin } from '../../styles';\nimport type { ComponentSize, SurfaceVariant, ThemeColor } from '../../types';\nimport { TABS_CTX } from '../tabs/tabs';\nimport styles from './tab-item.css?inline';\n\nexport type OreTabItemProps = {\n /** Whether this tab is currently selected (set by ore-tabs) */\n active?: boolean;\n /** Theme color (inherited from ore-tabs) */\n color?: ThemeColor;\n /** Disable this tab */\n disabled?: boolean;\n /** Size (inherited from ore-tabs) */\n size?: ComponentSize;\n /** Unique value identifier — must match a ore-tab-panel value */\n value: string;\n /** Visual variant (inherited from ore-tabs) */\n variant?: SurfaceVariant;\n};\n\n/**\n * Individual tab trigger. Must be placed in the `tabs` slot of `ore-tabs`.\n *\n * @element ore-tab-item\n *\n * @attr {string} value - Unique identifier, matches the corresponding ore-tab-panel value\n * @attr {boolean} active - Set by the parent ore-tabs when this tab is selected\n * @attr {boolean} disabled - Prevents selection\n * @attr {string} size - 'sm' | 'md' | 'lg'\n * @attr {string} variant - Inherited from ore-tabs: 'solid' | 'flat' | 'bordered' | 'ghost' | 'glass' | 'frost'\n * @attr {string} color - Inherited from ore-tabs: 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'error'\n *\n * @slot prefix - Icon or content before the label\n * @slot - Tab label\n * @slot suffix - Badge or count after the label\n *\n * @cssprop --tab-item-radius - Button border radius\n * @cssprop --tab-item-transition - Transition duration/easing\n * @cssprop --tab-item-padding - Button padding\n * @cssprop --tab-item-font-size - Button font size\n * @cssprop --tab-item-color - Default text color\n * @cssprop --tab-item-hover-bg - Background on hover\n * @cssprop --tab-item-active-bg - Background when active/selected\n * @cssprop --tab-item-active-color - Text color when active/selected\n * @cssprop --tab-item-active-shadow - Box shadow when active/selected\n * @part tab - Tab trigger element.\n * @example\n * ```html\n * <ore-tab-item slot=\"tabs\" value=\"overview\">Overview</ore-tab-item>\n * <ore-tab-item slot=\"tabs\" value=\"settings\" disabled>Settings</ore-tab-item>\n * ```\n */\nexport const TAB_ITEM_TAG = 'ore-tab-item' as const;\ndefine<OreTabItemProps>(TAB_ITEM_TAG, {\n props: {\n ...disablableBundle,\n active: prop.bool(false),\n color: prop.string<ThemeColor>(),\n size: prop.string<ComponentSize>(),\n value: prop.string(''),\n variant: prop.string<SurfaceVariant>(),\n },\n setup(props) {\n const el = getHost();\n const watch = watchEffect;\n\n const tabsCtx = inject(TABS_CTX);\n\n if (tabsCtx) {\n watch(() => {\n const color = tabsCtx.color.value;\n const size = tabsCtx.size.value;\n const variant = tabsCtx.variant.value;\n\n if (color !== undefined) el.setAttribute('color', color);\n\n if (size !== undefined) el.setAttribute('size', size);\n\n if (variant !== undefined) el.setAttribute('variant', variant);\n });\n }\n\n const isActive = computed(() =>\n tabsCtx ? !!tabsCtx.value.value && tabsCtx.value.value === props.value.value : props.active.value,\n );\n const isDisabled = () => Boolean(props.disabled.value);\n\n bind({\n attr: {\n active: () => (isActive.value ? true : undefined),\n },\n });\n\n const handleClick = (event: MouseEvent) => {\n event.stopPropagation();\n\n if (isDisabled()) {\n event.preventDefault();\n\n return;\n }\n\n el.dispatchEvent(new CustomEvent('click', { bubbles: true, detail: { value: props.value.value } }));\n };\n\n const tabId = () => `tab-${props.value.value}`;\n const buttonRef = ref<HTMLButtonElement>();\n\n // `aria-controls` as a plain IDREF attribute cannot resolve across shadow-tree boundaries\n // (the matching `id` lives inside <ore-tab-panel>'s own shadow root) — see\n // `setAriaReflection()`'s doc comment. Deferred to `onMounted()`: sibling custom elements\n // (including the peer `<ore-tab-panel>`) connect in tree order within the same synchronous\n // insertion, so a sibling's shadow content may not exist yet during this element's own\n // `setup()` — `onMounted()`'s microtask runs after the whole subtree has connected.\n onMounted(() => {\n watchEffect(() => {\n const button = buttonRef.value;\n const value = props.value.value;\n\n if (!button) return;\n\n const tabsEl = value ? el.closest('ore-tabs') : null;\n const panelEl = tabsEl?.querySelector<HTMLElement>(`:scope > ore-tab-panel[value=\"${value}\"]`);\n const panel = panelEl?.shadowRoot?.querySelector<HTMLElement>('.panel') ?? null;\n\n setAriaReflection(button, 'ariaControlsElements', panel ? [panel] : []);\n });\n });\n\n return html`\n <button\n role=\"tab\"\n type=\"button\"\n part=\"tab\"\n ref=\"${buttonRef}\"\n id=\"${tabId}\"\n aria-selected=\"${isActive}\"\n tabindex=\"${() => (isActive.value ? '0' : '-1')}\"\n aria-disabled=\"${isDisabled}\"\n @click=\"${handleClick}\">\n <slot name=\"prefix\"></slot>\n <slot></slot>\n <slot name=\"suffix\"></slot>\n </button>\n `;\n },\n styles: [colorThemeMixin, forcedColorsFocusMixin('button'), coarsePointerMixin, styles],\n});\n"],"mappings":";;;;;;;;;AAwDA,IAAa,IAAe;AAC5B,EAAwB,GAAc;CACpC,OAAO;EACL,GAAG;EACH,QAAQ,EAAK,KAAK,EAAK;EACvB,OAAO,EAAK,OAAmB;EAC/B,MAAM,EAAK,OAAsB;EACjC,OAAO,EAAK,OAAO,EAAE;EACrB,SAAS,EAAK,OAAuB;CACvC;CACA,MAAM,GAAO;EACX,IAAM,IAAK,EAAQ,GACb,IAAQ,GAER,IAAU,EAAO,CAAQ;EAE/B,AAAI,KACF,QAAY;GACV,IAAM,IAAQ,EAAQ,MAAM,OACtB,IAAO,EAAQ,KAAK,OACpB,IAAU,EAAQ,QAAQ;GAMhC,AAJI,MAAU,KAAA,KAAW,EAAG,aAAa,SAAS,CAAK,GAEnD,MAAS,KAAA,KAAW,EAAG,aAAa,QAAQ,CAAI,GAEhD,MAAY,KAAA,KAAW,EAAG,aAAa,WAAW,CAAO;EAC/D,CAAC;EAGH,IAAM,IAAW,QACf,IAAU,CAAC,CAAC,EAAQ,MAAM,SAAS,EAAQ,MAAM,UAAU,EAAM,MAAM,QAAQ,EAAM,OAAO,KAC9F,GACM,UAAmB,EAAQ,EAAM,SAAS;EAEhD,EAAK,EACH,MAAM,EACJ,cAAe,EAAS,QAAQ,KAAO,KAAA,EACzC,EACF,CAAC;EAED,IAAM,KAAe,MAAsB;GAGzC,IAFA,EAAM,gBAAgB,GAElB,EAAW,GAAG;IAChB,EAAM,eAAe;IAErB;GACF;GAEA,EAAG,cAAc,IAAI,YAAY,SAAS;IAAE,SAAS;IAAM,QAAQ,EAAE,OAAO,EAAM,MAAM,MAAM;GAAE,CAAC,CAAC;EACpG,GAEM,UAAc,OAAO,EAAM,MAAM,SACjC,IAAY,EAAuB;EAuBzC,OAfA,QAAgB;GACd,QAAkB;IAChB,IAAM,IAAS,EAAU,OACnB,IAAQ,EAAM,MAAM;IAE1B,IAAI,CAAC,GAAQ;IAIb,IAAM,MAFS,IAAQ,EAAG,QAAQ,UAAU,IAAI,KAAA,EACxB,cAA2B,iCAAiC,EAAM,GAAG,EAAA,EACtE,YAAY,cAA2B,QAAQ,KAAK;IAE3E,EAAkB,GAAQ,wBAAwB,IAAQ,CAAC,CAAK,IAAI,CAAC,CAAC;GACxE,CAAC;EACH,CAAC,GAEM,CAAI;;;;;eAKA,EAAU;cACX,EAAM;yBACK,EAAS;0BACP,EAAS,QAAQ,MAAM,KAAM;yBAC/B,EAAW;kBAClB,EAAY;;;;;;CAM5B;CACA,QAAQ;EAAC;EAAiB,EAAuB,QAAQ;EAAG;EAAoB;CAAM;AACxF,CAAC"}
|
package/dist/tab-panel.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./styles/mixins/accessibility.css.cjs"),t=require("./core/aria-reflection.cjs"),n=require("./tabs.cjs"),r=require("./disclosure/tab-panel/tab-panel.css.cjs");let i=require("@vielzeug/ore"),a=require("@vielzeug/ripple");var o={"2xl":`var(--size-12)`,lg:`var(--size-6)`,md:`var(--size-4)`,none:`0`,sm:`var(--size-2)`,xl:`var(--size-8)`,xs:`var(--size-1)`},s=`ore-tab-panel`;(0,i.define)(s,{props:{active:i.prop.bool(!1),lazy:i.prop.bool(!1),padding:i.prop.oneOf([`none`,`xs`,`sm`,`md`,`lg`,`xl`,`2xl`],`md`),value:i.prop.string(``)},setup(e){let r=(0,i.getHost)(),s=i.watchEffect,c=(0,i.inject)(n.TABS_CTX),l=(0,a.computed)(()=>c?!!c.value.value&&c.value.value===e.value.value:e.active.value);(0,i.bind)({attr:{active:()=>l.value?!0:void 0}});let u=(0,a.computed)(()=>o[e.padding.value??`md`]??o.md),d=(0,a.signal)(!1);s(()=>{l.value&&(d.value=!0)});let f=(0,a.computed)(()=>!e.lazy.value||d.value),p=(0,i.styleMap)({"--tab-panel-padding":u}),m=()=>`tabpanel-${e.value.value}`,h=(0,i.ref)();return(0,i.onMounted)(()=>{s(()=>{let n=h.value,i=e.value.value;if(!n)return;let a=((i?r.closest(`ore-tabs`):null)?.querySelector(`:scope > ore-tab-item[value="${i}"]`))?.shadowRoot?.querySelector(`[role="tab"]`)??null;t.setAriaReflection(n,`ariaLabelledByElements`,a?[a]:[])})}),i.html`
|
|
2
2
|
<div
|
|
3
3
|
class="panel"
|
|
4
4
|
part="panel"
|
|
@@ -12,5 +12,5 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
12
12
|
<slot></slot>
|
|
13
13
|
`)}
|
|
14
14
|
</div>
|
|
15
|
-
`},styles:[
|
|
15
|
+
`},styles:[e.reducedMotionMixin,r.default]}),exports.TAB_PANEL_TAG=s;
|
|
16
16
|
//# sourceMappingURL=tab-panel.cjs.map
|
package/dist/tab-panel.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-panel.cjs","names":[],"sources":["../src/disclosure/tab-panel/tab-panel.ts"],"sourcesContent":["import { define, html, inject, prop, ref,
|
|
1
|
+
{"version":3,"file":"tab-panel.cjs","names":[],"sources":["../src/disclosure/tab-panel/tab-panel.ts"],"sourcesContent":["import { bind, define, getHost, html, inject, onMounted, prop, ref, styleMap, watchEffect, when } from '@vielzeug/ore';\nimport { computed, signal } from '@vielzeug/ripple';\n\nimport { setAriaReflection } from '../../core';\nimport { reducedMotionMixin } from '../../styles';\nimport { TABS_CTX } from '../tabs/tabs';\nimport styles from './tab-panel.css?inline';\n\nconst TAB_PANEL_PADDING_PRESET: Record<string, string> = {\n '2xl': 'var(--size-12)',\n lg: 'var(--size-6)',\n md: 'var(--size-4)',\n none: '0',\n sm: 'var(--size-2)',\n xl: 'var(--size-8)',\n xs: 'var(--size-1)',\n};\n\nexport type OreTabPanelProps = {\n /** Active state (managed by ore-tabs) */\n active?: boolean;\n /** When true, the panel content is not rendered until first activation (preserves resources) */\n lazy?: boolean;\n /** Panel padding size: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' (default: 'md' = var(--size-4)) */\n padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** Must match the `value` of its corresponding ore-tab-item */\n value: string;\n};\n\n/**\n * Content panel for a tab. Shown when its `value` matches the selected tab.\n *\n * @element ore-tab-panel\n *\n * @attr {string} value - Must match the corresponding ore-tab-item value\n * @attr {boolean} active - Toggled by the parent ore-tabs\n * @attr {string} padding - Panel padding: 'none' | 'xs' | 'sm' | 'md' (default) | 'lg' | 'xl' | '2xl'\n *\n * @slot - Panel content\n *\n * @cssprop --tab-panel-padding - Inner padding of the panel content area\n * @cssprop --tab-panel-font-size - Font size of the panel content\n * @part panel - Panel container.\n * @example\n * ```html\n * <ore-tab-panel value=\"overview\"><p>Overview content here</p></ore-tab-panel>\n * <ore-tab-panel value=\"settings\" padding=\"lg\"><p>Large padding</p></ore-tab-panel>\n * <ore-tab-panel value=\"code\" padding=\"none\"><pre>No padding for code</pre></ore-tab-panel>\n * ```\n */\nexport const TAB_PANEL_TAG = 'ore-tab-panel' as const;\ndefine<OreTabPanelProps>(TAB_PANEL_TAG, {\n props: {\n active: prop.bool(false),\n lazy: prop.bool(false),\n padding: prop.oneOf(['none', 'xs', 'sm', 'md', 'lg', 'xl', '2xl'] as const, 'md'),\n value: prop.string(''),\n },\n setup(props) {\n const el = getHost();\n const watch = watchEffect;\n\n const tabsCtx = inject(TABS_CTX);\n const isActive = computed(() =>\n tabsCtx ? !!tabsCtx.value.value && tabsCtx.value.value === props.value.value : props.active.value,\n );\n\n bind({\n attr: {\n active: () => (isActive.value ? true : undefined),\n },\n });\n\n // Map padding prop to CSS variable\n const paddingValue = computed(() => {\n const key = props.padding.value ?? 'md';\n\n return TAB_PANEL_PADDING_PRESET[key] ?? TAB_PANEL_PADDING_PRESET.md;\n });\n // Track whether the panel has ever been active (for lazy rendering)\n const hasBeenActive = signal(false);\n\n watch(() => {\n if (isActive.value) hasBeenActive.value = true;\n });\n\n // shouldRender: true if not lazy OR has been active at least once\n const shouldRender = computed(() => !props.lazy.value || hasBeenActive.value);\n const panelStyle = styleMap({ '--tab-panel-padding': paddingValue });\n const panelId = () => `tabpanel-${props.value.value}`;\n const panelRef = ref<HTMLElement>();\n\n // `aria-labelledby` as a plain IDREF attribute cannot resolve across shadow-tree boundaries\n // (the matching `id` lives inside <ore-tab-item>'s own shadow root) — see\n // `setAriaReflection()`'s doc comment. Deferred to `onMounted()`: sibling custom elements\n // (including the peer `<ore-tab-item>`) connect in tree order within the same synchronous\n // insertion, so a sibling's shadow content may not exist yet during this element's own\n // `setup()` — `onMounted()`'s microtask runs after the whole subtree has connected.\n onMounted(() => {\n watch(() => {\n const panel = panelRef.value;\n const value = props.value.value;\n\n if (!panel) return;\n\n const tabsEl = value ? el.closest('ore-tabs') : null;\n const tabEl = tabsEl?.querySelector<HTMLElement>(`:scope > ore-tab-item[value=\"${value}\"]`);\n const button = tabEl?.shadowRoot?.querySelector<HTMLElement>('[role=\"tab\"]') ?? null;\n\n setAriaReflection(panel, 'ariaLabelledByElements', button ? [button] : []);\n });\n });\n\n return html`\n <div\n class=\"panel\"\n part=\"panel\"\n role=\"tabpanel\"\n ref=\"${panelRef}\"\n id=\"${panelId}\"\n aria-hidden=\"${() => String(!isActive.value)}\"\n style=\"${panelStyle}\"\n tabindex=\"0\">\n ${when(\n shouldRender,\n () => html`\n <slot></slot>\n `,\n )}\n </div>\n `;\n },\n styles: [reducedMotionMixin, styles],\n});\n"],"mappings":"+SAQA,IAAM,EAAmD,CACvD,MAAO,iBACP,GAAI,gBACJ,GAAI,gBACJ,KAAM,IACN,GAAI,gBACJ,GAAI,gBACJ,GAAI,eACN,EAkCa,EAAgB,iBAC7B,EAAA,EAAA,OAAA,CAAyB,EAAe,CACtC,MAAO,CACL,OAAQ,EAAA,KAAK,KAAK,EAAK,EACvB,KAAM,EAAA,KAAK,KAAK,EAAK,EACrB,QAAS,EAAA,KAAK,MAAM,CAAC,OAAQ,KAAM,KAAM,KAAM,KAAM,KAAM,KAAK,EAAY,IAAI,EAChF,MAAO,EAAA,KAAK,OAAO,EAAE,CACvB,EACA,MAAM,EAAO,CACX,IAAM,GAAA,EAAK,EAAA,QAAA,CAAQ,EACb,EAAQ,EAAA,YAER,GAAA,EAAU,EAAA,OAAA,CAAO,EAAA,QAAQ,EACzB,GAAA,EAAW,EAAA,SAAA,KACf,EAAU,CAAC,CAAC,EAAQ,MAAM,OAAS,EAAQ,MAAM,QAAU,EAAM,MAAM,MAAQ,EAAM,OAAO,KAC9F,GAEA,EAAA,EAAA,KAAA,CAAK,CACH,KAAM,CACJ,WAAe,EAAS,MAAQ,GAAO,IAAA,EACzC,CACF,CAAC,EAGD,IAAM,GAAA,EAAe,EAAA,SAAA,KAGZ,EAFK,EAAM,QAAQ,OAAS,OAEK,EAAyB,EAClE,EAEK,GAAA,EAAgB,EAAA,OAAA,CAAO,EAAK,EAElC,MAAY,CACN,EAAS,QAAO,EAAc,MAAQ,GAC5C,CAAC,EAGD,IAAM,GAAA,EAAe,EAAA,SAAA,KAAe,CAAC,EAAM,KAAK,OAAS,EAAc,KAAK,EACtE,GAAA,EAAa,EAAA,SAAA,CAAS,CAAE,sBAAuB,CAAa,CAAC,EAC7D,MAAgB,YAAY,EAAM,MAAM,QACxC,GAAA,EAAW,EAAA,IAAA,CAAiB,EAuBlC,OAfA,EAAA,EAAA,UAAA,KAAgB,CACd,MAAY,CACV,IAAM,EAAQ,EAAS,MACjB,EAAQ,EAAM,MAAM,MAE1B,GAAI,CAAC,EAAO,OAIZ,IAAM,IAFS,EAAQ,EAAG,QAAQ,UAAU,EAAI,KAAA,EAC1B,cAA2B,gCAAgC,EAAM,GAAG,EAAA,EACpE,YAAY,cAA2B,cAAc,GAAK,KAEhF,EAAA,kBAAkB,EAAO,yBAA0B,EAAS,CAAC,CAAM,EAAI,CAAC,CAAC,CAC3E,CAAC,CACH,CAAC,EAEM,EAAA,IAAI;;;;;eAKA,EAAS;cACV,EAAQ;2BACO,OAAO,CAAC,EAAS,KAAK,EAAE;iBACpC,EAAW;;WAElB,EAAA,EAAA,KAAA,CACA,MACM,EAAA,IAAI;;WAGZ,EAAE;;KAGR,EACA,OAAQ,CAAC,EAAA,mBAAoB,EAAA,OAAM,CACrC,CAAC"}
|
package/dist/tab-panel.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { reducedMotionMixin as e } from "./styles/mixins/accessibility.css.js";
|
|
2
|
+
import { setAriaReflection as t } from "./core/aria-reflection.js";
|
|
3
3
|
import { TABS_CTX as n } from "./tabs.js";
|
|
4
4
|
import r from "./disclosure/tab-panel/tab-panel.css.js";
|
|
5
5
|
import { bind as i, define as a, getHost as o, html as s, inject as c, onMounted as l, prop as u, ref as d, styleMap as f, watchEffect as p, when as m } from "@vielzeug/ore";
|
|
@@ -29,20 +29,20 @@ a(v, {
|
|
|
29
29
|
], "md"),
|
|
30
30
|
value: u.string("")
|
|
31
31
|
},
|
|
32
|
-
setup(
|
|
33
|
-
let r = o(), a = p, u = c(n), v = h(() => u ? !!u.value.value && u.value.value ===
|
|
32
|
+
setup(e) {
|
|
33
|
+
let r = o(), a = p, u = c(n), v = h(() => u ? !!u.value.value && u.value.value === e.value.value : e.active.value);
|
|
34
34
|
i({ attr: { active: () => v.value ? !0 : void 0 } });
|
|
35
|
-
let y = h(() => _[
|
|
35
|
+
let y = h(() => _[e.padding.value ?? "md"] ?? _.md), b = g(!1);
|
|
36
36
|
a(() => {
|
|
37
37
|
v.value && (b.value = !0);
|
|
38
38
|
});
|
|
39
|
-
let x = h(() => !
|
|
39
|
+
let x = h(() => !e.lazy.value || b.value), S = f({ "--tab-panel-padding": y }), C = () => `tabpanel-${e.value.value}`, w = d();
|
|
40
40
|
return l(() => {
|
|
41
41
|
a(() => {
|
|
42
|
-
let n = w.value, i =
|
|
42
|
+
let n = w.value, i = e.value.value;
|
|
43
43
|
if (!n) return;
|
|
44
44
|
let a = ((i ? r.closest("ore-tabs") : null)?.querySelector(`:scope > ore-tab-item[value="${i}"]`))?.shadowRoot?.querySelector("[role=\"tab\"]") ?? null;
|
|
45
|
-
|
|
45
|
+
t(n, "ariaLabelledByElements", a ? [a] : []);
|
|
46
46
|
});
|
|
47
47
|
}), s`
|
|
48
48
|
<div
|
|
@@ -60,7 +60,7 @@ a(v, {
|
|
|
60
60
|
</div>
|
|
61
61
|
`;
|
|
62
62
|
},
|
|
63
|
-
styles: [
|
|
63
|
+
styles: [e, r]
|
|
64
64
|
});
|
|
65
65
|
//#endregion
|
|
66
66
|
export { v as TAB_PANEL_TAG };
|
package/dist/tab-panel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-panel.js","names":[],"sources":["../src/disclosure/tab-panel/tab-panel.ts"],"sourcesContent":["import { define, html, inject, prop, ref,
|
|
1
|
+
{"version":3,"file":"tab-panel.js","names":[],"sources":["../src/disclosure/tab-panel/tab-panel.ts"],"sourcesContent":["import { bind, define, getHost, html, inject, onMounted, prop, ref, styleMap, watchEffect, when } from '@vielzeug/ore';\nimport { computed, signal } from '@vielzeug/ripple';\n\nimport { setAriaReflection } from '../../core';\nimport { reducedMotionMixin } from '../../styles';\nimport { TABS_CTX } from '../tabs/tabs';\nimport styles from './tab-panel.css?inline';\n\nconst TAB_PANEL_PADDING_PRESET: Record<string, string> = {\n '2xl': 'var(--size-12)',\n lg: 'var(--size-6)',\n md: 'var(--size-4)',\n none: '0',\n sm: 'var(--size-2)',\n xl: 'var(--size-8)',\n xs: 'var(--size-1)',\n};\n\nexport type OreTabPanelProps = {\n /** Active state (managed by ore-tabs) */\n active?: boolean;\n /** When true, the panel content is not rendered until first activation (preserves resources) */\n lazy?: boolean;\n /** Panel padding size: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' (default: 'md' = var(--size-4)) */\n padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** Must match the `value` of its corresponding ore-tab-item */\n value: string;\n};\n\n/**\n * Content panel for a tab. Shown when its `value` matches the selected tab.\n *\n * @element ore-tab-panel\n *\n * @attr {string} value - Must match the corresponding ore-tab-item value\n * @attr {boolean} active - Toggled by the parent ore-tabs\n * @attr {string} padding - Panel padding: 'none' | 'xs' | 'sm' | 'md' (default) | 'lg' | 'xl' | '2xl'\n *\n * @slot - Panel content\n *\n * @cssprop --tab-panel-padding - Inner padding of the panel content area\n * @cssprop --tab-panel-font-size - Font size of the panel content\n * @part panel - Panel container.\n * @example\n * ```html\n * <ore-tab-panel value=\"overview\"><p>Overview content here</p></ore-tab-panel>\n * <ore-tab-panel value=\"settings\" padding=\"lg\"><p>Large padding</p></ore-tab-panel>\n * <ore-tab-panel value=\"code\" padding=\"none\"><pre>No padding for code</pre></ore-tab-panel>\n * ```\n */\nexport const TAB_PANEL_TAG = 'ore-tab-panel' as const;\ndefine<OreTabPanelProps>(TAB_PANEL_TAG, {\n props: {\n active: prop.bool(false),\n lazy: prop.bool(false),\n padding: prop.oneOf(['none', 'xs', 'sm', 'md', 'lg', 'xl', '2xl'] as const, 'md'),\n value: prop.string(''),\n },\n setup(props) {\n const el = getHost();\n const watch = watchEffect;\n\n const tabsCtx = inject(TABS_CTX);\n const isActive = computed(() =>\n tabsCtx ? !!tabsCtx.value.value && tabsCtx.value.value === props.value.value : props.active.value,\n );\n\n bind({\n attr: {\n active: () => (isActive.value ? true : undefined),\n },\n });\n\n // Map padding prop to CSS variable\n const paddingValue = computed(() => {\n const key = props.padding.value ?? 'md';\n\n return TAB_PANEL_PADDING_PRESET[key] ?? TAB_PANEL_PADDING_PRESET.md;\n });\n // Track whether the panel has ever been active (for lazy rendering)\n const hasBeenActive = signal(false);\n\n watch(() => {\n if (isActive.value) hasBeenActive.value = true;\n });\n\n // shouldRender: true if not lazy OR has been active at least once\n const shouldRender = computed(() => !props.lazy.value || hasBeenActive.value);\n const panelStyle = styleMap({ '--tab-panel-padding': paddingValue });\n const panelId = () => `tabpanel-${props.value.value}`;\n const panelRef = ref<HTMLElement>();\n\n // `aria-labelledby` as a plain IDREF attribute cannot resolve across shadow-tree boundaries\n // (the matching `id` lives inside <ore-tab-item>'s own shadow root) — see\n // `setAriaReflection()`'s doc comment. Deferred to `onMounted()`: sibling custom elements\n // (including the peer `<ore-tab-item>`) connect in tree order within the same synchronous\n // insertion, so a sibling's shadow content may not exist yet during this element's own\n // `setup()` — `onMounted()`'s microtask runs after the whole subtree has connected.\n onMounted(() => {\n watch(() => {\n const panel = panelRef.value;\n const value = props.value.value;\n\n if (!panel) return;\n\n const tabsEl = value ? el.closest('ore-tabs') : null;\n const tabEl = tabsEl?.querySelector<HTMLElement>(`:scope > ore-tab-item[value=\"${value}\"]`);\n const button = tabEl?.shadowRoot?.querySelector<HTMLElement>('[role=\"tab\"]') ?? null;\n\n setAriaReflection(panel, 'ariaLabelledByElements', button ? [button] : []);\n });\n });\n\n return html`\n <div\n class=\"panel\"\n part=\"panel\"\n role=\"tabpanel\"\n ref=\"${panelRef}\"\n id=\"${panelId}\"\n aria-hidden=\"${() => String(!isActive.value)}\"\n style=\"${panelStyle}\"\n tabindex=\"0\">\n ${when(\n shouldRender,\n () => html`\n <slot></slot>\n `,\n )}\n </div>\n `;\n },\n styles: [reducedMotionMixin, styles],\n});\n"],"mappings":";;;;;;;AAQA,IAAM,IAAmD;CACvD,OAAO;CACP,IAAI;CACJ,IAAI;CACJ,MAAM;CACN,IAAI;CACJ,IAAI;CACJ,IAAI;AACN,GAkCa,IAAgB;AAC7B,EAAyB,GAAe;CACtC,OAAO;EACL,QAAQ,EAAK,KAAK,EAAK;EACvB,MAAM,EAAK,KAAK,EAAK;EACrB,SAAS,EAAK,MAAM;GAAC;GAAQ;GAAM;GAAM;GAAM;GAAM;GAAM;EAAK,GAAY,IAAI;EAChF,OAAO,EAAK,OAAO,EAAE;CACvB;CACA,MAAM,GAAO;EACX,IAAM,IAAK,EAAQ,GACb,IAAQ,GAER,IAAU,EAAO,CAAQ,GACzB,IAAW,QACf,IAAU,CAAC,CAAC,EAAQ,MAAM,SAAS,EAAQ,MAAM,UAAU,EAAM,MAAM,QAAQ,EAAM,OAAO,KAC9F;EAEA,EAAK,EACH,MAAM,EACJ,cAAe,EAAS,QAAQ,KAAO,KAAA,EACzC,EACF,CAAC;EAGD,IAAM,IAAe,QAGZ,EAFK,EAAM,QAAQ,SAAS,SAEK,EAAyB,EAClE,GAEK,IAAgB,EAAO,EAAK;EAElC,QAAY;GACV,AAAI,EAAS,UAAO,EAAc,QAAQ;EAC5C,CAAC;EAGD,IAAM,IAAe,QAAe,CAAC,EAAM,KAAK,SAAS,EAAc,KAAK,GACtE,IAAa,EAAS,EAAE,uBAAuB,EAAa,CAAC,GAC7D,UAAgB,YAAY,EAAM,MAAM,SACxC,IAAW,EAAiB;EAuBlC,OAfA,QAAgB;GACd,QAAY;IACV,IAAM,IAAQ,EAAS,OACjB,IAAQ,EAAM,MAAM;IAE1B,IAAI,CAAC,GAAO;IAIZ,IAAM,MAFS,IAAQ,EAAG,QAAQ,UAAU,IAAI,KAAA,EAC1B,cAA2B,gCAAgC,EAAM,GAAG,EAAA,EACpE,YAAY,cAA2B,gBAAc,KAAK;IAEhF,EAAkB,GAAO,0BAA0B,IAAS,CAAC,CAAM,IAAI,CAAC,CAAC;GAC3E,CAAC;EACH,CAAC,GAEM,CAAI;;;;;eAKA,EAAS;cACV,EAAQ;6BACO,OAAO,CAAC,EAAS,KAAK,EAAE;iBACpC,EAAW;;UAElB,EACA,SACM,CAAI;;WAGZ,EAAE;;;CAGR;CACA,QAAQ,CAAC,GAAoB,CAAM;AACrC,CAAC"}
|
package/dist/table.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./styles/mixins/accessibility.css.cjs"),t=require("./styles/mixins/table-base.css.cjs"),n=require("./content/table/table.css.cjs");let r=require("@vielzeug/ore");customElements.get(`ore-tr`)||customElements.define(`ore-tr`,class extends HTMLElement{}),customElements.get(`ore-th`)||customElements.define(`ore-th`,class extends HTMLElement{}),customElements.get(`ore-td`)||customElements.define(`ore-td`,class extends HTMLElement{});var i=[`colspan`,`rowspan`,`headers`,`abbr`];function a(e,t,n){if(e.childElementCount>0){let n=e.innerHTML;if(t.getAttribute(`data-src-html`)===n)return;t.setAttribute(`data-src-html`,n),t.textContent=``;for(let n of e.childNodes)t.appendChild(n.cloneNode(!0))}else{let n=e.textContent??``;t.textContent!==n&&(t.textContent=n)}for(let n of i){let r=e.getAttribute(n);r===null?t.removeAttribute(n):t.setAttribute(n,r)}let r=e.getAttribute(`scope`);r===null?n?t.scope=n:t.removeAttribute(`scope`):t.setAttribute(`scope`,r)}function o(e,t,n,r){let i=new WeakMap;t.textContent=``,n.textContent=``,r.textContent=``;for(let o of e.children){if(o.localName!==`ore-tr`)continue;let e=o.hasAttribute(`head`)?t:o.hasAttribute(`foot`)?r:n,s=document.createElement(`tr`);for(let r of o.children){if(r.localName!==`ore-th`&&r.localName!==`ore-td`)continue;let o=r.localName===`ore-th`,c=document.createElement(o?`th`:`td`),l=o?e===t?`col`:`row`:void 0;c.setAttribute(`part`,e===n?`cell`:`header-cell`),c.removeAttribute(`data-src-html`),a(r,c,l),i.set(r,{inferredScope:l,native:c}),s.appendChild(c)}e.appendChild(s)}return i}var s=`ore-table`;(0,r.define)(s,{props:{bordered:r.prop.bool(!1),caption:r.prop.string(),density:r.prop.string(),fullwidth:r.prop.bool(!1),loading:r.prop.bool(!1),sticky:r.prop.bool(!1),striped:r.prop.bool(!1)},setup(e){let t=(0,r.getHost)(),n=r.watchEffect;return(0,r.bind)({attr:{"aria-busy":e.loading,"aria-label":e.caption}}),(0,r.onMounted)(()=>{let r=t.shadowRoot
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./styles/mixins/accessibility.css.cjs"),t=require("./styles/mixins/table-base.css.cjs"),n=require("./content/table/table.css.cjs");let r=require("@vielzeug/ore");customElements.get(`ore-tr`)||customElements.define(`ore-tr`,class extends HTMLElement{}),customElements.get(`ore-th`)||customElements.define(`ore-th`,class extends HTMLElement{}),customElements.get(`ore-td`)||customElements.define(`ore-td`,class extends HTMLElement{});var i=[`colspan`,`rowspan`,`headers`,`abbr`];function a(e,t,n){if(e.childElementCount>0){let n=e.innerHTML;if(t.getAttribute(`data-src-html`)===n)return;t.setAttribute(`data-src-html`,n),t.textContent=``;for(let n of e.childNodes)t.appendChild(n.cloneNode(!0))}else{let n=e.textContent??``;t.textContent!==n&&(t.textContent=n)}for(let n of i){let r=e.getAttribute(n);r===null?t.removeAttribute(n):t.setAttribute(n,r)}let r=e.getAttribute(`scope`);r===null?n?t.scope=n:t.removeAttribute(`scope`):t.setAttribute(`scope`,r)}function o(e,t,n,r){let i=new WeakMap;t.textContent=``,n.textContent=``,r.textContent=``;for(let o of e.children){if(o.localName!==`ore-tr`)continue;let e=o.hasAttribute(`head`)?t:o.hasAttribute(`foot`)?r:n,s=document.createElement(`tr`);for(let r of o.children){if(r.localName!==`ore-th`&&r.localName!==`ore-td`)continue;let o=r.localName===`ore-th`,c=document.createElement(o?`th`:`td`),l=o?e===t?`col`:`row`:void 0;c.setAttribute(`part`,e===n?`cell`:`header-cell`),c.removeAttribute(`data-src-html`),a(r,c,l),i.set(r,{inferredScope:l,native:c}),s.appendChild(c)}e.appendChild(s)}return i}var s=`ore-table`;(0,r.define)(s,{props:{bordered:r.prop.bool(!1),caption:r.prop.string(),density:r.prop.string(),fullwidth:r.prop.bool(!1),loading:r.prop.bool(!1),sticky:r.prop.bool(!1),striped:r.prop.bool(!1)},setup(e){let t=(0,r.getHost)(),n=r.watchEffect;return(0,r.bind)({attr:{"aria-busy":e.loading,"aria-label":e.caption}}),(0,r.onMounted)(()=>{let r=t.shadowRoot?.querySelector(`.scroll-container`),s=document.createElement(`table`),c=document.createElement(`caption`),l=document.createElement(`thead`),u=document.createElement(`tbody`),d=document.createElement(`tfoot`);r.setAttribute(`part`,`scroll`),s.setAttribute(`part`,`table`),l.setAttribute(`part`,`head`),u.setAttribute(`part`,`body`),d.setAttribute(`part`,`foot`),s.append(c,l,u,d),r.appendChild(s),n(()=>{let t=e.caption.value??``;c.textContent=t,c.hidden=t===``});let f=o(t,l,u,d),p=new MutationObserver(e=>{for(let t of e){let e=(t.target instanceof Element?t.target:t.target.parentElement)?.closest(`ore-th, ore-td`);if(e){let t=f.get(e);t&&a(e,t.native,t.inferredScope)}}});p.observe(t,{attributeFilter:[...i,`scope`],attributes:!0,characterData:!0,childList:!0,subtree:!0});let m=new MutationObserver(()=>{f=o(t,l,u,d)});return m.observe(t,{childList:!0}),()=>{m.disconnect(),p.disconnect()}}),r.html`
|
|
2
2
|
<div class="scroll-container"></div>
|
|
3
3
|
`},styles:[e.reducedMotionMixin,t.tableBaseMixin(`table`),n.default]}),exports.TABLE_TAG=s;
|
|
4
4
|
//# sourceMappingURL=table.cjs.map
|
package/dist/table.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.cjs","names":[],"sources":["../src/content/table/table.ts"],"sourcesContent":["import { define, html, prop, bind, getHost, onMounted, watchEffect } from '@vielzeug/ore';\n\nimport { reducedMotionMixin, tableBaseMixin } from '../../styles';\nimport componentStyles from './table.css?inline';\n\n/* ── Types ───────────────────────────────────────────────────────────────── */\n\n/** Table component properties */\nexport type OreTableProps = {\n /** Adds a thicker outer border */\n bordered?: boolean;\n /** Visible caption text — also used as the accessible table label via `aria-label` */\n caption?: string;\n /** Cell density: `'compact'` | `'cozy'` (default) | `'comfortable'` */\n density?: 'compact' | 'cozy' | 'comfortable';\n /** Expands the table to 100% of its container width */\n fullwidth?: boolean;\n /** Applies a busy/disabled state with reduced opacity */\n loading?: boolean;\n /** Enables sticky column headers with a vertical scroll container */\n sticky?: boolean;\n /** Alternating row stripe backgrounds */\n striped?: boolean;\n};\n\n/* ── Child element markers ───────────────────────────────────────────────── */\n// ore-tr, ore-th, ore-td are lightweight light-DOM markers.\n// ore-table reads them and constructs a fully-native shadow <table> so that\n// browser features that require real table elements (colspan/rowspan,\n// position:sticky on <thead>, table layout algorithm) all work correctly.\n// Attributes on ore-th/ore-td are mirrored to the generated native cells.\n\n/**\n * Light-DOM row marker consumed by `<ore-table>`.\n *\n * @element ore-tr\n * @attr {boolean} head - Places the row in the generated `<thead>` section\n * @attr {boolean} foot - Places the row in the generated `<tfoot>` section\n *\n * @example\n * ```html\n * <ore-table>\n * <ore-tr head><ore-th>Name</ore-th><ore-th>Role</ore-th></ore-tr>\n * <ore-tr><ore-td>Alice</ore-td><ore-td>Admin</ore-td></ore-tr>\n * </ore-table>\n * ```\n */\nif (!customElements.get('ore-tr')) customElements.define('ore-tr', class extends HTMLElement {});\n\n/**\n * Light-DOM header cell marker consumed by `<ore-table>`.\n *\n * @element ore-th\n * @attr {number} colspan - Mirrors to native `<th colspan>`\n * @attr {number} rowspan - Mirrors to native `<th rowspan>`\n * @attr {string} scope - Mirrors to native `<th scope>`: 'col' | 'row' | 'colgroup' | 'rowgroup'\n * @attr {string} headers - Mirrors to native `<th headers>`\n *\n * @example\n * ```html\n * <ore-tr head>\n * <ore-th scope=\"col\">Name</ore-th>\n * <ore-th scope=\"col\" colspan=\"2\">Address</ore-th>\n * </ore-tr>\n * ```\n */\nif (!customElements.get('ore-th')) customElements.define('ore-th', class extends HTMLElement {});\n\n/**\n * Light-DOM data cell marker consumed by `<ore-table>`.\n *\n * @element ore-td\n * @attr {number} colspan - Mirrors to native `<td colspan>`\n * @attr {number} rowspan - Mirrors to native `<td rowspan>`\n * @attr {string} headers - Mirrors to native `<td headers>`\n *\n * @example\n * ```html\n * <ore-tr>\n * <ore-td>Alice</ore-td>\n * <ore-td colspan=\"2\">123 Main St, Springfield</ore-td>\n * </ore-tr>\n * ```\n */\nif (!customElements.get('ore-td')) customElements.define('ore-td', class extends HTMLElement {});\n\n/* ── Proxy/mirror helpers ────────────────────────────────────────────────── */\n\n// Attributes forwarded from ore-th/ore-td to the generated native cell.\n// scope is intentionally excluded — it requires fallback logic and is handled separately.\nconst CELL_ATTRS = ['colspan', 'rowspan', 'headers', 'abbr'];\n\n/**\n * Sync text content and tracked attributes from a light-DOM marker to its\n * native mirror. `fallbackScope` is applied when the source element carries no\n * explicit `scope` attribute, ensuring the auto-inferred value is always\n * present and is restored if an explicit override is later removed.\n */\nfunction syncCell(source: Element, native: HTMLTableCellElement, fallbackScope?: string): void {\n if (source.childElementCount > 0) {\n // Source has element children — deep-clone them into the native cell so\n // components like ore-skeleton render correctly inside the shadow table.\n // Guard: skip re-clone if the serialised content is identical to avoid\n // redundant DOM work on every MutationObserver tick (e.g. 250+ cells\n // of skeleton loaders all cloning on each attribute change).\n const snapshot = source.innerHTML;\n\n if (native.getAttribute('data-src-html') === snapshot) return;\n\n native.setAttribute('data-src-html', snapshot);\n native.textContent = '';\n\n for (const child of source.childNodes) {\n native.appendChild(child.cloneNode(true));\n }\n } else {\n const text = source.textContent ?? '';\n\n if (native.textContent !== text) native.textContent = text;\n }\n\n for (const attr of CELL_ATTRS) {\n const val = source.getAttribute(attr);\n\n if (val !== null) native.setAttribute(attr, val);\n else native.removeAttribute(attr);\n }\n\n // scope: explicit attribute wins; otherwise restore the inferred fallback.\n const explicitScope = source.getAttribute('scope');\n\n if (explicitScope !== null) native.setAttribute('scope', explicitScope);\n else if (fallbackScope) native.scope = fallbackScope;\n else native.removeAttribute('scope');\n}\n\n/** Entry stored in the cell map: native mirror element + its inferred scope fallback. */\ntype CellEntry = { inferredScope: string | undefined; native: HTMLTableCellElement };\n\n/**\n * (Re)build the entire native shadow table from the current light-DOM markers.\n * Returns a WeakMap of source marker → CellEntry for targeted sync by the\n * content observer. Storing `inferredScope` per cell ensures that removing an\n * explicit `scope` attribute reverts to the auto-inferred value rather than\n * dropping it entirely.\n */\nfunction buildTable(\n host: HTMLElement,\n thead: HTMLTableSectionElement,\n tbody: HTMLTableSectionElement,\n tfoot: HTMLTableSectionElement,\n): WeakMap<Element, CellEntry> {\n const cellMap = new WeakMap<Element, CellEntry>();\n\n thead.textContent = '';\n tbody.textContent = '';\n tfoot.textContent = '';\n\n for (const child of host.children) {\n if (child.localName !== 'ore-tr') continue;\n\n const section = child.hasAttribute('head') ? thead : child.hasAttribute('foot') ? tfoot : tbody;\n const tr = document.createElement('tr');\n\n for (const cell of child.children) {\n if (cell.localName !== 'ore-th' && cell.localName !== 'ore-td') continue;\n\n const isHeader = cell.localName === 'ore-th';\n const native = document.createElement(isHeader ? 'th' : 'td');\n // Auto-infer scope for <th> elements; undefined for <td>.\n const inferredScope = isHeader ? (section === thead ? 'col' : 'row') : undefined;\n\n native.setAttribute('part', section === tbody ? 'cell' : 'header-cell');\n native.removeAttribute('data-src-html');\n syncCell(cell, native, inferredScope);\n cellMap.set(cell, { inferredScope, native });\n tr.appendChild(native);\n }\n\n section.appendChild(tr);\n }\n\n return cellMap;\n}\n\n/**\n * Data table component.\n *\n * Reads light-DOM `<ore-tr>`/`<ore-th>`/`<ore-td>` markers and projects them\n * into a fully-native shadow `<table>`. Cell attributes (`colspan`, `rowspan`,\n * `scope`, etc.) are mirrored. Changes are observed and synced incrementally.\n *\n * Native table features — sticky headers, colspan/rowspan, the table layout\n * algorithm — all work because the shadow tree contains real table elements.\n *\n * @element ore-table\n *\n * @attr {boolean} bordered - Thicker outer border\n * @attr {string} caption - Caption text shown above the table\n * @attr {boolean} fullwidth - Expands to 100% container width\n * @attr {boolean} loading - Busy state: reduced opacity, no pointer events\n * @attr {string} density - Cell density: 'compact' | 'cozy' | 'comfortable' (default: 'cozy')\n * @attr {boolean} sticky - Sticky `<thead>` with scroll container\n * @attr {boolean} striped - Alternating row backgrounds\n *\n * @part scroll - Scroll container that hosts the generated native table\n * @part table - Generated native `<table>` element\n * @part head - Generated native `<thead>` section\n * @part body - Generated native `<tbody>` section\n * @part foot - Generated native `<tfoot>` section\n * @part cell - Every native `<td>` in `<tbody>` rows\n * @part header-cell - Every native `<th>` / `<td>` in `<thead>` and `<tfoot>` rows\n *\n * @cssprop --table-bg - Table background color\n * @cssprop --table-border-color - Cell separator and outer border color\n * @cssprop --table-radius - Corner radius of the table container\n * @cssprop --table-shadow - Box shadow of the table container\n * @cssprop --table-header-bg - Background of header and footer rows\n * @cssprop --table-accent - Accent color for interactive states\n * @cssprop --table-row-hover-bg - Row hover background\n * @cssprop --table-stripe-bg - Even-row stripe background\n * @cssprop --table-cell-padding-x - Cell horizontal padding\n * @cssprop --table-cell-padding-y - Cell vertical padding\n * @cssprop --table-font-size - Base font size for cells\n * @cssprop --table-sticky-max-height - Max height of the sticky scroll container\n * @cssprop --table-sticky-header-bg - Background of sticky header cells\n * @cssprop --table-sticky-blur - Backdrop blur applied to sticky headers\n *\n * @example\n * ```html\n * <ore-table caption=\"Top repositories\" striped bordered sticky>\n * <ore-tr head>\n * <ore-th>Repository</ore-th>\n * <ore-th>Stars</ore-th>\n * </ore-tr>\n * <ore-tr>\n * <ore-td>vielzeug/refine</ore-td>\n * <ore-td>1 200</ore-td>\n * </ore-tr>\n * </ore-table>\n * ```\n */\nexport const TABLE_TAG = 'ore-table' as const;\ndefine<OreTableProps>(TABLE_TAG, {\n props: {\n bordered: prop.bool(false),\n caption: prop.string(),\n density: prop.string<'compact' | 'cozy' | 'comfortable'>(),\n fullwidth: prop.bool(false),\n loading: prop.bool(false),\n sticky: prop.bool(false),\n striped: prop.bool(false),\n },\n\n setup(props) {\n const el = getHost();\n const watch = watchEffect;\n\n bind({\n attr: {\n 'aria-busy': props.loading,\n 'aria-label': props.caption,\n },\n });\n\n // Build the native shadow table via DOM APIs (not innerHTML) to avoid\n // HTML-parser foster-parenting, which ejects table section elements from\n // their intended positions in the tree.\n onMounted(() => {\n const scrollContainer = el.shadowRoot!.querySelector('.scroll-container')!;\n\n const table = document.createElement('table');\n const captionEl = document.createElement('caption');\n const thead = document.createElement('thead');\n const tbody = document.createElement('tbody');\n const tfoot = document.createElement('tfoot');\n\n scrollContainer.setAttribute('part', 'scroll');\n table.setAttribute('part', 'table');\n thead.setAttribute('part', 'head');\n tbody.setAttribute('part', 'body');\n tfoot.setAttribute('part', 'foot');\n table.append(captionEl, thead, tbody, tfoot);\n scrollContainer.appendChild(table);\n\n // Reactively sync caption text and visibility from prop.\n watch(() => {\n const text = props.caption.value ?? '';\n\n captionEl.textContent = text;\n captionEl.hidden = text === '';\n });\n\n // Initial full build.\n let cellMap = buildTable(el, thead, tbody, tfoot);\n\n // Content observer: syncs text/attribute changes inside ore-th/ore-td.\n // Remains connected throughout the component lifetime — no\n // disconnect/reconnect during structural rebuilds. Records that arrive\n // for cells no longer in cellMap (after a rebuild) are silently ignored\n // by the `if (entry)` guard, so there is no correctness risk.\n const contentObserver = new MutationObserver((records) => {\n for (const rec of records) {\n const sourceCell = (rec.target instanceof Element ? rec.target : rec.target.parentElement)?.closest(\n 'ore-th, ore-td',\n );\n\n if (sourceCell) {\n const entry = cellMap.get(sourceCell);\n\n if (entry) syncCell(sourceCell, entry.native, entry.inferredScope);\n }\n }\n });\n\n contentObserver.observe(el, {\n // Include 'scope' in attributeFilter so explicit scope changes are picked\n // up and the fallback-restore logic in syncCell runs correctly.\n attributeFilter: [...CELL_ATTRS, 'scope'],\n attributes: true,\n characterData: true,\n childList: true,\n subtree: true,\n });\n\n // Structure observer: triggers a full rebuild when ore-tr elements are\n // added, removed, or reordered. Scoped to direct children only so it\n // never fires for cell-level mutations.\n const structureObserver = new MutationObserver(() => {\n cellMap = buildTable(el, thead, tbody, tfoot);\n });\n\n structureObserver.observe(el, { childList: true });\n\n return () => {\n structureObserver.disconnect();\n contentObserver.disconnect();\n };\n });\n\n return html`\n <div class=\"scroll-container\"></div>\n `;\n },\n\n styles: [reducedMotionMixin, tableBaseMixin('table'), componentStyles],\n});\n"],"mappings":"sPA+CK,eAAe,IAAI,QAAQ,GAAG,eAAe,OAAO,SAAU,cAAc,WAAY,CAAC,CAAC,EAmB1F,eAAe,IAAI,QAAQ,GAAG,eAAe,OAAO,SAAU,cAAc,WAAY,CAAC,CAAC,EAkB1F,eAAe,IAAI,QAAQ,GAAG,eAAe,OAAO,SAAU,cAAc,WAAY,CAAC,CAAC,EAM/F,IAAM,EAAa,CAAC,UAAW,UAAW,UAAW,MAAM,EAQ3D,SAAS,EAAS,EAAiB,EAA8B,EAA8B,CAC7F,GAAI,EAAO,kBAAoB,EAAG,CAMhC,IAAM,EAAW,EAAO,UAExB,GAAI,EAAO,aAAa,eAAe,IAAM,EAAU,OAEvD,EAAO,aAAa,gBAAiB,CAAQ,EAC7C,EAAO,YAAc,GAErB,IAAK,IAAM,KAAS,EAAO,WACzB,EAAO,YAAY,EAAM,UAAU,EAAI,CAAC,CAE5C,KAAO,CACL,IAAM,EAAO,EAAO,aAAe,GAE/B,EAAO,cAAgB,IAAM,EAAO,YAAc,EACxD,CAEA,IAAK,IAAM,KAAQ,EAAY,CAC7B,IAAM,EAAM,EAAO,aAAa,CAAI,EAEhC,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AS,EACX,CAAC,EAKD,IAAM,EAAoB,IAAI,qBAAuB,CACnD,EAAU,EAAW,EAAI,EAAO,EAAO,CAAK,CAC9C,CAAC,EAID,OAFA,EAAkB,QAAQ,EAAI,CAAE,UAAW,EAAK,CAAC,MAEpC,CACX,EAAkB,WAAW,EAC7B,EAAgB,WAAW,CAC7B,CACF,CAAC,EAEM,EAAA,IAAI;;KAGb,EAEA,OAAQ,CAAC,EAAA,mBAAoB,EAAA,eAAe,OAAO,EAAG,EAAA,OAAe,CACvE,CAAC"}
|
|
1
|
+
{"version":3,"file":"table.cjs","names":[],"sources":["../src/content/table/table.ts"],"sourcesContent":["import { bind, define, getHost, html, onMounted, prop, watchEffect } from '@vielzeug/ore';\n\nimport { reducedMotionMixin, tableBaseMixin } from '../../styles';\nimport componentStyles from './table.css?inline';\n\n/* ── Types ───────────────────────────────────────────────────────────────── */\n\n/** Table component properties */\nexport type OreTableProps = {\n /** Adds a thicker outer border */\n bordered?: boolean;\n /** Visible caption text — also used as the accessible table label via `aria-label` */\n caption?: string;\n /** Cell density: `'compact'` | `'cozy'` (default) | `'comfortable'` */\n density?: 'compact' | 'cozy' | 'comfortable';\n /** Expands the table to 100% of its container width */\n fullwidth?: boolean;\n /** Applies a busy/disabled state with reduced opacity */\n loading?: boolean;\n /** Enables sticky column headers with a vertical scroll container */\n sticky?: boolean;\n /** Alternating row stripe backgrounds */\n striped?: boolean;\n};\n\n/* ── Child element markers ───────────────────────────────────────────────── */\n// ore-tr, ore-th, ore-td are lightweight light-DOM markers.\n// ore-table reads them and constructs a fully-native shadow <table> so that\n// browser features that require real table elements (colspan/rowspan,\n// position:sticky on <thead>, table layout algorithm) all work correctly.\n// Attributes on ore-th/ore-td are mirrored to the generated native cells.\n\n/**\n * Light-DOM row marker consumed by `<ore-table>`.\n *\n * @element ore-tr\n * @attr {boolean} head - Places the row in the generated `<thead>` section\n * @attr {boolean} foot - Places the row in the generated `<tfoot>` section\n *\n * @example\n * ```html\n * <ore-table>\n * <ore-tr head><ore-th>Name</ore-th><ore-th>Role</ore-th></ore-tr>\n * <ore-tr><ore-td>Alice</ore-td><ore-td>Admin</ore-td></ore-tr>\n * </ore-table>\n * ```\n */\nif (!customElements.get('ore-tr')) customElements.define('ore-tr', class extends HTMLElement {});\n\n/**\n * Light-DOM header cell marker consumed by `<ore-table>`.\n *\n * @element ore-th\n * @attr {number} colspan - Mirrors to native `<th colspan>`\n * @attr {number} rowspan - Mirrors to native `<th rowspan>`\n * @attr {string} scope - Mirrors to native `<th scope>`: 'col' | 'row' | 'colgroup' | 'rowgroup'\n * @attr {string} headers - Mirrors to native `<th headers>`\n *\n * @example\n * ```html\n * <ore-tr head>\n * <ore-th scope=\"col\">Name</ore-th>\n * <ore-th scope=\"col\" colspan=\"2\">Address</ore-th>\n * </ore-tr>\n * ```\n */\nif (!customElements.get('ore-th')) customElements.define('ore-th', class extends HTMLElement {});\n\n/**\n * Light-DOM data cell marker consumed by `<ore-table>`.\n *\n * @element ore-td\n * @attr {number} colspan - Mirrors to native `<td colspan>`\n * @attr {number} rowspan - Mirrors to native `<td rowspan>`\n * @attr {string} headers - Mirrors to native `<td headers>`\n *\n * @example\n * ```html\n * <ore-tr>\n * <ore-td>Alice</ore-td>\n * <ore-td colspan=\"2\">123 Main St, Springfield</ore-td>\n * </ore-tr>\n * ```\n */\nif (!customElements.get('ore-td')) customElements.define('ore-td', class extends HTMLElement {});\n\n/* ── Proxy/mirror helpers ────────────────────────────────────────────────── */\n\n// Attributes forwarded from ore-th/ore-td to the generated native cell.\n// scope is intentionally excluded — it requires fallback logic and is handled separately.\nconst CELL_ATTRS = ['colspan', 'rowspan', 'headers', 'abbr'];\n\n/**\n * Sync text content and tracked attributes from a light-DOM marker to its\n * native mirror. `fallbackScope` is applied when the source element carries no\n * explicit `scope` attribute, ensuring the auto-inferred value is always\n * present and is restored if an explicit override is later removed.\n */\nfunction syncCell(source: Element, native: HTMLTableCellElement, fallbackScope?: string): void {\n if (source.childElementCount > 0) {\n // Source has element children — deep-clone them into the native cell so\n // components like ore-skeleton render correctly inside the shadow table.\n // Guard: skip re-clone if the serialised content is identical to avoid\n // redundant DOM work on every MutationObserver tick (e.g. 250+ cells\n // of skeleton loaders all cloning on each attribute change).\n const snapshot = source.innerHTML;\n\n if (native.getAttribute('data-src-html') === snapshot) return;\n\n native.setAttribute('data-src-html', snapshot);\n native.textContent = '';\n\n for (const child of source.childNodes) {\n native.appendChild(child.cloneNode(true));\n }\n } else {\n const text = source.textContent ?? '';\n\n if (native.textContent !== text) native.textContent = text;\n }\n\n for (const attr of CELL_ATTRS) {\n const val = source.getAttribute(attr);\n\n if (val !== null) native.setAttribute(attr, val);\n else native.removeAttribute(attr);\n }\n\n // scope: explicit attribute wins; otherwise restore the inferred fallback.\n const explicitScope = source.getAttribute('scope');\n\n if (explicitScope !== null) native.setAttribute('scope', explicitScope);\n else if (fallbackScope) native.scope = fallbackScope;\n else native.removeAttribute('scope');\n}\n\n/** Entry stored in the cell map: native mirror element + its inferred scope fallback. */\ntype CellEntry = { inferredScope: string | undefined; native: HTMLTableCellElement };\n\n/**\n * (Re)build the entire native shadow table from the current light-DOM markers.\n * Returns a WeakMap of source marker → CellEntry for targeted sync by the\n * content observer. Storing `inferredScope` per cell ensures that removing an\n * explicit `scope` attribute reverts to the auto-inferred value rather than\n * dropping it entirely.\n */\nfunction buildTable(\n host: HTMLElement,\n thead: HTMLTableSectionElement,\n tbody: HTMLTableSectionElement,\n tfoot: HTMLTableSectionElement,\n): WeakMap<Element, CellEntry> {\n const cellMap = new WeakMap<Element, CellEntry>();\n\n thead.textContent = '';\n tbody.textContent = '';\n tfoot.textContent = '';\n\n for (const child of host.children) {\n if (child.localName !== 'ore-tr') continue;\n\n const section = child.hasAttribute('head') ? thead : child.hasAttribute('foot') ? tfoot : tbody;\n const tr = document.createElement('tr');\n\n for (const cell of child.children) {\n if (cell.localName !== 'ore-th' && cell.localName !== 'ore-td') continue;\n\n const isHeader = cell.localName === 'ore-th';\n const native = document.createElement(isHeader ? 'th' : 'td');\n // Auto-infer scope for <th> elements; undefined for <td>.\n const inferredScope = isHeader ? (section === thead ? 'col' : 'row') : undefined;\n\n native.setAttribute('part', section === tbody ? 'cell' : 'header-cell');\n native.removeAttribute('data-src-html');\n syncCell(cell, native, inferredScope);\n cellMap.set(cell, { inferredScope, native });\n tr.appendChild(native);\n }\n\n section.appendChild(tr);\n }\n\n return cellMap;\n}\n\n/**\n * Data table component.\n *\n * Reads light-DOM `<ore-tr>`/`<ore-th>`/`<ore-td>` markers and projects them\n * into a fully-native shadow `<table>`. Cell attributes (`colspan`, `rowspan`,\n * `scope`, etc.) are mirrored. Changes are observed and synced incrementally.\n *\n * Native table features — sticky headers, colspan/rowspan, the table layout\n * algorithm — all work because the shadow tree contains real table elements.\n *\n * @element ore-table\n *\n * @attr {boolean} bordered - Thicker outer border\n * @attr {string} caption - Caption text shown above the table\n * @attr {boolean} fullwidth - Expands to 100% container width\n * @attr {boolean} loading - Busy state: reduced opacity, no pointer events\n * @attr {string} density - Cell density: 'compact' | 'cozy' | 'comfortable' (default: 'cozy')\n * @attr {boolean} sticky - Sticky `<thead>` with scroll container\n * @attr {boolean} striped - Alternating row backgrounds\n *\n * @part scroll - Scroll container that hosts the generated native table\n * @part table - Generated native `<table>` element\n * @part head - Generated native `<thead>` section\n * @part body - Generated native `<tbody>` section\n * @part foot - Generated native `<tfoot>` section\n * @part cell - Every native `<td>` in `<tbody>` rows\n * @part header-cell - Every native `<th>` / `<td>` in `<thead>` and `<tfoot>` rows\n *\n * @cssprop --table-bg - Table background color\n * @cssprop --table-border-color - Cell separator and outer border color\n * @cssprop --table-radius - Corner radius of the table container\n * @cssprop --table-shadow - Box shadow of the table container\n * @cssprop --table-header-bg - Background of header and footer rows\n * @cssprop --table-accent - Accent color for interactive states\n * @cssprop --table-row-hover-bg - Row hover background\n * @cssprop --table-stripe-bg - Even-row stripe background\n * @cssprop --table-cell-padding-x - Cell horizontal padding\n * @cssprop --table-cell-padding-y - Cell vertical padding\n * @cssprop --table-font-size - Base font size for cells\n * @cssprop --table-sticky-max-height - Max height of the sticky scroll container\n * @cssprop --table-sticky-header-bg - Background of sticky header cells\n * @cssprop --table-sticky-blur - Backdrop blur applied to sticky headers\n *\n * @example\n * ```html\n * <ore-table caption=\"Top repositories\" striped bordered sticky>\n * <ore-tr head>\n * <ore-th>Repository</ore-th>\n * <ore-th>Stars</ore-th>\n * </ore-tr>\n * <ore-tr>\n * <ore-td>vielzeug/refine</ore-td>\n * <ore-td>1 200</ore-td>\n * </ore-tr>\n * </ore-table>\n * ```\n */\nexport const TABLE_TAG = 'ore-table' as const;\ndefine<OreTableProps>(TABLE_TAG, {\n props: {\n bordered: prop.bool(false),\n caption: prop.string(),\n density: prop.string<'compact' | 'cozy' | 'comfortable'>(),\n fullwidth: prop.bool(false),\n loading: prop.bool(false),\n sticky: prop.bool(false),\n striped: prop.bool(false),\n },\n\n setup(props) {\n const el = getHost();\n const watch = watchEffect;\n\n bind({\n attr: {\n 'aria-busy': props.loading,\n 'aria-label': props.caption,\n },\n });\n\n // Build the native shadow table via DOM APIs (not innerHTML) to avoid\n // HTML-parser foster-parenting, which ejects table section elements from\n // their intended positions in the tree.\n onMounted(() => {\n const scrollContainer = el.shadowRoot?.querySelector('.scroll-container')!;\n\n const table = document.createElement('table');\n const captionEl = document.createElement('caption');\n const thead = document.createElement('thead');\n const tbody = document.createElement('tbody');\n const tfoot = document.createElement('tfoot');\n\n scrollContainer.setAttribute('part', 'scroll');\n table.setAttribute('part', 'table');\n thead.setAttribute('part', 'head');\n tbody.setAttribute('part', 'body');\n tfoot.setAttribute('part', 'foot');\n table.append(captionEl, thead, tbody, tfoot);\n scrollContainer.appendChild(table);\n\n // Reactively sync caption text and visibility from prop.\n watch(() => {\n const text = props.caption.value ?? '';\n\n captionEl.textContent = text;\n captionEl.hidden = text === '';\n });\n\n // Initial full build.\n let cellMap = buildTable(el, thead, tbody, tfoot);\n\n // Content observer: syncs text/attribute changes inside ore-th/ore-td.\n // Remains connected throughout the component lifetime — no\n // disconnect/reconnect during structural rebuilds. Records that arrive\n // for cells no longer in cellMap (after a rebuild) are silently ignored\n // by the `if (entry)` guard, so there is no correctness risk.\n const contentObserver = new MutationObserver((records) => {\n for (const rec of records) {\n const sourceCell = (rec.target instanceof Element ? rec.target : rec.target.parentElement)?.closest(\n 'ore-th, ore-td',\n );\n\n if (sourceCell) {\n const entry = cellMap.get(sourceCell);\n\n if (entry) syncCell(sourceCell, entry.native, entry.inferredScope);\n }\n }\n });\n\n contentObserver.observe(el, {\n // Include 'scope' in attributeFilter so explicit scope changes are picked\n // up and the fallback-restore logic in syncCell runs correctly.\n attributeFilter: [...CELL_ATTRS, 'scope'],\n attributes: true,\n characterData: true,\n childList: true,\n subtree: true,\n });\n\n // Structure observer: triggers a full rebuild when ore-tr elements are\n // added, removed, or reordered. Scoped to direct children only so it\n // never fires for cell-level mutations.\n const structureObserver = new MutationObserver(() => {\n cellMap = buildTable(el, thead, tbody, tfoot);\n });\n\n structureObserver.observe(el, { childList: true });\n\n return () => {\n structureObserver.disconnect();\n contentObserver.disconnect();\n };\n });\n\n return html`\n <div class=\"scroll-container\"></div>\n `;\n },\n\n styles: [reducedMotionMixin, tableBaseMixin('table'), componentStyles],\n});\n"],"mappings":"sPA+CK,eAAe,IAAI,QAAQ,GAAG,eAAe,OAAO,SAAU,cAAc,WAAY,CAAC,CAAC,EAmB1F,eAAe,IAAI,QAAQ,GAAG,eAAe,OAAO,SAAU,cAAc,WAAY,CAAC,CAAC,EAkB1F,eAAe,IAAI,QAAQ,GAAG,eAAe,OAAO,SAAU,cAAc,WAAY,CAAC,CAAC,EAM/F,IAAM,EAAa,CAAC,UAAW,UAAW,UAAW,MAAM,EAQ3D,SAAS,EAAS,EAAiB,EAA8B,EAA8B,CAC7F,GAAI,EAAO,kBAAoB,EAAG,CAMhC,IAAM,EAAW,EAAO,UAExB,GAAI,EAAO,aAAa,eAAe,IAAM,EAAU,OAEvD,EAAO,aAAa,gBA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AAO,cAAA,EAAgB,QAC1F,gBACF,EAEA,GAAI,EAAY,CACd,IAAM,EAAQ,EAAQ,IAAI,CAAU,EAEhC,GAAO,EAAS,EAAY,EAAM,OAAQ,EAAM,aAAa,CACnE,CACF,CACF,CAAC,EAED,EAAgB,QAAQ,EAAI,CAG1B,gBAAiB,CAAC,GAAG,EAAY,OAAO,EACxC,WAAY,GACZ,cAAe,GACf,UAAW,GACX,QAAS,EACX,CAAC,EAKD,IAAM,EAAoB,IAAI,qBAAuB,CACnD,EAAU,EAAW,EAAI,EAAO,EAAO,CAAK,CAC9C,CAAC,EAID,OAFA,EAAkB,QAAQ,EAAI,CAAE,UAAW,EAAK,CAAC,MAEpC,CACX,EAAkB,WAAW,EAC7B,EAAgB,WAAW,CAC7B,CACF,CAAC,EAEM,EAAA,IAAI;;KAGb,EAEA,OAAQ,CAAC,EAAA,mBAAoB,EAAA,eAAe,OAAO,EAAG,EAAA,OAAe,CACvE,CAAC"}
|
package/dist/table.js
CHANGED
|
@@ -61,7 +61,7 @@ i(p, {
|
|
|
61
61
|
"aria-busy": e.loading,
|
|
62
62
|
"aria-label": e.caption
|
|
63
63
|
} }), s(() => {
|
|
64
|
-
let r = t.shadowRoot
|
|
64
|
+
let r = t.shadowRoot?.querySelector(".scroll-container"), i = document.createElement("table"), a = document.createElement("caption"), o = document.createElement("thead"), s = document.createElement("tbody"), c = document.createElement("tfoot");
|
|
65
65
|
r.setAttribute("part", "scroll"), i.setAttribute("part", "table"), o.setAttribute("part", "head"), s.setAttribute("part", "body"), c.setAttribute("part", "foot"), i.append(a, o, s, c), r.appendChild(i), n(() => {
|
|
66
66
|
let t = e.caption.value ?? "";
|
|
67
67
|
a.textContent = t, a.hidden = t === "";
|
package/dist/table.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.js","names":[],"sources":["../src/content/table/table.ts"],"sourcesContent":["import { define, html, prop, bind, getHost, onMounted, watchEffect } from '@vielzeug/ore';\n\nimport { reducedMotionMixin, tableBaseMixin } from '../../styles';\nimport componentStyles from './table.css?inline';\n\n/* ── Types ───────────────────────────────────────────────────────────────── */\n\n/** Table component properties */\nexport type OreTableProps = {\n /** Adds a thicker outer border */\n bordered?: boolean;\n /** Visible caption text — also used as the accessible table label via `aria-label` */\n caption?: string;\n /** Cell density: `'compact'` | `'cozy'` (default) | `'comfortable'` */\n density?: 'compact' | 'cozy' | 'comfortable';\n /** Expands the table to 100% of its container width */\n fullwidth?: boolean;\n /** Applies a busy/disabled state with reduced opacity */\n loading?: boolean;\n /** Enables sticky column headers with a vertical scroll container */\n sticky?: boolean;\n /** Alternating row stripe backgrounds */\n striped?: boolean;\n};\n\n/* ── Child element markers ───────────────────────────────────────────────── */\n// ore-tr, ore-th, ore-td are lightweight light-DOM markers.\n// ore-table reads them and constructs a fully-native shadow <table> so that\n// browser features that require real table elements (colspan/rowspan,\n// position:sticky on <thead>, table layout algorithm) all work correctly.\n// Attributes on ore-th/ore-td are mirrored to the generated native cells.\n\n/**\n * Light-DOM row marker consumed by `<ore-table>`.\n *\n * @element ore-tr\n * @attr {boolean} head - Places the row in the generated `<thead>` section\n * @attr {boolean} foot - Places the row in the generated `<tfoot>` section\n *\n * @example\n * ```html\n * <ore-table>\n * <ore-tr head><ore-th>Name</ore-th><ore-th>Role</ore-th></ore-tr>\n * <ore-tr><ore-td>Alice</ore-td><ore-td>Admin</ore-td></ore-tr>\n * </ore-table>\n * ```\n */\nif (!customElements.get('ore-tr')) customElements.define('ore-tr', class extends HTMLElement {});\n\n/**\n * Light-DOM header cell marker consumed by `<ore-table>`.\n *\n * @element ore-th\n * @attr {number} colspan - Mirrors to native `<th colspan>`\n * @attr {number} rowspan - Mirrors to native `<th rowspan>`\n * @attr {string} scope - Mirrors to native `<th scope>`: 'col' | 'row' | 'colgroup' | 'rowgroup'\n * @attr {string} headers - Mirrors to native `<th headers>`\n *\n * @example\n * ```html\n * <ore-tr head>\n * <ore-th scope=\"col\">Name</ore-th>\n * <ore-th scope=\"col\" colspan=\"2\">Address</ore-th>\n * </ore-tr>\n * ```\n */\nif (!customElements.get('ore-th')) customElements.define('ore-th', class extends HTMLElement {});\n\n/**\n * Light-DOM data cell marker consumed by `<ore-table>`.\n *\n * @element ore-td\n * @attr {number} colspan - Mirrors to native `<td colspan>`\n * @attr {number} rowspan - Mirrors to native `<td rowspan>`\n * @attr {string} headers - Mirrors to native `<td headers>`\n *\n * @example\n * ```html\n * <ore-tr>\n * <ore-td>Alice</ore-td>\n * <ore-td colspan=\"2\">123 Main St, Springfield</ore-td>\n * </ore-tr>\n * ```\n */\nif (!customElements.get('ore-td')) customElements.define('ore-td', class extends HTMLElement {});\n\n/* ── Proxy/mirror helpers ────────────────────────────────────────────────── */\n\n// Attributes forwarded from ore-th/ore-td to the generated native cell.\n// scope is intentionally excluded — it requires fallback logic and is handled separately.\nconst CELL_ATTRS = ['colspan', 'rowspan', 'headers', 'abbr'];\n\n/**\n * Sync text content and tracked attributes from a light-DOM marker to its\n * native mirror. `fallbackScope` is applied when the source element carries no\n * explicit `scope` attribute, ensuring the auto-inferred value is always\n * present and is restored if an explicit override is later removed.\n */\nfunction syncCell(source: Element, native: HTMLTableCellElement, fallbackScope?: string): void {\n if (source.childElementCount > 0) {\n // Source has element children — deep-clone them into the native cell so\n // components like ore-skeleton render correctly inside the shadow table.\n // Guard: skip re-clone if the serialised content is identical to avoid\n // redundant DOM work on every MutationObserver tick (e.g. 250+ cells\n // of skeleton loaders all cloning on each attribute change).\n const snapshot = source.innerHTML;\n\n if (native.getAttribute('data-src-html') === snapshot) return;\n\n native.setAttribute('data-src-html', snapshot);\n native.textContent = '';\n\n for (const child of source.childNodes) {\n native.appendChild(child.cloneNode(true));\n }\n } else {\n const text = source.textContent ?? '';\n\n if (native.textContent !== text) native.textContent = text;\n }\n\n for (const attr of CELL_ATTRS) {\n const val = source.getAttribute(attr);\n\n if (val !== null) native.setAttribute(attr, val);\n else native.removeAttribute(attr);\n }\n\n // scope: explicit attribute wins; otherwise restore the inferred fallback.\n const explicitScope = source.getAttribute('scope');\n\n if (explicitScope !== null) native.setAttribute('scope', explicitScope);\n else if (fallbackScope) native.scope = fallbackScope;\n else native.removeAttribute('scope');\n}\n\n/** Entry stored in the cell map: native mirror element + its inferred scope fallback. */\ntype CellEntry = { inferredScope: string | undefined; native: HTMLTableCellElement };\n\n/**\n * (Re)build the entire native shadow table from the current light-DOM markers.\n * Returns a WeakMap of source marker → CellEntry for targeted sync by the\n * content observer. Storing `inferredScope` per cell ensures that removing an\n * explicit `scope` attribute reverts to the auto-inferred value rather than\n * dropping it entirely.\n */\nfunction buildTable(\n host: HTMLElement,\n thead: HTMLTableSectionElement,\n tbody: HTMLTableSectionElement,\n tfoot: HTMLTableSectionElement,\n): WeakMap<Element, CellEntry> {\n const cellMap = new WeakMap<Element, CellEntry>();\n\n thead.textContent = '';\n tbody.textContent = '';\n tfoot.textContent = '';\n\n for (const child of host.children) {\n if (child.localName !== 'ore-tr') continue;\n\n const section = child.hasAttribute('head') ? thead : child.hasAttribute('foot') ? tfoot : tbody;\n const tr = document.createElement('tr');\n\n for (const cell of child.children) {\n if (cell.localName !== 'ore-th' && cell.localName !== 'ore-td') continue;\n\n const isHeader = cell.localName === 'ore-th';\n const native = document.createElement(isHeader ? 'th' : 'td');\n // Auto-infer scope for <th> elements; undefined for <td>.\n const inferredScope = isHeader ? (section === thead ? 'col' : 'row') : undefined;\n\n native.setAttribute('part', section === tbody ? 'cell' : 'header-cell');\n native.removeAttribute('data-src-html');\n syncCell(cell, native, inferredScope);\n cellMap.set(cell, { inferredScope, native });\n tr.appendChild(native);\n }\n\n section.appendChild(tr);\n }\n\n return cellMap;\n}\n\n/**\n * Data table component.\n *\n * Reads light-DOM `<ore-tr>`/`<ore-th>`/`<ore-td>` markers and projects them\n * into a fully-native shadow `<table>`. Cell attributes (`colspan`, `rowspan`,\n * `scope`, etc.) are mirrored. Changes are observed and synced incrementally.\n *\n * Native table features — sticky headers, colspan/rowspan, the table layout\n * algorithm — all work because the shadow tree contains real table elements.\n *\n * @element ore-table\n *\n * @attr {boolean} bordered - Thicker outer border\n * @attr {string} caption - Caption text shown above the table\n * @attr {boolean} fullwidth - Expands to 100% container width\n * @attr {boolean} loading - Busy state: reduced opacity, no pointer events\n * @attr {string} density - Cell density: 'compact' | 'cozy' | 'comfortable' (default: 'cozy')\n * @attr {boolean} sticky - Sticky `<thead>` with scroll container\n * @attr {boolean} striped - Alternating row backgrounds\n *\n * @part scroll - Scroll container that hosts the generated native table\n * @part table - Generated native `<table>` element\n * @part head - Generated native `<thead>` section\n * @part body - Generated native `<tbody>` section\n * @part foot - Generated native `<tfoot>` section\n * @part cell - Every native `<td>` in `<tbody>` rows\n * @part header-cell - Every native `<th>` / `<td>` in `<thead>` and `<tfoot>` rows\n *\n * @cssprop --table-bg - Table background color\n * @cssprop --table-border-color - Cell separator and outer border color\n * @cssprop --table-radius - Corner radius of the table container\n * @cssprop --table-shadow - Box shadow of the table container\n * @cssprop --table-header-bg - Background of header and footer rows\n * @cssprop --table-accent - Accent color for interactive states\n * @cssprop --table-row-hover-bg - Row hover background\n * @cssprop --table-stripe-bg - Even-row stripe background\n * @cssprop --table-cell-padding-x - Cell horizontal padding\n * @cssprop --table-cell-padding-y - Cell vertical padding\n * @cssprop --table-font-size - Base font size for cells\n * @cssprop --table-sticky-max-height - Max height of the sticky scroll container\n * @cssprop --table-sticky-header-bg - Background of sticky header cells\n * @cssprop --table-sticky-blur - Backdrop blur applied to sticky headers\n *\n * @example\n * ```html\n * <ore-table caption=\"Top repositories\" striped bordered sticky>\n * <ore-tr head>\n * <ore-th>Repository</ore-th>\n * <ore-th>Stars</ore-th>\n * </ore-tr>\n * <ore-tr>\n * <ore-td>vielzeug/refine</ore-td>\n * <ore-td>1 200</ore-td>\n * </ore-tr>\n * </ore-table>\n * ```\n */\nexport const TABLE_TAG = 'ore-table' as const;\ndefine<OreTableProps>(TABLE_TAG, {\n props: {\n bordered: prop.bool(false),\n caption: prop.string(),\n density: prop.string<'compact' | 'cozy' | 'comfortable'>(),\n fullwidth: prop.bool(false),\n loading: prop.bool(false),\n sticky: prop.bool(false),\n striped: prop.bool(false),\n },\n\n setup(props) {\n const el = getHost();\n const watch = watchEffect;\n\n bind({\n attr: {\n 'aria-busy': props.loading,\n 'aria-label': props.caption,\n },\n });\n\n // Build the native shadow table via DOM APIs (not innerHTML) to avoid\n // HTML-parser foster-parenting, which ejects table section elements from\n // their intended positions in the tree.\n onMounted(() => {\n const scrollContainer = el.shadowRoot!.querySelector('.scroll-container')!;\n\n const table = document.createElement('table');\n const captionEl = document.createElement('caption');\n const thead = document.createElement('thead');\n const tbody = document.createElement('tbody');\n const tfoot = document.createElement('tfoot');\n\n scrollContainer.setAttribute('part', 'scroll');\n table.setAttribute('part', 'table');\n thead.setAttribute('part', 'head');\n tbody.setAttribute('part', 'body');\n tfoot.setAttribute('part', 'foot');\n table.append(captionEl, thead, tbody, tfoot);\n scrollContainer.appendChild(table);\n\n // Reactively sync caption text and visibility from prop.\n watch(() => {\n const text = props.caption.value ?? '';\n\n captionEl.textContent = text;\n captionEl.hidden = text === '';\n });\n\n // Initial full build.\n let cellMap = buildTable(el, thead, tbody, tfoot);\n\n // Content observer: syncs text/attribute changes inside ore-th/ore-td.\n // Remains connected throughout the component lifetime — no\n // disconnect/reconnect during structural rebuilds. Records that arrive\n // for cells no longer in cellMap (after a rebuild) are silently ignored\n // by the `if (entry)` guard, so there is no correctness risk.\n const contentObserver = new MutationObserver((records) => {\n for (const rec of records) {\n const sourceCell = (rec.target instanceof Element ? rec.target : rec.target.parentElement)?.closest(\n 'ore-th, ore-td',\n );\n\n if (sourceCell) {\n const entry = cellMap.get(sourceCell);\n\n if (entry) syncCell(sourceCell, entry.native, entry.inferredScope);\n }\n }\n });\n\n contentObserver.observe(el, {\n // Include 'scope' in attributeFilter so explicit scope changes are picked\n // up and the fallback-restore logic in syncCell runs correctly.\n attributeFilter: [...CELL_ATTRS, 'scope'],\n attributes: true,\n characterData: true,\n childList: true,\n subtree: true,\n });\n\n // Structure observer: triggers a full rebuild when ore-tr elements are\n // added, removed, or reordered. Scoped to direct children only so it\n // never fires for cell-level mutations.\n const structureObserver = new MutationObserver(() => {\n cellMap = buildTable(el, thead, tbody, tfoot);\n });\n\n structureObserver.observe(el, { childList: true });\n\n return () => {\n structureObserver.disconnect();\n contentObserver.disconnect();\n };\n });\n\n return html`\n <div class=\"scroll-container\"></div>\n `;\n },\n\n styles: [reducedMotionMixin, tableBaseMixin('table'), componentStyles],\n});\n"],"mappings":";;;;AA+CK,eAAe,IAAI,QAAQ,KAAG,eAAe,OAAO,UAAU,cAAc,YAAY,CAAC,CAAC,GAmB1F,eAAe,IAAI,QAAQ,KAAG,eAAe,OAAO,UAAU,cAAc,YAAY,CAAC,CAAC,GAkB1F,eAAe,IAAI,QAAQ,KAAG,eAAe,OAAO,UAAU,cAAc,YAAY,CAAC,CAAC;AAM/F,IAAM,IAAa;CAAC;CAAW;CAAW;CAAW;AAAM;AAQ3D,SAAS,EAAS,GAAiB,GAA8B,GAA8B;CAC7F,IAAI,EAAO,oBAAoB,GAAG;EAMhC,IAAM,IAAW,EAAO;EAExB,IAAI,EAAO,aAAa,eAAe,MAAM,GAAU;EAGvD,AADA,EAAO,aAAa,iBAAiB,CAAQ,GAC7C,EAAO,cAAc;EAErB,KAAK,IAAM,KAAS,EAAO,YACzB,EAAO,YAAY,EAAM,UAAU,EAAI,CAAC;CAE5C,OAAO;EACL,IAAM,IAAO,EAAO,eAAe;EAEnC,AAAI,EAAO,gBAAgB,MAAM,EAAO,cAAc;CACxD;CAEA,KAAK,IAAM,KAAQ,GAAY;EAC7B,IAAM,IAAM,EAAO,aAAa,CAAI;EAEpC,AAAI,MAAQ,OACP,EAAO,gBAAgB,CAAI,IADd,EAAO,aAAa,GAAM,CAAG;CAEjD;CAGA,IAAM,IAAgB,EAAO,aAAa,OAAO;CAEjD,AAAI,MAAkB,OACb,IAAe,EAAO,QAAQ,IAClC,EAAO,gBAAgB,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AEA,QAAQ;EAAC;EAAoB,EAAe,OAAO;EAAG;CAAe;AACvE,CAAC"}
|
|
1
|
+
{"version":3,"file":"table.js","names":[],"sources":["../src/content/table/table.ts"],"sourcesContent":["import { bind, define, getHost, html, onMounted, prop, watchEffect } from '@vielzeug/ore';\n\nimport { reducedMotionMixin, tableBaseMixin } from '../../styles';\nimport componentStyles from './table.css?inline';\n\n/* ── Types ───────────────────────────────────────────────────────────────── */\n\n/** Table component properties */\nexport type OreTableProps = {\n /** Adds a thicker outer border */\n bordered?: boolean;\n /** Visible caption text — also used as the accessible table label via `aria-label` */\n caption?: string;\n /** Cell density: `'compact'` | `'cozy'` (default) | `'comfortable'` */\n density?: 'compact' | 'cozy' | 'comfortable';\n /** Expands the table to 100% of its container width */\n fullwidth?: boolean;\n /** Applies a busy/disabled state with reduced opacity */\n loading?: boolean;\n /** Enables sticky column headers with a vertical scroll container */\n sticky?: boolean;\n /** Alternating row stripe backgrounds */\n striped?: boolean;\n};\n\n/* ── Child element markers ───────────────────────────────────────────────── */\n// ore-tr, ore-th, ore-td are lightweight light-DOM markers.\n// ore-table reads them and constructs a fully-native shadow <table> so that\n// browser features that require real table elements (colspan/rowspan,\n// position:sticky on <thead>, table layout algorithm) all work correctly.\n// Attributes on ore-th/ore-td are mirrored to the generated native cells.\n\n/**\n * Light-DOM row marker consumed by `<ore-table>`.\n *\n * @element ore-tr\n * @attr {boolean} head - Places the row in the generated `<thead>` section\n * @attr {boolean} foot - Places the row in the generated `<tfoot>` section\n *\n * @example\n * ```html\n * <ore-table>\n * <ore-tr head><ore-th>Name</ore-th><ore-th>Role</ore-th></ore-tr>\n * <ore-tr><ore-td>Alice</ore-td><ore-td>Admin</ore-td></ore-tr>\n * </ore-table>\n * ```\n */\nif (!customElements.get('ore-tr')) customElements.define('ore-tr', class extends HTMLElement {});\n\n/**\n * Light-DOM header cell marker consumed by `<ore-table>`.\n *\n * @element ore-th\n * @attr {number} colspan - Mirrors to native `<th colspan>`\n * @attr {number} rowspan - Mirrors to native `<th rowspan>`\n * @attr {string} scope - Mirrors to native `<th scope>`: 'col' | 'row' | 'colgroup' | 'rowgroup'\n * @attr {string} headers - Mirrors to native `<th headers>`\n *\n * @example\n * ```html\n * <ore-tr head>\n * <ore-th scope=\"col\">Name</ore-th>\n * <ore-th scope=\"col\" colspan=\"2\">Address</ore-th>\n * </ore-tr>\n * ```\n */\nif (!customElements.get('ore-th')) customElements.define('ore-th', class extends HTMLElement {});\n\n/**\n * Light-DOM data cell marker consumed by `<ore-table>`.\n *\n * @element ore-td\n * @attr {number} colspan - Mirrors to native `<td colspan>`\n * @attr {number} rowspan - Mirrors to native `<td rowspan>`\n * @attr {string} headers - Mirrors to native `<td headers>`\n *\n * @example\n * ```html\n * <ore-tr>\n * <ore-td>Alice</ore-td>\n * <ore-td colspan=\"2\">123 Main St, Springfield</ore-td>\n * </ore-tr>\n * ```\n */\nif (!customElements.get('ore-td')) customElements.define('ore-td', class extends HTMLElement {});\n\n/* ── Proxy/mirror helpers ────────────────────────────────────────────────── */\n\n// Attributes forwarded from ore-th/ore-td to the generated native cell.\n// scope is intentionally excluded — it requires fallback logic and is handled separately.\nconst CELL_ATTRS = ['colspan', 'rowspan', 'headers', 'abbr'];\n\n/**\n * Sync text content and tracked attributes from a light-DOM marker to its\n * native mirror. `fallbackScope` is applied when the source element carries no\n * explicit `scope` attribute, ensuring the auto-inferred value is always\n * present and is restored if an explicit override is later removed.\n */\nfunction syncCell(source: Element, native: HTMLTableCellElement, fallbackScope?: string): void {\n if (source.childElementCount > 0) {\n // Source has element children — deep-clone them into the native cell so\n // components like ore-skeleton render correctly inside the shadow table.\n // Guard: skip re-clone if the serialised content is identical to avoid\n // redundant DOM work on every MutationObserver tick (e.g. 250+ cells\n // of skeleton loaders all cloning on each attribute change).\n const snapshot = source.innerHTML;\n\n if (native.getAttribute('data-src-html') === snapshot) return;\n\n native.setAttribute('data-src-html', snapshot);\n native.textContent = '';\n\n for (const child of source.childNodes) {\n native.appendChild(child.cloneNode(true));\n }\n } else {\n const text = source.textContent ?? '';\n\n if (native.textContent !== text) native.textContent = text;\n }\n\n for (const attr of CELL_ATTRS) {\n const val = source.getAttribute(attr);\n\n if (val !== null) native.setAttribute(attr, val);\n else native.removeAttribute(attr);\n }\n\n // scope: explicit attribute wins; otherwise restore the inferred fallback.\n const explicitScope = source.getAttribute('scope');\n\n if (explicitScope !== null) native.setAttribute('scope', explicitScope);\n else if (fallbackScope) native.scope = fallbackScope;\n else native.removeAttribute('scope');\n}\n\n/** Entry stored in the cell map: native mirror element + its inferred scope fallback. */\ntype CellEntry = { inferredScope: string | undefined; native: HTMLTableCellElement };\n\n/**\n * (Re)build the entire native shadow table from the current light-DOM markers.\n * Returns a WeakMap of source marker → CellEntry for targeted sync by the\n * content observer. Storing `inferredScope` per cell ensures that removing an\n * explicit `scope` attribute reverts to the auto-inferred value rather than\n * dropping it entirely.\n */\nfunction buildTable(\n host: HTMLElement,\n thead: HTMLTableSectionElement,\n tbody: HTMLTableSectionElement,\n tfoot: HTMLTableSectionElement,\n): WeakMap<Element, CellEntry> {\n const cellMap = new WeakMap<Element, CellEntry>();\n\n thead.textContent = '';\n tbody.textContent = '';\n tfoot.textContent = '';\n\n for (const child of host.children) {\n if (child.localName !== 'ore-tr') continue;\n\n const section = child.hasAttribute('head') ? thead : child.hasAttribute('foot') ? tfoot : tbody;\n const tr = document.createElement('tr');\n\n for (const cell of child.children) {\n if (cell.localName !== 'ore-th' && cell.localName !== 'ore-td') continue;\n\n const isHeader = cell.localName === 'ore-th';\n const native = document.createElement(isHeader ? 'th' : 'td');\n // Auto-infer scope for <th> elements; undefined for <td>.\n const inferredScope = isHeader ? (section === thead ? 'col' : 'row') : undefined;\n\n native.setAttribute('part', section === tbody ? 'cell' : 'header-cell');\n native.removeAttribute('data-src-html');\n syncCell(cell, native, inferredScope);\n cellMap.set(cell, { inferredScope, native });\n tr.appendChild(native);\n }\n\n section.appendChild(tr);\n }\n\n return cellMap;\n}\n\n/**\n * Data table component.\n *\n * Reads light-DOM `<ore-tr>`/`<ore-th>`/`<ore-td>` markers and projects them\n * into a fully-native shadow `<table>`. Cell attributes (`colspan`, `rowspan`,\n * `scope`, etc.) are mirrored. Changes are observed and synced incrementally.\n *\n * Native table features — sticky headers, colspan/rowspan, the table layout\n * algorithm — all work because the shadow tree contains real table elements.\n *\n * @element ore-table\n *\n * @attr {boolean} bordered - Thicker outer border\n * @attr {string} caption - Caption text shown above the table\n * @attr {boolean} fullwidth - Expands to 100% container width\n * @attr {boolean} loading - Busy state: reduced opacity, no pointer events\n * @attr {string} density - Cell density: 'compact' | 'cozy' | 'comfortable' (default: 'cozy')\n * @attr {boolean} sticky - Sticky `<thead>` with scroll container\n * @attr {boolean} striped - Alternating row backgrounds\n *\n * @part scroll - Scroll container that hosts the generated native table\n * @part table - Generated native `<table>` element\n * @part head - Generated native `<thead>` section\n * @part body - Generated native `<tbody>` section\n * @part foot - Generated native `<tfoot>` section\n * @part cell - Every native `<td>` in `<tbody>` rows\n * @part header-cell - Every native `<th>` / `<td>` in `<thead>` and `<tfoot>` rows\n *\n * @cssprop --table-bg - Table background color\n * @cssprop --table-border-color - Cell separator and outer border color\n * @cssprop --table-radius - Corner radius of the table container\n * @cssprop --table-shadow - Box shadow of the table container\n * @cssprop --table-header-bg - Background of header and footer rows\n * @cssprop --table-accent - Accent color for interactive states\n * @cssprop --table-row-hover-bg - Row hover background\n * @cssprop --table-stripe-bg - Even-row stripe background\n * @cssprop --table-cell-padding-x - Cell horizontal padding\n * @cssprop --table-cell-padding-y - Cell vertical padding\n * @cssprop --table-font-size - Base font size for cells\n * @cssprop --table-sticky-max-height - Max height of the sticky scroll container\n * @cssprop --table-sticky-header-bg - Background of sticky header cells\n * @cssprop --table-sticky-blur - Backdrop blur applied to sticky headers\n *\n * @example\n * ```html\n * <ore-table caption=\"Top repositories\" striped bordered sticky>\n * <ore-tr head>\n * <ore-th>Repository</ore-th>\n * <ore-th>Stars</ore-th>\n * </ore-tr>\n * <ore-tr>\n * <ore-td>vielzeug/refine</ore-td>\n * <ore-td>1 200</ore-td>\n * </ore-tr>\n * </ore-table>\n * ```\n */\nexport const TABLE_TAG = 'ore-table' as const;\ndefine<OreTableProps>(TABLE_TAG, {\n props: {\n bordered: prop.bool(false),\n caption: prop.string(),\n density: prop.string<'compact' | 'cozy' | 'comfortable'>(),\n fullwidth: prop.bool(false),\n loading: prop.bool(false),\n sticky: prop.bool(false),\n striped: prop.bool(false),\n },\n\n setup(props) {\n const el = getHost();\n const watch = watchEffect;\n\n bind({\n attr: {\n 'aria-busy': props.loading,\n 'aria-label': props.caption,\n },\n });\n\n // Build the native shadow table via DOM APIs (not innerHTML) to avoid\n // HTML-parser foster-parenting, which ejects table section elements from\n // their intended positions in the tree.\n onMounted(() => {\n const scrollContainer = el.shadowRoot?.querySelector('.scroll-container')!;\n\n const table = document.createElement('table');\n const captionEl = document.createElement('caption');\n const thead = document.createElement('thead');\n const tbody = document.createElement('tbody');\n const tfoot = document.createElement('tfoot');\n\n scrollContainer.setAttribute('part', 'scroll');\n table.setAttribute('part', 'table');\n thead.setAttribute('part', 'head');\n tbody.setAttribute('part', 'body');\n tfoot.setAttribute('part', 'foot');\n table.append(captionEl, thead, tbody, tfoot);\n scrollContainer.appendChild(table);\n\n // Reactively sync caption text and visibility from prop.\n watch(() => {\n const text = props.caption.value ?? '';\n\n captionEl.textContent = text;\n captionEl.hidden = text === '';\n });\n\n // Initial full build.\n let cellMap = buildTable(el, thead, tbody, tfoot);\n\n // Content observer: syncs text/attribute changes inside ore-th/ore-td.\n // Remains connected throughout the component lifetime — no\n // disconnect/reconnect during structural rebuilds. Records that arrive\n // for cells no longer in cellMap (after a rebuild) are silently ignored\n // by the `if (entry)` guard, so there is no correctness risk.\n const contentObserver = new MutationObserver((records) => {\n for (const rec of records) {\n const sourceCell = (rec.target instanceof Element ? rec.target : rec.target.parentElement)?.closest(\n 'ore-th, ore-td',\n );\n\n if (sourceCell) {\n const entry = cellMap.get(sourceCell);\n\n if (entry) syncCell(sourceCell, entry.native, entry.inferredScope);\n }\n }\n });\n\n contentObserver.observe(el, {\n // Include 'scope' in attributeFilter so explicit scope changes are picked\n // up and the fallback-restore logic in syncCell runs correctly.\n attributeFilter: [...CELL_ATTRS, 'scope'],\n attributes: true,\n characterData: true,\n childList: true,\n subtree: true,\n });\n\n // Structure observer: triggers a full rebuild when ore-tr elements are\n // added, removed, or reordered. Scoped to direct children only so it\n // never fires for cell-level mutations.\n const structureObserver = new MutationObserver(() => {\n cellMap = buildTable(el, thead, tbody, tfoot);\n });\n\n structureObserver.observe(el, { childList: true });\n\n return () => {\n structureObserver.disconnect();\n contentObserver.disconnect();\n };\n });\n\n return html`\n <div class=\"scroll-container\"></div>\n `;\n },\n\n styles: [reducedMotionMixin, tableBaseMixin('table'), componentStyles],\n});\n"],"mappings":";;;;AA+CK,eAAe,IAAI,QAAQ,KAAG,eAAe,OAAO,UAAU,cAAc,YAAY,CAAC,CAAC,GAmB1F,eAAe,IAAI,QAAQ,KAAG,eAAe,OAAO,UAAU,cAAc,YAAY,CAAC,CAAC,GAkB1F,eAAe,IAAI,QAAQ,KAAG,eAAe,OAAO,UAAU,cAAc,YAAY,CAAC,CAAC;AAM/F,IAAM,IAAa;CAAC;CAAW;CAAW;CAAW;AAAM;AAQ3D,SAAS,EAAS,GAAiB,GAA8B,GAA8B;CAC7F,IAAI,EAAO,oBAAoB,GAAG;EAMhC,IAAM,IAAW,EAAO;EAExB,IAAI,EAAO,aAAa,eAAe,MAAM,GAAU;EAGvD,AADA,EAAO,aAAa,iBAAiB,CAAQ,GAC7C,EAAO,cAAc;EAErB,KAAK,IAAM,KAAS,EAAO,YACzB,EAAO,YAAY,EAAM,UAAU,EAAI,CAAC;CAE5C,OAAO;EACL,IAAM,IAAO,EAAO,eAAe;EAEnC,AAAI,EAAO,gBAAgB,MAAM,EAAO,cAAc;CACxD;CAEA,KAAK,IAAM,KAAQ,GAAY;EAC7B,IAAM,IAAM,EAAO,aAAa,CAA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W,GAAI,GAAO,GAAO,CAAK;GAC9C,CAAC;GAID,OAFA,EAAkB,QAAQ,GAAI,EAAE,WAAW,GAAK,CAAC,SAEpC;IAEX,AADA,EAAkB,WAAW,GAC7B,EAAgB,WAAW;GAC7B;EACF,CAAC,GAEM,CAAI;;;CAGb;CAEA,QAAQ;EAAC;EAAoB,EAAe,OAAO;EAAG;CAAe;AACvE,CAAC"}
|
package/dist/tabs.cjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./styles/mixins/theme.css.cjs"),t=require("./core/keyboard.cjs"),n=require("./core/ore.cjs"),r=require("./core/direction.cjs"),i=require("./core/nav.cjs"),a=require("./shared/prop-bundles.cjs"),o=require("./disclosure/tabs/tabs.css.cjs");let s=require("@vielzeug/ore"),c=require("@vielzeug/ripple");var l=(0,s.createContext)(`TabsContext`),u=`ore-tabs`;(0,s.define)(u,{props:{...a.themableBundle,...a.sizableBundle,activation:s.prop.oneOf([`auto`,`manual`],`auto`),label:s.prop.string(),orientation:s.prop.oneOf([`horizontal`,`vertical`],`horizontal`),value:s.prop.string(),variant:s.prop.string()},setup(e){let a=(0,s.getHost)(),o=(0,s.useEmit)(),u=a.shadowRoot,d=(0,s.ref)(),f=(0,s.ref)(),p=(0,c.signal)(e.value.value),m=()=>e.activation.value===`manual`,h=()=>e.orientation.value===`vertical`;(0,s.bind)({attr:{value:()=>p.value??null}});let g=()=>[...a.querySelectorAll(`:scope > ore-tab-item[slot="tabs"]`)],_=()=>g().filter(e=>!e.hasAttribute(`disabled`)),v=e=>{e&&(e.shadowRoot?.querySelector(`[role="tab"]`)??e).focus()},y=(e,t=!1)=>{p.value=e,t&&e&&o(`change`,{value:e})},b=()=>{let e=g();if(e.length===0)return;let t=p.value;if(t&&e.some(e=>e.getAttribute(`value`)===t&&!e.hasAttribute(`disabled`)))return;let n=e.find(e=>!e.hasAttribute(`disabled`))?.getAttribute(`value`)??void 0;y(n,!1)};(0,c.watch)(e.value,e=>{p.value=e,b()});let x=i.createListControl({direction:()=>r.elementDirection(a),getItems:()=>_(),loop:!0,onNavigate:(e,t)=>{let n=_()[t];if(v(n),!m()){let e=n?.getAttribute(`value`);e&&y(e,!0)}},orientation:()=>h()?`vertical`:`both`,signal:n.lifecycleSignal(s.onCleanup)});(0,s.provide)(l,{color:e.color,orientation:(0,c.computed)(()=>e.orientation.value??`horizontal`),size:e.size,value:p,variant:e.variant});let S=e=>{let t=f.value,n=d.value;if(!t||!n||!e)return;let r=e.getBoundingClientRect(),i=n.getBoundingClientRect();if(h()){let e=r.top-i.top+n.scrollTop;t.style.transition=`none`,t.style.height=`${r.height}px`,t.style.width=``,t.style.left=`0`,t.style.top=`0`,t.offsetWidth,t.style.transition=``,t.style.transform=`translateY(${e}px)`}else{let e=r.left-i.left+n.scrollLeft;t.style.transition=`none`,t.style.width=`${r.width}px`,t.style.height=``,t.style.top=``,t.style.left=`0`,t.offsetWidth,t.style.transition=``,t.style.transform=`translateX(${e}px)`}},C=()=>{let e=p.value;if(!e)return;let t=g().find(t=>t.getAttribute(`value`)===e);S(t)};(0,c.watch)(p,()=>{requestAnimationFrame(C)});let w=e=>{let t=e.composedPath().find(e=>e instanceof HTMLElement&&e.localName===`ore-tab-item`);if(!t||t.hasAttribute(`disabled`)||t.closest(`ore-tabs`)!==a)return;let n=t.getAttribute(`value`);!n||n===p.value||y(n,!0)},T=t.createInteraction({disabled:(0,c.computed)(()=>!m()),onPress:()=>{let e=_().find(e=>e===document.activeElement||e.shadowRoot?.activeElement===document.activeElement)?.getAttribute(`value`);e&&e!==p.value&&y(e,!0)}});return(0,s.bind)({on:{click:w,keydown:e=>{let t=_();if(t.length===0)return;let n=e.composedPath().find(e=>e instanceof HTMLElement&&e.localName===`ore-tab-item`)??t.find(e=>e.getAttribute(`value`)===p.value),r=n?t.indexOf(n):-1;r>=0&&x.set(r),!x.handleKeydown(e)&&T.handleKeydown(e)}}}),(0,s.onMounted)(()=>{let e=()=>{b(),C()},t=u?.querySelector(`slot[name="tabs"]`);return t&&t.addEventListener(`slotchange`,e),e(),requestAnimationFrame(e),()=>{t&&t.removeEventListener(`slotchange`,e)}}),s.html`
|
|
2
2
|
<div class="tablist-wrapper">
|
|
3
3
|
<div
|
|
4
4
|
role="tablist"
|
|
5
|
-
ref="${
|
|
5
|
+
ref="${d}"
|
|
6
6
|
part="tablist"
|
|
7
|
-
aria-orientation="${
|
|
8
|
-
aria-label="${
|
|
7
|
+
aria-orientation="${e.orientation}"
|
|
8
|
+
aria-label="${e.label}">
|
|
9
9
|
<slot name="tabs"></slot>
|
|
10
10
|
</div>
|
|
11
|
-
<div class="indicator" ref="${
|
|
11
|
+
<div class="indicator" ref="${f}" part="indicator"></div>
|
|
12
12
|
</div>
|
|
13
13
|
<div class="panels" part="panels">
|
|
14
14
|
<slot></slot>
|
|
15
15
|
</div>
|
|
16
|
-
`},styles:[
|
|
16
|
+
`},styles:[e.colorThemeMixin,o.default]}),exports.TABS_CTX=l,exports.TABS_TAG=u;
|
|
17
17
|
//# sourceMappingURL=tabs.cjs.map
|