@kubohiroya/turbowarp-plus-editor-code-views 0.0.0-stage → 0.1.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.
- package/LICENSE +373 -0
- package/README.ja.md +38 -0
- package/README.md +37 -2
- package/dist/asset-edit-session.d.ts +24 -0
- package/dist/asset-edit-session.js +58 -0
- package/dist/block-argument-text.d.ts +39 -0
- package/dist/block-argument-text.js +170 -0
- package/dist/block-drag.d.ts +17 -0
- package/dist/block-drag.js +184 -0
- package/dist/code-extensions.d.ts +38 -0
- package/dist/code-extensions.js +418 -0
- package/dist/code-pane.d.ts +63 -0
- package/dist/code-pane.js +363 -0
- package/dist/custom-extension-fields.d.ts +45 -0
- package/dist/custom-extension-fields.js +144 -0
- package/dist/detached-block-palette-view.d.ts +10 -0
- package/dist/detached-block-palette-view.js +62 -0
- package/dist/detached-block-palette.d.ts +41 -0
- package/dist/detached-block-palette.js +197 -0
- package/dist/dockview-unsaved.d.ts +45 -0
- package/dist/dockview-unsaved.js +123 -0
- package/dist/history.d.ts +57 -0
- package/dist/history.js +85 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +729 -0
- package/dist/native-extension-field.d.ts +26 -0
- package/dist/native-extension-field.js +204 -0
- package/dist/native-field-svg.d.ts +20 -0
- package/dist/native-field-svg.js +156 -0
- package/dist/palette-category-reorder.d.ts +4 -0
- package/dist/palette-category-reorder.js +167 -0
- package/dist/palette-category-search.d.ts +26 -0
- package/dist/palette-category-search.js +74 -0
- package/dist/palette-dropdown-resize.d.ts +19 -0
- package/dist/palette-dropdown-resize.js +135 -0
- package/dist/parent-field-layout.d.ts +2 -0
- package/dist/parent-field-layout.js +90 -0
- package/dist/parent-field-mirror.d.ts +3 -0
- package/dist/parent-field-mirror.js +290 -0
- package/dist/parent-field-resources.d.ts +9 -0
- package/dist/parent-field-resources.js +199 -0
- package/dist/preview-chrome.d.ts +9 -0
- package/dist/preview-chrome.js +78 -0
- package/dist/procedure-editor.d.ts +9 -0
- package/dist/procedure-editor.js +122 -0
- package/dist/procedure-edits.d.ts +16 -0
- package/dist/procedure-edits.js +47 -0
- package/dist/programmatic-extension-field.d.ts +20 -0
- package/dist/programmatic-extension-field.js +69 -0
- package/dist/protocol.d.ts +15 -0
- package/dist/protocol.js +36 -0
- package/dist/script-layout-dialog.d.ts +10 -0
- package/dist/script-layout-dialog.js +93 -0
- package/dist/script-layout-view.d.ts +68 -0
- package/dist/script-layout-view.js +164 -0
- package/dist/script-layout-workspace.d.ts +45 -0
- package/dist/script-layout-workspace.js +55 -0
- package/dist/script-layout.d.ts +17 -0
- package/dist/script-layout.js +25 -0
- package/dist/script-view-menu.d.ts +46 -0
- package/dist/script-view-menu.js +161 -0
- package/dist/sprite-code-windows.d.ts +31 -0
- package/dist/sprite-code-windows.js +180 -0
- package/dist/stage-code-prewarm.d.ts +52 -0
- package/dist/stage-code-prewarm.js +216 -0
- package/dist/target-combobox.d.ts +10 -0
- package/dist/target-combobox.js +92 -0
- package/dist/variable-references.d.ts +1 -0
- package/dist/variable-references.js +87 -0
- package/dist/workspace.d.ts +103 -0
- package/dist/workspace.js +1102 -0
- package/package.json +100 -4
- package/src/asset-edit-session.ts +72 -0
- package/src/block-argument-text.ts +172 -0
- package/src/block-drag.ts +190 -0
- package/src/code-extensions.ts +394 -0
- package/src/code-pane.ts +353 -0
- package/src/custom-extension-fields.ts +154 -0
- package/src/detached-block-palette-view.tsx +97 -0
- package/src/detached-block-palette.ts +218 -0
- package/src/dockview-unsaved.ts +134 -0
- package/src/history.ts +114 -0
- package/src/index.ts +680 -0
- package/src/native-extension-field.ts +201 -0
- package/src/native-field-svg.ts +140 -0
- package/src/palette-category-reorder.ts +155 -0
- package/src/palette-category-search.ts +82 -0
- package/src/palette-dropdown-resize.ts +132 -0
- package/src/parent-field-layout.ts +88 -0
- package/src/parent-field-mirror.ts +260 -0
- package/src/parent-field-resources.ts +179 -0
- package/src/preview-chrome.ts +82 -0
- package/src/procedure-editor.ts +123 -0
- package/src/procedure-edits.ts +46 -0
- package/src/programmatic-extension-field.ts +76 -0
- package/src/protocol.ts +47 -0
- package/src/script-layout-dialog.ts +104 -0
- package/src/script-layout-view.ts +198 -0
- package/src/script-layout-workspace.ts +95 -0
- package/src/script-layout.ts +40 -0
- package/src/script-view-menu.ts +213 -0
- package/src/sprite-code-windows.tsx +182 -0
- package/src/stage-code-prewarm.ts +242 -0
- package/src/styles.css +595 -0
- package/src/target-combobox.tsx +106 -0
- package/src/variable-references.ts +85 -0
- package/src/workspace.ts +1124 -0
- package/tsconfig.json +23 -0
package/src/styles.css
ADDED
|
@@ -0,0 +1,595 @@
|
|
|
1
|
+
/* The target picker. */
|
|
2
|
+
|
|
3
|
+
.tw-target-combobox {
|
|
4
|
+
position: relative;
|
|
5
|
+
min-inline-size: 0;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.tw-target-combobox__field {
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
gap: 0.375rem;
|
|
12
|
+
inline-size: 10rem;
|
|
13
|
+
max-inline-size: 100%;
|
|
14
|
+
padding: 0.125rem 0.375rem;
|
|
15
|
+
border: 1px solid var(--ui-black-transparent, #d7dbe6);
|
|
16
|
+
border-radius: 0.5rem;
|
|
17
|
+
background: var(--input-background, #fff);
|
|
18
|
+
color: inherit;
|
|
19
|
+
font: inherit;
|
|
20
|
+
text-align: start;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.tw-target-combobox__field:focus-within {
|
|
24
|
+
outline: 2px solid var(--tw-window-control-focus, var(--looks-secondary, #3855b9));
|
|
25
|
+
outline-offset: 1px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.tw-target-combobox__field input {
|
|
29
|
+
flex: 1;
|
|
30
|
+
min-inline-size: 0;
|
|
31
|
+
border: 0;
|
|
32
|
+
background: transparent;
|
|
33
|
+
color: inherit;
|
|
34
|
+
font: inherit;
|
|
35
|
+
outline: none;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.tw-target-combobox__field button {
|
|
39
|
+
display: grid;
|
|
40
|
+
place-items: center;
|
|
41
|
+
padding: 0.25rem;
|
|
42
|
+
border: 0;
|
|
43
|
+
background: transparent;
|
|
44
|
+
color: inherit;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.tw-target-combobox__thumbnail {
|
|
48
|
+
flex: none;
|
|
49
|
+
inline-size: 1.75rem;
|
|
50
|
+
block-size: 1.75rem;
|
|
51
|
+
border-radius: 0.25rem;
|
|
52
|
+
object-fit: contain;
|
|
53
|
+
background: var(--ui-secondary, #f5f6fa);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.tw-target-combobox__options {
|
|
57
|
+
position: absolute;
|
|
58
|
+
inset-block-start: 100%;
|
|
59
|
+
inset-inline-start: 0;
|
|
60
|
+
box-sizing: border-box;
|
|
61
|
+
min-inline-size: 100%;
|
|
62
|
+
max-block-size: 14rem;
|
|
63
|
+
overflow: auto;
|
|
64
|
+
margin: 0.375rem 0 0;
|
|
65
|
+
padding: 0.25rem;
|
|
66
|
+
border: 1px solid var(--ui-black-transparent, #d7dbe6);
|
|
67
|
+
border-radius: 0.5rem;
|
|
68
|
+
background: var(--popover-background, #fff);
|
|
69
|
+
color: var(--text-primary, inherit);
|
|
70
|
+
box-shadow: 0 8px 24px #30364d24;
|
|
71
|
+
list-style: none;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.tw-target-combobox__options li {
|
|
75
|
+
display: flex;
|
|
76
|
+
gap: 0.5rem;
|
|
77
|
+
align-items: center;
|
|
78
|
+
padding: 0.25rem;
|
|
79
|
+
border-radius: 0.25rem;
|
|
80
|
+
cursor: pointer;
|
|
81
|
+
overflow-wrap: anywhere;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.tw-target-combobox__options li:hover,
|
|
85
|
+
.tw-target-combobox__highlight {
|
|
86
|
+
background: var(--ui-tertiary, #e9ecf5);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.tw-target-combobox__options [aria-selected="true"] {
|
|
90
|
+
font-weight: 600;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* The detached block palette. */
|
|
94
|
+
|
|
95
|
+
.tw-detached-palette {
|
|
96
|
+
position: fixed;
|
|
97
|
+
inset: 0;
|
|
98
|
+
display: grid;
|
|
99
|
+
grid-template-rows: minmax(0, 1fr);
|
|
100
|
+
color: var(--text-primary, #243248);
|
|
101
|
+
background: var(--ui-primary, #f5f6f8);
|
|
102
|
+
font: 14px system-ui, sans-serif;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.tw-detached-palette__content {
|
|
106
|
+
min-height: 0;
|
|
107
|
+
display: grid;
|
|
108
|
+
grid-template: "categories blocks" minmax(0, 1fr) / auto minmax(0, 1fr);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.tw-detached-palette[data-palette-orientation="vertical"] .tw-detached-palette__content {
|
|
112
|
+
grid-template: "categories" auto "blocks" minmax(0, 1fr) / minmax(0, 1fr);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.tw-detached-palette__categories,
|
|
116
|
+
.tw-detached-palette__blocks {
|
|
117
|
+
display: flex;
|
|
118
|
+
gap: 6px;
|
|
119
|
+
padding: 8px;
|
|
120
|
+
overflow: auto;
|
|
121
|
+
align-items: flex-start;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.tw-detached-palette__categories {
|
|
125
|
+
grid-area: categories;
|
|
126
|
+
flex-flow: column nowrap;
|
|
127
|
+
align-items: center;
|
|
128
|
+
background: var(--ui-secondary, #eceef4);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.tw-detached-palette__blocks {
|
|
132
|
+
grid-area: blocks;
|
|
133
|
+
flex-wrap: wrap;
|
|
134
|
+
align-content: flex-start;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.tw-detached-palette[data-palette-orientation="vertical"] .tw-detached-palette__categories {
|
|
138
|
+
flex-direction: row;
|
|
139
|
+
margin-right: calc(2rem + 12px);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.tw-detached-palette[data-palette-orientation="vertical"] .tw-detached-palette__blocks {
|
|
143
|
+
flex-flow: column nowrap;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.tw-detached-palette__categories button,
|
|
147
|
+
.tw-detached-palette__blocks button {
|
|
148
|
+
flex: none;
|
|
149
|
+
border: 1px solid transparent;
|
|
150
|
+
border-radius: 5px;
|
|
151
|
+
color: inherit;
|
|
152
|
+
background: transparent;
|
|
153
|
+
font: inherit;
|
|
154
|
+
padding: 5px 8px;
|
|
155
|
+
cursor: pointer;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.tw-detached-palette__categories button {
|
|
159
|
+
display: grid;
|
|
160
|
+
place-items: center;
|
|
161
|
+
inline-size: 40px;
|
|
162
|
+
block-size: 40px;
|
|
163
|
+
padding: 0;
|
|
164
|
+
border: 2px solid transparent;
|
|
165
|
+
border-radius: 50%;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.tw-detached-palette__categories button[aria-pressed="true"] {
|
|
169
|
+
border-color: currentColor;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.tw-detached-palette__categories button:focus-visible {
|
|
173
|
+
outline: 2px solid var(--looks-secondary, #4c72dd);
|
|
174
|
+
outline-offset: 2px;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.tw-detached-palette__category-icon {
|
|
178
|
+
display: grid;
|
|
179
|
+
place-items: center;
|
|
180
|
+
inline-size: 30px;
|
|
181
|
+
block-size: 30px;
|
|
182
|
+
border-radius: 50%;
|
|
183
|
+
color: var(--text-primary, #243248);
|
|
184
|
+
background: var(--ui-white, #fff) center / 22px 22px no-repeat;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.tw-detached-palette__category-icon svg {
|
|
188
|
+
inline-size: 18px;
|
|
189
|
+
block-size: 18px;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.tw-detached-palette__tooltip {
|
|
193
|
+
position: fixed;
|
|
194
|
+
z-index: 2;
|
|
195
|
+
transform: translateY(-50%);
|
|
196
|
+
max-inline-size: calc(100vw - 80px);
|
|
197
|
+
padding: 5px 8px;
|
|
198
|
+
border: 1px solid var(--ui-black-transparent, #d7dbe6);
|
|
199
|
+
border-radius: 5px;
|
|
200
|
+
color: var(--text-primary, #243248);
|
|
201
|
+
background: var(--ui-white, #fff);
|
|
202
|
+
overflow-wrap: anywhere;
|
|
203
|
+
pointer-events: none;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.tw-detached-palette[data-palette-orientation="vertical"] .tw-detached-palette__tooltip {
|
|
207
|
+
transform: none;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.tw-detached-palette__categories button[aria-pressed="true"],
|
|
211
|
+
.tw-detached-palette__categories button:hover,
|
|
212
|
+
.tw-detached-palette__blocks button:not(:disabled):hover {
|
|
213
|
+
background: var(--ui-black-transparent, #dce1ea);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.tw-detached-palette__blocks button svg {
|
|
217
|
+
display: block;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.tw-detached-palette__blocks button:disabled {
|
|
221
|
+
opacity: 0.55;
|
|
222
|
+
cursor: default;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.tw-detached-palette .tw-detached-palette__layout-menu {
|
|
226
|
+
position: fixed;
|
|
227
|
+
top: 8px;
|
|
228
|
+
right: 8px;
|
|
229
|
+
z-index: 3;
|
|
230
|
+
--tw-plus-icon-menu-max-width: calc(100vw - 16px);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.tw-detached-palette__layout-menu [role="menu"] {
|
|
234
|
+
inset-inline-end: auto;
|
|
235
|
+
right: 0;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/* Reordering palette categories. */
|
|
239
|
+
|
|
240
|
+
.tw-palette-category-reordering,
|
|
241
|
+
.tw-palette-category-reordering [data-palette-reorder-source],
|
|
242
|
+
.tw-palette-category-reordering [data-palette-reorder-target] {
|
|
243
|
+
cursor: grabbing;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.tw-palette-category-reordering [data-palette-reorder-source] {
|
|
247
|
+
opacity: 0.55;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.tw-palette-category-reordering [data-palette-reorder-target] {
|
|
251
|
+
outline: 2px solid currentColor;
|
|
252
|
+
outline-offset: -2px;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.tw-palette-category-drag-preview {
|
|
256
|
+
position: fixed;
|
|
257
|
+
z-index: 1000;
|
|
258
|
+
box-sizing: border-box;
|
|
259
|
+
pointer-events: none;
|
|
260
|
+
opacity: 0.65;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/* Searching palette categories. */
|
|
264
|
+
|
|
265
|
+
.tw-palette-category-search[type='search'] {
|
|
266
|
+
position: absolute;
|
|
267
|
+
top: 0;
|
|
268
|
+
left: 0;
|
|
269
|
+
z-index: 32;
|
|
270
|
+
box-sizing: border-box;
|
|
271
|
+
height: 28px;
|
|
272
|
+
padding-inline: 0.65rem;
|
|
273
|
+
border: 1px solid var(--ui-black-transparent, #c2c7d0);
|
|
274
|
+
border-radius: 999px;
|
|
275
|
+
background: var(--input-background, white);
|
|
276
|
+
color: var(--text-primary, #575e75);
|
|
277
|
+
font: inherit;
|
|
278
|
+
font-size: 0.8125rem;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/* Resizing palette dropdowns. */
|
|
282
|
+
|
|
283
|
+
.tw-palette-dropdown-resize-handle {
|
|
284
|
+
position: absolute;
|
|
285
|
+
top: 0;
|
|
286
|
+
left: 0;
|
|
287
|
+
z-index: 32;
|
|
288
|
+
cursor: nwse-resize;
|
|
289
|
+
touch-action: none;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.tw-palette-dropdown-resize-handle::after {
|
|
293
|
+
content: '';
|
|
294
|
+
position: absolute;
|
|
295
|
+
right: 3px;
|
|
296
|
+
bottom: 3px;
|
|
297
|
+
width: 10px;
|
|
298
|
+
height: 10px;
|
|
299
|
+
background: linear-gradient(135deg, transparent 51%, #68778c 51% 61%, transparent 61% 72%, #68778c 72% 82%, transparent 82%);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/* Long text arguments. */
|
|
303
|
+
|
|
304
|
+
.twPlusArgumentTextDialog {
|
|
305
|
+
box-sizing: border-box;
|
|
306
|
+
width: min(36rem, calc(100% - 2rem));
|
|
307
|
+
max-width: none;
|
|
308
|
+
padding: 1rem;
|
|
309
|
+
border: 0;
|
|
310
|
+
border-radius: 0.75rem;
|
|
311
|
+
background: Canvas;
|
|
312
|
+
color: CanvasText;
|
|
313
|
+
}
|
|
314
|
+
.twPlusArgumentTextDialog::backdrop {
|
|
315
|
+
background: #17212a80;
|
|
316
|
+
}
|
|
317
|
+
.twPlusArgumentTextDialog h2 {
|
|
318
|
+
margin-top: 0;
|
|
319
|
+
font-size: 1.1rem;
|
|
320
|
+
}
|
|
321
|
+
.twPlusArgumentTextDialog textarea {
|
|
322
|
+
box-sizing: border-box;
|
|
323
|
+
display: block;
|
|
324
|
+
width: 100%;
|
|
325
|
+
min-height: 10rem;
|
|
326
|
+
max-height: 60vh;
|
|
327
|
+
padding: 0.5rem;
|
|
328
|
+
resize: vertical;
|
|
329
|
+
font: inherit;
|
|
330
|
+
white-space: pre-wrap;
|
|
331
|
+
overflow-wrap: anywhere;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/* The function editor. */
|
|
335
|
+
|
|
336
|
+
.twPlusProcedureDialog {
|
|
337
|
+
position: fixed;
|
|
338
|
+
inset: 0;
|
|
339
|
+
box-sizing: border-box;
|
|
340
|
+
width: 100%;
|
|
341
|
+
height: 100%;
|
|
342
|
+
max-width: none;
|
|
343
|
+
max-height: none;
|
|
344
|
+
margin: 0;
|
|
345
|
+
padding: 0;
|
|
346
|
+
border: 0;
|
|
347
|
+
overflow: visible;
|
|
348
|
+
background: transparent;
|
|
349
|
+
}
|
|
350
|
+
.twPlusProcedureDialog::backdrop {
|
|
351
|
+
background: #17212a80;
|
|
352
|
+
}
|
|
353
|
+
.twPlusProcedureDialog > form {
|
|
354
|
+
box-sizing: border-box;
|
|
355
|
+
max-width: min(38rem, calc(100% - 2rem));
|
|
356
|
+
margin: min(12vh, 4rem) auto 0;
|
|
357
|
+
padding: 1rem;
|
|
358
|
+
border-radius: 0.75rem;
|
|
359
|
+
background: Canvas;
|
|
360
|
+
color: CanvasText;
|
|
361
|
+
}
|
|
362
|
+
.twPlusProcedureDialog h2 {
|
|
363
|
+
margin-top: 0;
|
|
364
|
+
}
|
|
365
|
+
.twPlusProcedureDialog [data-procedure-workspace] {
|
|
366
|
+
position: relative;
|
|
367
|
+
height: 7rem;
|
|
368
|
+
border: 1px solid GrayText;
|
|
369
|
+
}
|
|
370
|
+
.twPlusProcedureDialog [data-procedure-buttons],
|
|
371
|
+
.twPlusProcedureDialog footer {
|
|
372
|
+
display: flex;
|
|
373
|
+
flex-wrap: wrap;
|
|
374
|
+
gap: 0.5rem;
|
|
375
|
+
margin-block: 0.75rem;
|
|
376
|
+
}
|
|
377
|
+
.twPlusProcedureDialog footer {
|
|
378
|
+
justify-content: flex-end;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/* Code previews. */
|
|
382
|
+
|
|
383
|
+
[data-code-preview] {
|
|
384
|
+
position: relative;
|
|
385
|
+
inline-size: 100%;
|
|
386
|
+
block-size: 100%;
|
|
387
|
+
overflow: hidden;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
[data-code-preview] > div:first-child,
|
|
391
|
+
[data-code-preview] > .tw-code-preview-chrome {
|
|
392
|
+
inline-size: 100%;
|
|
393
|
+
block-size: 100%;
|
|
394
|
+
pointer-events: none;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
[data-code-preview] > .tw-code-preview-chrome {
|
|
398
|
+
position: absolute;
|
|
399
|
+
inset: 0;
|
|
400
|
+
overflow: hidden;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
[data-dockview-costume-thumbnail] {
|
|
404
|
+
position: absolute;
|
|
405
|
+
inset: auto var(--plus-watermark-right, 12px) var(--plus-watermark-bottom, 12px) auto;
|
|
406
|
+
pointer-events: none;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
[data-dockview-costume-thumbnail] > img[src] {
|
|
410
|
+
display: block;
|
|
411
|
+
max-width: var(--plus-watermark-size, 64px);
|
|
412
|
+
max-height: var(--plus-watermark-size, 64px);
|
|
413
|
+
opacity: 0.6;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
:has(> [data-dockview-costume-thumbnail]) > [data-code-watermark] {
|
|
417
|
+
display: none;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/* Keep Blockly's measurements and viewport while another Dockview group is selected. */
|
|
421
|
+
.dv-inactive-group .tw-plus-sprite-tab-slot--split .blocklyZoom,
|
|
422
|
+
.dv-inactive-group .tw-plus-sprite-tab-slot--split .blocklyToolboxDiv,
|
|
423
|
+
.dv-inactive-group .tw-plus-sprite-tab-slot--split .blocklyFlyout,
|
|
424
|
+
.dv-inactive-group .tw-plus-sprite-tab-slot--split .blocklyFlyoutScrollbar,
|
|
425
|
+
.dv-inactive-group .tw-plus-sprite-tab-slot--split [data-code-extension-button] {
|
|
426
|
+
visibility: hidden;
|
|
427
|
+
clip-path: inset(50%);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/* Script layout and script views. */
|
|
431
|
+
|
|
432
|
+
[data-code-hover-surface]:not(:hover) :is(
|
|
433
|
+
.blocklyZoom, [data-workspace-minimap], [data-dockview-costume-thumbnail],
|
|
434
|
+
[data-code-hover-thumbnail], [data-code-watermark]
|
|
435
|
+
) {
|
|
436
|
+
visibility: hidden;
|
|
437
|
+
pointer-events: none;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/* A function editor shows its palette only while the pointer is over it, or while typing in its search. */
|
|
441
|
+
[data-hover-palette]:not(:hover, :focus-within) .injectionDiv > :is(
|
|
442
|
+
.blocklyToolboxDiv, .blocklyFlyout, .blocklyFlyoutScrollbar,
|
|
443
|
+
.tw-palette-category-search, .tw-palette-dropdown-resize-handle
|
|
444
|
+
) {
|
|
445
|
+
visibility: hidden;
|
|
446
|
+
pointer-events: none;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
.tw-script-view-menu-arrow {
|
|
450
|
+
display: inline-block;
|
|
451
|
+
inline-size: 0.4em;
|
|
452
|
+
block-size: 0.4em;
|
|
453
|
+
margin-inline-start: 1em;
|
|
454
|
+
border-top: 1px solid;
|
|
455
|
+
border-right: 1px solid;
|
|
456
|
+
transform: rotate(45deg);
|
|
457
|
+
vertical-align: 0.12em;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
.tw-script-view-menu-arrow:dir(rtl) {
|
|
461
|
+
transform: rotate(-135deg);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.blocklyWidgetDiv .tw-script-view-submenu {
|
|
465
|
+
position: fixed;
|
|
466
|
+
max-inline-size: 100vw;
|
|
467
|
+
max-block-size: 100vh;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.tw-script-view-surface {
|
|
471
|
+
position: absolute;
|
|
472
|
+
z-index: 1;
|
|
473
|
+
inset: var(--tw-script-view-top, 0px)
|
|
474
|
+
max(var(--tw-script-view-right, 0px), var(--plus-stage-overlap, 0px)) 0
|
|
475
|
+
var(--tw-script-view-left, 0px);
|
|
476
|
+
overflow: auto;
|
|
477
|
+
overscroll-behavior: contain;
|
|
478
|
+
background: var(--ui-primary, Canvas);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
.tw-script-view-surface > div {
|
|
482
|
+
min-height: 100%;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
.tw-script-view-surface[hidden] {
|
|
486
|
+
display: none;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
.blocklySvg[data-script-serial] {
|
|
490
|
+
z-index: 2;
|
|
491
|
+
background: transparent;
|
|
492
|
+
pointer-events: none;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
.blocklySvg[data-script-serial] :is(.blocklyMainBackground, .blocklyBlockCanvas, .blocklyBubbleCanvas) {
|
|
496
|
+
visibility: hidden;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
.blocklySvg[data-script-serial] .blocklyZoom {
|
|
500
|
+
pointer-events: visiblePainted;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
[data-code-hover-surface]:not(:hover) .blocklySvg[data-script-serial] .blocklyZoom {
|
|
504
|
+
pointer-events: none;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
.injectionDiv:has(> [data-script-serial]) > [data-workspace-minimap] {
|
|
508
|
+
z-index: 3;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.tw-script-layout-svg {
|
|
512
|
+
display: block;
|
|
513
|
+
overflow: visible;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
.tw-script-view-surface[data-can-show-block] [data-script-view-block] {
|
|
517
|
+
cursor: pointer;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
.tw-script-layout-dialog {
|
|
521
|
+
box-sizing: border-box;
|
|
522
|
+
width: min(44rem, calc(100% - 2rem));
|
|
523
|
+
max-height: calc(100% - 2rem);
|
|
524
|
+
padding: 1.25rem;
|
|
525
|
+
border: 1px solid var(--ui-black-transparent, #80808070);
|
|
526
|
+
border-radius: 0.75rem;
|
|
527
|
+
background: var(--ui-primary, Canvas);
|
|
528
|
+
color: var(--text-primary, CanvasText);
|
|
529
|
+
font: 0.9rem/1.4 system-ui, sans-serif;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
.tw-script-layout-dialog::backdrop {
|
|
533
|
+
background: #17212a80;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
.tw-script-layout-dialog > h2 {
|
|
537
|
+
margin: 0 0 1rem;
|
|
538
|
+
font-size: 1.1rem;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
.tw-script-layout-options {
|
|
542
|
+
display: flex;
|
|
543
|
+
flex-wrap: wrap;
|
|
544
|
+
gap: 0.65rem 1rem;
|
|
545
|
+
margin-bottom: 0.75rem;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
.tw-script-layout-options label {
|
|
549
|
+
display: flex;
|
|
550
|
+
align-items: center;
|
|
551
|
+
gap: 0.5rem;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
.tw-script-layout-options select,
|
|
555
|
+
.tw-script-layout-dialog button {
|
|
556
|
+
padding: 0.35rem 0.55rem;
|
|
557
|
+
border: 1px solid var(--ui-black-transparent, #80808070);
|
|
558
|
+
border-radius: 0.35rem;
|
|
559
|
+
background: var(--ui-primary, Canvas);
|
|
560
|
+
color: inherit;
|
|
561
|
+
font: inherit;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
.tw-script-layout-preview {
|
|
565
|
+
height: min(45vh, 22rem);
|
|
566
|
+
overflow: auto;
|
|
567
|
+
border: 1px solid var(--ui-black-transparent, #80808070);
|
|
568
|
+
border-radius: 0.45rem;
|
|
569
|
+
background: color-mix(in srgb, var(--ui-primary, Canvas) 94%, currentColor);
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
.tw-script-layout-dialog > footer {
|
|
573
|
+
display: flex;
|
|
574
|
+
align-items: center;
|
|
575
|
+
justify-content: flex-end;
|
|
576
|
+
flex-wrap: wrap;
|
|
577
|
+
gap: 0.5rem;
|
|
578
|
+
margin-top: 0.75rem;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
.tw-script-layout-dialog [role="status"] {
|
|
582
|
+
flex: 1;
|
|
583
|
+
margin: 0;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
.tw-script-layout-dialog button:last-child:not(:disabled) {
|
|
587
|
+
background: var(--looks-secondary, #7951d1);
|
|
588
|
+
color: white;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
/* Scripts the one-script mode leaves out, and the body of a folded script. ScratchBlocks sets the display of
|
|
592
|
+
every script as it scrolls in and out of view, so the hiding must win over its inline style. */
|
|
593
|
+
[data-tw-plus-hidden] {
|
|
594
|
+
display: none !important;
|
|
595
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React, {useEffect, useRef, useState} from 'react';
|
|
2
|
+
|
|
3
|
+
function Thumbnail({target}) {
|
|
4
|
+
return target?.thumbnailUrl ?
|
|
5
|
+
<img className="tw-target-combobox__thumbnail" src={target.thumbnailUrl} alt="" /> :
|
|
6
|
+
<span className="tw-target-combobox__thumbnail" aria-hidden="true" />;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function TargetCombobox({id, targets, value, onSelect, onRename, disabled, locale}) {
|
|
10
|
+
const japanese = /^ja(?:-|$)/i.test(locale);
|
|
11
|
+
const label = japanese ? '編集対象' : 'Editing target';
|
|
12
|
+
const optionsLabel = japanese ? '編集対象の候補' : 'Editing target options';
|
|
13
|
+
const selected = targets.find(target => target.id === value);
|
|
14
|
+
const [popup, setPopup] = useState(null);
|
|
15
|
+
const [draft, setDraft] = useState(null);
|
|
16
|
+
const input = useRef(null);
|
|
17
|
+
const canRename = selected && !selected.isStage;
|
|
18
|
+
const open = !disabled && popup !== null && popup.value === value && targets.length > 0;
|
|
19
|
+
const listId = `${id}-options`;
|
|
20
|
+
const optionId = index => `${listId}-${index}`;
|
|
21
|
+
const highlight = open ? targets.findIndex(target => target.id === popup.highlighted) : -1;
|
|
22
|
+
const show = () => setPopup({value, highlighted: selected?.id ?? targets[0]?.id});
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (disabled) {
|
|
25
|
+
setPopup(null);
|
|
26
|
+
setDraft(null);
|
|
27
|
+
}
|
|
28
|
+
}, [disabled]);
|
|
29
|
+
|
|
30
|
+
function choose(target) {
|
|
31
|
+
setPopup(null);
|
|
32
|
+
setDraft(null);
|
|
33
|
+
onSelect(target.id);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function commitName() {
|
|
37
|
+
const name = draft?.id === value ? draft.name.trim() : '';
|
|
38
|
+
setDraft(null);
|
|
39
|
+
if (!disabled && canRename && name && name !== selected.name) onRename(name);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function keyDown(event) {
|
|
43
|
+
if (event.nativeEvent.isComposing) return;
|
|
44
|
+
const {key} = event;
|
|
45
|
+
if (key === 'Escape' && (open || draft)) {
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
if (open) setPopup(null);
|
|
48
|
+
else setDraft(null);
|
|
49
|
+
} else if (key === 'Enter') {
|
|
50
|
+
event.preventDefault();
|
|
51
|
+
if (open && highlight >= 0) choose(targets[highlight]);
|
|
52
|
+
else commitName();
|
|
53
|
+
} else if (key === 'ArrowDown' || key === 'ArrowUp') {
|
|
54
|
+
event.preventDefault();
|
|
55
|
+
if (!open) {
|
|
56
|
+
show();
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const next = Math.min(targets.length - 1, Math.max(0, highlight + (key === 'ArrowDown' ? 1 : -1)));
|
|
60
|
+
setPopup({value, highlighted: targets[next].id});
|
|
61
|
+
event.currentTarget.ownerDocument.getElementById(optionId(next))?.scrollIntoView({block: 'nearest'});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<div className="tw-target-combobox" onBlur={event => {
|
|
67
|
+
if (event.currentTarget.contains(event.relatedTarget)) return;
|
|
68
|
+
setPopup(null);
|
|
69
|
+
if (event.currentTarget.ownerDocument.hasFocus()) commitName();
|
|
70
|
+
}}>
|
|
71
|
+
<div className="tw-target-combobox__field">
|
|
72
|
+
<Thumbnail target={selected} />
|
|
73
|
+
<input aria-activedescendant={open && highlight >= 0 ? optionId(highlight) : undefined}
|
|
74
|
+
aria-controls={open ? listId : undefined} aria-expanded={open} aria-label={label}
|
|
75
|
+
aria-autocomplete="none" autoComplete="off" id={id} disabled={disabled || !targets.length}
|
|
76
|
+
onChange={event => {
|
|
77
|
+
setPopup(null);
|
|
78
|
+
setDraft({id: value, name: event.currentTarget.value});
|
|
79
|
+
}}
|
|
80
|
+
onKeyDown={keyDown} readOnly={!canRename} ref={input} role="combobox" type="text"
|
|
81
|
+
value={draft?.id === value ? draft.name : selected?.name ?? ''} />
|
|
82
|
+
<button aria-label={optionsLabel} aria-expanded={open} disabled={disabled || !targets.length}
|
|
83
|
+
onPointerDown={event => event.preventDefault()} onClick={() => {
|
|
84
|
+
if (open) setPopup(null);
|
|
85
|
+
else show();
|
|
86
|
+
input.current?.focus();
|
|
87
|
+
}} tabIndex={-1} type="button">
|
|
88
|
+
<svg aria-hidden="true" width="16" height="16" viewBox="0 0 16 16" fill="none"
|
|
89
|
+
stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round">
|
|
90
|
+
<path d="m4 6 4 4 4-4" />
|
|
91
|
+
</svg>
|
|
92
|
+
</button>
|
|
93
|
+
</div>
|
|
94
|
+
{open && <ul aria-label={label} className="tw-target-combobox__options" id={listId} role="listbox">
|
|
95
|
+
{targets.map((target, index) => (
|
|
96
|
+
<li aria-selected={target.id === value} className={index === highlight ? 'tw-target-combobox__highlight' : undefined}
|
|
97
|
+
id={optionId(index)} key={target.id} onClick={() => choose(target)}
|
|
98
|
+
onPointerDown={event => event.preventDefault()} role="option">
|
|
99
|
+
<Thumbnail target={target} />
|
|
100
|
+
<span>{target.name}</span>
|
|
101
|
+
</li>
|
|
102
|
+
))}
|
|
103
|
+
</ul>}
|
|
104
|
+
</div>
|
|
105
|
+
);
|
|
106
|
+
}
|