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