@astryx-vue/core 0.1.3 → 0.2.1
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-BylcA4vV.js → AlertDialog-ovx4cBjM.js} +1 -1
- package/dist/AppShell/index.js +1 -1
- package/dist/{AppShell-b0PWt9Fz.js → AppShell-1wNIEtK_.js} +2 -2
- package/dist/Avatar/index.d.ts +1 -1
- package/dist/Avatar/index.js +1 -1
- package/dist/Avatar-jmHInHwj.js +244 -0
- package/dist/AvatarGroup/index.d.ts +1 -1
- package/dist/AvatarGroup/index.js +1 -1
- package/dist/{AvatarGroup-CZcgAMjM.js → AvatarGroup-QyzSrpYA.js} +8 -7
- package/dist/Badge/index.d.ts +1 -1
- package/dist/Badge/index.js +1 -1
- package/dist/Badge-CjDQPF5g.js +30 -0
- package/dist/Banner/index.d.ts +1 -1
- package/dist/Breadcrumbs/index.d.ts +2 -2
- package/dist/Breadcrumbs/index.js +1 -1
- package/dist/{Breadcrumbs-C3YZFQ9w.js → Breadcrumbs-C97HmjkC.js} +45 -11
- package/dist/Button/index.d.ts +1 -1
- package/dist/ButtonGroup/index.d.ts +1 -1
- package/dist/Calendar/index.d.ts +2 -2
- package/dist/Calendar/index.js +1 -1
- package/dist/Calendar-DqC3EDN1.js +352 -0
- package/dist/Card/index.d.ts +1 -1
- package/dist/Carousel/index.d.ts +2 -0
- package/dist/Carousel/index.js +2 -0
- package/dist/Carousel-BGUnskjo.js +363 -0
- package/dist/Chat/index.js +1 -1
- package/dist/{Chat-C1aWl5V3.js → Chat-DCjXRiOF.js} +8 -8
- 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/Citation/index.js +1 -1
- package/dist/{Citation-C1X0Rde8.js → Citation-DunoAqVH.js} +2 -2
- package/dist/ClickableCard/index.d.ts +1 -1
- package/dist/Code/index.d.ts +3 -2
- package/dist/Code/index.js +4 -2
- package/dist/Code-yb_KOFtJ.js +299 -0
- package/dist/{CodeBlock-BQdooQy2.js → CodeBlock-CAF-VJnh.js} +8 -2
- package/dist/Collapsible/index.js +1 -1
- package/dist/{Collapsible-BS9ctCQV.js → Collapsible-DvMiYJp7.js} +1 -1
- package/dist/CommandPalette/index.js +1 -1
- package/dist/{CommandPalette-u5h_E05P.js → CommandPalette-xfm9ldUI.js} +1 -1
- package/dist/ComplexSelector/index.d.ts +1 -1
- package/dist/ComplexSelector/index.js +1 -1
- package/dist/{ComplexSelector-BHmGWml0.js → ComplexSelector-B6lBTRhP.js} +2 -2
- package/dist/ContextMenu/index.d.ts +2 -2
- package/dist/ContextMenu/index.js +1 -1
- package/dist/{ContextMenu-dA-ppaRQ.js → ContextMenu-DUkED3Z3.js} +101 -63
- package/dist/DateInput/index.d.ts +2 -2
- package/dist/DateInput/index.js +1 -1
- package/dist/DateInput-Crcg-CCj.js +376 -0
- package/dist/DateRangeInput/index.d.ts +1 -1
- package/dist/DateRangeInput/index.js +1 -1
- package/dist/{DateRangeInput-fmQlr_A7.js → DateRangeInput-e9KSxBBK.js} +2 -2
- package/dist/DateTimeInput/index.d.ts +1 -1
- package/dist/DateTimeInput/index.js +1 -1
- package/dist/{DateTimeInput-Bs1JmcIp.js → DateTimeInput-fSOfuLex.js} +5 -3
- package/dist/DropdownMenu/index.d.ts +3 -2
- package/dist/DropdownMenu/index.js +3 -2
- package/dist/{DropdownMenu-B0gogrvG.js → DropdownMenu-8G0B1UND.js} +63 -16
- package/dist/DropdownMenu-XvW4BJob.js +164 -0
- package/dist/EmptyState/index.js +1 -1
- package/dist/{EmptyState-Bhlqgsg4.js → EmptyState-CUJdTYKV.js} +1 -1
- package/dist/FileInput/index.d.ts +1 -1
- package/dist/FileInput/index.js +1 -1
- package/dist/{FileInput-CmAfOpkA.js → FileInput-D-fchyQH.js} +2 -2
- package/dist/Icon/index.d.ts +4 -0
- package/dist/Icon/index.js +3 -0
- package/dist/Icon/plugin.d.ts +45 -0
- package/dist/Icon/plugin.js +177 -0
- package/dist/Icon-Bku25g_K.js +193 -0
- package/dist/Lightbox/index.d.ts +2 -0
- package/dist/Lightbox/index.js +2 -0
- package/dist/Lightbox-uuVGgHxW.js +384 -0
- package/dist/Link/index.d.ts +1 -1
- package/dist/Link/index.js +1 -1
- package/dist/Link-DqdQZ37C.js +141 -0
- package/dist/List/index.d.ts +1 -1
- package/dist/Markdown/index.js +1 -1
- package/dist/{Markdown-CwtLr3f_.js → Markdown-DLICa3db.js} +3 -3
- package/dist/MetadataList/index.d.ts +1 -1
- package/dist/MetadataList/index.js +1 -1
- package/dist/{MetadataList-DlXQTLog.js → MetadataList-h492rqEN.js} +1 -1
- package/dist/MobileNav/index.js +1 -1
- package/dist/{MobileNavToggle-CgQamG6E.js → MobileNavToggle-BMj3Wtuq.js} +1 -1
- package/dist/MoreMenu/index.d.ts +1 -1
- package/dist/MoreMenu/index.js +1 -1
- package/dist/{MoreMenu-BXL6Dqsu.js → MoreMenu-DkYi5az5.js} +2 -2
- package/dist/MultiSelector/index.d.ts +1 -1
- package/dist/MultiSelector/index.js +1 -1
- package/dist/{MultiSelector-DT8ZccMI.js → MultiSelector-C2IS-EaU.js} +2 -2
- package/dist/NavItem/index.d.ts +1 -1
- package/dist/NavMenu/index.d.ts +1 -1
- package/dist/NavMenu/index.js +1 -1
- package/dist/{NavMenuItem-mzNQESpB.js → NavMenuItem-B-k7olt5.js} +2 -1
- package/dist/NumberInput/index.d.ts +2 -2
- package/dist/NumberInput/index.js +1 -1
- package/dist/NumberInput-CjfAsFwj.js +210 -0
- package/dist/Outline/index.d.ts +2 -0
- package/dist/Outline/index.js +2 -0
- package/dist/Outline-BTmrtvXR.js +325 -0
- package/dist/OverflowList/index.d.ts +1 -1
- package/dist/OverflowList/index.js +1 -1
- package/dist/{OverflowList-zXg3g6fy.js → OverflowList-CRE8BE7V.js} +2 -2
- package/dist/Overlay/index.d.ts +1 -1
- package/dist/Pagination/index.d.ts +2 -2
- package/dist/Pagination/index.js +1 -1
- package/dist/{Pagination-DXfgMUKJ.js → Pagination-BpGXPmc7.js} +76 -22
- package/dist/Popover/index.d.ts +1 -1
- package/dist/ProgressBar/index.d.ts +1 -1
- package/dist/ProgressBar/index.js +1 -1
- package/dist/{ProgressBar-ChDp-7oe.js → ProgressBar-DO9Chic6.js} +31 -11
- package/dist/Radio/index.d.ts +1 -1
- package/dist/RadioList/index.d.ts +1 -1
- package/dist/Resizable/index.js +1 -1
- package/dist/{Resizable-BuGKvU9I.js → Resizable-CE8XQDL2.js} +1 -1
- package/dist/ScrollableArea/index.d.ts +1 -1
- package/dist/SegmentedControl/index.d.ts +1 -1
- package/dist/SelectableCard/index.d.ts +1 -1
- package/dist/Selector/index.d.ts +2 -2
- package/dist/Selector/index.js +1 -1
- package/dist/Selector-DkJOLZSR.js +468 -0
- package/dist/SideNav/index.d.ts +1 -1
- package/dist/SideNav/index.js +1 -1
- package/dist/{SideNav-Cdrigq2A.js → SideNav-DcDWBnXJ.js} +17 -17
- package/dist/Stepper/index.d.ts +1 -1
- package/dist/Stepper/index.js +1 -1
- package/dist/{Stepper-DxmLfh8O.js → Stepper-DZKaqEoz.js} +1 -1
- package/dist/Switch/index.d.ts +1 -1
- package/dist/TabList/index.d.ts +1 -1
- package/dist/TabList/index.js +1 -1
- package/dist/{TabList-C411uNQU.js → TabList-hm06QPiW.js} +10 -3
- package/dist/Table/index.js +1 -1
- package/dist/{Table-7qRmlIQd.js → Table-DwehtMap.js} +4 -4
- package/dist/Text/index.d.ts +3 -2
- package/dist/Text/index.js +1 -1
- package/dist/{Text-CKd7e3gK.js → Text-BHVghsWo.js} +12 -2
- package/dist/TextArea/index.d.ts +1 -1
- package/dist/TextArea/index.js +1 -1
- package/dist/{TextArea-Cv9UVbzS.js → TextArea-CPwSytdO.js} +12 -6
- package/dist/TextInput/index.d.ts +1 -1
- package/dist/Theme/index.d.ts +2 -0
- package/dist/Theme/index.js +2 -0
- package/dist/Theme-BuUiiJNr.js +429 -0
- package/dist/Thumbnail/index.js +1 -1
- package/dist/{Thumbnail-BWVzLLyI.js → Thumbnail-CAOYds8t.js} +11 -11
- package/dist/{TimeField-l3QzU6vC.js → TimeField-BGbxCoKU.js} +2 -2
- package/dist/TimeInput/index.d.ts +1 -1
- package/dist/TimeInput/index.js +1 -1
- package/dist/{TimeInput-OkgX-xbQ.js → TimeInput-DJP3l4ZS.js} +1 -1
- package/dist/Timer/index.d.ts +2 -0
- package/dist/Timer/index.js +2 -0
- package/dist/Timer-B7GV6hqd.js +134 -0
- package/dist/Timestamp/index.d.ts +1 -1
- package/dist/Timestamp/index.js +2 -1
- package/dist/{Timestamp-DUoP9ari.js → Timestamp-BzRp8uWc.js} +5 -122
- package/dist/Toast/index.d.ts +2 -2
- package/dist/Toast/index.js +1 -1
- package/dist/{Toast-BKXPvEMp.js → Toast-C2ML-bmi.js} +37 -7
- 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-C4KD0fZD.js → Token-CjocuhzE.js} +1 -1
- package/dist/Tokenizer/index.d.ts +1 -1
- package/dist/Tokenizer/index.js +1 -1
- package/dist/{Tokenizer-BA8sTMPZ.js → Tokenizer-mYES5SPM.js} +2 -2
- package/dist/Toolbar/index.d.ts +1 -1
- package/dist/TopNav/index.d.ts +1 -1
- package/dist/TopNav/index.js +1 -1
- package/dist/{TopNav-CZokS7E_.js → TopNav-C2t6JkZb.js} +4 -4
- package/dist/TreeList/index.d.ts +1 -1
- package/dist/TreeList/index.js +1 -1
- package/dist/{TreeList-CIbAGOMf.js → TreeList-THJ0KamE.js} +3 -3
- package/dist/Typeahead/index.d.ts +1 -1
- package/dist/Typeahead/index.js +1 -1
- package/dist/{Typeahead-DIw-K4aa.js → Typeahead-D7VnvRpK.js} +2 -2
- package/dist/{context-D6ECRdc5.js → context-DzcK4T_C.js} +58 -2
- package/dist/context-O2Vb8cJl.js +57 -0
- package/dist/formatInstant-BDWUIxS7.js +119 -0
- package/dist/index-1AZ4KZhg.d.ts +96 -0
- package/dist/index-3p2BDVHq.d.ts +31 -0
- package/dist/{index-BuubzuE8.d.ts → index-BDZCJ9ri.d.ts} +2 -2
- package/dist/{index-FEy8qFSD.d.ts → index-BHqRH7QW.d.ts} +2 -2
- package/dist/{index-CTolyeii.d.ts → index-BLOEjvaM.d.ts} +16 -2
- package/dist/index-BMrggCw-.d.ts +52 -0
- package/dist/{index-z4p2k9VR.d.ts → index-Bgv4ZmBl.d.ts} +20 -2
- package/dist/{index-BoRIw-bP.d.ts → index-Bt7ewoz2.d.ts} +32 -2
- package/dist/{index-CjtAH60j.d.ts → index-Bu0Zd1uw.d.ts} +1 -1
- package/dist/{index-uQrLBZfF.d.ts → index-Bu3oXIIS.d.ts} +24 -0
- package/dist/{index-CX97hlld.d.ts → index-CBym0hSq.d.ts} +2 -19
- package/dist/index-CJlBAXwj.d.ts +100 -0
- package/dist/{index-DT9S92sh.d.ts → index-CNjbOgty.d.ts} +15 -0
- package/dist/{index-gW0HW02U.d.ts → index-COxy6LEW.d.ts} +1 -1
- package/dist/index-CRizexSC.d.ts +147 -0
- package/dist/{index-DYChvBOM.d.ts → index-Clmz00IK.d.ts} +31 -0
- package/dist/index-Cm_TiLXU.d.ts +22 -0
- package/dist/index-Cn-sSds-.d.ts +68 -0
- package/dist/index-CsVS37na.d.ts +81 -0
- package/dist/{index-DRmb-oUa.d.ts → index-CuFLztiI.d.ts} +6 -1
- package/dist/{index-CT8KEpec.d.ts → index-D0TlUOtG.d.ts} +1 -1
- package/dist/{index-fa72tWIU.d.ts → index-D2bSSSBP.d.ts} +1 -1
- package/dist/{index-2u4l3wq8.d.ts → index-DAiGhkNZ.d.ts} +15 -2
- package/dist/{index-DGNqi2za.d.ts → index-DQAnGHu7.d.ts} +5 -5
- package/dist/{index-BfOtLyNH.d.ts → index-D_nYxnNv.d.ts} +1 -1
- package/dist/{index-Df2YvC8o.d.ts → index-DeOftUMq.d.ts} +191 -75
- package/dist/{index-DXDGk38y.d.ts → index-Dg3ZmwEg.d.ts} +11 -0
- package/dist/{index-BiMGXtD-.d.ts → index-DimuSES0.d.ts} +14 -1
- package/dist/{index-C_2Z65Rp.d.ts → index-DnEh-HA0.d.ts} +1 -1
- package/dist/{index-D-ZuubCK.d.ts → index-DnSrjbjP.d.ts} +1 -1
- package/dist/{index-mQ6EPmaG.d.ts → index-DsyKhauk.d.ts} +78 -9
- package/dist/{index-C6RecznD.d.ts → index-I4J7gwa1.d.ts} +51 -9
- package/dist/{index-utZGF4GR.d.ts → index-NOXYEdOI.d.ts} +1 -1
- package/dist/{index-B4OOtNP8.d.ts → index-Z_onS2lR.d.ts} +1 -1
- package/dist/{index-CVn0GBdB.d.ts → index-cG1E0U2s.d.ts} +1 -1
- package/dist/{index-DEeJowZf.d.ts → index-cGagYM1g.d.ts} +15 -2
- package/dist/{index-Ck8qy6Rf.d.ts → index-c_TaW8mM.d.ts} +24 -2
- package/dist/{index-Bqb_Fyju.d.ts → index-jdjcb3Js.d.ts} +2 -2
- package/dist/index.d.ts +78 -68
- package/dist/index.js +107 -96
- package/dist/locale/index.d.ts +1 -1
- package/dist/locale/index.js +1 -1
- package/dist/registry-B1ObuP--.d.ts +45 -0
- package/dist/registry-C7OZb0PJ.js +135 -0
- package/dist/syntaxTheme-Bcs1YMF7.d.ts +38 -0
- package/dist/syntaxTheme-ClpWALZX.js +75 -0
- package/dist/types-BKcxXW--.d.ts +114 -0
- package/dist/types-Bt-lSgYX.d.ts +65 -0
- package/dist/{index-B8MbfMwV.d.ts → types-DDAAT1Xd.d.ts} +36 -82
- package/package.json +30 -1
- package/styles/avatar.css +14 -0
- package/styles/badge.css +8 -0
- package/styles/breadcrumbs.css +6 -1
- package/styles/button.css +13 -0
- package/styles/calendar.css +16 -0
- package/styles/card.css +2 -0
- package/styles/carousel.css +120 -0
- package/styles/chat.css +5 -2
- package/styles/dropdown-menu.css +11 -0
- package/styles/heading.css +6 -2
- package/styles/icon.css +38 -8
- package/styles/lightbox.css +144 -0
- package/styles/link.css +5 -0
- package/styles/media-theme.css +51 -0
- package/styles/number-input.css +22 -0
- package/styles/outline.css +124 -0
- package/styles/pagination.css +45 -1
- package/styles/progress-bar.css +4 -0
- package/styles/selector.css +58 -0
- package/styles/tab-list.css +15 -0
- package/styles/text-area.css +17 -0
- package/styles/text-input.css +5 -0
- package/styles/text.css +63 -14
- package/styles/theme.css +29 -0
- package/styles/timer.css +34 -0
- package/styles/toast.css +7 -0
- package/styles/toolbar.css +11 -0
- package/styles.css +6 -0
- package/dist/Avatar-5s3HSrtN.js +0 -136
- package/dist/Badge-Ba0EwsTj.js +0 -19
- package/dist/Calendar-CYhGDT6f.js +0 -277
- package/dist/DateInput-D2ErjXYO.js +0 -250
- package/dist/Icon-5MdZQ18k.js +0 -86
- package/dist/Link-CprjOuTI.js +0 -92
- package/dist/NumberInput-DspJO6z6.js +0 -147
- package/dist/Selector-DlZpQh42.js +0 -325
- package/dist/index-BzqRns96.d.ts +0 -64
- package/dist/index-ZJyk8RtQ.d.ts +0 -68
- package/dist/{CheckboxList-EsIEXjK_.js → CheckboxList-BbCPiend.js} +1 -1
- package/dist/{index-4FM5lQdV.d.ts → index-BUXNRekN.d.ts} +1 -1
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { t as usePositionedLayer } from "./usePositionedLayer-C1NBOsVT.js";
|
|
2
|
+
import { t as _sfc_main$1 } from "./Icon-Bku25g_K.js";
|
|
3
|
+
import { c as useDropdownMenuContext, n as useMenuFocus, o as MENU_ITEM_ROLES, s as activateMenuItem } from "./DropdownMenu-8G0B1UND.js";
|
|
4
|
+
import { t as _sfc_main$2 } from "./Item-C1z6gXn8.js";
|
|
5
|
+
import { Fragment, Teleport, computed, createBlock, createElementBlock, createElementVNode, createSlots, createVNode, defineComponent, nextTick, normalizeStyle, onBeforeUnmount, openBlock, ref, renderSlot, unref, useSlots, vShow, watch, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
|
6
|
+
import "../styles/dropdown-menu.css";
|
|
7
|
+
//#region src/DropdownMenu/DropdownMenuSubMenu.vue
|
|
8
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
9
|
+
name: "AstryxDropdownMenuSubMenu",
|
|
10
|
+
inheritAttrs: false,
|
|
11
|
+
__name: "DropdownMenuSubMenu",
|
|
12
|
+
props: {
|
|
13
|
+
label: {},
|
|
14
|
+
icon: {},
|
|
15
|
+
description: {},
|
|
16
|
+
isDisabled: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
default: false
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
setup(__props) {
|
|
22
|
+
const props = __props;
|
|
23
|
+
const slots = useSlots();
|
|
24
|
+
const menu = useDropdownMenuContext();
|
|
25
|
+
const rowComponent = ref(null);
|
|
26
|
+
const rowRef = computed(() => rowComponent.value?.element ?? null);
|
|
27
|
+
const flyoutRef = ref(null);
|
|
28
|
+
const flyoutOpen = ref(false);
|
|
29
|
+
const menuSize = computed(() => menu?.menuSize.value ?? "md");
|
|
30
|
+
const density = computed(() => menuSize.value === "sm" ? "compact" : "balanced");
|
|
31
|
+
const hasStart = computed(() => slots.icon != null || props.icon != null);
|
|
32
|
+
const focus = useMenuFocus({ list: flyoutRef });
|
|
33
|
+
const { position } = usePositionedLayer({
|
|
34
|
+
anchor: rowRef,
|
|
35
|
+
layer: flyoutRef,
|
|
36
|
+
isOpen: flyoutOpen,
|
|
37
|
+
placement: computed(() => "end"),
|
|
38
|
+
alignment: computed(() => "start"),
|
|
39
|
+
gap: 4
|
|
40
|
+
});
|
|
41
|
+
const flyoutStyle = computed(() => ({
|
|
42
|
+
top: `${position.value.top}px`,
|
|
43
|
+
left: `${position.value.left}px`,
|
|
44
|
+
zIndex: 1001
|
|
45
|
+
}));
|
|
46
|
+
let closeTimer = 0;
|
|
47
|
+
function cancelClose() {
|
|
48
|
+
if (closeTimer !== 0) window.clearTimeout(closeTimer);
|
|
49
|
+
closeTimer = 0;
|
|
50
|
+
}
|
|
51
|
+
function scheduleClose() {
|
|
52
|
+
cancelClose();
|
|
53
|
+
closeTimer = window.setTimeout(() => {
|
|
54
|
+
flyoutOpen.value = false;
|
|
55
|
+
}, 120);
|
|
56
|
+
}
|
|
57
|
+
async function openFlyout() {
|
|
58
|
+
if (props.isDisabled) return;
|
|
59
|
+
cancelClose();
|
|
60
|
+
flyoutOpen.value = true;
|
|
61
|
+
await nextTick();
|
|
62
|
+
focus.focusFirst();
|
|
63
|
+
}
|
|
64
|
+
function closeFlyout() {
|
|
65
|
+
cancelClose();
|
|
66
|
+
flyoutOpen.value = false;
|
|
67
|
+
rowComponent.value?.focus();
|
|
68
|
+
}
|
|
69
|
+
function onFlyoutKeydown(event) {
|
|
70
|
+
if (event.key === "ArrowLeft" || event.key === "Escape") {
|
|
71
|
+
event.preventDefault();
|
|
72
|
+
event.stopPropagation();
|
|
73
|
+
closeFlyout();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
77
|
+
event.preventDefault();
|
|
78
|
+
event.stopPropagation();
|
|
79
|
+
const focused = document.activeElement;
|
|
80
|
+
if (focused instanceof HTMLElement && MENU_ITEM_ROLES.has(focused.getAttribute("role") ?? "")) activateMenuItem(focused, event);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
event.stopPropagation();
|
|
84
|
+
focus.handleKeyDown(event);
|
|
85
|
+
}
|
|
86
|
+
watch(() => menu?.isOpen.value, (open) => {
|
|
87
|
+
if (!open) flyoutOpen.value = false;
|
|
88
|
+
});
|
|
89
|
+
onBeforeUnmount(cancelClose);
|
|
90
|
+
return (_ctx, _cache) => {
|
|
91
|
+
return openBlock(), createElementBlock(Fragment, null, [createVNode(_sfc_main$2, {
|
|
92
|
+
ref_key: "rowComponent",
|
|
93
|
+
ref: rowComponent,
|
|
94
|
+
class: "astryx-dropdown-menu-item",
|
|
95
|
+
role: "menuitem",
|
|
96
|
+
"aria-haspopup": "menu",
|
|
97
|
+
"aria-expanded": flyoutOpen.value,
|
|
98
|
+
"data-menu-size": menuSize.value,
|
|
99
|
+
"data-variant": "default",
|
|
100
|
+
density: density.value,
|
|
101
|
+
description: __props.description,
|
|
102
|
+
"is-disabled": __props.isDisabled,
|
|
103
|
+
label: __props.label,
|
|
104
|
+
tabindex: __props.isDisabled ? void 0 : -1,
|
|
105
|
+
"on-click": openFlyout,
|
|
106
|
+
onKeydown: [
|
|
107
|
+
withKeys(withModifiers(openFlyout, ["prevent", "stop"]), ["right"]),
|
|
108
|
+
withKeys(withModifiers(openFlyout, ["prevent", "stop"]), ["enter"]),
|
|
109
|
+
withKeys(withModifiers(openFlyout, ["prevent", "stop"]), ["space"])
|
|
110
|
+
],
|
|
111
|
+
onPointerenter: openFlyout,
|
|
112
|
+
onPointerleave: scheduleClose
|
|
113
|
+
}, createSlots({
|
|
114
|
+
endContent: withCtx(() => [createVNode(_sfc_main$1, {
|
|
115
|
+
color: "secondary",
|
|
116
|
+
icon: "chevronRight",
|
|
117
|
+
size: "sm"
|
|
118
|
+
})]),
|
|
119
|
+
_: 2
|
|
120
|
+
}, [
|
|
121
|
+
hasStart.value ? {
|
|
122
|
+
name: "startContent",
|
|
123
|
+
fn: withCtx(() => [renderSlot(_ctx.$slots, "icon", {}, () => [createVNode(_sfc_main$1, {
|
|
124
|
+
color: "secondary",
|
|
125
|
+
icon: __props.icon,
|
|
126
|
+
size: "sm"
|
|
127
|
+
}, null, 8, ["icon"])])]),
|
|
128
|
+
key: "0"
|
|
129
|
+
} : void 0,
|
|
130
|
+
unref(slots).label ? {
|
|
131
|
+
name: "label",
|
|
132
|
+
fn: withCtx(() => [renderSlot(_ctx.$slots, "label")]),
|
|
133
|
+
key: "1"
|
|
134
|
+
} : void 0,
|
|
135
|
+
unref(slots).description ? {
|
|
136
|
+
name: "description",
|
|
137
|
+
fn: withCtx(() => [renderSlot(_ctx.$slots, "description")]),
|
|
138
|
+
key: "2"
|
|
139
|
+
} : void 0
|
|
140
|
+
]), 1032, [
|
|
141
|
+
"aria-expanded",
|
|
142
|
+
"data-menu-size",
|
|
143
|
+
"density",
|
|
144
|
+
"description",
|
|
145
|
+
"is-disabled",
|
|
146
|
+
"label",
|
|
147
|
+
"tabindex",
|
|
148
|
+
"onKeydown"
|
|
149
|
+
]), (openBlock(), createBlock(Teleport, { to: "body" }, [withDirectives(createElementVNode("div", {
|
|
150
|
+
ref_key: "flyoutRef",
|
|
151
|
+
ref: flyoutRef,
|
|
152
|
+
class: "astryx-dropdown-menu astryx-dropdown-submenu",
|
|
153
|
+
role: "menu",
|
|
154
|
+
style: normalizeStyle(flyoutStyle.value),
|
|
155
|
+
tabindex: "-1",
|
|
156
|
+
onKeydown: onFlyoutKeydown,
|
|
157
|
+
onPointerenter: cancelClose,
|
|
158
|
+
onPointerleave: scheduleClose
|
|
159
|
+
}, [renderSlot(_ctx.$slots, "default")], 36), [[vShow, flyoutOpen.value]])]))], 64);
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
//#endregion
|
|
164
|
+
export { _sfc_main as t };
|
package/dist/EmptyState/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as _sfc_main } from "../EmptyState-
|
|
1
|
+
import { t as _sfc_main } from "../EmptyState-CUJdTYKV.js";
|
|
2
2
|
export { _sfc_main as EmptyState };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as _sfc_main$1 } from "./Heading-Dugosn6j.js";
|
|
2
|
-
import { t as _sfc_main$2 } from "./Text-
|
|
2
|
+
import { t as _sfc_main$2 } from "./Text-BHVghsWo.js";
|
|
3
3
|
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, openBlock, renderSlot, toDisplayString, useTemplateRef, withCtx } from "vue";
|
|
4
4
|
import "../styles/empty-state.css";
|
|
5
5
|
//#region src/EmptyState/EmptyState.vue
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Bn as _default, Gn as FileInputStatus, Hn as FileInputMode, Kn as FileInputValue, Un as FileInputProps, Vn as FileInputEmits, Wn as FileInputSize } from "../index-
|
|
1
|
+
import { Bn as _default, Gn as FileInputStatus, Hn as FileInputMode, Kn as FileInputValue, Un as FileInputProps, Vn as FileInputEmits, Wn as FileInputSize } from "../index-DeOftUMq.js";
|
|
2
2
|
export { _default as FileInput, type FileInputEmits, type FileInputMode, type FileInputProps, type FileInputSize, type FileInputStatus, type FileInputValue };
|
package/dist/FileInput/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as _sfc_main } from "../FileInput-
|
|
1
|
+
import { t as _sfc_main } from "../FileInput-D-fchyQH.js";
|
|
2
2
|
export { _sfc_main as FileInput };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as _sfc_main$1 } from "./VisuallyHidden-C7NN3VEP.js";
|
|
2
2
|
import { t as useAnnounce } from "./announce-Cnio10Wk.js";
|
|
3
3
|
import { n as selectFiles, t as formatFileSize } from "./useFileSelection-BPtaegqK.js";
|
|
4
|
-
import { a as useAstryxMessages } from "./context-
|
|
4
|
+
import { a as useAstryxMessages } from "./context-DzcK4T_C.js";
|
|
5
5
|
import { t as _sfc_main$2 } from "./FieldIcon--NTgW5IU.js";
|
|
6
6
|
import { t as _sfc_main$3 } from "./IconButton-BNQuz9W_.js";
|
|
7
|
-
import { t as _sfc_main$4 } from "./Icon-
|
|
7
|
+
import { t as _sfc_main$4 } from "./Icon-Bku25g_K.js";
|
|
8
8
|
import { t as _sfc_main$5 } from "./Spinner-9cYUCnDy.js";
|
|
9
9
|
import { t as _sfc_main$6 } from "./Field-8zRxzDHE.js";
|
|
10
10
|
import { computed, createBlock, createCommentVNode, createElementVNode, createTextVNode, createVNode, defineComponent, mergeModels, openBlock, shallowRef, toDisplayString, unref, useId, useModel, useTemplateRef, withCtx } from "vue";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { a as IconSize, i as IconProps, n as IconColor, o as IconSlots, r as IconName } from "../types-BKcxXW--.js";
|
|
2
|
+
import { a as isIconGlyph, i as iconGlyphSlug, n as ICON_GLYPHS, r as IconGlyphName, t as _default } from "../index-3p2BDVHq.js";
|
|
3
|
+
import { i as addIcon, n as IconifyIcon, r as addCollection, t as IconifyCollection } from "../registry-B1ObuP--.js";
|
|
4
|
+
export { ICON_GLYPHS, _default as Icon, type IconColor, type IconGlyphName, type IconName, type IconProps, type IconSize, type IconSlots, type IconifyCollection, type IconifyIcon, addCollection, addIcon, iconGlyphSlug, isIconGlyph };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { i as isIconGlyph, n as ICON_GLYPHS, r as iconGlyphSlug, t as _sfc_main } from "../Icon-Bku25g_K.js";
|
|
2
|
+
import { n as addCollection, r as addIcon } from "../registry-C7OZb0PJ.js";
|
|
3
|
+
export { ICON_GLYPHS, _sfc_main as Icon, addCollection, addIcon, iconGlyphSlug, isIconGlyph };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { t as IconifyCollection } from "../registry-B1ObuP--.js";
|
|
2
|
+
//#region src/Icon/plugin.d.ts
|
|
3
|
+
export interface AstryxIconsOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Collection prefixes to read, such as `['carbon']`.
|
|
6
|
+
*
|
|
7
|
+
* When omitted, every `@iconify-json/*` dependency of the project is used.
|
|
8
|
+
*/
|
|
9
|
+
collections?: readonly string[];
|
|
10
|
+
/**
|
|
11
|
+
* Read a collection by prefix. The default reads
|
|
12
|
+
* `@iconify-json/<prefix>/icons.json` from the project.
|
|
13
|
+
*/
|
|
14
|
+
loadCollection?: (prefix: string, root: string) => IconifyCollection | undefined;
|
|
15
|
+
}
|
|
16
|
+
interface AstryxIconsPlugin {
|
|
17
|
+
name: 'astryx-icons';
|
|
18
|
+
enforce: 'pre';
|
|
19
|
+
configResolved: (config: {
|
|
20
|
+
root: string;
|
|
21
|
+
}) => void;
|
|
22
|
+
resolveId: (id: string) => string | undefined;
|
|
23
|
+
load: (id: string) => string | undefined;
|
|
24
|
+
transform: (code: string, id: string) => {
|
|
25
|
+
code: string;
|
|
26
|
+
map: null;
|
|
27
|
+
} | undefined;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Vite plugin that bundles only the icons a project names in source.
|
|
31
|
+
*
|
|
32
|
+
* A static `name="carbon:settings"` becomes an import of that one icon. The
|
|
33
|
+
* collection JSON stays on disk; the client bundle receives the used bodies.
|
|
34
|
+
* Names built at runtime are invisible here — register those with
|
|
35
|
+
* `addCollection`.
|
|
36
|
+
*/
|
|
37
|
+
export declare function astryxIcons(options?: AstryxIconsOptions): AstryxIconsPlugin;
|
|
38
|
+
/** Static icon names written as `collection:icon`, or as a `name` binding. */
|
|
39
|
+
export declare function extractIconCandidates(code: string): string[];
|
|
40
|
+
/**
|
|
41
|
+
* VitePress sets the Vite root to `docs/`, which has no package.json.
|
|
42
|
+
* Walk up to the package that actually depends on `@iconify-json/*`.
|
|
43
|
+
*/
|
|
44
|
+
export declare function findPackageRoot(start: string): string;
|
|
45
|
+
//#endregion
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { a as parseIconName, o as resolveCollectionIcon, t as ASTRYX_ICON_QUEUE } from "../registry-C7OZb0PJ.js";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import process from "node:process";
|
|
6
|
+
//#region src/Icon/plugin.ts
|
|
7
|
+
const VIRTUAL = "virtual:astryx-icon/";
|
|
8
|
+
const ICON_PART = "[a-z0-9]+(?:[-_][a-z0-9]+)*";
|
|
9
|
+
/**
|
|
10
|
+
* Vite plugin that bundles only the icons a project names in source.
|
|
11
|
+
*
|
|
12
|
+
* A static `name="carbon:settings"` becomes an import of that one icon. The
|
|
13
|
+
* collection JSON stays on disk; the client bundle receives the used bodies.
|
|
14
|
+
* Names built at runtime are invisible here — register those with
|
|
15
|
+
* `addCollection`.
|
|
16
|
+
*/
|
|
17
|
+
function astryxIcons(options = {}) {
|
|
18
|
+
const cache = /* @__PURE__ */ new Map();
|
|
19
|
+
let root = process.cwd();
|
|
20
|
+
let prefixes;
|
|
21
|
+
const warned = /* @__PURE__ */ new Set();
|
|
22
|
+
function load(prefix) {
|
|
23
|
+
const key = prefix.toLowerCase();
|
|
24
|
+
if (cache.has(key)) return cache.get(key);
|
|
25
|
+
const loaded = (options.loadCollection ?? readInstalledCollection)(key, root);
|
|
26
|
+
cache.set(key, loaded);
|
|
27
|
+
return loaded;
|
|
28
|
+
}
|
|
29
|
+
function availablePrefixes() {
|
|
30
|
+
prefixes ??= (options.collections ?? discoverPrefixes(root)).map((prefix) => prefix.toLowerCase());
|
|
31
|
+
return prefixes;
|
|
32
|
+
}
|
|
33
|
+
function resolveSpecifier(raw) {
|
|
34
|
+
const parsed = parseIconName(raw, availablePrefixes());
|
|
35
|
+
if (parsed == null || !availablePrefixes().includes(parsed.prefix)) return void 0;
|
|
36
|
+
const collection = load(parsed.prefix);
|
|
37
|
+
if (collection == null) {
|
|
38
|
+
warnMissing(`${parsed.prefix}:${parsed.name}`, `Install @iconify-json/${parsed.prefix}.`);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (resolveCollectionIcon(collection, parsed.name) == null) {
|
|
42
|
+
warnMissing(`${parsed.prefix}:${parsed.name}`, "The collection has no icon by that name.");
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
return parsed;
|
|
46
|
+
}
|
|
47
|
+
function warnMissing(name, detail) {
|
|
48
|
+
if (warned.has(name)) return;
|
|
49
|
+
warned.add(name);
|
|
50
|
+
console.warn(`[astryx-vue] Icon "${name}" was not bundled. ${detail}`);
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
name: "astryx-icons",
|
|
54
|
+
enforce: "pre",
|
|
55
|
+
configResolved(config) {
|
|
56
|
+
root = findPackageRoot(config.root);
|
|
57
|
+
cache.clear();
|
|
58
|
+
prefixes = void 0;
|
|
59
|
+
},
|
|
60
|
+
resolveId(id) {
|
|
61
|
+
if (id.startsWith(VIRTUAL)) return `\0${id}`;
|
|
62
|
+
},
|
|
63
|
+
load(id) {
|
|
64
|
+
if (!id.startsWith(`\0${VIRTUAL}`)) return void 0;
|
|
65
|
+
const spec = id.slice(`\0${VIRTUAL}`.length);
|
|
66
|
+
const slash = spec.indexOf("/");
|
|
67
|
+
if (slash <= 0) return "export {}";
|
|
68
|
+
const prefix = spec.slice(0, slash);
|
|
69
|
+
const name = spec.slice(slash + 1);
|
|
70
|
+
const data = resolveCollectionIcon(load(prefix), name);
|
|
71
|
+
if (data == null) return "export {}";
|
|
72
|
+
const payload = iconPayload(data);
|
|
73
|
+
return `const queue = (globalThis[${JSON.stringify(ASTRYX_ICON_QUEUE)}] ??= [])\nqueue.push([${JSON.stringify(`${prefix}:${name}`)}, ${JSON.stringify(payload)}])\n`;
|
|
74
|
+
},
|
|
75
|
+
transform(code, id) {
|
|
76
|
+
if (!shouldScan(id)) return void 0;
|
|
77
|
+
const specs = /* @__PURE__ */ new Map();
|
|
78
|
+
for (const raw of extractIconCandidates(code)) {
|
|
79
|
+
const resolved = resolveSpecifier(raw);
|
|
80
|
+
if (resolved == null) continue;
|
|
81
|
+
specs.set(`${resolved.prefix}/${resolved.name}`, resolved);
|
|
82
|
+
}
|
|
83
|
+
if (specs.size === 0) return void 0;
|
|
84
|
+
const block = [...specs.values()].map((spec) => {
|
|
85
|
+
return `import '${VIRTUAL}${spec.prefix}/${spec.name}'`;
|
|
86
|
+
}).join("\n");
|
|
87
|
+
const next = (id.split("?", 1)[0] ?? id).endsWith(".vue") ? injectVue(code, block) : injectModule(code, block);
|
|
88
|
+
if (next === code) return void 0;
|
|
89
|
+
return {
|
|
90
|
+
code: next,
|
|
91
|
+
map: null
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function iconPayload(data) {
|
|
97
|
+
const payload = { body: data.body };
|
|
98
|
+
if (data.width != null) payload.width = data.width;
|
|
99
|
+
if (data.height != null) payload.height = data.height;
|
|
100
|
+
if (data.left != null) payload.left = data.left;
|
|
101
|
+
if (data.top != null) payload.top = data.top;
|
|
102
|
+
if (data.rotate != null) payload.rotate = data.rotate;
|
|
103
|
+
if (data.hFlip != null) payload.hFlip = data.hFlip;
|
|
104
|
+
if (data.vFlip != null) payload.vFlip = data.vFlip;
|
|
105
|
+
return payload;
|
|
106
|
+
}
|
|
107
|
+
function shouldScan(id) {
|
|
108
|
+
if (id.includes("\0") || id.includes("node_modules") || id.includes(VIRTUAL)) return false;
|
|
109
|
+
const [filename, query] = id.split("?", 2);
|
|
110
|
+
if (query?.includes("raw") || query?.includes("type=")) return false;
|
|
111
|
+
return /\.(?:vue|[cm]?[jt]sx?)$/.test(filename ?? "");
|
|
112
|
+
}
|
|
113
|
+
function unwrapLiteral(value) {
|
|
114
|
+
const trimmed = value.trim();
|
|
115
|
+
return (/^(["'`])([\s\S]*)\1$/.exec(trimmed)?.[2] ?? trimmed).trim();
|
|
116
|
+
}
|
|
117
|
+
/** Static icon names written as `collection:icon`, or as a `name` binding. */
|
|
118
|
+
function extractIconCandidates(code) {
|
|
119
|
+
const found = /* @__PURE__ */ new Set();
|
|
120
|
+
const colonLiteral = new RegExp(`(["'\`])(${ICON_PART}:${ICON_PART})\\1`, "gi");
|
|
121
|
+
const nameBinding = /(?:^|[\s<(]):?name\s*=\s*(["'])([\s\S]*?)\1/g;
|
|
122
|
+
const nameProperty = /(?:^|[{,\s])name\s*:\s*(["'`])([\s\S]*?)\1/g;
|
|
123
|
+
for (const match of code.matchAll(colonLiteral)) if (match[2]) found.add(match[2]);
|
|
124
|
+
for (const pattern of [nameBinding, nameProperty]) for (const match of code.matchAll(pattern)) if (match[2]) found.add(unwrapLiteral(match[2]));
|
|
125
|
+
return [...found];
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* VitePress sets the Vite root to `docs/`, which has no package.json.
|
|
129
|
+
* Walk up to the package that actually depends on `@iconify-json/*`.
|
|
130
|
+
*/
|
|
131
|
+
function findPackageRoot(start) {
|
|
132
|
+
let dir = start;
|
|
133
|
+
while (true) try {
|
|
134
|
+
readFileSync(join(dir, "package.json"));
|
|
135
|
+
return dir;
|
|
136
|
+
} catch {
|
|
137
|
+
const parent = dirname(dir);
|
|
138
|
+
if (parent === dir) return start;
|
|
139
|
+
dir = parent;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function discoverPrefixes(root) {
|
|
143
|
+
try {
|
|
144
|
+
const pkg = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
|
|
145
|
+
return [
|
|
146
|
+
...Object.keys(pkg.dependencies ?? {}),
|
|
147
|
+
...Object.keys(pkg.devDependencies ?? {}),
|
|
148
|
+
...Object.keys(pkg.optionalDependencies ?? {})
|
|
149
|
+
].filter((name) => name.startsWith("@iconify-json/")).map((name) => name.slice(14));
|
|
150
|
+
} catch {
|
|
151
|
+
return [];
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
function readInstalledCollection(prefix, root) {
|
|
155
|
+
try {
|
|
156
|
+
const jsonPath = createRequire(join(root, "package.json")).resolve(`@iconify-json/${prefix}/icons.json`);
|
|
157
|
+
return JSON.parse(readFileSync(jsonPath, "utf8"));
|
|
158
|
+
} catch {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function injectVue(code, block) {
|
|
163
|
+
if (code.includes(block)) return code;
|
|
164
|
+
const tags = [...code.matchAll(/<script\b[^>]*>/gi)];
|
|
165
|
+
const target = tags.find((tag) => tag[0].includes("setup")) ?? tags[0];
|
|
166
|
+
if (target?.index != null) {
|
|
167
|
+
const at = target.index + target[0].length;
|
|
168
|
+
return `${code.slice(0, at)}\n${block}\n${code.slice(at)}`;
|
|
169
|
+
}
|
|
170
|
+
return `<script setup>\n${block}\n<\/script>\n${code}`;
|
|
171
|
+
}
|
|
172
|
+
function injectModule(code, block) {
|
|
173
|
+
if (code.includes(block)) return code;
|
|
174
|
+
return `${block}\n${code}`;
|
|
175
|
+
}
|
|
176
|
+
//#endregion
|
|
177
|
+
export { astryxIcons, extractIconCandidates, findPackageRoot };
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { i as getIcon, s as warnMissingIcon } from "./registry-C7OZb0PJ.js";
|
|
2
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, inject, mergeProps, normalizeClass, openBlock, renderSlot, resolveDynamicComponent, toValue, useId } from "vue";
|
|
3
|
+
import "../styles/icon.css";
|
|
4
|
+
//#region src/Icon/context.ts
|
|
5
|
+
/**
|
|
6
|
+
* The size an owning component supplies to the icons in its slots.
|
|
7
|
+
*
|
|
8
|
+
* The value is stored as given, so a caller can pass a ref or a computed and
|
|
9
|
+
* keep the default in step with its own props.
|
|
10
|
+
*/
|
|
11
|
+
const ICON_DEFAULT_SIZE_KEY = Symbol("astryx-icon-default-size");
|
|
12
|
+
/**
|
|
13
|
+
* The size inherited from the nearest owner, or `undefined` when there is none.
|
|
14
|
+
*/
|
|
15
|
+
function useIconDefaultSize() {
|
|
16
|
+
const inherited = inject(ICON_DEFAULT_SIZE_KEY, void 0);
|
|
17
|
+
return computed(() => inherited == null ? void 0 : toValue(inherited));
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/Icon/glyphs.ts
|
|
21
|
+
/**
|
|
22
|
+
* The artwork kept for the components' own chrome. Applications bring their own
|
|
23
|
+
* icons; this list only has to cover what astryx-vue draws itself.
|
|
24
|
+
*/
|
|
25
|
+
const ICON_GLYPHS = [
|
|
26
|
+
"chevronDown",
|
|
27
|
+
"chevronLeft",
|
|
28
|
+
"chevronRight",
|
|
29
|
+
"check",
|
|
30
|
+
"moreHorizontal",
|
|
31
|
+
"copy",
|
|
32
|
+
"calendar",
|
|
33
|
+
"clock",
|
|
34
|
+
"upload",
|
|
35
|
+
"arrowUp",
|
|
36
|
+
"arrowDown",
|
|
37
|
+
"close",
|
|
38
|
+
"funnel",
|
|
39
|
+
"image"
|
|
40
|
+
];
|
|
41
|
+
function isIconGlyph(value) {
|
|
42
|
+
return ICON_GLYPHS.includes(value);
|
|
43
|
+
}
|
|
44
|
+
/** The CSS-safe form of a name, used as the `astryx-icon--<slug>` class. */
|
|
45
|
+
function iconGlyphSlug(name) {
|
|
46
|
+
return name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/:/g, "-").toLowerCase();
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/Icon/svg.ts
|
|
50
|
+
/**
|
|
51
|
+
* Turn icon data into a viewBox and a body.
|
|
52
|
+
*
|
|
53
|
+
* Flip and rotation follow Iconify: flip first, then rotate, and a 90 degree
|
|
54
|
+
* turn swaps the canvas. The body is wrapped in a transformed group only when
|
|
55
|
+
* a transform is present, so a plain glyph stays as the collection authored it.
|
|
56
|
+
*/
|
|
57
|
+
function iconToSVG(icon) {
|
|
58
|
+
const box = {
|
|
59
|
+
left: icon.left ?? 0,
|
|
60
|
+
top: icon.top ?? 0,
|
|
61
|
+
width: icon.width ?? 16,
|
|
62
|
+
height: icon.height ?? 16
|
|
63
|
+
};
|
|
64
|
+
let body = icon.body;
|
|
65
|
+
const transformations = [];
|
|
66
|
+
const hFlip = icon.hFlip === true;
|
|
67
|
+
const vFlip = icon.vFlip === true;
|
|
68
|
+
let rotation = icon.rotate ?? 0;
|
|
69
|
+
if (hFlip) {
|
|
70
|
+
if (vFlip) rotation += 2;
|
|
71
|
+
else {
|
|
72
|
+
transformations.push(`translate(${box.width + box.left} ${0 - box.top})`);
|
|
73
|
+
transformations.push("scale(-1 1)");
|
|
74
|
+
box.top = 0;
|
|
75
|
+
box.left = 0;
|
|
76
|
+
}
|
|
77
|
+
} else if (vFlip) {
|
|
78
|
+
transformations.push(`translate(${0 - box.left} ${box.height + box.top})`);
|
|
79
|
+
transformations.push("scale(1 -1)");
|
|
80
|
+
box.top = 0;
|
|
81
|
+
box.left = 0;
|
|
82
|
+
}
|
|
83
|
+
if (rotation < 0) rotation -= Math.floor(rotation / 4) * 4;
|
|
84
|
+
rotation %= 4;
|
|
85
|
+
switch (rotation) {
|
|
86
|
+
case 1: {
|
|
87
|
+
const origin = box.height / 2 + box.top;
|
|
88
|
+
transformations.unshift(`rotate(90 ${origin} ${origin})`);
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
case 2:
|
|
92
|
+
transformations.unshift(`rotate(180 ${box.width / 2 + box.left} ${box.height / 2 + box.top})`);
|
|
93
|
+
break;
|
|
94
|
+
case 3: {
|
|
95
|
+
const origin = box.width / 2 + box.left;
|
|
96
|
+
transformations.unshift(`rotate(-90 ${origin} ${origin})`);
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (rotation % 2 === 1) {
|
|
101
|
+
if (box.left !== box.top) {
|
|
102
|
+
const left = box.left;
|
|
103
|
+
box.left = box.top;
|
|
104
|
+
box.top = left;
|
|
105
|
+
}
|
|
106
|
+
if (box.width !== box.height) {
|
|
107
|
+
const width = box.width;
|
|
108
|
+
box.width = box.height;
|
|
109
|
+
box.height = width;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (transformations.length > 0) body = `<g transform="${transformations.join(" ")}">${body}</g>`;
|
|
113
|
+
return {
|
|
114
|
+
viewBox: `${box.left} ${box.top} ${box.width} ${box.height}`,
|
|
115
|
+
body
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function prefixIds(body, idPrefix) {
|
|
119
|
+
if (idPrefix === "" || !body.includes("id=")) return body;
|
|
120
|
+
return body.replace(/\bid=(["'])([^"']+)\1/g, (_, quote, id) => `id=${quote}${idPrefix}${id}${quote}`).replace(/(\b(?:href|xlink:href)=)(["'])#([^"']+)\2/g, (_, attr, quote, id) => `${attr}${quote}#${idPrefix}${id}${quote}`).replace(/url\(#([^)]+)\)/g, (_, id) => `url(#${idPrefix}${id})`);
|
|
121
|
+
}
|
|
122
|
+
/** A complete SVG element for one icon. The caller supplies a unique id prefix. */
|
|
123
|
+
function renderIconMarkup(icon, idPrefix) {
|
|
124
|
+
const built = iconToSVG(icon);
|
|
125
|
+
const body = prefixIds(built.body, idPrefix);
|
|
126
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${built.viewBox}" width="100%" height="100%" aria-hidden="true" focusable="false">${body}</svg>`;
|
|
127
|
+
}
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region src/Icon/Icon.vue
|
|
130
|
+
const _hoisted_1 = ["data-color", "data-size"];
|
|
131
|
+
const _hoisted_2 = ["innerHTML"];
|
|
132
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
133
|
+
name: "AstryxIcon",
|
|
134
|
+
__name: "Icon",
|
|
135
|
+
props: {
|
|
136
|
+
name: {},
|
|
137
|
+
icon: {},
|
|
138
|
+
color: { default: "inherit" },
|
|
139
|
+
size: {},
|
|
140
|
+
label: {}
|
|
141
|
+
},
|
|
142
|
+
setup(__props) {
|
|
143
|
+
const props = __props;
|
|
144
|
+
const inheritedSize = useIconDefaultSize();
|
|
145
|
+
const idPrefix = `i${useId().replace(/\W/g, "")}-`;
|
|
146
|
+
const hasName = computed(() => props.name != null && props.name !== "");
|
|
147
|
+
const resolvedSize = computed(() => {
|
|
148
|
+
if (props.size != null) return props.size;
|
|
149
|
+
if (inheritedSize.value != null) return inheritedSize.value;
|
|
150
|
+
if (hasName.value) return void 0;
|
|
151
|
+
return "md";
|
|
152
|
+
});
|
|
153
|
+
const iconMarkup = computed(() => {
|
|
154
|
+
if (!hasName.value || props.name == null) return void 0;
|
|
155
|
+
const data = getIcon(props.name);
|
|
156
|
+
if (data == null) {
|
|
157
|
+
warnMissingIcon(props.name);
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
return renderIconMarkup(data, idPrefix);
|
|
161
|
+
});
|
|
162
|
+
const glyphSlug = computed(() => typeof props.icon === "string" && isIconGlyph(props.icon) ? iconGlyphSlug(props.icon) : void 0);
|
|
163
|
+
const providedClass = computed(() => typeof props.icon === "string" && !isIconGlyph(props.icon) ? props.icon : void 0);
|
|
164
|
+
const iconComponent = computed(() => props.icon != null && typeof props.icon !== "string" ? props.icon : void 0);
|
|
165
|
+
const a11yAttrs = computed(() => {
|
|
166
|
+
const label = props.label;
|
|
167
|
+
return label != null && label !== "" ? {
|
|
168
|
+
"role": "img",
|
|
169
|
+
"aria-label": label
|
|
170
|
+
} : { "aria-hidden": "true" };
|
|
171
|
+
});
|
|
172
|
+
return (_ctx, _cache) => {
|
|
173
|
+
return openBlock(), createElementBlock("span", mergeProps(a11yAttrs.value, {
|
|
174
|
+
class: "astryx-icon",
|
|
175
|
+
"data-color": __props.color,
|
|
176
|
+
"data-size": resolvedSize.value
|
|
177
|
+
}), [
|
|
178
|
+
createCommentVNode(" Iconify bodies are SVG path data from a collection, not caller HTML. "),
|
|
179
|
+
createCommentVNode(" eslint-disable-next-line vue/no-v-html "),
|
|
180
|
+
hasName.value && iconMarkup.value ? (openBlock(), createElementBlock("span", {
|
|
181
|
+
key: 0,
|
|
182
|
+
class: "astryx-icon__svg",
|
|
183
|
+
innerHTML: iconMarkup.value
|
|
184
|
+
}, null, 8, _hoisted_2)) : !hasName.value && glyphSlug.value ? (openBlock(), createElementBlock("span", {
|
|
185
|
+
key: 1,
|
|
186
|
+
class: normalizeClass(["astryx-icon__glyph", `astryx-icon--${glyphSlug.value}`])
|
|
187
|
+
}, null, 2)) : !hasName.value && providedClass.value ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [createCommentVNode("\n Utility icon classes (UnoCSS `i-*`) set width and height to 100% outside\n any layer, which would override this box's size if the class sat on it.\n The box owns the size; the class only paints the inside.\n "), createElementVNode("span", { class: normalizeClass(["astryx-icon__external", providedClass.value]) }, null, 2)], 2112)) : !hasName.value && iconComponent.value ? (openBlock(), createBlock(resolveDynamicComponent(iconComponent.value), { key: 3 })) : !hasName.value ? renderSlot(_ctx.$slots, "default", {}, void 0, void 0, 4) : createCommentVNode("v-if", true)
|
|
188
|
+
], 16, _hoisted_1);
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
//#endregion
|
|
193
|
+
export { isIconGlyph as i, ICON_GLYPHS as n, iconGlyphSlug as r, _sfc_main as t };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as LightboxMediaType, c as UseLightboxOptions, i as LightboxMedia, n as _default, o as LightboxProps, r as LightboxEmits, s as LightboxTriggerProps, t as useLightbox } from "../index-1AZ4KZhg.js";
|
|
2
|
+
export { _default as Lightbox, type LightboxEmits, type LightboxMedia, type LightboxMediaType, type LightboxProps, type LightboxTriggerProps, type UseLightboxOptions, useLightbox };
|