@fusion.dev/helix 0.146.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 +5556 -539
- package/dist/accordion/item/accordion-item.css.js +4 -96
- 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 -57
- 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 +12 -207
- package/dist/badge/root/badge-root.d.ts +2 -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/breadcrumbs/breadcrumb/breadcrumb.css.js +13 -98
- package/dist/breadcrumbs/root/breadcrumbs-root.css.js +5 -42
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +17 -0
- package/dist/breadcrumbs/root/breadcrumbs-root.js +4 -0
- package/dist/button/root/button-root.css.js +16 -197
- package/dist/button/root/button-root.d.ts +1 -0
- package/dist/button-group/root/button-group-root.css.js +2 -52
- package/dist/callout/root/callout-root.css.js +5 -138
- package/dist/callout/root/callout-root.d.ts +4 -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/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 -239
- package/dist/chat/message/chat-message.d.ts +5 -0
- package/dist/chat/root/chat-root.css.js +5 -162
- package/dist/chat/typing.css.js +9 -46
- package/dist/checkbox/root/checkbox-root.css.js +12 -177
- 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-block/root/code-block-root.css.js +9 -274
- package/dist/color-input/root/color-input-root.css.js +5 -114
- package/dist/color-picker/root/color-picker-root.css.js +39 -337
- package/dist/color-picker/root/color-picker-root.d.ts +2 -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 +3 -43
- package/dist/data-table/root/data-table-root.css.js +21 -245
- package/dist/data-table/root/data-table-root.d.ts +7 -0
- package/dist/date-input/root/date-input-root.css.js +8 -103
- 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 -193
- package/dist/drawer/root/drawer-root.css.js +11 -237
- package/dist/drilldown/item/drilldown-item.css.js +4 -51
- package/dist/drilldown/item/drilldown-item.d.ts +1 -0
- package/dist/drilldown/root/drilldown-root.css.js +6 -120
- package/dist/element-events.generated.js +4 -1
- package/dist/empty/root/empty-root.css.js +2 -42
- package/dist/file-input/root/file-input-root.css.js +7 -173
- package/dist/file-input/root/file-input-root.d.ts +4 -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 -113
- package/dist/flex/root/flex-root.css.js +4 -207
- package/dist/flex/root/flex-root.d.ts +2 -2
- package/dist/format-date/root/format-date-root.css.js +1 -13
- package/dist/graph/root/graph-root.css.js +9 -444
- package/dist/grid/root/grid-root.css.js +1 -171
- package/dist/heatmap/root/heatmap-root.css.js +8 -156
- 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 +25 -203
- package/dist/icon-button/root/icon-button-root.d.ts +1 -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 -71
- package/dist/kbd/root/kbd-root.d.ts +7 -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 -37
- package/dist/lightbox/root/lightbox-root.css.js +38 -183
- package/dist/line-chart/root/line-chart-root.css.js +4 -170
- package/dist/line-chart/root/line-chart-root.d.ts +1 -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 -111
- package/dist/loader/root/loader-root.css.js +5 -171
- 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 +11 -162
- package/dist/megamenu/root/megamenu-root.d.ts +8 -0
- package/dist/menu/item/menu-item.css.js +7 -130
- 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 +17 -207
- package/dist/meter/root/meter-root.d.ts +3 -0
- package/dist/navigation/root/navigation-root.css.js +2 -54
- 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 -125
- package/dist/notifications/root/notifications-root.d.ts +3 -1
- package/dist/number-input/root/number-input-root.css.js +10 -103
- package/dist/object-inspector/root/object-inspector-root.css.js +11 -162
- 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/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 +9 -3
- package/dist/popover/root/popover-root.css.js +6 -127
- package/dist/progress/root/progress-root.css.js +7 -230
- package/dist/progress/root/progress-root.d.ts +4 -0
- package/dist/qr-code/root/qr-code-root.css.js +1 -68
- package/dist/quote/root/quote-root.css.js +1 -20
- package/dist/radio/group/radio-group.css.js +1 -21
- package/dist/radio/root/radio-root.css.js +5 -208
- package/dist/rating/root/rating-root.css.js +4 -117
- package/dist/sandbox/frame.d.ts +2 -1
- package/dist/sandbox/frame.js +1 -1
- package/dist/sandbox/index.d.ts +1 -1
- 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 -95
- package/dist/sandbox/source/sandbox-source.d.ts +31 -25
- package/dist/sandbox/source/sandbox-source.js +12 -5
- 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 +4 -0
- package/dist/sandbox/terminal/sandbox-terminal.js +2 -1
- package/dist/sandbox/tokens.d.ts +2 -2
- package/dist/sandbox/toolbar/sandbox-toolbar.css.js +1 -36
- package/dist/scatter-chart/root/scatter-chart-root.css.js +11 -146
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +1 -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/skip-link/root/skip-link-root.css.js +2 -47
- package/dist/slider/root/slider-root.css.js +19 -330
- package/dist/slider/root/slider-root.d.ts +2 -0
- package/dist/sparkline/root/sparkline-root.css.js +8 -143
- package/dist/sparkline/root/sparkline-root.d.ts +2 -0
- package/dist/speed-dial/item/speed-dial-item.css.js +4 -73
- package/dist/speed-dial/root/speed-dial-root.css.js +3 -149
- 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 -62
- package/dist/steps/root/steps-root.css.js +7 -92
- 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/tab/tab.css.js +6 -54
- package/dist/tag/group/tag-group.css.js +1 -11
- package/dist/tag/root/tag-root.css.js +1 -166
- package/dist/tag/root/tag-root.d.ts +2 -0
- package/dist/text/root/text-root.css.js +11 -200
- package/dist/textarea/root/textarea-root.css.js +3 -71
- package/dist/time-input/root/time-input-root.css.js +7 -118
- 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 -250
- package/dist/toast/root/toast-root.css.js +1 -85
- package/dist/toast/root/toast-root.js +2 -1
- package/dist/toggle/group/toggle-group.css.js +7 -126
- package/dist/toggle/root/toggle-root.css.js +1 -23
- package/dist/toolbar/root/toolbar-root.css.js +1 -36
- package/dist/toolbar/root/toolbar-root.d.ts +2 -0
- package/dist/tooltip/root/tooltip-root.css.js +5 -101
- package/dist/tooltip/root/tooltip-root.d.ts +2 -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 +12 -238
- package/dist/tree/root/tree-root.css.js +1 -40
- package/dist/trend/root/trend-root.css.js +5 -53
- 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 +3 -40
- package/lint.json +1 -1
- package/package.json +6 -6
- package/types/jsx.d.ts +2804 -619
- package/types/svelte.d.ts +1 -0
- package/types/vue.d.ts +810 -169
|
@@ -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>
|
|
@@ -1,96 +1,4 @@
|
|
|
1
1
|
import { createSheet } from '@fusion.dev/helix-core';
|
|
2
|
-
export const styles = createSheet(`:host {
|
|
3
|
-
display: block;
|
|
4
|
-
block-size:
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
[part="source"] {
|
|
8
|
-
background-color: var(--sandbox-source-background-color, var(--helix-color-background));
|
|
9
|
-
block-size: 100%;
|
|
10
|
-
border: none;
|
|
11
|
-
color: var(--helix-color-foreground-muted);
|
|
12
|
-
display: block;
|
|
13
|
-
font-family: var(--helix-font-mono);
|
|
14
|
-
font-size: var(--helix-text-xs);
|
|
15
|
-
inline-size: 100%;
|
|
16
|
-
line-height: var(--helix-leading-normal);
|
|
17
|
-
min-block-size: var(--sandbox-source-min-block-size, 12rem);
|
|
18
|
-
padding: var(--helix-space-sm);
|
|
19
|
-
resize: none;
|
|
20
|
-
tab-size: 2;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
[part="source"]:focus-visible {
|
|
24
|
-
background-color: var(--helix-color-surface);
|
|
25
|
-
outline: none;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
[part="field"] {
|
|
29
|
-
background-color: var(--sandbox-source-background-color, var(--helix-color-background));
|
|
30
|
-
block-size: 100%;
|
|
31
|
-
display: grid;
|
|
32
|
-
grid-template-rows: minmax(max-content, auto);
|
|
33
|
-
overflow: auto;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
[part="field"]:focus-within {
|
|
37
|
-
background-color: var(--helix-color-surface);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
[part="field"] > [part="highlight"],
|
|
41
|
-
[part="field"] > [part="source"] {
|
|
42
|
-
border: none;
|
|
43
|
-
box-sizing: border-box;
|
|
44
|
-
font-family: var(--helix-font-mono);
|
|
45
|
-
font-size: var(--helix-text-xs);
|
|
46
|
-
grid-area: 1 / 1;
|
|
47
|
-
inline-size: 100%;
|
|
48
|
-
letter-spacing: normal;
|
|
49
|
-
line-height: var(--helix-leading-normal);
|
|
50
|
-
margin: 0;
|
|
51
|
-
min-block-size: var(--sandbox-source-min-block-size, 12rem);
|
|
52
|
-
overflow-wrap: break-word;
|
|
53
|
-
padding: var(--helix-space-sm);
|
|
54
|
-
tab-size: 2;
|
|
55
|
-
white-space: pre-wrap;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
[part="field"] > [part="highlight"] {
|
|
59
|
-
color: var(--helix-color-foreground-muted);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
[part="field"] > [part="source"],
|
|
63
|
-
[part="field"] > [part="source"]:focus-visible {
|
|
64
|
-
-webkit-text-fill-color: transparent;
|
|
65
|
-
align-self: stretch;
|
|
66
|
-
background-color: transparent;
|
|
67
|
-
block-size: auto;
|
|
68
|
-
caret-color: var(--helix-color-foreground);
|
|
69
|
-
color: transparent;
|
|
70
|
-
overflow: hidden;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
[part="token"][data-kind="callable"] {
|
|
74
|
-
color: var(--sandbox-source-callable-color, var(--helix-color-syntax-callable));
|
|
75
|
-
}
|
|
76
|
-
[part="token"][data-kind="comment"] {
|
|
77
|
-
color: var(--sandbox-source-comment-color, var(--helix-color-syntax-comment));
|
|
78
|
-
}
|
|
79
|
-
[part="token"][data-kind="constant"] {
|
|
80
|
-
color: var(--sandbox-source-constant-color, var(--helix-color-syntax-constant));
|
|
81
|
-
}
|
|
82
|
-
[part="token"][data-kind="invalid"] {
|
|
83
|
-
color: var(--sandbox-source-invalid-color, var(--helix-color-syntax-invalid));
|
|
84
|
-
}
|
|
85
|
-
[part="token"][data-kind="keyword"] {
|
|
86
|
-
color: var(--sandbox-source-keyword-color, var(--helix-color-syntax-keyword));
|
|
87
|
-
}
|
|
88
|
-
[part="token"][data-kind="name"] {
|
|
89
|
-
color: var(--sandbox-source-name-color, var(--helix-color-syntax-name));
|
|
90
|
-
}
|
|
91
|
-
[part="token"][data-kind="string"] {
|
|
92
|
-
color: var(--sandbox-source-string-color, var(--helix-color-syntax-string));
|
|
93
|
-
}
|
|
94
|
-
[part="token"][data-kind="tag"] {
|
|
95
|
-
color: var(--sandbox-source-tag-color, var(--helix-color-syntax-tag));
|
|
96
|
-
}`);
|
|
2
|
+
export const styles = createSheet(`:host {display: block;block-size: 100%;}[part="highlight"],
|
|
3
|
+
[part="source"] {border: none;color: var(--helix-color-foreground-muted);font-family: var(--helix-font-mono);font-size: var(--helix-text-xs);inline-size: 100%;line-height: var(--helix-leading-normal);min-block-size: var(--sandbox-source-min-block-size, 12rem);padding: var(--helix-space-sm);tab-size: 2;}[part="source"] {background-color: var(--sandbox-source-background-color, var(--helix-color-background));block-size: 100%;display: block;resize: none;}[part="source"]:focus-visible {background-color: var(--helix-color-surface);outline: none;}[part="field"] {background-color: var(--sandbox-source-background-color, var(--helix-color-background));block-size: 100%;display: grid;grid-template-rows: minmax(max-content, auto);overflow: auto;}[part="field"]:focus-within {background-color: var(--helix-color-surface);}[part="field"] > [part] {grid-area: 1 / 1;letter-spacing: normal;margin: 0;overflow-wrap: break-word;white-space: pre-wrap;}[part="field"] > [part="source"],
|
|
4
|
+
[part="field"] > [part="source"]:focus-visible {-webkit-text-fill-color: transparent;align-self: stretch;background-color: transparent;block-size: auto;caret-color: var(--helix-color-foreground);color: transparent;overflow: hidden;}[data-kind="callable"] {color: var(--sandbox-source-callable-color, var(--helix-color-syntax-callable));}[data-kind="comment"] {color: var(--sandbox-source-comment-color, var(--helix-color-syntax-comment));}[data-kind="constant"] {color: var(--sandbox-source-constant-color, var(--helix-color-syntax-constant));}[data-kind="invalid"] {color: var(--sandbox-source-invalid-color, var(--helix-color-syntax-invalid));}[data-kind="keyword"] {color: var(--sandbox-source-keyword-color, var(--helix-color-syntax-keyword));}[data-kind="name"] {color: var(--sandbox-source-name-color, var(--helix-color-syntax-name));}[data-kind="string"] {color: var(--sandbox-source-string-color, var(--helix-color-syntax-string));}[data-kind="tag"] {color: var(--sandbox-source-tag-color, var(--helix-color-syntax-tag));}`);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
2
|
import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
3
|
-
import { type
|
|
3
|
+
import { type SandboxTokenizer } from '../tokens.js';
|
|
4
4
|
/**
|
|
5
5
|
* @summary An editable source pane for a sandbox preview.
|
|
6
6
|
*
|
|
@@ -12,7 +12,7 @@ import { type SandboxHighlight } from '../tokens.js';
|
|
|
12
12
|
* field, press Escape and then Tab. Shift+Tab moves focus back as it does
|
|
13
13
|
* anywhere else. The field's description says so to a screen reader.
|
|
14
14
|
*
|
|
15
|
-
* **`
|
|
15
|
+
* **`tokenize` colors the source** with a highlighter you bring, such as one
|
|
16
16
|
* built on Lezer, Prism or Shiki. It is a function from the source to runs of
|
|
17
17
|
* text, each with an optional kind, and the pane draws the runs under a
|
|
18
18
|
* transparent field, so typing, selection and undo stay the textarea's. The
|
|
@@ -20,7 +20,9 @@ import { type SandboxHighlight } from '../tokens.js';
|
|
|
20
20
|
* `string` and `tag`, each colored by the `--helix-color-syntax-*` token of
|
|
21
21
|
* its name and a hook of its own, such as `--sandbox-source-keyword-color`.
|
|
22
22
|
* A run of any other kind is drawn in the field's own color. Every run with a
|
|
23
|
-
* kind is a `token` part, and carries its kind as `data-kind`.
|
|
23
|
+
* kind is a `token` part, and carries its kind as `data-kind`. A `tokenize`
|
|
24
|
+
* that throws leaves the source drawn plain and the field editable, and the
|
|
25
|
+
* error is reported to the page as an uncaught one.
|
|
24
26
|
*
|
|
25
27
|
* @since 0.1.0
|
|
26
28
|
* @status stable
|
|
@@ -31,37 +33,27 @@ import { type SandboxHighlight } from '../tokens.js';
|
|
|
31
33
|
* @event {HelixCaretEvent} helix-caret - Fired when the cursor moves.
|
|
32
34
|
* @event {HelixEditEvent} helix-edit - Fired after the source was edited, with the new source.
|
|
33
35
|
*
|
|
34
|
-
* @csspart field - The box that scrolls the field and its colors together, under `
|
|
35
|
-
* @csspart highlight - The colored copy of the source drawn under the field, under `
|
|
36
|
+
* @csspart field - The box that scrolls the field and its colors together, under `tokenize`.
|
|
37
|
+
* @csspart highlight - The colored copy of the source drawn under the field, under `tokenize`.
|
|
36
38
|
* @csspart source - The editable region.
|
|
37
|
-
* @csspart token - One run of the source that has a kind, under `
|
|
39
|
+
* @csspart token - One run of the source that has a kind, under `tokenize`.
|
|
38
40
|
*
|
|
39
41
|
* @cssproperty --sandbox-source-background-color - Fill behind the source.
|
|
40
|
-
* @cssproperty --sandbox-source-callable-color - Color of a `callable` run, under `
|
|
41
|
-
* @cssproperty --sandbox-source-comment-color - Color of a `comment` run, under `
|
|
42
|
-
* @cssproperty --sandbox-source-constant-color - Color of a `constant` run, under `
|
|
43
|
-
* @cssproperty --sandbox-source-invalid-color - Color of an `invalid` run, under `
|
|
44
|
-
* @cssproperty --sandbox-source-keyword-color - Color of a `keyword` run, under `
|
|
42
|
+
* @cssproperty --sandbox-source-callable-color - Color of a `callable` run, under `tokenize`. Defaults to `--helix-color-syntax-callable`.
|
|
43
|
+
* @cssproperty --sandbox-source-comment-color - Color of a `comment` run, under `tokenize`. Defaults to `--helix-color-syntax-comment`.
|
|
44
|
+
* @cssproperty --sandbox-source-constant-color - Color of a `constant` run, under `tokenize`. Defaults to `--helix-color-syntax-constant`.
|
|
45
|
+
* @cssproperty --sandbox-source-invalid-color - Color of an `invalid` run, under `tokenize`. Defaults to `--helix-color-syntax-invalid`.
|
|
46
|
+
* @cssproperty --sandbox-source-keyword-color - Color of a `keyword` run, under `tokenize`. Defaults to `--helix-color-syntax-keyword`.
|
|
45
47
|
* @cssproperty --sandbox-source-min-block-size - Minimum height of the pane.
|
|
46
|
-
* @cssproperty --sandbox-source-name-color - Color of a `name` run, under `
|
|
47
|
-
* @cssproperty --sandbox-source-string-color - Color of a `string` run, under `
|
|
48
|
-
* @cssproperty --sandbox-source-tag-color - Color of a `tag` run, under `
|
|
48
|
+
* @cssproperty --sandbox-source-name-color - Color of a `name` run, under `tokenize`. Defaults to `--helix-color-syntax-name`.
|
|
49
|
+
* @cssproperty --sandbox-source-string-color - Color of a `string` run, under `tokenize`. Defaults to `--helix-color-syntax-string`.
|
|
50
|
+
* @cssproperty --sandbox-source-tag-color - Color of a `tag` run, under `tokenize`. Defaults to `--helix-color-syntax-tag`.
|
|
49
51
|
*/
|
|
50
52
|
export declare class HelixSandboxSource extends HelixElement {
|
|
51
53
|
/**
|
|
52
54
|
* The editable region's name, read by screen readers.
|
|
53
55
|
*/
|
|
54
56
|
fieldLabel: string;
|
|
55
|
-
/**
|
|
56
|
-
* Colors the source: a function from the source and the pane's `name` to
|
|
57
|
-
* runs of text, each with an optional kind, such as
|
|
58
|
-
* `[{ text: '<' }, { kind: 'tag', text: 'p' }, { text: '>' }]`.
|
|
59
|
-
*
|
|
60
|
-
* Absent, the pane is a plain field. Runs whose text does not add up to the
|
|
61
|
-
* source are drawn as the source, uncolored, so the colors never drift from
|
|
62
|
-
* the caret. Set it as a property.
|
|
63
|
-
*/
|
|
64
|
-
highlight?: SandboxHighlight;
|
|
65
57
|
/**
|
|
66
58
|
* The field's description, read by screen readers while Tab indents.
|
|
67
59
|
*/
|
|
@@ -79,6 +71,20 @@ export declare class HelixSandboxSource extends HelixElement {
|
|
|
79
71
|
* Whether Tab indents the source. When it is off, Tab moves focus.
|
|
80
72
|
*/
|
|
81
73
|
tabIndents: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Colors the source: a function from the source and the pane's `name` to
|
|
76
|
+
* runs of text, each with an optional kind, such as
|
|
77
|
+
* `[{ text: '<' }, { kind: 'tag', text: 'p' }, { text: '>' }]`.
|
|
78
|
+
*
|
|
79
|
+
* Absent, the pane is a plain field. Runs whose text does not add up to the
|
|
80
|
+
* source are drawn as the source, uncolored, so the colors never drift from
|
|
81
|
+
* the caret, and so is the source when the function throws. Set it as a
|
|
82
|
+
* property.
|
|
83
|
+
*
|
|
84
|
+
* Named for what it returns, runs of text, where Code Block's `highlight`
|
|
85
|
+
* returns markup.
|
|
86
|
+
*/
|
|
87
|
+
tokenize?: SandboxTokenizer;
|
|
82
88
|
/**
|
|
83
89
|
* The source being edited.
|
|
84
90
|
*/
|
|
@@ -123,7 +129,7 @@ export declare class HelixSandboxSource extends HelixElement {
|
|
|
123
129
|
private edit;
|
|
124
130
|
private readonly handleKeydown;
|
|
125
131
|
protected render(): TemplateResult;
|
|
126
|
-
/** The field itself and its description, which is the whole pane without `
|
|
132
|
+
/** The field itself and its description, which is the whole pane without `tokenize`. */
|
|
127
133
|
private renderField;
|
|
128
134
|
static styles: CSSResultGroup;
|
|
129
135
|
}
|
|
@@ -67,10 +67,17 @@ let HelixSandboxSource = class HelixSandboxSource extends HelixElement {
|
|
|
67
67
|
}
|
|
68
68
|
render() {
|
|
69
69
|
const field = this.renderField();
|
|
70
|
-
if (!this.
|
|
70
|
+
if (!this.tokenize) {
|
|
71
71
|
return field;
|
|
72
72
|
}
|
|
73
|
-
|
|
73
|
+
let given = [];
|
|
74
|
+
try {
|
|
75
|
+
given = this.tokenize(this.value, this.name);
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
globalThis.reportError?.(error);
|
|
79
|
+
}
|
|
80
|
+
const runs = drawnRuns(this.value, given);
|
|
74
81
|
return html `<div part="field">
|
|
75
82
|
<pre part="highlight" aria-hidden="true">${runs.map(({ kind, text }) => kind ? html `<span part="token" data-kind=${kind}>${text}</span>` : text)}${'\n'}</pre>
|
|
76
83
|
${field}
|
|
@@ -96,9 +103,6 @@ let HelixSandboxSource = class HelixSandboxSource extends HelixElement {
|
|
|
96
103
|
__decorate([
|
|
97
104
|
property({ attribute: 'field-label' })
|
|
98
105
|
], HelixSandboxSource.prototype, "fieldLabel", void 0);
|
|
99
|
-
__decorate([
|
|
100
|
-
property({ attribute: false })
|
|
101
|
-
], HelixSandboxSource.prototype, "highlight", void 0);
|
|
102
106
|
__decorate([
|
|
103
107
|
property({ attribute: 'keys-description' })
|
|
104
108
|
], HelixSandboxSource.prototype, "keysDescription", void 0);
|
|
@@ -108,6 +112,9 @@ __decorate([
|
|
|
108
112
|
__decorate([
|
|
109
113
|
property({ attribute: 'tab-indents', converter: onUnlessFalse })
|
|
110
114
|
], HelixSandboxSource.prototype, "tabIndents", void 0);
|
|
115
|
+
__decorate([
|
|
116
|
+
property({ attribute: false })
|
|
117
|
+
], HelixSandboxSource.prototype, "tokenize", void 0);
|
|
111
118
|
__decorate([
|
|
112
119
|
property()
|
|
113
120
|
], HelixSandboxSource.prototype, "value", void 0);
|
|
@@ -1,22 +1,2 @@
|
|
|
1
1
|
import { createSheet } from '@fusion.dev/helix-core';
|
|
2
|
-
export const styles = createSheet(`:host {
|
|
3
|
-
align-items: center;
|
|
4
|
-
background-color: var(--helix-color-background);
|
|
5
|
-
border-block-start: var(--helix-border-thin) solid var(--helix-color-border);
|
|
6
|
-
color: var(--sandbox-status-bar-color, var(--helix-color-foreground-subtle));
|
|
7
|
-
display: flex;
|
|
8
|
-
font-size: var(--helix-text-xs);
|
|
9
|
-
gap: var(--helix-space-sm);
|
|
10
|
-
line-height: var(--helix-leading-tight);
|
|
11
|
-
padding: var(--helix-space-2xs) var(--helix-space-sm);
|
|
12
|
-
|
|
13
|
-
user-select: none;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
slot:not([name]) + * {
|
|
17
|
-
margin-inline-start: auto;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
[part="caret"] {
|
|
21
|
-
font-variant-numeric: tabular-nums;
|
|
22
|
-
}`);
|
|
2
|
+
export const styles = createSheet(`:host {align-items: center;background-color: var(--helix-color-background);border-block-start: var(--helix-border-thin) solid var(--helix-color-border);color: var(--sandbox-status-bar-color, var(--helix-color-foreground-subtle));display: flex;font-size: var(--helix-text-xs);gap: var(--helix-space-sm);line-height: var(--helix-leading-tight);padding: var(--helix-space-2xs) var(--helix-space-sm);user-select: none;}slot:not([name]) + * {margin-inline-start: auto;}[part="caret"] {font-variant-numeric: tabular-nums;}`);
|
|
@@ -1,107 +1,6 @@
|
|
|
1
1
|
import { createSheet } from '@fusion.dev/helix-core';
|
|
2
|
-
export const styles = createSheet(`:host {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
min-block-size: 0;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
:host([controls]) {
|
|
11
|
-
grid-template-rows: auto minmax(0, 1fr);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
[part="controls"] {
|
|
15
|
-
align-items: center;
|
|
16
|
-
border-block-end: var(--helix-border-thin) solid var(--helix-color-border);
|
|
17
|
-
display: flex;
|
|
18
|
-
font-family: var(--helix-font-sans);
|
|
19
|
-
font-size: var(--helix-text-xs);
|
|
20
|
-
gap: var(--helix-space-xs);
|
|
21
|
-
justify-content: space-between;
|
|
22
|
-
padding: var(--helix-space-2xs) var(--helix-space-sm);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
[part="filter"],
|
|
26
|
-
[part="clear"] {
|
|
27
|
-
background-color: transparent;
|
|
28
|
-
border: var(--helix-border-thin) solid var(--helix-color-border);
|
|
29
|
-
border-radius: var(--helix-radii-sm);
|
|
30
|
-
color: var(--helix-color-foreground);
|
|
31
|
-
font: inherit;
|
|
32
|
-
padding: var(--helix-space-2xs) var(--helix-space-xs);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
[part="clear"] {
|
|
36
|
-
cursor: pointer;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
[part="clear"]:hover {
|
|
40
|
-
background-color: var(--helix-color-surface-sunken);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
[part="filter"]:focus-visible,
|
|
44
|
-
[part="clear"]:focus-visible {
|
|
45
|
-
outline: var(--helix-size-focus-ring) solid var(--helix-color-focus-ring);
|
|
46
|
-
outline-offset: var(--helix-size-focus-offset);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
[part="log"] {
|
|
50
|
-
font-family: var(--helix-font-mono);
|
|
51
|
-
font-size: var(--helix-text-xs);
|
|
52
|
-
line-height: var(--helix-leading-normal);
|
|
53
|
-
overflow: auto;
|
|
54
|
-
padding: var(--helix-space-xs) var(--helix-space-sm);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
[part="log"]:focus-visible {
|
|
58
|
-
outline: var(--helix-size-focus-ring) solid var(--helix-color-focus-ring);
|
|
59
|
-
outline-offset: calc(var(--helix-size-focus-offset) * -1);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
[part="empty"] {
|
|
63
|
-
color: var(--helix-color-foreground-subtle);
|
|
64
|
-
margin: var(--helix-space-none);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
[part="entry"] {
|
|
68
|
-
align-items: baseline;
|
|
69
|
-
color: var(--helix-color-foreground-muted);
|
|
70
|
-
display: grid;
|
|
71
|
-
gap: var(--helix-space-xs);
|
|
72
|
-
grid-template-columns: 3.5rem minmax(0, 1fr) auto;
|
|
73
|
-
padding-block: var(--helix-space-2xs);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
[part="level"] {
|
|
77
|
-
color: var(--helix-color-foreground-subtle);
|
|
78
|
-
text-transform: uppercase;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
[part="message"] {
|
|
82
|
-
white-space: pre-wrap;
|
|
83
|
-
word-break: break-word;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
[part="count"] {
|
|
87
|
-
background-color: var(--helix-color-surface-sunken);
|
|
88
|
-
border-radius: var(--helix-radii-full);
|
|
89
|
-
color: var(--helix-color-foreground-subtle);
|
|
90
|
-
padding-inline: var(--helix-space-2xs);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
[part="entry"][data-level="warn"] {
|
|
94
|
-
color: var(--helix-color-warning);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
[part="entry"][data-level="warn"] [part="level"] {
|
|
98
|
-
color: var(--helix-color-warning);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
[part="entry"][data-level="error"] {
|
|
102
|
-
color: var(--helix-color-danger);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
[part="entry"][data-level="error"] [part="level"] {
|
|
106
|
-
color: var(--helix-color-danger);
|
|
107
|
-
}`);
|
|
2
|
+
export const styles = createSheet(`:host {block-size: var(--sandbox-terminal-size, 100%);display: grid;grid-template-rows: minmax(0, 1fr);min-block-size: 0;}:host([controls]) {grid-template-rows: auto minmax(0, 1fr);}[part="controls"] {align-items: center;border-block-end: var(--helix-border-thin) solid var(--helix-color-border);display: flex;font-family: var(--helix-font-sans);font-size: var(--helix-text-xs);gap: var(--helix-space-xs);justify-content: space-between;padding: var(--helix-space-2xs) var(--helix-space-sm);}[part="filter"],
|
|
3
|
+
[part="clear"] {background-color: transparent;border: var(--helix-border-thin) solid var(--helix-color-border);border-radius: var(--helix-radii-sm);color: var(--helix-color-foreground);font: inherit;padding: var(--helix-space-2xs) var(--helix-space-xs);}[part="clear"] {cursor: pointer;}[part="clear"]:hover {background-color: var(--helix-color-surface-sunken);}[part="filter"]:focus-visible,
|
|
4
|
+
[part="clear"]:focus-visible {outline: var(--helix-size-focus-ring) solid var(--helix-color-focus-ring);outline-offset: var(--helix-size-focus-offset);}[part="log"] {font-family: var(--helix-font-mono);font-size: var(--helix-text-xs);line-height: var(--helix-leading-normal);overflow: auto;padding: var(--helix-space-xs) var(--helix-space-sm);}[part="log"]:focus-visible {outline: var(--helix-size-focus-ring) solid var(--helix-color-focus-ring);outline-offset: calc(var(--helix-size-focus-offset) * -1);}[part="empty"] {color: var(--helix-color-foreground-subtle);margin: var(--helix-space-none);}[part="entry"] {align-items: baseline;color: var(--helix-color-foreground-muted);display: grid;gap: var(--helix-space-xs);grid-template-columns: 3.5rem minmax(0, 1fr) auto;padding-block: var(--helix-space-2xs);}[part="level"] {color: var(--helix-color-foreground-subtle);text-transform: uppercase;}[part="message"] {white-space: pre-wrap;word-break: break-word;}[part="count"] {background-color: var(--helix-color-surface-sunken);border-radius: var(--helix-radii-full);color: var(--helix-color-foreground-subtle);padding-inline: var(--helix-space-2xs);}[data-level="warn"],
|
|
5
|
+
[data-level="warn"] [part="level"] {color: var(--helix-color-warning);}[data-level="error"],
|
|
6
|
+
[data-level="error"] [part="level"] {color: var(--helix-color-danger);}`);
|
|
@@ -106,6 +106,10 @@ export declare class HelixSandboxTerminal extends HelixElement {
|
|
|
106
106
|
* Takes the level the reader chose in the filter, unless a listener
|
|
107
107
|
* refused it, and then says so with the select's own `change`, which stops
|
|
108
108
|
* at the shadow root otherwise. A refusal puts the select back.
|
|
109
|
+
*
|
|
110
|
+
* The select's `input` is stopped where it starts, as Pagination's is. It is
|
|
111
|
+
* composed and comes first, so it left this element before
|
|
112
|
+
* `helix-before-change` and still left it when the change was refused.
|
|
109
113
|
*/
|
|
110
114
|
private readonly handleLevel;
|
|
111
115
|
/** The clear button and the level filter, under `controls`. */
|
|
@@ -16,6 +16,7 @@ const LEVEL_WORDS = {
|
|
|
16
16
|
warn: 'Warnings and errors',
|
|
17
17
|
};
|
|
18
18
|
const LIMIT = 200;
|
|
19
|
+
const stop = (event) => event.stopPropagation();
|
|
19
20
|
let HelixSandboxTerminal = class HelixSandboxTerminal extends HelixElement {
|
|
20
21
|
constructor() {
|
|
21
22
|
super(...arguments);
|
|
@@ -77,7 +78,7 @@ let HelixSandboxTerminal = class HelixSandboxTerminal extends HelixElement {
|
|
|
77
78
|
return nothing;
|
|
78
79
|
}
|
|
79
80
|
return html `<div part="controls">
|
|
80
|
-
<select part="filter" aria-label=${this.levelLabel} @change=${this.handleLevel}>
|
|
81
|
+
<select part="filter" aria-label=${this.levelLabel} @change=${this.handleLevel} @input=${stop}>
|
|
81
82
|
${LEVELS.map((one) => html `<option value=${one} ?selected=${(this.level ?? 'log') === one}>
|
|
82
83
|
${this.levelWords?.[one] ?? LEVEL_WORDS[one]}
|
|
83
84
|
</option>`)}
|
package/dist/sandbox/tokens.d.ts
CHANGED
|
@@ -10,12 +10,12 @@ export interface SandboxToken {
|
|
|
10
10
|
text: string;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Splits a pane's source into runs, for `SandboxSource.
|
|
13
|
+
* Splits a pane's source into runs, for `SandboxSource.tokenize`.
|
|
14
14
|
*
|
|
15
15
|
* Takes the source and the pane's `name`, such as `html` or `css`, so one
|
|
16
16
|
* function can serve every pane.
|
|
17
17
|
*/
|
|
18
|
-
export type
|
|
18
|
+
export type SandboxTokenizer = (source: string, name: string) => readonly SandboxToken[];
|
|
19
19
|
/** A run as the pane draws it: its text, and its kind as an attribute holds it. */
|
|
20
20
|
export interface DrawnRun {
|
|
21
21
|
/** The kind, in lowercase letters, digits and hyphens, or `undefined` for plain text. */
|
|
@@ -1,37 +1,2 @@
|
|
|
1
1
|
import { createSheet } from '@fusion.dev/helix-core';
|
|
2
|
-
export const styles = createSheet(`:host {
|
|
3
|
-
|
|
4
|
-
--helix-size-checkbox: var(--helix-size-checkbox-sm);
|
|
5
|
-
--helix-size-checkbox-loose: calc(var(--helix-size-checkbox) * 1.2);
|
|
6
|
-
--helix-size-checkbox-tight: calc(var(--helix-size-checkbox) * 0.8);
|
|
7
|
-
--helix-size-icon: var(--helix-size-icon-sm);
|
|
8
|
-
--helix-size-icon-loose: calc(var(--helix-size-icon) * 1.2);
|
|
9
|
-
--helix-size-icon-tight: calc(var(--helix-size-icon) * 0.8);
|
|
10
|
-
--helix-size-control: var(--helix-size-control-sm);
|
|
11
|
-
--helix-size-control-loose: calc(var(--helix-size-control) * 1.2);
|
|
12
|
-
--helix-size-control-tight: calc(var(--helix-size-control) * 0.8);
|
|
13
|
-
--helix-size-tag: var(--helix-size-tag-sm);
|
|
14
|
-
|
|
15
|
-
align-items: center;
|
|
16
|
-
background-color: var(--helix-color-background);
|
|
17
|
-
|
|
18
|
-
block-size: var(--sandbox-toolbar-size, var(--helix-size-control-lg));
|
|
19
|
-
|
|
20
|
-
border-block-end: var(--helix-border-thin) solid var(--helix-color-border);
|
|
21
|
-
display: flex;
|
|
22
|
-
min-block-size: 0;
|
|
23
|
-
padding-block: var(--helix-space-none);
|
|
24
|
-
|
|
25
|
-
padding-inline: var(--helix-space-md);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
slot {
|
|
29
|
-
align-items: center;
|
|
30
|
-
display: flex;
|
|
31
|
-
gap: var(--sandbox-toolbar-gap, var(--helix-space-sm));
|
|
32
|
-
min-inline-size: 0;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
slot[name="end"] {
|
|
36
|
-
margin-inline-start: auto;
|
|
37
|
-
}`);
|
|
2
|
+
export const styles = createSheet(`:host {--helix-size-checkbox: var(--helix-size-checkbox-sm);--helix-size-checkbox-loose: calc(var(--helix-size-checkbox) * 1.2);--helix-size-checkbox-tight: calc(var(--helix-size-checkbox) * 0.8);--helix-size-icon: var(--helix-size-icon-sm);--helix-size-icon-loose: calc(var(--helix-size-icon) * 1.2);--helix-size-icon-tight: calc(var(--helix-size-icon) * 0.8);--helix-size-control: var(--helix-size-control-sm);--helix-size-control-loose: calc(var(--helix-size-control) * 1.2);--helix-size-control-tight: calc(var(--helix-size-control) * 0.8);--helix-size-tag: var(--helix-size-tag-sm);align-items: center;background-color: var(--helix-color-background);block-size: var(--sandbox-toolbar-size, var(--helix-size-control-lg));border-block-end: var(--helix-border-thin) solid var(--helix-color-border);display: flex;min-block-size: 0;padding-block: var(--helix-space-none);padding-inline: var(--helix-space-md);}slot {align-items: center;display: flex;gap: var(--sandbox-toolbar-gap, var(--helix-space-sm));min-inline-size: 0;}slot[name="end"] {margin-inline-start: auto;}`);
|