vueless 0.0.246 → 0.0.247

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.246",
3
+ "version": "0.0.247",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -1,4 +1,4 @@
1
- import { getArgTypes, getSlotNames, allSlotsFragment } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UDropdownBadge from "../ui.dropdown-badge";
4
4
  import UDropdownItem from "../ui.dropdown-item";
@@ -32,7 +32,7 @@ export default {
32
32
  };
33
33
 
34
34
  const DefaultTemplate = (args) => ({
35
- components: { UDropdownBadge },
35
+ components: { UDropdownBadge, UDropdownItem },
36
36
  setup() {
37
37
  const slots = getSlotNames(UDropdownBadge.name);
38
38
 
@@ -42,61 +42,26 @@ const DefaultTemplate = (args) => ({
42
42
  <UDropdownBadge
43
43
  v-bind="args"
44
44
  >
45
- ${allSlotsFragment}
46
- </UDropdownBadge>
47
- `,
48
- });
49
-
50
- const SlotTemplate = (args) => ({
51
- components: { UDropdownBadge, UDropdownItem },
52
- setup() {
53
- return { args };
54
- },
55
- template: `
56
- <UDropdownBadge
57
- v-bind="args"
58
- >
59
- ${args.slotTemplate}
45
+ ${args.slotTemplate || getSlotsFragment()}
60
46
  </UDropdownBadge>
61
47
  `,
62
48
  });
63
49
 
64
- const SizesTemplate = (args, { argTypes } = {}) => ({
65
- components: { UDropdownBadge, URow },
66
- setup() {
67
- return {
68
- args,
69
- sizes: argTypes.size.options,
70
- };
71
- },
72
- template: `
73
- <URow>
74
- <UDropdownBadge
75
- v-for="(size, index) in sizes"
76
- v-bind="args"
77
- :size="size"
78
- :label="size"
79
- :key="index"
80
- />
81
- </URow>
82
- `,
83
- });
84
-
85
- const ColorsTemplate = (args, { argTypes } = {}) => ({
50
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
86
51
  components: { UDropdownBadge, URow },
87
52
  setup() {
88
53
  return {
89
54
  args,
90
- colors: argTypes.color.options,
55
+ options: argTypes[args.enum].options,
91
56
  };
92
57
  },
93
58
  template: `
94
59
  <URow>
95
60
  <UDropdownBadge
96
- v-for="(color, index) in colors"
97
- :color="color"
98
- :label="color"
61
+ v-for="(option, index) in options"
99
62
  v-bind="args"
63
+ :[args.enum]="option"
64
+ :label="option"
100
65
  :key="index"
101
66
  />
102
67
  </URow>
@@ -106,16 +71,16 @@ const ColorsTemplate = (args, { argTypes } = {}) => ({
106
71
  export const Default = DefaultTemplate.bind({});
107
72
  Default.args = {};
108
73
 
109
- export const sizes = SizesTemplate.bind({});
110
- sizes.args = {};
74
+ export const sizes = EnumVariantTemplate.bind({});
75
+ sizes.args = { enum: "size" };
111
76
 
112
- export const colors = ColorsTemplate.bind({});
113
- colors.args = {};
77
+ export const colors = EnumVariantTemplate.bind({});
78
+ colors.args = { enum: "color" };
114
79
 
115
80
  export const withoutDropdownIcon = DefaultTemplate.bind({});
116
81
  withoutDropdownIcon.args = { noIcon: true };
117
82
 
118
- export const dropdownListSlot = SlotTemplate.bind({});
83
+ export const dropdownListSlot = DefaultTemplate.bind({});
119
84
  dropdownListSlot.args = {
120
85
  slotTemplate: `
121
86
  <template #default>
@@ -1,4 +1,4 @@
1
- import { getArgTypes, getSlotNames, allSlotsFragment } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UDropdownButton from "../ui.dropdown-button";
4
4
  import UDropdownItem from "../ui.dropdown-item";
@@ -33,7 +33,7 @@ export default {
33
33
  };
34
34
 
35
35
  const DefaultTemplate = (args) => ({
36
- components: { UDropdownButton },
36
+ components: { UDropdownButton, UDropdownItem },
37
37
  setup() {
38
38
  const slots = getSlotNames(UDropdownButton.name);
39
39
 
@@ -42,62 +42,28 @@ const DefaultTemplate = (args) => ({
42
42
  template: `
43
43
  <UDropdownButton
44
44
  v-bind="args"
45
+ v-model="args.modelValue"
45
46
  >
46
- ${allSlotsFragment}
47
+ ${args.slotTemplate || getSlotsFragment()}
47
48
  </UDropdownButton>
48
49
  `,
49
50
  });
50
51
 
51
- const SlotTemplate = (args) => ({
52
- components: { UDropdownButton, UDropdownItem },
53
- setup() {
54
- return { args };
55
- },
56
- template: `
57
- <UDropdownButton
58
- v-bind="args"
59
- >
60
- ${args.slotTemplate}
61
- </UDropdownButton>
62
- `,
63
- });
64
-
65
- const VariantsTemplate = (args, { argTypes } = {}) => ({
66
- components: { UDropdownButton, URow },
67
- setup() {
68
- return {
69
- args,
70
- variants: argTypes.variant.options,
71
- };
72
- },
73
- template: `
74
- <URow>
75
- <UDropdownButton
76
- v-for="(variant, index) in variants"
77
- v-bind="args"
78
- :variant="variant"
79
- :label="variant"
80
- :key="index"
81
- />
82
- </URow>
83
- `,
84
- });
85
-
86
- const SizesTemplate = (args, { argTypes } = {}) => ({
52
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
87
53
  components: { UDropdownButton, URow },
88
54
  setup() {
89
55
  return {
90
56
  args,
91
- sizes: argTypes.size.options,
57
+ options: argTypes[args.enum].options,
92
58
  };
93
59
  },
94
60
  template: `
95
61
  <URow>
96
62
  <UDropdownButton
97
- v-for="(size, index) in sizes"
63
+ v-for="(option, index) in options"
98
64
  v-bind="args"
99
- :size="size"
100
- :label="size"
65
+ :[args.enum]="option"
66
+ :label="option"
101
67
  :key="index"
102
68
  />
103
69
  </URow>
@@ -135,19 +101,19 @@ Default.args = {};
135
101
  export const Filled = DefaultTemplate.bind({});
136
102
  Filled.args = { variant: "thirdary", filled: true };
137
103
 
138
- export const Variants = VariantsTemplate.bind({});
139
- Variants.args = { text: "" };
104
+ export const Variants = EnumVariantTemplate.bind({});
105
+ Variants.args = { enum: "variant", text: "" };
140
106
 
141
- export const Sizes = SizesTemplate.bind({});
142
- Sizes.args = { text: "" };
107
+ export const Sizes = EnumVariantTemplate.bind({});
108
+ Sizes.args = { enum: "size", text: "" };
143
109
 
144
110
  export const VariantColors = VariantColorsTemplate.bind({});
145
111
  VariantColors.args = { text: "" };
146
112
 
147
- export const WithoutDropdownIcon = VariantsTemplate.bind({});
148
- WithoutDropdownIcon.args = { noIcon: true };
113
+ export const WithoutDropdownIcon = EnumVariantTemplate.bind({});
114
+ WithoutDropdownIcon.args = { enum: "variant", noIcon: true };
149
115
 
150
- export const dropdownListSlot = SlotTemplate.bind({});
116
+ export const dropdownListSlot = DefaultTemplate.bind({});
151
117
  dropdownListSlot.args = {
152
118
  slotTemplate: `
153
119
  <template #default>
@@ -1,4 +1,4 @@
1
- import { getArgTypes } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UDropdownItem from "../ui.dropdown-item";
4
4
 
@@ -20,12 +20,14 @@ export default {
20
20
  const DefaultTemplate = (args) => ({
21
21
  components: { UDropdownItem },
22
22
  setup() {
23
- return { args };
23
+ const slots = getSlotNames(UDropdownItem.name);
24
+
25
+ return { args, slots };
24
26
  },
25
27
  template: `
26
- <UDropdownItem
27
- v-bind="args"
28
- />
28
+ <UDropdownItem v-bind="args">
29
+ ${args.slotTemplate || getSlotsFragment()}
30
+ </UDropdownItem>
29
31
  `,
30
32
  });
31
33
 
@@ -1,4 +1,4 @@
1
- import { getArgTypes, getSlotNames, allSlotsFragment } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UDropdownLink from "../ui.dropdown-link";
4
4
  import UDropdownItem from "../ui.dropdown-item";
@@ -32,91 +32,60 @@ export default {
32
32
  };
33
33
 
34
34
  const DefaultTemplate = (args) => ({
35
- components: { UDropdownLink },
35
+ components: { UDropdownLink, UDropdownItem },
36
36
  setup() {
37
37
  const slots = getSlotNames(UDropdownLink.name);
38
38
 
39
39
  return { args, slots };
40
40
  },
41
41
  template: `
42
- <UDropdownLink
43
- v-bind="args"
44
- >
45
- ${allSlotsFragment}
46
- </UDropdownLink>
47
- `,
48
- });
49
-
50
- const SlotTemplate = (args) => ({
51
- components: { UDropdownLink, UDropdownItem },
52
- setup() {
53
- return { args };
54
- },
55
- template: `
56
- <UDropdownLink
57
- v-bind="args"
58
- >
59
- ${args.slotTemplate}
42
+ <UDropdownLink v-bind="args">
43
+ ${args.slotTemplate || getSlotsFragment()}
60
44
  </UDropdownLink>
61
45
  `,
62
46
  });
63
47
 
64
- const SizesTemplate = (args, { argTypes } = {}) => ({
48
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
65
49
  components: { UDropdownLink, URow },
66
50
  setup() {
67
- return {
68
- args,
69
- sizes: argTypes.size.options,
70
- };
51
+ function getText(value) {
52
+ return `Dropdown ${value}`;
53
+ }
54
+
55
+ let prefixedOptions = argTypes[args.enum].options;
56
+
57
+ if (argTypes[args.enum].name === "size") {
58
+ prefixedOptions = prefixedOptions.map((option) => getText(option));
59
+ }
60
+
61
+ return { args, options: argTypes[args.enum].options, prefixedOptions };
71
62
  },
72
63
  template: `
73
64
  <URow>
74
65
  <UDropdownLink
75
- v-for="(size, index) in sizes"
66
+ v-for="(option, index) in options"
76
67
  v-bind="args"
77
- :size="size"
68
+ :[args.enum]="option"
69
+ :label="prefixedOptions[index]"
78
70
  :key="index"
79
71
  />
80
72
  </URow>
81
73
  `,
82
74
  });
83
75
 
84
- const ColorsTemplate = (args, { argTypes } = {}) => ({
85
- components: { UDropdownLink, URow },
86
- setup() {
87
- return {
88
- args,
89
- colors: argTypes.color.options,
90
- };
91
- },
92
- template: `
93
- <div>
94
- <URow>
95
- <UDropdownLink
96
- v-for="(color, id) in colors"
97
- v-bind="args"
98
- :color="color"
99
- :label="color"
100
- :key="id"
101
- />
102
- </URow>
103
- </div>
104
- `,
105
- });
106
-
107
76
  export const Default = DefaultTemplate.bind({});
108
77
  Default.args = {};
109
78
 
110
- export const sizes = SizesTemplate.bind({});
111
- sizes.args = {};
79
+ export const sizes = EnumVariantTemplate.bind({});
80
+ sizes.args = { enum: "size" };
112
81
 
113
- export const colors = ColorsTemplate.bind({});
114
- colors.args = {};
82
+ export const colors = EnumVariantTemplate.bind({});
83
+ colors.args = { enum: "color" };
115
84
 
116
85
  export const WithoutDropdownIcon = DefaultTemplate.bind({});
117
86
  WithoutDropdownIcon.args = { noIcon: true };
118
87
 
119
- export const dropdownListSlot = SlotTemplate.bind({});
88
+ export const dropdownListSlot = DefaultTemplate.bind({});
120
89
  dropdownListSlot.args = {
121
90
  slotTemplate: `
122
91
  <template #default>
@@ -1,4 +1,4 @@
1
- import { getArgTypes } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UDropdownList from "../ui.dropdown-list";
4
4
  import URow from "../ui.container-row";
@@ -32,29 +32,33 @@ export default {
32
32
  const DefaultTemplate = (args) => ({
33
33
  components: { UDropdownList },
34
34
  setup() {
35
- return { args };
35
+ const slots = getSlotNames(UDropdownList.name);
36
+
37
+ return { args, slots };
36
38
  },
37
39
  template: `
38
- <UDropdownList v-bind="args" class="mx-4 w-[24rem]"/>
40
+ <UDropdownList v-bind="args" class="mx-4 w-[24rem]">
41
+ ${args.slotTemplate || getSlotsFragment()}
42
+ </UDropdownList>
39
43
  `,
40
44
  });
41
45
 
42
- const SizesTemplate = (args, { argTypes } = {}) => ({
46
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
43
47
  components: { UDropdownList, URow },
44
48
  setup() {
45
49
  return {
46
50
  args,
47
- sizes: argTypes.size.options,
51
+ options: argTypes[args.enum].options,
48
52
  };
49
53
  },
50
54
  template: `
51
55
  <div class="flex flex-col gap-6">
52
56
  <URow>
53
57
  <UDropdownList
54
- v-for="(size, index) in sizes"
58
+ v-for="(option, index) in options"
55
59
  :key="index"
56
60
  v-bind="args"
57
- :size="size"
61
+ :[args.enum]="option"
58
62
  />
59
63
  </URow>
60
64
  </div>
@@ -64,8 +68,8 @@ const SizesTemplate = (args, { argTypes } = {}) => ({
64
68
  export const Default = DefaultTemplate.bind({});
65
69
  Default.args = {};
66
70
 
67
- export const sizes = SizesTemplate.bind({});
68
- sizes.args = {};
71
+ export const sizes = EnumVariantTemplate.bind({});
72
+ sizes.args = { enum: "size" };
69
73
 
70
74
  export const maxHeight = DefaultTemplate.bind({});
71
75
  maxHeight.args = { maxHeight: 80 };
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.246",
4
+ "version": "0.0.247",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",