@fusion.dev/helix 0.1.0 → 0.3.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 +256 -256
- package/dist/accordion/item/accordion-item.css.js +0 -1
- package/dist/accordion/item/accordion-item.js +0 -29
- package/dist/accordion/root/accordion-root.css.js +0 -1
- package/dist/accordion/root/accordion-root.js +0 -20
- package/dist/announcement/root/announcement-root.css.js +0 -1
- package/dist/announcement/root/announcement-root.js +0 -16
- package/dist/app-header/root/app-header-root.css.js +0 -1
- package/dist/app-header/root/app-header-root.js +0 -45
- package/dist/aura/root/aura-axis.js +0 -58
- package/dist/aura/root/aura-root.css.js +0 -1
- package/dist/aura/root/aura-root.js +0 -520
- package/dist/aura/root/aura-shader.js +0 -35
- package/dist/avatar/group/avatar-group.css.js +0 -1
- package/dist/avatar/group/avatar-group.js +0 -24
- package/dist/avatar/root/avatar-root.css.js +0 -1
- package/dist/avatar/root/avatar-root.js +0 -23
- package/dist/badge/root/badge-root.css.js +0 -1
- package/dist/badge/root/badge-root.d.ts +2 -6
- package/dist/badge/root/badge-root.js +0 -18
- package/dist/bar-chart/root/bar-chart-root.css.js +0 -1
- package/dist/bar-chart/root/bar-chart-root.js +0 -50
- package/dist/blockquote/root/blockquote-root.css.js +0 -1
- package/dist/blockquote/root/blockquote-root.js +0 -17
- package/dist/breadcrumbs/breadcrumb/breadcrumb.css.js +0 -1
- package/dist/breadcrumbs/breadcrumb/breadcrumb.js +0 -28
- package/dist/breadcrumbs/root/breadcrumbs-root.css.js +0 -1
- package/dist/breadcrumbs/root/breadcrumbs-root.js +0 -19
- package/dist/button/root/button-root.css.js +0 -1
- package/dist/button/root/button-root.js +0 -38
- package/dist/button-group/root/button-group-root.css.js +0 -1
- package/dist/button-group/root/button-group-root.js +0 -24
- package/dist/callout/root/callout-root.css.js +0 -1
- package/dist/callout/root/callout-root.js +0 -26
- package/dist/card/root/card-root.css.js +0 -1
- package/dist/card/root/card-root.js +0 -45
- package/dist/carousel/root/carousel-root.css.js +0 -1
- package/dist/carousel/root/carousel-root.js +0 -24
- package/dist/chat/composer/chat-composer.css.js +0 -1
- package/dist/chat/composer/chat-composer.js +0 -26
- package/dist/chat/message/chat-message.css.js +0 -1
- package/dist/chat/message/chat-message.js +0 -29
- package/dist/chat/root/chat-root.css.js +0 -1
- package/dist/chat/root/chat-root.js +0 -38
- package/dist/checkbox/root/checkbox-root.css.js +0 -1
- package/dist/checkbox/root/checkbox-root.js +0 -26
- package/dist/checkbox-group/root/checkbox-group-root.css.js +0 -1
- package/dist/checkbox-group/root/checkbox-group-root.js +0 -15
- package/dist/code/root/code-root.css.js +0 -1
- package/dist/code/root/code-root.js +0 -21
- package/dist/code-block/root/code-block-root.css.js +0 -1
- package/dist/code-block/root/code-block-root.js +0 -19
- package/dist/color-input/root/color-input-root.css.js +0 -1
- package/dist/color-input/root/color-input-root.js +0 -42
- package/dist/color-picker/root/color-picker-root.css.js +0 -1
- package/dist/color-picker/root/color-picker-root.js +0 -42
- package/dist/combobox/root/combobox-root.css.js +0 -1
- package/dist/combobox/root/combobox-root.js +0 -28
- package/dist/command/root/command-root.css.js +0 -1
- package/dist/command/root/command-root.js +0 -21
- package/dist/copy-button/root/copy-button-root.css.js +0 -1
- package/dist/copy-button/root/copy-button-root.js +0 -14
- package/dist/data-table/root/data-table-root.css.js +0 -1
- package/dist/data-table/root/data-table-root.js +0 -39
- package/dist/date-input/root/date-input-root.css.js +0 -1
- package/dist/date-input/root/date-input-root.js +0 -38
- package/dist/date-picker/root/date-picker-root.css.js +0 -1
- package/dist/date-picker/root/date-picker-root.js +0 -28
- package/dist/dialog/root/dialog-root.css.js +0 -1
- package/dist/dialog/root/dialog-root.js +0 -31
- package/dist/divider/root/divider-root.css.js +0 -1
- package/dist/divider/root/divider-root.js +0 -24
- package/dist/donut-chart/root/donut-chart-root.css.js +0 -1
- package/dist/donut-chart/root/donut-chart-root.js +0 -49
- package/dist/drawer/root/drawer-root.css.js +0 -1
- package/dist/drawer/root/drawer-root.js +0 -38
- package/dist/drilldown/item/drilldown-item.css.js +0 -1
- package/dist/drilldown/item/drilldown-item.js +0 -15
- package/dist/drilldown/root/drilldown-root.css.js +0 -1
- package/dist/drilldown/root/drilldown-root.js +0 -23
- package/dist/element-events.generated.js +0 -5
- package/dist/empty/root/empty-root.css.js +0 -1
- package/dist/empty/root/empty-root.js +0 -16
- package/dist/file-input/root/file-input-root.css.js +0 -1
- package/dist/file-input/root/file-input-root.js +0 -30
- package/dist/flex/root/flex-root.css.js +0 -1
- package/dist/flex/root/flex-root.js +0 -32
- package/dist/format-date/root/format-date-root.css.js +0 -1
- package/dist/format-date/root/format-date-root.js +0 -17
- package/dist/grid/root/grid-root.css.js +0 -1
- package/dist/grid/root/grid-root.js +0 -69
- package/dist/heatmap/root/heatmap-root.css.js +0 -1
- package/dist/heatmap/root/heatmap-root.d.ts +9 -11
- package/dist/heatmap/root/heatmap-root.js +0 -73
- package/dist/icon/glyph.css.js +0 -1
- package/dist/icon/root/icon-root.css.js +0 -1
- package/dist/icon/root/icon-root.js +0 -19
- package/dist/icon-button/root/icon-button-root.css.js +0 -1
- package/dist/icon-button/root/icon-button-root.js +0 -35
- package/dist/image/root/image-root.css.js +0 -1
- package/dist/image/root/image-root.js +0 -28
- package/dist/index.js +0 -5
- package/dist/input/root/input-root.css.js +0 -1
- package/dist/input/root/input-root.js +0 -28
- package/dist/kbd/root/kbd-root.css.js +0 -1
- package/dist/kbd/root/kbd-root.js +0 -20
- package/dist/legend/root/legend-root.css.js +0 -1
- package/dist/legend/root/legend-root.js +0 -35
- package/dist/line-chart/root/line-chart-root.css.js +0 -1
- package/dist/line-chart/root/line-chart-root.js +0 -47
- package/dist/list/item/list-item.css.js +0 -1
- package/dist/list/item/list-item.js +0 -38
- package/dist/list/root/list-root.css.js +0 -1
- package/dist/list/root/list-root.js +0 -23
- package/dist/listbox/root/listbox-root.css.js +0 -1
- package/dist/listbox/root/listbox-root.js +0 -22
- package/dist/loader/root/loader-root.css.js +0 -1
- package/dist/loader/root/loader-root.js +0 -19
- package/dist/megamenu/root/megamenu-root.css.js +0 -1
- package/dist/megamenu/root/megamenu-root.js +0 -24
- package/dist/menu/item/menu-item.css.js +0 -1
- package/dist/menu/item/menu-item.js +0 -16
- package/dist/menu/root/menu-root.css.js +0 -1
- package/dist/menu/root/menu-root.js +0 -26
- package/dist/meter/root/meter-root.css.js +0 -1
- package/dist/meter/root/meter-root.js +0 -50
- package/dist/mixins/mixin-control-surface/mixin-control-surface.js +0 -3
- package/dist/navigation/root/navigation-root.css.js +0 -1
- package/dist/navigation/root/navigation-root.js +0 -18
- package/dist/notifications/notification/notification.css.js +0 -1
- package/dist/notifications/notification/notification.js +0 -53
- package/dist/notifications/root/notifications-root.css.js +0 -1
- package/dist/notifications/root/notifications-root.js +0 -31
- package/dist/number-input/root/number-input-root.css.js +0 -1
- package/dist/number-input/root/number-input-root.js +0 -31
- package/dist/option/group/option-group.css.js +0 -1
- package/dist/option/group/option-group.js +0 -13
- package/dist/option/root/option-root.css.js +0 -1
- package/dist/option/root/option-root.js +0 -20
- package/dist/outline/root/outline-root.css.js +0 -1
- package/dist/outline/root/outline-root.js +0 -21
- package/dist/pagination/root/pagination-root.css.js +0 -1
- package/dist/pagination/root/pagination-root.js +0 -49
- package/dist/pagination/size/pagination-size.css.js +0 -1
- package/dist/pagination/size/pagination-size.js +0 -25
- package/dist/pagination/summary/pagination-summary.css.js +0 -1
- package/dist/pagination/summary/pagination-summary.js +0 -13
- package/dist/pin-input/root/pin-input-root.css.js +0 -1
- package/dist/pin-input/root/pin-input-root.js +0 -27
- package/dist/popover/root/popover-root.css.js +0 -1
- package/dist/popover/root/popover-root.js +0 -30
- package/dist/progress/root/progress-root.css.js +0 -1
- package/dist/progress/root/progress-root.js +0 -25
- package/dist/qr-code/root/qr-code-root.css.js +0 -1
- package/dist/qr-code/root/qr-code-root.js +0 -27
- package/dist/quote/root/quote-root.css.js +0 -1
- package/dist/quote/root/quote-root.js +0 -15
- package/dist/radio/group/radio-group.css.js +0 -1
- package/dist/radio/group/radio-group.js +0 -16
- package/dist/radio/root/radio-root.css.js +0 -1
- package/dist/radio/root/radio-root.js +0 -46
- package/dist/rating/root/rating-root.css.js +0 -1
- package/dist/rating/root/rating-root.js +0 -22
- package/dist/sandbox/index.js +0 -14
- package/dist/sandbox/preview/sandbox-preview.css.js +0 -1
- package/dist/sandbox/preview/sandbox-preview.js +0 -182
- package/dist/sandbox/root/sandbox-root.css.js +0 -1
- package/dist/sandbox/root/sandbox-root.js +1 -295
- package/dist/sandbox/source/sandbox-source.css.js +0 -1
- package/dist/sandbox/source/sandbox-source.js +0 -77
- package/dist/sandbox/status-bar/sandbox-status-bar.css.js +0 -1
- package/dist/sandbox/status-bar/sandbox-status-bar.js +0 -38
- package/dist/sandbox/terminal/sandbox-terminal.css.js +0 -1
- package/dist/sandbox/terminal/sandbox-terminal.js +0 -54
- package/dist/sandbox/toolbar/sandbox-toolbar.css.js +0 -1
- package/dist/sandbox/toolbar/sandbox-toolbar.js +0 -29
- package/dist/scroll-area/root/scroll-area-root.css.js +0 -1
- package/dist/scroll-area/root/scroll-area-root.js +0 -24
- package/dist/select/root/select-root.css.js +0 -1
- package/dist/select/root/select-root.js +0 -33
- package/dist/shared/chart/series.css.js +0 -1
- package/dist/shared/chart/terminus.css.js +0 -1
- package/dist/shared/field/field-inline.css.js +0 -1
- package/dist/shared/field/field-stacked.css.js +0 -1
- package/dist/shared/field/field.css.js +0 -1
- package/dist/skeleton/root/skeleton-root.css.js +0 -1
- package/dist/skeleton/root/skeleton-root.js +0 -18
- package/dist/slider/root/slider-root.css.js +0 -1
- package/dist/slider/root/slider-root.js +0 -32
- package/dist/sparkline/root/sparkline-root.css.js +0 -1
- package/dist/sparkline/root/sparkline-root.js +0 -40
- package/dist/speed-dial/item/speed-dial-item.css.js +0 -1
- package/dist/speed-dial/item/speed-dial-item.js +0 -16
- package/dist/speed-dial/root/speed-dial-root.css.js +0 -1
- package/dist/speed-dial/root/speed-dial-root.js +0 -16
- package/dist/splitter/root/splitter-root.css.js +0 -1
- package/dist/splitter/root/splitter-root.js +0 -50
- package/dist/stat/group/stat-group.css.js +0 -1
- package/dist/stat/group/stat-group.js +0 -19
- package/dist/stat/root/stat-root.css.js +0 -1
- package/dist/stat/root/stat-root.js +0 -17
- package/dist/steps/root/steps-root.css.js +0 -1
- package/dist/steps/root/steps-root.js +0 -26
- package/dist/steps/step/step.css.js +0 -1
- package/dist/steps/step/step.js +0 -12
- package/dist/switch/root/switch-root.css.js +0 -1
- package/dist/switch/root/switch-root.js +0 -32
- package/dist/table/cell/table-cell.css.js +0 -1
- package/dist/table/cell/table-cell.js +0 -14
- package/dist/table/column/table-column.css.js +0 -1
- package/dist/table/column/table-column.js +0 -13
- package/dist/table/root/table-root.css.js +0 -1
- package/dist/table/root/table-root.js +0 -19
- package/dist/table/row/table-row.css.js +0 -1
- package/dist/table/row/table-row.js +0 -14
- package/dist/tabs/panel/tab-panel.css.js +0 -1
- package/dist/tabs/panel/tab-panel.js +0 -16
- package/dist/tabs/root/tabs-root.css.js +0 -1
- package/dist/tabs/root/tabs-root.js +0 -19
- package/dist/tabs/tab/tab.css.js +0 -1
- package/dist/tabs/tab/tab.js +0 -16
- package/dist/tag/root/tag-root.css.js +0 -1
- package/dist/tag/root/tag-root.js +0 -25
- package/dist/text/root/text-root.css.js +0 -1
- package/dist/text/root/text-root.js +0 -48
- package/dist/textarea/root/textarea-root.css.js +0 -1
- package/dist/textarea/root/textarea-root.js +0 -17
- package/dist/time-input/root/time-input-root.css.js +0 -1
- package/dist/time-input/root/time-input-root.js +0 -31
- package/dist/time-picker/root/time-picker-root.css.js +0 -1
- package/dist/time-picker/root/time-picker-root.js +0 -29
- package/dist/timeline/item/timeline-item.css.js +0 -1
- package/dist/timeline/item/timeline-item.js +0 -17
- package/dist/timeline/root/timeline-root.css.js +0 -1
- package/dist/timeline/root/timeline-root.js +0 -15
- package/dist/toast/item/toast-item.css.js +0 -1
- package/dist/toast/item/toast-item.js +0 -21
- package/dist/toast/root/toast-root.css.js +0 -1
- package/dist/toast/root/toast-root.js +0 -27
- package/dist/toggle/group/toggle-group.css.js +0 -1
- package/dist/toggle/group/toggle-group.js +0 -25
- package/dist/toggle/root/toggle-root.css.js +0 -1
- package/dist/toggle/root/toggle-root.js +0 -18
- package/dist/toolbar/root/toolbar-root.css.js +0 -1
- package/dist/toolbar/root/toolbar-root.js +0 -19
- package/dist/tooltip/root/tooltip-root.css.js +0 -1
- package/dist/tooltip/root/tooltip-root.js +0 -22
- package/dist/tour/root/tour-root.css.js +0 -1
- package/dist/tour/root/tour-root.js +0 -14
- package/dist/tour/stop/tour-stop.css.js +0 -1
- package/dist/tour/stop/tour-stop.js +0 -22
- package/dist/tree/item/tree-item.css.js +0 -1
- package/dist/tree/item/tree-item.js +0 -34
- package/dist/tree/root/tree-root.css.js +0 -1
- package/dist/tree/root/tree-root.js +0 -27
- package/dist/trend/root/trend-root.css.js +0 -1
- package/dist/trend/root/trend-root.js +0 -34
- package/dist/video/root/video-root.css.js +0 -1
- package/dist/video/root/video-root.js +0 -37
- package/dist/video-playlist/item/video-playlist-item.css.js +0 -1
- package/dist/video-playlist/item/video-playlist-item.js +0 -15
- package/dist/video-playlist/menu/video-playlist-menu.css.js +0 -1
- package/dist/video-playlist/menu/video-playlist-menu.js +0 -36
- package/dist/video-playlist/root/video-playlist-root.css.js +0 -1
- package/dist/video-playlist/root/video-playlist-root.js +0 -16
- package/dist/virtual-list/root/virtual-list-root.css.js +0 -1
- package/dist/virtual-list/root/virtual-list-root.js +0 -21
- package/jsx.d.ts +1538 -2818
- package/package.json +7 -7
- package/vue.d.ts +3 -7
|
@@ -7,21 +7,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { customElement } from '@fusion.dev/helix-core';
|
|
8
8
|
import { HelixHeadlessQuote } from '@fusion.dev/helix-headless/quote';
|
|
9
9
|
import { styles } from './quote-root.css.js';
|
|
10
|
-
/**
|
|
11
|
-
* @summary A short quotation, set inline with the text around it.
|
|
12
|
-
*
|
|
13
|
-
* @description
|
|
14
|
-
* Takes the surrounding type rather than a size of its own, because a quotation
|
|
15
|
-
* inside a paragraph is that paragraph's text with marks around it.
|
|
16
|
-
*
|
|
17
|
-
* @since 0.1.0
|
|
18
|
-
* @status stable
|
|
19
|
-
* @category typography
|
|
20
|
-
* @aliases Q, InlineQuote
|
|
21
|
-
* @documentation https://helix.fusion.dev/components/quote
|
|
22
|
-
*
|
|
23
|
-
* @cssproperty --quote-color - Color of the quoted text.
|
|
24
|
-
*/
|
|
25
10
|
let HelixQuote = class HelixQuote extends HelixHeadlessQuote {
|
|
26
11
|
static { this.styles = styles; }
|
|
27
12
|
};
|
|
@@ -9,22 +9,6 @@ import { HelixHeadlessRadioGroup } from '@fusion.dev/helix-headless/radio';
|
|
|
9
9
|
import { styles as fieldStyles } from '../../shared/field/field.css.js';
|
|
10
10
|
import { styles as fieldStackedStyles } from '../../shared/field/field-stacked.css.js';
|
|
11
11
|
import { styles } from './radio-group.css.js';
|
|
12
|
-
/**
|
|
13
|
-
* @summary A set of choices where exactly one is the answer.
|
|
14
|
-
*
|
|
15
|
-
* @description
|
|
16
|
-
* The field's three parts, laid out the way every other field lays them out: a
|
|
17
|
-
* question over the set, and one line under it that is help until something is
|
|
18
|
-
* wrong. `orientation` lays out the choices and not the field, so a horizontal
|
|
19
|
-
* group keeps its question above the row rather than beside the first choice.
|
|
20
|
-
*
|
|
21
|
-
* @since 0.1.0
|
|
22
|
-
* @status experimental
|
|
23
|
-
* @aliases RadioButtons, Choice group
|
|
24
|
-
* @documentation https://helix.fusion.dev/components/radio-group
|
|
25
|
-
*
|
|
26
|
-
* @cssproperty --radio-group-gap - Space between the choices.
|
|
27
|
-
*/
|
|
28
12
|
let HelixRadioGroup = class HelixRadioGroup extends HelixHeadlessRadioGroup {
|
|
29
13
|
static { this.styles = [fieldStyles, fieldStackedStyles, styles]; }
|
|
30
14
|
};
|
|
@@ -8,55 +8,9 @@ import { customElement } from '@fusion.dev/helix-core';
|
|
|
8
8
|
import { HelixHeadlessRadio } from '@fusion.dev/helix-headless/radio';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import { styles } from './radio-root.css.js';
|
|
11
|
-
/**
|
|
12
|
-
* @summary One choice in a radio group.
|
|
13
|
-
*
|
|
14
|
-
* @description
|
|
15
|
-
* A circle with a dot in it, drawn here rather than by the browser for the
|
|
16
|
-
* reason the checkbox's box is: this is a `<button role="radio">`, so there was
|
|
17
|
-
* never a native control to restyle, and the weight and the motion of the mark
|
|
18
|
-
* are ours either way.
|
|
19
|
-
*
|
|
20
|
-
* The dot scales from nothing, like the checkbox's tick, so choosing shows
|
|
21
|
-
* something happening. It has no color, because color is reserved for state
|
|
22
|
-
* and being chosen is an answer rather than a state.
|
|
23
|
-
*
|
|
24
|
-
* @since 0.1.0
|
|
25
|
-
* @status experimental
|
|
26
|
-
* @category forms
|
|
27
|
-
* @aliases Option, Choice
|
|
28
|
-
* @documentation https://helix.fusion.dev/components/radio
|
|
29
|
-
*
|
|
30
|
-
* @cssproperty --radio-background-color - Fill of an unselected circle.
|
|
31
|
-
* @cssproperty --radio-border-color - Edge of the circle, in every state.
|
|
32
|
-
* @cssproperty --radio-card-background-color - Fill behind a card-shaped choice.
|
|
33
|
-
* @cssproperty --radio-card-border-color - Edge around one.
|
|
34
|
-
* @cssproperty --radio-card-padding - Inset of the card appearance.
|
|
35
|
-
* @cssproperty --radio-chip-size - Diameter of the chip appearance.
|
|
36
|
-
* @cssproperty --radio-mark-color - Color of the dot.
|
|
37
|
-
* @cssproperty --radio-size - Diameter of the circle.
|
|
38
|
-
*/
|
|
39
11
|
let HelixRadio = class HelixRadio extends HelixHeadlessRadio {
|
|
40
12
|
constructor() {
|
|
41
13
|
super(...arguments);
|
|
42
|
-
/**
|
|
43
|
-
* Takes the circle away, leaving the card as the whole control.
|
|
44
|
-
*
|
|
45
|
-
* Unnecessary under `chip`, which has no room for a circle beside its mark
|
|
46
|
-
* and hides it already.
|
|
47
|
-
*
|
|
48
|
-
* `card` only, and it is a graphic that goes rather than a radio: the control
|
|
49
|
-
* in the shadow root is untouched, so the row is still focusable, still
|
|
50
|
-
* reported to a screen reader, and still the thing a form submits.
|
|
51
|
-
*
|
|
52
|
-
* Safe because the card already carries the answer in its surface, a raised
|
|
53
|
-
* fill inside a primary edge and a three-pixel ring of it. Without that ring
|
|
54
|
-
* nothing would be left saying which card was chosen.
|
|
55
|
-
*
|
|
56
|
-
* Not on `Checkbox`, deliberately. A radio card with no circle is still
|
|
57
|
-
* unmistakably one-of-many because its siblings behave that way; a checkbox
|
|
58
|
-
* card with no box loses the only thing that says you may pick several.
|
|
59
|
-
*/
|
|
60
14
|
this.hideControl = false;
|
|
61
15
|
}
|
|
62
16
|
static { this.styles = styles; }
|
|
@@ -8,28 +8,6 @@ import { customElement } from '@fusion.dev/helix-core';
|
|
|
8
8
|
import { HelixHeadlessRating } from '@fusion.dev/helix-headless/rating';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import { styles } from './rating-root.css.js';
|
|
11
|
-
/**
|
|
12
|
-
* @summary A score out of a few marks, given or shown.
|
|
13
|
-
*
|
|
14
|
-
* @description
|
|
15
|
-
* Presentation only: the marks, and the clip that fills them partway.
|
|
16
|
-
* Everything about what the score is and how it is chosen is the base class.
|
|
17
|
-
*
|
|
18
|
-
* @since 0.1.0
|
|
19
|
-
* @status experimental
|
|
20
|
-
* @category forms
|
|
21
|
-
* @aliases Stars, Score, Review score
|
|
22
|
-
* @documentation https://helix.fusion.dev/components/rating
|
|
23
|
-
*
|
|
24
|
-
* @slot mark - The shape of a mark, cloned into every position. Left empty, the
|
|
25
|
-
* stylesheet draws its own and `--rating-mark` swaps it.
|
|
26
|
-
*
|
|
27
|
-
* @cssproperty --rating-color - The color of a filled mark.
|
|
28
|
-
* @cssproperty --rating-empty-color - And of an unfilled one.
|
|
29
|
-
* @cssproperty --rating-gap - Space between marks.
|
|
30
|
-
* @cssproperty --rating-mark - The shape of one mark, as a mask image.
|
|
31
|
-
* @cssproperty --rating-size - How big one mark is.
|
|
32
|
-
*/
|
|
33
11
|
let HelixRating = class HelixRating extends HelixHeadlessRating {
|
|
34
12
|
static { this.styles = styles; }
|
|
35
13
|
};
|
package/dist/sandbox/index.js
CHANGED
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The sandbox: a preview that runs what it is given, and the panes around it.
|
|
3
|
-
*
|
|
4
|
-
* The editor is deliberately absent and lives on in `@fusion.dev/helix-editor`, because
|
|
5
|
-
* it carries CodeMirror. That is roughly 4 MB installed against a design system
|
|
6
|
-
* of about the same size, and a `dependencies` entry is paid at install time by
|
|
7
|
-
* every consumer whether or not they import it, which is the one cost a subpath
|
|
8
|
-
* export cannot avoid. Its pane takes an editor by slot, so bringing one is a
|
|
9
|
-
* choice rather than a condition of using this.
|
|
10
|
-
*
|
|
11
|
-
* What makes this a sandbox rather than a layout is here: `Sandbox.Preview`
|
|
12
|
-
* hardcodes `sandbox="allow-scripts allow-forms"` on its frame and never
|
|
13
|
-
* `allow-same-origin`, which is the pairing that would undo it.
|
|
14
|
-
*/
|
|
15
1
|
export * from './preview/sandbox-preview.js';
|
|
16
2
|
export * from './root/sandbox-root.js';
|
|
17
3
|
export * from './source/sandbox-source.js';
|
|
@@ -6,133 +6,22 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
var HelixSandboxPreview_1;
|
|
8
8
|
import { customElement, HelixConsoleEvent, HelixElement, HelixResizeEvent, } from '@fusion.dev/helix-core';
|
|
9
|
-
/**
|
|
10
|
-
* How long the source has to stop changing before the frame is asked to render,
|
|
11
|
-
* in milliseconds.
|
|
12
|
-
*
|
|
13
|
-
* Long enough that a run of keystrokes is one render, short enough that letting
|
|
14
|
-
* go of the keyboard and looking up finds the preview already there.
|
|
15
|
-
*/
|
|
16
9
|
const SETTLE = 120;
|
|
17
10
|
import { html } from 'lit';
|
|
18
11
|
import { property } from 'lit/decorators.js';
|
|
19
12
|
import { styles as sheet } from './sandbox-preview.css.js';
|
|
20
|
-
/**
|
|
21
|
-
* @summary Renders sandbox source in a frame of its own.
|
|
22
|
-
*
|
|
23
|
-
* @description
|
|
24
|
-
* A sandboxed `<iframe>` pointed at `src`, which is a document the consumer
|
|
25
|
-
* provides. That document imports whatever the examples need, listens for a
|
|
26
|
-
* render message, and writes the markup into itself.
|
|
27
|
-
*
|
|
28
|
-
* **A frame rather than the page.** Rendering into the page meant an example
|
|
29
|
-
* was styled by whatever surrounded it, which flatters the preview and lies
|
|
30
|
-
* about it: an example that restyles `helix-card` restyled the sandbox too, a
|
|
31
|
-
* script in an example ran against the real document, and a stray
|
|
32
|
-
* `position: fixed` escaped the pane. It also left nothing to capture console
|
|
33
|
-
* output from, and the terminal has to come from somewhere.
|
|
34
|
-
*
|
|
35
|
-
* The cost is that the frame starts empty. Styles and element definitions do
|
|
36
|
-
* not cross into it, because a document has its own stylesheets and a window
|
|
37
|
-
* has its own custom element registry, so `src` has to load them. That is the
|
|
38
|
-
* consumer's document rather than something guessed at here.
|
|
39
|
-
*
|
|
40
|
-
* **The source is not trusted, and the frame is what makes that safe.**
|
|
41
|
-
* `sandbox="allow-scripts"` and no `allow-same-origin`, so the document runs on
|
|
42
|
-
* an opaque origin: script in an example cannot reach this page, its storage,
|
|
43
|
-
* its cookies, or the editor the source was typed into. Without it they could,
|
|
44
|
-
* measured, through an `onerror` handler on an image that fails to load, which
|
|
45
|
-
* `innerHTML` does not strip the way it refuses a `<script>` tag. That is what
|
|
46
|
-
* lets a sandbox hold markup a reader pasted from somewhere, or one day arrived
|
|
47
|
-
* in a shared link, rather than only what its owner typed.
|
|
48
|
-
*
|
|
49
|
-
* `allow-forms` is granted because examples have forms in them and a submit
|
|
50
|
-
* that silently does nothing is a worse lie than one that navigates a frame
|
|
51
|
-
* nobody is looking at. Top-level navigation, popups and modals are not.
|
|
52
|
-
*
|
|
53
|
-
* **`allow="clipboard-write *; fullscreen *"`, and the stars matter.** Both
|
|
54
|
-
* policies default to `self`, and a frame on an opaque origin is not `self`, so
|
|
55
|
-
* the default denies both: a component that copies to the clipboard and a video
|
|
56
|
-
* offering a fullscreen button each become a control that silently does nothing,
|
|
57
|
-
* a denied request rejecting a promise nobody was watching. Nothing else is
|
|
58
|
-
* granted, and a copy still needs the reader's own gesture.
|
|
59
|
-
*
|
|
60
|
-
* @since 0.1.0
|
|
61
|
-
* @status experimental
|
|
62
|
-
* @aliases Result, Output
|
|
63
|
-
* @documentation https://helix.fusion.dev/sandbox/preview
|
|
64
|
-
*
|
|
65
|
-
* @event {HelixConsoleEvent} helix-console - Relayed from the frame, one per console call.
|
|
66
|
-
* @event {HelixResizeEvent} helix-resize - How tall the frame's content is, whenever it changes.
|
|
67
|
-
*
|
|
68
|
-
* @csspart frame - The iframe.
|
|
69
|
-
*/
|
|
70
13
|
let HelixSandboxPreview = class HelixSandboxPreview extends HelixElement {
|
|
71
14
|
constructor() {
|
|
72
15
|
super(...arguments);
|
|
73
|
-
/**
|
|
74
|
-
* Accessible name for the frame.
|
|
75
|
-
*/
|
|
76
16
|
this.label = 'Preview';
|
|
77
|
-
/**
|
|
78
|
-
* Markup to render.
|
|
79
|
-
*/
|
|
80
17
|
this.source = '';
|
|
81
|
-
/**
|
|
82
|
-
* Document the frame loads, which brings the styles and the elements.
|
|
83
|
-
*/
|
|
84
18
|
this.src = '';
|
|
85
|
-
/**
|
|
86
|
-
* Stylesheet applied inside the frame, alongside the markup.
|
|
87
|
-
*/
|
|
88
19
|
this.styles = '';
|
|
89
|
-
/** Whether the frame has said it is listening. */
|
|
90
20
|
this.ready = false;
|
|
91
|
-
/**
|
|
92
|
-
* The frame's document has finished loading, so its listener exists.
|
|
93
|
-
*
|
|
94
|
-
* **The announcement is one shot and the parent can miss it.** The frame posts
|
|
95
|
-
* `helix-preview-ready` at the end of its own module evaluation and never
|
|
96
|
-
* repeats it, and `handleMessage` drops anything whose `source` is not
|
|
97
|
-
* `this.frame?.contentWindow`. That getter reads the render root, so it is
|
|
98
|
-
* null until this element has rendered once: a frame that loads before that
|
|
99
|
-
* render commits announces into a guard that refuses it, `ready` stays false,
|
|
100
|
-
* and `send` returns early forever, leaving the source set, the markup
|
|
101
|
-
* correct, and the preview blank with nothing logged.
|
|
102
|
-
*
|
|
103
|
-
* **It is a race, so it hides in the one place nobody looks.** The frame is
|
|
104
|
-
* only fast enough to win when its document and its bundle are already in the
|
|
105
|
-
* HTTP cache, which is a client-side navigation and never a cold load.
|
|
106
|
-
* Measured on the theme builder reached by clicking a link: `ready` false, a
|
|
107
|
-
* 9,382 character `source` in place, and an empty preview, where the same
|
|
108
|
-
* page loaded directly rendered correctly.
|
|
109
|
-
*
|
|
110
|
-
* `load` closes it without a retry protocol and without weakening either
|
|
111
|
-
* check on the way in. The frame's script is `defer`, so it has run by the
|
|
112
|
-
* time this fires, which makes the event a guarantee that the listener is
|
|
113
|
-
* there rather than a guess that it might be. The message path stays, because
|
|
114
|
-
* it is the one that works when the frame is slower than the render, and
|
|
115
|
-
* either arriving is enough.
|
|
116
|
-
*/
|
|
117
21
|
this.handleFrameLoad = () => {
|
|
118
22
|
this.ready = true;
|
|
119
23
|
this.send();
|
|
120
24
|
};
|
|
121
|
-
/**
|
|
122
|
-
* Takes messages from the frame.
|
|
123
|
-
*
|
|
124
|
-
* Two checks, and both earn their place.
|
|
125
|
-
*
|
|
126
|
-
* The window is the identity: `event.source` is a reference the sender cannot
|
|
127
|
-
* forge, and this frame's `contentWindow` is one only this element holds.
|
|
128
|
-
*
|
|
129
|
-
* The origin has to be opaque. The frame is sandboxed, so every message it
|
|
130
|
-
* sends arrives as `"null"`, measured. A real origin therefore means the
|
|
131
|
-
* frame is no longer showing the document it was given: `allow-scripts` lets
|
|
132
|
-
* an example navigate its own frame, and whatever it navigated to inherits
|
|
133
|
-
* `contentWindow` and could otherwise write lines into the terminal as though
|
|
134
|
-
* the example had logged them.
|
|
135
|
-
*/
|
|
136
25
|
this.handleMessage = (event) => {
|
|
137
26
|
if (event.source !== this.frame?.contentWindow || event.origin !== 'null') {
|
|
138
27
|
return;
|
|
@@ -145,34 +34,9 @@ let HelixSandboxPreview = class HelixSandboxPreview extends HelixElement {
|
|
|
145
34
|
if (event.data?.type === 'helix-preview-console') {
|
|
146
35
|
this.dispatchEvent(new HelixConsoleEvent({ level: event.data.level, text: event.data.text }));
|
|
147
36
|
}
|
|
148
|
-
/* **A press in the frame, put back into the page as a press.**
|
|
149
|
-
*
|
|
150
|
-
* The frame is on an opaque origin, which is the point of it, and a
|
|
151
|
-
* consequence is that a press inside is invisible outside: the event does
|
|
152
|
-
* not cross the boundary, the document cannot listen to a document it may
|
|
153
|
-
* not touch, and in WebKit the press moves no focus and blurs no window
|
|
154
|
-
* either, so there is nothing at all to infer it from. Measured: with the
|
|
155
|
-
* sandbox's settings menu open, pressing the component it configures left
|
|
156
|
-
* the menu standing over it, and the only way out was Escape or the trigger.
|
|
157
|
-
*
|
|
158
|
-
* So the frame reports it and this element re-states it where the page can
|
|
159
|
-
* hear it. A real `pointerdown` rather than a name of our own, because
|
|
160
|
-
* every light-dismiss in the library — and every one a consumer wrote —
|
|
161
|
-
* already listens for exactly that, and what happened *was* a press. It
|
|
162
|
-
* carries no coordinates for the reason the message does not: this element
|
|
163
|
-
* is where it happened, as far as the page is concerned.
|
|
164
|
-
*
|
|
165
|
-
* `composed` so it leaves whatever shadow root this element sits in, which
|
|
166
|
-
* is how those listeners find it in the path.
|
|
167
|
-
*/
|
|
168
37
|
if (event.data?.type === 'helix-preview-press') {
|
|
169
38
|
this.dispatchEvent(new PointerEvent('pointerdown', { bubbles: true, composed: true }));
|
|
170
39
|
}
|
|
171
|
-
/* Relayed rather than acted on. What the frame measured is a fact about the
|
|
172
|
-
example; how much room to give it is a decision, and it belongs to
|
|
173
|
-
whatever laid this element out. A preview that resized itself would be
|
|
174
|
-
deciding for the page it sits in, and the workbench and a reference page
|
|
175
|
-
want opposite things from the same number. */
|
|
176
40
|
if (event.data?.type === 'helix-preview-size') {
|
|
177
41
|
this.dispatchEvent(new HelixResizeEvent({ size: event.data.size }));
|
|
178
42
|
}
|
|
@@ -182,26 +46,7 @@ let HelixSandboxPreview = class HelixSandboxPreview extends HelixElement {
|
|
|
182
46
|
get frame() {
|
|
183
47
|
return this.renderRoot.querySelector('iframe');
|
|
184
48
|
}
|
|
185
|
-
/**
|
|
186
|
-
* Where messages to the frame are addressed.
|
|
187
|
-
*
|
|
188
|
-
* `'*'`, because there is nothing else to say: a sandboxed document has an
|
|
189
|
-
* opaque origin and `postMessage` has no target string that names one.
|
|
190
|
-
*
|
|
191
|
-
* It costs nothing. What is sent is the example's own source and stylesheet,
|
|
192
|
-
* to the document that is about to render them, and that document is the one
|
|
193
|
-
* thing on the page already entitled to both.
|
|
194
|
-
*/
|
|
195
49
|
static { this.target = '*'; }
|
|
196
|
-
/**
|
|
197
|
-
* Sends once the typing stops, replacing anything already waiting.
|
|
198
|
-
*
|
|
199
|
-
* A frame is the wrong unit. Keystrokes arrive fifty to a hundred and fifty
|
|
200
|
-
* milliseconds apart, so each one lands in a frame of its own and coalescing
|
|
201
|
-
* by frame coalesces nothing, leaving the example rebuilt per character. The
|
|
202
|
-
* delay has to be longer than the gap between keystrokes to catch a burst, and
|
|
203
|
-
* short enough to read as immediate when the typing stops.
|
|
204
|
-
*/
|
|
205
50
|
scheduleSend() {
|
|
206
51
|
clearTimeout(this.pending);
|
|
207
52
|
this.pending = setTimeout(() => {
|
|
@@ -209,7 +54,6 @@ let HelixSandboxPreview = class HelixSandboxPreview extends HelixElement {
|
|
|
209
54
|
this.send();
|
|
210
55
|
}, SETTLE);
|
|
211
56
|
}
|
|
212
|
-
/** Sends the current source to the frame, once it is listening. */
|
|
213
57
|
send() {
|
|
214
58
|
if (!this.ready) {
|
|
215
59
|
return;
|
|
@@ -234,20 +78,6 @@ let HelixSandboxPreview = class HelixSandboxPreview extends HelixElement {
|
|
|
234
78
|
this.pending = undefined;
|
|
235
79
|
window.removeEventListener('message', this.handleMessage);
|
|
236
80
|
}
|
|
237
|
-
/**
|
|
238
|
-
* Loads the frame's document again, and re-sends the example to it.
|
|
239
|
-
*
|
|
240
|
-
* For a bundle that has changed underneath a page nobody reloaded. The frame
|
|
241
|
-
* carries its own build of the component library, as a classic script it ran
|
|
242
|
-
* once at load, so a rebuilt bundle reaches a tab that is already open
|
|
243
|
-
* exactly never: the sandbox around it hot-reloads and the preview inside it
|
|
244
|
-
* keeps running whatever it started with, which reads as a component fix that
|
|
245
|
-
* did not work.
|
|
246
|
-
*
|
|
247
|
-
* Nothing needs to be resent by the caller. Clearing `ready` and reassigning
|
|
248
|
-
* `src` puts this back in the state it was in before the first load, and the
|
|
249
|
-
* new document announces itself the same way the first one did.
|
|
250
|
-
*/
|
|
251
81
|
reload() {
|
|
252
82
|
const frame = this.frame;
|
|
253
83
|
if (!frame) {
|
|
@@ -258,22 +88,10 @@ let HelixSandboxPreview = class HelixSandboxPreview extends HelixElement {
|
|
|
258
88
|
}
|
|
259
89
|
updated(changed) {
|
|
260
90
|
super.updated(changed);
|
|
261
|
-
// A new document has to say it is listening again before anything is sent.
|
|
262
91
|
if (changed.has('src')) {
|
|
263
92
|
this.ready = false;
|
|
264
93
|
return;
|
|
265
94
|
}
|
|
266
|
-
/* Typing is coalesced; a setting is not.
|
|
267
|
-
*
|
|
268
|
-
* The frame renders by assigning `innerHTML`, which throws away the example
|
|
269
|
-
* and builds it again, and every custom element in it disconnects and
|
|
270
|
-
* upgrades a second time. Sent on each update that is once per keystroke,
|
|
271
|
-
* and the work grows with the example while the typing does not.
|
|
272
|
-
*
|
|
273
|
-
* `SETTLE` is short enough to feel immediate and long enough that a burst of
|
|
274
|
-
* keystrokes is one render. Layout, direction and the color mode go
|
|
275
|
-
* straight out: they arrive one at a time from a menu, there is nothing to
|
|
276
|
-
* coalesce, and a delay there is a delay a reader can see. */
|
|
277
95
|
if (changed.has('source') || changed.has('styles')) {
|
|
278
96
|
this.scheduleSend();
|
|
279
97
|
return;
|