cck-ui 0.0.1

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.
Files changed (276) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +3 -0
  3. package/dist/index.css +1 -0
  4. package/dist/index.full.js +2957 -0
  5. package/dist/index.full.min.js +21 -0
  6. package/dist/index.full.min.js.map +1 -0
  7. package/dist/index.full.min.mjs +21 -0
  8. package/dist/index.full.min.mjs.map +1 -0
  9. package/dist/index.full.mjs +2945 -0
  10. package/es/_virtual/_rolldown/runtime.mjs +27 -0
  11. package/es/component.d.ts +6 -0
  12. package/es/component.mjs +8 -0
  13. package/es/component.mjs.map +1 -0
  14. package/es/components/base/style/css.mjs +1 -0
  15. package/es/components/base/style/index.mjs +1 -0
  16. package/es/components/button/index.d.ts +8 -0
  17. package/es/components/button/src/button-custom.d.ts +6 -0
  18. package/es/components/button/src/button.types.d.ts +77 -0
  19. package/es/components/button/src/button.vue.d.ts +28 -0
  20. package/es/components/button/src/use-button.d.ts +14 -0
  21. package/es/components/button/style/css.mjs +2 -0
  22. package/es/components/form/index.d.ts +4 -0
  23. package/es/components/form/src/constants.d.ts +7 -0
  24. package/es/components/form/src/form.types.d.ts +10 -0
  25. package/es/components/form/src/hooks/index.d.ts +2 -0
  26. package/es/components/form/src/hooks/use-form-common-props.d.ts +7 -0
  27. package/es/components/icon/index.d.ts +26 -0
  28. package/es/components/icon/src/icon.types.d.ts +13 -0
  29. package/es/components/icon/src/icon.vue.d.ts +17 -0
  30. package/es/components/icon/style/css.mjs +1 -0
  31. package/es/components/icon/style/index.mjs +1 -0
  32. package/es/components/index.d.ts +5 -0
  33. package/es/constants/index.d.ts +3 -0
  34. package/es/constants/key.d.ts +4 -0
  35. package/es/constants/sizes.d.ts +12 -0
  36. package/es/defaults.d.ts +6 -0
  37. package/es/defaults.mjs +9 -0
  38. package/es/defaults.mjs.map +1 -0
  39. package/es/hooks/index.d.ts +4 -0
  40. package/es/hooks/use-namespace/index.d.ts +27 -0
  41. package/es/hooks/use-prop/index.d.ts +6 -0
  42. package/es/hooks/use-theme/index.d.ts +5 -0
  43. package/es/index.d.ts +11 -0
  44. package/es/index.mjs +11 -0
  45. package/es/index.mjs.map +1 -0
  46. package/es/make-installer.d.ts +8 -0
  47. package/es/make-installer.mjs +14 -0
  48. package/es/make-installer.mjs.map +1 -0
  49. package/es/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/module/conversion.mjs +268 -0
  50. package/es/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/module/conversion.mjs.map +1 -0
  51. package/es/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/module/css-color-names.mjs +158 -0
  52. package/es/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/module/css-color-names.mjs.map +1 -0
  53. package/es/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/module/format-input.mjs +192 -0
  54. package/es/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/module/format-input.mjs.map +1 -0
  55. package/es/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/module/index.mjs +456 -0
  56. package/es/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/module/index.mjs.map +1 -0
  57. package/es/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/module/util.mjs +65 -0
  58. package/es/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/module/util.mjs.map +1 -0
  59. package/es/node_modules/.pnpm/es-toolkit@1.47.0/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs +53 -0
  60. package/es/node_modules/.pnpm/es-toolkit@1.47.0/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs.map +1 -0
  61. package/es/node_modules/.pnpm/vue@3.5.35_typescript@6.0.3/node_modules/vue/dist/vue.runtime.esm-bundler.mjs +22 -0
  62. package/es/node_modules/.pnpm/vue@3.5.35_typescript@6.0.3/node_modules/vue/dist/vue.runtime.esm-bundler.mjs.map +1 -0
  63. package/es/packages/components/button/index.mjs +8 -0
  64. package/es/packages/components/button/index.mjs.map +1 -0
  65. package/es/packages/components/button/src/button-custom.mjs +121 -0
  66. package/es/packages/components/button/src/button-custom.mjs.map +1 -0
  67. package/es/packages/components/button/src/button.mjs +7 -0
  68. package/es/packages/components/button/src/button.mjs.map +1 -0
  69. package/es/packages/components/button/src/button.types.mjs +0 -0
  70. package/es/packages/components/button/src/button.vue_vue_type_script_setup_true_lang.mjs +139 -0
  71. package/es/packages/components/button/src/button.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
  72. package/es/packages/components/button/src/use-button.mjs +41 -0
  73. package/es/packages/components/button/src/use-button.mjs.map +1 -0
  74. package/es/packages/components/form/index.mjs +3 -0
  75. package/es/packages/components/form/src/constants.mjs +6 -0
  76. package/es/packages/components/form/src/constants.mjs.map +1 -0
  77. package/es/packages/components/form/src/form.types.mjs +0 -0
  78. package/es/packages/components/form/src/hooks/index.mjs +2 -0
  79. package/es/packages/components/form/src/hooks/use-form-common-props.mjs +16 -0
  80. package/es/packages/components/form/src/hooks/use-form-common-props.mjs.map +1 -0
  81. package/es/packages/components/icon/index.mjs +8 -0
  82. package/es/packages/components/icon/index.mjs.map +1 -0
  83. package/es/packages/components/icon/src/icon.mjs +7 -0
  84. package/es/packages/components/icon/src/icon.mjs.map +1 -0
  85. package/es/packages/components/icon/src/icon.types.mjs +0 -0
  86. package/es/packages/components/icon/src/icon.vue_vue_type_script_setup_true_lang.mjs +42 -0
  87. package/es/packages/components/icon/src/icon.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
  88. package/es/packages/components/index.mjs +3 -0
  89. package/es/packages/constants/index.mjs +3 -0
  90. package/es/packages/constants/key.mjs +6 -0
  91. package/es/packages/constants/key.mjs.map +1 -0
  92. package/es/packages/constants/sizes.mjs +24 -0
  93. package/es/packages/constants/sizes.mjs.map +1 -0
  94. package/es/packages/hooks/index.mjs +4 -0
  95. package/es/packages/hooks/use-namespace/index.mjs +63 -0
  96. package/es/packages/hooks/use-namespace/index.mjs.map +1 -0
  97. package/es/packages/hooks/use-prop/index.mjs +10 -0
  98. package/es/packages/hooks/use-prop/index.mjs.map +1 -0
  99. package/es/packages/hooks/use-theme/index.mjs +19 -0
  100. package/es/packages/hooks/use-theme/index.mjs.map +1 -0
  101. package/es/packages/utils/colors.mjs +109 -0
  102. package/es/packages/utils/colors.mjs.map +1 -0
  103. package/es/packages/utils/dom/index.mjs +2 -0
  104. package/es/packages/utils/dom/style.mjs +11 -0
  105. package/es/packages/utils/dom/style.mjs.map +1 -0
  106. package/es/packages/utils/index.mjs +5 -0
  107. package/es/packages/utils/types.mjs +12 -0
  108. package/es/packages/utils/types.mjs.map +1 -0
  109. package/es/packages/utils/vue/index.mjs +2 -0
  110. package/es/packages/utils/vue/install.mjs +38 -0
  111. package/es/packages/utils/vue/install.mjs.map +1 -0
  112. package/es/packages/utils/vue/typescript.mjs +0 -0
  113. package/es/plugin.d.ts +6 -0
  114. package/es/plugin.mjs +6 -0
  115. package/es/plugin.mjs.map +1 -0
  116. package/es/utils/colors.d.ts +14 -0
  117. package/es/utils/dom/index.d.ts +2 -0
  118. package/es/utils/dom/style.d.ts +4 -0
  119. package/es/utils/index.d.ts +6 -0
  120. package/es/utils/types.d.ts +8 -0
  121. package/es/utils/vue/index.d.ts +3 -0
  122. package/es/utils/vue/install.d.ts +7 -0
  123. package/es/utils/vue/typescript.d.ts +19 -0
  124. package/global.d.ts +8 -0
  125. package/lib/_virtual/_rolldown/runtime.js +37 -0
  126. package/lib/component.d.ts +6 -0
  127. package/lib/component.js +12 -0
  128. package/lib/component.js.map +1 -0
  129. package/lib/components/base/style/css.js +2 -0
  130. package/lib/components/base/style/index.js +2 -0
  131. package/lib/components/button/index.d.ts +8 -0
  132. package/lib/components/button/src/button-custom.d.ts +6 -0
  133. package/lib/components/button/src/button.types.d.ts +77 -0
  134. package/lib/components/button/src/button.vue.d.ts +28 -0
  135. package/lib/components/button/src/use-button.d.ts +14 -0
  136. package/lib/components/button/style/css.js +3 -0
  137. package/lib/components/form/index.d.ts +4 -0
  138. package/lib/components/form/src/constants.d.ts +7 -0
  139. package/lib/components/form/src/form.types.d.ts +10 -0
  140. package/lib/components/form/src/hooks/index.d.ts +2 -0
  141. package/lib/components/form/src/hooks/use-form-common-props.d.ts +7 -0
  142. package/lib/components/icon/index.d.ts +26 -0
  143. package/lib/components/icon/src/icon.types.d.ts +13 -0
  144. package/lib/components/icon/src/icon.vue.d.ts +17 -0
  145. package/lib/components/icon/style/css.js +2 -0
  146. package/lib/components/icon/style/index.js +2 -0
  147. package/lib/components/index.d.ts +5 -0
  148. package/lib/constants/index.d.ts +3 -0
  149. package/lib/constants/key.d.ts +4 -0
  150. package/lib/constants/sizes.d.ts +12 -0
  151. package/lib/defaults.d.ts +6 -0
  152. package/lib/defaults.js +13 -0
  153. package/lib/defaults.js.map +1 -0
  154. package/lib/hooks/index.d.ts +4 -0
  155. package/lib/hooks/use-namespace/index.d.ts +27 -0
  156. package/lib/hooks/use-prop/index.d.ts +6 -0
  157. package/lib/hooks/use-theme/index.d.ts +5 -0
  158. package/lib/index.d.ts +11 -0
  159. package/lib/index.js +19 -0
  160. package/lib/index.js.map +1 -0
  161. package/lib/make-installer.d.ts +8 -0
  162. package/lib/make-installer.js +15 -0
  163. package/lib/make-installer.js.map +1 -0
  164. package/lib/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/conversion.js +309 -0
  165. package/lib/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/conversion.js.map +1 -0
  166. package/lib/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/css-color-names.js +168 -0
  167. package/lib/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/css-color-names.js.map +1 -0
  168. package/lib/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/format-input.js +209 -0
  169. package/lib/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/format-input.js.map +1 -0
  170. package/lib/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/from-ratio.js +43 -0
  171. package/lib/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/from-ratio.js.map +1 -0
  172. package/lib/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/index.js +471 -0
  173. package/lib/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/index.js.map +1 -0
  174. package/lib/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/interfaces.js +14 -0
  175. package/lib/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/interfaces.js.map +1 -0
  176. package/lib/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/public_api.js +50 -0
  177. package/lib/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/public_api.js.map +1 -0
  178. package/lib/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/random.js +255 -0
  179. package/lib/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/random.js.map +1 -0
  180. package/lib/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/readability.js +96 -0
  181. package/lib/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/readability.js.map +1 -0
  182. package/lib/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/to-ms-filter.js +35 -0
  183. package/lib/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/to-ms-filter.js.map +1 -0
  184. package/lib/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/util.js +82 -0
  185. package/lib/node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/util.js.map +1 -0
  186. package/lib/node_modules/.pnpm/es-toolkit@1.47.0/node_modules/es-toolkit/dist/predicate/isPlainObject.js +53 -0
  187. package/lib/node_modules/.pnpm/es-toolkit@1.47.0/node_modules/es-toolkit/dist/predicate/isPlainObject.js.map +1 -0
  188. package/lib/node_modules/.pnpm/vue@3.5.35_typescript@6.0.3/node_modules/vue/dist/vue.cjs.js +66 -0
  189. package/lib/node_modules/.pnpm/vue@3.5.35_typescript@6.0.3/node_modules/vue/dist/vue.cjs.js.map +1 -0
  190. package/lib/node_modules/.pnpm/vue@3.5.35_typescript@6.0.3/node_modules/vue/dist/vue.cjs.prod.js +56 -0
  191. package/lib/node_modules/.pnpm/vue@3.5.35_typescript@6.0.3/node_modules/vue/dist/vue.cjs.prod.js.map +1 -0
  192. package/lib/node_modules/.pnpm/vue@3.5.35_typescript@6.0.3/node_modules/vue/index.js +18 -0
  193. package/lib/node_modules/.pnpm/vue@3.5.35_typescript@6.0.3/node_modules/vue/index.js.map +1 -0
  194. package/lib/node_modules/.pnpm/vue@3.5.35_typescript@6.0.3/node_modules/vue/index2.js +14 -0
  195. package/lib/node_modules/.pnpm/vue@3.5.35_typescript@6.0.3/node_modules/vue/index2.js.map +1 -0
  196. package/lib/packages/components/button/index.js +13 -0
  197. package/lib/packages/components/button/index.js.map +1 -0
  198. package/lib/packages/components/button/src/button-custom.js +122 -0
  199. package/lib/packages/components/button/src/button-custom.js.map +1 -0
  200. package/lib/packages/components/button/src/button.js +10 -0
  201. package/lib/packages/components/button/src/button.js.map +1 -0
  202. package/lib/packages/components/button/src/button.types.js +1 -0
  203. package/lib/packages/components/button/src/button.vue_vue_type_script_setup_true_lang.js +139 -0
  204. package/lib/packages/components/button/src/button.vue_vue_type_script_setup_true_lang.js.map +1 -0
  205. package/lib/packages/components/button/src/use-button.js +42 -0
  206. package/lib/packages/components/button/src/use-button.js.map +1 -0
  207. package/lib/packages/components/form/index.js +6 -0
  208. package/lib/packages/components/form/src/constants.js +7 -0
  209. package/lib/packages/components/form/src/constants.js.map +1 -0
  210. package/lib/packages/components/form/src/form.types.js +1 -0
  211. package/lib/packages/components/form/src/hooks/index.js +4 -0
  212. package/lib/packages/components/form/src/hooks/use-form-common-props.js +18 -0
  213. package/lib/packages/components/form/src/hooks/use-form-common-props.js.map +1 -0
  214. package/lib/packages/components/icon/index.js +13 -0
  215. package/lib/packages/components/icon/index.js.map +1 -0
  216. package/lib/packages/components/icon/src/icon.js +10 -0
  217. package/lib/packages/components/icon/src/icon.js.map +1 -0
  218. package/lib/packages/components/icon/src/icon.types.js +1 -0
  219. package/lib/packages/components/icon/src/icon.vue_vue_type_script_setup_true_lang.js +42 -0
  220. package/lib/packages/components/icon/src/icon.vue_vue_type_script_setup_true_lang.js.map +1 -0
  221. package/lib/packages/components/index.js +5 -0
  222. package/lib/packages/constants/index.js +6 -0
  223. package/lib/packages/constants/key.js +7 -0
  224. package/lib/packages/constants/key.js.map +1 -0
  225. package/lib/packages/constants/sizes.js +26 -0
  226. package/lib/packages/constants/sizes.js.map +1 -0
  227. package/lib/packages/hooks/index.js +10 -0
  228. package/lib/packages/hooks/use-namespace/index.js +67 -0
  229. package/lib/packages/hooks/use-namespace/index.js.map +1 -0
  230. package/lib/packages/hooks/use-prop/index.js +11 -0
  231. package/lib/packages/hooks/use-prop/index.js.map +1 -0
  232. package/lib/packages/hooks/use-theme/index.js +20 -0
  233. package/lib/packages/hooks/use-theme/index.js.map +1 -0
  234. package/lib/packages/utils/colors.js +112 -0
  235. package/lib/packages/utils/colors.js.map +1 -0
  236. package/lib/packages/utils/dom/index.js +3 -0
  237. package/lib/packages/utils/dom/style.js +13 -0
  238. package/lib/packages/utils/dom/style.js.map +1 -0
  239. package/lib/packages/utils/index.js +21 -0
  240. package/lib/packages/utils/types.js +21 -0
  241. package/lib/packages/utils/types.js.map +1 -0
  242. package/lib/packages/utils/vue/index.js +4 -0
  243. package/lib/packages/utils/vue/install.js +40 -0
  244. package/lib/packages/utils/vue/install.js.map +1 -0
  245. package/lib/packages/utils/vue/typescript.js +1 -0
  246. package/lib/plugin.d.ts +6 -0
  247. package/lib/plugin.js +10 -0
  248. package/lib/plugin.js.map +1 -0
  249. package/lib/utils/colors.d.ts +14 -0
  250. package/lib/utils/dom/index.d.ts +2 -0
  251. package/lib/utils/dom/style.d.ts +4 -0
  252. package/lib/utils/index.d.ts +6 -0
  253. package/lib/utils/types.d.ts +8 -0
  254. package/lib/utils/vue/index.d.ts +3 -0
  255. package/lib/utils/vue/install.d.ts +7 -0
  256. package/lib/utils/vue/typescript.d.ts +19 -0
  257. package/package.json +69 -0
  258. package/theme-slate/base.css +1 -0
  259. package/theme-slate/cu-button.css +1 -0
  260. package/theme-slate/cu-common.css +1 -0
  261. package/theme-slate/cu-icon.css +1 -0
  262. package/theme-slate/cu-var.css +1 -0
  263. package/theme-slate/dark/css-vars.css +0 -0
  264. package/theme-slate/index.css +1 -0
  265. package/theme-slate/src/base.scss +2 -0
  266. package/theme-slate/src/button.scss +317 -0
  267. package/theme-slate/src/common/var.scss +179 -0
  268. package/theme-slate/src/common.scss +9 -0
  269. package/theme-slate/src/dark/css-vars.scss +0 -0
  270. package/theme-slate/src/icon.scss +43 -0
  271. package/theme-slate/src/index.scss +4 -0
  272. package/theme-slate/src/mixins/_var.scss +9 -0
  273. package/theme-slate/src/mixins/config.scss +5 -0
  274. package/theme-slate/src/mixins/function.scss +11 -0
  275. package/theme-slate/src/mixins/mixins.scss +19 -0
  276. package/theme-slate/src/var.scss +297 -0
