@agendize/vue-tools 0.0.1 → 0.0.2
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/index.d.ts +2 -1
- package/dist/utils/date.d.ts +1 -0
- package/dist/vue-tools.es.js +14 -1
- package/dist/vue-tools.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function dateToString(date: Date, short?: boolean): string;
|
package/dist/vue-tools.es.js
CHANGED
|
@@ -759,6 +759,19 @@ function useBlocState(bloc) {
|
|
|
759
759
|
});
|
|
760
760
|
return readonly(state);
|
|
761
761
|
}
|
|
762
|
+
function dateToString(date, short = false) {
|
|
763
|
+
var year = date.getFullYear();
|
|
764
|
+
var month = date.getMonth() + 1;
|
|
765
|
+
var day = date.getDate();
|
|
766
|
+
var hours = date.getHours();
|
|
767
|
+
var minutes = date.getMinutes();
|
|
768
|
+
var seconds = date.getSeconds();
|
|
769
|
+
if (short) {
|
|
770
|
+
return (day < 10 ? "0" + day : day) + "/" + (month < 10 ? "0" + month : month) + "/" + year;
|
|
771
|
+
} else {
|
|
772
|
+
return year + "-" + (month < 10 ? "0" + month : month) + "-" + (day < 10 ? "0" + day : day) + "T" + (hours < 10 ? "0" + hours : hours) + ":" + (minutes < 10 ? "0" + minutes : minutes) + ":" + (seconds < 10 ? "0" + seconds : seconds);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
762
775
|
class Bloc {
|
|
763
776
|
constructor(initialState) {
|
|
764
777
|
__publicField(this, "internalState");
|
|
@@ -784,4 +797,4 @@ class Bloc {
|
|
|
784
797
|
}
|
|
785
798
|
}
|
|
786
799
|
}
|
|
787
|
-
export { Bloc, useBlocState };
|
|
800
|
+
export { Bloc, dateToString, useBlocState };
|
package/dist/vue-tools.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(u,l){typeof exports=="object"&&typeof module!="undefined"?l(exports):typeof define=="function"&&define.amd?define(["exports"],l):(u=typeof globalThis!="undefined"?globalThis:u||self,l((u.agendize=u.agendize||{},u.agendize.tools={})))})(this,function(u){"use strict";var
|
|
1
|
+
(function(u,l){typeof exports=="object"&&typeof module!="undefined"?l(exports):typeof define=="function"&&define.amd?define(["exports"],l):(u=typeof globalThis!="undefined"?globalThis:u||self,l((u.agendize=u.agendize||{},u.agendize.tools={})))})(this,function(u){"use strict";var ue=Object.defineProperty;var fe=(u,l,b)=>l in u?ue(u,l,{enumerable:!0,configurable:!0,writable:!0,value:b}):u[l]=b;var J=(u,l,b)=>(fe(u,typeof l!="symbol"?l+"":l,b),b);function l(t,e){const n=Object.create(null),s=t.split(",");for(let r=0;r<s.length;r++)n[s[r]]=!0;return e?r=>!!n[r.toLowerCase()]:r=>!!n[r]}const b=()=>!1,mt=Object.prototype.hasOwnProperty,O=(t,e)=>mt.call(t,e),_=Array.isArray,v=t=>Q(t)==="[object Map]",z=t=>typeof t=="function",St=t=>typeof t=="string",N=t=>typeof t=="symbol",I=t=>t!==null&&typeof t=="object",Et=t=>I(t)&&z(t.then)&&z(t.catch),It=Object.prototype.toString,Q=t=>It.call(t),Mt=t=>Q(t).slice(8,-1),B=t=>St(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,D=(t,e)=>!Object.is(t,e),Y=t=>{const e=new Set(t);return e.w=0,e.n=0,e},Tt=t=>(t.w&G)>0,Rt=t=>(t.n&G)>0,F=new WeakMap;let G=1,M;const m=Symbol(""),V=Symbol("");let T=!0;const X=[];function Z(){X.push(T),T=!1}function k(){const t=X.pop();T=t===void 0?!0:t}function d(t,e,n){if(T&&M){let s=F.get(t);s||F.set(t,s=new Map);let r=s.get(n);r||s.set(n,r=Y()),tt(r)}}function tt(t,e){let n=!1;Rt(t)||(t.n|=G,n=!Tt(t)),n&&(t.add(M),M.deps.push(t))}function g(t,e,n,s,r,o){const i=F.get(t);if(!i)return;let c=[];if(e==="clear")c=[...i.values()];else if(n==="length"&&_(t))i.forEach((f,h)=>{(h==="length"||h>=s)&&c.push(f)});else switch(n!==void 0&&c.push(i.get(n)),e){case"add":_(t)?B(n)&&c.push(i.get("length")):(c.push(i.get(m)),v(t)&&c.push(i.get(V)));break;case"delete":_(t)||(c.push(i.get(m)),v(t)&&c.push(i.get(V)));break;case"set":v(t)&&c.push(i.get(m));break}if(c.length===1)c[0]&&$(c[0]);else{const f=[];for(const h of c)h&&f.push(...h);$(Y(f))}}function $(t,e){const n=_(t)?t:[...t];for(const s of n)s.computed&&et(s);for(const s of n)s.computed||et(s)}function et(t,e){(t!==M||t.allowRecurse)&&(t.scheduler?t.scheduler():t.run())}const Ot=l("__proto__,__v_isRef,__isVue"),nt=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(N)),vt=st(),xt=st(!0),rt=jt();function jt(){const t={};return["includes","indexOf","lastIndexOf"].forEach(e=>{t[e]=function(...n){const s=a(this);for(let o=0,i=this.length;o<i;o++)d(s,"get",o+"");const r=s[e](...n);return r===-1||r===!1?s[e](...n.map(a)):r}}),["push","pop","shift","unshift","splice"].forEach(e=>{t[e]=function(...n){Z();const s=a(this)[e].apply(this,n);return k(),s}}),t}function st(t=!1,e=!1){return function(s,r,o){if(r==="__v_isReactive")return!t;if(r==="__v_isReadonly")return t;if(r==="__v_isShallow")return e;if(r==="__v_raw"&&o===(t?e?yt:lt:e?$t:ft).get(s))return s;const i=_(s);if(!t&&i&&O(rt,r))return Reflect.get(rt,r,o);const c=Reflect.get(s,r,o);return(N(r)?nt.has(r):Ot(r))||(t||d(s,"get",r),e)?c:S(c)?i&&B(r)?c:c.value:I(c)?t?U(c):ht(c):c}}const Kt=Ht();function Ht(t=!1){return function(n,s,r,o){let i=n[s];if(W(i)&&S(i)&&!S(r))return!1;if(!t&&(!pt(r)&&!W(r)&&(i=a(i),r=a(r)),!_(n)&&S(i)&&!S(r)))return i.value=r,!0;const c=_(n)&&B(s)?Number(s)<n.length:O(n,s),f=Reflect.set(n,s,r,o);return n===a(o)&&(c?D(r,i)&&g(n,"set",s,r):g(n,"add",s,r)),f}}function Pt(t,e){const n=O(t,e);t[e];const s=Reflect.deleteProperty(t,e);return s&&n&&g(t,"delete",e,void 0),s}function Ct(t,e){const n=Reflect.has(t,e);return(!N(e)||!nt.has(e))&&d(t,"has",e),n}function Wt(t){return d(t,"iterate",_(t)?"length":m),Reflect.ownKeys(t)}const At={get:vt,set:Kt,deleteProperty:Pt,has:Ct,ownKeys:Wt},zt={get:xt,set(t,e){return!0},deleteProperty(t,e){return!0}},y=t=>t,x=t=>Reflect.getPrototypeOf(t);function j(t,e,n=!1,s=!1){t=t.__v_raw;const r=a(t),o=a(e);n||(e!==o&&d(r,"get",e),d(r,"get",o));const{has:i}=x(r),c=s?y:n?L:R;if(i.call(r,e))return c(t.get(e));if(i.call(r,o))return c(t.get(o));t!==r&&t.get(e)}function K(t,e=!1){const n=this.__v_raw,s=a(n),r=a(t);return e||(t!==r&&d(s,"has",t),d(s,"has",r)),t===r?n.has(t):n.has(t)||n.has(r)}function H(t,e=!1){return t=t.__v_raw,!e&&d(a(t),"iterate",m),Reflect.get(t,"size",t)}function ot(t){t=a(t);const e=a(this);return x(e).has.call(e,t)||(e.add(t),g(e,"add",t,t)),this}function it(t,e){e=a(e);const n=a(this),{has:s,get:r}=x(n);let o=s.call(n,t);o||(t=a(t),o=s.call(n,t));const i=r.call(n,t);return n.set(t,e),o?D(e,i)&&g(n,"set",t,e):g(n,"add",t,e),this}function ct(t){const e=a(this),{has:n,get:s}=x(e);let r=n.call(e,t);r||(t=a(t),r=n.call(e,t)),s&&s.call(e,t);const o=e.delete(t);return r&&g(e,"delete",t,void 0),o}function at(){const t=a(this),e=t.size!==0,n=t.clear();return e&&g(t,"clear",void 0,void 0),n}function P(t,e){return function(s,r){const o=this,i=o.__v_raw,c=a(i),f=e?y:t?L:R;return!t&&d(c,"iterate",m),i.forEach((h,p)=>s.call(r,f(h),f(p),o))}}function C(t,e,n){return function(...s){const r=this.__v_raw,o=a(r),i=v(o),c=t==="entries"||t===Symbol.iterator&&i,f=t==="keys"&&i,h=r[t](...s),p=n?y:e?L:R;return!e&&d(o,"iterate",f?V:m),{next(){const{value:A,done:q}=h.next();return q?{value:A,done:q}:{value:c?[p(A[0]),p(A[1])]:p(A),done:q}},[Symbol.iterator](){return this}}}}function w(t){return function(...e){return t==="delete"?!1:this}}function Nt(){const t={get(o){return j(this,o)},get size(){return H(this)},has:K,add:ot,set:it,delete:ct,clear:at,forEach:P(!1,!1)},e={get(o){return j(this,o,!1,!0)},get size(){return H(this)},has:K,add:ot,set:it,delete:ct,clear:at,forEach:P(!1,!0)},n={get(o){return j(this,o,!0)},get size(){return H(this,!0)},has(o){return K.call(this,o,!0)},add:w("add"),set:w("set"),delete:w("delete"),clear:w("clear"),forEach:P(!0,!1)},s={get(o){return j(this,o,!0,!0)},get size(){return H(this,!0)},has(o){return K.call(this,o,!0)},add:w("add"),set:w("set"),delete:w("delete"),clear:w("clear"),forEach:P(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(o=>{t[o]=C(o,!1,!1),n[o]=C(o,!0,!1),e[o]=C(o,!1,!0),s[o]=C(o,!0,!0)}),[t,n,e,s]}const[Bt,Dt,Yt,Ft]=Nt();function ut(t,e){const n=e?t?Ft:Yt:t?Dt:Bt;return(s,r,o)=>r==="__v_isReactive"?!t:r==="__v_isReadonly"?t:r==="__v_raw"?s:Reflect.get(O(n,r)&&r in s?n:s,r,o)}const Gt={get:ut(!1,!1)},Vt={get:ut(!0,!1)},ft=new WeakMap,$t=new WeakMap,lt=new WeakMap,yt=new WeakMap;function Ut(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Lt(t){return t.__v_skip||!Object.isExtensible(t)?0:Ut(Mt(t))}function ht(t){return W(t)?t:dt(t,!1,At,Gt,ft)}function U(t){return dt(t,!0,zt,Vt,lt)}function dt(t,e,n,s,r){if(!I(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const o=r.get(t);if(o)return o;const i=Lt(t);if(i===0)return t;const c=new Proxy(t,i===2?s:n);return r.set(t,c),c}function W(t){return!!(t&&t.__v_isReadonly)}function pt(t){return!!(t&&t.__v_isShallow)}function a(t){const e=t&&t.__v_raw;return e?a(e):t}const R=t=>I(t)?ht(t):t,L=t=>I(t)?U(t):t;function qt(t){T&&M&&(t=a(t),tt(t.dep||(t.dep=Y())))}function Jt(t,e){t=a(t),t.dep&&$(t.dep)}function S(t){return!!(t&&t.__v_isRef===!0)}function Qt(t){return Xt(t,!1)}function Xt(t,e){return S(t)?t:new Zt(t,e)}class Zt{constructor(e,n){this.__v_isShallow=n,this.dep=void 0,this.__v_isRef=!0,this._rawValue=n?e:a(e),this._value=n?e:R(e)}get value(){return qt(this),this._value}set value(e){const n=this.__v_isShallow||pt(e)||W(e);e=n?e:a(e),D(e,this._rawValue)&&(this._rawValue=e,this._value=n?e:R(e),Jt(this))}}function _t(t,e,n,s){let r;try{r=s?t(...s):t()}catch(o){wt(o,e,n)}return r}function gt(t,e,n,s){if(z(t)){const o=_t(t,e,n,s);return o&&Et(o)&&o.catch(i=>{wt(i,e,n)}),o}const r=[];for(let o=0;o<t.length;o++)r.push(gt(t[o],e,n,s));return r}function wt(t,e,n,s=!0){const r=e?e.vnode:null;if(e){let o=e.parent;const i=e.proxy,c=n;for(;o;){const h=o.ec;if(h){for(let p=0;p<h.length;p++)if(h[p](t,i,c)===!1)return}o=o.parent}const f=e.appContext.config.errorHandler;if(f){_t(f,null,10,[t,i,c]);return}}kt(t,n,r,s)}function kt(t,e,n,s=!0){console.error(t)}function te(t,e,n=E,s=!1){if(n){const r=n[t]||(n[t]=[]),o=e.__weh||(e.__weh=(...i)=>{if(n.isUnmounted)return;Z(),se(n);const c=gt(e,n,t,i);return oe(),k(),c});return s?r.unshift(o):r.push(o),o}}const bt=t=>(e,n=E)=>te(t,e,n),ee=bt("m"),ne=bt("um");function re(){return{app:null,config:{isNativeTag:b,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}re();let E=null;const se=t=>{E=t,t.scope.on()},oe=()=>{E&&E.scope.off(),E=null};function ie(t){const e=Qt(t.state),n=s=>{e.value=s};return ee(()=>{t.subscribe(n)}),ne(()=>{t.unsubscribe(n)}),U(e)}function ce(t,e=!1){var n=t.getFullYear(),s=t.getMonth()+1,r=t.getDate(),o=t.getHours(),i=t.getMinutes(),c=t.getSeconds();return e?(r<10?"0"+r:r)+"/"+(s<10?"0"+s:s)+"/"+n:n+"-"+(s<10?"0"+s:s)+"-"+(r<10?"0"+r:r)+"T"+(o<10?"0"+o:o)+":"+(i<10?"0"+i:i)+":"+(c<10?"0"+c:c)}class ae{constructor(e){J(this,"internalState");J(this,"listeners",[]);this.internalState=e}get state(){return this.internalState}changeState(e){this.internalState=e,this.listeners.length>0&&this.listeners.forEach(n=>n(this.state))}subscribe(e){this.listeners.push(e)}unsubscribe(e){const n=this.listeners.indexOf(e);n>-1&&this.listeners.splice(n,1)}}u.Bloc=ae,u.dateToString=ce,u.useBlocState=ie,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|