spell-ui 0.8.6 → 0.8.7
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
package/dist/ui-markdown.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-markdown.js","names":["_init","E.once","__name","UIT.SourceAttributes","UIT.SourceEvents","UIT.SourceParts","UIT.SourceStates","UIT.SourceTexts","_headings_dec","_init","<Show when={this.editable}>\n {this.tabs()}\n {this.editor()}\n </Show>","this","this.tabs()","this.editor()","ref={(body) => {\n this.body = body;\n }}","role={this.editable ? TAB_ROLES.panel : void 0}","aria-labelledby={this.editable ? _UIMarkdown.tabId(PREVIEW) : void 0}","hidden={this.editable && this.shownTab !== PREVIEW ? true : void 0}","class={this.rootClass}","part={this.partForName(\"body\")}","<For each={MarkdownTabs}>\n {(tab) => <button\n type=\"button\"\n id={_UIMarkdown.tabId(tab)}\n role={TAB_ROLES.tab}\n part={this.partForName(\"tab\")}\n aria-selected={this.shownTab === tab ? \"true\" : \"false\"}\n aria-controls={_UIMarkdown.panelId(tab)}\n tabindex={this.shownTab === tab ? 0 : -1}\n onClick={() => this.shownTab = tab}\n ref={(button) => {\n this.tabButtons.set(tab, button);\n }}\n >\n {this.translationForKey(tab)}\n </button>}\n </For>","each={MarkdownTabs}","ref={(button) => {\n this.tabButtons.set(tab, button);\n }}","role={TAB_ROLES.tab}","part={this.partForName(\"tab\")}","aria-selected={this.shownTab === tab ? \"true\" : \"false\"}","aria-controls={_UIMarkdown.panelId(tab)}","tabindex={this.shownTab === tab ? 0 : -1}","role={TAB_ROLES.list}","<nav part={this.partForName(\"tabs\")} role={TAB_ROLES.list} onKeyDown={this.onTabKeyDown}>\n <For each={MarkdownTabs}>\n {(tab) => <button\n type=\"button\"\n id={_UIMarkdown.tabId(tab)}\n role={TAB_ROLES.tab}\n part={this.partForName(\"tab\")}\n aria-selected={this.shownTab === tab ? \"true\" : \"false\"}\n aria-controls={_UIMarkdown.panelId(tab)}\n tabindex={this.shownTab === tab ? 0 : -1}\n onClick={() => this.shownTab = tab}\n ref={(button) => {\n this.tabButtons.set(tab, button);\n }}\n >\n {this.translationForKey(tab)}\n </button>}\n </For>\n </nav>","ref={this.keepTextBox}","role={TAB_ROLES.panel}","aria-labelledby={_UIMarkdown.tabId(WRITE)}","hidden={this.shownTab !== WRITE ? true : void 0}","part={this.partForName(\"editor\")}","aria-label={this.translationForKey(\"editor\")}","<section\n id={_UIMarkdown.panelId(WRITE)}\n role={TAB_ROLES.panel}\n aria-labelledby={_UIMarkdown.tabId(WRITE)}\n hidden={this.shownTab !== WRITE ? true : void 0}\n >\n <textarea\n part={this.partForName(\"editor\")}\n aria-label={this.translationForKey(\"editor\")}\n onInput={this.onInput}\n ref={this.keepTextBox}\n />\n </section>","E.DOMLoadableElement","E.untracked","__name","E.LoadableComponent","E.proto","E.protoMerged","E.onChange","E.state","E.whileConnected","_$createComponent","_$memo","_$readShallow","_$setAttribute","_$ref","markdownCSS","_$delegateEvents","__publicField","__decorateElement","__decoratorMetadata","__decoratorStart","__name$1","__runInitializers","SourceAttributes","SourceParts","SourceTexts","SourceStates","SourceEvents","__privateAdd","_loadSanitizer_dec","_load_dec","once","_init$1","_MarkdownRenderer","module","MarkdownRenderer","markdownVocabulary","UIMarkdown_default","_tmpl$","_tmpl$2","_tmpl$3","_tmpl$4","_headings_dec","_a","_init","_followHash_dec","_headings_dec2","_onTextChanged_dec","_keepTextBox_dec","_shownTab_dec","_onMarkdownChanged_dec","_elementSetup_dec","_vocabulary_dec","_b","_init2","_shownTab","_headings","_DOMMarkdownElement","DOMLoadableElement","untracked","id","DOMMarkdownElement","_UIMarkdown","LoadableComponent","proto","protoMerged","onChange","state","whileConnected","WRITE","textBox","event","MarkdownTabs","tab","index","link","IN_PAGE_LINK","isShown","PREVIEW","LEADING_TITLE","_self$","createComponent","Show","memo","_el$","_el$2","addEvent","ref","body","effect","TAB_ROLES","readShallow","_p$","setAttribute","t","a","o","className","i","n","_self$2","_el$3","insert","For","_el$4","button","_self$3","_el$5","_el$6","_ref$","text","listeners","target","ticket","UI","engine","sanitizer","options","fragment","html","isEditable","headings","error","code","CODE_BLOCK","pre","block","CODE_TAG","language","LANGUAGE_CLASS","LANGUAGE","COPY","INLINE_CODE","SHORT_CODE_LENGTH","SHORT_CLASS","box","TASK_BOXES","source","base","name","LINK_ATTRIBUTES","element","value","next","nextMarkup","old","oldMarkup","node","lead","tail","anchor","hash","markup","NodeType","UIMarkdown","delegateEvents"],"sources":["../src/components/ui-markdown/MarkdownRenderer.ts","../src/components/ui-markdown/UIMarkdown.en.ts","../src/components/ui-markdown/UIMarkdown.css?inline","../src/components/ui-markdown/UIMarkdown.tsx","../src/components/ui-markdown/index.ts"],"sourcesContent":["import { E } from \"spell/ui/core\"\nimport type { MarkdownEngine } from \"./MarkdownEngine\"\nimport type { MarkdownSanitizer } from \"./MarkdownSanitizer\"\n\n/****************\n * ### `MarkdownRenderer`\n * What `<ui-markdown>` asks to render: loads an engine on first use, each in its own lazy chunk.\n * - `load()`: marked (`MarkdownEngine`), what every `<ui-markdown>` draws with, `editable`'s preview too.\n * - A subclass may draw with an engine of its own (`UIMarkdown.loadEngine()`):\n * the app's `<spell-markdown>` draws with spell's.\n * - `loadSanitizer()`: DOMPurify (`MarkdownSanitizer`), only for `sanitized`.\n * - The element only knows `render(text, options) -> { html, headings }` (`MarkdownRendering`).\n * - Static: the loads are page-wide, started once and shared by every `<ui-markdown>`;\n * the loaders are swapped page-wide too.\n ****************/\nexport class MarkdownRenderer {\n /**\n * Imports the engine module; read once, on the first render.\n * - Replaceable, e.g. by a bundle that can't keep `import()`s\n * (the docs' classic script loads it as a script of its own).\n */\n static engineLoader: () => Promise<{ MarkdownEngine: { instance: MarkdownEngine } }> = () =>\n import(\"./MarkdownEngine\")\n\n /**\n * Imports `MarkdownSanitizer`.\n * - Replaceable as `engineLoader` (the docs' classic script loads it as a script of its own).\n */\n static sanitizerLoader: () => Promise<{ MarkdownSanitizer: { instance: MarkdownSanitizer } }> = () =>\n import(\"./MarkdownSanitizer\")\n\n /** marked, loaded on first use; the import starts once. */\n @E.once static load(): Promise<MarkdownEngine> {\n return MarkdownRenderer.engineLoader().then((module) => module.MarkdownEngine.instance)\n }\n\n /** DOMPurify, loaded on first use; the import starts once. */\n @E.once static loadSanitizer(): Promise<MarkdownSanitizer> {\n return MarkdownRenderer.sanitizerLoader().then((module) => module.MarkdownSanitizer.instance)\n }\n}\n","/**\n * The English vocabulary of `<ui-markdown>`: every name the tag uses.\n * - Its tag, attributes (each with its kind and allowed values), events, slots, parts, states and texts.\n * The shape is `E.ComponentVocabulary` (`spell/ui/vocabulary`).\n * - The source pieces (`source`, `load`, `ui-loaded` ... `ui-error`, the loader and error parts, the states and texts)\n * are shared with `<ui-include>` and `<ui-code>`: `UIT.Source*`, which `LoadableComponent` reads.\n */\n\nimport type { E } from \"spell/ui/core\"\nimport * as UIT from \"spell/ui/components/components.types\"\n\n/****************\n * ### `markdownVocabulary`\n * The names of `<ui-markdown>`, GitHub-flavoured markdown rendered:\n * the element's own text or a `source` file, its code blocks as `<ui-code>`;\n * `sanitized` runs it through DOMPurify, `editable` adds Write / Preview tabs.\n ****************/\nexport const markdownVocabulary = {\n tag: \"ui-markdown\",\n topics: [\"text\", \"typography\", \"data display\"],\n aka: [\"markdown\", \"md\", \"gfm\", \"readme\", \"rich text\", \"prose\"],\n skeleton: \"header, 4 line paragraph\",\n noun: \"markdown\",\n description:\n \"Markdown renders GitHub-flavoured markdown -- tables, task lists, code blocks -- from the element's own text or a file on this site.\",\n attributes: [\n ...UIT.SourceAttributes,\n {\n name: \"size\",\n group: \"appearance\",\n kind: \"size\",\n description: \"Text size, as Fomantic's sizes; default `medium`.\"\n },\n {\n name: \"breaks\",\n group: \"appearance\",\n kind: \"boolean\",\n description: \"A single newline is a line break, as in GitHub comments; default off, as in GitHub files.\"\n },\n {\n name: \"heading-offset\",\n group: \"appearance\",\n kind: \"number\",\n property: \"headingLevelOffset\",\n default: 0,\n description:\n \"Levels to shift headings by, e.g. `1`: `#` becomes `<h2>`, to sit under the page's own heading. Property \" +\n \"`headingLevelOffset`: `headingOffset` is WebKit's native `headingoffset`.\"\n },\n {\n name: \"skip-title\",\n group: \"behaviour\",\n kind: \"boolean\",\n description:\n \"Drop the text's leading `#` title (an `h1` first thing in the text), e.g. when the page shows its own \" +\n \"headline above a README. The text itself is unchanged: `content`, `save()` and the editor keep it.\"\n },\n {\n name: \"editable\",\n group: \"behaviour\",\n kind: \"boolean\",\n description:\n \"Write / Preview tabs: a text box for the markdown, and its preview. Each edit is a `ui-changed`; `save()` \" +\n \"writes it.\"\n },\n {\n name: \"sanitized\",\n group: \"advanced\",\n kind: \"boolean\",\n description:\n \"Sanitize the rendered markup with DOMPurify (its own lazy chunk, loaded only then): no scripts, event \" +\n \"handlers or `javascript:` links. Set it for text you didn't write; without it, raw HTML is kept as written.\"\n }\n ],\n events: [\n ...UIT.SourceEvents,\n {\n name: \"ui-drawn\",\n detail: \"{ headings: { level: number, text: string, id: string }[] }\",\n description:\n \"Rendered; `headings` (also the `headings` property) lists its headings, e.g. for a table of contents.\"\n }\n ],\n slots: [],\n parts: [\n ...UIT.SourceParts,\n { name: \"body\", description: \"The `<article>` holding the rendered markdown.\" },\n { name: \"tabs\", description: \"`editable`: the Write / Preview tab list.\" },\n { name: \"tab\", description: \"`editable`: each tab button.\" },\n { name: \"editor\", description: \"`editable`: the `<textarea>` holding the markdown.\" }\n ],\n states: [...UIT.SourceStates],\n texts: [\n ...UIT.SourceTexts,\n { key: \"write\", text: \"Write\", description: \"`editable`: the editing tab.\" },\n { key: \"preview\", text: \"Preview\", description: \"`editable`: the preview tab.\" },\n { key: \"editor\", text: \"Markdown\", description: \"`editable`: accessible name of the text box.\" }\n ]\n} as const satisfies E.ComponentVocabulary\n","/*\n * The style sheet of `<ui-markdown>`: ours, not Fomantic's. GitHub's markdown look, on `ui`'s tokens.\n * - It styles the component's shadow DOM:\n * - the source parts (`<ui-loader part=\"loader\">`, `<ui-message part=\"error\">`)\n * - then a `<section>` holding `<article class=\"ui [size] markdown\" part=\"body\">`,\n * the rendered HTML (`h1`-`h6` with ids, `p`, lists (task items: `li > input[type=checkbox]`), `blockquote`,\n * `table`, `hr`, `img`, inline `code` (`code.short`: kept on one line), `del`),\n * with each code block as a `<ui-code>` (its own sheet).\n * - `editable`: `<nav part=\"tabs\">` of `<button part=\"tab\" aria-selected>`,\n * a `<section>` around `<textarea part=\"editor\">`, then the article's `<section>` (both `role=tabpanel`).\n * - A subclass's engine may draw the article's blocks as `ui-*` elements (`ui-header`, `ui-list`, `ui-table` ...:\n * the app's `<spell-markdown>`, on spell's engine): each styles itself, and this sheet only spaces them.\n * - Sizes by the generic remap: `.ui.small` ... set `--ui-scale`, and the article scales its font by it.\n * - Public tokens are NEVER declared here: each is read through its private alias (`notes/theming.md`).\n * - Headings: GitHub's look by default (sans 600, a rule under `h1` / `h2`).\n * A theme or page restyles them with the `--ui-markdown-heading-*` / `-h1-size` ...\n * `-h3-size` tokens (the brand's serif headings, `spell.css`), since `::part(body)` can't reach the elements\n * inside the article.\n */\n\n@layer ui.components.markdown.types, ui.components.markdown.content, ui.components.markdown.variations, ui.components.markdown.states;\n\n/*******************************\n Markdown\n*******************************/\n\n@layer ui.components.markdown.types {\n :host {\n --_ui-markdown-editor-border: var(--ui-markdown-editor-border, var(--ui-border-color));\n --_ui-markdown-editor-background: var(--ui-markdown-editor-background, var(--ui-surface));\n --_ui-markdown-color: var(--ui-markdown-color, var(--ui-text-color));\n --_ui-markdown-muted: var(--ui-markdown-muted, var(--ui-text-muted));\n --_ui-markdown-radius: var(--ui-markdown-radius, var(--ui-radius));\n display: block;\n }\n\n .ui.markdown {\n --_ui-markdown-color: var(--ui-markdown-color, var(--ui-text-color));\n --_ui-markdown-muted: var(--ui-markdown-muted, var(--ui-text-muted));\n --_ui-markdown-line-height: var(--ui-markdown-line-height, 1.6);\n --_ui-markdown-heading-color: var(--ui-markdown-heading-color, var(--ui-text-color));\n /* headings' font family: the article's unless set (`initial` => `inherit`) */\n --_ui-markdown-heading-font-family: var(--ui-markdown-heading-font-family, initial);\n --_ui-markdown-heading-weight: var(--ui-markdown-heading-weight, 600);\n --_ui-markdown-heading-line-height: var(--ui-markdown-heading-line-height, 1.25);\n /* above and below each heading (`margin-block`), in ITS em */\n --_ui-markdown-heading-margin: var(--ui-markdown-heading-margin, 1.5em 1em);\n /* the rule under `h1` / `h2` (a `border`; `none` drops it), and the gap between it and the text */\n --_ui-markdown-heading-rule: var(--ui-markdown-heading-rule, 1px solid var(--_ui-markdown-rule-color));\n --_ui-markdown-heading-rule-gap: var(--ui-markdown-heading-rule-gap, 0.3em);\n /* where a revealed heading lands below the top (`reveal()`, `#id`): room for a page's sticky header */\n --_ui-markdown-heading-scroll-margin: var(--ui-markdown-heading-scroll-margin, 0);\n --_ui-markdown-h1-size: var(--ui-markdown-h1-size, 2em);\n --_ui-markdown-h2-size: var(--ui-markdown-h2-size, 1.5em);\n --_ui-markdown-h3-size: var(--ui-markdown-h3-size, 1.25em);\n /* bold text and inline code: the text colour unless set (`initial` => `inherit`) */\n --_ui-markdown-strong-color: var(--ui-markdown-strong-color, initial);\n --_ui-markdown-code-color: var(--ui-markdown-code-color, initial);\n --_ui-markdown-link-color: var(--ui-markdown-link-color, var(--ui-link));\n --_ui-markdown-rule-color: var(--ui-markdown-rule-color, var(--ui-border-color));\n /* a thematic break's (`---`) thickness */\n --_ui-markdown-hr-height: var(--ui-markdown-hr-height, 0.25em);\n --_ui-markdown-table-border: var(--ui-markdown-table-border, var(--ui-border-color));\n --_ui-markdown-stripe: var(--ui-markdown-stripe, var(--ui-surface-muted));\n --_ui-markdown-blockquote-color: var(--ui-markdown-blockquote-color, var(--ui-text-muted));\n --_ui-markdown-blockquote-border: var(--ui-markdown-blockquote-border, var(--ui-border-color-strong));\n /* inline code's chip: the foundation's (`ui-typography`), so its padding reads as the chip, not as a space */\n --_ui-markdown-code-background: var(--ui-markdown-code-background, var(--ui-surface-strong));\n --_ui-markdown-radius: var(--ui-markdown-radius, var(--ui-radius));\n display: block;\n color: var(--_ui-markdown-color);\n font-size: calc(var(--ui-font-size) * var(--ui-scale, 1));\n line-height: var(--_ui-markdown-line-height);\n overflow-wrap: break-word;\n }\n}\n\n@layer ui.components.markdown.content {\n /* blocks: GitHub's rhythm, one gap below each */\n .ui.markdown :is(p, ul, ol, blockquote, table, pre, ui-code, details, hr) {\n margin-block: 0 1em;\n }\n\n /* headings */\n .ui.markdown :is(h1, h2, h3, h4, h5, h6) {\n margin-block: var(--_ui-markdown-heading-margin);\n color: var(--_ui-markdown-heading-color);\n font-family: var(--_ui-markdown-heading-font-family, inherit);\n font-weight: var(--_ui-markdown-heading-weight);\n line-height: var(--_ui-markdown-heading-line-height);\n scroll-margin-top: var(--_ui-markdown-heading-scroll-margin);\n }\n\n .ui.markdown :is(h1, h2) {\n padding-block-end: var(--_ui-markdown-heading-rule-gap);\n border-block-end: var(--_ui-markdown-heading-rule);\n }\n\n .ui.markdown h1 {\n font-size: var(--_ui-markdown-h1-size);\n }\n\n .ui.markdown h2 {\n font-size: var(--_ui-markdown-h2-size);\n }\n\n .ui.markdown h3 {\n font-size: var(--_ui-markdown-h3-size);\n }\n\n .ui.markdown h4 {\n font-size: 1em;\n }\n\n .ui.markdown h5 {\n font-size: 0.875em;\n }\n\n .ui.markdown h6 {\n color: var(--_ui-markdown-muted);\n font-size: 0.85em;\n }\n\n /* links */\n .ui.markdown a {\n color: var(--_ui-markdown-link-color);\n text-decoration: underline;\n text-underline-offset: 0.15em;\n }\n\n /* lists, task lists */\n .ui.markdown :is(ul, ol) {\n padding-inline-start: 2em;\n }\n\n .ui.markdown :is(ul, ol) :is(ul, ol) {\n margin-block-end: 0;\n }\n\n .ui.markdown li + li {\n margin-block-start: 0.25em;\n }\n\n .ui.markdown li:has(> input[type=\"checkbox\"]) {\n list-style: none;\n }\n\n .ui.markdown li > input[type=\"checkbox\"] {\n margin-inline: -1.4em 0.4em;\n vertical-align: middle;\n }\n\n /* quotes, rules */\n .ui.markdown blockquote {\n margin-inline: 0;\n padding: 0 1em;\n border-inline-start: 0.25em solid var(--_ui-markdown-blockquote-border);\n color: var(--_ui-markdown-blockquote-color);\n }\n\n .ui.markdown hr {\n height: var(--_ui-markdown-hr-height);\n margin-block: 1.5em;\n border: 0;\n background: var(--_ui-markdown-rule-color);\n }\n\n /* tables: bordered cells, striped rows, scroll when too wide; NOT a `<ui-table>`'s, which styles its own */\n .ui.markdown table:not(ui-table > table) {\n display: block;\n width: max-content;\n max-width: 100%;\n overflow: auto;\n border-collapse: collapse;\n }\n\n .ui.markdown :is(th, td):not(ui-table *) {\n padding: 0.4em 0.8em;\n border: 1px solid var(--_ui-markdown-table-border);\n }\n\n .ui.markdown th:not(ui-table *) {\n font-weight: 600;\n }\n\n .ui.markdown tbody tr:nth-child(2n):not(ui-table *) {\n background: var(--_ui-markdown-stripe);\n }\n\n /* bold */\n .ui.markdown :is(strong, b) {\n color: var(--_ui-markdown-strong-color, inherit);\n }\n\n /*\n * Inline code: the foundation's chip, padded a little at its sides, no margin, so punctuation sits against it.\n * - A short span never breaks across lines (`--toggle` split at its dashes):\n * `code.short`, marked by `UIMarkdown.keepShortCode()`.\n * A longer one still wraps, so it never runs off a phone's screen.\n */\n .ui.markdown :not(pre) > code {\n padding: 0.125em 0.375em;\n border-radius: var(--_ui-markdown-radius);\n background: var(--_ui-markdown-code-background);\n color: var(--_ui-markdown-code-color, inherit);\n font-family: var(--ui-font-family-mono);\n font-size: 0.85em;\n }\n\n .ui.markdown :not(pre) > code.short {\n white-space: nowrap;\n }\n\n /* images, strikethrough */\n .ui.markdown img {\n max-width: 100%;\n height: auto;\n }\n\n .ui.markdown del {\n color: var(--_ui-markdown-muted);\n }\n\n /* code blocks are `<ui-code>`s */\n .ui.markdown ui-code {\n display: block;\n }\n\n /* an engine drawing `ui-*` blocks (a subclass's: `<spell-markdown>`): the same rhythm */\n .ui.markdown :is(ui-header, ui-list, ui-message, ui-segment, ui-table, ui-divider) {\n display: block;\n margin-block: 0 1em;\n }\n\n .ui.markdown ui-header {\n margin-block-start: 1.5em;\n }\n\n .ui.markdown ui-list ui-list {\n margin-block-end: 0;\n }\n\n /* no gap above the first block or below the last: AFTER the block rules, which set both */\n .ui.markdown > :first-child {\n margin-block-start: 0;\n }\n\n .ui.markdown > :last-child {\n margin-block-end: 0;\n }\n\n /* `editable`: Write / Preview tabs over the text box or the preview, GitHub's comment box */\n [part~=\"tabs\"] {\n display: flex;\n gap: 0.25em;\n border-block-end: 1px solid var(--_ui-markdown-editor-border);\n }\n\n [part~=\"tab\"] {\n margin-block-end: -1px;\n padding: 0.5em 1em;\n border: 1px solid transparent;\n border-start-start-radius: var(--_ui-markdown-radius);\n border-start-end-radius: var(--_ui-markdown-radius);\n background: none;\n color: var(--_ui-markdown-muted);\n font: inherit;\n cursor: pointer;\n }\n\n [part~=\"tab\"][aria-selected=\"true\"] {\n border-color: var(--_ui-markdown-editor-border);\n border-block-end-color: var(--_ui-markdown-editor-background);\n background: var(--_ui-markdown-editor-background);\n color: var(--_ui-markdown-color);\n }\n\n [part~=\"editor\"] {\n display: block;\n box-sizing: border-box;\n width: 100%;\n min-height: 12em;\n padding: 0.75em;\n border: 1px solid var(--_ui-markdown-editor-border);\n border-radius: var(--_ui-markdown-radius);\n background: var(--_ui-markdown-editor-background);\n color: var(--_ui-markdown-color);\n font-family: var(--ui-font-family-mono);\n font-size: 0.875em;\n line-height: 1.5;\n resize: vertical;\n }\n\n [part~=\"tabs\"] ~ section {\n margin-block-start: 0.75em;\n }\n}\n","import { For, Show } from \"solid-js\"\nimport type { JSX } from \"@solidjs/web\"\n\nimport { E, UI } from \"spell/ui/core\"\nimport type { codeVocabulary } from \"spell/ui/components/ui-code/UICode.en\"\nimport { MarkdownRenderer } from \"./MarkdownRenderer\"\nimport type { MarkdownHeading, MarkdownOptions, MarkdownRendering } from \"./UIMarkdown.types\"\nimport { markdownVocabulary } from \"./UIMarkdown.en\"\n\nimport markdownCSS from \"./UIMarkdown.css?inline\"\n\n/****************\n * ### `DOMMarkdownElement`\n * The DOM element of `<ui-markdown>`: it adds `headings` and `reveal()`\n * to the source API it inherits from `DOMLoadableElement` (`content`, `save()` ...).\n * - `headings`: `{ level, text, id }` of each heading of the last render, e.g. for a table of contents;\n * `[]` before the first (`ui-drawn` says when).\n * - `reveal(id)`: scroll to one of them from outside.\n * - Above the component: its `elementSetup` reads this class while the component is defined.\n ****************/\nexport class DOMMarkdownElement extends E.DOMLoadableElement<UIMarkdown> {\n /** Each heading of the last render; `[]` before the first. Untracked: it's for scripts. */\n @E.untracked\n get headings(): MarkdownHeading[] {\n return this.component?.headings ?? []\n }\n\n /**\n * Scroll to the rendered heading `id` (a `headings` entry's) and put `#id` in the address,\n * as a `#id` link inside does; `false` when no such heading is rendered (yet).\n * - Why a method: the headings live in the shadow root, which the page's own fragment navigation can't see,\n * e.g. from a table of contents outside the element.\n */\n reveal(id: string): boolean {\n return this.component?.reveal(id) ?? false\n }\n}\n\n/****************\n * ### `UIMarkdown`\n * The component behind `<ui-markdown>`: GitHub-flavoured markdown, rendered.\n *\n * - Its shadow DOM:\n * `<article class=\"ui [size] markdown\" part=\"body\">` in a `<section>` (the preview panel, when `editable`).\n * - The text: the element's own (`<script type=\"text/markdown\">` keeps it exact),\n * or a `source` file (see `LoadableComponent`).\n * - Rendering: marked, loaded with the first render (`MarkdownRenderer` -> `MarkdownEngine`, the lazy chunk).\n * Headings get GitHub's ids (`headings`, `ui-drawn`).\n * - A subclass may draw with an engine of its own (`loadEngine()`):\n * the app's `<spell-markdown>` draws with spell's, in `ui-*` elements.\n * - NOT sanitized unless `sanitized`: raw HTML in the text is kept.\n * `sanitized` loads DOMPurify (`MarkdownSanitizer`, a lazy chunk of its own) alongside the engine:\n * set it for text you didn't write.\n * - After rendering:\n * - each fenced code block becomes a `<ui-code language=\"x\" copy>` (one highlighter, one palette)\n * - each short inline code span is marked `short`, kept on one line (`keepShortCode()`)\n * - each task-list checkbox is named by its item's text (marked leaves it unlabelled)\n * - relative `href` / `src` resolve against `source`, so a README's links and images work where it's shown\n * - `#id` links scroll to the heading INSIDE the shadow root\n * (the page's own fragment navigation can't see it).\n * So do `reveal(id)` from outside, and a `#id` in the address that names one of its headings:\n * after the FIRST render (a page loaded with it), and on each `hashchange` (a link elsewhere on the page).\n * - `skip-title`: the text's leading `#` title isn't rendered (the text keeps it).\n * - A failed render (an engine that won't load) is a `render` error, with its message.\n * - `editable`: Write / Preview tabs (`role=tablist`, arrow keys), a `<textarea>` for the text,\n * and the article as the preview, drawn by the same engine.\n * - each keystroke sets `content`: `ui-changed`, `:state(dirty)`, and `save()` writes it back to `source`\n * - the preview renders while it's shown: the WHOLE text each time (~2 ms for 32 kB),\n * then swaps only the top-level blocks whose markup changed (`patchBody()`),\n * so unchanged elements keep their state (a highlighted `<ui-code>`, a scrolled table).\n * - SIDE EFFECTS: listens to `window`'s `hashchange` while connected;\n * a revealed heading is put in the address (`history.replaceState`, no new entry).\n ****************/\nexport class UIMarkdown extends E.LoadableComponent<typeof markdownVocabulary> {\n // typed wide, as `UIRoot`'s: a subclass names its own (the app's `<spell-markdown>`)\n @E.proto static vocabulary: E.ComponentVocabulary = markdownVocabulary\n @E.protoMerged static elementSetup = {\n styleSheets: { markdown: markdownCSS },\n DOMElement: DOMMarkdownElement,\n delegatesFocus: false\n } satisfies Partial<E.ElementSetup>\n\n ////////////////\n // ## Rendering\n ////////////////\n\n /** The `<article>`, once rendered. */\n private body?: HTMLElement\n\n /** Renders started; only the latest one's result is shown. */\n private ticket = 0\n\n /** Markup of each top-level node `patchBody()` put in the article, to tell which blocks changed. */\n private readonly rendered = new WeakMap<Node, string>()\n\n /**\n * Render whenever the text or a rendering attribute changes; `editable`, only while the preview shows.\n * - Never on a server: the server runs no effect.\n */\n @E.onChange(\"textToShow\", \"skipTitle\", \"loadStatus\", \"editable\", \"shownTab\", \"breaks\", \"headingOffset\", \"sanitized\")\n protected onMarkdownChanged() {\n const isShown = !this.editable || this.shownTab === PREVIEW\n if (this.loadStatus !== \"loaded\" || !isShown) return\n void this.renderMarkdown({\n text: this.skipTitle ? this.textToShow.replace(LEADING_TITLE, \"\") : this.textToShow,\n isEditable: this.editable,\n options: {\n breaks: !!this.breaks,\n headingOffset: Number(this.headingOffset) || 0,\n sanitized: !!this.sanitized\n }\n })\n }\n\n protected renderContent(): JSX.Element {\n return (\n <>\n <Show when={this.editable}>\n {this.tabs()}\n {this.editor()}\n </Show>\n <section\n id={UIMarkdown.panelId(PREVIEW)}\n role={this.editable ? TAB_ROLES.panel : undefined}\n aria-labelledby={this.editable ? UIMarkdown.tabId(PREVIEW) : undefined}\n hidden={this.editable && this.shownTab !== PREVIEW ? true : undefined}\n >\n <article\n class={this.rootClass}\n part={this.partForName(\"body\")}\n onClick={this.onClick}\n ref={(body: HTMLElement) => {\n this.body = body\n }}\n />\n </section>\n </>\n )\n }\n\n ////////////////\n // ## Editing (`editable`)\n ////////////////\n\n /** `editable`'s shown tab. */\n @E.state accessor shownTab: MarkdownTab = WRITE\n\n /** `editable`: the text box. */\n private textBox?: HTMLTextAreaElement\n\n /** `editable`: the tab buttons, by tab. */\n private readonly tabButtons = new Map<MarkdownTab, HTMLButtonElement>()\n\n /** `editable`'s tab list: Write, Preview. */\n private tabs(): JSX.Element {\n return (\n <nav part={this.partForName(\"tabs\")} role={TAB_ROLES.list} onKeyDown={this.onTabKeyDown}>\n <For each={MarkdownTabs}>\n {(tab) => (\n <button\n type=\"button\"\n id={UIMarkdown.tabId(tab)}\n role={TAB_ROLES.tab}\n part={this.partForName(\"tab\")}\n aria-selected={this.shownTab === tab ? \"true\" : \"false\"}\n aria-controls={UIMarkdown.panelId(tab)}\n tabindex={this.shownTab === tab ? 0 : -1}\n onClick={() => (this.shownTab = tab)}\n ref={(button: HTMLButtonElement) => {\n this.tabButtons.set(tab, button)\n }}\n >\n {this.translationForKey(tab)}\n </button>\n )}\n </For>\n </nav>\n )\n }\n\n /** `editable`'s text box, in the Write panel. */\n private editor(): JSX.Element {\n return (\n <section\n id={UIMarkdown.panelId(WRITE)}\n role={TAB_ROLES.panel}\n aria-labelledby={UIMarkdown.tabId(WRITE)}\n hidden={this.shownTab !== WRITE ? true : undefined}\n >\n <textarea\n part={this.partForName(\"editor\")}\n aria-label={this.translationForKey(\"editor\")}\n onInput={this.onInput}\n ref={this.keepTextBox}\n />\n </section>\n )\n }\n\n /** `editable`: keep the text box as it's drawn, and fill it with the text (`onTextChanged()` keeps it in step). */\n @E.untracked\n private readonly keepTextBox = (textBox: HTMLTextAreaElement) => {\n this.textBox = textBox\n textBox.value = this.textToShow\n }\n\n /** `editable`: the text box follows the content (`domElement.content = ...`, a reload). */\n @E.onChange(\"textToShow\")\n protected onTextChanged(text: string) {\n if (this.textBox && this.textBox.value !== text) this.textBox.value = text\n }\n\n /** `editable`: each keystroke is an edit (`ui-changed`, `dirty`). */\n private readonly onInput = (event: InputEvent) => {\n this.content = (event.currentTarget as HTMLTextAreaElement).value\n }\n\n /** `editable`'s tab list: arrows move between the tabs (wrapping), Home / End to the ends; focus follows. */\n private readonly onTabKeyDown = (event: KeyboardEvent) => {\n UI.focus.arrowKey(event, {\n container: event.currentTarget as HTMLElement,\n items: () => MarkdownTabs.map((tab) => this.tabButtons.get(tab)!),\n orientation: \"horizontal\",\n // the shown tab is the tab stop, drawn by `tabs()`\n tabindex: \"left alone\",\n onChange: (_button, index) => (this.shownTab = MarkdownTabs[index]!)\n })\n }\n\n ////////////////\n // ## Headings\n ////////////////\n\n /** The headings of the last render; the DOM element's `headings` reads it untracked. */\n @E.state accessor headings: MarkdownHeading[] = []\n\n /** A render has finished: the address's `#id` was looked for once, after the first. */\n private hasRendered = false\n\n /** Scroll to the rendered heading `id` and put `#id` in the address; `false` when there's none. */\n reveal(id: string): boolean {\n if (!this.scrollTo(id)) return false\n history.replaceState(history.state, \"\", `#${id}`)\n return true\n }\n\n /** While connected, listen to `window`'s `hashchange`; returns the listener's abort. */\n @E.whileConnected\n protected followHash() {\n const listeners = new AbortController()\n window.addEventListener(\"hashchange\", () => this.onHashChange(), { signal: listeners.signal })\n return () => listeners.abort()\n }\n\n /**\n * Scroll to the heading the address's `#id` names, if it's one of ours:\n * on `hashchange`, and once after the first render.\n * - Not when the PAGE has that id: the browser went there itself.\n */\n private onHashChange() {\n const id = UIMarkdown.idForHash(location.hash)\n if (id && !this.domElement.ownerDocument.getElementById(id)) this.scrollTo(id)\n }\n\n /** Scroll the element with `id` in the article into view; `false` when there's none. */\n private scrollTo(id: string): boolean {\n const target = this.body?.querySelector(`[id=\"${CSS.escape(id)}\"]`)\n target?.scrollIntoView()\n return !!target\n }\n\n /** A `#id` link: scroll to that heading here, in the shadow root, and put it in the address. */\n private readonly onClick = (event: MouseEvent) => {\n const link = (event.target as Element).closest?.(IN_PAGE_LINK)\n const id = link && UIMarkdown.idForHash(link.getAttribute(\"href\")!)\n if (id && this.reveal(id)) event.preventDefault()\n }\n\n ////////////////\n // ## Markup\n ////////////////\n\n /**\n * The engine this element draws with, loaded on first use: marked (`MarkdownRenderer.load()`).\n * - A HOOK: a subclass draws with an engine of its own by overriding it (the app's `<spell-markdown>`).\n * Its markup may hold `ui-*` elements (`MarkdownRendering.drawsUITags`), which `sanitized` then keeps.\n */\n protected loadEngine(): Promise<MarkdownRendering> {\n return MarkdownRenderer.load()\n }\n\n /**\n * Render `text` into the article; `ui-drawn` when done.\n * - `isEditable`: the markup patched in (`patchBody()`), so unchanged blocks keep their state.\n */\n private async renderMarkdown({ text, options, isEditable }: RenderParams) {\n const ticket = ++this.ticket\n try {\n await UI.load()\n const [engine, sanitizer] = await Promise.all([\n this.loadEngine(),\n options.sanitized ? MarkdownRenderer.loadSanitizer() : undefined\n ])\n if (ticket !== this.ticket || !this.body) return\n const { html, headings } = engine.render(text, options)\n const fragment = sanitizer\n ? sanitizer.sanitize(html, { uiTags: !!engine.drawsUITags })\n : this.domElement.ownerDocument.createRange().createContextualFragment(html)\n this.upgradeCode(fragment)\n this.keepShortCode(fragment)\n this.labelTaskItems(fragment)\n this.resolveUrls(fragment)\n if (isEditable) this.patchBody(this.body, fragment)\n else this.body.replaceChildren(fragment)\n this.headings = headings\n this.send(\"ui-drawn\", { headings })\n if (!this.hasRendered) {\n this.hasRendered = true\n this.onHashChange()\n }\n } catch (error) {\n if (ticket === this.ticket) this.onLoadError(error, \"render\")\n }\n }\n\n /** Each `<pre><code class=\"language-x\">` in `fragment` becomes a `<ui-code language=\"x\" copy>` with its text. */\n private upgradeCode(fragment: DocumentFragment) {\n for (const code of fragment.querySelectorAll(CODE_BLOCK)) {\n const pre = code.parentElement!\n const block = this.domElement.ownerDocument.createElement(CODE_TAG)\n const language = LANGUAGE_CLASS.exec(code.className)?.[1]\n if (language) block.setAttribute(LANGUAGE, language)\n block.setAttribute(COPY, \"\")\n block.textContent = (code.textContent ?? \"\").replace(/\\n$/, \"\")\n pre.replaceWith(block)\n }\n }\n\n /**\n * Mark each short inline code span `short`, so it never breaks across lines (`UIMarkdown.css`):\n * a browser breaks `--toggle` after its dashes.\n * - Only short ones (`SHORT_CODE_LENGTH`): a long span kept whole would run off a phone's screen.\n */\n private keepShortCode(fragment: DocumentFragment) {\n for (const code of fragment.querySelectorAll(INLINE_CODE)) {\n if ((code.textContent ?? \"\").length <= SHORT_CODE_LENGTH) code.classList.add(SHORT_CLASS)\n }\n }\n\n /** Name each task-list checkbox by its item's text: both engines write a bare box, which nothing labels. */\n private labelTaskItems(fragment: DocumentFragment) {\n for (const box of fragment.querySelectorAll(TASK_BOXES)) {\n const text = box.parentElement!.textContent?.trim()\n if (text) box.setAttribute(\"aria-label\", text)\n }\n }\n\n /** Point relative URLs in `fragment` where they point beside `source`; in-page `#id`s are left alone. */\n private resolveUrls(fragment: DocumentFragment) {\n const source = this.source || undefined\n if (!source) return\n const base = new URL(source, this.domElement.ownerDocument.baseURI)\n for (const name of LINK_ATTRIBUTES) {\n for (const element of fragment.querySelectorAll(`[${name}]`)) {\n const value = element.getAttribute(name)!\n if (value.startsWith(\"#\")) continue\n try {\n element.setAttribute(name, new URL(value, base).href)\n } catch {\n // not a URL: leave it\n }\n }\n }\n }\n\n /**\n * Put `fragment`'s top-level nodes in `body`, keeping the ones already there whose markup is the same:\n * the unchanged lead and tail stay, only the middle is swapped.\n * - Why: an edit changes a block or two; re-creating every `ui-*` element would re-highlight every code block\n * and lose each one's state (a scrolled table, a copied-code tick).\n * - A node not put here (a render from before `editable`) has no markup recorded, so it's always swapped.\n */\n private patchBody(body: HTMLElement, fragment: DocumentFragment) {\n const next = [...fragment.childNodes]\n const nextMarkup = next.map(UIMarkdown.markupFor)\n const old = [...body.childNodes]\n const oldMarkup = old.map((node) => this.rendered.get(node))\n let lead = 0\n while (lead < next.length && lead < old.length && nextMarkup[lead] === oldMarkup[lead]) lead++\n let tail = 0\n while (\n tail < next.length - lead &&\n tail < old.length - lead &&\n nextMarkup[next.length - 1 - tail] === oldMarkup[old.length - 1 - tail]\n ) {\n tail++\n }\n for (const node of old.slice(lead, old.length - tail)) node.remove()\n // `insertBefore()`'s \"at the end\" is `null`: a platform boundary\n const anchor = tail ? old[old.length - tail] : null\n for (const [index, node] of next.slice(lead, next.length - tail).entries()) {\n this.rendered.set(node, nextMarkup[lead + index])\n body.insertBefore(node, anchor)\n }\n }\n\n ////////////////\n // ## Helpers: static, as they're pure\n ////////////////\n\n /** `#some%20id` => `some id`; `undefined` for no hash, or a malformed one. */\n private static idForHash(hash: string): string | undefined {\n try {\n return decodeURIComponent(hash.slice(1)) || undefined\n } catch {\n return undefined\n }\n }\n\n /** A top-level node's markup, to compare renders by. */\n private static markupFor(node: Node): string {\n const markup = node.nodeType === E.NodeType.element ? (node as Element).outerHTML : node.textContent\n return `${node.nodeType}:${markup}`\n }\n\n /** Id of `tab`'s button, inside the shadow root. */\n private static tabId(tab: MarkdownTab): string {\n return `ui-markdown-${tab}-tab`\n }\n\n /** Id of `tab`'s panel, inside the shadow root. */\n private static panelId(tab: MarkdownTab): string {\n return `ui-markdown-${tab}-panel`\n }\n}\n\n/** The vocabulary getters, typed (`UIComponent`'s doc). */\nexport interface UIMarkdown extends E.AttributeValues<typeof markdownVocabulary> {}\n\n/** What `renderMarkdown()` renders. */\ntype RenderParams = {\n /** the markdown */\n text: string\n /** how to render it */\n options: MarkdownOptions\n /** `editable`: patched in, block by block (`patchBody()`) */\n isEditable: boolean\n}\n\n/** `editable`'s Write tab: the text box. */\nconst WRITE = \"write\"\n\n/** `editable`'s Preview tab: the article. */\nconst PREVIEW = \"preview\"\n\n/** `editable`'s tabs, in order; each is also its text's key. */\nconst MarkdownTabs = [WRITE, PREVIEW] as const\n\n/** One of `MarkdownTabs`. */\ntype MarkdownTab = (typeof MarkdownTabs)[number]\n\n/** `editable`'s tab roles. */\nconst TAB_ROLES = { list: \"tablist\", tab: \"tab\", panel: \"tabpanel\" } as const\n\n/**\n * A leading `#` title (`skip-title`), with its line end:\n * blank lines, then an ATX `# Title` (one `#`) or a setext title (a line underlined with `=`).\n */\nconst LEADING_TITLE = /^(?:[ \\t]*\\n)*[ ]{0,3}(?:#(?=[ \\t\\n]|$)[^\\n]*|[^\\s][^\\n]*\\n[ ]{0,3}=+[ \\t]*)(?:\\n|$)/\n\n/** A fenced code block, as both engines write it. */\nconst CODE_BLOCK = \"pre > code\"\n\n/** An inline code span: any `<code>` outside a code block (the blocks are `<ui-code>`s by then). */\nconst INLINE_CODE = \":not(pre) > code\"\n\n/** Longest inline code span kept on one line, in characters: a token name (`--ui-button-padding-block`) fits a phone's line. */\nconst SHORT_CODE_LENGTH = 28\n\n/** Class of a short inline code span. */\nconst SHORT_CLASS = \"short\"\n\n/** A code block's language, from its class: `language-js` => `js`. */\nconst LANGUAGE_CLASS = /\\blanguage-(\\S+)/\n\n/** Tag a fenced code block becomes. */\nconst CODE_TAG: (typeof codeVocabulary)[\"tag\"] = \"ui-code\"\n\n/** `<ui-code>`'s highlighting language. */\nconst LANGUAGE: E.AttributeName<typeof codeVocabulary> = \"language\"\n\n/** `<ui-code>`'s copy button. */\nconst COPY: E.AttributeName<typeof codeVocabulary> = \"copy\"\n\n/** Task-list checkboxes: marked's (`<input>`), and a `ui-*` engine's (`<ui-checkbox>`: `<spell-markdown>`'s). */\nconst TASK_BOXES = \"li > input[type=checkbox], ui-item > ui-checkbox\"\n\n/**\n * Attributes rewritten against `source`, so relative links and images point where they did beside the file.\n * - Not the element core's `E.URL_ATTRIBUTES`: markdown writes only these two, and keeps no originals to save.\n */\nconst LINK_ATTRIBUTES = [\"href\", \"src\"] as const\n\n/** A link to a `#id` on this page. */\nconst IN_PAGE_LINK = \"a[href^='#']\"\n","/**\n * The markdown family: defines `<ui-markdown>` and exports its component, `UIMarkdown`,\n * its DOM element class, `DOMMarkdownElement`, and `MarkdownRenderer`;\n * and the types an engine of a subclass's own meets (`MarkdownRendering`: `UIMarkdown.loadEngine()`).\n * - SIDE EFFECT: importing it defines the tag, and `<ui-code>` (its code blocks),\n * `<ui-loader>` and `<ui-message>` (its loading and error looks).\n * - Also the library's `spell/ui/ui-markdown` entry (its size is in `notes/report.md`).\n * - marked and DOMPurify are NOT in this chunk: `MarkdownEngine` loads on the first render,\n * DOMPurify (`MarkdownSanitizer`) only for `sanitized`.\n */\n\nimport { DOMMarkdownElement, UIMarkdown } from \"./UIMarkdown\"\nimport { MarkdownRenderer } from \"./MarkdownRenderer\"\n\nimport \"spell/ui/components/ui-code\"\nimport \"spell/ui/components/ui-loader\"\nimport \"spell/ui/components/ui-message\"\n\nUIMarkdown.define()\n\nexport { UIMarkdown, DOMMarkdownElement, MarkdownRenderer }\nexport type { MarkdownHeading, MarkdownOptions, MarkdownRendering, MarkdownResult } from \"./UIMarkdown.types\"\n"],"mappings":";;;;;;;;AAAA,IAAAiE,GAAAC,KAgCE,CAACjE,CAAE,GAhCLD;AAqCE,IAAA,CAACC,CAAE;AAtBE,IAAMoE,IAAN,MAAM,kBAAiB;CAiBpB,OAAO,OAAgC;EAC7C,OAAO,kBAAiB,aAAa,CAAA,CAAE,MAAM,MAAWC,EAAO,eAAe,QAAQ;CACxF;CAGQ,OAAO,gBAA4C;EACzD,OAAO,kBAAiB,gBAAgB,CAAA,CAAE,MAAM,MAAWA,EAAO,kBAAkB,QAAQ;CAC9F;AACF;AAz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M9BY,IAAY;CAAE,MAAM;CAAW,KAAK;CAAO,OAAO;AAAW,GAM7DX,KAAgB,wFAGhB6C,KAAa,cAGbQ,KAAc,oBAGdC,KAAoB,IAGpBC,KAAc,SAGdL,KAAiB,oBAGjBF,KAA2C,WAG3CG,KAAmD,YAGnDC,KAA+C,QAG/CK,KAAa,oDAMbI,KAAkB,CAAC,QAAQ,KAAK,GAGhChE,KAAe;;;;;;;ICterB8E,EAAW,OAAO"}
|
|
1
|
+
{"version":3,"file":"ui-markdown.js","names":["_init","E.once","__name","UIT.SourceAttributes","UIT.SourceEvents","UIT.SourceParts","UIT.SourceStates","UIT.SourceTexts","_headings_dec","_init","<Show when={this.hasTabs}>\n {this.tabs()}\n {this.editor()}\n </Show>","this","this.tabs()","this.editor()","ref={(body) => {\n this.body = body;\n }}","role={this.hasTabs ? TAB_ROLES.panel : void 0}","aria-labelledby={this.hasTabs ? _UIMarkdown.tabId(PREVIEW) : void 0}","hidden={this.hasTabs && this.shownTab !== PREVIEW ? true : void 0}","class={this.rootClass}","part={this.partForName(\"body\")}","<For each={MarkdownTabs}>\n {(tab) => <button\n type=\"button\"\n id={_UIMarkdown.tabId(tab)}\n role={TAB_ROLES.tab}\n part={this.partForName(\"tab\")}\n aria-selected={this.shownTab === tab ? \"true\" : \"false\"}\n aria-controls={_UIMarkdown.panelId(tab)}\n tabindex={this.shownTab === tab ? 0 : -1}\n onClick={() => this.shownTab = tab}\n ref={(button) => {\n this.tabButtons.set(tab, button);\n }}\n >\n {this.translationForKey(tab)}\n </button>}\n </For>","each={MarkdownTabs}","ref={(button) => {\n this.tabButtons.set(tab, button);\n }}","role={TAB_ROLES.tab}","part={this.partForName(\"tab\")}","aria-selected={this.shownTab === tab ? \"true\" : \"false\"}","aria-controls={_UIMarkdown.panelId(tab)}","tabindex={this.shownTab === tab ? 0 : -1}","role={TAB_ROLES.list}","<nav part={this.partForName(\"tabs\")} role={TAB_ROLES.list} onKeyDown={this.onTabKeyDown}>\n <For each={MarkdownTabs}>\n {(tab) => <button\n type=\"button\"\n id={_UIMarkdown.tabId(tab)}\n role={TAB_ROLES.tab}\n part={this.partForName(\"tab\")}\n aria-selected={this.shownTab === tab ? \"true\" : \"false\"}\n aria-controls={_UIMarkdown.panelId(tab)}\n tabindex={this.shownTab === tab ? 0 : -1}\n onClick={() => this.shownTab = tab}\n ref={(button) => {\n this.tabButtons.set(tab, button);\n }}\n >\n {this.translationForKey(tab)}\n </button>}\n </For>\n </nav>","ref={this.keepTextBox}","role={TAB_ROLES.panel}","aria-labelledby={_UIMarkdown.tabId(WRITE)}","hidden={this.shownTab !== WRITE ? true : void 0}","part={this.partForName(\"editor\")}","aria-label={this.translationForKey(\"editor\")}","<section\n id={_UIMarkdown.panelId(WRITE)}\n role={TAB_ROLES.panel}\n aria-labelledby={_UIMarkdown.tabId(WRITE)}\n hidden={this.shownTab !== WRITE ? true : void 0}\n >\n <textarea\n part={this.partForName(\"editor\")}\n aria-label={this.translationForKey(\"editor\")}\n onInput={this.onInput}\n ref={this.keepTextBox}\n />\n </section>","E.DOMLoadableElement","E.untracked","__name","E.LoadableComponent","E.proto","E.protoMerged","E.onChange","E.state","E.cssState","E.whileConnected","E.after","_$createComponent","_$memo","_$readShallow","_$setAttribute","_$ref","markdownCSS","_$delegateEvents","__name$1","__publicField","__decorateElement","__decoratorMetadata","__runInitializers","__privateAdd","SourceEvents","SourceTexts","SourceStates","SourceAttributes","SourceParts","__decoratorStart","PrefStore","MarkdownFormats","edit","start","end","text","mark","length","from","to","inner","unwrapped","wrapped","link","replaced","address","words","linked","match","LINK","offset","whole","part","STRONG","STRUCK","EMPHASIS","cleared","WRAP_MARKS","inside","formats","pattern","format","place","lead","heading","lineStart","indent","shape","raw","SHAPE_LEADS","next","kind","runs","out","child","node","TEXT_NODE","ELEMENT_NODE","element","name","HTML_MARKS","WORD_CHAR","earliest","RUN_PATTERNS","within","singles","MarkdownBox","props","isExact","document","range","action","FORMATTED_COMMANDS","WRAPS","anchor","event","KEY_ACTIONS","at","run","span","bar","parts","texts","BAR_ACTIONS","button","ICONS","tip","MENU_SHAPES","item","SHAPE_TEXTS","value","isOn","command","FORMAT_STATES","startNode","startOffset","endNode","endOffset","walker","left","last","before","selection","field","holder","renderInline","_loadSanitizer_dec","_load_dec","once","_init$1","_MarkdownRenderer","module","MarkdownRenderer","MarkdownSource","places","PLACE_KEY","token","tokens","oneLine","fitted","UNESCAPED_PIPE","add","atx","ATX_HEADING","rule","SETEXT_RULE","lines","rows","index","line","cells","column","cell","firstLine","itemStart","own","rest","block","marker","LIST_MARKER","isOneLine","holdsOnlyLists","nested","pipes","bounds","markdownVocabulary","UIMarkdown_default","_tmpl$","_tmpl$2","_tmpl$3","_tmpl$4","_headings_dec","_a","_init","_followHash_dec","_headings_dec2","_onBoxLeft_dec","_onBoxInput_dec","_onBoxKey_dec","_followOptionKey_dec","_isEditingInPlace_dec","_box_dec","_isPlacing_dec","_isOptionHeld_dec","_onTextChanged_dec","_keepTextBox_dec","_shownTab_dec","_onMarkdownChanged_dec","_elementSetup_dec","_vocabulary_dec","_b","_init2","_shownTab","_isOptionHeld","_box","_headings","_DOMMarkdownElement","DOMLoadableElement","untracked","id","DOMMarkdownElement","_UIMarkdown","LoadableComponent","proto","protoMerged","onChange","state","cssState","whileConnected","WRITE","textBox","MarkdownTabs","tab","box","isNewLine","edge","EDGE_KEYS","after","KEEP_AFTER_SECONDS","IN_PAGE_LINK","isShown","PREVIEW","shown","LEADING_TITLE","_self$","createComponent","Show","memo","_el$","_el$2","addEvent","ref","body","effect","TAB_ROLES","readShallow","_p$","setAttribute","t","a","o","className","i","n","TABS","_self$2","_el$3","insert","For","_el$4","_self$3","_el$5","_el$6","_ref$","listeners","options","follow","target","piece","PLACED","PLACE_ATTRIBUTE","caret","point","editor","engine","key","view","EDIT_VIEW_KEY","typed","reshaped","neighbour","how","rendered","error","SourceEvent","pieces","edited","moved","root","char","found","ticket","UI","sanitizer","fragment","html","isEditable","headings","code","CODE_BLOCK","pre","CODE_TAG","language","LANGUAGE_CLASS","LANGUAGE","COPY","INLINE_CODE","SHORT_CODE_LENGTH","SHORT_CLASS","TASK_BOXES","source","base","LINK_ATTRIBUTES","nextMarkup","old","oldMarkup","tail","hash","first","NodeType","NESTED_LIST","TASK_BOX","markup","UIMarkdown","delegateEvents"],"sources":["../src/components/ui-markdown/MarkdownFormats.ts","../src/components/ui-markdown/MarkdownBox.ts","../src/components/ui-markdown/MarkdownRenderer.ts","../src/components/ui-markdown/MarkdownSource.ts","../src/components/ui-markdown/UIMarkdown.en.ts","../src/components/ui-markdown/UIMarkdown.css?inline","../src/components/ui-markdown/UIMarkdown.tsx","../src/components/ui-markdown/index.ts"],"sourcesContent":["import type { MarkdownPlace } from \"./UIMarkdown.types\"\n\n/****************\n * ### `MarkdownFormats`\n * The formats `<ui-markdown editable>`'s box puts on its text (epic `epic-engine` P61), as markdown marks:\n * bold `**`, italic `*`, strikethrough `~~`, a link `[text](address)`; and a piece's SHAPE, which its line starts\n * with: a paragraph, a heading (`## `), a bulleted or numbered item (`- `, `1. `).\n * - Each format works on the box's text and its selection (`Edit`), and answers the new text and selection.\n * - `runsOf()`: the text cut into runs, each mark or styled word, for the box's faded-marks view.\n * - `markdownOf()`: a formatted view's DOM written back as markdown.\n * - Pure but `markdownOf()` (a DOM walk), so its tests need no element.\n ****************/\nexport class MarkdownFormats {\n ////////////////\n // ## Marks\n ////////////////\n\n /**\n * `mark` put around the selection, or taken off when it's there already.\n * - No selection: the word at the cursor; between words, an empty pair with the cursor in it.\n * - A single `*` (italic) never counts one of bold's `**` as its own.\n */\n static toggle(edit: Edit, mark: WrapMark): Edit {\n const { text } = edit\n let { start, end } = edit.start === edit.end ? MarkdownFormats.wordAt(edit) : edit\n if (start === end) {\n return {\n text: text.slice(0, start) + mark + mark + text.slice(end),\n start: start + mark.length,\n end: start + mark.length\n }\n }\n const length = mark.length\n const isWrapped = (from: number, to: number) =>\n text.slice(from - length, from) === mark &&\n text.slice(to, to + length) === mark &&\n (mark !== \"*\" ||\n (text[from - length - 1] !== \"*\" && text[to + length] !== \"*\") ||\n MarkdownFormats.isTriple(text, from, to))\n if (isWrapped(start, end)) {\n return {\n text: text.slice(0, start - length) + text.slice(start, end) + text.slice(end + length),\n start: start - length,\n end: end - length\n }\n }\n const inner = text.slice(start, end)\n if (inner.length > 2 * length && inner.startsWith(mark) && inner.endsWith(mark)) {\n const unwrapped = inner.slice(length, -length)\n return { text: text.slice(0, start) + unwrapped + text.slice(end), start, end: start + unwrapped.length }\n }\n // marks never sit against the space around a selection: `** bold**` isn't bold\n while (start < end && /\\s/.test(text[start]!)) start++\n while (end > start && /\\s/.test(text[end - 1]!)) end--\n const wrapped = mark + text.slice(start, end) + mark\n return { text: text.slice(0, start) + wrapped + text.slice(end), start: start + length, end: end + length }\n }\n\n /**\n * The selection as a link to `address`; inside a link, its address changed, or (`address` empty) the link taken\n * off, its text kept.\n * - No selection outside a link: the address as its own text.\n */\n static link(edit: Edit, address: string): Edit {\n const { text } = edit\n const link = MarkdownFormats.linkAt(text, edit.start)\n if (link) {\n const replaced = address ? `[${link.words}](${address})` : link.words\n const start = link.start + (address ? 1 : 0)\n return {\n text: text.slice(0, link.start) + replaced + text.slice(link.end),\n start,\n end: start + link.words.length\n }\n }\n if (!address) return edit\n const words = text.slice(edit.start, edit.end) || address\n const linked = `[${words}](${address})`\n return {\n text: text.slice(0, edit.start) + linked + text.slice(edit.end),\n start: edit.start + 1,\n end: edit.start + 1 + words.length\n }\n }\n\n /** The link at `offset` in `text`: where it starts and ends, its words and its address; `undefined` for none. */\n static linkAt(text: string, offset: number): FoundLink | undefined {\n for (const match of text.matchAll(LINK)) {\n const start = match.index\n const end = start + match[0].length\n if (offset >= start && offset <= end) return { start, end, words: match[1]!, address: match[2]! }\n }\n return undefined\n }\n\n /** The selection (or, with none, all the text) without its marks: bold, italic, strikethrough, links. */\n static clear(edit: Edit): Edit {\n const whole = edit.start === edit.end\n const start = whole ? 0 : edit.start\n const end = whole ? edit.text.length : edit.end\n let part = edit.text.slice(start, end)\n part = part.replace(LINK, \"$1\").replace(STRONG, \"$1\").replace(STRUCK, \"$1\").replace(EMPHASIS, \"$1\")\n // the marks just outside the selection, when it's exactly a marked run's words\n const text = edit.text.slice(0, start) + part + edit.text.slice(end)\n let cleared: Edit = { text, start, end: start + part.length }\n for (const mark of WRAP_MARKS) {\n const inside = cleared.text.slice(cleared.start - mark.length, cleared.start) === mark\n if (!whole && inside && cleared.text.slice(cleared.end, cleared.end + mark.length) === mark)\n cleared = MarkdownFormats.toggle(cleared, mark)\n }\n return cleared\n }\n\n /** Which formats the cursor at `offset` is in: the box's buttons show them pressed. */\n static formatsAt(text: string, offset: number): Set<Format> {\n const formats = new Set<Format>()\n const inside = (pattern: RegExp, format: Format) => {\n for (const match of text.matchAll(pattern)) {\n if (offset > match.index && offset < match.index + match[0].length) formats.add(format)\n }\n }\n inside(STRONG, \"bold\")\n inside(EMPHASIS, \"italic\")\n inside(STRUCK, \"strikethrough\")\n inside(LINK, \"link\")\n return formats\n }\n\n ////////////////\n // ## Shapes\n ////////////////\n\n /**\n * The shape the piece at `place` has, from what its line starts with in `text`: `h2` for `## `, `bullet` for `- `.\n * - A table cell has none: `undefined`.\n */\n static shapeOf(text: string, place: MarkdownPlace): Shape | undefined {\n if (place.kind === \"cell\") return undefined\n const lead = text.slice(text.lastIndexOf(\"\\n\", place.start - 1) + 1, place.start)\n const heading = /^ {0,3}(#{1,6})[ \\t]/.exec(lead)\n if (heading) return `h${heading[1]!.length}` as Shape\n if (/^\\s*\\d{1,9}[.)][ \\t]/.test(lead)) return \"numbered\"\n if (/^\\s*[*+-][ \\t]/.test(lead)) return \"bullet\"\n return \"paragraph\"\n }\n\n /**\n * `text` with the piece at `place` given `raw` as its words and `shape` as its shape: its line's lead rewritten\n * (`## `, `- `), the indent before it kept.\n * - A heading is one line: line ends in `raw` become spaces.\n * - Returns the new text, and where the piece's words now start and end in it.\n */\n static reshape(\n text: string,\n place: MarkdownPlace,\n raw: string,\n shape: Shape\n ): { text: string; place: MarkdownPlace } {\n const lineStart = text.lastIndexOf(\"\\n\", place.start - 1) + 1\n const indent = /^\\s*/.exec(text.slice(lineStart, place.start))![0]\n const words = shape.startsWith(\"h\") ? raw.replace(/\\s*\\n\\s*/g, \" \").trim() : raw.replace(/\\s+$/, \"\")\n const lead = indent + SHAPE_LEADS[shape]\n const next = text.slice(0, lineStart) + lead + words + text.slice(place.end)\n const kind = shape === \"paragraph\" ? \"paragraph\" : shape.startsWith(\"h\") ? \"heading\" : \"item\"\n const start = lineStart + lead.length\n return { text: next, place: { kind, start, end: start + words.length } }\n }\n\n ////////////////\n // ## Views\n ////////////////\n\n /**\n * `text` cut into runs, for the faded-marks view: each mark its own run (`mark`), the words between marks\n * styled as the marks around them say.\n * - Runs join back into `text`, character for character.\n */\n static runsOf(text: string): Run[] {\n const runs: Run[] = []\n MarkdownFormats.cut(text, [], runs)\n return runs\n }\n\n /**\n * A formatted view's content written back as markdown: `<strong>` / `<b>` as `**`, `<em>` / `<i>` as `*`,\n * `<del>` / `<s>` / `<strike>` as `~~`, `<a href>` as a link, `<code>` in backticks, `<br>` a line end.\n * - Any other element: its text. A `*` or `\\` in text is escaped, so it stays text.\n */\n static markdownOf(node: Node): string {\n let out = \"\"\n for (const child of node.childNodes) {\n if (child.nodeType === TEXT_NODE) {\n out += (child.textContent ?? \"\").replace(/[\\\\*]/g, \"\\\\$&\")\n continue\n }\n if (child.nodeType !== ELEMENT_NODE) continue\n const element = child as Element\n const inner = MarkdownFormats.markdownOf(element)\n const name = element.localName\n if (name === \"br\") out += \"\\n\"\n else if (name === \"code\") out += `\\`${element.textContent ?? \"\"}\\``\n else if (name === \"a\") out += `[${inner}](${element.getAttribute(\"href\") ?? \"\"})`\n else if (HTML_MARKS[name] && inner.trim()) out += HTML_MARKS[name] + inner + HTML_MARKS[name]\n else out += inner\n }\n return out\n }\n\n ////////////////\n // ## Helpers: static, as they're pure\n ////////////////\n\n /** The word around `edit`'s cursor: letters, digits and marks' insides; the cursor itself between words. */\n private static wordAt({ text, start }: Edit): { start: number; end: number } {\n let from = start\n let to = start\n while (from > 0 && WORD_CHAR.test(text[from - 1]!)) from--\n while (to < text.length && WORD_CHAR.test(text[to]!)) to++\n return { start: from, end: to }\n }\n\n /** `***x***`: bold and italic both, so a `*` beside the selection's `**` is italic's. */\n private static isTriple(text: string, from: number, to: number): boolean {\n return text.slice(from - 3, from) === \"***\" && text.slice(to, to + 3) === \"***\"\n }\n\n /** Cut `text` into `runs`, inside the formats `within`: the first marked span found, then what's around it. */\n private static cut(text: string, within: Format[], runs: Run[]) {\n let earliest: { match: RegExpExecArray; format: Format; mark: string } | undefined\n for (const [pattern, format, mark] of RUN_PATTERNS) {\n pattern.lastIndex = 0\n const match = pattern.exec(text)\n if (match && (!earliest || match.index < earliest.match.index)) earliest = { match, format, mark }\n }\n if (!earliest) {\n if (text) runs.push({ text, formats: within, isMark: false })\n return\n }\n const { match, format, mark } = earliest\n // `**bold *both***`: the lazy match stops at italic's closing star; bold's own two come one later\n const singles = match[1]!.match(/(?<!\\*)\\*(?!\\*)/g)?.length ?? 0\n if (format === \"bold\" && singles % 2 && text[match.index + match[0].length] === \"*\") {\n match[1] += \"*\"\n match[0] += \"*\"\n }\n if (match.index) runs.push({ text: text.slice(0, match.index), formats: within, isMark: false })\n const inner = [...within, format]\n if (format === \"link\") {\n runs.push({ text: \"[\", formats: inner, isMark: true })\n MarkdownFormats.cut(match[1]!, inner, runs)\n runs.push({ text: `](${match[2]})`, formats: inner, isMark: true })\n } else {\n runs.push({ text: mark, formats: inner, isMark: true })\n MarkdownFormats.cut(match[1]!, inner, runs)\n runs.push({ text: mark, formats: inner, isMark: true })\n }\n MarkdownFormats.cut(text.slice(match.index + match[0].length), within, runs)\n }\n}\n\n/** The box's text and its selection: offsets into the text. */\nexport type Edit = {\n /** the text */\n text: string\n /** where the selection starts */\n start: number\n /** where it ends: `start` for a bare cursor */\n end: number\n}\n\n/** A mark put around words. */\nexport type WrapMark = \"**\" | \"*\" | \"~~\"\n\n/** A format the box's buttons put on, and show pressed. */\nexport type Format = \"bold\" | \"italic\" | \"strikethrough\" | \"link\"\n\n/** A piece's shape: what its line starts with. */\nexport type Shape = \"paragraph\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" | \"h1\" | \"bullet\" | \"numbered\"\n\n/** One run of `runsOf()`. */\nexport type Run = {\n /** its text */\n text: string\n /** the formats it's inside */\n formats: Format[]\n /** a mark (`**`, a link's brackets and address), drawn faint */\n isMark: boolean\n}\n\n/** A link in the text: `linkAt()`. */\nexport type FoundLink = { start: number; end: number; words: string; address: string }\n\n/** Each wrapping mark, longest first. */\nconst WRAP_MARKS: WrapMark[] = [\"**\", \"~~\", \"*\"]\n\n/** What each shape's line starts with. */\nconst SHAPE_LEADS: Record<Shape, string> = {\n paragraph: \"\",\n h1: \"# \",\n h2: \"## \",\n h3: \"### \",\n h4: \"#### \",\n h5: \"##### \",\n h6: \"###### \",\n bullet: \"- \",\n numbered: \"1. \"\n}\n\n/** A link: its words, its address. */\nconst LINK = /\\[([^\\]\\n]*)\\]\\(([^)\\s]*)\\)/g\n\n/** Bold: its words. */\nconst STRONG = /\\*\\*(?=\\S)([^\\n]*?\\S)\\*\\*/g\n\n/** Strikethrough: its words. */\nconst STRUCK = /~~(?=\\S)([^\\n]*?\\S)~~/g\n\n/** Italic: its words, a single `*` (never one of bold's). */\nconst EMPHASIS = /(?<!\\*)\\*(?=[^\\s*])([^\\n*]*?[^\\s*])\\*/g\n\n/** Each run's pattern, its format and its mark, for `runsOf()`. */\nconst RUN_PATTERNS: [RegExp, Format, string][] = [\n [new RegExp(LINK.source, \"g\"), \"link\", \"\"],\n [new RegExp(STRONG.source, \"g\"), \"bold\", \"**\"],\n [new RegExp(STRUCK.source, \"g\"), \"strikethrough\", \"~~\"],\n [new RegExp(EMPHASIS.source, \"g\"), \"italic\", \"*\"]\n]\n\n/** The marks an element of a formatted view is written back with. */\nconst HTML_MARKS: Record<string, string> = { strong: \"**\", b: \"**\", em: \"*\", i: \"*\", del: \"~~\", s: \"~~\", strike: \"~~\" }\n\n/** A character of a word, for a bare cursor's word. */\nconst WORD_CHAR = /[\\p{L}\\p{N}_'’-]/u\n\n/** `Node.TEXT_NODE`, without the DOM's globals (node runs this file's tests too). */\nconst TEXT_NODE = 3\n\n/** `Node.ELEMENT_NODE`. */\nconst ELEMENT_NODE = 1\n","import { MarkdownFormats, type Edit, type Format, type Shape, type WrapMark } from \"./MarkdownFormats\"\nimport type { MarkdownPlaceKind } from \"./UIMarkdown.types\"\n\n/****************\n * ### `MarkdownBox`\n * The box one piece of `<ui-markdown editable>` becomes while it's edited (epic `epic-engine` P60, P61), with the\n * formatting bar above it.\n * - Two VIEWS, a switch at the bar's end flipping between them (Owen's Q67; the faded marks first, J195):\n * - `marks`: its markdown as plain text, each mark (`**`, a link's address) faint, the words bold, italic or struck\n * as the marks say; what's seen is exactly what's saved\n * - `formatted`: bold, italic, struck and links drawn, no marks, as a word processor; written back as markdown\n * as it's kept (`MarkdownFormats.markdownOf()`). A piece that wouldn't come back exactly (raw HTML, an escaped\n * mark) stays in `marks`, and the switch's tooltip says why.\n * - The bar: bold, italic, strikethrough, link, the piece's shape (Paragraph, H2-H4, bulleted, numbered), clear\n * formatting, then the switch. Placed by CSS anchor positioning just above the box (below it near the window's\n * top): it never moves the page. Its buttons never take the focus, so the cursor and selection stay.\n * - Keys: ⌘B, ⌘I, ⌘K, ⌘⇧X (Ctrl elsewhere), stopped so the window's own (VS Code's) never see them; never ⌘E,\n * Claude Code's.\n * - Plain DOM, no Solid: the box lives inside the rendered article, which the element patches by hand.\n * Its owner, `UIMarkdown`, keeps and saves what it holds.\n ****************/\nexport class MarkdownBox {\n /** The editable box, in place of the piece's own content. */\n readonly field: HTMLElement\n\n /** The formatting bar, in the element's shadow root. */\n readonly bar: HTMLElement\n\n /** The view it shows. */\n view: BoxView\n\n /** The piece's shape now: `undefined` for a table cell, which has none. */\n shape: Shape | undefined\n\n /** Why the formatted view can't show this piece, when it can't. */\n private readonly unformattable: string | undefined\n\n /** The bar's buttons, by what they do. */\n private readonly buttons = new Map<BarAction, HTMLElement>()\n\n /** The shape menu: Spell UI's `<ui-select>`, so it looks as every dropdown on the page does (Owen's C1 on J196). */\n private readonly shapes: HTMLElement\n\n /** The link's address field, while it's asked for. */\n private readonly address: HTMLInputElement\n\n /** The selection the link's address is for, while it's asked. */\n private linkFor: Edit | undefined\n\n constructor(private readonly props: BoxProps) {\n const { document } = props\n this.shape = props.shape\n const isExact = !!props.renderInline && MarkdownBox.comesBack(props.raw, props.renderInline, document)\n this.unformattable = isExact ? undefined : props.texts(props.renderInline ? \"formattedOff\" : \"noFormattedView\")\n this.view = props.view === \"formatted\" && !this.unformattable ? \"formatted\" : \"marks\"\n this.field = document.createElement(\"span\")\n this.field.setAttribute(\"role\", \"textbox\")\n this.field.setAttribute(\"aria-label\", props.label)\n this.field.setAttribute(\"part\", props.parts.box)\n if (props.kind === \"paragraph\") this.field.setAttribute(\"aria-multiline\", \"true\")\n this.field.addEventListener(\"keydown\", this.onKey)\n this.field.addEventListener(\"input\", this.onInput)\n this.field.addEventListener(\"paste\", this.onPaste)\n this.field.addEventListener(\"focusout\", props.onLeave)\n this.field.ownerDocument.addEventListener(\"selectionchange\", this.onSelectionChange)\n this.shapes = document.createElement(\"ui-select\")\n this.address = document.createElement(\"input\")\n this.bar = this.drawBar()\n this.draw(props.raw)\n }\n\n ////////////////\n // ## Its text\n ////////////////\n\n /** The markdown it holds now. */\n get raw(): string {\n if (this.view === \"formatted\") return MarkdownFormats.markdownOf(this.field).replace(/\\n$/, \"\")\n return (this.field.textContent ?? \"\").replace(/\\n$/, \"\")\n }\n\n /** Hold `text` instead (Escape's), the cursor at its end. */\n set raw(text: string) {\n this.draw(text)\n this.caret = text.length\n }\n\n /** The cursor and selection, as offsets into the text it shows; `undefined` when it's not in the box. */\n get selection(): { start: number; end: number } | undefined {\n const range = MarkdownBox.rangeIn(this.field)\n if (!range) return undefined\n return {\n start: this.offsetOf(range.startContainer, range.startOffset),\n end: this.offsetOf(range.endContainer, range.endOffset)\n }\n }\n\n /** Put the cursor `offset` characters into the text it shows. */\n set caret(offset: number) {\n this.select(offset, offset)\n }\n\n /** Focus the box, the cursor `offset` characters in (the end when not given). */\n focus(offset?: number) {\n this.field.focus()\n this.caret = offset ?? (this.field.textContent ?? \"\").length\n this.showPressed()\n }\n\n /** Take the box and its bar off the page; the owner puts the piece back. */\n remove() {\n this.field.ownerDocument.removeEventListener(\"selectionchange\", this.onSelectionChange)\n this.field.removeEventListener(\"focusout\", this.props.onLeave)\n this.bar.remove()\n }\n\n ////////////////\n // ## Formatting\n ////////////////\n\n /** Do `action`, from the bar or a key. */\n act(action: BarAction) {\n if (action === \"view\") return this.switchView()\n if (action === \"link\") return this.askAddress()\n if (action === \"bullet\" || action === \"numbered\") return this.reshape(this.shape === action ? \"paragraph\" : action)\n if (this.view === \"formatted\") {\n this.field.ownerDocument.execCommand(FORMATTED_COMMANDS[action])\n if (action === \"clear\") this.field.ownerDocument.execCommand(\"unlink\")\n } else {\n const edit = this.edit()\n this.apply(action === \"clear\" ? MarkdownFormats.clear(edit) : MarkdownFormats.toggle(edit, WRAPS[action]))\n }\n this.changed()\n }\n\n /** Give the piece `shape`: its line's lead changes as it's kept (`MarkdownFormats.reshape()`). */\n reshape(shape: Shape) {\n if (!this.shape) return\n this.shape = shape\n this.shapes.setAttribute(\"value\", shape.startsWith(\"h\") ? shape : \"paragraph\")\n this.changed()\n }\n\n /** Flip between the two views, keeping the text; the choice is told to the owner, to remember. */\n private switchView() {\n if (this.unformattable) return\n const raw = this.raw\n this.view = this.view === \"marks\" ? \"formatted\" : \"marks\"\n this.draw(raw)\n this.field.focus()\n this.caret = (this.field.textContent ?? \"\").length\n this.props.onView(this.view)\n this.showPressed()\n }\n\n /** Ask for the link's address in the bar, for the selection now; Enter puts it on, Escape goes back. */\n private askAddress() {\n const edit = this.edit()\n this.linkFor = edit\n const link = this.view === \"marks\" ? MarkdownFormats.linkAt(edit.text, edit.start) : undefined\n const anchor =\n this.view === \"formatted\"\n ? MarkdownBox.rangeIn(this.field)?.startContainer.parentElement?.closest(\"a\")\n : undefined\n this.address.value = link?.address ?? anchor?.getAttribute(\"href\") ?? \"\"\n this.address.hidden = false\n this.address.focus()\n this.address.select()\n }\n\n /** The link's address field's keys: Enter puts the link on (an empty address takes it off), Escape goes back. */\n private readonly onAddressKey = (event: KeyboardEvent) => {\n event.stopPropagation()\n if (event.key !== \"Enter\" && event.key !== \"Escape\") return\n event.preventDefault()\n const edit = this.linkFor\n this.linkFor = undefined\n this.address.hidden = true\n this.field.focus()\n if (!edit) return\n if (event.key === \"Escape\") return this.select(edit.start, edit.end)\n const address = this.address.value.trim()\n if (this.view === \"formatted\") {\n this.select(edit.start, edit.end)\n this.field.ownerDocument.execCommand(address ? \"createLink\" : \"unlink\", false, address)\n } else this.apply(MarkdownFormats.link(edit, address))\n this.changed()\n }\n\n ////////////////\n // ## Keys and typing\n ////////////////\n\n /**\n * The formatting keys: ⌘B bold, ⌘I italic, ⌘K link, ⌘⇧X strikethrough; stopped and prevented, so neither the\n * page nor the window acts on them. The owner's own keys (Enter, Tab, Escape) go on to it.\n */\n private readonly onKey = (event: KeyboardEvent) => {\n const isCommand = event.metaKey || event.ctrlKey\n const action =\n isCommand && !event.altKey ? KEY_ACTIONS[`${event.shiftKey ? \"shift+\" : \"\"}${event.code}`] : undefined\n if (action) {\n event.preventDefault()\n event.stopPropagation()\n return this.act(action)\n }\n // a new line in a paragraph: a line end in its text, in either view\n if (event.key === \"Enter\" && event.shiftKey && this.props.kind === \"paragraph\") {\n event.preventDefault()\n event.stopPropagation()\n this.field.ownerDocument.execCommand(\"insertText\", false, \"\\n\")\n return\n }\n this.props.onKey(event)\n }\n\n /** Each key: the marks view drawn again (the cursor kept), and the owner told. */\n private readonly onInput = (event: Event) => {\n if (this.view === \"marks\" && !(event as InputEvent).isComposing) {\n const at = this.selection\n this.draw(this.field.textContent ?? \"\")\n if (at) this.select(at.start, at.end)\n }\n this.props.onInput()\n this.showPressed()\n }\n\n /** Pasting is plain text, in either view. */\n private readonly onPaste = (event: ClipboardEvent) => {\n event.preventDefault()\n const text = event.clipboardData?.getData(\"text/plain\") ?? \"\"\n this.field.ownerDocument.execCommand(\"insertText\", false, text)\n }\n\n /** The cursor moved: the bar's buttons show the formats it's in. */\n private readonly onSelectionChange = () => {\n if (this.field.isConnected) this.showPressed()\n }\n\n /** What changed by the bar or a key is like a key: the owner told, the bar redrawn. */\n private changed() {\n this.props.onInput()\n this.showPressed()\n }\n\n ////////////////\n // ## Drawing\n ////////////////\n\n /** Draw `raw` as the view says: marks faint, or formatted. */\n private draw(raw: string) {\n const document = this.field.ownerDocument\n this.field.contentEditable = this.view === \"marks\" ? \"plaintext-only\" : \"true\"\n this.field.dataset.view = this.view\n if (this.view === \"formatted\") {\n this.field.innerHTML = this.props.renderInline!(raw)\n return\n }\n this.field.replaceChildren(\n ...MarkdownFormats.runsOf(raw).map((run) => {\n if (!run.isMark && !run.formats.length) return document.createTextNode(run.text)\n const span = document.createElement(\"span\")\n span.className = [run.isMark ? \"md-mark\" : \"\", ...run.formats.map((format) => `md-${format}`)].join(\" \").trim()\n span.textContent = run.text\n return span\n })\n )\n }\n\n /** The bar: its buttons, the shape menu, the link's address field, the switch. */\n private drawBar(): HTMLElement {\n const { document, texts, parts } = this.props\n const bar = document.createElement(\"span\")\n bar.setAttribute(\"part\", parts.bar)\n bar.setAttribute(\"role\", \"toolbar\")\n // a popover the owner shows: the top layer, so nothing on the page (a stuck title) covers it\n bar.popover = \"manual\"\n bar.setAttribute(\"aria-label\", texts(\"formatBar\"))\n // a press never takes the focus from the box: its cursor and selection stay (the menu and field excepted)\n bar.addEventListener(\"mousedown\", (event) => {\n if (!event.composedPath().includes(this.shapes) && event.target !== this.address) event.preventDefault()\n })\n for (const action of BAR_ACTIONS) {\n if (action === \"shape\") {\n if (this.shape) bar.append(this.drawShapes())\n continue\n }\n if ((action === \"bullet\" || action === \"numbered\") && !this.shape) continue\n const button = document.createElement(\"ui-button\")\n button.setAttribute(\"appearance\", \"basic\")\n button.setAttribute(\"size\", \"small\")\n button.setAttribute(\"icon\", ICONS[action])\n const tip = action === \"view\" && this.unformattable ? this.unformattable : texts(action)\n button.setAttribute(\"title\", tip)\n button.setAttribute(\"aria-label\", tip)\n if (action === \"view\" && this.unformattable) button.setAttribute(\"disabled\", \"\")\n button.addEventListener(\"click\", () => this.act(action))\n this.buttons.set(action, button)\n bar.append(button)\n }\n this.address.type = \"url\"\n this.address.hidden = true\n this.address.placeholder = texts(\"linkAddress\")\n this.address.setAttribute(\"aria-label\", texts(\"linkAddress\"))\n this.address.addEventListener(\"keydown\", this.onAddressKey)\n bar.append(this.address)\n return bar\n }\n\n /** The shape menu: Paragraph, H2, H3, H4 (a list is the list buttons'). */\n private drawShapes(): HTMLElement {\n const { document, texts } = this.props\n for (const shape of MENU_SHAPES) {\n const item = document.createElement(\"ui-item\")\n item.setAttribute(\"value\", shape)\n item.textContent = texts(SHAPE_TEXTS[shape as MenuShape])\n this.shapes.append(item)\n }\n this.shapes.setAttribute(\"size\", \"small\")\n // its menu opens on the bar's own ground: a theme's see-through surface let the page show through. Set on the\n // element, as a page sets a component's token: a component's sheet never declares another's (epic `epic-engine` r55)\n this.shapes.style.setProperty(\"--ui-select-picker-background\", \"var(--_ui-markdown-bar-background)\")\n this.shapes.setAttribute(\"value\", this.shape?.startsWith(\"h\") ? this.shape : \"paragraph\")\n this.shapes.setAttribute(\"aria-label\", texts(\"shape\"))\n this.shapes.title = texts(\"shape\")\n this.shapes.addEventListener(\"ui-changed\", (event) => {\n const { value } = (event as CustomEvent<{ value: string }>).detail\n if (value === this.shape) return\n this.reshape(value as Shape)\n this.field.focus()\n })\n return this.shapes\n }\n\n /** The bar's buttons pressed for the formats the cursor is in, the list buttons for the shape, the switch for the view. */\n private showPressed() {\n const formats = this.formatsNow()\n for (const [action, button] of this.buttons) {\n const isOn =\n action === \"view\"\n ? this.view === \"formatted\"\n : action === \"bullet\" || action === \"numbered\"\n ? this.shape === action\n : formats.has(action as Format)\n button.toggleAttribute(\"active\", isOn)\n }\n }\n\n /** The formats the cursor is in now, as either view knows them. */\n private formatsNow(): Set<Format> {\n if (this.view === \"marks\") {\n const at = this.selection\n return at ? MarkdownFormats.formatsAt(this.field.textContent ?? \"\", at.start) : new Set()\n }\n const document = this.field.ownerDocument\n const formats = new Set<Format>()\n for (const [format, command] of Object.entries(FORMAT_STATES) as [Format, string][]) {\n if (command && document.queryCommandState(command)) formats.add(format)\n }\n const node = MarkdownBox.rangeIn(this.field)?.startContainer\n if ((node?.nodeType === 1 ? (node as Element) : node?.parentElement)?.closest(\"a\")) formats.add(\"link\")\n return formats\n }\n\n ////////////////\n // ## Selection\n ////////////////\n\n /** The text the marks view shows and its selection, for a format. */\n private edit(): Edit {\n const text = this.field.textContent ?? \"\"\n const at = this.selection ?? { start: text.length, end: text.length }\n return { text, ...at }\n }\n\n /** Show `edit`'s text in the marks view, its selection selected. */\n private apply(edit: Edit) {\n this.draw(edit.text)\n this.select(edit.start, edit.end)\n }\n\n /** Select from `start` to `end`, offsets into the text it shows. */\n private select(start: number, end: number) {\n const [startNode, startOffset] = this.pointAt(start)\n const [endNode, endOffset] = this.pointAt(end)\n const selection = this.field.ownerDocument.getSelection()\n selection?.setBaseAndExtent(startNode, startOffset, endNode, endOffset)\n }\n\n /** The DOM point `offset` characters into the box's text. */\n private pointAt(offset: number): [Node, number] {\n const walker = this.field.ownerDocument.createTreeWalker(this.field, NodeFilter.SHOW_TEXT)\n let left = offset\n let last: Text | undefined\n for (let node = walker.nextNode() as Text | null; node; node = walker.nextNode() as Text | null) {\n if (left <= node.data.length) return [node, left]\n left -= node.data.length\n last = node\n }\n return last ? [last, last.data.length] : [this.field, this.field.childNodes.length]\n }\n\n /** How many characters of the box's text come before `node` at `offset`. */\n private offsetOf(node: Node, offset: number): number {\n const before = this.field.ownerDocument.createRange()\n before.setStart(this.field, 0)\n before.setEnd(node, offset)\n return before.toString().length\n }\n\n ////////////////\n // ## Helpers: static, as they're pure\n ////////////////\n\n /** The selection's range, when it's inside `field` (its shadow root's own, where the browser has one). */\n private static rangeIn(field: HTMLElement): Range | undefined {\n const root = field.getRootNode() as ShadowRoot & { getSelection?: () => Selection | null }\n const selection = root.getSelection?.() ?? field.ownerDocument.getSelection()\n if (!selection?.rangeCount) return undefined\n const range = selection.getRangeAt(0)\n return field.contains(range.startContainer) ? range : undefined\n }\n\n /**\n * Does `raw`, shown formatted and written back, come back as the same text? Not with raw HTML, an escaped mark,\n * or `_x_` (written back `*x*`): then it stays in the marks view.\n */\n private static comesBack(raw: string, renderInline: (text: string) => string, document: Document): boolean {\n const holder = document.createElement(\"span\")\n holder.innerHTML = renderInline(raw)\n return MarkdownFormats.markdownOf(holder) === raw\n }\n}\n\n/** What the box is made with. */\nexport type BoxProps = {\n /** the page */\n document: Document\n /** the piece's kind */\n kind: MarkdownPlaceKind\n /** its markdown */\n raw: string\n /** its shape: `undefined` for a table cell */\n shape: Shape | undefined\n /** the box's accessible name */\n label: string\n /** the part names, as the element's vocabulary says them */\n parts: { box: string; bar: string }\n /** the element's texts, by key */\n texts: (key: string) => string\n /** the view last chosen in this browser */\n view: BoxView\n /** the engine's inline render: the formatted view; none, only the marks view */\n renderInline?: (text: string) => string\n /** a key the box doesn't take: the owner's (Enter, Tab, Escape, Home, End) */\n onKey: (event: KeyboardEvent) => void\n /** the text changed */\n onInput: () => void\n /** the focus left the box */\n onLeave: (event: FocusEvent) => void\n /** the view was switched: to remember */\n onView: (view: BoxView) => void\n}\n\n/** The box's two views: its markdown with the marks faint, or formatted only. */\nexport type BoxView = \"marks\" | \"formatted\"\n\n/** What the bar does, in its order. */\nexport type BarAction =\n | \"bold\"\n | \"italic\"\n | \"strikethrough\"\n | \"link\"\n | \"shape\"\n | \"bullet\"\n | \"numbered\"\n | \"clear\"\n | \"view\"\n\n/** The bar's actions, in its order. */\nconst BAR_ACTIONS: BarAction[] = [\n \"bold\",\n \"italic\",\n \"strikethrough\",\n \"link\",\n \"shape\",\n \"bullet\",\n \"numbered\",\n \"clear\",\n \"view\"\n]\n\n/** The shape menu's shapes. */\nconst MENU_SHAPES = [\"paragraph\", \"h2\", \"h3\", \"h4\"] as const\n\n/** One of `MENU_SHAPES`. */\ntype MenuShape = (typeof MENU_SHAPES)[number]\n\n/** Each menu shape's text key. */\nconst SHAPE_TEXTS: Record<MenuShape, string> = {\n paragraph: \"shapeParagraph\",\n h2: \"shapeH2\",\n h3: \"shapeH3\",\n h4: \"shapeH4\"\n}\n\n/** Each button's icon. */\nconst ICONS: Record<Exclude<BarAction, \"shape\">, string> = {\n bold: \"bold\",\n italic: \"italic\",\n strikethrough: \"strikethrough\",\n link: \"link\",\n bullet: \"list ul\",\n numbered: \"list ol\",\n clear: \"eraser\",\n view: \"eye\"\n}\n\n/** The mark each wrapping format puts on, in the marks view. */\nconst WRAPS: Record<string, WrapMark> = { bold: \"**\", italic: \"*\", strikethrough: \"~~\" }\n\n/** The editing command each format is in the formatted view. */\nconst FORMATTED_COMMANDS: Record<string, string> = {\n bold: \"bold\",\n italic: \"italic\",\n strikethrough: \"strikeThrough\",\n clear: \"removeFormat\"\n}\n\n/** The command whose state says the cursor is in each format, in the formatted view; a link is its `<a>`. */\nconst FORMAT_STATES: Record<Format, string> = {\n bold: \"bold\",\n italic: \"italic\",\n strikethrough: \"strikeThrough\",\n link: \"\"\n}\n\n/** The formatting keys, by `KeyboardEvent.code` (Shift first): never `KeyE`, Claude Code's. */\nconst KEY_ACTIONS: Record<string, BarAction> = {\n KeyB: \"bold\",\n KeyI: \"italic\",\n KeyK: \"link\",\n \"shift+KeyX\": \"strikethrough\"\n}\n","import { E } from \"spell/ui/core\"\nimport type { MarkdownEngine } from \"./MarkdownEngine\"\nimport type { MarkdownSanitizer } from \"./MarkdownSanitizer\"\n\n/****************\n * ### `MarkdownRenderer`\n * What `<ui-markdown>` asks to render: loads an engine on first use, each in its own lazy chunk.\n * - `load()`: marked (`MarkdownEngine`), what every `<ui-markdown>` draws with, `editable`'s preview too.\n * - A subclass may draw with an engine of its own (`UIMarkdown.loadEngine()`):\n * the app's `<spell-markdown>` draws with spell's.\n * - `loadSanitizer()`: DOMPurify (`MarkdownSanitizer`), only for `sanitized`.\n * - The element only knows `render(text, options) -> { html, headings }` (`MarkdownRendering`).\n * - Static: the loads are page-wide, started once and shared by every `<ui-markdown>`;\n * the loaders are swapped page-wide too.\n ****************/\nexport class MarkdownRenderer {\n /**\n * Imports the engine module; read once, on the first render.\n * - Replaceable, e.g. by a bundle that can't keep `import()`s\n * (the docs' classic script loads it as a script of its own).\n */\n static engineLoader: () => Promise<{ MarkdownEngine: { instance: MarkdownEngine } }> = () =>\n import(\"./MarkdownEngine\")\n\n /**\n * Imports `MarkdownSanitizer`.\n * - Replaceable as `engineLoader` (the docs' classic script loads it as a script of its own).\n */\n static sanitizerLoader: () => Promise<{ MarkdownSanitizer: { instance: MarkdownSanitizer } }> = () =>\n import(\"./MarkdownSanitizer\")\n\n /** marked, loaded on first use; the import starts once. */\n @E.once static load(): Promise<MarkdownEngine> {\n return MarkdownRenderer.engineLoader().then((module) => module.MarkdownEngine.instance)\n }\n\n /** DOMPurify, loaded on first use; the import starts once. */\n @E.once static loadSanitizer(): Promise<MarkdownSanitizer> {\n return MarkdownRenderer.sanitizerLoader().then((module) => module.MarkdownSanitizer.instance)\n }\n}\n","import type { Token, Tokens } from \"marked\"\n\nimport type { MarkdownPlace, MarkdownPlaceKind } from \"./UIMarkdown.types\"\n\n/****************\n * ### `MarkdownSource`\n * Where each piece `<ui-markdown editable>` lets you edit sits in its markdown, and how new text goes back in.\n * - A PLACE is one piece's own text: a paragraph, a heading's words after its `#`s, a list item's own line, a table\n * cell's text between its pipes; its `start` and `end` are offsets into the markdown.\n * - `placesOf()`: the places of marked's tokens, each token marked with its place's number (`placeOf()`), so the\n * engine draws it on the element it renders (`data-ui-place`).\n * - `replace()`: the markdown with one place's text swapped, every other byte as it was.\n * - Left out (no place): blockquotes, code, HTML blocks; a list item holding more than its line and nested lists;\n * a nested list item over several lines. They stay as they are, and aren't editable in place.\n * - Pure: no DOM, and only marked's TYPES, so the engine (built alone into a classic script) and the element both\n * carry it.\n ****************/\nexport class MarkdownSource {\n /**\n * The places of `tokens` (marked's, lexed from `text`), in reading order; each placed token is marked with its\n * number (`placeOf()`).\n * - A token whose `raw` isn't found in `text` stops the walk: the places before it stand, none after\n * (text marked lexed differently from what it was given, e.g. `\\r\\n`).\n */\n static placesOf(tokens: readonly Token[], text: string): MarkdownPlace[] {\n const places: MarkdownPlace[] = []\n const add: AddPlace = (token, kind, start, end) => {\n ;(token as Placed)[PLACE_KEY] = places.length\n places.push({ kind, start, end })\n }\n let at = 0\n for (const token of tokens) {\n const start = text.startsWith(token.raw, at) ? at : text.indexOf(token.raw, at)\n if (start < 0) break\n MarkdownSource.visit(token, text, start, add)\n at = start + token.raw.length\n }\n return places\n }\n\n /** The number of the place `token` was marked with by `placesOf()`; `undefined` for none. */\n static placeOf(token: object): number | undefined {\n return (token as Placed)[PLACE_KEY]\n }\n\n /**\n * `text` with `place`'s text swapped for `raw`.\n * - A table cell or a heading is one line: line ends in `raw` become spaces.\n * A cell's unescaped `|` is escaped, so the row keeps its columns.\n * - A list item's own text is one line too.\n */\n static replace(text: string, place: MarkdownPlace, raw: string): string {\n const oneLine = place.kind === \"paragraph\" ? raw.replace(/\\s+$/, \"\") : raw.replace(/\\s*\\n\\s*/g, \" \").trim()\n const fitted = place.kind === \"cell\" ? oneLine.replace(UNESCAPED_PIPE, \"\\\\|\") : oneLine\n return text.slice(0, place.start) + fitted + text.slice(place.end)\n }\n\n ////////////////\n // ## Each kind of block\n ////////////////\n\n /** Add the places of `token`, which starts at `start` in `text`. */\n private static visit(token: Token, text: string, start: number, add: AddPlace) {\n if (token.type === \"paragraph\") MarkdownSource.paragraph(token as Tokens.Paragraph, start, add)\n else if (token.type === \"heading\") MarkdownSource.heading(token as Tokens.Heading, start, add)\n else if (token.type === \"table\") MarkdownSource.table(token as Tokens.Table, start, add)\n else if (token.type === \"list\")\n MarkdownSource.list(token as Tokens.List, text, start, start + token.raw.length, add)\n }\n\n /** A paragraph: its raw text, without the space around it. */\n private static paragraph(token: Tokens.Paragraph, start: number, add: AddPlace) {\n const { from, to } = MarkdownSource.trimmed(token.raw)\n if (to > from) add(token, \"paragraph\", start + from, start + to)\n }\n\n /** A heading: an ATX one's words after its `#`s (without closing `#`s), a setext one's line(s) above its rule. */\n private static heading(token: Tokens.Heading, start: number, add: AddPlace) {\n const atx = ATX_HEADING.exec(token.raw.split(\"\\n\")[0]!)\n if (atx) {\n const words = atx[2]!\n if (words) add(token, \"heading\", start + atx[1]!.length, start + atx[1]!.length + words.length)\n return\n }\n const rule = SETEXT_RULE.exec(token.raw)\n if (!rule) return\n const { from, to } = MarkdownSource.trimmed(token.raw.slice(0, rule.index))\n if (to > from) add(token, \"heading\", start + from, start + to)\n }\n\n /** A table: each cell's text, between its pipes; the delimiter row has none. */\n private static table(token: Tokens.Table, start: number, add: AddPlace) {\n const lines = MarkdownSource.linesOf(token.raw)\n const rows = [token.header, null, ...token.rows]\n for (const [index, line] of lines.entries()) {\n const cells = rows[index]\n if (!cells) continue\n for (const [column, cell] of MarkdownSource.cellsOf(line.text).entries()) {\n const token = cells[column]\n if (token) add(token, \"cell\", start + line.start + cell.from, start + line.start + cell.to)\n }\n }\n }\n\n /**\n * A list's items between `from` and `to` in `text`: each item's own line, after its marker (and task box);\n * its nested lists in turn.\n * - An item is found by its first line: a nested list's tokens are its text without the indent.\n */\n private static list(token: Tokens.List, text: string, from: number, to: number, add: AddPlace) {\n let at = from\n for (const item of token.items) {\n const firstLine = item.raw.split(\"\\n\")[0]!.trim()\n const itemStart = text.indexOf(firstLine, at)\n if (itemStart < 0 || itemStart >= to) return\n at = itemStart + firstLine.length\n // a task item's box is a token of its own (`checkbox`), drawn before its text\n const blocks = item.tokens.filter((block) => block.type !== \"space\" && block.type !== \"checkbox\")\n const [own, ...rest] = blocks\n const marker = LIST_MARKER.exec(firstLine)\n const isOneLine = !!own && !own.raw.trim().includes(\"\\n\")\n const holdsOnlyLists = rest.every((block) => block.type === \"list\")\n if (marker && isOneLine && holdsOnlyLists && (own.type === \"text\" || own.type === \"paragraph\")) {\n const words = firstLine.slice(marker[0].length).replace(/\\s+$/, \"\")\n if (words) add(item, \"item\", itemStart + marker[0].length, itemStart + marker[0].length + words.length)\n }\n for (const nested of rest) {\n if (nested.type !== \"list\") break\n MarkdownSource.list(nested as Tokens.List, text, at, to, add)\n }\n }\n }\n\n ////////////////\n // ## Helpers\n ////////////////\n\n /** Where `raw`'s text starts and ends, without the space around it. */\n private static trimmed(raw: string): { from: number; to: number } {\n const from = raw.length - raw.trimStart().length\n return { from, to: raw.trimEnd().length }\n }\n\n /** `raw`'s non-blank lines, each with where it starts in `raw`. */\n private static linesOf(raw: string): { text: string; start: number }[] {\n const lines: { text: string; start: number }[] = []\n let start = 0\n for (const text of raw.split(\"\\n\")) {\n if (text.trim()) lines.push({ text, start })\n start += text.length + 1\n }\n return lines\n }\n\n /**\n * A table row's cells: where each one's text starts and ends in `line`, without the space around it.\n * - Split at every `|` but an escaped one (`\\|`), as GitHub does, inside code spans too.\n * - A leading or trailing `|` opens or closes the row: no cell before or after it.\n */\n private static cellsOf(line: string): { from: number; to: number }[] {\n const pipes: number[] = []\n for (let index = 0; index < line.length; index++) {\n if (line[index] === \"\\\\\") index++\n else if (line[index] === \"|\") pipes.push(index)\n }\n const bounds = [-1, ...pipes, line.length]\n const cells: { from: number; to: number }[] = []\n for (let index = 0; index < bounds.length - 1; index++) {\n const from = bounds[index]! + 1\n const to = bounds[index + 1]!\n const cell = line.slice(from, to)\n const isEdge = (index === 0 || index === bounds.length - 2) && !cell.trim() && pipes.length\n if (isEdge) continue\n const lead = cell.length - cell.trimStart().length\n const words = cell.trim().length\n // an empty cell: its text goes after one space, so `| |` becomes `| x |`\n cells.push(\n words\n ? { from: from + lead, to: from + lead + words }\n : { from: from + Math.min(1, cell.length), to: from + Math.min(1, cell.length) }\n )\n }\n return cells\n }\n}\n\n/** What `placesOf()` hands each kind of block, to add a place. */\ntype AddPlace = (token: object, kind: MarkdownPlaceKind, start: number, end: number) => void\n\n/** A token marked with its place's number. */\ntype Placed = { [PLACE_KEY]?: number }\n\n/** The key a token's place number is kept under. */\nconst PLACE_KEY = \"uiPlace\"\n\n/** An ATX heading's line: its `#`s and the space after them, then its words, before any closing `#`s. */\nconst ATX_HEADING = /^( {0,3}#{1,6}(?:[ \\t]+|$))(.*?)(?:[ \\t]+#+)?[ \\t]*$/\n\n/** A setext heading's rule, under its words. */\nconst SETEXT_RULE = /\\n {0,3}(?:=+|-+)[ \\t]*\\n*$/\n\n/** A list item's marker, and its task box: `- `, `12. `, `- [x] `. */\nconst LIST_MARKER = /^(?:[*+-]|\\d{1,9}[.)])[ \\t]+(?:\\[[ xX]\\][ \\t]+)?/\n\n/** A `|` not escaped already. */\nconst UNESCAPED_PIPE = /(?<!\\\\)\\|/g\n","/**\n * The English vocabulary of `<ui-markdown>`: every name the tag uses.\n * - Its tag, attributes (each with its kind and allowed values), events, slots, parts, states and texts.\n * The shape is `E.ComponentVocabulary` (`spell/ui/vocabulary`).\n * - The source pieces (`source`, `load`, `ui-loaded` ... `ui-error`, the loader and error parts, the states and texts)\n * are shared with `<ui-include>` and `<ui-code>`: `UIT.Source*`, which `LoadableComponent` reads.\n */\n\nimport type { E } from \"spell/ui/core\"\nimport * as UIT from \"spell/ui/components/components.types\"\n\n/****************\n * ### `markdownVocabulary`\n * The names of `<ui-markdown>`, GitHub-flavoured markdown rendered:\n * the element's own text or a `source` file, its code blocks as `<ui-code>`;\n * `sanitized` runs it through DOMPurify; `editable` edits its text where it's drawn (⌥-click),\n * `editable=\"tabs\"` adds Write / Preview tabs.\n ****************/\nexport const markdownVocabulary = {\n tag: \"ui-markdown\",\n icon: \"markdown\",\n topics: [\"text\", \"typography\", \"data display\"],\n aka: [\"markdown\", \"md\", \"gfm\", \"readme\", \"rich text\", \"prose\"],\n skeleton: \"header, 4 line paragraph\",\n noun: \"markdown\",\n description:\n \"Markdown renders GitHub-flavoured markdown -- tables, task lists, code blocks -- from the element's own text or a file on this site.\",\n attributes: [\n ...UIT.SourceAttributes,\n {\n name: \"size\",\n group: \"appearance\",\n kind: \"size\",\n description: \"Text size, as Fomantic's sizes; default `medium`.\"\n },\n {\n name: \"breaks\",\n group: \"appearance\",\n kind: \"boolean\",\n description: \"A single newline is a line break, as in GitHub comments; default off, as in GitHub files.\"\n },\n {\n name: \"heading-offset\",\n group: \"appearance\",\n kind: \"number\",\n property: \"headingLevelOffset\",\n default: 0,\n description:\n \"Levels to shift headings by, e.g. `1`: `#` becomes `<h2>`, to sit under the page's own heading. Property \" +\n \"`headingLevelOffset`: `headingOffset` is WebKit's native `headingoffset`.\"\n },\n {\n name: \"skip-title\",\n group: \"behaviour\",\n kind: \"boolean\",\n description:\n \"Drop the text's leading `#` title (an `h1` first thing in the text), e.g. when the page shows its own \" +\n \"headline above a README. The text itself is unchanged: `content`, `save()` and the editor keep it.\"\n },\n {\n name: \"editable\",\n group: \"behaviour\",\n kind: \"keyOrValueAndKey\",\n values: [\"tabs\"],\n description:\n \"Edit the text where it's drawn: ⌥-click (Alt-click) a paragraph, a heading, a list item or a table cell, \" +\n \"and it becomes a box holding its markdown; Enter or a click away keeps it, Tab moves to the next, Escape \" +\n \"puts it back, and 5 seconds without typing keeps it too. Holding ⌥ outlines what can be edited. \" +\n '`editable=\"tabs\"`: Write / Preview tabs instead, a text box for the whole markdown and its preview. ' +\n \"Each edit is a `ui-changed`, and `save()` writes it: in place, each edit is saved as it's kept.\"\n },\n {\n name: \"sanitized\",\n group: \"advanced\",\n kind: \"boolean\",\n description:\n \"Sanitize the rendered markup with DOMPurify (its own lazy chunk, loaded only then): no scripts, event \" +\n \"handlers or `javascript:` links. Set it for text you didn't write; without it, raw HTML is kept as written.\"\n }\n ],\n events: [\n ...UIT.SourceEvents,\n {\n name: \"ui-drawn\",\n detail: \"{ headings: { level: number, text: string, id: string }[] }\",\n description:\n \"Rendered; `headings` (also the `headings` property) lists its headings, e.g. for a table of contents.\"\n }\n ],\n slots: [],\n parts: [\n ...UIT.SourceParts,\n { name: \"body\", description: \"The `<article>` holding the rendered markdown.\" },\n { name: \"tabs\", description: '`editable=\"tabs\"`: the Write / Preview tab list.' },\n { name: \"tab\", description: '`editable=\"tabs\"`: each tab button.' },\n { name: \"editor\", description: '`editable=\"tabs\"`: the `<textarea>` holding the markdown.' },\n { name: \"edit-bar\", description: \"`editable`: the formatting bar above the open box.\" },\n {\n name: \"edit-box\",\n description: \"`editable`: the box a piece becomes while it's edited in place, holding its markdown.\"\n }\n ],\n states: [\n ...UIT.SourceStates,\n { name: \"placing\", description: \"`editable`: ⌥ is held, so what can be edited in place is outlined.\" },\n { name: \"editing\", description: \"`editable`: a piece is being edited in place.\" }\n ],\n texts: [\n ...UIT.SourceTexts,\n { key: \"write\", text: \"Write\", description: '`editable=\"tabs\"`: the editing tab.' },\n { key: \"preview\", text: \"Preview\", description: '`editable=\"tabs\"`: the preview tab.' },\n { key: \"editor\", text: \"Markdown\", description: '`editable=\"tabs\"`: accessible name of the text box.' },\n { key: \"editBox\", text: \"Edit {kind}\", description: \"`editable`: accessible name of the box a piece becomes.\" },\n { key: \"paragraph\", text: \"paragraph\", description: \"`editable`: a paragraph, in `editBox`.\" },\n { key: \"heading\", text: \"heading\", description: \"`editable`: a heading, in `editBox`.\" },\n { key: \"item\", text: \"list item\", description: \"`editable`: a list item, in `editBox`.\" },\n { key: \"cell\", text: \"table cell\", description: \"`editable`: a table cell, in `editBox`.\" },\n { key: \"formatBar\", text: \"Formatting\", description: \"`editable`: accessible name of the formatting bar.\" },\n { key: \"bold\", text: \"Bold (⌘B)\", description: \"`editable`: the bar's bold button.\" },\n { key: \"italic\", text: \"Italic (⌘I)\", description: \"`editable`: the bar's italic button.\" },\n { key: \"strikethrough\", text: \"Strikethrough (⌘⇧X)\", description: \"`editable`: the bar's strikethrough button.\" },\n { key: \"link\", text: \"Link (⌘K)\", description: \"`editable`: the bar's link button.\" },\n {\n key: \"linkAddress\",\n text: \"Link address: Enter puts it on, empty takes it off\",\n description: \"`editable`: the link's address field.\"\n },\n { key: \"shape\", text: \"Paragraph or heading\", description: \"`editable`: the bar's shape menu.\" },\n { key: \"shapeParagraph\", text: \"Paragraph\", description: \"`editable`: the shape menu's paragraph.\" },\n { key: \"shapeH2\", text: \"Heading 2\", description: \"`editable`: the shape menu's `##`.\" },\n { key: \"shapeH3\", text: \"Heading 3\", description: \"`editable`: the shape menu's `###`.\" },\n { key: \"shapeH4\", text: \"Heading 4\", description: \"`editable`: the shape menu's `####`.\" },\n { key: \"bullet\", text: \"Bulleted list\", description: \"`editable`: the bar's bulleted list button.\" },\n { key: \"numbered\", text: \"Numbered list\", description: \"`editable`: the bar's numbered list button.\" },\n { key: \"clear\", text: \"Clear formatting\", description: \"`editable`: the bar's clear formatting button.\" },\n { key: \"view\", text: \"Show it formatted, without its marks\", description: \"`editable`: the bar's view switch.\" },\n {\n key: \"formattedOff\",\n text: \"This text can't show formatted: written back, it wouldn't be the same\",\n description: \"`editable`: the switch's tooltip, for a piece whose markdown wouldn't come back exactly.\"\n },\n {\n key: \"noFormattedView\",\n text: \"This markdown's engine has no formatted view\",\n description: \"`editable`: the switch's tooltip, for a subclass's engine without `renderInline()`.\"\n }\n ]\n} as const satisfies E.ComponentVocabulary\n","/*\n * The style sheet of `<ui-markdown>`: ours, not Fomantic's. GitHub's markdown look, on `ui`'s tokens.\n * - It styles the component's shadow DOM:\n * - the source parts (`<ui-loader part=\"loader\">`, `<ui-message part=\"error\">`)\n * - then a `<section>` holding `<article class=\"ui [size] markdown\" part=\"body\">`,\n * the rendered HTML (`h1`-`h6` with ids, `p`, lists (task items: `li > input[type=checkbox]`), `blockquote`,\n * `table`, `hr`, `img`, inline `code` (`code.short`: kept on one line), `del`),\n * with each code block as a `<ui-code>` (its own sheet).\n * - `editable=\"tabs\"`: `<nav part=\"tabs\">` of `<button part=\"tab\" aria-selected>`,\n * a `<section>` around `<textarea part=\"editor\">`, then the article's `<section>` (both `role=tabpanel`).\n * - A subclass's engine may draw the article's blocks as `ui-*` elements (`ui-header`, `ui-list`, `ui-table` ...:\n * the app's `<spell-markdown>`, on spell's engine): each styles itself, and this sheet only spaces them.\n * - Sizes by the generic remap: `.ui.small` ... set `--ui-scale`, and the article scales its font by it.\n * - Public tokens are NEVER declared here: each is read through its private alias (`notes/theming.md`).\n * - Headings: GitHub's look by default (sans 600, a rule under `h1` / `h2`).\n * A theme or page restyles them with the `--ui-markdown-heading-*` / `-h1-size` ...\n * `-h3-size` tokens (the brand's serif headings, `spell.css`), since `::part(body)` can't reach the elements\n * inside the article.\n */\n\n@layer ui.components.markdown.types, ui.components.markdown.content, ui.components.markdown.variations, ui.components.markdown.states;\n\n/*******************************\n Markdown\n*******************************/\n\n@layer ui.components.markdown.types {\n :host {\n --_ui-markdown-editor-border: var(--ui-markdown-editor-border, var(--ui-border-color));\n --_ui-markdown-editor-background: var(--ui-markdown-editor-background, var(--ui-surface));\n --_ui-markdown-color: var(--ui-markdown-color, var(--ui-text-color));\n --_ui-markdown-muted: var(--ui-markdown-muted, var(--ui-text-muted));\n --_ui-markdown-radius: var(--ui-markdown-radius, var(--ui-radius));\n /* the widest a paragraph, list or quote runs: a page sets a reading measure (`75ch`); unset, the column's width */\n --_ui-markdown-measure: var(--ui-markdown-measure, none);\n display: block;\n }\n\n .ui.markdown {\n --_ui-markdown-color: var(--ui-markdown-color, var(--ui-text-color));\n --_ui-markdown-muted: var(--ui-markdown-muted, var(--ui-text-muted));\n --_ui-markdown-line-height: var(--ui-markdown-line-height, 1.6);\n --_ui-markdown-heading-color: var(--ui-markdown-heading-color, var(--ui-text-color));\n /* headings' font family: the article's unless set (`initial` => `inherit`) */\n --_ui-markdown-heading-font-family: var(--ui-markdown-heading-font-family, initial);\n --_ui-markdown-heading-weight: var(--ui-markdown-heading-weight, 600);\n --_ui-markdown-heading-line-height: var(--ui-markdown-heading-line-height, 1.25);\n /* above and below each heading (`margin-block`), in ITS em */\n --_ui-markdown-heading-margin: var(--ui-markdown-heading-margin, 1.5em 1em);\n /* the rule under `h1` / `h2` (a `border`; `none` drops it), and the gap between it and the text */\n --_ui-markdown-heading-rule: var(--ui-markdown-heading-rule, 1px solid var(--_ui-markdown-rule-color));\n --_ui-markdown-heading-rule-gap: var(--ui-markdown-heading-rule-gap, 0.3em);\n /* where a revealed heading lands below the top (`reveal()`, `#id`): room for a page's sticky header */\n --_ui-markdown-heading-scroll-margin: var(--ui-markdown-heading-scroll-margin, 0);\n --_ui-markdown-h1-size: var(--ui-markdown-h1-size, 2em);\n --_ui-markdown-h2-size: var(--ui-markdown-h2-size, 1.5em);\n --_ui-markdown-h3-size: var(--ui-markdown-h3-size, 1.25em);\n /* bold text and inline code: the text colour unless set (`initial` => `inherit`) */\n --_ui-markdown-strong-color: var(--ui-markdown-strong-color, initial);\n --_ui-markdown-code-color: var(--ui-markdown-code-color, initial);\n --_ui-markdown-link-color: var(--ui-markdown-link-color, var(--ui-link));\n --_ui-markdown-rule-color: var(--ui-markdown-rule-color, var(--ui-border-color));\n /* a thematic break's (`---`) thickness */\n --_ui-markdown-hr-height: var(--ui-markdown-hr-height, 0.25em);\n --_ui-markdown-table-border: var(--ui-markdown-table-border, var(--ui-border-color));\n --_ui-markdown-stripe: var(--ui-markdown-stripe, var(--ui-surface-muted));\n --_ui-markdown-blockquote-color: var(--ui-markdown-blockquote-color, var(--ui-text-muted));\n --_ui-markdown-blockquote-border: var(--ui-markdown-blockquote-border, var(--ui-border-color-strong));\n /* inline code's chip: the foundation's (`ui-typography`), so its padding reads as the chip, not as a space */\n --_ui-markdown-code-background: var(--ui-markdown-code-background, var(--ui-surface-strong));\n --_ui-markdown-radius: var(--ui-markdown-radius, var(--ui-radius));\n /* the widest a paragraph, list or quote runs: a page sets a reading measure (`75ch`); unset, the column's width */\n --_ui-markdown-measure: var(--ui-markdown-measure, none);\n display: block;\n color: var(--_ui-markdown-color);\n font-size: calc(var(--ui-font-size) * var(--ui-scale, 1));\n line-height: var(--_ui-markdown-line-height);\n overflow-wrap: break-word;\n }\n}\n\n@layer ui.components.markdown.content {\n /* blocks: GitHub's rhythm, one gap below each */\n .ui.markdown :is(p, ul, ol, blockquote, table, pre, ui-code, details, hr) {\n margin-block: 0 1em;\n }\n /* prose at most the reading measure (`--ui-markdown-measure`); code, tables and pictures keep the column's width */\n .ui.markdown > :is(p, ul, ol, blockquote) {\n max-width: var(--_ui-markdown-measure);\n }\n\n /* headings */\n .ui.markdown :is(h1, h2, h3, h4, h5, h6) {\n margin-block: var(--_ui-markdown-heading-margin);\n color: var(--_ui-markdown-heading-color);\n font-family: var(--_ui-markdown-heading-font-family, inherit);\n font-weight: var(--_ui-markdown-heading-weight);\n line-height: var(--_ui-markdown-heading-line-height);\n scroll-margin-top: var(--_ui-markdown-heading-scroll-margin);\n }\n\n .ui.markdown :is(h1, h2) {\n padding-block-end: var(--_ui-markdown-heading-rule-gap);\n border-block-end: var(--_ui-markdown-heading-rule);\n }\n\n .ui.markdown h1 {\n font-size: var(--_ui-markdown-h1-size);\n }\n\n .ui.markdown h2 {\n font-size: var(--_ui-markdown-h2-size);\n }\n\n .ui.markdown h3 {\n font-size: var(--_ui-markdown-h3-size);\n }\n\n .ui.markdown h4 {\n font-size: 1em;\n }\n\n .ui.markdown h5 {\n font-size: 0.875em;\n }\n\n .ui.markdown h6 {\n color: var(--_ui-markdown-muted);\n font-size: 0.85em;\n }\n\n /* links */\n .ui.markdown a {\n color: var(--_ui-markdown-link-color);\n text-decoration: underline;\n text-underline-offset: 0.15em;\n }\n\n /* lists, task lists */\n .ui.markdown :is(ul, ol) {\n padding-inline-start: 2em;\n }\n\n .ui.markdown :is(ul, ol) :is(ul, ol) {\n margin-block-end: 0;\n }\n\n .ui.markdown li + li {\n margin-block-start: 0.25em;\n }\n\n .ui.markdown li:has(> input[type=\"checkbox\"]) {\n list-style: none;\n }\n\n .ui.markdown li > input[type=\"checkbox\"] {\n margin-inline: -1.4em 0.4em;\n vertical-align: middle;\n }\n\n /* quotes, rules */\n .ui.markdown blockquote {\n margin-inline: 0;\n padding: 0 1em;\n border-inline-start: 0.25em solid var(--_ui-markdown-blockquote-border);\n color: var(--_ui-markdown-blockquote-color);\n }\n\n .ui.markdown hr {\n height: var(--_ui-markdown-hr-height);\n margin-block: 1.5em;\n border: 0;\n background: var(--_ui-markdown-rule-color);\n }\n\n /* tables: bordered cells, striped rows, scroll when too wide; NOT a `<ui-table>`'s, which styles its own */\n .ui.markdown table:not(ui-table > table) {\n display: block;\n width: max-content;\n max-width: 100%;\n overflow: auto;\n border-collapse: collapse;\n }\n\n .ui.markdown :is(th, td):not(ui-table *) {\n padding: 0.4em 0.8em;\n border: 1px solid var(--_ui-markdown-table-border);\n }\n\n .ui.markdown th:not(ui-table *) {\n font-weight: 600;\n }\n\n .ui.markdown tbody tr:nth-child(2n):not(ui-table *) {\n background: var(--_ui-markdown-stripe);\n }\n\n /* bold */\n .ui.markdown :is(strong, b) {\n color: var(--_ui-markdown-strong-color, inherit);\n }\n\n /*\n * Inline code: the foundation's chip, padded a little at its sides, no margin, so punctuation sits against it.\n * - A short span never breaks across lines (`--toggle` split at its dashes):\n * `code.short`, marked by `UIMarkdown.keepShortCode()`.\n * A longer one still wraps, so it never runs off a phone's screen.\n */\n .ui.markdown :not(pre) > code {\n padding: 0.125em 0.375em;\n border-radius: var(--_ui-markdown-radius);\n background: var(--_ui-markdown-code-background);\n color: var(--_ui-markdown-code-color, inherit);\n font-family: var(--ui-font-family-mono);\n font-size: 0.85em;\n }\n\n .ui.markdown :not(pre) > code.short {\n white-space: nowrap;\n }\n\n /* images, strikethrough */\n .ui.markdown img {\n max-width: 100%;\n height: auto;\n }\n\n .ui.markdown del {\n color: var(--_ui-markdown-muted);\n }\n\n /* code blocks are `<ui-code>`s */\n .ui.markdown ui-code {\n display: block;\n }\n\n /* an engine drawing `ui-*` blocks (a subclass's: `<spell-markdown>`): the same rhythm */\n .ui.markdown :is(ui-header, ui-list, ui-message, ui-segment, ui-table, ui-divider) {\n display: block;\n margin-block: 0 1em;\n }\n\n .ui.markdown ui-header {\n margin-block-start: 1.5em;\n }\n\n .ui.markdown ui-list ui-list {\n margin-block-end: 0;\n }\n\n /* no gap above the first block or below the last: AFTER the block rules, which set both */\n .ui.markdown > :first-child {\n margin-block-start: 0;\n }\n\n .ui.markdown > :last-child {\n margin-block-end: 0;\n }\n\n /* `editable`: Write / Preview tabs over the text box or the preview, GitHub's comment box */\n [part~=\"tabs\"] {\n display: flex;\n gap: 0.25em;\n border-block-end: 1px solid var(--_ui-markdown-editor-border);\n }\n\n [part~=\"tab\"] {\n margin-block-end: -1px;\n padding: 0.5em 1em;\n border: 1px solid transparent;\n border-start-start-radius: var(--_ui-markdown-radius);\n border-start-end-radius: var(--_ui-markdown-radius);\n background: none;\n color: var(--_ui-markdown-muted);\n font: inherit;\n cursor: pointer;\n }\n\n [part~=\"tab\"][aria-selected=\"true\"] {\n border-color: var(--_ui-markdown-editor-border);\n border-block-end-color: var(--_ui-markdown-editor-background);\n background: var(--_ui-markdown-editor-background);\n color: var(--_ui-markdown-color);\n }\n\n [part~=\"editor\"] {\n display: block;\n box-sizing: border-box;\n width: 100%;\n min-height: 12em;\n padding: 0.75em;\n border: 1px solid var(--_ui-markdown-editor-border);\n border-radius: var(--_ui-markdown-radius);\n background: var(--_ui-markdown-editor-background);\n color: var(--_ui-markdown-color);\n font-family: var(--ui-font-family-mono);\n font-size: 0.875em;\n line-height: 1.5;\n resize: vertical;\n }\n\n /* the preview, under the tabs: `editable=\"tabs\"` draws the article `.tabs.editable` */\n .ui.tabs.editable.markdown {\n margin-block-start: 0.75em;\n }\n}\n\n/*******************************\n Editing in place\n*******************************/\n\n/*\n * `editable` (the article `.editable`): holding ⌥ outlines each piece that can be edited (`:state(placing)`,\n * `[data-ui-place]`), and the piece being edited shows its markdown in a box (`[part~=\"edit-box\"]`), in place of\n * its own content, with its formatting bar above it (`[part~=\"edit-bar\"]`, anchored to the box), and its runs in the\n * faded-marks view (`.md-mark`, `.md-bold` ...).\n */\n@layer ui.components.markdown.states {\n :host {\n --_ui-markdown-edit-color: var(--ui-markdown-edit-color, var(--ui-primary));\n /* the bar's own ground: solid, over the text it sits on (a page may make the editor's clear) */\n --_ui-markdown-bar-background: var(--ui-markdown-bar-background, var(--ui-background));\n }\n\n :host(:state(placing)) .ui.editable.markdown [data-ui-place] {\n outline: 1px dashed color-mix(in oklch, var(--_ui-markdown-edit-color) 70%, transparent);\n outline-offset: -1px;\n cursor: text;\n }\n\n .ui.editable.markdown [part~=\"edit-box\"] {\n outline: 2px solid var(--_ui-markdown-edit-color);\n outline-offset: 1px;\n border-radius: 2px;\n background: color-mix(in oklch, var(--_ui-markdown-edit-color) 6%, transparent);\n font-family: var(--ui-font-family-mono);\n font-size: 0.92em;\n /* a new line typed in a paragraph (Shift+Enter) stays a line end in its text */\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n }\n\n /* the box's formatting bar sits just above it (below it near the window's top): anchored, so the page never moves */\n .ui.editable.markdown [part~=\"edit-box\"] {\n anchor-name: --ui-markdown-box;\n }\n\n /* the formatted view: the page's own text, no code font */\n .ui.editable.markdown [part~=\"edit-box\"][data-view=\"formatted\"] {\n font-family: inherit;\n font-size: inherit;\n }\n\n /* the faded-marks view: the marks faint, the words as the marks say */\n [part~=\"edit-box\"] .md-mark {\n opacity: 0.4;\n font-weight: normal;\n font-style: normal;\n }\n [part~=\"edit-box\"] .md-bold {\n font-weight: 700;\n }\n [part~=\"edit-box\"] .md-italic {\n font-style: italic;\n }\n [part~=\"edit-box\"] .md-strikethrough {\n text-decoration: line-through;\n }\n [part~=\"edit-box\"] .md-link {\n color: var(--_ui-markdown-link-color, var(--ui-link));\n }\n\n [part~=\"edit-bar\"] {\n /* a popover (the top layer): the browser's own popover box undone */\n inset: auto;\n margin-inline: 0;\n overflow: visible;\n color: inherit;\n position: fixed;\n position-anchor: --ui-markdown-box;\n position-area: block-start span-inline-end;\n position-try-fallbacks: flip-block;\n margin-block: 6px;\n z-index: 10;\n display: flex;\n align-items: center;\n gap: 2px;\n padding: 3px;\n border: 1px solid var(--_ui-markdown-editor-border);\n border-radius: var(--_ui-markdown-radius);\n background: var(--_ui-markdown-bar-background);\n /* a theme's see-through ground still reads: what's under it blurred away */\n backdrop-filter: blur(12px);\n box-shadow: 0 2px 8px color-mix(in oklch, black 12%, transparent);\n font-size: 0.875em;\n }\n\n [part~=\"edit-bar\"] input {\n font: inherit;\n padding: 0.2em 0.4em;\n border: 1px solid var(--_ui-markdown-editor-border);\n border-radius: var(--_ui-markdown-radius);\n background: var(--_ui-markdown-editor-background);\n color: var(--_ui-markdown-color);\n }\n\n [part~=\"edit-bar\"] input {\n inline-size: 18em;\n }\n}\n","import { For, Show } from \"solid-js\"\nimport type { JSX } from \"@solidjs/web\"\n\nimport { E, UI } from \"spell/ui/core\"\nimport type { codeVocabulary } from \"spell/ui/components/ui-code/UICode.en\"\nimport { PrefStore } from \"spell/util/persist/PrefStore\"\nimport { MarkdownBox, type BoxView } from \"./MarkdownBox\"\nimport { MarkdownFormats, type Shape } from \"./MarkdownFormats\"\nimport { MarkdownRenderer } from \"./MarkdownRenderer\"\nimport { MarkdownSource } from \"./MarkdownSource\"\nimport type {\n MarkdownHeading,\n MarkdownOptions,\n MarkdownPlace,\n MarkdownPlaceKind,\n MarkdownRendering\n} from \"./UIMarkdown.types\"\nimport { markdownVocabulary } from \"./UIMarkdown.en\"\n\nimport markdownCSS from \"./UIMarkdown.css?inline\"\n\n/****************\n * ### `DOMMarkdownElement`\n * The DOM element of `<ui-markdown>`: it adds `headings` and `reveal()`\n * to the source API it inherits from `DOMLoadableElement` (`content`, `save()` ...).\n * - `headings`: `{ level, text, id }` of each heading of the last render, e.g. for a table of contents;\n * `[]` before the first (`ui-drawn` says when).\n * - `reveal(id)`: scroll to one of them from outside.\n * - Above the component: its `elementSetup` reads this class while the component is defined.\n ****************/\nexport class DOMMarkdownElement extends E.DOMLoadableElement<UIMarkdown> {\n /** Each heading of the last render; `[]` before the first. Untracked: it's for scripts. */\n @E.untracked\n get headings(): MarkdownHeading[] {\n return this.component?.headings ?? []\n }\n\n /**\n * Scroll to the rendered heading `id` (a `headings` entry's) and put `#id` in the address,\n * as a `#id` link inside does; `false` when no such heading is rendered (yet).\n * - Why a method: the headings live in the shadow root, which the page's own fragment navigation can't see,\n * e.g. from a table of contents outside the element.\n */\n reveal(id: string): boolean {\n return this.component?.reveal(id) ?? false\n }\n}\n\n/****************\n * ### `UIMarkdown`\n * The component behind `<ui-markdown>`: GitHub-flavoured markdown, rendered.\n *\n * - Its shadow DOM:\n * `<article class=\"ui [size] markdown\" part=\"body\">` in a `<section>` (the preview panel, when `editable=\"tabs\"`).\n * - The text: the element's own (`<script type=\"text/markdown\">` keeps it exact),\n * or a `source` file (see `LoadableComponent`).\n * - Rendering: marked, loaded with the first render (`MarkdownRenderer` -> `MarkdownEngine`, the lazy chunk).\n * Headings get GitHub's ids (`headings`, `ui-drawn`).\n * - A subclass may draw with an engine of its own (`loadEngine()`):\n * the app's `<spell-markdown>` draws with spell's, in `ui-*` elements.\n * - NOT sanitized unless `sanitized`: raw HTML in the text is kept.\n * `sanitized` loads DOMPurify (`MarkdownSanitizer`, a lazy chunk of its own) alongside the engine:\n * set it for text you didn't write.\n * - After rendering:\n * - each fenced code block becomes a `<ui-code language=\"x\" copy>` (one highlighter, one palette)\n * - each short inline code span is marked `short`, kept on one line (`keepShortCode()`)\n * - each task-list checkbox is named by its item's text (marked leaves it unlabelled)\n * - relative `href` / `src` resolve against `source`, so a README's links and images work where it's shown\n * - `#id` links scroll to the heading INSIDE the shadow root\n * (the page's own fragment navigation can't see it).\n * So do `reveal(id)` from outside, and a `#id` in the address that names one of its headings:\n * after the FIRST render (a page loaded with it), and on each `hashchange` (a link elsewhere on the page).\n * - `skip-title`: the text's leading `#` title isn't rendered (the text keeps it).\n * - A failed render (an engine that won't load) is a `render` error, with its message.\n * - `editable`: each paragraph, heading, list item and table cell is edited where it's drawn (\"Editing in place\").\n * - `editable=\"tabs\"`: Write / Preview tabs (`role=tablist`, arrow keys), a `<textarea>` for the text,\n * and the article as the preview, drawn by the same engine.\n * - each keystroke sets `content`: `ui-changed`, `:state(dirty)`, and `save()` writes it back to `source`\n * - the preview renders while it's shown: the WHOLE text each time (~2 ms for 32 kB),\n * then swaps only the top-level blocks whose markup changed (`patchBody()`),\n * so unchanged elements keep their state (a highlighted `<ui-code>`, a scrolled table).\n * - SIDE EFFECTS: listens to `window`'s `hashchange` while connected, and to its ⌥ key while `editable`;\n * a revealed heading is put in the address (`history.replaceState`, no new entry).\n ****************/\nexport class UIMarkdown extends E.LoadableComponent<typeof markdownVocabulary> {\n // typed wide, as `UIRoot`'s: a subclass names its own (the app's `<spell-markdown>`)\n @E.proto static vocabulary: E.ComponentVocabulary = markdownVocabulary\n @E.protoMerged static elementSetup = {\n styleSheets: { markdown: markdownCSS },\n DOMElement: DOMMarkdownElement,\n delegatesFocus: false\n } satisfies Partial<E.ElementSetup>\n\n ////////////////\n // ## Rendering\n ////////////////\n\n /** The `<article>`, once rendered. */\n private body?: HTMLElement\n\n /** Renders started; only the latest one's result is shown. */\n private ticket = 0\n\n /** Markup of each top-level node `patchBody()` put in the article, to tell which blocks changed. */\n private readonly rendered = new WeakMap<Node, string>()\n\n /**\n * Render whenever the text or a rendering attribute changes; `editable=\"tabs\"`, only while the preview shows.\n * - Never on a server: the server runs no effect.\n */\n @E.onChange(\"textToShow\", \"skipTitle\", \"loadStatus\", \"editable\", \"shownTab\", \"breaks\", \"headingOffset\", \"sanitized\")\n protected onMarkdownChanged() {\n void this.renderNow()\n }\n\n /**\n * Render the text as it is now, unless it can't show: not loaded, the Write tab up, or a piece being edited in\n * place (it renders once that closes, \"Editing in place\").\n * - Returns the render, for what waits on it (Tab, to the next piece).\n */\n private renderNow(): Promise<void> | undefined {\n const isShown = !this.hasTabs || this.shownTab === PREVIEW\n if (this.loadStatus !== \"loaded\" || !isShown) return\n if (this.box) {\n this.isRenderWaiting = true\n return\n }\n const text = this.textToShow\n const shown = this.skipTitle ? text.replace(LEADING_TITLE, \"\") : text\n this.placesOffset = text.length - shown.length\n return this.renderMarkdown({\n text: shown,\n isEditable: !!this.editable,\n options: {\n breaks: !!this.breaks,\n headingOffset: Number(this.headingOffset) || 0,\n sanitized: !!this.sanitized,\n places: this.editsInPlace\n }\n })\n }\n\n protected renderContent(): JSX.Element {\n return (\n <>\n <Show when={this.hasTabs}>\n {this.tabs()}\n {this.editor()}\n </Show>\n <section\n id={UIMarkdown.panelId(PREVIEW)}\n role={this.hasTabs ? TAB_ROLES.panel : undefined}\n aria-labelledby={this.hasTabs ? UIMarkdown.tabId(PREVIEW) : undefined}\n hidden={this.hasTabs && this.shownTab !== PREVIEW ? true : undefined}\n >\n <article\n class={this.rootClass}\n part={this.partForName(\"body\")}\n onClick={this.onClick}\n ref={(body: HTMLElement) => {\n this.body = body\n }}\n />\n </section>\n </>\n )\n }\n\n ////////////////\n // ## Editing in tabs (`editable=\"tabs\"`)\n ////////////////\n\n /** `editable=\"tabs\"`: Write / Preview tabs. */\n get hasTabs(): boolean {\n return this.editable === TABS\n }\n\n /** `editable`'s shown tab. */\n @E.state accessor shownTab: MarkdownTab = WRITE\n\n /** `editable`: the text box. */\n private textBox?: HTMLTextAreaElement\n\n /** `editable`: the tab buttons, by tab. */\n private readonly tabButtons = new Map<MarkdownTab, HTMLButtonElement>()\n\n /** `editable`'s tab list: Write, Preview. */\n private tabs(): JSX.Element {\n return (\n <nav part={this.partForName(\"tabs\")} role={TAB_ROLES.list} onKeyDown={this.onTabKeyDown}>\n <For each={MarkdownTabs}>\n {(tab) => (\n <button\n type=\"button\"\n id={UIMarkdown.tabId(tab)}\n role={TAB_ROLES.tab}\n part={this.partForName(\"tab\")}\n aria-selected={this.shownTab === tab ? \"true\" : \"false\"}\n aria-controls={UIMarkdown.panelId(tab)}\n tabindex={this.shownTab === tab ? 0 : -1}\n onClick={() => (this.shownTab = tab)}\n ref={(button: HTMLButtonElement) => {\n this.tabButtons.set(tab, button)\n }}\n >\n {this.translationForKey(tab)}\n </button>\n )}\n </For>\n </nav>\n )\n }\n\n /** `editable`'s text box, in the Write panel. */\n private editor(): JSX.Element {\n return (\n <section\n id={UIMarkdown.panelId(WRITE)}\n role={TAB_ROLES.panel}\n aria-labelledby={UIMarkdown.tabId(WRITE)}\n hidden={this.shownTab !== WRITE ? true : undefined}\n >\n <textarea\n part={this.partForName(\"editor\")}\n aria-label={this.translationForKey(\"editor\")}\n onInput={this.onInput}\n ref={this.keepTextBox}\n />\n </section>\n )\n }\n\n /** `editable`: keep the text box as it's drawn, and fill it with the text (`onTextChanged()` keeps it in step). */\n @E.untracked\n private readonly keepTextBox = (textBox: HTMLTextAreaElement) => {\n this.textBox = textBox\n textBox.value = this.textToShow\n }\n\n /** `editable`: the text box follows the content (`domElement.content = ...`, a reload). */\n @E.onChange(\"textToShow\")\n protected onTextChanged(text: string) {\n if (this.textBox && this.textBox.value !== text) this.textBox.value = text\n }\n\n /** `editable`: each keystroke is an edit (`ui-changed`, `dirty`). */\n private readonly onInput = (event: InputEvent) => {\n this.content = (event.currentTarget as HTMLTextAreaElement).value\n }\n\n /** `editable`'s tab list: arrows move between the tabs (wrapping), Home / End to the ends; focus follows. */\n private readonly onTabKeyDown = (event: KeyboardEvent) => {\n UI.focus.arrowKey(event, {\n container: event.currentTarget as HTMLElement,\n items: () => MarkdownTabs.map((tab) => this.tabButtons.get(tab)!),\n orientation: \"horizontal\",\n // the shown tab is the tab stop, drawn by `tabs()`\n tabindex: \"left alone\",\n onChange: (_button, index) => (this.shownTab = MarkdownTabs[index]!)\n })\n }\n\n ////////////////\n // ## Editing in place (`editable`)\n ////////////////\n\n /** `editable`, bare: each piece edited where it's drawn, by ⌥-click (epic `epic-engine` P60). */\n get editsInPlace(): boolean {\n return this.editable === true\n }\n\n /** ⌥ (Alt) is held down, while the window has the focus. */\n @E.state accessor isOptionHeld = false\n\n /** Holding ⌥ outlines what can be edited in place: `:state(placing)`. */\n @E.cssState(\"placing\")\n get isPlacing(): boolean {\n return this.editsInPlace && this.isOptionHeld\n }\n\n /** The piece being edited in place, while one is. */\n @E.state accessor box: OpenBox | undefined = undefined\n\n /** A piece is being edited in place: `:state(editing)`. */\n @E.cssState(\"editing\")\n get isEditingInPlace(): boolean {\n return !!this.box\n }\n\n /** The places of the last render (`MarkdownSource`), as offsets into the text it rendered. */\n private places: MarkdownPlace[] = []\n\n /** Where the rendered text starts in the content: past the title `skip-title` leaves out. */\n private placesOffset = 0\n\n /** A render came while a box was open: it runs as the box closes. */\n private isRenderWaiting = false\n\n /** The open box's keep, 5 seconds after the last key. */\n private keepTimer?: E.CancelablePromise<unknown>\n\n /** The engine of the last render: the box's formatted view draws with it (`renderInline()`). */\n private engine?: MarkdownRendering\n\n /** The saves kept edits start, one after another (`saveInTurn()`). */\n private saves: Promise<unknown> = Promise.resolve()\n\n /** While connected, follow ⌥ on the window: down, up, and the window losing the focus. */\n @E.whileConnected\n protected followOptionKey() {\n const listeners = new AbortController()\n const options = { signal: listeners.signal }\n const follow = (event: KeyboardEvent) => (this.isOptionHeld = event.altKey)\n window.addEventListener(\"keydown\", follow, options)\n window.addEventListener(\"keyup\", follow, options)\n window.addEventListener(\"blur\", () => (this.isOptionHeld = false), options)\n return () => listeners.abort()\n }\n\n /** ⌥-click: open a box on the piece under it; `false` when there's none, or it's the open box. */\n private openAt(event: MouseEvent): boolean {\n const target = event.target as Element\n if (this.box?.editor.field.contains(target)) return false\n const piece = target.closest?.(PLACED) as HTMLElement | null\n if (!piece || !this.body?.contains(piece)) return false\n void this.open(piece, { x: event.clientX, y: event.clientY })\n return true\n }\n\n /**\n * Edit `piece` where it is: its own content becomes a box holding its markdown, the cursor where `point` was\n * (else at its end).\n * - Its own content: all of it, but a list item's nested lists and task box; a loose item's first paragraph.\n * - A box already open is kept first.\n */\n private async open(piece: HTMLElement, point?: { x: number; y: number }) {\n if (this.box) await this.keep(\"close\")\n const place = this.places[Number(piece.getAttribute(PLACE_ATTRIBUTE))]\n if (!place || !piece.isConnected) return\n const text = this.textToShow\n const start = place.start + this.placesOffset\n const end = place.end + this.placesOffset\n const raw = text.slice(start, end)\n const holder = UIMarkdown.holderOf(piece)\n const own = UIMarkdown.ownNodes(holder)\n const caret = point ? this.caretFor(holder, raw, point) : raw.length\n const shape = MarkdownFormats.shapeOf(text, { ...place, start, end })\n const editor = this.boxFor(place.kind, raw, shape)\n holder.insertBefore(editor.field, own[0] ?? null)\n for (const node of own) node.remove()\n this.domElement.shadowRoot?.append(editor.bar)\n // in the top layer: over a section's stuck title, which would hide it otherwise (Owen's C1 on J196)\n editor.bar.showPopover()\n this.box = {\n piece,\n editor,\n own,\n place: { ...place, start, end },\n raw,\n opened: raw,\n shape,\n openedShape: shape,\n base: text\n }\n editor.focus(editor.view === \"marks\" ? caret : undefined)\n }\n\n /** The box a piece of `kind` becomes, holding its markdown `raw`, with its formatting bar (`MarkdownBox`). */\n private boxFor(kind: MarkdownPlaceKind, raw: string, shape: Shape | undefined): MarkdownBox {\n const engine = this.engine\n return new MarkdownBox({\n document: this.domElement.ownerDocument,\n kind,\n raw,\n shape,\n label: this.translationForKey(\"editBox\", { kind: this.translationForKey(kind) }),\n parts: { box: this.partForName(\"edit-box\"), bar: this.partForName(\"edit-bar\") },\n texts: (key) => this.translationForKey(key as never),\n view: UIMarkdown.chosenView,\n renderInline: engine?.renderInline ? (text) => engine.renderInline!(text) : undefined,\n onKey: this.onBoxKey,\n onInput: this.onBoxInput,\n onLeave: this.onBoxLeft,\n onView: (view) => (UIMarkdown.chosenView = view)\n })\n }\n\n /** The box's view last chosen in this browser (`PrefStore`, `ui-markdown:edit-view`): the faded marks first (J195). */\n private static get chosenView(): BoxView {\n return PrefStore.getAt(EDIT_VIEW_KEY) === \"formatted\" ? \"formatted\" : \"marks\"\n }\n\n private static set chosenView(view: BoxView) {\n PrefStore.setAt(EDIT_VIEW_KEY, view)\n }\n\n /**\n * The box's keys: Enter keeps it and closes; Shift+Enter is a new line in a paragraph; Tab and Shift+Tab keep it\n * and move to the next and previous piece; Escape puts the text back; Home and End go to its start and end.\n * - Stopped here, so a page's own keys don't act on them.\n */\n @E.untracked\n private readonly onBoxKey = (event: KeyboardEvent) => {\n event.stopPropagation()\n const box = this.box\n if (!box) return\n const isNewLine = event.key === \"Enter\" && event.shiftKey && box.place.kind === \"paragraph\"\n // Home and End: the box's start and end, never the page's (a Mac scrolls the page by them)\n const edge = event.shiftKey ? undefined : EDGE_KEYS[event.key as keyof typeof EDGE_KEYS]\n if (edge !== undefined) box.editor.caret = edge === \"start\" ? 0 : (box.editor.field.textContent ?? \"\").length\n else if (event.key === \"Escape\") void this.putBack()\n else if (event.key === \"Enter\" && !isNewLine) void this.keep(\"close\")\n else if (event.key === \"Tab\") void this.keep(event.shiftKey ? \"previous\" : \"next\")\n else return\n event.preventDefault()\n }\n\n /** Each key: the box is kept 5 seconds after the last one. */\n @E.untracked\n private readonly onBoxInput = () => {\n this.keepTimer?.cancel()\n this.keepTimer = E.after(KEEP_AFTER_SECONDS, () => void this.keep(\"open\"))\n }\n\n /** The focus left the box (a click away): it's kept, and closes. */\n @E.untracked\n private readonly onBoxLeft = (event: FocusEvent) => {\n const box = this.box\n const to = event.relatedTarget as Node | null\n // into the bar (its shape menu, the link's address): still editing\n if (box && !box.editor.field.contains(to) && !box.editor.bar.contains(to)) void this.keep(\"close\")\n }\n\n /**\n * Keep what's typed in the box: the content changes (`ui-changed`, dirty) and is saved (`save()`); then the box\n * stays open (`open`), closes, or moves to the next or previous piece.\n * - The text changed under the box (a live update, an agent's save): the piece's text is found again, once; not\n * there, or there twice, it's a `conflict` (`ui-error`), and the box stays open with what was typed.\n */\n private async keep(how: \"open\" | \"close\" | \"next\" | \"previous\") {\n const box = this.box\n if (!box) return\n this.keepTimer?.cancel()\n const typed = box.editor.raw\n const text = this.textToShow\n let start = box.place.start\n if (text !== box.base) {\n const at = text.indexOf(box.raw)\n if (at < 0 || text.includes(box.raw, at + 1)) return this.onKeepConflict()\n start = at\n }\n const place = { ...box.place, start, end: start + box.raw.length }\n // a new shape (a heading's level, a list): its line's lead rewritten too\n const shape = box.editor.shape\n const reshaped = shape && shape !== box.shape ? MarkdownFormats.reshape(text, place, typed, shape) : undefined\n const next = reshaped?.text ?? MarkdownSource.replace(text, place, typed)\n const neighbour = how === \"next\" || how === \"previous\" ? this.neighbourOf(box.piece, how) : undefined\n const after = neighbour && this.startInNext(neighbour, place, next.length - text.length)\n if (next !== text) {\n box.place = reshaped?.place ?? { ...place, end: next.length - (text.length - place.end) }\n box.raw = next.slice(box.place.start, box.place.end)\n box.shape = shape\n box.base = next\n this.content = next\n this.saveInTurn()\n }\n if (how === \"open\") return\n // drawn again now, not when the content's change reaches the render: the next piece opens in the new drawing\n const rendered = this.close(box) ?? (next !== text ? this.renderNow() : undefined)\n if (after === undefined) return\n await rendered\n const target = [...(this.body?.querySelectorAll<HTMLElement>(PLACED) ?? [])].find(\n (piece) => this.places[Number(piece.getAttribute(PLACE_ATTRIBUTE))]?.start === after\n )\n if (target) await this.open(target)\n }\n\n /**\n * Save the content, after any save still running: each save finds the text the one before it wrote.\n * - Failures are the element's `ui-error`; the content stays.\n */\n private saveInTurn() {\n this.saves = this.saves.then(() => this.save()).catch(() => false)\n }\n\n /** Escape: the box's text as it was when it opened, kept; then it closes. */\n private async putBack() {\n const box = this.box\n if (!box) return\n if (box.raw === box.opened && box.shape === box.openedShape) return void this.close(box)\n box.editor.raw = box.opened\n if (box.openedShape) box.editor.reshape(box.openedShape)\n await this.keep(\"close\")\n }\n\n /**\n * Close the box: the piece shows as before, then the render that waited runs (its new text, if it changed).\n * - Returns that render, else `undefined`.\n */\n private close(box: OpenBox): Promise<void> | undefined {\n this.keepTimer?.cancel()\n this.box = undefined\n box.editor.remove()\n box.editor.field.replaceWith(...box.own)\n if (!this.isRenderWaiting) return\n this.isRenderWaiting = false\n return this.renderNow()\n }\n\n /** The text changed under the box, and its piece can't be found again: `conflict`, and the box stays open. */\n private onKeepConflict() {\n const error = new Error(\"<ui-markdown>: this text changed while it was edited; copy what you typed, and reload\")\n this.sendSourceEvent(E.SourceEvent.error, { kind: \"conflict\", source: this.source || undefined, error })\n }\n\n /** The piece before or after `piece`, in reading order; `undefined` at either end. */\n private neighbourOf(piece: HTMLElement, how: \"next\" | \"previous\"): HTMLElement | undefined {\n const pieces = [...(this.body?.querySelectorAll<HTMLElement>(PLACED) ?? [])]\n return pieces[pieces.indexOf(piece) + (how === \"next\" ? 1 : -1)]\n }\n\n /**\n * Where `neighbour`'s text starts in the rendered text once the box's edit is in: after `edited`, it moved by\n * `moved` characters.\n */\n private startInNext(neighbour: HTMLElement, edited: MarkdownPlace, moved: number): number | undefined {\n const place = this.places[Number(neighbour.getAttribute(PLACE_ATTRIBUTE))]\n if (!place) return\n const start = place.start + this.placesOffset\n return (start >= edited.end ? start + moved : start) - this.placesOffset\n }\n\n /**\n * The offset in `raw` for the point clicked in `holder`: the drawn text before it, matched character by character\n * in the markdown, which has more (`**`, a link's address).\n */\n private caretFor(holder: HTMLElement, raw: string, point: { x: number; y: number }): number {\n const root = this.domElement.shadowRoot\n const caret = this.domElement.ownerDocument.caretPositionFromPoint?.(point.x, point.y, {\n shadowRoots: root ? [root] : []\n })\n if (!caret || !holder.contains(caret.offsetNode)) return raw.length\n const before = this.domElement.ownerDocument.createRange()\n before.setStart(holder, 0)\n before.setEnd(caret.offsetNode, caret.offset)\n let at = 0\n for (const char of before.toString()) {\n const found = raw.indexOf(char, at)\n if (found < 0) return raw.length\n at = found + 1\n }\n return at\n }\n\n ////////////////\n // ## Headings\n ////////////////\n\n /** The headings of the last render; the DOM element's `headings` reads it untracked. */\n @E.state accessor headings: MarkdownHeading[] = []\n\n /** A render has finished: the address's `#id` was looked for once, after the first. */\n private hasRendered = false\n\n /** Scroll to the rendered heading `id` and put `#id` in the address; `false` when there's none. */\n reveal(id: string): boolean {\n if (!this.scrollTo(id)) return false\n history.replaceState(history.state, \"\", `#${id}`)\n return true\n }\n\n /** While connected, listen to `window`'s `hashchange`; returns the listener's abort. */\n @E.whileConnected\n protected followHash() {\n const listeners = new AbortController()\n window.addEventListener(\"hashchange\", () => this.onHashChange(), { signal: listeners.signal })\n return () => listeners.abort()\n }\n\n /**\n * Scroll to the heading the address's `#id` names, if it's one of ours:\n * on `hashchange`, and once after the first render.\n * - Not when the PAGE has that id: the browser went there itself.\n */\n private onHashChange() {\n const id = UIMarkdown.idForHash(location.hash)\n if (id && !this.domElement.ownerDocument.getElementById(id)) this.scrollTo(id)\n }\n\n /** Scroll the element with `id` in the article into view; `false` when there's none. */\n private scrollTo(id: string): boolean {\n const target = this.body?.querySelector(`[id=\"${CSS.escape(id)}\"]`)\n target?.scrollIntoView()\n return !!target\n }\n\n /**\n * A `#id` link: scroll to that heading here, in the shadow root, and put it in the address.\n * - `editable`, ⌥-click: edit the piece clicked in place, the link not followed (\"Editing in place\").\n */\n private readonly onClick = (event: MouseEvent) => {\n if (this.editsInPlace && event.altKey && this.openAt(event)) return event.preventDefault()\n const link = (event.target as Element).closest?.(IN_PAGE_LINK)\n const id = link && UIMarkdown.idForHash(link.getAttribute(\"href\")!)\n if (id && this.reveal(id)) event.preventDefault()\n }\n\n ////////////////\n // ## Markup\n ////////////////\n\n /**\n * The engine this element draws with, loaded on first use: marked (`MarkdownRenderer.load()`).\n * - A HOOK: a subclass draws with an engine of its own by overriding it (the app's `<spell-markdown>`).\n * Its markup may hold `ui-*` elements (`MarkdownRendering.drawsUITags`), which `sanitized` then keeps.\n */\n protected loadEngine(): Promise<MarkdownRendering> {\n return MarkdownRenderer.load()\n }\n\n /**\n * Render `text` into the article; `ui-drawn` when done.\n * - `isEditable`: the markup patched in (`patchBody()`), so unchanged blocks keep their state.\n */\n private async renderMarkdown({ text, options, isEditable }: RenderParams) {\n const ticket = ++this.ticket\n try {\n await UI.load()\n const [engine, sanitizer] = await Promise.all([\n this.loadEngine(),\n options.sanitized ? MarkdownRenderer.loadSanitizer() : undefined\n ])\n if (ticket !== this.ticket || !this.body) return\n this.engine = engine\n const { html, headings, places } = engine.render(text, options)\n const fragment = sanitizer\n ? sanitizer.sanitize(html, { uiTags: !!engine.drawsUITags })\n : this.domElement.ownerDocument.createRange().createContextualFragment(html)\n this.upgradeCode(fragment)\n this.keepShortCode(fragment)\n this.labelTaskItems(fragment)\n this.resolveUrls(fragment)\n if (isEditable) this.patchBody(this.body, fragment)\n else this.body.replaceChildren(fragment)\n this.places = places ?? []\n this.headings = headings\n this.send(\"ui-drawn\", { headings })\n if (!this.hasRendered) {\n this.hasRendered = true\n this.onHashChange()\n }\n } catch (error) {\n if (ticket === this.ticket) this.onLoadError(error, \"render\")\n }\n }\n\n /** Each `<pre><code class=\"language-x\">` in `fragment` becomes a `<ui-code language=\"x\" copy>` with its text. */\n private upgradeCode(fragment: DocumentFragment) {\n for (const code of fragment.querySelectorAll(CODE_BLOCK)) {\n const pre = code.parentElement!\n const block = this.domElement.ownerDocument.createElement(CODE_TAG)\n const language = LANGUAGE_CLASS.exec(code.className)?.[1]\n if (language) block.setAttribute(LANGUAGE, language)\n block.setAttribute(COPY, \"\")\n block.textContent = (code.textContent ?? \"\").replace(/\\n$/, \"\")\n pre.replaceWith(block)\n }\n }\n\n /**\n * Mark each short inline code span `short`, so it never breaks across lines (`UIMarkdown.css`):\n * a browser breaks `--toggle` after its dashes.\n * - Only short ones (`SHORT_CODE_LENGTH`): a long span kept whole would run off a phone's screen.\n */\n private keepShortCode(fragment: DocumentFragment) {\n for (const code of fragment.querySelectorAll(INLINE_CODE)) {\n if ((code.textContent ?? \"\").length <= SHORT_CODE_LENGTH) code.classList.add(SHORT_CLASS)\n }\n }\n\n /** Name each task-list checkbox by its item's text: both engines write a bare box, which nothing labels. */\n private labelTaskItems(fragment: DocumentFragment) {\n for (const box of fragment.querySelectorAll(TASK_BOXES)) {\n const text = box.parentElement!.textContent?.trim()\n if (text) box.setAttribute(\"aria-label\", text)\n }\n }\n\n /** Point relative URLs in `fragment` where they point beside `source`; in-page `#id`s are left alone. */\n private resolveUrls(fragment: DocumentFragment) {\n const source = this.source || undefined\n if (!source) return\n const base = new URL(source, this.domElement.ownerDocument.baseURI)\n for (const name of LINK_ATTRIBUTES) {\n for (const element of fragment.querySelectorAll(`[${name}]`)) {\n const value = element.getAttribute(name)!\n if (value.startsWith(\"#\")) continue\n try {\n element.setAttribute(name, new URL(value, base).href)\n } catch {\n // not a URL: leave it\n }\n }\n }\n }\n\n /**\n * Put `fragment`'s top-level nodes in `body`, keeping the ones already there whose markup is the same:\n * the unchanged lead and tail stay, only the middle is swapped.\n * - Why: an edit changes a block or two; re-creating every `ui-*` element would re-highlight every code block\n * and lose each one's state (a scrolled table, a copied-code tick).\n * - A node not put here (a render from before `editable`) has no markup recorded, so it's always swapped.\n */\n private patchBody(body: HTMLElement, fragment: DocumentFragment) {\n const next = [...fragment.childNodes]\n const nextMarkup = next.map(UIMarkdown.markupFor)\n const old = [...body.childNodes]\n const oldMarkup = old.map((node) => this.rendered.get(node))\n let lead = 0\n while (lead < next.length && lead < old.length && nextMarkup[lead] === oldMarkup[lead]) lead++\n let tail = 0\n while (\n tail < next.length - lead &&\n tail < old.length - lead &&\n nextMarkup[next.length - 1 - tail] === oldMarkup[old.length - 1 - tail]\n ) {\n tail++\n }\n for (const node of old.slice(lead, old.length - tail)) node.remove()\n // `insertBefore()`'s \"at the end\" is `null`: a platform boundary\n const anchor = tail ? old[old.length - tail] : null\n for (const [index, node] of next.slice(lead, next.length - tail).entries()) {\n this.rendered.set(node, nextMarkup[lead + index])\n body.insertBefore(node, anchor)\n }\n }\n\n ////////////////\n // ## Helpers: static, as they're pure\n ////////////////\n\n /** `#some%20id` => `some id`; `undefined` for no hash, or a malformed one. */\n private static idForHash(hash: string): string | undefined {\n try {\n return decodeURIComponent(hash.slice(1)) || undefined\n } catch {\n return undefined\n }\n }\n\n /** Where a piece's own content is: a loose list item's first paragraph, else the piece. */\n private static holderOf(piece: HTMLElement): HTMLElement {\n const first = piece.firstElementChild\n return piece.localName === \"li\" && first?.localName === \"p\" ? (first as HTMLElement) : piece\n }\n\n /** `holder`'s own content: its nodes up to a nested list, without a task box. */\n private static ownNodes(holder: HTMLElement): ChildNode[] {\n const own: ChildNode[] = []\n for (const node of holder.childNodes) {\n if (node.nodeType === E.NodeType.element && NESTED_LIST.test((node as Element).localName)) break\n if (node.nodeType === E.NodeType.element && (node as Element).matches(TASK_BOX)) continue\n own.push(node)\n }\n return own\n }\n\n /** A top-level node's markup, to compare renders by. */\n private static markupFor(node: Node): string {\n const markup = node.nodeType === E.NodeType.element ? (node as Element).outerHTML : node.textContent\n return `${node.nodeType}:${markup}`\n }\n\n /** Id of `tab`'s button, inside the shadow root. */\n private static tabId(tab: MarkdownTab): string {\n return `ui-markdown-${tab}-tab`\n }\n\n /** Id of `tab`'s panel, inside the shadow root. */\n private static panelId(tab: MarkdownTab): string {\n return `ui-markdown-${tab}-panel`\n }\n}\n\n/** The vocabulary getters, typed (`UIComponent`'s doc). */\nexport interface UIMarkdown extends E.AttributeValues<typeof markdownVocabulary> {}\n\n/** What `renderMarkdown()` renders. */\ntype RenderParams = {\n /** the markdown */\n text: string\n /** how to render it */\n options: MarkdownOptions\n /** `editable`: patched in, block by block (`patchBody()`) */\n isEditable: boolean\n}\n\n/** The piece open in a box (`editable`), and what it stood for. */\ntype OpenBox = {\n /** the drawn piece: a `<p>`, a heading, an `<li>`, a `<td>` / `<th>` */\n piece: HTMLElement\n /** the box, in place of its own content, and its bar */\n editor: MarkdownBox\n /** its own content, put back as the box closes */\n own: ChildNode[]\n /** its text's place in the content as kept last (offsets into the whole text, `skip-title`'s title too) */\n place: MarkdownPlace\n /** its markdown as kept last */\n raw: string\n /** its markdown as the box opened: what Escape puts back */\n opened: string\n /** its shape as kept last: `undefined` for a table cell */\n shape: Shape | undefined\n /** its shape as the box opened */\n openedShape: Shape | undefined\n /** the whole content as kept last: a different one means it changed under the box */\n base: string\n}\n\n/** Where the box's view is remembered, in this browser (`PrefStore`). */\nconst EDIT_VIEW_KEY = \"ui-markdown:edit-view\"\n\n/** `editable=\"tabs\"`: Write / Preview tabs, not editing in place. */\nconst TABS = \"tabs\"\n\n/** The attribute the engine marks an editable piece with: its place's number (`MarkdownEngine`). */\nconst PLACE_ATTRIBUTE = \"data-ui-place\"\n\n/** A piece that can be edited in place. */\nconst PLACED = `[${PLACE_ATTRIBUTE}]`\n\n/** A box is kept this long after its last key, in seconds: Owen's 5 (epic `epic-engine` C2). */\nconst KEEP_AFTER_SECONDS = 5\n\n/** The keys that go to the box's start or end. */\nconst EDGE_KEYS = { Home: \"start\", End: \"end\" } as const\n\n/** A list nested in a list item: not part of the item's own text. */\nconst NESTED_LIST = /^(ul|ol)$/\n\n/** A task item's box, as marked draws it. */\nconst TASK_BOX = \"input[type=checkbox]\"\n\n/** `editable`'s Write tab: the text box. */\nconst WRITE = \"write\"\n\n/** `editable`'s Preview tab: the article. */\nconst PREVIEW = \"preview\"\n\n/** `editable`'s tabs, in order; each is also its text's key. */\nconst MarkdownTabs = [WRITE, PREVIEW] as const\n\n/** One of `MarkdownTabs`. */\ntype MarkdownTab = (typeof MarkdownTabs)[number]\n\n/** `editable`'s tab roles. */\nconst TAB_ROLES = { list: \"tablist\", tab: \"tab\", panel: \"tabpanel\" } as const\n\n/**\n * A leading `#` title (`skip-title`), with its line end:\n * blank lines, then an ATX `# Title` (one `#`) or a setext title (a line underlined with `=`).\n */\nconst LEADING_TITLE = /^(?:[ \\t]*\\n)*[ ]{0,3}(?:#(?=[ \\t\\n]|$)[^\\n]*|[^\\s][^\\n]*\\n[ ]{0,3}=+[ \\t]*)(?:\\n|$)/\n\n/** A fenced code block, as both engines write it. */\nconst CODE_BLOCK = \"pre > code\"\n\n/** An inline code span: any `<code>` outside a code block (the blocks are `<ui-code>`s by then). */\nconst INLINE_CODE = \":not(pre) > code\"\n\n/** Longest inline code span kept on one line, in characters: a token name (`--ui-button-padding-block`) fits a phone's line. */\nconst SHORT_CODE_LENGTH = 28\n\n/** Class of a short inline code span. */\nconst SHORT_CLASS = \"short\"\n\n/** A code block's language, from its class: `language-js` => `js`. */\nconst LANGUAGE_CLASS = /\\blanguage-(\\S+)/\n\n/** Tag a fenced code block becomes. */\nconst CODE_TAG: (typeof codeVocabulary)[\"tag\"] = \"ui-code\"\n\n/** `<ui-code>`'s highlighting language. */\nconst LANGUAGE: E.AttributeName<typeof codeVocabulary> = \"language\"\n\n/** `<ui-code>`'s copy button. */\nconst COPY: E.AttributeName<typeof codeVocabulary> = \"copy\"\n\n/** Task-list checkboxes: marked's (`<input>`), and a `ui-*` engine's (`<ui-checkbox>`: `<spell-markdown>`'s). */\nconst TASK_BOXES = \"li > input[type=checkbox], ui-item > ui-checkbox\"\n\n/**\n * Attributes rewritten against `source`, so relative links and images point where they did beside the file.\n * - Not the element core's `E.URL_ATTRIBUTES`: markdown writes only these two, and keeps no originals to save.\n */\nconst LINK_ATTRIBUTES = [\"href\", \"src\"] as const\n\n/** A link to a `#id` on this page. */\nconst IN_PAGE_LINK = \"a[href^='#']\"\n","/**\n * The markdown family: defines `<ui-markdown>` and exports its component, `UIMarkdown`,\n * its DOM element class, `DOMMarkdownElement`, and `MarkdownRenderer`;\n * and the types an engine of a subclass's own meets (`MarkdownRendering`: `UIMarkdown.loadEngine()`).\n * - SIDE EFFECT: importing it defines the tag, `<ui-button>` and `<ui-select>` (its edit box's bar), and `<ui-code>` (its code blocks),\n * `<ui-loader>` and `<ui-message>` (its loading and error looks).\n * - Also the library's `spell/ui/ui-markdown` entry (its size is in `notes/report.md`).\n * - marked and DOMPurify are NOT in this chunk: `MarkdownEngine` loads on the first render,\n * DOMPurify (`MarkdownSanitizer`) only for `sanitized`.\n */\n\nimport { DOMMarkdownElement, UIMarkdown } from \"./UIMarkdown\"\nimport { MarkdownRenderer } from \"./MarkdownRenderer\"\n\nimport \"spell/ui/components/ui-button\"\nimport \"spell/ui/components/ui-code\"\nimport \"spell/ui/components/ui-loader\"\nimport \"spell/ui/components/ui-message\"\nimport \"spell/ui/components/ui-select\"\n\nUIMarkdown.define()\n\nexport { UIMarkdown, DOMMarkdownElement, MarkdownRenderer }\nexport type { MarkdownHeading, MarkdownOptions, MarkdownRendering, MarkdownResult } from \"./UIMarkdown.types\"\n"],"mappings":";;;;;;;;;;;AAYA,IAAaoE,IAAb,MAAa,gBAAgB;CAU3B,OAAO,OAAO,GAAY,GAAsB;EAC9C,IAAM,EAAE,YAASC,GACb,EAAE,UAAO,WAAQA,EAAK,UAAUA,EAAK,MAAM,gBAAgB,OAAOA,CAAI,IAAIA;EAC9E,IAAIC,MAAUC,GACZ,OAAO;GACL,MAAMC,EAAK,MAAM,GAAGF,CAAK,IAAIG,IAAOA,IAAOD,EAAK,MAAMD,CAAG;GACzD,OAAOD,IAAQG,EAAK;GACpB,KAAKH,IAAQG,EAAK;EACpB;EAEF,IAAMC,IAASD,EAAK,QACd,aAAa,GAAc,MAC/BD,EAAK,MAAMG,IAAOD,GAAQC,CAAI,MAAMF,KACpCD,EAAK,MAAMI,GAAIA,IAAKF,CAAM,MAAMD,MAC/BA,MAAS,OACPD,EAAKG,IAAOD,IAAS,OAAO,OAAOF,EAAKI,IAAKF,OAAY,OAC1D,gBAAgB,SAASF,GAAMG,GAAMC,CAAE;EAC3C,IAAI,UAAUN,GAAOC,CAAG,GACtB,OAAO;GACL,MAAMC,EAAK,MAAM,GAAGF,IAAQI,CAAM,IAAIF,EAAK,MAAMF,GAAOC,CAAG,IAAIC,EAAK,MAAMD,IAAMG,CAAM;GACtF,OAAOJ,IAAQI;GACf,KAAKH,IAAMG;EACb;EAEF,IAAMG,IAAQL,EAAK,MAAMF,GAAOC,CAAG;EACnC,IAAIM,EAAM,SAAS,IAAIH,KAAUG,EAAM,WAAWJ,CAAI,KAAKI,EAAM,SAASJ,CAAI,GAAG;GAC/E,IAAMK,IAAYD,EAAM,MAAMH,GAAQ,CAACA,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