Socket
Socket
Sign inDemoInstall

deleight

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deleight - npm Package Compare versions

Comparing version 1.0.4 to 1.1.0

2

dist/cjs/appliance.js

@@ -82,3 +82,3 @@ 'use strict';

*
* @param {ApplyMap } applyMap
* @param {IApplyMap } applyMap
* @param {HTMLElement} [containerElement]

@@ -85,0 +85,0 @@ * @param {boolean|number} [asComponent]

@@ -89,5 +89,5 @@ 'use strict';

* Defaults to the empty string.
* @returns {ArrayTemplate}
* @returns {ITemplates}
*/
function arrayTemplate(templateStr, argNames, itemName) {
function templates(templateStr, argNames, itemName) {
if (!argNames)

@@ -97,9 +97,7 @@ argNames = [];

itemName = "item";
return Function("arr", ...argNames, `
const result = [];
for (let ${itemName} of arr) {
result.push(\`${templateStr}\`);
return (Function(`
function* gen(arr, ${argNames.join(', ')}) {
for (let ${itemName} of arr) yield \`${templateStr}\`;
}
return result;
`);
return gen;`))();
}

@@ -123,5 +121,5 @@ /**

* the default name (T) is present in argNames.
* @returns {AsyncArrayTemplate}
* @returns {IAsyncTemplates}
*/
function asyncArrayTemplate(templateStr, argNames, itemName, tagName) {
function asyncTemplates(templateStr, argNames, itemName, tagName) {
if (!argNames)

@@ -141,9 +139,7 @@ argNames = [];

}
const f = Function(tagName, "arr", ...argNames, `
const result = [];
for (let ${itemName} of arr) {
result.push(${tagName}\`${templateStr}\`);
const f = (Function(`
function* gen(${tagName}, arr, ${argNames.join(', ')}) {
for (let ${itemName} of arr) yield ${tagName}\`${templateStr}\`;
}
return Promise.all(result).then(resolved => resolved);
`);
return gen;`))();
return (arr, ...args) => f(tag, arr, ...args);

@@ -194,5 +190,4 @@ }

exports.arrayTemplate = arrayTemplate;
exports.asyncArrayTemplate = asyncArrayTemplate;
exports.asyncTemplate = asyncTemplate;
exports.asyncTemplates = asyncTemplates;
exports.createFragment = createFragment;

@@ -202,1 +197,2 @@ exports.get = get;

exports.template = template;
exports.templates = templates;

@@ -21,3 +21,3 @@ 'use strict';

* @param {Iterable<Node>} values The new nodes to insert.
* @param {Inserter} [insertWith] The insertion function
* @param {IInserter} [insertWith] The insertion function
*/

@@ -71,3 +71,3 @@ function insert(elements, values, insertWith) {

* @param {(Element|CSSStyleRule)[]} elements
* @param {SetMap} values
* @param {ISetMap} values
*/

@@ -74,0 +74,0 @@ function set(elements, values) {

@@ -113,3 +113,3 @@ 'use strict';

*
* @param {Matcher} matcher Map of event target matcher to associated handler function
* @param {IMatcher} matcher Map of event target matcher to associated handler function
* @param {boolean} wrapListeners Whether to werap the matcher functions with `eventListener`.

@@ -116,0 +116,0 @@ */

@@ -98,3 +98,3 @@ 'use strict';

* This is an array of objects passed as the final arguments in calls. Empty array by default.
* @param {OneConstructor} [ctor] The constructor used to create the `get` Ones. This parameter is used internally;
* @param {IOneConstructor} [ctor] The constructor used to create the `get` Ones. This parameter is used internally;
* no need to supply an argument.

@@ -101,0 +101,0 @@ *

@@ -127,3 +127,3 @@ /**

*/
interface ApplyMap {
interface IApplyMap {
[key: string]: Function | Function[];

@@ -185,3 +185,3 @@ }

*
* @param {ApplyMap } applyMap
* @param {IApplyMap } applyMap
* @param {HTMLElement} [containerElement]

@@ -191,3 +191,3 @@ * @param {boolean|number} [asComponent]

*/
declare function apply(applyMap: ApplyMap, containerElement?: Element, asComponent?: boolean | number, firstOnly?: boolean | number): void;
declare function apply(applyMap: IApplyMap, containerElement?: Element, asComponent?: boolean | number, firstOnly?: boolean | number): void;
/**

@@ -225,3 +225,2 @@ * Applies the given functions to the specified elements (or CSS rules).

declare function tag(strings: Array<string>, ...expressions: any[]): Promise<string>;
type Args<T> = T[keyof T];
/**

@@ -259,4 +258,4 @@ * Effectively creates a template literal out of an existing template string and wraps it in a function

*/
interface ArrayTemplate {
(arr: Iterable<any>, ...args: any[]): string[];
interface ITemplates {
(arr: Iterable<any>, ...args: any[]): Iterable<string>;
}

@@ -266,4 +265,4 @@ /**

*/
interface AsyncArrayTemplate {
(arr: Iterable<any>, ...args: any[]): Promise<string[]>;
interface IAsyncTemplates {
(arr: Iterable<any>, ...args: any[]): Iterable<Promise<string>>;
}

@@ -284,5 +283,5 @@ /**

* Defaults to the empty string.
* @returns {ArrayTemplate}
* @returns {ITemplates}
*/
declare function arrayTemplate(templateStr: string, argNames: Array<string>, itemName: string): ArrayTemplate;
declare function templates(templateStr: string, argNames: Array<string>, itemName: string): ITemplates;
/**

@@ -305,5 +304,5 @@ * Async equivalent of arrayTemplate. The async template tag ('T' by default)

* the default name (T) is present in argNames.
* @returns {AsyncArrayTemplate}
* @returns {IAsyncTemplates}
*/
declare function asyncArrayTemplate(templateStr: string, argNames: Array<string>, itemName: string, tagName: string): AsyncArrayTemplate;
declare function asyncTemplates(templateStr: string, argNames: Array<string>, itemName: string, tagName: string): IAsyncTemplates;
/**

@@ -349,3 +348,3 @@ * Fetches text (typically markup) from the url. This is only a shorthand

*/
interface Inserter {
interface IInserter {
(node: Node, target: Node): void;

@@ -368,5 +367,5 @@ }

* @param {Iterable<Node>} values The new nodes to insert.
* @param {Inserter} [insertWith] The insertion function
* @param {IInserter} [insertWith] The insertion function
*/
declare function insert(elements: Iterator<Node> | Node[], values: Iterable<Node>, insertWith?: Inserter): void;
declare function insert(elements: Iterator<Node> | Node[], values: Iterable<Node>, insertWith?: IInserter): void;
/**

@@ -402,3 +401,3 @@ * Default inserters for use with `insert`

*/
interface SetMap {
interface ISetMap {
[key: string]: any[];

@@ -420,5 +419,5 @@ }

* @param {(Element|CSSStyleRule)[]} elements
* @param {SetMap} values
* @param {ISetMap} values
*/
declare function set(elements: Iterable<Element | CSSStyleRule>, values: SetMap): void;
declare function set(elements: Iterable<Element | CSSStyleRule>, values: ISetMap): void;
/**

@@ -466,3 +465,3 @@ * Correctly replace the specified nodes with corresponding values.

*/
interface Matcher {
interface IMatcher {
[key: string]: Function | Function[];

@@ -534,7 +533,7 @@ }

*
* @param {Matcher} matcher Map of event target matcher to associated handler function
* @param {IMatcher} matcher Map of event target matcher to associated handler function
* @param {boolean} wrapListeners Whether to werap the matcher functions with `eventListener`.
*/
declare function matchListener(matcher: Matcher, wrapListeners?: boolean): (e: {
target: MatchEventTarget;
declare function matchListener(matcher: IMatcher, wrapListeners?: boolean): (e: {
target: IMatchEventTarget;
}) => any;

@@ -544,3 +543,3 @@ /**

*/
interface MatchEventTarget extends EventTarget {
interface IMatchEventTarget extends EventTarget {
matches?: (arg0: string) => any;

@@ -556,3 +555,3 @@ }

declare class MatchListener extends Listener {
constructor(matcher: Matcher, wrapListeners?: boolean);
constructor(matcher: IMatcher, wrapListeners?: boolean);
}

@@ -731,4 +730,4 @@ /**

*/
interface OneConstructor {
(many: any[], recursive?: boolean, context?: any[], ctor?: OneConstructor): One;
interface IOneConstructor {
(many: any[], recursive?: boolean, context?: any[], ctor?: IOneConstructor): One;
}

@@ -754,3 +753,3 @@ /**

*/
ctor?: OneConstructor;
ctor?: IOneConstructor;
/**

@@ -769,3 +768,3 @@ * The context shared by the many functions or methods of the objects in many.

* This is an array of objects passed as the final arguments in calls. Empty array by default.
* @param {OneConstructor} [ctor] The constructor used to create the `get` Ones. This parameter is used internally;
* @param {IOneConstructor} [ctor] The constructor used to create the `get` Ones. This parameter is used internally;
* no need to supply an argument.

@@ -779,3 +778,3 @@ *

*/
constructor(many: any[], recursive?: boolean, context?: any[], ctor?: OneConstructor);
constructor(many: any[], recursive?: boolean, context?: any[], ctor?: IOneConstructor);
/**

@@ -982,3 +981,3 @@ * Gets corresponding properties from all the objects in many. If this is

*/
interface AnyFunction {
interface IAnyFunction {
(...args: any): any;

@@ -1014,4 +1013,4 @@ }

*/
type RecursiveProp<T> = {
[key in keyof T]?: (arg: Recursive<T[key]>) => any;
type IRecursiveProp<T> = {
[key in keyof T]?: (arg: IRecursive<T[key]>) => any;
};

@@ -1021,3 +1020,3 @@ /**

*/
type RecursiveSetProp<T> = {
type IRecursiveSetProp<T> = {
[key in keyof T]?: any;

@@ -1028,9 +1027,9 @@ };

*/
type Recursive<T> = {
[key in keyof T]: T[key] extends AnyFunction ? (...args: Parameters<T[key]>) => Recursive<T> : T[key];
type IRecursive<T> = {
[key in keyof T]: T[key] extends IAnyFunction ? (...args: Parameters<T[key]>) => IRecursive<T> : T[key];
} & {
[WITH]: (arg: RecursiveProp<T>) => Recursive<T>;
[SET]: (arg: RecursiveSetProp<T>) => Recursive<T>;
[ASSIGN]: (...objs: any[]) => Recursive<T>;
(arg: any, ...args: any): Recursive<T>;
[WITH]: (arg: IRecursiveProp<T>) => IRecursive<T>;
[SET]: (arg: IRecursiveSetProp<T>) => IRecursive<T>;
[ASSIGN]: (...objs: any[]) => IRecursive<T>;
(arg: any, ...args: any): IRecursive<T>;
(): T;

@@ -1050,4 +1049,4 @@ };

*/
declare function With<T>(obj: T): Recursive<T>;
declare function With<T>(obj: T): IRecursive<T>;
export { ASSIGN, Actribute, type AnyFunction, type ApplyMap, type Args, type ArrayTemplate, type AsyncArrayTemplate, END, EventListener, type Inserter, Listener, type MatchEventTarget, MatchListener, type Matcher, One, type OneConstructor, type Recursive, type RecursiveProp, type RecursiveSetProp, SET, type SetMap, Sophistry, StyleSheet, WITH, With, apply, applyTo, arrayTemplate, asyncArrayTemplate, asyncTemplate, createFragment, eventListener, flat, get, getLength, ignoreContext, insert, inserter, items, iterLengths, keys, matchListener, onEnter, onKey, one, parentSelector, preventDefault, range, remove, repeat, ruleSelector, ruleSelectorAll, set, setLength, stopPropagation, tag, template, uItems, unWrap, update };
export { ASSIGN, Actribute, END, EventListener, type IAnyFunction, type IApplyMap, type IAsyncTemplates, type IInserter, type IMatchEventTarget, type IMatcher, type IOneConstructor, type IRecursive, type IRecursiveProp, type IRecursiveSetProp, type ISetMap, type ITemplates, Listener, MatchListener, One, SET, Sophistry, StyleSheet, WITH, With, apply, applyTo, asyncTemplate, asyncTemplates, createFragment, eventListener, flat, get, getLength, ignoreContext, insert, inserter, items, iterLengths, keys, matchListener, onEnter, onKey, one, parentSelector, preventDefault, range, remove, repeat, ruleSelector, ruleSelectorAll, set, setLength, stopPropagation, tag, template, templates, uItems, unWrap, update };

@@ -80,3 +80,3 @@ /**

*
* @param {ApplyMap } applyMap
* @param {IApplyMap } applyMap
* @param {HTMLElement} [containerElement]

@@ -83,0 +83,0 @@ * @param {boolean|number} [asComponent]

@@ -87,5 +87,5 @@ /**

* Defaults to the empty string.
* @returns {ArrayTemplate}
* @returns {ITemplates}
*/
function arrayTemplate(templateStr, argNames, itemName) {
function templates(templateStr, argNames, itemName) {
if (!argNames)

@@ -95,9 +95,7 @@ argNames = [];

itemName = "item";
return Function("arr", ...argNames, `
const result = [];
for (let ${itemName} of arr) {
result.push(\`${templateStr}\`);
return (Function(`
function* gen(arr, ${argNames.join(', ')}) {
for (let ${itemName} of arr) yield \`${templateStr}\`;
}
return result;
`);
return gen;`))();
}

@@ -121,5 +119,5 @@ /**

* the default name (T) is present in argNames.
* @returns {AsyncArrayTemplate}
* @returns {IAsyncTemplates}
*/
function asyncArrayTemplate(templateStr, argNames, itemName, tagName) {
function asyncTemplates(templateStr, argNames, itemName, tagName) {
if (!argNames)

@@ -139,9 +137,7 @@ argNames = [];

}
const f = Function(tagName, "arr", ...argNames, `
const result = [];
for (let ${itemName} of arr) {
result.push(${tagName}\`${templateStr}\`);
const f = (Function(`
function* gen(${tagName}, arr, ${argNames.join(', ')}) {
for (let ${itemName} of arr) yield ${tagName}\`${templateStr}\`;
}
return Promise.all(result).then(resolved => resolved);
`);
return gen;`))();
return (arr, ...args) => f(tag, arr, ...args);

@@ -192,2 +188,2 @@ }

export { arrayTemplate, asyncArrayTemplate, asyncTemplate, createFragment, get, tag, template };
export { asyncTemplate, asyncTemplates, createFragment, get, tag, template, templates };

@@ -19,3 +19,3 @@ /**

* @param {Iterable<Node>} values The new nodes to insert.
* @param {Inserter} [insertWith] The insertion function
* @param {IInserter} [insertWith] The insertion function
*/

@@ -69,3 +69,3 @@ function insert(elements, values, insertWith) {

* @param {(Element|CSSStyleRule)[]} elements
* @param {SetMap} values
* @param {ISetMap} values
*/

@@ -72,0 +72,0 @@ function set(elements, values) {

@@ -111,3 +111,3 @@ /**

*
* @param {Matcher} matcher Map of event target matcher to associated handler function
* @param {IMatcher} matcher Map of event target matcher to associated handler function
* @param {boolean} wrapListeners Whether to werap the matcher functions with `eventListener`.

@@ -114,0 +114,0 @@ */

@@ -96,3 +96,3 @@ /**

* This is an array of objects passed as the final arguments in calls. Empty array by default.
* @param {OneConstructor} [ctor] The constructor used to create the `get` Ones. This parameter is used internally;
* @param {IOneConstructor} [ctor] The constructor used to create the `get` Ones. This parameter is used internally;
* no need to supply an argument.

@@ -99,0 +99,0 @@ *

{
"name": "deleight",
"version": "1.0.4",
"version": "1.1.0",
"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",

{
"name": "deleight",
"version": "1.0.4",
"version": "1.1.0",
"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",

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