storybook 9.0.0-alpha.1 → 9.0.0-alpha.11

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.
Files changed (267) hide show
  1. package/README.md +31 -29
  2. package/assets/browser/favicon.svg +1 -0
  3. package/assets/browser/nunito-sans-bold-italic.woff2 +0 -0
  4. package/assets/browser/nunito-sans-bold.woff2 +0 -0
  5. package/assets/browser/nunito-sans-italic.woff2 +0 -0
  6. package/assets/browser/nunito-sans-regular.woff2 +0 -0
  7. package/assets/docs/addon-controls-args-annotated.png +0 -0
  8. package/assets/docs/addon-controls-args-background-color.png +0 -0
  9. package/assets/docs/addon-controls-args-background-string.png +0 -0
  10. package/assets/docs/addon-controls-args-docs.png +0 -0
  11. package/assets/docs/addon-controls-args-logging.png +0 -0
  12. package/assets/docs/addon-controls-args-no-annotation.png +0 -0
  13. package/assets/docs/addon-controls-args-reflow-slider.png +0 -0
  14. package/assets/docs/addon-controls-args-reflow.png +0 -0
  15. package/assets/docs/addon-controls-args-template.png +0 -0
  16. package/assets/docs/addon-controls-expanded.png +0 -0
  17. package/assets/docs/addon-controls-hero.gif +0 -0
  18. package/assets/docs/addon-controls-install.png +0 -0
  19. package/assets/docs/hero.gif +0 -0
  20. package/assets/docs/message-reference.png +0 -0
  21. package/assets/docs/viewport.png +0 -0
  22. package/assets/server/addon.tsconfig.json +6 -0
  23. package/assets/server/base-preview-body.html +119 -0
  24. package/assets/server/base-preview-head.html +451 -0
  25. package/assets/server/template.ejs +87 -0
  26. package/bin/index.cjs +1 -1
  27. package/dist/actions/decorator.d.ts +6 -0
  28. package/dist/actions/decorator.js +139 -0
  29. package/dist/actions/index.cjs +127 -0
  30. package/dist/actions/index.d.ts +105 -0
  31. package/dist/actions/index.js +112 -0
  32. package/dist/actions/manager.js +1196 -0
  33. package/dist/actions/preview.cjs +165 -0
  34. package/dist/actions/preview.d.ts +55 -0
  35. package/dist/actions/preview.js +156 -0
  36. package/dist/babel/index.cjs +54034 -0
  37. package/dist/babel/index.d.ts +7488 -0
  38. package/dist/babel/index.js +54044 -0
  39. package/dist/bin/index.cjs +118 -0
  40. package/dist/bin/index.js +112 -0
  41. package/dist/builder-manager/index.cjs +2140 -0
  42. package/dist/builder-manager/index.d.ts +19 -0
  43. package/dist/builder-manager/index.js +2162 -0
  44. package/dist/channels/index.cjs +1913 -0
  45. package/dist/channels/index.d.ts +108 -0
  46. package/dist/channels/index.js +1881 -0
  47. package/dist/cli/bin/index.cjs +2687 -0
  48. package/dist/cli/bin/index.d.ts +2 -0
  49. package/dist/cli/bin/index.js +2707 -0
  50. package/dist/cli/index.cjs +17327 -0
  51. package/dist/cli/index.d.ts +209 -0
  52. package/dist/cli/index.js +17349 -0
  53. package/dist/client-logger/index.cjs +80 -0
  54. package/dist/client-logger/index.d.ts +29 -0
  55. package/dist/client-logger/index.js +64 -0
  56. package/dist/common/index.cjs +20568 -0
  57. package/dist/common/index.d.ts +948 -0
  58. package/dist/common/index.js +20653 -0
  59. package/dist/component-testing/index.cjs +23 -0
  60. package/dist/component-testing/index.d.ts +3 -0
  61. package/dist/component-testing/index.js +5 -0
  62. package/dist/component-testing/manager.css +170 -0
  63. package/dist/component-testing/manager.js +3099 -0
  64. package/dist/component-testing/preview.cjs +40 -0
  65. package/dist/component-testing/preview.d.ts +5 -0
  66. package/dist/component-testing/preview.js +25 -0
  67. package/dist/components/index.cjs +27925 -0
  68. package/dist/components/index.d.ts +1423 -0
  69. package/dist/components/index.js +24674 -0
  70. package/dist/controls/decorator.d.ts +5 -0
  71. package/dist/controls/decorator.js +8 -0
  72. package/dist/controls/index.cjs +26 -0
  73. package/dist/controls/index.d.ts +39 -0
  74. package/dist/controls/index.js +6 -0
  75. package/dist/controls/manager.js +5545 -0
  76. package/dist/controls/preview.cjs +26 -0
  77. package/dist/controls/preview.d.ts +55 -0
  78. package/dist/controls/preview.js +9 -0
  79. package/dist/core-events/index.cjs +167 -0
  80. package/dist/core-events/index.d.ts +426 -0
  81. package/dist/core-events/index.js +149 -0
  82. package/dist/core-server/index.cjs +38183 -0
  83. package/dist/core-server/index.d.ts +720 -0
  84. package/dist/core-server/index.js +38272 -0
  85. package/dist/core-server/presets/common-manager.js +20 -0
  86. package/dist/core-server/presets/common-override-preset.cjs +4824 -0
  87. package/dist/core-server/presets/common-override-preset.js +4829 -0
  88. package/dist/core-server/presets/common-preset.cjs +10231 -0
  89. package/dist/core-server/presets/common-preset.js +10309 -0
  90. package/dist/csf/index.cjs +179 -0
  91. package/dist/csf/index.d.ts +750 -0
  92. package/dist/csf/index.js +172 -0
  93. package/dist/csf-tools/index.cjs +1422 -0
  94. package/dist/csf-tools/index.d.ts +250 -0
  95. package/dist/csf-tools/index.js +1439 -0
  96. package/dist/docs-tools/index.cjs +2891 -0
  97. package/dist/docs-tools/index.d.ts +162 -0
  98. package/dist/docs-tools/index.js +2876 -0
  99. package/dist/index.cjs +17 -1
  100. package/dist/index.d.ts +1 -1
  101. package/dist/index.js +2 -7
  102. package/dist/instrumenter/index.cjs +3492 -0
  103. package/dist/instrumenter/index.d.ts +104 -0
  104. package/dist/instrumenter/index.js +4964 -0
  105. package/dist/manager/globals-module-info.cjs +817 -0
  106. package/dist/manager/globals-module-info.d.ts +36 -0
  107. package/dist/manager/globals-module-info.js +804 -0
  108. package/dist/manager/globals-runtime.js +83389 -0
  109. package/dist/manager/globals.cjs +47 -0
  110. package/dist/manager/globals.d.ts +24 -0
  111. package/dist/manager/globals.js +34 -0
  112. package/dist/manager/runtime.js +12323 -0
  113. package/dist/manager-api/index.cjs +11074 -0
  114. package/dist/manager-api/index.d.ts +1512 -0
  115. package/dist/manager-api/index.js +4835 -0
  116. package/dist/manager-errors.d.ts +89 -0
  117. package/dist/manager-errors.js +99 -0
  118. package/dist/node-logger/index.cjs +1642 -0
  119. package/dist/node-logger/index.d.ts +117 -0
  120. package/dist/node-logger/index.js +1652 -0
  121. package/dist/preview/globals.cjs +38 -0
  122. package/dist/preview/globals.d.ts +15 -0
  123. package/dist/preview/globals.js +25 -0
  124. package/dist/preview/runtime.js +44921 -0
  125. package/dist/preview-api/index.cjs +5227 -0
  126. package/dist/preview-api/index.d.ts +1093 -0
  127. package/dist/preview-api/index.js +5295 -0
  128. package/dist/preview-errors.cjs +503 -0
  129. package/dist/preview-errors.d.ts +212 -0
  130. package/dist/preview-errors.js +449 -0
  131. package/dist/router/index.cjs +3296 -0
  132. package/dist/router/index.d.ts +385 -0
  133. package/dist/router/index.js +1843 -0
  134. package/dist/server-errors.cjs +727 -0
  135. package/dist/server-errors.d.ts +296 -0
  136. package/dist/server-errors.js +728 -0
  137. package/dist/telemetry/index.cjs +2756 -0
  138. package/dist/telemetry/index.d.ts +133 -0
  139. package/dist/telemetry/index.js +2797 -0
  140. package/dist/test/index.cjs +35685 -0
  141. package/dist/test/index.d.ts +186 -0
  142. package/dist/test/index.js +33751 -0
  143. package/dist/test/preview.cjs +15869 -0
  144. package/dist/test/preview.d.ts +54 -0
  145. package/dist/test/preview.js +14440 -0
  146. package/dist/test/spy.cjs +257 -0
  147. package/dist/test/spy.d.ts +66 -0
  148. package/dist/test/spy.js +239 -0
  149. package/dist/theming/create.cjs +232 -0
  150. package/dist/theming/create.d.ts +50 -0
  151. package/dist/theming/create.js +216 -0
  152. package/dist/theming/index.cjs +2665 -0
  153. package/dist/theming/index.d.ts +11939 -0
  154. package/dist/theming/index.js +2485 -0
  155. package/dist/types/index.cjs +27 -0
  156. package/dist/types/index.d.ts +2795 -0
  157. package/dist/types/index.js +7 -0
  158. package/dist/viewport/index.cjs +310 -0
  159. package/dist/viewport/index.d.ts +320 -0
  160. package/dist/viewport/index.js +290 -0
  161. package/dist/viewport/manager.js +400 -0
  162. package/dist/viewport/preview.cjs +35 -0
  163. package/dist/viewport/preview.d.ts +69 -0
  164. package/dist/viewport/preview.js +19 -0
  165. package/package.json +539 -209
  166. package/.eslintrc.cjs +0 -31
  167. package/__mocks__/@aw-web-design/x-default-browser.js +0 -2
  168. package/core/babel/index.cjs +0 -1
  169. package/core/babel/index.d.ts +0 -2
  170. package/core/babel/index.js +0 -1
  171. package/core/builder-manager/index.cjs +0 -1
  172. package/core/builder-manager/index.d.ts +0 -2
  173. package/core/builder-manager/index.js +0 -1
  174. package/core/channels/index.cjs +0 -1
  175. package/core/channels/index.d.ts +0 -2
  176. package/core/channels/index.js +0 -1
  177. package/core/cli/bin/index.cjs +0 -1
  178. package/core/cli/bin/index.d.ts +0 -2
  179. package/core/cli/bin/index.js +0 -1
  180. package/core/cli/index.cjs +0 -1
  181. package/core/cli/index.d.ts +0 -2
  182. package/core/cli/index.js +0 -1
  183. package/core/client-logger/index.cjs +0 -1
  184. package/core/client-logger/index.d.ts +0 -2
  185. package/core/client-logger/index.js +0 -1
  186. package/core/common/index.cjs +0 -1
  187. package/core/common/index.d.ts +0 -2
  188. package/core/common/index.js +0 -1
  189. package/core/components/index.cjs +0 -1
  190. package/core/components/index.d.ts +0 -2
  191. package/core/components/index.js +0 -1
  192. package/core/core-events/index.cjs +0 -1
  193. package/core/core-events/index.d.ts +0 -2
  194. package/core/core-events/index.js +0 -1
  195. package/core/core-server/index.cjs +0 -1
  196. package/core/core-server/index.d.ts +0 -2
  197. package/core/core-server/index.js +0 -1
  198. package/core/core-server/presets/common-manager.js +0 -1
  199. package/core/core-server/presets/common-override-preset.cjs +0 -1
  200. package/core/core-server/presets/common-override-preset.js +0 -1
  201. package/core/core-server/presets/common-preset.cjs +0 -1
  202. package/core/core-server/presets/common-preset.js +0 -1
  203. package/core/csf/index.cjs +0 -1
  204. package/core/csf/index.d.ts +0 -2
  205. package/core/csf/index.js +0 -1
  206. package/core/csf-tools/index.cjs +0 -1
  207. package/core/csf-tools/index.d.ts +0 -2
  208. package/core/csf-tools/index.js +0 -1
  209. package/core/docs-tools/index.cjs +0 -1
  210. package/core/docs-tools/index.d.ts +0 -2
  211. package/core/docs-tools/index.js +0 -1
  212. package/core/index.cjs +0 -1
  213. package/core/index.d.ts +0 -2
  214. package/core/index.js +0 -1
  215. package/core/manager/globals-module-info.cjs +0 -1
  216. package/core/manager/globals-module-info.d.ts +0 -2
  217. package/core/manager/globals-module-info.js +0 -1
  218. package/core/manager/globals-runtime.js +0 -1
  219. package/core/manager/globals.cjs +0 -1
  220. package/core/manager/globals.d.ts +0 -2
  221. package/core/manager/globals.js +0 -1
  222. package/core/manager-api/index.cjs +0 -1
  223. package/core/manager-api/index.d.ts +0 -2
  224. package/core/manager-api/index.js +0 -1
  225. package/core/manager-errors.d.ts +0 -2
  226. package/core/manager-errors.js +0 -1
  227. package/core/node-logger/index.cjs +0 -1
  228. package/core/node-logger/index.d.ts +0 -2
  229. package/core/node-logger/index.js +0 -1
  230. package/core/preview/globals.cjs +0 -1
  231. package/core/preview/globals.d.ts +0 -2
  232. package/core/preview/globals.js +0 -1
  233. package/core/preview/runtime.js +0 -1
  234. package/core/preview-api/index.cjs +0 -1
  235. package/core/preview-api/index.d.ts +0 -2
  236. package/core/preview-api/index.js +0 -1
  237. package/core/preview-errors.cjs +0 -1
  238. package/core/preview-errors.d.ts +0 -2
  239. package/core/preview-errors.js +0 -1
  240. package/core/router/index.cjs +0 -1
  241. package/core/router/index.d.ts +0 -2
  242. package/core/router/index.js +0 -1
  243. package/core/server-errors.cjs +0 -1
  244. package/core/server-errors.d.ts +0 -2
  245. package/core/server-errors.js +0 -1
  246. package/core/telemetry/index.cjs +0 -1
  247. package/core/telemetry/index.d.ts +0 -2
  248. package/core/telemetry/index.js +0 -1
  249. package/core/theming/create.cjs +0 -1
  250. package/core/theming/create.d.ts +0 -2
  251. package/core/theming/create.js +0 -1
  252. package/core/theming/index.cjs +0 -1
  253. package/core/theming/index.d.ts +0 -2
  254. package/core/theming/index.js +0 -1
  255. package/core/types/index.cjs +0 -1
  256. package/core/types/index.d.ts +0 -2
  257. package/core/types/index.js +0 -1
  258. package/core.cjs +0 -0
  259. package/core.d.ts +0 -0
  260. package/core.js +0 -1
  261. package/dist/chunk-OWLSIX54.js +0 -8
  262. package/dist/core-path.cjs +0 -1
  263. package/dist/core-path.d.ts +0 -3
  264. package/dist/core-path.js +0 -9
  265. package/dist/proxy.cjs +0 -1
  266. package/dist/proxy.d.ts +0 -2
  267. package/dist/proxy.js +0 -9
