proto-tinker-wc 0.0.411 → 0.0.413
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-9c3ee45f.js → index-fb958656.js} +69 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/proto-tinker-wc.cjs.js +2 -2
- package/dist/cjs/proto-tinker.cjs.entry.js +127 -131
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/proto-tinker/proto-tinker.js +1 -1
- package/dist/components/proto-tinker.js +126 -130
- package/dist/esm/{index-103deccc.js → index-b73046cf.js} +69 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/proto-tinker-wc.js +3 -3
- package/dist/esm/proto-tinker.entry.js +127 -131
- package/dist/proto-tinker-wc/p-0940c870.js +2 -0
- package/dist/proto-tinker-wc/p-3490913e.entry.js +1 -0
- package/dist/proto-tinker-wc/proto-tinker-wc.esm.js +1 -1
- package/package.json +3 -3
- package/dist/proto-tinker-wc/p-0e6cebec.entry.js +0 -1
- package/dist/proto-tinker-wc/p-d8b16e88.js +0 -2
|
@@ -107,6 +107,7 @@ function queryNonceMetaTagContent(doc) {
|
|
|
107
107
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
|
|
108
108
|
const h = (nodeName, vnodeData, ...children) => {
|
|
109
109
|
let child = null;
|
|
110
|
+
let key = null;
|
|
110
111
|
let simple = false;
|
|
111
112
|
let lastSimple = false;
|
|
112
113
|
const vNodeChildren = [];
|
|
@@ -134,6 +135,9 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
134
135
|
};
|
|
135
136
|
walk(children);
|
|
136
137
|
if (vnodeData) {
|
|
138
|
+
if (vnodeData.key) {
|
|
139
|
+
key = vnodeData.key;
|
|
140
|
+
}
|
|
137
141
|
// normalize class / className attributes
|
|
138
142
|
{
|
|
139
143
|
const classData = vnodeData.className || vnodeData.class;
|
|
@@ -156,6 +160,9 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
156
160
|
if (vNodeChildren.length > 0) {
|
|
157
161
|
vnode.$children$ = vNodeChildren;
|
|
158
162
|
}
|
|
163
|
+
{
|
|
164
|
+
vnode.$key$ = key;
|
|
165
|
+
}
|
|
159
166
|
return vnode;
|
|
160
167
|
};
|
|
161
168
|
/**
|
|
@@ -177,6 +184,9 @@ const newVNode = (tag, text) => {
|
|
|
177
184
|
{
|
|
178
185
|
vnode.$attrs$ = null;
|
|
179
186
|
}
|
|
187
|
+
{
|
|
188
|
+
vnode.$key$ = null;
|
|
189
|
+
}
|
|
180
190
|
return vnode;
|
|
181
191
|
};
|
|
182
192
|
const Host = {};
|
|
@@ -402,6 +412,8 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
402
412
|
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
403
413
|
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
404
414
|
}
|
|
415
|
+
else if (memberName === 'key')
|
|
416
|
+
;
|
|
405
417
|
else if ((!isProp ) &&
|
|
406
418
|
memberName[0] === 'o' &&
|
|
407
419
|
memberName[1] === 'n') {
|
|
@@ -713,6 +725,8 @@ const removeVnodes = (vnodes, startIdx, endIdx) => {
|
|
|
713
725
|
const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = false) => {
|
|
714
726
|
let oldStartIdx = 0;
|
|
715
727
|
let newStartIdx = 0;
|
|
728
|
+
let idxInOld = 0;
|
|
729
|
+
let i = 0;
|
|
716
730
|
let oldEndIdx = oldCh.length - 1;
|
|
717
731
|
let oldStartVnode = oldCh[0];
|
|
718
732
|
let oldEndVnode = oldCh[oldEndIdx];
|
|
@@ -720,6 +734,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = fal
|
|
|
720
734
|
let newStartVnode = newCh[0];
|
|
721
735
|
let newEndVnode = newCh[newEndIdx];
|
|
722
736
|
let node;
|
|
737
|
+
let elmToMove;
|
|
723
738
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
724
739
|
if (oldStartVnode == null) {
|
|
725
740
|
// VNode might have been moved left
|
|
@@ -786,7 +801,41 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = fal
|
|
|
786
801
|
newStartVnode = newCh[++newStartIdx];
|
|
787
802
|
}
|
|
788
803
|
else {
|
|
804
|
+
// Here we do some checks to match up old and new nodes based on the
|
|
805
|
+
// `$key$` attribute, which is set by putting a `key="my-key"` attribute
|
|
806
|
+
// in the JSX for a DOM element in the implementation of a Stencil
|
|
807
|
+
// component.
|
|
808
|
+
//
|
|
809
|
+
// First we check to see if there are any nodes in the array of old
|
|
810
|
+
// children which have the same key as the first node in the new
|
|
811
|
+
// children.
|
|
812
|
+
idxInOld = -1;
|
|
789
813
|
{
|
|
814
|
+
for (i = oldStartIdx; i <= oldEndIdx; ++i) {
|
|
815
|
+
if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
|
|
816
|
+
idxInOld = i;
|
|
817
|
+
break;
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
if (idxInOld >= 0) {
|
|
822
|
+
// We found a node in the old children which matches up with the first
|
|
823
|
+
// node in the new children! So let's deal with that
|
|
824
|
+
elmToMove = oldCh[idxInOld];
|
|
825
|
+
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
826
|
+
// the tag doesn't match so we'll need a new DOM element
|
|
827
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
|
|
828
|
+
}
|
|
829
|
+
else {
|
|
830
|
+
patch(elmToMove, newStartVnode, isInitialRender);
|
|
831
|
+
// invalidate the matching old node so that we won't try to update it
|
|
832
|
+
// again later on
|
|
833
|
+
oldCh[idxInOld] = undefined;
|
|
834
|
+
node = elmToMove.$elm$;
|
|
835
|
+
}
|
|
836
|
+
newStartVnode = newCh[++newStartIdx];
|
|
837
|
+
}
|
|
838
|
+
else {
|
|
790
839
|
// We either didn't find an element in the old children that matches
|
|
791
840
|
// the key of the first new child OR the build is not using `key`
|
|
792
841
|
// attributes at all. In either case we need to create a new element
|
|
@@ -836,6 +885,14 @@ const isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
|
|
|
836
885
|
// compare if two vnode to see if they're "technically" the same
|
|
837
886
|
// need to have the same element tag, and same key to be the same
|
|
838
887
|
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
|
888
|
+
// this will be set if JSX tags in the build have `key` attrs set on them
|
|
889
|
+
// we only want to check this if we're not on the first render since on
|
|
890
|
+
// first render `leftVNode.$key$` will always be `null`, so we can be led
|
|
891
|
+
// astray and, for instance, accidentally delete a DOM node that we want to
|
|
892
|
+
// keep around.
|
|
893
|
+
if (!isInitialRender) {
|
|
894
|
+
return leftVNode.$key$ === rightVNode.$key$;
|
|
895
|
+
}
|
|
839
896
|
return true;
|
|
840
897
|
}
|
|
841
898
|
return false;
|
|
@@ -1621,8 +1678,19 @@ const setNonce = (nonce) => (plt.$nonce$ = nonce);
|
|
|
1621
1678
|
/**
|
|
1622
1679
|
* A WeakMap mapping runtime component references to their corresponding host reference
|
|
1623
1680
|
* instances.
|
|
1681
|
+
*
|
|
1682
|
+
* **Note**: If we're in an HMR context we need to store a reference to this
|
|
1683
|
+
* value on `window` in order to maintain the mapping of {@link d.RuntimeRef}
|
|
1684
|
+
* to {@link d.HostRef} across HMR updates.
|
|
1685
|
+
*
|
|
1686
|
+
* This is necessary because when HMR updates for a component are processed by
|
|
1687
|
+
* the browser-side dev server client the JS bundle for that component is
|
|
1688
|
+
* re-fetched. Since the module containing {@link hostRefs} is included in
|
|
1689
|
+
* that bundle, if we do not store a reference to it the new iteration of the
|
|
1690
|
+
* component will not have access to the previous hostRef map, leading to a
|
|
1691
|
+
* bug where the new version of the component cannot properly initialize.
|
|
1624
1692
|
*/
|
|
1625
|
-
const hostRefs =
|
|
1693
|
+
const hostRefs = new WeakMap();
|
|
1626
1694
|
/**
|
|
1627
1695
|
* Given a {@link d.RuntimeRef} retrieve the corresponding {@link d.HostRef}
|
|
1628
1696
|
*
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-fb958656.js');
|
|
6
6
|
|
|
7
7
|
const defineCustomElements = (win, options) => {
|
|
8
8
|
if (typeof window === 'undefined') return undefined;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-fb958656.js');
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
|
-
Stencil Client Patch Browser v4.
|
|
8
|
+
Stencil Client Patch Browser v4.12.0 | MIT Licensed | https://stenciljs.com
|
|
9
9
|
*/
|
|
10
10
|
const patchBrowser = () => {
|
|
11
11
|
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('proto-tinker-wc.cjs.js', document.baseURI).href));
|