@can2421/ui-components 1.0.32 → 1.0.33
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.
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
declare
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
default:
|
|
1
|
+
import { ConfigProviderContext } from './types';
|
|
2
|
+
declare function __VLS_template(): {
|
|
3
|
+
attrs: Partial<{}>;
|
|
4
|
+
slots: {
|
|
5
|
+
default?(_: {
|
|
6
|
+
config: ConfigProviderContext | undefined;
|
|
7
|
+
}): any;
|
|
6
8
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
default: string;
|
|
13
|
-
};
|
|
14
|
-
}>> & Readonly<{}>, {
|
|
9
|
+
refs: {};
|
|
10
|
+
rootEl: any;
|
|
11
|
+
};
|
|
12
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
13
|
+
declare const __VLS_component: import('vue').DefineComponent<ConfigProviderContext, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ConfigProviderContext> & Readonly<{}>, {
|
|
15
14
|
namespace: string;
|
|
16
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions,
|
|
17
|
-
|
|
15
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
17
|
+
export default _default;
|
|
18
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
19
|
+
new (): {
|
|
20
|
+
$slots: S;
|
|
21
|
+
};
|
|
22
|
+
};
|
package/dist/ui-components.mjs
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".c-button[data-v-c8316dbd]{display:inline-block;padding:.5em 1em;outline:unset;border:unset;border-radius:4px;background:#fff;cursor:pointer}.c-button[data-v-c8316dbd]:active{box-shadow:inset 0 0 0 1px #eaeaea}.c-button--primary[data-v-c8316dbd]{background:#409eff;color:#fff}.c-button--disabled[data-v-c8316dbd]{cursor:not-allowed;opacity:.5}")),document.head.appendChild(e)}}catch(d){console.error("vite-plugin-css-injected-by-js",d)}})();
|
|
2
|
-
import { ref as
|
|
3
|
-
function
|
|
2
|
+
import { ref as p, getCurrentInstance as u, computed as l, unref as s, provide as b, inject as v, defineComponent as f, createElementBlock as y, openBlock as S, normalizeClass as k, renderSlot as d, watch as h } from "vue";
|
|
3
|
+
function m(e) {
|
|
4
4
|
return e.install = (t) => {
|
|
5
5
|
const n = e.name || "UnknownComponent";
|
|
6
6
|
t.component(n, e);
|
|
7
7
|
}, e;
|
|
8
8
|
}
|
|
9
|
-
const
|
|
10
|
-
namespace: "
|
|
9
|
+
const g = Symbol("c"), r = "c", a = p({
|
|
10
|
+
namespace: "c"
|
|
11
11
|
});
|
|
12
|
-
function
|
|
13
|
-
const n =
|
|
14
|
-
return
|
|
12
|
+
function x(e, t = void 0) {
|
|
13
|
+
const n = u() ? v(g, a) : a;
|
|
14
|
+
return l(() => {
|
|
15
15
|
var o;
|
|
16
16
|
return ((o = n.value) == null ? void 0 : o[e]) ?? t;
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
const o = !!
|
|
19
|
+
function P(e, t) {
|
|
20
|
+
const o = !!u() ? b : void 0;
|
|
21
21
|
if (!o) {
|
|
22
22
|
console.warn("provideGlobalConfig", "provideGlobalConfig() can only be used inside setup().");
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
|
-
const c =
|
|
26
|
-
return o(
|
|
25
|
+
const c = l(() => s(e));
|
|
26
|
+
return o(g, c), c;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
return `${
|
|
28
|
+
function i(e) {
|
|
29
|
+
return `${x("namespace", r).value}-${e}`;
|
|
30
30
|
}
|
|
31
|
-
const
|
|
31
|
+
const $ = {
|
|
32
32
|
namespace: {
|
|
33
33
|
type: String,
|
|
34
34
|
default: "c"
|
|
35
35
|
}
|
|
36
|
-
},
|
|
37
|
-
|
|
36
|
+
}, _ = {
|
|
37
|
+
...$,
|
|
38
38
|
type: {
|
|
39
39
|
type: String,
|
|
40
40
|
default: "primary"
|
|
41
41
|
},
|
|
42
42
|
size: String
|
|
43
|
-
}, B = /* @__PURE__ */
|
|
43
|
+
}, B = /* @__PURE__ */ f({
|
|
44
44
|
name: "CButton",
|
|
45
45
|
__name: "button",
|
|
46
|
-
props:
|
|
46
|
+
props: _,
|
|
47
47
|
setup(e) {
|
|
48
48
|
const t = e;
|
|
49
49
|
function n() {
|
|
50
50
|
console.log("click");
|
|
51
51
|
}
|
|
52
|
-
return (o, c) => (
|
|
53
|
-
class:
|
|
52
|
+
return (o, c) => (S(), y("div", {
|
|
53
|
+
class: k([s(i)("button"), s(i)(`button--${t.type}`)]),
|
|
54
54
|
onClick: n
|
|
55
55
|
}, [
|
|
56
|
-
|
|
56
|
+
d(o.$slots, "default", {}, void 0, !0)
|
|
57
57
|
], 2));
|
|
58
58
|
}
|
|
59
59
|
}), j = (e, t) => {
|
|
@@ -61,37 +61,33 @@ const x = {
|
|
|
61
61
|
for (const [o, c] of t)
|
|
62
62
|
n[o] = c;
|
|
63
63
|
return n;
|
|
64
|
-
}, w = /* @__PURE__ */ j(B, [["__scopeId", "data-v-c8316dbd"]]), G =
|
|
65
|
-
namespace: {
|
|
66
|
-
type: String,
|
|
67
|
-
default: "c"
|
|
68
|
-
}
|
|
69
|
-
}, $ = l({
|
|
64
|
+
}, w = /* @__PURE__ */ j(B, [["__scopeId", "data-v-c8316dbd"]]), G = m(w), O = /* @__PURE__ */ f({
|
|
70
65
|
name: "CConfigProvider",
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
66
|
+
__name: "index",
|
|
67
|
+
props: {
|
|
68
|
+
namespace: { default: r }
|
|
69
|
+
},
|
|
70
|
+
setup(e) {
|
|
71
|
+
const t = e, n = p({
|
|
72
|
+
namespace: r
|
|
73
|
+
}), o = P(n);
|
|
74
|
+
return h(
|
|
75
|
+
() => t,
|
|
78
76
|
(c) => {
|
|
79
77
|
n.value.namespace = c == null ? void 0 : c.namespace;
|
|
80
78
|
},
|
|
81
79
|
{
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
immediate: !0,
|
|
81
|
+
deep: !0
|
|
84
82
|
}
|
|
85
|
-
);
|
|
86
|
-
const o = h(n);
|
|
87
|
-
return () => f(t, "default", { config: o == null ? void 0 : o.value });
|
|
83
|
+
), (c, C) => d(c.$slots, "default", { config: s(o) });
|
|
88
84
|
}
|
|
89
|
-
}), z =
|
|
85
|
+
}), z = m(O), I = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
90
86
|
__proto__: null,
|
|
91
87
|
CButton: G,
|
|
92
88
|
CConfigProvider: z,
|
|
93
|
-
buttonProps:
|
|
94
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
89
|
+
buttonProps: _
|
|
90
|
+
}, Symbol.toStringTag, { value: "Module" })), N = {
|
|
95
91
|
install(e) {
|
|
96
92
|
Object.entries(I).forEach(([t, n]) => {
|
|
97
93
|
e.component(t, n);
|
|
@@ -101,6 +97,6 @@ const x = {
|
|
|
101
97
|
export {
|
|
102
98
|
G as CButton,
|
|
103
99
|
z as CConfigProvider,
|
|
104
|
-
|
|
105
|
-
|
|
100
|
+
_ as buttonProps,
|
|
101
|
+
N as default
|
|
106
102
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".c-button[data-v-c8316dbd]{display:inline-block;padding:.5em 1em;outline:unset;border:unset;border-radius:4px;background:#fff;cursor:pointer}.c-button[data-v-c8316dbd]:active{box-shadow:inset 0 0 0 1px #eaeaea}.c-button--primary[data-v-c8316dbd]{background:#409eff;color:#fff}.c-button--disabled[data-v-c8316dbd]{cursor:not-allowed;opacity:.5}")),document.head.appendChild(e)}}catch(d){console.error("vite-plugin-css-injected-by-js",d)}})();
|
|
2
|
-
(function(r,
|
|
2
|
+
(function(r,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],n):(r=typeof globalThis<"u"?globalThis:r||self,n(r["can-lib"]={},r.Vue))})(this,(function(r,n){"use strict";function f(e){return e.install=o=>{const t=e.name||"UnknownComponent";o.component(t,e)},e}const p=Symbol("c"),i="c",u=n.ref({namespace:"c"});function _(e,o=void 0){const t=n.getCurrentInstance()?n.inject(p,u):u;return n.computed(()=>{var c;return((c=t.value)==null?void 0:c[e])??o})}function g(e,o){const c=!!n.getCurrentInstance()?n.provide:void 0;if(!c){console.warn("provideGlobalConfig","provideGlobalConfig() can only be used inside setup().");return}const s=n.computed(()=>n.unref(e));return c(p,s),s}function l(e){return`${_("namespace",i).value}-${e}`}const a={...{namespace:{type:String,default:"c"}},type:{type:String,default:"primary"},size:String},d=f(((e,o)=>{const t=e.__vccOpts||e;for(const[c,s]of o)t[c]=s;return t})(n.defineComponent({name:"CButton",__name:"button",props:a,setup(e){const o=e;function t(){console.log("click")}return(c,s)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass([n.unref(l)("button"),n.unref(l)(`button--${o.type}`)]),onClick:t},[n.renderSlot(c.$slots,"default",{},void 0,!0)],2))}}),[["__scopeId","data-v-c8316dbd"]])),m=f(n.defineComponent({name:"CConfigProvider",__name:"index",props:{namespace:{default:i}},setup(e){const o=e,t=n.ref({namespace:i}),c=g(t);return n.watch(()=>o,s=>{t.value.namespace=s==null?void 0:s.namespace},{immediate:!0,deep:!0}),(s,y)=>n.renderSlot(s.$slots,"default",{config:n.unref(c)})}})),C=Object.freeze(Object.defineProperty({__proto__:null,CButton:d,CConfigProvider:m,buttonProps:a},Symbol.toStringTag,{value:"Module"})),b={install(e){Object.entries(C).forEach(([o,t])=>{e.component(o,t)})}};r.CButton=d,r.CConfigProvider=m,r.buttonProps=a,r.default=b,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|