@gramlot/gramlot 0.3.20 → 0.3.26

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 (172) hide show
  1. package/dist/components/chat/__init__.py +13 -0
  2. package/dist/components/chat/assets/collection.js +9 -0
  3. package/dist/components/chat/assets/index.js +3 -0
  4. package/dist/components/chat/commands.json +7 -0
  5. package/dist/components/chat/grammar.json +48 -0
  6. package/dist/components/editors/__init__.py +2 -2
  7. package/dist/components/editors/assets/collection.js +26 -120912
  8. package/dist/components/editors/assets/index.js +2 -1
  9. package/dist/components/editors/assets/modules/chunk-74O4WKIV.js +1 -0
  10. package/dist/components/editors/assets/modules/chunk-AU4HFPIY.js +1 -0
  11. package/dist/components/editors/assets/modules/chunk-YSGSC7KM.js +1 -0
  12. package/dist/components/editors/assets/modules/code-mirror-engine-RWQTR5G5.js +92 -0
  13. package/dist/components/editors/assets/modules/jodit-engine-MTSA4GZ3.js +1853 -0
  14. package/dist/components/editors/assets/modules/markdown-document-VFC23FAY.js +1 -0
  15. package/dist/components/editors/assets/modules/prose-mirror-engine-GMZPJPNN.js +24 -0
  16. package/dist/components/grid/__init__.py +14 -0
  17. package/dist/components/grid/assets/collection.js +262 -0
  18. package/dist/components/grid/assets/index.js +3 -0
  19. package/dist/components/grid/commands.json +7 -0
  20. package/dist/components/grid/grammar.json +770 -0
  21. package/dist/components/grouplets/__init__.py +13 -0
  22. package/dist/components/grouplets/assets/collection.js +185 -0
  23. package/dist/components/grouplets/assets/index.js +3 -0
  24. package/dist/components/grouplets/assets/modules/chunk-BLMUM44K.js +1 -0
  25. package/dist/components/grouplets/assets/modules/markdown-document-YWNZTOKK.js +1 -0
  26. package/dist/components/grouplets/commands.json +7 -0
  27. package/dist/components/grouplets/grammar.json +355 -0
  28. package/dist/components/inputs/__init__.py +1 -1
  29. package/dist/components/inputs/assets/collection.js +65 -24511
  30. package/dist/components/inputs/assets/index.js +2 -1
  31. package/dist/components/inputs/grammar.json +278 -6
  32. package/dist/components/layout/__init__.py +1 -1
  33. package/dist/components/layout/assets/collection.js +68 -26732
  34. package/dist/components/layout/assets/index.js +2 -1
  35. package/dist/components/layout/grammar.json +39 -0
  36. package/dist/components/selection_trial/__init__.py +13 -0
  37. package/dist/components/selection_trial/assets/collection.js +4 -0
  38. package/dist/components/selection_trial/assets/index.js +3 -0
  39. package/dist/components/selection_trial/commands.json +7 -0
  40. package/dist/components/selection_trial/grammar.json +587 -0
  41. package/dist/components/tree/__init__.py +1 -1
  42. package/dist/components/tree/assets/collection.js +27 -24612
  43. package/dist/components/tree/assets/index.js +2 -1
  44. package/dist/components/tree/grammar.json +341 -1
  45. package/dist/components/typst/__init__.py +2 -2
  46. package/dist/components/typst/assets/collection.js +12 -4
  47. package/dist/components/typst/assets/index.js +2 -1
  48. package/dist/components/typst/assets/modules/chunk-BLMUM44K.js +1 -0
  49. package/dist/components/typst/assets/modules/typst-client-JHC6UVYG.js +4 -0
  50. package/dist/components/uploads/__init__.py +13 -0
  51. package/dist/components/uploads/assets/collection.js +67 -0
  52. package/dist/components/uploads/assets/index.js +3 -0
  53. package/dist/components/uploads/commands.json +7 -0
  54. package/dist/components/uploads/grammar.json +789 -0
  55. package/dist/gramlot-markdown.js +16 -0
  56. package/dist/gramlot.js +6861 -1395
  57. package/dist/gramlot.min.js +1595 -46
  58. package/dist/runtime-notices.json +28 -0
  59. package/package.json +10 -3
  60. package/src/binding/grid-struct.js +63 -0
  61. package/src/binding/installation.js +5 -2
  62. package/src/binding/providers.js +4 -1
  63. package/src/binding/remote-resolver.js +1 -8
  64. package/src/binding/runtime.js +90 -6
  65. package/src/binding/validation-context.js +40 -0
  66. package/src/browser-camera-provider.d.ts +8 -0
  67. package/src/browser-camera-provider.js +104 -0
  68. package/src/builder/gramlot-builder.d.ts +5 -0
  69. package/src/builder/gramlot-builder.js +16 -0
  70. package/src/builder/source.js +34 -0
  71. package/src/chat.d.ts +12 -0
  72. package/src/chat.js +198 -0
  73. package/src/collection-artifact.js +1 -1
  74. package/src/components/attachment-manager.js +160 -0
  75. package/src/components/bases.js +19 -6
  76. package/src/components/border-container.js +86 -8
  77. package/src/components/buttons.js +11 -1
  78. package/src/components/chat.js +28 -0
  79. package/src/components/choice-editor.js +106 -38
  80. package/src/components/database-choices.js +133 -9
  81. package/src/components/editing-status-styles.js +26 -0
  82. package/src/components/editing-status.js +115 -0
  83. package/src/components/field-state.js +42 -54
  84. package/src/components/grid-cell-editor.js +181 -0
  85. package/src/components/grid-grammar.json +258 -0
  86. package/src/components/grid-header-interaction.js +196 -0
  87. package/src/components/grid-row-interaction.js +184 -0
  88. package/src/components/grid-row-layout.js +96 -0
  89. package/src/components/grid-rows.js +28 -0
  90. package/src/components/grid-search-box.js +142 -0
  91. package/src/components/grid-search-styles.js +42 -0
  92. package/src/components/grid-search.js +37 -0
  93. package/src/components/grid-structure.js +85 -0
  94. package/src/components/grid-styles.js +201 -0
  95. package/src/components/grid.js +666 -0
  96. package/src/components/grouplet-card.js +445 -0
  97. package/src/components/grouplets.js +17 -0
  98. package/src/components/html-preview.js +17 -4
  99. package/src/components/image-crop-dialog.js +272 -0
  100. package/src/components/image-crop.js +79 -0
  101. package/src/components/image-uploader.js +252 -0
  102. package/src/components/inputs.js +2 -1
  103. package/src/components/jodit-engine.js +1 -1
  104. package/src/components/markdown-document.js +2 -2
  105. package/src/components/menus.js +1 -0
  106. package/src/components/registry.js +4 -3
  107. package/src/components/screen-capture.js +43 -0
  108. package/src/components/selected-container.js +6 -2
  109. package/src/components/tray-pane.js +32 -4
  110. package/src/components/tree.js +416 -17
  111. package/src/components/typed-editor.js +23 -11
  112. package/src/components/upload-engine.js +156 -0
  113. package/src/components/uploader.js +208 -0
  114. package/src/components/uploads.js +7 -0
  115. package/src/editing-session.d.ts +25 -0
  116. package/src/editing-session.js +396 -0
  117. package/src/experiments/selection-transfer.js +78 -0
  118. package/src/experiments/selection-trial.js +64 -0
  119. package/src/experiments/window-selection.js +124 -0
  120. package/src/format.js +22 -7
  121. package/src/gramlot.d.ts +2 -0
  122. package/src/gramlot.js +2 -1
  123. package/src/handlers/device-handler.d.ts +2 -1
  124. package/src/handlers/rpc-handler.d.ts +3 -3
  125. package/src/index-page-styles.js +2 -1
  126. package/src/index.d.ts +16 -1
  127. package/src/index.js +16 -1
  128. package/src/inout.d.ts +2 -0
  129. package/src/inout.js +6 -0
  130. package/src/markdown-loader.d.ts +1 -0
  131. package/src/markdown-loader.js +4 -0
  132. package/src/markdown.d.ts +1 -0
  133. package/src/markdown.js +2 -0
  134. package/src/media-frame.js +9 -0
  135. package/src/renderer/attributes.js +7 -1
  136. package/src/renderer/gramlot-renderer.d.ts +2 -0
  137. package/src/renderer/gramlot-renderer.js +39 -3
  138. package/src/server/assets.d.ts +1 -1
  139. package/src/server/assets.js +1 -1
  140. package/src/server/gramlot-server.d.ts +10 -1
  141. package/src/server/gramlot-server.js +96 -8
  142. package/src/server/index.d.ts +2 -0
  143. package/src/server/index.js +2 -0
  144. package/src/server/page-base.js +17 -4
  145. package/src/server/page.d.ts +13 -1
  146. package/src/server/page.js +6 -0
  147. package/src/server/source-import.d.ts +2 -0
  148. package/src/server/source-import.js +31 -0
  149. package/src/server/upload.d.ts +20 -0
  150. package/src/server/upload.js +142 -0
  151. package/src/server/visual-editor.d.ts +11 -0
  152. package/src/server/visual-editor.js +149 -0
  153. package/src/source-picker.d.ts +9 -0
  154. package/src/source-picker.js +57 -0
  155. package/src/stores/bag-collection-store.js +51 -0
  156. package/src/stores/bag-collection-view.js +127 -0
  157. package/src/stores/collection-filter.js +77 -0
  158. package/src/tree-store.d.ts +24 -0
  159. package/src/tree-store.js +193 -0
  160. package/src/validation-run.js +50 -0
  161. package/src/view/button.js +8 -5
  162. package/src/view/controls.js +31 -32
  163. package/src/view/grouplet-card.js +54 -0
  164. package/src/view/html.js +29 -4
  165. package/src/view/labelbox.js +7 -3
  166. package/src/visual-editor-icons.js +10 -0
  167. package/src/visual-editor.d.ts +56 -0
  168. package/src/visual-editor.js +844 -0
  169. package/themes/gramlot-base/theme.css +127 -0
  170. package/themes/gramlot-compact/theme.css +8 -0
  171. package/themes/joanna/theme.css +8 -0
  172. package/themes/mimi/theme.css +8 -0
