@gramlot/gramlot 0.3.32 → 0.3.33

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 (60) hide show
  1. package/dist/components/charts/__init__.py +1 -1
  2. package/dist/components/charts/assets/collection.js +36 -21
  3. package/dist/components/charts/assets/index.js +1 -1
  4. package/dist/components/charts/grammar.json +15482 -232
  5. package/dist/gramlot.js +22 -10
  6. package/dist/gramlot.min.js +2 -2
  7. package/dist/standard-collections.js +1 -1
  8. package/package.json +1 -1
  9. package/src/components/chart-boxplot-options.js +22 -0
  10. package/src/components/chart-candlestick-options.js +27 -0
  11. package/src/components/chart-controls.js +28 -6
  12. package/src/components/chart-domains.js +1 -1
  13. package/src/components/chart-engines/echarts.js +18 -0
  14. package/src/components/chart-fields.js +11 -1
  15. package/src/components/chart-funnel-options.js +19 -0
  16. package/src/components/chart-gauge-options.js +98 -0
  17. package/src/components/chart-gauge.js +105 -0
  18. package/src/components/chart-heatmap-options.js +29 -0
  19. package/src/components/chart-notice.js +126 -0
  20. package/src/components/chart-pane.js +7 -1
  21. package/src/components/chart-parallel-options.js +24 -0
  22. package/src/components/chart-radar-options.js +29 -0
  23. package/src/components/chart-renderer.js +2 -8
  24. package/src/components/chart-sankey-options.js +43 -0
  25. package/src/components/chart-sunburst-options.js +12 -0
  26. package/src/components/chart-syntax.js +82 -0
  27. package/src/components/chart-time.js +2 -1
  28. package/src/components/chart-treemap-options.js +16 -0
  29. package/src/components/chart-type-data.js +62 -0
  30. package/src/components/chart-types/area.js +6 -1
  31. package/src/components/chart-types/bar.js +6 -1
  32. package/src/components/chart-types/bar3D.js +7 -1
  33. package/src/components/chart-types/boxplot.js +11 -0
  34. package/src/components/chart-types/candlestick.js +10 -0
  35. package/src/components/chart-types/donut.js +6 -1
  36. package/src/components/chart-types/funnel.js +7 -0
  37. package/src/components/chart-types/heatmap.js +8 -0
  38. package/src/components/chart-types/horizontalBar.js +6 -1
  39. package/src/components/chart-types/index.js +21 -1
  40. package/src/components/chart-types/line.js +6 -1
  41. package/src/components/chart-types/line3D.js +7 -1
  42. package/src/components/chart-types/lines3D.js +7 -1
  43. package/src/components/chart-types/map.js +7 -1
  44. package/src/components/chart-types/map3D.js +6 -1
  45. package/src/components/chart-types/mapBar3D.js +6 -1
  46. package/src/components/chart-types/parallel.js +7 -0
  47. package/src/components/chart-types/pie.js +6 -1
  48. package/src/components/chart-types/polygons3D.js +7 -1
  49. package/src/components/chart-types/radar.js +7 -0
  50. package/src/components/chart-types/sankey.js +8 -0
  51. package/src/components/chart-types/scatter.js +6 -1
  52. package/src/components/chart-types/scatter3D.js +7 -1
  53. package/src/components/chart-types/stackedArea.js +6 -1
  54. package/src/components/chart-types/stackedBar.js +6 -1
  55. package/src/components/chart-types/sunburst.js +7 -0
  56. package/src/components/chart-types/surface.js +7 -1
  57. package/src/components/chart-types/treemap.js +7 -0
  58. package/src/components/charts.js +60 -13
  59. package/src/components/registry.js +9 -5
  60. package/src/page-store-connection.js +15 -5
