@oneb/ui-vue 0.3.32 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ChevronLeftIcon-7505e081.cjs +1 -0
- package/dist/ChevronLeftIcon-bb9adb5b.js +20 -0
- package/dist/ChevronRightIcon-2992cf0d.cjs +1 -0
- package/dist/ChevronRightIcon-b0585768.js +20 -0
- package/dist/ChevronUpIcon-64a673e1.cjs +1 -0
- package/dist/{ChevronRightIcon-4549a26b.js → ChevronUpIcon-c43f27a9.js} +2 -19
- package/dist/MagnifyingGlassIcon-adf871ba.cjs +1 -0
- package/dist/MagnifyingGlassIcon-ca213d3d.js +20 -0
- package/dist/OneDropdownAuto.vue_vue_type_script_setup_true_lang-2c508e8a.js +79 -0
- package/dist/OneDropdownAuto.vue_vue_type_script_setup_true_lang-bf923b04.cjs +1 -0
- package/dist/OneFormInput.vue_vue_type_script_setup_true_lang-b89117e7.js +521 -0
- package/dist/OneFormInput.vue_vue_type_script_setup_true_lang-f6f7cd96.cjs +1 -0
- package/dist/OneHelpMenu-6ec63535.cjs +1 -0
- package/dist/{OneHelpMenu-73817f8a.js → OneHelpMenu-d5182c78.js} +118 -213
- package/dist/OneMarkdown.vue_vue_type_script_setup_true_lang-05266fc3.cjs +1 -0
- package/dist/OneMarkdown.vue_vue_type_script_setup_true_lang-bb2219c7.js +18 -0
- package/dist/OneModal-02a9a173.js +189 -0
- package/dist/OneModal-0e92c039.cjs +1 -0
- package/dist/OneTooltip.vue_vue_type_script_setup_true_lang-c492c128.js +25 -0
- package/dist/OneTooltip.vue_vue_type_script_setup_true_lang-e83a81ea.cjs +1 -0
- package/dist/SpinnerIcon-01be39fe.cjs +1 -0
- package/dist/{SpinnerIcon-74648c98.js → SpinnerIcon-516264ba.js} +5 -6
- package/dist/button/index.cjs +1 -1
- package/dist/button/index.d.ts +1 -1
- package/dist/button/index.js +3 -4
- package/dist/checkbox/checkbox.d.ts +5 -0
- package/dist/checkbox/index.cjs +1 -1
- package/dist/checkbox/index.js +40 -34
- package/dist/chips/OneChips.vue.d.ts +2 -0
- package/dist/chips/chips.d.ts +25 -0
- package/dist/chips/index.cjs +1 -0
- package/dist/chips/index.d.ts +3 -0
- package/dist/chips/index.js +62 -0
- package/dist/clipboard-494e1513.cjs +1 -0
- package/dist/clipboard-733b79a1.js +22 -0
- package/dist/common/OneDetailsList.vue.d.ts +2 -0
- package/dist/common/OneDetailsRow.vue.d.ts +2 -0
- package/dist/common/index.cjs +1 -1
- package/dist/common/index.d.ts +2 -0
- package/dist/common/index.js +68 -16
- package/dist/composables/index.cjs +1 -0
- package/dist/composables/index.d.ts +18 -0
- package/dist/composables/index.js +91 -0
- package/dist/composables/useAsyncMethod.d.ts +17 -0
- package/dist/composables/useAsyncSelect.d.ts +26 -0
- package/dist/composables/useConfirm.d.ts +27 -0
- package/dist/composables/useCursorList.d.ts +42 -0
- package/dist/composables/useDebouncedRef.d.ts +6 -0
- package/dist/composables/useFileUpload.d.ts +21 -0
- package/dist/composables/useFormSubmit.d.ts +23 -0
- package/dist/composables/useIsMobile.d.ts +8 -0
- package/dist/confirm/OneConfirmHost.vue.d.ts +2 -0
- package/dist/confirm/confirm.d.ts +10 -0
- package/dist/confirm/index.cjs +1 -0
- package/dist/confirm/index.d.ts +5 -0
- package/dist/confirm/index.js +59 -0
- package/dist/cursorList/OneCursorList.vue.d.ts +2 -0
- package/dist/cursorList/index.cjs +1 -0
- package/dist/cursorList/index.d.ts +3 -0
- package/dist/cursorList/index.js +78 -0
- package/dist/dataTable/index.cjs +1 -1
- package/dist/dataTable/index.js +256 -301
- package/dist/dateTime/OneDateTime.vue.d.ts +2 -0
- package/dist/dateTime/dateTime.d.ts +43 -0
- package/dist/dateTime/index.cjs +1 -0
- package/dist/dateTime/index.d.ts +3 -0
- package/dist/dateTime/index.js +66 -0
- package/dist/dropdown/index.cjs +1 -1
- package/dist/dropdown/index.js +302 -376
- package/dist/dropdown-5cb64ab7.cjs +1 -0
- package/dist/dropdown-c81fb945.js +101 -0
- package/dist/entityPicker/index.cjs +1 -1
- package/dist/entityPicker/index.js +57 -57
- package/dist/entityPicker/useEntityModal.d.ts +7 -3
- package/dist/errorsPage/OneCrashScreen.vue.d.ts +2 -0
- package/dist/errorsPage/OneErrorHero.vue.d.ts +2 -0
- package/dist/errorsPage/OneNotFoundPage.vue.d.ts +2 -0
- package/dist/errorsPage/OneServerErrorPage.vue.d.ts +2 -0
- package/dist/errorsPage/OneSnakeGame.vue.d.ts +2 -0
- package/dist/errorsPage/createAppErrorHandler.d.ts +24 -0
- package/dist/errorsPage/errorsType.d.ts +5 -0
- package/dist/errorsPage/index.cjs +1 -1
- package/dist/errorsPage/index.d.ts +8 -0
- package/dist/errorsPage/index.js +557 -28
- package/dist/errorsPage/useCrashState.d.ts +10 -0
- package/dist/fileUpload/OneDropzone.vue.d.ts +2 -0
- package/dist/fileUpload/OneFileUpload.vue.d.ts +2 -0
- package/dist/fileUpload/fileUpload.d.ts +17 -0
- package/dist/fileUpload/index.cjs +1 -0
- package/dist/fileUpload/index.d.ts +6 -0
- package/dist/fileUpload/index.js +228 -0
- package/dist/filterBuilder/OneFilterBuilder.vue.d.ts +2 -0
- package/dist/filterBuilder/OneFilterGroup.vue.d.ts +2 -0
- package/dist/filterBuilder/OneFilterRule.vue.d.ts +2 -0
- package/dist/filterBuilder/filterBuilder.d.ts +17 -0
- package/dist/filterBuilder/index.cjs +1 -0
- package/dist/filterBuilder/index.d.ts +5 -0
- package/dist/filterBuilder/index.js +257 -0
- package/dist/form/form.d.ts +1 -1
- package/dist/form/index.cjs +1 -1
- package/dist/form/index.js +66 -574
- package/dist/i18n/index.cjs +1 -1
- package/dist/i18n/index.js +99 -15
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +18 -0
- package/dist/index.js +242 -104
- package/dist/indicators/OneStatCard.vue.d.ts +2 -0
- package/dist/indicators/index.cjs +1 -1
- package/dist/indicators/index.d.ts +1 -0
- package/dist/indicators/index.js +66 -29
- package/dist/label/index.cjs +1 -1
- package/dist/label/index.js +5 -5
- package/dist/layout/OneAuthLayout.vue.d.ts +2 -0
- package/dist/layout/OneBackButton.vue.d.ts +2 -0
- package/dist/layout/OneBreadcrumbs.vue.d.ts +2 -0
- package/dist/layout/OneEmptyLayout.vue.d.ts +6 -0
- package/dist/layout/OneGridLayout.vue.d.ts +2 -0
- package/dist/layout/index.cjs +1 -1
- package/dist/layout/index.d.ts +6 -1
- package/dist/layout/index.js +1057 -765
- package/dist/layout/layout.d.ts +11 -0
- package/dist/modal/OneModalHost.vue.d.ts +2 -0
- package/dist/modal/index.cjs +1 -1
- package/dist/modal/index.d.ts +3 -0
- package/dist/modal/index.js +84 -27
- package/dist/modal/modal.d.ts +9 -0
- package/dist/modal/useModalStack.d.ts +20 -0
- package/dist/notifications/OneNotificationItem.vue.d.ts +2 -0
- package/dist/notifications/OneNotificationsBell.vue.d.ts +2 -0
- package/dist/notifications/OneNotificationsPanel.vue.d.ts +2 -0
- package/dist/notifications/index.cjs +1 -0
- package/dist/notifications/index.d.ts +7 -0
- package/dist/notifications/index.js +477 -0
- package/dist/notifications/notifications.d.ts +53 -0
- package/dist/notifications/useNotifyfeed.d.ts +32 -0
- package/dist/periodPicker/index.cjs +1 -1
- package/dist/periodPicker/index.js +126 -139
- package/dist/popover/OnePopover.vue.d.ts +2 -0
- package/dist/popover/index.cjs +1 -0
- package/dist/popover/index.d.ts +3 -0
- package/dist/popover/index.js +102 -0
- package/dist/popover/popover.d.ts +31 -0
- package/dist/progress/OneProgress.vue.d.ts +2 -0
- package/dist/progress/index.cjs +1 -0
- package/dist/progress/index.d.ts +3 -0
- package/dist/progress/index.js +74 -0
- package/dist/progress/progress.d.ts +32 -0
- package/dist/searchInput/OneSearchInput.vue.d.ts +2 -0
- package/dist/searchInput/index.cjs +1 -0
- package/dist/searchInput/index.d.ts +3 -0
- package/dist/searchInput/index.js +103 -0
- package/dist/searchInput/searchInput.d.ts +39 -0
- package/dist/settings/OneSettingsLayout.vue.d.ts +2 -0
- package/dist/settings/OneSettingsRow.vue.d.ts +2 -0
- package/dist/settings/OneSettingsSection.vue.d.ts +2 -0
- package/dist/settings/index.cjs +1 -0
- package/dist/settings/index.d.ts +4 -0
- package/dist/settings/index.js +116 -0
- package/dist/spinner/OneSpinner.vue.d.ts +2 -0
- package/dist/spinner/index.cjs +1 -0
- package/dist/spinner/index.d.ts +3 -0
- package/dist/spinner/index.js +30 -0
- package/dist/spinner/spinner.d.ts +10 -0
- package/dist/stageBadge/index.cjs +1 -1
- package/dist/stageBadge/index.js +18 -16
- package/dist/stepper/OneStepper.vue.d.ts +2 -0
- package/dist/stepper/index.cjs +1 -0
- package/dist/stepper/index.d.ts +3 -0
- package/dist/stepper/index.js +53 -0
- package/dist/stepper/stepper.d.ts +24 -0
- package/dist/style.css +1 -1
- package/dist/switch/index.cjs +1 -1
- package/dist/switch/index.js +3 -4
- package/dist/tabs/OneTab.vue.d.ts +2 -0
- package/dist/tabs/OneTabs.vue.d.ts +2 -0
- package/dist/tabs/index.cjs +1 -0
- package/dist/tabs/index.d.ts +4 -0
- package/dist/tabs/index.js +64 -0
- package/dist/tabs/tabs.d.ts +7 -0
- package/dist/toast/OneMascotToast.vue.d.ts +2 -0
- package/dist/toast/RabbitIcon.vue.d.ts +2 -0
- package/dist/toast/index.cjs +1 -1
- package/dist/toast/index.d.ts +4 -0
- package/dist/toast/index.js +139 -74
- package/dist/toast/useMascotToast.d.ts +12 -0
- package/dist/tooltip/OneTooltip.vue.d.ts +2 -0
- package/dist/tooltip/index.cjs +2 -2
- package/dist/tooltip/index.d.ts +1 -0
- package/dist/tooltip/index.js +33 -30
- package/dist/useConfirm-6344b49d.cjs +1 -0
- package/dist/useConfirm-74e99a5c.js +23 -0
- package/dist/useCursorList-5c1b57aa.js +62 -0
- package/dist/useCursorList-e1cb41e7.cjs +1 -0
- package/dist/useElementWidth-b36a7ce9.js +40 -0
- package/dist/useElementWidth-b3e53f48.cjs +1 -0
- package/dist/useFileUpload-228dbc07.js +24 -0
- package/dist/useFileUpload-f47622bb.cjs +1 -0
- package/dist/useIsMobile-7b1f08cf.cjs +1 -0
- package/dist/useIsMobile-98fc0cf9.js +7 -0
- package/dist/useMediaQuery-1d87df02.cjs +1 -0
- package/dist/useMediaQuery-77a19b18.js +37 -0
- package/dist/useModal-6a5d870b.js +30 -0
- package/dist/useModal-aa6f4a57.cjs +1 -0
- package/dist/userList/OneUserInviteModal.vue.d.ts +2 -0
- package/dist/userList/OneUserList.vue.d.ts +2 -0
- package/dist/userList/OneUserListItem.vue.d.ts +2 -0
- package/dist/userList/index.cjs +1 -0
- package/dist/userList/index.d.ts +4 -0
- package/dist/userList/index.js +559 -0
- package/dist/utils/clipboard.d.ts +6 -0
- package/dist/utils/format.d.ts +17 -0
- package/dist/utils/index.cjs +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +125 -0
- package/dist/utils/string.d.ts +25 -0
- package/dist/utils/versionChecker.d.ts +26 -0
- package/package.json +215 -24
- package/dist/ChevronRightIcon-7a2f0c20.cjs +0 -1
- package/dist/OneHelpMenu-c6e88d8f.cjs +0 -1
- package/dist/OneMarkdown.vue_vue_type_style_index_0_lang-0ea8fbf8.cjs +0 -1
- package/dist/OneMarkdown.vue_vue_type_style_index_0_lang-4ed993c7.js +0 -1
- package/dist/SpinnerIcon-ccb6f3fc.cjs +0 -1
- package/dist/SpinnerIcon.vue_vue_type_style_index_0_lang-0ea8fbf8.cjs +0 -1
- package/dist/SpinnerIcon.vue_vue_type_style_index_0_lang-4ed993c7.js +0 -1
- package/dist/useModal-0c73777f.cjs +0 -1
- package/dist/useModal-7fe9444b.js +0 -194
package/dist/errorsPage/index.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { defineComponent as O, computed as x, resolveComponent as U, openBlock as a, createElementBlock as c, createElementVNode as s, toDisplayString as r, createCommentVNode as h, createTextVNode as C, createVNode as E, withCtx as z, useSlots as ae, normalizeClass as R, renderSlot as F, ref as _, onMounted as le, onUnmounted as ue, normalizeStyle as ie, Fragment as ce, renderList as de, createSlots as Y, createBlock as P, unref as I, onBeforeUnmount as Z, watch as ve } from "vue";
|
|
2
|
+
import { useOnebI18n as L } from "../i18n/index.js";
|
|
3
|
+
import { _ as ee } from "../_plugin-vue_export-helper-dad06003.js";
|
|
4
|
+
import { useRouter as fe } from "vue-router";
|
|
5
|
+
import { OneButton as M } from "../button/index.js";
|
|
6
|
+
import { c as me } from "../clipboard-733b79a1.js";
|
|
7
|
+
import "../SpinnerIcon-516264ba.js";
|
|
8
|
+
const ye = {
|
|
4
9
|
statusMessage: {
|
|
5
10
|
type: String,
|
|
6
11
|
required: !1
|
|
@@ -16,48 +21,572 @@ const E = {
|
|
|
16
21
|
statusCode: {
|
|
17
22
|
type: String,
|
|
18
23
|
default: "403"
|
|
24
|
+
},
|
|
25
|
+
t: {
|
|
26
|
+
type: Function,
|
|
27
|
+
default: void 0
|
|
19
28
|
}
|
|
20
|
-
},
|
|
29
|
+
}, ge = O({
|
|
21
30
|
name: "ErrorPage",
|
|
22
|
-
props:
|
|
31
|
+
props: ye,
|
|
32
|
+
setup(e) {
|
|
33
|
+
const o = L();
|
|
34
|
+
return { t: x(() => e.t ?? o) };
|
|
35
|
+
}
|
|
23
36
|
});
|
|
24
|
-
const
|
|
37
|
+
const pe = { class: "error-container" }, _e = { class: "text-8xl text-secondary-content" }, he = { key: 0 }, xe = {
|
|
25
38
|
key: 1,
|
|
26
39
|
class: "pt-5"
|
|
27
|
-
},
|
|
28
|
-
function
|
|
29
|
-
const l =
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
}, be = { class: "request-info hidden" };
|
|
41
|
+
function ke(e, o, y, t, f, d) {
|
|
42
|
+
const l = U("router-link");
|
|
43
|
+
return a(), c("div", pe, [
|
|
44
|
+
s("h1", _e, r(e.statusCode), 1),
|
|
45
|
+
e.statusMessage ? (a(), c("p", he, r(e.statusMessage), 1)) : h("", !0),
|
|
46
|
+
o[3] || (o[3] = s("div", { class: "border-b border-secondary-stroke w-full pt-10" }, null, -1)),
|
|
47
|
+
e.statusText ? (a(), c("p", xe, r(e.statusText), 1)) : h("", !0),
|
|
48
|
+
s("div", be, [
|
|
49
|
+
s("p", null, [
|
|
50
|
+
o[0] || (o[0] = s("strong", null, "Request ID:", -1)),
|
|
51
|
+
C(" " + r(e.requestId), 1)
|
|
39
52
|
]),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
53
|
+
o[1] || (o[1] = s("button", { class: "copy-btn" }, "Скопіювати", -1)),
|
|
54
|
+
o[2] || (o[2] = s("p", null, [
|
|
55
|
+
C(" Передайте цю інформацію розробнику або напишіть в "),
|
|
56
|
+
s("a", {
|
|
44
57
|
href: "https://t.me/telegram_bot",
|
|
45
58
|
target: "_blank"
|
|
46
59
|
}, "Telegram-бот")
|
|
47
60
|
], -1))
|
|
48
61
|
]),
|
|
49
|
-
|
|
62
|
+
E(l, {
|
|
50
63
|
to: "/",
|
|
51
64
|
class: "home-link"
|
|
52
65
|
}, {
|
|
53
|
-
default:
|
|
54
|
-
|
|
55
|
-
])
|
|
66
|
+
default: z(() => [
|
|
67
|
+
C(r(e.t("ui.errors.go_home")), 1)
|
|
68
|
+
]),
|
|
56
69
|
_: 1
|
|
57
70
|
})
|
|
58
71
|
]);
|
|
59
72
|
}
|
|
60
|
-
const
|
|
73
|
+
const gt = /* @__PURE__ */ ee(ge, [["render", ke], ["__scopeId", "data-v-4ac01274"]]), we = { class: "flex items-center justify-center gap-2 sm:gap-4" }, Se = {
|
|
74
|
+
key: 0,
|
|
75
|
+
class: "relative"
|
|
76
|
+
}, $e = { class: "one-error-logo-bounce" }, Ce = ["src"], Ee = {
|
|
77
|
+
key: 0,
|
|
78
|
+
class: "absolute inset-0 animate-ping opacity-20",
|
|
79
|
+
"aria-hidden": "true"
|
|
80
|
+
}, Te = ["src"], D = "text-[100px] sm:text-[160px] font-bold text-secondary-stroke leading-none select-none", Oe = /* @__PURE__ */ O({
|
|
81
|
+
__name: "OneErrorHero",
|
|
82
|
+
props: {
|
|
83
|
+
left: {
|
|
84
|
+
type: String,
|
|
85
|
+
required: !0
|
|
86
|
+
},
|
|
87
|
+
/** Fallback digit shown when there is no logo (neither slot nor logoSrc). */
|
|
88
|
+
middle: {
|
|
89
|
+
type: String,
|
|
90
|
+
required: !0
|
|
91
|
+
},
|
|
92
|
+
right: {
|
|
93
|
+
type: String,
|
|
94
|
+
required: !0
|
|
95
|
+
},
|
|
96
|
+
logoSrc: {
|
|
97
|
+
type: String,
|
|
98
|
+
default: void 0
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
setup(e) {
|
|
102
|
+
const o = e, y = ae(), t = x(() => !!y.default), f = x(() => t.value || !!o.logoSrc);
|
|
103
|
+
return (d, l) => (a(), c("div", we, [
|
|
104
|
+
s("span", {
|
|
105
|
+
class: R(D)
|
|
106
|
+
}, r(e.left), 1),
|
|
107
|
+
f.value ? (a(), c("div", Se, [
|
|
108
|
+
s("div", $e, [
|
|
109
|
+
F(d.$slots, "default", {}, () => [
|
|
110
|
+
s("img", {
|
|
111
|
+
src: e.logoSrc,
|
|
112
|
+
class: "w-20 h-20 sm:w-28 sm:h-28",
|
|
113
|
+
alt: "Logo"
|
|
114
|
+
}, null, 8, Ce)
|
|
115
|
+
], !0)
|
|
116
|
+
]),
|
|
117
|
+
e.logoSrc && !t.value ? (a(), c("div", Ee, [
|
|
118
|
+
s("img", {
|
|
119
|
+
src: e.logoSrc,
|
|
120
|
+
class: "w-20 h-20 sm:w-28 sm:h-28",
|
|
121
|
+
alt: ""
|
|
122
|
+
}, null, 8, Te)
|
|
123
|
+
])) : h("", !0)
|
|
124
|
+
])) : (a(), c("span", {
|
|
125
|
+
key: 1,
|
|
126
|
+
class: R(D)
|
|
127
|
+
}, r(e.middle), 1)),
|
|
128
|
+
s("span", {
|
|
129
|
+
class: R(D)
|
|
130
|
+
}, r(e.right), 1)
|
|
131
|
+
]));
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
const te = /* @__PURE__ */ ee(Oe, [["__scopeId", "data-v-59d54d25"]]), qe = { class: "w-full" }, Ie = { class: "flex items-center justify-between mb-4" }, ze = { class: "flex items-center gap-4" }, Fe = { class: "text-sm text-secondary-base" }, Le = {
|
|
135
|
+
class: "text-success-content",
|
|
136
|
+
"data-test": "snake-score"
|
|
137
|
+
}, je = {
|
|
138
|
+
key: 0,
|
|
139
|
+
class: "text-sm text-danger-base font-medium",
|
|
140
|
+
"data-test": "snake-status"
|
|
141
|
+
}, Be = {
|
|
142
|
+
key: 1,
|
|
143
|
+
class: "text-sm text-success-content",
|
|
144
|
+
"data-test": "snake-status"
|
|
145
|
+
}, Re = {
|
|
146
|
+
key: 2,
|
|
147
|
+
class: "text-sm text-secondary-content",
|
|
148
|
+
"data-test": "snake-status"
|
|
149
|
+
}, Me = { class: "flex gap-2" }, Ge = { class: "bg-secondary-body-active border border-secondary-stroke rounded-20 p-4 shadow-sm" }, Ne = ["data-snake"], De = {
|
|
150
|
+
key: 0,
|
|
151
|
+
class: "absolute inset-1 rounded-md border border-success-active/40"
|
|
152
|
+
}, He = {
|
|
153
|
+
key: 1,
|
|
154
|
+
class: "absolute inset-2 rounded-sm bg-danger-base"
|
|
155
|
+
}, Pe = { class: "text-xs text-secondary-content text-center mt-3" }, Ue = /* @__PURE__ */ O({
|
|
156
|
+
__name: "OneSnakeGame",
|
|
157
|
+
props: {
|
|
158
|
+
gridSize: {
|
|
159
|
+
type: Number,
|
|
160
|
+
default: 15
|
|
161
|
+
},
|
|
162
|
+
tickMs: {
|
|
163
|
+
type: Number,
|
|
164
|
+
default: 170
|
|
165
|
+
},
|
|
166
|
+
t: {
|
|
167
|
+
type: Function,
|
|
168
|
+
default: void 0
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
emits: ["score", "game-over"],
|
|
172
|
+
setup(e, { expose: o, emit: y }) {
|
|
173
|
+
const t = e, f = y, d = L(), l = x(() => t.t ?? d), m = _([]), g = _({ x: 1, y: 0 }), k = _({ x: 1, y: 0 }), p = _({ x: 0, y: 0 }), w = _(0), b = _(!1), v = _(!1);
|
|
174
|
+
let T = null;
|
|
175
|
+
const oe = x(
|
|
176
|
+
() => Array.from({ length: t.gridSize * t.gridSize }, (u, n) => ({
|
|
177
|
+
x: n % t.gridSize,
|
|
178
|
+
y: Math.floor(n / t.gridSize)
|
|
179
|
+
}))
|
|
180
|
+
), G = (u) => {
|
|
181
|
+
var n, i;
|
|
182
|
+
return ((n = m.value[0]) == null ? void 0 : n.x) === u.x && ((i = m.value[0]) == null ? void 0 : i.y) === u.y;
|
|
183
|
+
}, A = (u) => m.value.some((n, i) => i !== 0 && n.x === u.x && n.y === u.y), N = (u) => p.value.x === u.x && p.value.y === u.y, V = (u) => {
|
|
184
|
+
const n = [];
|
|
185
|
+
for (let S = 0; S < t.gridSize; S += 1)
|
|
186
|
+
for (let $ = 0; $ < t.gridSize; $ += 1)
|
|
187
|
+
u.some((X) => X.x === $ && X.y === S) || n.push({ x: $, y: S });
|
|
188
|
+
if (n.length === 0)
|
|
189
|
+
return { x: 0, y: 0 };
|
|
190
|
+
const i = Math.floor(Math.random() * n.length);
|
|
191
|
+
return n[i];
|
|
192
|
+
}, j = () => {
|
|
193
|
+
T != null && (clearInterval(T), T = null), b.value = !1;
|
|
194
|
+
}, K = () => {
|
|
195
|
+
j(), v.value = !0, f("game-over", w.value);
|
|
196
|
+
}, q = () => {
|
|
197
|
+
j(), m.value = [
|
|
198
|
+
{
|
|
199
|
+
x: Math.floor(t.gridSize / 2),
|
|
200
|
+
y: Math.floor(t.gridSize / 2)
|
|
201
|
+
}
|
|
202
|
+
], g.value = { x: 1, y: 0 }, k.value = { x: 1, y: 0 }, p.value = V(m.value), w.value = 0, v.value = !1;
|
|
203
|
+
}, ne = (u) => {
|
|
204
|
+
g.value.x + u.x === 0 && g.value.y + u.y === 0 || (k.value = u);
|
|
205
|
+
}, re = () => {
|
|
206
|
+
g.value = k.value;
|
|
207
|
+
const u = m.value[0], n = { x: u.x + g.value.x, y: u.y + g.value.y };
|
|
208
|
+
if (n.x < 0 || n.x >= t.gridSize || n.y < 0 || n.y >= t.gridSize) {
|
|
209
|
+
K();
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
if (m.value.some(($) => $.x === n.x && $.y === n.y)) {
|
|
213
|
+
K();
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
const S = [n, ...m.value];
|
|
217
|
+
n.x === p.value.x && n.y === p.value.y ? (w.value += 1, f("score", w.value), p.value = V(S)) : S.pop(), m.value = S;
|
|
218
|
+
}, J = () => {
|
|
219
|
+
T != null || v.value || (b.value = !0, T = setInterval(re, t.tickMs));
|
|
220
|
+
}, Q = () => {
|
|
221
|
+
if (v.value) {
|
|
222
|
+
q();
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
b.value ? j() : J();
|
|
226
|
+
}, W = (u) => {
|
|
227
|
+
const n = u.key.toLowerCase(), i = {
|
|
228
|
+
arrowup: { x: 0, y: -1 },
|
|
229
|
+
w: { x: 0, y: -1 },
|
|
230
|
+
arrowdown: { x: 0, y: 1 },
|
|
231
|
+
s: { x: 0, y: 1 },
|
|
232
|
+
arrowleft: { x: -1, y: 0 },
|
|
233
|
+
a: { x: -1, y: 0 },
|
|
234
|
+
arrowright: { x: 1, y: 0 },
|
|
235
|
+
d: { x: 1, y: 0 }
|
|
236
|
+
};
|
|
237
|
+
i[n] ? (ne(i[n]), !b.value && !v.value && J()) : n === " " ? (u.preventDefault(), v.value || Q()) : n === "enter" && v.value && q();
|
|
238
|
+
};
|
|
239
|
+
return le(() => {
|
|
240
|
+
q(), window.addEventListener("keydown", W);
|
|
241
|
+
}), ue(() => {
|
|
242
|
+
j(), window.removeEventListener("keydown", W);
|
|
243
|
+
}), o({ score: w, isRunning: b, isGameOver: v, resetGame: q }), (u, n) => (a(), c("div", qe, [
|
|
244
|
+
s("div", Ie, [
|
|
245
|
+
s("div", ze, [
|
|
246
|
+
s("span", Fe, [
|
|
247
|
+
C(r(l.value("ui.errors.snake_score")) + ": ", 1),
|
|
248
|
+
s("strong", Le, r(w.value), 1)
|
|
249
|
+
]),
|
|
250
|
+
v.value ? (a(), c("span", je, r(l.value("ui.errors.snake_game_over")), 1)) : b.value ? (a(), c("span", Be, r(l.value("ui.errors.snake_running")), 1)) : (a(), c("span", Re, r(l.value("ui.errors.snake_paused")), 1))
|
|
251
|
+
]),
|
|
252
|
+
s("div", Me, [
|
|
253
|
+
s("button", {
|
|
254
|
+
type: "button",
|
|
255
|
+
class: "px-3 py-1.5 rounded-lg text-sm text-white bg-success-base hover:bg-success-hover transition",
|
|
256
|
+
"data-test": "snake-toggle",
|
|
257
|
+
onClick: Q
|
|
258
|
+
}, r(v.value ? l.value("ui.errors.snake_restart") : b.value ? l.value("ui.errors.snake_pause") : l.value("ui.errors.snake_start")), 1),
|
|
259
|
+
s("button", {
|
|
260
|
+
type: "button",
|
|
261
|
+
class: "px-3 py-1.5 rounded-lg text-sm border border-secondary-stroke text-secondary-base hover:bg-secondary-body-hover transition",
|
|
262
|
+
"data-test": "snake-reset",
|
|
263
|
+
onClick: q
|
|
264
|
+
}, r(l.value("ui.errors.snake_reset")), 1)
|
|
265
|
+
])
|
|
266
|
+
]),
|
|
267
|
+
s("div", Ge, [
|
|
268
|
+
s("div", {
|
|
269
|
+
class: "w-full mx-auto",
|
|
270
|
+
style: ie({ display: "grid", gridTemplateColumns: `repeat(${e.gridSize}, minmax(0, 1fr))` })
|
|
271
|
+
}, [
|
|
272
|
+
(a(!0), c(ce, null, de(oe.value, (i) => (a(), c("div", {
|
|
273
|
+
key: `${i.x}-${i.y}`,
|
|
274
|
+
class: R(["relative aspect-square border border-secondary-stroke/60", [
|
|
275
|
+
G(i) ? "bg-success-active shadow-inner" : A(i) ? "bg-success-25" : N(i) ? "bg-danger-glow" : "bg-white"
|
|
276
|
+
]]),
|
|
277
|
+
"data-test": "snake-cell",
|
|
278
|
+
"data-snake": G(i) ? "head" : A(i) ? "body" : N(i) ? "food" : void 0
|
|
279
|
+
}, [
|
|
280
|
+
G(i) ? (a(), c("div", De)) : N(i) ? (a(), c("div", He)) : h("", !0)
|
|
281
|
+
], 10, Ne))), 128))
|
|
282
|
+
], 4)
|
|
283
|
+
]),
|
|
284
|
+
s("p", Pe, r(l.value("ui.errors.snake_instructions")), 1)
|
|
285
|
+
]));
|
|
286
|
+
}
|
|
287
|
+
}), Ae = { class: "flex flex-col items-center justify-center p-4" }, Ve = { class: "text-center mb-8" }, Ke = { class: "text-xl text-secondary-base mt-2" }, Je = { class: "flex gap-4 mt-4" }, pt = /* @__PURE__ */ O({
|
|
288
|
+
__name: "OneNotFoundPage",
|
|
289
|
+
props: {
|
|
290
|
+
/** App logo shown between the digits; the #logo slot takes priority. */
|
|
291
|
+
logoSrc: {
|
|
292
|
+
type: String,
|
|
293
|
+
default: void 0
|
|
294
|
+
},
|
|
295
|
+
homeTo: {
|
|
296
|
+
type: [String, Object],
|
|
297
|
+
default: "/"
|
|
298
|
+
},
|
|
299
|
+
withGame: {
|
|
300
|
+
type: Boolean,
|
|
301
|
+
default: !0
|
|
302
|
+
},
|
|
303
|
+
t: {
|
|
304
|
+
type: Function,
|
|
305
|
+
default: void 0
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
setup(e) {
|
|
309
|
+
const o = e, y = L(), t = x(() => o.t ?? y), f = fe(), d = _(!1), l = () => {
|
|
310
|
+
f ? f.back() : typeof window < "u" && window.history.back();
|
|
311
|
+
};
|
|
312
|
+
return (m, g) => {
|
|
313
|
+
const k = U("RouterLink");
|
|
314
|
+
return a(), c("div", Ae, [
|
|
315
|
+
s("div", Ve, [
|
|
316
|
+
E(te, {
|
|
317
|
+
left: "4",
|
|
318
|
+
middle: "0",
|
|
319
|
+
right: "4",
|
|
320
|
+
"logo-src": e.logoSrc
|
|
321
|
+
}, Y({ _: 2 }, [
|
|
322
|
+
m.$slots.logo ? {
|
|
323
|
+
name: "default",
|
|
324
|
+
fn: z(() => [
|
|
325
|
+
F(m.$slots, "logo")
|
|
326
|
+
]),
|
|
327
|
+
key: "0"
|
|
328
|
+
} : void 0
|
|
329
|
+
]), 1032, ["logo-src"]),
|
|
330
|
+
s("p", Ke, r(t.value("ui.errors.page_not_found")), 1)
|
|
331
|
+
]),
|
|
332
|
+
e.withGame && !d.value ? (a(), P(I(M), {
|
|
333
|
+
key: 0,
|
|
334
|
+
variant: "success",
|
|
335
|
+
size: "lg",
|
|
336
|
+
label: t.value("ui.errors.play_snake"),
|
|
337
|
+
"data-test": "nf-play",
|
|
338
|
+
onClick: g[0] || (g[0] = (p) => d.value = !0)
|
|
339
|
+
}, null, 8, ["label"])) : h("", !0),
|
|
340
|
+
d.value ? (a(), P(Ue, {
|
|
341
|
+
key: 1,
|
|
342
|
+
class: "max-w-2xl",
|
|
343
|
+
t: t.value
|
|
344
|
+
}, null, 8, ["t"])) : h("", !0),
|
|
345
|
+
s("div", Je, [
|
|
346
|
+
E(k, {
|
|
347
|
+
to: e.homeTo,
|
|
348
|
+
class: "text-info-base hover:text-info-active underline text-sm",
|
|
349
|
+
"data-test": "nf-home"
|
|
350
|
+
}, {
|
|
351
|
+
default: z(() => [
|
|
352
|
+
C(r(t.value("ui.errors.go_home")), 1)
|
|
353
|
+
]),
|
|
354
|
+
_: 1
|
|
355
|
+
}, 8, ["to"]),
|
|
356
|
+
s("button", {
|
|
357
|
+
type: "button",
|
|
358
|
+
class: "text-secondary-base hover:text-secondary-hover underline text-sm",
|
|
359
|
+
"data-test": "nf-back",
|
|
360
|
+
onClick: l
|
|
361
|
+
}, r(t.value("ui.errors.go_back")), 1)
|
|
362
|
+
])
|
|
363
|
+
]);
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
}), Qe = { class: "flex flex-col items-center justify-center p-4" }, We = { class: "text-center mb-8" }, Xe = { class: "text-xl text-secondary-base mt-2" }, Ye = { class: "text-sm text-secondary-content mt-2 max-w-md mx-auto" }, Ze = {
|
|
367
|
+
key: 0,
|
|
368
|
+
class: "mb-6 text-sm text-secondary-base text-center",
|
|
369
|
+
"data-test": "se-request"
|
|
370
|
+
}, et = { class: "flex flex-col items-center gap-4" }, _t = /* @__PURE__ */ O({
|
|
371
|
+
__name: "OneServerErrorPage",
|
|
372
|
+
props: {
|
|
373
|
+
/** App logo shown between the digits; the #logo slot takes priority. */
|
|
374
|
+
logoSrc: {
|
|
375
|
+
type: String,
|
|
376
|
+
default: void 0
|
|
377
|
+
},
|
|
378
|
+
homeTo: {
|
|
379
|
+
type: [String, Object],
|
|
380
|
+
default: "/"
|
|
381
|
+
},
|
|
382
|
+
/** Backend request/trace id — shows the «Код запиту» block with a copy button. */
|
|
383
|
+
requestId: {
|
|
384
|
+
type: String,
|
|
385
|
+
default: void 0
|
|
386
|
+
},
|
|
387
|
+
t: {
|
|
388
|
+
type: Function,
|
|
389
|
+
default: void 0
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
setup(e) {
|
|
393
|
+
const o = e, y = L(), t = x(() => o.t ?? y), f = _(!1);
|
|
394
|
+
let d = null;
|
|
395
|
+
const l = async () => {
|
|
396
|
+
!o.requestId || !await me(o.requestId) || (f.value = !0, d != null && clearTimeout(d), d = setTimeout(() => {
|
|
397
|
+
f.value = !1, d = null;
|
|
398
|
+
}, 2e3));
|
|
399
|
+
}, m = () => {
|
|
400
|
+
window.location.reload();
|
|
401
|
+
};
|
|
402
|
+
return Z(() => {
|
|
403
|
+
d != null && clearTimeout(d);
|
|
404
|
+
}), (g, k) => {
|
|
405
|
+
const p = U("RouterLink");
|
|
406
|
+
return a(), c("div", Qe, [
|
|
407
|
+
s("div", We, [
|
|
408
|
+
E(te, {
|
|
409
|
+
left: "5",
|
|
410
|
+
middle: "0",
|
|
411
|
+
right: "0",
|
|
412
|
+
"logo-src": e.logoSrc
|
|
413
|
+
}, Y({ _: 2 }, [
|
|
414
|
+
g.$slots.logo ? {
|
|
415
|
+
name: "default",
|
|
416
|
+
fn: z(() => [
|
|
417
|
+
F(g.$slots, "logo")
|
|
418
|
+
]),
|
|
419
|
+
key: "0"
|
|
420
|
+
} : void 0
|
|
421
|
+
]), 1032, ["logo-src"]),
|
|
422
|
+
s("p", Xe, r(t.value("ui.errors.server_error")), 1),
|
|
423
|
+
s("p", Ye, r(t.value("ui.errors.server_error_hint")), 1)
|
|
424
|
+
]),
|
|
425
|
+
e.requestId ? (a(), c("div", Ze, [
|
|
426
|
+
C(r(t.value("ui.errors.request_id")) + ": ", 1),
|
|
427
|
+
s("strong", null, r(e.requestId), 1),
|
|
428
|
+
s("button", {
|
|
429
|
+
type: "button",
|
|
430
|
+
class: "ml-2 text-info-base hover:text-info-active underline",
|
|
431
|
+
"data-test": "se-copy",
|
|
432
|
+
onClick: l
|
|
433
|
+
}, r(f.value ? t.value("ui.errors.copied") : t.value("ui.errors.copy")), 1)
|
|
434
|
+
])) : h("", !0),
|
|
435
|
+
s("div", et, [
|
|
436
|
+
E(I(M), {
|
|
437
|
+
variant: "primary",
|
|
438
|
+
size: "lg",
|
|
439
|
+
label: t.value("ui.errors.reload_page"),
|
|
440
|
+
"data-test": "se-reload",
|
|
441
|
+
onClick: m
|
|
442
|
+
}, null, 8, ["label"]),
|
|
443
|
+
F(g.$slots, "support"),
|
|
444
|
+
E(p, {
|
|
445
|
+
to: e.homeTo,
|
|
446
|
+
class: "text-info-base hover:text-info-active underline text-sm",
|
|
447
|
+
"data-test": "se-home"
|
|
448
|
+
}, {
|
|
449
|
+
default: z(() => [
|
|
450
|
+
C(r(t.value("ui.errors.go_home")), 1)
|
|
451
|
+
]),
|
|
452
|
+
_: 1
|
|
453
|
+
}, 8, ["to"])
|
|
454
|
+
])
|
|
455
|
+
]);
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
}), B = _(!1), H = _(null);
|
|
459
|
+
function se() {
|
|
460
|
+
return { show: B, error: H, trigger: (y) => {
|
|
461
|
+
B.value || (H.value = y, B.value = !0);
|
|
462
|
+
}, dismiss: () => {
|
|
463
|
+
B.value = !1, H.value = null;
|
|
464
|
+
} };
|
|
465
|
+
}
|
|
466
|
+
const tt = {
|
|
467
|
+
key: 0,
|
|
468
|
+
class: "fixed inset-0 z-[10000] flex items-center justify-center bg-secondary-body p-6",
|
|
469
|
+
role: "alert",
|
|
470
|
+
"aria-live": "assertive",
|
|
471
|
+
"data-test": "crash-screen"
|
|
472
|
+
}, st = { class: "flex w-full max-w-[480px] flex-col items-center text-center" }, ot = {
|
|
473
|
+
key: 0,
|
|
474
|
+
class: "mb-6"
|
|
475
|
+
}, nt = ["src"], rt = { class: "mb-3 text-2xl font-semibold" }, at = {
|
|
476
|
+
class: "mb-8 text-base text-secondary-base",
|
|
477
|
+
"data-test": "crash-message"
|
|
478
|
+
}, lt = {
|
|
479
|
+
key: 2,
|
|
480
|
+
"data-test": "crash-details",
|
|
481
|
+
class: "mt-6 text-xs text-secondary-content"
|
|
482
|
+
}, ht = /* @__PURE__ */ O({
|
|
483
|
+
__name: "OneCrashScreen",
|
|
484
|
+
props: {
|
|
485
|
+
/** App logo above the title; the #logo slot takes priority. */
|
|
486
|
+
logoSrc: {
|
|
487
|
+
type: String,
|
|
488
|
+
default: void 0
|
|
489
|
+
},
|
|
490
|
+
/** Account portal URL — the second button shows only when set. */
|
|
491
|
+
accountUrl: {
|
|
492
|
+
type: String,
|
|
493
|
+
default: void 0
|
|
494
|
+
},
|
|
495
|
+
autoReloadSeconds: {
|
|
496
|
+
type: Number,
|
|
497
|
+
default: 10
|
|
498
|
+
},
|
|
499
|
+
/**
|
|
500
|
+
* Disables auto-reload («Перезавантажте сторінку вручну») — e.g. when the
|
|
501
|
+
* app counted too many reload attempts (invoice MAX_AUTO_RELOAD_ATTEMPTS).
|
|
502
|
+
*/
|
|
503
|
+
persistent: {
|
|
504
|
+
type: Boolean,
|
|
505
|
+
default: !1
|
|
506
|
+
},
|
|
507
|
+
/** Shows `err.name: err.message` under the buttons (debug builds). */
|
|
508
|
+
showDetails: {
|
|
509
|
+
type: Boolean,
|
|
510
|
+
default: !1
|
|
511
|
+
},
|
|
512
|
+
t: {
|
|
513
|
+
type: Function,
|
|
514
|
+
default: void 0
|
|
515
|
+
}
|
|
516
|
+
},
|
|
517
|
+
setup(e) {
|
|
518
|
+
const o = e, y = L(), t = x(() => o.t ?? y), { show: f, error: d } = se(), l = _(o.autoReloadSeconds);
|
|
519
|
+
let m = null;
|
|
520
|
+
const g = x(() => {
|
|
521
|
+
const v = d.value;
|
|
522
|
+
return v instanceof Error ? `${v.name}: ${v.message}` : String(v ?? "Unknown error");
|
|
523
|
+
}), k = x(() => o.persistent ? t.value("ui.crash.persistent") : l.value > 0 ? t.value("ui.crash.countdown", { n: l.value }) : t.value("ui.crash.reloading")), p = () => {
|
|
524
|
+
m != null && (clearInterval(m), m = null);
|
|
525
|
+
}, w = () => {
|
|
526
|
+
p(), window.location.reload();
|
|
527
|
+
}, b = () => {
|
|
528
|
+
o.accountUrl && (p(), window.location.href = o.accountUrl);
|
|
529
|
+
};
|
|
530
|
+
return ve(
|
|
531
|
+
f,
|
|
532
|
+
(v) => {
|
|
533
|
+
p(), v && (l.value = o.autoReloadSeconds, !o.persistent && (m = setInterval(() => {
|
|
534
|
+
l.value -= 1, l.value <= 0 && (p(), window.location.reload());
|
|
535
|
+
}, 1e3)));
|
|
536
|
+
},
|
|
537
|
+
{ immediate: !0 }
|
|
538
|
+
), Z(() => {
|
|
539
|
+
p();
|
|
540
|
+
}), (v, T) => I(f) ? (a(), c("div", tt, [
|
|
541
|
+
s("div", st, [
|
|
542
|
+
e.logoSrc || v.$slots.logo ? (a(), c("div", ot, [
|
|
543
|
+
F(v.$slots, "logo", {}, () => [
|
|
544
|
+
s("img", {
|
|
545
|
+
src: e.logoSrc,
|
|
546
|
+
alt: "",
|
|
547
|
+
class: "h-20 w-20"
|
|
548
|
+
}, null, 8, nt)
|
|
549
|
+
])
|
|
550
|
+
])) : h("", !0),
|
|
551
|
+
s("h1", rt, r(t.value("ui.crash.title")), 1),
|
|
552
|
+
s("p", at, r(k.value), 1),
|
|
553
|
+
E(I(M), {
|
|
554
|
+
class: "w-full mb-3",
|
|
555
|
+
variant: "primary",
|
|
556
|
+
label: t.value("ui.crash.reload_now"),
|
|
557
|
+
"data-test": "crash-reload",
|
|
558
|
+
onClick: w
|
|
559
|
+
}, null, 8, ["label"]),
|
|
560
|
+
e.accountUrl ? (a(), P(I(M), {
|
|
561
|
+
key: 1,
|
|
562
|
+
class: "w-full",
|
|
563
|
+
variant: "secondary",
|
|
564
|
+
label: t.value("ui.crash.open_account"),
|
|
565
|
+
"data-test": "crash-account",
|
|
566
|
+
onClick: b
|
|
567
|
+
}, null, 8, ["label"])) : h("", !0),
|
|
568
|
+
e.showDetails ? (a(), c("p", lt, r(g.value), 1)) : h("", !0)
|
|
569
|
+
])
|
|
570
|
+
])) : h("", !0);
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
function xt(e = {}) {
|
|
574
|
+
const o = e.criticalInfos ?? ["setup function", "render function"];
|
|
575
|
+
return (y, t, f) => {
|
|
576
|
+
var d;
|
|
577
|
+
try {
|
|
578
|
+
(d = e.onError) == null || d.call(e, y, f);
|
|
579
|
+
} catch {
|
|
580
|
+
}
|
|
581
|
+
console.error("[Vue Error]", y, f), o.includes(f) && (e.onCritical ?? se().trigger)(y);
|
|
582
|
+
};
|
|
583
|
+
}
|
|
61
584
|
export {
|
|
62
|
-
|
|
585
|
+
ht as OneCrashScreen,
|
|
586
|
+
gt as OneErrorPage,
|
|
587
|
+
pt as OneNotFoundPage,
|
|
588
|
+
_t as OneServerErrorPage,
|
|
589
|
+
Ue as OneSnakeGame,
|
|
590
|
+
xt as createAppErrorHandler,
|
|
591
|
+
se as useCrashState
|
|
63
592
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
export interface CrashState {
|
|
3
|
+
show: Ref<boolean>;
|
|
4
|
+
error: Ref<unknown>;
|
|
5
|
+
/** Shows the crash screen. Ignored while one is already shown (first error wins). */
|
|
6
|
+
trigger: (err: unknown) => void;
|
|
7
|
+
/** Hides the crash screen and clears the stored error. */
|
|
8
|
+
dismiss: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function useCrashState(): CrashState;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface FileUploadError {
|
|
2
|
+
code: 'size' | 'type';
|
|
3
|
+
file: File;
|
|
4
|
+
}
|
|
5
|
+
export interface FileValidationOptions {
|
|
6
|
+
accept?: string;
|
|
7
|
+
maxSizeMb?: number;
|
|
8
|
+
multiple?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Validates picked/dropped files against accept + maxSizeMb, shared by
|
|
12
|
+
* OneFileUpload and OneDropzone. Returns accepted files and typed errors.
|
|
13
|
+
*/
|
|
14
|
+
export declare const validateFiles: (files: File[], opts: FileValidationOptions) => {
|
|
15
|
+
accepted: File[];
|
|
16
|
+
errors: FileUploadError[];
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("../useFileUpload-f47622bb.cjs"),e=require("vue"),S=require("../spinner/index.cjs"),x=require("../i18n/index.cjs"),z=require("../button/index.cjs");require("../SpinnerIcon-01be39fe.cjs");require("../_plugin-vue_export-helper-f246444f.cjs");function D(t,o){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5"})])}const w=(t,o)=>o?o.split(",").map(l=>l.trim().toLowerCase()).some(l=>l?l.startsWith(".")?t.name.toLowerCase().endsWith(l):l.endsWith("/*")?t.type.toLowerCase().startsWith(l.slice(0,-1)):t.type.toLowerCase()===l:!1):!0,v=(t,o)=>{const l=[],r=[],u=o.multiple?t:t.slice(0,1);for(const n of u){if(!w(n,o.accept)){r.push({code:"type",file:n});continue}if(o.maxSizeMb!=null&&n.size>o.maxSizeMb*1024*1024){r.push({code:"size",file:n});continue}l.push(n)}return{accepted:l,errors:r}},C={key:2,class:"text-[#525B66] font-medium"},E={key:3,class:"text-[#525B66]"},N=["accept","multiple","disabled"],F=e.defineComponent({__name:"OneFileUpload",props:{label:{type:String,default:""},accept:{type:String,default:void 0},multiple:{type:Boolean,default:!1},maxSizeMb:{type:Number,default:void 0},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},t:{type:Function,default:void 0}},emits:["files","error"],setup(t,{emit:o}){const l=t,r=o,u=x.useOnebI18n(),n=e.computed(()=>l.t??u),s=c=>{const d=c.target,p=Array.from(d.files??[]);if(d.value="",p.length===0)return;const{accepted:f,errors:b}=v(p,{accept:l.accept,maxSizeMb:l.maxSizeMb,multiple:l.multiple});b.forEach(g=>r("error",g)),f.length>0&&r("files",f)};return(c,d)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["hover:text-blue-500 cursor-pointer text-sm w-full h-full flex items-center border hover:bg-gray-50 px-3 py-2 rounded-md gap-3",{"opacity-60 cursor-not-allowed pointer-events-none":t.disabled}])},[t.loading?(e.openBlock(),e.createBlock(e.unref(S.OneSpinner),{key:0,size:"sm"})):(e.openBlock(),e.createBlock(e.unref(D),{key:1,class:"w-4 h-4 text-[#525B66]"})),t.loading?(e.openBlock(),e.createElementBlock("span",E,e.toDisplayString(n.value("ui.file_upload.uploading"))+"...",1)):(e.openBlock(),e.createElementBlock("span",C,e.toDisplayString(t.label||n.value("ui.file_upload.select")),1)),e.createElementVNode("input",{class:"hidden",type:"file",accept:t.accept,multiple:t.multiple,disabled:t.disabled,onChange:s},null,40,N)],2))}}),M=["accept","multiple","disabled"],V={class:"text-base font-medium text-gray-900"},O={class:"text-xs text-gray-500"},q={key:0,class:"mt-4 text-sm text-gray-700"},L={class:"font-semibold"},j=e.defineComponent({__name:"OneDropzone",props:{accept:{type:String,default:void 0},multiple:{type:Boolean,default:!1},maxSizeMb:{type:Number,default:void 0},disabled:{type:Boolean,default:!1},hint:{type:String,default:""},help:{type:String,default:""},buttonLabel:{type:String,default:""},t:{type:Function,default:void 0}},emits:["files","error"],setup(t,{emit:o}){const l=t,r=o,u=x.useOnebI18n(),n=e.computed(()=>l.t??u),s=e.ref(!1),c=e.ref([]),d=e.ref(null),p=a=>{const i=Array.from(a??[]);if(i.length===0)return;const{accepted:m,errors:B}=v(i,{accept:l.accept,maxSizeMb:l.maxSizeMb,multiple:l.multiple});B.forEach(y=>r("error",y)),m.length>0&&(c.value=m.map(y=>y.name),r("files",m))},f=a=>{var i;a.preventDefault(),s.value=!1,!l.disabled&&p(((i=a.dataTransfer)==null?void 0:i.files)??null)},b=a=>{a.preventDefault(),!l.disabled&&(s.value=!0)},g=a=>{if(l.disabled)return;const i=a.target;p(i.files),i.value=""},h=()=>{var a;l.disabled||(a=d.value)==null||a.click()};return(a,i)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["border-2 border-dashed rounded-xl bg-white p-6 flex flex-col items-center justify-center text-center transition-colors",{"border-blue-500 bg-blue-50":s.value&&!t.disabled,"border-gray-300":!s.value||t.disabled,"opacity-60 cursor-not-allowed":t.disabled}]),"data-test":"dropzone",onDrop:f,onDragover:b,onDragleave:i[0]||(i[0]=m=>s.value=!1)},[e.createElementVNode("input",{ref_key:"inputRef",ref:d,type:"file",accept:t.accept,multiple:t.multiple,class:"hidden",disabled:t.disabled,onChange:g},null,40,M),e.renderSlot(a.$slots,"default",{isDragging:s.value,openPicker:h},()=>[e.createElementVNode("div",{class:"cursor-pointer flex flex-col items-center gap-2",onClick:h},[e.createElementVNode("span",V,e.toDisplayString(t.hint||n.value("ui.dropzone.hint")),1),e.createElementVNode("span",O,e.toDisplayString(t.help||n.value("ui.dropzone.help")),1)]),e.createVNode(e.unref(z.OneButton),{type:"button",variant:"primary",class:"mt-3",label:t.buttonLabel||n.value("ui.dropzone.choose"),disabled:t.disabled,onClick:h},null,8,["label","disabled"]),c.value.length?(e.openBlock(),e.createElementBlock("div",q,[e.createTextVNode(e.toDisplayString(n.value("ui.dropzone.selected"))+": ",1),e.createElementVNode("span",L,e.toDisplayString(c.value.join(", ")),1)])):e.createCommentVNode("",!0)])],34))}});exports.useFileUpload=k.useFileUpload;exports.OneDropzone=j;exports.OneFileUpload=F;exports.validateFiles=v;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as OneFileUpload } from './OneFileUpload.vue';
|
|
2
|
+
export { default as OneDropzone } from './OneDropzone.vue';
|
|
3
|
+
export { validateFiles } from './fileUpload';
|
|
4
|
+
export type { FileUploadError, FileValidationOptions } from './fileUpload';
|
|
5
|
+
export { useFileUpload } from '../composables/useFileUpload';
|
|
6
|
+
export type { UseFileUploadOptions, UseFileUploadReturn } from '../composables/useFileUpload';
|