@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
@@ -23,6 +23,7 @@ var __copyProps = (to, from, except, desc) => {
23
23
  }
24
24
  return to;
25
25
  };
26
+ var __reExport = (target, mod2, secondTarget) => (__copyProps(target, mod2, "default"), secondTarget && __copyProps(secondTarget, mod2, "default"));
26
27
  var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
27
28
  // If the importer is in node compatibility mode or this is not an ESM
28
29
  // file that has been converted to a CommonJS file using a Babel-
@@ -52,7 +53,7 @@ var require_conventions = __commonJS({
52
53
  }
53
54
  }
54
55
  }
55
- function freeze2(object, oc) {
56
+ function freeze(object, oc) {
56
57
  if (oc === void 0) {
57
58
  oc = Object;
58
59
  }
@@ -75,7 +76,7 @@ var require_conventions = __commonJS({
75
76
  }
76
77
  return target;
77
78
  }
78
- var HTML_BOOLEAN_ATTRIBUTES = freeze2({
79
+ var HTML_BOOLEAN_ATTRIBUTES = freeze({
79
80
  allowfullscreen: true,
80
81
  async: true,
81
82
  autofocus: true,
@@ -104,7 +105,7 @@ var require_conventions = __commonJS({
104
105
  function isHTMLBooleanAttribute(name) {
105
106
  return hasOwn(HTML_BOOLEAN_ATTRIBUTES, name.toLowerCase());
106
107
  }
107
- var HTML_VOID_ELEMENTS = freeze2({
108
+ var HTML_VOID_ELEMENTS = freeze({
108
109
  area: true,
109
110
  base: true,
110
111
  br: true,
@@ -123,7 +124,7 @@ var require_conventions = __commonJS({
123
124
  function isHTMLVoidElement(tagName) {
124
125
  return hasOwn(HTML_VOID_ELEMENTS, tagName.toLowerCase());
125
126
  }
126
- var HTML_RAW_TEXT_ELEMENTS = freeze2({
127
+ var HTML_RAW_TEXT_ELEMENTS = freeze({
127
128
  script: false,
128
129
  style: false,
129
130
  textarea: true,
@@ -143,7 +144,7 @@ var require_conventions = __commonJS({
143
144
  function hasDefaultHTMLNamespace(mimeType) {
144
145
  return isHTMLMimeType(mimeType) || mimeType === MIME_TYPE.XML_XHTML_APPLICATION;
145
146
  }
146
- var MIME_TYPE = freeze2({
147
+ var MIME_TYPE = freeze({
147
148
  /**
148
149
  * `text/html`, the only mime type that triggers treating an XML document as HTML.
149
150
  *
@@ -196,7 +197,7 @@ var require_conventions = __commonJS({
196
197
  function isValidMimeType(mimeType) {
197
198
  return _MIME_TYPES.indexOf(mimeType) > -1;
198
199
  }
199
- var NAMESPACE = freeze2({
200
+ var NAMESPACE = freeze({
200
201
  /**
201
202
  * The XHTML namespace.
202
203
  *
@@ -224,7 +225,7 @@ var require_conventions = __commonJS({
224
225
  });
225
226
  exports.assign = assign;
226
227
  exports.find = find;
227
- exports.freeze = freeze2;
228
+ exports.freeze = freeze;
228
229
  exports.HTML_BOOLEAN_ATTRIBUTES = HTML_BOOLEAN_ATTRIBUTES;
229
230
  exports.HTML_RAW_TEXT_ELEMENTS = HTML_RAW_TEXT_ELEMENTS;
230
231
  exports.HTML_VOID_ELEMENTS = HTML_VOID_ELEMENTS;
@@ -887,12 +888,12 @@ var require_dom = __commonJS({
887
888
  i++;
888
889
  }
889
890
  }
890
- function _nnmBucket(map, namespaceURI, create) {
891
+ function _nnmBucket(map, namespaceURI, create2) {
891
892
  if (!namespaceURI) {
892
893
  return map._noNsIndex;
893
894
  }
894
895
  var bucket = map._nsIndex[namespaceURI];
895
- if (!bucket && create) {
896
+ if (!bucket && create2) {
896
897
  bucket = map._nsIndex[namespaceURI] = /* @__PURE__ */ Object.create(null);
897
898
  }
898
899
  return bucket;
@@ -3278,15 +3279,15 @@ var require_dom = __commonJS({
3278
3279
  var require_entities = __commonJS({
3279
3280
  "node_modules/@xmldom/xmldom/lib/entities.js"(exports) {
3280
3281
  "use strict";
3281
- var freeze2 = require_conventions().freeze;
3282
- exports.XML_ENTITIES = freeze2({
3282
+ var freeze = require_conventions().freeze;
3283
+ exports.XML_ENTITIES = freeze({
3283
3284
  amp: "&",
3284
3285
  apos: "'",
3285
3286
  gt: ">",
3286
3287
  lt: "<",
3287
3288
  quot: '"'
3288
3289
  });
3289
- exports.HTML_ENTITIES = freeze2({
3290
+ exports.HTML_ENTITIES = freeze({
3290
3291
  Aacute: "\xC1",
3291
3292
  aacute: "\xE1",
3292
3293
  Abreve: "\u0102",
@@ -6511,151 +6512,22 @@ var require_lib = __commonJS({
6511
6512
  }
6512
6513
  });
6513
6514
 
6514
- // src/webcomponent.js
6515
- 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;
6516
- var RESERVED = /* @__PURE__ */ new Set([
6517
- "annotation-xml",
6518
- "color-profile",
6519
- "font-face",
6520
- "font-face-src",
6521
- "font-face-uri",
6522
- "font-face-format",
6523
- "font-face-name",
6524
- "missing-glyph"
6525
- ]);
6526
- function webcomponentCode(attrs) {
6527
- const code = attrs.code;
6528
- if (typeof code !== "string" || NAME.exec(code)?.[0] !== code || !code.includes("-") || RESERVED.has(code)) {
6529
- throw new TypeError("webcomponent: code must be a literal custom-element name");
6530
- }
6531
- return code;
6532
- }
6533
-
6534
- // src/components/registry.js
6535
- function freeze(value) {
6536
- for (const child of Object.values(value)) if (child && typeof child === "object") freeze(child);
6537
- return Object.freeze(value);
6538
- }
6539
- function annotation(parameter) {
6540
- if (typeof parameter.dtype !== "string" && !Array.isArray(parameter.dtype)) throw new TypeError("Component parameter requires dtype");
6541
- const alternatives = (Array.isArray(parameter.dtype) ? parameter.dtype : [parameter.dtype]).map((dtype) => ({ kind: "dtype", dtype }));
6542
- if (parameter.nullable) alternatives.push({ kind: "dtype", dtype: "NN" });
6543
- if (parameter.binding && parameter.dtype !== "T") alternatives.push({
6544
- kind: "annotated",
6545
- base: { kind: "dtype", dtype: "T" },
6546
- metadata: [{ kind: "regex", pattern: "^[\\^=].+", flags: 0 }]
6547
- });
6548
- return alternatives.length === 1 ? alternatives[0] : { kind: "union", items: alternatives };
6549
- }
6550
- function defineComponent({ name, tag: tag2, base, mixins = [], parameters: parameters2 = {}, subTags = "", presentationDefaults = [], dataScope = false, command = false, childParameters = {}, sourceContext = false, bagStore = false, dragSource = false, implementation }) {
6551
- webcomponentCode({ code: tag2 });
6552
- if (!/^[a-zA-Z][a-zA-Z0-9]*$/.test(name)) throw new TypeError("Invalid component authoring name");
6553
- const effective = { ...base.parameters };
6554
- for (const mixin of mixins) {
6555
- for (const [key, spec] of Object.entries(mixin.parameters)) {
6556
- if (Object.hasOwn(effective, key)) throw new Error(`Duplicate mixin parameter: ${key}`);
6557
- effective[key] = spec;
6558
- }
6559
- }
6560
- Object.assign(effective, parameters2);
6561
- for (const spec of Object.values(effective)) annotation(spec);
6562
- return Object.freeze({
6563
- name,
6564
- tag: tag2,
6565
- base,
6566
- subTags,
6567
- presentationDefaults: Object.freeze([...presentationDefaults]),
6568
- dataScope,
6569
- command,
6570
- bagStore,
6571
- mixins: Object.freeze([...mixins]),
6572
- parameters: freeze(structuredClone(effective)),
6573
- childParameters: freeze(structuredClone(childParameters)),
6574
- sourceContext,
6575
- dragSource,
6576
- implementation
6577
- });
6578
- }
6579
- var ComponentCollection = class {
6580
- #classes = /* @__PURE__ */ new WeakMap();
6581
- constructor({ name, components }) {
6582
- this.name = name;
6583
- this.components = Object.freeze([...components]);
6584
- const names = /* @__PURE__ */ new Set(), tags = /* @__PURE__ */ new Set();
6585
- for (const component of components) {
6586
- if (names.has(component.name.toLowerCase()) || tags.has(component.tag)) {
6587
- throw new Error(`Duplicate component: ${component.name}`);
6588
- }
6589
- names.add(component.name.toLowerCase());
6590
- tags.add(component.tag);
6591
- }
6592
- }
6593
- /** Same JSON consumed by Python and JavaScript Builders. */
6594
- toDocument() {
6595
- return {
6596
- document_format: { name: "builder_grammar", version: "1.1" },
6597
- grammar: { name: this.name, version: null, title: this.name, description: null },
6598
- abstracts: {},
6599
- elements: Object.fromEntries(this.components.map((component) => [component.name, {
6600
- doc: null,
6601
- sub_tags: component.subTags,
6602
- parent_tags: null,
6603
- inherits_from: null,
6604
- ns: null,
6605
- node_label: null,
6606
- collection_key: null,
6607
- attributes: {
6608
- parameters: [
6609
- ...Object.entries(component.parameters).map(([name, spec]) => ({
6610
- name,
6611
- kind: "keyword_only",
6612
- role: "attribute",
6613
- annotation: annotation(spec),
6614
- has_default: true,
6615
- default: spec.default ?? null
6616
- })),
6617
- {
6618
- name: "attr",
6619
- kind: "var_keyword",
6620
- role: "attribute",
6621
- annotation: { kind: "any" },
6622
- has_default: false
6623
- }
6624
- ],
6625
- accepts_var_keyword: true,
6626
- accepts_var_positional: false
6627
- },
6628
- _meta: { render_tag: component.tag, gramlot_component: {
6629
- parameters: structuredClone(component.parameters),
6630
- presentationDefaults: [...component.presentationDefaults],
6631
- dataScope: component.dataScope,
6632
- command: component.command,
6633
- ...Object.keys(component.childParameters).length ? { childParameters: structuredClone(component.childParameters) } : {},
6634
- ...component.sourceContext ? { sourceContext: true } : {},
6635
- ...component.dragSource ? { dragSource: true } : {},
6636
- ...component.bagStore ? { bagStore: true } : {}
6637
- } }
6638
- }]))
6639
- };
6640
- }
6641
- /** Register once per document realm, only when the collection is activated. */
6642
- register(window2) {
6643
- if (this.#classes.has(window2)) return;
6644
- const classes2 = [];
6645
- for (const component of this.components) {
6646
- if (window2.customElements.get(component.tag)) throw new Error(`Custom element already registered: ${component.tag}`);
6647
- let Base = component.base(window2.HTMLElement);
6648
- for (const mixin of component.mixins) Base = mixin(Base);
6649
- const Class = component.implementation(Base);
6650
- Object.defineProperty(Class, "gramlotComponent", { value: component });
6651
- classes2.push([component.tag, Class]);
6652
- }
6653
- for (const [tag2, Class] of classes2) window2.customElements.define(tag2, Class);
6654
- this.#classes.set(window2, classes2);
6655
- }
6656
- };
6515
+ // collection-authoring:@gramlot/gramlot/components
6516
+ var components_exports = {};
6517
+ __export(components_exports, {
6518
+ defineCollection: () => defineCollection
6519
+ });
6520
+ __reExport(components_exports, components_star);
6521
+ import * as components_star from "@gramlot/gramlot/components";
6522
+ import { defineCollection as create } from "@gramlot/gramlot/components";
6657
6523
  function defineCollection(options) {
6658
- return new ComponentCollection(options);
6524
+ if (options.name !== "inputs") throw new Error("Unexpected bundled collection");
6525
+ const css = [], assets = {};
6526
+ options.css?.forEach((url, index) => {
6527
+ url.href = css[index].href;
6528
+ });
6529
+ for (const [key, url] of Object.entries(options.assets ?? {})) url.href = assets[key].href;
6530
+ return create({ ...options, css, assets });
6659
6531
  }
6660
6532
 
6661
6533
  // src/components/parameters.js
@@ -6689,7 +6561,7 @@ function controlElement(HTMLElement) {
6689
6561
  style.textContent = `:host{display:inline-block;font:inherit} *,*::before,*::after{box-sizing:border-box}
6690
6562
  input,textarea{font:inherit;max-width:100%} .control-box{min-width:0;color:var(--gramlot-ink,CanvasText)}
6691
6563
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),textarea{
6692
- appearance:none;box-sizing:border-box;border:1px solid var(--gramlot-border-control,#7a8798);
6564
+ appearance:none;box-sizing:border-box;width:100%;border:1px solid var(--gramlot-border-control,#7a8798);
6693
6565
  border-radius:var(--gramlot-radius-sm,4px);background:var(--gramlot-field-background,Canvas);color:var(--gramlot-ink,CanvasText);
6694
6566
  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)}
6695
6567
  input:read-only:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),textarea:read-only{
@@ -9991,11 +9863,11 @@ var MAX_POWER = 1e6;
9991
9863
  var NE = -7;
9992
9864
  var PE = 21;
9993
9865
  var STRICT = false;
9994
- var NAME2 = "[big.js] ";
9995
- var INVALID = NAME2 + "Invalid ";
9866
+ var NAME = "[big.js] ";
9867
+ var INVALID = NAME + "Invalid ";
9996
9868
  var INVALID_DP = INVALID + "decimal places";
9997
9869
  var INVALID_RM = INVALID + "rounding mode";
9998
- var DIV_BY_ZERO = NAME2 + "Division by zero";
9870
+ var DIV_BY_ZERO = NAME + "Division by zero";
9999
9871
  var P2 = {};
10000
9872
  var UNDEFINED = void 0;
10001
9873
  var NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
@@ -10361,7 +10233,7 @@ P2.sqrt = function() {
10361
10233
  var r, c, t, x = this, Big2 = x.constructor, s = x.s, e = x.e, half = new Big2("0.5");
10362
10234
  if (!x.c[0]) return new Big2(x);
10363
10235
  if (s < 0) {
10364
- throw Error(NAME2 + "No square root");
10236
+ throw Error(NAME + "No square root");
10365
10237
  }
10366
10238
  s = Math.sqrt(+stringify(x, true, true));
10367
10239
  if (s === 0 || s === 1 / 0) {
@@ -10441,7 +10313,7 @@ P2[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")] = P2.toJSON = P2.to
10441
10313
  P2.toNumber = function() {
10442
10314
  var n = +stringify(this, true, true);
10443
10315
  if (this.constructor.strict === true && !this.eq(n.toString())) {
10444
- throw Error(NAME2 + "Imprecise conversion");
10316
+ throw Error(NAME + "Imprecise conversion");
10445
10317
  }
10446
10318
  return n;
10447
10319
  };
@@ -10459,7 +10331,7 @@ P2.toPrecision = function(sd, rm) {
10459
10331
  P2.valueOf = function() {
10460
10332
  var x = this, Big2 = x.constructor;
10461
10333
  if (Big2.strict === true) {
10462
- throw Error(NAME2 + "valueOf disallowed");
10334
+ throw Error(NAME + "valueOf disallowed");
10463
10335
  }
10464
10336
  return stringify(x, x.e <= Big2.NE || x.e >= Big2.PE, true);
10465
10337
  };
@@ -16795,7 +16667,7 @@ function pythonRegexPattern(pattern, flags) {
16795
16667
  }
16796
16668
  return result;
16797
16669
  }
16798
- function annotation2(desc, path, nested = false, customTypes = null) {
16670
+ function annotation(desc, path, nested = false, customTypes = null) {
16799
16671
  if (desc === null) return null;
16800
16672
  exactKeys(desc, ["kind", "dtype", "module", "name", "origin", "arguments", "items", "values", "base", "metadata", "pattern", "flags", "ge", "le", "gt", "lt", "value"], ["kind"], path);
16801
16673
  switch (desc.kind) {
@@ -16834,7 +16706,7 @@ function annotation2(desc, path, nested = false, customTypes = null) {
16834
16706
  }
16835
16707
  case "union": {
16836
16708
  if (!Array.isArray(desc.items) || !desc.items.length) fail2(path, "union items must be non-empty");
16837
- const items = desc.items.map((v, i) => annotation2(v, `${path}.items[${i}]`, true, customTypes));
16709
+ const items = desc.items.map((v, i) => annotation(v, `${path}.items[${i}]`, true, customTypes));
16838
16710
  return { ...desc, items, inputConstraint: items.some((x) => x.inputConstraint), test: (v) => items.some((x) => x.test && x.test(v)) };
16839
16711
  }
16840
16712
  case "literal":
@@ -16844,8 +16716,8 @@ function annotation2(desc, path, nested = false, customTypes = null) {
16844
16716
  case "annotated": {
16845
16717
  if (!Array.isArray(desc.metadata)) fail2(path, "annotated metadata must be an array");
16846
16718
  if (desc.metadata.some((v) => !["regex", "range", "value"].includes(v?.kind))) fail2(path, "unsupported annotation metadata kind");
16847
- const base = annotation2(desc.base, `${path}.base`, true, customTypes);
16848
- const metadata = desc.metadata.map((v, i) => annotation2(v, `${path}.metadata[${i}]`, true, customTypes));
16719
+ const base = annotation(desc.base, `${path}.base`, true, customTypes);
16720
+ const metadata = desc.metadata.map((v, i) => annotation(v, `${path}.metadata[${i}]`, true, customTypes));
16849
16721
  return { ...desc, base, metadata, inputConstraint: base.inputConstraint, test: (v) => base.test(v) && metadata.every((x) => !x.test || x.test(v)) };
16850
16722
  }
16851
16723
  case "range": {
@@ -16877,12 +16749,12 @@ function annotation2(desc, path, nested = false, customTypes = null) {
16877
16749
  jsonValue(desc.value, `${path}.value`);
16878
16750
  return { ...desc };
16879
16751
  case "generic": {
16880
- const origin = annotation2(desc.origin, `${path}.origin`, true, customTypes);
16752
+ const origin = annotation(desc.origin, `${path}.origin`, true, customTypes);
16881
16753
  if (desc.origin?.kind !== "type" || desc.origin.module !== "builtins" || !["list", "dict", "tuple", "set"].includes(desc.origin.name)) {
16882
16754
  fail2(path, "only list, dict, tuple and set generic origins are supported");
16883
16755
  }
16884
16756
  if (!Array.isArray(desc.arguments)) fail2(path, "generic arguments must be an array");
16885
- const args = desc.arguments.map((v, i) => annotation2(v, `${path}.arguments[${i}]`, true, customTypes));
16757
+ const args = desc.arguments.map((v, i) => annotation(v, `${path}.arguments[${i}]`, true, customTypes));
16886
16758
  return { ...desc, origin, arguments: args, inputConstraint: args.some((x) => x.inputConstraint), test: (v) => origin.test(v) && genericItems(desc.origin, args, v) };
16887
16759
  }
16888
16760
  case "arguments":
@@ -16967,7 +16839,7 @@ function parameters(value, path, customTypes) {
16967
16839
  if (p.has_default) jsonValue(p.default, `${pp}.default`);
16968
16840
  foundVarKeyword ||= p.kind === "var_keyword";
16969
16841
  foundVarPositional ||= p.kind === "var_positional";
16970
- return { ...p, annotation: annotation2(p.annotation, `${pp}.annotation`, false, customTypes) };
16842
+ return { ...p, annotation: annotation(p.annotation, `${pp}.annotation`, false, customTypes) };
16971
16843
  });
16972
16844
  if (foundVarKeyword !== value.accepts_var_keyword || foundVarPositional !== value.accepts_var_positional) {
16973
16845
  fail2(path, "variadic summary flags do not match parameters");
@@ -17109,7 +16981,7 @@ var CustomTypes = class _CustomTypes {
17109
16981
  }
17110
16982
  jsonValue(definition, `custom_types.${name}`);
17111
16983
  const copy = structuredClone(definition);
17112
- const compiled = annotation2(copy, `custom_types.${name}`);
16984
+ const compiled = annotation(copy, `custom_types.${name}`);
17113
16985
  const reference = Object.freeze({ kind: "custom", name });
17114
16986
  Object.defineProperty(this, name, { value: reference, enumerable: true });
17115
16987
  this.#definitions.set(name, copy);
@@ -23128,14 +23000,26 @@ var SVG_NS = "http://www.w3.org/2000/svg";
23128
23000
  // src/components/popup.js
23129
23001
  var VIEWPORT_MARGIN = 8;
23130
23002
  var ANCHOR_GAP = 3;
23131
- function positionPopup(popup, anchor, { align = "start", matchWidth = false, inset = 0 } = {}) {
23003
+ function positionPopup(popup, anchor, { align = "start", matchWidth = false, inset = 0, placement = "bottom", point = null } = {}) {
23132
23004
  const view = anchor.ownerDocument.defaultView;
23133
- const field = anchor.getBoundingClientRect();
23005
+ const field = point ? { left: point.x, right: point.x, top: point.y, bottom: point.y, width: 0 } : anchor.getBoundingClientRect();
23134
23006
  const availableWidth = Math.max(0, view.innerWidth - 2 * VIEWPORT_MARGIN);
23135
23007
  popup.style.setProperty("--gramlot-popup-available-width", `${availableWidth}px`);
23136
23008
  if (matchWidth) popup.style.width = `${Math.min(Math.max(0, field.width - 2 * inset), availableWidth)}px`;
23137
23009
  popup.style.removeProperty("--gramlot-popup-available-height");
23138
23010
  const natural = popup.getBoundingClientRect();
23011
+ if (placement === "side") {
23012
+ const right = Math.max(0, view.innerWidth - VIEWPORT_MARGIN - field.right - ANCHOR_GAP);
23013
+ const left2 = Math.max(0, field.left - VIEWPORT_MARGIN - ANCHOR_GAP);
23014
+ const opensLeft = natural.width > right && left2 > right;
23015
+ popup.style.setProperty("--gramlot-popup-available-width", `${opensLeft ? left2 : right}px`);
23016
+ popup.style.setProperty("--gramlot-popup-available-height", `${Math.max(0, view.innerHeight - 2 * VIEWPORT_MARGIN)}px`);
23017
+ const size2 = popup.getBoundingClientRect();
23018
+ const x = opensLeft ? field.left - size2.width - ANCHOR_GAP : field.right + ANCHOR_GAP;
23019
+ popup.style.left = `${Math.max(VIEWPORT_MARGIN, Math.min(x, view.innerWidth - size2.width - VIEWPORT_MARGIN))}px`;
23020
+ popup.style.top = `${Math.max(VIEWPORT_MARGIN, Math.min(field.top, view.innerHeight - size2.height - VIEWPORT_MARGIN))}px`;
23021
+ return;
23022
+ }
23139
23023
  const below = Math.max(0, view.innerHeight - VIEWPORT_MARGIN - field.bottom - ANCHOR_GAP);
23140
23024
  const above = Math.max(0, field.top - VIEWPORT_MARGIN - ANCHOR_GAP);
23141
23025
  const upwards = natural.height > below && above > below;
@@ -23497,6 +23381,7 @@ var timeEditor = (Base) => class extends Base {
23497
23381
  };
23498
23382
 
23499
23383
  // src/components/validation.js
23384
+ import { Bag as Bag2 } from "@gramlot/gramlot";
23500
23385
  var validationRules = ["select", "notnull", "empty", "case", "len", "min", "max", "email", "regex", "call", "remote"];
23501
23386
  var deferredRules = ["nodup", "exist", "gridnodup"];
23502
23387
  var empty = (value) => value == null || value === "";
@@ -23518,7 +23403,7 @@ function validateInput(value, parameters2, context = {}) {
23518
23403
  if (output == null || output === true) return;
23519
23404
  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.");
23520
23405
  const prefix = `validate_${rule}`;
23521
- const response = output instanceof Bag ? Object.fromEntries(output.getNodes().map((node) => [node.label, node.value])) : typeof output === "object" ? output : { errorcode: output === false ? "error" : output };
23406
+ const response = output instanceof Bag2 ? Object.fromEntries(output.getNodes().map((node) => [node.label, node.value])) : typeof output === "object" ? output : { errorcode: output === false ? "error" : output };
23522
23407
  if (Object.hasOwn(response, "value")) {
23523
23408
  result.modified ||= !Object.is(result.value, response.value);
23524
23409
  result.value = response.value;
@@ -23852,6 +23737,7 @@ function FieldState(Base) {
23852
23737
  FieldState.parameters = validationParameters;
23853
23738
 
23854
23739
  // src/components/choice-editor.js
23740
+ import { Bag as Bag3 } from "@gramlot/gramlot";
23855
23741
  function ChoiceEditor(HTMLElement) {
23856
23742
  return class extends NativeControl(HTMLElement) {
23857
23743
  #value;
@@ -23864,6 +23750,8 @@ function ChoiceEditor(HTMLElement) {
23864
23750
  #source;
23865
23751
  #separator;
23866
23752
  #cleanup;
23753
+ #requestController;
23754
+ #searchTimer;
23867
23755
  constructor() {
23868
23756
  super();
23869
23757
  const doc = this.ownerDocument;
@@ -23874,6 +23762,7 @@ function ChoiceEditor(HTMLElement) {
23874
23762
  .choices{max-width:var(--gramlot-popup-available-width,100vw);position:fixed;inset:auto;margin:0;padding:var(--gramlot-popup-padding,4px);box-sizing:border-box;max-height:min(var(--gramlot-choice-max-height,12rem),var(--gramlot-popup-available-height,100vh));overflow:auto;
23875
23763
  border:1px solid var(--gramlot-border-control,#aab4c2);border-radius:var(--gramlot-radius-sm,4px);background:var(--gramlot-surface,Canvas);color:var(--gramlot-ink,CanvasText);font:inherit;box-shadow:var(--gramlot-shadow,0 3px 9px #0002)}
23876
23764
  .choices[hidden]{display:none} .choice{min-height:var(--gramlot-touch-target,0px);display:flex;align-items:center;padding:.25em .5em;cursor:pointer}
23765
+ .choice-detail{margin-inline-start:var(--gramlot-space-3,.75rem);color:var(--gramlot-text-secondary,GrayText)}
23877
23766
  .choice[aria-selected=true]{background:var(--gramlot-selected,Highlight);color:var(--gramlot-ink,HighlightText)}`;
23878
23767
  this.toggle = doc.createElement("button");
23879
23768
  this.toggle.className = "toggle";
@@ -23900,9 +23789,9 @@ function ChoiceEditor(HTMLElement) {
23900
23789
  this.control.addEventListener("input", (event) => {
23901
23790
  this.#dirty = true;
23902
23791
  this.#picked = null;
23903
- if (!event.isComposing) this.search(this.control.value);
23792
+ if (!event.isComposing) this.scheduleSearch(this.control.value);
23904
23793
  });
23905
- this.control.addEventListener("compositionend", () => this.search(this.control.value));
23794
+ this.control.addEventListener("compositionend", () => this.scheduleSearch(this.control.value));
23906
23795
  this.control.addEventListener("keydown", (event) => {
23907
23796
  if (event.isComposing || this.locked) return;
23908
23797
  if (event.key === "ArrowDown" || event.key === "ArrowUp") {
@@ -23938,6 +23827,30 @@ function ChoiceEditor(HTMLElement) {
23938
23827
  get constrained() {
23939
23828
  return true;
23940
23829
  }
23830
+ get choiceSource() {
23831
+ return this.parameters.store ?? this.parameters.callback ?? this.parameters.values;
23832
+ }
23833
+ get searchDelay() {
23834
+ return 0;
23835
+ }
23836
+ textValue(text2) {
23837
+ return text2;
23838
+ }
23839
+ selectionAccepted(row) {
23840
+ }
23841
+ selectionResolved(row) {
23842
+ }
23843
+ renderChoice(row, item) {
23844
+ item.textContent = row.caption;
23845
+ }
23846
+ scheduleSearch(query) {
23847
+ this.closeChoices();
23848
+ if (!this.searchDelay) return this.search(query);
23849
+ this.#searchTimer = setTimeout(() => {
23850
+ this.#searchTimer = null;
23851
+ this.search(query);
23852
+ }, this.searchDelay);
23853
+ }
23941
23854
  get commitOnChange() {
23942
23855
  return this.constrained;
23943
23856
  }
@@ -23949,11 +23862,15 @@ function ChoiceEditor(HTMLElement) {
23949
23862
  }
23950
23863
  projectAttributes(attrs, adapt) {
23951
23864
  const rest = super.projectAttributes(attrs, adapt);
23952
- const source = this.parameters.store ?? this.parameters.callback ?? this.parameters.values;
23865
+ const source = this.choiceSource;
23953
23866
  const changed = source !== this.#source || this.parameters.separator !== this.#separator;
23954
23867
  this.#separator = this.parameters.separator;
23955
23868
  this.#source = source;
23956
23869
  this.toggle.disabled = this.locked;
23870
+ if (changed) {
23871
+ this.#rows = [];
23872
+ this.#picked = null;
23873
+ }
23957
23874
  if (changed || this.locked) this.closeChoices();
23958
23875
  if (changed && this.active && !this.#dirty) this.resolveValue();
23959
23876
  return rest;
@@ -23989,13 +23906,14 @@ function ChoiceEditor(HTMLElement) {
23989
23906
  this.error("Choose a value from the list.");
23990
23907
  return { ok: false };
23991
23908
  }
23992
- const value = this.constrained ? text2 === "" ? null : matches[0].id : text2;
23909
+ const value = this.constrained ? text2 === "" ? null : matches[0].id : this.textValue(text2);
23993
23910
  return this.validateCandidate(value, (accepted) => {
23994
23911
  if (accepted !== value && this.constrained) throw new Error("Validation cannot replace a selected code; update the Data explicitly.");
23995
23912
  this.#value = accepted;
23996
23913
  this.#dirty = false;
23997
23914
  this.#picked = null;
23998
23915
  if (!this.constrained) this.control.value = accepted ?? "";
23916
+ this.selectionAccepted(matches.length === 1 && accepted === value ? matches[0] : null);
23999
23917
  });
24000
23918
  }
24001
23919
  commitDraft() {
@@ -24011,30 +23929,38 @@ function ChoiceEditor(HTMLElement) {
24011
23929
  this.commitDraft();
24012
23930
  }
24013
23931
  async request(keywords) {
23932
+ this.#requestController?.abort();
23933
+ const controller = new AbortController();
23934
+ this.#requestController = controller;
24014
23935
  const generation = ++this.#generation;
24015
23936
  this.control.setAttribute("aria-busy", "true");
24016
23937
  this.error("");
24017
23938
  try {
24018
- const rows = await this.loadChoices(keywords);
23939
+ const rows = await this.loadChoices(keywords, controller.signal);
24019
23940
  if (generation !== this.#generation || !this.active) return null;
24020
23941
  return rows;
24021
23942
  } catch (error) {
24022
23943
  if (generation === this.#generation && this.active) this.error(error.message);
24023
23944
  return null;
24024
23945
  } finally {
24025
- if (generation === this.#generation) this.control.setAttribute("aria-busy", "false");
23946
+ if (generation === this.#generation) {
23947
+ this.#requestController = null;
23948
+ this.control.setAttribute("aria-busy", "false");
23949
+ }
24026
23950
  }
24027
23951
  }
24028
23952
  async resolveValue() {
24029
23953
  if (this.#value == null || this.#value === "") {
24030
23954
  this.control.value = "";
24031
23955
  this.error("");
23956
+ if (this.active) this.selectionResolved(null);
24032
23957
  return;
24033
23958
  }
24034
23959
  if (!this.active) return;
24035
23960
  this.control.value = this.#value;
24036
23961
  if (!this.constrained) {
24037
23962
  this.error("");
23963
+ this.selectionResolved(null);
24038
23964
  return;
24039
23965
  }
24040
23966
  const rows = await this.request({ _id: this.#value });
@@ -24043,6 +23969,7 @@ function ChoiceEditor(HTMLElement) {
24043
23969
  this.#rows = rows;
24044
23970
  this.control.value = row ? row.caption : this.#value;
24045
23971
  this.error(row ? "" : "Value is not in the list.");
23972
+ this.selectionResolved(row ?? null);
24046
23973
  }
24047
23974
  async search(query) {
24048
23975
  if (this.locked || !this.active) return;
@@ -24057,7 +23984,7 @@ function ChoiceEditor(HTMLElement) {
24057
23984
  item.id = `choice-${index}`;
24058
23985
  item.className = "choice";
24059
23986
  item.setAttribute("role", "option");
24060
- item.textContent = row.caption;
23987
+ this.renderChoice(row, item);
24061
23988
  item.addEventListener("click", () => this.choose(row));
24062
23989
  return item;
24063
23990
  }));
@@ -24096,6 +24023,10 @@ function ChoiceEditor(HTMLElement) {
24096
24023
  else this.control.setAttribute("aria-activedescendant", `choice-${this.#active}`);
24097
24024
  }
24098
24025
  closeChoices() {
24026
+ clearTimeout(this.#searchTimer);
24027
+ this.#searchTimer = null;
24028
+ this.#requestController?.abort();
24029
+ this.#requestController = null;
24099
24030
  ++this.#generation;
24100
24031
  this.#cleanup?.();
24101
24032
  this.#cleanup = null;
@@ -24124,7 +24055,7 @@ function localChoices(Base) {
24124
24055
  loadChoices(keywords) {
24125
24056
  let rows;
24126
24057
  if (this.parameters.store != null) {
24127
- if (!(this.parameters.store instanceof Bag)) throw new TypeError("store must be a Bag");
24058
+ if (!(this.parameters.store instanceof Bag3)) throw new TypeError("store must be a Bag");
24128
24059
  if (this.parameters.values) throw new TypeError("store and values are mutually exclusive");
24129
24060
  const ids = /* @__PURE__ */ new Set();
24130
24061
  rows = this.parameters.store.getNodes().map((node) => {
@@ -24156,8 +24087,136 @@ function callbackChoices(Base) {
24156
24087
  };
24157
24088
  }
24158
24089
 
24090
+ // src/components/database-choices.js
24091
+ var databaseParameters = {
24092
+ dbtable: { dtype: "T", binding: "read" },
24093
+ method: { dtype: "T", default: "dbSelect", binding: "read" },
24094
+ columns: { dtype: "T", binding: "read" },
24095
+ hiddenColumns: { dtype: "T", binding: "read" },
24096
+ order_by: { dtype: "T", binding: "read" },
24097
+ limit: { dtype: "L", default: 10, binding: "read" },
24098
+ searchDelay: { dtype: "L", default: 300, binding: "read" },
24099
+ ignoreCase: { dtype: "B", default: true, binding: "read" },
24100
+ hasDownArrow: { dtype: "B", default: true, binding: "read" },
24101
+ emptyLabel: { dtype: "T", default: "", binding: "read" },
24102
+ selectedCaption: { dtype: "T" },
24103
+ selectedRecord: { dtype: "T" },
24104
+ selectedCb: { dtype: "T" }
24105
+ };
24106
+ var requestParameters = ["dbtable", "method", "columns", "hiddenColumns", "order_by", "limit", "ignoreCase"];
24107
+ function databaseChoices(Base) {
24108
+ return class extends Base {
24109
+ #configuration = {};
24110
+ #outputs = {};
24111
+ #revision = 0;
24112
+ #acceptedRow;
24113
+ get choiceSource() {
24114
+ return this.#revision;
24115
+ }
24116
+ get searchDelay() {
24117
+ return this.parameters.searchDelay;
24118
+ }
24119
+ // Database writes wait for a complete choice/free-text edit, even with live=True.
24120
+ get commitOnChange() {
24121
+ return true;
24122
+ }
24123
+ textValue(text2) {
24124
+ return text2 === "" ? null : text2;
24125
+ }
24126
+ projectAttributes(attrs, adapt) {
24127
+ const configuration = Object.fromEntries(Object.entries(attrs).filter(([key]) => requestParameters.includes(key) || key === "autoSelect" || key.startsWith("condition_")));
24128
+ const keys = /* @__PURE__ */ new Set([...Object.keys(configuration), ...Object.keys(this.#configuration)]);
24129
+ if ([...keys].some((key) => !Object.is(configuration[key], this.#configuration[key]))) {
24130
+ this.cancelValidation();
24131
+ this.#acceptedRow = void 0;
24132
+ this.#configuration = configuration;
24133
+ this.#revision++;
24134
+ }
24135
+ this.#outputs = Object.fromEntries(Object.entries(attrs).filter(([key]) => key.startsWith("selected_")));
24136
+ const rest = super.projectAttributes(attrs, adapt);
24137
+ const { limit, searchDelay, hasDownArrow, emptyLabel } = this.parameters;
24138
+ if (!Number.isInteger(limit) || limit < 1) throw new TypeError("limit must be a positive integer.");
24139
+ if (!Number.isInteger(searchDelay) || searchDelay < 0) throw new TypeError("searchDelay must be a non-negative integer.");
24140
+ this.toggle.hidden = !hasDownArrow;
24141
+ this.control.style.paddingRight = hasDownArrow ? "" : "var(--gramlot-field-padding, .25em)";
24142
+ if (!this.parameters.placeholder) this.control.placeholder = emptyLabel;
24143
+ for (const key of Object.keys(rest)) if (key.startsWith("condition_") || key.startsWith("selected_")) delete rest[key];
24144
+ return rest;
24145
+ }
24146
+ async loadChoices(keywords, signal) {
24147
+ const parameters2 = Object.fromEntries(requestParameters.filter((key) => key !== "method" && this.parameters[key] != null).map((key) => [key, this.parameters[key]]));
24148
+ for (const [key, value] of Object.entries(this.#configuration)) {
24149
+ if (key.startsWith("condition_")) {
24150
+ const name = key.slice(10);
24151
+ if (!name || name.startsWith("_") || requestParameters.includes(name)) throw new TypeError("Invalid condition parameter.");
24152
+ parameters2[name] = value;
24153
+ }
24154
+ }
24155
+ const result = await this.pageContext.remote(this.parameters.method, { ...parameters2, ...keywords }, signal);
24156
+ if (!result || !Array.isArray(result.rows) || typeof result.identifier !== "string" || typeof result.caption !== "string") {
24157
+ throw new TypeError("Database selectors require {rows, identifier, caption}.");
24158
+ }
24159
+ const ids = /* @__PURE__ */ new Set();
24160
+ return result.rows.map((record2) => {
24161
+ const id = record2[result.identifier], caption = record2[result.caption];
24162
+ if (!(typeof id === "string" && id.length || Number.isSafeInteger(id)) || typeof caption !== "string" || ids.has(id)) {
24163
+ throw new TypeError("Invalid or duplicate database choice identity/caption.");
24164
+ }
24165
+ ids.add(id);
24166
+ return { id, caption, record: record2, captionField: result.caption };
24167
+ });
24168
+ }
24169
+ selectionAccepted(row) {
24170
+ this.#acceptedRow = row;
24171
+ }
24172
+ renderChoice(row, item) {
24173
+ super.renderChoice(row, item);
24174
+ for (const name of (this.parameters.columns ?? "").split(",").map((name2) => name2.trim()).filter((name2) => name2 && name2 !== row.captionField)) {
24175
+ const detail = this.ownerDocument.createElement("span");
24176
+ detail.className = "choice-detail";
24177
+ detail.textContent = row.record[name] ?? "";
24178
+ item.append(detail);
24179
+ }
24180
+ }
24181
+ selectionResolved(row) {
24182
+ this.#writeOutputs(row);
24183
+ }
24184
+ #writeOutputs(row) {
24185
+ const { selectedCaption, selectedRecord } = this.parameters;
24186
+ this.pageContext.selectionOutputs({ selectedCaption, selectedRecord, fields: this.#outputs }, row);
24187
+ }
24188
+ finishValidation(outcome) {
24189
+ if (outcome.ok && this.#acceptedRow !== void 0) {
24190
+ const row = this.#acceptedRow;
24191
+ this.#acceptedRow = void 0;
24192
+ this.#writeOutputs(row);
24193
+ if (this.parameters.selectedCb) {
24194
+ const report = (error) => console.error("Selection notification failed:", error);
24195
+ try {
24196
+ const result = this.pageContext.callLogic(
24197
+ this.parameters.selectedCb,
24198
+ { value: outcome.value, record: row?.record ?? null }
24199
+ );
24200
+ if (result instanceof Promise) result.catch(report);
24201
+ } catch (error) {
24202
+ report(error);
24203
+ }
24204
+ }
24205
+ }
24206
+ super.finishValidation(outcome);
24207
+ }
24208
+ async resolveValue() {
24209
+ await super.resolveValue();
24210
+ if (this.active && !this.locked && this.parameters.autoSelect && this.readControlValue() == null) {
24211
+ const rows = await this.request({ _querystring: "", limit: 2 });
24212
+ if (rows?.length === 1 && this.readControlValue() == null && !this.locked) this.choose(rows[0]);
24213
+ }
24214
+ }
24215
+ };
24216
+ }
24217
+
24159
24218
  // src/components/inputs.js
24160
- var Textbox = defineComponent({
24219
+ var Textbox = (0, components_exports.defineComponent)({
24161
24220
  name: "textbox",
24162
24221
  tag: "gramlot-textbox",
24163
24222
  base: NativeControl,
@@ -24168,7 +24227,7 @@ var Textbox = defineComponent({
24168
24227
  },
24169
24228
  implementation: textEditor("input", "text")
24170
24229
  });
24171
- var Checkbox = defineComponent({
24230
+ var Checkbox = (0, components_exports.defineComponent)({
24172
24231
  name: "checkbox",
24173
24232
  tag: "gramlot-checkbox",
24174
24233
  base: NativeControl,
@@ -24222,7 +24281,7 @@ var Checkbox = defineComponent({
24222
24281
  }
24223
24282
  }
24224
24283
  });
24225
- var RadioButtonText = defineComponent({
24284
+ var RadioButtonText = (0, components_exports.defineComponent)({
24226
24285
  name: "radioButtonText",
24227
24286
  tag: "gramlot-radio-button-text",
24228
24287
  base: ChoiceGroup,
@@ -24256,7 +24315,7 @@ function textEditor(tag2, type) {
24256
24315
  }
24257
24316
  };
24258
24317
  }
24259
- var TextBoxArea = defineComponent({
24318
+ var TextBoxArea = (0, components_exports.defineComponent)({
24260
24319
  name: "textBoxArea",
24261
24320
  tag: "gramlot-text-box-area",
24262
24321
  base: NativeControl,
@@ -24269,7 +24328,7 @@ var TextBoxArea = defineComponent({
24269
24328
  },
24270
24329
  implementation: textEditor("textarea")
24271
24330
  });
24272
- var Passwordbox = defineComponent({
24331
+ var Passwordbox = (0, components_exports.defineComponent)({
24273
24332
  name: "passwordbox",
24274
24333
  tag: "gramlot-passwordbox",
24275
24334
  base: NativeControl,
@@ -24280,7 +24339,7 @@ var Passwordbox = defineComponent({
24280
24339
  },
24281
24340
  implementation: textEditor("input", "password")
24282
24341
  });
24283
- var RadioButton = defineComponent({
24342
+ var RadioButton = (0, components_exports.defineComponent)({
24284
24343
  name: "radioButton",
24285
24344
  tag: "gramlot-radio-button",
24286
24345
  base: NativeControl,
@@ -24304,7 +24363,7 @@ var RadioButton = defineComponent({
24304
24363
  }
24305
24364
  }
24306
24365
  });
24307
- var Colorpicker = defineComponent({
24366
+ var Colorpicker = (0, components_exports.defineComponent)({
24308
24367
  name: "colorpicker",
24309
24368
  tag: "gramlot-colorpicker",
24310
24369
  base: NativeControl,
@@ -24359,7 +24418,7 @@ function rangeEditor(vertical) {
24359
24418
  }
24360
24419
  };
24361
24420
  }
24362
- var HorizontalSlider = defineComponent({
24421
+ var HorizontalSlider = (0, components_exports.defineComponent)({
24363
24422
  name: "horizontalSlider",
24364
24423
  tag: "gramlot-horizontal-slider",
24365
24424
  base: NativeControl,
@@ -24368,7 +24427,7 @@ var HorizontalSlider = defineComponent({
24368
24427
  sourceContext: true,
24369
24428
  implementation: rangeEditor(false)
24370
24429
  });
24371
- var VerticalSlider = defineComponent({
24430
+ var VerticalSlider = (0, components_exports.defineComponent)({
24372
24431
  name: "verticalSlider",
24373
24432
  tag: "gramlot-vertical-slider",
24374
24433
  base: NativeControl,
@@ -24377,7 +24436,7 @@ var VerticalSlider = defineComponent({
24377
24436
  sourceContext: true,
24378
24437
  implementation: rangeEditor(true)
24379
24438
  });
24380
- var NumberTextBox = defineComponent({
24439
+ var NumberTextBox = (0, components_exports.defineComponent)({
24381
24440
  name: "numberTextBox",
24382
24441
  tag: "gramlot-number-text-box",
24383
24442
  base: TypedEditor,
@@ -24390,7 +24449,7 @@ var NumberTextBox = defineComponent({
24390
24449
  },
24391
24450
  implementation: numberEditor
24392
24451
  });
24393
- var DateTextBox = defineComponent({
24452
+ var DateTextBox = (0, components_exports.defineComponent)({
24394
24453
  name: "dateTextBox",
24395
24454
  tag: "gramlot-date-text-box",
24396
24455
  base: TypedEditor,
@@ -24402,7 +24461,7 @@ var DateTextBox = defineComponent({
24402
24461
  },
24403
24462
  implementation: dateEditor
24404
24463
  });
24405
- var DateCalendar = defineComponent({
24464
+ var DateCalendar = (0, components_exports.defineComponent)({
24406
24465
  name: "dateCalendar",
24407
24466
  tag: "gramlot-date-calendar",
24408
24467
  base: CalendarControl,
@@ -24411,7 +24470,7 @@ var DateCalendar = defineComponent({
24411
24470
  implementation: (Base) => class extends Base {
24412
24471
  }
24413
24472
  });
24414
- var TimeTextBox = defineComponent({
24473
+ var TimeTextBox = (0, components_exports.defineComponent)({
24415
24474
  name: "timeTextBox",
24416
24475
  tag: "gramlot-time-text-box",
24417
24476
  base: TypedEditor,
@@ -24419,7 +24478,7 @@ var TimeTextBox = defineComponent({
24419
24478
  parameters: { value: { dtype: "H", nullable: true, binding: "twoWay" } },
24420
24479
  implementation: timeEditor
24421
24480
  });
24422
- var FilteringSelect = defineComponent({
24481
+ var FilteringSelect = (0, components_exports.defineComponent)({
24423
24482
  name: "filteringSelect",
24424
24483
  tag: "gramlot-filtering-select",
24425
24484
  base: ChoiceEditor,
@@ -24427,7 +24486,7 @@ var FilteringSelect = defineComponent({
24427
24486
  parameters: { values: { dtype: "T", default: "", binding: "read" }, separator: { dtype: "T", default: ",", binding: "read" } },
24428
24487
  implementation: localChoices
24429
24488
  });
24430
- var CallbackSelect = defineComponent({
24489
+ var CallbackSelect = (0, components_exports.defineComponent)({
24431
24490
  name: "callbackSelect",
24432
24491
  tag: "gramlot-callback-select",
24433
24492
  base: ChoiceEditor,
@@ -24435,19 +24494,47 @@ var CallbackSelect = defineComponent({
24435
24494
  parameters: { callback: { dtype: "T" } },
24436
24495
  implementation: callbackChoices
24437
24496
  });
24438
- var ComboBox = defineComponent({
24497
+ var ComboBox = (0, components_exports.defineComponent)({
24439
24498
  name: "comboBox",
24440
24499
  tag: "gramlot-combo-box",
24441
24500
  base: ChoiceEditor,
24442
24501
  mixins: [Labelbox, FieldState],
24443
- parameters: { values: { dtype: "T", default: "", binding: "read" }, separator: { dtype: "T", default: ",", binding: "read" }, store: { dtype: "X", nullable: true, default: null, binding: "read" } },
24502
+ parameters: {
24503
+ values: { dtype: "T", default: "", binding: "read" },
24504
+ separator: { dtype: "T", default: ",", binding: "read" },
24505
+ store: { dtype: "X", nullable: true, default: null, binding: "read" }
24506
+ },
24444
24507
  implementation: (Base) => class extends localChoices(Base) {
24445
24508
  get constrained() {
24446
24509
  return false;
24447
24510
  }
24448
24511
  }
24449
24512
  });
24450
- var CheckBoxText = defineComponent({
24513
+ var DbSelect = (0, components_exports.defineComponent)({
24514
+ name: "dbSelect",
24515
+ tag: "gramlot-db-select",
24516
+ base: ChoiceEditor,
24517
+ mixins: [Labelbox, FieldState],
24518
+ parameters: {
24519
+ ...databaseParameters,
24520
+ value: { dtype: ["T", "L"], nullable: true, binding: "twoWay" },
24521
+ autoSelect: { dtype: "B", default: false, binding: "read" }
24522
+ },
24523
+ implementation: databaseChoices
24524
+ });
24525
+ var DbComboBox = (0, components_exports.defineComponent)({
24526
+ name: "dbComboBox",
24527
+ tag: "gramlot-db-combo-box",
24528
+ base: ChoiceEditor,
24529
+ mixins: [Labelbox, FieldState],
24530
+ parameters: databaseParameters,
24531
+ implementation: (Base) => class extends databaseChoices(Base) {
24532
+ get constrained() {
24533
+ return false;
24534
+ }
24535
+ }
24536
+ });
24537
+ var CheckBoxText = (0, components_exports.defineComponent)({
24451
24538
  name: "checkBoxText",
24452
24539
  tag: "gramlot-check-box-text",
24453
24540
  base: ChoiceGroup,
@@ -24482,6 +24569,8 @@ var inputs_default = defineCollection({ name: "inputs", components: [
24482
24569
  FilteringSelect,
24483
24570
  CallbackSelect,
24484
24571
  ComboBox,
24572
+ DbSelect,
24573
+ DbComboBox,
24485
24574
  CheckBoxText,
24486
24575
  DateCalendar
24487
24576
  ] });
@@ -24493,6 +24582,8 @@ export {
24493
24582
  ComboBox,
24494
24583
  DateCalendar,
24495
24584
  DateTextBox,
24585
+ DbComboBox,
24586
+ DbSelect,
24496
24587
  FilteringSelect,
24497
24588
  HorizontalSlider,
24498
24589
  NumberTextBox,