1 | var __extends = (this && this.__extends) || (function () {
|
2 | var extendStatics = function (d, b) {
|
3 | extendStatics = Object.setPrototypeOf ||
|
4 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
5 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
6 | return extendStatics(d, b);
|
7 | };
|
8 | return function (d, b) {
|
9 | extendStatics(d, b);
|
10 | function __() { this.constructor = d; }
|
11 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
12 | };
|
13 | })();
|
14 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
15 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
16 | return new (P || (P = Promise))(function (resolve, reject) {
|
17 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
18 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
19 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
20 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
21 | });
|
22 | };
|
23 | var __generator = (this && this.__generator) || function (thisArg, body) {
|
24 | var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
25 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
26 | function verb(n) { return function (v) { return step([n, v]); }; }
|
27 | function step(op) {
|
28 | if (f) throw new TypeError("Generator is already executing.");
|
29 | while (_) try {
|
30 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
31 | if (y = 0, t) op = [op[0] & 2, t.value];
|
32 | switch (op[0]) {
|
33 | case 0: case 1: t = op; break;
|
34 | case 4: _.label++; return { value: op[1], done: false };
|
35 | case 5: _.label++; y = op[1]; op = [0]; continue;
|
36 | case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
37 | default:
|
38 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
39 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
40 | if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
41 | if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
42 | if (t[2]) _.ops.pop();
|
43 | _.trys.pop(); continue;
|
44 | }
|
45 | op = body.call(thisArg, _);
|
46 | } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
47 | if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
48 | }
|
49 | };
|
50 | var __spreadArrays = (this && this.__spreadArrays) || function () {
|
51 | for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
52 | for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
53 | for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
54 | r[k] = a[j];
|
55 | return r;
|
56 | };
|
57 | var BUILD = { "allRenderFn": false, "cmpDidLoad": false, "cmpShouldUpdate": false, "cmpDidUnload": false, "cmpDidUpdate": false, "cmpDidRender": true, "cmpWillLoad": false, "cmpWillUpdate": false, "cmpWillRender": false, "connectedCallback": true, "disconnectedCallback": false, "element": false, "event": false, "hasRenderFn": true, "lifecycle": true, "asyncLoading": true, "hostListener": true, "hostListenerTargetWindow": true, "hostListenerTargetDocument": false, "hostListenerTargetBody": false, "hostListenerTargetParent": false, "hostListenerTarget": true, "member": true, "method": false, "mode": false, "noVdomRender": false, "observeAttribute": true, "prop": true, "propBoolean": true, "propNumber": false, "propString": true, "propMutable": false, "reflect": true, "scoped": true, "shadowDom": false, "slot": true, "slotRelocation": true, "state": true, "style": true, "svg": true, "updatable": true, "vdomAttribute": true, "vdomXlink": false, "vdomClass": true, "vdomFunctional": false, "vdomKey": false, "vdomListener": true, "vdomRef": false, "vdomRender": true, "vdomStyle": true, "vdomText": true, "watchCallback": true, "taskQueue": true, "lazyLoad": true, "hydrateServerSide": false, "cssVarShim": true, "initializeNextTick": true, "hydrateClientSide": false, "isDebug": false, "isDev": false, "devTools": false, "lifecycleDOMEvents": false, "profile": false, "hotModuleReplacement": false, "constructableCSS": true, "cssAnnotations": true };
|
58 | var NAMESPACE = 'anjuna-docs';
|
59 | var queueCongestion = 0;
|
60 | var queuePending = false;
|
61 | var scopeId;
|
62 | var contentRef;
|
63 | var hostTagName;
|
64 | var useNativeShadowDom = false;
|
65 | var checkSlotFallbackVisibility = false;
|
66 | var checkSlotRelocate = false;
|
67 | var isSvgMode = false;
|
68 | var win = window;
|
69 | var doc = document;
|
70 | var plt = {
|
71 | $flags$: 0,
|
72 | $resourcesUrl$: '',
|
73 | jmp: function (h) { return h(); },
|
74 | raf: function (h) { return requestAnimationFrame(h); },
|
75 | ael: function (el, eventName, listener, opts) { return el.addEventListener(eventName, listener, opts); },
|
76 | rel: function (el, eventName, listener, opts) { return el.removeEventListener(eventName, listener, opts); },
|
77 | };
|
78 | var supportsShadowDom = false;
|
79 | var supportsListenerOptions = (function () {
|
80 | var supportsListenerOptions = false;
|
81 | try {
|
82 | doc.addEventListener('e', null, Object.defineProperty({}, 'passive', {
|
83 | get: function () { supportsListenerOptions = true; }
|
84 | }));
|
85 | }
|
86 | catch (e) { }
|
87 | return supportsListenerOptions;
|
88 | })();
|
89 | var supportsConstructibleStylesheets = (function () {
|
90 | try {
|
91 | new CSSStyleSheet();
|
92 | return true;
|
93 | }
|
94 | catch (e) { }
|
95 | return false;
|
96 | })();
|
97 | var hostRefs = new WeakMap();
|
98 | var getHostRef = function (ref) { return hostRefs.get(ref); };
|
99 | var registerInstance = function (lazyInstance, hostRef) { return hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef); };
|
100 | var registerHost = function (elm) {
|
101 | var hostRef = {
|
102 | $flags$: 0,
|
103 | $hostElement$: elm,
|
104 | $instanceValues$: new Map()
|
105 | };
|
106 | {
|
107 | hostRef.$onReadyPromise$ = new Promise(function (r) { return hostRef.$onReadyResolve$ = r; });
|
108 | elm['s-p'] = [];
|
109 | elm['s-rc'] = [];
|
110 | }
|
111 | return hostRefs.set(elm, hostRef);
|
112 | };
|
113 | var isMemberInElement = function (elm, memberName) { return memberName in elm; };
|
114 | var consoleError = function (e) { return console.error(e); };
|
115 | var moduleCache = new Map();
|
116 | var loadModule = function (cmpMeta, hostRef, hmrVersionId) {
|
117 |
|
118 | var exportName = cmpMeta.$tagName$.replace(/-/g, '_');
|
119 | var bundleId = (cmpMeta.$lazyBundleIds$);
|
120 | var module = moduleCache.get(bundleId);
|
121 | if (module) {
|
122 | return module[exportName];
|
123 | }
|
124 | return import(
|
125 |
|
126 |
|
127 |
|
128 | "./" + bundleId + ".entry.js" + '').then(function (importedModule) {
|
129 | {
|
130 | moduleCache.set(bundleId, importedModule);
|
131 | }
|
132 | return importedModule[exportName];
|
133 | }, consoleError);
|
134 | };
|
135 | var styles = new Map();
|
136 | var queueDomReads = [];
|
137 | var queueDomWrites = [];
|
138 | var queueDomWritesLow = [];
|
139 | var queueTask = function (queue, write) { return function (cb) {
|
140 | queue.push(cb);
|
141 | if (!queuePending) {
|
142 | queuePending = true;
|
143 | if (write && plt.$flags$ & 4 ) {
|
144 | nextTick(flush);
|
145 | }
|
146 | else {
|
147 | plt.raf(flush);
|
148 | }
|
149 | }
|
150 | }; };
|
151 | var consume = function (queue) {
|
152 | for (var i = 0; i < queue.length; i++) {
|
153 | try {
|
154 | queue[i](performance.now());
|
155 | }
|
156 | catch (e) {
|
157 | consoleError(e);
|
158 | }
|
159 | }
|
160 | queue.length = 0;
|
161 | };
|
162 | var consumeTimeout = function (queue, timeout) {
|
163 | var i = 0;
|
164 | var ts = 0;
|
165 | while (i < queue.length && (ts = performance.now()) < timeout) {
|
166 | try {
|
167 | queue[i++](ts);
|
168 | }
|
169 | catch (e) {
|
170 | consoleError(e);
|
171 | }
|
172 | }
|
173 | if (i === queue.length) {
|
174 | queue.length = 0;
|
175 | }
|
176 | else if (i !== 0) {
|
177 | queue.splice(0, i);
|
178 | }
|
179 | };
|
180 | var flush = function () {
|
181 | queueCongestion++;
|
182 |
|
183 |
|
184 |
|
185 | consume(queueDomReads);
|
186 | var timeout = (plt.$flags$ & 6 ) === 2
|
187 | ? performance.now() + (10 * Math.ceil(queueCongestion * (1.0 / 22.0)))
|
188 | : Infinity;
|
189 |
|
190 | consumeTimeout(queueDomWrites, timeout);
|
191 | consumeTimeout(queueDomWritesLow, timeout);
|
192 | if (queueDomWrites.length > 0) {
|
193 | queueDomWritesLow.push.apply(queueDomWritesLow, queueDomWrites);
|
194 | queueDomWrites.length = 0;
|
195 | }
|
196 | if (queuePending = ((queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length) > 0)) {
|
197 |
|
198 |
|
199 | plt.raf(flush);
|
200 | }
|
201 | else {
|
202 | queueCongestion = 0;
|
203 | }
|
204 | };
|
205 | var nextTick = function (cb) { return Promise.resolve().then(cb); };
|
206 | var writeTask = queueTask(queueDomWrites, true);
|
207 |
|
208 |
|
209 |
|
210 |
|
211 |
|
212 |
|
213 |
|
214 | var EMPTY_OBJ = {};
|
215 |
|
216 |
|
217 |
|
218 | var SVG_NS = 'http://www.w3.org/2000/svg';
|
219 | var HTML_NS = 'http://www.w3.org/1999/xhtml';
|
220 | var isDef = function (v) { return v != null; };
|
221 | var isComplexType = function (o) {
|
222 |
|
223 | o = typeof o;
|
224 | return o === 'object' || o === 'function';
|
225 | };
|
226 | var getDynamicImportFunction = function (namespace) {
|
227 | return "__sc_import_" + namespace.replace(/\s|-/g, '_');
|
228 | };
|
229 | var patchEsm = function () {
|
230 |
|
231 | if (!(win.CSS && win.CSS.supports && win.CSS.supports('color', 'var(--c)'))) {
|
232 |
|
233 | return import('./css-shim-978387b1-1e75855f.js').then(function () {
|
234 | plt.$cssShim$ = win.__stencil_cssshim;
|
235 | if (plt.$cssShim$) {
|
236 | return plt.$cssShim$.initShim();
|
237 | }
|
238 | });
|
239 | }
|
240 | return Promise.resolve();
|
241 | };
|
242 | var patchBrowser = function () { return __awaiter(void 0, void 0, void 0, function () {
|
243 | var importMeta, regex, scriptElm, opts, resourcesUrl;
|
244 | return __generator(this, function (_a) {
|
245 | switch (_a.label) {
|
246 | case 0:
|
247 | {
|
248 | plt.$cssShim$ = win.__stencil_cssshim;
|
249 | }
|
250 | importMeta = "";
|
251 | regex = new RegExp("/" + NAMESPACE + "(\\.esm)?\\.js($|\\?|#)");
|
252 | scriptElm = Array.from(doc.querySelectorAll('script')).find(function (s) { return (regex.test(s.src) ||
|
253 | s.getAttribute('data-stencil-namespace') === NAMESPACE); });
|
254 | opts = scriptElm['data-opts'];
|
255 | if (!(importMeta !== '')) return [3 , 1];
|
256 | return [2 , Object.assign(Object.assign({}, opts), { resourcesUrl: new URL('.', importMeta).href })];
|
257 | case 1:
|
258 | resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href));
|
259 | patchDynamicImport(resourcesUrl.href);
|
260 | if (!!window.customElements) return [3 , 3];
|
261 |
|
262 | return [4 , import('./dom-96781eef-a2fb04dd.js')];
|
263 | case 2:
|
264 |
|
265 | _a.sent();
|
266 | _a.label = 3;
|
267 | case 3: return [2 , Object.assign(Object.assign({}, opts), { resourcesUrl: resourcesUrl.href })];
|
268 | }
|
269 | });
|
270 | }); };
|
271 | var patchDynamicImport = function (base) {
|
272 | var importFunctionName = getDynamicImportFunction(NAMESPACE);
|
273 | try {
|
274 |
|
275 |
|
276 |
|
277 | win[importFunctionName] = new Function('w', "return import(w);//" + Math.random());
|
278 | }
|
279 | catch (e) {
|
280 | var moduleMap_1 = new Map();
|
281 | win[importFunctionName] = function (src) {
|
282 | var url = new URL(src, base).href;
|
283 | var mod = moduleMap_1.get(url);
|
284 | if (!mod) {
|
285 | var script_1 = doc.createElement('script');
|
286 | script_1.type = 'module';
|
287 | script_1.src = URL.createObjectURL(new Blob(["import * as m from '" + url + "'; window." + importFunctionName + ".m = m;"], { type: 'application/javascript' }));
|
288 | mod = new Promise(function (resolve) {
|
289 | script_1.onload = function () {
|
290 | resolve(win[importFunctionName].m);
|
291 | script_1.remove();
|
292 | };
|
293 | });
|
294 | moduleMap_1.set(url, mod);
|
295 | doc.head.appendChild(script_1);
|
296 | }
|
297 | return mod;
|
298 | };
|
299 | }
|
300 | };
|
301 | var parsePropertyValue = function (propValue, propType) {
|
302 |
|
303 | if (propValue != null && !isComplexType(propValue)) {
|
304 | if (propType & 4 ) {
|
305 |
|
306 |
|
307 | return (propValue === 'false' ? false : propValue === '' || !!propValue);
|
308 | }
|
309 | if (propType & 1 ) {
|
310 |
|
311 |
|
312 | return String(propValue);
|
313 | }
|
314 |
|
315 | return propValue;
|
316 | }
|
317 |
|
318 |
|
319 | return propValue;
|
320 | };
|
321 | var HYDRATED_CLASS = 'hydrated';
|
322 | var createTime = function (fnName, tagName) {
|
323 | if (tagName === void 0) { tagName = ''; }
|
324 | {
|
325 | return function () { return; };
|
326 | }
|
327 | };
|
328 | var uniqueTime = function (key, measureText) {
|
329 | {
|
330 | return function () { return; };
|
331 | }
|
332 | };
|
333 | var rootAppliedStyles = new WeakMap();
|
334 | var registerStyle = function (scopeId, cssText, allowCS) {
|
335 | var style = styles.get(scopeId);
|
336 | if (supportsConstructibleStylesheets && allowCS) {
|
337 | style = (style || new CSSStyleSheet());
|
338 | style.replace(cssText);
|
339 | }
|
340 | else {
|
341 | style = cssText;
|
342 | }
|
343 | styles.set(scopeId, style);
|
344 | };
|
345 | var addStyle = function (styleContainerNode, cmpMeta, mode, hostElm) {
|
346 | var scopeId = getScopeId(cmpMeta.$tagName$);
|
347 | var style = styles.get(scopeId);
|
348 |
|
349 |
|
350 | styleContainerNode = (styleContainerNode.nodeType === 11 ? styleContainerNode : doc);
|
351 | if (style) {
|
352 | if (typeof style === 'string') {
|
353 | styleContainerNode = styleContainerNode.head || styleContainerNode;
|
354 | var appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
355 | var styleElm = void 0;
|
356 | if (!appliedStyles) {
|
357 | rootAppliedStyles.set(styleContainerNode, appliedStyles = new Set());
|
358 | }
|
359 | if (!appliedStyles.has(scopeId)) {
|
360 | {
|
361 | if (plt.$cssShim$) {
|
362 | styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style, !!(cmpMeta.$flags$ & 10 ));
|
363 | var newScopeId = styleElm['s-sc'];
|
364 | if (newScopeId) {
|
365 | scopeId = newScopeId;
|
366 |
|
367 |
|
368 |
|
369 | appliedStyles = null;
|
370 | }
|
371 | }
|
372 | else {
|
373 | styleElm = doc.createElement('style');
|
374 | styleElm.innerHTML = style;
|
375 | }
|
376 | styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
377 | }
|
378 | if (appliedStyles) {
|
379 | appliedStyles.add(scopeId);
|
380 | }
|
381 | }
|
382 | }
|
383 | else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
384 | styleContainerNode.adoptedStyleSheets = __spreadArrays(styleContainerNode.adoptedStyleSheets, [
|
385 | style
|
386 | ]);
|
387 | }
|
388 | }
|
389 | return scopeId;
|
390 | };
|
391 | var attachStyles = function (elm, cmpMeta, mode) {
|
392 | var endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
393 | var scopeId = addStyle(elm.getRootNode(), cmpMeta, mode, elm);
|
394 | if (cmpMeta.$flags$ & 10 ) {
|
395 |
|
396 |
|
397 |
|
398 |
|
399 |
|
400 |
|
401 |
|
402 | elm['s-sc'] = scopeId;
|
403 | elm.classList.add(scopeId + '-h');
|
404 | if (cmpMeta.$flags$ & 2 ) {
|
405 | elm.classList.add(scopeId + '-s');
|
406 | }
|
407 | }
|
408 | endAttachStyles();
|
409 | };
|
410 | var getScopeId = function (tagName, mode) { return 'sc-' + (tagName); };
|
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 |
|
418 |
|
419 |
|
420 |
|
421 |
|
422 | var h = function (nodeName, vnodeData) {
|
423 | var children = [];
|
424 | for (var _i = 2; _i < arguments.length; _i++) {
|
425 | children[_i - 2] = arguments[_i];
|
426 | }
|
427 | var child = null;
|
428 | var slotName = null;
|
429 | var simple = false;
|
430 | var lastSimple = false;
|
431 | var vNodeChildren = [];
|
432 | var walk = function (c) {
|
433 | for (var i = 0; i < c.length; i++) {
|
434 | child = c[i];
|
435 | if (Array.isArray(child)) {
|
436 | walk(child);
|
437 | }
|
438 | else if (child != null && typeof child !== 'boolean') {
|
439 | if (simple = typeof nodeName !== 'function' && !isComplexType(child)) {
|
440 | child = String(child);
|
441 | }
|
442 | if (simple && lastSimple) {
|
443 |
|
444 | vNodeChildren[vNodeChildren.length - 1].$text$ += child;
|
445 | }
|
446 | else {
|
447 |
|
448 | vNodeChildren.push(simple ? newVNode(null, child) : child);
|
449 | }
|
450 | lastSimple = simple;
|
451 | }
|
452 | }
|
453 | };
|
454 | walk(children);
|
455 | if (vnodeData) {
|
456 | if (vnodeData.name) {
|
457 | slotName = vnodeData.name;
|
458 | }
|
459 | {
|
460 | var classData_1 = vnodeData.className || vnodeData.class;
|
461 | if (classData_1) {
|
462 | vnodeData.class = typeof classData_1 !== 'object'
|
463 | ? classData_1
|
464 | : Object.keys(classData_1)
|
465 | .filter(function (k) { return classData_1[k]; })
|
466 | .join(' ');
|
467 | }
|
468 | }
|
469 | }
|
470 | var vnode = newVNode(nodeName, null);
|
471 | vnode.$attrs$ = vnodeData;
|
472 | if (vNodeChildren.length > 0) {
|
473 | vnode.$children$ = vNodeChildren;
|
474 | }
|
475 | {
|
476 | vnode.$name$ = slotName;
|
477 | }
|
478 | return vnode;
|
479 | };
|
480 | var newVNode = function (tag, text) {
|
481 | var vnode = {
|
482 | $flags$: 0,
|
483 | $tag$: tag,
|
484 | $text$: text,
|
485 | $elm$: null,
|
486 | $children$: null
|
487 | };
|
488 | {
|
489 | vnode.$attrs$ = null;
|
490 | }
|
491 | {
|
492 | vnode.$name$ = null;
|
493 | }
|
494 | return vnode;
|
495 | };
|
496 | var Host = {};
|
497 | var isHost = function (node) { return node && node.$tag$ === Host; };
|
498 |
|
499 |
|
500 |
|
501 |
|
502 |
|
503 |
|
504 |
|
505 |
|
506 | var setAccessor = function (elm, memberName, oldValue, newValue, isSvg, flags) {
|
507 | if (oldValue === newValue) {
|
508 | return;
|
509 | }
|
510 | var isProp = isMemberInElement(elm, memberName);
|
511 | var ln = memberName.toLowerCase();
|
512 | if (memberName === 'class') {
|
513 | var classList = elm.classList;
|
514 | var oldClasses_1 = parseClassList(oldValue);
|
515 | var newClasses_1 = parseClassList(newValue);
|
516 | classList.remove.apply(classList, oldClasses_1.filter(function (c) { return c && !newClasses_1.includes(c); }));
|
517 | classList.add.apply(classList, newClasses_1.filter(function (c) { return c && !oldClasses_1.includes(c); }));
|
518 | }
|
519 | else if (memberName === 'style') {
|
520 |
|
521 | {
|
522 | for (var prop in oldValue) {
|
523 | if (!newValue || newValue[prop] == null) {
|
524 | if (prop.includes('-')) {
|
525 | elm.style.removeProperty(prop);
|
526 | }
|
527 | else {
|
528 | elm.style[prop] = '';
|
529 | }
|
530 | }
|
531 | }
|
532 | }
|
533 | for (var prop in newValue) {
|
534 | if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
535 | if (prop.includes('-')) {
|
536 | elm.style.setProperty(prop, newValue[prop]);
|
537 | }
|
538 | else {
|
539 | elm.style[prop] = newValue[prop];
|
540 | }
|
541 | }
|
542 | }
|
543 | }
|
544 | else if (!isProp && memberName[0] === 'o' && memberName[1] === 'n') {
|
545 |
|
546 |
|
547 |
|
548 |
|
549 | if (memberName[2] === '-') {
|
550 |
|
551 |
|
552 |
|
553 |
|
554 |
|
555 |
|
556 |
|
557 | memberName = memberName.slice(3);
|
558 | }
|
559 | else if (isMemberInElement(win, ln)) {
|
560 |
|
561 |
|
562 |
|
563 |
|
564 | memberName = ln.slice(2);
|
565 | }
|
566 | else {
|
567 |
|
568 |
|
569 |
|
570 |
|
571 |
|
572 | memberName = ln[2] + memberName.slice(3);
|
573 | }
|
574 | if (oldValue) {
|
575 | plt.rel(elm, memberName, oldValue, false);
|
576 | }
|
577 | if (newValue) {
|
578 | plt.ael(elm, memberName, newValue, false);
|
579 | }
|
580 | }
|
581 | else {
|
582 |
|
583 | var isComplex = isComplexType(newValue);
|
584 | if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
|
585 | try {
|
586 | if (!elm.tagName.includes('-')) {
|
587 | var n = newValue == null ? '' : newValue;
|
588 |
|
589 | if (memberName === 'list') {
|
590 | isProp = false;
|
591 |
|
592 | }
|
593 | else if (oldValue == null || elm[memberName] != n) {
|
594 | elm[memberName] = n;
|
595 | }
|
596 | }
|
597 | else {
|
598 | elm[memberName] = newValue;
|
599 | }
|
600 | }
|
601 | catch (e) { }
|
602 | }
|
603 | if (newValue == null || newValue === false) {
|
604 | {
|
605 | elm.removeAttribute(memberName);
|
606 | }
|
607 | }
|
608 | else if ((!isProp || (flags & 4 ) || isSvg) && !isComplex) {
|
609 | newValue = newValue === true ? '' : newValue;
|
610 | {
|
611 | elm.setAttribute(memberName, newValue);
|
612 | }
|
613 | }
|
614 | }
|
615 | };
|
616 | var parseClassListRegex = /\s/;
|
617 | var parseClassList = function (value) { return (!value) ? [] : value.split(parseClassListRegex); };
|
618 | var updateElement = function (oldVnode, newVnode, isSvgMode, memberName) {
|
619 |
|
620 |
|
621 |
|
622 | var elm = (newVnode.$elm$.nodeType === 11 && newVnode.$elm$.host) ? newVnode.$elm$.host : newVnode.$elm$;
|
623 | var oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
624 | var newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
|
625 | {
|
626 |
|
627 | for (memberName in oldVnodeAttrs) {
|
628 | if (!(memberName in newVnodeAttrs)) {
|
629 | setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
|
630 | }
|
631 | }
|
632 | }
|
633 |
|
634 | for (memberName in newVnodeAttrs) {
|
635 | setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
636 | }
|
637 | };
|
638 | var createElm = function (oldParentVNode, newParentVNode, childIndex, parentElm) {
|
639 |
|
640 | var newVNode = newParentVNode.$children$[childIndex];
|
641 | var i = 0;
|
642 | var elm;
|
643 | var childNode;
|
644 | var oldVNode;
|
645 | if (!useNativeShadowDom) {
|
646 |
|
647 | checkSlotRelocate = true;
|
648 | if (newVNode.$tag$ === 'slot') {
|
649 | if (scopeId) {
|
650 |
|
651 | parentElm.classList.add(scopeId + '-s');
|
652 | }
|
653 | newVNode.$flags$ |= (newVNode.$children$)
|
654 |
|
655 |
|
656 | ? 2
|
657 |
|
658 |
|
659 |
|
660 | : 1 ;
|
661 | }
|
662 | }
|
663 | if (newVNode.$text$ !== null) {
|
664 |
|
665 | elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
666 | }
|
667 | else if (newVNode.$flags$ & 1 ) {
|
668 |
|
669 | elm = newVNode.$elm$ = doc.createTextNode('');
|
670 | }
|
671 | else {
|
672 | if (!isSvgMode) {
|
673 | isSvgMode = newVNode.$tag$ === 'svg';
|
674 | }
|
675 |
|
676 | elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, (newVNode.$flags$ & 2 ) ? 'slot-fb' : newVNode.$tag$));
|
677 | if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
|
678 | isSvgMode = false;
|
679 | }
|
680 |
|
681 | {
|
682 | updateElement(null, newVNode, isSvgMode);
|
683 | }
|
684 | if (isDef(scopeId) && elm['s-si'] !== scopeId) {
|
685 |
|
686 |
|
687 | elm.classList.add((elm['s-si'] = scopeId));
|
688 | }
|
689 | if (newVNode.$children$) {
|
690 | for (i = 0; i < newVNode.$children$.length; ++i) {
|
691 |
|
692 | childNode = createElm(oldParentVNode, newVNode, i, elm);
|
693 |
|
694 | if (childNode) {
|
695 |
|
696 | elm.appendChild(childNode);
|
697 | }
|
698 | }
|
699 | }
|
700 | {
|
701 | if (newVNode.$tag$ === 'svg') {
|
702 |
|
703 | isSvgMode = false;
|
704 | }
|
705 | else if (elm.tagName === 'foreignObject') {
|
706 |
|
707 | isSvgMode = true;
|
708 | }
|
709 | }
|
710 | }
|
711 | {
|
712 | elm['s-hn'] = hostTagName;
|
713 | if (newVNode.$flags$ & (2 | 1 )) {
|
714 |
|
715 | elm['s-sr'] = true;
|
716 |
|
717 | elm['s-cr'] = contentRef;
|
718 |
|
719 | elm['s-sn'] = newVNode.$name$ || '';
|
720 |
|
721 | oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
722 | if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
|
723 |
|
724 |
|
725 | putBackInOriginalLocation(oldParentVNode.$elm$, false);
|
726 | }
|
727 | }
|
728 | }
|
729 | return elm;
|
730 | };
|
731 | var putBackInOriginalLocation = function (parentElm, recursive) {
|
732 | plt.$flags$ |= 1 ;
|
733 | var oldSlotChildNodes = parentElm.childNodes;
|
734 | for (var i = oldSlotChildNodes.length - 1; i >= 0; i--) {
|
735 | var childNode = oldSlotChildNodes[i];
|
736 | if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
|
737 |
|
738 |
|
739 |
|
740 |
|
741 | parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
|
742 |
|
743 |
|
744 |
|
745 | childNode['s-ol'].remove();
|
746 | childNode['s-ol'] = undefined;
|
747 | checkSlotRelocate = true;
|
748 | }
|
749 | if (recursive) {
|
750 | putBackInOriginalLocation(childNode, recursive);
|
751 | }
|
752 | }
|
753 | plt.$flags$ &= ~1 ;
|
754 | };
|
755 | var addVnodes = function (parentElm, before, parentVNode, vnodes, startIdx, endIdx) {
|
756 | var containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
757 | var childNode;
|
758 | for (; startIdx <= endIdx; ++startIdx) {
|
759 | if (vnodes[startIdx]) {
|
760 | childNode = createElm(null, parentVNode, startIdx, parentElm);
|
761 | if (childNode) {
|
762 | vnodes[startIdx].$elm$ = childNode;
|
763 | containerElm.insertBefore(childNode, referenceNode(before));
|
764 | }
|
765 | }
|
766 | }
|
767 | };
|
768 | var removeVnodes = function (vnodes, startIdx, endIdx, vnode, elm) {
|
769 | for (; startIdx <= endIdx; ++startIdx) {
|
770 | if (vnode = vnodes[startIdx]) {
|
771 | elm = vnode.$elm$;
|
772 | {
|
773 |
|
774 |
|
775 | checkSlotFallbackVisibility = true;
|
776 | if (elm['s-ol']) {
|
777 |
|
778 | elm['s-ol'].remove();
|
779 | }
|
780 | else {
|
781 |
|
782 |
|
783 | putBackInOriginalLocation(elm, true);
|
784 | }
|
785 | }
|
786 |
|
787 | elm.remove();
|
788 | }
|
789 | }
|
790 | };
|
791 | var updateChildren = function (parentElm, oldCh, newVNode, newCh) {
|
792 | var oldStartIdx = 0;
|
793 | var newStartIdx = 0;
|
794 | var oldEndIdx = oldCh.length - 1;
|
795 | var oldStartVnode = oldCh[0];
|
796 | var oldEndVnode = oldCh[oldEndIdx];
|
797 | var newEndIdx = newCh.length - 1;
|
798 | var newStartVnode = newCh[0];
|
799 | var newEndVnode = newCh[newEndIdx];
|
800 | var node;
|
801 | while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
802 | if (oldStartVnode == null) {
|
803 |
|
804 | oldStartVnode = oldCh[++oldStartIdx];
|
805 | }
|
806 | else if (oldEndVnode == null) {
|
807 | oldEndVnode = oldCh[--oldEndIdx];
|
808 | }
|
809 | else if (newStartVnode == null) {
|
810 | newStartVnode = newCh[++newStartIdx];
|
811 | }
|
812 | else if (newEndVnode == null) {
|
813 | newEndVnode = newCh[--newEndIdx];
|
814 | }
|
815 | else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
816 | patch(oldStartVnode, newStartVnode);
|
817 | oldStartVnode = oldCh[++oldStartIdx];
|
818 | newStartVnode = newCh[++newStartIdx];
|
819 | }
|
820 | else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
821 | patch(oldEndVnode, newEndVnode);
|
822 | oldEndVnode = oldCh[--oldEndIdx];
|
823 | newEndVnode = newCh[--newEndIdx];
|
824 | }
|
825 | else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
826 |
|
827 | if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
828 | putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
829 | }
|
830 | patch(oldStartVnode, newEndVnode);
|
831 | parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
832 | oldStartVnode = oldCh[++oldStartIdx];
|
833 | newEndVnode = newCh[--newEndIdx];
|
834 | }
|
835 | else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
836 |
|
837 | if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
838 | putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
839 | }
|
840 | patch(oldEndVnode, newStartVnode);
|
841 | parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
842 | oldEndVnode = oldCh[--oldEndIdx];
|
843 | newStartVnode = newCh[++newStartIdx];
|
844 | }
|
845 | else {
|
846 | {
|
847 |
|
848 | node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
|
849 | newStartVnode = newCh[++newStartIdx];
|
850 | }
|
851 | if (node) {
|
852 | {
|
853 | parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
|
854 | }
|
855 | }
|
856 | }
|
857 | }
|
858 | if (oldStartIdx > oldEndIdx) {
|
859 | addVnodes(parentElm, (newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$), newVNode, newCh, newStartIdx, newEndIdx);
|
860 | }
|
861 | else if (newStartIdx > newEndIdx) {
|
862 | removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
863 | }
|
864 | };
|
865 | var isSameVnode = function (vnode1, vnode2) {
|
866 |
|
867 |
|
868 | if (vnode1.$tag$ === vnode2.$tag$) {
|
869 | if (vnode1.$tag$ === 'slot') {
|
870 | return vnode1.$name$ === vnode2.$name$;
|
871 | }
|
872 | return true;
|
873 | }
|
874 | return false;
|
875 | };
|
876 | var referenceNode = function (node) {
|
877 |
|
878 |
|
879 |
|
880 |
|
881 | return (node && node['s-ol']) || node;
|
882 | };
|
883 | var parentReferenceNode = function (node) { return (node['s-ol'] ? node['s-ol'] : node).parentNode; };
|
884 | var patch = function (oldVNode, newVNode) {
|
885 | var elm = newVNode.$elm$ = oldVNode.$elm$;
|
886 | var oldChildren = oldVNode.$children$;
|
887 | var newChildren = newVNode.$children$;
|
888 | var defaultHolder;
|
889 | {
|
890 |
|
891 |
|
892 | isSvgMode = elm && elm.parentNode &&
|
893 | elm.ownerSVGElement !== undefined;
|
894 | isSvgMode = newVNode.$tag$ === 'svg' ? true : (newVNode.$tag$ === 'foreignObject' ? false : isSvgMode);
|
895 | }
|
896 | if (newVNode.$text$ === null) {
|
897 |
|
898 | {
|
899 | if (newVNode.$tag$ === 'slot')
|
900 | ;
|
901 | else {
|
902 |
|
903 |
|
904 |
|
905 | updateElement(oldVNode, newVNode, isSvgMode);
|
906 | }
|
907 | }
|
908 | if (oldChildren !== null && newChildren !== null) {
|
909 |
|
910 | updateChildren(elm, oldChildren, newVNode, newChildren);
|
911 | }
|
912 | else if (newChildren !== null) {
|
913 |
|
914 | if (oldVNode.$text$ !== null) {
|
915 |
|
916 | elm.textContent = '';
|
917 | }
|
918 |
|
919 | addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
|
920 | }
|
921 | else if (oldChildren !== null) {
|
922 |
|
923 | removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
924 | }
|
925 | }
|
926 | else if ((defaultHolder = elm['s-cr'])) {
|
927 |
|
928 | defaultHolder.parentNode.textContent = newVNode.$text$;
|
929 | }
|
930 | else if (oldVNode.$text$ !== newVNode.$text$) {
|
931 |
|
932 |
|
933 | elm.data = newVNode.$text$;
|
934 | }
|
935 | if (isSvgMode && newVNode.$tag$ === 'svg') {
|
936 | isSvgMode = false;
|
937 | }
|
938 | };
|
939 | var updateFallbackSlotVisibility = function (elm) {
|
940 |
|
941 | var childNodes = elm.childNodes;
|
942 | var childNode;
|
943 | var i;
|
944 | var ilen;
|
945 | var j;
|
946 | var slotNameAttr;
|
947 | var nodeType;
|
948 | for (i = 0, ilen = childNodes.length; i < ilen; i++) {
|
949 | childNode = childNodes[i];
|
950 | if (childNode.nodeType === 1 ) {
|
951 | if (childNode['s-sr']) {
|
952 |
|
953 |
|
954 | slotNameAttr = childNode['s-sn'];
|
955 |
|
956 |
|
957 | childNode.hidden = false;
|
958 | for (j = 0; j < ilen; j++) {
|
959 | if (childNodes[j]['s-hn'] !== childNode['s-hn']) {
|
960 |
|
961 | nodeType = childNodes[j].nodeType;
|
962 | if (slotNameAttr !== '') {
|
963 |
|
964 | if (nodeType === 1 && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
965 | childNode.hidden = true;
|
966 | break;
|
967 | }
|
968 | }
|
969 | else {
|
970 |
|
971 |
|
972 |
|
973 | if (nodeType === 1 || (nodeType === 3 && childNodes[j].textContent.trim() !== '')) {
|
974 | childNode.hidden = true;
|
975 | break;
|
976 | }
|
977 | }
|
978 | }
|
979 | }
|
980 | }
|
981 |
|
982 | updateFallbackSlotVisibility(childNode);
|
983 | }
|
984 | }
|
985 | };
|
986 | var relocateNodes = [];
|
987 | var relocateSlotContent = function (elm) {
|
988 |
|
989 | var childNodes = elm.childNodes;
|
990 | var ilen = childNodes.length;
|
991 | var i = 0;
|
992 | var j = 0;
|
993 | var nodeType = 0;
|
994 | var childNode;
|
995 | var node;
|
996 | var hostContentNodes;
|
997 | var slotNameAttr;
|
998 | for (ilen = childNodes.length; i < ilen; i++) {
|
999 | childNode = childNodes[i];
|
1000 | if (childNode['s-sr'] && (node = childNode['s-cr'])) {
|
1001 |
|
1002 |
|
1003 | hostContentNodes = node.parentNode.childNodes;
|
1004 | slotNameAttr = childNode['s-sn'];
|
1005 | for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
1006 | node = hostContentNodes[j];
|
1007 | if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
|
1008 |
|
1009 |
|
1010 |
|
1011 | nodeType = node.nodeType;
|
1012 | if (((nodeType === 3 || nodeType === 8 ) && slotNameAttr === '') ||
|
1013 | (nodeType === 1 && node.getAttribute('slot') === null && slotNameAttr === '') ||
|
1014 | (nodeType === 1 && node.getAttribute('slot') === slotNameAttr)) {
|
1015 |
|
1016 | if (!relocateNodes.some(function (r) { return r.$nodeToRelocate$ === node; })) {
|
1017 |
|
1018 |
|
1019 |
|
1020 | checkSlotFallbackVisibility = true;
|
1021 | node['s-sn'] = slotNameAttr;
|
1022 |
|
1023 | relocateNodes.push({
|
1024 | $slotRefNode$: childNode,
|
1025 | $nodeToRelocate$: node
|
1026 | });
|
1027 | }
|
1028 | }
|
1029 | }
|
1030 | }
|
1031 | }
|
1032 | if (childNode.nodeType === 1 ) {
|
1033 | relocateSlotContent(childNode);
|
1034 | }
|
1035 | }
|
1036 | };
|
1037 | var renderVdom = function (hostElm, hostRef, cmpMeta, renderFnResults) {
|
1038 | hostTagName = hostElm.tagName;
|
1039 | var oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
1040 | var rootVnode = isHost(renderFnResults)
|
1041 | ? renderFnResults
|
1042 | : h(null, null, renderFnResults);
|
1043 | if (cmpMeta.$attrsToReflect$) {
|
1044 | rootVnode.$attrs$ = rootVnode.$attrs$ || {};
|
1045 | cmpMeta.$attrsToReflect$.forEach(function (_a) {
|
1046 | var propName = _a[0], attribute = _a[1];
|
1047 | return rootVnode.$attrs$[attribute] = hostElm[propName];
|
1048 | });
|
1049 | }
|
1050 | rootVnode.$tag$ = null;
|
1051 | rootVnode.$flags$ |= 4 ;
|
1052 | hostRef.$vnode$ = rootVnode;
|
1053 | rootVnode.$elm$ = oldVNode.$elm$ = (hostElm);
|
1054 | {
|
1055 | scopeId = hostElm['s-sc'];
|
1056 | }
|
1057 | {
|
1058 | contentRef = hostElm['s-cr'];
|
1059 | useNativeShadowDom = supportsShadowDom;
|
1060 |
|
1061 | checkSlotFallbackVisibility = false;
|
1062 | }
|
1063 |
|
1064 | patch(oldVNode, rootVnode);
|
1065 | {
|
1066 | if (checkSlotRelocate) {
|
1067 | relocateSlotContent(rootVnode.$elm$);
|
1068 | for (var i = 0; i < relocateNodes.length; i++) {
|
1069 | var relocateNode = relocateNodes[i];
|
1070 | if (!relocateNode.$nodeToRelocate$['s-ol']) {
|
1071 |
|
1072 |
|
1073 | var orgLocationNode = doc.createTextNode('');
|
1074 | orgLocationNode['s-nr'] = relocateNode.$nodeToRelocate$;
|
1075 | relocateNode.$nodeToRelocate$.parentNode.insertBefore((relocateNode.$nodeToRelocate$['s-ol'] = orgLocationNode), relocateNode.$nodeToRelocate$);
|
1076 | }
|
1077 | }
|
1078 |
|
1079 |
|
1080 | plt.$flags$ |= 1 ;
|
1081 | for (var i = 0; i < relocateNodes.length; i++) {
|
1082 | var relocateNode = relocateNodes[i];
|
1083 |
|
1084 |
|
1085 | var parentNodeRef = relocateNode.$slotRefNode$.parentNode;
|
1086 | var insertBeforeNode = relocateNode.$slotRefNode$.nextSibling;
|
1087 | var orgLocationNode = relocateNode.$nodeToRelocate$['s-ol'];
|
1088 | while (orgLocationNode = orgLocationNode.previousSibling) {
|
1089 | var refNode = orgLocationNode['s-nr'];
|
1090 | if (refNode &&
|
1091 | refNode['s-sn'] === relocateNode.$nodeToRelocate$['s-sn'] &&
|
1092 | parentNodeRef === refNode.parentNode) {
|
1093 | refNode = refNode.nextSibling;
|
1094 | if (!refNode || !refNode['s-nr']) {
|
1095 | insertBeforeNode = refNode;
|
1096 | break;
|
1097 | }
|
1098 | }
|
1099 | }
|
1100 | if ((!insertBeforeNode && parentNodeRef !== relocateNode.$nodeToRelocate$.parentNode) ||
|
1101 | (relocateNode.$nodeToRelocate$.nextSibling !== insertBeforeNode)) {
|
1102 |
|
1103 |
|
1104 |
|
1105 | if (relocateNode.$nodeToRelocate$ !== insertBeforeNode) {
|
1106 |
|
1107 | parentNodeRef.insertBefore(relocateNode.$nodeToRelocate$, insertBeforeNode);
|
1108 | }
|
1109 | }
|
1110 | }
|
1111 |
|
1112 |
|
1113 | plt.$flags$ &= ~1 ;
|
1114 | }
|
1115 | if (checkSlotFallbackVisibility) {
|
1116 | updateFallbackSlotVisibility(rootVnode.$elm$);
|
1117 | }
|
1118 |
|
1119 | relocateNodes.length = 0;
|
1120 | }
|
1121 | };
|
1122 | var attachToAncestor = function (hostRef, ancestorComponent) {
|
1123 | if (ancestorComponent && !hostRef.$onRenderResolve$) {
|
1124 | ancestorComponent['s-p'].push(new Promise(function (r) { return hostRef.$onRenderResolve$ = r; }));
|
1125 | }
|
1126 | };
|
1127 | var scheduleUpdate = function (elm, hostRef, cmpMeta, isInitialLoad) {
|
1128 | {
|
1129 | hostRef.$flags$ |= 16 ;
|
1130 | }
|
1131 | if (hostRef.$flags$ & 4 ) {
|
1132 | hostRef.$flags$ |= 512 ;
|
1133 | return;
|
1134 | }
|
1135 | var endSchedule = createTime('scheduleUpdate', cmpMeta.$tagName$);
|
1136 | var ancestorComponent = hostRef.$ancestorComponent$;
|
1137 | var instance = hostRef.$lazyInstance$;
|
1138 | var update = function () { return updateComponent(elm, hostRef, cmpMeta, instance, isInitialLoad); };
|
1139 | attachToAncestor(hostRef, ancestorComponent);
|
1140 | var promise;
|
1141 | if (isInitialLoad) {
|
1142 | {
|
1143 | hostRef.$flags$ |= 256 ;
|
1144 | if (hostRef.$queuedListeners$) {
|
1145 | hostRef.$queuedListeners$.forEach(function (_a) {
|
1146 | var methodName = _a[0], event = _a[1];
|
1147 | return safeCall(instance, methodName, event);
|
1148 | });
|
1149 | hostRef.$queuedListeners$ = null;
|
1150 | }
|
1151 | }
|
1152 | }
|
1153 | endSchedule();
|
1154 |
|
1155 |
|
1156 |
|
1157 | return then(promise, function () { return writeTask(update); });
|
1158 | };
|
1159 | var updateComponent = function (elm, hostRef, cmpMeta, instance, isInitialLoad) {
|
1160 |
|
1161 | var endUpdate = createTime('update', cmpMeta.$tagName$);
|
1162 | var rc = elm['s-rc'];
|
1163 | if (isInitialLoad) {
|
1164 |
|
1165 | attachStyles(elm, cmpMeta, hostRef.$modeName$);
|
1166 | }
|
1167 | var endRender = createTime('render', cmpMeta.$tagName$);
|
1168 | {
|
1169 | {
|
1170 | try {
|
1171 |
|
1172 |
|
1173 |
|
1174 | renderVdom(elm, hostRef, cmpMeta, (instance.render && instance.render()));
|
1175 | }
|
1176 | catch (e) {
|
1177 | consoleError(e);
|
1178 | }
|
1179 | }
|
1180 | }
|
1181 | if (plt.$cssShim$) {
|
1182 | plt.$cssShim$.updateHost(elm);
|
1183 | }
|
1184 | {
|
1185 | hostRef.$flags$ &= ~16 ;
|
1186 | }
|
1187 | {
|
1188 | hostRef.$flags$ |= 2 ;
|
1189 | }
|
1190 | if (rc) {
|
1191 |
|
1192 |
|
1193 |
|
1194 | rc.forEach(function (cb) { return cb(); });
|
1195 | elm['s-rc'] = undefined;
|
1196 | }
|
1197 | endRender();
|
1198 | endUpdate();
|
1199 | {
|
1200 | var childrenPromises = elm['s-p'];
|
1201 | var postUpdate = function () { return postUpdateComponent(elm, hostRef, cmpMeta); };
|
1202 | if (childrenPromises.length === 0) {
|
1203 | postUpdate();
|
1204 | }
|
1205 | else {
|
1206 | Promise.all(childrenPromises).then(postUpdate);
|
1207 | hostRef.$flags$ |= 4 ;
|
1208 | childrenPromises.length = 0;
|
1209 | }
|
1210 | }
|
1211 | };
|
1212 | var postUpdateComponent = function (elm, hostRef, cmpMeta) {
|
1213 | var endPostUpdate = createTime('postUpdate', cmpMeta.$tagName$);
|
1214 | var instance = hostRef.$lazyInstance$;
|
1215 | var ancestorComponent = hostRef.$ancestorComponent$;
|
1216 | {
|
1217 | safeCall(instance, 'componentDidRender');
|
1218 | }
|
1219 | if (!(hostRef.$flags$ & 64 )) {
|
1220 | hostRef.$flags$ |= 64 ;
|
1221 | {
|
1222 |
|
1223 |
|
1224 | elm.classList.add(HYDRATED_CLASS);
|
1225 | }
|
1226 | endPostUpdate();
|
1227 | {
|
1228 | hostRef.$onReadyResolve$(elm);
|
1229 | if (!ancestorComponent) {
|
1230 | appDidLoad();
|
1231 | }
|
1232 | }
|
1233 | }
|
1234 | else {
|
1235 | endPostUpdate();
|
1236 | }
|
1237 |
|
1238 |
|
1239 | {
|
1240 | if (hostRef.$onRenderResolve$) {
|
1241 | hostRef.$onRenderResolve$();
|
1242 | hostRef.$onRenderResolve$ = undefined;
|
1243 | }
|
1244 | if (hostRef.$flags$ & 512 ) {
|
1245 | nextTick(function () { return scheduleUpdate(elm, hostRef, cmpMeta, false); });
|
1246 | }
|
1247 | hostRef.$flags$ &= ~(4 | 512 );
|
1248 | }
|
1249 |
|
1250 |
|
1251 |
|
1252 | };
|
1253 | var forceUpdate = function (elm, cmpMeta) {
|
1254 | {
|
1255 | var hostRef = getHostRef(elm);
|
1256 | if ((hostRef.$flags$ & (2 | 16 )) === 2 ) {
|
1257 | scheduleUpdate(elm, hostRef, cmpMeta, false);
|
1258 | }
|
1259 | }
|
1260 | };
|
1261 | var appDidLoad = function (who) {
|
1262 |
|
1263 |
|
1264 | {
|
1265 | doc.documentElement.classList.add(HYDRATED_CLASS);
|
1266 | }
|
1267 | {
|
1268 | plt.$flags$ |= 2 ;
|
1269 | }
|
1270 | };
|
1271 | var safeCall = function (instance, method, arg) {
|
1272 | if (instance && instance[method]) {
|
1273 | try {
|
1274 | return instance[method](arg);
|
1275 | }
|
1276 | catch (e) {
|
1277 | consoleError(e);
|
1278 | }
|
1279 | }
|
1280 | return undefined;
|
1281 | };
|
1282 | var then = function (promise, thenFn) {
|
1283 | return promise && promise.then ? promise.then(thenFn) : thenFn();
|
1284 | };
|
1285 | var getValue = function (ref, propName) { return getHostRef(ref).$instanceValues$.get(propName); };
|
1286 | var setValue = function (ref, propName, newVal, cmpMeta) {
|
1287 |
|
1288 | var hostRef = getHostRef(ref);
|
1289 | var elm = hostRef.$hostElement$;
|
1290 | var oldVal = hostRef.$instanceValues$.get(propName);
|
1291 | var flags = hostRef.$flags$;
|
1292 | var instance = hostRef.$lazyInstance$;
|
1293 | newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
1294 | if (newVal !== oldVal && (!(flags & 8 /* isConstructingInstance */) || oldVal === undefined)) {
|
1295 |
|
1296 |
|
1297 | hostRef.$instanceValues$.set(propName, newVal);
|
1298 | if (instance) {
|
1299 |
|
1300 | if (cmpMeta.$watchers$ && flags & 128 ) {
|
1301 | var watchMethods = cmpMeta.$watchers$[propName];
|
1302 | if (watchMethods) {
|
1303 |
|
1304 | watchMethods.forEach(function (watchMethodName) {
|
1305 | try {
|
1306 |
|
1307 | instance[watchMethodName](newVal, oldVal, propName);
|
1308 | }
|
1309 | catch (e) {
|
1310 | consoleError(e);
|
1311 | }
|
1312 | });
|
1313 | }
|
1314 | }
|
1315 | if ((flags & (2 | 16 )) === 2 ) {
|
1316 |
|
1317 |
|
1318 |
|
1319 |
|
1320 | scheduleUpdate(elm, hostRef, cmpMeta, false);
|
1321 | }
|
1322 | }
|
1323 | }
|
1324 | };
|
1325 | var proxyComponent = function (Cstr, cmpMeta, flags) {
|
1326 | if (cmpMeta.$members$) {
|
1327 | if (Cstr.watchers) {
|
1328 | cmpMeta.$watchers$ = Cstr.watchers;
|
1329 | }
|
1330 |
|
1331 | var members = Object.entries(cmpMeta.$members$);
|
1332 | var prototype_1 = Cstr.prototype;
|
1333 | members.forEach(function (_a) {
|
1334 | var memberName = _a[0], memberFlags = _a[1][0];
|
1335 | if (((memberFlags & 31 ) ||
|
1336 | ((flags & 2 ) &&
|
1337 | (memberFlags & 32 )))) {
|
1338 |
|
1339 | Object.defineProperty(prototype_1, memberName, {
|
1340 | get: function () {
|
1341 |
|
1342 | return getValue(this, memberName);
|
1343 | },
|
1344 | set: function (newValue) {
|
1345 |
|
1346 | setValue(this, memberName, newValue, cmpMeta);
|
1347 | },
|
1348 | configurable: true,
|
1349 | enumerable: true
|
1350 | });
|
1351 | }
|
1352 | });
|
1353 | if ((flags & 1 )) {
|
1354 | var attrNameToPropName_1 = new Map();
|
1355 | prototype_1.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
1356 | var _this = this;
|
1357 | plt.jmp(function () {
|
1358 | var propName = attrNameToPropName_1.get(attrName);
|
1359 | _this[propName] = newValue === null && typeof _this[propName] === 'boolean'
|
1360 | ? false
|
1361 | : newValue;
|
1362 | });
|
1363 | };
|
1364 |
|
1365 |
|
1366 | Cstr.observedAttributes = members
|
1367 | .filter(function (_a) {
|
1368 | var _ = _a[0], m = _a[1];
|
1369 | return m[0] & 15;
|
1370 | } )
|
1371 | .map(function (_a) {
|
1372 | var propName = _a[0], m = _a[1];
|
1373 | var attrName = m[1] || propName;
|
1374 | attrNameToPropName_1.set(attrName, propName);
|
1375 | if (m[0] & 512 ) {
|
1376 | cmpMeta.$attrsToReflect$.push([propName, attrName]);
|
1377 | }
|
1378 | return attrName;
|
1379 | });
|
1380 | }
|
1381 | }
|
1382 | return Cstr;
|
1383 | };
|
1384 | var addEventListeners = function (elm, hostRef, listeners) {
|
1385 | hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || [];
|
1386 | var removeFns = listeners.map(function (_a) {
|
1387 | var flags = _a[0], name = _a[1], method = _a[2];
|
1388 | var target = (getHostListenerTarget(elm, flags));
|
1389 | var handler = hostListenerProxy(hostRef, method);
|
1390 | var opts = hostListenerOpts(flags);
|
1391 | plt.ael(target, name, handler, opts);
|
1392 | return function () { return plt.rel(target, name, handler, opts); };
|
1393 | });
|
1394 | return function () { return removeFns.forEach(function (fn) { return fn(); }); };
|
1395 | };
|
1396 | var hostListenerProxy = function (hostRef, methodName) {
|
1397 | return function (ev) {
|
1398 | {
|
1399 | if (hostRef.$flags$ & 256 ) {
|
1400 |
|
1401 | hostRef.$lazyInstance$[methodName](ev);
|
1402 | }
|
1403 | else {
|
1404 | hostRef.$queuedListeners$.push([methodName, ev]);
|
1405 | }
|
1406 | }
|
1407 | };
|
1408 | };
|
1409 | var getHostListenerTarget = function (elm, flags) {
|
1410 | if (flags & 8 )
|
1411 | return win;
|
1412 | return elm;
|
1413 | };
|
1414 | var hostListenerOpts = function (flags) { return supportsListenerOptions ?
|
1415 | {
|
1416 | 'passive': (flags & 1 ) !== 0,
|
1417 | 'capture': (flags & 2 ) !== 0,
|
1418 | }
|
1419 | : (flags & 2 ) !== 0; };
|
1420 | var initializeComponent = function (elm, hostRef, cmpMeta, hmrVersionId, Cstr) { return __awaiter(void 0, void 0, void 0, function () {
|
1421 | var endLoad, endNewInstance, scopeId_1, endRegisterStyles, style, ancestorComponent, schedule;
|
1422 | return __generator(this, function (_a) {
|
1423 | switch (_a.label) {
|
1424 | case 0:
|
1425 | if (!((hostRef.$flags$ & 32 ) === 0)) return [3 , 3];
|
1426 |
|
1427 | hostRef.$flags$ |= 32 ;
|
1428 |
|
1429 |
|
1430 |
|
1431 | Cstr = loadModule(cmpMeta);
|
1432 | if (!Cstr.then) return [3 , 2];
|
1433 | endLoad = uniqueTime();
|
1434 | return [4 , Cstr];
|
1435 | case 1:
|
1436 | Cstr = _a.sent();
|
1437 | endLoad();
|
1438 | _a.label = 2;
|
1439 | case 2:
|
1440 | if (!Cstr.isProxied) {
|
1441 |
|
1442 |
|
1443 |
|
1444 | {
|
1445 | cmpMeta.$watchers$ = Cstr.watchers;
|
1446 | }
|
1447 | proxyComponent(Cstr, cmpMeta, 2 );
|
1448 | Cstr.isProxied = true;
|
1449 | }
|
1450 | endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
|
1451 |
|
1452 |
|
1453 |
|
1454 | {
|
1455 | hostRef.$flags$ |= 8 ;
|
1456 | }
|
1457 |
|
1458 |
|
1459 |
|
1460 |
|
1461 | try {
|
1462 | new Cstr(hostRef);
|
1463 | }
|
1464 | catch (e) {
|
1465 | consoleError(e);
|
1466 | }
|
1467 | {
|
1468 | hostRef.$flags$ &= ~8 ;
|
1469 | }
|
1470 | {
|
1471 | hostRef.$flags$ |= 128 ;
|
1472 | }
|
1473 | endNewInstance();
|
1474 | fireConnectedCallback(hostRef.$lazyInstance$);
|
1475 | scopeId_1 = getScopeId(cmpMeta.$tagName$);
|
1476 | if (!styles.has(scopeId_1) && Cstr.style) {
|
1477 | endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
1478 | style = Cstr.style;
|
1479 | registerStyle(scopeId_1, style, !!(cmpMeta.$flags$ & 1 ));
|
1480 | endRegisterStyles();
|
1481 | }
|
1482 | _a.label = 3;
|
1483 | case 3:
|
1484 | ancestorComponent = hostRef.$ancestorComponent$;
|
1485 | schedule = function () { return scheduleUpdate(elm, hostRef, cmpMeta, true); };
|
1486 | if (ancestorComponent && ancestorComponent['s-rc']) {
|
1487 |
|
1488 |
|
1489 |
|
1490 |
|
1491 |
|
1492 |
|
1493 | ancestorComponent['s-rc'].push(schedule);
|
1494 | }
|
1495 | else {
|
1496 | schedule();
|
1497 | }
|
1498 | return [2 ];
|
1499 | }
|
1500 | });
|
1501 | }); };
|
1502 | var fireConnectedCallback = function (instance) {
|
1503 | {
|
1504 | safeCall(instance, 'connectedCallback');
|
1505 | }
|
1506 | };
|
1507 | var connectedCallback = function (elm, cmpMeta) {
|
1508 | if ((plt.$flags$ & 1 ) === 0) {
|
1509 | var endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
|
1510 |
|
1511 | var hostRef_1 = getHostRef(elm);
|
1512 | if (cmpMeta.$listeners$) {
|
1513 |
|
1514 |
|
1515 |
|
1516 | hostRef_1.$rmListeners$ = addEventListeners(elm, hostRef_1, cmpMeta.$listeners$);
|
1517 | }
|
1518 | if (!(hostRef_1.$flags$ & 1 )) {
|
1519 |
|
1520 | hostRef_1.$flags$ |= 1 ;
|
1521 | var hostId = void 0;
|
1522 | if (!hostId) {
|
1523 |
|
1524 |
|
1525 |
|
1526 |
|
1527 | if ((cmpMeta.$flags$ & 4 ) ||
|
1528 | (BUILD.shadowDom )) {
|
1529 | setContentReference(elm);
|
1530 | }
|
1531 | }
|
1532 | {
|
1533 |
|
1534 |
|
1535 | var ancestorComponent = elm;
|
1536 | while ((ancestorComponent = (ancestorComponent.parentNode || ancestorComponent.host))) {
|
1537 |
|
1538 |
|
1539 | if ((ancestorComponent['s-p'])) {
|
1540 |
|
1541 |
|
1542 | attachToAncestor(hostRef_1, (hostRef_1.$ancestorComponent$ = ancestorComponent));
|
1543 | break;
|
1544 | }
|
1545 | }
|
1546 | }
|
1547 |
|
1548 |
|
1549 | if (cmpMeta.$members$) {
|
1550 | Object.entries(cmpMeta.$members$).forEach(function (_a) {
|
1551 | var memberName = _a[0], memberFlags = _a[1][0];
|
1552 | if (memberFlags & 31 && elm.hasOwnProperty(memberName)) {
|
1553 | var value = elm[memberName];
|
1554 | delete elm[memberName];
|
1555 | elm[memberName] = value;
|
1556 | }
|
1557 | });
|
1558 | }
|
1559 | {
|
1560 |
|
1561 |
|
1562 |
|
1563 |
|
1564 | nextTick(function () { return initializeComponent(elm, hostRef_1, cmpMeta); });
|
1565 | }
|
1566 | }
|
1567 | fireConnectedCallback(hostRef_1.$lazyInstance$);
|
1568 | endConnected();
|
1569 | }
|
1570 | };
|
1571 | var setContentReference = function (elm) {
|
1572 |
|
1573 |
|
1574 |
|
1575 |
|
1576 |
|
1577 |
|
1578 | var crName = '';
|
1579 | var contentRefElm = elm['s-cr'] = doc.createComment(crName);
|
1580 | contentRefElm['s-cn'] = true;
|
1581 | elm.insertBefore(contentRefElm, elm.firstChild);
|
1582 | };
|
1583 | var disconnectedCallback = function (elm) {
|
1584 | if ((plt.$flags$ & 1 ) === 0) {
|
1585 | var hostRef = getHostRef(elm);
|
1586 | {
|
1587 | if (hostRef.$rmListeners$) {
|
1588 | hostRef.$rmListeners$();
|
1589 | hostRef.$rmListeners$ = undefined;
|
1590 | }
|
1591 | }
|
1592 |
|
1593 | if (plt.$cssShim$) {
|
1594 | plt.$cssShim$.removeHost(elm);
|
1595 | }
|
1596 | }
|
1597 | };
|
1598 | var bootstrapLazy = function (lazyBundles, options) {
|
1599 | if (options === void 0) { options = {}; }
|
1600 | var endBootstrap = createTime();
|
1601 | var cmpTags = [];
|
1602 | var exclude = options.exclude || [];
|
1603 | var head = doc.head;
|
1604 | var customElements = win.customElements;
|
1605 | var y = head.querySelector('meta[charset]');
|
1606 | var visibilityStyle = doc.createElement('style');
|
1607 | var deferredConnectedCallbacks = [];
|
1608 | var appLoadFallback;
|
1609 | var isBootstrapping = true;
|
1610 | Object.assign(plt, options);
|
1611 | plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
|
1612 | if (options.syncQueue) {
|
1613 | plt.$flags$ |= 4 ;
|
1614 | }
|
1615 | lazyBundles.forEach(function (lazyBundle) { return lazyBundle[1].forEach(function (compactMeta) {
|
1616 | var cmpMeta = {
|
1617 | $flags$: compactMeta[0],
|
1618 | $tagName$: compactMeta[1],
|
1619 | $members$: compactMeta[2],
|
1620 | $listeners$: compactMeta[3],
|
1621 | };
|
1622 | {
|
1623 | cmpMeta.$members$ = compactMeta[2];
|
1624 | }
|
1625 | {
|
1626 | cmpMeta.$listeners$ = compactMeta[3];
|
1627 | }
|
1628 | {
|
1629 | cmpMeta.$attrsToReflect$ = [];
|
1630 | }
|
1631 | {
|
1632 | cmpMeta.$watchers$ = {};
|
1633 | }
|
1634 | var tagName = cmpMeta.$tagName$;
|
1635 | var HostElement = (function (_super) {
|
1636 | __extends(HostElement, _super);
|
1637 |
|
1638 | function HostElement(self) {
|
1639 | var _this =
|
1640 |
|
1641 | _super.call(this, self) || this;
|
1642 | self = _this;
|
1643 | registerHost(self);
|
1644 | return _this;
|
1645 | }
|
1646 | HostElement.prototype.connectedCallback = function () {
|
1647 | var _this = this;
|
1648 | if (appLoadFallback) {
|
1649 | clearTimeout(appLoadFallback);
|
1650 | appLoadFallback = null;
|
1651 | }
|
1652 | if (isBootstrapping) {
|
1653 |
|
1654 | deferredConnectedCallbacks.push(this);
|
1655 | }
|
1656 | else {
|
1657 | plt.jmp(function () { return connectedCallback(_this, cmpMeta); });
|
1658 | }
|
1659 | };
|
1660 | HostElement.prototype.disconnectedCallback = function () {
|
1661 | var _this = this;
|
1662 | plt.jmp(function () { return disconnectedCallback(_this); });
|
1663 | };
|
1664 | HostElement.prototype['s-hmr'] = function (hmrVersionId) {
|
1665 | };
|
1666 | HostElement.prototype.forceUpdate = function () {
|
1667 | forceUpdate(this, cmpMeta);
|
1668 | };
|
1669 | HostElement.prototype.componentOnReady = function () {
|
1670 | return getHostRef(this).$onReadyPromise$;
|
1671 | };
|
1672 | return HostElement;
|
1673 | }(HTMLElement));
|
1674 | cmpMeta.$lazyBundleIds$ = lazyBundle[0];
|
1675 | if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
1676 | cmpTags.push(tagName);
|
1677 | customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 ));
|
1678 | }
|
1679 | }); });
|
1680 |
|
1681 | visibilityStyle.innerHTML = cmpTags + '{visibility:hidden}.hydrated{visibility:inherit}';
|
1682 | visibilityStyle.setAttribute('data-styles', '');
|
1683 | head.insertBefore(visibilityStyle, y ? y.nextSibling : head.firstChild);
|
1684 |
|
1685 | isBootstrapping = false;
|
1686 | if (deferredConnectedCallbacks.length > 0) {
|
1687 | deferredConnectedCallbacks.forEach(function (host) { return host.connectedCallback(); });
|
1688 | }
|
1689 | else {
|
1690 | plt.jmp(function () { return appLoadFallback = setTimeout(appDidLoad, 30, 'timeout'); });
|
1691 | }
|
1692 |
|
1693 | endBootstrap();
|
1694 | };
|
1695 | var getElement = function (ref) { return getHostRef(ref).$hostElement$; };
|
1696 | export { patchEsm as a, bootstrapLazy as b, getElement as g, h, patchBrowser as p, registerInstance as r };
|