@can2421/ui-components 1.0.31 → 1.0.32

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