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

typed-dom

Package Overview
Dependencies
Maintainers
1
Versions
350
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typed-dom - npm Package Compare versions

Comparing version 0.0.322 to 0.0.323

internal.ts

2

dist/dom.js

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

/*! typed-dom v0.0.322 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
/*! typed-dom v0.0.323 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
(function webpackUniversalModuleDefinition(root, factory) {

@@ -3,0 +3,0 @@ if(typeof exports === 'object' && typeof module === 'object')

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

/*! typed-dom v0.0.322 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
/*! typed-dom v0.0.323 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
(function webpackUniversalModuleDefinition(root, factory) {

@@ -3,0 +3,0 @@ if(typeof exports === 'object' && typeof module === 'object')

@@ -0,6 +1,7 @@

export type { El } from './src/proxy';
export { API, Shadow, HTML, SVG } from './src/builder';
export { El } from './src/proxy';
export { NS, Attrs, Children, Factory, shadow, frag, html, svg, text, element, define, append, prepend, defrag } from './src/util/dom';
export { NS, Attrs, Children, Factory } from './src/util/dom';
export { shadow, frag, html, svg, text, element, define, append, prepend, defrag } from './src/util/dom';
export { listen, delegate, bind, once, currentTarget } from './src/util/listener';
export { querySelectorAll, querySelectorWith, querySelectorAllWith } from './src/util/query';
export { identity } from './src/util/identity';

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

/*! typed-dom v0.0.322 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
/*! typed-dom v0.0.323 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
(function webpackUniversalModuleDefinition(root, factory) {

@@ -707,3 +707,3 @@ if(typeof exports === 'object' && typeof module === 'object')

}));
exports.Events = exports.symbols = void 0;
exports.Listeners = exports.symbols = void 0;
const array_1 = __webpack_require__(112);

@@ -715,11 +715,12 @@ var symbols;

// Optional
symbols.events = Symbol.for('typed-dom::events');
symbols.listeners = Symbol.for('typed-dom::listeners');
})(symbols = exports.symbols || (exports.symbols = {}));
class Events {
static get(target) {
return target[symbols.events] ?? target.element[symbols.proxy]?.[symbols.events];
class Listeners {
static from(target) {
return target[symbols.listeners] ?? target.element[symbols.proxy]?.[symbols.listeners];
}
static hasConnectionListener(target) {
const events = this.get(target);
return events ? events.targets.length > 0 || events.connect || events.disconnect : false;
const listeners = this.from(target);
if (!listeners) return false;
return listeners.targets.length > 0 || listeners.connect || listeners.disconnect;
}

@@ -758,5 +759,5 @@ constructor(element) {

for (const target of targets) {
const events = Events.get(target);
events?.dispatchConnectEvent();
if (!events?.connect) continue;
const listeners = Listeners.from(target);
listeners?.dispatchConnectEvent();
if (!listeners?.connect) continue;
target.element.dispatchEvent(new Event('connect', {

@@ -772,5 +773,5 @@ bubbles: false,

for (const target of targets) {
const events = Events.get(target);
events?.dispatchDisconnectEvent();
if (!events?.disconnect) continue;
const listeners = Listeners.from(target);
listeners?.dispatchDisconnectEvent();
if (!listeners?.disconnect) continue;
target.element.dispatchEvent(new Event('disconnect', {

@@ -783,3 +784,3 @@ bubbles: false,

}
exports.Events = Events;
exports.Listeners = Listeners;

@@ -809,3 +810,3 @@ /***/ }),

this.isInit = true;
this[_a] = new internal_1.Events(this.element);
this[_a] = new internal_1.Listeners(this.element);
this.container = container;

@@ -921,3 +922,3 @@ this.$children = children;

const addedChildren = [];
const events = internal_1.Events.get(this);
const listeners = internal_1.Listeners.from(this);
let isMutated = false;

