@lion/ui 0.16.0-alpha.0 → 0.16.1
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/components/overlays/src/OverlayController.js +1 -1
- package/components/overlays/src/OverlaysManager.js +4 -4
- package/components/overlays/test/OverlayController.test.js +36 -0
- package/components/overlays/test/OverlaysManager.test.js +1 -1
- package/components/overlays/test-suites/OverlayMixin.suite.js +58 -0
- package/custom-elements.json +39 -39
- package/dist-types/components/overlays/src/OverlaysManager.d.ts +2 -2
- package/dist-types/components/overlays/src/OverlaysManager.d.ts.map +1 -1
- package/dist-types/components/overlays/test-suites/OverlayMixin.suite.d.ts.map +1 -1
- package/dist-types/tsconfig.tsbuildinfo +1 -1
- package/docs/components/checkbox-group/overview.md +2 -2
- package/docs/components/collapsible/overview.md +1 -1
- package/docs/components/combobox/overview.md +1 -1
- package/docs/components/combobox/use-cases.md +1 -1
- package/docs/components/dialog/overview.md +1 -1
- package/docs/components/fieldset/overview.md +5 -5
- package/docs/components/form/overview.md +3 -3
- package/docs/components/form/use-cases.md +2 -2
- package/docs/components/icon/use-cases.md +1 -1
- package/docs/components/input/overview.md +1 -1
- package/docs/components/input-amount/overview.md +3 -3
- package/docs/components/input-date/overview.md +3 -3
- package/docs/components/input-datepicker/overview.md +5 -5
- package/docs/components/input-email/overview.md +2 -2
- package/docs/components/input-file/overview.md +1 -1
- package/docs/components/input-iban/overview.md +2 -2
- package/docs/components/input-range/overview.md +2 -2
- package/docs/components/input-stepper/overview.md +1 -1
- package/docs/components/input-tel/overview.md +1 -1
- package/docs/components/input-tel/use-cases.md +6 -6
- package/docs/components/input-tel-dropdown/overview.md +1 -1
- package/docs/components/listbox/use-cases.md +1 -1
- package/docs/components/radio-group/overview.md +3 -3
- package/docs/components/select/use-cases.md +1 -1
- package/docs/components/select-rich/use-cases.md +2 -2
- package/docs/components/tabs/examples.md +1 -1
- package/docs/fundamentals/index.md +4 -4
- package/docs/fundamentals/node-tools/publish-docs/overview.md +3 -3
- package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +2 -2
- package/docs/fundamentals/rationales/accessibility.md +1 -1
- package/docs/fundamentals/systems/core/SlotMixin.md +1 -1
- package/docs/fundamentals/systems/core/overview.md +1 -1
- package/docs/fundamentals/systems/form/formatting-and-parsing.md +4 -4
- package/docs/fundamentals/systems/form/model-value.md +1 -1
- package/docs/fundamentals/systems/form/overview.md +28 -28
- package/docs/fundamentals/systems/form/validate.md +2 -2
- package/docs/fundamentals/systems/localize/overview.md +4 -4
- package/docs/fundamentals/systems/overlays/api-table.md +6 -5
- package/docs/fundamentals/systems/overlays/configuration.md +2 -2
- package/docs/fundamentals/systems/overlays/overview.md +5 -5
- package/docs/fundamentals/systems/overlays/use-cases.md +2 -2
- package/docs/fundamentals/tools/helpers/overview.md +1 -1
- package/docs/fundamentals/tools/singleton-manager/overview.md +4 -4
- package/docs/guides/how-to/create-a-custom-field.md +5 -5
- package/docs/guides/how-to/create-a-form.md +4 -4
- package/docs/guides/how-to/extend-a-native-input.md +2 -2
- package/docs/guides/index.md +8 -8
- package/docs/guides/principles/index.md +5 -5
- package/docs/guides/principles/styling.md +1 -1
- package/package.json +1 -1
|
@@ -46,8 +46,8 @@ export class OverlaysManager {
|
|
|
46
46
|
* @private
|
|
47
47
|
*/
|
|
48
48
|
this.__shownList = [];
|
|
49
|
-
/** @
|
|
50
|
-
this.
|
|
49
|
+
/** @protected */
|
|
50
|
+
this._siblingsInert = false;
|
|
51
51
|
/**
|
|
52
52
|
* @type {WeakMap<OverlayController, OverlayController[]>}
|
|
53
53
|
* @private
|
|
@@ -118,7 +118,7 @@ export class OverlaysManager {
|
|
|
118
118
|
|
|
119
119
|
this.__list = [];
|
|
120
120
|
this.__shownList = [];
|
|
121
|
-
this.
|
|
121
|
+
this._siblingsInert = false;
|
|
122
122
|
|
|
123
123
|
if (OverlaysManager.__globalStyleNode) {
|
|
124
124
|
document.head.removeChild(
|
|
@@ -131,7 +131,7 @@ export class OverlaysManager {
|
|
|
131
131
|
/** Features right now only for Global Overlay Manager */
|
|
132
132
|
|
|
133
133
|
get siblingsInert() {
|
|
134
|
-
return this.
|
|
134
|
+
return this._siblingsInert;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
/** PreventsScroll */
|
|
@@ -310,6 +310,42 @@ describe('OverlayController', () => {
|
|
|
310
310
|
|
|
311
311
|
expect(isRegisteredOnManager(ctrl)).to.be.false;
|
|
312
312
|
});
|
|
313
|
+
|
|
314
|
+
it('handles removal from DOM gracefully when overlay is open', async () => {
|
|
315
|
+
const contentNode = /** @type {HTMLElement} */ (fixtureSync(html`<div>my content</div>`));
|
|
316
|
+
const ctrl = new OverlayController({
|
|
317
|
+
placementMode: 'global',
|
|
318
|
+
contentNode,
|
|
319
|
+
});
|
|
320
|
+
await ctrl.show();
|
|
321
|
+
expect(ctrl.isShown).to.be.true;
|
|
322
|
+
expect(isRegisteredOnManager(ctrl)).to.be.true;
|
|
323
|
+
|
|
324
|
+
// Remove contentNode from DOM (simulates element being removed while open)
|
|
325
|
+
contentNode.parentElement?.removeChild(contentNode);
|
|
326
|
+
|
|
327
|
+
// Manually trigger teardown (normally happens via disconnectedCallback in OverlayMixin)
|
|
328
|
+
ctrl.teardown();
|
|
329
|
+
|
|
330
|
+
// Teardown should complete without errors
|
|
331
|
+
expect(isRegisteredOnManager(ctrl)).to.be.false;
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
it('does not throw when hide() is called after teardown() on a shown controller', async () => {
|
|
335
|
+
const ctrl = new OverlayController({
|
|
336
|
+
...withGlobalTestConfig(),
|
|
337
|
+
});
|
|
338
|
+
await ctrl.show();
|
|
339
|
+
expect(ctrl.isShown).to.be.true;
|
|
340
|
+
|
|
341
|
+
// teardown removes the controller from the manager
|
|
342
|
+
ctrl.teardown();
|
|
343
|
+
expect(isRegisteredOnManager(ctrl)).to.be.false;
|
|
344
|
+
|
|
345
|
+
// hide() should handle gracefully that the controller is no longer on the manager
|
|
346
|
+
await ctrl.hide();
|
|
347
|
+
expect(ctrl.isShown).to.be.false;
|
|
348
|
+
});
|
|
313
349
|
});
|
|
314
350
|
|
|
315
351
|
describe('Node Configuration', () => {
|
|
@@ -46,7 +46,7 @@ describe('OverlaysManager', () => {
|
|
|
46
46
|
// @ts-ignore [allow-private-in-test]
|
|
47
47
|
expect(mngr.__shownList).to.be.empty;
|
|
48
48
|
// @ts-ignore [allow-private-in-test]
|
|
49
|
-
expect(mngr.
|
|
49
|
+
expect(mngr._siblingsInert).to.be.false;
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
it('can add/remove controllers', () => {
|
|
@@ -597,6 +597,64 @@ export function runOverlayMixinSuite({ tagString, tag, suffix = '' }) {
|
|
|
597
597
|
expect(isCtrlRegisteredAtOverlaysManager).to.equal(true);
|
|
598
598
|
});
|
|
599
599
|
|
|
600
|
+
it('teardown completes successfully when open overlay is removed from DOM', async () => {
|
|
601
|
+
const el = /** @type {OverlayEl} */ (
|
|
602
|
+
await fixture(html`
|
|
603
|
+
<${tag}>
|
|
604
|
+
<div slot="content">content of the overlay</div>
|
|
605
|
+
<button slot="invoker">invoker button</button>
|
|
606
|
+
</${tag}>
|
|
607
|
+
`)
|
|
608
|
+
);
|
|
609
|
+
|
|
610
|
+
// 1. Open the overlay
|
|
611
|
+
el.opened = true;
|
|
612
|
+
await el.updateComplete;
|
|
613
|
+
await el._overlayCtrl._showComplete;
|
|
614
|
+
expect(el._overlayCtrl.isShown).to.be.true;
|
|
615
|
+
|
|
616
|
+
// 2. Remove element from DOM without closing
|
|
617
|
+
/** @type {HTMLElement} */ (el.parentNode).removeChild(el);
|
|
618
|
+
|
|
619
|
+
// 3. Wait for _isPermanentlyDisconnected to resolve and teardown to complete
|
|
620
|
+
await aTimeout(0);
|
|
621
|
+
|
|
622
|
+
// 4. Teardown should complete without errors
|
|
623
|
+
// The controller should no longer be registered
|
|
624
|
+
expect(el._overlayCtrl.manager.list.find(ctrl => ctrl === el._overlayCtrl)).to.be.undefined;
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
it('does not throw when element is removed from DOM while overlay is open', async () => {
|
|
628
|
+
const el = /** @type {OverlayEl} */ (
|
|
629
|
+
await fixture(html`
|
|
630
|
+
<${tag}>
|
|
631
|
+
<div slot="content">content of the overlay</div>
|
|
632
|
+
<button slot="invoker">invoker button</button>
|
|
633
|
+
</${tag}>
|
|
634
|
+
`)
|
|
635
|
+
);
|
|
636
|
+
|
|
637
|
+
// 1. Open the overlay
|
|
638
|
+
el.opened = true;
|
|
639
|
+
await el.updateComplete;
|
|
640
|
+
await el._overlayCtrl._showComplete;
|
|
641
|
+
expect(el._overlayCtrl.isShown).to.be.true;
|
|
642
|
+
|
|
643
|
+
// 2. Store reference to the controller before removal
|
|
644
|
+
const ctrl = el._overlayCtrl;
|
|
645
|
+
|
|
646
|
+
// 3. Remove element from DOM without closing the overlay
|
|
647
|
+
/** @type {HTMLElement} */ (el.parentNode).removeChild(el);
|
|
648
|
+
|
|
649
|
+
// 4. Wait for _isPermanentlyDisconnected to resolve and teardown to complete
|
|
650
|
+
await aTimeout(0);
|
|
651
|
+
|
|
652
|
+
// 5. Teardown removed the controller from the manager.
|
|
653
|
+
// hide() should handle this gracefully without throwing.
|
|
654
|
+
await ctrl.hide();
|
|
655
|
+
expect(ctrl.isShown).to.be.false;
|
|
656
|
+
});
|
|
657
|
+
|
|
600
658
|
it('correctly removes event listeners when disconnected from dom', async () => {
|
|
601
659
|
const el = /** @type {OverlayEl} */ (
|
|
602
660
|
await fixture(html`
|
package/custom-elements.json
CHANGED
|
@@ -2158,6 +2158,36 @@
|
|
|
2158
2158
|
}
|
|
2159
2159
|
]
|
|
2160
2160
|
},
|
|
2161
|
+
{
|
|
2162
|
+
"kind": "javascript-module",
|
|
2163
|
+
"path": "exports/define-helpers/sb-action-logger.js",
|
|
2164
|
+
"declarations": [],
|
|
2165
|
+
"exports": [
|
|
2166
|
+
{
|
|
2167
|
+
"kind": "custom-element-definition",
|
|
2168
|
+
"name": "sb-action-logger",
|
|
2169
|
+
"declaration": {
|
|
2170
|
+
"name": "SbActionLogger",
|
|
2171
|
+
"module": "/exports/helpers.js"
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
]
|
|
2175
|
+
},
|
|
2176
|
+
{
|
|
2177
|
+
"kind": "javascript-module",
|
|
2178
|
+
"path": "exports/define-helpers/sb-locale-switcher.js",
|
|
2179
|
+
"declarations": [],
|
|
2180
|
+
"exports": [
|
|
2181
|
+
{
|
|
2182
|
+
"kind": "custom-element-definition",
|
|
2183
|
+
"name": "sb-locale-switcher",
|
|
2184
|
+
"declaration": {
|
|
2185
|
+
"name": "SbLocaleSwitcher",
|
|
2186
|
+
"module": "/exports/helpers.js"
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
]
|
|
2190
|
+
},
|
|
2161
2191
|
{
|
|
2162
2192
|
"kind": "javascript-module",
|
|
2163
2193
|
"path": "exports/define/lion-accordion.js",
|
|
@@ -2863,36 +2893,6 @@
|
|
|
2863
2893
|
}
|
|
2864
2894
|
]
|
|
2865
2895
|
},
|
|
2866
|
-
{
|
|
2867
|
-
"kind": "javascript-module",
|
|
2868
|
-
"path": "exports/define-helpers/sb-action-logger.js",
|
|
2869
|
-
"declarations": [],
|
|
2870
|
-
"exports": [
|
|
2871
|
-
{
|
|
2872
|
-
"kind": "custom-element-definition",
|
|
2873
|
-
"name": "sb-action-logger",
|
|
2874
|
-
"declaration": {
|
|
2875
|
-
"name": "SbActionLogger",
|
|
2876
|
-
"module": "/exports/helpers.js"
|
|
2877
|
-
}
|
|
2878
|
-
}
|
|
2879
|
-
]
|
|
2880
|
-
},
|
|
2881
|
-
{
|
|
2882
|
-
"kind": "javascript-module",
|
|
2883
|
-
"path": "exports/define-helpers/sb-locale-switcher.js",
|
|
2884
|
-
"declarations": [],
|
|
2885
|
-
"exports": [
|
|
2886
|
-
{
|
|
2887
|
-
"kind": "custom-element-definition",
|
|
2888
|
-
"name": "sb-locale-switcher",
|
|
2889
|
-
"declaration": {
|
|
2890
|
-
"name": "SbLocaleSwitcher",
|
|
2891
|
-
"module": "/exports/helpers.js"
|
|
2892
|
-
}
|
|
2893
|
-
}
|
|
2894
|
-
]
|
|
2895
|
-
},
|
|
2896
2896
|
{
|
|
2897
2897
|
"kind": "javascript-module",
|
|
2898
2898
|
"path": "components/accordion/src/LionAccordion.js",
|
|
@@ -122788,6 +122788,15 @@
|
|
|
122788
122788
|
"name": "teardown",
|
|
122789
122789
|
"privacy": "public"
|
|
122790
122790
|
},
|
|
122791
|
+
{
|
|
122792
|
+
"kind": "field",
|
|
122793
|
+
"name": "_siblingsInert",
|
|
122794
|
+
"type": {
|
|
122795
|
+
"text": "boolean"
|
|
122796
|
+
},
|
|
122797
|
+
"privacy": "protected",
|
|
122798
|
+
"default": "false"
|
|
122799
|
+
},
|
|
122791
122800
|
{
|
|
122792
122801
|
"kind": "field",
|
|
122793
122802
|
"name": "__blockingMap",
|
|
@@ -122820,15 +122829,6 @@
|
|
|
122820
122829
|
},
|
|
122821
122830
|
"privacy": "private",
|
|
122822
122831
|
"default": "[]"
|
|
122823
|
-
},
|
|
122824
|
-
{
|
|
122825
|
-
"kind": "field",
|
|
122826
|
-
"name": "__siblingsInert",
|
|
122827
|
-
"type": {
|
|
122828
|
-
"text": "boolean"
|
|
122829
|
-
},
|
|
122830
|
-
"privacy": "private",
|
|
122831
|
-
"default": "false"
|
|
122832
122832
|
}
|
|
122833
122833
|
]
|
|
122834
122834
|
}
|
|
@@ -23,8 +23,8 @@ export class OverlaysManager {
|
|
|
23
23
|
* @private
|
|
24
24
|
*/
|
|
25
25
|
private __shownList;
|
|
26
|
-
/** @
|
|
27
|
-
|
|
26
|
+
/** @protected */
|
|
27
|
+
protected _siblingsInert: boolean;
|
|
28
28
|
/**
|
|
29
29
|
* @type {WeakMap<OverlayController, OverlayController[]>}
|
|
30
30
|
* @private
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlaysManager.d.ts","sourceRoot":"","sources":["../../../../components/overlays/src/OverlaysManager.js"],"names":[],"mappings":"AASA;;GAEG;AACH;IACE,mDAMC;IAED;;;OAGG;IACH,iEAEC;IAED;;;OAGG;IACH,sEAEC;IAGC;;;OAGG;IACH,eAAgB;IAChB;;;OAGG;IACH,oBAAqB;IACrB,
|
|
1
|
+
{"version":3,"file":"OverlaysManager.d.ts","sourceRoot":"","sources":["../../../../components/overlays/src/OverlaysManager.js"],"names":[],"mappings":"AASA;;GAEG;AACH;IACE,mDAMC;IAED;;;OAGG;IACH,iEAEC;IAED;;;OAGG;IACH,sEAEC;IAGC;;;OAGG;IACH,eAAgB;IAChB;;;OAGG;IACH,oBAAqB;IACrB,iBAAiB;IACjB,kCAA2B;IAC3B;;;OAGG;IACH,sBAAkC;IAOpC;;;;OAIG;IACH,eAHW,iBAAiB,GACf,iBAAiB,CAQ7B;IAED;;OAEG;IACH,qBAFW,iBAAiB,QAQ3B;IAED;;OAEG;IACH,iBAFW,iBAAiB,QAe3B;IAED;;OAEG;IACH,iBAFW,GAAG,QAOb;IAED,iBAeC;IAED,yDAAyD;IAEzD,6BAEC;IAED,qBAAqB;IAGrB,+BAYC;IAED;;OAEG;IACH,gHAoBC;IAED;;;OAGG;IACH,gCAFW,iBAAiB,QAM3B;IAED;;OAEG;IACH,uCAFW,iBAAiB,QAS3B;CACF;;6BAEU,gBAAgB,GAAG,SAAS;;wBAtM1B,OAAO,KAAK,EAAE,SAAS;gCACvB,OAAO,wBAAwB,EAAE,iBAAiB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayMixin.suite.d.ts","sourceRoot":"","sources":["../../../../components/overlays/test-suites/OverlayMixin.suite.js"],"names":[],"mappings":"AAwDA;;GAEG;AACH,iEAFW;IAAC,SAAS,EAAC,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAC,MAAM,CAAA;CAAC,
|
|
1
|
+
{"version":3,"file":"OverlayMixin.suite.d.ts","sourceRoot":"","sources":["../../../../components/overlays/test-suites/OverlayMixin.suite.js"],"names":[],"mappings":"AAwDA;;GAEG;AACH,iEAFW;IAAC,SAAS,EAAC,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAC,MAAM,CAAA;CAAC,QAkuBzD;kCAxwBY,OAAO,+BAA+B,EAAE,mBAAmB;wBAC3D,UAAU,GAAG,WAAW,GAAG;IAAC,YAAY,EAAC,iBAAiB,CAAA;CAAC;2BAC3D,OAAO,+BAA+B,EAAE,YAAY;0BACpD,OAAO,+BAA+B,EAAE,WAAW;4BACnD,OAAO,2BAA2B,EAAE,aAAa"}
|