@pictogrammers/components 0.4.7 → 0.4.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/package.json +1 -1
- package/pg/app/app.css +1 -1
- package/pg/app/app.ts +8 -2
package/package.json
CHANGED
package/pg/app/app.css
CHANGED
package/pg/app/app.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, Part, Prop } from '@pictogrammers/element';
|
|
1
|
+
import { Component, Part, Prop, Local } from '@pictogrammers/element';
|
|
2
2
|
|
|
3
3
|
import template from './app.html';
|
|
4
4
|
import style from './app.css';
|
|
@@ -14,9 +14,14 @@ export default class PgApp extends HTMLElement {
|
|
|
14
14
|
@Part() $side: HTMLDivElement;
|
|
15
15
|
@Part() $resize: HTMLButtonElement;
|
|
16
16
|
|
|
17
|
+
@Local('app') store = new Map([
|
|
18
|
+
['width', 12 * 16]
|
|
19
|
+
]);
|
|
20
|
+
|
|
17
21
|
connectedCallback() {
|
|
18
22
|
this.$logo.addEventListener('click', this.#handleClick.bind(this));
|
|
19
23
|
this.$resize.addEventListener('pointerdown', this.#handlePointerDown.bind(this));
|
|
24
|
+
this.$side.style.width = `${this.store.get('width')}px`;
|
|
20
25
|
}
|
|
21
26
|
|
|
22
27
|
#handleClick() {
|
|
@@ -33,6 +38,7 @@ export default class PgApp extends HTMLElement {
|
|
|
33
38
|
const x = currentX - ee.clientX;
|
|
34
39
|
const width = currentWidth - x;
|
|
35
40
|
this.$side.style.width = `${width}px`;
|
|
41
|
+
this.store.set('width', Math.floor(width));
|
|
36
42
|
}
|
|
37
43
|
const handlePointerUp = () => {
|
|
38
44
|
this.$resize.classList.remove('dragging');
|
|
@@ -42,4 +48,4 @@ export default class PgApp extends HTMLElement {
|
|
|
42
48
|
document.addEventListener('pointermove', handlePointerMove);
|
|
43
49
|
document.addEventListener('pointerup', handlePointerUp);
|
|
44
50
|
}
|
|
45
|
-
}
|
|
51
|
+
}
|