vueless 0.0.236 → 0.0.237

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.
@@ -4,7 +4,7 @@ import URow from "../ui.container-row";
4
4
  import DebitIcon from "../ui.text-money/assets/debit.svg?component";
5
5
  import CreditIcon from "../ui.text-money/assets/credit.svg?component";
6
6
 
7
- import { getArgTypes, getSlotNames, allSlotsFragment } from "../service.storybook";
7
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
8
8
 
9
9
  const COMPONENT_CLASSES = "flex justify-center w-1/6";
10
10
 
@@ -26,145 +26,41 @@ export default {
26
26
  };
27
27
 
28
28
  const DefaultTemplate = (args) => ({
29
- components: { UMoney },
29
+ components: { UMoney, UIcon },
30
30
  setup() {
31
31
  const slots = getSlotNames(UMoney.name);
32
32
 
33
- return { args, slots };
34
- },
35
- template: `
36
- <div class="${COMPONENT_CLASSES}">
37
- <UMoney v-bind="args">
38
- ${allSlotsFragment}
39
- </UMoney>
40
- </div>
41
- `,
42
- });
43
-
44
- const SlotTemplate = (args) => ({
45
- components: { UMoney, UIcon },
46
- setup() {
47
33
  const icons = {
48
34
  Debit: DebitIcon,
49
35
  Credit: CreditIcon,
50
36
  };
51
37
 
52
- return { args, icons };
38
+ return { args, slots, icons };
53
39
  },
54
40
  template: `
55
41
  <div class="${COMPONENT_CLASSES}">
56
42
  <UMoney v-bind="args">
57
- ${args.slotTemplate}
43
+ ${args.slotTemplate || getSlotsFragment()}
58
44
  </UMoney>
59
45
  </div>
60
46
  `,
61
47
  });
62
48
 
63
- const SizesTemplate = (args, { argTypes } = {}) => ({
64
- components: { UMoney, URow },
65
- setup() {
66
- return {
67
- args,
68
- sizes: argTypes.size.options,
69
- };
70
- },
71
- template: `
72
- <URow>
73
- <div class="${COMPONENT_CLASSES}" v-for="(size, index) in sizes" :key="index">
74
- <UMoney v-bind="args" :size="size" >
75
- <template v-for="(slot) in slots" v-slot:[slot]>
76
- <template v-if="args[slot]">{{ args[slot] }}</template>
77
- </template>
78
- </UMoney>
79
- </div>
80
- </URow>
81
- `,
82
- });
83
-
84
- const WeightTemplate = (args, { argTypes } = {}) => ({
85
- components: { UMoney, URow },
86
- setup() {
87
- return {
88
- args,
89
- weights: argTypes.weight.options,
90
- };
91
- },
92
- template: `
93
- <URow>
94
- <div class="${COMPONENT_CLASSES}" v-for="(weight, index) in weights" :key="index">
95
- <UMoney v-bind="args" :weight="weight" >
96
- <template v-for="(slot) in slots" v-slot:[slot]>
97
- <template v-if="args[slot]">{{ args[slot] }}</template>
98
- </template>
99
- </UMoney>
100
- </div>
101
- </URow>
102
- `,
103
- });
104
-
105
- const ColorsTemplate = (args, { argTypes } = {}) => ({
49
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
106
50
  components: { UMoney, URow },
107
51
  setup() {
108
- return {
109
- args,
110
- colors: argTypes.color.options,
111
- };
112
- },
113
- template: `
114
- <URow>
115
- <div class="${COMPONENT_CLASSES}" v-for="(color, index) in colors" :key="index">
116
- <UMoney v-bind="args" :color="color" >
117
- <template v-for="(slot) in slots" v-slot:[slot]>
118
- <template v-if="args[slot]">{{ args[slot] }}</template>
119
- </template>
120
- </UMoney>
121
- </div>
122
- </URow>
123
- `,
124
- created() {
125
- this.mxArgTypes = argTypes;
126
- },
127
- });
128
-
129
- const SignsTemplate = (args, { argTypes } = {}) => ({
130
- components: { UMoney, URow },
131
- setup() {
132
- return {
133
- args,
134
- signs: argTypes.sign.options,
135
- };
136
- },
137
- template: `
138
- <URow>
139
- <div class="${COMPONENT_CLASSES}" v-for="(sign, index) in signs" :key="index">
140
- <UMoney v-bind="args" :sign="sign" >
141
- <template v-for="(slot) in slots" v-slot:[slot]>
142
- <template v-if="args[slot]">{{ args[slot] }}</template>
143
- </template>
144
- </UMoney>
145
- </div>
146
- </URow>
147
- `,
148
- created() {
149
- this.mxArgTypes = argTypes;
150
- },
151
- });
52
+ const slots = getSlotNames(UMoney.name);
152
53
 
