@vueless/storybook 0.0.75-beta.6 → 0.0.75-beta.8

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.
@@ -1,4 +1,4 @@
1
- import { addons, useArgs, makeDecorator } from "@storybook/preview-api";
1
+ import { addons, makeDecorator, useArgs } from "@storybook/preview-api";
2
2
  import { h, onMounted, watch } from "vue";
3
3
 
4
4
  const params = new URLSearchParams(window.location.search);
@@ -27,7 +27,7 @@ export const vue3SourceDecorator = makeDecorator({
27
27
  previousStoryId = context.id;
28
28
 
29
29
  // this returns a new component that computes the source code when mounted
30
- // and emits an events that is handled by addons-docs
30
+ // and emits an event that is handled by addons-docs
31
31
  // watch args and re-emit on change
32
32
  return {
33
33
  components: { story },
@@ -38,16 +38,20 @@ export const vue3SourceDecorator = makeDecorator({
38
38
  await setSourceCode();
39
39
  });
40
40
 
41
- watch(context.args, async () => {
42
- // it allows changing args dynamically
43
- updateArgs({ ...context.args });
44
- await setSourceCode();
45
- });
41
+ watch(
42
+ context.args,
43
+ async () => {
44
+ updateArgs({ ...context.args });
45
+ await setSourceCode();
46
+ },
47
+ { deep: true },
48
+ );
46
49
 
47
50
  async function setSourceCode() {
48
51
  try {
49
52
  const src = context.originalStoryFn(context.args, context.argTypes).template;
50
- const code = templateSourceCode(src, context.args, context.argTypes);
53
+ const code = preFormat(src, context.args, context.argTypes);
54
+
51
55
  const channel = addons.getChannel();
52
56
 
53
57
  const emitFormattedTemplate = async () => {
@@ -64,7 +68,7 @@ export const vue3SourceDecorator = makeDecorator({
64
68
  channel.emit("storybook/docs/snippet-rendered", {
65
69
  id: context.id,
66
70
  args: context.args,
67
- source: formattedCode,
71
+ source: postFormat(formattedCode),
68
72
  });
69
73
  };
70
74
 
@@ -83,22 +87,32 @@ export const vue3SourceDecorator = makeDecorator({
83
87
  },
84
88
  });
85
89
 
86
- function templateSourceCode(templateSource, args, argTypes) {
87
- const MODEL_VALUE_KEY = "modelValue";
88
- const componentArgs = {};
90
+ function preFormat(templateSource, args, argTypes) {
91
+ templateSource = expandVueLoopFromTemplate(templateSource, args, argTypes);
92
+
93
+ if (args?.outerEnum) {
94
+ templateSource = expandOuterVueLoopFromTemplate(templateSource, args, argTypes);
95
+ }
96
+
97
+ const componentArgs = {
98
+ ...(args.class && { class: args.class }),
99
+ };
100
+
101
+ const enumKeys = Object.entries(args)
102
+ .filter(([, value]) => JSON.stringify(value)?.includes("{enumValue}"))
103
+ .map(([key]) => key);
89
104
 
90
105
  for (const [key, val] of Object.entries(argTypes)) {
91
- if (key === MODEL_VALUE_KEY) continue;
106
+ if (key === "modelValue") continue;
92
107
 
93
- const value = args[key];
108
+ const isUndefined = typeof val !== "undefined";
109
+ const isProps = val?.table?.category === "props";
110
+ const isValueDefault = args[key] === val.defaultValue;
94
111
 
95
- if (
96
- typeof val !== "undefined" &&
97
- val.table &&
98
- val.table.category === "props" &&
99
- value !== val.defaultValue
100
- ) {
101
- componentArgs[key] = val;
112
+ if (isUndefined && isProps && !isValueDefault) {
113
+ if (!(args.enum && enumKeys.includes(key)) && key !== args.outerEnum) {
114
+ componentArgs[key] = val;
115
+ }
102
116
  }
103
117
  }
104
118
 
@@ -110,29 +124,158 @@ function templateSourceCode(templateSource, args, argTypes) {
110
124
  // eslint-disable-next-line vue/max-len
111
125
  `</template><template v-else-if="slot === 'default' && args['defaultSlot']">{{ args['defaultSlot'] }}</template><template v-else-if="args[slot + 'Slot']">{{ args[slot + 'Slot'] }}</template></template>`;
112
126
 
113
- return templateSource
127
+ const modelValue = JSON.stringify(args["modelValue"])?.replaceAll('"', "'");
128
+
129
+ templateSource = templateSource
114
130
  .replace(/>[\s]+</g, "><")
115
131
  .trim()
116
132
  .replace(slotTemplateCodeBefore, "")
117
133
  .replace(slotTemplateCodeAfter, "")
118
134
  .replace(
119
- `v-model="args.${MODEL_VALUE_KEY}"`,
120
- args[MODEL_VALUE_KEY] ? `v-model="${args[MODEL_VALUE_KEY]}"` : "",
135
+ new RegExp(`v-model="args\\.modelValue"`, "g"),
136
+ args["modelValue"] ? `v-model="${modelValue}"` : "",
121
137
  )
122
138
  .replace(
123
- 'v-bind="args"',
139
+ /v-bind="args"/g,
124
140
  Object.keys(componentArgs)
125
- .map((key) => " " + propToSource(kebabCase(key), args[key]))
141
+ .map((key) => " " + propToSource(kebabCase(key), args[key], argTypes[key]))
126
142
  .join(""),
127
143
  );
144
+
145
+ return templateSource;
146
+ }
147
+
148
+ function postFormat(code) {
149
+ return (
150
+ code
151
+ /* Add self-closing tag if there is no content inside */
152
+ .replace(/<(\w+)([^>]*)><\/\1>/g, (_, tag, attrs) => {
153
+ const hasText = attrs.trim().includes("\n") ? false : attrs.trim().length > 0;
154
+ const space = hasText ? " " : "";
155
+
156
+ return `<${tag}${attrs}${space}/>`;
157
+ })
158
+ /* Format objects in props */
159
+ .replace(/^(\s*):([\w-]+)="\[(\{.*?\})\]"/gm, (_, indent, propName, content) => {
160
+ const formatted = content
161
+ .split(/\},\s*\{/)
162
+ .map((obj, i, arr) => {
163
+ if (i === 0) obj += "}";
164
+ else if (i === arr.length - 1) obj = "{" + obj;
165
+ else obj = "{" + obj + "}";
166
+
167
+ return `${indent} ${obj}`;
168
+ })
169
+ .join(",\n");
170
+
171
+ return `${indent}:${propName}="[\n${formatted}\n${indent}]"`;
172
+ })
173
+ /* Added a new line between nested elements with closing tags */
174
+ .replace(/(<\/[\w-]+>)\n(\s*)(<[\w-][^>]*?>)/g, (match, closeTag, indent, openTag) => {
175
+ return `${closeTag}\n\n${indent}${openTag}`;
176
+ })
177
+ /* Added a new line between nested elements with self-closing tags */
178
+ .replace(/(\/>\n)(?=\s*<\w[\s\S]*?\n\s*\/>)/g, "$1\n")
179
+ );
180
+ }
181
+
182
+ function expandOuterVueLoopFromTemplate(template, args, argTypes) {
183
+ const loopRegex = /<(\w+)[^>]*v-for[^>]*>([\s\S]*?)<\/\1>/;
184
+ const loopMatch = template.match(loopRegex);
185
+
186
+ if (!loopMatch) return;
187
+
188
+ const [, containerTag, innerContent] = loopMatch;
189
+
190
+ const elementRegex = /<(\w+)([^>]*)>(.*?)<\/\1>/g;
191
+ const elements = [...innerContent.matchAll(elementRegex)];
192
+
193
+ if (!elements.length) return;
194
+
195
+ const newRows = argTypes[args.outerEnum]?.options
196
+ .map((variant) => {
197
+ const rows = elements
198
+ .map(([, tag, props, children]) => {
199
+ return `<${tag}${props} ${args.outerEnum}="${variant}">${children}</${tag}>`;
200
+ })
201
+ .join("\n ");
202
+
203
+ return ` <${containerTag}>\n ${rows}\n </${containerTag}>`;
204
+ })
205
+ .join("\n");
206
+
207
+ return template.replace(loopRegex, newRows);
208
+ }
209
+
210
+ function expandVueLoopFromTemplate(template, args, argTypes) {
211
+ return template.replace(
212
+ // eslint-disable-next-line vue/max-len
213
+ /<(\w+)([^>]*)\s+v-for="option\s+in\s+argTypes\?\.\[args\.enum]\?\.options"([^>]*?)>([\s\S]*?)<\/\1\s*>|<(\w+)([^>]*)\s+v-for="option\s+in\s+argTypes\?\.\[args\.enum]\?\.options"([^>]*)\/?>/g,
214
+ (
215
+ match,
216
+ name1,
217
+ pre1,
218
+ post1,
219
+ content, // For full component
220
+ name2,
221
+ pre2,
222
+ post2, // For self-closing component
223
+ ) => {
224
+ const componentName = name1 || name2;
225
+ const beforeAttrs = pre1 || pre2 || "";
226
+ const afterAttrs = post1 || post2 || "";
227
+ const slotContent = content || "";
228
+
229
+ const restProps = (beforeAttrs + " " + afterAttrs)
230
+ .replace(/\n/g, " ") // remove newlines
231
+ .replace(/\//g, "") // remove forward slashes
232
+ .replace(/\sv-bind="[^"]*"/g, ' v-bind="args"') // replace v-bind with args
233
+ .replace(/\s:key="[^"]*"/g, "") // remove :key
234
+ .replace(/\sv-model="[^"]*"/g, "") // remove v-model
235
+ .replace(/\s+/g, " ") // collapse multiple spaces
236
+ .trim();
237
+
238
+ return (
239
+ argTypes?.[args.enum]?.options
240
+ ?.map(
241
+ (option) =>
242
+ // eslint-disable-next-line vue/max-len
243
+ `<${componentName} ${generateEnumAttributes(args, option)} ${restProps}>${slotContent}</${componentName}>`,
244
+ )
245
+ ?.join("\n") || ""
246
+ );
247
+ },
248
+ );
249
+ }
250
+
251
+ function generateEnumAttributes(args, option) {
252
+ const enumKeys = Object.entries(args)
253
+ .filter(([, value]) => JSON.stringify(value)?.includes("{enumValue}"))
254
+ .map(([key]) => key);
255
+
256
+ if (args.enum) {
257
+ enumKeys.unshift(args.enum);
258
+ }
259
+
260
+ return enumKeys
261
+ .map((key) => {
262
+ const isNotPrimitive =
263
+ Object.keys(args[key] || {}).length || (Array.isArray(args[key]) && args[key].length);
264
+
265
+ return key in args && isNotPrimitive
266
+ ? `${key}="${JSON.stringify(args[key]).replaceAll('"', "'").replaceAll("{enumValue}", option)}"`
267
+ : `${key}="${option}"`;
268
+ })
269
+ .join(" ");
128
270
  }
129
271
 
130
- function propToSource(key, val) {
272
+ function propToSource(key, val, argType) {
273
+ const defaultValue = argType.table?.defaultValue?.summary;
131
274
  const type = typeof val;
132
275
 
133
276
  switch (type) {
134
277
  case "boolean":
135
- return val ? key : "";
278
+ return val || defaultValue === "false" ? key : `:${key}="${val}"`;
136
279
  case "string":
137
280
  return `${key}="${val}"`;
138
281
  case "object":
@@ -6,35 +6,57 @@
6
6
  /* -------------------- General -------------------- */
7
7
 
8
8
  ::-webkit-scrollbar {
9
- @apply w-3 h-3;
9
+ width: 0.75rem; /* w-3 */
10
+ height: 0.75rem; /* h-3 */
10
11
  }
11
12
 
12
13
  ::-webkit-scrollbar-track {
13
- @apply transition;
14
+ transition: all 0.2s; /* transition */
14
15
  }
15
16
 
16
17
  ::-webkit-scrollbar-thumb {
17
- @apply rounded-xs transition;
18
+ border-radius: 0.125rem; /* rounded-xs */
19
+ transition: all 0.2s; /* transition */
18
20
  }
19
21
 
20
22
  .light::-webkit-scrollbar-track,
21
23
  .light ::-webkit-scrollbar-track {
22
- @apply bg-gray-50 hover:bg-gray-200;
24
+ background-color: #f9fafb; /* bg-gray-50 */
25
+ }
26
+
27
+ .light::-webkit-scrollbar-track:hover,
28
+ .light ::-webkit-scrollbar-track:hover {
29
+ background-color: #e5e7eb; /* hover:bg-gray-200 */
23
30
  }
24
31
 
25
32
  .light::-webkit-scrollbar-thumb,
26
33
  .light ::-webkit-scrollbar-thumb {
27
- @apply bg-gray-400 hover:bg-gray-500;
34
+ background-color: #9ca3af; /* bg-gray-400 */
35
+ }
36
+
37
+ .light::-webkit-scrollbar-thumb:hover,
38
+ .light ::-webkit-scrollbar-thumb:hover {
39
+ background-color: #6b7280; /* hover:bg-gray-500 */
28
40
  }
29
41
 
30
- .dark::-webkit-scrollbar-track,
31
- .dark ::-webkit-scrollbar-track {
32
- @apply bg-gray-950 hover:bg-gray-800;
42
+ .dark::-webkit-scrollbar-track,
43
+ .dark ::-webkit-scrollbar-track {
44
+ background-color: #030712; /* bg-gray-950 */
45
+ }
46
+
47
+ .dark::-webkit-scrollbar-track:hover,
48
+ .dark ::-webkit-scrollbar-track:hover {
49
+ background-color: #1f2937; /* hover:bg-gray-800 */
33
50
  }
34
51
 
35
52
  .dark::-webkit-scrollbar-thumb,
36
- .dark ::-webkit-scrollbar-thumb {
37
- @apply bg-gray-600 hover:bg-gray-500;
53
+ .dark ::-webkit-scrollbar-thumb {
54
+ background-color: #4b5563; /* bg-gray-600 */
55
+ }
56
+
57
+ .dark::-webkit-scrollbar-thumb:hover,
58
+ .dark ::-webkit-scrollbar-thumb:hover {
59
+ background-color: #6b7280; /* hover:bg-gray-500 */
38
60
  }
39
61
 
40
62
  @supports (-moz-appearance: none) {
@@ -50,15 +72,15 @@
50
72
  }
51
73
 
52
74
  html.dark {
53
- @apply bg-gray-950;
75
+ background-color: #030712; /* bg-gray-950 */
54
76
  }
55
77
 
56
78
  html.light {
57
- @apply bg-gray-50;
79
+ background-color: #f9fafb; /* bg-gray-50 */
58
80
  }
59
81
 
60
82
  html.vl-dark #storybook-root {
61
- @apply bg-gray-900;
83
+ background-color: #111827; /* bg-gray-900 */
62
84
  }
63
85
 
64
86
  body {
@@ -74,7 +96,7 @@ body {
74
96
  .light .sbdocs .sbdocs-content > p,
75
97
  .light .sbdocs .sbdocs-content > table th,
76
98
  .light .sbdocs .sbdocs-content > table td {
77
- @apply !text-gray-900;
99
+ color: #111827 !important; /* !text-gray-900 */
78
100
  }
79
101
 
80
102
  .dark .sbdocs .sbdocs-content > h1,
@@ -82,160 +104,184 @@ body {
82
104
  .dark .sbdocs .sbdocs-content > h3,
83
105
  .dark .sbdocs .sbdocs-content > .sb-anchor > h3,
84
106
  .dark .sbdocs .sbdocs-content > .sb-anchor > p,
85
- .dark .sbdocs .sbdocs-content > :not(.sb-anchor) ul > li,
107
+ .dark .sbdocs .sbdocs-content > ul > li,
86
108
  .dark .sbdocs .sbdocs-content > p,
87
109
  .dark .sbdocs .sbdocs-content > table th,
88
110
  .dark .sbdocs .sbdocs-content > table td {
89
- @apply !text-gray-200;
111
+ color: #e5e7eb !important; /* !text-gray-200 */
90
112
  }
91
113
 
92
114
  .sbdocs .sbdocs-content > table tr {
93
- @apply border-none;
115
+ border-style: none; /* border-none */
94
116
  }
95
117
 
96
118
  .sbdocs .sbdocs-content > table th,
97
119
  .sbdocs .sbdocs-content > table td {
98
- @apply border-l-0 border-t-0 text-left;
120
+ border-left-width: 0; /* border-l-0 */
121
+ border-top-width: 0; /* border-t-0 */
122
+ text-align: left; /* text-left */
99
123
  }
100
124
 
101
125
  .sbdocs .sbdocs-content > table th:last-child,
102
126
  .sbdocs .sbdocs-content > table td:last-child {
103
- @apply border-r-0;
127
+ border-right-width: 0; /* border-r-0 */
104
128
  }
105
129
 
106
130
  .sbdocs .sbdocs-content > table tbody tr:last-child td {
107
- @apply border-b-0;
131
+ border-bottom-width: 0; /* border-b-0 */
108
132
  }
109
133
 
110
134
  .light .sbdocs .sbdocs-content > table th {
111
- @apply bg-gray-100 border-gray-200;
135
+ background-color: #f3f4f6; /* bg-gray-100 */
136
+ border-color: #e5e7eb; /* border-gray-200 */
112
137
  }
113
138
 
114
139
  .light .sbdocs .sbdocs-content > table td {
115
- @apply bg-white border-gray-200;
140
+ background-color: #ffffff; /* bg-white */
141
+ border-color: #e5e7eb; /* border-gray-200 */
116
142
  }
117
143
 
118
144
  .light .sbdocs .sbdocs-content > table {
119
- @apply rounded-lg outline outline-1 outline-gray-200 overflow-hidden;
145
+ border-radius: 0.5rem; /* rounded-lg */
146
+ outline: 1px solid #e5e7eb; /* outline-1 outline-gray-200 */
147
+ overflow: hidden; /* overflow-hidden */
120
148
  }
121
149
 
122
150
  .dark .sbdocs .sbdocs-content > table th {
123
- @apply bg-gray-800 border-gray-700;
151
+ background-color: #1f2937; /* bg-gray-800 */
152
+ border-color: #374151; /* border-gray-700 */
124
153
  }
125
154
 
126
155
  .dark .sbdocs .sbdocs-content > table td {
127
- @apply bg-gray-900 border-gray-700;
156
+ background-color: #111827; /* bg-gray-900 */
157
+ border-color: #374151; /* border-gray-700 */
128
158
  }
129
159
 
130
160
  .dark .sbdocs .sbdocs-content > table {
131
- @apply rounded-lg outline outline-1 outline-gray-700 overflow-hidden;
161
+ border-radius: 0.5rem; /* rounded-lg */
162
+ outline: 1px solid #374151; /* outline-1 outline-gray-700 */
163
+ overflow: hidden; /* overflow-hidden */
132
164
  }
133
165
 
134
166
  /* -------------------- Storybook preview skeleton -------------------- */
135
167
 
136
168
  .light .sb-preparing-docs,
137
169
  .light .sb-preparing-story {
138
- @apply bg-gray-50;
170
+ background-color: #f9fafb; /* bg-gray-50 */
139
171
  }
140
172
 
141
173
  .light .sb-previewBlock {
142
- @apply bg-white border-gray-200 rounded-lg;
174
+ background-color: #ffffff; /* bg-white */
175
+ border-color: #e5e7eb; /* border-gray-200 */
176
+ border-radius: 0.5rem; /* rounded-lg */
143
177
  box-shadow: none !important;
144
178
  }
145
179
 
146
180
  .light .sb-previewBlock_header {
147
- @apply border-solid border-b !border-b-gray-200;
181
+ border-style: solid; /* border-solid */
182
+ border-bottom-width: 1px; /* border-b */
183
+ border-bottom-color: #e5e7eb !important; /* !border-b-gray-200 */
148
184
  box-shadow: none !important;
149
185
  }
150
186
 
151
187
  .light .sb-previewBlock_icon {
152
- @apply bg-gray-300;
188
+ background-color: #d1d5db; /* bg-gray-300 */
153
189
  }
154
190
 
155
191
  .light .sb-argstableBlock-body {
156
- @apply rounded-sm;
192
+ border-radius: 0.125rem; /* rounded-sm */
157
193
  box-shadow: rgb(0 0 0 / 5%) 0 1px 3px 1px, rgb(0 0 0 / 4%) 0 0 0 1px;
158
194
  }
159
195
 
160
196
  .light .sb-argstableBlock-body td {
161
- @apply bg-white border-solid border-b !border-b-gray-200;
197
+ background-color: #ffffff; /* bg-white */
198
+ border-style: solid; /* border-solid */
199
+ border-bottom-width: 1px; /* border-b */
200
+ border-bottom-color: #e5e7eb !important; /* !border-b-gray-200 */
162
201
  }
163
202
 
164
203
  .light .sb-argstableBlock-body tr:last-child td {
165
- @apply border-b-0;
204
+ border-bottom-width: 0px; /* border-b-0 */
166
205
  }
167
206
 
168
207
  .light .sb-argstableBlock span,
169
208
  .light .sb-argstableBlock button {
170
- @apply bg-gray-200;
209
+ background-color: #e5e7eb; /* bg-gray-200 */
171
210
  }
172
211
 
173
212
  .dark .sb-preparing-docs,
174
213
  .dark .sb-preparing-story {
175
- @apply bg-gray-950;
214
+ background-color: #030712; /* bg-gray-950 */
176
215
  }
177
216
 
178
217
  .dark .sb-previewBlock {
179
- @apply bg-gray-900 border-gray-800 rounded-lg;
218
+ background-color: #111827; /* bg-gray-900 */
219
+ border-color: #1f2937; /* border-gray-800 */
220
+ border-radius: 0.5rem; /* rounded-lg */
180
221
  box-shadow: none !important;
181
222
  }
182
223
 
183
224
  .dark .sb-previewBlock_header {
184
- @apply border-solid border-b !border-b-gray-800;
225
+ border-style: solid; /* border-solid */
226
+ border-bottom-width: 1px; /* border-b */
227
+ border-bottom-color: #1f2937 !important; /* !border-b-gray-800 */
185
228
  box-shadow: none !important;
186
229
  }
187
230
 
188
231
  .dark .sb-previewBlock_icon {
189
- @apply bg-gray-700;
232
+ background-color: #374151; /* bg-gray-700 */
190
233
  }
191
234
 
192
235
  .dark .sb-argstableBlock-body {
193
- @apply rounded-sm;
236
+ border-radius: 0.125rem; /* rounded-sm */
194
237
  box-shadow: rgb(255 255 255 / 10%) 0 1px 3px 1px, rgb(255 255 255 / 7%) 0 0 0 1px;
195
238
  }
196
239
 
197
240
  .dark .sb-argstableBlock-body td {
198
- @apply bg-gray-900 border-solid border-b !border-b-gray-800;
241
+ background-color: #111827; /* bg-gray-900 */
242
+ border-style: solid; /* border-solid */
243
+ border-bottom-width: 1px; /* border-b */
244
+ border-bottom-color: #1f2937 !important; /* !border-b-gray-800 */
199
245
  }
200
246
 
201
247
  .dark .sb-argstableBlock-body tr:last-child td {
202
- @apply border-b-0;
248
+ border-bottom-width: 0px; /* border-b-0 */
203
249
  }
204
250
 
205
251
  .dark .sb-argstableBlock span,
206
252
  .dark .sb-argstableBlock button {
207
- @apply bg-gray-700;
253
+ background-color: #374151; /* bg-gray-700 */
208
254
  }
209
255
 
210
256
  /* -------------------- All docs block -------------------- */
211
257
 
212
258
  .dark .sbdocs {
213
- @apply bg-gray-950;
259
+ background-color: #030712; /* bg-gray-950 */
214
260
  }
215
261
 
216
262
  /* -------------------- Main story -------------------- */
217
263
 
218
264
  .sb-anchor {
219
- @apply mt-2;
265
+ margin-top: 0.5rem; /* mt-2 */
220
266
  }
221
267
 
222
268
  .dark .sb-anchor > p > a {
223
- @apply text-green-400;
269
+ color: #4ade80; /* text-green-400 */
224
270
  }
225
271
 
226
272
  .light .sb-anchor > p > a {
227
- @apply text-green-600;
273
+ color: #16a34a; /* text-green-600 */
228
274
  }
229
275
 
230
276
  .sb-bar,
231
277
  .docs-story {
232
- @apply bg-white;
278
+ background-color: #ffffff; /* bg-white */
233
279
  }
234
280
 
235
281
  .vl-dark .sb-bar,
236
282
  .vl-dark .docs-story,
237
283
  .vl-dark .docs-story + div {
238
- @apply !bg-gray-900;
284
+ background-color: #111827 !important; /* !bg-gray-900 */
239
285
  }
240
286
 
241
287
  /* prevents showing scrollbar in buttons stories */
@@ -244,33 +290,36 @@ body {
244
290
  }
245
291
 
246
292
  .sb-bar {
247
- @apply border-0;
293
+ border-width: 0; /* border-0 */
248
294
  }
249
295
 
250
296
  .dark .sb-bar {
251
- @apply border-b border-gray-300;
297
+ border-bottom: 1px solid #d1d5db; /* border-b border-gray-300 */
252
298
  box-shadow: none !important;
253
299
  }
254
300
 
255
- .vl-dark .sb-bar {
256
- @apply border-b border-gray-800;
301
+ .vl-dark .sb-bar {
302
+ border-bottom: 1px solid #1f2937; /* border-b border-gray-800 */
257
303
  box-shadow: none !important;
258
304
  }
259
305
 
260
306
  .sbdocs.sbdocs-preview .prismjs {
261
- @apply border-t border-t-gray-700 bg-gray-800;
307
+ border-top: 1px solid #374151; /* border-t border-t-gray-700 */
308
+ background-color: #1f2937; /* bg-gray-800 */
262
309
  }
263
310
 
264
311
  .vl-dark .docblock-code-toggle {
265
- @apply bg-gray-800 border-gray-800 text-gray-400;
312
+ background-color: #1f2937; /* bg-gray-800 */
313
+ border-color: #1f2937; /* border-gray-800 */
314
+ color: #9ca3af; /* text-gray-400 */
266
315
  }
267
316
 
268
317
  .vl-light .docblock-code-toggle {
269
- @apply !border border-gray-300;
318
+ border: 1px solid #d1d5db !important; /* !border border-gray-300 */
270
319
  }
271
320
 
272
321
  .vl-dark .docblock-code-toggle {
273
- @apply !border border-gray-700;
322
+ border: 1px solid #374151 !important; /* !border border-gray-700 */
274
323
  }
275
324
 
276
325
  .docblock-code-toggle,
@@ -296,58 +345,67 @@ body {
296
345
 
297
346
  .dark .sbdocs.sbdocs-preview,
298
347
  .vl-dark .sbdocs.sbdocs-preview {
299
- @apply border-gray-800;
348
+ border-color: #1f2937; /* border-gray-800 */
300
349
  }
301
350
 
302
351
  /* -------------------- Args table -------------------- */
303
352
 
304
353
  @media screen and (max-width: 600px) {
305
354
  div:has(> .docblock-argstable) {
306
- @apply !mb-10 overflow-x-scroll;
355
+ margin-bottom: 2.5rem !important;
356
+ overflow-x: scroll;
307
357
  }
308
358
 
309
359
  .docblock-argstable {
310
- @apply !mb-0;
360
+ margin-bottom: 0 !important;
311
361
  }
312
362
  }
313
363
 
314
364
  .dark .docblock-argstable,
315
365
  .dark .docblock-argstable-head th {
316
- @apply !text-gray-200;
366
+ color: rgb(229, 231, 235) !important; /* text-gray-200 */
317
367
  }
318
368
 
319
369
  .docblock-argstable-body {
320
- @apply rounded-lg !filter-none;
370
+ border-radius: 0.5rem; /* rounded-lg */
371
+ filter: none !important;
321
372
  }
322
373
 
323
374
  .docblock-argstable-body tr td {
324
- @apply !rounded-none;
375
+ border-radius: 0 !important; /* !rounded-none */
325
376
  }
326
377
 
327
378
  .docblock-argstable-body tr:not([title]) > td {
328
- @apply !bg-white;
379
+ background-color: #fff !important; /* bg-white */
329
380
  }
330
381
 
331
382
  .dark .docblock-argstable-body tr > td {
332
- @apply border-b border-solid !bg-gray-900 border-s-0 border-e-0 !border-t-gray-800;
333
- border-block-end: none !important;
383
+ border-top: 1px solid rgb(31, 41, 55) !important;
384
+ border-bottom: 1px solid rgb(31, 41, 55) !important; /* border-b border-gray-800 */
385
+ background-color: rgb(17, 24, 39) !important; /* bg-gray-900 */
386
+ border-inline-start-style: solid;
387
+ border-inline-start-width: 0;
388
+ border-inline-end-style: solid;
389
+ border-inline-end-width: 0;
334
390
  }
335
391
 
336
392
  .dark .docblock-argstable-body tr > td:first-child,
337
393
  .dark .docblock-argstable-body tr > td:last-child {
338
- @apply !border-s-gray-800 !border-e-gray-800;
394
+ border-inline-start-color: rgb(31, 41, 55) !important; /* border-s-gray-800 */
395
+ border-inline-end-color: rgb(31, 41, 55) !important; /* border-s-gray-800 */
339
396
  }
340
397
 
341
398
  .dark .docblock-argstable-body {
342
- @apply border border-b-gray-800;
399
+ border-bottom: 1px solid rgb(31, 41, 55); /* border-b-gray-800 */
343
400
  }
344
401
 
345
402
  .dark .docblock-argstable-body tr[title] > td {
346
- @apply !bg-gray-800 !text-gray-400;
403
+ background-color: rgb(31, 41, 55) !important;
404
+ color: rgb(156, 163, 175) !important; /* text-gray-400 */
347
405
  }
348
406
 
349
407
  .dark .docblock-argstable-body tr[title] > td svg {
350
- @apply !text-gray-400;
408
+ color: rgb(156, 163, 175) !important; /* text-gray-400 */
351
409
  }
352
410
 
353
411
  .light .sbdocs .sbdocs-content code,
@@ -356,7 +414,9 @@ body {
356
414
  .light .docblock-argstable-body tr > td:nth-child(2) > div > div > span[class],
357
415
  .light .docblock-argstable-body tr > td:nth-child(3) > div > span[class],
358
416
  .light .docblock-argstable-body tr > td:nth-child(3) > span[class] {
359
- @apply bg-gray-100 border-gray-200 text-gray-800;
417
+ background-color: rgb(243, 244, 246); /* bg-gray-100 */
418
+ border-color: rgb(229, 231, 235); /* border-gray-200 */
419
+ color: rgb(31, 41, 55); /* text-gray-800 */
360
420
  }
361
421
 
362
422
  .dark .rejt-value-node:hover .rejt-value,
@@ -366,19 +426,21 @@ body {
366
426
  .dark .docblock-argstable-body tr > td:nth-child(2) > div > div > span[class],
367
427
  .dark .docblock-argstable-body tr > td:nth-child(3) > div > span[class],
368
428
  .dark .docblock-argstable-body tr > td:nth-child(3) > span[class] {
369
- @apply bg-gray-800 border-gray-700/50 text-gray-400;
429
+ background-color: rgb(31, 41, 55); /* bg-gray-800 */
430
+ border-color: rgba(55, 65, 81, 0.5); /* border-gray-700/50 */
431
+ color: rgb(156, 163, 175); /* text-gray-400 */
370
432
  border-radius: 4px !important;
371
-
372
433
  }
373
434
 
374
435
  .dark .sb-story code,
375
436
  .light .sb-story code {
376
- @apply !bg-inherit !text-inherit;
437
+ background-color: inherit !important;
438
+ color: inherit !important;
377
439
  border-radius: 4px !important;
378
440
  }
379
441
 
380
442
  .dark .docblock-argstable-body tr > td > div + div > span:not([class]) {
381
- @apply text-gray-400;
443
+ color: rgb(156, 163, 175); /* text-gray-400 */
382
444
  }
383
445
 
384
446
  .dark .docblock-argstable-body tr > td .rejt-edit-form,
@@ -386,17 +448,40 @@ body {
386
448
  .dark .docblock-argstable-body tr > td textarea,
387
449
  .dark .docblock-argstable-body tr > td select,
388
450
  .dark .docblock-argstable-body tr > td:nth-child(4) button {
389
- @apply text-gray-200 bg-gray-800 border border-solid border-gray-700/50 hover:border-gray-600 focus:border-gray-500 text-[13px];
451
+ color: rgb(229, 231, 235); /* text-gray-200 */
452
+ background-color: rgb(31, 41, 55); /* bg-gray-800 */
453
+ border: 1px solid rgba(55, 65, 81, 0.5); /* border-gray-700/50 */
454
+ font-size: 13px;
390
455
  box-shadow: none !important;
391
456
  color-scheme: dark;
392
457
  }
393
458
 
459
+ .dark .docblock-argstable-body tr > td .rejt-edit-form:hover,
460
+ .dark .docblock-argstable-body tr > td input:hover,
461
+ .dark .docblock-argstable-body tr > td textarea:hover,
462
+ .dark .docblock-argstable-body tr > td select:hover,
463
+ .dark .docblock-argstable-body tr > td:nth-child(4) button:hover {
464
+ border: 1px solid #4b5563; /* border-gray-600 */
465
+ }
466
+
467
+ .dark .docblock-argstable-body tr > td .rejt-edit-form:focus,
468
+ .dark .docblock-argstable-body tr > td input:focus,
469
+ .dark .docblock-argstable-body tr > td textarea:focus,
470
+ .dark .docblock-argstable-body tr > td select:focus,
471
+ .dark .docblock-argstable-body tr > td:nth-child(4) button:focus {
472
+ border: 1px solid rgb(107, 114, 128); /* border-gray-500 */
473
+ }
474
+
394
475
  .docblock-argstable-body tr > td .rejt-add-value-node button {
395
- @apply px-1.5 py-0.5 leading-none;
476
+ padding-left: 0.375rem; /* px-1.5 */
477
+ padding-right: 0.375rem;
478
+ padding-top: 0.125rem; /* py-0.5 */
479
+ padding-bottom: 0.125rem;
480
+ line-height: 1;
396
481
  }
397
482
 
398
483
  .light .docblock-argstable-body tr > td .rejt-add-value-node button[type="submit"] {
399
- @apply bg-white;
484
+ background-color: #fff;
400
485
  }
401
486
 
402
487
  .light .docblock-argstable-body tr > td .rejt-edit-form,
@@ -404,81 +489,118 @@ body {
404
489
  .light .docblock-argstable-body tr > td textarea,
405
490
  .light .docblock-argstable-body tr > td select,
406
491
  .light .docblock-argstable-body tr > td:nth-child(4) button {
407
- @apply text-gray-900 border border-solid border-gray-300 hover:border-gray-400 focus:border-gray-500 text-[13px];
492
+ color: rgb(17, 24, 39); /* text-gray-900 */
493
+ border: 1px solid rgb(209, 213, 219); /* border-gray-300 */
494
+ font-size: 13px;
408
495
  box-shadow: none !important;
409
496
  }
410
497
 
498
+ .light .docblock-argstable-body tr > td .rejt-edit-form:hover,
499
+ .light .docblock-argstable-body tr > td input:hover,
500
+ .light .docblock-argstable-body tr > td textarea:hover,
501
+ .light .docblock-argstable-body tr > td select:hover,
502
+ .light .docblock-argstable-body tr > td:nth-child(4) button:hover {
503
+ border: 1px solid rgb(156, 163, 175); /* border-gray-400 */
504
+ }
505
+
506
+ .light .docblock-argstable-body tr > td .rejt-edit-form:focus,
507
+ .light .docblock-argstable-body tr > td input:focus,
508
+ .light .docblock-argstable-body tr > td textarea:focus,
509
+ .light .docblock-argstable-body tr > td select:focus,
510
+ .light .docblock-argstable-body tr > td:nth-child(4) button:focus {
511
+ border: 1px solid rgb(107, 114, 128); /* border-gray-500 */
512
+ }
513
+
411
514
  .dark .docblock-argstable-body label[aria-disabled] {
412
- @apply bg-gray-800;
515
+ background-color: rgb(31, 41, 55); /* bg-gray-800 */
413
516
  }
414
517
 
415
518
  .dark .docblock-argstable-body label[aria-disabled] span {
416
- @apply text-gray-200;
519
+ color: rgb(229, 231, 235); /* text-gray-200 */
417
520
  }
418
521
 
419
522
  .dark .docblock-argstable-body [type='checkbox'],
420
523
  .dark .docblock-argstable-body [type='radio'] {
421
- @apply border border-solid !border-gray-700;
524
+ border: 1px solid rgb(55, 65, 81) !important; /* border-gray-700 */
422
525
  box-shadow: none !important;
423
526
  }
424
527
 
425
- .dark .docblock-argstable-body [type='checkbox']:checked,
426
- .dark .docblock-argstable-body [type='radio']:checked {
427
- @apply invert grayscale !border-gray-300;
428
- }
429
-
430
528
  .dark .docblock-argstable-body [type='radio']:checked {
431
- @apply bg-gray-900;
529
+ background-color: rgb(17, 24, 39); /* bg-gray-900 */
432
530
  }
433
531
 
434
532
  .light .docblock-argstable-body [type='radio']:checked {
435
- @apply !bg-gray-900;
533
+ background-color: rgb(17, 24, 39) !important; /* bg-gray-900 */
436
534
  }
437
535
 
438
536
  .docblock-argstable [type='checkbox']:focus,
439
537
  .docblock-argstable [type='radio']:focus {
440
- @apply !ring-gray-300;
538
+ outline-color: rgb(209, 213, 219) !important; /* ring-gray-300 */
441
539
  }
442
540
 
443
541
  .dark .rejt-name,
444
542
  .dark .rejt-collapsed-text {
445
- @apply !text-gray-400;
543
+ color: rgb(156, 163, 175) !important; /* text-gray-400 */
446
544
  }
447
545
 
448
546
  .dark .rejt-value {
449
- @apply !text-gray-200;
547
+ color: rgb(229, 231, 235) !important; /* text-gray-200 */
450
548
  }
451
549
 
452
550
  /* -------------------- Code block and user markdown -------------------- */
453
551
 
454
552
  #storybook-docs h2 {
455
- @apply mt-8 mb-6 pb-2 font-bold;
553
+ margin-top: 2rem; /* mt-8 */
554
+ margin-bottom: 1.5rem; /* mb-6 */
555
+ padding-bottom: 0.5rem; /* pb-2 */
556
+ font-weight: 700; /* font-bold */
456
557
  }
457
558
 
458
559
  .dark h2 {
459
- @apply border-b-gray-800;
560
+ border-bottom-color: rgb(31, 41, 55); /* border-b-gray-800 */
460
561
  }
461
562
 
462
563
  .docblock-source {
463
- @apply !bg-gray-800 border-gray-800;
564
+ background-color: rgb(31, 41, 55) !important; /* !bg-gray-800 */
565
+ border-color: rgb(31, 41, 55); /* border-gray-800 */
464
566
  box-shadow: none !important;
465
567
  border-radius: 8px !important;
466
568
  }
467
569
 
468
570
  .dark .docblock-source {
469
- @apply !bg-gray-900 !border-gray-800;
571
+ background-color: rgb(17, 24, 39) !important; /* !bg-gray-900 */
572
+ border-color: rgb(31, 41, 55) !important; /* !border-gray-800 */
470
573
  }
471
574
 
472
575
  .dark .docblock-source button {
473
- @apply bg-gray-800 border-gray-800 text-gray-400 rounded-tl-none;
576
+ background-color: rgb(31, 41, 55); /* bg-gray-800 */
577
+ border-color: rgb(31, 41, 55); /* border-gray-800 */
578
+ color: rgb(156, 163, 175); /* text-gray-400 */
579
+ border-top-left-radius: 0; /* rounded-tl-none */
580
+ }
581
+
582
+ .dark a.sbdocs.sbdocs-a {
583
+ color: #6b7280; /* text-gray-500 */
584
+ }
585
+
586
+ .light a.sbdocs.sbdocs-a {
587
+ color: #6b7280; /* text-gray-500 */
588
+ }
589
+
590
+ .light a.sbdocs.sbdocs-a:hover,
591
+ .dark a.sbdocs.sbdocs-a:hover{
592
+ text-decoration: underline dashed #6b7280; /* text-gray-500 */
593
+ text-underline-offset: 3px;
474
594
  }
475
595
 
476
596
  /* -------------------- Storybook story preview -------------------- */
477
597
 
478
598
  .vl-dark {
479
- @apply min-h-full bg-gray-900;
599
+ min-height: 100%; /* min-h-full */
600
+ background-color: rgb(17, 24, 39); /* bg-gray-900 */
480
601
  }
481
602
 
482
603
  .vl-light {
483
- @apply min-h-full bg-white;
604
+ min-height: 100%; /* min-h-full */
605
+ background-color: #ffffff; /* bg-white */
484
606
  }
@@ -1,12 +1,11 @@
1
1
  /** @type { import('@storybook/vue3-vite').StorybookConfig } */
2
2
  export default {
3
3
  stories: [
4
- "../node_modules/vueless/**/stories.@(js|jsx|ts|tsx)",
5
- "../node_modules/vueless/**/docs.@(mdx)",
4
+ "../node_modules/vueless/**/stories.{js,jsx,ts,tsx}",
5
+ "../node_modules/vueless/**/docs.mdx",
6
6
  /* Define a path to your own component stories. */
7
- // "../.vueless/**/stories.@(js|jsx|ts|tsx)",
8
- // "../.vueless/**/docs.@(mdx)",
9
- ],
7
+ // "../src/**/stories.{js,jsx,ts,tsx}",
8
+ // "../src/**/docs.mdx"],
10
9
  addons: [
11
10
  "@storybook/addon-links",
12
11
  "@storybook/addon-essentials",
@@ -121,8 +121,6 @@ Custom dark mode related vueless loader.
121
121
  background: #1f2937 !important;
122
122
  }
123
123
 
124
-
125
-
126
124
  .search-field,
127
125
  .search-result-item {
128
126
  border-radius: 8px !important;
@@ -137,12 +135,14 @@ Custom dark mode related vueless loader.
137
135
  .light .search-result-item svg[type="component"],
138
136
  .dark .search-result-item mark {
139
137
  color: #10b981;
138
+ font-weight: 600;
140
139
  }
141
140
 
142
141
  .dark .sidebar-item svg[type="component"],
143
142
  .dark .search-result-item svg[type="component"],
144
143
  .light .search-result-item mark {
145
144
  color: #059669;
145
+ font-weight: 600;
146
146
  }
147
147
 
148
148
  .light .sidebar-item svg[type="document"],
@@ -159,6 +159,14 @@ Custom dark mode related vueless loader.
159
159
  color: #4b5563;
160
160
  }
161
161
 
162
+ .light .search-result-item--label {
163
+ color: #6b7280; /* text-gray-600 */
164
+ }
165
+
166
+ .dark .search-result-item--label {
167
+ color: #a8abb0; /* text-gray-400 */
168
+ }
169
+
162
170
  #sidebar-bottom-wrapper {
163
171
  display: none;
164
172
  }
@@ -5,6 +5,7 @@ import { getRandomId } from "vueless";
5
5
  import themeLight from "./themes/themeLight.js";
6
6
  import themeDark from "./themes/themeDark.js";
7
7
  import themeLightDocs from "./themes/themeLightDocs.js";
8
+
8
9
  import { storyDarkModeDecorator } from "./decorators/storyDarkModeDecorator.js";
9
10
  import { vue3SourceDecorator } from "./decorators/vue3SourceDecorator.js";
10
11
 
@@ -58,7 +59,7 @@ export const parameters = {
58
59
  },
59
60
  };
60
61
 
61
- /* Reload the page on error "Failed to fetch dynamically imported module..." */
62
+ /* Reload the page on the error "Failed to fetch dynamically imported module..." */
62
63
  window.addEventListener("error", (ev) => onFailedToFetchModule(ev.message));
63
64
  window.addEventListener("unhandledrejection", (ev) => onFailedToFetchModule(ev?.reason?.message));
64
65
 
@@ -3,9 +3,10 @@ import { defineConfig } from "vite";
3
3
  // Plugins
4
4
  import Vue from "@vitejs/plugin-vue";
5
5
  import { Vueless, TailwindCSS } from "vueless/plugin-vite";
6
+ import { STORYBOOK_ENV } from "vueless/constants.js";
6
7
 
7
8
  export default defineConfig({
8
- plugins: [Vue(), TailwindCSS(), Vueless({ mode: "storybook", debug: false })],
9
+ plugins: [Vue(), TailwindCSS(), Vueless({ env: STORYBOOK_ENV, debug: false })],
9
10
  optimizeDeps: {
10
11
  include: [
11
12
  "cva",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vueless/storybook",
3
- "version": "0.0.75-beta.6",
3
+ "version": "0.0.75-beta.8",
4
4
  "description": "Simplifies Storybook configuration for Vueless UI library.",
5
5
  "homepage": "https://vueless.com",
6
6
  "author": "Johnny Grid",