@gramlot/gramlot-examples 0.3.3 → 0.3.5

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 (32) hide show
  1. package/README.md +6 -3
  2. package/package.json +4 -3
  3. package/src/gramlot_examples/catalog.json +54 -0
  4. package/src/gramlot_examples/gallery/dist/frame.js +548 -36
  5. package/src/gramlot_examples/gallery/dist/gallery.js +2467 -16677
  6. package/src/gramlot_examples/gallery/dist/inputs.js +12 -6
  7. package/src/gramlot_examples/gallery/dist/inspector.js +547 -35
  8. package/src/gramlot_examples/gallery/dist/layout.js +847 -28
  9. package/src/gramlot_examples/gallery/dist/notices.json +0 -24
  10. package/src/gramlot_examples/gallery/dist/theme-styles.js +1 -1
  11. package/src/gramlot_examples/gallery/gallery-page.js +77 -47
  12. package/src/gramlot_examples/gallery/gallery.css +61 -38
  13. package/src/gramlot_examples/gallery/guided-demo.js +151 -0
  14. package/src/gramlot_examples/gallery/page.js +6 -6
  15. package/src/gramlot_examples/index.js +1 -0
  16. package/src/gramlot_examples/pages/layout/01_border.js +80 -0
  17. package/src/gramlot_examples/pages/layout/01_border.md +23 -0
  18. package/src/gramlot_examples/pages/layout/02_nested.js +99 -0
  19. package/src/gramlot_examples/pages/layout/02_nested.md +23 -0
  20. package/src/gramlot_examples/pages/layout/03_rounded.js +111 -0
  21. package/src/gramlot_examples/pages/layout/03_rounded.md +25 -0
  22. package/src/gramlot_examples/pages/layout/04_drawer_handles.js +140 -0
  23. package/src/gramlot_examples/pages/layout/04_drawer_handles.md +33 -0
  24. package/src/gramlot_examples/pages/layout/05_nested_lab.js +251 -0
  25. package/src/gramlot_examples/pages/layout/05_nested_lab.md +25 -0
  26. package/src/gramlot_examples/pages/layout/06_border_events.js +118 -0
  27. package/src/gramlot_examples/pages/layout/06_border_events.md +25 -0
  28. package/src/gramlot_examples/pages/layout/07_tabs.js +300 -0
  29. package/src/gramlot_examples/pages/layout/07_tabs.md +37 -0
  30. package/src/gramlot_examples/pages/layout/08_stack.js +142 -0
  31. package/src/gramlot_examples/pages/layout/08_stack.md +27 -0
  32. package/src/gramlot_examples/pages/layout/README.md +15 -0
@@ -6547,7 +6547,7 @@ function annotation(parameter) {
6547
6547
  });
6548
6548
  return alternatives.length === 1 ? alternatives[0] : { kind: "union", items: alternatives };
6549
6549
  }
6550
- function defineComponent({ name, tag: tag2, base, mixins = [], parameters: parameters2 = {}, subTags = "", presentationDefaults = [], dataScope = false, command = false, implementation }) {
6550
+ function defineComponent({ name, tag: tag2, base, mixins = [], parameters: parameters2 = {}, subTags = "", presentationDefaults = [], dataScope = false, command = false, childParameters = {}, sourceContext = false, implementation }) {
6551
6551
  webcomponentCode({ code: tag2 });
6552
6552
  if (!/^[a-zA-Z][a-zA-Z0-9]*$/.test(name)) throw new TypeError("Invalid component authoring name");
6553
6553
  const effective = { ...base.parameters };
@@ -6569,6 +6569,8 @@ function defineComponent({ name, tag: tag2, base, mixins = [], parameters: param
6569
6569
  command,
6570
6570
  mixins: Object.freeze([...mixins]),
6571
6571
  parameters: freeze(structuredClone(effective)),
6572
+ childParameters: freeze(structuredClone(childParameters)),
6573
+ sourceContext,
6572
6574
  implementation
6573
6575
  });
6574
6576
  }
@@ -6625,7 +6627,9 @@ var ComponentCollection = class {
6625
6627
  parameters: structuredClone(component.parameters),
6626
6628
  presentationDefaults: [...component.presentationDefaults],
6627
6629
  dataScope: component.dataScope,
6628
- command: component.command
6630
+ command: component.command,
6631
+ ...Object.keys(component.childParameters).length ? { childParameters: structuredClone(component.childParameters) } : {},
6632
+ ...component.sourceContext ? { sourceContext: true } : {}
6629
6633
  } }
