@gramlot/gramlot 0.3.24 → 0.3.27

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 (144) hide show
  1. package/dist/components/chat/__init__.py +1 -1
  2. package/dist/components/chat/assets/collection.js +3 -3
  3. package/dist/components/chat/assets/index.js +1 -1
  4. package/dist/components/editors/__init__.py +2 -2
  5. package/dist/components/editors/assets/collection.js +21 -20
  6. package/dist/components/editors/assets/index.js +1 -1
  7. package/dist/components/editors/assets/modules/chunk-74O4WKIV.js +1 -0
  8. package/dist/components/editors/assets/modules/{code-mirror-engine-QX4A5FVO.js → code-mirror-engine-RWQTR5G5.js} +29 -29
  9. package/dist/components/editors/assets/modules/{jodit-engine-MMSPIWM7.js → jodit-engine-MTSA4GZ3.js} +292 -292
  10. package/dist/components/editors/assets/modules/markdown-document-VFC23FAY.js +1 -0
  11. package/dist/components/editors/assets/modules/{prose-mirror-engine-IXTRTG6B.js → prose-mirror-engine-GMZPJPNN.js} +13 -13
  12. package/dist/components/grid/__init__.py +3 -2
  13. package/dist/components/grid/assets/collection.js +77 -17
  14. package/dist/components/grid/assets/index.js +1 -1
  15. package/dist/components/grid/grammar.json +78 -1
  16. package/dist/components/grouplets/__init__.py +2 -2
  17. package/dist/components/grouplets/assets/collection.js +3 -20
  18. package/dist/components/grouplets/assets/index.js +1 -1
  19. package/dist/components/grouplets/assets/modules/chunk-BLMUM44K.js +1 -0
  20. package/dist/components/grouplets/assets/modules/markdown-document-YWNZTOKK.js +1 -0
  21. package/dist/components/inputs/__init__.py +1 -1
  22. package/dist/components/inputs/assets/collection.js +59 -34
  23. package/dist/components/inputs/assets/index.js +1 -1
  24. package/dist/components/inputs/grammar.json +64 -0
  25. package/dist/components/layout/__init__.py +1 -1
  26. package/dist/components/layout/assets/collection.js +67 -57
  27. package/dist/components/layout/assets/index.js +1 -1
  28. package/dist/components/layout/grammar.json +35 -0
  29. package/dist/components/selection_trial/__init__.py +1 -1
  30. package/dist/components/selection_trial/assets/collection.js +3 -3
  31. package/dist/components/selection_trial/assets/index.js +1 -1
  32. package/dist/components/selection_trial/grammar.json +35 -0
  33. package/dist/components/tree/__init__.py +1 -1
  34. package/dist/components/tree/assets/collection.js +26 -23
  35. package/dist/components/tree/assets/index.js +1 -1
  36. package/dist/components/tree/grammar.json +341 -1
  37. package/dist/components/typst/__init__.py +1 -1
  38. package/dist/components/typst/assets/collection.js +3 -3
  39. package/dist/components/typst/assets/index.js +1 -1
  40. package/dist/components/uploads/__init__.py +13 -0
  41. package/dist/components/uploads/assets/collection.js +67 -0
  42. package/dist/components/uploads/assets/index.js +3 -0
  43. package/dist/components/uploads/commands.json +7 -0
  44. package/dist/components/uploads/grammar.json +789 -0
  45. package/dist/{components/editors/assets/modules/chunk-OCFLP2K4.js → gramlot-markdown.js} +12 -12
  46. package/dist/gramlot.js +5455 -573
  47. package/dist/gramlot.min.js +1588 -43
  48. package/dist/runtime-notices.json +28 -0
  49. package/package.json +4 -2
  50. package/src/binding/grid-struct.js +1 -1
  51. package/src/binding/providers.js +4 -1
  52. package/src/binding/remote-resolver.js +1 -8
  53. package/src/binding/runtime.js +40 -1
  54. package/src/binding/validation-context.js +41 -0
  55. package/src/browser-camera-provider.d.ts +8 -0
  56. package/src/browser-camera-provider.js +104 -0
  57. package/src/builder/source.js +13 -2
  58. package/src/components/attachment-manager.js +160 -0
  59. package/src/components/bases.js +19 -6
  60. package/src/components/border-container.js +86 -8
  61. package/src/components/buttons.js +11 -1
  62. package/src/components/choice-editor.js +44 -16
  63. package/src/components/database-choices.js +13 -8
  64. package/src/components/editing-status-styles.js +26 -0
  65. package/src/components/editing-status.js +115 -0
  66. package/src/components/field-state.js +44 -58
  67. package/src/components/grid-cell-editor.js +245 -0
  68. package/src/components/grid-grammar.json +42 -0
  69. package/src/components/grid-structure.js +5 -1
  70. package/src/components/grid-styles.js +60 -1
  71. package/src/components/grid.js +103 -11
  72. package/src/components/grouplet-card.js +11 -3
  73. package/src/components/html-preview.js +17 -4
  74. package/src/components/image-crop-dialog.js +272 -0
  75. package/src/components/image-crop.js +79 -0
  76. package/src/components/image-uploader.js +252 -0
  77. package/src/components/inputs.js +4 -3
  78. package/src/components/jodit-engine.js +1 -1
  79. package/src/components/markdown-document.js +2 -2
  80. package/src/components/parameters.js +6 -2
  81. package/src/components/screen-capture.js +43 -0
  82. package/src/components/selected-container.js +6 -2
  83. package/src/components/tree.js +417 -17
  84. package/src/components/typed-editor.js +19 -9
  85. package/src/components/upload-engine.js +156 -0
  86. package/src/components/uploader.js +208 -0
  87. package/src/components/uploads.js +7 -0
  88. package/src/components/validation.js +1 -1
  89. package/src/editing-session.d.ts +26 -0
  90. package/src/editing-session.js +494 -0
  91. package/src/editor-values.js +57 -0
  92. package/src/experiments/selection-trial.js +18 -2
  93. package/src/format.js +22 -7
  94. package/src/gramlot.d.ts +3 -0
  95. package/src/gramlot.js +9 -5
  96. package/src/handlers/device-handler.d.ts +2 -1
  97. package/src/handlers/rpc-handler.d.ts +3 -3
  98. package/src/index-page-styles.js +1 -0
  99. package/src/index.d.ts +14 -1
  100. package/src/index.js +13 -0
  101. package/src/inout.d.ts +2 -0
  102. package/src/inout.js +6 -0
  103. package/src/markdown-loader.d.ts +1 -0
  104. package/src/markdown-loader.js +4 -0
  105. package/src/markdown.d.ts +1 -0
  106. package/src/markdown.js +2 -0
  107. package/src/media-frame.js +9 -0
  108. package/src/renderer/attributes.js +7 -1
  109. package/src/renderer/gramlot-renderer.d.ts +3 -0
  110. package/src/renderer/gramlot-renderer.js +42 -2
  111. package/src/server/assets.d.ts +1 -1
  112. package/src/server/assets.js +1 -1
  113. package/src/server/gramlot-server.d.ts +8 -1
  114. package/src/server/gramlot-server.js +83 -7
  115. package/src/server/index.d.ts +2 -0
  116. package/src/server/index.js +2 -0
  117. package/src/server/page-base.js +17 -4
  118. package/src/server/page.d.ts +13 -1
  119. package/src/server/page.js +6 -0
  120. package/src/server/source-import.d.ts +2 -0
  121. package/src/server/source-import.js +35 -0
  122. package/src/server/upload.d.ts +20 -0
  123. package/src/server/upload.js +142 -0
  124. package/src/server/visual-editor.d.ts +11 -0
  125. package/src/server/visual-editor.js +159 -0
  126. package/src/source-picker.d.ts +9 -0
  127. package/src/source-picker.js +56 -0
  128. package/src/tree-store.d.ts +24 -0
  129. package/src/tree-store.js +193 -0
  130. package/src/validation-run.js +50 -0
  131. package/src/view/button.js +8 -5
  132. package/src/view/controls.js +9 -42
  133. package/src/view/html.js +10 -2
  134. package/src/visual-editor-canvas.js +29 -0
  135. package/src/visual-editor-catalogue.js +34 -0
  136. package/src/visual-editor-icons.js +10 -0
  137. package/src/visual-editor.d.ts +61 -0
  138. package/src/visual-editor.js +1062 -0
  139. package/themes/gramlot-base/theme.css +141 -0
  140. package/tools/gramlot-tools-inspector.js +1 -1
  141. package/tools/inspector-agent.js +1 -1
  142. package/dist/components/editors/assets/modules/chunk-MMJXUHRQ.js +0 -3
  143. package/src/form-state.d.ts +0 -20
  144. package/src/form-state.js +0 -198
