@can2421/ui-components 1.0.28 → 1.0.30

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 +1,2 @@
1
1
  export * from './button';
2
+ export * from './config-provider/index';
@@ -1,67 +1,103 @@
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 u, getCurrentInstance as i, inject as p, computed as f, defineComponent as m, createElementBlock as d, openBlock as _, normalizeClass as b, unref as s, renderSlot as g } from "vue";
3
- const y = (t) => (t.install = (e) => {
4
- const n = t.name || "UnknownComponent";
5
- e.component(n, t);
6
- }, t), C = Symbol("c"), v = "c", a = u({
2
+ import { ref as i, getCurrentInstance as p, computed as u, unref as r, provide as g, inject as b, defineComponent as l, createElementBlock as C, openBlock as v, normalizeClass as _, renderSlot as f, watch as y } from "vue";
3
+ const S = (e) => (e.install = (t) => {
4
+ const n = e.name || "UnknownComponent";
5
+ t.component(n, e);
6
+ }, e), d = Symbol("c"), k = "c", s = i({
7
7
  namespace: "ctsy"
8
8
  });
9
- function k(t, e = void 0) {
10
- const n = i() ? p(C, a) : a;
11
- return f(() => {
9
+ function P(e, t = void 0) {
10
+ const n = p() ? b(d, s) : s;
11
+ return u(() => {
12
12
  var o;
13
- return ((o = n.value) == null ? void 0 : o[t]) ?? e;
13
+ return ((o = n.value) == null ? void 0 : o[e]) ?? t;
14
14
  });
15
15
  }
16
- function r(t) {
17
- return `${k("namespace", v).value}-${t}`;
16
+ function h(e, t) {
17
+ const o = !!p() ? g : void 0;
18
+ if (!o) {
19
+ console.warn("provideGlobalConfig", "provideGlobalConfig() can only be used inside setup().");
20
+ return;
21
+ }
22
+ const c = u(() => r(e));
23
+ return o(d, c), c;
24
+ }
25
+ function a(e) {
26
+ return `${P("namespace", k).value}-${e}`;
18
27
  }
19
- const S = {
28
+ const x = {
20
29
  namespace: {
21
30
  type: String,
22
31
  default: "c"
23
32
  }
24
- }, l = {
25
- ...S,
33
+ }, m = {
34
+ ...x,
26
35
  type: {
27
36
  type: String,
28
37
  default: "primary"
29
38
  },
30
39
  size: String
31
- }, B = /* @__PURE__ */ m({
40
+ }, B = /* @__PURE__ */ l({
32
41
  name: "CButton",
33
42
  __name: "button",
34
- props: l,
35
- setup(t) {
36
- const e = t;
43
+ props: m,
44
+ setup(e) {
45
+ const t = e;
37
46
  function n() {
38
47
  console.log("click");
39
48
  }
40
- return (o, c) => (_(), d("div", {
41
- class: b([s(r)("button"), s(r)(`button--${e.type}`)]),
49
+ return (o, c) => (v(), C("div", {
50
+ class: _([r(a)("button"), r(a)(`button--${t.type}`)]),
42
51
  onClick: n
43
52
  }, [
44
- g(o.$slots, "default", {}, void 0, !0)
53
+ f(o.$slots, "default", {}, void 0, !0)
45
54
  ], 2));
46
55
  }
47
- }), h = (t, e) => {
48
- const n = t.__vccOpts || t;
49
- for (const [o, c] of e)
56
+ }), j = (e, t) => {
57
+ const n = e.__vccOpts || e;
58
+ for (const [o, c] of t)
50
59
  n[o] = c;
51
60
  return n;
52
- }, j = /* @__PURE__ */ h(B, [["__scopeId", "data-v-c8316dbd"]]), x = y(j), O = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
61
+ }, w = /* @__PURE__ */ j(B, [["__scopeId", "data-v-c8316dbd"]]), G = S(w), O = {
62
+ namespace: {
63
+ type: String,
64
+ default: "c"
65
+ }
66
+ };
67
+ l({
68
+ name: "CConfigProvider",
69
+ props: O,
70
+ setup(e, { slots: t }) {
71
+ const n = i({
72
+ namespace: "c"
73
+ });
74
+ y(
75
+ () => e,
76
+ (c) => {
77
+ n.value.namespace = c == null ? void 0 : c.namespace;
78
+ },
79
+ {
80
+ deep: !0,
81
+ immediate: !0
82
+ }
83
+ );
84
+ const o = h(n);
85
+ return () => f(t, "default", { config: o == null ? void 0 : o.value });
86
+ }
87
+ });
88
+ const $ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53
89
  __proto__: null,
54
- CButton: x,
55
- buttonProps: l
56
- }, Symbol.toStringTag, { value: "Module" })), $ = {
57
- install(t) {
58
- Object.entries(O).forEach(([e, n]) => {
59
- t.component(e, n);
90
+ CButton: G,
91
+ buttonProps: m
92
+ }, Symbol.toStringTag, { value: "Module" })), E = {
93
+ install(e) {
94
+ Object.entries($).forEach(([t, n]) => {
95
+ e.component(t, n);
60
96
  });
61
97
  }
62
98
  };
63
99
  export {
64
- x as CButton,
65
- l as buttonProps,
66
- $ as default
100
+ G as CButton,
101
+ m as buttonProps,
102
+ E as default
67
103
  };
@@ -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(c,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(c=typeof globalThis<"u"?globalThis:c||self,e(c["can-lib"]={},c.Vue))})(this,(function(c,e){"use strict";const f=t=>(t.install=n=>{const o=t.name||"UnknownComponent";n.component(o,t)},t),p=Symbol("c"),d="c",r=e.ref({namespace:"ctsy"});function m(t,n=void 0){const o=e.getCurrentInstance()?e.inject(p,r):r;return e.computed(()=>{var s;return((s=o.value)==null?void 0:s[t])??n})}function i(t){return`${m("namespace",d).value}-${t}`}const a={...{namespace:{type:String,default:"c"}},type:{type:String,default:"primary"},size:String},l=f(((t,n)=>{const o=t.__vccOpts||t;for(const[s,u]of n)o[s]=u;return o})(e.defineComponent({name:"CButton",__name:"button",props:a,setup(t){const n=t;function o(){console.log("click")}return(s,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([e.unref(i)("button"),e.unref(i)(`button--${n.type}`)]),onClick:o},[e.renderSlot(s.$slots,"default",{},void 0,!0)],2))}}),[["__scopeId","data-v-c8316dbd"]])),_=Object.freeze(Object.defineProperty({__proto__:null,CButton:l,buttonProps:a},Symbol.toStringTag,{value:"Module"})),b={install(t){Object.entries(_).forEach(([n,o])=>{t.component(n,o)})}};c.CButton=l,c.buttonProps=a,c.default=b,Object.defineProperties(c,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
2
+ (function(r,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(r=typeof globalThis<"u"?globalThis:r||self,e(r["can-lib"]={},r.Vue))})(this,(function(r,e){"use strict";const f=n=>(n.install=o=>{const t=n.name||"UnknownComponent";o.component(t,n)},n),a=Symbol("c"),d="c",p=e.ref({namespace:"ctsy"});function m(n,o=void 0){const t=e.getCurrentInstance()?e.inject(a,p):p;return e.computed(()=>{var c;return((c=t.value)==null?void 0:c[n])??o})}function g(n,o){const c=!!e.getCurrentInstance()?e.provide:void 0;if(!c){console.warn("provideGlobalConfig","provideGlobalConfig() can only be used inside setup().");return}const s=e.computed(()=>e.unref(n));return c(a,s),s}function u(n){return`${m("namespace",d).value}-${n}`}const i={...{namespace:{type:String,default:"c"}},type:{type:String,default:"primary"},size:String},l=f(((n,o)=>{const t=n.__vccOpts||n;for(const[c,s]of o)t[c]=s;return t})(e.defineComponent({name:"CButton",__name:"button",props:i,setup(n){const o=n;function t(){console.log("click")}return(c,s)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([e.unref(u)("button"),e.unref(u)(`button--${o.type}`)]),onClick:t},[e.renderSlot(c.$slots,"default",{},void 0,!0)],2))}}),[["__scopeId","data-v-c8316dbd"]])),b={namespace:{type:String,default:"c"}};e.defineComponent({name:"CConfigProvider",props:b,setup(n,{slots:o}){const t=e.ref({namespace:"c"});e.watch(()=>n,s=>{t.value.namespace=s==null?void 0:s.namespace},{deep:!0,immediate:!0});const c=g(t);return()=>e.renderSlot(o,"default",{config:c==null?void 0:c.value})}});const _=Object.freeze(Object.defineProperty({__proto__:null,CButton:l,buttonProps:i},Symbol.toStringTag,{value:"Module"})),C={install(n){Object.entries(_).forEach(([o,t])=>{n.component(o,t)})}};r.CButton=l,r.buttonProps=i,r.default=C,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@can2421/ui-components",
3
- "version": "1.0.28",
3
+ "version": "1.0.30",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./dist/index.es.d.ts",