Comparing version 1.3.3 to 1.3.4
@@ -63,2 +63,10 @@ /** | ||
/** | ||
* A component can also declare itself open by returning this symbol | ||
*/ | ||
declare const open: unique symbol; | ||
/** | ||
* A component can also declare itself closed by returning this symbol | ||
*/ | ||
declare const closed: unique symbol; | ||
/** | ||
* An Actribute class. This is almost like a custom elements registry 'class'. | ||
@@ -169,8 +177,19 @@ */ | ||
* @param names | ||
* @param sources | ||
* @param scopes | ||
* @param sep | ||
* @returns | ||
*/ | ||
declare function props(names: string, sources: any[], sep?: string): any[]; | ||
declare function props(names: string, scopes: any[], sep?: string): any[]; | ||
/** | ||
* Join multiple components, so that they can be applied as one component. | ||
* Can reduce repetitive markup in many cases. If you specify a returnValue | ||
* the new component will return it, else it will return the return value of | ||
* the last component. | ||
* | ||
* @param components | ||
* @param returnValue | ||
* @returns | ||
*/ | ||
declare function join(components: IComponent[], returnValue?: any): (element: Element, attr: Attr, ...context: any[]) => any; | ||
export { Actribute, type IActributeInit, type IComponent, type IProcessOptions, type IRegisterMap, props }; | ||
export { Actribute, type IActributeInit, type IComponent, type IProcessOptions, type IRegisterMap, closed, join, open, props }; |
@@ -1,1 +0,1 @@ | ||
"use strict";function t(t,e){const r=e.split(".");let s=t[r[0].trim()];for(let e=1;e<r.length&&("object"==typeof s||"function"==typeof s);e++)s=(t=s)[r[e].trim()];return s}exports.Actribute=class{registry={};openAttr;closedAttr;constructor(t){this.openAttr=t?.open||"o-pen",this.closedAttr=t?.closed||"c-losed"}register(t){return Object.assign(this.registry,t)&&this}process(t){let e,r,s;"string"==typeof t?r=t:t instanceof Element?e=t:t instanceof Array?s=t:"object"==typeof t&&(e=t.el,r=t.attr,s=t.ctx),e||(e=document.body),r||(r="c-"),s||(s=[]);const o=e.attributes,i=o.length;let n,c,h,l=!1,f=e.hasAttribute(this.openAttr);for(c=0;c<i;c++)if(n=o[c],n&&n.name.startsWith(r))if(l=!0,h=n.name.substring(r.length),this.registry.hasOwnProperty(h))this.registry[h](e,n,...s);else{if(!this.registry.hasOwnProperty("*"))throw new Error(`The component "${h}" was not found in the registry.`);this.registry["*"](e,n,...s)}if(!l||f){let t=e.firstElementChild;for(;t;)t.hasAttribute(this.closedAttr)||this.process({el:t,attr:r,ctx:s}),t=t.nextElementSibling}return this}},exports.props=function(e,r,s){const o=[],i=r.length;let n,c,h;for(n of(e=e.trim()).split(s||" "))if(n=n.trim(),""!==n){for(c=void 0,h=-1;void 0===c&&++h<i;)c=t(r[h],n);if(void 0===c)throw new TypeError(`The property "${n}" was not found in any of the sources.`);o.push(c)}return o}; | ||
"use strict";const t=Symbol("Open component"),e=Symbol("Closed component");function r(t,e){const r=e.split(".");let o=t[r[0].trim()];for(let e=1;e<r.length&&("object"==typeof o||"function"==typeof o);e++)o=(t=o)[r[e].trim()];return o}exports.Actribute=class{registry={};openAttr;closedAttr;constructor(t){this.openAttr=t?.open||"o-pen",this.closedAttr=t?.closed||"c-losed"}register(t){return Object.assign(this.registry,t)&&this}process(r){let o,s,n;"string"==typeof r?s=r:r instanceof Element?o=r:r instanceof Array?n=r:"object"==typeof r&&(o=r.el,s=r.attr,n=r.ctx),o||(o=document.body),s||(s="c-"),n||(n=[]);const i=o.attributes,c=i.length;let l,p,h,f,u=!1,y=o.hasAttribute(this.openAttr),a=o.hasAttribute(this.closedAttr);for(p=0;p<c;p++)if(l=i[p],l&&l.name.startsWith(s)){if(u=!0,h=l.name.substring(s.length),this.registry.hasOwnProperty(h))f=this.registry[h](o,l,...n);else{if(!this.registry.hasOwnProperty("*"))throw new Error(`The component "${h}" was not found in the registry.`);f=this.registry["*"](o,l,...n)}f===t?y=!0:f===e&&(a=!0)}if(!u||y&&!a){let t=o.firstElementChild;for(;t;)t.hasAttribute(this.closedAttr)||this.process({el:t,attr:s,ctx:n}),t=t.nextElementSibling}return this}},exports.closed=e,exports.join=function(t,e){return(r,o,...s)=>{let n;for(let e of t)n=e(r,o,...s);return e||n}},exports.open=t,exports.props=function(t,e,o){"string"!=typeof t&&(t=t.toString());const s=[],n=e.length;let i,c,l;for(i of(t=t.trim()).split(o||" "))if(i=i.trim(),""!==i){for(c=void 0,l=-1;void 0===c&&++l<n;)c=r(e[l],i);if(void 0===c)throw new TypeError(`The property "${i}" was not found in any of the sources.`);s.push(c)}return s}; |
@@ -63,2 +63,10 @@ /** | ||
/** | ||
* A component can also declare itself open by returning this symbol | ||
*/ | ||
declare const open: unique symbol; | ||
/** | ||
* A component can also declare itself closed by returning this symbol | ||
*/ | ||
declare const closed: unique symbol; | ||
/** | ||
* An Actribute class. This is almost like a custom elements registry 'class'. | ||
@@ -169,8 +177,19 @@ */ | ||
* @param names | ||
* @param sources | ||
* @param scopes | ||
* @param sep | ||
* @returns | ||
*/ | ||
declare function props(names: string, sources: any[], sep?: string): any[]; | ||
declare function props(names: string, scopes: any[], sep?: string): any[]; | ||
/** | ||
* Join multiple components, so that they can be applied as one component. | ||
* Can reduce repetitive markup in many cases. If you specify a returnValue | ||
* the new component will return it, else it will return the return value of | ||
* the last component. | ||
* | ||
* @param components | ||
* @param returnValue | ||
* @returns | ||
*/ | ||
declare function join(components: IComponent[], returnValue?: any): (element: Element, attr: Attr, ...context: any[]) => any; | ||
export { Actribute, type IActributeInit, type IComponent, type IProcessOptions, type IRegisterMap, props }; | ||
export { Actribute, type IActributeInit, type IComponent, type IProcessOptions, type IRegisterMap, closed, join, open, props }; |
@@ -1,1 +0,1 @@ | ||
class t{registry={};openAttr;closedAttr;constructor(t){this.openAttr=t?.open||"o-pen",this.closedAttr=t?.closed||"c-losed"}register(t){return Object.assign(this.registry,t)&&this}process(t){let e,r,s;"string"==typeof t?r=t:t instanceof Element?e=t:t instanceof Array?s=t:"object"==typeof t&&(e=t.el,r=t.attr,s=t.ctx),e||(e=document.body),r||(r="c-"),s||(s=[]);const o=e.attributes,i=o.length;let n,h,c,l=!1,f=e.hasAttribute(this.openAttr);for(h=0;h<i;h++)if(n=o[h],n&&n.name.startsWith(r))if(l=!0,c=n.name.substring(r.length),this.registry.hasOwnProperty(c))this.registry[c](e,n,...s);else{if(!this.registry.hasOwnProperty("*"))throw new Error(`The component "${c}" was not found in the registry.`);this.registry["*"](e,n,...s)}if(!l||f){let t=e.firstElementChild;for(;t;)t.hasAttribute(this.closedAttr)||this.process({el:t,attr:r,ctx:s}),t=t.nextElementSibling}return this}}function e(t,e){const r=e.split(".");let s=t[r[0].trim()];for(let e=1;e<r.length&&("object"==typeof s||"function"==typeof s);e++)s=(t=s)[r[e].trim()];return s}function r(t,r,s){const o=[],i=r.length;let n,h,c;for(n of(t=t.trim()).split(s||" "))if(n=n.trim(),""!==n){for(h=void 0,c=-1;void 0===h&&++c<i;)h=e(r[c],n);if(void 0===h)throw new TypeError(`The property "${n}" was not found in any of the sources.`);o.push(h)}return o}export{t as Actribute,r as props}; | ||
const t=Symbol("Open component"),e=Symbol("Closed component");class r{registry={};openAttr;closedAttr;constructor(t){this.openAttr=t?.open||"o-pen",this.closedAttr=t?.closed||"c-losed"}register(t){return Object.assign(this.registry,t)&&this}process(r){let o,s,n;"string"==typeof r?s=r:r instanceof Element?o=r:r instanceof Array?n=r:"object"==typeof r&&(o=r.el,s=r.attr,n=r.ctx),o||(o=document.body),s||(s="c-"),n||(n=[]);const i=o.attributes,c=i.length;let l,h,f,p,u=!1,y=o.hasAttribute(this.openAttr),a=o.hasAttribute(this.closedAttr);for(h=0;h<c;h++)if(l=i[h],l&&l.name.startsWith(s)){if(u=!0,f=l.name.substring(s.length),this.registry.hasOwnProperty(f))p=this.registry[f](o,l,...n);else{if(!this.registry.hasOwnProperty("*"))throw new Error(`The component "${f}" was not found in the registry.`);p=this.registry["*"](o,l,...n)}p===t?y=!0:p===e&&(a=!0)}if(!u||y&&!a){let t=o.firstElementChild;for(;t;)t.hasAttribute(this.closedAttr)||this.process({el:t,attr:s,ctx:n}),t=t.nextElementSibling}return this}}function o(t,e){const r=e.split(".");let o=t[r[0].trim()];for(let e=1;e<r.length&&("object"==typeof o||"function"==typeof o);e++)o=(t=o)[r[e].trim()];return o}function s(t,e,r){"string"!=typeof t&&(t=t.toString());const s=[],n=e.length;let i,c,l;for(i of(t=t.trim()).split(r||" "))if(i=i.trim(),""!==i){for(c=void 0,l=-1;void 0===c&&++l<n;)c=o(e[l],i);if(void 0===c)throw new TypeError(`The property "${i}" was not found in any of the sources.`);s.push(c)}return s}function n(t,e){return(r,o,...s)=>{let n;for(let e of t)n=e(r,o,...s);return e||n}}export{r as Actribute,e as closed,n as join,t as open,s as props}; |
{ | ||
"name": "deleight", | ||
"version": "1.3.3", | ||
"version": "1.3.4", | ||
"description": "A group of 8 libraries for writing accessible and joyfully interactive web applications with traditional HTML, CSS and JavaScript.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -222,5 +222,4 @@ # Deleight | ||
3. Complete and add more examples. | ||
4. Discuss features, issues and related subjects on the site and in other channels. | ||
5. Improve the documentation. | ||
6. Work on further ideas. | ||
4. Improve the documentation. | ||
5. Fix the logo... | ||
@@ -227,0 +226,0 @@ ## Ideas |
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
135826
2728
230