data-tier
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -5,3 +5,3 @@ import { DOMProcessor } from './dom-processor.js'; | ||
export const version = '3.0.0'; | ||
export const version = '3.0.1'; | ||
@@ -8,0 +8,0 @@ const initStartTime = performance.now(); |
@@ -1,1 +0,1 @@ | ||
import{DOMProcessor as o}from"./dom-processor.min.js";import{Ties as t}from"./ties.min.js";import{Views as e}from"./views.min.js";export const version="3.0.0";const s=performance.now();console.info("DT (3.0.0): starting initialization...");const r=new class{constructor(){this.params=Object.freeze(Array.from(new URL(import.meta.url).searchParams).reduce((o,t)=>(o[t[0]]=t[1],o),{})),this.paramsKey=Symbol("view.params.key"),this.domProcessor=new o(this),this.ties=new t(this),this.views=new e(this),"false"!==this.params.autostart&&!1!==this.params.autostart&&this.domProcessor.addDocument(document)}};export const ties=r.ties;export const addDocument=r.domProcessor.addDocument.bind(r.domProcessor);export const removeDocument=r.domProcessor.removeDocument.bind(r.domProcessor);export const addRootDocument=addDocument;export const removeRootDocument=removeDocument;console.info(`DT (3.0.0): ... initialization DONE (took ${(performance.now()-s).toFixed(2)}ms)`); | ||
import{DOMProcessor as o}from"./dom-processor.min.js";import{Ties as t}from"./ties.min.js";import{Views as e}from"./views.min.js";export const version="3.0.1";const s=performance.now();console.info("DT (3.0.1): starting initialization...");const r=new class{constructor(){this.params=Object.freeze(Array.from(new URL(import.meta.url).searchParams).reduce((o,t)=>(o[t[0]]=t[1],o),{})),this.paramsKey=Symbol("view.params.key"),this.domProcessor=new o(this),this.ties=new t(this),this.views=new e(this),"false"!==this.params.autostart&&!1!==this.params.autostart&&this.domProcessor.addDocument(document)}};export const ties=r.ties;export const addDocument=r.domProcessor.addDocument.bind(r.domProcessor);export const removeDocument=r.domProcessor.removeDocument.bind(r.domProcessor);export const addRootDocument=addDocument;export const removeRootDocument=removeDocument;console.info(`DT (3.0.1): ... initialization DONE (took ${(performance.now()-s).toFixed(2)}ms)`); |
@@ -12,12 +12,12 @@ import { Observable } from './object-observer.min.js'; | ||
DISCARD: 'href', | ||
IFRAME: 'src', | ||
IMAGE: 'href', | ||
IMG: 'src', | ||
INPUT: 'value', | ||
LINK: 'href', | ||
PATTERN: 'href', | ||
use: 'href', | ||
INPUT: 'value', | ||
SELECT: 'value', | ||
SOURCE: 'src', | ||
TEXTAREA: 'value', | ||
use: 'href' | ||
IFRAME: 'src', | ||
IMG: 'src', | ||
SOURCE: 'src' | ||
}, | ||
@@ -24,0 +24,0 @@ DEFAULT_EVENTS_CHANGE = ['INPUT', 'SELECT', 'TEXTAREA'], |
@@ -1,1 +0,1 @@ | ||
import{Observable as t}from"./object-observer.min.js";const e=/\s*[,;]\s*/,r=/\s*=>\s*/,n={A:"href",ANIMATE:"href",AREA:"href",BASE:"href",DISCARD:"href",IFRAME:"src",IMAGE:"href",IMG:"src",INPUT:"value",LINK:"href",PATTERN:"href",SELECT:"value",SOURCE:"src",TEXTAREA:"value",use:"href"},i=["INPUT","SELECT","TEXTAREA"],o="abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",s=o.length;export{a as ensureObservable,c as extractViewParams,p as getPath,d as setPath,m as callViewFunction,g as getRandomKey};class l{constructor(t,e,r,n,i,o,s){this.tieKey=t,this.rawPath=e,this.path=r,this.targetProperty=n,this.changeEvent=i,this.isFunctional=o,this.fParams=s,this.iClasses=null}}function a(e){return e?t.isObservable(e)?e:t.from(e):t.from({})}function c(t){const r=t.getAttribute("data-tie");if(r){const n=function(t,r){const n=[],i={},o=t.trim().split(e),s=o.length;let l,a,c,h=0;for(;h<s;h++)if((l=o[h])&&(a&&(a+=","+l),!(l.indexOf("(")>0&&(a=l).indexOf(")")<0)))try{a?(c=u(a),a=null):c=f(l,r),c.targetProperty in i?console.error(`elements's property '${c.targetProperty}' tied more than once; all but first tie dismissed`):(n.push(c),i[c.targetProperty]=!0)}catch(t){console.error(`failed to parse one of a multi param parts (${l}), skipping it`,t)}return n}(r,t);return n.length?n:null}return null}function u(t){const[e,r]=t.split(/[()]/),n=r.trim().split(/\s*,\s*/).map(h);if(!n.length)throw new Error(`functional tie parameter MUST have at least one tied argument, '${t}' doesn't`);return new l(null,null,null,e,null,!0,n)}function f(t,e){let[o,s,a]=t.split(r);const{tieKey:c,rawPath:u,path:f}=h(o);s=s||function(t){let e=n[t.nodeName];e?"checkbox"===t.type&&(e="checked"):e="textContent";return e}(e),a=a||function(t){let e=null;i.includes(t.nodeName)&&(e="change");return e}(e);const p=new l(c,u,f,s,a,!1,null);return"classList"===s&&(p.iClasses=Array.from(e.classList)),p}function h(t){const[e,r=""]=t.split(":");if(!e)throw new Error(`tie key missing in tie parameter '${t}'; expected example: "orders:0.address.apt => title"`);return{tieKey:e,rawPath:r,path:r.split(".").filter(Boolean)}}function p(t,e){if(!t)return null;const r=e,n=r.length;if(!n)return t;let i,o=t,s=0;for(;s<n-1;s++)if(null===(o=o[i=r[s]])||void 0===o)return o;return o[r[s]]}function d(t,e,r){if(!t)return;const n=e.length;let i,o,s=0;for(;s<n-1;s++)if((o=t[i=e[s]])&&"object"==typeof o)t=o;else if(void 0===o||null===o)t[i]={},t=t[i];else if("object"!=typeof o)return void console.error("setting deep path MAY NOT override primitives along the way");t[e[s]]=r}function m(t,e,r){try{t[e].apply(t,r)}catch(n){console.error(`failed to call '${e}' of '${t}' with '${r}'`,n)}}function g(t){let e="",r=t;const n=crypto.getRandomValues(new Uint8Array(t));for(;r--;)e+=o.charAt(s*n[r]/256);return e} | ||
import{Observable as t}from"./object-observer.min.js";const e=/\s*[,;]\s*/,r=/\s*=>\s*/,n={A:"href",ANIMATE:"href",AREA:"href",BASE:"href",DISCARD:"href",IMAGE:"href",LINK:"href",PATTERN:"href",use:"href",INPUT:"value",SELECT:"value",TEXTAREA:"value",IFRAME:"src",IMG:"src",SOURCE:"src"},i=["INPUT","SELECT","TEXTAREA"],o="abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",s=o.length;export{a as ensureObservable,c as extractViewParams,p as getPath,d as setPath,m as callViewFunction,g as getRandomKey};class l{constructor(t,e,r,n,i,o,s){this.tieKey=t,this.rawPath=e,this.path=r,this.targetProperty=n,this.changeEvent=i,this.isFunctional=o,this.fParams=s,this.iClasses=null}}function a(e){return e?t.isObservable(e)?e:t.from(e):t.from({})}function c(t){const r=t.getAttribute("data-tie");if(r){const n=function(t,r){const n=[],i={},o=t.trim().split(e),s=o.length;let l,a,c,h=0;for(;h<s;h++)if((l=o[h])&&(a&&(a+=","+l),!(l.indexOf("(")>0&&(a=l).indexOf(")")<0)))try{a?(c=u(a),a=null):c=f(l,r),c.targetProperty in i?console.error(`elements's property '${c.targetProperty}' tied more than once; all but first tie dismissed`):(n.push(c),i[c.targetProperty]=!0)}catch(t){console.error(`failed to parse one of a multi param parts (${l}), skipping it`,t)}return n}(r,t);return n.length?n:null}return null}function u(t){const[e,r]=t.split(/[()]/),n=r.trim().split(/\s*,\s*/).map(h);if(!n.length)throw new Error(`functional tie parameter MUST have at least one tied argument, '${t}' doesn't`);return new l(null,null,null,e,null,!0,n)}function f(t,e){let[o,s,a]=t.split(r);const{tieKey:c,rawPath:u,path:f}=h(o);s=s||function(t){let e=n[t.nodeName];e?"checkbox"===t.type&&(e="checked"):e="textContent";return e}(e),a=a||function(t){let e=null;i.includes(t.nodeName)&&(e="change");return e}(e);const p=new l(c,u,f,s,a,!1,null);return"classList"===s&&(p.iClasses=Array.from(e.classList)),p}function h(t){const[e,r=""]=t.split(":");if(!e)throw new Error(`tie key missing in tie parameter '${t}'; expected example: "orders:0.address.apt => title"`);return{tieKey:e,rawPath:r,path:r.split(".").filter(Boolean)}}function p(t,e){if(!t)return null;const r=e,n=r.length;if(!n)return t;let i,o=t,s=0;for(;s<n-1;s++)if(null===(o=o[i=r[s]])||void 0===o)return o;return o[r[s]]}function d(t,e,r){if(!t)return;const n=e.length;let i,o,s=0;for(;s<n-1;s++)if((o=t[i=e[s]])&&"object"==typeof o)t=o;else if(void 0===o||null===o)t[i]={},t=t[i];else if("object"!=typeof o)return void console.error("setting deep path MAY NOT override primitives along the way");t[e[s]]=r}function m(t,e,r){try{t[e].apply(t,r)}catch(n){console.error(`failed to call '${e}' of '${t}' with '${r}'`,n)}}function g(t){let e="",r=t;const n=crypto.getRandomValues(new Uint8Array(t));for(;r--;)e+=o.charAt(s*n[r]/256);return e} |
{ | ||
"name": "data-tier", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Tiny and fast two way (MV-VM) data binding framework for browser environments.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package