@typespec/playground 0.3.0-dev.9 → 0.3.0

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 (122) hide show
  1. package/dist/.storybook/main.d.ts +5 -0
  2. package/dist/.storybook/main.d.ts.map +1 -0
  3. package/dist/.storybook/preview.d.ts +5 -0
  4. package/dist/.storybook/preview.d.ts.map +1 -0
  5. package/dist/index.js +31 -34
  6. package/dist/react/index.js +1430 -783
  7. package/dist/react/viewers/index.js +8 -7
  8. package/dist/react-wrapper-CT3xxCSW.js +20 -0
  9. package/dist/src/browser-host.d.ts +3 -2
  10. package/dist/src/browser-host.d.ts.map +1 -1
  11. package/dist/src/core.d.ts +1 -1
  12. package/dist/src/core.d.ts.map +1 -1
  13. package/dist/src/editor-command-bar/editor-command-bar.d.ts +4 -3
  14. package/dist/src/editor-command-bar/editor-command-bar.d.ts.map +1 -1
  15. package/dist/src/index.d.ts +5 -5
  16. package/dist/src/index.d.ts.map +1 -1
  17. package/dist/src/lsp/monaco-to-lsp.d.ts +1 -1
  18. package/dist/src/manifest.d.ts +2 -4
  19. package/dist/src/manifest.d.ts.map +1 -1
  20. package/dist/src/react/context/index.d.ts +1 -1
  21. package/dist/src/react/context/index.d.ts.map +1 -1
  22. package/dist/src/react/context/playground-context.d.ts +4 -4
  23. package/dist/src/react/context/playground-context.d.ts.map +1 -1
  24. package/dist/src/react/default-footer.d.ts +2 -1
  25. package/dist/src/react/default-footer.d.ts.map +1 -1
  26. package/dist/src/react/diagnostic-list/diagnostic-list.d.ts +3 -2
  27. package/dist/src/react/diagnostic-list/diagnostic-list.d.ts.map +1 -1
  28. package/dist/src/react/editor.d.ts +3 -2
  29. package/dist/src/react/editor.d.ts.map +1 -1
  30. package/dist/src/react/emitter-dropdown.d.ts +2 -1
  31. package/dist/src/react/emitter-dropdown.d.ts.map +1 -1
  32. package/dist/src/react/file-output/file-output.d.ts +6 -5
  33. package/dist/src/react/file-output/file-output.d.ts.map +1 -1
  34. package/dist/src/react/footer/footer-item.d.ts +2 -1
  35. package/dist/src/react/footer/footer-item.d.ts.map +1 -1
  36. package/dist/src/react/footer/footer-version-item.d.ts +1 -1
  37. package/dist/src/react/footer/footer.d.ts +2 -1
  38. package/dist/src/react/footer/footer.d.ts.map +1 -1
  39. package/dist/src/react/footer/index.d.ts +3 -3
  40. package/dist/src/react/footer/index.d.ts.map +1 -1
  41. package/dist/src/react/index.d.ts +6 -6
  42. package/dist/src/react/index.d.ts.map +1 -1
  43. package/dist/src/react/output-tabs/output-tabs.d.ts +3 -7
  44. package/dist/src/react/output-tabs/output-tabs.d.ts.map +1 -1
  45. package/dist/src/react/output-view/file-viewer.d.ts +4 -0
  46. package/dist/src/react/output-view/file-viewer.d.ts.map +1 -0
  47. package/dist/src/react/output-view/output-view.d.ts +9 -4
  48. package/dist/src/react/output-view/output-view.d.ts.map +1 -1
  49. package/dist/src/react/output-view/type-graph-viewer.d.ts +4 -0
  50. package/dist/src/react/output-view/type-graph-viewer.d.ts.map +1 -0
  51. package/dist/src/react/playground.d.ts +8 -5
  52. package/dist/src/react/playground.d.ts.map +1 -1
  53. package/dist/src/react/problem-pane/header.d.ts +4 -3
  54. package/dist/src/react/problem-pane/header.d.ts.map +1 -1
  55. package/dist/src/react/problem-pane/index.d.ts +1 -1
  56. package/dist/src/react/problem-pane/problem-pane.d.ts +4 -3
  57. package/dist/src/react/problem-pane/problem-pane.d.ts.map +1 -1
  58. package/dist/src/react/samples-dropdown.d.ts +3 -2
  59. package/dist/src/react/samples-dropdown.d.ts.map +1 -1
  60. package/dist/src/react/settings/compiler-settings-dialog-button.d.ts +2 -1
  61. package/dist/src/react/settings/compiler-settings.d.ts +4 -3
  62. package/dist/src/react/settings/compiler-settings.d.ts.map +1 -1
  63. package/dist/src/react/settings/emitter-options-form.d.ts +4 -3
  64. package/dist/src/react/settings/emitter-options-form.d.ts.map +1 -1
  65. package/dist/src/react/settings/linter-form.d.ts +4 -3
  66. package/dist/src/react/settings/linter-form.d.ts.map +1 -1
  67. package/dist/src/react/split-pane/index.d.ts +1 -1
  68. package/dist/src/react/split-pane/index.d.ts.map +1 -1
  69. package/dist/src/react/split-pane/pane.d.ts +2 -1
  70. package/dist/src/react/split-pane/pane.d.ts.map +1 -1
  71. package/dist/src/react/split-pane/sash-content.d.ts +2 -1
  72. package/dist/src/react/split-pane/sash-content.d.ts.map +1 -1
  73. package/dist/src/react/split-pane/sash.d.ts +2 -1
  74. package/dist/src/react/split-pane/sash.d.ts.map +1 -1
  75. package/dist/src/react/split-pane/split-pane.d.ts +2 -1
  76. package/dist/src/react/split-pane/split-pane.d.ts.map +1 -1
  77. package/dist/src/react/standalone.d.ts +5 -4
  78. package/dist/src/react/standalone.d.ts.map +1 -1
  79. package/dist/src/react/types.d.ts +20 -8
  80. package/dist/src/react/types.d.ts.map +1 -1
  81. package/dist/src/react/typespec-editor.d.ts +5 -4
  82. package/dist/src/react/typespec-editor.d.ts.map +1 -1
  83. package/dist/src/react/viewers/index.d.ts +2 -1
  84. package/dist/src/react/viewers/index.d.ts.map +1 -1
  85. package/dist/src/react/viewers/swagger-ui.d.ts +2 -2
  86. package/dist/src/react/viewers/swagger-ui.d.ts.map +1 -1
  87. package/dist/src/services.d.ts +3 -2
  88. package/dist/src/services.d.ts.map +1 -1
  89. package/dist/src/tooling/index.d.ts +2 -1
  90. package/dist/src/tooling/index.d.ts.map +1 -1
  91. package/dist/src/tooling/types.d.ts +2 -1
  92. package/dist/src/tooling/types.d.ts.map +1 -1
  93. package/dist/src/types.d.ts +2 -1
  94. package/dist/src/types.d.ts.map +1 -1
  95. package/dist/src/vite/index.d.ts +3 -2
  96. package/dist/src/vite/index.d.ts.map +1 -1
  97. package/dist/src/vite/types.d.ts +4 -3
  98. package/dist/src/vite/types.d.ts.map +1 -1
  99. package/dist/state-storage-BjOULkS3.js +654 -0
  100. package/dist/stories/footer/footer-item.stories.d.ts +9 -0
  101. package/dist/stories/footer/footer-item.stories.d.ts.map +1 -0
  102. package/dist/stories/footer/footer-version-item.stories.d.ts +9 -0
  103. package/dist/stories/footer/footer-version-item.stories.d.ts.map +1 -0
  104. package/dist/stories/footer/footer.stories.d.ts +9 -0
  105. package/dist/stories/footer/footer.stories.d.ts.map +1 -0
  106. package/dist/stories/playground.stories.d.ts +9 -0
  107. package/dist/stories/playground.stories.d.ts.map +1 -0
  108. package/dist/{index.css → style.css} +168 -161
  109. package/dist/tooling/index.js +18 -23
  110. package/dist/vite/index.js +74 -76
  111. package/dist/vite.config.d.ts +3 -0
  112. package/dist/vite.config.d.ts.map +1 -0
  113. package/package.json +39 -38
  114. package/dist/index.js.map +0 -1
  115. package/dist/react/index.js.map +0 -1
  116. package/dist/react/viewers/index.js.map +0 -1
  117. package/dist/react-wrapper-uSmRU7Jg.js +0 -21
  118. package/dist/react-wrapper-uSmRU7Jg.js.map +0 -1
  119. package/dist/state-storage-CObxFEXn.js +0 -657
  120. package/dist/state-storage-CObxFEXn.js.map +0 -1
  121. package/dist/tooling/index.js.map +0 -1
  122. package/dist/vite/index.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"playground.stories.d.ts","sourceRoot":"","sources":["../../stories/playground.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAQxD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAIjC,CAAC;AACF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,UAAU,CAAC,CAAC;AAEzC,eAAO,MAAM,OAAO,EAAE,KAIrB,CAAC;AAqBF,eAAO,MAAM,YAAY,EAAE,KAM1B,CAAC"}
