@astryx-vue/core 0.33.4 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AlertDialog/index.js +1 -1
- package/dist/{AlertDialog-CwyMvZEI.js → AlertDialog-CdrF01J0.js} +3 -3
- package/dist/AvatarGroup/index.d.ts +1 -1
- package/dist/AvatarGroup/index.js +1 -1
- package/dist/{AvatarGroup-BIPixZOb.js → AvatarGroup-CACtdvXz.js} +1 -1
- package/dist/Banner/index.d.ts +1 -1
- package/dist/Banner/index.js +1 -1
- package/dist/{Banner-CMXebR4Y.js → Banner-CAyN5-NO.js} +1 -1
- package/dist/BottomSheet/index.d.ts +1 -1
- package/dist/Breadcrumbs/index.js +2 -2
- package/dist/{Breadcrumbs-BPxPAEHQ.js → Breadcrumbs-BQnrbWXt.js} +1 -1
- package/dist/Button/index.d.ts +1 -1
- package/dist/Button/index.js +1 -1
- package/dist/{Button-B7PvGVt6.js → Button-CrZtv_4j.js} +2 -2
- package/dist/ButtonGroup/index.d.ts +1 -1
- package/dist/ButtonGroup/index.js +1 -1
- package/dist/{ButtonGroup-BkwQ0h97.js → ButtonGroup-Jgx-IWPz.js} +2 -2
- package/dist/Calendar/index.d.ts +1 -1
- package/dist/Card/index.d.ts +1 -1
- package/dist/Carousel/index.d.ts +1 -1
- package/dist/Carousel/index.js +1 -1
- package/dist/{Carousel-BmfKiv69.js → Carousel-BdhtUtf-.js} +1 -1
- package/dist/Chat/index.d.ts +1 -1
- package/dist/Chat/index.js +1 -1
- package/dist/{Chat-2AG37D51.js → Chat-DT712Yft.js} +1 -1
- package/dist/CheckboxInput/index.d.ts +1 -1
- package/dist/CheckboxInput/index.js +1 -1
- package/dist/{CheckboxInput-rbMgS8ZL.js → CheckboxInput-D8N6yvK5.js} +4 -4
- package/dist/CheckboxList/index.d.ts +1 -1
- package/dist/CheckboxList/index.js +1 -1
- package/dist/{CheckboxListItem-Ckt1Cwt_.js → CheckboxListItem--iUp9-KO.js} +4 -4
- package/dist/ClickableCard/index.d.ts +1 -1
- package/dist/ClickableCard/index.js +1 -1
- package/dist/{ClickableCard-Dh0tOQv-.js → ClickableCard-B_upAn7L.js} +1 -1
- package/dist/Code/index.d.ts +3 -2
- package/dist/Code/index.js +3 -2
- package/dist/Code/languages/dockerfile/index.d.ts +5 -0
- package/dist/Code/languages/dockerfile/index.js +47 -0
- package/dist/Code/languages/graphql/index.d.ts +5 -0
- package/dist/Code/languages/graphql/index.js +24 -0
- package/dist/Code/languages/java/index.d.ts +5 -0
- package/dist/Code/languages/java/index.js +17 -0
- package/dist/Code/languages/lua/index.d.ts +5 -0
- package/dist/Code/languages/lua/index.js +14 -0
- package/dist/Code/languages/objective-c/index.d.ts +5 -0
- package/dist/Code/languages/objective-c/index.js +29 -0
- package/dist/Code/languages/powershell/index.d.ts +5 -0
- package/dist/Code/languages/powershell/index.js +36 -0
- package/dist/Code/languages/ruby/index.d.ts +5 -0
- package/dist/Code/languages/ruby/index.js +21 -0
- package/dist/Code/languages/thrift/index.d.ts +5 -0
- package/dist/Code/languages/thrift/index.js +15 -0
- package/dist/Code/languages/toml/index.d.ts +5 -0
- package/dist/Code/languages/toml/index.js +55 -0
- package/dist/{CodeBlock-ZluDuBT7.js → CodeBlock-BkqcfoZ1.js} +309 -96
- package/dist/Collapsible/index.d.ts +1 -1
- package/dist/Collapsible/index.js +1 -1
- package/dist/{Collapsible-B_9H2wV_.js → Collapsible-BKt7UCeF.js} +1 -1
- package/dist/CommandPalette/index.d.ts +1 -1
- package/dist/CommandPalette/index.js +1 -1
- package/dist/{CommandPalette-Cbr-WWC8.js → CommandPalette-CvOeE6i-.js} +1 -1
- package/dist/ComplexSelector/index.d.ts +1 -1
- package/dist/ComplexSelector/index.js +1 -1
- package/dist/{ComplexSelector-BPvBCUJk.js → ComplexSelector-CVEfoN0k.js} +2 -2
- package/dist/ContextMenu/index.d.ts +1 -1
- package/dist/ContextMenu/index.js +2 -2
- package/dist/{ContextMenu-BF4ALBZn.js → ContextMenu-ZqWtb5Si.js} +2 -2
- package/dist/DateInput/index.d.ts +1 -1
- package/dist/DateInput/index.js +1 -1
- package/dist/{DateInput-C7PICKR2.js → DateInput-7FFzOvcu.js} +2 -2
- package/dist/DateRangeInput/index.d.ts +1 -1
- package/dist/DateRangeInput/index.js +1 -1
- package/dist/{DateRangeInput-Dt-BA7AA.js → DateRangeInput-C0ICAvm7.js} +3 -3
- package/dist/DateTimeInput/index.d.ts +1 -1
- package/dist/DateTimeInput/index.js +1 -1
- package/dist/{DateTimeInput-XEESzGJf.js → DateTimeInput-CaX09wfm.js} +4 -4
- package/dist/Dialog/index.d.ts +1 -1
- package/dist/Dialog/index.js +1 -1
- package/dist/{DialogHeader-DcP4xAk3.js → DialogHeader-DLaiYrvF.js} +1 -1
- package/dist/Drawer/index.d.ts +1 -1
- package/dist/Drawer/index.js +1 -1
- package/dist/{Drawer-CdHbZffI.js → Drawer-BpuER-VT.js} +1 -1
- package/dist/DropdownMenu/index.js +2 -2
- package/dist/{DropdownMenu-C1494BkC.js → DropdownMenu-K8JPIcSk.js} +4 -4
- package/dist/Field/index.js +3 -3
- package/dist/{Field-KszpxUdx.js → Field-CjC4qc2q.js} +1 -1
- package/dist/{FieldInfoTip-CY9BTVtK.js → FieldInfoTip-Cu4LNidQ.js} +1 -1
- package/dist/{FieldLabel-KPCTcJpO.js → FieldLabel-BFBAGrFY.js} +1 -1
- package/dist/FileInput/index.js +1 -1
- package/dist/{FileInput-BTIn6OoY.js → FileInput-DFsbOoe-.js} +3 -3
- package/dist/HoverCard/index.d.ts +1 -1
- package/dist/IconButton/index.js +1 -1
- package/dist/{IconButton-e5xeGow-.js → IconButton-BPjZPGRy.js} +1 -1
- package/dist/InfoTip/index.d.ts +1 -1
- package/dist/InfoTip/index.js +1 -1
- package/dist/{InfoTip-DpvV8zrm.js → InfoTip-DqDgJRtp.js} +1 -1
- package/dist/{InputClearButton-BzxJH6mk.js → InputClearButton-BZzOtoH7.js} +1 -1
- package/dist/InputGroup/index.js +1 -1
- package/dist/{InputGroup-Bj4hksiI.js → InputGroup-BN6v-b9L.js} +1 -1
- package/dist/InternationalizationProvider/index.d.ts +1 -1
- package/dist/InternationalizationProvider/index.js +1 -1
- package/dist/{InternationalizationProvider-BGtwZDY0.js → InternationalizationProvider-DzNfleAX.js} +1 -1
- package/dist/{Item-D62Cibn1.js → Item-BzjepDWA.js} +1 -1
- package/dist/Lightbox/index.js +1 -1
- package/dist/{Lightbox-FWtAn7X5.js → Lightbox-K2cAUZRG.js} +1 -1
- package/dist/Link/index.d.ts +1 -1
- package/dist/Link/index.js +1 -1
- package/dist/{Link-BxK3lbA-.js → Link-v-K2lhCh.js} +1 -1
- package/dist/List/index.d.ts +1 -1
- package/dist/List/index.js +2 -2
- package/dist/{ListItem-B4jt3EXr.js → ListItem-BTcwwpFb.js} +2 -2
- package/dist/Markdown/index.d.ts +1 -1
- package/dist/Markdown/index.js +2 -2
- package/dist/Markdown/parser/index.js +1 -1
- package/dist/{Markdown-CsoseOGe.js → Markdown-B4WsMYzN.js} +80 -5
- package/dist/MetadataList/index.d.ts +1 -1
- package/dist/MoreMenu/index.d.ts +1 -1
- package/dist/MoreMenu/index.js +1 -1
- package/dist/{MoreMenu-4zcxptan.js → MoreMenu-BF9qhsxq.js} +3 -3
- package/dist/MultiSelector/index.d.ts +1 -1
- package/dist/MultiSelector/index.js +1 -1
- package/dist/{MultiSelector-LuAE71wE.js → MultiSelector-CDMoxGKV.js} +3 -3
- package/dist/NavItem/index.js +1 -1
- package/dist/{NavItem-mcmzIshL.js → NavItem-DUnSwKRl.js} +1 -1
- package/dist/NavMenu/index.js +2 -2
- package/dist/{NavMenu-Bp35Bk7_.js → NavMenu-DAnQr1S5.js} +1 -1
- package/dist/{NavMenuItem-DviXkleh.js → NavMenuItem-CrTUxgBP.js} +2 -2
- package/dist/NumberInput/index.d.ts +1 -1
- package/dist/NumberInput/index.js +1 -1
- package/dist/{NumberInput-CxzhFPQw.js → NumberInput-DQ7FMUTd.js} +3 -3
- package/dist/Outline/index.js +1 -1
- package/dist/{Outline-KpA-ffCT.js → Outline-CSHJqtg4.js} +2 -2
- package/dist/OverflowList/index.d.ts +1 -1
- package/dist/OverflowList/index.js +1 -1
- package/dist/{OverflowList-DRZxrAYq.js → OverflowList-CK6sgmY3.js} +1 -1
- package/dist/Pagination/index.js +1 -1
- package/dist/{Pagination-B3JMAlnl.js → Pagination-B-337WLy.js} +2 -2
- package/dist/{PanGestureRecognizer-R5y8LZ9h.js → PanGestureRecognizer-yYMpXB93.js} +1 -1
- package/dist/Popover/index.d.ts +1 -1
- package/dist/Popover/index.js +1 -1
- package/dist/{Popover-CQr95J2s.js → Popover-DVrWAYg2.js} +1 -1
- package/dist/PowerSearch/index.d.ts +1 -1
- package/dist/PowerSearch/index.js +1 -1
- package/dist/{PowerSearch-BEaqgsZa.js → PowerSearch-sWyeh9Az.js} +19 -19
- package/dist/{PressTracker-Dze87pxw.js → PressTracker-CjfG1d8n.js} +2 -2
- package/dist/ProgressBar/index.d.ts +1 -1
- package/dist/Radio/index.d.ts +1 -1
- package/dist/Radio/index.js +1 -1
- package/dist/{RadioGroup-CpMYh9eL.js → RadioGroup-BloTgj7H.js} +4 -4
- package/dist/RadioList/index.d.ts +1 -1
- package/dist/RadioList/index.js +1 -1
- package/dist/{RadioListItem-n-h5r1GO.js → RadioListItem-BERujpW8.js} +1 -1
- package/dist/Resizable/index.d.ts +1 -1
- package/dist/ScrollableArea/index.d.ts +1 -1
- package/dist/SegmentedControl/index.js +1 -1
- package/dist/{SegmentedControl-nz9d6e0y.js → SegmentedControl-BzvLJL8T.js} +6 -6
- package/dist/SelectableCard/index.d.ts +1 -1
- package/dist/SelectableCard/index.js +1 -1
- package/dist/{SelectableCard-C018jluo.js → SelectableCard-IAv2X4dq.js} +1 -1
- package/dist/Selector/index.d.ts +1 -1
- package/dist/Selector/index.js +1 -1
- package/dist/{Selector-CW1jaM4F.js → Selector-CsEWOfWV.js} +1 -1
- package/dist/SideNav/index.d.ts +1 -1
- package/dist/SideNav/index.js +1 -1
- package/dist/{SideNav-DgRpBPuP.js → SideNav-CVAi462m.js} +2 -2
- package/dist/Slider/index.js +1 -1
- package/dist/{Slider-Bz72itTP.js → Slider-D0omHlRI.js} +5 -5
- package/dist/Stack/index.d.ts +1 -1
- package/dist/Stepper/index.d.ts +1 -1
- package/dist/Stepper/index.js +1 -1
- package/dist/{Stepper-Af_rH8C4.js → Stepper-CetoMTog.js} +1 -1
- package/dist/Switch/index.d.ts +1 -1
- package/dist/Switch/index.js +1 -1
- package/dist/{Switch-BYsb1gKn.js → Switch-DTwurKmh.js} +6 -6
- package/dist/TabList/index.d.ts +1 -1
- package/dist/TabList/index.js +1 -1
- package/dist/{TabList-Cgw2IuL-.js → TabList-BJTT4nm6.js} +2 -2
- package/dist/Table/index.d.ts +1 -1
- package/dist/Table/index.js +1 -1
- package/dist/{Table-DzE-4_og.js → Table-CUqi9BXT.js} +11 -11
- package/dist/TextArea/index.d.ts +1 -1
- package/dist/TextArea/index.js +1 -1
- package/dist/{TextArea-DrYMTaZm.js → TextArea-BKwmXPGQ.js} +4 -4
- package/dist/TextInput/index.d.ts +1 -1
- package/dist/TextInput/index.js +1 -1
- package/dist/{TextInput-B-1cuwcB.js → TextInput-CRXs8cDs.js} +4 -4
- package/dist/Thumbnail/index.js +1 -1
- package/dist/{Thumbnail-DeMaRkDU.js → Thumbnail-GUwgnwZb.js} +2 -2
- package/dist/{TimeField-C1Nv-fz3.js → TimeField-Bn_ziTCi.js} +1 -1
- package/dist/TimeInput/index.d.ts +1 -1
- package/dist/TimeInput/index.js +1 -1
- package/dist/{TimeInput-Dvh6qqHI.js → TimeInput-BKkwmN1V.js} +2 -2
- package/dist/Timestamp/index.d.ts +1 -1
- package/dist/Timestamp/index.js +1 -1
- package/dist/{Timestamp-wFkl39dn.js → Timestamp-Dlz2SvSe.js} +1 -1
- package/dist/Toast/index.js +1 -1
- package/dist/{Toast-CO6Z1r1s.js → Toast-BSnsRCyB.js} +3 -3
- package/dist/ToggleButton/index.d.ts +1 -1
- package/dist/ToggleButton/index.js +1 -1
- package/dist/{ToggleButton-DPpjDYxP.js → ToggleButton-DE79lIQq.js} +3 -3
- package/dist/Token/index.js +1 -1
- package/dist/{Token-DZkUAIYA.js → Token-BdClMOG9.js} +1 -1
- package/dist/Tokenizer/index.d.ts +1 -1
- package/dist/Tokenizer/index.js +1 -1
- package/dist/{Tokenizer-CX7D4klL.js → Tokenizer-BitI30VU.js} +5 -5
- package/dist/Toolbar/index.d.ts +1 -1
- package/dist/Tooltip/index.d.ts +1 -1
- package/dist/TopNav/index.d.ts +1 -1
- package/dist/TopNav/index.js +1 -1
- package/dist/{TopNav-D8Hc_kQ-.js → TopNav-BUjEldSq.js} +2 -2
- package/dist/TreeList/index.js +1 -1
- package/dist/{TreeList-lNyuRBOk.js → TreeList-BVJ3V-xI.js} +1 -1
- package/dist/Typeahead/index.js +1 -1
- package/dist/{Typeahead-BiosTaFo.js → Typeahead-C54ao2ye.js} +3 -3
- package/dist/{accessibleName-f5xApbXG.js → accessibleName-19W3jhkD.js} +1 -1
- package/dist/{boxHold-YML2o6iP.js → boxHold-0ChMpiin.js} +1 -1
- package/dist/code-block-DCVrTLMZ.js +19 -0
- package/dist/composables/index.js +4 -4
- package/dist/{composables-CPDafrux.js → composables-CF2weN-L.js} +2 -2
- package/dist/{geometry-CGa3nNzZ.js → geometry-BnZ6uDX_.js} +1 -1
- package/dist/grammar-4Pn2745Q.d.ts +58 -0
- package/dist/grammar-Dz71GleT.js +144 -0
- package/dist/{index-B6GTqpW-.d.ts → index--kbwaSXW.d.ts} +3 -3
- package/dist/{index-CQi9WGWE.d.ts → index-AgTJRqUY.d.ts} +2 -2
- package/dist/{index-CTv55aOa.d.ts → index-BRr_eg_u.d.ts} +1 -1
- package/dist/{index-ChqMaV6N.d.ts → index-BZDl_iLU.d.ts} +61 -13
- package/dist/{index-BB9acgK8.d.ts → index-BgT6mH3U.d.ts} +1 -1
- package/dist/{index-C1e8LNx2.d.ts → index-BjqoHLMq.d.ts} +1 -1
- package/dist/{index-DofC9Rll.d.ts → index-BtqvPjAf.d.ts} +1 -1
- package/dist/{index-CZ29Xu_E.d.ts → index-Bwh8O-v8.d.ts} +1 -1
- package/dist/{index-BdICULsZ.d.ts → index-CArlEl1O.d.ts} +555 -159
- package/dist/{index-Bgk1Rj2A.d.ts → index-CTjkJP4x.d.ts} +1 -1
- package/dist/{index-a_FOKJMw.d.ts → index-CbA8rR_b.d.ts} +2 -2
- package/dist/{index-jz9GfvS0.d.ts → index-CdvmnNMH.d.ts} +1 -1
- package/dist/{index-DhrnMYVh.d.ts → index-D1C2Nt3F.d.ts} +2 -2
- package/dist/{index-BVx-HFp8.d.ts → index-D9t_l8pJ.d.ts} +1 -1
- package/dist/{index-CukA-J8A.d.ts → index-DHsYyqMP.d.ts} +9 -9
- package/dist/{index-DYabo8TI.d.ts → index-DPhQZXYw.d.ts} +1 -1
- package/dist/{index-CUuUoX3h.d.ts → index-JE1HrzdJ.d.ts} +3 -3
- package/dist/{index-utZGF4GR.d.ts → index-NOXYEdOI.d.ts} +1 -1
- package/dist/{index-DN5Ga_Zm.d.ts → index-QC9FDUDA.d.ts} +3 -3
- package/dist/{index-CpkQlo1t.d.ts → index-V6uruC4Z.d.ts} +2 -2
- package/dist/{index-tdOyqA_U.d.ts → index-a6o69uPN.d.ts} +2 -2
- package/dist/{index-C9uW39Mj.d.ts → index-mK1ICsVg.d.ts} +3 -3
- package/dist/{index-DlsrR4Gm.d.ts → index-uLDBzCDo.d.ts} +10 -10
- package/dist/{index-ql9ApSTF.d.ts → index-yQc-te9a.d.ts} +2 -2
- package/dist/index.d.ts +27 -27
- package/dist/index.js +80 -78
- package/dist/{loadCatalog-BODWYaNy.d.ts → loadCatalog-C_Cy_8WN.d.ts} +2 -0
- package/dist/{loadCatalog-DMOOMWtw.js → loadCatalog-VlWGFIMU.js} +6 -17
- package/dist/locale/index.d.ts +2 -2
- package/dist/locale/index.js +3 -2
- package/dist/{locale-C8X7gJlc.js → locale-U0KLmREA.js} +1 -1
- package/dist/{pressFeedback--_INTed0.js → pressFeedback-B3cqaMGl.js} +1 -1
- package/dist/{publicParser-C8RBKNLA.js → publicParser-Dbu2LRTf.js} +2 -2
- package/dist/{useActionGroupTracking-BTjuGF9J.js → useActionGroupTracking-D0IwimcQ.js} +2 -2
- package/dist/{useInputStatusIcon-Bl2JFlc3.js → useInputStatusIcon-C2AkJiAT.js} +1 -1
- package/dist/{useMenuPress-CF1GHP_7.js → useMenuPress-B5h9PBx_.js} +1 -1
- package/dist/{usePressFeedback-B_NavJu0.js → usePressFeedback-iyoKakPX.js} +1 -1
- package/dist/{useTouchHitArea-BpEJXuu-.js → useTouchHitArea-MvzPCmJg.js} +1 -1
- package/package.json +37 -1
- package/reset.css +14 -0
- package/styles/code.css +85 -8
- package/styles/markdown.css +6 -5
- package/styles/progress-bar.css +25 -26
- package/dist/index-C9ZssPUV.d.ts +0 -380
|
@@ -1,12 +1,17 @@
|
|
|
1
|
+
import { t as hasSlotContent } from "./slotContent-CNWOrGOr.js";
|
|
1
2
|
import { t as _sfc_main$3 } from "./Icon-Dk0jccgU.js";
|
|
2
3
|
import { t as _sfc_main$4 } from "./VisuallyHidden-cpmsV-0M.js";
|
|
3
4
|
import { n as isDevBuild, t as devPropError } from "./devBuild-G249YcdZ.js";
|
|
4
5
|
import { t as useClipboard } from "./useClipboard-CTY3GwFz.js";
|
|
5
|
-
import { t as _sfc_main$5 } from "./IconButton-
|
|
6
|
+
import { t as _sfc_main$5 } from "./IconButton-BPjZPGRy.js";
|
|
7
|
+
import { o as useComponentMessages } from "./context-B8IEFCDR.js";
|
|
8
|
+
import { t as useScrollableArea } from "./useScrollableArea-BaHkGWbX.js";
|
|
6
9
|
import { t as useScrollbars } from "./useScrollbars-Ch0xqJWO.js";
|
|
7
10
|
import { t as _sfc_main$6 } from "./ComponentIcon-Dw4xQxg3.js";
|
|
11
|
+
import { t as codeBlockMessages } from "./code-block-DCVrTLMZ.js";
|
|
12
|
+
import { _ as isCustomCodeLanguage, a as DIRECTIVE, f as cLike, i as C_WORDS, l as NUMBER, n as CALL, p as codeLanguagePainter, r as CPP_WORDS, t as BLOCK_COMMENT, u as PUNCTUATION, v as languageKey, y as languageLabel } from "./grammar-Dz71GleT.js";
|
|
8
13
|
import { a as syntaxThemeStyle } from "./syntaxTheme-R7xnu5x5.js";
|
|
9
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeProps, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, openBlock, ref, renderList, renderSlot, toDisplayString, unref, useAttrs, useId, useTemplateRef, watch, withCtx, withModifiers } from "vue";
|
|
14
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeProps, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, openBlock, ref, renderList, renderSlot, shallowRef, toDisplayString, unref, useAttrs, useId, useSlots, useTemplateRef, watch, withCtx, withModifiers } from "vue";
|
|
10
15
|
import "../styles/code.css";
|
|
11
16
|
//#region src/Code/Code.vue
|
|
12
17
|
const _hoisted_1$2 = ["data-color", "data-size"];
|
|
@@ -24,6 +29,7 @@ const _sfc_main$2 = /*@__PURE__*/ defineComponent({
|
|
|
24
29
|
return openBlock(), createElementBlock("code", {
|
|
25
30
|
ref_key: "root",
|
|
26
31
|
ref: root,
|
|
32
|
+
dir: "ltr",
|
|
27
33
|
class: "astryx-code",
|
|
28
34
|
"data-color": __props.color,
|
|
29
35
|
"data-size": __props.size
|
|
@@ -111,7 +117,7 @@ function describeTokenType(type) {
|
|
|
111
117
|
}
|
|
112
118
|
const name = CSS.escape(`astryx-${type}`);
|
|
113
119
|
const color = `var(${CSS.escape(`--astryx-code-syntax-${type}`)}, currentColor)`;
|
|
114
|
-
dynamicStyles.sheet?.insertRule(
|
|
120
|
+
dynamicStyles.sheet?.insertRule(`@layer astryx.components { .astryx-code-block code::highlight(${name}) { color: ${color}; } }`);
|
|
115
121
|
}
|
|
116
122
|
function resolveHighlight(type) {
|
|
117
123
|
if (typeof CSS === "undefined") return null;
|
|
@@ -258,7 +264,8 @@ const _hoisted_4$1 = {
|
|
|
258
264
|
};
|
|
259
265
|
const _hoisted_5$1 = {
|
|
260
266
|
key: 1,
|
|
261
|
-
class: "astryx-code-block__line-content"
|
|
267
|
+
class: "astryx-code-block__line-content",
|
|
268
|
+
dir: "auto"
|
|
262
269
|
};
|
|
263
270
|
const _hoisted_6$1 = {
|
|
264
271
|
key: 2,
|
|
@@ -281,13 +288,30 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
|
281
288
|
mode: {},
|
|
282
289
|
scrollLabel: {},
|
|
283
290
|
size: {},
|
|
291
|
+
startLineNumber: {},
|
|
284
292
|
tokenLines: {}
|
|
285
293
|
},
|
|
286
294
|
setup(__props) {
|
|
287
295
|
const props = __props;
|
|
288
296
|
const code = useTemplateRef("code");
|
|
289
|
-
const scrollEl =
|
|
297
|
+
const scrollEl = shallowRef(null);
|
|
290
298
|
useScrollbars(scrollEl);
|
|
299
|
+
const scrollArea = useScrollableArea({
|
|
300
|
+
axis: "inline",
|
|
301
|
+
keyboardAccess: { owner: "content" }
|
|
302
|
+
});
|
|
303
|
+
function bindScroll(element) {
|
|
304
|
+
scrollEl.value = element instanceof HTMLElement ? element : null;
|
|
305
|
+
scrollArea.viewport(element);
|
|
306
|
+
}
|
|
307
|
+
const fadeAttrs = computed(() => {
|
|
308
|
+
const { inline } = scrollArea.state.value;
|
|
309
|
+
return {
|
|
310
|
+
"data-scrollable-inline": inline.isScrollable ? "true" : void 0,
|
|
311
|
+
"data-scroll-inline-start": inline.atStart ? "true" : void 0,
|
|
312
|
+
"data-scroll-inline-end": inline.atEnd ? "true" : void 0
|
|
313
|
+
};
|
|
314
|
+
});
|
|
291
315
|
const chunks = computed(() => {
|
|
292
316
|
const lines = props.lines;
|
|
293
317
|
if (lines.length < CHUNK_THRESHOLD) return [{
|
|
@@ -353,12 +377,12 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
|
353
377
|
}
|
|
354
378
|
const codeStyle = computed(() => {
|
|
355
379
|
const style = {};
|
|
356
|
-
if (props.hasLineNumbers) style["--astryx-code-block-gutter-width"] = `${String(props.lines.length).length}ch`;
|
|
380
|
+
if (props.hasLineNumbers) style["--astryx-code-block-gutter-width"] = `${String(props.startLineNumber + props.lines.length - 1).length}ch`;
|
|
357
381
|
return style;
|
|
358
382
|
});
|
|
359
383
|
const scrollStyle = computed(() => props.maxHeight == null ? void 0 : { maxHeight: typeof props.maxHeight === "number" ? `${props.maxHeight}px` : props.maxHeight });
|
|
360
384
|
function isHighlighted(index) {
|
|
361
|
-
return props.highlightSet?.has(
|
|
385
|
+
return props.highlightSet?.has(props.startLineNumber + index) ?? false;
|
|
362
386
|
}
|
|
363
387
|
let removeRanges = null;
|
|
364
388
|
function paintRanges() {
|
|
@@ -378,14 +402,15 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
|
378
402
|
});
|
|
379
403
|
onBeforeUnmount(() => removeRanges?.());
|
|
380
404
|
return (_ctx, _cache) => {
|
|
381
|
-
return openBlock(), createElementBlock("div", {
|
|
382
|
-
ref:
|
|
405
|
+
return openBlock(), createElementBlock("div", mergeProps({
|
|
406
|
+
ref: bindScroll,
|
|
383
407
|
class: "astryx-code-block__scroll",
|
|
408
|
+
dir: "ltr",
|
|
384
409
|
role: "group",
|
|
385
410
|
tabindex: "0",
|
|
386
411
|
"aria-label": __props.scrollLabel,
|
|
387
|
-
style:
|
|
388
|
-
}, [createElementVNode("div", { class: normalizeClass(["astryx-code-block__wrap", { "astryx-code-block__wrap--compact": __props.isCompact }]) }, [createElementVNode("code", {
|
|
412
|
+
style: scrollStyle.value
|
|
413
|
+
}, fadeAttrs.value), [createElementVNode("div", { class: normalizeClass(["astryx-code-block__wrap", { "astryx-code-block__wrap--compact": __props.isCompact }]) }, [createElementVNode("code", {
|
|
389
414
|
ref_key: "code",
|
|
390
415
|
ref: code,
|
|
391
416
|
class: "astryx-code-block__code",
|
|
@@ -407,7 +432,7 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
|
407
432
|
"astryx-code-block__line--numbered": __props.hasLineNumbers
|
|
408
433
|
}]),
|
|
409
434
|
"data-diff": diffKind(chunk.start + offset),
|
|
410
|
-
"data-line": chunk.start + offset
|
|
435
|
+
"data-line": __props.startLineNumber + chunk.start + offset
|
|
411
436
|
}, [__props.diff != null ? (openBlock(), createElementBlock("span", _hoisted_4$1, toDisplayString(glyph(chunk.start + offset)), 1)) : createCommentVNode("v-if", true), __props.mode === "spans" || __props.diff != null ? (openBlock(), createElementBlock("span", _hoisted_5$1, [(openBlock(true), createElementBlock(Fragment, null, renderList(lineParts.value[chunk.start + offset], (part, index) => {
|
|
412
437
|
return openBlock(), createElementBlock(Fragment, { key: index }, [part.type != null ? (openBlock(), createElementBlock("span", {
|
|
413
438
|
key: 0,
|
|
@@ -415,7 +440,7 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
|
415
440
|
}, toDisplayString(part.text), 3)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(part.text), 1)], 64))], 64);
|
|
416
441
|
}), 128))])) : (openBlock(), createElementBlock("span", _hoisted_6$1, toDisplayString(line || ""), 1))], 10, _hoisted_3$1);
|
|
417
442
|
}), 128))], 6);
|
|
418
|
-
}), 128))], 12, _hoisted_2$1)], 2)],
|
|
443
|
+
}), 128))], 12, _hoisted_2$1)], 2)], 16, _hoisted_1$1);
|
|
419
444
|
};
|
|
420
445
|
}
|
|
421
446
|
});
|
|
@@ -502,6 +527,119 @@ function fileHeaderLines(lines) {
|
|
|
502
527
|
return headers;
|
|
503
528
|
}
|
|
504
529
|
//#endregion
|
|
530
|
+
//#region src/Code/builtinGrammars.ts
|
|
531
|
+
/** Built-in grammars for C, C++, SQL, Rust, Kotlin, Swift and Go; null for any other identifier. */
|
|
532
|
+
function buildSystemLanguagePatterns(lang) {
|
|
533
|
+
switch (lang) {
|
|
534
|
+
case "c":
|
|
535
|
+
case "h": return cLike(C_WORDS, [{
|
|
536
|
+
type: "keyword",
|
|
537
|
+
regex: DIRECTIVE
|
|
538
|
+
}]);
|
|
539
|
+
case "cpp":
|
|
540
|
+
case "c++":
|
|
541
|
+
case "cc":
|
|
542
|
+
case "cxx":
|
|
543
|
+
case "hpp":
|
|
544
|
+
case "hh": return cLike(CPP_WORDS, [{
|
|
545
|
+
type: "keyword",
|
|
546
|
+
regex: DIRECTIVE
|
|
547
|
+
}, {
|
|
548
|
+
type: "string",
|
|
549
|
+
regex: /\b(?:u8|[uUL])?R"([^()\\\s]{0,16})\([\s\S]*?\)\1"/
|
|
550
|
+
}]);
|
|
551
|
+
case "sql": return {
|
|
552
|
+
defaultType: "variable",
|
|
553
|
+
patterns: [
|
|
554
|
+
{
|
|
555
|
+
type: "comment",
|
|
556
|
+
regex: /--[^\n]*/
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
type: "comment",
|
|
560
|
+
regex: BLOCK_COMMENT
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
type: "string",
|
|
564
|
+
regex: /'(?:[^']|'')*'/
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
type: "property",
|
|
568
|
+
regex: /"[^"\n]*"|`[^`\n]*`/
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
type: "number",
|
|
572
|
+
regex: NUMBER
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
type: "keyword",
|
|
576
|
+
regex: /\b(?:select|from|where|and|or|not|in|is|null|as|join|inner|left|right|full|outer|cross|on|group|by|order|having|limit|offset|union|all|distinct|insert|into|values|update|set|delete|create|table|view|index|drop|alter|add|primary|key|foreign|references|with|case|when|then|else|end|exists|between|like|asc|desc|true|false|default|returning|interval)\b/i
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
type: "function",
|
|
580
|
+
regex: CALL
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
type: "operator",
|
|
584
|
+
regex: /[+\-*/%=<>!|]+/
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
type: "punctuation",
|
|
588
|
+
regex: PUNCTUATION
|
|
589
|
+
}
|
|
590
|
+
]
|
|
591
|
+
};
|
|
592
|
+
case "rust":
|
|
593
|
+
case "rs": return cLike("as async await break const continue crate dyn else enum extern false fn for if impl in let loop match mod move mut pub ref return self Self static struct super trait true type unsafe use where while", [
|
|
594
|
+
{
|
|
595
|
+
type: "constant",
|
|
596
|
+
regex: /#!?\[[^\]\n]*\]/
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
type: "function",
|
|
600
|
+
regex: /\b[a-z_]\w*!(?=\s*[([{])/i
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
type: "string",
|
|
604
|
+
regex: /\bb?r(#*)"[\s\S]*?"\1/
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
type: "type",
|
|
608
|
+
regex: /'[a-z_]\w*\b(?!')/
|
|
609
|
+
}
|
|
610
|
+
]);
|
|
611
|
+
case "kotlin":
|
|
612
|
+
case "kt":
|
|
613
|
+
case "kts": return cLike("as break class continue do else false for fun if in interface is null object package return super this throw true try typealias val var when while by constructor init companion data sealed enum open override private protected public internal suspend inline lateinit import", [{
|
|
614
|
+
type: "constant",
|
|
615
|
+
regex: /@\w+/
|
|
616
|
+
}, {
|
|
617
|
+
type: "string",
|
|
618
|
+
regex: /"""[\s\S]*?"""/
|
|
619
|
+
}]);
|
|
620
|
+
case "swift": return cLike("associatedtype class deinit enum extension func import init inout internal let open operator private protocol public static struct subscript typealias var break case continue default defer do else fallthrough for guard if in repeat return switch where while as catch false is nil rethrows super self Self throw throws true try async await actor some any", [
|
|
621
|
+
{
|
|
622
|
+
type: "string",
|
|
623
|
+
regex: /(#+)"[\s\S]*?"\1/
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
type: "constant",
|
|
627
|
+
regex: /[@#]\w+/
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
type: "string",
|
|
631
|
+
regex: /"""[\s\S]*?"""/
|
|
632
|
+
}
|
|
633
|
+
]);
|
|
634
|
+
case "go":
|
|
635
|
+
case "golang": return cLike("break case chan const continue default defer else fallthrough for func go goto if import interface map package range return select struct switch type var true false nil iota", [{
|
|
636
|
+
type: "string",
|
|
637
|
+
regex: /`[^`]*`/
|
|
638
|
+
}]);
|
|
639
|
+
default: return null;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
//#endregion
|
|
505
643
|
//#region src/Code/tokenizer.ts
|
|
506
644
|
const langCache = /* @__PURE__ */ new Map();
|
|
507
645
|
const JS_KEYWORDS = /\b(const|let|var|function|class|if|else|for|while|return|import|export|from|default|async|await|try|catch|throw|new|typeof|instanceof|interface|type|enum|extends|implements|switch|case|break|continue|do|in|of|void|null|undefined|true|false|this|super|yield|delete|static|public|private|protected|readonly|abstract|as|is|keyof|declare|module|namespace|require)\b/;
|
|
@@ -1081,23 +1219,54 @@ function buildLanguagePatterns(lang) {
|
|
|
1081
1219
|
}
|
|
1082
1220
|
]
|
|
1083
1221
|
};
|
|
1084
|
-
default: return
|
|
1222
|
+
default: return buildSystemLanguagePatterns(lang);
|
|
1085
1223
|
}
|
|
1086
1224
|
}
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
const definition = raw == null ? null : {
|
|
1225
|
+
/** How each language value paints, compiled once per value. */
|
|
1226
|
+
const valueCache = /* @__PURE__ */ new WeakMap();
|
|
1227
|
+
function compile(raw) {
|
|
1228
|
+
return {
|
|
1092
1229
|
defaultType: raw.defaultType,
|
|
1093
1230
|
patterns: raw.patterns.map((pattern) => ({
|
|
1094
1231
|
...pattern,
|
|
1095
1232
|
anchored: new RegExp(pattern.regex.source, `${pattern.regex.flags.replace(/[gy]/g, "")}y`)
|
|
1096
1233
|
}))
|
|
1097
1234
|
};
|
|
1098
|
-
|
|
1235
|
+
}
|
|
1236
|
+
/**
|
|
1237
|
+
* How `language` paints: a compiled grammar (a built-in identifier, or an
|
|
1238
|
+
* Astryx module), a custom tokenize function, or null (plain code). An
|
|
1239
|
+
* identifier string selects only a built-in grammar.
|
|
1240
|
+
*/
|
|
1241
|
+
function resolveLanguage(language) {
|
|
1242
|
+
if (typeof language !== "string") {
|
|
1243
|
+
const cachedValue = valueCache.get(language);
|
|
1244
|
+
if (cachedValue !== void 0) return cachedValue;
|
|
1245
|
+
const painter = codeLanguagePainter(language);
|
|
1246
|
+
const resolved = painter == null ? null : painter.kind === "grammar" ? compile(painter.grammar) : {
|
|
1247
|
+
tokenize: painter.tokenize,
|
|
1248
|
+
name: language.name
|
|
1249
|
+
};
|
|
1250
|
+
valueCache.set(language, resolved);
|
|
1251
|
+
return resolved;
|
|
1252
|
+
}
|
|
1253
|
+
const cached = langCache.get(language);
|
|
1254
|
+
if (cached !== void 0) return cached;
|
|
1255
|
+
const raw = buildLanguagePatterns(language);
|
|
1256
|
+
const definition = raw == null ? null : compile(raw);
|
|
1257
|
+
langCache.set(language, definition);
|
|
1099
1258
|
return definition;
|
|
1100
1259
|
}
|
|
1260
|
+
/** A compiled grammar for `language`, or null for a custom or plain one. */
|
|
1261
|
+
function buildLanguage(language) {
|
|
1262
|
+
const resolved = resolveLanguage(language);
|
|
1263
|
+
return resolved != null && "patterns" in resolved ? resolved : null;
|
|
1264
|
+
}
|
|
1265
|
+
/** The tokens of a custom language, or null when `language` is not one. */
|
|
1266
|
+
function customTokens(code, language) {
|
|
1267
|
+
const resolved = resolveLanguage(language);
|
|
1268
|
+
return resolved != null && "tokenize" in resolved ? flatTokensToLines(resolved.tokenize(code, resolved.name), code) : null;
|
|
1269
|
+
}
|
|
1101
1270
|
/** Code shorter than this is tokenized synchronously instead of in chunks. */
|
|
1102
1271
|
const SYNC_TOKENIZE_THRESHOLD = 2e3;
|
|
1103
1272
|
const ASYNC_CHUNK_SIZE = 800;
|
|
@@ -1135,6 +1304,8 @@ function tokenizeLine(code, definition, lineStart, lineEnd) {
|
|
|
1135
1304
|
* to the start of the line.
|
|
1136
1305
|
*/
|
|
1137
1306
|
function tokenize(code, language) {
|
|
1307
|
+
const custom = customTokens(code, language);
|
|
1308
|
+
if (custom != null) return custom;
|
|
1138
1309
|
const definition = buildLanguage(language);
|
|
1139
1310
|
if (definition == null) return [];
|
|
1140
1311
|
const result = [];
|
|
@@ -1151,6 +1322,8 @@ function tokenize(code, language) {
|
|
|
1151
1322
|
* work and returns the lines tokenized so far.
|
|
1152
1323
|
*/
|
|
1153
1324
|
async function tokenizeAsync(code, language, signal) {
|
|
1325
|
+
const custom = customTokens(code, language);
|
|
1326
|
+
if (custom != null) return custom;
|
|
1154
1327
|
const definition = buildLanguage(language);
|
|
1155
1328
|
if (definition == null) return [];
|
|
1156
1329
|
const result = [];
|
|
@@ -1192,6 +1365,7 @@ function flatTokensToLines(tokens, code) {
|
|
|
1192
1365
|
//#region src/Code/CodeBlock.vue
|
|
1193
1366
|
const _hoisted_1 = [
|
|
1194
1367
|
"data-container",
|
|
1368
|
+
"data-corner",
|
|
1195
1369
|
"data-language",
|
|
1196
1370
|
"data-size"
|
|
1197
1371
|
];
|
|
@@ -1205,8 +1379,13 @@ const _hoisted_4 = {
|
|
|
1205
1379
|
key: 0,
|
|
1206
1380
|
class: "astryx-code-block__chevron"
|
|
1207
1381
|
};
|
|
1208
|
-
const _hoisted_5 =
|
|
1209
|
-
|
|
1382
|
+
const _hoisted_5 = {
|
|
1383
|
+
key: 0,
|
|
1384
|
+
class: "astryx-code-block__controls"
|
|
1385
|
+
};
|
|
1386
|
+
const _hoisted_6 = ["inert"];
|
|
1387
|
+
const _hoisted_7 = { class: "astryx-code-block__collapse-inner" };
|
|
1388
|
+
const _hoisted_8 = ["data-size"];
|
|
1210
1389
|
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
1211
1390
|
name: "AstryxCodeBlock",
|
|
1212
1391
|
inheritAttrs: false,
|
|
@@ -1224,6 +1403,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
1224
1403
|
type: Boolean,
|
|
1225
1404
|
default: false
|
|
1226
1405
|
},
|
|
1406
|
+
startLineNumber: { default: 1 },
|
|
1227
1407
|
highlightLines: {},
|
|
1228
1408
|
isDiff: {
|
|
1229
1409
|
type: Boolean,
|
|
@@ -1257,6 +1437,8 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
1257
1437
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
1258
1438
|
const props = __props;
|
|
1259
1439
|
const emit = __emit;
|
|
1440
|
+
const slots = useSlots();
|
|
1441
|
+
const messages = useComponentMessages({ codeBlock: codeBlockMessages });
|
|
1260
1442
|
if (isDevBuild() && typeof props.code !== "string") throw devPropError("CodeBlock", "code", "must be a string, for example <CodeBlock code=\"const a = 1;\" language=\"ts\" />. CodeBlock does not read its default slot.");
|
|
1261
1443
|
const attrs = useAttrs();
|
|
1262
1444
|
const root = useTemplateRef("root");
|
|
@@ -1277,8 +1459,8 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
1277
1459
|
const tokenSource = computed(() => diffLines.value?.content.join("\n") ?? props.code);
|
|
1278
1460
|
const syncTokenLines = computed(() => {
|
|
1279
1461
|
const source = tokenSource.value;
|
|
1280
|
-
if (props.tokenizer != null) return flatTokensToLines(props.tokenizer(source, props.language), source);
|
|
1281
|
-
if (source.length >= 2e3) return null;
|
|
1462
|
+
if (props.tokenizer != null) return flatTokensToLines(props.tokenizer(source, languageLabel(props.language)), source);
|
|
1463
|
+
if (source.length >= 2e3 && !isCustomCodeLanguage(props.language)) return null;
|
|
1282
1464
|
return tokenize(source, props.language);
|
|
1283
1465
|
});
|
|
1284
1466
|
const tokenLines = computed(() => {
|
|
@@ -1290,7 +1472,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
1290
1472
|
});
|
|
1291
1473
|
async function loadTokens() {
|
|
1292
1474
|
const source = tokenSource.value;
|
|
1293
|
-
if (props.tokenizer != null || source.length < 2e3) return;
|
|
1475
|
+
if (props.tokenizer != null || source.length < 2e3 || isCustomCodeLanguage(props.language)) return;
|
|
1294
1476
|
const code = source;
|
|
1295
1477
|
const language = props.language;
|
|
1296
1478
|
const controller = new AbortController();
|
|
@@ -1344,15 +1526,25 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
1344
1526
|
if (props.highlightMode === "ranges") return "ranges";
|
|
1345
1527
|
return isSafariBrowser.value ? "spans" : "ranges";
|
|
1346
1528
|
});
|
|
1529
|
+
/** 第一行的行号(文件里的真实行号)。小于 1 或不是有限数都按 1 算。 */
|
|
1530
|
+
const firstLineNumber = computed(() => Number.isFinite(props.startLineNumber) && props.startLineNumber > 1 ? Math.floor(props.startLineNumber) : 1);
|
|
1347
1531
|
const highlightSet = computed(() => props.highlightLines == null ? null : new Set(props.highlightLines));
|
|
1348
|
-
|
|
1532
|
+
/** 语言值显示它自己的名字,字符串显示它本身。 */
|
|
1533
|
+
const languageName = computed(() => languageLabel(props.language));
|
|
1534
|
+
/** `data-language`:字符串本身,语言值取第一个标识符。 */
|
|
1535
|
+
const dataLanguage = computed(() => languageKey(props.language));
|
|
1536
|
+
const languageLabel$1 = computed(() => {
|
|
1349
1537
|
if (!props.hasLanguageLabel) return null;
|
|
1350
|
-
if (props.isDiff) return
|
|
1351
|
-
return
|
|
1538
|
+
if (props.isDiff) return languageName.value === "plaintext" ? "diff" : messages.value.codeBlock.diffLabel(languageName.value);
|
|
1539
|
+
return languageName.value === "plaintext" ? null : languageName.value;
|
|
1352
1540
|
});
|
|
1353
1541
|
/** `filename — language`, omitting whichever half is missing. */
|
|
1354
|
-
const headerText = computed(() => [props.title, languageLabel.value].filter((part) => part != null && part !== "").join(" — "));
|
|
1542
|
+
const headerText = computed(() => [props.title, languageLabel$1.value].filter((part) => part != null && part !== "").join(" — "));
|
|
1355
1543
|
const showHeader = computed(() => headerText.value !== "");
|
|
1544
|
+
/** 调用方放在复制按钮前面的控件。它不会让代码块长出标题栏。 */
|
|
1545
|
+
const hasEndContent = computed(() => hasSlotContent(slots.endContent));
|
|
1546
|
+
/** 没有标题栏时,控件排在代码右边自己的一列里,不盖住代码。 */
|
|
1547
|
+
const hasCorner = computed(() => !showHeader.value && (props.hasCopyButton || hasEndContent.value));
|
|
1356
1548
|
const canCollapse = computed(() => showHeader.value && props.isCollapsible && lines.value.length >= props.collapsibleThreshold);
|
|
1357
1549
|
const isCollapsed = ref(false);
|
|
1358
1550
|
watch(canCollapse, () => {
|
|
@@ -1371,7 +1563,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
1371
1563
|
};
|
|
1372
1564
|
});
|
|
1373
1565
|
function headerLabel() {
|
|
1374
|
-
return !(props.title != null && props.title.trim() !== "") && languageLabel.value == null ? props.codeLabel : void 0;
|
|
1566
|
+
return !(props.title != null && props.title.trim() !== "") && languageLabel$1.value == null ? props.codeLabel : void 0;
|
|
1375
1567
|
}
|
|
1376
1568
|
function toggleCollapsed() {
|
|
1377
1569
|
isCollapsed.value = !isCollapsed.value;
|
|
@@ -1419,21 +1611,22 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
1419
1611
|
}, forwardedAttrs.value, {
|
|
1420
1612
|
class: ["astryx-code-block", unref(attrs).class],
|
|
1421
1613
|
"data-container": __props.container,
|
|
1422
|
-
"data-
|
|
1614
|
+
"data-corner": hasCorner.value || void 0,
|
|
1615
|
+
"data-language": dataLanguage.value,
|
|
1423
1616
|
"data-size": __props.size,
|
|
1424
1617
|
style: rootStyle.value
|
|
1425
1618
|
}), [
|
|
1426
|
-
_cache[
|
|
1619
|
+
_cache[24] || (_cache[24] = createTextVNode(" ", -1)),
|
|
1427
1620
|
showHeader.value ? (openBlock(), createElementBlock("div", {
|
|
1428
1621
|
key: 0,
|
|
1429
1622
|
class: normalizeClass(["astryx-code-block__header astryx-code-block-header", { "astryx-code-block__header--divided": __props.hasLineNumbers }]),
|
|
1430
1623
|
"data-container": __props.container,
|
|
1431
|
-
"data-language":
|
|
1624
|
+
"data-language": dataLanguage.value,
|
|
1432
1625
|
"data-size": __props.size
|
|
1433
1626
|
}, [
|
|
1434
|
-
_cache[
|
|
1627
|
+
_cache[11] || (_cache[11] = createTextVNode("\n ", -1)),
|
|
1435
1628
|
createCommentVNode(" eslint-disable-next-line vue-a11y/no-static-element-interactions -- the interactive role, tabindex, and aria state are bound from `titleControlAttrs`, which the rule cannot see; it is the disclosure control when collapsing is available. "),
|
|
1436
|
-
_cache[
|
|
1629
|
+
_cache[12] || (_cache[12] = createTextVNode("\n ", -1)),
|
|
1437
1630
|
createElementVNode("div", mergeProps(titleControlAttrs.value, {
|
|
1438
1631
|
class: ["astryx-code-block__title-control", { "astryx-code-block__title-control--collapsible": canCollapse.value }],
|
|
1439
1632
|
onClick: _cache[0] || (_cache[0] = ($event) => canCollapse.value && toggleCollapsed()),
|
|
@@ -1442,7 +1635,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
1442
1635
|
_cache[4] || (_cache[4] = createTextVNode("\n ", -1)),
|
|
1443
1636
|
createElementVNode("span", {
|
|
1444
1637
|
class: "astryx-code-block__title astryx-code-block-title",
|
|
1445
|
-
"data-language":
|
|
1638
|
+
"data-language": dataLanguage.value,
|
|
1446
1639
|
"data-size": __props.size
|
|
1447
1640
|
}, [
|
|
1448
1641
|
_cache[3] || (_cache[3] = createTextVNode("\n ", -1)),
|
|
@@ -1460,59 +1653,67 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
1460
1653
|
], 8, _hoisted_3),
|
|
1461
1654
|
_cache[5] || (_cache[5] = createTextVNode("\n ", -1))
|
|
1462
1655
|
], 16),
|
|
1463
|
-
_cache[
|
|
1464
|
-
__props.hasCopyButton ? (openBlock(),
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1656
|
+
_cache[13] || (_cache[13] = createTextVNode("\n ", -1)),
|
|
1657
|
+
__props.hasCopyButton || hasEndContent.value ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
1658
|
+
_cache[8] || (_cache[8] = createTextVNode("\n ", -1)),
|
|
1659
|
+
renderSlot(_ctx.$slots, "endContent"),
|
|
1660
|
+
_cache[9] || (_cache[9] = createTextVNode("\n ", -1)),
|
|
1661
|
+
__props.hasCopyButton ? (openBlock(), createBlock(_sfc_main$5, {
|
|
1662
|
+
key: 0,
|
|
1663
|
+
class: "astryx-code-block-copy-button",
|
|
1664
|
+
variant: "ghost",
|
|
1665
|
+
size: "sm",
|
|
1666
|
+
label: copyButtonLabel.value,
|
|
1667
|
+
tooltip: copyTooltip.value,
|
|
1668
|
+
onClick: withModifiers(onCopy, ["stop"])
|
|
1669
|
+
}, {
|
|
1670
|
+
default: withCtx(() => [
|
|
1671
|
+
_cache[6] || (_cache[6] = createTextVNode("\n ", -1)),
|
|
1672
|
+
createVNode(_sfc_main$6, {
|
|
1673
|
+
"icon-slot": "code-block-copy",
|
|
1674
|
+
state: { copied: unref(isCopied) },
|
|
1675
|
+
fallback: {
|
|
1676
|
+
icon: copyIcon.value,
|
|
1677
|
+
size: "sm"
|
|
1678
|
+
},
|
|
1679
|
+
color: "inherit"
|
|
1680
|
+
}, null, 8, ["state", "fallback"]),
|
|
1681
|
+
_cache[7] || (_cache[7] = createTextVNode("\n ", -1))
|
|
1682
|
+
]),
|
|
1683
|
+
_: 1
|
|
1684
|
+
}, 8, ["label", "tooltip"])) : createCommentVNode("v-if", true),
|
|
1685
|
+
_cache[10] || (_cache[10] = createTextVNode("\n ", -1))
|
|
1686
|
+
])) : createCommentVNode("v-if", true),
|
|
1687
|
+
_cache[14] || (_cache[14] = createTextVNode("\n ", -1))
|
|
1489
1688
|
], 10, _hoisted_2)) : createCommentVNode("v-if", true),
|
|
1490
|
-
_cache[
|
|
1689
|
+
_cache[25] || (_cache[25] = createTextVNode("\n ", -1)),
|
|
1491
1690
|
canCollapse.value ? (openBlock(), createElementBlock("div", {
|
|
1492
1691
|
key: 1,
|
|
1493
1692
|
id: regionId,
|
|
1494
1693
|
class: normalizeClass(["astryx-code-block__collapse", { "astryx-code-block__collapse--collapsed": isCollapsed.value }]),
|
|
1495
1694
|
inert: isCollapsed.value || void 0
|
|
1496
1695
|
}, [
|
|
1497
|
-
_cache[
|
|
1498
|
-
createElementVNode("div",
|
|
1499
|
-
_cache[
|
|
1696
|
+
_cache[17] || (_cache[17] = createTextVNode("\n ", -1)),
|
|
1697
|
+
createElementVNode("div", _hoisted_7, [
|
|
1698
|
+
_cache[15] || (_cache[15] = createTextVNode("\n ", -1)),
|
|
1500
1699
|
createVNode(_sfc_main$1, {
|
|
1501
1700
|
diff: diffLines.value,
|
|
1502
1701
|
"has-line-numbers": __props.hasLineNumbers,
|
|
1503
1702
|
"highlight-set": highlightSet.value,
|
|
1703
|
+
"start-line-number": firstLineNumber.value,
|
|
1504
1704
|
"is-compact": showHeader.value && !__props.hasLineNumbers,
|
|
1505
1705
|
"is-wrapped": __props.isWrapped,
|
|
1506
1706
|
lines: lines.value,
|
|
1507
1707
|
"max-height": __props.maxHeight,
|
|
1508
1708
|
mode: paintMode.value,
|
|
1509
|
-
"scroll-label": languageLabel.value ?? __props.codeLabel,
|
|
1709
|
+
"scroll-label": languageLabel$1.value ?? __props.codeLabel,
|
|
1510
1710
|
size: __props.size,
|
|
1511
1711
|
"token-lines": tokenLines.value
|
|
1512
1712
|
}, null, 8, [
|
|
1513
1713
|
"diff",
|
|
1514
1714
|
"has-line-numbers",
|
|
1515
1715
|
"highlight-set",
|
|
1716
|
+
"start-line-number",
|
|
1516
1717
|
"is-compact",
|
|
1517
1718
|
"is-wrapped",
|
|
1518
1719
|
"lines",
|
|
@@ -1522,26 +1723,28 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
1522
1723
|
"size",
|
|
1523
1724
|
"token-lines"
|
|
1524
1725
|
]),
|
|
1525
|
-
_cache[
|
|
1726
|
+
_cache[16] || (_cache[16] = createTextVNode("\n ", -1))
|
|
1526
1727
|
]),
|
|
1527
|
-
_cache[
|
|
1528
|
-
], 10,
|
|
1728
|
+
_cache[18] || (_cache[18] = createTextVNode("\n ", -1))
|
|
1729
|
+
], 10, _hoisted_6)) : (openBlock(), createBlock(_sfc_main$1, {
|
|
1529
1730
|
key: 2,
|
|
1530
1731
|
diff: diffLines.value,
|
|
1531
1732
|
"has-line-numbers": __props.hasLineNumbers,
|
|
1532
1733
|
"highlight-set": highlightSet.value,
|
|
1734
|
+
"start-line-number": firstLineNumber.value,
|
|
1533
1735
|
"is-compact": showHeader.value && !__props.hasLineNumbers,
|
|
1534
1736
|
"is-wrapped": __props.isWrapped,
|
|
1535
1737
|
lines: lines.value,
|
|
1536
1738
|
"max-height": __props.maxHeight,
|
|
1537
1739
|
mode: paintMode.value,
|
|
1538
|
-
"scroll-label": languageLabel.value ?? __props.codeLabel,
|
|
1740
|
+
"scroll-label": languageLabel$1.value ?? __props.codeLabel,
|
|
1539
1741
|
size: __props.size,
|
|
1540
1742
|
"token-lines": tokenLines.value
|
|
1541
1743
|
}, null, 8, [
|
|
1542
1744
|
"diff",
|
|
1543
1745
|
"has-line-numbers",
|
|
1544
1746
|
"highlight-set",
|
|
1747
|
+
"start-line-number",
|
|
1545
1748
|
"is-compact",
|
|
1546
1749
|
"is-wrapped",
|
|
1547
1750
|
"lines",
|
|
@@ -1551,32 +1754,42 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
1551
1754
|
"size",
|
|
1552
1755
|
"token-lines"
|
|
1553
1756
|
])),
|
|
1554
|
-
_cache[
|
|
1555
|
-
|
|
1757
|
+
_cache[26] || (_cache[26] = createTextVNode("\n ", -1)),
|
|
1758
|
+
hasCorner.value ? (openBlock(), createElementBlock("div", {
|
|
1556
1759
|
key: 3,
|
|
1557
|
-
class: "astryx-code-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1760
|
+
class: "astryx-code-block__corner",
|
|
1761
|
+
"data-size": __props.size
|
|
1762
|
+
}, [
|
|
1763
|
+
_cache[21] || (_cache[21] = createTextVNode("\n ", -1)),
|
|
1764
|
+
renderSlot(_ctx.$slots, "endContent"),
|
|
1765
|
+
_cache[22] || (_cache[22] = createTextVNode("\n ", -1)),
|
|
1766
|
+
__props.hasCopyButton ? (openBlock(), createBlock(_sfc_main$5, {
|
|
1767
|
+
key: 0,
|
|
1768
|
+
class: "astryx-code-block-copy-button",
|
|
1769
|
+
variant: "ghost",
|
|
1770
|
+
size: "sm",
|
|
1771
|
+
label: copyButtonLabel.value,
|
|
1772
|
+
tooltip: copyTooltip.value,
|
|
1773
|
+
onClick: withModifiers(onCopy, ["stop"])
|
|
1774
|
+
}, {
|
|
1775
|
+
default: withCtx(() => [
|
|
1776
|
+
_cache[19] || (_cache[19] = createTextVNode("\n ", -1)),
|
|
1777
|
+
createVNode(_sfc_main$6, {
|
|
1778
|
+
"icon-slot": "code-block-copy",
|
|
1779
|
+
state: { copied: unref(isCopied) },
|
|
1780
|
+
fallback: {
|
|
1781
|
+
icon: copyIcon.value,
|
|
1782
|
+
size: "sm"
|
|
1783
|
+
},
|
|
1784
|
+
color: "inherit"
|
|
1785
|
+
}, null, 8, ["state", "fallback"]),
|
|
1786
|
+
_cache[20] || (_cache[20] = createTextVNode("\n ", -1))
|
|
1787
|
+
]),
|
|
1788
|
+
_: 1
|
|
1789
|
+
}, 8, ["label", "tooltip"])) : createCommentVNode("v-if", true),
|
|
1790
|
+
_cache[23] || (_cache[23] = createTextVNode("\n ", -1))
|
|
1791
|
+
], 8, _hoisted_8)) : createCommentVNode("v-if", true),
|
|
1792
|
+
_cache[27] || (_cache[27] = createTextVNode("\n ", -1))
|
|
1580
1793
|
], 16, _hoisted_1), createVNode(_sfc_main$4, {
|
|
1581
1794
|
role: "status",
|
|
1582
1795
|
"aria-live": "polite"
|