@threadlabs/looma 0.1.16 → 0.1.17

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 (121) hide show
  1. package/dist/{chunk-SVINNT3E.js → chunk-OY4D3W4U.js} +29 -29
  2. package/dist/{chunk-G53JEAQK.js → chunk-SZJQ3NPX.js} +6 -3
  3. package/dist/chunk-YHXJC5M5.js +341 -0
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/looma.cjs.js +1 -1
  6. package/dist/cjs/{manager-BOpVXb92.js → manager-C9j3HZay.js} +5 -2
  7. package/dist/cjs/positioning-i0WrCAdF.js +384 -0
  8. package/dist/cjs/ui-affordance-scope.cjs.entry.js +3 -113
  9. package/dist/cjs/ui-context-menu.cjs.entry.js +40 -5
  10. package/dist/cjs/ui-dialog.cjs.entry.js +1 -1
  11. package/dist/cjs/ui-menu.cjs.entry.js +83 -2
  12. package/dist/cjs/ui-popover.cjs.entry.js +43 -3
  13. package/dist/cjs/ui-toast-region.cjs.entry.js +17 -2
  14. package/dist/cjs/ui-tooltip.cjs.entry.js +95 -27
  15. package/dist/cjs/ui-tree-item.cjs.entry.js +1 -1
  16. package/dist/collection/components/ui-context-menu/ui-context-menu.css +17 -4
  17. package/dist/collection/components/ui-context-menu/ui-context-menu.js +38 -3
  18. package/dist/collection/components/ui-menu/ui-menu.css +39 -0
  19. package/dist/collection/components/ui-menu/ui-menu.js +128 -1
  20. package/dist/collection/components/ui-popover/ui-popover.css +31 -0
  21. package/dist/collection/components/ui-popover/ui-popover.js +87 -1
  22. package/dist/collection/components/ui-toast-region/ui-toast-region.css +6 -0
  23. package/dist/collection/components/ui-toast-region/ui-toast-region.js +16 -1
  24. package/dist/collection/components/ui-tooltip/ui-tooltip.css +20 -0
  25. package/dist/collection/components/ui-tooltip/ui-tooltip.js +160 -25
  26. package/dist/collection/components/ui-tree-item/ui-tree-item.css +10 -6
  27. package/dist/collection/input-modality.js +24 -0
  28. package/dist/collection/overlay/manager.js +5 -2
  29. package/dist/collection/overlay/positioning.js +246 -0
  30. package/dist/components/p-CEYIKqYc.js +1 -0
  31. package/dist/components/p-DOulVJT7.js +1 -0
  32. package/dist/components/p-PM9a74r7.js +1 -0
  33. package/dist/components/ui-affordance-scope.js +1 -1
  34. package/dist/components/ui-context-menu.js +1 -1
  35. package/dist/components/ui-dialog.js +1 -1
  36. package/dist/components/ui-menu.js +1 -1
  37. package/dist/components/ui-popover.js +1 -1
  38. package/dist/components/ui-toast-region.js +1 -1
  39. package/dist/components/ui-tooltip.js +1 -1
  40. package/dist/components/ui-tree-item.js +1 -1
  41. package/dist/esm/loader.js +1 -1
  42. package/dist/esm/looma.js +1 -1
  43. package/dist/esm/{manager-CR7f2MQC.js → manager-PM9a74r7.js} +5 -2
  44. package/dist/esm/positioning-Bu0dmLBE.js +379 -0
  45. package/dist/esm/ui-affordance-scope.entry.js +1 -111
  46. package/dist/esm/ui-context-menu.entry.js +40 -5
  47. package/dist/esm/ui-dialog.entry.js +1 -1
  48. package/dist/esm/ui-menu.entry.js +83 -2
  49. package/dist/esm/ui-popover.entry.js +43 -3
  50. package/dist/esm/ui-toast-region.entry.js +17 -2
  51. package/dist/esm/ui-tooltip.entry.js +95 -27
  52. package/dist/esm/ui-tree-item.entry.js +1 -1
  53. package/dist/index.cjs +776 -59
  54. package/dist/index.d.cts +44 -1
  55. package/dist/index.d.ts +44 -1
  56. package/dist/index.js +235 -4
  57. package/dist/looma/looma.esm.js +1 -1
  58. package/dist/looma/{p-c6721aba.entry.js → p-11083743.entry.js} +1 -1
  59. package/dist/looma/p-1674cda4.entry.js +1 -0
  60. package/dist/looma/p-2e6f791e.entry.js +1 -0
  61. package/dist/looma/p-54c41576.entry.js +1 -0
  62. package/dist/looma/p-9194a99d.entry.js +1 -0
  63. package/dist/looma/p-Bu0dmLBE.js +1 -0
  64. package/dist/looma/p-PM9a74r7.js +1 -0
  65. package/dist/looma/p-ba01f45d.entry.js +1 -0
  66. package/dist/looma/p-caa8fc7b.entry.js +1 -0
  67. package/dist/looma/{p-ef9ca2ed.entry.js → p-d01960c2.entry.js} +2 -2
  68. package/dist/types/components/ui-context-menu/ui-context-menu.d.ts +3 -0
  69. package/dist/types/components/ui-menu/ui-menu.d.ts +13 -0
  70. package/dist/types/components/ui-popover/ui-popover.d.ts +9 -0
  71. package/dist/types/components/ui-toast-region/ui-toast-region.d.ts +2 -0
  72. package/dist/types/components/ui-tooltip/ui-tooltip.d.ts +16 -1
  73. package/dist/types/components.d.ts +71 -0
  74. package/dist/types/input-modality.d.ts +6 -0
  75. package/dist/types/overlay/manager.d.ts +3 -0
  76. package/dist/types/overlay/positioning.d.ts +33 -0
  77. package/dist/ui-affordance-scope.entry-X7DTKJGL.js +54 -0
  78. package/dist/{ui-avatar-group.entry-DQDP325O.js → ui-avatar-group.entry-MC34FKAN.js} +1 -1
  79. package/dist/{ui-avatar.entry-WYIDMOFE.js → ui-avatar.entry-OKRQWTQV.js} +1 -1
  80. package/dist/{ui-badge.entry-VGHXPEDT.js → ui-badge.entry-RI7JB7KV.js} +1 -1
  81. package/dist/{ui-button.entry-LKPLOJ22.js → ui-button.entry-PFO5TTPN.js} +1 -1
  82. package/dist/{ui-checkbox.entry-J74HEA22.js → ui-checkbox.entry-UHFWVISP.js} +1 -1
  83. package/dist/{ui-context-menu.entry-MQM2FCLI.js → ui-context-menu.entry-AIXB6U5D.js} +40 -6
  84. package/dist/{ui-dialog.entry-DQMMDO4Z.js → ui-dialog.entry-LPREQH2T.js} +2 -2
  85. package/dist/{ui-disclosure.entry-ONF7UZDC.js → ui-disclosure.entry-7XCUIYVZ.js} +1 -1
  86. package/dist/{ui-floating-action-button.entry-FKTGVC5T.js → ui-floating-action-button.entry-5PNIMUAW.js} +1 -1
  87. package/dist/{ui-form-field.entry-M3ISWQNU.js → ui-form-field.entry-77YW46SM.js} +1 -1
  88. package/dist/{ui-icon-button.entry-AWFIQUHM.js → ui-icon-button.entry-4AD6ALPQ.js} +1 -1
  89. package/dist/{ui-input.entry-JZ6RETMT.js → ui-input.entry-E7E6QDTV.js} +1 -1
  90. package/dist/{ui-menu-item.entry-5MFR5LFL.js → ui-menu-item.entry-H3HFLUB6.js} +1 -1
  91. package/dist/ui-menu.entry-UAKZU4HG.js +184 -0
  92. package/dist/{ui-popover.entry-ELCMKO6Y.js → ui-popover.entry-GVQKX26B.js} +46 -4
  93. package/dist/{ui-radio-group.entry-RJHUPPEM.js → ui-radio-group.entry-MNSR6UEE.js} +1 -1
  94. package/dist/{ui-radio.entry-3VRDPOY4.js → ui-radio.entry-6D4WTI5E.js} +1 -1
  95. package/dist/{ui-search-result-row.entry-J34YPAV7.js → ui-search-result-row.entry-J2TILUH2.js} +1 -1
  96. package/dist/{ui-search-shell.entry-IJ4UUP27.js → ui-search-shell.entry-FSWHEZQF.js} +1 -1
  97. package/dist/{ui-select.entry-C6YD3HQ5.js → ui-select.entry-JRCYYNNW.js} +1 -1
  98. package/dist/{ui-switch.entry-UZDF5QTI.js → ui-switch.entry-YZWMNRP2.js} +1 -1
  99. package/dist/{ui-tabs.entry-YRAKWOMR.js → ui-tabs.entry-F2Y344JY.js} +1 -1
  100. package/dist/{ui-textarea.entry-JLDKFT3K.js → ui-textarea.entry-3EZCUUAK.js} +1 -1
  101. package/dist/{ui-toast-region.entry-GC7C7KXF.js → ui-toast-region.entry-BTV4AW3I.js} +20 -3
  102. package/dist/ui-tooltip.entry-U644CF5U.js +214 -0
  103. package/dist/{ui-top-bar.entry-5W5UA5KV.js → ui-top-bar.entry-FGGOREQR.js} +1 -1
  104. package/dist/{ui-tree-item.entry-3LM7IXIK.js → ui-tree-item.entry-XVMHEONY.js} +2 -2
  105. package/dist/{ui-tree.entry-X4FU42A6.js → ui-tree.entry-4R7DYGAM.js} +1 -1
  106. package/editor.css +3 -4
  107. package/package.json +1 -1
  108. package/tokens.css +14 -2
  109. package/vue/editor/index.js +62 -51
  110. package/dist/components/p-CR7f2MQC.js +0 -1
  111. package/dist/components/p-QiwSQmKJ.js +0 -1
  112. package/dist/looma/p-2ae73d5b.entry.js +0 -1
  113. package/dist/looma/p-3ac2e0d4.entry.js +0 -1
  114. package/dist/looma/p-65c25c94.entry.js +0 -1
  115. package/dist/looma/p-8c09c724.entry.js +0 -1
  116. package/dist/looma/p-95cd639d.entry.js +0 -1
  117. package/dist/looma/p-96f73d07.entry.js +0 -1
  118. package/dist/looma/p-CR7f2MQC.js +0 -1
  119. package/dist/ui-affordance-scope.entry-PFP2TDKO.js +0 -145
  120. package/dist/ui-menu.entry-IOEIDATQ.js +0 -98
  121. package/dist/ui-tooltip.entry-F26XDTYX.js +0 -145
