snice 3.1.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +90 -41
- package/dist/components/accordion/snice-accordion-item.d.ts +2 -2
- package/dist/components/accordion/snice-accordion-item.js +9 -9
- package/dist/components/accordion/snice-accordion-item.js.map +1 -1
- package/dist/components/accordion/snice-accordion.d.ts +2 -2
- package/dist/components/accordion/snice-accordion.js +9 -9
- package/dist/components/accordion/snice-accordion.js.map +1 -1
- package/dist/components/actions/snice-actions.d.ts +28 -0
- package/dist/components/actions/snice-actions.js +220 -0
- package/dist/components/actions/snice-actions.js.map +1 -0
- package/dist/components/actions/snice-actions.types.d.ts +27 -0
- package/dist/components/alert/snice-alert.d.ts +2 -2
- package/dist/components/alert/snice-alert.js +9 -9
- package/dist/components/alert/snice-alert.js.map +1 -1
- package/dist/components/audio-recorder/snice-audio-recorder.d.ts +58 -0
- package/dist/components/audio-recorder/snice-audio-recorder.js +413 -0
- package/dist/components/audio-recorder/snice-audio-recorder.js.map +1 -0
- package/dist/components/audio-recorder/snice-audio-recorder.types.d.ts +28 -0
- package/dist/components/avatar/snice-avatar.d.ts +2 -2
- package/dist/components/avatar/snice-avatar.js +9 -9
- package/dist/components/avatar/snice-avatar.js.map +1 -1
- package/dist/components/badge/snice-badge.d.ts +2 -2
- package/dist/components/badge/snice-badge.js +10 -10
- package/dist/components/badge/snice-badge.js.map +1 -1
- package/dist/components/banner/snice-banner.d.ts +22 -0
- package/dist/components/banner/snice-banner.js +180 -0
- package/dist/components/banner/snice-banner.js.map +1 -0
- package/dist/components/banner/snice-banner.types.d.ts +14 -0
- package/dist/components/breadcrumbs/snice-breadcrumbs.d.ts +2 -2
- package/dist/components/breadcrumbs/snice-breadcrumbs.js +9 -9
- package/dist/components/breadcrumbs/snice-breadcrumbs.js.map +1 -1
- package/dist/components/button/snice-button.d.ts +2 -2
- package/dist/components/button/snice-button.js +9 -9
- package/dist/components/button/snice-button.js.map +1 -1
- package/dist/components/calendar/snice-calendar.d.ts +46 -0
- package/dist/components/calendar/snice-calendar.js +294 -0
- package/dist/components/calendar/snice-calendar.js.map +1 -0
- package/dist/components/calendar/snice-calendar.types.d.ts +34 -0
- package/dist/components/camera/snice-camera.d.ts +39 -0
- package/dist/components/camera/snice-camera.js +286 -0
- package/dist/components/camera/snice-camera.js.map +1 -0
- package/dist/components/camera/snice-camera.types.d.ts +28 -0
- package/dist/components/card/snice-card.d.ts +2 -2
- package/dist/components/card/snice-card.js +9 -9
- package/dist/components/card/snice-card.js.map +1 -1
- package/dist/components/carousel/snice-carousel.d.ts +32 -0
- package/dist/components/carousel/snice-carousel.js +279 -0
- package/dist/components/carousel/snice-carousel.js.map +1 -0
- package/dist/components/carousel/snice-carousel.types.d.ts +22 -0
- package/dist/components/chart/snice-chart.d.ts +73 -0
- package/dist/components/chart/snice-chart.js +940 -0
- package/dist/components/chart/snice-chart.js.map +1 -0
- package/dist/components/chart/snice-chart.types.d.ts +71 -0
- package/dist/components/chat/snice-chat.d.ts +98 -0
- package/dist/components/chat/snice-chat.js +589 -0
- package/dist/components/chat/snice-chat.js.map +1 -0
- package/dist/components/chat/snice-chat.types.d.ts +141 -0
- package/dist/components/checkbox/snice-checkbox.d.ts +2 -2
- package/dist/components/checkbox/snice-checkbox.js +9 -9
- package/dist/components/checkbox/snice-checkbox.js.map +1 -1
- package/dist/components/chip/snice-chip.d.ts +2 -2
- package/dist/components/chip/snice-chip.js +9 -9
- package/dist/components/chip/snice-chip.js.map +1 -1
- package/dist/components/code-block/snice-code-block.d.ts +15 -0
- package/dist/components/code-block/snice-code-block.js +141 -0
- package/dist/components/code-block/snice-code-block.js.map +1 -0
- package/dist/components/code-block/snice-code-block.types.d.ts +15 -0
- package/dist/components/color-display/snice-color-display.d.ts +14 -0
- package/dist/components/color-display/snice-color-display.js +151 -0
- package/dist/components/color-display/snice-color-display.js.map +1 -0
- package/dist/components/color-display/snice-color-display.types.d.ts +10 -0
- package/dist/components/color-picker/snice-color-picker.d.ts +50 -0
- package/dist/components/color-picker/snice-color-picker.js +489 -0
- package/dist/components/color-picker/snice-color-picker.js.map +1 -0
- package/dist/components/color-picker/snice-color-picker.types.d.ts +19 -0
- package/dist/components/command-palette/snice-command-palette.d.ts +47 -0
- package/dist/components/command-palette/snice-command-palette.js +428 -0
- package/dist/components/command-palette/snice-command-palette.js.map +1 -0
- package/dist/components/command-palette/snice-command-palette.types.d.ts +49 -0
- package/dist/components/date-picker/snice-date-picker.d.ts +2 -2
- package/dist/components/date-picker/snice-date-picker.js +10 -10
- package/dist/components/date-picker/snice-date-picker.js.map +1 -1
- package/dist/components/divider/snice-divider.d.ts +2 -2
- package/dist/components/divider/snice-divider.js +9 -9
- package/dist/components/divider/snice-divider.js.map +1 -1
- package/dist/components/doc/snice-doc.d.ts +93 -0
- package/dist/components/doc/snice-doc.js +626 -0
- package/dist/components/doc/snice-doc.js.map +1 -0
- package/dist/components/doc/snice-doc.types.d.ts +118 -0
- package/dist/components/draw/snice-draw.d.ts +71 -0
- package/dist/components/draw/snice-draw.js +709 -0
- package/dist/components/draw/snice-draw.js.map +1 -0
- package/dist/components/draw/snice-draw.types.d.ts +41 -0
- package/dist/components/drawer/snice-drawer.d.ts +2 -2
- package/dist/components/drawer/snice-drawer.js +9 -9
- package/dist/components/drawer/snice-drawer.js.map +1 -1
- package/dist/components/empty-state/snice-empty-state.d.ts +13 -0
- package/dist/components/empty-state/snice-empty-state.js +121 -0
- package/dist/components/empty-state/snice-empty-state.js.map +1 -0
- package/dist/components/empty-state/snice-empty-state.types.d.ts +9 -0
- package/dist/components/file-upload/snice-file-upload.d.ts +44 -0
- package/dist/components/file-upload/snice-file-upload.js +387 -0
- package/dist/components/file-upload/snice-file-upload.js.map +1 -0
- package/dist/components/file-upload/snice-file-upload.types.d.ts +22 -0
- package/dist/components/gantt/snice-gantt.d.ts +29 -0
- package/dist/components/gantt/snice-gantt.js +268 -0
- package/dist/components/gantt/snice-gantt.js.map +1 -0
- package/dist/components/gantt/snice-gantt.types.d.ts +23 -0
- package/dist/components/image/snice-image.d.ts +22 -0
- package/dist/components/image/snice-image.js +201 -0
- package/dist/components/image/snice-image.js.map +1 -0
- package/dist/components/image/snice-image.types.d.ts +17 -0
- package/dist/components/input/snice-input.d.ts +2 -2
- package/dist/components/input/snice-input.js +9 -9
- package/dist/components/input/snice-input.js.map +1 -1
- package/dist/components/kanban/snice-kanban.d.ts +31 -0
- package/dist/components/kanban/snice-kanban.js +243 -0
- package/dist/components/kanban/snice-kanban.js.map +1 -0
- package/dist/components/kanban/snice-kanban.types.d.ts +29 -0
- package/dist/components/kpi/snice-kpi.d.ts +16 -0
- package/dist/components/kpi/snice-kpi.js +162 -0
- package/dist/components/kpi/snice-kpi.js.map +1 -0
- package/dist/components/kpi/snice-kpi.types.d.ts +12 -0
- package/dist/components/layout/snice-layout-blog.d.ts +2 -2
- package/dist/components/layout/snice-layout-blog.js +9 -9
- package/dist/components/layout/snice-layout-blog.js.map +1 -1
- package/dist/components/layout/snice-layout-card.d.ts +2 -2
- package/dist/components/layout/snice-layout-card.js +9 -9
- package/dist/components/layout/snice-layout-card.js.map +1 -1
- package/dist/components/layout/snice-layout-centered.d.ts +2 -2
- package/dist/components/layout/snice-layout-centered.js +9 -9
- package/dist/components/layout/snice-layout-centered.js.map +1 -1
- package/dist/components/layout/snice-layout-dashboard.d.ts +2 -2
- package/dist/components/layout/snice-layout-dashboard.js +9 -9
- package/dist/components/layout/snice-layout-dashboard.js.map +1 -1
- package/dist/components/layout/snice-layout-fullscreen.d.ts +2 -2
- package/dist/components/layout/snice-layout-fullscreen.js +9 -9
- package/dist/components/layout/snice-layout-fullscreen.js.map +1 -1
- package/dist/components/layout/snice-layout-landing.d.ts +2 -2
- package/dist/components/layout/snice-layout-landing.js +9 -9
- package/dist/components/layout/snice-layout-landing.js.map +1 -1
- package/dist/components/layout/snice-layout-minimal.d.ts +2 -2
- package/dist/components/layout/snice-layout-minimal.js +9 -9
- package/dist/components/layout/snice-layout-minimal.js.map +1 -1
- package/dist/components/layout/snice-layout-sidebar.d.ts +2 -2
- package/dist/components/layout/snice-layout-sidebar.js +9 -9
- package/dist/components/layout/snice-layout-sidebar.js.map +1 -1
- package/dist/components/layout/snice-layout-split.d.ts +2 -2
- package/dist/components/layout/snice-layout-split.js +9 -9
- package/dist/components/layout/snice-layout-split.js.map +1 -1
- package/dist/components/layout/snice-layout.d.ts +2 -2
- package/dist/components/layout/snice-layout.js +9 -9
- package/dist/components/layout/snice-layout.js.map +1 -1
- package/dist/components/link/snice-link.d.ts +13 -0
- package/dist/components/link/snice-link.js +137 -0
- package/dist/components/link/snice-link.js.map +1 -0
- package/dist/components/link/snice-link.types.d.ts +11 -0
- package/dist/components/list/snice-list-item.d.ts +6 -0
- package/dist/components/list/snice-list-item.js +68 -0
- package/dist/components/list/snice-list-item.js.map +1 -0
- package/dist/components/list/snice-list.d.ts +23 -0
- package/dist/components/list/snice-list.js +270 -0
- package/dist/components/list/snice-list.js.map +1 -0
- package/dist/components/list/snice-list.types.d.ts +28 -0
- package/dist/components/location/snice-location.d.ts +35 -0
- package/dist/components/location/snice-location.js +238 -0
- package/dist/components/location/snice-location.js.map +1 -0
- package/dist/components/location/snice-location.types.d.ts +35 -0
- package/dist/components/login/snice-login.d.ts +2 -2
- package/dist/components/login/snice-login.js +9 -9
- package/dist/components/login/snice-login.js.map +1 -1
- package/dist/components/menu/snice-menu-divider.d.ts +4 -0
- package/dist/components/menu/snice-menu-divider.js +53 -0
- package/dist/components/menu/snice-menu-divider.js.map +1 -0
- package/dist/components/menu/snice-menu-item.d.ts +10 -0
- package/dist/components/menu/snice-menu-item.js +99 -0
- package/dist/components/menu/snice-menu-item.js.map +1 -0
- package/dist/components/menu/snice-menu-item.types.d.ts +9 -0
- package/dist/components/menu/snice-menu.d.ts +27 -0
- package/dist/components/menu/snice-menu.js +199 -0
- package/dist/components/menu/snice-menu.js.map +1 -0
- package/dist/components/menu/snice-menu.types.d.ts +18 -0
- package/dist/components/modal/snice-modal.d.ts +2 -2
- package/dist/components/modal/snice-modal.js +9 -9
- package/dist/components/modal/snice-modal.js.map +1 -1
- package/dist/components/nav/snice-nav.js +1 -1
- package/dist/components/nav/snice-nav.js.map +1 -1
- package/dist/components/pagination/snice-pagination.d.ts +2 -2
- package/dist/components/pagination/snice-pagination.js +8 -8
- package/dist/components/pagination/snice-pagination.js.map +1 -1
- package/dist/components/progress/snice-progress.d.ts +2 -2
- package/dist/components/progress/snice-progress.js +9 -9
- package/dist/components/progress/snice-progress.js.map +1 -1
- package/dist/components/qr-code/qrcode.d.ts +28 -0
- package/dist/components/qr-code/qrcode.js +906 -0
- package/dist/components/qr-code/qrcode.js.map +1 -0
- package/dist/components/qr-code/snice-qr-code.d.ts +35 -0
- package/dist/components/qr-code/snice-qr-code.js +256 -0
- package/dist/components/qr-code/snice-qr-code.js.map +1 -0
- package/dist/components/qr-code/snice-qr-code.types.d.ts +33 -0
- package/dist/components/radio/snice-radio.d.ts +2 -2
- package/dist/components/radio/snice-radio.js +9 -9
- package/dist/components/radio/snice-radio.js.map +1 -1
- package/dist/components/select/snice-option.d.ts +2 -2
- package/dist/components/select/snice-option.js +8 -8
- package/dist/components/select/snice-option.js.map +1 -1
- package/dist/components/select/snice-select.d.ts +2 -2
- package/dist/components/select/snice-select.js +9 -9
- package/dist/components/select/snice-select.js.map +1 -1
- package/dist/components/skeleton/snice-skeleton.d.ts +2 -2
- package/dist/components/skeleton/snice-skeleton.js +9 -9
- package/dist/components/skeleton/snice-skeleton.js.map +1 -1
- package/dist/components/slider/snice-slider.d.ts +53 -0
- package/dist/components/slider/snice-slider.js +479 -0
- package/dist/components/slider/snice-slider.js.map +1 -0
- package/dist/components/slider/snice-slider.types.d.ts +26 -0
- package/dist/components/snice-cell-C0slgOpe.js +4 -0
- package/dist/components/snice-cell-C0slgOpe.js.map +1 -0
- package/dist/components/sparkline/snice-sparkline.d.ts +21 -0
- package/dist/components/sparkline/snice-sparkline.js +228 -0
- package/dist/components/sparkline/snice-sparkline.js.map +1 -0
- package/dist/components/sparkline/snice-sparkline.types.d.ts +16 -0
- package/dist/components/spinner/snice-spinner.d.ts +10 -0
- package/dist/components/spinner/snice-spinner.js +109 -0
- package/dist/components/spinner/snice-spinner.js.map +1 -0
- package/dist/components/spinner/snice-spinner.types.d.ts +8 -0
- package/dist/components/split-pane/snice-split-pane.d.ts +32 -0
- package/dist/components/split-pane/snice-split-pane.js +191 -0
- package/dist/components/split-pane/snice-split-pane.js.map +1 -0
- package/dist/components/split-pane/snice-split-pane.types.d.ts +19 -0
- package/dist/components/stat/snice-stat.d.ts +14 -0
- package/dist/components/stat/snice-stat.js +140 -0
- package/dist/components/stat/snice-stat.js.map +1 -0
- package/dist/components/stat/snice-stat.types.d.ts +12 -0
- package/dist/components/stepper/snice-stepper-panel.d.ts +8 -0
- package/dist/components/stepper/snice-stepper-panel.js +70 -0
- package/dist/components/stepper/snice-stepper-panel.js.map +1 -0
- package/dist/components/stepper/snice-stepper-panel.types.d.ts +4 -0
- package/dist/components/stepper/snice-stepper.d.ts +15 -0
- package/dist/components/stepper/snice-stepper.js +163 -0
- package/dist/components/stepper/snice-stepper.js.map +1 -0
- package/dist/components/stepper/snice-stepper.types.d.ts +13 -0
- package/dist/components/switch/snice-switch.d.ts +2 -2
- package/dist/components/switch/snice-switch.js +9 -9
- package/dist/components/switch/snice-switch.js.map +1 -1
- package/dist/components/table/snice-cell-actions.d.ts +2 -2
- package/dist/components/table/snice-cell-actions.js +9 -9
- package/dist/components/table/snice-cell-actions.js.map +1 -1
- package/dist/components/table/snice-cell-boolean.d.ts +2 -2
- package/dist/components/table/snice-cell-boolean.js +9 -9
- package/dist/components/table/snice-cell-boolean.js.map +1 -1
- package/dist/components/table/snice-cell-color.d.ts +2 -2
- package/dist/components/table/snice-cell-color.js +9 -9
- package/dist/components/table/snice-cell-color.js.map +1 -1
- package/dist/components/table/snice-cell-currency.d.ts +2 -2
- package/dist/components/table/snice-cell-currency.js +9 -9
- package/dist/components/table/snice-cell-currency.js.map +1 -1
- package/dist/components/table/snice-cell-date.d.ts +2 -2
- package/dist/components/table/snice-cell-date.js +9 -9
- package/dist/components/table/snice-cell-date.js.map +1 -1
- package/dist/components/table/snice-cell-duration.d.ts +2 -2
- package/dist/components/table/snice-cell-duration.js +9 -9
- package/dist/components/table/snice-cell-duration.js.map +1 -1
- package/dist/components/table/snice-cell-email.d.ts +2 -2
- package/dist/components/table/snice-cell-email.js +9 -9
- package/dist/components/table/snice-cell-email.js.map +1 -1
- package/dist/components/table/snice-cell-filesize.d.ts +2 -2
- package/dist/components/table/snice-cell-filesize.js +9 -9
- package/dist/components/table/snice-cell-filesize.js.map +1 -1
- package/dist/components/table/snice-cell-image.d.ts +2 -2
- package/dist/components/table/snice-cell-image.js +9 -9
- package/dist/components/table/snice-cell-image.js.map +1 -1
- package/dist/components/table/snice-cell-json.d.ts +2 -2
- package/dist/components/table/snice-cell-json.js +9 -9
- package/dist/components/table/snice-cell-json.js.map +1 -1
- package/dist/components/table/snice-cell-link.d.ts +2 -2
- package/dist/components/table/snice-cell-link.js +9 -9
- package/dist/components/table/snice-cell-link.js.map +1 -1
- package/dist/components/table/snice-cell-location.d.ts +2 -2
- package/dist/components/table/snice-cell-location.js +9 -9
- package/dist/components/table/snice-cell-location.js.map +1 -1
- package/dist/components/table/snice-cell-number.d.ts +2 -2
- package/dist/components/table/snice-cell-number.js +9 -9
- package/dist/components/table/snice-cell-number.js.map +1 -1
- package/dist/components/table/snice-cell-percentage.d.ts +2 -2
- package/dist/components/table/snice-cell-percentage.js +9 -9
- package/dist/components/table/snice-cell-percentage.js.map +1 -1
- package/dist/components/table/snice-cell-phone.d.ts +2 -2
- package/dist/components/table/snice-cell-phone.js +9 -9
- package/dist/components/table/snice-cell-phone.js.map +1 -1
- package/dist/components/table/snice-cell-progress.d.ts +2 -2
- package/dist/components/table/snice-cell-progress.js +9 -9
- package/dist/components/table/snice-cell-progress.js.map +1 -1
- package/dist/components/table/snice-cell-rating.d.ts +2 -2
- package/dist/components/table/snice-cell-rating.js +9 -9
- package/dist/components/table/snice-cell-rating.js.map +1 -1
- package/dist/components/table/snice-cell-sparkline.d.ts +2 -2
- package/dist/components/table/snice-cell-sparkline.js +9 -9
- package/dist/components/table/snice-cell-sparkline.js.map +1 -1
- package/dist/components/table/snice-cell-status.d.ts +2 -2
- package/dist/components/table/snice-cell-status.js +9 -9
- package/dist/components/table/snice-cell-status.js.map +1 -1
- package/dist/components/table/snice-cell-tag.d.ts +2 -2
- package/dist/components/table/snice-cell-tag.js +9 -9
- package/dist/components/table/snice-cell-tag.js.map +1 -1
- package/dist/components/table/snice-cell-text.d.ts +2 -2
- package/dist/components/table/snice-cell-text.js +9 -9
- package/dist/components/table/snice-cell-text.js.map +1 -1
- package/dist/components/table/snice-cell.d.ts +2 -2
- package/dist/components/table/snice-cell.js +9 -9
- package/dist/components/table/snice-cell.js.map +1 -1
- package/dist/components/table/snice-column.d.ts +1 -1
- package/dist/components/table/snice-column.js +4 -4
- package/dist/components/table/snice-column.js.map +1 -1
- package/dist/components/table/snice-header.d.ts +2 -2
- package/dist/components/table/snice-header.js +9 -9
- package/dist/components/table/snice-header.js.map +1 -1
- package/dist/components/table/snice-progress.d.ts +2 -2
- package/dist/components/table/snice-progress.js +8 -8
- package/dist/components/table/snice-progress.js.map +1 -1
- package/dist/components/table/snice-rating.d.ts +2 -2
- package/dist/components/table/snice-rating.js +8 -8
- package/dist/components/table/snice-rating.js.map +1 -1
- package/dist/components/table/snice-row.d.ts +2 -2
- package/dist/components/table/snice-row.js +10 -10
- package/dist/components/table/snice-row.js.map +1 -1
- package/dist/components/table/snice-table.d.ts +2 -3
- package/dist/components/table/snice-table.js +9 -14
- package/dist/components/table/snice-table.js.map +1 -1
- package/dist/components/tabs/snice-tab-panel.d.ts +2 -2
- package/dist/components/tabs/snice-tab-panel.js +9 -9
- package/dist/components/tabs/snice-tab-panel.js.map +1 -1
- package/dist/components/tabs/snice-tab.d.ts +2 -2
- package/dist/components/tabs/snice-tab.js +9 -9
- package/dist/components/tabs/snice-tab.js.map +1 -1
- package/dist/components/tabs/snice-tabs.d.ts +2 -2
- package/dist/components/tabs/snice-tabs.js +9 -9
- package/dist/components/tabs/snice-tabs.js.map +1 -1
- package/dist/components/terminal/snice-terminal.types.d.ts +133 -0
- package/dist/components/textarea/snice-textarea.d.ts +52 -0
- package/dist/components/textarea/snice-textarea.js +407 -0
- package/dist/components/textarea/snice-textarea.js.map +1 -0
- package/dist/components/textarea/snice-textarea.types.d.ts +30 -0
- package/dist/components/timeline/snice-timeline.d.ts +11 -0
- package/dist/components/timeline/snice-timeline.js +112 -0
- package/dist/components/timeline/snice-timeline.js.map +1 -0
- package/dist/components/timeline/snice-timeline.types.d.ts +16 -0
- package/dist/components/toast/snice-toast-container.d.ts +2 -2
- package/dist/components/toast/snice-toast-container.js +8 -8
- package/dist/components/toast/snice-toast-container.js.map +1 -1
- package/dist/components/toast/snice-toast.d.ts +2 -2
- package/dist/components/toast/snice-toast.js +8 -8
- package/dist/components/toast/snice-toast.js.map +1 -1
- package/dist/components/tooltip/snice-tooltip.d.ts +2 -2
- package/dist/components/tooltip/snice-tooltip.js +10 -10
- package/dist/components/tooltip/snice-tooltip.js.map +1 -1
- package/dist/components/tree/snice-tree-item.d.ts +35 -0
- package/dist/components/tree/snice-tree-item.js +301 -0
- package/dist/components/tree/snice-tree-item.js.map +1 -0
- package/dist/components/tree/snice-tree-item.types.d.ts +30 -0
- package/dist/components/tree/snice-tree.d.ts +45 -0
- package/dist/components/tree/snice-tree.js +390 -0
- package/dist/components/tree/snice-tree.js.map +1 -0
- package/dist/components/tree/snice-tree.types.d.ts +65 -0
- package/dist/components/virtual-scroller/snice-virtual-scroller.d.ts +31 -0
- package/dist/components/virtual-scroller/snice-virtual-scroller.js +160 -0
- package/dist/components/virtual-scroller/snice-virtual-scroller.js.map +1 -0
- package/dist/components/virtual-scroller/snice-virtual-scroller.types.d.ts +19 -0
- package/dist/index.cjs +125 -158
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +125 -158
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +125 -158
- package/dist/index.iife.js.map +1 -1
- package/dist/parts.d.ts +13 -16
- package/dist/symbols.cjs +1 -1
- package/dist/symbols.esm.js +1 -1
- package/dist/template.d.ts +0 -1
- package/dist/transitions.cjs +1 -1
- package/dist/transitions.esm.js +1 -1
- package/docs/ai/README.md +10 -1
- package/docs/ai/components/actions.md +81 -0
- package/docs/ai/components/audio-recorder.md +97 -0
- package/docs/ai/components/banner.md +84 -0
- package/docs/ai/components/calendar.md +95 -0
- package/docs/ai/components/camera.md +130 -0
- package/docs/ai/components/carousel.md +49 -0
- package/docs/ai/components/chart.md +160 -0
- package/docs/ai/components/chat.md +189 -0
- package/docs/ai/components/code-block.md +32 -0
- package/docs/ai/components/color-display.md +48 -0
- package/docs/ai/components/color-picker.md +75 -0
- package/docs/ai/components/command-palette.md +117 -0
- package/docs/ai/components/doc.md +154 -0
- package/docs/ai/components/draw.md +140 -0
- package/docs/ai/components/empty-state.md +72 -0
- package/docs/ai/components/file-upload.md +93 -0
- package/docs/ai/components/gantt.md +95 -0
- package/docs/ai/components/image.md +60 -0
- package/docs/ai/components/kanban.md +102 -0
- package/docs/ai/components/kpi.md +158 -0
- package/docs/ai/components/layout.md +261 -0
- package/docs/ai/components/link.md +77 -0
- package/docs/ai/components/list.md +50 -0
- package/docs/ai/components/location.md +75 -0
- package/docs/ai/components/menu.md +114 -0
- package/docs/ai/components/popover.md +70 -0
- package/docs/ai/components/qr-code.md +106 -0
- package/docs/ai/components/slider.md +87 -0
- package/docs/ai/components/sparkline.md +168 -0
- package/docs/ai/components/spinner.md +47 -0
- package/docs/ai/components/split-pane.md +71 -0
- package/docs/ai/components/stat.md +29 -0
- package/docs/ai/components/stepper.md +216 -0
- package/docs/ai/components/textarea.md +87 -0
- package/docs/ai/components/timeline.md +77 -0
- package/docs/ai/components/tree.md +191 -0
- package/docs/ai/components/virtual-scroller.md +71 -0
- package/docs/components/actions.md +317 -0
- package/docs/components/alert.md +540 -0
- package/docs/components/audio-recorder.md +152 -0
- package/docs/components/badge.md +593 -0
- package/docs/components/banner.md +106 -0
- package/docs/components/breadcrumbs.md +568 -0
- package/docs/components/button.md +648 -0
- package/docs/components/calendar.md +397 -0
- package/docs/components/camera.md +383 -0
- package/docs/components/card.md +778 -0
- package/docs/components/carousel.md +63 -0
- package/docs/components/chart.md +526 -0
- package/docs/components/chat.md +482 -0
- package/docs/components/checkbox.md +714 -0
- package/docs/components/chip.md +670 -0
- package/docs/components/code-block.md +49 -0
- package/docs/components/color-display.md +96 -0
- package/docs/components/color-picker.md +81 -0
- package/docs/components/command-palette.md +159 -0
- package/docs/components/doc.md +357 -0
- package/docs/components/draw.md +307 -0
- package/docs/components/empty-state.md +79 -0
- package/docs/components/file-upload.md +263 -0
- package/docs/components/gantt.md +347 -0
- package/docs/components/image.md +110 -0
- package/docs/components/kanban.md +410 -0
- package/docs/components/kpi.md +251 -0
- package/docs/components/link.md +229 -0
- package/docs/components/list.md +65 -0
- package/docs/components/location.md +369 -0
- package/docs/components/menu.md +633 -0
- package/docs/components/popover.md +333 -0
- package/docs/components/qr-code.md +464 -0
- package/docs/components/slider.md +297 -0
- package/docs/components/sparkline.md +293 -0
- package/docs/components/spinner.md +63 -0
- package/docs/components/split-pane.md +315 -0
- package/docs/components/stat.md +45 -0
- package/docs/components/stepper.md +410 -0
- package/docs/components/textarea.md +235 -0
- package/docs/components/timeline.md +192 -0
- package/docs/components/tree.md +536 -0
- package/docs/components/virtual-scroller.md +298 -0
- package/package.json +2 -1
- package/dist/components/snice-cell-BLFVdxPp.js +0 -4
- package/dist/components/snice-cell-BLFVdxPp.js.map +0 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* snice v3.
|
|
2
|
+
* snice v3.2.0
|
|
3
3
|
* Imperative TypeScript framework for building vanilla web components with decorators, differential rendering, routing, and controllers. No virtual DOM, no build complexity.
|
|
4
4
|
* (c) 2024
|
|
5
5
|
* Released under the MIT License.
|
|
@@ -702,7 +702,6 @@ function cleanupResponseHandlers(instance) {
|
|
|
702
702
|
|
|
703
703
|
/**
|
|
704
704
|
* Template system for Snice v3.0.0
|
|
705
|
-
* Inspired by lit-html but custom implementation
|
|
706
705
|
* Provides html`` and css`` tagged template processors with differential rendering
|
|
707
706
|
*/
|
|
708
707
|
// Unique symbols for type checking
|
|
@@ -803,18 +802,14 @@ function isUnsafeHTML(value) {
|
|
|
803
802
|
return value && value._$litType$ === UNSAFE_HTML;
|
|
804
803
|
}
|
|
805
804
|
|
|
806
|
-
/**
|
|
807
|
-
* Simplified lit-html-style template system
|
|
808
|
-
* Based on lit-html's approach but simplified
|
|
809
|
-
*/
|
|
810
805
|
// Unique marker for dynamic parts
|
|
811
|
-
// Using processing instruction syntax like lit-html for better compatibility
|
|
812
806
|
// This parses as a comment node but doesn't get escaped in attributes
|
|
813
807
|
const marker = `snice$${Math.random().toFixed(9).slice(2)}$`;
|
|
814
808
|
const markerMatch = '?' + marker;
|
|
815
809
|
const nodeMarker = `<${markerMatch}>`;
|
|
816
810
|
const markerRegex = new RegExp(marker, 'g');
|
|
817
|
-
// Template cache
|
|
811
|
+
// Template cache - templates with same string array can be reused
|
|
812
|
+
const templateCache = new WeakMap();
|
|
818
813
|
/**
|
|
819
814
|
* A prepared template ready for rendering
|
|
820
815
|
*/
|
|
@@ -831,8 +826,8 @@ class Template {
|
|
|
831
826
|
const element = node;
|
|
832
827
|
const tagName = element.tagName.toLowerCase();
|
|
833
828
|
// Handle virtual elements: <if>, <case>
|
|
834
|
-
//
|
|
835
|
-
//
|
|
829
|
+
// Keep them in the DOM with display:contents for now
|
|
830
|
+
// Will optimize later with proper template extraction
|
|
836
831
|
if (tagName === 'if') {
|
|
837
832
|
// <if value="${condition}">children</if>
|
|
838
833
|
const valueAttr = element.getAttribute('value');
|
|
@@ -840,16 +835,15 @@ class Template {
|
|
|
840
835
|
// Remove the value attribute
|
|
841
836
|
element.removeAttribute('value');
|
|
842
837
|
this.parts.push({
|
|
843
|
-
type: 'if',
|
|
838
|
+
type: 'conditional-if',
|
|
844
839
|
index: partIndex++,
|
|
845
|
-
element // Keep the <if> element
|
|
840
|
+
element // Keep the <if> element
|
|
846
841
|
});
|
|
847
842
|
// Continue processing children normally
|
|
848
843
|
}
|
|
849
844
|
continue;
|
|
850
845
|
}
|
|
851
846
|
// Handle <case> element
|
|
852
|
-
// Like <if>, <case> stays in DOM styled with display:contents
|
|
853
847
|
if (tagName === 'case') {
|
|
854
848
|
// <case value="${value}">children</case>
|
|
855
849
|
const valueAttr = element.getAttribute('value');
|
|
@@ -857,9 +851,9 @@ class Template {
|
|
|
857
851
|
// Remove the value attribute
|
|
858
852
|
element.removeAttribute('value');
|
|
859
853
|
this.parts.push({
|
|
860
|
-
type: 'case',
|
|
854
|
+
type: 'conditional-case',
|
|
861
855
|
index: partIndex++,
|
|
862
|
-
|
|
856
|
+
element // Keep the <case> element
|
|
863
857
|
});
|
|
864
858
|
// Continue processing children normally
|
|
865
859
|
}
|
|
@@ -981,13 +975,18 @@ class Template {
|
|
|
981
975
|
* Prepare a template for rendering
|
|
982
976
|
*/
|
|
983
977
|
function prepareTemplate(result) {
|
|
984
|
-
//
|
|
978
|
+
// Check cache first
|
|
985
979
|
const { strings } = result;
|
|
986
|
-
|
|
980
|
+
const cached = templateCache.get(strings);
|
|
981
|
+
if (cached) {
|
|
982
|
+
return cached;
|
|
983
|
+
}
|
|
984
|
+
// Build HTML with markers and extract original attribute names
|
|
985
|
+
const htmlParts = [];
|
|
987
986
|
const attrNamesForParts = [];
|
|
988
987
|
for (let i = 0; i < strings.length; i++) {
|
|
989
988
|
const str = strings[i];
|
|
990
|
-
|
|
989
|
+
htmlParts.push(str);
|
|
991
990
|
if (i < strings.length - 1) {
|
|
992
991
|
// Check if we're in an attribute context
|
|
993
992
|
// Look backwards for = sign
|
|
@@ -1001,7 +1000,7 @@ function prepareTemplate(result) {
|
|
|
1001
1000
|
}
|
|
1002
1001
|
const attrName = str.substring(attrStart + 1, lastEquals).trim();
|
|
1003
1002
|
attrNamesForParts.push(attrName);
|
|
1004
|
-
|
|
1003
|
+
htmlParts.push(marker);
|
|
1005
1004
|
}
|
|
1006
1005
|
else {
|
|
1007
1006
|
// Check if this is a meta element (<if> or <case>) by looking backwards
|
|
@@ -1010,19 +1009,23 @@ function prepareTemplate(result) {
|
|
|
1010
1009
|
if (metaElementMatch) {
|
|
1011
1010
|
// This is a meta element - add value attribute
|
|
1012
1011
|
attrNamesForParts.push('value');
|
|
1013
|
-
|
|
1012
|
+
htmlParts.push(`value="${marker}"`);
|
|
1014
1013
|
}
|
|
1015
1014
|
else {
|
|
1016
1015
|
// We're in node content
|
|
1017
1016
|
attrNamesForParts.push(''); // Empty string for node parts
|
|
1018
|
-
|
|
1017
|
+
htmlParts.push(nodeMarker);
|
|
1019
1018
|
}
|
|
1020
1019
|
}
|
|
1021
1020
|
}
|
|
1022
1021
|
}
|
|
1022
|
+
const html = htmlParts.join('');
|
|
1023
1023
|
const template = document.createElement('template');
|
|
1024
1024
|
template.innerHTML = html;
|
|
1025
|
-
|
|
1025
|
+
const tmpl = new Template(result, template, attrNamesForParts);
|
|
1026
|
+
// Cache the template for reuse
|
|
1027
|
+
templateCache.set(strings, tmpl);
|
|
1028
|
+
return tmpl;
|
|
1026
1029
|
}
|
|
1027
1030
|
/**
|
|
1028
1031
|
* Instance of a rendered template
|
|
@@ -1031,6 +1034,8 @@ class TemplateInstance {
|
|
|
1031
1034
|
constructor(result) {
|
|
1032
1035
|
this.parts = [];
|
|
1033
1036
|
this.fragment = null;
|
|
1037
|
+
this.conditionalParts = []; // if/case parts with their indices
|
|
1038
|
+
this.regularParts = []; // all other parts with their indices
|
|
1034
1039
|
this.template = prepareTemplate(result);
|
|
1035
1040
|
}
|
|
1036
1041
|
renderFragment() {
|
|
@@ -1048,7 +1053,8 @@ class TemplateInstance {
|
|
|
1048
1053
|
templateNode = walker.nextNode();
|
|
1049
1054
|
clonedNode = clonedWalker.nextNode();
|
|
1050
1055
|
}
|
|
1051
|
-
for (
|
|
1056
|
+
for (let i = 0; i < this.template.parts.length; i++) {
|
|
1057
|
+
const partDef = this.template.parts[i];
|
|
1052
1058
|
let part;
|
|
1053
1059
|
switch (partDef.type) {
|
|
1054
1060
|
case 'node':
|
|
@@ -1072,18 +1078,25 @@ class TemplateInstance {
|
|
|
1072
1078
|
const eventElement = nodeMap.get(partDef.element);
|
|
1073
1079
|
part = new EventPart(eventElement, partDef.name);
|
|
1074
1080
|
break;
|
|
1075
|
-
case 'if':
|
|
1076
|
-
const
|
|
1077
|
-
part = new
|
|
1081
|
+
case 'conditional-if':
|
|
1082
|
+
const conditionalIfElement = nodeMap.get(partDef.element);
|
|
1083
|
+
part = new ConditionalIfPart(conditionalIfElement);
|
|
1078
1084
|
break;
|
|
1079
|
-
case 'case':
|
|
1080
|
-
const
|
|
1081
|
-
part = new
|
|
1085
|
+
case 'conditional-case':
|
|
1086
|
+
const conditionalCaseElement = nodeMap.get(partDef.element);
|
|
1087
|
+
part = new ConditionalCasePart(conditionalCaseElement);
|
|
1082
1088
|
break;
|
|
1083
1089
|
default:
|
|
1084
1090
|
throw new Error(`Unknown part type: ${partDef.type}`);
|
|
1085
1091
|
}
|
|
1086
1092
|
this.parts.push(part);
|
|
1093
|
+
// Separate conditional parts from regular parts for optimized update
|
|
1094
|
+
if (part instanceof ConditionalIfPart || part instanceof ConditionalCasePart) {
|
|
1095
|
+
this.conditionalParts.push({ part, index: i });
|
|
1096
|
+
}
|
|
1097
|
+
else {
|
|
1098
|
+
this.regularParts.push({ part, index: i });
|
|
1099
|
+
}
|
|
1087
1100
|
}
|
|
1088
1101
|
}
|
|
1089
1102
|
return this.fragment;
|
|
@@ -1095,19 +1108,15 @@ class TemplateInstance {
|
|
|
1095
1108
|
return fragment;
|
|
1096
1109
|
}
|
|
1097
1110
|
update(values) {
|
|
1098
|
-
// Process
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
}
|
|
1111
|
+
// Optimized: Process conditional parts first (if any), then regular parts
|
|
1112
|
+
// Using pre-separated arrays with cached indices avoids instanceof and indexOf calls
|
|
1113
|
+
// Process conditional parts first (they control visibility)
|
|
1114
|
+
for (const { part, index } of this.conditionalParts) {
|
|
1115
|
+
part.commit(values[index]);
|
|
1104
1116
|
}
|
|
1105
|
-
// Then process
|
|
1106
|
-
for (
|
|
1107
|
-
|
|
1108
|
-
if (!(part instanceof IfPart || part instanceof CasePart)) {
|
|
1109
|
-
part.commit(values[i]);
|
|
1110
|
-
}
|
|
1117
|
+
// Then process regular parts
|
|
1118
|
+
for (const { part, index } of this.regularParts) {
|
|
1119
|
+
part.commit(values[index]);
|
|
1111
1120
|
}
|
|
1112
1121
|
}
|
|
1113
1122
|
clear() {
|
|
@@ -1167,6 +1176,7 @@ class NodePart extends Part {
|
|
|
1167
1176
|
}
|
|
1168
1177
|
commitArray(values) {
|
|
1169
1178
|
this.clear();
|
|
1179
|
+
// Template caching (via prepareTemplate) still provides significant performance benefit
|
|
1170
1180
|
for (const value of values) {
|
|
1171
1181
|
if (isTemplateResult(value)) {
|
|
1172
1182
|
const instance = new TemplateInstance(value);
|
|
@@ -1223,8 +1233,18 @@ class AttributePart extends Part {
|
|
|
1223
1233
|
this.element.removeAttribute(this.name);
|
|
1224
1234
|
}
|
|
1225
1235
|
else {
|
|
1226
|
-
//
|
|
1227
|
-
|
|
1236
|
+
// Inline attribute value computation for performance
|
|
1237
|
+
let finalValue;
|
|
1238
|
+
if (!this.attrStrings || this.attrStrings.length === 0) {
|
|
1239
|
+
finalValue = String(value);
|
|
1240
|
+
}
|
|
1241
|
+
else if (this.attrStrings.length === 1) {
|
|
1242
|
+
finalValue = this.attrStrings[0];
|
|
1243
|
+
}
|
|
1244
|
+
else {
|
|
1245
|
+
// Multiple segments: "prefix" + value + "suffix"
|
|
1246
|
+
finalValue = this.attrStrings[0] + String(value) + this.attrStrings[1];
|
|
1247
|
+
}
|
|
1228
1248
|
this.element.setAttribute(this.name, finalValue);
|
|
1229
1249
|
}
|
|
1230
1250
|
}
|
|
@@ -1232,22 +1252,6 @@ class AttributePart extends Part {
|
|
|
1232
1252
|
this.element.removeAttribute(this.name);
|
|
1233
1253
|
}
|
|
1234
1254
|
}
|
|
1235
|
-
/**
|
|
1236
|
-
* Data-oriented function to compute attribute value from static strings and dynamic value
|
|
1237
|
-
*/
|
|
1238
|
-
function computeAttributeValue(attrStrings, value) {
|
|
1239
|
-
if (!attrStrings || attrStrings.length === 0) {
|
|
1240
|
-
// No template strings, just use the value
|
|
1241
|
-
return String(value);
|
|
1242
|
-
}
|
|
1243
|
-
if (attrStrings.length === 1) {
|
|
1244
|
-
// Single string segment, no interpolation (shouldn't happen but handle it)
|
|
1245
|
-
return attrStrings[0];
|
|
1246
|
-
}
|
|
1247
|
-
// Multiple segments: "prefix" + value + "suffix"
|
|
1248
|
-
// For aria-label="Remove ${label}", attrStrings = ["Remove ", ""]
|
|
1249
|
-
return attrStrings[0] + String(value) + attrStrings[1];
|
|
1250
|
-
}
|
|
1251
1255
|
/**
|
|
1252
1256
|
* PropertyPart handles property bindings
|
|
1253
1257
|
*/
|
|
@@ -1302,6 +1306,7 @@ class EventPart extends Part {
|
|
|
1302
1306
|
this.listener = null;
|
|
1303
1307
|
this.value = undefined;
|
|
1304
1308
|
this.keyFilter = null;
|
|
1309
|
+
this.host = null; // Cache host element
|
|
1305
1310
|
this.element = element;
|
|
1306
1311
|
// Parse keyboard shortcuts:
|
|
1307
1312
|
// Supports both dot notation (@keydown.enter) and colon notation (@keydown:Enter) to match @on decorator
|
|
@@ -1337,14 +1342,15 @@ class EventPart extends Part {
|
|
|
1337
1342
|
}
|
|
1338
1343
|
if (typeof value === 'function') {
|
|
1339
1344
|
// Auto-bind to host element (the custom element with shadow root)
|
|
1340
|
-
//
|
|
1341
|
-
|
|
1342
|
-
|
|
1345
|
+
// Cache host lookup for performance
|
|
1346
|
+
if (!this.host) {
|
|
1347
|
+
const rootNode = this.element.getRootNode();
|
|
1348
|
+
this.host = rootNode.host || null;
|
|
1349
|
+
}
|
|
1343
1350
|
// Create a wrapper that calls the handler with the host as context
|
|
1344
|
-
|
|
1345
|
-
|
|
1351
|
+
if (this.host) {
|
|
1352
|
+
const host = this.host; // Capture for closure
|
|
1346
1353
|
this.listener = ((event) => {
|
|
1347
|
-
// If keyboard filter is specified, check if event matches
|
|
1348
1354
|
if (this.keyFilter && !matchesKeyboardFilter(event, this.keyFilter)) {
|
|
1349
1355
|
return;
|
|
1350
1356
|
}
|
|
@@ -1462,146 +1468,107 @@ function matchesKeyboardFilter(event, filter) {
|
|
|
1462
1468
|
return ctrlMatch && altMatch && shiftMatch && metaMatch;
|
|
1463
1469
|
}
|
|
1464
1470
|
/**
|
|
1465
|
-
*
|
|
1466
|
-
*
|
|
1467
|
-
* instead of just hiding them with CSS
|
|
1471
|
+
* ConditionalIfPart handles <if> conditional rendering
|
|
1472
|
+
* Removes/inserts DOM nodes based on condition
|
|
1468
1473
|
*/
|
|
1469
|
-
class
|
|
1474
|
+
class ConditionalIfPart extends Part {
|
|
1470
1475
|
constructor(ifElement) {
|
|
1471
1476
|
super();
|
|
1472
1477
|
this.value = undefined;
|
|
1473
1478
|
this.fragment = null;
|
|
1474
|
-
this.childNodes = [];
|
|
1475
1479
|
this.ifElement = ifElement;
|
|
1476
|
-
// Set display to contents so the wrapper is transparent
|
|
1477
|
-
// display:contents makes the element invisible but renders its children
|
|
1478
1480
|
this.ifElement.style.display = 'contents';
|
|
1479
|
-
// Store initial child nodes
|
|
1480
|
-
this.childNodes = Array.from(this.ifElement.childNodes);
|
|
1481
1481
|
}
|
|
1482
1482
|
commit(value) {
|
|
1483
1483
|
const condition = Boolean(value);
|
|
1484
|
-
|
|
1485
|
-
if (this.value !== undefined && Boolean(this.value) === condition) {
|
|
1484
|
+
if (this.value === value)
|
|
1486
1485
|
return;
|
|
1487
|
-
}
|
|
1488
1486
|
this.value = value;
|
|
1489
1487
|
if (condition) {
|
|
1490
|
-
// Show: restore children from fragment
|
|
1488
|
+
// Show: restore children from fragment
|
|
1491
1489
|
if (this.fragment && this.fragment.hasChildNodes()) {
|
|
1492
1490
|
this.ifElement.appendChild(this.fragment);
|
|
1493
|
-
this.fragment = null;
|
|
1494
1491
|
}
|
|
1495
1492
|
}
|
|
1496
1493
|
else {
|
|
1497
|
-
// Hide: move children to
|
|
1498
|
-
this.fragment
|
|
1494
|
+
// Hide: move children to fragment
|
|
1495
|
+
if (!this.fragment) {
|
|
1496
|
+
this.fragment = document.createDocumentFragment();
|
|
1497
|
+
}
|
|
1499
1498
|
while (this.ifElement.firstChild) {
|
|
1500
1499
|
this.fragment.appendChild(this.ifElement.firstChild);
|
|
1501
1500
|
}
|
|
1502
1501
|
}
|
|
1503
1502
|
}
|
|
1504
1503
|
clear() {
|
|
1505
|
-
|
|
1506
|
-
|
|
1504
|
+
if (!this.fragment) {
|
|
1505
|
+
this.fragment = document.createDocumentFragment();
|
|
1506
|
+
}
|
|
1507
1507
|
while (this.ifElement.firstChild) {
|
|
1508
1508
|
this.fragment.appendChild(this.ifElement.firstChild);
|
|
1509
1509
|
}
|
|
1510
1510
|
}
|
|
1511
1511
|
}
|
|
1512
1512
|
/**
|
|
1513
|
-
*
|
|
1514
|
-
*
|
|
1513
|
+
* ConditionalCasePart handles <case>/<when>/<default> conditional rendering
|
|
1514
|
+
* Removes/inserts matching branch based on value
|
|
1515
1515
|
*/
|
|
1516
|
-
class
|
|
1516
|
+
class ConditionalCasePart extends Part {
|
|
1517
1517
|
constructor(caseElement) {
|
|
1518
1518
|
super();
|
|
1519
1519
|
this.value = undefined;
|
|
1520
|
-
this.
|
|
1521
|
-
this.
|
|
1520
|
+
this.childrenMap = new Map();
|
|
1521
|
+
this.fragments = new Map();
|
|
1522
|
+
this.defaultChild = null;
|
|
1523
|
+
this.currentChild = null;
|
|
1522
1524
|
this.caseElement = caseElement;
|
|
1523
|
-
//
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1525
|
+
// Build map and store children in fragments initially
|
|
1526
|
+
for (const child of Array.from(this.caseElement.children)) {
|
|
1527
|
+
const childTag = child.tagName.toLowerCase();
|
|
1528
|
+
if (childTag === 'when') {
|
|
1529
|
+
const whenValue = child.getAttribute('value') || '';
|
|
1530
|
+
this.childrenMap.set(whenValue, child);
|
|
1531
|
+
const fragment = document.createDocumentFragment();
|
|
1532
|
+
fragment.appendChild(child);
|
|
1533
|
+
this.fragments.set(child, fragment);
|
|
1534
|
+
}
|
|
1535
|
+
else if (childTag === 'default') {
|
|
1536
|
+
this.defaultChild = child;
|
|
1537
|
+
const fragment = document.createDocumentFragment();
|
|
1538
|
+
fragment.appendChild(child);
|
|
1539
|
+
this.fragments.set(child, fragment);
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1531
1542
|
}
|
|
1532
1543
|
commit(value) {
|
|
1533
|
-
// If value hasn't changed, do nothing
|
|
1534
1544
|
if (this.value === value)
|
|
1535
1545
|
return;
|
|
1536
1546
|
this.value = value;
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
if (
|
|
1542
|
-
|
|
1543
|
-
if (whenValue === String(value)) {
|
|
1544
|
-
hasMatch = true;
|
|
1545
|
-
break;
|
|
1546
|
-
}
|
|
1547
|
+
const valueStr = String(value);
|
|
1548
|
+
// Remove current child
|
|
1549
|
+
if (this.currentChild) {
|
|
1550
|
+
const fragment = this.fragments.get(this.currentChild);
|
|
1551
|
+
if (fragment && !fragment.hasChildNodes()) {
|
|
1552
|
+
fragment.appendChild(this.currentChild);
|
|
1547
1553
|
}
|
|
1548
1554
|
}
|
|
1549
|
-
//
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
const
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
const whenValue = child.getAttribute('value');
|
|
1556
|
-
shouldBeAttached = (whenValue === String(value));
|
|
1557
|
-
}
|
|
1558
|
-
else if (tagName === 'default') {
|
|
1559
|
-
shouldBeAttached = !hasMatch;
|
|
1560
|
-
}
|
|
1561
|
-
// Update DOM if state changed
|
|
1562
|
-
if (shouldBeAttached && !isAttached) {
|
|
1563
|
-
// Re-insert from fragment in correct position
|
|
1564
|
-
// Find next sibling that is still attached
|
|
1565
|
-
const childIndex = this.childrenList.indexOf(child);
|
|
1566
|
-
let insertBefore = null;
|
|
1567
|
-
for (let i = childIndex + 1; i < this.childrenList.length; i++) {
|
|
1568
|
-
if (this.attachedChildren.get(this.childrenList[i])) {
|
|
1569
|
-
insertBefore = this.childrenList[i];
|
|
1570
|
-
break;
|
|
1571
|
-
}
|
|
1572
|
-
}
|
|
1573
|
-
// Get child from fragment
|
|
1574
|
-
const fragment = this.fragments.get(child);
|
|
1575
|
-
if (fragment && fragment.firstChild) {
|
|
1576
|
-
if (insertBefore) {
|
|
1577
|
-
this.caseElement.insertBefore(fragment.firstChild, insertBefore);
|
|
1578
|
-
}
|
|
1579
|
-
else {
|
|
1580
|
-
this.caseElement.appendChild(fragment.firstChild);
|
|
1581
|
-
}
|
|
1582
|
-
}
|
|
1583
|
-
this.attachedChildren.set(child, true);
|
|
1584
|
-
}
|
|
1585
|
-
else if (!shouldBeAttached && isAttached) {
|
|
1586
|
-
// Move to fragment
|
|
1587
|
-
const fragment = this.fragments.get(child);
|
|
1588
|
-
if (fragment) {
|
|
1589
|
-
fragment.appendChild(child);
|
|
1590
|
-
}
|
|
1591
|
-
this.attachedChildren.set(child, false);
|
|
1555
|
+
// Insert matching child
|
|
1556
|
+
const matchingChild = this.childrenMap.get(valueStr) || this.defaultChild;
|
|
1557
|
+
if (matchingChild) {
|
|
1558
|
+
const fragment = this.fragments.get(matchingChild);
|
|
1559
|
+
if (fragment && fragment.hasChildNodes()) {
|
|
1560
|
+
this.caseElement.appendChild(fragment);
|
|
1592
1561
|
}
|
|
1562
|
+
this.currentChild = matchingChild;
|
|
1593
1563
|
}
|
|
1594
1564
|
}
|
|
1595
1565
|
clear() {
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
if (
|
|
1599
|
-
|
|
1600
|
-
if (fragment) {
|
|
1601
|
-
fragment.appendChild(child);
|
|
1602
|
-
}
|
|
1603
|
-
this.attachedChildren.set(child, false);
|
|
1566
|
+
if (this.currentChild) {
|
|
1567
|
+
const fragment = this.fragments.get(this.currentChild);
|
|
1568
|
+
if (fragment && !fragment.hasChildNodes()) {
|
|
1569
|
+
fragment.appendChild(this.currentChild);
|
|
1604
1570
|
}
|
|
1571
|
+
this.currentChild = null;
|
|
1605
1572
|
}
|
|
1606
1573
|
}
|
|
1607
1574
|
}
|