ember-source 6.0.0-alpha.9 → 6.0.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/blueprints/component/index.js +8 -71
- package/blueprints/component-class/index.js +8 -47
- package/build-metadata.json +3 -3
- package/dist/ember-template-compiler.js +4200 -6302
- package/dist/ember-testing.js +1 -1
- package/dist/ember.debug.js +4040 -8666
- package/dist/ember.prod.js +3734 -8082
- package/dist/packages/@glimmer/debug/index.js +87 -1440
- package/dist/packages/@glimmer/destroyable/index.js +59 -113
- package/dist/packages/@glimmer/encoder/index.js +4 -11
- package/dist/packages/@glimmer/global-context/index.js +40 -144
- package/dist/packages/@glimmer/manager/index.js +191 -312
- package/dist/packages/@glimmer/node/index.js +34 -76
- package/dist/packages/@glimmer/opcode-compiler/index.js +794 -1422
- package/dist/packages/@glimmer/owner/index.js +2 -1
- package/dist/packages/@glimmer/program/index.js +105 -192
- package/dist/packages/@glimmer/reference/index.js +109 -237
- package/dist/packages/@glimmer/runtime/index.js +1939 -3715
- package/dist/packages/@glimmer/util/index.js +114 -241
- package/dist/packages/@glimmer/validator/index.js +203 -409
- package/dist/packages/@glimmer/vm/index.js +163 -176
- package/dist/packages/@glimmer/wire-format/index.js +70 -71
- package/dist/packages/ember/version.js +1 -1
- package/docs/data.json +1 -1
- package/lib/browsers.js +40 -68
- package/package.json +21 -24
|
@@ -6,45 +6,29 @@ class NodeDOMTreeConstruction extends DOMTreeConstruction {
|
|
|
6
6
|
constructor(doc) {
|
|
7
7
|
super(doc || createHTMLDocument());
|
|
8
8
|
}
|
|
9
|
-
|
|
10
9
|
// override to prevent usage of `this.document` until after the constructor
|
|
11
10
|
setupUselessElement() {}
|
|
12
11
|
insertHTMLBefore(parent, reference, html) {
|
|
13
12
|
let raw = this.document.createRawHTMLSection(html);
|
|
14
|
-
parent.insertBefore(raw, reference);
|
|
15
|
-
return new ConcreteBounds(parent, raw, raw);
|
|
13
|
+
return parent.insertBefore(raw, reference), new ConcreteBounds(parent, raw, raw);
|
|
16
14
|
}
|
|
17
|
-
|
|
18
15
|
// override to avoid SVG detection/work when in node (this is not needed in SSR)
|
|
19
16
|
createElement(tag) {
|
|
20
17
|
return this.document.createElement(tag);
|
|
21
18
|
}
|
|
22
|
-
|
|
23
19
|
// override to avoid namespace shenanigans when in node (this is not needed in SSR)
|
|
24
20
|
setAttribute(element, name, value) {
|
|
25
21
|
element.setAttribute(name, value);
|
|
26
22
|
}
|
|
27
23
|
}
|
|
28
|
-
const TEXT_NODE = 3;
|
|
29
24
|
const NEEDS_EXTRA_CLOSE = new WeakMap();
|
|
30
|
-
function currentNode(cursor) {
|
|
31
|
-
let {
|
|
32
|
-
element,
|
|
33
|
-
nextSibling
|
|
34
|
-
} = cursor;
|
|
35
|
-
if (nextSibling === null) {
|
|
36
|
-
return element.lastChild;
|
|
37
|
-
} else {
|
|
38
|
-
return nextSibling.previousSibling;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
25
|
class SerializeBuilder extends NewElementBuilder {
|
|
42
26
|
serializeBlockDepth = 0;
|
|
43
27
|
__openBlock() {
|
|
44
28
|
let {
|
|
45
|
-
tagName
|
|
29
|
+
tagName: tagName
|
|
46
30
|
} = this.element;
|
|
47
|
-
if (
|
|
31
|
+
if ("TITLE" !== tagName && "SCRIPT" !== tagName && "STYLE" !== tagName) {
|
|
48
32
|
let depth = this.serializeBlockDepth++;
|
|
49
33
|
this.__appendComment(`%+b:${depth}%`);
|
|
50
34
|
}
|
|
@@ -52,84 +36,58 @@ class SerializeBuilder extends NewElementBuilder {
|
|
|
52
36
|
}
|
|
53
37
|
__closeBlock() {
|
|
54
38
|
let {
|
|
55
|
-
tagName
|
|
39
|
+
tagName: tagName
|
|
56
40
|
} = this.element;
|
|
57
|
-
super.__closeBlock()
|
|
58
|
-
if (tagName !== 'TITLE' && tagName !== 'SCRIPT' && tagName !== 'STYLE') {
|
|
41
|
+
if (super.__closeBlock(), "TITLE" !== tagName && "SCRIPT" !== tagName && "STYLE" !== tagName) {
|
|
59
42
|
let depth = --this.serializeBlockDepth;
|
|
60
43
|
this.__appendComment(`%-b:${depth}%`);
|
|
61
44
|
}
|
|
62
45
|
}
|
|
63
46
|
__appendHTML(html) {
|
|
64
47
|
let {
|
|
65
|
-
tagName
|
|
48
|
+
tagName: tagName
|
|
66
49
|
} = this.element;
|
|
67
|
-
if (
|
|
68
|
-
return super.__appendHTML(html);
|
|
69
|
-
}
|
|
70
|
-
|
|
50
|
+
if ("TITLE" === tagName || "SCRIPT" === tagName || "STYLE" === tagName) return super.__appendHTML(html);
|
|
71
51
|
// Do we need to run the html tokenizer here?
|
|
72
|
-
let first = this.__appendComment(
|
|
73
|
-
if (
|
|
74
|
-
let openIndex = html.indexOf(
|
|
75
|
-
|
|
76
|
-
let tr = html.slice(openIndex + 1, openIndex + 3);
|
|
77
|
-
if (tr === 'tr') {
|
|
78
|
-
html = `<tbody>${html}</tbody>`;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
if (html === '') {
|
|
83
|
-
this.__appendComment('% %');
|
|
84
|
-
} else {
|
|
85
|
-
super.__appendHTML(html);
|
|
52
|
+
let first = this.__appendComment("%glmr%");
|
|
53
|
+
if ("TABLE" === tagName) {
|
|
54
|
+
let openIndex = html.indexOf("<");
|
|
55
|
+
openIndex > -1 && "tr" === html.slice(openIndex + 1, openIndex + 3) && (html = `<tbody>${html}</tbody>`);
|
|
86
56
|
}
|
|
87
|
-
|
|
57
|
+
"" === html ? this.__appendComment("% %") : super.__appendHTML(html);
|
|
58
|
+
let last = this.__appendComment("%glmr%");
|
|
88
59
|
return new ConcreteBounds(this.element, first, last);
|
|
89
60
|
}
|
|
90
61
|
__appendText(string) {
|
|
91
62
|
let {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
this
|
|
101
|
-
|
|
102
|
-
return super.__appendText(string);
|
|
63
|
+
tagName: tagName
|
|
64
|
+
} = this.element,
|
|
65
|
+
current = function (cursor) {
|
|
66
|
+
let {
|
|
67
|
+
element: element,
|
|
68
|
+
nextSibling: nextSibling
|
|
69
|
+
} = cursor;
|
|
70
|
+
return null === nextSibling ? element.lastChild : nextSibling.previousSibling;
|
|
71
|
+
}(this);
|
|
72
|
+
return "TITLE" === tagName || "SCRIPT" === tagName || "STYLE" === tagName ? super.__appendText(string) : "" === string ? this.__appendComment("% %") : (current && 3 === current.nodeType && this.__appendComment("%|%"), super.__appendText(string));
|
|
103
73
|
}
|
|
104
74
|
closeElement() {
|
|
105
|
-
|
|
106
|
-
NEEDS_EXTRA_CLOSE.delete(this.element);
|
|
107
|
-
super.closeElement();
|
|
108
|
-
}
|
|
109
|
-
return super.closeElement();
|
|
75
|
+
return NEEDS_EXTRA_CLOSE.has(this.element) && (NEEDS_EXTRA_CLOSE.delete(this.element), super.closeElement()), super.closeElement();
|
|
110
76
|
}
|
|
111
77
|
openElement(tag) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
// really in the template.
|
|
119
|
-
NEEDS_EXTRA_CLOSE.set(this.constructing, true);
|
|
120
|
-
this.flushElement(null);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return super.openElement(tag);
|
|
78
|
+
return "tr" === tag && "TBODY" !== this.element.tagName && "THEAD" !== this.element.tagName && "TFOOT" !== this.element.tagName && (this.openElement("tbody"),
|
|
79
|
+
// This prevents the closeBlock comment from being re-parented
|
|
80
|
+
// under the auto inserted tbody. Rehydration builder needs to
|
|
81
|
+
// account for the insertion since it is injected here and not
|
|
82
|
+
// really in the template.
|
|
83
|
+
NEEDS_EXTRA_CLOSE.set(this.constructing, !0), this.flushElement(null)), super.openElement(tag);
|
|
124
84
|
}
|
|
125
85
|
pushRemoteElement(element, cursorId, insertBefore = null) {
|
|
126
86
|
let {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
script.setAttribute(
|
|
131
|
-
dom.insertBefore(element, script, insertBefore);
|
|
132
|
-
return super.pushRemoteElement(element, cursorId, insertBefore);
|
|
87
|
+
dom: dom
|
|
88
|
+
} = this,
|
|
89
|
+
script = dom.createElement("script");
|
|
90
|
+
return script.setAttribute("glmr", cursorId), dom.insertBefore(element, script, insertBefore), super.pushRemoteElement(element, cursorId, insertBefore);
|
|
133
91
|
}
|
|
134
92
|
}
|
|
135
93
|
function serializeBuilder(env, cursor) {
|