kempo-ui 0.4.7 → 0.4.8

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/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [0.4.3] - 2026-04-30
8
+ ### Added
9
+ - Initial CHANGELOG entry. All prior work is condensed into this log entry.
10
+
11
+ [0.4.3]: https://github.com/dustinpoissant/kempo-ui/releases/tag/v0.4.3
@@ -1 +1 @@
1
- import{html as t}from"../lit-all.min.js";import e from"./ShadowComponent.js";import s from"../utils/formatTimestamp.js";export default class m extends e{static properties={timestamp:{type:Number,reflect:!0},format:{type:String,reflect:!0},locale:{type:String,reflect:!0}};constructor(){super(),this.timestamp=0,this.format="",this.locale=""}render(){const e=this.timestamp?s(this.timestamp,this.format,this.locale||navigator.language):"";return t`<span>${e}</span>`}}window.customElements.define("k-timestamp",m);
1
+ import{html as t}from"../lit-all.min.js";import e from"./ShadowComponent.js";import s from"../utils/formatTimestamp.js";export default class i extends e{static properties={timestamp:{type:String,reflect:!0},format:{type:String,reflect:!0},locale:{type:String,reflect:!0}};constructor(){super(),this.timestamp="",this.format="",this.locale=""}render(){const e=this.timestamp?s(this.timestamp,this.format,this.locale||navigator.language):"";return t`<span>${e}</span>`}}window.customElements.define("k-timestamp",i);
@@ -1 +1 @@
1
- export default(e,i,t)=>{const s=new Date(parseInt(e));if(i){const e=(e,i)=>("000"+e).slice(-1*i),t={YYYY:s.getFullYear(),YY:String(s.getFullYear()).slice(-2),MM:e(s.getMonth()+1,2),M:s.getMonth()+1,DD:e(s.getDate(),2),D:s.getDate(),hh:e(s.getHours(),2),h:s.getHours(),mm:e(s.getMinutes(),2),m:s.getMinutes(),ss:e(s.getSeconds(),2),s:s.getSeconds(),iiii:e(s.getMilliseconds(),3),iii:e(s.getMilliseconds(),3),ii:e(s.getMilliseconds(),2),i:s.getMilliseconds()};return i.replace(/YYYY|YY|MM|M|DD|D|hh|h|mm|m|ss|s|iiii|iii|ii|i/g,e=>t[e])}return s.toLocaleString(t||Intl.DateTimeFormat().resolvedOptions().locale)};
1
+ export default(e,i,t)=>{const s=isNaN(e)?Date.parse(e):parseInt(e),l=new Date(s);if(i){const e=(e,i)=>("000"+e).slice(-1*i),t={YYYY:l.getFullYear(),YY:String(l.getFullYear()).slice(-2),MM:e(l.getMonth()+1,2),M:l.getMonth()+1,DD:e(l.getDate(),2),D:l.getDate(),hh:e(l.getHours(),2),h:l.getHours(),mm:e(l.getMinutes(),2),m:l.getMinutes(),ss:e(l.getSeconds(),2),s:l.getSeconds(),iiii:e(l.getMilliseconds(),3),iii:e(l.getMilliseconds(),3),ii:e(l.getMilliseconds(),2),i:l.getMilliseconds()};return i.replace(/YYYY|YY|MM|M|DD|D|hh|h|mm|m|ss|s|iiii|iii|ii|i/g,e=>t[e])}return l.toLocaleString(t||Intl.DateTimeFormat().resolvedOptions().locale)};
@@ -1 +1 @@
1
- import{html as t}from"../lit-all.min.js";import e from"./ShadowComponent.js";import s from"../utils/formatTimestamp.js";export default class m extends e{static properties={timestamp:{type:Number,reflect:!0},format:{type:String,reflect:!0},locale:{type:String,reflect:!0}};constructor(){super(),this.timestamp=0,this.format="",this.locale=""}render(){const e=this.timestamp?s(this.timestamp,this.format,this.locale||navigator.language):"";return t`<span>${e}</span>`}}window.customElements.define("k-timestamp",m);
1
+ import{html as t}from"../lit-all.min.js";import e from"./ShadowComponent.js";import s from"../utils/formatTimestamp.js";export default class i extends e{static properties={timestamp:{type:String,reflect:!0},format:{type:String,reflect:!0},locale:{type:String,reflect:!0}};constructor(){super(),this.timestamp="",this.format="",this.locale=""}render(){const e=this.timestamp?s(this.timestamp,this.format,this.locale||navigator.language):"";return t`<span>${e}</span>`}}window.customElements.define("k-timestamp",i);
@@ -1 +1 @@
1
- export default(e,i,t)=>{const s=new Date(parseInt(e));if(i){const e=(e,i)=>("000"+e).slice(-1*i),t={YYYY:s.getFullYear(),YY:String(s.getFullYear()).slice(-2),MM:e(s.getMonth()+1,2),M:s.getMonth()+1,DD:e(s.getDate(),2),D:s.getDate(),hh:e(s.getHours(),2),h:s.getHours(),mm:e(s.getMinutes(),2),m:s.getMinutes(),ss:e(s.getSeconds(),2),s:s.getSeconds(),iiii:e(s.getMilliseconds(),3),iii:e(s.getMilliseconds(),3),ii:e(s.getMilliseconds(),2),i:s.getMilliseconds()};return i.replace(/YYYY|YY|MM|M|DD|D|hh|h|mm|m|ss|s|iiii|iii|ii|i/g,e=>t[e])}return s.toLocaleString(t||Intl.DateTimeFormat().resolvedOptions().locale)};
1
+ export default(e,i,t)=>{const s=isNaN(e)?Date.parse(e):parseInt(e),l=new Date(s);if(i){const e=(e,i)=>("000"+e).slice(-1*i),t={YYYY:l.getFullYear(),YY:String(l.getFullYear()).slice(-2),MM:e(l.getMonth()+1,2),M:l.getMonth()+1,DD:e(l.getDate(),2),D:l.getDate(),hh:e(l.getHours(),2),h:l.getHours(),mm:e(l.getMinutes(),2),m:l.getMinutes(),ss:e(l.getSeconds(),2),s:l.getSeconds(),iiii:e(l.getMilliseconds(),3),iii:e(l.getMilliseconds(),3),ii:e(l.getMilliseconds(),2),i:l.getMilliseconds()};return i.replace(/YYYY|YY|MM|M|DD|D|hh|h|mm|m|ss|s|iiii|iii|ii|i/g,e=>t[e])}return l.toLocaleString(t||Intl.DateTimeFormat().resolvedOptions().locale)};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kempo-ui",
3
- "version": "0.4.7",
3
+ "version": "0.4.8",
4
4
  "type": "module",
