@viewfly/platform-browser 3.0.1 → 3.0.3
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/README.en.md +58 -0
- package/README.md +2 -0
- package/dist/dom-renderer.d.ts +1 -0
- package/dist/html-renderer.d.ts +1 -0
- package/dist/index.esm.js +6 -4
- package/dist/index.js +6 -4
- package/package.json +2 -2
package/README.en.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# @viewfly/platform-browser
|
|
2
|
+
|
|
3
|
+
**Languages:** [简体中文](./README.md)
|
|
4
|
+
|
|
5
|
+
Browser entrypoint for Viewfly apps: create the root app, mount to the DOM, destroy, and related DOM-facing APIs.
|
|
6
|
+
|
|
7
|
+
Install and configure **`@viewfly/core`** first (JSX, `reflect-metadata`, etc.).
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @viewfly/platform-browser @viewfly/core
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Create and mount
|
|
20
|
+
|
|
21
|
+
HTML mount target:
|
|
22
|
+
|
|
23
|
+
```html
|
|
24
|
+
<div id="app"></div>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Script:
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { createApp } from '@viewfly/platform-browser'
|
|
31
|
+
|
|
32
|
+
function App() {
|
|
33
|
+
return () => <div>Hello Viewfly</div>
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const app = createApp(<App />)
|
|
37
|
+
app.mount(document.getElementById('app')!)
|
|
38
|
+
|
|
39
|
+
// when needed
|
|
40
|
+
app.destroy()
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
Refer to typings and the official docs for full API surface.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Docs
|
|
50
|
+
|
|
51
|
+
- Official site: <https://viewfly.org> (creating an app, lifecycle).
|
|
52
|
+
- **`@viewfly/platform-browser`** typings for parameter/return details.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
MIT
|
package/README.md
CHANGED
package/dist/dom-renderer.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export declare class DomRenderer extends NativeRenderer<HTMLElement, Text> {
|
|
|
24
24
|
unListen(node: HTMLElement, type: string, callback: (ev: any) => any): void;
|
|
25
25
|
syncTextContent(target: Text, content: string): void;
|
|
26
26
|
getNameSpace(type: string, namespace: ElementNamespace): string | void;
|
|
27
|
+
getChildrenNameSpace(type: string, namespace: ElementNamespace): string | void;
|
|
27
28
|
/**
|
|
28
29
|
* SVG / MathML 等非 HTML 下无 HTML5 的「反射 IDL」表;通常用属性字符串表示,false/空串/非数常表示不输出该属性。
|
|
29
30
|
*/
|
package/dist/html-renderer.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export declare class HTMLRenderer extends NativeRenderer<VDOMElement, VDOMText>
|
|
|
35
35
|
syncTextContent(target: VDOMText, content: string): void;
|
|
36
36
|
insertAfter(newNode: VDOMElement | VDOMText, ref: VDOMElement | VDOMText): void;
|
|
37
37
|
getNameSpace(): void;
|
|
38
|
+
getChildrenNameSpace(): string | void;
|
|
38
39
|
}
|
|
39
40
|
/**
|
|
40
41
|
* 轻量 DOM 转换为 HTML 字符串的转换器
|
package/dist/index.esm.js
CHANGED
|
@@ -490,14 +490,15 @@ var DomRenderer = class DomRenderer extends NativeRenderer {
|
|
|
490
490
|
target.textContent = content;
|
|
491
491
|
}
|
|
492
492
|
getNameSpace(type, namespace) {
|
|
493
|
-
if (namespace === "svg")
|
|
494
|
-
if (type === "foreignObject") return;
|
|
495
|
-
return namespace;
|
|
496
|
-
}
|
|
493
|
+
if (namespace === "svg") return namespace;
|
|
497
494
|
if (type === "svg") return type;
|
|
498
495
|
if (type === "math") return "mathml";
|
|
499
496
|
return namespace;
|
|
500
497
|
}
|
|
498
|
+
getChildrenNameSpace(type, namespace) {
|
|
499
|
+
if (namespace === "svg" && type === "foreignObject") return;
|
|
500
|
+
return namespace;
|
|
501
|
+
}
|
|
501
502
|
/**
|
|
502
503
|
* SVG / MathML 等非 HTML 下无 HTML5 的「反射 IDL」表;通常用属性字符串表示,false/空串/非数常表示不输出该属性。
|
|
503
504
|
*/
|
|
@@ -661,6 +662,7 @@ var HTMLRenderer = class extends NativeRenderer {
|
|
|
661
662
|
} else console.warn(`Element "${ref instanceof VDOMText ? ref.text : ref.name}" was accidentally deleted, and viewfly is unable to update the current view`);
|
|
662
663
|
}
|
|
663
664
|
getNameSpace() {}
|
|
665
|
+
getChildrenNameSpace() {}
|
|
664
666
|
};
|
|
665
667
|
/**
|
|
666
668
|
* 轻量 DOM 转换为 HTML 字符串的转换器
|
package/dist/index.js
CHANGED
|
@@ -491,14 +491,15 @@ var DomRenderer = class DomRenderer extends _viewfly_core.NativeRenderer {
|
|
|
491
491
|
target.textContent = content;
|
|
492
492
|
}
|
|
493
493
|
getNameSpace(type, namespace) {
|
|
494
|
-
if (namespace === "svg")
|
|
495
|
-
if (type === "foreignObject") return;
|
|
496
|
-
return namespace;
|
|
497
|
-
}
|
|
494
|
+
if (namespace === "svg") return namespace;
|
|
498
495
|
if (type === "svg") return type;
|
|
499
496
|
if (type === "math") return "mathml";
|
|
500
497
|
return namespace;
|
|
501
498
|
}
|
|
499
|
+
getChildrenNameSpace(type, namespace) {
|
|
500
|
+
if (namespace === "svg" && type === "foreignObject") return;
|
|
501
|
+
return namespace;
|
|
502
|
+
}
|
|
502
503
|
/**
|
|
503
504
|
* SVG / MathML 等非 HTML 下无 HTML5 的「反射 IDL」表;通常用属性字符串表示,false/空串/非数常表示不输出该属性。
|
|
504
505
|
*/
|
|
@@ -662,6 +663,7 @@ var HTMLRenderer = class extends _viewfly_core.NativeRenderer {
|
|
|
662
663
|
} else console.warn(`Element "${ref instanceof VDOMText ? ref.text : ref.name}" was accidentally deleted, and viewfly is unable to update the current view`);
|
|
663
664
|
}
|
|
664
665
|
getNameSpace() {}
|
|
666
|
+
getChildrenNameSpace() {}
|
|
665
667
|
};
|
|
666
668
|
/**
|
|
667
669
|
* 轻量 DOM 转换为 HTML 字符串的转换器
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viewfly/platform-browser",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"description": "This project is used to enable the Viewfly framework to run in a browser.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"keywords": [],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@viewfly/core": "^3.0.
|
|
21
|
+
"@viewfly/core": "^3.0.3",
|
|
22
22
|
"csstype": "^3.1.3"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|