6630
6634
  }]))
6631
6635
  };
@@ -23116,12 +23120,12 @@ var SVG_NS = "http://www.w3.org/2000/svg";
23116
23120
  // node_modules/@gramlot/gramlot/src/components/popup.js
23117
23121
  var VIEWPORT_MARGIN = 8;
23118
23122
  var ANCHOR_GAP = 3;
23119
- function positionPopup(popup, anchor, { align = "start", matchWidth = false } = {}) {
23123
+ function positionPopup(popup, anchor, { align = "start", matchWidth = false, inset = 0 } = {}) {
23120
23124
  const view = anchor.ownerDocument.defaultView;
23121
23125
  const field = anchor.getBoundingClientRect();
23122
23126
  const availableWidth = Math.max(0, view.innerWidth - 2 * VIEWPORT_MARGIN);
23123
23127
  popup.style.setProperty("--gramlot-popup-available-width", `${availableWidth}px`);
23124
- if (matchWidth) popup.style.width = `${Math.min(field.width, availableWidth)}px`;
23128
+ if (matchWidth) popup.style.width = `${Math.min(Math.max(0, field.width - 2 * inset), availableWidth)}px`;
23125
23129
  popup.style.removeProperty("--gramlot-popup-available-height");
23126
23130
  const natural = popup.getBoundingClientRect();
23127
23131
  const below = Math.max(0, view.innerHeight - VIEWPORT_MARGIN - field.bottom - ANCHOR_GAP);
@@ -23129,7 +23133,7 @@ function positionPopup(popup, anchor, { align = "start", matchWidth = false } =
23129
23133
  const upwards = natural.height > below && above > below;
23130
23134
  popup.style.setProperty("--gramlot-popup-available-height", `${upwards ? above : below}px`);
23131
23135
  const size = popup.getBoundingClientRect();
23132
- const left = align === "end" ? field.right - size.width : field.left;
23136
+ const left = align === "end" ? field.right - size.width - inset : field.left + inset;
23133
23137
  const top = upwards ? field.top - size.height - ANCHOR_GAP : field.bottom + ANCHOR_GAP;
23134
23138
  popup.style.left = `${Math.max(VIEWPORT_MARGIN, Math.min(left, view.innerWidth - size.width - VIEWPORT_MARGIN))}px`;
23135
23139
  popup.style.top = `${Math.max(VIEWPORT_MARGIN, Math.min(top, view.innerHeight - size.height - VIEWPORT_MARGIN))}px`;
@@ -23856,6 +23860,7 @@ function ChoiceEditor(HTMLElement) {
23856
23860
  const doc = this.ownerDocument;
23857
23861
  const style = doc.createElement("style");
23858
23862
  style.textContent = `.option{position:relative} #control{width:100%;padding-right:calc(var(--gramlot-choice-toggle-width,1.6em) + .2em)}
23863
+ #control:focus-visible{outline:1px solid var(--gramlot-border-control,#7a8798);outline-offset:-3px}
23859
23864
  .toggle{position:absolute;right:0;top:0;bottom:0;width:var(--gramlot-choice-toggle-width,1.6em);min-width:0;min-height:0;font:inherit;font-size:var(--gramlot-field-font-size,1em);padding:0;border:0;background:transparent;color:inherit}
23860
23865
  .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;
23861
23866
  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)}
@@ -24051,7 +24056,8 @@ function ChoiceEditor(HTMLElement) {
24051
24056
  this.choices.hidden = false;
24052
24057
  this.choices.showPopover();
24053
24058
  this.#opened = true;
24054
- positionPopup(this.choices, this.control, { matchWidth: true });
24059
+ const inset = parseFloat(view.getComputedStyle(this).getPropertyValue("--gramlot-choice-popup-inset") || "2");
24060
+ positionPopup(this.choices, this.control, { matchWidth: true, inset });
24055
24061
  this.control.setAttribute("aria-expanded", "true");
24056
24062
  this.activate(0);
24057
24063
  const close = () => this.closeChoices();