@@ -933,3 +934,3 @@ switch (this.type) {

{
if (this.isInit || !events?.mutate) {
if (this.isInit || !listeners?.mutate) {
container.textContent = children;

@@ -958,3 +959,3 @@ isMutated = true;

this.scope(newChild);
internal_1.Events.hasConnectionListener(newChild) && addedChildren.push(newChild) && events.add(newChild);
internal_1.Listeners.hasConnectionListener(newChild) && addedChildren.push(newChild) && listeners.add(newChild);
}

@@ -973,3 +974,3 @@ }

if (oldChild.element.parentNode !== container) {
internal_1.Events.hasConnectionListener(oldChild) && removedChildren.push(oldChild) && events.del(oldChild);
internal_1.Listeners.hasConnectionListener(oldChild) && removedChildren.push(oldChild) && listeners.del(oldChild);
}

@@ -989,3 +990,3 @@ }

newChild.element.parentNode !== container && container.appendChild(newChild.element);
internal_1.Events.hasConnectionListener(newChild) && addedChildren.push(newChild) && events.add(newChild);
internal_1.Listeners.hasConnectionListener(newChild) && addedChildren.push(newChild) && listeners.add(newChild);
isMutated = true;

@@ -1008,4 +1009,4 @@ }

container.replaceChild(newChild.element, oldChild.element);
internal_1.Events.hasConnectionListener(newChild) && addedChildren.push(newChild) && events.add(newChild);
internal_1.Events.hasConnectionListener(oldChild) && removedChildren.push(oldChild) && events.del(oldChild);
internal_1.Listeners.hasConnectionListener(newChild) && addedChildren.push(newChild) && listeners.add(newChild);
internal_1.Listeners.hasConnectionListener(oldChild) && removedChildren.push(oldChild) && listeners.del(oldChild);
} else {

@@ -1024,9 +1025,9 @@ const ref = newChild.element.nextSibling;

}
events?.dispatchDisconnectEvent(removedChildren);
events?.dispatchConnectEvent(addedChildren);
isMutated && events?.dispatchMutateEvent();
listeners?.dispatchDisconnectEvent(removedChildren);
listeners?.dispatchConnectEvent(addedChildren);
isMutated && listeners?.dispatchMutateEvent();
}
}
exports.ElementProxy = ElementProxy;
_a = internal_1.symbols.events;
_a = internal_1.symbols.listeners;
function throwErrorIfNotUsable(child, newParent) {

@@ -1033,0 +1034,0 @@ const oldParent = child.element.parentNode;

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

/*! typed-dom v0.0.322 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
/*! typed-dom v0.0.323 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
(function webpackUniversalModuleDefinition(root, factory) {

@@ -3,0 +3,0 @@ if(typeof exports === 'object' && typeof module === 'object')

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

/*! typed-dom v0.0.322 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
/*! typed-dom v0.0.323 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
(function webpackUniversalModuleDefinition(root, factory) {

@@ -3,0 +3,0 @@ if(typeof exports === 'object' && typeof module === 'object')

export declare namespace symbols {
const proxy: unique symbol;
const events: unique symbol;
const listeners: unique symbol;
}

@@ -9,7 +9,7 @@ interface Target {

};
readonly [symbols.events]?: Events;
readonly [symbols.listeners]?: Listeners;
}
export declare class Events {
export declare class Listeners {
private readonly element;
static get(target: Target): Events | undefined;
static from(target: Target): Listeners | undefined;
static hasConnectionListener(target: Target): boolean;

@@ -16,0 +16,0 @@ constructor(element: Element);

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

import { symbols, Events } from './internal';
import { symbols, Listeners } from './internal';
import { TagNameMap, Attrs, Factory as BaseFactory } from './util/dom';

@@ -46,5 +46,5 @@ declare global {

private $children;
readonly [symbols.events]: Events;
readonly [symbols.listeners]: Listeners;
get children(): El.Getter<C>;
set children(children: El.Setter<C>);
}

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

/*! typed-dom v0.0.322 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
/*! typed-dom v0.0.323 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
(function webpackUniversalModuleDefinition(root, factory) {

@@ -3,0 +3,0 @@ if(typeof exports === 'object' && typeof module === 'object')

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

/*! typed-dom v0.0.322 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
/*! typed-dom v0.0.323 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
(function webpackUniversalModuleDefinition(root, factory) {

@@ -3,0 +3,0 @@ if(typeof exports === 'object' && typeof module === 'object')

@@ -0,6 +1,7 @@

export type { El } from './src/proxy';
export { API, Shadow, HTML, SVG } from './src/builder';
export { El } from './src/proxy';
export { NS, Attrs, Children, Factory, shadow, frag, html, svg, text, element, define, append, prepend, defrag } from './src/util/dom';
export { NS, Attrs, Children, Factory } from './src/util/dom';
export { shadow, frag, html, svg, text, element, define, append, prepend, defrag } from './src/util/dom';
export { listen, delegate, bind, once, currentTarget } from './src/util/listener';
export { querySelectorAll, querySelectorWith, querySelectorAllWith } from './src/util/query';
export { identity } from './src/util/identity';

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

/*! typed-dom v0.0.322 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
/*! typed-dom v0.0.323 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
(function webpackUniversalModuleDefinition(root, factory) {

@@ -707,3 +707,3 @@ if(typeof exports === 'object' && typeof module === 'object')

}));
exports.Events = exports.symbols = void 0;
exports.Listeners = exports.symbols = void 0;
const array_1 = __webpack_require__(112);

@@ -715,11 +715,12 @@ var symbols;

// Optional
symbols.events = Symbol.for('typed-dom::events');
symbols.listeners = Symbol.for('typed-dom::listeners');
})(symbols = exports.symbols || (exports.symbols = {}));
class Events {
static get(target) {
return target[symbols.events] ?? target.element[symbols.proxy]?.[symbols.events];
class Listeners {
static from(target) {
return target[symbols.listeners] ?? target.element[symbols.proxy]?.[symbols.listeners];
}
static hasConnectionListener(target) {
const events = this.get(target);
return events ? events.targets.length > 0 || events.connect || events.disconnect : false;
const listeners = this.from(target);
if (!listeners) return false;
return listeners.targets.length > 0 || listeners.connect || listeners.disconnect;
}

@@ -758,5 +759,5 @@ constructor(element) {

for (const target of targets) {
const events = Events.get(target);
events?.dispatchConnectEvent();
if (!events?.connect) continue;
const listeners = Listeners.from(target);
listeners?.dispatchConnectEvent();
if (!listeners?.connect) continue;
target.element.dispatchEvent(new Event('connect', {

@@ -772,5 +773,5 @@ bubbles: false,

for (const target of targets) {
const events = Events.get(target);
events?.dispatchDisconnectEvent();
if (!events?.disconnect) continue;
const listeners = Listeners.from(target);
listeners?.dispatchDisconnectEvent();
if (!listeners?.disconnect) continue;
target.element.dispatchEvent(new Event('disconnect', {

@@ -783,3 +784,3 @@ bubbles: false,

}
exports.Events = Events;
exports.Listeners = Listeners;

@@ -809,3 +810,3 @@ /***/ }),

