@ac-design/design-system 0.0.0-stage → 1.0.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/README.md +160 -2
- package/dist/lib/compat.css +4441 -0
- package/dist/lib/components/AcAccordion.js +5 -0
- package/dist/lib/components/AcAccordion.vue.d.ts +35 -0
- package/dist/lib/components/AcAccordion.vue_vue_type_script_setup_true_lang.js +61 -0
- package/dist/lib/components/AcAccordionItem.js +5 -0
- package/dist/lib/components/AcAccordionItem.vue.d.ts +49 -0
- package/dist/lib/components/AcAccordionItem.vue_vue_type_script_setup_true_lang.js +81 -0
- package/dist/lib/components/AcAlert.js +5 -0
- package/dist/lib/components/AcAlert.vue.d.ts +52 -0
- package/dist/lib/components/AcAlert.vue_vue_type_script_setup_true_lang.js +121 -0
- package/dist/lib/components/AcAppSwitcher.js +5 -0
- package/dist/lib/components/AcAppSwitcher.vue.d.ts +83 -0
- package/dist/lib/components/AcAppSwitcher.vue_vue_type_script_setup_true_lang.js +303 -0
- package/dist/lib/components/AcAvatar.js +5 -0
- package/dist/lib/components/AcAvatar.vue.d.ts +27 -0
- package/dist/lib/components/AcAvatar.vue_vue_type_script_setup_true_lang.js +116 -0
- package/dist/lib/components/AcBadge.js +5 -0
- package/dist/lib/components/AcBadge.vue.d.ts +32 -0
- package/dist/lib/components/AcBadge.vue_vue_type_script_setup_true_lang.js +88 -0
- package/dist/lib/components/AcBanner.js +5 -0
- package/dist/lib/components/AcBanner.vue.d.ts +57 -0
- package/dist/lib/components/AcBanner.vue_vue_type_script_setup_true_lang.js +114 -0
- package/dist/lib/components/AcBreadcrumb.js +5 -0
- package/dist/lib/components/AcBreadcrumb.vue.d.ts +25 -0
- package/dist/lib/components/AcBreadcrumb.vue_vue_type_script_setup_true_lang.js +88 -0
- package/dist/lib/components/AcButton.js +5 -0
- package/dist/lib/components/AcButton.vue.d.ts +49 -0
- package/dist/lib/components/AcButton.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/lib/components/AcButtons.js +5 -0
- package/dist/lib/components/AcButtons.vue.d.ts +31 -0
- package/dist/lib/components/AcButtons.vue_vue_type_script_setup_true_lang.js +44 -0
- package/dist/lib/components/AcCard.js +5 -0
- package/dist/lib/components/AcCard.vue.d.ts +27 -0
- package/dist/lib/components/AcCard.vue_vue_type_script_setup_true_lang.js +28 -0
- package/dist/lib/components/AcCellValue.js +5 -0
- package/dist/lib/components/AcCellValue.vue.d.ts +139 -0
- package/dist/lib/components/AcCellValue.vue_vue_type_script_setup_true_lang.js +386 -0
- package/dist/lib/components/AcCheckBox.js +5 -0
- package/dist/lib/components/AcCheckBox.vue.d.ts +31 -0
- package/dist/lib/components/AcCheckBox.vue_vue_type_script_setup_true_lang.js +49 -0
- package/dist/lib/components/AcCheckRadio.js +5 -0
- package/dist/lib/components/AcCheckRadio.vue.d.ts +35 -0
- package/dist/lib/components/AcCheckRadio.vue_vue_type_script_setup_true_lang.js +56 -0
- package/dist/lib/components/AcClusterSwitcher.js +5 -0
- package/dist/lib/components/AcClusterSwitcher.vue.d.ts +95 -0
- package/dist/lib/components/AcClusterSwitcher.vue_vue_type_script_setup_true_lang.js +416 -0
- package/dist/lib/components/AcCodeEditor.js +5 -0
- package/dist/lib/components/AcCodeEditor.vue.d.ts +88 -0
- package/dist/lib/components/AcCodeEditor.vue_vue_type_script_setup_true_lang.js +375 -0
- package/dist/lib/components/AcContentHeader.js +5 -0
- package/dist/lib/components/AcContentHeader.vue.d.ts +29 -0
- package/dist/lib/components/AcContentHeader.vue_vue_type_script_setup_true_lang.js +31 -0
- package/dist/lib/components/AcContentLayout.js +5 -0
- package/dist/lib/components/AcContentLayout.vue.d.ts +21 -0
- package/dist/lib/components/AcContentLayout.vue_vue_type_script_setup_true_lang.js +18 -0
- package/dist/lib/components/AcContentTable.js +5 -0
- package/dist/lib/components/AcContentTable.vue.d.ts +54 -0
- package/dist/lib/components/AcContentTable.vue_vue_type_script_setup_true_lang.js +67 -0
- package/dist/lib/components/AcDatePicker.js +5 -0
- package/dist/lib/components/AcDatePicker.vue.d.ts +88 -0
- package/dist/lib/components/AcDatePicker.vue_vue_type_script_setup_true_lang.js +794 -0
- package/dist/lib/components/AcDeleteModal.js +5 -0
- package/dist/lib/components/AcDeleteModal.vue.d.ts +51 -0
- package/dist/lib/components/AcDeleteModal.vue_vue_type_script_setup_true_lang.js +110 -0
- package/dist/lib/components/AcDivider.js +5 -0
- package/dist/lib/components/AcDivider.vue.d.ts +25 -0
- package/dist/lib/components/AcDivider.vue_vue_type_script_setup_true_lang.js +39 -0
- package/dist/lib/components/AcDropdown.js +5 -0
- package/dist/lib/components/AcDropdown.vue.d.ts +45 -0
- package/dist/lib/components/AcDropdown.vue_vue_type_script_setup_true_lang.js +152 -0
- package/dist/lib/components/AcDropdownDivider.js +5 -0
- package/dist/lib/components/AcDropdownDivider.vue.d.ts +9 -0
- package/dist/lib/components/AcDropdownDivider.vue_vue_type_script_setup_true_lang.js +20 -0
- package/dist/lib/components/AcDropdownItem.js +5 -0
- package/dist/lib/components/AcDropdownItem.vue.d.ts +50 -0
- package/dist/lib/components/AcDropdownItem.vue_vue_type_script_setup_true_lang.js +86 -0
- package/dist/lib/components/AcEmptyState.js +5 -0
- package/dist/lib/components/AcEmptyState.vue.d.ts +42 -0
- package/dist/lib/components/AcEmptyState.vue_vue_type_script_setup_true_lang.js +81 -0
- package/dist/lib/components/AcFeatureCard.js +5 -0
- package/dist/lib/components/AcFeatureCard.vue.d.ts +84 -0
- package/dist/lib/components/AcFeatureCard.vue_vue_type_script_setup_true_lang.js +218 -0
- package/dist/lib/components/AcFileEditor.js +5 -0
- package/dist/lib/components/AcFileEditor.vue.d.ts +95 -0
- package/dist/lib/components/AcFileEditor.vue_vue_type_script_setup_true_lang.js +556 -0
- package/dist/lib/components/AcFileUpload.js +5 -0
- package/dist/lib/components/AcFileUpload.vue.d.ts +67 -0
- package/dist/lib/components/AcFileUpload.vue_vue_type_script_setup_true_lang.js +274 -0
- package/dist/lib/components/AcFontScale.js +5 -0
- package/dist/lib/components/AcFontScale.vue.d.ts +17 -0
- package/dist/lib/components/AcFontScale.vue_vue_type_script_setup_true_lang.js +65 -0
- package/dist/lib/components/AcForm.js +5 -0
- package/dist/lib/components/AcForm.vue.d.ts +31 -0
- package/dist/lib/components/AcForm.vue_vue_type_script_setup_true_lang.js +38 -0
- package/dist/lib/components/AcFormArray.js +5 -0
- package/dist/lib/components/AcFormArray.vue.d.ts +124 -0
- package/dist/lib/components/AcFormArray.vue_vue_type_script_setup_true_lang.js +485 -0
- package/dist/lib/components/AcFormFooter.js +5 -0
- package/dist/lib/components/AcFormFooter.vue.d.ts +48 -0
- package/dist/lib/components/AcFormFooter.vue_vue_type_script_setup_true_lang.js +86 -0
- package/dist/lib/components/AcFormSection.js +5 -0
- package/dist/lib/components/AcFormSection.vue.d.ts +32 -0
- package/dist/lib/components/AcFormSection.vue_vue_type_script_setup_true_lang.js +38 -0
- package/dist/lib/components/AcHeader.js +5 -0
- package/dist/lib/components/AcHeader.vue.d.ts +46 -0
- package/dist/lib/components/AcHeader.vue_vue_type_script_setup_true_lang.js +60 -0
- package/dist/lib/components/AcHeaderItem.js +5 -0
- package/dist/lib/components/AcHeaderItem.vue.d.ts +13 -0
- package/dist/lib/components/AcHeaderItem.vue_vue_type_script_setup_true_lang.js +14 -0
- package/dist/lib/components/AcHeaderItems.js +5 -0
- package/dist/lib/components/AcHeaderItems.vue.d.ts +13 -0
- package/dist/lib/components/AcHeaderItems.vue_vue_type_script_setup_true_lang.js +14 -0
- package/dist/lib/components/AcInfoTable.js +5 -0
- package/dist/lib/components/AcInfoTable.vue.d.ts +59 -0
- package/dist/lib/components/AcInfoTable.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/lib/components/AcInput.js +5 -0
- package/dist/lib/components/AcInput.vue.d.ts +68 -0
- package/dist/lib/components/AcInput.vue_vue_type_script_setup_true_lang.js +143 -0
- package/dist/lib/components/AcKbd.js +5 -0
- package/dist/lib/components/AcKbd.vue.d.ts +25 -0
- package/dist/lib/components/AcKbd.vue_vue_type_script_setup_true_lang.js +134 -0
- package/dist/lib/components/AcLogo.js +5 -0
- package/dist/lib/components/AcLogo.vue.d.ts +18 -0
- package/dist/lib/components/AcLogo.vue_vue_type_script_setup_true_lang.js +67 -0
- package/dist/lib/components/AcModal.js +5 -0
- package/dist/lib/components/AcModal.vue.d.ts +54 -0
- package/dist/lib/components/AcModal.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/lib/components/AcNavbar.js +5 -0
- package/dist/lib/components/AcNavbar.vue.d.ts +41 -0
- package/dist/lib/components/AcNavbar.vue_vue_type_script_setup_true_lang.js +60 -0
- package/dist/lib/components/AcNavbarItem.js +5 -0
- package/dist/lib/components/AcNavbarItem.vue.d.ts +44 -0
- package/dist/lib/components/AcNavbarItem.vue_vue_type_script_setup_true_lang.js +65 -0
- package/dist/lib/components/AcNotificationMenu.js +5 -0
- package/dist/lib/components/AcNotificationMenu.vue.d.ts +90 -0
- package/dist/lib/components/AcNotificationMenu.vue_vue_type_script_setup_true_lang.js +345 -0
- package/dist/lib/components/AcPage.js +5 -0
- package/dist/lib/components/AcPage.vue.d.ts +25 -0
- package/dist/lib/components/AcPage.vue_vue_type_script_setup_true_lang.js +36 -0
- package/dist/lib/components/AcPagination.js +5 -0
- package/dist/lib/components/AcPagination.vue.d.ts +51 -0
- package/dist/lib/components/AcPagination.vue_vue_type_script_setup_true_lang.js +160 -0
- package/dist/lib/components/AcPreloader.js +5 -0
- package/dist/lib/components/AcPreloader.vue.d.ts +28 -0
- package/dist/lib/components/AcPreloader.vue_vue_type_script_setup_true_lang.js +39 -0
- package/dist/lib/components/AcProgress.js +5 -0
- package/dist/lib/components/AcProgress.vue.d.ts +31 -0
- package/dist/lib/components/AcProgress.vue_vue_type_script_setup_true_lang.js +76 -0
- package/dist/lib/components/AcResourceCard.js +5 -0
- package/dist/lib/components/AcResourceCard.vue.d.ts +106 -0
- package/dist/lib/components/AcResourceCard.vue_vue_type_script_setup_true_lang.js +203 -0
- package/dist/lib/components/AcSearchBar.js +5 -0
- package/dist/lib/components/AcSearchBar.vue.d.ts +41 -0
- package/dist/lib/components/AcSearchBar.vue_vue_type_script_setup_true_lang.js +76 -0
- package/dist/lib/components/AcSectionContent.js +5 -0
- package/dist/lib/components/AcSectionContent.vue.d.ts +55 -0
- package/dist/lib/components/AcSectionContent.vue_vue_type_script_setup_true_lang.js +74 -0
- package/dist/lib/components/AcSegmentedControl.js +5 -0
- package/dist/lib/components/AcSegmentedControl.vue.d.ts +46 -0
- package/dist/lib/components/AcSegmentedControl.vue_vue_type_script_setup_true_lang.js +104 -0
- package/dist/lib/components/AcSelect.js +5 -0
- package/dist/lib/components/AcSelect.vue.d.ts +78 -0
- package/dist/lib/components/AcSelect.vue_vue_type_script_setup_true_lang.js +441 -0
- package/dist/lib/components/AcSidePanel.js +5 -0
- package/dist/lib/components/AcSidePanel.vue.d.ts +57 -0
- package/dist/lib/components/AcSidePanel.vue_vue_type_script_setup_true_lang.js +128 -0
- package/dist/lib/components/AcSideTabs.js +5 -0
- package/dist/lib/components/AcSideTabs.vue.d.ts +93 -0
- package/dist/lib/components/AcSideTabs.vue_vue_type_script_setup_true_lang.js +373 -0
- package/dist/lib/components/AcSidebar.js +5 -0
- package/dist/lib/components/AcSidebar.vue.d.ts +63 -0
- package/dist/lib/components/AcSidebar.vue_vue_type_script_setup_true_lang.js +221 -0
- package/dist/lib/components/AcSidebarItem.js +5 -0
- package/dist/lib/components/AcSidebarItem.vue.d.ts +55 -0
- package/dist/lib/components/AcSidebarItem.vue_vue_type_script_setup_true_lang.js +155 -0
- package/dist/lib/components/AcSidebarSection.js +5 -0
- package/dist/lib/components/AcSidebarSection.vue.d.ts +32 -0
- package/dist/lib/components/AcSidebarSection.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/lib/components/AcSkeleton.js +5 -0
- package/dist/lib/components/AcSkeleton.vue.d.ts +27 -0
- package/dist/lib/components/AcSkeleton.vue_vue_type_script_setup_true_lang.js +142 -0
- package/dist/lib/components/AcSlider.js +5 -0
- package/dist/lib/components/AcSlider.vue.d.ts +72 -0
- package/dist/lib/components/AcSlider.vue_vue_type_script_setup_true_lang.js +327 -0
- package/dist/lib/components/AcSpinner.js +5 -0
- package/dist/lib/components/AcSpinner.vue.d.ts +12 -0
- package/dist/lib/components/AcSpinner.vue_vue_type_script_setup_true_lang.js +45 -0
- package/dist/lib/components/AcStatCard.js +5 -0
- package/dist/lib/components/AcStatCard.vue.d.ts +84 -0
- package/dist/lib/components/AcStatCard.vue_vue_type_script_setup_true_lang.js +225 -0
- package/dist/lib/components/AcStatusBar.js +5 -0
- package/dist/lib/components/AcStatusBar.vue.d.ts +66 -0
- package/dist/lib/components/AcStatusBar.vue_vue_type_script_setup_true_lang.js +145 -0
- package/dist/lib/components/AcSteps.js +5 -0
- package/dist/lib/components/AcSteps.vue.d.ts +28 -0
- package/dist/lib/components/AcSteps.vue_vue_type_script_setup_true_lang.js +91 -0
- package/dist/lib/components/AcSwitch.js +5 -0
- package/dist/lib/components/AcSwitch.vue.d.ts +44 -0
- package/dist/lib/components/AcSwitch.vue_vue_type_script_setup_true_lang.js +67 -0
- package/dist/lib/components/AcTable.js +5 -0
- package/dist/lib/components/AcTable.vue.d.ts +98 -0
- package/dist/lib/components/AcTable.vue_vue_type_script_setup_true_lang.js +272 -0
- package/dist/lib/components/AcTabs.js +5 -0
- package/dist/lib/components/AcTabs.vue.d.ts +40 -0
- package/dist/lib/components/AcTabs.vue_vue_type_script_setup_true_lang.js +72 -0
- package/dist/lib/components/AcTag.js +5 -0
- package/dist/lib/components/AcTag.vue.d.ts +41 -0
- package/dist/lib/components/AcTag.vue_vue_type_script_setup_true_lang.js +99 -0
- package/dist/lib/components/AcTextarea.js +5 -0
- package/dist/lib/components/AcTextarea.vue.d.ts +53 -0
- package/dist/lib/components/AcTextarea.vue_vue_type_script_setup_true_lang.js +120 -0
- package/dist/lib/components/AcThemeMode.js +5 -0
- package/dist/lib/components/AcThemeMode.vue.d.ts +17 -0
- package/dist/lib/components/AcThemeMode.vue_vue_type_script_setup_true_lang.js +60 -0
- package/dist/lib/components/AcToaster.js +5 -0
- package/dist/lib/components/AcToaster.vue.d.ts +15 -0
- package/dist/lib/components/AcToaster.vue_vue_type_script_setup_true_lang.js +166 -0
- package/dist/lib/components/AcTooltip.js +5 -0
- package/dist/lib/components/AcTooltip.vue.d.ts +30 -0
- package/dist/lib/components/AcTooltip.vue_vue_type_script_setup_true_lang.js +117 -0
- package/dist/lib/components/AcUsageCard.js +5 -0
- package/dist/lib/components/AcUsageCard.vue.d.ts +85 -0
- package/dist/lib/components/AcUsageCard.vue_vue_type_script_setup_true_lang.js +230 -0
- package/dist/lib/components/AcUserMenu.js +5 -0
- package/dist/lib/components/AcUserMenu.vue.d.ts +77 -0
- package/dist/lib/components/AcUserMenu.vue_vue_type_script_setup_true_lang.js +258 -0
- package/dist/lib/components/index.d.ts +76 -0
- package/dist/lib/components/types.d.ts +16 -0
- package/dist/lib/composables/useBrandColor.d.ts +53 -0
- package/dist/lib/composables/useBrandColor.js +148 -0
- package/dist/lib/composables/useColorMode.d.ts +12 -0
- package/dist/lib/composables/useColorMode.js +40 -0
- package/dist/lib/composables/useFontScale.d.ts +16 -0
- package/dist/lib/composables/useFontScale.js +43 -0
- package/dist/lib/composables/useToast.d.ts +68 -0
- package/dist/lib/composables/useToast.js +36 -0
- package/dist/lib/editor/index.d.ts +4 -0
- package/dist/lib/editor/index.js +3 -0
- package/dist/lib/editor/theme.d.ts +3 -0
- package/dist/lib/editor/theme.js +309 -0
- package/dist/lib/editor/validate.d.ts +19 -0
- package/dist/lib/editor/validate.js +127 -0
- package/dist/lib/index.d.ts +29 -0
- package/dist/lib/index.js +78 -0
- package/dist/lib/theme.css +556 -0
- package/package.json +82 -4
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import e from "./AcThemeMode.js";
|
|
2
|
+
import t from "./AcFontScale.js";
|
|
3
|
+
import { Fragment as n, Teleport as r, Transition as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, getCurrentInstance as p, mergeModels as m, mergeProps as ee, nextTick as h, normalizeClass as g, normalizeStyle as te, onBeforeUnmount as ne, openBlock as _, ref as v, renderList as y, renderSlot as b, resolveDynamicComponent as x, toDisplayString as S, unref as C, useId as re, useModel as ie, watch as w, withCtx as T } from "vue";
|
|
4
|
+
import { ChevronDown as ae, LogOut as oe } from "@lucide/vue";
|
|
5
|
+
//#region src/lib/components/AcUserMenu.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var se = {
|
|
7
|
+
class: "inline-flex",
|
|
8
|
+
"data-ac-ds": "",
|
|
9
|
+
"data-testid": "ac-user-menu"
|
|
10
|
+
}, ce = [
|
|
11
|
+
"aria-expanded",
|
|
12
|
+
"aria-controls",
|
|
13
|
+
"aria-label"
|
|
14
|
+
], le = {
|
|
15
|
+
class: "inline-flex size-7 shrink-0 items-center justify-center overflow-hidden rounded-full bg-primary-90 text-xs font-semibold text-primary-20 ring-1 ring-border",
|
|
16
|
+
"aria-hidden": "true"
|
|
17
|
+
}, ue = ["src"], de = { class: "hidden max-w-36 truncate text-base font-medium text-heading sm:block" }, E = {
|
|
18
|
+
class: "inline-flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-full bg-primary-90 text-base font-semibold text-primary-20 ring-1 ring-border",
|
|
19
|
+
"aria-hidden": "true"
|
|
20
|
+
}, D = ["src"], fe = { class: "min-w-0 flex-1" }, pe = { class: "block truncate text-base font-medium text-heading" }, me = {
|
|
21
|
+
key: 0,
|
|
22
|
+
class: "block truncate text-xs text-muted"
|
|
23
|
+
}, he = {
|
|
24
|
+
key: 0,
|
|
25
|
+
role: "group",
|
|
26
|
+
class: "flex flex-col gap-px p-1"
|
|
27
|
+
}, ge = { class: "min-w-0 flex-1 truncate" }, _e = ["aria-labelledby"], ve = ["id"], ye = ["aria-labelledby"], be = ["id"], O = {
|
|
28
|
+
role: "group",
|
|
29
|
+
class: "border-t border-border-light p-1"
|
|
30
|
+
}, k = "flex h-8 w-full cursor-pointer items-center gap-2.5 rounded-6 px-2.5 text-left text-base text-body outline-none transition-colors hover:bg-surface-muted hover:text-heading focus-visible:bg-surface-muted focus-visible:text-heading aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-muted", A = "[role=\"menuitem\"]:not([aria-disabled=\"true\"]), [role=\"radio\"]", j = /*@__PURE__*/ f({
|
|
31
|
+
__name: "AcUserMenu",
|
|
32
|
+
props: /*@__PURE__*/ m({
|
|
33
|
+
name: {},
|
|
34
|
+
email: { default: "" },
|
|
35
|
+
avatarUrl: { default: "" },
|
|
36
|
+
profileUrl: { default: "" },
|
|
37
|
+
items: { default: () => [] },
|
|
38
|
+
showThemeMode: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: !1
|
|
41
|
+
},
|
|
42
|
+
showFontScale: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: !1
|
|
45
|
+
},
|
|
46
|
+
showName: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: !0
|
|
49
|
+
},
|
|
50
|
+
logoutUrl: { default: "" },
|
|
51
|
+
logoutLabel: { default: "Sign out" }
|
|
52
|
+
}, {
|
|
53
|
+
open: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: !1
|
|
56
|
+
},
|
|
57
|
+
openModifiers: {}
|
|
58
|
+
}),
|
|
59
|
+
emits: /*@__PURE__*/ m([
|
|
60
|
+
"select",
|
|
61
|
+
"logout",
|
|
62
|
+
"set:theme"
|
|
63
|
+
], ["update:open"]),
|
|
64
|
+
setup(f, { emit: m }) {
|
|
65
|
+
let j = f, M = ie(f, "open"), N = m, P = p()?.appContext.components.RouterLink, F = re(), I = `${F}-trigger`, L = `${F}-menu`, R = v(null), z = v(null), B = v(!1), V = v({
|
|
66
|
+
top: 0,
|
|
67
|
+
right: 0
|
|
68
|
+
}), H = a(() => {
|
|
69
|
+
let e = j.name.trim().split(/[\s._-]+/).filter(Boolean);
|
|
70
|
+
return e.length ? (e[0].charAt(0) + (e.length > 1 ? e[e.length - 1].charAt(0) : "")).toUpperCase() : "?";
|
|
71
|
+
}), U = a(() => !!j.avatarUrl && !B.value);
|
|
72
|
+
function W(e) {
|
|
73
|
+
return e.to && P && !e.disabled ? P : e.to || e.href ? "a" : "button";
|
|
74
|
+
}
|
|
75
|
+
function xe(e) {
|
|
76
|
+
let t = W(e);
|
|
77
|
+
return t === P ? { to: e.to } : t === "a" ? e.disabled ? { "aria-disabled": "true" } : { href: e.href ?? (typeof e.to == "string" ? e.to : void 0) } : {
|
|
78
|
+
type: "button",
|
|
79
|
+
"aria-disabled": e.disabled ? "true" : void 0
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function G() {
|
|
83
|
+
return [...z.value?.querySelectorAll(A) ?? []];
|
|
84
|
+
}
|
|
85
|
+
function K(e) {
|
|
86
|
+
let t = G();
|
|
87
|
+
t.length && t[(e + t.length) % t.length].focus();
|
|
88
|
+
}
|
|
89
|
+
function q() {
|
|
90
|
+
let e = R.value;
|
|
91
|
+
if (!e) return;
|
|
92
|
+
let t = e.getBoundingClientRect(), n = z.value?.offsetHeight ?? 320, r = Math.max(8, window.innerWidth - t.right), i = window.innerHeight - t.bottom - 6 - 8;
|
|
93
|
+
V.value = i < n && t.top > i ? {
|
|
94
|
+
bottom: window.innerHeight - t.top + 6,
|
|
95
|
+
right: r
|
|
96
|
+
} : {
|
|
97
|
+
top: t.bottom + 6,
|
|
98
|
+
right: r
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
async function J(e = "first") {
|
|
102
|
+
M.value = !0, await h(), q(), K(e === "first" ? 0 : -1);
|
|
103
|
+
}
|
|
104
|
+
function Y(e = !0) {
|
|
105
|
+
M.value && (M.value = !1, e && R.value?.focus());
|
|
106
|
+
}
|
|
107
|
+
function X(e) {
|
|
108
|
+
[
|
|
109
|
+
"Enter",
|
|
110
|
+
" ",
|
|
111
|
+
"ArrowDown"
|
|
112
|
+
].includes(e.key) ? (e.preventDefault(), J("first")) : e.key === "ArrowUp" && (e.preventDefault(), J("last"));
|
|
113
|
+
}
|
|
114
|
+
function Se(e) {
|
|
115
|
+
let t = G().indexOf(document.activeElement);
|
|
116
|
+
e.key === "ArrowDown" ? (e.preventDefault(), K(t + 1)) : e.key === "ArrowUp" ? (e.preventDefault(), K(t - 1)) : e.key === "Home" ? (e.preventDefault(), K(0)) : e.key === "End" ? (e.preventDefault(), K(-1)) : e.key === "Escape" ? (e.preventDefault(), e.stopPropagation(), Y()) : e.key === "Tab" && Y();
|
|
117
|
+
}
|
|
118
|
+
function Ce(e) {
|
|
119
|
+
e.disabled || (N("select", e), Y());
|
|
120
|
+
}
|
|
121
|
+
function we() {
|
|
122
|
+
N("logout"), Y(!1);
|
|
123
|
+
}
|
|
124
|
+
function Z(e) {
|
|
125
|
+
let t = e.target;
|
|
126
|
+
R.value?.contains(t) || z.value?.contains(t) || Y(!1);
|
|
127
|
+
}
|
|
128
|
+
function Q() {
|
|
129
|
+
q();
|
|
130
|
+
}
|
|
131
|
+
function $() {
|
|
132
|
+
document.removeEventListener("pointerdown", Z, !0), window.removeEventListener("scroll", Q, !0), window.removeEventListener("resize", Q);
|
|
133
|
+
}
|
|
134
|
+
return w(M, (e) => {
|
|
135
|
+
if (!e) return $();
|
|
136
|
+
document.addEventListener("pointerdown", Z, !0), window.addEventListener("scroll", Q, !0), window.addEventListener("resize", Q), h(q);
|
|
137
|
+
}), w(() => j.avatarUrl, () => B.value = !1), ne($), (a, p) => (_(), c("div", se, [l("button", {
|
|
138
|
+
id: I,
|
|
139
|
+
ref_key: "trigger",
|
|
140
|
+
ref: R,
|
|
141
|
+
type: "button",
|
|
142
|
+
"aria-haspopup": "menu",
|
|
143
|
+
"aria-expanded": M.value,
|
|
144
|
+
"aria-controls": M.value ? L : void 0,
|
|
145
|
+
"aria-label": `${f.name}, account menu`,
|
|
146
|
+
class: g(["group inline-flex h-8 shrink-0 cursor-pointer items-center gap-2 rounded-50 p-0.5 transition-colors hover:bg-surface-sunken focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring", [f.showName && "sm:pr-2", M.value && "bg-surface-sunken"]]),
|
|
147
|
+
"data-ac-ds": "",
|
|
148
|
+
"data-testid": "ac-user-menu-trigger",
|
|
149
|
+
onClick: p[1] ||= (e) => M.value ? Y() : J(),
|
|
150
|
+
onKeydown: X
|
|
151
|
+
}, [l("span", le, [U.value ? (_(), c("img", {
|
|
152
|
+
key: 0,
|
|
153
|
+
src: f.avatarUrl,
|
|
154
|
+
alt: "",
|
|
155
|
+
class: "size-full object-cover",
|
|
156
|
+
onError: p[0] ||= (e) => B.value = !0
|
|
157
|
+
}, null, 40, ue)) : (_(), c(n, { key: 1 }, [u(S(H.value), 1)], 64))]), f.showName ? (_(), c(n, { key: 0 }, [l("span", de, S(f.name), 1), d(C(ae), {
|
|
158
|
+
class: g(["hidden size-3.5 shrink-0 text-muted transition-transform duration-150 motion-reduce:transition-none sm:block", M.value && "rotate-180"]),
|
|
159
|
+
"aria-hidden": "true"
|
|
160
|
+
}, null, 8, ["class"])], 64)) : s("", !0)], 42, ce), (_(), o(r, { to: "body" }, [d(i, {
|
|
161
|
+
"enter-active-class": "transition duration-150 ease-out motion-reduce:transition-none",
|
|
162
|
+
"enter-from-class": "opacity-0 -translate-y-1 scale-[0.98]",
|
|
163
|
+
"leave-active-class": "transition duration-100 ease-in",
|
|
164
|
+
"leave-to-class": "opacity-0"
|
|
165
|
+
}, {
|
|
166
|
+
default: T(() => [M.value ? (_(), c("div", {
|
|
167
|
+
key: 0,
|
|
168
|
+
id: L,
|
|
169
|
+
ref_key: "panel",
|
|
170
|
+
ref: z,
|
|
171
|
+
role: "menu",
|
|
172
|
+
"aria-labelledby": I,
|
|
173
|
+
class: "fixed z-[90] w-72 max-w-[calc(100vw-16px)] overflow-hidden rounded-10 border border-border bg-surface shadow-lg",
|
|
174
|
+
style: te({
|
|
175
|
+
top: V.value.top === void 0 ? void 0 : `${V.value.top}px`,
|
|
176
|
+
bottom: V.value.bottom === void 0 ? void 0 : `${V.value.bottom}px`,
|
|
177
|
+
right: `${V.value.right}px`
|
|
178
|
+
}),
|
|
179
|
+
"data-ac-ds": "",
|
|
180
|
+
"data-testid": "ac-user-menu-panel",
|
|
181
|
+
onKeydown: Se
|
|
182
|
+
}, [
|
|
183
|
+
(_(), o(x(f.profileUrl ? "a" : "div"), {
|
|
184
|
+
href: f.profileUrl || void 0,
|
|
185
|
+
role: f.profileUrl ? "menuitem" : "presentation",
|
|
186
|
+
tabindex: f.profileUrl ? -1 : void 0,
|
|
187
|
+
class: g(["flex items-center gap-3 border-b border-border-light px-3.5 py-3 outline-none", f.profileUrl && "transition-colors hover:bg-surface-muted focus-visible:bg-surface-muted"])
|
|
188
|
+
}, {
|
|
189
|
+
default: T(() => [l("span", E, [U.value ? (_(), c("img", {
|
|
190
|
+
key: 0,
|
|
191
|
+
src: f.avatarUrl,
|
|
192
|
+
alt: "",
|
|
193
|
+
class: "size-full object-cover",
|
|
194
|
+
onError: p[2] ||= (e) => B.value = !0
|
|
195
|
+
}, null, 40, D)) : (_(), c(n, { key: 1 }, [u(S(H.value), 1)], 64))]), l("span", fe, [l("span", pe, S(f.name), 1), f.email ? (_(), c("span", me, S(f.email), 1)) : s("", !0)])]),
|
|
196
|
+
_: 1
|
|
197
|
+
}, 8, [
|
|
198
|
+
"href",
|
|
199
|
+
"role",
|
|
200
|
+
"tabindex",
|
|
201
|
+
"class"
|
|
202
|
+
])),
|
|
203
|
+
f.items.length || a.$slots.default ? (_(), c("div", he, [(_(!0), c(n, null, y(f.items, (e) => (_(), o(x(W(e)), ee({ key: e.label }, { ref_for: !0 }, xe(e), {
|
|
204
|
+
role: "menuitem",
|
|
205
|
+
tabindex: "-1",
|
|
206
|
+
class: k,
|
|
207
|
+
onClick: (t) => Ce(e)
|
|
208
|
+
}), {
|
|
209
|
+
default: T(() => [e.icon ? (_(), o(x(e.icon), {
|
|
210
|
+
key: 0,
|
|
211
|
+
"aria-hidden": "true"
|
|
212
|
+
})) : s("", !0), l("span", ge, S(e.label), 1)]),
|
|
213
|
+
_: 2
|
|
214
|
+
}, 1040, ["onClick"]))), 128)), b(a.$slots, "default", {
|
|
215
|
+
close: Y,
|
|
216
|
+
itemClass: k
|
|
217
|
+
})])) : s("", !0),
|
|
218
|
+
f.showThemeMode ? (_(), c("div", {
|
|
219
|
+
key: 1,
|
|
220
|
+
role: "group",
|
|
221
|
+
"aria-labelledby": `${C(F)}-theme`,
|
|
222
|
+
class: "border-t border-border-light px-3.5 py-2.5"
|
|
223
|
+
}, [l("p", {
|
|
224
|
+
id: `${C(F)}-theme`,
|
|
225
|
+
class: "mb-1.5 text-xs font-medium text-label"
|
|
226
|
+
}, "Theme", 8, ve), d(e, {
|
|
227
|
+
display: "labels",
|
|
228
|
+
"onSet:theme": p[3] ||= (e) => N("set:theme", e)
|
|
229
|
+
})], 8, _e)) : s("", !0),
|
|
230
|
+
f.showFontScale ? (_(), c("div", {
|
|
231
|
+
key: 2,
|
|
232
|
+
role: "group",
|
|
233
|
+
"aria-labelledby": `${C(F)}-scale`,
|
|
234
|
+
class: "border-t border-border-light px-3.5 py-2.5"
|
|
235
|
+
}, [l("p", {
|
|
236
|
+
id: `${C(F)}-scale`,
|
|
237
|
+
class: "mb-1.5 text-xs font-medium text-label"
|
|
238
|
+
}, "Text size", 8, be), d(t, { display: "labels" })], 8, ye)) : s("", !0),
|
|
239
|
+
l("div", O, [(_(), o(x(f.logoutUrl ? "a" : "button"), {
|
|
240
|
+
href: f.logoutUrl || void 0,
|
|
241
|
+
type: f.logoutUrl ? void 0 : "button",
|
|
242
|
+
role: "menuitem",
|
|
243
|
+
tabindex: "-1",
|
|
244
|
+
class: g(k),
|
|
245
|
+
"data-ac-ds": "",
|
|
246
|
+
"data-testid": "ac-user-menu-logout",
|
|
247
|
+
onClick: we
|
|
248
|
+
}, {
|
|
249
|
+
default: T(() => [d(C(oe), { "aria-hidden": "true" }), l("span", null, S(f.logoutLabel), 1)]),
|
|
250
|
+
_: 1
|
|
251
|
+
}, 8, ["href", "type"]))])
|
|
252
|
+
], 36)) : s("", !0)]),
|
|
253
|
+
_: 3
|
|
254
|
+
})]))]));
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
//#endregion
|
|
258
|
+
export { j as default };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export { default as AcAccordion } from "./AcAccordion.vue";
|
|
2
|
+
export { default as AcAccordionItem } from "./AcAccordionItem.vue";
|
|
3
|
+
export { default as AcAlert } from "./AcAlert.vue";
|
|
4
|
+
export { default as AcAppSwitcher } from "./AcAppSwitcher.vue";
|
|
5
|
+
export { default as AcAvatar } from "./AcAvatar.vue";
|
|
6
|
+
export { default as AcBadge } from "./AcBadge.vue";
|
|
7
|
+
export { default as AcBanner } from "./AcBanner.vue";
|
|
8
|
+
export { default as AcBreadcrumb } from "./AcBreadcrumb.vue";
|
|
9
|
+
export { default as AcButton } from "./AcButton.vue";
|
|
10
|
+
export { default as AcButtons } from "./AcButtons.vue";
|
|
11
|
+
export { default as AcCard } from "./AcCard.vue";
|
|
12
|
+
export { default as AcPage } from "./AcPage.vue";
|
|
13
|
+
export { default as AcCellValue } from "./AcCellValue.vue";
|
|
14
|
+
export { default as AcCheckBox } from "./AcCheckBox.vue";
|
|
15
|
+
export { default as AcCheckRadio } from "./AcCheckRadio.vue";
|
|
16
|
+
export { default as AcClusterSwitcher } from "./AcClusterSwitcher.vue";
|
|
17
|
+
export { default as AcContentHeader } from "./AcContentHeader.vue";
|
|
18
|
+
export { default as AcContentLayout } from "./AcContentLayout.vue";
|
|
19
|
+
export { default as AcContentTable } from "./AcContentTable.vue";
|
|
20
|
+
export { default as AcDatePicker } from "./AcDatePicker.vue";
|
|
21
|
+
export { default as AcDeleteConfirmationModal } from "./AcDeleteModal.vue";
|
|
22
|
+
export { default as AcDeleteModal } from "./AcDeleteModal.vue";
|
|
23
|
+
export { default as AcDivider } from "./AcDivider.vue";
|
|
24
|
+
export { default as AcDropdown } from "./AcDropdown.vue";
|
|
25
|
+
export { default as AcDropdownDivider } from "./AcDropdownDivider.vue";
|
|
26
|
+
export { default as AcDropdownItem } from "./AcDropdownItem.vue";
|
|
27
|
+
export { default as AcEmptyState } from "./AcEmptyState.vue";
|
|
28
|
+
export { default as AcFeatureCard } from "./AcFeatureCard.vue";
|
|
29
|
+
export { default as AcFileUpload } from "./AcFileUpload.vue";
|
|
30
|
+
export { default as AcForm } from "./AcForm.vue";
|
|
31
|
+
export { default as AcFormArray } from "./AcFormArray.vue";
|
|
32
|
+
export { default as AcFormFooter } from "./AcFormFooter.vue";
|
|
33
|
+
export { default as AcFormSection } from "./AcFormSection.vue";
|
|
34
|
+
export { default as AcHeader } from "./AcHeader.vue";
|
|
35
|
+
export { default as AcHeaderItem } from "./AcHeaderItem.vue";
|
|
36
|
+
export { default as AcHeaderItems } from "./AcHeaderItems.vue";
|
|
37
|
+
export { default as AcInfoTable } from "./AcInfoTable.vue";
|
|
38
|
+
export { default as AcInput } from "./AcInput.vue";
|
|
39
|
+
export { default as AcKbd } from "./AcKbd.vue";
|
|
40
|
+
export { default as AcLogo } from "./AcLogo.vue";
|
|
41
|
+
export { default as AcModal } from "./AcModal.vue";
|
|
42
|
+
export { default as AcNavbar } from "./AcNavbar.vue";
|
|
43
|
+
export { default as AcNavbarItem } from "./AcNavbarItem.vue";
|
|
44
|
+
export { default as AcNotificationMenu } from "./AcNotificationMenu.vue";
|
|
45
|
+
export { default as AcPagination } from "./AcPagination.vue";
|
|
46
|
+
export { default as AcPreloader } from "./AcPreloader.vue";
|
|
47
|
+
export { default as AcProgress } from "./AcProgress.vue";
|
|
48
|
+
export { default as AcResourceCard } from "./AcResourceCard.vue";
|
|
49
|
+
export { default as AcSearchBar } from "./AcSearchBar.vue";
|
|
50
|
+
export { default as AcSectionContent } from "./AcSectionContent.vue";
|
|
51
|
+
export { default as AcSegmentedControl } from "./AcSegmentedControl.vue";
|
|
52
|
+
export { default as AcSelect } from "./AcSelect.vue";
|
|
53
|
+
export { default as AcSidebar } from "./AcSidebar.vue";
|
|
54
|
+
export { default as AcSidebarItem } from "./AcSidebarItem.vue";
|
|
55
|
+
export { default as AcSidebarSection } from "./AcSidebarSection.vue";
|
|
56
|
+
export { default as AcSidePanel } from "./AcSidePanel.vue";
|
|
57
|
+
export { default as AcSideTabs } from "./AcSideTabs.vue";
|
|
58
|
+
export { default as AcSkeleton } from "./AcSkeleton.vue";
|
|
59
|
+
export { default as AcSlider } from "./AcSlider.vue";
|
|
60
|
+
export { default as AcSpinner } from "./AcSpinner.vue";
|
|
61
|
+
export { default as AcStatCard } from "./AcStatCard.vue";
|
|
62
|
+
export { default as AcStatusBar } from "./AcStatusBar.vue";
|
|
63
|
+
export { default as AcSteps } from "./AcSteps.vue";
|
|
64
|
+
export { default as AcSwitch } from "./AcSwitch.vue";
|
|
65
|
+
export { default as AcTable } from "./AcTable.vue";
|
|
66
|
+
export { default as AcTabs } from "./AcTabs.vue";
|
|
67
|
+
export { default as AcTag } from "./AcTag.vue";
|
|
68
|
+
export { default as AcTextarea } from "./AcTextarea.vue";
|
|
69
|
+
export { default as AcThemeMode } from "./AcThemeMode.vue";
|
|
70
|
+
export { default as AcFontScale } from "./AcFontScale.vue";
|
|
71
|
+
export { default as AcToaster } from "./AcToaster.vue";
|
|
72
|
+
export { default as AcTooltip } from "./AcTooltip.vue";
|
|
73
|
+
export { default as AcUsageCard } from "./AcUsageCard.vue";
|
|
74
|
+
export { default as AcUserMenu } from "./AcUserMenu.vue";
|
|
75
|
+
/** Alias of AcDeleteModal under the old library's name. */
|
|
76
|
+
export type * from "./types";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type Tone = "primary" | "info" | "success" | "warning" | "danger";
|
|
2
|
+
export type Variant = "solid" | "light" | "outlined";
|
|
3
|
+
export interface Option<T = unknown> {
|
|
4
|
+
value: T;
|
|
5
|
+
label: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface SelectOption<V = string | number> {
|
|
10
|
+
value: V;
|
|
11
|
+
label: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/** Options with the same group are listed under that heading. */
|
|
15
|
+
group?: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/** A brand colour as numbers: hue 0–360, saturation and lightness 0–100. */
|
|
2
|
+
export interface BrandHsl {
|
|
3
|
+
hue: number;
|
|
4
|
+
saturation: number;
|
|
5
|
+
lightness: number;
|
|
6
|
+
}
|
|
7
|
+
/** The shape the old `@appscode/design-system/plugins/theme` returned: strings, with `%` on saturation and lightness. */
|
|
8
|
+
export interface LegacyHsl {
|
|
9
|
+
hue: string;
|
|
10
|
+
saturation: string;
|
|
11
|
+
lightness: string;
|
|
12
|
+
}
|
|
13
|
+
export interface SetBrandColorOptions {
|
|
14
|
+
/** Darkens the colour, keeping its hue, until white text on it reaches 4.5:1. */
|
|
15
|
+
ensureContrast?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** WCAG AA for normal-size text. */
|
|
18
|
+
export declare const MIN_CONTRAST = 4.5;
|
|
19
|
+
/** Parses `#rgb` or `#rrggbb` (the `#` is optional). Returns `null` for anything else. */
|
|
20
|
+
export declare function hexToHsl(hex: string): BrandHsl | null;
|
|
21
|
+
/** Converts an HSL colour to `#rrggbb`. */
|
|
22
|
+
export declare function hslToHex(color: BrandHsl): string;
|
|
23
|
+
/** WCAG contrast ratio of white text on the colour, from 1 to 21. Solid buttons put white text on `bg-primary`. */
|
|
24
|
+
export declare function contrastOnWhite(color: BrandHsl): number;
|
|
25
|
+
/** The highest lightness (in whole percent) at which white text on this hue and saturation still reaches `target`. */
|
|
26
|
+
export declare function readableLightness(hue: number, saturation: number, target?: number): number;
|
|
27
|
+
/**
|
|
28
|
+
* The runtime brand colour. It writes `--primary-hue`, `--primary-saturation` and `--primary-light`
|
|
29
|
+
* on <html>, which re-hues every `primary-*` step. State is shared by every caller.
|
|
30
|
+
* With `persist`, the colour is saved in localStorage (the old apps' `themeColor` key) and restored on first use.
|
|
31
|
+
*/
|
|
32
|
+
export declare function useBrandColor(options?: {
|
|
33
|
+
persist?: boolean;
|
|
34
|
+
}): {
|
|
35
|
+
color: import("vue").ComputedRef<string>;
|
|
36
|
+
hsl: import("vue").ComputedRef<{
|
|
37
|
+
hue: number;
|
|
38
|
+
saturation: number;
|
|
39
|
+
lightness: number;
|
|
40
|
+
} | null>;
|
|
41
|
+
contrast: import("vue").ComputedRef<number>;
|
|
42
|
+
isReadable: import("vue").ComputedRef<boolean>;
|
|
43
|
+
setColor: (hex: string, setOptions?: SetBrandColorOptions) => boolean;
|
|
44
|
+
reset: () => void;
|
|
45
|
+
};
|
|
46
|
+
/** @deprecated Use `hexToHsl`. Same output as the old plugin: `{ hue: "208", saturation: "77%", lightness: "40%" }`. */
|
|
47
|
+
export declare function HexToHSL(hex: string): LegacyHsl;
|
|
48
|
+
/** @deprecated Use `hslToHex`. Takes numbers, like the old plugin. */
|
|
49
|
+
export declare function HSLToHex(h: number, s: number, l: number): string;
|
|
50
|
+
/** @deprecated Use `useBrandColor().hsl`. Reads the three variables from :root as strings. */
|
|
51
|
+
export declare function getThemeHSL(): LegacyHsl;
|
|
52
|
+
/** @deprecated Use `useBrandColor().setColor(hex)`. Writes the three variables on :root; pass `%` on saturation and lightness. */
|
|
53
|
+
export declare function setThemeHSL(h: string | number, s: string, l: string): void;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { computed as e, ref as t } from "vue";
|
|
2
|
+
//#region src/lib/composables/useBrandColor.ts
|
|
3
|
+
var n = "themeColor", r = [
|
|
4
|
+
"--primary-hue",
|
|
5
|
+
"--primary-saturation",
|
|
6
|
+
"--primary-light"
|
|
7
|
+
], i = 4.5, a = t(null), o = !1;
|
|
8
|
+
function s(e, t, n) {
|
|
9
|
+
return Math.min(n, Math.max(t, e));
|
|
10
|
+
}
|
|
11
|
+
function c(e) {
|
|
12
|
+
let t = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
|
|
13
|
+
if (!t) return null;
|
|
14
|
+
let n = t[1].length === 3 ? [...t[1]].map((e) => e + e).join("") : t[1], [r, i, a] = [
|
|
15
|
+
0,
|
|
16
|
+
2,
|
|
17
|
+
4
|
|
18
|
+
].map((e) => parseInt(n.slice(e, e + 2), 16) / 255), o = Math.max(r, i, a), s = Math.min(r, i, a), c = o - s, l = (o + s) / 2, u = 0;
|
|
19
|
+
c && (u = o === r ? (i - a) / c % 6 : o === i ? (a - r) / c + 2 : (r - i) / c + 4), u = Math.round(u * 60), u < 0 && (u += 360);
|
|
20
|
+
let d = c ? c / (1 - Math.abs(2 * l - 1)) : 0;
|
|
21
|
+
return {
|
|
22
|
+
hue: u,
|
|
23
|
+
saturation: +(d * 100).toFixed(1),
|
|
24
|
+
lightness: +(l * 100).toFixed(1)
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function l({ hue: e, saturation: t, lightness: n }) {
|
|
28
|
+
let r = s(t, 0, 100) / 100, i = s(n, 0, 100) / 100, a = (t) => (t + e / 30) % 12, o = r * Math.min(i, 1 - i), c = (e) => i - o * Math.max(-1, Math.min(a(e) - 3, 9 - a(e), 1));
|
|
29
|
+
return [
|
|
30
|
+
c(0),
|
|
31
|
+
c(8),
|
|
32
|
+
c(4)
|
|
33
|
+
];
|
|
34
|
+
}
|
|
35
|
+
function u(e) {
|
|
36
|
+
return `#${l(e).map((e) => Math.round(e * 255).toString(16).padStart(2, "0")).join("")}`;
|
|
37
|
+
}
|
|
38
|
+
function d(e) {
|
|
39
|
+
let [t, n, r] = l(e).map((e) => e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4);
|
|
40
|
+
return 1.05 / (.2126 * t + .7152 * n + .0722 * r + .05);
|
|
41
|
+
}
|
|
42
|
+
function f(e, t, n = i) {
|
|
43
|
+
for (let r = 100; r > 0; r--) if (d({
|
|
44
|
+
hue: e,
|
|
45
|
+
saturation: t,
|
|
46
|
+
lightness: r
|
|
47
|
+
}) >= n) return r;
|
|
48
|
+
return 0;
|
|
49
|
+
}
|
|
50
|
+
function p() {
|
|
51
|
+
if (typeof document > "u") return null;
|
|
52
|
+
let e = getComputedStyle(document.documentElement), [t, n, i] = r.map((t) => parseFloat(e.getPropertyValue(t)));
|
|
53
|
+
return [
|
|
54
|
+
t,
|
|
55
|
+
n,
|
|
56
|
+
i
|
|
57
|
+
].some((e) => Number.isNaN(e)) ? null : {
|
|
58
|
+
hue: t,
|
|
59
|
+
saturation: n,
|
|
60
|
+
lightness: i
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function m(e) {
|
|
64
|
+
let t = document.documentElement.style;
|
|
65
|
+
t.setProperty("--primary-hue", String(e.hue)), t.setProperty("--primary-saturation", `${e.saturation}%`), t.setProperty("--primary-light", `${e.lightness}%`), a.value = e;
|
|
66
|
+
}
|
|
67
|
+
function h() {
|
|
68
|
+
try {
|
|
69
|
+
return localStorage.getItem(n);
|
|
70
|
+
} catch {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function g(t = {}) {
|
|
75
|
+
if (typeof document < "u") {
|
|
76
|
+
if (t.persist && !o) {
|
|
77
|
+
o = !0;
|
|
78
|
+
let e = h(), t = e ? c(e) : null;
|
|
79
|
+
t && m(t);
|
|
80
|
+
}
|
|
81
|
+
a.value = p();
|
|
82
|
+
}
|
|
83
|
+
let s = e(() => a.value), l = e(() => a.value ? u(a.value) : ""), g = e(() => a.value ? d(a.value) : 0), _ = e(() => g.value >= i);
|
|
84
|
+
function v(e, r = {}) {
|
|
85
|
+
let i = c(e);
|
|
86
|
+
if (!i || typeof document > "u") return !1;
|
|
87
|
+
let a = r.ensureContrast ? {
|
|
88
|
+
...i,
|
|
89
|
+
lightness: Math.min(i.lightness, f(i.hue, i.saturation))
|
|
90
|
+
} : i;
|
|
91
|
+
if (m(a), t.persist) try {
|
|
92
|
+
localStorage.setItem(n, u(a));
|
|
93
|
+
} catch {}
|
|
94
|
+
return !0;
|
|
95
|
+
}
|
|
96
|
+
function y() {
|
|
97
|
+
if (typeof document < "u" && (r.forEach((e) => document.documentElement.style.removeProperty(e)), a.value = p(), t.persist)) try {
|
|
98
|
+
localStorage.removeItem(n);
|
|
99
|
+
} catch {}
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
color: l,
|
|
103
|
+
hsl: s,
|
|
104
|
+
contrast: g,
|
|
105
|
+
isReadable: _,
|
|
106
|
+
setColor: v,
|
|
107
|
+
reset: y
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function _(e) {
|
|
111
|
+
let t = c(e) ?? {
|
|
112
|
+
hue: 0,
|
|
113
|
+
saturation: 0,
|
|
114
|
+
lightness: 0
|
|
115
|
+
};
|
|
116
|
+
return {
|
|
117
|
+
hue: String(t.hue),
|
|
118
|
+
saturation: `${t.saturation}%`,
|
|
119
|
+
lightness: `${t.lightness}%`
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function v(e, t, n) {
|
|
123
|
+
return u({
|
|
124
|
+
hue: e,
|
|
125
|
+
saturation: t,
|
|
126
|
+
lightness: n
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function y() {
|
|
130
|
+
if (typeof document > "u") return {
|
|
131
|
+
hue: "",
|
|
132
|
+
saturation: "",
|
|
133
|
+
lightness: ""
|
|
134
|
+
};
|
|
135
|
+
let e = getComputedStyle(document.documentElement), [t, n, i] = r.map((t) => e.getPropertyValue(t).trim());
|
|
136
|
+
return {
|
|
137
|
+
hue: t,
|
|
138
|
+
saturation: n,
|
|
139
|
+
lightness: i
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function b(e, t, n) {
|
|
143
|
+
if (typeof document > "u") return;
|
|
144
|
+
let r = document.documentElement.style;
|
|
145
|
+
r.setProperty("--primary-hue", String(e)), r.setProperty("--primary-saturation", t), r.setProperty("--primary-light", n), a.value = p();
|
|
146
|
+
}
|
|
147
|
+
//#endregion
|
|
148
|
+
export { v as HSLToHex, _ as HexToHSL, i as MIN_CONTRAST, d as contrastOnWhite, y as getThemeHSL, c as hexToHsl, u as hslToHex, f as readableLightness, b as setThemeHSL, g as useBrandColor };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type ColorMode = "light" | "dark" | "system";
|
|
2
|
+
/**
|
|
3
|
+
* The app-wide light/dark/system choice. State is shared by every caller;
|
|
4
|
+
* it toggles `.dark` and `.is-dark-theme` on <html> and remembers the choice in localStorage.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useColorMode(options?: {
|
|
7
|
+
defaultMode?: ColorMode;
|
|
8
|
+
}): {
|
|
9
|
+
mode: import("vue").ComputedRef<ColorMode>;
|
|
10
|
+
isDark: import("vue").ComputedRef<boolean>;
|
|
11
|
+
setMode: (next: ColorMode) => void;
|
|
12
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { computed as e, ref as t } from "vue";
|
|
2
|
+
//#region src/lib/composables/useColorMode.ts
|
|
3
|
+
var n = "themeMode", r = t("light"), i = t(!1), a = !1;
|
|
4
|
+
function o() {
|
|
5
|
+
try {
|
|
6
|
+
let e = localStorage.getItem(n);
|
|
7
|
+
return e === "light" || e === "dark" || e === "system" ? e : null;
|
|
8
|
+
} catch {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function s(e) {
|
|
13
|
+
let t = document.documentElement;
|
|
14
|
+
t.classList.toggle("dark", e), t.classList.toggle("is-dark-theme", e);
|
|
15
|
+
}
|
|
16
|
+
function c(e) {
|
|
17
|
+
if (a || typeof window > "u") return;
|
|
18
|
+
a = !0, r.value = o() ?? e;
|
|
19
|
+
let t = window.matchMedia("(prefers-color-scheme: dark)");
|
|
20
|
+
i.value = t.matches, t.addEventListener("change", (e) => {
|
|
21
|
+
i.value = e.matches, s(l.value);
|
|
22
|
+
}), s(l.value);
|
|
23
|
+
}
|
|
24
|
+
var l = e(() => r.value === "system" ? i.value : r.value === "dark");
|
|
25
|
+
function u(t = {}) {
|
|
26
|
+
c(t.defaultMode ?? "light");
|
|
27
|
+
function i(e) {
|
|
28
|
+
r.value = e, s(l.value);
|
|
29
|
+
try {
|
|
30
|
+
localStorage.setItem(n, e);
|
|
31
|
+
} catch {}
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
mode: e(() => r.value),
|
|
35
|
+
isDark: l,
|
|
36
|
+
setMode: i
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { u as useColorMode };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** `small` 0.92, `default` 1, `large` 1.1, `larger` 1.2 — or any number between 0.8 and 1.5. */
|
|
2
|
+
export type FontScale = "small" | "default" | "large" | "larger";
|
|
3
|
+
export declare const FONT_SCALES: Record<FontScale, number>;
|
|
4
|
+
/**
|
|
5
|
+
* The app-wide interface scale. It writes `--ac-scale` on <html>; text, line heights, spacing and radii are all
|
|
6
|
+
* multiples of it, so the whole interface grows or shrinks in proportion. State is shared by every caller and
|
|
7
|
+
* remembered in localStorage.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useFontScale(options?: {
|
|
10
|
+
defaultScale?: number;
|
|
11
|
+
}): {
|
|
12
|
+
scale: import("vue").ComputedRef<number>;
|
|
13
|
+
preset: import("vue").ComputedRef<FontScale | null>;
|
|
14
|
+
setScale: (next: FontScale | number) => void;
|
|
15
|
+
presets: Record<FontScale, number>;
|
|
16
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { computed as e, ref as t } from "vue";
|
|
2
|
+
//#region src/lib/composables/useFontScale.ts
|
|
3
|
+
var n = {
|
|
4
|
+
small: .92,
|
|
5
|
+
default: 1,
|
|
6
|
+
large: 1.1,
|
|
7
|
+
larger: 1.2
|
|
8
|
+
}, r = "uiScale", i = .8, a = 1.5, o = t(1), s = !1;
|
|
9
|
+
function c(e) {
|
|
10
|
+
return Math.min(a, Math.max(i, Math.round(e * 100) / 100));
|
|
11
|
+
}
|
|
12
|
+
function l() {
|
|
13
|
+
try {
|
|
14
|
+
let e = localStorage.getItem(r), t = e === null ? NaN : Number(e);
|
|
15
|
+
return Number.isFinite(t) ? c(t) : null;
|
|
16
|
+
} catch {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function u(e) {
|
|
21
|
+
document.documentElement.style.setProperty("--ac-scale", String(e)), window.dispatchEvent(new Event("ac-scale"));
|
|
22
|
+
}
|
|
23
|
+
function d(e) {
|
|
24
|
+
s || typeof window > "u" || (s = !0, o.value = l() ?? c(e), u(o.value));
|
|
25
|
+
}
|
|
26
|
+
function f(t = {}) {
|
|
27
|
+
d(t.defaultScale ?? 1);
|
|
28
|
+
function i(e) {
|
|
29
|
+
o.value = c(typeof e == "number" ? e : n[e]), u(o.value);
|
|
30
|
+
try {
|
|
31
|
+
localStorage.setItem(r, String(o.value));
|
|
32
|
+
} catch {}
|
|
33
|
+
}
|
|
34
|
+
let a = e(() => Object.keys(n).find((e) => n[e] === o.value) ?? null);
|
|
35
|
+
return {
|
|
36
|
+
scale: e(() => o.value),
|
|
37
|
+
preset: a,
|
|
38
|
+
setScale: i,
|
|
39
|
+
presets: n
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { n as FONT_SCALES, f as useFontScale };
|