@viewfly/platform-browser 0.6.0 → 0.6.1
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/bundles/html-renderer.d.ts +9 -9
- package/bundles/index.esm.js +4 -4
- package/bundles/index.js +4 -4
- package/bundles/jsx-dom.d.ts +6 -1
- package/package.json +3 -3
|
@@ -2,13 +2,13 @@ import { NativeRenderer } from '@viewfly/core';
|
|
|
2
2
|
export declare class VDOMElement {
|
|
3
3
|
name: string;
|
|
4
4
|
props: Map<string, any>;
|
|
5
|
-
children: Array<VDOMElement |
|
|
5
|
+
children: Array<VDOMElement | VDOMText>;
|
|
6
6
|
style: Map<string, any>;
|
|
7
7
|
className: string;
|
|
8
8
|
parent: VDOMElement | null;
|
|
9
9
|
constructor(name: string);
|
|
10
10
|
}
|
|
11
|
-
export declare class
|
|
11
|
+
export declare class VDOMText {
|
|
12
12
|
text: string;
|
|
13
13
|
parent: VDOMElement | null;
|
|
14
14
|
constructor(text: string);
|
|
@@ -16,22 +16,22 @@ export declare class VDomText {
|
|
|
16
16
|
/**
|
|
17
17
|
* 用于生成模拟轻量 DOM 节点的渲染器
|
|
18
18
|
*/
|
|
19
|
-
export declare class HTMLRenderer extends NativeRenderer<VDOMElement,
|
|
19
|
+
export declare class HTMLRenderer extends NativeRenderer<VDOMElement, VDOMText> {
|
|
20
20
|
createElement(name: string): VDOMElement;
|
|
21
|
-
createTextNode(textContent: string):
|
|
21
|
+
createTextNode(textContent: string): VDOMText;
|
|
22
22
|
setProperty(node: VDOMElement, key: string, value: any): void;
|
|
23
|
-
appendChild(parent: VDOMElement, newChild: VDOMElement |
|
|
24
|
-
prependChild(parent: VDOMElement, newChild: VDOMElement |
|
|
23
|
+
appendChild(parent: VDOMElement, newChild: VDOMElement | VDOMText): void;
|
|
24
|
+
prependChild(parent: VDOMElement, newChild: VDOMElement | VDOMText): void;
|
|
25
25
|
removeProperty(node: VDOMElement, key: string): void;
|
|
26
26
|
setStyle(target: VDOMElement, key: string, value: any): void;
|
|
27
27
|
removeStyle(target: VDOMElement, key: string): void;
|
|
28
28
|
setClass(target: VDOMElement, value: string): void;
|
|
29
29
|
listen(): void;
|
|
30
30
|
unListen(): void;
|
|
31
|
-
remove(node: VDOMElement |
|
|
31
|
+
remove(node: VDOMElement | VDOMText): void;
|
|
32
32
|
cleanChildren(node: VDOMElement): void;
|
|
33
|
-
syncTextContent(target:
|
|
34
|
-
insertAfter(newNode: VDOMElement |
|
|
33
|
+
syncTextContent(target: VDOMText, content: string): void;
|
|
34
|
+
insertAfter(newNode: VDOMElement | VDOMText, ref: VDOMElement | VDOMText): void;
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* 轻量 DOM 转换为 HTML 字符串的转换器
|
package/bundles/index.esm.js
CHANGED
|
@@ -168,7 +168,7 @@ class VDOMElement {
|
|
|
168
168
|
this.parent = null;
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
class
|
|
171
|
+
class VDOMText {
|
|
172
172
|
constructor(text) {
|
|
173
173
|
this.text = text;
|
|
174
174
|
this.parent = null;
|
|
@@ -182,7 +182,7 @@ class HTMLRenderer extends NativeRenderer {
|
|
|
182
182
|
return new VDOMElement(name);
|
|
183
183
|
}
|
|
184
184
|
createTextNode(textContent) {
|
|
185
|
-
return new
|
|
185
|
+
return new VDOMText(textContent);
|
|
186
186
|
}
|
|
187
187
|
setProperty(node, key, value) {
|
|
188
188
|
node.props.set(key, value);
|
|
@@ -257,7 +257,7 @@ class OutputTranslator {
|
|
|
257
257
|
}
|
|
258
258
|
vDomToHTMLString(vDom) {
|
|
259
259
|
const xssFilter = OutputTranslator.simpleXSSFilter;
|
|
260
|
-
if (vDom instanceof
|
|
260
|
+
if (vDom instanceof VDOMText) {
|
|
261
261
|
return this.replaceEmpty(xssFilter.text(vDom.text), ' ');
|
|
262
262
|
}
|
|
263
263
|
const styles = Array.from(vDom.style.keys()).filter(key => {
|
|
@@ -332,4 +332,4 @@ OutputTranslator.simpleXSSFilter = {
|
|
|
332
332
|
}
|
|
333
333
|
};
|
|
334
334
|
|
|
335
|
-
export { DomRenderer, HTMLRenderer, OutputTranslator, VDOMElement,
|
|
335
|
+
export { DomRenderer, HTMLRenderer, OutputTranslator, VDOMElement, VDOMText, createApp, createPortal };
|
package/bundles/index.js
CHANGED
|
@@ -170,7 +170,7 @@ class VDOMElement {
|
|
|
170
170
|
this.parent = null;
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
class
|
|
173
|
+
class VDOMText {
|
|
174
174
|
constructor(text) {
|
|
175
175
|
this.text = text;
|
|
176
176
|
this.parent = null;
|
|
@@ -184,7 +184,7 @@ class HTMLRenderer extends core.NativeRenderer {
|
|
|
184
184
|
return new VDOMElement(name);
|
|
185
185
|
}
|
|
186
186
|
createTextNode(textContent) {
|
|
187
|
-
return new
|
|
187
|
+
return new VDOMText(textContent);
|
|
188
188
|
}
|
|
189
189
|
setProperty(node, key, value) {
|
|
190
190
|
node.props.set(key, value);
|
|
@@ -259,7 +259,7 @@ class OutputTranslator {
|
|
|
259
259
|
}
|
|
260
260
|
vDomToHTMLString(vDom) {
|
|
261
261
|
const xssFilter = OutputTranslator.simpleXSSFilter;
|
|
262
|
-
if (vDom instanceof
|
|
262
|
+
if (vDom instanceof VDOMText) {
|
|
263
263
|
return this.replaceEmpty(xssFilter.text(vDom.text), ' ');
|
|
264
264
|
}
|
|
265
265
|
const styles = Array.from(vDom.style.keys()).filter(key => {
|
|
@@ -338,6 +338,6 @@ exports.DomRenderer = DomRenderer;
|
|
|
338
338
|
exports.HTMLRenderer = HTMLRenderer;
|
|
339
339
|
exports.OutputTranslator = OutputTranslator;
|
|
340
340
|
exports.VDOMElement = VDOMElement;
|
|
341
|
-
exports.
|
|
341
|
+
exports.VDOMText = VDOMText;
|
|
342
342
|
exports.createApp = createApp;
|
|
343
343
|
exports.createPortal = createPortal;
|
package/bundles/jsx-dom.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as CSS from 'csstype';
|
|
2
|
-
import { JSXInternal } from '@viewfly/core';
|
|
3
2
|
export interface CSSProperties extends CSS.Properties<string | number>, CSS.PropertiesHyphen<string | number> {
|
|
4
3
|
/**
|
|
5
4
|
* The index signature was removed to enable closed typing for style
|
|
@@ -1142,4 +1141,10 @@ export interface Events {
|
|
|
1142
1141
|
type EventHandlers<E> = {
|
|
1143
1142
|
[K in keyof E]?: E[K] extends (...args: any) => any ? E[K] : (payload: E[K]) => void;
|
|
1144
1143
|
};
|
|
1144
|
+
declare global {
|
|
1145
|
+
namespace JSXInternal {
|
|
1146
|
+
interface IntrinsicElements extends NativeElements {
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1145
1150
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viewfly/platform-browser",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "This project is used to enable the Viewfly framework to run in a browser.",
|
|
5
5
|
"main": "./bundles/index.js",
|
|
6
6
|
"module": "./bundles/index.esm.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"keywords": [],
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@viewfly/core": "^0.6.
|
|
15
|
+
"@viewfly/core": "^0.6.1",
|
|
16
16
|
"csstype": "^3.1.2"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"bugs": {
|
|
34
34
|
"url": "https://github.com/viewfly/viewfly.git/issues"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "95ed600209322e44d2bd7d2eb62a1868629d9d68"
|
|
37
37
|
}
|