@viewfly/platform-browser 1.0.5 → 1.1.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/bundles/index.d.ts +105 -13
- package/bundles/index.esm.js +19 -14
- package/bundles/index.js +19 -14
- package/package.json +3 -3
package/bundles/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NativeNode, ViewFlyNode, Application, Config, JSXNode, NativeRenderer, JSX, ClassNames } from '@viewfly/core';
|
|
1
|
+
import { NativeNode, ViewFlyNode, Application, Config, JSXNode, NativeRenderer, ElementNamespace, JSX, ClassNames } from '@viewfly/core';
|
|
2
2
|
import * as CSS from 'csstype';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -109,23 +109,17 @@ declare class OutputTranslator {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
declare class DomRenderer extends NativeRenderer<HTMLElement, Text> {
|
|
112
|
-
static NAMESPACES:
|
|
113
|
-
svg: string;
|
|
114
|
-
html: string;
|
|
115
|
-
xml: string;
|
|
116
|
-
xlink: string;
|
|
117
|
-
xmlns: string;
|
|
118
|
-
};
|
|
112
|
+
static NAMESPACES: Record<string, string>;
|
|
119
113
|
propMap: Record<string, Record<string, string>>;
|
|
120
|
-
createElement(name: string,
|
|
114
|
+
createElement(name: string, namespace: ElementNamespace): HTMLElement;
|
|
121
115
|
createTextNode(textContent: string): Text;
|
|
122
116
|
appendChild(parent: HTMLElement, newChild: any): void;
|
|
123
117
|
prependChild(parent: HTMLElement, newChild: HTMLElement | Text): void;
|
|
124
118
|
insertAfter(newNode: HTMLElement | Text, ref: HTMLElement | Text): void;
|
|
125
119
|
remove(node: HTMLElement | Text): void;
|
|
126
120
|
cleanChildren(node: HTMLElement): void;
|
|
127
|
-
setProperty(node: HTMLElement, key: string, value: any,
|
|
128
|
-
removeProperty(node: HTMLElement, key: string,
|
|
121
|
+
setProperty(node: HTMLElement, key: string, value: any, namespace: ElementNamespace): void;
|
|
122
|
+
removeProperty(node: HTMLElement, key: string, namespace: ElementNamespace): void;
|
|
129
123
|
setClass(target: HTMLElement, className: string): void;
|
|
130
124
|
setStyle(target: HTMLElement, key: string, value: any): void;
|
|
131
125
|
removeStyle(target: HTMLElement, key: string): void;
|
|
@@ -1191,7 +1185,105 @@ interface SVGElements {
|
|
|
1191
1185
|
use: SVGAttributes<SVGUseElement>;
|
|
1192
1186
|
view: SVGAttributes<SVGViewElement>;
|
|
1193
1187
|
}
|
|
1194
|
-
interface
|
|
1188
|
+
interface MathMLAttributes extends JSX.RefAttributes<MathMLElement> {
|
|
1189
|
+
children?: JSXNode;
|
|
1190
|
+
scriptlevel?: string;
|
|
1191
|
+
}
|
|
1192
|
+
interface MathMLMoAttributes extends MathMLAttributes {
|
|
1193
|
+
accent?: Booleanish;
|
|
1194
|
+
fence?: Booleanish;
|
|
1195
|
+
lspace?: string;
|
|
1196
|
+
maxsize?: string;
|
|
1197
|
+
minsize?: string;
|
|
1198
|
+
movablelimits?: Booleanish;
|
|
1199
|
+
rspace?: string;
|
|
1200
|
+
separator?: Booleanish;
|
|
1201
|
+
stretchy?: Booleanish;
|
|
1202
|
+
symmetric?: Booleanish;
|
|
1203
|
+
}
|
|
1204
|
+
interface MathMLMathAttributes extends MathMLAttributes {
|
|
1205
|
+
xmlns?: 'http://www.w3.org/1998/Math/MathML';
|
|
1206
|
+
display?: 'block' | 'inline';
|
|
1207
|
+
}
|
|
1208
|
+
interface MathMLMfracAttributes extends MathMLAttributes {
|
|
1209
|
+
linethickness?: string;
|
|
1210
|
+
}
|
|
1211
|
+
interface MathMLMoverAttributes extends MathMLAttributes {
|
|
1212
|
+
accent?: Booleanish;
|
|
1213
|
+
}
|
|
1214
|
+
interface MathMLMpaddedAttributes extends MathMLAttributes {
|
|
1215
|
+
depth?: string;
|
|
1216
|
+
height?: string;
|
|
1217
|
+
lspace?: string;
|
|
1218
|
+
voffset?: string;
|
|
1219
|
+
width?: string;
|
|
1220
|
+
}
|
|
1221
|
+
interface MathMLMspaceAttributes extends MathMLAttributes {
|
|
1222
|
+
width?: string;
|
|
1223
|
+
height?: string;
|
|
1224
|
+
}
|
|
1225
|
+
interface MathMLMtableAttribute extends MathMLAttributes {
|
|
1226
|
+
align?: string;
|
|
1227
|
+
columnalign?: string;
|
|
1228
|
+
columnlines?: Numberish;
|
|
1229
|
+
columnspacing?: Numberish;
|
|
1230
|
+
frame?: 'solid' | 'dashed' | 'none';
|
|
1231
|
+
framespacing?: Numberish;
|
|
1232
|
+
rowalign?: string;
|
|
1233
|
+
rowlines?: Numberish;
|
|
1234
|
+
rowspacing?: Numberish;
|
|
1235
|
+
width?: string;
|
|
1236
|
+
}
|
|
1237
|
+
interface MathMLMtdAttributes extends MathMLAttributes {
|
|
1238
|
+
columnalign?: string;
|
|
1239
|
+
columnspan?: Numberish;
|
|
1240
|
+
rowalign?: string;
|
|
1241
|
+
rowspan?: Numberish;
|
|
1242
|
+
}
|
|
1243
|
+
interface MathMLMtrAttributes extends MathMLAttributes {
|
|
1244
|
+
columnalign?: string;
|
|
1245
|
+
rowalign?: string;
|
|
1246
|
+
}
|
|
1247
|
+
interface MathMLMunderAttributes extends MathMLAttributes {
|
|
1248
|
+
accentunder?: Booleanish;
|
|
1249
|
+
}
|
|
1250
|
+
interface MathMLMunderoverAttributes extends MathMLAttributes {
|
|
1251
|
+
accent?: Booleanish;
|
|
1252
|
+
accentunder?: Booleanish;
|
|
1253
|
+
}
|
|
1254
|
+
interface MathMLElements {
|
|
1255
|
+
annotation: MathMLAttributes;
|
|
1256
|
+
'annotation-xml': MathMLAttributes;
|
|
1257
|
+
maction: MathMLAttributes;
|
|
1258
|
+
math: MathMLMathAttributes;
|
|
1259
|
+
merror: MathMLAttributes;
|
|
1260
|
+
mfrac: MathMLMfracAttributes;
|
|
1261
|
+
mi: MathMLAttributes;
|
|
1262
|
+
mmultiscripts: MathMLAttributes;
|
|
1263
|
+
mn: MathMLAttributes;
|
|
1264
|
+
mo: MathMLMoAttributes;
|
|
1265
|
+
mover: MathMLMoverAttributes;
|
|
1266
|
+
mpadded: MathMLMpaddedAttributes;
|
|
1267
|
+
mphantom: MathMLAttributes;
|
|
1268
|
+
mprescripts: MathMLAttributes;
|
|
1269
|
+
mroot: MathMLAttributes;
|
|
1270
|
+
mrow: MathMLAttributes;
|
|
1271
|
+
ms: MathMLAttributes;
|
|
1272
|
+
mspace: MathMLMspaceAttributes;
|
|
1273
|
+
msqrt: MathMLAttributes;
|
|
1274
|
+
mstyle: MathMLAttributes;
|
|
1275
|
+
msub: MathMLAttributes;
|
|
1276
|
+
msubsup: MathMLAttributes;
|
|
1277
|
+
msup: MathMLAttributes;
|
|
1278
|
+
mtable: MathMLMtableAttribute;
|
|
1279
|
+
mtd: MathMLMtdAttributes;
|
|
1280
|
+
mtext: MathMLAttributes;
|
|
1281
|
+
mtr: MathMLMtrAttributes;
|
|
1282
|
+
munder: MathMLMunderAttributes;
|
|
1283
|
+
semantics: MathMLAttributes;
|
|
1284
|
+
munderover: MathMLMunderoverAttributes;
|
|
1285
|
+
}
|
|
1286
|
+
interface NativeElements extends DOMElements, SVGElements, MathMLElements {
|
|
1195
1287
|
}
|
|
1196
1288
|
interface Events {
|
|
1197
1289
|
onCopy: ClipboardEvent;
|
|
@@ -1287,4 +1379,4 @@ declare module '@viewfly/core' {
|
|
|
1287
1379
|
}
|
|
1288
1380
|
}
|
|
1289
1381
|
|
|
1290
|
-
export { type AnchorHTMLAttributes, type AreaHTMLAttributes, type AudioHTMLAttributes, type BaseHTMLAttributes, type BlockquoteHTMLAttributes, type ButtonHTMLAttributes, type CSSProperties, type CanvasHTMLAttributes, type ColHTMLAttributes, type ColgroupHTMLAttributes, type DOMElements, type DataHTMLAttributes, type DelHTMLAttributes, type DetailsHTMLAttributes, type DialogHTMLAttributes, DomRenderer, type EmbedHTMLAttributes, type Events, type FieldsetHTMLAttributes, type FormHTMLAttributes, type HTMLAttributes, HTMLRenderer, type HtmlHTMLAttributes, type IframeHTMLAttributes, type ImgHTMLAttributes, type InputHTMLAttributes, type InsHTMLAttributes, type KeygenHTMLAttributes, type LabelHTMLAttributes, type LiHTMLAttributes, type LinkHTMLAttributes, type MapHTMLAttributes, type MediaHTMLAttributes, type MenuHTMLAttributes, type MetaHTMLAttributes, type MeterHTMLAttributes, type NativeElements, type ObjectHTMLAttributes, type OlHTMLAttributes, type OptgroupHTMLAttributes, type OptionHTMLAttributes, type OutputHTMLAttributes, OutputTranslator, type ParamHTMLAttributes, type ProgressHTMLAttributes, type QuoteHTMLAttributes, type SVGAttributes, type SVGElements, type ScriptHTMLAttributes, type SelectHTMLAttributes, type SourceHTMLAttributes, type StyleHTMLAttributes, type StyleValue, type TableHTMLAttributes, type TdHTMLAttributes, type TextareaHTMLAttributes, type ThHTMLAttributes, type TimeHTMLAttributes, type TrackHTMLAttributes, VDOMElement, VDOMNode, VDOMText, type VideoHTMLAttributes, type WebViewHTMLAttributes, createApp, createPortal };
|
|
1382
|
+
export { type AnchorHTMLAttributes, type AreaHTMLAttributes, type AudioHTMLAttributes, type BaseHTMLAttributes, type BlockquoteHTMLAttributes, type ButtonHTMLAttributes, type CSSProperties, type CanvasHTMLAttributes, type ColHTMLAttributes, type ColgroupHTMLAttributes, type DOMElements, type DataHTMLAttributes, type DelHTMLAttributes, type DetailsHTMLAttributes, type DialogHTMLAttributes, DomRenderer, type EmbedHTMLAttributes, type Events, type FieldsetHTMLAttributes, type FormHTMLAttributes, type HTMLAttributes, HTMLRenderer, type HtmlHTMLAttributes, type IframeHTMLAttributes, type ImgHTMLAttributes, type InputHTMLAttributes, type InsHTMLAttributes, type KeygenHTMLAttributes, type LabelHTMLAttributes, type LiHTMLAttributes, type LinkHTMLAttributes, type MapHTMLAttributes, type MathMLAttributes, type MathMLElements, type MathMLMathAttributes, type MathMLMfracAttributes, type MathMLMoAttributes, type MathMLMoverAttributes, type MathMLMpaddedAttributes, type MathMLMspaceAttributes, type MathMLMtableAttribute, type MathMLMtdAttributes, type MathMLMtrAttributes, type MathMLMunderAttributes, type MathMLMunderoverAttributes, type MediaHTMLAttributes, type MenuHTMLAttributes, type MetaHTMLAttributes, type MeterHTMLAttributes, type NativeElements, type ObjectHTMLAttributes, type OlHTMLAttributes, type OptgroupHTMLAttributes, type OptionHTMLAttributes, type OutputHTMLAttributes, OutputTranslator, type ParamHTMLAttributes, type ProgressHTMLAttributes, type QuoteHTMLAttributes, type SVGAttributes, type SVGElements, type ScriptHTMLAttributes, type SelectHTMLAttributes, type SourceHTMLAttributes, type StyleHTMLAttributes, type StyleValue, type TableHTMLAttributes, type TdHTMLAttributes, type TextareaHTMLAttributes, type ThHTMLAttributes, type TimeHTMLAttributes, type TrackHTMLAttributes, VDOMElement, VDOMNode, VDOMText, type VideoHTMLAttributes, type WebViewHTMLAttributes, createApp, createPortal };
|
package/bundles/index.esm.js
CHANGED
|
@@ -12,9 +12,10 @@ class DomRenderer extends NativeRenderer {
|
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
createElement(name,
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
createElement(name, namespace) {
|
|
16
|
+
const ns = namespace && DomRenderer.NAMESPACES[namespace];
|
|
17
|
+
if (ns) {
|
|
18
|
+
return document.createElementNS(ns, name);
|
|
18
19
|
}
|
|
19
20
|
return document.createElement(name);
|
|
20
21
|
}
|
|
@@ -45,13 +46,13 @@ class DomRenderer extends NativeRenderer {
|
|
|
45
46
|
cleanChildren(node) {
|
|
46
47
|
node.textContent = '';
|
|
47
48
|
}
|
|
48
|
-
setProperty(node, key, value,
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
49
|
+
setProperty(node, key, value, namespace) {
|
|
50
|
+
const NAMESPACE = DomRenderer.NAMESPACES;
|
|
51
|
+
if (namespace) {
|
|
51
52
|
const [prefix, ...unqualifiedName] = key.split(/(?=[A-Z])/);
|
|
52
53
|
let ns = null;
|
|
53
|
-
if (prefix === 'xmlns' || unqualifiedName.length &&
|
|
54
|
-
ns =
|
|
54
|
+
if (prefix === 'xmlns' || unqualifiedName.length && NAMESPACE[prefix]) {
|
|
55
|
+
ns = NAMESPACE[prefix];
|
|
55
56
|
}
|
|
56
57
|
node.setAttributeNS(ns, key, String(value));
|
|
57
58
|
return;
|
|
@@ -61,19 +62,22 @@ class DomRenderer extends NativeRenderer {
|
|
|
61
62
|
key = map[key] || key;
|
|
62
63
|
}
|
|
63
64
|
if (key in node) {
|
|
65
|
+
if (map && document.activeElement === node && key === 'value') {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
64
68
|
node[key] = value;
|
|
65
69
|
}
|
|
66
70
|
else {
|
|
67
71
|
node.setAttribute(key, value);
|
|
68
72
|
}
|
|
69
73
|
}
|
|
70
|
-
removeProperty(node, key,
|
|
71
|
-
if (
|
|
72
|
-
const
|
|
74
|
+
removeProperty(node, key, namespace) {
|
|
75
|
+
if (namespace) {
|
|
76
|
+
const NAMESPACE = DomRenderer.NAMESPACES;
|
|
73
77
|
const [prefix, ...unqualifiedName] = key.split(/(?=[A-Z])/);
|
|
74
78
|
let ns = null;
|
|
75
|
-
if (prefix === 'xmlns' || unqualifiedName.length &&
|
|
76
|
-
ns =
|
|
79
|
+
if (prefix === 'xmlns' || unqualifiedName.length && NAMESPACE[prefix]) {
|
|
80
|
+
ns = NAMESPACE[prefix];
|
|
77
81
|
}
|
|
78
82
|
node.removeAttributeNS(ns, key);
|
|
79
83
|
return;
|
|
@@ -123,7 +127,8 @@ DomRenderer.NAMESPACES = {
|
|
|
123
127
|
html: 'http://www.w3.org/1999/xhtml',
|
|
124
128
|
xml: 'http://www.w3.org/XML/1998/namespace',
|
|
125
129
|
xlink: 'http://www.w3.org/1999/xlink',
|
|
126
|
-
xmlns: 'http://www.w3.org/2000/xmlns/'
|
|
130
|
+
xmlns: 'http://www.w3.org/2000/xmlns/',
|
|
131
|
+
mathml: 'http://www.w3.org/1998/Math/MathML',
|
|
127
132
|
};
|
|
128
133
|
|
|
129
134
|
function createApp(root, config = true) {
|
package/bundles/index.js
CHANGED
|
@@ -14,9 +14,10 @@ class DomRenderer extends core.NativeRenderer {
|
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
createElement(name,
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
createElement(name, namespace) {
|
|
18
|
+
const ns = namespace && DomRenderer.NAMESPACES[namespace];
|
|
19
|
+
if (ns) {
|
|
20
|
+
return document.createElementNS(ns, name);
|
|
20
21
|
}
|
|
21
22
|
return document.createElement(name);
|
|
22
23
|
}
|
|
@@ -47,13 +48,13 @@ class DomRenderer extends core.NativeRenderer {
|
|
|
47
48
|
cleanChildren(node) {
|
|
48
49
|
node.textContent = '';
|
|
49
50
|
}
|
|
50
|
-
setProperty(node, key, value,
|
|
51
|
-
const
|
|
52
|
-
if (
|
|
51
|
+
setProperty(node, key, value, namespace) {
|
|
52
|
+
const NAMESPACE = DomRenderer.NAMESPACES;
|
|
53
|
+
if (namespace) {
|
|
53
54
|
const [prefix, ...unqualifiedName] = key.split(/(?=[A-Z])/);
|
|
54
55
|
let ns = null;
|
|
55
|
-
if (prefix === 'xmlns' || unqualifiedName.length &&
|
|
56
|
-
ns =
|
|
56
|
+
if (prefix === 'xmlns' || unqualifiedName.length && NAMESPACE[prefix]) {
|
|
57
|
+
ns = NAMESPACE[prefix];
|
|
57
58
|
}
|
|
58
59
|
node.setAttributeNS(ns, key, String(value));
|
|
59
60
|
return;
|
|
@@ -63,19 +64,22 @@ class DomRenderer extends core.NativeRenderer {
|
|
|
63
64
|
key = map[key] || key;
|
|
64
65
|
}
|
|
65
66
|
if (key in node) {
|
|
67
|
+
if (map && document.activeElement === node && key === 'value') {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
66
70
|
node[key] = value;
|
|
67
71
|
}
|
|
68
72
|
else {
|
|
69
73
|
node.setAttribute(key, value);
|
|
70
74
|
}
|
|
71
75
|
}
|
|
72
|
-
removeProperty(node, key,
|
|
73
|
-
if (
|
|
74
|
-
const
|
|
76
|
+
removeProperty(node, key, namespace) {
|
|
77
|
+
if (namespace) {
|
|
78
|
+
const NAMESPACE = DomRenderer.NAMESPACES;
|
|
75
79
|
const [prefix, ...unqualifiedName] = key.split(/(?=[A-Z])/);
|
|
76
80
|
let ns = null;
|
|
77
|
-
if (prefix === 'xmlns' || unqualifiedName.length &&
|
|
78
|
-
ns =
|
|
81
|
+
if (prefix === 'xmlns' || unqualifiedName.length && NAMESPACE[prefix]) {
|
|
82
|
+
ns = NAMESPACE[prefix];
|
|
79
83
|
}
|
|
80
84
|
node.removeAttributeNS(ns, key);
|
|
81
85
|
return;
|
|
@@ -125,7 +129,8 @@ DomRenderer.NAMESPACES = {
|
|
|
125
129
|
html: 'http://www.w3.org/1999/xhtml',
|
|
126
130
|
xml: 'http://www.w3.org/XML/1998/namespace',
|
|
127
131
|
xlink: 'http://www.w3.org/1999/xlink',
|
|
128
|
-
xmlns: 'http://www.w3.org/2000/xmlns/'
|
|
132
|
+
xmlns: 'http://www.w3.org/2000/xmlns/',
|
|
133
|
+
mathml: 'http://www.w3.org/1998/Math/MathML',
|
|
129
134
|
};
|
|
130
135
|
|
|
131
136
|
function createApp(root, config = true) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viewfly/platform-browser",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
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",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"keywords": [],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@viewfly/core": "^1.0
|
|
17
|
+
"@viewfly/core": "^1.1.0",
|
|
18
18
|
"csstype": "^3.1.2"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"bugs": {
|
|
37
37
|
"url": "https://github.com/viewfly/viewfly.git/issues"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "56c28e6d0f87586ea6dda6597b00b4c5326edc07"
|
|
40
40
|
}
|