storybook-addon-sdc 0.3.3 → 0.3.5
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/README.md +19 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,14 +8,14 @@ This addon streamlines the integration of Drupal Single Directory Components (SD
|
|
|
8
8
|
|
|
9
9
|
- [Overview](#overview)
|
|
10
10
|
- [Storybook Example Live](#storybook-example-live)
|
|
11
|
-
- [Why Choose SDC Storybook Over Alternatives?](#why-choose-sdc-storybook-over-alternatives)
|
|
12
11
|
- [Features of the Addon](#features-of-the-addon)
|
|
13
|
-
- [
|
|
12
|
+
- [Why Choose SDC Storybook Over Alternatives?](#why-choose-sdc-storybook-over-alternatives)
|
|
14
13
|
- [Quickstart Guide](#quickstart-guide)
|
|
15
14
|
- [Configuration](#configuration)
|
|
16
15
|
- [Setting Default Values](#setting-default-values)
|
|
17
16
|
- [Creating Experimental Stories](#creating-experimental-stories)
|
|
18
17
|
- [Regular Storybook](#regular-storybook)
|
|
18
|
+
- [Dependencies](#dependencies)
|
|
19
19
|
- [Known Issues](#known-issues)
|
|
20
20
|
- [UI Patterns](#ui-patterns)
|
|
21
21
|
|
|
@@ -31,6 +31,16 @@ This Storybook addon makes it easy to integrate Drupal Single Directory Componen
|
|
|
31
31
|
|
|
32
32
|
You can view a [live example of the SDC Addon in Storybook](https://iberdinsky-skilld.github.io/sdc-addon), hosted on GitHub Pages, showcasing components in the `/components` directory of that repository.
|
|
33
33
|
|
|
34
|
+
## Features of the Addon
|
|
35
|
+
|
|
36
|
+
The SDC Storybook Addon simplifies the integration of Drupal Single Directory Components (SDC) into Storybook, offering several key features:
|
|
37
|
+
|
|
38
|
+
- Vite Plugin Integration: Leverages the vite-plugin-twig-drupal plugin to seamlessly load and process Twig templates used in SDC components.
|
|
39
|
+
- Dynamic Path Resolution: Utilizes namespaces to dynamically discover components within your project structure, eliminating the need for manual configuration.
|
|
40
|
+
- Story Generation: Automatically creates stories based on the YAML configurations of your SDC components, streamlining the story creation process.
|
|
41
|
+
- JSON Schema Support: Supports JSON Schema for props and slots, enabling the generation of mock data for missing values and ensuring data consistency.
|
|
42
|
+
- Drupal Behavior Embedding: Allows you to directly embed Drupal behaviors like Drupal.attachBehaviors() into Storybook previews, ensuring components behave similarly to their Drupal counterparts.
|
|
43
|
+
|
|
34
44
|
## Why Choose SDC Storybook Over Alternatives?
|
|
35
45
|
|
|
36
46
|
While solutions like [SDC Styleguide](https://www.drupal.org/project/sdc_styleguide) and [Drupal Storybook](https://www.drupal.org/project/storybook) are valuable, the SDC Storybook addon offers distinct advantages:
|
|
@@ -73,18 +83,6 @@ While using Drupal to render components offers tighter integration, there are st
|
|
|
73
83
|
- Twig.js Works Well for Frontend-Focused Use Cases.
|
|
74
84
|
- Styling and Behavior Mismatches Can Be Managed Separately in Drupal implelentation phase.
|
|
75
85
|
|
|
76
|
-
## Features of the Addon
|
|
77
|
-
|
|
78
|
-
- Vite plugin for loading YAML-based SDC configurations.
|
|
79
|
-
- Dynamic path resolution based on namespaces for easy component discovery.
|
|
80
|
-
- Story generator that creates stories directly from YAML files.
|
|
81
|
-
- JSON schema-based props and support for Drupal behaviors.
|
|
82
|
-
|
|
83
|
-
## Dependencies
|
|
84
|
-
|
|
85
|
-
- [vite-plugin-twig-drupal](https://github.com/larowlan/vite-plugin-twig-drupal): Loads Twig with Drupal functions.
|
|
86
|
-
- [json-schema-faker](https://github.com/json-schema-faker/json-schema-faker): Generates mock data for missing props and slots.
|
|
87
|
-
|
|
88
86
|
## Quickstart Guide
|
|
89
87
|
|
|
90
88
|
1. **In theme or module or just empty directory (If package.json not yet exists)**:
|
|
@@ -202,8 +200,8 @@ thirdPartySettings:
|
|
|
202
200
|
- m-paragraph--grid
|
|
203
201
|
slots:
|
|
204
202
|
content:
|
|
205
|
-
# 1. Basic Props
|
|
206
|
-
# This card uses only the basic default props defined in the component YAML.
|
|
203
|
+
# 1. Basic Props and Slots
|
|
204
|
+
# This card uses only the basic default props and slots defined in the component YAML.
|
|
207
205
|
- type: component
|
|
208
206
|
component: 'umami:card'
|
|
209
207
|
|
|
@@ -300,6 +298,11 @@ export default {
|
|
|
300
298
|
export const Basic = {}
|
|
301
299
|
```
|
|
302
300
|
|
|
301
|
+
## Dependencies
|
|
302
|
+
|
|
303
|
+
- [vite-plugin-twig-drupal](https://github.com/larowlan/vite-plugin-twig-drupal): Loads Twig with Drupal functions.
|
|
304
|
+
- [json-schema-faker](https://github.com/json-schema-faker/json-schema-faker): Generates mock data for missing props and slots.
|
|
305
|
+
|
|
303
306
|
## Known Issues
|
|
304
307
|
|
|
305
308
|
- `$ref: json-schema-definitions://` for SDC from Experience Builder is unsupported.
|