@@ -12,6 +12,45 @@
12
12
  box-shadow: var(--ui-shadow-lg);
13
13
  }
14
14
 
15
+ :host(:not([data-open])) {
16
+ display: none;
17
+ }
18
+
19
+ :host([popover]) {
20
+ position: fixed;
21
+ inset: auto;
22
+ margin: 0;
23
+ overflow: auto;
24
+ max-block-size: calc(100dvh - (var(--ui-menu-viewport-gap) * 2));
25
+ opacity: 0;
26
+ transform: translateY(-4px) scale(0.99);
27
+ transition:
28
+ opacity var(--ui-motion-fast) var(--ui-motion-ease),
29
+ transform var(--ui-motion-fast) var(--ui-motion-ease),
30
+ display var(--ui-motion-fast) allow-discrete,
31
+ overlay var(--ui-motion-fast) allow-discrete;
32
+ }
33
+
34
+ :host([popover]:popover-open) {
35
+ opacity: 1;
36
+ transform: translateY(0) scale(1);
37
+ }
38
+
39
+ @starting-style {
40
+ :host([popover]:popover-open) {
41
+ opacity: 0;
42
+ transform: translateY(-4px) scale(0.99);
43
+ }
44
+ }
45
+
46
+ :host([hidden]) {
47
+ display: none !important;
48
+ }
49
+
50
+ @media (prefers-reduced-motion: reduce) {
51
+ :host([popover]) { transition: none; }
52
+ }
53
+
15
54
  ::slotted(ui-menu-item) {
16
55
  display: block;
17
56
  width: 100%;
@@ -1,23 +1,90 @@
1
1
  import { Host, h } from "@stencil/core";
2
2
  import { eventToTrigger } from "../../utils/events";
3
3
  import { dispatchDetail } from "../../utils/events";
4
+ import { closeOverlay, openOverlay, requestTopOverlayClose } from "../../overlay/manager";
5
+ import { createAnchoredSurface, } from "../../overlay/positioning";
4
6
  export class UIMenu {
5
7
  host;
6
8
  open = false;
7
9
  defaultOpen = false;
10
+ /** Id of the control that anchors this menu in the top layer. */
11
+ for;
12
+ /** Preferred placement; Looma flips and shifts when space is constrained. */
13
+ placement = 'bottom-start';
8
14
  internalOpen = false;
15
+ overlayId = `ui-menu-${Math.random().toString(36).slice(2, 11)}`;
16
+ anchor = null;
17
+ surface = null;
9
18
  syncFromProp() {
10
19
  this.internalOpen = this.open;
11
20
  }
21
+ resetSurface() {
22
+ this.setupSurface();
23
+ this.syncSurface();
24
+ }
25
+ syncSurface() {
26
+ this.syncAnchorState();
27
+ if (!this.surface)
28
+ return;
29
+ if (this.internalOpen) {
30
+ this.surface.show();
31
+ openOverlay({
32
+ id: this.overlayId,
33
+ modal: false,
34
+ element: this.host,
35
+ relatedElements: this.anchor ? [this.anchor] : undefined,
36
+ dismissible: true,
37
+ requestClose: (reason, trigger) => this.closeMenu(reason, trigger),
38
+ });
39
+ }
40
+ else {
41
+ this.surface.hide();
42
+ closeOverlay(this.overlayId);
43
+ }
44
+ }
12
45
  componentDidLoad() {
13
46
  this.syncFromProp();
14
47
  this.internalOpen = this.internalOpen || this.defaultOpen;
15
48
  this.host.addEventListener('click', this.onItemClick);
16
49
  this.host.addEventListener('keydown', this.onKeydown);
50
+ this.setupSurface();
51
+ this.syncSurface();
17
52
  }
18
53
  disconnectedCallback() {
19
54
  this.host.removeEventListener('click', this.onItemClick);
20
55
  this.host.removeEventListener('keydown', this.onKeydown);
56
+ this.surface?.destroy();
57
+ this.surface = null;
58
+ closeOverlay(this.overlayId);
59
+ }
60
+ setupSurface() {
61
+ this.surface?.destroy();
62
+ this.surface = null;
63
+ this.anchor = this.for ? this.host.ownerDocument.getElementById(this.for) : null;
64
+ if (!this.anchor)
65
+ return;
66
+ this.surface = createAnchoredSurface(this.host, {
67
+ anchor: this.anchor,
68
+ placement: this.placement,
69
+ });
70
+ }
71
+ syncAnchorState() {
72
+ if (!this.anchor)
73
+ return;
74
+ this.anchor.setAttribute('aria-haspopup', 'menu');
75
+ this.anchor.setAttribute('aria-expanded', this.internalOpen ? 'true' : 'false');
76
+ }
77
+ closeMenu(reason, trigger) {
78
+ if (!this.internalOpen)
79
+ return;
80
+ this.internalOpen = false;
81
+ dispatchDetail(this.host, 'close', {
82
+ open: false,
83
+ reason: reason,
84
+ trigger: trigger,
85
+ });
86
+ if (reason === 'escape')
87
+ this.anchor?.focus();
21
88
  }
22
89
  getItems() {
23
90
  return Array.from(this.host.querySelectorAll('ui-menu-item'));
@@ -44,6 +111,11 @@ export class UIMenu {
44
111
  this.internalOpen = false;
45
112
  };
46
113
  onKeydown = (e) => {
114
+ if (e.key === 'Escape') {
115
+ e.preventDefault();
116
+ requestTopOverlayClose('escape', 'keyboard');
117
+ return;
118
+ }
47
119
  const items = this.getItems().filter((i) => !this.isItemDisabled(i));
48
120
  if (items.length === 0)
49
121
  return;
@@ -76,7 +148,7 @@ export class UIMenu {
76
148
  }
77
149
  };
78
150
  render() {
79
- return (h(Host, { key: '5e463cbbce272c6b6132a839b818deef3e39a532', role: "menu", "aria-orientation": "vertical", "data-open": this.internalOpen ? '' : undefined }, h("slot", { key: 'feea6a21d41a7b27a6270814bcf0b3f3ded394a1' })));
151
+ return (h(Host, { key: '06ad0750df843cb874bd4f257d8567157c855493', role: "menu", "aria-orientation": "vertical", "data-open": this.internalOpen ? '' : undefined }, h("slot", { key: '50118ac749a2747ca06f4d483499c4cd20125a89' })));
80
152
  }
81
153
  static get is() { return "ui-menu"; }
82
154
  static get encapsulation() { return "shadow"; }
@@ -131,6 +203,52 @@ export class UIMenu {
131
203
  "reflect": false,
132
204
  "attribute": "default-open",
133
205
  "defaultValue": "false"
206
+ },
207
+ "for": {
208
+ "type": "string",
209
+ "mutable": false,
210
+ "complexType": {
211
+ "original": "string",
212
+ "resolved": "string",
213
+ "references": {}
214
+ },
215
+ "required": false,
216
+ "optional": true,
217
+ "docs": {
218
+ "tags": [],
219
+ "text": "Id of the control that anchors this menu in the top layer."
220
+ },
221
+ "getter": false,
222
+ "setter": false,
223
+ "reflect": false,
224
+ "attribute": "for"
225
+ },
226
+ "placement": {
227
+ "type": "string",
228
+ "mutable": false,
229
+ "complexType": {
230
+ "original": "AnchoredPlacement",
231
+ "resolved": "\"bottom-end\" | \"bottom-start\" | \"top-end\" | \"top-start\"",
232
+ "references": {
233
+ "AnchoredPlacement": {
234
+ "location": "import",
235
+ "path": "../../overlay/positioning",
236
+ "id": "src/overlay/positioning.ts::AnchoredPlacement",
237
+ "referenceLocation": "AnchoredPlacement"
238
+ }
239
+ }
240
+ },
241
+ "required": false,
242
+ "optional": false,
243
+ "docs": {
244
+ "tags": [],
245
+ "text": "Preferred placement; Looma flips and shifts when space is constrained."
246
+ },
247
+ "getter": false,
248
+ "setter": false,
249
+ "reflect": false,
250
+ "attribute": "placement",
251
+ "defaultValue": "'bottom-start'"
134
252
  }
135
253
  };
136
254
  }
@@ -144,6 +262,15 @@ export class UIMenu {
144
262
  return [{
145
263
  "propName": "open",
146
264
  "methodName": "syncFromProp"
265
+ }, {
266
+ "propName": "for",
267
+ "methodName": "resetSurface"
268
+ }, {
269
+ "propName": "placement",
270
+ "methodName": "resetSurface"
271
+ }, {
272
+ "propName": "internalOpen",
273
+ "methodName": "syncSurface"
147
274
  }];
148
275
  }
149
276
  }
