@studio-west/component-sw 0.13.10 → 0.13.16

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/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { n as e } from "./SwIcon-C4RHAbK1.js";
2
- import { Transition as t, computed as n, createApp as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, defineAsyncComponent as l, h as u, normalizeClass as d, onMounted as f, onUnmounted as p, openBlock as m, ref as h, renderSlot as g, toDisplayString as _, withCtx as v } from "vue";
1
+ import { n as e } from "./SwIcon-Ce_Lj65y.js";
2
+ import { Transition as t, computed as n, createApp as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, defineAsyncComponent as l, h as u, normalizeClass as d, onMounted as f, onUnmounted as p, openBlock as m, ref as h, renderSlot as g, toDisplayString as _, unref as v, useSlots as y, withCtx as b } from "vue";
3
3
  //#region src/components/SwAlert.vue
4
- var y = {
4
+ var x = { class: "body" }, S = { class: "text" }, C = { key: 0 }, w = {
5
5
  __name: "SwAlert",
6
6
  props: {
7
7
  message: {
@@ -35,108 +35,132 @@ var y = {
35
35
  "success",
36
36
  "warning",
37
37
  "error",
38
- "info"
38
+ "danger",
39
+ "info",
40
+ "primary"
39
41
  ].includes(e)
40
42
  }
41
43
  },
42
44
  emits: ["closed"],
43
45
  setup(r, { emit: l }) {
44
- let u = r, y = l, b = h(!1), x = null, S = () => {
45
- document.querySelector(".sw-alert-wrapper").togglePopover(), b.value = !0, document.querySelector(".sw-alert-wrapper").showPopover(), E();
46
- }, C = () => {
47
- b.value = !1, y("closed");
48
- }, w = () => {
49
- x &&= (clearTimeout(x), null);
50
- }, T = () => {
51
- E();
52
- }, E = () => {
53
- x = setTimeout(C, u.duration);
46
+ let u = y(), w = r, T = l, E = h(!1), D = null, O = () => {
47
+ E.value = !0, M();
48
+ }, k = () => {
49
+ E.value = !1, T("closed");
50
+ }, A = () => {
51
+ D &&= (clearTimeout(D), null);
52
+ }, j = () => {
53
+ M();
54
+ }, M = () => {
55
+ D = setTimeout(k, w.duration);
54
56
  };
55
57
  f(() => {
56
- S();
58
+ O();
57
59
  }), p(() => {
58
- x && clearTimeout(x);
60
+ D && clearTimeout(D);
59
61
  });
60
- let D = n(() => {
62
+ let N = n(() => {
61
63
  let e = ["sw-alert"];
62
- return u.size.length > 0 && e.push(`sw-${u.size}`), u.type.length > 0 && e.push(`sw-${u.type}`), u.class.length > 0 && e.push(u.class), e;
64
+ if (w.size.length > 0 && e.push(`sw-${w.size}`), w.type.length > 0) {
65
+ let t = w.type === "error" ? "danger" : w.type;
66
+ e.push(`sw-${t}`);
67
+ }
68
+ return w.class.length > 0 && e.push(w.class), e;
63
69
  });
64
70
  return (n, r) => (m(), i(t, { name: "fade" }, {
65
- default: v(() => [b.value ? (m(), o("div", {
71
+ default: b(() => [E.value ? (m(), o("div", {
66
72
  key: 0,
67
- class: d(D.value),
68
- onMouseenter: w,
69
- onMouseleave: T
70
- }, [
71
- u.before.length > 0 ? (m(), i(e, {
73
+ class: d(N.value),
74
+ onMouseenter: A,
75
+ onMouseleave: j
76
+ }, [s("div", x, [
77
+ w.before.length > 0 ? (m(), i(e, {
72
78
  key: 0,
73
- "icon-class": u.before
79
+ "icon-class": w.before
74
80
  }, null, 8, ["icon-class"])) : g(n.$slots, "prefix", {}, void 0, void 0, 1),
75
- g(n.$slots, "default", {}, () => [c(_(u.message), 1)]),
76
- u.after.length > 0 ? (m(), i(e, {
81
+ s("span", S, [g(n.$slots, "default", {}, () => [c(_(w.message), 1)])]),
82
+ w.after.length > 0 ? (m(), i(e, {
77
83
  key: 2,
78
- "icon-class": u.after,
79
- onClick: C
80
- }, null, 8, ["icon-class"])) : g(n.$slots, "suffix", {}, void 0, void 0, 3),
81
- s("footer", null, [g(n.$slots, "footer")])
82
- ], 34)) : a("", !0)]),
84
+ class: "close",
85
+ "icon-class": w.after,
86
+ onClick: k
87
+ }, null, 8, ["icon-class"])) : g(n.$slots, "suffix", {}, void 0, void 0, 3)
88
+ ]), v(u).footer ? (m(), o("footer", C, [g(n.$slots, "footer")])) : a("", !0)], 34)) : a("", !0)]),
83
89
  _: 3
84
90
  }));
85
91
  }
86
- }, b = null;
87
- function x(e = {}) {
92
+ }, T = /* @__PURE__ */ new Map(), E = "center", D = "top";
93
+ function O(e, t) {
94
+ return `${e}-${t}`;
95
+ }
96
+ function k(e, t) {
97
+ let n = O(e, t), r = T.get(n) ?? null;
98
+ return r ||= document.querySelector(`div.sw-alert-wrapper[data-place="${n}"]`), r || (r = document.createElement("div"), r.className = `sw-alert-wrapper place-${e} align-${t}`, r.dataset.place = n, r.setAttribute("popover", "manual"), document.body.appendChild(r), T.set(n, r)), r;
99
+ }
100
+ function A(e) {
101
+ if (typeof e.showPopover == "function") try {
102
+ e.matches(":popover-open") || e.showPopover();
103
+ } catch {}
104
+ }
105
+ function j(e) {
106
+ if (e.childElementCount > 0) return;
107
+ if (typeof e.hidePopover == "function") try {
108
+ e.matches(":popover-open") && e.hidePopover();
109
+ } catch {}
110
+ let t = e.dataset.place;
111
+ t && T.delete(t), e.remove();
112
+ }
113
+ function M(e = {}) {
88
114
  if (typeof document > "u") return;
89
- b ||= document.querySelector("div.sw-alert-wrapper"), b || (b = document.createElement("div"), b.className = "sw-alert-wrapper", b.setAttribute("popover", "manual"), document.body.appendChild(b));
90
- let { prefix: t, suffix: n, footer: i, ...a } = e, o = (e) => e == null ? null : typeof e == "function" ? e : typeof e == "string" ? () => [u("span", e)] : Array.isArray(e) ? () => e : () => [e], s = r({ setup() {
91
- return () => u(y, {
92
- ...a,
93
- onClose: () => {
94
- b && s._container && (b.removeChild(s._container), s.unmount()), e.onClose && e.onClose();
115
+ let t = e.placement ?? D, n = k(t, e.align ?? E), { prefix: i, suffix: a, footer: o, placement: s, align: c, ...l } = e, d = (e) => e == null ? null : typeof e == "function" ? e : typeof e == "string" ? () => [u("span", e)] : Array.isArray(e) ? () => e : () => [e], f = r({ setup() {
116
+ return () => u(w, {
117
+ ...l,
118
+ onClosed: () => {
119
+ f.unmount(), p.parentNode === n && n.removeChild(p), j(n), e.onClose && e.onClose();
95
120
  }
96
121
  }, {
97
- ...t != null && { prefix: o(t) },
98
- ...n != null && { suffix: o(n) },
99
- ...i != null && { footer: o(i) }
122
+ ...i != null && { prefix: d(i) },
123
+ ...a != null && { suffix: d(a) },
124
+ ...o != null && { footer: d(o) }
100
125
  });
101
- } }), c = s.mount(document.createElement("div"));
102
- b && c.$el && b.appendChild(c.$el);
126
+ } }), p = document.createElement("div");
127
+ p.className = "sw-alert-host", f.mount(p), t === "bottom" && n.firstChild ? n.insertBefore(p, n.firstChild) : n.appendChild(p), A(n);
103
128
  }
104
129
  //#endregion
105
130
  //#region src/index.ts
106
- var S = /* #__PURE__ */ Object.assign({
107
- "./components/SwButton.vue": () => import("./SwButton-mr7jdXoz.js").then((e) => e.n),
131
+ var N = /* #__PURE__ */ Object.assign({
132
+ "./components/SwButton.vue": () => import("./SwButton-DBj7jzhd.js").then((e) => e.n),
108
133
  "./components/SwButtonGroup.vue": () => import("./SwButtonGroup-Ck8aedFL.js"),
109
134
  "./components/SwCollapse.vue": () => import("./SwCollapse-DrCfi6Ly.js"),
110
- "./components/SwDatePicker.vue": () => import("./SwDatePicker-FT-rT4rV.js"),
111
- "./components/SwDropdown.vue": () => import("./SwDropdown-BTADCvrN.js"),
112
- "./components/SwDropdownItem.vue": () => import("./SwDropdownItem-oQKFG36T.js"),
113
- "./components/SwDropdownNew.vue": () => import("./SwDropdownNew-BuCIN-iv.js"),
114
- "./components/SwFile.vue": () => import("./SwFile-BBIqUoFG.js"),
115
- "./components/SwFormItem.vue": () => import("./SwFormItem-DgFaNwe9.js"),
116
- "./components/SwGide.vue": () => import("./SwGide-BYRlBr9D.js"),
117
- "./components/SwIcon.vue": () => import("./SwIcon-C4RHAbK1.js").then((e) => e.t),
118
- "./components/SwInput.vue": () => import("./SwInput-0Eph7P-m.js"),
135
+ "./components/SwDatePicker.vue": () => import("./SwDatePicker-BwgaZLnR.js"),
136
+ "./components/SwDropdown.vue": () => import("./SwDropdown-D5nIZEAM.js"),
137
+ "./components/SwDropdownItem.vue": () => import("./SwDropdownItem-09XdzVHh.js"),
138
+ "./components/SwFile.vue": () => import("./SwFile-BTNWhEX-.js"),
139
+ "./components/SwFormItem.vue": () => import("./SwFormItem-SuqNvXBQ.js"),
140
+ "./components/SwGide.vue": () => import("./SwGide-BScP5PoP.js"),
141
+ "./components/SwIcon.vue": () => import("./SwIcon-Ce_Lj65y.js").then((e) => e.t),
142
+ "./components/SwInput.vue": () => import("./SwInput-D5cZvb4H.js"),
119
143
  "./components/SwMenu.vue": () => import("./SwMenu-Dohv0z9N.js"),
120
- "./components/SwMessage.vue": () => import("./SwMessage-CUTW1YCi.js"),
121
- "./components/SwSection.vue": () => import("./SwSection-DG9jX0Yc.js"),
122
- "./components/SwSelect.vue": () => import("./SwSelect-DwxIlRFI.js"),
144
+ "./components/SwMessage.vue": () => import("./SwMessage-BRYFF_qT.js"),
145
+ "./components/SwSection.vue": () => import("./SwSection-Ck1GYU_A.js"),
146
+ "./components/SwSelect.vue": () => import("./SwSelect-Bo9kUY7P.js"),
123
147
  "./components/SwSkeleton.vue": () => import("./SwSkeleton-DsjPQpL2.js"),
124
148
  "./components/SwSkeletonItem.vue": () => import("./SwSkeletonItem-DOBVXQbh.js"),
125
- "./components/SwSlider.vue": () => import("./SwSlider-DkgJH6Bh.js"),
149
+ "./components/SwSlider.vue": () => import("./SwSlider-Cl9pwY6h.js"),
126
150
  "./components/SwSwitch.vue": () => import("./SwSwitch-Cxk-eNTf.js"),
127
151
  "./components/SwTable.vue": () => import("./SwTable-DE3cDsvN.js"),
128
152
  "./components/SwTableColumn.vue": () => import("./SwTableColumn-DQT28erv.js"),
129
153
  "./components/SwTabs.vue": () => import("./SwTabs-A6JIa-Kl.js"),
130
154
  "./components/SwTabsPane.vue": () => import("./SwTabsPane-CDBFh3D3.js")
131
- }), C = { SwAlert: y };
132
- for (let e in S) {
155
+ }), P = { SwAlert: w };
156
+ for (let e in N) {
133
157
  let t = e.split("/").pop().replace(".vue", "").replace(/-(\w)/g, (e, t) => t.toUpperCase());
134
- C[t] = l(() => S[e]());
158
+ P[t] = l(() => N[e]());
135
159
  }
136
- var w = { install(e) {
137
- Object.keys(C).forEach((t) => {
138
- e.component(t, C[t]);
139
- }), e.config.globalProperties.$Alert = x, e.provide("Alert", x);
160
+ var F = { install(e) {
161
+ Object.keys(P).forEach((t) => {
162
+ e.component(t, P[t]);
163
+ }), e.config.globalProperties.$Alert = M, e.provide("Alert", M);
140
164
  } };
141
165
  //#endregion
142
- export { x as Alert, w as Library, C as components };
166
+ export { M as Alert, F as Library, P as components };
@@ -36,7 +36,22 @@ function r(e, t) {
36
36
  let s = n.slice(0, e.length).replace(/_+/g, (e) => `\\d{1,${e.length}}`).replace(/[+()]/g, "\\$&"), c = RegExp(`^${s}$`);
37
37
  return o = o.replace(/[-—]$|(\) )$/g, ""), !c.test(e) || e.length < 5 ? o : e;
38
38
  }
39
- function i(e, t = !1) {
39
+ function i(e) {
40
+ if (typeof document > "u" || !document.body) return 0;
41
+ let t = 0, n = document.body.querySelectorAll("*");
42
+ for (let r = 0; r < n.length; r++) {
43
+ let i = n[r];
44
+ if (e && (i === e || e.contains(i)) || i.closest(".sw-alert-wrapper, .sw-dropdown-popup.gide")) continue;
45
+ let a = getComputedStyle(i);
46
+ if (a.position === "static") continue;
47
+ let o = a.zIndex;
48
+ if (o === "auto") continue;
49
+ let s = Number.parseInt(o, 10);
50
+ !Number.isNaN(s) && s > t && (t = s);
51
+ }
52
+ return t;
53
+ }
54
+ function a(e, t = !1) {
40
55
  let n = e.getBoundingClientRect();
41
56
  return t ? n.left > 50 ? {
42
57
  right: "100%",
@@ -50,4 +65,4 @@ function i(e, t = !1) {
50
65
  };
51
66
  }
52
67
  //#endregion
53
- export { t as a, n as i, r as n, e as r, i as t };
68
+ export { n as a, i, r as n, t as o, e as r, a as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studio-west/component-sw",
3
- "version": "0.13.10",
3
+ "version": "0.13.16",
4
4
  "description": "Vue components of Component-SW collection.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -52,6 +52,9 @@
52
52
  },
53
53
  "author": "Alexander Efimov",
54
54
  "license": "MIT",
55
+ "publishConfig": {
56
+ "access": "public"
57
+ },
55
58
  "engines": {
56
59
  "node": ">=20.19.0 || >=22.12.0"
57
60
  }
@@ -22,7 +22,6 @@ declare module 'vue' {
22
22
  SwCollapse: DefineComponent
23
23
  SwDropdown: DefineComponent
24
24
  SwDropdownItem: DefineComponent
25
- SwDropdownNew: DefineComponent
26
25
  SwFormItem: DefineComponent
27
26
  SwGide: DefineComponent
28
27
  SwIcon: DefineComponent
@@ -48,7 +47,6 @@ declare module 'vue' {
48
47
  'sw-collapse': DefineComponent
49
48
  'sw-dropdown': DefineComponent
50
49
  'sw-dropdown-item': DefineComponent
51
- 'sw-dropdown-new': DefineComponent
52
50
  'sw-form-item': DefineComponent
53
51
  'sw-gide': DefineComponent
54
52
  'sw-icon': DefineComponent
package/types/index.d.ts CHANGED
@@ -7,14 +7,21 @@ export interface LibraryPlugin extends Plugin {
7
7
 
8
8
  declare const Library: LibraryPlugin
9
9
 
10
+ export type AlertAlign = 'left' | 'center' | 'right'
11
+ export type AlertPlacement = 'top' | 'bottom'
12
+
10
13
  // Alert options interface
11
14
  export interface AlertOptions {
12
15
  title?: string
13
16
  message?: string
14
- type?: 'success' | 'warning' | 'error' | 'info'
17
+ type?: 'success' | 'warning' | 'error' | 'danger' | 'info' | 'primary'
15
18
  duration?: number
16
19
  showClose?: boolean
17
20
  onClose?: () => void
21
+ /** Горизонталь: слева, по центру, справа */
22
+ align?: AlertAlign
23
+ /** Вертикаль: top — старые сверху; bottom — свежие сверху */
24
+ placement?: AlertPlacement
18
25
  before?: string
19
26
  after?: string
20
27
  /** Слот #prefix (для иконки — `before`) */
@@ -124,7 +131,6 @@ declare module 'vue' {
124
131
  SwCollapse: DefineComponent
125
132
  SwDropdown: DefineComponent
126
133
  SwDropdownItem: DefineComponent
127
- SwDropdownNew: DefineComponent
128
134
  SwFormItem: DefineComponent
129
135
  SwGide: DefineComponent
130
136
  SwIcon: DefineComponent
@@ -1,36 +0,0 @@
1
- import { n as e } from "./SwIcon-C4RHAbK1.js";
2
- import { computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, normalizeClass as a, openBlock as o, renderSlot as s } from "vue";
3
- //#region src/components/SwDropdownItem.vue
4
- var c = {
5
- __name: "SwDropdownItem",
6
- props: {
7
- class: {
8
- type: String,
9
- default: ""
10
- },
11
- size: {
12
- type: String,
13
- default: ""
14
- },
15
- type: {
16
- type: String,
17
- default: ""
18
- },
19
- iconBefore: {
20
- type: String,
21
- default: ""
22
- }
23
- },
24
- setup(c) {
25
- let l = c, u = t(() => {
26
- let e = ["sw-dropdown-item"];
27
- return l.size.length > 0 && e.push("sw-" + l.size), l.type.length > 0 && e.push("sw-" + l.type), l.class.length > 0 && e.push(l.class), e;
28
- });
29
- return (t, l) => (o(), i("li", { class: a(u.value) }, [c.iconBefore.length > 0 ? (o(), n(e, {
30
- key: 0,
31
- "icon-class": c.iconBefore
32
- }, null, 8, ["icon-class"])) : r("", !0), s(t.$slots, "default")], 2));
33
- }
34
- };
35
- //#endregion
36
- export { c as default };
@@ -1,107 +0,0 @@
1
- import { Teleport as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, mergeModels as a, normalizeClass as o, normalizeStyle as s, onMounted as c, onUnmounted as l, openBlock as u, ref as d, renderSlot as f, unref as p, useModel as m, watchEffect as h, withModifiers as g } from "vue";
2
- //#region src/components/SwDropdownNew.vue
3
- var _ = ["id"], v = {
4
- __name: "SwDropdownNew",
5
- props: /*@__PURE__*/ a({
6
- class: {
7
- type: String,
8
- default: ""
9
- },
10
- type: {
11
- type: String,
12
- default: ""
13
- },
14
- trigger: {
15
- type: String,
16
- default: "click"
17
- },
18
- placement: {
19
- type: String,
20
- default: "bottom-left"
21
- },
22
- maxWidth: {
23
- type: Number,
24
- default: 0
25
- }
26
- }, {
27
- modelValue: {},
28
- modelModifiers: {}
29
- }),
30
- emits: ["update:modelValue"],
31
- setup(a, { expose: v }) {
32
- let y = a, b = m(a, "modelValue"), x = d(null), S = d(null), C = d({}), w = Math.ceil(Math.random() * 1e3), T = d(0), E = t(() => {
33
- let e = ["sw-dropdown"];
34
- return y.type.length > 0 && e.push("sw-" + y.type), e;
35
- }), D = new ResizeObserver(() => {
36
- b.value && T.value++, T.value > 99 && (T.value = 1);
37
- });
38
- h(() => {
39
- if (!b.value || !S.value || !x.value) return;
40
- T.value < 2 && D.observe(S.value);
41
- let e = window.pageYOffset || document.documentElement.scrollTop, t = window.pageXOffset || document.documentElement.scrollLeft;
42
- document.body.style.position = "fixed", document.body.style.top = `-${e}px`, document.body.style.left = `-${t}px`, document.body.style.position = "", document.body.style.top = "", document.body.style.left = "", document.documentElement.scrollTop = e, document.documentElement.scrollLeft = t;
43
- let n = x.value.getBoundingClientRect(), r = window.innerWidth, i = window.innerHeight, a = S.value.offsetHeight, o = S.value.offsetWidth, s = n.left + n.width / 2 + t, c = n.top + n.height / 2 + e, l = n.height / 2 + 8, [u, d] = y.placement.split("-", 2);
44
- switch (u) {
45
- case "bottom":
46
- c = e + i - a - l - 8 < c ? c - l - a : c + l, d === void 0 && (s -= o / 2);
47
- break;
48
- case "top":
49
- c = e + a + l + 8 > c ? c + l : c - l - a, d === void 0 && (s -= o / 2);
50
- break;
51
- case "left":
52
- s - o - n.width / 2 - 8 < 0 ? s + n.width / 2 + 8 + o < r ? (s = s + n.width / 2 + 8, c -= a / 2) : (c = e + a + l + 8 > c ? c + l : c - l - a, s = s + n.width / 2 < r ? s + n.width / 2 - o : s - o / 2) : (s = s - o - n.width / 2 - 8, c -= a / 2);
53
- break;
54
- case "right":
55
- s + n.width / 2 + 8 + o > r ? s - o - n.width / 2 - 8 > 0 ? (s = s - o - n.width / 2 - 8, c -= a / 2) : (c = e + a + l + 8 > c ? c + l : c - l - a, s -= n.width / 2) : (s = s + n.width / 2 + 8, c -= a / 2);
56
- break;
57
- }
58
- switch (d) {
59
- case "left":
60
- s = t + r - 8 > s - n.width / 2 + o ? s - n.width / 2 : s - o + n.width / 2;
61
- break;
62
- case "right":
63
- s = 8 < s + n.width / 2 - o ? s - o + n.width / 2 : s - n.width / 2;
64
- break;
65
- }
66
- s < 0 && (s = 0), c < 0 && (c = 0), C.value = {
67
- position: "absolute",
68
- top: `${c}px`,
69
- left: `${s}px`,
70
- maxWidth: y.maxWidth > 0 ? `${y.maxWidth}px` : ""
71
- };
72
- }, { flush: "post" });
73
- let O = () => {
74
- y.trigger === "click" && (b.value = !b.value);
75
- }, k = () => {
76
- y.trigger === "hover" && (b.value = !b.value);
77
- }, A = () => {
78
- y.trigger === "context" && (b.value = !b.value);
79
- }, j = () => {
80
- b.value && T.value++, T.value > 99 && (T.value = 1);
81
- };
82
- return v({ handleResize: j }), c(() => {
83
- window.addEventListener("resize", j), window.onscrollend === void 0 ? window.addEventListener("scroll", j) : window.addEventListener("scrollend", j);
84
- }), l(() => {
85
- D.disconnect(), window.removeEventListener("resize", j), window.onscrollend === void 0 ? window.removeEventListener("scroll", j) : window.removeEventListener("scrollend", j);
86
- }), (t, a) => (u(), i("div", {
87
- class: o(E.value),
88
- onClick: a[0] ||= (e) => O(),
89
- onMouseover: a[1] ||= g((e) => k(), ["stop"]),
90
- onMouseleave: a[2] ||= g((e) => k(), ["stop"]),
91
- onContextmenu: a[3] ||= g((e) => A(), ["stop"]),
92
- ref_key: "dropdownRef",
93
- ref: x
94
- }, [f(t.$slots, "default"), (u(), n(e, { to: "body" }, [b.value ? (u(), i("ul", {
95
- key: 0,
96
- popover: "",
97
- ref_key: "popupRef",
98
- ref: S,
99
- id: p(w),
100
- class: o(["sw-dropdown-popup", y.class]),
101
- style: s(C.value),
102
- tabindex: "-1"
103
- }, [f(t.$slots, "dropdown")], 14, _)) : r("", !0)]))], 34));
104
- }
105
- };
106
- //#endregion
107
- export { v as default };
@@ -1,24 +0,0 @@
1
- import { computed as e, createElementBlock as t, normalizeClass as n, openBlock as r, renderSlot as i } from "vue";
2
- //#region src/components/SwFormItem.vue
3
- var a = {
4
- __name: "SwFormItem",
5
- props: {
6
- class: {
7
- type: String,
8
- default: ""
9
- },
10
- type: {
11
- type: String,
12
- default: ""
13
- }
14
- },
15
- setup(a) {
16
- let o = a, s = e(() => {
17
- let e = ["sw-form-item"];
18
- return o.type.length > 0 && e.push("sw-" + o.type), o.class.length > 0 && e.push(o.class), e;
19
- });
20
- return (e, a) => (r(), t("div", { class: n(s.value) }, [i(e.$slots, "default")], 2));
21
- }
22
- };
23
- //#endregion
24
- export { a as default };
@@ -1,125 +0,0 @@
1
- import { n as e } from "./SwIcon-C4RHAbK1.js";
2
- import { t } from "./SwButton-mr7jdXoz.js";
3
- import n from "./SwDropdown-BTADCvrN.js";
4
- import { createElementBlock as r, createElementVNode as i, createTextVNode as a, createVNode as o, mergeModels as s, normalizeClass as c, onMounted as l, openBlock as u, ref as d, renderSlot as f, toDisplayString as p, useModel as m, watchEffect as h, withCtx as g } from "vue";
5
- //#region src/components/SwGide.vue
6
- var _ = ["src"], v = {
7
- __name: "SwGide",
8
- props: /*@__PURE__*/ s({
9
- steps: {
10
- type: Array,
11
- default: () => []
12
- },
13
- iconClose: {
14
- type: String,
15
- default: ""
16
- },
17
- maxWidth: {
18
- type: Number,
19
- default: 250
20
- }
21
- }, {
22
- modelValue: {
23
- type: Number,
24
- default: 0
25
- },
26
- modelModifiers: {}
27
- }),
28
- emits: /*@__PURE__*/ s(["close"], ["update:modelValue"]),
29
- setup(s, { emit: v }) {
30
- let y = d(null), b = d(!0), x = d(null), S = m(s, "modelValue"), C = v, w = s, T = () => C("close"), E = (e) => {
31
- let t = S.value + e;
32
- t < 0 ? S.value = 0 : t >= w.steps.length ? T() : S.value = t;
33
- }, D = !1, O = (e) => {
34
- let t = e.getBoundingClientRect(), n = window.innerHeight;
35
- t.top < 5 ? (D = !0, document.documentElement.scrollTop += t.top - 5) : t.bottom > n - 5 && (D = !0, document.documentElement.scrollTop += t.bottom - n + 5);
36
- }, k = () => {
37
- if (!x.value || !y.value) return;
38
- let e = x.value.getBoundingClientRect(), t = window.pageYOffset || document.documentElement.scrollTop, n = window.pageXOffset || document.documentElement.scrollLeft;
39
- y.value.style.gridTemplateRows = `${e.top + t - 5}px ${e.height + 10}px 1fr`, y.value.style.gridTemplateColumns = `${e.left + n - 5}px ${e.width + 10}px 1fr`, y.value.style.height = document.documentElement.scrollHeight + "px";
40
- };
41
- return h((e) => {
42
- if (!y.value) return;
43
- let t = w.steps[S.value]?.tag;
44
- if (!t || !t.trim()) {
45
- y.value.style.gridTemplateRows = "40% 0 1fr", y.value.style.gridTemplateColumns = "1fr 0 1fr", y.value.style.height = document.documentElement.scrollHeight + "px";
46
- return;
47
- }
48
- if (x.value = document.querySelector(t), !x.value) {
49
- console.warn(`[SwGuide] Элемент не найден: ${t}`);
50
- return;
51
- }
52
- O(x.value);
53
- let n = () => {
54
- if (D) {
55
- D = !1;
56
- return;
57
- }
58
- k();
59
- };
60
- k();
61
- let r = new ResizeObserver(k);
62
- r.observe(x.value), window.addEventListener("resize", n), window.addEventListener("scroll", n, { passive: !0 }), e(() => {
63
- r.disconnect(), window.removeEventListener("resize", n), window.removeEventListener("scroll", n);
64
- });
65
- }), l(() => window.onload = () => x.value = document.querySelector(w.steps[S.value]?.tag)), (s, l) => (u(), r("div", {
66
- class: "sw-gide",
67
- ref_key: "swGide",
68
- ref: y
69
- }, [
70
- l[6] ||= i("div", { class: "overlay0" }, null, -1),
71
- l[7] ||= i("div", { class: "overlay1" }, null, -1),
72
- o(n, {
73
- class: "gide",
74
- trigger: "none",
75
- placement: w.steps[S.value].placement,
76
- modelValue: b.value,
77
- "onUpdate:modelValue": l[2] ||= (e) => b.value = e,
78
- maxWidth: w.maxWidth
79
- }, {
80
- dropdown: g(() => [
81
- i("header", null, [f(s.$slots, "header", {}, () => [a(p(w.steps[S.value].header) + " ", 1), o(t, {
82
- type: "primary",
83
- link: "",
84
- onClick: T
85
- }, {
86
- default: g(() => [o(e, { "icon-class": w.iconClose }, null, 8, ["icon-class"])]),
87
- _: 1
88
- })])]),
89
- f(s.$slots, "default", {}, () => [i("div", null, p(w.steps[S.value].text), 1), i("img", {
90
- class: c(/left/.test(w.steps[S.value]?.placement) ? "reflect" : null),
91
- src: w.steps[S.value].img
92
- }, null, 10, _)]),
93
- i("footer", null, [f(s.$slots, "footer", {}, () => [o(t, {
94
- type: S.value === 0 ? "info" : "warning",
95
- text: "",
96
- link: "",
97
- onClick: l[0] ||= (e) => E(-1)
98
- }, {
99
- default: g(() => [f(s.$slots, "arrow", {}, () => [l[3] ||= a("‹", -1)])]),
100
- _: 3
101
- }, 8, ["type"]), o(t, {
102
- type: "success",
103
- onClick: l[1] ||= (e) => E(1),
104
- text: "",
105
- link: "",
106
- class: "sw-revers"
107
- }, {
108
- default: g(() => [f(s.$slots, "arrow", {}, () => [l[4] ||= a("‹", -1)])]),
109
- _: 3
110
- })])])
111
- ]),
112
- default: g(() => [l[5] ||= i("div", { class: "hole" }, null, -1)]),
113
- _: 3
114
- }, 8, [
115
- "placement",
116
- "modelValue",
117
- "maxWidth"
118
- ]),
119
- l[8] ||= i("div", { class: "overlay2" }, null, -1),
120
- l[9] ||= i("div", { class: "overlay3" }, null, -1)
121
- ], 512));
122
- }
123
- };
124
- //#endregion
125
- export { v as default };
@@ -1,55 +0,0 @@
1
- import { n as e } from "./SwIcon-C4RHAbK1.js";
2
- import { t } from "./SwButton-mr7jdXoz.js";
3
- import { createCommentVNode as n, createElementBlock as r, createElementVNode as i, createTextVNode as a, createVNode as o, mergeModels as s, nextTick as c, normalizeClass as l, onUnmounted as u, openBlock as d, ref as f, renderSlot as p, toDisplayString as m, unref as h, useModel as g, useSlots as _, watch as v, withCtx as y } from "vue";
4
- //#region src/components/SwMessage.vue
5
- var b = { key: 0 }, x = {
6
- __name: "SwMessage",
7
- props: /*@__PURE__*/ s({
8
- name: {
9
- type: String,
10
- default: ""
11
- },
12
- class: {
13
- type: String,
14
- default: ""
15
- },
16
- iconAfter: {
17
- type: String,
18
- default: ""
19
- }
20
- }, {
21
- modelValue: {},
22
- modelModifiers: {}
23
- }),
24
- emits: ["update:modelValue"],
25
- setup(s) {
26
- let x = g(s, "modelValue"), S = s, C = f(null), w = _(), T = (e) => {
27
- if (C.value && x.value) {
28
- let t = C.value.getBoundingClientRect();
29
- e.clientX >= t.left && e.clientX <= t.right && e.clientY >= t.top && e.clientY <= t.bottom || (x.value = !1);
30
- }
31
- };
32
- return v(() => x.value, (e) => {
33
- e ? (C.value.showModal(), c(), window.addEventListener("click", T, !0)) : (C.value.close(), window.removeEventListener("click", T));
34
- }), u(() => {
35
- window.removeEventListener("click", T);
36
- }), (s, c) => (d(), r("dialog", {
37
- class: l("sw-message " + S.class),
38
- ref_key: "messageRef",
39
- ref: C
40
- }, [
41
- S.name.length > 0 || h(w)?.header ? (d(), r("header", b, [p(s.$slots, "header", {}, () => [a(m(S.name) + " ", 1), o(t, {
42
- link: "",
43
- type: "primary",
44
- onClick: c[0] ||= (e) => x.value = !1
45
- }, {
46
- default: y(() => [o(e, { "icon-class": S.iconAfter }, null, 8, ["icon-class"])]),
47
- _: 1
48
- })])])) : n("", !0),
49
- p(s.$slots, "default"),
50
- i("footer", null, [p(s.$slots, "footer")])
51
- ], 2));
52
- }
53
- };
54
- //#endregion
55
- export { x as default };