snice 4.27.0 → 4.28.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/dist/cdn/accordion/snice-accordion.js +1 -1
- package/dist/cdn/accordion/snice-accordion.min.js +1 -1
- package/dist/cdn/activity-feed/snice-activity-feed.js +1 -1
- package/dist/cdn/activity-feed/snice-activity-feed.min.js +1 -1
- package/dist/cdn/alert/snice-alert.js +1 -1
- package/dist/cdn/alert/snice-alert.min.js +1 -1
- package/dist/cdn/app-tiles/snice-app-tiles.js +1 -1
- package/dist/cdn/app-tiles/snice-app-tiles.min.js +1 -1
- package/dist/cdn/approval-flow/snice-approval-flow.js +1 -1
- package/dist/cdn/approval-flow/snice-approval-flow.min.js +1 -1
- package/dist/cdn/audio-recorder/snice-audio-recorder.js +1 -1
- package/dist/cdn/audio-recorder/snice-audio-recorder.min.js +1 -1
- package/dist/cdn/availability/snice-availability.js +1 -1
- package/dist/cdn/availability/snice-availability.min.js +1 -1
- package/dist/cdn/avatar/snice-avatar.js +1 -1
- package/dist/cdn/avatar/snice-avatar.min.js +1 -1
- package/dist/cdn/avatar-group/snice-avatar-group.js +1 -1
- package/dist/cdn/avatar-group/snice-avatar-group.min.js +1 -1
- package/dist/cdn/badge/snice-badge.js +2 -2
- package/dist/cdn/badge/snice-badge.js.map +1 -1
- package/dist/cdn/badge/snice-badge.min.js +2 -2
- package/dist/cdn/badge/snice-badge.min.js.map +1 -1
- package/dist/cdn/banner/snice-banner.js +1 -1
- package/dist/cdn/banner/snice-banner.min.js +1 -1
- package/dist/cdn/book/snice-book.js +1 -1
- package/dist/cdn/book/snice-book.min.js +1 -1
- package/dist/cdn/booking/snice-booking.js +1 -1
- package/dist/cdn/booking/snice-booking.min.js +1 -1
- package/dist/cdn/breadcrumbs/snice-breadcrumbs.js +1 -1
- package/dist/cdn/breadcrumbs/snice-breadcrumbs.min.js +1 -1
- package/dist/cdn/button/snice-button.js +11 -10
- package/dist/cdn/button/snice-button.js.map +1 -1
- package/dist/cdn/button/snice-button.min.js +3 -3
- package/dist/cdn/button/snice-button.min.js.map +1 -1
- package/dist/cdn/calendar/snice-calendar.js +1 -1
- package/dist/cdn/calendar/snice-calendar.min.js +1 -1
- package/dist/cdn/camera/snice-camera.js +1 -1
- package/dist/cdn/camera/snice-camera.min.js +1 -1
- package/dist/cdn/camera-annotate/snice-camera-annotate.js +1 -1
- package/dist/cdn/camera-annotate/snice-camera-annotate.min.js +1 -1
- package/dist/cdn/candlestick/snice-candlestick.js +1 -1
- package/dist/cdn/candlestick/snice-candlestick.min.js +1 -1
- package/dist/cdn/card/snice-card.js +1 -1
- package/dist/cdn/card/snice-card.min.js +1 -1
- package/dist/cdn/carousel/snice-carousel.js +1 -1
- package/dist/cdn/carousel/snice-carousel.min.js +1 -1
- package/dist/cdn/cart/snice-cart.js +1 -1
- package/dist/cdn/cart/snice-cart.min.js +1 -1
- package/dist/cdn/chart/snice-chart.js +1 -1
- package/dist/cdn/chart/snice-chart.min.js +1 -1
- package/dist/cdn/chat/snice-chat.js +1 -1
- package/dist/cdn/chat/snice-chat.min.js +1 -1
- package/dist/cdn/checkbox/snice-checkbox.js +1 -1
- package/dist/cdn/checkbox/snice-checkbox.min.js +1 -1
- package/dist/cdn/chip/snice-chip.js +1 -1
- package/dist/cdn/chip/snice-chip.min.js +1 -1
- package/dist/cdn/code-block/snice-code-block.js +1 -1
- package/dist/cdn/code-block/snice-code-block.min.js +1 -1
- package/dist/cdn/color-display/snice-color-display.js +1 -1
- package/dist/cdn/color-display/snice-color-display.min.js +1 -1
- package/dist/cdn/color-picker/snice-color-picker.js +1 -1
- package/dist/cdn/color-picker/snice-color-picker.min.js +1 -1
- package/dist/cdn/command-palette/snice-command-palette.js +1 -1
- package/dist/cdn/command-palette/snice-command-palette.min.js +1 -1
- package/dist/cdn/comments/snice-comments.js +1 -1
- package/dist/cdn/comments/snice-comments.min.js +1 -1
- package/dist/cdn/countdown/snice-countdown.js +1 -1
- package/dist/cdn/countdown/snice-countdown.min.js +1 -1
- package/dist/cdn/cropper/snice-cropper.js +1 -1
- package/dist/cdn/cropper/snice-cropper.min.js +1 -1
- package/dist/cdn/data-card/snice-data-card.js +1 -1
- package/dist/cdn/data-card/snice-data-card.min.js +1 -1
- package/dist/cdn/date-picker/snice-date-picker.js +1 -1
- package/dist/cdn/date-picker/snice-date-picker.min.js +1 -1
- package/dist/cdn/date-range-picker/snice-date-range-picker.js +1 -1
- package/dist/cdn/date-range-picker/snice-date-range-picker.min.js +1 -1
- package/dist/cdn/date-time-picker/snice-date-time-picker.js +1 -1
- package/dist/cdn/date-time-picker/snice-date-time-picker.min.js +1 -1
- package/dist/cdn/diff/snice-diff.js +1 -1
- package/dist/cdn/diff/snice-diff.min.js +1 -1
- package/dist/cdn/divider/snice-divider.js +1 -1
- package/dist/cdn/divider/snice-divider.min.js +1 -1
- package/dist/cdn/doc/snice-doc.js +1 -1
- package/dist/cdn/doc/snice-doc.min.js +1 -1
- package/dist/cdn/draw/snice-draw.js +1 -1
- package/dist/cdn/draw/snice-draw.min.js +1 -1
- package/dist/cdn/drawer/snice-drawer.js +1 -1
- package/dist/cdn/drawer/snice-drawer.min.js +1 -1
- package/dist/cdn/empty-state/snice-empty-state.js +1 -1
- package/dist/cdn/empty-state/snice-empty-state.min.js +1 -1
- package/dist/cdn/estimate/snice-estimate.js +1 -1
- package/dist/cdn/estimate/snice-estimate.min.js +1 -1
- package/dist/cdn/file-gallery/snice-file-gallery.js +1 -1
- package/dist/cdn/file-gallery/snice-file-gallery.min.js +1 -1
- package/dist/cdn/file-upload/snice-file-upload.js +1 -1
- package/dist/cdn/file-upload/snice-file-upload.min.js +1 -1
- package/dist/cdn/flip-card/snice-flip-card.js +1 -1
- package/dist/cdn/flip-card/snice-flip-card.min.js +1 -1
- package/dist/cdn/flow/snice-flow.js +1 -1
- package/dist/cdn/flow/snice-flow.min.js +1 -1
- package/dist/cdn/form-layout/snice-form-layout.js +1 -1
- package/dist/cdn/form-layout/snice-form-layout.min.js +1 -1
- package/dist/cdn/funnel/snice-funnel.js +1 -1
- package/dist/cdn/funnel/snice-funnel.min.js +1 -1
- package/dist/cdn/gantt/snice-gantt.js +1 -1
- package/dist/cdn/gantt/snice-gantt.min.js +1 -1
- package/dist/cdn/gauge/snice-gauge.js +1 -1
- package/dist/cdn/gauge/snice-gauge.min.js +1 -1
- package/dist/cdn/heatmap/snice-heatmap.js +1 -1
- package/dist/cdn/heatmap/snice-heatmap.min.js +1 -1
- package/dist/cdn/image/snice-image.js +1 -1
- package/dist/cdn/image/snice-image.min.js +1 -1
- package/dist/cdn/input/snice-input.js +1 -1
- package/dist/cdn/input/snice-input.min.js +1 -1
- package/dist/cdn/invoice/snice-invoice.js +1 -1
- package/dist/cdn/invoice/snice-invoice.min.js +1 -1
- package/dist/cdn/kanban/snice-kanban.js +1 -1
- package/dist/cdn/kanban/snice-kanban.min.js +1 -1
- package/dist/cdn/key-value/snice-key-value.js +1 -1
- package/dist/cdn/key-value/snice-key-value.min.js +1 -1
- package/dist/cdn/kpi/snice-kpi.js +1 -1
- package/dist/cdn/kpi/snice-kpi.min.js +1 -1
- package/dist/cdn/layout/snice-layout.js +1 -1
- package/dist/cdn/layout/snice-layout.min.js +1 -1
- package/dist/cdn/leaderboard/snice-leaderboard.js +1 -1
- package/dist/cdn/leaderboard/snice-leaderboard.min.js +1 -1
- package/dist/cdn/link/snice-link.js +1 -1
- package/dist/cdn/link/snice-link.min.js +1 -1
- package/dist/cdn/link-preview/snice-link-preview.js +1 -1
- package/dist/cdn/link-preview/snice-link-preview.min.js +1 -1
- package/dist/cdn/list/snice-list.js +1 -1
- package/dist/cdn/list/snice-list.min.js +1 -1
- package/dist/cdn/location/snice-location.js +1 -1
- package/dist/cdn/location/snice-location.min.js +1 -1
- package/dist/cdn/login/snice-login.js +11 -10
- package/dist/cdn/login/snice-login.js.map +1 -1
- package/dist/cdn/login/snice-login.min.js +5 -5
- package/dist/cdn/login/snice-login.min.js.map +1 -1
- package/dist/cdn/map/snice-map.js +1 -1
- package/dist/cdn/map/snice-map.min.js +1 -1
- package/dist/cdn/markdown/snice-markdown.js +1 -1
- package/dist/cdn/markdown/snice-markdown.min.js +1 -1
- package/dist/cdn/masonry/snice-masonry.js +1 -1
- package/dist/cdn/masonry/snice-masonry.min.js +1 -1
- package/dist/cdn/menu/snice-menu.js +1 -1
- package/dist/cdn/menu/snice-menu.min.js +1 -1
- package/dist/cdn/message-strip/snice-message-strip.js +1 -1
- package/dist/cdn/message-strip/snice-message-strip.min.js +1 -1
- package/dist/cdn/metric-table/snice-metric-table.js +1 -1
- package/dist/cdn/metric-table/snice-metric-table.min.js +1 -1
- package/dist/cdn/modal/snice-modal.js +1 -1
- package/dist/cdn/modal/snice-modal.min.js +1 -1
- package/dist/cdn/music-player/snice-music-player.js +1 -1
- package/dist/cdn/music-player/snice-music-player.min.js +1 -1
- package/dist/cdn/nav/snice-nav.js +1 -1
- package/dist/cdn/nav/snice-nav.min.js +1 -1
- package/dist/cdn/network-graph/snice-network-graph.js +1 -1
- package/dist/cdn/network-graph/snice-network-graph.min.js +1 -1
- package/dist/cdn/notification-center/snice-notification-center.js +1 -1
- package/dist/cdn/notification-center/snice-notification-center.min.js +1 -1
- package/dist/cdn/order-tracker/snice-order-tracker.js +1 -1
- package/dist/cdn/order-tracker/snice-order-tracker.min.js +1 -1
- package/dist/cdn/org-chart/snice-org-chart.js +1 -1
- package/dist/cdn/org-chart/snice-org-chart.min.js +1 -1
- package/dist/cdn/pagination/snice-pagination.js +1 -1
- package/dist/cdn/pagination/snice-pagination.min.js +1 -1
- package/dist/cdn/paint/snice-paint.js +1 -1
- package/dist/cdn/paint/snice-paint.min.js +1 -1
- package/dist/cdn/pdf-viewer/snice-pdf-viewer.js +1 -1
- package/dist/cdn/pdf-viewer/snice-pdf-viewer.min.js +1 -1
- package/dist/cdn/permission-matrix/snice-permission-matrix.js +1 -1
- package/dist/cdn/permission-matrix/snice-permission-matrix.min.js +1 -1
- package/dist/cdn/podcast-player/snice-podcast-player.js +1 -1
- package/dist/cdn/podcast-player/snice-podcast-player.min.js +1 -1
- package/dist/cdn/pricing-table/snice-pricing-table.js +1 -1
- package/dist/cdn/pricing-table/snice-pricing-table.min.js +1 -1
- package/dist/cdn/product-card/snice-product-card.js +1 -1
- package/dist/cdn/product-card/snice-product-card.min.js +1 -1
- package/dist/cdn/progress/snice-progress.js +1 -1
- package/dist/cdn/progress/snice-progress.min.js +1 -1
- package/dist/cdn/progress-ring/snice-progress-ring.js +1 -1
- package/dist/cdn/progress-ring/snice-progress-ring.min.js +1 -1
- package/dist/cdn/qr-code/snice-qr-code.js +1 -1
- package/dist/cdn/qr-code/snice-qr-code.min.js +1 -1
- package/dist/cdn/qr-reader/snice-qr-reader.js +1 -1
- package/dist/cdn/qr-reader/snice-qr-reader.min.js +1 -1
- package/dist/cdn/radio/snice-radio.js +1 -1
- package/dist/cdn/radio/snice-radio.min.js +1 -1
- package/dist/cdn/range-slider/snice-range-slider.js +1 -1
- package/dist/cdn/range-slider/snice-range-slider.min.js +1 -1
- package/dist/cdn/rating/snice-rating.js +1 -1
- package/dist/cdn/rating/snice-rating.min.js +1 -1
- package/dist/cdn/receipt/snice-receipt.js +1 -1
- package/dist/cdn/receipt/snice-receipt.min.js +1 -1
- package/dist/cdn/recipe/snice-recipe.js +1 -1
- package/dist/cdn/recipe/snice-recipe.min.js +1 -1
- package/dist/cdn/runtime/README.md +2 -2
- package/dist/cdn/runtime/snice-runtime.esm.js +83 -61
- package/dist/cdn/runtime/snice-runtime.esm.js.map +1 -1
- package/dist/cdn/runtime/snice-runtime.esm.min.js +7 -7
- package/dist/cdn/runtime/snice-runtime.esm.min.js.map +1 -1
- package/dist/cdn/runtime/snice-runtime.js +83 -61
- package/dist/cdn/runtime/snice-runtime.js.map +1 -1
- package/dist/cdn/runtime/snice-runtime.min.js +7 -7
- package/dist/cdn/runtime/snice-runtime.min.js.map +1 -1
- package/dist/cdn/sankey/snice-sankey.js +1 -1
- package/dist/cdn/sankey/snice-sankey.min.js +1 -1
- package/dist/cdn/segmented-control/snice-segmented-control.js +1 -1
- package/dist/cdn/segmented-control/snice-segmented-control.min.js +1 -1
- package/dist/cdn/select/snice-select.js +1 -1
- package/dist/cdn/select/snice-select.min.js +1 -1
- package/dist/cdn/skeleton/snice-skeleton.js +1 -1
- package/dist/cdn/skeleton/snice-skeleton.min.js +1 -1
- package/dist/cdn/slider/snice-slider.js +1 -1
- package/dist/cdn/slider/snice-slider.min.js +1 -1
- package/dist/cdn/sortable/snice-sortable.js +1 -1
- package/dist/cdn/sortable/snice-sortable.min.js +1 -1
- package/dist/cdn/sparkline/snice-sparkline.js +1 -1
- package/dist/cdn/sparkline/snice-sparkline.min.js +1 -1
- package/dist/cdn/spinner/snice-spinner.js +1 -1
- package/dist/cdn/spinner/snice-spinner.min.js +1 -1
- package/dist/cdn/split-button/snice-split-button.js +1 -1
- package/dist/cdn/split-button/snice-split-button.min.js +1 -1
- package/dist/cdn/split-pane/snice-split-pane.js +1 -1
- package/dist/cdn/split-pane/snice-split-pane.min.js +1 -1
- package/dist/cdn/spotlight/snice-spotlight.js +1 -1
- package/dist/cdn/spotlight/snice-spotlight.min.js +1 -1
- package/dist/cdn/spreadsheet/snice-spreadsheet.js +1 -1
- package/dist/cdn/spreadsheet/snice-spreadsheet.min.js +1 -1
- package/dist/cdn/stat-group/snice-stat-group.js +1 -1
- package/dist/cdn/stat-group/snice-stat-group.min.js +1 -1
- package/dist/cdn/step-input/snice-step-input.js +1 -1
- package/dist/cdn/step-input/snice-step-input.min.js +1 -1
- package/dist/cdn/stepper/snice-stepper.js +1 -1
- package/dist/cdn/stepper/snice-stepper.min.js +1 -1
- package/dist/cdn/switch/snice-switch.js +1 -1
- package/dist/cdn/switch/snice-switch.min.js +1 -1
- package/dist/cdn/table/snice-table.js +11 -10
- package/dist/cdn/table/snice-table.js.map +1 -1
- package/dist/cdn/table/snice-table.min.js +73 -73
- package/dist/cdn/table/snice-table.min.js.map +1 -1
- package/dist/cdn/tabs/snice-tabs.js +1 -1
- package/dist/cdn/tabs/snice-tabs.min.js +1 -1
- package/dist/cdn/tag/snice-tag.js +1 -1
- package/dist/cdn/tag/snice-tag.min.js +1 -1
- package/dist/cdn/tag-input/snice-tag-input.js +1 -1
- package/dist/cdn/tag-input/snice-tag-input.min.js +1 -1
- package/dist/cdn/terminal/snice-terminal.js +1 -1
- package/dist/cdn/terminal/snice-terminal.min.js +1 -1
- package/dist/cdn/testimonial/snice-testimonial.js +1 -1
- package/dist/cdn/testimonial/snice-testimonial.min.js +1 -1
- package/dist/cdn/textarea/snice-textarea.js +1 -1
- package/dist/cdn/textarea/snice-textarea.min.js +1 -1
- package/dist/cdn/time-picker/snice-time-picker.js +1 -1
- package/dist/cdn/time-picker/snice-time-picker.min.js +1 -1
- package/dist/cdn/time-range-picker/snice-time-range-picker.js +1 -1
- package/dist/cdn/time-range-picker/snice-time-range-picker.min.js +1 -1
- package/dist/cdn/timeline/snice-timeline.js +1 -1
- package/dist/cdn/timeline/snice-timeline.min.js +1 -1
- package/dist/cdn/timer/snice-timer.js +1 -1
- package/dist/cdn/timer/snice-timer.min.js +1 -1
- package/dist/cdn/toast/snice-toast.js +1 -1
- package/dist/cdn/toast/snice-toast.min.js +1 -1
- package/dist/cdn/tooltip/snice-tooltip.js +1 -1
- package/dist/cdn/tooltip/snice-tooltip.min.js +1 -1
- package/dist/cdn/tree/snice-tree.js +1 -1
- package/dist/cdn/tree/snice-tree.min.js +1 -1
- package/dist/cdn/treemap/snice-treemap.js +1 -1
- package/dist/cdn/treemap/snice-treemap.min.js +1 -1
- package/dist/cdn/user-card/snice-user-card.js +1 -1
- package/dist/cdn/user-card/snice-user-card.min.js +1 -1
- package/dist/cdn/video-player/snice-video-player.js +1 -1
- package/dist/cdn/video-player/snice-video-player.min.js +1 -1
- package/dist/cdn/virtual-scroller/snice-virtual-scroller.js +1 -1
- package/dist/cdn/virtual-scroller/snice-virtual-scroller.min.js +1 -1
- package/dist/cdn/waterfall/snice-waterfall.js +1 -1
- package/dist/cdn/waterfall/snice-waterfall.min.js +1 -1
- package/dist/cdn/weather/snice-weather.js +1 -1
- package/dist/cdn/weather/snice-weather.min.js +1 -1
- package/dist/cdn/work-order/snice-work-order.js +1 -1
- package/dist/cdn/work-order/snice-work-order.min.js +1 -1
- package/dist/components/badge/snice-badge.js +1 -1
- package/dist/components/badge/snice-badge.js.map +1 -1
- package/dist/components/button/snice-button.d.ts +2 -2
- package/dist/components/button/snice-button.js +11 -10
- package/dist/components/button/snice-button.js.map +1 -1
- package/dist/index.cjs +80 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +80 -58
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +80 -58
- package/dist/index.iife.js.map +1 -1
- package/dist/parts.d.ts +9 -7
- package/dist/symbols.cjs +1 -1
- package/dist/symbols.esm.js +1 -1
- package/dist/transitions.cjs +1 -1
- package/dist/transitions.esm.js +1 -1
- package/package.json +20 -10
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* snice v4.
|
|
2
|
+
* snice v4.28.0
|
|
3
3
|
* A decorator-driven web component library with differential rendering, routing, controllers, and 130+ ready-made UI components. Use as much or as little as you want. Zero dependencies, works anywhere.
|
|
4
4
|
* (c) 2024
|
|
5
5
|
* Released under the MIT License.
|
|
6
6
|
*/
|
|
7
7
|
/*!
|
|
8
|
-
* snice v4.
|
|
8
|
+
* snice v4.27.0
|
|
9
9
|
* A decorator-driven web component library with differential rendering, routing, controllers, and 130+ ready-made UI components. Use as much or as little as you want. Zero dependencies, works anywhere.
|
|
10
10
|
* (c) 2024
|
|
11
11
|
* Released under the MIT License.
|
|
@@ -2065,9 +2065,20 @@ class ConditionalIfPart extends Part {
|
|
|
2065
2065
|
constructor(ifElement) {
|
|
2066
2066
|
super();
|
|
2067
2067
|
this.value = NOT_SET;
|
|
2068
|
-
this.
|
|
2069
|
-
|
|
2070
|
-
|
|
2068
|
+
this.childFragment = null;
|
|
2069
|
+
const parent = ifElement.parentNode;
|
|
2070
|
+
// Create comment boundary markers
|
|
2071
|
+
this.startNode = document.createComment('if');
|
|
2072
|
+
this.endNode = document.createComment('/if');
|
|
2073
|
+
// Insert markers where <if> is
|
|
2074
|
+
parent.insertBefore(this.startNode, ifElement);
|
|
2075
|
+
parent.insertBefore(this.endNode, ifElement.nextSibling);
|
|
2076
|
+
// Move <if>'s children between the markers
|
|
2077
|
+
while (ifElement.firstChild) {
|
|
2078
|
+
parent.insertBefore(ifElement.firstChild, this.endNode);
|
|
2079
|
+
}
|
|
2080
|
+
// Remove the <if> element from DOM
|
|
2081
|
+
parent.removeChild(ifElement);
|
|
2071
2082
|
}
|
|
2072
2083
|
commit(value) {
|
|
2073
2084
|
const condition = Boolean(value);
|
|
@@ -2076,26 +2087,32 @@ class ConditionalIfPart extends Part {
|
|
|
2076
2087
|
this.value = value;
|
|
2077
2088
|
if (condition) {
|
|
2078
2089
|
// Show: restore children from fragment
|
|
2079
|
-
if (this.
|
|
2080
|
-
this.
|
|
2090
|
+
if (this.childFragment && this.childFragment.hasChildNodes()) {
|
|
2091
|
+
this.startNode.parentNode.insertBefore(this.childFragment, this.endNode);
|
|
2081
2092
|
}
|
|
2082
2093
|
}
|
|
2083
2094
|
else {
|
|
2084
2095
|
// Hide: move children to fragment
|
|
2085
|
-
if (!this.
|
|
2086
|
-
this.
|
|
2096
|
+
if (!this.childFragment) {
|
|
2097
|
+
this.childFragment = document.createDocumentFragment();
|
|
2087
2098
|
}
|
|
2088
|
-
|
|
2089
|
-
|
|
2099
|
+
let node = this.startNode.nextSibling;
|
|
2100
|
+
while (node && node !== this.endNode) {
|
|
2101
|
+
const next = node.nextSibling;
|
|
2102
|
+
this.childFragment.appendChild(node);
|
|
2103
|
+
node = next;
|
|
2090
2104
|
}
|
|
2091
2105
|
}
|
|
2092
2106
|
}
|
|
2093
2107
|
clear() {
|
|
2094
|
-
if (!this.
|
|
2095
|
-
this.
|
|
2108
|
+
if (!this.childFragment) {
|
|
2109
|
+
this.childFragment = document.createDocumentFragment();
|
|
2096
2110
|
}
|
|
2097
|
-
|
|
2098
|
-
|
|
2111
|
+
let node = this.startNode.nextSibling;
|
|
2112
|
+
while (node && node !== this.endNode) {
|
|
2113
|
+
const next = node.nextSibling;
|
|
2114
|
+
this.childFragment.appendChild(node);
|
|
2115
|
+
node = next;
|
|
2099
2116
|
}
|
|
2100
2117
|
}
|
|
2101
2118
|
}
|
|
@@ -2107,62 +2124,70 @@ class ConditionalCasePart extends Part {
|
|
|
2107
2124
|
constructor(caseElement) {
|
|
2108
2125
|
super();
|
|
2109
2126
|
this.value = NOT_SET;
|
|
2110
|
-
this.
|
|
2111
|
-
this.
|
|
2112
|
-
this.
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
this.
|
|
2116
|
-
|
|
2117
|
-
|
|
2127
|
+
this.branches = new Map();
|
|
2128
|
+
this.defaultBranch = null;
|
|
2129
|
+
this.currentKey = null;
|
|
2130
|
+
const parent = caseElement.parentNode;
|
|
2131
|
+
// Create comment boundary markers
|
|
2132
|
+
this.startNode = document.createComment('case');
|
|
2133
|
+
this.endNode = document.createComment('/case');
|
|
2134
|
+
// Insert markers where <case> is
|
|
2135
|
+
parent.insertBefore(this.startNode, caseElement);
|
|
2136
|
+
parent.insertBefore(this.endNode, caseElement.nextSibling);
|
|
2137
|
+
// Extract branches from <when> and <default> children
|
|
2138
|
+
for (const child of Array.from(caseElement.children)) {
|
|
2118
2139
|
const childTag = child.tagName.toLowerCase();
|
|
2119
2140
|
if (childTag === 'when') {
|
|
2120
|
-
child.style.display = 'contents';
|
|
2121
2141
|
const whenValue = child.getAttribute('value') || '';
|
|
2122
|
-
this.childrenMap.set(whenValue, child);
|
|
2123
2142
|
const fragment = document.createDocumentFragment();
|
|
2124
|
-
|
|
2125
|
-
|
|
2143
|
+
while (child.firstChild) {
|
|
2144
|
+
fragment.appendChild(child.firstChild);
|
|
2145
|
+
}
|
|
2146
|
+
this.branches.set(whenValue, fragment);
|
|
2126
2147
|
}
|
|
2127
2148
|
else if (childTag === 'default') {
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
this.fragments.set(child, fragment);
|
|
2149
|
+
this.defaultBranch = document.createDocumentFragment();
|
|
2150
|
+
while (child.firstChild) {
|
|
2151
|
+
this.defaultBranch.appendChild(child.firstChild);
|
|
2152
|
+
}
|
|
2133
2153
|
}
|
|
2134
2154
|
}
|
|
2155
|
+
// Remove the <case> element from DOM
|
|
2156
|
+
parent.removeChild(caseElement);
|
|
2135
2157
|
}
|
|
2136
2158
|
commit(value) {
|
|
2137
2159
|
if (this.value === value)
|
|
2138
2160
|
return;
|
|
2139
2161
|
this.value = value;
|
|
2140
2162
|
const valueStr = String(value);
|
|
2141
|
-
//
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
this.
|
|
2163
|
+
// Move current content back to its fragment
|
|
2164
|
+
this._collectCurrent();
|
|
2165
|
+
// Insert matching branch
|
|
2166
|
+
const hasBranch = this.branches.has(valueStr);
|
|
2167
|
+
const matchingFragment = hasBranch ? this.branches.get(valueStr) : this.defaultBranch;
|
|
2168
|
+
this.currentKey = hasBranch ? valueStr : (this.defaultBranch ? '__default__' : null);
|
|
2169
|
+
if (matchingFragment && matchingFragment.hasChildNodes()) {
|
|
2170
|
+
this.startNode.parentNode.insertBefore(matchingFragment, this.endNode);
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
_collectCurrent() {
|
|
2174
|
+
if (this.currentKey === null)
|
|
2175
|
+
return;
|
|
2176
|
+
const fragment = this.currentKey === '__default__'
|
|
2177
|
+
? this.defaultBranch
|
|
2178
|
+
: this.branches.get(this.currentKey);
|
|
2179
|
+
if (!fragment)
|
|
2180
|
+
return;
|
|
2181
|
+
let node = this.startNode.nextSibling;
|
|
2182
|
+
while (node && node !== this.endNode) {
|
|
2183
|
+
const next = node.nextSibling;
|
|
2184
|
+
fragment.appendChild(node);
|
|
2185
|
+
node = next;
|
|
2156
2186
|
}
|
|
2157
2187
|
}
|
|
2158
2188
|
clear() {
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
if (fragment && !fragment.hasChildNodes()) {
|
|
2162
|
-
fragment.appendChild(this.currentChild);
|
|
2163
|
-
}
|
|
2164
|
-
this.currentChild = null;
|
|
2165
|
-
}
|
|
2189
|
+
this._collectCurrent();
|
|
2190
|
+
this.currentKey = null;
|
|
2166
2191
|
}
|
|
2167
2192
|
}
|
|
2168
2193
|
|
|
@@ -3087,19 +3112,16 @@ function applyStyles(element) {
|
|
|
3087
3112
|
if (!element.shadowRoot) {
|
|
3088
3113
|
element.attachShadow({ mode: 'open' });
|
|
3089
3114
|
}
|
|
3090
|
-
// Create base styles for meta elements (if, case)
|
|
3091
|
-
const baseStyleSheet = new CSSStyleSheet();
|
|
3092
|
-
baseStyleSheet.replaceSync('if, case { display: contents; }');
|
|
3093
3115
|
if (!element.shadowRoot)
|
|
3094
3116
|
return;
|
|
3095
3117
|
// Prefer constructable stylesheets
|
|
3096
3118
|
if (result.styleSheet && 'adoptedStyleSheets' in element.shadowRoot) {
|
|
3097
|
-
element.shadowRoot.adoptedStyleSheets = [
|
|
3119
|
+
element.shadowRoot.adoptedStyleSheets = [result.styleSheet];
|
|
3098
3120
|
return;
|
|
3099
3121
|
}
|
|
3100
3122
|
// Fallback to <style> tag
|
|
3101
3123
|
const style = document.createElement('style');
|
|
3102
|
-
style.textContent =
|
|
3124
|
+
style.textContent = result.cssText;
|
|
3103
3125
|
element.shadowRoot.appendChild(style);
|
|
3104
3126
|
}
|
|
3105
3127
|
catch (error) {
|
|
@@ -5419,7 +5441,7 @@ if (typeof document !== 'undefined') {
|
|
|
5419
5441
|
}
|
|
5420
5442
|
|
|
5421
5443
|
/*!
|
|
5422
|
-
* snice v4.
|
|
5444
|
+
* snice v4.27.0
|
|
5423
5445
|
* A decorator-driven web component library with differential rendering, routing, controllers, and 130+ ready-made UI components. Use as much or as little as you want. Zero dependencies, works anywhere.
|
|
5424
5446
|
* (c) 2024
|
|
5425
5447
|
* Released under the MIT License.
|
|
@@ -5436,7 +5458,7 @@ if (!globalThis.snice) {
|
|
|
5436
5458
|
}
|
|
5437
5459
|
|
|
5438
5460
|
/*!
|
|
5439
|
-
* snice v4.
|
|
5461
|
+
* snice v4.27.0
|
|
5440
5462
|
* A decorator-driven web component library with differential rendering, routing, controllers, and 130+ ready-made UI components. Use as much or as little as you want. Zero dependencies, works anywhere.
|
|
5441
5463
|
* (c) 2024
|
|
5442
5464
|
* Released under the MIT License.
|