153
- const SymbolAlignTemplate = (args, { argTypes } = {}) => ({
154
- components: { UMoney, URow },
155
- setup() {
156
54
  return {
157
55
  args,
158
- symbolsAlign: argTypes.symbolAlign.options,
56
+ slots,
57
+ options: argTypes[args.enum].options,
159
58
  };
160
59
  },
161
60
  template: `
162
61
  <URow>
163
- <div class="${COMPONENT_CLASSES}" v-for="(symbolAlign, index) in symbolsAlign" :key="index">
164
- <UMoney
165
- v-bind="args"
166
- :symbol-align="symbolAlign"
167
- >
62
+ <div class="${COMPONENT_CLASSES}" v-for="(option, index) in options" :key="index">
63
+ <UMoney v-bind="args" :[args.enum]="option" >
168
64
  <template v-for="(slot) in slots" v-slot:[slot]>
169
65
  <template v-if="args[slot]">{{ args[slot] }}</template>
170
66
  </template>
@@ -177,27 +73,6 @@ const SymbolAlignTemplate = (args, { argTypes } = {}) => ({
177
73
  },
178
74
  });
179
75
 
180
- const AlignTemplate = (args, { argTypes } = {}) => ({
181
- components: { UMoney, URow },
182
- setup() {
183
- return {
184
- args,
185
- aligns: argTypes.align.options,
186
- };
187
- },
188
- template: `
189
- <URow>
190
- <div class="${COMPONENT_CLASSES}" v-for="(align, index) in aligns" :key="index">
191
- <UMoney :align="align" v-bind="args" >
192
- <template v-for="(slot) in slots" v-slot:[slot]>
193
- <template v-if="args[slot]">{{ args[slot] }}</template>
194
- </template>
195
- </UMoney>
196
- </div>
197
- </URow>
198
- `,
199
- });
200
-
201
76
  export const Default = DefaultTemplate.bind({});
202
77
  Default.args = {};
203
78
 
@@ -208,24 +83,25 @@ otherValues.args = {
208
83
  sign: "negative",
209
84
  };
210
85
 
211
- export const colors = ColorsTemplate.bind({});
86
+ export const colors = EnumVariantTemplate.bind({});
212
87
  colors.args = {
88
+ enum: "color",
213
89
  sum: 0,
214
90
  symbol: "$",
215
91
  sign: "default",
216
92
  };
217
93
 
218
- export const sizes = SizesTemplate.bind({});
219
- sizes.args = {};
94
+ export const sizes = EnumVariantTemplate.bind({});
95
+ sizes.args = { enum: "size" };
220
96
 
221
- export const weights = WeightTemplate.bind({});
222
- weights.args = {};
97
+ export const weights = EnumVariantTemplate.bind({});
98
+ weights.args = { enum: "weight" };
223
99
 
224
- export const sign = SignsTemplate.bind({});
225
- sign.args = {};
100
+ export const sign = EnumVariantTemplate.bind({});
101
+ sign.args = { enum: "sign" };
226
102
 
227
- export const symbolAlign = SymbolAlignTemplate.bind({});
228
- symbolAlign.args = {};
103
+ export const symbolAlign = EnumVariantTemplate.bind({});
104
+ symbolAlign.args = { enum: "symbolAlign" };
229
105
 
230
106
  export const planned = DefaultTemplate.bind({});
231
107
  planned.args = { planned: true };
@@ -236,10 +112,10 @@ integer.args = { integer: true };
236
112
  export const numeralDecimalScale3 = DefaultTemplate.bind({});
237
113
  numeralDecimalScale3.args = { numeralDecimalScale: 3 };
238
114
 
239
- export const align = AlignTemplate.bind({});
240
- align.args = {};
115
+ export const align = EnumVariantTemplate.bind({});
116
+ align.args = { enum: "align" };
241
117
 
242
- export const slotLeft = SlotTemplate.bind({});
118
+ export const slotLeft = DefaultTemplate.bind({});
243
119
  slotLeft.args = {
244
120
  slotTemplate: `
245
121
  <template #left>
@@ -248,7 +124,7 @@ slotLeft.args = {
248
124
  `,
249
125
  };
250
126
 
251
- export const slotRight = SlotTemplate.bind({});
127
+ export const slotRight = DefaultTemplate.bind({});
252
128
  slotRight.args = {
253
129
  slotTemplate: `
254
130
  <template #right>
@@ -4,7 +4,7 @@ import UNotify from "../ui.text-notify";
4
4
  import UButton from "../ui.button";
5
5
  import UGroup from "../ui.container-group";
6
6
 
7
- import { getArgTypes } from "../service.storybook";
7
+ import { getArgTypes, getSlotsFragment } from "../service.storybook";
8
8
 
9
9
  /**
10
10
  * The `UNotify` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.text-notify)
@@ -28,39 +28,28 @@ export default {
28
28
  const DefaultTemplate = (args) => ({
29
29
  components: { UNotify, UButton },
30
30
  setup() {
31
- return { args };
32
- },
33
- template: `
34
- <UNotify class="m-4" v-bind="args" />
35
- <UButton label="Show notify" @click="onClick"/>
36
- `,
37
- methods: {
38
- onClick() {
31
+ function onClick() {
39
32
  notify({
40
33
  type: "success",
41
34
  label: "Hurray!",
42
35
  description: "The file successfully downloaded.",
43
36
  });
44
- },
37
+ }
38
+
39
+ return { args, onClick };
45
40
  },
41
+ template: `
42
+ <UNotify class="m-4" v-bind="args">
43
+ ${args.slotTemplate || getSlotsFragment()}
44
+ </UNotify>
45
+ <UButton label="Show notify" @click="onClick"/>
46
+ `,
46
47
  });
47
48
 
48
49
  const TypesTemplate = (args) => ({
49
50
  components: { UNotify, UButton, UGroup },
50
51
  setup() {
51
- return { args };
52
- },
53
- template: `
54
- <UNotify class="m-4" />
55
-
56
- <UGroup>
57
- <UButton label="Success" color="green" @click="onClick('success')"/>
58
- <UButton label="Warning" color="orange" @click="onClick('warning')"/>
59
- <UButton label="Error" color="red" @click="onClick('error')"/>
60
- </UGroup>
61
- `,
62
- methods: {
63
- onClick(type) {
52
+ function onClick(type) {
64
53
  if (type === "success") {
65
54
  notify({
66
55
  type,
@@ -84,8 +73,19 @@ const TypesTemplate = (args) => ({
84
73
  description: "The file can't be downloaded, please check the fields and try again.",
85
74
  });
86
75
  }
87
- },
76
+ }
77
+
78
+ return { args, onClick };
88
79
  },
80
+ template: `
81
+ <UNotify class="m-4" />
82
+
83
+ <UGroup>
84
+ <UButton label="Success" color="green" @click="onClick('success')"/>
85
+ <UButton label="Warning" color="orange" @click="onClick('warning')"/>
86
+ <UButton label="Error" color="red" @click="onClick('error')"/>
87
+ </UGroup>
88
+ `,
89
89
  });
90
90
 
91
91
  export const Default = DefaultTemplate.bind({});
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.236",
4
+ "version": "0.0.237",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -413,21 +413,31 @@
413
413
  "description": "",
414
414
  "attributes": [
415
415
  {
416
- "name": "variant",
417
- "description": "Alert variant.",
416
+ "name": "title",
417
+ "description": "Alert title.",
418
418
  "value": {
419
419
  "kind": "expression",
420
- "type": "'primary' | 'secondary' | 'thirdary'"
420
+ "type": "string"
421
421
  },
422
- "default": "thirdary"
422
+ "default": "\"\""
423
423
  },
424
424
  {
425
- "name": "html",
426
- "description": "HTML or plain text.",
425
+ "name": "description",
426
+ "description": "Alert description.",
427
427
  "value": {
428
428
  "kind": "expression",
429
429
  "type": "string"
430
- }
430
+ },
431
+ "default": "\"\""
432
+ },
433
+ {
434
+ "name": "variant",
435
+ "description": "Alert variant.",
436
+ "value": {
437
+ "kind": "expression",
438
+ "type": "'primary' | 'secondary' | 'thirdary'"
439
+ },
440
+ "default": "primary"
431
441
  },
432
442
  {
433
443
  "name": "size",
@@ -491,24 +501,6 @@
491
501
  "type": "string"
492
502
  },
493
503
  "default": "\"\""
494
- },
495
- {
496
- "name": "title",
497
- "description": "Alert title.",
498
- "value": {
499
- "kind": "expression",
500
- "type": "string"
501
- },
502
- "default": "\"\""
503
- },
504
- {
505
- "name": "description",
506
- "description": "Alert description.",
507
- "value": {
508
- "kind": "expression",
509
- "type": "string"
510
- },
511
- "default": "\"\""
512
504
  }
513
505
  ],
514
506
  "events": [
@@ -522,6 +514,10 @@
522
514
  "name": "top",
523
515
  "description": "Use it to add something above the text."
524
516
  },
517
+ {
518
+ "name": "left",
519
+ "description": "Use it to add something before the text."
520
+ },
525
521
  {
526
522
  "name": "title",
527
523
  "scoped": true,
@@ -545,12 +541,7 @@
545
541
  ]
546
542
  },
547
543
  {
548
- "name": "left",
549
- "description": "Use it to add something before the text."
550
- },
551
- {
552
- "name": "default",
553
- "description": "Use it to add something inside."
544
+ "name": "default"
554
545
  },
555
546
  {
556
547
  "name": "right",