vueless 0.0.742 → 0.0.744

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.742",
3
+ "version": "0.0.744",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -547,9 +547,9 @@ const {
547
547
  datepickerCalendarAttrs,
548
548
  datepickerInputAttrs,
549
549
  menuAttrs,
550
- buttonWrapperAttrs,
551
- buttonAttrs,
552
- shiftRangeButtonAttrs,
550
+ rangeButtonAttrs,
551
+ rangeButtonShiftAttrs,
552
+ rangeButtonSelectAttrs,
553
553
  rangeInputWrapperAttrs,
554
554
  rangeInputErrorAttrs,
555
555
  datepickerInputActiveAttrs,
@@ -572,7 +572,7 @@ const {
572
572
  /* Merging DatePickerRange's i18n translations into Calendar's i18n translations. */
573
573
 
574
574
  /* TODO:
575
- Find way to do it more explicity.
575
+ Find way to do it more explicity.
576
576
  It is not really clear that i18n changes datepickerCalendarAttrs now.
577
577
  */
578
578
  watchEffect(() => {
@@ -624,7 +624,7 @@ watchEffect(() => {
624
624
  </template>
625
625
  </UInput>
626
626
 
627
- <div v-if="isVariant.button" v-bind="buttonWrapperAttrs">
627
+ <div v-if="isVariant.button" v-bind="rangeButtonAttrs">
628
628
  <UButton
629
629
  ref="button-prev"
630
630
  square
@@ -633,7 +633,7 @@ watchEffect(() => {
633
633
  :disabled="disabled"
634
634
  variant="thirdary"
635
635
  :left-icon="config.defaults.prevIcon"
636
- v-bind="shiftRangeButtonAttrs"
636
+ v-bind="rangeButtonShiftAttrs"
637
637
  @click="onClickShiftRange(ShiftAction.Prev)"
638
638
  />
639
639
 
@@ -646,7 +646,7 @@ watchEffect(() => {
646
646
  :disabled="disabled"
647
647
  :label="userFormatDate"
648
648
  variant="thirdary"
649
- v-bind="buttonAttrs"
649
+ v-bind="rangeButtonSelectAttrs"
650
650
  @click="activate"
651
651
  />
652
652
 
@@ -658,7 +658,7 @@ watchEffect(() => {
658
658
  :disabled="disabled"
659
659
  variant="thirdary"
660
660
  :left-icon="config.defaults.nextIcon"
661
- v-bind="shiftRangeButtonAttrs"
661
+ v-bind="rangeButtonShiftAttrs"
662
662
  @click="onClickShiftRange(ShiftAction.Next)"
663
663
  />
664
664
  </div>
@@ -22,9 +22,9 @@ export default /*tw*/ {
22
22
  },
23
23
  },
24
24
  },
25
- buttonWrapper: "flex rounded-dynamic max-md:justify-between",
26
- button: "{UButton} shrink-0 grow rounded-none",
27
- shiftRangeButton: `
25
+ rangeButton: "flex rounded-dynamic max-md:justify-between",
26
+ rangeButtonSelect: "{UButton} shrink-0 grow rounded-none",
27
+ rangeButtonShift: `
28
28
  first:rounded-dynamic first:rounded-r-none
29
29
  last:rounded-dynamic last:rounded-l-none
30
30
  `,
@@ -38,6 +38,7 @@ const generatedIcons = computed(() => {
38
38
 
39
39
  const dynamicComponent = computed(() => {
40
40
  const FILL_SUFFIX = "-fill";
41
+ const ICON_EXTENSION = ".svg";
41
42
 
42
43
  const userLibrary = config.value.defaults.library as IconLibraries;
43
44
 
@@ -69,12 +70,15 @@ const dynamicComponent = computed(() => {
69
70
  /* Dynamic import */
70
71
  if (!name) return "";
71
72
 
72
- function getIcon(params: (string | number)[]) {
73
+ function getIcon(name: string, params: (string | number)[] = []) {
74
+ // eslint-disable-next-line prettier/prettier
75
+ const iconName = isFill
76
+ ? name + FILL_SUFFIX + ICON_EXTENSION
77
+ : name + ICON_EXTENSION;
78
+
73
79
  const [, component] =
74
80
  generatedIcons.value.find(([path]) =>
75
- params.every(
76
- (param) => (isFill || !path.includes(FILL_SUFFIX)) && path.includes(String(param)),
77
- ),
81
+ [iconName, ...params].every((param) => path.includes(String(param))),
78
82
  ) || [];
79
83
 
80
84
  return component;
@@ -84,21 +88,21 @@ const dynamicComponent = computed(() => {
84
88
  const libraries = {
85
89
  "vueless": async () => {
86
90
  return import.meta.env.PROD
87
- ? await getIcon([name])
91
+ ? await getIcon(name)
88
92
  : isSSR
89
93
  ? import(/* @vite-ignore */ `${VUELESS_ICONS_CACHED_DIR}/${VUELESS_LIBRARY}/${name}.svg?component`)
90
94
  : import(/* @vite-ignore */ `/${VUELESS_ICONS_CACHED_DIR}/${VUELESS_LIBRARY}/${name}.svg?component`);
91
95
  },
92
96
  "@material-symbols": async () => {
93
97
  return import.meta.env.PROD
94
- ? await getIcon([library, weight, style, name])
98
+ ? await getIcon(name, [library, weight, style])
95
99
  : isSSR
96
100
  ? import(/* @vite-ignore */ `node_modules/${library}/svg-${weight}/${style}/${name}.svg?component`)
97
101
  : import(/* @vite-ignore */ `/node_modules/${library}/svg-${weight}/${style}/${name}.svg?component`);
98
102
  },
99
103
  "bootstrap-icons": async () => {
100
104
  return import.meta.env.PROD
101
- ? await getIcon([library, name])
105
+ ? await getIcon(name, [library])
102
106
  : isSSR
103
107
  ? import(/* @vite-ignore */ `node_modules/${library}/icons/${name}.svg?component`)
104
108
  : import(/* @vite-ignore */ `/node_modules/${library}/icons/${name}.svg?component`);
@@ -107,14 +111,14 @@ const dynamicComponent = computed(() => {
107
111
  const fillType = isFill ? "solid" : "outline";
108
112
 
109
113
  return import.meta.env.PROD
110
- ? await getIcon([library, fillType, name])
114
+ ? await getIcon(name, [library, fillType])
111
115
  : isSSR
112
116
  ? import(/* @vite-ignore */ `node_modules/${library}/24/${fillType}/${name}.svg?component`)
113
117
  : import(/* @vite-ignore */ `/node_modules/${library}/24/${fillType}/${name}.svg?component`);
114
118
  },
115
119
  "custom-icons": async () => {
116
120
  return import.meta.env.PROD
117
- ? await getIcon([library, name])
121
+ ? await getIcon(name, [library])
118
122
  : isSSR
119
123
  ? import(/* @vite-ignore */ `${customLibraryPath}/${name}.svg?component`)
120
124
  : import(/* @vite-ignore */ `/${customLibraryPath}/${name}.svg?component`);