@@ -12,3 +12,34 @@
12
12
  max-block-size: calc(100dvh - (var(--ui-popover-viewport-gap) * 2));
13
13
  overflow: auto;
14
14
  }
15
+
16
+ :host(:not([data-open])) {
17
+ display: none;
18
+ }
19
+
20
+ :host([popover]) {
21
+ position: fixed;
22
+ inset: auto;
23
+ margin: 0;
24
+ opacity: 0;
25
+ transform: translateY(-4px) scale(0.99);
26
+ transition:
27
+ opacity var(--ui-motion-fast) var(--ui-motion-ease),
28
+ transform var(--ui-motion-fast) var(--ui-motion-ease),
29
+ display var(--ui-motion-fast) allow-discrete,
30
+ overlay var(--ui-motion-fast) allow-discrete;
31
+ }
32
+
33
+ :host([popover]:popover-open) { opacity: 1; transform: translateY(0) scale(1); }
34
+
35
+ @starting-style {
36
+ :host([popover]:popover-open) { opacity: 0; transform: translateY(-4px) scale(0.99); }
37
+ }
38
+
39
+ :host([hidden]) {
40
+ display: none !important;
41
+ }
42
+
43
+ @media (prefers-reduced-motion: reduce) {
44
+ :host([popover]) { transition: none; }
45
+ }
@@ -1,12 +1,18 @@
1
1
  import { Host, h } from "@stencil/core";
