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.cjs
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.
|
|
@@ -704,7 +704,6 @@ function cleanupResponseHandlers(instance) {
|
|
|
704
704
|
|
|
705
705
|
/**
|
|
706
706
|
* Template system for Snice v3.0.0
|
|
707
|
-
* Inspired by lit-html but custom implementation
|
|
708
707
|
* Provides html`` and css`` tagged template processors with differential rendering
|
|
709
708
|
*/
|
|
710
709
|
// Unique symbols for type checking
|
|
@@ -805,18 +804,14 @@ function isUnsafeHTML(value) {
|
|
|
805
804
|
return value && value._$litType$ === UNSAFE_HTML;
|
|
806
805
|
}
|
|
807
806
|
|
|
808
|
-
/**
|
|
809
|
-
* Simplified lit-html-style template system
|
|
810
|
-
* Based on lit-html's approach but simplified
|
|
811
|
-
*/
|
|
812
807
|
// Unique marker for dynamic parts
|
|
813
|
-
// Using processing instruction syntax like lit-html for better compatibility
|
|
814
808
|
// This parses as a comment node but doesn't get escaped in attributes
|
|
815
809
|
const marker = `snice$${Math.random().toFixed(9).slice(2)}$`;
|
|
816
810
|
const markerMatch = '?' + marker;
|
|
817
811
|
const nodeMarker = `<${markerMatch}>`;
|
|
818
812
|
const markerRegex = new RegExp(marker, 'g');
|
|
819
|
-
// Template cache
|
|
813
|
+
// Template cache - templates with same string array can be reused
|
|
814
|
+
const templateCache = new WeakMap();
|
|
820
815
|
/**
|
|
821
816
|
* A prepared template ready for rendering
|
|
822
817
|
*/
|
|
@@ -833,8 +828,8 @@ class Template {
|
|
|
833
828
|
const element = node;
|
|
834
829
|
const tagName = element.tagName.toLowerCase();
|
|
835
830
|
// Handle virtual elements: <if>, <case>
|
|
836
|
-
//
|
|
837
|
-
//
|
|
831
|
+
// Keep them in the DOM with display:contents for now
|
|
832
|
+
// Will optimize later with proper template extraction
|
|
838
833
|
if (tagName === 'if') {
|
|
839
834
|
// <if value="${condition}">children</if>
|
|
840
835
|
const valueAttr = element.getAttribute('value');
|
|
@@ -842,16 +837,15 @@ class Template {
|
|
|
842
837
|
// Remove the value attribute
|
|
843
838
|
element.removeAttribute('value');
|
|
844
839
|
this.parts.push({
|
|
845
|
-
type: 'if',
|
|
840
|
+
type: 'conditional-if',
|
|
846
841
|
index: partIndex++,
|
|
847
|
-
element // Keep the <if> element
|
|
842
|
+
element // Keep the <if> element
|
|
848
843
|
});
|
|
849
844
|
// Continue processing children normally
|
|
850
845
|
}
|
|
851
846
|
continue;
|
|
852
847
|
}
|
|
853
848
|
// Handle <case> element
|
|
854
|
-
// Like <if>, <case> stays in DOM styled with display:contents
|
|
855
849
|
if (tagName === 'case') {
|
|
856
850
|
// <case value="${value}">children</case>
|
|
857
851
|
const valueAttr = element.getAttribute('value');
|
|
@@ -859,9 +853,9 @@ class Template {
|
|
|
859
853
|
// Remove the value attribute
|
|
860
854
|
element.removeAttribute('value');
|
|
861
855
|
this.parts.push({
|
|
862
|
-
type: 'case',
|
|
856
|
+
type: 'conditional-case',
|
|
863
857
|
index: partIndex++,
|
|
864
|
-
|
|
858
|
+
element // Keep the <case> element
|
|
865
859
|
});
|
|
866
860
|
// Continue processing children normally
|
|
867
861
|
}
|
|
@@ -983,13 +977,18 @@ class Template {
|
|
|
983
977
|
* Prepare a template for rendering
|
|
984
978
|
*/
|
|
985
979
|
function prepareTemplate(result) {
|
|
986
|
-
//
|
|
980
|
+
// Check cache first
|
|
987
981
|
const { strings } = result;
|
|
988
|
-
|
|
982
|
+
const cached = templateCache.get(strings);
|
|
983
|
+
if (cached) {
|
|
984
|
+
return cached;
|
|
985
|
+
}
|
|
986
|
+
// Build HTML with markers and extract original attribute names
|
|
987
|
+
const htmlParts = [];
|
|
989
988
|
const attrNamesForParts = [];
|
|
990
989
|
for (let i = 0; i < strings.length; i++) {
|
|
991
990
|
const str = strings[i];
|
|
992
|
-
|
|
991
|
+
htmlParts.push(str);
|
|
993
992
|
if (i < strings.length - 1) {
|
|
994
993
|
// Check if we're in an attribute context
|
|
995
994
|
// Look backwards for = sign
|
|
@@ -1003,7 +1002,7 @@ function prepareTemplate(result) {
|
|
|
1003
1002
|
}
|
|
1004
1003
|
const attrName = str.substring(attrStart + 1, lastEquals).trim();
|
|
1005
1004
|
attrNamesForParts.push(attrName);
|
|
1006
|
-
|
|
1005
|
+
htmlParts.push(marker);
|
|
1007
1006
|
}
|
|
1008
1007
|
else {
|
|
1009
1008
|
// Check if this is a meta element (<if> or <case>) by looking backwards
|
|
@@ -1012,19 +1011,23 @@ function prepareTemplate(result) {
|
|
|
1012
1011
|
if (metaElementMatch) {
|
|
1013
1012
|
// This is a meta element - add value attribute
|
|
1014
1013
|
attrNamesForParts.push('value');
|
|
1015
|
-
|
|
1014
|
+
htmlParts.push(`value="${marker}"`);
|
|
1016
1015
|
}
|
|
1017
1016
|
else {
|
|
1018
1017
|
// We're in node content
|
|
1019
1018
|
attrNamesForParts.push(''); // Empty string for node parts
|
|
1020
|
-
|
|
1019
|
+
htmlParts.push(nodeMarker);
|
|
1021
1020
|
}
|
|
1022
1021
|
}
|
|
1023
1022
|
}
|
|
1024
1023
|
}
|
|
1024
|
+
const html = htmlParts.join('');
|
|
1025
1025
|
const template = document.createElement('template');
|
|
1026
1026
|
template.innerHTML = html;
|
|
1027
|
-
|
|
1027
|
+
const tmpl = new Template(result, template, attrNamesForParts);
|
|
1028
|
+
// Cache the template for reuse
|
|
1029
|
+
templateCache.set(strings, tmpl);
|
|
1030
|
+
return tmpl;
|
|
1028
1031
|
}
|
|
1029
1032
|
/**
|
|
1030
1033
|
* Instance of a rendered template
|
|
@@ -1033,6 +1036,8 @@ class TemplateInstance {
|
|
|
1033
1036
|
constructor(result) {
|
|
1034
1037
|
this.parts = [];
|
|
1035
1038
|
this.fragment = null;
|
|
1039
|
+
this.conditionalParts = []; // if/case parts with their indices
|
|
1040
|
+
this.regularParts = []; // all other parts with their indices
|
|
1036
1041
|
this.template = prepareTemplate(result);
|
|
1037
1042
|
}
|
|
1038
1043
|
renderFragment() {
|
|
@@ -1050,7 +1055,8 @@ class TemplateInstance {
|
|
|
1050
1055
|
templateNode = walker.nextNode();
|
|
1051
1056
|
clonedNode = clonedWalker.nextNode();
|
|
1052
1057
|
}
|
|
1053
|
-
for (
|
|
1058
|
+
for (let i = 0; i < this.template.parts.length; i++) {
|
|
1059
|
+
const partDef = this.template.parts[i];
|
|
1054
1060
|
let part;
|
|
1055
1061
|
switch (partDef.type) {
|
|
1056
1062
|
case 'node':
|
|
@@ -1074,18 +1080,25 @@ class TemplateInstance {
|
|
|
1074
1080
|
const eventElement = nodeMap.get(partDef.element);
|
|
1075
1081
|
part = new EventPart(eventElement, partDef.name);
|
|
1076
1082
|
break;
|
|
1077
|
-
case 'if':
|
|
1078
|
-
const
|
|
1079
|
-
part = new
|
|
1083
|
+
case 'conditional-if':
|
|
1084
|
+
const conditionalIfElement = nodeMap.get(partDef.element);
|
|
1085
|
+
part = new ConditionalIfPart(conditionalIfElement);
|
|
1080
1086
|
break;
|
|
1081
|
-
case 'case':
|
|
1082
|
-
const
|
|
1083
|
-
part = new
|
|
1087
|
+
case 'conditional-case':
|
|
1088
|
+
const conditionalCaseElement = nodeMap.get(partDef.element);
|
|
1089
|
+
part = new ConditionalCasePart(conditionalCaseElement);
|
|
1084
1090
|
break;
|
|
1085
1091
|
default:
|
|
1086
1092
|
throw new Error(`Unknown part type: ${partDef.type}`);
|
|
1087
1093
|
}
|
|
1088
1094
|
this.parts.push(part);
|
|
1095
|
+
// Separate conditional parts from regular parts for optimized update
|
|
1096
|
+
if (part instanceof ConditionalIfPart || part instanceof ConditionalCasePart) {
|
|
1097
|
+
this.conditionalParts.push({ part, index: i });
|
|
1098
|
+
}
|
|
1099
|
+
else {
|
|
1100
|
+
this.regularParts.push({ part, index: i });
|
|
1101
|
+
}
|
|
1089
1102
|
}
|
|
1090
1103
|
}
|
|
1091
1104
|
return this.fragment;
|
|
@@ -1097,19 +1110,15 @@ class TemplateInstance {
|
|
|
1097
1110
|
return fragment;
|
|
1098
1111
|
}
|
|
1099
1112
|
update(values) {
|
|
1100
|
-
// Process
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
}
|
|
1113
|
+
// Optimized: Process conditional parts first (if any), then regular parts
|
|
1114
|
+
// Using pre-separated arrays with cached indices avoids instanceof and indexOf calls
|
|
1115
|
+
// Process conditional parts first (they control visibility)
|
|
1116
|
+
for (const { part, index } of this.conditionalParts) {
|
|
1117
|
+
part.commit(values[index]);
|
|
1106
1118
|
}
|
|
1107
|
-
// Then process
|
|
1108
|
-
for (
|
|
1109
|
-
|
|
1110
|
-
if (!(part instanceof IfPart || part instanceof CasePart)) {
|
|
1111
|
-
part.commit(values[i]);
|
|
1112
|
-
}
|
|
1119
|
+
// Then process regular parts
|
|
1120
|
+
for (const { part, index } of this.regularParts) {
|
|
1121
|
+
part.commit(values[index]);
|
|
1113
1122
|
}
|
|
1114
1123
|
}
|
|
1115
1124
|
clear() {
|
|
@@ -1169,6 +1178,7 @@ class NodePart extends Part {
|
|
|
1169
1178
|
}
|
|
1170
1179
|
commitArray(values) {
|
|
1171
1180
|
this.clear();
|
|
1181
|
+
// Template caching (via prepareTemplate) still provides significant performance benefit
|
|
1172
1182
|
for (const value of values) {
|
|
1173
1183
|
if (isTemplateResult(value)) {
|
|
1174
1184
|
const instance = new TemplateInstance(value);
|
|
@@ -1225,8 +1235,18 @@ class AttributePart extends Part {
|
|
|
1225
1235
|
this.element.removeAttribute(this.name);
|
|
1226
1236
|
}
|
|
1227
1237
|
else {
|
|
1228
|
-
//
|
|
1229
|
-
|
|
1238
|
+
// Inline attribute value computation for performance
|
|
1239
|
+
let finalValue;
|
|
1240
|
+
if (!this.attrStrings || this.attrStrings.length === 0) {
|
|
1241
|
+
finalValue = String(value);
|
|
1242
|
+
}
|
|
1243
|
+
else if (this.attrStrings.length === 1) {
|
|
1244
|
+
finalValue = this.attrStrings[0];
|
|
1245
|
+
}
|
|
1246
|
+
else {
|
|
1247
|
+
// Multiple segments: "prefix" + value + "suffix"
|
|
1248
|
+
finalValue = this.attrStrings[0] + String(value) + this.attrStrings[1];
|
|
1249
|
+
}
|
|
1230
1250
|
this.element.setAttribute(this.name, finalValue);
|
|
1231
1251
|
}
|
|
1232
1252
|
}
|
|
@@ -1234,22 +1254,6 @@ class AttributePart extends Part {
|
|
|
1234
1254
|
this.element.removeAttribute(this.name);
|
|
1235
1255
|
}
|
|
1236
1256
|
}
|
|
1237
|
-
/**
|
|
1238
|
-
* Data-oriented function to compute attribute value from static strings and dynamic value
|
|
1239
|
-
*/
|
|
1240
|
-
function computeAttributeValue(attrStrings, value) {
|
|
1241
|
-
if (!attrStrings || attrStrings.length === 0) {
|
|
1242
|
-
// No template strings, just use the value
|
|
1243
|
-
return String(value);
|
|
1244
|
-
}
|
|
1245
|
-
if (attrStrings.length === 1) {
|
|
1246
|
-
// Single string segment, no interpolation (shouldn't happen but handle it)
|
|
1247
|
-
return attrStrings[0];
|
|
1248
|
-
}
|
|
1249
|
-
// Multiple segments: "prefix" + value + "suffix"
|
|
1250
|
-
// For aria-label="Remove ${label}", attrStrings = ["Remove ", ""]
|
|
1251
|
-
return attrStrings[0] + String(value) + attrStrings[1];
|
|
1252
|
-
}
|
|
1253
1257
|
/**
|
|
1254
1258
|
* PropertyPart handles property bindings
|
|
1255
1259
|
*/
|
|
@@ -1304,6 +1308,7 @@ class EventPart extends Part {
|
|
|
1304
1308
|
this.listener = null;
|
|
1305
1309
|
this.value = undefined;
|
|
1306
1310
|
this.keyFilter = null;
|
|
1311
|
+
this.host = null; // Cache host element
|
|
1307
1312
|
this.element = element;
|
|
1308
1313
|
// Parse keyboard shortcuts:
|
|
1309
1314
|
// Supports both dot notation (@keydown.enter) and colon notation (@keydown:Enter) to match @on decorator
|
|
@@ -1339,14 +1344,15 @@ class EventPart extends Part {
|
|
|
1339
1344
|
}
|
|
1340
1345
|
if (typeof value === 'function') {
|
|
1341
1346
|
// Auto-bind to host element (the custom element with shadow root)
|
|
1342
|
-
//
|
|
1343
|
-
|
|
1344
|
-
|
|
1347
|
+
// Cache host lookup for performance
|
|
1348
|
+
if (!this.host) {
|
|
1349
|
+
const rootNode = this.element.getRootNode();
|
|
1350
|
+
this.host = rootNode.host || null;
|
|
1351
|
+
}
|
|
1345
1352
|
// Create a wrapper that calls the handler with the host as context
|
|
1346
|
-
|
|
1347
|
-
|
|
1353
|
+
if (this.host) {
|
|
1354
|
+
const host = this.host; // Capture for closure
|
|
1348
1355
|
this.listener = ((event) => {
|
|
1349
|
-
// If keyboard filter is specified, check if event matches
|
|
1350
1356
|
if (this.keyFilter && !matchesKeyboardFilter(event, this.keyFilter)) {
|
|
1351
1357
|
return;
|
|
1352
1358
|
}
|
|
@@ -1464,146 +1470,107 @@ function matchesKeyboardFilter(event, filter) {
|
|
|
1464
1470
|
return ctrlMatch && altMatch && shiftMatch && metaMatch;
|
|
1465
1471
|
}
|
|
1466
1472
|
/**
|
|
1467
|
-
*
|
|
1468
|
-
*
|
|
1469
|
-
* instead of just hiding them with CSS
|
|
1473
|
+
* ConditionalIfPart handles <if> conditional rendering
|
|
1474
|
+
* Removes/inserts DOM nodes based on condition
|
|
1470
1475
|
*/
|
|
1471
|
-
class
|
|
1476
|
+
class ConditionalIfPart extends Part {
|
|
1472
1477
|
constructor(ifElement) {
|
|
1473
1478
|
super();
|
|
1474
1479
|
this.value = undefined;
|
|
1475
1480
|
this.fragment = null;
|
|
1476
|
-
this.childNodes = [];
|
|
1477
1481
|
this.ifElement = ifElement;
|
|
1478
|
-
// Set display to contents so the wrapper is transparent
|
|
1479
|
-
// display:contents makes the element invisible but renders its children
|
|
1480
1482
|
this.ifElement.style.display = 'contents';
|
|
1481
|
-
// Store initial child nodes
|
|
1482
|
-
this.childNodes = Array.from(this.ifElement.childNodes);
|
|
1483
1483
|
}
|
|
1484
1484
|
commit(value) {
|
|
1485
1485
|
const condition = Boolean(value);
|
|
1486
|
-
|
|
1487
|
-
if (this.value !== undefined && Boolean(this.value) === condition) {
|
|
1486
|
+
if (this.value === value)
|
|
1488
1487
|
return;
|
|
1489
|
-
}
|
|
1490
1488
|
this.value = value;
|
|
1491
1489
|
if (condition) {
|
|
1492
|
-
// Show: restore children from fragment
|
|
1490
|
+
// Show: restore children from fragment
|
|
1493
1491
|
if (this.fragment && this.fragment.hasChildNodes()) {
|
|
1494
1492
|
this.ifElement.appendChild(this.fragment);
|
|
1495
|
-
this.fragment = null;
|
|
1496
1493
|
}
|
|
1497
1494
|
}
|
|
1498
1495
|
else {
|
|
1499
|
-
// Hide: move children to
|
|
1500
|
-
this.fragment
|
|
1496
|
+
// Hide: move children to fragment
|
|
1497
|
+
if (!this.fragment) {
|
|
1498
|
+
this.fragment = document.createDocumentFragment();
|
|
1499
|
+
}
|
|
1501
1500
|
while (this.ifElement.firstChild) {
|
|
1502
1501
|
this.fragment.appendChild(this.ifElement.firstChild);
|
|
1503
1502
|
}
|
|
1504
1503
|
}
|
|
1505
1504
|
}
|
|
1506
1505
|
clear() {
|
|
1507
|
-
|
|
1508
|
-
|
|
1506
|
+
if (!this.fragment) {
|
|
1507
|
+
this.fragment = document.createDocumentFragment();
|
|
1508
|
+
}
|
|
1509
1509
|
while (this.ifElement.firstChild) {
|
|
1510
1510
|
this.fragment.appendChild(this.ifElement.firstChild);
|
|
1511
1511
|
}
|
|
1512
1512
|
}
|
|
1513
1513
|
}
|
|
1514
1514
|
/**
|
|
1515
|
-
*
|
|
1516
|
-
*
|
|
1515
|
+
* ConditionalCasePart handles <case>/<when>/<default> conditional rendering
|
|
1516
|
+
* Removes/inserts matching branch based on value
|
|
1517
1517
|
*/
|
|
1518
|
-
class
|
|
1518
|
+
class ConditionalCasePart extends Part {
|
|
1519
1519
|
constructor(caseElement) {
|
|
1520
1520
|
super();
|
|
1521
1521
|
this.value = undefined;
|
|
1522
|
-
this.
|
|
1523
|
-
this.
|
|
1522
|
+
this.childrenMap = new Map();
|
|
1523
|
+
this.fragments = new Map();
|
|
1524
|
+
this.defaultChild = null;
|
|
1525
|
+
this.currentChild = null;
|
|
1524
1526
|
this.caseElement = caseElement;
|
|
1525
|
-
//
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1527
|
+
// Build map and store children in fragments initially
|
|
1528
|
+
for (const child of Array.from(this.caseElement.children)) {
|
|
1529
|
+
const childTag = child.tagName.toLowerCase();
|
|
1530
|
+
if (childTag === 'when') {
|
|
1531
|
+
const whenValue = child.getAttribute('value') || '';
|
|
1532
|
+
this.childrenMap.set(whenValue, child);
|
|
1533
|
+
const fragment = document.createDocumentFragment();
|
|
1534
|
+
fragment.appendChild(child);
|
|
1535
|
+
this.fragments.set(child, fragment);
|
|
1536
|
+
}
|
|
1537
|
+
else if (childTag === 'default') {
|
|
1538
|
+
this.defaultChild = child;
|
|
1539
|
+
const fragment = document.createDocumentFragment();
|
|
1540
|
+
fragment.appendChild(child);
|
|
1541
|
+
this.fragments.set(child, fragment);
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1533
1544
|
}
|
|
1534
1545
|
commit(value) {
|
|
1535
|
-
// If value hasn't changed, do nothing
|
|
1536
1546
|
if (this.value === value)
|
|
1537
1547
|
return;
|
|
1538
1548
|
this.value = value;
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
if (
|
|
1544
|
-
|
|
1545
|
-
if (whenValue === String(value)) {
|
|
1546
|
-
hasMatch = true;
|
|
1547
|
-
break;
|
|
1548
|
-
}
|
|
1549
|
+
const valueStr = String(value);
|
|
1550
|
+
// Remove current child
|
|
1551
|
+
if (this.currentChild) {
|
|
1552
|
+
const fragment = this.fragments.get(this.currentChild);
|
|
1553
|
+
if (fragment && !fragment.hasChildNodes()) {
|
|
1554
|
+
fragment.appendChild(this.currentChild);
|
|
1549
1555
|
}
|
|
1550
1556
|
}
|
|
1551
|
-
//
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
const
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
const whenValue = child.getAttribute('value');
|
|
1558
|
-
shouldBeAttached = (whenValue === String(value));
|
|
1559
|
-
}
|
|
1560
|
-
else if (tagName === 'default') {
|
|
1561
|
-
shouldBeAttached = !hasMatch;
|
|
1562
|
-
}
|
|
1563
|
-
// Update DOM if state changed
|
|
1564
|
-
if (shouldBeAttached && !isAttached) {
|
|
1565
|
-
// Re-insert from fragment in correct position
|
|
1566
|
-
// Find next sibling that is still attached
|
|
1567
|
-
const childIndex = this.childrenList.indexOf(child);
|
|
1568
|
-
let insertBefore = null;
|
|
1569
|
-
for (let i = childIndex + 1; i < this.childrenList.length; i++) {
|
|
1570
|
-
if (this.attachedChildren.get(this.childrenList[i])) {
|
|
1571
|
-
insertBefore = this.childrenList[i];
|
|
1572
|
-
break;
|
|
1573
|
-
}
|
|
1574
|
-
}
|
|
1575
|
-
// Get child from fragment
|
|
1576
|
-
const fragment = this.fragments.get(child);
|
|
1577
|
-
if (fragment && fragment.firstChild) {
|
|
1578
|
-
if (insertBefore) {
|
|
1579
|
-
this.caseElement.insertBefore(fragment.firstChild, insertBefore);
|
|
1580
|
-
}
|
|
1581
|
-
else {
|
|
1582
|
-
this.caseElement.appendChild(fragment.firstChild);
|
|
1583
|
-
}
|
|
1584
|
-
}
|
|
1585
|
-
this.attachedChildren.set(child, true);
|
|
1586
|
-
}
|
|
1587
|
-
else if (!shouldBeAttached && isAttached) {
|
|
1588
|
-
// Move to fragment
|
|
1589
|
-
const fragment = this.fragments.get(child);
|
|
1590
|
-
if (fragment) {
|
|
1591
|
-
fragment.appendChild(child);
|
|
1592
|
-
}
|
|
1593
|
-
this.attachedChildren.set(child, false);
|
|
1557
|
+
// Insert matching child
|
|
1558
|
+
const matchingChild = this.childrenMap.get(valueStr) || this.defaultChild;
|
|
1559
|
+
if (matchingChild) {
|
|
1560
|
+
const fragment = this.fragments.get(matchingChild);
|
|
1561
|
+
if (fragment && fragment.hasChildNodes()) {
|
|
1562
|
+
this.caseElement.appendChild(fragment);
|
|
1594
1563
|
}
|
|
1564
|
+
this.currentChild = matchingChild;
|
|
1595
1565
|
}
|
|
1596
1566
|
}
|
|
1597
1567
|
clear() {
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
if (
|
|
1601
|
-
|
|
1602
|
-
if (fragment) {
|
|
1603
|
-
fragment.appendChild(child);
|
|
1604
|
-
}
|
|
1605
|
-
this.attachedChildren.set(child, false);
|
|
1568
|
+
if (this.currentChild) {
|
|
1569
|
+
const fragment = this.fragments.get(this.currentChild);
|
|
1570
|
+
if (fragment && !fragment.hasChildNodes()) {
|
|
1571
|
+
fragment.appendChild(this.currentChild);
|
|
1606
1572
|
}
|
|
1573
|
+
this.currentChild = null;
|
|
1607
1574
|
}
|
|
1608
1575
|
}
|
|
1609
1576
|
}
|