@descope-ui/descope-attachment 3.13.1 → 3.13.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@descope-ui/descope-attachment",
3
- "version": "3.13.1",
3
+ "version": "3.13.2",
4
4
  "files": [
5
5
  "src",
6
6
  "stories"
@@ -18,14 +18,14 @@
18
18
  },
19
19
  "devDependencies": {
20
20
  "@playwright/test": "1.58.2",
21
- "test-drivers": "3.13.1",
22
- "e2e-utils": "3.13.1",
23
- "test-assets": "3.13.1"
21
+ "e2e-utils": "3.13.2",
22
+ "test-assets": "3.13.2",
23
+ "test-drivers": "3.13.2"
24
24
  },
25
25
  "dependencies": {
26
- "@descope-ui/common": "3.13.1",
27
- "@descope-ui/descope-anchored": "3.13.1",
28
- "@descope-ui/theme-globals": "3.13.1"
26
+ "@descope-ui/common": "3.13.2",
27
+ "@descope-ui/theme-globals": "3.13.2",
28
+ "@descope-ui/descope-anchored": "3.13.2"
29
29
  },
30
30
  "publishConfig": {
31
31
  "link-workspace-packages": false
@@ -28,6 +28,12 @@ class RawAttachment extends createBaseClass({
28
28
  componentName,
29
29
  baseSelector: 'descope-anchored',
30
30
  }) {
31
+ // Observes the inner descope-anchored's `class` attribute so runtime
32
+ // updates (e.g. real-time conditional components toggling `.hidden`) keep
33
+ // this attachment host's class in sync. Set up in connectedCallback so
34
+ // reconnects work (createBaseClass gates init() to first connect only).
35
+ #anchoredClassObserver = null;
36
+
31
37
  constructor() {
32
38
  super();
33
39
 
@@ -66,8 +72,6 @@ class RawAttachment extends createBaseClass({
66
72
  init() {
67
73
  super.init?.();
68
74
 
69
- this.#syncComponentState();
70
-
71
75
  injectStyle(
72
76
  `
73
77
  :host {
@@ -118,6 +122,30 @@ class RawAttachment extends createBaseClass({
118
122
  this.classList.toggle('hidden', hasHidden);
119
123
  }
120
124
 
125
+ #observeAnchored() {
126
+ this.#anchoredClassObserver?.disconnect();
127
+ if (this.anchored) {
128
+ this.#anchoredClassObserver = observeAttributes(
129
+ this.anchored,
130
+ () => this.#syncComponentState(),
131
+ { includeAttrs: ['class'] },
132
+ );
133
+ }
134
+ }
135
+
136
+ // createBaseClass gates init() to first-connect, so observing here is
137
+ // required for the detach/reattach cycle to keep working.
138
+ connectedCallback() {
139
+ super.connectedCallback?.();
140
+ this.#syncComponentState();
141
+ this.#observeAnchored();
142
+ }
143
+
144
+ disconnectedCallback() {
145
+ super.disconnectedCallback?.();
146
+ this.#anchoredClassObserver?.disconnect();
147
+ }
148
+
121
149
  #syncAvailableSizeAttr() {
122
150
  const anchor = this.defaultSlot?.assignedElements()?.[0];
123
151