@kubohiroya/turbowarp-plus-editor-workbench 0.17.0 → 0.18.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.
@@ -54,6 +54,8 @@ interface MenuItem {
54
54
  enabled: boolean;
55
55
  callback(): void;
56
56
  separator?: boolean;
57
+ /** The editor's menu icon for the item, by name. */
58
+ twPlusMenuIcon?: string;
57
59
  }
58
60
  interface BlockSvgLike {
59
61
  id: string;
@@ -235,6 +235,8 @@ export function attachBreakpointMenu(options) {
235
235
  text: breakpointMenuText(options.getLocale?.(), on, !on && breakpoints.runsCompiled(blocks)),
236
236
  enabled: true,
237
237
  separator: true,
238
+ // The editor draws its ladybug before the text, as for its other block menu items.
239
+ twPlusMenuIcon: 'debug',
238
240
  callback: () => breakpoints.toggle(blocks, block.id)
239
241
  }];
240
242
  }
@@ -15,6 +15,8 @@ export declare const debuggerReference: Readonly<{
15
15
  providerId: "turbowarp-plus";
16
16
  documentId: "debugger";
17
17
  }>;
18
+ /** The ladybug that marks debugging in the editor, as an image for the tab. */
19
+ export declare const debuggerTabIcon: string;
18
20
  export declare const debuggerTitle: (locale: string) => "デバッガー" | "Debugger";
19
21
  export declare function attachDebuggerPanel(debuggerInterface: DebuggerInterface, options: DebuggerPanelOptions): {
20
22
  dispose(): void;
@@ -17,6 +17,9 @@ import { getDocumentWorkspace } from "./document-workspace.js";
17
17
  export const dockedClass = 'tw-plus-debugger-docked';
18
18
  export const debuggerReference = Object.freeze({ providerId: 'turbowarp-plus', documentId: 'debugger' });
19
19
  const buttonSelector = '.sa-debugger-container';
20
+ /** The ladybug that marks debugging in the editor, as an image for the tab. */
21
+ export const debuggerTabIcon = 'data:image/svg+xml,' + encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><text x="8" y="13" font-size="13" ' +
22
+ 'text-anchor="middle">\u{1F41E}</text></svg>');
20
23
  export const debuggerTitle = (locale) => (/^ja(?:-|$)/i.test(locale) ? 'デバッガー' : 'Debugger');
