analog-clock-components 0.1.302 → 0.1.304
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/analog-clock/analog-clock.esm.js +1 -1
- package/dist/analog-clock/{p-c54c9f6a.js → p-bd83218f.js} +0 -0
- package/dist/analog-clock/{p-97a8952d.entry.js → p-d97e4317.entry.js} +1 -1
- package/dist/cjs/analog-clock.cjs.entry.js +1 -1
- package/dist/cjs/analog-clock.cjs.js +2 -2
- package/dist/cjs/{index-b03b1653.js → index-5ea1be96.js} +184 -44
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/analog-clock/analog-clock.js +56 -52
- package/dist/esm/analog-clock.entry.js +1 -1
- package/dist/esm/analog-clock.js +2 -2
- package/dist/esm/{index-d143a91e.js → index-feecb2c4.js} +184 -44
- package/dist/esm/loader.js +2 -2
- package/loader/package.json +1 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as o}from"./p-
|
|
1
|
+
import{p as e,b as o}from"./p-bd83218f.js";(()=>{const o=import.meta.url,t={};return""!==o&&(t.resourcesUrl=new URL(".",o).href),e(t)})().then((e=>o([["p-d97e4317",[[1,"analog-clock",{size:[2],timeZone:[2,"time-zone"],time:[32]}]]]],e)));
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,h as e}from"./p-
|
|
1
|
+
import{r as t,h as e}from"./p-bd83218f.js";const r=class{constructor(e){t(this,e),this.size=void 0,this.timeZone=0,this.time=Date.now()}componentDidLoad(){this.timer=window.setInterval((()=>{this.time=Date.now()}),250)}disconnectedCallback(){clearInterval(this.timer)}get hour(){return new Date(this.time).getHours()}get minute(){return new Date(this.time).getMinutes()}get second(){return new Date(this.time).getSeconds()}hourToDegrees(){const t=this.hour+this.timeZone;return Math.floor(this.minute/2)+30*t}minuteToDegrees(){return Math.floor(this.second/10)+6*this.minute}secondToDegrees(){return 6*this.second}render(){return e("svg",{class:"clock",viewBox:"0 0 200 200",width:this.size,height:this.size},e("circle",{id:"circle",cx:"100",cy:"100",r:"95","stroke-width":"10",fill:"transparent"}),e("line",{id:"hour",transform:`rotate(${this.hourToDegrees()}, 100, 100)`,x1:"100",y1:"100",x2:"100",y2:"60","stroke-width":"10","stroke-linecap":"round"}),e("line",{id:"minute",transform:`rotate(${this.minuteToDegrees()}, 100, 100)`,x1:"100",y1:"100",x2:"100",y2:"30","stroke-width":"8","stroke-linecap":"round"}),e("line",{id:"second",transform:`rotate(${this.secondToDegrees()}, 100, 100)`,x1:"100",y1:"100",x2:"100",y2:"20","stroke-width":"2","stroke-linecap":"round"}))}};r.style=".clock #circle{stroke:var(--clock-circle-color, black)}.clock #hour{stroke:var(--clock-hour-color, black)}.clock #minute{stroke:var(--clock-minute-color, black)}.clock #second{stroke:var(--clock-second-color, black)}";export{r as analog_clock}
|
|
@@ -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-5ea1be96.js');
|
|
6
6
|
|
|
7
7
|
const analogClockCss = ".clock #circle{stroke:var(--clock-circle-color, black)}.clock #hour{stroke:var(--clock-hour-color, black)}.clock #minute{stroke:var(--clock-minute-color, black)}.clock #second{stroke:var(--clock-second-color, black)}";
|
|
8
8
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
3
|
+
const index = require('./index-5ea1be96.js');
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
|
-
Stencil Client Patch Browser v2.
|
|
6
|
+
Stencil Client Patch Browser v2.18.0 | MIT Licensed | https://stenciljs.com
|
|
7
7
|
*/
|
|
8
8
|
const patchBrowser = () => {
|
|
9
9
|
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('analog-clock.cjs.js', document.baseURI).href));
|
|
@@ -62,7 +62,7 @@ const uniqueTime = (key, measureText) => {
|
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
|
-
const rootAppliedStyles = new WeakMap();
|
|
65
|
+
const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
|
|
66
66
|
const registerStyle = (scopeId, cssText, allowCS) => {
|
|
67
67
|
let style = styles.get(scopeId);
|
|
68
68
|
if (supportsConstructableStylesheets && allowCS) {
|
|
@@ -84,7 +84,7 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
84
84
|
const style = styles.get(scopeId);
|
|
85
85
|
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
86
86
|
// so the fallback is to always use the document for the root node in those cases
|
|
87
|
-
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
|
87
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
|
88
88
|
if (style) {
|
|
89
89
|
if (typeof style === 'string') {
|
|
90
90
|
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
@@ -118,7 +118,7 @@ const attachStyles = (hostRef) => {
|
|
|
118
118
|
const flags = cmpMeta.$flags$;
|
|
119
119
|
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
120
120
|
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
121
|
-
if (flags & 10 /* needsScopedEncapsulation */) {
|
|
121
|
+
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
|
122
122
|
// only required when we're NOT using native shadow dom (slot)
|
|
123
123
|
// or this browser doesn't support native shadow dom
|
|
124
124
|
// and this host element was NOT created with SSR
|
|
@@ -272,7 +272,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
|
-
else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
275
|
+
else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
|
|
276
276
|
newValue = newValue === true ? '' : newValue;
|
|
277
277
|
{
|
|
278
278
|
elm.setAttribute(memberName, newValue);
|
|
@@ -287,7 +287,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
287
287
|
// if the element passed in is a shadow root, which is a document fragment
|
|
288
288
|
// then we want to be adding attrs/props to the shadow root's "host" element
|
|
289
289
|
// if it's not a shadow root, then we add attrs/props to the same element
|
|
290
|
-
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
290
|
+
const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
|
|
291
291
|
? newVnode.$elm$.host
|
|
292
292
|
: newVnode.$elm$;
|
|
293
293
|
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
@@ -305,6 +305,16 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
305
305
|
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
|
306
306
|
}
|
|
307
307
|
};
|
|
308
|
+
/**
|
|
309
|
+
* Create a DOM Node corresponding to one of the children of a given VNode.
|
|
310
|
+
*
|
|
311
|
+
* @param oldParentVNode the parent VNode from the previous render
|
|
312
|
+
* @param newParentVNode the parent VNode from the current render
|
|
313
|
+
* @param childIndex the index of the VNode, in the _new_ parent node's
|
|
314
|
+
* children, for which we will create a new DOM node
|
|
315
|
+
* @param parentElm the parent DOM node which our new node will be a child of
|
|
316
|
+
* @returns the newly created node
|
|
317
|
+
*/
|
|
308
318
|
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
309
319
|
// tslint:disable-next-line: prefer-const
|
|
310
320
|
const newVNode = newParentVNode.$children$[childIndex];
|
|
@@ -379,6 +389,74 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
|
379
389
|
}
|
|
380
390
|
}
|
|
381
391
|
};
|
|
392
|
+
/**
|
|
393
|
+
* Reconcile the children of a new VNode with the children of an old VNode by
|
|
394
|
+
* traversing the two collections of children, identifying nodes that are
|
|
395
|
+
* conserved or changed, calling out to `patch` to make any necessary
|
|
396
|
+
* updates to the DOM, and rearranging DOM nodes as needed.
|
|
397
|
+
*
|
|
398
|
+
* The algorithm for reconciling children works by analyzing two 'windows' onto
|
|
399
|
+
* the two arrays of children (`oldCh` and `newCh`). We keep track of the
|
|
400
|
+
* 'windows' by storing start and end indices and references to the
|
|
401
|
+
* corresponding array entries. Initially the two 'windows' are basically equal
|
|
402
|
+
* to the entire array, but we progressively narrow the windows until there are
|
|
403
|
+
* no children left to update by doing the following:
|
|
404
|
+
*
|
|
405
|
+
* 1. Skip any `null` entries at the beginning or end of the two arrays, so
|
|
406
|
+
* that if we have an initial array like the following we'll end up dealing
|
|
407
|
+
* only with a window bounded by the highlighted elements:
|
|
408
|
+
*
|
|
409
|
+
* [null, null, VNode1 , ... , VNode2, null, null]
|
|
410
|
+
* ^^^^^^ ^^^^^^
|
|
411
|
+
*
|
|
412
|
+
* 2. Check to see if the elements at the head and tail positions are equal
|
|
413
|
+
* across the windows. This will basically detect elements which haven't
|
|
414
|
+
* been added, removed, or changed position, i.e. if you had the following
|
|
415
|
+
* VNode elements (represented as HTML):
|
|
416
|
+
*
|
|
417
|
+
* oldVNode: `<div><p><span>HEY</span></p></div>`
|
|
418
|
+
* newVNode: `<div><p><span>THERE</span></p></div>`
|
|
419
|
+
*
|
|
420
|
+
* Then when comparing the children of the `<div>` tag we check the equality
|
|
421
|
+
* of the VNodes corresponding to the `<p>` tags and, since they are the
|
|
422
|
+
* same tag in the same position, we'd be able to avoid completely
|
|
423
|
+
* re-rendering the subtree under them with a new DOM element and would just
|
|
424
|
+
* call out to `patch` to handle reconciling their children and so on.
|
|
425
|
+
*
|
|
426
|
+
* 3. Check, for both windows, to see if the element at the beginning of the
|
|
427
|
+
* window corresponds to the element at the end of the other window. This is
|
|
428
|
+
* a heuristic which will let us identify _some_ situations in which
|
|
429
|
+
* elements have changed position, for instance it _should_ detect that the
|
|
430
|
+
* children nodes themselves have not changed but merely moved in the
|
|
431
|
+
* following example:
|
|
432
|
+
*
|
|
433
|
+
* oldVNode: `<div><element-one /><element-two /></div>`
|
|
434
|
+
* newVNode: `<div><element-two /><element-one /></div>`
|
|
435
|
+
*
|
|
436
|
+
* If we find cases like this then we also need to move the concrete DOM
|
|
437
|
+
* elements corresponding to the moved children to write the re-order to the
|
|
438
|
+
* DOM.
|
|
439
|
+
*
|
|
440
|
+
* 4. Finally, if VNodes have the `key` attribute set on them we check for any
|
|
441
|
+
* nodes in the old children which have the same key as the first element in
|
|
442
|
+
* our window on the new children. If we find such a node we handle calling
|
|
443
|
+
* out to `patch`, moving relevant DOM nodes, and so on, in accordance with
|
|
444
|
+
* what we find.
|
|
445
|
+
*
|
|
446
|
+
* Finally, once we've narrowed our 'windows' to the point that either of them
|
|
447
|
+
* collapse (i.e. they have length 0) we then handle any remaining VNode
|
|
448
|
+
* insertion or deletion that needs to happen to get a DOM state that correctly
|
|
449
|
+
* reflects the new child VNodes. If, for instance, after our window on the old
|
|
450
|
+
* children has collapsed we still have more nodes on the new children that
|
|
451
|
+
* we haven't dealt with yet then we need to add them, or if the new children
|
|
452
|
+
* collapse but we still have unhandled _old_ children then we need to make
|
|
453
|
+
* sure the corresponding DOM nodes are removed.
|
|
454
|
+
*
|
|
455
|
+
* @param parentElm the node into which the parent VNode is rendered
|
|
456
|
+
* @param oldCh the old children of the parent node
|
|
457
|
+
* @param newVNode the new VNode which will replace the parent
|
|
458
|
+
* @param newCh the new children of the parent node
|
|
459
|
+
*/
|
|
382
460
|
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
383
461
|
let oldStartIdx = 0;
|
|
384
462
|
let newStartIdx = 0;
|
|
@@ -391,7 +469,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
391
469
|
let node;
|
|
392
470
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
393
471
|
if (oldStartVnode == null) {
|
|
394
|
-
//
|
|
472
|
+
// VNode might have been moved left
|
|
395
473
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
396
474
|
}
|
|
397
475
|
else if (oldEndVnode == null) {
|
|
@@ -404,34 +482,67 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
404
482
|
newEndVnode = newCh[--newEndIdx];
|
|
405
483
|
}
|
|
406
484
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
485
|
+
// if the start nodes are the same then we should patch the new VNode
|
|
486
|
+
// onto the old one, and increment our `newStartIdx` and `oldStartIdx`
|
|
487
|
+
// indices to reflect that. We don't need to move any DOM Nodes around
|
|
488
|
+
// since things are matched up in order.
|
|
407
489
|
patch(oldStartVnode, newStartVnode);
|
|
408
490
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
409
491
|
newStartVnode = newCh[++newStartIdx];
|
|
410
492
|
}
|
|
411
493
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
494
|
+
// likewise, if the end nodes are the same we patch new onto old and
|
|
495
|
+
// decrement our end indices, and also likewise in this case we don't
|
|
496
|
+
// need to move any DOM Nodes.
|
|
412
497
|
patch(oldEndVnode, newEndVnode);
|
|
413
498
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
414
499
|
newEndVnode = newCh[--newEndIdx];
|
|
415
500
|
}
|
|
416
501
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
417
502
|
patch(oldStartVnode, newEndVnode);
|
|
503
|
+
// We need to move the element for `oldStartVnode` into a position which
|
|
504
|
+
// will be appropriate for `newEndVnode`. For this we can use
|
|
505
|
+
// `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
|
|
506
|
+
// sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
|
|
507
|
+
// `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
|
|
508
|
+
//
|
|
509
|
+
// <old-start-node />
|
|
510
|
+
// <some-intervening-node />
|
|
511
|
+
// <old-end-node />
|
|
512
|
+
// <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
|
|
513
|
+
// <next-sibling />
|
|
514
|
+
//
|
|
515
|
+
// If instead `oldEndVnode.$elm$` has no sibling then we just want to put
|
|
516
|
+
// the node for `oldStartVnode` at the end of the children of
|
|
517
|
+
// `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
|
|
518
|
+
// aren't any siblings, and passing `null` to `Node.insertBefore` will
|
|
519
|
+
// append it to the children of the parent element.
|
|
418
520
|
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
|
419
521
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
420
522
|
newEndVnode = newCh[--newEndIdx];
|
|
421
523
|
}
|
|
422
524
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
423
525
|
patch(oldEndVnode, newStartVnode);
|
|
526
|
+
// We've already checked above if `oldStartVnode` and `newStartVnode` are
|
|
527
|
+
// the same node, so since we're here we know that they are not. Thus we
|
|
528
|
+
// can move the element for `oldEndVnode` _before_ the element for
|
|
529
|
+
// `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
|
|
530
|
+
// future.
|
|
424
531
|
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
|
425
532
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
426
533
|
newStartVnode = newCh[++newStartIdx];
|
|
427
534
|
}
|
|
428
535
|
else {
|
|
429
536
|
{
|
|
430
|
-
//
|
|
537
|
+
// We either didn't find an element in the old children that matches
|
|
538
|
+
// the key of the first new child OR the build is not using `key`
|
|
539
|
+
// attributes at all. In either case we need to create a new element
|
|
540
|
+
// for the new node.
|
|
431
541
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
432
542
|
newStartVnode = newCh[++newStartIdx];
|
|
433
543
|
}
|
|
434
544
|
if (node) {
|
|
545
|
+
// if we created a new node then handle inserting it to the DOM
|
|
435
546
|
{
|
|
436
547
|
oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
|
|
437
548
|
}
|
|
@@ -439,20 +550,49 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
439
550
|
}
|
|
440
551
|
}
|
|
441
552
|
if (oldStartIdx > oldEndIdx) {
|
|
553
|
+
// we have some more new nodes to add which don't match up with old nodes
|
|
442
554
|
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
|
443
555
|
}
|
|
444
556
|
else if (newStartIdx > newEndIdx) {
|
|
557
|
+
// there are nodes in the `oldCh` array which no longer correspond to nodes
|
|
558
|
+
// in the new array, so lets remove them (which entails cleaning up the
|
|
559
|
+
// relevant DOM nodes)
|
|
445
560
|
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
446
561
|
}
|
|
447
562
|
};
|
|
448
|
-
|
|
563
|
+
/**
|
|
564
|
+
* Compare two VNodes to determine if they are the same
|
|
565
|
+
*
|
|
566
|
+
* **NB**: This function is an equality _heuristic_ based on the available
|
|
567
|
+
* information set on the two VNodes and can be misleading under certain
|
|
568
|
+
* circumstances. In particular, if the two nodes do not have `key` attrs
|
|
569
|
+
* (available under `$key$` on VNodes) then the function falls back on merely
|
|
570
|
+
* checking that they have the same tag.
|
|
571
|
+
*
|
|
572
|
+
* So, in other words, if `key` attrs are not set on VNodes which may be
|
|
573
|
+
* changing order within a `children` array or something along those lines then
|
|
574
|
+
* we could obtain a false positive and then have to do needless re-rendering.
|
|
575
|
+
*
|
|
576
|
+
* @param leftVNode the first VNode to check
|
|
577
|
+
* @param rightVNode the second VNode to check
|
|
578
|
+
* @returns whether they're equal or not
|
|
579
|
+
*/
|
|
580
|
+
const isSameVnode = (leftVNode, rightVNode) => {
|
|
449
581
|
// compare if two vnode to see if they're "technically" the same
|
|
450
582
|
// need to have the same element tag, and same key to be the same
|
|
451
|
-
if (
|
|
583
|
+
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
|
452
584
|
return true;
|
|
453
585
|
}
|
|
454
586
|
return false;
|
|
455
587
|
};
|
|
588
|
+
/**
|
|
589
|
+
* Handle reconciling an outdated VNode with a new one which corresponds to
|
|
590
|
+
* it. This function handles flushing updates to the DOM and reconciling the
|
|
591
|
+
* children of the two nodes (if any).
|
|
592
|
+
*
|
|
593
|
+
* @param oldVNode an old VNode whose DOM element and children we want to update
|
|
594
|
+
* @param newVNode a new VNode representing an updated version of the old one
|
|
595
|
+
*/
|
|
456
596
|
const patch = (oldVNode, newVNode) => {
|
|
457
597
|
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
|
458
598
|
const oldChildren = oldVNode.$children$;
|
|
@@ -464,7 +604,6 @@ const patch = (oldVNode, newVNode) => {
|
|
|
464
604
|
// only add this to the when the compiler sees we're using an svg somewhere
|
|
465
605
|
isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
|
|
466
606
|
}
|
|
467
|
-
// element node
|
|
468
607
|
{
|
|
469
608
|
{
|
|
470
609
|
// either this is the first render of an element OR it's an update
|
|
@@ -475,6 +614,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
475
614
|
}
|
|
476
615
|
if (oldChildren !== null && newChildren !== null) {
|
|
477
616
|
// looks like there's child vnodes for both the old and new vnodes
|
|
617
|
+
// so we need to call `updateChildren` to reconcile them
|
|
478
618
|
updateChildren(elm, oldChildren, newVNode, newChildren);
|
|
479
619
|
}
|
|
480
620
|
else if (newChildren !== null) {
|
|
@@ -496,7 +636,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
496
636
|
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
|
497
637
|
hostTagName = hostElm.tagName;
|
|
498
638
|
rootVnode.$tag$ = null;
|
|
499
|
-
rootVnode.$flags$ |= 4 /* isHost */;
|
|
639
|
+
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
|
500
640
|
hostRef.$vnode$ = rootVnode;
|
|
501
641
|
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
|
|
502
642
|
{
|
|
@@ -524,10 +664,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
|
524
664
|
};
|
|
525
665
|
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
526
666
|
{
|
|
527
|
-
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
|
|
667
|
+
hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
528
668
|
}
|
|
529
|
-
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
|
530
|
-
hostRef.$flags$ |= 512 /* needsRerender */;
|
|
669
|
+
if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
|
|
670
|
+
hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
|
|
531
671
|
return;
|
|
532
672
|
}
|
|
533
673
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
|
@@ -574,7 +714,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
574
714
|
}
|
|
575
715
|
else {
|
|
576
716
|
Promise.all(childrenPromises).then(postUpdate);
|
|
577
|
-
hostRef.$flags$ |= 4 /* isWaitingForChildren */;
|
|
717
|
+
hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
|
|
578
718
|
childrenPromises.length = 0;
|
|
579
719
|
}
|
|
580
720
|
}
|
|
@@ -583,10 +723,10 @@ const callRender = (hostRef, instance, elm) => {
|
|
|
583
723
|
try {
|
|
584
724
|
instance = instance.render() ;
|
|
585
725
|
{
|
|
586
|
-
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
|
|
726
|
+
hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
587
727
|
}
|
|
588
728
|
{
|
|
589
|
-
hostRef.$flags$ |= 2 /* hasRendered */;
|
|
729
|
+
hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
|
|
590
730
|
}
|
|
591
731
|
{
|
|
592
732
|
{
|
|
@@ -610,8 +750,8 @@ const postUpdateComponent = (hostRef) => {
|
|
|
610
750
|
const endPostUpdate = createTime('postUpdate', tagName);
|
|
611
751
|
const instance = hostRef.$lazyInstance$ ;
|
|
612
752
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
613
|
-
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
614
|
-
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
753
|
+
if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
|
|
754
|
+
hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
|
|
615
755
|
{
|
|
616
756
|
// DOM WRITE!
|
|
617
757
|
addHydratedFlag(elm);
|
|
@@ -637,10 +777,10 @@ const postUpdateComponent = (hostRef) => {
|
|
|
637
777
|
hostRef.$onRenderResolve$();
|
|
638
778
|
hostRef.$onRenderResolve$ = undefined;
|
|
639
779
|
}
|
|
640
|
-
if (hostRef.$flags$ & 512 /* needsRerender */) {
|
|
780
|
+
if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
|
|
641
781
|
nextTick(() => scheduleUpdate(hostRef, false));
|
|
642
782
|
}
|
|
643
|
-
hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
|
|
783
|
+
hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
|
|
644
784
|
}
|
|
645
785
|
// ( •_•)
|
|
646
786
|
// ( •_•)>⌐■-■
|
|
@@ -696,7 +836,7 @@ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
|
696
836
|
const parsePropertyValue = (propValue, propType) => {
|
|
697
837
|
// ensure this value is of the correct prop type
|
|
698
838
|
if (propValue != null && !isComplexType(propValue)) {
|
|
699
|
-
if (propType & 2 /* Number */) {
|
|
839
|
+
if (propType & 2 /* MEMBER_FLAGS.Number */) {
|
|
700
840
|
// force it to be a number
|
|
701
841
|
return parseFloat(propValue);
|
|
702
842
|
}
|
|
@@ -718,12 +858,12 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
718
858
|
// explicitly check for NaN on both sides, as `NaN === NaN` is always false
|
|
719
859
|
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
|
720
860
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
721
|
-
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
861
|
+
if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
722
862
|
// gadzooks! the property's value has changed!!
|
|
723
863
|
// set our new value!
|
|
724
864
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
725
865
|
if (instance) {
|
|
726
|
-
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
866
|
+
if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
727
867
|
// looks like this value actually changed, so we've got work to do!
|
|
728
868
|
// but only if we've already rendered, otherwise just chill out
|
|
729
869
|
// queue that we need to do an update, but don't worry about queuing
|
|
@@ -739,8 +879,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
739
879
|
const members = Object.entries(cmpMeta.$members$);
|
|
740
880
|
const prototype = Cstr.prototype;
|
|
741
881
|
members.map(([memberName, [memberFlags]]) => {
|
|
742
|
-
if ((memberFlags & 31 /* Prop */ ||
|
|
743
|
-
((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
|
882
|
+
if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
|
|
883
|
+
((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
|
|
744
884
|
// proxyComponent - prop
|
|
745
885
|
Object.defineProperty(prototype, memberName, {
|
|
746
886
|
get() {
|
|
@@ -756,7 +896,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
756
896
|
});
|
|
757
897
|
}
|
|
758
898
|
});
|
|
759
|
-
if ((flags & 1 /* isElementConstructor */)) {
|
|
899
|
+
if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
|
|
760
900
|
const attrNameToPropName = new Map();
|
|
761
901
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
|
762
902
|
plt.jmp(() => {
|
|
@@ -812,7 +952,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
812
952
|
// create an array of attributes to observe
|
|
813
953
|
// and also create a map of html attribute name to js property name
|
|
814
954
|
Cstr.observedAttributes = members
|
|
815
|
-
.filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
|
|
955
|
+
.filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
|
|
816
956
|
.map(([propName, m]) => {
|
|
817
957
|
const attrName = m[1] || propName;
|
|
818
958
|
attrNameToPropName.set(attrName, propName);
|
|
@@ -824,10 +964,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
824
964
|
};
|
|
825
965
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
826
966
|
// initializeComponent
|
|
827
|
-
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
967
|
+
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
|
828
968
|
{
|
|
829
969
|
// we haven't initialized this element yet
|
|
830
|
-
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
970
|
+
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
|
831
971
|
// lazy loaded components
|
|
832
972
|
// request the component's implementation to be
|
|
833
973
|
// wired up with the host element
|
|
@@ -839,7 +979,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
839
979
|
endLoad();
|
|
840
980
|
}
|
|
841
981
|
if (!Cstr.isProxied) {
|
|
842
|
-
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
982
|
+
proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
|
|
843
983
|
Cstr.isProxied = true;
|
|
844
984
|
}
|
|
845
985
|
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
|
|
@@ -847,7 +987,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
847
987
|
// but let's keep track of when we start and stop
|
|
848
988
|
// so that the getters/setters don't incorrectly step on data
|
|
849
989
|
{
|
|
850
|
-
hostRef.$flags$ |= 8 /* isConstructingInstance */;
|
|
990
|
+
hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
|
|
851
991
|
}
|
|
852
992
|
// construct the lazy-loaded component implementation
|
|
853
993
|
// passing the hostRef is very important during
|
|
@@ -860,7 +1000,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
860
1000
|
consoleError(e);
|
|
861
1001
|
}
|
|
862
1002
|
{
|
|
863
|
-
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
|
1003
|
+
hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
|
|
864
1004
|
}
|
|
865
1005
|
endNewInstance();
|
|
866
1006
|
}
|
|
@@ -870,7 +1010,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
870
1010
|
const scopeId = getScopeId(cmpMeta);
|
|
871
1011
|
if (!styles.has(scopeId)) {
|
|
872
1012
|
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
|
873
|
-
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
|
1013
|
+
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
|
874
1014
|
endRegisterStyles();
|
|
875
1015
|
}
|
|
876
1016
|
}
|
|
@@ -892,13 +1032,13 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
892
1032
|
}
|
|
893
1033
|
};
|
|
894
1034
|
const connectedCallback = (elm) => {
|
|
895
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1035
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
896
1036
|
const hostRef = getHostRef(elm);
|
|
897
1037
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
898
1038
|
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
|
|
899
|
-
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
|
1039
|
+
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
|
900
1040
|
// first time this component has connected
|
|
901
|
-
hostRef.$flags$ |= 1 /* hasConnected */;
|
|
1041
|
+
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
|
902
1042
|
{
|
|
903
1043
|
// find the first ancestor component (if there is one) and register
|
|
904
1044
|
// this component as one of the actively loading child components for its ancestor
|
|
@@ -918,7 +1058,7 @@ const connectedCallback = (elm) => {
|
|
|
918
1058
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
919
1059
|
if (cmpMeta.$members$) {
|
|
920
1060
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
921
|
-
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1061
|
+
if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
|
|
922
1062
|
const value = elm[memberName];
|
|
923
1063
|
delete elm[memberName];
|
|
924
1064
|
elm[memberName] = value;
|
|
@@ -933,7 +1073,7 @@ const connectedCallback = (elm) => {
|
|
|
933
1073
|
}
|
|
934
1074
|
};
|
|
935
1075
|
const disconnectedCallback = (elm) => {
|
|
936
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1076
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
937
1077
|
const hostRef = getHostRef(elm);
|
|
938
1078
|
const instance = hostRef.$lazyInstance$ ;
|
|
939
1079
|
{
|
|
@@ -973,7 +1113,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
973
1113
|
super(self);
|
|
974
1114
|
self = this;
|
|
975
1115
|
registerHost(self, cmpMeta);
|
|
976
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1116
|
+
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
977
1117
|
// this component is using shadow dom
|
|
978
1118
|
// and this browser supports shadow dom
|
|
979
1119
|
// add the read-only property "shadowRoot" to the host element
|
|
@@ -1008,7 +1148,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1008
1148
|
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
|
1009
1149
|
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
|
1010
1150
|
cmpTags.push(tagName);
|
|
1011
|
-
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
|
|
1151
|
+
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
|
|
1012
1152
|
}
|
|
1013
1153
|
});
|
|
1014
1154
|
});
|
|
@@ -1030,7 +1170,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1030
1170
|
// Fallback appLoad event
|
|
1031
1171
|
endBootstrap();
|
|
1032
1172
|
};
|
|
1033
|
-
const hostRefs = new WeakMap();
|
|
1173
|
+
const hostRefs = /*@__PURE__*/ new WeakMap();
|
|
1034
1174
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
1035
1175
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
1036
1176
|
const registerHost = (elm, cmpMeta) => {
|
|
@@ -1071,14 +1211,14 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1071
1211
|
return importedModule[exportName];
|
|
1072
1212
|
}, consoleError);
|
|
1073
1213
|
};
|
|
1074
|
-
const styles = new Map();
|
|
1214
|
+
const styles = /*@__PURE__*/ new Map();
|
|
1075
1215
|
const queueDomReads = [];
|
|
1076
1216
|
const queueDomWrites = [];
|
|
1077
1217
|
const queueTask = (queue, write) => (cb) => {
|
|
1078
1218
|
queue.push(cb);
|
|
1079
1219
|
if (!queuePending) {
|
|
1080
1220
|
queuePending = true;
|
|
1081
|
-
if (write && plt.$flags$ & 4 /* queueSync */) {
|
|
1221
|
+
if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
|
|
1082
1222
|
nextTick(flush);
|
|
1083
1223
|
}
|
|
1084
1224
|
else {
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -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-5ea1be96.js');
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
|
-
Stencil Client Patch Esm v2.
|
|
8
|
+
Stencil Client Patch Esm v2.18.0 | MIT Licensed | https://stenciljs.com
|
|
9
9
|
*/
|
|
10
10
|
const patchEsm = () => {
|
|
11
11
|
return index.promiseResolve();
|