@gramlot/gramlot 0.3.9 → 0.3.15

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 (95) hide show
  1. package/dist/components/editors/__init__.py +13 -0
  2. package/dist/components/{editors.js → editors/assets/collection.js} +354 -418
  3. package/dist/components/editors/assets/index.js +2 -0
  4. package/dist/components/editors/commands.json +7 -0
  5. package/dist/components/editors/grammar.json +7045 -0
  6. package/dist/components/inputs/__init__.py +13 -0
  7. package/dist/components/{inputs.js → inputs/assets/collection.js} +291 -200
  8. package/dist/components/inputs/assets/index.js +2 -0
  9. package/dist/components/inputs/commands.json +7 -0
  10. package/dist/components/inputs/grammar.json +42881 -0
  11. package/dist/components/layout/__init__.py +13 -0
  12. package/dist/components/layout/assets/collection.js +25737 -0
  13. package/dist/components/layout/assets/index.js +2 -0
  14. package/dist/components/layout/commands.json +7 -0
  15. package/dist/components/layout/grammar.json +1798 -0
  16. package/dist/components/tree/__init__.py +13 -0
  17. package/dist/components/{tree.js → tree/assets/collection.js} +62 -175
  18. package/dist/components/tree/assets/index.js +2 -0
  19. package/dist/components/tree/commands.json +7 -0
  20. package/dist/components/tree/grammar.json +339 -0
  21. package/dist/components/typst/__init__.py +13 -0
  22. package/dist/components/typst/assets/collection.js +4 -0
  23. package/dist/components/typst/assets/index.js +2 -0
  24. package/dist/components/typst/commands.json +7 -0
  25. package/dist/components/typst/grammar.json +81 -0
  26. package/dist/gramlot.js +2525 -905
  27. package/dist/gramlot.min.js +109 -28
  28. package/dist/runtime-notices.json +0 -196
  29. package/package.json +1 -1
  30. package/src/binding/ask-dialog.js +1 -1
  31. package/src/binding/installation.js +5 -6
  32. package/src/binding/remote.js +9 -2
  33. package/src/binding/runtime.js +12 -5
  34. package/src/bootstrap.d.ts +1 -1
  35. package/src/bootstrap.js +52 -30
  36. package/src/builder/binding.json +25 -0
  37. package/src/builder/gramlot-builder.js +16 -3
  38. package/src/builder/source.js +41 -4
  39. package/src/collection-artifact.d.ts +11 -0
  40. package/src/collection-artifact.js +57 -0
  41. package/src/commands.d.ts +9 -0
  42. package/src/commands.js +36 -0
  43. package/src/components/bases.js +1 -1
  44. package/src/components/border-container.js +33 -2
  45. package/src/components/buttons.js +84 -161
  46. package/src/components/choice-editor.js +31 -10
  47. package/src/components/database-choices.js +110 -0
  48. package/src/components/inputs.js +15 -2
  49. package/src/components/layout.js +5 -3
  50. package/src/components/menus.js +346 -0
  51. package/src/components/popup.js +15 -2
  52. package/src/components/registry.js +18 -3
  53. package/src/components/toolbar-overflow.js +181 -0
  54. package/src/components/tree.js +14 -4
  55. package/src/components/validation.js +1 -1
  56. package/src/components/windows.js +284 -0
  57. package/src/gramlot.d.ts +2 -0
  58. package/src/gramlot.js +4 -2
  59. package/src/handlers/rpc-handler.d.ts +6 -1
  60. package/src/handlers/rpc-handler.js +7 -2
  61. package/src/handlers/source-handler.d.ts +2 -1
  62. package/src/handlers/source-handler.js +10 -1
  63. package/src/index-page-styles.js +1 -1
  64. package/src/index-theme.js +1 -1
  65. package/src/index.d.ts +5 -0
  66. package/src/index.js +5 -0
  67. package/src/renderer/attributes.js +11 -2
  68. package/src/renderer/gramlot-html-renderer.js +1 -0
  69. package/src/renderer/gramlot-renderer.js +13 -3
  70. package/src/server/assets.js +2 -2
  71. package/src/server/gramlot-file-server.d.ts +2 -0
  72. package/src/server/gramlot-file-server.js +45 -1
  73. package/src/server/gramlot-server.d.ts +20 -2
  74. package/src/server/gramlot-server.js +86 -6
  75. package/src/server/page-base.js +1 -0
  76. package/src/server/page.d.ts +3 -0
  77. package/src/view/button.js +47 -3
  78. package/src/view/controls.js +8 -0
  79. package/src/view/html.js +8 -0
  80. package/src/view/menu-command.js +45 -0
  81. package/src/view/menu.js +87 -0
  82. package/themes/gramlot-compact/README.md +19 -0
  83. package/themes/gramlot-compact/theme.css +138 -45
  84. package/themes/joanna/README.md +19 -0
  85. package/themes/joanna/theme.css +134 -78
  86. package/themes/mela/theme.css +184 -0
  87. package/themes/mimi/README.md +19 -0
  88. package/themes/mimi/theme.css +133 -77
  89. package/themes/palettes/README.md +3 -0
  90. package/themes/palettes/compact.css +86 -0
  91. package/themes/palettes/joanna.css +86 -0
  92. package/themes/palettes/mimi.css +86 -0
  93. package/tools/gramlot-tools-inspector.js +3 -3
  94. package/dist/components/layout.js +0 -1402
  95. package/dist/components/typst.js +0 -4
@@ -31,6 +31,7 @@ var __copyProps = (to, from2, except, desc) => {
31
31
  }
32
32
  return to;
33
33
  };
34
+ var __reExport = (target, mod2, secondTarget) => (__copyProps(target, mod2, "default"), secondTarget && __copyProps(secondTarget, mod2, "default"));
34
35
  var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
35
36
  // If the importer is in node compatibility mode or this is not an ESM
36
37
  // file that has been converted to a CommonJS file using a Babel-
@@ -60,7 +61,7 @@ var require_conventions = __commonJS({
60
61
  }
61
62
  }
62
63
  }