5
5
  "description": "A Lit based web-component library",
6
6
  "main": "index.js",
@@ -4,14 +4,14 @@ import formatTimestamp from '../utils/formatTimestamp.js';
4
4
 
5
5
  export default class Timestamp extends ShadowComponent {
6
6
  static properties = {
7
- timestamp: { type: Number, reflect: true },
7
+ timestamp: { type: String, reflect: true },
8
8
  format: { type: String, reflect: true },
9
9
  locale: { type: String, reflect: true }
10
10
  };
11
11
 
12
12
  constructor() {
13
13
  super();
14
- this.timestamp = 0;
14
+ this.timestamp = '';
15
15
  this.format = '';
16
16
  this.locale = '';
17
17
  }
@@ -20,7 +20,7 @@ export default class Timestamp extends ShadowComponent {
20
20
  Rendering Logic
21
21
  */
22
22
  render() {
23
- const formattedTime = this.timestamp
23
+ const formattedTime = this.timestamp
24
24
  ? formatTimestamp(this.timestamp, this.format, this.locale || navigator.language)
25
25
  : '';
26
26
 
@@ -1,5 +1,6 @@
1
1
  export default (timestamp, format, forceLocale) => {
2
- const date = new Date(parseInt(timestamp));
2
+ const ms = isNaN(timestamp) ? Date.parse(timestamp) : parseInt(timestamp);
3
+ const date = new Date(ms);
3
4
  if (format) {
4
5
  const pad = (num, size) => ('000' + num).slice(size * -1);
5
6
  const tokens = {