@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.
Files changed (108) hide show
  1. package/LICENSE +373 -0
  2. package/README.ja.md +38 -0
  3. package/README.md +37 -2
  4. package/dist/asset-edit-session.d.ts +24 -0
  5. package/dist/asset-edit-session.js +58 -0
  6. package/dist/block-argument-text.d.ts +39 -0
  7. package/dist/block-argument-text.js +170 -0
  8. package/dist/block-drag.d.ts +17 -0
  9. package/dist/block-drag.js +184 -0
  10. package/dist/code-extensions.d.ts +38 -0
  11. package/dist/code-extensions.js +418 -0
  12. package/dist/code-pane.d.ts +63 -0
  13. package/dist/code-pane.js +363 -0
  14. package/dist/custom-extension-fields.d.ts +45 -0
  15. package/dist/custom-extension-fields.js +144 -0
  16. package/dist/detached-block-palette-view.d.ts +10 -0
  17. package/dist/detached-block-palette-view.js +62 -0
  18. package/dist/detached-block-palette.d.ts +41 -0
  19. package/dist/detached-block-palette.js +197 -0
  20. package/dist/dockview-unsaved.d.ts +45 -0
  21. package/dist/dockview-unsaved.js +123 -0
  22. package/dist/history.d.ts +57 -0
  23. package/dist/history.js +85 -0
  24. package/dist/index.d.ts +28 -0
  25. package/dist/index.js +729 -0
  26. package/dist/native-extension-field.d.ts +26 -0
  27. package/dist/native-extension-field.js +204 -0
  28. package/dist/native-field-svg.d.ts +20 -0
  29. package/dist/native-field-svg.js +156 -0
  30. package/dist/palette-category-reorder.d.ts +4 -0
  31. package/dist/palette-category-reorder.js +167 -0
  32. package/dist/palette-category-search.d.ts +26 -0
  33. package/dist/palette-category-search.js +74 -0
  34. package/dist/palette-dropdown-resize.d.ts +19 -0
  35. package/dist/palette-dropdown-resize.js +135 -0
  36. package/dist/parent-field-layout.d.ts +2 -0
  37. package/dist/parent-field-layout.js +90 -0
  38. package/dist/parent-field-mirror.d.ts +3 -0
  39. package/dist/parent-field-mirror.js +290 -0
  40. package/dist/parent-field-resources.d.ts +9 -0
  41. package/dist/parent-field-resources.js +199 -0
  42. package/dist/preview-chrome.d.ts +9 -0
  43. package/dist/preview-chrome.js +78 -0
  44. package/dist/procedure-editor.d.ts +9 -0
  45. package/dist/procedure-editor.js +122 -0
  46. package/dist/procedure-edits.d.ts +16 -0
  47. package/dist/procedure-edits.js +47 -0
  48. package/dist/programmatic-extension-field.d.ts +20 -0
  49. package/dist/programmatic-extension-field.js +69 -0
  50. package/dist/protocol.d.ts +15 -0
  51. package/dist/protocol.js +36 -0
  52. package/dist/script-layout-dialog.d.ts +10 -0
  53. package/dist/script-layout-dialog.js +93 -0
  54. package/dist/script-layout-view.d.ts +68 -0
  55. package/dist/script-layout-view.js +164 -0
  56. package/dist/script-layout-workspace.d.ts +45 -0
  57. package/dist/script-layout-workspace.js +55 -0
  58. package/dist/script-layout.d.ts +17 -0
  59. package/dist/script-layout.js +25 -0
  60. package/dist/script-view-menu.d.ts +46 -0
  61. package/dist/script-view-menu.js +161 -0
  62. package/dist/sprite-code-windows.d.ts +31 -0
  63. package/dist/sprite-code-windows.js +180 -0
  64. package/dist/stage-code-prewarm.d.ts +52 -0
  65. package/dist/stage-code-prewarm.js +216 -0
  66. package/dist/target-combobox.d.ts +10 -0
  67. package/dist/target-combobox.js +92 -0
  68. package/dist/variable-references.d.ts +1 -0
  69. package/dist/variable-references.js +87 -0
  70. package/dist/workspace.d.ts +103 -0
  71. package/dist/workspace.js +1102 -0
  72. package/package.json +100 -4
  73. package/src/asset-edit-session.ts +72 -0
  74. package/src/block-argument-text.ts +172 -0
  75. package/src/block-drag.ts +190 -0
  76. package/src/code-extensions.ts +394 -0
  77. package/src/code-pane.ts +353 -0
  78. package/src/custom-extension-fields.ts +154 -0
  79. package/src/detached-block-palette-view.tsx +97 -0
  80. package/src/detached-block-palette.ts +218 -0
  81. package/src/dockview-unsaved.ts +134 -0
  82. package/src/history.ts +114 -0
  83. package/src/index.ts +680 -0
  84. package/src/native-extension-field.ts +201 -0
  85. package/src/native-field-svg.ts +140 -0
  86. package/src/palette-category-reorder.ts +155 -0
  87. package/src/palette-category-search.ts +82 -0
  88. package/src/palette-dropdown-resize.ts +132 -0
  89. package/src/parent-field-layout.ts +88 -0
  90. package/src/parent-field-mirror.ts +260 -0
  91. package/src/parent-field-resources.ts +179 -0
  92. package/src/preview-chrome.ts +82 -0
  93. package/src/procedure-editor.ts +123 -0
  94. package/src/procedure-edits.ts +46 -0
  95. package/src/programmatic-extension-field.ts +76 -0
  96. package/src/protocol.ts +47 -0
  97. package/src/script-layout-dialog.ts +104 -0
  98. package/src/script-layout-view.ts +198 -0
  99. package/src/script-layout-workspace.ts +95 -0
  100. package/src/script-layout.ts +40 -0
  101. package/src/script-view-menu.ts +213 -0
  102. package/src/sprite-code-windows.tsx +182 -0
  103. package/src/stage-code-prewarm.ts +242 -0
  104. package/src/styles.css +595 -0
  105. package/src/target-combobox.tsx +106 -0
  106. package/src/variable-references.ts +85 -0
  107. package/src/workspace.ts +1124 -0
  108. package/tsconfig.json +23 -0
