Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

data-tier-list

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

data-tier-list - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

233

dist/data-tier-list.js

@@ -1,10 +0,17 @@

import * as DataTier from './data-tier/data-tier.min.js';
import { ties } from './data-tier/data-tier.min.js';
const
SEQUENCE_ID_KEY = Symbol('sequence.id'),
BOUND_UPDATER_KEY = Symbol('bound.updater'),
DATA_TIER_LIST = 'data-tier-list',
SELF_TEMPLATE = `
<style>:host {display: none;}</style>
<slot></slot>
`,
ITEMS_KEY = Symbol('items.key'),
PREPARED_TEMPLATE_KEY = Symbol('prepared.template');
TEMPLATE_KEY = Symbol('template'),
let sequencer = 1;
OBSERVER_KEY = Symbol('observer'),
FULL_UPDATER_KEY = Symbol('full.updater'),
PART_UPDATER_KEY = Symbol('part.updater'),
CONTAINER_RESOLVER_KEY = Symbol('container.resolver'),
TEMPLATE_PROCESSOR_KEY = Symbol('template.processor');

@@ -14,20 +21,9 @@ class DataTierList extends HTMLElement {

super();
this[SEQUENCE_ID_KEY] = sequencer++;
this[BOUND_UPDATER_KEY] = this.fullUpdate.bind(this);
this.attachShadow({ mode: 'open' }).innerHTML = '<slot></slot>';
this.shadowRoot.firstElementChild.addEventListener('slotchange', event => {
const templateNodes = event.target.assignedNodes().filter(n => n.nodeType === Node.ELEMENT_NODE);
if (templateNodes.length !== 1) {
console.error(`list item template MUST have onle 1 root element, got ${templateNodes.length}`);
return;
}
this.preprocessTemplate(templateNodes[0]);
this.fullUpdate();
});
this[ITEMS_KEY] = null;
this[TEMPLATE_KEY] = null;
this[OBSERVER_KEY] = this[OBSERVER_KEY].bind(this);
this.attachShadow({ mode: 'open' }).innerHTML = SELF_TEMPLATE;
this.shadowRoot.querySelector('slot').addEventListener('slotchange', () => this[TEMPLATE_PROCESSOR_KEY]());
}
connectedCallback() {
this.style.display = 'none';
}
get defaultTieTarget() {

@@ -38,26 +34,28 @@ return 'items';

set items(items) {
// not an Array - exit eagerly
if (!Array.isArray(items)) {
console.error(`array of items expected, but got '${items}'`);
if (this[ITEMS_KEY] && this[ITEMS_KEY].length) {
console.warn(`array of items expected (empty array or null allowed), but got '${items}'; nor further action taken`);
}
return;
}
// remove old model (should be conditional?)
// same value set - exit eagerly
if (this[ITEMS_KEY] === items) {
return;
}
// remove old model
if (this[ITEMS_KEY]) {
this[ITEMS_KEY].unobserve(this[BOUND_UPDATER_KEY]);
if (DataTier.ties.get(this)) {
DataTier.ties.remove(this);
this[ITEMS_KEY].unobserve(this[OBSERVER_KEY]);
if (ties.get(this)) {
ties.remove(this);
}
}
// create new model
let im;
if (typeof items.observe === 'function' && typeof items.unobserve === 'function') {
im = items;
} else {
im = DataTier.ties.create(this, items);
}
im.observe(this[BOUND_UPDATER_KEY]);
// create/update model
const im = ties.update(this, items);
im.observe(this[OBSERVER_KEY], { pathsOf: '' });
this[ITEMS_KEY] = im;
this.fullUpdate();
this[FULL_UPDATER_KEY]();
}

@@ -69,4 +67,42 @@

fullUpdate(changes) {
if (!this[PREPARED_TEMPLATE_KEY] || !this[ITEMS_KEY]) {
[CONTAINER_RESOLVER_KEY]() {
let result;
const attr = this.getAttribute('data-list-target');
if (attr) {
result = this.getRootNode().querySelector(attr);
if (!result) {
throw new Error(`failed to resolve target container by the given query '${attr}'`);
}
} else {
result = this.parentNode;
}
return result;
}
[TEMPLATE_PROCESSOR_KEY]() {
const templateNodes = this.shadowRoot.querySelector('slot').assignedNodes().filter(n => n.nodeType === Node.ELEMENT_NODE);
let newTemplate = null;
if (templateNodes.length === 1) {
newTemplate = templateNodes[0].outerHTML;
} else {
throw new Error(`list item template MAY have 1 root element only, got ${templateNodes.length}`);
}
// TODO: any preprocessing/optimisations go here
this[TEMPLATE_KEY] = newTemplate;
this[FULL_UPDATER_KEY]();
}
[OBSERVER_KEY](changes) {
for (const change of changes) {
if (change.type === 'shuffle' || change.type === 'reverse') {
this[FULL_UPDATER_KEY]();
} else {
this[PART_UPDATER_KEY](change);
}
}
}
[FULL_UPDATER_KEY]() {
if (!this[TEMPLATE_KEY] || !this[ITEMS_KEY]) {
return;

@@ -76,78 +112,73 @@ }

const
targetContainer = this.resolveTargetContainer(),
targetContainer = this[CONTAINER_RESOLVER_KEY](),
inParentAdjust = targetContainer.contains(this) ? 1 : 0;
if (changes) {
const t = document.createElement('template');
changes.forEach(c => {
if (c.path.length > 1) {
return;
}
if (c.type === 'insert') {
t.innerHTML = this[PREPARED_TEMPLATE_KEY];
targetContainer.insertBefore(t.content, targetContainer.children[c.path[0] + inParentAdjust]);
} else if (c.type === 'delete') {
targetContainer.removeChild(targetContainer.children[c.path[0] + inParentAdjust]);
} else if (c.type === 'reverse') {
for (var i = inParentAdjust + 1, l = targetContainer.children.length - inParentAdjust / 2; i < l; i++) {
targetContainer.insertBefore(targetContainer.children[i], targetContainer.children[i - 1]);
}
} else {
console.warn(`unsupported change type ${c.type}`);
}
});
} else {
const
items = this.items,
currentListLength = targetContainer.childElementCount - inParentAdjust,
desiredListLength = items.length;
let llc = currentListLength,
lastElementChild;
while (llc > desiredListLength) {
lastElementChild = targetContainer.lastElementChild;
if (lastElementChild !== this) {
targetContainer.removeChild(lastElementChild);
}
llc--;
}
const
items = this.items,
currentListLength = targetContainer.childElementCount - inParentAdjust,
desiredListLength = items.length;
let appendContent = '';
while (llc < desiredListLength) {
appendContent += this[PREPARED_TEMPLATE_KEY];
llc++;
}
if (appendContent) {
const t = document.createElement('template');
t.innerHTML = appendContent;
targetContainer.appendChild(t.content);
}
let llc = currentListLength,
lastElementChild;
for (let i = inParentAdjust, l = targetContainer.children.length; i < l; i++) {
const c = targetContainer.children[i];
const m = DataTier.ties.get(c);
if (!m) {
DataTier.ties.create(c, items[i - inParentAdjust]);
} else if (m !== items[i - inParentAdjust]) {
DataTier.ties.update(c, items[i - inParentAdjust]);
}
while (llc > desiredListLength) {
lastElementChild = targetContainer.lastElementChild;
if (lastElementChild !== this) {
lastElementChild.remove();
}
llc--;
}
}
resolveTargetContainer() {
let result = this.parentElement;
const attr = this.getAttribute('data-list-target');
if (attr) {
result = this.getRootNode().querySelector(attr);
let appendContent = '';
while (llc < desiredListLength) {
appendContent += this[TEMPLATE_KEY];
llc++;
}
return result;
if (appendContent) {
const t = document.createElement('template');
t.innerHTML = appendContent;
targetContainer.appendChild(t.content);
}
for (let i = inParentAdjust, l = targetContainer.children.length; i < l; i++) {
const c = targetContainer.children[i];
ties.update(c, items[i - inParentAdjust]);
}
}
preprocessTemplate(template) {
this[PREPARED_TEMPLATE_KEY] = template.outerHTML;
[PART_UPDATER_KEY](change) {
if (!this[TEMPLATE_KEY] || !this[ITEMS_KEY]) {
return;
}
const
targetContainer = this[CONTAINER_RESOLVER_KEY](),
inParentAdjust = targetContainer.contains(this) ? 1 : 0;
const t = document.createElement('template');
if (change.path.length > 1) {
return;
}
if (change.type === 'insert') {
t.innerHTML = this[TEMPLATE_KEY];
ties.create(t.content.firstElementChild, change.value);
targetContainer.insertBefore(t.content, targetContainer.children[change.path[0] + inParentAdjust]);
} else if (change.type === 'update') {
// TODO
} else if (change.type === 'delete') {
targetContainer.removeChild(targetContainer.children[change.path[0] + inParentAdjust]);
} else if (change.type === 'reverse') {
for (var i = inParentAdjust + 1, l = targetContainer.children.length - inParentAdjust / 2; i < l; i++) {
targetContainer.insertBefore(targetContainer.children[i], targetContainer.children[i - 1]);
}
} else {
console.warn(`unsupported change type ${change.type}`);
}
}
}
if (!customElements.get('data-tier-list')) {
customElements.define('data-tier-list', DataTierList);
if (!customElements.get(DATA_TIER_LIST)) {
customElements.define(DATA_TIER_LIST, DataTierList);
} else {
console.warn(`'${DATA_TIER_LIST}' is already defined in this environment, won't redefine`);
}

@@ -1,1 +0,1 @@

import*as DataTier from"./data-tier/data-tier.min.js";const SEQUENCE_ID_KEY=Symbol("sequence.id"),BOUND_UPDATER_KEY=Symbol("bound.updater"),ITEMS_KEY=Symbol("items.key"),PREPARED_TEMPLATE_KEY=Symbol("prepared.template");let sequencer=1;class DataTierList extends HTMLElement{constructor(){super(),this[SEQUENCE_ID_KEY]=sequencer++,this[BOUND_UPDATER_KEY]=this.fullUpdate.bind(this),this.attachShadow({mode:"open"}).innerHTML="<slot></slot>",this.shadowRoot.firstElementChild.addEventListener("slotchange",e=>{const t=e.target.assignedNodes().filter(e=>e.nodeType===Node.ELEMENT_NODE);1===t.length?(this.preprocessTemplate(t[0]),this.fullUpdate()):console.error(`list item template MUST have onle 1 root element, got ${t.length}`)})}connectedCallback(){this.style.display="none"}get defaultTieTarget(){return"items"}set items(e){if(!Array.isArray(e))return void console.error(`array of items expected, but got '${e}'`);let t;this[ITEMS_KEY]&&(this[ITEMS_KEY].unobserve(this[BOUND_UPDATER_KEY]),DataTier.ties.get(this)&&DataTier.ties.remove(this)),(t="function"==typeof e.observe&&"function"==typeof e.unobserve?e:DataTier.ties.create(this,e)).observe(this[BOUND_UPDATER_KEY]),this[ITEMS_KEY]=t,this.fullUpdate()}get items(){return this[ITEMS_KEY]}fullUpdate(e){if(!this[PREPARED_TEMPLATE_KEY]||!this[ITEMS_KEY])return;const t=this.resolveTargetContainer(),i=t.contains(this)?1:0;if(e){const s=document.createElement("template");e.forEach(e=>{if(!(e.path.length>1))if("insert"===e.type)s.innerHTML=this[PREPARED_TEMPLATE_KEY],t.insertBefore(s.content,t.children[e.path[0]+i]);else if("delete"===e.type)t.removeChild(t.children[e.path[0]+i]);else if("reverse"===e.type)for(var r=i+1,n=t.children.length-i/2;r<n;r++)t.insertBefore(t.children[r],t.children[r-1]);else console.warn(`unsupported change type ${e.type}`)})}else{const e=this.items,s=t.childElementCount-i,r=e.length;let n,o=s;for(;o>r;)(n=t.lastElementChild)!==this&&t.removeChild(n),o--;let a="";for(;o<r;)a+=this[PREPARED_TEMPLATE_KEY],o++;if(a){const e=document.createElement("template");e.innerHTML=a,t.appendChild(e.content)}for(let s=i,r=t.children.length;s<r;s++){const r=t.children[s],n=DataTier.ties.get(r);n?n!==e[s-i]&&DataTier.ties.update(r,e[s-i]):DataTier.ties.create(r,e[s-i])}}}resolveTargetContainer(){let e=this.parentElement;const t=this.getAttribute("data-list-target");return t&&(e=this.getRootNode().querySelector(t)),e}preprocessTemplate(e){this[PREPARED_TEMPLATE_KEY]=e.outerHTML}}customElements.get("data-tier-list")||customElements.define("data-tier-list",DataTierList);
import{ties}from"./data-tier/data-tier.min.js";const DATA_TIER_LIST="data-tier-list",SELF_TEMPLATE="\n\t\t<style>:host {display: none;}</style>\n\t\t<slot></slot>\n\t",ITEMS_KEY=Symbol("items.key"),TEMPLATE_KEY=Symbol("template"),OBSERVER_KEY=Symbol("observer"),FULL_UPDATER_KEY=Symbol("full.updater"),PART_UPDATER_KEY=Symbol("part.updater"),CONTAINER_RESOLVER_KEY=Symbol("container.resolver"),TEMPLATE_PROCESSOR_KEY=Symbol("template.processor");class DataTierList extends HTMLElement{constructor(){super(),this[ITEMS_KEY]=null,this[TEMPLATE_KEY]=null,this[OBSERVER_KEY]=this[OBSERVER_KEY].bind(this),this.attachShadow({mode:"open"}).innerHTML=SELF_TEMPLATE,this.shadowRoot.querySelector("slot").addEventListener("slotchange",()=>this[TEMPLATE_PROCESSOR_KEY]())}get defaultTieTarget(){return"items"}set items(e){if(!Array.isArray(e))return void(this[ITEMS_KEY]&&this[ITEMS_KEY].length&&console.warn(`array of items expected (empty array or null allowed), but got '${e}'; nor further action taken`));if(this[ITEMS_KEY]===e)return;this[ITEMS_KEY]&&(this[ITEMS_KEY].unobserve(this[OBSERVER_KEY]),ties.get(this)&&ties.remove(this));const t=ties.update(this,e);t.observe(this[OBSERVER_KEY],{pathsOf:""}),this[ITEMS_KEY]=t,this[FULL_UPDATER_KEY]()}get items(){return this[ITEMS_KEY]}[CONTAINER_RESOLVER_KEY](){let e;const t=this.getAttribute("data-list-target");if(t){if(!(e=this.getRootNode().querySelector(t)))throw new Error(`failed to resolve target container by the given query '${t}'`)}else e=this.parentNode;return e}[TEMPLATE_PROCESSOR_KEY](){const e=this.shadowRoot.querySelector("slot").assignedNodes().filter(e=>e.nodeType===Node.ELEMENT_NODE);let t=null;if(1!==e.length)throw new Error(`list item template MAY have 1 root element only, got ${e.length}`);t=e[0].outerHTML,this[TEMPLATE_KEY]=t,this[FULL_UPDATER_KEY]()}[OBSERVER_KEY](e){for(const t of e)"shuffle"===t.type||"reverse"===t.type?this[FULL_UPDATER_KEY]():this[PART_UPDATER_KEY](t)}[FULL_UPDATER_KEY](){if(!this[TEMPLATE_KEY]||!this[ITEMS_KEY])return;const e=this[CONTAINER_RESOLVER_KEY](),t=e.contains(this)?1:0,E=this.items,s=e.childElementCount-t,i=E.length;let r,n=s;for(;n>i;)(r=e.lastElementChild)!==this&&r.remove(),n--;let o="";for(;n<i;)o+=this[TEMPLATE_KEY],n++;if(o){const t=document.createElement("template");t.innerHTML=o,e.appendChild(t.content)}for(let s=t,i=e.children.length;s<i;s++){const i=e.children[s];ties.update(i,E[s-t])}}[PART_UPDATER_KEY](e){if(!this[TEMPLATE_KEY]||!this[ITEMS_KEY])return;const t=this[CONTAINER_RESOLVER_KEY](),E=t.contains(this)?1:0,s=document.createElement("template");if(!(e.path.length>1))if("insert"===e.type)s.innerHTML=this[TEMPLATE_KEY],ties.create(s.content.firstElementChild,e.value),t.insertBefore(s.content,t.children[e.path[0]+E]);else if("update"===e.type);else if("delete"===e.type)t.removeChild(t.children[e.path[0]+E]);else if("reverse"===e.type)for(var i=E+1,r=t.children.length-E/2;i<r;i++)t.insertBefore(t.children[i],t.children[i-1]);else console.warn(`unsupported change type ${e.type}`)}}customElements.get(DATA_TIER_LIST)?console.warn("'data-tier-list' is already defined in this environment, won't redefine"):customElements.define(DATA_TIER_LIST,DataTierList);

@@ -1,1 +0,1 @@

import{Ties}from"./ties.min.js";import{Views}from"./views.min.js";import{DEFAULT_TIE_TARGET_PROVIDER as dttp,CHANGE_EVENT_NAME_PROVIDER as cenp,getTargetProperty,extractViewParams,addChangeListener,delChangeListener,getPath,setPath,callViewFunction}from"./utils.min.js";console.info("DT: starting initialization...");const initStartTime=performance.now(),MUTATION_OBSERVER_OPTIONS={childList:!0,subtree:!0,attributes:!0,attributeOldValue:!0,attributeFilter:["data-tie"],characterData:!1,characterDataOldValue:!1},roots=new WeakSet;class Instance{constructor(){this.params=Object.freeze(Array.from(new URL(import.meta.url).searchParams).reduce((e,t)=>(e[t[0]]=t[1],e),{})),this.paramsKey=Symbol("view.params"),this.scopeRootKey=Symbol("scope.root"),this.ties=new Ties(this),this.views=new Views(this)}addRootDocument(e){if(!e||Node.DOCUMENT_NODE!==e.nodeType&&Node.DOCUMENT_FRAGMENT_NODE!==e.nodeType)throw new Error("invalid argument, NULL or not one of: DOCUMENT_NODE, DOCUMENT_FRAGMENT_NODE");return roots.has(e)?(console.warn("any root document may be added only once"),!1):(new MutationObserver(processDomChanges).observe(e,MUTATION_OBSERVER_OPTIONS),addTree(e),roots.add(e),!0)}removeRootDocument(e){return roots.has(e)?(dropTree(e),roots.delete(e),!0):(console.warn("no root document "+e+" known"),!1)}}const instance=new Instance;export const ties=instance.ties;export const DEFAULT_TIE_TARGET_PROVIDER=dttp;export const CHANGE_EVENT_NAME_PROVIDER=cenp;export const addRootDocument=instance.addRootDocument;export const removeRootDocument=instance.removeRootDocument;function changeListener(e){const t=e.currentTarget,n=getTargetProperty(t),o=t[instance.paramsKey];let a,s,i,r=o.length;for(;r--;)(a=o[r]).targetProperty===n&&(s=instance.ties.get(a.tieKey))&&(i=t[n],setPath(s,a.path,i))}function add(e){if(e.matches(":defined")){const t=extractViewParams(e,instance.scopeRootKey);t&&(instance.views.addView(e,t),updateFromView(e,t),addChangeListener(e,changeListener)),e.shadowRoot&&!e.hasAttribute("data-tie-blackbox")&&instance.addRootDocument(e.shadowRoot)}else waitUndefined(e)}function waitUndefined(e){let t;if(e.localName.indexOf("-")>0)t=e.localName;else{const n=/.*is\s*=\s*"([^"]+)"\s*.*/.exec(e.outerHTML);n&&n.length>1&&(t=n[1])}t?customElements.whenDefined(t).then(()=>add(e)):console.warn("failed to determine tag of yet undefined custom element "+e+", abandoning")}function updateFromView(e,t){let n=t.length;for(;n--;){const o=t[n];if(o.isFunctional){let t=!1;const n=[];o.fParams.forEach(e=>{let o;const a=instance.ties.get(e.tieKey);a&&(o=getPath(a,e.path),t=!0),n.push(o)}),t&&(n.push(null),callViewFunction(e,o.targetProperty,n))}else{const t=instance.ties.get(o.tieKey);if(!t)continue;let n=getPath(t,o.path);void 0===n&&(n=""),instance.views.setViewProperty(e,o,n)}}}function addTree(e){let t,n=[e];e.childElementCount&&(n=Array.from(e.querySelectorAll("*"))).unshift(e);const o=n.length;for(let e=0;e<o;e++)try{t=n[e],Node.ELEMENT_NODE!==t.nodeType||t[instance.paramsKey]||add(t)}catch(e){console.error("failed to process/add element",e)}}function dropTree(e){let t,n,o,a=[e];for(e.childElementCount&&(a=Array.from(e.querySelectorAll("*"))).unshift(e),t=a.length;t--;)(o=(n=a[t])[instance.paramsKey])&&(instance.views.delView(n,o),delChangeListener(n,changeListener)),n.shadowRoot&&!n.hasAttribute("data-tie-blackbox")&&instance.removeRootDocument(n.shadowRoot)}function onTieParamChange(e,t,n){let o;t&&(o=e[instance.paramsKey])&&(instance.views.delView(e,o),delChangeListener(e,changeListener)),n&&(o=extractViewParams(e,instance.scopeRootKey))&&(instance.views.addView(e,o),updateFromView(e,o),addChangeListener(e,changeListener))}function processDomChanges(e){const t=e.length;let n,o,a,s,i,r,c,d,l=0;for(;l<t;l++)if("attributes"===(s=(a=e[l]).type)){const e=a.attributeName,t=a.target,n=a.oldValue,o=t.getAttribute(e);n!==o&&onTieParamChange(t,n,o)}else if("childList"===s){for(r=(i=a.addedNodes).length;r--;)o=(n=i[r]).nodeType,Node.ELEMENT_NODE===o&&addTree(n);for(d=(c=a.removedNodes).length;d--;)o=(n=c[d]).nodeType,Node.ELEMENT_NODE===o&&dropTree(n)}}"false"!==instance.params.autostart&&!1!==instance.params.autostart&&instance.addRootDocument(document),console.info("DT: ... initialization DONE (took "+Math.floor(100*(performance.now()-initStartTime))/100+"ms)");
import{Ties}from"./ties.min.js";import{Views}from"./views.min.js";import{DEFAULT_TIE_TARGET_PROVIDER as dttp,CHANGE_EVENT_NAME_PROVIDER as cenp,getTargetProperty,extractViewParams,addChangeListener,delChangeListener,getPath,setPath,callViewFunction}from"./utils.min.js";console.info("DT: starting initialization...");const initStartTime=performance.now(),MUTATION_OBSERVER_OPTIONS={childList:!0,subtree:!0,attributes:!0,attributeOldValue:!0,attributeFilter:["data-tie"],characterData:!1,characterDataOldValue:!1},roots=new WeakSet,PARAMS_KEY=Symbol("view.params.key"),SCOPE_ROOT_TIE_KEY=Symbol("scope.root.tie.key");class Instance{constructor(){this.params=Object.freeze(Array.from(new URL(import.meta.url).searchParams).reduce((e,t)=>(e[t[0]]=t[1],e),{})),this.paramsKey=PARAMS_KEY,this.scopeRootTieKey=SCOPE_ROOT_TIE_KEY,this.ties=new Ties(this),this.views=new Views(this),this.addTree=addTree}}const instance=new Instance;export const ties=instance.ties;export const DEFAULT_TIE_TARGET_PROVIDER=dttp;export const CHANGE_EVENT_NAME_PROVIDER=cenp;export const addRootDocument=function(e){if(!e||Node.DOCUMENT_NODE!==e.nodeType&&Node.DOCUMENT_FRAGMENT_NODE!==e.nodeType)throw new Error("invalid argument, NULL or not one of: DOCUMENT_NODE, DOCUMENT_FRAGMENT_NODE");return roots.has(e)?(console.warn("any root document may be added only once"),!1):(new MutationObserver(processDomChanges).observe(e,MUTATION_OBSERVER_OPTIONS),addTree(e),roots.add(e),!0)};export const removeRootDocument=function(e){return roots.has(e)?(dropTree(e),roots.delete(e),!0):(console.warn("no root document "+e+" known"),!1)};function changeListener(e){const t=e.currentTarget,o=getTargetProperty(t),n=t[PARAMS_KEY];let a,r,i;if(!n)return;let s=n.length;for(;s--;)(a=n[s]).targetProperty===o&&(r=ties.get(a.tieKey))&&(i=t[o],setPath(r,a.path,i))}function add(e){if(e.matches(":defined")){const t=extractViewParams(e,SCOPE_ROOT_TIE_KEY);t&&(instance.views.addView(e,t),updateFromView(e,t),addChangeListener(e,changeListener)),e.shadowRoot&&!e.hasAttribute("data-tie-blackbox")&&addRootDocument(e.shadowRoot)}else waitUndefined(e)}function waitUndefined(e){let t;if(e.localName.indexOf("-")>0)t=e.localName;else{const o=/.*is\s*=\s*"([^"]+)"\s*.*/.exec(e.outerHTML);o&&o.length>1&&(t=o[1])}t?customElements.whenDefined(t).then(()=>add(e)):console.warn("failed to determine tag of yet undefined custom element "+e+", abandoning")}function updateFromView(e,t){let o=t.length;for(;o--;){const n=t[o];if(n.isFunctional){let t=!1;const o=[];n.fParams.forEach(e=>{let n;const a=ties.get(e.tieKey);a&&(n=getPath(a,e.path),t=!0),o.push(n)}),t&&(o.push(null),callViewFunction(e,n.targetProperty,o))}else{const t=ties.get(n.tieKey);if(!t)continue;let o=getPath(t,n.path);void 0===o&&(o=""),instance.views.setViewProperty(e,n,o)}}}export function addTree(e){let t,o=[e];e.childElementCount&&(o=Array.from(e.querySelectorAll("*"))).unshift(e);const n=o.length;for(let e=0;e<n;e++)try{t=o[e],Node.ELEMENT_NODE!==t.nodeType||t[PARAMS_KEY]||add(t)}catch(e){console.error("failed to process/add element",e)}};function dropTree(e){let t,o,n,a=[e];for(e.childElementCount&&(a=Array.from(e.querySelectorAll("*"))).unshift(e),t=a.length;t--;)(n=(o=a[t])[PARAMS_KEY])&&(instance.views.delView(o,n),delChangeListener(o,changeListener)),o.shadowRoot&&!o.hasAttribute("data-tie-blackbox")&&removeRootDocument(o.shadowRoot)}function onTieParamChange(e,t,o){let n;t&&(n=e[PARAMS_KEY])&&(instance.views.delView(e,n),delChangeListener(e,changeListener)),o&&(n=extractViewParams(e,SCOPE_ROOT_TIE_KEY))&&(instance.views.addView(e,n),updateFromView(e,n),addChangeListener(e,changeListener))}function processDomChanges(e){const t=e.length;let o,n,a,r,i,s,c,d,l=0;for(;l<t;l++)if("attributes"===(r=(a=e[l]).type)){const e=a.attributeName,t=a.target,o=a.oldValue,n=t.getAttribute(e);o!==n&&onTieParamChange(t,o,n)}else if("childList"===r){for(s=(i=a.addedNodes).length;s--;)n=(o=i[s]).nodeType,Node.ELEMENT_NODE===n&&addTree(o);for(d=(c=a.removedNodes).length;d--;)n=(o=c[d]).nodeType,Node.ELEMENT_NODE===n&&dropTree(o)}}"false"!==instance.params.autostart&&!1!==instance.params.autostart&&addRootDocument(document),console.info("DT: ... initialization DONE (took "+Math.floor(100*(performance.now()-initStartTime))/100+"ms)");

@@ -1,1 +0,1 @@

const t="insert",e="update",o="delete",r=Symbol("observable-meta-key"),n={path:1,pathsOf:1,pathsFrom:1},s={[r]:{value:null},observe:{value:function(t,e){if("function"!=typeof t)throw new Error("observer parameter MUST be a function");const o=this[r].observers;if(o.some(e=>e[0]===t))console.info("observer may be bound to an observable only once");else{let r;r=e?function(t){const e={};void 0!==t.path&&("string"!=typeof t.path?console.error('"path" option, if/when provided, MUST be a non-empty string'):e.path=t.path),void 0!==t.pathsOf&&(t.path?console.error('"pathsOf" option MAY NOT be specified together with "path" option'):"string"!=typeof t.pathsOf?console.error('"pathsOf" option, if/when provided, MUST be a non-empty string'):e.pathsOf=t.pathsOf.split(".").filter(t=>t)),void 0!==t.pathsFrom&&(t.path||t.pathsOf?console.error('"pathsFrom" option MAY NOT be specified together with "path"/"pathsOf" option/s'):"string"!=typeof t.pathsFrom?console.error('"pathsFrom" option, if/when provided, MUST be a non-empty string'):e.pathsFrom=t.pathsFrom);const o=Object.keys(t).filter(t=>!n.hasOwnProperty(t));return o.length&&console.error(`'${o.join(", ")}' is/are not a valid option/s`),e}(e):{},o.push([t,r])}}},unobserve:{value:function(){const t=this[r].observers;let e=t.length;if(e){let o=arguments.length;if(o)for(;o--;){let r=e;for(;r--;)t[r][0]===arguments[o]&&(t.splice(r,1),e--)}else t.splice(0)}}}},a=function(t,e){s[r].value=e;const o=Object.keys(t),n=Object.defineProperties({},s);let a,i=o.length;for(;i--;)n[a=o[i]]=p(t[a],a,e);return n},i=function(t,e){let o=t.length;s[r].value=e;const n=Object.defineProperties(new Array(o),s);for(;o--;)n[o]=p(t[o],o,e);return n},h=function(t,e){return s[r].value=e,Object.defineProperties(t,s),t},l=function(t,e){let o,r,n,s,a,i,h,l,p,c;const f=e.length;for(;;){for(l=(o=t.observers).length;l--;)try{n=(r=o[l])[0],s=r[1],a=e,s.path?(i=s.path,a=e.filter(t=>t.path.join(".")===i)):s.pathsOf?a=e.filter(t=>t.path.length===s.pathsOf.length+1):s.pathsFrom&&(h=s.pathsFrom,a=e.filter(t=>t.path.join(".").startsWith(h))),a.length&&n(a)}catch(t){console.error(`failed to deliver changes to listener ${n}`,t)}let u;if(!t.parent)break;u=new Array(f);for(let o=0;o<f;o++)c=e[o],p=[t.ownKey,...c.path],u[o]={type:c.type,path:p,value:c.value,oldValue:c.oldValue,object:c.object};e=u,t=t.parent}},p=function(t,e,o){return t&&"object"==typeof t?Array.isArray(t)?new w({target:t,ownKey:e,parent:o}).proxy:ArrayBuffer.isView(t)?new j({target:t,ownKey:e,parent:o}).proxy:t instanceof Date||t instanceof Blob||t instanceof Error?t:new d({target:t,ownKey:e,parent:o}).proxy:t},c=function(){const t=this[r],e=t.target;let o,n,s;for(e.reverse(),o=0,n=e.length;o<n;o++)if((s=e[o])&&"object"==typeof s){const t=s[r];t&&(t.ownKey=o)}return l(t,[{type:"reverse",path:[],object:this}]),this},f=function(t){const e=this[r],o=e.target;let n,s,a;for(o.sort(t),n=0,s=o.length;n<s;n++)if((a=o[n])&&"object"==typeof a){const t=a[r];t&&(t.ownKey=n)}return l(e,[{type:"shuffle",path:[],object:this}]),this},u=function(o,n,s){const a=this[r],i=a.target,h=[],c=i.length,f=i.slice(0);if(n=void 0===n?0:n<0?Math.max(c+n,0):Math.min(n,c),s=void 0===s?c:s<0?Math.max(c+s,0):Math.min(s,c),n<c&&s>n){let c;i.fill(o,n,s);for(let o,l,u=n;u<s;u++)o=i[u],i[u]=p(o,u,a),f.hasOwnProperty(u)?((l=f[u])&&"object"==typeof l&&(c=l[r])&&(l=c.detach()),h.push({type:e,path:[u],value:i[u],oldValue:l,object:this})):h.push({type:t,path:[u],value:i[u],object:this});l(a,h)}return this},y=function(t,o,n){const s=this[r],a=s.target,i=a.length;t=t<0?Math.max(i+t,0):t,o=void 0===o?0:o<0?Math.max(i+o,0):Math.min(o,i),n=void 0===n?i:n<0?Math.max(i+n,0):Math.min(n,i);const h=Math.min(n-o,i-t);if(t<i&&t!==o&&h>0){const i=a.slice(0),c=[];a.copyWithin(t,o,n);for(let o,n,l,f=t;f<t+h;f++)(o=a[f])&&"object"==typeof o&&(o=p(o,f,s),a[f]=o),(n=i[f])&&"object"==typeof n&&(l=n[r])&&(n=l.detach()),"object"!=typeof o&&o===n||c.push({type:e,path:[f],value:o,oldValue:n,object:this});l(s,c)}return this},b={pop:function(){const t=this[r],e=t.target,n=e.length-1;let s=e.pop();if(s&&"object"==typeof s){const t=s[r];t&&(s=t.detach())}return l(t,[{type:o,path:[n],oldValue:s,object:this}]),s},push:function(){const e=this[r],o=e.target,n=arguments.length,s=new Array(n),a=o.length;for(let t=0;t<n;t++)s[t]=p(arguments[t],a+t,e);const i=Reflect.apply(o.push,o,s),h=[];for(let e=a,r=o.length;e<r;e++)h[e-a]={type:t,path:[e],value:o[e],object:this};return l(e,h),i},shift:function(){const t=this[r],e=t.target;let n,s,a,i,h;for((n=e.shift())&&"object"==typeof n&&(h=n[r])&&(n=h.detach()),s=0,a=e.length;s<a;s++)(i=e[s])&&"object"==typeof i&&(h=i[r])&&(h.ownKey=s);return l(t,[{type:o,path:[0],oldValue:n,object:this}]),n},unshift:function(){const e=this[r],o=e.target,n=arguments.length,s=new Array(n);for(let t=0;t<n;t++)s[t]=p(arguments[t],t,e);const a=Reflect.apply(o.unshift,o,s);for(let t,e=0,n=o.length;e<n;e++)if((t=o[e])&&"object"==typeof t){const o=t[r];o&&(o.ownKey=e)}const i=s.length,h=new Array(i);for(let e=0;e<i;e++)h[e]={type:t,path:[e],value:o[e],object:this};return l(e,h),a},reverse:c,sort:f,fill:u,copyWithin:y,splice:function(){const n=this[r],s=n.target,a=arguments.length,i=new Array(a),h=s.length;for(let t=0;t<a;t++)i[t]=p(arguments[t],t,n);const c=0===a?0:i[0]<0?h+i[0]:i[0],f=a<2?h-c:i[1],u=Math.max(a-2,0),y=Reflect.apply(s.splice,s,i),b=s.length;let g,v,d,w;for(let t,e=0;e<b;e++)(t=s[e])&&"object"==typeof t&&(g=t[r])&&(g.ownKey=e);for(v=0,d=y.length;v<d;v++)(w=y[v])&&"object"==typeof w&&(g=w[r])&&(y[v]=g.detach());const j=[];let m;for(m=0;m<f;m++)m<u?j.push({type:e,path:[c+m],value:s[c+m],oldValue:y[m],object:this}):j.push({type:o,path:[c+m],oldValue:y[m],object:this});for(;m<u;m++)j.push({type:t,path:[c+m],value:s[c+m],object:this});return l(n,j),y}},g={reverse:c,sort:f,fill:u,copyWithin:y,set:function(t,o){const n=this[r],s=n.target,a=t.length,i=s.slice(0);o=o||0,s.set(t,o);const h=new Array(a);for(let t=o;t<a+o;t++)h[t-o]={type:e,path:[t],value:s[t],oldValue:i[t],object:this};l(n,h)}};class v{constructor(t,e){const o=t.target,r=t.parent,n=t.ownKey;r&&void 0!==n?(this.parent=r,this.ownKey=n):(this.parent=null,this.ownKey=null);const s=e(o,this);this.observers=[],this.revokable=Proxy.revocable(s,this),this.proxy=this.revokable.proxy,this.target=s}detach(){return this.parent=null,this.target}set(o,n,s){let a=o[n];if(s!==a){const i=p(s,n,this);if(o[n]=i,a&&"object"==typeof a){const t=a[r];t&&(a=t.detach())}const h=void 0===a?[{type:t,path:[n],value:i,object:this.proxy}]:[{type:e,path:[n],value:i,oldValue:a,object:this.proxy}];l(this,h)}return!0}deleteProperty(t,e){let n=t[e];if(delete t[e],n&&"object"==typeof n){const t=n[r];t&&(n=t.detach())}const s=[{type:o,path:[e],oldValue:n,object:this.proxy}];return l(this,s),!0}}class d extends v{constructor(t){super(t,a)}}class w extends v{constructor(t){super(t,i)}get(t,e){return b.hasOwnProperty(e)?b[e]:t[e]}}class j extends v{constructor(t){super(t,h)}get(t,e){return g.hasOwnProperty(e)?g[e]:t[e]}}class m{constructor(){throw new Error('Observable MAY NOT be created via constructor, see "Observable.from" API')}static from(t){if(t&&"object"==typeof t){if(t[r])return t;if(Array.isArray(t))return new w({target:t,ownKey:null,parent:null}).proxy;if(ArrayBuffer.isView(t))return new j({target:t,ownKey:null,parent:null}).proxy;if(t instanceof Date||t instanceof Blob||t instanceof Error)throw new Error(`${t} found to be one of non-observable types`);return new d({target:t,ownKey:null,parent:null}).proxy}throw new Error("observable MAY ONLY be created from a non-null object")}static isObservable(t){return!(!t||!t[r])}}Object.freeze(m);export{m as Observable};
const t="insert",e="update",o="delete",r=Symbol("observable-meta-key"),n={async:1},s={path:1,pathsOf:1,pathsFrom:1},i={[r]:{value:null},observe:{value:function(t,e){if("function"!=typeof t)throw new Error(`observer MUST be a function, got '${t}'`);const o=this[r].observers;if(o.some(e=>e[0]===t))console.warn("observer may be bound to an observable only once; will NOT rebind");else{let r;r=e?function(t){const e={};if(void 0!==t.path){if("string"!=typeof t.path||""===t.path)throw new Error('"path" option, if/when provided, MUST be a non-empty string');e.path=t.path}if(void 0!==t.pathsOf){if(t.path)throw new Error('"pathsOf" option MAY NOT be specified together with "path" option');if("string"!=typeof t.pathsOf)throw new Error('"pathsOf" option, if/when provided, MUST be a string (MAY be empty)');e.pathsOf=t.pathsOf.split(".").filter(t=>t)}if(void 0!==t.pathsFrom){if(t.path||t.pathsOf)throw new Error('"pathsFrom" option MAY NOT be specified together with "path"/"pathsOf" option/s');if("string"!=typeof t.pathsFrom||""===t.pathsFrom)throw new Error('"pathsFrom" option, if/when provided, MUST be a non-empty string');e.pathsFrom=t.pathsFrom}const o=Object.keys(t).filter(t=>!s.hasOwnProperty(t));if(o.length)throw new Error(`'${o.join(", ")}' is/are not a valid observer option/s`);return e}(e):{},o.push([t,r])}}},unobserve:{value:function(){const t=this[r].observers;let e=t.length;if(e){let o=arguments.length;if(o)for(;o--;){let r=e;for(;r--;)t[r][0]===arguments[o]&&(t.splice(r,1),e--)}else t.splice(0)}}}},a=function(t,e){i[r].value=e;const o=Object.keys(t),n=Object.defineProperties({},i);let s,a=o.length;for(;a--;)n[s=o[a]]=u(t[s],s,e);return n},h=function(t,e){let o=t.length;i[r].value=e;const n=Object.defineProperties(new Array(o),i);for(;o--;)n[o]=u(t[o],o,e);return n},l=function(t,e){return i[r].value=e,Object.defineProperties(t,i),t},p=function(t,e){let o=e;if(t.path){const r=t.path;o=e.filter(t=>t.path.join(".")===r)}else if(t.pathsOf){const r=t.pathsOf;o=e.filter(t=>t.path.length===r.length+1||t.path.length===r.length&&("reverse"===t.type||"shuffle"===t.type))}else if(t.pathsFrom){const r=t.pathsFrom;o=e.filter(t=>t.path.join(".").startsWith(r))}return o},c=function(){const t=this.batches;this.batches=null;for(const e of t)e[0](e[1])},f=function(t,e){let o,r,n,s,i,a,h,l,f=t;const u=e.length;do{for(a=(o=f.observers).length;a--;)try{if(r=o[a],n=r[0],s=r[1],(i=p(s,e)).length)if(f.options.async){f.batches||(f.batches=[],queueMicrotask(c.bind(f)));let t=f.batches.find(t=>t[0]===n);t||(t=[n,[]],f.batches.push(t)),Array.prototype.push.apply(t[1],i)}else n(i)}catch(t){console.error(`failed to deliver changes to listener ${n}`,t)}let t;if(f.parent){t=new Array(u);for(let o=0;o<u;o++)l=e[o],h=[f.ownKey,...l.path],t[o]={type:l.type,path:h,value:l.value,oldValue:l.oldValue,object:l.object};e=t,f=f.parent}else f=null}while(f)},u=function(t,e,o){return t&&"object"==typeof t?Array.isArray(t)?new m({target:t,ownKey:e,parent:o}).proxy:ArrayBuffer.isView(t)?new x({target:t,ownKey:e,parent:o}).proxy:t instanceof Date||t instanceof Blob||t instanceof Error?t:new O({target:t,ownKey:e,parent:o}).proxy:t},y=function(){const t=this[r],e=t.target;let o,n,s;for(e.reverse(),o=0,n=e.length;o<n;o++)if((s=e[o])&&"object"==typeof s){const t=s[r];t&&(t.ownKey=o)}return f(t,[{type:"reverse",path:[],object:this}]),this},b=function(t){const e=this[r],o=e.target;let n,s,i;for(o.sort(t),n=0,s=o.length;n<s;n++)if((i=o[n])&&"object"==typeof i){const t=i[r];t&&(t.ownKey=n)}return f(e,[{type:"shuffle",path:[],object:this}]),this},w=function(o,n,s){const i=this[r],a=i.target,h=[],l=a.length,p=a.slice(0);if(n=void 0===n?0:n<0?Math.max(l+n,0):Math.min(n,l),s=void 0===s?l:s<0?Math.max(l+s,0):Math.min(s,l),n<l&&s>n){let l;a.fill(o,n,s);for(let o,c,f=n;f<s;f++)o=a[f],a[f]=u(o,f,i),p.hasOwnProperty(f)?((c=p[f])&&"object"==typeof c&&(l=c[r])&&(c=l.detach()),h.push({type:e,path:[f],value:a[f],oldValue:c,object:this})):h.push({type:t,path:[f],value:a[f],object:this});f(i,h)}return this},g=function(t,o,n){const s=this[r],i=s.target,a=i.length;t=t<0?Math.max(a+t,0):t,o=void 0===o?0:o<0?Math.max(a+o,0):Math.min(o,a),n=void 0===n?a:n<0?Math.max(a+n,0):Math.min(n,a);const h=Math.min(n-o,a-t);if(t<a&&t!==o&&h>0){const a=i.slice(0),l=[];i.copyWithin(t,o,n);for(let o,n,p,c=t;c<t+h;c++)(o=i[c])&&"object"==typeof o&&(o=u(o,c,s),i[c]=o),(n=a[c])&&"object"==typeof n&&(p=n[r])&&(n=p.detach()),"object"!=typeof o&&o===n||l.push({type:e,path:[c],value:o,oldValue:n,object:this});f(s,l)}return this},v={pop:function(){const t=this[r],e=t.target,n=e.length-1;let s=e.pop();if(s&&"object"==typeof s){const t=s[r];t&&(s=t.detach())}return f(t,[{type:o,path:[n],oldValue:s,object:this}]),s},push:function(){const e=this[r],o=e.target,n=arguments.length,s=new Array(n),i=o.length;for(let t=0;t<n;t++)s[t]=u(arguments[t],i+t,e);const a=Reflect.apply(o.push,o,s),h=[];for(let e=i,r=o.length;e<r;e++)h[e-i]={type:t,path:[e],value:o[e],object:this};return f(e,h),a},shift:function(){const t=this[r],e=t.target;let n,s,i,a,h;for((n=e.shift())&&"object"==typeof n&&(h=n[r])&&(n=h.detach()),s=0,i=e.length;s<i;s++)(a=e[s])&&"object"==typeof a&&(h=a[r])&&(h.ownKey=s);return f(t,[{type:o,path:[0],oldValue:n,object:this}]),n},unshift:function(){const e=this[r],o=e.target,n=arguments.length,s=new Array(n);for(let t=0;t<n;t++)s[t]=u(arguments[t],t,e);const i=Reflect.apply(o.unshift,o,s);for(let t,e=0,n=o.length;e<n;e++)if((t=o[e])&&"object"==typeof t){const o=t[r];o&&(o.ownKey=e)}const a=s.length,h=new Array(a);for(let e=0;e<a;e++)h[e]={type:t,path:[e],value:o[e],object:this};return f(e,h),i},reverse:y,sort:b,fill:w,copyWithin:g,splice:function(){const n=this[r],s=n.target,i=arguments.length,a=new Array(i),h=s.length;for(let t=0;t<i;t++)a[t]=u(arguments[t],t,n);const l=0===i?0:a[0]<0?h+a[0]:a[0],p=i<2?h-l:a[1],c=Math.max(i-2,0),y=Reflect.apply(s.splice,s,a),b=s.length;let w,g,v,d;for(let t,e=0;e<b;e++)(t=s[e])&&"object"==typeof t&&(w=t[r])&&(w.ownKey=e);for(g=0,v=y.length;g<v;g++)(d=y[g])&&"object"==typeof d&&(w=d[r])&&(y[g]=w.detach());const j=[];let O;for(O=0;O<p;O++)O<c?j.push({type:e,path:[l+O],value:s[l+O],oldValue:y[O],object:this}):j.push({type:o,path:[l+O],oldValue:y[O],object:this});for(;O<c;O++)j.push({type:t,path:[l+O],value:s[l+O],object:this});return f(n,j),y}},d={reverse:y,sort:b,fill:w,copyWithin:g,set:function(t,o){const n=this[r],s=n.target,i=t.length,a=s.slice(0);o=o||0,s.set(t,o);const h=new Array(i);for(let t=o;t<i+o;t++)h[t-o]={type:e,path:[t],value:s[t],oldValue:a[t],object:this};f(n,h)}};class j{constructor(t,e){const o=t.target,r=t.parent,n=t.ownKey;r&&void 0!==n?(this.parent=r,this.ownKey=n):(this.parent=null,this.ownKey=null);const s=e(o,this);this.observers=[],this.revokable=Proxy.revocable(s,this),this.proxy=this.revokable.proxy,this.target=s,this.processOptions(t.options)}processOptions(t){if(t){if("object"!=typeof t)throw new Error(`Observable options if/when provided, MAY only be a non-null object, got '${t}'`);const e=Object.keys(t).filter(t=>!n.hasOwnProperty(t));if(e.length)throw new Error(`'${e.join(", ")}' is/are not a valid Observable option/s`);this.options=Object.assign({},t)}else this.options={}}detach(){return this.parent=null,this.target}set(o,n,s){let i=o[n];if(s!==i){const a=u(s,n,this);if(o[n]=a,i&&"object"==typeof i){const t=i[r];t&&(i=t.detach())}const h=void 0===i?[{type:t,path:[n],value:a,object:this.proxy}]:[{type:e,path:[n],value:a,oldValue:i,object:this.proxy}];f(this,h)}return!0}deleteProperty(t,e){let n=t[e];if(delete t[e],n&&"object"==typeof n){const t=n[r];t&&(n=t.detach())}const s=[{type:o,path:[e],oldValue:n,object:this.proxy}];return f(this,s),!0}}class O extends j{constructor(t){super(t,a)}}class m extends j{constructor(t){super(t,h)}get(t,e){return v.hasOwnProperty(e)?v[e]:t[e]}}class x extends j{constructor(t){super(t,l)}get(t,e){return d.hasOwnProperty(e)?d[e]:t[e]}}class M{constructor(){throw new Error('Observable MAY NOT be created via constructor, see "Observable.from" API')}static from(t,e){if(t&&"object"==typeof t){if(t[r])return t;if(Array.isArray(t))return new m({target:t,ownKey:null,parent:null,options:e}).proxy;if(ArrayBuffer.isView(t))return new x({target:t,ownKey:null,parent:null,options:e}).proxy;if(t instanceof Date||t instanceof Blob||t instanceof Error)throw new Error(`${t} found to be one of a on-observable types`);return new O({target:t,ownKey:null,parent:null,options:e}).proxy}throw new Error("observable MAY ONLY be created from a non-null object")}static isObservable(t){return!(!t||!t[r])}}Object.freeze(M);export{M as Observable};

@@ -1,1 +0,1 @@

import{ensureObservable,getPath,callViewFunction,getRandomKey}from"./utils.min.js";const MODEL_KEY=Symbol("model.key"),tieNameValidator=/^[a-zA-Z0-9]+$/,reservedTieNames=["scope"];class Tie{constructor(e,t,i){this.key=e,this.ties=i,this.model=t}set model(e){this[MODEL_KEY]=ensureObservable(e),this[MODEL_KEY].observe(e=>this.processDataChanges(e))}get model(){return this[MODEL_KEY]}processDataChanges(e){const t=this.ties.dti.views.obtainTieViews(this.key),i=t._pathsCache,s=i.length;let o,r,a,n,h,l,d,c,y,p,f,m,w,E,g,u,v,T="";if(s)for(o=0,r=e.length;o<r;o++)if(l=(h=(a=e[o]).path).length,!h.some(e=>"symbol"==typeof e)){for(E=!1,n=a.object,!Array.isArray(n)||"insert"!==a.type&&"delete"!==a.type||isNaN(h[h.length-1])?1===l?T=h[0]:l&&(T=2===l?h[0]+"."+h[1]:h.join(".")):(T=h.slice(0,-1).join("."),E=!0),f=T.length,d=s,v=new Map;d;)if(f>(c=i[--d]).length?(m=c,w=T):(m=T,w=c),g=m===w&&!E,0===w.indexOf(m))for(p=(y=t[c]).length;p;){u=y[--p];let e=v.get(u);e||(e={},v.set(u,e)),e[c]=g}this.updateViews(v,a)}}updateViews(e,t){let i,s;e.forEach((e,o)=>{for(i=o[this.ties.dti.paramsKey],s=i.length;s;){const r=i[--s];if(r.isFunctional){if(r.fParams.some(t=>t.tieKey===this.key&&t.rawPath in e)){let e=!1;const i=[];r.fParams.forEach(t=>{let s;const o=this.ties.get(t.tieKey);o&&(s=getPath(o,t.path),e=!0),i.push(s)}),e&&(i.push([t]),callViewFunction(o,r.targetProperty,i))}}else{if(r.tieKey!==this.key)continue;if(!(r.rawPath in e))continue;let i;void 0===(i=t&&void 0!==t.value&&e[r.rawPath]?t.value:getPath(this[MODEL_KEY],r.path))&&(i=""),this.ties.dti.views.setViewProperty(o,r,i)}}})}}export class Ties{constructor(e){this.dti=e,this.ties={}}get(e){const t="string"==typeof e?e:e?e[this.dti.scopeRootKey]:void 0,i=this.ties[t];return i?i.model:null}create(e,t){if(this.ties[e])throw new Error(`tie '${e}' already exists`);if(null===t)throw new Error("initial model, when provided, MUST NOT be null");this.validateTieKey(e);let i=e;"string"!=typeof i&&((i=e[this.dti.scopeRootKey])||(i=getRandomKey(16),e[this.dti.scopeRootKey]=i));const s=this.dti.views.obtainTieViews(i),o=new Tie(i,t,this,s);return this.ties[i]=o,o.processDataChanges([{path:[]}]),o.model}update(e,t){if(!t||"object"!=typeof t)throw new Error("model MUST be a non-null object");const i="string"==typeof e?e:e?e[this.dti.scopeRootKey]:void 0,s=this.ties[i];return s?(s.model!==t&&(s.model=t,s.processDataChanges([{path:[]}])),s.model):this.create(i,t)}remove(e){let t=e;if("object"==typeof e)t=e.nodeType===Node.ELEMENT_NODE?e[this.dti.scopeRootKey]:Object.keys(this.ties).find(t=>this.ties[t].model===e);else if("string"!=typeof e)throw new Error(`invalid tieToRemove parameter ${e}`);this.ties[t]&&(delete this.ties[t],this.dti.views.deleteTieViews(t))}validateTieKey(e){if(!e)throw new Error(`invalid key '${e}'`);if("string"==typeof e){if(!tieNameValidator.test(e))throw new Error(`tie key MUST match ${tieNameValidator}; '${e}' doesn't`);if(reservedTieNames.indexOf(e)>=0)throw new Error(`tie key MUST NOT be one of those: ${reservedTieNames.join(", ")}`)}else if(!e.nodeType||e.nodeType!==Node.ELEMENT_NODE)throw new Error(`invalid key '${e}'`)}};
import{ensureObservable,getPath,callViewFunction,getRandomKey}from"./utils.min.js";const MODEL_KEY=Symbol("model.key"),tieNameValidator=/^[a-zA-Z0-9]+$/,reservedTieNames=["scope"];class Tie{constructor(e,t,i){this.key=e,this.ties=i,this.model=t}set model(e){this[MODEL_KEY]=ensureObservable(e),this[MODEL_KEY].observe(e=>this.processDataChanges(e))}get model(){return this[MODEL_KEY]}processDataChanges(e){const t=this.ties.dti.views.obtainTieViews(this.key),i=t._pathsCache,s=i.length;let o,r,a,n,h,l,d,c,p,y,f,m,w,T,g,E,u,v="";if(s)for(o=0,r=e.length;o<r;o++)if(l=(h=(a=e[o]).path).length,!h.some(e=>"symbol"==typeof e)){for(T=!1,n=a.object,!Array.isArray(n)||"insert"!==a.type&&"delete"!==a.type||isNaN(h[h.length-1])?1===l?v=h[0]:l&&(v=2===l?h[0]+"."+h[1]:h.join(".")):(v=h.slice(0,-1).join("."),T=!0),f=v.length,d=s,u=new Map;d;)if(f>(c=i[--d]).length?(m=c,w=v):(m=v,w=c),g=m===w&&!T,0===w.indexOf(m))for(y=(p=t[c]).length;y;){E=p[--y];let e=u.get(E);e||(e={},u.set(E,e)),e[c]=g}this.updateViews(u,a)}}updateViews(e,t){let i,s;e.forEach((e,o)=>{for(i=o[this.ties.dti.paramsKey],s=i.length;s;){const r=i[--s];if(r.isFunctional){if(r.fParams.some(t=>t.tieKey===this.key&&t.rawPath in e)){let e=!1;const i=[];r.fParams.forEach(t=>{let s;const o=this.ties.get(t.tieKey);o&&(s=getPath(o,t.path),e=!0),i.push(s)}),e&&(i.push([t]),callViewFunction(o,r.targetProperty,i))}}else{if(r.tieKey!==this.key)continue;if(!(r.rawPath in e))continue;let i;void 0===(i=t&&void 0!==t.value&&e[r.rawPath]?t.value:getPath(this[MODEL_KEY],r.path))&&(i=""),this.ties.dti.views.setViewProperty(o,r,i)}}})}}export class Ties{constructor(e){this.dti=e,this.ties={}}get(e){const t="string"==typeof e?e:e?e[this.dti.scopeRootTieKey]:void 0,i=this.ties[t];return i?i.model:null}create(e,t){if(null===t)throw new Error("initial model, when provided, MUST NOT be null");let i;if("string"==typeof e?i=e:e&&e.nodeType&&e.nodeType===Node.ELEMENT_NODE&&((i=e[this.dti.scopeRootTieKey])||(i=e[this.dti.scopeRootTieKey]=getRandomKey(16))),Ties.validateTieKey(i),this.ties[i])throw new Error(`tie '${i}' already exists`);e.nodeType&&this.dti.addTree(e);const s=this.dti.views.obtainTieViews(i),o=new Tie(i,t,this,s);return this.ties[i]=o,o.processDataChanges([{path:[]}]),o.model}update(e,t){if(!t||"object"!=typeof t)throw new Error("model MUST be a non-null object");const i="string"==typeof e?e:e?e[this.dti.scopeRootTieKey]:void 0,s=this.ties[i];return s?(s.model!==t&&(s.model=t,s.processDataChanges([{path:[]}])),s.model):this.create(e,t)}remove(e){let t=e;if("object"==typeof e)t=e.nodeType===Node.ELEMENT_NODE?e[this.dti.scopeRootTieKey]:Object.keys(this.ties).find(t=>this.ties[t].model===e);else if("string"!=typeof e)throw new Error(`invalid tieToRemove parameter ${e}`);this.ties[t]&&(delete this.ties[t],this.dti.views.deleteTieViews(t))}static validateTieKey(e){if(!e||"string"!=typeof e)throw new Error(`invalid key '${e}'`);if(!tieNameValidator.test(e))throw new Error(`tie key MUST match ${tieNameValidator}; '${e}' doesn't`);if(reservedTieNames.indexOf(e)>=0)throw new Error(`tie key MUST NOT be one of those: ${reservedTieNames.join(", ")}`)}};

@@ -1,1 +0,1 @@

import{Observable}from"./object-observer.min.js";const DEFAULT_TIE_TARGET_PROVIDER="defaultTieTarget",CHANGE_EVENT_NAME_PROVIDER="changeEventName",PARAM_SPLITTER=/\s*=>\s*/,MULTI_PARAMS_SPLITTER=/\s*[,;]\s*/,DEFAULT_VALUE_ELEMENTS={INPUT:1,SELECT:1,TEXTAREA:1},DEFAULT_SRC_ELEMENTS={IMG:1,IFRAME:1,SOURCE:1},DEFAULT_HREF_ELEMENTS={A:1,ANIMATE:1,AREA:1,BASE:1,DISCARD:1,IMAGE:1,LINK:1,PATTERN:1,use:1},DEFAULT_CHANGE_ELEMENTS={INPUT:1,SELECT:1,TEXTAREA:1},randomKeySource="abcdefghijklmnopqrstuvwxyz0123456789",randomKeySourceLen=randomKeySource.length;export{DEFAULT_TIE_TARGET_PROVIDER,ensureObservable,getTargetProperty,extractViewParams,CHANGE_EVENT_NAME_PROVIDER,addChangeListener,delChangeListener,getPath,setPath,callViewFunction,getRandomKey};class Parameter{constructor(e,t,r,n,a,o){this.tieKey=e,this.rawPath=t,this.path=r,this.targetProperty=n,this.isFunctional=a,this.fParams=o,this.iClasses=null}}function ensureObservable(e){return e?Observable.isObservable(e)?e:Observable.from(e):Observable.from({})}function getTargetProperty(e){let t=e[DEFAULT_TIE_TARGET_PROVIDER];if(!t){const r=e.nodeName;t="INPUT"===r&&"checkbox"===e.type?"checked":r in DEFAULT_VALUE_ELEMENTS?"value":r in DEFAULT_SRC_ELEMENTS?"src":r in DEFAULT_HREF_ELEMENTS?"href":"textContent"}return t}function extractViewParams(e,t){const r=e.getAttribute("data-tie");return r?parseViewParams(r,e,t):null}function parseViewParams(e,t,r){const n=[],a={},o=e.split(MULTI_PARAMS_SPLITTER),s=o.length;let i,l,E,c=0;for(;c<s;c++)if((i=o[c])&&(l&&(l+=","+i),!(i.indexOf("(")>0&&(l=i).indexOf(")")<0)))try{l?(E=parseFunctionParam(l,r),l=null):E=parsePropertyParam(i,t,r),E.targetProperty in a?console.error(`elements's property '${E.targetProperty}' tied more than once; all but first dismissed`):(n.push(E),a[E.targetProperty]=!0)}catch(e){console.error(`failed to parse one of a multi param parts (${i}), skipping it`,e)}return n}function parseFunctionParam(e,t){const r=e.split(/[()]/),n=r[1].split(/\s*,\s*/).map(e=>{const t=e.split(":");if(!t.length||t.length>2||!t[0])throw new Error("invalid function tied value: "+e);const r=t.length>1?t[1]:"";return{tieKey:t[0],rawPath:r,path:r.split(".").filter(e=>e)}});if(!n.length)throw new Error(`functional tie parameter MUST have at least one tied argument, '${e}' doesn't`);return new Parameter(null,null,null,r[0],!0,n)}function parsePropertyParam(e,t,r){const n=e.split(PARAM_SPLITTER);1===n.length&&n.push(getTargetProperty(t));const a=n[0].split(":");if(!a.length||a.length>2||!a[0])throw new Error(`invalid tie parameter '${e}'; expected (example): "orders:0.address.street, orders:0.address.apt => title"`);let o=a[0];"scope"===a[0]&&(o=getScopeTieKey(t,r));const s=a.length>1?a[1]:"",i=new Parameter(o,s,s.split(".").filter(e=>e),n[1],!1,null);return"classList"===i.targetProperty&&(i.iClasses=Array.from(t.classList)),i}function getScopeTieKey(e,t){let r=e,n=r[t];for(;!n&&r.parentNode;)(r=r.parentNode).host&&(r=r.host),n=r[t];return n||null}function addChangeListener(e,t){const r=obtainChangeEventName(e);r&&e.addEventListener(r,t)}function delChangeListener(e,t){const r=obtainChangeEventName(e);r&&e.removeEventListener(r,t)}function obtainChangeEventName(e){let t=e[CHANGE_EVENT_NAME_PROVIDER];return t||e.nodeName in DEFAULT_CHANGE_ELEMENTS&&(t="change"),t}function getPath(e,t){if(!e)return null;const r=t,n=r.length;if(!n)return e;let a,o=e,s=0;for(;s<n-1;s++)if(null===(o=o[a=r[s]])||void 0===o)return o;return o[r[s]]}function setPath(e,t,r){if(!e)return;const n=t.length;let a,o,s=0;for(;s<n-1;s++)if((o=e[a=t[s]])&&"object"==typeof o)e=o;else if(void 0===o||null===o)e[a]={},e=e[a];else if("object"!=typeof o)return void console.error("setting deep path MAY NOT override primitives along the way");e[t[s]]=r}function callViewFunction(e,t,r){try{e[t].apply(e,r)}catch(n){console.error(`failed to call '${t}' of '${e}' with '${r}'`,n)}}function getRandomKey(e){let t="",r=e;const n=crypto.getRandomValues(new Uint8Array(e));for(;r;)r--,t+=randomKeySource.charAt(randomKeySourceLen*n[r]/256);return t}
import{Observable}from"./object-observer.min.js";const DEFAULT_TIE_TARGET_PROVIDER="defaultTieTarget",CHANGE_EVENT_NAME_PROVIDER="changeEventName",PARAM_SPLITTER=/\s*=>\s*/,MULTI_PARAMS_SPLITTER=/\s*[,;]\s*/,DEFAULT_VALUE_ELEMENTS={INPUT:1,SELECT:1,TEXTAREA:1},DEFAULT_SRC_ELEMENTS={IMG:1,IFRAME:1,SOURCE:1},DEFAULT_HREF_ELEMENTS={A:1,ANIMATE:1,AREA:1,BASE:1,DISCARD:1,IMAGE:1,LINK:1,PATTERN:1,use:1},DEFAULT_CHANGE_ELEMENTS={INPUT:1,SELECT:1,TEXTAREA:1},randomKeySource="abcdefghijklmnopqrstuvwxyz0123456789",randomKeySourceLen=randomKeySource.length;export{DEFAULT_TIE_TARGET_PROVIDER,ensureObservable,getTargetProperty,extractViewParams,CHANGE_EVENT_NAME_PROVIDER,addChangeListener,delChangeListener,getPath,setPath,callViewFunction,getRandomKey};class Parameter{constructor(e,t,r,n,a,o){this.tieKey=e,this.rawPath=t,this.path=r,this.targetProperty=n,this.isFunctional=a,this.fParams=o,this.iClasses=null}}function ensureObservable(e){return e?Observable.isObservable(e)?e:Observable.from(e):Observable.from({})}function getTargetProperty(e){let t=e[DEFAULT_TIE_TARGET_PROVIDER];if(!t){const r=e.nodeName;t="INPUT"===r&&"checkbox"===e.type?"checked":r in DEFAULT_VALUE_ELEMENTS?"value":r in DEFAULT_SRC_ELEMENTS?"src":r in DEFAULT_HREF_ELEMENTS?"href":"textContent"}return t}function extractViewParams(e,t){const r=e.getAttribute("data-tie");return r?parseViewParams(r,e,t):null}function parseViewParams(e,t,r){const n=[],a={},o=e.split(MULTI_PARAMS_SPLITTER),s=o.length;let i,l,E,c=0;for(;c<s;c++)if((i=o[c])&&(l&&(l+=","+i),!(i.indexOf("(")>0&&(l=i).indexOf(")")<0)))try{l?(E=parseFunctionParam(l),l=null):E=parsePropertyParam(i,t,r),E.targetProperty in a?console.error(`elements's property '${E.targetProperty}' tied more than once; all but first dismissed`):(n.push(E),a[E.targetProperty]=!0)}catch(e){console.error(`failed to parse one of a multi param parts (${i}), skipping it`,e)}return n}function parseFunctionParam(e){const t=e.split(/[()]/),r=t[1].split(/\s*,\s*/).map(e=>{const t=e.split(":");if(!t.length||t.length>2||!t[0])throw new Error("invalid function tied value: "+e);const r=t.length>1?t[1]:"";return{tieKey:t[0],rawPath:r,path:r.split(".").filter(e=>e)}});if(!r.length)throw new Error(`functional tie parameter MUST have at least one tied argument, '${e}' doesn't`);return new Parameter(null,null,null,t[0],!0,r)}function parsePropertyParam(e,t,r){const n=e.split(PARAM_SPLITTER);1===n.length&&n.push(getTargetProperty(t));const a=n[0].split(":");if(!a.length||a.length>2||!a[0])throw new Error(`invalid tie parameter '${e}'; expected (example): "orders:0.address.street, orders:0.address.apt => title"`);let o=a[0];"scope"===a[0]&&(o=getScopeTieKey(t,r));const s=a.length>1?a[1]:"",i=new Parameter(o,s,s.split(".").filter(e=>e),n[1],!1,null);return"classList"===i.targetProperty&&(i.iClasses=Array.from(t.classList)),i}function getScopeTieKey(e,t){let r=e,n=r[t];for(;!n&&r.parentNode;)(r=r.parentNode).host&&(r=r.host),n=r[t];return n||null}function addChangeListener(e,t){const r=obtainChangeEventName(e);r&&e.addEventListener(r,t)}function delChangeListener(e,t){const r=obtainChangeEventName(e);r&&e.removeEventListener(r,t)}function obtainChangeEventName(e){let t=e[CHANGE_EVENT_NAME_PROVIDER];return t||e.nodeName in DEFAULT_CHANGE_ELEMENTS&&(t="change"),t}function getPath(e,t){if(!e)return null;const r=t,n=r.length;if(!n)return e;let a,o=e,s=0;for(;s<n-1;s++)if(null===(o=o[a=r[s]])||void 0===o)return o;return o[r[s]]}function setPath(e,t,r){if(!e)return;const n=t.length;let a,o,s=0;for(;s<n-1;s++)if((o=e[a=t[s]])&&"object"==typeof o)e=o;else if(void 0===o||null===o)e[a]={},e=e[a];else if("object"!=typeof o)return void console.error("setting deep path MAY NOT override primitives along the way");e[t[s]]=r}function callViewFunction(e,t,r){try{e[t].apply(e,r)}catch(n){console.error(`failed to call '${t}' of '${e}' with '${r}'`,n)}}function getRandomKey(e){let t="",r=e;const n=crypto.getRandomValues(new Uint8Array(e));for(;r;)r--,t+=randomKeySource.charAt(randomKeySourceLen*n[r]/256);return t}

@@ -1,1 +0,1 @@

import{getRandomKey}from"./utils.min.js";export class Views{constructor(e){this.dti=e,this.views={}}obtainTieViews(e){let t=this.views[e];return t||(t={_pathsCache:[]},this.views[e]=t),t}deleteTieViews(e){delete this.views[e]}addView(e,t){let s,i,o,r,n=t.length,a=!1;const h=void 0!==e[this.dti.scopeRootKey];for(;n;)if((s=t[--n]).isFunctional)for(r=(i=s.fParams).length;r;)o=i[--r],this.seekAndInsertView(o,e),h||"scope"!==o.targetProperty||(a=!0);else this.seekAndInsertView(s,e),h||"scope"!==s.targetProperty||(a=!0);e[this.dti.paramsKey]=t,a&&(e[this.dti.scopeRootKey]=getRandomKey(16))}delView(e,t){let s,i,o,r,n=t.length;for(;n;)if((s=t[--n]).isFunctional)for(r=(i=s.fParams).length;r;)o=i[--r],this.seekAndRemoveView(o,e);else this.seekAndRemoveView(s,e);delete e[this.dti.paramsKey]}seekAndInsertView(e,t){const s=e.tieKey,i=e.rawPath,o=this.obtainTieViews(s);let r=o[i];r||(r=[],o[i]=r,o._pathsCache.push(i)),r.indexOf(t)<0&&r.push(t)}seekAndRemoveView(e,t){const s=e.tieKey,i=e.rawPath,o=this.views[s];if(o){const e=o[i];if(e){const s=e.indexOf(t);s>=0&&e.splice(s,1)}}}setViewProperty(e,t,s){const i=t.targetProperty;try{this._unsafeSetProperty(e,t,s,i)}catch(t){console.error(`failed to set '${i}' of '${e}' to '${s}'`,t)}}_unsafeSetProperty(e,t,s,i){if("href"===i&&"object"==typeof e.href)e.href.baseVal=s;else if("scope"===i)this.dti.ties.update(e,s);else if("classList"===i){const i=t.iClasses.slice(0);s&&(Array.isArray(s)&&s.length?s.forEach(e=>{i.indexOf(e)<0&&i.push(e)}):"object"==typeof s?Object.keys(s).forEach(e=>{const t=i.indexOf(e);s[e]?t<0&&i.push(e):t>=0&&i.splice(t,1)}):"string"==typeof s&&i.indexOf(s)<0&&i.push(s)),e.className=i.join(" ")}else e[i]=s}};
import{getRandomKey}from"./utils.min.js";export class Views{constructor(e){this.dti=e,this.views={}}obtainTieViews(e){let t=this.views[e];return t||(t={_pathsCache:[]},this.views[e]=t),t}deleteTieViews(e){delete this.views[e]}addView(e,t){let s,i,o,r,n=t.length,a=!1;const h=void 0!==e[this.dti.scopeRootTieKey];let c=!1;for(;n;)if((s=t[--n]).isFunctional)for(r=(i=s.fParams).length;r;)(o=i[--r]).tieKey&&(this.seekAndInsertView(o,e),c=!0,h||"scope"!==o.targetProperty||(a=!0));else{if(!s.tieKey)continue;this.seekAndInsertView(s,e),c=!0,h||"scope"!==s.targetProperty||(a=!0)}c&&(e[this.dti.paramsKey]=t),a&&(e[this.dti.scopeRootTieKey]=getRandomKey(16))}delView(e,t){let s,i,o,r,n=t.length;for(;n;)if((s=t[--n]).isFunctional)for(r=(i=s.fParams).length;r;)o=i[--r],this.seekAndRemoveView(o,e);else this.seekAndRemoveView(s,e);delete e[this.dti.paramsKey]}seekAndInsertView(e,t){const s=e.tieKey,i=e.rawPath,o=this.obtainTieViews(s);let r=o[i];r||(r=[],o[i]=r,o._pathsCache.push(i)),r.indexOf(t)<0&&r.push(t)}seekAndRemoveView(e,t){const s=e.tieKey,i=e.rawPath,o=this.views[s];if(o){const e=o[i];if(e){const s=e.indexOf(t);s>=0&&e.splice(s,1)}}}setViewProperty(e,t,s){const i=t.targetProperty;try{this._unsafeSetProperty(e,t,s,i)}catch(t){console.error(`failed to set '${i}' of '${e}' to '${s}'`,t)}}_unsafeSetProperty(e,t,s,i){if("href"===i&&"object"==typeof e.href)e.href.baseVal=s;else if("scope"===i)this.dti.ties.update(e,s);else if("classList"===i){const i=t.iClasses.slice(0);s&&(Array.isArray(s)&&s.length?s.forEach(e=>{i.indexOf(e)<0&&i.push(e)}):"object"==typeof s?Object.keys(s).forEach(e=>{const t=i.indexOf(e);s[e]?t<0&&i.push(e):t>=0&&i.splice(t,1)}):"string"==typeof s&&i.indexOf(s)<0&&i.push(s)),e.className=i.join(" ")}else e[i]=s}};
{
"name": "data-tier-list",
"version": "1.0.2",
"version": "1.1.0",
"description": "List component based on DataTier binding engine",

@@ -34,2 +34,3 @@ "keywords": [

"browser": "dist/data-tier-list.min.js",
"type": "module",
"author": {

@@ -45,20 +46,15 @@ "name": "Guller Yuri",

"scripts": {
"build": "node ./build/tools/build-dist.js",
"lint": "eslint -c ./build/.eslintrc.json --ignore-path ./build/.eslintignore ./src/**/*.js",
"build": "node ./ci/tools/build-dist.js",
"lint": "eslint -c ./ci/.eslintrc.json ./src/*.js ./tests/*.js ./ci/**/*.js",
"test": "node ./node_modules/just-test/dist/tests-runner/run-tests.js --config=./tests/tests-runner-config.json"
},
"dependencies": {
"data-tier": "^2.9.4"
"data-tier": "^2.10.0"
},
"devDependencies": {
"eslint": "^7.6.0",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-standard": "^4.0.1",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-node": "^11.1.0",
"eslint": "^7.8.1",
"fs-extra": "^9.0.1",
"uglify-es": "^3.3.9",
"just-test": "^2.3.0"
"just-test": "2.3.2"
}
}

@@ -7,7 +7,26 @@ [![GitHub](https://img.shields.io/github/license/gullerya/data-tier-list.svg)](https://github.com/gullerya/data-tier-list)

## Overview
# Overview
`data-tier-list` is a WebComponent based on a [DataTier library](https://github.com/gullerya/data-tier) and providing visualization of a repeated contents.
`data-tier-list` is a WebComponent, that provides repetative view functionality - given a UI template for a single item and a tied data set, it'll reflect that set in UI continuously, including any further changes to the data set.
Note: the work is in progress and this is only an initial version for dev-purposes.
General availability note will be updated here.
`data-tier-list` supports the following data structures:
* `Array`
* `Object`
Uniformity of a data items **is not** validated/enforced, implying it being a consumer's concern.
`data-tier-list` based on a [data-tier](https://github.com/gullerya/data-tier) library for the model-view tying part.
# APIs and conditions
* `data-tier-list` element self and it's light DOM are **not** displayed
* light DOM of the `data-tier-list` is taken as an **item-template** for a single item
* item-template is observed for any changes; replacement of it or a change of its child/ren triggers a **full (re)render** of the list
* item-template may have **at most** one top level element (any nested elements tree allowed)
* item-template removal cleans the list
* item-template error (eg more than one child) throws, list remains untouched
# Latest changelog
TBD

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc