@bobbykim/manguito-theme 1.2.0 → 1.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/CHANGELOG.md +23 -0
- package/README.md +51 -17
- package/dist/composable.cjs +1 -1
- package/dist/composable.js +1 -1
- package/dist/core.cjs +2 -2
- package/dist/core.d.ts +32 -4
- package/dist/core.js +557 -527
- package/dist/directives.cjs +1 -1
- package/dist/directives.d.ts +13 -10
- package/dist/directives.js +47 -41
- package/dist/index-BjeE_nEZ.cjs +1 -0
- package/dist/index-CzXHE-4G.js +108 -0
- package/dist/mcl-theme-v4.css +7 -1
- package/dist/useModalScrollLock-ONrBOk5v.js +56 -0
- package/dist/useModalScrollLock-X2enYbzG.cjs +1 -0
- package/package.json +3 -2
- package/dist/index-CKV6der_.cjs +0 -1
- package/dist/index-r-cHwpQM.js +0 -101
- package/dist/useModalScrollLock-BUdEkX4m.cjs +0 -1
- package/dist/useModalScrollLock-CZPywtVE.js +0 -56
package/dist/directives.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index-BjeE_nEZ.cjs"),a=require("vue"),v=(t,e)=>{if(t.tagName==="A"){const o=t.getAttribute("href");return o?o.charAt(0)==="#"?o.substring(1):o:null}return e||null},p=t=>t?document.getElementById(t):null,f=t=>t.hasAttribute("visible"),u=t=>{const o=t.getAttribute("visible")==="true"?"false":"true";t.setAttribute("visible",o)},b=t=>{const e=`div[accordion="${t}"]`;return Array.from(document.querySelectorAll(e))},C=(t,e)=>{b(e).forEach(r=>{r.id===t.id?u(r):r.getAttribute("visible")==="true"&&r.setAttribute("visible","false")})},A=t=>{u(t)},h=t=>e=>{e.preventDefault();const o=e.target,r=v(o,t),l=p(r);if(!l){console.warn(`[v-collapse] Target element not found: ${r}`);return}if(!f(l)){console.warn(`[v-collapse] Target element missing 'visible' attribute: ${r}`);return}const n=l.getAttribute("accordion");n?C(l,n):A(l)};let d=!1;const H=()=>{d||(d=!0,console.warn("[v-collapse] v-collapse is sunsetted: no collapse component reacts to it, including the base Collapse. Call toggle() on a Collapse template ref or bind :visible, and wrap accordions in <AccordionGroup>. It will be removed in the next major release."))},k={mounted(t,e){H(),t.__HandleToggler=h(e.arg),t.addEventListener("click",t.__HandleToggler)},unmounted(t){t.__HandleToggler&&(t.removeEventListener("click",t.__HandleToggler),delete t.__HandleToggler)}},w=t=>e=>{e.preventDefault();const o=e.target,r=v(o,t),l=p(r);if(!l){console.warn(`[v-toggle] Target element not found: ${r}`);return}if(!f(l)){console.warn(`[v-toggle] Target element mission visible 'visible' attribute: ${r}`);return}u(l)},y={mounted(t,e){t.__ClickToggleHandler=w(e.arg),t.addEventListener("click",t.__ClickToggleHandler)},unmounted(t){t.__ClickToggleHandler&&(t.removeEventListener("click",t.__ClickToggleHandler),delete t.__ClickToggleHandler)}};let I=0;const c=(t,e,o,r)=>{if(t.hasAttribute(o))return t.getAttribute(o);if(typeof e.value=="object"&&e.value!==null&&r in e.value)return e.value[r]},E=(t,e)=>{if(t.hasAttribute("title"))return t.getAttribute("title")||void 0;if(typeof e.value=="string")return e.value;if(typeof e.value=="object"&&e.value?.title)return e.value.title},x=t=>{const e=Object.keys(t.modifiers);return e.length>0?e[0]:void 0},V=(t,e)=>{t.classList.add("relative","group","overflow-visible"),t.__TooltipId||(t.__TooltipId=`mcl-tooltip-${++I}`);const o=t.__TooltipId,r=E(t,e),l=c(t,e,"color","color"),n=c(t,e,"text-color","textColor"),s=c(t,e,"tooltip-width","width"),i=typeof e.value=="object"?e.value.customClass:void 0,m=x(e),T=a.createVNode(g.tooltip,{id:o,direction:m,content:r,color:l,textColor:n,width:s,customClass:i});a.render(T,t),t.setAttribute("aria-describedby",o)},$=t=>{a.render(null,t),t.removeAttribute("aria-describedby"),delete t.__TooltipId},_={mounted(t,e){t.__HandleTooltip=o=>V(t,o),t.__UnmountTooltip=()=>$(t),t.__HandleTooltip(e)},updated(t,e,o,r){const l=e.value!==e.oldValue;let n=!1;const s=r.dirs?.find(i=>i.dir===_);if(s){const i=s.arg;e.arg!==i&&(n=!0)}(l||n)&&t.__HandleTooltip(e)},unmounted(t){t.__UnmountTooltip()}};exports.vClickOutside=g.vClickOutside;exports.vCollapse=k;exports.vToggle=y;exports.vTooltip=_;
|
package/dist/directives.d.ts
CHANGED
|
@@ -77,14 +77,22 @@ export declare const vClickOutside: Directive<ClickOutsideElement, ClickOutsideV
|
|
|
77
77
|
/**
|
|
78
78
|
* Vue directive for collapsible elements with accordion support.
|
|
79
79
|
*
|
|
80
|
-
* @deprecated
|
|
81
|
-
*
|
|
82
|
-
*
|
|
80
|
+
* @deprecated Sunsetted. No collapse component reacts to this directive,
|
|
81
|
+
* including the base `Collapse`, `MclCollapseA`, and `MclCollapseB`: they manage
|
|
82
|
+
* state internally via the `useCollapseState` composable. Mounting it logs a
|
|
83
|
+
* warning once per page. It will be removed in the next major release.
|
|
83
84
|
*
|
|
84
|
-
*
|
|
85
|
+
* - `v-collapse:<id>` on a trigger → call `toggle()` on a `Collapse` template ref,
|
|
86
|
+
* or bind `:visible`.
|
|
87
|
+
* - `accordion="<name>"` on a panel → wrap the panels in `<AccordionGroup>`.
|
|
85
88
|
*
|
|
86
89
|
* @example
|
|
87
|
-
* //
|
|
90
|
+
* // Standalone base Collapse
|
|
91
|
+
* <button @click="collapseRef?.toggle()">Toggle</button>
|
|
92
|
+
* <Collapse ref="collapseRef" id="panel-1">...</Collapse>
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* // Accordion
|
|
88
96
|
* import { AccordionGroup } from '@bobbykim/manguito-theme'
|
|
89
97
|
* import { MclCollapseA } from '@bobbykim/mcl-collapse'
|
|
90
98
|
*
|
|
@@ -92,11 +100,6 @@ export declare const vClickOutside: Directive<ClickOutsideElement, ClickOutsideV
|
|
|
92
100
|
* <MclCollapseA collapse-id="item1" title="Item 1">...</MclCollapseA>
|
|
93
101
|
* <MclCollapseA collapse-id="item2" title="Item 2">...</MclCollapseA>
|
|
94
102
|
* </AccordionGroup>
|
|
95
|
-
*
|
|
96
|
-
* @example
|
|
97
|
-
* // Preferred: standalone collapse (no wrapper needed)
|
|
98
|
-
* <MclCollapseA collapse-id="item1" title="Item 1">...</MclCollapseA>
|
|
99
|
-
*
|
|
100
103
|
*/
|
|
101
104
|
export declare const vCollapse: Directive<CollapseElement>;
|
|
102
105
|
|
package/dist/directives.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { t as _ } from "./index-
|
|
2
|
-
import { v as
|
|
3
|
-
import { createVNode as
|
|
4
|
-
const
|
|
1
|
+
import { t as _ } from "./index-CzXHE-4G.js";
|
|
2
|
+
import { v as O } from "./index-CzXHE-4G.js";
|
|
3
|
+
import { createVNode as T, render as d } from "vue";
|
|
4
|
+
const g = (t, e) => {
|
|
5
5
|
if (t.tagName === "A") {
|
|
6
6
|
const o = t.getAttribute("href");
|
|
7
7
|
return o ? o.charAt(0) === "#" ? o.substring(1) : o : null;
|
|
8
8
|
}
|
|
9
9
|
return e || null;
|
|
10
|
-
},
|
|
10
|
+
}, v = (t) => t ? document.getElementById(t) : null, p = (t) => t.hasAttribute("visible"), c = (t) => {
|
|
11
11
|
const o = t.getAttribute("visible") === "true" ? "false" : "true";
|
|
12
12
|
t.setAttribute("visible", o);
|
|
13
|
-
},
|
|
13
|
+
}, b = (t) => {
|
|
14
14
|
const e = `div[accordion="${t}"]`;
|
|
15
15
|
return Array.from(document.querySelectorAll(e));
|
|
16
16
|
}, A = (t, e) => {
|
|
17
|
-
|
|
18
|
-
r.id === t.id ?
|
|
17
|
+
b(e).forEach((r) => {
|
|
18
|
+
r.id === t.id ? c(r) : r.getAttribute("visible") === "true" && r.setAttribute("visible", "false");
|
|
19
19
|
});
|
|
20
20
|
}, C = (t) => {
|
|
21
|
-
|
|
22
|
-
},
|
|
21
|
+
c(t);
|
|
22
|
+
}, h = (t) => (e) => {
|
|
23
23
|
e.preventDefault();
|
|
24
|
-
const o = e.target, r =
|
|
24
|
+
const o = e.target, r = g(o, t), l = v(r);
|
|
25
25
|
if (!l) {
|
|
26
26
|
console.warn(`[v-collapse] Target element not found: ${r}`);
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
if (!
|
|
29
|
+
if (!p(l)) {
|
|
30
30
|
console.warn(
|
|
31
31
|
`[v-collapse] Target element missing 'visible' attribute: ${r}`
|
|
32
32
|
);
|
|
@@ -34,42 +34,48 @@ const d = (t, e) => {
|
|
|
34
34
|
}
|
|
35
35
|
const n = l.getAttribute("accordion");
|
|
36
36
|
n ? A(l, n) : C(l);
|
|
37
|
-
}
|
|
37
|
+
};
|
|
38
|
+
let u = !1;
|
|
39
|
+
const H = () => {
|
|
40
|
+
u || (u = !0, console.warn(
|
|
41
|
+
"[v-collapse] v-collapse is sunsetted: no collapse component reacts to it, including the base Collapse. Call toggle() on a Collapse template ref or bind :visible, and wrap accordions in <AccordionGroup>. It will be removed in the next major release."
|
|
42
|
+
));
|
|
43
|
+
}, L = {
|
|
38
44
|
mounted(t, e) {
|
|
39
|
-
t.__HandleToggler =
|
|
45
|
+
H(), t.__HandleToggler = h(e.arg), t.addEventListener("click", t.__HandleToggler);
|
|
40
46
|
},
|
|
41
47
|
unmounted(t) {
|
|
42
48
|
t.__HandleToggler && (t.removeEventListener("click", t.__HandleToggler), delete t.__HandleToggler);
|
|
43
49
|
}
|
|
44
|
-
},
|
|
50
|
+
}, k = (t) => (e) => {
|
|
45
51
|
e.preventDefault();
|
|
46
|
-
const o = e.target, r =
|
|
52
|
+
const o = e.target, r = g(o, t), l = v(r);
|
|
47
53
|
if (!l) {
|
|
48
54
|
console.warn(`[v-toggle] Target element not found: ${r}`);
|
|
49
55
|
return;
|
|
50
56
|
}
|
|
51
|
-
if (!
|
|
57
|
+
if (!p(l)) {
|
|
52
58
|
console.warn(
|
|
53
59
|
`[v-toggle] Target element mission visible 'visible' attribute: ${r}`
|
|
54
60
|
);
|
|
55
61
|
return;
|
|
56
62
|
}
|
|
57
|
-
|
|
58
|
-
},
|
|
63
|
+
c(l);
|
|
64
|
+
}, j = {
|
|
59
65
|
mounted(t, e) {
|
|
60
|
-
t.__ClickToggleHandler =
|
|
66
|
+
t.__ClickToggleHandler = k(e.arg), t.addEventListener("click", t.__ClickToggleHandler);
|
|
61
67
|
},
|
|
62
68
|
unmounted(t) {
|
|
63
69
|
t.__ClickToggleHandler && (t.removeEventListener("click", t.__ClickToggleHandler), delete t.__ClickToggleHandler);
|
|
64
70
|
}
|
|
65
71
|
};
|
|
66
|
-
let
|
|
67
|
-
const
|
|
72
|
+
let w = 0;
|
|
73
|
+
const a = (t, e, o, r) => {
|
|
68
74
|
if (t.hasAttribute(o))
|
|
69
75
|
return t.getAttribute(o);
|
|
70
76
|
if (typeof e.value == "object" && e.value !== null && r in e.value)
|
|
71
77
|
return e.value[r];
|
|
72
|
-
},
|
|
78
|
+
}, I = (t, e) => {
|
|
73
79
|
if (t.hasAttribute("title"))
|
|
74
80
|
return t.getAttribute("title") || void 0;
|
|
75
81
|
if (typeof e.value == "string")
|
|
@@ -79,40 +85,40 @@ const s = (t, e, o, r) => {
|
|
|
79
85
|
}, E = (t) => {
|
|
80
86
|
const e = Object.keys(t.modifiers);
|
|
81
87
|
return e.length > 0 ? e[0] : void 0;
|
|
82
|
-
},
|
|
83
|
-
t.classList.add("relative", "group", "overflow-visible"), t.__TooltipId || (t.__TooltipId = `mcl-tooltip-${++
|
|
84
|
-
const o = t.__TooltipId, r =
|
|
88
|
+
}, x = (t, e) => {
|
|
89
|
+
t.classList.add("relative", "group", "overflow-visible"), t.__TooltipId || (t.__TooltipId = `mcl-tooltip-${++w}`);
|
|
90
|
+
const o = t.__TooltipId, r = I(t, e), l = a(t, e, "color", "color"), n = a(
|
|
85
91
|
t,
|
|
86
92
|
e,
|
|
87
93
|
"text-color",
|
|
88
94
|
"textColor"
|
|
89
|
-
),
|
|
95
|
+
), s = a(
|
|
90
96
|
t,
|
|
91
97
|
e,
|
|
92
98
|
"tooltip-width",
|
|
93
99
|
"width"
|
|
94
|
-
), i = typeof e.value == "object" ? e.value.customClass : void 0,
|
|
100
|
+
), i = typeof e.value == "object" ? e.value.customClass : void 0, f = E(e), m = T(_, {
|
|
95
101
|
id: o,
|
|
96
|
-
direction:
|
|
102
|
+
direction: f,
|
|
97
103
|
content: r,
|
|
98
104
|
color: l,
|
|
99
105
|
textColor: n,
|
|
100
|
-
width:
|
|
106
|
+
width: s,
|
|
101
107
|
customClass: i
|
|
102
108
|
});
|
|
103
|
-
|
|
109
|
+
d(m, t), t.setAttribute("aria-describedby", o);
|
|
104
110
|
}, y = (t) => {
|
|
105
|
-
|
|
106
|
-
},
|
|
111
|
+
d(null, t), t.removeAttribute("aria-describedby"), delete t.__TooltipId;
|
|
112
|
+
}, V = {
|
|
107
113
|
mounted(t, e) {
|
|
108
|
-
t.__HandleTooltip = (o) =>
|
|
114
|
+
t.__HandleTooltip = (o) => x(t, o), t.__UnmountTooltip = () => y(t), t.__HandleTooltip(e);
|
|
109
115
|
},
|
|
110
116
|
updated(t, e, o, r) {
|
|
111
117
|
const l = e.value !== e.oldValue;
|
|
112
118
|
let n = !1;
|
|
113
|
-
const
|
|
114
|
-
if (
|
|
115
|
-
const i =
|
|
119
|
+
const s = r.dirs?.find((i) => i.dir === V);
|
|
120
|
+
if (s) {
|
|
121
|
+
const i = s.arg;
|
|
116
122
|
e.arg !== i && (n = !0);
|
|
117
123
|
}
|
|
118
124
|
(l || n) && t.__HandleTooltip(e);
|
|
@@ -122,8 +128,8 @@ const s = (t, e, o, r) => {
|
|
|
122
128
|
}
|
|
123
129
|
};
|
|
124
130
|
export {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
131
|
+
O as vClickOutside,
|
|
132
|
+
L as vCollapse,
|
|
133
|
+
j as vToggle,
|
|
134
|
+
V as vTooltip
|
|
129
135
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const v=require("isomorphic-dompurify"),l=require("vue"),c=require("./index-CsKLajvY.cjs"),f=(e,t,o)=>!t||!(t instanceof Node)||e===t||e.contains(t)?!1:o?.length?!o.some(n=>n===t||n.contains(t)):!0,u=e=>typeof e.value=="function"?{handler:e.value,events:["click"]}:{handler:e.value.handler,events:e.value.events||["click"],excludeElements:e.value.excludeElements},p=(e,t)=>{const o=(n=[],r=[])=>n.length===r.length&&n.every((i,s)=>i===r[s]);return e.handler===t.handler&&o(e.events,t.events)&&o(e.excludeElements,t.excludeElements)},d=(e,t,o)=>n=>{f(e,n.target,o)&&t(n)},m={mounted(e,t){const{handler:o,events:n,excludeElements:r}=u(t);e.__ClickOutsideHandler=d(e,o,r),n.forEach(i=>{document.addEventListener(i,e.__ClickOutsideHandler,!0)})},updated(e,t){const o=u({...t,value:t.oldValue});if(e.__ClickOutsideHandler&&p(o,u(t)))return;e.__ClickOutsideHandler&&o.events.forEach(s=>{document.removeEventListener(s,e.__ClickOutsideHandler,!0)});const{handler:n,events:r,excludeElements:i}=u(t);e.__ClickOutsideHandler=d(e,n,i),r.forEach(s=>{document.addEventListener(s,e.__ClickOutsideHandler,!0)})},unmounted(e,t){if(e.__ClickOutsideHandler){const{events:o}=u(t);o.forEach(n=>{document.removeEventListener(n,e.__ClickOutsideHandler,!0)}),delete e.__ClickOutsideHandler}}},a={left:"tooltip-left",top:"tooltip-top",bottom:"tooltip-bottom",right:"tooltip-right"},h=l.defineComponent({name:"Tooltip",props:{id:{type:String,default:void 0},direction:{type:String,default:"right"},color:{type:String,default:"dark-3"},textColor:{type:String,default:"white"},width:{type:[Number,String],default:80},customClass:{type:String,default:""},content:{type:String,required:!0}},setup(e){const t="invisible opacity-0 group-hover:visible group-hover:opacity-100 group-focus:visible group-focus:opacity-100 z-[100] tooltip",o=l.computed(()=>[c.generateClass.bgColorVariant({color:e.color}),c.generateClass.textColorVariant({color:e.textColor})].join(" ")),n=l.computed(()=>({width:`${e.width}px`})),r=l.computed(()=>a[e.direction]||a.right),i=l.computed(()=>[t,r.value,o.value,e.customClass]);return()=>l.h("div",{id:e.id,class:i.value,role:"tooltip",innerHTML:v.sanitize(e.content),style:[n.value]})}});exports.tooltip=h;exports.vClickOutside=m;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import v from "isomorphic-dompurify";
|
|
2
|
+
import { defineComponent as f, computed as u, h as m } from "vue";
|
|
3
|
+
import { g as c } from "./index-CDXrm85l.js";
|
|
4
|
+
const p = (t, e, o) => !e || !(e instanceof Node) || t === e || t.contains(e) ? !1 : o?.length ? !o.some(
|
|
5
|
+
(n) => n === e || n.contains(e)
|
|
6
|
+
) : !0, s = (t) => typeof t.value == "function" ? {
|
|
7
|
+
handler: t.value,
|
|
8
|
+
events: ["click"]
|
|
9
|
+
} : {
|
|
10
|
+
handler: t.value.handler,
|
|
11
|
+
events: t.value.events || ["click"],
|
|
12
|
+
excludeElements: t.value.excludeElements
|
|
13
|
+
}, h = (t, e) => {
|
|
14
|
+
const o = (n = [], r = []) => n.length === r.length && n.every((i, l) => i === r[l]);
|
|
15
|
+
return t.handler === e.handler && o(t.events, e.events) && o(t.excludeElements, e.excludeElements);
|
|
16
|
+
}, a = (t, e, o) => (n) => {
|
|
17
|
+
p(t, n.target, o) && e(n);
|
|
18
|
+
}, k = {
|
|
19
|
+
mounted(t, e) {
|
|
20
|
+
const { handler: o, events: n, excludeElements: r } = s(e);
|
|
21
|
+
t.__ClickOutsideHandler = a(t, o, r), n.forEach((i) => {
|
|
22
|
+
document.addEventListener(i, t.__ClickOutsideHandler, !0);
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
updated(t, e) {
|
|
26
|
+
const o = s({
|
|
27
|
+
...e,
|
|
28
|
+
value: e.oldValue
|
|
29
|
+
});
|
|
30
|
+
if (t.__ClickOutsideHandler && h(o, s(e)))
|
|
31
|
+
return;
|
|
32
|
+
t.__ClickOutsideHandler && o.events.forEach((l) => {
|
|
33
|
+
document.removeEventListener(l, t.__ClickOutsideHandler, !0);
|
|
34
|
+
});
|
|
35
|
+
const { handler: n, events: r, excludeElements: i } = s(e);
|
|
36
|
+
t.__ClickOutsideHandler = a(t, n, i), r.forEach((l) => {
|
|
37
|
+
document.addEventListener(l, t.__ClickOutsideHandler, !0);
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
unmounted(t, e) {
|
|
41
|
+
if (t.__ClickOutsideHandler) {
|
|
42
|
+
const { events: o } = s(e);
|
|
43
|
+
o.forEach((n) => {
|
|
44
|
+
document.removeEventListener(n, t.__ClickOutsideHandler, !0);
|
|
45
|
+
}), delete t.__ClickOutsideHandler;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}, d = {
|
|
49
|
+
left: "tooltip-left",
|
|
50
|
+
top: "tooltip-top",
|
|
51
|
+
bottom: "tooltip-bottom",
|
|
52
|
+
right: "tooltip-right"
|
|
53
|
+
}, y = f({
|
|
54
|
+
// eslint-disable-next-line vue/multi-word-component-names -- exported component; renaming it would change its public name
|
|
55
|
+
name: "Tooltip",
|
|
56
|
+
props: {
|
|
57
|
+
id: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: void 0
|
|
60
|
+
},
|
|
61
|
+
direction: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: "right"
|
|
64
|
+
},
|
|
65
|
+
color: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: "dark-3"
|
|
68
|
+
},
|
|
69
|
+
textColor: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: "white"
|
|
72
|
+
},
|
|
73
|
+
width: {
|
|
74
|
+
type: [Number, String],
|
|
75
|
+
default: 80
|
|
76
|
+
},
|
|
77
|
+
customClass: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: ""
|
|
80
|
+
},
|
|
81
|
+
content: {
|
|
82
|
+
type: String,
|
|
83
|
+
required: !0
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
setup(t) {
|
|
87
|
+
const e = "invisible opacity-0 group-hover:visible group-hover:opacity-100 group-focus:visible group-focus:opacity-100 z-[100] tooltip", o = u(() => [
|
|
88
|
+
c.bgColorVariant({ color: t.color }),
|
|
89
|
+
c.textColorVariant({ color: t.textColor })
|
|
90
|
+
].join(" ")), n = u(() => ({ width: `${t.width}px` })), r = u(() => d[t.direction] || d.right), i = u(() => [
|
|
91
|
+
e,
|
|
92
|
+
r.value,
|
|
93
|
+
o.value,
|
|
94
|
+
t.customClass
|
|
95
|
+
]);
|
|
96
|
+
return () => m("div", {
|
|
97
|
+
id: t.id,
|
|
98
|
+
class: i.value,
|
|
99
|
+
role: "tooltip",
|
|
100
|
+
innerHTML: v.sanitize(t.content),
|
|
101
|
+
style: [n.value]
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
export {
|
|
106
|
+
y as t,
|
|
107
|
+
k as v
|
|
108
|
+
};
|
package/dist/mcl-theme-v4.css
CHANGED
|
@@ -403,10 +403,16 @@
|
|
|
403
403
|
}
|
|
404
404
|
|
|
405
405
|
.btn-group .btn {
|
|
406
|
-
outline: none;
|
|
407
406
|
border-radius: 0;
|
|
408
407
|
}
|
|
409
408
|
|
|
409
|
+
/* Keep the standard focus ring in a group, and lift the focused button so
|
|
410
|
+
its neighbours don't paint over the ring (#110). */
|
|
411
|
+
.btn-group .btn:focus {
|
|
412
|
+
position: relative;
|
|
413
|
+
z-index: 1;
|
|
414
|
+
}
|
|
415
|
+
|
|
410
416
|
.btn-group .btn:first-child {
|
|
411
417
|
border-top-left-radius: theme(--radius-sm);
|
|
412
418
|
border-bottom-left-radius: theme(--radius-sm);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useMutationObserver as d, useScrollLock as f } from "@vueuse/core";
|
|
2
|
+
import { ref as b, provide as g, inject as m, computed as v, isRef as r, watch as a, shallowRef as I, onMounted as A } from "vue";
|
|
3
|
+
const C = (e) => e.getAttribute("visible") === "true", M = (e) => e.type === "attributes" && e.attributeName === "visible", h = (e, t) => d(
|
|
4
|
+
e,
|
|
5
|
+
(s) => {
|
|
6
|
+
const o = s.find(M);
|
|
7
|
+
if (!o)
|
|
8
|
+
return;
|
|
9
|
+
const u = o.target, l = C(u);
|
|
10
|
+
t(l);
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
attributes: !0,
|
|
14
|
+
attributeFilter: ["visible"]
|
|
15
|
+
// only watch the visible attribute
|
|
16
|
+
}
|
|
17
|
+
), i = /* @__PURE__ */ Symbol("accordion"), k = () => {
|
|
18
|
+
const e = b(null);
|
|
19
|
+
g(i, { openId: e });
|
|
20
|
+
}, L = (e, t = !1) => {
|
|
21
|
+
const s = m(i, null);
|
|
22
|
+
if (s) {
|
|
23
|
+
const o = v(() => s.openId.value === e), u = () => {
|
|
24
|
+
s.openId.value = o.value ? null : e;
|
|
25
|
+
}, l = () => {
|
|
26
|
+
s.openId.value = e;
|
|
27
|
+
}, c = () => {
|
|
28
|
+
o.value && (s.openId.value = null);
|
|
29
|
+
};
|
|
30
|
+
return (r(t) ? t.value : t) && s.openId.value === null && l(), r(t) && a(t, (n) => n ? l() : c()), { isOpen: o, toggle: u, open: l, close: c };
|
|
31
|
+
} else {
|
|
32
|
+
const o = b(r(t) ? t.value : t);
|
|
33
|
+
return r(t) && a(t, (n) => {
|
|
34
|
+
o.value = n;
|
|
35
|
+
}), { isOpen: v(() => o.value), toggle: () => {
|
|
36
|
+
o.value = !o.value;
|
|
37
|
+
}, open: () => {
|
|
38
|
+
o.value = !0;
|
|
39
|
+
}, close: () => {
|
|
40
|
+
o.value = !1;
|
|
41
|
+
} };
|
|
42
|
+
}
|
|
43
|
+
}, R = (e) => {
|
|
44
|
+
const t = I(null), s = f(t);
|
|
45
|
+
A(() => {
|
|
46
|
+
t.value = document.documentElement, s.value = e.value;
|
|
47
|
+
}), a(e, (o) => {
|
|
48
|
+
s.value = o;
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
R as a,
|
|
53
|
+
h as o,
|
|
54
|
+
k as p,
|
|
55
|
+
L as u
|
|
56
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const a=require("@vueuse/core"),s=require("vue"),b=e=>e.getAttribute("visible")==="true",d=e=>e.type==="attributes"&&e.attributeName==="visible",f=(e,t)=>a.useMutationObserver(e,l=>{const o=l.find(d);if(!o)return;const c=o.target,u=b(c);t(u)},{attributes:!0,attributeFilter:["visible"]}),v=Symbol("accordion"),p=()=>{const e=s.ref(null);s.provide(v,{openId:e})},g=(e,t=!1)=>{const l=s.inject(v,null);if(l){const o=s.computed(()=>l.openId.value===e),c=()=>{l.openId.value=o.value?null:e},u=()=>{l.openId.value=e},r=()=>{o.value&&(l.openId.value=null)};return(s.isRef(t)?t.value:t)&&l.openId.value===null&&u(),s.isRef(t)&&s.watch(t,n=>n?u():r()),{isOpen:o,toggle:c,open:u,close:r}}else{const o=s.ref(s.isRef(t)?t.value:t);return s.isRef(t)&&s.watch(t,n=>{o.value=n}),{isOpen:s.computed(()=>o.value),toggle:()=>{o.value=!o.value},open:()=>{o.value=!0},close:()=>{o.value=!1}}}},A=e=>{const t=s.shallowRef(null),l=a.useScrollLock(t);s.onMounted(()=>{t.value=document.documentElement,l.value=e.value}),s.watch(e,o=>{l.value=o})};exports.observeVisibleAttr=f;exports.provideAccordion=p;exports.useCollapseState=g;exports.useModalScrollLock=A;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobbykim/manguito-theme",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "main theme file for manguito components library. Other MCL components will need to import this file to run.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"build": "vite build && cp lib/style/mcl-theme-v4.css dist/mcl-theme-v4.css",
|
|
82
82
|
"test": "vitest run",
|
|
83
83
|
"test:watch": "vitest",
|
|
84
|
-
"test:dist": "node scripts/check-dist-ssr.mjs"
|
|
84
|
+
"test:dist": "node scripts/check-dist-ssr.mjs",
|
|
85
|
+
"typecheck": "vue-tsc --noEmit -p tsconfig.json"
|
|
85
86
|
}
|
|
86
87
|
}
|
package/dist/index-CKV6der_.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const v=require("isomorphic-dompurify"),r=require("vue"),u=require("./index-CsKLajvY.cjs"),f=(t,e,i)=>!e||!(e instanceof Node)||t===e||t.contains(e)?!1:i?.length?!i.some(o=>o===e||o.contains(e)):!0,s=t=>typeof t.value=="function"?{handler:t.value,events:["click"]}:{handler:t.value.handler,events:t.value.events||["click"],excludeElements:t.value.excludeElements},c=(t,e,i)=>o=>{f(t,o.target,i)&&e(o)},p={mounted(t,e){const{handler:i,events:o,excludeElements:l}=s(e);t.__ClickOutsideHandler=c(t,i,l),o.forEach(n=>{document.addEventListener(n,t.__ClickOutsideHandler,!0)})},updated(t,e){t.__ClickOutsideHandler&&s({...e,value:e.oldValue}).events.forEach(a=>{document.removeEventListener(a,t.__ClickOutsideHandler,!0)});const{handler:i,events:o,excludeElements:l}=s(e);t.__ClickOutsideHandler=c(t,i,l),o.forEach(n=>{document.addEventListener(n,t.__ClickOutsideHandler,!0)})},unmounted(t,e){if(t.__ClickOutsideHandler){const{events:i}=s(e);i.forEach(o=>{document.removeEventListener(o,t.__ClickOutsideHandler,!0)}),delete t.__ClickOutsideHandler}}},d={left:"tooltip-left",top:"tooltip-top",bottom:"tooltip-bottom",right:"tooltip-right"},C=r.defineComponent({name:"Tooltip",props:{id:{type:String,default:void 0},direction:{type:String,default:"right"},color:{type:String,default:"dark-3"},textColor:{type:String,default:"white"},width:{type:[Number,String],default:80},customClass:{type:String,default:""},content:{type:String,required:!0}},setup(t){const e="invisible opacity-0 group-hover:visible group-hover:opacity-100 group-focus:visible group-focus:opacity-100 z-[100] tooltip",i=r.computed(()=>[u.generateClass.bgColorVariant({color:t.color}),u.generateClass.textColorVariant({color:t.textColor})].join(" ")),o=r.computed(()=>({width:`${t.width}px`})),l=r.computed(()=>d[t.direction]||d.right),n=r.computed(()=>[e,l.value,i.value,t.customClass]);return()=>r.h("div",{id:t.id,class:n.value,role:"tooltip",innerHTML:v.sanitize(t.content),style:[o.value]})}});exports.tooltip=C;exports.vClickOutside=p;
|
package/dist/index-r-cHwpQM.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import f from "isomorphic-dompurify";
|
|
2
|
-
import { defineComponent as v, computed as l, h as p } from "vue";
|
|
3
|
-
import { g as u } from "./index-CDXrm85l.js";
|
|
4
|
-
const m = (t, e, i) => !e || !(e instanceof Node) || t === e || t.contains(e) ? !1 : i?.length ? !i.some(
|
|
5
|
-
(o) => o === e || o.contains(e)
|
|
6
|
-
) : !0, s = (t) => typeof t.value == "function" ? {
|
|
7
|
-
handler: t.value,
|
|
8
|
-
events: ["click"]
|
|
9
|
-
} : {
|
|
10
|
-
handler: t.value.handler,
|
|
11
|
-
events: t.value.events || ["click"],
|
|
12
|
-
excludeElements: t.value.excludeElements
|
|
13
|
-
}, c = (t, e, i) => (o) => {
|
|
14
|
-
m(t, o.target, i) && e(o);
|
|
15
|
-
}, O = {
|
|
16
|
-
mounted(t, e) {
|
|
17
|
-
const { handler: i, events: o, excludeElements: r } = s(e);
|
|
18
|
-
t.__ClickOutsideHandler = c(t, i, r), o.forEach((n) => {
|
|
19
|
-
document.addEventListener(n, t.__ClickOutsideHandler, !0);
|
|
20
|
-
});
|
|
21
|
-
},
|
|
22
|
-
updated(t, e) {
|
|
23
|
-
t.__ClickOutsideHandler && s({
|
|
24
|
-
...e,
|
|
25
|
-
value: e.oldValue
|
|
26
|
-
}).events.forEach((d) => {
|
|
27
|
-
document.removeEventListener(d, t.__ClickOutsideHandler, !0);
|
|
28
|
-
});
|
|
29
|
-
const { handler: i, events: o, excludeElements: r } = s(e);
|
|
30
|
-
t.__ClickOutsideHandler = c(t, i, r), o.forEach((n) => {
|
|
31
|
-
document.addEventListener(n, t.__ClickOutsideHandler, !0);
|
|
32
|
-
});
|
|
33
|
-
},
|
|
34
|
-
unmounted(t, e) {
|
|
35
|
-
if (t.__ClickOutsideHandler) {
|
|
36
|
-
const { events: i } = s(e);
|
|
37
|
-
i.forEach((o) => {
|
|
38
|
-
document.removeEventListener(o, t.__ClickOutsideHandler, !0);
|
|
39
|
-
}), delete t.__ClickOutsideHandler;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}, a = {
|
|
43
|
-
left: "tooltip-left",
|
|
44
|
-
top: "tooltip-top",
|
|
45
|
-
bottom: "tooltip-bottom",
|
|
46
|
-
right: "tooltip-right"
|
|
47
|
-
}, k = v({
|
|
48
|
-
name: "Tooltip",
|
|
49
|
-
props: {
|
|
50
|
-
id: {
|
|
51
|
-
type: String,
|
|
52
|
-
default: void 0
|
|
53
|
-
},
|
|
54
|
-
direction: {
|
|
55
|
-
type: String,
|
|
56
|
-
default: "right"
|
|
57
|
-
},
|
|
58
|
-
color: {
|
|
59
|
-
type: String,
|
|
60
|
-
default: "dark-3"
|
|
61
|
-
},
|
|
62
|
-
textColor: {
|
|
63
|
-
type: String,
|
|
64
|
-
default: "white"
|
|
65
|
-
},
|
|
66
|
-
width: {
|
|
67
|
-
type: [Number, String],
|
|
68
|
-
default: 80
|
|
69
|
-
},
|
|
70
|
-
customClass: {
|
|
71
|
-
type: String,
|
|
72
|
-
default: ""
|
|
73
|
-
},
|
|
74
|
-
content: {
|
|
75
|
-
type: String,
|
|
76
|
-
required: !0
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
setup(t) {
|
|
80
|
-
const e = "invisible opacity-0 group-hover:visible group-hover:opacity-100 group-focus:visible group-focus:opacity-100 z-[100] tooltip", i = l(() => [
|
|
81
|
-
u.bgColorVariant({ color: t.color }),
|
|
82
|
-
u.textColorVariant({ color: t.textColor })
|
|
83
|
-
].join(" ")), o = l(() => ({ width: `${t.width}px` })), r = l(() => a[t.direction] || a.right), n = l(() => [
|
|
84
|
-
e,
|
|
85
|
-
r.value,
|
|
86
|
-
i.value,
|
|
87
|
-
t.customClass
|
|
88
|
-
]);
|
|
89
|
-
return () => p("div", {
|
|
90
|
-
id: t.id,
|
|
91
|
-
class: n.value,
|
|
92
|
-
role: "tooltip",
|
|
93
|
-
innerHTML: f.sanitize(t.content),
|
|
94
|
-
style: [o.value]
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
export {
|
|
99
|
-
k as t,
|
|
100
|
-
O as v
|
|
101
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const n=require("@vueuse/core"),o=require("vue"),v=e=>e.getAttribute("visible")==="true",b=e=>e.type==="attributes"&&e.attributeName==="visible",d=(e,s)=>n.useMutationObserver(e,l=>{const t=l.find(b);if(!t)return;const u=t.target,c=v(u);s(c)},{attributes:!0,attributeFilter:["visible"]}),r=Symbol("accordion"),p=()=>{const e=o.ref(null);o.provide(r,{openId:e})},g=(e,s=!1)=>{const l=o.inject(r,null);if(l){const t=o.computed(()=>l.openId.value===e);return{isOpen:t,toggle:()=>{l.openId.value=t.value?null:e},open:()=>{l.openId.value=e},close:()=>{t.value&&(l.openId.value=null)}}}else{const t=o.ref(o.isRef(s)?s.value:s);return o.isRef(s)&&o.watch(s,i=>{t.value=i}),{isOpen:o.computed(()=>t.value),toggle:()=>{t.value=!t.value},open:()=>{t.value=!0},close:()=>{t.value=!1}}}},f=e=>{const s=o.shallowRef(null),l=n.useScrollLock(s);o.onMounted(()=>{s.value=document.documentElement,l.value=e.value}),o.watch(e,t=>{l.value=t})};exports.observeVisibleAttr=d;exports.provideAccordion=p;exports.useCollapseState=g;exports.useModalScrollLock=f;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { useMutationObserver as p, useScrollLock as d } from "@vueuse/core";
|
|
2
|
-
import { ref as c, provide as g, inject as f, computed as u, isRef as r, watch as a, shallowRef as m, onMounted as A } from "vue";
|
|
3
|
-
const I = (e) => e.getAttribute("visible") === "true", C = (e) => e.type === "attributes" && e.attributeName === "visible", h = (e, o) => p(
|
|
4
|
-
e,
|
|
5
|
-
(s) => {
|
|
6
|
-
const t = s.find(C);
|
|
7
|
-
if (!t)
|
|
8
|
-
return;
|
|
9
|
-
const l = t.target, n = I(l);
|
|
10
|
-
o(n);
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
attributes: !0,
|
|
14
|
-
attributeFilter: ["visible"]
|
|
15
|
-
// only watch the visible attribute
|
|
16
|
-
}
|
|
17
|
-
), i = /* @__PURE__ */ Symbol("accordion"), k = () => {
|
|
18
|
-
const e = c(null);
|
|
19
|
-
g(i, { openId: e });
|
|
20
|
-
}, L = (e, o = !1) => {
|
|
21
|
-
const s = f(i, null);
|
|
22
|
-
if (s) {
|
|
23
|
-
const t = u(() => s.openId.value === e);
|
|
24
|
-
return { isOpen: t, toggle: () => {
|
|
25
|
-
s.openId.value = t.value ? null : e;
|
|
26
|
-
}, open: () => {
|
|
27
|
-
s.openId.value = e;
|
|
28
|
-
}, close: () => {
|
|
29
|
-
t.value && (s.openId.value = null);
|
|
30
|
-
} };
|
|
31
|
-
} else {
|
|
32
|
-
const t = c(r(o) ? o.value : o);
|
|
33
|
-
return r(o) && a(o, (b) => {
|
|
34
|
-
t.value = b;
|
|
35
|
-
}), { isOpen: u(() => t.value), toggle: () => {
|
|
36
|
-
t.value = !t.value;
|
|
37
|
-
}, open: () => {
|
|
38
|
-
t.value = !0;
|
|
39
|
-
}, close: () => {
|
|
40
|
-
t.value = !1;
|
|
41
|
-
} };
|
|
42
|
-
}
|
|
43
|
-
}, R = (e) => {
|
|
44
|
-
const o = m(null), s = d(o);
|
|
45
|
-
A(() => {
|
|
46
|
-
o.value = document.documentElement, s.value = e.value;
|
|
47
|
-
}), a(e, (t) => {
|
|
48
|
-
s.value = t;
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
export {
|
|
52
|
-
R as a,
|
|
53
|
-
h as o,
|
|
54
|
-
k as p,
|
|
55
|
-
L as u
|
|
56
|
-
};
|