@lordfokas/yrframe 0.2.0 → 0.3.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/dist/Component.d.ts +1 -1
- package/dist/Component.js +2 -2
- package/dist/ComponentEvents.d.ts +2 -2
- package/dist/ComponentEvents.js +6 -6
- package/package.json +2 -2
package/dist/Component.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export declare class Component<A extends Attributes> extends HTMLElement {
|
|
|
23
23
|
/** Redraw this component. Works by deleting all children, calling render() and appending the results. */
|
|
24
24
|
redraw(): void;
|
|
25
25
|
/** Called after redraw() to do special manipulation of children nodes. */
|
|
26
|
-
|
|
26
|
+
onRedraw(): void;
|
|
27
27
|
/** Get this component's real width in pixels. */
|
|
28
28
|
width(): number;
|
|
29
29
|
/** Get this component's real height in pixels. */
|
package/dist/Component.js
CHANGED
|
@@ -67,10 +67,10 @@ export class Component extends HTMLElement {
|
|
|
67
67
|
ComponentFactory.appendChildren(this, child);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
this.
|
|
70
|
+
this.onRedraw();
|
|
71
71
|
}
|
|
72
72
|
/** Called after redraw() to do special manipulation of children nodes. */
|
|
73
|
-
|
|
73
|
+
onRedraw() { }
|
|
74
74
|
/** Get this component's real width in pixels. */
|
|
75
75
|
width() {
|
|
76
76
|
return parseFloat(getComputedStyle(this, null).width.replace("px", ""));
|
|
@@ -35,8 +35,8 @@ export declare class ComponentEvents {
|
|
|
35
35
|
* If the target configuration has no path, the whole event is stopped instead.
|
|
36
36
|
*/
|
|
37
37
|
attachRemover<T extends Event, K1 extends keyof T>(target: EventTarget<T, K1> | undefined, predicate: Source<boolean>, name: string, optional?: Optional): void;
|
|
38
|
-
/** Attach a listener that
|
|
39
|
-
|
|
38
|
+
/** Attach a listener that adds or removes a flag attribute from a component based on a boolean event field. */
|
|
39
|
+
attachFlagger<T extends Event, K1 extends keyof T>(target: EventTarget<T, K1> | undefined, source: Source<HTMLElement>, flag: string, ref: boolean, name: string, optional?: Optional): void;
|
|
40
40
|
/** Create a function that will fire an event and process data from it. */
|
|
41
41
|
attachSource<T extends Event, K1 extends keyof T>(target: EventTarget<T, K1> | undefined, name: string, optional?: Optional): void;
|
|
42
42
|
/** Create a fake source function that supplies a static or local value. */
|
package/dist/ComponentEvents.js
CHANGED
|
@@ -94,19 +94,19 @@ export class ComponentEvents {
|
|
|
94
94
|
throw new Error("Unsupported path length > 1 for removers");
|
|
95
95
|
}, nice).named(name, this.owner));
|
|
96
96
|
}
|
|
97
|
-
/** Attach a listener that
|
|
98
|
-
|
|
99
|
-
if (this.skip(target, name, "
|
|
97
|
+
/** Attach a listener that adds or removes a flag attribute from a component based on a boolean event field. */
|
|
98
|
+
attachFlagger(target, source, flag, ref, name, optional) {
|
|
99
|
+
if (this.skip(target, name, "flagger", optional))
|
|
100
100
|
return;
|
|
101
101
|
this.createListener(target, name, (value, _) => {
|
|
102
102
|
if (typeof value !== "boolean")
|
|
103
103
|
return;
|
|
104
104
|
const element = source.call(this);
|
|
105
|
-
if (value) {
|
|
106
|
-
element.setAttribute(
|
|
105
|
+
if (value === ref) {
|
|
106
|
+
element.setAttribute(flag, "");
|
|
107
107
|
}
|
|
108
108
|
else {
|
|
109
|
-
element.removeAttribute(
|
|
109
|
+
element.removeAttribute(flag);
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
112
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lordfokas/yrframe",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "A Typescript class-based WebComponents library using Material Design.",
|
|
5
5
|
"main": "dist/yrframe.js",
|
|
6
6
|
"scripts": {
|
|
@@ -20,6 +20,6 @@
|
|
|
20
20
|
"typescript": "^5.3.3"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@lordfokas/event-bus": "^1.0.
|
|
23
|
+
"@lordfokas/event-bus": "^1.0.22"
|
|
24
24
|
}
|
|
25
25
|
}
|