package/dist/gramlot.js CHANGED
@@ -22447,7 +22447,7 @@ var PageStoreConnection = class {
22447
22447
  this.frames.registerChannel("server", {
22448
22448
  changed: (peer) => this.peerChanged(peer),
22449
22449
  disconnected: (peer) => {
22450
- if (peer.parent) this.fail(new Error("PageStore parent disconnected"));
22450
+ if (peer.parent && this.parent) this.fail(new Error("PageStore parent disconnected"));
22451
22451
  else this.forget(peer.window);
22452
22452
  },
22453
22453
  receive: (peer, message) => {
@@ -22458,8 +22458,13 @@ var PageStoreConnection = class {
22458
22458
  }
22459
22459
  }
22460
22460
  }, { endpoint: this.endpoint, ready: false });
22461
- if (this.parent) return;
22462
- address.searchParams.set("pageId", gramlot.pageId);
22461
+ this.address = address;
22462
+ if (!this.parent) this.open();
22463
+ }
22464
+ /** Opens this page's own WebSocket: the page is the root of its family channel. */
22465
+ open() {
22466
+ const address = this.address;
22467
+ address.searchParams.set("pageId", this.gramlot.pageId);
22463
22468
  this.socket = new this.window.WebSocket(address.href);
22464
22469
  this.socket.addEventListener("open", () => this.connected());
22465
22470
  this.socket.addEventListener("message", (event) => {
@@ -22475,9 +22480,12 @@ var PageStoreConnection = class {
22475
22480
  });
22476
22481
  }
22477
22482
  peerChanged(peer) {
22478
- if (this.closed || !peer.parent) return;
22483
+ if (this.closed || !peer.parent || !this.parent) return;
22479
22484
  const state = peer.channels.server;
22480
- if (peer.origin !== this.origin || state?.endpoint !== this.endpoint) {
22485
+ if (!state) {
22486
+ this.parent = null;
22487
+ this.open();
22488
+ } else if (peer.origin !== this.origin || state?.endpoint !== this.endpoint) {
22481
22489
  this.fail(new Error("Parent does not provide the same PageStore endpoint"));
22482
22490
  } else if (state.ready) this.connected();
22483
22491
  else if (this.ready) this.fail(new Error("PageStore parent channel closed"));
@@ -23172,7 +23180,7 @@ function annotation2(parameter) {
23172
23180
  });
23173
23181
  return alternatives.length === 1 ? alternatives[0] : { kind: "union", items: alternatives };
23174
23182
  }
23175
- function defineComponent({ name, tag: tag2, base, mixins = [], parameters: parameters2 = {}, subTags = "", presentationDefaults = [], dataScope = false, command = false, childParameters = {}, sourceContext = false, bagStore = false, bagStruct = false, dragSource = false, implementation }) {
23183
+ function defineComponent({ name, tag: tag2, base, doc = null, mixins = [], parameters: parameters2 = {}, subTags = "", presentationDefaults = [], dataScope = false, command = false, childParameters = {}, sourceContext = false, bagStore = false, bagStruct = false, dragSource = false, implementation }) {
23176
23184
  webcomponentCode({ code: tag2 });
23177
23185
  if (!/^[a-zA-Z][a-zA-Z0-9]*$/.test(name)) throw new TypeError("Invalid component authoring name");
23178
23186
  const effective = { ...base.parameters };
@@ -23183,11 +23191,15 @@ function defineComponent({ name, tag: tag2, base, mixins = [], parameters: param
23183
23191
  }
23184
23192
  }
23185
23193
  Object.assign(effective, parameters2);
23186
- for (const spec of Object.values(effective)) annotation2(spec);
23194
+ for (const spec of Object.values(effective)) {
23195
+ annotation2(spec);
23196
+ if (spec.required !== void 0 && (spec.required !== true || Object.hasOwn(spec, "default"))) throw new TypeError("A required component parameter is true and has no default");
23197
+ }
23187
23198
  return Object.freeze({
23188
23199
  name,
23189
23200
  tag: tag2,
23190
23201
  base,
23202
+ doc,
23191
23203
  subTags,
23192
23204
  presentationDefaults: Object.freeze([...presentationDefaults]),
23193
23205
  dataScope,
@@ -23237,7 +23249,7 @@ var ComponentCollection = class _ComponentCollection {
23237
23249
  grammar: { name: this.name, version: null, title: this.name, description: null },
23238
23250
  abstracts: {},
23239
23251
  elements: Object.fromEntries(this.components.map((component) => [component.name, {
23240
- doc: null,
23252
+ doc: component.doc,
23241
23253
  sub_tags: component.subTags,
23242
23254
  parent_tags: null,
23243
23255
  inherits_from: null,
@@ -23246,13 +23258,13 @@ var ComponentCollection = class _ComponentCollection {
23246
23258
  collection_key: null,
23247
23259
  attributes: {
23248
23260
  parameters: [
23261
+ // A parameter with `required: true` has no default: the Builders reject the element without it.
23249
23262
  ...Object.entries(component.parameters).map(([name, spec]) => ({
23250
23263
  name,
23251
23264
  kind: "keyword_only",
23252
23265
  role: "attribute",
23253
23266
  annotation: annotation2(spec),
23254
- has_default: true,
23255
- default: spec.default ?? null
23267
+ ...spec.required ? { has_default: false } : { has_default: true, default: spec.default ?? null }
23256
23268
  })),
23257
23269
  {
23258
23270
  name: "attr",