@@ -0,0 +1,170 @@
1
+ /**
2
+ * Long text in a block argument.
3
+ *
4
+ * The vertical renderer sets `MAX_DISPLAY_LENGTH` to Infinity, so a text argument draws every
5
+ * character and the block grows until it covers its neighbours. This caps what a text argument
6
+ * shows, and edits a value that no longer fits in a dialog instead of the one-line inline editor.
7
+ */
8
+ /** Display budget in half-width columns. A wide character, such as a kanji, takes two. */
9
+ export const ARGUMENT_TEXT_COLUMNS = 30;
10
+ const wide = /[ᄀ-ᅟ⺀-〾ぁ-㏿㐀-䶿一-鿿ꀀ-꓏가-힣豈-﫿︰-﹏＀-⦆¢-₩]|[\u{1F300}-\u{1FAFF}\u{20000}-\u{3FFFD}]/u;
11
+ const lineBreak = /[\r\n]/;
12
+ /**
13
+ * Where a value's display is cut, in UTF-16 units, or undefined when it shows in full.
14
+ * The cut leaves one column for the ellipsis and never splits a line break or a surrogate pair.
15
+ * @param {string} text The value.
16
+ * @param {number} columns The display budget.
17
+ * @returns {number | undefined} The number of leading units shown before the ellipsis.
18
+ */
19
+ export const argumentTextCut = (text, columns = ARGUMENT_TEXT_COLUMNS) => {
20
+ let used = 0;
21
+ let index = 0;
22
+ let fit;
23
+ for (const character of text) {
24
+ if (lineBreak.test(character))
25
+ return fit ?? index;
26
+ used += wide.test(character) ? 2 : 1;
27
+ if (used > columns - 1 && fit === undefined)
28
+ fit = index;
29
+ if (used > columns)
30
+ return fit;
31
+ index += character.length;
32
+ }
33
+ return undefined;
34
+ };
35
+ /**
36
+ * True when a value is edited in the dialog: it is cut on the block, or it spans lines.
37
+ * @param {string} text The value.
38
+ * @returns {boolean} Whether the dialog edits it.
39
+ */
40
+ export const editsInDialog = (text) => argumentTextCut(text) !== undefined;
41
+ const text = (locale) => /^ja(?:-|$)/i.test(locale) ? {
42
+ title: 'テキストを編集', cancel: 'キャンセル', save: '保存'
43
+ } : {
44
+ title: 'Edit text', cancel: 'Cancel', save: 'Save'
45
+ };
46
+ /**
47
+ * Show the dialog for one value.
48
+ * @param {Document} document The editor's document.
49
+ * @param {string} value The current value.
50
+ * @param {string} locale The editor's language.
51
+ * @param {(value: string) => void} save Called with the edited value when the dialog is saved.
52
+ * @returns {HTMLDialogElement} The open dialog.
53
+ */
54
+ export const openArgumentTextDialog = (document, value, locale, save) => {
55
+ const labels = text(locale);
56
+ const dialog = document.createElement('dialog');
57
+ dialog.className = 'twPlusArgumentTextDialog';
58
+ dialog.setAttribute('aria-label', labels.title);
59
+ const form = document.createElement('form');
60
+ form.method = 'dialog';
61
+ const heading = document.createElement('h2');
62
+ heading.textContent = labels.title;
63
+ const area = document.createElement('textarea');
64
+ area.value = value;
65
+ area.spellcheck = false;
66
+ area.setAttribute('aria-label', labels.title);
67
+ const cancel = document.createElement('button');
68
+ cancel.type = 'button';
69
+ cancel.textContent = labels.cancel;
70
+ cancel.dataset.dialogAction = 'cancel';
71
+ const submit = document.createElement('button');
72
+ submit.type = 'submit';
73
+ submit.textContent = labels.save;
74
+ submit.dataset.dialogAction = 'confirm';
75
+ const footer = document.createElement('footer');
76
+ footer.className = 'tw-plus-dialog-actions';
77
+ footer.append(cancel, submit);
78
+ form.append(heading, area, footer);
79
+ dialog.append(form);
80
+ let open = true;
81
+ const close = () => {
82
+ if (!open)
83
+ return;
84
+ open = false;
85
+ if (dialog.open)
86
+ dialog.close();
87
+ dialog.remove();
88
+ };
89
+ cancel.addEventListener('click', close);
90
+ dialog.addEventListener('cancel', event => {
91
+ event.preventDefault();
92
+ close();
93
+ });
94
+ form.addEventListener('submit', event => {
95
+ event.preventDefault();
96
+ const next = area.value;
97
+ close();
98
+ save(next);
99
+ });
100
+ area.addEventListener('keydown', event => {
101
+ if (event.key === 'Enter' && (event.ctrlKey || event.metaKey) && !event.isComposing) {
102
+ event.preventDefault();
103
+ form.requestSubmit(submit);
104
+ }
105
+ });
106
+ document.body.append(dialog);
107
+ dialog.showModal();
108
+ area.focus();
109
+ area.setSelectionRange(area.value.length, area.value.length);
110
+ return dialog;
111
+ };
112
+ const installed = new WeakSet();
113
+ /**
114
+ * Cap text arguments and route long values to the dialog.
115
+ * Only plain text inputs open the dialog: number, text-with-menu and procedure-name fields keep
116
+ * their own editors, and a field an extension gave its own `showEditor_` keeps that one.
117
+ * @param {object} ScratchBlocks The loaded ScratchBlocks.
118
+ */
119
+ export const installBlockArgumentText = ScratchBlocks => {
120
+ const FieldTextInput = ScratchBlocks?.FieldTextInput;
121
+ const field = FieldTextInput?.prototype;
122
+ if (!field?.showEditor_ || !field.getDisplayText_ || installed.has(field))
123
+ return;
124
+ installed.add(field);
125
+ const { getDisplayText_: displayText, showEditor_: showEditor } = field;
126
+ field.getDisplayText_ = function (...args) {
127
+ const value = this.text_;
128
+ const cut = typeof value === 'string' ? argumentTextCut(value) : undefined;
129
+ if (cut === undefined)
130
+ return displayText.apply(this, args);
131
+ // The inherited code still handles empty values, spacing and right-to-left text.
132
+ this.text_ = `${value.slice(0, cut)}…`;
133
+ try {
134
+ return displayText.apply(this, args);
135
+ }
136
+ finally {
137
+ this.text_ = value;
138
+ }
139
+ };
140
+ field.showEditor_ = function (quietInput, readOnly, ...rest) {
141
+ const block = this.sourceBlock_;
142
+ const document = block?.workspace?.getInjectionDiv?.()?.ownerDocument;
143
+ if (Object.getPrototypeOf(this) !== field || readOnly || !document ||
144
+ typeof this.text_ !== 'string' || !editsInDialog(this.text_)) {
145
+ return showEditor.call(this, quietInput, readOnly, ...rest);
146
+ }
147
+ ScratchBlocks.WidgetDiv?.hide?.();
148
+ ScratchBlocks.DropDownDiv?.hideWithoutAnimation?.();
149
+ const locale = ScratchBlocks.ScratchMsgs?.currentLocale_ ?? document.documentElement.lang ?? 'en';
150
+ openArgumentTextDialog(document, this.text_, locale, value => {
151
+ if (this.sourceBlock_ !== block || !block.workspace)
152
+ return;
153
+ const validated = this.callValidator(value);
154
+ if (validated === null)
155
+ return;
156
+ const events = ScratchBlocks.Events;
157
+ events?.setGroup?.(true);
158
+ try {
159
+ // Same path as the inline editor's save: one change event, then the render.
160
+ this.setText(validated);
161
+ this.onFinishEditing_?.(validated);
162
+ }
163
+ finally {
164
+ events?.setGroup?.(false);
165
+ }
166
+ if (block.rendered)
167
+ block.render();
168
+ });
169
+ };
170
+ };
@@ -0,0 +1,17 @@
1
+ import { type BlockImportReceipt, type TargetPort, type VMPort } from '@kubohiroya/turbowarp-script-transfer';
2
+ type Destination = {
3
+ element: HTMLElement;
4
+ workspace: any;
5
+ target: TargetPort;
6
+ };
7
+ export declare function attachBlockDrag({ vm, workspace, ScratchBlocks: blocks, onError, prepareImport }: {
8
+ vm: VMPort;
9
+ workspace: any;
10
+ ScratchBlocks: any;
11
+ onError(error: unknown): void;
12
+ prepareImport(target: TargetPort): (receipt: BlockImportReceipt) => void;
13
+ }): {
14
+ register(destination: Destination): () => boolean;
15
+ dispose(): void;
16
+ };
17
+ export {};
@@ -0,0 +1,184 @@
1
+ import { exportScript, importScriptWithReceipt } from '@kubohiroya/turbowarp-script-transfer';
2
+ const sources = new WeakMap();
3
+ const installed = new WeakSet();
4
+ const onDragDisposed = new WeakMap();
5
+ function installDragStart(blocks) {
6
+ const prototype = blocks.BlockDragger.prototype;
7
+ if (installed.has(prototype))
8
+ return;
9
+ installed.add(prototype);
10
+ const { startBlockDrag, dispose } = prototype;
11
+ prototype.startBlockDrag = function (...args) {
12
+ sources.get(this.workspace_)?.(this);
13
+ return startBlockDrag.apply(this, args);
14
+ };
15
+ prototype.dispose = function (...args) {
16
+ onDragDisposed.get(this)?.();
17
+ return dispose.apply(this, args);
18
+ };
19
+ }
20
+ function finishAtSource(blocks, workspace, gesture, group) {
21
+ const { x, y } = gesture.mouseDownXY_;
22
+ const block = gesture.blockDragger_.draggingBlock_;
23
+ const connections = gesture.blockDragger_.draggedConnectionManager_;
24
+ const { isDeleteArea, isInsideBlocksArea } = workspace;
25
+ const { wouldConnectBlock } = connections;
26
+ const { scheduleSnapAndBump } = block;
27
+ const redo = workspace.redoStack_.slice();
28
+ // Finish the native gesture at its origin. A detached stack is reconnected by undoing
29
+ // just the drag's event group, before releasing the workspace to another tab.
30
+ workspace.isDeleteArea = () => blocks.DELETE_AREA_NONE;
31
+ workspace.isInsideBlocksArea = () => true;
32
+ connections.wouldConnectBlock = () => false;
33
+ block.scheduleSnapAndBump = () => { };
34
+ try {
35
+ const Mouse = workspace.getInjectionDiv().ownerDocument.defaultView.MouseEvent;
36
+ gesture.handleUp(new Mouse('mouseup', { clientX: x, clientY: y }));
37
+ blocks.Events.fireNow_();
38
+ if (group && workspace.undoStack_.at(-1)?.group === group) {
39
+ workspace.undo(false);
40
+ blocks.Events.fireNow_();
41
+ workspace.redoStack_ = redo;
42
+ }
43
+ }
44
+ finally {
45
+ workspace.isDeleteArea = isDeleteArea;
46
+ workspace.isInsideBlocksArea = isInsideBlocksArea;
47
+ connections.wouldConnectBlock = wouldConnectBlock;
48
+ block.scheduleSnapAndBump = scheduleSnapAndBump;
49
+ }
50
+ }
51
+ function positionIn(destination, { x, y }) {
52
+ const svg = destination.workspace.getParentSvg();
53
+ const matrix = destination.workspace.getCanvas().getScreenCTM();
54
+ if (!matrix)
55
+ return;
56
+ const point = svg.createSVGPoint();
57
+ point.x = x;
58
+ point.y = y;
59
+ const position = point.matrixTransform(matrix.inverse());
60
+ if (Number.isFinite(position.x) && Number.isFinite(position.y)) {
61
+ return { x: Math.round(destination.workspace.RTL ? -position.x : position.x), y: Math.round(position.y) };
62
+ }
63
+ }
64
+ export function attachBlockDrag({ vm, workspace, ScratchBlocks: blocks, onError, prepareImport }) {
65
+ const destinations = new Set();
66
+ const windowOffsets = new WeakMap();
67
+ let disposed = false;
68
+ let clearDrag;
69
+ function windowPoint(event, source, destination) {
70
+ if (source === destination)
71
+ return { x: event.clientX, y: event.clientY };
72
+ const host = source.defaultView;
73
+ const child = destination.defaultView;
74
+ if (!host || !child || (event.clientX >= 0 && event.clientX < host.innerWidth &&
75
+ event.clientY >= 0 && event.clientY < host.innerHeight))
76
+ return;
77
+ // A browser may continue to deliver mouse input to the pressed window. Prefer a
78
+ // measured viewport offset, accounting for browser chrome around a popup.
79
+ const measured = windowOffsets.get(child);
80
+ const border = (child.outerWidth - child.innerWidth) / 2;
81
+ const x = measured?.x ?? border;
82
+ const y = measured?.y ?? child.outerHeight - child.innerHeight - border;
83
+ return { x: event.screenX - child.screenX - x, y: event.screenY - child.screenY - y };
84
+ }
85
+ const current = (destination) => !disposed && destinations.has(destination) &&
86
+ destination.element.isConnected && vm.runtime.getTargetById(destination.target.id) === destination.target;
87
+ installDragStart(blocks);
88
+ sources.set(workspace, dragger => {
89
+ clearDrag?.();
90
+ const gesture = workspace.currentGesture_;
91
+ const down = gesture?.mostRecentEvent_;
92
+ const block = dragger.draggingBlock_;
93
+ const target = vm.editingTarget;
94
+ if (!destinations.size || !down?.type.startsWith('mouse') || !(down.buttons & 1) ||
95
+ gesture.flyout_ || block.isShadow() || !target?.blocks.getBlock(block.id))
96
+ return;
97
+ const source = workspace.getInjectionDiv().ownerDocument;
98
+ const stage = vm.runtime.getTargetForStage();
99
+ blocks.Events.fireNow_();
100
+ const root = block.getRootBlock().id;
101
+ const listeners = new AbortController();
102
+ clearDrag = () => {
103
+ listeners.abort();
104
+ onDragDisposed.delete(dragger);
105
+ clearDrag = undefined;
106
+ };
107
+ onDragDisposed.set(dragger, clearDrag);
108
+ const capture = { capture: true, signal: listeners.signal };
109
+ const documents = new Set([source, ...Array.from(destinations, item => item.element.ownerDocument)]);
110
+ for (const document of documents) {
111
+ document.addEventListener('mousemove', event => {
112
+ const host = document.defaultView;
113
+ const { clientX, clientY, screenX, screenY } = event;
114
+ if (host && clientX >= 0 && clientY >= 0 && clientX < host.innerWidth && clientY < host.innerHeight) {
115
+ windowOffsets.set(host, { x: screenX - clientX - host.screenX, y: screenY - clientY - host.screenY });
116
+ }
117
+ }, capture);
118
+ document.addEventListener('keydown', event => {
119
+ if (event.key !== 'Escape')
120
+ return;
121
+ clearDrag?.();
122
+ if (workspace.currentGesture_ !== gesture || gesture.blockDragger_ !== dragger)
123
+ return;
124
+ event.preventDefault();
125
+ finishAtSource(blocks, workspace, gesture, blocks.Events.getGroup());
126
+ }, capture);
127
+ document.addEventListener('mouseup', event => {
128
+ if (event.button !== 0)
129
+ return;
130
+ clearDrag?.();
131
+ if (workspace.currentGesture_ !== gesture || gesture.blockDragger_ !== dragger ||
132
+ vm.editingTarget !== target || vm.runtime.getTargetById(target.id) !== target ||
133
+ vm.runtime.getTargetForStage() !== stage)
134
+ return;
135
+ for (const destination of destinations) {
136
+ const element = destination.element;
137
+ const point = windowPoint(event, document, element.ownerDocument);
138
+ if (!point || !current(destination) ||
139
+ !element.contains(element.ownerDocument.elementFromPoint(point.x, point.y)))
140
+ continue;
141
+ const position = positionIn(destination, point);
142
+ if (!position)
143
+ continue;
144
+ event.preventDefault();
145
+ event.stopImmediatePropagation();
146
+ finishAtSource(blocks, workspace, gesture, blocks.Events.getGroup());
147
+ try {
148
+ const script = exportScript(vm, target, root);
149
+ let record;
150
+ void importScriptWithReceipt(vm, destination.target, script, {
151
+ position,
152
+ canCommit: () => current(destination) && vm.runtime.getTargetForStage() === stage,
153
+ beforeCommit: () => { record = prepareImport(destination.target); },
154
+ onCommitted: receipt => record(receipt)
155
+ }).catch(onError);
156
+ }
157
+ catch (error) {
158
+ onError(error);
159
+ }
160
+ return;
161
+ }
162
+ const host = source.defaultView;
163
+ if (document !== source || (host && (event.clientX < 0 || event.clientX >= host.innerWidth ||
164
+ event.clientY < 0 || event.clientY >= host.innerHeight))) {
165
+ event.preventDefault();
166
+ event.stopImmediatePropagation();
167
+ finishAtSource(blocks, workspace, gesture, blocks.Events.getGroup());
168
+ }
169
+ }, capture);
170
+ }
171
+ });
172
+ return {
173
+ register(destination) {
174
+ destinations.add(destination);
175
+ return () => destinations.delete(destination);
176
+ },
177
+ dispose() {
178
+ disposed = true;
179
+ clearDrag?.();
180
+ sources.delete(workspace);
181
+ destinations.clear();
182
+ }
183
+ };
184
+ }
@@ -0,0 +1,38 @@
1
+ import type { NativeFieldGraphic } from './native-field-svg.ts';
2
+ import { type CustomField } from './custom-extension-fields.ts';
3
+ export { createFieldActionDialog } from './programmatic-extension-field.ts';
4
+ type BlockDefinition = {
5
+ type: string;
6
+ [key: string]: unknown;
7
+ };
8
+ type Category = {
9
+ id: string;
10
+ xml: string;
11
+ };
12
+ type DynamicShape = {
13
+ mutation: string;
14
+ json: BlockDefinition;
15
+ };
16
+ export type CodeExtensions = {
17
+ definitions: BlockDefinition[];
18
+ categories: Category[];
19
+ dynamicDefaults: DynamicShape[];
20
+ customFields: CustomField[];
21
+ };
22
+ export declare function attachDockedCodeExtensions({ vm, ScratchBlocks, document, locale, onError: onFieldError }: {
23
+ vm: any;
24
+ ScratchBlocks: any;
25
+ document: any;
26
+ locale: any;
27
+ onError?: (_error: unknown) => void;
28
+ }): {
29
+ dispose(): void;
30
+ };
31
+ export declare function getCodeExtensions(runtime: any, target: any): CodeExtensions;
32
+ export declare function getCodeDynamicShapes(runtime: any, target: any): DynamicShape[];
33
+ export declare function createCodeExtensionPalette(blocks: any, openProgrammatic?: any): {
34
+ update({ definitions, categories, dynamicDefaults, customFields }: CodeExtensions): string;
35
+ setNativeFieldGraphics(graphics: NativeFieldGraphic[]): void;
36
+ setDynamicShapes(next: DynamicShape[]): void;
37
+ supports(xml: Element): boolean;
38
+ };