@fluffjs/fluff 0.1.9 → 0.1.10
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/runtime/FluffElementImpl.d.ts +1 -1
- package/runtime/FluffElementImpl.js +4 -1
- package/runtime/tests/TestPropertyUnwrapChildComponent.d.ts +10 -0
- package/runtime/tests/TestPropertyUnwrapChildComponent.js +19 -0
- package/runtime/tests/TestPropertyUnwrapContainerClass.d.ts +4 -0
- package/runtime/tests/TestPropertyUnwrapContainerClass.js +4 -0
- package/runtime/tests/TestPropertyUnwrapParentComponent.d.ts +9 -0
- package/runtime/tests/TestPropertyUnwrapParentComponent.js +19 -0
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@ export declare abstract class FluffElement extends FluffBase {
|
|
|
15
15
|
constructor();
|
|
16
16
|
connectedCallback(): void;
|
|
17
17
|
disconnectedCallback(): void;
|
|
18
|
-
$watch: (_properties: string[], callback: () => void) => Subscription;
|
|
18
|
+
$watch: (_properties: string[], callback: (changed: string) => void) => Subscription;
|
|
19
19
|
__processBindingsOnElementPublic(el: HTMLElement, scope: Scope, subscriptions?: Subscription[]): void;
|
|
20
20
|
protected abstract __render(): void;
|
|
21
21
|
protected __setupBindings(): void;
|
|
@@ -62,7 +62,7 @@ export class FluffElement extends FluffBase {
|
|
|
62
62
|
this.__baseSubscriptions = [];
|
|
63
63
|
}
|
|
64
64
|
$watch = (_properties, callback) => {
|
|
65
|
-
callback();
|
|
65
|
+
callback('');
|
|
66
66
|
return {
|
|
67
67
|
unsubscribe: () => {
|
|
68
68
|
}
|
|
@@ -187,6 +187,9 @@ export class FluffElement extends FluffBase {
|
|
|
187
187
|
this.__bindOutputOnElement(el, outputName, handler);
|
|
188
188
|
}
|
|
189
189
|
__setChildProperty(el, propName, value) {
|
|
190
|
+
if (value instanceof Property) {
|
|
191
|
+
value = value.getValue();
|
|
192
|
+
}
|
|
190
193
|
if (el instanceof HTMLElement && el.hasAttribute('x-fluff-component')) {
|
|
191
194
|
const tagName = el.tagName.toLowerCase();
|
|
192
195
|
if (customElements.get(tagName) === undefined) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Property } from '../../utils/Property.js';
|
|
2
|
+
import { FluffElement } from '../FluffElement.js';
|
|
3
|
+
export declare let testPropertyUnwrapReceivedValue: number | null;
|
|
4
|
+
export declare function resetTestPropertyUnwrapReceivedValue(): void;
|
|
5
|
+
export declare class TestPropertyUnwrapChildComponent extends FluffElement {
|
|
6
|
+
__property: Property<number | null>;
|
|
7
|
+
get property(): number | null;
|
|
8
|
+
set property(val: number | null);
|
|
9
|
+
protected __render(): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Property } from '../../utils/Property.js';
|
|
2
|
+
import { FluffElement } from '../FluffElement.js';
|
|
3
|
+
export let testPropertyUnwrapReceivedValue = null;
|
|
4
|
+
export function resetTestPropertyUnwrapReceivedValue() {
|
|
5
|
+
testPropertyUnwrapReceivedValue = null;
|
|
6
|
+
}
|
|
7
|
+
export class TestPropertyUnwrapChildComponent extends FluffElement {
|
|
8
|
+
__property = new Property({ initialValue: null, propertyName: 'property' });
|
|
9
|
+
get property() {
|
|
10
|
+
return this.__property.getValue();
|
|
11
|
+
}
|
|
12
|
+
set property(val) {
|
|
13
|
+
testPropertyUnwrapReceivedValue = val;
|
|
14
|
+
this.__property.setValue(val);
|
|
15
|
+
}
|
|
16
|
+
__render() {
|
|
17
|
+
this.__getShadowRoot().innerHTML = '<span></span>';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Property } from '../../utils/Property.js';
|
|
2
|
+
import { FluffElement } from '../FluffElement.js';
|
|
3
|
+
import { TestPropertyUnwrapContainerClass } from './TestPropertyUnwrapContainerClass.js';
|
|
4
|
+
export declare class TestPropertyUnwrapParentComponent extends FluffElement {
|
|
5
|
+
__hostClass: Property<TestPropertyUnwrapContainerClass>;
|
|
6
|
+
get hostClass(): TestPropertyUnwrapContainerClass;
|
|
7
|
+
set hostClass(val: TestPropertyUnwrapContainerClass);
|
|
8
|
+
protected __render(): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Property } from '../../utils/Property.js';
|
|
2
|
+
import { FluffElement } from '../FluffElement.js';
|
|
3
|
+
import { TestPropertyUnwrapContainerClass } from './TestPropertyUnwrapContainerClass.js';
|
|
4
|
+
export class TestPropertyUnwrapParentComponent extends FluffElement {
|
|
5
|
+
__hostClass = new Property({ initialValue: new TestPropertyUnwrapContainerClass(), propertyName: 'hostClass' });
|
|
6
|
+
get hostClass() {
|
|
7
|
+
const val = this.__hostClass.getValue();
|
|
8
|
+
if (!val) {
|
|
9
|
+
throw new Error('hostClass is null');
|
|
10
|
+
}
|
|
11
|
+
return val;
|
|
12
|
+
}
|
|
13
|
+
set hostClass(val) {
|
|
14
|
+
this.__hostClass.setValue(val);
|
|
15
|
+
}
|
|
16
|
+
__render() {
|
|
17
|
+
this.__getShadowRoot().innerHTML = '<test-prop-unwrap-child data-lid="l0"></test-prop-unwrap-child>';
|
|
18
|
+
}
|
|
19
|
+
}
|