this.isInit = true;
this[_a] = new internal_1.Events(this.element);
this[_a] = new internal_1.Listeners(this.element);
this.container = container;

@@ -921,3 +922,3 @@ this.$children = children;

const addedChildren = [];
const events = internal_1.Events.get(this);
const listeners = internal_1.Listeners.from(this);
let isMutated = false;

@@ -933,3 +934,3 @@ switch (this.type) {

{
if (this.isInit || !events?.mutate) {
if (this.isInit || !listeners?.mutate) {
container.textContent = children;

@@ -958,3 +959,3 @@ isMutated = true;

this.scope(newChild);
internal_1.Events.hasConnectionListener(newChild) && addedChildren.push(newChild) && events.add(newChild);
internal_1.Listeners.hasConnectionListener(newChild) && addedChildren.push(newChild) && listeners.add(newChild);
}

@@ -973,3 +974,3 @@ }

if (oldChild.element.parentNode !== container) {
internal_1.Events.hasConnectionListener(oldChild) && removedChildren.push(oldChild) && events.del(oldChild);
internal_1.Listeners.hasConnectionListener(oldChild) && removedChildren.push(oldChild) && listeners.del(oldChild);
}

@@ -989,3 +990,3 @@ }

newChild.element.parentNode !== container && container.appendChild(newChild.element);
internal_1.Events.hasConnectionListener(newChild) && addedChildren.push(newChild) && events.add(newChild);
internal_1.Listeners.hasConnectionListener(newChild) && addedChildren.push(newChild) && listeners.add(newChild);
isMutated = true;

@@ -1008,4 +1009,4 @@ }

