mood-ui 0.11.0 → 0.12.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.
Files changed (124) hide show
  1. package/dist/components/data-display/calendar/AgendaView.cjs.map +1 -1
  2. package/dist/components/data-display/calendar/AgendaView.mjs.map +1 -1
  3. package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.cjs +4 -1
  4. package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  5. package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.mjs +4 -1
  6. package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  7. package/dist/components/data-display/calendar/DayView.cjs.map +1 -1
  8. package/dist/components/data-display/calendar/DayView.mjs.map +1 -1
  9. package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.cjs +7 -4
  10. package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  11. package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.mjs +7 -4
  12. package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  13. package/dist/components/data-display/calendar/MonthView.cjs +1 -1
  14. package/dist/components/data-display/calendar/MonthView.cjs.map +1 -1
  15. package/dist/components/data-display/calendar/MonthView.mjs +1 -1
  16. package/dist/components/data-display/calendar/MonthView.mjs.map +1 -1
  17. package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.cjs +8 -12
  18. package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  19. package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.mjs +8 -12
  20. package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  21. package/dist/components/data-display/calendar/Scheduler.cjs.map +1 -1
  22. package/dist/components/data-display/calendar/Scheduler.mjs.map +1 -1
  23. package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.cjs +7 -4
  24. package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  25. package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.mjs +7 -4
  26. package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  27. package/dist/components/data-display/calendar/WeekView.cjs.map +1 -1
  28. package/dist/components/data-display/calendar/WeekView.mjs.map +1 -1
  29. package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.cjs +7 -4
  30. package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  31. package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.mjs +7 -4
  32. package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  33. package/dist/components/data-display/date-picker/DateTimePicker.cjs.map +1 -1
  34. package/dist/components/data-display/date-picker/DateTimePicker.mjs.map +1 -1
  35. package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.cjs +1 -1
  36. package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  37. package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.mjs +1 -1
  38. package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  39. package/dist/components/feedback/Drawer.cjs.map +1 -1
  40. package/dist/components/feedback/Drawer.mjs.map +1 -1
  41. package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.cjs +4 -9
  42. package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  43. package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.mjs +4 -9
  44. package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  45. package/dist/components/feedback/Modal.cjs.map +1 -1
  46. package/dist/components/feedback/Modal.mjs.map +1 -1
  47. package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.cjs +4 -9
  48. package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  49. package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.mjs +4 -9
  50. package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  51. package/dist/components/feedback/Tooltip.cjs.map +1 -1
  52. package/dist/components/feedback/Tooltip.mjs.map +1 -1
  53. package/dist/components/feedback/Tooltip.vue_vue_type_script_setup_true_lang.cjs +44 -17
  54. package/dist/components/feedback/Tooltip.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  55. package/dist/components/feedback/Tooltip.vue_vue_type_script_setup_true_lang.mjs +44 -17
  56. package/dist/components/feedback/Tooltip.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  57. package/dist/components/forms/Combobox.cjs.map +1 -1
  58. package/dist/components/forms/Combobox.mjs.map +1 -1
  59. package/dist/components/forms/Combobox.vue_vue_type_script_setup_true_lang.cjs +2 -2
  60. package/dist/components/forms/Combobox.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  61. package/dist/components/forms/Combobox.vue_vue_type_script_setup_true_lang.mjs +2 -2
  62. package/dist/components/forms/Combobox.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  63. package/dist/components/forms/PhoneInput.cjs.map +1 -1
  64. package/dist/components/forms/PhoneInput.mjs.map +1 -1
  65. package/dist/components/forms/PhoneInput.vue_vue_type_script_setup_true_lang.cjs +6 -1
  66. package/dist/components/forms/PhoneInput.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  67. package/dist/components/forms/PhoneInput.vue_vue_type_script_setup_true_lang.mjs +6 -1
  68. package/dist/components/forms/PhoneInput.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  69. package/dist/components/forms/SearchInput.cjs.map +1 -1
  70. package/dist/components/forms/SearchInput.mjs.map +1 -1
  71. package/dist/components/forms/SearchInput.vue_vue_type_script_setup_true_lang.cjs +8 -6
  72. package/dist/components/forms/SearchInput.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  73. package/dist/components/forms/SearchInput.vue_vue_type_script_setup_true_lang.mjs +8 -6
  74. package/dist/components/forms/SearchInput.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  75. package/dist/components/layout/PopoverPanel.cjs +1 -1
  76. package/dist/components/layout/PopoverPanel.cjs.map +1 -1
  77. package/dist/components/layout/PopoverPanel.mjs +1 -1
  78. package/dist/components/layout/PopoverPanel.mjs.map +1 -1
  79. package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.cjs +2 -2
  80. package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  81. package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.mjs +2 -2
  82. package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  83. package/dist/components/navigation/Switcher.cjs.map +1 -1
  84. package/dist/components/navigation/Switcher.mjs.map +1 -1
  85. package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.cjs +38 -40
  86. package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  87. package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.mjs +38 -40
  88. package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  89. package/dist/composables/eventColors.cjs +51 -27
  90. package/dist/composables/eventColors.cjs.map +1 -1
  91. package/dist/composables/eventColors.mjs +51 -27
  92. package/dist/composables/eventColors.mjs.map +1 -1
  93. package/dist/composables/useBodyScrollLock.cjs +44 -0
  94. package/dist/composables/useBodyScrollLock.cjs.map +1 -0
  95. package/dist/composables/useBodyScrollLock.mjs +43 -0
  96. package/dist/composables/useBodyScrollLock.mjs.map +1 -0
  97. package/dist/composables/useCalendarTheme.cjs +29 -8
  98. package/dist/composables/useCalendarTheme.cjs.map +1 -1
  99. package/dist/composables/useCalendarTheme.mjs +29 -8
  100. package/dist/composables/useCalendarTheme.mjs.map +1 -1
  101. package/dist/composables/usePopover.cjs +44 -12
  102. package/dist/composables/usePopover.cjs.map +1 -1
  103. package/dist/composables/usePopover.mjs +44 -12
  104. package/dist/composables/usePopover.mjs.map +1 -1
  105. package/dist/mood-ui.css +9 -9
  106. package/dist/types/composables/eventColors.d.ts +2 -2
  107. package/dist/types/composables/useBodyScrollLock.d.ts +19 -0
  108. package/dist/types/composables/useCalendarTheme.d.ts +2 -0
  109. package/dist/types/interfaces/data-display/calendar/AgendaView.interface.d.ts +5 -0
  110. package/dist/types/interfaces/data-display/calendar/DayView.interface.d.ts +5 -0
  111. package/dist/types/interfaces/data-display/calendar/MonthView.interface.d.ts +5 -0
  112. package/dist/types/interfaces/data-display/calendar/Scheduler.interface.d.ts +5 -0
  113. package/dist/types/interfaces/data-display/calendar/WeekView.interface.d.ts +5 -0
  114. package/dist/types/utils/cssLength.d.ts +5 -0
  115. package/dist/types/utils/tooltipArrow.d.ts +34 -0
  116. package/dist/utils/cssLength.cjs +13 -0
  117. package/dist/utils/cssLength.cjs.map +1 -0
  118. package/dist/utils/cssLength.mjs +13 -0
  119. package/dist/utils/cssLength.mjs.map +1 -0
  120. package/dist/utils/tooltipArrow.cjs +37 -0
  121. package/dist/utils/tooltipArrow.cjs.map +1 -0
  122. package/dist/utils/tooltipArrow.mjs +36 -0
  123. package/dist/utils/tooltipArrow.mjs.map +1 -0
  124. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Switcher.vue_vue_type_script_setup_true_lang.mjs","names":["$slots"],"sources":["../../../src/components/navigation/Switcher.vue"],"sourcesContent":["<template>\n <div class=\"modo-switcher inline-flex\" :class=\"{ 'w-full': fullWidth }\">\n <span ref=\"triggerWrapEl\" class=\"inline-flex\" :class=\"{ 'w-full': fullWidth }\">\n <slot\n name=\"trigger\"\n :activeItem=\"activeItem\"\n :isOpen=\"isOpen\"\n :toggle=\"onTriggerClick\"\n >\n <button\n ref=\"triggerEl\"\n type=\"button\"\n data-modo-switcher-trigger\n aria-haspopup=\"listbox\"\n :aria-expanded=\"isOpen\"\n :aria-label=\"resolvedAriaLabel\"\n :disabled=\"disabled\"\n :class=\"[\n 'inline-flex items-center gap-3 px-3 py-2 text-left transition-colors',\n 'border bg-card text-card-foreground border-border',\n 'hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60',\n radiusClass,\n fullWidth ? 'w-full' : '',\n disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer',\n ]\"\n @click=\"onTriggerClick\"\n @keydown=\"onTriggerKeydown\"\n >\n <span v-if=\"activeItem?.avatar\" class=\"shrink-0\">\n <Avatar\n :src=\"activeItem.avatar.src\"\n :initials=\"activeItem.avatar.initials\"\n :name=\"activeItem.title\"\n size=\"small\"\n />\n </span>\n <span\n v-else-if=\"activeItem?.icon\"\n class=\"shrink-0 inline-flex items-center justify-center w-9 h-9 rounded-md bg-accent/60 text-foreground\"\n >\n <component :is=\"activeItem.icon\" class=\"w-5 h-5\" aria-hidden=\"true\" />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span class=\"truncate text-body font-medium\">\n {{ activeItem ? activeItem.title : resolvedPlaceholder }}\n </span>\n <span\n v-if=\"!compactTrigger && activeItem?.subtitle\"\n class=\"truncate text-caption text-muted-foreground\"\n >\n {{ activeItem.subtitle }}\n </span>\n </span>\n <ChevronUpDownIcon\n v-if=\"chevron === 'updown'\"\n class=\"w-4 h-4 shrink-0 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n <ChevronDownIcon\n v-else-if=\"chevron === 'down'\"\n class=\"w-4 h-4 shrink-0 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n </button>\n </slot>\n </span>\n\n <PopoverPanel\n :open=\"isOpen\"\n :style=\"mergedPanelStyle\"\n :radius=\"resolvedRadius\"\n role=\"dialog\"\n :aria-label=\"resolvedAriaLabel\"\n @update:panelRef=\"panelRef = $event\"\n >\n <div\n data-modo-switcher-panel\n class=\"modo-switcher-panel overflow-y-auto\"\n :style=\"{ maxHeight: panelMaxHeightStyle }\"\n >\n <div\n v-if=\"panelTitle\"\n class=\"px-3 pt-3 pb-2 text-caption text-muted-foreground uppercase tracking-wider\"\n >\n {{ panelTitle }}\n </div>\n\n <div v-if=\"searchable\" class=\"px-2 pt-2 pb-1\">\n <input\n ref=\"searchInputEl\"\n v-model=\"searchQuery\"\n role=\"searchbox\"\n type=\"text\"\n :placeholder=\"resolvedSearchPlaceholder\"\n :aria-controls=\"listboxId\"\n :aria-activedescendant=\"activeDescendantId\"\n class=\"w-full px-2 py-1.5 text-body bg-background border border-border rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60\"\n @keydown=\"onSearchKeydown\"\n />\n </div>\n\n <template v-if=\"loading\">\n <slot name=\"loading\">\n <div class=\"p-2 flex flex-col gap-1\">\n <div\n v-for=\"i in 3\"\n :key=\"i\"\n data-modo-switcher-skeleton\n >\n <Skeleton height=\"44px\" />\n </div>\n </div>\n </slot>\n </template>\n\n <template v-else-if=\"items.length === 0\">\n <slot name=\"empty\">\n <div class=\"px-3 py-6 text-center text-muted-foreground text-body\">\n {{ resolvedEmptyText }}\n </div>\n </slot>\n </template>\n\n <template v-else-if=\"displayedItems.length === 0\">\n <div class=\"px-3 py-6 text-center text-muted-foreground text-body\">\n {{ resolvedNoResults }}\n </div>\n </template>\n\n <ul\n v-else\n role=\"listbox\"\n :id=\"listboxId\"\n class=\"flex flex-col\"\n @keydown=\"onListKeydown\"\n >\n <li\n v-for=\"(item, idx) in displayedItems\"\n :key=\"item.value\"\n :ref=\"(el) => setOptionRef(el as HTMLElement | null, idx)\"\n role=\"option\"\n :id=\"`${listboxId}-opt-${idx}`\"\n :aria-selected=\"item.value === modelValue\"\n :aria-current=\"item.value === modelValue ? 'true' : undefined\"\n :aria-disabled=\"item.disabled || undefined\"\n :data-active=\"item.value === modelValue || undefined\"\n :tabindex=\"-1\"\n class=\"modo-switcher-item flex items-center gap-3 px-3 py-2 cursor-pointer\"\n :class=\"[\n item.value === modelValue ? 'bg-accent/40' : '',\n searchable && idx === highlightedIdx ? 'bg-accent' : 'hover:bg-accent',\n item.disabled ? 'opacity-50 cursor-not-allowed' : '',\n ]\"\n @click=\"selectItem(item)\"\n @mouseenter=\"searchable ? (highlightedIdx = idx) : null\"\n >\n <span v-if=\"item.avatar\" class=\"shrink-0\">\n <Avatar\n :src=\"item.avatar.src\"\n :initials=\"item.avatar.initials\"\n :name=\"item.title\"\n size=\"small\"\n />\n </span>\n <span\n v-else-if=\"item.icon\"\n data-modo-switcher-iconwrap\n class=\"shrink-0 inline-flex items-center justify-center w-9 h-9 rounded-md bg-accent/60 text-foreground\"\n >\n <component :is=\"item.icon\" class=\"w-5 h-5\" aria-hidden=\"true\" />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span class=\"truncate text-body font-medium\">{{ item.title }}</span>\n <span\n v-if=\"item.subtitle\"\n class=\"truncate text-caption text-muted-foreground\"\n >{{ item.subtitle }}</span>\n </span>\n <slot\n name=\"item-trailing\"\n :item=\"item\"\n :active=\"item.value === modelValue\"\n :close=\"close\"\n >\n <CheckIcon\n v-if=\"item.value === modelValue\"\n class=\"w-4 h-4 shrink-0\"\n aria-hidden=\"true\"\n />\n </slot>\n </li>\n </ul>\n\n <template v-if=\"$slots.footer\">\n <hr\n data-modo-switcher-footer-sep\n role=\"separator\"\n class=\"my-1 border-t border-border\"\n />\n <div class=\"p-1\">\n <slot name=\"footer\" :close=\"close\" />\n </div>\n </template>\n </div>\n </PopoverPanel>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, nextTick, ref, useId, watch, watchEffect } from \"vue\";\nimport { ChevronUpDownIcon, ChevronDownIcon, CheckIcon } from \"@heroicons/vue/24/outline\";\nimport PopoverPanel from \"../layout/PopoverPanel.vue\";\nimport Avatar from \"../data-display/avatar/Avatar.vue\";\nimport Skeleton from \"../feedback/Skeleton.vue\";\nimport { usePopover } from \"../../composables/usePopover\";\nimport {\n useResolvedRadius,\n useModoLocale,\n} from \"../../composables/useModoConfig\";\nimport type {\n Switcher as SwitcherProps,\n SwitcherEmits,\n SwitcherItem,\n SwitcherValue,\n} from \"../../interfaces/navigation/Switcher.interface\";\n\nconst props = withDefaults(defineProps<SwitcherProps>(), {\n modelValue: null,\n chevron: \"updown\",\n triggerVariant: \"outline\",\n compactTrigger: false,\n fullWidth: false,\n panelWidth: \"trigger\",\n panelMinWidth: \"15rem\",\n panelMaxHeight: 320,\n placement: \"bottom-start\",\n searchable: false,\n loading: false,\n disabled: false,\n});\n\nconst emit = defineEmits<SwitcherEmits>();\n\nconst locale = useModoLocale();\nconst resolvedRadius = useResolvedRadius(() => props.radius);\nconst listboxId = useId();\n\nconst resolvedPlaceholder = computed(\n () => props.placeholder ?? locale.value.switcher.placeholder,\n);\nconst resolvedAriaLabel = computed(\n () => props.ariaLabel ?? locale.value.switcher.ariaLabel,\n);\nconst resolvedEmptyText = computed(\n () => props.emptyText ?? locale.value.switcher.empty,\n);\nconst resolvedSearchPlaceholder = computed(\n () => props.searchPlaceholder ?? locale.value.switcher.searchPlaceholder,\n);\nconst resolvedNoResults = computed(\n () => props.noResultsText ?? locale.value.switcher.noResults,\n);\n\nconst searchQuery = ref(\"\");\nconst searchInputEl = ref<HTMLInputElement | null>(null);\n\nconst displayedItems = computed<SwitcherItem[]>(() => {\n if (!props.searchable) return props.items;\n const q = searchQuery.value.trim().toLowerCase();\n if (!q) return props.items;\n const fields = props.searchFields ?? [\"title\", \"subtitle\"];\n return props.items.filter((it) =>\n fields.some((f) => {\n const v = it[f];\n return typeof v === \"string\" && v.toLowerCase().includes(q);\n }),\n );\n});\n\nwatch(searchQuery, (q) => {\n emit(\"search\", q);\n});\n\nconst radiusClass = computed(() => {\n switch (resolvedRadius.value) {\n case \"none\": return \"rounded-none\";\n case \"small\": return \"rounded-sm\";\n case \"large\": return \"rounded-lg\";\n case \"full\": return \"rounded-[999px]\";\n default: return \"rounded-md\";\n }\n});\n\nconst panelMaxHeightStyle = computed(() => {\n const v = props.panelMaxHeight;\n return typeof v === \"number\" ? `${v}px` : v;\n});\n\nconst panelMinWidthStyle = computed(() => {\n const v = props.panelMinWidth;\n if (v == null) return undefined;\n return typeof v === \"number\" ? `${v}px` : v;\n});\n\n// The popover composable sizes the panel to the trigger width when\n// `panelWidth='trigger'`. A narrow trigger (e.g. an avatar-only custom\n// trigger) would otherwise crush the panel — `minWidth` floors it.\nconst mergedPanelStyle = computed(() => ({\n ...panelStyle.value,\n ...(panelMinWidthStyle.value ? { minWidth: panelMinWidthStyle.value } : {}),\n}));\n\nconst activeItem = computed<SwitcherItem | null>(() => {\n if (props.modelValue == null) return null;\n return props.items.find((i) => i.value === props.modelValue) ?? null;\n});\n\nconst {\n triggerRef,\n panelRef,\n isOpen,\n panelStyle,\n open,\n close,\n toggle,\n} = usePopover({\n placement: () => props.placement,\n matchTriggerWidth: () => props.panelWidth === \"trigger\",\n closeOnEscape: false,\n onOpen: () => emit(\"open\"),\n onClose: () => {\n searchQuery.value = \"\";\n emit(\"close\");\n },\n});\n\nconst triggerEl = ref<HTMLElement | null>(null);\nconst triggerWrapEl = ref<HTMLElement | null>(null);\nwatch([triggerEl, triggerWrapEl], ([btn, wrap]) => {\n triggerRef.value = (btn as HTMLElement | null) ?? (wrap as HTMLElement | null);\n});\n\nfunction focusTrigger() {\n const el = triggerEl.value ?? triggerWrapEl.value;\n el?.focus?.();\n}\n\nfunction onTriggerClick() {\n if (props.disabled) return;\n toggle();\n}\n\nfunction selectItem(item: SwitcherItem) {\n if (item.disabled || props.disabled) return;\n emit(\"update:modelValue\", item.value);\n emit(\"change\", item.value, item);\n close();\n}\n\nfunction focusableIndices(): number[] {\n return displayedItems.value\n .map((it, i) => (it.disabled ? -1 : i))\n .filter((i) => i !== -1);\n}\n\nconst optionRefs = new Map<number, HTMLElement>();\nfunction setOptionRef(el: HTMLElement | null, idx: number) {\n if (el) optionRefs.set(idx, el);\n else optionRefs.delete(idx);\n}\n\nfunction focusOptionByIdx(idx: number) {\n optionRefs.get(idx)?.focus();\n}\n\nasync function openAndFocusActive() {\n if (props.disabled) return;\n if (!isOpen.value) open();\n await nextTick();\n if (props.searchable) {\n searchInputEl.value?.focus();\n return;\n }\n const order = focusableIndices();\n if (!order.length) return;\n const activeIdx = displayedItems.value.findIndex(\n (it) => it.value === props.modelValue,\n );\n const usable =\n activeIdx >= 0 && !displayedItems.value[activeIdx].disabled\n ? activeIdx\n : order[0];\n focusOptionByIdx(usable);\n}\n\nfunction onTriggerKeydown(e: KeyboardEvent) {\n if ([\"ArrowDown\", \"ArrowUp\", \"Enter\", \" \"].includes(e.key)) {\n e.preventDefault();\n openAndFocusActive();\n } else if (e.key === \"Escape\" && isOpen.value) {\n e.preventDefault();\n close();\n }\n}\n\nfunction currentFocusedIdx(): number {\n const el = document.activeElement as HTMLElement | null;\n if (!el) return -1;\n for (const [idx, node] of optionRefs.entries()) {\n if (node === el) return idx;\n }\n return -1;\n}\n\nfunction moveFocus(delta: 1 | -1) {\n const order = focusableIndices();\n if (!order.length) return;\n const cur = currentFocusedIdx();\n let pos = order.indexOf(cur);\n if (pos === -1) {\n focusOptionByIdx(delta > 0 ? order[0] : order[order.length - 1]);\n return;\n }\n pos = (pos + delta + order.length) % order.length;\n focusOptionByIdx(order[pos]);\n}\n\nfunction onListKeydown(e: KeyboardEvent) {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n moveFocus(1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n moveFocus(-1);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) focusOptionByIdx(order[0]);\n } else if (e.key === \"End\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) focusOptionByIdx(order[order.length - 1]);\n } else if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n const idx = currentFocusedIdx();\n if (idx >= 0) selectItem(displayedItems.value[idx]);\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n close();\n focusTrigger();\n } else if (\n !props.searchable &&\n e.key.length === 1 &&\n /^[a-zA-Z0-9]$/.test(e.key)\n ) {\n const order = focusableIndices();\n const letter = e.key.toLowerCase();\n const match = order.find((i) =>\n displayedItems.value[i].title.toLowerCase().startsWith(letter),\n );\n if (match !== undefined) focusOptionByIdx(match);\n }\n}\n\nwatch(isOpen, (open) => {\n if (!open) focusTrigger();\n});\n\nconst highlightedIdx = ref<number>(-1);\n\nconst activeDescendantId = computed(() =>\n highlightedIdx.value >= 0\n ? `${listboxId}-opt-${highlightedIdx.value}`\n : undefined,\n);\n\nwatch(displayedItems, () => {\n if (!props.searchable) return;\n const order = focusableIndices();\n highlightedIdx.value = order[0] ?? -1;\n});\n\nwatch(isOpen, (open) => {\n if (!open) {\n highlightedIdx.value = -1;\n return;\n }\n if (!props.searchable) return;\n const idx = displayedItems.value.findIndex(\n (it) => it.value === props.modelValue && !it.disabled,\n );\n const order = focusableIndices();\n highlightedIdx.value = idx >= 0 ? idx : order[0] ?? -1;\n});\n\nfunction moveHighlight(delta: 1 | -1) {\n const order = focusableIndices();\n if (!order.length) return;\n const cur = order.indexOf(highlightedIdx.value);\n if (cur === -1) {\n highlightedIdx.value = delta > 0 ? order[0] : order[order.length - 1];\n return;\n }\n const next = (cur + delta + order.length) % order.length;\n highlightedIdx.value = order[next];\n}\n\nfunction onSearchKeydown(e: KeyboardEvent) {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n moveHighlight(1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n moveHighlight(-1);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) highlightedIdx.value = order[0];\n } else if (e.key === \"End\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) highlightedIdx.value = order[order.length - 1];\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n if (highlightedIdx.value >= 0) {\n selectItem(displayedItems.value[highlightedIdx.value]);\n }\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n close();\n focusTrigger();\n }\n}\n\n// Dev-only: warn once per offending item when both icon and avatar are set.\nif (import.meta.env?.DEV ?? true) {\n const warned = new Set<SwitcherValue>();\n watchEffect(() => {\n for (const item of props.items) {\n if (item.icon && item.avatar && !warned.has(item.value)) {\n warned.add(item.value);\n console.warn(\n `[Switcher] item \"${item.value}\" declares both \\`icon\\` and \\`avatar\\`; \\`avatar\\` wins. Pick one.`,\n );\n }\n }\n });\n}\n\ndefineExpose({ open, close, toggle });\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkOA,MAAM,QAAQ;EAed,MAAM,OAAO;EAEb,MAAM,SAAS,eAAe;EAC9B,MAAM,iBAAiB,wBAAwB,MAAM,OAAO;EAC5D,MAAM,YAAY,OAAO;EAEzB,MAAM,sBAAsB,eACpB,MAAM,eAAe,OAAO,MAAM,SAAS,YAClD;EACD,MAAM,oBAAoB,eAClB,MAAM,aAAa,OAAO,MAAM,SAAS,UAChD;EACD,MAAM,oBAAoB,eAClB,MAAM,aAAa,OAAO,MAAM,SAAS,MAChD;EACD,MAAM,4BAA4B,eAC1B,MAAM,qBAAqB,OAAO,MAAM,SAAS,kBACxD;EACD,MAAM,oBAAoB,eAClB,MAAM,iBAAiB,OAAO,MAAM,SAAS,UACpD;EAED,MAAM,cAAc,IAAI,GAAG;EAC3B,MAAM,gBAAgB,IAA6B,KAAK;EAExD,MAAM,iBAAiB,eAA+B;GACpD,IAAI,CAAC,MAAM,YAAY,OAAO,MAAM;GACpC,MAAM,IAAI,YAAY,MAAM,MAAM,CAAC,aAAa;GA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PP,aAOO,CANL,YAKE,gBAAA;QAJC,KAAK,KAAK,OAAO;QACjB,UAAU,KAAK,OAAO;QACtB,MAAM,KAAK;QACZ,MAAK;;;;;eAII,KAAK,QAAA,WAAA,EADlB,mBAMO,QANP,aAMO,EAAA,WAAA,EADL,YAAgE,wBAAhD,KAAK,KAAI,EAAA;QAAE,OAAM;QAAU,eAAY;;OAEzD,mBAMO,QANP,aAMO,CALL,mBAAoE,QAApE,aAAoE,gBAApB,KAAK,MAAK,EAAA,EAAA,EAElD,KAAK,YAAA,WAAA,EADb,mBAG2B,QAH3B,aAG2B,gBAAvB,KAAK,SAAQ,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA,CAAA,CAAA;OAEnB,WAWO,KAAA,QAAA,iBAAA;QATE;QACN,QAAQ,KAAK,UAAU,QAAA;QACvB,OAAO,MAAA,MAAK;gBAOR,CAJG,KAAK,UAAU,QAAA,cAAA,WAAA,EADvB,YAIE,MAAA,UAAA,EAAA;;QAFA,OAAM;QACN,eAAY;;;;KAMJA,KAAAA,OAAO,UAAA,WAAA,EAAvB,mBASW,UAAA,EAAA,KAAA,GAAA,EAAA,CAAA,OAAA,OAAA,OAAA,KART,mBAIE,MAAA;MAHA,iCAAA;MACA,MAAK;MACL,OAAM;oBAER,mBAEM,OAFN,aAEM,CADJ,WAAqC,KAAA,QAAA,UAAA,EAAhB,OAAO,MAAA,MAAK,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,GAAA,IAAA,mBAAA,IAAA,KAAA"}
