analog-clock-components 0.1.366 → 0.1.368

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.
@@ -1 +1 @@
1
- import{p as e,b as o}from"./p-451de3ca.js";export{s as setNonce}from"./p-451de3ca.js";(()=>{const o=import.meta.url,s={};return""!==o&&(s.resourcesUrl=new URL(".",o).href),e(s)})().then((e=>o([["p-d8e50134",[[1,"analog-clock",{size:[2],timeZone:[2,"time-zone"],time:[32]}]]]],e)));
1
+ import{p as e,b as o}from"./p-7a1dd0d9.js";export{s as setNonce}from"./p-7a1dd0d9.js";(()=>{const o=import.meta.url,s={};return""!==o&&(s.resourcesUrl=new URL(".",o).href),e(s)})().then((e=>o([["p-c0d180f3",[[1,"analog-clock",{size:[2],timeZone:[2,"time-zone"],time:[32]}]]]],e)));
@@ -1 +1 @@
1
- import{r as t,h as e}from"./p-451de3ca.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}
1
+ import{r as t,h as e}from"./p-7a1dd0d9.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-a22a8034.js');
5
+ const index = require('./index-90279adf.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
 
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-a22a8034.js');
5
+ const index = require('./index-90279adf.js');
6
6
 
7
7
  /*
8
- Stencil Client Patch Browser v2.22.1 | MIT Licensed | https://stenciljs.com
8
+ Stencil Client Patch Browser v2.22.2 | 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('analog-clock.cjs.js', document.baseURI).href));
@@ -138,6 +138,14 @@ const h = (nodeName, vnodeData, ...children) => {
138
138
  }
139
139
  return vnode;
140
140
  };
141
+ /**
142
+ * A utility function for creating a virtual DOM node from a tag and some
143
+ * possible text content.
144
+ *
145
+ * @param tag the tag for this element
146
+ * @param text possible text content for the node
147
+ * @returns a newly-minted virtual DOM node
148
+ */
141
149
  const newVNode = (tag, text) => {
142
150
  const vnode = {
143
151
  $flags$: 0,
@@ -152,6 +160,12 @@ const newVNode = (tag, text) => {
152
160
  return vnode;
153
161
  };
154
162
  const Host = {};
163
+ /**
164
+ * Check whether a given node is a Host node or not
165
+ *
166
+ * @param node the virtual DOM node to check
167
+ * @returns whether it's a Host node or not
168
+ */
155
169
  const isHost = (node) => node && node.$tag$ === Host;
156
170
  /**
157
171
  * Parse a new property value for a given property type.
@@ -417,6 +431,21 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
417
431
  }
418
432
  return elm;
419
433
  };
434
+ /**
435
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
436
+ * add them to the DOM in the appropriate place.
437
+ *
438
+ * @param parentElm the DOM node which should be used as a parent for the new
439
+ * DOM nodes
440
+ * @param before a child of the `parentElm` which the new children should be
441
+ * inserted before (optional)
442
+ * @param parentVNode the parent virtual DOM node
443
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
444
+ * @param startIdx the index in the child virtual DOM nodes at which to start
445
+ * creating DOM nodes (inclusive)
446
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
447
+ * creating DOM nodes (inclusive)
448
+ */
420
449
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
421
450
  let containerElm = (parentElm);
422
451
  let childNode;
@@ -433,6 +462,19 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
433
462
  }
434
463
  }
435
464
  };
465
+ /**
466
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
467
+ * This can be used to, for instance, clean up after a list of children which
468
+ * should no longer be shown.
469
+ *
470
+ * This function also handles some of Stencil's slot relocation logic.
471
+ *
472
+ * @param vnodes a list of virtual DOM nodes to remove
473
+ * @param startIdx the index at which to start removing nodes (inclusive)
474
+ * @param endIdx the index at which to stop removing nodes (inclusive)
475
+ * @param vnode a VNode
476
+ * @param elm an element
477
+ */
436
478
  const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
437
479
  for (; startIdx <= endIdx; ++startIdx) {
438
480
  if ((vnode = vnodes[startIdx])) {
@@ -624,7 +666,8 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
624
666
  *
625
667
  * So, in other words, if `key` attrs are not set on VNodes which may be
626
668
  * changing order within a `children` array or something along those lines then
627
- * we could obtain a false positive and then have to do needless re-rendering.
669
+ * we could obtain a false negative and then have to do needless re-rendering
670
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
628
671
  *
629
672
  * @param leftVNode the first VNode to check
630
673
  * @param rightVNode the second VNode to check
@@ -683,6 +726,18 @@ const patch = (oldVNode, newVNode) => {
683
726
  }
684
727
  }
685
728
  };
