@kubohiroya/turbowarp-plus-editor-workbench 0.13.0 → 0.15.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/README.ja.md CHANGED
@@ -139,5 +139,5 @@ Web 版の Plus 標準配置で `twPlusDockview=1` を付けて起動すると
139
139
 
140
140
  ホストが `getFunctions` を渡すと、「自由配置」の次に「ハット・関数一覧」と「呼び出し関係」がある(ボタンの並びは
141
141
  `@kubohiroya/turbowarp-plus-editor-sprite-panes` のツールバーが決め、保存済みのレイアウトが持つセクションの番号は変わらない。「呼び出し関係」は次の番号を使う)。`SpriteFunctionPane` が、前者ではホストが `hats` で渡すハットのスクリプトとブロック定義を
142
- 一覧し(並べ方は名前順・Z順・N順)、後者では LR・TD の呼び出し図を表示する。並べ方・流れはビューごとに保つ。どちらで選んだ関数もホストの `openFunction` で、ハットのスクリプトは `openScript` で開く(スプライトの横のタブなど)。`openFunction` が無ければ関数はダイアログで開く。`createFunction` を渡すと、一覧や図の下の分割ボタンで、標準のブロック定義か TurboWarp-Plus の名前付き関数を作れる。ダイアログはホストの
142
+ 一覧し(並べ方は名前順・Z順・N順)、後者では LR・TD の呼び出し図を表示する。並べ方・流れはビューごとに保つ。どちらで選んだ関数もホストの `openFunction` で、ハットのスクリプトは `openScript` で開く(スプライトの横のタブなど)。`openFunction` が無ければ関数はダイアログで開く。`createFunction(targetId, kind, name)` を渡すと、一覧の下と図の左下の「+ 新しい関数を追加」で、名前を入れて標準のブロック定義か TurboWarp-Plus の名前付き関数を作れる。ダイアログはホストの
143
143
  `mountFunctionEditor` を呼び、その定義のコード編集画面はホストが持つ。このパッケージは Scratch Blocks のコードを持たないためである。
package/README.md CHANGED
@@ -141,6 +141,6 @@ saved layouts do not change, and Calls takes the next one). `SpriteFunctionPane`
141
141
  the other hat scripts the host passes in `hats` above the definitions, ordered by name, in Z order or in N order, and the call
142
142
  graph flowing LR or TD in the second; each view keeps the order and flow it chose. A function picked in either opens through
143
143
  `openFunction`, and a hat script through `openScript`, such as in a tab beside the sprite; without `openFunction` a function opens
144
- in a dialog. With `createFunction`, a split button below the list or graph makes a standard custom block or a TurboWarp-Plus named
145
- function. The dialog calls the host's `mountFunctionEditor`, which owns the code workspace of that
144
+ in a dialog. With `createFunction(targetId, kind, name)`, an “Add a new function” button below the list and in the bottom left
145
+ corner of the graph asks for a name and makes a standard custom block or a TurboWarp-Plus named function. The dialog calls the host's `mountFunctionEditor`, which owns the code workspace of that
146
146
  definition, because this package carries no Scratch Blocks code.
@@ -212,11 +212,12 @@ type SpriteTabsProps<Snapshot> = Omit<TabOptions<Snapshot>, 'activateSection' |
212
212
  id: string;
213
213
  };
214
214
  /**
215
- * Make a new function in the target: a standard custom block or a TurboWarp-Plus named function.
216
- * Resolves with the id of the new hat, or with nothing when cancelled. Without it, the functions
217
- * section has no create button.
215
+ * Make a new function of this name in the target: a standard custom block, whose block text is the name,
216
+ * or a TurboWarp-Plus named function. Resolves with the id of the new hat, or with nothing when nothing
217
+ * was made; a rejection may carry a `code` the pane explains. Without it, the functions sections have
218
+ * no add button.
218
219
  */
219
- createFunction?(targetId: string, kind: FunctionKind): Promise<string | void>;
220
+ createFunction?(targetId: string, kind: FunctionKind, name: string): Promise<string | void>;
220
221
  getCodeSearchItems?(targetId: string): readonly SpriteSearchResult[];
221
222
  openCodeSearchResult?(targetId: string, id: string): void;
222
223
  };
