@viewfly/core 0.0.1-alpha.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/LICENSE +21 -0
- package/README.md +4 -0
- package/bundles/_utils/make-error.d.ts +1 -0
- package/bundles/foundation/_api.d.ts +2 -0
- package/bundles/foundation/_utils.d.ts +24 -0
- package/bundles/foundation/injection-tokens.d.ts +18 -0
- package/bundles/foundation/renderer.d.ts +33 -0
- package/bundles/index.esm.js +1188 -0
- package/bundles/index.js +1216 -0
- package/bundles/model/_api.d.ts +3 -0
- package/bundles/model/component.d.ts +194 -0
- package/bundles/model/jsx-element.d.ts +39 -0
- package/bundles/model/root.component.d.ts +10 -0
- package/bundles/public-api.d.ts +5 -0
- package/bundles/viewfly.d.ts +36 -0
- package/jsx-dev-runtime.js +8 -0
- package/jsx-runtime.d.ts +16 -0
- package/jsx-runtime.js +7 -0
- package/jsx-runtime.umd.js +17 -0
- package/package.json +39 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 TanBo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function makeError(name: string): (message: string) => Error;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Component, JSXElement } from '../model/_api';
|
|
2
|
+
export interface MapChanges {
|
|
3
|
+
remove: [string, any][];
|
|
4
|
+
set: [string, any][];
|
|
5
|
+
}
|
|
6
|
+
export interface ArrayChanges {
|
|
7
|
+
remove: string[];
|
|
8
|
+
add: string[];
|
|
9
|
+
}
|
|
10
|
+
export interface ObjectChanges {
|
|
11
|
+
remove: [string, any][];
|
|
12
|
+
add: [string, any][];
|
|
13
|
+
}
|
|
14
|
+
export declare const refKey = "ref";
|
|
15
|
+
export declare function getObjectChanges(target: Record<string, any>, source: Record<string, any>): ObjectChanges;
|
|
16
|
+
export declare function getMapChanges(target: Map<string, any>, source: Map<string, any>): MapChanges;
|
|
17
|
+
export declare function getSetChanges(target: Set<string>, source: Set<string>): ArrayChanges;
|
|
18
|
+
export declare function getNodeChanges(newVNode: JSXElement | Component, oldVNode: JSXElement | Component): {
|
|
19
|
+
styleChanges: MapChanges;
|
|
20
|
+
attrChanges: MapChanges;
|
|
21
|
+
classesChanges: ArrayChanges;
|
|
22
|
+
listenerChanges: ObjectChanges;
|
|
23
|
+
isChanged: boolean;
|
|
24
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type NativeNode = Record<string, any>;
|
|
2
|
+
export declare abstract class NativeRenderer<ElementNode = NativeNode, TextNode = NativeNode> {
|
|
3
|
+
abstract createElement(name: string): ElementNode;
|
|
4
|
+
abstract createTextNode(textContent: string): TextNode;
|
|
5
|
+
abstract setProperty(node: ElementNode, key: string, value: any): void;
|
|
6
|
+
abstract appendChild(parent: ElementNode, newChild: ElementNode | TextNode): void;
|
|
7
|
+
abstract prependChild(parent: ElementNode, newChild: ElementNode | TextNode): void;
|
|
8
|
+
abstract removeProperty(node: ElementNode, key: string): void;
|
|
9
|
+
abstract setStyle(target: ElementNode, key: string, value: any): void;
|
|
10
|
+
abstract removeStyle(target: ElementNode, key: string): void;
|
|
11
|
+
abstract addClass(target: ElementNode, name: string): void;
|
|
12
|
+
abstract removeClass(target: ElementNode, name: string): void;
|
|
13
|
+
abstract listen<T = any>(node: ElementNode, type: string, callback: (ev: T) => any): void;
|
|
14
|
+
abstract unListen(node: ElementNode, type: string, callback: (ev: any) => any): void;
|
|
15
|
+
abstract remove(node: ElementNode | TextNode): void;
|
|
16
|
+
abstract syncTextContent(target: TextNode, content: string): void;
|
|
17
|
+
abstract insertAfter(newNode: ElementNode | TextNode, ref: ElementNode | TextNode): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { RootComponent } from '../model/_api';
|
|
2
|
+
import { NativeNode, NativeRenderer } from './injection-tokens';
|
|
3
|
+
export declare abstract class RootComponentRef {
|
|
4
|
+
abstract component: RootComponent;
|
|
5
|
+
abstract host: NativeNode;
|
|
6
|
+
}
|
|
7
|
+
export declare class Renderer {
|
|
8
|
+
private nativeRenderer;
|
|
9
|
+
private rootComponentRef;
|
|
10
|
+
private componentAtomCaches;
|
|
11
|
+
constructor(nativeRenderer: NativeRenderer, rootComponentRef: RootComponentRef);
|
|
12
|
+
render(): void;
|
|
13
|
+
refresh(): void;
|
|
14
|
+
private reconcile;
|
|
15
|
+
private reconcileElement;
|
|
16
|
+
private applyChanges;
|
|
17
|
+
private diff;
|
|
18
|
+
private cleanView;
|
|
19
|
+
private reuseAndUpdate;
|
|
20
|
+
private createViewByAtom;
|
|
21
|
+
private buildView;
|
|
22
|
+
private componentRender;
|
|
23
|
+
private createChainByComponentFactory;
|
|
24
|
+
private createChain;
|
|
25
|
+
private createChainByJSXElement;
|
|
26
|
+
private createChainByJSXText;
|
|
27
|
+
private createChainByChildren;
|
|
28
|
+
private linkTemplate;
|
|
29
|
+
private link;
|
|
30
|
+
private createElement;
|
|
31
|
+
private createTextNode;
|
|
32
|
+
private updateNativeNodeProperties;
|
|
33
|
+
}
|