2
2
  import { openOverlay, closeOverlay, requestTopOverlayClose } from "../../overlay/manager";
3
3
  import { dispatchDetail } from "../../utils/events";
4
+ import { createAnchoredSurface, } from "../../overlay/positioning";
4
5
  export class UIPopover {
5
6
  host;
6
7
  open = false;
7
8
  defaultOpen = false;
9
+ /** Optional id of the element this popover follows in the top layer. */
10
+ for;
11
+ placement = 'bottom-start';
8
12
  internalOpen = false;
9
13
  overlayId = `ui-popover-${Math.random().toString(36).slice(2, 11)}`;
14
+ anchor = null;
15
+ surface = null;
10
16
  syncFromProp() {
11
17
  this.internalOpen = this.open;
12
18
  }
@@ -27,12 +33,37 @@ export class UIPopover {
27
33
  });
28
34
  }
29
35
  }
36
+ resetSurface() {
37
+ this.setupSurface();
38
+ this.syncSurface();
39
+ }
40
+ setupSurface() {
41
+ this.surface?.destroy();
42
+ this.surface = null;
43
+ this.anchor = this.for ? this.host.ownerDocument.getElementById(this.for) : null;
44
+ if (!this.anchor)
45
+ return;
46
+ this.surface = createAnchoredSurface(this.host, {
47
+ anchor: this.anchor,
48
+ placement: this.placement,
49
+ });
50
+ }
51
+ syncSurface() {
52
+ if (!this.surface)
53
+ return;
54
+ if (this.internalOpen)
55
+ this.surface.show();
56
+ else
57
+ this.surface.hide();
58
+ }
30
59
  syncOverlay() {
60
+ this.syncSurface();
31
61
  if (this.internalOpen) {
32
62
  openOverlay({
33
63
  id: this.overlayId,
34
64
  modal: false,
35
65
  element: this.host,
66
+ relatedElements: this.anchor ? [this.anchor] : undefined,
36
67
  dismissible: true,
37
68
  requestClose: (reason, trigger) => this.handleRequestClose(reason, trigger),
38
69
  });
@@ -45,10 +76,13 @@ export class UIPopover {
45
76
  this.syncFromProp();
46
77
  this.internalOpen = this.internalOpen || this.defaultOpen;
47
78
  this.host.addEventListener('keydown', this.onKeydown);
79
+ this.setupSurface();
48
80
  this.syncOverlay();
49
81
  }
50
82
  disconnectedCallback() {
51
83
  this.host.removeEventListener('keydown', this.onKeydown);
84
+ this.surface?.destroy();
85
+ this.surface = null;
52
86
  closeOverlay(this.overlayId);
53
87
  }
54
88
  componentDidUpdate() {
@@ -68,7 +102,7 @@ export class UIPopover {
68
102
  }
69
103
  };
70
104
  render() {
71
- return (h(Host, { key: '67e7f52220db9d997fb11b686d6abcbdf9557a8d', "data-open": this.internalOpen ? '' : undefined, onKeyDown: this.onKeydown }, h("slot", { key: 'd7c1fa2ab75994fe0a7dd63f8289754c7754c30f' })));
105
+ return (h(Host, { key: '8e45be54147ff8f76a0d5e7fd875c3f4cf5ac40a', "data-open": this.internalOpen ? '' : undefined, onKeyDown: this.onKeydown }, h("slot", { key: '3141729cd32c8dcdaec1fbd763eb034242563c8f' })));
72
106
  }
73
107
  static get is() { return "ui-popover"; }
74
108
  static get encapsulation() { return "shadow"; }
@@ -123,6 +157,52 @@ export class UIPopover {
123
157
  "reflect": false,
124
158
  "attribute": "default-open",
125
159
  "defaultValue": "false"
160
+ },
161
+ "for": {
162
+ "type": "string",
163
+ "mutable": false,
164
+ "complexType": {
165
+ "original": "string",
166
+ "resolved": "string",
167
+ "references": {}
168
+ },
169
+ "required": false,
170
+ "optional": true,
171
+ "docs": {
172
+ "tags": [],
173
+ "text": "Optional id of the element this popover follows in the top layer."
174
+ },
175
+ "getter": false,
176
+ "setter": false,
177
+ "reflect": false,
178
+ "attribute": "for"
179
+ },
180
+ "placement": {
181
+ "type": "string",
182
+ "mutable": false,
183
+ "complexType": {
184
+ "original": "AnchoredPlacement",
185
+ "resolved": "\"bottom-end\" | \"bottom-start\" | \"top-end\" | \"top-start\"",
186
+ "references": {
187
+ "AnchoredPlacement": {
188
+ "location": "import",
189
+ "path": "../../overlay/positioning",
190
+ "id": "src/overlay/positioning.ts::AnchoredPlacement",
191
+ "referenceLocation": "AnchoredPlacement"
192
+ }
193
+ }
194
+ },
195
+ "required": false,
196
+ "optional": false,
197
+ "docs": {
198
+ "tags": [],
199
+ "text": ""
200
+ },
201
+ "getter": false,
202
+ "setter": false,
203
+ "reflect": false,
204
+ "attribute": "placement",
205
+ "defaultValue": "'bottom-start'"
126
206
  }
127
207
  };
128
208
  }
