@can2421/ui-components 1.0.27 → 1.0.29

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.
@@ -28,8 +28,8 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
28
28
  readonly default: "c";
29
29
  };
30
30
  }>> & Readonly<{}>, {
31
- readonly type: import('./button.types').ButtonType;
32
31
  readonly namespace: string;
32
+ readonly type: import('./button.types').ButtonType;
33
33
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
34
34
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
35
35
  export default _default;
@@ -10,8 +10,8 @@ declare const CButton: import('../../../utils/install').SFCWithInstall<{
10
10
  readonly default: "c";
11
11
  };
12
12
  }>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
13
- readonly type: import('./button.types').ButtonType;
14
13
  readonly namespace: string;
14
+ readonly type: import('./button.types').ButtonType;
15
15
  }, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
16
16
  P: {};
17
17
  B: {};
@@ -30,8 +30,8 @@ declare const CButton: import('../../../utils/install').SFCWithInstall<{
30
30
  readonly default: "c";
31
31
  };
32
32
  }>> & Readonly<{}>, {}, {}, {}, {}, {
33
- readonly type: import('./button.types').ButtonType;
34
33
  readonly namespace: string;
34
+ readonly type: import('./button.types').ButtonType;
35
35
  }>;
36
36
  __isFragment?: never;
37
37
  __isTeleport?: never;
@@ -47,8 +47,8 @@ declare const CButton: import('../../../utils/install').SFCWithInstall<{
47
47
  readonly default: "c";
48
48
  };
49
49
  }>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {
50
- readonly type: import('./button.types').ButtonType;
51
50
  readonly namespace: string;
51
+ readonly type: import('./button.types').ButtonType;
52
52
  }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