21
24
  export function attachDebuggerPanel(debuggerInterface, options) {
22
25
  const { element, setVisible } = debuggerInterface;
@@ -34,6 +37,7 @@ export function attachDebuggerPanel(debuggerInterface, options) {
34
37
  reference: debuggerReference,
35
38
  filename: title,
36
39
  title,
40
+ icon: debuggerTabIcon,
37
41
  transient: true,
38
42
  mount(slot, closePanel) {
39
43
  close = closePanel;
@@ -18,6 +18,8 @@ export interface DocumentPanelRequest {
18
18
  filename: string;
19
19
  /** What the tab shows. Without it the tab names the file and where it comes from. */
20
20
  title?: string;
21
+ /** An image URL the tab shows before its title, as a sprite tab shows the sprite's costume. */
22
+ icon?: string;
21
23
  transient?: boolean;
22
24
  /** Keeps this utility tab first while the host enables the project folder drawer. */
23
25
  pinWithProjectFolder?: boolean;
@@ -716,8 +716,9 @@ export function mountSpriteTabs(root, content, options) {
716
716
  if (!panel)
717
717
  continue;
718
718
  const fixed = fixedProjectTab(id);
719
- if (panel.api.getParameters().fixedProjectTab !== fixed)
720
- panel.api.updateParameters({ fixedProjectTab: fixed });
719
+ if (panel.api.getParameters().fixedProjectTab !== fixed) {
720
+ panel.api.updateParameters({ fixedProjectTab: fixed, ...(request.icon && { icon: request.icon }) });
721
+ }
721
722
  const group = fixed && leftmostGroup();
722
723
  if (group && group.panels[0]?.id !== id)
723
724
  panel.api.moveTo({ group, index: 0, skipSetActive: !panel.api.isActive });
@@ -753,7 +754,8 @@ export function mountSpriteTabs(root, content, options) {
753
754
  documents.set(id, { request });
754
755
  try {
755
756
  dockview.addPanel({ id, title, component: documentComponent, renderer: 'always',
756
- inactive: request.inactive, params: { fixedProjectTab: Boolean(fixed) }, ...(position && { position }) });
757
+ inactive: request.inactive, params: { fixedProjectTab: Boolean(fixed), ...(request.icon && { icon: request.icon }) },
758
+ ...(position && { position }) });
757
759
  }
758
760
  catch (error) {
759
761
  documents.get(id)?.session?.dispose();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubohiroya/turbowarp-plus-editor-workbench",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "The TurboWarp Plus Editor workbench: layout, dockable sprite tabs, stage, debugger tab and file menu",
5
5
  "type": "module",
6
6
  "license": "MPL-2.0",
@@ -274,6 +274,8 @@ interface MenuItem {
274
274
  enabled: boolean;
275
275
  callback(): void;
276
276
  separator?: boolean;
277
+ /** The editor's menu icon for the item, by name. */
278
+ twPlusMenuIcon?: string;
277
279
  }
278
280
 
279
281
  interface BlockSvgLike {
@@ -343,6 +345,8 @@ export function attachBreakpointMenu (options: BreakpointMenuOptions) {
343
345
  text: breakpointMenuText(options.getLocale?.(), on, !on && breakpoints.runsCompiled(blocks)),
344
346
  enabled: true,
345
347
  separator: true,
348
+ // The editor draws its ladybug before the text, as for its other block menu items.
349
+ twPlusMenuIcon: 'debug',
346
350
  callback: () => breakpoints.toggle(blocks, block.id)
347
351
  }];
348
352
  }
@@ -34,6 +34,11 @@ export const dockedClass = 'tw-plus-debugger-docked';
34
34
  export const debuggerReference = Object.freeze({providerId: 'turbowarp-plus', documentId: 'debugger'});
35
35
  const buttonSelector = '.sa-debugger-container';
36
36
 
37
+ /** The ladybug that marks debugging in the editor, as an image for the tab. */
38
+ export const debuggerTabIcon = 'data:image/svg+xml,' + encodeURIComponent(
39
+ '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><text x="8" y="13" font-size="13" ' +
40
+ 'text-anchor="middle">\u{1F41E}</text></svg>');
41
+
37
42
  export const debuggerTitle = (locale: string) => (/^ja(?:-|$)/i.test(locale) ? 'デバッガー' : 'Debugger');
38
43
 
39
44
  export function attachDebuggerPanel (debuggerInterface: DebuggerInterface, options: DebuggerPanelOptions) {
@@ -53,6 +58,7 @@ export function attachDebuggerPanel (debuggerInterface: DebuggerInterface, optio
53
58
  reference: debuggerReference,
54
59
  filename: title,
55
60
  title,
61
+ icon: debuggerTabIcon,
56
62
  transient: true,
57
63
  mount (slot, closePanel) {
58
64
  close = closePanel;
@@ -16,6 +16,8 @@ export interface DocumentPanelRequest {
16
16
  filename: string;
17
17
  /** What the tab shows. Without it the tab names the file and where it comes from. */
18
18
  title?: string;
19
+ /** An image URL the tab shows before its title, as a sprite tab shows the sprite's costume. */
20
+ icon?: string;
19
21
  transient?: boolean;
20
22
  /** Keeps this utility tab first while the host enables the project folder drawer. */
21
23
  pinWithProjectFolder?: boolean;
@@ -836,7 +836,9 @@ export function mountSpriteTabs<Snapshot>(root: HTMLElement, content: HTMLElemen
836
836
  const panel = dockview.getPanel(id);
837
837
  if (!panel) continue;
838
838
  const fixed = fixedProjectTab(id);
839
- if (panel.api.getParameters().fixedProjectTab !== fixed) panel.api.updateParameters({fixedProjectTab: fixed});
839
+ if (panel.api.getParameters().fixedProjectTab !== fixed) {
840
+ panel.api.updateParameters({fixedProjectTab: fixed, ...(request.icon && {icon: request.icon})});
841
+ }
840
842
  const group = fixed && leftmostGroup();
841
843
  if (group && group.panels[0]?.id !== id) panel.api.moveTo({group, index: 0, skipSetActive: !panel.api.isActive});
842
844
  }
@@ -869,7 +871,8 @@ export function mountSpriteTabs<Snapshot>(root: HTMLElement, content: HTMLElemen
869
871
  documents.set(id, {request});
870
872
  try {
871
873
  dockview.addPanel({id, title, component: documentComponent, renderer: 'always',
872
- inactive: request.inactive, params: {fixedProjectTab: Boolean(fixed)}, ...(position && {position})});
874
+ inactive: request.inactive, params: {fixedProjectTab: Boolean(fixed), ...(request.icon && {icon: request.icon})},
875
+ ...(position && {position})});
873
876
  } catch (error) {
874
877
  documents.get(id)?.session?.dispose();
875
878
  documents.delete(id);
@@ -96,8 +96,9 @@
96
96
 
97
97
  /*
98
98
  * The debugger sits on the menu bar on its own, between the stage launcher and the extension tray,
99
- * as a round 2rem button like a browser toolbar's "…" menu. The add-on's shell-prompt image is
100
- * hidden and "…" drawn in its place; `::after` stays free for the add-on's unread dot.
99
+ * as a round 2rem button showing 🐞, as the recorder beside it shows 🎥. The ladybug marks every
100
+ * debugging entry point in the editor. The add-on's shell-prompt image is hidden and the ladybug
101
+ * drawn in its place; `::after` stays free for the add-on's unread dot.
101
102
  */
102
103
  .tw-stage-controls__debugger-button {
103
104
  flex: none;
@@ -140,8 +141,9 @@
140
141
  }
141
142
 
142
143
  .tw-stage-controls__debugger-button [data-tw-stage-button-content]::before {
143
- content: "…";
144
- font: bold 1.25rem/1 sans-serif;
144
+ content: "🐞";
145
+ font-size: 1rem;
146
+ line-height: 1;
145
147
  }
146
148
 
147
149
  /*