@@ -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']);
@@ -207,14 +208,6 @@ export class ControlAdapter {
207
208
  class ComponentControl extends ControlAdapter {
208
209
  #releaseForm;
209
210
  form = null;
210
- commitFormValue(value) { super.commit(null,value); }
211
- validateForm() {
212
- const value = this.node.getRelativeData(this.node.getAttr('value'));
213
- commitComponent(this.element,this.element.validateCandidate(value, () => {}), result => {
214
- this.form.candidate(this,result.value);
215
- });
216
- }
217
-
218
211
  static writesDefault = false;
219
212
  static preservesUnchangedValue = true;
220
213
  get eventElement() { return this.element.control; }
@@ -239,7 +232,8 @@ class ComponentControl extends ControlAdapter {
239
232
  detach() { this.element.releaseControl(); this.#releaseForm?.(); super.detach(); }
240
233
  commit(event) {
241
234
  if (this.binding.closed || this.element.control.disabled || this.element.control.readOnly) return;
242
- 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));
243
237
  }
244
238
  get writeEvent() {
245
239
  if (this.element.commitOnChange) return 'change';
@@ -613,18 +607,12 @@ const INPUT_CONTROLS = {
613
607
  /** Component validation uses the same Source, activated code and RPC services as controllers. */
614
608
  function componentContext(adapter) {
615
609
  const {binding, node} = adapter, app = binding.runtime.gramlot;
616
- const invoke = (attribute, code, keywords, expression = false) => {
617
- if (!expression) return invokeHook(binding.runtime, node, attribute, code, keywords);
618
- return binding.runtime.inlineCompiler.compile(node, attribute, code, Object.keys(keywords),
619
- `return (${code});`)(keywords);
620
- };
621
610
  return {
622
611
  locale:app.locale, timeZone:app.timeZone, createDecimal, isDecimal, getDecimalLibrary,
623
612
  form:adapter.form,
624
- formCandidate:value => adapter.form?.candidate(adapter,value),
625
- formPending:pending => adapter.form?.pending(adapter,pending),
613
+ formCancelValidation:() => adapter.form?.cancelValidation(node),
614
+ formValidateCandidate:(value, selection) => adapter.form.validateCandidate(node,value,selection),
626
615
  formValidate:() => adapter.form?.scheduleValidation(adapter),
627
- formResult:result => adapter.form?.result(node,result),
628
616
  formSelectionPending:active => adapter.form?.pendingPart(node,'selection',active ? 'active' : null),
629
617
  formSelectionError:message => adapter.form?.issue(node,'selection',message),
630
618
  formParseError:message => adapter.form?.parseError(node,message),
@@ -633,8 +621,8 @@ function componentContext(adapter) {
633
621
  isActive:() => !binding.closed,
634
622
  reportError:(error, title) => { if (!binding.closed) binding.runtime.reportError(error, title); },
635
623
  callLogic:(name, keywords) => callLogic(binding.runtime, node, name, keywords),
636
- format:(value, options) => app.format(value, options), invoke,
637
- remote:(method, keywords, signal) => app.rpc.call('data', method, keywords, {signal}),
624
+ format:(value, options) => app.format(value, options),
625
+ ...validationContext(binding),
638
626
  selectionOutputs:({selectedCaption, selectedRecord, fields}, row) => {
639
627
  if (binding.closed) return;
640
628
  if (selectedCaption) node.setRelativeData(selectedCaption, row?.caption ?? null);
@@ -643,30 +631,9 @@ function componentContext(adapter) {
643
631
  node.setRelativeData(path, row?.record[name.slice(9)] ?? null);
644
632
  }
645
633
  },
646
- validationCurrent:() => {
647
- const pointer = node.getAttr('value');
648
- const path = node.pointerType(pointer) ? node.absDatapath(pointer) : null;
649
- return () => !binding.closed && node.getAttr('value') === pointer && (path === null || node.absDatapath(pointer) === path);
650
- },
651
- finishValidation:({ok, result, rules}) => {
652
- if (binding.closed) return;
653
- if (ok) for (const patch of result.datachanges) node.getRelativeData('.').update(patch);
654
- const attribute = ok ? 'validate_onAccept' : 'validate_onReject';
655
- if (rules[attribute]) {
656
- const report = error => { if (!binding.closed) binding.runtime.reportError(error, 'Validation callback failed'); };
657
- try {
658
- const validations = Object.fromEntries(Object.entries(rules).map(([key, value]) => [key.slice(9), value]));
659
- const returned = invoke(attribute, rules[attribute], {value:result.value, result, validations, userChange:true});
660
- if (returned instanceof Promise) returned.catch(report);
661
- } catch (error) { report(error); }
662
- }
663
- },
664
- checkDataPatch:patch => {
665
- if (!(patch instanceof Bag)) throw new TypeError('Validation data changes must be a Bag.');
666
- if (!(node.getRelativeData('.') instanceof Bag)) throw new TypeError('Validation data changes require a Bag datapath.');
667
- }
668
634
  };
669
635
  }
636
+
670
637
  function commitComponent(host, outcome, commit) {
671
638
  const context = host.pageContext;
672
639
  const finish = result => { if (result.ok && result.isCurrent()) { commit(result); host.finishValidation(result); } };
package/src/view/html.js CHANGED
@@ -39,8 +39,9 @@ function domPropertyName(name) {
39
39
  * names and style arrive adapted by the renderers (GramlotHtmlRenderer, GramlotSvgRenderer).
40
40
  */
41
41
  export class HtmlElement {
42
- constructor({format, metadataAttributes = [], invokeScript = null, callLogic = null, reportError = null} = {}) {
42
+ constructor({format, metadataAttributes = [], invokeScript = null, callLogic = null, reportError = null, uploadContext = null} = {}) {
43
43
  this.format = format;
44
+ this.uploadContext = uploadContext;
44
45
  this.invokeScript = invokeScript;
45
46
  this.callLogic = callLogic;
46
47
  this.reportError = reportError;
@@ -131,6 +132,7 @@ export class HtmlElement {
131
132
  timeZone: node.rootBuilder.binding.gramlot.timeZone,
132
133
  collectionView: (bag, rowMode) => node.rootBuilder.binding.collectionView(node, bag, rowMode),
133
134
  format: this.format,
135
+ upload: () => this.uploadContext(),
134
136
  reportError: (error, title) => this.reportError(node, error, title),
135
137
  publish: (topic, payload) => node.publish(topic, payload),
136
138
  writeParameter: (name, value) => this.writeParameter(node, name, value),
@@ -226,7 +228,13 @@ export class HtmlElement {
226
228
  }
227
229
  if (this.definition(node).meta.gramlot_component) {
228
230
  if (this.definition(node).meta.gramlot_component.bagStore) {
229
- 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
+ }
230
238
  }
231
239
  if (this.definition(node).meta.gramlot_component.bagStruct) {
232
240
  const path = node.absDatapath(node.getAttr('structpath'));
@@ -0,0 +1,29 @@
1
+ /** An editor-owned document destination for the same live Source and renderer. */
2
+ export class VisualEditorCanvas {
3
+ constructor({app, editor, design}) {
4
+ this.renderer = app.src.renderer;
5
+ this.design = design;
6
+ const presentation = this.renderer.records.get(design).presentation;
7
+ this.frame = presentation.ownerDocument.createElement('iframe');
8
+ this.frame.title = 'Page canvas';
9
+ this.frame.className = 'visual-editor-canvas-frame';
10
+ this.frame.style.cssText = 'display:block;width:100%;height:100%;min-height:240px;border:0;background:white';
11
+ presentation.before(this.frame);
12
+ const document = this.frame.contentDocument;
13
+ app.registerDocument(document);
14
+ const base = document.createElement('style');
15
+ base.textContent = 'html,body{margin:0;min-height:100%;} .visual-editor-canvas{min-height:100vh;}';
16
+ this.styles = document.createElement('style');
17
+ const selection = document.createElement('style');
18
+ selection.textContent = '.gramlot-source-selected{outline:2px solid #8ab4f8!important;outline-offset:-2px!important;}';
19
+ document.head.append(base, this.styles, selection);
20
+ this.body = document.body;
21
+ this.renderer.mountDestination(design, this.body);
22
+ this.release = this.renderer.onDispose(editor, () => this.dispose());
23
+ }
24
+ setCss(texts) { this.styles.textContent = texts.join('\n'); }
25
+ dispose() {
26
+ this.release?.(); this.release = null;
27
+ this.frame.remove();
28
+ }
29
+ }
@@ -0,0 +1,34 @@
1
+ import {HtmlBuilder, SourceBag} from '@genrojs/builders';
2
+
3
+ const htmlTags = new Set(Object.entries(new HtmlBuilder().schema)
4
+ .filter(([, info]) => !info._meta?.data_element && !info._meta?.subbuilder && !info._meta?.container)
5
+ .map(([tag]) => tag));
6
+
7
+ export function validateCatalogue(catalogue) {
8
+ if (catalogue == null || catalogue === 'html') return;
9
+ if (!Array.isArray(catalogue) || catalogue.some(tag => typeof tag !== 'string' || !tag || tag.trim() !== tag))
10
+ throw new TypeError('catalogue must be "html" or a list of tag names');
11
+ if (!catalogue.includes('div')) throw new Error('catalogue must include div for pageRoot');
12
+ }
13
+
14
+ export function catalogueAllows(catalogue, tag, meta = {}) {
15
+ if (catalogue == null) return true;
16
+ if (Array.isArray(catalogue)) return catalogue.includes(tag);
17
+ return !meta.gramlot_component && !meta.data_element && !meta.subbuilder && !meta.container
18
+ && htmlTags.has(meta.render_tag ?? tag);
19
+ }
20
+
21
+ export function validateCatalogueSource(catalogue, source) {
22
+ if (catalogue == null) return;
23
+ const visit = (bag, prefix) => {
24
+ for (const node of bag.getNodes()) {
25
+ const path = prefix ? `${prefix}.${node.label}` : node.label;
26
+ if (!catalogueAllows(catalogue, node.nodeTag, node.getAttr('_meta') ?? {}))
27
+ throw new Error(`Tag ${node.nodeTag} is outside the editor catalogue at ${path}`);
28
+ if (node.resolver) throw new Error(`Catalogue scope requires materialized Source at ${path}`);
29
+ const value = node.getValue(true);
30
+ if (value instanceof SourceBag) visit(value, path);
31
+ }
32
+ };
33
+ visit(source, '');
34
+ }
@@ -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';
@@ -0,0 +1,61 @@
1
+ import type {SourceBagNode} from '@genrojs/builders';
2
+ export function visualEditorScope(node:SourceBagNode):SourceBagNode;
3
+ export class VisualEditorLogic {
4
+ setCanvasCss(node:SourceBagNode, texts:string[]):void;
5
+ loadSource(node:SourceBagNode, document:{source:string; filename:string}):void;
6
+ currentSource(node:SourceBagNode):string;
7
+ markSaved(node:SourceBagNode):void;
8
+ initializeDocument(node:SourceBagNode):void;
9
+ chatRender(node:SourceBagNode, ...args:unknown[]):unknown;
10
+ chatCompleted(node:SourceBagNode, ...args:unknown[]):unknown;
11
+ chatReset(node:SourceBagNode, ...args:unknown[]):unknown;
12
+ chatResize(node:SourceBagNode, ...args:unknown[]):unknown;
13
+ chatPickAttachments(node:SourceBagNode, ...args:unknown[]):unknown;
14
+ chatRenderAttachments(node:SourceBagNode, ...args:unknown[]):unknown;
15
+ chatRemoveAttachment(node:SourceBagNode, ...args:unknown[]):unknown;
16
+ chatSend(node:SourceBagNode, ...args:unknown[]):unknown;
17
+ assistantState(node:SourceBagNode, ...args:unknown[]):unknown;
18
+ assistantApply(node:SourceBagNode, ...args:unknown[]):unknown;
19
+ applySourceEdit(node:SourceBagNode, ...args:unknown[]):unknown;
20
+ initializeCanvasSelection(node:SourceBagNode, ...args:unknown[]):unknown;
21
+ highlightSelection(node:SourceBagNode, ...args:unknown[]):unknown;
22
+ clipboardShortcut(node:SourceBagNode, ...args:unknown[]):unknown;
23
+ clipboardModifiers(node:SourceBagNode, ...args:unknown[]):unknown;
24
+ cutBranch(node:SourceBagNode, ...args:unknown[]):unknown;
25
+ copyBranch(node:SourceBagNode, ...args:unknown[]):unknown;
26
+ dropClipboard(node:SourceBagNode, ...args:unknown[]):unknown;
27
+ prepareClipboard(node:SourceBagNode, ...args:unknown[]):unknown;
28
+ branchSnapshot(node:SourceBagNode, ...args:unknown[]):unknown;
29
+ beginClipboard(node:SourceBagNode, ...args:unknown[]):unknown;
30
+ saveClipboard(node:SourceBagNode, ...args:unknown[]):unknown;
31
+ pasteBranch(node:SourceBagNode, ...args:unknown[]):unknown;
32
+ beginPaste(node:SourceBagNode, ...args:unknown[]):unknown;
33
+ finishPaste(node:SourceBagNode, ...args:unknown[]):unknown;
34
+ openCode(node:SourceBagNode, ...args:unknown[]):unknown;
35
+ codeSave(node:SourceBagNode, ...args:unknown[]):unknown;
36
+ codePreview(node:SourceBagNode, ...args:unknown[]):unknown;
37
+ newPage(node:SourceBagNode, ...args:unknown[]):unknown;
38
+ copySource(node:SourceBagNode, ...args:unknown[]):unknown;
39
+ downloadPage(node:SourceBagNode, ...args:unknown[]):unknown;
40
+ openUpload(node:SourceBagNode, ...args:unknown[]):unknown;
41
+ sourceUploaded(node:SourceBagNode, ...args:unknown[]):unknown;
42
+ toggleNavigation(node:SourceBagNode, ...args:unknown[]):unknown;
43
+ openCatalogue(node:SourceBagNode, ...args:unknown[]):unknown;
44
+ openProperties(node:SourceBagNode, ...args:unknown[]):unknown;
45
+ sourceLabel(node:SourceBagNode, ...args:unknown[]):unknown;
46
+ dropNode(node:SourceBagNode, ...args:unknown[]):unknown;
47
+ insertWidget(node:SourceBagNode, ...args:unknown[]):unknown;
48
+ initializeEditor(node:SourceBagNode, ...args:unknown[]):unknown;
49
+ prepareWidget(node:SourceBagNode, ...args:unknown[]):unknown;
50
+ prepareSource(node:SourceBagNode, ...args:unknown[]):unknown;
51
+ applyDrop(node:SourceBagNode, ...args:unknown[]):unknown;
52
+ showProperties(node:SourceBagNode, ...args:unknown[]):unknown;
53
+ toggleLabelboxAttributes(node:SourceBagNode, ...args:unknown[]):unknown;
54
+ labelboxFields(node:SourceBagNode, ...args:unknown[]):unknown;
55
+ renderLabelboxAttribute(node:SourceBagNode, ...args:unknown[]):unknown;
56
+ parameterField(node:SourceBagNode, ...args:unknown[]):unknown;
57
+ renderParameterInput(node:SourceBagNode, ...args:unknown[]):unknown;
58
+ changePropertyType(node:SourceBagNode, ...args:unknown[]):unknown;
59
+ changeProperty(node:SourceBagNode, ...args:unknown[]):unknown;
60
+ applyInsert(node:SourceBagNode, ...args:unknown[]):unknown;
61
+ }