@oicl/openbridge-webcomponents 2.0.0-next.170 → 2.0.0-next.172
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.
- package/bundle/openbridge-webcomponents.bundle.js +974 -511
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +1853 -377
- package/dist/ar/poi/poi-aton.d.ts +1 -0
- package/dist/ar/poi/poi-aton.d.ts.map +1 -1
- package/dist/ar/poi/poi-aton.js +1 -0
- package/dist/ar/poi/poi-aton.js.map +1 -1
- package/dist/ar/poi/poi-base.d.ts +39 -5
- package/dist/ar/poi/poi-base.d.ts.map +1 -1
- package/dist/ar/poi/poi-base.js +108 -37
- package/dist/ar/poi/poi-base.js.map +1 -1
- package/dist/ar/poi/poi-data.d.ts +1 -0
- package/dist/ar/poi/poi-data.d.ts.map +1 -1
- package/dist/ar/poi/poi-data.js +1 -0
- package/dist/ar/poi/poi-data.js.map +1 -1
- package/dist/ar/poi/poi-vessel.d.ts +1 -0
- package/dist/ar/poi/poi-vessel.d.ts.map +1 -1
- package/dist/ar/poi/poi-vessel.js +1 -0
- package/dist/ar/poi/poi-vessel.js.map +1 -1
- package/dist/ar/poi/poi.d.ts +4 -12
- package/dist/ar/poi/poi.d.ts.map +1 -1
- package/dist/ar/poi/poi.js +6 -72
- package/dist/ar/poi/poi.js.map +1 -1
- package/dist/ar/poi-button/poi-button.d.ts +6 -2
- package/dist/ar/poi-button/poi-button.d.ts.map +1 -1
- package/dist/ar/poi-button/poi-button.js +10 -1
- package/dist/ar/poi-button/poi-button.js.map +1 -1
- package/dist/ar/poi-card/poi-card.d.ts +12 -1
- package/dist/ar/poi-card/poi-card.d.ts.map +1 -1
- package/dist/ar/poi-card/poi-card.js +4 -1
- package/dist/ar/poi-card/poi-card.js.map +1 -1
- package/dist/ar/poi-controller/poi-controller.d.ts +45 -1
- package/dist/ar/poi-controller/poi-controller.d.ts.map +1 -1
- package/dist/ar/poi-controller/poi-controller.js +72 -14
- package/dist/ar/poi-controller/poi-controller.js.map +1 -1
- package/dist/ar/poi-group/poi-group.d.ts +28 -5
- package/dist/ar/poi-group/poi-group.d.ts.map +1 -1
- package/dist/ar/poi-group/poi-group.js +50 -7
- package/dist/ar/poi-group/poi-group.js.map +1 -1
- package/dist/ar/poi-layer/poi-layer.css.js +69 -18
- package/dist/ar/poi-layer/poi-layer.css.js.map +1 -1
- package/dist/ar/poi-layer/poi-layer.d.ts +64 -5
- package/dist/ar/poi-layer/poi-layer.d.ts.map +1 -1
- package/dist/ar/poi-layer/poi-layer.js +173 -39
- package/dist/ar/poi-layer/poi-layer.js.map +1 -1
- package/dist/ar/poi-layer-stack/poi-layer-stack.d.ts +82 -7
- package/dist/ar/poi-layer-stack/poi-layer-stack.d.ts.map +1 -1
- package/dist/ar/poi-layer-stack/poi-layer-stack.js +172 -100
- package/dist/ar/poi-layer-stack/poi-layer-stack.js.map +1 -1
- package/dist/ar/poi-projection/poi-projection.d.ts +88 -0
- package/dist/ar/poi-projection/poi-projection.d.ts.map +1 -0
- package/dist/ar/poi-projection/poi-projection.js +90 -0
- package/dist/ar/poi-projection/poi-projection.js.map +1 -0
- package/dist/automation/automation-button/abstract-automation-button-motorized.d.ts +11 -1
- package/dist/automation/automation-button/abstract-automation-button-motorized.d.ts.map +1 -1
- package/dist/automation/automation-button/abstract-automation-button-motorized.js +14 -4
- package/dist/automation/automation-button/abstract-automation-button-motorized.js.map +1 -1
- package/dist/automation/automation-button/abstract-automation-button-squared.d.ts +25 -1
- package/dist/automation/automation-button/abstract-automation-button-squared.d.ts.map +1 -1
- package/dist/automation/automation-button/abstract-automation-button-squared.js +27 -3
- package/dist/automation/automation-button/abstract-automation-button-squared.js.map +1 -1
- package/dist/automation/automation-button/abstract-automation-button-storybook-helpers.d.ts +12 -0
- package/dist/automation/automation-button/abstract-automation-button-storybook-helpers.d.ts.map +1 -1
- package/dist/automation/automation-button/abstract-automation-button-storybook-helpers.js +8 -0
- package/dist/automation/automation-button/abstract-automation-button-storybook-helpers.js.map +1 -1
- package/dist/automation/bipolar-transistor/bipolar-transistor.js +4 -4
- package/dist/automation/bipolar-transistor/bipolar-transistor.js.map +1 -1
- package/dist/automation/capacitor/capacitor.js +4 -4
- package/dist/automation/capacitor/capacitor.js.map +1 -1
- package/dist/automation/converter/converter.js +4 -4
- package/dist/automation/converter/converter.js.map +1 -1
- package/dist/automation/damper/damper.js +1 -1
- package/dist/automation/damper/damper.js.map +1 -1
- package/dist/automation/diodes/diodes.js +6 -6
- package/dist/automation/diodes/diodes.js.map +1 -1
- package/dist/automation/fan/fan.js +1 -1
- package/dist/automation/fan/fan.js.map +1 -1
- package/dist/automation/filter/filter.js +4 -4
- package/dist/automation/filter/filter.js.map +1 -1
- package/dist/automation/ground/ground.js +3 -3
- package/dist/automation/ground/ground.js.map +1 -1
- package/dist/automation/logic/logic.js +6 -6
- package/dist/automation/logic/logic.js.map +1 -1
- package/dist/automation/mosfet/mosfet.js +8 -8
- package/dist/automation/mosfet/mosfet.js.map +1 -1
- package/dist/automation/motor/motor.js +2 -2
- package/dist/automation/motor/motor.js.map +1 -1
- package/dist/automation/pump/pump.js +2 -2
- package/dist/automation/pump/pump.js.map +1 -1
- package/dist/automation/resistor/resistor.js +5 -5
- package/dist/automation/resistor/resistor.js.map +1 -1
- package/dist/automation/router/router.js +2 -2
- package/dist/automation/router/router.js.map +1 -1
- package/dist/automation/source/source.js +5 -5
- package/dist/automation/source/source.js.map +1 -1
- package/dist/automation/switch/switch.js +4 -4
- package/dist/automation/switch/switch.js.map +1 -1
- package/dist/automation/transformer/transformer.js +2 -2
- package/dist/automation/transformer/transformer.js.map +1 -1
- package/package.json +2 -2
|
@@ -38,6 +38,9 @@ var ObcPoiLayer = class ObcPoiLayer extends LitElement {
|
|
|
38
38
|
this.internalSwapping = false;
|
|
39
39
|
this.lastHeight = 0;
|
|
40
40
|
this.isGrouping = false;
|
|
41
|
+
this.lastGroupingSignature = "";
|
|
42
|
+
this.groupingIds = /* @__PURE__ */ new WeakMap();
|
|
43
|
+
this.nextGroupingId = 1;
|
|
41
44
|
this.targetObservers = /* @__PURE__ */ new Map();
|
|
42
45
|
this.targetSizeElements = /* @__PURE__ */ new Map();
|
|
43
46
|
this.groupingRaf = 0;
|
|
@@ -82,6 +85,12 @@ var ObcPoiLayer = class ObcPoiLayer extends LitElement {
|
|
|
82
85
|
};
|
|
83
86
|
this.buttonOffsetXResetRaf = /* @__PURE__ */ new Map();
|
|
84
87
|
}
|
|
88
|
+
static {
|
|
89
|
+
this.shadowRootOptions = {
|
|
90
|
+
...LitElement.shadowRootOptions,
|
|
91
|
+
slotAssignment: "manual"
|
|
92
|
+
};
|
|
93
|
+
}
|
|
85
94
|
static {
|
|
86
95
|
this.GROUP_LAYER_HOOK_ATTR = "data-in-poi-layer";
|
|
87
96
|
}
|
|
@@ -283,19 +292,24 @@ var ObcPoiLayer = class ObcPoiLayer extends LitElement {
|
|
|
283
292
|
setupLayerMutationObserver() {
|
|
284
293
|
this.layerMutationObserver?.disconnect();
|
|
285
294
|
this.layerMutationObserver = new MutationObserver((mutations) => {
|
|
295
|
+
let childListChanged = false;
|
|
296
|
+
let relevant = false;
|
|
286
297
|
for (const mutation of mutations) {
|
|
287
298
|
if (mutation.type !== "childList") continue;
|
|
299
|
+
childListChanged = true;
|
|
288
300
|
const nodes = [...mutation.addedNodes, ...mutation.removedNodes];
|
|
289
|
-
for (const node of nodes) {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
this.updateTargetObservers();
|
|
293
|
-
this.scheduleGrouping();
|
|
294
|
-
this.scheduleLayerHeightUpdate();
|
|
295
|
-
this.crossingTargetsDirty = true;
|
|
296
|
-
return;
|
|
297
|
-
}
|
|
301
|
+
for (const node of nodes) if (node instanceof HTMLElement && this.isPoiLayerRelevantNode(node)) {
|
|
302
|
+
relevant = true;
|
|
303
|
+
break;
|
|
298
304
|
}
|
|
305
|
+
if (relevant) break;
|
|
306
|
+
}
|
|
307
|
+
if (childListChanged) this.syncSlotAssignments();
|
|
308
|
+
if (relevant) {
|
|
309
|
+
this.updateTargetObservers();
|
|
310
|
+
this.scheduleGrouping();
|
|
311
|
+
this.scheduleLayerHeightUpdate();
|
|
312
|
+
this.crossingTargetsDirty = true;
|
|
299
313
|
}
|
|
300
314
|
});
|
|
301
315
|
this.layerMutationObserver.observe(this, {
|
|
@@ -307,6 +321,68 @@ var ObcPoiLayer = class ObcPoiLayer extends LitElement {
|
|
|
307
321
|
this.scheduleGrouping();
|
|
308
322
|
this.scheduleLayerHeightUpdate();
|
|
309
323
|
}
|
|
324
|
+
getMainSlot() {
|
|
325
|
+
return this.shadowRoot?.querySelector("slot.main") ?? null;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Assign every light-DOM child that is not currently placed in an
|
|
329
|
+
* auto-group member slot to the main slot. With `slotAssignment: 'manual'`
|
|
330
|
+
* nothing renders unless explicitly assigned, so this runs after render,
|
|
331
|
+
* on child-list mutations, and after every grouping change.
|
|
332
|
+
*/
|
|
333
|
+
syncSlotAssignments() {
|
|
334
|
+
const mainSlot = this.getMainSlot();
|
|
335
|
+
if (!mainSlot) return;
|
|
336
|
+
const groupAssigned = /* @__PURE__ */ new Set();
|
|
337
|
+
this.getAutoGroups().forEach((group) => {
|
|
338
|
+
this.getAutoGroupMemberSlot(group)?.assignedNodes().forEach((node) => groupAssigned.add(node));
|
|
339
|
+
});
|
|
340
|
+
const mainNodes = Array.from(this.childNodes).filter((node) => !groupAssigned.has(node) && (node instanceof Element || node instanceof Text));
|
|
341
|
+
mainSlot.assign(...mainNodes);
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Called by an auto-created `obc-poi-group` after it removed a target from
|
|
345
|
+
* its member slot, so the target immediately re-renders through the main
|
|
346
|
+
* slot instead of disappearing until the next grouping pass.
|
|
347
|
+
* @internal
|
|
348
|
+
*/
|
|
349
|
+
releaseAssignedTarget(_target) {
|
|
350
|
+
this.syncSlotAssignments();
|
|
351
|
+
this.requestGroupingUpdate();
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* The auto-created `obc-poi-group` elements currently managed by this
|
|
355
|
+
* layer. Auto groups are shadow-internal chrome (they never appear in the
|
|
356
|
+
* consumer's light DOM); use this accessor — typically after a
|
|
357
|
+
* `grouping-change` event — to reach them, e.g. to expand a group
|
|
358
|
+
* programmatically.
|
|
359
|
+
*/
|
|
360
|
+
get autoGroups() {
|
|
361
|
+
return this.getAutoGroups();
|
|
362
|
+
}
|
|
363
|
+
getAutoGroups() {
|
|
364
|
+
return Array.from(this.shadowRoot?.querySelectorAll("obc-poi-group[data-auto-group]") ?? []);
|
|
365
|
+
}
|
|
366
|
+
getAutoGroupMemberSlot(group) {
|
|
367
|
+
return group.querySelector(":scope > slot.auto-group-members");
|
|
368
|
+
}
|
|
369
|
+
/** The auto group a target is currently assigned into, if any. */
|
|
370
|
+
getAutoGroupOf(target) {
|
|
371
|
+
const slot = target.assignedSlot;
|
|
372
|
+
if (slot?.classList.contains("auto-group-members")) return slot.parentElement;
|
|
373
|
+
return null;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Members of a group in either mode: slot-assigned (shadow auto groups) or
|
|
377
|
+
* light-DOM children (consumer-managed manual groups).
|
|
378
|
+
*/
|
|
379
|
+
getGroupMembers(group) {
|
|
380
|
+
if (group instanceof HTMLElement) {
|
|
381
|
+
const slot = this.getAutoGroupMemberSlot(group);
|
|
382
|
+
if (slot) return slot.assignedElements().filter((el) => isPoi(el));
|
|
383
|
+
}
|
|
384
|
+
return Array.from(group.querySelectorAll(`[${POI_ATTR}]`)).filter((node) => isPoi(node));
|
|
385
|
+
}
|
|
310
386
|
scheduleGrouping() {
|
|
311
387
|
if (this.overlapMode === "crossing") {
|
|
312
388
|
this.scheduleCrossingMode();
|
|
@@ -352,6 +428,35 @@ var ObcPoiLayer = class ObcPoiLayer extends LitElement {
|
|
|
352
428
|
this.crossingOrder = next.crossingOrder;
|
|
353
429
|
return next.shouldContinue;
|
|
354
430
|
}
|
|
431
|
+
getGroupingId(target) {
|
|
432
|
+
let id = this.groupingIds.get(target);
|
|
433
|
+
if (id === void 0) {
|
|
434
|
+
id = this.nextGroupingId++;
|
|
435
|
+
this.groupingIds.set(target, id);
|
|
436
|
+
}
|
|
437
|
+
return id;
|
|
438
|
+
}
|
|
439
|
+
notifyGroupingChange(clusters, frontTargets, behindTargets, preGrouped) {
|
|
440
|
+
const idsOf = (targets) => Array.from(targets, (target) => this.getGroupingId(target)).sort((a, b) => a - b);
|
|
441
|
+
const signature = JSON.stringify({
|
|
442
|
+
clusters: clusters.map((cluster) => idsOf(cluster)).sort(),
|
|
443
|
+
front: idsOf(frontTargets),
|
|
444
|
+
behind: idsOf(behindTargets),
|
|
445
|
+
pre: idsOf(preGrouped)
|
|
446
|
+
});
|
|
447
|
+
if (signature === this.lastGroupingSignature) return;
|
|
448
|
+
this.lastGroupingSignature = signature;
|
|
449
|
+
this.dispatchEvent(new CustomEvent("grouping-change", {
|
|
450
|
+
detail: {
|
|
451
|
+
clusters: clusters.map((cluster) => [...cluster]),
|
|
452
|
+
front: [...frontTargets],
|
|
453
|
+
behind: [...behindTargets],
|
|
454
|
+
pregrouped: [...preGrouped]
|
|
455
|
+
},
|
|
456
|
+
bubbles: true,
|
|
457
|
+
composed: true
|
|
458
|
+
}));
|
|
459
|
+
}
|
|
355
460
|
toggleGroupLayerHook(group, hasTargets) {
|
|
356
461
|
if (hasTargets) group.setAttribute(_ObcPoiLayer.GROUP_LAYER_HOOK_ATTR, "");
|
|
357
462
|
else group.removeAttribute(_ObcPoiLayer.GROUP_LAYER_HOOK_ATTR);
|
|
@@ -376,14 +481,18 @@ var ObcPoiLayer = class ObcPoiLayer extends LitElement {
|
|
|
376
481
|
const exitRaw = getComputedStyle(this).getPropertyValue("--obc-poi-layer-overlap-exit");
|
|
377
482
|
const preRaw = getComputedStyle(this).getPropertyValue("--obc-poi-layer-overlap-pre");
|
|
378
483
|
const behindRaw = getComputedStyle(this).getPropertyValue("--obc-poi-layer-overlap-behind");
|
|
379
|
-
const
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
484
|
+
const parseThreshold = (raw, fallback) => {
|
|
485
|
+
const value = Number.parseFloat(raw);
|
|
486
|
+
return Number.isFinite(value) ? value : fallback;
|
|
487
|
+
};
|
|
488
|
+
const enterThreshold = parseThreshold(enterRaw, 10);
|
|
489
|
+
const exitThreshold = Math.max(parseThreshold(exitRaw, enterThreshold + 8), enterThreshold);
|
|
490
|
+
const preThreshold = parseThreshold(preRaw, Math.max(enterThreshold, 16));
|
|
491
|
+
const behindThreshold = parseThreshold(behindRaw, enterThreshold);
|
|
383
492
|
const currentGroupByTarget = /* @__PURE__ */ new Map();
|
|
384
493
|
targets.forEach((target) => {
|
|
385
|
-
const
|
|
386
|
-
if (
|
|
494
|
+
const group = this.getAutoGroupOf(target);
|
|
495
|
+
if (group) currentGroupByTarget.set(target, group);
|
|
387
496
|
});
|
|
388
497
|
const rects = /* @__PURE__ */ new Map();
|
|
389
498
|
targets.forEach((target) => {
|
|
@@ -397,7 +506,7 @@ var ObcPoiLayer = class ObcPoiLayer extends LitElement {
|
|
|
397
506
|
}, currentGroupByTarget);
|
|
398
507
|
const clusters = buildClusters(targets, adjacency);
|
|
399
508
|
const behindClusters = buildClusters(targets, behindAdjacency);
|
|
400
|
-
const existingGroups =
|
|
509
|
+
const existingGroups = this.getAutoGroups().filter((group) => !group.hasAttribute("data-exiting"));
|
|
401
510
|
const frontTargets = /* @__PURE__ */ new Set();
|
|
402
511
|
clusters.forEach((cluster) => {
|
|
403
512
|
const front = this.getFrontTarget(cluster, rects);
|
|
@@ -410,13 +519,24 @@ var ObcPoiLayer = class ObcPoiLayer extends LitElement {
|
|
|
410
519
|
});
|
|
411
520
|
const expandedAutoGroup = existingGroups.find((group) => group.expand === true || group.collapsing === true);
|
|
412
521
|
if (expandedAutoGroup) {
|
|
413
|
-
|
|
522
|
+
const joined = this.joinWhileExpanded ? this.tryJoinExpandedGroup(expandedAutoGroup, targets, rects, enterThreshold) : null;
|
|
523
|
+
if (joined) {
|
|
524
|
+
const liveClusters = existingGroups.map((group) => this.getGroupMembers(group));
|
|
525
|
+
const liveFront = /* @__PURE__ */ new Set();
|
|
526
|
+
liveClusters.forEach((cluster) => {
|
|
527
|
+
const front = this.getFrontTarget(cluster, rects);
|
|
528
|
+
if (front) liveFront.add(front);
|
|
529
|
+
});
|
|
530
|
+
behindTargets.delete(joined);
|
|
531
|
+
preGrouped.delete(joined);
|
|
532
|
+
this.notifyGroupingChange(liveClusters, liveFront, behindTargets, preGrouped);
|
|
533
|
+
}
|
|
414
534
|
return;
|
|
415
535
|
}
|
|
416
536
|
const remainingClusters = [...clusters];
|
|
417
537
|
const keptGroups = [];
|
|
418
538
|
existingGroups.forEach((group) => {
|
|
419
|
-
const children =
|
|
539
|
+
const children = this.getGroupMembers(group);
|
|
420
540
|
const matchIndex = remainingClusters.findIndex((cluster) => cluster.length === children.length && cluster.every((target) => children.includes(target)));
|
|
421
541
|
if (matchIndex >= 0) {
|
|
422
542
|
keptGroups.push(group);
|
|
@@ -444,7 +564,8 @@ var ObcPoiLayer = class ObcPoiLayer extends LitElement {
|
|
|
444
564
|
});
|
|
445
565
|
group.removeAttribute("data-visible");
|
|
446
566
|
group.setAttribute("data-exiting", "true");
|
|
447
|
-
|
|
567
|
+
this.getAutoGroupMemberSlot(group)?.assign();
|
|
568
|
+
this.syncSlotAssignments();
|
|
448
569
|
children.forEach((child) => {
|
|
449
570
|
if (!front || child !== front) child.getBoundingClientRect();
|
|
450
571
|
});
|
|
@@ -465,12 +586,16 @@ var ObcPoiLayer = class ObcPoiLayer extends LitElement {
|
|
|
465
586
|
group.setAttribute("data-position-mode", "bottom");
|
|
466
587
|
group.setAttribute("data-visible", "true");
|
|
467
588
|
group.internalSwapping = !!this.internalSwapping;
|
|
468
|
-
group.setAttribute("
|
|
589
|
+
group.setAttribute("position-vertical", `${this.getGroupPositionVertical(cluster, rects, layerRect, group)}px`);
|
|
590
|
+
const memberSlot = document.createElement("slot");
|
|
591
|
+
memberSlot.className = "auto-group-members";
|
|
592
|
+
group.appendChild(memberSlot);
|
|
469
593
|
cluster.forEach((target) => {
|
|
470
594
|
target.removeAttribute("data-grouped");
|
|
471
|
-
group.appendChild(target);
|
|
472
595
|
});
|
|
473
|
-
this.appendChild(group);
|
|
596
|
+
this.wrapper?.appendChild(group);
|
|
597
|
+
memberSlot.assign(...cluster);
|
|
598
|
+
this.syncSlotAssignments();
|
|
474
599
|
requestAnimationFrame(() => {
|
|
475
600
|
cluster.forEach((target) => target.setAttribute("data-grouped", "true"));
|
|
476
601
|
});
|
|
@@ -478,8 +603,8 @@ var ObcPoiLayer = class ObcPoiLayer extends LitElement {
|
|
|
478
603
|
});
|
|
479
604
|
const groupedTargets = /* @__PURE__ */ new Set();
|
|
480
605
|
keptGroups.forEach((group) => {
|
|
481
|
-
|
|
482
|
-
|
|
606
|
+
this.getGroupMembers(group).forEach((child) => {
|
|
607
|
+
groupedTargets.add(child);
|
|
483
608
|
});
|
|
484
609
|
});
|
|
485
610
|
targets.forEach((target) => {
|
|
@@ -518,6 +643,7 @@ var ObcPoiLayer = class ObcPoiLayer extends LitElement {
|
|
|
518
643
|
}
|
|
519
644
|
});
|
|
520
645
|
this.refreshGroupPositions(layerRect, rects);
|
|
646
|
+
this.notifyGroupingChange(clusters, frontTargets, behindTargets, preGrouped);
|
|
521
647
|
requestAnimationFrame(() => {
|
|
522
648
|
targets.forEach((target) => target.removeAttribute("data-front-exit"));
|
|
523
649
|
});
|
|
@@ -528,13 +654,13 @@ var ObcPoiLayer = class ObcPoiLayer extends LitElement {
|
|
|
528
654
|
}
|
|
529
655
|
tryJoinExpandedGroup(group, targets, rects, enterThreshold) {
|
|
530
656
|
const groupTargets = this.getGroupTargets(group);
|
|
531
|
-
if (groupTargets.length === 0) return;
|
|
657
|
+
if (groupTargets.length === 0) return null;
|
|
532
658
|
const groupTargetSet = new Set(groupTargets);
|
|
533
|
-
const candidates = targets.filter((target) => !groupTargetSet.has(target) && target.parentElement?.tagName.toLowerCase() !== "obc-poi-group");
|
|
534
|
-
if (candidates.length === 0) return;
|
|
659
|
+
const candidates = targets.filter((target) => !groupTargetSet.has(target) && target.parentElement?.tagName.toLowerCase() !== "obc-poi-group" && this.getAutoGroupOf(target) === null);
|
|
660
|
+
if (candidates.length === 0) return null;
|
|
535
661
|
const useButtonRects = group.expand === true || group.collapsing === true;
|
|
536
662
|
const groupCenters = groupTargets.map((target) => useButtonRects ? this.getTargetRect(target) : rects.get(target)).filter((rect) => !!rect).map((rect) => rect.left + rect.width / 2);
|
|
537
|
-
if (groupCenters.length === 0) return;
|
|
663
|
+
if (groupCenters.length === 0) return null;
|
|
538
664
|
const groupCenter = (Math.min(...groupCenters) + Math.max(...groupCenters)) / 2;
|
|
539
665
|
let bestCandidate = null;
|
|
540
666
|
let bestGap = Number.POSITIVE_INFINITY;
|
|
@@ -552,10 +678,16 @@ var ObcPoiLayer = class ObcPoiLayer extends LitElement {
|
|
|
552
678
|
}
|
|
553
679
|
}
|
|
554
680
|
}
|
|
555
|
-
if (!bestCandidate) return;
|
|
681
|
+
if (!bestCandidate) return null;
|
|
556
682
|
bestCandidate.setAttribute("data-joined-expanded", "true");
|
|
557
683
|
const candidateRect = rects.get(bestCandidate);
|
|
558
|
-
|
|
684
|
+
const insertBefore = (candidateRect?.left !== void 0 ? candidateRect.left + candidateRect.width / 2 : 0) < groupCenter;
|
|
685
|
+
const memberSlot = group instanceof HTMLElement ? this.getAutoGroupMemberSlot(group) : null;
|
|
686
|
+
if (memberSlot) {
|
|
687
|
+
const members = memberSlot.assignedElements().filter((el) => el !== bestCandidate);
|
|
688
|
+
memberSlot.assign(...insertBefore ? [bestCandidate, ...members] : [...members, bestCandidate]);
|
|
689
|
+
this.syncSlotAssignments();
|
|
690
|
+
} else if (insertBefore) group.insertBefore(bestCandidate, groupTargets[0] ?? null);
|
|
559
691
|
else group.appendChild(bestCandidate);
|
|
560
692
|
bestCandidate.setAttribute("data-grouped", "true");
|
|
561
693
|
bestCandidate.removeAttribute("data-behind");
|
|
@@ -571,6 +703,7 @@ var ObcPoiLayer = class ObcPoiLayer extends LitElement {
|
|
|
571
703
|
bestCandidate.style.height = touchTarget;
|
|
572
704
|
}
|
|
573
705
|
group.refreshExpandedLayout?.(true);
|
|
706
|
+
return bestCandidate;
|
|
574
707
|
}
|
|
575
708
|
applyStandaloneVisualState(target, overlap) {
|
|
576
709
|
const isEnhanced = target.buttonType === ObcPoiButtonType.Enhanced;
|
|
@@ -586,17 +719,17 @@ var ObcPoiLayer = class ObcPoiLayer extends LitElement {
|
|
|
586
719
|
clearPoiVisualState(target);
|
|
587
720
|
}
|
|
588
721
|
refreshGroupPositions(layerRect, rects) {
|
|
589
|
-
Array.from(this.querySelectorAll("obc-poi-group")).forEach((group) => {
|
|
590
|
-
const children =
|
|
722
|
+
[...Array.from(this.querySelectorAll("obc-poi-group")), ...this.getAutoGroups()].forEach((group) => {
|
|
723
|
+
const children = this.getGroupMembers(group);
|
|
591
724
|
this.toggleGroupLayerHook(group, children.length > 0);
|
|
592
|
-
const hasPositionAttr = group.hasAttribute("
|
|
725
|
+
const hasPositionAttr = group.hasAttribute("position-vertical");
|
|
593
726
|
if (!group.hasAttribute("data-auto-group") && !group.hasAttribute("data-position-mode")) group.setAttribute("data-position-mode", "bottom");
|
|
594
727
|
const shouldSetPosition = group.hasAttribute("data-auto-group") || !hasPositionAttr;
|
|
595
728
|
if (group.hasAttribute("data-auto-group")) group.internalSwapping = !!this.internalSwapping;
|
|
596
729
|
if (children.length > 0 && shouldSetPosition) {
|
|
597
730
|
const layerBounds = layerRect ?? this.getBoundingClientRect();
|
|
598
731
|
const rectMap = rects ?? new Map(children.map((child) => [child, this.getTargetRectForGrouping(child, layerBounds)]));
|
|
599
|
-
group.setAttribute("
|
|
732
|
+
group.setAttribute("position-vertical", `${this.getGroupPositionVertical(children, rectMap, layerBounds, group)}px`);
|
|
600
733
|
}
|
|
601
734
|
group.updatePosition?.();
|
|
602
735
|
});
|
|
@@ -738,19 +871,20 @@ var ObcPoiLayer = class ObcPoiLayer extends LitElement {
|
|
|
738
871
|
return Array.from(this.querySelectorAll(`[${POI_ATTR}]`)).filter((node) => isPoi(node) && !node.hasAttribute("data-stack-selected"));
|
|
739
872
|
}
|
|
740
873
|
getGroupTargets(group) {
|
|
741
|
-
return
|
|
742
|
-
}
|
|
743
|
-
updated(changedProperties) {
|
|
744
|
-
if (changedProperties.has("isSelected")) this.dispatchEvent(new Event("layer-selection-changed", { bubbles: true }));
|
|
874
|
+
return this.getGroupMembers(group);
|
|
745
875
|
}
|
|
746
876
|
render() {
|
|
747
877
|
return html`
|
|
748
878
|
<div class="wrapper${this.debug ? " debug" : ""}">
|
|
749
879
|
${this.debug ? html`<span class="debug-label">${this.label || "Layer"}</span>` : nothing}
|
|
750
|
-
<slot></slot>
|
|
880
|
+
<slot class="main"></slot>
|
|
751
881
|
</div>
|
|
752
882
|
`;
|
|
753
883
|
}
|
|
884
|
+
updated(changedProperties) {
|
|
885
|
+
if (changedProperties.has("isSelected")) this.dispatchEvent(new Event("layer-selection-changed", { bubbles: true }));
|
|
886
|
+
this.syncSlotAssignments();
|
|
887
|
+
}
|
|
754
888
|
static {
|
|
755
889
|
this.styles = unsafeCSS(poi_layer_default);
|
|
756
890
|
}
|