@astryx-vue/core 0.2.3 → 0.2.5
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.md +28 -26
- package/THIRD_PARTY_NOTICES.md +2 -0
- package/dist/AlertDialog/index.js +1 -1
- package/dist/{AlertDialog-ovx4cBjM.js → AlertDialog-B6UeBCE7.js} +2 -2
- package/dist/AppShell/index.js +1 -1
- package/dist/{AppShell-Dd-D4bA2.js → AppShell-CeBmB0Q9.js} +2 -2
- package/dist/Avatar/index.d.ts +1 -1
- package/dist/Avatar/index.js +1 -1
- package/dist/{Avatar-jmHInHwj.js → Avatar-BB4Z4LF1.js} +10 -4
- package/dist/AvatarGroup/index.d.ts +1 -1
- package/dist/Banner/index.d.ts +1 -1
- package/dist/BottomSheet/index.d.ts +2 -2
- package/dist/BottomSheet/index.js +3 -2
- package/dist/{BottomSheet-Dg95HB1s.js → BottomSheet-BV6vfgGu.js} +82 -22
- package/dist/BottomSheet-o7xw-TOi.js +153 -0
- package/dist/Breadcrumbs/index.d.ts +2 -2
- package/dist/Breadcrumbs/index.js +2 -2
- package/dist/{Breadcrumbs-CWGfgLNK.js → Breadcrumbs-D6G7f5WL.js} +1 -1
- package/dist/Button/index.d.ts +1 -1
- package/dist/ButtonGroup/index.d.ts +1 -1
- package/dist/Calendar/index.d.ts +1 -1
- package/dist/Calendar/index.js +1 -1
- package/dist/{Calendar-CnOsSjMY.js → Calendar-DmTeM7PO.js} +2 -2
- package/dist/Carousel/index.js +1 -1
- package/dist/{Carousel-JA7ilqI_.js → Carousel-CIKrcA2r.js} +1 -1
- package/dist/Chat/index.js +1 -1
- package/dist/{Chat-C7WrCOE4.js → Chat-BFox3u9D.js} +1 -1
- package/dist/CheckboxInput/index.d.ts +1 -1
- package/dist/CheckboxList/index.d.ts +1 -1
- package/dist/CheckboxList/index.js +1 -1
- package/dist/{CheckboxList-CnCGnkZk.js → CheckboxList-BlPf7vPe.js} +4 -4
- package/dist/Citation/index.js +1 -1
- package/dist/{Citation-CtwrU33I.js → Citation-BG-vg9ia.js} +1 -1
- package/dist/ClickableCard/index.d.ts +1 -1
- package/dist/Code/index.d.ts +3 -3
- package/dist/Code/index.js +4 -4
- package/dist/{Code-BvefYRpx.js → Code-XnPuGxey.js} +1 -1
- package/dist/{CodeBlock-BZGzYeoL.js → CodeBlock-B2pnEOJY.js} +145 -15
- package/dist/CommandPalette/index.js +1 -1
- package/dist/{CommandPalette-BNbM9T9y.js → CommandPalette-DKgHzmJk.js} +10 -10
- package/dist/ComplexSelector/index.js +1 -1
- package/dist/{ComplexSelector-LtbLlrcj.js → ComplexSelector-Dv44FFhN.js} +1 -1
- package/dist/ContextMenu/index.d.ts +2 -2
- package/dist/ContextMenu/index.js +2 -2
- package/dist/{ContextMenu-DVQl0xL5.js → ContextMenu-BeJO5HYx.js} +4 -369
- package/dist/DateInput/index.d.ts +1 -1
- package/dist/DateInput/index.js +1 -1
- package/dist/{DateInput-zm8sNc0t.js → DateInput-D4XFAEMp.js} +3 -3
- package/dist/DateRangeInput/index.d.ts +1 -1
- package/dist/DateRangeInput/index.js +1 -1
- package/dist/{DateRangeInput-DlVFzrf7.js → DateRangeInput-Cp6AZfew.js} +2 -2
- package/dist/DateTimeInput/index.d.ts +1 -1
- package/dist/DateTimeInput/index.js +1 -1
- package/dist/{DateTimeInput-C7Z-p6Yd.js → DateTimeInput-B6MPPp76.js} +3 -3
- package/dist/DropdownMenu/index.d.ts +2 -2
- package/dist/DropdownMenu/index.js +3 -3
- package/dist/{DropdownMenu-BoZChdev.js → DropdownMenu--lnUeJEG.js} +3 -3
- package/dist/{DropdownMenu-u1psFjis.js → DropdownMenu-6E9jFdFe.js} +4 -4
- package/dist/{DropdownMenuRadioItem.vue-uVM0FD2f.d.ts → DropdownMenuRadioItem.vue-CXEURBcq.d.ts} +1 -1
- package/dist/EmptyState/index.js +1 -1
- package/dist/{EmptyState-CUJdTYKV.js → EmptyState-0RWymQUS.js} +2 -2
- package/dist/FileInput/index.d.ts +1 -1
- package/dist/FileInput/index.js +1 -1
- package/dist/{FileInput-QdlZn7qK.js → FileInput-DuNwdbAo.js} +1 -1
- package/dist/Grid/index.d.ts +1 -1
- package/dist/Heading/index.d.ts +2 -2
- package/dist/Heading/index.js +1 -1
- package/dist/Heading-B9C3LZlS.js +94 -0
- package/dist/Indicator/index.d.ts +2 -2
- package/dist/InputGroup/index.d.ts +1 -1
- package/dist/Item-DrYJL1TG.js +590 -0
- package/dist/Lightbox/index.js +1 -1
- package/dist/{Lightbox-BSzfqZ-u.js → Lightbox-Br3o0SyQ.js} +1 -1
- package/dist/Link/index.d.ts +3 -2
- package/dist/Link/index.js +1 -1
- package/dist/Link-DCZ6922-.js +196 -0
- package/dist/List/index.d.ts +3 -3
- package/dist/List/index.js +2 -2
- package/dist/{ListItem-pGxvn6QJ.js → ListItem-CcRHWuEm.js} +8 -2
- package/dist/Markdown/index.d.ts +2 -2
- package/dist/Markdown/index.js +2 -2
- package/dist/{Markdown-B6tSqenv.js → Markdown-Bz0R3kNj.js} +274 -30
- package/dist/MetadataList/index.js +1 -1
- package/dist/{MetadataList-aN1tRn6W.js → MetadataList-CFaocx6j.js} +1 -1
- package/dist/MobileNav/index.js +1 -1
- package/dist/{MobileNavToggle-fqcSafkc.js → MobileNavToggle-Dh3uLivq.js} +1 -1
- package/dist/MoreMenu/index.d.ts +1 -1
- package/dist/MoreMenu/index.js +1 -1
- package/dist/{MoreMenu-B3brqdK_.js → MoreMenu-B95nRSe8.js} +2 -2
- package/dist/MultiSelector/index.d.ts +1 -1
- package/dist/MultiSelector/index.js +1 -1
- package/dist/{MultiSelector-BD5PMgez.js → MultiSelector-DuF5TECE.js} +4 -4
- package/dist/{NavDisclosure-DbYLDXK0.js → NavDisclosure-C6sPZ89n.js} +4 -1
- package/dist/NavHeadingSurface-Cb3x9iDx.js +287 -0
- package/dist/NavItem/index.d.ts +1 -1
- package/dist/NavMenu/index.d.ts +2 -2
- package/dist/NavMenu/index.js +4 -3
- package/dist/NavMenu-ClIgMaxE.js +176 -0
- package/dist/{NavMenuItem-DrwIMHKO.js → NavMenuItem-E7S8gBh-.js} +1 -1
- package/dist/NumberInput/index.d.ts +1 -1
- package/dist/NumberInput/index.js +1 -1
- package/dist/{NumberInput-CBeU4lEl.js → NumberInput-B4IL3s_8.js} +1 -1
- package/dist/Outline/index.js +1 -1
- package/dist/{Outline--HVMSB6i.js → Outline-DBUuchi9.js} +1 -1
- package/dist/OverflowList/index.d.ts +1 -1
- package/dist/OverflowList/index.js +1 -1
- package/dist/{OverflowList-FMh7r-r_.js → OverflowList-aDd_oem0.js} +3 -3
- package/dist/Pagination/index.d.ts +1 -1
- package/dist/Pagination/index.js +1 -1
- package/dist/{Pagination-DlIvESjx.js → Pagination-CNe9F6Fl.js} +181 -45
- package/dist/Popover/index.d.ts +1 -1
- package/dist/PowerSearch/index.d.ts +1 -1
- package/dist/PowerSearch/index.js +1 -1
- package/dist/{PowerSearch-CMG7Rb69.js → PowerSearch-C6U8Sq1Y.js} +13 -13
- package/dist/ProgressBar/index.d.ts +2 -2
- package/dist/ProgressBar/index.js +1 -1
- package/dist/{ProgressBar-DO9Chic6.js → ProgressBar-DF6WZNCI.js} +45 -6
- package/dist/Radio/index.d.ts +1 -1
- package/dist/RadioList/index.d.ts +1 -1
- package/dist/Resizable/index.d.ts +1 -1
- package/dist/Resizable/index.js +1 -1
- package/dist/{Resizable-CXpvj1TZ.js → ResizeHandle-DYy0e3v9.js} +1 -1
- package/dist/ScrollableArea/index.d.ts +1 -1
- package/dist/SelectableCard/index.d.ts +1 -1
- package/dist/Selector/index.d.ts +1 -1
- package/dist/Selector/index.js +1 -1
- package/dist/{Selector-BpPnuWH3.js → Selector-5N-hq2nF.js} +3 -3
- package/dist/SideNav/index.d.ts +2 -2
- package/dist/SideNav/index.js +1 -1
- package/dist/{SideNav-D4TupqgE.js → SideNav-CT9lfspi.js} +225 -229
- package/dist/Stack/index.d.ts +1 -1
- package/dist/Stepper/index.js +1 -1
- package/dist/{Stepper-H-6-T5Ps.js → Stepper-BqhVCgC-.js} +1 -1
- package/dist/Switch/index.d.ts +1 -1
- package/dist/Table/index.js +1 -1
- package/dist/{Table-nqA_njNz.js → Table-CsdH8fCB.js} +4 -4
- package/dist/Text/index.d.ts +3 -3
- package/dist/Text/index.js +1 -1
- package/dist/Text-DIzZw6FA.js +86 -0
- package/dist/TextArea/index.d.ts +1 -1
- package/dist/TextInput/index.d.ts +1 -1
- package/dist/Theme/index.d.ts +3 -3
- package/dist/Theme/index.js +2 -2
- package/dist/Theme-CtaUWo4g.js +1246 -0
- package/dist/Thumbnail/index.js +1 -1
- package/dist/{Thumbnail-CXb3m_Hv.js → Thumbnail-BnQwX1cQ.js} +2 -2
- package/dist/{TimeField-B3cndWb0.js → TimeField-Biiuv0hB.js} +1 -1
- package/dist/TimeInput/index.d.ts +1 -1
- package/dist/TimeInput/index.js +1 -1
- package/dist/{TimeInput-BHQ_LKGm.js → TimeInput-C9gptCOK.js} +1 -1
- package/dist/Timer/index.d.ts +1 -1
- package/dist/Timer/index.js +1 -1
- package/dist/{Timer-B7GV6hqd.js → Timer-kxzQx3tp.js} +1 -1
- package/dist/Timestamp/index.d.ts +1 -1
- package/dist/Timestamp/index.js +1 -1
- package/dist/{Timestamp-Cfuxbb3i.js → Timestamp-D7bd_nF3.js} +2 -2
- package/dist/ToggleButton/index.d.ts +1 -1
- package/dist/Token/index.d.ts +1 -1
- package/dist/Token/index.js +1 -1
- package/dist/{Token-CdVLH0_H.js → Token-D2GsI_Ei.js} +1 -1
- package/dist/Tokenizer/index.js +1 -1
- package/dist/{Tokenizer-DlD-S_8-.js → Tokenizer-rwzamZg4.js} +3 -3
- package/dist/Toolbar/index.d.ts +1 -1
- package/dist/Tooltip/index.d.ts +1 -1
- package/dist/Tooltip/index.js +1 -1
- package/dist/{Tooltip-mp0NMh_Y.js → Tooltip-C2fh9anJ.js} +23 -8
- package/dist/TopNav/index.d.ts +1 -1
- package/dist/TopNav/index.js +1 -1
- package/dist/{TopNav-DzV874G7.js → TopNav-arWFLTBM.js} +112 -42
- package/dist/TreeList/index.js +1 -1
- package/dist/{TreeList-DEwvlZRV.js → TreeList-C9xvMpJZ.js} +1 -1
- package/dist/Typeahead/index.d.ts +2 -2
- package/dist/Typeahead/index.js +3 -2
- package/dist/Typeahead-_V11btpv.js +499 -0
- package/dist/{TypeaheadMenu-CGvo0Tud.js → TypeaheadMenu-BEObzonz.js} +46 -10
- package/dist/composables/index.d.ts +2 -2
- package/dist/composables/index.js +4 -4
- package/dist/composables-CWw6t-RJ.js +520 -0
- package/dist/{context-DmOLCubj.js → context-CPh7kE-a.js} +58 -10
- package/dist/{index-BRfR0lhb.d.ts → index-12QYAbiz.d.ts} +1 -1
- package/dist/{index-D1Twv_fL.d.ts → index-4TRnFGxv.d.ts} +6 -6
- package/dist/{index-BTAgQRP0.d.ts → index-B9rqmYxh.d.ts} +150 -62
- package/dist/index-BBtJt5_A.d.ts +26 -0
- package/dist/{index-Ch6BbxCP.d.ts → index-BH9PzQ1F.d.ts} +13 -8
- package/dist/{index-C2sfHfBw.d.ts → index-BK9T1TPZ.d.ts} +4 -4
- package/dist/{index-D_UEJIU5.d.ts → index-BPwD6aBv.d.ts} +1 -1
- package/dist/{index-B1x05arQ.d.ts → index-BlOIC_AM.d.ts} +1 -1
- package/dist/{index-C5p2NeCr.d.ts → index-Blm197N_.d.ts} +11 -2
- package/dist/{index-Bu3oXIIS.d.ts → index-BmmdzwT9.d.ts} +6 -0
- package/dist/{index-MPcg1Pm4.d.ts → index-BpH4wvsg.d.ts} +2 -2
- package/dist/{index-BMn9ghAX.d.ts → index-C1HIqW_H.d.ts} +2 -2
- package/dist/{index-LIyvJTW3.d.ts → index-C3GaPqvJ.d.ts} +84 -8
- package/dist/{index-DkVEBdWa.d.ts → index-CB9Srua5.d.ts} +1 -1
- package/dist/{index-C8wDPDcP.d.ts → index-CLmKfnqf.d.ts} +49 -7
- package/dist/{index-DMQG6kdM.d.ts → index-CPwzSbQQ.d.ts} +2 -2
- package/dist/{index-DAiGhkNZ.d.ts → index-D4I_obqR.d.ts} +1 -1
- package/dist/{index-foQMNKZO.d.ts → index-D5N9ikrS.d.ts} +48 -2
- package/dist/{index-D8o50qOE.d.ts → index-DFbvnBlf.d.ts} +31 -2
- package/dist/{index-Cm_TiLXU.d.ts → index-Dgg0bHVM.d.ts} +7 -3
- package/dist/{index-ViSV0RBx.d.ts → index-DjMwF8ET.d.ts} +11 -1
- package/dist/{index-nCEmW6wa.d.ts → index-DtePJ_w_.d.ts} +1 -1
- package/dist/index-DxR1FChm.d.ts +158 -0
- package/dist/{index-f4NGT-e2.d.ts → index-EFqQF2Bx.d.ts} +1 -1
- package/dist/{index-BB5yVIN-.d.ts → index-JL4auphT.d.ts} +2 -2
- package/dist/{index-B9f1rUEv.d.ts → index-XuAAcYiP.d.ts} +1 -1
- package/dist/{index-D0TlUOtG.d.ts → index-YmSe1ujk.d.ts} +76 -3
- package/dist/{index-BMrggCw-.d.ts → index-bvr3WHvs.d.ts} +1 -1
- package/dist/{index-CDDMDHJM.d.ts → index-c67ca7eJ.d.ts} +1 -1
- package/dist/{index-CGZ2xi3r.d.ts → index-eshFLli0.d.ts} +40 -3
- package/dist/{index-DxsKyAxq.d.ts → index-vizlhXVs.d.ts} +131 -2
- package/dist/{index-DfgHJE7H.d.ts → index-z3uLM1O6.d.ts} +153 -24
- package/dist/index.d.ts +80 -79
- package/dist/index.js +118 -115
- package/dist/locale/index.d.ts +2 -2
- package/dist/locale/index.js +3 -3
- package/dist/locale-sLw5Caia.js +917 -0
- package/dist/{searchResultMessage-DN0HeRRB.js → searchResultMessage-CCnq-_ce.js} +1 -1
- package/dist/syntaxTheme-CwVEcVDk.d.ts +57 -0
- package/dist/{syntaxTheme-ClpWALZX.js → syntaxTheme-R7xnu5x5.js} +24 -3
- package/dist/{types-Bt-lSgYX.d.ts → types-D9nP_X-c.d.ts} +14 -1
- package/dist/{types-CAZY4Xua.d.ts → types-DGYHIu4I.d.ts} +30 -1
- package/dist/types-D_J66aPN.d.ts +85 -0
- package/dist/types-gKsEkk2g.d.ts +320 -0
- package/dist/{useMenuDrillIn-OaEwjK44.js → useMenuDrillIn-BgjJcY3K.js} +1 -1
- package/dist/useMenuPress-DUmEy4TB.js +425 -0
- package/dist/{composables-DDI08XFF.js → useResizable-B3ahKLoZ.js} +73 -248
- package/dist/useTruncation-B5qXQzAP.js +53 -0
- package/locales/SOURCE.json +37 -0
- package/locales/af-ZA.json +1482 -0
- package/locales/ar-SA.json +1482 -0
- package/locales/ca-ES.json +1482 -0
- package/locales/cs-CZ.json +1482 -0
- package/locales/da-DK.json +1482 -0
- package/locales/de-DE.json +1482 -0
- package/locales/el-GR.json +1482 -0
- package/locales/en.json +1646 -0
- package/locales/es-ES.json +1482 -0
- package/locales/fi-FI.json +1482 -0
- package/locales/fr-FR.json +1482 -0
- package/locales/he-IL.json +1482 -0
- package/locales/hu-HU.json +1482 -0
- package/locales/it-IT.json +1482 -0
- package/locales/ja-JP.json +1482 -0
- package/locales/ko-KR.json +1482 -0
- package/locales/nl-NL.json +1482 -0
- package/locales/no-NO.json +1482 -0
- package/locales/pl-PL.json +1482 -0
- package/locales/pt-BR.json +1482 -0
- package/locales/pt-PT.json +1482 -0
- package/locales/ro-RO.json +1482 -0
- package/locales/ru-RU.json +1482 -0
- package/locales/sr-SP.json +1482 -0
- package/locales/sv-SE.json +1482 -0
- package/locales/tr-TR.json +1482 -0
- package/locales/uk-UA.json +1482 -0
- package/locales/vi-VN.json +1482 -0
- package/locales/zh-CN.json +1482 -0
- package/locales/zh-TW.json +1482 -0
- package/package.json +4 -2
- package/styles/bottom-sheet.css +27 -0
- package/styles/code.css +62 -0
- package/styles/container-reveal.css +104 -0
- package/styles/heading.css +47 -0
- package/styles/keyboard-hint.css +28 -0
- package/styles/link.css +34 -0
- package/styles/list.css +88 -1
- package/styles/markdown.css +12 -0
- package/styles/pagination.css +30 -0
- package/styles/progress-bar.css +49 -0
- package/styles/side-nav.css +36 -1
- package/styles/text.css +18 -0
- package/styles/top-nav.css +145 -6
- package/styles/typeahead.css +24 -0
- package/styles.css +2 -0
- package/dist/Heading-Dugosn6j.js +0 -43
- package/dist/Item-C1z6gXn8.js +0 -289
- package/dist/Link-DqdQZ37C.js +0 -141
- package/dist/Text-BHVghsWo.js +0 -53
- package/dist/Theme-CejS9MHm.js +0 -447
- package/dist/Typeahead-DQ3tmqYe.js +0 -375
- package/dist/index-Bqb_Fyju.d.ts +0 -80
- package/dist/index-Dg3ZmwEg.d.ts +0 -75
- package/dist/locale-CCwVnyMZ.js +0 -42
- package/dist/syntaxTheme-Bcs1YMF7.d.ts +0 -38
- package/dist/types-jmqqnkKA.d.ts +0 -163
- package/dist/useHotkeys-dABSK1o9.js +0 -80
- package/dist/useLongPress-Cyxwa73s.js +0 -60
- package/dist/{index-BXkNZF3q.d.ts → index-CpiWVbRZ.d.ts} +1 -1
package/dist/Link-DqdQZ37C.js
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { t as _sfc_main$1 } from "./Tooltip-mp0NMh_Y.js";
|
|
2
|
-
import { computed, createBlock, createCommentVNode, createElementBlock, defineComponent, normalizeClass, openBlock, renderSlot, withCtx, withModifiers } from "vue";
|
|
3
|
-
import "../styles/link.css";
|
|
4
|
-
//#region src/Link/Link.vue
|
|
5
|
-
const _hoisted_1 = [
|
|
6
|
-
"href",
|
|
7
|
-
"target",
|
|
8
|
-
"rel",
|
|
9
|
-
"download"
|
|
10
|
-
];
|
|
11
|
-
const _hoisted_2 = {
|
|
12
|
-
key: 0,
|
|
13
|
-
class: "astryx-link__external",
|
|
14
|
-
"aria-hidden": "true"
|
|
15
|
-
};
|
|
16
|
-
const _hoisted_3 = ["disabled"];
|
|
17
|
-
const _hoisted_4 = [
|
|
18
|
-
"href",
|
|
19
|
-
"target",
|
|
20
|
-
"rel",
|
|
21
|
-
"download"
|
|
22
|
-
];
|
|
23
|
-
const _hoisted_5 = {
|
|
24
|
-
key: 0,
|
|
25
|
-
class: "astryx-link__external",
|
|
26
|
-
"aria-hidden": "true"
|
|
27
|
-
};
|
|
28
|
-
const _hoisted_6 = ["disabled"];
|
|
29
|
-
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
30
|
-
inheritAttrs: false,
|
|
31
|
-
__name: "Link",
|
|
32
|
-
props: {
|
|
33
|
-
href: {},
|
|
34
|
-
isExternalLink: {
|
|
35
|
-
type: Boolean,
|
|
36
|
-
default: false
|
|
37
|
-
},
|
|
38
|
-
hasUnderline: {
|
|
39
|
-
type: Boolean,
|
|
40
|
-
default: false
|
|
41
|
-
},
|
|
42
|
-
color: { default: "accent" },
|
|
43
|
-
isDisabled: {
|
|
44
|
-
type: Boolean,
|
|
45
|
-
default: false
|
|
46
|
-
},
|
|
47
|
-
target: {},
|
|
48
|
-
rel: {},
|
|
49
|
-
download: { type: [String, Boolean] },
|
|
50
|
-
tooltip: {},
|
|
51
|
-
isStandalone: {
|
|
52
|
-
type: Boolean,
|
|
53
|
-
default: false
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
emits: ["click"],
|
|
57
|
-
setup(__props, { emit: __emit }) {
|
|
58
|
-
const props = __props;
|
|
59
|
-
const emit = __emit;
|
|
60
|
-
const computedTarget = computed(() => {
|
|
61
|
-
return props.isExternalLink ? "_blank" : props.target;
|
|
62
|
-
});
|
|
63
|
-
const computedRel = computed(() => {
|
|
64
|
-
const parts = new Set((props.rel ?? "").split(" ").filter(Boolean));
|
|
65
|
-
if (props.isExternalLink || computedTarget.value === "_blank") {
|
|
66
|
-
parts.add("noopener");
|
|
67
|
-
parts.add("noreferrer");
|
|
68
|
-
}
|
|
69
|
-
return parts.size > 0 ? Array.from(parts).join(" ") : void 0;
|
|
70
|
-
});
|
|
71
|
-
const classes = computed(() => [
|
|
72
|
-
"astryx-link",
|
|
73
|
-
`astryx-link--color-${props.color}`,
|
|
74
|
-
props.hasUnderline && "astryx-link--underlined",
|
|
75
|
-
props.isDisabled && "astryx-link--disabled",
|
|
76
|
-
props.isExternalLink && "astryx-link--external",
|
|
77
|
-
props.isStandalone && "astryx-link--standalone"
|
|
78
|
-
]);
|
|
79
|
-
const tooltipText = computed(() => {
|
|
80
|
-
return props.tooltip?.trim() || void 0;
|
|
81
|
-
});
|
|
82
|
-
function handleClick(event) {
|
|
83
|
-
if (props.isDisabled) {
|
|
84
|
-
event.preventDefault();
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
emit("click", event);
|
|
88
|
-
}
|
|
89
|
-
return (_ctx, _cache) => {
|
|
90
|
-
return tooltipText.value ? (openBlock(), createBlock(_sfc_main$1, {
|
|
91
|
-
key: 0,
|
|
92
|
-
content: tooltipText.value
|
|
93
|
-
}, {
|
|
94
|
-
default: withCtx(() => [__props.href && !__props.isDisabled ? (openBlock(), createElementBlock("a", {
|
|
95
|
-
key: 0,
|
|
96
|
-
class: normalizeClass(["astryx-link", classes.value]),
|
|
97
|
-
href: __props.href,
|
|
98
|
-
target: computedTarget.value,
|
|
99
|
-
rel: computedRel.value,
|
|
100
|
-
download: __props.download,
|
|
101
|
-
onClick: handleClick
|
|
102
|
-
}, [renderSlot(_ctx.$slots, "default"), __props.isExternalLink ? (openBlock(), createElementBlock("span", _hoisted_2, "↗")) : createCommentVNode("v-if", true)], 10, _hoisted_1)) : __props.href && __props.isDisabled ? (openBlock(), createElementBlock("a", {
|
|
103
|
-
key: 1,
|
|
104
|
-
class: normalizeClass(["astryx-link", classes.value]),
|
|
105
|
-
role: "link",
|
|
106
|
-
"aria-disabled": "true",
|
|
107
|
-
onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["prevent"]))
|
|
108
|
-
}, [renderSlot(_ctx.$slots, "default")], 2)) : (openBlock(), createElementBlock("button", {
|
|
109
|
-
key: 2,
|
|
110
|
-
type: "button",
|
|
111
|
-
class: normalizeClass(["astryx-link", classes.value]),
|
|
112
|
-
disabled: __props.isDisabled,
|
|
113
|
-
onClick: handleClick
|
|
114
|
-
}, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_3))]),
|
|
115
|
-
_: 3
|
|
116
|
-
}, 8, ["content"])) : __props.href && !__props.isDisabled ? (openBlock(), createElementBlock("a", {
|
|
117
|
-
key: 1,
|
|
118
|
-
class: normalizeClass(["astryx-link", classes.value]),
|
|
119
|
-
href: __props.href,
|
|
120
|
-
target: computedTarget.value,
|
|
121
|
-
rel: computedRel.value,
|
|
122
|
-
download: __props.download,
|
|
123
|
-
onClick: handleClick
|
|
124
|
-
}, [renderSlot(_ctx.$slots, "default"), __props.isExternalLink ? (openBlock(), createElementBlock("span", _hoisted_5, "↗")) : createCommentVNode("v-if", true)], 10, _hoisted_4)) : __props.href && __props.isDisabled ? (openBlock(), createElementBlock("a", {
|
|
125
|
-
key: 2,
|
|
126
|
-
class: normalizeClass(["astryx-link", classes.value]),
|
|
127
|
-
role: "link",
|
|
128
|
-
"aria-disabled": "true",
|
|
129
|
-
onClick: _cache[1] || (_cache[1] = withModifiers(() => {}, ["prevent"]))
|
|
130
|
-
}, [renderSlot(_ctx.$slots, "default")], 2)) : (openBlock(), createElementBlock("button", {
|
|
131
|
-
key: 3,
|
|
132
|
-
type: "button",
|
|
133
|
-
class: normalizeClass(["astryx-link", classes.value]),
|
|
134
|
-
disabled: __props.isDisabled,
|
|
135
|
-
onClick: handleClick
|
|
136
|
-
}, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_6));
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
//#endregion
|
|
141
|
-
export { _sfc_main as t };
|
package/dist/Text-BHVghsWo.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { computed, createBlock, defineComponent, normalizeClass, normalizeStyle, openBlock, renderSlot, resolveDynamicComponent, withCtx } from "vue";
|
|
2
|
-
import "../styles/text.css";
|
|
3
|
-
//#region src/Text/Text.vue
|
|
4
|
-
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
5
|
-
__name: "Text",
|
|
6
|
-
props: {
|
|
7
|
-
type: { default: "body" },
|
|
8
|
-
size: {},
|
|
9
|
-
color: { default: "primary" },
|
|
10
|
-
weight: {},
|
|
11
|
-
textWrap: {},
|
|
12
|
-
wordBreak: {},
|
|
13
|
-
hasStrikethrough: { type: Boolean },
|
|
14
|
-
hasTabularNumbers: { type: Boolean },
|
|
15
|
-
display: { default: "inline" },
|
|
16
|
-
as: { default: "span" },
|
|
17
|
-
maxLines: { default: 0 }
|
|
18
|
-
},
|
|
19
|
-
setup(__props) {
|
|
20
|
-
const props = __props;
|
|
21
|
-
const weight = computed(() => props.weight === "normal" ? "regular" : props.weight);
|
|
22
|
-
const isBlock = computed(() => props.display === "block" || props.maxLines > 0);
|
|
23
|
-
const classes = computed(() => [
|
|
24
|
-
"astryx-text",
|
|
25
|
-
`astryx-text--type-${props.type}`,
|
|
26
|
-
props.size && `astryx-text--size-${props.size}`,
|
|
27
|
-
`astryx-text--color-${props.color}`,
|
|
28
|
-
weight.value && `astryx-text--weight-${weight.value}`,
|
|
29
|
-
props.textWrap && `astryx-text--wrap-${props.textWrap}`,
|
|
30
|
-
props.wordBreak && `astryx-text--word-${props.wordBreak}`,
|
|
31
|
-
props.hasStrikethrough && "astryx-text--strike",
|
|
32
|
-
props.hasTabularNumbers && "astryx-text--tabular",
|
|
33
|
-
isBlock.value && "astryx-text--block",
|
|
34
|
-
props.maxLines === 1 && "astryx-text--truncate-single",
|
|
35
|
-
props.maxLines > 1 && "astryx-text--truncate-multi"
|
|
36
|
-
]);
|
|
37
|
-
const style = computed(() => {
|
|
38
|
-
if (props.maxLines > 1) return { WebkitLineClamp: props.maxLines };
|
|
39
|
-
return {};
|
|
40
|
-
});
|
|
41
|
-
return (_ctx, _cache) => {
|
|
42
|
-
return openBlock(), createBlock(resolveDynamicComponent(__props.as), {
|
|
43
|
-
class: normalizeClass(["astryx-text", classes.value]),
|
|
44
|
-
style: normalizeStyle(style.value)
|
|
45
|
-
}, {
|
|
46
|
-
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
47
|
-
_: 3
|
|
48
|
-
}, 8, ["class", "style"]);
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
//#endregion
|
|
53
|
-
export { _sfc_main as t };
|
package/dist/Theme-CejS9MHm.js
DELETED
|
@@ -1,447 +0,0 @@
|
|
|
1
|
-
import { t as useMediaQuery } from "./useMediaQuery-GMmgp28-.js";
|
|
2
|
-
import { n as themeContextKey, r as themeNestingKey, t as mediaThemeKey } from "./context-Cws_tXTr.js";
|
|
3
|
-
import { i as syntaxThemeStyle } from "./syntaxTheme-ClpWALZX.js";
|
|
4
|
-
import { n as resolveLightDark, r as syntaxThemeKey, t as readColorMode } from "./colorMode-CBgdgDSn.js";
|
|
5
|
-
import { computed, createElementBlock, defineComponent, inject, markRaw, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, openBlock, provide, ref, renderSlot, unref, useAttrs, useTemplateRef, watch } from "vue";
|
|
6
|
-
import "../styles/media-theme.css";
|
|
7
|
-
import "../styles/theme.css";
|
|
8
|
-
//#region src/Theme/defineTheme.ts
|
|
9
|
-
const THEME_NAME = /^[a-z0-9][a-z0-9-]*$/i;
|
|
10
|
-
const UNSAFE_TOKEN = /[;{}<>\n\r]/;
|
|
11
|
-
function isDefinedTheme(value) {
|
|
12
|
-
return !!value && typeof value === "object" && value.__astryxTheme === true;
|
|
13
|
-
}
|
|
14
|
-
/** Accept `--color-accent`, `--astryx-color-accent`, or `color-accent`. */
|
|
15
|
-
function normalizeTokenName(name) {
|
|
16
|
-
const trimmed = name.trim();
|
|
17
|
-
if (trimmed.startsWith("--astryx-")) return trimmed;
|
|
18
|
-
if (trimmed.startsWith("--")) return `--astryx-${trimmed.slice(2)}`;
|
|
19
|
-
return `--astryx-${trimmed}`;
|
|
20
|
-
}
|
|
21
|
-
function assertTokenValue(value, name) {
|
|
22
|
-
if (UNSAFE_TOKEN.test(value)) throw new Error(`Theme token ${name} has an unsupported value.`);
|
|
23
|
-
}
|
|
24
|
-
function isTokenPair(value) {
|
|
25
|
-
return Array.isArray(value);
|
|
26
|
-
}
|
|
27
|
-
function resolveTokenMap(tokens) {
|
|
28
|
-
const resolved = {};
|
|
29
|
-
if (!tokens) return resolved;
|
|
30
|
-
for (const [name, value] of Object.entries(tokens)) {
|
|
31
|
-
if (value == null) continue;
|
|
32
|
-
const key = normalizeTokenName(name);
|
|
33
|
-
if (isTokenPair(value)) {
|
|
34
|
-
const [light, dark] = value;
|
|
35
|
-
assertTokenValue(light, key);
|
|
36
|
-
assertTokenValue(dark, key);
|
|
37
|
-
resolved[key] = `light-dark(${light}, ${dark})`;
|
|
38
|
-
continue;
|
|
39
|
-
}
|
|
40
|
-
assertTokenValue(value, key);
|
|
41
|
-
resolved[key] = value;
|
|
42
|
-
}
|
|
43
|
-
return resolved;
|
|
44
|
-
}
|
|
45
|
-
function mergeMaps(base, next) {
|
|
46
|
-
if (base == null && next == null) return void 0;
|
|
47
|
-
return {
|
|
48
|
-
...base,
|
|
49
|
-
...next
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
function sealIndicators(indicators) {
|
|
53
|
-
if (indicators == null) return void 0;
|
|
54
|
-
const sealed = {};
|
|
55
|
-
for (const [name, component] of Object.entries(indicators)) if (component) sealed[name] = markRaw(component);
|
|
56
|
-
return sealed;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Create a theme object that `Theme` can apply to a subtree.
|
|
60
|
-
*
|
|
61
|
-
* Token names are the upstream names (`--color-accent`) or this package's
|
|
62
|
-
* prefixed names (`--astryx-color-accent`). A `[light, dark]` tuple becomes
|
|
63
|
-
* `light-dark()`.
|
|
64
|
-
*/
|
|
65
|
-
function defineTheme(input) {
|
|
66
|
-
if (!THEME_NAME.test(input.name)) throw new Error(`Theme name "${input.name}" must use letters, numbers, and hyphens.`);
|
|
67
|
-
if (input.extends != null && !isDefinedTheme(input.extends)) throw new Error("defineTheme extends must be a theme returned by defineTheme().");
|
|
68
|
-
const base = input.extends;
|
|
69
|
-
const icons = mergeMaps(base?.icons, input.icons);
|
|
70
|
-
const indicators = sealIndicators(mergeMaps(base?.indicators, input.indicators));
|
|
71
|
-
return {
|
|
72
|
-
__astryxTheme: true,
|
|
73
|
-
name: input.name,
|
|
74
|
-
tokens: {
|
|
75
|
-
...base?.tokens,
|
|
76
|
-
...resolveTokenMap(input.tokens)
|
|
77
|
-
},
|
|
78
|
-
onDark: {
|
|
79
|
-
...base?.onDark,
|
|
80
|
-
...resolveTokenMap(input.onDark?.tokens)
|
|
81
|
-
},
|
|
82
|
-
onLight: {
|
|
83
|
-
...base?.onLight,
|
|
84
|
-
...resolveTokenMap(input.onLight?.tokens)
|
|
85
|
-
},
|
|
86
|
-
syntax: input.syntax ?? base?.syntax,
|
|
87
|
-
...icons ? { icons } : {},
|
|
88
|
-
...indicators ? { indicators } : {}
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
/** Neutral, with no token overrides. Colors come from `@astryx-vue/themes/neutral.css`. */
|
|
92
|
-
const neutralTheme = defineTheme({ name: "neutral" });
|
|
93
|
-
//#endregion
|
|
94
|
-
//#region src/Theme/themeStyle.ts
|
|
95
|
-
/**
|
|
96
|
-
* Aliases declared on `:root` are substituted there. A later override of the
|
|
97
|
-
* semantic token does not flow through that already-substituted value, so the
|
|
98
|
-
* alias has to be written again on the element that sets the semantic token.
|
|
99
|
-
*
|
|
100
|
-
* Card background and border are not aliases: Neutral paints them with its own
|
|
101
|
-
* stops, and they follow the semantic token only when a theme sets one.
|
|
102
|
-
*/
|
|
103
|
-
const COMPONENT_BRIDGES = {
|
|
104
|
-
"--astryx-color-text-primary": [
|
|
105
|
-
"--astryx-text-foreground",
|
|
106
|
-
"--astryx-heading-foreground",
|
|
107
|
-
"--astryx-button-secondary-foreground",
|
|
108
|
-
"--astryx-button-ghost-foreground"
|
|
109
|
-
],
|
|
110
|
-
"--astryx-color-text-secondary": ["--astryx-text-supporting-foreground"],
|
|
111
|
-
"--astryx-color-accent": ["--astryx-button-primary-background", "--astryx-button-focus"],
|
|
112
|
-
"--astryx-color-on-accent": ["--astryx-button-primary-foreground"],
|
|
113
|
-
"--astryx-color-neutral": ["--astryx-button-secondary-background"],
|
|
114
|
-
"--astryx-color-icon-primary": ["--astryx-icon-primary-foreground"],
|
|
115
|
-
"--astryx-color-background-card": ["--astryx-card-background"],
|
|
116
|
-
"--astryx-color-background-muted": ["--astryx-card-muted-background"],
|
|
117
|
-
"--astryx-color-border": ["--astryx-card-border"]
|
|
118
|
-
};
|
|
119
|
-
/** Surfaces keep their own button treatment. Text aliases still follow onDark and onLight. */
|
|
120
|
-
const SURFACE_BRIDGES = {
|
|
121
|
-
"--astryx-color-text-primary": ["--astryx-text-foreground", "--astryx-heading-foreground"],
|
|
122
|
-
"--astryx-color-text-secondary": ["--astryx-text-supporting-foreground"],
|
|
123
|
-
"--astryx-color-background-card": ["--astryx-card-background"],
|
|
124
|
-
"--astryx-color-background-muted": ["--astryx-card-muted-background"],
|
|
125
|
-
"--astryx-color-border": ["--astryx-card-border"]
|
|
126
|
-
};
|
|
127
|
-
function bridgeComponentTokens(tokens, bridges = COMPONENT_BRIDGES) {
|
|
128
|
-
const style = { ...tokens };
|
|
129
|
-
for (const [source, targets] of Object.entries(bridges)) {
|
|
130
|
-
const value = tokens[source];
|
|
131
|
-
if (!value) continue;
|
|
132
|
-
for (const target of targets) style[target] = value;
|
|
133
|
-
}
|
|
134
|
-
return style;
|
|
135
|
-
}
|
|
136
|
-
/** Token bridges for an inverted surface. Button colors stay with MediaTheme. */
|
|
137
|
-
function bridgeSurfaceTokens(tokens) {
|
|
138
|
-
return bridgeComponentTokens(tokens, SURFACE_BRIDGES);
|
|
139
|
-
}
|
|
140
|
-
/** Inline custom properties for a theme subtree, including syntax colors. */
|
|
141
|
-
function themeStyle(theme) {
|
|
142
|
-
const style = bridgeComponentTokens(theme.tokens);
|
|
143
|
-
if (theme.syntax) Object.assign(style, syntaxThemeStyle(theme.syntax));
|
|
144
|
-
return style;
|
|
145
|
-
}
|
|
146
|
-
//#endregion
|
|
147
|
-
//#region src/Theme/contrast.ts
|
|
148
|
-
const HEX = /^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
|
|
149
|
-
const RGB = /^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[,\s/]+([\d.]+)(%)?)?\s*\)$/i;
|
|
150
|
-
function parseColor(input) {
|
|
151
|
-
const value = input.trim().toLowerCase();
|
|
152
|
-
if (value === "transparent") return {
|
|
153
|
-
r: 0,
|
|
154
|
-
g: 0,
|
|
155
|
-
b: 0,
|
|
156
|
-
a: 0
|
|
157
|
-
};
|
|
158
|
-
const hex = HEX.exec(value);
|
|
159
|
-
if (hex?.[1]) {
|
|
160
|
-
const raw = hex[1];
|
|
161
|
-
const expanded = raw.length === 3 ? raw.split("").map((part) => part + part).join("") : raw;
|
|
162
|
-
const channels = expanded.length === 6 ? `${expanded}ff` : expanded;
|
|
163
|
-
return {
|
|
164
|
-
r: Number.parseInt(channels.slice(0, 2), 16),
|
|
165
|
-
g: Number.parseInt(channels.slice(2, 4), 16),
|
|
166
|
-
b: Number.parseInt(channels.slice(4, 6), 16),
|
|
167
|
-
a: Number.parseInt(channels.slice(6, 8), 16) / 255
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
const rgb = RGB.exec(value);
|
|
171
|
-
if (!rgb) return null;
|
|
172
|
-
const alpha = rgb[4] == null ? 1 : rgb[5] === "%" ? Number.parseFloat(rgb[4]) / 100 : Number.parseFloat(rgb[4]);
|
|
173
|
-
return {
|
|
174
|
-
r: Number.parseFloat(rgb[1] ?? "0"),
|
|
175
|
-
g: Number.parseFloat(rgb[2] ?? "0"),
|
|
176
|
-
b: Number.parseFloat(rgb[3] ?? "0"),
|
|
177
|
-
a: alpha
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
function channel(value) {
|
|
181
|
-
const scaled = value / 255;
|
|
182
|
-
return scaled <= .04045 ? scaled / 12.92 : ((scaled + .055) / 1.055) ** 2.4;
|
|
183
|
-
}
|
|
184
|
-
function relativeLuminance(color) {
|
|
185
|
-
return .2126 * channel(color.r) + .7152 * channel(color.g) + .0722 * channel(color.b);
|
|
186
|
-
}
|
|
187
|
-
/** WCAG contrast ratio. 1 is no contrast. */
|
|
188
|
-
function contrastRatio(foreground, background) {
|
|
189
|
-
const first = relativeLuminance(foreground);
|
|
190
|
-
const second = relativeLuminance(background);
|
|
191
|
-
const lighter = Math.max(first, second);
|
|
192
|
-
const darker = Math.min(first, second);
|
|
193
|
-
return (lighter + .05) / (darker + .05);
|
|
194
|
-
}
|
|
195
|
-
const ON_DARK = {
|
|
196
|
-
r: 255,
|
|
197
|
-
g: 255,
|
|
198
|
-
b: 255,
|
|
199
|
-
a: 1
|
|
200
|
-
};
|
|
201
|
-
const ON_LIGHT = {
|
|
202
|
-
r: 23,
|
|
203
|
-
g: 23,
|
|
204
|
-
b: 23,
|
|
205
|
-
a: 1
|
|
206
|
-
};
|
|
207
|
-
/**
|
|
208
|
-
* Choose a media surface from the painted background.
|
|
209
|
-
*
|
|
210
|
-
* `off` means the ambient text already reads on that background at 3:1, so no
|
|
211
|
-
* inverted context is needed. `null` means the background is too transparent
|
|
212
|
-
* to judge.
|
|
213
|
-
*/
|
|
214
|
-
function pickMediaMode(background, ambientText) {
|
|
215
|
-
if (background.a < .2) return null;
|
|
216
|
-
if (contrastRatio(ambientText, background) >= 3) return "off";
|
|
217
|
-
return contrastRatio(ON_DARK, background) >= contrastRatio(ON_LIGHT, background) ? "dark" : "light";
|
|
218
|
-
}
|
|
219
|
-
//#endregion
|
|
220
|
-
//#region src/Theme/useAutoMediaMode.ts
|
|
221
|
-
function readPaintedBackground(start) {
|
|
222
|
-
let current = start;
|
|
223
|
-
for (let depth = 0; current && depth < 6; depth += 1) {
|
|
224
|
-
const style = getComputedStyle(current);
|
|
225
|
-
const background = parseColor(style.backgroundColor);
|
|
226
|
-
if (background && background.a >= .2) return {
|
|
227
|
-
background,
|
|
228
|
-
ambient: parseColor(style.color) ?? {
|
|
229
|
-
r: 23,
|
|
230
|
-
g: 23,
|
|
231
|
-
b: 23,
|
|
232
|
-
a: 1
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
current = current.parentElement;
|
|
236
|
-
}
|
|
237
|
-
return null;
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Measure the element that actually paints behind a `display: contents` media
|
|
241
|
-
* theme. Returns `null` when the surface cannot be read.
|
|
242
|
-
*/
|
|
243
|
-
function useAutoMediaMode(element, enabled) {
|
|
244
|
-
const detected = ref(null);
|
|
245
|
-
function measure() {
|
|
246
|
-
if (!enabled.value || typeof getComputedStyle !== "function") {
|
|
247
|
-
detected.value = null;
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
const parent = element.value?.parentElement;
|
|
251
|
-
if (!parent) {
|
|
252
|
-
detected.value = null;
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
const painted = readPaintedBackground(parent);
|
|
256
|
-
detected.value = painted ? pickMediaMode(painted.background, painted.ambient) : null;
|
|
257
|
-
}
|
|
258
|
-
onMounted(measure);
|
|
259
|
-
watch(enabled, measure);
|
|
260
|
-
return detected;
|
|
261
|
-
}
|
|
262
|
-
//#endregion
|
|
263
|
-
//#region src/Theme/MediaTheme.vue
|
|
264
|
-
const _hoisted_1$1 = ["data-astryx-media"];
|
|
265
|
-
const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
266
|
-
name: "AstryxMediaTheme",
|
|
267
|
-
inheritAttrs: false,
|
|
268
|
-
__name: "MediaTheme",
|
|
269
|
-
props: {
|
|
270
|
-
mode: {},
|
|
271
|
-
fallback: { default: "dark" }
|
|
272
|
-
},
|
|
273
|
-
setup(__props, { expose: __expose }) {
|
|
274
|
-
const props = __props;
|
|
275
|
-
const attrs = useAttrs();
|
|
276
|
-
const root = useTemplateRef("root");
|
|
277
|
-
const theme = inject(themeContextKey, null);
|
|
278
|
-
const detected = useAutoMediaMode(root, computed(() => props.mode === "auto"));
|
|
279
|
-
const resolved = computed(() => {
|
|
280
|
-
if (props.mode === "off") return "off";
|
|
281
|
-
if (props.mode === "auto") return detected.value ?? props.fallback;
|
|
282
|
-
return props.mode;
|
|
283
|
-
});
|
|
284
|
-
provide(mediaThemeKey, resolved);
|
|
285
|
-
const rootStyle = computed(() => {
|
|
286
|
-
const surface = resolved.value === "dark" ? theme?.value.theme.onDark : resolved.value === "light" ? theme?.value.theme.onLight : void 0;
|
|
287
|
-
if (!surface) return {};
|
|
288
|
-
return bridgeSurfaceTokens(surface);
|
|
289
|
-
});
|
|
290
|
-
__expose({ element: root });
|
|
291
|
-
return (_ctx, _cache) => {
|
|
292
|
-
return openBlock(), createElementBlock("div", {
|
|
293
|
-
ref_key: "root",
|
|
294
|
-
ref: root,
|
|
295
|
-
class: normalizeClass(["astryx-media-theme", unref(attrs).class]),
|
|
296
|
-
"data-astryx-media": resolved.value === "off" ? void 0 : resolved.value,
|
|
297
|
-
style: normalizeStyle([rootStyle.value, unref(attrs).style])
|
|
298
|
-
}, [renderSlot(_ctx.$slots, "default")], 14, _hoisted_1$1);
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
//#endregion
|
|
303
|
-
//#region src/Theme/useThemeRootSync.ts
|
|
304
|
-
const entries = [];
|
|
305
|
-
let baseSnapshot = null;
|
|
306
|
-
function capture() {
|
|
307
|
-
const root = document.documentElement;
|
|
308
|
-
return {
|
|
309
|
-
theme: root.getAttribute("data-astryx-theme"),
|
|
310
|
-
mode: root.getAttribute("data-astryx-color-mode")
|
|
311
|
-
};
|
|
312
|
-
}
|
|
313
|
-
function writeAttribute(name, value) {
|
|
314
|
-
const root = document.documentElement;
|
|
315
|
-
if (value == null) root.removeAttribute(name);
|
|
316
|
-
else root.setAttribute(name, value);
|
|
317
|
-
}
|
|
318
|
-
function apply(entry) {
|
|
319
|
-
const root = document.documentElement;
|
|
320
|
-
root.setAttribute("data-astryx-theme", entry.name());
|
|
321
|
-
const mode = entry.mode();
|
|
322
|
-
if (mode === "light" || mode === "dark") root.setAttribute("data-astryx-color-mode", mode);
|
|
323
|
-
else root.removeAttribute("data-astryx-color-mode");
|
|
324
|
-
}
|
|
325
|
-
function restoreBase() {
|
|
326
|
-
if (!baseSnapshot) return;
|
|
327
|
-
writeAttribute("data-astryx-theme", baseSnapshot.theme);
|
|
328
|
-
writeAttribute("data-astryx-color-mode", baseSnapshot.mode);
|
|
329
|
-
baseSnapshot = null;
|
|
330
|
-
}
|
|
331
|
-
/**
|
|
332
|
-
* The outermost Theme mirrors its name and mode onto `documentElement`, so
|
|
333
|
-
* portaled UI and browser chrome see the same theme. Nested themes do not.
|
|
334
|
-
*/
|
|
335
|
-
function useThemeRootSync(isNested, themeName, mode) {
|
|
336
|
-
if (isNested || typeof document === "undefined") return;
|
|
337
|
-
const entry = {
|
|
338
|
-
name: themeName,
|
|
339
|
-
mode
|
|
340
|
-
};
|
|
341
|
-
onMounted(() => {
|
|
342
|
-
if (entries.length === 0) baseSnapshot = capture();
|
|
343
|
-
entries.push(entry);
|
|
344
|
-
apply(entry);
|
|
345
|
-
});
|
|
346
|
-
watch(() => [themeName(), mode()], () => {
|
|
347
|
-
if (entries[entries.length - 1] === entry) apply(entry);
|
|
348
|
-
});
|
|
349
|
-
onBeforeUnmount(() => {
|
|
350
|
-
const index = entries.lastIndexOf(entry);
|
|
351
|
-
if (index >= 0) entries.splice(index, 1);
|
|
352
|
-
const top = entries[entries.length - 1];
|
|
353
|
-
if (top) apply(top);
|
|
354
|
-
else restoreBase();
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
//#endregion
|
|
358
|
-
//#region src/Theme/Theme.vue
|
|
359
|
-
const _hoisted_1 = ["data-astryx-theme", "data-astryx-color-mode"];
|
|
360
|
-
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
361
|
-
name: "AstryxTheme",
|
|
362
|
-
inheritAttrs: false,
|
|
363
|
-
__name: "Theme",
|
|
364
|
-
props: {
|
|
365
|
-
theme: {},
|
|
366
|
-
mode: { default: "system" }
|
|
367
|
-
},
|
|
368
|
-
setup(__props, { expose: __expose }) {
|
|
369
|
-
const props = __props;
|
|
370
|
-
const attrs = useAttrs();
|
|
371
|
-
const root = useTemplateRef("root");
|
|
372
|
-
const isNested = inject(themeNestingKey, false);
|
|
373
|
-
const parentSyntax = inject(syntaxThemeKey, null);
|
|
374
|
-
provide(themeNestingKey, true);
|
|
375
|
-
provide(themeContextKey, computed(() => ({
|
|
376
|
-
theme: props.theme,
|
|
377
|
-
mode: props.mode
|
|
378
|
-
})));
|
|
379
|
-
if (parentSyntax || props.theme.syntax) provide(syntaxThemeKey, computed(() => props.theme.syntax ?? parentSyntax?.value ?? null));
|
|
380
|
-
useThemeRootSync(isNested, () => props.theme.name, () => props.mode);
|
|
381
|
-
const colorScheme = computed(() => {
|
|
382
|
-
if (props.mode === "dark") return "dark";
|
|
383
|
-
if (props.mode === "light") return "light";
|
|
384
|
-
return "light dark";
|
|
385
|
-
});
|
|
386
|
-
const rootStyle = computed(() => ({
|
|
387
|
-
colorScheme: colorScheme.value,
|
|
388
|
-
...themeStyle(props.theme)
|
|
389
|
-
}));
|
|
390
|
-
__expose({ element: root });
|
|
391
|
-
return (_ctx, _cache) => {
|
|
392
|
-
return openBlock(), createElementBlock("div", {
|
|
393
|
-
ref_key: "root",
|
|
394
|
-
ref: root,
|
|
395
|
-
class: normalizeClass(["astryx-theme", unref(attrs).class]),
|
|
396
|
-
"data-astryx-theme": __props.theme.name,
|
|
397
|
-
"data-astryx-color-mode": __props.mode === "system" ? void 0 : __props.mode,
|
|
398
|
-
style: normalizeStyle([rootStyle.value, unref(attrs).style])
|
|
399
|
-
}, [renderSlot(_ctx.$slots, "default")], 14, _hoisted_1);
|
|
400
|
-
};
|
|
401
|
-
}
|
|
402
|
-
});
|
|
403
|
-
//#endregion
|
|
404
|
-
//#region src/Theme/useMediaTheme.ts
|
|
405
|
-
/** Read the nearest MediaTheme. Outside one, the mode is `off`. */
|
|
406
|
-
function useMediaTheme() {
|
|
407
|
-
return { mode: inject(mediaThemeKey, null) ?? computed(() => "off") };
|
|
408
|
-
}
|
|
409
|
-
//#endregion
|
|
410
|
-
//#region src/Theme/useTheme.ts
|
|
411
|
-
function readDocumentToken(name, mode) {
|
|
412
|
-
if (typeof document === "undefined") return "";
|
|
413
|
-
const raw = getComputedStyle(document.documentElement).getPropertyValue(name).trim();
|
|
414
|
-
return raw ? resolveLightDark(raw, mode) : "";
|
|
415
|
-
}
|
|
416
|
-
/**
|
|
417
|
-
* Read the nearest theme. Outside a `Theme`, the name is `neutral` and tokens
|
|
418
|
-
* are read from the document's custom properties.
|
|
419
|
-
*/
|
|
420
|
-
function useTheme() {
|
|
421
|
-
const context = inject(themeContextKey, null);
|
|
422
|
-
const prefersDark = useMediaQuery("(prefers-color-scheme: dark)");
|
|
423
|
-
const mode = computed(() => {
|
|
424
|
-
const requested = context?.value.mode;
|
|
425
|
-
if (requested === "light" || requested === "dark") return requested;
|
|
426
|
-
return readColorMode(prefersDark.value);
|
|
427
|
-
});
|
|
428
|
-
const name = computed(() => context?.value.theme.name ?? "neutral");
|
|
429
|
-
const tokens = computed(() => {
|
|
430
|
-
const source = context?.value.theme.tokens ?? {};
|
|
431
|
-
const resolved = {};
|
|
432
|
-
for (const [key, value] of Object.entries(source)) resolved[key] = resolveLightDark(value, mode.value);
|
|
433
|
-
return resolved;
|
|
434
|
-
});
|
|
435
|
-
function token(tokenName) {
|
|
436
|
-
const key = normalizeTokenName(tokenName);
|
|
437
|
-
return tokens.value[key] ?? readDocumentToken(key, mode.value);
|
|
438
|
-
}
|
|
439
|
-
return {
|
|
440
|
-
name,
|
|
441
|
-
mode,
|
|
442
|
-
token,
|
|
443
|
-
tokens
|
|
444
|
-
};
|
|
445
|
-
}
|
|
446
|
-
//#endregion
|
|
447
|
-
export { defineTheme as a, normalizeTokenName as c, _sfc_main$1 as i, useMediaTheme as n, isDefinedTheme as o, _sfc_main as r, neutralTheme as s, useTheme as t };
|