@@ -0,0 +1,63 @@
1
+ import { vue_runtime_esm_bundler_exports } from "../../../node_modules/.pnpm/vue@3.5.35_typescript@6.0.3/node_modules/vue/dist/vue.runtime.esm-bundler.mjs";
2
+ //#region ../../packages/hooks/use-namespace/index.ts
3
+ const defaultNamespace = "c";
4
+ const statePrefix = "is-";
5
+ const _bem = (namespace, block, blockSuffix, element, modifier) => {
6
+ let cls = `${namespace}-${block}`;
7
+ if (blockSuffix) cls += `-${blockSuffix}`;
8
+ if (element) cls += `__${element}`;
9
+ if (modifier) cls += `--${modifier}`;
10
+ return cls;
11
+ };
12
+ const namespaceContextKey = Symbol("namespaceContextKey");
13
+ const useGetDerivedNamespace = (namespaceOverrides) => {
14
+ const derivedNamespace = namespaceOverrides || ((0, vue_runtime_esm_bundler_exports.getCurrentInstance)() ? (0, vue_runtime_esm_bundler_exports.inject)(namespaceContextKey, (0, vue_runtime_esm_bundler_exports.ref)("c")) : (0, vue_runtime_esm_bundler_exports.ref)("c"));
15
+ return (0, vue_runtime_esm_bundler_exports.computed)(() => {
16
+ return (0, vue_runtime_esm_bundler_exports.unref)(derivedNamespace) || "c";
17
+ });
18
+ };
19
+ const useNamespace = (block, namespaceOverrides) => {
20
+ const namespace = useGetDerivedNamespace(namespaceOverrides);
21
+ const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
22
+ const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
23
+ const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
24
+ const be = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
25
+ const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
26
+ const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
27
+ const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
28
+ const is = (name, ...args) => {
29
+ const state = args.length >= 1 ? args[0] : true;
30
+ return name && state ? `${statePrefix}${name}` : "";
31
+ };
32
+ const cssVar = (object) => {
33
+ const styles = {};
34
+ for (const key in object) if (object[key]) styles[`--${namespace.value}-${key}`] = object[key];
35
+ return styles;
36
+ };
37
+ const cssVarBlock = (object) => {
38
+ const styles = {};
39
+ for (const key in object) if (object[key]) styles[`--${namespace.value}-${block}-${key}`] = object[key];
40
+ return styles;
41
+ };
42
+ const cssVarName = (name) => `--${namespace.value}-${name}`;
43
+ const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
44
+ return {
45
+ namespace,
46
+ b,
47
+ e,
48
+ m,
49
+ be,
50
+ em,
51
+ bm,
52
+ bem,
53
+ is,
54
+ cssVar,
55
+ cssVarName,
56
+ cssVarBlock,
57
+ cssVarBlockName
58
+ };
59
+ };
60
+ //#endregion
61
+ export { defaultNamespace, namespaceContextKey, useGetDerivedNamespace, useNamespace };
62
+
63
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../../../packages/hooks/use-namespace/index.ts"],"sourcesContent":["import { computed, getCurrentInstance, inject, ref, unref } from 'vue'\n\nimport type { InjectionKey, Ref } from 'vue'\n\nexport const defaultNamespace = 'c'\nconst statePrefix = 'is-'\n\nconst _bem = (\n namespace: string,\n block: string,\n blockSuffix: string,\n element: string,\n modifier: string\n) => {\n let cls = `${namespace}-${block}`\n if (blockSuffix) {\n cls += `-${blockSuffix}`\n }\n if (element) {\n cls += `__${element}`\n }\n if (modifier) {\n cls += `--${modifier}`\n }\n return cls\n}\n\nexport const namespaceContextKey: InjectionKey<Ref<string | undefined>> =\n Symbol('namespaceContextKey')\n\nexport const useGetDerivedNamespace = (\n namespaceOverrides?: Ref<string | undefined>\n) => {\n const derivedNamespace =\n namespaceOverrides ||\n (getCurrentInstance()\n ? inject(namespaceContextKey, ref(defaultNamespace))\n : ref(defaultNamespace))\n const namespace = computed(() => {\n return unref(derivedNamespace) || defaultNamespace\n })\n return namespace\n}\n\nexport const useNamespace = (\n block: string,\n namespaceOverrides?: Ref<string | undefined>\n) => {\n const namespace = useGetDerivedNamespace(namespaceOverrides)\n const b = (blockSuffix = '') =>\n _bem(namespace.value, block, blockSuffix, '', '')\n const e = (element?: string) =>\n element ? _bem(namespace.value, block, '', element, '') : ''\n const m = (modifier?: string) =>\n modifier ? _bem(namespace.value, block, '', '', modifier) : ''\n const be = (blockSuffix?: string, element?: string) =>\n blockSuffix && element\n ? _bem(namespace.value, block, blockSuffix, element, '')\n : ''\n const em = (element?: string, modifier?: string) =>\n element && modifier\n ? _bem(namespace.value, block, '', element, modifier)\n : ''\n const bm = (blockSuffix?: string, modifier?: string) =>\n blockSuffix && modifier\n ? _bem(namespace.value, block, blockSuffix, '', modifier)\n : ''\n const bem = (blockSuffix?: string, element?: string, modifier?: string) =>\n blockSuffix && element && modifier\n ? _bem(namespace.value, block, blockSuffix, element, modifier)\n : ''\n const is: {\n (name: string, state: boolean | undefined): string\n (name: string): string\n } = (name: string, ...args: [boolean | undefined] | []) => {\n const state = args.length >= 1 ? args[0]! : true\n return name && state ? `${statePrefix}${name}` : ''\n }\n\n // for css var\n // --el-xxx: value;\n const cssVar = (object: Record<string, string>) => {\n const styles: Record<string, string> = {}\n for (const key in object) {\n if (object[key]) {\n styles[`--${namespace.value}-${key}`] = object[key]\n }\n }\n return styles\n }\n // with block\n const cssVarBlock = (object: Record<string, string>) => {\n const styles: Record<string, string> = {}\n for (const key in object) {\n if (object[key]) {\n styles[`--${namespace.value}-${block}-${key}`] = object[key]\n }\n }\n return styles\n }\n\n const cssVarName = (name: string) => `--${namespace.value}-${name}`\n const cssVarBlockName = (name: string) =>\n `--${namespace.value}-${block}-${name}`\n\n return {\n namespace,\n b,\n e,\n m,\n be,\n em,\n bm,\n bem,\n is,\n // css\n cssVar,\n cssVarName,\n cssVarBlock,\n cssVarBlockName\n }\n}\n\nexport type UseNamespaceReturn = ReturnType<typeof useNamespace>\n"],"mappings":";;AAIA,MAAa,mBAAmB;AAChC,MAAM,cAAc;AAEpB,MAAM,QACJ,WACA,OACA,aACA,SACA,aACG;CACH,IAAI,MAAM,GAAG,UAAU,GAAG;CAC1B,IAAI,aACF,OAAO,IAAI;CAEb,IAAI,SACF,OAAO,KAAK;CAEd,IAAI,UACF,OAAO,KAAK;CAEd,OAAO;AACT;AAEA,MAAa,sBACX,OAAO,qBAAqB;AAE9B,MAAa,0BACX,uBACG;CACH,MAAM,mBACJ,wBAAA,GAAA,gCAAA,mBAAA,CACoB,KAAA,GAAA,gCAAA,OAAA,CACT,sBAAA,GAAA,gCAAA,IAAA,CAAA,GAAyC,CAAC,KAAA,GAAA,gCAAA,IAAA,CAAA,GAC7B;CAI1B,QAAA,GAAA,gCAAA,SAAA,OAHiC;EAC/B,QAAA,GAAA,gCAAA,MAAA,CAAa,gBAAgB,KAAA;CAC/B,CACe;AACjB;AAEA,MAAa,gBACX,OACA,uBACG;CACH,MAAM,YAAY,uBAAuB,kBAAkB;CAC3D,MAAM,KAAK,cAAc,OACvB,KAAK,UAAU,OAAO,OAAO,aAAa,IAAI,EAAE;CAClD,MAAM,KAAK,YACT,UAAU,KAAK,UAAU,OAAO,OAAO,IAAI,SAAS,EAAE,IAAI;CAC5D,MAAM,KAAK,aACT,WAAW,KAAK,UAAU,OAAO,OAAO,IAAI,IAAI,QAAQ,IAAI;CAC9D,MAAM,MAAM,aAAsB,YAChC,eAAe,UACX,KAAK,UAAU,OAAO,OAAO,aAAa,SAAS,EAAE,IACrD;CACN,MAAM,MAAM,SAAkB,aAC5B,WAAW,WACP,KAAK,UAAU,OAAO,OAAO,IAAI,SAAS,QAAQ,IAClD;CACN,MAAM,MAAM,aAAsB,aAChC,eAAe,WACX,KAAK,UAAU,OAAO,OAAO,aAAa,IAAI,QAAQ,IACtD;CACN,MAAM,OAAO,aAAsB,SAAkB,aACnD,eAAe,WAAW,WACtB,KAAK,UAAU,OAAO,OAAO,aAAa,SAAS,QAAQ,IAC3D;CACN,MAAM,MAGD,MAAc,GAAG,SAAqC;EACzD,MAAM,QAAQ,KAAK,UAAU,IAAI,KAAK,KAAM;EAC5C,OAAO,QAAQ,QAAQ,GAAG,cAAc,SAAS;CACnD;CAIA,MAAM,UAAU,WAAmC;EACjD,MAAM,SAAiC,CAAC;EACxC,KAAK,MAAM,OAAO,QAChB,IAAI,OAAO,MACT,OAAO,KAAK,UAAU,MAAM,GAAG,SAAS,OAAO;EAGnD,OAAO;CACT;CAEA,MAAM,eAAe,WAAmC;EACtD,MAAM,SAAiC,CAAC;EACxC,KAAK,MAAM,OAAO,QAChB,IAAI,OAAO,MACT,OAAO,KAAK,UAAU,MAAM,GAAG,MAAM,GAAG,SAAS,OAAO;EAG5D,OAAO;CACT;CAEA,MAAM,cAAc,SAAiB,KAAK,UAAU,MAAM,GAAG;CAC7D,MAAM,mBAAmB,SACvB,KAAK,UAAU,MAAM,GAAG,MAAM,GAAG;CAEnC,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;CACF;AACF"}
@@ -0,0 +1,10 @@
1
+ import { vue_runtime_esm_bundler_exports } from "../../../node_modules/.pnpm/vue@3.5.35_typescript@6.0.3/node_modules/vue/dist/vue.runtime.esm-bundler.mjs";
2
+ //#region ../../packages/hooks/use-prop/index.ts
3
+ const useProp = (name) => {
4
+ const vm = (0, vue_runtime_esm_bundler_exports.getCurrentInstance)();
5
+ return (0, vue_runtime_esm_bundler_exports.computed)(() => (vm?.proxy?.$props)?.[name]);
6
+ };
7
+ //#endregion
8
+ export { useProp };
9
+
10
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../../../packages/hooks/use-prop/index.ts"],"sourcesContent":["import { computed, getCurrentInstance } from 'vue'\nimport type { ComputedRef } from 'vue'\n\nexport const useProp = <T>(name: string): ComputedRef<T | undefined> => {\n const vm = getCurrentInstance()\n return computed(() => (vm?.proxy?.$props as any)?.[name])\n}\n"],"mappings":";;AAGA,MAAa,WAAc,SAA6C;CACtE,MAAM,MAAA,GAAA,gCAAA,mBAAA,CAAwB;CAC9B,QAAA,GAAA,gCAAA,SAAA,QAAuB,IAAI,OAAO,OAAA,GAAiB,KAAK;AAC1D"}
@@ -0,0 +1,19 @@
1
+ import { vue_runtime_esm_bundler_exports } from "../../../node_modules/.pnpm/vue@3.5.35_typescript@6.0.3/node_modules/vue/dist/vue.runtime.esm-bundler.mjs";
2
+ //#region ../../packages/hooks/use-theme/index.ts
3
+ const getCurrentScheme = () => {
4
+ if (typeof document === "undefined") return "light";
5
+ return document.documentElement.dataset.cColorScheme === "dark" ? "dark" : "light";
6
+ };
7
+ const colorScheme = (0, vue_runtime_esm_bundler_exports.ref)(getCurrentScheme());
8
+ if (typeof window !== "undefined") new MutationObserver(() => {
9
+ const newScheme = getCurrentScheme();
10
+ if (newScheme !== colorScheme.value) colorScheme.value = newScheme;
11
+ }).observe(document.documentElement, {
12
+ attributes: true,
13
+ attributeFilter: ["data-c-color-scheme"]
14
+ });
15
+ const useColorScheme = () => (0, vue_runtime_esm_bundler_exports.readonly)(colorScheme);
16
+ //#endregion
17
+ export { useColorScheme };
18
+
19
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../../../packages/hooks/use-theme/index.ts"],"sourcesContent":["import { readonly, ref } from 'vue'\n\nexport type ColorScheme = 'light' | 'dark'\n\nconst getCurrentScheme = (): ColorScheme => {\n if (typeof document === 'undefined') return 'light'\n const scheme = document.documentElement.dataset.cColorScheme\n return scheme === 'dark' ? 'dark' : 'light'\n}\n\nconst colorScheme = ref<ColorScheme>(getCurrentScheme())\n\nif (typeof window !== 'undefined') {\n const observer = new MutationObserver(() => {\n const newScheme = getCurrentScheme()\n if (newScheme !== colorScheme.value) {\n colorScheme.value = newScheme\n }\n })\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['data-c-color-scheme']\n })\n}\n\nexport const useColorScheme = () => readonly(colorScheme)\n"],"mappings":";;AAIA,MAAM,yBAAsC;CAC1C,IAAI,OAAO,aAAa,aAAa,OAAO;CAE5C,OADe,SAAS,gBAAgB,QAAQ,iBAC9B,SAAS,SAAS;AACtC;AAEA,MAAM,eAAA,GAAA,gCAAA,IAAA,CAA+B,iBAAiB,CAAC;AAEvD,IAAI,OAAO,WAAW,aAOpB,IANqB,uBAAuB;CAC1C,MAAM,YAAY,iBAAiB;CACnC,IAAI,cAAc,YAAY,OAC5B,YAAY,QAAQ;AAExB,CACO,CAAC,CAAC,QAAQ,SAAS,iBAAiB;CACzC,YAAY;CACZ,iBAAiB,CAAC,qBAAqB;AACzC,CAAC;AAGH,MAAa,wBAAA,GAAA,gCAAA,SAAA,CAAgC,WAAW"}
@@ -0,0 +1,109 @@
1
+ import { TinyColor } from "../../node_modules/.pnpm/@ctrl_tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/module/index.mjs";
2
+ //#region ../../packages/utils/colors.ts
3
+ const SATURATIONS = [
4
+ 8,
5
+ 15,
6
+ 30,
7
+ 55,
8
+ 78,
9
+ 95,
10
+ 95,
11
+ 92,
12
+ 88,
13
+ 85
14
+ ];
15
+ const LIGHTNESSES = [
16
+ 95,
17
+ 88,
18
+ 75,
19
+ 62,
20
+ 50,
21
+ 40,
22
+ 32,
23
+ 27,
24
+ 22,
25
+ 18
26
+ ];
27
+ const shadeCache = /* @__PURE__ */ new Map();
28
+ function getNormalizedKey(colorStr) {
29
+ const tc = new TinyColor(colorStr);
30
+ if (!tc.isValid) return null;
31
+ return tc.toHexString();
32
+ }
33
+ function getFormat(colorStr) {
34
+ const fmt = new TinyColor(colorStr).format;
35
+ return fmt === "name" ? "hex" : fmt;
36
+ }
37
+ /**
38
+ * Generates 10 shades (index 0~9, 0 lightest, 9 darkest) from a given color.
39
+ * The output format matches the input format (hex / rgb / rgba / hsl / hsla).
40
+ * Results are cached so repeated calls with the same color (even different formats) return instantly.
41
+ * @param originalColor - Any valid CSS color string
42
+ * @returns An array of 10 color strings representing the shades
43
+ * @throws If the input color is invalid
44
+ */
45
+ function generateColorShades(originalColor) {
46
+ const normKey = getNormalizedKey(originalColor);
47
+ if (!normKey) throw new Error(`Invalid color: ${originalColor}`);
48
+ const targetFormat = getFormat(originalColor);
49
+ const cacheKey = `${normKey}|${targetFormat}`;
50
+ if (shadeCache.has(cacheKey)) return shadeCache.get(cacheKey);
51
+ const base = new TinyColor(originalColor);
52
+ if (!base.isValid) throw new Error(`Invalid color: ${originalColor}`);
53
+ const { h } = base.toHsl();
54
+ const shades = [];
55
+ for (let i = 0; i < 10; i++) {
56
+ const color = new TinyColor({
57
+ h,
58
+ s: SATURATIONS[i] / 100,
59
+ l: LIGHTNESSES[i] / 100
60
+ });
61
+ let output;
62
+ switch (targetFormat) {
63
+ case "hex":
64
+ output = color.toHexString();
65
+ break;
66
+ case "rgb":
67
+ output = color.toRgbString();
68
+ break;
69
+ case "hsl":
70
+ output = color.toHslString();
71
+ break;
72
+ case "hsv":
73
+ output = color.toHsvString();
74
+ break;
75
+ default: output = color.toHexString();
76
+ }
77
+ shades.push(output);
78
+ }
79
+ shadeCache.set(cacheKey, shades);
80
+ return shades;
81
+ }
82
+ function clearShadeCache() {
83
+ shadeCache.clear();
84
+ }
85
+ function setColorAlpha(originalColor, alpha) {
86
+ if (Number.isNaN(Number(alpha))) throw new TypeError(`Invalid alpha: ${alpha}`);
87
+ const tc = new TinyColor(originalColor);
88
+ if (!tc.isValid) throw new Error(`Invalid color: ${originalColor}`);
89
+ const targetFormat = getFormat(originalColor);
90
+ tc.setAlpha(alpha);
91
+ let output;
92
+ switch (targetFormat) {
93
+ case "rgb":
94
+ output = tc.toRgbString();
95
+ break;
96
+ case "hsl":
97
+ output = tc.toHslString();
98
+ break;
99
+ case "hsv":
100
+ output = tc.toHsvString();
101
+ break;
102
+ default: output = tc.toRgbString();
103
+ }
104
+ return output;
105
+ }
106
+ //#endregion
107
+ export { clearShadeCache, generateColorShades, setColorAlpha };
108
+
109
+ //# sourceMappingURL=colors.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.mjs","names":[],"sources":["../../../../../packages/utils/colors.ts"],"sourcesContent":["import { TinyColor } from '@ctrl/tinycolor'\n\nconst SATURATIONS = [8, 15, 30, 55, 78, 95, 95, 92, 88, 85]\n\nconst LIGHTNESSES = [95, 88, 75, 62, 50, 40, 32, 27, 22, 18]\n\nconst shadeCache = new Map<string, string[]>()\n\nfunction getNormalizedKey(colorStr: string): string | null {\n const tc = new TinyColor(colorStr)\n if (!tc.isValid) return null\n return tc.toHexString()\n}\n\nfunction getFormat(colorStr: string): string {\n const tc = new TinyColor(colorStr)\n const fmt = tc.format\n return fmt === 'name' ? 'hex' : fmt\n}\n\n/**\n * Generates 10 shades (index 0~9, 0 lightest, 9 darkest) from a given color.\n * The output format matches the input format (hex / rgb / rgba / hsl / hsla).\n * Results are cached so repeated calls with the same color (even different formats) return instantly.\n * @param originalColor - Any valid CSS color string\n * @returns An array of 10 color strings representing the shades\n * @throws If the input color is invalid\n */\nexport function generateColorShades(originalColor: string): string[] {\n const normKey = getNormalizedKey(originalColor)\n if (!normKey) {\n throw new Error(`Invalid color: ${originalColor}`)\n }\n\n const targetFormat = getFormat(originalColor)\n const cacheKey = `${normKey}|${targetFormat}`\n\n if (shadeCache.has(cacheKey)) {\n return shadeCache.get(cacheKey)!\n }\n\n const base = new TinyColor(originalColor)\n if (!base.isValid) {\n throw new Error(`Invalid color: ${originalColor}`)\n }\n\n const { h } = base.toHsl()\n\n const shades: string[] = []\n\n for (let i = 0; i < 10; i++) {\n const color = new TinyColor({\n h,\n s: SATURATIONS[i] / 100,\n l: LIGHTNESSES[i] / 100\n })\n\n let output: string\n switch (targetFormat) {\n case 'hex':\n output = color.toHexString()\n break\n case 'rgb':\n output = color.toRgbString()\n break\n case 'hsl':\n output = color.toHslString()\n break\n case 'hsv':\n output = color.toHsvString()\n break\n default:\n output = color.toHexString()\n }\n shades.push(output)\n }\n\n shadeCache.set(cacheKey, shades)\n return shades\n}\n\nexport function clearShadeCache(): void {\n shadeCache.clear()\n}\n\nexport function setColorAlpha(originalColor: string, alpha: number): string {\n if (Number.isNaN(Number(alpha))) {\n throw new TypeError(`Invalid alpha: ${alpha}`)\n }\n\n const tc = new TinyColor(originalColor)\n if (!tc.isValid) {\n throw new Error(`Invalid color: ${originalColor}`)\n }\n\n const targetFormat = getFormat(originalColor)\n tc.setAlpha(alpha)\n\n let output: string\n switch (targetFormat) {\n case 'rgb':\n output = tc.toRgbString()\n break\n case 'hsl':\n output = tc.toHslString()\n break\n case 'hsv':\n output = tc.toHsvString()\n break\n default:\n output = tc.toRgbString()\n }\n\n return output\n}\n"],"mappings":";;AAEA,MAAM,cAAc;CAAC;CAAG;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;AAAE;AAE1D,MAAM,cAAc;CAAC;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;AAAE;AAE3D,MAAM,6BAAa,IAAI,IAAsB;AAE7C,SAAS,iBAAiB,UAAiC;CACzD,MAAM,KAAK,IAAI,UAAU,QAAQ;CACjC,IAAI,CAAC,GAAG,SAAS,OAAO;CACxB,OAAO,GAAG,YAAY;AACxB;AAEA,SAAS,UAAU,UAA0B;CAE3C,MAAM,MAAM,IADG,UAAU,QACZ,CAAC,CAAC;CACf,OAAO,QAAQ,SAAS,QAAQ;AAClC;;;;;;;;;AAUA,SAAgB,oBAAoB,eAAiC;CACnE,MAAM,UAAU,iBAAiB,aAAa;CAC9C,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,kBAAkB,eAAe;CAGnD,MAAM,eAAe,UAAU,aAAa;CAC5C,MAAM,WAAW,GAAG,QAAQ,GAAG;CAE/B,IAAI,WAAW,IAAI,QAAQ,GACzB,OAAO,WAAW,IAAI,QAAQ;CAGhC,MAAM,OAAO,IAAI,UAAU,aAAa;CACxC,IAAI,CAAC,KAAK,SACR,MAAM,IAAI,MAAM,kBAAkB,eAAe;CAGnD,MAAM,EAAE,MAAM,KAAK,MAAM;CAEzB,MAAM,SAAmB,CAAC;CAE1B,KAAK,IAAI,IAAI,GAAG,IAAI,IAAI,KAAK;EAC3B,MAAM,QAAQ,IAAI,UAAU;GAC1B;GACA,GAAG,YAAY,KAAK;GACpB,GAAG,YAAY,KAAK;EACtB,CAAC;EAED,IAAI;EACJ,QAAQ,cAAR;GACE,KAAK;IACH,SAAS,MAAM,YAAY;IAC3B;GACF,KAAK;IACH,SAAS,MAAM,YAAY;IAC3B;GACF,KAAK;IACH,SAAS,MAAM,YAAY;IAC3B;GACF,KAAK;IACH,SAAS,MAAM,YAAY;IAC3B;GACF,SACE,SAAS,MAAM,YAAY;EAC/B;EACA,OAAO,KAAK,MAAM;CACpB;CAEA,WAAW,IAAI,UAAU,MAAM;CAC/B,OAAO;AACT;AAEA,SAAgB,kBAAwB;CACtC,WAAW,MAAM;AACnB;AAEA,SAAgB,cAAc,eAAuB,OAAuB;CAC1E,IAAI,OAAO,MAAM,OAAO,KAAK,CAAC,GAC5B,MAAM,IAAI,UAAU,kBAAkB,OAAO;CAG/C,MAAM,KAAK,IAAI,UAAU,aAAa;CACtC,IAAI,CAAC,GAAG,SACN,MAAM,IAAI,MAAM,kBAAkB,eAAe;CAGnD,MAAM,eAAe,UAAU,aAAa;CAC5C,GAAG,SAAS,KAAK;CAEjB,IAAI;CACJ,QAAQ,cAAR;EACE,KAAK;GACH,SAAS,GAAG,YAAY;GACxB;EACF,KAAK;GACH,SAAS,GAAG,YAAY;GACxB;EACF,KAAK;GACH,SAAS,GAAG,YAAY;GACxB;EACF,SACE,SAAS,GAAG,YAAY;CAC5B;CAEA,OAAO;AACT"}
@@ -0,0 +1,2 @@
1
+ import { addUnit } from "./style.mjs";
2
+ export { addUnit };
@@ -0,0 +1,11 @@
1
+ import { isNumber, isString, isStringNumber } from "../types.mjs";
2
+ //#region ../../packages/utils/dom/style.ts
3
+ function addUnit(value, defaultUnit = "px") {
4
+ if (!value && value !== 0) return "";
5
+ if (isNumber(value) || isStringNumber(value)) return `${value}${defaultUnit}`;
6
+ else if (isString(value)) return value;
7
+ }
8
+ //#endregion
9
+ export { addUnit };
10
+
11
+ //# sourceMappingURL=style.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.mjs","names":[],"sources":["../../../../../../packages/utils/dom/style.ts"],"sourcesContent":["import { isNumber, isString, isStringNumber } from '../types'\n\n// const SCOPE = 'utils/dom/style'\n\nexport function addUnit(value?: string | number, defaultUnit = 'px') {\n if (!value && value !== 0) return ''\n if (isNumber(value) || isStringNumber(value)) {\n return `${value}${defaultUnit}`\n } else if (isString(value)) {\n return value\n }\n // debugWarn(SCOPE, 'binding value must be a string or number')\n}\n"],"mappings":";;AAIA,SAAgB,QAAQ,OAAyB,cAAc,MAAM;CACnE,IAAI,CAAC,SAAS,UAAU,GAAG,OAAO;CAClC,IAAI,SAAS,KAAK,KAAK,eAAe,KAAK,GACzC,OAAO,GAAG,QAAQ;MACb,IAAI,SAAS,KAAK,GACvB,OAAO;AAGX"}
@@ -0,0 +1,5 @@
1
+ import { clearShadeCache, generateColorShades, setColorAlpha } from "./colors.mjs";
2
+ import { isNumber, isString, isStringNumber, isUndefined } from "./types.mjs";
3
+ import { addUnit } from "./dom/style.mjs";
4
+ import { withInstall, withPropsDefaultSetter } from "./vue/install.mjs";
5
+ export { addUnit, clearShadeCache, generateColorShades, isNumber, isString, isStringNumber, isUndefined, setColorAlpha, withInstall, withPropsDefaultSetter };
@@ -0,0 +1,12 @@
1
+ import { isString, isString as isString$1 } from "@vue/shared";
2
+ //#region ../../packages/utils/types.ts
3
+ const isUndefined = (val) => val === void 0;
4
+ const isNumber = (val) => typeof val === "number";
5
+ const isStringNumber = (val) => {
6
+ if (!isString$1(val)) return false;
7
+ return !Number.isNaN(Number(val));
8
+ };
9
+ //#endregion
10
+ export { isNumber, isString, isStringNumber, isUndefined };
11
+
12
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.mjs","names":["isString"],"sources":["../../../../../packages/utils/types.ts"],"sourcesContent":["import { isString } from '@vue/shared'\n\nexport { isString } from '@vue/shared'\n\nexport const isUndefined = (val: any): val is undefined => val === undefined\nexport const isNumber = (val: any): val is number => typeof val === 'number'\n\nexport const isStringNumber = (val: string): boolean => {\n if (!isString(val)) {\n return false\n }\n return !Number.isNaN(Number(val))\n}\n"],"mappings":";;AAIA,MAAa,eAAe,QAA+B,QAAQ,KAAA;AACnE,MAAa,YAAY,QAA4B,OAAO,QAAQ;AAEpE,MAAa,kBAAkB,QAAyB;CACtD,IAAI,CAACA,WAAS,GAAG,GACf,OAAO;CAET,OAAO,CAAC,OAAO,MAAM,OAAO,GAAG,CAAC;AAClC"}
@@ -0,0 +1,2 @@
1
+ import { withInstall, withPropsDefaultSetter } from "./install.mjs";
2
+ export { withInstall, withPropsDefaultSetter };
@@ -0,0 +1,38 @@
1
+ import { isPlainObject } from "../../../node_modules/.pnpm/es-toolkit@1.47.0/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs";
2
+ import { hasOwn, isArray } from "@vue/shared";
3
+ //#region ../../packages/utils/vue/install.ts
4
+ const withPropsDefaultSetter = (target) => {
5
+ const _p = target.props;
6
+ const props = isArray(_p) ? Object.fromEntries(_p.map((key) => [key, {}])) : _p;
7
+ target.setPropsDefaults = (defaults) => {
8
+ if (!props) return;
9
+ for (const [key, value] of Object.entries(defaults)) {
10
+ const prop = props[key];
11
+ if (!hasOwn(props, key)) continue;
12
+ if (isPlainObject(prop)) {
13
+ props[key] = {
14
+ ...props,
15
+ default: value
16
+ };
17
+ continue;
18
+ }
19
+ props[key] = {
20
+ type: prop,
21
+ default: value
22
+ };
23
+ }
24
+ target.props = props;
25
+ };
26
+ };
27
+ const withInstall = (main, extra) => {
28
+ main.install = (app) => {
29
+ for (const comp of [main, ...Object.values(extra ?? [])]) app.component(comp.name, comp);
30
+ };
31
+ if (extra) for (const [key, comp] of Object.entries(extra)) main[key] = comp;
32
+ withPropsDefaultSetter(main);
33
+ return main;
34
+ };
35
+ //#endregion
36
+ export { withInstall, withPropsDefaultSetter };
37
+
38
+ //# sourceMappingURL=install.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.mjs","names":[],"sources":["../../../../../../packages/utils/vue/install.ts"],"sourcesContent":["import { hasOwn, isArray } from '@vue/shared'\nimport { isPlainObject } from 'es-toolkit'\nimport type { SFCWithInstall } from './typescript'\n\nexport const withPropsDefaultSetter = (target: any) => {\n const _p = target.props\n const props = isArray(_p)\n ? Object.fromEntries(_p.map((key) => [key, {}]))\n : _p\n\n target.setPropsDefaults = (defaults: Record<string, any>) => {\n if (!props) return\n\n for (const [key, value] of Object.entries(defaults)) {\n const prop = props[key]\n\n if (!hasOwn(props, key)) continue\n\n if (isPlainObject(prop)) {\n props[key] = {\n ...props,\n default: value\n }\n continue\n }\n\n props[key] = {\n type: prop,\n default: value\n }\n }\n\n target.props = props\n }\n}\n\nexport const withInstall = <T, E extends Record<string, any>>(\n main: T,\n extra?: E\n) => {\n ;(main as SFCWithInstall<T>).install = (app): void => {\n for (const comp of [main, ...Object.values(extra ?? [])]) {\n app.component(comp.name, comp)\n }\n }\n\n if (extra) {\n for (const [key, comp] of Object.entries(extra)) {\n ;(main as any)[key] = comp\n }\n }\n withPropsDefaultSetter(main)\n return main as SFCWithInstall<T> & E\n}\n"],"mappings":";;;AAIA,MAAa,0BAA0B,WAAgB;CACrD,MAAM,KAAK,OAAO;CAClB,MAAM,QAAQ,QAAQ,EAAE,IACpB,OAAO,YAAY,GAAG,KAAK,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAC7C;CAEJ,OAAO,oBAAoB,aAAkC;EAC3D,IAAI,CAAC,OAAO;EAEZ,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,QAAQ,GAAG;GACnD,MAAM,OAAO,MAAM;GAEnB,IAAI,CAAC,OAAO,OAAO,GAAG,GAAG;GAEzB,IAAI,cAAc,IAAI,GAAG;IACvB,MAAM,OAAO;KACX,GAAG;KACH,SAAS;IACX;IACA;GACF;GAEA,MAAM,OAAO;IACX,MAAM;IACN,SAAS;GACX;EACF;EAEA,OAAO,QAAQ;CACjB;AACF;AAEA,MAAa,eACX,MACA,UACG;CACF,KAA4B,WAAW,QAAc;EACpD,KAAK,MAAM,QAAQ,CAAC,MAAM,GAAG,OAAO,OAAO,SAAS,CAAC,CAAC,CAAC,GACrD,IAAI,UAAU,KAAK,MAAM,IAAI;CAEjC;CAEA,IAAI,OACF,KAAK,MAAM,CAAC,KAAK,SAAS,OAAO,QAAQ,KAAK,GAC3C,KAAc,OAAO;CAG1B,uBAAuB,IAAI;CAC3B,OAAO;AACT"}
File without changes
package/es/plugin.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { Plugin } from "vue";
2
+
3
+ //#region ../../packages/cck-ui/plugin.d.ts
4
+ declare const _default: Plugin[];
5
+ //#endregion
6
+ export { _default as default };
package/es/plugin.mjs ADDED
@@ -0,0 +1,6 @@
1
+ //#region ../../packages/cck-ui/plugin.ts
2
+ var plugin_default = [];
3
+ //#endregion
4
+ export { plugin_default as default };
5
+
6
+ //# sourceMappingURL=plugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.mjs","names":[],"sources":["../../../packages/cck-ui/plugin.ts"],"sourcesContent":["import type { Plugin } from 'vue'\n\nexport default [] as Plugin[]\n"],"mappings":";AAEA,IAAA,iBAAe,CAAC"}
@@ -0,0 +1,14 @@
1
+ //#region ../../packages/utils/colors.d.ts
2
+ /**
3
+ * Generates 10 shades (index 0~9, 0 lightest, 9 darkest) from a given color.
4
+ * The output format matches the input format (hex / rgb / rgba / hsl / hsla).
5
+ * Results are cached so repeated calls with the same color (even different formats) return instantly.
6
+ * @param originalColor - Any valid CSS color string
7
+ * @returns An array of 10 color strings representing the shades
8
+ * @throws If the input color is invalid
9
+ */
10
+ declare function generateColorShades(originalColor: string): string[];
11
+ declare function clearShadeCache(): void;
12
+ declare function setColorAlpha(originalColor: string, alpha: number): string;
13
+ //#endregion
14
+ export { clearShadeCache, generateColorShades, setColorAlpha };
@@ -0,0 +1,2 @@
1
+ import { addUnit } from "./style.js";
2
+ export { addUnit };
@@ -0,0 +1,4 @@
1
+ //#region ../../packages/utils/dom/style.d.ts
2
+ declare function addUnit(value?: string | number, defaultUnit?: string): string | undefined;
3
+ //#endregion
4
+ export { addUnit };
@@ -0,0 +1,6 @@
1
+ import { clearShadeCache, generateColorShades, setColorAlpha } from "./colors.js";
2
+ import { addUnit } from "./dom/style.js";
3
+ import { EmitFn, SFCInstallWithContext, SFCWithInstall, SFCWithPropsDefaultSetter } from "./vue/typescript.js";
4
+ import { withInstall, withPropsDefaultSetter } from "./vue/install.js";
5
+ import { isNumber, isString, isStringNumber, isUndefined } from "./types.js";
6
+ export { EmitFn, SFCInstallWithContext, SFCWithInstall, SFCWithPropsDefaultSetter, addUnit, clearShadeCache, generateColorShades, isNumber, isString, isStringNumber, isUndefined, setColorAlpha, withInstall, withPropsDefaultSetter };
@@ -0,0 +1,8 @@
1
+ import { isString } from "@vue/shared";
2
+
3
+ //#region ../../packages/utils/types.d.ts
4
+ declare const isUndefined: (val: any) => val is undefined;
5
+ declare const isNumber: (val: any) => val is number;
6
+ declare const isStringNumber: (val: string) => boolean;
7
+ //#endregion
8
+ export { isNumber, isString, isStringNumber, isUndefined };
@@ -0,0 +1,3 @@
1
+ import { EmitFn, SFCInstallWithContext, SFCWithInstall, SFCWithPropsDefaultSetter } from "./typescript.js";
2
+ import { withInstall, withPropsDefaultSetter } from "./install.js";
3
+ export { EmitFn, SFCInstallWithContext, SFCWithInstall, SFCWithPropsDefaultSetter, withInstall, withPropsDefaultSetter };
@@ -0,0 +1,7 @@
1
+ import { SFCWithInstall } from "./typescript.js";
2
+
3
+ //#region ../../packages/utils/vue/install.d.ts
4
+ declare const withPropsDefaultSetter: (target: any) => void;
5
+ declare const withInstall: <T, E extends Record<string, any>>(main: T, extra?: E) => SFCWithInstall<T> & E;
6
+ //#endregion
7
+ export { withInstall, withPropsDefaultSetter };
@@ -0,0 +1,19 @@
1
+ import { AllowedComponentProps, AppContext, Component, EmitsOptions, ObjectPlugin, SetupContext, VNodeProps } from "vue";
2
+ import { ComponentEmit, ComponentProps } from "vue-component-type-helpers";
3
+
4
+ //#region ../../packages/utils/vue/typescript.d.ts
5
+ type NativeType = null | undefined | number | string | boolean | symbol | Function;
6
+ type InferDefaults<T> = { [K in keyof T as string extends K ? never : K]?: InferDefault<T[K]> };
7
+ type InferDefault<T> = (() => T & {}) | (T extends NativeType ? T : never);
8
+ type ExtractEventNames<T> = ComponentEmit<T> extends ((event: string, ...args: any[]) => any) ? never : keyof { [K in keyof ComponentProps<T> as K extends `on${infer Event}` ? ComponentEmit<T> extends ((event: Uncapitalize<Event>, ...args: any[]) => any) ? K : never : never]: unknown };
9
+ type ExcludeProps<T> = ExtractEventNames<T> | keyof VNodeProps | keyof AllowedComponentProps;
10
+ type SFCWithInstall<T> = T & ObjectPlugin & SFCWithPropsDefaultSetter<T>;
11
+ type SFCInstallWithContext<T> = SFCWithInstall<T> & {
12
+ _context: AppContext | null;
13
+ };
14
+ type SFCWithPropsDefaultSetter<T> = T extends Component ? {
15
+ setPropsDefault: (defaults: InferDefaults<{ [K in keyof ComponentProps<T> as K extends ExcludeProps<T> ? never : K]?: ComponentProps<T>[K] }>) => void;
16
+ } : unknown;
17
+ type EmitFn<E extends EmitsOptions> = SetupContext<E>['emit'];
18
+ //#endregion
19
+ export { EmitFn, SFCInstallWithContext, SFCWithInstall, SFCWithPropsDefaultSetter };
package/global.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ /* prettier-ignore */
2
+ declare module 'vue' {
3
+ export interface GlobalComponents {
4
+ ELICON: typeof import('cck-ui')['CIcon']
5
+ }
6
+ }
7
+
8
+ export {}
@@ -0,0 +1,37 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
9
+ var __exportAll = (all, no_symbols) => {
10
+ let target = {};
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
15
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
16
+ return target;
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
20
+ key = keys[i];
21
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
22
+ get: ((k) => from[k]).bind(null, key),
23
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
24
+ });
25
+ }
26
+ return to;
27
+ };
28
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
29
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
+ value: mod,
31
+ enumerable: true
32
+ }) : target, mod));
33
+ //#endregion
34
+ exports.__commonJSMin = __commonJSMin;
35
+ exports.__exportAll = __exportAll;
36
+ exports.__reExport = __reExport;
37
+ exports.__toESM = __toESM;
@@ -0,0 +1,6 @@
1
+ import { Plugin } from "vue";
2
+
3
+ //#region ../../packages/cck-ui/component.d.ts
4
+ declare const _default: Plugin[];
5
+ //#endregion
6
+ export { _default as default };
@@ -0,0 +1,12 @@
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ const require_index = require("./packages/components/button/index.js");
6
+ const require_index$1 = require("./packages/components/icon/index.js");
7
+ //#region ../../packages/cck-ui/component.ts
8
+ var component_default = [require_index.CButton, require_index$1.CIcon];
9
+ //#endregion
10
+ exports.default = component_default;
11
+
12
+ //# sourceMappingURL=component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.js","names":["CButton","CIcon"],"sources":["../../../packages/cck-ui/component.ts"],"sourcesContent":["import { CButton, CIcon } from '@cck-ui/components'\n\nimport type { Plugin } from 'vue'\n\nexport default [CButton, CIcon] as Plugin[]\n"],"mappings":";;;;;;;AAIA,IAAA,oBAAe,CAACA,cAAAA,SAASC,gBAAAA,KAAK"}
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("cck-ui/theme-slate/base.css");
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("cck-ui/theme-slate/src/base.scss");
@@ -0,0 +1,8 @@
1
+ import { SFCWithInstall } from "../../utils/vue/typescript.js";
2
+ import { ButtonProps, ButtonVariant } from "./src/button.types.js";
3
+ import _default from "./src/button.vue.js";
4
+
5
+ //#region ../../packages/components/button/index.d.ts
6
+ declare const CButton: SFCWithInstall<typeof _default>;
7
+ //#endregion
8
+ export { ButtonProps, ButtonVariant, CButton, CButton as default };
@@ -0,0 +1,6 @@
1
+ import { ButtonProps } from "./button.types.js";
2
+
3
+ //#region ../../packages/components/button/src/button-custom.d.ts
4
+ declare function useButtonCustomStyle(props: ButtonProps): import("vue").ComputedRef<Record<string, string>>;
5
+ //#endregion
6
+ export { useButtonCustomStyle };
@@ -0,0 +1,77 @@
1
+ import { ComponentSize } from "../../../constants/sizes.js";
2
+ import { CSSProperties, Component } from "vue";
3
+
4
+ //#region ../../packages/components/button/src/button.types.d.ts
5
+ type ButtonVariant = 'default' | 'filled' | 'light' | 'outline' | 'transparent' | 'white' | 'subtle' | 'gradient';
6
+ interface ButtonProps {
7
+ /**
8
+ * @description If set, adjusts text color based on background color for `filled` variant
9
+ */
10
+ autoContrast?: boolean;
11
+ /**
12
+ * @description Key of `theme.colors` or any valid CSS color
13
+ * @default theme.primaryColor
14
+ */
15
+ color?: string;
16
+ /**
17
+ * @description Sets `disabled` attribute, applies disabled styles
18
+ */
19
+ disabled?: boolean;
20
+ /**
21
+ * @description Sets `width: 100%`
22
+ * @default false
23
+ */
24
+ fullWidth?: boolean;
25
+ /**
26
+ * @description Gradient configuration used for `variant="gradient"`
27
+ * @default { from: 'blue', to: 'cyan', deg: 45 }
28
+ */
29
+ gradient?: {
30
+ from: string;
31
+ to: string;
32
+ deg: number;
33
+ };
34
+ /**
35
+ * @description Sets `justify-content` of `inner` element, can be used to change distribution of sections and label
36
+ * @default 'center'
37
+ */
38
+ justify?: CSSProperties['justify-content'];
39
+ /**
40
+ * @description Content on the left side of the button label
41
+ */
42
+ leftSection?: Component;
43
+ /**
44
+ * @description Props add to the `Loader` component (only visible when `loading` props is set)
45
+ */
46
+ loaderProps?: Record<string, string>;
47
+ /**
48
+ * @description If set, the `Loader` component is displayed over the button
49
+ */
50
+ loading?: boolean;
51
+ /**
52
+ * @description Key of `theme.radius` or any valid CSS value to set `border-radius`
53
+ * @default theme.defaultRadius
54
+ */
55
+ radius?: string;
56
+ /**
57
+ * @description Content on the right side of the button label
58
+ */
59
+ rightSection?: Component;
60
+ /**
61
+ * @description Controls button `height`, `font-size` and horizontal `padding`
62
+ * @default 'sm'
63
+ */
64
+ size?: ComponentSize;
65
+ /**
66
+ * @description custom element tag
67
+ * @default 'button'
68
+ */
69
+ tag?: string | Component;
70
+ /**
71
+ * @description variants of button
72
+ * @default 'default'
73
+ */
74
+ variant?: ButtonVariant;
75
+ }
76
+ //#endregion
77
+ export { ButtonProps, ButtonVariant };