@progressive-development/pd-spa-helper 0.0.1 → 0.0.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/dist/src/InitApplicationData.d.ts +3 -0
- package/dist/src/InitApplicationData.js +8 -0
- package/dist/src/InitApplicationData.js.map +1 -0
- package/dist/src/PdSpaHelper.d.ts +111 -6
- package/dist/src/PdSpaHelper.js +410 -12
- package/dist/src/PdSpaHelper.js.map +1 -1
- package/dist/src/defaultpage/default-login.d.ts +5 -0
- package/dist/src/defaultpage/default-login.js +16 -0
- package/dist/src/defaultpage/default-login.js.map +1 -0
- package/dist/src/firebase/auth.d.ts +4 -0
- package/dist/src/firebase/auth.js +28 -0
- package/dist/src/firebase/auth.js.map +1 -0
- package/dist/src/firebase/firestore-client.d.ts +9 -0
- package/dist/src/firebase/firestore-client.js +19 -0
- package/dist/src/firebase/firestore-client.js.map +1 -0
- package/dist/src/firebase/functions-client.d.ts +31 -0
- package/dist/src/firebase/functions-client.js +70 -0
- package/dist/src/firebase/functions-client.js.map +1 -0
- package/dist/src/pd-spa-helper.d.ts +0 -1
- package/dist/src/pd-spa-helper.js +4 -2
- package/dist/src/pd-spa-helper.js.map +1 -1
- package/dist/src/router/AppMain.d.ts +6 -0
- package/dist/src/router/AppMain.js +14 -0
- package/dist/src/router/AppMain.js.map +1 -0
- package/dist/src/service-call-controller2.d.ts +16 -0
- package/dist/src/service-call-controller2.js +43 -0
- package/dist/src/service-call-controller2.js.map +1 -0
- package/dist/src/tmpown/pd-login.d.ts +14 -0
- package/dist/src/tmpown/pd-login.js +118 -0
- package/dist/src/tmpown/pd-login.js.map +1 -0
- package/dist/src/tmpown/pd-panel-viewer.d.ts +18 -0
- package/dist/src/tmpown/pd-panel-viewer.js +187 -0
- package/dist/src/tmpown/pd-panel-viewer.js.map +1 -0
- package/dist/src/tmpown/pd-panel.d.ts +5 -0
- package/dist/src/tmpown/pd-panel.js +41 -0
- package/dist/src/tmpown/pd-panel.js.map +1 -0
- package/dist/src/tmpown/pd-toast.d.ts +12 -0
- package/dist/src/tmpown/pd-toast.js +114 -0
- package/dist/src/tmpown/pd-toast.js.map +1 -0
- package/dist/test/pd-spa-helper.test.js +2 -2
- package/dist/test/pd-spa-helper.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -1
- package/pd-spa-helper.iml +9 -0
- package/src/InitApplicationData.ts +9 -0
- package/src/PdSpaHelper.ts +490 -16
- package/src/defaultpage/default-login.ts +15 -0
- package/src/firebase/auth.ts +30 -0
- package/src/firebase/firestore-client.ts +21 -0
- package/src/firebase/functions-client.ts +103 -0
- package/src/pd-spa-helper.ts +3 -3
- package/src/router/AppMain.ts +10 -0
- package/src/service-call-controller2.ts +67 -0
- package/src/tmpown/pd-login.ts +126 -0
- package/src/tmpown/pd-panel-viewer.ts +193 -0
- package/src/tmpown/pd-panel.ts +43 -0
- package/src/tmpown/pd-toast.ts +114 -0
- package/test/pd-spa-helper.test.ts +2 -2
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/* eslint-disable lit-a11y/click-events-have-key-events */
|
|
2
|
+
// https://stackblitz.com/edit/lit-story-viewer?file=story-viewer.ts
|
|
3
|
+
import { __decorate } from "tslib";
|
|
4
|
+
import { html, css, LitElement } from 'lit';
|
|
5
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
6
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
7
|
+
import 'hammerjs';
|
|
8
|
+
import '@progressive-development/pd-icon/pd-icon.js';
|
|
9
|
+
let timer;
|
|
10
|
+
let PdPanelViewer = class PdPanelViewer extends LitElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.withProgress = false;
|
|
14
|
+
this.deltaCalc = 3;
|
|
15
|
+
this._index = 0;
|
|
16
|
+
// eslint-disable-next-line no-undef
|
|
17
|
+
this._panData = {};
|
|
18
|
+
this._update = {};
|
|
19
|
+
}
|
|
20
|
+
get index() {
|
|
21
|
+
return this._index;
|
|
22
|
+
}
|
|
23
|
+
set index(value) {
|
|
24
|
+
this.children[this._index].dispatchEvent(new CustomEvent('exited'));
|
|
25
|
+
this.children[value].dispatchEvent(new CustomEvent('entered'));
|
|
26
|
+
this._index = value;
|
|
27
|
+
}
|
|
28
|
+
render() {
|
|
29
|
+
return html `
|
|
30
|
+
<div class="panel-container">
|
|
31
|
+
<slot></slot>
|
|
32
|
+
<pd-icon id="prev" icon="previousArrow" activeIcon ?disabled="${this.index <= 0}" @click=${this.previous}></pd-icon>
|
|
33
|
+
<pd-icon id="next" icon="nextArrow" activeIcon ?disabled="${this.index === (this.children.length - 1)}" @click=${this.next}></pd-icon>
|
|
34
|
+
</div>
|
|
35
|
+
${this.withProgress ? html `
|
|
36
|
+
<div id="progress">
|
|
37
|
+
${Array.from(this.children).map((childEl, i) => html `
|
|
38
|
+
<div @click="${() => { this._index = i; }}" class=${classMap({ watched: i <= this.index })}></div>`)}
|
|
39
|
+
</div>` : ''}
|
|
40
|
+
`;
|
|
41
|
+
}
|
|
42
|
+
firstUpdated() {
|
|
43
|
+
const hammerVal = new Hammer(this);
|
|
44
|
+
// listen to events
|
|
45
|
+
hammerVal.on('pan', (panEvent) => {
|
|
46
|
+
this._panData = panEvent;
|
|
47
|
+
});
|
|
48
|
+
// Do updates to rerender panel viewer, timeout to reduce updates
|
|
49
|
+
// https://web.dev/resize-observer/
|
|
50
|
+
const ro = new ResizeObserver(entries => {
|
|
51
|
+
entries.forEach(() => {
|
|
52
|
+
window.clearTimeout(timer);
|
|
53
|
+
timer = setTimeout(() => {
|
|
54
|
+
this.requestUpdate();
|
|
55
|
+
}, 100);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
ro.observe(this);
|
|
59
|
+
}
|
|
60
|
+
update(changedProperties) {
|
|
61
|
+
const { isFinal = false } = this._panData;
|
|
62
|
+
let { deltaX = 0 } = this._panData;
|
|
63
|
+
const width = this.clientWidth;
|
|
64
|
+
const minScale = 0.8;
|
|
65
|
+
// Guard against an infinite loop by looking for index.
|
|
66
|
+
if (!changedProperties.has("_index") && isFinal) {
|
|
67
|
+
if (deltaX > (width / this.deltaCalc)) {
|
|
68
|
+
this.previous();
|
|
69
|
+
}
|
|
70
|
+
else if (deltaX < (-width / this.deltaCalc)) {
|
|
71
|
+
this.next();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// We don't want the latent deltaX when releasing a pan.
|
|
75
|
+
deltaX = (isFinal ? 0 : deltaX);
|
|
76
|
+
Array.from(this.children).forEach((el, i) => {
|
|
77
|
+
const x = (i - this.index) * width + deltaX;
|
|
78
|
+
// Piecewise scale(deltaX), looks like: __/\__
|
|
79
|
+
const u = deltaX / width + (i - this.index);
|
|
80
|
+
const v = -Math.abs(u * (1 - minScale)) + 1;
|
|
81
|
+
const scale = Math.max(v, minScale);
|
|
82
|
+
// eslint-disable-next-line no-param-reassign
|
|
83
|
+
el.style.transform = `translate3d(${x}px,0,0) scale(${scale})`;
|
|
84
|
+
// eslint-disable-next-line no-param-reassign
|
|
85
|
+
el.style.opacity = scale;
|
|
86
|
+
});
|
|
87
|
+
super.update(changedProperties);
|
|
88
|
+
}
|
|
89
|
+
/* Advance to the next story card if possible */
|
|
90
|
+
next() {
|
|
91
|
+
this.index = Math.max(0, Math.min(this.children.length - 1, this.index + 1));
|
|
92
|
+
this._update = false;
|
|
93
|
+
}
|
|
94
|
+
/* Go back to the previous story card if possible */
|
|
95
|
+
previous() {
|
|
96
|
+
this.index = Math.max(0, Math.min(this.children.length - 1, this.index - 1));
|
|
97
|
+
this._update = false;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
PdPanelViewer.styles = css `
|
|
101
|
+
|
|
102
|
+
:host {
|
|
103
|
+
display: flex;
|
|
104
|
+
flex-direction: column;
|
|
105
|
+
width: 100%;
|
|
106
|
+
max-width: var(--pd-panel-width, 1170px);
|
|
107
|
+
overflow: var(--pd-panel-overflow, hidden);
|
|
108
|
+
background-color: var(--pd-panel-viewer-bg-col);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.panel-container {
|
|
112
|
+
position: relative;
|
|
113
|
+
height: var(--pd-panel-height, 60vh);
|
|
114
|
+
width: 100%;
|
|
115
|
+
display: flex;
|
|
116
|
+
flex-direction: column;
|
|
117
|
+
padding: 0 2rem;
|
|
118
|
+
box-sizing: border-box;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
pd-icon {
|
|
122
|
+
position: absolute;
|
|
123
|
+
top: calc(50% - 25px);
|
|
124
|
+
height: 50px;
|
|
125
|
+
cursor: pointer;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
#prev {
|
|
129
|
+
left: 0;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
#next {
|
|
133
|
+
right: 0;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
#progress {
|
|
137
|
+
position: relative;
|
|
138
|
+
height: 20px;
|
|
139
|
+
width: 50%;
|
|
140
|
+
margin: .5rem auto;
|
|
141
|
+
display: grid;
|
|
142
|
+
grid-auto-flow: column;
|
|
143
|
+
grid-auto-columns: 1fr;
|
|
144
|
+
grid-gap: 10px;
|
|
145
|
+
align-content: center;
|
|
146
|
+
align-self: flex-end;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
#progress > div {
|
|
150
|
+
background: var(--pd-panel-progress-col, grey);
|
|
151
|
+
height: 4px;
|
|
152
|
+
transition: background 0.3s linear;
|
|
153
|
+
cursor: pointer;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
#progress > div.watched {
|
|
157
|
+
background: var(--pd-panel-progress-col, yellow);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
::slotted(*) {
|
|
161
|
+
position: absolute;
|
|
162
|
+
width: 100%;
|
|
163
|
+
height: calc(100%);
|
|
164
|
+
transition: transform 0.35s ease-out;
|
|
165
|
+
left: 0;
|
|
166
|
+
}
|
|
167
|
+
`;
|
|
168
|
+
__decorate([
|
|
169
|
+
property({ type: Boolean })
|
|
170
|
+
], PdPanelViewer.prototype, "withProgress", void 0);
|
|
171
|
+
__decorate([
|
|
172
|
+
property({ type: Number })
|
|
173
|
+
], PdPanelViewer.prototype, "deltaCalc", void 0);
|
|
174
|
+
__decorate([
|
|
175
|
+
property({ type: Number, state: true })
|
|
176
|
+
], PdPanelViewer.prototype, "_index", void 0);
|
|
177
|
+
__decorate([
|
|
178
|
+
property({ type: Object, state: true })
|
|
179
|
+
], PdPanelViewer.prototype, "_panData", void 0);
|
|
180
|
+
__decorate([
|
|
181
|
+
property({ type: Boolean, state: true })
|
|
182
|
+
], PdPanelViewer.prototype, "_update", void 0);
|
|
183
|
+
PdPanelViewer = __decorate([
|
|
184
|
+
customElement("pd-panel-viewer")
|
|
185
|
+
], PdPanelViewer);
|
|
186
|
+
export { PdPanelViewer };
|
|
187
|
+
//# sourceMappingURL=pd-panel-viewer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pd-panel-viewer.js","sourceRoot":"","sources":["../../../src/tmpown/pd-panel-viewer.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,oEAAoE;;AAEpE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,UAAU,CAAC;AAElB,OAAO,6CAA6C,CAAC;AAErD,IAAI,KAAS,CAAC;AAGd,IAAa,aAAa,GAA1B,MAAa,aAAc,SAAQ,UAAU;IAA7C;;QAGI,iBAAY,GAAG,KAAK,CAAC;QAGrB,cAAS,GAAG,CAAC,CAAC;QAGd,WAAM,GAAG,CAAC,CAAC;QAIX,AADA,oCAAoC;QACpC,aAAQ,GAAO,EAAE,CAAC;QAGlB,YAAO,GAAG,EAAE,CAAC;IA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAmEd,CAAC;AAlFN;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;mDACL;AAGrB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;gDACX;AAGd;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAC,CAAC;6CAC3B;AAIX;IAFC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAC,CAAC;+CAEpB;AAGlB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAC,CAAC;8CAC1B;AAhBJ,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CAkLzB;SAlLY,aAAa","sourcesContent":["/* eslint-disable lit-a11y/click-events-have-key-events */\n// https://stackblitz.com/edit/lit-story-viewer?file=story-viewer.ts\n\nimport { html, css, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nimport 'hammerjs';\n\nimport '@progressive-development/pd-icon/pd-icon.js';\n\nlet timer:any;\n\n@customElement(\"pd-panel-viewer\")\nexport class PdPanelViewer extends LitElement {\n\n @property({type: Boolean})\n withProgress = false;\n\n @property({type: Number})\n deltaCalc = 3;\n\n @property({type: Number, state: true})\n _index = 0;\n\n @property({type: Object, state: true})\n // eslint-disable-next-line no-undef\n _panData:any = {};\n\n @property({type: Boolean, state: true})\n _update = {};\n\n static styles = css`\n\n :host {\n display: flex;\n flex-direction: column;\n width: 100%;\n max-width: var(--pd-panel-width, 1170px);\n overflow: var(--pd-panel-overflow, hidden);\n background-color: var(--pd-panel-viewer-bg-col);\n }\n\n .panel-container {\n position: relative;\n height: var(--pd-panel-height, 60vh);\n width: 100%;\n display: flex;\n flex-direction: column;\n padding: 0 2rem;\n box-sizing: border-box;\n }\n\n pd-icon {\n position: absolute;\n top: calc(50% - 25px);\n height: 50px;\n cursor: pointer;\n }\n\n #prev {\n left: 0;\n }\n\n #next {\n right: 0;\n }\n\n #progress {\n position: relative;\n height: 20px;\n width: 50%;\n margin: .5rem auto;\n display: grid;\n grid-auto-flow: column;\n grid-auto-columns: 1fr;\n grid-gap: 10px;\n align-content: center;\n align-self: flex-end;\n }\n\n #progress > div {\n background: var(--pd-panel-progress-col, grey);\n height: 4px;\n transition: background 0.3s linear;\n cursor: pointer;\n }\n\n #progress > div.watched {\n background: var(--pd-panel-progress-col, yellow);\n }\n\n ::slotted(*) {\n position: absolute;\n width: 100%;\n height: calc(100%);\n transition: transform 0.35s ease-out;\n left: 0;\n }\n `;\n\n get index() {\n return this._index;\n }\n\n set index(value) {\n this.children[this._index].dispatchEvent(new CustomEvent('exited'));\n this.children[value].dispatchEvent(new CustomEvent('entered'));\n this._index = value;\n }\n\n render() {\n return html`\n <div class=\"panel-container\">\n <slot></slot>\n <pd-icon id=\"prev\" icon=\"previousArrow\" activeIcon ?disabled=\"${this.index <= 0}\" @click=${this.previous}></pd-icon>\n <pd-icon id=\"next\" icon=\"nextArrow\" activeIcon ?disabled=\"${this.index === (this.children.length - 1)}\" @click=${this.next}></pd-icon>\n </div>\n ${this.withProgress ? html`\n <div id=\"progress\">\n ${Array.from(this.children).map((childEl, i) => html`\n <div @click=\"${() => {this._index = i;}}\" class=${classMap({watched: i <= this.index})}></div>`)}\n </div>` : ''}\n `;\n }\n\n\n firstUpdated() {\n const hammerVal = new Hammer(this);\n // listen to events\n hammerVal.on('pan', (panEvent: any) => {\n this._panData = panEvent;\n });\n\n // Do updates to rerender panel viewer, timeout to reduce updates\n // https://web.dev/resize-observer/\n const ro = new ResizeObserver(entries => {\n entries.forEach(() => {\n window.clearTimeout(timer);\n timer = setTimeout(() => {\n this.requestUpdate();\n }, 100);\n });\n });\n ro.observe(this);\n }\n\n update(changedProperties:any) {\n const {isFinal = false} = this._panData;\n let {deltaX = 0} = this._panData;\n\n const width = this.clientWidth;\n const minScale = 0.8;\n\n // Guard against an infinite loop by looking for index.\n if (!changedProperties.has(\"_index\") && isFinal) {\n if ( deltaX > (width / this.deltaCalc)) {\n this.previous();\n } else if(deltaX < (-width / this.deltaCalc)) {\n this.next();\n }\n }\n\n // We don't want the latent deltaX when releasing a pan.\n deltaX = (isFinal ? 0 : deltaX);\n\n Array.from(this.children).forEach((el:any, i) => {\n const x = (i - this.index) * width + deltaX;\n // Piecewise scale(deltaX), looks like: __/\\__\n const u = deltaX / width + (i - this.index);\n const v = -Math.abs(u * (1 - minScale)) + 1;\n const scale = Math.max(v, minScale);\n // eslint-disable-next-line no-param-reassign\n el.style.transform = `translate3d(${x}px,0,0) scale(${scale})`;\n // eslint-disable-next-line no-param-reassign\n el.style.opacity = scale;\n });\n super.update(changedProperties);\n }\n\n /* Advance to the next story card if possible */\n next() {\n this.index = Math.max(0, Math.min(this.children.length - 1, this.index + 1));\n this._update = false;\n }\n\n /* Go back to the previous story card if possible */\n previous() {\n this.index = Math.max(0, Math.min(this.children.length - 1, this.index - 1));\n this._update = false;\n }\n\n}\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// https://stackblitz.com/edit/lit-story-viewer?file=story-viewer.ts
|
|
2
|
+
import { __decorate } from "tslib";
|
|
3
|
+
import { html, LitElement, css } from 'lit';
|
|
4
|
+
import { customElement } from 'lit/decorators.js';
|
|
5
|
+
let PdPanel = class PdPanel extends LitElement {
|
|
6
|
+
render() {
|
|
7
|
+
return html `
|
|
8
|
+
<div id="content">
|
|
9
|
+
<slot></slot>
|
|
10
|
+
</div>
|
|
11
|
+
`;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
PdPanel.styles = css `
|
|
15
|
+
:host {
|
|
16
|
+
background: var(--pd-panel-bg, #AFC1D2);
|
|
17
|
+
border-radius: var(--pd-panel-border-radius, 0.2em);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* Default styles for content */
|
|
21
|
+
#content {
|
|
22
|
+
position: absolute;
|
|
23
|
+
top: 0;
|
|
24
|
+
right: 0;
|
|
25
|
+
bottom: 0;
|
|
26
|
+
left: 0;
|
|
27
|
+
padding: 2rem;
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: flex-start;
|
|
32
|
+
}
|
|
33
|
+
#content > slot::slotted(*) {
|
|
34
|
+
margin: 0;
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
PdPanel = __decorate([
|
|
38
|
+
customElement("pd-panel")
|
|
39
|
+
], PdPanel);
|
|
40
|
+
export { PdPanel };
|
|
41
|
+
//# sourceMappingURL=pd-panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pd-panel.js","sourceRoot":"","sources":["../../../src/tmpown/pd-panel.ts"],"names":[],"mappings":"AAAA,oEAAoE;;AAEpE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD,IAAa,OAAO,GAApB,MAAa,OAAQ,SAAQ,UAAU;IA2BrC,MAAM;QACJ,OAAO,IAAI,CAAA;;;;KAIV,CAAC;IACJ,CAAC;CAGF,CAAA;AAlCQ,cAAM,GACT,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;OAsBF,CAAC;AAzBK,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAoCnB;SApCY,OAAO","sourcesContent":["// https://stackblitz.com/edit/lit-story-viewer?file=story-viewer.ts\n\nimport { html, LitElement, css } from 'lit';\nimport { customElement } from 'lit/decorators.js';\n\n@customElement(\"pd-panel\")\nexport class PdPanel extends LitElement { \n\n static styles = \n css`\n :host {\n background: var(--pd-panel-bg, #AFC1D2);\n border-radius: var(--pd-panel-border-radius, 0.2em);\n }\n\n /* Default styles for content */\n #content {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n padding: 2rem;\n display: flex;\n flex-direction: column; \n align-items: center;\n justify-content: flex-start;\n }\n #content > slot::slotted(*) {\n margin: 0;\n }\n `;\n\n render() { \n return html`\n <div id=\"content\">\n <slot></slot>\n </div>\n `;\n }\n\n\n}"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class PdToast extends LitElement {
|
|
3
|
+
isError: boolean;
|
|
4
|
+
isSuccess: boolean;
|
|
5
|
+
duration: number;
|
|
6
|
+
static styles: import("lit").CSSResult;
|
|
7
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
8
|
+
connectedCallback(): void;
|
|
9
|
+
updated(changedProps: any): void;
|
|
10
|
+
_show(): Promise<unknown>;
|
|
11
|
+
_close(): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
/* eslint-disable wc/no-self-class */
|
|
3
|
+
import { LitElement, html, css } from 'lit';
|
|
4
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
5
|
+
let PdToast = class PdToast extends LitElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.isError = false;
|
|
9
|
+
this.isSuccess = false;
|
|
10
|
+
this.duration = -100;
|
|
11
|
+
}
|
|
12
|
+
render() {
|
|
13
|
+
return html `
|
|
14
|
+
<slot></slot>
|
|
15
|
+
<pd-icon @click="${this._close}" icon="closeLink" class="close-link"></pd-icon>
|
|
16
|
+
`;
|
|
17
|
+
}
|
|
18
|
+
connectedCallback() {
|
|
19
|
+
// eslint-disable-next-line wc/guard-super-call
|
|
20
|
+
super.connectedCallback();
|
|
21
|
+
this.setAttribute('aria-live', 'polite');
|
|
22
|
+
}
|
|
23
|
+
updated(changedProps) {
|
|
24
|
+
if (changedProps.has('duration')) {
|
|
25
|
+
if (this.duration === -100) {
|
|
26
|
+
this._close();
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
this._show();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
_show() {
|
|
34
|
+
return new Promise((resolve) => {
|
|
35
|
+
if (this.className === 'show') {
|
|
36
|
+
// Do nothing, prevent spamming
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
// 1000ms to not overlap fadein and fadeout animations
|
|
40
|
+
if (this.duration >= 1000) {
|
|
41
|
+
this.style.animation = `fadein 0.5s, fadeout 0.5s ${this.duration - 500}ms`;
|
|
42
|
+
}
|
|
43
|
+
this.className = 'show';
|
|
44
|
+
if (this.duration > 0) {
|
|
45
|
+
setTimeout(() => {
|
|
46
|
+
this._close();
|
|
47
|
+
resolve("Ok");
|
|
48
|
+
}, this.duration >= 1000 ? this.duration : 3000);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
_close() {
|
|
54
|
+
this.style.animation = '';
|
|
55
|
+
this.className = this.className.replace('show', '');
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
PdToast.styles = css `
|
|
59
|
+
:host {
|
|
60
|
+
--pd-icon-size: 1rem;
|
|
61
|
+
|
|
62
|
+
transform: translateX(-150%);
|
|
63
|
+
transition: transform 1s;
|
|
64
|
+
|
|
65
|
+
/* Other styles */
|
|
66
|
+
position: fixed;
|
|
67
|
+
bottom: 30px;
|
|
68
|
+
left: 30px;
|
|
69
|
+
width: calc(100% - 60px);
|
|
70
|
+
max-width: 400px;
|
|
71
|
+
|
|
72
|
+
z-index: 5;
|
|
73
|
+
|
|
74
|
+
background: var(--app-primary-color, #ebcf57);
|
|
75
|
+
color: #0A3A48;
|
|
76
|
+
padding: .5rem;
|
|
77
|
+
border-radius: var(--item-border-radius, 2px);
|
|
78
|
+
box-shadow: 3px 5px 5px 3px lightgrey;
|
|
79
|
+
display: flex;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
:host([isError]) {
|
|
83
|
+
background: darkred;
|
|
84
|
+
color: #fff;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
:host([isSuccess]) {
|
|
88
|
+
background: green;
|
|
89
|
+
color: #fff;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
:host(.show) {
|
|
93
|
+
transform: translateX(0%);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.close-link {
|
|
97
|
+
margin-left: auto;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
`;
|
|
101
|
+
__decorate([
|
|
102
|
+
property({ type: Boolean, reflect: true })
|
|
103
|
+
], PdToast.prototype, "isError", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
property({ type: Boolean, reflect: true })
|
|
106
|
+
], PdToast.prototype, "isSuccess", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
property({ type: Number })
|
|
109
|
+
], PdToast.prototype, "duration", void 0);
|
|
110
|
+
PdToast = __decorate([
|
|
111
|
+
customElement("pd-toast")
|
|
112
|
+
], PdToast);
|
|
113
|
+
export { PdToast };
|
|
114
|
+
//# sourceMappingURL=pd-toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pd-toast.js","sourceRoot":"","sources":["../../../src/tmpown/pd-toast.ts"],"names":[],"mappings":";AAAA,qCAAqC;AACrC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG5D,IAAa,OAAO,GAApB,MAAa,OAAQ,SAAQ,UAAU;IAAvC;;QAGE,YAAO,GAAY,KAAK,CAAC;QAGzB,cAAS,GAAY,KAAK,CAAC;QAG3B,aAAQ,GAAW,CAAC,GAAG,CAAC;IAkG1B,CAAC;IAnDC,MAAM;QACJ,OAAO,IAAI,CAAA;;yB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CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACtD,CAAC;CACF,CAAA;AAhGQ,cAAM,GACX,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA0CF,CAAC;AAnDJ;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;wCAChB;AAGzB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;0CACd;AAG3B;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;yCACD;AATb,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CA2GnB;SA3GY,OAAO","sourcesContent":["/* eslint-disable wc/no-self-class */\nimport { LitElement, html, css } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\n@customElement(\"pd-toast\")\nexport class PdToast extends LitElement {\n\n @property({type: Boolean, reflect: true})\n isError: boolean = false;\n\n @property({type: Boolean, reflect: true})\n isSuccess: boolean = false;\n\n @property({type: Number})\n duration: number = -100;\n\n static styles = \n css`\n :host {\n --pd-icon-size: 1rem; \n\n transform: translateX(-150%);\n transition: transform 1s;\n\n /* Other styles */\n position: fixed;\n bottom: 30px;\n left: 30px;\n width: calc(100% - 60px);\n max-width: 400px;\n\n z-index: 5;\n\n background: var(--app-primary-color, #ebcf57);\n color: #0A3A48;\n padding: .5rem;\n border-radius: var(--item-border-radius, 2px);\n box-shadow: 3px 5px 5px 3px lightgrey;\n display: flex;\n }\n\n :host([isError]) {\n background: darkred;\n color: #fff;\n }\n\n :host([isSuccess]) {\n background: green;\n color: #fff;\n }\n\n :host(.show) {\n transform: translateX(0%);\n }\n\n .close-link {\n margin-left: auto;\n }\n \n `; \n\n render() {\n return html`\n <slot></slot>\n <pd-icon @click=\"${this._close}\" icon=\"closeLink\" class=\"close-link\"></pd-icon>\n `;\n }\n\n connectedCallback() {\n // eslint-disable-next-line wc/guard-super-call\n super.connectedCallback();\n this.setAttribute('aria-live', 'polite');\n }\n\n updated(changedProps:any) {\n if (changedProps.has('duration')) {\n if (this.duration === -100) {\n this._close();\n } else {\n this._show();\n }\n }\n }\n\n _show() {\n return new Promise((resolve) => {\n if (this.className === 'show') {\n // Do nothing, prevent spamming\n } else {\n // 1000ms to not overlap fadein and fadeout animations\n if (this.duration >= 1000) {\n this.style.animation = `fadein 0.5s, fadeout 0.5s ${this.duration - 500}ms`;\n } \n this.className = 'show';\n \n if (this.duration > 0) {\n setTimeout(\n () => { \n this._close();\n resolve(\"Ok\");\n },\n this.duration >= 1000 ? this.duration : 3000\n );\n } \n }\n });\n }\n\n _close() {\n this.style.animation = '';\n this.className = this.className.replace('show', '');\n }\n}\n\n"]}
|
|
@@ -5,12 +5,12 @@ describe('PdSpaHelper', () => {
|
|
|
5
5
|
it('has a default title "Hey there" and counter 5', async () => {
|
|
6
6
|
const el = await fixture(html `<pd-spa-helper></pd-spa-helper>`);
|
|
7
7
|
expect(el.title).to.equal('Hey there');
|
|
8
|
-
expect(el.counter).to.equal(5);
|
|
8
|
+
// expect(el.counter).to.equal(5);
|
|
9
9
|
});
|
|
10
10
|
it('increases the counter on button click', async () => {
|
|
11
11
|
const el = await fixture(html `<pd-spa-helper></pd-spa-helper>`);
|
|
12
12
|
el.shadowRoot.querySelector('button').click();
|
|
13
|
-
expect(el.counter).to.equal(6);
|
|
13
|
+
// expect(el.counter).to.equal(6);
|
|
14
14
|
});
|
|
15
15
|
it('can override the title via attribute', async () => {
|
|
16
16
|
const el = await fixture(html `<pd-spa-helper title="attribute title"></pd-spa-helper>`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pd-spa-helper.test.js","sourceRoot":"","sources":["../../test/pd-spa-helper.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,M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,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uBAAuB,EAAE,KAAK,IAAI,EAAE;QACrC,MAAM,EAAE,GAAG,MAAM,OAAO,CAAc,IAAI,CAAA,iCAAiC,CAAC,CAAC;QAE7E,MAAM,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC;IAChD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { html } from 'lit';\nimport { fixture, expect } from '@open-wc/testing';\nimport { PdSpaHelper } from '../src/PdSpaHelper.js';\nimport '../src/pd-spa-helper.js';\n\ndescribe('PdSpaHelper', () => {\n it('has a default title \"Hey there\" and counter 5', async () => {\n const el = await fixture<PdSpaHelper>(html`<pd-spa-helper></pd-spa-helper>`);\n\n expect(el.title).to.equal('Hey there');\n // expect(el.counter).to.equal(5);\n });\n\n it('increases the counter on button click', async () => {\n const el = await fixture<PdSpaHelper>(html`<pd-spa-helper></pd-spa-helper>`);\n el.shadowRoot!.querySelector('button')!.click();\n\n // expect(el.counter).to.equal(6);\n });\n\n it('can override the title via attribute', async () => {\n const el = await fixture<PdSpaHelper>(html`<pd-spa-helper title=\"attribute title\"></pd-spa-helper>`);\n\n expect(el.title).to.equal('attribute title');\n });\n\n it('passes the a11y audit', async () => {\n const el = await fixture<PdSpaHelper>(html`<pd-spa-helper></pd-spa-helper>`);\n\n await expect(el).shadowDom.to.be.accessible();\n });\n});\n"]}
|