@fusion.dev/helix 0.145.0 → 0.147.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/custom-elements.json +13218 -3717
- package/dist/accordion/item/accordion-item.css.js +4 -92
- package/dist/accordion/item/accordion-item.d.ts +8 -0
- package/dist/accordion/root/accordion-root.css.js +2 -28
- package/dist/announcement/root/announcement-root.css.js +10 -154
- package/dist/announcement/root/announcement-root.d.ts +3 -0
- package/dist/app-header/root/app-header-root.css.js +2 -118
- package/dist/area-chart/root/area-chart-root.css.js +4 -94
- package/dist/area-chart/root/area-chart-root.d.ts +1 -0
- package/dist/aura/root/aura-root.css.js +2 -54
- package/dist/aura/root/aura-root.d.ts +21 -9
- package/dist/aura/root/aura-root.js +23 -12
- package/dist/avatar/group/avatar-group.css.js +5 -36
- package/dist/avatar/group/avatar-group.d.ts +3 -0
- package/dist/avatar/root/avatar-root.css.js +1 -53
- package/dist/avatar/root/avatar-root.d.ts +2 -0
- package/dist/badge/root/badge-root.css.js +17 -142
- package/dist/badge/root/badge-root.d.ts +20 -0
- package/dist/badge/root/badge-root.js +6 -0
- package/dist/bar-chart/root/bar-chart-root.css.js +8 -292
- package/dist/blockquote/root/blockquote-root.css.js +1 -43
- package/dist/blockquote/root/blockquote-root.d.ts +2 -0
- package/dist/breadcrumbs/breadcrumb/breadcrumb.css.js +13 -98
- package/dist/breadcrumbs/root/breadcrumbs-root.css.js +7 -21
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +18 -0
- package/dist/breadcrumbs/root/breadcrumbs-root.js +4 -0
- package/dist/button/root/button-root.css.js +16 -196
- package/dist/button/root/button-root.d.ts +3 -0
- package/dist/button-group/root/button-group-root.css.js +2 -52
- package/dist/callout/root/callout-root.css.js +5 -137
- package/dist/callout/root/callout-root.d.ts +8 -2
- package/dist/canvas/node/canvas-node.css.js +10 -367
- package/dist/canvas/root/canvas-root.css.js +7 -270
- package/dist/card/root/card-root.css.js +5 -134
- package/dist/card/root/card-root.d.ts +6 -0
- package/dist/carousel/root/carousel-root.css.js +20 -386
- package/dist/chat/composer/chat-composer.css.js +4 -105
- package/dist/chat/message/chat-message.css.js +5 -301
- package/dist/chat/message/chat-message.d.ts +5 -0
- package/dist/chat/message/chat-message.js +2 -1
- package/dist/chat/root/chat-root.css.js +5 -155
- package/dist/chat/root/chat-root.d.ts +2 -0
- package/dist/chat/root/chat-root.js +2 -1
- package/dist/chat/typing.css.d.ts +1 -0
- package/dist/chat/typing.css.js +25 -0
- package/dist/checkbox/root/checkbox-root.css.js +12 -162
- package/dist/checkbox/root/checkbox-root.d.ts +2 -1
- package/dist/checkbox-group/root/checkbox-group-root.css.js +1 -27
- package/dist/code/root/code-root.css.js +3 -25
- package/dist/code/root/code-root.d.ts +2 -0
- package/dist/code-block/root/code-block-root.css.js +9 -250
- package/dist/code-block/root/code-block-root.d.ts +2 -1
- package/dist/color-input/root/color-input-root.css.js +5 -104
- package/dist/color-picker/root/color-picker-root.css.js +39 -329
- package/dist/color-picker/root/color-picker-root.d.ts +3 -0
- package/dist/combobox/root/combobox-root.css.js +8 -147
- package/dist/command/root/command-root.css.js +3 -74
- package/dist/copy-button/root/copy-button-root.css.js +5 -36
- package/dist/copy-button/root/copy-button-root.d.ts +7 -0
- package/dist/data-table/root/data-table-root.css.js +24 -241
- package/dist/data-table/root/data-table-root.d.ts +12 -0
- package/dist/date-input/root/date-input-root.css.js +8 -93
- package/dist/date-picker/root/date-picker-root.css.js +16 -278
- package/dist/date-picker/root/date-picker-root.d.ts +1 -0
- package/dist/description-list/item/description-list-item.css.js +1 -41
- package/dist/description-list/item/description-list-item.d.ts +7 -0
- package/dist/description-list/root/description-list-root.css.js +1 -34
- package/dist/description-list/root/description-list-root.d.ts +1 -0
- package/dist/dialog/root/dialog-root.css.js +7 -221
- package/dist/dialog/root/dialog-root.d.ts +3 -0
- package/dist/divider/root/divider-root.css.js +6 -81
- package/dist/donut-chart/root/donut-chart-root.css.js +7 -174
- package/dist/donut-chart/root/donut-chart-root.d.ts +3 -0
- package/dist/drawer/root/drawer-root.css.js +14 -193
- package/dist/drawer/root/drawer-root.d.ts +5 -0
- package/dist/drilldown/item/drilldown-item.css.js +4 -51
- package/dist/drilldown/item/drilldown-item.d.ts +7 -0
- package/dist/drilldown/root/drilldown-root.css.js +8 -109
- package/dist/drilldown/root/drilldown-root.d.ts +10 -0
- package/dist/element-events.generated.js +19 -6
- package/dist/empty/root/empty-root.css.js +2 -42
- package/dist/file-input/root/file-input-root.css.js +7 -172
- package/dist/file-input/root/file-input-root.d.ts +15 -0
- package/dist/filter-input/chip/filter-chip.css.js +2 -84
- package/dist/filter-input/field/filter-field.css.js +1 -3
- package/dist/filter-input/menu/filter-menu.css.js +1 -3
- package/dist/filter-input/operator/filter-operator.css.js +1 -3
- package/dist/filter-input/root/filter-input-root.css.js +6 -112
- package/dist/filter-input/root/filter-input-root.d.ts +5 -0
- package/dist/flex/root/flex-root.css.js +4 -198
- package/dist/flex/root/flex-root.d.ts +19 -8
- package/dist/format-date/root/format-date-root.css.js +1 -13
- package/dist/graph/root/graph-root.css.js +12 -444
- package/dist/graph/root/graph-root.d.ts +8 -0
- package/dist/grid/root/grid-root.css.js +1 -171
- package/dist/grid/root/grid-root.d.ts +4 -1
- package/dist/heatmap/root/heatmap-root.css.js +8 -155
- package/dist/heatmap/root/heatmap-root.d.ts +2 -0
- package/dist/icon/index.d.ts +1 -1
- package/dist/icon/root/icon-root.css.js +1 -18
- package/dist/icon/root/index.d.ts +1 -1
- package/dist/icon-button/root/icon-button-root.css.js +63 -186
- package/dist/icon-button/root/icon-button-root.d.ts +5 -0
- package/dist/image/root/image-root.css.js +7 -65
- package/dist/image/root/image-root.d.ts +3 -0
- package/dist/input/root/input-root.css.js +6 -79
- package/dist/kbd/root/kbd-root.css.js +2 -44
- package/dist/kbd/root/kbd-root.d.ts +9 -0
- package/dist/legend/root/legend-root.css.js +9 -106
- package/dist/legend/root/legend-root.d.ts +2 -0
- package/dist/lightbox/item/lightbox-item.css.js +1 -33
- package/dist/lightbox/root/lightbox-root.css.js +40 -144
- package/dist/line-chart/root/line-chart-root.css.js +4 -154
- package/dist/line-chart/root/line-chart-root.d.ts +3 -0
- package/dist/list/item/list-item.css.js +2 -94
- package/dist/list/root/list-root.css.js +4 -88
- package/dist/listbox/root/listbox-root.css.js +4 -102
- package/dist/listbox/root/listbox-root.d.ts +1 -0
- package/dist/loader/root/loader-root.css.js +5 -171
- package/dist/loader/root/loader-root.d.ts +2 -0
- package/dist/map/area/map-area.css.js +1 -23
- package/dist/map/buildings/map-buildings.css.js +1 -26
- package/dist/map/contours/map-contours.css.js +2 -5
- package/dist/map/landcover/map-landcover.css.js +1 -4
- package/dist/map/marker/map-marker.css.js +14 -327
- package/dist/map/points/map-points.css.js +1 -86
- package/dist/map/position/map-position.css.js +8 -227
- package/dist/map/raster/map-raster.css.js +1 -3
- package/dist/map/root/map-root.css.js +10 -352
- package/dist/map/route/map-route.css.js +1 -24
- package/dist/map/terrain/map-terrain.css.js +3 -7
- package/dist/megamenu/root/megamenu-root.css.js +15 -163
- package/dist/megamenu/root/megamenu-root.d.ts +19 -0
- package/dist/menu/item/menu-item.css.js +9 -111
- package/dist/menu/item/menu-item.d.ts +1 -0
- package/dist/menu/root/menu-root.css.js +1 -110
- package/dist/menu/section/menu-section.css.js +1 -13
- package/dist/meter/root/meter-root.css.js +20 -207
- package/dist/meter/root/meter-root.d.ts +4 -0
- package/dist/navigation/root/navigation-root.css.js +2 -54
- package/dist/navigation/root/navigation-root.d.ts +7 -0
- package/dist/notifications/group/notification-group.css.js +1 -61
- package/dist/notifications/notification/notification.css.js +17 -264
- package/dist/notifications/root/notifications-root.css.js +7 -119
- package/dist/notifications/root/notifications-root.d.ts +3 -1
- package/dist/number-input/root/number-input-root.css.js +10 -100
- package/dist/number-input/root/number-input-root.d.ts +8 -0
- package/dist/object-inspector/root/object-inspector-root.css.js +11 -166
- package/dist/option/group/option-group.css.js +1 -22
- package/dist/option/index.d.ts +1 -0
- package/dist/option/index.js +1 -0
- package/dist/option/root/option-root.css.js +3 -85
- package/dist/option/separator/option-separator.css.d.ts +1 -0
- package/dist/option/separator/option-separator.css.js +3 -0
- package/dist/option/separator/option-separator.d.ts +26 -0
- package/dist/option/separator/option-separator.js +16 -0
- package/dist/orb/root/orb-root.css.js +1 -41
- package/dist/orb/root/orb-root.d.ts +14 -6
- package/dist/orb/root/orb-root.js +16 -27
- package/dist/outline/root/outline-root.css.js +24 -122
- package/dist/outline/root/outline-root.d.ts +17 -4
- package/dist/pagination/root/pagination-root.css.js +9 -105
- package/dist/pagination/size/pagination-size.css.js +1 -22
- package/dist/pagination/summary/pagination-summary.css.js +1 -7
- package/dist/pin-input/root/pin-input-root.css.js +2 -73
- package/dist/pin-input/root/pin-input-root.d.ts +12 -2
- package/dist/popover/root/popover-root.css.js +6 -127
- package/dist/progress/root/progress-root.css.js +7 -228
- package/dist/progress/root/progress-root.d.ts +5 -0
- package/dist/qr-code/root/qr-code-root.css.js +1 -57
- package/dist/quote/root/quote-root.css.js +1 -17
- package/dist/quote/root/quote-root.d.ts +2 -0
- package/dist/radio/group/radio-group.css.js +1 -21
- package/dist/radio/root/radio-root.css.js +5 -192
- package/dist/radio/root/radio-root.d.ts +2 -1
- package/dist/rating/root/rating-root.css.js +4 -117
- package/dist/sandbox/frame.d.ts +5 -3
- package/dist/sandbox/frame.js +20 -6
- package/dist/sandbox/index.d.ts +1 -0
- package/dist/sandbox/preview/sandbox-preview.css.js +1 -12
- package/dist/sandbox/preview/sandbox-preview.d.ts +19 -3
- package/dist/sandbox/preview/sandbox-preview.js +17 -11
- package/dist/sandbox/root/sandbox-root.css.js +3 -70
- package/dist/sandbox/root/sandbox-root.d.ts +16 -4
- package/dist/sandbox/root/sandbox-root.js +29 -50
- package/dist/sandbox/source/sandbox-source.css.js +3 -25
- package/dist/sandbox/source/sandbox-source.d.ts +40 -0
- package/dist/sandbox/source/sandbox-source.js +22 -0
- package/dist/sandbox/status-bar/sandbox-status-bar.css.js +1 -21
- package/dist/sandbox/terminal/sandbox-terminal.css.js +5 -106
- package/dist/sandbox/terminal/sandbox-terminal.d.ts +14 -2
- package/dist/sandbox/terminal/sandbox-terminal.js +20 -6
- package/dist/sandbox/tokens.d.ts +39 -0
- package/dist/sandbox/tokens.js +9 -0
- package/dist/sandbox/toolbar/sandbox-toolbar.css.js +1 -36
- package/dist/scatter-chart/root/scatter-chart-root.css.js +11 -137
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +3 -0
- package/dist/scroll-area/root/scroll-area-root.css.js +14 -181
- package/dist/select/root/select-root.css.js +4 -124
- package/dist/shared/chart/series.css.js +1 -36
- package/dist/shared/chart/terminus.css.js +1 -47
- package/dist/shared/chart/tooltip.css.js +1 -68
- package/dist/shared/collection/state.css.js +1 -9
- package/dist/shared/field/field-frame.css.js +3 -33
- package/dist/shared/field/field-inline.css.js +1 -4
- package/dist/shared/field/field-segments.css.js +1 -39
- package/dist/shared/field/field-stacked.css.js +1 -5
- package/dist/shared/field/field.css.js +3 -57
- package/dist/shared/floating/entrance.css.js +3 -34
- package/dist/shared/floating/panel.css.js +2 -17
- package/dist/shared/glyph/glyph.css.js +1 -5
- package/dist/shared/live/live.css.js +1 -8
- package/dist/shared/tags/tags.css.js +1 -39
- package/dist/shared/viewport/viewport.css.js +8 -135
- package/dist/skeleton/root/skeleton-root.css.js +12 -120
- package/dist/skeleton/root/skeleton-root.d.ts +1 -0
- package/dist/skip-link/root/skip-link-root.css.js +2 -35
- package/dist/skip-link/root/skip-link-root.d.ts +3 -3
- package/dist/slider/root/slider-root.css.js +35 -320
- package/dist/slider/root/slider-root.d.ts +2 -0
- package/dist/sparkline/root/sparkline-root.css.js +10 -96
- package/dist/sparkline/root/sparkline-root.d.ts +8 -0
- package/dist/sparkline/root/sparkline-root.js +2 -1
- package/dist/speed-dial/item/speed-dial-item.css.js +6 -74
- package/dist/speed-dial/item/speed-dial-item.d.ts +3 -0
- package/dist/speed-dial/root/speed-dial-root.css.js +3 -144
- package/dist/speed-dial/root/speed-dial-root.d.ts +7 -1
- package/dist/speed-dial/root/speed-dial-root.js +0 -1
- package/dist/splitter/root/splitter-root.css.js +11 -176
- package/dist/stat/group/stat-group.css.js +1 -36
- package/dist/stat/root/stat-root.css.js +3 -58
- package/dist/steps/root/steps-root.css.js +13 -70
- package/dist/steps/root/steps-root.d.ts +5 -0
- package/dist/steps/step/step.css.js +5 -156
- package/dist/switch/root/switch-root.css.js +2 -110
- package/dist/table/cell/table-cell.css.js +1 -33
- package/dist/table/column/table-column.css.js +7 -105
- package/dist/table/root/table-root.css.js +1 -43
- package/dist/table/row/table-row.css.js +6 -18
- package/dist/table/row/table-row.d.ts +2 -0
- package/dist/tabs/panel/tab-panel.css.js +2 -17
- package/dist/tabs/root/tabs-root.css.js +6 -177
- package/dist/tabs/root/tabs-root.d.ts +4 -0
- package/dist/tabs/tab/tab.css.js +10 -51
- package/dist/tabs/tab/tab.d.ts +7 -0
- package/dist/tag/group/tag-group.css.js +1 -5
- package/dist/tag/root/tag-root.css.js +1 -166
- package/dist/tag/root/tag-root.d.ts +2 -0
- package/dist/text/clamp.d.ts +5 -2
- package/dist/text/clamp.js +3 -1
- package/dist/text/root/text-root.css.js +11 -206
- package/dist/text/root/text-root.d.ts +2 -1
- package/dist/textarea/root/textarea-root.css.js +3 -44
- package/dist/time-input/root/time-input-root.css.js +7 -106
- package/dist/time-picker/root/time-picker-root.css.js +10 -134
- package/dist/time-picker/root/time-picker-root.d.ts +1 -0
- package/dist/timeline/group/timeline-group.css.js +1 -31
- package/dist/timeline/item/timeline-item.css.js +3 -134
- package/dist/timeline/root/timeline-root.css.js +1 -66
- package/dist/toast/item/toast-item.css.js +8 -240
- package/dist/toast/root/toast-root.css.js +1 -85
- package/dist/toast/root/toast-root.d.ts +1 -0
- package/dist/toast/root/toast-root.js +3 -1
- package/dist/toggle/group/toggle-group.css.js +9 -125
- package/dist/toggle/group/toggle-group.d.ts +6 -1
- package/dist/toggle/root/toggle-root.css.js +1 -23
- package/dist/toggle/root/toggle-root.d.ts +6 -0
- package/dist/toolbar/root/toolbar-root.css.js +1 -35
- package/dist/toolbar/root/toolbar-root.d.ts +4 -0
- package/dist/tooltip/root/tooltip-root.css.js +5 -101
- package/dist/tooltip/root/tooltip-root.d.ts +6 -0
- package/dist/tour/root/tour-root.css.js +2 -28
- package/dist/tour/stop/tour-stop.css.js +2 -109
- package/dist/tree/item/tree-item.css.js +14 -230
- package/dist/tree/item/tree-item.d.ts +9 -0
- package/dist/tree/root/tree-root.css.js +1 -40
- package/dist/trend/root/trend-root.css.js +5 -55
- package/dist/trend/root/trend-root.d.ts +2 -2
- package/dist/video/root/video-root.css.js +16 -398
- package/dist/video-playlist/item/video-playlist-item.css.js +12 -86
- package/dist/video-playlist/item/video-playlist-item.d.ts +12 -0
- package/dist/video-playlist/menu/video-playlist-menu.css.js +1 -41
- package/dist/video-playlist/root/video-playlist-root.css.js +1 -19
- package/dist/video-playlist/root/video-playlist-root.d.ts +2 -0
- package/dist/virtual-list/root/virtual-list-root.css.js +5 -28
- package/dist/virtual-list/root/virtual-list-root.d.ts +7 -1
- package/lint.json +1 -1
- package/package.json +9 -9
- package/types/jsx.d.ts +6997 -1154
- package/types/svelte.d.ts +1 -0
- package/types/vue.d.ts +2081 -271
|
@@ -1,126 +1,13 @@
|
|
|
1
1
|
import { createSheet } from '@fusion.dev/helix-core';
|
|
2
|
-
export const styles = createSheet(`:host {
|
|
3
|
-
|
|
4
|
-
--_rating-mark-size: var(--rating-size, var(--helix-size-icon-md));
|
|
5
|
-
--_rating-mark-gap: var(--rating-gap, var(--helix-space-2xs));
|
|
6
|
-
|
|
7
|
-
display: inline-flex;
|
|
8
|
-
flex-direction: column;
|
|
9
|
-
gap: var(--helix-space-2xs);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
[part="field"] {
|
|
13
|
-
align-items: center;
|
|
14
|
-
display: inline-flex;
|
|
15
|
-
gap: var(--helix-space-xs);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
[part="marks"] {
|
|
19
|
-
display: inline-flex;
|
|
20
|
-
position: relative;
|
|
21
|
-
|
|
22
|
-
touch-action: pan-y;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
[part="track"],
|
|
26
|
-
[part="fill"] {
|
|
27
|
-
display: inline-flex;
|
|
28
|
-
gap: var(--_rating-mark-gap);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
[part="track"] {
|
|
32
|
-
color: var(--rating-empty-color, var(--helix-color-border));
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
[part="fill"] {
|
|
36
|
-
color: var(--rating-color, var(--helix-color-warning));
|
|
37
|
-
inline-size: calc(
|
|
2
|
+
export const styles = createSheet(`:host {--_rating-mark-size: var(--rating-size, var(--helix-size-icon-md));--_rating-mark-gap: var(--rating-gap, var(--helix-space-2xs));display: inline-flex;flex-direction: column;gap: var(--helix-space-2xs);}[part="field"] {align-items: center;display: inline-flex;gap: var(--helix-space-xs);}[part="marks"] {display: inline-flex;position: relative;touch-action: pan-y;}[part="track"],
|
|
3
|
+
[part="fill"] {display: inline-flex;gap: var(--_rating-mark-gap);}[part="track"] {color: var(--rating-empty-color, var(--helix-color-border));}[part="fill"] {color: var(--rating-color, var(--helix-color-warning));inline-size: calc(
|
|
38
4
|
var(--rating-full, 0) *
|
|
39
5
|
(var(--_rating-mark-size) + var(--_rating-mark-gap)) +
|
|
40
6
|
var(--rating-part, 0) *
|
|
41
7
|
var(--_rating-mark-size)
|
|
42
|
-
);
|
|
43
|
-
inset-block: 0;
|
|
44
|
-
inset-inline-start: 0;
|
|
45
|
-
overflow: hidden;
|
|
46
|
-
position: absolute;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
[part="mark"] {
|
|
50
|
-
--_rating-star: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2.6l2.9 5.9 6.5.9-4.7 4.6 1.1 6.5-5.8-3-5.8 3 1.1-6.5L2.6 9.4l6.5-.9z"/></svg>');
|
|
51
|
-
|
|
52
|
-
background-color: currentcolor;
|
|
53
|
-
block-size: var(--_rating-mark-size);
|
|
54
|
-
flex: 0 0 auto;
|
|
55
|
-
inline-size: var(--_rating-mark-size);
|
|
56
|
-
mask-image: var(--rating-mark, var(--_rating-star));
|
|
57
|
-
mask-position: center;
|
|
58
|
-
mask-repeat: no-repeat;
|
|
59
|
-
mask-size: contain;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
[part="option"] {
|
|
63
|
-
all: unset;
|
|
64
|
-
box-sizing: border-box;
|
|
65
|
-
|
|
66
|
-
cursor: pointer;
|
|
67
|
-
inset-block: 0;
|
|
68
|
-
position: absolute;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
[part="option"] {
|
|
72
|
-
--_rating-pitch: calc((100% + var(--_rating-mark-gap)) / var(--rating-steps, 1));
|
|
73
|
-
|
|
74
|
-
inline-size: var(--_rating-pitch);
|
|
75
|
-
inset-inline-start: calc(
|
|
8
|
+
);inset-block: 0;inset-inline-start: 0;overflow: hidden;position: absolute;}[part="mark"] {--_rating-star: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2.6l2.9 5.9 6.5.9-4.7 4.6 1.1 6.5-5.8-3-5.8 3 1.1-6.5L2.6 9.4l6.5-.9z"/></svg>');background-color: currentcolor;block-size: var(--_rating-mark-size);flex: 0 0 auto;inline-size: var(--_rating-mark-size);mask-image: var(--rating-mark, var(--_rating-star));mask-position: center;mask-repeat: no-repeat;mask-size: contain;}[part="option"] {all: unset;box-sizing: border-box;cursor: pointer;inset-block: 0;position: absolute;}[part="option"] {--_rating-pitch: calc((100% + var(--_rating-mark-gap)) / var(--rating-steps, 1));inline-size: var(--_rating-pitch);inset-inline-start: calc(
|
|
76
9
|
(var(--rating-step, 1) - 1) *
|
|
77
10
|
var(--_rating-pitch) -
|
|
78
11
|
var(--_rating-mark-gap) /
|
|
79
12
|
2
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
[part="value"] {
|
|
84
|
-
color: var(--helix-color-foreground-muted);
|
|
85
|
-
font-size: var(--helix-text-sm);
|
|
86
|
-
font-variant-numeric: tabular-nums;
|
|
87
|
-
line-height: 1;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
:host([shape="dots"]) {
|
|
91
|
-
--_rating-mark-size: var(--rating-size, var(--helix-size-icon-sm));
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
:host([shape="dots"]) [part="mark"] {
|
|
95
|
-
border-radius: var(--helix-radii-full);
|
|
96
|
-
mask-image: none;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
[part="option"]:focus-visible {
|
|
100
|
-
border-radius: var(--helix-radii-sm);
|
|
101
|
-
outline: var(--helix-size-focus-ring) solid var(--helix-color-focus-ring);
|
|
102
|
-
outline-offset: var(--helix-size-focus-offset);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
:host(:disabled) [part="option"] {
|
|
106
|
-
cursor: not-allowed;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
:host(:disabled) [part="marks"] {
|
|
110
|
-
opacity: 0.5;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
:host([readonly]) [part="marks"] {
|
|
114
|
-
cursor: default;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
[data-slotted] [part="mark"] {
|
|
118
|
-
background-color: transparent;
|
|
119
|
-
mask-image: none;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
@media print {
|
|
123
|
-
:host {
|
|
124
|
-
print-color-adjust: exact;
|
|
125
|
-
}
|
|
126
|
-
}`);
|
|
13
|
+
);}[part="value"] {color: var(--helix-color-foreground-muted);font-size: var(--helix-text-sm);font-variant-numeric: tabular-nums;line-height: 1;}:host([shape="dots"]) {--_rating-mark-size: var(--rating-size, var(--helix-size-icon-sm));}:host([shape="dots"]) [part="mark"] {border-radius: var(--helix-radii-full);mask-image: none;}[part="option"]:focus-visible {border-radius: var(--helix-radii-sm);outline: var(--helix-size-focus-ring) solid var(--helix-color-focus-ring);outline-offset: var(--helix-size-focus-offset);}:host(:disabled) [part="option"] {cursor: not-allowed;}:host(:disabled) [part="marks"] {opacity: 0.5;}:host([readonly]) [part="marks"] {cursor: default;}[data-slotted] [part="mark"] {background-color: transparent;mask-image: none;}@media print {:host {print-color-adjust: exact;}}`);
|
package/dist/sandbox/frame.d.ts
CHANGED
|
@@ -24,9 +24,10 @@ export interface ServePreviewOptions {
|
|
|
24
24
|
* shrinks each top-level child to its own content and centers it, which is
|
|
25
25
|
* the difference for a component whose root is a full-width block. They
|
|
26
26
|
* select the root by its `data-preview-root` attribute, so they reach nothing
|
|
27
|
-
* an example draws inside it.
|
|
27
|
+
* an example draws inside it. The three that fill the viewport count their
|
|
28
|
+
* padding inside that height, so the root never overflows the frame.
|
|
28
29
|
*/
|
|
29
|
-
export declare const LAYOUT_RULES = "\n:root { --preview-measure: 48rem; }\n[data-preview-root][data-layout=\"padded\"] { padding: var(--helix-space-lg, 1.5rem); }\n[data-preview-root][data-layout=\"centered\"], [data-preview-root][data-layout=\"hug\"] {\n align-content: center; display: block
|
|
30
|
+
export declare const LAYOUT_RULES = "\n:root { --preview-measure: 48rem; }\n[data-preview-root][data-layout=\"padded\"] { padding: var(--helix-space-lg, 1.5rem); }\n[data-preview-root][data-layout=\"centered\"], [data-preview-root][data-layout=\"hug\"] {\n align-content: center; box-sizing: border-box; display: block;\n inline-size: min(100%, var(--preview-measure)); margin-inline: auto; min-block-size: 100dvh;\n padding: var(--helix-space-lg, 1.5rem);\n}\n[data-preview-root][data-layout=\"centered\"] { text-align: center; }\n[data-preview-root][data-layout=\"centered\"] > * { margin-inline: auto; text-align: start; }\n[data-preview-root][data-layout=\"hug\"] > * {\n inline-size: fit-content; margin-inline: auto; max-inline-size: 100%;\n}\n[data-preview-root][data-layout=\"fullscreen\"] { box-sizing: border-box; min-block-size: 100dvh; padding: 0; }\n";
|
|
30
31
|
/** Whether `data` is a render message, as the preview sends one. */
|
|
31
32
|
export declare const isRender: (data: unknown) => data is PreviewRender;
|
|
32
33
|
/**
|
|
@@ -50,7 +51,8 @@ export declare const loggedText: (value: unknown) => string;
|
|
|
50
51
|
* - Writes each `helix-preview-render` into the root: the markup, the
|
|
51
52
|
* stylesheet, the direction, the layout and the color mode. Scripts in the
|
|
52
53
|
* markup run.
|
|
53
|
-
* - Posts every console call and uncaught error as `helix-preview-console
|
|
54
|
+
* - Posts every console call and uncaught error as `helix-preview-console`,
|
|
55
|
+
* an uncaught one marked `uncaught`, which marks the preview `failed`.
|
|
54
56
|
* - Posts `helix-preview-size` whenever what was drawn changes height.
|
|
55
57
|
* - Posts `helix-preview-press` on every press, so menus outside close.
|
|
56
58
|
*
|
package/dist/sandbox/frame.js
CHANGED
|
@@ -2,15 +2,16 @@ export const LAYOUT_RULES = `
|
|
|
2
2
|
:root { --preview-measure: 48rem; }
|
|
3
3
|
[data-preview-root][data-layout="padded"] { padding: var(--helix-space-lg, 1.5rem); }
|
|
4
4
|
[data-preview-root][data-layout="centered"], [data-preview-root][data-layout="hug"] {
|
|
5
|
-
align-content: center;
|
|
6
|
-
margin-inline: auto; min-block-size: 100dvh;
|
|
5
|
+
align-content: center; box-sizing: border-box; display: block;
|
|
6
|
+
inline-size: min(100%, var(--preview-measure)); margin-inline: auto; min-block-size: 100dvh;
|
|
7
|
+
padding: var(--helix-space-lg, 1.5rem);
|
|
7
8
|
}
|
|
8
9
|
[data-preview-root][data-layout="centered"] { text-align: center; }
|
|
9
10
|
[data-preview-root][data-layout="centered"] > * { margin-inline: auto; text-align: start; }
|
|
10
11
|
[data-preview-root][data-layout="hug"] > * {
|
|
11
12
|
inline-size: fit-content; margin-inline: auto; max-inline-size: 100%;
|
|
12
13
|
}
|
|
13
|
-
[data-preview-root][data-layout="fullscreen"] { min-block-size: 100dvh; padding: 0; }
|
|
14
|
+
[data-preview-root][data-layout="fullscreen"] { box-sizing: border-box; min-block-size: 100dvh; padding: 0; }
|
|
14
15
|
`;
|
|
15
16
|
export const isRender = (data) => typeof data === 'object' &&
|
|
16
17
|
data !== null &&
|
|
@@ -70,7 +71,7 @@ export const servePreview = (options = {}) => {
|
|
|
70
71
|
};
|
|
71
72
|
}
|
|
72
73
|
const failed = (event) => {
|
|
73
|
-
post({ level: 'error', text: event.message, type: 'helix-preview-console' });
|
|
74
|
+
post({ level: 'error', text: event.message, type: 'helix-preview-console', uncaught: true });
|
|
74
75
|
};
|
|
75
76
|
const measure = () => {
|
|
76
77
|
const boxes = [...root.children].flatMap(drawn);
|
|
@@ -113,9 +114,21 @@ export const servePreview = (options = {}) => {
|
|
|
113
114
|
options.onRender?.(root, fresh);
|
|
114
115
|
measure();
|
|
115
116
|
};
|
|
116
|
-
const press = () => post({ type: 'helix-preview-press' });
|
|
117
117
|
const watcher = new ResizeObserver(measure);
|
|
118
|
-
|
|
118
|
+
const watch = () => {
|
|
119
|
+
watcher.disconnect();
|
|
120
|
+
watcher.observe(root);
|
|
121
|
+
for (const child of root.children) {
|
|
122
|
+
const placed = getComputedStyle(child).display === 'contents' ? child.children : [child];
|
|
123
|
+
for (const box of placed) {
|
|
124
|
+
watcher.observe(box);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const children = new MutationObserver(watch);
|
|
129
|
+
children.observe(root, { childList: true });
|
|
130
|
+
watch();
|
|
131
|
+
const press = () => post({ type: 'helix-preview-press' });
|
|
119
132
|
window.addEventListener('error', failed);
|
|
120
133
|
window.addEventListener('message', render);
|
|
121
134
|
document.addEventListener('pointerdown', press, { capture: true, passive: true });
|
|
@@ -125,6 +138,7 @@ export const servePreview = (options = {}) => {
|
|
|
125
138
|
console[level] = originals[index];
|
|
126
139
|
});
|
|
127
140
|
watcher.disconnect();
|
|
141
|
+
children.disconnect();
|
|
128
142
|
window.removeEventListener('error', failed);
|
|
129
143
|
window.removeEventListener('message', render);
|
|
130
144
|
document.removeEventListener('pointerdown', press, { capture: true });
|
package/dist/sandbox/index.d.ts
CHANGED
|
@@ -18,4 +18,5 @@ export * from './root/sandbox-root.js';
|
|
|
18
18
|
export * from './source/sandbox-source.js';
|
|
19
19
|
export * from './status-bar/sandbox-status-bar.js';
|
|
20
20
|
export * from './terminal/sandbox-terminal.js';
|
|
21
|
+
export type { SandboxToken, SandboxTokenizer } from './tokens.js';
|
|
21
22
|
export * from './toolbar/sandbox-toolbar.js';
|
|
@@ -1,13 +1,2 @@
|
|
|
1
1
|
import { createSheet } from '@fusion.dev/helix-core';
|
|
2
|
-
export const styles = createSheet(`:host {
|
|
3
|
-
display: block;
|
|
4
|
-
min-block-size: 0;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
[part="frame"] {
|
|
8
|
-
background-color: var(--helix-color-background);
|
|
9
|
-
block-size: 100%;
|
|
10
|
-
border: none;
|
|
11
|
-
display: block;
|
|
12
|
-
inline-size: 100%;
|
|
13
|
-
}`);
|
|
2
|
+
export const styles = createSheet(`:host {display: block;min-block-size: 0;}[part="frame"] {background-color: var(--helix-color-background);block-size: 100%;border: none;display: block;inline-size: 100%;}`);
|
|
@@ -19,6 +19,8 @@ export interface PreviewConsole {
|
|
|
19
19
|
level: 'log' | 'info' | 'warn' | 'error';
|
|
20
20
|
text: string;
|
|
21
21
|
type: 'helix-preview-console';
|
|
22
|
+
/** Set for an error the example threw and did not catch, which marks the preview `failed`. */
|
|
23
|
+
uncaught?: boolean;
|
|
22
24
|
}
|
|
23
25
|
/**
|
|
24
26
|
* A press inside the frame, which is the one event the page cannot see for
|
|
@@ -57,6 +59,13 @@ export type PreviewMessage = PreviewConsole | PreviewPress | PreviewReady | Prev
|
|
|
57
59
|
* let a document on the same origin remove its own sandbox, which is the same
|
|
58
60
|
* as having none.
|
|
59
61
|
*
|
|
62
|
+
* **A preview says where it is.** It is `:state(loading)` from the moment it
|
|
63
|
+
* has a `src` until that document can take the example, and again through
|
|
64
|
+
* `reload()`. It is `:state(failed)` once the example throws an error it does
|
|
65
|
+
* not catch, until the next source is sent, which a frame on `servePreview`
|
|
66
|
+
* reports. A page draws its own spinner or message from either, such as a
|
|
67
|
+
* sibling shown by `helix-sandbox-preview:state(failed) + .message`.
|
|
68
|
+
*
|
|
60
69
|
* @since 0.1.0
|
|
61
70
|
* @status stable
|
|
62
71
|
* @aliases Result, Output
|
|
@@ -66,6 +75,9 @@ export type PreviewMessage = PreviewConsole | PreviewPress | PreviewReady | Prev
|
|
|
66
75
|
* @event {HelixResizeEvent} helix-resize - Fired when the height of the frame's content changes, with the new height.
|
|
67
76
|
*
|
|
68
77
|
* @csspart frame - The iframe.
|
|
78
|
+
*
|
|
79
|
+
* @cssstate failed - Since the example threw an error it did not catch, until the next source is sent.
|
|
80
|
+
* @cssstate loading - While the frame's document loads, until it can take the example.
|
|
69
81
|
*/
|
|
70
82
|
export declare class HelixSandboxPreview extends HelixElement {
|
|
71
83
|
/**
|
|
@@ -127,7 +139,9 @@ export declare class HelixSandboxPreview extends HelixElement {
|
|
|
127
139
|
private ready;
|
|
128
140
|
private get frame();
|
|
129
141
|
/**
|
|
130
|
-
* The frame's document has finished loading, so its listener exists
|
|
142
|
+
* The frame's document has finished loading, so its listener exists, the
|
|
143
|
+
* example is sent and the preview is no longer `loading`. The frame saying
|
|
144
|
+
* `helix-preview-ready` lands here too.
|
|
131
145
|
*
|
|
132
146
|
* **The announcement is one shot and the parent can miss it.** The frame posts
|
|
133
147
|
* `helix-preview-ready` at the end of its own module evaluation and never
|
|
@@ -180,8 +194,8 @@ export declare class HelixSandboxPreview extends HelixElement {
|
|
|
180
194
|
* thing on the page already entitled to both.
|
|
181
195
|
*/
|
|
182
196
|
private static readonly target;
|
|
183
|
-
/**
|
|
184
|
-
private
|
|
197
|
+
/** Holds a coalesced send, so only one is ever queued, and drops it on disconnect. */
|
|
198
|
+
private readonly settle;
|
|
185
199
|
/**
|
|
186
200
|
* Sends once the typing stops, replacing anything already waiting.
|
|
187
201
|
*
|
|
@@ -211,6 +225,8 @@ export declare class HelixSandboxPreview extends HelixElement {
|
|
|
211
225
|
* new document announces itself the same way the first one did.
|
|
212
226
|
*/
|
|
213
227
|
reload(): void;
|
|
228
|
+
/** A new document is on its way, so nothing is sent until it listens, and nothing has failed in it. */
|
|
229
|
+
private unready;
|
|
214
230
|
protected updated(changed: PropertyValues): void;
|
|
215
231
|
protected render(): TemplateResult;
|
|
216
232
|
static styles: CSSResultGroup;
|
|
@@ -5,7 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
var HelixSandboxPreview_1;
|
|
8
|
-
import { customElement, HelixConsoleEvent, HelixElement, HelixResizeEvent, } from '@fusion.dev/helix-core';
|
|
8
|
+
import { customElement, DelayController, HelixConsoleEvent, HelixElement, HelixResizeEvent, } from '@fusion.dev/helix-core';
|
|
9
9
|
const SETTLE = 120;
|
|
10
10
|
import { html } from 'lit';
|
|
11
11
|
import { property } from 'lit/decorators.js';
|
|
@@ -20,6 +20,7 @@ let HelixSandboxPreview = class HelixSandboxPreview extends HelixElement {
|
|
|
20
20
|
this.ready = false;
|
|
21
21
|
this.handleFrameLoad = () => {
|
|
22
22
|
this.ready = true;
|
|
23
|
+
this.toggleState('loading', false);
|
|
23
24
|
this.send();
|
|
24
25
|
};
|
|
25
26
|
this.handleMessage = (event) => {
|
|
@@ -27,12 +28,14 @@ let HelixSandboxPreview = class HelixSandboxPreview extends HelixElement {
|
|
|
27
28
|
return;
|
|
28
29
|
}
|
|
29
30
|
if (event.data?.type === 'helix-preview-ready') {
|
|
30
|
-
this.
|
|
31
|
-
this.send();
|
|
31
|
+
this.handleFrameLoad();
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
if (event.data?.type === 'helix-preview-console') {
|
|
35
35
|
this.dispatchEvent(new HelixConsoleEvent({ level: event.data.level, text: event.data.text }));
|
|
36
|
+
if (event.data.uncaught) {
|
|
37
|
+
this.toggleState('failed', true);
|
|
38
|
+
}
|
|
36
39
|
}
|
|
37
40
|
if (event.data?.type === 'helix-preview-press') {
|
|
38
41
|
this.dispatchEvent(new PointerEvent('pointerdown', { bubbles: true, composed: true }));
|
|
@@ -41,6 +44,7 @@ let HelixSandboxPreview = class HelixSandboxPreview extends HelixElement {
|
|
|
41
44
|
this.dispatchEvent(new HelixResizeEvent({ size: event.data.size }));
|
|
42
45
|
}
|
|
43
46
|
};
|
|
47
|
+
this.settle = new DelayController(this);
|
|
44
48
|
}
|
|
45
49
|
static { HelixSandboxPreview_1 = this; }
|
|
46
50
|
get frame() {
|
|
@@ -48,11 +52,10 @@ let HelixSandboxPreview = class HelixSandboxPreview extends HelixElement {
|
|
|
48
52
|
}
|
|
49
53
|
static { this.target = '*'; }
|
|
50
54
|
scheduleSend() {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
this.pending = undefined;
|
|
55
|
+
this.settle.start(SETTLE, () => {
|
|
56
|
+
this.toggleState('failed', false);
|
|
54
57
|
this.send();
|
|
55
|
-
}
|
|
58
|
+
});
|
|
56
59
|
}
|
|
57
60
|
send() {
|
|
58
61
|
if (!this.ready) {
|
|
@@ -74,8 +77,6 @@ let HelixSandboxPreview = class HelixSandboxPreview extends HelixElement {
|
|
|
74
77
|
}
|
|
75
78
|
disconnectedCallback() {
|
|
76
79
|
super.disconnectedCallback();
|
|
77
|
-
clearTimeout(this.pending);
|
|
78
|
-
this.pending = undefined;
|
|
79
80
|
window.removeEventListener('message', this.handleMessage);
|
|
80
81
|
}
|
|
81
82
|
reload() {
|
|
@@ -83,13 +84,18 @@ let HelixSandboxPreview = class HelixSandboxPreview extends HelixElement {
|
|
|
83
84
|
if (!frame) {
|
|
84
85
|
return;
|
|
85
86
|
}
|
|
86
|
-
this.
|
|
87
|
+
this.unready();
|
|
87
88
|
frame.src = this.src;
|
|
88
89
|
}
|
|
90
|
+
unready() {
|
|
91
|
+
this.ready = false;
|
|
92
|
+
this.toggleState('failed', false);
|
|
93
|
+
this.toggleState('loading', this.src !== '');
|
|
94
|
+
}
|
|
89
95
|
updated(changed) {
|
|
90
96
|
super.updated(changed);
|
|
91
97
|
if (changed.has('src')) {
|
|
92
|
-
this.
|
|
98
|
+
this.unready();
|
|
93
99
|
return;
|
|
94
100
|
}
|
|
95
101
|
if (changed.has('source') || changed.has('styles')) {
|
|
@@ -1,71 +1,4 @@
|
|
|
1
1
|
import { createSheet } from '@fusion.dev/helix-core';
|
|
2
|
-
export const styles = createSheet(`:host {
|
|
3
|
-
|
|
4
|
-
display:
|
|
5
|
-
grid-template-rows: auto minmax(0, 1fr) auto;
|
|
6
|
-
min-block-size: var(--sandbox-min-block-size, 20rem);
|
|
7
|
-
overflow: hidden;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
::slotted([slot="toolbar"]) {
|
|
11
|
-
grid-row: 1;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
[part="body"] {
|
|
15
|
-
grid-row: 2;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
::slotted([slot="status"]) {
|
|
19
|
-
grid-row: 3;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
[part="body"],
|
|
23
|
-
[part="panes"] {
|
|
24
|
-
--splitter-color: var(--sandbox-separator-color, var(--helix-color-border));
|
|
25
|
-
--splitter-target: calc(var(--sandbox-grab, var(--helix-space-2xs)) * 2);
|
|
26
|
-
min-block-size: 0;
|
|
27
|
-
min-inline-size: 0;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
[part="panes"] {
|
|
31
|
-
block-size: 100%;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
[part="body"]:not([data-panel])::part(separator) {
|
|
35
|
-
display: none;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
[part="body"]:not([data-panel])::part(corner) {
|
|
39
|
-
display: none;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
[part="pane"] {
|
|
43
|
-
block-size: 100%;
|
|
44
|
-
min-block-size: 0;
|
|
45
|
-
min-inline-size: 0;
|
|
46
|
-
overflow: hidden;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
[part="panel"] {
|
|
50
|
-
block-size: 100%;
|
|
51
|
-
min-block-size: 0;
|
|
52
|
-
overflow: hidden;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
::slotted([slot="panel"]) {
|
|
56
|
-
block-size: 100%;
|
|
57
|
-
min-block-size: 0;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
::slotted(helix-sandbox-preview) {
|
|
61
|
-
background-color: var(--helix-color-background);
|
|
62
|
-
block-size: 100%;
|
|
63
|
-
color: var(--helix-color-foreground);
|
|
64
|
-
display: block;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
@media print {
|
|
68
|
-
:host {
|
|
69
|
-
display: none;
|
|
70
|
-
}
|
|
71
|
-
}`);
|
|
2
|
+
export const styles = createSheet(`:host {background-color: var(--helix-color-background);display: grid;grid-template-rows: auto minmax(0, 1fr) auto;min-block-size: var(--sandbox-min-block-size, 20rem);overflow: hidden;}::slotted([slot="toolbar"]) {grid-row: 1;}[part="body"] {grid-row: 2;}::slotted([slot="status"]) {grid-row: 3;}[part="body"],
|
|
3
|
+
[part="panes"] {--splitter-color: var(--sandbox-separator-color, var(--helix-color-border));--splitter-target: calc(var(--sandbox-grab, var(--helix-space-2xs)) * 2);min-block-size: 0;min-inline-size: 0;}[part="panes"] {block-size: 100%;}[part="body"]:not([data-panel])::part(corner),
|
|
4
|
+
[part="body"]:not([data-panel])::part(separator) {display: none;}[part="pane"] {block-size: 100%;min-block-size: 0;min-inline-size: 0;overflow: hidden;}[part="panel"] {block-size: 100%;min-block-size: 0;overflow: hidden;}::slotted([slot="panel"]) {block-size: 100%;min-block-size: 0;}::slotted(helix-sandbox-preview) {background-color: var(--helix-color-background);block-size: 100%;color: var(--helix-color-foreground);display: block;}@media print {:host {display: none;}}`);
|
|
@@ -41,16 +41,18 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
|
41
41
|
* @event {HelixResizeEvent} helix-resize - Fired by the preview pane when the height of the frame's content changes, with the new height.
|
|
42
42
|
* @event {HelixSplitEvent} helix-split - Fired after the panes' divider settled somewhere new, with the lead pane's share.
|
|
43
43
|
*
|
|
44
|
-
* @csspart body - The splitter holding the panes above the panel.
|
|
44
|
+
* @csspart body - The splitter holding the panes above the panel. `::part(body):state(dragging)` matches while its divider is held.
|
|
45
45
|
* @csspart corner - The handle where the two dividers cross.
|
|
46
46
|
* @csspart pane - Either pane.
|
|
47
47
|
* @csspart panel - The box that holds the slotted panel.
|
|
48
|
-
* @csspart panes - The splitter holding the source and preview panes.
|
|
48
|
+
* @csspart panes - The splitter holding the source and preview panes. `::part(panes):state(dragging)` matches while its divider is held.
|
|
49
49
|
* @csspart separator - Either divider.
|
|
50
50
|
*
|
|
51
51
|
* @cssproperty --sandbox-grab - The invisible width of a divider's drag target.
|
|
52
52
|
* @cssproperty --sandbox-min-block-size - Minimum height of the sandbox.
|
|
53
53
|
* @cssproperty --sandbox-separator-color - Color of the divider.
|
|
54
|
+
*
|
|
55
|
+
* @cssstate panel-collapsed - While there is a panel and it is no taller than `panel-collapsed-size`.
|
|
54
56
|
*/
|
|
55
57
|
export declare class HelixSandbox extends HelixElement {
|
|
56
58
|
/**
|
|
@@ -176,8 +178,12 @@ export declare class HelixSandbox extends HelixElement {
|
|
|
176
178
|
* back into the position that answered it.
|
|
177
179
|
*/
|
|
178
180
|
private readonly watch;
|
|
179
|
-
/**
|
|
180
|
-
|
|
181
|
+
/**
|
|
182
|
+
* A panel height as a share of the body, which is what the splitter takes,
|
|
183
|
+
* held to what the panel may have. A height that is no number is the
|
|
184
|
+
* default one.
|
|
185
|
+
*/
|
|
186
|
+
private shareOf;
|
|
181
187
|
/**
|
|
182
188
|
* Where the outer divider goes: everything the panel is not.
|
|
183
189
|
*
|
|
@@ -305,6 +311,12 @@ export declare class HelixSandbox extends HelixElement {
|
|
|
305
311
|
private requestSplit;
|
|
306
312
|
/** As `requestSplit`, for the panel, whose value is pixels rather than a share. */
|
|
307
313
|
private requestPanelSize;
|
|
314
|
+
/**
|
|
315
|
+
* Takes a request a splitter of this sandbox made for itself, stopped and
|
|
316
|
+
* refused, and gives its value. Gives nothing for one that came up from
|
|
317
|
+
* something slotted into a pane, which passes through untouched.
|
|
318
|
+
*/
|
|
319
|
+
private claim;
|
|
308
320
|
/**
|
|
309
321
|
* Answers a divider that has asked to move.
|
|
310
322
|
*
|
|
@@ -74,54 +74,42 @@ let HelixSandbox = class HelixSandbox extends HelixElement {
|
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
76
|
this.handlePanesChange = (event) => {
|
|
77
|
-
|
|
77
|
+
const value = this.claim(event);
|
|
78
|
+
if (value === undefined) {
|
|
78
79
|
return;
|
|
79
80
|
}
|
|
80
|
-
const { value } = event.detail;
|
|
81
|
-
event.stopPropagation();
|
|
82
|
-
event.preventDefault();
|
|
83
81
|
this.requestSplit(Number(value));
|
|
84
82
|
this.answer(event.currentTarget, this.split);
|
|
85
83
|
};
|
|
86
84
|
this.handlePanelChange = (event) => {
|
|
87
|
-
|
|
85
|
+
const value = this.claim(event);
|
|
86
|
+
if (value === undefined) {
|
|
88
87
|
return;
|
|
89
88
|
}
|
|
90
|
-
const { value } = event.detail;
|
|
91
|
-
event.stopPropagation();
|
|
92
|
-
event.preventDefault();
|
|
93
89
|
if (this.bodyHeight > 0) {
|
|
94
90
|
this.requestPanelSize(Math.max(this.panelFloor, ((100 - Number(value)) / 100) * this.bodyHeight));
|
|
95
91
|
}
|
|
96
92
|
this.answer(event.currentTarget, this.panelPosition);
|
|
97
93
|
};
|
|
98
94
|
this.handleCollapse = (event) => {
|
|
99
|
-
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
event.stopPropagation();
|
|
103
|
-
event.preventDefault();
|
|
95
|
+
this.claim(event);
|
|
104
96
|
};
|
|
105
97
|
this.readPanel = () => {
|
|
106
98
|
this.hasPanel = this.querySelector(':scope > [slot="panel"]') !== null;
|
|
107
99
|
};
|
|
108
100
|
}
|
|
109
|
-
|
|
110
|
-
const size = Number.isFinite(this.panelSize) ? this.panelSize : DEFAULT_PANEL;
|
|
101
|
+
shareOf(size) {
|
|
111
102
|
if (this.bodyHeight <= 0) {
|
|
112
103
|
return 0;
|
|
113
104
|
}
|
|
114
|
-
|
|
105
|
+
const panel = Number.isFinite(size) ? size : DEFAULT_PANEL;
|
|
106
|
+
return Math.min(PANEL_MAX * 100, Math.max(0, (panel / this.bodyHeight) * 100));
|
|
115
107
|
}
|
|
116
108
|
get panelPosition() {
|
|
117
|
-
return this.hasPanel ? 100 - this.
|
|
109
|
+
return this.hasPanel ? 100 - this.shareOf(this.panelSize) : 100;
|
|
118
110
|
}
|
|
119
111
|
get homePanelPosition() {
|
|
120
|
-
|
|
121
|
-
if (!this.hasPanel || this.bodyHeight <= 0) {
|
|
122
|
-
return 100;
|
|
123
|
-
}
|
|
124
|
-
return 100 - Math.min(PANEL_MAX * 100, Math.max(0, (panel / this.bodyHeight) * 100));
|
|
112
|
+
return this.hasPanel ? 100 - this.shareOf(this.defaultPanelSize) : 100;
|
|
125
113
|
}
|
|
126
114
|
get panelSliver() {
|
|
127
115
|
if (this.bodyHeight <= 0) {
|
|
@@ -176,7 +164,6 @@ let HelixSandbox = class HelixSandbox extends HelixElement {
|
|
|
176
164
|
if (accepted && this.split !== was) {
|
|
177
165
|
this.dispatchEvent(new HelixSplitEvent({ value: String(this.split) }));
|
|
178
166
|
}
|
|
179
|
-
return accepted;
|
|
180
167
|
}
|
|
181
168
|
requestPanelSize(next) {
|
|
182
169
|
const was = this.panelSize;
|
|
@@ -191,7 +178,14 @@ let HelixSandbox = class HelixSandbox extends HelixElement {
|
|
|
191
178
|
if (accepted && this.panelSize !== was) {
|
|
192
179
|
this.dispatchEvent(new HelixPanelResizeEvent({ value: String(this.panelSize) }));
|
|
193
180
|
}
|
|
194
|
-
|
|
181
|
+
}
|
|
182
|
+
claim(event) {
|
|
183
|
+
if (event.target !== event.currentTarget) {
|
|
184
|
+
return undefined;
|
|
185
|
+
}
|
|
186
|
+
event.stopPropagation();
|
|
187
|
+
event.preventDefault();
|
|
188
|
+
return event.detail.value;
|
|
195
189
|
}
|
|
196
190
|
answer(divider, position) {
|
|
197
191
|
const target = divider;
|
|
@@ -224,6 +218,7 @@ let HelixSandbox = class HelixSandbox extends HelixElement {
|
|
|
224
218
|
if (!this.hasUpdated && this.childrenKnown) {
|
|
225
219
|
this.readPanel();
|
|
226
220
|
}
|
|
221
|
+
this.toggleState('panel-collapsed', this.hasPanel && this.panelSize <= this.panelCollapsedSize);
|
|
227
222
|
if (!this.hasUpdated || typeof this.renderRoot?.querySelector !== 'function') {
|
|
228
223
|
return;
|
|
229
224
|
}
|
|
@@ -253,33 +248,17 @@ let HelixSandbox = class HelixSandbox extends HelixElement {
|
|
|
253
248
|
const first = this.lead === 'preview' ? 'preview' : 'source';
|
|
254
249
|
const second = first === 'preview' ? 'source' : 'preview';
|
|
255
250
|
const split = Number.isFinite(this.split) ? this.split : DEFAULT_SPLIT;
|
|
251
|
+
const home = Number.isFinite(this.defaultSplit) ? this.defaultSplit : DEFAULT_SPLIT;
|
|
252
|
+
const label = this.separatorLabel || (first === 'preview' ? 'Resize preview pane' : 'Resize source pane');
|
|
256
253
|
return html `<slot name="toolbar"></slot>
|
|
257
|
-
<helix-splitter
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
default-position=${this.homePanelPosition}
|
|
266
|
-
min=${100 - PANEL_MAX * 100}
|
|
267
|
-
.position=${this.panelPosition}
|
|
268
|
-
@helix-before-collapse=${this.handleCollapse}
|
|
269
|
-
@helix-before-resize=${this.handlePanelChange}
|
|
270
|
-
>
|
|
271
|
-
<helix-splitter
|
|
272
|
-
slot="start"
|
|
273
|
-
part="panes"
|
|
274
|
-
exportparts="separator"
|
|
275
|
-
default-position=${Number.isFinite(this.defaultSplit) ? this.defaultSplit : DEFAULT_SPLIT}
|
|
276
|
-
label=${this.separatorLabel || (first === 'preview' ? 'Resize preview pane' : 'Resize source pane')}
|
|
277
|
-
orientation=${vertical ? 'vertical' : 'horizontal'}
|
|
278
|
-
.position=${split}
|
|
279
|
-
@helix-before-collapse=${this.handleCollapse}
|
|
280
|
-
@helix-before-resize=${this.handlePanesChange}
|
|
281
|
-
>
|
|
282
|
-
${''}
|
|
254
|
+
<helix-splitter part="body" ?data-panel=${this.hasPanel} exportparts="separator, corner"
|
|
255
|
+
orientation="vertical" collapsed-size=${this.panelSliver} corner-label=${this.cornerLabel}
|
|
256
|
+
label=${this.panelLabel} default-position=${this.homePanelPosition}
|
|
257
|
+
min=${100 - PANEL_MAX * 100} .position=${this.panelPosition}
|
|
258
|
+
@helix-before-collapse=${this.handleCollapse} @helix-before-resize=${this.handlePanelChange}>
|
|
259
|
+
<helix-splitter slot="start" part="panes" exportparts="separator" default-position=${home}
|
|
260
|
+
label=${label} orientation=${vertical ? 'vertical' : 'horizontal'} .position=${split}
|
|
261
|
+
@helix-before-collapse=${this.handleCollapse} @helix-before-resize=${this.handlePanesChange}>
|
|
283
262
|
<div part="pane" data-pane=${first} slot="start"><slot name=${first} @slotchange=${this.seed}></slot></div>
|
|
284
263
|
<div part="pane" data-pane=${second} slot="end"><slot name=${second} @slotchange=${this.seed}></slot></div>
|
|
285
264
|
</helix-splitter>
|