spell-ui 0.8.6 → 0.8.8
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/README-components.md +14 -6
- package/README-frameworks.md +22 -12
- package/README-migrating.md +7 -6
- package/README-runtime.md +14 -13
- package/README-site.md +11 -11
- package/README-themes.md +38 -11
- package/README.md +61 -73
- package/dist/Dragging-CMZoLEWQ.js +169 -0
- package/dist/Dragging-CMZoLEWQ.js.map +1 -0
- package/dist/{MarkdownEngine-CbuT9Mjc.js → MarkdownEngine-CW1WGqNp.js} +122 -100
- package/dist/MarkdownEngine-CW1WGqNp.js.map +1 -0
- package/dist/{PrefStore-CeaTtjTz.js → PrefStore-Qv0e5y04.js} +22 -22
- package/dist/PrefStore-Qv0e5y04.js.map +1 -0
- package/dist/ScrollingRow-7n7Z-HIE.js +88 -0
- package/dist/ScrollingRow-7n7Z-HIE.js.map +1 -0
- package/dist/SitePages-CciwREek.js +51 -0
- package/dist/SitePages-CciwREek.js.map +1 -0
- package/dist/{SlottedItems-Ch0tzzlL.js → SlottedItems-Du3aJwG1.js} +22 -22
- package/dist/{SlottedItems-Ch0tzzlL.js.map → SlottedItems-Du3aJwG1.js.map} +1 -1
- package/dist/ThemeDraft-B7NPif4d.js +805 -0
- package/dist/ThemeDraft-B7NPif4d.js.map +1 -0
- package/dist/TreeMeasure-BVJeGb1L.js +42 -0
- package/dist/TreeMeasure-BVJeGb1L.js.map +1 -0
- package/dist/UIButton-DFEds67r.js +6 -0
- package/dist/UIButton-DFEds67r.js.map +1 -0
- package/dist/UIInput-BodVbUoQ.js +6 -0
- package/dist/UIInput-BodVbUoQ.js.map +1 -0
- package/dist/{UIKeys-DJF2TIKE.js → UIKeys-Rh_gUZjP.js} +10 -9
- package/dist/UIKeys-Rh_gUZjP.js.map +1 -0
- package/dist/UILabel-DgJUBzB_.js +6 -0
- package/dist/UILabel-DgJUBzB_.js.map +1 -0
- package/dist/UIMenu-zdcAtwTa.js +42 -0
- package/dist/UIMenu-zdcAtwTa.js.map +1 -0
- package/dist/{UIRuntime-BBuehGly.js → UIRuntime-KH309p5B.js} +398 -207
- package/dist/UIRuntime-KH309p5B.js.map +1 -0
- package/dist/_spell-element/DOMElement.d.ts +62 -5
- package/dist/_spell-element/MoveAndResize.d.ts +75 -0
- package/dist/_spell-element/UIComponent.d.ts +42 -0
- package/dist/_spell-element/elements.types.d.ts +47 -0
- package/dist/_spell-element/index.d.ts +1 -0
- package/dist/_spell-element/vocabulary.types.d.ts +34 -2
- package/dist/{runtime → _util}/Api.d.ts +14 -4
- package/dist/_util/Dragging.d.ts +148 -0
- package/dist/_util/ListSelection.d.ts +46 -0
- package/dist/{util → _util}/LoadOnce.d.ts +9 -1
- package/dist/_util/ReconnectingSocket.d.ts +51 -0
- package/dist/_util/diagram/DiagramColumns.d.ts +14 -0
- package/dist/_util/diagram/DiagramLayout.d.ts +119 -0
- package/dist/_util/diagram/DiagramSVG.d.ts +17 -0
- package/dist/_util/dom.d.ts +10 -0
- package/dist/_util/fetching.d.ts +92 -0
- package/dist/_util/measures/Dimension.d.ts +63 -0
- package/dist/_util/measures/MeasureSystem.d.ts +66 -0
- package/dist/_util/measures/dimensions.generated.d.ts +16 -0
- package/dist/_util/persist/ColorScheme.d.ts +6 -0
- package/dist/_util/persist/ServerPlace.d.ts +42 -0
- package/dist/_util/persist/WaitedOnPlace.d.ts +27 -0
- package/dist/_util/persist/persist.types.d.ts +21 -2
- package/dist/_util/timing.d.ts +10 -1
- package/dist/api.js +8 -7
- package/dist/api.js.map +1 -1
- package/dist/components/ComponentDefinitions.d.ts +29 -0
- package/dist/components/components.es.d.ts +13 -0
- package/dist/components/components.types.d.ts +113 -8
- package/dist/components/ui-accordion/UIAccordion.d.ts +1 -0
- package/dist/components/ui-accordion/UIAccordion.en.d.ts +1 -0
- package/dist/components/ui-action/UIAction.en.d.ts +5 -1
- package/dist/components/ui-ad/UIAd.d.ts +1 -0
- package/dist/components/ui-ad/UIAd.en.d.ts +1 -0
- package/dist/components/ui-breadcrumbs/UIBreadcrumb.d.ts +1 -0
- package/dist/components/ui-breadcrumbs/UIBreadcrumb.en.d.ts +1 -0
- package/dist/components/ui-breadcrumbs/UIBreadcrumbs.d.ts +1 -0
- package/dist/components/ui-breadcrumbs/UIBreadcrumbs.en.d.ts +1 -0
- package/dist/components/ui-button/UIButton.d.ts +8 -3
- package/dist/components/ui-button/UIButton.en.d.ts +9 -4
- package/dist/components/ui-button/UIButton.es.d.ts +6 -0
- package/dist/components/ui-button/UIButton.fallback.d.ts +8 -3
- package/dist/components/ui-button/UIButtons.d.ts +1 -0
- package/dist/components/ui-button/UIButtons.en.d.ts +1 -0
- package/dist/components/ui-button/UIOr.d.ts +1 -0
- package/dist/components/ui-button/UIOr.en.d.ts +1 -0
- package/dist/components/ui-calendar/UICalendar.d.ts +6 -0
- package/dist/components/ui-calendar/UICalendar.en.d.ts +6 -0
- package/dist/components/ui-calendar/UICalendar.fallback.d.ts +6 -0
- package/dist/components/ui-card/CardClicks.d.ts +40 -0
- package/dist/components/ui-card/UICard.d.ts +41 -0
- package/dist/components/ui-card/UICard.en.d.ts +49 -0
- package/dist/components/ui-card/UICard.es.d.ts +1 -0
- package/dist/components/ui-card/UICards.d.ts +31 -0
- package/dist/components/ui-card/UICards.en.d.ts +31 -0
- package/dist/components/ui-card/UICards.es.d.ts +8 -0
- package/dist/components/ui-checkbox/CheckControl.d.ts +7 -0
- package/dist/components/ui-checkbox/UICheckbox.d.ts +7 -0
- package/dist/components/ui-checkbox/UICheckbox.en.d.ts +7 -0
- package/dist/components/ui-checkbox/UICheckbox.es.d.ts +1 -0
- package/dist/components/ui-checkbox/UICheckbox.fallback.d.ts +7 -0
- package/dist/components/ui-checkbox/UICheckbox.types.d.ts +5 -0
- package/dist/components/ui-checkbox/UIRadio.d.ts +8 -0
- package/dist/components/ui-checkbox/UIRadio.en.d.ts +6 -0
- package/dist/components/ui-code/UICode.en.d.ts +1 -0
- package/dist/components/ui-comment/UIComment.d.ts +1 -0
- package/dist/components/ui-comment/UIComment.en.d.ts +1 -0
- package/dist/components/ui-comment/UIComments.d.ts +1 -0
- package/dist/components/ui-comment/UIComments.en.d.ts +1 -0
- package/dist/components/ui-components/PackHotSwap.d.ts +13 -3
- package/dist/components/ui-components/UIComponents.d.ts +1 -0
- package/dist/components/ui-components/UIComponents.en.d.ts +1 -0
- package/dist/components/ui-container/UIContainer.d.ts +11 -0
- package/dist/components/ui-container/UIContainer.en.d.ts +7 -0
- package/dist/components/ui-container/UIContainer.es.d.ts +1 -0
- package/dist/components/ui-diagram/UIDiagram.d.ts +268 -0
- package/dist/components/ui-diagram/UIDiagram.en.d.ts +106 -0
- package/dist/components/ui-diagram/UIDiagram.es.d.ts +37 -0
- package/dist/components/ui-diagram/UIDiagramNode.d.ts +98 -0
- package/dist/components/ui-diagram/UIDiagramNode.en.d.ts +38 -0
- package/dist/components/ui-diagram/UIDiagramNode.es.d.ts +16 -0
- package/dist/components/ui-diagram/index.d.ts +8 -0
- package/dist/components/ui-dimension/UIDimension.d.ts +81 -0
- package/dist/components/ui-dimension/UIDimension.en.d.ts +54 -0
- package/dist/components/ui-dimension/UIDimension.es.d.ts +22 -0
- package/dist/components/ui-dimension/index.d.ts +2 -0
- package/dist/components/ui-dimmer/UIDimmer.d.ts +6 -1
- package/dist/components/ui-dimmer/UIDimmer.en.d.ts +1 -0
- package/dist/components/ui-dimmer/UIDimmer.es.d.ts +1 -1
- package/dist/components/ui-divider/UIDivider.d.ts +2 -0
- package/dist/components/ui-divider/UIDivider.en.d.ts +2 -0
- package/dist/components/ui-divider/UIDivider.es.d.ts +1 -0
- package/dist/components/ui-dropdown/UIDropdown.d.ts +6 -0
- package/dist/components/ui-dropdown/UIDropdown.en.d.ts +6 -0
- package/dist/components/ui-dropdown/UIDropdown.fallback.d.ts +6 -0
- package/dist/components/ui-embed/UIEmbed.d.ts +1 -0
- package/dist/components/ui-embed/UIEmbed.en.d.ts +1 -0
- package/dist/components/ui-emoji/UIEmoji.d.ts +1 -0
- package/dist/components/ui-emoji/UIEmoji.en.d.ts +1 -0
- package/dist/components/ui-example/UIExample.en.d.ts +4 -2
- package/dist/components/ui-example/UIExample.es.d.ts +3 -2
- package/dist/components/ui-feed/UIFeed.d.ts +1 -0
- package/dist/components/ui-feed/UIFeed.en.d.ts +1 -0
- package/dist/components/ui-feed/UIFeedEvent.d.ts +1 -0
- package/dist/components/ui-feed/UIFeedEvent.en.d.ts +1 -0
- package/dist/components/ui-flag/UIFlag.d.ts +1 -0
- package/dist/components/ui-flag/UIFlag.en.d.ts +1 -0
- package/dist/components/ui-flyout/UIFlyout.d.ts +1 -0
- package/dist/components/ui-flyout/UIFlyout.en.d.ts +1 -0
- package/dist/components/ui-form/FormBinding.d.ts +13 -1
- package/dist/components/ui-form/FormFields.d.ts +4 -4
- package/dist/components/ui-form/UIField.d.ts +30 -3
- package/dist/components/ui-form/UIField.en.d.ts +9 -0
- package/dist/components/ui-form/UIField.es.d.ts +6 -0
- package/dist/components/ui-form/UIFields.d.ts +1 -0
- package/dist/components/ui-form/UIFields.en.d.ts +1 -0
- package/dist/components/ui-form/UIForm.d.ts +15 -0
- package/dist/components/ui-form/UIForm.en.d.ts +6 -0
- package/dist/components/ui-form/UIRepeat.d.ts +1 -0
- package/dist/components/ui-form/UIRepeat.en.d.ts +1 -0
- package/dist/components/ui-form/index.d.ts +2 -1
- package/dist/components/ui-grid/UIColumn.d.ts +1 -0
- package/dist/components/ui-grid/UIColumn.en.d.ts +1 -0
- package/dist/components/ui-grid/UIGrid.d.ts +1 -0
- package/dist/components/ui-grid/UIGrid.en.d.ts +1 -0
- package/dist/components/ui-grid/UIRow.d.ts +1 -0
- package/dist/components/ui-grid/UIRow.en.d.ts +1 -0
- package/dist/components/ui-icon/UIIcon.d.ts +3 -2
- package/dist/components/ui-icon/UIIcon.en.d.ts +3 -2
- package/dist/components/ui-icon/UIIcons.d.ts +1 -0
- package/dist/components/ui-icon/UIIcons.en.d.ts +1 -0
- package/dist/components/ui-icon-picker/UIIconPicker.d.ts +6 -0
- package/dist/components/ui-icon-picker/UIIconPicker.en.d.ts +6 -0
- package/dist/components/ui-icon-picker/UIIconPicker.fallback.d.ts +6 -0
- package/dist/components/ui-image/UIImage.d.ts +34 -0
- package/dist/components/ui-image/UIImage.en.d.ts +23 -0
- package/dist/components/ui-image/UIImage.es.d.ts +2 -0
- package/dist/components/ui-image/UIImages.d.ts +1 -0
- package/dist/components/ui-image/UIImages.en.d.ts +1 -0
- package/dist/components/ui-include/UIInclude.d.ts +1 -0
- package/dist/components/ui-include/UIInclude.en.d.ts +1 -0
- package/dist/components/ui-input/TextControl.d.ts +7 -0
- package/dist/components/ui-input/UIInput.d.ts +22 -3
- package/dist/components/ui-input/UIInput.en.d.ts +9 -2
- package/dist/components/ui-input/UIInput.es.d.ts +2 -0
- package/dist/components/ui-input/UIInput.fallback.d.ts +9 -2
- package/dist/components/ui-input/UITextarea.d.ts +20 -0
- package/dist/components/ui-input/UITextarea.en.d.ts +15 -0
- package/dist/components/ui-input/UITextarea.es.d.ts +4 -0
- package/dist/components/ui-item/UIItem.d.ts +27 -4
- package/dist/components/ui-item/UIItem.en.d.ts +5 -1
- package/dist/components/ui-items/UIItems.d.ts +1 -0
- package/dist/components/ui-items/UIItems.en.d.ts +1 -0
- package/dist/components/ui-json/JsonChild.d.ts +30 -0
- package/dist/components/ui-json/UIJson.d.ts +128 -0
- package/dist/components/ui-json/UIJson.en.d.ts +71 -0
- package/dist/components/ui-json/UIJson.es.d.ts +12 -0
- package/dist/components/ui-json/index.d.ts +3 -0
- package/dist/components/ui-keys/UIKeys.d.ts +1 -0
- package/dist/components/ui-keys/UIKeys.en.d.ts +1 -0
- package/dist/components/ui-label/UILabel.d.ts +2 -0
- package/dist/components/ui-label/UILabel.en.d.ts +2 -0
- package/dist/components/ui-label/UILabel.es.d.ts +1 -0
- package/dist/components/ui-label/UILabels.d.ts +1 -0
- package/dist/components/ui-label/UILabels.en.d.ts +1 -0
- package/dist/components/ui-list/UIList.d.ts +2 -0
- package/dist/components/ui-list/UIList.en.d.ts +2 -0
- package/dist/components/ui-list/UIList.es.d.ts +1 -0
- package/dist/components/ui-loader/UILoader.d.ts +1 -0
- package/dist/components/ui-loader/UILoader.en.d.ts +1 -0
- package/dist/components/ui-markdown/MarkdownBox.d.ts +143 -0
- package/dist/components/ui-markdown/MarkdownEngine.d.ts +14 -2
- package/dist/components/ui-markdown/MarkdownFormats.d.ts +95 -0
- package/dist/components/ui-markdown/MarkdownSource.d.ts +57 -0
- package/dist/components/ui-markdown/UIMarkdown.d.ts +126 -6
- package/dist/components/ui-markdown/UIMarkdown.en.d.ts +111 -8
- package/dist/components/ui-markdown/UIMarkdown.es.d.ts +29 -1
- package/dist/components/ui-markdown/UIMarkdown.types.d.ts +26 -0
- package/dist/components/ui-menu/ScrollingRow.d.ts +79 -0
- package/dist/components/ui-menu/TitleFit.d.ts +3 -0
- package/dist/components/ui-menu/UIMenu.d.ts +97 -4
- package/dist/components/ui-menu/UIMenu.en.d.ts +50 -1
- package/dist/components/ui-menu/UIMenu.es.d.ts +4 -0
- package/dist/components/ui-message/UIMessage.d.ts +2 -0
- package/dist/components/ui-message/UIMessage.en.d.ts +2 -0
- package/dist/components/ui-message/UIMessage.es.d.ts +1 -0
- package/dist/components/ui-modal/UIModal.d.ts +1 -0
- package/dist/components/ui-modal/UIModal.en.d.ts +1 -0
- package/dist/components/ui-nag/UINag.d.ts +1 -0
- package/dist/components/ui-nag/UINag.en.d.ts +1 -0
- package/dist/components/ui-page/UIPage.d.ts +15 -0
- package/dist/components/ui-page/UIPage.en.d.ts +15 -0
- package/dist/components/ui-page/UIPage.es.d.ts +1 -0
- package/dist/components/ui-panel/UIPanel.d.ts +6 -0
- package/dist/components/ui-panel/UIPanel.en.d.ts +33 -20
- package/dist/components/ui-parts/UIActions.d.ts +1 -0
- package/dist/components/ui-parts/UIActions.en.d.ts +1 -0
- package/dist/components/ui-parts/UIAuthor.d.ts +1 -0
- package/dist/components/ui-parts/UIAuthor.en.d.ts +1 -0
- package/dist/components/ui-parts/UIAvatar.d.ts +1 -0
- package/dist/components/ui-parts/UIAvatar.en.d.ts +1 -0
- package/dist/components/ui-parts/UIContent.d.ts +1 -0
- package/dist/components/ui-parts/UIContent.en.d.ts +1 -0
- package/dist/components/ui-parts/UIDate.d.ts +1 -0
- package/dist/components/ui-parts/UIDate.en.d.ts +1 -0
- package/dist/components/ui-parts/UIDescription.d.ts +1 -0
- package/dist/components/ui-parts/UIDescription.en.d.ts +1 -0
- package/dist/components/ui-parts/UIDetail.d.ts +1 -0
- package/dist/components/ui-parts/UIDetail.en.d.ts +1 -0
- package/dist/components/ui-parts/UIExtra.d.ts +1 -0
- package/dist/components/ui-parts/UIExtra.en.d.ts +1 -0
- package/dist/components/ui-parts/UIHeader.d.ts +3 -1
- package/dist/components/ui-parts/UIHeader.en.d.ts +3 -1
- package/dist/components/ui-parts/UIMeta.d.ts +1 -0
- package/dist/components/ui-parts/UIMeta.en.d.ts +1 -0
- package/dist/components/ui-parts/UIParts.types.d.ts +15 -1
- package/dist/components/ui-parts/UISummary.d.ts +1 -0
- package/dist/components/ui-parts/UISummary.en.d.ts +1 -0
- package/dist/components/ui-parts/UITitle.d.ts +1 -0
- package/dist/components/ui-parts/UITitle.en.d.ts +1 -0
- package/dist/components/ui-parts/UIValue.d.ts +1 -0
- package/dist/components/ui-parts/UIValue.en.d.ts +1 -0
- package/dist/components/ui-placeholder/UIPlaceholder.d.ts +1 -0
- package/dist/components/ui-placeholder/UIPlaceholder.en.d.ts +1 -0
- package/dist/components/ui-placeholder/UIPlaceholderHeader.d.ts +1 -0
- package/dist/components/ui-placeholder/UIPlaceholderHeader.en.d.ts +1 -0
- package/dist/components/ui-placeholder/UIPlaceholderImage.d.ts +1 -0
- package/dist/components/ui-placeholder/UIPlaceholderImage.en.d.ts +1 -0
- package/dist/components/ui-placeholder/UIPlaceholderLine.d.ts +1 -0
- package/dist/components/ui-placeholder/UIPlaceholderLine.en.d.ts +1 -0
- package/dist/components/ui-placeholder/UIPlaceholderParagraph.d.ts +1 -0
- package/dist/components/ui-placeholder/UIPlaceholderParagraph.en.d.ts +1 -0
- package/dist/components/ui-popup/UIPopup.d.ts +30 -3
- package/dist/components/ui-popup/UIPopup.en.d.ts +7 -0
- package/dist/components/ui-popup/UIPopup.es.d.ts +1 -0
- package/dist/components/ui-progress/UIProgress.d.ts +2 -0
- package/dist/components/ui-progress/UIProgress.en.d.ts +2 -0
- package/dist/components/ui-progress/UIProgress.es.d.ts +1 -0
- package/dist/components/ui-property-editor/UIProperty.d.ts +132 -5
- package/dist/components/ui-property-editor/UIProperty.en.d.ts +11 -44
- package/dist/components/ui-property-editor/UIProperty.es.d.ts +4 -0
- package/dist/components/ui-property-editor/UIPropertyEditor.d.ts +38 -0
- package/dist/components/ui-property-editor/UIPropertyEditor.en.d.ts +1 -0
- package/dist/components/ui-property-editor/UIPropertyEditor.es.d.ts +4 -0
- package/dist/components/ui-property-editor/UIPropertyEditor.types.d.ts +33 -0
- package/dist/components/ui-property-editor/UIPropertyGroup.d.ts +12 -0
- package/dist/components/ui-property-editor/UIPropertyGroup.en.d.ts +2 -0
- package/dist/components/ui-property-editor/UIPropertyGroup.es.d.ts +9 -0
- package/dist/components/ui-property-editor/index.d.ts +1 -0
- package/dist/components/ui-quote/UIQuote.d.ts +1 -0
- package/dist/components/ui-quote/UIQuote.en.d.ts +1 -0
- package/dist/components/ui-rail/UIRail.d.ts +1 -0
- package/dist/components/ui-rail/UIRail.en.d.ts +1 -0
- package/dist/components/ui-rating/UIRating.d.ts +6 -0
- package/dist/components/ui-rating/UIRating.en.d.ts +6 -0
- package/dist/components/ui-rating/UIRating.fallback.d.ts +6 -0
- package/dist/components/ui-reveal/UIReveal.d.ts +1 -0
- package/dist/components/ui-reveal/UIReveal.en.d.ts +1 -0
- package/dist/components/ui-root/UIRoot.d.ts +18 -3
- package/dist/components/ui-root/UIRoot.en.d.ts +15 -0
- package/dist/components/ui-root/UIRoot.es.d.ts +1 -0
- package/dist/components/ui-search/UISearch.d.ts +48 -7
- package/dist/components/ui-search/UISearch.en.d.ts +13 -1
- package/dist/components/ui-search/UISearch.es.d.ts +1 -0
- package/dist/components/ui-search/UISearch.fallback.d.ts +13 -1
- package/dist/components/ui-section/UISection.d.ts +22 -1
- package/dist/components/ui-section/UISection.en.d.ts +10 -0
- package/dist/components/ui-section/UISection.es.d.ts +1 -0
- package/dist/components/ui-section/UISections.d.ts +1 -0
- package/dist/components/ui-section/UISections.en.d.ts +1 -0
- package/dist/components/ui-segment/UISegment.d.ts +2 -0
- package/dist/components/ui-segment/UISegment.en.d.ts +2 -0
- package/dist/components/ui-segment/UISegment.es.d.ts +1 -0
- package/dist/components/ui-segment/UISegments.d.ts +1 -0
- package/dist/components/ui-segment/UISegments.en.d.ts +1 -0
- package/dist/components/ui-select/UISelect.d.ts +6 -0
- package/dist/components/ui-select/UISelect.en.d.ts +6 -0
- package/dist/components/ui-select/UISelect.fallback.d.ts +6 -0
- package/dist/components/ui-shape/UIShape.d.ts +23 -2
- package/dist/components/ui-shape/UIShape.en.d.ts +8 -0
- package/dist/components/ui-shape/UIShape.es.d.ts +1 -0
- package/dist/components/ui-shape/UISide.d.ts +4 -0
- package/dist/components/ui-shape/UISide.en.d.ts +4 -0
- package/dist/components/ui-sidebar/UIPushable.d.ts +1 -0
- package/dist/components/ui-sidebar/UIPushable.en.d.ts +1 -0
- package/dist/components/ui-sidebar/UIPusher.d.ts +1 -0
- package/dist/components/ui-sidebar/UIPusher.en.d.ts +1 -0
- package/dist/components/ui-sidebar/UISidebar.d.ts +1 -0
- package/dist/components/ui-sidebar/UISidebar.en.d.ts +1 -0
- package/dist/components/ui-sides/UISides.d.ts +209 -0
- package/dist/components/ui-sides/UISides.en.d.ts +122 -0
- package/dist/components/ui-sides/UISides.es.d.ts +30 -0
- package/dist/components/ui-sides/UISides.fallback.d.ts +134 -0
- package/dist/components/ui-sides/index.d.ts +2 -0
- package/dist/components/ui-site-nav/SitePages.d.ts +53 -0
- package/dist/components/ui-site-nav/UISiteNav.d.ts +207 -0
- package/dist/components/ui-site-nav/UISiteNav.en.d.ts +87 -0
- package/dist/components/ui-site-nav/UISiteNav.es.d.ts +29 -0
- package/dist/components/ui-site-nav/index.d.ts +1 -0
- package/dist/components/ui-site-tabs/UISiteTabs.d.ts +126 -0
- package/dist/components/ui-site-tabs/UISiteTabs.en.d.ts +49 -0
- package/dist/components/ui-site-tabs/UISiteTabs.es.d.ts +18 -0
- package/dist/components/ui-site-tabs/index.d.ts +1 -0
- package/dist/components/ui-slider/UISlider.d.ts +7 -0
- package/dist/components/ui-slider/UISlider.en.d.ts +7 -0
- package/dist/components/ui-slider/UISlider.es.d.ts +1 -0
- package/dist/components/ui-slider/UISlider.fallback.d.ts +7 -0
- package/dist/components/ui-space/UISpace.d.ts +1 -0
- package/dist/components/ui-space/UISpace.en.d.ts +1 -0
- package/dist/components/ui-split-panel/UISplitPanel.d.ts +175 -0
- package/dist/components/ui-split-panel/UISplitPanel.en.d.ts +74 -0
- package/dist/components/ui-split-panel/UISplitPanel.es.d.ts +25 -0
- package/dist/components/ui-split-panel/index.d.ts +2 -0
- package/dist/components/ui-stack/UIStack.d.ts +31 -5
- package/dist/components/ui-stack/UIStack.en.d.ts +15 -3
- package/dist/components/ui-statistic/UIStatistic.d.ts +1 -0
- package/dist/components/ui-statistic/UIStatistic.en.d.ts +1 -0
- package/dist/components/ui-statistic/UIStatistics.d.ts +1 -0
- package/dist/components/ui-statistic/UIStatistics.en.d.ts +1 -0
- package/dist/components/ui-step/UIStep.d.ts +1 -0
- package/dist/components/ui-step/UIStep.en.d.ts +1 -0
- package/dist/components/ui-step/UISteps.d.ts +1 -0
- package/dist/components/ui-step/UISteps.en.d.ts +1 -0
- package/dist/components/ui-sticky/UISticky.d.ts +4 -0
- package/dist/components/ui-sticky/UISticky.en.d.ts +1 -0
- package/dist/components/ui-tab/UITab.d.ts +8 -0
- package/dist/components/ui-tab/UITab.en.d.ts +1 -0
- package/dist/components/ui-tab/UITabs.d.ts +107 -16
- package/dist/components/ui-tab/UITabs.en.d.ts +40 -1
- package/dist/components/ui-tab/UITabs.es.d.ts +4 -0
- package/dist/components/ui-table/TableEditing.d.ts +77 -0
- package/dist/components/ui-table/UICell.d.ts +1 -0
- package/dist/components/ui-table/UICell.en.d.ts +1 -0
- package/dist/components/ui-table/UITable.d.ts +145 -5
- package/dist/components/ui-table/UITable.en.d.ts +19 -0
- package/dist/components/ui-table/UITable.es.d.ts +3 -0
- package/dist/components/ui-terms/UITerm.d.ts +1 -0
- package/dist/components/ui-terms/UITerm.en.d.ts +1 -0
- package/dist/components/ui-terms/UITerms.d.ts +1 -0
- package/dist/components/ui-terms/UITerms.en.d.ts +1 -0
- package/dist/components/ui-text/UILink.d.ts +11 -0
- package/dist/components/ui-text/UILink.en.d.ts +4 -0
- package/dist/components/ui-text/UIText.d.ts +7 -0
- package/dist/components/ui-text/UIText.en.d.ts +7 -0
- package/dist/components/ui-text/UIText.es.d.ts +2 -0
- package/dist/components/ui-theme-editor/SavedTheme.d.ts +55 -43
- package/dist/components/ui-theme-editor/ThemeDraft.d.ts +15 -0
- package/dist/components/ui-theme-editor/UIColorChip.d.ts +1 -0
- package/dist/components/ui-theme-editor/UIColorChip.en.d.ts +1 -0
- package/dist/components/ui-theme-editor/UIThemeEditor.d.ts +157 -26
- package/dist/components/ui-theme-editor/UIThemeEditor.en.d.ts +79 -6
- package/dist/components/ui-theme-editor/UIThemeEditor.es.d.ts +20 -2
- package/dist/components/ui-theme-editor/UIThemeEditor.types.d.ts +0 -2
- package/dist/components/ui-theme-editor/UIThemeToken.d.ts +1 -0
- package/dist/components/ui-theme-editor/UIThemeToken.en.d.ts +1 -0
- package/dist/components/ui-theme-menu/HueDropdown.d.ts +47 -0
- package/dist/components/ui-theme-menu/ThemeMenu.d.ts +18 -7
- package/dist/components/ui-theme-menu/ThemePreference.d.ts +145 -36
- package/dist/components/ui-theme-menu/UIThemeMenu.d.ts +118 -7
- package/dist/components/ui-theme-menu/UIThemeMenu.en.d.ts +82 -2
- package/dist/components/ui-theme-menu/UIThemeMenu.es.d.ts +21 -1
- package/dist/components/ui-theme-menu/UIThemeMenu.types.d.ts +36 -8
- package/dist/components/ui-theme-menu/index.d.ts +2 -1
- package/dist/components/ui-toast/UIToast.d.ts +1 -0
- package/dist/components/ui-toast/UIToast.en.d.ts +1 -0
- package/dist/components/ui-toc/UIToc.d.ts +1 -0
- package/dist/components/ui-toc/UIToc.en.d.ts +1 -0
- package/dist/components/ui-toolbar/UIToolbar.d.ts +13 -10
- package/dist/components/ui-toolbar/UIToolbar.en.d.ts +138 -84
- package/dist/components/ui-toolbar/UIToolbar.es.d.ts +2 -0
- package/dist/components/ui-transition/UITransition.d.ts +1 -0
- package/dist/components/ui-transition/UITransition.en.d.ts +1 -0
- package/dist/components/ui-tree/UITree.d.ts +162 -0
- package/dist/components/ui-tree/UITree.en.d.ts +88 -0
- package/dist/components/ui-tree/UITree.es.d.ts +35 -0
- package/dist/components/ui-tree/UITreeItem.d.ts +204 -0
- package/dist/components/ui-tree/UITreeItem.en.d.ts +142 -0
- package/dist/components/ui-tree/UITreeItem.es.d.ts +32 -0
- package/dist/components/ui-tree/index.d.ts +3 -0
- package/dist/components/ui-tree-diagram/TreeData.d.ts +3 -12
- package/dist/components/ui-tree-diagram/TreeLayout.d.ts +54 -21
- package/dist/components/ui-tree-diagram/TreeMeasure.d.ts +36 -0
- package/dist/components/ui-tree-diagram/UITreeDiagram.d.ts +152 -27
- package/dist/components/ui-tree-diagram/UITreeDiagram.en.d.ts +47 -7
- package/dist/components/ui-tree-diagram/UITreeDiagram.es.d.ts +12 -1
- package/dist/components/ui-tree-diagram/UITreeDiagram.types.d.ts +66 -21
- package/dist/components/ui-tree-diagram/UITreeNode.d.ts +148 -0
- package/dist/components/ui-tree-diagram/UITreeNode.en.d.ts +69 -0
- package/dist/components/ui-tree-diagram/UITreeNode.es.d.ts +21 -0
- package/dist/components/ui-tree-diagram/index.d.ts +4 -2
- package/dist/components/ui-video/UIAudio.d.ts +1 -0
- package/dist/components/ui-video/UIAudio.en.d.ts +1 -0
- package/dist/components/ui-video/UIVideo.d.ts +1 -0
- package/dist/components/ui-video/UIVideo.en.d.ts +1 -0
- package/dist/components/ui-visibility/UIVisibility.d.ts +1 -0
- package/dist/components/ui-visibility/UIVisibility.en.d.ts +1 -0
- package/dist/components/ui-zoom/UIZoom.d.ts +1 -0
- package/dist/components/ui-zoom/UIZoom.en.d.ts +1 -0
- package/dist/{components.es-DmLzT-Bq.js → components.es-BOa_7gFF.js} +498 -109
- package/dist/components.es-BOa_7gFF.js.map +1 -0
- package/dist/core.d.ts +3 -1
- package/dist/core.js +1082 -511
- package/dist/core.js.map +1 -1
- package/dist/crisp-VfYZlTph.js +6 -0
- package/dist/{crisp-CoZRRDuQ.js.map → crisp-VfYZlTph.js.map} +1 -1
- package/dist/docs-components/index.d.ts +1 -0
- package/dist/docs-components/ui-docs-index/UIDocsIndex.d.ts +89 -0
- package/dist/docs-components/ui-docs-index/UIDocsIndex.en.d.ts +43 -0
- package/dist/docs-components/ui-docs-index/index.d.ts +2 -0
- package/dist/docs-components/ui-docs-nav/UIDocsNav.d.ts +54 -87
- package/dist/docs-components/ui-docs-nav/UIDocsNav.types.d.ts +2 -29
- package/dist/docs-components/ui-docs-search/SearchIndex.d.ts +8 -2
- package/dist/docs-components/ui-docs-search/UIDocsSearch.d.ts +10 -0
- package/dist/docs-components/ui-docs-search/UIDocsSearch.en.d.ts +5 -0
- package/dist/elements/AddressParameter.d.ts +87 -0
- package/dist/elements/DOMFormControl.d.ts +5 -0
- package/dist/elements/FormComponent.d.ts +32 -0
- package/dist/elements/LoadableBody.d.ts +6 -1
- package/dist/elements/LoadableComponent.d.ts +10 -1
- package/dist/elements/RootSettings.d.ts +43 -6
- package/dist/elements/SpellUISettings.d.ts +1 -0
- package/dist/elements/StickyWatch.d.ts +20 -0
- package/dist/elements/elements.types.d.ts +15 -0
- package/dist/elements/index.d.ts +2 -0
- package/dist/forms.js +93 -63
- package/dist/forms.js.map +1 -1
- package/dist/fruity-BRVlgJZd.js +6 -0
- package/dist/fruity-BRVlgJZd.js.map +1 -0
- package/dist/{fruity.theme-BJcMiPl1.js → fruity.theme-CbC7Jyvk.js} +2 -2
- package/dist/fruity.theme-CbC7Jyvk.js.map +1 -0
- package/dist/glass-x9tbbwVq.js +6 -0
- package/dist/glass-x9tbbwVq.js.map +1 -0
- package/dist/glass.theme-24wY2wH9.js +6 -0
- package/dist/glass.theme-24wY2wH9.js.map +1 -0
- package/dist/hot.js +530 -24
- package/dist/hot.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.js +91 -81
- package/dist/jsx.d.ts +21149 -10377
- package/dist/matrix-QY2gWbJ0.js +6 -0
- package/dist/{matrix-CqA59hiF.js.map → matrix-QY2gWbJ0.js.map} +1 -1
- package/dist/{matrix.theme-jqQZjcq3.js → matrix.theme-_8xtwhDq.js} +2 -2
- package/dist/matrix.theme-_8xtwhDq.js.map +1 -0
- package/dist/midnight-BxlTQSfw.js +6 -0
- package/dist/{midnight-BnoVOrhC.js.map → midnight-BxlTQSfw.js.map} +1 -1
- package/dist/mockup-83ELBuVr.js +6 -0
- package/dist/mockup-83ELBuVr.js.map +1 -0
- package/dist/mockup.theme-DmpBgGBl.js +6 -0
- package/dist/mockup.theme-DmpBgGBl.js.map +1 -0
- package/dist/paper-M61nUilz.js +6 -0
- package/dist/{paper-CynH8ZuT.js.map → paper-M61nUilz.js.map} +1 -1
- package/dist/persist.types-D2m6wD-S.js +9 -0
- package/dist/persist.types-D2m6wD-S.js.map +1 -0
- package/dist/pop-CxXfytjk.js +6 -0
- package/dist/{pop-D2i9V_rG.js.map → pop-CxXfytjk.js.map} +1 -1
- package/dist/runtime/DataTooltips.d.ts +75 -0
- package/dist/runtime/PropertyControls.d.ts +15 -1
- package/dist/runtime/Sources.d.ts +16 -4
- package/dist/runtime/Styles.d.ts +11 -0
- package/dist/runtime/Themes.d.ts +10 -4
- package/dist/runtime/UIRuntime.d.ts +4 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/runtime.types.d.ts +18 -85
- package/dist/spell-By5Y3jKP.js +6 -0
- package/dist/{spell-BFtLICm7.js.map → spell-By5Y3jKP.js.map} +1 -1
- package/dist/{spell.theme-B7AU7SQX.js → spell.theme-DxGj7qHx.js} +2 -2
- package/dist/spell.theme-DxGj7qHx.js.map +1 -0
- package/dist/styles/CodeThemeFile.d.ts +73 -0
- package/dist/styles/StyleGenerator.d.ts +6 -0
- package/dist/styles/styles.en.d.ts +141 -3
- package/dist/styles/styles.types.d.ts +2 -0
- package/dist/{styles.en-RLpYiO5_.js → styles.en-CUUxNwHo.js} +71 -14
- package/dist/styles.en-CUUxNwHo.js.map +1 -0
- package/dist/styles.js +13 -13
- package/dist/styles.js.map +1 -1
- package/dist/ui-accordion.js +54 -53
- package/dist/ui-accordion.js.map +1 -1
- package/dist/ui-action.js +20 -19
- package/dist/ui-action.js.map +1 -1
- package/dist/ui-ad.js +5 -4
- package/dist/ui-ad.js.map +1 -1
- package/dist/ui-breadcrumbs.js +15 -13
- package/dist/ui-breadcrumbs.js.map +1 -1
- package/dist/ui-button.js +132 -125
- package/dist/ui-button.js.map +1 -1
- package/dist/ui-calendar.js +208 -206
- package/dist/ui-calendar.js.map +1 -1
- package/dist/ui-card.js +260 -98
- package/dist/ui-card.js.map +1 -1
- package/dist/ui-checkbox.js +95 -81
- package/dist/ui-checkbox.js.map +1 -1
- package/dist/ui-code.js +25 -24
- package/dist/ui-code.js.map +1 -1
- package/dist/ui-comment.js +14 -12
- package/dist/ui-comment.js.map +1 -1
- package/dist/ui-components.js +7 -6
- package/dist/ui-components.js.map +1 -1
- package/dist/ui-container.js +24 -12
- package/dist/ui-container.js.map +1 -1
- package/dist/ui-diagram.js +1328 -0
- package/dist/ui-diagram.js.map +1 -0
- package/dist/ui-dimension.js +779 -0
- package/dist/ui-dimension.js.map +1 -0
- package/dist/ui-dimmer.js +36 -34
- package/dist/ui-dimmer.js.map +1 -1
- package/dist/ui-divider.js +7 -5
- package/dist/ui-divider.js.map +1 -1
- package/dist/ui-dropdown.js +107 -105
- package/dist/ui-dropdown.js.map +1 -1
- package/dist/ui-embed.js +36 -35
- package/dist/ui-embed.js.map +1 -1
- package/dist/ui-emoji.js +10 -9
- package/dist/ui-emoji.js.map +1 -1
- package/dist/ui-example.js +63 -61
- package/dist/ui-example.js.map +1 -1
- package/dist/ui-feed.js +12 -10
- package/dist/ui-feed.js.map +1 -1
- package/dist/ui-flag.js +10 -9
- package/dist/ui-flag.js.map +1 -1
- package/dist/ui-flyout.js +7 -6
- package/dist/ui-flyout.js.map +1 -1
- package/dist/ui-form.js +244 -162
- package/dist/ui-form.js.map +1 -1
- package/dist/ui-grid.js +21 -18
- package/dist/ui-grid.js.map +1 -1
- package/dist/ui-icon-picker.js +46 -44
- package/dist/ui-icon-picker.js.map +1 -1
- package/dist/ui-icon.js +17 -14
- package/dist/ui-icon.js.map +1 -1
- package/dist/ui-image.js +93 -55
- package/dist/ui-image.js.map +1 -1
- package/dist/ui-include.js +18 -17
- package/dist/ui-include.js.map +1 -1
- package/dist/ui-input.js +154 -112
- package/dist/ui-input.js.map +1 -1
- package/dist/ui-item.js +152 -102
- package/dist/ui-item.js.map +1 -1
- package/dist/ui-items.js +9 -8
- package/dist/ui-items.js.map +1 -1
- package/dist/ui-json.js +115 -0
- package/dist/ui-json.js.map +1 -0
- package/dist/ui-keys.js +1 -1
- package/dist/ui-label.js +18 -15
- package/dist/ui-label.js.map +1 -1
- package/dist/ui-list.js +7 -5
- package/dist/ui-list.js.map +1 -1
- package/dist/ui-loader.js +7 -6
- package/dist/ui-loader.js.map +1 -1
- package/dist/ui-markdown.js +975 -83
- package/dist/ui-markdown.js.map +1 -1
- package/dist/ui-menu.js +329 -196
- package/dist/ui-menu.js.map +1 -1
- package/dist/ui-message.js +20 -18
- package/dist/ui-message.js.map +1 -1
- package/dist/ui-modal.js +46 -45
- package/dist/ui-modal.js.map +1 -1
- package/dist/ui-nag.js +19 -18
- package/dist/ui-nag.js.map +1 -1
- package/dist/ui-page.js +8 -7
- package/dist/ui-page.js.map +1 -1
- package/dist/ui-panel.js +28 -17
- package/dist/ui-panel.js.map +1 -1
- package/dist/ui-parts.js +66 -52
- package/dist/ui-parts.js.map +1 -1
- package/dist/ui-placeholder.js +21 -16
- package/dist/ui-placeholder.js.map +1 -1
- package/dist/ui-popup.js +113 -84
- package/dist/ui-popup.js.map +1 -1
- package/dist/ui-progress.js +9 -7
- package/dist/ui-progress.js.map +1 -1
- package/dist/ui-property-editor.js +706 -203
- package/dist/ui-property-editor.js.map +1 -1
- package/dist/ui-quote.js +5 -4
- package/dist/ui-quote.js.map +1 -1
- package/dist/ui-rail.js +5 -4
- package/dist/ui-rail.js.map +1 -1
- package/dist/ui-rating.js +31 -29
- package/dist/ui-rating.js.map +1 -1
- package/dist/ui-reveal.js +7 -6
- package/dist/ui-reveal.js.map +1 -1
- package/dist/ui-root.js +324 -158
- package/dist/ui-root.js.map +1 -1
- package/dist/ui-search.js +210 -168
- package/dist/ui-search.js.map +1 -1
- package/dist/ui-section.js +124 -92
- package/dist/ui-section.js.map +1 -1
- package/dist/ui-segment.js +15 -12
- package/dist/ui-segment.js.map +1 -1
- package/dist/ui-select.js +83 -81
- package/dist/ui-select.js.map +1 -1
- package/dist/ui-shape.js +86 -58
- package/dist/ui-shape.js.map +1 -1
- package/dist/ui-sidebar.js +59 -56
- package/dist/ui-sidebar.js.map +1 -1
- package/dist/ui-sides.js +325 -0
- package/dist/ui-sides.js.map +1 -0
- package/dist/ui-site-nav.js +329 -0
- package/dist/ui-site-nav.js.map +1 -0
- package/dist/ui-site-tabs.js +177 -0
- package/dist/ui-site-tabs.js.map +1 -0
- package/dist/ui-slider.js +84 -81
- package/dist/ui-slider.js.map +1 -1
- package/dist/ui-space.js +7 -6
- package/dist/ui-space.js.map +1 -1
- package/dist/ui-split-panel.js +298 -0
- package/dist/ui-split-panel.js.map +1 -0
- package/dist/ui-stack.js +47 -23
- package/dist/ui-stack.js.map +1 -1
- package/dist/ui-statistic.js +15 -13
- package/dist/ui-statistic.js.map +1 -1
- package/dist/ui-step.js +31 -29
- package/dist/ui-step.js.map +1 -1
- package/dist/ui-sticky.js +7 -6
- package/dist/ui-sticky.js.map +1 -1
- package/dist/ui-tab.js +230 -138
- package/dist/ui-tab.js.map +1 -1
- package/dist/ui-table.js +724 -162
- package/dist/ui-table.js.map +1 -1
- package/dist/ui-terms.js +12 -10
- package/dist/ui-terms.js.map +1 -1
- package/dist/ui-text.js +53 -28
- package/dist/ui-text.js.map +1 -1
- package/dist/ui-theme-editor.js +1018 -1545
- package/dist/ui-theme-editor.js.map +1 -1
- package/dist/ui-theme-menu-CuIjr8Ou.js +1493 -0
- package/dist/ui-theme-menu-CuIjr8Ou.js.map +1 -0
- package/dist/ui-toast.js +45 -44
- package/dist/ui-toast.js.map +1 -1
- package/dist/ui-toc.js +75 -74
- package/dist/ui-toc.js.map +1 -1
- package/dist/ui-toolbar.js +51 -73
- package/dist/ui-toolbar.js.map +1 -1
- package/dist/ui-transition.js +12 -11
- package/dist/ui-transition.js.map +1 -1
- package/dist/ui-tree-diagram.js +676 -197
- package/dist/ui-tree-diagram.js.map +1 -1
- package/dist/ui-tree.js +625 -0
- package/dist/ui-tree.js.map +1 -0
- package/dist/ui-video.js +13 -11
- package/dist/ui-video.js.map +1 -1
- package/dist/ui-visibility.js +26 -25
- package/dist/ui-visibility.js.map +1 -1
- package/dist/ui-zoom.js +79 -78
- package/dist/ui-zoom.js.map +1 -1
- package/dist/util/TopLayerTip.d.ts +28 -0
- package/dist/util/index.d.ts +5 -2
- package/dist/vocabulary/DefaultValues.d.ts +34 -0
- package/dist/vocabulary/SharedVocabulary.d.ts +4 -0
- package/dist/vocabulary/SharedVocabulary.es.d.ts +7 -0
- package/dist/vocabulary/ValueSets.d.ts +18 -0
- package/dist/vocabulary/Vocabulary.d.ts +1 -0
- package/dist/vocabulary/defaults.generated.d.ts +6 -0
- package/dist/vocabulary/index.d.ts +1 -0
- package/package.json +1 -1
- package/dist/MarkdownEngine-CbuT9Mjc.js.map +0 -1
- package/dist/PrefStore-CeaTtjTz.js.map +0 -1
- package/dist/UIButton-XkfGqgh6.js +0 -6
- package/dist/UIButton-XkfGqgh6.js.map +0 -1
- package/dist/UIInput-BUudZstW.js +0 -6
- package/dist/UIInput-BUudZstW.js.map +0 -1
- package/dist/UIKeys-DJF2TIKE.js.map +0 -1
- package/dist/UILabel-C1jy3Yl8.js +0 -6
- package/dist/UILabel-C1jy3Yl8.js.map +0 -1
- package/dist/UIMenu-Btd-8V3A.js +0 -42
- package/dist/UIMenu-Btd-8V3A.js.map +0 -1
- package/dist/UIRuntime-BBuehGly.js.map +0 -1
- package/dist/components.es-DmLzT-Bq.js.map +0 -1
- package/dist/crisp-CoZRRDuQ.js +0 -6
- package/dist/fruity-CQFYeRlh.js +0 -6
- package/dist/fruity-CQFYeRlh.js.map +0 -1
- package/dist/fruity.theme-BJcMiPl1.js.map +0 -1
- package/dist/glass-CAfW11kL.js +0 -6
- package/dist/glass-CAfW11kL.js.map +0 -1
- package/dist/glass.theme-DQcBbtCW.js +0 -6
- package/dist/glass.theme-DQcBbtCW.js.map +0 -1
- package/dist/matrix-CqA59hiF.js +0 -6
- package/dist/matrix.theme-jqQZjcq3.js.map +0 -1
- package/dist/midnight-BnoVOrhC.js +0 -6
- package/dist/paper-CynH8ZuT.js +0 -6
- package/dist/persist.types-CsZxS8TG.js +0 -9
- package/dist/persist.types-CsZxS8TG.js.map +0 -1
- package/dist/pop-D2i9V_rG.js +0 -6
- package/dist/spell-BFtLICm7.js +0 -6
- package/dist/spell.theme-B7AU7SQX.js.map +0 -1
- package/dist/styles.en-RLpYiO5_.js.map +0 -1
- package/dist/ui-theme-menu-DyKZygpV.js +0 -921
- package/dist/ui-theme-menu-DyKZygpV.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-tree.js","names":["this","<Show when={this.icon}>{(icon) => <ui-icon class=\"icon\" name={icon()} />}</Show>","<Show when={this.which}>{(which) => <span class=\"which\">{which()}</span>}</Show>","<Show when={this.count}>\n {(count) => <ui-label class=\"count\" part={this.partForName(\"count\")} size=\"mini\" appearance=\"circular\">\n {count()}\n </ui-label>}\n </Show>","<div class={[\"row\", this.band]} part={this.partForName(\"row\")} style={{ \"--_ui-tree-depth\": this.indent }}>\n <span\n class=\"toggle\"\n part={this.partForName(\"toggle\")}\n aria-hidden=\"true\"\n title={this.canOpen ? this.translationForKey(this.isOpen ? \"close\" : \"open\") : void 0}\n onClick={this.onToggleClicked}\n />\n <slot name=\"icon\">\n <Show when={this.icon}>{(icon) => <ui-icon class=\"icon\" name={icon()} />}</Show>\n </slot>\n <span class=\"label\" part={this.partForName(\"label\")}>\n <slot name=\"label\">\n <span class=\"words\">{this.label}</span>\n <Show when={this.which}>{(which) => <span class=\"which\">{which()}</span>}</Show>\n </slot>\n </span>\n <Show when={this.count}>\n {(count) => <ui-label class=\"count\" part={this.partForName(\"count\")} size=\"mini\" appearance=\"circular\">\n {count()}\n </ui-label>}\n </Show>\n <Show when={this.badge}>\n {(badge) => <ui-label class=\"badge\" part={this.partForName(\"badge\")} size=\"mini\" color=\"yellow\" appearance=\"basic\">\n {badge()}\n </ui-label>}\n </Show>\n <span class=\"actions\">\n <slot name=\"actions\" />\n </span>\n </div>","<Show when={this.badge}>\n {(badge) => <ui-label class=\"badge\" part={this.partForName(\"badge\")} size=\"mini\" color=\"yellow\" appearance=\"basic\">\n {badge()}\n </ui-label>}\n </Show>","part={this.partForName(\"row\")}","\"--_ui-tree-depth\": this.indent","part={this.partForName(\"toggle\")}","title={this.canOpen ? this.translationForKey(this.isOpen ? \"close\" : \"open\") : void 0}","part={this.partForName(\"label\")}","<Show when={this.drawsRows}>\n <div\n class={[\"rows\", { shut: !this.showsRows }]}\n role=\"group\"\n part={this.partForName(\"group\")}\n inert={this.showsRows ? void 0 : \"\"}\n >\n <div class=\"folded\">\n <slot />\n </div>\n </div>\n </Show>","part={this.partForName(\"group\")}","inert={this.showsRows ? void 0 : \"\"}","<div\n class={[\"rows\", { shut: !this.showsRows }]}\n role=\"group\"\n part={this.partForName(\"group\")}\n inert={this.showsRows ? void 0 : \"\"}\n >\n <div class=\"folded\">\n <slot />\n </div>\n </div>","_tmpl$","_tmpl$2","_tmpl$3","_tmpl$4","_tmpl$5","_elementSetup_dec","_vocabulary_dec","_a","_init","E.UIComponent","E.proto","E.protoMerged","E.cssState","E.controlled","E.state","E.watches","E.aria","E.untracked","E.onChange","E.Disclosure","_$getOwner","_$createComponent","_$readShallow","_$setAttribute","_$setStyleProperty","__name","treeCSS","_$delegateEvents","<Show when={this.pathRows.length}>\n <div class=\"path\" part={this.partForName(\"path\")} aria-hidden=\"true\">\n <For each={this.pathRows}>\n {(row, index) => <>\n <Show when={index()}>\n <span class=\"separator\">›</span>\n </Show>\n <span\n class=\"path-row\"\n part={this.partForName(\"path-row\")}\n style={{ \"flex-shrink\": 100 ** (this.pathRows.length - 1 - index()) }}\n onClick={() => this.scrollToRow(row)}\n >\n {row.label}\n </span>\n </>}\n </For>\n </div>\n </Show>","this","<For each={this.pathRows}>\n {(row, index) => <>\n <Show when={index()}>\n <span class=\"separator\">›</span>\n </Show>\n <span\n class=\"path-row\"\n part={this.partForName(\"path-row\")}\n style={{ \"flex-shrink\": 100 ** (this.pathRows.length - 1 - index()) }}\n onClick={() => this.scrollToRow(row)}\n >\n {row.label}\n </span>\n </>}\n </For>","<Show when={index()}>\n <span class=\"separator\">›</span>\n </Show>","<span class=\"separator\">›</span>","\"flex-shrink\": 100 ** (this.pathRows.length - 1 - index())","<div class=\"path\" part={this.partForName(\"path\")} aria-hidden=\"true\">\n <For each={this.pathRows}>\n {(row, index) => <>\n <Show when={index()}>\n <span class=\"separator\">›</span>\n </Show>\n <span\n class=\"path-row\"\n part={this.partForName(\"path-row\")}\n style={{ \"flex-shrink\": 100 ** (this.pathRows.length - 1 - index()) }}\n onClick={() => this.scrollToRow(row)}\n >\n {row.label}\n </span>\n </>}\n </For>\n </div>","<Show when={this.hasNoMatches}>\n <div class=\"empty\" part={this.partForName(\"empty\")}>\n <slot name=\"empty\">{this.translationForKey(\"noMatches\")}</slot>\n </div>\n </Show>","<div class=\"empty\" part={this.partForName(\"empty\")}>\n <slot name=\"empty\">{this.translationForKey(\"noMatches\")}</slot>\n </div>","E.UIComponent","E.proto","E.protoMerged","E.state","E.cssState","E.aria","E.on","E.onChange","E.isSameList","E.watches","E.ListSelection","_$createComponent","_$setAttribute","_$setStyleProperty","_$getOwner","E.beforeNextPaint","E.scrollingBoxFor","__name","treeCSS","_$delegateEvents","__name$1","__publicField","__decorateElement","__decoratorMetadata","__runInitializers","__privateAdd","__decoratorStart","getOwner$1","treeVocabulary","treeItemVocabulary","UITree_default","_tmpl$$1","_tmpl$2$1","_tmpl$3$1","_tmpl$4$1","_tmpl$5$1","_tmpl$6","_onSelectedChanged_dec","_onToggleClicked_dec","_ariaDepth_dec","_ariaIsSelected_dec","_ariaOpen_dec","_canOpen_dec","_hasRows_dec","_isKeptOpen_dec","_isFilteredOut_dec","_isBand_dec","_isInNav_dec","_indent_dec","_depth_dec","_isOpen_dec","_elementSetup_dec$1","_vocabulary_dec$1","_a$1","_init$1","_isOpen","_depth","_indent","_isInNav","_isFilteredOut","_isKeptOpen","_UITreeItem","UIComponent","proto","protoMerged","cssState","controlled","state","watches","aria","untracked","onChange","Disclosure","event","child","slotted","_self$","_el$","_el$2","_el$3","_el$4","_el$5","_el$6","_el$7","_el$8","_el$9","addEvent","insert","createComponent","Show","_el$13","effect","icon","_v$","_el$14","which","_el$15","count","_el$16","badge","readShallow","className","_p$","t","setAttribute","setStyleProperty","i","n","_el$10","_el$12","a","depth","indent","at","BAND","NAV","selected","scrollIntoSight","UITreeItem","delegateEvents","_tmpl$","_tmpl$2","_tmpl$3","_tmpl$4","_tmpl$5","_onRowsChanged_dec","_onFilterChanged_dec","_watchScrolling_dec","_pathRows_dec","_onKeyDown_dec","_onCanRoveChanged_dec","_onClicked_dec","_ariaName_dec","_ariaIsMany_dec","_isFiltering_dec","_hasNoMatches_dec","_elementSetup_dec","_vocabulary_dec","_a","_init","_hasNoMatches","_pathRows","_UITree","on","isSameList","ListSelection","MANY","For","index","row","rows","parent","component","walk","target","value","each","next","values","canRove","UI","handled","select","up","isConnected","stickyPath","isServer","onScroll","beforeNextPaint","box","scrollingBoxFor","top","first","around","text","matchIn","anyMatch","isInside","isMatch","UITree"],"sources":["../src/components/ui-tree/UITree.en.ts","../src/components/ui-tree/UITreeItem.en.ts","../src/components/ui-tree/UITree.css?inline","../src/components/ui-tree/UITreeItem.tsx","../src/components/ui-tree/UITree.tsx","../src/components/ui-tree/index.ts"],"sourcesContent":["/**\n * The English vocabulary of `<ui-tree>`: every name the tag uses.\n * The shape is `E.ComponentVocabulary` (`spell/ui/vocabulary`).\n */\n\nimport type { E } from \"spell/ui/core\"\n\n/****************\n * ### `treeVocabulary`\n * The names of `<ui-tree>`: rows nested in rows, which open and close, and are selected one or many at a time.\n ****************/\nexport const treeVocabulary = {\n tag: \"ui-tree\",\n icon: \"sitemap\",\n topics: [\"lists\", \"navigation\"],\n aka: [\"tree view\", \"outline\", \"hierarchy\", \"file tree\", \"nested list\", \"folder list\"],\n noun: \"tree\",\n description: \"A tree shows rows nested in rows, which open and close, and can be selected one or many at a time.\",\n skeleton: \"3 line paragraph\",\n attributes: [\n {\n name: \"choose\",\n group: \"behaviour\",\n kind: \"valueOnly\",\n values: [\"one\", \"many\"],\n classes: { one: \"\", many: \"many\" },\n description:\n \"How rows are selected: `one` (the default), or `many`, where Shift takes a range, \" +\n \"and Command or Control adds a row or takes it away.\"\n },\n {\n name: \"filter\",\n group: \"behaviour\",\n kind: \"string\",\n description:\n \"Show only the rows whose words hold this text, whatever its case, and the rows they're inside, opened to show \" +\n \"them. It changes no row's `open`: clearing it puts the tree back as it was. \" +\n \"A row drawn only once its parent opens can't be found while that's closed.\"\n },\n {\n name: \"label\",\n group: \"behaviour\",\n kind: \"string\",\n description: \"What a screen reader calls the tree.\"\n },\n {\n name: \"appearance\",\n group: \"appearance\",\n kind: \"valueOnly\",\n values: [\"nav\"],\n description:\n \"`nav`: a site's side navigation, as the docs site's is: taller rows, a selected row a rounded box in the \" +\n \"primary colour, the open-and-close chevron at a row's end, and `band` rows as heading bands.\"\n },\n {\n name: \"sticky-path\",\n group: \"behaviour\",\n kind: \"keyOnly\",\n description:\n \"While the tree scrolls, one line pinned at its top names the open rows the first row in view is inside, \" +\n \"`Solitaire › Grid › StockPile`, shortened from the left when it doesn't fit. A click on one scrolls to its \" +\n \"row, selecting nothing. It shows only while one of them is scrolled out of sight.\"\n }\n ],\n events: [\n {\n name: \"ui-selecting\",\n cancelable: true,\n detail: \"{ item: HTMLElement, value: string, originalEvent?: Event }\",\n description:\n \"A row is about to be selected, by a click, or by Enter or Space: cancel it to decide what's selected yourself, \" +\n \"reading the keys held from `originalEvent`.\"\n },\n {\n name: \"ui-changed\",\n detail: \"{ value: string, values: string[], originalEvent?: Event }\",\n description:\n \"What's selected changed: `value`, the row clicked; `values`, every selected row in the tree's order \" +\n \"(each one's `value`, else its `label`).\"\n }\n ],\n slots: [\n { name: \"\", description: \"The top rows: `<ui-tree-item>`s.\" },\n { name: \"empty\", description: \"Shown when `filter` matches no row.\" }\n ],\n parts: [\n { name: \"empty\", description: \"The box around the `empty` slot.\" },\n { name: \"path\", description: \"`sticky-path`: the pinned line naming the rows scrolled out of sight.\" },\n { name: \"path-row\", description: \"`sticky-path`: each row's name in the path.\" }\n ],\n states: [\n { name: \"filtering\", description: \"It has a `filter`.\" },\n { name: \"no-matches\", description: \"Its `filter` matches no row.\" }\n ],\n texts: [\n {\n key: \"noMatches\",\n text: \"Nothing matches\",\n description: \"Shown when `filter` matches no row and no `empty` is given.\"\n }\n ]\n} as const satisfies E.ComponentVocabulary\n","/**\n * The English vocabulary of `<ui-tree-item>`: every name the tag uses.\n * The shape is `E.ComponentVocabulary` (`spell/ui/vocabulary`).\n */\n\nimport type { E } from \"spell/ui/core\"\n\n/****************\n * ### `treeItemVocabulary`\n * The names of `<ui-tree-item>`: one row of a `<ui-tree>`, holding the rows inside it.\n ****************/\nexport const treeItemVocabulary = {\n tag: \"ui-tree-item\",\n icon: \"circle outline\",\n topics: [\"lists\", \"navigation\"],\n aka: [\"tree node\", \"tree row\", \"outline row\"],\n noun: \"tree item\",\n description: \"One row of a tree: an icon and a label, with the rows inside it, which it opens and closes.\",\n skeleton: \"line\",\n attributes: [\n { name: \"label\", group: \"content\", kind: \"string\", description: \"What the row says.\" },\n { name: \"which\", group: \"content\", kind: \"string\", description: \"Which one it is, quieter, after its label.\" },\n { name: \"icon\", group: \"content\", kind: \"icon\", description: \"The icon before its label.\" },\n {\n name: \"value\",\n group: \"content\",\n kind: \"string\",\n description: \"What `ui-changed` calls this row. None: its `label`.\"\n },\n { name: \"open\", group: \"behaviour\", kind: \"keyOnly\", description: \"The rows inside it show.\" },\n { name: \"selected\", group: \"behaviour\", kind: \"keyOnly\", description: \"It's selected.\" },\n {\n name: \"expandable\",\n group: \"behaviour\",\n kind: \"keyOnly\",\n description: \"It can open though it has no rows inside it yet: for rows drawn only once it opens.\"\n },\n {\n name: \"group\",\n group: \"behaviour\",\n kind: \"keyOnly\",\n description: \"It only holds rows: a click opens or closes it, and it's never selected.\"\n },\n {\n name: \"band\",\n group: \"appearance\",\n kind: \"valueOnly\",\n values: [\"heading\", \"subheading\"],\n description:\n \"The row is a heading band over the rows inside it, in a tree whose `appearance` is `nav`: `heading`, a \" +\n \"tinted band that stays at the top while its rows scroll; `subheading`, a lighter one inside it.\"\n },\n {\n name: \"count\",\n group: \"content\",\n kind: \"string\",\n description: \"A number in a small round label after its words: how many rows are inside it, say.\"\n },\n {\n name: \"badge\",\n group: \"content\",\n kind: \"string\",\n description: \"A word in a small label after its words: `Planned`, `In progress`.\"\n }\n ],\n events: [\n {\n name: \"ui-opening\",\n cancelable: true,\n detail: \"{ open: boolean, originalEvent?: Event }\",\n description: \"It's about to open: cancel it to stay closed.\"\n },\n {\n name: \"ui-closing\",\n cancelable: true,\n detail: \"{ open: boolean, originalEvent?: Event }\",\n description: \"It's about to close: cancel it to stay open.\"\n }\n ],\n slots: [\n { name: \"\", description: \"The rows inside it: `<ui-tree-item>`s, and anything else to show between them.\" },\n { name: \"label\", description: \"The row's words, in place of `label` and `which`.\" },\n { name: \"icon\", description: \"The row's icon, in place of `icon`.\" },\n { name: \"actions\", description: \"Buttons at the row's end.\" }\n ],\n parts: [\n { name: \"row\", description: \"The row itself.\" },\n { name: \"toggle\", description: \"The triangle that opens and closes it.\" },\n { name: \"label\", description: \"Its words.\" },\n { name: \"count\", description: \"Its `count`'s label.\" },\n { name: \"badge\", description: \"Its `badge`'s label.\" },\n { name: \"group\", description: \"The box around the rows inside it.\" }\n ],\n states: [\n { name: \"open\", description: \"The rows inside it show.\" },\n { name: \"selected\", description: \"It's selected.\" },\n { name: \"has-items\", description: \"It has rows inside it, or could: it draws its triangle.\" },\n { name: \"filtered-out\", description: \"The tree's `filter` hides it.\" },\n { name: \"nav\", description: \"Its tree's `appearance` is `nav`: it takes the side navigation's look.\" }\n ],\n texts: [\n { key: \"open\", text: \"Open\", description: \"The triangle's name, closed.\" },\n { key: \"close\", text: \"Close\", description: \"The triangle's name, open.\" }\n ]\n} as const satisfies E.ComponentVocabulary\n","/*\n * `<ui-tree>` and `<ui-tree-item>` (`UITree.tsx`, `UITreeItem.tsx`): rows nested in rows, each row the tree's full width.\n * - Tokens:\n * | `--ui-tree-indent` | how far in each level goes |\n * | `--ui-tree-row-height` | a row's least height |\n * | `--ui-tree-gap` | the room between a row's triangle, icon and words |\n * | `--ui-tree-hover-background` | a row under the mouse |\n * | `--ui-tree-selected-background` / `-color` | a selected row |\n * | `--ui-tree-muted-color` | the triangle, the icon and `which` |\n * | `--ui-tree-path-background` | `sticky-path`'s line, over the rows it covers |\n * - `appearance=\"nav\"` (the rows' `:state(nav)`): the docs site's side navigation, its look matched to `<ui-docs-nav>`'s\n * (epic `mockup` P5), with these tokens of its own:\n * | `--ui-tree-nav-band-background` / `-color` | a `band=\"heading\"` row |\n * | `--ui-tree-nav-subheading-color` | a `band=\"subheading\"` row |\n * | `--ui-tree-nav-border-color` | the line above a band |\n * | `--ui-tree-nav-current-background` / `-color` | the selected row, the page shown |\n * | `--ui-tree-nav-open-duration` / `-close-duration` | how long a row's rows take to ease open, and shut |\n * | `--ui-tree-nav-ease` | how they ease |\n * - A row's rows stay drawn while it's closed, a one-row grid 0fr tall, so they ease; never under reduced motion.\n */\n@layer ui.components {\n :host {\n --_ui-tree-indent: var(--ui-tree-indent, 12px);\n --_ui-tree-row-height: var(--ui-tree-row-height, 22px);\n --_ui-tree-gap: var(--ui-tree-gap, 4px);\n --_ui-tree-hover-background: var(\n --ui-tree-hover-background,\n color-mix(in oklab, var(--ui-primary) 6%, transparent)\n );\n --_ui-tree-selected-background: var(--ui-tree-selected-background, var(--ui-primary-background));\n --_ui-tree-selected-color: var(--ui-tree-selected-color, var(--ui-primary-text, var(--ui-text-color)));\n --_ui-tree-muted-color: var(--ui-tree-muted-color, var(--ui-text-muted));\n --_ui-tree-path-background: var(--ui-tree-path-background, var(--ui-background));\n display: block;\n min-width: 0;\n color: var(--ui-text-color);\n outline: none;\n cursor: var(--ui-control-cursor);\n /* no row is the browser's scroll anchor: opening or closing one never scrolls the box around the tree */\n overflow-anchor: none;\n }\n :host(:state(filtered-out)) {\n display: none;\n }\n /* what isn't a row, between rows, makes no sense among matches */\n :host(:state(filtering)) ::slotted(:not([label])) {\n display: none;\n }\n\n .empty {\n padding: 0.5em 8px;\n color: var(--_ui-tree-muted-color);\n }\n\n /* `sticky-path`: one line pinned over the top rows, taking no room of its own, so nothing moves when it shows */\n .path {\n position: sticky;\n top: 0;\n z-index: 1;\n display: flex;\n align-items: center;\n gap: var(--_ui-tree-gap);\n box-sizing: border-box;\n height: var(--_ui-tree-row-height);\n margin-block-end: calc(var(--_ui-tree-row-height) * -1);\n padding-inline: 8px;\n overflow: hidden;\n white-space: nowrap;\n background: var(--_ui-tree-path-background);\n /* over a see-through pane, the rows under it blurred out of the way */\n backdrop-filter: blur(12px);\n border-block-end: 1px solid var(--ui-border-color);\n color: var(--_ui-tree-muted-color);\n }\n /* the outer rows give way first: each shrinks a hundred times more than the one after it */\n .path-row {\n flex: 0 1 auto;\n min-width: 1.5em;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n .path-row:last-child {\n min-width: 0;\n color: var(--ui-text-color);\n }\n .path-row:hover {\n color: var(--ui-text-color);\n text-decoration: underline;\n }\n .separator {\n flex: none;\n }\n\n .row {\n display: flex;\n align-items: center;\n gap: var(--_ui-tree-gap);\n box-sizing: border-box;\n min-height: var(--_ui-tree-row-height);\n padding-inline: calc(8px + var(--_ui-tree-depth, 0) * var(--_ui-tree-indent)) 8px;\n white-space: nowrap;\n }\n .row:hover {\n background: var(--_ui-tree-hover-background);\n }\n :host(:state(selected)) > .row {\n background: var(--_ui-tree-selected-background);\n color: var(--_ui-tree-selected-color);\n }\n :host(:focus-visible) > .row {\n outline: var(--ui-focus-width) solid var(--ui-focus-color);\n outline-offset: calc(var(--ui-focus-width) * -1);\n }\n\n /* the room for a triangle is always there, so the rows' icons line up */\n .toggle {\n flex: 0 0 12px;\n align-self: stretch;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n color: var(--_ui-tree-muted-color);\n }\n :host(:state(has-items)) > .row > .toggle::before {\n content: \"\";\n width: 0.62em;\n height: 0.62em;\n background: currentColor;\n clip-path: polygon(20% 5%, 90% 50%, 20% 95%);\n transition: rotate 0.1s;\n }\n :host(:state(has-items)[aria-expanded=\"true\"]) > .row > .toggle::before,\n :host(:state(open):state(has-items)) > .row > .toggle::before {\n rotate: 90deg;\n }\n\n .icon,\n ::slotted([slot=\"icon\"]) {\n flex: none;\n margin: 0;\n color: var(--_ui-tree-muted-color);\n --ui-icon-width: 1em;\n --ui-icon-distance: 0;\n }\n .label {\n flex: 0 1 auto;\n display: flex;\n gap: 0.33em;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n .words {\n flex: 0 1 auto;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n /* which one it is: shortened before the words are */\n .which {\n flex: 0 10 auto;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n color: var(--_ui-tree-muted-color);\n }\n .actions {\n display: inline-flex;\n align-items: center;\n gap: var(--_ui-tree-gap);\n margin-inline-start: auto;\n }\n\n /* ## `appearance=\"nav\"`: the docs site's side navigation */\n :host(:state(nav)) {\n --_ui-tree-nav-border-color: var(\n --ui-tree-nav-border-color,\n light-dark(color-mix(in oklab, var(--ui-brown-background), var(--ui-brown) 9%), var(--ui-border-color))\n );\n --_ui-tree-nav-band-background: var(\n --ui-tree-nav-band-background,\n color-mix(in oklab, var(--ui-brown-background) 50%, light-dark(#fffdf8, var(--ui-surface)))\n );\n --_ui-tree-nav-band-color: var(--ui-tree-nav-band-color, var(--ui-brown-text));\n --_ui-tree-nav-subheading-color: var(--ui-tree-nav-subheading-color, var(--ui-text-muted));\n --_ui-tree-nav-current-background: var(\n --ui-tree-nav-current-background,\n light-dark(var(--ui-primary-background), var(--ui-primary))\n );\n --_ui-tree-nav-current-color: var(\n --ui-tree-nav-current-color,\n light-dark(var(--ui-primary-text), var(--ui-primary-on))\n );\n --_ui-tree-nav-open-duration: var(--ui-tree-nav-open-duration, 320ms);\n --_ui-tree-nav-close-duration: var(--ui-tree-nav-close-duration, 140ms);\n --_ui-tree-nav-ease: var(--ui-tree-nav-ease, var(--ui-ease-out));\n --_ui-tree-indent: var(--ui-tree-indent, 1em);\n --_ui-tree-hover-background: var(--ui-tree-hover-background, oklch(from var(--ui-text-dark) l c h / 0.06));\n line-height: 1.25;\n }\n /* a row's rows, folded: one grid row, 1fr open, 0fr shut, what's in it clipped and hidden once it's folded */\n :host(:state(nav)) > .rows {\n display: grid;\n grid-template-rows: 1fr;\n }\n :host(:state(nav)) > .rows.shut {\n grid-template-rows: 0fr;\n }\n :host(:state(nav)) > .rows > .folded {\n min-height: 0;\n overflow: hidden;\n }\n :host(:state(nav)) > .rows.shut > .folded {\n visibility: hidden;\n }\n @media (prefers-reduced-motion: no-preference) {\n :host(:state(nav)) > .rows {\n transition: grid-template-rows var(--_ui-tree-nav-open-duration) var(--_ui-tree-nav-ease);\n }\n :host(:state(nav)) > .rows.shut {\n transition-duration: var(--_ui-tree-nav-close-duration);\n }\n /* hidden only once it's folded: its `visibility` waits out the close */\n :host(:state(nav)) > .rows.shut > .folded {\n transition: visibility 0s linear var(--_ui-tree-nav-close-duration);\n }\n :host(:state(nav)) > .row > .toggle {\n transition: opacity 150ms ease-out;\n }\n :host(:state(nav):state(has-items)) > .row > .toggle::before {\n transition:\n rotate 200ms var(--_ui-tree-nav-ease),\n translate 200ms var(--_ui-tree-nav-ease);\n }\n }\n :host(:state(nav)) > .row {\n gap: 0.75em;\n min-height: 2.25em;\n /* 0.5em of the tree's text, from inside this smaller text */\n margin-inline: calc(0.5em / 0.875);\n padding-block: 0.25em;\n padding-inline: calc(0.75em + var(--_ui-tree-depth, 0) * var(--_ui-tree-indent)) 0.75em;\n border-radius: var(--ui-radius-m);\n font-size: 0.875em;\n font-weight: 500;\n white-space: nowrap;\n }\n :host(:state(nav)) > .row:hover {\n color: var(--ui-text-dark);\n }\n :host(:state(nav):state(selected)) > .row {\n background: var(--_ui-tree-nav-current-background);\n color: var(--_ui-tree-nav-current-color);\n }\n :host(:state(nav):state(selected)) > .row .icon,\n :host(:state(nav):state(selected)) > .row > ::slotted([slot=\"icon\"]) {\n color: inherit;\n }\n /* the rows under a band: a little room above and below, as a list of links has, and a pixel between rows;\n a subheading band goes edge to edge, as the first and last thing under its heading */\n :host(:state(nav):state(band)) > .rows > .folded > slot {\n display: block;\n padding-block: 0.375em;\n }\n :host(:state(nav):not(:state(band))) {\n margin-block-end: 1px;\n }\n :host(:state(nav)[band=\"subheading\"]:first-child) {\n margin-block-start: -0.375em;\n }\n :host(:state(nav)[band=\"subheading\"]:last-child) {\n margin-block-end: -0.375em;\n }\n :host(:state(nav)) .icon,\n :host(:state(nav)) ::slotted([slot=\"icon\"]) {\n width: 1.25em;\n font-size: 1.05em;\n text-align: center;\n --ui-icon-width: 1.25em;\n }\n .count::part(label),\n .badge::part(label) {\n margin: 0;\n flex: none;\n }\n\n /* the chevron, at the row's end: pointing down while open, right while closed */\n :host(:state(nav)) > .row > .toggle {\n order: 99;\n flex-basis: 1em;\n margin-inline: auto -0.25em;\n opacity: 0.55;\n }\n :host(:state(nav)) > .row:hover > .toggle,\n :host(:state(nav):focus-visible) > .row > .toggle {\n opacity: 1;\n }\n :host(:state(nav):state(has-items)) > .row > .toggle::before {\n width: 0.45em;\n height: 0.45em;\n background: none;\n clip-path: none;\n border-inline-end: 1.5px solid currentColor;\n border-block-end: 1.5px solid currentColor;\n rotate: -45deg;\n translate: 0 -0.1em;\n }\n :host(:state(nav):state(has-items)[aria-expanded=\"true\"]) > .row > .toggle::before,\n :host(:state(nav):state(open):state(has-items)) > .row > .toggle::before {\n rotate: 45deg;\n translate: 0 -0.2em;\n }\n\n /* a heading band: the whole width, stuck at the top while its rows scroll under it */\n :host(:state(nav)) > .row.heading {\n position: sticky;\n top: 0;\n z-index: 1;\n min-height: 2.25em;\n margin: 0;\n padding: 0.25em 1em;\n border-radius: 0;\n border-block-start: 1px solid var(--_ui-tree-nav-border-color);\n background:\n linear-gradient(var(--_ui-tree-nav-band-background), var(--_ui-tree-nav-band-background)), var(--ui-background);\n color: var(--_ui-tree-nav-band-color);\n font: var(--ui-font-weight-bold) 0.75em / 1 var(--ui-font-family);\n letter-spacing: 0.01em;\n text-transform: uppercase;\n gap: 0.5em;\n }\n :host(:state(nav):first-child) > .row.heading {\n border-block-start: 0;\n }\n :host(:state(nav)) > .row.heading > .toggle,\n :host(:state(nav)) > .row.subheading > .toggle {\n font-size: 1.3em;\n }\n /* a subheading band, inside a heading's rows: lighter, in the monospace face */\n :host(:state(nav)) > .row.subheading {\n min-height: 2em;\n margin: 0;\n padding: 0.25em 1em;\n border-radius: 0;\n border-block-start: 1px solid color-mix(in oklab, var(--_ui-tree-nav-border-color) 60%, transparent);\n color: var(--_ui-tree-nav-subheading-color);\n font: 500 0.6875em / 1 var(--ui-font-family-mono);\n letter-spacing: 0.12em;\n text-transform: uppercase;\n gap: 0.5em;\n }\n :host(:state(nav)) > .row.subheading:hover {\n color: var(--ui-text-dark);\n }\n :host(:state(nav)) > .row.heading .count::part(label),\n :host(:state(nav)) > .row.subheading .count::part(label) {\n font-family: var(--ui-font-family);\n letter-spacing: 0;\n }\n :host(:state(nav):state(band)) > .row:hover {\n background-color: transparent;\n }\n :host(:state(nav):state(band):focus-visible) > .row {\n outline-offset: calc(var(--ui-focus-width) * -1);\n }\n}\n","import { Show } from \"solid-js\"\n\nimport { E } from \"spell/ui/core\"\nimport { treeItemVocabulary } from \"./UITreeItem.en\"\n\nimport treeCSS from \"./UITree.css?inline\"\n\n/****************\n * ### `UITreeItem`\n * The component behind `<ui-tree-item>`: one row of a `<ui-tree>`, holding the rows inside it as its children.\n *\n * <div part=\"row\"> (the whole width of the tree, however deep the row)\n * <span part=\"toggle\"/> (the triangle: a click opens or closes it, and selects nothing)\n * <slot name=\"icon\"/> <span part=\"label\"/> <slot name=\"actions\"/>\n * </div>\n * <div part=\"group\"> (the rows inside it, while it's open)\n * <div class=\"folded\"><slot/></div>\n * </div>\n *\n * - Opening and closing are a `Disclosure`: `open`, `ui-opening`, `ui-closing`, as a section's are.\n * - A click on the row isn't handled here: it reaches `<ui-tree>`, which knows the other rows.\n * - The row is what takes the focus' ring, though the DOM element takes the focus: the tree's keys move it.\n * - How deep it is comes from its place, read as it connects: it pads its row, so a selected row fills the width.\n * - Its tree's `appearance=\"nav\"` (a site's side navigation) gives it the docs site's look: `:state(nav)`, read as it\n * connects too. Then a `band` row is a heading over the rows inside it, and `count` / `badge` label its words.\n * - Its rows stay drawn while it's closed (shut, and out of the keys' and a screen reader's reach), so they ease open\n * and shut, as the docs site's folds do (`--ui-tree-nav-open-duration` ...). Every other tree draws them only\n * while it's open.\n ****************/\nexport class UITreeItem extends E.UIComponent<typeof treeItemVocabulary> {\n @E.proto static vocabulary = treeItemVocabulary\n @E.protoMerged static elementSetup: Partial<E.ElementSetup> = {\n styleSheets: { tree: treeCSS },\n delegatesFocus: false,\n aria: { role: \"treeitem\" },\n cssStates: [\"selected\"]\n }\n\n /** The rows inside it show. */\n @E.cssState(\"open\") @E.controlled(\"open\") accessor isOpen = false\n\n /** Opening and closing it, as a person would. */\n readonly disclosure = new E.Disclosure({ component: this, member: \"isOpen\" })\n\n /** How many rows it's inside. */\n @E.state accessor depth = 0\n\n /** How many rows it's inside that aren't `band`s: how far in it's drawn, as a heading band adds no step. */\n @E.state accessor indent = 0\n\n /** Its tree is a side navigation (`appearance=\"nav\"`): `:state(nav)`. */\n @E.cssState(\"nav\") @E.state accessor isInNav = false\n\n /** It's a heading band over its rows: `:state(band)`, with `band`'s value as a class of its row. */\n @E.cssState(\"band\")\n get isBand(): boolean {\n return !!this.band\n }\n\n /** The tree's `filter` hides it. */\n @E.state @E.cssState(\"filtered-out\") accessor isFilteredOut = false\n\n /** The tree's `filter` matches a row inside it, so those show though it's closed. */\n @E.state accessor isKeptOpen = false\n\n /** Does it have a row inside it? Rows only, so a marker between them doesn't count. */\n @E.watches({ childList: true })\n get hasRows(): boolean {\n return [...this.domElement.children].some((child) => child.localName === this.domElement.localName)\n }\n\n /** It can open: it has rows, or says it will. */\n @E.cssState(\"has-items\")\n get canOpen(): boolean {\n return this.hasRows || !!this.expandable\n }\n\n /** The rows inside it are on screen. */\n get showsRows(): boolean {\n return this.canOpen && (this.isOpen || this.isKeptOpen)\n }\n\n /** The box of rows inside it is drawn: while they show, and always in a side navigation, so they ease. */\n get drawsRows(): boolean {\n return this.showsRows || (this.isInNav && this.canOpen)\n }\n\n /** What `ui-changed` calls it. */\n get valueOrLabel(): string {\n return this.value ?? this.label ?? \"\"\n }\n\n /** The words the tree's `filter` looks in: its `label` and `which`, or what's in its `label` slot. */\n get filterWords(): string {\n const slotted = this.domElement.querySelector(':scope > [slot=\"label\"]')?.textContent ?? \"\"\n return `${this.label ?? \"\"} ${this.which ?? \"\"} ${slotted}`\n }\n\n /** The screen reader's `aria-expanded`. */\n @E.aria(\"expanded\")\n get ariaOpen(): \"true\" | \"false\" | undefined {\n return this.canOpen ? (this.showsRows ? \"true\" : \"false\") : undefined\n }\n\n /** The screen reader's `aria-selected`. */\n @E.aria(\"selected\")\n get ariaIsSelected(): \"true\" | \"false\" | undefined {\n return this.group ? undefined : this.selected ? \"true\" : \"false\"\n }\n\n /** The screen reader's `aria-level`: 1 for a top row. */\n @E.aria(\"level\")\n get ariaDepth(): string {\n return String(this.depth + 1)\n }\n\n render() {\n return (\n <>\n <div class={[\"row\", this.band]} part={this.partForName(\"row\")} style={{ \"--_ui-tree-depth\": this.indent }}>\n <span\n class=\"toggle\"\n part={this.partForName(\"toggle\")}\n aria-hidden=\"true\"\n title={this.canOpen ? this.translationForKey(this.isOpen ? \"close\" : \"open\") : undefined}\n onClick={this.onToggleClicked}\n />\n <slot name=\"icon\">\n <Show when={this.icon}>{(icon) => <ui-icon class=\"icon\" name={icon()} />}</Show>\n </slot>\n <span class=\"label\" part={this.partForName(\"label\")}>\n <slot name=\"label\">\n <span class=\"words\">{this.label}</span>\n <Show when={this.which}>{(which) => <span class=\"which\">{which()}</span>}</Show>\n </slot>\n </span>\n <Show when={this.count}>\n {(count) => (\n <ui-label class=\"count\" part={this.partForName(\"count\")} size=\"mini\" appearance=\"circular\">\n {count()}\n </ui-label>\n )}\n </Show>\n <Show when={this.badge}>\n {(badge) => (\n <ui-label class=\"badge\" part={this.partForName(\"badge\")} size=\"mini\" color=\"yellow\" appearance=\"basic\">\n {badge()}\n </ui-label>\n )}\n </Show>\n <span class=\"actions\">\n <slot name=\"actions\" />\n </span>\n </div>\n <Show when={this.drawsRows}>\n <div\n class={[\"rows\", { shut: !this.showsRows }]}\n role=\"group\"\n part={this.partForName(\"group\")}\n inert={this.showsRows ? undefined : \"\"}\n >\n <div class=\"folded\">\n <slot />\n </div>\n </div>\n </Show>\n </>\n )\n }\n\n /** The triangle was clicked: open or close, and select nothing. */\n @E.untracked private readonly onToggleClicked = (event: MouseEvent) => {\n if (!this.canOpen) return\n event.stopPropagation()\n this.disclosure.toggle(event)\n }\n\n /** It connected: how deep it is, and whether its tree is a side navigation. */\n onConnect() {\n super.onConnect()\n let depth = 0\n let indent = 0\n let at = this.domElement.parentElement\n for (; at && at.localName === this.domElement.localName; at = at.parentElement) {\n depth++\n if (!at.hasAttribute(BAND)) indent++\n }\n this.depth = depth\n this.indent = indent\n this.isInNav = at?.getAttribute(\"appearance\") === NAV\n }\n\n /** It was selected, by whatever: it shows, in the middle of the tree if it was out of sight. */\n @E.onChange(\"selected\", { defer: true })\n protected onSelectedChanged(selected: boolean | undefined) {\n if (selected) E.scrollIntoSight(this.domElement)\n }\n}\n\nexport interface UITreeItem extends E.AttributeValues<typeof treeItemVocabulary> {}\n\n/** The tree's `appearance` that makes it a side navigation. */\nconst NAV = \"nav\"\n\n/** The attribute of a row that's a heading band: it adds no step in. */\nconst BAND = \"band\"\n","import { isServer } from \"@solidjs/web\"\nimport { For, Show } from \"solid-js\"\n\nimport { E, UI } from \"spell/ui/core\"\nimport { treeVocabulary } from \"./UITree.en\"\nimport { UITreeItem } from \"./UITreeItem\"\n\nimport treeCSS from \"./UITree.css?inline\"\n\n/****************\n * ### `UITree`\n * The component behind `<ui-tree>`: rows nested in rows (`<ui-tree-item>`s), which open and close,\n * selected one or many at a time.\n * - Its rows are its children, and each row's rows are that row's: the nesting IS the tree.\n * - Selecting: a click on a row, or Enter or Space on it.\n * - `choose=\"many\"` follows the rule every list of ours does (`E.ListSelection`): Shift takes a range, Command or\n * Control adds or takes away, over the rows on screen, in their order.\n * - It asks first, with a cancelable `ui-selecting`: a page that decides what's selected itself cancels it,\n * and sets each row's `selected`.\n * - Keys, the tree pattern: up and down, Home and End (`UI.focus.roving()`); right opens, then goes in; left closes,\n * then goes out. One tab stop.\n * - `filter`: only the rows whose words hold it, with the rows they're inside kept open.\n * It changes no row's `open`. Rows drawn only once their parent opens can't be found while that's closed.\n * - Plain walks over its light DOM, so 500 rows filter in a few milliseconds.\n * - `sticky-path`: while it scrolls, one line pinned at its top names the open rows the first row in view is inside.\n * - Read again on every scroll of whatever scrolls it, before the next paint: rows know nothing of it.\n * - Hidden from screen readers: each row already says how deep it is (`aria-level`), and the keys walk the rows.\n ****************/\nexport class UITree extends E.UIComponent<typeof treeVocabulary> {\n @E.proto static vocabulary = treeVocabulary\n @E.protoMerged static elementSetup: Partial<E.ElementSetup> = {\n styleSheets: { tree: treeCSS },\n delegatesFocus: false,\n aria: { role: \"tree\" }\n }\n\n /** The anchor of a Shift range. */\n private readonly selection = new E.ListSelection<UITreeItem>()\n\n /** Up, down, Home and End over the rows on screen, once it's connected. */\n private roving: ReturnType<typeof UI.focus.roving> | undefined\n\n /** Its `filter` matches no row. */\n @E.state @E.cssState(\"no-matches\") accessor hasNoMatches = false\n\n /** It has a `filter`. */\n @E.cssState(\"filtering\")\n get isFiltering(): boolean {\n return !!this.filter\n }\n\n /** The screen reader's `aria-multiselectable`. */\n @E.aria(\"multiSelectable\")\n get ariaIsMany(): \"true\" | undefined {\n return this.choose === MANY ? \"true\" : undefined\n }\n\n /** The screen reader's `aria-label`. */\n @E.aria(\"label\")\n get ariaName(): string | undefined {\n return this.label\n }\n\n render() {\n return (\n <>\n <Show when={this.pathRows.length}>\n <div class=\"path\" part={this.partForName(\"path\")} aria-hidden=\"true\">\n <For each={this.pathRows}>\n {(row, index) => (\n <>\n <Show when={index()}>\n <span class=\"separator\">›</span>\n </Show>\n <span\n class=\"path-row\"\n part={this.partForName(\"path-row\")}\n style={{ \"flex-shrink\": 100 ** (this.pathRows.length - 1 - index()) }}\n onClick={() => this.scrollToRow(row)}\n >\n {row.label}\n </span>\n </>\n )}\n </For>\n </div>\n </Show>\n <slot />\n <Show when={this.hasNoMatches}>\n <div class=\"empty\" part={this.partForName(\"empty\")}>\n <slot name=\"empty\">{this.translationForKey(\"noMatches\")}</slot>\n </div>\n </Show>\n </>\n )\n }\n\n ////////////////\n // ## Rows\n ////////////////\n\n /** The rows directly under `parent`. */\n private rowsIn(parent: Element): UITreeItem[] {\n const rows: UITreeItem[] = []\n for (const child of parent.children) {\n const { component } = child as E.DOMElement\n if (component instanceof UITreeItem) rows.push(component)\n }\n return rows\n }\n\n /** The rows on screen, in their order. */\n private get rowsOnScreen(): UITreeItem[] {\n const walk = (parent: Element): UITreeItem[] =>\n this.rowsIn(parent).flatMap((row) =>\n row.isFilteredOut ? [] : [row, ...(row.showsRows ? walk(row.domElement) : [])]\n )\n return walk(this.domElement)\n }\n\n /** Every row, on screen or not, in its order. */\n private get allRows(): UITreeItem[] {\n const walk = (parent: Element): UITreeItem[] => this.rowsIn(parent).flatMap((row) => [row, ...walk(row.domElement)])\n return walk(this.domElement)\n }\n\n /** The row `event` happened on: the innermost, whatever it went through. */\n private rowOf(event: Event): UITreeItem | undefined {\n for (const target of event.composedPath()) {\n if (target === this.domElement) return undefined\n const { component } = target as E.DOMElement\n if (component instanceof UITreeItem) return component\n }\n return undefined\n }\n\n ////////////////\n // ## Selecting\n ////////////////\n\n /** A row was clicked. A button in its `actions`, or a link, is that control's click. */\n @E.on(\"click\")\n protected onClicked(event: MouseEvent) {\n const row = this.rowOf(event)\n if (!row || E.OwnControls.isClicked(event, { upTo: row.domElement })) return\n this.roving?.focus(this.roving.items.indexOf(row.domElement))\n this.activate(row, event)\n }\n\n /** `row` was clicked, or Enter or Space pressed on it. */\n private activate(row: UITreeItem, event: MouseEvent | KeyboardEvent) {\n if (row.group) {\n row.disclosure.toggle(event)\n return\n }\n const value = row.valueOrLabel\n if (!this.send(\"ui-selecting\", { item: row.domElement, value, originalEvent: event })) return\n const rows = this.rowsOnScreen.filter((each) => !each.group)\n const selected = this.allRows.filter((each) => each.selected)\n const next = new Set(\n this.choose === MANY ? this.selection.clicked(row, { items: rows, selected, keys: event }) : [row]\n )\n for (const each of this.allRows) {\n if (!!each.selected !== next.has(each)) each.selected = next.has(each)\n }\n const values = this.allRows.filter((each) => next.has(each)).map((each) => each.valueOrLabel)\n this.send(\"ui-changed\", { value, values, originalEvent: event })\n }\n\n ////////////////\n // ## Keys\n ////////////////\n\n /** Is it in the page, with the runtime there to rove with? */\n protected get canRove(): boolean {\n return this.isReady && this.isConnected\n }\n\n /** The keys, while it's in the page: the rows are read again on each press. */\n @E.onChange(\"canRove\")\n protected onCanRoveChanged(canRove: boolean) {\n if (!canRove) return\n this.roving = UI.focus.roving({\n container: this.domElement,\n items: () => this.rowsOnScreen.map((row) => row.domElement),\n orientation: \"vertical\",\n wrap: false,\n activeIndex: Math.max(\n 0,\n this.rowsOnScreen.findIndex((row) => row.selected)\n )\n })\n return () => {\n this.roving?.detach()\n this.roving = undefined\n }\n }\n\n /** Right, left, Enter and Space; the rest are `UI.focus.roving()`'s. */\n @E.on(\"keydown\")\n protected onKeyDown(event: KeyboardEvent) {\n const row = this.rowOf(event)\n if (!row || event.target !== row.domElement) return\n const handled = this.keyActions(row)[event.key]?.(event)\n if (handled === false) return\n if (handled !== undefined) event.preventDefault()\n }\n\n /** What each key does on `row`; `false`: it did nothing, so leave the key alone. */\n private keyActions(row: UITreeItem): Record<string, (event: KeyboardEvent) => unknown> {\n const select = (event: KeyboardEvent) => this.activate(row, event)\n return {\n Enter: select,\n \" \": select,\n ArrowRight: () => {\n if (!row.canOpen) return false\n if (!row.showsRows) row.disclosure.open()\n else this.focusRow(this.rowsIn(row.domElement).find((each) => !each.isFilteredOut))\n return true\n },\n ArrowLeft: (): unknown => {\n if (row.isOpen && row.canOpen) return row.disclosure.close()\n const parent = row.domElement.parentElement as E.DOMElement | null\n const up = parent?.component\n if (up instanceof UITreeItem) return this.focusRow(up) ?? true\n return false\n }\n }\n }\n\n /** Move the focus to `row`. */\n private focusRow(row: UITreeItem | undefined) {\n if (row) this.roving?.focus(this.roving.items.indexOf(row.domElement))\n }\n\n ////////////////\n // ## The sticky path\n ////////////////\n\n /** `sticky-path`: the open rows the first row in view is inside, outermost first, while one is out of sight. */\n @E.state({ equals: E.isSameList }) accessor pathRows: readonly UITreeItem[] = []\n\n /** A read of the path is waiting for the next paint. */\n private cancelPathRead: (() => void) | undefined\n\n /** While connected with `sticky-path`: every scroll that moves the tree reads the path again. */\n @E.onChange(\"isConnected\", \"stickyPath\")\n protected watchScrolling(isConnected: boolean, stickyPath: boolean | undefined) {\n if (!isConnected || !stickyPath || isServer) {\n this.pathRows = []\n return undefined\n }\n // a scroll doesn't bubble: caught on its way down, from whatever box scrolls the tree; one read a frame\n const onScroll = () => this.readPathSoon()\n document.addEventListener(\"scroll\", onScroll, { capture: true, passive: true })\n this.readPathSoon()\n return () => {\n document.removeEventListener(\"scroll\", onScroll, { capture: true })\n this.cancelPathRead?.()\n }\n }\n\n /** Read the path before the next paint, once however many scrolls ask. */\n private readPathSoon() {\n this.cancelPathRead ??= E.beforeNextPaint(() => {\n this.cancelPathRead = undefined\n this.pathRows = this.readPath()\n })\n }\n\n /** The open rows around the first row in view, when the outermost of them is above the top of what's in view. */\n private readPath(): UITreeItem[] {\n const box = E.scrollingBoxFor(this.domElement)\n const top = Math.max(box?.getBoundingClientRect().top ?? 0, this.domElement.getBoundingClientRect().top)\n const first = this.rowsOnScreen.find((row) => rowBoxOf(row).bottom > top + this.pathHeight)\n if (!first) return []\n const around: UITreeItem[] = []\n for (let at = first.domElement.parentElement; at && at !== this.domElement; at = at.parentElement) {\n const { component } = at as E.DOMElement\n if (component instanceof UITreeItem) around.unshift(component)\n }\n return around.length && rowBoxOf(around[0]!).top < top ? around : []\n }\n\n /** Scroll so `row` is the first row in view, just under the path, selecting nothing. */\n private scrollToRow(row: UITreeItem) {\n const box = E.scrollingBoxFor(this.domElement)\n if (!box) return\n const top = Math.max(box.getBoundingClientRect().top, this.domElement.getBoundingClientRect().top)\n box.scrollTop += rowBoxOf(row).top - top - this.pathHeight\n }\n\n /** How tall the path's line is while it shows: 0 while it doesn't. */\n private get pathHeight(): number {\n return this.domElement.renderRoot.querySelector<HTMLElement>(\".path\")?.offsetHeight ?? 0\n }\n\n ////////////////\n // ## Filtering\n ////////////////\n\n /** The text to look for changed. */\n @E.onChange(\"filter\", \"isReady\")\n protected onFilterChanged() {\n this.applyFilter()\n }\n\n /** Rows came or went, or their words changed. */\n @E.watches({ childList: true, subtree: true, attributes: true, attributeFilter: [\"label\", \"which\"] })\n protected onRowsChanged() {\n if (this.filter) this.applyFilter()\n this.roving?.refresh()\n }\n\n /** Hide what doesn't match, and keep open what's around what does. */\n private applyFilter() {\n const text = (this.filter ?? \"\").trim().toLowerCase()\n const matchIn = (parent: Element): boolean => {\n let anyMatch = false\n for (const row of this.rowsIn(parent)) {\n const isInside = matchIn(row.domElement)\n const isMatch = !text || row.filterWords.toLowerCase().includes(text)\n row.isFilteredOut = !isMatch && !isInside\n row.isKeptOpen = !!text && isInside\n anyMatch ||= isMatch || isInside\n }\n return anyMatch\n }\n this.hasNoMatches = !matchIn(this.domElement) && !!text\n }\n}\n\nexport interface UITree extends E.AttributeValues<typeof treeVocabulary> {}\n\n/** Where `row`'s own line is on screen, without the rows inside it. */\nfunction rowBoxOf(row: UITreeItem): DOMRect {\n return (row.domElement.renderRoot.querySelector(\".row\") ?? row.domElement).getBoundingClientRect()\n}\n\n/** `choose` of a tree whose rows are selected many at a time. */\nconst MANY = \"many\"\n","/**\n * The tree family: defines `<ui-tree>` and `<ui-tree-item>`, and exports their components.\n * - SIDE EFFECT: importing it defines the tags, `<ui-icon>` through the icon barrel,\n * so a page never has to import the icons its rows show, and `<ui-label>`, a row's `count` and `badge`.\n * - Also the library's `spell/ui/ui-tree` entry.\n */\n\nimport { UITree } from \"./UITree\"\nimport { UITreeItem } from \"./UITreeItem\"\n\nimport \"spell/ui/components/ui-icon\"\nimport \"spell/ui/components/ui-label\"\n\nUITree.define()\nUITreeItem.define()\n\nexport { UITree, UITreeItem }\n"],"mappings":";;;;;;;AAWA,IAAagF,KAAiB;CAC5B,KAAK;CACL,MAAM;CACN,QAAQ,CAAC,SAAS,YAAY;CAC9B,KAAK;EAAC;EAAa;EAAW;EAAa;EAAa;EAAe;CAAa;CACpF,MAAM;CACN,aAAa;CACb,UAAU;CACV,YAAY;EACV;GACE,MAAM;GACN,OAAO;GACP,MAAM;GACN,QAAQ,CAAC,OAAO,MAAM;GACtB,SAAS;IAAE,KAAK;IAAI,MAAM;GAAO;GACjC,aACE;EAEJ;EACA;GACE,MAAM;GACN,OAAO;GACP,MAAM;GACN,aACE;EAGJ;EACA;GACE,MAAM;GACN,OAAO;GACP,MAAM;GACN,aAAa;EACf;EACA;GACE,MAAM;GACN,OAAO;GACP,MAAM;GACN,QAAQ,CAAC,KAAK;GACd,aACE;EAEJ;EACA;GACE,MAAM;GACN,OAAO;GACP,MAAM;GACN,aACE;EAGJ;CACF;CACA,QAAQ,CACN;EACE,MAAM;EACN,YAAY;EACZ,QAAQ;EACR,aACE;CAEJ,GACA;EACE,MAAM;EACN,QAAQ;EACR,aACE;CAEJ,CACF;CACA,OAAO,CACL;EAAE,MAAM;EAAI,aAAa;CAAoC,GAC7D;EAAE,MAAM;EAAS,aAAa;CAAsC,CACtE;CACA,OAAO;EACL;GAAE,MAAM;GAAS,aAAa;EAAmC;EACjE;GAAE,MAAM;GAAQ,aAAa;EAAyE;EACtG;GAAE,MAAM;GAAY,aAAa;EAA+C;CAClF;CACA,QAAQ,CACN;EAAE,MAAM;EAAa,aAAa;CAAqB,GACvD;EAAE,MAAM;EAAc,aAAa;CAA+B,CACpE;CACA,OAAO,CACL;EACE,KAAK;EACL,MAAM;EACN,aAAa;CACf,CACF;AACF,GC1FaC,KAAqB;CAChC,KAAK;CACL,MAAM;CACN,QAAQ,CAAC,SAAS,YAAY;CAC9B,KAAK;EAAC;EAAa;EAAY;CAAa;CAC5C,MAAM;C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AvJWY,CAAA,GA4KXxH,EAAAqH,GAAA,GAAU,aADVV,IA3KWa,CAAA,GAoNwBxH,EAAAqH,GAAA,GAAS,YAA5CX,IApNWc,GAoNiCD,CAAA,GAO5CvH,EAAAqH,GAAA,GAAU,kBADVZ,IA1NWe,CAAA,GAmRXxH,EAAAqH,GAAA,GAAU,mBADVb,IAlRWgB,CAAA,GAyRXxH,EAAAqH,GAAA,GAAU,iBADVd,IAxRWiB,CAAA,GACFxH,EAAAqH,GAAA,IAAO,cAAhBF,IADWK,CAAA,GAEIxH,EAAAqH,GAAA,IAAO,gBAAtBH,IAFWM,CAAA,GAANvH,EAAAoH,GAAMG,CAAA,GAAoD7H,EAAA6H,GAAA,QAAA,GACtDzH,EADEyH,GACK,cAAatH,EAApBmH,GAAA,IADEG,GACkBlH,EAAA,CAAA,GAApBJ,EAAAmH,GAAA,IADEG,CAAA,GAEIzH,EAFJyH,GAEW,gBAAwCtH,EAA/CmH,GAAA,IAFJG,GAEmD;CAC5D,aAAa,EAAE,MAAM5H,EAAQ;CAC7B,gBAAgB;CAChB,MAAM,EAAE,MAAM,OAAO;AACvB,CAAA,CAAA,GAJeM,EAAAmH,GAAA,IAFJG,CAAA;AAAN,IAAMqC,KAANrC;AAmTP,SAAS,SAAS,GAA0B;CAC1C,QAAQO,EAAI,WAAW,WAAW,cAAc,MAAM,KAAKA,EAAI,WAAA,CAAY,sBAAsB;AACnG;AAFSpI,EAAA,UAAA,UAAA;AAKT,IAAMiI,KAAO;eCvUbiC,GAAO,OAAO,GACd7D,EAAW,OAAO"}
|
package/dist/ui-video.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./rolldown-runtime-CYGlBXrH.js";
|
|
2
|
-
import { Bt as e, DOMElement as t,
|
|
2
|
+
import { Bt as e, DOMElement as t, Ht as n, Lt as r, Rt as i, UIComponent as a, Ut as o, cssState as s, proto as c, protoMerged as l, zt as u } from "./core.js";
|
|
3
3
|
import { Show as d } from "solid-js";
|
|
4
4
|
import { className as f, createComponent as p, effect as m, insert as h, isServer as g, readShallow as _, ref as v, setAttribute as y, style as b, template as x } from "@solidjs/web";
|
|
5
5
|
//#region src/components/ui-video/UIVideo.types.ts
|
|
@@ -46,6 +46,7 @@ var S = [
|
|
|
46
46
|
}
|
|
47
47
|
], w = {
|
|
48
48
|
tag: "ui-video",
|
|
49
|
+
icon: "video",
|
|
49
50
|
topics: ["media", "elements"],
|
|
50
51
|
aka: [
|
|
51
52
|
"video",
|
|
@@ -98,7 +99,7 @@ var S = [
|
|
|
98
99
|
}]
|
|
99
100
|
}, T, E, D, DOMMediaElement = class extends t {
|
|
100
101
|
static {
|
|
101
|
-
|
|
102
|
+
e(this, "DOMMediaElement");
|
|
102
103
|
}
|
|
103
104
|
play() {
|
|
104
105
|
return this.component?.play() ?? Promise.resolve();
|
|
@@ -116,9 +117,9 @@ var S = [
|
|
|
116
117
|
get paused() {
|
|
117
118
|
return this.component?.media?.paused ?? !0;
|
|
118
119
|
}
|
|
119
|
-
}, O = class _MediaPlayer extends (E =
|
|
120
|
+
}, O = class _MediaPlayer extends (E = a, T = [l], E) {
|
|
120
121
|
constructor() {
|
|
121
|
-
super(...arguments),
|
|
122
|
+
super(...arguments), n(this, "media");
|
|
122
123
|
}
|
|
123
124
|
play() {
|
|
124
125
|
return this.media?.play() ?? Promise.resolve();
|
|
@@ -131,15 +132,15 @@ var S = [
|
|
|
131
132
|
for (let [t, n] of A) e.addEventListener(t, () => this.send(n, { currentTime: e.currentTime }));
|
|
132
133
|
}
|
|
133
134
|
};
|
|
134
|
-
D =
|
|
135
|
+
D = u(E), r(D, 13, "elementSetup", T, O), i(D, O), e(O, "MediaPlayer"), n(O, "elementSetup", o(D, 8, O, {
|
|
135
136
|
DOMElement: DOMMediaElement,
|
|
136
137
|
delegatesFocus: !0
|
|
137
|
-
})),
|
|
138
|
+
})), o(D, 11, O);
|
|
138
139
|
var k = O, A = [
|
|
139
140
|
["play", "ui-play"],
|
|
140
141
|
["pause", "ui-pause"],
|
|
141
142
|
["ended", "ui-ended"]
|
|
142
|
-
], j = "@layer ui.components.video.types{:host{max-inline-size:100%;display:block}:host(:state(silent)){display:none}.ui.video{border-radius:var(--ui-video-radius,var(--ui-radius));background:#000;block-size:auto;inline-size:100%;display:block}.ui.audio{inline-size:100%;display:block}}", M = /* @__PURE__ */ x("<track kind=captions default>"), N = /* @__PURE__ */ x("<video playsinline>"), P, F, I, L, R = class _UIVideo extends (I = k, F = [
|
|
143
|
+
], j = "@layer ui.components.video.types{:host{max-inline-size:100%;display:block}:host(:state(silent)){display:none}.ui.video{border-radius:var(--ui-video-radius,var(--ui-radius));background:#000;block-size:auto;inline-size:100%;display:block}.ui.audio{inline-size:100%;display:block}}", M = /* @__PURE__ */ x("<track kind=captions default>"), N = /* @__PURE__ */ x("<video playsinline>"), P, F, I, L, R = class _UIVideo extends (I = k, F = [c], P = [l], I) {
|
|
143
144
|
get aspectRatio() {
|
|
144
145
|
let e = this.ratio?.trim();
|
|
145
146
|
return e && /^\d+(\.\d+)?(\s*\/\s*\d+(\.\d+)?)?$/.test(e) ? e : void 0;
|
|
@@ -180,9 +181,10 @@ var k = O, A = [
|
|
|
180
181
|
}), t;
|
|
181
182
|
}
|
|
182
183
|
};
|
|
183
|
-
L =
|
|
184
|
+
L = u(I), r(L, 13, "vocabulary", F, R), r(L, 13, "elementSetup", P, R), i(L, R), e(R, "UIVideo"), n(R, "vocabulary", o(L, 8, R, w)), o(L, 11, R), n(R, "elementSetup", o(L, 12, R, { styleSheets: { video: j } })), o(L, 15, R);
|
|
184
185
|
var z = R, B = {
|
|
185
186
|
tag: "ui-audio",
|
|
187
|
+
icon: "volume up",
|
|
186
188
|
topics: ["media", "elements"],
|
|
187
189
|
aka: [
|
|
188
190
|
"audio",
|
|
@@ -210,9 +212,9 @@ var z = R, B = {
|
|
|
210
212
|
description: "No `controls`: nothing shows."
|
|
211
213
|
}],
|
|
212
214
|
texts: []
|
|
213
|
-
}, V = /* @__PURE__ */ x("<audio>"), H, U, W, G, K, q = class _UIAudio extends (G = k, W = [
|
|
215
|
+
}, V = /* @__PURE__ */ x("<audio>"), H, U, W, G, K, q = class _UIAudio extends (G = k, W = [c], U = [l], H = [s("silent")], G) {
|
|
214
216
|
constructor() {
|
|
215
|
-
super(...arguments),
|
|
217
|
+
super(...arguments), o(K, 5, this);
|
|
216
218
|
}
|
|
217
219
|
get isSilent() {
|
|
218
220
|
return !this.controls;
|
|
@@ -234,7 +236,7 @@ var z = R, B = {
|
|
|
234
236
|
}), t;
|
|
235
237
|
}
|
|
236
238
|
};
|
|
237
|
-
K =
|
|
239
|
+
K = u(G), r(K, 2, "isSilent", H, q), r(K, 13, "vocabulary", W, q), r(K, 13, "elementSetup", U, q), i(K, q), e(q, "UIAudio"), n(q, "vocabulary", o(K, 8, q, B)), o(K, 11, q), n(q, "elementSetup", o(K, 12, q, { styleSheets: { video: j } })), o(K, 15, q);
|
|
238
240
|
var J = q;
|
|
239
241
|
z.define(), J.define();
|
|
240
242
|
//#endregion
|
package/dist/ui-video.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-video.js","names":["_elementSetup_dec","_a","_init","E.DOMElement","E.UIComponent","E.protoMerged","__name","this","ref={(video) => this.adopt(video)}","<Show when={this.captions}>\n <track\n kind=\"captions\"\n src={this.captions}\n srclang={this.pageLanguage}\n label={this.isReady ? this.translationForKey(\"captions\") : void 0}\n default\n />\n </Show>","srclang={this.pageLanguage}","label={this.isReady ? this.translationForKey(\"captions\") : void 0}","<track\n kind=\"captions\"\n src={this.captions}\n srclang={this.pageLanguage}\n label={this.isReady ? this.translationForKey(\"captions\") : void 0}\n default\n />","part={this.partForName(\"video\")}","src={this.src}","poster={this.poster}","controls={this.controls}","autoplay={this.autoplay}","muted={this.muted}","loop={this.loop}","aria-label={this.sharedLabel}","style={this.aspectRatio ? { \"aspect-ratio\": this.aspectRatio } : void 0}","<video\n ref={(video) => this.adopt(video)}\n class={this.rootClass}\n part={this.partForName(\"video\")}\n src={this.src}\n poster={this.poster}\n controls={this.controls}\n autoplay={this.autoplay}\n muted={this.muted}\n loop={this.loop}\n playsinline\n aria-label={this.sharedLabel}\n style={this.aspectRatio ? { \"aspect-ratio\": this.aspectRatio } : void 0}\n >\n <Show when={this.captions}>\n <track\n kind=\"captions\"\n src={this.captions}\n srclang={this.pageLanguage}\n label={this.isReady ? this.translationForKey(\"captions\") : void 0}\n default\n />\n </Show>\n </video>","_tmpl$","_elementSetup_dec","_vocabulary_dec","_a","_init","E.proto","E.protoMerged","_$createComponent","_$setAttribute","_$readShallow","__name","videoCSS","this","ref={(audio) => this.adopt(audio)}","part={this.partForName(\"audio\")}","src={this.src}","controls={this.controls}","autoplay={this.autoplay}","muted={this.muted}","loop={this.loop}","aria-label={this.sharedLabel}","<audio\n ref={(audio) => this.adopt(audio)}\n class={this.rootClass}\n part={this.partForName(\"audio\")}\n src={this.src}\n controls={this.controls}\n autoplay={this.autoplay}\n muted={this.muted}\n loop={this.loop}\n aria-label={this.sharedLabel}\n />","E.proto","E.protoMerged","E.cssState","_$readShallow","_$setAttribute","__name","videoCSS","__publicField","__decorateElement","__decoratorMetadata","__decoratorStart","__name$1","__runInitializers","MediaAttributes","MediaEvents","videoVocabulary","_elementSetup_dec$2","_a$2","_init$2","DOMElement","media","seconds","_MediaPlayer","UIComponent","protoMerged","native","event","PLAYER_EVENTS","MediaPlayer","UIVideo_default","_tmpl$$1","_tmpl$2","_elementSetup_dec$1","_vocabulary_dec$1","_a$1","_init$1","_UIVideo","proto","ratio","isServer","_self$","_el$","ref","video","insert","createComponent","Show","_el$2","effect","_p$","setAttribute","t","a","readShallow","className","o","i","n","h","r","style","d","UIVideo","audioVocabulary","_tmpl$","_isSilent_dec","_elementSetup_dec","_vocabulary_dec","_a","_init","_UIAudio","cssState","audio","UIAudio"],"sources":["../src/components/ui-video/UIVideo.types.ts","../src/components/ui-video/UIVideo.en.ts","../src/components/ui-video/MediaPlayer.tsx","../src/components/ui-video/UIVideo.css?inline","../src/components/ui-video/UIVideo.tsx","../src/components/ui-video/UIAudio.en.ts","../src/components/ui-video/UIAudio.tsx","../src/components/ui-video/index.ts"],"sourcesContent":["/**\n * What `<ui-video>` and `<ui-audio>` share: their attributes and events, as vocabulary pieces.\n * - Pure data: the vocabularies import it, and node reads them.\n */\n\nimport type { E } from \"spell/ui/core\"\n\n/** The attributes every player takes: what to play, and how. */\nexport const MediaAttributes = [\n { name: \"src\", group: \"link\", kind: \"string\", description: \"The file to play, relative to the page.\" },\n {\n name: \"autoplay\",\n group: \"behaviour\",\n kind: \"boolean\",\n description:\n \"Starts playing as soon as it can. A browser allows that only when `muted`, or after the reader has \" +\n \"clicked on the page.\"\n },\n { name: \"muted\", group: \"behaviour\", kind: \"boolean\", description: \"Starts with the sound off.\" },\n { name: \"loop\", group: \"behaviour\", kind: \"boolean\", description: \"Starts again at the end.\" }\n] as const satisfies readonly E.AttributeSpec[]\n\n/** The events every player sends, from its native element's. */\nexport const MediaEvents = [\n { name: \"ui-play\", detail: \"{ currentTime: number }\", description: \"It started playing (or went on).\" },\n { name: \"ui-pause\", detail: \"{ currentTime: number }\", description: \"It paused.\" },\n { name: \"ui-ended\", detail: \"{ currentTime: number }\", description: \"It played to the end.\" }\n] as const satisfies readonly E.EventSpec[]\n","/**\n * The English vocabulary of `<ui-video>`: every name the tag uses.\n * - Its tag, attributes (each with its kind and allowed values), events, slots, parts and states.\n * The shape is `E.ComponentVocabulary` (`spell/ui/vocabulary`).\n * - The browser's own video player (epic `ui-gaps` P11): a video FILE, where `<ui-embed>` plays another site's.\n * - Its name for a screen reader is the shared `label`.\n */\n\nimport type { E } from \"spell/ui/core\"\nimport { MediaAttributes, MediaEvents } from \"./UIVideo.types\"\n\n/****************\n * ### `videoVocabulary`\n * The names of `<ui-video>`: `<video part=\"video\">`, the browser's player.\n ****************/\nexport const videoVocabulary = {\n tag: \"ui-video\",\n topics: [\"media\", \"elements\"],\n aka: [\"video\", \"movie\", \"clip\", \"player\", \"video player\"],\n noun: \"video\",\n description: \"A video plays a video file in the browser's own player.\",\n attributes: [\n ...MediaAttributes,\n { name: \"poster\", group: \"content\", kind: \"string\", description: \"A picture shown before it plays.\" },\n {\n name: \"controls\",\n group: \"behaviour\",\n kind: \"boolean\",\n default: true,\n description: 'The browser\\'s play, pause and volume controls; `controls=\"false\"` hides them.'\n },\n {\n name: \"captions\",\n group: \"content\",\n kind: \"string\",\n description: \"A captions file (WebVTT, `.vtt`), in the page's language: the player offers them.\"\n },\n {\n name: \"ratio\",\n group: \"layout\",\n kind: \"string\",\n description: 'Its shape, width to height: `\"16/9\"`, `\"4/3\"`, `\"1\"`. By default, the video\\'s own.'\n }\n ],\n events: [...MediaEvents],\n slots: [],\n parts: [{ name: \"video\", description: \"The `<video>`.\" }],\n states: [],\n texts: [{ key: \"captions\", text: \"Captions\", description: \"The captions track's name in the player's menu.\" }]\n} as const satisfies E.ComponentVocabulary\n","import { E } from \"spell/ui/core\"\n\n/****************\n * ### `DOMMediaElement`\n * The DOM element of `<ui-video>` and `<ui-audio>`: a script API over the player inside, as the platform's\n * `<video>` / `<audio>` have.\n * - Above the components: their `elementSetup` reads this class while they're defined.\n ****************/\nexport class DOMMediaElement extends E.DOMElement<MediaPlayer> {\n /** Play it; the promise settles as the browser starts, or refuses (autoplay with sound, say). */\n play(): Promise<void> {\n return this.component?.play() ?? Promise.resolve()\n }\n\n /** Pause it. */\n pause() {\n this.component?.pause()\n }\n\n /** Where it is, in seconds; set it to jump there. */\n get currentTime(): number {\n return this.component?.media?.currentTime ?? 0\n }\n\n set currentTime(seconds: number) {\n const media = this.component?.media\n if (media) media.currentTime = seconds\n }\n\n /** Is it paused (or not started)? */\n get paused(): boolean {\n return this.component?.media?.paused ?? true\n }\n}\n\n/****************\n * ### `MediaPlayer`\n * The base of `<ui-video>` and `<ui-audio>`'s components: the browser's own player in the shadow root.\n *\n * - The native element is the component's `media`, set by its `ref`.\n * - Its `play`, `pause` and `ended` events become `ui-play`, `ui-pause` and `ui-ended`,\n * with where it was (`currentTime`).\n * - `play()` / `pause()` call through; the DOM element offers them (`DOMMediaElement`).\n * - Autoplay is the browser's to allow: only `muted`, or after the reader has clicked on the page. No workaround.\n ****************/\nexport abstract class MediaPlayer<V extends E.ComponentVocabulary = E.ComponentVocabulary> extends E.UIComponent<V> {\n @E.protoMerged static elementSetup: Partial<E.ElementSetup> = {\n DOMElement: DOMMediaElement,\n delegatesFocus: true\n }\n\n /** The `<video>` / `<audio>`, once drawn. */\n media: HTMLMediaElement | undefined\n\n /** Play it; a refusal (autoplay with sound) rejects, as the platform's does. */\n play(): Promise<void> {\n return this.media?.play() ?? Promise.resolve()\n }\n\n /** Pause it. */\n pause() {\n this.media?.pause()\n }\n\n /** Keep the native element, and send its `play` / `pause` / `ended` as `ui-*` events. */\n protected adopt(media: HTMLMediaElement) {\n this.media = media\n for (const [native, event] of PLAYER_EVENTS) {\n media.addEventListener(native, () => this.send(event as never, { currentTime: media.currentTime } as never))\n }\n }\n}\n\n/** The native player's events, and what each is sent as. */\nconst PLAYER_EVENTS = [\n [\"play\", \"ui-play\"],\n [\"pause\", \"ui-pause\"],\n [\"ended\", \"ui-ended\"]\n] as const\n","/*\n * The style sheet of `<ui-video>` and `<ui-audio>`: the browser's own players, as wide as their box allows.\n * - Shadow markup: `<video class=\"ui video\" part=\"video\">` (or `<audio class=\"ui audio\" part=\"audio\">`).\n * - A video is a block, never wider than its container; `ratio` is its own `aspect-ratio`, on the `<video>` itself.\n * - An audio without `controls` draws nothing (`:state(silent)`): a sound the page plays.\n */\n\n@layer ui.components.video.types {\n :host {\n display: block;\n max-inline-size: 100%;\n }\n /* an audio without `controls`: nothing shows */\n :host(:state(silent)) {\n display: none;\n }\n .ui.video {\n display: block;\n inline-size: 100%;\n block-size: auto;\n border-radius: var(--ui-video-radius, var(--ui-radius));\n background: black;\n }\n .ui.audio {\n display: block;\n inline-size: 100%;\n }\n}\n","import { Show } from \"solid-js\"\nimport { isServer, type JSX } from \"@solidjs/web\"\n\nimport { E } from \"spell/ui/core\"\nimport { videoVocabulary } from \"./UIVideo.en\"\n// Import directly to avoid circular import: the base class\nimport { MediaPlayer } from \"./MediaPlayer\"\n\nimport videoCSS from \"./UIVideo.css?inline\"\n\n/****************\n * ### `<ui-video>`\n * The component behind `<ui-video>`: a video file in the browser's own player (epic `ui-gaps` P11).\n *\n * - `<video class=\"ui video\" part=\"video\">`, with the browser's controls unless `controls=\"false\"`.\n * - `captions` is a WebVTT file, drawn as the video's `<track>` in the page's language.\n * - `ratio` is its shape (`16/9`); by default the video's own.\n * - Its name for a screen reader is the shared `label`.\n * - The script API, events and autoplay rule: `MediaPlayer`.\n ****************/\nexport class UIVideo extends MediaPlayer<typeof videoVocabulary> {\n @E.proto static vocabulary = videoVocabulary\n @E.protoMerged static elementSetup = { styleSheets: { video: videoCSS } } satisfies Partial<E.ElementSetup>\n\n /** `ratio` as CSS: `16/9`, `4 / 3`, `1`; `undefined` for the video's own. */\n get aspectRatio(): string | undefined {\n const ratio = this.ratio?.trim()\n return ratio && /^\\d+(\\.\\d+)?(\\s*\\/\\s*\\d+(\\.\\d+)?)?$/.test(ratio) ? ratio : undefined\n }\n\n /** The page's language, for the captions; none on a server. */\n get pageLanguage(): string | undefined {\n return isServer ? undefined : document.documentElement.lang || undefined\n }\n\n render(): JSX.Element {\n return (\n <video\n ref={(video: HTMLVideoElement) => this.adopt(video)}\n class={this.rootClass}\n part={this.partForName(\"video\")}\n src={this.src}\n poster={this.poster}\n controls={this.controls}\n autoplay={this.autoplay}\n muted={this.muted}\n loop={this.loop}\n playsinline\n aria-label={this.sharedLabel}\n style={this.aspectRatio ? { \"aspect-ratio\": this.aspectRatio } : undefined}\n >\n <Show when={this.captions}>\n <track\n kind=\"captions\"\n src={this.captions}\n srclang={this.pageLanguage}\n label={this.isReady ? this.translationForKey(\"captions\") : undefined}\n default\n />\n </Show>\n </video>\n )\n }\n}\n\n/** The vocabulary's attribute getters, typed (see \"Attributes\" in `UIComponent`). */\nexport interface UIVideo extends E.AttributeValues<typeof videoVocabulary> {}\n","/**\n * The English vocabulary of `<ui-audio>`: every name the tag uses.\n * - Its tag, attributes (each with its kind and allowed values), events, slots, parts and states.\n * The shape is `E.ComponentVocabulary` (`spell/ui/vocabulary`).\n * - The browser's own audio player (epic `ui-gaps` P11).\n * Without `controls` it draws nothing: a sound the page plays from script (a game's).\n */\n\nimport type { E } from \"spell/ui/core\"\nimport { MediaAttributes, MediaEvents } from \"./UIVideo.types\"\n\n/****************\n * ### `audioVocabulary`\n * The names of `<ui-audio>`: `<audio part=\"audio\">`, the browser's player.\n ****************/\nexport const audioVocabulary = {\n tag: \"ui-audio\",\n topics: [\"media\", \"elements\"],\n aka: [\"audio\", \"sound\", \"music\", \"sound effect\", \"audio player\"],\n noun: \"audio\",\n description: \"An audio plays a sound file: in the browser's own player, or unseen, when the page says.\",\n attributes: [\n ...MediaAttributes,\n {\n name: \"controls\",\n group: \"behaviour\",\n kind: \"boolean\",\n description: \"Shows the browser's player. Without it, nothing shows: the page plays it (`play()`).\"\n }\n ],\n events: [...MediaEvents],\n slots: [],\n parts: [{ name: \"audio\", description: \"The `<audio>`.\" }],\n states: [{ name: \"silent\", description: \"No `controls`: nothing shows.\" }],\n texts: []\n} as const satisfies E.ComponentVocabulary\n","import type { JSX } from \"@solidjs/web\"\n\nimport { E } from \"spell/ui/core\"\nimport { audioVocabulary } from \"./UIAudio.en\"\n// Import directly to avoid circular import: the base class\nimport { MediaPlayer } from \"./MediaPlayer\"\n\nimport videoCSS from \"./UIVideo.css?inline\"\n\n/****************\n * ### `<ui-audio>`\n * The component behind `<ui-audio>`: a sound file in the browser's own player (epic `ui-gaps` P11).\n *\n * - `<audio class=\"ui audio\" part=\"audio\">`.\n * - With `controls`, the browser's player shows; without, nothing does (`:state(silent)`):\n * a sound the page plays from script, a game's, `document.querySelector(\"ui-audio\").play()`.\n * - Its name for a screen reader is the shared `label`.\n * - The script API, events and autoplay rule: `MediaPlayer`.\n ****************/\nexport class UIAudio extends MediaPlayer<typeof audioVocabulary> {\n @E.proto static vocabulary = audioVocabulary\n @E.protoMerged static elementSetup = { styleSheets: { video: videoCSS } } satisfies Partial<E.ElementSetup>\n\n /** No `controls`: nothing shows. */\n @E.cssState(\"silent\")\n get isSilent(): boolean {\n return !this.controls\n }\n\n render(): JSX.Element {\n return (\n <audio\n ref={(audio: HTMLAudioElement) => this.adopt(audio)}\n class={this.rootClass}\n part={this.partForName(\"audio\")}\n src={this.src}\n controls={this.controls}\n autoplay={this.autoplay}\n muted={this.muted}\n loop={this.loop}\n aria-label={this.sharedLabel}\n />\n )\n }\n}\n\n/** The vocabulary's attribute getters, typed (see \"Attributes\" in `UIComponent`). */\nexport interface UIAudio extends E.AttributeValues<typeof audioVocabulary> {}\n","/**\n * The video family: defines `<ui-video>` and `<ui-audio>`, and exports their components, `UIVideo` and `UIAudio`,\n * and their DOM element class, `DOMMediaElement`.\n * - SIDE EFFECT: importing it defines the tags.\n * - Also the library's `spell/ui/ui-video` entry (its size is in `notes/report.md`).\n * - NOTE: `MediaPlayer` (the two's base) is internal.\n */\n\nimport { UIVideo } from \"./UIVideo\"\nimport { UIAudio } from \"./UIAudio\"\nimport { DOMMediaElement } from \"./MediaPlayer\"\n\nUIVideo.define()\nUIAudio.define()\n\nexport { UIVideo, UIAudio, DOMMediaElement }\n"],"mappings":";;;;;AAQA,IAAa0D,IAAkB;CAC7B;EAAE,MAAM;EAAO,OAAO;EAAQ,MAAM;EAAU,aAAa;CAA0C;CACrG;EACE,MAAM;EACN,OAAO;EACP,MAAM;EACN,aACE;CAEJ;CACA;EAAE,MAAM;EAAS,OAAO;EAAa,MAAM;EAAW,aAAa;CAA6B;CAChG;EAAE,MAAM;EAAQ,OAAO;EAAa,MAAM;EAAW,aAAa;CAA2B;AAC/F,GAGaC,IAAc;CACzB;EAAE,MAAM;EAAW,QAAQ;EAA2B,aAAa;CAAmC;CACtG;EAAE,MAAM;EAAY,QAAQ;EAA2B,aAAa;CAAa;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,EAAAyD,GAAA,IADEC,CAAA,GAEI/D,EAFJ+D,GAEW,gBAAe1D,EAAtByD,GAAA,IAFJC,GAE0B,EAAE,aAAa,EAAE,OAAOhE,EAAS,EAAE,CAAA,CAAA,GAAzDM,EAAAyD,GAAA,IAFJC,CAAA;AAAN,IAAMG,IAANH;ACPPR,EAAQ,OAAO,GACfW,EAAQ,OAAO"}
|
|
1
|
+
{"version":3,"file":"ui-video.js","names":["_elementSetup_dec","_a","_init","E.DOMElement","E.UIComponent","E.protoMerged","__name","this","ref={(video) => this.adopt(video)}","<Show when={this.captions}>\n <track\n kind=\"captions\"\n src={this.captions}\n srclang={this.pageLanguage}\n label={this.isReady ? this.translationForKey(\"captions\") : void 0}\n default\n />\n </Show>","srclang={this.pageLanguage}","label={this.isReady ? this.translationForKey(\"captions\") : void 0}","<track\n kind=\"captions\"\n src={this.captions}\n srclang={this.pageLanguage}\n label={this.isReady ? this.translationForKey(\"captions\") : void 0}\n default\n />","part={this.partForName(\"video\")}","src={this.src}","poster={this.poster}","controls={this.controls}","autoplay={this.autoplay}","muted={this.muted}","loop={this.loop}","aria-label={this.sharedLabel}","style={this.aspectRatio ? { \"aspect-ratio\": this.aspectRatio } : void 0}","<video\n ref={(video) => this.adopt(video)}\n class={this.rootClass}\n part={this.partForName(\"video\")}\n src={this.src}\n poster={this.poster}\n controls={this.controls}\n autoplay={this.autoplay}\n muted={this.muted}\n loop={this.loop}\n playsinline\n aria-label={this.sharedLabel}\n style={this.aspectRatio ? { \"aspect-ratio\": this.aspectRatio } : void 0}\n >\n <Show when={this.captions}>\n <track\n kind=\"captions\"\n src={this.captions}\n srclang={this.pageLanguage}\n label={this.isReady ? this.translationForKey(\"captions\") : void 0}\n default\n />\n </Show>\n </video>","_tmpl$","_elementSetup_dec","_vocabulary_dec","_a","_init","E.proto","E.protoMerged","_$createComponent","_$setAttribute","_$readShallow","__name","videoCSS","this","ref={(audio) => this.adopt(audio)}","part={this.partForName(\"audio\")}","src={this.src}","controls={this.controls}","autoplay={this.autoplay}","muted={this.muted}","loop={this.loop}","aria-label={this.sharedLabel}","<audio\n ref={(audio) => this.adopt(audio)}\n class={this.rootClass}\n part={this.partForName(\"audio\")}\n src={this.src}\n controls={this.controls}\n autoplay={this.autoplay}\n muted={this.muted}\n loop={this.loop}\n aria-label={this.sharedLabel}\n />","E.proto","E.protoMerged","E.cssState","_$readShallow","_$setAttribute","__name","videoCSS","__name$1","__publicField","__decorateElement","__decoratorMetadata","__runInitializers","__decoratorStart","MediaAttributes","MediaEvents","videoVocabulary","_elementSetup_dec$2","_a$2","_init$2","DOMElement","media","seconds","_MediaPlayer","UIComponent","protoMerged","native","event","PLAYER_EVENTS","MediaPlayer","UIVideo_default","_tmpl$$1","_tmpl$2","_elementSetup_dec$1","_vocabulary_dec$1","_a$1","_init$1","_UIVideo","proto","ratio","isServer","_self$","_el$","ref","video","insert","createComponent","Show","_el$2","effect","_p$","setAttribute","t","a","readShallow","className","o","i","n","h","r","style","d","UIVideo","audioVocabulary","_tmpl$","_isSilent_dec","_elementSetup_dec","_vocabulary_dec","_a","_init","_UIAudio","cssState","audio","UIAudio"],"sources":["../src/components/ui-video/UIVideo.types.ts","../src/components/ui-video/UIVideo.en.ts","../src/components/ui-video/MediaPlayer.tsx","../src/components/ui-video/UIVideo.css?inline","../src/components/ui-video/UIVideo.tsx","../src/components/ui-video/UIAudio.en.ts","../src/components/ui-video/UIAudio.tsx","../src/components/ui-video/index.ts"],"sourcesContent":["/**\n * What `<ui-video>` and `<ui-audio>` share: their attributes and events, as vocabulary pieces.\n * - Pure data: the vocabularies import it, and node reads them.\n */\n\nimport type { E } from \"spell/ui/core\"\n\n/** The attributes every player takes: what to play, and how. */\nexport const MediaAttributes = [\n { name: \"src\", group: \"link\", kind: \"string\", description: \"The file to play, relative to the page.\" },\n {\n name: \"autoplay\",\n group: \"behaviour\",\n kind: \"boolean\",\n description:\n \"Starts playing as soon as it can. A browser allows that only when `muted`, or after the reader has \" +\n \"clicked on the page.\"\n },\n { name: \"muted\", group: \"behaviour\", kind: \"boolean\", description: \"Starts with the sound off.\" },\n { name: \"loop\", group: \"behaviour\", kind: \"boolean\", description: \"Starts again at the end.\" }\n] as const satisfies readonly E.AttributeSpec[]\n\n/** The events every player sends, from its native element's. */\nexport const MediaEvents = [\n { name: \"ui-play\", detail: \"{ currentTime: number }\", description: \"It started playing (or went on).\" },\n { name: \"ui-pause\", detail: \"{ currentTime: number }\", description: \"It paused.\" },\n { name: \"ui-ended\", detail: \"{ currentTime: number }\", description: \"It played to the end.\" }\n] as const satisfies readonly E.EventSpec[]\n","/**\n * The English vocabulary of `<ui-video>`: every name the tag uses.\n * - Its tag, attributes (each with its kind and allowed values), events, slots, parts and states.\n * The shape is `E.ComponentVocabulary` (`spell/ui/vocabulary`).\n * - The browser's own video player (epic `ui-gaps` P11): a video FILE, where `<ui-embed>` plays another site's.\n * - Its name for a screen reader is the shared `label`.\n */\n\nimport type { E } from \"spell/ui/core\"\nimport { MediaAttributes, MediaEvents } from \"./UIVideo.types\"\n\n/****************\n * ### `videoVocabulary`\n * The names of `<ui-video>`: `<video part=\"video\">`, the browser's player.\n ****************/\nexport const videoVocabulary = {\n tag: \"ui-video\",\n icon: \"video\",\n topics: [\"media\", \"elements\"],\n aka: [\"video\", \"movie\", \"clip\", \"player\", \"video player\"],\n noun: \"video\",\n description: \"A video plays a video file in the browser's own player.\",\n attributes: [\n ...MediaAttributes,\n { name: \"poster\", group: \"content\", kind: \"string\", description: \"A picture shown before it plays.\" },\n {\n name: \"controls\",\n group: \"behaviour\",\n kind: \"boolean\",\n default: true,\n description: 'The browser\\'s play, pause and volume controls; `controls=\"false\"` hides them.'\n },\n {\n name: \"captions\",\n group: \"content\",\n kind: \"string\",\n description: \"A captions file (WebVTT, `.vtt`), in the page's language: the player offers them.\"\n },\n {\n name: \"ratio\",\n group: \"layout\",\n kind: \"string\",\n description: 'Its shape, width to height: `\"16/9\"`, `\"4/3\"`, `\"1\"`. By default, the video\\'s own.'\n }\n ],\n events: [...MediaEvents],\n slots: [],\n parts: [{ name: \"video\", description: \"The `<video>`.\" }],\n states: [],\n texts: [{ key: \"captions\", text: \"Captions\", description: \"The captions track's name in the player's menu.\" }]\n} as const satisfies E.ComponentVocabulary\n","import { E } from \"spell/ui/core\"\n\n/****************\n * ### `DOMMediaElement`\n * The DOM element of `<ui-video>` and `<ui-audio>`: a script API over the player inside, as the platform's\n * `<video>` / `<audio>` have.\n * - Above the components: their `elementSetup` reads this class while they're defined.\n ****************/\nexport class DOMMediaElement extends E.DOMElement<MediaPlayer> {\n /** Play it; the promise settles as the browser starts, or refuses (autoplay with sound, say). */\n play(): Promise<void> {\n return this.component?.play() ?? Promise.resolve()\n }\n\n /** Pause it. */\n pause() {\n this.component?.pause()\n }\n\n /** Where it is, in seconds; set it to jump there. */\n get currentTime(): number {\n return this.component?.media?.currentTime ?? 0\n }\n\n set currentTime(seconds: number) {\n const media = this.component?.media\n if (media) media.currentTime = seconds\n }\n\n /** Is it paused (or not started)? */\n get paused(): boolean {\n return this.component?.media?.paused ?? true\n }\n}\n\n/****************\n * ### `MediaPlayer`\n * The base of `<ui-video>` and `<ui-audio>`'s components: the browser's own player in the shadow root.\n *\n * - The native element is the component's `media`, set by its `ref`.\n * - Its `play`, `pause` and `ended` events become `ui-play`, `ui-pause` and `ui-ended`,\n * with where it was (`currentTime`).\n * - `play()` / `pause()` call through; the DOM element offers them (`DOMMediaElement`).\n * - Autoplay is the browser's to allow: only `muted`, or after the reader has clicked on the page. No workaround.\n ****************/\nexport abstract class MediaPlayer<V extends E.ComponentVocabulary = E.ComponentVocabulary> extends E.UIComponent<V> {\n @E.protoMerged static elementSetup: Partial<E.ElementSetup> = {\n DOMElement: DOMMediaElement,\n delegatesFocus: true\n }\n\n /** The `<video>` / `<audio>`, once drawn. */\n media: HTMLMediaElement | undefined\n\n /** Play it; a refusal (autoplay with sound) rejects, as the platform's does. */\n play(): Promise<void> {\n return this.media?.play() ?? Promise.resolve()\n }\n\n /** Pause it. */\n pause() {\n this.media?.pause()\n }\n\n /** Keep the native element, and send its `play` / `pause` / `ended` as `ui-*` events. */\n protected adopt(media: HTMLMediaElement) {\n this.media = media\n for (const [native, event] of PLAYER_EVENTS) {\n media.addEventListener(native, () => this.send(event as never, { currentTime: media.currentTime } as never))\n }\n }\n}\n\n/** The native player's events, and what each is sent as. */\nconst PLAYER_EVENTS = [\n [\"play\", \"ui-play\"],\n [\"pause\", \"ui-pause\"],\n [\"ended\", \"ui-ended\"]\n] as const\n","/*\n * The style sheet of `<ui-video>` and `<ui-audio>`: the browser's own players, as wide as their box allows.\n * - Shadow markup: `<video class=\"ui video\" part=\"video\">` (or `<audio class=\"ui audio\" part=\"audio\">`).\n * - A video is a block, never wider than its container; `ratio` is its own `aspect-ratio`, on the `<video>` itself.\n * - An audio without `controls` draws nothing (`:state(silent)`): a sound the page plays.\n */\n\n@layer ui.components.video.types {\n :host {\n display: block;\n max-inline-size: 100%;\n }\n /* an audio without `controls`: nothing shows */\n :host(:state(silent)) {\n display: none;\n }\n .ui.video {\n display: block;\n inline-size: 100%;\n block-size: auto;\n border-radius: var(--ui-video-radius, var(--ui-radius));\n background: black;\n }\n .ui.audio {\n display: block;\n inline-size: 100%;\n }\n}\n","import { Show } from \"solid-js\"\nimport { isServer, type JSX } from \"@solidjs/web\"\n\nimport { E } from \"spell/ui/core\"\nimport { videoVocabulary } from \"./UIVideo.en\"\n// Import directly to avoid circular import: the base class\nimport { MediaPlayer } from \"./MediaPlayer\"\n\nimport videoCSS from \"./UIVideo.css?inline\"\n\n/****************\n * ### `<ui-video>`\n * The component behind `<ui-video>`: a video file in the browser's own player (epic `ui-gaps` P11).\n *\n * - `<video class=\"ui video\" part=\"video\">`, with the browser's controls unless `controls=\"false\"`.\n * - `captions` is a WebVTT file, drawn as the video's `<track>` in the page's language.\n * - `ratio` is its shape (`16/9`); by default the video's own.\n * - Its name for a screen reader is the shared `label`.\n * - The script API, events and autoplay rule: `MediaPlayer`.\n ****************/\nexport class UIVideo extends MediaPlayer<typeof videoVocabulary> {\n @E.proto static vocabulary = videoVocabulary\n @E.protoMerged static elementSetup = { styleSheets: { video: videoCSS } } satisfies Partial<E.ElementSetup>\n\n /** `ratio` as CSS: `16/9`, `4 / 3`, `1`; `undefined` for the video's own. */\n get aspectRatio(): string | undefined {\n const ratio = this.ratio?.trim()\n return ratio && /^\\d+(\\.\\d+)?(\\s*\\/\\s*\\d+(\\.\\d+)?)?$/.test(ratio) ? ratio : undefined\n }\n\n /** The page's language, for the captions; none on a server. */\n get pageLanguage(): string | undefined {\n return isServer ? undefined : document.documentElement.lang || undefined\n }\n\n render(): JSX.Element {\n return (\n <video\n ref={(video: HTMLVideoElement) => this.adopt(video)}\n class={this.rootClass}\n part={this.partForName(\"video\")}\n src={this.src}\n poster={this.poster}\n controls={this.controls}\n autoplay={this.autoplay}\n muted={this.muted}\n loop={this.loop}\n playsinline\n aria-label={this.sharedLabel}\n style={this.aspectRatio ? { \"aspect-ratio\": this.aspectRatio } : undefined}\n >\n <Show when={this.captions}>\n <track\n kind=\"captions\"\n src={this.captions}\n srclang={this.pageLanguage}\n label={this.isReady ? this.translationForKey(\"captions\") : undefined}\n default\n />\n </Show>\n </video>\n )\n }\n}\n\n/** The vocabulary's attribute getters, typed (see \"Attributes\" in `UIComponent`). */\nexport interface UIVideo extends E.AttributeValues<typeof videoVocabulary> {}\n","/**\n * The English vocabulary of `<ui-audio>`: every name the tag uses.\n * - Its tag, attributes (each with its kind and allowed values), events, slots, parts and states.\n * The shape is `E.ComponentVocabulary` (`spell/ui/vocabulary`).\n * - The browser's own audio player (epic `ui-gaps` P11).\n * Without `controls` it draws nothing: a sound the page plays from script (a game's).\n */\n\nimport type { E } from \"spell/ui/core\"\nimport { MediaAttributes, MediaEvents } from \"./UIVideo.types\"\n\n/****************\n * ### `audioVocabulary`\n * The names of `<ui-audio>`: `<audio part=\"audio\">`, the browser's player.\n ****************/\nexport const audioVocabulary = {\n tag: \"ui-audio\",\n icon: \"volume up\",\n topics: [\"media\", \"elements\"],\n aka: [\"audio\", \"sound\", \"music\", \"sound effect\", \"audio player\"],\n noun: \"audio\",\n description: \"An audio plays a sound file: in the browser's own player, or unseen, when the page says.\",\n attributes: [\n ...MediaAttributes,\n {\n name: \"controls\",\n group: \"behaviour\",\n kind: \"boolean\",\n description: \"Shows the browser's player. Without it, nothing shows: the page plays it (`play()`).\"\n }\n ],\n events: [...MediaEvents],\n slots: [],\n parts: [{ name: \"audio\", description: \"The `<audio>`.\" }],\n states: [{ name: \"silent\", description: \"No `controls`: nothing shows.\" }],\n texts: []\n} as const satisfies E.ComponentVocabulary\n","import type { JSX } from \"@solidjs/web\"\n\nimport { E } from \"spell/ui/core\"\nimport { audioVocabulary } from \"./UIAudio.en\"\n// Import directly to avoid circular import: the base class\nimport { MediaPlayer } from \"./MediaPlayer\"\n\nimport videoCSS from \"./UIVideo.css?inline\"\n\n/****************\n * ### `<ui-audio>`\n * The component behind `<ui-audio>`: a sound file in the browser's own player (epic `ui-gaps` P11).\n *\n * - `<audio class=\"ui audio\" part=\"audio\">`.\n * - With `controls`, the browser's player shows; without, nothing does (`:state(silent)`):\n * a sound the page plays from script, a game's, `document.querySelector(\"ui-audio\").play()`.\n * - Its name for a screen reader is the shared `label`.\n * - The script API, events and autoplay rule: `MediaPlayer`.\n ****************/\nexport class UIAudio extends MediaPlayer<typeof audioVocabulary> {\n @E.proto static vocabulary = audioVocabulary\n @E.protoMerged static elementSetup = { styleSheets: { video: videoCSS } } satisfies Partial<E.ElementSetup>\n\n /** No `controls`: nothing shows. */\n @E.cssState(\"silent\")\n get isSilent(): boolean {\n return !this.controls\n }\n\n render(): JSX.Element {\n return (\n <audio\n ref={(audio: HTMLAudioElement) => this.adopt(audio)}\n class={this.rootClass}\n part={this.partForName(\"audio\")}\n src={this.src}\n controls={this.controls}\n autoplay={this.autoplay}\n muted={this.muted}\n loop={this.loop}\n aria-label={this.sharedLabel}\n />\n )\n }\n}\n\n/** The vocabulary's attribute getters, typed (see \"Attributes\" in `UIComponent`). */\nexport interface UIAudio extends E.AttributeValues<typeof audioVocabulary> {}\n","/**\n * The video family: defines `<ui-video>` and `<ui-audio>`, and exports their components, `UIVideo` and `UIAudio`,\n * and their DOM element class, `DOMMediaElement`.\n * - SIDE EFFECT: importing it defines the tags.\n * - Also the library's `spell/ui/ui-video` entry (its size is in `notes/report.md`).\n * - NOTE: `MediaPlayer` (the two's base) is internal.\n */\n\nimport { UIVideo } from \"./UIVideo\"\nimport { UIAudio } from \"./UIAudio\"\nimport { DOMMediaElement } from \"./MediaPlayer\"\n\nUIVideo.define()\nUIAudio.define()\n\nexport { UIVideo, UIAudio, DOMMediaElement }\n"],"mappings":";;;;;AAQA,IAAa0D,IAAkB;CAC7B;EAAE,MAAM;EAAO,OAAO;EAAQ,MAAM;EAAU,aAAa;CAA0C;CACrG;EACE,MAAM;EACN,OAAO;EACP,MAAM;EACN,aACE;CAEJ;CACA;EAAE,MAAM;EAAS,OAAO;EAAa,MAAM;EAAW,aAAa;CAA6B;CAChG;EAAE,MAAM;EAAQ,OAAO;EAAa,MAAM;EAAW,aAAa;CAA2B;AAC/F,GAGaC,IAAc;CACzB;EAAE,MAAM;EAAW,QAAQ;EAA2B,aAAa;CAAmC;CACtG;EAAE,MAAM;EAAY,QAAQ;EAA2B,aAAa;CAAa;CACjF;EAAE,MAAM;EAAY,QAAQ;EAA2B,aAAa;CAAwB;AAC9F,GCZaC,IAAkB;CAC7B,KAAK;CACL,MAAM;CACN,QAAQ,CAAC,SAAS,UAAU;CAC5B,KAAK;EAAC;EAAS;EAAS;EAAQ;EAAU;CAAc;CACxD,MAAM;CACN,aAAa;CACb,YAAY;EACV,GAAGF;EACH;GAAE,MAAM;GAAU,OAAO;GAAW,MAAM;GAAU,aAAa;EAAmC;EACpG;GACE,MAAM;GACN,OAAO;GACP,MAAM;GACN,SAAS;GACT,aAAa;EACf;EACA;GACE,MAAM;GACN,OAAO;GACP,MAAM;GACN,aAAa;EACf;EACA;GACE,M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as r, Rt as i, UI as a, UIComponent as o, Ut as s, Vt as c, a as l, cssState as u, onChange as d, proto as f, protoMerged as p, state as m, zt as h } from "./core.js";
|
|
3
3
|
import { className as g, effect as _, getOwner as v, isServer as y, readShallow as b, setAttribute as x, template as S } from "@solidjs/web";
|
|
4
4
|
//#region src/components/ui-visibility/UIVisibility.en.ts
|
|
5
5
|
var C = {
|
|
6
6
|
tag: "ui-visibility",
|
|
7
|
+
icon: "eye",
|
|
7
8
|
topics: [
|
|
8
9
|
"animation",
|
|
9
10
|
"media",
|
|
@@ -109,14 +110,14 @@ var C = {
|
|
|
109
110
|
description: "Some of it is on screen now (as of the last check)."
|
|
110
111
|
}],
|
|
111
112
|
texts: []
|
|
112
|
-
}, w = "@layer ui.components.visibility.types{:host,.ui.visibility{display:block}}@layer ui.components.visibility.content,ui.components.visibility.variations,ui.components.visibility.states;", T = /* @__PURE__ */ S("<div><slot>"), E, D, O, k, A, j, M, N = class _UIVisibility extends (A =
|
|
113
|
+
}, w = "@layer ui.components.visibility.types{:host,.ui.visibility{display:block}}@layer ui.components.visibility.content,ui.components.visibility.variations,ui.components.visibility.states;", T = /* @__PURE__ */ S("<div><slot>"), E, D, O, k, A, j, M, N = class _UIVisibility extends (A = o, k = [f], O = [p], D = [u("visible"), m], E = [d("isReady", "isConnected", "once", "continuous", "offset", "type", "animation", "duration")], A) {
|
|
113
114
|
constructor() {
|
|
114
|
-
super(...arguments),
|
|
115
|
+
super(...arguments), s(j, 5, this), c(this, M, s(j, 8, this, !1)), s(j, 11, this), t(this, "onImageLoad", /* @__PURE__ */ e((e) => {
|
|
115
116
|
this.send("ui-loaded", { image: e });
|
|
116
117
|
}, "onImageLoad"));
|
|
117
118
|
}
|
|
118
119
|
get extraClass() {
|
|
119
|
-
return this.type === "image" ?
|
|
120
|
+
return this.type === "image" ? r : void 0;
|
|
120
121
|
}
|
|
121
122
|
render() {
|
|
122
123
|
y && this.type === "image" && this.serverImages();
|
|
@@ -129,32 +130,32 @@ var C = {
|
|
|
129
130
|
g(t, e, r?.e), n !== r?.t && x(t, "part", n);
|
|
130
131
|
}), t;
|
|
131
132
|
}
|
|
132
|
-
onWatchSettingsChanged(e, t, n,
|
|
133
|
+
onWatchSettingsChanged(e, t, n, i, a, o, s, c) {
|
|
133
134
|
if (e && t) return this.watch({
|
|
134
135
|
once: n !== !1,
|
|
135
|
-
continuous: !!
|
|
136
|
+
continuous: !!i,
|
|
136
137
|
offset: a ?? 0,
|
|
137
|
-
images: o ===
|
|
138
|
+
images: o === r,
|
|
138
139
|
animation: this.animationToRun,
|
|
139
140
|
duration: c ?? F
|
|
140
141
|
});
|
|
141
142
|
}
|
|
142
|
-
watch(
|
|
143
|
-
let
|
|
144
|
-
once:
|
|
145
|
-
continuous:
|
|
146
|
-
offset:
|
|
147
|
-
onOnScreen:
|
|
148
|
-
onOffScreen:
|
|
149
|
-
onTopVisible:
|
|
150
|
-
onBottomVisible:
|
|
151
|
-
onTopPassed:
|
|
152
|
-
onBottomPassed:
|
|
153
|
-
onPassing:
|
|
154
|
-
onUpdate: /* @__PURE__ */
|
|
155
|
-
},
|
|
143
|
+
watch(t) {
|
|
144
|
+
let n = /* @__PURE__ */ e((e) => (t) => void this.send(e, t), "emit"), r = {
|
|
145
|
+
once: t.once,
|
|
146
|
+
continuous: t.continuous,
|
|
147
|
+
offset: t.offset,
|
|
148
|
+
onOnScreen: n("ui-in-view"),
|
|
149
|
+
onOffScreen: n("ui-out-of-view"),
|
|
150
|
+
onTopVisible: n("ui-top-in-view"),
|
|
151
|
+
onBottomVisible: n("ui-bottom-in-view"),
|
|
152
|
+
onTopPassed: n("ui-top-passed"),
|
|
153
|
+
onBottomPassed: n("ui-bottom-passed"),
|
|
154
|
+
onPassing: n("ui-passing"),
|
|
155
|
+
onUpdate: /* @__PURE__ */ e((e) => this.isOnScreen = e.onScreen, "onUpdate")
|
|
156
|
+
}, i = a.observeVisibility(this.domElement, r), o = t.images ? this.watchImages(t) : void 0;
|
|
156
157
|
return () => {
|
|
157
|
-
|
|
158
|
+
i(), o?.();
|
|
158
159
|
};
|
|
159
160
|
}
|
|
160
161
|
watchImages({ animation: e, duration: t, offset: n }) {
|
|
@@ -175,7 +176,7 @@ var C = {
|
|
|
175
176
|
};
|
|
176
177
|
}
|
|
177
178
|
lazyLoad(e, t) {
|
|
178
|
-
for (let n of this.domElement.querySelectorAll(R)) e.has(n) || e.set(n,
|
|
179
|
+
for (let n of this.domElement.querySelectorAll(R)) e.has(n) || e.set(n, a.visibility.lazyImage(n, {
|
|
179
180
|
...t,
|
|
180
181
|
onLoad: this.onImageLoad
|
|
181
182
|
}));
|
|
@@ -191,10 +192,10 @@ var C = {
|
|
|
191
192
|
return e === "none" || l.isAttention(e) ? !1 : l.runtimeNameFor(e);
|
|
192
193
|
}
|
|
193
194
|
};
|
|
194
|
-
j =
|
|
195
|
+
j = h(A), M = /* @__PURE__ */ new WeakMap(), n(j, 4, "isOnScreen", D, N, M), n(j, 1, "onWatchSettingsChanged", E, N), n(j, 13, "vocabulary", k, N), n(j, 13, "elementSetup", O, N), i(j, N), e(N, "UIVisibility"), t(N, "vocabulary", s(j, 12, N, C)), s(j, 15, N), t(N, "elementSetup", s(j, 16, N, {
|
|
195
196
|
styleSheets: { visibility: w },
|
|
196
197
|
delegatesFocus: !1
|
|
197
|
-
})),
|
|
198
|
+
})), s(j, 19, N);
|
|
198
199
|
var P = N, F = 1e3, I = "data-src", L = "data-srcset", R = "img[data-src]";
|
|
199
200
|
//#endregion
|
|
200
201
|
//#region src/components/ui-visibility/index.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-visibility.js","names":["this","part={this.partForName(\"visibility\")}","<div class={this.rootClass} part={this.partForName(\"visibility\")}>\n <slot />\n </div>","E.UIComponent","E.proto","E.protoMerged","E.cssState","E.state","E.onChange","UIT.IMAGE","_$getOwner","_$readShallow","_$setAttribute","__name","visibilityCSS","__publicField","__decorateElement","__decoratorMetadata","__decoratorStart","IMAGE","__name$1","__runInitializers","AnimationLookup","__privateAdd","visibilityVocabulary","UIVisibility_default","_tmpl$","_onWatchSettingsChanged_dec","_isOnScreen_dec","_elementSetup_dec","_vocabulary_dec","_a","_init","_isOnScreen","_UIVisibility","UIComponent","proto","protoMerged","cssState","state","onChange","isServer","_self$","_el$","_el$2","getOwner","effect","readShallow","className","_p$","t","setAttribute","isReady","isConnected","once","continuous","offset","type","duration","DEFAULT_DURATION","emit","name","calculations","options","config","stop","UI","stopImages","stops","animation","observer","DATA_SRC","image","LAZY_IMAGES","srcset","DATA_SRCSET","UIVisibility"],"sources":["../src/components/ui-visibility/UIVisibility.en.ts","../src/components/ui-visibility/UIVisibility.css?inline","../src/components/ui-visibility/UIVisibility.tsx","../src/components/ui-visibility/index.ts"],"sourcesContent":["/**\n * Every name `<ui-visibility>` uses: tag, attributes (kind + allowed values), events, slots, parts, states, texts.\n * Schema: `E.ComponentVocabulary` (`spell/ui/vocabulary`).\n * - No class attributes: visibility is a behaviour (Fomantic's has no stylesheet); the root is `ui visibility`.\n * - Events are Fomantic's callbacks as `ui-*` events, `detail` the calculations (`VisibilityCalculations`).\n */\n\nimport type { E } from \"spell/ui/core\"\n\n/****************\n * ### `<ui-visibility>`\n * A wrapper that reports where it is against the screen, and can lazy-load the images inside it:\n * `<div class=\"ui visibility\" part=\"visibility\">` around the slot.\n ****************/\nexport const visibilityVocabulary = {\n tag: \"ui-visibility\",\n topics: [\"animation\", \"media\", \"modules\"],\n aka: [\"scroll spy\", \"in view\", \"intersection\", \"lazy load\", \"on screen\"],\n noun: \"visibility\",\n description: \"Visibility provides a set of callbacks for when content appears in the viewport.\",\n attributes: [\n {\n name: \"once\",\n group: \"appearance\",\n kind: \"boolean\",\n default: true,\n description: 'Each event fires at most once (Fomantic\\'s default); `once=\"false\"`: each time it turns true.'\n },\n {\n name: \"continuous\",\n group: \"appearance\",\n kind: \"boolean\",\n description: \"Events fire at every check while their condition holds (each crossing, not every scrolled pixel).\"\n },\n {\n name: \"offset\",\n group: \"layout\",\n kind: \"number\",\n default: 0,\n description: \"Pixels below the viewport top that count as the screen top, e.g. under a fixed menu.\"\n },\n {\n name: \"type\",\n group: \"appearance\",\n kind: \"enum\",\n values: [\"image\"],\n description:\n \"`image`: every `<img data-src>` inside gets its source once on screen, then fades in (`ui-loaded`).\"\n },\n {\n name: \"duration\",\n group: \"behaviour\",\n kind: \"number\",\n default: 1000,\n description: '`type=\"image\"`: that animation\\'s ms.'\n }\n ],\n events: [\n { name: \"ui-in-view\", detail: \"VisibilityCalculations\", description: \"Some of it came on screen (`onOnScreen`).\" },\n {\n name: \"ui-out-of-view\",\n detail: \"VisibilityCalculations\",\n description: \"None of it is on screen (`onOffScreen`).\"\n },\n { name: \"ui-top-in-view\", detail: \"VisibilityCalculations\", description: \"Its top came on screen.\" },\n { name: \"ui-bottom-in-view\", detail: \"VisibilityCalculations\", description: \"Its bottom came on screen.\" },\n { name: \"ui-top-passed\", detail: \"VisibilityCalculations\", description: \"Its top passed the screen top.\" },\n { name: \"ui-bottom-passed\", detail: \"VisibilityCalculations\", description: \"Its bottom passed the screen top.\" },\n { name: \"ui-passing\", detail: \"VisibilityCalculations\", description: \"It spans the screen top.\" },\n {\n name: \"ui-loaded\",\n detail: \"{ image: HTMLImageElement }\",\n description: '`type=\"image\"`: an image got its source (and finished its transition).'\n }\n ],\n slots: [{ name: \"\", description: 'The content; its `<img data-src>`s with `type=\"image\"`.' }],\n parts: [{ name: \"visibility\", description: \"The box around the slot.\" }],\n states: [{ name: \"visible\", description: \"Some of it is on screen now (as of the last check).\" }],\n texts: []\n} as const satisfies E.ComponentVocabulary\n","/*\n * `<ui-visibility>`: Fomantic's visibility behaviour has no stylesheet; this is the DOM element's box.\n * - Shadow markup contract: `<div class=\"ui visibility\" part=\"visibility\">` around the default `<slot>`;\n * `ui visibility image` with `type=\"image\"` (a hook for page CSS, no look here).\n * - The DOM element is a BLOCK: it is the box `UI.observeVisibility()` measures\n * (a `display: contents` DOM element has none).\n * - Lazy images (`type=\"image\"`) are the page's own `<img data-src>`s:\n * give them a `width` / `height` (or an `aspect-ratio`), so they take their space before loading,\n * as with any lazy image.\n */\n\n@layer ui.components.visibility.types, ui.components.visibility.content, ui.components.visibility.variations, ui.components.visibility.states;\n\n@layer ui.components.visibility.types {\n :host {\n display: block;\n }\n .ui.visibility {\n display: block;\n }\n}\n","import { isServer, type JSX } from \"@solidjs/web\"\n\nimport { E, UI, UIT } from \"spell/ui/core\"\nimport { visibilityVocabulary } from \"./UIVisibility.en\"\n\nimport visibilityCSS from \"./UIVisibility.css?inline\"\n\n/****************\n * ### `UIVisibility`\n * The component behind `<ui-visibility>`: a block around content that reports where it is against the screen,\n * `<div class=\"ui visibility\" part=\"visibility\">` around the slot.\n *\n * - Fomantic's visibility callbacks become `ui-*` events (`ui-in-view`, `ui-out-of-view`, `ui-top-passed` …),\n * through `UI.observeVisibility()`: an `IntersectionObserver`, no scroll listener.\n *\n * - It watches while connected;\n * again whenever `once`, `continuous`, `offset` or the image settings change (which re-arms `once`).\n * - `:state(visible)`: on screen as of the last check.\n * - `type=\"image\"`: each `<img data-src>` inside (found now and as the content changes)\n * goes through `UI.visibility.lazyImage()`:\n * its source is set once it's on screen, then it fades in and `ui-loaded` fires.\n * - Measured against the viewport (Fomantic's default `context`).\n ****************/\nexport class UIVisibility extends E.UIComponent<VisibilityVocabulary> {\n @E.proto static vocabulary = visibilityVocabulary\n @E.protoMerged static elementSetup = {\n styleSheets: { visibility: visibilityCSS },\n // a wrapper: a click on its text must not jump to a link inside\n delegatesFocus: false\n } satisfies Partial<E.ElementSetup>\n\n /** On screen as of the last check. `:state(visible)`. */\n @E.cssState(\"visible\")\n @E.state\n accessor isOnScreen = false\n\n /** `image` before the noun for a lazy-image wrapper (`ui image visibility`), a hook for page CSS. */\n protected get extraClass(): string | undefined {\n return this.type === UIT.IMAGE ? UIT.IMAGE : undefined\n }\n\n render(): JSX.Element {\n if (isServer && this.type === UIT.IMAGE) this.serverImages()\n return (\n <div class={this.rootClass} part={this.partForName(\"visibility\")}>\n <slot />\n </div>\n )\n }\n\n /**\n * Watch while connected, once rendered (`isReady`, as when the render started it);\n * anew when the settings change.\n * - Returns the undo, run before the next watch.\n */\n @E.onChange(\"isReady\", \"isConnected\", \"once\", \"continuous\", \"offset\", \"type\", \"animation\", \"duration\")\n protected onWatchSettingsChanged(\n isReady: boolean,\n isConnected: boolean,\n once: UIVisibility[\"once\"],\n continuous: UIVisibility[\"continuous\"],\n offset: UIVisibility[\"offset\"],\n type: UIVisibility[\"type\"],\n // followed so a change re-watches; `animationToRun` below adds motion off around it\n _animation: unknown,\n duration: UIVisibility[\"duration\"]\n ): E.Disposer | undefined {\n if (!isReady || !isConnected) return undefined\n return this.watch({\n once: once !== false,\n continuous: !!continuous,\n offset: offset ?? 0,\n images: type === UIT.IMAGE,\n animation: this.animationToRun,\n duration: duration ?? DEFAULT_DURATION\n })\n }\n\n /** Observe the DOM element (and lazy images); returns the undo. */\n private watch(config: VisibilityConfig): E.Disposer {\n const emit = (name: Parameters<UIVisibility[\"send\"]>[0]) => (calculations: E.VisibilityCalculations) =>\n void this.send(name, calculations)\n const options: E.VisibilityOptions = {\n once: config.once,\n continuous: config.continuous,\n offset: config.offset,\n onOnScreen: emit(\"ui-in-view\"),\n onOffScreen: emit(\"ui-out-of-view\"),\n onTopVisible: emit(\"ui-top-in-view\"),\n onBottomVisible: emit(\"ui-bottom-in-view\"),\n onTopPassed: emit(\"ui-top-passed\"),\n onBottomPassed: emit(\"ui-bottom-passed\"),\n onPassing: emit(\"ui-passing\"),\n onUpdate: (calculations) => (this.isOnScreen = calculations.onScreen)\n }\n const stop = UI.observeVisibility(this.domElement, options)\n const stopImages = config.images ? this.watchImages(config) : undefined\n return () => {\n stop()\n stopImages?.()\n }\n }\n\n /** Lazy-load every `<img data-src>` inside, now and as content changes; returns the undo. */\n private watchImages({ animation, duration, offset }: VisibilityConfig): E.Disposer {\n const stops = new Map<HTMLImageElement, E.Disposer>()\n const options: E.LazyImageOptions = { transition: UIVisibility.animationFor(animation), duration, offset }\n this.lazyLoad(stops, options)\n // oxlint-disable-next-line spell-ui/no-mutation-observer -- only while `images` is on and the element connected\n const observer = new MutationObserver(() => this.lazyLoad(stops, options))\n observer.observe(this.domElement, { childList: true, subtree: true, attributeFilter: [DATA_SRC] })\n return () => {\n observer.disconnect()\n for (const stop of stops.values()) stop()\n }\n }\n\n /**\n * Hand every `<img data-src>` inside that isn't in `stops` yet to `UI.visibility.lazyImage()`.\n * - SIDE EFFECT: records each one's undo in `stops`.\n */\n private lazyLoad(stops: Map<HTMLImageElement, E.Disposer>, options: E.LazyImageOptions) {\n for (const image of this.domElement.querySelectorAll<HTMLImageElement>(LAZY_IMAGES)) {\n if (stops.has(image)) continue\n stops.set(image, UI.visibility.lazyImage(image, { ...options, onLoad: this.onImageLoad }))\n }\n }\n\n /** A lazy image has its `src`. */\n private readonly onImageLoad = (image: HTMLImageElement) => {\n this.send(\"ui-loaded\", { image })\n }\n\n /**\n * Static server render (`spell/ui/static`): nothing will observe, so each `<img data-src>` gets its source now,\n * with `loading=\"lazy\"` (unless it says otherwise).\n * - Crawlers and no-JS readers see the image; the browser defers it.\n * - SIDE EFFECT: writes the DOM element's light-DOM images, which the flattener then moves into the root.\n */\n private serverImages() {\n for (const image of this.domElement.querySelectorAll(LAZY_IMAGES)) {\n image.setAttribute(\"src\", image.getAttribute(DATA_SRC)!)\n const srcset = image.getAttribute(DATA_SRCSET)\n if (srcset) image.setAttribute(\"srcset\", srcset)\n if (!image.hasAttribute(\"loading\")) image.setAttribute(\"loading\", \"lazy\")\n }\n }\n\n /**\n * The shared `animation` (Fomantic's name) as a `UI.transitions` name; `false` for `none` or an attention one.\n * - STATIC: pure.\n */\n private static animationFor(animation: UIT.Animation): E.AnimationName | false {\n if (animation === UIT.NO_ANIMATION || UIT.AnimationLookup.isAttention(animation)) return false\n return UIT.AnimationLookup.runtimeNameFor(animation)\n }\n}\n\n/** The vocabulary's attribute getters, typed (see \"Attributes\" in `UIComponent`). */\nexport interface UIVisibility extends E.AttributeValues<VisibilityVocabulary> {}\n\n/** What a watch depends on. */\ntype VisibilityConfig = {\n /** each event fires at most once (re-armed by a change here) */\n once: boolean\n /** events fire at every check while their condition holds */\n continuous: boolean\n /** px below the viewport top that count as the screen top */\n offset: number\n /** `type=\"image\"`: lazy-load the images inside */\n images: boolean\n /** a lazy image's animation: the element's `animationToRun` (`none` when motion is off) */\n animation: UIT.Animation\n /** its ms */\n duration: number\n}\n\n/** Its default ms (Fomantic's 1000). */\nconst DEFAULT_DURATION = 1000\n\n/** The vocabulary type, for brevity. */\ntype VisibilityVocabulary = typeof visibilityVocabulary\n\n/** A lazy image's source, until it's on screen (Fomantic's `metadata.src`). */\nconst DATA_SRC = \"data-src\"\n\n/** A lazy image's `srcset`, until it's on screen. */\nconst DATA_SRCSET = \"data-srcset\"\n\n/** The lazy images inside `type=\"image\"`. */\nconst LAZY_IMAGES = \"img[data-src]\"\n","/**\n * The visibility family: defines `<ui-visibility>` and exports its component, `UIVisibility`.\n * - SIDE EFFECT: importing it defines the tag.\n * - NOTE: the behaviour itself is the runtime's (`UI.observeVisibility()`, `UI.visibility.lazyImage()`),\n * usable without this element.\n * - Also the library's `spell/ui/ui-visibility` entry (its size is in `notes/report.md`).\n */\n\nimport { UIVisibility } from \"./UIVisibility\"\n\nUIVisibility.define()\n\nexport { UIVisibility }\n"],"mappings":";;;;AAcA,IAAawB,IAAuB;CAClC,KAAK;CACL,QAAQ;EAAC;EAAa;EAAS;CAAS;CACxC,KAAK;EAAC;EAAc;EAAW;EAAgB;EAAa;CAAW;CACvE,MAAM;CACN,aAAa;CACb,YAAY;EACV;GACE,MAAM;GACN,OAAO;GACP,MAAM;GACN,SAAS;GACT,aAAa;EACf;EACA;GACE,MAAM;GACN,OAAO;GACP,MAAM;GACN,aAAa;EACf;EACA;GACE,MAAM;GACN,OAAO;GACP,MAAM;GACN,SAAS;GACT,aAAa;EACf;EACA;GACE,MAAM;GACN,OAAO;GACP,M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WI,oBAAA,IAAA,QAAA,GAATf,EAAAgB,GAAA,GAAS,cAFTJ,GATWM,GAWFD,CAAA,GAsBTjB,EAAAgB,GAAA,GAAU,0BADVL,GAhCWO,CAAA,GACFlB,EAAAgB,GAAA,IAAO,cAAhBF,GADWI,CAAA,GAEIlB,EAAAgB,GAAA,IAAO,gBAAtBH,GAFWK,CAAA,GAANjB,EAAAe,GAAME,CAAA,GAAyDrB,EAAAqB,GAAA,cAAA,GAC3DnB,EADEmB,GACK,cAAab,EAApBW,GAAA,IADEE,GACkBV,CAAA,CAAA,GAApBH,EAAAW,GAAA,IADEE,CAAA,GAEInB,EAFJmB,GAEW,gBAAeb,EAAtBW,GAAA,IAFJE,GAE0B;CACnC,aAAa,EAAE,YAAYpB,EAAc;CAEzC,gBAAgB;AAClB,CAAA,CAAA,GAJeO,EAAAW,GAAA,IAFJE,CAAA;AAAN,IAAM0C,IAAN1C,GA2JDyB,IAAmB,KAMnBY,IAAW,YAGXI,IAAc,eAGdF,IAAc;;;ACpLpBG,EAAa,OAAO"}
|
|
1
|
+
{"version":3,"file":"ui-visibility.js","names":["this","part={this.partForName(\"visibility\")}","<div class={this.rootClass} part={this.partForName(\"visibility\")}>\n <slot />\n </div>","E.UIComponent","E.proto","E.protoMerged","E.cssState","E.state","E.onChange","UIT.IMAGE","_$getOwner","_$readShallow","_$setAttribute","__name","visibilityCSS","__name$1","__publicField","__decorateElement","IMAGE","__decoratorMetadata","__runInitializers","__privateAdd","AnimationLookup","__decoratorStart","visibilityVocabulary","UIVisibility_default","_tmpl$","_onWatchSettingsChanged_dec","_isOnScreen_dec","_elementSetup_dec","_vocabulary_dec","_a","_init","_isOnScreen","_UIVisibility","UIComponent","proto","protoMerged","cssState","state","onChange","isServer","_self$","_el$","_el$2","getOwner","effect","readShallow","className","_p$","t","setAttribute","isReady","isConnected","once","continuous","offset","type","duration","DEFAULT_DURATION","emit","name","calculations","options","config","stop","UI","stopImages","stops","animation","observer","DATA_SRC","image","LAZY_IMAGES","srcset","DATA_SRCSET","UIVisibility"],"sources":["../src/components/ui-visibility/UIVisibility.en.ts","../src/components/ui-visibility/UIVisibility.css?inline","../src/components/ui-visibility/UIVisibility.tsx","../src/components/ui-visibility/index.ts"],"sourcesContent":["/**\n * Every name `<ui-visibility>` uses: tag, attributes (kind + allowed values), events, slots, parts, states, texts.\n * Schema: `E.ComponentVocabulary` (`spell/ui/vocabulary`).\n * - No class attributes: visibility is a behaviour (Fomantic's has no stylesheet); the root is `ui visibility`.\n * - Events are Fomantic's callbacks as `ui-*` events, `detail` the calculations (`VisibilityCalculations`).\n */\n\nimport type { E } from \"spell/ui/core\"\n\n/****************\n * ### `<ui-visibility>`\n * A wrapper that reports where it is against the screen, and can lazy-load the images inside it:\n * `<div class=\"ui visibility\" part=\"visibility\">` around the slot.\n ****************/\nexport const visibilityVocabulary = {\n tag: \"ui-visibility\",\n icon: \"eye\",\n topics: [\"animation\", \"media\", \"modules\"],\n aka: [\"scroll spy\", \"in view\", \"intersection\", \"lazy load\", \"on screen\"],\n noun: \"visibility\",\n description: \"Visibility provides a set of callbacks for when content appears in the viewport.\",\n attributes: [\n {\n name: \"once\",\n group: \"appearance\",\n kind: \"boolean\",\n default: true,\n description: 'Each event fires at most once (Fomantic\\'s default); `once=\"false\"`: each time it turns true.'\n },\n {\n name: \"continuous\",\n group: \"appearance\",\n kind: \"boolean\",\n description: \"Events fire at every check while their condition holds (each crossing, not every scrolled pixel).\"\n },\n {\n name: \"offset\",\n group: \"layout\",\n kind: \"number\",\n default: 0,\n description: \"Pixels below the viewport top that count as the screen top, e.g. under a fixed menu.\"\n },\n {\n name: \"type\",\n group: \"appearance\",\n kind: \"enum\",\n values: [\"image\"],\n description:\n \"`image`: every `<img data-src>` inside gets its source once on screen, then fades in (`ui-loaded`).\"\n },\n {\n name: \"duration\",\n group: \"behaviour\",\n kind: \"number\",\n default: 1000,\n description: '`type=\"image\"`: that animation\\'s ms.'\n }\n ],\n events: [\n { name: \"ui-in-view\", detail: \"VisibilityCalculations\", description: \"Some of it came on screen (`onOnScreen`).\" },\n {\n name: \"ui-out-of-view\",\n detail: \"VisibilityCalculations\",\n description: \"None of it is on screen (`onOffScreen`).\"\n },\n { name: \"ui-top-in-view\", detail: \"VisibilityCalculations\", description: \"Its top came on screen.\" },\n { name: \"ui-bottom-in-view\", detail: \"VisibilityCalculations\", description: \"Its bottom came on screen.\" },\n { name: \"ui-top-passed\", detail: \"VisibilityCalculations\", description: \"Its top passed the screen top.\" },\n { name: \"ui-bottom-passed\", detail: \"VisibilityCalculations\", description: \"Its bottom passed the screen top.\" },\n { name: \"ui-passing\", detail: \"VisibilityCalculations\", description: \"It spans the screen top.\" },\n {\n name: \"ui-loaded\",\n detail: \"{ image: HTMLImageElement }\",\n description: '`type=\"image\"`: an image got its source (and finished its transition).'\n }\n ],\n slots: [{ name: \"\", description: 'The content; its `<img data-src>`s with `type=\"image\"`.' }],\n parts: [{ name: \"visibility\", description: \"The box around the slot.\" }],\n states: [{ name: \"visible\", description: \"Some of it is on screen now (as of the last check).\" }],\n texts: []\n} as const satisfies E.ComponentVocabulary\n","/*\n * `<ui-visibility>`: Fomantic's visibility behaviour has no stylesheet; this is the DOM element's box.\n * - Shadow markup contract: `<div class=\"ui visibility\" part=\"visibility\">` around the default `<slot>`;\n * `ui visibility image` with `type=\"image\"` (a hook for page CSS, no look here).\n * - The DOM element is a BLOCK: it is the box `UI.observeVisibility()` measures\n * (a `display: contents` DOM element has none).\n * - Lazy images (`type=\"image\"`) are the page's own `<img data-src>`s:\n * give them a `width` / `height` (or an `aspect-ratio`), so they take their space before loading,\n * as with any lazy image.\n */\n\n@layer ui.components.visibility.types, ui.components.visibility.content, ui.components.visibility.variations, ui.components.visibility.states;\n\n@layer ui.components.visibility.types {\n :host {\n display: block;\n }\n .ui.visibility {\n display: block;\n }\n}\n","import { isServer, type JSX } from \"@solidjs/web\"\n\nimport { E, UI, UIT } from \"spell/ui/core\"\nimport { visibilityVocabulary } from \"./UIVisibility.en\"\n\nimport visibilityCSS from \"./UIVisibility.css?inline\"\n\n/****************\n * ### `UIVisibility`\n * The component behind `<ui-visibility>`: a block around content that reports where it is against the screen,\n * `<div class=\"ui visibility\" part=\"visibility\">` around the slot.\n *\n * - Fomantic's visibility callbacks become `ui-*` events (`ui-in-view`, `ui-out-of-view`, `ui-top-passed` …),\n * through `UI.observeVisibility()`: an `IntersectionObserver`, no scroll listener.\n *\n * - It watches while connected;\n * again whenever `once`, `continuous`, `offset` or the image settings change (which re-arms `once`).\n * - `:state(visible)`: on screen as of the last check.\n * - `type=\"image\"`: each `<img data-src>` inside (found now and as the content changes)\n * goes through `UI.visibility.lazyImage()`:\n * its source is set once it's on screen, then it fades in and `ui-loaded` fires.\n * - Measured against the viewport (Fomantic's default `context`).\n ****************/\nexport class UIVisibility extends E.UIComponent<VisibilityVocabulary> {\n @E.proto static vocabulary = visibilityVocabulary\n @E.protoMerged static elementSetup = {\n styleSheets: { visibility: visibilityCSS },\n // a wrapper: a click on its text must not jump to a link inside\n delegatesFocus: false\n } satisfies Partial<E.ElementSetup>\n\n /** On screen as of the last check. `:state(visible)`. */\n @E.cssState(\"visible\")\n @E.state\n accessor isOnScreen = false\n\n /** `image` before the noun for a lazy-image wrapper (`ui image visibility`), a hook for page CSS. */\n protected get extraClass(): string | undefined {\n return this.type === UIT.IMAGE ? UIT.IMAGE : undefined\n }\n\n render(): JSX.Element {\n if (isServer && this.type === UIT.IMAGE) this.serverImages()\n return (\n <div class={this.rootClass} part={this.partForName(\"visibility\")}>\n <slot />\n </div>\n )\n }\n\n /**\n * Watch while connected, once rendered (`isReady`, as when the render started it);\n * anew when the settings change.\n * - Returns the undo, run before the next watch.\n */\n @E.onChange(\"isReady\", \"isConnected\", \"once\", \"continuous\", \"offset\", \"type\", \"animation\", \"duration\")\n protected onWatchSettingsChanged(\n isReady: boolean,\n isConnected: boolean,\n once: UIVisibility[\"once\"],\n continuous: UIVisibility[\"continuous\"],\n offset: UIVisibility[\"offset\"],\n type: UIVisibility[\"type\"],\n // followed so a change re-watches; `animationToRun` below adds motion off around it\n _animation: unknown,\n duration: UIVisibility[\"duration\"]\n ): E.Disposer | undefined {\n if (!isReady || !isConnected) return undefined\n return this.watch({\n once: once !== false,\n continuous: !!continuous,\n offset: offset ?? 0,\n images: type === UIT.IMAGE,\n animation: this.animationToRun,\n duration: duration ?? DEFAULT_DURATION\n })\n }\n\n /** Observe the DOM element (and lazy images); returns the undo. */\n private watch(config: VisibilityConfig): E.Disposer {\n const emit = (name: Parameters<UIVisibility[\"send\"]>[0]) => (calculations: E.VisibilityCalculations) =>\n void this.send(name, calculations)\n const options: E.VisibilityOptions = {\n once: config.once,\n continuous: config.continuous,\n offset: config.offset,\n onOnScreen: emit(\"ui-in-view\"),\n onOffScreen: emit(\"ui-out-of-view\"),\n onTopVisible: emit(\"ui-top-in-view\"),\n onBottomVisible: emit(\"ui-bottom-in-view\"),\n onTopPassed: emit(\"ui-top-passed\"),\n onBottomPassed: emit(\"ui-bottom-passed\"),\n onPassing: emit(\"ui-passing\"),\n onUpdate: (calculations) => (this.isOnScreen = calculations.onScreen)\n }\n const stop = UI.observeVisibility(this.domElement, options)\n const stopImages = config.images ? this.watchImages(config) : undefined\n return () => {\n stop()\n stopImages?.()\n }\n }\n\n /** Lazy-load every `<img data-src>` inside, now and as content changes; returns the undo. */\n private watchImages({ animation, duration, offset }: VisibilityConfig): E.Disposer {\n const stops = new Map<HTMLImageElement, E.Disposer>()\n const options: E.LazyImageOptions = { transition: UIVisibility.animationFor(animation), duration, offset }\n this.lazyLoad(stops, options)\n // oxlint-disable-next-line spell-ui/no-mutation-observer -- only while `images` is on and the element connected\n const observer = new MutationObserver(() => this.lazyLoad(stops, options))\n observer.observe(this.domElement, { childList: true, subtree: true, attributeFilter: [DATA_SRC] })\n return () => {\n observer.disconnect()\n for (const stop of stops.values()) stop()\n }\n }\n\n /**\n * Hand every `<img data-src>` inside that isn't in `stops` yet to `UI.visibility.lazyImage()`.\n * - SIDE EFFECT: records each one's undo in `stops`.\n */\n private lazyLoad(stops: Map<HTMLImageElement, E.Disposer>, options: E.LazyImageOptions) {\n for (const image of this.domElement.querySelectorAll<HTMLImageElement>(LAZY_IMAGES)) {\n if (stops.has(image)) continue\n stops.set(image, UI.visibility.lazyImage(image, { ...options, onLoad: this.onImageLoad }))\n }\n }\n\n /** A lazy image has its `src`. */\n private readonly onImageLoad = (image: HTMLImageElement) => {\n this.send(\"ui-loaded\", { image })\n }\n\n /**\n * Static server render (`spell/ui/static`): nothing will observe, so each `<img data-src>` gets its source now,\n * with `loading=\"lazy\"` (unless it says otherwise).\n * - Crawlers and no-JS readers see the image; the browser defers it.\n * - SIDE EFFECT: writes the DOM element's light-DOM images, which the flattener then moves into the root.\n */\n private serverImages() {\n for (const image of this.domElement.querySelectorAll(LAZY_IMAGES)) {\n image.setAttribute(\"src\", image.getAttribute(DATA_SRC)!)\n const srcset = image.getAttribute(DATA_SRCSET)\n if (srcset) image.setAttribute(\"srcset\", srcset)\n if (!image.hasAttribute(\"loading\")) image.setAttribute(\"loading\", \"lazy\")\n }\n }\n\n /**\n * The shared `animation` (Fomantic's name) as a `UI.transitions` name; `false` for `none` or an attention one.\n * - STATIC: pure.\n */\n private static animationFor(animation: UIT.Animation): E.AnimationName | false {\n if (animation === UIT.NO_ANIMATION || UIT.AnimationLookup.isAttention(animation)) return false\n return UIT.AnimationLookup.runtimeNameFor(animation)\n }\n}\n\n/** The vocabulary's attribute getters, typed (see \"Attributes\" in `UIComponent`). */\nexport interface UIVisibility extends E.AttributeValues<VisibilityVocabulary> {}\n\n/** What a watch depends on. */\ntype VisibilityConfig = {\n /** each event fires at most once (re-armed by a change here) */\n once: boolean\n /** events fire at every check while their condition holds */\n continuous: boolean\n /** px below the viewport top that count as the screen top */\n offset: number\n /** `type=\"image\"`: lazy-load the images inside */\n images: boolean\n /** a lazy image's animation: the element's `animationToRun` (`none` when motion is off) */\n animation: UIT.Animation\n /** its ms */\n duration: number\n}\n\n/** Its default ms (Fomantic's 1000). */\nconst DEFAULT_DURATION = 1000\n\n/** The vocabulary type, for brevity. */\ntype VisibilityVocabulary = typeof visibilityVocabulary\n\n/** A lazy image's source, until it's on screen (Fomantic's `metadata.src`). */\nconst DATA_SRC = \"data-src\"\n\n/** A lazy image's `srcset`, until it's on screen. */\nconst DATA_SRCSET = \"data-srcset\"\n\n/** The lazy images inside `type=\"image\"`. */\nconst LAZY_IMAGES = \"img[data-src]\"\n","/**\n * The visibility family: defines `<ui-visibility>` and exports its component, `UIVisibility`.\n * - SIDE EFFECT: importing it defines the tag.\n * - NOTE: the behaviour itself is the runtime's (`UI.observeVisibility()`, `UI.visibility.lazyImage()`),\n * usable without this element.\n * - Also the library's `spell/ui/ui-visibility` entry (its size is in `notes/report.md`).\n */\n\nimport { UIVisibility } from \"./UIVisibility\"\n\nUIVisibility.define()\n\nexport { UIVisibility }\n"],"mappings":";;;;AAcA,IAAawB,IAAuB;CAClC,KAAK;CACL,MAAM;CACN,QAAQ;EAAC;EAAa;EAAS;CAAS;CACxC,KAAK;EAAC;EAAc;EAAW;EAAgB;EAAa;CAAW;CACvE,MAAM;CACN,aAAa;CACb,YAAY;EACV;GACE,MAAM;GACN,OAAO;GACP,MAAM;GACN,SAAS;GACT,aAAa;EACf;EACA;GACE,MAAM;GACN,OAAO;GACP,MAAM;GACN,aAAa;EACf;EACA;GACE,MAAM;GACN,OAAO;GACP,MAAM;GACN,SAAS;GACT,aAAa;EACf;EACA;GACE,MAAM;GACN,OAAO;GACP,MAAM;GACN,QAAQ,CAAC,OAAO;GAChB,aACE;EACJ;EACA;GACE,MAAM;GACN,OAAO;GACP,MAAM;GACN,SAAS;GACT,aAAa;EACf;CACF;CACA,QAAQ;EACN;GAAE,MAAM;GAAc,QAAQ;GAA0B,aAAa;EAA4C;EACjH;GACE,MAAM;GACN,QAAQ;GACR,aAAa;EACf;EACA;GAAE,MAAM;GAAkB,QAAQ;GAA0B,aAAa;EAA0B;EACnG;GAAE,MAAM;GAAqB,QAAQ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