tinkiet 0.11.2 → 0.11.8
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/accordion/index.js +72 -62
- package/box/index.js +58 -58
- package/button/button.d.ts +10 -3
- package/button/index.js +127 -92
- package/checkbox/checkbox.d.ts +2 -4
- package/checkbox/index.js +99 -86
- package/chip/chip.d.ts +1 -1
- package/chip/index.js +30 -8
- package/dialog/dialog.d.ts +6 -2
- package/dialog/index.js +29 -9
- package/drawer/drawer.d.ts +11 -6
- package/drawer/index.js +79 -49
- package/icon/icon.d.ts +2 -1
- package/icon/index.js +90 -76
- package/index.js +431 -296
- package/list-item/index.js +94 -88
- package/list-item/list-item.d.ts +4 -4
- package/loading/index.js +58 -58
- package/notie/index.js +58 -58
- package/package.json +1 -1
- package/radio/index.js +79 -79
- package/radio/radio.d.ts +2 -2
- package/router/index.d.ts +6 -0
- package/router/index.js +52 -40
- package/select/index.js +58 -58
- package/switch/index.js +75 -75
- package/switch/switch.d.ts +2 -2
- package/theme/index.js +23 -26
- package/theme/theme.d.ts +2 -1
- package/topbar/index.js +58 -58
- package/umd/tinkiet.min.js +87 -53
package/chip/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE_lit__ from "lit";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_lit_directives_class_map_js_2f88e643__ from "lit/directives/class-map.js";
|
|
2
3
|
import * as __WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__ from "lit/decorators.js";
|
|
3
4
|
/******/ var __webpack_modules__ = ({
|
|
4
5
|
|
|
@@ -26,6 +27,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
26
27
|
var external_lit_ = __webpack_require__(2927);
|
|
27
28
|
// EXTERNAL MODULE: external "lit/decorators.js"
|
|
28
29
|
var decorators_js_ = __webpack_require__(8899);
|
|
30
|
+
// EXTERNAL MODULE: external "lit/directives/class-map.js"
|
|
31
|
+
var class_map_js_ = __webpack_require__(4955);
|
|
29
32
|
;// ./tinkiet/chip/chip.scss
|
|
30
33
|
/* harmony default export */ const chip = ("*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:rgba(0,0,0,0);box-sizing:border-box}.chip{display:inline-flex;align-items:center;border-radius:10px;padding:3px 10px;background:hsl(var(--surface-container-highest));border:1px solid hsl(var(--outline-variant));font-size:13px;height:30px;gap:6px;line-height:1;cursor:pointer}.chip.disabled{opacity:.4;pointer-events:none}.chip .leading{display:inline-flex;align-items:center}.chip .leading slot::slotted(*){display:inline-flex;align-items:center}.chip .label{white-space:nowrap;display:inline-flex;align-items:center;line-height:1}.chip .trailing{display:inline-flex;align-items:center}.chip .trailing slot::slotted(*){display:inline-flex;align-items:center}.chip .trailing .remove{background:none;border:none;cursor:pointer;font-size:13px;line-height:1;opacity:.7}.chip .trailing .remove:hover{opacity:1}");
|
|
31
34
|
;// ./tinkiet/chip/chip.ts
|
|
@@ -38,6 +41,7 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
|
|
|
38
41
|
|
|
39
42
|
|
|
40
43
|
|
|
44
|
+
|
|
41
45
|
/**
|
|
42
46
|
* Material-style Chip component.
|
|
43
47
|
*
|
|
@@ -55,14 +59,21 @@ let TkChip = class TkChip extends external_lit_.LitElement {
|
|
|
55
59
|
super(...arguments);
|
|
56
60
|
this.disabled = false;
|
|
57
61
|
this.removable = false;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
this.onRemove = (event) => {
|
|
63
|
+
event.stopPropagation();
|
|
64
|
+
if (this.disabled)
|
|
65
|
+
return;
|
|
66
|
+
this.dispatchEvent(new CustomEvent("remove", { bubbles: true, composed: true }));
|
|
67
|
+
};
|
|
61
68
|
}
|
|
62
69
|
render() {
|
|
70
|
+
const classes = {
|
|
71
|
+
chip: true,
|
|
72
|
+
disabled: this.disabled
|
|
73
|
+
};
|
|
63
74
|
return (0,external_lit_.html) `
|
|
64
|
-
<div class
|
|
65
|
-
|
|
75
|
+
<div class=${(0,class_map_js_.classMap)(classes)} aria-disabled=${this.disabled ? "true" : "false"}>
|
|
76
|
+
|
|
66
77
|
<!-- 3. LEADING ICON (optional) -->
|
|
67
78
|
<span class="leading">
|
|
68
79
|
<slot name="leading"></slot>
|
|
@@ -77,7 +88,7 @@ let TkChip = class TkChip extends external_lit_.LitElement {
|
|
|
77
88
|
<span class="trailing">
|
|
78
89
|
<slot name="trailing">
|
|
79
90
|
${this.removable
|
|
80
|
-
? (0,external_lit_.html) `<button class="remove" @click=${this.onRemove}>✕</button>`
|
|
91
|
+
? (0,external_lit_.html) `<button class="remove" type="button" ?disabled=${this.disabled} aria-label="Remove" @click=${this.onRemove}>✕</button>`
|
|
81
92
|
: ""}
|
|
82
93
|
</slot>
|
|
83
94
|
</span>
|
|
@@ -88,10 +99,10 @@ let TkChip = class TkChip extends external_lit_.LitElement {
|
|
|
88
99
|
};
|
|
89
100
|
TkChip.styles = (0,external_lit_.css) `${(0,external_lit_.unsafeCSS)(chip)}`;
|
|
90
101
|
__decorate([
|
|
91
|
-
(0,decorators_js_.property)({ type: Boolean })
|
|
102
|
+
(0,decorators_js_.property)({ type: Boolean, reflect: true })
|
|
92
103
|
], TkChip.prototype, "disabled", void 0);
|
|
93
104
|
__decorate([
|
|
94
|
-
(0,decorators_js_.property)({ type: Boolean })
|
|
105
|
+
(0,decorators_js_.property)({ type: Boolean, reflect: true })
|
|
95
106
|
], TkChip.prototype, "removable", void 0);
|
|
96
107
|
TkChip = __decorate([
|
|
97
108
|
(0,decorators_js_.customElement)("tk-chip")
|
|
@@ -99,6 +110,17 @@ TkChip = __decorate([
|
|
|
99
110
|
|
|
100
111
|
|
|
101
112
|
|
|
113
|
+
/***/ }),
|
|
114
|
+
|
|
115
|
+
/***/ 4955:
|
|
116
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
117
|
+
|
|
118
|
+
var x = (y) => {
|
|
119
|
+
var x = {}; __webpack_require__.d(x, y); return x
|
|
120
|
+
}
|
|
121
|
+
var y = (x) => (() => (x))
|
|
122
|
+
module.exports = x({ ["classMap"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_directives_class_map_js_2f88e643__.classMap) });
|
|
123
|
+
|
|
102
124
|
/***/ }),
|
|
103
125
|
|
|
104
126
|
/***/ 8899:
|
package/dialog/dialog.d.ts
CHANGED
|
@@ -4,9 +4,13 @@ export declare class TkDialog extends LitElement {
|
|
|
4
4
|
modal: boolean;
|
|
5
5
|
open: boolean;
|
|
6
6
|
blurOverlay: boolean;
|
|
7
|
-
private resolve
|
|
7
|
+
private resolve?;
|
|
8
|
+
private handleKeyDown;
|
|
9
|
+
private onOverlayClick;
|
|
8
10
|
render(): import("lit").TemplateResult<1>;
|
|
9
|
-
protected updated(
|
|
11
|
+
protected updated(changedProps: PropertyValueMap<this>): void;
|
|
12
|
+
connectedCallback(): void;
|
|
13
|
+
disconnectedCallback(): void;
|
|
10
14
|
show(): Promise<string | boolean | null>;
|
|
11
15
|
hide(value?: boolean | string | null): void;
|
|
12
16
|
}
|
package/dialog/index.js
CHANGED
|
@@ -9,7 +9,7 @@ var x = (y) => {
|
|
|
9
9
|
var x = {}; __webpack_require__.d(x, y); return x
|
|
10
10
|
}
|
|
11
11
|
var y = (x) => (() => (x))
|
|
12
|
-
module.exports = x({ ["LitElement"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.LitElement), ["css"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.css), ["html"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.html), ["unsafeCSS"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.unsafeCSS) });
|
|
12
|
+
module.exports = x({ ["LitElement"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.LitElement), ["css"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.css), ["html"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.html), ["nothing"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.nothing), ["unsafeCSS"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.unsafeCSS) });
|
|
13
13
|
|
|
14
14
|
/***/ }),
|
|
15
15
|
|
|
@@ -55,24 +55,44 @@ let TkDialog = class TkDialog extends external_lit_.LitElement {
|
|
|
55
55
|
this.modal = false;
|
|
56
56
|
this.open = false;
|
|
57
57
|
this.blurOverlay = false;
|
|
58
|
+
this.handleKeyDown = (event) => {
|
|
59
|
+
if (event.key === "Escape" && this.open && !this.modal)
|
|
60
|
+
this.hide();
|
|
61
|
+
};
|
|
62
|
+
this.onOverlayClick = () => {
|
|
63
|
+
if (!this.modal)
|
|
64
|
+
this.hide();
|
|
65
|
+
};
|
|
58
66
|
}
|
|
59
67
|
render() {
|
|
60
68
|
return (0,external_lit_.html) `
|
|
61
69
|
${this.open
|
|
62
70
|
? (0,external_lit_.html) `
|
|
63
|
-
<div class="overlay ${this.blurOverlay ? "blur" : ""}" @click=${
|
|
64
|
-
<div class="container">
|
|
71
|
+
<div class="overlay ${this.blurOverlay ? "blur" : ""}" @click=${this.onOverlayClick}></div>
|
|
72
|
+
<div class="container" role="dialog" aria-modal=${this.modal ? "true" : "false"}>
|
|
65
73
|
<slot></slot>
|
|
66
74
|
</div>
|
|
67
75
|
`
|
|
68
|
-
:
|
|
76
|
+
: external_lit_.nothing}
|
|
69
77
|
`;
|
|
70
78
|
}
|
|
71
|
-
updated(
|
|
72
|
-
if (
|
|
73
|
-
this.
|
|
74
|
-
|
|
75
|
-
|
|
79
|
+
updated(changedProps) {
|
|
80
|
+
if (changedProps.has("open")) {
|
|
81
|
+
if (this.open) {
|
|
82
|
+
this.dispatchEvent(new CustomEvent("did-show", { bubbles: true }));
|
|
83
|
+
}
|
|
84
|
+
else if (changedProps.get("open") === true) {
|
|
85
|
+
this.dispatchEvent(new CustomEvent("did-close", { bubbles: true }));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
connectedCallback() {
|
|
90
|
+
super.connectedCallback();
|
|
91
|
+
window.addEventListener("keydown", this.handleKeyDown);
|
|
92
|
+
}
|
|
93
|
+
disconnectedCallback() {
|
|
94
|
+
window.removeEventListener("keydown", this.handleKeyDown);
|
|
95
|
+
super.disconnectedCallback();
|
|
76
96
|
}
|
|
77
97
|
show() {
|
|
78
98
|
this.open = true;
|
package/drawer/drawer.d.ts
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import { LitElement } from "lit";
|
|
1
|
+
import { LitElement, PropertyValues } from "lit";
|
|
2
2
|
export declare class TkDrawer extends LitElement {
|
|
3
3
|
static styles: import("lit").CSSResult;
|
|
4
|
-
|
|
5
|
-
set open(value: boolean);
|
|
6
|
-
get open(): boolean;
|
|
4
|
+
open: boolean;
|
|
7
5
|
over: boolean;
|
|
8
6
|
openQuery: string;
|
|
9
7
|
overQuery: string;
|
|
10
8
|
right: boolean;
|
|
11
9
|
swipeable: boolean;
|
|
12
10
|
private $drawer;
|
|
11
|
+
private $content;
|
|
12
|
+
private contentScrolled;
|
|
13
|
+
private contentHasBottomShadow;
|
|
13
14
|
private mql;
|
|
15
|
+
private overMediaQueryListener;
|
|
16
|
+
private handleOverlayClick;
|
|
14
17
|
render(): import("lit").TemplateResult<1>;
|
|
15
|
-
|
|
18
|
+
protected firstUpdated(): void;
|
|
19
|
+
updated(props: PropertyValues<this>): void;
|
|
16
20
|
protected overMediaQuery(): void;
|
|
17
|
-
private
|
|
21
|
+
private handleContentScroll;
|
|
18
22
|
hideIfOver(): void;
|
|
19
23
|
show(): void;
|
|
20
24
|
hide(): void;
|
|
@@ -25,6 +29,7 @@ export declare class TkDrawer extends LitElement {
|
|
|
25
29
|
touchStart(event: TouchEvent): void;
|
|
26
30
|
touchMove(event: TouchEvent): void;
|
|
27
31
|
touchEnd(event: TouchEvent): void;
|
|
32
|
+
disconnectedCallback(): void;
|
|
28
33
|
}
|
|
29
34
|
declare global {
|
|
30
35
|
interface HTMLElementTagNameMap {
|
package/drawer/index.js
CHANGED
|
@@ -27,7 +27,7 @@ var external_lit_ = __webpack_require__(2927);
|
|
|
27
27
|
// EXTERNAL MODULE: external "lit/decorators.js"
|
|
28
28
|
var decorators_js_ = __webpack_require__(8899);
|
|
29
29
|
;// ./tinkiet/drawer/drawer.scss
|
|
30
|
-
/* harmony default export */ const drawer = ("*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:rgba(0,0,0,0);box-sizing:border-box}:host{display:block;height:100%;width:100%;position:relative;overflow:hidden;background-color:hsl(var(--surface))}.drawer{display:grid;grid-template-columns:var(--drawer-width, 256px) 10px;grid-template-rows:auto 1fr auto;grid-template-areas:\"header swipe\" \"content swipe\" \"footer swipe\";position:absolute;top:0;bottom:0;transform:translateX(calc(-100% + 10px));transition:transform cubic-bezier(0.4, 0, 0.2, 1) var(--transition-duration-medium, 180ms);will-change:transform;touch-action:pan-y;z-index:var(--drawer-z-index, 200);background-color:hsl(var(--surface))}.drawer .drawer-header{grid-area:header}.drawer .drawer-content{grid-area:content;overflow:auto}.drawer .drawer-footer{grid-area:footer}.drawer .drawer-swipe{grid-area:swipe;background-color:rgba(0,0,0,0)}:host([right]) .drawer{right:0;transform:translateX(calc(100% + 10px))}.overlay{position:absolute;top:0;left:0;right:0;bottom:0;z-index:var(--drawer-overlay-z-index, 200);background-color:rgba(0,0,0,.5);display:none}.container{transition:padding cubic-bezier(0.4, 0, 0.2, 1) var(--transition-duration-slow, 250ms);overflow:auto;height:100%}:host([open]) .drawer{transform:none}:host([open]) .container{padding-left:var(--drawer-width, 256px)}:host([open][over]) .drawer{background-color:hsl(var(--surface-container-low));box-shadow:0px 1px 2px 0px rgba(0, 0, 0, 0.3), 0px 1px 3px 1px rgba(0, 0, 0, 0.15)}:host([open][over]) .container{padding-left:0}:host([open][over]) .overlay{display:block}@media(max-width: var(--drawer-trigger-width, 400px)){:host([open]) .container{padding-left:0}:host([open]) .overlay{display:block}}");
|
|
30
|
+
/* harmony default export */ const drawer = ("*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:rgba(0,0,0,0);box-sizing:border-box}:host{display:block;height:100%;width:100%;position:relative;overflow:hidden;background-color:hsl(var(--surface))}.drawer{display:grid;grid-template-columns:var(--drawer-width, 256px) 10px;grid-template-rows:auto 1fr auto;grid-template-areas:\"header swipe\" \"content swipe\" \"footer swipe\";position:absolute;top:0;bottom:0;transform:translateX(calc(-100% + 10px));transition:transform cubic-bezier(0.4, 0, 0.2, 1) var(--transition-duration-medium, 180ms);will-change:transform;touch-action:pan-y;z-index:var(--drawer-z-index, 200);background-color:hsl(var(--surface))}.drawer .drawer-header{grid-area:header}.drawer .drawer-content{grid-area:content;overflow:auto;position:relative;transition:opacity var(--transition-duration-medium, 180ms) ease}.drawer .drawer-content::before,.drawer .drawer-content::after{content:\"\";position:sticky;display:block;height:14px;pointer-events:none;opacity:0;transition:opacity var(--transition-duration-medium, 180ms) ease;left:0;right:0;width:100%;z-index:1}.drawer .drawer-content::before{top:0;margin-top:-14px;background:linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0))}.drawer .drawer-content::after{bottom:0;margin-bottom:-14px;background:linear-gradient(0deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0))}.drawer .drawer-content.has-top-shadow::before{opacity:1}.drawer .drawer-content.has-bottom-shadow::after{opacity:1}.drawer .drawer-footer{grid-area:footer}.drawer .drawer-swipe{grid-area:swipe;background-color:rgba(0,0,0,0)}:host([right]) .drawer{right:0;transform:translateX(calc(100% + 10px))}.overlay{position:absolute;top:0;left:0;right:0;bottom:0;z-index:var(--drawer-overlay-z-index, 200);background-color:rgba(0,0,0,.5);display:none}.container{transition:padding cubic-bezier(0.4, 0, 0.2, 1) var(--transition-duration-slow, 250ms);overflow:auto;height:100%}:host([open]) .drawer{transform:none}:host([open]) .container{padding-left:var(--drawer-width, 256px)}:host([open][over]) .drawer{background-color:hsl(var(--surface-container-low));box-shadow:0px 1px 2px 0px rgba(0, 0, 0, 0.3), 0px 1px 3px 1px rgba(0, 0, 0, 0.15)}:host([open][over]) .container{padding-left:0}:host([open][over]) .overlay{display:block}@media(max-width: var(--drawer-trigger-width, 400px)){:host([open]) .container{padding-left:0}:host([open]) .overlay{display:block}}");
|
|
31
31
|
;// ./tinkiet/drawer/drawer.ts
|
|
32
32
|
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
33
33
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -38,43 +38,47 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
|
|
42
41
|
let TkDrawer = class TkDrawer extends external_lit_.LitElement {
|
|
43
42
|
constructor() {
|
|
44
43
|
super(...arguments);
|
|
45
|
-
this.
|
|
44
|
+
this.open = false;
|
|
46
45
|
this.over = false;
|
|
47
46
|
this.right = false;
|
|
48
47
|
this.swipeable = false;
|
|
48
|
+
this.contentScrolled = false;
|
|
49
|
+
this.contentHasBottomShadow = false;
|
|
50
|
+
this.overMediaQueryListener = (e) => {
|
|
51
|
+
e.matches ? this.setAttribute("over", "") : this.removeAttribute("over");
|
|
52
|
+
};
|
|
53
|
+
this.handleOverlayClick = () => {
|
|
54
|
+
this.hide();
|
|
55
|
+
};
|
|
56
|
+
this.handleContentScroll = () => {
|
|
57
|
+
if (!this.$content)
|
|
58
|
+
return;
|
|
59
|
+
const { scrollTop, scrollHeight, clientHeight } = this.$content;
|
|
60
|
+
this.contentScrolled = scrollTop > 0;
|
|
61
|
+
const atBottom = Math.ceil(scrollTop + clientHeight) >= scrollHeight;
|
|
62
|
+
this.contentHasBottomShadow = !atBottom && scrollHeight > clientHeight;
|
|
63
|
+
};
|
|
49
64
|
this.swipeX = 0;
|
|
50
65
|
this.swipeY = 0;
|
|
51
66
|
this.isHorizontalSwipe = false;
|
|
52
67
|
}
|
|
53
|
-
set open(value) {
|
|
54
|
-
if (value === this._open)
|
|
55
|
-
return;
|
|
56
|
-
const oldValue = this._open;
|
|
57
|
-
this._open = value;
|
|
58
|
-
this.requestUpdate("open", oldValue);
|
|
59
|
-
if (this._open)
|
|
60
|
-
this.dispatchEvent(new Event("did-show"));
|
|
61
|
-
if (!this._open)
|
|
62
|
-
this.dispatchEvent(new Event("did-close"));
|
|
63
|
-
}
|
|
64
|
-
get open() {
|
|
65
|
-
return this._open;
|
|
66
|
-
}
|
|
67
68
|
render() {
|
|
68
69
|
return (0,external_lit_.html) `
|
|
69
70
|
<div class="container">
|
|
70
71
|
<slot name="drawer-container"></slot>
|
|
71
72
|
</div>
|
|
72
|
-
<div class="overlay" @click=${
|
|
73
|
+
<div class="overlay" @click=${this.handleOverlayClick}></div>
|
|
73
74
|
<div class="drawer" @touchstart=${this.touchStart} @touchmove=${this.touchMove} @touchend=${this.touchEnd}>
|
|
74
75
|
<div class="drawer-header">
|
|
75
76
|
<slot name="drawer-header"></slot>
|
|
76
77
|
</div>
|
|
77
|
-
<div
|
|
78
|
+
<div
|
|
79
|
+
class="drawer-content ${this.contentScrolled ? "has-top-shadow" : ""} ${this.contentHasBottomShadow ? "has-bottom-shadow" : ""}"
|
|
80
|
+
@scroll=${this.handleContentScroll}
|
|
81
|
+
>
|
|
78
82
|
<slot name="drawer-content"></slot>
|
|
79
83
|
</div>
|
|
80
84
|
<div class="drawer-footer">
|
|
@@ -85,28 +89,39 @@ let TkDrawer = class TkDrawer extends external_lit_.LitElement {
|
|
|
85
89
|
|
|
86
90
|
`;
|
|
87
91
|
}
|
|
92
|
+
firstUpdated() {
|
|
93
|
+
if (this.overQuery)
|
|
94
|
+
this.overMediaQuery();
|
|
95
|
+
if (this.openQuery && window.matchMedia(this.openQuery).matches)
|
|
96
|
+
this.show();
|
|
97
|
+
this.handleContentScroll();
|
|
98
|
+
}
|
|
88
99
|
updated(props) {
|
|
89
|
-
|
|
100
|
+
super.updated(props);
|
|
101
|
+
if (props.has("overQuery") && this.overQuery)
|
|
90
102
|
this.overMediaQuery();
|
|
91
|
-
if (props.has("openQuery"))
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
103
|
+
if (props.has("openQuery") && this.openQuery && window.matchMedia(this.openQuery).matches)
|
|
104
|
+
this.show();
|
|
105
|
+
if (props.has("open")) {
|
|
106
|
+
if (this.open) {
|
|
107
|
+
this.dispatchEvent(new CustomEvent("did-show", { bubbles: true }));
|
|
108
|
+
}
|
|
109
|
+
else if (props.get("open") === true) {
|
|
110
|
+
this.dispatchEvent(new CustomEvent("did-close", { bubbles: true }));
|
|
111
|
+
}
|
|
112
|
+
if (this.swipeable && this.$drawer) {
|
|
113
|
+
requestAnimationFrame(() => {
|
|
114
|
+
this.$drawer.removeAttribute("style");
|
|
115
|
+
});
|
|
116
|
+
}
|
|
99
117
|
}
|
|
100
118
|
}
|
|
101
119
|
overMediaQuery() {
|
|
102
120
|
if (this.mql)
|
|
103
|
-
this.mql.removeEventListener("change", this.overMediaQueryListener
|
|
121
|
+
this.mql.removeEventListener("change", this.overMediaQueryListener);
|
|
104
122
|
this.mql = window.matchMedia(this.overQuery);
|
|
105
123
|
this.mql.matches ? this.setAttribute("over", "") : this.removeAttribute("over");
|
|
106
|
-
this.mql.addEventListener("change", this.overMediaQueryListener
|
|
107
|
-
}
|
|
108
|
-
overMediaQueryListener(e) {
|
|
109
|
-
e.matches ? this.setAttribute("over", "") : this.removeAttribute("over");
|
|
124
|
+
this.mql.addEventListener("change", this.overMediaQueryListener);
|
|
110
125
|
}
|
|
111
126
|
hideIfOver() {
|
|
112
127
|
var _a;
|
|
@@ -123,53 +138,59 @@ let TkDrawer = class TkDrawer extends external_lit_.LitElement {
|
|
|
123
138
|
this.open = !this.open;
|
|
124
139
|
}
|
|
125
140
|
touchStart(event) {
|
|
126
|
-
if (!this.swipeable)
|
|
141
|
+
if (!this.swipeable || !this.$drawer)
|
|
127
142
|
return;
|
|
128
143
|
this.$drawer.style.transition = "transform 0ms ease";
|
|
129
144
|
this.swipeX = event.touches[0].clientX;
|
|
130
145
|
this.swipeY = event.touches[0].clientY;
|
|
131
146
|
}
|
|
132
147
|
touchMove(event) {
|
|
133
|
-
if (!this.swipeable)
|
|
148
|
+
if (!this.swipeable || !this.$drawer)
|
|
134
149
|
return;
|
|
135
150
|
const deltaX = event.touches[0].clientX - this.swipeX;
|
|
136
151
|
const deltaY = event.touches[0].clientY - this.swipeY;
|
|
137
152
|
this.isHorizontalSwipe = Math.abs(deltaX) > Math.abs(deltaY);
|
|
138
153
|
if (!this.isHorizontalSwipe)
|
|
139
154
|
return;
|
|
140
|
-
|
|
141
|
-
deltaX > 0 ? 0 : deltaX
|
|
142
|
-
deltaX < 0 ? 0 : deltaX;
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
155
|
+
const x = this.open
|
|
156
|
+
? deltaX > 0 ? 0 : deltaX
|
|
157
|
+
: deltaX < 0 ? 0 : deltaX;
|
|
158
|
+
const transformString = this.open
|
|
159
|
+
? `translateX(${x}px)`
|
|
160
|
+
: `translateX(min(calc(-100% + 10px + ${x}px), 0px))`;
|
|
161
|
+
requestAnimationFrame(() => {
|
|
162
|
+
if (!this.$drawer)
|
|
163
|
+
return;
|
|
148
164
|
this.$drawer.style.transform = transformString;
|
|
149
165
|
});
|
|
150
166
|
}
|
|
151
167
|
touchEnd(event) {
|
|
152
|
-
if (!this.swipeable)
|
|
168
|
+
if (!this.swipeable || !this.$drawer)
|
|
153
169
|
return;
|
|
154
|
-
requestAnimationFrame(
|
|
155
|
-
|
|
170
|
+
requestAnimationFrame(() => {
|
|
171
|
+
var _a;
|
|
172
|
+
(_a = this.$drawer) === null || _a === void 0 ? void 0 : _a.removeAttribute("style");
|
|
156
173
|
});
|
|
157
174
|
const deltaX = event.changedTouches[0].clientX - this.swipeX;
|
|
158
175
|
if (this.isHorizontalSwipe && this.open)
|
|
159
176
|
this.open = -50 > deltaX ? false : true;
|
|
160
177
|
else if (this.isHorizontalSwipe && !this.open) {
|
|
161
|
-
console.log("bbb", deltaX, 50 < Math.abs(deltaX) ? true : false);
|
|
162
178
|
this.open = 50 < deltaX ? true : false;
|
|
163
179
|
}
|
|
164
180
|
this.isHorizontalSwipe = false;
|
|
165
181
|
}
|
|
182
|
+
disconnectedCallback() {
|
|
183
|
+
if (this.mql)
|
|
184
|
+
this.mql.removeEventListener("change", this.overMediaQueryListener);
|
|
185
|
+
super.disconnectedCallback();
|
|
186
|
+
}
|
|
166
187
|
};
|
|
167
188
|
TkDrawer.styles = (0,external_lit_.css) `
|
|
168
189
|
${(0,external_lit_.unsafeCSS)(drawer)}
|
|
169
190
|
`;
|
|
170
191
|
__decorate([
|
|
171
192
|
(0,decorators_js_.property)({ type: Boolean, reflect: true })
|
|
172
|
-
], TkDrawer.prototype, "open",
|
|
193
|
+
], TkDrawer.prototype, "open", void 0);
|
|
173
194
|
__decorate([
|
|
174
195
|
(0,decorators_js_.property)({ type: Boolean, reflect: true })
|
|
175
196
|
], TkDrawer.prototype, "over", void 0);
|
|
@@ -188,6 +209,15 @@ __decorate([
|
|
|
188
209
|
__decorate([
|
|
189
210
|
(0,decorators_js_.query)("div.drawer")
|
|
190
211
|
], TkDrawer.prototype, "$drawer", void 0);
|
|
212
|
+
__decorate([
|
|
213
|
+
(0,decorators_js_.query)("div.drawer-content")
|
|
214
|
+
], TkDrawer.prototype, "$content", void 0);
|
|
215
|
+
__decorate([
|
|
216
|
+
(0,decorators_js_.state)()
|
|
217
|
+
], TkDrawer.prototype, "contentScrolled", void 0);
|
|
218
|
+
__decorate([
|
|
219
|
+
(0,decorators_js_.state)()
|
|
220
|
+
], TkDrawer.prototype, "contentHasBottomShadow", void 0);
|
|
191
221
|
__decorate([
|
|
192
222
|
(0,decorators_js_.eventOptions)({ passive: true })
|
|
193
223
|
], TkDrawer.prototype, "touchStart", null);
|
|
@@ -212,7 +242,7 @@ var x = (y) => {
|
|
|
212
242
|
var x = {}; __webpack_require__.d(x, y); return x
|
|
213
243
|
}
|
|
214
244
|
var y = (x) => (() => (x))
|
|
215
|
-
module.exports = x({ ["customElement"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.customElement), ["eventOptions"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.eventOptions), ["property"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.property), ["query"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.query) });
|
|
245
|
+
module.exports = x({ ["customElement"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.customElement), ["eventOptions"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.eventOptions), ["property"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.property), ["query"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.query), ["state"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.state) });
|
|
216
246
|
|
|
217
247
|
/***/ })
|
|
218
248
|
|
package/icon/icon.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PropertyValues } from "lit";
|
|
1
2
|
import { TkBox } from "../box";
|
|
2
3
|
export declare class TkIcon extends TkBox {
|
|
3
4
|
static get styles(): import("lit").CSSResult[];
|
|
@@ -6,7 +7,7 @@ export declare class TkIcon extends TkBox {
|
|
|
6
7
|
path: string;
|
|
7
8
|
private svg;
|
|
8
9
|
render(): import("lit").TemplateResult<1>;
|
|
9
|
-
updated(props:
|
|
10
|
+
protected updated(props: PropertyValues<TkIcon>): void;
|
|
10
11
|
loadIcon(): Promise<void>;
|
|
11
12
|
}
|
|
12
13
|
declare global {
|