63
- function freeze4(object, oc) {
64
+ function freeze3(object, oc) {
64
65
  if (oc === void 0) {
65
66
  oc = Object;
66
67
  }
@@ -83,7 +84,7 @@ var require_conventions = __commonJS({
83
84
  }
84
85
  return target;
85
86
  }
86
- var HTML_BOOLEAN_ATTRIBUTES = freeze4({
87
+ var HTML_BOOLEAN_ATTRIBUTES = freeze3({
87
88
  allowfullscreen: true,
88
89
  async: true,
89
90
  autofocus: true,
@@ -112,7 +113,7 @@ var require_conventions = __commonJS({
112
113
  function isHTMLBooleanAttribute(name2) {
113
114
  return hasOwn(HTML_BOOLEAN_ATTRIBUTES, name2.toLowerCase());
114
115
  }
115
- var HTML_VOID_ELEMENTS = freeze4({
116
+ var HTML_VOID_ELEMENTS = freeze3({
116
117
  area: true,
117
118
  base: true,
118
119
  br: true,
@@ -131,7 +132,7 @@ var require_conventions = __commonJS({
131
132
  function isHTMLVoidElement(tagName2) {
132
133
  return hasOwn(HTML_VOID_ELEMENTS, tagName2.toLowerCase());
133
134
  }
134
- var HTML_RAW_TEXT_ELEMENTS = freeze4({
135
+ var HTML_RAW_TEXT_ELEMENTS = freeze3({
135
136
  script: false,
136
137
  style: false,
137
138
  textarea: true,
@@ -151,7 +152,7 @@ var require_conventions = __commonJS({
151
152
  function hasDefaultHTMLNamespace(mimeType) {
152
153
  return isHTMLMimeType(mimeType) || mimeType === MIME_TYPE.XML_XHTML_APPLICATION;
153
154
  }
154
- var MIME_TYPE = freeze4({
155
+ var MIME_TYPE = freeze3({
155
156
  /**
156
157
  * `text/html`, the only mime type that triggers treating an XML document as HTML.
157
158
  *
@@ -204,7 +205,7 @@ var require_conventions = __commonJS({
204
205
  function isValidMimeType(mimeType) {
205
206
  return _MIME_TYPES.indexOf(mimeType) > -1;
206
207
  }
207
- var NAMESPACE = freeze4({
208
+ var NAMESPACE = freeze3({
208
209
  /**
209
210
  * The XHTML namespace.
210
211
  *
@@ -232,7 +233,7 @@ var require_conventions = __commonJS({
232
233
  });
233
234
  exports.assign = assign3;
234
235
  exports.find = find2;
235
- exports.freeze = freeze4;
236
+ exports.freeze = freeze3;
236
237
  exports.HTML_BOOLEAN_ATTRIBUTES = HTML_BOOLEAN_ATTRIBUTES;
237
238
  exports.HTML_RAW_TEXT_ELEMENTS = HTML_RAW_TEXT_ELEMENTS;
238
239
  exports.HTML_VOID_ELEMENTS = HTML_VOID_ELEMENTS;
@@ -895,12 +896,12 @@ var require_dom = __commonJS({
895
896
  i2++;
896
897
  }
897
898
  }
898
- function _nnmBucket(map5, namespaceURI, create2) {
899
+ function _nnmBucket(map5, namespaceURI, create3) {
899
900
  if (!namespaceURI) {
900
901
  return map5._noNsIndex;
901
902
  }
902
903
  var bucket = map5._nsIndex[namespaceURI];
903
- if (!bucket && create2) {
904
+ if (!bucket && create3) {
904
905
  bucket = map5._nsIndex[namespaceURI] = /* @__PURE__ */ Object.create(null);
905
906
  }
906
907
  return bucket;
@@ -3286,15 +3287,15 @@ var require_dom = __commonJS({
3286
3287
  var require_entities = __commonJS({
3287
3288
  "node_modules/@xmldom/xmldom/lib/entities.js"(exports) {
3288
3289
  "use strict";
3289
- var freeze4 = require_conventions().freeze;
3290
- exports.XML_ENTITIES = freeze4({
3290
+ var freeze3 = require_conventions().freeze;
3291
+ exports.XML_ENTITIES = freeze3({
3291
3292
  amp: "&",
3292
3293
  apos: "'",
3293
3294
  gt: ">",
3294
3295
  lt: "<",
3295
3296
  quot: '"'
3296
3297
  });
3297
- exports.HTML_ENTITIES = freeze4({
3298
+ exports.HTML_ENTITIES = freeze3({
3298
3299
  Aacute: "\xC1",
3299
3300
  aacute: "\xE1",
3300
3301
  Abreve: "\u0102",
@@ -8618,8 +8619,8 @@ var init_dist = __esm({
8618
8619
  way it is initialized. Can be useful when you need to provide a
8619
8620
  non-default starting value for the field.
8620
8621
  */
8621
- init(create2) {
8622
- return [this, initField.of({ field: this, create: create2 })];
8622
+ init(create3) {
8623
+ return [this, initField.of({ field: this, create: create3 })];
8623
8624
  }
8624
8625
  /**
8625
8626
  State field instances can be used as
@@ -13178,9 +13179,9 @@ var init_dist2 = __esm({
13178
13179
  }
13179
13180
  });
13180
13181
  ViewPlugin = class _ViewPlugin {
13181
- constructor(id2, create2, domEventHandlers, domEventObservers, buildExtensions) {
13182
+ constructor(id2, create3, domEventHandlers, domEventObservers, buildExtensions) {
13182
13183
  this.id = id2;
13183
- this.create = create2;
13184
+ this.create = create3;
13184
13185
  this.domEventHandlers = domEventHandlers;
13185
13186
  this.domEventObservers = domEventObservers;
13186
13187
  this.baseExtensions = buildExtensions(this);
@@ -13196,9 +13197,9 @@ var init_dist2 = __esm({
13196
13197
  Define a plugin from a constructor function that creates the
13197
13198
  plugin's value, given an editor view.
13198
13199
  */
13199
- static define(create2, spec) {
13200
+ static define(create3, spec) {
13200
13201
  const { eventHandlers, eventObservers, provide, decorations: deco } = spec || {};
13201
- return new _ViewPlugin(nextPluginID++, create2, eventHandlers, eventObservers, (plugin) => {
13202
+ return new _ViewPlugin(nextPluginID++, create3, eventHandlers, eventObservers, (plugin) => {
13202
13203
  let ext = [];
13203
13204
  if (deco)
13204
13205
  ext.push(decorations.of((view) => {
@@ -20773,13 +20774,14 @@ function buildTree(data2) {
20773
20774
  cursor.next();
20774
20775
  let localChildren = [], localPositions = [];
20775
20776
  let localInRepeat = id2 >= minRepeatType ? id2 : -1;
20776
- let lastGroup = 0, lastEnd = end;
20777
+ let lastGroup = 0, lastEnd = end, groupLookAhead = lookAheadAtStart;
20777
20778
  while (cursor.pos > endPos) {
20778
20779
  if (localInRepeat >= 0 && cursor.id == localInRepeat && cursor.size >= 0) {
20779
20780
  if (cursor.end <= lastEnd - maxBufferLength) {
20780
- makeRepeatLeaf(localChildren, localPositions, start, lastGroup, cursor.end, lastEnd, localInRepeat, lookAheadAtStart, contextAtStart);
20781
+ makeRepeatLeaf(localChildren, localPositions, start, lastGroup, cursor.end, lastEnd, localInRepeat, groupLookAhead, contextAtStart);
20781
20782
  lastGroup = localChildren.length;
20782
20783
  lastEnd = cursor.end;
20784
+ groupLookAhead = lookAhead;
20783
20785
  }
20784
20786
  cursor.next();
20785
20787
  } else if (depth2 > 2500) {
@@ -20789,7 +20791,7 @@ function buildTree(data2) {
20789
20791
  }
20790
20792
  }
20791
20793
  if (localInRepeat >= 0 && lastGroup > 0 && lastGroup < localChildren.length)
20792
- makeRepeatLeaf(localChildren, localPositions, start, lastGroup, start, lastEnd, localInRepeat, lookAheadAtStart, contextAtStart);
20794
+ makeRepeatLeaf(localChildren, localPositions, start, lastGroup, start, lastEnd, localInRepeat, groupLookAhead, contextAtStart);
20793
20795
  localChildren.reverse();
20794
20796
  localPositions.reverse();
20795
20797
  if (localInRepeat > -1 && lastGroup > 0) {
@@ -20839,7 +20841,7 @@ function buildTree(data2) {
20839
20841
  if (!lastI && last2.type == type && last2.length == length2)
20840
20842
  return last2;
20841
20843
  if (lookAheadProp = last2.prop(NodeProp.lookAhead))
20842
- lookAhead2 = positions2[lastI] + last2.length + lookAheadProp;
20844
+ lookAhead2 = positions2[lastI] + last2.length + lookAheadProp - length2;
20843
20845
  }
20844
20846
  return makeTree(type, children2, positions2, length2, lookAhead2, contextHash2);
20845
20847
  };
@@ -44780,8 +44782,8 @@ var init_dom = __esm({
44780
44782
  /**
44781
44783
  * Wrap node inside another node
44782
44784
  */
44783
- static wrap(current, tag2, create2) {
44784
- const wrapper = isString2(tag2) ? create2.element(tag2) : tag2;
44785
+ static wrap(current, tag2, create3) {
44786
+ const wrapper = isString2(tag2) ? create3.element(tag2) : tag2;
44785
44787
  if (_Dom.isNode(current)) {
44786
44788
  if (!current.parentNode) {
44787
44789
  throw error("Element should be in DOM");
@@ -44833,15 +44835,15 @@ var init_dom = __esm({
44833
44835
  next = step;
44834
44836
  }
44835
44837
  }
44836
- static replace(elm, newTagName, create2, withAttributes = false, notMoveContent = false) {
44838
+ static replace(elm, newTagName, create3, withAttributes = false, notMoveContent = false) {
44837
44839
  if (isHTML(newTagName)) {
44838
- assert(create2, "Need create instance for new tag");
44839
- newTagName = create2.fromHTML(newTagName);
44840
+ assert(create3, "Need create instance for new tag");
44841
+ newTagName = create3.fromHTML(newTagName);
44840
44842
  }
44841
44843
  let tag2;
44842
44844
  if (isString2(newTagName)) {
44843
- assert(create2, "Need create instance for new tag");
44844
- tag2 = create2.element(newTagName);
44845
+ assert(create3, "Need create instance for new tag");
44846
+ tag2 = create3.element(newTagName);
44845
44847
  } else {
44846
44848
  tag2 = newTagName;
44847
44849
  }
@@ -56246,13 +56248,13 @@ var init_data_provider = __esm({
56246
56248
  * @param source - Server source key
56247
56249
  */
56248
56250
  createFolder(name2, path, source) {
56249
- const { create: create2 } = this.o;
56250
- if (!create2) {
56251
+ const { create: create3 } = this.o;
56252
+ if (!create3) {
56251
56253
  throw error("Set Create api options");
56252
56254
  }
56253
- create2.data.source = source;
56254
- create2.data.path = path;
56255
- create2.data.name = name2;
56255
+ create3.data.source = source;
56256
+ create3.data.path = path;
56257
+ create3.data.name = name2;
56256
56258
  return this.get("create").then((resp) => {
56257
56259
  if (this.isSuccess(resp)) {
56258
56260
  return true;
@@ -57511,12 +57513,12 @@ var init_self_listeners = __esm({
57511
57513
  // node_modules/jodit/esm/modules/file-browser/listeners/state-listeners.js
57512
57514
  function stateListeners() {
57513
57515
  const elmMap = elementsMap(this);
57514
- const { state, files, create: create2, options: options3 } = this, getDomElement = (item) => {
57516
+ const { state, files, create: create3, options: options3 } = this, getDomElement = (item) => {
57515
57517
  const key3 = item.uniqueHashKey;
57516
57518
  if (elmMap[key3]) {
57517
57519
  return elmMap[key3].elm;
57518
57520
  }
57519
- const elm = create2.fromHTML(options3.getThumbTemplate.call(this, item, item.source, item.sourceName.toString()));
57521
+ const elm = create3.fromHTML(options3.getThumbTemplate.call(this, item, item.source, item.sourceName.toString()));
57520
57522
  elm.dataset.key = key3;
57521
57523
  elmMap[key3] = {
57522
57524
  item,
@@ -57556,24 +57558,24 @@ function stateListeners() {
57556
57558
  this.files.container.appendChild(getDomElement(item));
57557
57559
  });
57558
57560
  } else {
57559
- files.container.appendChild(create2.div(this.componentName + "_no-files_true", this.i18n("There are no files")));
57561
+ files.container.appendChild(create3.div(this.componentName + "_no-files_true", this.i18n("There are no files")));
57560
57562
  }
57561
57563
  }, this.defaultTimeout)).on("change.sources", this.async.debounce(() => {
57562
57564
  Dom.detach(this.tree.container);
57563
57565
  state.sources.forEach((source) => {
57564
57566
  const sourceName = source.name;
57565
57567
  if (sourceName && sourceName !== DEFAULT_SOURCE_NAME2) {
57566
- this.tree.container.appendChild(create2.div(this.tree.getFullElName("source-title"), sourceName));
57568
+ this.tree.container.appendChild(create3.div(this.tree.getFullElName("source-title"), sourceName));
57567
57569
  }
57568
57570
  source.folders.forEach((name2) => {
57569
- const folderElm = create2.a(this.tree.getFullElName("item"), {
57571
+ const folderElm = create3.a(this.tree.getFullElName("item"), {
57570
57572
  draggable: "draggable",
57571
57573
  href: "#",
57572
57574
  "data-path": normalizePath(source.path, name2 + "/"),
57573
57575
  "data-name": name2,
57574
57576
  "data-source": sourceName,
57575
57577
  "data-source-path": source.path
57576
- }, create2.span(this.tree.getFullElName("item-title"), name2));
57578
+ }, create3.span(this.tree.getFullElName("item-title"), name2));
57577
57579
  const action = (actionName) => (e) => {
57578
57580
  this.e.fire(`${actionName}.filebrowser`, {
57579
57581
  name: name2,
@@ -58892,14 +58894,14 @@ var init_table = __esm({
58892
58894
  formalCoordinate(table3, cell, max2 = false) {
58893
58895
  return _Table.__formalCoordinate(table3, cell, max2);
58894
58896
  }
58895
- static __appendRow(table3, line, after, create2) {
58897
+ static __appendRow(table3, line, after, create3) {
58896
58898
  var _a3;
58897
58899
  let row;
58898
58900
  if (!line) {
58899
58901
  const columnsCount = _Table.__getColumnsCount(table3);
58900
- row = create2.element("tr");
58902
+ row = create3.element("tr");
58901
58903
  for (let j = 0; j < columnsCount; j += 1) {
58902
- row.appendChild(create2.element("td"));
58904
+ row.appendChild(create3.element("td"));
58903
58905
  }
58904
58906
  } else {
58905
58907
  row = line.cloneNode(true);
@@ -84462,7 +84464,7 @@ function cleanArray(array) {
84462
84464
  return array;
84463
84465
  }
84464
84466
  function clone2(object) {
84465
- const newObject = create(null);
84467
+ const newObject = create2(null);
84466
84468
  for (const _ref2 of entries(object)) {
84467
84469
  var _ref3 = _slicedToArray(_ref2, 2);
84468
84470
  const property = _ref3[0];
@@ -84619,7 +84621,7 @@ function createDOMPurify() {
84619
84621
  ...mathMl,
84620
84622
  ...xml2
84621
84623
  ]);
84622
- let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
84624
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(create2(null, {
84623
84625
  tagNameCheck: {
84624
84626
  writable: true,
84625
84627
  configurable: false,
@@ -84641,7 +84643,7 @@ function createDOMPurify() {
84641
84643
  }));
84642
84644
  let FORBID_TAGS = null;
84643
84645
  let FORBID_ATTR = null;
84644
- const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
84646
+ const EXTRA_ELEMENT_HANDLING = Object.seal(create2(null, {
84645
84647
  tagCheck: {
84646
84648
  writable: true,
84647
84649
  configurable: false,
@@ -84741,7 +84743,7 @@ function createDOMPurify() {
84741
84743
  SVG_NAMESPACE,
84742
84744
  HTML_NAMESPACE2
84743
84745
  ], stringToString);
84744
- const DEFAULT_MATHML_TEXT_INTEGRATION_POINTS = freeze2([
84746
+ const DEFAULT_MATHML_TEXT_INTEGRATION_POINTS = freeze([
84745
84747
  "mi",
84746
84748
  "mo",
84747
84749
  "mn",
@@ -84749,7 +84751,7 @@ function createDOMPurify() {
84749
84751
  "mtext"
84750
84752
  ]);
84751
84753
  let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS);
84752
- const DEFAULT_HTML_INTEGRATION_POINTS = freeze2(["annotation-xml"]);
84754
+ const DEFAULT_HTML_INTEGRATION_POINTS = freeze(["annotation-xml"]);
84753
84755
  let HTML_INTEGRATION_POINTS2 = addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS);
84754
84756
  const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, [
84755
84757
  "title",
@@ -84808,8 +84810,8 @@ function createDOMPurify() {
84808
84810
  NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE2;
84809
84811
  MATHML_TEXT_INTEGRATION_POINTS = _resolveObjectOption(cfg, "MATHML_TEXT_INTEGRATION_POINTS", () => addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS));
84810
84812
  HTML_INTEGRATION_POINTS2 = _resolveObjectOption(cfg, "HTML_INTEGRATION_POINTS", () => addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS));
84811
- const customElementHandling = _resolveObjectOption(cfg, "CUSTOM_ELEMENT_HANDLING", () => create(null));
84812
- CUSTOM_ELEMENT_HANDLING = create(null);
84813
+ const customElementHandling = _resolveObjectOption(cfg, "CUSTOM_ELEMENT_HANDLING", () => create2(null));
84814
+ CUSTOM_ELEMENT_HANDLING = create2(null);
84813
84815
  if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck)) CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck;
84814
84816
  if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck)) CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck;
84815
84817
  if (objectHasOwnProperty(customElementHandling, "allowCustomizedBuiltInElements") && typeof customElementHandling.allowCustomizedBuiltInElements === "boolean") CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements;
@@ -84818,7 +84820,7 @@ function createDOMPurify() {
84818
84820
  if (RETURN_DOM_FRAGMENT) RETURN_DOM = true;
84819
84821
  if (USE_PROFILES) {
84820
84822
  ALLOWED_TAGS = addToSet({}, text3);
84821
- ALLOWED_ATTR = create(null);
84823
+ ALLOWED_ATTR = create2(null);
84822
84824
  if (USE_PROFILES.html === true) {
84823
84825
  addToSet(ALLOWED_TAGS, html$1);
84824
84826
  addToSet(ALLOWED_ATTR, html2);
@@ -84887,7 +84889,7 @@ function createDOMPurify() {
84887
84889
  if (trustedTypesPolicy === void 0) trustedTypesPolicy = _getDefaultTrustedTypesPolicy();
84888
84890
  if (trustedTypesPolicy && typeof emptyHTML === "string") emptyHTML = _createTrustedHTML("");
84889
84891
  }
84890
- if (freeze2) freeze2(cfg);
84892
+ if (freeze) freeze(cfg);
84891
84893
  CONFIG = cfg;
84892
84894
  };
84893
84895
  const ALL_SVG_TAGS = addToSet({}, [
@@ -85522,7 +85524,7 @@ function createDOMPurify() {
85522
85524
  };
85523
85525
  return DOMPurify;
85524
85526
  }
85525
- var entries, setPrototypeOf, isFrozen, getPrototypeOf, getOwnPropertyDescriptor, freeze2, seal, create, _ref, apply, construct, arrayForEach, arrayLastIndexOf, arrayPop, arrayPush, arraySplice, arrayIsArray, stringToLowerCase, stringToString, stringMatch, stringReplace, stringIndexOf, stringTrim, numberToString, booleanToString, bigintToString, symbolToString, objectHasOwnProperty, objectToString, regExpTest, typeErrorCreate, html$1, svg$1, svgFilters, svgDisallowed, mathMl$1, mathMlDisallowed, text3, html2, svg2, mathMl, xml2, MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR, DATA_ATTR, ARIA_ATTR, IS_ALLOWED_URI, IS_SCRIPT_OR_DATA, ATTR_WHITESPACE, DOCTYPE_NAME, CUSTOM_ELEMENT, ELEMENT_MARKUP_PROBE, COMMENT_MARKUP_PROBE, FALLBACK_TAG_CLOSE, SELF_CLOSING_TAG, NODE_TYPE, LITERAL_TEXT_ELEMENT_NAMES, LITERAL_TEXT_ELEMENTS, LITERAL_TEXT_CLOSE, getGlobal, _createTrustedTypesPolicy, _createHooksMap, _resolveSetOption, _resolveObjectOption, purify_default;
85527
+ var entries, setPrototypeOf, isFrozen, getPrototypeOf, getOwnPropertyDescriptor, freeze, seal, create2, _ref, apply, construct, arrayForEach, arrayLastIndexOf, arrayPop, arrayPush, arraySplice, arrayIsArray, stringToLowerCase, stringToString, stringMatch, stringReplace, stringIndexOf, stringTrim, numberToString, booleanToString, bigintToString, symbolToString, objectHasOwnProperty, objectToString, regExpTest, typeErrorCreate, html$1, svg$1, svgFilters, svgDisallowed, mathMl$1, mathMlDisallowed, text3, html2, svg2, mathMl, xml2, MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR, DATA_ATTR, ARIA_ATTR, IS_ALLOWED_URI, IS_SCRIPT_OR_DATA, ATTR_WHITESPACE, DOCTYPE_NAME, CUSTOM_ELEMENT, ELEMENT_MARKUP_PROBE, COMMENT_MARKUP_PROBE, FALLBACK_TAG_CLOSE, SELF_CLOSING_TAG, NODE_TYPE, LITERAL_TEXT_ELEMENT_NAMES, LITERAL_TEXT_ELEMENTS, LITERAL_TEXT_CLOSE, getGlobal, _createTrustedTypesPolicy, _createHooksMap, _resolveSetOption, _resolveObjectOption, purify_default;
85526
85528
  var init_purify_es = __esm({
85527
85529
  "node_modules/dompurify/dist/purify.es.mjs"() {
85528
85530
  /*! @license DOMPurify 3.4.16 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.16/LICENSE */
@@ -85541,13 +85543,13 @@ var init_purify_es = __esm({
85541
85543
  isFrozen = Object.isFrozen;
85542
85544
  getPrototypeOf = Object.getPrototypeOf;
85543
85545
  getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
85544
- freeze2 = Object.freeze;
85546
+ freeze = Object.freeze;
85545
85547
  seal = Object.seal;
85546
- create = Object.create;
85548
+ create2 = Object.create;
85547
85549
  _ref = typeof Reflect !== "undefined" && Reflect;
85548
85550
  apply = _ref.apply;
85549
85551
  construct = _ref.construct;
85550
- if (!freeze2) freeze2 = function freeze3(x) {
85552
+ if (!freeze) freeze = function freeze2(x) {
85551
85553
  return x;
85552
85554
  };
85553
85555
  if (!seal) seal = function seal2(x) {
@@ -85583,7 +85585,7 @@ var init_purify_es = __esm({
85583
85585
  objectToString = unapply(Object.prototype.toString);
85584
85586
  regExpTest = unapply(RegExp.prototype.test);
85585
85587
  typeErrorCreate = unconstruct(TypeError);
85586
- html$1 = freeze2([
85588
+ html$1 = freeze([
85587
85589
  "a",
85588
85590
  "abbr",
85589
85591
  "acronym",
@@ -85704,7 +85706,7 @@ var init_purify_es = __esm({
85704
85706
  "video",
85705
85707
  "wbr"
85706
85708
  ]);
85707
- svg$1 = freeze2([
85709
+ svg$1 = freeze([
85708
85710
  "svg",
85709
85711
  "a",
85710
85712
  "altglyph",
@@ -85753,7 +85755,7 @@ var init_purify_es = __esm({
85753
85755
  "view",
85754
85756
  "vkern"
85755
85757
  ]);
85756
- svgFilters = freeze2([
85758
+ svgFilters = freeze([
85757
85759
  "feBlend",
85758
85760
  "feColorMatrix",
85759
85761
  "feComponentTransfer",
@@ -85780,7 +85782,7 @@ var init_purify_es = __esm({
85780
85782
  "feTile",
85781
85783
  "feTurbulence"
85782
85784
  ]);
85783
- svgDisallowed = freeze2([
85785
+ svgDisallowed = freeze([
85784
85786
  "animate",
85785
85787
  "color-profile",
85786
85788
  "cursor",
@@ -85804,7 +85806,7 @@ var init_purify_es = __esm({
85804
85806
  "unknown",
85805
85807
  "use"
85806
85808
  ]);
85807
- mathMl$1 = freeze2([
85809
+ mathMl$1 = freeze([
85808
85810
  "math",
85809
85811
  "menclose",
85810
85812
  "merror",
@@ -85836,7 +85838,7 @@ var init_purify_es = __esm({
85836
85838
  "munderover",
85837
85839
  "mprescripts"
85838
85840
  ]);
85839
- mathMlDisallowed = freeze2([
85841
+ mathMlDisallowed = freeze([
85840
85842
  "maction",
85841
85843
  "maligngroup",
85842
85844
  "malignmark",
@@ -85853,8 +85855,8 @@ var init_purify_es = __esm({
85853
85855
  "mprescripts",
85854
85856
  "none"
85855
85857
  ]);
85856
- text3 = freeze2(["#text"]);
85857
- html2 = freeze2([
85858
+ text3 = freeze(["#text"]);
85859
+ html2 = freeze([
85858
85860
  "accept",
85859
85861
  "action",
85860
85862
  "align",
@@ -85974,7 +85976,7 @@ var init_purify_es = __esm({
85974
85976
  "wrap",
85975
85977
  "xmlns"
85976
85978
  ]);
85977
- svg2 = freeze2([
85979
+ svg2 = freeze([
85978
85980
  "accent-height",
85979
85981
  "accumulate",
85980
85982
  "additive",
@@ -86168,7 +86170,7 @@ var init_purify_es = __esm({
86168
86170
  "z",
86169
86171
  "zoomandpan"
86170
86172
  ]);
86171
- mathMl = freeze2([
86173
+ mathMl = freeze([
86172
86174
  "accent",
86173
86175
  "accentunder",
86174
86176
  "align",
@@ -86224,7 +86226,7 @@ var init_purify_es = __esm({
86224
86226
  "width",
86225
86227
  "xmlns"
86226
86228
  ]);
86227
- xml2 = freeze2([
86229
+ xml2 = freeze([
86228
86230
  "xlink:href",
86229
86231
  "xml:id",
86230
86232
  "xlink:title",
@@ -86269,13 +86271,13 @@ var init_purify_es = __esm({
86269
86271
  "plaintext",
86270
86272
  "noscript"
86271
86273
  ];
86272
- LITERAL_TEXT_ELEMENTS = freeze2(addToSet({}, LITERAL_TEXT_ELEMENT_NAMES));
86274
+ LITERAL_TEXT_ELEMENTS = freeze(addToSet({}, LITERAL_TEXT_ELEMENT_NAMES));
86273
86275
  LITERAL_TEXT_CLOSE = (function() {
86274
86276
  const map5 = {};
86275
86277
  arrayForEach(LITERAL_TEXT_ELEMENT_NAMES, (name2) => {
86276
86278
  map5[name2] = seal(new RegExp("</" + name2 + "(?=[\\t\\n\\f\\r />])", "i"));
86277
86279
  });
86278
- return freeze2(map5);
86280
+ return freeze(map5);
86279
86281
  })();
86280
86282
  getGlobal = function getGlobal2() {
86281
86283
  return typeof window === "undefined" ? null : window;
@@ -89706,6 +89708,14 @@ function mapFragment(fragment, f, parent) {
89706
89708
  }
89707
89709
  return Fragment.fromArray(mapped);
89708
89710
  }
89711
+ function pushMarkStep(cls, from2, to, mark, target) {
89712
+ let last2 = target.length ? target[target.length - 1] : null;
89713
+ if (last2 && last2 instanceof cls && last2.to == from2 && last2.mark.eq(mark)) {
89714
+ target[target.length - 1] = new cls(last2.from, to, mark);
89715
+ } else {
89716
+ target.push(new cls(from2, to, mark));
89717
+ }
89718
+ }
89709
89719
  function contentBetween(doc4, from2, to) {
89710
89720
  let $from = doc4.resolve(from2), dist2 = to - from2, depth2 = $from.depth;
89711
89721
  while (dist2 > 0 && depth2 > 0 && $from.indexAfter(depth2) == $from.node(depth2).childCount) {
@@ -89724,36 +89734,22 @@ function contentBetween(doc4, from2, to) {
89724
89734
  return false;
89725
89735
  }
89726
89736
  function addMark(tr, from2, to, mark) {
89727
- let removed = [], added = [];
89728
- let removing, adding;
89737
+ let added = [];
89729
89738
  tr.doc.nodesBetween(from2, to, (node, pos, parent) => {
89730
89739
  if (!node.isInline)
89731
89740
  return;
89732
89741
  let marks2 = node.marks;
89733
89742
  if (!mark.isInSet(marks2) && parent.type.allowsMarkType(mark.type)) {
89734
89743
  let start = Math.max(pos, from2), end = Math.min(pos + node.nodeSize, to);
89735
- let newSet = mark.addToSet(marks2);
89736
- for (let i2 = 0; i2 < marks2.length; i2++) {
89737
- if (!marks2[i2].isInSet(newSet)) {
89738
- if (removing && removing.to == start && removing.mark.eq(marks2[i2]))
89739
- removing.to = end;
89740
- else
89741
- removed.push(removing = new RemoveMarkStep(start, end, marks2[i2]));
89742
- }
89743
- }
89744
- if (adding && adding.to == start)
89745
- adding.to = end;
89746
- else
89747
- added.push(adding = new AddMarkStep(start, end, mark));
89744
+ pushMarkStep(AddMarkStep, start, end, mark, added);
89748
89745
  }
89749
89746
  });
89750
- removed.forEach((s) => tr.step(s));
89751
89747
  added.forEach((s) => tr.step(s));
89752
89748
  }
89753
89749
  function removeMark(tr, from2, to, mark) {
89754
89750
  let matched = [], step = 0;
89755
89751
  tr.doc.nodesBetween(from2, to, (node, pos) => {
89756
- if (!node.isInline)
89752
+ if (!node.isInline || !node.isAtom)
89757
89753
  return;
89758
89754
  step++;
89759
89755
  let toRemove = null;
@@ -90257,7 +90253,7 @@ function coveredDepths($from, $to) {
90257
90253
  }
90258
90254
  return result;
90259
90255
  }
90260
- var lower16, factor16, DEL_BEFORE, DEL_AFTER, DEL_ACROSS, DEL_SIDE, MapResult, StepMap, Mapping, stepsByID, Step, StepResult, AddMarkStep, RemoveMarkStep, AddNodeMarkStep, RemoveNodeMarkStep, ReplaceStep, ReplaceAroundStep, Fitter, AttrStep, DocAttrStep, TransformError, Transform;
90256
+ var lower16, factor16, DEL_BEFORE, DEL_AFTER, DEL_ACROSS, DEL_SIDE, MapResult, StepMap, Mapping, stepsByID, Step, StepResult, AddMarkStep, RemoveMarkStep, MarkSetStep, AddNodeMarkStep, RemoveNodeMarkStep, ReplaceStep, ReplaceAroundStep, Fitter, AttrStep, DocAttrStep, TransformError, Transform;
90261
90257
  var init_dist28 = __esm({
90262
90258
  "node_modules/prosemirror-transform/dist/index.js"() {
90263
90259
  init_dist27();
@@ -90636,14 +90632,27 @@ var init_dist28 = __esm({
90636
90632
  }, parent), oldSlice.openStart, oldSlice.openEnd);
90637
90633
  return StepResult.fromReplace(doc4, this.from, this.to, slice2);
90638
90634
  }
90639
- invert() {
90640
- return new RemoveMarkStep(this.from, this.to, this.mark);
90635
+ invert(doc4) {
90636
+ let steps = [];
90637
+ doc4.nodesBetween(this.from, this.to, (node, pos) => {
90638
+ if (node.isInline && node.isAtom) {
90639
+ let added = this.mark.addToSet(node.marks);
90640
+ if (!Mark.sameSet(added, node.marks)) {
90641
+ let from2 = Math.max(this.from, pos), to = Math.min(this.to, pos + node.nodeSize);
90642
+ pushMarkStep(RemoveMarkStep, from2, to, this.mark, steps);
90643
+ for (let mark of node.marks)
90644
+ if (!mark.isInSet(added))
90645
+ pushMarkStep(_AddMarkStep, from2, to, mark, steps);
90646
+ }
90647
+ }
90648
+ });
90649
+ return steps.length == 1 ? steps[0] : new MarkSetStep(steps);
90641
90650
  }
90642
90651
  map(mapping) {
90643
- let from2 = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
90644
- if (from2.deleted && to.deleted || from2.pos >= to.pos)
90652
+ let from2 = mapping.map(this.from, 1), to = mapping.map(this.to, -1);
90653
+ if (from2 >= to)
90645
90654
  return null;
90646
- return new _AddMarkStep(from2.pos, to.pos, this.mark);
90655
+ return new _AddMarkStep(from2, to, this.mark);
90647
90656
  }
90648
90657
  merge(other) {
90649
90658
  if (other instanceof _AddMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from)
@@ -90685,14 +90694,19 @@ var init_dist28 = __esm({
90685
90694
  }, doc4), oldSlice.openStart, oldSlice.openEnd);
90686
90695
  return StepResult.fromReplace(doc4, this.from, this.to, slice2);
90687
90696
  }
90688
- invert() {
90689
- return new AddMarkStep(this.from, this.to, this.mark);
90697
+ invert(doc4) {
90698
+ let steps = [];
90699
+ doc4.nodesBetween(this.from, this.to, (node, pos) => {
90700
+ if (node.isInline && node.isAtom && this.mark.isInSet(node.marks))
90701
+ pushMarkStep(AddMarkStep, Math.max(this.from, pos), Math.min(this.to, pos + node.nodeSize), this.mark, steps);
90702
+ });
90703
+ return steps.length == 1 ? steps[0] : new MarkSetStep(steps);
90690
90704
  }
90691
90705
  map(mapping) {
90692
- let from2 = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
90693
- if (from2.deleted && to.deleted || from2.pos >= to.pos)
90706
+ let from2 = mapping.map(this.from, 1), to = mapping.map(this.to, -1);
90707
+ if (from2 >= to)
90694
90708
  return null;
90695
- return new _RemoveMarkStep(from2.pos, to.pos, this.mark);
90709
+ return new _RemoveMarkStep(from2, to, this.mark);
90696
90710
  }
90697
90711
  merge(other) {
90698
90712
  if (other instanceof _RemoveMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from)
@@ -90717,6 +90731,42 @@ var init_dist28 = __esm({
90717
90731
  }
90718
90732
  };
90719
90733
  Step.jsonID("removeMark", RemoveMarkStep);
90734
+ MarkSetStep = class _MarkSetStep extends Step {
90735
+ constructor(steps) {
90736
+ super();
90737
+ this.steps = steps;
90738
+ }
90739
+ apply(doc4) {
90740
+ for (let step of this.steps) {
90741
+ let result = step.apply(doc4);
90742
+ if (!result.doc)
90743
+ return result;
90744
+ doc4 = result.doc;
90745
+ }
90746
+ return new StepResult(doc4, null);
90747
+ }
90748
+ invert(doc4) {
90749
+ return new _MarkSetStep(this.steps.map((s) => s.invert(doc4)));
90750
+ }
90751
+ map(mapping) {
90752
+ let result = [];
90753
+ for (let step of this.steps) {
90754
+ let mapped = step.map(mapping);
90755
+ if (mapped)
90756
+ result.push(mapped);
90757
+ }
90758
+ return result.length ? new _MarkSetStep(result) : null;
90759
+ }
90760
+ toJSON() {
90761
+ return { stepType: "markSet", steps: this.steps.map((s) => s.toJSON()) };
90762
+ }
90763
+ static fromJSON(schema2, json3) {
90764
+ if (!Array.isArray(json3.steps) || !json3.steps.every((s) => s.stepType == "addMark" || s.stepType == "removeMark"))
90765
+ throw new RangeError("Invalid JSON for MarkSetStep");
90766
+ return new _MarkSetStep(json3.steps.map((s) => Step.fromJSON(schema2, s)));
90767
+ }
90768
+ };
90769
+ Step.jsonID("markSet", MarkSetStep);
90720
90770
  AddNodeMarkStep = class _AddNodeMarkStep extends Step {
90721
90771
  /**
90722
90772
  Create a node mark step.
@@ -99856,151 +99906,22 @@ var init_prose_mirror_engine = __esm({
99856
99906
  }
99857
99907
  });
99858
99908
 
99859
- // src/webcomponent.js
99860
- var NAME = /^[a-z][.0-9_a-z\-\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}]*$/u;
99861
- var RESERVED = /* @__PURE__ */ new Set([
99862
- "annotation-xml",
99863
- "color-profile",
99864
- "font-face",
99865
- "font-face-src",
99866
- "font-face-uri",
99867
- "font-face-format",
99868
- "font-face-name",
99869
- "missing-glyph"
99870
- ]);
99871
- function webcomponentCode(attrs2) {
99872
- const code3 = attrs2.code;
99873
- if (typeof code3 !== "string" || NAME.exec(code3)?.[0] !== code3 || !code3.includes("-") || RESERVED.has(code3)) {
99874
- throw new TypeError("webcomponent: code must be a literal custom-element name");
99875
- }
99876
- return code3;
99877
- }
99878
-
99879
- // src/components/registry.js
99880
- function freeze(value) {
99881
- for (const child of Object.values(value)) if (child && typeof child === "object") freeze(child);
99882
- return Object.freeze(value);
99883
- }
99884
- function annotation(parameter) {
99885
- if (typeof parameter.dtype !== "string" && !Array.isArray(parameter.dtype)) throw new TypeError("Component parameter requires dtype");
99886
- const alternatives = (Array.isArray(parameter.dtype) ? parameter.dtype : [parameter.dtype]).map((dtype) => ({ kind: "dtype", dtype }));
99887
- if (parameter.nullable) alternatives.push({ kind: "dtype", dtype: "NN" });
99888
- if (parameter.binding && parameter.dtype !== "T") alternatives.push({
99889
- kind: "annotated",
99890
- base: { kind: "dtype", dtype: "T" },
99891
- metadata: [{ kind: "regex", pattern: "^[\\^=].+", flags: 0 }]
99892
- });
99893
- return alternatives.length === 1 ? alternatives[0] : { kind: "union", items: alternatives };
99894
- }
99895
- function defineComponent({ name: name2, tag: tag2, base: base3, mixins = [], parameters: parameters2 = {}, subTags = "", presentationDefaults = [], dataScope = false, command: command2 = false, childParameters = {}, sourceContext: sourceContext2 = false, bagStore = false, dragSource = false, implementation }) {
99896
- webcomponentCode({ code: tag2 });
99897
- if (!/^[a-zA-Z][a-zA-Z0-9]*$/.test(name2)) throw new TypeError("Invalid component authoring name");
99898
- const effective = { ...base3.parameters };
99899
- for (const mixin of mixins) {
99900
- for (const [key3, spec] of Object.entries(mixin.parameters)) {
99901
- if (Object.hasOwn(effective, key3)) throw new Error(`Duplicate mixin parameter: ${key3}`);
99902
- effective[key3] = spec;
99903
- }
99904
- }
99905
- Object.assign(effective, parameters2);
99906
- for (const spec of Object.values(effective)) annotation(spec);
99907
- return Object.freeze({
99908
- name: name2,
99909
- tag: tag2,
99910
- base: base3,
99911
- subTags,
99912
- presentationDefaults: Object.freeze([...presentationDefaults]),
99913
- dataScope,
99914
- command: command2,
99915
- bagStore,
99916
- mixins: Object.freeze([...mixins]),
99917
- parameters: freeze(structuredClone(effective)),
99918
- childParameters: freeze(structuredClone(childParameters)),
99919
- sourceContext: sourceContext2,
99920
- dragSource,
99921
- implementation
99922
- });
99923
- }
99924
- var ComponentCollection = class {
99925
- #classes = /* @__PURE__ */ new WeakMap();
99926
- constructor({ name: name2, components }) {
99927
- this.name = name2;
99928
- this.components = Object.freeze([...components]);
99929
- const names = /* @__PURE__ */ new Set(), tags3 = /* @__PURE__ */ new Set();
99930
- for (const component2 of components) {
99931
- if (names.has(component2.name.toLowerCase()) || tags3.has(component2.tag)) {
99932
- throw new Error(`Duplicate component: ${component2.name}`);
99933
- }
99934
- names.add(component2.name.toLowerCase());
99935
- tags3.add(component2.tag);
99936
- }
99937
- }
99938
- /** Same JSON consumed by Python and JavaScript Builders. */
99939
- toDocument() {
99940
- return {
99941
- document_format: { name: "builder_grammar", version: "1.1" },
99942
- grammar: { name: this.name, version: null, title: this.name, description: null },
99943
- abstracts: {},
99944
- elements: Object.fromEntries(this.components.map((component2) => [component2.name, {
99945
- doc: null,
99946
- sub_tags: component2.subTags,
99947
- parent_tags: null,
99948
- inherits_from: null,
99949
- ns: null,
99950
- node_label: null,
99951
- collection_key: null,
99952
- attributes: {
99953
- parameters: [
99954
- ...Object.entries(component2.parameters).map(([name2, spec]) => ({
99955
- name: name2,
99956
- kind: "keyword_only",
99957
- role: "attribute",
99958
- annotation: annotation(spec),
99959
- has_default: true,
99960
- default: spec.default ?? null
99961
- })),
99962
- {
99963
- name: "attr",
99964
- kind: "var_keyword",
99965
- role: "attribute",
99966
- annotation: { kind: "any" },
99967
- has_default: false
99968
- }
99969
- ],
99970
- accepts_var_keyword: true,
99971
- accepts_var_positional: false
99972
- },
99973
- _meta: { render_tag: component2.tag, gramlot_component: {
99974
- parameters: structuredClone(component2.parameters),
99975
- presentationDefaults: [...component2.presentationDefaults],
99976
- dataScope: component2.dataScope,
99977
- command: component2.command,
99978
- ...Object.keys(component2.childParameters).length ? { childParameters: structuredClone(component2.childParameters) } : {},
99979
- ...component2.sourceContext ? { sourceContext: true } : {},
99980
- ...component2.dragSource ? { dragSource: true } : {},
99981
- ...component2.bagStore ? { bagStore: true } : {}
99982
- } }
99983
- }]))
99984
- };
99985
- }
99986
- /** Register once per document realm, only when the collection is activated. */
99987
- register(window2) {
99988
- if (this.#classes.has(window2)) return;
99989
- const classes2 = [];
99990
- for (const component2 of this.components) {
99991
- if (window2.customElements.get(component2.tag)) throw new Error(`Custom element already registered: ${component2.tag}`);
99992
- let Base = component2.base(window2.HTMLElement);
99993
- for (const mixin of component2.mixins) Base = mixin(Base);
99994
- const Class = component2.implementation(Base);
99995
- Object.defineProperty(Class, "gramlotComponent", { value: component2 });
99996
- classes2.push([component2.tag, Class]);
99997
- }
99998
- for (const [tag2, Class] of classes2) window2.customElements.define(tag2, Class);
99999
- this.#classes.set(window2, classes2);
100000
- }
100001
- };
99909
+ // collection-authoring:@gramlot/gramlot/components
99910
+ var components_exports = {};
99911
+ __export(components_exports, {
99912
+ defineCollection: () => defineCollection
99913
+ });
99914
+ __reExport(components_exports, components_star);
99915
+ import * as components_star from "@gramlot/gramlot/components";
99916
+ import { defineCollection as create } from "@gramlot/gramlot/components";
100002
99917
  function defineCollection(options3) {
100003
- return new ComponentCollection(options3);
99918
+ if (options3.name !== "editors") throw new Error("Unexpected bundled collection");
99919
+ const css3 = [], assets = {};
99920
+ options3.css?.forEach((url2, index) => {
99921
+ url2.href = css3[index].href;
99922
+ });
99923
+ for (const [key3, url2] of Object.entries(options3.assets ?? {})) url2.href = assets[key3].href;
99924
+ return create({ ...options3, css: css3, assets });
100004
99925
  }
100005
99926
 
100006
99927
  // src/components/parameters.js
@@ -100034,7 +99955,7 @@ function controlElement(HTMLElement2) {
100034
99955
  style.textContent = `:host{display:inline-block;font:inherit} *,*::before,*::after{box-sizing:border-box}
100035
99956
  input,textarea{font:inherit;max-width:100%} .control-box{min-width:0;color:var(--gramlot-ink,CanvasText)}
100036
99957
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),textarea{
100037
- appearance:none;box-sizing:border-box;border:1px solid var(--gramlot-border-control,#7a8798);
99958
+ appearance:none;box-sizing:border-box;width:100%;border:1px solid var(--gramlot-border-control,#7a8798);
100038
99959
  border-radius:var(--gramlot-radius-sm,4px);background:var(--gramlot-field-background,Canvas);color:var(--gramlot-ink,CanvasText);
100039
99960
  min-height:var(--gramlot-field-height,28px);padding:var(--gramlot-field-padding,.25em .5em);font-size:var(--gramlot-field-font-size,1em);line-height:var(--gramlot-field-line-height,inherit)}
100040
99961
  input:read-only:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),textarea:read-only{
@@ -100300,6 +100221,163 @@ Labelbox.parameters = {
100300
100221
  lbl_position: { dtype: "T", default: "TL", binding: "read", enum: POSITIONS }
100301
100222
  };
100302
100223
 
100224
+ // src/components/validation.js
100225
+ import { Bag as Bag2 } from "@gramlot/gramlot";
100226
+
100227
+ // node_modules/@genrojs/builders/src/pointers.js
100228
+ function pointerTransform(value) {
100229
+ if (typeof value !== "string" || !["^", "="].includes(value[0]) || value.startsWith("==")) return null;
100230
+ const index = value.indexOf(":");
100231
+ if (index < 0) return null;
100232
+ const expression = value[index + 1] === "=";
100233
+ return { pointer: value.slice(0, index), expression, body: value.slice(index + (expression ? 2 : 1)) };
100234
+ }
100235
+ var SLOT = /^\{(\??[A-Za-z_][A-Za-z0-9_]*|\?)?\}/;
100236
+ function pointerTemplate(body, read) {
100237
+ let result = "", blocked = false;
100238
+ for (let i2 = 0; i2 < body.length; ) {
100239
+ if (body[i2] !== "{" && body[i2] !== "}") {
100240
+ result += body[i2++];
100241
+ continue;
100242
+ }
100243
+ const match2 = body.slice(i2).match(SLOT);
100244
+ if (!match2) throw new SyntaxError("Invalid pointer template placeholder");
100245
+ const slot = match2[1] ?? "";
100246
+ const optional = slot.startsWith("?");
100247
+ const value = read(optional ? slot.slice(1) : slot);
100248
+ if (value == null || value === "" && !optional) blocked = true;
100249
+ else result += String(value);
100250
+ i2 += match2[0].length;
100251
+ }
100252
+ return blocked ? null : result;
100253
+ }
100254
+ function pointerExpression(body) {
100255
+ const slots = [], identifiers2 = /* @__PURE__ */ new Set();
100256
+ let text4 = "", operand = true;
100257
+ for (let i2 = 0; i2 < body.length; ) {
100258
+ const start = i2, c = body[i2];
100259
+ if (c === '"' || c === "'" || c === "`") {
100260
+ i2++;
100261
+ while (i2 < body.length) {
100262
+ if (body[i2] === "\\") {
100263
+ i2 += 2;
100264
+ continue;
100265
+ }
100266
+ if (body[i2++] === c) break;
100267
+ }
100268
+ text4 += body.slice(start, i2);
100269
+ operand = false;
100270
+ continue;
100271
+ }
100272
+ if (body.startsWith("//", i2)) {
100273
+ i2 = body.indexOf("\n", i2);
100274
+ if (i2 < 0) i2 = body.length;
100275
+ text4 += body.slice(start, i2);
100276
+ continue;
100277
+ }
100278
+ if (body.startsWith("/*", i2)) {
100279
+ const end = body.indexOf("*/", i2 + 2);
100280
+ i2 = end < 0 ? body.length : end + 2;
100281
+ text4 += body.slice(start, i2);
100282
+ continue;
100283
+ }
100284
+ if (c === "/" && operand) {
100285
+ let bracket2 = false;
100286
+ i2++;
100287
+ while (i2 < body.length) {
100288
+ const current = body[i2++];
100289
+ if (current === "\\") {
100290
+ i2++;
100291
+ continue;
100292
+ }
100293
+ if (current === "[") bracket2 = true;
100294
+ else if (current === "]") bracket2 = false;
100295
+ else if (current === "/" && !bracket2) break;
100296
+ }
100297
+ while (/[a-z]/i.test(body[i2] ?? "") && i2 < body.length) i2++;
100298
+ text4 += body.slice(start, i2);
100299
+ operand = false;
100300
+ continue;
100301
+ }
100302
+ const slot = c === "{" ? body.slice(i2).match(SLOT) : null;
100303
+ if (slot) {
100304
+ const name2 = slot[1] ?? "";
100305
+ if (name2.startsWith("?")) throw new SyntaxError("Optional slots are supported in pointer templates only");
100306
+ text4 += `_pointerValues[${slots.length}]`;
100307
+ slots.push(name2);
100308
+ i2 += slot[0].length;
100309
+ operand = false;
100310
+ continue;
100311
+ }
100312
+ const word = body.slice(i2).match(/^[A-Za-z_$][\w$]*/);
100313
+ if (word) {
100314
+ identifiers2.add(word[0]);
100315
+ text4 += word[0];
100316
+ i2 += word[0].length;
100317
+ operand = ["return", "typeof", "void", "delete", "new", "in", "instanceof", "yield", "await"].includes(word[0]);
100318
+ continue;
100319
+ }
100320
+ text4 += c;
100321
+ i2++;
100322
+ if (!/\s/.test(c)) operand = /[([{,:;=!?&|+*%~<>\/-]/.test(c);
100323
+ }
100324
+ return { text: text4, slots, identifiers: identifiers2 };
100325
+ }
100326
+ function resolvePointerItems(items, current, evaluate = () => null) {
100327
+ const values2 = /* @__PURE__ */ new Map(), active = [];
100328
+ const resolve = (name2) => {
100329
+ if (values2.has(name2)) return values2.get(name2);
100330
+ if (!items.has(name2)) throw new Error(`Referenced Source attribute '${name2}' does not exist`);
100331
+ if (active.includes(name2)) throw new Error(`Cyclic attribute dependency: ${[...active, name2].join(" -> ")}`);
100332
+ active.push(name2);
100333
+ try {
100334
+ const raw = items.get(name2);
100335
+ const transform = typeof name2 === "string" ? pointerTransform(raw) : null;
100336
+ let result = current.get(name2);
100337
+ if (transform) {
100338
+ const read = (key3) => key3 ? resolve(key3) : current.get(name2);
100339
+ if (transform.expression) {
100340
+ const expression = pointerExpression(transform.body);
100341
+ result = evaluate(name2, raw, expression, expression.slots.map(read));
100342
+ } else {
100343
+ result = pointerTemplate(transform.body, read);
100344
+ if (current.get(name2) == null) result = null;
100345
+ }
100346
+ }
100347
+ values2.set(name2, result);
100348
+ return result;
100349
+ } finally {
100350
+ active.pop();
100351
+ }
100352
+ };
100353
+ return new Map([...items.keys()].map((name2) => [name2, resolve(name2)]));
100354
+ }
100355
+ function pointerDependencies(node, raw) {
100356
+ const items = new Map([...Object.entries(node.getAttr()), ...node.fixedAttrItems()]);
100357
+ const seen = /* @__PURE__ */ new Set(), active = [];
100358
+ const visit = (value) => {
100359
+ const transform = pointerTransform(value);
100360
+ if (!transform) return;
100361
+ const names = [];
100362
+ if (transform.expression) names.push(...pointerExpression(transform.body).slots);
100363
+ else pointerTemplate(transform.body, (key3) => {
100364
+ names.push(key3);
100365
+ return "";
100366
+ });
100367
+ for (const name2 of names.filter(Boolean)) {
100368
+ if (!items.has(name2)) throw new Error(`Referenced Source attribute '${name2}' does not exist`);
100369
+ if (active.includes(name2)) throw new Error(`Cyclic attribute dependency: ${[...active, name2].join(" -> ")}`);
100370
+ if (seen.has(name2)) continue;
100371
+ active.push(name2);
100372
+ visit(items.get(name2));
100373
+ active.pop();
100374
+ seen.add(name2);
100375
+ }
100376
+ };
100377
+ visit(raw);
100378
+ return seen;
100379
+ }
100380
+
100303
100381
  // node_modules/decimal.js/decimal.mjs
100304
100382
  /*!
100305
100383
  * decimal.js v10.6.0
@@ -102492,11 +102570,11 @@ var MAX_POWER = 1e6;
102492
102570
  var NE = -7;
102493
102571
  var PE = 21;
102494
102572
  var STRICT = false;
102495
- var NAME2 = "[big.js] ";
102496
- var INVALID = NAME2 + "Invalid ";
102573
+ var NAME = "[big.js] ";
102574
+ var INVALID = NAME + "Invalid ";
102497
102575
  var INVALID_DP = INVALID + "decimal places";
102498
102576
  var INVALID_RM = INVALID + "rounding mode";
102499
- var DIV_BY_ZERO = NAME2 + "Division by zero";
102577
+ var DIV_BY_ZERO = NAME + "Division by zero";
102500
102578
  var P2 = {};
102501
102579
  var UNDEFINED = void 0;
102502
102580
  var NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
@@ -102862,7 +102940,7 @@ P2.sqrt = function() {
102862
102940
  var r, c, t2, x = this, Big2 = x.constructor, s = x.s, e = x.e, half = new Big2("0.5");
102863
102941
  if (!x.c[0]) return new Big2(x);
102864
102942
  if (s < 0) {
102865
- throw Error(NAME2 + "No square root");
102943
+ throw Error(NAME + "No square root");
102866
102944
  }
102867
102945
  s = Math.sqrt(+stringify(x, true, true));
102868
102946
  if (s === 0 || s === 1 / 0) {
@@ -102942,7 +103020,7 @@ P2[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")] = P2.toJSON = P2.to
102942
103020
  P2.toNumber = function() {
102943
103021
  var n = +stringify(this, true, true);
102944
103022
  if (this.constructor.strict === true && !this.eq(n.toString())) {
102945
- throw Error(NAME2 + "Imprecise conversion");
103023
+ throw Error(NAME + "Imprecise conversion");
102946
103024
  }
102947
103025
  return n;
102948
103026
  };
@@ -102960,7 +103038,7 @@ P2.toPrecision = function(sd, rm3) {
102960
103038
  P2.valueOf = function() {
102961
103039
  var x = this, Big2 = x.constructor;
102962
103040
  if (Big2.strict === true) {
102963
- throw Error(NAME2 + "valueOf disallowed");
103041
+ throw Error(NAME + "valueOf disallowed");
102964
103042
  }
102965
103043
  return stringify(x, x.e <= Big2.NE || x.e >= Big2.PE, true);
102966
103044
  };
@@ -108838,160 +108916,6 @@ BagResolver.registerBagClass(Bag);
108838
108916
  registerType(Bag, "X", (bag) => bag._toTytxPayload(), (payload) => Bag._fromTytxPayload(payload));
108839
108917
  setSubtypeDict(Bag.tytxSuffix, { ...getSubtypeDict(Bag.tytxSuffix), Bag });
108840
108918
 
108841
- // node_modules/@genrojs/builders/src/pointers.js
108842
- function pointerTransform(value) {
108843
- if (typeof value !== "string" || !["^", "="].includes(value[0]) || value.startsWith("==")) return null;
108844
- const index = value.indexOf(":");
108845
- if (index < 0) return null;
108846
- const expression = value[index + 1] === "=";
108847
- return { pointer: value.slice(0, index), expression, body: value.slice(index + (expression ? 2 : 1)) };
108848
- }
108849
- var SLOT = /^\{(\??[A-Za-z_][A-Za-z0-9_]*|\?)?\}/;
108850
- function pointerTemplate(body, read) {
108851
- let result = "", blocked = false;
108852
- for (let i2 = 0; i2 < body.length; ) {
108853
- if (body[i2] !== "{" && body[i2] !== "}") {
108854
- result += body[i2++];
108855
- continue;
108856
- }
108857
- const match2 = body.slice(i2).match(SLOT);
108858
- if (!match2) throw new SyntaxError("Invalid pointer template placeholder");
108859
- const slot = match2[1] ?? "";
108860
- const optional = slot.startsWith("?");
108861
- const value = read(optional ? slot.slice(1) : slot);
108862
- if (value == null || value === "" && !optional) blocked = true;
108863
- else result += String(value);
108864
- i2 += match2[0].length;
108865
- }
108866
- return blocked ? null : result;
108867
- }
108868
- function pointerExpression(body) {
108869
- const slots = [], identifiers2 = /* @__PURE__ */ new Set();
108870
- let text4 = "", operand = true;
108871
- for (let i2 = 0; i2 < body.length; ) {
108872
- const start = i2, c = body[i2];
108873
- if (c === '"' || c === "'" || c === "`") {
108874
- i2++;
108875
- while (i2 < body.length) {
108876
- if (body[i2] === "\\") {
108877
- i2 += 2;
108878
- continue;
108879
- }
108880
- if (body[i2++] === c) break;
108881
- }
108882
- text4 += body.slice(start, i2);
108883
- operand = false;
108884
- continue;
108885
- }
108886
- if (body.startsWith("//", i2)) {
108887
- i2 = body.indexOf("\n", i2);
108888
- if (i2 < 0) i2 = body.length;
108889
- text4 += body.slice(start, i2);
108890
- continue;
108891
- }
108892
- if (body.startsWith("/*", i2)) {
108893
- const end = body.indexOf("*/", i2 + 2);
108894
- i2 = end < 0 ? body.length : end + 2;
108895
- text4 += body.slice(start, i2);
108896
- continue;
108897
- }
108898
- if (c === "/" && operand) {
108899
- let bracket2 = false;
108900
- i2++;
108901
- while (i2 < body.length) {
108902
- const current = body[i2++];
108903
- if (current === "\\") {
108904
- i2++;
108905
- continue;
108906
- }
108907
- if (current === "[") bracket2 = true;
108908
- else if (current === "]") bracket2 = false;
108909
- else if (current === "/" && !bracket2) break;
108910
- }
108911
- while (/[a-z]/i.test(body[i2] ?? "") && i2 < body.length) i2++;
108912
- text4 += body.slice(start, i2);
108913
- operand = false;
108914
- continue;
108915
- }
108916
- const slot = c === "{" ? body.slice(i2).match(SLOT) : null;
108917
- if (slot) {
108918
- const name2 = slot[1] ?? "";
108919
- if (name2.startsWith("?")) throw new SyntaxError("Optional slots are supported in pointer templates only");
108920
- text4 += `_pointerValues[${slots.length}]`;
108921
- slots.push(name2);
108922
- i2 += slot[0].length;
108923
- operand = false;
108924
- continue;
108925
- }
108926
- const word = body.slice(i2).match(/^[A-Za-z_$][\w$]*/);
108927
- if (word) {
108928
- identifiers2.add(word[0]);
108929
- text4 += word[0];
108930
- i2 += word[0].length;
108931
- operand = ["return", "typeof", "void", "delete", "new", "in", "instanceof", "yield", "await"].includes(word[0]);
108932
- continue;
108933
- }
108934
- text4 += c;
108935
- i2++;
108936
- if (!/\s/.test(c)) operand = /[([{,:;=!?&|+*%~<>\/-]/.test(c);
108937
- }
108938
- return { text: text4, slots, identifiers: identifiers2 };
108939
- }
108940
- function resolvePointerItems(items, current, evaluate = () => null) {
108941
- const values2 = /* @__PURE__ */ new Map(), active = [];
108942
- const resolve = (name2) => {
108943
- if (values2.has(name2)) return values2.get(name2);
108944
- if (!items.has(name2)) throw new Error(`Referenced Source attribute '${name2}' does not exist`);
108945
- if (active.includes(name2)) throw new Error(`Cyclic attribute dependency: ${[...active, name2].join(" -> ")}`);
108946
- active.push(name2);
108947
- try {
108948
- const raw = items.get(name2);
108949
- const transform = typeof name2 === "string" ? pointerTransform(raw) : null;
108950
- let result = current.get(name2);
108951
- if (transform) {
108952
- const read = (key3) => key3 ? resolve(key3) : current.get(name2);
108953
- if (transform.expression) {
108954
- const expression = pointerExpression(transform.body);
108955
- result = evaluate(name2, raw, expression, expression.slots.map(read));
108956
- } else {
108957
- result = pointerTemplate(transform.body, read);
108958
- if (current.get(name2) == null) result = null;
108959
- }
108960
- }
108961
- values2.set(name2, result);
108962
- return result;
108963
- } finally {
108964
- active.pop();
108965
- }
108966
- };
108967
- return new Map([...items.keys()].map((name2) => [name2, resolve(name2)]));
108968
- }
108969
- function pointerDependencies(node, raw) {
108970
- const items = new Map([...Object.entries(node.getAttr()), ...node.fixedAttrItems()]);
108971
- const seen = /* @__PURE__ */ new Set(), active = [];
108972
- const visit = (value) => {
108973
- const transform = pointerTransform(value);
108974
- if (!transform) return;
108975
- const names = [];
108976
- if (transform.expression) names.push(...pointerExpression(transform.body).slots);
108977
- else pointerTemplate(transform.body, (key3) => {
108978
- names.push(key3);
108979
- return "";
108980
- });
108981
- for (const name2 of names.filter(Boolean)) {
108982
- if (!items.has(name2)) throw new Error(`Referenced Source attribute '${name2}' does not exist`);
108983
- if (active.includes(name2)) throw new Error(`Cyclic attribute dependency: ${[...active, name2].join(" -> ")}`);
108984
- if (seen.has(name2)) continue;
108985
- active.push(name2);
108986
- visit(items.get(name2));
108987
- active.pop();
108988
- seen.add(name2);
108989
- }
108990
- };
108991
- visit(raw);
108992
- return seen;
108993
- }
108994
-
108995
108919
  // node_modules/@genrojs/builders/src/utils.js
108996
108920
  var PYTHON_KEYWORDS = /* @__PURE__ */ new Set([
108997
108921
  "False",
@@ -109450,7 +109374,7 @@ function pythonRegexPattern(pattern, flags) {
109450
109374
  }
109451
109375
  return result;
109452
109376
  }
109453
- function annotation2(desc, path, nested = false, customTypes = null) {
109377
+ function annotation(desc, path, nested = false, customTypes = null) {
109454
109378
  if (desc === null) return null;
109455
109379
  exactKeys(desc, ["kind", "dtype", "module", "name", "origin", "arguments", "items", "values", "base", "metadata", "pattern", "flags", "ge", "le", "gt", "lt", "value"], ["kind"], path);
109456
109380
  switch (desc.kind) {
@@ -109489,7 +109413,7 @@ function annotation2(desc, path, nested = false, customTypes = null) {
109489
109413
  }
109490
109414
  case "union": {
109491
109415
  if (!Array.isArray(desc.items) || !desc.items.length) fail(path, "union items must be non-empty");
109492
- const items = desc.items.map((v, i2) => annotation2(v, `${path}.items[${i2}]`, true, customTypes));
109416
+ const items = desc.items.map((v, i2) => annotation(v, `${path}.items[${i2}]`, true, customTypes));
109493
109417
  return { ...desc, items, inputConstraint: items.some((x) => x.inputConstraint), test: (v) => items.some((x) => x.test && x.test(v)) };
109494
109418
  }
109495
109419
  case "literal":
@@ -109499,8 +109423,8 @@ function annotation2(desc, path, nested = false, customTypes = null) {
109499
109423
  case "annotated": {
109500
109424
  if (!Array.isArray(desc.metadata)) fail(path, "annotated metadata must be an array");
109501
109425
  if (desc.metadata.some((v) => !["regex", "range", "value"].includes(v?.kind))) fail(path, "unsupported annotation metadata kind");
109502
- const base3 = annotation2(desc.base, `${path}.base`, true, customTypes);
109503
- const metadata = desc.metadata.map((v, i2) => annotation2(v, `${path}.metadata[${i2}]`, true, customTypes));
109426
+ const base3 = annotation(desc.base, `${path}.base`, true, customTypes);
109427
+ const metadata = desc.metadata.map((v, i2) => annotation(v, `${path}.metadata[${i2}]`, true, customTypes));
109504
109428
  return { ...desc, base: base3, metadata, inputConstraint: base3.inputConstraint, test: (v) => base3.test(v) && metadata.every((x) => !x.test || x.test(v)) };
109505
109429
  }
109506
109430
  case "range": {
@@ -109532,12 +109456,12 @@ function annotation2(desc, path, nested = false, customTypes = null) {
109532
109456
  jsonValue(desc.value, `${path}.value`);
109533
109457
  return { ...desc };
109534
109458
  case "generic": {
109535
- const origin = annotation2(desc.origin, `${path}.origin`, true, customTypes);
109459
+ const origin = annotation(desc.origin, `${path}.origin`, true, customTypes);
109536
109460
  if (desc.origin?.kind !== "type" || desc.origin.module !== "builtins" || !["list", "dict", "tuple", "set"].includes(desc.origin.name)) {
109537
109461
  fail(path, "only list, dict, tuple and set generic origins are supported");
109538
109462
  }
109539
109463
  if (!Array.isArray(desc.arguments)) fail(path, "generic arguments must be an array");
109540
- const args = desc.arguments.map((v, i2) => annotation2(v, `${path}.arguments[${i2}]`, true, customTypes));
109464
+ const args = desc.arguments.map((v, i2) => annotation(v, `${path}.arguments[${i2}]`, true, customTypes));
109541
109465
  return { ...desc, origin, arguments: args, inputConstraint: args.some((x) => x.inputConstraint), test: (v) => origin.test(v) && genericItems(desc.origin, args, v) };
109542
109466
  }
109543
109467
  case "arguments":
@@ -109622,7 +109546,7 @@ function parameters(value, path, customTypes) {
109622
109546
  if (p.has_default) jsonValue(p.default, `${pp}.default`);
109623
109547
  foundVarKeyword ||= p.kind === "var_keyword";
109624
109548
  foundVarPositional ||= p.kind === "var_positional";
109625
- return { ...p, annotation: annotation2(p.annotation, `${pp}.annotation`, false, customTypes) };
109549
+ return { ...p, annotation: annotation(p.annotation, `${pp}.annotation`, false, customTypes) };
109626
109550
  });
109627
109551
  if (foundVarKeyword !== value.accepts_var_keyword || foundVarPositional !== value.accepts_var_positional) {
109628
109552
  fail(path, "variadic summary flags do not match parameters");
@@ -109764,7 +109688,7 @@ var CustomTypes = class _CustomTypes {
109764
109688
  }
109765
109689
  jsonValue(definition, `custom_types.${name2}`);
109766
109690
  const copy2 = structuredClone(definition);
109767
- const compiled = annotation2(copy2, `custom_types.${name2}`);
109691
+ const compiled = annotation(copy2, `custom_types.${name2}`);
109768
109692
  const reference2 = Object.freeze({ kind: "custom", name: name2 });
109769
109693
  Object.defineProperty(this, name2, { value: reference2, enumerable: true });
109770
109694
  this.#definitions.set(name2, copy2);
@@ -115799,7 +115723,7 @@ function validateInput(value, parameters2, context = {}) {
115799
115723
  if (output == null || output === true) return;
115800
115724
  if (typeof output !== "boolean" && typeof output !== "string" && (typeof output !== "object" || Array.isArray(output))) throw new TypeError("A validator returns true, false, null, an error code, or a result object/Bag.");
115801
115725
  const prefix = `validate_${rule}`;
115802
- const response = output instanceof Bag ? Object.fromEntries(output.getNodes().map((node) => [node.label, node.value])) : typeof output === "object" ? output : { errorcode: output === false ? "error" : output };
115726
+ const response = output instanceof Bag2 ? Object.fromEntries(output.getNodes().map((node) => [node.label, node.value])) : typeof output === "object" ? output : { errorcode: output === false ? "error" : output };
115803
115727
  if (Object.hasOwn(response, "value")) {
115804
115728
  result.modified ||= !Object.is(result.value, response.value);
115805
115729
  result.value = response.value;
@@ -115944,14 +115868,26 @@ var validationParameters = {
115944
115868
  // src/components/popup.js
115945
115869
  var VIEWPORT_MARGIN = 8;
115946
115870
  var ANCHOR_GAP = 3;
115947
- function positionPopup(popup, anchor, { align: align2 = "start", matchWidth = false, inset = 0 } = {}) {
115871
+ function positionPopup(popup, anchor, { align: align2 = "start", matchWidth = false, inset = 0, placement = "bottom", point = null } = {}) {
115948
115872
  const view = anchor.ownerDocument.defaultView;
115949
- const field = anchor.getBoundingClientRect();
115873
+ const field = point ? { left: point.x, right: point.x, top: point.y, bottom: point.y, width: 0 } : anchor.getBoundingClientRect();
115950
115874
  const availableWidth = Math.max(0, view.innerWidth - 2 * VIEWPORT_MARGIN);
115951
115875
  popup.style.setProperty("--gramlot-popup-available-width", `${availableWidth}px`);
115952
115876
  if (matchWidth) popup.style.width = `${Math.min(Math.max(0, field.width - 2 * inset), availableWidth)}px`;
115953
115877
  popup.style.removeProperty("--gramlot-popup-available-height");
115954
115878
  const natural = popup.getBoundingClientRect();
115879
+ if (placement === "side") {
115880
+ const right = Math.max(0, view.innerWidth - VIEWPORT_MARGIN - field.right - ANCHOR_GAP);
115881
+ const left2 = Math.max(0, field.left - VIEWPORT_MARGIN - ANCHOR_GAP);
115882
+ const opensLeft = natural.width > right && left2 > right;
115883
+ popup.style.setProperty("--gramlot-popup-available-width", `${opensLeft ? left2 : right}px`);
115884
+ popup.style.setProperty("--gramlot-popup-available-height", `${Math.max(0, view.innerHeight - 2 * VIEWPORT_MARGIN)}px`);
115885
+ const size4 = popup.getBoundingClientRect();
115886
+ const x = opensLeft ? field.left - size4.width - ANCHOR_GAP : field.right + ANCHOR_GAP;
115887
+ popup.style.left = `${Math.max(VIEWPORT_MARGIN, Math.min(x, view.innerWidth - size4.width - VIEWPORT_MARGIN))}px`;
115888
+ popup.style.top = `${Math.max(VIEWPORT_MARGIN, Math.min(field.top, view.innerHeight - size4.height - VIEWPORT_MARGIN))}px`;
115889
+ return;
115890
+ }
115955
115891
  const below = Math.max(0, view.innerHeight - VIEWPORT_MARGIN - field.bottom - ANCHOR_GAP);
115956
115892
  const above = Math.max(0, field.top - VIEWPORT_MARGIN - ANCHOR_GAP);
115957
115893
  const upwards = natural.height > below && above > below;
@@ -116257,7 +116193,7 @@ EditorControl.parameters = {
116257
116193
  live: { dtype: "B", default: true, binding: "read" }
116258
116194
  };
116259
116195
  var toggle = { dtype: "B", default: true, binding: "read" };
116260
- var CodeMirror = defineComponent({
116196
+ var CodeMirror = (0, components_exports.defineComponent)({
116261
116197
  name: "codeMirror",
116262
116198
  tag: "gramlot-code-mirror",
116263
116199
  base: EditorControl,
@@ -116364,7 +116300,7 @@ function HtmlControl(HTMLElement2) {
116364
116300
  };
116365
116301
  }
116366
116302
  HtmlControl.parameters = { disabled: { dtype: "B", default: false, binding: "read" }, readonly: { dtype: "B", default: false, binding: "read" }, live: { dtype: "B", default: true, binding: "read" } };
116367
- var HtmlEditor = defineComponent({
116303
+ var HtmlEditor = (0, components_exports.defineComponent)({
116368
116304
  name: "htmlEditor",
116369
116305
  tag: "gramlot-html-editor",
116370
116306
  base: HtmlControl,
@@ -116399,7 +116335,7 @@ function PreviewElement(HTMLElement2) {
116399
116335
  }
116400
116336
  };
116401
116337
  }
116402
- var HtmlPreview = defineComponent({
116338
+ var HtmlPreview = (0, components_exports.defineComponent)({
116403
116339
  name: "htmlPreview",
116404
116340
  tag: "gramlot-html-preview",
116405
116341
  base: PreviewElement,
@@ -116407,7 +116343,7 @@ var HtmlPreview = defineComponent({
116407
116343
  implementation: (Base) => class extends Base {
116408
116344
  }
116409
116345
  });
116410
- var MarkdownPreview = defineComponent({
116346
+ var MarkdownPreview = (0, components_exports.defineComponent)({
116411
116347
  name: "markdownPreview",
116412
116348
  tag: "gramlot-markdown-preview",
116413
116349
  base: PreviewElement,
@@ -116505,7 +116441,7 @@ function MarkdownControl(MarkdownElement) {
116505
116441
  };
116506
116442
  }
116507
116443
  MarkdownControl.parameters = { disabled: { dtype: "B", default: false, binding: "read" }, readonly: { dtype: "B", default: false, binding: "read" }, live: { dtype: "B", default: true, binding: "read" } };
116508
- var MarkdownEditor = defineComponent({
116444
+ var MarkdownEditor = (0, components_exports.defineComponent)({
116509
116445
  name: "markdownEditor",
116510
116446
  tag: "gramlot-markdown-editor",
116511
116447
  base: MarkdownControl,