ember-source 5.6.0-alpha.2 → 5.6.0-alpha.4
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/build-metadata.json +3 -3
- package/dist/dependencies/@glimmer/debug.js +1533 -0
- package/dist/dependencies/@glimmer/destroyable.js +30 -59
- package/dist/dependencies/@glimmer/encoder.js +13 -24
- package/dist/dependencies/@glimmer/global-context.js +38 -41
- package/dist/dependencies/@glimmer/manager.js +144 -326
- package/dist/dependencies/@glimmer/node.js +14 -46
- package/dist/dependencies/@glimmer/opcode-compiler.js +1673 -2478
- package/dist/dependencies/@glimmer/owner.js +2 -5
- package/dist/dependencies/@glimmer/program.js +102 -185
- package/dist/dependencies/@glimmer/reference.js +58 -126
- package/dist/dependencies/@glimmer/runtime.js +4674 -5639
- package/dist/dependencies/@glimmer/util.js +340 -326
- package/dist/dependencies/@glimmer/validator.js +160 -217
- package/dist/dependencies/@glimmer/vm.js +174 -23
- package/dist/dependencies/@glimmer/wire-format.js +91 -34
- package/dist/dependencies/@simple-dom/document.js +1 -1
- package/dist/dependencies/backburner.js.js +1 -1
- package/dist/dependencies/router_js.js +15 -16
- package/dist/dependencies/rsvp.js +89 -88
- package/dist/ember-template-compiler.js +8574 -8350
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +107 -107
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +11216 -9634
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/glimmer/index.js +109 -80
- package/dist/packages/@ember/-internals/metal/index.js +5 -4
- package/dist/packages/@ember/-internals/utils/index.js +3 -4
- package/dist/packages/@ember/array/-internals.js +1 -2
- package/dist/packages/@ember/debug/lib/inspect.js +0 -1
- package/dist/packages/@ember/object/core.js +0 -1
- package/dist/packages/@ember/object/mixin.js +1 -2
- package/dist/packages/@ember/routing/route.js +23 -101
- package/dist/packages/@ember/routing/router.js +25 -84
- package/dist/packages/ember/version.js +1 -1
- package/dist/packages/ember-babel.js +13 -0
- package/docs/data.json +217 -242
- package/lib/index.js +1 -5
- package/package.json +26 -21
- package/types/stable/@ember/-internals/glimmer/index.d.ts +1 -1
- package/types/stable/@ember/-internals/glimmer/lib/component-managers/curly.d.ts +4 -4
- package/types/stable/@ember/-internals/glimmer/lib/component-managers/mount.d.ts +3 -3
- package/types/stable/@ember/-internals/glimmer/lib/component-managers/outlet.d.ts +5 -8
- package/types/stable/@ember/-internals/glimmer/lib/component-managers/root.d.ts +3 -3
- package/types/stable/@ember/-internals/glimmer/lib/renderer.d.ts +3 -3
- package/types/stable/@ember/-internals/glimmer/lib/resolver.d.ts +3 -3
- package/types/stable/@ember/-internals/glimmer/lib/syntax/utils.d.ts +3 -2
- package/types/stable/@ember/-internals/glimmer/lib/utils/iterator.d.ts +2 -2
- package/types/stable/@ember/-internals/glimmer/lib/utils/outlet.d.ts +39 -18
- package/types/stable/@ember/-internals/utility-types/index.d.ts +1 -0
- package/types/stable/@ember/-internals/views/lib/system/utils.d.ts +4 -3
- package/types/stable/@ember/routing/route.d.ts +6 -28
- package/dist/dependencies/@glimmer/low-level.js +0 -77
|
@@ -6,22 +6,37 @@ function emptyArray() {
|
|
|
6
6
|
}
|
|
7
7
|
const EMPTY_STRING_ARRAY = emptyArray();
|
|
8
8
|
const EMPTY_NUMBER_ARRAY = emptyArray();
|
|
9
|
+
|
|
9
10
|
/**
|
|
10
11
|
* This function returns `true` if the input array is the special empty array sentinel,
|
|
11
12
|
* which is sometimes used for optimizations.
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
14
|
function isEmptyArray(input) {
|
|
15
15
|
return input === EMPTY_ARRAY;
|
|
16
16
|
}
|
|
17
|
+
function* reverse(input) {
|
|
18
|
+
for (let i = input.length - 1; i >= 0; i--) {
|
|
19
|
+
yield input[i];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function* enumerate(input) {
|
|
23
|
+
let i = 0;
|
|
24
|
+
for (const item of input) {
|
|
25
|
+
yield [i++, item];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
17
28
|
|
|
18
29
|
// import Logger from './logger';
|
|
19
30
|
|
|
31
|
+
|
|
32
|
+
// let alreadyWarned = false;
|
|
33
|
+
|
|
20
34
|
function debugAssert(test, msg) {
|
|
21
35
|
// if (!alreadyWarned) {
|
|
22
36
|
// alreadyWarned = true;
|
|
23
37
|
// Logger.warn("Don't leave debug assertions on in public builds");
|
|
24
38
|
// }
|
|
39
|
+
|
|
25
40
|
if (!test) {
|
|
26
41
|
throw new Error(msg || 'assertion failure');
|
|
27
42
|
}
|
|
@@ -30,6 +45,84 @@ function deprecate(desc) {
|
|
|
30
45
|
LOCAL_LOGGER.warn(`DEPRECATION: ${desc}`);
|
|
31
46
|
}
|
|
32
47
|
|
|
48
|
+
function keys(obj) {
|
|
49
|
+
return Object.keys(obj);
|
|
50
|
+
}
|
|
51
|
+
function unwrap(val) {
|
|
52
|
+
if (val === null || val === undefined) throw new Error(`Expected value to be present`);
|
|
53
|
+
return val;
|
|
54
|
+
}
|
|
55
|
+
function expect(val, message) {
|
|
56
|
+
if (val === null || val === undefined) throw new Error(message);
|
|
57
|
+
return val;
|
|
58
|
+
}
|
|
59
|
+
function unreachable() {
|
|
60
|
+
let message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'unreachable';
|
|
61
|
+
return new Error(message);
|
|
62
|
+
}
|
|
63
|
+
function exhausted(value) {
|
|
64
|
+
throw new Error(`Exhausted ${String(value)}`);
|
|
65
|
+
}
|
|
66
|
+
const tuple = function () {
|
|
67
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
68
|
+
args[_key] = arguments[_key];
|
|
69
|
+
}
|
|
70
|
+
return args;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
function isPresent(value) {
|
|
74
|
+
return value !== null && value !== undefined;
|
|
75
|
+
}
|
|
76
|
+
function assertPresent(value, message) {
|
|
77
|
+
if (!isPresent(value)) {
|
|
78
|
+
throw new Error(`Expected present, got ${typeof value === 'string' ? value : message}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function isPresentArray(list) {
|
|
82
|
+
return list.length > 0;
|
|
83
|
+
}
|
|
84
|
+
function ifPresent(list, ifPresent, otherwise) {
|
|
85
|
+
if (isPresentArray(list)) {
|
|
86
|
+
return ifPresent(list);
|
|
87
|
+
} else {
|
|
88
|
+
return otherwise();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function arrayToOption(list) {
|
|
92
|
+
if (isPresentArray(list)) {
|
|
93
|
+
return list;
|
|
94
|
+
} else {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function assertPresentArray(list) {
|
|
99
|
+
let message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : `unexpected empty list`;
|
|
100
|
+
if (!isPresentArray(list)) {
|
|
101
|
+
throw new Error(message);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function asPresentArray(list) {
|
|
105
|
+
let message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : `unexpected empty list`;
|
|
106
|
+
assertPresentArray(list, message);
|
|
107
|
+
return list;
|
|
108
|
+
}
|
|
109
|
+
function getLast(list) {
|
|
110
|
+
return list.length === 0 ? undefined : list[list.length - 1];
|
|
111
|
+
}
|
|
112
|
+
function getFirst(list) {
|
|
113
|
+
return list.length === 0 ? undefined : list[0];
|
|
114
|
+
}
|
|
115
|
+
function mapPresentArray(list, mapper) {
|
|
116
|
+
if (list === null) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
let out = [];
|
|
120
|
+
for (let item of list) {
|
|
121
|
+
out.push(mapper(item));
|
|
122
|
+
}
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
125
|
+
|
|
33
126
|
function dict() {
|
|
34
127
|
return Object.create(null);
|
|
35
128
|
}
|
|
@@ -40,45 +133,89 @@ function isObject(u) {
|
|
|
40
133
|
return typeof u === 'function' || typeof u === 'object' && u !== null;
|
|
41
134
|
}
|
|
42
135
|
class StackImpl {
|
|
43
|
-
|
|
44
|
-
|
|
136
|
+
stack;
|
|
137
|
+
current = null;
|
|
138
|
+
constructor() {
|
|
139
|
+
let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
45
140
|
this.stack = values;
|
|
46
141
|
}
|
|
47
|
-
|
|
48
142
|
get size() {
|
|
49
143
|
return this.stack.length;
|
|
50
144
|
}
|
|
51
|
-
|
|
52
145
|
push(item) {
|
|
53
146
|
this.current = item;
|
|
54
147
|
this.stack.push(item);
|
|
55
148
|
}
|
|
56
|
-
|
|
57
149
|
pop() {
|
|
58
150
|
let item = this.stack.pop();
|
|
59
|
-
|
|
60
|
-
this.current = len === 0 ? null : this.stack[len - 1];
|
|
151
|
+
this.current = getLast(this.stack) ?? null;
|
|
61
152
|
return item === undefined ? null : item;
|
|
62
153
|
}
|
|
63
|
-
|
|
64
154
|
nth(from) {
|
|
65
155
|
let len = this.stack.length;
|
|
66
|
-
return len < from ? null : this.stack[len - from];
|
|
156
|
+
return len < from ? null : unwrap(this.stack[len - from]);
|
|
67
157
|
}
|
|
68
|
-
|
|
69
158
|
isEmpty() {
|
|
70
159
|
return this.stack.length === 0;
|
|
71
160
|
}
|
|
72
|
-
|
|
73
161
|
toArray() {
|
|
74
162
|
return this.stack;
|
|
75
163
|
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/// <reference types="qunit" />
|
|
167
|
+
|
|
168
|
+
let beginTestSteps;
|
|
169
|
+
let endTestSteps;
|
|
170
|
+
let verifySteps;
|
|
171
|
+
let logStep;
|
|
76
172
|
|
|
173
|
+
let debugToString;
|
|
174
|
+
if (DEBUG) {
|
|
175
|
+
let getFunctionName = fn => {
|
|
176
|
+
let functionName = fn.name;
|
|
177
|
+
if (functionName === undefined) {
|
|
178
|
+
let match = /function (\w+)\s*\(/u.exec(String(fn));
|
|
179
|
+
functionName = match && match[1] || '';
|
|
180
|
+
}
|
|
181
|
+
return functionName.replace(/^bound /u, '');
|
|
182
|
+
};
|
|
183
|
+
let getObjectName = obj => {
|
|
184
|
+
let name;
|
|
185
|
+
let className;
|
|
186
|
+
if (obj.constructor && typeof obj.constructor === 'function') {
|
|
187
|
+
className = getFunctionName(obj.constructor);
|
|
188
|
+
}
|
|
189
|
+
if ('toString' in obj && obj.toString !== Object.prototype.toString && obj.toString !== Function.prototype.toString) {
|
|
190
|
+
name = obj.toString();
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// If the class has a decent looking name, and the `toString` is one of the
|
|
194
|
+
// default Ember toStrings, replace the constructor portion of the toString
|
|
195
|
+
// with the class name. We check the length of the class name to prevent doing
|
|
196
|
+
// this when the value is minified.
|
|
197
|
+
if (name && /<.*:ember\d+>/u.test(name) && className && className[0] !== '_' && className.length > 2 && className !== 'Class') {
|
|
198
|
+
return name.replace(/<.*:/u, `<${className}:`);
|
|
199
|
+
}
|
|
200
|
+
return name || className;
|
|
201
|
+
};
|
|
202
|
+
let getPrimitiveName = value => {
|
|
203
|
+
return String(value);
|
|
204
|
+
};
|
|
205
|
+
debugToString = value => {
|
|
206
|
+
if (typeof value === 'function') {
|
|
207
|
+
return getFunctionName(value) || `(unknown function)`;
|
|
208
|
+
} else if (typeof value === 'object' && value !== null) {
|
|
209
|
+
return getObjectName(value) || `(unknown object)`;
|
|
210
|
+
} else {
|
|
211
|
+
return getPrimitiveName(value);
|
|
212
|
+
}
|
|
213
|
+
};
|
|
77
214
|
}
|
|
215
|
+
var debugToString$1 = debugToString;
|
|
78
216
|
|
|
79
217
|
function clearElement(parent) {
|
|
80
218
|
let current = parent.firstChild;
|
|
81
|
-
|
|
82
219
|
while (current) {
|
|
83
220
|
let next = current.nextSibling;
|
|
84
221
|
parent.removeChild(current);
|
|
@@ -86,30 +223,118 @@ function clearElement(parent) {
|
|
|
86
223
|
}
|
|
87
224
|
}
|
|
88
225
|
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
226
|
+
const RAW_NODE = -1;
|
|
227
|
+
const ELEMENT_NODE = 1;
|
|
228
|
+
const TEXT_NODE = 3;
|
|
229
|
+
const COMMENT_NODE = 8;
|
|
230
|
+
const DOCUMENT_NODE = 9;
|
|
231
|
+
const DOCUMENT_TYPE_NODE = 10;
|
|
232
|
+
const DOCUMENT_FRAGMENT_NODE = 11;
|
|
233
|
+
const NS_HTML = 'http://www.w3.org/1999/xhtml';
|
|
234
|
+
const NS_MATHML = 'http://www.w3.org/1998/Math/MathML';
|
|
235
|
+
const NS_SVG = 'http://www.w3.org/2000/svg';
|
|
236
|
+
const NS_XLINK = 'http://www.w3.org/1999/xlink';
|
|
237
|
+
const NS_XML = 'http://www.w3.org/XML/1998/namespace';
|
|
238
|
+
const NS_XMLNS = 'http://www.w3.org/2000/xmlns/';
|
|
239
|
+
const INSERT_BEFORE_BEGIN = 'beforebegin';
|
|
240
|
+
const INSERT_AFTER_BEGIN = 'afterbegin';
|
|
241
|
+
const INSERT_BEFORE_END = 'beforeend';
|
|
242
|
+
const INSERT_AFTER_END = 'afterend';
|
|
93
243
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
let arr = new Array(count);
|
|
244
|
+
/*
|
|
245
|
+
Encoding notes
|
|
97
246
|
|
|
98
|
-
for
|
|
99
|
-
|
|
100
|
-
}
|
|
247
|
+
We use 30 bit integers for encoding, so that we don't ever encode a non-SMI
|
|
248
|
+
integer to push on the stack.
|
|
101
249
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
function values(obj) {
|
|
105
|
-
const vals = [];
|
|
250
|
+
Handles are >= 0
|
|
251
|
+
Immediates are < 0
|
|
106
252
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
253
|
+
True, False, Undefined and Null are pushed as handles into the symbol table,
|
|
254
|
+
with well known handles (0, 1, 2, 3)
|
|
255
|
+
|
|
256
|
+
The negative space is divided into positives and negatives. Positives are
|
|
257
|
+
higher numbers (-1, -2, -3, etc), negatives are lower.
|
|
258
|
+
|
|
259
|
+
We only encode immediates for two reasons:
|
|
260
|
+
|
|
261
|
+
1. To transfer over the wire, so they're smaller in general
|
|
262
|
+
2. When pushing values onto the stack from the low level/inner VM, which may
|
|
263
|
+
be converted into WASM one day.
|
|
264
|
+
|
|
265
|
+
This allows the low-level VM to always use SMIs, and to minimize using JS
|
|
266
|
+
values via handles for things like the stack pointer and frame pointer.
|
|
267
|
+
Externally, most code pushes values as JS values, except when being pulled
|
|
268
|
+
from the append byte code where it was already encoded.
|
|
269
|
+
|
|
270
|
+
Logically, this is because the low level VM doesn't really care about these
|
|
271
|
+
higher level values. For instance, the result of a userland helper may be a
|
|
272
|
+
number, or a boolean, or undefined/null, but it's extra work to figure that
|
|
273
|
+
out and push it correctly, vs. just pushing the value as a JS value with a
|
|
274
|
+
handle.
|
|
275
|
+
|
|
276
|
+
Note: The details could change here in the future, this is just the current
|
|
277
|
+
strategy.
|
|
278
|
+
*/
|
|
110
279
|
|
|
111
|
-
|
|
280
|
+
let ImmediateConstants = /*#__PURE__*/function (ImmediateConstants) {
|
|
281
|
+
ImmediateConstants[ImmediateConstants["MAX_SMI"] = 1073741823] = "MAX_SMI";
|
|
282
|
+
ImmediateConstants[ImmediateConstants["MIN_SMI"] = -1073741824] = "MIN_SMI";
|
|
283
|
+
ImmediateConstants[ImmediateConstants["SIGN_BIT"] = -536870913] = "SIGN_BIT";
|
|
284
|
+
ImmediateConstants[ImmediateConstants["MAX_INT"] = 536870911] = "MAX_INT";
|
|
285
|
+
ImmediateConstants[ImmediateConstants["MIN_INT"] = -536870912] = "MIN_INT";
|
|
286
|
+
ImmediateConstants[ImmediateConstants["FALSE_HANDLE"] = 0] = "FALSE_HANDLE";
|
|
287
|
+
ImmediateConstants[ImmediateConstants["TRUE_HANDLE"] = 1] = "TRUE_HANDLE";
|
|
288
|
+
ImmediateConstants[ImmediateConstants["NULL_HANDLE"] = 2] = "NULL_HANDLE";
|
|
289
|
+
ImmediateConstants[ImmediateConstants["UNDEFINED_HANDLE"] = 3] = "UNDEFINED_HANDLE";
|
|
290
|
+
ImmediateConstants[ImmediateConstants["ENCODED_FALSE_HANDLE"] = 0] = "ENCODED_FALSE_HANDLE";
|
|
291
|
+
ImmediateConstants[ImmediateConstants["ENCODED_TRUE_HANDLE"] = 1] = "ENCODED_TRUE_HANDLE";
|
|
292
|
+
ImmediateConstants[ImmediateConstants["ENCODED_NULL_HANDLE"] = 2] = "ENCODED_NULL_HANDLE";
|
|
293
|
+
ImmediateConstants[ImmediateConstants["ENCODED_UNDEFINED_HANDLE"] = 3] = "ENCODED_UNDEFINED_HANDLE";
|
|
294
|
+
return ImmediateConstants;
|
|
295
|
+
}({});
|
|
296
|
+
function isHandle(value) {
|
|
297
|
+
return value >= 0;
|
|
112
298
|
}
|
|
299
|
+
function isNonPrimitiveHandle(value) {
|
|
300
|
+
return value > ImmediateConstants.ENCODED_UNDEFINED_HANDLE;
|
|
301
|
+
}
|
|
302
|
+
function constants() {
|
|
303
|
+
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
304
|
+
values[_key] = arguments[_key];
|
|
305
|
+
}
|
|
306
|
+
return [false, true, null, undefined, ...values];
|
|
307
|
+
}
|
|
308
|
+
function isSmallInt(value) {
|
|
309
|
+
return value % 1 === 0 && value <= ImmediateConstants.MAX_INT && value >= ImmediateConstants.MIN_INT;
|
|
310
|
+
}
|
|
311
|
+
function encodeNegative(num) {
|
|
312
|
+
return num & ImmediateConstants.SIGN_BIT;
|
|
313
|
+
}
|
|
314
|
+
function decodeNegative(num) {
|
|
315
|
+
return num | ~ImmediateConstants.SIGN_BIT;
|
|
316
|
+
}
|
|
317
|
+
function encodePositive(num) {
|
|
318
|
+
return ~num;
|
|
319
|
+
}
|
|
320
|
+
function decodePositive(num) {
|
|
321
|
+
return ~num;
|
|
322
|
+
}
|
|
323
|
+
function encodeHandle(num) {
|
|
324
|
+
return num;
|
|
325
|
+
}
|
|
326
|
+
function decodeHandle(num) {
|
|
327
|
+
return num;
|
|
328
|
+
}
|
|
329
|
+
function encodeImmediate(num) {
|
|
330
|
+
num |= 0;
|
|
331
|
+
return num < 0 ? encodeNegative(num) : encodePositive(num);
|
|
332
|
+
}
|
|
333
|
+
function decodeImmediate(num) {
|
|
334
|
+
num |= 0;
|
|
335
|
+
return num > ImmediateConstants.SIGN_BIT ? decodePositive(num) : decodeNegative(num);
|
|
336
|
+
}
|
|
337
|
+
[1, -1].forEach(x => decodeImmediate(encodeImmediate(x)));
|
|
113
338
|
|
|
114
339
|
/**
|
|
115
340
|
Strongly hint runtimes to intern the provided string.
|
|
@@ -153,239 +378,79 @@ function values(obj) {
|
|
|
153
378
|
function intern(str) {
|
|
154
379
|
let obj = {};
|
|
155
380
|
obj[str] = 1;
|
|
156
|
-
|
|
157
381
|
for (let key in obj) {
|
|
158
382
|
if (key === str) {
|
|
159
383
|
return key;
|
|
160
384
|
}
|
|
161
385
|
}
|
|
162
|
-
|
|
163
386
|
return str;
|
|
164
387
|
}
|
|
165
388
|
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
return false;
|
|
170
|
-
} // eslint-disable-next-line symbol-description
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
return typeof Symbol() === 'symbol';
|
|
174
|
-
}();
|
|
175
|
-
function keys(obj) {
|
|
176
|
-
return Object.keys(obj);
|
|
177
|
-
}
|
|
178
|
-
function unwrap(val) {
|
|
179
|
-
if (val === null || val === undefined) throw new Error(`Expected value to be present`);
|
|
180
|
-
return val;
|
|
181
|
-
}
|
|
182
|
-
function expect(val, message) {
|
|
183
|
-
if (val === null || val === undefined) throw new Error(message);
|
|
184
|
-
return val;
|
|
185
|
-
}
|
|
186
|
-
function unreachable(message = 'unreachable') {
|
|
187
|
-
return new Error(message);
|
|
188
|
-
}
|
|
189
|
-
function exhausted(value) {
|
|
190
|
-
throw new Error(`Exhausted ${value}`);
|
|
191
|
-
}
|
|
192
|
-
const tuple = (...args) => args;
|
|
193
|
-
function enumerableSymbol(key) {
|
|
194
|
-
return intern(`__${key}${Math.floor(Math.random() * Date.now())}__`);
|
|
195
|
-
}
|
|
196
|
-
const symbol = HAS_NATIVE_SYMBOL ? Symbol : enumerableSymbol;
|
|
197
|
-
|
|
198
|
-
function strip(strings, ...args) {
|
|
199
|
-
let out = '';
|
|
200
|
-
|
|
201
|
-
for (let i = 0; i < strings.length; i++) {
|
|
202
|
-
let string = strings[i];
|
|
203
|
-
let dynamic = args[i] !== undefined ? String(args[i]) : '';
|
|
204
|
-
out += `${string}${dynamic}`;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
let lines = out.split('\n');
|
|
208
|
-
|
|
209
|
-
while (lines.length && lines[0].match(/^\s*$/)) {
|
|
210
|
-
lines.shift();
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
while (lines.length && lines[lines.length - 1].match(/^\s*$/)) {
|
|
214
|
-
lines.pop();
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
let min = Infinity;
|
|
218
|
-
|
|
219
|
-
for (let line of lines) {
|
|
220
|
-
let leading = line.match(/^\s*/)[0].length;
|
|
221
|
-
min = Math.min(min, leading);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
let stripped = [];
|
|
225
|
-
|
|
226
|
-
for (let line of lines) {
|
|
227
|
-
stripped.push(line.slice(min));
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
return stripped.join('\n');
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
function isHandle(value) {
|
|
234
|
-
return value >= 0;
|
|
235
|
-
}
|
|
236
|
-
function isNonPrimitiveHandle(value) {
|
|
237
|
-
return value > 3
|
|
238
|
-
/* ENCODED_UNDEFINED_HANDLE */
|
|
239
|
-
;
|
|
240
|
-
}
|
|
241
|
-
function constants(...values) {
|
|
242
|
-
return [false, true, null, undefined, ...values];
|
|
243
|
-
}
|
|
244
|
-
function isSmallInt(value) {
|
|
245
|
-
return value % 1 === 0 && value <= 536870911
|
|
246
|
-
/* MAX_INT */
|
|
247
|
-
&& value >= -536870912
|
|
248
|
-
/* MIN_INT */
|
|
249
|
-
;
|
|
250
|
-
}
|
|
251
|
-
function encodeNegative(num) {
|
|
252
|
-
|
|
253
|
-
return num & -536870913
|
|
254
|
-
/* SIGN_BIT */
|
|
255
|
-
;
|
|
256
|
-
}
|
|
257
|
-
function decodeNegative(num) {
|
|
258
|
-
|
|
259
|
-
return num | ~-536870913
|
|
260
|
-
/* SIGN_BIT */
|
|
261
|
-
;
|
|
262
|
-
}
|
|
263
|
-
function encodePositive(num) {
|
|
264
|
-
|
|
265
|
-
return ~num;
|
|
266
|
-
}
|
|
267
|
-
function decodePositive(num) {
|
|
268
|
-
|
|
269
|
-
return ~num;
|
|
270
|
-
}
|
|
271
|
-
function encodeHandle(num) {
|
|
272
|
-
|
|
273
|
-
return num;
|
|
274
|
-
}
|
|
275
|
-
function decodeHandle(num) {
|
|
276
|
-
|
|
277
|
-
return num;
|
|
278
|
-
}
|
|
279
|
-
function encodeImmediate(num) {
|
|
280
|
-
num |= 0;
|
|
281
|
-
return num < 0 ? encodeNegative(num) : encodePositive(num);
|
|
282
|
-
}
|
|
283
|
-
function decodeImmediate(num) {
|
|
284
|
-
num |= 0;
|
|
285
|
-
return num > -536870913
|
|
286
|
-
/* SIGN_BIT */
|
|
287
|
-
? decodePositive(num) : decodeNegative(num);
|
|
288
|
-
} // Warm
|
|
289
|
-
[1, -1].forEach(x => decodeImmediate(encodeImmediate(x)));
|
|
290
|
-
|
|
291
|
-
function unwrapHandle(handle) {
|
|
292
|
-
if (typeof handle === 'number') {
|
|
293
|
-
return handle;
|
|
294
|
-
} else {
|
|
295
|
-
let error = handle.errors[0];
|
|
296
|
-
throw new Error(`Compile Error: ${error.problem} @ ${error.span.start}..${error.span.end}`);
|
|
297
|
-
}
|
|
389
|
+
const SERIALIZATION_FIRST_NODE_STRING = '%+b:0%';
|
|
390
|
+
function isSerializationFirstNode(node) {
|
|
391
|
+
return node.nodeValue === SERIALIZATION_FIRST_NODE_STRING;
|
|
298
392
|
}
|
|
299
|
-
function unwrapTemplate(template) {
|
|
300
|
-
if (template.result === 'error') {
|
|
301
|
-
throw new Error(`Compile Error: ${template.problem} @ ${template.span.start}..${template.span.end}`);
|
|
302
|
-
}
|
|
303
393
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
} else {
|
|
310
|
-
return handle.handle;
|
|
394
|
+
let assign = Object.assign;
|
|
395
|
+
function fillNulls(count) {
|
|
396
|
+
let arr = new Array(count);
|
|
397
|
+
for (let i = 0; i < count; i++) {
|
|
398
|
+
arr[i] = null;
|
|
311
399
|
}
|
|
400
|
+
return arr;
|
|
312
401
|
}
|
|
313
|
-
function
|
|
314
|
-
return
|
|
402
|
+
function values(obj) {
|
|
403
|
+
return Object.values(obj);
|
|
315
404
|
}
|
|
316
|
-
function
|
|
317
|
-
return
|
|
405
|
+
function entries(dict) {
|
|
406
|
+
return Object.entries(dict);
|
|
318
407
|
}
|
|
319
408
|
|
|
320
|
-
var weakSet = typeof WeakSet === 'function' ? WeakSet : class WeakSetPolyFill {
|
|
321
|
-
constructor() {
|
|
322
|
-
this._map = new WeakMap();
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
add(val) {
|
|
326
|
-
this._map.set(val, true);
|
|
327
|
-
|
|
328
|
-
return this;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
delete(val) {
|
|
332
|
-
return this._map.delete(val);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
has(val) {
|
|
336
|
-
return this._map.has(val);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
};
|
|
340
|
-
|
|
341
409
|
function castToSimple(node) {
|
|
342
410
|
if (isDocument(node)) {
|
|
343
411
|
return node;
|
|
344
|
-
} else if (
|
|
412
|
+
} else if (isSimpleElement(node)) {
|
|
345
413
|
return node;
|
|
346
414
|
} else {
|
|
347
415
|
return node;
|
|
348
416
|
}
|
|
349
417
|
}
|
|
418
|
+
|
|
419
|
+
// If passed a document, verify we're in the browser and return it as a Document
|
|
420
|
+
|
|
421
|
+
// If we don't know what this is, but the check requires it to be an element,
|
|
422
|
+
// the cast will mandate that it's a browser element
|
|
423
|
+
// Finally, if it's a more generic check, the cast will mandate that it's a
|
|
424
|
+
// browser node and return a BrowserNodeUtils corresponding to the check
|
|
350
425
|
function castToBrowser(node, sugaryCheck) {
|
|
351
426
|
if (node === null || node === undefined) {
|
|
352
427
|
return null;
|
|
353
428
|
}
|
|
354
|
-
|
|
355
429
|
if (typeof document === undefined) {
|
|
356
430
|
throw new Error('Attempted to cast to a browser node in a non-browser context');
|
|
357
431
|
}
|
|
358
|
-
|
|
359
432
|
if (isDocument(node)) {
|
|
360
433
|
return node;
|
|
361
434
|
}
|
|
362
|
-
|
|
363
435
|
if (node.ownerDocument !== document) {
|
|
364
436
|
throw new Error('Attempted to cast to a browser node with a node that was not created from this document');
|
|
365
437
|
}
|
|
366
|
-
|
|
367
|
-
return checkNode(node, sugaryCheck);
|
|
438
|
+
return checkBrowserNode(node, sugaryCheck);
|
|
368
439
|
}
|
|
369
|
-
|
|
370
440
|
function checkError(from, check) {
|
|
371
|
-
return new Error(`cannot cast a ${from} into ${check}`);
|
|
441
|
+
return new Error(`cannot cast a ${from} into ${String(check)}`);
|
|
372
442
|
}
|
|
373
|
-
|
|
374
443
|
function isDocument(node) {
|
|
375
|
-
return node.nodeType ===
|
|
376
|
-
|
|
377
|
-
|
|
444
|
+
return node.nodeType === DOCUMENT_NODE;
|
|
445
|
+
}
|
|
446
|
+
function isSimpleElement(node) {
|
|
447
|
+
return node?.nodeType === ELEMENT_NODE;
|
|
378
448
|
}
|
|
379
|
-
|
|
380
449
|
function isElement(node) {
|
|
381
|
-
return node
|
|
382
|
-
/* ELEMENT_NODE */
|
|
383
|
-
;
|
|
450
|
+
return node?.nodeType === ELEMENT_NODE && node instanceof Element;
|
|
384
451
|
}
|
|
385
|
-
|
|
386
|
-
function checkNode(node, check) {
|
|
452
|
+
function checkBrowserNode(node, check) {
|
|
387
453
|
let isMatch = false;
|
|
388
|
-
|
|
389
454
|
if (node !== null) {
|
|
390
455
|
if (typeof check === 'string') {
|
|
391
456
|
isMatch = stringCheckNode(node, check);
|
|
@@ -395,161 +460,110 @@ function checkNode(node, check) {
|
|
|
395
460
|
throw unreachable();
|
|
396
461
|
}
|
|
397
462
|
}
|
|
398
|
-
|
|
399
|
-
if (isMatch) {
|
|
463
|
+
if (isMatch && node instanceof Node) {
|
|
400
464
|
return node;
|
|
401
465
|
} else {
|
|
402
|
-
throw checkError(`SimpleElement(${node})`, check);
|
|
466
|
+
throw checkError(`SimpleElement(${node?.constructor?.name ?? 'null'})`, check);
|
|
403
467
|
}
|
|
404
468
|
}
|
|
405
|
-
|
|
406
469
|
function stringCheckNode(node, check) {
|
|
407
470
|
switch (check) {
|
|
408
471
|
case 'NODE':
|
|
409
472
|
return true;
|
|
410
|
-
|
|
411
473
|
case 'HTML':
|
|
412
474
|
return node instanceof HTMLElement;
|
|
413
|
-
|
|
414
475
|
case 'SVG':
|
|
415
476
|
return node instanceof SVGElement;
|
|
416
|
-
|
|
417
477
|
case 'ELEMENT':
|
|
418
478
|
return node instanceof Element;
|
|
419
|
-
|
|
420
479
|
default:
|
|
421
480
|
if (check.toUpperCase() === check) {
|
|
422
481
|
throw new Error(`BUG: this code is missing handling for a generic node type`);
|
|
423
482
|
}
|
|
424
|
-
|
|
425
483
|
return node instanceof Element && node.tagName.toLowerCase() === check;
|
|
426
484
|
}
|
|
427
485
|
}
|
|
428
486
|
|
|
429
|
-
function
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
487
|
+
function strip(strings) {
|
|
488
|
+
let out = '';
|
|
489
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
490
|
+
args[_key - 1] = arguments[_key];
|
|
491
|
+
}
|
|
492
|
+
for (const [i, string] of enumerate(strings)) {
|
|
493
|
+
let dynamic = args[i] !== undefined ? String(args[i]) : '';
|
|
494
|
+
out += `${string}${dynamic}`;
|
|
495
|
+
}
|
|
496
|
+
let lines = out.split('\n');
|
|
497
|
+
while (isPresentArray(lines) && /^\s*$/u.test(getFirst(lines))) {
|
|
498
|
+
lines.shift();
|
|
499
|
+
}
|
|
500
|
+
while (isPresentArray(lines) && /^\s*$/u.test(getLast(lines))) {
|
|
501
|
+
lines.pop();
|
|
502
|
+
}
|
|
503
|
+
let min = Infinity;
|
|
504
|
+
for (let line of lines) {
|
|
505
|
+
let leading = /^\s*/u.exec(line)[0].length;
|
|
506
|
+
min = Math.min(min, leading);
|
|
437
507
|
}
|
|
508
|
+
let stripped = [];
|
|
509
|
+
for (let line of lines) {
|
|
510
|
+
stripped.push(line.slice(min));
|
|
511
|
+
}
|
|
512
|
+
return stripped.join('\n');
|
|
438
513
|
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
514
|
+
|
|
515
|
+
function unwrapHandle(handle) {
|
|
516
|
+
if (typeof handle === 'number') {
|
|
517
|
+
return handle;
|
|
442
518
|
} else {
|
|
443
|
-
|
|
519
|
+
let error = handle.errors[0];
|
|
520
|
+
throw new Error(`Compile Error: ${error.problem} @ ${error.span.start}..${error.span.end}`);
|
|
444
521
|
}
|
|
445
522
|
}
|
|
446
|
-
function
|
|
447
|
-
if (
|
|
448
|
-
throw new Error(
|
|
523
|
+
function unwrapTemplate(template) {
|
|
524
|
+
if (template.result === 'error') {
|
|
525
|
+
throw new Error(`Compile Error: ${template.problem} @ ${template.span.start}..${template.span.end}`);
|
|
449
526
|
}
|
|
527
|
+
return template;
|
|
450
528
|
}
|
|
451
|
-
function
|
|
452
|
-
if (
|
|
453
|
-
return
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
let out = [];
|
|
457
|
-
|
|
458
|
-
for (let item of list) {
|
|
459
|
-
out.push(callback(item));
|
|
529
|
+
function extractHandle(handle) {
|
|
530
|
+
if (typeof handle === 'number') {
|
|
531
|
+
return handle;
|
|
532
|
+
} else {
|
|
533
|
+
return handle.handle;
|
|
460
534
|
}
|
|
461
|
-
|
|
462
|
-
|
|
535
|
+
}
|
|
536
|
+
function isOkHandle(handle) {
|
|
537
|
+
return typeof handle === 'number';
|
|
538
|
+
}
|
|
539
|
+
function isErrHandle(handle) {
|
|
540
|
+
return typeof handle === 'number';
|
|
463
541
|
}
|
|
464
542
|
|
|
465
543
|
function buildUntouchableThis(source) {
|
|
466
544
|
let context = null;
|
|
467
|
-
|
|
468
|
-
if (DEBUG && HAS_NATIVE_PROXY) {
|
|
545
|
+
if (DEBUG) {
|
|
469
546
|
let assertOnProperty = property => {
|
|
470
|
-
|
|
547
|
+
let access = typeof property === 'symbol' || typeof property === 'number' ? `[${String(property)}]` : `.${property}`;
|
|
548
|
+
throw new Error(`You accessed \`this${access}\` from a function passed to the ${source}, but the function itself was not bound to a valid \`this\` context. Consider updating to use a bound function (for instance, use an arrow function, \`() => {}\`).`);
|
|
471
549
|
};
|
|
472
|
-
|
|
473
550
|
context = new Proxy({}, {
|
|
474
551
|
get(_target, property) {
|
|
475
552
|
assertOnProperty(property);
|
|
476
553
|
},
|
|
477
|
-
|
|
478
554
|
set(_target, property) {
|
|
479
555
|
assertOnProperty(property);
|
|
480
556
|
return false;
|
|
481
557
|
},
|
|
482
|
-
|
|
483
558
|
has(_target, property) {
|
|
484
559
|
assertOnProperty(property);
|
|
485
560
|
return false;
|
|
486
561
|
}
|
|
487
|
-
|
|
488
562
|
});
|
|
489
563
|
}
|
|
490
|
-
|
|
491
564
|
return context;
|
|
492
565
|
}
|
|
493
566
|
|
|
494
|
-
let debugToString;
|
|
495
|
-
|
|
496
|
-
if (DEBUG) {
|
|
497
|
-
let getFunctionName = fn => {
|
|
498
|
-
let functionName = fn.name;
|
|
499
|
-
|
|
500
|
-
if (functionName === undefined) {
|
|
501
|
-
let match = Function.prototype.toString.call(fn).match(/function (\w+)\s*\(/);
|
|
502
|
-
functionName = match && match[1] || '';
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
return functionName.replace(/^bound /, '');
|
|
506
|
-
};
|
|
507
|
-
|
|
508
|
-
let getObjectName = obj => {
|
|
509
|
-
let name;
|
|
510
|
-
let className;
|
|
511
|
-
|
|
512
|
-
if (obj.constructor && typeof obj.constructor === 'function') {
|
|
513
|
-
className = getFunctionName(obj.constructor);
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
if ('toString' in obj && obj.toString !== Object.prototype.toString && obj.toString !== Function.prototype.toString) {
|
|
517
|
-
name = obj.toString();
|
|
518
|
-
} // If the class has a decent looking name, and the `toString` is one of the
|
|
519
|
-
// default Ember toStrings, replace the constructor portion of the toString
|
|
520
|
-
// with the class name. We check the length of the class name to prevent doing
|
|
521
|
-
// this when the value is minified.
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
if (name && name.match(/<.*:ember\d+>/) && className && className[0] !== '_' && className.length > 2 && className !== 'Class') {
|
|
525
|
-
return name.replace(/<.*:/, `<${className}:`);
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
return name || className;
|
|
529
|
-
};
|
|
530
|
-
|
|
531
|
-
let getPrimitiveName = value => {
|
|
532
|
-
return String(value);
|
|
533
|
-
};
|
|
534
|
-
|
|
535
|
-
debugToString = value => {
|
|
536
|
-
if (typeof value === 'function') {
|
|
537
|
-
return getFunctionName(value) || `(unknown function)`;
|
|
538
|
-
} else if (typeof value === 'object' && value !== null) {
|
|
539
|
-
return getObjectName(value) || `(unknown object)`;
|
|
540
|
-
} else {
|
|
541
|
-
return getPrimitiveName(value);
|
|
542
|
-
}
|
|
543
|
-
};
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
var debugToString$1 = debugToString;
|
|
547
|
-
|
|
548
|
-
let beginTestSteps;
|
|
549
|
-
let endTestSteps;
|
|
550
|
-
let verifySteps;
|
|
551
|
-
let logStep;
|
|
552
|
-
|
|
553
567
|
/**
|
|
554
568
|
* This constant exists to make it easier to differentiate normal logs from
|
|
555
569
|
* errant console.logs. LOCAL_LOGGER should only be used inside a
|
|
@@ -558,20 +572,20 @@ let logStep;
|
|
|
558
572
|
* It does not alleviate the need to check LOCAL_SHOULD_LOG, which is used
|
|
559
573
|
* for stripping.
|
|
560
574
|
*/
|
|
561
|
-
|
|
562
575
|
const LOCAL_LOGGER = console;
|
|
576
|
+
|
|
563
577
|
/**
|
|
564
578
|
* This constant exists to make it easier to differentiate normal logs from
|
|
565
579
|
* errant console.logs. LOGGER can be used outside of LOCAL_SHOULD_LOG checks,
|
|
566
580
|
* and is meant to be used in the rare situation where a console.* call is
|
|
567
581
|
* actually appropriate.
|
|
568
582
|
*/
|
|
569
|
-
|
|
570
583
|
const LOGGER = console;
|
|
571
|
-
function assertNever(value
|
|
584
|
+
function assertNever(value) {
|
|
585
|
+
let desc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'unexpected unreachable branch';
|
|
572
586
|
LOGGER.log('unreachable', value);
|
|
573
587
|
LOGGER.log(`${desc} :: ${JSON.stringify(value)} (${value})`);
|
|
574
588
|
throw new Error(`code reached unreachable`);
|
|
575
589
|
}
|
|
576
590
|
|
|
577
|
-
export { EMPTY_ARRAY, EMPTY_NUMBER_ARRAY, EMPTY_STRING_ARRAY,
|
|
591
|
+
export { COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, EMPTY_ARRAY, EMPTY_NUMBER_ARRAY, EMPTY_STRING_ARRAY, INSERT_AFTER_BEGIN, INSERT_AFTER_END, INSERT_BEFORE_BEGIN, INSERT_BEFORE_END, ImmediateConstants, LOCAL_LOGGER, LOGGER, NS_HTML, NS_MATHML, NS_SVG, NS_XLINK, NS_XML, NS_XMLNS, RAW_NODE, SERIALIZATION_FIRST_NODE_STRING, StackImpl as Stack, TEXT_NODE, arrayToOption, asPresentArray, debugAssert as assert, assertNever, assertPresent, assertPresentArray, assign, beginTestSteps, buildUntouchableThis, castToBrowser, castToSimple, checkBrowserNode as checkNode, clearElement, constants, debugToString$1 as debugToString, decodeHandle, decodeImmediate, decodeNegative, decodePositive, deprecate, dict, emptyArray, encodeHandle, encodeImmediate, encodeNegative, encodePositive, endTestSteps, entries, enumerate, exhausted, expect, extractHandle, fillNulls, getFirst, getLast, ifPresent, intern, isDict, isElement, isEmptyArray, isErrHandle, isHandle, isNonPrimitiveHandle, isObject, isOkHandle, isPresent, isPresentArray, isSerializationFirstNode, isSimpleElement, isSmallInt, keys, logStep, mapPresentArray, reverse, strip, tuple, unreachable, unwrap, unwrapHandle, unwrapTemplate, values, verifySteps };
|