729
+ /**
730
+ * The main entry point for Stencil's virtual DOM-based rendering engine
731
+ *
732
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
733
+ * function will handle creating a virtual DOM tree with a single root, patching
734
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
735
+ * relocation, and reflecting attributes.
736
+ *
737
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
738
+ * the DOM node into which it should be rendered.
739
+ * @param renderFnResults the virtual DOM nodes to be rendered
740
+ */
686
741
  const renderVdom = (hostRef, renderFnResults) => {
687
742
  const hostElm = hostRef.$hostElement$;
688
743
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-a22a8034.js');
5
+ const index = require('./index-90279adf.js');
6
6
 
7
7
  /*
8
- Stencil Client Patch Esm v2.22.1 | MIT Licensed | https://stenciljs.com
8
+ Stencil Client Patch Esm v2.22.2 | MIT Licensed | https://stenciljs.com
9
9
  */
10
10
  const patchEsm = () => {
11
11
  return index.promiseResolve();
@@ -4,7 +4,7 @@
4
4
  ],
5
5
  "compiler": {
6
6
  "name": "@stencil/core",
7
- "version": "2.22.1",
7
+ "version": "2.22.2",
8
8
  "typescriptVersion": "4.9.4"
9
9
  },
10
10
  "collections": [],
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h } from './index-62b63d0e.js';
1
+ import { r as registerInstance, h } from './index-d01063ab.js';
2
2
 
3
3
  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)}";
4
4
 
@@ -1,8 +1,8 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-62b63d0e.js';
2
- export { s as setNonce } from './index-62b63d0e.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-d01063ab.js';
2
+ export { s as setNonce } from './index-d01063ab.js';
3
3
 
4
4
  /*
5
- Stencil Client Patch Browser v2.22.1 | MIT Licensed | https://stenciljs.com
5
+ Stencil Client Patch Browser v2.22.2 | MIT Licensed | https://stenciljs.com
6
6
  */
7
7
  const patchBrowser = () => {
8
8
  const importMeta = import.meta.url;
@@ -116,6 +116,14 @@ const h = (nodeName, vnodeData, ...children) => {
116
116
  }
117
117
  return vnode;
118
118
  };
119
+ /**
120
+ * A utility function for creating a virtual DOM node from a tag and some
121
+ * possible text content.
122
+ *
123
+ * @param tag the tag for this element
124
+ * @param text possible text content for the node
125
+ * @returns a newly-minted virtual DOM node
126
+ */
119
127
  const newVNode = (tag, text) => {
120
128
  const vnode = {
121
129
  $flags$: 0,
@@ -130,6 +138,12 @@ const newVNode = (tag, text) => {
130
138
  return vnode;
131
139
  };
132
140
  const Host = {};
141
+ /**
142
+ * Check whether a given node is a Host node or not
143
+ *
144
+ * @param node the virtual DOM node to check
145
+ * @returns whether it's a Host node or not
146
+ */
133
147
  const isHost = (node) => node && node.$tag$ === Host;
134
148
  /**
135
149
  * Parse a new property value for a given property type.
@@ -395,6 +409,21 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
395
409
  }
396
410
  return elm;
397
411
  };
412
+ /**
413
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
414
+ * add them to the DOM in the appropriate place.
415
+ *
416
+ * @param parentElm the DOM node which should be used as a parent for the new
417
+ * DOM nodes
418
+ * @param before a child of the `parentElm` which the new children should be
419
+ * inserted before (optional)
420
+ * @param parentVNode the parent virtual DOM node
421
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
422
+ * @param startIdx the index in the child virtual DOM nodes at which to start
423
+ * creating DOM nodes (inclusive)
424
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
425
+ * creating DOM nodes (inclusive)
426
+ */
398
427
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
399
428
  let containerElm = (parentElm);
400
429
  let childNode;
@@ -411,6 +440,19 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
411
440
  }
412
441
  }
413
442
  };
443
+ /**
444
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
445
+ * This can be used to, for instance, clean up after a list of children which
446
+ * should no longer be shown.
447
+ *
448
+ * This function also handles some of Stencil's slot relocation logic.
449
+ *
450
+ * @param vnodes a list of virtual DOM nodes to remove
451
+ * @param startIdx the index at which to start removing nodes (inclusive)
452
+ * @param endIdx the index at which to stop removing nodes (inclusive)
453
+ * @param vnode a VNode
454
+ * @param elm an element
455
+ */
414
456
  const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
