@bagelink/vue 1.6.43 → 1.6.49
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/bin/experimentalGenTypedRoutes.ts +18 -19
- package/bin/utils.ts +4 -4
- package/dist/components/AddressSearch.vue.d.ts.map +1 -1
- package/dist/components/Alert.vue.d.ts.map +1 -1
- package/dist/components/BglVideo.vue.d.ts.map +1 -1
- package/dist/components/Card.vue.d.ts.map +1 -1
- package/dist/components/Carousel.vue.d.ts +2 -2
- package/dist/components/Carousel.vue.d.ts.map +1 -1
- package/dist/components/Dropdown.vue.d.ts.map +1 -1
- package/dist/components/Flag.vue.d.ts.map +1 -1
- package/dist/components/IframeVue.vue.d.ts.map +1 -1
- package/dist/components/ListItem.vue.d.ts.map +1 -1
- package/dist/components/Loading.vue.d.ts.map +1 -1
- package/dist/components/Modal.vue.d.ts.map +1 -1
- package/dist/components/ModalForm.vue.d.ts.map +1 -1
- package/dist/components/NavBar.vue.d.ts +1 -1
- package/dist/components/Pill.vue.d.ts.map +1 -1
- package/dist/components/Swiper.vue.d.ts +12 -4
- package/dist/components/Swiper.vue.d.ts.map +1 -1
- package/dist/components/Zoomer.vue.d.ts.map +1 -1
- package/dist/components/analytics/LineChart.vue.d.ts.map +1 -1
- package/dist/components/analytics/PieChart.vue.d.ts +2 -1
- package/dist/components/analytics/PieChart.vue.d.ts.map +1 -1
- package/dist/components/analytics/index.d.ts +1 -1
- package/dist/components/analytics/index.d.ts.map +1 -1
- package/dist/components/calendar/CalendarPopover.vue.d.ts.map +1 -1
- package/dist/components/form/BglMultiStepForm.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/ColorInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/DateInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/PasswordInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/RadioGroup.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/RangeInput.vue.d.ts +11 -11
- package/dist/components/form/inputs/RichText/components/EditorToolbar.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/RichText/components/TableGridSelector.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/RichText/utils/commands.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/TelInput.vue.d.ts.map +1 -1
- package/dist/components/layout/AppContent.vue.d.ts.map +1 -1
- package/dist/components/layout/AppSidebar.vue.d.ts +1 -0
- package/dist/components/layout/AppSidebar.vue.d.ts.map +1 -1
- package/dist/components/layout/Layout.vue.d.ts.map +1 -1
- package/dist/components/layout/Tabs.vue.d.ts.map +1 -1
- package/dist/components/layout/index.d.ts +3 -3
- package/dist/components/layout/index.d.ts.map +1 -1
- package/dist/components/lightbox/Lightbox.vue.d.ts.map +1 -1
- package/dist/index.cjs +24 -15
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +1530 -1404
- package/dist/plugins/modalTypes.d.ts +1 -8
- package/dist/plugins/modalTypes.d.ts.map +1 -1
- package/dist/plugins/useModal.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -2
- package/src/components/AccordionItem.vue +13 -13
- package/src/components/AddToCalendar.vue +1 -1
- package/src/components/AddressSearch.vue +9 -8
- package/src/components/Alert.vue +2 -1
- package/src/components/Badge.vue +5 -5
- package/src/components/BglVideo.vue +44 -45
- package/src/components/Btn.vue +15 -15
- package/src/components/Card.vue +10 -8
- package/src/components/Carousel.vue +159 -162
- package/src/components/DataPreview.vue +1 -1
- package/src/components/DragOver.vue +6 -6
- package/src/components/Dropdown.vue +39 -38
- package/src/components/Flag.vue +7 -6
- package/src/components/Icon/Icon.vue +22 -22
- package/src/components/IframeVue.vue +5 -5
- package/src/components/Image.vue +17 -17
- package/src/components/ImportData.vue +79 -79
- package/src/components/ListItem.vue +12 -11
- package/src/components/Loading.vue +10 -9
- package/src/components/MapEmbed/Index.vue +24 -24
- package/src/components/Modal.vue +11 -9
- package/src/components/ModalForm.vue +15 -11
- package/src/components/NavBar.vue +6 -6
- package/src/components/Pagination.vue +27 -27
- package/src/components/Pill.vue +11 -12
- package/src/components/Rating.vue +2 -2
- package/src/components/Slider.vue +75 -75
- package/src/components/Spreadsheet/Index.vue +34 -34
- package/src/components/Spreadsheet/SpreadsheetTable.vue +3 -3
- package/src/components/Swiper.vue +4 -4
- package/src/components/Zoomer.vue +282 -182
- package/src/components/analytics/BarChart.vue +6 -6
- package/src/components/analytics/KpiCard.vue +2 -2
- package/src/components/analytics/LineChart.vue +63 -61
- package/src/components/analytics/PieChart.vue +104 -90
- package/src/components/analytics/index.ts +2 -2
- package/src/components/calendar/CalendarPopover.vue +1 -1
- package/src/components/calendar/Index.vue +1 -1
- package/src/components/calendar/views/AgendaView.vue +3 -3
- package/src/components/calendar/views/DayView.vue +6 -6
- package/src/components/calendar/views/MonthView.vue +2 -2
- package/src/components/calendar/views/WeekView.vue +18 -18
- package/src/components/dataTable/DataTable.vue +4 -4
- package/src/components/dataTable/useSorting.ts +1 -1
- package/src/components/dataTable/useTableData.ts +15 -15
- package/src/components/dataTable/useTableSelection.ts +15 -15
- package/src/components/dataTable/useTableVirtualization.ts +1 -1
- package/src/components/draggable/useDraggable.ts +42 -42
- package/src/components/form/BagelForm.vue +15 -15
- package/src/components/form/BglFieldSet.vue +5 -3
- package/src/components/form/BglMultiStepForm.vue +20 -21
- package/src/components/form/inputs/CheckInput.vue +2 -2
- package/src/components/form/inputs/CodeEditor/format.ts +7 -7
- package/src/components/form/inputs/CodeEditor/useHighlight.ts +6 -6
- package/src/components/form/inputs/ColorInput.vue +5 -4
- package/src/components/form/inputs/DateInput.vue +8 -9
- package/src/components/form/inputs/DatePicker.vue +24 -24
- package/src/components/form/inputs/EmailInput.vue +24 -24
- package/src/components/form/inputs/NumberInput.vue +26 -26
- package/src/components/form/inputs/OTP.vue +7 -7
- package/src/components/form/inputs/PasswordInput.vue +3 -2
- package/src/components/form/inputs/RadioGroup.vue +28 -25
- package/src/components/form/inputs/RadioPillsInput.vue +12 -12
- package/src/components/form/inputs/RangeInput.vue +21 -21
- package/src/components/form/inputs/RichText/components/EditorToolbar.vue +107 -92
- package/src/components/form/inputs/RichText/components/TableGridSelector.vue +64 -64
- package/src/components/form/inputs/RichText/components/gridBox.vue +10 -8
- package/src/components/form/inputs/RichText/composables/useCommands.ts +1 -1
- package/src/components/form/inputs/RichText/composables/useEditor.ts +12 -12
- package/src/components/form/inputs/RichText/composables/useEditorKeyboard.ts +1 -1
- package/src/components/form/inputs/RichText/index.vue +138 -138
- package/src/components/form/inputs/RichText/utils/commands.ts +84 -85
- package/src/components/form/inputs/RichText/utils/debug.ts +1 -1
- package/src/components/form/inputs/RichText/utils/formatting.ts +39 -39
- package/src/components/form/inputs/RichText/utils/media.ts +7 -7
- package/src/components/form/inputs/RichText/utils/selection.ts +28 -28
- package/src/components/form/inputs/RichText/utils/table.ts +19 -19
- package/src/components/form/inputs/SelectBtn.vue +1 -1
- package/src/components/form/inputs/SelectInput.vue +54 -54
- package/src/components/form/inputs/SignaturePad.vue +40 -40
- package/src/components/form/inputs/TableField.vue +1 -1
- package/src/components/form/inputs/TelInput.vue +54 -53
- package/src/components/form/inputs/TextInput.vue +19 -19
- package/src/components/form/inputs/ToggleInput.vue +2 -2
- package/src/components/form/inputs/Upload/useFileUpload.ts +6 -6
- package/src/components/form/useBagelFormState.ts +5 -5
- package/src/components/layout/AppContent.vue +6 -3
- package/src/components/layout/AppLayout.vue +2 -2
- package/src/components/layout/AppSidebar.vue +83 -16
- package/src/components/layout/Layout.vue +12 -10
- package/src/components/layout/SidebarMenu.vue +4 -4
- package/src/components/layout/TabbedLayout.vue +17 -17
- package/src/components/layout/Tabs.vue +4 -5
- package/src/components/layout/TabsNav.vue +14 -14
- package/src/components/layout/index.ts +3 -5
- package/src/components/lightbox/Lightbox.vue +276 -126
- package/src/components/lightbox/index.ts +8 -8
- package/src/composables/index.ts +8 -8
- package/src/composables/useAddToCalendar.ts +13 -13
- package/src/composables/useDevice.ts +2 -2
- package/src/composables/useFormField.ts +4 -4
- package/src/composables/usePolling.ts +8 -8
- package/src/composables/useSchemaField.ts +38 -38
- package/src/composables/useTheme.ts +9 -9
- package/src/composables/useValidateFieldValue.ts +2 -2
- package/src/directives/pattern.ts +25 -25
- package/src/directives/ripple.ts +4 -4
- package/src/directives/vResize.ts +6 -6
- package/src/index.ts +1 -0
- package/src/plugins/bagel.ts +4 -4
- package/src/plugins/modalTypes.ts +1 -8
- package/src/plugins/useModal.ts +43 -18
- package/src/styles/layout.css +1 -1
- package/src/types/index.ts +1 -1
- package/src/utils/BagelFormUtils.ts +7 -7
- package/src/utils/calendar/Helpers.ts +8 -8
- package/src/utils/calendar/dateUtils.ts +22 -22
- package/src/utils/calendar/time.ts +25 -25
- package/src/utils/calendar/week.ts +25 -25
- package/src/utils/elementUtils.ts +27 -27
- package/src/utils/sizeParsing.ts +2 -2
- package/src/utils/strings.ts +5 -5
- package/src/utils/tapDetector.ts +11 -11
- package/src/utils/useSearch.ts +29 -29
- package/vite.config.ts +0 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bagelink/vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.49",
|
|
5
5
|
"description": "Bagel core sdk packages",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Bagel Studio",
|
|
@@ -60,7 +60,6 @@
|
|
|
60
60
|
"swiper": "^12.0.3",
|
|
61
61
|
"@types/leaflet": "^1.9.18",
|
|
62
62
|
"@types/signature_pad": "^4.0.0",
|
|
63
|
-
"@vue-macros/reactivity-transform": "^1.1.6",
|
|
64
63
|
"vue": "^3.5.16",
|
|
65
64
|
"vue-component-type-helpers": "^2.2.10",
|
|
66
65
|
"vue-toastification": "^2.0.0-rc.5"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { Icon } from '@bagelink/vue'
|
|
3
|
-
import { inject,
|
|
3
|
+
import { computed, inject, ref, watch } from 'vue'
|
|
4
4
|
|
|
5
5
|
const props = defineProps<{
|
|
6
6
|
label?: string
|
|
@@ -14,12 +14,12 @@ const props = defineProps<{
|
|
|
14
14
|
|
|
15
15
|
const emit = defineEmits(['update:open'])
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
const openVal = ref(!!props.open)
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
get: () => openVal,
|
|
19
|
+
const isOpen = computed({
|
|
20
|
+
get: () => openVal.value,
|
|
21
21
|
set: (value: boolean) => {
|
|
22
|
-
openVal = value
|
|
22
|
+
openVal.value = value
|
|
23
23
|
emit('update:open', value)
|
|
24
24
|
},
|
|
25
25
|
})
|
|
@@ -28,34 +28,34 @@ interface AccordionState {
|
|
|
28
28
|
openItem?: string
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
const accordionState = inject<AccordionState>('accordionState')
|
|
31
|
+
const accordionState = inject<AccordionState | undefined>('accordionState', undefined)
|
|
32
32
|
const id = props.id || Math.random().toString(36).slice(7)
|
|
33
33
|
|
|
34
34
|
const computedIcon = computed(() => {
|
|
35
|
-
return 'plus_minus'
|
|
36
|
-
? (isOpen ? 'remove' : 'add')
|
|
35
|
+
return props.iconType === 'plus_minus'
|
|
36
|
+
? (isOpen.value ? 'remove' : 'add')
|
|
37
37
|
: 'expand_more'
|
|
38
38
|
})
|
|
39
39
|
const iconPosition = computed(() => props.iconPosition || 'end')
|
|
40
40
|
|
|
41
|
-
watch(() => props.open, () => isOpen = props.open, { immediate: true })
|
|
41
|
+
watch(() => props.open, () => isOpen.value = props.open, { immediate: true })
|
|
42
42
|
|
|
43
43
|
if (accordionState) {
|
|
44
44
|
watch(
|
|
45
45
|
() => accordionState.openItem,
|
|
46
46
|
(currentOpenId) => {
|
|
47
|
-
if (currentOpenId !== id) {isOpen = false}
|
|
47
|
+
if (currentOpenId !== id) { isOpen.value = false }
|
|
48
48
|
},
|
|
49
49
|
{ immediate: true }
|
|
50
50
|
)
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
function toggle() {
|
|
54
|
-
isOpen = !isOpen
|
|
54
|
+
isOpen.value = !isOpen.value
|
|
55
55
|
if (accordionState) {
|
|
56
|
-
if (isOpen) {
|
|
56
|
+
if (isOpen.value) {
|
|
57
57
|
accordionState.openItem = id
|
|
58
|
-
} else if (accordionState.openItem === id) {
|
|
58
|
+
} else if (accordionState.openItem !== undefined && accordionState.openItem === id) {
|
|
59
59
|
accordionState.openItem = undefined
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -39,7 +39,7 @@ const calendarProviders = [
|
|
|
39
39
|
]
|
|
40
40
|
|
|
41
41
|
const includedProviders = computed(() => {
|
|
42
|
-
if (!props.providers || !props.providers.length) {return calendarProviders}
|
|
42
|
+
if (!props.providers || !props.providers.length) { return calendarProviders }
|
|
43
43
|
return calendarProviders.filter(provider => props.providers?.includes(provider.id))
|
|
44
44
|
})
|
|
45
45
|
|
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { Dropdown, ListItem, ListView, TextInput } from '@bagelink/vue'
|
|
3
|
+
import { ref } from 'vue'
|
|
3
4
|
|
|
4
5
|
const emit = defineEmits(['addressSelected'])
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
const addressInput = ref('')
|
|
7
|
+
const searchResults = ref<any[]>([])
|
|
7
8
|
|
|
8
9
|
type MapMarker = {
|
|
9
10
|
lat: number
|
|
10
11
|
lon: number
|
|
11
12
|
} | [number, number]
|
|
12
13
|
|
|
13
|
-
const suggestion =
|
|
14
|
+
const suggestion = ref<typeof Dropdown>()
|
|
14
15
|
function emitAddress(address: MapMarker) {
|
|
15
16
|
emit('addressSelected', address)
|
|
16
|
-
searchResults = []
|
|
17
|
-
addressInput = ''
|
|
17
|
+
searchResults.value = []
|
|
18
|
+
addressInput.value = ''
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
async function searchAddresses() {
|
|
21
|
-
const addressURL = addressInput.replaceAll(/\s+/g, '+')
|
|
22
|
+
const addressURL = addressInput.value.replaceAll(/\s+/g, '+')
|
|
22
23
|
const geocodeUrl = `https://nominatim.openstreetmap.org/search?format=json&q=${encodeURI(addressURL)}`
|
|
23
24
|
const res = await fetch(geocodeUrl)
|
|
24
|
-
searchResults = await res.json()
|
|
25
|
-
suggestion?.show()
|
|
25
|
+
searchResults.value = await res.json() ?? []
|
|
26
|
+
suggestion.value?.show()
|
|
26
27
|
}
|
|
27
28
|
</script>
|
|
28
29
|
|
package/src/components/Alert.vue
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { IconType } from '@bagelink/vue'
|
|
3
3
|
import { Icon } from '@bagelink/vue'
|
|
4
|
+
import { ref } from 'vue'
|
|
4
5
|
import Btn from './Btn.vue'
|
|
5
6
|
|
|
6
7
|
interface Props {
|
|
@@ -19,7 +20,7 @@ withDefaults(
|
|
|
19
20
|
},
|
|
20
21
|
)
|
|
21
22
|
|
|
22
|
-
const isDismissed =
|
|
23
|
+
const isDismissed = ref(false)
|
|
23
24
|
|
|
24
25
|
const color = {
|
|
25
26
|
info: 'var(--bgl-primary)',
|
package/src/components/Badge.vue
CHANGED
|
@@ -14,11 +14,11 @@ defineProps<Props>()
|
|
|
14
14
|
</script>
|
|
15
15
|
|
|
16
16
|
<template>
|
|
17
|
-
<div class="pill" :class="[color]">
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
</div>
|
|
17
|
+
<div class="pill" :class="[color]">
|
|
18
|
+
<Icon v-if="icon" class="inline" :icon="icon" />
|
|
19
|
+
{{ text }}
|
|
20
|
+
<Icon v-if="iconEnd" class="inline" :icon="iconEnd" />
|
|
21
|
+
</div>
|
|
22
22
|
</template>
|
|
23
23
|
|
|
24
24
|
<style scoped>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { useIntersectionObserver } from '@vueuse/core'
|
|
3
|
-
import { watch } from 'vue'
|
|
3
|
+
import { computed, ref, watch } from 'vue'
|
|
4
4
|
|
|
5
5
|
type Autoplay = boolean | 'visible'
|
|
6
6
|
interface Props {
|
|
@@ -16,33 +16,33 @@ interface Props {
|
|
|
16
16
|
|
|
17
17
|
const props = defineProps<Props>()
|
|
18
18
|
|
|
19
|
-
const videoFormat =
|
|
19
|
+
const videoFormat = computed(() => props.src?.split('.').pop()?.split('?').shift()?.toLowerCase() ?? 'mp4')
|
|
20
20
|
|
|
21
|
-
const videoContainer =
|
|
21
|
+
const videoContainer = ref<HTMLElement | null>()
|
|
22
22
|
|
|
23
|
-
const isYoutubeShort =
|
|
24
|
-
return props.src?.includes('youtube.com/shorts/')
|
|
23
|
+
const isYoutubeShort = computed(() => {
|
|
24
|
+
return props.src?.includes('youtube.com/shorts/') ?? false
|
|
25
25
|
})
|
|
26
26
|
|
|
27
|
-
const aspectRatio =
|
|
27
|
+
const aspectRatio = computed(
|
|
28
28
|
() => {
|
|
29
|
-
if (isYoutubeShort) {return '9/16'} // Vertical aspect ratio for Shorts
|
|
30
|
-
return props.aspectRatio?.replace(':', '/')
|
|
29
|
+
if (isYoutubeShort.value) { return '9/16' } // Vertical aspect ratio for Shorts
|
|
30
|
+
return props.aspectRatio?.replace(':', '/') ?? '16/9'
|
|
31
31
|
}
|
|
32
32
|
)
|
|
33
33
|
|
|
34
|
-
const video =
|
|
34
|
+
const video = ref<HTMLVideoElement | null>()
|
|
35
35
|
|
|
36
36
|
function play() {
|
|
37
|
-
video?.play()
|
|
37
|
+
video.value?.play()
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
function pause() {
|
|
41
|
-
video?.pause()
|
|
41
|
+
video.value?.pause()
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
// Setup intersection observer for autoplay="visible"
|
|
45
|
-
if ('visible'
|
|
45
|
+
if (props.autoplay === 'visible') {
|
|
46
46
|
useIntersectionObserver(
|
|
47
47
|
videoContainer,
|
|
48
48
|
([{ isIntersecting }]) => {
|
|
@@ -57,50 +57,49 @@ if ('visible' === props.autoplay) {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
watch(() => props.status, (status) => {
|
|
60
|
-
if ('play'
|
|
61
|
-
if ('pause'
|
|
60
|
+
if (status === 'play') { play() }
|
|
61
|
+
if (status === 'pause') { pause() }
|
|
62
62
|
})
|
|
63
63
|
|
|
64
64
|
defineExpose({ play, pause })
|
|
65
65
|
|
|
66
|
-
const embedType =
|
|
66
|
+
const embedType = computed<'YouTube' | 'Vimeo' | undefined>(() => {
|
|
67
67
|
const youtubeRegex = /youtube\.com|youtu\.be/
|
|
68
|
-
if (youtubeRegex.test(props.src
|
|
68
|
+
if (youtubeRegex.test(props.src ?? '')) { return 'YouTube' }
|
|
69
69
|
const vimeoRegex = /(?:player\.)?vimeo\.com/
|
|
70
|
-
if (vimeoRegex.test(props.src
|
|
70
|
+
if (vimeoRegex.test(props.src ?? '')) { return 'Vimeo' }
|
|
71
|
+
return undefined
|
|
71
72
|
})
|
|
72
73
|
|
|
73
|
-
const videoUrl =
|
|
74
|
-
if (embedType) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
videoId = props.src?.split(/v=|youtu\.be\//)[1]?.split('&')?.[0] || ''
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const queryParams = new URLSearchParams({
|
|
85
|
-
autoplay: props.autoplay ? '1' : '0',
|
|
86
|
-
controls: '0',
|
|
87
|
-
showinfo: '0',
|
|
88
|
-
modestbranding: '1'
|
|
89
|
-
})
|
|
90
|
-
return `https://www.youtube.com/embed/${videoId}?${queryParams}`
|
|
74
|
+
const videoUrl = computed(() => {
|
|
75
|
+
if (embedType.value === 'YouTube') {
|
|
76
|
+
// Extract video ID from YouTube regular or Shorts URL
|
|
77
|
+
let videoId = ''
|
|
78
|
+
if (props.src?.includes('youtube.com/shorts/') === true) {
|
|
79
|
+
videoId = props.src.split('/shorts/')[1]?.split('?')[0] ?? ''
|
|
80
|
+
} else {
|
|
81
|
+
videoId = props.src?.split(/v=|youtu\.be\//)[1]?.split('&')?.[0] ?? ''
|
|
91
82
|
}
|
|
92
|
-
if ('Vimeo' === embedType) {
|
|
93
|
-
// Handle both regular Vimeo URLs and player.vimeo.com embed URLs
|
|
94
|
-
const playerVimeoRegex = /player\.vimeo\.com\/video\/(\d+)/
|
|
95
|
-
const regularVimeoRegex = /vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|album\/(\d+)\/video\/)?(\d+)(?:$|\/|\?)/
|
|
96
83
|
|
|
97
|
-
|
|
98
|
-
|
|
84
|
+
const queryParams = new URLSearchParams({
|
|
85
|
+
autoplay: (props.autoplay === true || props.autoplay === 'visible') ? '1' : '0',
|
|
86
|
+
controls: '0',
|
|
87
|
+
showinfo: '0',
|
|
88
|
+
modestbranding: '1'
|
|
89
|
+
})
|
|
90
|
+
return `https://www.youtube.com/embed/${videoId}?${queryParams}`
|
|
91
|
+
}
|
|
92
|
+
if (embedType.value === 'Vimeo') {
|
|
93
|
+
// Handle both regular Vimeo URLs and player.vimeo.com embed URLs
|
|
94
|
+
const playerVimeoRegex = /player\.vimeo\.com\/video\/(\d+)/
|
|
95
|
+
const regularVimeoRegex = /vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|album\/(\d+)\/video\/)?(\d+)(?:$|\/|\?)/
|
|
99
96
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
97
|
+
const playerMatch = props.src?.match(playerVimeoRegex) ?? null
|
|
98
|
+
const regularMatch = props.src?.match(regularVimeoRegex) ?? null
|
|
99
|
+
|
|
100
|
+
const videoId = playerMatch?.[1] ?? regularMatch?.[3]
|
|
101
|
+
console.log(videoId, { playerMatch, regularMatch })
|
|
102
|
+
return `https://player.vimeo.com/video/${videoId}`
|
|
104
103
|
}
|
|
105
104
|
return props.src
|
|
106
105
|
})
|
package/src/components/Btn.vue
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { IconType, ExtendedThemeType } from '@bagelink/vue'
|
|
3
3
|
import type { SetupContext } from 'vue'
|
|
4
4
|
import { Icon, Loading, useModal } from '@bagelink/vue'
|
|
5
|
-
import { useSlots, ref, onMounted, onUnmounted } from 'vue'
|
|
5
|
+
import { useSlots, ref, onMounted, onUnmounted, computed } from 'vue'
|
|
6
6
|
import { RouterLink } from 'vue-router'
|
|
7
7
|
|
|
8
8
|
const props = withDefaults(
|
|
@@ -60,7 +60,7 @@ const emit = defineEmits<{
|
|
|
60
60
|
const isMobileScreen = ref(false)
|
|
61
61
|
|
|
62
62
|
function checkMobile() {
|
|
63
|
-
isMobileScreen.value =
|
|
63
|
+
isMobileScreen.value = window.innerWidth <= 910
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
onMounted(() => {
|
|
@@ -73,15 +73,15 @@ onUnmounted(() => {
|
|
|
73
73
|
})
|
|
74
74
|
|
|
75
75
|
async function handleClick(event: MouseEvent) {
|
|
76
|
-
if (props.confirm) {
|
|
76
|
+
if (props.confirm !== undefined && props.confirm !== false) {
|
|
77
77
|
const { confirmModal } = useModal()
|
|
78
|
-
const message =
|
|
78
|
+
const message = typeof props.confirm === 'string' ? props.confirm : 'Are you sure?'
|
|
79
79
|
const confirmed = await confirmModal({
|
|
80
80
|
title: 'Confirm',
|
|
81
81
|
message
|
|
82
82
|
})
|
|
83
83
|
|
|
84
|
-
if (!confirmed) {return}
|
|
84
|
+
if (!confirmed) { return }
|
|
85
85
|
|
|
86
86
|
props.onClick(event)
|
|
87
87
|
emit('confirmed', event)
|
|
@@ -90,8 +90,8 @@ async function handleClick(event: MouseEvent) {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
const iconSizeComputed =
|
|
94
|
-
if (props.iconSize !== undefined) {return props.iconSize}
|
|
93
|
+
const iconSizeComputed = computed(() => {
|
|
94
|
+
if (props.iconSize !== undefined) { return props.iconSize }
|
|
95
95
|
|
|
96
96
|
// Default icon sizes based on button size
|
|
97
97
|
const sizeMap = {
|
|
@@ -114,20 +114,20 @@ const iconSizeComputed = $computed(() => {
|
|
|
114
114
|
return isMobileScreen.value ? 1 : 1.2
|
|
115
115
|
})
|
|
116
116
|
|
|
117
|
-
const isComponent =
|
|
118
|
-
if (props.disabled) {return props.is}
|
|
119
|
-
if (props.to) {return RouterLink}
|
|
120
|
-
if (props.href) {return 'a'}
|
|
117
|
+
const isComponent = computed(() => {
|
|
118
|
+
if (props.disabled) { return props.is }
|
|
119
|
+
if (props.to !== undefined && props.to !== '') { return RouterLink }
|
|
120
|
+
if (props.href !== undefined && props.href !== '') { return 'a' }
|
|
121
121
|
return props.is
|
|
122
122
|
})
|
|
123
123
|
|
|
124
|
-
const bind =
|
|
124
|
+
const bind = computed(() => {
|
|
125
125
|
const obj: { [key: string]: any } = {}
|
|
126
126
|
if (!props.disabled) {
|
|
127
|
-
if (props.to) {obj.to = props.to}
|
|
128
|
-
else if (props.href) {obj.href = props.href}
|
|
127
|
+
if (props.to !== undefined && props.to !== '') { obj.to = props.to }
|
|
128
|
+
else if (props.href !== undefined && props.href !== '') { obj.href = props.href }
|
|
129
129
|
}
|
|
130
|
-
if (
|
|
130
|
+
if ((props.to === undefined || props.to === '') && (props.href === undefined || props.href === '')) {
|
|
131
131
|
obj.role = props.role
|
|
132
132
|
obj.type = props.type
|
|
133
133
|
}
|
package/src/components/Card.vue
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
|
|
2
4
|
const props = defineProps<{
|
|
3
5
|
label?: string
|
|
4
6
|
thin?: boolean
|
|
@@ -23,16 +25,16 @@ const props = defineProps<{
|
|
|
23
25
|
| 'transparent'
|
|
24
26
|
}>()
|
|
25
27
|
|
|
26
|
-
const bind =
|
|
28
|
+
const bind = computed(() => {
|
|
27
29
|
const obj: { [key: string]: any } = {}
|
|
28
|
-
if (props.href) {obj.href = props.href}
|
|
29
|
-
else if (props.to) {obj.to = props.to}
|
|
30
|
+
if (props.href !== undefined && props.href !== '') { obj.href = props.href }
|
|
31
|
+
else if (props.to !== undefined && props.to !== '') { obj.to = props.to }
|
|
30
32
|
return obj
|
|
31
33
|
})
|
|
32
34
|
|
|
33
|
-
const is =
|
|
34
|
-
if (props.href) {return 'a'}
|
|
35
|
-
if (props.to) {return 'router-link'}
|
|
35
|
+
const is = computed(() => {
|
|
36
|
+
if (props.href !== undefined && props.href !== '') { return 'a' }
|
|
37
|
+
if (props.to !== undefined && props.to !== '') { return 'router-link' }
|
|
36
38
|
return 'div'
|
|
37
39
|
})
|
|
38
40
|
</script>
|
|
@@ -46,8 +48,8 @@ const is = $computed(() => {
|
|
|
46
48
|
[bg || '']: bg,
|
|
47
49
|
'overflow-x': overflowX,
|
|
48
50
|
'overflow-y': overflowY,
|
|
49
|
-
|
|
50
|
-
}"
|
|
51
|
+
'card_frame': frame,
|
|
52
|
+
}"
|
|
51
53
|
>
|
|
52
54
|
<span v-if="label" class="card_label">
|
|
53
55
|
{{ label }}
|