snice 4.8.0 → 4.9.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/adapters/react/camera-annotate.d.ts +27 -0
- package/adapters/react/camera-annotate.d.ts.map +1 -0
- package/adapters/react/camera-annotate.js +24 -0
- package/adapters/react/camera-annotate.js.map +1 -0
- package/adapters/react/camera-annotate.tsx +35 -0
- package/adapters/react/candlestick.d.ts +34 -0
- package/adapters/react/candlestick.d.ts.map +1 -0
- package/adapters/react/candlestick.js +24 -0
- package/adapters/react/candlestick.js.map +1 -0
- package/adapters/react/candlestick.tsx +42 -0
- package/adapters/react/components.d.ts +14 -0
- package/adapters/react/components.d.ts.map +1 -1
- package/adapters/react/components.js +7 -0
- package/adapters/react/components.js.map +1 -1
- package/adapters/react/components.ts +14 -0
- package/adapters/react/funnel.d.ts +31 -0
- package/adapters/react/funnel.d.ts.map +1 -0
- package/adapters/react/funnel.js +24 -0
- package/adapters/react/funnel.js.map +1 -0
- package/adapters/react/funnel.tsx +39 -0
- package/adapters/react/network-graph.d.ts +32 -0
- package/adapters/react/network-graph.d.ts.map +1 -0
- package/adapters/react/network-graph.js +24 -0
- package/adapters/react/network-graph.js.map +1 -0
- package/adapters/react/network-graph.tsx +40 -0
- package/adapters/react/sankey.d.ts +31 -0
- package/adapters/react/sankey.d.ts.map +1 -0
- package/adapters/react/sankey.js +24 -0
- package/adapters/react/sankey.js.map +1 -0
- package/adapters/react/sankey.tsx +39 -0
- package/adapters/react/time-range-picker.d.ts +33 -0
- package/adapters/react/time-range-picker.d.ts.map +1 -0
- package/adapters/react/time-range-picker.js +24 -0
- package/adapters/react/time-range-picker.js.map +1 -0
- package/adapters/react/time-range-picker.tsx +41 -0
- package/adapters/react/treemap.d.ts +30 -0
- package/adapters/react/treemap.d.ts.map +1 -0
- package/adapters/react/treemap.js +24 -0
- package/adapters/react/treemap.js.map +1 -0
- package/adapters/react/treemap.tsx +38 -0
- package/adapters/react/virtual-scroller.d.ts +1 -0
- package/adapters/react/virtual-scroller.d.ts.map +1 -1
- package/adapters/react/virtual-scroller.js +1 -1
- package/adapters/react/virtual-scroller.js.map +1 -1
- package/adapters/react/virtual-scroller.tsx +2 -1
- package/dist/cdn/accordion/snice-accordion.js +1 -1
- package/dist/cdn/accordion/snice-accordion.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/audio-recorder/snice-audio-recorder.js +1 -1
- package/dist/cdn/audio-recorder/snice-audio-recorder.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/badge/snice-badge.js +1 -1
- package/dist/cdn/badge/snice-badge.min.js +1 -1
- package/dist/cdn/banner/snice-banner.js +1 -1
- package/dist/cdn/banner/snice-banner.min.js +1 -1
- package/dist/cdn/breadcrumbs/snice-breadcrumbs.js +2 -2
- package/dist/cdn/breadcrumbs/snice-breadcrumbs.js.map +1 -1
- package/dist/cdn/breadcrumbs/snice-breadcrumbs.min.js +13 -13
- package/dist/cdn/breadcrumbs/snice-breadcrumbs.min.js.map +1 -1
- package/dist/cdn/button/snice-button.js +1 -1
- package/dist/cdn/button/snice-button.min.js +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/README.md +27 -0
- package/dist/cdn/camera-annotate/snice-camera-annotate.js +730 -0
- package/dist/cdn/camera-annotate/snice-camera-annotate.js.map +1 -0
- package/dist/cdn/camera-annotate/snice-camera-annotate.min.js +144 -0
- package/dist/cdn/camera-annotate/snice-camera-annotate.min.js.map +1 -0
- package/dist/cdn/candlestick/README.md +27 -0
- package/dist/cdn/candlestick/snice-candlestick.js +717 -0
- package/dist/cdn/candlestick/snice-candlestick.js.map +1 -0
- package/dist/cdn/candlestick/snice-candlestick.min.js +22 -0
- package/dist/cdn/candlestick/snice-candlestick.min.js.map +1 -0
- 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/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/date-picker/snice-date-picker.js +1 -1
- package/dist/cdn/date-picker/snice-date-picker.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/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/funnel/README.md +27 -0
- package/dist/cdn/funnel/snice-funnel.js +424 -0
- package/dist/cdn/funnel/snice-funnel.js.map +1 -0
- package/dist/cdn/funnel/snice-funnel.min.js +20 -0
- package/dist/cdn/funnel/snice-funnel.min.js.map +1 -0
- 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/kanban/snice-kanban.js +1 -1
- package/dist/cdn/kanban/snice-kanban.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/README.md +2 -2
- package/dist/cdn/layout/snice-layout.js +23 -6
- package/dist/cdn/layout/snice-layout.js.map +1 -1
- package/dist/cdn/layout/snice-layout.min.js +2 -2
- package/dist/cdn/layout/snice-layout.min.js.map +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/README.md +6 -2
- package/dist/cdn/list/snice-list.js +87 -10
- package/dist/cdn/list/snice-list.js.map +1 -1
- package/dist/cdn/list/snice-list.min.js +20 -6
- package/dist/cdn/list/snice-list.min.js.map +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 +1 -1
- package/dist/cdn/login/snice-login.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/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/README.md +2 -2
- package/dist/cdn/nav/snice-nav.js +23 -6
- package/dist/cdn/nav/snice-nav.js.map +1 -1
- package/dist/cdn/nav/snice-nav.min.js +2 -2
- package/dist/cdn/nav/snice-nav.min.js.map +1 -1
- package/dist/cdn/network-graph/README.md +27 -0
- package/dist/cdn/network-graph/snice-network-graph.js +788 -0
- package/dist/cdn/network-graph/snice-network-graph.js.map +1 -0
- package/dist/cdn/network-graph/snice-network-graph.min.js +13 -0
- package/dist/cdn/network-graph/snice-network-graph.min.js.map +1 -0
- package/dist/cdn/pagination/README.md +2 -2
- package/dist/cdn/pagination/snice-pagination.js +13 -13
- package/dist/cdn/pagination/snice-pagination.js.map +1 -1
- package/dist/cdn/pagination/snice-pagination.min.js +14 -14
- package/dist/cdn/pagination/snice-pagination.min.js.map +1 -1
- package/dist/cdn/paint/snice-paint.js +1 -1
- package/dist/cdn/paint/snice-paint.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/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/runtime/snice-runtime.esm.js +3 -3
- package/dist/cdn/runtime/snice-runtime.esm.js.map +1 -1
- package/dist/cdn/runtime/snice-runtime.esm.min.js +3 -3
- package/dist/cdn/runtime/snice-runtime.esm.min.js.map +1 -1
- package/dist/cdn/runtime/snice-runtime.js +3 -3
- package/dist/cdn/runtime/snice-runtime.js.map +1 -1
- package/dist/cdn/runtime/snice-runtime.min.js +3 -3
- package/dist/cdn/runtime/snice-runtime.min.js.map +1 -1
- package/dist/cdn/sankey/README.md +27 -0
- package/dist/cdn/sankey/snice-sankey.js +679 -0
- package/dist/cdn/sankey/snice-sankey.js.map +1 -0
- package/dist/cdn/sankey/snice-sankey.min.js +21 -0
- package/dist/cdn/sankey/snice-sankey.min.js.map +1 -0
- 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/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-pane/snice-split-pane.js +1 -1
- package/dist/cdn/split-pane/snice-split-pane.min.js +1 -1
- package/dist/cdn/stepper/README.md +6 -2
- package/dist/cdn/stepper/snice-stepper.js +77 -10
- package/dist/cdn/stepper/snice-stepper.js.map +1 -1
- package/dist/cdn/stepper/snice-stepper.min.js +13 -9
- package/dist/cdn/stepper/snice-stepper.min.js.map +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 +1 -1
- package/dist/cdn/table/snice-table.min.js +1 -1
- package/dist/cdn/tabs/snice-tabs.js +1 -1
- package/dist/cdn/tabs/snice-tabs.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/textarea/snice-textarea.js +1 -1
- package/dist/cdn/textarea/snice-textarea.min.js +1 -1
- package/dist/cdn/time-range-picker/README.md +27 -0
- package/dist/cdn/time-range-picker/snice-time-range-picker.js +635 -0
- package/dist/cdn/time-range-picker/snice-time-range-picker.js.map +1 -0
- package/dist/cdn/time-range-picker/snice-time-range-picker.min.js +34 -0
- package/dist/cdn/time-range-picker/snice-time-range-picker.min.js.map +1 -0
- 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/README.md +5 -1
- package/dist/cdn/tree/snice-tree.js +4 -8
- package/dist/cdn/tree/snice-tree.js.map +1 -1
- package/dist/cdn/tree/snice-tree.min.js +5 -5
- package/dist/cdn/tree/snice-tree.min.js.map +1 -1
- package/dist/cdn/treemap/README.md +27 -0
- package/dist/cdn/treemap/snice-treemap.js +522 -0
- package/dist/cdn/treemap/snice-treemap.js.map +1 -0
- package/dist/cdn/treemap/snice-treemap.min.js +14 -0
- package/dist/cdn/treemap/snice-treemap.min.js.map +1 -0
- package/dist/cdn/virtual-scroller/README.md +2 -2
- package/dist/cdn/virtual-scroller/snice-virtual-scroller.js +47 -16
- package/dist/cdn/virtual-scroller/snice-virtual-scroller.js.map +1 -1
- package/dist/cdn/virtual-scroller/snice-virtual-scroller.min.js +9 -9
- package/dist/cdn/virtual-scroller/snice-virtual-scroller.min.js.map +1 -1
- package/dist/components/breadcrumbs/snice-breadcrumbs.js +1 -1
- package/dist/components/breadcrumbs/snice-breadcrumbs.js.map +1 -1
- package/dist/components/camera-annotate/snice-camera-annotate.d.ts +68 -0
- package/dist/components/camera-annotate/snice-camera-annotate.js +663 -0
- package/dist/components/camera-annotate/snice-camera-annotate.js.map +1 -0
- package/dist/components/camera-annotate/snice-camera-annotate.types.d.ts +50 -0
- package/dist/components/candlestick/snice-candlestick.d.ts +78 -0
- package/dist/components/candlestick/snice-candlestick.js +650 -0
- package/dist/components/candlestick/snice-candlestick.js.map +1 -0
- package/dist/components/candlestick/snice-candlestick.types.d.ts +40 -0
- package/dist/components/funnel/snice-funnel.d.ts +37 -0
- package/dist/components/funnel/snice-funnel.js +357 -0
- package/dist/components/funnel/snice-funnel.js.map +1 -0
- package/dist/components/funnel/snice-funnel.types.d.ts +28 -0
- package/dist/components/list/snice-list-item.d.ts +2 -0
- package/dist/components/list/snice-list-item.js +20 -2
- package/dist/components/list/snice-list-item.js.map +1 -1
- package/dist/components/nav/snice-nav.js +22 -5
- package/dist/components/nav/snice-nav.js.map +1 -1
- package/dist/components/network-graph/snice-network-graph.d.ts +80 -0
- package/dist/components/network-graph/snice-network-graph.js +721 -0
- package/dist/components/network-graph/snice-network-graph.js.map +1 -0
- package/dist/components/network-graph/snice-network-graph.types.d.ts +49 -0
- package/dist/components/pagination/snice-pagination.js +12 -12
- package/dist/components/sankey/snice-sankey.d.ts +46 -0
- package/dist/components/sankey/snice-sankey.js +612 -0
- package/dist/components/sankey/snice-sankey.js.map +1 -0
- package/dist/components/sankey/snice-sankey.types.d.ts +59 -0
- package/dist/components/stepper/snice-stepper.js +9 -3
- package/dist/components/stepper/snice-stepper.js.map +1 -1
- package/dist/components/time-range-picker/snice-time-range-picker.d.ts +67 -0
- package/dist/components/time-range-picker/snice-time-range-picker.js +568 -0
- package/dist/components/time-range-picker/snice-time-range-picker.js.map +1 -0
- package/dist/components/time-range-picker/snice-time-range-picker.types.d.ts +39 -0
- package/dist/components/treemap/snice-treemap.d.ts +49 -0
- package/dist/components/treemap/snice-treemap.js +455 -0
- package/dist/components/treemap/snice-treemap.js.map +1 -0
- package/dist/components/treemap/snice-treemap.types.d.ts +42 -0
- package/dist/components/virtual-scroller/snice-virtual-scroller.d.ts +5 -0
- package/dist/components/virtual-scroller/snice-virtual-scroller.js +47 -16
- package/dist/components/virtual-scroller/snice-virtual-scroller.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +1 -1
- package/dist/index.iife.js.map +1 -1
- 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/docs/ai/components/camera-annotate.md +82 -0
- package/docs/ai/components/candlestick.md +79 -0
- package/docs/ai/components/funnel.md +86 -0
- package/docs/ai/components/network-graph.md +87 -0
- package/docs/ai/components/sankey.md +63 -0
- package/docs/ai/components/time-range-picker.md +78 -0
- package/docs/ai/components/treemap.md +78 -0
- package/docs/components/camera-annotate.md +186 -0
- package/docs/components/candlestick.md +196 -0
- package/docs/components/funnel.md +191 -0
- package/docs/components/network-graph.md +215 -0
- package/docs/components/sankey.md +201 -0
- package/docs/components/time-range-picker.md +213 -0
- package/docs/components/treemap.md +198 -0
- package/package.json +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Snice Treemap - CDN Build
|
|
2
|
+
|
|
3
|
+
CDN build of the Snice treemap component. Requires the Snice runtime (`snice-runtime.min.js`) to be loaded first.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<script src="snice-runtime.min.js"></script>
|
|
9
|
+
<script src="snice-treemap.min.js"></script>
|
|
10
|
+
<snice-treemap></snice-treemap>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Size
|
|
14
|
+
- Minified: 15.6 KB
|
|
15
|
+
- Gzipped: 5.2 KB
|
|
16
|
+
|
|
17
|
+
## Theme
|
|
18
|
+
For proper styling, link the Snice theme CSS:
|
|
19
|
+
```html
|
|
20
|
+
<link rel="stylesheet" href="https://unpkg.com/snice/dist/components/theme/theme.css">
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Documentation
|
|
24
|
+
https://snice.dev
|
|
25
|
+
|
|
26
|
+
## License
|
|
27
|
+
MIT
|
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* snice v4.8.0
|
|
3
|
+
* Imperative TypeScript framework for building vanilla web components with decorators, differential rendering, routing, and controllers. No virtual DOM, no build complexity.
|
|
4
|
+
* (c) 2024
|
|
5
|
+
* Released under the MIT License.
|
|
6
|
+
*/
|
|
7
|
+
if(typeof globalThis.Snice==="undefined"){console.warn("[snice] snice-runtime.min.js must be loaded before snice-treemap.min.js");}
|
|
8
|
+
var SniceTreemap = (function (exports, snice) {
|
|
9
|
+
'use strict';
|
|
10
|
+
|
|
11
|
+
/******************************************************************************
|
|
12
|
+
Copyright (c) Microsoft Corporation.
|
|
13
|
+
|
|
14
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
15
|
+
purpose with or without fee is hereby granted.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
18
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
19
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
20
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
21
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
22
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
23
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
24
|
+
***************************************************************************** */
|
|
25
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
29
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
30
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
31
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
32
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
33
|
+
var _, done = false;
|
|
34
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
35
|
+
var context = {};
|
|
36
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
37
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
38
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
39
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
40
|
+
if (kind === "accessor") {
|
|
41
|
+
if (result === void 0) continue;
|
|
42
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
43
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
44
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
45
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
46
|
+
}
|
|
47
|
+
else if (_ = accept(result)) {
|
|
48
|
+
if (kind === "field") initializers.unshift(_);
|
|
49
|
+
else descriptor[key] = _;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
53
|
+
done = true;
|
|
54
|
+
}
|
|
55
|
+
function __runInitializers(thisArg, initializers, value) {
|
|
56
|
+
var useValue = arguments.length > 2;
|
|
57
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
58
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
59
|
+
}
|
|
60
|
+
return useValue ? value : void 0;
|
|
61
|
+
}
|
|
62
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
63
|
+
var e = new Error(message);
|
|
64
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
var cssContent = ":host{display:block;font-family:var(--snice-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif);contain:layout style paint;width:100%}.treemap{position:relative;width:100%;overflow:hidden}.treemap__svg{display:block;width:100%;height:100%}.treemap__rect{cursor:pointer;transition:opacity var(--snice-transition-fast, 150ms) ease}.treemap__rect:hover{opacity:.85}.treemap__rect-stroke{fill:none;stroke:var(--snice-color-background,rgb(255 255 255));stroke-width:2px;pointer-events:none}.treemap__label{fill:rgb(255 255 255);font-family:var(--snice-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif);font-weight:var(--snice-font-weight-medium,500);pointer-events:none;text-anchor:middle;dominant-baseline:central}.treemap__value{fill:rgb(255 255 255 / 0.85);font-family:var(--snice-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif);font-weight:var(--snice-font-weight-medium,500);pointer-events:none;text-anchor:middle;dominant-baseline:central;font-size:.75rem}.treemap__breadcrumbs{display:flex;align-items:center;gap:var(--snice-spacing-2xs,.25rem);padding:var(--snice-spacing-xs,.5rem) 0;font-size:var(--snice-font-size-sm, .875rem);color:var(--snice-color-text-secondary,rgb(82 82 82));min-height:2rem}.treemap__breadcrumb{background:0 0;border:none;padding:var(--snice-spacing-3xs,.125rem) var(--snice-spacing-2xs,.25rem);font-family:inherit;font-size:inherit;color:var(--snice-color-primary,rgb(37 99 235));cursor:pointer;border-radius:var(--snice-border-radius-md,.25rem);transition:background var(--snice-transition-fast, 150ms) ease}.treemap__breadcrumb:hover{background:var(--snice-color-background-element,rgb(252 251 249))}.treemap__breadcrumb--current{color:var(--snice-color-text,rgb(23 23 23));cursor:default;font-weight:var(--snice-font-weight-semibold,600)}.treemap__breadcrumb--current:hover{background:0 0}.treemap__separator{color:var(--snice-color-text-tertiary,rgb(115 115 115));user-select:none}.treemap__tooltip{position:absolute;pointer-events:none;background:var(--snice-color-text,rgb(23 23 23));color:var(--snice-color-text-inverse,rgb(250 250 250));padding:var(--snice-spacing-2xs,.25rem) var(--snice-spacing-xs,.5rem);border-radius:var(--snice-border-radius-md,.25rem);font-size:.75rem;white-space:nowrap;z-index:10;opacity:0;transition:opacity var(--snice-transition-fast, 150ms) ease;box-shadow:var(--snice-shadow-md,0 4px 6px -1px rgb(0 0 0 / .1),0 2px 4px -2px rgb(0 0 0 / .1));transform:translate(-50%,-100%);margin-top:-.5rem}.treemap__tooltip--visible{opacity:1}:host([animation]) .treemap__rect{transition:x var(--snice-transition-medium, 250ms) ease,y var(--snice-transition-medium, 250ms) ease,width var(--snice-transition-medium, 250ms) ease,height var(--snice-transition-medium, 250ms) ease,opacity var(--snice-transition-fast, 150ms) ease}";
|
|
68
|
+
|
|
69
|
+
const COLOR_SCHEMES = {
|
|
70
|
+
default: ['#4e79a7', '#f28e2b', '#e15759', '#76b7b2', '#59a14f', '#edc948', '#b07aa1', '#ff9da7', '#9c755f', '#bab0ac'],
|
|
71
|
+
blue: ['#08519c', '#3182bd', '#6baed6', '#9ecae1', '#2171b5', '#4292c6', '#6baed6', '#c6dbef'],
|
|
72
|
+
green: ['#006d2c', '#31a354', '#74c476', '#a1d99b', '#238b45', '#41ab5d', '#74c476', '#c7e9c0'],
|
|
73
|
+
purple: ['#54278f', '#756bb1', '#9e9ac8', '#bcbddc', '#6a51a3', '#807dba', '#9e9ac8', '#dadaeb'],
|
|
74
|
+
orange: ['#d94701', '#fd8d3c', '#fdae6b', '#fdd0a2', '#e6550d', '#f16913', '#fd8d3c', '#fee6ce'],
|
|
75
|
+
warm: ['#b30000', '#e34a33', '#fc8d59', '#fdcc8a', '#d7301f', '#ef6548', '#fc8d59', '#fef0d9'],
|
|
76
|
+
cool: ['#016c59', '#1c9099', '#67a9cf', '#a6bddb', '#02818a', '#3690c0', '#67a9cf', '#d0d1e6'],
|
|
77
|
+
rainbow: ['#e41a1c', '#ff7f00', '#ffff33', '#4daf4a', '#377eb8', '#984ea3', '#a65628', '#f781bf'],
|
|
78
|
+
};
|
|
79
|
+
function sumValues(node) {
|
|
80
|
+
if (node.children && node.children.length > 0) {
|
|
81
|
+
return node.children.reduce((sum, child) => sum + sumValues(child), 0);
|
|
82
|
+
}
|
|
83
|
+
return Math.max(0, node.value);
|
|
84
|
+
}
|
|
85
|
+
function squarify(children, x, y, w, h, depth, colorOffset, padding) {
|
|
86
|
+
const totalValue = children.reduce((sum, c) => sum + sumValues(c), 0);
|
|
87
|
+
if (totalValue <= 0 || w <= 0 || h <= 0)
|
|
88
|
+
return [];
|
|
89
|
+
const sorted = [...children].sort((a, b) => sumValues(b) - sumValues(a));
|
|
90
|
+
const rects = [];
|
|
91
|
+
let remaining = sorted.slice();
|
|
92
|
+
let cx = x;
|
|
93
|
+
let cy = y;
|
|
94
|
+
let cw = w;
|
|
95
|
+
let ch = h;
|
|
96
|
+
while (remaining.length > 0) {
|
|
97
|
+
const isWide = cw >= ch;
|
|
98
|
+
const side = isWide ? ch : cw;
|
|
99
|
+
const totalRemaining = remaining.reduce((s, c) => s + sumValues(c), 0);
|
|
100
|
+
const row = [];
|
|
101
|
+
let rowSum = 0;
|
|
102
|
+
let worstRatio = Infinity;
|
|
103
|
+
for (const child of remaining) {
|
|
104
|
+
const childVal = sumValues(child);
|
|
105
|
+
const testSum = rowSum + childVal;
|
|
106
|
+
const testRow = [...row, child];
|
|
107
|
+
const rowArea = (testSum / totalRemaining) * (cw * ch);
|
|
108
|
+
const rowSide = rowArea / side;
|
|
109
|
+
let testWorst = 0;
|
|
110
|
+
for (const r of testRow) {
|
|
111
|
+
const rArea = (sumValues(r) / testSum) * rowArea;
|
|
112
|
+
const rSide = rArea / rowSide;
|
|
113
|
+
const ratio = Math.max(rSide / rowSide, rowSide / rSide);
|
|
114
|
+
testWorst = Math.max(testWorst, ratio);
|
|
115
|
+
}
|
|
116
|
+
if (testWorst <= worstRatio || row.length === 0) {
|
|
117
|
+
row.push(child);
|
|
118
|
+
rowSum = testSum;
|
|
119
|
+
worstRatio = testWorst;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
const rowArea = (rowSum / totalRemaining) * (cw * ch);
|
|
126
|
+
const rowSide = side > 0 ? rowArea / side : 0;
|
|
127
|
+
let offset = 0;
|
|
128
|
+
for (let i = 0; i < row.length; i++) {
|
|
129
|
+
const node = row[i];
|
|
130
|
+
const nodeVal = sumValues(node);
|
|
131
|
+
const nodeSize = rowSum > 0 ? (nodeVal / rowSum) * side : 0;
|
|
132
|
+
let rx, ry, rw, rh;
|
|
133
|
+
if (isWide) {
|
|
134
|
+
rx = cx;
|
|
135
|
+
ry = cy + offset;
|
|
136
|
+
rw = rowSide;
|
|
137
|
+
rh = nodeSize;
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
rx = cx + offset;
|
|
141
|
+
ry = cy;
|
|
142
|
+
rw = nodeSize;
|
|
143
|
+
rh = rowSide;
|
|
144
|
+
}
|
|
145
|
+
const colorIndex = colorOffset + rects.length + i;
|
|
146
|
+
const px = Math.min(padding, rw / 4);
|
|
147
|
+
const py = Math.min(padding, rh / 4);
|
|
148
|
+
rects.push({
|
|
149
|
+
x: rx + px,
|
|
150
|
+
y: ry + py,
|
|
151
|
+
width: Math.max(0, rw - px * 2),
|
|
152
|
+
height: Math.max(0, rh - py * 2),
|
|
153
|
+
node,
|
|
154
|
+
depth,
|
|
155
|
+
colorIndex,
|
|
156
|
+
});
|
|
157
|
+
offset += nodeSize;
|
|
158
|
+
}
|
|
159
|
+
if (isWide) {
|
|
160
|
+
cx += rowSide;
|
|
161
|
+
cw -= rowSide;
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
cy += rowSide;
|
|
165
|
+
ch -= rowSide;
|
|
166
|
+
}
|
|
167
|
+
remaining = remaining.slice(row.length);
|
|
168
|
+
}
|
|
169
|
+
return rects;
|
|
170
|
+
}
|
|
171
|
+
let SniceTreemap = (() => {
|
|
172
|
+
let _classDecorators = [snice.element('snice-treemap')];
|
|
173
|
+
let _classDescriptor;
|
|
174
|
+
let _classExtraInitializers = [];
|
|
175
|
+
let _classThis;
|
|
176
|
+
let _classSuper = HTMLElement;
|
|
177
|
+
let _instanceExtraInitializers = [];
|
|
178
|
+
let _data_decorators;
|
|
179
|
+
let _data_initializers = [];
|
|
180
|
+
let _data_extraInitializers = [];
|
|
181
|
+
let _showLabels_decorators;
|
|
182
|
+
let _showLabels_initializers = [];
|
|
183
|
+
let _showLabels_extraInitializers = [];
|
|
184
|
+
let _showValues_decorators;
|
|
185
|
+
let _showValues_initializers = [];
|
|
186
|
+
let _showValues_extraInitializers = [];
|
|
187
|
+
let _colorScheme_decorators;
|
|
188
|
+
let _colorScheme_initializers = [];
|
|
189
|
+
let _colorScheme_extraInitializers = [];
|
|
190
|
+
let _padding_decorators;
|
|
191
|
+
let _padding_initializers = [];
|
|
192
|
+
let _padding_extraInitializers = [];
|
|
193
|
+
let _animation_decorators;
|
|
194
|
+
let _animation_initializers = [];
|
|
195
|
+
let _animation_extraInitializers = [];
|
|
196
|
+
let _containerEl_decorators;
|
|
197
|
+
let _containerEl_initializers = [];
|
|
198
|
+
let _containerEl_extraInitializers = [];
|
|
199
|
+
let _chartEl_decorators;
|
|
200
|
+
let _chartEl_initializers = [];
|
|
201
|
+
let _chartEl_extraInitializers = [];
|
|
202
|
+
let _tooltipEl_decorators;
|
|
203
|
+
let _tooltipEl_initializers = [];
|
|
204
|
+
let _tooltipEl_extraInitializers = [];
|
|
205
|
+
let _breadcrumbsEl_decorators;
|
|
206
|
+
let _breadcrumbsEl_initializers = [];
|
|
207
|
+
let _breadcrumbsEl_extraInitializers = [];
|
|
208
|
+
let _emitClick_decorators;
|
|
209
|
+
let _emitHover_decorators;
|
|
210
|
+
let _emitDrill_decorators;
|
|
211
|
+
let _init_decorators;
|
|
212
|
+
let _onDataChange_decorators;
|
|
213
|
+
let _onDisplayChange_decorators;
|
|
214
|
+
let _cleanup_decorators;
|
|
215
|
+
let _renderContent_decorators;
|
|
216
|
+
let _componentStyles_decorators;
|
|
217
|
+
(class extends _classSuper {
|
|
218
|
+
static { _classThis = this; }
|
|
219
|
+
constructor() {
|
|
220
|
+
super(...arguments);
|
|
221
|
+
this.data = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _data_initializers, { label: '', value: 0 }));
|
|
222
|
+
this.showLabels = (__runInitializers(this, _data_extraInitializers), __runInitializers(this, _showLabels_initializers, true));
|
|
223
|
+
this.showValues = (__runInitializers(this, _showLabels_extraInitializers), __runInitializers(this, _showValues_initializers, false));
|
|
224
|
+
this.colorScheme = (__runInitializers(this, _showValues_extraInitializers), __runInitializers(this, _colorScheme_initializers, 'default'));
|
|
225
|
+
this.padding = (__runInitializers(this, _colorScheme_extraInitializers), __runInitializers(this, _padding_initializers, 2));
|
|
226
|
+
this.animation = (__runInitializers(this, _padding_extraInitializers), __runInitializers(this, _animation_initializers, true));
|
|
227
|
+
this.containerEl = (__runInitializers(this, _animation_extraInitializers), __runInitializers(this, _containerEl_initializers, void 0));
|
|
228
|
+
this.chartEl = (__runInitializers(this, _containerEl_extraInitializers), __runInitializers(this, _chartEl_initializers, void 0));
|
|
229
|
+
this.tooltipEl = (__runInitializers(this, _chartEl_extraInitializers), __runInitializers(this, _tooltipEl_initializers, void 0));
|
|
230
|
+
this.breadcrumbsEl = (__runInitializers(this, _tooltipEl_extraInitializers), __runInitializers(this, _breadcrumbsEl_initializers, void 0));
|
|
231
|
+
// Plain private fields — no @property, no re-renders
|
|
232
|
+
this._drillPathState = (__runInitializers(this, _breadcrumbsEl_extraInitializers), []);
|
|
233
|
+
this._tooltipText = '';
|
|
234
|
+
this._tooltipX = 0;
|
|
235
|
+
this._tooltipY = 0;
|
|
236
|
+
this._tooltipVisible = false;
|
|
237
|
+
this._width = 600;
|
|
238
|
+
this._height = 400;
|
|
239
|
+
this._resizeObserver = null;
|
|
240
|
+
this._rects = [];
|
|
241
|
+
this._cachedData = { label: '', value: 0 };
|
|
242
|
+
}
|
|
243
|
+
static {
|
|
244
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
245
|
+
_data_decorators = [snice.property({ type: Object, attribute: false })];
|
|
246
|
+
_showLabels_decorators = [snice.property({ type: Boolean, attribute: 'show-labels' })];
|
|
247
|
+
_showValues_decorators = [snice.property({ type: Boolean, attribute: 'show-values' })];
|
|
248
|
+
_colorScheme_decorators = [snice.property({ attribute: 'color-scheme' })];
|
|
249
|
+
_padding_decorators = [snice.property({ type: Number })];
|
|
250
|
+
_animation_decorators = [snice.property({ type: Boolean })];
|
|
251
|
+
_containerEl_decorators = [snice.query('.treemap')];
|
|
252
|
+
_chartEl_decorators = [snice.query('.treemap__chart')];
|
|
253
|
+
_tooltipEl_decorators = [snice.query('.treemap__tooltip')];
|
|
254
|
+
_breadcrumbsEl_decorators = [snice.query('.treemap__breadcrumbs')];
|
|
255
|
+
_emitClick_decorators = [snice.dispatch('treemap-click', { bubbles: true, composed: true })];
|
|
256
|
+
_emitHover_decorators = [snice.dispatch('treemap-hover', { bubbles: true, composed: true })];
|
|
257
|
+
_emitDrill_decorators = [snice.dispatch('treemap-drill', { bubbles: true, composed: true })];
|
|
258
|
+
_init_decorators = [snice.ready()];
|
|
259
|
+
_onDataChange_decorators = [snice.watch('data')];
|
|
260
|
+
_onDisplayChange_decorators = [snice.watch('showLabels', 'showValues', 'colorScheme', 'padding', 'animation')];
|
|
261
|
+
_cleanup_decorators = [snice.dispose()];
|
|
262
|
+
_renderContent_decorators = [snice.render({ once: true })];
|
|
263
|
+
_componentStyles_decorators = [snice.styles()];
|
|
264
|
+
__esDecorate(this, null, _emitClick_decorators, { kind: "method", name: "emitClick", static: false, private: false, access: { has: obj => "emitClick" in obj, get: obj => obj.emitClick }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
265
|
+
__esDecorate(this, null, _emitHover_decorators, { kind: "method", name: "emitHover", static: false, private: false, access: { has: obj => "emitHover" in obj, get: obj => obj.emitHover }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
266
|
+
__esDecorate(this, null, _emitDrill_decorators, { kind: "method", name: "emitDrill", static: false, private: false, access: { has: obj => "emitDrill" in obj, get: obj => obj.emitDrill }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
267
|
+
__esDecorate(this, null, _init_decorators, { kind: "method", name: "init", static: false, private: false, access: { has: obj => "init" in obj, get: obj => obj.init }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
268
|
+
__esDecorate(this, null, _onDataChange_decorators, { kind: "method", name: "onDataChange", static: false, private: false, access: { has: obj => "onDataChange" in obj, get: obj => obj.onDataChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
269
|
+
__esDecorate(this, null, _onDisplayChange_decorators, { kind: "method", name: "onDisplayChange", static: false, private: false, access: { has: obj => "onDisplayChange" in obj, get: obj => obj.onDisplayChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
270
|
+
__esDecorate(this, null, _cleanup_decorators, { kind: "method", name: "cleanup", static: false, private: false, access: { has: obj => "cleanup" in obj, get: obj => obj.cleanup }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
271
|
+
__esDecorate(this, null, _renderContent_decorators, { kind: "method", name: "renderContent", static: false, private: false, access: { has: obj => "renderContent" in obj, get: obj => obj.renderContent }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
272
|
+
__esDecorate(this, null, _componentStyles_decorators, { kind: "method", name: "componentStyles", static: false, private: false, access: { has: obj => "componentStyles" in obj, get: obj => obj.componentStyles }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
273
|
+
__esDecorate(null, null, _data_decorators, { kind: "field", name: "data", static: false, private: false, access: { has: obj => "data" in obj, get: obj => obj.data, set: (obj, value) => { obj.data = value; } }, metadata: _metadata }, _data_initializers, _data_extraInitializers);
|
|
274
|
+
__esDecorate(null, null, _showLabels_decorators, { kind: "field", name: "showLabels", static: false, private: false, access: { has: obj => "showLabels" in obj, get: obj => obj.showLabels, set: (obj, value) => { obj.showLabels = value; } }, metadata: _metadata }, _showLabels_initializers, _showLabels_extraInitializers);
|
|
275
|
+
__esDecorate(null, null, _showValues_decorators, { kind: "field", name: "showValues", static: false, private: false, access: { has: obj => "showValues" in obj, get: obj => obj.showValues, set: (obj, value) => { obj.showValues = value; } }, metadata: _metadata }, _showValues_initializers, _showValues_extraInitializers);
|
|
276
|
+
__esDecorate(null, null, _colorScheme_decorators, { kind: "field", name: "colorScheme", static: false, private: false, access: { has: obj => "colorScheme" in obj, get: obj => obj.colorScheme, set: (obj, value) => { obj.colorScheme = value; } }, metadata: _metadata }, _colorScheme_initializers, _colorScheme_extraInitializers);
|
|
277
|
+
__esDecorate(null, null, _padding_decorators, { kind: "field", name: "padding", static: false, private: false, access: { has: obj => "padding" in obj, get: obj => obj.padding, set: (obj, value) => { obj.padding = value; } }, metadata: _metadata }, _padding_initializers, _padding_extraInitializers);
|
|
278
|
+
__esDecorate(null, null, _animation_decorators, { kind: "field", name: "animation", static: false, private: false, access: { has: obj => "animation" in obj, get: obj => obj.animation, set: (obj, value) => { obj.animation = value; } }, metadata: _metadata }, _animation_initializers, _animation_extraInitializers);
|
|
279
|
+
__esDecorate(null, null, _containerEl_decorators, { kind: "field", name: "containerEl", static: false, private: false, access: { has: obj => "containerEl" in obj, get: obj => obj.containerEl, set: (obj, value) => { obj.containerEl = value; } }, metadata: _metadata }, _containerEl_initializers, _containerEl_extraInitializers);
|
|
280
|
+
__esDecorate(null, null, _chartEl_decorators, { kind: "field", name: "chartEl", static: false, private: false, access: { has: obj => "chartEl" in obj, get: obj => obj.chartEl, set: (obj, value) => { obj.chartEl = value; } }, metadata: _metadata }, _chartEl_initializers, _chartEl_extraInitializers);
|
|
281
|
+
__esDecorate(null, null, _tooltipEl_decorators, { kind: "field", name: "tooltipEl", static: false, private: false, access: { has: obj => "tooltipEl" in obj, get: obj => obj.tooltipEl, set: (obj, value) => { obj.tooltipEl = value; } }, metadata: _metadata }, _tooltipEl_initializers, _tooltipEl_extraInitializers);
|
|
282
|
+
__esDecorate(null, null, _breadcrumbsEl_decorators, { kind: "field", name: "breadcrumbsEl", static: false, private: false, access: { has: obj => "breadcrumbsEl" in obj, get: obj => obj.breadcrumbsEl, set: (obj, value) => { obj.breadcrumbsEl = value; } }, metadata: _metadata }, _breadcrumbsEl_initializers, _breadcrumbsEl_extraInitializers);
|
|
283
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
284
|
+
_classThis = _classDescriptor.value;
|
|
285
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
286
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
287
|
+
}
|
|
288
|
+
get drillPath() {
|
|
289
|
+
return this._drillPathState;
|
|
290
|
+
}
|
|
291
|
+
emitClick(node, depth) {
|
|
292
|
+
return { node, depth };
|
|
293
|
+
}
|
|
294
|
+
emitHover(detail) {
|
|
295
|
+
return detail;
|
|
296
|
+
}
|
|
297
|
+
emitDrill(node, path) {
|
|
298
|
+
return { node, path };
|
|
299
|
+
}
|
|
300
|
+
init() {
|
|
301
|
+
this._cachedData = this.data;
|
|
302
|
+
this._resizeObserver = new ResizeObserver((entries) => {
|
|
303
|
+
for (const entry of entries) {
|
|
304
|
+
const cr = entry.contentRect;
|
|
305
|
+
if (cr.width > 0 && cr.height > 0) {
|
|
306
|
+
this._width = cr.width;
|
|
307
|
+
this._height = cr.height;
|
|
308
|
+
}
|
|
309
|
+
else if (cr.width > 0) {
|
|
310
|
+
this._width = cr.width;
|
|
311
|
+
this._height = cr.width * 0.667;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
this.rebuildChart();
|
|
315
|
+
});
|
|
316
|
+
this._resizeObserver.observe(this);
|
|
317
|
+
this.rebuildChart();
|
|
318
|
+
}
|
|
319
|
+
onDataChange() {
|
|
320
|
+
this._cachedData = this.data;
|
|
321
|
+
this._drillPathState = [];
|
|
322
|
+
this.rebuildChart();
|
|
323
|
+
}
|
|
324
|
+
onDisplayChange() {
|
|
325
|
+
this.rebuildChart();
|
|
326
|
+
}
|
|
327
|
+
cleanup() {
|
|
328
|
+
this._resizeObserver?.disconnect();
|
|
329
|
+
this._resizeObserver = null;
|
|
330
|
+
}
|
|
331
|
+
drillDown(node) {
|
|
332
|
+
if (node.children && node.children.length > 0) {
|
|
333
|
+
this._drillPathState = [...this._drillPathState, node];
|
|
334
|
+
this.emitDrill(node, this._drillPathState);
|
|
335
|
+
this.rebuildChart();
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
drillUp() {
|
|
339
|
+
if (this._drillPathState.length > 0) {
|
|
340
|
+
this._drillPathState = this._drillPathState.slice(0, -1);
|
|
341
|
+
const current = this._drillPathState.length > 0
|
|
342
|
+
? this._drillPathState[this._drillPathState.length - 1]
|
|
343
|
+
: this._cachedData;
|
|
344
|
+
this.emitDrill(current, this._drillPathState);
|
|
345
|
+
this.rebuildChart();
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
drillToRoot() {
|
|
349
|
+
this._drillPathState = [];
|
|
350
|
+
this.emitDrill(this._cachedData, []);
|
|
351
|
+
this.rebuildChart();
|
|
352
|
+
}
|
|
353
|
+
getCurrentNode() {
|
|
354
|
+
if (this._drillPathState.length > 0) {
|
|
355
|
+
return this._drillPathState[this._drillPathState.length - 1];
|
|
356
|
+
}
|
|
357
|
+
return this._cachedData;
|
|
358
|
+
}
|
|
359
|
+
getColor(index) {
|
|
360
|
+
const colors = COLOR_SCHEMES[this.colorScheme] || COLOR_SCHEMES.default;
|
|
361
|
+
return colors[index % colors.length];
|
|
362
|
+
}
|
|
363
|
+
computeRects() {
|
|
364
|
+
const current = this.getCurrentNode();
|
|
365
|
+
const children = current.children;
|
|
366
|
+
if (!children || children.length === 0)
|
|
367
|
+
return [];
|
|
368
|
+
return squarify(children, 0, 0, this._width, this._height, 0, 0, this.padding);
|
|
369
|
+
}
|
|
370
|
+
canFitLabel(rect) {
|
|
371
|
+
return rect.width > 30 && rect.height > 16;
|
|
372
|
+
}
|
|
373
|
+
canFitValue(rect) {
|
|
374
|
+
return rect.width > 30 && rect.height > 30;
|
|
375
|
+
}
|
|
376
|
+
getLabelFontSize(rect) {
|
|
377
|
+
const maxByWidth = rect.width / 8;
|
|
378
|
+
const maxByHeight = rect.height / 3;
|
|
379
|
+
return Math.min(Math.max(Math.min(maxByWidth, maxByHeight), 8), 16);
|
|
380
|
+
}
|
|
381
|
+
/** Rebuild the entire SVG chart via innerHTML on the chart container */
|
|
382
|
+
rebuildChart() {
|
|
383
|
+
if (!this.chartEl) {
|
|
384
|
+
requestAnimationFrame(() => this.rebuildChart());
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
this._rects = this.computeRects();
|
|
388
|
+
let svg = '';
|
|
389
|
+
svg += `<svg class="treemap__svg" viewBox="0 0 ${this._width} ${this._height}" preserveAspectRatio="none">`;
|
|
390
|
+
for (let i = 0; i < this._rects.length; i++) {
|
|
391
|
+
svg += this.buildRectGroup(this._rects[i], i);
|
|
392
|
+
}
|
|
393
|
+
svg += '</svg>';
|
|
394
|
+
this.chartEl.innerHTML = svg;
|
|
395
|
+
// Attach event listeners to rects
|
|
396
|
+
const rectEls = this.chartEl.querySelectorAll('.treemap__rect');
|
|
397
|
+
rectEls.forEach((el) => {
|
|
398
|
+
const index = Number(el.dataset.index);
|
|
399
|
+
const rect = this._rects[index];
|
|
400
|
+
if (!rect)
|
|
401
|
+
return;
|
|
402
|
+
el.addEventListener('click', (e) => {
|
|
403
|
+
e.stopPropagation();
|
|
404
|
+
this.emitClick(rect.node, rect.depth);
|
|
405
|
+
if (rect.node.children && rect.node.children.length > 0) {
|
|
406
|
+
this.drillDown(rect.node);
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
el.addEventListener('mouseenter', () => {
|
|
410
|
+
this._tooltipText = `${rect.node.label}: ${sumValues(rect.node).toLocaleString()}`;
|
|
411
|
+
this._tooltipX = rect.x + rect.width / 2;
|
|
412
|
+
this._tooltipY = rect.y;
|
|
413
|
+
this._tooltipVisible = true;
|
|
414
|
+
this.updateTooltipDOM();
|
|
415
|
+
this.emitHover({ node: rect.node, depth: rect.depth });
|
|
416
|
+
});
|
|
417
|
+
el.addEventListener('mouseleave', () => {
|
|
418
|
+
this._tooltipVisible = false;
|
|
419
|
+
this.updateTooltipDOM();
|
|
420
|
+
this.emitHover(null);
|
|
421
|
+
});
|
|
422
|
+
});
|
|
423
|
+
this.rebuildBreadcrumbs();
|
|
424
|
+
}
|
|
425
|
+
buildRectGroup(rect, index) {
|
|
426
|
+
const color = rect.node.color || this.getColor(rect.colorIndex);
|
|
427
|
+
const showLabel = this.showLabels && this.canFitLabel(rect);
|
|
428
|
+
const showValue = this.showValues && this.canFitValue(rect);
|
|
429
|
+
const fontSize = this.getLabelFontSize(rect);
|
|
430
|
+
const cx = rect.x + rect.width / 2;
|
|
431
|
+
const labelY = showValue ? rect.y + rect.height / 2 - fontSize * 0.4 : rect.y + rect.height / 2;
|
|
432
|
+
const valueY = showLabel ? rect.y + rect.height / 2 + fontSize * 0.8 : rect.y + rect.height / 2;
|
|
433
|
+
let parts = '';
|
|
434
|
+
parts += `<rect class="treemap__rect" data-index="${index}" x="${rect.x}" y="${rect.y}" width="${rect.width}" height="${rect.height}" fill="${color}" />`;
|
|
435
|
+
parts += `<rect class="treemap__rect-stroke" x="${rect.x}" y="${rect.y}" width="${rect.width}" height="${rect.height}" />`;
|
|
436
|
+
if (showLabel) {
|
|
437
|
+
parts += `<text class="treemap__label" x="${cx}" y="${labelY}" style="font-size: ${fontSize}px">${rect.node.label}</text>`;
|
|
438
|
+
}
|
|
439
|
+
if (showValue) {
|
|
440
|
+
parts += `<text class="treemap__value" x="${cx}" y="${valueY}">${sumValues(rect.node).toLocaleString()}</text>`;
|
|
441
|
+
}
|
|
442
|
+
return parts;
|
|
443
|
+
}
|
|
444
|
+
/** Update tooltip element directly */
|
|
445
|
+
updateTooltipDOM() {
|
|
446
|
+
const tooltip = this.tooltipEl;
|
|
447
|
+
if (!tooltip)
|
|
448
|
+
return;
|
|
449
|
+
if (!this._tooltipVisible) {
|
|
450
|
+
tooltip.classList.remove('treemap__tooltip--visible');
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
const tooltipLeft = `${(this._tooltipX / this._width) * 100}%`;
|
|
454
|
+
const tooltipTop = `${(this._tooltipY / this._height) * 100}%`;
|
|
455
|
+
tooltip.style.left = tooltipLeft;
|
|
456
|
+
tooltip.style.top = tooltipTop;
|
|
457
|
+
tooltip.textContent = this._tooltipText;
|
|
458
|
+
tooltip.classList.add('treemap__tooltip--visible');
|
|
459
|
+
}
|
|
460
|
+
/** Rebuild breadcrumbs via innerHTML */
|
|
461
|
+
rebuildBreadcrumbs() {
|
|
462
|
+
const el = this.breadcrumbsEl;
|
|
463
|
+
if (!el)
|
|
464
|
+
return;
|
|
465
|
+
if (this._drillPathState.length === 0) {
|
|
466
|
+
el.innerHTML = '';
|
|
467
|
+
el.style.display = 'none';
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
el.style.display = '';
|
|
471
|
+
let html = '';
|
|
472
|
+
html += `<button class="treemap__breadcrumb" data-drill-root>${this._cachedData.label || 'Root'}</button>`;
|
|
473
|
+
for (let i = 0; i < this._drillPathState.length; i++) {
|
|
474
|
+
const node = this._drillPathState[i];
|
|
475
|
+
const isLast = i === this._drillPathState.length - 1;
|
|
476
|
+
html += '<span class="treemap__separator">/</span>';
|
|
477
|
+
if (isLast) {
|
|
478
|
+
html += `<span class="treemap__breadcrumb treemap__breadcrumb--current">${node.label}</span>`;
|
|
479
|
+
}
|
|
480
|
+
else {
|
|
481
|
+
html += `<button class="treemap__breadcrumb" data-drill-index="${i}">${node.label}</button>`;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
el.innerHTML = html;
|
|
485
|
+
// Attach breadcrumb event listeners
|
|
486
|
+
const rootBtn = el.querySelector('[data-drill-root]');
|
|
487
|
+
if (rootBtn) {
|
|
488
|
+
rootBtn.addEventListener('click', () => this.drillToRoot());
|
|
489
|
+
}
|
|
490
|
+
el.querySelectorAll('[data-drill-index]').forEach((btn) => {
|
|
491
|
+
const idx = Number(btn.dataset.drillIndex);
|
|
492
|
+
btn.addEventListener('click', () => {
|
|
493
|
+
const node = this._drillPathState[idx];
|
|
494
|
+
this._drillPathState = this._drillPathState.slice(0, idx + 1);
|
|
495
|
+
this.emitDrill(node, this._drillPathState);
|
|
496
|
+
this.rebuildChart();
|
|
497
|
+
});
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
renderContent() {
|
|
501
|
+
const dataLabel = this._cachedData?.label || 'Treemap';
|
|
502
|
+
return snice.html /*html*/ `
|
|
503
|
+
<div class="treemap__breadcrumbs" style="display: none"></div>
|
|
504
|
+
<div class="treemap" role="img" aria-label="${dataLabel}">
|
|
505
|
+
<div class="treemap__chart"></div>
|
|
506
|
+
<div class="treemap__tooltip"></div>
|
|
507
|
+
</div>
|
|
508
|
+
`;
|
|
509
|
+
}
|
|
510
|
+
componentStyles() {
|
|
511
|
+
return snice.css /*css*/ `${cssContent}`;
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
return _classThis;
|
|
515
|
+
})();
|
|
516
|
+
|
|
517
|
+
exports.SniceTreemap = SniceTreemap;
|
|
518
|
+
|
|
519
|
+
return exports;
|
|
520
|
+
|
|
521
|
+
})({}, Snice);
|
|
522
|
+
//# sourceMappingURL=snice-treemap.js.map
|