53
53
  $slots: {
54
54
  default?(_: {}): any;
@@ -0,0 +1,6 @@
1
+ import { App, MaybeRef, Ref } from 'vue';
2
+ import { ConfigProviderContext } from './types';
3
+ export declare function useGlobalConfig<K extends keyof ConfigProviderContext, D extends ConfigProviderContext[K]>(key: K, defaultValue?: D): Ref<Exclude<ConfigProviderContext[K], undefined> | D>;
4
+ export declare function useGlobalConfig(): Ref<ConfigProviderContext>;
5
+ export declare function provideGlobalConfig(config: MaybeRef<ConfigProviderContext>, app?: App): Ref<ConfigProviderContext, ConfigProviderContext> | undefined;
6
+ export declare function useNamespace(className: string): string;
@@ -0,0 +1,17 @@
1
+ declare const ConfigProvider: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
2
+ namespace: {
3
+ type: StringConstructor;
4
+ default: string;
5
+ };
6
+ }>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
7
+ [key: string]: any;
8
+ }>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
9
+ namespace: {
10
+ type: StringConstructor;
11
+ default: string;
12
+ };
13
+ }>> & Readonly<{}>, {
14
+ namespace: string;
15
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
16
+ export type ConfigProviderInstance = InstanceType<typeof ConfigProvider>;
17
+ export default ConfigProvider;
@@ -0,0 +1,6 @@
1
+ export declare const configproviderProps: {
2
+ namespace: {
3
+ type: StringConstructor;
4
+ default: string;
5
+ };
6
+ };
@@ -0,0 +1,4 @@
1
+ import { InjectionKey, Ref } from 'vue';
2
+ import { ConfigProviderContext } from './types';
3
+ export declare const configProviderContextKey: InjectionKey<Ref<ConfigProviderContext>>;
4
+ export declare const defaultNamespace = "c";
@@ -0,0 +1,3 @@
1
+ export interface ConfigProviderContext {
2
+ namespace: string;
3
+ }
@@ -1 +1,2 @@
1
1
  export * from './button';
2
+ export * from './config-provider';
@@ -1,53 +1,103 @@
1
- import { defineComponent as r, createElementBlock as a, openBlock as l, normalizeClass as p, renderSlot as i } from "vue";
2
- const u = (t) => (t.install = (n) => {
3
- const e = t.name || "UnknownComponent";
4
- n.component(e, t);
5
- }, t), m = {
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 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
+ namespace: "ctsy"
8
+ });
9
+ function P(e, t = void 0) {
10
+ const n = p() ? b(d, s) : s;
11
+ return u(() => {
12
+ var o;
13
+ return ((o = n.value) == null ? void 0 : o[e]) ?? t;
14
+ });
15
+ }
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}`;
27
+ }
28
+ const x = {
6
29
  namespace: {
7
30
  type: String,
8
31
  default: "c"
9
32
  }
10
- }, c = {
11
- ...m,
33
+ }, m = {
34
+ ...x,
12
35
  type: {
13
36
  type: String,
14
37
  default: "primary"
15
38
  },
16
39
  size: String
17
- }, d = /* @__PURE__ */ r({
40
+ }, B = /* @__PURE__ */ l({
18
41
  name: "CButton",
19
42
  __name: "button",
20
- props: c,
21
- setup(t) {
22
- const n = t;
23
- function e() {
43
+ props: m,
44
+ setup(e) {
45
+ const t = e;
46
+ function n() {
24
47
  console.log("click");
25
48
  }
26
- return (o, s) => (l(), a("div", {
27
- class: p([`${o.namespace}-button`, `${o.namespace}-button--${n.type}`]),
28
- onClick: e
49
+ return (o, c) => (v(), C("div", {
50
+ class: _([r(a)("button"), r(a)(`button--${t.type}`)]),
51
+ onClick: n
29
52
  }, [
30
- i(o.$slots, "default", {}, void 0, !0)
53
+ f(o.$slots, "default", {}, void 0, !0)
31
54
  ], 2));
32
55
  }
33
- }), f = (t, n) => {
34
- const e = t.__vccOpts || t;
35
- for (const [o, s] of n)
36
- e[o] = s;
37
- return e;
38
- }, _ = /* @__PURE__ */ f(d, [["__scopeId", "data-v-e76271b0"]]), b = u(_), y = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
56
+ }), j = (e, t) => {
57
+ const n = e.__vccOpts || e;
58
+ for (const [o, c] of t)
59
+ n[o] = c;
60
+ return n;
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({
39
89
  __proto__: null,
40
- CButton: b,
41
- buttonProps: c
42
- }, Symbol.toStringTag, { value: "Module" })), k = {
43
- install(t) {
44
- Object.entries(y).forEach(([n, e]) => {
45
- t.component(n, e);
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);
46
96
  });
47
97
  }
48
98
  };
49
99
  export {
50
- b as CButton,
51
- c as buttonProps,
52
- k as default
100
+ G as CButton,
101
+ m as buttonProps,
102
+ E as default
53
103
  };
@@ -1,2 +1,2 @@
1
- (function(t,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],n):(t=typeof globalThis<"u"?globalThis:t||self,n(t["can-lib"]={},t.Vue))})(this,(function(t,n){"use strict";var r=document.createElement("style");r.textContent=`.c-button[data-v-e76271b0]{display:inline-block;padding:.5em 1em;outline:unset;border:unset;border-radius:4px;background:#fff;cursor:pointer}.c-button[data-v-e76271b0]:active{box-shadow:inset 0 0 0 1px #eaeaea}.c-button--primary[data-v-e76271b0]{background:#409eff;color:#fff}.c-button--disabled[data-v-e76271b0]{cursor:not-allowed;opacity:.5}
2
- /*$vite$:1*/`,document.head.appendChild(r);const l=e=>(e.install=a=>{const o=e.name||"UnknownComponent";a.component(o,e)},e),c={...{namespace:{type:String,default:"c"}},type:{type:String,default:"primary"},size:String},i=l(((e,a)=>{const o=e.__vccOpts||e;for(const[s,u]of a)o[s]=u;return o})(n.defineComponent({name:"CButton",__name:"button",props:c,setup(e){const a=e;function o(){console.log("click")}return(s,u)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass([`${s.namespace}-button`,`${s.namespace}-button--${a.type}`]),onClick:o},[n.renderSlot(s.$slots,"default",{},void 0,!0)],2))}}),[["__scopeId","data-v-e76271b0"]])),d=Object.freeze(Object.defineProperty({__proto__:null,CButton:i,buttonProps:c},Symbol.toStringTag,{value:"Module"})),p={install(e){Object.entries(d).forEach(([a,o])=>{e.component(a,o)})}};t.CButton=i,t.buttonProps=c,t.default=p,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
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 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.27",
3
+ "version": "1.0.29",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./dist/index.es.d.ts",
package/dist/index.css DELETED
@@ -1 +0,0 @@
1
- .c-button[data-v-e76271b0]{display:inline-block;padding:.5em 1em;outline:unset;border:unset;border-radius:4px;background:#fff;cursor:pointer}.c-button[data-v-e76271b0]:active{box-shadow:inset 0 0 0 1px #eaeaea}.c-button--primary[data-v-e76271b0]{background:#409eff;color:#fff}.c-button--disabled[data-v-e76271b0]{cursor:not-allowed;opacity:.5}