New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ebuilder-js

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ebuilder-js - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

utils/DOM.d.ts

7

declarations.d.ts

@@ -7,2 +7,5 @@ declare type AnyObject = {

};
declare type NumberObject = {
[key: string]: number;
};
declare type StringObject = {

@@ -43,3 +46,5 @@ [key: string]: string;

interval?: number;
cloneList: Element[];
getRef: (query: string) => any;
setElement: (value: Element) => void;
}

@@ -52,3 +57,3 @@ declare type RuleMap = Map<string, string>;

}
interface ProcessedObject {
interface ParsedObject {
[key: string]: {

@@ -55,0 +60,0 @@ value: any;

360

modules/EBuilder.d.ts
declare const EBuilder: (this: any, source: Element | string) => {
el: Element;
element: Element;
htmlContent: () => string;
getHTML: () => string;
isEBuilder: boolean;
referenceMap: ReferenceMap;
getRef: (query: string) => any;
cloneList: Element[];
getRef: (query?: string | undefined) => any;
given: (...references: ReferencePair[]) => {
el: Element;
element: Element;
htmlContent: () => string;
getHTML: () => string;
isEBuilder: boolean;
referenceMap: ReferenceMap;
getRef: (query: string) => any;
cloneList: Element[];
getRef: (query?: string | undefined) => any;
given: any;
into: (targetInput: EBTarget, { at, times }?: IntoOptions) => any | undefined;
after: (node: Element) => any;
before: (node: Element) => any;
replace: (node: Node) => any;
after: (inputTarget: Element | EBObject) => any;
before: (inputTarget: Element | EBObject) => any;
replace: (inputTarget: Element | EBObject) => any;
swap: (swapped: HTMLElement, animate?: boolean | {

@@ -24,3 +26,4 @@ animationDuration?: number | undefined;

} | undefined) => Promise<any | undefined>;
out: () => void;
out: (all?: boolean | undefined) => any;
clearClones: () => any;
dispatch: (nameInput: string, emitterInput?: any) => any;

@@ -32,7 +35,8 @@ set: (options?: SetOptions) => any;

setChildren: (children: EBChild | EBChild[] | Function) => any;
setStyles: (styles: StringObject | Function) => any;
setStyle: (style: StringObject | Function) => any;
setClasses: (...classes: (string | string[])[]) => any;
textContent: (input: string) => any;
setContent: (input: string | Element | EBObject) => any;
toString: () => string;
count: () => number;
setElement: (value: Element) => void;
};

@@ -42,11 +46,12 @@ into: (targetInput: EBTarget, { at, times }?: IntoOptions) => {

element: Element;
htmlContent: () => string;
getHTML: () => string;
isEBuilder: boolean;
referenceMap: ReferenceMap;
getRef: (query: string) => any;
cloneList: Element[];
getRef: (query?: string | undefined) => any;
given: (...references: ReferencePair[]) => any;
into: any;
after: (node: Element) => any;
before: (node: Element) => any;
replace: (node: Node) => any;
after: (inputTarget: Element | EBObject) => any;
before: (inputTarget: Element | EBObject) => any;
replace: (inputTarget: Element | EBObject) => any;
swap: (swapped: HTMLElement, animate?: boolean | {

@@ -56,3 +61,4 @@ animationDuration?: number | undefined;

} | undefined) => Promise<any | undefined>;
out: () => void;
out: (all?: boolean | undefined) => any;
clearClones: () => any;
dispatch: (nameInput: string, emitterInput?: any) => any;

@@ -64,20 +70,22 @@ set: (options?: SetOptions) => any;

setChildren: (children: EBChild | EBChild[] | Function) => any;
setStyles: (styles: StringObject | Function) => any;
setStyle: (style: StringObject | Function) => any;
setClasses: (...classes: (string | string[])[]) => any;
textContent: (input: string) => any;
setContent: (input: string | Element | EBObject) => any;
toString: () => string;
count: () => number;
setElement: (value: Element) => void;
} | undefined;
after: (node: Element) => {
after: (inputTarget: Element | EBObject) => {
el: Element;
element: Element;
htmlContent: () => string;
getHTML: () => string;
isEBuilder: boolean;
referenceMap: ReferenceMap;
getRef: (query: string) => any;
cloneList: Element[];
getRef: (query?: string | undefined) => any;
given: (...references: ReferencePair[]) => any;
into: (targetInput: EBTarget, { at, times }?: IntoOptions) => any | undefined;
after: any;
before: (node: Element) => any;
replace: (node: Node) => any;
before: (inputTarget: Element | EBObject) => any;
replace: (inputTarget: Element | EBObject) => any;
swap: (swapped: HTMLElement, animate?: boolean | {

@@ -87,3 +95,4 @@ animationDuration?: number | undefined;

} | undefined) => Promise<any | undefined>;
out: () => void;
out: (all?: boolean | undefined) => any;
clearClones: () => any;
dispatch: (nameInput: string, emitterInput?: any) => any;

@@ -95,20 +104,22 @@ set: (options?: SetOptions) => any;

setChildren: (children: EBChild | EBChild[] | Function) => any;
setStyles: (styles: StringObject | Function) => any;
setStyle: (style: StringObject | Function) => any;
setClasses: (...classes: (string | string[])[]) => any;
textContent: (input: string) => any;
setContent: (input: string | Element | EBObject) => any;
toString: () => string;
count: () => number;
setElement: (value: Element) => void;
};
before: (node: Element) => {
before: (inputTarget: Element | EBObject) => {
el: Element;
element: Element;
htmlContent: () => string;
getHTML: () => string;
isEBuilder: boolean;
referenceMap: ReferenceMap;
getRef: (query: string) => any;
cloneList: Element[];
getRef: (query?: string | undefined) => any;
given: (...references: ReferencePair[]) => any;
into: (targetInput: EBTarget, { at, times }?: IntoOptions) => any | undefined;
after: (node: Element) => any;
after: (inputTarget: Element | EBObject) => any;
before: any;
replace: (node: Node) => any;
replace: (inputTarget: Element | EBObject) => any;
swap: (swapped: HTMLElement, animate?: boolean | {

@@ -118,3 +129,4 @@ animationDuration?: number | undefined;

} | undefined) => Promise<any | undefined>;
out: () => void;
out: (all?: boolean | undefined) => any;
clearClones: () => any;
dispatch: (nameInput: string, emitterInput?: any) => any;

@@ -126,19 +138,21 @@ set: (options?: SetOptions) => any;

setChildren: (children: EBChild | EBChild[] | Function) => any;
setStyles: (styles: StringObject | Function) => any;
setStyle: (style: StringObject | Function) => any;
setClasses: (...classes: (string | string[])[]) => any;
textContent: (input: string) => any;
setContent: (input: string | Element | EBObject) => any;
toString: () => string;
count: () => number;
setElement: (value: Element) => void;
};
replace: (node: Node) => {
replace: (inputTarget: Element | EBObject) => {
el: Element;
element: Element;
htmlContent: () => string;
getHTML: () => string;
isEBuilder: boolean;
referenceMap: ReferenceMap;
getRef: (query: string) => any;
cloneList: Element[];
getRef: (query?: string | undefined) => any;
given: (...references: ReferencePair[]) => any;
into: (targetInput: EBTarget, { at, times }?: IntoOptions) => any | undefined;
after: (node: Element) => any;
before: (node: Element) => any;
after: (inputTarget: Element | EBObject) => any;
before: (inputTarget: Element | EBObject) => any;
replace: any;

@@ -149,3 +163,4 @@ swap: (swapped: HTMLElement, animate?: boolean | {

} | undefined) => Promise<any | undefined>;
out: () => void;
out: (all?: boolean | undefined) => any;
clearClones: () => any;
dispatch: (nameInput: string, emitterInput?: any) => any;

@@ -157,7 +172,8 @@ set: (options?: SetOptions) => any;

setChildren: (children: EBChild | EBChild[] | Function) => any;
setStyles: (styles: StringObject | Function) => any;
setStyle: (style: StringObject | Function) => any;
setClasses: (...classes: (string | string[])[]) => any;
textContent: (input: string) => any;
setContent: (input: string | Element | EBObject) => any;
toString: () => string;
count: () => number;
setElement: (value: Element) => void;
};

@@ -170,13 +186,15 @@ swap: (swapped: HTMLElement, animate?: boolean | {

element: Element;
htmlContent: () => string;
getHTML: () => string;
isEBuilder: boolean;
referenceMap: ReferenceMap;
getRef: (query: string) => any;
cloneList: Element[];
getRef: (query?: string | undefined) => any;
given: (...references: ReferencePair[]) => any;
into: (targetInput: EBTarget, { at, times }?: IntoOptions) => any | undefined;
after: (node: Element) => any;
before: (node: Element) => any;
replace: (node: Node) => any;
after: (inputTarget: Element | EBObject) => any;
before: (inputTarget: Element | EBObject) => any;
replace: (inputTarget: Element | EBObject) => any;
swap: any;
out: () => void;
out: (all?: boolean | undefined) => any;
clearClones: () => any;
dispatch: (nameInput: string, emitterInput?: any) => any;

@@ -188,21 +206,86 @@ set: (options?: SetOptions) => any;

setChildren: (children: EBChild | EBChild[] | Function) => any;
setStyles: (styles: StringObject | Function) => any;
setStyle: (style: StringObject | Function) => any;
setClasses: (...classes: (string | string[])[]) => any;
textContent: (input: string) => any;
setContent: (input: string | Element | EBObject) => any;
toString: () => string;
count: () => number;
setElement: (value: Element) => void;
} | undefined>;
out: () => void;
out: (all?: boolean | undefined) => {
el: Element;
element: Element;
getHTML: () => string;
isEBuilder: boolean;
referenceMap: ReferenceMap;
cloneList: Element[];
getRef: (query?: string | undefined) => any;
given: (...references: ReferencePair[]) => any;
into: (targetInput: EBTarget, { at, times }?: IntoOptions) => any | undefined;
after: (inputTarget: Element | EBObject) => any;
before: (inputTarget: Element | EBObject) => any;
replace: (inputTarget: Element | EBObject) => any;
swap: (swapped: HTMLElement, animate?: boolean | {
animationDuration?: number | undefined;
animationType?: string | undefined;
} | undefined) => Promise<any | undefined>;
out: any;
clearClones: () => any;
dispatch: (nameInput: string, emitterInput?: any) => any;
set: (options?: SetOptions) => any;
setAttributes: (attributes: StringObject | Function) => any;
setProperties: (properties: AnyObject | Function) => any;
setListeners: (listeners: EventTuple | EventTuple[] | Function) => any;
setChildren: (children: EBChild | EBChild[] | Function) => any;
setStyle: (style: StringObject | Function) => any;
setClasses: (...classes: (string | string[])[]) => any;
setContent: (input: string | Element | EBObject) => any;
toString: () => string;
count: () => number;
setElement: (value: Element) => void;
};
clearClones: () => {
el: Element;
element: Element;
getHTML: () => string;
isEBuilder: boolean;
referenceMap: ReferenceMap;
cloneList: Element[];
getRef: (query?: string | undefined) => any;
given: (...references: ReferencePair[]) => any;
into: (targetInput: EBTarget, { at, times }?: IntoOptions) => any | undefined;
after: (inputTarget: Element | EBObject) => any;
before: (inputTarget: Element | EBObject) => any;
replace: (inputTarget: Element | EBObject) => any;
swap: (swapped: HTMLElement, animate?: boolean | {
animationDuration?: number | undefined;
animationType?: string | undefined;
} | undefined) => Promise<any | undefined>;
out: (all?: boolean | undefined) => any;
clearClones: any;
dispatch: (nameInput: string, emitterInput?: any) => any;
set: (options?: SetOptions) => any;
setAttributes: (attributes: StringObject | Function) => any;
setProperties: (properties: AnyObject | Function) => any;
setListeners: (listeners: EventTuple | EventTuple[] | Function) => any;
setChildren: (children: EBChild | EBChild[] | Function) => any;
setStyle: (style: StringObject | Function) => any;
setClasses: (...classes: (string | string[])[]) => any;
setContent: (input: string | Element | EBObject) => any;
toString: () => string;
count: () => number;
setElement: (value: Element) => void;
};
dispatch: (nameInput: string, emitterInput?: any) => {
el: Element;
element: Element;
htmlContent: () => string;
getHTML: () => string;
isEBuilder: boolean;
referenceMap: ReferenceMap;
getRef: (query: string) => any;
cloneList: Element[];
getRef: (query?: string | undefined) => any;
given: (...references: ReferencePair[]) => any;
into: (targetInput: EBTarget, { at, times }?: IntoOptions) => any | undefined;
after: (node: Element) => any;
before: (node: Element) => any;
replace: (node: Node) => any;
after: (inputTarget: Element | EBObject) => any;
before: (inputTarget: Element | EBObject) => any;
replace: (inputTarget: Element | EBObject) => any;
swap: (swapped: HTMLElement, animate?: boolean | {

@@ -212,3 +295,4 @@ animationDuration?: number | undefined;

} | undefined) => Promise<any | undefined>;
out: () => void;
out: (all?: boolean | undefined) => any;
clearClones: () => any;
dispatch: any;

@@ -220,7 +304,8 @@ set: (options?: SetOptions) => any;

setChildren: (children: EBChild | EBChild[] | Function) => any;
setStyles: (styles: StringObject | Function) => any;
setStyle: (style: StringObject | Function) => any;
setClasses: (...classes: (string | string[])[]) => any;
textContent: (input: string) => any;
setContent: (input: string | Element | EBObject) => any;
toString: () => string;
count: () => number;
setElement: (value: Element) => void;
};

@@ -230,11 +315,12 @@ set: (options?: SetOptions) => {

element: Element;
htmlContent: () => string;
getHTML: () => string;
isEBuilder: boolean;
referenceMap: ReferenceMap;
getRef: (query: string) => any;
cloneList: Element[];
getRef: (query?: string | undefined) => any;
given: (...references: ReferencePair[]) => any;
into: (targetInput: EBTarget, { at, times }?: IntoOptions) => any | undefined;
after: (node: Element) => any;
before: (node: Element) => any;
replace: (node: Node) => any;
after: (inputTarget: Element | EBObject) => any;
before: (inputTarget: Element | EBObject) => any;
replace: (inputTarget: Element | EBObject) => any;
swap: (swapped: HTMLElement, animate?: boolean | {

@@ -244,3 +330,4 @@ animationDuration?: number | undefined;

} | undefined) => Promise<any | undefined>;
out: () => void;
out: (all?: boolean | undefined) => any;
clearClones: () => any;
dispatch: (nameInput: string, emitterInput?: any) => any;

@@ -252,7 +339,8 @@ set: any;

setChildren: (children: EBChild | EBChild[] | Function) => any;
setStyles: (styles: StringObject | Function) => any;
setStyle: (style: StringObject | Function) => any;
setClasses: (...classes: (string | string[])[]) => any;
textContent: (input: string) => any;
setContent: (input: string | Element | EBObject) => any;
toString: () => string;
count: () => number;
setElement: (value: Element) => void;
};

@@ -262,11 +350,12 @@ setAttributes: (attributes: StringObject | Function) => {

element: Element;
htmlContent: () => string;
getHTML: () => string;
isEBuilder: boolean;
referenceMap: ReferenceMap;
getRef: (query: string) => any;
cloneList: Element[];
getRef: (query?: string | undefined) => any;
given: (...references: ReferencePair[]) => any;
into: (targetInput: EBTarget, { at, times }?: IntoOptions) => any | undefined;
after: (node: Element) => any;
before: (node: Element) => any;
replace: (node: Node) => any;
after: (inputTarget: Element | EBObject) => any;
before: (inputTarget: Element | EBObject) => any;
replace: (inputTarget: Element | EBObject) => any;
swap: (swapped: HTMLElement, animate?: boolean | {

@@ -276,3 +365,4 @@ animationDuration?: number | undefined;

} | undefined) => Promise<any | undefined>;
out: () => void;
out: (all?: boolean | undefined) => any;
clearClones: () => any;
dispatch: (nameInput: string, emitterInput?: any) => any;

@@ -284,7 +374,8 @@ set: (options?: SetOptions) => any;

setChildren: (children: EBChild | EBChild[] | Function) => any;
setStyles: (styles: StringObject | Function) => any;
setStyle: (style: StringObject | Function) => any;
setClasses: (...classes: (string | string[])[]) => any;
textContent: (input: string) => any;
setContent: (input: string | Element | EBObject) => any;
toString: () => string;
count: () => number;
setElement: (value: Element) => void;
};

@@ -294,11 +385,12 @@ setProperties: (properties: AnyObject | Function) => {

element: Element;
htmlContent: () => string;
getHTML: () => string;
isEBuilder: boolean;
referenceMap: ReferenceMap;
getRef: (query: string) => any;
cloneList: Element[];
getRef: (query?: string | undefined) => any;
given: (...references: ReferencePair[]) => any;
into: (targetInput: EBTarget, { at, times }?: IntoOptions) => any | undefined;
after: (node: Element) => any;
before: (node: Element) => any;
replace: (node: Node) => any;
after: (inputTarget: Element | EBObject) => any;
before: (inputTarget: Element | EBObject) => any;
replace: (inputTarget: Element | EBObject) => any;
swap: (swapped: HTMLElement, animate?: boolean | {

@@ -308,3 +400,4 @@ animationDuration?: number | undefined;

} | undefined) => Promise<any | undefined>;
out: () => void;
out: (all?: boolean | undefined) => any;
clearClones: () => any;
dispatch: (nameInput: string, emitterInput?: any) => any;

@@ -316,7 +409,8 @@ set: (options?: SetOptions) => any;

setChildren: (children: EBChild | EBChild[] | Function) => any;
setStyles: (styles: StringObject | Function) => any;
setStyle: (style: StringObject | Function) => any;
setClasses: (...classes: (string | string[])[]) => any;
textContent: (input: string) => any;
setContent: (input: string | Element | EBObject) => any;
toString: () => string;
count: () => number;
setElement: (value: Element) => void;
};

@@ -326,11 +420,12 @@ setListeners: (listeners: EventTuple | EventTuple[] | Function) => {

element: Element;
htmlContent: () => string;
getHTML: () => string;
isEBuilder: boolean;
referenceMap: ReferenceMap;
getRef: (query: string) => any;
cloneList: Element[];
getRef: (query?: string | undefined) => any;
given: (...references: ReferencePair[]) => any;
into: (targetInput: EBTarget, { at, times }?: IntoOptions) => any | undefined;
after: (node: Element) => any;
before: (node: Element) => any;
replace: (node: Node) => any;
after: (inputTarget: Element | EBObject) => any;
before: (inputTarget: Element | EBObject) => any;
replace: (inputTarget: Element | EBObject) => any;
swap: (swapped: HTMLElement, animate?: boolean | {

@@ -340,3 +435,4 @@ animationDuration?: number | undefined;

} | undefined) => Promise<any | undefined>;
out: () => void;
out: (all?: boolean | undefined) => any;
clearClones: () => any;
dispatch: (nameInput: string, emitterInput?: any) => any;

@@ -348,7 +444,8 @@ set: (options?: SetOptions) => any;

setChildren: (children: EBChild | EBChild[] | Function) => any;
setStyles: (styles: StringObject | Function) => any;
setStyle: (style: StringObject | Function) => any;
setClasses: (...classes: (string | string[])[]) => any;
textContent: (input: string) => any;
setContent: (input: string | Element | EBObject) => any;
toString: () => string;
count: () => number;
setElement: (value: Element) => void;
};

@@ -358,11 +455,12 @@ setChildren: (children: EBChild | EBChild[] | Function) => {

element: Element;
htmlContent: () => string;
getHTML: () => string;
isEBuilder: boolean;
referenceMap: ReferenceMap;
getRef: (query: string) => any;
cloneList: Element[];
getRef: (query?: string | undefined) => any;
given: (...references: ReferencePair[]) => any;
into: (targetInput: EBTarget, { at, times }?: IntoOptions) => any | undefined;
after: (node: Element) => any;
before: (node: Element) => any;
replace: (node: Node) => any;
after: (inputTarget: Element | EBObject) => any;
before: (inputTarget: Element | EBObject) => any;
replace: (inputTarget: Element | EBObject) => any;
swap: (swapped: HTMLElement, animate?: boolean | {

@@ -372,3 +470,4 @@ animationDuration?: number | undefined;

} | undefined) => Promise<any | undefined>;
out: () => void;
out: (all?: boolean | undefined) => any;
clearClones: () => any;
dispatch: (nameInput: string, emitterInput?: any) => any;

@@ -380,20 +479,22 @@ set: (options?: SetOptions) => any;

setChildren: any;
setStyles: (styles: StringObject | Function) => any;
setStyle: (style: StringObject | Function) => any;
setClasses: (...classes: (string | string[])[]) => any;
textContent: (input: string) => any;
setContent: (input: string | Element | EBObject) => any;
toString: () => string;
count: () => number;
setElement: (value: Element) => void;
};
setStyles: (styles: StringObject | Function) => {
setStyle: (style: StringObject | Function) => {
el: Element;
element: Element;
htmlContent: () => string;
getHTML: () => string;
isEBuilder: boolean;
referenceMap: ReferenceMap;
getRef: (query: string) => any;
cloneList: Element[];
getRef: (query?: string | undefined) => any;
given: (...references: ReferencePair[]) => any;
into: (targetInput: EBTarget, { at, times }?: IntoOptions) => any | undefined;
after: (node: Element) => any;
before: (node: Element) => any;
replace: (node: Node) => any;
after: (inputTarget: Element | EBObject) => any;
before: (inputTarget: Element | EBObject) => any;
replace: (inputTarget: Element | EBObject) => any;
swap: (swapped: HTMLElement, animate?: boolean | {

@@ -403,3 +504,4 @@ animationDuration?: number | undefined;

} | undefined) => Promise<any | undefined>;
out: () => void;
out: (all?: boolean | undefined) => any;
clearClones: () => any;
dispatch: (nameInput: string, emitterInput?: any) => any;

@@ -411,7 +513,8 @@ set: (options?: SetOptions) => any;

setChildren: (children: EBChild | EBChild[] | Function) => any;
setStyles: any;
setStyle: any;
setClasses: (...classes: (string | string[])[]) => any;
textContent: (input: string) => any;
setContent: (input: string | Element | EBObject) => any;
toString: () => string;
count: () => number;
setElement: (value: Element) => void;
};

@@ -421,11 +524,12 @@ setClasses: (...classes: (string | string[])[]) => {

element: Element;
htmlContent: () => string;
getHTML: () => string;
isEBuilder: boolean;
referenceMap: ReferenceMap;
getRef: (query: string) => any;
cloneList: Element[];
getRef: (query?: string | undefined) => any;
given: (...references: ReferencePair[]) => any;
into: (targetInput: EBTarget, { at, times }?: IntoOptions) => any | undefined;
after: (node: Element) => any;
before: (node: Element) => any;
replace: (node: Node) => any;
after: (inputTarget: Element | EBObject) => any;
before: (inputTarget: Element | EBObject) => any;
replace: (inputTarget: Element | EBObject) => any;
swap: (swapped: HTMLElement, animate?: boolean | {

@@ -435,3 +539,4 @@ animationDuration?: number | undefined;

} | undefined) => Promise<any | undefined>;
out: () => void;
out: (all?: boolean | undefined) => any;
clearClones: () => any;
dispatch: (nameInput: string, emitterInput?: any) => any;

@@ -443,20 +548,22 @@ set: (options?: SetOptions) => any;

setChildren: (children: EBChild | EBChild[] | Function) => any;
setStyles: (styles: StringObject | Function) => any;
setStyle: (style: StringObject | Function) => any;
setClasses: any;
textContent: (input: string) => any;
setContent: (input: string | Element | EBObject) => any;
toString: () => string;
count: () => number;
setElement: (value: Element) => void;
};
textContent: (input: string) => {
setContent: (input: string | Element | EBObject) => {
el: Element;
element: Element;
htmlContent: () => string;
getHTML: () => string;
isEBuilder: boolean;
referenceMap: ReferenceMap;
getRef: (query: string) => any;
cloneList: Element[];
getRef: (query?: string | undefined) => any;
given: (...references: ReferencePair[]) => any;
into: (targetInput: EBTarget, { at, times }?: IntoOptions) => any | undefined;
after: (node: Element) => any;
before: (node: Element) => any;
replace: (node: Node) => any;
after: (inputTarget: Element | EBObject) => any;
before: (inputTarget: Element | EBObject) => any;
replace: (inputTarget: Element | EBObject) => any;
swap: (swapped: HTMLElement, animate?: boolean | {

@@ -466,3 +573,4 @@ animationDuration?: number | undefined;

} | undefined) => Promise<any | undefined>;
out: () => void;
out: (all?: boolean | undefined) => any;
clearClones: () => any;
dispatch: (nameInput: string, emitterInput?: any) => any;

@@ -474,11 +582,13 @@ set: (options?: SetOptions) => any;

setChildren: (children: EBChild | EBChild[] | Function) => any;
setStyles: (styles: StringObject | Function) => any;
setStyle: (style: StringObject | Function) => any;
setClasses: (...classes: (string | string[])[]) => any;
textContent: any;
setContent: any;
toString: () => string;
count: () => number;
setElement: (value: Element) => void;
};
toString: () => string;
count: () => number;
setElement: (value: Element) => void;
} | undefined;
export default EBuilder;

@@ -25,2 +25,4 @@ "use strict";

var DOM = require("../utils/DOM");
var Parse = require("../utils/Parse");

@@ -38,6 +40,7 @@

var referenceMap = new Map([['window', window]]);
var cloneList = [];
return {
el: element,
element: element,
htmlContent: function htmlContent() {
getHTML: function getHTML() {
return this.element.innerHTML;

@@ -47,4 +50,5 @@ },

referenceMap: referenceMap,
cloneList: cloneList,
getRef: function getRef(query) {
return this.referenceMap.get(query) || (new EBuilderError_1["default"]('nul!', query), false);
return query ? this.referenceMap.get(query) : (new EBuilderError_1["default"]('nul!', query), false);
},

@@ -58,4 +62,5 @@ given: function given() {

target = _ref[0],
id = _ref[1];
id = _ref[1]; // come back here later
_this.referenceMap.set(id, target);

@@ -81,40 +86,29 @@ } else if (Check.isNamedFunction(ref)) {

if (!Check.isValidTarget(targetInput)) return;
if (!Check.isValidTarget(targetInput) || !Check.isNumber(times)) return; // use Parse.getTrueElement() instead
var getTarget = function getTarget(target) {
return Check.isEBuilder(target) ? target.element : target;
return Check.isEBObject(target) ? target.element : target;
};
var insertAt = function insertAt(element, target, n) {
if (!Check.isNumber(n)) return;
var getPos = function getPos(n, length) {
return n < 0 ? Math.max(length - 1 + n, 0) : Math.min(length - 1, n);
};
var childList = target.children;
var p = getPos(n, childList.length);
if (childList.length === 0 || childList.length - 1 === p) target.appendChild(element);else childList[p].insertAdjacentElement('beforebegin', element);
};
var target = getTarget(targetInput);
var p = Math.floor(Number(at));
Number.isNaN(p) ? target.appendChild(element) : insertAt(element, target, p);
DOM.insertV1.call(this, this.element, getTarget(targetInput), at, times);
this.element.dispatchEvent(new CustomEvent('ebuilderinsert'));
return this;
},
after: function after(node) {
node.insertAdjacentElement('afterend', element);
after: function after(inputTarget) {
var target = Parse.getTrueElement(inputTarget);
target.insertAdjacentElement('afterend', element);
this.element.dispatchEvent(new CustomEvent('ebuilderinsert'));
return this;
},
before: function before(node) {
node.insertAdjacentElement('beforebegin', element);
before: function before(inputTarget) {
var target = Parse.getTrueElement(inputTarget);
target.insertAdjacentElement('beforebegin', element);
this.element.dispatchEvent(new CustomEvent('ebuilderinsert'));
return this;
},
replace: function replace(node) {
replace: function replace(inputTarget) {
var _a;
(_a = node.parentNode) === null || _a === void 0 ? void 0 : _a.replaceChild(element, node);
var target = Parse.getTrueElement(inputTarget);
(_a = target.parentNode) === null || _a === void 0 ? void 0 : _a.replaceChild(element, target);
this.element.dispatchEvent(new CustomEvent('ebuilderinsert'));

@@ -168,7 +162,17 @@ return this;

}(),
out: function out() {
out: function out(all) {
var _a;
(_a = element.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(element);
if (all) this.clearClones;
return this;
},
clearClones: function clearClones() {
this.cloneList.forEach(function (clone) {
var _a;
return (_a = clone.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(clone);
});
return this;
},
dispatch: function dispatch(nameInput, emitterInput) {

@@ -188,3 +192,4 @@ var emitter = !emitterInput ? this.element : 'isEBuilder' in emitterInput ? emitterInput.element : emitterInput;

listeners: Setter.Listeners,
children: Setter.Children
children: Setter.Children,
style: Setter.Style
};

@@ -217,5 +222,5 @@

},
setStyles: function setStyles(styles) {
var value = Parse.getComputedValue.call(this, styles);
Setter.Styles.call(this, value);
setStyle: function setStyle(style) {
// const value = Parse.getComputedValue.call(this, style)
Setter.Style.call(this, style);
return this;

@@ -230,4 +235,6 @@ },

},
textContent: function textContent(input) {
element.textContent = input;
// + setContent(options = { add?, remove?, })
setContent: function setContent(input) {
this.element.innerHTML = "".concat(input); // DOM.insert.call(this, input, element, at, 1)
return this;

@@ -240,2 +247,6 @@ },

return this.element.childNodes.length;
},
setElement: function setElement(value) {
this.element = value;
this.el = value;
}

@@ -242,0 +253,0 @@ };

@@ -8,1 +8,2 @@ export declare const RuleMap: FunctionObject;

export declare function For(this: EBObject, conditionId: string, callback: Function): void;
export declare function For2(this: EBObject, ref: any[], callback: Function): void;

@@ -10,6 +10,8 @@ "use strict";

});
exports.For = exports.If = exports.Timeout = exports.Interval = exports.Once = exports.On = exports.RuleMap = void 0;
exports.For2 = exports.For = exports.If = exports.Timeout = exports.Interval = exports.Once = exports.On = exports.RuleMap = void 0;
var EBuilderError_1 = require("./EBuilderError");
var Check = require("../utils/Check");
var Parse = require("../utils/Parse");

@@ -86,2 +88,12 @@

exports.For = For;
exports.For = For;
function For2(ref, callback) {
var _this = this;
if (!Check.isArray(ref)) return callback.call(this), void ref.forEach(function (v, i, a) {
callback.call(_this, v, i, a);
});
}
exports.For2 = For2;
{
"name": "ebuilder-js",
"version": "0.0.6",
"version": "0.0.7",
"description": "Highly configurable and easily manipulable elements in a single declaration, with a functionnal touch.",

@@ -5,0 +5,0 @@ "main": "./index.js",

# EBuilder : an HTML element builder
Highly configurable and manipulable elements in a single declaration, with a functionnal touch.
Build and manipulate elements the functionnal way, in a single statement.
```javascript
const p = EBuilder('p').setContent('Lopsum Irem').into(document.body, { times: 3 })
const title = EBuilder('<h1>Hello <strong>World</strong>!</h1>').before(p)
const button = EBuilder('button').set({
style: {
'background@interval:500': () => `hsl(360 * Math.random(), 50%, 50%`
}
}).
```
**README in progress!**

@@ -14,3 +26,3 @@

## Install
## Installation

@@ -24,5 +36,2 @@ ### Using npm

import EBuilder from 'ebuilder-js'
// test
EBuilder('div').into(document.body)
```

@@ -35,8 +44,9 @@

```
```javascript
EBuilder('div').into(document.body)
```
## Features
## Doc
### EBuilder inputs
*
## Properties

@@ -43,0 +53,0 @@

@@ -1,13 +0,14 @@

export declare const typeOf: (s: any) => string;
export declare const isTypeOf: (x: any, ...types: string[]) => boolean;
export declare const isNumber: (subject: any) => boolean;
export declare const isFunction: (subject: any) => boolean;
export declare const isArray: (subject: any) => boolean;
export declare const isArrayArray: (subject: any) => boolean;
export declare const isStringObject: (subject: any) => boolean;
export declare const isEventTuple: (subject: any) => boolean;
export declare const isEventTupleArray: (subject: any) => boolean;
export declare const isElement: (subject: any) => boolean;
export declare const isEBuilder: (subject: any) => boolean;
export declare const isValidChild: (child: any) => boolean;
export declare const typeOf: (input: any) => string;
export declare const isTypeOf: (input: any, ...types: string[]) => boolean;
export declare const isNumber: (input: any) => input is number;
export declare const isString: (input: any) => input is string;
export declare const isFunction: (input: any) => input is Function;
export declare const isArray: (input: any) => input is [];
export declare const isArrayArray: (input: any) => input is [][];
export declare const isStringObject: (input: any) => input is StringObject;
export declare const isEventTuple: (input: any) => input is EventTuple;
export declare const isEventTupleArray: (input: any) => input is EventTuple[];
export declare const isElement: (input: any) => input is Element;
export declare const isEBObject: (input: any) => input is EBObject;
export declare const isValidChild: (input: any) => input is EBChild;
export declare const isValidSource: (source: any) => boolean;

@@ -14,0 +15,0 @@ export declare const isValidSwap: (element: Element, swapped: Element) => boolean;

@@ -7,9 +7,9 @@ "use strict";

});
exports.isNamedFunction = exports.hasName = exports.isValidTarget = exports.isValidSwap = exports.isValidSource = exports.isValidChild = exports.isEBuilder = exports.isElement = exports.isEventTupleArray = exports.isEventTuple = exports.isStringObject = exports.isArrayArray = exports.isArray = exports.isFunction = exports.isNumber = exports.isTypeOf = exports.typeOf = void 0;
exports.isNamedFunction = exports.hasName = exports.isValidTarget = exports.isValidSwap = exports.isValidSource = exports.isValidChild = exports.isEBObject = exports.isElement = exports.isEventTupleArray = exports.isEventTuple = exports.isStringObject = exports.isArrayArray = exports.isArray = exports.isFunction = exports.isString = exports.isNumber = exports.isTypeOf = exports.typeOf = void 0;
exports.typeOf = function (s) {
return "".concat({}.toString.call(s)).replace(/^\[object ([a-z]+)\]$/i, '$1').toLowerCase();
exports.typeOf = function (input) {
return "".concat({}.toString.call(input)).replace(/^\[object ([a-z]+)\]$/i, '$1').toLowerCase();
};
exports.isTypeOf = function (x) {
exports.isTypeOf = function (input) {
for (var _len = arguments.length, types = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {

@@ -20,3 +20,3 @@ types[_key - 1] = arguments[_key];

return types.map(function (type) {
return exports.typeOf(x) === type.toLocaleLowerCase();
return exports.typeOf(input) === type.toLocaleLowerCase();
}).reduce(function (a, c) {

@@ -27,16 +27,20 @@ return a || c;

exports.isNumber = function (subject) {
return exports.isTypeOf(subject, 'number');
exports.isNumber = function (input) {
return exports.isTypeOf(input, 'number');
};
exports.isFunction = function (subject) {
return exports.isTypeOf(subject, 'function');
exports.isString = function (input) {
return exports.isTypeOf(input, 'string');
};
exports.isArray = function (subject) {
return exports.isTypeOf(subject, 'array');
exports.isFunction = function (input) {
return exports.isTypeOf(input, 'function');
};
exports.isArrayArray = function (subject) {
return exports.isTypeOf(subject, 'array') && subject.every(function (item) {
exports.isArray = function (input) {
return exports.isTypeOf(input, 'array');
};
exports.isArrayArray = function (input) {
return exports.isTypeOf(input, 'array') && input.every(function (item) {
return exports.isTypeOf(item, 'array');

@@ -46,4 +50,4 @@ });

exports.isStringObject = function (subject) {
return exports.isTypeOf(subject, 'object') && Object.keys(subject).every(function (item) {
exports.isStringObject = function (input) {
return exports.isTypeOf(input, 'object') && Object.keys(input).every(function (item) {
return exports.isTypeOf(item, 'string');

@@ -53,20 +57,20 @@ });

exports.isEventTuple = function (subject) {
return exports.isTypeOf(subject, 'array') && exports.isTypeOf(subject[0], 'string') && exports.isTypeOf(subject[1], 'function') && (!subject[2] || exports.isTypeOf(subject[2], 'boolean', 'object'));
exports.isEventTuple = function (input) {
return exports.isTypeOf(input, 'array') && exports.isTypeOf(input[0], 'string') && exports.isTypeOf(input[1], 'function') && (!input[2] || exports.isTypeOf(input[2], 'boolean', 'object'));
};
exports.isEventTupleArray = function (subject) {
return exports.isTypeOf(subject, 'array') && subject.every(exports.isEventTuple);
exports.isEventTupleArray = function (input) {
return exports.isTypeOf(input, 'array') && input.every(exports.isEventTuple);
};
exports.isElement = function (subject) {
return subject instanceof Element;
exports.isElement = function (input) {
return input instanceof Element;
};
exports.isEBuilder = function (subject) {
return subject instanceof Object && 'isEBuilder' in subject && 'el' in subject && subject.isEBuilder && subject.el;
exports.isEBObject = function (input) {
return input instanceof Object && input.isEBuilder;
};
exports.isValidChild = function (child) {
return exports.isTypeOf(child, 'string', 'number') || child instanceof Node || child.isEBuilder;
exports.isValidChild = function (input) {
return exports.isTypeOf(input, 'string', 'number') || input instanceof Node || input.isEBuilder;
};

@@ -83,3 +87,3 @@

exports.isValidTarget = function (target) {
return exports.isEBuilder(target) || target instanceof Element;
return exports.isEBObject(target) || target instanceof Element;
};

@@ -86,0 +90,0 @@

@@ -5,4 +5,9 @@ export declare function elementStringSource(source: string): {

};
export declare function HTMLToElement(html: string): Element | Node;
export declare function getFragmentFrom(input: string | Element | EBObject, times?: number): DocumentFragment;
export declare function getElementFrom(input: string | Element | EBObject): Element;
export declare function eventInput(this: EBObject, eventInput: string): any[];
export declare function getTrueElement(input: Element | EBObject): Element;
export declare function getComputedValue(this: EBObject, value: any): any;
export declare const sourceObject: (source: AnyObject) => ProcessedObject;
export declare function getComputedValue2(this: EBObject, value: any, boundData?: any[]): any;
export declare const inputObject: (source: AnyObject) => ParsedObject;

@@ -12,3 +12,3 @@ "use strict";

});
exports.sourceObject = exports.getComputedValue = exports.eventInput = exports.elementStringSource = void 0;
exports.inputObject = exports.getComputedValue2 = exports.getComputedValue = exports.getTrueElement = exports.eventInput = exports.getElementFrom = exports.getFragmentFrom = exports.HTMLToElement = exports.elementStringSource = void 0;

@@ -35,3 +35,39 @@ var Check = require("./Check");

function HTMLToElement(html) {
var template = document.createElement('template');
template.innerHTML = html;
return template.content.firstChild; // needs checks
}
exports.HTMLToElement = HTMLToElement;
function getFragmentFrom(input) {
var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
var template = document.createElement('template');
var safeTimes = Math.abs(Math.floor(times));
var fillTemplate = function fillTemplate(input) {
var html = Check.isElement(input) ? input.outerHTML : "".concat(input);
template.innerHTML += html;
};
while (safeTimes--) {
fillTemplate(input);
}
return template.content;
}
exports.getFragmentFrom = getFragmentFrom;
function getElementFrom(input) {
return Check.isString(input) ? HTMLToElement(input) // change this
: Check.isEBObject(input) ? input.element : input // needs checks
;
}
exports.getElementFrom = getElementFrom;
function eventInput(eventInput) {
// replace with getTrueElement()
var elementFrom = function elementFrom(getRefResult) {

@@ -52,2 +88,8 @@ return 'isEBuilder' in getRefResult ? getRefResult.element : getRefResult;

function getTrueElement(input) {
return Check.isEBObject(input) ? input.element : input;
}
exports.getTrueElement = getTrueElement;
function getComputedValue(value) {

@@ -59,3 +101,9 @@ return Check.isFunction(value) ? value.call(this) : value;

exports.sourceObject = function (source) {
function getComputedValue2(value, boundData) {
return Check.isFunction(value) ? value.call(this, boundData) : value;
}
exports.getComputedValue2 = getComputedValue2;
exports.inputObject = function (source) {
// 'properties@once:click@interval:1000' => ['properties', 'once:click', 'interval:1000']

@@ -71,3 +119,3 @@ var parseSourceKey = function parseSourceKey(sourceKey) {

var getProcessedEntriesFromSource = function getProcessedEntriesFromSource(source) {
var parseEntries = function parseEntries(source) {
return Object.keys(source).map(function (sourceKey) {

@@ -107,3 +155,3 @@ // trueKey = 'properties', rawRules = ['once:click', 'interval:1000']

var processedEntries = getProcessedEntriesFromSource(source);
var processedEntries = parseEntries(source);
var finalObject = getObjectFromEntries(processedEntries); // const finalMap = createMapFromProcessedEntries(processedEntries)

@@ -110,0 +158,0 @@

@@ -1,7 +0,15 @@

export declare function element(source: string | Element): Element;
/**
* Determinate the source element to work on depending on the input:
* element => element
* 'div' or '@element:div' => div element
* '<div>hello</div> or '@html:<div>hello</div> => element built upon html
* '@select:div.mydiv' => document.querySelector('div.mydiv')
*/
export declare function element(source: string | Element | EBObject): Element;
export declare function Properties(this: EBObject, properties?: AnyObject | Function): void;
export declare function Attributes(this: EBObject, attributes?: StringObject | Function): void;
export declare function Styles(this: EBObject, styles?: StringObject | Function): void;
export declare function Style(this: EBObject, style?: StringObject | Function): void;
export declare function Listeners(this: EBObject, listeners: EventTuple | EventTuple[] | Function): void;
export declare function Children(this: EBObject, children: EBChild | EBChild[] | Function): void;
export declare function process(this: EBObject, source: AnyObject, callback: SetterCallback, keyRestriction?: Object): void;
export declare function process2(this: EBObject, source: AnyObject, callback: SetterCallback, keyRestriction?: Object): void;

@@ -10,3 +10,3 @@ "use strict";

});
exports.process = exports.Children = exports.Listeners = exports.Styles = exports.Attributes = exports.Properties = exports.element = void 0;
exports.process2 = exports.process = exports.Children = exports.Listeners = exports.Style = exports.Attributes = exports.Properties = exports.element = void 0;

@@ -20,3 +20,11 @@ var EBuilderError_1 = require("../modules/EBuilderError");

var Rule = require("../modules/Rule");
/**
* Determinate the source element to work on depending on the input:
* element => element
* 'div' or '@element:div' => div element
* '<div>hello</div> or '@html:<div>hello</div> => element built upon html
* '@select:div.mydiv' => document.querySelector('div.mydiv')
*/
function element(source) {

@@ -31,5 +39,5 @@ var hasRule = function hasRule(input) {

var getElementFromHTML = function getElementFromHTML(value) {
var getElementFromHTML = function getElementFromHTML(html) {
var template = document.createElement('template');
template.innerHTML = value;
template.innerHTML = html;
return template.content.firstElementChild;

@@ -49,3 +57,5 @@ };

};
if (source instanceof Element) return source;
if (Check.isElement(source)) return source;
if (Check.isEBObject(source)) return source.element;
source = "".concat(source);

@@ -97,6 +107,6 @@ if (hasRule(source)) {

function Styles() {
function Style() {
var _this3 = this;
var styles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var style = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

@@ -109,6 +119,6 @@ var setStyle = function setStyle(name, value) {

process.call(this, styles, setStyle);
process.call(this, style, setStyle);
}
exports.Styles = Styles;
exports.Style = Style;

@@ -145,3 +155,3 @@ function Listeners(listeners) {

_this5.element.innerHTML += "".concat(child);
} else if (child.isEBuilder) {
} else if (Check.isEBObject(child)) {
_this5.element.appendChild(child.element);

@@ -160,3 +170,3 @@ } else new EBuilderError_1["default"]("Invalid input in children array", child);

var parsedObject = Parse.sourceObject(source);
var parsedObject = Parse.inputObject(source);

@@ -168,5 +178,2 @@ var processEntry = function processEntry(key) {

rules = currentEntry.rules;
/**
* Possible entry point for calling additionnal parameters for, e.g., @-for rule
*/

@@ -203,2 +210,65 @@ var computedValue = function computedValue() {

exports.process = process;
exports.process = process;
function process2(source, callback, keyRestriction) {
var _this7 = this;
var parsedObject = Parse.inputObject(source);
var processEntry = function processEntry(key) {
if (keyRestriction && !(key in keyRestriction)) return;
var currentEntry = parsedObject[key];
var value = currentEntry.value,
rules = currentEntry.rules;
if (rules.has('for')) {
if (Check.isFunction(value)) {
var ref = _this7.getRef(rules.get('for')); // needs checks
Rule.For2.call(_this7, ref, value);
}
} else {
var computedValue = function computedValue() {
return Parse.getComputedValue.call(_this7, value);
};
var setEntry = function setEntry() {
return callback(key, computedValue());
}; // const computedValue2 = (boundData?: any[]) => Parse.getComputedValue2.call(this, value, boundData)
// const setEntry2 = (boundData?: any[]) => callback(key, computedValue2(boundData))
currentEntry.hasRules() ? submitToRules(rules, setEntry) : setEntry();
}
};
var submitToRules = function submitToRules(rules, callback) {
var ruleApplied = false;
var applyRule = function applyRule(ruleValue, ruleName) {
var ruleKey = ruleName.toLowerCase();
if (ruleKey in Rule.RuleMap) {
Rule.RuleMap[ruleKey].call(_this7, ruleValue, callback);
ruleApplied = true;
}
};
var applyRule2 = function applyRule2(ruleValue, ruleName) {
var ruleKey = ruleName.toLowerCase();
if (ruleKey in Rule.RuleMap) {
Rule.RuleMap[ruleKey].call(_this7, ruleValue, callback);
ruleApplied = true;
}
};
rules.forEach(applyRule);
if (!ruleApplied) callback();
};
Object.keys(parsedObject).forEach(processEntry);
}
exports.process2 = process2;
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