ablok-components 0.3.57 → 0.3.59
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/_virtual/_plugin-vue_export-helper.js +9 -0
- package/dist/ablok-components.umd.js +2 -2
- package/dist/assets/img/guide.png.js +4 -0
- package/dist/components/atoms/base-button/base-button.vue.js +92 -0
- package/dist/components/atoms/base-button/base-button.vue3.js +5 -0
- package/dist/components/atoms/base-headline/base-headline.vue.js +30 -0
- package/dist/components/atoms/base-headline/base-headline.vue2.js +4 -0
- package/dist/components/atoms/base-image/base-image.vue.js +75 -0
- package/dist/components/atoms/base-image/base-image.vue3.js +5 -0
- package/dist/components/atoms/base-input/base-input.vue.js +181 -0
- package/dist/components/atoms/base-input/base-input.vue3.js +5 -0
- package/dist/components/atoms/base-paragraph/base-paragraph.vue.js +21 -0
- package/dist/components/atoms/base-paragraph/base-paragraph.vue2.js +4 -0
- package/dist/components/atoms/canvas-confetti/canvas-confetti.vue.js +113 -0
- package/dist/components/atoms/canvas-confetti/canvas-confetti.vue3.js +5 -0
- package/dist/components/atoms/check-group/check-group.vue.js +86 -0
- package/dist/components/atoms/check-group/check-group.vue3.js +5 -0
- package/dist/components/atoms/custom-html/custom-html.vue.js +26 -0
- package/dist/components/atoms/custom-html/custom-html.vue2.js +4 -0
- package/dist/components/atoms/input-checkbox/input-checkbox.vue.js +84 -0
- package/dist/components/atoms/input-checkbox/input-checkbox.vue3.js +5 -0
- package/dist/components/atoms/input-datetime/input-datetime.vue.js +99 -0
- package/dist/components/atoms/input-datetime/input-datetime.vue2.js +4 -0
- package/dist/components/atoms/input-file/input-file.vue.js +130 -0
- package/dist/components/atoms/input-file/input-file.vue2.js +4 -0
- package/dist/components/atoms/input-passcode/input-passcode.vue.js +149 -0
- package/dist/components/atoms/input-passcode/input-passcode.vue2.js +4 -0
- package/dist/components/atoms/input-password/input-password.vue.js +118 -0
- package/dist/components/atoms/input-password/input-password.vue2.js +4 -0
- package/dist/components/atoms/input-textarea/input-textarea.vue.js +105 -0
- package/dist/components/atoms/input-textarea/input-textarea.vue2.js +4 -0
- package/dist/components/atoms/loading-spinner/loading-spinner.vue.js +38 -0
- package/dist/components/atoms/loading-spinner/loading-spinner.vue3.js +5 -0
- package/dist/components/atoms/radio-group/radio-group.vue.js +99 -0
- package/dist/components/atoms/radio-group/radio-group.vue3.js +5 -0
- package/dist/components/atoms/svg-icon/svg-icon.vue.js +44 -0
- package/dist/components/atoms/svg-icon/svg-icon.vue3.js +5 -0
- package/dist/components/atoms/zoom-slider/zoom-slider.vue.js +59 -0
- package/dist/components/atoms/zoom-slider/zoom-slider.vue3.js +5 -0
- package/dist/components/molecules/accordion/accordion-item.vue.js +76 -0
- package/dist/components/molecules/accordion/accordion-item.vue3.js +5 -0
- package/dist/components/molecules/accordion/accordion.vue.js +12 -0
- package/dist/components/molecules/auto-suggest/auto-suggest.vue.js +132 -0
- package/dist/components/molecules/auto-suggest/auto-suggest.vue3.js +5 -0
- package/dist/components/molecules/base-camera/base-camera.vue.js +392 -0
- package/dist/components/molecules/base-camera/base-camera.vue3.js +5 -0
- package/dist/components/molecules/base-map/base-map.vue.js +386 -0
- package/dist/components/molecules/base-map/base-map.vue3.js +5 -0
- package/dist/components/molecules/color-palette/color-palette.vue.js +72 -0
- package/dist/components/molecules/color-palette/color-palette.vue3.js +5 -0
- package/dist/components/molecules/dom-renderer/dom-renderer.vue.js +102 -0
- package/dist/components/molecules/dom-renderer/dom-renderer.vue2.js +4 -0
- package/dist/components/molecules/file-upload/file-upload.vue.js +177 -0
- package/dist/components/molecules/file-upload/file-upload.vue3.js +5 -0
- package/dist/components/molecules/hint-system/hint-system.vue.d.ts +1 -1
- package/dist/components/molecules/hint-system/hint-system.vue.js +111 -0
- package/dist/components/molecules/hint-system/hint-system.vue3.js +5 -0
- package/dist/components/molecules/image-crop/image-crop.vue.js +82 -0
- package/dist/components/molecules/image-crop/image-crop.vue2.js +4 -0
- package/dist/components/molecules/image-crop-resize/image-crop-resize.vue.js +120 -0
- package/dist/components/molecules/image-crop-resize/image-crop-resize.vue2.js +4 -0
- package/dist/components/molecules/image-resize/image-resize.vue.js +143 -0
- package/dist/components/molecules/image-resize/image-resize.vue2.js +4 -0
- package/dist/components/molecules/image-upload/image-upload.vue.js +274 -0
- package/dist/components/molecules/image-upload/image-upload.vue3.js +5 -0
- package/dist/components/molecules/image-zoom/image-zoom.vue.js +209 -0
- package/dist/components/molecules/image-zoom/image-zoom.vue3.js +5 -0
- package/dist/components/molecules/input-color/input-color.vue.js +105 -0
- package/dist/components/molecules/input-color/input-color.vue3.js +5 -0
- package/dist/components/molecules/input-datepicker/input-datepicker.vue.js +263 -0
- package/dist/components/molecules/input-datepicker/input-datepicker.vue3.js +5 -0
- package/dist/components/molecules/input-dropdown/input-dropdown.vue.js +207 -0
- package/dist/components/molecules/input-dropdown/input-dropdown.vue3.js +5 -0
- package/dist/components/molecules/link-sharing/link-sharing.vue.js +177 -0
- package/dist/components/molecules/link-sharing/link-sharing.vue3.js +7 -0
- package/dist/components/molecules/location-list/location-list.vue.js +98 -0
- package/dist/components/molecules/location-list/location-list.vue3.js +5 -0
- package/dist/components/molecules/media-thumbnails/media-thumbnails.vue.js +55 -0
- package/dist/components/molecules/media-thumbnails/media-thumbnails.vue3.js +5 -0
- package/dist/components/molecules/popover-notifications/popover-notifications.vue.js +135 -0
- package/dist/components/molecules/popover-notifications/popover-notifications.vue3.js +5 -0
- package/dist/components/molecules/popover-tooltip/popover-tooltip.vue.js +134 -0
- package/dist/components/molecules/popover-tooltip/popover-tooltip.vue3.js +5 -0
- package/dist/components/molecules/progress-steps/progress-steps.vue.js +84 -0
- package/dist/components/molecules/progress-steps/progress-steps.vue3.js +5 -0
- package/dist/components/molecules/qr-code/qr-code.vue.js +103 -0
- package/dist/components/molecules/qr-code/qr-code.vue3.js +5 -0
- package/dist/components/molecules/radio-buttons/radio-buttons.vue.js +79 -0
- package/dist/components/molecules/radio-buttons/radio-buttons.vue3.js +5 -0
- package/dist/components/molecules/rte-editor/rte-editor.vue.js +455 -0
- package/dist/components/molecules/rte-editor/rte-editor.vue3.js +5 -0
- package/dist/components/molecules/select-media/select-media.vue.js +87 -0
- package/dist/components/molecules/select-media/select-media.vue3.js +5 -0
- package/dist/components/molecules/upload-group/upload-group.vue.js +178 -0
- package/dist/components/molecules/upload-group/upload-group.vue3.js +5 -0
- package/dist/components/organisms/asset-uploader/asset-uploader.vue.js +126 -0
- package/dist/components/organisms/asset-uploader/asset-uploader.vue3.js +5 -0
- package/dist/components/organisms/location-finder/location-finder.vue.js +634 -0
- package/dist/components/organisms/location-finder/location-finder.vue3.js +5 -0
- package/dist/components/templates/base-carousel/base-carousel.vue.js +94 -0
- package/dist/components/templates/base-carousel/base-carousel.vue3.js +5 -0
- package/dist/components/templates/base-form/base-form.vue.js +35 -0
- package/dist/components/templates/base-form/base-form.vue3.js +5 -0
- package/dist/components/templates/modal-dialog/modal-dialog.vue.js +123 -0
- package/dist/components/templates/modal-dialog/modal-dialog.vue3.js +5 -0
- package/dist/components/templates/popover-dialog/popover-dialog.vue.js +95 -0
- package/dist/components/templates/popover-dialog/popover-dialog.vue3.js +5 -0
- package/dist/components/templates/sortable-list/sortable-list.vue.js +158 -0
- package/dist/components/templates/sortable-list/sortable-list.vue3.js +5 -0
- package/dist/components/templates/touch-wrapper/touch-wrapper.vue.js +85 -0
- package/dist/components/templates/touch-wrapper/touch-wrapper.vue3.js +5 -0
- package/dist/composables/useCameraFilter.js +56 -0
- package/dist/composables/useConfetti.js +12 -0
- package/dist/composables/useDirections.js +62 -0
- package/dist/composables/useFileUpload.js +79 -0
- package/dist/composables/useGeocoding.js +85 -0
- package/dist/composables/useGeolocation.js +71 -0
- package/dist/composables/useSanitize.js +23 -0
- package/dist/i18n.d.ts +3 -0
- package/dist/index.js +156 -0
- package/dist/locales/en.d.ts +3 -0
- package/dist/node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +9 -0
- package/dist/node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +18 -0
- package/dist/node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/_lib/buildMatchFn.js +31 -0
- package/dist/node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +15 -0
- package/dist/node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/de/_lib/formatDistance.js +163 -0
- package/dist/node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/de/_lib/formatLong.js +37 -0
- package/dist/node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/de/_lib/formatRelative.js +11 -0
- package/dist/node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/de/_lib/localize.js +161 -0
- package/dist/node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/de/_lib/match.js +112 -0
- package/dist/node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/de.js +20 -0
- package/dist/node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +70 -0
- package/dist/node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/en-US/_lib/formatLong.js +33 -0
- package/dist/node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +11 -0
- package/dist/node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/en-US/_lib/localize.js +155 -0
- package/dist/node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/en-US/_lib/match.js +110 -0
- package/dist/node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/en-US.js +20 -0
- package/dist/node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/fr/_lib/formatDistance.js +70 -0
- package/dist/node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/fr/_lib/formatLong.js +33 -0
- package/dist/node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/fr/_lib/formatRelative.js +11 -0
- package/dist/node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/fr/_lib/localize.js +121 -0
- package/dist/node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/fr/_lib/match.js +110 -0
- package/dist/node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/fr.js +20 -0
- package/dist/utilities/helpers.js +79 -0
- package/package.json +80 -25
- package/dist/ablok-components.es.js +0 -8654
- package/dist/components/atoms/base-button/base-button.spec.d.ts +0 -1
- package/dist/components/atoms/base-headline/base-headline.spec.d.ts +0 -1
- package/dist/components/atoms/base-image/base-image.spec.d.ts +0 -1
- package/dist/components/atoms/base-input/base-input.spec.d.ts +0 -1
- package/dist/components/atoms/base-paragraph/base-paragraph.spec.d.ts +0 -1
- package/dist/components/atoms/canvas-confetti/canvas-confetti.spec.d.ts +0 -1
- package/dist/components/atoms/check-group/check-group.spec.d.ts +0 -1
- package/dist/components/atoms/custom-html/custom-html.spec.d.ts +0 -1
- package/dist/components/atoms/input-checkbox/input-checkbox.spec.d.ts +0 -1
- package/dist/components/atoms/input-file/input-file.spec.d.ts +0 -1
- package/dist/components/atoms/input-passcode/input-passcode.spec.d.ts +0 -1
- package/dist/components/atoms/input-password/input-password.spec.d.ts +0 -1
- package/dist/components/atoms/input-textarea/input-textarea.spec.d.ts +0 -1
- package/dist/components/atoms/loading-spinner/loading-spinner.spec.d.ts +0 -1
- package/dist/components/atoms/radio-group/radio-group.spec.d.ts +0 -1
- package/dist/components/atoms/svg-icon/svg-icon.spec.d.ts +0 -1
- package/dist/components/atoms/zoom-slider/zoom-slider.spec.d.ts +0 -1
- package/dist/components/molecules/accordion/accordion-item.spec.d.ts +0 -1
- package/dist/components/molecules/auto-suggest/auto-suggest.spec.d.ts +0 -1
- package/dist/components/molecules/base-map/base-map.spec.d.ts +0 -1
- package/dist/components/molecules/color-palette/color-palette.spec.d.ts +0 -1
- package/dist/components/molecules/dom-renderer/dom-renderer.spec.d.ts +0 -1
- package/dist/components/molecules/file-upload/file-upload.spec.d.ts +0 -1
- package/dist/components/molecules/hint-system/hint-system.spec.d.ts +0 -1
- package/dist/components/molecules/image-crop/image-crop.spec.d.ts +0 -1
- package/dist/components/molecules/image-crop-resize/image-crop-resize.spec.d.ts +0 -1
- package/dist/components/molecules/image-resize/image-resize.spec.d.ts +0 -1
- package/dist/components/molecules/image-upload/image-upload.spec.d.ts +0 -1
- package/dist/components/molecules/image-zoom/image-zoom.spec.d.ts +0 -1
- package/dist/components/molecules/input-color/input-color.spec.d.ts +0 -1
- package/dist/components/molecules/input-datepicker/input-datepicker.spec.d.ts +0 -1
- package/dist/components/molecules/input-dropdown/input-dropdown.spec.d.ts +0 -1
- package/dist/components/molecules/link-sharing/link-sharing.spec.d.ts +0 -1
- package/dist/components/molecules/media-thumbnails/media-thumbnails.spec.d.ts +0 -1
- package/dist/components/molecules/popover-notifications/popover-notifications.spec.d.ts +0 -1
- package/dist/components/molecules/popover-tooltip/popover-tooltip.spec.d.ts +0 -1
- package/dist/components/molecules/progress-steps/progress-steps.spec.d.ts +0 -1
- package/dist/components/molecules/qr-code/qr-code.spec.d.ts +0 -1
- package/dist/components/molecules/radio-buttons/radio-buttons.spec.d.ts +0 -1
- package/dist/components/molecules/rte-editor/rte-editor.spec.d.ts +0 -1
- package/dist/components/molecules/select-media/select-media.spec.d.ts +0 -1
- package/dist/components/molecules/upload-group/upload-group.spec.d.ts +0 -1
- package/dist/components/organisms/asset-uploader/asset-uploader.spec.d.ts +0 -1
- package/dist/components/organisms/location-finder/location-finder.spec.d.ts +0 -1
- package/dist/components/templates/base-carousel/base-carousel.spec.d.ts +0 -1
- package/dist/components/templates/base-form/base-form.spec.d.ts +0 -1
- package/dist/components/templates/modal-dialog/modal-dialog.spec.d.ts +0 -1
- package/dist/components/templates/popover-dialog/popover-dialog.spec.d.ts +0 -1
- package/dist/components/templates/sortable-list/sortable-list.spec.d.ts +0 -1
- package/dist/components/templates/touch-wrapper/touch-wrapper.spec.d.ts +0 -1
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { defineComponent as b, ref as s, openBlock as o, createElementBlock as n, withModifiers as u, createVNode as d, createCommentVNode as m, createElementVNode as i, Fragment as y, renderList as g, renderSlot as C, normalizeClass as w, toDisplayString as V } from "vue";
|
|
2
|
+
import f from "../../atoms/svg-icon/svg-icon.vue.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
const W = { class: "carousel d-flex" }, L = ["title"], N = ["onClick"], $ = ["title"], S = /* @__PURE__ */ b({
|
|
5
|
+
__name: "base-carousel",
|
|
6
|
+
props: {
|
|
7
|
+
modelValue: {
|
|
8
|
+
type: Number,
|
|
9
|
+
default: -1
|
|
10
|
+
},
|
|
11
|
+
config: {
|
|
12
|
+
type: Object,
|
|
13
|
+
default: null
|
|
14
|
+
},
|
|
15
|
+
messages: {
|
|
16
|
+
type: Object,
|
|
17
|
+
default: {}
|
|
18
|
+
},
|
|
19
|
+
items: {
|
|
20
|
+
type: Array,
|
|
21
|
+
default: []
|
|
22
|
+
},
|
|
23
|
+
navigation: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: !0
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
emits: ["update:modelValue", "select"],
|
|
29
|
+
setup(l, { emit: v }) {
|
|
30
|
+
const p = v, e = s(), r = s();
|
|
31
|
+
function h() {
|
|
32
|
+
e.value.scrollTo({
|
|
33
|
+
top: 0,
|
|
34
|
+
left: e.value.scrollLeft - e.value.clientWidth > 0 ? e.value.scrollLeft - e.value.clientWidth : 0,
|
|
35
|
+
behavior: "smooth"
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function k() {
|
|
39
|
+
e.value.scrollTo({
|
|
40
|
+
top: 0,
|
|
41
|
+
left: e.value.scrollLeft - e.value.clientWidth <= r.value.clientWidth ? e.value.scrollLeft + e.value.clientWidth : r.value.clientWidth,
|
|
42
|
+
behavior: "smooth"
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function _(t) {
|
|
46
|
+
p("update:modelValue", t);
|
|
47
|
+
}
|
|
48
|
+
return (t, j) => (o(), n("div", W, [
|
|
49
|
+
l.navigation ? (o(), n("button", {
|
|
50
|
+
key: 0,
|
|
51
|
+
class: "carousel__control btn btn-link text-light",
|
|
52
|
+
type: "button",
|
|
53
|
+
onClick: u(h, ["prevent", "stop"]),
|
|
54
|
+
title: t.$t("common.backward")
|
|
55
|
+
}, [
|
|
56
|
+
d(f, { symbol: "chevron-left" })
|
|
57
|
+
], 8, L)) : m("", !0),
|
|
58
|
+
i("div", {
|
|
59
|
+
ref_key: "viewport",
|
|
60
|
+
ref: e,
|
|
61
|
+
class: "carousel__viewport flex-grow-1"
|
|
62
|
+
}, [
|
|
63
|
+
i("div", {
|
|
64
|
+
ref_key: "track",
|
|
65
|
+
ref: r,
|
|
66
|
+
class: "carousel__track d-flex justify-center align-items-center"
|
|
67
|
+
}, [
|
|
68
|
+
(o(!0), n(y, null, g(l.items, (a, c) => C(t.$slots, "carousel-item", {
|
|
69
|
+
key: a.src,
|
|
70
|
+
item: a,
|
|
71
|
+
index: c
|
|
72
|
+
}, () => [
|
|
73
|
+
i("div", {
|
|
74
|
+
class: w(["carousel__item", c === l.modelValue ? "selected" : ""]),
|
|
75
|
+
onClick: (x) => _(c)
|
|
76
|
+
}, V(a), 11, N)
|
|
77
|
+
])), 128))
|
|
78
|
+
], 512)
|
|
79
|
+
], 512),
|
|
80
|
+
l.navigation ? (o(), n("button", {
|
|
81
|
+
key: 1,
|
|
82
|
+
class: "carousel__control btn btn-link text-light",
|
|
83
|
+
type: "button",
|
|
84
|
+
onClick: u(k, ["prevent", "stop"]),
|
|
85
|
+
title: t.$t("common.forward")
|
|
86
|
+
}, [
|
|
87
|
+
d(f, { symbol: "chevron-right" })
|
|
88
|
+
], 8, $)) : m("", !0)
|
|
89
|
+
]));
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
export {
|
|
93
|
+
S as default
|
|
94
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { defineComponent as s, openBlock as r, createElementBlock as i, createElementVNode as l, withModifiers as a, renderSlot as c } from "vue";
|
|
2
|
+
const p = { class: "base-form" }, d = /* @__PURE__ */ s({
|
|
3
|
+
__name: "base-form",
|
|
4
|
+
props: {
|
|
5
|
+
id: {},
|
|
6
|
+
name: {},
|
|
7
|
+
variant: {},
|
|
8
|
+
disabled: { type: Boolean },
|
|
9
|
+
pending: { type: Boolean }
|
|
10
|
+
},
|
|
11
|
+
setup(m) {
|
|
12
|
+
function o(e) {
|
|
13
|
+
console.log("input", e);
|
|
14
|
+
}
|
|
15
|
+
function n(e) {
|
|
16
|
+
console.log("reset", e);
|
|
17
|
+
}
|
|
18
|
+
function t(e) {
|
|
19
|
+
console.log("submit", e);
|
|
20
|
+
}
|
|
21
|
+
return (e, f) => (r(), i("div", p, [
|
|
22
|
+
l("form", {
|
|
23
|
+
ref: "form",
|
|
24
|
+
onInput: o,
|
|
25
|
+
onReset: n,
|
|
26
|
+
onSubmit: a(t, ["prevent"])
|
|
27
|
+
}, [
|
|
28
|
+
c(e.$slots, "default")
|
|
29
|
+
], 544)
|
|
30
|
+
]));
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
export {
|
|
34
|
+
d as default
|
|
35
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { defineComponent as _, ref as E, watch as k, onMounted as V, onBeforeUnmount as C, openBlock as c, createElementBlock as m, normalizeClass as B, createElementVNode as d, toDisplayString as f, createCommentVNode as p, renderSlot as y } from "vue";
|
|
2
|
+
const w = { class: "modal-dialog__content d-flex flex-column" }, L = { class: "modal-dialog__header d-flex p-3 border-bottom" }, S = {
|
|
3
|
+
key: 0,
|
|
4
|
+
class: "modal-dialog__title",
|
|
5
|
+
id: "exampleModalLabel"
|
|
6
|
+
}, x = { class: "modal-dialog__body" }, $ = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "modal-dialog__footer d-flex p-3 border-top"
|
|
9
|
+
}, M = /* @__PURE__ */ _({
|
|
10
|
+
__name: "modal-dialog",
|
|
11
|
+
props: {
|
|
12
|
+
modelValue: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: !1
|
|
15
|
+
},
|
|
16
|
+
modal: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
default: !0
|
|
19
|
+
},
|
|
20
|
+
size: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: "md"
|
|
23
|
+
/* MD */
|
|
24
|
+
},
|
|
25
|
+
dismiss: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: !0
|
|
28
|
+
},
|
|
29
|
+
title: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: ""
|
|
32
|
+
},
|
|
33
|
+
footer: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: !0
|
|
36
|
+
},
|
|
37
|
+
classes: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: ""
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
emits: ["update:modelValue", "confirm", "cancel"],
|
|
43
|
+
setup(a, { expose: g, emit: v }) {
|
|
44
|
+
const n = a, s = v, t = E();
|
|
45
|
+
function i() {
|
|
46
|
+
document.documentElement.style.setProperty("--scroll-position", `${Math.round(document.documentElement.scrollTop)}px`), n.modal ? t.value?.showModal() : t.value?.show(), s("update:modelValue", !0);
|
|
47
|
+
}
|
|
48
|
+
function l() {
|
|
49
|
+
const e = t.value && new KeyframeEffect(
|
|
50
|
+
t.value,
|
|
51
|
+
[{ translate: "0 -100%", opacity: "0" }],
|
|
52
|
+
{ duration: 320, easing: "ease", direction: "normal" }
|
|
53
|
+
), o = new Animation(e, document.timeline);
|
|
54
|
+
o.play(), o.addEventListener("finish", () => {
|
|
55
|
+
t.value?.close(), u();
|
|
56
|
+
}), s("update:modelValue", !1);
|
|
57
|
+
}
|
|
58
|
+
function u() {
|
|
59
|
+
const e = getComputedStyle(document.documentElement).getPropertyValue("--scroll-position");
|
|
60
|
+
document.documentElement.scrollTo({
|
|
61
|
+
top: parseInt(e, 10),
|
|
62
|
+
behavior: "instant"
|
|
63
|
+
}), s("update:modelValue", !1);
|
|
64
|
+
}
|
|
65
|
+
function h(e) {
|
|
66
|
+
i(), s("confirm", e);
|
|
67
|
+
}
|
|
68
|
+
function b() {
|
|
69
|
+
l(), s("cancel");
|
|
70
|
+
}
|
|
71
|
+
function r(e) {
|
|
72
|
+
const o = e.target;
|
|
73
|
+
o && o.nodeName === "DIALOG" && l();
|
|
74
|
+
}
|
|
75
|
+
return k(() => n.modelValue, (e, o) => {
|
|
76
|
+
e && e !== o ? i() : o && l();
|
|
77
|
+
}, { immediate: !0 }), V(() => {
|
|
78
|
+
t.value?.addEventListener("cancel", (e) => {
|
|
79
|
+
e.preventDefault(), l();
|
|
80
|
+
}), n.dismiss && document.addEventListener("click", r), n.modelValue && i();
|
|
81
|
+
}), C(() => {
|
|
82
|
+
n.dismiss && document.removeEventListener("click", r);
|
|
83
|
+
}), g({
|
|
84
|
+
show: i,
|
|
85
|
+
close: l,
|
|
86
|
+
confirm: h,
|
|
87
|
+
cancel: b
|
|
88
|
+
}), (e, o) => (c(), m("dialog", {
|
|
89
|
+
ref_key: "dialog",
|
|
90
|
+
ref: t,
|
|
91
|
+
class: B(["modal-dialog", {
|
|
92
|
+
[`modal-dialog--${a.size}`]: a.size
|
|
93
|
+
}]),
|
|
94
|
+
onClose: u
|
|
95
|
+
}, [
|
|
96
|
+
d("div", w, [
|
|
97
|
+
d("div", L, [
|
|
98
|
+
a.title ? (c(), m("h5", S, f(a.title), 1)) : p("", !0),
|
|
99
|
+
d("button", {
|
|
100
|
+
type: "button",
|
|
101
|
+
class: "btn-close ms-auto border-radius-none",
|
|
102
|
+
"aria-label": "Close",
|
|
103
|
+
onClick: l
|
|
104
|
+
})
|
|
105
|
+
]),
|
|
106
|
+
d("div", x, [
|
|
107
|
+
y(e.$slots, "default")
|
|
108
|
+
]),
|
|
109
|
+
a.footer ? (c(), m("div", $, [
|
|
110
|
+
y(e.$slots, "footer"),
|
|
111
|
+
d("button", {
|
|
112
|
+
type: "button",
|
|
113
|
+
class: "btn ms-auto",
|
|
114
|
+
onClick: l
|
|
115
|
+
}, f(e.$t("common.close")), 1)
|
|
116
|
+
])) : p("", !0)
|
|
117
|
+
])
|
|
118
|
+
], 34));
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
export {
|
|
122
|
+
M as default
|
|
123
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { defineComponent as c, ref as v, computed as g, watch as h, onMounted as y, onBeforeUnmount as T, openBlock as E, createElementBlock as L, renderSlot as S, createTextVNode as w } from "vue";
|
|
2
|
+
const V = ["id", "popover"], B = /* @__PURE__ */ c({
|
|
3
|
+
__name: "popover-dialog",
|
|
4
|
+
props: {
|
|
5
|
+
modelValue: {
|
|
6
|
+
type: Boolean,
|
|
7
|
+
default: !1
|
|
8
|
+
},
|
|
9
|
+
type: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: "auto"
|
|
12
|
+
},
|
|
13
|
+
id: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: () => `popover-dialog-${Math.random().toString(36).substr(2, 9)}`
|
|
16
|
+
},
|
|
17
|
+
title: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: ""
|
|
20
|
+
},
|
|
21
|
+
header: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: !1
|
|
24
|
+
},
|
|
25
|
+
footer: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: !1
|
|
28
|
+
},
|
|
29
|
+
classes: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: ""
|
|
32
|
+
},
|
|
33
|
+
hover: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: !1
|
|
36
|
+
},
|
|
37
|
+
hoverDelay: {
|
|
38
|
+
type: Number,
|
|
39
|
+
default: 400
|
|
40
|
+
},
|
|
41
|
+
closeTimeout: {
|
|
42
|
+
type: Number,
|
|
43
|
+
default: 0
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
emits: ["update:modelValue"],
|
|
47
|
+
setup(i, { emit: m }) {
|
|
48
|
+
const t = i, s = m, e = v(), a = v(), l = v(!1), d = g(() => "ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
49
|
+
function f() {
|
|
50
|
+
clearTimeout(a.value), t.hover && e.value?.showPopover();
|
|
51
|
+
}
|
|
52
|
+
function r() {
|
|
53
|
+
l.value = !0, clearTimeout(a.value), f();
|
|
54
|
+
}
|
|
55
|
+
function n() {
|
|
56
|
+
l.value = !1, (t.hover || t.closeTimeout) && (a.value = setTimeout(() => {
|
|
57
|
+
e.value?.hidePopover();
|
|
58
|
+
}, t.closeTimeout || t.hoverDelay));
|
|
59
|
+
}
|
|
60
|
+
h(() => t.modelValue, (o, u) => {
|
|
61
|
+
o && !u ? e.value?.matches(":popover-open") || e.value?.showPopover() : !o && u && e.value?.matches(":popover-open") && e.value?.hidePopover();
|
|
62
|
+
});
|
|
63
|
+
function p(o) {
|
|
64
|
+
o.newState === "open" ? (t.closeTimeout && !l.value && (clearTimeout(a.value), a.value = setTimeout(() => {
|
|
65
|
+
l.value || e.value?.hidePopover();
|
|
66
|
+
}, t.closeTimeout)), t.modelValue || s("update:modelValue", !0)) : o.newState === "closed" && (l.value = !1, t.modelValue && s("update:modelValue", !1));
|
|
67
|
+
}
|
|
68
|
+
return y(() => {
|
|
69
|
+
if (e.value?.addEventListener("toggle", p), t.modelValue && e.value?.showPopover(), !d.value) {
|
|
70
|
+
e.value?.addEventListener("mouseenter", r), e.value?.addEventListener("mouseleave", n);
|
|
71
|
+
const o = document.querySelector(`[popovertarget="${t.id}"]`);
|
|
72
|
+
o && (o.addEventListener("mouseenter", r), o.addEventListener("mouseleave", n));
|
|
73
|
+
}
|
|
74
|
+
}), T(() => {
|
|
75
|
+
if (clearTimeout(a.value), e.value?.removeEventListener("toggle", p), !d.value) {
|
|
76
|
+
e.value?.removeEventListener("mouseenter", r), e.value?.removeEventListener("mouseleave", n);
|
|
77
|
+
const o = document.querySelector(`[popovertarget="${t.id}"]`);
|
|
78
|
+
o && (o.removeEventListener("mouseenter", r), o.removeEventListener("mouseleave", n));
|
|
79
|
+
}
|
|
80
|
+
}), (o, u) => (E(), L("span", {
|
|
81
|
+
class: "popover-dialog",
|
|
82
|
+
id: i.id,
|
|
83
|
+
popover: i.type,
|
|
84
|
+
ref_key: "popover",
|
|
85
|
+
ref: e
|
|
86
|
+
}, [
|
|
87
|
+
S(o.$slots, "default", {}, () => [
|
|
88
|
+
u[0] || (u[0] = w(" Popover content goes here. ", -1))
|
|
89
|
+
])
|
|
90
|
+
], 8, V));
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
export {
|
|
94
|
+
B as default
|
|
95
|
+
};
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { defineComponent as L, ref as v, computed as m, useSlots as O, watch as f, openBlock as i, createBlock as N, TransitionGroup as x, withModifiers as _, normalizeClass as D, withCtx as C, createElementBlock as d, Fragment as V, renderList as M, createCommentVNode as p, createElementVNode as b, createVNode as A, renderSlot as $, createTextVNode as P, toDisplayString as j } from "vue";
|
|
2
|
+
import { sanitizeHtml as z } from "../../../composables/useSanitize.js";
|
|
3
|
+
import q from "../../atoms/svg-icon/svg-icon.vue.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
const F = ["onDragenter", "onDragover", "onDragleave", "onDragend", "onDrop", "innerHTML"], G = ["onDragstart", "onDrag", "onDragenter", "onDragover", "onDragleave", "onDragend", "onDrop"], J = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "sortable-list__drag-handle"
|
|
8
|
+
}, K = {
|
|
9
|
+
type: "button",
|
|
10
|
+
class: "btn",
|
|
11
|
+
draggable: "true"
|
|
12
|
+
}, Q = {
|
|
13
|
+
key: 0,
|
|
14
|
+
class: "sortable-list__item"
|
|
15
|
+
}, ee = /* @__PURE__ */ L({
|
|
16
|
+
__name: "sortable-list",
|
|
17
|
+
props: {
|
|
18
|
+
modelValue: {
|
|
19
|
+
type: Array,
|
|
20
|
+
default: () => []
|
|
21
|
+
},
|
|
22
|
+
config: {
|
|
23
|
+
type: Object,
|
|
24
|
+
default: null
|
|
25
|
+
},
|
|
26
|
+
messages: {
|
|
27
|
+
type: Object,
|
|
28
|
+
default: {}
|
|
29
|
+
},
|
|
30
|
+
vertical: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: !0
|
|
33
|
+
},
|
|
34
|
+
showDragHandle: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: !1
|
|
37
|
+
},
|
|
38
|
+
showPreview: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: !0
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
emits: [
|
|
44
|
+
"update:modelValue",
|
|
45
|
+
"update:isDragging",
|
|
46
|
+
"update:dragIndex",
|
|
47
|
+
"update:dragOverIndex"
|
|
48
|
+
],
|
|
49
|
+
setup(n, { emit: k }) {
|
|
50
|
+
const S = n, o = v(!1), l = v(null), s = v(null), g = k, c = m({
|
|
51
|
+
get() {
|
|
52
|
+
return S.modelValue;
|
|
53
|
+
},
|
|
54
|
+
set(e) {
|
|
55
|
+
g("update:modelValue", e);
|
|
56
|
+
}
|
|
57
|
+
}), B = m(() => {
|
|
58
|
+
const e = document.querySelector(".is-drag-item")?.outerHTML;
|
|
59
|
+
return e ? z(e) : "";
|
|
60
|
+
}), E = O(), H = m(() => E["list-append"]);
|
|
61
|
+
function I(e, a) {
|
|
62
|
+
e.dataTransfer && (e.dataTransfer.dropEffect = "move", e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("index", a.toLocaleString()), o.value = !0, l.value = a);
|
|
63
|
+
}
|
|
64
|
+
function w(e, a) {
|
|
65
|
+
o.value = !1, l.value = null, s.value = null;
|
|
66
|
+
}
|
|
67
|
+
function R(e, a) {
|
|
68
|
+
}
|
|
69
|
+
function y(e, a) {
|
|
70
|
+
s.value = l.value !== a ? a : null;
|
|
71
|
+
}
|
|
72
|
+
function h(e, a) {
|
|
73
|
+
s.value = l.value !== a ? a : null;
|
|
74
|
+
}
|
|
75
|
+
function U(e, a) {
|
|
76
|
+
}
|
|
77
|
+
function T(e, a) {
|
|
78
|
+
if (e.dataTransfer) {
|
|
79
|
+
e.preventDefault();
|
|
80
|
+
const u = Number(e.dataTransfer.getData("index")), r = a, t = [...c.value];
|
|
81
|
+
(r || r === 0) && (u || u === 0) && t.splice(r, 0, t.splice(u, 1)[0]), c.value = t;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return f(() => o.value, (e) => {
|
|
85
|
+
g("update:isDragging", e);
|
|
86
|
+
}, { immediate: !0 }), f(() => l.value, (e) => {
|
|
87
|
+
g("update:dragIndex", e);
|
|
88
|
+
}, { immediate: !0 }), f(() => s.value, (e) => {
|
|
89
|
+
g("update:dragOverIndex", e);
|
|
90
|
+
}, { immediate: !0 }), (e, a) => (i(), N(x, {
|
|
91
|
+
name: "list",
|
|
92
|
+
tag: "ul",
|
|
93
|
+
class: D(["sortable-list p-0 d-flex gap-2", {
|
|
94
|
+
"flex-column": n.vertical,
|
|
95
|
+
"flex-row flex-wrap": !n.vertical
|
|
96
|
+
}]),
|
|
97
|
+
onDragover: a[0] || (a[0] = _(() => {
|
|
98
|
+
}, ["prevent"])),
|
|
99
|
+
onDragenter: a[1] || (a[1] = _(() => {
|
|
100
|
+
}, ["prevent"]))
|
|
101
|
+
}, {
|
|
102
|
+
default: C(() => [
|
|
103
|
+
(i(!0), d(V, null, M(c.value, (u, r) => (i(), d(V, { key: r }, [
|
|
104
|
+
n.showPreview && o.value && s.value === r ? (i(), d("li", {
|
|
105
|
+
key: 0,
|
|
106
|
+
class: "sortable-list__item is-drop-target",
|
|
107
|
+
onDragenter: (t) => y(t, r),
|
|
108
|
+
onDragover: (t) => h(t, r),
|
|
109
|
+
onDragleave: (t) => void 0,
|
|
110
|
+
onDragend: (t) => w(),
|
|
111
|
+
onDrop: (t) => T(t, r),
|
|
112
|
+
innerHTML: B.value
|
|
113
|
+
}, null, 40, F)) : p("", !0),
|
|
114
|
+
b("li", {
|
|
115
|
+
class: D(["sortable-list__item d-flex", {
|
|
116
|
+
"is-drag-item": o.value && l.value === r,
|
|
117
|
+
"is-drop-target": o.value && s.value === r && !n.showPreview,
|
|
118
|
+
"align-items-center gap-2": n.vertical
|
|
119
|
+
}]),
|
|
120
|
+
draggable: !0,
|
|
121
|
+
onDragstart: (t) => I(t, r),
|
|
122
|
+
onDrag: (t) => void 0,
|
|
123
|
+
onDragenter: (t) => y(t, r),
|
|
124
|
+
onDragover: (t) => h(t, r),
|
|
125
|
+
onDragleave: (t) => void 0,
|
|
126
|
+
onDragend: (t) => w(),
|
|
127
|
+
onDrop: (t) => T(t, r)
|
|
128
|
+
}, [
|
|
129
|
+
n.showDragHandle ? (i(), d("div", J, [
|
|
130
|
+
b("button", K, [
|
|
131
|
+
A(q, { symbol: "drag" })
|
|
132
|
+
])
|
|
133
|
+
])) : p("", !0),
|
|
134
|
+
b("div", {
|
|
135
|
+
class: D(["sortable-list__item-content", {
|
|
136
|
+
"flex-grow-1": n.vertical
|
|
137
|
+
}])
|
|
138
|
+
}, [
|
|
139
|
+
$(e.$slots, "list-item", {
|
|
140
|
+
item: u,
|
|
141
|
+
index: r
|
|
142
|
+
}, () => [
|
|
143
|
+
P(j(u), 1)
|
|
144
|
+
])
|
|
145
|
+
], 2)
|
|
146
|
+
], 42, G)
|
|
147
|
+
], 64))), 128)),
|
|
148
|
+
H.value ? (i(), d("li", Q, [
|
|
149
|
+
$(e.$slots, "list-append")
|
|
150
|
+
])) : p("", !0)
|
|
151
|
+
]),
|
|
152
|
+
_: 3
|
|
153
|
+
}, 8, ["class"]));
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
export {
|
|
157
|
+
ee as default
|
|
158
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { defineComponent as g, getCurrentInstance as h, ref as y, onMounted as E, openBlock as $, createElementBlock as C, renderSlot as c, createElementVNode as s, createVNode as u, unref as p } from "vue";
|
|
2
|
+
import i from "../../atoms/svg-icon/svg-icon.vue.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
const _ = { class: "touch-wrapper__controls" }, k = {
|
|
5
|
+
class: "btn-group",
|
|
6
|
+
role: "group"
|
|
7
|
+
}, N = /* @__PURE__ */ g({
|
|
8
|
+
__name: "touch-wrapper",
|
|
9
|
+
props: {
|
|
10
|
+
modelValue: {
|
|
11
|
+
type: Number,
|
|
12
|
+
default: 1
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
emits: ["update:modelValue"],
|
|
16
|
+
setup(d, { emit: m }) {
|
|
17
|
+
const a = h()?.appContext?.config?.globalProperties?.$config || { iconSprite: "/symbol-defs.svg" }, f = d, b = m, n = y();
|
|
18
|
+
function o(t) {
|
|
19
|
+
const e = f.modelValue + t;
|
|
20
|
+
b("update:modelValue", t === 0 ? 1 : e >= 1 ? e : 1);
|
|
21
|
+
}
|
|
22
|
+
function v(t) {
|
|
23
|
+
if (t.ctrlKey) {
|
|
24
|
+
t.preventDefault();
|
|
25
|
+
const e = 0 - t.deltaY * 0.01;
|
|
26
|
+
o(e);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function r(t) {
|
|
30
|
+
t.preventDefault();
|
|
31
|
+
const { scale: e } = t, l = e > 1 ? e * 0.01 : 0 - e;
|
|
32
|
+
o(l);
|
|
33
|
+
}
|
|
34
|
+
return E(() => {
|
|
35
|
+
n.value && (n.value.addEventListener("wheel", v, !1), n.value.addEventListener("gesturestart", r, !1), n.value.addEventListener("gesturechange", r, !1), n.value.addEventListener("gestureend", r, !1));
|
|
36
|
+
}), (t, e) => ($(), C("div", {
|
|
37
|
+
ref_key: "touchElement",
|
|
38
|
+
ref: n,
|
|
39
|
+
class: "touch-wrapper"
|
|
40
|
+
}, [
|
|
41
|
+
c(t.$slots, "controls", {
|
|
42
|
+
on: { setScale: o }
|
|
43
|
+
}, () => [
|
|
44
|
+
s("div", _, [
|
|
45
|
+
s("div", k, [
|
|
46
|
+
s("button", {
|
|
47
|
+
type: "button",
|
|
48
|
+
class: "btn",
|
|
49
|
+
onClick: e[0] || (e[0] = (l) => o(-1))
|
|
50
|
+
}, [
|
|
51
|
+
u(i, {
|
|
52
|
+
symbol: "minus",
|
|
53
|
+
"base-path": p(a).iconSprite
|
|
54
|
+
}, null, 8, ["base-path"])
|
|
55
|
+
]),
|
|
56
|
+
s("button", {
|
|
57
|
+
type: "button",
|
|
58
|
+
class: "btn",
|
|
59
|
+
onClick: e[1] || (e[1] = (l) => o(0))
|
|
60
|
+
}, [
|
|
61
|
+
u(i, {
|
|
62
|
+
symbol: "maximize",
|
|
63
|
+
"base-path": p(a).iconSprite
|
|
64
|
+
}, null, 8, ["base-path"])
|
|
65
|
+
]),
|
|
66
|
+
s("button", {
|
|
67
|
+
type: "button",
|
|
68
|
+
class: "btn",
|
|
69
|
+
onClick: e[2] || (e[2] = (l) => o(1))
|
|
70
|
+
}, [
|
|
71
|
+
u(i, {
|
|
72
|
+
symbol: "plus",
|
|
73
|
+
"base-path": p(a).iconSprite
|
|
74
|
+
}, null, 8, ["base-path"])
|
|
75
|
+
])
|
|
76
|
+
])
|
|
77
|
+
])
|
|
78
|
+
]),
|
|
79
|
+
c(t.$slots, "default")
|
|
80
|
+
], 512));
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
export {
|
|
84
|
+
N as default
|
|
85
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { computed as F } from "vue";
|
|
2
|
+
function R(l) {
|
|
3
|
+
const m = F(() => {
|
|
4
|
+
if (!l.tintColor) return null;
|
|
5
|
+
const e = l.tintColor.replace("#", ""), a = parseInt(e.substring(0, 2), 16), i = parseInt(e.substring(2, 4), 16), r = parseInt(e.substring(4, 6), 16);
|
|
6
|
+
return { r: a, g: i, b: r };
|
|
7
|
+
});
|
|
8
|
+
function f(e, a, i) {
|
|
9
|
+
if (l.filter === "none" && !l.tintColor) return;
|
|
10
|
+
const r = e.getImageData(0, 0, a, i), t = r.data;
|
|
11
|
+
if (l.filter === "grayscale")
|
|
12
|
+
for (let n = 0; n < t.length; n += 4) {
|
|
13
|
+
const o = 0.299 * t[n] + 0.587 * t[n + 1] + 0.114 * t[n + 2];
|
|
14
|
+
t[n] = o, t[n + 1] = o, t[n + 2] = o;
|
|
15
|
+
}
|
|
16
|
+
else if (l.filter === "sepia")
|
|
17
|
+
for (let n = 0; n < t.length; n += 4) {
|
|
18
|
+
const o = t[n], g = t[n + 1], c = t[n + 2];
|
|
19
|
+
t[n] = Math.min(255, 0.393 * o + 0.769 * g + 0.189 * c), t[n + 1] = Math.min(255, 0.349 * o + 0.686 * g + 0.168 * c), t[n + 2] = Math.min(255, 0.272 * o + 0.534 * g + 0.131 * c);
|
|
20
|
+
}
|
|
21
|
+
if (l.tintColor && m.value) {
|
|
22
|
+
const { r: n, g: o, b: g } = m.value, c = l.tintIntensity;
|
|
23
|
+
for (let s = 0; s < t.length; s += 4) {
|
|
24
|
+
const d = t[s], h = t[s + 1], u = t[s + 2], I = d * n / 255, C = h * o / 255, v = u * g / 255;
|
|
25
|
+
t[s] = d + (I - d) * c, t[s + 1] = h + (C - h) * c, t[s + 2] = u + (v - u) * c;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
e.putImageData(r, 0, 0);
|
|
29
|
+
}
|
|
30
|
+
async function w(e) {
|
|
31
|
+
if (typeof e != "string")
|
|
32
|
+
return e.complete && e.naturalWidth > 0 || await new Promise((i, r) => {
|
|
33
|
+
e.onload = () => i(), e.onerror = () => r(new Error("Failed to load image element"));
|
|
34
|
+
}), e;
|
|
35
|
+
const a = new Image();
|
|
36
|
+
return await new Promise((i, r) => {
|
|
37
|
+
a.onload = () => i(), a.onerror = () => r(new Error("Failed to load image source")), a.src = e;
|
|
38
|
+
}), a;
|
|
39
|
+
}
|
|
40
|
+
async function b(e, a = {}) {
|
|
41
|
+
const i = await w(e), r = document.createElement("canvas"), t = a.width || i.naturalWidth || i.width, n = a.height || i.naturalHeight || i.height;
|
|
42
|
+
r.width = t, r.height = n;
|
|
43
|
+
const o = r.getContext("2d");
|
|
44
|
+
if (!o)
|
|
45
|
+
throw new Error("Could not create canvas context");
|
|
46
|
+
return o.drawImage(i, 0, 0, t, n), f(o, t, n), r.toDataURL(a.mimeType || "image/png", a.quality);
|
|
47
|
+
}
|
|
48
|
+
async function y(e, a = {}) {
|
|
49
|
+
const i = await b(e, a);
|
|
50
|
+
return (await fetch(i)).blob();
|
|
51
|
+
}
|
|
52
|
+
return { tintRgb: m, applyFilterToCanvas: f, applyFilterToImage: b, applyFilterToImageBlob: y };
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
R as useCameraFilter
|
|
56
|
+
};
|