@kernel4632/kima 0.0.0-stage → 0.6.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/LICENSE +21 -0
- package/README.md +166 -2
- package/dist/THIRD_PARTY_NOTICES.txt +2676 -0
- package/dist/kima-elements-core.js +53209 -0
- package/dist/kima-elements.js +126371 -0
- package/dist/kima-theme.js +1583 -0
- package/dist/kima.js +141 -0
- package/dist/style.css +2 -0
- package/dist/vue/_virtual/_plugin-vue_export-helper.js +7 -0
- package/dist/vue/components/advanced-input/calendar.ce.js +216 -0
- package/dist/vue/components/advanced-input/date-range-picker.ce.js +224 -0
- package/dist/vue/components/advanced-input/editable.ce.js +160 -0
- package/dist/vue/components/advanced-input/mention.ce.js +181 -0
- package/dist/vue/components/advanced-input/range-slider.ce.js +111 -0
- package/dist/vue/components/advanced-input/time-range-picker.ce.js +120 -0
- package/dist/vue/components/advanced-input/transfer.ce.js +192 -0
- package/dist/vue/components/content/chart.ce.js +282 -0
- package/dist/vue/components/content/code-editor.ce.js +309 -0
- package/dist/vue/components/content/equation.ce.js +69 -0
- package/dist/vue/components/content/heatmap.ce.js +148 -0
- package/dist/vue/components/content/rich-text-editor.ce.js +319 -0
- package/dist/vue/components/core/badge.ce.js +66 -0
- package/dist/vue/components/core/button-group.ce.js +142 -0
- package/dist/vue/components/core/button.ce.js +73 -0
- package/dist/vue/components/core/card.ce.js +73 -0
- package/dist/vue/components/core/cascader.ce.js +329 -0
- package/dist/vue/components/core/checkbox.ce.js +116 -0
- package/dist/vue/components/core/code-block.ce.js +108 -0
- package/dist/vue/components/core/combobox.ce.js +354 -0
- package/dist/vue/components/core/date-picker.ce.js +433 -0
- package/dist/vue/components/core/dialog.ce.js +118 -0
- package/dist/vue/components/core/divider.ce.js +49 -0
- package/dist/vue/components/core/drawer.ce.js +235 -0
- package/dist/vue/components/core/empty-state.ce.js +58 -0
- package/dist/vue/components/core/icon-button.ce.js +93 -0
- package/dist/vue/components/core/icon.ce.js +42 -0
- package/dist/vue/components/core/layout.ce.js +68 -0
- package/dist/vue/components/core/menu.ce.js +178 -0
- package/dist/vue/components/core/notification.ce.js +158 -0
- package/dist/vue/components/core/pagination.ce.js +158 -0
- package/dist/vue/components/core/progress.ce.js +49 -0
- package/dist/vue/components/core/select.ce.js +325 -0
- package/dist/vue/components/core/slider.ce.js +116 -0
- package/dist/vue/components/core/switch.ce.js +100 -0
- package/dist/vue/components/core/tabs.ce.js +193 -0
- package/dist/vue/components/core/text-field.ce.js +194 -0
- package/dist/vue/components/core/time-picker.ce.js +486 -0
- package/dist/vue/components/core/tooltip.ce.js +125 -0
- package/dist/vue/components/core/tree.ce.js +248 -0
- package/dist/vue/components/core/virtual-scroll.ce.js +176 -0
- package/dist/vue/components/data/copy-button.ce.js +75 -0
- package/dist/vue/components/data/image-preview.ce.js +226 -0
- package/dist/vue/components/data/infinite-scroll.ce.js +126 -0
- package/dist/vue/components/data/long-text.ce.js +70 -0
- package/dist/vue/components/data/relative-time.ce.js +77 -0
- package/dist/vue/components/data/ring-progress.ce.js +87 -0
- package/dist/vue/components/data/table.ce.js +491 -0
- package/dist/vue/components/data/virtual-table.ce.js +178 -0
- package/dist/vue/components/data/virtual-tree.ce.js +213 -0
- package/dist/vue/components/display/alert.ce.js +101 -0
- package/dist/vue/components/display/avatar-group.ce.js +65 -0
- package/dist/vue/components/display/avatar.ce.js +84 -0
- package/dist/vue/components/display/blockquote.ce.js +44 -0
- package/dist/vue/components/display/countdown.ce.js +77 -0
- package/dist/vue/components/display/descriptions.ce.js +43 -0
- package/dist/vue/components/display/highlight.ce.js +48 -0
- package/dist/vue/components/display/image.ce.js +146 -0
- package/dist/vue/components/display/list.ce.js +68 -0
- package/dist/vue/components/display/result.ce.js +57 -0
- package/dist/vue/components/display/skeleton.ce.js +67 -0
- package/dist/vue/components/display/spinner.ce.js +42 -0
- package/dist/vue/components/display/statistic.ce.js +71 -0
- package/dist/vue/components/display/timeline.ce.js +59 -0
- package/dist/vue/components/form-completion/angle-slider.ce.js +103 -0
- package/dist/vue/components/form-completion/color-picker.ce.js +286 -0
- package/dist/vue/components/form-completion/date-field.ce.js +131 -0
- package/dist/vue/components/form-completion/dynamic-input.ce.js +158 -0
- package/dist/vue/components/form-completion/form.ce.js +248 -0
- package/dist/vue/components/form-completion/json-input.ce.js +114 -0
- package/dist/vue/components/form-completion/masked-input.ce.js +88 -0
- package/dist/vue/components/form-completion/period-picker.ce.js +147 -0
- package/dist/vue/components/form-completion/time-field.ce.js +120 -0
- package/dist/vue/components/form-completion/upload-manager.ce.js +223 -0
- package/dist/vue/components/foundation/banner.ce.js +106 -0
- package/dist/vue/components/foundation/error-state.ce.js +108 -0
- package/dist/vue/components/foundation/field-group.ce.js +146 -0
- package/dist/vue/components/foundation/flex.ce.js +60 -0
- package/dist/vue/components/foundation/grid.ce.js +52 -0
- package/dist/vue/components/foundation/input-group.ce.js +34 -0
- package/dist/vue/components/foundation/page-header.ce.js +55 -0
- package/dist/vue/components/foundation/time-display.ce.js +129 -0
- package/dist/vue/components/foundation/typography.ce.js +71 -0
- package/dist/vue/components/input/checkbox-group.ce.js +93 -0
- package/dist/vue/components/input/field.ce.js +74 -0
- package/dist/vue/components/input/file-upload.ce.js +142 -0
- package/dist/vue/components/input/number-field.ce.js +103 -0
- package/dist/vue/components/input/pin-input.ce.js +112 -0
- package/dist/vue/components/input/radio-group.ce.js +96 -0
- package/dist/vue/components/input/rating.ce.js +115 -0
- package/dist/vue/components/input/tags-input.ce.js +153 -0
- package/dist/vue/components/input/textarea.ce.js +180 -0
- package/dist/vue/components/input/toggle.ce.js +58 -0
- package/dist/vue/components/interaction/chip.ce.js +95 -0
- package/dist/vue/components/interaction/command.ce.js +161 -0
- package/dist/vue/components/interaction/context-menu.ce.js +113 -0
- package/dist/vue/components/interaction/hover-card.ce.js +92 -0
- package/dist/vue/components/interaction/loading-overlay.ce.js +70 -0
- package/dist/vue/components/interaction/menubar.ce.js +134 -0
- package/dist/vue/components/interaction/multi-select.ce.js +264 -0
- package/dist/vue/components/interaction/popconfirm.ce.js +95 -0
- package/dist/vue/components/interaction/popover.ce.js +83 -0
- package/dist/vue/components/interaction/tree-select.ce.js +195 -0
- package/dist/vue/components/navigation/accordion.ce.js +114 -0
- package/dist/vue/components/navigation/anchor.ce.js +125 -0
- package/dist/vue/components/navigation/back-top.ce.js +67 -0
- package/dist/vue/components/navigation/breadcrumb.ce.js +48 -0
- package/dist/vue/components/navigation/carousel.ce.js +114 -0
- package/dist/vue/components/navigation/collapsible.ce.js +57 -0
- package/dist/vue/components/navigation/link.ce.js +62 -0
- package/dist/vue/components/navigation/navigation-menu.ce.js +91 -0
- package/dist/vue/components/navigation/overflow-list.ce.js +67 -0
- package/dist/vue/components/navigation/scroll-area.ce.js +47 -0
- package/dist/vue/components/navigation/splitter.ce.js +131 -0
- package/dist/vue/components/navigation/stepper.ce.js +74 -0
- package/dist/vue/components/navigation/toolbar.ce.js +93 -0
- package/dist/vue/components/navigation/visually-hidden.ce.js +16 -0
- package/dist/vue/components/shell/app-shell.ce.js +87 -0
- package/dist/vue/components/shell/config-provider.ce.js +110 -0
- package/dist/vue/components/shell/marquee.ce.js +92 -0
- package/dist/vue/components/shell/masonry.ce.js +50 -0
- package/dist/vue/components/shell/sidebar.ce.js +125 -0
- package/dist/vue/components/utility/affix.ce.js +64 -0
- package/dist/vue/components/utility/alert-dialog.ce.js +124 -0
- package/dist/vue/components/utility/animated-number.ce.js +66 -0
- package/dist/vue/components/utility/float-button.ce.js +104 -0
- package/dist/vue/components/utility/listbox.ce.js +81 -0
- package/dist/vue/components/utility/loading-bar.ce.js +85 -0
- package/dist/vue/components/utility/log-viewer.ce.js +124 -0
- package/dist/vue/components/utility/notification-queue.ce.js +109 -0
- package/dist/vue/components/utility/progress-group.ce.js +59 -0
- package/dist/vue/components/utility/qr-code.ce.js +62 -0
- package/dist/vue/components/utility/tag-group.ce.js +124 -0
- package/dist/vue/components/utility/tour.ce.js +214 -0
- package/dist/vue/components/utility/virtual-select.ce.js +207 -0
- package/dist/vue/components/utility/watermark.ce.js +44 -0
- package/dist/vue/internal/menu-items.js +184 -0
- package/dist/vue/internal/navigation-items.js +110 -0
- package/dist/vue/utils/code-highlight.js +142 -0
- package/dist/vue/utils/config.js +47 -0
- package/dist/vue/utils/content-motion.js +37 -0
- package/dist/vue/utils/content.js +83 -0
- package/dist/vue/utils/display-status.js +31 -0
- package/dist/vue/utils/foundation.js +65 -0
- package/dist/vue/utils/input-state.js +38 -0
- package/dist/vue/utils/interaction.js +103 -0
- package/dist/vue/utils/local-date.js +48 -0
- package/dist/vue/utils/motion.js +80 -0
- package/dist/vue/utils/native-slots.js +30 -0
- package/dist/vue/utils/navigation.js +44 -0
- package/dist/vue/utils/notifications.js +60 -0
- package/dist/vue/utils/qr.js +20 -0
- package/dist/vue/utils/remote-options.js +65 -0
- package/dist/vue/utils/ripple.js +20 -0
- package/dist/vue/utils/scoped-slots.js +22 -0
- package/dist/vue/utils/shell.js +43 -0
- package/dist/vue/utils/theme.js +50 -0
- package/dist/vue/utils/utility-choice.js +56 -0
- package/package.json +99 -4
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { computed as e, inject as t, onBeforeUnmount as n, onMounted as r, ref as i } from "vue";
|
|
2
|
+
// src/utils/config.js
|
|
3
|
+
var a = Symbol.for("kima.config"), o = Object.freeze({
|
|
4
|
+
locale: "zh-CN",
|
|
5
|
+
direction: "ltr",
|
|
6
|
+
reducedMotion: "system",
|
|
7
|
+
theme: "dark"
|
|
8
|
+
});
|
|
9
|
+
function s(s) {
|
|
10
|
+
let c = t(a, null), l = i({}), u;
|
|
11
|
+
return r(() => {
|
|
12
|
+
function e() {
|
|
13
|
+
let e = s.value?.$el || s.value, t = {};
|
|
14
|
+
for (let n = e?.parentElement; n; n = n.parentElement) if (n.hasAttribute("data-kima-config")) for (let e of [
|
|
15
|
+
"locale",
|
|
16
|
+
"direction",
|
|
17
|
+
"reducedMotion",
|
|
18
|
+
"theme",
|
|
19
|
+
"seed",
|
|
20
|
+
"variant"
|
|
21
|
+
]) {
|
|
22
|
+
let r = `data-kima-${e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`)}`;
|
|
23
|
+
t[e] == null && n.hasAttribute(r) && (t[e] = n.getAttribute(r));
|
|
24
|
+
}
|
|
25
|
+
l.value = t;
|
|
26
|
+
}
|
|
27
|
+
let t = s.value?.$el || s.value;
|
|
28
|
+
u = new MutationObserver(e), u.observe(t.ownerDocument.documentElement, {
|
|
29
|
+
attributes: !0,
|
|
30
|
+
subtree: !0,
|
|
31
|
+
childList: !0,
|
|
32
|
+
attributeFilter: [
|
|
33
|
+
"data-kima-locale",
|
|
34
|
+
"data-kima-direction",
|
|
35
|
+
"data-kima-reduced-motion",
|
|
36
|
+
"data-kima-theme",
|
|
37
|
+
"data-kima-seed",
|
|
38
|
+
"data-kima-variant"
|
|
39
|
+
]
|
|
40
|
+
}), e();
|
|
41
|
+
}), n(() => u?.disconnect()), e(() => ({
|
|
42
|
+
...o,
|
|
43
|
+
...c?.value || {},
|
|
44
|
+
...l.value
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
export { o as defaultConfig, a as kimaConfigKey, s as useKimaConfig };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { prefersReducedMotion as e } from "./motion.js";
|
|
2
|
+
import { nextTick as t, onBeforeUnmount as n, watch as r } from "vue";
|
|
3
|
+
// src/utils/content-motion.js
|
|
4
|
+
function i(i, a, { opacity: o = !0 } = {}) {
|
|
5
|
+
let s, c = !1, l = 0, u = 0;
|
|
6
|
+
r(a, () => {
|
|
7
|
+
let e = i.value?.getBoundingClientRect();
|
|
8
|
+
u = e && e.height > 0 ? e.height : 0;
|
|
9
|
+
}, { flush: "pre" }), r(a, async () => {
|
|
10
|
+
let n = ++l;
|
|
11
|
+
if (await t(), c || n !== l) return;
|
|
12
|
+
let r = i.value, a = r?.ownerDocument.defaultView;
|
|
13
|
+
if (!r || e(r) || !r.animate) return;
|
|
14
|
+
let d = a.getComputedStyle(r), f = d.getPropertyValue("--kima-duration-effects").trim(), p = f ? parseFloat(f) * (f.endsWith("ms") ? 1 : 1e3) : 180;
|
|
15
|
+
if (!Number.isFinite(p) || p <= 0) return;
|
|
16
|
+
let m = r.getBoundingClientRect().height, h = u > 0 && Math.abs(m - u) > 1;
|
|
17
|
+
if (!h && !o) return;
|
|
18
|
+
let g = o ? s ? d.opacity : .55 : 1, _ = h ? [{
|
|
19
|
+
height: `${u}px`,
|
|
20
|
+
opacity: g
|
|
21
|
+
}, {
|
|
22
|
+
height: `${m}px`,
|
|
23
|
+
opacity: 1
|
|
24
|
+
}] : [{ opacity: g }, { opacity: 1 }];
|
|
25
|
+
s?.cancel(), s = r.animate(_, {
|
|
26
|
+
duration: p,
|
|
27
|
+
easing: d.getPropertyValue("--kima-curve-emphasized").trim() || "ease-out"
|
|
28
|
+
}), h && (r.style.overflow = "clip");
|
|
29
|
+
let v = s;
|
|
30
|
+
v.finished.then(() => {
|
|
31
|
+
s === v && (s = void 0), h && (r.style.overflow = "");
|
|
32
|
+
}).catch(() => {});
|
|
33
|
+
}, { deep: !0 }), n(() => {
|
|
34
|
+
c = !0, l++, s?.cancel();
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
export { i as useContentMotion };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { onBeforeUnmount as e, onMounted as t, ref as n, watch as r } from "vue";
|
|
2
|
+
import i from "xss";
|
|
3
|
+
// src/utils/content.js
|
|
4
|
+
var { FilterXSS: a, escapeAttrValue: o } = i;
|
|
5
|
+
function s(e) {
|
|
6
|
+
let t = String(e ?? "").trim();
|
|
7
|
+
return !t || /[\u0000-\u0020\u007f\\]/.test(t) ? !1 : /^(?:https?:\/\/|mailto:|tel:|\/(?!\/)|#)/i.test(t);
|
|
8
|
+
}
|
|
9
|
+
var c = new a({
|
|
10
|
+
whiteList: {
|
|
11
|
+
p: [],
|
|
12
|
+
br: [],
|
|
13
|
+
strong: [],
|
|
14
|
+
b: [],
|
|
15
|
+
em: [],
|
|
16
|
+
i: [],
|
|
17
|
+
s: [],
|
|
18
|
+
h1: [],
|
|
19
|
+
h2: [],
|
|
20
|
+
h3: [],
|
|
21
|
+
ul: [],
|
|
22
|
+
ol: ["start"],
|
|
23
|
+
li: [],
|
|
24
|
+
blockquote: [],
|
|
25
|
+
pre: [],
|
|
26
|
+
code: [],
|
|
27
|
+
hr: [],
|
|
28
|
+
a: [
|
|
29
|
+
"href",
|
|
30
|
+
"title",
|
|
31
|
+
"rel"
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
stripIgnoreTag: !0,
|
|
35
|
+
stripIgnoreTagBody: [
|
|
36
|
+
"script",
|
|
37
|
+
"style",
|
|
38
|
+
"iframe",
|
|
39
|
+
"object",
|
|
40
|
+
"svg",
|
|
41
|
+
"math"
|
|
42
|
+
],
|
|
43
|
+
css: !1,
|
|
44
|
+
safeAttrValue(e, t, n) {
|
|
45
|
+
return e === "a" && t === "href" ? s(n) ? o(n) : "" : e === "a" && t === "rel" ? "noopener noreferrer nofollow" : e === "ol" && t === "start" ? /^-?\d+$/.test(n) ? n : "" : o(n);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
function l(e) {
|
|
49
|
+
return c.process(String(e ?? ""));
|
|
50
|
+
}
|
|
51
|
+
function u(e) {
|
|
52
|
+
let { from: t, to: n } = e.state.selection;
|
|
53
|
+
return {
|
|
54
|
+
from: t,
|
|
55
|
+
to: n,
|
|
56
|
+
empty: t === n,
|
|
57
|
+
text: e.state.doc.textBetween(t, n, "\n")
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function d(i, a, o, s, c) {
|
|
61
|
+
let l = n(s(i.modelValue)), u, d;
|
|
62
|
+
r(() => i.modelValue, (e) => {
|
|
63
|
+
l.value = s(e);
|
|
64
|
+
});
|
|
65
|
+
function f(e) {
|
|
66
|
+
i.disabled || i.readonly || (l.value = s(e), a("update:modelValue", l.value), a("change", l.value));
|
|
67
|
+
}
|
|
68
|
+
function p(e) {
|
|
69
|
+
let t = o.value?.querySelector("textarea")?.form;
|
|
70
|
+
e.target !== t || e.defaultPrevented || queueMicrotask(() => {
|
|
71
|
+
!e.defaultPrevented && o.value && (l.value = u, c?.(u), a("update:modelValue", l.value));
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return t(() => {
|
|
75
|
+
u = l.value, d = o.value?.ownerDocument, d?.addEventListener("reset", p);
|
|
76
|
+
let e = o.value?.querySelector("textarea");
|
|
77
|
+
e && (e.defaultValue = l.value);
|
|
78
|
+
}), e(() => d?.removeEventListener("reset", p)), {
|
|
79
|
+
local: l,
|
|
80
|
+
update: f
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export { u as contentSelection, s as safeContentUrl, l as sanitizeContent, d as useContentState };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Alert02Icon as e, AlertCircleIcon as t, CheckmarkCircle02Icon as n, InformationCircleIcon as r } from "@hugeicons/core-free-icons";
|
|
2
|
+
// src/utils/display-status.js
|
|
3
|
+
var i = {
|
|
4
|
+
neutral: {
|
|
5
|
+
label: "提示",
|
|
6
|
+
icon: r
|
|
7
|
+
},
|
|
8
|
+
info: {
|
|
9
|
+
label: "信息",
|
|
10
|
+
icon: r
|
|
11
|
+
},
|
|
12
|
+
success: {
|
|
13
|
+
label: "成功",
|
|
14
|
+
icon: n
|
|
15
|
+
},
|
|
16
|
+
warning: {
|
|
17
|
+
label: "警告",
|
|
18
|
+
icon: e
|
|
19
|
+
},
|
|
20
|
+
danger: {
|
|
21
|
+
label: "错误",
|
|
22
|
+
icon: t
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
function a(e) {
|
|
26
|
+
return {
|
|
27
|
+
variant: Object.hasOwn(i, e) ? e : "neutral",
|
|
28
|
+
...i[e] || i.neutral
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export { a as displayStatus };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// src/utils/foundation.js
|
|
2
|
+
var e = [
|
|
3
|
+
"base",
|
|
4
|
+
"sm",
|
|
5
|
+
"md",
|
|
6
|
+
"lg"
|
|
7
|
+
], t = [
|
|
8
|
+
0,
|
|
9
|
+
1,
|
|
10
|
+
2,
|
|
11
|
+
3,
|
|
12
|
+
4,
|
|
13
|
+
5,
|
|
14
|
+
6,
|
|
15
|
+
8,
|
|
16
|
+
10,
|
|
17
|
+
12,
|
|
18
|
+
16
|
|
19
|
+
];
|
|
20
|
+
function n(e, t, n) {
|
|
21
|
+
return t.includes(e) ? e : n;
|
|
22
|
+
}
|
|
23
|
+
function r(e, n = 4) {
|
|
24
|
+
let r = Number(e);
|
|
25
|
+
return `var(--kima-space-${t.includes(r) ? r : n})`;
|
|
26
|
+
}
|
|
27
|
+
function i(t, n, r) {
|
|
28
|
+
let i = t && typeof t == "object" && !Array.isArray(t) ? t : { base: t }, a = n(i.base ?? r);
|
|
29
|
+
return e.map((e) => (i[e] !== void 0 && (a = n(i[e])), a));
|
|
30
|
+
}
|
|
31
|
+
function a(t, n, r, a, o) {
|
|
32
|
+
return Object.fromEntries(i(r, a, o).map((r, i) => [`--kima-${t}-${n}-${e[i]}`, r]));
|
|
33
|
+
}
|
|
34
|
+
function o(e) {
|
|
35
|
+
let t = Number(e);
|
|
36
|
+
return `repeat(${Number.isInteger(t) && t >= 1 && t <= 24 ? t : 1}, minmax(0, 1fr))`;
|
|
37
|
+
}
|
|
38
|
+
function s(e) {
|
|
39
|
+
if (!Array.isArray(e) || !e.length || e.length > 24) return {
|
|
40
|
+
template: "none",
|
|
41
|
+
names: [],
|
|
42
|
+
columns: 0
|
|
43
|
+
};
|
|
44
|
+
let t = e.map((e) => typeof e == "string" ? e.trim().split(/\s+/) : []), n = t[0].length;
|
|
45
|
+
if (!n || t.some((e) => e.length !== n || e.some((e) => !/^(?:[a-zA-Z_][\w-]*|\.)$/.test(e)))) return {
|
|
46
|
+
template: "none",
|
|
47
|
+
names: [],
|
|
48
|
+
columns: 0
|
|
49
|
+
};
|
|
50
|
+
let r = [...new Set(t.flat().filter((e) => e !== "."))];
|
|
51
|
+
for (let e of r) {
|
|
52
|
+
let n = t.flatMap((t, n) => t.flatMap((t, r) => t === e ? [[n, r]] : [])), r = n.map((e) => e[0]), i = n.map((e) => e[1]);
|
|
53
|
+
for (let n = Math.min(...r); n <= Math.max(...r); n++) for (let r = Math.min(...i); r <= Math.max(...i); r++) if (t[n][r] !== e) return {
|
|
54
|
+
template: "none",
|
|
55
|
+
names: [],
|
|
56
|
+
columns: 0
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
template: t.map((e) => `"${e.join(" ")}"`).join(" "),
|
|
61
|
+
names: r,
|
|
62
|
+
columns: n
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export { n as choice, o as columnTemplate, e as foundationBreakpoints, s as gridAreas, a as layoutVariables, i as responsive, r as space };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { computed as e, getCurrentInstance as t, onBeforeUnmount as n, onMounted as r, ref as i, useAttrs as a, watch as o } from "vue";
|
|
2
|
+
// src/utils/input-state.js
|
|
3
|
+
function s(e, t, a, s = (e) => e, c) {
|
|
4
|
+
let l = (e) => Array.isArray(e) ? [...e] : e, u = i(l(s(e.modelValue)));
|
|
5
|
+
o(() => e.modelValue, (e) => {
|
|
6
|
+
u.value = l(s(e));
|
|
7
|
+
}, { deep: !0 });
|
|
8
|
+
function d(n, r = !0) {
|
|
9
|
+
e.disabled || e.readonly || (u.value = l(s(n)), t("update:modelValue", l(u.value)), r && t("change", l(u.value)));
|
|
10
|
+
}
|
|
11
|
+
let f, p;
|
|
12
|
+
function m(e) {
|
|
13
|
+
let n = a.value, r = n?.form || n?.querySelector("input,select,textarea,button")?.form || n?.closest("form");
|
|
14
|
+
e.target === r && queueMicrotask(() => {
|
|
15
|
+
!e.defaultPrevented && a.value && (u.value = l(f), c?.(u.value), t("update:modelValue", l(u.value)));
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return r(() => {
|
|
19
|
+
f = l(u.value), p = a.value?.ownerDocument, p?.addEventListener("reset", m, !0);
|
|
20
|
+
let e = a.value?.matches("input,select,textarea") ? [a.value] : [...a.value?.querySelectorAll("input,select,textarea") || []];
|
|
21
|
+
for (let t of e) if (t.tagName === "SELECT") for (let e of t.options) e.defaultSelected = e.selected;
|
|
22
|
+
else ["checkbox", "radio"].includes(t.type) ? t.defaultChecked = t.checked : t.type !== "file" && (t.defaultValue = t.value);
|
|
23
|
+
}), n(() => p?.removeEventListener("reset", m, !0)), {
|
|
24
|
+
local: u,
|
|
25
|
+
update: d
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function c() {
|
|
29
|
+
let n = a(), r = !!t()?.ce;
|
|
30
|
+
return {
|
|
31
|
+
attrs: n,
|
|
32
|
+
controlAttrs: e(() => {
|
|
33
|
+
let e = { ...n };
|
|
34
|
+
return delete e.class, delete e.style, r && delete e.id, e;
|
|
35
|
+
})
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export { c as useInputAttrs, s as useInputState };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { useNativeSlots as e } from "./native-slots.js";
|
|
2
|
+
import { computed as t, getCurrentInstance as n, nextTick as r, onBeforeUnmount as i, onMounted as a, ref as o, shallowRef as s, useAttrs as c, useHost as l, watch as u } from "vue";
|
|
3
|
+
// src/utils/interaction.js
|
|
4
|
+
function d() {
|
|
5
|
+
let n = o(null), r = c(), { hasNativeSlot: i, isCustomElement: a } = e(n);
|
|
6
|
+
return {
|
|
7
|
+
root: n,
|
|
8
|
+
attrs: r,
|
|
9
|
+
forwardedAttrs: t(() => a ? {
|
|
10
|
+
...r,
|
|
11
|
+
id: void 0
|
|
12
|
+
} : r),
|
|
13
|
+
hasNativeSlot: i
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function f(e, t, r) {
|
|
17
|
+
let i = n()?.ce ? l() : null, a = (e) => Array.isArray(e) ? [...e] : e, o = s(a(e[t]));
|
|
18
|
+
u(() => e[t], (e) => {
|
|
19
|
+
o.value = a(e);
|
|
20
|
+
}, { deep: !0 });
|
|
21
|
+
function c(e) {
|
|
22
|
+
Object.is(o.value, e) || (o.value = a(e), i && (i[t] = a(e)), r(`update:${t}`, a(e)));
|
|
23
|
+
}
|
|
24
|
+
return [o, c];
|
|
25
|
+
}
|
|
26
|
+
function p(e) {
|
|
27
|
+
return t(() => {
|
|
28
|
+
let [t, n] = String(e.placement || "bottom-start").split("-");
|
|
29
|
+
return {
|
|
30
|
+
side: [
|
|
31
|
+
"top",
|
|
32
|
+
"right",
|
|
33
|
+
"bottom",
|
|
34
|
+
"left"
|
|
35
|
+
].includes(t) ? t : "bottom",
|
|
36
|
+
align: ["start", "end"].includes(n) ? n : "center",
|
|
37
|
+
sideOffset: 8,
|
|
38
|
+
collisionPadding: 12,
|
|
39
|
+
avoidCollisions: !0,
|
|
40
|
+
positionStrategy: "fixed"
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function m(e, n, i) {
|
|
45
|
+
let a = o(-1), s = t(() => e.value.flatMap((e, t) => e.disabled ? [] : [t])), c = t(() => a.value >= 0 ? `${i}-${a.value}` : void 0);
|
|
46
|
+
function l(e) {
|
|
47
|
+
a.value = e, r(() => {
|
|
48
|
+
typeof document < "u" && document.getElementById(c.value)?.scrollIntoView({ block: "nearest" });
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
u(e, () => l(s.value[0] ?? -1), { immediate: !0 });
|
|
52
|
+
function d(t) {
|
|
53
|
+
if (t.isComposing || t.ctrlKey || t.metaKey || t.altKey) return;
|
|
54
|
+
let r = s.value;
|
|
55
|
+
if ([
|
|
56
|
+
"ArrowDown",
|
|
57
|
+
"ArrowUp",
|
|
58
|
+
"Home",
|
|
59
|
+
"End",
|
|
60
|
+
"Enter"
|
|
61
|
+
].includes(t.key)) {
|
|
62
|
+
if (t.preventDefault(), t.key === "Enter") {
|
|
63
|
+
let t = e.value[a.value];
|
|
64
|
+
t && !t.disabled && n(t);
|
|
65
|
+
} else if (t.key === "Home") l(r[0] ?? -1);
|
|
66
|
+
else if (t.key === "End") l(r.at(-1) ?? -1);
|
|
67
|
+
else {
|
|
68
|
+
let e = r.indexOf(a.value), n = t.key === "ArrowDown" ? 1 : -1;
|
|
69
|
+
l(r.length ? r[e < 0 ? n > 0 ? 0 : r.length - 1 : (e + n + r.length) % r.length] : -1);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
active: a,
|
|
75
|
+
activeId: c,
|
|
76
|
+
highlight: l,
|
|
77
|
+
keydown: d
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function h(e, t, n, r) {
|
|
81
|
+
let o, s, c, l = (e) => Array.isArray(e) ? [...e] : e;
|
|
82
|
+
function u(t) {
|
|
83
|
+
t.target === e.value?.closest("form") && (clearTimeout(c), c = setTimeout(() => {
|
|
84
|
+
!t.defaultPrevented && e.value && (n(l(o)), r?.());
|
|
85
|
+
}, 0));
|
|
86
|
+
}
|
|
87
|
+
a(() => {
|
|
88
|
+
o = l(t.value), s = e.value.ownerDocument, s.addEventListener("reset", u, !0);
|
|
89
|
+
}), i(() => {
|
|
90
|
+
clearTimeout(c), s?.removeEventListener("reset", u, !0);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function g(e, t) {
|
|
94
|
+
e.preventDefault(), e.stopPropagation(), t();
|
|
95
|
+
}
|
|
96
|
+
function _(e) {
|
|
97
|
+
let t = [];
|
|
98
|
+
function n(e) {
|
|
99
|
+
for (let r of e) t.push(r), Array.isArray(r.children) && n(r.children);
|
|
100
|
+
}
|
|
101
|
+
return n(e), t;
|
|
102
|
+
}
|
|
103
|
+
export { g as dismissInteraction, _ as flattenChoices, m as useChoiceCursor, f as useInteractionModel, h as useInteractionReset, d as useInteractionRoot, p as usePlacement };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// src/utils/local-date.js
|
|
2
|
+
var e = (e) => String(e).padStart(2, "0");
|
|
3
|
+
function t(t) {
|
|
4
|
+
return `${String(t.getFullYear()).padStart(4, "0")}-${e(t.getMonth() + 1)}-${e(t.getDate())}`;
|
|
5
|
+
}
|
|
6
|
+
function n(e, t, n = 1) {
|
|
7
|
+
let r = new Date(2e3, 0, 1, 12);
|
|
8
|
+
return r.setFullYear(e, t, n), r;
|
|
9
|
+
}
|
|
10
|
+
function r(e) {
|
|
11
|
+
if (typeof e != "string" || !/^\d{4}-\d{2}-\d{2}$/.test(e)) return null;
|
|
12
|
+
let [r, i, a] = e.split("-").map(Number);
|
|
13
|
+
if (r < 1 || r > 9999 || i < 1 || i > 12 || a < 1 || a > 31) return null;
|
|
14
|
+
let o = n(r, i - 1, a);
|
|
15
|
+
return t(o) === e ? o : null;
|
|
16
|
+
}
|
|
17
|
+
function i(e) {
|
|
18
|
+
return r(e) ? e : null;
|
|
19
|
+
}
|
|
20
|
+
function a() {
|
|
21
|
+
return t(/* @__PURE__ */ new Date());
|
|
22
|
+
}
|
|
23
|
+
function o(e, n) {
|
|
24
|
+
let i = r(e);
|
|
25
|
+
return i ? (i.setDate(i.getDate() + n), t(i)) : e;
|
|
26
|
+
}
|
|
27
|
+
function s(e, i) {
|
|
28
|
+
let a = r(e);
|
|
29
|
+
if (!a) return e;
|
|
30
|
+
let o = a.getDate(), s = n(a.getFullYear(), a.getMonth() + i), c = n(s.getFullYear(), s.getMonth() + 1, 0).getDate();
|
|
31
|
+
return t(n(s.getFullYear(), s.getMonth(), Math.min(o, c)));
|
|
32
|
+
}
|
|
33
|
+
function c(e) {
|
|
34
|
+
return `${e.slice(0, 7)}-01`;
|
|
35
|
+
}
|
|
36
|
+
function l(e, t, n) {
|
|
37
|
+
let i = r(e);
|
|
38
|
+
if (!i) return e || "";
|
|
39
|
+
try {
|
|
40
|
+
return new Intl.DateTimeFormat(t || "zh-CN", n).format(i);
|
|
41
|
+
} catch {
|
|
42
|
+
return new Intl.DateTimeFormat("zh-CN", n).format(i);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function u(e) {
|
|
46
|
+
return typeof e == "string" && /^([01]\d|2[0-3]):[0-5]\d$/.test(e) ? Number(e.slice(0, 2)) * 60 + Number(e.slice(3)) : null;
|
|
47
|
+
}
|
|
48
|
+
export { n as civilDate, t as dateKey, l as formatDate, c as monthKey, i as normalizeDate, e as pad, r as parseDate, o as shiftDay, s as shiftMonth, u as timeMinutes, a as todayKey };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// src/utils/motion.js
|
|
2
|
+
var e = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
function n(e) {
|
|
4
|
+
return (e?.closest?.("[data-kima-reduced-motion]"))?.getAttribute("data-kima-reduced-motion") === "reduce" ? !0 : e?.ownerDocument?.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1;
|
|
5
|
+
}
|
|
6
|
+
function r(e) {
|
|
7
|
+
let t = parseFloat(e) || 0;
|
|
8
|
+
return e.trim().endsWith("ms") ? t : t * 1e3;
|
|
9
|
+
}
|
|
10
|
+
function i(e) {
|
|
11
|
+
e.inert = !0, e.setAttribute("aria-hidden", "true");
|
|
12
|
+
}
|
|
13
|
+
function a(e) {
|
|
14
|
+
e.inert = !1, e.removeAttribute("aria-hidden");
|
|
15
|
+
}
|
|
16
|
+
var o = {
|
|
17
|
+
onBeforeEnter: a,
|
|
18
|
+
onBeforeLeave: i
|
|
19
|
+
}, s = /* @__PURE__ */ new WeakMap();
|
|
20
|
+
function c(e) {
|
|
21
|
+
let t = e?.getBoundingClientRect().height || 0;
|
|
22
|
+
t > 0 && s.set(e, t);
|
|
23
|
+
}
|
|
24
|
+
function l(n) {
|
|
25
|
+
let r = e.get(n);
|
|
26
|
+
r && (t.set(n, {
|
|
27
|
+
height: n.getBoundingClientRect().height,
|
|
28
|
+
opacity: getComputedStyle(n).opacity
|
|
29
|
+
}), r.observer?.disconnect(), e.delete(n), r.animation?.cancel(), n.style.overflow = r.overflow);
|
|
30
|
+
}
|
|
31
|
+
function u(i, a, o) {
|
|
32
|
+
let c = i.ownerDocument.defaultView, l = i.style.display === "none" || c.getComputedStyle(i).display === "none";
|
|
33
|
+
o && l && (i.style.display = "");
|
|
34
|
+
let u = c.getComputedStyle(i), d = t.get(i);
|
|
35
|
+
t.delete(i);
|
|
36
|
+
let f = i.getBoundingClientRect().height || s.get(i) || 0, p = n(i) ? 0 : r(u.getPropertyValue("--kima-duration-slow") || "300ms"), m = u.getPropertyValue("--kima-curve-emphasized").trim() || "ease-out";
|
|
37
|
+
if (!p || !i.animate) {
|
|
38
|
+
a();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
let h = {
|
|
42
|
+
overflow: i.style.overflow,
|
|
43
|
+
animation: null,
|
|
44
|
+
observer: null
|
|
45
|
+
};
|
|
46
|
+
e.set(i, h), i.style.overflow = "clip";
|
|
47
|
+
let g = o ? f : 0;
|
|
48
|
+
function _(t, n) {
|
|
49
|
+
let r = i.animate([{
|
|
50
|
+
height: `${t}px`,
|
|
51
|
+
opacity: n
|
|
52
|
+
}, {
|
|
53
|
+
height: `${g}px`,
|
|
54
|
+
opacity: +!!o
|
|
55
|
+
}], {
|
|
56
|
+
duration: p,
|
|
57
|
+
easing: m,
|
|
58
|
+
fill: "both"
|
|
59
|
+
});
|
|
60
|
+
h.animation = r, r.finished.then(() => {
|
|
61
|
+
e.get(i) === h && h.animation === r && (h.observer?.disconnect(), e.delete(i), i.style.overflow = h.overflow, a(), r.cancel());
|
|
62
|
+
}).catch(() => {});
|
|
63
|
+
}
|
|
64
|
+
if (_(d?.height ?? (o ? 0 : f), d?.opacity ?? (o ? 0 : u.opacity)), o && c.ResizeObserver && i.firstElementChild) {
|
|
65
|
+
let t = i.firstElementChild.getBoundingClientRect().height;
|
|
66
|
+
h.observer = new c.ResizeObserver(() => {
|
|
67
|
+
let n = i.firstElementChild?.getBoundingClientRect().height ?? t;
|
|
68
|
+
if (Math.abs(n - t) < .5 || e.get(i) !== h) return;
|
|
69
|
+
let r = i.getBoundingClientRect().height, a = c.getComputedStyle(i).opacity;
|
|
70
|
+
g += n - t, t = n, h.animation.cancel(), _(r, a);
|
|
71
|
+
}), h.observer.observe(i.firstElementChild);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
var d = {
|
|
75
|
+
onEnter: (e, t) => u(e, t, !0),
|
|
76
|
+
onLeave: (e, t) => u(e, t, !1),
|
|
77
|
+
onEnterCancelled: l,
|
|
78
|
+
onLeaveCancelled: l
|
|
79
|
+
};
|
|
80
|
+
export { a as activateMotionElement, d as collapseTransition, n as prefersReducedMotion, o as presenceTransition, c as rememberCollapseHeight, i as retireMotionElement };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { getCurrentInstance as e, onBeforeUnmount as t, onMounted as n, ref as r, useHost as i } from "vue";
|
|
2
|
+
// src/utils/native-slots.js
|
|
3
|
+
function a(a) {
|
|
4
|
+
let o = !!e()?.ce, s = o ? i() : null, c = r(/* @__PURE__ */ new Set()), l;
|
|
5
|
+
function u() {
|
|
6
|
+
if (!o || !s) {
|
|
7
|
+
c.value = /* @__PURE__ */ new Set();
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
let e = /* @__PURE__ */ new Set();
|
|
11
|
+
for (let t of s.childNodes) t.nodeType !== 8 && (t.nodeType === 3 ? t.textContent.trim() && e.add("default") : t.nodeType === 1 && e.add(t.getAttribute("slot")?.trim() || "default"));
|
|
12
|
+
c.value = e;
|
|
13
|
+
}
|
|
14
|
+
function d(e = "default") {
|
|
15
|
+
return o && c.value.has(e || "default");
|
|
16
|
+
}
|
|
17
|
+
return n(() => {
|
|
18
|
+
o && s && (u(), l = new MutationObserver(u), l.observe(s, {
|
|
19
|
+
childList: !0,
|
|
20
|
+
characterData: !0,
|
|
21
|
+
attributes: !0,
|
|
22
|
+
attributeFilter: ["slot"],
|
|
23
|
+
subtree: !0
|
|
24
|
+
}));
|
|
25
|
+
}), t(() => l?.disconnect()), {
|
|
26
|
+
hasNativeSlot: d,
|
|
27
|
+
isCustomElement: o
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export { a as useNativeSlots };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useNativeSlots as e } from "./native-slots.js";
|
|
2
|
+
import { computed as t, getCurrentInstance as n, ref as r, shallowRef as i, useAttrs as a, useHost as o, watch as s } from "vue";
|
|
3
|
+
// src/utils/navigation.js
|
|
4
|
+
function c() {
|
|
5
|
+
let n = r(null), i = a(), { hasNativeSlot: o, isCustomElement: s } = e(n);
|
|
6
|
+
return {
|
|
7
|
+
root: n,
|
|
8
|
+
forwardedAttrs: t(() => s ? {
|
|
9
|
+
...i,
|
|
10
|
+
id: void 0
|
|
11
|
+
} : i),
|
|
12
|
+
hasNativeSlot: o,
|
|
13
|
+
isCustomElement: s
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function l(e, t, r) {
|
|
17
|
+
let a = n()?.ce ? o() : null, c = i(e[t]);
|
|
18
|
+
s(() => e[t], (e) => {
|
|
19
|
+
c.value = e;
|
|
20
|
+
});
|
|
21
|
+
function l(e) {
|
|
22
|
+
Object.is(e, c.value) || (c.value = e, a && (a[t] = e), r(`update:${t}`, e), r("change", e));
|
|
23
|
+
}
|
|
24
|
+
return [c, l];
|
|
25
|
+
}
|
|
26
|
+
function u(e) {
|
|
27
|
+
if (typeof window > "u") return null;
|
|
28
|
+
if (!e) return window;
|
|
29
|
+
let t = typeof e == "string" ? (() => {
|
|
30
|
+
try {
|
|
31
|
+
return document.querySelector(e);
|
|
32
|
+
} catch {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
})() : e;
|
|
36
|
+
return t?.matches?.("kima-scroll-area") ? t.querySelector(".kima-scroll-area") : t;
|
|
37
|
+
}
|
|
38
|
+
function d(e = !0) {
|
|
39
|
+
return e && !window.matchMedia("(prefers-reduced-motion: reduce)").matches ? "smooth" : "instant";
|
|
40
|
+
}
|
|
41
|
+
function f(e) {
|
|
42
|
+
return typeof e == "number" || /^\d+(\.\d+)?$/.test(String(e).trim()) ? `${Math.max(0, Number(e))}px` : e;
|
|
43
|
+
}
|
|
44
|
+
export { f as cssSize, d as scrollBehavior, u as scrollTarget, l as useNavigationModel, c as useNavigationRoot };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// src/utils/notifications.js
|
|
2
|
+
function e({ capacity: e = 3 } = {}) {
|
|
3
|
+
let t = [], n = 0, r = a(e), i = /* @__PURE__ */ new Set();
|
|
4
|
+
function a(e) {
|
|
5
|
+
return Math.max(0, Math.floor(Number(e) || 0));
|
|
6
|
+
}
|
|
7
|
+
function o() {
|
|
8
|
+
return t.map((e) => ({ ...e }));
|
|
9
|
+
}
|
|
10
|
+
function s() {
|
|
11
|
+
let e = o();
|
|
12
|
+
for (let t of [...i]) t(e);
|
|
13
|
+
}
|
|
14
|
+
function c(e) {
|
|
15
|
+
let i = typeof e == "string" ? { message: e } : { ...e }, a = t.find((e) => i.dedupeKey != null && e.dedupeKey === i.dedupeKey || i.id != null && e.id === i.id), o = a?.id ?? i.id ?? `kima-notice-${++n}`;
|
|
16
|
+
return t = a ? t.map((e) => e === a ? {
|
|
17
|
+
...e,
|
|
18
|
+
...i,
|
|
19
|
+
id: o,
|
|
20
|
+
open: !0
|
|
21
|
+
} : e) : [...t, {
|
|
22
|
+
...i,
|
|
23
|
+
id: o,
|
|
24
|
+
open: !0
|
|
25
|
+
}], t = r ? t.slice(-r) : [], s(), o;
|
|
26
|
+
}
|
|
27
|
+
function l(e, n) {
|
|
28
|
+
return t.some((t) => t.id === e) ? (t = t.map((t) => t.id === e ? {
|
|
29
|
+
...t,
|
|
30
|
+
...n,
|
|
31
|
+
id: e
|
|
32
|
+
} : t), s(), !0) : !1;
|
|
33
|
+
}
|
|
34
|
+
function u(e) {
|
|
35
|
+
let n = t.filter((t) => t.id !== e);
|
|
36
|
+
return n.length !== t.length && (t = n, s(), !0);
|
|
37
|
+
}
|
|
38
|
+
function d() {
|
|
39
|
+
t = [], s();
|
|
40
|
+
}
|
|
41
|
+
function f(e) {
|
|
42
|
+
return i.add(e), e(o()), () => i.delete(e);
|
|
43
|
+
}
|
|
44
|
+
function p(e) {
|
|
45
|
+
r = a(e), t = r ? t.slice(-r) : [], s();
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
push: c,
|
|
49
|
+
update: l,
|
|
50
|
+
dismiss: u,
|
|
51
|
+
clear: d,
|
|
52
|
+
subscribe: f,
|
|
53
|
+
setCapacity: p,
|
|
54
|
+
snapshot: o,
|
|
55
|
+
get capacity() {
|
|
56
|
+
return r;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export { e as createNotifications };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import e from "qrcode-generator";
|
|
2
|
+
// src/utils/qr.js
|
|
3
|
+
e.stringToBytes = (e) => Array.from(new TextEncoder().encode(e));
|
|
4
|
+
function t(t, n = "M") {
|
|
5
|
+
let r = e(0, [
|
|
6
|
+
"L",
|
|
7
|
+
"M",
|
|
8
|
+
"Q",
|
|
9
|
+
"H"
|
|
10
|
+
].includes(n) ? n : "M");
|
|
11
|
+
r.addData(String(t), "Byte"), r.make();
|
|
12
|
+
let i = r.getModuleCount(), a = Array.from({ length: i }, (e, t) => Array.from({ length: i }, (e, n) => r.isDark(t, n)));
|
|
13
|
+
return {
|
|
14
|
+
size: i,
|
|
15
|
+
modules: a,
|
|
16
|
+
path: a.flatMap((e, t) => e.flatMap((e, n) => e ? [`M${n + 4} ${t + 4}h1v1h-1z`] : [])).join(""),
|
|
17
|
+
viewBox: `0 0 ${i + 8} ${i + 8}`
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export { t as encodeQR };
|