@leavittsoftware/web 8.5.3 → 8.7.0
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": "@leavittsoftware/web",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.7.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"files": [
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"url": "https://github.com/LeavittSoftware/titanium-elements/issues"
|
|
45
45
|
},
|
|
46
46
|
"homepage": "https://github.com/LeavittSoftware/titanium-elements/#readme",
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "6b8bf27873e0dbd791b3fd6b41d10888041abab8"
|
|
48
48
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
2
|
/**
|
|
3
3
|
* Titanium drawer - a minimalist fly-out style drawer based on a native dialog
|
|
4
4
|
*
|
|
@@ -9,6 +9,7 @@ import { LitElement } from 'lit';
|
|
|
9
9
|
* @cssprop {Color} [--md-sys-color-on-background] Color of slotted h3 and h4
|
|
10
10
|
*/
|
|
11
11
|
export declare class TitaniumDrawer extends LitElement {
|
|
12
|
+
#private;
|
|
12
13
|
private accessor dialog;
|
|
13
14
|
/**
|
|
14
15
|
* Set the position of content fixed when menu is closed. Only takes effect if always-show-content is set.
|
|
@@ -24,8 +25,11 @@ export declare class TitaniumDrawer extends LitElement {
|
|
|
24
25
|
accessor direction: 'ltr' | 'rtl';
|
|
25
26
|
private accessor hasHeader;
|
|
26
27
|
private accessor hasFooter;
|
|
28
|
+
accessor mode: 'inline' | 'flyover' | null;
|
|
29
|
+
accessor isOpen: boolean;
|
|
27
30
|
private readonly headerElements;
|
|
28
31
|
private readonly footerElements;
|
|
32
|
+
updated(changedProps: PropertyValues<this>): Promise<void>;
|
|
29
33
|
firstUpdated(): Promise<void>;
|
|
30
34
|
static animationsComplete(element: HTMLElement): Promise<PromiseSettledResult<Animation>[]>;
|
|
31
35
|
/**
|
|
@@ -36,6 +40,7 @@ export declare class TitaniumDrawer extends LitElement {
|
|
|
36
40
|
* Closes drawer
|
|
37
41
|
*/
|
|
38
42
|
close(): Promise<void>;
|
|
43
|
+
toggle(): void;
|
|
39
44
|
/**
|
|
40
45
|
* Closes drawer without animations
|
|
41
46
|
*/
|
|
@@ -41,6 +41,38 @@ let TitaniumDrawer = class TitaniumDrawer extends LitElement {
|
|
|
41
41
|
#hasFooter_accessor_storage = false;
|
|
42
42
|
get hasFooter() { return this.#hasFooter_accessor_storage; }
|
|
43
43
|
set hasFooter(value) { this.#hasFooter_accessor_storage = value; }
|
|
44
|
+
#mode_accessor_storage;
|
|
45
|
+
get mode() { return this.#mode_accessor_storage; }
|
|
46
|
+
set mode(value) { this.#mode_accessor_storage = value; }
|
|
47
|
+
#isOpen_accessor_storage = false;
|
|
48
|
+
get isOpen() { return this.#isOpen_accessor_storage; } //read only
|
|
49
|
+
set isOpen(value) { this.#isOpen_accessor_storage = value; }
|
|
50
|
+
async updated(changedProps) {
|
|
51
|
+
if (changedProps.has('mode')) {
|
|
52
|
+
if (this.mode === 'inline') {
|
|
53
|
+
if (this.isOpen) {
|
|
54
|
+
//drawer was already open in inline mode, so we need to keep it open
|
|
55
|
+
this.alwayShowContent = true;
|
|
56
|
+
}
|
|
57
|
+
//close the flyover drawer, we are inline now
|
|
58
|
+
this?.close();
|
|
59
|
+
}
|
|
60
|
+
if (this.mode === 'flyover') {
|
|
61
|
+
//we are now in flyover mode, so we need to open the drawer if it was open
|
|
62
|
+
if (this.isOpen) {
|
|
63
|
+
this.dialog?.showModal();
|
|
64
|
+
this.dialog?.removeAttribute('hide');
|
|
65
|
+
this.setBodyOverflow('hidden');
|
|
66
|
+
}
|
|
67
|
+
//we are now in flyover mode, we need to hide the inline content
|
|
68
|
+
this.alwayShowContent = false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
#setOpen(isOpen) {
|
|
73
|
+
this.isOpen = isOpen;
|
|
74
|
+
this.dispatchEvent(new Event('open-change'));
|
|
75
|
+
}
|
|
44
76
|
async firstUpdated() {
|
|
45
77
|
let touchstartX = 0;
|
|
46
78
|
let touchendX = 0;
|
|
@@ -75,26 +107,54 @@ let TitaniumDrawer = class TitaniumDrawer extends LitElement {
|
|
|
75
107
|
* Opens drawer
|
|
76
108
|
*/
|
|
77
109
|
open() {
|
|
78
|
-
this.
|
|
79
|
-
|
|
80
|
-
this.
|
|
110
|
+
if (this.isOpen)
|
|
111
|
+
return;
|
|
112
|
+
if (this.mode === 'inline') {
|
|
113
|
+
this.#setOpen(true);
|
|
114
|
+
this.alwayShowContent = true;
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
this.dialog?.showModal();
|
|
118
|
+
this.dialog?.removeAttribute('hide');
|
|
119
|
+
this.setBodyOverflow('hidden');
|
|
120
|
+
}
|
|
81
121
|
}
|
|
82
122
|
/**
|
|
83
123
|
* Closes drawer
|
|
84
124
|
*/
|
|
85
125
|
async close() {
|
|
86
|
-
if (this.
|
|
126
|
+
if (!this.isOpen)
|
|
127
|
+
return;
|
|
128
|
+
if (this.mode === 'inline') {
|
|
129
|
+
this.#setOpen(false);
|
|
130
|
+
this.alwayShowContent = false;
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
87
133
|
this.dialog?.setAttribute('hide', '');
|
|
88
134
|
await TitaniumDrawer_1.animationsComplete(this.dialog);
|
|
89
135
|
this.dialog?.close();
|
|
90
136
|
this.dialog?.removeAttribute('hide');
|
|
91
137
|
}
|
|
92
138
|
}
|
|
139
|
+
toggle() {
|
|
140
|
+
if (this.isOpen) {
|
|
141
|
+
this.close();
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
this.open();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
93
147
|
/**
|
|
94
148
|
* Closes drawer without animations
|
|
95
149
|
*/
|
|
96
150
|
closeQuick() {
|
|
97
|
-
if (this.
|
|
151
|
+
if (!this.isOpen)
|
|
152
|
+
return;
|
|
153
|
+
if (this.mode === 'inline') {
|
|
154
|
+
this.#setOpen(false);
|
|
155
|
+
this.alwayShowContent = false;
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
98
158
|
this.dialog?.close();
|
|
99
159
|
}
|
|
100
160
|
}
|
|
@@ -310,7 +370,14 @@ let TitaniumDrawer = class TitaniumDrawer extends LitElement {
|
|
|
310
370
|
this.setBodyOverflow('');
|
|
311
371
|
redispatchEvent(this, e);
|
|
312
372
|
}}
|
|
313
|
-
@toggle=${(e) =>
|
|
373
|
+
@toggle=${(e) => {
|
|
374
|
+
//isOpen state is fully managed by the drawer when not in flyover mode
|
|
375
|
+
if (this.mode === 'flyover') {
|
|
376
|
+
const isOpen = e.target?.hasAttribute('open');
|
|
377
|
+
this.#setOpen(isOpen);
|
|
378
|
+
}
|
|
379
|
+
redispatchEvent(this, e);
|
|
380
|
+
}}
|
|
314
381
|
part="dialog"
|
|
315
382
|
>
|
|
316
383
|
<header part="header"><slot name="header" @slotchange=${() => (this.hasHeader = this.headerElements.length > 0)}></slot></header>
|
|
@@ -337,6 +404,12 @@ __decorate([
|
|
|
337
404
|
__decorate([
|
|
338
405
|
property({ type: Boolean, reflect: true, attribute: 'has-footer' })
|
|
339
406
|
], TitaniumDrawer.prototype, "hasFooter", null);
|
|
407
|
+
__decorate([
|
|
408
|
+
property({ type: String, reflect: true, attribute: 'mode' })
|
|
409
|
+
], TitaniumDrawer.prototype, "mode", null);
|
|
410
|
+
__decorate([
|
|
411
|
+
property({ type: Boolean, reflect: true, attribute: 'open' })
|
|
412
|
+
], TitaniumDrawer.prototype, "isOpen", null);
|
|
340
413
|
__decorate([
|
|
341
414
|
queryAssignedElements({ slot: 'header' })
|
|
342
415
|
], TitaniumDrawer.prototype, "headerElements", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.js","sourceRoot":"","sources":["drawer.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"drawer.js","sourceRoot":"","sources":["drawer.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AAEjF;;;;;;;;GAQG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,UAAU;;IACV,yBAAiC;IAAjC,IAAA,MAAM,4CAA2B;IAAjC,IAAA,MAAM,kDAA2B;IAKd,0BAAiB,KAAK,CAAC;IAH5E;;OAEG;IACkD,IAAA,KAAK,2CAAkB;IAAvB,IAAA,KAAK,iDAAkB;IAKW,qCAA4B,KAAK,CAAC;IAHzH;;OAEG;IACoF,IAAA,gBAAgB,sDAAkB;IAAlC,IAAA,gBAAgB,4DAAkB;IAKrE,8BAA2B,KAAK,CAAC;IAHrF;;OAEG;IACiD,IAAA,SAAS,+CAAwB;IAAjC,IAAA,SAAS,qDAAwB;IAEC,8BAAY,KAAK,CAAC;IAAlB,IAAA,SAAS,+CAAS;IAAlB,IAAA,SAAS,qDAAS;IAClB,8BAAY,KAAK,CAAC;IAAlB,IAAA,SAAS,+CAAS;IAAlB,IAAA,SAAS,qDAAS;IAEjC,uBAAkC;IAAlC,IAAA,IAAI,0CAA8B;IAAlC,IAAA,IAAI,gDAA8B;IACjC,2BAAkB,KAAK,CAAC;IAAxB,IAAA,MAAM,4CAAkB,CAAC,WAAW;IAApC,IAAA,MAAM,kDAAkB;IAKhG,KAAK,CAAC,OAAO,CAAC,YAAkC;QAC9C,IAAI,YAAY,CAAC,GA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