@storybook/web-components 7.4.0-alpha.0 → 7.4.0-alpha.1

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": "@storybook/web-components",
3
- "version": "7.4.0-alpha.0",
3
+ "version": "7.4.0-alpha.1",
4
4
  "description": "Storybook web-components renderer",
5
5
  "keywords": [
6
6
  "lit",
@@ -41,23 +41,24 @@
41
41
  "types": "dist/index.d.ts",
42
42
  "files": [
43
43
  "dist/**/*",
44
- "template/**/*",
44
+ "template/cli/**/*",
45
45
  "README.md",
46
46
  "*.js",
47
- "*.d.ts"
47
+ "*.d.ts",
48
+ "!src/**/*"
48
49
  ],
49
50
  "scripts": {
50
51
  "check": "../../../scripts/prepare/check.ts",
51
52
  "prep": "../../../scripts/prepare/bundle.ts"
52
53
  },
53
54
  "dependencies": {
54
- "@storybook/client-logger": "7.4.0-alpha.0",
55
- "@storybook/core-client": "7.4.0-alpha.0",
56
- "@storybook/docs-tools": "7.4.0-alpha.0",
55
+ "@storybook/client-logger": "7.4.0-alpha.1",
56
+ "@storybook/core-client": "7.4.0-alpha.1",
57
+ "@storybook/docs-tools": "7.4.0-alpha.1",
57
58
  "@storybook/global": "^5.0.0",
58
- "@storybook/manager-api": "7.4.0-alpha.0",
59
- "@storybook/preview-api": "7.4.0-alpha.0",
60
- "@storybook/types": "7.4.0-alpha.0",
59
+ "@storybook/manager-api": "7.4.0-alpha.1",
60
+ "@storybook/preview-api": "7.4.0-alpha.1",
61
+ "@storybook/types": "7.4.0-alpha.1",
61
62
  "tiny-invariant": "^1.3.1",
62
63
  "ts-dedent": "^2.0.0"
63
64
  },
@@ -1,199 +0,0 @@
1
- import { global } from '@storybook/global';
2
-
3
- import { LitElement, html, css } from 'lit-element';
4
-
5
- const { CustomEvent } = global;
6
-
7
- const demoWcCardStyle = css`
8
- :host {
9
- display: block;
10
- position: relative;
11
- width: 250px;
12
- height: 200px;
13
- border-radius: 10px;
14
- transform-style: preserve-3d;
15
- transition: all 0.8s ease;
16
- }
17
-
18
- .header {
19
- font-weight: bold;
20
- font-size: var(--demo-wc-card-header-font-size, 16px);
21
- text-align: center;
22
- }
23
-
24
- .content {
25
- padding: 20px 10px 0 10px;
26
- flex-grow: 1;
27
- }
28
-
29
- .footer {
30
- display: flex;
31
- }
32
-
33
- dl {
34
- margin: 0;
35
- text-align: left;
36
- }
37
-
38
- dd {
39
- margin-left: 15px;
40
- }
41
-
42
- button {
43
- border-radius: 15px;
44
- width: 30px;
45
- height: 30px;
46
- background: #fff;
47
- border: 1px solid #ccc;
48
- color: #000;
49
- font-size: 21px;
50
- line-height: 27px;
51
- font-weight: bold;
52
- cursor: pointer;
53
- margin: 5px;
54
- }
55
-
56
- .note {
57
- flex-grow: 1;
58
- color: #666;
59
- font-size: 16px;
60
- font-weight: bold;
61
- text-align: left;
62
- padding-top: 15px;
63
- }
64
-
65
- :host([back-side]) {
66
- transform: rotateY(180deg);
67
- }
68
-
69
- #front,
70
- #back {
71
- position: absolute;
72
- width: 250px;
73
- box-sizing: border-box;
74
- box-shadow: #ccc 3px 3px 2px 1px;
75
- padding: 10px;
76
- display: flex;
77
- flex-flow: column;
78
- top: 0;
79
- left: 0;
80
- height: 100%;
81
- border-radius: 10px;
82
- backface-visibility: hidden;
83
- overflow: hidden;
84
- }
85
-
86
- #front {
87
- background: linear-gradient(141deg, #aaa 25%, #eee 40%, #ddd 55%);
88
- color: var(--demo-wc-card-front-color, #000);
89
- }
90
-
91
- #back {
92
- background: linear-gradient(141deg, #333 25%, #aaa 40%, #666 55%);
93
- color: var(--demo-wc-card-back-color, #fff);
94
- text-align: center;
95
- transform: rotateY(180deg) translate3d(0px, 0, 1px);
96
- }
97
-
98
- #back .note {
99
- color: #fff;
100
- }
101
- `;
102
-
103
- /**
104
- * This is a container looking like a card with a back and front side you can switch
105
- *
106
- * @slot - This is an unnamed slot (the default slot)
107
- * @fires side-changed - Fires whenever it switches between front/back
108
- * @cssprop --demo-wc-card-header-font-size - Header font size
109
- * @cssprop --demo-wc-card-front-color - Font color for front
110
- * @cssprop --demo-wc-card-back-color - Font color for back
111
- * @csspart front - Front of the card
112
- * @csspart back - Back of the card
113
- */
114
- export class DemoWcCard extends LitElement {
115
- static get properties() {
116
- return {
117
- backSide: {
118
- type: Boolean,
119
- reflect: true,
120
- attribute: 'back-side',
121
- },
122
- header: { type: String },
123
- rows: { type: Object },
124
- };
125
- }
126
-
127
- static get styles() {
128
- return demoWcCardStyle;
129
- }
130
-
131
- constructor() {
132
- super();
133
-
134
- /**
135
- * Indicates that the back of the card is shown
136
- */
137
- this.backSide = false;
138
-
139
- /**
140
- * Header message
141
- */
142
- this.header = 'Your Message';
143
-
144
- /**
145
- * Data rows
146
- */
147
- this.rows = [];
148
- }
149
-
150
- toggle() {
151
- this.backSide = !this.backSide;
152
- }
153
-
154
- render() {
155
- return html`
156
- <div id="front" part="front">
157
- <div class="header">${this.header}</div>
158
- <div class="content">
159
- <slot></slot>
160
- </div>
161
- <div class="footer">
162
- <div class="note">A</div>
163
- <button @click=${this.toggle}>></button>
164
- </div>
165
- </div>
166
- <div id="back" part="back">
167
- <div class="header">${this.header}</div>
168
-
169
- <div class="content">
170
- ${this.rows.length === 0
171
- ? html``
172
- : html`
173
- <dl>
174
- ${this.rows.map(
175
- (row) => html`
176
- <dt>${row.header}</dt>
177
- <dd>${row.value}</dd>
178
- `
179
- )}
180
- </dl>
181
- `}
182
- </div>
183
- <div class="footer">
184
- <div class="note">B</div>
185
- <button @click=${this.toggle}>></button>
186
- </div>
187
- </div>
188
- `;
189
- }
190
-
191
- updated(changedProperties) {
192
- if (changedProperties.has('backSide') && changedProperties.get('backSide') !== undefined) {
193
- this.dispatchEvent(new CustomEvent('side-changed'));
194
- }
195
- }
196
- }
197
-
198
- // eslint-disable-next-line no-undef
199
- customElements.define('input', DemoWcCard);
@@ -1,61 +0,0 @@
1
- import { html } from 'lit';
2
-
3
- export const Welcome = () => html`
4
- <div class="main">
5
- <h1>Welcome to Storybook for Web Components</h1>
6
- <p>This is a UI component dev environment for your plain HTML snippets.</p>
7
- <p>
8
- We've added some basic stories inside the <code class="code">stories</code> directory.
9
- <br />
10
- A story is a single state of one or more UI components. You can have as many stories as you
11
- want.
12
- <br />
13
- (Basically a story is like a visual test case.)
14
- </p>
15
- <p>
16
- See these sample
17
- <a class="link" href="#" data-sb-kind="Demo Card" data-sb-story="Front">stories</a>
18
- </p>
19
- <p>
20
- Just like that, you can add your own snippets as stories.
21
- <br />
22
- You can also edit those snippets and see changes right away.
23
- <br />
24
- </p>
25
- <p>
26
- Usually we create stories with smaller UI components in the app.<br />
27
- Have a look at the
28
- <a class="link" href="https://storybook.js.org/basics/writing-stories" target="_blank">
29
- Writing Stories
30
- </a>
31
- section in our documentation.
32
- </p>
33
- </div>
34
-
35
- <style>
36
- .main {
37
- padding: 15px;
38
- line-height: 1.4;
39
- font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;
40
- background-color: #ffffff;
41
- }
42
-
43
- .logo {
44
- width: 256px;
45
- margin: 15px;
46
- }
47
-
48
- .code {
49
- font-size: 15px;
50
- font-weight: 600;
51
- padding: 2px 5px;
52
- border: 1px solid #eae9e9;
53
- border-radius: 4px;
54
- background-color: #f3f2f2;
55
- color: #3a3a3a;
56
- }
57
- </style>
58
- `;
59
-
60
- // eslint-disable-next-line no-undef
61
- customElements.define('input', Welcome);
package/src/typings.d.ts DELETED
@@ -1,5 +0,0 @@
1
- /* eslint-disable no-underscore-dangle, @typescript-eslint/naming-convention */
2
- declare var STORYBOOK_ENV: 'web-components';
3
- declare var __STORYBOOK_CUSTOM_ELEMENTS_MANIFEST__: any;
4
- declare var __STORYBOOK_CUSTOM_ELEMENTS__: any;
5
- declare var LOGLEVEL: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent' | undefined;
@@ -1,30 +0,0 @@
1
- .storybook-button {
2
- font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
3
- font-weight: 700;
4
- border: 0;
5
- border-radius: 3em;
6
- cursor: pointer;
7
- display: inline-block;
8
- line-height: 1;
9
- }
10
- .storybook-button--primary {
11
- color: white;
12
- background-color: #1ea7fd;
13
- }
14
- .storybook-button--secondary {
15
- color: #333;
16
- background-color: transparent;
17
- box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset;
18
- }
19
- .storybook-button--small {
20
- font-size: 12px;
21
- padding: 10px 16px;
22
- }
23
- .storybook-button--medium {
24
- font-size: 14px;
25
- padding: 11px 20px;
26
- }
27
- .storybook-button--large {
28
- font-size: 16px;
29
- padding: 12px 24px;
30
- }
@@ -1,95 +0,0 @@
1
- {
2
- "version": "experimental",
3
- "tags": [
4
- {
5
- "name": "demo-wc-card",
6
- "path": "./demo-wc-card.js",
7
- "description": "This is a container looking like a card with a back and front side you can switch",
8
- "attributes": [
9
- {
10
- "name": "back-side",
11
- "description": "Indicates that the back of the card is shown",
12
- "type": "boolean",
13
- "default": "false"
14
- },
15
- {
16
- "name": "header",
17
- "description": "Header message",
18
- "type": "string",
19
- "default": "\"Your Message\""
20
- },
21
- {
22
- "name": "rows",
23
- "description": "Data rows",
24
- "type": "object",
25
- "default": "[]"
26
- }
27
- ],
28
- "properties": [
29
- {
30
- "name": "backSide",
31
- "attribute": "back-side",
32
- "description": "Indicates that the back of the card is shown",
33
- "type": "boolean",
34
- "default": "false"
35
- },
36
- {
37
- "name": "header",
38
- "attribute": "header",
39
- "description": "Header message",
40
- "type": "string",
41
- "default": "\"Your Message\""
42
- },
43
- {
44
- "name": "rows",
45
- "attribute": "rows",
46
- "description": "Data rows",
47
- "type": "object",
48
- "default": "[]"
49
- }
50
- ],
51
- "events": [
52
- {
53
- "name": "side-changed",
54
- "description": "Fires whenever it switches between front/back"
55
- }
56
- ],
57
- "methods": [
58
- {
59
- "name": "testMethod",
60
- "description": "Some web component frameworks like Stencil generate extra docs for methods. These are also displayed in the ArgsTable."
61
- }
62
- ],
63
- "slots": [
64
- {
65
- "name": "",
66
- "description": "This is an unnamed slot (the default slot)"
67
- }
68
- ],
69
- "cssProperties": [
70
- {
71
- "name": "--demo-wc-card-header-font-size",
72
- "description": "Header font size"
73
- },
74
- {
75
- "name": "--demo-wc-card-front-color",
76
- "description": "Font color for front"
77
- },
78
- {
79
- "name": "--demo-wc-card-back-color",
80
- "description": "Font color for back"
81
- }
82
- ],
83
- "cssParts": [
84
- {
85
- "name": "front",
86
- "description": "Front of the card"
87
- },
88
- {
89
- "name": "back",
90
- "description": "Back of the card"
91
- }
92
- ]
93
- }
94
- ]
95
- }
@@ -1,162 +0,0 @@
1
- {
2
- "schemaVersion": "1.0.0",
3
- "readme": "",
4
- "modules": [
5
- {
6
- "kind": "javascript-module",
7
- "path": "demo-wc-card/index.js",
8
- "declarations": [],
9
- "exports": [
10
- {
11
- "kind": "custom-element-definition",
12
- "name": "demo-wc-card",
13
- "declaration": {
14
- "name": "DemoWcCard",
15
- "module": "demo-wc-card/DemoWcCard.js"
16
- }
17
- }
18
- ]
19
- },
20
- {
21
- "kind": "javascript-module",
22
- "path": "demo-wc-card/DemoWcCard.js",
23
- "declarations": [
24
- {
25
- "kind": "class",
26
- "description": "This is a container looking like a card with a back and front side you can switch",
27
- "name": "DemoWcCard",
28
- "cssProperties": [
29
- {
30
- "description": "Header font size",
31
- "name": "--demo-wc-card-header-font-size"
32
- },
33
- {
34
- "description": "Font color for front",
35
- "name": "--demo-wc-card-front-color"
36
- },
37
- {
38
- "description": "Font color for back",
39
- "name": "--demo-wc-card-back-color"
40
- }
41
- ],
42
- "cssParts": [
43
- {
44
- "description": "Front of the card",
45
- "name": "front"
46
- },
47
- {
48
- "description": "Back of the card",
49
- "name": "back"
50
- }
51
- ],
52
- "slots": [
53
- {
54
- "name": "prefix",
55
- "description": "Label prefix"
56
- }
57
- ],
58
- "members": [
59
- {
60
- "kind": "method",
61
- "name": "toggle"
62
- },
63
- {
64
- "kind": "field",
65
- "name": "backSide",
66
- "type": {
67
- "text": "boolean"
68
- },
69
- "description": "Indicates that the back of the card is shown",
70
- "default": "false",
71
- "privacy": "public",
72
- "attribute": "back-side",
73
- "reflects": true
74
- },
75
- {
76
- "kind": "field",
77
- "name": "header",
78
- "type": {
79
- "text": "string"
80
- },
81
- "description": "Header message",
82
- "default": "'Your Message'",
83
- "privacy": "public",
84
- "attribute": "header"
85
- },
86
- {
87
- "kind": "field",
88
- "name": "rows",
89
- "type": {
90
- "text": "array"
91
- },
92
- "description": "Data rows",
93
- "default": "[]",
94
- "privacy": "public",
95
- "attribute": "rows"
96
- }
97
- ],
98
- "events": [
99
- {
100
- "name": "side-changed",
101
- "type": {
102
- "text": "CustomEvent"
103
- },
104
- "description": "Fires whenever it switches between front/back"
105
- }
106
- ],
107
- "attributes": [
108
- {
109
- "name": "back-side",
110
- "fieldName": "backSide"
111
- },
112
- {
113
- "name": "header",
114
- "fieldName": "header"
115
- },
116
- {
117
- "name": "rows",
118
- "fieldName": "rows"
119
- }
120
- ],
121
- "superclass": {
122
- "name": "LitElement",
123
- "package": "lit"
124
- },
125
- "tagName": "demo-wc-card",
126
- "customElement": true
127
- }
128
- ],
129
- "exports": [
130
- {
131
- "kind": "js",
132
- "name": "DemoWcCard",
133
- "declaration": {
134
- "name": "DemoWcCard",
135
- "module": "demo-wc-card/DemoWcCard.js"
136
- }
137
- }
138
- ]
139
- },
140
- {
141
- "kind": "javascript-module",
142
- "path": "demo-wc-card/demoWcCardStyle.css.js",
143
- "declarations": [
144
- {
145
- "kind": "variable",
146
- "name": "demoWcCardStyle",
147
- "default": "css`\n :host {\n display: block;\n position: relative;\n width: 250px;\n height: 200px;\n border-radius: 10px;\n transform-style: preserve-3d;\n transition: all 0.8s ease;\n }\n\n .header {\n font-weight: bold;\n font-size: var(--demo-wc-card-header-font-size, 16px);\n text-align: center;\n }\n\n .content {\n padding: 20px 10px 0 10px;\n flex-grow: 1;\n }\n\n .footer {\n display: flex;\n }\n\n dl {\n margin: 0;\n text-align: left;\n }\n\n dd {\n margin-left: 15px;\n }\n\n button {\n border-radius: 15px;\n width: 30px;\n height: 30px;\n background: #fff;\n border: 1px solid #ccc;\n color: #000;\n font-size: 21px;\n line-height: 27px;\n font-weight: bold;\n cursor: pointer;\n margin: 5px;\n }\n\n .note {\n flex-grow: 1;\n color: #666;\n font-size: 16px;\n font-weight: bold;\n text-align: left;\n padding-top: 15px;\n }\n\n :host([back-side]) {\n transform: rotateY(180deg);\n }\n\n #front,\n #back {\n position: absolute;\n width: 250px;\n box-sizing: border-box;\n box-shadow: #ccc 3px 3px 2px 1px;\n padding: 10px;\n display: flex;\n flex-flow: column;\n top: 0;\n left: 0;\n height: 100%;\n border-radius: 10px;\n backface-visibility: hidden;\n overflow: hidden;\n }\n\n #front {\n background: linear-gradient(141deg, #aaa 25%, #eee 40%, #ddd 55%);\n color: var(--demo-wc-card-front-color, #000);\n }\n\n #back {\n background: linear-gradient(141deg, #333 25%, #aaa 40%, #666 55%);\n color: var(--demo-wc-card-back-color, #fff);\n text-align: center;\n transform: rotateY(180deg) translate3d(0px, 0, 1px);\n }\n\n #back .note {\n color: #fff;\n }\n`"
148
- }
149
- ],
150
- "exports": [
151
- {
152
- "kind": "js",
153
- "name": "demoWcCardStyle",
154
- "declaration": {
155
- "name": "demoWcCardStyle",
156
- "module": "demo-wc-card/demoWcCardStyle.css.js"
157
- }
158
- }
159
- ]
160
- }
161
- ]
162
- }