@bagelink/vue 0.0.1000 → 0.0.1004
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/BglVideo.vue.d.ts.map +1 -1
- package/dist/components/IframeVue.vue.d.ts +47 -0
- package/dist/components/IframeVue.vue.d.ts.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/index.cjs +238 -170
- package/dist/index.mjs +238 -170
- package/dist/style.css +3 -3
- package/package.json +1 -1
- package/src/components/BglVideo.vue +5 -2
- package/src/components/IframeVue.vue +72 -0
- package/src/components/index.ts +2 -1
package/dist/style.css
CHANGED
|
@@ -293,15 +293,15 @@ display: block;
|
|
|
293
293
|
color: var(--bgl-red);
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
-
.bgl_vid iframe[data-v-
|
|
297
|
-
.bgl_vid video[data-v-
|
|
296
|
+
.bgl_vid iframe[data-v-732c510b],
|
|
297
|
+
.bgl_vid video[data-v-732c510b] {
|
|
298
298
|
width: 100%;
|
|
299
299
|
height: auto;
|
|
300
300
|
display: block;
|
|
301
301
|
margin: auto;
|
|
302
302
|
border-radius: var(--input-border-radius);
|
|
303
303
|
}
|
|
304
|
-
.bgl_vid.vid_empty[data-v-
|
|
304
|
+
.bgl_vid.vid_empty[data-v-732c510b] {
|
|
305
305
|
padding-top: 56.25%;
|
|
306
306
|
background: var(--input-bg);
|
|
307
307
|
border-radius: var(--input-border-radius);
|
package/package.json
CHANGED
|
@@ -26,13 +26,16 @@ const videoUrl = $computed(() => {
|
|
|
26
26
|
if (embedType === 'YouTube') {
|
|
27
27
|
const videoId = props.src?.split(/v=|youtu\.be\//)[1]?.split('&')?.[0]
|
|
28
28
|
const queryParams = new URLSearchParams({
|
|
29
|
-
autoplay: props.autoplay ? '1' : '0'
|
|
29
|
+
autoplay: props.autoplay ? '1' : '0',
|
|
30
|
+
controls: '0',
|
|
31
|
+
showinfo: '0',
|
|
32
|
+
modestbranding: '1'
|
|
30
33
|
})
|
|
31
34
|
return `https://www.youtube.com/embed/${videoId}?${queryParams}`
|
|
32
35
|
}
|
|
33
36
|
if (embedType === 'Vimeo') {
|
|
34
37
|
const vimeoRegex
|
|
35
|
-
|
|
38
|
+
// eslint-disable-next-line regexp/no-unused-capturing-group
|
|
36
39
|
= /vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|album\/(\d+)\/video\/)?(\d+)(?:$|\/|\?)/
|
|
37
40
|
const videoId = props.src?.match(vimeoRegex)?.[3]
|
|
38
41
|
return `https://player.vimeo.com/video/${videoId}`
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
interface Message {
|
|
3
|
+
mesage: string
|
|
4
|
+
type: string
|
|
5
|
+
}
|
|
6
|
+
defineProps<{
|
|
7
|
+
src: string
|
|
8
|
+
title?: string
|
|
9
|
+
height?: string
|
|
10
|
+
width?: string
|
|
11
|
+
name?: string
|
|
12
|
+
sandbox?: string
|
|
13
|
+
allow?: string
|
|
14
|
+
allowfullscreen?: boolean
|
|
15
|
+
loading?: 'eager' | 'lazy'
|
|
16
|
+
referrerpolicy?: string
|
|
17
|
+
marginwidth?: number
|
|
18
|
+
marginheight?: number
|
|
19
|
+
scrolling?: 'yes' | 'no' | 'auto'
|
|
20
|
+
csp?: string
|
|
21
|
+
srcset?: string
|
|
22
|
+
}>()
|
|
23
|
+
|
|
24
|
+
const emit = defineEmits<{
|
|
25
|
+
(message: 'message', payload: Message): void
|
|
26
|
+
(load: 'load', payload: Event): void
|
|
27
|
+
}>()
|
|
28
|
+
|
|
29
|
+
import { onBeforeUnmount, onMounted } from 'vue'
|
|
30
|
+
|
|
31
|
+
const iframe = $ref<HTMLIFrameElement>()
|
|
32
|
+
|
|
33
|
+
function handleMessage(event: MessageEvent) {
|
|
34
|
+
emit('message', event.data as Message)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function handleMessageWrapper(event: MessageEvent) {
|
|
38
|
+
if (event.source === iframe?.contentWindow) {
|
|
39
|
+
handleMessage(event)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
onMounted(() => {
|
|
44
|
+
window.addEventListener('message', handleMessageWrapper)
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
onBeforeUnmount(() => {
|
|
48
|
+
window.removeEventListener('message', handleMessageWrapper)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const contentWindow = () => iframe?.contentWindow as Window | null
|
|
52
|
+
|
|
53
|
+
defineExpose({ contentWindow })
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<template>
|
|
57
|
+
<iframe
|
|
58
|
+
ref="iframe"
|
|
59
|
+
:src
|
|
60
|
+
:title
|
|
61
|
+
frameborder="none"
|
|
62
|
+
:width
|
|
63
|
+
:height
|
|
64
|
+
allowpaymentrequest="true"
|
|
65
|
+
:marginwidth
|
|
66
|
+
:marginheight
|
|
67
|
+
:csp
|
|
68
|
+
:scrolling
|
|
69
|
+
:srcset
|
|
70
|
+
@load="$event => emit('load', $event)"
|
|
71
|
+
/>
|
|
72
|
+
</template>
|
package/src/components/index.ts
CHANGED
|
@@ -13,6 +13,7 @@ export { default as DataPreview } from './DataPreview.vue'
|
|
|
13
13
|
export { default as Dropdown } from './Dropdown.vue'
|
|
14
14
|
export { default as Flag } from './Flag.vue'
|
|
15
15
|
export * from './form'
|
|
16
|
+
export { default as IframeVue } from './IframeVue.vue'
|
|
16
17
|
export { default as Image } from './Image.vue'
|
|
17
18
|
export * from './layout'
|
|
18
19
|
export { default as ListItem } from './ListItem.vue'
|
|
@@ -24,8 +25,8 @@ export { default as Icon } from './MaterialIcon.vue'
|
|
|
24
25
|
export { default as Modal } from './Modal.vue'
|
|
25
26
|
export { default as ModalConfirm } from './ModalConfirm.vue'
|
|
26
27
|
export { default as ModalForm } from './ModalForm.vue'
|
|
27
|
-
export { default as NavBar } from './NavBar.vue'
|
|
28
28
|
|
|
29
|
+
export { default as NavBar } from './NavBar.vue'
|
|
29
30
|
export { default as PageTitle } from './PageTitle.vue'
|
|
30
31
|
export { default as Pill } from './Pill.vue'
|
|
31
32
|
export { default as RouterWrapper } from './RouterWrapper.vue'
|