snice 4.26.2 → 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
package/dist/index.iife.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* snice v4.
|
|
2
|
+
* snice v4.27.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.
|
|
@@ -2062,9 +2062,20 @@ var Snice = (function (exports) {
|
|
|
2062
2062
|
constructor(ifElement) {
|
|
2063
2063
|
super();
|
|
2064
2064
|
this.value = NOT_SET;
|
|
2065
|
-
this.
|
|
2066
|
-
|
|
2067
|
-
|
|
2065
|
+
this.childFragment = null;
|
|
2066
|
+
const parent = ifElement.parentNode;
|
|
2067
|
+
// Create comment boundary markers
|
|
2068
|
+
this.startNode = document.createComment('if');
|
|
2069
|
+
this.endNode = document.createComment('/if');
|
|
2070
|
+
// Insert markers where <if> is
|
|
2071
|
+
parent.insertBefore(this.startNode, ifElement);
|
|
2072
|
+
parent.insertBefore(this.endNode, ifElement.nextSibling);
|
|
2073
|
+
// Move <if>'s children between the markers
|
|
2074
|
+
while (ifElement.firstChild) {
|
|
2075
|
+
parent.insertBefore(ifElement.firstChild, this.endNode);
|
|
2076
|
+
}
|
|
2077
|
+
// Remove the <if> element from DOM
|
|
2078
|
+
parent.removeChild(ifElement);
|
|
2068
2079
|
}
|
|
2069
2080
|
commit(value) {
|
|
2070
2081
|
const condition = Boolean(value);
|
|
@@ -2073,26 +2084,32 @@ var Snice = (function (exports) {
|
|
|
2073
2084
|
this.value = value;
|
|
2074
2085
|
if (condition) {
|
|
2075
2086
|
// Show: restore children from fragment
|
|
2076
|
-
if (this.
|
|
2077
|
-
this.
|
|
2087
|
+
if (this.childFragment && this.childFragment.hasChildNodes()) {
|
|
2088
|
+
this.startNode.parentNode.insertBefore(this.childFragment, this.endNode);
|
|
2078
2089
|
}
|
|
2079
2090
|
}
|
|
2080
2091
|
else {
|
|
2081
2092
|
// Hide: move children to fragment
|
|
2082
|
-
if (!this.
|
|
2083
|
-
this.
|
|
2093
|
+
if (!this.childFragment) {
|
|
2094
|
+
this.childFragment = document.createDocumentFragment();
|
|
2084
2095
|
}
|
|
2085
|
-
|
|
2086
|
-
|
|
2096
|
+
let node = this.startNode.nextSibling;
|
|
2097
|
+
while (node && node !== this.endNode) {
|
|
2098
|
+
const next = node.nextSibling;
|
|
2099
|
+
this.childFragment.appendChild(node);
|
|
2100
|
+
node = next;
|
|
2087
2101
|
}
|
|
2088
2102
|
}
|
|
2089
2103
|
}
|
|
2090
2104
|
clear() {
|
|
2091
|
-
if (!this.
|
|
2092
|
-
this.
|
|
2105
|
+
if (!this.childFragment) {
|
|
2106
|
+
this.childFragment = document.createDocumentFragment();
|
|
2093
2107
|
}
|
|
2094
|
-
|
|
2095
|
-
|
|
2108
|
+
let node = this.startNode.nextSibling;
|
|
2109
|
+
while (node && node !== this.endNode) {
|
|
2110
|
+
const next = node.nextSibling;
|
|
2111
|
+
this.childFragment.appendChild(node);
|
|
2112
|
+
node = next;
|
|
2096
2113
|
}
|
|
2097
2114
|
}
|
|
2098
2115
|
}
|
|
@@ -2104,62 +2121,70 @@ var Snice = (function (exports) {
|
|
|
2104
2121
|
constructor(caseElement) {
|
|
2105
2122
|
super();
|
|
2106
2123
|
this.value = NOT_SET;
|
|
2107
|
-
this.
|
|
2108
|
-
this.
|
|
2109
|
-
this.
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
this.
|
|
2113
|
-
|
|
2114
|
-
|
|
2124
|
+
this.branches = new Map();
|
|
2125
|
+
this.defaultBranch = null;
|
|
2126
|
+
this.currentKey = null;
|
|
2127
|
+
const parent = caseElement.parentNode;
|
|
2128
|
+
// Create comment boundary markers
|
|
2129
|
+
this.startNode = document.createComment('case');
|
|
2130
|
+
this.endNode = document.createComment('/case');
|
|
2131
|
+
// Insert markers where <case> is
|
|
2132
|
+
parent.insertBefore(this.startNode, caseElement);
|
|
2133
|
+
parent.insertBefore(this.endNode, caseElement.nextSibling);
|
|
2134
|
+
// Extract branches from <when> and <default> children
|
|
2135
|
+
for (const child of Array.from(caseElement.children)) {
|
|
2115
2136
|
const childTag = child.tagName.toLowerCase();
|
|
2116
2137
|
if (childTag === 'when') {
|
|
2117
|
-
child.style.display = 'contents';
|
|
2118
2138
|
const whenValue = child.getAttribute('value') || '';
|
|
2119
|
-
this.childrenMap.set(whenValue, child);
|
|
2120
2139
|
const fragment = document.createDocumentFragment();
|
|
2121
|
-
|
|
2122
|
-
|
|
2140
|
+
while (child.firstChild) {
|
|
2141
|
+
fragment.appendChild(child.firstChild);
|
|
2142
|
+
}
|
|
2143
|
+
this.branches.set(whenValue, fragment);
|
|
2123
2144
|
}
|
|
2124
2145
|
else if (childTag === 'default') {
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
this.fragments.set(child, fragment);
|
|
2146
|
+
this.defaultBranch = document.createDocumentFragment();
|
|
2147
|
+
while (child.firstChild) {
|
|
2148
|
+
this.defaultBranch.appendChild(child.firstChild);
|
|
2149
|
+
}
|
|
2130
2150
|
}
|
|
2131
2151
|
}
|
|
2152
|
+
// Remove the <case> element from DOM
|
|
2153
|
+
parent.removeChild(caseElement);
|
|
2132
2154
|
}
|
|
2133
2155
|
commit(value) {
|
|
2134
2156
|
if (this.value === value)
|
|
2135
2157
|
return;
|
|
2136
2158
|
this.value = value;
|
|
2137
2159
|
const valueStr = String(value);
|
|
2138
|
-
//
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
this.
|
|
2160
|
+
// Move current content back to its fragment
|
|
2161
|
+
this._collectCurrent();
|
|
2162
|
+
// Insert matching branch
|
|
2163
|
+
const hasBranch = this.branches.has(valueStr);
|
|
2164
|
+
const matchingFragment = hasBranch ? this.branches.get(valueStr) : this.defaultBranch;
|
|
2165
|
+
this.currentKey = hasBranch ? valueStr : (this.defaultBranch ? '__default__' : null);
|
|
2166
|
+
if (matchingFragment && matchingFragment.hasChildNodes()) {
|
|
2167
|
+
this.startNode.parentNode.insertBefore(matchingFragment, this.endNode);
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
_collectCurrent() {
|
|
2171
|
+
if (this.currentKey === null)
|
|
2172
|
+
return;
|
|
2173
|
+
const fragment = this.currentKey === '__default__'
|
|
2174
|
+
? this.defaultBranch
|
|
2175
|
+
: this.branches.get(this.currentKey);
|
|
2176
|
+
if (!fragment)
|
|
2177
|
+
return;
|
|
2178
|
+
let node = this.startNode.nextSibling;
|
|
2179
|
+
while (node && node !== this.endNode) {
|
|
2180
|
+
const next = node.nextSibling;
|
|
2181
|
+
fragment.appendChild(node);
|
|
2182
|
+
node = next;
|
|
2153
2183
|
}
|
|
2154
2184
|
}
|
|
2155
2185
|
clear() {
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
if (fragment && !fragment.hasChildNodes()) {
|
|
2159
|
-
fragment.appendChild(this.currentChild);
|
|
2160
|
-
}
|
|
2161
|
-
this.currentChild = null;
|
|
2162
|
-
}
|
|
2186
|
+
this._collectCurrent();
|
|
2187
|
+
this.currentKey = null;
|
|
2163
2188
|
}
|
|
2164
2189
|
}
|
|
2165
2190
|
|
|
@@ -3084,19 +3109,16 @@ var Snice = (function (exports) {
|
|
|
3084
3109
|
if (!element.shadowRoot) {
|
|
3085
3110
|
element.attachShadow({ mode: 'open' });
|
|
3086
3111
|
}
|
|
3087
|
-
// Create base styles for meta elements (if, case)
|
|
3088
|
-
const baseStyleSheet = new CSSStyleSheet();
|
|
3089
|
-
baseStyleSheet.replaceSync('if, case { display: contents; }');
|
|
3090
3112
|
if (!element.shadowRoot)
|
|
3091
3113
|
return;
|
|
3092
3114
|
// Prefer constructable stylesheets
|
|
3093
3115
|
if (result.styleSheet && 'adoptedStyleSheets' in element.shadowRoot) {
|
|
3094
|
-
element.shadowRoot.adoptedStyleSheets = [
|
|
3116
|
+
element.shadowRoot.adoptedStyleSheets = [result.styleSheet];
|
|
3095
3117
|
return;
|
|
3096
3118
|
}
|
|
3097
3119
|
// Fallback to <style> tag
|
|
3098
3120
|
const style = document.createElement('style');
|
|
3099
|
-
style.textContent =
|
|
3121
|
+
style.textContent = result.cssText;
|
|
3100
3122
|
element.shadowRoot.appendChild(style);
|
|
3101
3123
|
}
|
|
3102
3124
|
catch (error) {
|