@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.170 → 2.0.0-next.171

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 (78) hide show
  1. package/bundle/openbridge-webcomponents.bundle.js +870 -441
  2. package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
  3. package/custom-elements.json +1110 -383
  4. package/dist/ar/poi/poi-aton.d.ts +1 -0
  5. package/dist/ar/poi/poi-aton.d.ts.map +1 -1
  6. package/dist/ar/poi/poi-aton.js +1 -0
  7. package/dist/ar/poi/poi-aton.js.map +1 -1
  8. package/dist/ar/poi/poi-base.d.ts +39 -5
  9. package/dist/ar/poi/poi-base.d.ts.map +1 -1
  10. package/dist/ar/poi/poi-base.js +108 -37
  11. package/dist/ar/poi/poi-base.js.map +1 -1
  12. package/dist/ar/poi/poi-data.d.ts +1 -0
  13. package/dist/ar/poi/poi-data.d.ts.map +1 -1
  14. package/dist/ar/poi/poi-data.js +1 -0
  15. package/dist/ar/poi/poi-data.js.map +1 -1
  16. package/dist/ar/poi/poi-vessel.d.ts +1 -0
  17. package/dist/ar/poi/poi-vessel.d.ts.map +1 -1
  18. package/dist/ar/poi/poi-vessel.js +1 -0
  19. package/dist/ar/poi/poi-vessel.js.map +1 -1
  20. package/dist/ar/poi/poi.d.ts +4 -12
  21. package/dist/ar/poi/poi.d.ts.map +1 -1
  22. package/dist/ar/poi/poi.js +6 -72
  23. package/dist/ar/poi/poi.js.map +1 -1
  24. package/dist/ar/poi-button/poi-button.d.ts +6 -2
  25. package/dist/ar/poi-button/poi-button.d.ts.map +1 -1
  26. package/dist/ar/poi-button/poi-button.js +10 -1
  27. package/dist/ar/poi-button/poi-button.js.map +1 -1
  28. package/dist/ar/poi-card/poi-card.d.ts +12 -1
  29. package/dist/ar/poi-card/poi-card.d.ts.map +1 -1
  30. package/dist/ar/poi-card/poi-card.js +4 -1
  31. package/dist/ar/poi-card/poi-card.js.map +1 -1
  32. package/dist/ar/poi-controller/poi-controller.d.ts +45 -1
  33. package/dist/ar/poi-controller/poi-controller.d.ts.map +1 -1
  34. package/dist/ar/poi-controller/poi-controller.js +72 -14
  35. package/dist/ar/poi-controller/poi-controller.js.map +1 -1
  36. package/dist/ar/poi-group/poi-group.d.ts +28 -5
  37. package/dist/ar/poi-group/poi-group.d.ts.map +1 -1
  38. package/dist/ar/poi-group/poi-group.js +50 -7
  39. package/dist/ar/poi-group/poi-group.js.map +1 -1
  40. package/dist/ar/poi-layer/poi-layer.css.js +69 -18
  41. package/dist/ar/poi-layer/poi-layer.css.js.map +1 -1
  42. package/dist/ar/poi-layer/poi-layer.d.ts +64 -5
  43. package/dist/ar/poi-layer/poi-layer.d.ts.map +1 -1
  44. package/dist/ar/poi-layer/poi-layer.js +173 -39
  45. package/dist/ar/poi-layer/poi-layer.js.map +1 -1
  46. package/dist/ar/poi-layer-stack/poi-layer-stack.d.ts +82 -7
  47. package/dist/ar/poi-layer-stack/poi-layer-stack.d.ts.map +1 -1
  48. package/dist/ar/poi-layer-stack/poi-layer-stack.js +172 -100
  49. package/dist/ar/poi-layer-stack/poi-layer-stack.js.map +1 -1
  50. package/dist/ar/poi-projection/poi-projection.d.ts +88 -0
  51. package/dist/ar/poi-projection/poi-projection.d.ts.map +1 -0
  52. package/dist/ar/poi-projection/poi-projection.js +90 -0
  53. package/dist/ar/poi-projection/poi-projection.js.map +1 -0
  54. package/docs/MigrationGuide.mdx +61 -5
  55. package/docs/migration-guide/a11y-labels.md +8 -0
  56. package/docs/migration-guide/api-automation.md +1 -0
  57. package/package.json +2 -2
  58. package/src/ar/_test-utils.ts +18 -6
  59. package/src/ar/poi/poi-aton.ts +2 -0
  60. package/src/ar/poi/poi-base.ts +159 -70
  61. package/src/ar/poi/poi-data.ts +2 -0
  62. package/src/ar/poi/poi-dom-ownership.spec.ts +393 -0
  63. package/src/ar/poi/poi-vessel.ts +2 -0
  64. package/src/ar/poi/poi.ts +12 -113
  65. package/src/ar/poi-button/poi-button.ts +25 -3
  66. package/src/ar/poi-card/poi-card.ts +16 -2
  67. package/src/ar/poi-controller/poi-controller.spec.ts +54 -0
  68. package/src/ar/poi-controller/poi-controller.stories.ts +76 -24
  69. package/src/ar/poi-controller/poi-controller.ts +111 -41
  70. package/src/ar/poi-group/poi-group.stories.ts +18 -5
  71. package/src/ar/poi-group/poi-group.ts +87 -12
  72. package/src/ar/poi-layer/poi-layer.css +69 -18
  73. package/src/ar/poi-layer/poi-layer.stories.ts +30 -16
  74. package/src/ar/poi-layer/poi-layer.ts +289 -64
  75. package/src/ar/poi-layer-stack/poi-layer-stack.stories.ts +56 -23
  76. package/src/ar/poi-layer-stack/poi-layer-stack.ts +342 -247
  77. package/src/ar/poi-projection/poi-projection.stories.ts +100 -0
  78. package/src/ar/poi-projection/poi-projection.ts +147 -0