@@ -0,0 +1,290 @@
1
+ // src/viewport/constants.ts
2
+ var e = "storybook/viewport", t = "viewport", o = `${e}/panel`, h = `${e}/tool`;
3
+
4
+ // src/viewport/defaults.ts
5
+ var p = {
6
+ iphone5: {
7
+ name: "iPhone 5",
8
+ styles: {
9
+ height: "568px",
10
+ width: "320px"
11
+ },
12
+ type: "mobile"
13
+ },
14
+ iphone6: {
15
+ name: "iPhone 6",
16
+ styles: {
17
+ height: "667px",
18
+ width: "375px"
19
+ },
20
+ type: "mobile"
21
+ },
22
+ iphone6p: {
23
+ name: "iPhone 6 Plus",
24
+ styles: {
25
+ height: "736px",
26
+ width: "414px"
27
+ },
28
+ type: "mobile"
29
+ },
30
+ iphone8p: {
31
+ name: "iPhone 8 Plus",
32
+ styles: {
33
+ height: "736px",
34
+ width: "414px"
35
+ },
36
+ type: "mobile"
37
+ },
38
+ iphonex: {
39
+ name: "iPhone X",
40
+ styles: {
41
+ height: "812px",
42
+ width: "375px"
43
+ },
44
+ type: "mobile"
45
+ },
46
+ iphonexr: {
47
+ name: "iPhone XR",
48
+ styles: {
49
+ height: "896px",
50
+ width: "414px"
51
+ },
52
+ type: "mobile"
53
+ },
54
+ iphonexsmax: {
55
+ name: "iPhone XS Max",
56
+ styles: {
57
+ height: "896px",
58
+ width: "414px"
59
+ },
60
+ type: "mobile"
61
+ },
62
+ iphonese2: {
63
+ name: "iPhone SE (2nd generation)",
64
+ styles: {
65
+ height: "667px",
66
+ width: "375px"
67
+ },
68
+ type: "mobile"
69
+ },
70
+ iphone12mini: {
71
+ name: "iPhone 12 mini",
72
+ styles: {
73
+ height: "812px",
74
+ width: "375px"
75
+ },
76
+ type: "mobile"
77
+ },
78
+ iphone12: {
79
+ name: "iPhone 12",
80
+ styles: {
81
+ height: "844px",
82
+ width: "390px"
83
+ },
84
+ type: "mobile"
85
+ },
86
+ iphone12promax: {
87
+ name: "iPhone 12 Pro Max",
88
+ styles: {
89
+ height: "926px",
90
+ width: "428px"
91
+ },
92
+ type: "mobile"
93
+ },
94
+ iphoneSE3: {
95
+ name: "iPhone SE 3rd generation",
96
+ styles: {
97
+ height: "667px",
98
+ width: "375px"
99
+ },
100
+ type: "mobile"
101
+ },
102
+ iphone13: {
103
+ name: "iPhone 13",
104
+ styles: {
105
+ height: "844px",
106
+ width: "390px"
107
+ },
108
+ type: "mobile"
109
+ },
110
+ iphone13pro: {
111
+ name: "iPhone 13 Pro",
112
+ styles: {
113
+ height: "844px",
114
+ width: "390px"
115
+ },
116
+ type: "mobile"
117
+ },
118
+ iphone13promax: {
119
+ name: "iPhone 13 Pro Max",
120
+ styles: {
121
+ height: "926px",
122
+ width: "428px"
123
+ },
124
+ type: "mobile"
125
+ },
126
+ iphone14: {
127
+ name: "iPhone 14",
128
+ styles: {
129
+ height: "844px",
130
+ width: "390px"
131
+ },
132
+ type: "mobile"
133
+ },
134
+ iphone14pro: {
135
+ name: "iPhone 14 Pro",
136
+ styles: {
137
+ height: "852px",
138
+ width: "393px"
139
+ },
140
+ type: "mobile"
141
+ },
142
+ iphone14promax: {
143
+ name: "iPhone 14 Pro Max",
144
+ styles: {
145
+ height: "932px",
146
+ width: "430px"
147
+ },
148
+ type: "mobile"
149
+ },
150
+ ipad: {
151
+ name: "iPad",
152
+ styles: {
153
+ height: "1024px",
154
+ width: "768px"
155
+ },
156
+ type: "tablet"
157
+ },
158
+ ipad10p: {
159
+ name: "iPad Pro 10.5-in",
160
+ styles: {
161
+ height: "1112px",
162
+ width: "834px"
163
+ },
164
+ type: "tablet"
165
+ },
166
+ ipad11p: {
167
+ name: "iPad Pro 11-in",
168
+ styles: {
169
+ height: "1194px",
170
+ width: "834px"
171
+ },
172
+ type: "tablet"
173
+ },
174
+ ipad12p: {
175
+ name: "iPad Pro 12.9-in",
176
+ styles: {
177
+ height: "1366px",
178
+ width: "1024px"
179
+ },
180
+ type: "tablet"
181
+ },
182
+ galaxys5: {
183
+ name: "Galaxy S5",
184
+ styles: {
185
+ height: "640px",
186
+ width: "360px"
187
+ },
188
+ type: "mobile"
189
+ },
190
+ galaxys9: {
191
+ name: "Galaxy S9",
192
+ styles: {
193
+ height: "740px",
194
+ width: "360px"
195
+ },
196
+ type: "mobile"
197
+ },
198
+ nexus5x: {
199
+ name: "Nexus 5X",
200
+ styles: {
201
+ height: "660px",
202
+ width: "412px"
203
+ },
204
+ type: "mobile"
205
+ },
206
+ nexus6p: {
207
+ name: "Nexus 6P",
208
+ styles: {
209
+ height: "732px",
210
+ width: "412px"
211
+ },
212
+ type: "mobile"
213
+ },
214
+ pixel: {
215
+ name: "Pixel",
216
+ styles: {
217
+ height: "960px",
218
+ width: "540px"
219
+ },
220
+ type: "mobile"
221
+ },
222
+ pixelxl: {
223
+ name: "Pixel XL",
224
+ styles: {
225
+ height: "1280px",
226
+ width: "720px"
227
+ },
228
+ type: "mobile"
229
+ }
230
+ }, x = p, n = "responsive", l = {
231
+ mobile1: {
232
+ name: "Small mobile",
233
+ styles: {
234
+ height: "568px",
235
+ width: "320px"
236
+ },
237
+ type: "mobile"
238
+ },
239
+ mobile2: {
240
+ name: "Large mobile",
241
+ styles: {
242
+ height: "896px",
243
+ width: "414px"
244
+ },
245
+ type: "mobile"
246
+ },
247
+ tablet: {
248
+ name: "Tablet",
249
+ styles: {
250
+ height: "1112px",
251
+ width: "834px"
252
+ },
253
+ type: "tablet"
254
+ },
255
+ desktop: {
256
+ name: "Desktop",
257
+ styles: {
258
+ height: "1024px",
259
+ width: "1280px"
260
+ },
261
+ type: "desktop"
262
+ }
263
+ };
264
+
265
+ // src/viewport/preview.ts
266
+ import { definePreview as r } from "storybook/preview-api";
267
+ var w = {
268
+ [t]: { value: void 0, isRotated: !1 }
269
+ };
270
+
271
+ // src/viewport/responsiveViewport.tsx
272
+ var g = {
273
+ name: "Reset viewport",
274
+ styles: {
275
+ height: "100%",
276
+ width: "100%"
277
+ },
278
+ type: "desktop"
279
+ };
280
+ export {
281
+ e as ADDON_ID,
282
+ n as DEFAULT_VIEWPORT,
283
+ x as INITIAL_VIEWPORTS,
284
+ l as MINIMAL_VIEWPORTS,
285
+ o as PANEL_ID,
286
+ t as PARAM_KEY,
287
+ h as TOOL_ID,
288
+ w as initialGlobals,
289
+ g as responsiveViewport
290
+ };
@@ -0,0 +1,400 @@
1
+ var q = Object.defineProperty;
2
+ var n = (e, t) => q(e, "name", { value: t, configurable: !0 });
3
+
4
+ // src/viewport/manager.tsx
5
+ import * as F from "react";
6
+ import { addons as O, types as c0 } from "storybook/manager-api";
7
+
8
+ // src/viewport/components/Tool.tsx
9
+ import o, { Fragment as J, useCallback as Q, useEffect as $, useState as K } from "react";
10
+ import { IconButton as e0, TooltipLinkList as t0, WithTooltip as a0 } from "storybook/internal/components";
11
+
12
+ // ../node_modules/@storybook/icons/dist/index.mjs
13
+ import * as l from "react";
14
+ var H = /* @__PURE__ */ l.forwardRef(({ color: e = "currentColor", size: t = 14, ...a }, r) => /* @__PURE__ */ l.createElement(
15
+ "svg",
16
+ {
17
+ width: t,
18
+ height: t,
19
+ viewBox: "0 0 14 14",
20
+ fill: "none",
21
+ xmlns: "http://www.w3.org/2000/svg",
22
+ ref: r,
23
+ ...a
24
+ },
25
+ /* @__PURE__ */ l.createElement(
26
+ "path",
27
+ {
28
+ d: "M1.5 1.004a.5.5 0 100 1H12v10.5a.5.5 0 001 0v-10.5a1 1 0 00-1-1H1.5z",
29
+ fill: e
30
+ }
31
+ ),
32
+ /* @__PURE__ */ l.createElement(
33
+ "path",
34
+ {
35
+ d: "M1 3.504a.5.5 0 01.5-.5H10a1 1 0 011 1v8.5a.5.5 0 01-1 0v-8.5H1.5a.5.5 0 01-.5-.5z",
36
+ fill: e
37
+ }
38
+ ),
39
+ /* @__PURE__ */ l.createElement(
40
+ "path",
41
+ {
42
+ fillRule: "evenodd",
43
+ clipRule: "evenodd",
44
+ d: "M1.5 5.004a.5.5 0 00-.5.5v7a.5.5 0 00.5.5h7a.5.5 0 00.5-.5v-7a.5.5 0 00-.5-.5h-7zm.5 1v6h6v-6H2z",
45
+ fill: e
46
+ }
47
+ )
48
+ ));
49
+ var C = /* @__PURE__ */ l.forwardRef(({ color: e = "currentColor", size: t = 14, ...a }, r) => /* @__PURE__ */ l.createElement(
50
+ "svg",
51
+ {
52
+ width: t,
53
+ height: t,
54
+ viewBox: "0 0 14 14",
55
+ fill: "none",
56
+ xmlns: "http://www.w3.org/2000/svg",
57
+ ref: r,
58
+ ...a
59
+ },
60
+ /* @__PURE__ */ l.createElement(
61
+ "path",
62
+ {
63
+ fillRule: "evenodd",
64
+ clipRule: "evenodd",
65
+ d: "M.5 13.004a.5.5 0 01-.5-.5v-11a.5.5 0 01.5-.5h13a.5.5 0 01.5.5v11a.5.5 0 01-.5.5H.5zm.5-1v-8h12v8H1zm1-9.5a.5.5 0 11-1 0 .5.5 0 01\
66
+ 1 0zm2 0a.5.5 0 11-1 0 .5.5 0 011 0zm2 0a.5.5 0 11-1 0 .5.5 0 011 0z",
67
+ fill: e
68
+ }
69
+ )
70
+ )), L = /* @__PURE__ */ l.forwardRef(({ color: e = "currentColor", size: t = 14, ...a }, r) => /* @__PURE__ */ l.createElement(
71
+ "svg",
72
+ {
73
+ width: t,
74
+ height: t,
75
+ viewBox: "0 0 14 15",
76
+ fill: "none",
77
+ xmlns: "http://www.w3.org/2000/svg",
78
+ ref: r,
79
+ ...a
80
+ },
81
+ /* @__PURE__ */ l.createElement(
82
+ "path",
83
+ {
84
+ fillRule: "evenodd",
85
+ clipRule: "evenodd",
86
+ d: "M3.5.004a1.5 1.5 0 00-1.5 1.5v11a1.5 1.5 0 001.5 1.5h7a1.5 1.5 0 001.5-1.5v-11a1.5 1.5 0 00-1.5-1.5h-7zm0 1h7a.5.5 0 01.5.5v9.5H3v\
87
+ -9.5a.5.5 0 01.5-.5zm2.5 11a.5.5 0 000 1h2a.5.5 0 000-1H6z",
88
+ fill: e
89
+ }
90
+ )
91
+ )), A = /* @__PURE__ */ l.forwardRef(({ color: e = "currentColor", size: t = 14, ...a }, r) => /* @__PURE__ */ l.createElement(
92
+ "svg",
93
+ {
94
+ width: t,
95
+ height: t,
96
+ viewBox: "0 0 14 15",
97
+ fill: "none",
98
+ xmlns: "http://www.w3.org/2000/svg",
99
+ ref: r,
100
+ ...a
101
+ },
102
+ /* @__PURE__ */ l.createElement(
103
+ "path",
104
+ {
105
+ fillRule: "evenodd",
106
+ clipRule: "evenodd",
107
+ d: "M3 1.504a1.5 1.5 0 011.5-1.5h5a1.5 1.5 0 011.5 1.5v11a1.5 1.5 0 01-1.5 1.5h-5a1.5 1.5 0 01-1.5-1.5v-11zm1 10.5v-10h6v10H4z",
108
+ fill: e
109
+ }
110
+ )
111
+ ));
112
+ var V = /* @__PURE__ */ l.forwardRef(({ color: e = "currentColor", size: t = 14, ...a }, r) => /* @__PURE__ */ l.createElement(
113
+ "svg",
114
+ {
115
+ width: t,
116
+ height: t,
117
+ viewBox: "0 0 14 14",
118
+ fill: "none",
119
+ xmlns: "http://www.w3.org/2000/svg",
120
+ ref: r,
121
+ ...a
122
+ },
123
+ /* @__PURE__ */ l.createElement(
124
+ "path",
125
+ {
126
+ d: "M10.646 2.646a.5.5 0 01.708 0l1.5 1.5a.5.5 0 010 .708l-1.5 1.5a.5.5 0 01-.708-.708L11.293 5H1.5a.5.5 0 010-1h9.793l-.647-.646a.5.5\
127
+ 0 010-.708zM3.354 8.354L2.707 9H12.5a.5.5 0 010 1H2.707l.647.646a.5.5 0 01-.708.708l-1.5-1.5a.5.5 0 010-.708l1.5-1.5a.5.5 0 11.708.708z",
128
+ fill: e
129
+ }
130
+ )
131
+ ));
132
+ var B = /* @__PURE__ */ l.forwardRef(({ color: e = "currentColor", size: t = 14, ...a }, r) => /* @__PURE__ */ l.createElement(
133
+ "svg",
134
+ {
135
+ width: t,
136
+ height: t,
137
+ viewBox: "0 0 14 14",
138
+ fill: "none",
139
+ xmlns: "http://www.w3.org/2000/svg",
140
+ ref: r,
141
+ ...a
142
+ },
143
+ /* @__PURE__ */ l.createElement(
144
+ "path",
145
+ {
146
+ d: "M7.092.5H7a6.5 6.5 0 106.41 7.583.5.5 0 10-.986-.166A5.495 5.495 0 017 12.5a5.5 5.5 0 010-11h.006a5.5 5.5 0 014.894 3H10a.5.5 0 00\
147
+ 0 1h3a.5.5 0 00.5-.5V2a.5.5 0 00-1 0v1.535A6.495 6.495 0 007.092.5z",
148
+ fill: e
149
+ }
150
+ )
151
+ ));
152
+
153
+ // src/viewport/components/Tool.tsx
154
+ import { useGlobals as l0, useParameter as r0 } from "storybook/manager-api";
155
+ import { Global as n0 } from "storybook/theming";
156
+
157
+ // src/viewport/constants.ts
158
+ var i = "storybook/viewport", d = "viewport", v0 = `${i}/panel`, y = `${i}/tool`;
159
+
160
+ // src/viewport/defaults.ts
161
+ var b = {
162
+ mobile1: {
163
+ name: "Small mobile",
164
+ styles: {
165
+ height: "568px",
166
+ width: "320px"
167
+ },
168
+ type: "mobile"
169
+ },
170
+ mobile2: {
171
+ name: "Large mobile",
172
+ styles: {
173
+ height: "896px",
174
+ width: "414px"
175
+ },
176
+ type: "mobile"
177
+ },
178
+ tablet: {
179
+ name: "Tablet",
180
+ styles: {
181
+ height: "1112px",
182
+ width: "834px"
183
+ },
184
+ type: "tablet"
185
+ },
186
+ desktop: {
187
+ name: "Desktop",
188
+ styles: {
189
+ height: "1024px",
190
+ width: "1280px"
191
+ },
192
+ type: "desktop"
193
+ }
194
+ };
195
+
196
+ // src/viewport/responsiveViewport.tsx
197
+ var m = {
198
+ name: "Reset viewport",
199
+ styles: {
200
+ height: "100%",
201
+ width: "100%"
202
+ },
203
+ type: "desktop"
204
+ };
205
+
206
+ // src/viewport/preview.ts
207
+ import { definePreview as m0 } from "storybook/preview-api";
208
+ var P = {
209
+ [d]: { value: void 0, isRotated: !1 }
210
+ };
211
+
212
+ // src/viewport/shortcuts.ts
213
+ var S = /* @__PURE__ */ n((e, t) => e.indexOf(t), "getCurrentViewportIndex"), X = /* @__PURE__ */ n((e, t) => {
214
+ let a = S(e, t);
215
+ return a === e.length - 1 ? e[0] : e[a + 1];
216
+ }, "getNextViewport"), Z = /* @__PURE__ */ n((e, t) => {
217
+ let a = S(e, t);
218
+ return a < 1 ? e[e.length - 1] : e[a - 1];
219
+ }, "getPreviousViewport"), _ = /* @__PURE__ */ n(async (e, t, a, r) => {
220
+ await e.setAddonShortcut(i, {
221
+ label: "Previous viewport",
222
+ defaultShortcut: ["alt", "shift", "V"],
223
+ actionName: "previous",
224
+ action: /* @__PURE__ */ n(() => {
225
+ a({
226
+ viewport: Z(r, t)
227
+ });
228
+ }, "action")
229
+ }), await e.setAddonShortcut(i, {
230
+ label: "Next viewport",
231
+ defaultShortcut: ["alt", "V"],
232
+ actionName: "next",
233
+ action: /* @__PURE__ */ n(() => {
234
+ a({
235
+ viewport: X(r, t)
236
+ });
237
+ }, "action")
238
+ }), await e.setAddonShortcut(i, {
239
+ label: "Reset viewport",
240
+ defaultShortcut: ["alt", "control", "V"],
241
+ actionName: "reset",
242
+ action: /* @__PURE__ */ n(() => {
243
+ a(P);
244
+ }, "action")
245
+ });
246
+ }, "registerShortcuts");
247
+
248
+ // src/viewport/utils.tsx
249
+ import M, { Fragment as j } from "react";
250
+ import { IconButton as Y } from "storybook/internal/components";
251
+ import { styled as z } from "storybook/theming";
252
+ var k = z.div({
253
+ display: "inline-flex",
254
+ alignItems: "center"
255
+ }), I = z.div(({ theme: e }) => ({
256
+ display: "inline-block",
257
+ textDecoration: "none",
258
+ padding: 10,
259
+ fontWeight: e.typography.weight.bold,
260
+ fontSize: e.typography.size.s2 - 1,
261
+ lineHeight: "1",
262
+ height: 40,
263
+ border: "none",
264
+ borderTop: "3px solid transparent",
265
+ borderBottom: "3px solid transparent",
266
+ background: "transparent"
267
+ })), D = z(Y)(() => ({
268
+ display: "inline-flex",
269
+ alignItems: "center"
270
+ })), T = z.div(({ theme: e }) => ({
271
+ fontSize: e.typography.size.s2 - 1,
272
+ marginLeft: 10
273
+ })), G = {
274
+ desktop: /* @__PURE__ */ M.createElement(C, null),
275
+ mobile: /* @__PURE__ */ M.createElement(A, null),
276
+ tablet: /* @__PURE__ */ M.createElement(L, null),
277
+ other: /* @__PURE__ */ M.createElement(j, null)
278
+ };
279
+
280
+ // src/viewport/components/Tool.tsx
281
+ var U = /* @__PURE__ */ n(({ api: e }) => {
282
+ let t = r0(d), [a, r, g] = l0(), [u, s] = K(!1), { options: h = b, disable: E } = t || {}, v = a?.[d] || {}, w = typeof v == "string" ? v :
283
+ v.value, f = typeof v == "string" ? !1 : v.isRotated, c = h[w] || m, R = u || c !== m, p = d in g, x = Object.keys(h).length;
284
+ if ($(() => {
285
+ _(e, w, r, Object.keys(h));
286
+ }, [h, w, r, e]), c.styles === null || !h || x < 1)
287
+ return null;
288
+ if (typeof c.styles == "function")
289
+ return console.warn(
290
+ "Addon Viewport no longer supports dynamic styles using a function, use css calc() instead"
291
+ ), null;
292
+ let N = f ? c.styles.height : c.styles.width, W = f ? c.styles.width : c.styles.height;
293
+ return E ? null : /* @__PURE__ */ o.createElement(
294
+ o0,
295
+ {
296
+ item: c,
297
+ updateGlobals: r,
298
+ viewportMap: h,
299
+ viewportName: w,
300
+ isRotated: f,
301
+ setIsTooltipVisible: s,
302
+ isLocked: p,
303
+ isActive: R,
304
+ width: N,
305
+ height: W
306
+ }
307
+ );
308
+ }, "ViewportTool"), o0 = o.memo(/* @__PURE__ */ n(function(t) {
309
+ let {
310
+ item: a,
311
+ viewportMap: r,
312
+ viewportName: g,
313
+ isRotated: u,
314
+ updateGlobals: s,
315
+ setIsTooltipVisible: h,
316
+ isLocked: E,
317
+ isActive: v,
318
+ width: w,
319
+ height: f
320
+ } = t, c = Q(
321
+ (R) => s({ [d]: R }),
322
+ [s]
323
+ );
324
+ return /* @__PURE__ */ o.createElement(J, null, /* @__PURE__ */ o.createElement(
325
+ a0,
326
+ {
327
+ placement: "bottom",
328
+ tooltip: ({ onHide: R }) => /* @__PURE__ */ o.createElement(
329
+ t0,
330
+ {
331
+ links: [
332
+ ...length > 0 && a !== m ? [
333
+ {
334
+ id: "reset",
335
+ title: "Reset viewport",
336
+ icon: /* @__PURE__ */ o.createElement(B, null),
337
+ onClick: /* @__PURE__ */ n(() => {
338
+ c({ value: void 0, isRotated: !1 }), R();
339
+ }, "onClick")
340
+ }
341
+ ] : [],
342
+ ...Object.entries(r).map(([p, x]) => ({
343
+ id: p,
344
+ title: x.name,
345
+ icon: G[x.type],
346
+ active: p === g,
347
+ onClick: /* @__PURE__ */ n(() => {
348
+ c({ value: p, isRotated: !1 }), R();
349
+ }, "onClick")
350
+ }))
351
+ ].flat()
352
+ }
353
+ ),
354
+ closeOnOutsideClick: !0,
355
+ onVisibleChange: h
356
+ },
357
+ /* @__PURE__ */ o.createElement(
358
+ D,
359
+ {
360
+ disabled: E,
361
+ key: "viewport",
362
+ title: "Change the size of the preview",
363
+ active: v,
364
+ onDoubleClick: () => {
365
+ c({ value: void 0, isRotated: !1 });
366
+ }
367
+ },
368
+ /* @__PURE__ */ o.createElement(H, null),
369
+ a !== m ? /* @__PURE__ */ o.createElement(T, null, a.name, " ", u ? "(L)" : "(P)") : null
370
+ )
371
+ ), /* @__PURE__ */ o.createElement(
372
+ n0,
373
+ {
374
+ styles: {
375
+ 'iframe[data-is-storybook="true"]': { width: w, height: f }
376
+ }
377
+ }
378
+ ), a !== m ? /* @__PURE__ */ o.createElement(k, null, /* @__PURE__ */ o.createElement(I, { title: "Viewport width" }, w.replace("px", "")),
379
+ E ? "/" : /* @__PURE__ */ o.createElement(
380
+ e0,
381
+ {
382
+ key: "viewport-rotate",
383
+ title: "Rotate viewport",
384
+ onClick: () => {
385
+ c({ value: g, isRotated: !u });
386
+ }
387
+ },
388
+ /* @__PURE__ */ o.createElement(V, null)
389
+ ), /* @__PURE__ */ o.createElement(I, { title: "Viewport height" }, f.replace("px", ""))) : null);
390
+ }, "PureTool"));
391
+
392
+ // src/viewport/manager.tsx
393
+ O.register(i, (e) => {
394
+ O.add(y, {
395
+ title: "viewport / media-queries",
396
+ type: c0.TOOL,
397
+ match: /* @__PURE__ */ n(({ viewMode: t, tabId: a }) => t === "story" && !a, "match"),
398
+ render: /* @__PURE__ */ n(() => /* @__PURE__ */ F.createElement(U, { api: e }), "render")
399
+ });
400
+ });
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var p = Object.defineProperty;
3
+ var c = Object.getOwnPropertyDescriptor;
4
+ var d = Object.getOwnPropertyNames;
5
+ var m = Object.prototype.hasOwnProperty;
6
+ var l = (t, o) => p(t, "name", { value: o, configurable: !0 });
7
+ var x = (t, o) => {
8
+ for (var r in o)
9
+ p(t, r, { get: o[r], enumerable: !0 });
10
+ }, A = (t, o, r, i) => {
11
+ if (o && typeof o == "object" || typeof o == "function")
12
+ for (let e of d(o))
13
+ !m.call(t, e) && e !== r && p(t, e, { get: () => o[e], enumerable: !(i = c(o, e)) || i.enumerable });
14
+ return t;
15
+ };
16
+ var D = (t) => A(p({}, "__esModule", { value: !0 }), t);
17
+
18
+ // src/viewport/preview.ts
19
+ var b = {};
20
+ x(b, {
21
+ default: () => _,
22
+ initialGlobals: () => f
23
+ });
24
+ module.exports = D(b);
25
+ var s = require("storybook/preview-api");
26
+
27
+ // src/viewport/constants.ts
28
+ var a = "storybook/viewport", n = "viewport", P = `${a}/panel`, R = `${a}/tool`;
29
+
30
+ // src/viewport/preview.ts
31
+ var f = {
32
+ [n]: { value: void 0, isRotated: !1 }
33
+ }, _ = /* @__PURE__ */ l(() => (0, s.definePreview)({
34
+ initialGlobals: f
35
+ }), "default");