container.replaceChild(newChild.element, oldChild.element);
internal_1.Events.hasConnectionListener(newChild) && addedChildren.push(newChild) && events.add(newChild);
internal_1.Events.hasConnectionListener(oldChild) && removedChildren.push(oldChild) && events.del(oldChild);
internal_1.Listeners.hasConnectionListener(newChild) && addedChildren.push(newChild) && listeners.add(newChild);
internal_1.Listeners.hasConnectionListener(oldChild) && removedChildren.push(oldChild) && listeners.del(oldChild);
} else {

@@ -1024,9 +1025,9 @@ const ref = newChild.element.nextSibling;

}
events?.dispatchDisconnectEvent(removedChildren);
events?.dispatchConnectEvent(addedChildren);
isMutated && events?.dispatchMutateEvent();
listeners?.dispatchDisconnectEvent(removedChildren);
listeners?.dispatchConnectEvent(addedChildren);
isMutated && listeners?.dispatchMutateEvent();
}
}
exports.ElementProxy = ElementProxy;
_a = internal_1.symbols.events;
_a = internal_1.symbols.listeners;
function throwErrorIfNotUsable(child, newParent) {

@@ -1033,0 +1034,0 @@ const oldParent = child.element.parentNode;

@@ -0,6 +1,7 @@

export type { El } from './src/proxy';
export { API, Shadow, HTML, SVG } from './src/builder';
export { El } from './src/proxy';
export { NS, Attrs, Children, Factory, shadow, frag, html, svg, text, element, define, append, prepend, defrag } from './src/util/dom';
export { NS, Attrs, Children, Factory } from './src/util/dom';
export { shadow, frag, html, svg, text, element, define, append, prepend, defrag } from './src/util/dom';
export { listen, delegate, bind, once, currentTarget } from './src/util/listener';
export { querySelectorAll, querySelectorWith, querySelectorAllWith } from './src/util/query';
export { identity } from './src/util/identity';

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

/*! typed-dom v0.0.322 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
/*! typed-dom v0.0.323 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
(function webpackUniversalModuleDefinition(root, factory) {

@@ -3,0 +3,0 @@ if(typeof exports === 'object' && typeof module === 'object')

{
"name": "typed-dom",
"version": "0.0.322",
"version": "0.0.323",
"description": "A value-level and type-level DOM builder.",

@@ -5,0 +5,0 @@ "private": false,

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

/*! typed-dom v0.0.322 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
/*! typed-dom v0.0.323 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
(function webpackUniversalModuleDefinition(root, factory) {

@@ -3,0 +3,0 @@ if(typeof exports === 'object' && typeof module === 'object')

@@ -29,3 +29,3 @@ # typed-dom

|-|-|-|-|-|
|jQuery|Query|Implementation|Plugin|Breakable / Unclear dependency|
|jQuery|Query|Implementation|Plugin|Breakable / Implicit dependency|
|Typed-DOM|Type|Interface|Fork|Slow construction|

@@ -32,0 +32,0 @@ |React|Create all and search difference|Implementation|Component|Breakable / Waste / Complex / Severely dependent / Incomplete vain reinvention of the browser|

@@ -7,3 +7,3 @@ import { splice } from 'spica/array';

// Optional
export const events = Symbol.for('typed-dom::events');
export const listeners = Symbol.for('typed-dom::listeners');
}

@@ -15,14 +15,13 @@

};
readonly [symbols.events]?: Events;
readonly [symbols.listeners]?: Listeners;
}
export class Events {
public static get(target: Target): Events | undefined {
return target[symbols.events] ?? target.element[symbols.proxy]?.[symbols.events];
export class Listeners {
public static from(target: Target): Listeners | undefined {
return target[symbols.listeners] ?? target.element[symbols.proxy]?.[symbols.listeners];
}
public static hasConnectionListener(target: Target): boolean {
const events = this.get(target);
return events
? events.targets.length > 0 || events.connect || events.disconnect
: false;
const listeners = this.from(target);
if (!listeners) return false;
return listeners.targets.length > 0 || listeners.connect || listeners.disconnect;
}

@@ -64,5 +63,5 @@ constructor(

for (const target of targets) {
const events = Events.get(target);
events?.dispatchConnectEvent();
if (!events?.connect) continue;
const listeners = Listeners.from(target);
listeners?.dispatchConnectEvent();
if (!listeners?.connect) continue;
target.element.dispatchEvent(new Event('connect', { bubbles: false, cancelable: false }));

@@ -77,5 +76,5 @@ }

for (const target of targets) {
const events = Events.get(target);
events?.dispatchDisconnectEvent();
if (!events?.disconnect) continue;
const listeners = Listeners.from(target);
listeners?.dispatchDisconnectEvent();
if (!listeners?.disconnect) continue;
target.element.dispatchEvent(new Event('disconnect', { bubbles: false, cancelable: false }));

@@ -82,0 +81,0 @@ }

import { isArray, hasOwnProperty } from 'spica/alias';
import { symbols, Events } from './internal';
import { symbols, Listeners } from './internal';
import { TagNameMap, Attrs, Factory as BaseFactory } from './util/dom';

@@ -186,3 +186,3 @@ import { identity } from './util/identity';

private $children: C;
public readonly [symbols.events] = new Events(this.element);
public readonly [symbols.listeners] = new Listeners(this.element);
public get children(): El.Getter<C> {

@@ -201,3 +201,3 @@ switch (this.type) {

const addedChildren: El[] = [];
const events = Events.get(this);
const listeners = Listeners.from(this);
let isMutated = false;

@@ -212,3 +212,3 @@ switch (this.type) {

case ElChildType.Text: {
if (this.isInit || !events?.mutate) {
if (this.isInit || !listeners?.mutate) {
container.textContent = children as El.Children.Text;

@@ -237,3 +237,3 @@ isMutated = true;

assert(!addedChildren.includes(newChild));
Events.hasConnectionListener(newChild) && addedChildren.push(newChild) && events!.add(newChild);
Listeners.hasConnectionListener(newChild) && addedChildren.push(newChild) && listeners!.add(newChild);
}

@@ -254,3 +254,3 @@ }

assert(!removedChildren.includes(oldChild));
Events.hasConnectionListener(oldChild) && removedChildren.push(oldChild) && events!.del(oldChild);
Listeners.hasConnectionListener(oldChild) && removedChildren.push(oldChild) && listeners!.del(oldChild);
assert(isMutated);

@@ -273,3 +273,3 @@ }

assert(!addedChildren.includes(newChild));
Events.hasConnectionListener(newChild) && addedChildren.push(newChild) && events!.add(newChild);
Listeners.hasConnectionListener(newChild) && addedChildren.push(newChild) && listeners!.add(newChild);
isMutated = true;

@@ -294,5 +294,5 @@ }

assert(!addedChildren.includes(newChild));
Events.hasConnectionListener(newChild) && addedChildren.push(newChild) && events!.add(newChild);
Listeners.hasConnectionListener(newChild) && addedChildren.push(newChild) && listeners!.add(newChild);
assert(!removedChildren.includes(oldChild));
Events.hasConnectionListener(oldChild) && removedChildren.push(oldChild) && events!.del(oldChild);
Listeners.hasConnectionListener(oldChild) && removedChildren.push(oldChild) && listeners!.del(oldChild);
}

@@ -314,6 +314,6 @@ else {

}
events?.dispatchDisconnectEvent(removedChildren);
events?.dispatchConnectEvent(addedChildren);
listeners?.dispatchDisconnectEvent(removedChildren);
listeners?.dispatchConnectEvent(addedChildren);
assert(isMutated || removedChildren.length + addedChildren.length === 0);
isMutated && events?.dispatchMutateEvent();
isMutated && listeners?.dispatchMutateEvent();
}

@@ -320,0 +320,0 @@ }

@@ -1,2 +0,8 @@

import { API, Shadow, HTML, SVG, NS, shadow, frag, html, svg, text, element, define, append, prepend, defrag, listen, once, bind, delegate, currentTarget, querySelectorAll, querySelectorWith, querySelectorAllWith, identity } from '../../index';
import {
API, Shadow, HTML, SVG, NS,
shadow, frag, html, svg, text, element, define, append, prepend, defrag,
listen, once, bind, delegate, currentTarget,
querySelectorAll, querySelectorWith, querySelectorAllWith,
identity,
} from '../../index';

@@ -3,0 +9,0 @@ describe('Interface: Package', function () {

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