@@ -37,14 +37,14 @@ export type ExpandEvent = CustomEvent<{expand: boolean}>;
37
37
  * - Front-target handling: Keeps one front target visually prioritized while collapsing other targets into overlap state.
38
38
  * - Backdrop interaction: Shows a backdrop while expanded and collapses on backdrop click.
39
39
  * - Dynamic ordering: `internalSwapping` enables reordering while expanded based on current horizontal positions.
40
- * - Vertical placement: `positionVertical` sets the wrapper/group top offset used for collapsed positioning.
40
+ * - Vertical placement: `positionVertical` (attribute `position-vertical`) sets the wrapper/group top offset used for collapsed positioning.
41
41
  *
42
42
  * ### Usage Guidelines
43
43
  * - Slot only `obc-poi-data` items that should behave as one grouped target set.
44
44
  * - Control expand/collapse via the `expand` property, or let the built-in wrapper button toggle expansion.
45
45
  * - Use the `expand` event detail to synchronize nearby standalone targets (for example, set outside targets to overlapped while this group is open).
46
- * - Treat `collapsing` as component-managed runtime state unless you have a specific orchestration need.
47
- * - **TODO(designer):** Confirm whether external consumers should set `collapsing` directly, or if it should remain fully internal.
46
+ * - Treat `collapsing` as orchestration state: it is set by the group itself and by coordinating containers such as `obc-poi-layer-stack` during collapse animations. Do not set it directly.
47
+ * - `internalSwapping` is usually set via `obc-poi-layer`'s `internal-swapping` attribute, which forwards it to auto-created groups; set it directly only on manually managed groups.
48
48
  *
49
49
  * ### Slots
50
50
  * | Slot | Renders When... | Purpose |
@@ -54,6 +54,7 @@ export type ExpandEvent = CustomEvent<{expand: boolean}>;
54
54
  * ### Events
55
55
  * - `expand` - Fired when expand state changes. Detail: `{ expand: boolean }`.
56
56
  * - `collapse-finished` - Fired when the collapse animation has fully completed.