@@ -0,0 +1,24 @@
1
+ import {BagResolver} from '@genrojs/bag';
2
+ import type {Bag, BagNode} from '@genrojs/bag';
3
+ import type {SourceBagNode} from '@genrojs/builders';
4
+ import type {Gramlot} from './gramlot.js';
5
+
6
+ export class TreeStoreResolver extends BagResolver {
7
+ constructor(options?: {readOnly?: boolean});
8
+ bind(store: TreeStore, path: string): void;
9
+ load(): Promise<Bag>;
10
+ }
11
+ export class TreeStore {
12
+ constructor(options: {gramlot: Gramlot; method: string; params?: Record<string, unknown>});
13
+ pathFor(node: BagNode): string;
14
+ load(path?: string, label?: string | null, attributes?: Record<string, unknown>): Promise<Bag>;
15
+ dispose(): void;
16
+ }
17
+ export class TreeStoreLogic {
18
+ treeStoreMount(node: SourceBagNode, args: {storeMethod: string; storeParams: Record<string, unknown>}): Promise<void>;
19
+ treeFavoritesMount(node: SourceBagNode, args: {favoriteKey: string}): void;
20
+ treeFavoriteActionState(node: SourceBagNode, args: {item: BagNode; state: Bag}): {hidden: boolean; icon: string; title: string};
21
+ treeFavoriteToggle(node: SourceBagNode, args: {item: BagNode; path: string; favoriteKey: string}): void;
22
+ treeInspect(node: SourceBagNode, args: {item: BagNode; path: string}): void;
23
+ treeInspectClose(node: SourceBagNode, event: Event): void;
24
+ }
@@ -0,0 +1,193 @@
1
+ import {Bag, BagResolver, registerResolver} from '@genrojs/bag';
2
+ import {fromTytx, toTytx} from '@genrojs/tytx';
3
+ import {GramlotBuilder} from './builder/gramlot-builder.js';
4
+ import {randomId} from './random-id.js';
5
+
6
+ /** A branch whose loader is supplied by its owning TreeStore after transport. */
7
+ export class TreeStoreResolver extends BagResolver {
8
+ constructor({readOnly = false} = {}) {
9
+ super({cacheTime: -1, readOnly});
10
+ this.store = null;
11
+ this.path = null;
12
+ this.pending = null;
13
+ }
14
+ bind(store, path) {
15
+ if (this.store !== null) throw new Error('TreeStoreResolver is already bound');
16
+ this.store = store;
17
+ this.path = path;
18
+ }
19
+ load() {
20
+ if (this.store === null) throw new Error('TreeStoreResolver is not bound to a store');
21
+ if (this.pending !== null) return this.pending;
22
+ const node = this.node;
23
+ const path = this.path ? this.store.pathFor(node) : '';
24
+ const pending = this.store.load(path, path ? node.label : null, path ? {...node.attr} : {});
25
+ this.pending = pending;
26
+ pending.finally(() => { if (this.pending === pending) this.pending = null; }).catch(() => {});
27
+ return pending;
28
+ }
29
+ }
30
+
31
+ registerResolver(TreeStoreResolver, {
32
+ module: 'gramlot.tree_store', name: 'TreeStoreResolver',
33
+ encode: () => ({args: [], kwargs: {}}),
34
+ decode: () => new TreeStoreResolver(),
35
+ });
36
+
37
+ /** One RPC method supplies the root and every lazy branch of a Data Bag. */
38
+ export class TreeStore {
39
+ constructor({gramlot, method, params = {}}) {
40
+ if (!gramlot || typeof method !== 'string' || !method) throw new TypeError('TreeStore requires a page and method');
41
+ for (const key of ['path', 'label', 'attributes']) {
42
+ if (Object.hasOwn(params, key)) throw new TypeError(`TreeStore params reserves ${key}`);
43
+ }
44
+ this.gramlot = gramlot;
45
+ this.method = method;
46
+ this.params = {...params};
47
+ this.controller = new AbortController();
48
+ this.root = null;
49
+ }
50
+ pathFor(node) {
51
+ const labels = [];
52
+ while (node && node.parentBag !== this.root) {
53
+ labels.unshift(node.label);
54
+ node = node.parentNode;
55
+ }
56
+ if (!node || this.root === null) throw new Error('TreeStore node is outside its root');
57
+ labels.unshift(node.label);
58
+ return labels.join('.');
59
+ }
60
+ async load(path = '', label = null, attributes = {}) {
61
+ if (this.controller.signal.aborted) throw this.controller.signal.reason;
62
+ const result = await this.gramlot.rpc.call('data', this.method,
63
+ {...this.params, path, label, attributes}, {signal: this.controller.signal});
64
+ if (this.controller.signal.aborted) throw this.controller.signal.reason;
65
+ if (!(result instanceof Bag)) throw new TypeError('TreeStore method must return a Bag');
66
+ if (!path) {
67
+ this.root = result;
68
+ result.setBackref();
69
+ }
70
+ const bind = (bag, prefix) => {
71
+ for (const node of bag.getNodes()) {
72
+ const nodePath = prefix ? `${prefix}.${node.label}` : node.label;
73
+ if (node.resolver instanceof TreeStoreResolver) node.resolver.bind(this, nodePath);
74
+ if (node.staticValue instanceof Bag) bind(node.staticValue, nodePath);
75
+ }
76
+ };
77
+ bind(result, path);
78
+ return result;
79
+ }
80
+ dispose() { this.controller.abort(); }
81
+ }
82
+
83
+ /** Source lifecycle for the Python tree_store composition. */
84
+ export class TreeStoreLogic {
85
+ treeFavoriteActionState(node, {item, state}) {
86
+ const hidden = item.resolver !== null || item.staticValue instanceof Bag;
87
+ if (item.getAttr('favoriteEntry') === true) return {hidden: false, icon: '✕', title: 'Remove favorite'};
88
+ const saved = !hidden && state.getNodes().some(favorite => favorite.getAttr('fieldpath') === item.getAttr('fieldpath'));
89
+ return {hidden, icon: saved ? '♥' : '♡', title: saved ? 'Remove favorite' : 'Add favorite'};
90
+ }
91
+
92
+ treeFavoritesMount(node, {favoriteKey}) {
93
+ const storage = this.page.src.renderer.destination.ownerDocument.defaultView.localStorage;
94
+ const saved = storage.getItem(favoriteKey);
95
+ this.setTreeFavorites(node.getRelativeData('.'), saved === null ? [] : fromTytx(saved));
96
+ }
97
+
98
+ setTreeFavorites(state, records) {
99
+ if (!Array.isArray(records)) throw new TypeError('Tree favorites must be an array');
100
+ const favorites = new Bag();
101
+ records.forEach((record, index) => {
102
+ if (!record || typeof record.fieldpath !== 'string' || typeof record.path !== 'string' ||
103
+ typeof record.caption !== 'string' || !record.attrs || typeof record.attrs !== 'object') {
104
+ throw new TypeError('Invalid tree favorite');
105
+ }
106
+ const attrs = {...record.attrs};
107
+ for (const name of ['caption', 'fullcaption']) {
108
+ if (typeof attrs[name] === 'string')
109
+ attrs[name] = attrs[name].replace(/(^|\.)!!(?:\[[^\]]+\])?/g, '$1');
110
+ }
111
+ favorites.setItem(`favorite_${index}`, null, {...attrs,
112
+ favoriteEntry: true, originalPath: record.path});
113
+ });
114
+ state.setItem('favorites', favorites);
115
+ }
116
+
117
+ treeFavoriteToggle(node, {item, path, favoriteKey}) {
118
+ if (item.resolver || item.staticValue instanceof Bag) return;
119
+ const attrs = item.getAttr();
120
+ const state = node.getRelativeData('.');
121
+ const records = state.getItem('favorites').getNodes().map(favorite => {
122
+ const {favoriteEntry, originalPath, ...attributes} = favorite.getAttr();
123
+ return {fieldpath: attributes.fieldpath, path: originalPath, caption: attributes.caption, attrs: attributes};
124
+ });
125
+ const index = records.findIndex(record => record.fieldpath === attrs.fieldpath);
126
+ if (index === -1) records.push({fieldpath: attrs.fieldpath, path, caption: attrs.caption, attrs: {...attrs}});
127
+ else records.splice(index, 1);
128
+ const storage = this.page.src.renderer.destination.ownerDocument.defaultView.localStorage;
129
+ storage.setItem(favoriteKey, toTytx(records));
130
+ this.setTreeFavorites(state, records);
131
+ }
132
+
133
+ treeStoreMount(node, {storeMethod, storeParams}) {
134
+ const scope = node.parentNode;
135
+ const state = node.getRelativeData('.');
136
+ const store = new TreeStore({gramlot: this.page, method: storeMethod, params: storeParams});
137
+ this.page.src.renderer.onDispose(scope, () => store.dispose());
138
+ const resolver = new TreeStoreResolver({readOnly: true});
139
+ resolver.bind(store, '');
140
+ state.setResolver('store', resolver);
141
+ return Promise.resolve(state.getItem('store')).then(value => {
142
+ if (!store.controller.signal.aborted) state.setItem('store', value);
143
+ });
144
+ }
145
+
146
+ treeInspect(node, {item, path}) {
147
+ const binding = this.page.src.binding.bindingFor(node);
148
+ let closed = false;
149
+ const id = `tree_inspect_${randomId()}`;
150
+ let release = () => {};
151
+ const close = () => {
152
+ if (closed) return;
153
+ closed = true;
154
+ release();
155
+ if (this.page.src.source.getNode(id)) this.page.src.source.popNode(id);
156
+ };
157
+ release = binding.track(close);
158
+ try {
159
+ const builder = new GramlotBuilder();
160
+ const dialog = builder.root.html_dialog({nodeId: id, request: id,
161
+ connect_oncancel: 'treeInspectClose', connect_onclose: 'treeInspectClose',
162
+ 'aria-labelledby': `${id}_title`,
163
+ style: 'width:min(36rem,calc(100% - 48px));max-height:80vh;overflow:auto;'});
164
+ dialog.h2('Attributes', {id: `${id}_title`});
165
+ dialog.p(`==${JSON.stringify(path)}`);
166
+ dialog.html_button('Close', {type: 'button', autofocus: true, request: id, connect_onclick: 'treeInspectClose'});
167
+ const table = dialog.table();
168
+ for (const [name, value] of Object.entries(item.getAttr())) {
169
+ const row = table.tr();
170
+ row.th(`==${JSON.stringify(name)}`, {scope: 'row'});
171
+ const text = typeof value === 'string' ? value : value === undefined ? 'undefined' : toTytx(value);
172
+ row.td(`==${JSON.stringify(text)}`);
173
+ }
174
+ this.page.src.source.setItem(id, this.page.src.prepareSource(builder.source));
175
+ const dialogNode = this.page.src.binding.nodeIds.get(id);
176
+ Object.defineProperty(dialogNode, 'treeInspectClose', {value: close, configurable: true});
177
+ this.page.src.renderer.onDispose(dialogNode, () => {
178
+ close();
179
+ delete dialogNode.treeInspectClose;
180
+ });
181
+ this.page.dom.getDomNode(dialogNode).showModal();
182
+ } catch (error) {
183
+ close();
184
+ throw error;
185
+ }
186
+ }
187
+
188
+ treeInspectClose(node, event) {
189
+ event.preventDefault();
190
+ const dialog = this.page.src.binding.nodeIds.get(node.getAttr('request'));
191
+ if (dialog) dialog.treeInspectClose();
192
+ }
193
+ }
@@ -0,0 +1,50 @@
1
+ /** One validation attempt lifecycle, independent of a mounted control. */
2
+ export class ValidationRun {
3
+ epoch = 0;
4
+ controller = null;
5
+ cancel() {
6
+ this.epoch++;
7
+ this.controller?.abort();
8
+ this.controller = null;
9
+ }
10
+ start(value, rules, context, execute, complete, pending = () => {}) {
11
+ this.cancel();
12
+ const controller = new AbortController(), epoch = this.epoch;
13
+ this.controller = controller;
14
+ const current = context.validationCurrent();
15
+ const isCurrent = () => epoch === this.epoch && !controller.signal.aborted && current();
16
+ const failure = error => ({value, modified:false, error:error.message, warnings:[], issues:[], datachanges:[]});
17
+ let settled = false;
18
+ const finish = result => {
19
+ if (settled || !isCurrent()) return {ok:false};
20
+ settled = true;
21
+ this.controller = null;
22
+ const outcome = {ok:!result.error, value:result.value, result, rules, isCurrent};
23
+ complete(outcome);
24
+ return outcome;
25
+ };
26
+ let result;
27
+ try {
28
+ if (rules.validate_timeout != null && (!Number.isInteger(rules.validate_timeout) || rules.validate_timeout <= 0)) {
29
+ throw new TypeError('validate_timeout must be a positive integer in milliseconds.');
30
+ }
31
+ result = execute(value, rules, {...context, signal:controller.signal});
32
+ } catch (error) { return finish(failure(error)); }
33
+ if (!(result instanceof Promise)) return finish(result);
34
+ pending();
35
+ return new Promise(resolve => {
36
+ let timer;
37
+ const abort = () => { clearTimeout(timer); resolve({ok:false}); };
38
+ controller.signal.addEventListener('abort', abort, {once:true});
39
+ const settle = answer => {
40
+ clearTimeout(timer);
41
+ controller.signal.removeEventListener('abort', abort);
42
+ try { resolve(finish(answer)); } catch (error) { context.reportError(error, 'Validation completion failed'); resolve({ok:false}); }
43
+ };
44
+ if (rules.validate_timeout != null) timer = setTimeout(() => {
45
+ settle(failure(new Error('Validation timed out.'))); controller.abort();
46
+ }, rules.validate_timeout);
47
+ result.then(settle, error => settle(failure(error)));
48
+ });
49
+ }
50
+ }
@@ -122,6 +122,9 @@ export class ButtonBinding {
122
122
  event.stopPropagation();
123
123
  return target.activateCommand(event);
124
124
  }
