@pacem/pacem-ui 2.0.0-grothendieck → 2.0.0-hadamard

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 (54) hide show
  1. package/dist/browser/pacem-ui.js +228 -145
  2. package/dist/browser/pacem-ui.js.map +1 -1
  3. package/dist/browser/pacem-ui.min.js +2 -2
  4. package/dist/bundle/pacem-ui.min.mjs +71 -71
  5. package/dist/bundle/pacem-ui.mjs +282 -226
  6. package/dist/bundle/pacem-ui.mjs.map +4 -4
  7. package/dist/docs/pacem-ui.json +171 -149
  8. package/dist/esm/adapter.js +1 -1
  9. package/dist/esm/anchor.js +1 -1
  10. package/dist/esm/balloon.js +94 -28
  11. package/dist/esm/binder.js +1 -1
  12. package/dist/esm/blade.js +1 -1
  13. package/dist/esm/bottom-sheet.js +1 -1
  14. package/dist/esm/button.js +4 -5
  15. package/dist/esm/buttonset.js +1 -1
  16. package/dist/esm/calendar.js +1 -1
  17. package/dist/esm/collapse.js +1 -1
  18. package/dist/esm/dialog-abstractions.js +17 -5
  19. package/dist/esm/dialog.js +1 -1
  20. package/dist/esm/divider.js +1 -1
  21. package/dist/esm/icon.js +1 -1
  22. package/dist/esm/image.js +1 -1
  23. package/dist/esm/index-components-ui.js +1 -1
  24. package/dist/esm/index-components.js +1 -1
  25. package/dist/esm/index-iife.js +1 -1
  26. package/dist/esm/index.js +1 -1
  27. package/dist/esm/infinite-scroller.js +1 -1
  28. package/dist/esm/iterative.js +1 -1
  29. package/dist/esm/lightbox-abstractions.js +1 -1
  30. package/dist/esm/lightbox.js +1 -1
  31. package/dist/esm/loader.js +1 -1
  32. package/dist/esm/markdown-svc.js +1 -1
  33. package/dist/esm/markdown.js +1 -1
  34. package/dist/esm/marquee.js +1 -1
  35. package/dist/esm/media-query.js +1 -1
  36. package/dist/esm/menu.js +1 -1
  37. package/dist/esm/pager.js +1 -1
  38. package/dist/esm/picture.js +1 -1
  39. package/dist/esm/progressbar.js +1 -1
  40. package/dist/esm/sidebar.js +1 -1
  41. package/dist/esm/slideshow.js +1 -1
  42. package/dist/esm/social-twitter.js +1 -1
  43. package/dist/esm/sticky-header.js +1 -1
  44. package/dist/esm/tabs.js +1 -1
  45. package/dist/esm/ticker.js +5 -2
  46. package/dist/esm/toast.js +1 -1
  47. package/dist/esm/toc.js +1 -1
  48. package/dist/esm/tuner.js +1 -1
  49. package/dist/esm/types.js +1 -1
  50. package/dist/esm/vibration.js +1 -1
  51. package/dist/esm/view.js +1 -1
  52. package/dist/esm/window.js +1 -1
  53. package/package.json +1 -1
  54. package/typings/index.d.ts +47 -10
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @pacem/pacem-ui v2.0.0-grothendieck (https://js.pacem.it)
2
+ * @pacem/pacem-ui v2.0.0-hadamard (https://js.pacem.it)
3
3
  * Pacem (https://pacem.it)
4
4
  * Licensed under Apache-2.0
5
5
  */
@@ -550,17 +550,24 @@
550
550
  BalloonAlignment["End"] = "end";
551
551
  BalloonAlignment["Auto"] = "auto";
552
552
  })(BalloonAlignment || (BalloonAlignment = {}));
553
+ /** A side of `target` a {@link PacemBalloonElement} can sit on. */
554
+ const BalloonPlacement = {
555
+ Top: 'top',
556
+ Left: 'left',
557
+ Bottom: 'bottom',
558
+ Right: 'right',
559
+ };
560
+ /** The automatic placements of a {@link PacemBalloonElement}: the side with the most room, on both axes or on one. */
561
+ const BalloonPlacementOption = {
562
+ Auto: 'auto',
563
+ HorizontalAuto: 'x',
564
+ VerticalAuto: 'y'
565
+ };
553
566
  /** Side of `target` a {@link PacemBalloonElement} is anchored to (with automatic variants that pick the side with the most room). */
554
- var BalloonPosition;
555
- (function (BalloonPosition) {
556
- BalloonPosition["Top"] = "top";
557
- BalloonPosition["Left"] = "left";
558
- BalloonPosition["Bottom"] = "bottom";
559
- BalloonPosition["Right"] = "right";
560
- BalloonPosition["Auto"] = "auto";
561
- BalloonPosition["HorizontalAuto"] = "x";
562
- BalloonPosition["VerticalAuto"] = "y";
563
- })(BalloonPosition || (BalloonPosition = {}));
567
+ const BalloonPosition = {
568
+ ...BalloonPlacement,
569
+ ...BalloonPlacementOption
570
+ };
564
571
  /** Whether a {@link PacemBalloonElement} sizes itself freely or matches its `target`'s size along the anchored axis. */
565
572
  var BalloonSizing;
566
573
  (function (BalloonSizing) {
@@ -585,9 +592,20 @@
585
592
  'track': true
586
593
  }
587
594
  };
595
+ /**
596
+ * CSS custom property a balloon publishes on itself when placed: the room left (px) on its side of the target, within
597
+ * the viewport, so that its contents can fit (e.g. `max-height: var(--pacem-balloon-available-height)` on a scrolling
598
+ * list). Updated whenever the balloon repositions (scroll, resize, when tracking).
599
+ */
600
+ const AVAILABLE_HEIGHT_VAR = '--pacem-balloon-available-height';
601
+ /** Breathing room (px) kept between a balloon and the viewport's edge when computing {@link AVAILABLE_HEIGHT_VAR}. */
602
+ const AVAILABLE_HEIGHT_GUTTER = 8;
588
603
  const positioningStyles = 'balloon-right balloon-left balloon-bottom balloon-top balloon-start balloon-center balloon-end';
589
604
  const allStyles = pacemCore.PCSS + '-balloon ' + positioningStyles + ' balloon-out balloon-in balloon-on';
590
605
  /** Positions its content as a floating popup (menu or tooltip) anchored to a `target` element or point; see {@link BalloonOptions}. */
606
+ // (the content's `<p-resize>` is `display: block` inline: in the shadow root the theme's `pacem-resize { display: block }`
607
+ // does not apply, and an inline element never reports a resize, i.e. the balloon would not reposition when its content
608
+ // grows or shrinks, e.g. a filtered list above its target)
591
609
  let PacemBalloonElement = class PacemBalloonElement extends pacemCore.Components.PacemElement {
592
610
  constructor() {
593
611
  super(...arguments);
@@ -781,6 +799,32 @@
781
799
  this._adjust();
782
800
  }
783
801
  }
802
+ /**
803
+ * The side {@link BalloonOptions.prefer} asks for, when the balloon fits there (its natural size, on that side of the
804
+ * target, within the viewport); `null` otherwise, or when nothing is preferred.
805
+ * @param room The room around the target, per side.
806
+ */
807
+ _preferredSide(opts, room) {
808
+ const prefer = opts.prefer;
809
+ if (pacemCore.Utils.isNull(prefer) || !(prefer in room)) {
810
+ return null;
811
+ }
812
+ const isVertical = prefer === BalloonPlacement.Top || prefer === BalloonPlacement.Bottom;
813
+ const size = isVertical ? this.offsetHeight : this.offsetWidth;
814
+ const fits = size + AVAILABLE_HEIGHT_GUTTER <= room[prefer];
815
+ return fits ? prefer : null;
816
+ }
817
+ /** The room left on a side of the target (the whole viewport height for a side that is not above or below). */
818
+ _availableHeight(position, offsetTop, offsetBottom, viewportHeight) {
819
+ switch (position) {
820
+ case BalloonPosition.Top:
821
+ return Math.max(offsetTop - AVAILABLE_HEIGHT_GUTTER, 0);
822
+ case BalloonPosition.Bottom:
823
+ return Math.max(offsetBottom - AVAILABLE_HEIGHT_GUTTER, 0);
824
+ default:
825
+ return viewportHeight;
826
+ }
827
+ }
784
828
  _adjust() {
785
829
  const popup = this, el = popup.target;
786
830
  if (pacemCore.Utils.isNull(el)) {
@@ -790,24 +834,39 @@
790
834
  const vieportSize = pacemCore.Utils.windowSize;
791
835
  var opts = this._options;
792
836
  var chosenPosition = opts.position, chosenAlignment = opts.align;
837
+ // room around the target, in the viewport
838
+ const viewportHeight = vieportSize.height;
839
+ const viewportWidth = vieportSize.width;
840
+ const offsetLeft = coords.left - pacemCore.Utils.scrollLeft;
841
+ const offsetTop = coords.top - pacemCore.Utils.scrollTop;
842
+ const offsetBottom = viewportHeight - (offsetTop + coords.height);
843
+ const offsetRight = viewportWidth - (offsetLeft + coords.width);
844
+ // (the natural size, uncapped: see AVAILABLE_HEIGHT_VAR below)
845
+ popup.style.removeProperty(AVAILABLE_HEIGHT_VAR);
793
846
  if (chosenPosition != BalloonPosition.Top &&
794
847
  chosenPosition != BalloonPosition.Bottom && chosenPosition != BalloonPosition.Left && chosenPosition != BalloonPosition.Right) {
795
- let viewportHeight = vieportSize.height;
796
- let viewportWidth = vieportSize.width;
797
- const offsetLeft = coords.left - pacemCore.Utils.scrollLeft;
798
- const offsetTop = coords.top - pacemCore.Utils.scrollTop;
799
- const offsetBottom = viewportHeight - (offsetTop + coords.height);
800
- const offsetRight = viewportWidth - (offsetLeft + coords.width);
801
- switch (chosenPosition) {
802
- case BalloonPosition.HorizontalAuto:
803
- chosenPosition = offsetLeft > offsetRight ? BalloonPosition.Left : BalloonPosition.Right;
804
- break;
805
- default:
806
- // (!) exclude 'left' and 'right' also when position is simply set to 'auto'
807
- chosenPosition = offsetTop > offsetBottom ? BalloonPosition.Top : BalloonPosition.Bottom;
808
- break;
848
+ // an automatic position: the preferred side wins, whenever the balloon fits there (on either axis)...
849
+ const room = { top: offsetTop, bottom: offsetBottom, left: offsetLeft, right: offsetRight };
850
+ const preferred = this._preferredSide(opts, room);
851
+ if (!pacemCore.Utils.isNull(preferred)) {
852
+ chosenPosition = preferred;
853
+ }
854
+ else {
855
+ // ...otherwise the larger side
856
+ switch (chosenPosition) {
857
+ case BalloonPosition.HorizontalAuto:
858
+ chosenPosition = offsetLeft > offsetRight ? BalloonPosition.Left : BalloonPosition.Right;
859
+ break;
860
+ default:
861
+ // (!) exclude 'left' and 'right' also when position is simply set to 'auto'
862
+ chosenPosition = offsetTop > offsetBottom ? BalloonPosition.Top : BalloonPosition.Bottom;
863
+ break;
864
+ }
809
865
  }
810
866
  }
867
+ // the room left on the chosen side, for contents that must fit in the viewport (e.g. a scrolling list)
868
+ const availableHeight = this._availableHeight(chosenPosition, offsetTop, offsetBottom, viewportHeight);
869
+ popup.style.setProperty(AVAILABLE_HEIGHT_VAR, `${availableHeight}px`);
811
870
  if (opts.size === BalloonSizing.Match) {
812
871
  switch (chosenPosition) {
813
872
  case BalloonPosition.Bottom:
@@ -975,11 +1034,14 @@
975
1034
  this._timer = setTimeout(() => this.popup(), delay);
976
1035
  return;
977
1036
  }
978
- const popup = this, isVisible = pacemCore.Utils.isVisible(popup);
1037
+ const popup = this, isVisible = pacemCore.Utils.isVisible(popup),
1038
+ // (popping out: still visible, but leaving; popping up again cancels that)
1039
+ isLeaving = pacemCore.Utils.hasClass(popup, 'balloon-out');
979
1040
  this._adjustWatchers(true);
980
- if (isVisible || this.disabled) {
1041
+ if ((isVisible && !isLeaving) || this.disabled) {
981
1042
  return;
982
1043
  }
1044
+ pacemCore.Utils.removeClass(popup, 'balloon-out');
983
1045
  // attach closured behavior to popup
984
1046
  //if (!sameTrigger) {
985
1047
  this._registerEvents(); // $popup.on('mouseenter', obj.methods.hover).on('mouseleave', obj.methods.out).data(vars.TRIGGER, obj);
@@ -1021,6 +1083,10 @@
1021
1083
  pacemCore.Utils.removeClass(popup, 'balloon-in balloon-on');
1022
1084
  pacemCore.Utils.addClass(popup, 'balloon-out');
1023
1085
  pacemCore.Utils.addAnimationEndCallback(popup, () => {
1086
+ // (popped up again meanwhile: stays)
1087
+ if (!pacemCore.Utils.hasClass(popup, 'balloon-out')) {
1088
+ return;
1089
+ }
1024
1090
  popup.style.visibility = 'hidden';
1025
1091
  this._visible = false;
1026
1092
  pacemCore.Utils.removeClass(popup, allStyles);
@@ -1105,7 +1171,7 @@
1105
1171
  shadow: true,
1106
1172
  template: `<${pacemCore.P}-resize target="{{ :host.target }}" disabled="true" watch-position="true" on-${pacemCore.Components.ResizeEventName}=":host._onLayoutChange($event)"></${pacemCore.P}-resize>
1107
1173
  <div class="${pacemCore.PCSS}-balloon-face"></div>
1108
- <div class="${pacemCore.PCSS}-balloon"><${pacemCore.P}-resize on-${pacemCore.Components.ResizeEventName}=":host._onLayoutChange($event)" disabled="true" content><slot></slot></${pacemCore.P}-resize></div>
1174
+ <div class="${pacemCore.PCSS}-balloon"><${pacemCore.P}-resize on-${pacemCore.Components.ResizeEventName}=":host._onLayoutChange($event)" disabled="true" content style="display: block"><slot></slot></${pacemCore.P}-resize></div>
1109
1175
  <div class="corner top-left" part="corner-topleft"></div><div class="corner bottom-left" part="corner-bottomleft"></div><div class="corner top-right" part="corner-topright"></div><div class="corner bottom-right" part="corner-bottomright"></div>`
1110
1176
  })
1111
1177
  ], PacemBalloonElement);
@@ -2198,74 +2264,6 @@
2198
2264
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2199
2265
  };
2200
2266
  //namespace Pacem.Components.UI {
2201
- /** Set of buttons shown by a dialog (e.g. {@link PacemDialogBase}), controlling which {@link DialogButton}s are visible. */
2202
- var DialogButtons;
2203
- (function (DialogButtons) {
2204
- DialogButtons["YesNo"] = "yesno";
2205
- DialogButtons["YesNoCancel"] = "yesnocancel";
2206
- DialogButtons["Ok"] = "ok";
2207
- DialogButtons["OkCancel"] = "okcancel";
2208
- })(DialogButtons || (DialogButtons = {}));
2209
- /** Single button a dialog can be committed/closed with. */
2210
- var DialogButton;
2211
- (function (DialogButton) {
2212
- DialogButton["Yes"] = "yes";
2213
- DialogButton["No"] = "no";
2214
- DialogButton["Cancel"] = "cancel";
2215
- DialogButton["Ok"] = "ok";
2216
- })(DialogButton || (DialogButton = {}));
2217
- /** Event name dispatched by a {@link PacemDialogBase} when it is committed/closed via one of its buttons. */
2218
- const DialogResultEventName = 'commit';
2219
- /** Event dispatched by a {@link PacemDialogBase} when it is committed/closed via one of its buttons; also the resolution value of `open()`'s promise. */
2220
- class DialogResultEvent extends pacemCore.CustomTypedEvent {
2221
- constructor(args) {
2222
- super(DialogResultEventName, args);
2223
- }
2224
- }
2225
- /** Base class for modal dialog elements (see {@link PacemDialogElement}): wraps a {@link Lightbox} with an open/commit lifecycle resolved through a promise. */
2226
- class PacemDialogBase extends pacemCore.Components.PacemElement {
2227
- #deferred;
2228
- /** Opens the dialog, optionally seeding its `state`. @returns A promise resolved with the {@link DialogResultEventArgs} once the dialog is committed. */
2229
- open(state) {
2230
- const lb = this.lightbox;
2231
- if (!pacemCore.Utils.isNull(this.#deferred)) {
2232
- throw `Dialog already open.`;
2233
- }
2234
- const deferred = this.#deferred = Promise.withResolvers();
2235
- if (this.hide || this.disabled) {
2236
- this.log(pacemCore.Logging.LogLevel.Warn, 'Dialog hidden or disabled, opening forbidden.');
2237
- deferred.reject();
2238
- }
2239
- else {
2240
- this.dispatchEvent(new Event('open'));
2241
- lb.show = true;
2242
- this.state = state;
2243
- }
2244
- return deferred.promise;
2245
- }
2246
- /** Closes the dialog with the given button outcome, resolving the pending `open()` promise and dispatching a {@link DialogResultEvent}. */
2247
- commit(btn, evt) {
2248
- pacemCore.avoidHandler(evt);
2249
- this.log(pacemCore.Logging.LogLevel.Debug, `Committing dialog by clicking '${btn}'.`);
2250
- const state = this.state;
2251
- var drevt = new DialogResultEvent({ button: btn, state: state });
2252
- this.lightbox.show = false;
2253
- this.#deferred.resolve(drevt.detail);
2254
- this.#deferred = null;
2255
- this.dispatchEvent(drevt);
2256
- }
2257
- }
2258
- __decorate$v([
2259
- pacemCore.Watch()
2260
- ], PacemDialogBase.prototype, "state", void 0);
2261
-
2262
- var __decorate$u = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2263
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2264
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2265
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2266
- return c > 3 && r && Object.defineProperty(target, key, r), r;
2267
- };
2268
- //namespace Pacem.Components.UI {
2269
2267
  /** Clickable button element with optional icon, command dispatching (via {@link CommandEvent}) and an optional confirmation dialog gate. */
2270
2268
  let PacemButtonElement = class PacemButtonElement extends pacemCore.Components.PacemIterableElement {
2271
2269
  constructor() {
@@ -2332,9 +2330,9 @@
2332
2330
  }
2333
2331
  };
2334
2332
  if (!this.disabled && evt.type === 'click' && !pacemCore.Utils.isNull(this.confirmationDialog)) {
2335
- this.confirmationDialog.open(this.confirmationMessage).then(r => {
2336
- if (r.button === DialogButton.Yes || r.button === DialogButton.Ok)
2337
- fn(evt);
2333
+ this.confirmationDialog.open(this.confirmationMessage, true).then(r => {
2334
+ //if (r.button === DialogButton.Yes || r.button === DialogButton.Ok)
2335
+ fn(evt);
2338
2336
  });
2339
2337
  }
2340
2338
  else if (!(evt instanceof MouseEvent) || evt.button === 0) {
@@ -2342,25 +2340,25 @@
2342
2340
  }
2343
2341
  }
2344
2342
  };
2345
- __decorate$u([
2343
+ __decorate$v([
2346
2344
  pacemCore.Watch({ emit: false, converter: pacemCore.PropertyConverters.String })
2347
2345
  ], PacemButtonElement.prototype, "iconGlyph", void 0);
2348
- __decorate$u([
2346
+ __decorate$v([
2349
2347
  pacemCore.Watch({ emit: false, converter: pacemCore.PropertyConverters.String })
2350
2348
  ], PacemButtonElement.prototype, "iconUrl", void 0);
2351
- __decorate$u([
2349
+ __decorate$v([
2352
2350
  pacemCore.Watch({ emit: false, converter: pacemCore.PropertyConverters.String })
2353
2351
  ], PacemButtonElement.prototype, "commandName", void 0);
2354
- __decorate$u([
2352
+ __decorate$v([
2355
2353
  pacemCore.Watch({ emit: false, converter: pacemCore.PropertyConverters.Json })
2356
2354
  ], PacemButtonElement.prototype, "commandArgument", void 0);
2357
- __decorate$u([
2355
+ __decorate$v([
2358
2356
  pacemCore.Watch({ emit: false, converter: pacemCore.PropertyConverters.String })
2359
2357
  ], PacemButtonElement.prototype, "confirmationMessage", void 0);
2360
- __decorate$u([
2358
+ __decorate$v([
2361
2359
  pacemCore.Watch({ emit: false, converter: pacemCore.PropertyConverters.Element })
2362
2360
  ], PacemButtonElement.prototype, "confirmationDialog", void 0);
2363
- PacemButtonElement = __decorate$u([
2361
+ PacemButtonElement = __decorate$v([
2364
2362
  pacemCore.CustomElement({
2365
2363
  tagName: pacemCore.P + '-button',
2366
2364
  modifiers: ['hoverable', 'focusable', 'clickable']
@@ -2368,7 +2366,7 @@
2368
2366
  ], PacemButtonElement);
2369
2367
  //}
2370
2368
 
2371
- var __decorate$t = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2369
+ var __decorate$u = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2372
2370
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2373
2371
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2374
2372
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -2401,14 +2399,14 @@
2401
2399
  return item instanceof PacemButtonElement;
2402
2400
  }
2403
2401
  };
2404
- PacemButtonsetElement = __decorate$t([
2402
+ PacemButtonsetElement = __decorate$u([
2405
2403
  pacemCore.CustomElement({
2406
2404
  tagName: pacemCore.P + '-buttonset'
2407
2405
  })
2408
2406
  ], PacemButtonsetElement);
2409
2407
  //}
2410
2408
 
2411
- var __decorate$s = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2409
+ var __decorate$t = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2412
2410
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2413
2411
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2414
2412
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -2461,22 +2459,22 @@
2461
2459
  });
2462
2460
  }
2463
2461
  };
2464
- __decorate$s([
2462
+ __decorate$t([
2465
2463
  pacemCore.Watch({ converter: pacemCore.PropertyConverters.Datetime })
2466
2464
  ], PacemCalendarEventElement.prototype, "start", void 0);
2467
- __decorate$s([
2465
+ __decorate$t([
2468
2466
  pacemCore.Watch({ converter: pacemCore.PropertyConverters.Datetime })
2469
2467
  ], PacemCalendarEventElement.prototype, "end", void 0);
2470
- __decorate$s([
2468
+ __decorate$t([
2471
2469
  pacemCore.Watch({ converter: pacemCore.PropertyConverters.String })
2472
2470
  ], PacemCalendarEventElement.prototype, "caption", void 0);
2473
- __decorate$s([
2471
+ __decorate$t([
2474
2472
  pacemCore.Watch({ converter: pacemCore.PropertyConverters.Json })
2475
2473
  ], PacemCalendarEventElement.prototype, "place", void 0);
2476
- __decorate$s([
2474
+ __decorate$t([
2477
2475
  pacemCore.Watch({ converter: pacemCore.PropertyConverters.Boolean })
2478
2476
  ], PacemCalendarEventElement.prototype, "allDay", void 0);
2479
- PacemCalendarEventElement = __decorate$s([
2477
+ PacemCalendarEventElement = __decorate$t([
2480
2478
  pacemCore.CustomElement({
2481
2479
  tagName: pacemCore.P + '-calendar-event'
2482
2480
  })
@@ -2630,25 +2628,25 @@
2630
2628
  }
2631
2629
  }
2632
2630
  }
2633
- __decorate$s([
2631
+ __decorate$t([
2634
2632
  pacemCore.Watch({ converter: pacemCore.PropertyConverters.Datetime })
2635
2633
  ], PacemCalendarBaseElement.prototype, "viewDate", void 0);
2636
- __decorate$s([
2634
+ __decorate$t([
2637
2635
  pacemCore.Watch({ converter: pacemCore.PropertyConverters.Datetime })
2638
2636
  ], PacemCalendarBaseElement.prototype, "now", void 0);
2639
- __decorate$s([
2637
+ __decorate$t([
2640
2638
  pacemCore.Watch({ converter: pacemCore.PropertyConverters.String })
2641
2639
  ], PacemCalendarBaseElement.prototype, "zoom", void 0);
2642
- __decorate$s([
2640
+ __decorate$t([
2643
2641
  pacemCore.Watch({ converter: pacemCore.PropertyConverters.String })
2644
2642
  ], PacemCalendarBaseElement.prototype, "weekStart", void 0);
2645
- __decorate$s([
2643
+ __decorate$t([
2646
2644
  pacemCore.Watch({ converter: pacemCore.PropertyConverters.Eval })
2647
2645
  ], PacemCalendarBaseElement.prototype, "week", void 0);
2648
- __decorate$s([
2646
+ __decorate$t([
2649
2647
  pacemCore.Watch({ converter: pacemCore.PropertyConverters.Eval })
2650
2648
  ], PacemCalendarBaseElement.prototype, "month", void 0);
2651
- __decorate$s([
2649
+ __decorate$t([
2652
2650
  pacemCore.Watch({ converter: pacemCore.PropertyConverters.Eval })
2653
2651
  ], PacemCalendarBaseElement.prototype, "disabledRanges", void 0);
2654
2652
  /** Base class for calendar-family elements that render their {@link PacemCalendarEventElement} items into a positioned grid (see {@link PacemCalendarElement}, {@link PacemAgendaElement}); subclasses supply the grid-building logic via `buildDataSource`. */
@@ -2822,13 +2820,13 @@
2822
2820
  }
2823
2821
  }
2824
2822
  };
2825
- __decorate$s([
2823
+ __decorate$t([
2826
2824
  pacemCore.ViewChild(pacemCore.P + '-clock')
2827
2825
  ], PacemAgendaElement.prototype, "_clock", void 0);
2828
- __decorate$s([
2826
+ __decorate$t([
2829
2827
  pacemCore.Watch({ converter: pacemCore.PropertyConverters.Datetime })
2830
2828
  ], PacemAgendaElement.prototype, "time", void 0);
2831
- PacemAgendaElement = __decorate$s([
2829
+ PacemAgendaElement = __decorate$t([
2832
2830
  pacemCore.CustomElement({
2833
2831
  tagName: pacemCore.P + '-agenda', shadow: pacemCore.Defaults.USE_SHADOW_ROOT,
2834
2832
  template: `<${pacemCore.P}-repeater class="${pacemCore.PCSS}-agenda agenda-grid" datasource="{{ :host.datasource }}">${buildAgendaGrid()}<${pacemCore.P}-clock hidden></${pacemCore.P}-clock>
@@ -2909,16 +2907,16 @@ css-class="{{ ['hour-start-'+ (^item.hour + 1), 'hour-end-'+ (^item.hour + ^item
2909
2907
  return super.getDayLabel(d);
2910
2908
  }
2911
2909
  };
2912
- __decorate$s([
2910
+ __decorate$t([
2913
2911
  pacemCore.Watch({ converter: pacemCore.PropertyConverters.Datetime })
2914
2912
  ], PacemCalendarElement.prototype, "date", void 0);
2915
- __decorate$s([
2913
+ __decorate$t([
2916
2914
  pacemCore.Watch({ emit: false })
2917
2915
  ], PacemCalendarElement.prototype, "dayLabelFormatter", void 0);
2918
- __decorate$s([
2916
+ __decorate$t([
2919
2917
  pacemCore.Watch()
2920
2918
  ], PacemCalendarElement.prototype, "_formatVersion", void 0);
2921
- PacemCalendarElement = __decorate$s([
2919
+ PacemCalendarElement = __decorate$t([
2922
2920
  pacemCore.CustomElement({
2923
2921
  tagName: pacemCore.P + '-calendar', shadow: pacemCore.Defaults.USE_SHADOW_ROOT,
2924
2922
  template: `<${pacemCore.P}-repeater class="${pacemCore.PCSS}-calendar calendar-grid" datasource="{{ :host.datasource }}">${buildCalendarGrid()}
@@ -2942,10 +2940,10 @@ css-class="{{ ['hour-start-'+ (^item.hour + 1), 'hour-end-'+ (^item.hour + ^item
2942
2940
  /** Displays (and CSS-classes itself by) the current hour/minute; typically overlaid on a {@link PacemAgendaElement} to mark the current-time line. */
2943
2941
  let PacemClockElement = class PacemClockElement extends pacemCore.Components.PacemElement {
2944
2942
  };
2945
- __decorate$s([
2943
+ __decorate$t([
2946
2944
  pacemCore.Watch({ converter: pacemCore.PropertyConverters.Datetime })
2947
2945
  ], PacemClockElement.prototype, "now", void 0);
2948
- PacemClockElement = __decorate$s([
2946
+ PacemClockElement = __decorate$t([
2949
2947
  pacemCore.CustomElement({ tagName: pacemCore.P + '-clock' })
2950
2948
  ], PacemClockElement);
2951
2949
  // #endregion
@@ -2975,13 +2973,13 @@ css-class="{{ ['hour-start-'+ (^item.hour + 1), 'hour-end-'+ (^item.hour + ^item
2975
2973
  super.disconnectedCallback();
2976
2974
  }
2977
2975
  };
2978
- __decorate$s([
2976
+ __decorate$t([
2979
2977
  pacemCore.ViewChild(pacemCore.P + '-calendar')
2980
2978
  ], PacemScheduleElement.prototype, "_calendar", void 0);
2981
- __decorate$s([
2979
+ __decorate$t([
2982
2980
  pacemCore.ViewChild(pacemCore.P + '-agenda')
2983
2981
  ], PacemScheduleElement.prototype, "_agenda", void 0);
2984
- PacemScheduleElement = __decorate$s([
2982
+ PacemScheduleElement = __decorate$t([
2985
2983
  pacemCore.CustomElement({
2986
2984
  tagName: pacemCore.P + '-schedule', shadow: pacemCore.Defaults.USE_SHADOW_ROOT,
2987
2985
  template: `<${pacemCore.P}-panel class="${pacemCore.PCSS}-schedule" css-class="{{ ['schedule-'+ (:host.zoom || '${CalendarZoom.Month}')] }}">
@@ -3037,7 +3035,7 @@ css-class="{{ ['hour-start-'+ (^item.hour + 1), 'hour-end-'+ (^item.hour + ^item
3037
3035
  this._target.disabledRanges = actualRanges;
3038
3036
  }
3039
3037
  }
3040
- __decorate$s([
3038
+ __decorate$t([
3041
3039
  pacemCore.Debounce(true)
3042
3040
  ], PacemCalendarRuleBaseElement.prototype, "refreshDisabledRanges", null);
3043
3041
  /** Declarative {@link PacemCalendarRuleBaseElement} that disables every day of the ancestor calendar not listed in `days` (e.g. weekends). */
@@ -3074,15 +3072,15 @@ css-class="{{ ['hour-start-'+ (^item.hour + 1), 'hour-end-'+ (^item.hour + ^item
3074
3072
  return retval;
3075
3073
  }
3076
3074
  };
3077
- __decorate$s([
3075
+ __decorate$t([
3078
3076
  pacemCore.Watch({ emit: false, converter: pacemCore.PropertyConverters.StringArray })
3079
3077
  ], PacemCalendarDayOfWeekRuleElement.prototype, "days", void 0);
3080
- PacemCalendarDayOfWeekRuleElement = __decorate$s([
3078
+ PacemCalendarDayOfWeekRuleElement = __decorate$t([
3081
3079
  pacemCore.CustomElement({ tagName: pacemCore.P + '-calendar-daysofweek-rule' })
3082
3080
  ], PacemCalendarDayOfWeekRuleElement);
3083
3081
  // #endregion
3084
3082
 
3085
- var __decorate$r = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
3083
+ var __decorate$s = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
3086
3084
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3087
3085
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3088
3086
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -3135,25 +3133,105 @@ css-class="{{ ['hour-start-'+ (^item.hour + 1), 'hour-end-'+ (^item.hour + ^item
3135
3133
  }
3136
3134
  }
3137
3135
  };
3138
- __decorate$r([
3136
+ __decorate$s([
3139
3137
  pacemCore.Watch({ converter: pacemCore.PropertyConverters.Boolean })
3140
3138
  ], PacemCollapseElement.prototype, "collapse", void 0);
3141
- __decorate$r([
3139
+ __decorate$s([
3142
3140
  pacemCore.Watch({ emit: false, converter: pacemCore.PropertyConverters.Boolean })
3143
3141
  ], PacemCollapseElement.prototype, "horizontal", void 0);
3144
- __decorate$r([
3142
+ __decorate$s([
3145
3143
  pacemCore.ViewChild(pacemCore.P + '-resize')
3146
3144
  ], PacemCollapseElement.prototype, "_resizer", void 0);
3147
- __decorate$r([
3145
+ __decorate$s([
3148
3146
  pacemCore.ViewChild(`[part=content]`)
3149
3147
  ], PacemCollapseElement.prototype, "_container", void 0);
3150
- PacemCollapseElement = __decorate$r([
3148
+ PacemCollapseElement = __decorate$s([
3151
3149
  pacemCore.CustomElement({
3152
3150
  tagName: pacemCore.P + '-collapse', shadow: true,
3153
3151
  template: `<${pacemCore.P}-resize on-${pacemCore.Components.ResizeEventName}=":host._resizeHandler($event)" target="{{ ::_container }}"></${pacemCore.P}-resize><div part="container"><div part="content"><slot></slot></div></div>`
3154
3152
  })
3155
3153
  ], PacemCollapseElement);
3156
3154
 
3155
+ var __decorate$r = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
3156
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3157
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3158
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3159
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
3160
+ };
3161
+ //namespace Pacem.Components.UI {
3162
+ /** Set of buttons shown by a dialog (e.g. {@link PacemDialogBase}), controlling which {@link DialogButton}s are visible. */
3163
+ var DialogButtons;
3164
+ (function (DialogButtons) {
3165
+ DialogButtons["YesNo"] = "yesno";
3166
+ DialogButtons["YesNoCancel"] = "yesnocancel";
3167
+ DialogButtons["Ok"] = "ok";
3168
+ DialogButtons["OkCancel"] = "okcancel";
3169
+ })(DialogButtons || (DialogButtons = {}));
3170
+ /** Single button a dialog can be committed/closed with. */
3171
+ var DialogButton;
3172
+ (function (DialogButton) {
3173
+ DialogButton["Yes"] = "yes";
3174
+ DialogButton["No"] = "no";
3175
+ DialogButton["Cancel"] = "cancel";
3176
+ DialogButton["Ok"] = "ok";
3177
+ })(DialogButton || (DialogButton = {}));
3178
+ /** Event name dispatched by a {@link PacemDialogBase} when it is committed/closed via one of its buttons. */
3179
+ const DialogResultEventName = 'commit';
3180
+ /** Event dispatched by a {@link PacemDialogBase} when it is committed/closed via one of its buttons; also the resolution value of `open()`'s promise. */
3181
+ class DialogResultEvent extends pacemCore.CustomTypedEvent {
3182
+ constructor(args) {
3183
+ super(DialogResultEventName, args);
3184
+ }
3185
+ }
3186
+ /** Base class for modal dialog elements (see {@link PacemDialogElement}): wraps a {@link Lightbox} with an open/commit lifecycle resolved through a promise. */
3187
+ class PacemDialogBase extends pacemCore.Components.PacemElement {
3188
+ #deferred;
3189
+ /** Opens the dialog, optionally seeding its `state`. @returns A promise resolved with the {@link DialogResultEventArgs} once the dialog is committed. */
3190
+ open(state, rejectOnDeny = false) {
3191
+ const lb = this.lightbox;
3192
+ if (!pacemCore.Utils.isNull(this.#deferred)) {
3193
+ throw `Dialog already open.`;
3194
+ }
3195
+ const deferred = (this.#deferred = { promise: Promise.withResolvers(), rejectOnDeny }).promise;
3196
+ if (this.hide || this.disabled) {
3197
+ this.log(pacemCore.Logging.LogLevel.Warn, 'Dialog hidden or disabled, opening forbidden.');
3198
+ deferred.reject();
3199
+ }
3200
+ else {
3201
+ this.dispatchEvent(new Event('open'));
3202
+ lb.show = true;
3203
+ this.state = state;
3204
+ }
3205
+ return deferred.promise;
3206
+ }
3207
+ /** Closes the dialog with the given button outcome, resolving the pending `open()` promise and dispatching a {@link DialogResultEvent}. */
3208
+ commit(btn, evt) {
3209
+ pacemCore.avoidHandler(evt);
3210
+ this.log(pacemCore.Logging.LogLevel.Debug, `Committing dialog by clicking '${btn}'.`);
3211
+ const state = this.state;
3212
+ var drevt = new DialogResultEvent({ button: btn, state });
3213
+ this.lightbox.show = false;
3214
+ const { promise, rejectOnDeny } = this.#deferred;
3215
+ if (rejectOnDeny) {
3216
+ switch (btn) {
3217
+ case DialogButton.Cancel:
3218
+ case DialogButton.No:
3219
+ promise.reject(drevt.detail);
3220
+ default:
3221
+ promise.resolve(drevt.detail);
3222
+ }
3223
+ }
3224
+ else {
3225
+ promise.resolve(drevt.detail);
3226
+ }
3227
+ this.#deferred = null;
3228
+ this.dispatchEvent(drevt);
3229
+ }
3230
+ }
3231
+ __decorate$r([
3232
+ pacemCore.Watch()
3233
+ ], PacemDialogBase.prototype, "state", void 0);
3234
+
3157
3235
  var __decorate$q = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
3158
3236
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3159
3237
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -5305,8 +5383,11 @@ css-class="{{ ['hour-start-'+ (^item.hour + 1), 'hour-end-'+ (^item.hour + ^item
5305
5383
  content = content.toLocaleString();
5306
5384
  }
5307
5385
  if (typeof content === 'string') {
5386
+ // (sanitizing a string parses it: a fragment comes back)
5308
5387
  const safeContent = this.sanitize(content);
5309
- this.#newContent = this._buildMarkupNode(safeContent);
5388
+ this.#newContent = typeof safeContent === 'string'
5389
+ ? this._buildMarkupNode(safeContent)
5390
+ : Array.from(safeContent.childNodes);
5310
5391
  }
5311
5392
  else if (content instanceof Node) {
5312
5393
  const safeContent = this.sanitize(content);
@@ -6368,14 +6449,16 @@ css-class="{{ ['hour-start-'+ (^item.hour + 1), 'hour-end-'+ (^item.hour + ^item
6368
6449
 
6369
6450
  var indexComponentsUi = /*#__PURE__*/Object.freeze({
6370
6451
  __proto__: null,
6452
+ AVAILABLE_HEIGHT_VAR: AVAILABLE_HEIGHT_VAR,
6371
6453
  get AdapterOrientation () { return AdapterOrientation; },
6372
6454
  AdapterPageButtonRefreshEvent: AdapterPageButtonRefreshEvent,
6373
6455
  AdapterPageButtonRefreshEventName: AdapterPageButtonRefreshEventName,
6374
6456
  get BalloonAlignment () { return BalloonAlignment; },
6375
6457
  get BalloonBehavior () { return BalloonBehavior; },
6458
+ BalloonPlacement: BalloonPlacement,
6376
6459
  BalloonPopoutEventName: BalloonPopoutEventName,
6377
6460
  BalloonPopupEventName: BalloonPopupEventName,
6378
- get BalloonPosition () { return BalloonPosition; },
6461
+ BalloonPosition: BalloonPosition,
6379
6462
  get BalloonSizing () { return BalloonSizing; },
6380
6463
  get BalloonTrigger () { return BalloonTrigger; },
6381
6464
  get BinderAnchor () { return BinderAnchor; },