@@ -139,6 +219,12 @@ export class UIPopover {
139
219
  }, {
140
220
  "propName": "internalOpen",
141
221
  "methodName": "onOpenChange"
222
+ }, {
223
+ "propName": "for",
224
+ "methodName": "resetSurface"
225
+ }, {
226
+ "propName": "placement",
227
+ "methodName": "resetSurface"
142
228
  }];
143
229
  }
144
230
  }
@@ -11,6 +11,12 @@
11
11
  pointer-events: none;
12
12
  }
13
13
 
14
+ :host([popover]) {
15
+ right: auto;
16
+ bottom: auto;
17
+ margin: 0;
18
+ }
19
+
14
20
  :host > * {
15
21
  pointer-events: auto;
16
22
  }
@@ -1,19 +1,31 @@
1
1
  import { Host, h } from "@stencil/core";
2
2
  import { eventToTrigger } from "../../utils/events";
3
3
  import { dispatchDetail } from "../../utils/events";
4
+ import { createViewportSurface } from "../../overlay/positioning";
4
5
  export class UIToastRegion {
5
6
  host;
6
7
  open = true;
7
8
  internalOpen = true;
9
+ surface = null;
8
10
  syncFromProp() {
9
11
  this.internalOpen = this.open;
10
12
  }
13
+ syncSurface() {
14
+ if (this.internalOpen)
15
+ this.surface?.show();
16
+ else
17
+ this.surface?.hide();
18
+ }
11
19
  componentDidLoad() {
20
+ this.surface = createViewportSurface(this.host);
12
21
  this.syncFromProp();
22
+ this.syncSurface();
13
23
  this.host.addEventListener('click', this.onClick);
14
24
  }
15
25
  disconnectedCallback() {
16
26
  this.host.removeEventListener('click', this.onClick);
27
+ this.surface?.destroy();
28
+ this.surface = null;
17
29
  }
18
30
  getToasts() {
19
31
  return Array.from(this.host.querySelectorAll('[data-ui-toast]'));
@@ -47,7 +59,7 @@ export class UIToastRegion {
47
59
  }
48
60
  };
49
61
  render() {
50
- return (h(Host, { key: '0edcce54864ba991b092d004d3b45cf697b9c3ac', role: "region", "aria-label": "Notifications", "data-open": this.internalOpen ? '' : undefined }, h("slot", { key: '2e30794a05b018fb55c4313c8e17f7262ecee7da' })));
62
+ return (h(Host, { key: '693e24016ec0881a4d619a489f1b655feee41784', role: "region", "aria-label": "Notifications", "data-open": this.internalOpen ? '' : undefined }, h("slot", { key: 'e666b2a73a5d7eb8dd607df3d1c5135b78cf3775' })));
51
63
  }
52
64
  static get is() { return "ui-toast-region"; }
53
65
  static get encapsulation() { return "shadow"; }
@@ -95,6 +107,9 @@ export class UIToastRegion {
95
107
  return [{
96
108
  "propName": "open",
97
109
  "methodName": "syncFromProp"
110
+ }, {
111
+ "propName": "internalOpen",
112
+ "methodName": "syncSurface"
98
113
  }];
99
114
  }
100
115
  }