125
+ const rowActions = this.element.closest('gramlot-row-actions');
126
+ const rowContext = rowActions ? rowActions.getRowContext() : null;
127
+ if (rowActions && rowContext === null) return;
125
128
  if (!this.element.prepareCommand(event)) return;
126
129
  const mechanism = this.mechanism;
127
130
  if (!mechanism) return;
@@ -143,7 +146,7 @@ export class ButtonBinding {
143
146
  release();
144
147
  this.#cancelDelay = null;
145
148
  this.#pendingCount = 0;
146
- this.#execute(event, count, activation);
149
+ this.#execute(event, count, activation, rowContext);
147
150
  }, delay);
148
151
  const release = this.binding.track(() => this.#cancelDelay?.());
149
152
  this.#cancelDelay = () => {
@@ -156,7 +159,7 @@ export class ButtonBinding {
156
159
  return;
157
160
  }
158
161
  this.#cancelDelay?.();
159
- return this.#execute(event, counter, activation);
162
+ return this.#execute(event, counter, activation, rowContext);
160
163
  }
161
164
 
162
165
  async #executeRegistered(activation) {
@@ -175,7 +178,7 @@ export class ButtonBinding {
175
178
  }
176
179
 
177
180
  /** Deliver the last event once; arguments are read when the mechanism executes. */