1
+ {"version":3,"file":"Switcher.vue_vue_type_script_setup_true_lang.mjs","names":["$slots"],"sources":["../../../src/components/navigation/Switcher.vue"],"sourcesContent":["<template>\n <div class=\"modo-switcher inline-flex\" :class=\"{ 'w-full': fullWidth }\">\n <span ref=\"triggerWrapEl\" class=\"inline-flex\" :class=\"{ 'w-full': fullWidth }\">\n <slot\n name=\"trigger\"\n :activeItem=\"activeItem\"\n :isOpen=\"isOpen\"\n :toggle=\"onTriggerClick\"\n >\n <button\n ref=\"triggerEl\"\n type=\"button\"\n data-modo-switcher-trigger\n aria-haspopup=\"listbox\"\n :aria-expanded=\"isOpen\"\n :aria-label=\"resolvedAriaLabel\"\n :disabled=\"disabled\"\n :class=\"[\n 'inline-flex items-center gap-3 px-3 py-2 text-left transition-colors',\n 'border bg-card text-card-foreground border-border',\n 'hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60',\n radiusClass,\n fullWidth ? 'w-full' : '',\n disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer',\n ]\"\n @click=\"onTriggerClick\"\n @keydown=\"onTriggerKeydown\"\n >\n <span v-if=\"activeItem?.avatar\" class=\"shrink-0\">\n <Avatar\n :src=\"activeItem.avatar.src\"\n :initials=\"activeItem.avatar.initials\"\n :name=\"activeItem.title\"\n size=\"small\"\n />\n </span>\n <span\n v-else-if=\"activeItem?.icon\"\n :class=\"[\n 'shrink-0 inline-flex items-center justify-center w-9 h-9 bg-accent/60 text-foreground',\n radiusClass,\n ]\"\n >\n <component :is=\"activeItem.icon\" class=\"w-5 h-5\" aria-hidden=\"true\" />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span class=\"truncate text-body font-medium\">\n {{ activeItem ? activeItem.title : resolvedPlaceholder }}\n </span>\n <span\n v-if=\"!compactTrigger && activeItem?.subtitle\"\n class=\"truncate text-caption text-muted-foreground\"\n >\n {{ activeItem.subtitle }}\n </span>\n </span>\n <ChevronUpDownIcon\n v-if=\"chevron === 'updown'\"\n class=\"w-4 h-4 shrink-0 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n <ChevronDownIcon\n v-else-if=\"chevron === 'down'\"\n class=\"w-4 h-4 shrink-0 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n </button>\n </slot>\n </span>\n\n <PopoverPanel\n :open=\"isOpen\"\n :style=\"mergedPanelStyle\"\n :radius=\"resolvedRadius\"\n role=\"dialog\"\n :aria-label=\"resolvedAriaLabel\"\n @update:panelRef=\"panelRef = $event\"\n >\n <div\n data-modo-switcher-panel\n class=\"modo-switcher-panel overflow-y-auto\"\n :style=\"{ maxHeight: panelMaxHeightStyle }\"\n >\n <div\n v-if=\"panelTitle\"\n class=\"px-3 pt-3 pb-2 text-caption text-muted-foreground uppercase tracking-wider\"\n >\n {{ panelTitle }}\n </div>\n\n <div v-if=\"searchable\" class=\"px-2 pt-2 pb-1\">\n <input\n ref=\"searchInputEl\"\n v-model=\"searchQuery\"\n role=\"searchbox\"\n type=\"text\"\n :placeholder=\"resolvedSearchPlaceholder\"\n :aria-controls=\"listboxId\"\n :aria-activedescendant=\"activeDescendantId\"\n class=\"w-full px-2 py-1.5 text-body bg-background border border-border rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60\"\n @keydown=\"onSearchKeydown\"\n />\n </div>\n\n <template v-if=\"loading\">\n <slot name=\"loading\">\n <div class=\"p-2 flex flex-col gap-1\">\n <div\n v-for=\"i in 3\"\n :key=\"i\"\n data-modo-switcher-skeleton\n >\n <Skeleton height=\"44px\" />\n </div>\n </div>\n </slot>\n </template>\n\n <template v-else-if=\"items.length === 0\">\n <slot name=\"empty\">\n <div class=\"px-3 py-6 text-center text-muted-foreground text-body\">\n {{ resolvedEmptyText }}\n </div>\n </slot>\n </template>\n\n <template v-else-if=\"displayedItems.length === 0\">\n <div class=\"px-3 py-6 text-center text-muted-foreground text-body\">\n {{ resolvedNoResults }}\n </div>\n </template>\n\n <ul\n v-else\n role=\"listbox\"\n :id=\"listboxId\"\n class=\"flex flex-col\"\n @keydown=\"onListKeydown\"\n >\n <li\n v-for=\"(item, idx) in displayedItems\"\n :key=\"item.value\"\n :ref=\"(el) => setOptionRef(el as HTMLElement | null, idx)\"\n role=\"option\"\n :id=\"`${listboxId}-opt-${idx}`\"\n :aria-selected=\"item.value === modelValue\"\n :aria-current=\"item.value === modelValue ? 'true' : undefined\"\n :aria-disabled=\"item.disabled || undefined\"\n :data-active=\"item.value === modelValue || undefined\"\n :tabindex=\"-1\"\n class=\"modo-switcher-item flex items-center gap-3 px-3 py-2 cursor-pointer\"\n :class=\"[\n item.value === modelValue ? 'bg-accent/40' : '',\n searchable && idx === highlightedIdx ? 'bg-accent' : 'hover:bg-accent',\n item.disabled ? 'opacity-50 cursor-not-allowed' : '',\n ]\"\n @click=\"selectItem(item)\"\n @mouseenter=\"searchable ? (highlightedIdx = idx) : null\"\n >\n <span v-if=\"item.avatar\" class=\"shrink-0\">\n <Avatar\n :src=\"item.avatar.src\"\n :initials=\"item.avatar.initials\"\n :name=\"item.title\"\n size=\"small\"\n />\n </span>\n <span\n v-else-if=\"item.icon\"\n data-modo-switcher-iconwrap\n :class=\"[\n 'shrink-0 inline-flex items-center justify-center w-9 h-9 bg-accent/60 text-foreground',\n radiusClass,\n ]\"\n >\n <component :is=\"item.icon\" class=\"w-5 h-5\" aria-hidden=\"true\" />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span class=\"truncate text-body font-medium\">{{ item.title }}</span>\n <span\n v-if=\"item.subtitle\"\n class=\"truncate text-caption text-muted-foreground\"\n >{{ item.subtitle }}</span>\n </span>\n <slot\n name=\"item-trailing\"\n :item=\"item\"\n :active=\"item.value === modelValue\"\n :close=\"close\"\n >\n <CheckIcon\n v-if=\"item.value === modelValue\"\n class=\"w-4 h-4 shrink-0\"\n aria-hidden=\"true\"\n />\n </slot>\n </li>\n </ul>\n\n <template v-if=\"$slots.footer\">\n <hr\n data-modo-switcher-footer-sep\n role=\"separator\"\n class=\"my-1 border-t border-border\"\n />\n <div class=\"p-1\">\n <slot name=\"footer\" :close=\"close\" />\n </div>\n </template>\n </div>\n </PopoverPanel>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, nextTick, ref, useId, watch, watchEffect } from \"vue\";\nimport { ChevronUpDownIcon, ChevronDownIcon, CheckIcon } from \"@heroicons/vue/24/outline\";\nimport PopoverPanel from \"../layout/PopoverPanel.vue\";\nimport Avatar from \"../data-display/avatar/Avatar.vue\";\nimport Skeleton from \"../feedback/Skeleton.vue\";\nimport { usePopover } from \"../../composables/usePopover\";\nimport {\n useResolvedRadius,\n useModoLocale,\n} from \"../../composables/useModoConfig\";\nimport type {\n Switcher as SwitcherProps,\n SwitcherEmits,\n SwitcherItem,\n SwitcherValue,\n} from \"../../interfaces/navigation/Switcher.interface\";\n\nconst props = withDefaults(defineProps<SwitcherProps>(), {\n modelValue: null,\n chevron: \"updown\",\n triggerVariant: \"outline\",\n compactTrigger: false,\n fullWidth: false,\n panelWidth: \"trigger\",\n panelMinWidth: \"15rem\",\n panelMaxHeight: 320,\n placement: \"bottom-start\",\n searchable: false,\n loading: false,\n disabled: false,\n});\n\nconst emit = defineEmits<SwitcherEmits>();\n\nconst locale = useModoLocale();\nconst resolvedRadius = useResolvedRadius(() => props.radius);\nconst listboxId = useId();\n\nconst resolvedPlaceholder = computed(\n () => props.placeholder ?? locale.value.switcher.placeholder,\n);\nconst resolvedAriaLabel = computed(\n () => props.ariaLabel ?? locale.value.switcher.ariaLabel,\n);\nconst resolvedEmptyText = computed(\n () => props.emptyText ?? locale.value.switcher.empty,\n);\nconst resolvedSearchPlaceholder = computed(\n () => props.searchPlaceholder ?? locale.value.switcher.searchPlaceholder,\n);\nconst resolvedNoResults = computed(\n () => props.noResultsText ?? locale.value.switcher.noResults,\n);\n\nconst searchQuery = ref(\"\");\nconst searchInputEl = ref<HTMLInputElement | null>(null);\n\nconst displayedItems = computed<SwitcherItem[]>(() => {\n if (!props.searchable) return props.items;\n const q = searchQuery.value.trim().toLowerCase();\n if (!q) return props.items;\n const fields = props.searchFields ?? [\"title\", \"subtitle\"];\n return props.items.filter((it) =>\n fields.some((f) => {\n const v = it[f];\n return typeof v === \"string\" && v.toLowerCase().includes(q);\n }),\n );\n});\n\nwatch(searchQuery, (q) => {\n emit(\"search\", q);\n});\n\nconst radiusClass = computed(() => {\n switch (resolvedRadius.value) {\n case \"none\": return \"rounded-none\";\n case \"small\": return \"rounded-sm\";\n case \"large\": return \"rounded-lg\";\n case \"full\": return \"rounded-[999px]\";\n default: return \"rounded-md\";\n }\n});\n\nconst panelMaxHeightStyle = computed(() => {\n const v = props.panelMaxHeight;\n return typeof v === \"number\" ? `${v}px` : v;\n});\n\nconst panelMinWidthStyle = computed(() => {\n const v = props.panelMinWidth;\n if (v == null) return undefined;\n return typeof v === \"number\" ? `${v}px` : v;\n});\n\n// The popover composable sizes the panel to the trigger width when\n// `panelWidth='trigger'`. A narrow trigger (e.g. an avatar-only custom\n// trigger) would otherwise crush the panel — `minWidth` floors it.\nconst mergedPanelStyle = computed(() => ({\n ...panelStyle.value,\n ...(panelMinWidthStyle.value ? { minWidth: panelMinWidthStyle.value } : {}),\n}));\n\nconst activeItem = computed<SwitcherItem | null>(() => {\n if (props.modelValue == null) return null;\n return props.items.find((i) => i.value === props.modelValue) ?? null;\n});\n\nconst {\n triggerRef,\n panelRef,\n isOpen,\n panelStyle,\n open,\n close,\n toggle,\n} = usePopover({\n placement: () => props.placement,\n matchTriggerWidth: () => props.panelWidth === \"trigger\",\n closeOnEscape: false,\n onOpen: () => emit(\"open\"),\n onClose: () => {\n searchQuery.value = \"\";\n emit(\"close\");\n },\n});\n\nconst triggerEl = ref<HTMLElement | null>(null);\nconst triggerWrapEl = ref<HTMLElement | null>(null);\nwatch([triggerEl, triggerWrapEl], ([btn, wrap]) => {\n triggerRef.value = (btn as HTMLElement | null) ?? (wrap as HTMLElement | null);\n});\n\nfunction focusTrigger() {\n const el = triggerEl.value ?? triggerWrapEl.value;\n el?.focus?.();\n}\n\nfunction onTriggerClick() {\n if (props.disabled) return;\n toggle();\n}\n\nfunction selectItem(item: SwitcherItem) {\n if (item.disabled || props.disabled) return;\n emit(\"update:modelValue\", item.value);\n emit(\"change\", item.value, item);\n close();\n}\n\nfunction focusableIndices(): number[] {\n return displayedItems.value\n .map((it, i) => (it.disabled ? -1 : i))\n .filter((i) => i !== -1);\n}\n\nconst optionRefs = new Map<number, HTMLElement>();\nfunction setOptionRef(el: HTMLElement | null, idx: number) {\n if (el) optionRefs.set(idx, el);\n else optionRefs.delete(idx);\n}\n\nfunction focusOptionByIdx(idx: number) {\n optionRefs.get(idx)?.focus();\n}\n\nasync function openAndFocusActive() {\n if (props.disabled) return;\n if (!isOpen.value) open();\n await nextTick();\n if (props.searchable) {\n searchInputEl.value?.focus();\n return;\n }\n const order = focusableIndices();\n if (!order.length) return;\n const activeIdx = displayedItems.value.findIndex(\n (it) => it.value === props.modelValue,\n );\n const usable =\n activeIdx >= 0 && !displayedItems.value[activeIdx].disabled\n ? activeIdx\n : order[0];\n focusOptionByIdx(usable);\n}\n\nfunction onTriggerKeydown(e: KeyboardEvent) {\n if ([\"ArrowDown\", \"ArrowUp\", \"Enter\", \" \"].includes(e.key)) {\n e.preventDefault();\n openAndFocusActive();\n } else if (e.key === \"Escape\" && isOpen.value) {\n e.preventDefault();\n close();\n }\n}\n\nfunction currentFocusedIdx(): number {\n const el = document.activeElement as HTMLElement | null;\n if (!el) return -1;\n for (const [idx, node] of optionRefs.entries()) {\n if (node === el) return idx;\n }\n return -1;\n}\n\nfunction moveFocus(delta: 1 | -1) {\n const order = focusableIndices();\n if (!order.length) return;\n const cur = currentFocusedIdx();\n let pos = order.indexOf(cur);\n if (pos === -1) {\n focusOptionByIdx(delta > 0 ? order[0] : order[order.length - 1]);\n return;\n }\n pos = (pos + delta + order.length) % order.length;\n focusOptionByIdx(order[pos]);\n}\n\nfunction onListKeydown(e: KeyboardEvent) {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n moveFocus(1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n moveFocus(-1);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) focusOptionByIdx(order[0]);\n } else if (e.key === \"End\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) focusOptionByIdx(order[order.length - 1]);\n } else if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n const idx = currentFocusedIdx();\n if (idx >= 0) selectItem(displayedItems.value[idx]);\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n close();\n focusTrigger();\n } else if (\n !props.searchable &&\n e.key.length === 1 &&\n /^[a-zA-Z0-9]$/.test(e.key)\n ) {\n const order = focusableIndices();\n const letter = e.key.toLowerCase();\n const match = order.find((i) =>\n displayedItems.value[i].title.toLowerCase().startsWith(letter),\n );\n if (match !== undefined) focusOptionByIdx(match);\n }\n}\n\nwatch(isOpen, (open) => {\n if (!open) focusTrigger();\n});\n\nconst highlightedIdx = ref<number>(-1);\n\nconst activeDescendantId = computed(() =>\n highlightedIdx.value >= 0\n ? `${listboxId}-opt-${highlightedIdx.value}`\n : undefined,\n);\n\nwatch(displayedItems, () => {\n if (!props.searchable) return;\n const order = focusableIndices();\n highlightedIdx.value = order[0] ?? -1;\n});\n\nwatch(isOpen, (open) => {\n if (!open) {\n highlightedIdx.value = -1;\n return;\n }\n if (!props.searchable) return;\n const idx = displayedItems.value.findIndex(\n (it) => it.value === props.modelValue && !it.disabled,\n );\n const order = focusableIndices();\n highlightedIdx.value = idx >= 0 ? idx : order[0] ?? -1;\n});\n\nfunction moveHighlight(delta: 1 | -1) {\n const order = focusableIndices();\n if (!order.length) return;\n const cur = order.indexOf(highlightedIdx.value);\n if (cur === -1) {\n highlightedIdx.value = delta > 0 ? order[0] : order[order.length - 1];\n return;\n }\n const next = (cur + delta + order.length) % order.length;\n highlightedIdx.value = order[next];\n}\n\nfunction onSearchKeydown(e: KeyboardEvent) {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n moveHighlight(1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n moveHighlight(-1);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) highlightedIdx.value = order[0];\n } else if (e.key === \"End\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) highlightedIdx.value = order[order.length - 1];\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n if (highlightedIdx.value >= 0) {\n selectItem(displayedItems.value[highlightedIdx.value]);\n }\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n close();\n focusTrigger();\n }\n}\n\n// Dev-only: warn once per offending item when both icon and avatar are set.\nif (import.meta.env?.DEV ?? true) {\n const warned = new Set<SwitcherValue>();\n watchEffect(() => {\n for (const item of props.items) {\n if (item.icon && item.avatar && !warned.has(item.value)) {\n warned.add(item.value);\n console.warn(\n `[Switcher] item \"${item.value}\" declares both \\`icon\\` and \\`avatar\\`; \\`avatar\\` wins. Pick one.`,\n );\n }\n }\n });\n}\n\ndefineExpose({ open, close, toggle });\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwOA,MAAM,QAAQ;EAed,MAAM,OAAO;EAEb,MAAM,SAAS,eAAe;EAC9B,MAAM,iBAAiB,wBAAwB,MAAM,OAAO;EAC5D,MAAM,YAAY,OAAO;EAEzB,MAAM,sBAAsB,eACpB,MAAM,eAAe,OAAO,MAAM,SAAS,YAClD;EACD,MAAM,oBAAoB,eAClB,MAAM,aAAa,OAAO,MAAM,SAAS,UAChD;EACD,MAAM,oBAAoB,eAClB,MAAM,aAAa,OAAO,MAAM,SAAS,MAChD;EACD,MAAM,4BAA4B,eAC1B,MAAM,qBAAqB,OAAO,MAAM,SAAS,kBACxD;EACD,MAAM,oBAAoB,eAClB,MAAM,iBAAiB,OAAO,MAAM,SAAS,UACpD;EAED,MAAM,cAAc,IAAI,GAAG;EAC3B,MAAM,gBAAgB,IAA6B,KAAK;EAExD,MAAM,iBAAiB,eAA+B;GACpD,IAAI,CAAC,MAAM,YAAY,OAAO,MAAM;GACpC,MAAM,IAAI,YAAY,MAAM,MAAM,CAAC,aAAa;GAChD,IAAI,CAAC,GAAG,OAAO,MAAM;GACrB,MAAM,SAAS,MAAM,gBAAgB,CAAC,SAAS,W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AK,KAAK,OAAO;QACjB,UAAU,KAAK,OAAO;QACtB,MAAM,KAAK;QACZ,MAAK;;;;;eAII,KAAK,QAAA,WAAA,EADlB,mBASO,QAAA;;QAPL,+BAAA;QACC,OAAK,eAAA,CAAA,yFAA6H,YAAA,MAAA,CAAA;yBAKnI,YAAgE,wBAAhD,KAAK,KAAI,EAAA;QAAE,OAAM;QAAU,eAAY;;OAEzD,mBAMO,QANP,aAMO,CALL,mBAAoE,QAApE,aAAoE,gBAApB,KAAK,MAAK,EAAA,EAAA,EAElD,KAAK,YAAA,WAAA,EADb,mBAG2B,QAH3B,aAG2B,gBAAvB,KAAK,SAAQ,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA,CAAA,CAAA;OAEnB,WAWO,KAAA,QAAA,iBAAA;QATE;QACN,QAAQ,KAAK,UAAU,QAAA;QACvB,OAAO,MAAA,MAAK;gBAOR,CAJG,KAAK,UAAU,QAAA,cAAA,WAAA,EADvB,YAIE,MAAA,UAAA,EAAA;;QAFA,OAAM;QACN,eAAY;;;;KAMJA,KAAAA,OAAO,UAAA,WAAA,EAAvB,mBASW,UAAA,EAAA,KAAA,GAAA,EAAA,CAAA,OAAA,OAAA,OAAA,KART,mBAIE,MAAA;MAHA,iCAAA;MACA,MAAK;MACL,OAAM;oBAER,mBAEM,OAFN,aAEM,CADJ,WAAqC,KAAA,QAAA,UAAA,EAAhB,OAAO,MAAA,MAAK,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,GAAA,IAAA,mBAAA,IAAA,KAAA"}
@@ -1,33 +1,57 @@
1
1
  //#region src/composables/eventColors.ts
2
- /**
3
- * Soft variant used in timed grids (WeekView, DayView, Scheduler).
4
- * Translucent fills (`/15`) so the underlying grid lines stay visible —
5
- * matches the look of `colorHex` events that use `rgba(..., 0.12)`.
2
+ /** Translucent fill + text colour, soft variant used in timed grids. */
3
+ var FILL = {
4
+ default: "bg-foreground/10 text-foreground",
5
+ primary: "bg-primary/15 text-primary",
6
+ danger: "bg-destructive/15 text-destructive",
7
+ success: "bg-success/15 text-success",
8
+ warning: "bg-warning/15 text-warning",
9
+ info: "bg-info/15 text-info",
10
+ purple: "bg-purple/15 text-purple",
11
+ pink: "bg-pink/15 text-pink"
12
+ };
13
+ /** Same, a touch more opaque so compact MonthView pills stay readable. */
14
+ var FILL_STRONG = {
15
+ default: "bg-foreground/15 text-foreground",
16
+ primary: "bg-primary/20 text-primary",
17
+ danger: "bg-destructive/20 text-destructive",
18
+ success: "bg-success/20 text-success",
19
+ warning: "bg-warning/20 text-warning",
20
+ info: "bg-info/20 text-info",
21
+ purple: "bg-purple/20 text-purple",
22
+ pink: "bg-pink/20 text-pink"
23
+ };
24
+ /**
25
+ * Left colour rule. Kept separate from the fill because it only works on a
26
+ * squarish event: `border-radius` sweeps a one-sided border around the corner
27
+ * arc, so at a large radius the rule tapers into a crescent instead of reading
28
+ * as a bar — see `EVENT_ACCENT_RADII` in `useCalendarTheme`.
29
+ */
30
+ var ACCENT = {
31
+ default: "border-l-2 border-muted-foreground",
32
+ primary: "border-l-2 border-primary",
33
+ danger: "border-l-2 border-destructive",
34
+ success: "border-l-2 border-success",
35
+ warning: "border-l-2 border-warning",
36
+ info: "border-l-2 border-info",
37
+ purple: "border-l-2 border-purple",
38
+ pink: "border-l-2 border-pink"
39
+ };
40
+ var compose = (fills, c, accent) => {
41
+ const key = c ?? "primary";
42
+ return accent ? `${fills[key]} ${ACCENT[key]}` : fills[key];
43
+ };
44
+ /**
45
+ * Soft variant used in timed grids (WeekView, DayView, Scheduler).
46
+ * Translucent fills (`/15`) so the underlying grid lines stay visible —
47
+ * matches the look of `colorHex` events that use `rgba(..., 0.12)`.
6
48
  */
7
- var eventColorClass = (c) => ({
8
- default: "bg-foreground/10 text-foreground border-l-2 border-muted-foreground",
9
- primary: "bg-primary/15 text-primary border-l-2 border-primary",
10
- danger: "bg-destructive/15 text-destructive border-l-2 border-destructive",
11
- success: "bg-success/15 text-success border-l-2 border-success",
12
- warning: "bg-warning/15 text-warning border-l-2 border-warning",
13
- info: "bg-info/15 text-info border-l-2 border-info",
14
- purple: "bg-purple/15 text-purple border-l-2 border-purple",
15
- pink: "bg-pink/15 text-pink border-l-2 border-pink"
16
- })[c ?? "primary"];
17
- /**
18
- * Stronger variant used in MonthView (pill-like events) — slightly more
19
- * opaque to stay readable in compact pills.
49
+ var eventColorClass = (c, accent = true) => compose(FILL, c, accent);
50
+ /**
51
+ * Stronger variant used in MonthView (pill-like events) — slightly more
52
+ * opaque to stay readable in compact pills.
20
53
  */
21
- var eventColorClassStrong = (c) => ({
22
- default: "bg-foreground/15 text-foreground border-l-2 border-muted-foreground",
23
- primary: "bg-primary/20 text-primary border-l-2 border-primary",
24
- danger: "bg-destructive/20 text-destructive border-l-2 border-destructive",
25
- success: "bg-success/20 text-success border-l-2 border-success",
26
- warning: "bg-warning/20 text-warning border-l-2 border-warning",
27
- info: "bg-info/20 text-info border-l-2 border-info",
28
- purple: "bg-purple/20 text-purple border-l-2 border-purple",
29
- pink: "bg-pink/20 text-pink border-l-2 border-pink"
30
- })[c ?? "primary"];
54
+ var eventColorClassStrong = (c, accent = true) => compose(FILL_STRONG, c, accent);
31
55
  var hexToRgba = (hex, alpha) => {
32
56
  const h = hex.replace("#", "");
33
57
  const full = h.length === 3 ? h.split("").map((c) => c + c).join("") : h;
@@ -1 +1 @@
1
- {"version":3,"file":"eventColors.cjs","names":[],"sources":["../../src/composables/eventColors.ts"],"sourcesContent":["export type EventColor = 'default' | 'primary' | 'danger' | 'success' | 'warning' | 'info' | 'purple' | 'pink'; \n \n/** \n * Soft variant used in timed grids (WeekView, DayView, Scheduler). \n * Translucent fills (`/15`) so the underlying grid lines stay visible — \n * matches the look of `colorHex` events that use `rgba(..., 0.12)`. \n */ \nexport const eventColorClass = (c?: EventColor | null) => ({ \n default: 'bg-foreground/10 text-foreground border-l-2 border-muted-foreground', \n primary: 'bg-primary/15 text-primary border-l-2 border-primary', \n danger: 'bg-destructive/15 text-destructive border-l-2 border-destructive', \n success: 'bg-success/15 text-success border-l-2 border-success', \n warning: 'bg-warning/15 text-warning border-l-2 border-warning', \n info: 'bg-info/15 text-info border-l-2 border-info', \n purple: 'bg-purple/15 text-purple border-l-2 border-purple', \n pink: 'bg-pink/15 text-pink border-l-2 border-pink', \n}[c ?? 'primary']); \n \n/** \n * Stronger variant used in MonthView (pill-like events) — slightly more \n * opaque to stay readable in compact pills. \n */ \nexport const eventColorClassStrong = (c?: EventColor | null) => ({ \n default: 'bg-foreground/15 text-foreground border-l-2 border-muted-foreground', \n primary: 'bg-primary/20 text-primary border-l-2 border-primary', \n danger: 'bg-destructive/20 text-destructive border-l-2 border-destructive', \n success: 'bg-success/20 text-success border-l-2 border-success', \n warning: 'bg-warning/20 text-warning border-l-2 border-warning', \n info: 'bg-info/20 text-info border-l-2 border-info', \n purple: 'bg-purple/20 text-purple border-l-2 border-purple', \n pink: 'bg-pink/20 text-pink border-l-2 border-pink', \n}[c ?? 'primary']); \n \nexport const hexToRgba = (hex: string, alpha: number) => { \n const h = hex.replace('#', ''); \n const full = h.length === 3 ? h.split('').map(c => c + c).join('') : h; \n const r = parseInt(full.slice(0, 2), 16); \n const g = parseInt(full.slice(2, 4), 16); \n const b = parseInt(full.slice(4, 6), 16); \n return `rgba(${r}, ${g}, ${b}, ${alpha})`; \n};\n"],"mappings":";;;;;;AAOA,IAAa,mBAAmB,OAA2B;CACvD,SAAS;CACT,SAAS;CACT,QAAQ;CACR,SAAS;CACT,SAAS;CACT,MAAM;CACN,QAAQ;CACR,MAAM;CACT,EAAC,KAAK;;;;;AAMP,IAAa,yBAAyB,OAA2B;CAC7D,SAAS;CACT,SAAS;CACT,QAAQ;CACR,SAAS;CACT,SAAS;CACT,MAAM;CACN,QAAQ;CACR,MAAM;CACT,EAAC,KAAK;AAEP,IAAa,aAAa,KAAa,UAAkB;CACrD,MAAM,IAAI,IAAI,QAAQ,KAAK,GAAG;CAC9B,MAAM,OAAO,EAAE,WAAW,IAAI,EAAE,MAAM,GAAG,CAAC,KAAI,MAAK,IAAI,EAAE,CAAC,KAAK,GAAG,GAAG;CAIrE,OAAO,QAHG,SAAS,KAAK,MAAM,GAAG,EAAE,EAAE,GAGtB,CAAE,IAFP,SAAS,KAAK,MAAM,GAAG,EAAE,EAAE,GAEhB,CAAE,IADb,SAAS,KAAK,MAAM,GAAG,EAAE,EAAE,GACV,CAAE,IAAI,MAAM"}
1
+ {"version":3,"file":"eventColors.cjs","names":[],"sources":["../../src/composables/eventColors.ts"],"sourcesContent":["export type EventColor = 'default' | 'primary' | 'danger' | 'success' | 'warning' | 'info' | 'purple' | 'pink';\n\n/** Translucent fill + text colour, soft variant used in timed grids. */\nconst FILL: Record<EventColor, string> = {\n default: 'bg-foreground/10 text-foreground',\n primary: 'bg-primary/15 text-primary',\n danger: 'bg-destructive/15 text-destructive',\n success: 'bg-success/15 text-success',\n warning: 'bg-warning/15 text-warning',\n info: 'bg-info/15 text-info',\n purple: 'bg-purple/15 text-purple',\n pink: 'bg-pink/15 text-pink',\n};\n\n/** Same, a touch more opaque so compact MonthView pills stay readable. */\nconst FILL_STRONG: Record<EventColor, string> = {\n default: 'bg-foreground/15 text-foreground',\n primary: 'bg-primary/20 text-primary',\n danger: 'bg-destructive/20 text-destructive',\n success: 'bg-success/20 text-success',\n warning: 'bg-warning/20 text-warning',\n info: 'bg-info/20 text-info',\n purple: 'bg-purple/20 text-purple',\n pink: 'bg-pink/20 text-pink',\n};\n\n/**\n * Left colour rule. Kept separate from the fill because it only works on a\n * squarish event: `border-radius` sweeps a one-sided border around the corner\n * arc, so at a large radius the rule tapers into a crescent instead of reading\n * as a bar — see `EVENT_ACCENT_RADII` in `useCalendarTheme`.\n */\nconst ACCENT: Record<EventColor, string> = {\n default: 'border-l-2 border-muted-foreground',\n primary: 'border-l-2 border-primary',\n danger: 'border-l-2 border-destructive',\n success: 'border-l-2 border-success',\n warning: 'border-l-2 border-warning',\n info: 'border-l-2 border-info',\n purple: 'border-l-2 border-purple',\n pink: 'border-l-2 border-pink',\n};\n\nconst compose = (\n fills: Record<EventColor, string>,\n c: EventColor | null | undefined,\n accent: boolean,\n) => {\n const key = c ?? 'primary';\n return accent ? `${fills[key]} ${ACCENT[key]}` : fills[key];\n};\n\n/**\n * Soft variant used in timed grids (WeekView, DayView, Scheduler).\n * Translucent fills (`/15`) so the underlying grid lines stay visible —\n * matches the look of `colorHex` events that use `rgba(..., 0.12)`.\n */\nexport const eventColorClass = (c?: EventColor | null, accent = true) =>\n compose(FILL, c, accent);\n\n/**\n * Stronger variant used in MonthView (pill-like events) — slightly more\n * opaque to stay readable in compact pills.\n */\nexport const eventColorClassStrong = (c?: EventColor | null, accent = true) =>\n compose(FILL_STRONG, c, accent);\n\nexport const hexToRgba = (hex: string, alpha: number) => {\n const h = hex.replace('#', '');\n const full = h.length === 3 ? h.split('').map(c => c + c).join('') : h;\n const r = parseInt(full.slice(0, 2), 16);\n const g = parseInt(full.slice(2, 4), 16);\n const b = parseInt(full.slice(4, 6), 16);\n return `rgba(${r}, ${g}, ${b}, ${alpha})`;\n};\n"],"mappings":";;AAGA,IAAM,OAAmC;CACrC,SAAS;CACT,SAAS;CACT,QAAQ;CACR,SAAS;CACT,SAAS;CACT,MAAM;CACN,QAAQ;CACR,MAAM;CACT;;AAGD,IAAM,cAA0C;CAC5C,SAAS;CACT,SAAS;CACT,QAAQ;CACR,SAAS;CACT,SAAS;CACT,MAAM;CACN,QAAQ;CACR,MAAM;CACT;;;;;;;AAQD,IAAM,SAAqC;CACvC,SAAS;CACT,SAAS;CACT,QAAQ;CACR,SAAS;CACT,SAAS;CACT,MAAM;CACN,QAAQ;CACR,MAAM;CACT;AAED,IAAM,WACF,OACA,GACA,WACC;CACD,MAAM,MAAM,KAAK;CACjB,OAAO,SAAS,GAAG,MAAM,KAAK,GAAG,OAAO,SAAS,MAAM;;;;;;;AAQ3D,IAAa,mBAAmB,GAAuB,SAAS,SAC5D,QAAQ,MAAM,GAAG,OAAO;;;;;AAM5B,IAAa,yBAAyB,GAAuB,SAAS,SAClE,QAAQ,aAAa,GAAG,OAAO;AAEnC,IAAa,aAAa,KAAa,UAAkB;CACrD,MAAM,IAAI,IAAI,QAAQ,KAAK,GAAG;CAC9B,MAAM,OAAO,EAAE,WAAW,IAAI,EAAE,MAAM,GAAG,CAAC,KAAI,MAAK,IAAI,EAAE,CAAC,KAAK,GAAG,GAAG;CAIrE,OAAO,QAHG,SAAS,KAAK,MAAM,GAAG,EAAE,EAAE,GAGtB,CAAE,IAFP,SAAS,KAAK,MAAM,GAAG,EAAE,EAAE,GAEhB,CAAE,IADb,SAAS,KAAK,MAAM,GAAG,EAAE,EAAE,GACV,CAAE,IAAI,MAAM"}
@@ -1,33 +1,57 @@
1
1
  //#region src/composables/eventColors.ts
2
- /**
3
- * Soft variant used in timed grids (WeekView, DayView, Scheduler).
4
- * Translucent fills (`/15`) so the underlying grid lines stay visible —
5
- * matches the look of `colorHex` events that use `rgba(..., 0.12)`.
2
+ /** Translucent fill + text colour, soft variant used in timed grids. */
3
+ var FILL = {
4
+ default: "bg-foreground/10 text-foreground",
5
+ primary: "bg-primary/15 text-primary",
6
+ danger: "bg-destructive/15 text-destructive",
7
+ success: "bg-success/15 text-success",
8
+ warning: "bg-warning/15 text-warning",
9
+ info: "bg-info/15 text-info",
10
+ purple: "bg-purple/15 text-purple",
11
+ pink: "bg-pink/15 text-pink"
12
+ };
13
+ /** Same, a touch more opaque so compact MonthView pills stay readable. */
14
+ var FILL_STRONG = {
15
+ default: "bg-foreground/15 text-foreground",
16
+ primary: "bg-primary/20 text-primary",
17
+ danger: "bg-destructive/20 text-destructive",
18
+ success: "bg-success/20 text-success",
19
+ warning: "bg-warning/20 text-warning",
20
+ info: "bg-info/20 text-info",
21
+ purple: "bg-purple/20 text-purple",
22
+ pink: "bg-pink/20 text-pink"
23
+ };
24
+ /**
25
+ * Left colour rule. Kept separate from the fill because it only works on a
26
+ * squarish event: `border-radius` sweeps a one-sided border around the corner
27
+ * arc, so at a large radius the rule tapers into a crescent instead of reading
28
+ * as a bar — see `EVENT_ACCENT_RADII` in `useCalendarTheme`.
29
+ */
30
+ var ACCENT = {
31
+ default: "border-l-2 border-muted-foreground",
32
+ primary: "border-l-2 border-primary",
33
+ danger: "border-l-2 border-destructive",
34
+ success: "border-l-2 border-success",
35
+ warning: "border-l-2 border-warning",
36
+ info: "border-l-2 border-info",
37
+ purple: "border-l-2 border-purple",
38
+ pink: "border-l-2 border-pink"
39
+ };
40
+ var compose = (fills, c, accent) => {
41
+ const key = c ?? "primary";
42
+ return accent ? `${fills[key]} ${ACCENT[key]}` : fills[key];
43
+ };
44
+ /**
45
+ * Soft variant used in timed grids (WeekView, DayView, Scheduler).
46
+ * Translucent fills (`/15`) so the underlying grid lines stay visible —
47
+ * matches the look of `colorHex` events that use `rgba(..., 0.12)`.
6
48
  */
7
- var eventColorClass = (c) => ({
8
- default: "bg-foreground/10 text-foreground border-l-2 border-muted-foreground",
9
- primary: "bg-primary/15 text-primary border-l-2 border-primary",
10
- danger: "bg-destructive/15 text-destructive border-l-2 border-destructive",
11
- success: "bg-success/15 text-success border-l-2 border-success",
12
- warning: "bg-warning/15 text-warning border-l-2 border-warning",
13
- info: "bg-info/15 text-info border-l-2 border-info",
14
- purple: "bg-purple/15 text-purple border-l-2 border-purple",
15
- pink: "bg-pink/15 text-pink border-l-2 border-pink"
16
- })[c ?? "primary"];
17
- /**
18
- * Stronger variant used in MonthView (pill-like events) — slightly more
19
- * opaque to stay readable in compact pills.
49
+ var eventColorClass = (c, accent = true) => compose(FILL, c, accent);
50
+ /**
51
+ * Stronger variant used in MonthView (pill-like events) — slightly more
52
+ * opaque to stay readable in compact pills.
20
53
  */
21
- var eventColorClassStrong = (c) => ({
22
- default: "bg-foreground/15 text-foreground border-l-2 border-muted-foreground",
23
- primary: "bg-primary/20 text-primary border-l-2 border-primary",
24
- danger: "bg-destructive/20 text-destructive border-l-2 border-destructive",
25
- success: "bg-success/20 text-success border-l-2 border-success",
26
- warning: "bg-warning/20 text-warning border-l-2 border-warning",
27
- info: "bg-info/20 text-info border-l-2 border-info",
28
- purple: "bg-purple/20 text-purple border-l-2 border-purple",
29
- pink: "bg-pink/20 text-pink border-l-2 border-pink"
30
- })[c ?? "primary"];
54
+ var eventColorClassStrong = (c, accent = true) => compose(FILL_STRONG, c, accent);
31
55
  var hexToRgba = (hex, alpha) => {
32
56
  const h = hex.replace("#", "");
33
57
  const full = h.length === 3 ? h.split("").map((c) => c + c).join("") : h;
@@ -1 +1 @@
1
- {"version":3,"file":"eventColors.mjs","names":[],"sources":["../../src/composables/eventColors.ts"],"sourcesContent":["export type EventColor = 'default' | 'primary' | 'danger' | 'success' | 'warning' | 'info' | 'purple' | 'pink'; \n \n/** \n * Soft variant used in timed grids (WeekView, DayView, Scheduler). \n * Translucent fills (`/15`) so the underlying grid lines stay visible — \n * matches the look of `colorHex` events that use `rgba(..., 0.12)`. \n */ \nexport const eventColorClass = (c?: EventColor | null) => ({ \n default: 'bg-foreground/10 text-foreground border-l-2 border-muted-foreground', \n primary: 'bg-primary/15 text-primary border-l-2 border-primary', \n danger: 'bg-destructive/15 text-destructive border-l-2 border-destructive', \n success: 'bg-success/15 text-success border-l-2 border-success', \n warning: 'bg-warning/15 text-warning border-l-2 border-warning', \n info: 'bg-info/15 text-info border-l-2 border-info', \n purple: 'bg-purple/15 text-purple border-l-2 border-purple', \n pink: 'bg-pink/15 text-pink border-l-2 border-pink', \n}[c ?? 'primary']); \n \n/** \n * Stronger variant used in MonthView (pill-like events) — slightly more \n * opaque to stay readable in compact pills. \n */ \nexport const eventColorClassStrong = (c?: EventColor | null) => ({ \n default: 'bg-foreground/15 text-foreground border-l-2 border-muted-foreground', \n primary: 'bg-primary/20 text-primary border-l-2 border-primary', \n danger: 'bg-destructive/20 text-destructive border-l-2 border-destructive', \n success: 'bg-success/20 text-success border-l-2 border-success', \n warning: 'bg-warning/20 text-warning border-l-2 border-warning', \n info: 'bg-info/20 text-info border-l-2 border-info', \n purple: 'bg-purple/20 text-purple border-l-2 border-purple', \n pink: 'bg-pink/20 text-pink border-l-2 border-pink', \n}[c ?? 'primary']); \n \nexport const hexToRgba = (hex: string, alpha: number) => { \n const h = hex.replace('#', ''); \n const full = h.length === 3 ? h.split('').map(c => c + c).join('') : h; \n const r = parseInt(full.slice(0, 2), 16); \n const g = parseInt(full.slice(2, 4), 16); \n const b = parseInt(full.slice(4, 6), 16); \n return `rgba(${r}, ${g}, ${b}, ${alpha})`; \n};\n"],"mappings":";;;;;;AAOA,IAAa,mBAAmB,OAA2B;CACvD,SAAS;CACT,SAAS;CACT,QAAQ;CACR,SAAS;CACT,SAAS;CACT,MAAM;CACN,QAAQ;CACR,MAAM;CACT,EAAC,KAAK;;;;;AAMP,IAAa,yBAAyB,OAA2B;CAC7D,SAAS;CACT,SAAS;CACT,QAAQ;CACR,SAAS;CACT,SAAS;CACT,MAAM;CACN,QAAQ;CACR,MAAM;CACT,EAAC,KAAK;AAEP,IAAa,aAAa,KAAa,UAAkB;CACrD,MAAM,IAAI,IAAI,QAAQ,KAAK,GAAG;CAC9B,MAAM,OAAO,EAAE,WAAW,IAAI,EAAE,MAAM,GAAG,CAAC,KAAI,MAAK,IAAI,EAAE,CAAC,KAAK,GAAG,GAAG;CAIrE,OAAO,QAHG,SAAS,KAAK,MAAM,GAAG,EAAE,EAAE,GAGtB,CAAE,IAFP,SAAS,KAAK,MAAM,GAAG,EAAE,EAAE,GAEhB,CAAE,IADb,SAAS,KAAK,MAAM,GAAG,EAAE,EAAE,GACV,CAAE,IAAI,MAAM"}
1
+ {"version":3,"file":"eventColors.mjs","names":[],"sources":["../../src/composables/eventColors.ts"],"sourcesContent":["export type EventColor = 'default' | 'primary' | 'danger' | 'success' | 'warning' | 'info' | 'purple' | 'pink';\n\n/** Translucent fill + text colour, soft variant used in timed grids. */\nconst FILL: Record<EventColor, string> = {\n default: 'bg-foreground/10 text-foreground',\n primary: 'bg-primary/15 text-primary',\n danger: 'bg-destructive/15 text-destructive',\n success: 'bg-success/15 text-success',\n warning: 'bg-warning/15 text-warning',\n info: 'bg-info/15 text-info',\n purple: 'bg-purple/15 text-purple',\n pink: 'bg-pink/15 text-pink',\n};\n\n/** Same, a touch more opaque so compact MonthView pills stay readable. */\nconst FILL_STRONG: Record<EventColor, string> = {\n default: 'bg-foreground/15 text-foreground',\n primary: 'bg-primary/20 text-primary',\n danger: 'bg-destructive/20 text-destructive',\n success: 'bg-success/20 text-success',\n warning: 'bg-warning/20 text-warning',\n info: 'bg-info/20 text-info',\n purple: 'bg-purple/20 text-purple',\n pink: 'bg-pink/20 text-pink',\n};\n\n/**\n * Left colour rule. Kept separate from the fill because it only works on a\n * squarish event: `border-radius` sweeps a one-sided border around the corner\n * arc, so at a large radius the rule tapers into a crescent instead of reading\n * as a bar — see `EVENT_ACCENT_RADII` in `useCalendarTheme`.\n */\nconst ACCENT: Record<EventColor, string> = {\n default: 'border-l-2 border-muted-foreground',\n primary: 'border-l-2 border-primary',\n danger: 'border-l-2 border-destructive',\n success: 'border-l-2 border-success',\n warning: 'border-l-2 border-warning',\n info: 'border-l-2 border-info',\n purple: 'border-l-2 border-purple',\n pink: 'border-l-2 border-pink',\n};\n\nconst compose = (\n fills: Record<EventColor, string>,\n c: EventColor | null | undefined,\n accent: boolean,\n) => {\n const key = c ?? 'primary';\n return accent ? `${fills[key]} ${ACCENT[key]}` : fills[key];\n};\n\n/**\n * Soft variant used in timed grids (WeekView, DayView, Scheduler).\n * Translucent fills (`/15`) so the underlying grid lines stay visible —\n * matches the look of `colorHex` events that use `rgba(..., 0.12)`.\n */\nexport const eventColorClass = (c?: EventColor | null, accent = true) =>\n compose(FILL, c, accent);\n\n/**\n * Stronger variant used in MonthView (pill-like events) — slightly more\n * opaque to stay readable in compact pills.\n */\nexport const eventColorClassStrong = (c?: EventColor | null, accent = true) =>\n compose(FILL_STRONG, c, accent);\n\nexport const hexToRgba = (hex: string, alpha: number) => {\n const h = hex.replace('#', '');\n const full = h.length === 3 ? h.split('').map(c => c + c).join('') : h;\n const r = parseInt(full.slice(0, 2), 16);\n const g = parseInt(full.slice(2, 4), 16);\n const b = parseInt(full.slice(4, 6), 16);\n return `rgba(${r}, ${g}, ${b}, ${alpha})`;\n};\n"],"mappings":";;AAGA,IAAM,OAAmC;CACrC,SAAS;CACT,SAAS;CACT,QAAQ;CACR,SAAS;CACT,SAAS;CACT,MAAM;CACN,QAAQ;CACR,MAAM;CACT;;AAGD,IAAM,cAA0C;CAC5C,SAAS;CACT,SAAS;CACT,QAAQ;CACR,SAAS;CACT,SAAS;CACT,MAAM;CACN,QAAQ;CACR,MAAM;CACT;;;;;;;AAQD,IAAM,SAAqC;CACvC,SAAS;CACT,SAAS;CACT,QAAQ;CACR,SAAS;CACT,SAAS;CACT,MAAM;CACN,QAAQ;CACR,MAAM;CACT;AAED,IAAM,WACF,OACA,GACA,WACC;CACD,MAAM,MAAM,KAAK;CACjB,OAAO,SAAS,GAAG,MAAM,KAAK,GAAG,OAAO,SAAS,MAAM;;;;;;;AAQ3D,IAAa,mBAAmB,GAAuB,SAAS,SAC5D,QAAQ,MAAM,GAAG,OAAO;;;;;AAM5B,IAAa,yBAAyB,GAAuB,SAAS,SAClE,QAAQ,aAAa,GAAG,OAAO;AAEnC,IAAa,aAAa,KAAa,UAAkB;CACrD,MAAM,IAAI,IAAI,QAAQ,KAAK,GAAG;CAC9B,MAAM,OAAO,EAAE,WAAW,IAAI,EAAE,MAAM,GAAG,CAAC,KAAI,MAAK,IAAI,EAAE,CAAC,KAAK,GAAG,GAAG;CAIrE,OAAO,QAHG,SAAS,KAAK,MAAM,GAAG,EAAE,EAAE,GAGtB,CAAE,IAFP,SAAS,KAAK,MAAM,GAAG,EAAE,EAAE,GAEhB,CAAE,IADb,SAAS,KAAK,MAAM,GAAG,EAAE,EAAE,GACV,CAAE,IAAI,MAAM"}
@@ -0,0 +1,44 @@
1
+ //#region src/composables/useBodyScrollLock.ts
2
+ /**
3
+ * Reference-counted `<body>` scroll lock, shared by every overlay that needs
4
+ * one (Modal, Drawer, …).
5
+ *
6
+ * Each overlay used to save and restore `body.style.overflow` on its own. That
7
+ * breaks as soon as two overlays are open at once: the second one saves the
8
+ * *locked* value (`'hidden'`) as the thing to restore, so whichever releases
9
+ * last writes `overflow: hidden` back onto <body> and the page can never
10
+ * scroll again. Counting holders here means the original values are captured
11
+ * once, by the first lock, and restored once, by the last release.
12
+ *
13
+ * Callers must pair every `lockBodyScroll()` with exactly one
14
+ * `unlockBodyScroll()` — components track that with an instance-level flag so
15
+ * a double release cannot drop the count below zero.
16
+ */
17
+ var holders = 0;
18
+ var previousOverflow = "";
19
+ var previousPaddingRight = "";
20
+ function lockBodyScroll() {
21
+ if (typeof document === "undefined") return;
22
+ if (holders === 0) {
23
+ const scrollBarWidth = window.innerWidth - document.documentElement.clientWidth;
24
+ previousOverflow = document.body.style.overflow;
25
+ previousPaddingRight = document.body.style.paddingRight;
26
+ document.body.style.overflow = "hidden";
27
+ if (scrollBarWidth > 0) document.body.style.paddingRight = `${scrollBarWidth}px`;
28
+ }
29
+ holders += 1;
30
+ }
31
+ function unlockBodyScroll() {
32
+ if (typeof document === "undefined" || holders === 0) return;
33
+ holders -= 1;
34
+ if (holders > 0) return;
35
+ document.body.style.overflow = previousOverflow;
36
+ document.body.style.paddingRight = previousPaddingRight;
37
+ previousOverflow = "";
38
+ previousPaddingRight = "";
39
+ }
40
+ //#endregion
41
+ exports.lockBodyScroll = lockBodyScroll;
42
+ exports.unlockBodyScroll = unlockBodyScroll;
43
+
44
+ //# sourceMappingURL=useBodyScrollLock.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBodyScrollLock.cjs","names":[],"sources":["../../src/composables/useBodyScrollLock.ts"],"sourcesContent":["/**\n * Reference-counted `<body>` scroll lock, shared by every overlay that needs\n * one (Modal, Drawer, …).\n *\n * Each overlay used to save and restore `body.style.overflow` on its own. That\n * breaks as soon as two overlays are open at once: the second one saves the\n * *locked* value (`'hidden'`) as the thing to restore, so whichever releases\n * last writes `overflow: hidden` back onto <body> and the page can never\n * scroll again. Counting holders here means the original values are captured\n * once, by the first lock, and restored once, by the last release.\n *\n * Callers must pair every `lockBodyScroll()` with exactly one\n * `unlockBodyScroll()` — components track that with an instance-level flag so\n * a double release cannot drop the count below zero.\n */\n\nlet holders = 0;\nlet previousOverflow = '';\nlet previousPaddingRight = '';\n\nexport function lockBodyScroll(): void {\n if (typeof document === 'undefined') return;\n\n if (holders === 0) {\n // Compensate for the scrollbar the lock is about to remove, so the\n // page underneath doesn't shift sideways.\n const scrollBarWidth = window.innerWidth - document.documentElement.clientWidth;\n previousOverflow = document.body.style.overflow;\n previousPaddingRight = document.body.style.paddingRight;\n document.body.style.overflow = 'hidden';\n if (scrollBarWidth > 0) {\n document.body.style.paddingRight = `${scrollBarWidth}px`;\n }\n }\n\n holders += 1;\n}\n\nexport function unlockBodyScroll(): void {\n if (typeof document === 'undefined' || holders === 0) return;\n\n holders -= 1;\n if (holders > 0) return;\n\n document.body.style.overflow = previousOverflow;\n document.body.style.paddingRight = previousPaddingRight;\n previousOverflow = '';\n previousPaddingRight = '';\n}\n\n/** Test-only escape hatch so specs can start from a known state. */\nexport function __resetBodyScrollLock(): void {\n holders = 0;\n previousOverflow = '';\n previousPaddingRight = '';\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,IAAI,UAAU;AACd,IAAI,mBAAmB;AACvB,IAAI,uBAAuB;AAE3B,SAAgB,iBAAuB;CACnC,IAAI,OAAO,aAAa,aAAa;CAErC,IAAI,YAAY,GAAG;EAGf,MAAM,iBAAiB,OAAO,aAAa,SAAS,gBAAgB;EACpE,mBAAmB,SAAS,KAAK,MAAM;EACvC,uBAAuB,SAAS,KAAK,MAAM;EAC3C,SAAS,KAAK,MAAM,WAAW;EAC/B,IAAI,iBAAiB,GACjB,SAAS,KAAK,MAAM,eAAe,GAAG,eAAe;;CAI7D,WAAW;;AAGf,SAAgB,mBAAyB;CACrC,IAAI,OAAO,aAAa,eAAe,YAAY,GAAG;CAEtD,WAAW;CACX,IAAI,UAAU,GAAG;CAEjB,SAAS,KAAK,MAAM,WAAW;CAC/B,SAAS,KAAK,MAAM,eAAe;CACnC,mBAAmB;CACnB,uBAAuB"}
@@ -0,0 +1,43 @@
1
+ //#region src/composables/useBodyScrollLock.ts
2
+ /**
3
+ * Reference-counted `<body>` scroll lock, shared by every overlay that needs
4
+ * one (Modal, Drawer, …).
5
+ *
6
+ * Each overlay used to save and restore `body.style.overflow` on its own. That
7
+ * breaks as soon as two overlays are open at once: the second one saves the
8
+ * *locked* value (`'hidden'`) as the thing to restore, so whichever releases
9
+ * last writes `overflow: hidden` back onto <body> and the page can never
10
+ * scroll again. Counting holders here means the original values are captured
11
+ * once, by the first lock, and restored once, by the last release.
12
+ *
13
+ * Callers must pair every `lockBodyScroll()` with exactly one
14
+ * `unlockBodyScroll()` — components track that with an instance-level flag so
15
+ * a double release cannot drop the count below zero.
16
+ */
17
+ var holders = 0;
18
+ var previousOverflow = "";
19
+ var previousPaddingRight = "";
20
+ function lockBodyScroll() {
21
+ if (typeof document === "undefined") return;
22
+ if (holders === 0) {
23
+ const scrollBarWidth = window.innerWidth - document.documentElement.clientWidth;
24
+ previousOverflow = document.body.style.overflow;
25
+ previousPaddingRight = document.body.style.paddingRight;
26
+ document.body.style.overflow = "hidden";
27
+ if (scrollBarWidth > 0) document.body.style.paddingRight = `${scrollBarWidth}px`;
28
+ }
29
+ holders += 1;
30
+ }
31
+ function unlockBodyScroll() {
32
+ if (typeof document === "undefined" || holders === 0) return;
33
+ holders -= 1;
34
+ if (holders > 0) return;
35
+ document.body.style.overflow = previousOverflow;
36
+ document.body.style.paddingRight = previousPaddingRight;
37
+ previousOverflow = "";
38
+ previousPaddingRight = "";
39
+ }
40
+ //#endregion
41
+ export { lockBodyScroll, unlockBodyScroll };
42
+
43
+ //# sourceMappingURL=useBodyScrollLock.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBodyScrollLock.mjs","names":[],"sources":["../../src/composables/useBodyScrollLock.ts"],"sourcesContent":["/**\n * Reference-counted `<body>` scroll lock, shared by every overlay that needs\n * one (Modal, Drawer, …).\n *\n * Each overlay used to save and restore `body.style.overflow` on its own. That\n * breaks as soon as two overlays are open at once: the second one saves the\n * *locked* value (`'hidden'`) as the thing to restore, so whichever releases\n * last writes `overflow: hidden` back onto <body> and the page can never\n * scroll again. Counting holders here means the original values are captured\n * once, by the first lock, and restored once, by the last release.\n *\n * Callers must pair every `lockBodyScroll()` with exactly one\n * `unlockBodyScroll()` — components track that with an instance-level flag so\n * a double release cannot drop the count below zero.\n */\n\nlet holders = 0;\nlet previousOverflow = '';\nlet previousPaddingRight = '';\n\nexport function lockBodyScroll(): void {\n if (typeof document === 'undefined') return;\n\n if (holders === 0) {\n // Compensate for the scrollbar the lock is about to remove, so the\n // page underneath doesn't shift sideways.\n const scrollBarWidth = window.innerWidth - document.documentElement.clientWidth;\n previousOverflow = document.body.style.overflow;\n previousPaddingRight = document.body.style.paddingRight;\n document.body.style.overflow = 'hidden';\n if (scrollBarWidth > 0) {\n document.body.style.paddingRight = `${scrollBarWidth}px`;\n }\n }\n\n holders += 1;\n}\n\nexport function unlockBodyScroll(): void {\n if (typeof document === 'undefined' || holders === 0) return;\n\n holders -= 1;\n if (holders > 0) return;\n\n document.body.style.overflow = previousOverflow;\n document.body.style.paddingRight = previousPaddingRight;\n previousOverflow = '';\n previousPaddingRight = '';\n}\n\n/** Test-only escape hatch so specs can start from a known state. */\nexport function __resetBodyScrollLock(): void {\n holders = 0;\n previousOverflow = '';\n previousPaddingRight = '';\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,IAAI,UAAU;AACd,IAAI,mBAAmB;AACvB,IAAI,uBAAuB;AAE3B,SAAgB,iBAAuB;CACnC,IAAI,OAAO,aAAa,aAAa;CAErC,IAAI,YAAY,GAAG;EAGf,MAAM,iBAAiB,OAAO,aAAa,SAAS,gBAAgB;EACpE,mBAAmB,SAAS,KAAK,MAAM;EACvC,uBAAuB,SAAS,KAAK,MAAM;EAC3C,SAAS,KAAK,MAAM,WAAW;EAC/B,IAAI,iBAAiB,GACjB,SAAS,KAAK,MAAM,eAAe,GAAG,eAAe;;CAI7D,WAAW;;AAGf,SAAgB,mBAAyB;CACrC,IAAI,OAAO,aAAa,eAAe,YAAY,GAAG;CAEtD,WAAW;CACX,IAAI,UAAU,GAAG;CAEjB,SAAS,KAAK,MAAM,WAAW;CAC/B,SAAS,KAAK,MAAM,eAAe;CACnC,mBAAmB;CACnB,uBAAuB"}
@@ -58,6 +58,18 @@ var PILL = {
58
58
  large: "rounded-full",
59
59
  full: "rounded-full"
60
60
  };
61
+ /**
62
+ * Radii at which an event still has enough straight left edge to carry the
63
+ * colour rule. Past these, `border-radius` sweeps the one-sided border around
64
+ * the corner arc and it renders as a crescent hugging the side of the event
65
+ * instead of a bar; the translucent fill and the text colour carry the event
66
+ * colour on their own there.
67
+ */
68
+ var EVENT_ACCENT_RADII = [
69
+ "none",
70
+ "small",
71
+ "medium"
72
+ ];
61
73
  var DAY_NAME_CASE = {
62
74
  upper: "uppercase",
63
75
  lower: "lowercase",
@@ -74,15 +86,24 @@ function useCalendarTheme(input) {
74
86
  const resolvedRadius = (0, vue.computed)(() => {
75
87
  return input.radius() ?? cfg?.value.radius ?? "medium";
76
88
  });
89
+ const todayTextClass = (0, vue.computed)(() => TEXT[resolvedColor.value] ?? TEXT.default);
90
+ const todayBgClass = (0, vue.computed)(() => BG[resolvedColor.value] ?? BG.default);
91
+ const rangeSelectClass = (0, vue.computed)(() => RANGE[resolvedColor.value] ?? RANGE.default);
92
+ const focusRingColorClass = (0, vue.computed)(() => RING[resolvedColor.value] ?? RING.default);
93
+ const highlightDotClass = (0, vue.computed)(() => DOT[resolvedColor.value] ?? DOT.default);
94
+ const containerRadiusClass = (0, vue.computed)(() => CONTAINER[resolvedRadius.value] ?? CONTAINER.large);
95
+ const eventRadiusClass = (0, vue.computed)(() => EVENT[resolvedRadius.value] ?? EVENT.small);
96
+ const pillRadiusClass = (0, vue.computed)(() => PILL[resolvedRadius.value] ?? PILL.full);
77
97
  return {
78
- todayTextClass: (0, vue.computed)(() => TEXT[resolvedColor.value] ?? TEXT.default),
79
- todayBgClass: (0, vue.computed)(() => BG[resolvedColor.value] ?? BG.default),
80
- rangeSelectClass: (0, vue.computed)(() => RANGE[resolvedColor.value] ?? RANGE.default),
81
- focusRingColorClass: (0, vue.computed)(() => RING[resolvedColor.value] ?? RING.default),
82
- highlightDotClass: (0, vue.computed)(() => DOT[resolvedColor.value] ?? DOT.default),
83
- containerRadiusClass: (0, vue.computed)(() => CONTAINER[resolvedRadius.value] ?? CONTAINER.large),
84
- eventRadiusClass: (0, vue.computed)(() => EVENT[resolvedRadius.value] ?? EVENT.small),
85
- pillRadiusClass: (0, vue.computed)(() => PILL[resolvedRadius.value] ?? PILL.full),
98
+ todayTextClass,
99
+ todayBgClass,
100
+ rangeSelectClass,
101
+ focusRingColorClass,
102
+ highlightDotClass,
103
+ containerRadiusClass,
104
+ eventRadiusClass,
105
+ showEventAccent: (0, vue.computed)(() => EVENT_ACCENT_RADII.includes(resolvedRadius.value)),
106
+ pillRadiusClass,
86
107
  dayNameCaseClass: (0, vue.computed)(() => DAY_NAME_CASE[input.dayNameCase?.() ?? "upper"] ?? DAY_NAME_CASE.upper),
87
108
  resolvedColor
88
109
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useCalendarTheme.cjs","names":[],"sources":["../../src/composables/useCalendarTheme.ts"],"sourcesContent":["import { computed, type ComputedRef } from 'vue'; \nimport { useModoConfig } from './useModoConfig'; \n \nexport type CalendarColor = 'default' | 'primary' | 'danger' | 'success' | 'warning'; \nexport type CalendarRadius = 'none' | 'small' | 'medium' | 'large' | 'full'; \nexport type DayNameCase = 'upper' | 'lower' | 'capitalize' | 'normal'; \n \nexport interface CalendarThemeInput { \n color: () => CalendarColor | undefined; \n radius: () => CalendarRadius | undefined; \n dayNameCase?: () => DayNameCase; \n} \n \nexport interface CalendarTheme { \n todayTextClass: ComputedRef<string>; \n todayBgClass: ComputedRef<string>; \n rangeSelectClass: ComputedRef<string>; \n focusRingColorClass: ComputedRef<string>; \n highlightDotClass: ComputedRef<string>; \n containerRadiusClass: ComputedRef<string>; \n eventRadiusClass: ComputedRef<string>; \n pillRadiusClass: ComputedRef<string>; \n dayNameCaseClass: ComputedRef<string>; \n resolvedColor: ComputedRef<CalendarColor>; \n} \n \nconst TEXT: Record<CalendarColor, string> = { \n default: 'text-foreground', \n primary: 'text-primary', \n danger: 'text-destructive', \n success: 'text-success', \n warning: 'text-warning', \n}; \n \nconst BG: Record<CalendarColor, string> = { \n default: 'bg-foreground text-background', \n primary: 'bg-primary text-primary-foreground', \n danger: 'bg-destructive text-destructive-foreground', \n success: 'bg-success text-success-foreground', \n warning: 'bg-warning text-warning-foreground', \n}; \n \nconst RANGE: Record<CalendarColor, string> = { \n default: 'border-foreground/40 bg-foreground/10', \n primary: 'border-primary/50 bg-primary/10', \n danger: 'border-destructive/50 bg-destructive/10', \n success: 'border-success/50 bg-success/10', \n warning: 'border-warning/50 bg-warning/10', \n}; \n \nconst RING: Record<CalendarColor, string> = { \n default: 'ring-ring', \n primary: 'ring-primary', \n danger: 'ring-destructive', \n success: 'ring-success', \n warning: 'ring-warning', \n}; \n \nconst DOT: Record<CalendarColor, string> = { \n default: 'bg-muted-foreground', \n primary: 'bg-primary', \n danger: 'bg-destructive', \n success: 'bg-success', \n warning: 'bg-warning', \n}; \n \nconst CONTAINER: Record<CalendarRadius, string> = { \n none: 'rounded-none', \n small: 'rounded', \n medium: 'rounded-md', \n large: 'rounded-xl', \n full: 'rounded-3xl', \n}; \n \nconst EVENT: Record<CalendarRadius, string> = { \n none: 'rounded-none', \n small: 'rounded-sm', \n medium: 'rounded', \n large: 'rounded-md', \n full: 'rounded-xl', \n}; \n \nconst PILL: Record<CalendarRadius, string> = { \n none: 'rounded-none', \n small: 'rounded-sm', \n medium: 'rounded-md', \n large: 'rounded-full', \n full: 'rounded-full', \n}; \n \nconst DAY_NAME_CASE: Record<DayNameCase, string> = { \n upper: 'uppercase', \n lower: 'lowercase', \n capitalize: 'capitalize', \n normal: 'normal-case', \n}; \n \nexport function useCalendarTheme(input: CalendarThemeInput): CalendarTheme { \n const cfg = useModoConfig(); \n const resolvedColor = computed<CalendarColor>(() => { \n const local = input.color(); \n if (local && local !== 'default') return local; \n return (cfg?.value.color as CalendarColor) ?? 'default'; \n }); \n const resolvedRadius = computed<CalendarRadius>(() => { \n const local = input.radius(); \n return local ?? (cfg?.value.radius as CalendarRadius) ?? 'medium'; \n }); \n \n const todayTextClass = computed(() => TEXT[resolvedColor.value] ?? TEXT.default); \n const todayBgClass = computed(() => BG[resolvedColor.value] ?? BG.default); \n const rangeSelectClass = computed(() => RANGE[resolvedColor.value] ?? RANGE.default); \n const focusRingColorClass = computed(() => RING[resolvedColor.value] ?? RING.default); \n const highlightDotClass = computed(() => DOT[resolvedColor.value] ?? DOT.default); \n const containerRadiusClass = computed(() => CONTAINER[resolvedRadius.value] ?? CONTAINER.large); \n const eventRadiusClass = computed(() => EVENT[resolvedRadius.value] ?? EVENT.small); \n const pillRadiusClass = computed(() => PILL[resolvedRadius.value] ?? PILL.full); \n const dayNameCaseClass = computed(() => DAY_NAME_CASE[input.dayNameCase?.() ?? 'upper'] ?? DAY_NAME_CASE.upper); \n \n return { \n todayTextClass, \n todayBgClass, \n rangeSelectClass, \n focusRingColorClass, \n highlightDotClass, \n containerRadiusClass, \n eventRadiusClass, \n pillRadiusClass, \n dayNameCaseClass, \n resolvedColor, \n }; \n}\n"],"mappings":";;;;AA0BA,IAAM,OAAsC;CACxC,SAAS;CACT,SAAS;CACT,QAAQ;CACR,SAAS;CACT,SAAS;CACZ;AAED,IAAM,KAAoC;CACtC,SAAS;CACT,SAAS;CACT,QAAQ;CACR,SAAS;CACT,SAAS;CACZ;AAED,IAAM,QAAuC;CACzC,SAAS;CACT,SAAS;CACT,QAAQ;CACR,SAAS;CACT,SAAS;CACZ;AAED,IAAM,OAAsC;CACxC,S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AXmC,KAAK,eAAe,UAAU,KAAK,KAWtE;EACA,mBAAA,GAAA,IAAA,gBAXoC,cAAc,MAAM,eAAe,IAAI,YAAY,cAAc,MAWrG;EACA;EACH"}
1
+ {"version":3,"file":"useCalendarTheme.cjs","names":[],"sources":["../../src/composables/useCalendarTheme.ts"],"sourcesContent":["import { computed, type ComputedRef } from 'vue'; \nimport { useModoConfig } from './useModoConfig'; \n \nexport type CalendarColor = 'default' | 'primary' | 'danger' | 'success' | 'warning'; \nexport type CalendarRadius = 'none' | 'small' | 'medium' | 'large' | 'full'; \nexport type DayNameCase = 'upper' | 'lower' | 'capitalize' | 'normal'; \n \nexport interface CalendarThemeInput { \n color: () => CalendarColor | undefined; \n radius: () => CalendarRadius | undefined; \n dayNameCase?: () => DayNameCase; \n} \n \nexport interface CalendarTheme { \n todayTextClass: ComputedRef<string>; \n todayBgClass: ComputedRef<string>; \n rangeSelectClass: ComputedRef<string>; \n focusRingColorClass: ComputedRef<string>; \n highlightDotClass: ComputedRef<string>; \n containerRadiusClass: ComputedRef<string>; \n eventRadiusClass: ComputedRef<string>;\n /** Whether an event's left colour rule reads as a bar at the current radius. */\n showEventAccent: ComputedRef<boolean>;\n pillRadiusClass: ComputedRef<string>;\n dayNameCaseClass: ComputedRef<string>; \n resolvedColor: ComputedRef<CalendarColor>; \n} \n \nconst TEXT: Record<CalendarColor, string> = { \n default: 'text-foreground', \n primary: 'text-primary', \n danger: 'text-destructive', \n success: 'text-success', \n warning: 'text-warning', \n}; \n \nconst BG: Record<CalendarColor, string> = { \n default: 'bg-foreground text-background', \n primary: 'bg-primary text-primary-foreground', \n danger: 'bg-destructive text-destructive-foreground', \n success: 'bg-success text-success-foreground', \n warning: 'bg-warning text-warning-foreground', \n}; \n \nconst RANGE: Record<CalendarColor, string> = { \n default: 'border-foreground/40 bg-foreground/10', \n primary: 'border-primary/50 bg-primary/10', \n danger: 'border-destructive/50 bg-destructive/10', \n success: 'border-success/50 bg-success/10', \n warning: 'border-warning/50 bg-warning/10', \n}; \n \nconst RING: Record<CalendarColor, string> = { \n default: 'ring-ring', \n primary: 'ring-primary', \n danger: 'ring-destructive', \n success: 'ring-success', \n warning: 'ring-warning', \n}; \n \nconst DOT: Record<CalendarColor, string> = { \n default: 'bg-muted-foreground', \n primary: 'bg-primary', \n danger: 'bg-destructive', \n success: 'bg-success', \n warning: 'bg-warning', \n}; \n \nconst CONTAINER: Record<CalendarRadius, string> = { \n none: 'rounded-none', \n small: 'rounded', \n medium: 'rounded-md', \n large: 'rounded-xl', \n full: 'rounded-3xl', \n}; \n \nconst EVENT: Record<CalendarRadius, string> = { \n none: 'rounded-none', \n small: 'rounded-sm', \n medium: 'rounded', \n large: 'rounded-md', \n full: 'rounded-xl', \n}; \n \nconst PILL: Record<CalendarRadius, string> = { \n none: 'rounded-none', \n small: 'rounded-sm', \n medium: 'rounded-md', \n large: 'rounded-full', \n full: 'rounded-full', \n}; \n \n/**\n * Radii at which an event still has enough straight left edge to carry the\n * colour rule. Past these, `border-radius` sweeps the one-sided border around\n * the corner arc and it renders as a crescent hugging the side of the event\n * instead of a bar; the translucent fill and the text colour carry the event\n * colour on their own there.\n */\nconst EVENT_ACCENT_RADII: CalendarRadius[] = ['none', 'small', 'medium'];\n\nconst DAY_NAME_CASE: Record<DayNameCase, string> = {\n upper: 'uppercase', \n lower: 'lowercase', \n capitalize: 'capitalize', \n normal: 'normal-case', \n}; \n \nexport function useCalendarTheme(input: CalendarThemeInput): CalendarTheme { \n const cfg = useModoConfig(); \n const resolvedColor = computed<CalendarColor>(() => { \n const local = input.color(); \n if (local && local !== 'default') return local; \n return (cfg?.value.color as CalendarColor) ?? 'default'; \n }); \n const resolvedRadius = computed<CalendarRadius>(() => { \n const local = input.radius(); \n return local ?? (cfg?.value.radius as CalendarRadius) ?? 'medium'; \n }); \n \n const todayTextClass = computed(() => TEXT[resolvedColor.value] ?? TEXT.default); \n const todayBgClass = computed(() => BG[resolvedColor.value] ?? BG.default); \n const rangeSelectClass = computed(() => RANGE[resolvedColor.value] ?? RANGE.default); \n const focusRingColorClass = computed(() => RING[resolvedColor.value] ?? RING.default); \n const highlightDotClass = computed(() => DOT[resolvedColor.value] ?? DOT.default); \n const containerRadiusClass = computed(() => CONTAINER[resolvedRadius.value] ?? CONTAINER.large); \n const eventRadiusClass = computed(() => EVENT[resolvedRadius.value] ?? EVENT.small); \n const pillRadiusClass = computed(() => PILL[resolvedRadius.value] ?? PILL.full);\n const showEventAccent = computed(() => EVENT_ACCENT_RADII.includes(resolvedRadius.value));\n const dayNameCaseClass = computed(() => DAY_NAME_CASE[input.dayNameCase?.() ?? 'upper'] ?? DAY_NAME_CASE.upper); \n \n return { \n todayTextClass, \n todayBgClass, \n rangeSelectClass, \n focusRingColorClass, \n highlightDotClass, \n containerRadiusClass,\n eventRadiusClass,\n showEventAccent,\n pillRadiusClass,\n dayNameCaseClass, \n resolvedColor, \n }; \n}\n"],"mappings":";;;;AA4BA,IAAM,OAAsC;CACxC,SAAS;CACT,SAAS;CACT,QAAQ;CACR,SAAS;CACT,SAAS;CACZ;AAED,IAAM,KAAoC;CACtC,SAAS;CACT,SAAS;CACT,QAAQ;CACR,SAAS;CACT,SAAS;CACZ;AAED,IAAM,QAAuC;CACzC,SAAS;CACT,SAAS;CACT,QAAQ;CACR,SAAS;CACT,SAAS;CACZ;AAED,IAAM,OAAsC;CACxC,SAAS;CACT,SAAS;CACT,QAAQ;CACR,SAAS;CACT,SAAS;CACZ;AAED,IAAM,MAAqC;CACvC,SAAS;CACT,SAAS;CACT,QAAQ;CACR,SAAS;CACT,SAAS;CACZ;AAED,IAAM,YAA4C;CAC9C,MAAM;CACN,OAAO;CACP,QAAQ;CACR,OAAO;CACP,MAAM;CACT;AAED,IAAM,QAAwC;CAC1C,MAAM;CACN,OAAO;CACP,QAAQ;CACR,OAAO;CACP,MAAM;CACT;AAED,IAAM,OAAuC;CACzC,MAAM;CACN,OAAO;CACP,QAAQ;CACR,OAAO;CACP,MAAM;CACT;;;;;;;;AAS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
58
58
  full: "rounded-full"
59
59
  };
60
+ /**
61
+ * Radii at which an event still has enough straight left edge to carry the
62
+ * colour rule. Past these, `border-radius` sweeps the one-sided border around
63
+ * the corner arc and it renders as a crescent hugging the side of the event
64
+ * instead of a bar; the translucent fill and the text colour carry the event
65
+ * colour on their own there.
66
+ */
67
+ var EVENT_ACCENT_RADII = [
68
+ "none",
69
+ "small",
70
+ "medium"
71
+ ];
60
72
  var DAY_NAME_CASE = {
61
73
  upper: "uppercase",
62
74
  lower: "lowercase",
@@ -73,15 +85,24 @@ function useCalendarTheme(input) {
73
85
  const resolvedRadius = computed(() => {
74
86
  return input.radius() ?? cfg?.value.radius ?? "medium";
75
87
  });
88
+ const todayTextClass = computed(() => TEXT[resolvedColor.value] ?? TEXT.default);
89
+ const todayBgClass = computed(() => BG[resolvedColor.value] ?? BG.default);
90
+ const rangeSelectClass = computed(() => RANGE[resolvedColor.value] ?? RANGE.default);
91
+ const focusRingColorClass = computed(() => RING[resolvedColor.value] ?? RING.default);
92
+ const highlightDotClass = computed(() => DOT[resolvedColor.value] ?? DOT.default);
93
+ const containerRadiusClass = computed(() => CONTAINER[resolvedRadius.value] ?? CONTAINER.large);
94
+ const eventRadiusClass = computed(() => EVENT[resolvedRadius.value] ?? EVENT.small);
95
+ const pillRadiusClass = computed(() => PILL[resolvedRadius.value] ?? PILL.full);
76
96
  return {
77
- todayTextClass: computed(() => TEXT[resolvedColor.value] ?? TEXT.default),
78
- todayBgClass: computed(() => BG[resolvedColor.value] ?? BG.default),
79
- rangeSelectClass: computed(() => RANGE[resolvedColor.value] ?? RANGE.default),
80
- focusRingColorClass: computed(() => RING[resolvedColor.value] ?? RING.default),
81
- highlightDotClass: computed(() => DOT[resolvedColor.value] ?? DOT.default),
82
- containerRadiusClass: computed(() => CONTAINER[resolvedRadius.value] ?? CONTAINER.large),
83
- eventRadiusClass: computed(() => EVENT[resolvedRadius.value] ?? EVENT.small),
84
- pillRadiusClass: computed(() => PILL[resolvedRadius.value] ?? PILL.full),
97
+ todayTextClass,
98
+ todayBgClass,
99
+ rangeSelectClass,
100
+ focusRingColorClass,
101
+ highlightDotClass,
102
+ containerRadiusClass,
103
+ eventRadiusClass,
104
+ showEventAccent: computed(() => EVENT_ACCENT_RADII.includes(resolvedRadius.value)),
105
+ pillRadiusClass,
85
106
  dayNameCaseClass: computed(() => DAY_NAME_CASE[input.dayNameCase?.() ?? "upper"] ?? DAY_NAME_CASE.upper),
86
107
  resolvedColor
87
108
  };