@@ -1,4 +1,7 @@
1
1
  :host {
2
+ position: fixed;
3
+ inset: auto;
4
+ margin: 0;
2
5
  display: inline-block;
3
6
  border: 1px solid var(--ui-border-default);
4
7
  border-radius: var(--ui-radius-2);
@@ -7,8 +10,25 @@
7
10
  padding: var(--ui-space-2) var(--ui-space-3);
8
11
  font-size: var(--ui-font-size-sm);
9
12
  box-shadow: var(--ui-shadow-md);
13
+ opacity: 0;
14
+ transform: translateY(4px);
15
+ transition:
16
+ opacity var(--ui-motion-fast) var(--ui-motion-ease),
17
+ transform var(--ui-motion-fast) var(--ui-motion-ease),
18
+ display var(--ui-motion-fast) allow-discrete,
19
+ overlay var(--ui-motion-fast) allow-discrete;
20
+ }
21
+
22
+ :host(:popover-open) { opacity: 1; transform: translateY(0); }
23
+
24
+ @starting-style {
25
+ :host(:popover-open) { opacity: 0; transform: translateY(4px); }
10
26
  }
11
27
 
12
28
  :host([hidden]) {
13
29
  display: none !important;
14
30
  }
31
+
32
+ @media (prefers-reduced-motion: reduce) {
33
+ :host { transition: none; }
34
+ }