sharedcz-vue3 1.0.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/LICENSE ADDED
@@ -0,0 +1,18 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,87 @@
1
+ # sharedcz-vue3
2
+
3
+ A small Vue 3 library with shared components and utilities.
4
+
5
+ ## Naming conventions
6
+
7
+ - Components use `Cz` prefix and PascalCase, e.g. `CzButton`.
8
+ - Utilities use `cz` prefix and camelCase, e.g. `czDebounce`, `czClamp`.
9
+ - Installing the plugin mounts utilities on `app.config.globalProperties.$cz` for runtime access (e.g. `this.$cz.czDebounce`).
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ npm i sharedcz-vue3
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```js
20
+ import { createApp } from 'vue'
21
+ import App from './App.vue'
22
+ import SharedCZ, { CzButton, czDebounce } from 'sharedcz-vue3'
23
+ import 'sharedcz-vue3/style.css'
24
+
25
+ const app = createApp(App)
26
+ app.use(SharedCZ)
27
+ app.mount('#app')
28
+
29
+ // or named imports
30
+ // app.component('CzButton', CzButton)
31
+ // console.log(czDebounce)
32
+ ```
33
+
34
+ ## Styles & theming
35
+
36
+ - Global variables and base rules are defined in `src/styles/base.css` and built to `dist/style.css`.
37
+ - Component-specific styles are stored in `src/styles/components/` and copied to `dist/components/` during `postbuild`.
38
+ - To customize theme or adapt styles in the consumer project, override CSS variables before importing the library stylesheet:
39
+
40
+ ```css
41
+ :root {
42
+ --cz-primary: #1a73e8;
43
+ --cz-btn-bg: #fff;
44
+ --cz-btn-color: #1a73e8;
45
+ }
46
+ @import 'sharedcz-vue3/style.css';
47
+ ```
48
+
49
+ If you only need to tweak a specific component, import its CSS from `dist/components/<component>.css`.
50
+
51
+ ## Build & Test
52
+
53
+ ```
54
+ cd packages/sharedcz-vue3
55
+ npm install
56
+ npm run build # builds lib to dist/ and runs postbuild to copy styles
57
+ npm test # runs unit tests (vitest)
58
+ ```
59
+
60
+ ## Publish
61
+
62
+ - Before publishing, bump the package `version` in `packages/sharedcz-vue3/package.json`.
63
+ - Publish with:
64
+
65
+ ```bash
66
+ cd packages/sharedcz-vue3
67
+ npm publish --access public
68
+ ```
69
+
70
+ > Note: This template intentionally does not contain an automated publish workflow. If your npm account requires two-factor authentication (2FA), use an Automation token with `bypass 2FA` in CI when automating publishes.
71
+
72
+ ## Files & structure
73
+
74
+ Key files:
75
+
76
+ - `src/components/` — component source files (each component has its own folder and style in `src/styles/components/`)
77
+ - `src/styles/` — `base.css` and per-component CSS files
78
+ - `src/utils/` — utility functions prefixed with `cz`
79
+ - `dist/` — build output (JS bundles + `style.css` + `components/` styles)
80
+
81
+ ---
82
+
83
+ If you'd like, I can also:
84
+ - add a small example demo (Vite app) showing variable overrides and per-component style imports, or
85
+ - create a simple CI step that runs build + tests on push (no publishing).
86
+
87
+ Tell me which (if any) you'd like next.
@@ -0,0 +1,11 @@
1
+ .cz-btn {
2
+ min-width: 100px;
3
+ height: 36px;
4
+ border-radius: 6px;
5
+ border: 1px solid var(--cz-btn-border);
6
+ background: var(--cz-btn-bg);
7
+ color: var(--cz-btn-color);
8
+ cursor: pointer;
9
+ font-family: inherit;
10
+ }
11
+ .cz-btn:hover { background: var(--cz-primary); color: #fff }
package/dist/index.css ADDED
@@ -0,0 +1 @@
1
+ .cz-btn[data-v-cfc70710]{min-width:100px;height:36px;border-radius:6px;border:1px solid var(--cz-btn-border);background:var(--cz-btn-bg);color:var(--cz-btn-color);cursor:pointer;font-family:inherit}.cz-btn[data-v-cfc70710]:hover{background:var(--cz-primary);color:#fff}
@@ -0,0 +1,45 @@
1
+ import { openBlock as r, createElementBlock as i, renderSlot as l, createTextVNode as _ } from "vue";
2
+ const a = (e, o) => {
3
+ const t = e.__vccOpts || e;
4
+ for (const [n, c] of o)
5
+ t[n] = c;
6
+ return t;
7
+ }, u = { class: "cz-btn" }, f = /* @__PURE__ */ Object.assign({ name: "CzButton" }, {
8
+ __name: "index",
9
+ setup(e) {
10
+ return (o, t) => (r(), i("button", u, [
11
+ l(o.$slots, "default", {}, () => [
12
+ t[0] || (t[0] = _("Button", -1))
13
+ ], !0)
14
+ ]));
15
+ }
16
+ }), p = /* @__PURE__ */ a(f, [["__scopeId", "data-v-cfc70710"]]);
17
+ function m(e, o = 300) {
18
+ let t;
19
+ return function(...n) {
20
+ const c = this;
21
+ clearTimeout(t), t = setTimeout(() => e.apply(c, n), o);
22
+ };
23
+ }
24
+ function d(e, o, t) {
25
+ return Math.min(t, Math.max(o, e));
26
+ }
27
+ const s = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
28
+ __proto__: null,
29
+ czClamp: d,
30
+ czDebounce: m
31
+ }, Symbol.toStringTag, { value: "Module" })), g = [p];
32
+ function b(e) {
33
+ g.forEach((o) => {
34
+ const t = o.name || o.__file && o.__file.split("/").pop().replace(/\.[^.]+$/, "");
35
+ t && e.component(t, o);
36
+ }), e.config.globalProperties.$cz || (e.config.globalProperties.$cz = {}), Object.assign(e.config.globalProperties.$cz, s);
37
+ }
38
+ const x = Object.assign({ install: b }, s);
39
+ export {
40
+ p as CzButton,
41
+ d as czClamp,
42
+ m as czDebounce,
43
+ x as default
44
+ };
45
+ //# sourceMappingURL=sharedcz-vue3.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sharedcz-vue3.es.js","sources":["../src/components/cz-button/index.vue","../src/utils/debounce.js","../src/utils/index.js","../src/index.js"],"sourcesContent":["<template>\r\n <button class=\"cz-btn\"><slot>Button</slot></button>\r\n</template>\r\n\r\n<script setup>\r\ndefineOptions({ name: 'CzButton' })\r\n</script>\r\n\r\n<style src=\"../../styles/components/cz-button.css\" scoped></style>\r\n","/**\r\n * Debounce helper (cz-prefixed)\r\n * @param {Function} fn\r\n * @param {number} wait\r\n */\r\nexport function czDebounce(fn, wait = 300) {\r\n let timer\r\n return function (...args) {\r\n const ctx = this\r\n clearTimeout(timer)\r\n timer = setTimeout(() => fn.apply(ctx, args), wait)\r\n }\r\n}\r\n","export { czDebounce } from './debounce'\r\n\r\nexport function czClamp(n, min, max) {\r\n return Math.min(max, Math.max(min, n))\r\n}\r\n","import CzButton from './components/cz-button/index.vue'\r\nimport * as utils from './utils'\r\n\r\nconst components = [CzButton]\r\n\r\nfunction install(app) {\r\n components.forEach((c) => {\r\n const name =\r\n c.name ||\r\n (c.__file &&\r\n c.__file\r\n .split('/')\r\n .pop()\r\n .replace(/\\.[^.]+$/, ''))\r\n if (name) app.component(name, c)\r\n })\r\n\r\n // Mount utilities under a short global property $cz\r\n if (!app.config.globalProperties.$cz) app.config.globalProperties.$cz = {}\r\n Object.assign(app.config.globalProperties.$cz, utils)\r\n}\r\n\r\nexport { CzButton }\r\nexport * from './utils'\r\nexport default Object.assign({ install }, utils)\r\n"],"names":["_openBlock","_createElementBlock","_hoisted_1","_renderSlot","_ctx","czDebounce","fn","wait","timer","args","ctx","czClamp","n","min","max","components","CzButton","install","app","c","name","utils","index"],"mappings":";;;;;;;;;sBACEA,EAAA,GAAAC,EAAmD,UAAnDC,GAAmD;AAAA,MAA5BC,EAAmBC,yBAAnB,MAAmB;AAAA,0BAAb,UAAM,EAAA;AAAA;;;;ACI9B,SAASC,EAAWC,GAAIC,IAAO,KAAK;AACzC,MAAIC;AACJ,SAAO,YAAaC,GAAM;AACxB,UAAMC,IAAM;AACZ,iBAAaF,CAAK,GAClBA,IAAQ,WAAW,MAAMF,EAAG,MAAMI,GAAKD,CAAI,GAAGF,CAAI;AAAA,EACnD;AACH;ACVO,SAASI,EAAQC,GAAGC,GAAKC,GAAK;AACnC,SAAO,KAAK,IAAIA,GAAK,KAAK,IAAID,GAAKD,CAAC,CAAC;AACvC;;;;;8CCDMG,IAAa,CAACC,CAAQ;AAE5B,SAASC,EAAQC,GAAK;AACpB,EAAAH,EAAW,QAAQ,CAACI,MAAM;AACxB,UAAMC,IACJD,EAAE,QACDA,EAAE,UACDA,EAAE,OACC,MAAM,GAAG,EACT,IAAK,EACL,QAAQ,YAAY,EAAE;AAC7B,IAAIC,KAAMF,EAAI,UAAUE,GAAMD,CAAC;AAAA,EACnC,CAAG,GAGID,EAAI,OAAO,iBAAiB,QAAKA,EAAI,OAAO,iBAAiB,MAAM,CAAE,IAC1E,OAAO,OAAOA,EAAI,OAAO,iBAAiB,KAAKG,CAAK;AACtD;AAIA,MAAeC,IAAA,OAAO,OAAO,EAAE,SAAAL,EAAO,GAAII,CAAK;"}
@@ -0,0 +1,3 @@
1
+ (function(o,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],c):(o=typeof globalThis<"u"?globalThis:o||self,c(o.SharedCZ={},o.Vue))})(this,function(o,c){"use strict";var s=document.createElement("style");s.textContent=`.cz-btn[data-v-cfc70710]{min-width:100px;height:36px;border-radius:6px;border:1px solid var(--cz-btn-border);background:var(--cz-btn-bg);color:var(--cz-btn-color);cursor:pointer;font-family:inherit}.cz-btn[data-v-cfc70710]:hover{background:var(--cz-primary);color:#fff}
2
+ `,document.head.appendChild(s);const z="",d=(t,n)=>{const e=t.__vccOpts||t;for(const[r,i]of n)e[r]=i;return e},_={class:"cz-btn"},a=d(Object.assign({name:"CzButton"},{__name:"index",setup(t){return(n,e)=>(c.openBlock(),c.createElementBlock("button",_,[c.renderSlot(n.$slots,"default",{},()=>[e[0]||(e[0]=c.createTextVNode("Button",-1))],!0)]))}}),[["__scopeId","data-v-cfc70710"]]);function l(t,n=300){let e;return function(...r){const i=this;clearTimeout(e),e=setTimeout(()=>t.apply(i,r),n)}}function u(t,n,e){return Math.min(e,Math.max(n,t))}const f=Object.freeze(Object.defineProperty({__proto__:null,czClamp:u,czDebounce:l},Symbol.toStringTag,{value:"Module"})),p=[a];function b(t){p.forEach(n=>{const e=n.name||n.__file&&n.__file.split("/").pop().replace(/\.[^.]+$/,"");e&&t.component(e,n)}),t.config.globalProperties.$cz||(t.config.globalProperties.$cz={}),Object.assign(t.config.globalProperties.$cz,f)}const m=Object.assign({install:b},f);o.CzButton=a,o.czClamp=u,o.czDebounce=l,o.default=m,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
3
+ //# sourceMappingURL=sharedcz-vue3.umd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sharedcz-vue3.umd.js","sources":["../src/components/cz-button/index.vue","../src/utils/debounce.js","../src/utils/index.js","../src/index.js"],"sourcesContent":["<template>\r\n <button class=\"cz-btn\"><slot>Button</slot></button>\r\n</template>\r\n\r\n<script setup>\r\ndefineOptions({ name: 'CzButton' })\r\n</script>\r\n\r\n<style src=\"../../styles/components/cz-button.css\" scoped></style>\r\n","/**\r\n * Debounce helper (cz-prefixed)\r\n * @param {Function} fn\r\n * @param {number} wait\r\n */\r\nexport function czDebounce(fn, wait = 300) {\r\n let timer\r\n return function (...args) {\r\n const ctx = this\r\n clearTimeout(timer)\r\n timer = setTimeout(() => fn.apply(ctx, args), wait)\r\n }\r\n}\r\n","export { czDebounce } from './debounce'\r\n\r\nexport function czClamp(n, min, max) {\r\n return Math.min(max, Math.max(min, n))\r\n}\r\n","import CzButton from './components/cz-button/index.vue'\r\nimport * as utils from './utils'\r\n\r\nconst components = [CzButton]\r\n\r\nfunction install(app) {\r\n components.forEach((c) => {\r\n const name =\r\n c.name ||\r\n (c.__file &&\r\n c.__file\r\n .split('/')\r\n .pop()\r\n .replace(/\\.[^.]+$/, ''))\r\n if (name) app.component(name, c)\r\n })\r\n\r\n // Mount utilities under a short global property $cz\r\n if (!app.config.globalProperties.$cz) app.config.globalProperties.$cz = {}\r\n Object.assign(app.config.globalProperties.$cz, utils)\r\n}\r\n\r\nexport { CzButton }\r\nexport * from './utils'\r\nexport default Object.assign({ install }, utils)\r\n"],"names":["_openBlock","_createElementBlock","_hoisted_1","_renderSlot","_ctx","czDebounce","fn","wait","timer","args","ctx","czClamp","n","min","max","components","CzButton","install","app","c","name","utils","index"],"mappings":";6MACEA,YAAA,EAAAC,qBAAmD,SAAnDC,EAAmD,CAA5BC,EAAAA,WAAmBC,sBAAnB,IAAmB,+BAAb,SAAM,EAAA,iDCI9B,SAASC,EAAWC,EAAIC,EAAO,IAAK,CACzC,IAAIC,EACJ,OAAO,YAAaC,EAAM,CACxB,MAAMC,EAAM,KACZ,aAAaF,CAAK,EAClBA,EAAQ,WAAW,IAAMF,EAAG,MAAMI,EAAKD,CAAI,EAAGF,CAAI,CACnD,CACH,CCVO,SAASI,EAAQC,EAAGC,EAAKC,EAAK,CACnC,OAAO,KAAK,IAAIA,EAAK,KAAK,IAAID,EAAKD,CAAC,CAAC,CACvC,2HCDMG,EAAa,CAACC,CAAQ,EAE5B,SAASC,EAAQC,EAAK,CACpBH,EAAW,QAASI,GAAM,CACxB,MAAMC,EACJD,EAAE,MACDA,EAAE,QACDA,EAAE,OACC,MAAM,GAAG,EACT,IAAK,EACL,QAAQ,WAAY,EAAE,EACzBC,GAAMF,EAAI,UAAUE,EAAMD,CAAC,CACnC,CAAG,EAGID,EAAI,OAAO,iBAAiB,MAAKA,EAAI,OAAO,iBAAiB,IAAM,CAAE,GAC1E,OAAO,OAAOA,EAAI,OAAO,iBAAiB,IAAKG,CAAK,CACtD,CAIe,MAAAC,EAAA,OAAO,OAAO,CAAE,QAAAL,CAAO,EAAII,CAAK"}
package/dist/style.css ADDED
@@ -0,0 +1,10 @@
1
+ /* Global variables and base styles for sharedcz-vue3 */
2
+ :root {
3
+ --cz-primary: #000;
4
+ --cz-btn-bg: #fff;
5
+ --cz-btn-color: #000;
6
+ --cz-btn-border: #000;
7
+ }
8
+
9
+ * { box-sizing: border-box }
10
+ body { margin: 0 }
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "sharedcz-vue3",
3
+ "version": "1.0.0",
4
+ "private": false,
5
+ "type": "module",
6
+ "main": "dist/sharedcz-vue3.umd.js",
7
+ "module": "dist/sharedcz-vue3.es.js",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/sharedcz-vue3.es.js",
11
+ "require": "./dist/sharedcz-vue3.umd.js"
12
+ },
13
+ "./style.css": "./dist/style.css"
14
+ },
15
+ "files": ["dist", "README.md", "LICENSE"],
16
+ "scripts": {
17
+ "dev": "vite",
18
+ "build": "vite build",
19
+ "postbuild": "node scripts/copy-styles.js",
20
+ "test": "vitest",
21
+ "dev:example": "cd example && npm install && npm run dev"
22
+ },
23
+ "peerDependencies": {
24
+ "vue": "^3.2.0"
25
+ },
26
+ "devDependencies": {
27
+ "vite": "^4.4.9",
28
+ "@vitejs/plugin-vue": "^4.2.0",
29
+ "vitest": "^0.34.0",
30
+ "@vue/test-utils": "^2.0.0-rc.24"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "description": "sharedcz-vue3 - shared Vue 3 components and utilities"
36
+ }