@sth87/shadcn-design-system 0.3.0 → 0.3.1
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
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("dayjs"),N=require("dayjs/plugin/customParseFormat");h.extend(N);const b=new Set(["y","M","L","d","E","H","h","m","s","S","a"]),y=/[A-Za-z]/,v="en-US";function S(e){const r=[];let n=0;for(;n<e.length;){const t=e[n];if(t==="'"){if(e[n+1]==="'"){r.push({kind:"literal",text:"'"}),n+=2;continue}let c="";for(n+=1;n<e.length;){if(e[n]==="'"){if(e[n+1]==="'"){c+="'",n+=2;continue}break}c+=e[n],n+=1}n+=1,r.push({kind:"literal",text:c});continue}if(!y.test(t)){r.push({kind:"literal",text:t}),n+=1;continue}let s=1;for(;e[n+s]===t;)s+=1;if(!b.has(t))throw new RangeError(`Unsupported date format token "${t.repeat(s)}" in "${e}"`);r.push({kind:"field",letter:t,count:s}),n+=s}return r}function D(e){return y.test(e)?`[${e.replace(/]/g,"")}]`:e}function o(e,r){throw new RangeError(`Unsupported date format token "${e.letter.repeat(e.count)}" in "${r}"`)}function x(e,r){const{letter:n,count:t}=e;switch(n){case"y":return t===2?"YY":t===4?"YYYY":o(e,r);case"M":case"L":return t<=2?"M".repeat(t):null;case"d":return t<=2?"D".repeat(t):o(e,r);case"E":return null;case"H":case"h":case"m":case"s":return t<=2?n.repeat(t):o(e,r);case"S":return t===3?"SSS":o(e,r);case"a":return t<=2?"A":t===3?"a":o(e,r);default:return o(e,r)}}function O(e,r,n,t){const{letter:s,count:c}=r,d=s==="M"||s==="L";if(d?c!==3&&c!==4:c>4)return o(r,n);const i=c===4;if(t){const m=i?"wide":"abbreviated",u=s==="L"?"standalone":"formatting";return d?t.localize.month(e.getMonth(),{width:m,context:u}):t.localize.day(e.getDay(),{width:m,context:u})}const f=d?{month:i?"long":"short"}:{weekday:i?"long":"short"};return new Intl.DateTimeFormat(v,f).format(e)}function R(e,r,n){if(Number.isNaN(e.getTime()))throw new RangeError("Invalid time value");const t=S(r).map(s=>s.kind==="literal"?D(s.text):x(s,r)??`[${O(e,s,r,n)}]`);return h(e).format(t.join(""))}function L(e){return!!e&&!Number.isNaN(e.getTime())}const w=["year","month","day","hour","minute","second","ms"];function A(e){switch(e){case"y":return"year";case"M":case"L":return"month";case"d":return"day";case"H":case"h":case"a":return"hour";case"m":return"minute";case"s":return"second";default:return"ms"}}function $(e,r){const{letter:n,count:t}=e;switch(n){case"y":return t===2?"YY":t===4?"YYYY":o(e,r);case"M":case"L":return t<=2?"M":t===3?"MMM":t===4?"MMMM":o(e,r);case"d":return t<=2?"D":o(e,r);case"H":case"h":case"m":case"s":return t<=2?n:o(e,r);case"S":return t===3?"SSS":o(e,r);case"a":return"A";default:return o(e,r)}}const M=e=>e.replace(/\d+/g,r=>String(Number(r))).toLowerCase();function z(e,r,n=new Date){const t=S(r),s=t.filter(a=>a.kind==="field");if(!s.length)return;const c=t.map(a=>a.kind==="literal"?D(a.text):$(a,r)).join(""),d=e.trim(),i=h(d,c,"en");if(!i.isValid()||M(i.format(c))!==M(d))return;const f=new Set(s.map(a=>A(a.letter))),m=Math.min(...[...f].map(a=>w.indexOf(a))),u=n,l=(a,E,T,Y)=>{const p=w.indexOf(a);return f.has(a)?E:p<m?T:Y},g=new Date(l("year",i.year(),u.getFullYear(),0),l("month",i.month(),u.getMonth(),0),l("day",i.date(),u.getDate(),1),l("hour",i.hour(),u.getHours(),0),l("minute",i.minute(),u.getMinutes(),0),l("second",i.second(),u.getSeconds(),0),l("ms",i.millisecond(),u.getMilliseconds(),0));return L(g)?g:void 0}exports.formatDate=R;exports.isValidDate=L;exports.parseDate=z;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("dayjs"),N=require("dayjs/plugin/customParseFormat.js");h.extend(N);const b=new Set(["y","M","L","d","E","H","h","m","s","S","a"]),y=/[A-Za-z]/,v="en-US";function S(e){const r=[];let n=0;for(;n<e.length;){const t=e[n];if(t==="'"){if(e[n+1]==="'"){r.push({kind:"literal",text:"'"}),n+=2;continue}let c="";for(n+=1;n<e.length;){if(e[n]==="'"){if(e[n+1]==="'"){c+="'",n+=2;continue}break}c+=e[n],n+=1}n+=1,r.push({kind:"literal",text:c});continue}if(!y.test(t)){r.push({kind:"literal",text:t}),n+=1;continue}let s=1;for(;e[n+s]===t;)s+=1;if(!b.has(t))throw new RangeError(`Unsupported date format token "${t.repeat(s)}" in "${e}"`);r.push({kind:"field",letter:t,count:s}),n+=s}return r}function D(e){return y.test(e)?`[${e.replace(/]/g,"")}]`:e}function o(e,r){throw new RangeError(`Unsupported date format token "${e.letter.repeat(e.count)}" in "${r}"`)}function x(e,r){const{letter:n,count:t}=e;switch(n){case"y":return t===2?"YY":t===4?"YYYY":o(e,r);case"M":case"L":return t<=2?"M".repeat(t):null;case"d":return t<=2?"D".repeat(t):o(e,r);case"E":return null;case"H":case"h":case"m":case"s":return t<=2?n.repeat(t):o(e,r);case"S":return t===3?"SSS":o(e,r);case"a":return t<=2?"A":t===3?"a":o(e,r);default:return o(e,r)}}function O(e,r,n,t){const{letter:s,count:c}=r,d=s==="M"||s==="L";if(d?c!==3&&c!==4:c>4)return o(r,n);const i=c===4;if(t){const m=i?"wide":"abbreviated",u=s==="L"?"standalone":"formatting";return d?t.localize.month(e.getMonth(),{width:m,context:u}):t.localize.day(e.getDay(),{width:m,context:u})}const f=d?{month:i?"long":"short"}:{weekday:i?"long":"short"};return new Intl.DateTimeFormat(v,f).format(e)}function R(e,r,n){if(Number.isNaN(e.getTime()))throw new RangeError("Invalid time value");const t=S(r).map(s=>s.kind==="literal"?D(s.text):x(s,r)??`[${O(e,s,r,n)}]`);return h(e).format(t.join(""))}function L(e){return!!e&&!Number.isNaN(e.getTime())}const w=["year","month","day","hour","minute","second","ms"];function A(e){switch(e){case"y":return"year";case"M":case"L":return"month";case"d":return"day";case"H":case"h":case"a":return"hour";case"m":return"minute";case"s":return"second";default:return"ms"}}function $(e,r){const{letter:n,count:t}=e;switch(n){case"y":return t===2?"YY":t===4?"YYYY":o(e,r);case"M":case"L":return t<=2?"M":t===3?"MMM":t===4?"MMMM":o(e,r);case"d":return t<=2?"D":o(e,r);case"H":case"h":case"m":case"s":return t<=2?n:o(e,r);case"S":return t===3?"SSS":o(e,r);case"a":return"A";default:return o(e,r)}}const M=e=>e.replace(/\d+/g,r=>String(Number(r))).toLowerCase();function z(e,r,n=new Date){const t=S(r),s=t.filter(a=>a.kind==="field");if(!s.length)return;const c=t.map(a=>a.kind==="literal"?D(a.text):$(a,r)).join(""),d=e.trim(),i=h(d,c,"en");if(!i.isValid()||M(i.format(c))!==M(d))return;const f=new Set(s.map(a=>A(a.letter))),m=Math.min(...[...f].map(a=>w.indexOf(a))),u=n,l=(a,E,T,Y)=>{const p=w.indexOf(a);return f.has(a)?E:p<m?T:Y},g=new Date(l("year",i.year(),u.getFullYear(),0),l("month",i.month(),u.getMonth(),0),l("day",i.date(),u.getDate(),1),l("hour",i.hour(),u.getHours(),0),l("minute",i.minute(),u.getMinutes(),0),l("second",i.second(),u.getSeconds(),0),l("ms",i.millisecond(),u.getMilliseconds(),0));return L(g)?g:void 0}exports.formatDate=R;exports.isValidDate=L;exports.parseDate=z;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import h from "dayjs";
|
|
2
|
-
import T from "dayjs/plugin/customParseFormat";
|
|
2
|
+
import T from "dayjs/plugin/customParseFormat.js";
|
|
3
3
|
h.extend(T);
|
|
4
4
|
const x = /* @__PURE__ */ new Set(["y", "M", "L", "d", "E", "H", "h", "m", "s", "S", "a"]), y = /[A-Za-z]/, N = "en-US";
|
|
5
5
|
function S(e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-format.d.ts","sourceRoot":"","sources":["../../../../../../src/utils/date-format.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"date-format.d.ts","sourceRoot":"","sources":["../../../../../../src/utils/date-format.ts"],"names":[],"mappings":"AAmHA;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,aAAa,GAAG,MAAM,CAAC;IAC9B,OAAO,EAAE,YAAY,GAAG,YAAY,CAAC;CACtC;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE;QACR,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAAC;QACxD,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAAC;KACvD,CAAC;CACH;AA0BD,mGAAmG;AACnG,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,eAAe,GAAG,MAAM,CAQxF;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,IAAI,IAAI,CAEvE;AAsDD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,GAAE,IAAiB,GAAG,IAAI,GAAG,SAAS,CAiCvG"}
|