@sankhyalabs/sankhyablocks 1.3.31-beta.4 → 1.3.31
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/dist/cjs/{index-ebe8245e.js → index-1133bc2a.js} +9 -453
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/sankhyablocks.cjs.js +2 -2
- package/dist/cjs/snk-application.cjs.entry.js +95 -118
- package/dist/cjs/snk-pesquisa.cjs.entry.js +2 -2
- package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +0 -4
- package/dist/collection/components/snk-application/snk-application.js +20 -61
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +2 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +21 -36
- package/dist/collection/lib/http/data-fetcher/fetchers/grid-config-fetcher.js +3 -4
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +1 -0
- package/dist/components/snk-application2.js +94 -118
- package/dist/components/snk-pesquisa2.js +1 -1
- package/dist/esm/{index-7565ae23.js → index-ffda6382.js} +10 -453
- package/dist/esm/loader.js +2 -2
- package/dist/esm/sankhyablocks.js +2 -2
- package/dist/esm/snk-application.entry.js +95 -118
- package/dist/esm/snk-pesquisa.entry.js +2 -2
- package/dist/esm/teste-pesquisa.entry.js +1 -1
- package/dist/sankhyablocks/{p-bb31ea2a.entry.js → p-2a7b4cb3.entry.js} +1 -1
- package/dist/sankhyablocks/{p-6d82d7fd.entry.js → p-49fdec1f.entry.js} +1 -1
- package/dist/sankhyablocks/p-9bc9abe0.entry.js +69 -0
- package/dist/sankhyablocks/p-edcb9d8e.js +2 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +5 -6
- package/dist/types/components.d.ts +1 -119
- package/dist/types/lib/http/data-fetcher/fetchers/grid-config-fetcher.d.ts +1 -1
- package/package.json +5 -5
- package/react/components.d.ts +0 -4
- package/react/components.js +0 -4
- package/react/components.js.map +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +0 -174
- package/dist/cjs/snk-form.cjs.entry.js +0 -95
- package/dist/cjs/snk-grid.cjs.entry.js +0 -64
- package/dist/cjs/snk-taskbar.cjs.entry.js +0 -159
- package/dist/cjs/taskbar-elements-589a3744.js +0 -68
- package/dist/collection/components/snk-data-unit/snk-data-unit.css +0 -6
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +0 -429
- package/dist/collection/components/snk-form/snk-form.css +0 -3
- package/dist/collection/components/snk-form/snk-form.js +0 -194
- package/dist/collection/components/snk-grid/snk-grid.css +0 -5
- package/dist/collection/components/snk-grid/snk-grid.js +0 -128
- package/dist/collection/components/snk-taskbar/component/snk-popup-button.js +0 -7
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +0 -63
- package/dist/collection/components/snk-taskbar/snk-taskbar.css +0 -3
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +0 -268
- package/dist/components/snk-data-unit.d.ts +0 -11
- package/dist/components/snk-data-unit.js +0 -198
- package/dist/components/snk-form.d.ts +0 -11
- package/dist/components/snk-form.js +0 -121
- package/dist/components/snk-grid.d.ts +0 -11
- package/dist/components/snk-grid.js +0 -88
- package/dist/components/snk-taskbar.d.ts +0 -11
- package/dist/components/snk-taskbar.js +0 -6
- package/dist/components/snk-taskbar2.js +0 -239
- package/dist/esm/snk-data-unit.entry.js +0 -170
- package/dist/esm/snk-form.entry.js +0 -91
- package/dist/esm/snk-grid.entry.js +0 -60
- package/dist/esm/snk-taskbar.entry.js +0 -155
- package/dist/esm/taskbar-elements-b6822601.js +0 -66
- package/dist/sankhyablocks/p-306224bf.entry.js +0 -1
- package/dist/sankhyablocks/p-4ee1e12b.js +0 -1
- package/dist/sankhyablocks/p-88278b85.entry.js +0 -1
- package/dist/sankhyablocks/p-90b832f7.js +0 -2
- package/dist/sankhyablocks/p-a4b2fa10.entry.js +0 -69
- package/dist/sankhyablocks/p-bb8d8fe7.entry.js +0 -1
- package/dist/sankhyablocks/p-e7ade160.entry.js +0 -1
- package/dist/types/components/snk-taskbar/component/snk-popup-button.d.ts +0 -12
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +0 -24
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +0 -28
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
const NAMESPACE = 'sankhyablocks';
|
|
2
2
|
|
|
3
3
|
let scopeId;
|
|
4
|
-
let contentRef;
|
|
5
4
|
let hostTagName;
|
|
6
|
-
let useNativeShadowDom = false;
|
|
7
|
-
let checkSlotFallbackVisibility = false;
|
|
8
|
-
let checkSlotRelocate = false;
|
|
9
5
|
let isSvgMode = false;
|
|
10
6
|
let queuePending = false;
|
|
11
7
|
const win = typeof window !== 'undefined' ? window : {};
|
|
@@ -139,8 +135,6 @@ const isComplexType = (o) => {
|
|
|
139
135
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
|
|
140
136
|
const h = (nodeName, vnodeData, ...children) => {
|
|
141
137
|
let child = null;
|
|
142
|
-
let key = null;
|
|
143
|
-
let slotName = null;
|
|
144
138
|
let simple = false;
|
|
145
139
|
let lastSimple = false;
|
|
146
140
|
const vNodeChildren = [];
|
|
@@ -168,13 +162,6 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
168
162
|
};
|
|
169
163
|
walk(children);
|
|
170
164
|
if (vnodeData) {
|
|
171
|
-
// normalize class / classname attributes
|
|
172
|
-
if (vnodeData.key) {
|
|
173
|
-
key = vnodeData.key;
|
|
174
|
-
}
|
|
175
|
-
if (vnodeData.name) {
|
|
176
|
-
slotName = vnodeData.name;
|
|
177
|
-
}
|
|
178
165
|
{
|
|
179
166
|
const classData = vnodeData.className || vnodeData.class;
|
|
180
167
|
if (classData) {
|
|
@@ -187,21 +174,11 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
187
174
|
}
|
|
188
175
|
}
|
|
189
176
|
}
|
|
190
|
-
if (typeof nodeName === 'function') {
|
|
191
|
-
// nodeName is a functional component
|
|
192
|
-
return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
|
|
193
|
-
}
|
|
194
177
|
const vnode = newVNode(nodeName, null);
|
|
195
178
|
vnode.$attrs$ = vnodeData;
|
|
196
179
|
if (vNodeChildren.length > 0) {
|
|
197
180
|
vnode.$children$ = vNodeChildren;
|
|
198
181
|
}
|
|
199
|
-
{
|
|
200
|
-
vnode.$key$ = key;
|
|
201
|
-
}
|
|
202
|
-
{
|
|
203
|
-
vnode.$name$ = slotName;
|
|
204
|
-
}
|
|
205
182
|
return vnode;
|
|
206
183
|
};
|
|
207
184
|
const newVNode = (tag, text) => {
|
|
@@ -215,46 +192,10 @@ const newVNode = (tag, text) => {
|
|
|
215
192
|
{
|
|
216
193
|
vnode.$attrs$ = null;
|
|
217
194
|
}
|
|
218
|
-
{
|
|
219
|
-
vnode.$key$ = null;
|
|
220
|
-
}
|
|
221
|
-
{
|
|
222
|
-
vnode.$name$ = null;
|
|
223
|
-
}
|
|
224
195
|
return vnode;
|
|
225
196
|
};
|
|
226
197
|
const Host = {};
|
|
227
198
|
const isHost = (node) => node && node.$tag$ === Host;
|
|
228
|
-
const vdomFnUtils = {
|
|
229
|
-
forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
|
|
230
|
-
map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
|
|
231
|
-
};
|
|
232
|
-
const convertToPublic = (node) => ({
|
|
233
|
-
vattrs: node.$attrs$,
|
|
234
|
-
vchildren: node.$children$,
|
|
235
|
-
vkey: node.$key$,
|
|
236
|
-
vname: node.$name$,
|
|
237
|
-
vtag: node.$tag$,
|
|
238
|
-
vtext: node.$text$,
|
|
239
|
-
});
|
|
240
|
-
const convertToPrivate = (node) => {
|
|
241
|
-
if (typeof node.vtag === 'function') {
|
|
242
|
-
const vnodeData = Object.assign({}, node.vattrs);
|
|
243
|
-
if (node.vkey) {
|
|
244
|
-
vnodeData.key = node.vkey;
|
|
245
|
-
}
|
|
246
|
-
if (node.vname) {
|
|
247
|
-
vnodeData.name = node.vname;
|
|
248
|
-
}
|
|
249
|
-
return h(node.vtag, vnodeData, ...(node.vchildren || []));
|
|
250
|
-
}
|
|
251
|
-
const vnode = newVNode(node.vtag, node.vtext);
|
|
252
|
-
vnode.$attrs$ = node.vattrs;
|
|
253
|
-
vnode.$children$ = node.vchildren;
|
|
254
|
-
vnode.$key$ = node.vkey;
|
|
255
|
-
vnode.$name$ = node.vname;
|
|
256
|
-
return vnode;
|
|
257
|
-
};
|
|
258
199
|
/**
|
|
259
200
|
* Production setAccessor() function based on Preact by
|
|
260
201
|
* Jason Miller (@developit)
|
|
@@ -274,8 +215,6 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
274
215
|
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
275
216
|
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
276
217
|
}
|
|
277
|
-
else if (memberName === 'key')
|
|
278
|
-
;
|
|
279
218
|
else if (memberName === 'ref') {
|
|
280
219
|
// minifier will clean this up
|
|
281
220
|
if (newValue) {
|
|
@@ -388,36 +327,13 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
388
327
|
let i = 0;
|
|
389
328
|
let elm;
|
|
390
329
|
let childNode;
|
|
391
|
-
let oldVNode;
|
|
392
|
-
if (!useNativeShadowDom) {
|
|
393
|
-
// remember for later we need to check to relocate nodes
|
|
394
|
-
checkSlotRelocate = true;
|
|
395
|
-
if (newVNode.$tag$ === 'slot') {
|
|
396
|
-
if (scopeId) {
|
|
397
|
-
// scoped css needs to add its scoped id to the parent element
|
|
398
|
-
parentElm.classList.add(scopeId + '-s');
|
|
399
|
-
}
|
|
400
|
-
newVNode.$flags$ |= newVNode.$children$
|
|
401
|
-
? // slot element has fallback content
|
|
402
|
-
2 /* isSlotFallback */
|
|
403
|
-
: // slot element does not have fallback content
|
|
404
|
-
1 /* isSlotReference */;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
330
|
if (newVNode.$text$ !== null) {
|
|
408
331
|
// create text node
|
|
409
332
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
410
333
|
}
|
|
411
|
-
else if (newVNode.$flags$ & 1 /* isSlotReference */) {
|
|
412
|
-
// create a slot reference node
|
|
413
|
-
elm = newVNode.$elm$ =
|
|
414
|
-
doc.createTextNode('');
|
|
415
|
-
}
|
|
416
334
|
else {
|
|
417
335
|
// create element
|
|
418
|
-
elm = newVNode.$elm$ = (doc.createElement(newVNode.$
|
|
419
|
-
? 'slot-fb'
|
|
420
|
-
: newVNode.$tag$));
|
|
336
|
+
elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
|
|
421
337
|
// add css classes, attrs, props, listeners, etc.
|
|
422
338
|
{
|
|
423
339
|
updateElement(null, newVNode, isSvgMode);
|
|
@@ -430,7 +346,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
430
346
|
if (newVNode.$children$) {
|
|
431
347
|
for (i = 0; i < newVNode.$children$.length; ++i) {
|
|
432
348
|
// create the node
|
|
433
|
-
childNode = createElm(oldParentVNode, newVNode, i
|
|
349
|
+
childNode = createElm(oldParentVNode, newVNode, i);
|
|
434
350
|
// return node could have been null
|
|
435
351
|
if (childNode) {
|
|
436
352
|
// append our new node
|
|
@@ -439,62 +355,20 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
439
355
|
}
|
|
440
356
|
}
|
|
441
357
|
}
|
|
442
|
-
{
|
|
443
|
-
elm['s-hn'] = hostTagName;
|
|
444
|
-
if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
|
|
445
|
-
// remember the content reference comment
|
|
446
|
-
elm['s-sr'] = true;
|
|
447
|
-
// remember the content reference comment
|
|
448
|
-
elm['s-cr'] = contentRef;
|
|
449
|
-
// remember the slot name, or empty string for default slot
|
|
450
|
-
elm['s-sn'] = newVNode.$name$ || '';
|
|
451
|
-
// check if we've got an old vnode for this slot
|
|
452
|
-
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
|
453
|
-
if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
|
|
454
|
-
// we've got an old slot vnode and the wrapper is being replaced
|
|
455
|
-
// so let's move the old slot content back to it's original location
|
|
456
|
-
putBackInOriginalLocation(oldParentVNode.$elm$, false);
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
358
|
return elm;
|
|
461
359
|
};
|
|
462
|
-
const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
463
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
464
|
-
const oldSlotChildNodes = parentElm.childNodes;
|
|
465
|
-
for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
|
|
466
|
-
const childNode = oldSlotChildNodes[i];
|
|
467
|
-
if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
|
|
468
|
-
// // this child node in the old element is from another component
|
|
469
|
-
// // remove this node from the old slot's parent
|
|
470
|
-
// childNode.remove();
|
|
471
|
-
// and relocate it back to it's original location
|
|
472
|
-
parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
|
|
473
|
-
// remove the old original location comment entirely
|
|
474
|
-
// later on the patch function will know what to do
|
|
475
|
-
// and move this to the correct spot in need be
|
|
476
|
-
childNode['s-ol'].remove();
|
|
477
|
-
childNode['s-ol'] = undefined;
|
|
478
|
-
checkSlotRelocate = true;
|
|
479
|
-
}
|
|
480
|
-
if (recursive) {
|
|
481
|
-
putBackInOriginalLocation(childNode, recursive);
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
485
|
-
};
|
|
486
360
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
487
|
-
let containerElm = (
|
|
361
|
+
let containerElm = (parentElm);
|
|
488
362
|
let childNode;
|
|
489
363
|
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
490
364
|
containerElm = containerElm.shadowRoot;
|
|
491
365
|
}
|
|
492
366
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
493
367
|
if (vnodes[startIdx]) {
|
|
494
|
-
childNode = createElm(null, parentVNode, startIdx
|
|
368
|
+
childNode = createElm(null, parentVNode, startIdx);
|
|
495
369
|
if (childNode) {
|
|
496
370
|
vnodes[startIdx].$elm$ = childNode;
|
|
497
|
-
containerElm.insertBefore(childNode,
|
|
371
|
+
containerElm.insertBefore(childNode, before);
|
|
498
372
|
}
|
|
499
373
|
}
|
|
500
374
|
}
|
|
@@ -504,20 +378,6 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
|
504
378
|
if ((vnode = vnodes[startIdx])) {
|
|
505
379
|
elm = vnode.$elm$;
|
|
506
380
|
callNodeRefs(vnode);
|
|
507
|
-
{
|
|
508
|
-
// we're removing this element
|
|
509
|
-
// so it's possible we need to show slot fallback content now
|
|
510
|
-
checkSlotFallbackVisibility = true;
|
|
511
|
-
if (elm['s-ol']) {
|
|
512
|
-
// remove the original location comment
|
|
513
|
-
elm['s-ol'].remove();
|
|
514
|
-
}
|
|
515
|
-
else {
|
|
516
|
-
// it's possible that child nodes of the node
|
|
517
|
-
// that's being removed are slot nodes
|
|
518
|
-
putBackInOriginalLocation(elm, true);
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
381
|
// remove the vnode's element from the dom
|
|
522
382
|
elm.remove();
|
|
523
383
|
}
|
|
@@ -526,8 +386,6 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
|
526
386
|
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
527
387
|
let oldStartIdx = 0;
|
|
528
388
|
let newStartIdx = 0;
|
|
529
|
-
let idxInOld = 0;
|
|
530
|
-
let i = 0;
|
|
531
389
|
let oldEndIdx = oldCh.length - 1;
|
|
532
390
|
let oldStartVnode = oldCh[0];
|
|
533
391
|
let oldEndVnode = oldCh[oldEndIdx];
|
|
@@ -535,7 +393,6 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
535
393
|
let newStartVnode = newCh[0];
|
|
536
394
|
let newEndVnode = newCh[newEndIdx];
|
|
537
395
|
let node;
|
|
538
|
-
let elmToMove;
|
|
539
396
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
540
397
|
if (oldStartVnode == null) {
|
|
541
398
|
// Vnode might have been moved left
|
|
@@ -561,56 +418,26 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
561
418
|
newEndVnode = newCh[--newEndIdx];
|
|
562
419
|
}
|
|
563
420
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
564
|
-
// Vnode moved right
|
|
565
|
-
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
566
|
-
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
567
|
-
}
|
|
568
421
|
patch(oldStartVnode, newEndVnode);
|
|
569
422
|
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
|
570
423
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
571
424
|
newEndVnode = newCh[--newEndIdx];
|
|
572
425
|
}
|
|
573
426
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
574
|
-
// Vnode moved left
|
|
575
|
-
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
576
|
-
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
577
|
-
}
|
|
578
427
|
patch(oldEndVnode, newStartVnode);
|
|
579
428
|
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
|
580
429
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
581
430
|
newStartVnode = newCh[++newStartIdx];
|
|
582
431
|
}
|
|
583
432
|
else {
|
|
584
|
-
// createKeyToOldIdx
|
|
585
|
-
idxInOld = -1;
|
|
586
433
|
{
|
|
587
|
-
for (i = oldStartIdx; i <= oldEndIdx; ++i) {
|
|
588
|
-
if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
|
|
589
|
-
idxInOld = i;
|
|
590
|
-
break;
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
if (idxInOld >= 0) {
|
|
595
|
-
elmToMove = oldCh[idxInOld];
|
|
596
|
-
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
597
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
|
|
598
|
-
}
|
|
599
|
-
else {
|
|
600
|
-
patch(elmToMove, newStartVnode);
|
|
601
|
-
oldCh[idxInOld] = undefined;
|
|
602
|
-
node = elmToMove.$elm$;
|
|
603
|
-
}
|
|
604
|
-
newStartVnode = newCh[++newStartIdx];
|
|
605
|
-
}
|
|
606
|
-
else {
|
|
607
434
|
// new element
|
|
608
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx
|
|
435
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
609
436
|
newStartVnode = newCh[++newStartIdx];
|
|
610
437
|
}
|
|
611
438
|
if (node) {
|
|
612
439
|
{
|
|
613
|
-
|
|
440
|
+
oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
|
|
614
441
|
}
|
|
615
442
|
}
|
|
616
443
|
}
|
|
@@ -626,36 +453,19 @@ const isSameVnode = (vnode1, vnode2) => {
|
|
|
626
453
|
// compare if two vnode to see if they're "technically" the same
|
|
627
454
|
// need to have the same element tag, and same key to be the same
|
|
628
455
|
if (vnode1.$tag$ === vnode2.$tag$) {
|
|
629
|
-
|
|
630
|
-
return vnode1.$name$ === vnode2.$name$;
|
|
631
|
-
}
|
|
632
|
-
{
|
|
633
|
-
return vnode1.$key$ === vnode2.$key$;
|
|
634
|
-
}
|
|
456
|
+
return true;
|
|
635
457
|
}
|
|
636
458
|
return false;
|
|
637
459
|
};
|
|
638
|
-
const referenceNode = (node) => {
|
|
639
|
-
// this node was relocated to a new location in the dom
|
|
640
|
-
// because of some other component's slot
|
|
641
|
-
// but we still have an html comment in place of where
|
|
642
|
-
// it's original location was according to it's original vdom
|
|
643
|
-
return (node && node['s-ol']) || node;
|
|
644
|
-
};
|
|
645
|
-
const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
|
|
646
460
|
const patch = (oldVNode, newVNode) => {
|
|
647
461
|
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
|
648
462
|
const oldChildren = oldVNode.$children$;
|
|
649
463
|
const newChildren = newVNode.$children$;
|
|
650
|
-
const tag = newVNode.$tag$;
|
|
651
464
|
const text = newVNode.$text$;
|
|
652
|
-
let defaultHolder;
|
|
653
465
|
if (text === null) {
|
|
654
466
|
// element node
|
|
655
467
|
{
|
|
656
|
-
|
|
657
|
-
;
|
|
658
|
-
else {
|
|
468
|
+
{
|
|
659
469
|
// either this is the first render of an element OR it's an update
|
|
660
470
|
// AND we already know it's possible it could have changed
|
|
661
471
|
// this updates the element's css classes, attrs, props, listeners, etc.
|
|
@@ -680,147 +490,12 @@ const patch = (oldVNode, newVNode) => {
|
|
|
680
490
|
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
681
491
|
}
|
|
682
492
|
}
|
|
683
|
-
else if ((defaultHolder = elm['s-cr'])) {
|
|
684
|
-
// this element has slotted content
|
|
685
|
-
defaultHolder.parentNode.textContent = text;
|
|
686
|
-
}
|
|
687
493
|
else if (oldVNode.$text$ !== text) {
|
|
688
494
|
// update the text content for the text only vnode
|
|
689
495
|
// and also only if the text is different than before
|
|
690
496
|
elm.data = text;
|
|
691
497
|
}
|
|
692
498
|
};
|
|
693
|
-
const updateFallbackSlotVisibility = (elm) => {
|
|
694
|
-
// tslint:disable-next-line: prefer-const
|
|
695
|
-
const childNodes = elm.childNodes;
|
|
696
|
-
let childNode;
|
|
697
|
-
let i;
|
|
698
|
-
let ilen;
|
|
699
|
-
let j;
|
|
700
|
-
let slotNameAttr;
|
|
701
|
-
let nodeType;
|
|
702
|
-
for (i = 0, ilen = childNodes.length; i < ilen; i++) {
|
|
703
|
-
childNode = childNodes[i];
|
|
704
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
705
|
-
if (childNode['s-sr']) {
|
|
706
|
-
// this is a slot fallback node
|
|
707
|
-
// get the slot name for this slot reference node
|
|
708
|
-
slotNameAttr = childNode['s-sn'];
|
|
709
|
-
// by default always show a fallback slot node
|
|
710
|
-
// then hide it if there are other slots in the light dom
|
|
711
|
-
childNode.hidden = false;
|
|
712
|
-
for (j = 0; j < ilen; j++) {
|
|
713
|
-
nodeType = childNodes[j].nodeType;
|
|
714
|
-
if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
|
|
715
|
-
// this sibling node is from a different component OR is a named fallback slot node
|
|
716
|
-
if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
717
|
-
childNode.hidden = true;
|
|
718
|
-
break;
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
else {
|
|
722
|
-
// this is a default fallback slot node
|
|
723
|
-
// any element or text node (with content)
|
|
724
|
-
// should hide the default fallback slot node
|
|
725
|
-
if (nodeType === 1 /* ElementNode */ ||
|
|
726
|
-
(nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
727
|
-
childNode.hidden = true;
|
|
728
|
-
break;
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
// keep drilling down
|
|
734
|
-
updateFallbackSlotVisibility(childNode);
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
};
|
|
738
|
-
const relocateNodes = [];
|
|
739
|
-
const relocateSlotContent = (elm) => {
|
|
740
|
-
// tslint:disable-next-line: prefer-const
|
|
741
|
-
let childNode;
|
|
742
|
-
let node;
|
|
743
|
-
let hostContentNodes;
|
|
744
|
-
let slotNameAttr;
|
|
745
|
-
let relocateNodeData;
|
|
746
|
-
let j;
|
|
747
|
-
let i = 0;
|
|
748
|
-
const childNodes = elm.childNodes;
|
|
749
|
-
const ilen = childNodes.length;
|
|
750
|
-
for (; i < ilen; i++) {
|
|
751
|
-
childNode = childNodes[i];
|
|
752
|
-
if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
|
|
753
|
-
// first got the content reference comment node
|
|
754
|
-
// then we got it's parent, which is where all the host content is in now
|
|
755
|
-
hostContentNodes = node.parentNode.childNodes;
|
|
756
|
-
slotNameAttr = childNode['s-sn'];
|
|
757
|
-
for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
|
758
|
-
node = hostContentNodes[j];
|
|
759
|
-
if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
|
|
760
|
-
// let's do some relocating to its new home
|
|
761
|
-
// but never relocate a content reference node
|
|
762
|
-
// that is suppose to always represent the original content location
|
|
763
|
-
if (isNodeLocatedInSlot(node, slotNameAttr)) {
|
|
764
|
-
// it's possible we've already decided to relocate this node
|
|
765
|
-
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
766
|
-
// made some changes to slots
|
|
767
|
-
// let's make sure we also double check
|
|
768
|
-
// fallbacks are correctly hidden or shown
|
|
769
|
-
checkSlotFallbackVisibility = true;
|
|
770
|
-
node['s-sn'] = node['s-sn'] || slotNameAttr;
|
|
771
|
-
if (relocateNodeData) {
|
|
772
|
-
// previously we never found a slot home for this node
|
|
773
|
-
// but turns out we did, so let's remember it now
|
|
774
|
-
relocateNodeData.$slotRefNode$ = childNode;
|
|
775
|
-
}
|
|
776
|
-
else {
|
|
777
|
-
// add to our list of nodes to relocate
|
|
778
|
-
relocateNodes.push({
|
|
779
|
-
$slotRefNode$: childNode,
|
|
780
|
-
$nodeToRelocate$: node,
|
|
781
|
-
});
|
|
782
|
-
}
|
|
783
|
-
if (node['s-sr']) {
|
|
784
|
-
relocateNodes.map((relocateNode) => {
|
|
785
|
-
if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
|
|
786
|
-
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
787
|
-
if (relocateNodeData && !relocateNode.$slotRefNode$) {
|
|
788
|
-
relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
});
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
|
|
795
|
-
// so far this element does not have a slot home, not setting slotRefNode on purpose
|
|
796
|
-
// if we never find a home for this element then we'll need to hide it
|
|
797
|
-
relocateNodes.push({
|
|
798
|
-
$nodeToRelocate$: node,
|
|
799
|
-
});
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
805
|
-
relocateSlotContent(childNode);
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
};
|
|
809
|
-
const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
|
|
810
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
811
|
-
if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
|
|
812
|
-
return true;
|
|
813
|
-
}
|
|
814
|
-
if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
|
|
815
|
-
return true;
|
|
816
|
-
}
|
|
817
|
-
return false;
|
|
818
|
-
}
|
|
819
|
-
if (nodeToRelocate['s-sn'] === slotNameAttr) {
|
|
820
|
-
return true;
|
|
821
|
-
}
|
|
822
|
-
return slotNameAttr === '';
|
|
823
|
-
};
|
|
824
499
|
const callNodeRefs = (vNode) => {
|
|
825
500
|
{
|
|
826
501
|
vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
|
|
@@ -829,7 +504,6 @@ const callNodeRefs = (vNode) => {
|
|
|
829
504
|
};
|
|
830
505
|
const renderVdom = (hostRef, renderFnResults) => {
|
|
831
506
|
const hostElm = hostRef.$hostElement$;
|
|
832
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
|
833
507
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
834
508
|
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
|
835
509
|
hostTagName = hostElm.tagName;
|
|
@@ -840,90 +514,8 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
840
514
|
{
|
|
841
515
|
scopeId = hostElm['s-sc'];
|
|
842
516
|
}
|
|
843
|
-
{
|
|
844
|
-
contentRef = hostElm['s-cr'];
|
|
845
|
-
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
|
846
|
-
// always reset
|
|
847
|
-
checkSlotFallbackVisibility = false;
|
|
848
|
-
}
|
|
849
517
|
// synchronous patch
|
|
850
518
|
patch(oldVNode, rootVnode);
|
|
851
|
-
{
|
|
852
|
-
// while we're moving nodes around existing nodes, temporarily disable
|
|
853
|
-
// the disconnectCallback from working
|
|
854
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
855
|
-
if (checkSlotRelocate) {
|
|
856
|
-
relocateSlotContent(rootVnode.$elm$);
|
|
857
|
-
let relocateData;
|
|
858
|
-
let nodeToRelocate;
|
|
859
|
-
let orgLocationNode;
|
|
860
|
-
let parentNodeRef;
|
|
861
|
-
let insertBeforeNode;
|
|
862
|
-
let refNode;
|
|
863
|
-
let i = 0;
|
|
864
|
-
for (; i < relocateNodes.length; i++) {
|
|
865
|
-
relocateData = relocateNodes[i];
|
|
866
|
-
nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
867
|
-
if (!nodeToRelocate['s-ol']) {
|
|
868
|
-
// add a reference node marking this node's original location
|
|
869
|
-
// keep a reference to this node for later lookups
|
|
870
|
-
orgLocationNode =
|
|
871
|
-
doc.createTextNode('');
|
|
872
|
-
orgLocationNode['s-nr'] = nodeToRelocate;
|
|
873
|
-
nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
for (i = 0; i < relocateNodes.length; i++) {
|
|
877
|
-
relocateData = relocateNodes[i];
|
|
878
|
-
nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
879
|
-
if (relocateData.$slotRefNode$) {
|
|
880
|
-
// by default we're just going to insert it directly
|
|
881
|
-
// after the slot reference node
|
|
882
|
-
parentNodeRef = relocateData.$slotRefNode$.parentNode;
|
|
883
|
-
insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
|
|
884
|
-
orgLocationNode = nodeToRelocate['s-ol'];
|
|
885
|
-
while ((orgLocationNode = orgLocationNode.previousSibling)) {
|
|
886
|
-
refNode = orgLocationNode['s-nr'];
|
|
887
|
-
if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
|
|
888
|
-
refNode = refNode.nextSibling;
|
|
889
|
-
if (!refNode || !refNode['s-nr']) {
|
|
890
|
-
insertBeforeNode = refNode;
|
|
891
|
-
break;
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
|
|
896
|
-
nodeToRelocate.nextSibling !== insertBeforeNode) {
|
|
897
|
-
// we've checked that it's worth while to relocate
|
|
898
|
-
// since that the node to relocate
|
|
899
|
-
// has a different next sibling or parent relocated
|
|
900
|
-
if (nodeToRelocate !== insertBeforeNode) {
|
|
901
|
-
if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
|
|
902
|
-
// probably a component in the index.html that doesn't have it's hostname set
|
|
903
|
-
nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
|
|
904
|
-
}
|
|
905
|
-
// add it back to the dom but in its new home
|
|
906
|
-
parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
else {
|
|
911
|
-
// this node doesn't have a slot home to go to, so let's hide it
|
|
912
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
913
|
-
nodeToRelocate.hidden = true;
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
if (checkSlotFallbackVisibility) {
|
|
919
|
-
updateFallbackSlotVisibility(rootVnode.$elm$);
|
|
920
|
-
}
|
|
921
|
-
// done moving nodes around
|
|
922
|
-
// allow the disconnect callback to work again
|
|
923
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
924
|
-
// always reset
|
|
925
|
-
relocateNodes.length = 0;
|
|
926
|
-
}
|
|
927
519
|
};
|
|
928
520
|
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
929
521
|
const createEvent = (ref, name, flags) => {
|
|
@@ -980,9 +572,6 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
980
572
|
promise = safeCall(instance, 'componentWillLoad');
|
|
981
573
|
}
|
|
982
574
|
}
|
|
983
|
-
{
|
|
984
|
-
promise = then(promise, () => safeCall(instance, 'componentWillRender'));
|
|
985
|
-
}
|
|
986
575
|
endSchedule();
|
|
987
576
|
return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
988
577
|
};
|
|
@@ -1052,9 +641,6 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1052
641
|
const endPostUpdate = createTime('postUpdate', tagName);
|
|
1053
642
|
const instance = hostRef.$lazyInstance$ ;
|
|
1054
643
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
1055
|
-
{
|
|
1056
|
-
safeCall(instance, 'componentDidRender');
|
|
1057
|
-
}
|
|
1058
644
|
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
1059
645
|
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
1060
646
|
{
|
|
@@ -1144,15 +730,6 @@ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
|
1144
730
|
const parsePropertyValue = (propValue, propType) => {
|
|
1145
731
|
// ensure this value is of the correct prop type
|
|
1146
732
|
if (propValue != null && !isComplexType(propValue)) {
|
|
1147
|
-
if (propType & 4 /* Boolean */) {
|
|
1148
|
-
// per the HTML spec, any string value means it is a boolean true value
|
|
1149
|
-
// but we'll cheat here and say that the string "false" is the boolean false
|
|
1150
|
-
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
1151
|
-
}
|
|
1152
|
-
if (propType & 2 /* Number */) {
|
|
1153
|
-
// force it to be a number
|
|
1154
|
-
return parseFloat(propValue);
|
|
1155
|
-
}
|
|
1156
733
|
if (propType & 1 /* String */) {
|
|
1157
734
|
// could have been passed as a number or boolean
|
|
1158
735
|
// but we still want it as a string
|
|
@@ -1402,15 +979,6 @@ const connectedCallback = (elm) => {
|
|
|
1402
979
|
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
|
1403
980
|
// first time this component has connected
|
|
1404
981
|
hostRef.$flags$ |= 1 /* hasConnected */;
|
|
1405
|
-
{
|
|
1406
|
-
// initUpdate
|
|
1407
|
-
// if the slot polyfill is required we'll need to put some nodes
|
|
1408
|
-
// in here to act as original content anchors as we move nodes around
|
|
1409
|
-
// host element has been connected to the DOM
|
|
1410
|
-
if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
|
|
1411
|
-
setContentReference(elm);
|
|
1412
|
-
}
|
|
1413
|
-
}
|
|
1414
982
|
{
|
|
1415
983
|
// find the first ancestor component (if there is one) and register
|
|
1416
984
|
// this component as one of the actively loading child components for its ancestor
|
|
@@ -1448,17 +1016,6 @@ const connectedCallback = (elm) => {
|
|
|
1448
1016
|
endConnected();
|
|
1449
1017
|
}
|
|
1450
1018
|
};
|
|
1451
|
-
const setContentReference = (elm) => {
|
|
1452
|
-
// only required when we're NOT using native shadow dom (slot)
|
|
1453
|
-
// or this browser doesn't support native shadow dom
|
|
1454
|
-
// and this host element was NOT created with SSR
|
|
1455
|
-
// let's pick out the inner content for slot projection
|
|
1456
|
-
// create a node to represent where the original
|
|
1457
|
-
// content was first placed, which is useful later on
|
|
1458
|
-
const contentRefElm = (elm['s-cr'] = doc.createComment(''));
|
|
1459
|
-
contentRefElm['s-cn'] = true;
|
|
1460
|
-
elm.insertBefore(contentRefElm, elm.firstChild);
|
|
1461
|
-
};
|
|
1462
1019
|
const disconnectedCallback = (elm) => {
|
|
1463
1020
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1464
1021
|
const hostRef = getHostRef(elm);
|
|
@@ -1648,4 +1205,4 @@ const flush = () => {
|
|
|
1648
1205
|
const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
|
|
1649
1206
|
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
|
1650
1207
|
|
|
1651
|
-
export { Host as H, bootstrapLazy as b, createEvent as c,
|
|
1208
|
+
export { Host as H, bootstrapLazy as b, createEvent as c, h, promiseResolve as p, registerInstance as r };
|