@@ -1,39 +1,4 @@
1
- .playground-module_layout__SCPgt {
2
- display: flex;
3
- flex-direction: column;
4
- width: 100%;
5
- height: 100%;
6
- overflow: hidden;
7
- }
8
-
9
- .editor-command-bar-module_bar__5q4D5 {
10
- border-bottom: 1px solid var(--colorNeutralStroke1);
11
- }
12
-
13
- .editor-command-bar-module_divider__iDahk {
14
- flex: 1;
15
- }
16
-
17
- .editor-command-bar-module_spacer__hlHE9 {
18
- width: 10px;
19
- }
20
-
21
- .swagger-ui-module_swagger-ui-container__6pJ6L {
22
- width: 100%;
23
- height: 100%;
24
- overflow: auto;
25
- }
26
-
27
- .footer-version-item-module_version-item__pjuvV {
28
- padding: 0;
29
- }
30
- .footer-version-item-module_button__70iqf {
31
- cursor: pointer;
32
- height: 100%;
33
- padding: 0 5px;
34
- }
35
-
36
- .footer-module_footer__QqUEE {
1
+ ._footer_cn8nf_1 {
37
2
  grid-area: footer;
38
3
  display: flex;
39
4
  font-size: 14px;
@@ -41,191 +6,150 @@
41
6
  background-color: #007acc;
42
7
  }
43
8
 
44
- .footer-module_footer-item__7rhbZ {
9
+ ._footer-item_cn8nf_9 {
45
10
  text-decoration: none;
46
11
  color: #fefefe;
47
12
  border-right: 1px solid #d5d5d5;
48
13
  padding: 0 5px;
49
14
  }
50
15
 
51
- .footer-module_footer-item__7rhbZ:hover {
16
+ ._footer-item_cn8nf_9:hover {
52
17
  background-color: #063a5c;
53
18
  }
54
-
55
- .output-view-module_output-view__uT5Ae {
56
- display: flex;
57
- flex-direction: column;
58
- height: 100%;
59
- }
60
-
61
- .output-view-module_output-content__Lis-G {
62
- flex: 1;
63
- min-height: 0;
64
- }
65
-
66
- .output-view-module_type-graph-viewer__tUDEV {
67
- height: 100%;
68
- overflow-y: auto;
69
- }
70
-
71
- .split-pane-module_split-pane__XCqR8 {
72
- flex: 1;
73
- height: 100%;
74
- position: relative;
75
- width: 100%;
76
- }
77
-
78
- .split-pane-module_split-disabled__fZ0Sg {
79
- user-select: none;
80
- }
81
-
82
- .split-pane-module_split-pane-dragging__mQJnZ.split-pane-module_react-split-vertical__WTUQ1 {
83
- cursor: col-resize;
84
- }
85
-
86
- .split-pane-module_split-pane-dragging__mQJnZ.split-pane-module_react-split-horizontal__Fpls- {
87
- cursor: row-resize;
88
- }
89
-
90
- .split-pane-module_sash__hNWH6 {
91
- height: 100%;
92
- position: absolute;
93
- top: 0;
94
- transition: background-color 0.1s;
95
- width: 100%;
96
- z-index: 2;
97
- }
98
-
99
- .split-pane-module_sash-disabled__z6uCV {
100
- pointer-events: none;
101
- }
102
-
103
- .split-pane-module_sash-vertical__S8HbH {
104
- cursor: col-resize;
105
- }
106
-
107
- .split-pane-module_sash-horizontal__BTUaN {
108
- cursor: row-resize;
19
+ ._version-item_1c15n_1 {
20
+ padding: 0;
109
21
  }
110
-
111
- .split-pane-module_sash-content__DLAt4 {
112
- width: 100%;
22
+ ._button_1c15n_4 {
23
+ cursor: pointer;
113
24
  height: 100%;
114
- background-color: var(--colorNeutralStroke2);
25
+ padding: 0 5px;
115
26
  }
116
-
117
- .split-pane-module_sash-content-dragging__NkKQP,
118
- .split-pane-module_sash-content__DLAt4:hover {
119
- background-color: var(--colorNeutralStroke1Pressed);
27
+ ._form_sqeas_1 {
28
+ display: flex;
29
+ flex-direction: column;
30
+ gap: 20px;
120
31
  }
121
32
 
122
- .split-pane-module_sash-vertical__S8HbH .split-pane-module_sash-content__DLAt4 {
123
- width: 1px;
124
- margin-left: 1px;
33
+ ._item_sqeas_7 {
34
+ display: flex;
35
+ flex-direction: column;
36
+ gap: 10px;
125
37
  }
126
38
 
127
- .split-pane-module_sash-horizontal__BTUaN .split-pane-module_sash-content__DLAt4 {
128
- height: 1px;
129
- margin-top: 1px;
39
+ ._switch_sqeas_13 label {
40
+ padding-left: 0;
130
41
  }
131
-
132
- .split-pane-module_sash-vertical__S8HbH .split-pane-module_sash-content-dragging__NkKQP {
133
- width: 100%;
42
+ ._bar_15c2c_1 {
43
+ border-bottom: 1px solid var(--colorNeutralStroke1);
134
44
  }
135
45
 
136
- .split-pane-module_sash-horizontal__BTUaN .split-pane-module_sash-content-dragging__NkKQP {
137
- height: 100%;
46
+ ._divider_15c2c_5 {
47
+ flex: 1;
138
48
  }
139
49
 
140
- .split-pane-module_pane__m1zQB {
141
- height: 100%;
142
- position: absolute;
143
- white-space: normal;
144
- width: 100%;
145
- overflow: hidden;
50
+ ._spacer_15c2c_9 {
51
+ width: 10px;
146
52
  }
147
-
148
- .file-output-module_file-output__YBaE7 {
53
+ ._file-output_jzw6j_1 {
149
54
  position: relative;
150
55
  height: 100%;
151
56
  }
152
- .file-output-module_viewer-selector__fNWoo {
57
+ ._viewer-selector_jzw6j_5 {
153
58
  margin: 0.5rem 1.5rem;
154
59
  position: absolute;
155
60
  z-index: 1;
156
61
  right: 0;
157
62
  }
158
-
159
- .output-tabs-module_tabs__MFCRl {
63
+ ._tabs_1x6x2_1 {
160
64
  border-bottom: 1px solid var(--colorNeutralStroke1);
161
65
  box-shadow: var(--shadow2);
66
+ overflow-y: auto;
162
67
  }
163
68
 
164
- .output-tabs-module_tab-divider__9Fv-- {
69
+ ._tab-divider_1x6x2_7 {
165
70
  flex: 1;
166
71
  border-right: 1px solid var(--colorNeutralStroke1);
167
72
  }
168
73
 
169
- .output-tabs-module_tab__FJ78k {
74
+ ._tab_1x6x2_1 {
170
75
  height: 40px;
171
76
  border-right: 1px solid var(--colorNeutralStroke1) !important;
172
77
  border-radius: 0 !important;
173
78
  }
174
79
 
175
- .output-tabs-module_tab--selected__GjCZY {
80
+ ._tab--selected_1x6x2_18 {
176
81
  background-color: var(--colorNeutralBackground5) !important;
177
82
  }
178
-
179
- .problem-pane-module_problem-pane__GJKF4 {
83
+ ._output-view_18pnu_1 {
84
+ display: flex;
85
+ flex-direction: row;
180
86
  height: 100%;
181
- background-color: var(--colorNeutralBackground3);
87
+ }
88
+ ._file-viewer_18pnu_6 {
182
89
  display: flex;
183
90
  flex-direction: column;
184
- max-height: 100%;
91
+ height: 100%;
185
92
  }
186
93
 
187
- .problem-pane-module_problem-content__rYzbh {
188
- overflow-y: auto;
94
+ ._output-content_18pnu_12 {
95
+ flex: 1;
96
+ min-width: 0;
189
97
  }
190
- .problem-pane-module_no-problems__Ub8R- {
191
- padding: 10px;
98
+ ._file-viewer-content_18pnu_16 {
99
+ flex: 1;
100
+ min-height: 0;
192
101
  }
193
102
 
194
- .problem-pane-module_internal-compiler-error__laE4f {
195
- padding: 10px;
103
+ ._type-graph-viewer_18pnu_21 {
104
+ height: 100%;
105
+ overflow-y: auto;
196
106
  }
197
107
 
198
- .diagnostic-list-module_list__6tVpz {
108
+ ._viewer-tabs-container_18pnu_26 {
109
+ background-color: var(--colorNeutralBackground3);
110
+ }
111
+ ._layout_l03ni_1 {
112
+ display: flex;
113
+ flex-direction: column;
114
+ width: 100%;
115
+ height: 100%;
116
+ overflow: hidden;
117
+ }
118
+
119
+ ._edit-pane_l03ni_9 {
120
+ display: flex;
121
+ flex-direction: column;
122
+ }
123
+ ._list_wrnwm_1 {
199
124
  }
200
125
 
201
- .diagnostic-list-module_item__BE8Fr {
126
+ ._item_wrnwm_4 {
202
127
  cursor: pointer;
203
128
  display: flex;
204
129
  gap: 10px;
205
130
  padding: 0 10px;
206
131
  }
207
132
 
208
- .diagnostic-list-module_item__BE8Fr:hover {
133
+ ._item_wrnwm_4:hover {
209
134
  background-color: var(--colorNeutralBackground3Hover);
210
135
  }
211
136
 
212
- .diagnostic-list-module_item--error__tnhWA {
137
+ ._item--error_wrnwm_15 {
213
138
  color: var(--colorStatusDangerForeground1);
214
139
  }
215
140
 
216
- .diagnostic-list-module_item--warning__J7vIN {
141
+ ._item--warning_wrnwm_19 {
217
142
  color: var(--colorStatusWarningForeground1);
218
143
  }
219
144
 
220
- .diagnostic-list-module_item-code__AgVjZ {
145
+ ._item-code_wrnwm_23 {
221
146
  color: var(--colorBrandForeground2);
222
147
  }
223
148
 
224
- .diagnostic-list-module_item-loc__IeYnW {
149
+ ._item-loc_wrnwm_27 {
225
150
  color: var(--colorNeutralForeground3);
226
151
  }
227
-
228
- .header-module_header__LyUNg {
152
+ ._header_1qhql_1 {
229
153
  padding: 5px;
230
154
  cursor: pointer;
231
155
  display: flex;
@@ -236,49 +160,132 @@
236
160
  box-shadow: var(--shadow2);
237
161
  }
238
162
 
239
- .header-module_header--error__8MKzf {
163
+ ._header--error_1qhql_12 {
240
164
  background-color: var(--colorStatusDangerBackground2);
241
165
  color: var(--colorNeutralForeground1);
242
166
  }
243
167
 
244
- .header-module_error-icon__gb-oB {
168
+ ._error-icon_1qhql_17 {
245
169
  color: var(--colorStatusDangerForeground1);
246
170
  }
247
171
 
248
- .header-module_header--warning__QPFEE {
172
+ ._header--warning_1qhql_21 {
249
173
  background-color: var(--colorStatusWarningBackground2);
250
174
  color: var(--colorNeutralForeground2);
251
175
  }
252
176
 
253
- .header-module_warning-icon__u14P3 {
177
+ ._warning-icon_1qhql_26 {
254
178
  color: var(--colorStatusWarningForeground1);
255
179
  }
256
180
 
257
- .header-module_header-content__Uc4HJ {
181
+ ._header-content_1qhql_30 {
258
182
  display: flex;
259
183
  align-items: center;
260
184
  gap: 10px;
261
185
  }
262
186
 
263
- .header-module_header-chevron__HXm6b {
187
+ ._header-chevron_1qhql_36 {
264
188
  transition: transform 0.2s ease-in-out;
265
189
  }
266
- .header-module_header-chevron--collapsed__wKyHV {
190
+ ._header-chevron--collapsed_1qhql_39 {
267
191
  transform: rotate(90deg);
268
192
  }
269
-
270
- .emitter-options-form-module_form__dm2RP {
193
+ ._problem-pane_kxgwp_1 {
194
+ height: 100%;
195
+ background-color: var(--colorNeutralBackground3);
271
196
  display: flex;
272
197
  flex-direction: column;
273
- gap: 20px;
198
+ max-height: 100%;
274
199
  }
275
200
 
276
- .emitter-options-form-module_item__WocHP {
277
- display: flex;
278
- flex-direction: column;
279
- gap: 10px;
201
+ ._problem-content_kxgwp_9 {
202
+ overflow-y: auto;
203
+ }
204
+ ._no-problems_kxgwp_12 {
205
+ padding: 10px;
280
206
  }
281
207
 
282
- .emitter-options-form-module_switch__d4EQs label {
283
- padding-left: 0;
208
+ ._internal-compiler-error_kxgwp_16 {
209
+ padding: 10px;
210
+ }
211
+ ._split-pane_v2eo6_1 {
212
+ flex: 1;
213
+ height: 100%;
214
+ position: relative;
215
+ width: 100%;
216
+ }
217
+
218
+ ._split-disabled_v2eo6_8 {
219
+ user-select: none;
220
+ }
221
+
222
+ ._split-pane-dragging_v2eo6_12._react-split-vertical_v2eo6_12 {
223
+ cursor: col-resize;
224
+ }
225
+
226
+ ._split-pane-dragging_v2eo6_12._react-split-horizontal_v2eo6_16 {
227
+ cursor: row-resize;
228
+ }
229
+
230
+ ._sash_v2eo6_20 {
231
+ height: 100%;
232
+ position: absolute;
233
+ top: 0;
234
+ transition: background-color 0.1s;
235
+ width: 100%;
236
+ z-index: 2;
237
+ }
238
+
239
+ ._sash-disabled_v2eo6_29 {
240
+ pointer-events: none;
241
+ }
242
+
243
+ ._sash-vertical_v2eo6_33 {
244
+ cursor: col-resize;
245
+ }
246
+
247
+ ._sash-horizontal_v2eo6_37 {
248
+ cursor: row-resize;
249
+ }
250
+
251
+ ._sash-content_v2eo6_41 {
252
+ width: 100%;
253
+ height: 100%;
254
+ background-color: var(--colorNeutralStroke2);
255
+ }
256
+
257
+ ._sash-content-dragging_v2eo6_47,
258
+ ._sash-content_v2eo6_41:hover {
259
+ background-color: var(--colorNeutralStroke1Pressed);
260
+ }
261
+
262
+ ._sash-vertical_v2eo6_33 ._sash-content_v2eo6_41 {
263
+ width: 1px;
264
+ margin-left: 1px;
265
+ }
266
+
267
+ ._sash-horizontal_v2eo6_37 ._sash-content_v2eo6_41 {
268
+ height: 1px;
269
+ margin-top: 1px;
270
+ }
271
+
272
+ ._sash-vertical_v2eo6_33 ._sash-content-dragging_v2eo6_47 {
273
+ width: 100%;
274
+ }
275
+
276
+ ._sash-horizontal_v2eo6_37 ._sash-content-dragging_v2eo6_47 {
277
+ height: 100%;
278
+ }
279
+
280
+ ._pane_v2eo6_70 {
281
+ height: 100%;
282
+ position: absolute;
283
+ white-space: normal;
284
+ width: 100%;
285
+ overflow: hidden;
286
+ }
287
+ ._swagger-ui-container_1c81n_1 {
288
+ width: 100%;
289
+ height: 100%;
290
+ overflow: auto;
284
291
  }
@@ -1,30 +1,25 @@
1
1
  import { getDirectoryPath } from '@typespec/compiler';
2
2
  import { readFile, mkdir, writeFile } from 'fs/promises';
3
3
 
4
- /**
5
- * @experimental This API is experimental
6
- */
7
4
  async function buildSamples_experimental(rootDir, output, samples) {
8
- const resolvedSamples = {};
9
- for (const [name, config] of Object.entries(samples)) {
10
- const content = await readFile(`${rootDir}/${config.filename}`, "utf-8");
11
- resolvedSamples[name] = {
12
- filename: config.filename,
13
- content,
14
- preferredEmitter: config.preferredEmitter,
15
- compilerOptions: config.compilerOptions,
16
- };
17
- }
18
- const dir = getDirectoryPath(output);
19
- await mkdir(dir, { recursive: true });
20
- // await writeFile(output, content);
21
- const dts = [
22
- `import type { PlaygroundSample } from "@typespec/playground";`,
23
- `const samples: Record<string, PlaygroundSample> = ${JSON.stringify(resolvedSamples, null, 2)};`,
24
- `export default samples;`,
25
- ].join("\n");
26
- await writeFile(output, dts);
5
+ const resolvedSamples = {};
6
+ for (const [name, config] of Object.entries(samples)) {
7
+ const content = await readFile(`${rootDir}/${config.filename}`, "utf-8");
8
+ resolvedSamples[name] = {
9
+ filename: config.filename,
10
+ content,
11
+ preferredEmitter: config.preferredEmitter,
12
+ compilerOptions: config.compilerOptions
13
+ };
14
+ }
15
+ const dir = getDirectoryPath(output);
16
+ await mkdir(dir, { recursive: true });
17
+ const dts = [
18
+ `import type { PlaygroundSample } from "@typespec/playground";`,
19
+ `const samples: Record<string, PlaygroundSample> = ${JSON.stringify(resolvedSamples, null, 2)};`,
20
+ `export default samples;`
21
+ ].join("\n");
22
+ await writeFile(output, dts);
27
23
  }
28
24
 
29
25
  export { buildSamples_experimental };
30
- //# sourceMappingURL=index.js.map
@@ -2,92 +2,90 @@ import { typespecBundlePlugin } from '@typespec/bundler/vite';
2
2
  import react from '@vitejs/plugin-react';
3
3
 
4
4
  function definePlaygroundViteConfig(config) {
5
- return {
6
- base: "./",
7
- build: {
8
- target: "esnext",
9
- chunkSizeWarningLimit: 5000,
10
- rollupOptions: {
11
- output: {
12
- manualChunks(id) {
13
- if (id.includes("/node_modules/monaco-editor/esm/vs/editor")) {
14
- return "monaco";
15
- }
16
- return undefined;
17
- },
18
- },
19
- },
20
- },
21
- esbuild: {
22
- logOverride: { "this-is-undefined-in-esm": "silent" },
23
- },
24
- assetsInclude: [/\.tsp$/],
25
- optimizeDeps: {
26
- exclude: ["swagger-ui"],
27
- },
28
- plugins: [
29
- react({}),
30
- playgroundManifestPlugin(config),
31
- !config.skipBundleLibraries
32
- ? typespecBundlePlugin({
33
- folderName: "libs",
34
- libraries: config.libraries,
35
- })
36
- : undefined,
37
- ],
38
- server: {
39
- fs: {
40
- strict: false,
41
- },
42
- },
43
- };
5
+ return {
6
+ base: "./",
7
+ build: {
8
+ target: "esnext",
9
+ chunkSizeWarningLimit: 5e3,
10
+ rollupOptions: {
11
+ output: {
12
+ manualChunks(id) {
13
+ if (id.includes("/node_modules/monaco-editor/esm/vs/editor")) {
14
+ return "monaco";
15
+ }
16
+ return void 0;
17
+ }
18
+ }
19
+ }
20
+ },
21
+ esbuild: {
22
+ logOverride: { "this-is-undefined-in-esm": "silent" }
23
+ },
24
+ assetsInclude: [/\.tsp$/],
25
+ optimizeDeps: {
26
+ exclude: ["swagger-ui"]
27
+ },
28
+ plugins: [
29
+ react({}),
30
+ playgroundManifestPlugin(config),
31
+ !config.skipBundleLibraries ? typespecBundlePlugin({
32
+ folderName: "libs",
33
+ libraries: config.libraries
34
+ }) : void 0
35
+ ],
36
+ server: {
37
+ fs: {
38
+ strict: false
39
+ }
40
+ }
41
+ };
44
42
  }
45
43
  function playgroundManifestPlugin(config) {
46
- const { samples, ...manifest } = config;
47
- let viteConfig;
48
- return {
49
- name: "playground-manifest",
50
- enforce: "pre", // Need to run before resolving library imports to stub `@typespec/playground/manifest`
51
- async configResolved(c) {
52
- viteConfig = c;
53
- },
54
- resolveId(id) {
55
- if (id === "@typespec/playground/manifest") {
56
- return id;
57
- }
58
- return null;
59
- },
60
- load(id) {
61
- if (id === `@typespec/playground/manifest`) {
62
- const sampleImport = Object.values(samples ?? {})
63
- .map((sampleValue, index) => `import s${index} from "${viteConfig.root}/${sampleValue.filename}?raw"`)
64
- .join("\n");
65
- const sampleObj = [
66
- "{",
67
- ...Object.entries(samples ?? {}).map(([label, config], index) => `${JSON.stringify(label)}: {
68
- fileName: ${JSON.stringify(config.filename)},
69
- preferredEmitter: ${config.preferredEmitter ? JSON.stringify(config.preferredEmitter) : "undefined"},
44
+ const { samples, ...manifest } = config;
45
+ let viteConfig;
46
+ return {
47
+ name: "playground-manifest",
48
+ enforce: "pre",
49
+ // Need to run before resolving library imports to stub `@typespec/playground/manifest`
50
+ async configResolved(c) {
51
+ viteConfig = c;
52
+ },
53
+ resolveId(id) {
54
+ if (id === "@typespec/playground/manifest") {
55
+ return id;
56
+ }
57
+ return null;
58
+ },
59
+ load(id) {
60
+ if (id === `@typespec/playground/manifest`) {
61
+ const sampleImport = Object.values(samples ?? {}).map(
62
+ (sampleValue, index) => `import s${index} from "${viteConfig.root}/${sampleValue.filename}?raw"`
63
+ ).join("\n");
64
+ const sampleObj = [
65
+ "{",
66
+ ...Object.entries(samples ?? {}).map(
67
+ ([label, config2], index) => `${JSON.stringify(label)}: {
68
+ fileName: ${JSON.stringify(config2.filename)},
69
+ preferredEmitter: ${config2.preferredEmitter ? JSON.stringify(config2.preferredEmitter) : "undefined"},
70
70
  content: s${index},
71
- ${config.compilerOptions
72
- ? `compilerOptions: ${JSON.stringify(config.compilerOptions)},`
73
- : ""}
71
+ ${config2.compilerOptions ? `compilerOptions: ${JSON.stringify(config2.compilerOptions)},` : ""}
74
72
 
75
- }, `),
76
- "}",
77
- ].join("\n");
78
- const file = `
73
+ }, `
74
+ ),
75
+ "}"
76
+ ].join("\n");
77
+ const file = `
79
78
  ${sampleImport};
80
79
 
81
80
  export default {
82
81
  ...${JSON.stringify(manifest)},
83
82
  samples: ${sampleObj}
84
83
  };`;
85
- return file;
86
- }
87
- return undefined;
88
- },
89
- };
84
+ return file;
85
+ }
86
+ return void 0;
87
+ }
88
+ };
90
89
  }
91
90
 
92
91
  export { definePlaygroundViteConfig };
93
- //# sourceMappingURL=index.js.map
@@ -0,0 +1,3 @@
1
+ declare const _default: import('vite').UserConfig;
2
+ export default _default;
3
+ //# sourceMappingURL=vite.config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite.config.d.ts","sourceRoot":"","sources":["../vite.config.ts"],"names":[],"mappings":";AAwBA,wBAwCG"}