vueless 0.0.643 → 0.0.644

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.643",
3
+ "version": "0.0.644",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -66,7 +66,7 @@
66
66
  "@vue/eslint-config-prettier": "^10.0.0",
67
67
  "@vue/eslint-config-typescript": "^14.1.1",
68
68
  "@vue/tsconfig": "^0.5.1",
69
- "@vueless/storybook": "^0.0.54",
69
+ "@vueless/storybook": "^0.0.57",
70
70
  "autoprefixer": "^10.4.19",
71
71
  "cssnano": "^6.1.2",
72
72
  "eslint": "^9.12.0",
@@ -10,7 +10,7 @@ interface UBoilerplateArgs extends Props {
10
10
  }
11
11
 
12
12
  export default {
13
- id: "10010",
13
+ id: "110010",
14
14
  title: "Custom / UBoilerplate",
15
15
  component: UBoilerplate,
16
16
  args: {
@@ -65,12 +65,12 @@ export interface UCalendarProps<TModelValue extends DateValue> {
65
65
  /**
66
66
  * Min date (JavaScript Date object or string formatted in given `dateFormat`).
67
67
  */
68
- minDate?: string | Date;
68
+ minDate?: Date | string;
69
69
 
70
70
  /**
71
71
  * Max date (JavaScript Date object or string formatted in given `dateFormat`).
72
72
  */
73
- maxDate?: string | Date;
73
+ maxDate?: Date | string;
74
74
 
75
75
  /**
76
76
  * Component config object.
@@ -305,10 +305,6 @@ watchEffect(() => {
305
305
  @slot Use it add something before the date.
306
306
  @binding {string} icon-name
307
307
  -->
308
- <slot name="left-icon" :icon-name="iconName" />
309
- </template>
310
-
311
- <template #right-icon="{ iconName }">
312
308
  <slot name="left" :icon-name="iconName" />
313
309
  </template>
314
310
 
@@ -81,12 +81,12 @@ export interface UDatePickerProps<TModelValue> {
81
81
  /**
82
82
  * Min date (JavaScript Date object or string formatted in given `dateFormat`).
83
83
  */
84
- minDate?: string | Date;
84
+ minDate?: Date | string;
85
85
 
86
86
  /**
87
87
  * Max date (JavaScript Date object or string formatted in given `dateFormat`).
88
88
  */
89
- maxDate?: string | Date;
89
+ maxDate?: Date | string;
90
90
 
91
91
  /**
92
92
  * Left icon name.
@@ -114,12 +114,12 @@ export interface UDatePickerRangeProps<TModelValue> {
114
114
  /**
115
115
  * Min date (JavaScript Date object or string formatted in given `dateFormat`).
116
116
  */
117
- minDate?: string | Date;
117
+ minDate?: Date | string;
118
118
 
119
119
  /**
120
120
  * Max date (JavaScript Date object or string formatted in given `dateFormat`).
121
121
  */
122
- maxDate?: string | Date;
122
+ maxDate?: Date | string;
123
123
 
124
124
  /**
125
125
  * Date string format.
@@ -55,7 +55,7 @@ function onClick(event: MouseEvent) {
55
55
  * Get element / nested component attributes for each config token ✨
56
56
  * Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
57
57
  */
58
- const { avatarAttrs, placeholderIconAttrs } = useUI<Config>(defaultConfig);
58
+ const { config, avatarAttrs, placeholderIconAttrs } = useUI<Config>(defaultConfig);
59
59
  </script>
60
60
 
61
61
  <template>
@@ -78,7 +78,7 @@ const { avatarAttrs, placeholderIconAttrs } = useUI<Config>(defaultConfig);
78
78
  internal
79
79
  :size="size"
80
80
  :color="componentColor"
81
- :name="placeholderIcon"
81
+ :name="placeholderIcon || config.defaults.placeholderIcon"
82
82
  v-bind="placeholderIconAttrs"
83
83
  />
84
84
  </slot>
@@ -1,6 +1,7 @@
1
1
  import path from "path";
2
2
  import { statSync, existsSync } from "fs";
3
3
  import { readdir } from "node:fs/promises";
4
+ import { cwd } from "node:process";
4
5
  import esbuild from "esbuild";
5
6
 
6
7
  import { VUELESS_CONFIGS_CACHED_DIR } from "../../constants.js";
@@ -52,27 +53,27 @@ export async function getDirFiles(dirPath, ext, { recursive = true, exclude = []
52
53
 
53
54
  export function getNuxtFiles() {
54
55
  return [
55
- path.join(process.cwd(), "composables"),
56
- path.join(process.cwd(), "components"),
57
- path.join(process.cwd(), "layouts"),
58
- path.join(process.cwd(), "pages"),
59
- path.join(process.cwd(), "plugins"),
60
- path.join(process.cwd(), "utils"),
61
- path.join(process.cwd(), "Error.vue"),
62
- path.join(process.cwd(), "App.vue"),
63
- path.join(process.cwd(), "Error.vue"),
64
- path.join(process.cwd(), "app.vue"),
65
- path.join(process.cwd(), "error.vue"),
66
- path.join(process.cwd(), "playground", "app.vue"),
56
+ path.join(cwd(), "composables"),
57
+ path.join(cwd(), "components"),
58
+ path.join(cwd(), "layouts"),
59
+ path.join(cwd(), "pages"),
60
+ path.join(cwd(), "plugins"),
61
+ path.join(cwd(), "utils"),
62
+ path.join(cwd(), "Error.vue"),
63
+ path.join(cwd(), "App.vue"),
64
+ path.join(cwd(), "Error.vue"),
65
+ path.join(cwd(), "app.vue"),
66
+ path.join(cwd(), "error.vue"),
67
+ path.join(cwd(), "playground", "app.vue"),
67
68
  ];
68
69
  }
69
70
 
70
71
  export function getVueFiles() {
71
- return [path.join(process.cwd(), "src")];
72
+ return [path.join(cwd(), "src")];
72
73
  }
73
74
 
74
75
  export async function getComponentDefaultConfig(name, entryPath) {
75
- const configOutPath = path.join(process.cwd(), `${VUELESS_CONFIGS_CACHED_DIR}/${name}.mjs`);
76
+ const configOutPath = path.join(cwd(), `${VUELESS_CONFIGS_CACHED_DIR}/${name}.mjs`);
76
77
 
77
78
  await buildTSFile(entryPath, configOutPath);
78
79
 
@@ -7,8 +7,9 @@
7
7
  /* eslint-disable no-console */
8
8
  import fs from "node:fs";
9
9
  import path from "node:path";
10
- import { createRequire } from "module";
10
+ import { cwd } from "node:process";
11
11
  import { rm, cp } from "node:fs/promises";
12
+ import { createRequire } from "module";
12
13
  import { merge } from "lodash-es";
13
14
 
14
15
  import { vuelessConfig } from "./vuelessConfig.js";
@@ -25,11 +26,9 @@ import {
25
26
  ICONS_DIR,
26
27
  } from "../../constants.js";
27
28
 
28
- const cwd = process.cwd();
29
-
30
- const DEFAULT_ICONS_DIR = path.join(cwd, VUELESS_ICONS_DIR);
31
- const DEFAULT_ICONS_LOCAL_DIR = path.join(cwd, VUELESS_ICONS_LOCAL_DIR);
32
- const CACHED_ICONS_DIR = path.join(cwd, VUELESS_ICONS_CACHED_DIR);
29
+ const DEFAULT_ICONS_DIR = path.join(cwd(), VUELESS_ICONS_DIR);
30
+ const DEFAULT_ICONS_LOCAL_DIR = path.join(cwd(), VUELESS_ICONS_LOCAL_DIR);
31
+ const CACHED_ICONS_DIR = path.join(cwd(), VUELESS_ICONS_CACHED_DIR);
33
32
  const U_ICON = "UIcon";
34
33
 
35
34
  let isDebug = false;
@@ -53,8 +52,8 @@ export async function cacheIcons({ mode, env, debug, targetFiles = [] } = {}) {
53
52
 
54
53
  if (isVuelessIconsMode) {
55
54
  targetFiles = isVuelessEnv
56
- ? [path.join(cwd, VUELESS_LOCAL_DIR)]
57
- : [path.join(cwd, VUELESS_DIR)];
55
+ ? [path.join(cwd(), VUELESS_LOCAL_DIR)]
56
+ : [path.join(cwd(), VUELESS_DIR)];
58
57
  }
59
58
 
60
59
  const commonExcludes = ["/types.ts", "/constants.ts"];
@@ -93,7 +92,7 @@ export async function removeIconsCache(mirrorCacheDir, debug) {
93
92
  }
94
93
 
95
94
  if (mirrorCacheDir) {
96
- const mirrorCacheIconsPath = path.join(cwd, mirrorCacheDir, ICONS_DIR);
95
+ const mirrorCacheIconsPath = path.join(cwd(), mirrorCacheDir, ICONS_DIR);
97
96
 
98
97
  if (fs.existsSync(mirrorCacheIconsPath)) {
99
98
  await rm(mirrorCacheIconsPath, { recursive: true, force: true });
@@ -112,10 +111,10 @@ export async function removeIconsCache(mirrorCacheDir, debug) {
112
111
  * @returns {Promise<void>}
113
112
  */
114
113
  export async function copyIconsCache(mirrorCacheDir, debug) {
115
- const cachePath = path.join(cwd, VUELESS_ICONS_CACHED_DIR);
114
+ const cachePath = path.join(cwd(), VUELESS_ICONS_CACHED_DIR);
116
115
 
117
116
  if (mirrorCacheDir && fs.existsSync(cachePath)) {
118
- await cp(cachePath, path.join(cwd, mirrorCacheDir, ICONS_DIR), { recursive: true });
117
+ await cp(cachePath, path.join(cwd(), mirrorCacheDir, ICONS_DIR), { recursive: true });
119
118
  }
120
119
 
121
120
  if (debug) {
@@ -275,23 +274,23 @@ function getIconLibraryPaths(name, defaults) {
275
274
  const libraries = {
276
275
  [VUELESS_LIBRARY]: {
277
276
  // @material-symbols icons which used across the components (this works only at Vueless env).
278
- source: `${cwd}/node_modules/${library}/svg-${weight}/${style}/${name}.svg`,
277
+ source: `${cwd()}/node_modules/${library}/svg-${weight}/${style}/${name}.svg`,
279
278
  destination: `${CACHED_ICONS_DIR}/${VUELESS_LIBRARY}/${name}.svg`
280
279
  },
281
280
  "@material-symbols": {
282
- source: `${cwd}/node_modules/${library}/svg-${weight}/${style}/${name}.svg`,
281
+ source: `${cwd()}/node_modules/${library}/svg-${weight}/${style}/${name}.svg`,
283
282
  destination: `${CACHED_ICONS_DIR}/${library}/svg-${weight}/${style}/${name}.svg`
284
283
  },
285
284
  "bootstrap-icons": {
286
- source: `${cwd}/node_modules/${library}/icons/${name}.svg`,
285
+ source: `${cwd()}/node_modules/${library}/icons/${name}.svg`,
287
286
  destination: `${CACHED_ICONS_DIR}/${library}/${name}.svg`
288
287
  },
289
288
  "heroicons": {
290
- source: `${cwd}/node_modules/${library}/24/${name.endsWith("-fill") ? "solid" : "outline"}/${name}.svg`,
289
+ source: `${cwd()}/node_modules/${library}/24/${name.endsWith("-fill") ? "solid" : "outline"}/${name}.svg`,
291
290
  destination: `${CACHED_ICONS_DIR}/${library}/${name.endsWith("-fill") ? "solid" : "outline"}/${name}.svg`
292
291
  },
293
292
  "custom-icons": {
294
- source: `${cwd}/${customLibraryPath}/${name}.svg`,
293
+ source: `${cwd()}/${customLibraryPath}/${name}.svg`,
295
294
  destination: `${CACHED_ICONS_DIR}/${library}/${name}.svg`
296
295
  },
297
296
  };
@@ -308,7 +307,7 @@ function getIconLibraryPaths(name, defaults) {
308
307
  */
309
308
  async function getDefaults() {
310
309
  const defaultIconsDir = isVuelessEnv ? VUELESS_LOCAL_DIR : VUELESS_DIR;
311
- const defaultConfigPath = path.join(cwd, defaultIconsDir, COMPONENTS[U_ICON], "config.ts");
310
+ const defaultConfigPath = path.join(cwd(), defaultIconsDir, COMPONENTS[U_ICON], "config.ts");
312
311
  const uIconDefaultConfig = await getComponentDefaultConfig(U_ICON, defaultConfigPath);
313
312
 
314
313
  return merge({}, uIconDefaultConfig?.defaults, vuelessConfig?.component?.[U_ICON]?.defaults);
@@ -1,9 +1,9 @@
1
1
  import path from "node:path";
2
- import { merge, cloneDeep } from "lodash-es";
2
+ import { cwd } from "node:process";
3
3
  import { existsSync } from "node:fs";
4
4
  import { readFile } from "node:fs/promises";
5
+ import { merge, cloneDeep, isEqual } from "lodash-es";
5
6
  import { extendTailwindMerge } from "tailwind-merge";
6
- import { isEqual } from "lodash-es";
7
7
  import { defineConfig } from "cva";
8
8
 
9
9
  import { vuelessConfig } from "./vuelessConfig.js";
@@ -24,7 +24,6 @@ import {
24
24
  TAILWIND_VARIANT_DELIMITER_REG_EXP,
25
25
  } from "../../constants.js";
26
26
 
27
- const cwd = process.cwd();
28
27
  const twMerge = extendTailwindMerge(merge(TAILWIND_MERGE_EXTENSION, vuelessConfig.tailwindMerge));
29
28
 
30
29
  export const { cx } = defineConfig({
@@ -188,7 +187,7 @@ async function retrieveComponentDefaultConfig(componentName, vuelessConfigFiles)
188
187
  );
189
188
 
190
189
  return componentDefaultConfigPath
191
- ? await getComponentDefaultConfig(componentName, path.join(cwd, componentDefaultConfigPath))
190
+ ? await getComponentDefaultConfig(componentName, path.join(cwd(), componentDefaultConfigPath))
192
191
  : {};
193
192
  }
194
193
 
@@ -1,5 +1,6 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
+ import { cwd } from "node:process";
3
4
 
4
5
  import { buildTSFile } from "./helper.js";
5
6
  import { VUELESS_CACHE_DIR, VUELESS_CONFIG_FILE_NAME } from "../../constants.js";
@@ -11,12 +12,9 @@ import { VUELESS_CACHE_DIR, VUELESS_CONFIG_FILE_NAME } from "../../constants.js"
11
12
  export let vuelessConfig = {};
12
13
 
13
14
  (async () => {
14
- const configPathJs = path.join(process.cwd(), `${VUELESS_CONFIG_FILE_NAME}.js`);
15
- const configPathTs = path.join(process.cwd(), `${VUELESS_CONFIG_FILE_NAME}.ts`);
16
- const configOutPath = path.join(
17
- process.cwd(),
18
- `${VUELESS_CACHE_DIR}/${VUELESS_CONFIG_FILE_NAME}.mjs`,
19
- );
15
+ const configPathJs = path.join(cwd(), `${VUELESS_CONFIG_FILE_NAME}.js`);
16
+ const configPathTs = path.join(cwd(), `${VUELESS_CONFIG_FILE_NAME}.ts`);
17
+ const configOutPath = path.join(cwd(), `${VUELESS_CACHE_DIR}/${VUELESS_CONFIG_FILE_NAME}.mjs`);
20
18
 
21
19
  if (!fs.existsSync(configPathJs) && !fs.existsSync(configPathTs)) {
22
20
  vuelessConfig = {};
@@ -91,19 +91,20 @@ export function getArgTypes(componentName: string | undefined) {
91
91
  component.attributes?.forEach((attribute: Attribute) => {
92
92
  const type = attribute.value.type;
93
93
 
94
- if (type.includes("|")) {
94
+ if (attribute.enum) {
95
95
  types[attribute.name] = {
96
- control: type.split("|")[0].toLowerCase() as ArgType["control"],
96
+ options: attribute.enum,
97
+ control: "select",
97
98
  table: {
98
99
  defaultValue: { summary: attribute.default || "" },
100
+ type: { summary: attribute.enum.join(" | ") },
99
101
  },
100
102
  };
101
103
  }
102
104
 
103
- if (attribute.enum) {
105
+ if (attribute.enum?.length === 1) {
104
106
  types[attribute.name] = {
105
- options: attribute.enum,
106
- control: "select",
107
+ control: "object",
107
108
  table: {
108
109
  defaultValue: { summary: attribute.default || "" },
109
110
  type: { summary: attribute.enum.join(" | ") },
@@ -111,17 +112,36 @@ export function getArgTypes(componentName: string | undefined) {
111
112
  };
112
113
  }
113
114
 
114
- if (attribute.enum?.length === 1) {
115
+ const nonUnionTypes = [
116
+ "string",
117
+ "number",
118
+ "boolean",
119
+ "Date",
120
+ "UnknownObject",
121
+ "UnknownArray",
122
+ "Array",
123
+ ];
124
+
125
+ if (attribute.enum?.every((value) => nonUnionTypes.includes(value))) {
126
+ let control = attribute.enum[0];
127
+
128
+ if (control === "string") {
129
+ control = "text";
130
+ }
131
+
132
+ if (control === "Date") {
133
+ control = "date";
134
+ }
135
+
115
136
  types[attribute.name] = {
116
- control: "object",
137
+ control: control as ArgType["control"],
117
138
  table: {
118
139
  defaultValue: { summary: attribute.default || "" },
119
- type: { summary: attribute.enum.join(" | ") },
120
140
  },
121
141
  };
122
142
  }
123
143
 
124
- if (type === "string" || type.includes("string")) {
144
+ if (type === "string") {
125
145
  types[attribute.name] = {
126
146
  control: "text",
127
147
  table: {
@@ -139,14 +159,11 @@ export function getArgTypes(componentName: string | undefined) {
139
159
  };
140
160
  }
141
161
 
142
- if (type === "Date" || attribute.enum?.includes("Date")) {
162
+ if (type === "Date") {
143
163
  types[attribute.name] = {
144
164
  control: "date",
145
165
  table: {
146
166
  defaultValue: { summary: attribute.default || "" },
147
- type: {
148
- summary: ["Date", "string"].join(" | "),
149
- },
150
167
  },
151
168
  };
152
169
  }