57
+ * - `obc-poi-group-target-released` - Fired after `releaseTarget()` returns a target to the group's parent context: re-parented for consumer-managed groups, re-assigned to the layer's main slot for layer-created auto groups. Detail: `{ target: Poi }`.
57
58
  *
58
59
  * ### Best Practices
59
60
  * - Keep grouped targets positioned consistently so wrapper bounds and front-target selection remain stable.
@@ -62,24 +63,31 @@ export type ExpandEvent = CustomEvent<{expand: boolean}>;
62
63
  *
63
64
  * ### Example
64
65
  * ```html
65
- * <obc-poi-group positionVertical="240px">
66
+ * <obc-poi-group position-vertical="240px">
66
67
  * <obc-poi-data x="300" button-y="240" y="240"></obc-poi-data>
67
68
  * <obc-poi-data x="320" button-y="240" y="240"></obc-poi-data>
68
69
  * <obc-poi-data x="340" button-y="240" y="240"></obc-poi-data>
69
70
  * </obc-poi-group>
70
71
  * ```
71
72
  *
73
+ * @property collapsing - Collapse-animation state. Set by the group itself and by coordinating
74
+ * containers such as `obc-poi-layer-stack` during collapse orchestration;
75
+ * do not set it directly.
76
+ * @property internalSwapping - Reorders expanded targets when their horizontal positions cross. Usually
77
+ * set via `obc-poi-layer`'s `internal-swapping` attribute, which forwards it
78
+ * to auto-created groups; set it directly only on manually managed groups.
72
79
  * @slot - Default slot for grouped `obc-poi-data` targets.
73
80
  * @fires {CustomEvent<{expand:boolean}>} expand - Fired when the group expand state changes.
74
81
  * @fires {CustomEvent<void>} collapse-finished - Fired after collapse animation completes.
75
- * @fires {CustomEvent<{target: Poi}>} obc-poi-group-target-released - Fired after a target leaves the group and has been re-inserted before it in the parent. Bubbles and is composed.
82
+ * @fires {CustomEvent<{target: Poi}>} obc-poi-group-target-released - Fired after `releaseTarget()` returns a target to the group's parent context (re-parented for consumer-managed groups, re-assigned for auto groups) — immediately when the group is collapsed, or once the collapse animation completes. Bubbles and is composed.
76
83
  * @experimental
77
84
  */
78
85
  @customElement('obc-poi-group')
79
86
  export class ObcPoiGroup extends LitElement {
80
87
  @property({type: Boolean}) expand = false;
81
88
  @property({type: Boolean}) collapsing = false;
82
- @property({type: String}) positionVertical = '0px';
89
+ @property({type: String, attribute: 'position-vertical'})
90
+ positionVertical = '0px';
83
91
  @property({type: Boolean, attribute: 'internal-swapping'})
84
92
  internalSwapping = false;
85
93
  @state() private wrapperOffsetX = '0px';
@@ -278,10 +286,49 @@ export class ObcPoiGroup extends LitElement {
278
286
  });
279
287
  };
280
288
 
289
+ /**
290
+ * Membership check that works for both light-DOM children (manual groups)
291
+ * and slot-assigned members (layer-created auto groups, where the member
292
+ * stays in the consumer's light DOM and is assigned into this group's
293
+ * member slot).
294
+ */
295
+ private isMember(child: HTMLElement): boolean {
296
+ return (
297
+ child.parentElement === this || child.assignedSlot?.parentElement === this
298
+ );
299
+ }
300
+
301
+ private getMemberSlot(): HTMLSlotElement | null {
302
+ return this.querySelector(
303
+ ':scope > slot.auto-group-members'
304
+ ) as HTMLSlotElement | null;
305
+ }
306
+
307
+ /**
308
+ * Paint the front child on top. For light-DOM members this reorders the
309
+ * children; for slot-assigned members it re-assigns the member slot, which
310
+ * changes flattened-tree order without touching the consumer's DOM.
311
+ */
312
+ private bringChildToFront(frontChild: Poi) {
313
+ const memberSlot = this.getMemberSlot();
314
+ if (memberSlot && frontChild.assignedSlot === memberSlot) {
315
+ const members = memberSlot.assignedElements();
316
+ if (members[members.length - 1] === frontChild) return;
317
+ memberSlot.assign(
318
+ ...members.filter((el) => el !== frontChild),
319
+ frontChild
320
+ );
321
+ return;
322
+ }
323
+ if (frontChild.parentElement === this) {
324
+ this.appendChild(frontChild);
325
+ }
326
+ }
327
+
281
328
  private ensureFrontChildOnTop() {
282
329
  const frontChild = this.getFrontChild();
283
330
  if (frontChild && this.lastElementChild !== frontChild) {
284
- this.appendChild(frontChild);
331
+ this.bringChildToFront(frontChild);
285
332
  }
286
333
  }