@@ -1578,8 +1578,8 @@ function SpriteTabs(props) {
1578
1578
  onOpenScript: props.openScript &&
1579
1579
  ((hat, options) => props.openScript(targetId, hat, options)),
1580
1580
  selectedId: props.selectedScript?.targetId === targetId ? props.selectedScript.id : undefined,
1581
- onCreate: props.createFunction && (async (functionKind) => {
1582
- const created = await props.createFunction(targetId, functionKind);
1581
+ onCreate: props.createFunction && (async (functionKind, name) => {
1582
+ const created = await props.createFunction(targetId, functionKind, name);
1583
1583
  // Show the new function now rather than at the next project change.
1584
1584
  if (created)
1585
1585
  workspace?.refreshSurfaces();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubohiroya/turbowarp-plus-editor-workbench",
3
- "version": "0.13.0",
3
+ "version": "0.15.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",
@@ -73,7 +73,7 @@
73
73
  },
74
74
  "dependencies": {
75
75
  "@kubohiroya/turbowarp-plus-editor-project-model": "0.1.2",
76
- "@kubohiroya/turbowarp-plus-editor-sprite-panes": "0.4.0",
76
+ "@kubohiroya/turbowarp-plus-editor-sprite-panes": "0.5.0",
77
77
  "dockview": "8.8.3"
78
78
  },
79
79
  "peerDependencies": {
package/src/editor.css CHANGED
@@ -424,6 +424,11 @@
424
424
  padding-left: 16pt;
425
425
  }
426
426
 
427
+ /* In a section heading of the sprite editor the row holds only its tools, with no stage to keep clear of. */
428
+ .standard-body :global(.tw-plus-sprite-toolbar-tools) .tab-row {
429
+ padding-right: 0;
430
+ }
431
+
427
432
  .standard-body .stage-hidden {
428
433
  visibility: hidden;
429
434
  pointer-events: none;
@@ -55,7 +55,8 @@
55
55
  .tw-plus-sprite-layout-menu-divider {
56
56
  height: 1px;
57
57
  margin: 4px 0;
58
- background: var(--ui-black-transparent, #c6cfda);
58
+ /* Drawn from the menu's text colour, so it reads as clearly in the dark theme as in the light one. */
59
+ background: color-mix(in srgb, currentColor 35%, transparent);
59
60
  }
60
61
 
61
62
  .tw-plus-sprite-layout-menu-popup button:disabled { opacity: 0.55; cursor: default; }
@@ -1466,11 +1466,12 @@ type SpriteTabsProps<Snapshot> = Omit<TabOptions<Snapshot>, 'activateSection' |
1466
1466
  /** The function or hat script shown beside the sprite, which the list of hats and functions highlights. */
1467
1467
  selectedScript?: {targetId: string; id: string};
1468
1468
  /**
1469
- * Make a new function in the target: a standard custom block or a TurboWarp-Plus named function.
1470
- * Resolves with the id of the new hat, or with nothing when cancelled. Without it, the functions
1471
- * section has no create button.
1469
+ * Make a new function of this name in the target: a standard custom block, whose block text is the name,
1470
+ * or a TurboWarp-Plus named function. Resolves with the id of the new hat, or with nothing when nothing
1471
+ * was made; a rejection may carry a `code` the pane explains. Without it, the functions sections have
1472
+ * no add button.
1472
1473
  */
1473
- createFunction?(targetId: string, kind: FunctionKind): Promise<string | void>;
1474
+ createFunction?(targetId: string, kind: FunctionKind, name: string): Promise<string | void>;
1474
1475
  getCodeSearchItems?(targetId: string): readonly SpriteSearchResult[];
1475
1476
  openCodeSearchResult?(targetId: string, id: string): void;
1476
1477
  };
@@ -1696,8 +1697,8 @@ function SpriteTabs<Snapshot>(props: SpriteTabsProps<Snapshot>) {
1696
1697
  onOpenScript: props.openScript &&
1697
1698
  ((hat: SpriteHatScript, options?: OpenScriptOptions) => props.openScript!(targetId, hat, options)),
1698
1699
  selectedId: props.selectedScript?.targetId === targetId ? props.selectedScript.id : undefined,
1699
- onCreate: props.createFunction && (async (functionKind: FunctionKind) => {
1700
- const created = await props.createFunction!(targetId, functionKind);
1700
+ onCreate: props.createFunction && (async (functionKind: FunctionKind, name: string) => {
1701
+ const created = await props.createFunction!(targetId, functionKind, name);
1701
1702
  // Show the new function now rather than at the next project change.
1702
1703
  if (created) workspace?.refreshSurfaces();
1703
1704
  return created;