178
- #execute(event, counter, activation = null) {
181
+ #execute(event, counter, activation = null, rowContext = null) {
179
182
  if (activation) return this.#executeRegistered(activation);
180
183
  if (this.binding.closed || this.element.disabled) return;
181
184
  const mechanism = this.mechanism;
@@ -184,12 +187,12 @@ export class ButtonBinding {
184
187
  const modifiers = eventToString(event);
185
188
  if (mechanism === 'controller') {
186
189
  const provider = this.binding.runtime.bindingFor(this.controllers[0])?.providers[0];
187
- provider?.invoke({kind: 'click', event, counter});
190
+ provider?.invoke({kind: 'click', event, counter, rowContext});
188
191
  } else if (mechanism === 'action') {
189
192
  const read = () => {
190
193
  const [, attrs] = node.rootBuilder.runtimeValues(node);
191
194
  const authored = Object.fromEntries(Object.entries(attrs).filter(([name]) => name !== 'ask'));
192
- return {...this.binding.runtime.renderer.references.resolveArguments(authored), event, _counter: counter, modifiers};
195
+ return {...this.binding.runtime.renderer.references.resolveArguments(authored), ...rowContext, event, _counter: counter, modifiers};
193
196
  };
194
197
  const execute = result => {
195
198
  if (this.binding.closed || this.element.disabled || result === null) return;
@@ -7,8 +7,9 @@
7
7
 
8
8
  import {createDecimal, isDecimal, getDecimalLibrary} from '@genrojs/tytx';
9
9
  import {Bag} from '@genrojs/bag';
10
+ import {validationContext} from '../binding/validation-context.js';
10
11
  import {XHTML_NS} from '../renderer/attributes.js';
11
- import {callLogic, invokeHook} from '../binding/hooks.js';
12
+ import {callLogic} from '../binding/hooks.js';
12
13
 
13
14
  // Native input.type and input/select.multiple use setters; radio group updates membership.
14
15
  const CONTROL_TAGS = new Set(['input', 'select', 'textarea']);
@@ -205,21 +206,34 @@ export class ControlAdapter {
205
206
 
206
207
  /** Custom controls share the existing typed commit, IME and cleanup machinery. */
207
208
  class ComponentControl extends ControlAdapter {
209
+ #releaseForm;
210
+ form = null;
208
211
  static writesDefault = false;
209
212
  static preservesUnchangedValue = true;
210
213
  get eventElement() { return this.element.control; }
211
214
  attach() {
215
+ this.form = this.element.supportsFormValidation && this.node.pointerType(this.node.getAttr('value')) === '^' ? this.node.formState : null;
212
216
  this.element.setPageContext(componentContext(this));
217
+ if (this.form && this.node.pointerType(this.node.getAttr('value')) === '^') this.#releaseForm = this.form.register(this);
213
218
  super.attach();
214
219
  }
220
+ refresh() {
221
+ const form = this.element.supportsFormValidation && this.node.pointerType(this.node.getAttr('value')) === '^' ? this.node.formState : null;
222
+ if (form === this.form) return;
223
+ this.#releaseForm?.();
224
+ this.form = form;
225
+ this.element.setPageContext(componentContext(this));
226
+ this.#releaseForm = form ? form.register(this) : null;
227
+ }
215
228
  project(value, change) {
216
229
  if (this.element.shouldProjectControlValue(value)) super.project(value, change);
217
230
  }
218
231
  same(a, b) { return this.element.sameControlValue(a, b); }
219
- detach() { this.element.releaseControl(); super.detach(); }
232
+ detach() { this.element.releaseControl(); this.#releaseForm?.(); super.detach(); }
220
233
  commit(event) {
221
234
  if (this.binding.closed || this.element.control.disabled || this.element.control.readOnly) return;
222
- commitComponent(this.element, this.element.acceptControlValue(), result => super.commit(event, result.value));
235
+ const outcome = this.element.acceptControlValue();
236
+ if (!this.form) commitComponent(this.element, outcome, result => super.commit(event, result.value));
223
237
  }
224
238
  get writeEvent() {
225
239
  if (this.element.commitOnChange) return 'change';
@@ -229,6 +243,9 @@ class ComponentControl extends ControlAdapter {
229
243
  read() { return this.element.readControlValue(); }
230
244
  write(value) { this.element.writeControlValue(value); }
231
245
  handleEvent(event) {
246
+ if (event.type === 'input' && this.form && !this.binding.closed && !this.element.control.disabled && !this.element.control.readOnly) {
247
+ this.form.draft(this.node,this.element.control.value ?? '');
248
+ }
232
249
  super.handleEvent(event);
233
250
  // Native change does not cross a shadow boundary; expose it to connect_onchange.
234
251
  if (!event.composed && !this.binding.closed && ['input', 'change'].includes(event.type)) {
@@ -590,19 +607,22 @@ const INPUT_CONTROLS = {
590
607
  /** Component validation uses the same Source, activated code and RPC services as controllers. */
591
608
  function componentContext(adapter) {
592
609
  const {binding, node} = adapter, app = binding.runtime.gramlot;
593
- const invoke = (attribute, code, keywords, expression = false) => {
594
- if (!expression) return invokeHook(binding.runtime, node, attribute, code, keywords);
595
- return binding.runtime.inlineCompiler.compile(node, attribute, code, Object.keys(keywords),
596
- `return (${code});`)(keywords);
597
- };
598
610
  return {
599
611
  locale:app.locale, timeZone:app.timeZone, createDecimal, isDecimal, getDecimalLibrary,
612
+ form:adapter.form,
613
+ formCancelValidation:() => adapter.form?.cancelValidation(node),
614
+ formValidateCandidate:(value, selection) => adapter.form.validateCandidate(node,value,selection),
615
+ formValidate:() => adapter.form?.scheduleValidation(adapter),
616
+ formSelectionPending:active => adapter.form?.pendingPart(node,'selection',active ? 'active' : null),
617
+ formSelectionError:message => adapter.form?.issue(node,'selection',message),
618
+ formParseError:message => adapter.form?.parseError(node,message),
619
+ formClearDraft:() => adapter.form?.clearDraft(node),
600
620
  publish:(topic, payload) => node.publish(topic, payload),
601
621
  isActive:() => !binding.closed,
602
622
  reportError:(error, title) => { if (!binding.closed) binding.runtime.reportError(error, title); },
603
623
  callLogic:(name, keywords) => callLogic(binding.runtime, node, name, keywords),
604
- format:(value, options) => app.format(value, options), invoke,
605
- remote:(method, keywords, signal) => app.rpc.call('data', method, keywords, {signal}),
624
+ format:(value, options) => app.format(value, options),
625
+ ...validationContext(binding),
606
626
  selectionOutputs:({selectedCaption, selectedRecord, fields}, row) => {
607
627
  if (binding.closed) return;
608
628
  if (selectedCaption) node.setRelativeData(selectedCaption, row?.caption ?? null);
@@ -611,30 +631,9 @@ function componentContext(adapter) {
611
631
  node.setRelativeData(path, row?.record[name.slice(9)] ?? null);
612
632
  }
613
633
  },
614
- validationCurrent:() => {
615
- const pointer = node.getAttr('value');
616
- const path = node.pointerType(pointer) ? node.absDatapath(pointer) : null;
617
- return () => !binding.closed && node.getAttr('value') === pointer && (path === null || node.absDatapath(pointer) === path);
618
- },
619
- finishValidation:({ok, result, rules}) => {
620
- if (binding.closed) return;
621
- if (ok) for (const patch of result.datachanges) node.getRelativeData('.').update(patch);
622
- const attribute = ok ? 'validate_onAccept' : 'validate_onReject';
623
- if (rules[attribute]) {
624
- const report = error => { if (!binding.closed) binding.runtime.reportError(error, 'Validation callback failed'); };
625
- try {
626
- const validations = Object.fromEntries(Object.entries(rules).map(([key, value]) => [key.slice(9), value]));
627
- const returned = invoke(attribute, rules[attribute], {value:result.value, result, validations, userChange:true});
628
- if (returned instanceof Promise) returned.catch(report);
629
- } catch (error) { report(error); }
630
- }
631
- },
632
- checkDataPatch:patch => {
633
- if (!(patch instanceof Bag)) throw new TypeError('Validation data changes must be a Bag.');
634
- if (!(node.getRelativeData('.') instanceof Bag)) throw new TypeError('Validation data changes require a Bag datapath.');
635
- }
636
634
  };
637
635
  }
636
+
638
637
  function commitComponent(host, outcome, commit) {
639
638
  const context = host.pageContext;
640
639
  const finish = result => { if (result.ok && result.isCurrent()) { commit(result); host.finishValidation(result); } };
@@ -0,0 +1,54 @@
1
+ /** Confirmed clearing belongs to Source/Data, never to DOM input scraping. */
2
+ import {SourceBag, pointerTransform} from '@genrojs/builders';
3
+
4
+ export class GroupletCardActions {
5
+ #closed = false;
6
+ #pending = false;
7
+ constructor(binding, element) { this.binding = binding; this.element = element; }
8
+ attach() { this.element.cardActions = this; }
9
+ detach() { this.#closed = true; delete this.element.cardActions; }
10
+ async clear() {
11
+ const {binding, element} = this;
12
+ const allowed = () => !this.#closed && !binding.closed && element.isConnected
13
+ && element.parameters.delitem === true;
14
+ if (this.#pending || !allowed()) return;
15
+ const node = binding.node, source = node.value, root = node.absDatapath('.');
16
+ if (root === null || !(source instanceof SourceBag)) return;
17
+ this.#pending = true;
18
+ try {
19
+ const confirmed = await binding.runtime.askDialog.show(binding, {
20
+ title: 'Clear card fields',
21
+ msg: `Clear the fields of “${element.parameters.title}”? This cannot be undone.`,
22
+ }, {});
23
+ // A refreshed body or a different record requires a fresh confirmation.
24
+ if (confirmed === null || !allowed() || node.value !== source || node.absDatapath('.') !== root) return;
25
+ const fields = new Map();
26
+ const states = new Set();
27
+ const retainStates = card => {
28
+ for (const name of ['collapsed', 'checkbox']) {
29
+ const pointer = card.getAttr(name);
30
+ if (card.pointerType(pointer)) states.add(card.absDatapath(pointer));
31
+ }
32
+ };
33
+ retainStates(node);
34
+ const visit = bag => {
35
+ for (const child of bag.getNodes()) {
36
+ if (child.nodeTag === 'groupletCard') retainStates(child);
37
+ const pointer = child.getAttr('value');
38
+ if (!child._getMeta('data_element') && child.pointerType(pointer) === '^' && !pointerTransform(pointer)) {
39
+ const path = child.absDatapath(pointer);
40
+ if (path !== null && (root === '' || path.startsWith(`${root}.`))) fields.set(path, {child, pointer});
41
+ }
42
+ if (child.staticValue instanceof SourceBag) visit(child.staticValue);
43
+ }
44
+ };
45
+ visit(source);
46
+ for (const [path, {child, pointer}] of fields) {
47
+ if (!allowed() || node.value !== source || node.absDatapath('.') !== root) break;
48
+ if (states.has(path)) continue;
49
+ if (child.getAttr('value') !== pointer || child.absDatapath(pointer) !== path) continue;
50
+ binding.runtime.renderer.html.writeParameter(child, 'value', null);
51
+ }
52
+ } finally { this.#pending = false; }
53
+ }
54
+ }
package/src/view/html.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import {createLabelbox, projectLabelbox, labelboxStyle} from './labelbox.js';
2
+ import {commandFrame, frameRecipient} from './menu-command.js';
2
3
  import {randomId} from '../random-id.js';
3
4
  import {SourceBag, META_ATTRS, resolveRenderTag, sourceAttributeItems, SvgBuilder, pointerTransform} from '@genrojs/builders';
4
5
  import {ControlAdapter} from './controls.js';
@@ -38,7 +39,9 @@ function domPropertyName(name) {
38
39
  * names and style arrive adapted by the renderers (GramlotHtmlRenderer, GramlotSvgRenderer).
39
40
  */
40
41
  export class HtmlElement {
41
- constructor({metadataAttributes = [], invokeScript = null, callLogic = null, reportError = null} = {}) {
42
+ constructor({format, metadataAttributes = [], invokeScript = null, callLogic = null, reportError = null, uploadContext = null} = {}) {
43
+ this.format = format;
44
+ this.uploadContext = uploadContext;
42
45
  this.invokeScript = invokeScript;
43
46
  this.callLogic = callLogic;
44
47
  this.reportError = reportError;
@@ -67,8 +70,11 @@ export class HtmlElement {
67
70
  if (text != null && !['string', 'number', 'boolean'].includes(typeof text)) {
68
71
  throw new TypeError('HTML text must be scalar');
69
72
  }
73
+ const component = this.definition(node).meta.gramlot_component;
70
74
  for (const [key, value] of Object.entries(node.attr)) {
71
- if (key === 'value' && this.definition(node).meta.gramlot_component) continue;
75
+ // Declared component parameters are checked by the builder schema;
76
+ // only ordinary DOM attributes must be scalar.
77
+ if (component && Object.hasOwn(component.parameters, key)) continue;
72
78
  if (node.nodeTag === 'menuline' && key === 'parameters') continue;
73
79
  if (this.metadataAttributes.has(key) || ['ask', '_ask'].includes(key) || (value && typeof value === 'object' && Object.hasOwn(value, '$gramlotRef'))) continue;
74
80
  if (value != null && !['string', 'number', 'boolean'].includes(typeof value)) {
@@ -120,6 +126,13 @@ export class HtmlElement {
120
126
  }
121
127
  if (meta.gramlot_component?.sourceContext) {
122
128
  element.setSourceContext({
129
+ sourceNode: node,
130
+ frameRecipient: () => frameRecipient(commandFrame(node)),
131
+ locale: node.rootBuilder.binding.gramlot.locale,
132
+ timeZone: node.rootBuilder.binding.gramlot.timeZone,
133
+ collectionView: (bag, rowMode) => node.rootBuilder.binding.collectionView(node, bag, rowMode),
134
+ format: this.format,
135
+ upload: () => this.uploadContext(),
123
136
  reportError: (error, title) => this.reportError(node, error, title),
124
137
  publish: (topic, payload) => node.publish(topic, payload),
125
138
  writeParameter: (name, value) => this.writeParameter(node, name, value),
@@ -176,7 +189,7 @@ export class HtmlElement {
176
189
  * other value gives the current `style` back (V1, legacy genro_wdg.js). The `value` of a form
177
190
  * control belongs to its ControlAdapter: neither the attribute nor the property is written here.
178
191
  */
179
- update(record, node, attrs = node.attr, textValue = DEFAULT_TEXT, visible = null) {
192
+ update(record, node, attrs = node.attr, textValue = DEFAULT_TEXT, visible = null, change = null) {
180
193
  if (node.nodeTag === 'script') {
181
194
  for (const [name, code] of node.codeAttributes()) {
182
195
  if (node.activatedCode(name) !== code) {
@@ -215,7 +228,19 @@ export class HtmlElement {
215
228
  }
216
229
  if (this.definition(node).meta.gramlot_component) {
217
230
  if (this.definition(node).meta.gramlot_component.bagStore) {
218
- element.setStoreBag(node.getRelativeData(node.getAttr('storepath')));
231
+ if (node.nodeTag === 'tree') element.setStoreBag(node.rootBuilder.binding.treeStore(node));
232
+ else {
233
+ const path = node.absDatapath(node.getAttr('storepath'));
234
+ if (!change || change.path === path || change.path.startsWith(`${path}.`) || path.startsWith(`${change.path}.`)) {
235
+ element.setStoreBag(node.getRelativeData(node.getAttr('storepath')));
236
+ }
237
+ }
238
+ }
239
+ if (this.definition(node).meta.gramlot_component.bagStruct) {
240
+ const path = node.absDatapath(node.getAttr('structpath'));
241
+ if (!change || change.path === path || change.path.startsWith(`${path}.`) || path.startsWith(`${change.path}.`)) {
242
+ element.setStructBag(node.getRelativeData(node.getAttr('structpath')));
243
+ }
219
244
  }
220
245
  attrs = element.projectAttributes(attrs, adapt);
221
246
  }
@@ -22,10 +22,14 @@ export const labelboxStyle = `.gramlot-labelbox[hidden]{display:none!important}
22
22
  .gramlot-labelbox[data-movable]>.label-box{cursor:grab;touch-action:none;user-select:none}
23
23
  .gramlot-labelbox[data-movable]>.label-box>label{cursor:inherit;user-select:none;-webkit-user-select:none}
24
24
  .gramlot-labelbox[data-selected]{outline:2px solid var(--gramlot-focus-ring,var(--gramlot-brand-blue,#3766b5));outline-offset:-2px}
25
- .gramlot-labelbox[data-tray-block]>.label-box{position:relative;padding-inline:32px 60px}
26
- .gramlot-labelbox>.label-box>.tray-settings-button{position:absolute;right:3px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:26px;height:26px;padding:4px;border:0;border-radius:4px;background:transparent;color:inherit;cursor:pointer}
25
+ .gramlot-labelbox[data-tray-block]>.label-box{position:relative;padding-inline:88px 32px}
26
+ .gramlot-labelbox>.label-box>.tray-settings-button{position:absolute;left:31px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:26px;height:26px;padding:4px;border:0;border-radius:4px;background:transparent;color:inherit;cursor:pointer}
27
27
  .gramlot-labelbox>.label-box>button[hidden]{display:none}
28
- .gramlot-labelbox>.label-box>.tray-settings-button[data-kind=layer]{right:31px}
28
+ .gramlot-labelbox>.label-box>.tray-settings-button[data-kind=layer]{left:59px}
29
+ .gramlot-labelbox>.label-box>.tray-close{position:absolute;right:3px;top:50%;transform:translateY(-50%);width:26px;height:26px;display:grid;place-items:center;padding:4px;border:0;border-radius:4px;background:transparent;color:inherit;cursor:pointer;opacity:.65}
30
+ .tray-close svg{width:18px;height:18px;pointer-events:none}
31
+ .gramlot-labelbox>.label-box>.tray-close:hover{opacity:1;background:color-mix(in srgb,currentColor 12%,transparent)}
32
+ .tray-close:focus-visible{opacity:1;outline:2px solid var(--gramlot-focus-ring,Highlight);outline-offset:-2px}
29
33
  .tray-settings-button{opacity:.65}
30
34
  .tray-settings-button:hover,.tray-settings-button:focus-visible{opacity:1}
31
35
  .tray-settings-button svg{width:18px;height:18px;pointer-events:none}
@@ -0,0 +1,10 @@
1
+ export const toolIcons = {"navigation": "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%237b8795%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%223%22%20y%3D%224%22%20width%3D%2218%22%20height%3D%2216%22%20rx%3D%222%22%2F%3E%3Cpath%20d%3D%22M9%204v16M5.5%208h1M5.5%2012h1%22%2F%3E%3C%2Fsvg%3E", "catalogue": "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%237b8795%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%223%22%20y%3D%223%22%20width%3D%227%22%20height%3D%227%22%20rx%3D%221%22%2F%3E%3Crect%20x%3D%2214%22%20y%3D%223%22%20width%3D%227%22%20height%3D%227%22%20rx%3D%221%22%2F%3E%3Crect%20x%3D%223%22%20y%3D%2214%22%20width%3D%227%22%20height%3D%227%22%20rx%3D%221%22%2F%3E%3Cpath%20d%3D%22M14%2017.5h7M17.5%2014v7%22%2F%3E%3C%2Fsvg%3E", "properties": "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%237b8795%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M4%206h16M4%2012h16M4%2018h16%22%2F%3E%3Ccircle%20cx%3D%228%22%20cy%3D%226%22%20r%3D%222%22%2F%3E%3Ccircle%20cx%3D%2216%22%20cy%3D%2212%22%20r%3D%222%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2218%22%20r%3D%222%22%2F%3E%3C%2Fsvg%3E", "new": "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%237b8795%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M14%202H6a2%202%200%200%200-2%202v16a2%202%200%200%200%202%202h12a2%202%200%200%200%202-2V8Z%20M14%202v6h6%20M8%2015h8%20M12%2011v8%22%2F%3E%3C%2Fsvg%3E", "download": "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%237b8795%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M12%203v12m-5-5%205%205%205-5%20M4%2016v4a1%201%200%200%200%201%201h14a1%201%200%200%200%201-1v-4%22%2F%3E%3C%2Fsvg%3E", "copy": "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%237b8795%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%228%22%20y%3D%228%22%20width%3D%2212%22%20height%3D%2213%22%20rx%3D%222%22%2F%3E%3Cpath%20d%3D%22M16%208V5a2%202%200%200%200-2-2H5a2%202%200%200%200-2%202v9a2%202%200%200%200%202%202h3%22%2F%3E%3C%2Fsvg%3E"};
2
+
3
+ toolIcons.open = "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%237b8795%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%207V5a2%202%200%200%201%202-2h5l2%202h7a2%202%200%200%201%202%202v2M3%209h18l-2%2011H4z%22%2F%3E%3C%2Fsvg%3E";
4
+
5
+ toolIcons.cut = 'data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%237b8795%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Ccircle%20cx%3D%226%22%20cy%3D%226%22%20r%3D%223%22%2F%3E%3Ccircle%20cx%3D%226%22%20cy%3D%2218%22%20r%3D%223%22%2F%3E%3Cpath%20d%3D%22m8%208%2012%2012M8%2016%2020%204%22%2F%3E%3C%2Fsvg%3E';
6
+
7
+ toolIcons.paste = 'data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%237b8795%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%225%22%20y%3D%225%22%20width%3D%2214%22%20height%3D%2216%22%20rx%3D%222%22%2F%3E%3Crect%20x%3D%229%22%20y%3D%222%22%20width%3D%226%22%20height%3D%225%22%20rx%3D%221%22%2F%3E%3Cpath%20d%3D%22M9%2012h6m-6%204h6%22%2F%3E%3C%2Fsvg%3E';
8
+
9
+
10
+ toolIcons.appearance = 'data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%228%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.7%22%2F%3E%3Cpath%20d%3D%22M12%204a8%208%200%200%201%200%2016z%22%20fill%3D%22black%22%2F%3E%3C%2Fsvg%3E';