@gramlot/gramlot 0.3.10 → 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 (91) hide show
  1. package/dist/components/editors/__init__.py +13 -0
  2. package/dist/components/{editors.js → editors/assets/collection.js} +131 -246
  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} +287 -198
  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 +2491 -902
  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/runtime.js +4 -2
  33. package/src/bootstrap.d.ts +1 -1
  34. package/src/bootstrap.js +52 -30
  35. package/src/builder/binding.json +25 -0
  36. package/src/builder/gramlot-builder.js +16 -3
  37. package/src/builder/source.js +33 -1
  38. package/src/collection-artifact.d.ts +11 -0
  39. package/src/collection-artifact.js +57 -0
  40. package/src/commands.d.ts +9 -0
  41. package/src/commands.js +36 -0
  42. package/src/components/bases.js +1 -1
  43. package/src/components/border-container.js +26 -1
  44. package/src/components/buttons.js +84 -161
  45. package/src/components/choice-editor.js +31 -10
  46. package/src/components/database-choices.js +110 -0
  47. package/src/components/inputs.js +15 -2
  48. package/src/components/layout.js +5 -3
  49. package/src/components/menus.js +346 -0
  50. package/src/components/popup.js +15 -2
  51. package/src/components/registry.js +18 -3
  52. package/src/components/toolbar-overflow.js +181 -0
  53. package/src/components/tree.js +14 -4
  54. package/src/components/windows.js +284 -0
  55. package/src/gramlot.d.ts +2 -0
  56. package/src/gramlot.js +4 -2
  57. package/src/handlers/rpc-handler.d.ts +6 -1
  58. package/src/handlers/rpc-handler.js +7 -2
  59. package/src/handlers/source-handler.d.ts +2 -1
  60. package/src/handlers/source-handler.js +10 -1
  61. package/src/index-page-styles.js +1 -1
  62. package/src/index-theme.js +1 -1
  63. package/src/index.d.ts +5 -0
  64. package/src/index.js +5 -0
  65. package/src/renderer/gramlot-html-renderer.js +1 -0
  66. package/src/renderer/gramlot-renderer.js +13 -3
  67. package/src/server/gramlot-file-server.d.ts +2 -0
  68. package/src/server/gramlot-file-server.js +45 -1
  69. package/src/server/gramlot-server.d.ts +20 -2
  70. package/src/server/gramlot-server.js +86 -6
  71. package/src/server/page-base.js +1 -0
  72. package/src/server/page.d.ts +3 -0
  73. package/src/view/button.js +47 -3
  74. package/src/view/controls.js +8 -0
  75. package/src/view/html.js +1 -0
  76. package/src/view/menu-command.js +45 -0
  77. package/src/view/menu.js +87 -0
  78. package/themes/gramlot-compact/README.md +19 -0
  79. package/themes/gramlot-compact/theme.css +138 -45
  80. package/themes/joanna/README.md +19 -0
  81. package/themes/joanna/theme.css +134 -78
  82. package/themes/mela/theme.css +184 -0
  83. package/themes/mimi/README.md +19 -0
  84. package/themes/mimi/theme.css +133 -77
  85. package/themes/palettes/README.md +3 -0
  86. package/themes/palettes/compact.css +86 -0
  87. package/themes/palettes/joanna.css +86 -0
  88. package/themes/palettes/mimi.css +86 -0
  89. package/tools/gramlot-tools-inspector.js +3 -3
  90. package/dist/components/layout.js +0 -3385
  91. 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) => {
@@ -44781,8 +44782,8 @@ var init_dom = __esm({
44781
44782
  /**
44782
44783
  * Wrap node inside another node
44783
44784
  */
44784
- static wrap(current, tag2, create2) {
44785
- const wrapper = isString2(tag2) ? create2.element(tag2) : tag2;
44785
+ static wrap(current, tag2, create3) {
44786
+ const wrapper = isString2(tag2) ? create3.element(tag2) : tag2;
44786
44787
  if (_Dom.isNode(current)) {
44787
44788
  if (!current.parentNode) {
44788
44789
  throw error("Element should be in DOM");
@@ -44834,15 +44835,15 @@ var init_dom = __esm({
44834
44835
  next = step;
44835
44836
  }
44836
44837
  }
44837
- static replace(elm, newTagName, create2, withAttributes = false, notMoveContent = false) {
44838
+ static replace(elm, newTagName, create3, withAttributes = false, notMoveContent = false) {
44838
44839
  if (isHTML(newTagName)) {
44839
- assert(create2, "Need create instance for new tag");
44840
- newTagName = create2.fromHTML(newTagName);
44840
+ assert(create3, "Need create instance for new tag");
44841
+ newTagName = create3.fromHTML(newTagName);
44841
44842
  }
44842
44843
  let tag2;
44843
44844
  if (isString2(newTagName)) {
44844
- assert(create2, "Need create instance for new tag");
44845
- tag2 = create2.element(newTagName);
44845
+ assert(create3, "Need create instance for new tag");
44846
+ tag2 = create3.element(newTagName);
44846
44847
  } else {
44847
44848
  tag2 = newTagName;
44848
44849
  }
@@ -56247,13 +56248,13 @@ var init_data_provider = __esm({
56247
56248
  * @param source - Server source key
56248
56249
  */
56249
56250
  createFolder(name2, path, source) {
56250
- const { create: create2 } = this.o;
56251
- if (!create2) {
56251
+ const { create: create3 } = this.o;
56252
+ if (!create3) {
56252
56253
  throw error("Set Create api options");
56253
56254
  }
56254
- create2.data.source = source;
56255
- create2.data.path = path;
56256
- create2.data.name = name2;
56255
+ create3.data.source = source;
56256
+ create3.data.path = path;
56257
+ create3.data.name = name2;
56257
56258
  return this.get("create").then((resp) => {
56258
56259
  if (this.isSuccess(resp)) {
56259
56260
  return true;
@@ -57512,12 +57513,12 @@ var init_self_listeners = __esm({
57512
57513
  // node_modules/jodit/esm/modules/file-browser/listeners/state-listeners.js
57513
57514
  function stateListeners() {
57514
57515
  const elmMap = elementsMap(this);
57515
- const { state, files, create: create2, options: options3 } = this, getDomElement = (item) => {
57516
+ const { state, files, create: create3, options: options3 } = this, getDomElement = (item) => {
57516
57517
  const key3 = item.uniqueHashKey;
57517
57518
  if (elmMap[key3]) {
57518
57519
  return elmMap[key3].elm;
57519
57520
  }
57520
- 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()));
57521
57522
  elm.dataset.key = key3;
57522
57523
  elmMap[key3] = {
57523
57524
  item,
@@ -57557,24 +57558,24 @@ function stateListeners() {
57557
57558
  this.files.container.appendChild(getDomElement(item));
57558
57559
  });
57559
57560
  } else {
57560
- 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")));
57561
57562
  }
57562
57563
  }, this.defaultTimeout)).on("change.sources", this.async.debounce(() => {
57563
57564
  Dom.detach(this.tree.container);
57564
57565
  state.sources.forEach((source) => {
57565
57566
  const sourceName = source.name;
57566
57567
  if (sourceName && sourceName !== DEFAULT_SOURCE_NAME2) {
57567
- 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));
57568
57569
  }
57569
57570
  source.folders.forEach((name2) => {
57570
- const folderElm = create2.a(this.tree.getFullElName("item"), {
57571
+ const folderElm = create3.a(this.tree.getFullElName("item"), {
57571
57572
  draggable: "draggable",
57572
57573
  href: "#",
57573
57574
  "data-path": normalizePath(source.path, name2 + "/"),
57574
57575
  "data-name": name2,
57575
57576
  "data-source": sourceName,
57576
57577
  "data-source-path": source.path
57577
- }, create2.span(this.tree.getFullElName("item-title"), name2));
57578
+ }, create3.span(this.tree.getFullElName("item-title"), name2));
57578
57579
  const action = (actionName) => (e) => {
57579
57580
  this.e.fire(`${actionName}.filebrowser`, {
57580
57581
  name: name2,
@@ -58893,14 +58894,14 @@ var init_table = __esm({
58893
58894
  formalCoordinate(table3, cell, max2 = false) {
58894
58895
  return _Table.__formalCoordinate(table3, cell, max2);
58895
58896
  }
58896
- static __appendRow(table3, line, after, create2) {
58897
+ static __appendRow(table3, line, after, create3) {
58897
58898
  var _a3;
58898
58899
  let row;
58899
58900
  if (!line) {
58900
58901
  const columnsCount = _Table.__getColumnsCount(table3);
58901
- row = create2.element("tr");
58902
+ row = create3.element("tr");
58902
58903
  for (let j = 0; j < columnsCount; j += 1) {
58903
- row.appendChild(create2.element("td"));
58904
+ row.appendChild(create3.element("td"));
58904
58905
  }
58905
58906
  } else {
58906
58907
  row = line.cloneNode(true);
@@ -84463,7 +84464,7 @@ function cleanArray(array) {
84463
84464
  return array;
84464
84465
  }
84465
84466
  function clone2(object) {
84466
- const newObject = create(null);
84467
+ const newObject = create2(null);
84467
84468
  for (const _ref2 of entries(object)) {
84468
84469
  var _ref3 = _slicedToArray(_ref2, 2);
84469
84470
  const property = _ref3[0];
@@ -84620,7 +84621,7 @@ function createDOMPurify() {
84620
84621
  ...mathMl,
84621
84622
  ...xml2
84622
84623
  ]);
84623
- let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
84624
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(create2(null, {
84624
84625
  tagNameCheck: {
84625
84626
  writable: true,
84626
84627
  configurable: false,
@@ -84642,7 +84643,7 @@ function createDOMPurify() {
84642
84643
  }));
84643
84644
  let FORBID_TAGS = null;
84644
84645
  let FORBID_ATTR = null;
84645
- const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
84646
+ const EXTRA_ELEMENT_HANDLING = Object.seal(create2(null, {
84646
84647
  tagCheck: {
84647
84648
  writable: true,
84648
84649
  configurable: false,
@@ -84742,7 +84743,7 @@ function createDOMPurify() {
84742
84743
  SVG_NAMESPACE,
84743
84744
  HTML_NAMESPACE2
84744
84745
  ], stringToString);
84745
- const DEFAULT_MATHML_TEXT_INTEGRATION_POINTS = freeze2([
84746
+ const DEFAULT_MATHML_TEXT_INTEGRATION_POINTS = freeze([
84746
84747
  "mi",
84747
84748
  "mo",
84748
84749
  "mn",
@@ -84750,7 +84751,7 @@ function createDOMPurify() {
84750
84751
  "mtext"
84751
84752
  ]);
84752
84753
  let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS);
84753
- const DEFAULT_HTML_INTEGRATION_POINTS = freeze2(["annotation-xml"]);
84754
+ const DEFAULT_HTML_INTEGRATION_POINTS = freeze(["annotation-xml"]);
84754
84755
  let HTML_INTEGRATION_POINTS2 = addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS);
84755
84756
  const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, [
84756
84757
  "title",
@@ -84809,8 +84810,8 @@ function createDOMPurify() {
84809
84810
  NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE2;
84810
84811
  MATHML_TEXT_INTEGRATION_POINTS = _resolveObjectOption(cfg, "MATHML_TEXT_INTEGRATION_POINTS", () => addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS));
84811
84812
  HTML_INTEGRATION_POINTS2 = _resolveObjectOption(cfg, "HTML_INTEGRATION_POINTS", () => addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS));
84812
- const customElementHandling = _resolveObjectOption(cfg, "CUSTOM_ELEMENT_HANDLING", () => create(null));
84813
- CUSTOM_ELEMENT_HANDLING = create(null);
84813
+ const customElementHandling = _resolveObjectOption(cfg, "CUSTOM_ELEMENT_HANDLING", () => create2(null));
84814
+ CUSTOM_ELEMENT_HANDLING = create2(null);
84814
84815
  if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck)) CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck;
84815
84816
  if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck)) CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck;
84816
84817
  if (objectHasOwnProperty(customElementHandling, "allowCustomizedBuiltInElements") && typeof customElementHandling.allowCustomizedBuiltInElements === "boolean") CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements;
@@ -84819,7 +84820,7 @@ function createDOMPurify() {
84819
84820
  if (RETURN_DOM_FRAGMENT) RETURN_DOM = true;
84820
84821
  if (USE_PROFILES) {
84821
84822
  ALLOWED_TAGS = addToSet({}, text3);
84822
- ALLOWED_ATTR = create(null);
84823
+ ALLOWED_ATTR = create2(null);
84823
84824
  if (USE_PROFILES.html === true) {
84824
84825
  addToSet(ALLOWED_TAGS, html$1);
84825
84826
  addToSet(ALLOWED_ATTR, html2);
@@ -84888,7 +84889,7 @@ function createDOMPurify() {
84888
84889
  if (trustedTypesPolicy === void 0) trustedTypesPolicy = _getDefaultTrustedTypesPolicy();
84889
84890
  if (trustedTypesPolicy && typeof emptyHTML === "string") emptyHTML = _createTrustedHTML("");
84890
84891
  }
84891
- if (freeze2) freeze2(cfg);
84892
+ if (freeze) freeze(cfg);
84892
84893
  CONFIG = cfg;
84893
84894
  };
84894
84895
  const ALL_SVG_TAGS = addToSet({}, [
@@ -85523,7 +85524,7 @@ function createDOMPurify() {
85523
85524
  };
85524
85525
  return DOMPurify;
85525
85526
  }
85526
- 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;
85527
85528
  var init_purify_es = __esm({
85528
85529
  "node_modules/dompurify/dist/purify.es.mjs"() {
85529
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 */
@@ -85542,13 +85543,13 @@ var init_purify_es = __esm({
85542
85543
  isFrozen = Object.isFrozen;
85543
85544
  getPrototypeOf = Object.getPrototypeOf;
85544
85545
  getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
85545
- freeze2 = Object.freeze;
85546
+ freeze = Object.freeze;
85546
85547
  seal = Object.seal;
85547
- create = Object.create;
85548
+ create2 = Object.create;
85548
85549
  _ref = typeof Reflect !== "undefined" && Reflect;
85549
85550
  apply = _ref.apply;
85550
85551
  construct = _ref.construct;
85551
- if (!freeze2) freeze2 = function freeze3(x) {
85552
+ if (!freeze) freeze = function freeze2(x) {
85552
85553
  return x;
85553
85554
  };
85554
85555
  if (!seal) seal = function seal2(x) {
@@ -85584,7 +85585,7 @@ var init_purify_es = __esm({
85584
85585
  objectToString = unapply(Object.prototype.toString);
85585
85586
  regExpTest = unapply(RegExp.prototype.test);
85586
85587
  typeErrorCreate = unconstruct(TypeError);
85587
- html$1 = freeze2([
85588
+ html$1 = freeze([
85588
85589
  "a",
85589
85590
  "abbr",
85590
85591
  "acronym",
@@ -85705,7 +85706,7 @@ var init_purify_es = __esm({
85705
85706
  "video",
85706
85707
  "wbr"
85707
85708
  ]);
85708
- svg$1 = freeze2([
85709
+ svg$1 = freeze([
85709
85710
  "svg",
85710
85711
  "a",
85711
85712
  "altglyph",
@@ -85754,7 +85755,7 @@ var init_purify_es = __esm({
85754
85755
  "view",
85755
85756
  "vkern"
85756
85757
  ]);
85757
- svgFilters = freeze2([
85758
+ svgFilters = freeze([
85758
85759
  "feBlend",
85759
85760
  "feColorMatrix",
85760
85761
  "feComponentTransfer",
@@ -85781,7 +85782,7 @@ var init_purify_es = __esm({
85781
85782
  "feTile",
85782
85783
  "feTurbulence"
85783
85784
  ]);
85784
- svgDisallowed = freeze2([
85785
+ svgDisallowed = freeze([
85785
85786
  "animate",
85786
85787
  "color-profile",
85787
85788
  "cursor",
@@ -85805,7 +85806,7 @@ var init_purify_es = __esm({
85805
85806
  "unknown",
85806
85807
  "use"
85807
85808
  ]);
85808
- mathMl$1 = freeze2([
85809
+ mathMl$1 = freeze([
85809
85810
  "math",
85810
85811
  "menclose",
85811
85812
  "merror",
@@ -85837,7 +85838,7 @@ var init_purify_es = __esm({
85837
85838
  "munderover",
85838
85839
  "mprescripts"
85839
85840
  ]);
85840
- mathMlDisallowed = freeze2([
85841
+ mathMlDisallowed = freeze([
85841
85842
  "maction",
85842
85843
  "maligngroup",
85843
85844
  "malignmark",
@@ -85854,8 +85855,8 @@ var init_purify_es = __esm({
85854
85855
  "mprescripts",
85855
85856
  "none"
85856
85857
  ]);
85857
- text3 = freeze2(["#text"]);
85858
- html2 = freeze2([
85858
+ text3 = freeze(["#text"]);
85859
+ html2 = freeze([
85859
85860
  "accept",
85860
85861
  "action",
85861
85862
  "align",
@@ -85975,7 +85976,7 @@ var init_purify_es = __esm({
85975
85976
  "wrap",
85976
85977
  "xmlns"
85977
85978
  ]);
85978
- svg2 = freeze2([
85979
+ svg2 = freeze([
85979
85980
  "accent-height",
85980
85981
  "accumulate",
85981
85982
  "additive",
@@ -86169,7 +86170,7 @@ var init_purify_es = __esm({
86169
86170
  "z",
86170
86171
  "zoomandpan"
86171
86172
  ]);
86172
- mathMl = freeze2([
86173
+ mathMl = freeze([
86173
86174
  "accent",
86174
86175
  "accentunder",
86175
86176
  "align",
@@ -86225,7 +86226,7 @@ var init_purify_es = __esm({
86225
86226
  "width",
86226
86227
  "xmlns"
86227
86228
  ]);
86228
- xml2 = freeze2([
86229
+ xml2 = freeze([
86229
86230
  "xlink:href",
86230
86231
  "xml:id",
86231
86232
  "xlink:title",
@@ -86270,13 +86271,13 @@ var init_purify_es = __esm({
86270
86271
  "plaintext",
86271
86272
  "noscript"
86272
86273
  ];
86273
- LITERAL_TEXT_ELEMENTS = freeze2(addToSet({}, LITERAL_TEXT_ELEMENT_NAMES));
86274
+ LITERAL_TEXT_ELEMENTS = freeze(addToSet({}, LITERAL_TEXT_ELEMENT_NAMES));
86274
86275
  LITERAL_TEXT_CLOSE = (function() {
86275
86276
  const map5 = {};
86276
86277
  arrayForEach(LITERAL_TEXT_ELEMENT_NAMES, (name2) => {
86277
86278
  map5[name2] = seal(new RegExp("</" + name2 + "(?=[\\t\\n\\f\\r />])", "i"));
86278
86279
  });
86279
- return freeze2(map5);
86280
+ return freeze(map5);
86280
86281
  })();
86281
86282
  getGlobal = function getGlobal2() {
86282
86283
  return typeof window === "undefined" ? null : window;
@@ -89707,6 +89708,14 @@ function mapFragment(fragment, f, parent) {
89707
89708
  }
89708
89709
  return Fragment.fromArray(mapped);
89709
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
+ }
89710
89719
  function contentBetween(doc4, from2, to) {
89711
89720
  let $from = doc4.resolve(from2), dist2 = to - from2, depth2 = $from.depth;
89712
89721
  while (dist2 > 0 && depth2 > 0 && $from.indexAfter(depth2) == $from.node(depth2).childCount) {
@@ -89725,17 +89734,14 @@ function contentBetween(doc4, from2, to) {
89725
89734
  return false;
89726
89735
  }
89727
89736
  function addMark(tr, from2, to, mark) {
89728
- let added = [], 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
- if (adding && adding.to == start)
89736
- adding.to = end;
89737
- else
89738
- added.push(adding = new AddMarkStep(start, end, mark));
89744
+ pushMarkStep(AddMarkStep, start, end, mark, added);
89739
89745
  }
89740
89746
  });
89741
89747
  added.forEach((s) => tr.step(s));
@@ -90617,8 +90623,6 @@ var init_dist28 = __esm({
90617
90623
  this.mark = mark;
90618
90624
  }
90619
90625
  apply(doc4) {
90620
- if (this.from == this.to)
90621
- return new StepResult(doc4, null);
90622
90626
  let oldSlice = doc4.slice(this.from, this.to), $from = doc4.resolve(this.from);
90623
90627
  let parent = $from.node($from.sharedDepth(this.to));
90624
90628
  let slice2 = new Slice(mapFragment(oldSlice.content, (node, parent2) => {
@@ -90635,14 +90639,14 @@ var init_dist28 = __esm({
90635
90639
  let added = this.mark.addToSet(node.marks);
90636
90640
  if (!Mark.sameSet(added, node.marks)) {
90637
90641
  let from2 = Math.max(this.from, pos), to = Math.min(this.to, pos + node.nodeSize);
90638
- steps.push(new RemoveMarkStep(from2, to, this.mark));
90642
+ pushMarkStep(RemoveMarkStep, from2, to, this.mark, steps);
90639
90643
  for (let mark of node.marks)
90640
90644
  if (!mark.isInSet(added))
90641
- steps.push(new _AddMarkStep(from2, to, mark));
90645
+ pushMarkStep(_AddMarkStep, from2, to, mark, steps);
90642
90646
  }
90643
90647
  }
90644
90648
  });
90645
- return steps.length == 0 ? new RemoveMarkStep(this.from, this.from, this.mark) : steps.length == 1 ? steps[0] : new MarkSetStep(steps);
90649
+ return steps.length == 1 ? steps[0] : new MarkSetStep(steps);
90646
90650
  }
90647
90651
  map(mapping) {
90648
90652
  let from2 = mapping.map(this.from, 1), to = mapping.map(this.to, -1);
@@ -90684,8 +90688,6 @@ var init_dist28 = __esm({
90684
90688
  this.mark = mark;
90685
90689
  }
90686
90690
  apply(doc4) {
90687
- if (this.from == this.to)
90688
- return new StepResult(doc4, null);
90689
90691
  let oldSlice = doc4.slice(this.from, this.to);
90690
90692
  let slice2 = new Slice(mapFragment(oldSlice.content, (node) => {
90691
90693
  return node.mark(this.mark.removeFromSet(node.marks));
@@ -90696,9 +90698,9 @@ var init_dist28 = __esm({
90696
90698
  let steps = [];
90697
90699
  doc4.nodesBetween(this.from, this.to, (node, pos) => {
90698
90700
  if (node.isInline && node.isAtom && this.mark.isInSet(node.marks))
90699
- steps.push(new AddMarkStep(Math.max(this.from, pos), Math.min(this.to, pos + node.nodeSize), this.mark));
90701
+ pushMarkStep(AddMarkStep, Math.max(this.from, pos), Math.min(this.to, pos + node.nodeSize), this.mark, steps);
90700
90702
  });
90701
- return steps.length == 0 ? new AddMarkStep(this.from, this.from, this.mark) : steps.length == 1 ? steps[0] : new MarkSetStep(steps);
90703
+ return steps.length == 1 ? steps[0] : new MarkSetStep(steps);
90702
90704
  }
90703
90705
  map(mapping) {
90704
90706
  let from2 = mapping.map(this.from, 1), to = mapping.map(this.to, -1);
@@ -90758,7 +90760,7 @@ var init_dist28 = __esm({
90758
90760
  toJSON() {
90759
90761
  return { stepType: "markSet", steps: this.steps.map((s) => s.toJSON()) };
90760
90762
  }
90761
- fromJSON(schema2, json3) {
90763
+ static fromJSON(schema2, json3) {
90762
90764
  if (!Array.isArray(json3.steps) || !json3.steps.every((s) => s.stepType == "addMark" || s.stepType == "removeMark"))
90763
90765
  throw new RangeError("Invalid JSON for MarkSetStep");
90764
90766
  return new _MarkSetStep(json3.steps.map((s) => Step.fromJSON(schema2, s)));
@@ -99904,151 +99906,22 @@ var init_prose_mirror_engine = __esm({
99904
99906
  }
99905
99907
  });
99906
99908
 
99907
- // src/webcomponent.js
99908
- 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;
99909
- var RESERVED = /* @__PURE__ */ new Set([
99910
- "annotation-xml",
99911
- "color-profile",
99912
- "font-face",
99913
- "font-face-src",
99914
- "font-face-uri",
99915
- "font-face-format",
99916
- "font-face-name",
99917
- "missing-glyph"
99918
- ]);
99919
- function webcomponentCode(attrs2) {
99920
- const code3 = attrs2.code;
99921
- if (typeof code3 !== "string" || NAME.exec(code3)?.[0] !== code3 || !code3.includes("-") || RESERVED.has(code3)) {
99922
- throw new TypeError("webcomponent: code must be a literal custom-element name");
99923
- }
99924
- return code3;
99925
- }
99926
-
99927
- // src/components/registry.js
99928
- function freeze(value) {
99929
- for (const child of Object.values(value)) if (child && typeof child === "object") freeze(child);
99930
- return Object.freeze(value);
99931
- }
99932
- function annotation(parameter) {
99933
- if (typeof parameter.dtype !== "string" && !Array.isArray(parameter.dtype)) throw new TypeError("Component parameter requires dtype");
99934
- const alternatives = (Array.isArray(parameter.dtype) ? parameter.dtype : [parameter.dtype]).map((dtype) => ({ kind: "dtype", dtype }));
99935
- if (parameter.nullable) alternatives.push({ kind: "dtype", dtype: "NN" });
99936
- if (parameter.binding && parameter.dtype !== "T") alternatives.push({
99937
- kind: "annotated",
99938
- base: { kind: "dtype", dtype: "T" },
99939
- metadata: [{ kind: "regex", pattern: "^[\\^=].+", flags: 0 }]
99940
- });
99941
- return alternatives.length === 1 ? alternatives[0] : { kind: "union", items: alternatives };
99942
- }
99943
- 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 }) {
99944
- webcomponentCode({ code: tag2 });
99945
- if (!/^[a-zA-Z][a-zA-Z0-9]*$/.test(name2)) throw new TypeError("Invalid component authoring name");
99946
- const effective = { ...base3.parameters };
99947
- for (const mixin of mixins) {
99948
- for (const [key3, spec] of Object.entries(mixin.parameters)) {
99949
- if (Object.hasOwn(effective, key3)) throw new Error(`Duplicate mixin parameter: ${key3}`);
99950
- effective[key3] = spec;
99951
- }
99952
- }
99953
- Object.assign(effective, parameters2);
99954
- for (const spec of Object.values(effective)) annotation(spec);
99955
- return Object.freeze({
99956
- name: name2,
99957
- tag: tag2,
99958
- base: base3,
99959
- subTags,
99960
- presentationDefaults: Object.freeze([...presentationDefaults]),
99961
- dataScope,
99962
- command: command2,
99963
- bagStore,
99964
- mixins: Object.freeze([...mixins]),
99965
- parameters: freeze(structuredClone(effective)),
99966
- childParameters: freeze(structuredClone(childParameters)),
99967
- sourceContext: sourceContext2,
99968
- dragSource,
99969
- implementation
99970
- });
99971
- }
99972
- var ComponentCollection = class {
99973
- #classes = /* @__PURE__ */ new WeakMap();
99974
- constructor({ name: name2, components }) {
99975
- this.name = name2;
99976
- this.components = Object.freeze([...components]);
99977
- const names = /* @__PURE__ */ new Set(), tags3 = /* @__PURE__ */ new Set();
99978
- for (const component2 of components) {
99979
- if (names.has(component2.name.toLowerCase()) || tags3.has(component2.tag)) {
99980
- throw new Error(`Duplicate component: ${component2.name}`);
99981
- }
99982
- names.add(component2.name.toLowerCase());
99983
- tags3.add(component2.tag);
99984
- }
99985
- }
99986
- /** Same JSON consumed by Python and JavaScript Builders. */
99987
- toDocument() {
99988
- return {
99989
- document_format: { name: "builder_grammar", version: "1.1" },
99990
- grammar: { name: this.name, version: null, title: this.name, description: null },
99991
- abstracts: {},
99992
- elements: Object.fromEntries(this.components.map((component2) => [component2.name, {
99993
- doc: null,
99994
- sub_tags: component2.subTags,
99995
- parent_tags: null,
99996
- inherits_from: null,
99997
- ns: null,
99998
- node_label: null,
99999
- collection_key: null,
100000
- attributes: {
100001
- parameters: [
100002
- ...Object.entries(component2.parameters).map(([name2, spec]) => ({
100003
- name: name2,
100004
- kind: "keyword_only",
100005
- role: "attribute",
100006
- annotation: annotation(spec),
100007
- has_default: true,
100008
- default: spec.default ?? null
100009
- })),
100010
- {
100011
- name: "attr",
100012
- kind: "var_keyword",
100013
- role: "attribute",
100014
- annotation: { kind: "any" },
100015
- has_default: false
100016
- }
100017
- ],
100018
- accepts_var_keyword: true,
100019
- accepts_var_positional: false
100020
- },
100021
- _meta: { render_tag: component2.tag, gramlot_component: {
100022
- parameters: structuredClone(component2.parameters),
100023
- presentationDefaults: [...component2.presentationDefaults],
100024
- dataScope: component2.dataScope,
100025
- command: component2.command,
100026
- ...Object.keys(component2.childParameters).length ? { childParameters: structuredClone(component2.childParameters) } : {},
100027
- ...component2.sourceContext ? { sourceContext: true } : {},
100028
- ...component2.dragSource ? { dragSource: true } : {},
100029
- ...component2.bagStore ? { bagStore: true } : {}
100030
- } }
100031
- }]))
100032
- };
100033
- }
100034
- /** Register once per document realm, only when the collection is activated. */
100035
- register(window2) {
100036
- if (this.#classes.has(window2)) return;
100037
- const classes2 = [];
100038
- for (const component2 of this.components) {
100039
- if (window2.customElements.get(component2.tag)) throw new Error(`Custom element already registered: ${component2.tag}`);
100040
- let Base = component2.base(window2.HTMLElement);
100041
- for (const mixin of component2.mixins) Base = mixin(Base);
100042
- const Class = component2.implementation(Base);
100043
- Object.defineProperty(Class, "gramlotComponent", { value: component2 });
100044
- classes2.push([component2.tag, Class]);
100045
- }
100046
- for (const [tag2, Class] of classes2) window2.customElements.define(tag2, Class);
100047
- this.#classes.set(window2, classes2);
100048
- }
100049
- };
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";
100050
99917
  function defineCollection(options3) {
100051
- 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 });
100052
99925
  }
100053
99926
 
100054
99927
  // src/components/parameters.js
@@ -100082,7 +99955,7 @@ function controlElement(HTMLElement2) {
100082
99955
  style.textContent = `:host{display:inline-block;font:inherit} *,*::before,*::after{box-sizing:border-box}
100083
99956
  input,textarea{font:inherit;max-width:100%} .control-box{min-width:0;color:var(--gramlot-ink,CanvasText)}
100084
99957
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),textarea{
100085
- 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);
100086
99959
  border-radius:var(--gramlot-radius-sm,4px);background:var(--gramlot-field-background,Canvas);color:var(--gramlot-ink,CanvasText);
100087
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)}
100088
99961
  input:read-only:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),textarea:read-only{
@@ -102697,11 +102570,11 @@ var MAX_POWER = 1e6;
102697
102570
  var NE = -7;
102698
102571
  var PE = 21;
102699
102572
  var STRICT = false;
102700
- var NAME2 = "[big.js] ";
102701
- var INVALID = NAME2 + "Invalid ";
102573
+ var NAME = "[big.js] ";
102574
+ var INVALID = NAME + "Invalid ";
102702
102575
  var INVALID_DP = INVALID + "decimal places";
102703
102576
  var INVALID_RM = INVALID + "rounding mode";
102704
- var DIV_BY_ZERO = NAME2 + "Division by zero";
102577
+ var DIV_BY_ZERO = NAME + "Division by zero";
102705
102578
  var P2 = {};
102706
102579
  var UNDEFINED = void 0;
102707
102580
  var NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
@@ -103067,7 +102940,7 @@ P2.sqrt = function() {
103067
102940
  var r, c, t2, x = this, Big2 = x.constructor, s = x.s, e = x.e, half = new Big2("0.5");
103068
102941
  if (!x.c[0]) return new Big2(x);
103069
102942
  if (s < 0) {
103070
- throw Error(NAME2 + "No square root");
102943
+ throw Error(NAME + "No square root");
103071
102944
  }
103072
102945
  s = Math.sqrt(+stringify(x, true, true));
103073
102946
  if (s === 0 || s === 1 / 0) {
@@ -103147,7 +103020,7 @@ P2[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")] = P2.toJSON = P2.to
103147
103020
  P2.toNumber = function() {
103148
103021
  var n = +stringify(this, true, true);
103149
103022
  if (this.constructor.strict === true && !this.eq(n.toString())) {
103150
- throw Error(NAME2 + "Imprecise conversion");
103023
+ throw Error(NAME + "Imprecise conversion");
103151
103024
  }
103152
103025
  return n;
103153
103026
  };
@@ -103165,7 +103038,7 @@ P2.toPrecision = function(sd, rm3) {
103165
103038
  P2.valueOf = function() {
103166
103039
  var x = this, Big2 = x.constructor;
103167
103040
  if (Big2.strict === true) {
103168
- throw Error(NAME2 + "valueOf disallowed");
103041
+ throw Error(NAME + "valueOf disallowed");
103169
103042
  }
103170
103043
  return stringify(x, x.e <= Big2.NE || x.e >= Big2.PE, true);
103171
103044
  };
@@ -109501,7 +109374,7 @@ function pythonRegexPattern(pattern, flags) {
109501
109374
  }
109502
109375
  return result;
109503
109376
  }
109504
- function annotation2(desc, path, nested = false, customTypes = null) {
109377
+ function annotation(desc, path, nested = false, customTypes = null) {
109505
109378
  if (desc === null) return null;
109506
109379
  exactKeys(desc, ["kind", "dtype", "module", "name", "origin", "arguments", "items", "values", "base", "metadata", "pattern", "flags", "ge", "le", "gt", "lt", "value"], ["kind"], path);
109507
109380
  switch (desc.kind) {
@@ -109540,7 +109413,7 @@ function annotation2(desc, path, nested = false, customTypes = null) {
109540
109413
  }
109541
109414
  case "union": {
109542
109415
  if (!Array.isArray(desc.items) || !desc.items.length) fail(path, "union items must be non-empty");
109543
- 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));
109544
109417
  return { ...desc, items, inputConstraint: items.some((x) => x.inputConstraint), test: (v) => items.some((x) => x.test && x.test(v)) };
109545
109418
  }
109546
109419
  case "literal":
@@ -109550,8 +109423,8 @@ function annotation2(desc, path, nested = false, customTypes = null) {
109550
109423
  case "annotated": {
109551
109424
  if (!Array.isArray(desc.metadata)) fail(path, "annotated metadata must be an array");
109552
109425
  if (desc.metadata.some((v) => !["regex", "range", "value"].includes(v?.kind))) fail(path, "unsupported annotation metadata kind");
109553
- const base3 = annotation2(desc.base, `${path}.base`, true, customTypes);
109554
- 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));
109555
109428
  return { ...desc, base: base3, metadata, inputConstraint: base3.inputConstraint, test: (v) => base3.test(v) && metadata.every((x) => !x.test || x.test(v)) };
109556
109429
  }
109557
109430
  case "range": {
@@ -109583,12 +109456,12 @@ function annotation2(desc, path, nested = false, customTypes = null) {
109583
109456
  jsonValue(desc.value, `${path}.value`);
109584
109457
  return { ...desc };
109585
109458
  case "generic": {
109586
- const origin = annotation2(desc.origin, `${path}.origin`, true, customTypes);
109459
+ const origin = annotation(desc.origin, `${path}.origin`, true, customTypes);
109587
109460
  if (desc.origin?.kind !== "type" || desc.origin.module !== "builtins" || !["list", "dict", "tuple", "set"].includes(desc.origin.name)) {
109588
109461
  fail(path, "only list, dict, tuple and set generic origins are supported");
109589
109462
  }
109590
109463
  if (!Array.isArray(desc.arguments)) fail(path, "generic arguments must be an array");
109591
- 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));
109592
109465
  return { ...desc, origin, arguments: args, inputConstraint: args.some((x) => x.inputConstraint), test: (v) => origin.test(v) && genericItems(desc.origin, args, v) };
109593
109466
  }
109594
109467
  case "arguments":
@@ -109673,7 +109546,7 @@ function parameters(value, path, customTypes) {
109673
109546
  if (p.has_default) jsonValue(p.default, `${pp}.default`);
109674
109547
  foundVarKeyword ||= p.kind === "var_keyword";
109675
109548
  foundVarPositional ||= p.kind === "var_positional";
109676
- return { ...p, annotation: annotation2(p.annotation, `${pp}.annotation`, false, customTypes) };
109549
+ return { ...p, annotation: annotation(p.annotation, `${pp}.annotation`, false, customTypes) };
109677
109550
  });
109678
109551
  if (foundVarKeyword !== value.accepts_var_keyword || foundVarPositional !== value.accepts_var_positional) {
109679
109552
  fail(path, "variadic summary flags do not match parameters");
@@ -109815,7 +109688,7 @@ var CustomTypes = class _CustomTypes {
109815
109688
  }
109816
109689
  jsonValue(definition, `custom_types.${name2}`);
109817
109690
  const copy2 = structuredClone(definition);
109818
- const compiled = annotation2(copy2, `custom_types.${name2}`);
109691
+ const compiled = annotation(copy2, `custom_types.${name2}`);
109819
109692
  const reference2 = Object.freeze({ kind: "custom", name: name2 });
109820
109693
  Object.defineProperty(this, name2, { value: reference2, enumerable: true });
109821
109694
  this.#definitions.set(name2, copy2);
@@ -115995,14 +115868,26 @@ var validationParameters = {
115995
115868
  // src/components/popup.js
115996
115869
  var VIEWPORT_MARGIN = 8;
115997
115870
  var ANCHOR_GAP = 3;
115998
- 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 } = {}) {
115999
115872
  const view = anchor.ownerDocument.defaultView;
116000
- const field = anchor.getBoundingClientRect();
115873
+ const field = point ? { left: point.x, right: point.x, top: point.y, bottom: point.y, width: 0 } : anchor.getBoundingClientRect();
116001
115874
  const availableWidth = Math.max(0, view.innerWidth - 2 * VIEWPORT_MARGIN);
116002
115875
  popup.style.setProperty("--gramlot-popup-available-width", `${availableWidth}px`);
116003
115876
  if (matchWidth) popup.style.width = `${Math.min(Math.max(0, field.width - 2 * inset), availableWidth)}px`;
116004
115877
  popup.style.removeProperty("--gramlot-popup-available-height");
116005
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
+ }
116006
115891
  const below = Math.max(0, view.innerHeight - VIEWPORT_MARGIN - field.bottom - ANCHOR_GAP);
116007
115892
  const above = Math.max(0, field.top - VIEWPORT_MARGIN - ANCHOR_GAP);
116008
115893
  const upwards = natural.height > below && above > below;
@@ -116308,7 +116193,7 @@ EditorControl.parameters = {
116308
116193
  live: { dtype: "B", default: true, binding: "read" }
116309
116194
  };
116310
116195
  var toggle = { dtype: "B", default: true, binding: "read" };
116311
- var CodeMirror = defineComponent({
116196
+ var CodeMirror = (0, components_exports.defineComponent)({
116312
116197
  name: "codeMirror",
116313
116198
  tag: "gramlot-code-mirror",
116314
116199
  base: EditorControl,
@@ -116415,7 +116300,7 @@ function HtmlControl(HTMLElement2) {
116415
116300
  };
116416
116301
  }
116417
116302
  HtmlControl.parameters = { disabled: { dtype: "B", default: false, binding: "read" }, readonly: { dtype: "B", default: false, binding: "read" }, live: { dtype: "B", default: true, binding: "read" } };
116418
- var HtmlEditor = defineComponent({
116303
+ var HtmlEditor = (0, components_exports.defineComponent)({
116419
116304
  name: "htmlEditor",
116420
116305
  tag: "gramlot-html-editor",
116421
116306
  base: HtmlControl,
@@ -116450,7 +116335,7 @@ function PreviewElement(HTMLElement2) {
116450
116335
  }
116451
116336
  };
116452
116337
  }
116453
- var HtmlPreview = defineComponent({
116338
+ var HtmlPreview = (0, components_exports.defineComponent)({
116454
116339
  name: "htmlPreview",
116455
116340
  tag: "gramlot-html-preview",
116456
116341
  base: PreviewElement,
@@ -116458,7 +116343,7 @@ var HtmlPreview = defineComponent({
116458
116343
  implementation: (Base) => class extends Base {
116459
116344
  }
116460
116345
  });
116461
- var MarkdownPreview = defineComponent({
116346
+ var MarkdownPreview = (0, components_exports.defineComponent)({
116462
116347
  name: "markdownPreview",
116463
116348
  tag: "gramlot-markdown-preview",
116464
116349
  base: PreviewElement,
@@ -116556,7 +116441,7 @@ function MarkdownControl(MarkdownElement) {
116556
116441
  };
116557
116442
  }
116558
116443
  MarkdownControl.parameters = { disabled: { dtype: "B", default: false, binding: "read" }, readonly: { dtype: "B", default: false, binding: "read" }, live: { dtype: "B", default: true, binding: "read" } };
116559
- var MarkdownEditor = defineComponent({
116444
+ var MarkdownEditor = (0, components_exports.defineComponent)({
116560
116445
  name: "markdownEditor",
116561
116446
  tag: "gramlot-markdown-editor",
116562
116447
  base: MarkdownControl,