415
457
  for (; startIdx <= endIdx; ++startIdx) {
416
458
  if ((vnode = vnodes[startIdx])) {
@@ -602,7 +644,8 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
602
644
  *
603
645
  * So, in other words, if `key` attrs are not set on VNodes which may be
604
646
  * changing order within a `children` array or something along those lines then
605
- * we could obtain a false positive and then have to do needless re-rendering.
647
+ * we could obtain a false negative and then have to do needless re-rendering
648
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
606
649
  *
607
650
  * @param leftVNode the first VNode to check
608
651
  * @param rightVNode the second VNode to check
@@ -661,6 +704,18 @@ const patch = (oldVNode, newVNode) => {
661
704
  }
662
705
  }
663
706
  };
707
+ /**
708
+ * The main entry point for Stencil's virtual DOM-based rendering engine
709
+ *
710
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
711
+ * function will handle creating a virtual DOM tree with a single root, patching
712
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
713
+ * relocation, and reflecting attributes.
714
+ *
715
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
716
+ * the DOM node into which it should be rendered.
717
+ * @param renderFnResults the virtual DOM nodes to be rendered
718
+ */
664
719
  const renderVdom = (hostRef, renderFnResults) => {
665
720
  const hostElm = hostRef.$hostElement$;
666
721
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
@@ -1,8 +1,8 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-62b63d0e.js';
2
- export { s as setNonce } from './index-62b63d0e.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-d01063ab.js';
2
+ export { s as setNonce } from './index-d01063ab.js';
3
3
 
4
4
  /*
5
- Stencil Client Patch Esm v2.22.1 | MIT Licensed | https://stenciljs.com
5
+ Stencil Client Patch Esm v2.22.2 | MIT Licensed | https://stenciljs.com
6
6
  */
7
7
  const patchEsm = () => {
8
8
  return promiseResolve();
@@ -485,6 +485,14 @@ export interface FunctionalUtilities {
485
485
  export interface FunctionalComponent<T = {}> {
486
486
  (props: T, children: VNode[], utils: FunctionalUtilities): VNode | VNode[];
487
487
  }
488
+ /**
489
+ * A Child VDOM node
490
+ *
491
+ * This has most of the same properties as {@link VNode} but friendlier names
492
+ * (i.e. `vtag` instead of `$tag$`, `vchildren` instead of `$children$`) in
493
+ * order to provide a friendlier public interface for users of the
494
+ * {@link FunctionalUtilities}).
495
+ */
488
496
  export interface ChildNode {
489
497
  vtag?: string | number | Function;
490
498
  vkey?: string | number;
@@ -531,6 +539,9 @@ export declare function h(sel: any, children: Array<VNode | undefined | null>):
531
539
  export declare function h(sel: any, data: VNodeData | null, text: string): VNode;
532
540
  export declare function h(sel: any, data: VNodeData | null, children: Array<VNode | undefined | null>): VNode;
533
541
  export declare function h(sel: any, data: VNodeData | null, children: VNode): VNode;
542
+ /**
543
+ * A virtual DOM node
544
+ */
534
545
  export interface VNode {
535
546
  $flags$: number;
536
547
  $tag$: string | number | Function;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "analog-clock-components",
3
- "version": "0.1.366",
3
+ "version": "0.1.368",
4
4
  "description": "Stencil Component Starter",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -17,8 +17,6 @@
17
17
  "scripts": {
18
18
  "build": "stencil build --docs",
19
19
  "start": "stencil build --dev --watch --serve",
20
- "test": "stencil test --spec --e2e",
21
- "test.watch": "stencil test --spec --e2e --watchAll",
22
20
  "generate": "stencil generate",
23
21
  "predeploy": "yarn build",
24
22
  "deploy": "yarn publish --patch",
@@ -27,17 +25,13 @@
27
25
  "format": "prettier --write src"
28
26
  },
29
27
  "dependencies": {
30
- "@stencil/core": "2.22.1"
28
+ "@stencil/core": "2.22.2"
31
29
  },
32
30
  "license": "MIT",
33
31
  "devDependencies": {
34
- "@types/jest": "29.2.5",
35
- "@types/puppeteer": "5.4.7",
36
- "cspell": "6.19.0",
32
+ "cspell": "6.19.2",
37
33
  "eslint": "8.32.0",
38
- "jest": "29.3.1",
39
34
  "prettier": "2.8.3",
40
- "puppeteer": "19.5.2",
41
35
  "tslint": "6.1.3",
42
36
  "typescript": "4.9.4"
43
37
  }