storybook-addon-sdc 0.2.6 → 0.2.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.
- package/dist/exBuilderSchema.yml +225 -0
- package/dist/preset.js +92 -88
- package/package.json +2 -1
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
json-schema-definitions://experience_builder.module/textarea:
|
|
2
|
+
title: 'Multi-line string'
|
|
3
|
+
type: 'string'
|
|
4
|
+
json-schema-definitions://experience_builder.module/heading-element:
|
|
5
|
+
title: 'Heading element'
|
|
6
|
+
type: 'string'
|
|
7
|
+
enum:
|
|
8
|
+
- 'div'
|
|
9
|
+
- 'h1'
|
|
10
|
+
- 'h2'
|
|
11
|
+
- 'h3'
|
|
12
|
+
- 'h4'
|
|
13
|
+
- 'h5'
|
|
14
|
+
- 'h6'
|
|
15
|
+
json-schema-definitions://experience_builder.module/column-width:
|
|
16
|
+
title: 'Column Width'
|
|
17
|
+
type: 'integer'
|
|
18
|
+
enum:
|
|
19
|
+
- '25'
|
|
20
|
+
- '33'
|
|
21
|
+
- '50'
|
|
22
|
+
- '66'
|
|
23
|
+
- '75'
|
|
24
|
+
json-schema-definitions://experience_builder.module/background-color:
|
|
25
|
+
title: 'Background Color'
|
|
26
|
+
type: 'string'
|
|
27
|
+
enum:
|
|
28
|
+
- ''
|
|
29
|
+
- 'primary'
|
|
30
|
+
- 'secondary'
|
|
31
|
+
- 'white'
|
|
32
|
+
json-schema-definitions://experience_builder.module/date-range:
|
|
33
|
+
title: 'date range'
|
|
34
|
+
type: 'object'
|
|
35
|
+
required:
|
|
36
|
+
- 'from'
|
|
37
|
+
- 'to'
|
|
38
|
+
properties:
|
|
39
|
+
from:
|
|
40
|
+
title: 'Start date'
|
|
41
|
+
type: 'string'
|
|
42
|
+
format: 'date'
|
|
43
|
+
to:
|
|
44
|
+
title: 'End date'
|
|
45
|
+
type: 'string'
|
|
46
|
+
format: 'date'
|
|
47
|
+
json-schema-definitions://experience_builder.module/stream-wrapper-uri:
|
|
48
|
+
title: 'Stream wrapper URI'
|
|
49
|
+
type: 'string'
|
|
50
|
+
format: 'uri'
|
|
51
|
+
json-schema-definitions://experience_builder.module/stream-wrapper-image-uri:
|
|
52
|
+
title: 'Stream wrapper image URI'
|
|
53
|
+
type: 'string'
|
|
54
|
+
format: 'uri'
|
|
55
|
+
json-schema-definitions://experience_builder.module/image-uri:
|
|
56
|
+
title: 'Image URL'
|
|
57
|
+
type: 'string'
|
|
58
|
+
format: 'uri-reference'
|
|
59
|
+
json-schema-definitions://experience_builder.module/heading:
|
|
60
|
+
title: 'Heading'
|
|
61
|
+
type: 'object'
|
|
62
|
+
required:
|
|
63
|
+
- 'text'
|
|
64
|
+
- 'element'
|
|
65
|
+
properties:
|
|
66
|
+
text:
|
|
67
|
+
type: 'string'
|
|
68
|
+
title: 'Text'
|
|
69
|
+
description: 'The heading text.'
|
|
70
|
+
examples:
|
|
71
|
+
- 'A heading element'
|
|
72
|
+
style:
|
|
73
|
+
type: 'string'
|
|
74
|
+
title: 'Style'
|
|
75
|
+
description: 'The heading style to use.'
|
|
76
|
+
enum:
|
|
77
|
+
- 'primary'
|
|
78
|
+
- 'secondary'
|
|
79
|
+
examples:
|
|
80
|
+
- 'primary'
|
|
81
|
+
- 'secondary'
|
|
82
|
+
element:
|
|
83
|
+
type: 'string'
|
|
84
|
+
title: 'Element'
|
|
85
|
+
description: 'The HTML element to use.'
|
|
86
|
+
enum:
|
|
87
|
+
- 'div'
|
|
88
|
+
- 'h1'
|
|
89
|
+
- 'h2'
|
|
90
|
+
- 'h3'
|
|
91
|
+
- 'h4'
|
|
92
|
+
- 'h5'
|
|
93
|
+
- 'h6'
|
|
94
|
+
examples:
|
|
95
|
+
- 'h1'
|
|
96
|
+
- 'h2'
|
|
97
|
+
- 'h3'
|
|
98
|
+
- 'h4'
|
|
99
|
+
- 'h5'
|
|
100
|
+
- 'h6'
|
|
101
|
+
- 'div'
|
|
102
|
+
json-schema-definitions://experience_builder.module/text:
|
|
103
|
+
title: 'Text'
|
|
104
|
+
type: 'object'
|
|
105
|
+
properties:
|
|
106
|
+
text:
|
|
107
|
+
type: 'string'
|
|
108
|
+
title: 'Text'
|
|
109
|
+
description: 'The text to display.'
|
|
110
|
+
examples:
|
|
111
|
+
- 'This is some text'
|
|
112
|
+
json-schema-definitions://experience_builder.module/shoe-icon:
|
|
113
|
+
title: 'Icon'
|
|
114
|
+
type: 'object'
|
|
115
|
+
properties:
|
|
116
|
+
name:
|
|
117
|
+
type: 'string'
|
|
118
|
+
title: 'Name'
|
|
119
|
+
description: 'The badge’s theme variant.'
|
|
120
|
+
default: 'primary'
|
|
121
|
+
enum:
|
|
122
|
+
- 'moon-stars-fill'
|
|
123
|
+
- 'moon-stars'
|
|
124
|
+
- 'star-fill'
|
|
125
|
+
- 'star'
|
|
126
|
+
- 'stars'
|
|
127
|
+
- 'rocket-fill'
|
|
128
|
+
- 'rocket-takeoff-fill'
|
|
129
|
+
- 'rocket-takeoff'
|
|
130
|
+
- 'rocket'
|
|
131
|
+
examples:
|
|
132
|
+
- 'moon-stars-fill'
|
|
133
|
+
- 'moon-stars'
|
|
134
|
+
- 'star-fill'
|
|
135
|
+
- 'star'
|
|
136
|
+
- 'stars'
|
|
137
|
+
- 'rocket-fill'
|
|
138
|
+
- 'rocket-takeoff-fill'
|
|
139
|
+
- 'rocket-takeoff'
|
|
140
|
+
- 'rocket'
|
|
141
|
+
label:
|
|
142
|
+
type: 'string'
|
|
143
|
+
title: 'Label'
|
|
144
|
+
description: 'An alternate description to use for assistive devices. If omitted, the icon will be considered presentational and ignored by assistive devices.'
|
|
145
|
+
default: 'This is an icon'
|
|
146
|
+
examples:
|
|
147
|
+
- 'This is an icon'
|
|
148
|
+
size:
|
|
149
|
+
type: 'string'
|
|
150
|
+
title: 'Size'
|
|
151
|
+
description: 'The icon size.'
|
|
152
|
+
default: ''
|
|
153
|
+
enum:
|
|
154
|
+
- ''
|
|
155
|
+
- 'base'
|
|
156
|
+
- 'l'
|
|
157
|
+
- 's'
|
|
158
|
+
- 'xs'
|
|
159
|
+
- 'xxs'
|
|
160
|
+
examples:
|
|
161
|
+
- ''
|
|
162
|
+
- 'base'
|
|
163
|
+
- 'l'
|
|
164
|
+
- 's'
|
|
165
|
+
- 'xs'
|
|
166
|
+
- 'xxs'
|
|
167
|
+
color:
|
|
168
|
+
type: 'string'
|
|
169
|
+
title: 'Color'
|
|
170
|
+
description: 'The icon color'
|
|
171
|
+
default: ''
|
|
172
|
+
enum:
|
|
173
|
+
- ''
|
|
174
|
+
- 'gray'
|
|
175
|
+
- 'primary'
|
|
176
|
+
- 'neutral-soft'
|
|
177
|
+
- 'neutral-medium'
|
|
178
|
+
- 'neutral-loud'
|
|
179
|
+
- 'primary-medium'
|
|
180
|
+
- 'primary-loud'
|
|
181
|
+
- 'black'
|
|
182
|
+
- 'white'
|
|
183
|
+
- 'red'
|
|
184
|
+
- 'gold'
|
|
185
|
+
- 'green'
|
|
186
|
+
examples:
|
|
187
|
+
- ''
|
|
188
|
+
- 'gray'
|
|
189
|
+
- 'primary'
|
|
190
|
+
- 'neutral-soft'
|
|
191
|
+
- 'neutral-medium'
|
|
192
|
+
- 'neutral-loud'
|
|
193
|
+
- 'primary-medium'
|
|
194
|
+
- 'primary-loud'
|
|
195
|
+
- 'black'
|
|
196
|
+
- 'white'
|
|
197
|
+
- 'red'
|
|
198
|
+
- 'gold'
|
|
199
|
+
- 'green'
|
|
200
|
+
slot:
|
|
201
|
+
type: 'string'
|
|
202
|
+
title: 'Slot'
|
|
203
|
+
description: 'The slot the icon should appear in'
|
|
204
|
+
examples:
|
|
205
|
+
json-schema-definitions://experience_builder.module/image:
|
|
206
|
+
title: 'image'
|
|
207
|
+
type: 'object'
|
|
208
|
+
required:
|
|
209
|
+
- 'src'
|
|
210
|
+
properties:
|
|
211
|
+
src:
|
|
212
|
+
title: 'Image URL'
|
|
213
|
+
$ref: json-schema-definitions://experience_builder.module/image-uri
|
|
214
|
+
alt:
|
|
215
|
+
title: 'Alternative text'
|
|
216
|
+
type: 'string'
|
|
217
|
+
width:
|
|
218
|
+
title: 'Image width'
|
|
219
|
+
type: 'integer'
|
|
220
|
+
height:
|
|
221
|
+
title: 'Image height'
|
|
222
|
+
type: 'integer'
|
|
223
|
+
json-schema-definitions://experience_builder.module/config-entity-id:
|
|
224
|
+
title: 'config entity id'
|
|
225
|
+
type: 'string'
|
package/dist/preset.js
CHANGED
|
@@ -5484,25 +5484,27 @@ init_esm_shims();
|
|
|
5484
5484
|
// src/vite-plugin-storybook-yaml-stories.ts
|
|
5485
5485
|
init_esm_shims();
|
|
5486
5486
|
var import_yaml2 = __toESM(require_yaml(), 1);
|
|
5487
|
-
import { readdirSync, readFileSync as readFileSync2, existsSync } from "fs";
|
|
5488
|
-
import { dirname as dirname2, extname, resolve as resolve2
|
|
5487
|
+
import { readdirSync, readFileSync as readFileSync2, existsSync as existsSync2 } from "fs";
|
|
5488
|
+
import { dirname as dirname2, extname, join, resolve as resolve2 } from "path";
|
|
5489
5489
|
|
|
5490
5490
|
// src/argsGenerator.ts
|
|
5491
5491
|
init_esm_shims();
|
|
5492
5492
|
import { JSONSchemaFaker } from "json-schema-faker";
|
|
5493
5493
|
var generateArgs = (schema, defs) => {
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5494
|
+
return Object.entries(schema).reduce((acc, [key, property]) => {
|
|
5495
|
+
acc[key] = JSONSchemaFaker.generate(property, defs);
|
|
5496
|
+
return acc;
|
|
5497
|
+
}, {});
|
|
5498
|
+
};
|
|
5499
|
+
var slotsToSchemaProperties = (slots) => {
|
|
5500
|
+
return Object.fromEntries(
|
|
5501
|
+
Object.entries(slots).map(([key, value]) => [
|
|
5502
|
+
key,
|
|
5503
|
+
{ type: "string", ...value }
|
|
5504
|
+
])
|
|
5505
|
+
);
|
|
5500
5506
|
};
|
|
5501
|
-
|
|
5502
|
-
acc[key] = { type: "string", ...value };
|
|
5503
|
-
return acc;
|
|
5504
|
-
}, {});
|
|
5505
|
-
var argsGenerator_default = (content, jsonSchemaFakerOptions) => {
|
|
5507
|
+
function generateStorybookArgs(content, jsonSchemaFakerOptions) {
|
|
5506
5508
|
JSONSchemaFaker.option({
|
|
5507
5509
|
ignoreMissingRefs: true,
|
|
5508
5510
|
failOnInvalidTypes: false,
|
|
@@ -5510,12 +5512,13 @@ var argsGenerator_default = (content, jsonSchemaFakerOptions) => {
|
|
|
5510
5512
|
useDefaultValue: true,
|
|
5511
5513
|
...jsonSchemaFakerOptions
|
|
5512
5514
|
});
|
|
5515
|
+
const { props, slots, $defs } = content;
|
|
5513
5516
|
const generatedArgs = {
|
|
5514
|
-
...
|
|
5515
|
-
...
|
|
5517
|
+
...props?.properties && generateArgs(props.properties, $defs),
|
|
5518
|
+
...slots && generateArgs(slotsToSchemaProperties(slots), $defs)
|
|
5516
5519
|
};
|
|
5517
5520
|
return generatedArgs;
|
|
5518
|
-
}
|
|
5521
|
+
}
|
|
5519
5522
|
|
|
5520
5523
|
// src/argTypesGenerator.ts
|
|
5521
5524
|
init_esm_shims();
|
|
@@ -5536,56 +5539,63 @@ var argTypesGenerator_default = (content) => {
|
|
|
5536
5539
|
|
|
5537
5540
|
// src/storiesGenerator.ts
|
|
5538
5541
|
init_esm_shims();
|
|
5539
|
-
var storiesGenerator_default = (stories) =>
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
},
|
|
5551
|
-
};
|
|
5552
|
-
`
|
|
5553
|
-
).join("\n");
|
|
5542
|
+
var storiesGenerator_default = (stories) => Object.entries(stories).map(
|
|
5543
|
+
([storyKey, { props = {}, slots = {} }]) => `
|
|
5544
|
+
export const ${storyKey} = {
|
|
5545
|
+
args: {
|
|
5546
|
+
...Basic.args,
|
|
5547
|
+
${generateArgs2(props)}
|
|
5548
|
+
${generateArgs2(slots, true)}
|
|
5549
|
+
},
|
|
5550
|
+
play: async ({ canvasElement }) => {
|
|
5551
|
+
Drupal.attachBehaviors(canvasElement, window.drupalSettings);
|
|
5552
|
+
},
|
|
5554
5553
|
};
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
)
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
return `${argString},`;
|
|
5567
|
-
}).join("\n");
|
|
5554
|
+
`
|
|
5555
|
+
).join("\n");
|
|
5556
|
+
var generateArgs2 = (args, isSlot = false) => Object.entries(args).map(([key, value]) => `${key}: ${formatArgValue(value, isSlot)},`).join("\n");
|
|
5557
|
+
var formatArgValue = (value, isSlot) => {
|
|
5558
|
+
if (Array.isArray(value)) {
|
|
5559
|
+
const arrayContent = value.map(
|
|
5560
|
+
(item) => item?.type === "component" ? generateComponent(item) : JSON.stringify(item)
|
|
5561
|
+
).join(isSlot ? " + " : ", ");
|
|
5562
|
+
return `[${arrayContent}]`;
|
|
5563
|
+
}
|
|
5564
|
+
return JSON.stringify(value);
|
|
5568
5565
|
};
|
|
5569
5566
|
var generateComponent = (item) => {
|
|
5570
|
-
const componentName = item.component.split(":").pop();
|
|
5567
|
+
const componentName = item.component.split(":").pop() ?? "unknown";
|
|
5571
5568
|
const kebabCaseName = componentName.replace(/-/g, "");
|
|
5572
|
-
const componentProps = {
|
|
5573
|
-
...item.props,
|
|
5574
|
-
...item.slots
|
|
5575
|
-
};
|
|
5569
|
+
const componentProps = { ...item.props, ...item.slots };
|
|
5576
5570
|
return `${kebabCaseName}.component(${JSON.stringify(componentProps)})`;
|
|
5577
5571
|
};
|
|
5578
5572
|
|
|
5579
5573
|
// src/customRefsTransform.ts
|
|
5580
5574
|
init_esm_shims();
|
|
5581
5575
|
var import_yaml = __toESM(require_yaml(), 1);
|
|
5582
|
-
import { readFileSync } from "node:fs";
|
|
5576
|
+
import { readFileSync, existsSync } from "node:fs";
|
|
5583
5577
|
import { resolve } from "node:path";
|
|
5584
|
-
var
|
|
5585
|
-
|
|
5586
|
-
)
|
|
5578
|
+
var loadYamlFile = (filePath) => {
|
|
5579
|
+
const resolvedPath = resolve(__dirname, filePath);
|
|
5580
|
+
if (!existsSync(resolvedPath)) {
|
|
5581
|
+
throw new Error(`File not found: ${resolvedPath}`);
|
|
5582
|
+
}
|
|
5583
|
+
return (0, import_yaml.parse)(readFileSync(resolvedPath, "utf8"));
|
|
5584
|
+
};
|
|
5585
|
+
var uiPatternsSchema = loadYamlFile("../drupal-defs/uiPatternsSchema.yml");
|
|
5586
|
+
var additionalSchema = loadYamlFile("../drupal-defs/exBuilderSchema.yml");
|
|
5587
|
+
var customDefs = {
|
|
5588
|
+
...uiPatternsSchema,
|
|
5589
|
+
...additionalSchema
|
|
5590
|
+
};
|
|
5587
5591
|
var customRefsTransform_default = (schema) => {
|
|
5588
|
-
return {
|
|
5592
|
+
return {
|
|
5593
|
+
...schema,
|
|
5594
|
+
$defs: {
|
|
5595
|
+
...customDefs,
|
|
5596
|
+
...schema.$defs
|
|
5597
|
+
}
|
|
5598
|
+
};
|
|
5589
5599
|
};
|
|
5590
5600
|
|
|
5591
5601
|
// src/componentMetadata.ts
|
|
@@ -5602,52 +5612,46 @@ var componentMetadata_default = (id, content) => {
|
|
|
5602
5612
|
};
|
|
5603
5613
|
|
|
5604
5614
|
// src/vite-plugin-storybook-yaml-stories.ts
|
|
5605
|
-
var readCDC = (
|
|
5606
|
-
var getSubdirectories = (baseDir) => readdirSync(baseDir, { withFileTypes: true }).filter((
|
|
5615
|
+
var readCDC = (filePath) => customRefsTransform_default((0, import_yaml2.parse)(readFileSync2(filePath, "utf8")));
|
|
5616
|
+
var getSubdirectories = (baseDir) => readdirSync(baseDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join(baseDir, entry.name));
|
|
5607
5617
|
var resolveComponentPath = (namespace, component) => {
|
|
5608
|
-
const
|
|
5609
|
-
const directories = [
|
|
5618
|
+
const baseDir = resolve2("./components");
|
|
5619
|
+
const directories = [baseDir, ...getSubdirectories(baseDir)];
|
|
5610
5620
|
const possiblePaths = directories.map(
|
|
5611
5621
|
(dir) => join(dir, component, `${component}.component.yml`)
|
|
5612
5622
|
);
|
|
5613
|
-
return possiblePaths.find(
|
|
5623
|
+
return possiblePaths.find(existsSync2);
|
|
5614
5624
|
};
|
|
5615
|
-
var generateImports = (directory) => readdirSync(directory).
|
|
5616
|
-
|
|
5625
|
+
var generateImports = (directory) => readdirSync(directory).filter(
|
|
5626
|
+
(asset) => [".css", ".js", ".mjs", ".twig"].includes(extname(asset))
|
|
5627
|
+
).map((asset) => {
|
|
5617
5628
|
const assetPath = `./${asset}`;
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
`;
|
|
5621
|
-
} else if (extension === ".twig") {
|
|
5622
|
-
return `${imports}import COMPONENT from '${assetPath}';
|
|
5623
|
-
`;
|
|
5624
|
-
}
|
|
5625
|
-
return imports;
|
|
5626
|
-
}, "");
|
|
5629
|
+
return extname(asset) === ".twig" ? `import COMPONENT from '${assetPath}';` : `import '${assetPath}';`;
|
|
5630
|
+
}).join("\n");
|
|
5627
5631
|
var dynamicImports = (stories) => {
|
|
5628
5632
|
const imports = /* @__PURE__ */ new Set();
|
|
5629
5633
|
const findComponentArgs = (args) => {
|
|
5630
|
-
|
|
5631
|
-
const value = args[key];
|
|
5634
|
+
Object.values(args).forEach((value) => {
|
|
5632
5635
|
if (Array.isArray(value)) {
|
|
5633
5636
|
value.forEach((item) => {
|
|
5634
5637
|
if (item.type === "component") {
|
|
5635
5638
|
const [namespace, componentName] = item.component.split(":");
|
|
5636
5639
|
const resolvedPath = resolveComponentPath(namespace, componentName);
|
|
5637
5640
|
if (resolvedPath) {
|
|
5638
|
-
|
|
5639
|
-
|
|
5641
|
+
imports.add(
|
|
5642
|
+
`import ${componentName.replace(/-/g, "")} from '${resolvedPath}';`
|
|
5643
|
+
);
|
|
5640
5644
|
}
|
|
5641
5645
|
}
|
|
5642
5646
|
});
|
|
5643
|
-
} else if (typeof value === "object"
|
|
5647
|
+
} else if (value && typeof value === "object") {
|
|
5644
5648
|
findComponentArgs(value);
|
|
5645
5649
|
}
|
|
5646
|
-
}
|
|
5650
|
+
});
|
|
5647
5651
|
};
|
|
5648
|
-
Object.values(stories).forEach(
|
|
5649
|
-
findComponentArgs({ ...slots, ...props })
|
|
5650
|
-
|
|
5652
|
+
Object.values(stories).forEach(
|
|
5653
|
+
({ slots = {}, props = {} }) => findComponentArgs({ ...slots, ...props })
|
|
5654
|
+
);
|
|
5651
5655
|
return Array.from(imports).join("\n");
|
|
5652
5656
|
};
|
|
5653
5657
|
var vite_plugin_storybook_yaml_stories_default = ({ jsonSchemaFakerOptions = {} }) => ({
|
|
@@ -5659,19 +5663,16 @@ var vite_plugin_storybook_yaml_stories_default = ({ jsonSchemaFakerOptions = {}
|
|
|
5659
5663
|
const storiesImports = dynamicImports(
|
|
5660
5664
|
content.thirdPartySettings?.sdcStorybook?.stories || {}
|
|
5661
5665
|
);
|
|
5666
|
+
const metadata = componentMetadata_default(id, content);
|
|
5662
5667
|
const argTypes = {
|
|
5663
5668
|
componentMetadata: { table: { disable: true } },
|
|
5664
5669
|
...argTypesGenerator_default(content)
|
|
5665
5670
|
};
|
|
5666
|
-
const metadata = componentMetadata_default(id, content);
|
|
5667
5671
|
const args = {
|
|
5668
5672
|
componentMetadata: metadata,
|
|
5669
|
-
...
|
|
5670
|
-
};
|
|
5671
|
-
const basicArgs = {
|
|
5672
|
-
componentMetadata: metadata,
|
|
5673
|
-
...argsGenerator_default(content, jsonSchemaFakerOptions)
|
|
5673
|
+
...generateStorybookArgs(content, jsonSchemaFakerOptions)
|
|
5674
5674
|
};
|
|
5675
|
+
const basicArgs = { ...args };
|
|
5675
5676
|
const stories = content.thirdPartySettings?.sdcStorybook?.stories ? storiesGenerator_default(content.thirdPartySettings.sdcStorybook.stories) : "";
|
|
5676
5677
|
return `
|
|
5677
5678
|
${imports}
|
|
@@ -5726,7 +5727,7 @@ var yamlStoriesIndexer = {
|
|
|
5726
5727
|
import twig from "vite-plugin-twig-drupal";
|
|
5727
5728
|
import { mergeConfig } from "vite";
|
|
5728
5729
|
import { resolve as resolve3 } from "path";
|
|
5729
|
-
import { existsSync as
|
|
5730
|
+
import { existsSync as existsSync3 } from "fs";
|
|
5730
5731
|
import glob from "glob";
|
|
5731
5732
|
var cachedComponentDirectories = null;
|
|
5732
5733
|
var getComponentDirectories = () => {
|
|
@@ -5740,7 +5741,7 @@ var resolveComponentPath2 = (namespace, component) => {
|
|
|
5740
5741
|
const possiblePaths = componentDirectories.map(
|
|
5741
5742
|
(dir) => resolve3(`${dir}/${component}/${component}.component.yml`)
|
|
5742
5743
|
);
|
|
5743
|
-
return possiblePaths.find((path2) =>
|
|
5744
|
+
return possiblePaths.find((path2) => existsSync3(path2));
|
|
5744
5745
|
};
|
|
5745
5746
|
function viteFinal(config, options) {
|
|
5746
5747
|
const { namespace } = options.sdcStorybookOptions;
|
|
@@ -5766,7 +5767,10 @@ function viteFinal(config, options) {
|
|
|
5766
5767
|
}
|
|
5767
5768
|
});
|
|
5768
5769
|
}
|
|
5769
|
-
var experimental_indexers = async (existingIndexers) => [
|
|
5770
|
+
var experimental_indexers = async (existingIndexers) => [
|
|
5771
|
+
...existingIndexers || [],
|
|
5772
|
+
yamlStoriesIndexer
|
|
5773
|
+
];
|
|
5770
5774
|
var previewHead = (head) => `
|
|
5771
5775
|
<style>
|
|
5772
5776
|
.visually-hidden {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "storybook-addon-sdc",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "Drupal Single Directory Components as stories",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"SDC",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"@storybook/types": "^8.4.4",
|
|
50
50
|
"@types/json-schema": "^7.0.15",
|
|
51
51
|
"@types/node": "^22.8.7",
|
|
52
|
+
"@types/twig": "^1.12.16",
|
|
52
53
|
"auto": "^11.3.0",
|
|
53
54
|
"boxen": "^8.0.1",
|
|
54
55
|
"dedent": "^1.5.1",
|