287
334
 
@@ -294,7 +341,7 @@ export class ObcPoiGroup extends LitElement {
294
341
  }
295
342
 
296
343
  public releaseTarget(target: Poi): Promise<boolean> {
297
- if (target.parentElement !== this) {
344
+ if (!this.isMember(target)) {
298
345
  return Promise.resolve(false);
299
346
  }
300
347
 
@@ -346,7 +393,7 @@ export class ObcPoiGroup extends LitElement {
346
393
  }
347
394
 
348
395
  if (!expand && frontChild) {
349
- this.appendChild(frontChild);
396
+ this.bringChildToFront(frontChild);
350
397
  }
351
398
 
352
399
  this.animateTopOffset(expand ? 1 : 0);
@@ -533,7 +580,7 @@ export class ObcPoiGroup extends LitElement {
533
580
  const touchAreaExpanded = progress > 0.5;
534
581
 
535
582
  this.topOffsetTargets.forEach((config, child) => {
536
- if (child.parentElement !== this) {
583
+ if (!this.isMember(child)) {
537
584
  this.topOffsetTargets.delete(child);
538
585
  this.collapseDeltas.delete(child);
539
586
  this.lastAppliedOffsets.delete(child);
@@ -768,7 +815,7 @@ export class ObcPoiGroup extends LitElement {
768
815
  this.lastTargetOrder = orderedTargets;
769
816
 
770
817
  targets.forEach((child) => {
771
- if (child.parentElement !== this) {
818
+ if (!this.isMember(child)) {
772
819
  this.topOffsetTargets.delete(child);
773
820
  this.lastAppliedOffsets.delete(child);
774
821
  return;
@@ -883,7 +930,7 @@ export class ObcPoiGroup extends LitElement {
883
930
  }
884
931
 
885
932
  private releaseTargetToParent(target: Poi): boolean {
886
- if (target.parentElement !== this) {
933
+ if (!this.isMember(target)) {
887
934
  return false;
888
935
  }
889
936
 
@@ -909,6 +956,34 @@ export class ObcPoiGroup extends LitElement {
909
956
  target.style.removeProperty('--obc-poi-group-overlap-shift');
910
957
  clearPoiVisualState(target);
911
958
 
959
+ const memberSlot = this.getMemberSlot();
960
+ if (memberSlot && target.assignedSlot === memberSlot) {
961
+ // Slot-assigned member (layer-created auto group): the target already
962
+ // lives in the consumer's light DOM — only the assignment changes. The
963
+ // host layer immediately re-assigns it to its main slot.
964
+ memberSlot.assign(
965
+ ...memberSlot.assignedElements().filter((el) => el !== target)
966
+ );
967
+ const root = this.getRootNode();
968
+ const host =
969
+ root instanceof ShadowRoot
970
+ ? (root.host as HTMLElement & {
971
+ releaseAssignedTarget?: (target: Poi) => void;
972
+ })
973
+ : null;
974
+ host?.releaseAssignedTarget?.(target);
975
+ this.updatePosition();
976
+
977
+ this.dispatchEvent(
978
+ new CustomEvent<{target: Poi}>('obc-poi-group-target-released', {
979
+ detail: {target},
980
+ bubbles: true,
981
+ composed: true,
982
+ })
983
+ );
984
+ return true;
985
+ }
986
+
912
987
  const parent = this.parentElement;
913
988
  if (!parent) {
914
989
  return false;
@@ -8,10 +8,13 @@
8
8
 
9
9
  --obc-poi-layer-height: auto;
10
10
  --obc-poi-layer-auto-group-offset-y: 0;
11
- --obc-poi-layer-line-length: 120px;
12
11
  --obc-poi-layer-exit-delay-ms: 140;
13
12
  --obc-poi-layer-group-removal-delay-ms: 250;
14
13
  --obc-poi-layer-exit-lock-duration-ms: 500;
14
+ --obc-poi-layer-overlap-enter: 10px;
15
+ --obc-poi-layer-overlap-exit: 18px;
16
+ --obc-poi-layer-overlap-pre: 16px;
17
+ --obc-poi-layer-overlap-behind: 10px;
15
18
  }
16
19
 
17
20
  .wrapper.debug {
@@ -37,8 +40,10 @@
37
40
  pointer-events: none;
38
41
  }
39
42
 
40
- ::slotted([data-poi-target]),
41
- ::slotted(obc-poi-group) {
43
+ /* ---------- Main slot: ungrouped targets and manual groups ---------- */
44
+
45
+ .main::slotted([data-poi-target]),
46
+ .main::slotted(obc-poi-group) {
42
47
  position: absolute;
43
48
  bottom: 0;
44
49
  height: 100%;
@@ -58,59 +63,105 @@
58
63
  pointer-events: auto;
59
64
  }
60
65
 
61
- ::slotted([data-poi-target][data-grouped]) {
66
+ .main::slotted([data-poi-target][data-grouped]) {
62
67
  opacity: 0;
63
68
  }
64
69
 
65
- ::slotted([data-poi-target]:not([data-grouped])) {
70
+ .main::slotted([data-poi-target]:not([data-grouped])) {
66
71
  opacity: 1;
67
72
  }
68
73
 
69
- ::slotted([data-poi-target][data-behind]) {
74
+ .main::slotted([data-poi-target][data-behind]) {
70
75
  opacity: 0.4;
71
76
  --poi-size: 32px;
72
77
  --obc-poi-target-icon-opacity: 0;
73
78
  }
74
79
 
75
- ::slotted([data-poi-target][data-exiting]) {
80
+ .main::slotted([data-poi-target][data-exiting]) {
76
81
  opacity: 0.4;
77
82
  --poi-size: 32px;
78
83
  --obc-poi-target-icon-opacity: 0;
79
84
  }
80
85
 
81
- ::slotted([data-poi-target][data-front]) {
86
+ .main::slotted([data-poi-target][data-front]) {
82
87
  opacity: 1;
83
88
  --poi-size: 36px;
84
89
  --obc-poi-target-icon-opacity: 1;
85
90
  }
86
91
 
87
- ::slotted(obc-poi-group[data-auto-group]) {
88
- opacity: 1;
89
- }
90
-
91
- ::slotted(obc-poi-group) {
92
+ .main::slotted(obc-poi-group) {
92
93
  bottom: 0;
93
94
  height: 100%;
94
95
  transform: none;
95
96
  pointer-events: none;
96
97
  }
97
98
 
98
- ::slotted(obc-poi-group[data-auto-group]) {
99
+ .main::slotted(obc-poi-group[data-exiting]) {
100
+ pointer-events: none;
101
+ }
102
+
103
+ /* ---------- Auto groups: shadow chrome, members slot-assigned ---------- */
104
+
105
+ .wrapper > obc-poi-group[data-auto-group] {
99
106
  opacity: 0;
100
107
  z-index: 2;
101
108
  transition: opacity 0.1s ease-out;
102
109
  }
103
110
 
104
- ::slotted(obc-poi-group[data-auto-group][data-visible]) {
111
+ .wrapper > obc-poi-group[data-auto-group][data-visible] {
105
112
  opacity: 1;
106
113
  }
107
114
 
108
- ::slotted(obc-poi-group[data-exiting]) {
115
+ .wrapper > obc-poi-group[data-auto-group][data-exiting] {
109
116
  pointer-events: none;
110
117
  }
111
118
 
112
- :host([data-stack-inactive]) ::slotted([data-poi-target]:not([data-grouped])),
113
- :host([data-stack-inactive]) ::slotted(obc-poi-group) {
119
+ /*
120
+ * Members of auto groups stay in the consumer's light DOM but are assigned
121
+ * to the group's member slot, so they are styled from the layer stylesheet
122
+ * (mirrors the grouped-target rules previously in poi-group.css).
123
+ */
124
+ .auto-group-members::slotted([data-poi-target]) {
125
+ position: absolute;
126
+ top: auto;
127
+ bottom: 0;
128
+ height: 100%;
129
+ transform-origin: 50% 50%;
130
+ --obc-poi-layer-target-scale: 1;
131
+ --obc-poi-layer-target-shift: calc(
132
+ (1 - var(--obc-poi-layer-target-scale)) * 100%
133
+ );
134
+ transform: translateX(var(--obc-poi-target-offset-x, 0px))
135
+ translateY(calc(100% - var(--obc-poi-layer-target-shift)))
136
+ scale(var(--obc-poi-layer-target-scale));
137
+ transition: opacity 0.1s ease-out;
138
+ pointer-events: auto;
139
+ }
140
+
141
+ .auto-group-members::slotted([data-poi-target][data-behind]),
142
+ .auto-group-members::slotted([data-poi-target][data-exiting]) {
143
+ opacity: 0.4;
144
+ --poi-size: 32px;
145
+ --obc-poi-target-icon-opacity: 0;
146
+ }
147
+
148
+ .auto-group-members::slotted([data-poi-target][data-front]) {
149
+ opacity: 1;
150
+ --poi-size: 36px;
151
+ --obc-poi-target-icon-opacity: 1;
152
+ }
153
+
154
+ .auto-group-members::slotted([data-poi-target][data-grouped]) {
155
+ opacity: 1;
156
+ transition: opacity 0.1s ease-out;
157
+ }
158
+
159
+ /* ---------- Inactive stack layer dimming ---------- */
160
+
161
+ :host([data-stack-inactive])
162
+ .main::slotted([data-poi-target]:not([data-grouped])),
163
+ :host([data-stack-inactive]) .main::slotted(obc-poi-group),
164
+ :host([data-stack-inactive]) .wrapper > obc-poi-group[data-auto-group] {
114
165
  --obc-poi-object-frame-opacity: var(--obc-poi-layer-inactive-opacity, 0.7);
115
166
  --obc-poi-data-content-opacity: var(--obc-poi-layer-inactive-opacity, 0.7);
116
167
  --obc-poi-overlap-elements-opacity: var(
@@ -2,6 +2,7 @@ import type {Meta, StoryObj} from '@storybook/web-components-vite';
2
2
  import {html} from 'lit';
3
3
  import {createRef, ref} from 'lit/directives/ref.js';
4
4
  import {OverlapMode} from './poi-layer.js';
5
+ import type {ObcPoiLayer} from './poi-layer.js';
5
6
  import './poi-layer.js';
6
7
  import '../poi/poi-data.js';
7
8
  import {ObcPoiData, PoiDataValue} from '../poi/poi-data.js';
@@ -383,6 +384,9 @@ export const Overlap: Story = {
383
384
  label: 'Overlap',
384
385
  debug: true,
385
386
  },
387
+ play: async () => {
388
+ await waitForStorySettle({drainTransitions: true});
389
+ },
386
390
  render(args) {
387
391
  return html`
388
392
  <style>
@@ -417,6 +421,9 @@ export const OverlapWithGroup: Story = {
417
421
  label: 'Overlap Group',
418
422
  debug: true,
419
423
  },
424
+ play: async () => {
425
+ await waitForStorySettle({drainTransitions: true});
426
+ },
420
427
  render(args) {
421
428
  return html`
422
429
  <style>
@@ -456,6 +463,9 @@ export const OverlapWithGroupNumbers: Story = {
456
463
  label: 'Overlap Group (Numbers)',
457
464
  debug: true,
458
465
  },
466
+ play: async () => {
467
+ await waitForStorySettle({drainTransitions: true});
468
+ },
459
469
  render(args) {
460
470
  return html`
461
471
  <style>
@@ -496,6 +506,9 @@ export const EnterGroupFromTwo: Story = {
496
506
  label: 'Enter Group (2)',
497
507
  debug: true,
498
508
  },
509
+ play: async () => {
510
+ await waitForStorySettle({drainTransitions: true});
511
+ },
499
512
  render(args) {
500
513
  const hostRef = createRef<HTMLDivElement>();
501
514
  const startFirstX = 180;
@@ -678,6 +691,9 @@ export const JoinGroup: Story = {
678
691
  label: 'Join Group (3)',
679
692
  debug: true,
680
693
  },
694
+ play: async () => {
695
+ await waitForStorySettle({drainTransitions: true});
696
+ },
681
697
  render(args) {
682
698
  const hostRef = createRef<HTMLDivElement>();
683
699
  const startAnimation = (root: HTMLElement | null) => {
@@ -833,23 +849,22 @@ export const JoinExpandedGroup: Story = {
833
849
  setTimeout(() => spawnLateTarget(hostRef.value ?? null), 0);
834
850
  }
835
851
  setTimeout(() => {
836
- const layer = layerRef.value;
852
+ const layer = layerRef.value as ObcPoiLayer | null;
837
853
  if (!layer) return;
838
854
  const applyInitialExpand = () => {
839
- const group = layer.querySelector('obc-poi-group[data-auto-group]') as {
840
- expand: boolean;
841
- } | null;
855
+ const group = layer.autoGroups[0] as
856
+ (HTMLElement & {expand: boolean}) | undefined;
842
857
  if (!group) return false;
843
858
  group.expand = !!args.expand;
844
859
  return true;
845
860
  };
846
861
  if (applyInitialExpand()) return;
847
- const observer = new MutationObserver(() => {
862
+ const onGroupingChange = () => {
848
863
  if (applyInitialExpand()) {
849
- observer.disconnect();
864
+ layer.removeEventListener('grouping-change', onGroupingChange);
850
865
  }
851
- });
852
- observer.observe(layer, {childList: true, subtree: true});
866
+ };
867
+ layer.addEventListener('grouping-change', onGroupingChange);
853
868
  }, 0);
854
869
  return html`
855
870
  <style>
@@ -953,23 +968,22 @@ export const LeaveExpandedGroup: Story = {
953
968
  setTimeout(() => startAnimation(hostRef.value ?? null), 0);
954
969
  }
955
970
  setTimeout(() => {
956
- const layer = layerRef.value;
971
+ const layer = layerRef.value as ObcPoiLayer | null;
957
972
  if (!layer) return;
958
973
  const applyInitialExpand = () => {
959
- const group = layer.querySelector('obc-poi-group') as {
960
- expand: boolean;
961
- } | null;
974
+ const group = layer.autoGroups[0] as
975
+ (HTMLElement & {expand: boolean}) | undefined;
962
976
  if (!group) return false;
963
977
  group.expand = !!args.expand;
964
978
  return true;
965
979
  };
966
980
  if (applyInitialExpand()) return;
967
- const observer = new MutationObserver(() => {
981
+ const onGroupingChange = () => {
968
982
  if (applyInitialExpand()) {
969
- observer.disconnect();
983
+ layer.removeEventListener('grouping-change', onGroupingChange);
970
984
  }
971
- });
972
- observer.observe(layer, {childList: true, subtree: true});
985
+ };
986
+ layer.addEventListener('grouping-change', onGroupingChange);
973
987
  }, 0);
974
988
  return html`
975
989
  <style>