@descope-ui/descope-anchored 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-anchored",
|
|
3
|
-
"version": "3.13.
|
|
3
|
+
"version": "3.13.2",
|
|
4
4
|
"files": [
|
|
5
5
|
"src",
|
|
6
6
|
"stories"
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@playwright/test": "1.58.2",
|
|
18
|
-
"e2e-utils": "3.13.
|
|
19
|
-
"test-assets": "3.13.
|
|
20
|
-
"test-drivers": "3.13.
|
|
18
|
+
"e2e-utils": "3.13.2",
|
|
19
|
+
"test-assets": "3.13.2",
|
|
20
|
+
"test-drivers": "3.13.2"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@descope-ui/common": "3.13.
|
|
24
|
-
"@descope-ui/theme-globals": "3.13.
|
|
23
|
+
"@descope-ui/common": "3.13.2",
|
|
24
|
+
"@descope-ui/theme-globals": "3.13.2"
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"link-workspace-packages": false
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
forwardAttrs,
|
|
5
5
|
getComponentName,
|
|
6
6
|
injectStyle,
|
|
7
|
+
observeAttributes,
|
|
7
8
|
} from '@descope-ui/common/components-helpers';
|
|
8
9
|
import { compose } from '@descope-ui/common/utils';
|
|
9
10
|
|
|
@@ -19,6 +20,11 @@ class RawAnchored extends createBaseClass({
|
|
|
19
20
|
|
|
20
21
|
#hostStretchSheet = null;
|
|
21
22
|
|
|
23
|
+
// Observes the anchor's `class` attribute so runtime updates by the SDK
|
|
24
|
+
// (e.g. real-time conditional components toggling `.hidden`) propagate to
|
|
25
|
+
// this element. Without this, only the initial slotchange would sync.
|
|
26
|
+
#anchorClassObserver = null;
|
|
27
|
+
|
|
22
28
|
get #anchor() {
|
|
23
29
|
return this.defaultSlot.assignedElements({ flatten: true })[0];
|
|
24
30
|
}
|
|
@@ -121,6 +127,28 @@ class RawAnchored extends createBaseClass({
|
|
|
121
127
|
this.#anchored,
|
|
122
128
|
'st-host-direction',
|
|
123
129
|
);
|
|
130
|
+
|
|
131
|
+
this.#observeAnchorClass();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
#observeAnchorClass() {
|
|
135
|
+
this.#anchorClassObserver?.disconnect();
|
|
136
|
+
if (this.#anchor) {
|
|
137
|
+
this.#anchorClassObserver = observeAttributes(
|
|
138
|
+
this.#anchor,
|
|
139
|
+
() => this.#syncComponentState(),
|
|
140
|
+
{ includeAttrs: ['class'] },
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// createBaseClass gates init() to first-connect (#isInit). Without
|
|
146
|
+
// re-observing here, runtime `.hidden` toggles stop syncing after a
|
|
147
|
+
// detach/reattach cycle.
|
|
148
|
+
connectedCallback() {
|
|
149
|
+
super.connectedCallback?.();
|
|
150
|
+
this.#observeAnchorClass();
|
|
151
|
+
this.#syncComponentState();
|
|
124
152
|
}
|
|
125
153
|
|
|
126
154
|
// Injects [stretch] layout rules into the containing component's shadow root (e.g. descope-attachment)
|
|
@@ -162,6 +190,7 @@ class RawAnchored extends createBaseClass({
|
|
|
162
190
|
super.disconnectedCallback?.();
|
|
163
191
|
this.#stretchObserver?.disconnect();
|
|
164
192
|
this.#directionObserver?.disconnect();
|
|
193
|
+
this.#anchorClassObserver?.disconnect();
|
|
165
194
|
}
|
|
166
195
|
|
|
167
196
|
// Track whether anything is slotted, so the host display rule can hide an
|