typed-dom
Advanced tools
Comparing version 0.0.327 to 0.0.328
@@ -1,2 +0,2 @@ | ||
/*! typed-dom v0.0.327 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */ | ||
/*! typed-dom v0.0.328 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */ | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
@@ -178,4 +178,3 @@ if(typeof exports === 'object' && typeof module === 'object') | ||
function defineAttrs(el, attrs) { | ||
for (const name in attrs) { | ||
if (!(0, alias_1.hasOwnProperty)(attrs, name)) continue; | ||
for (const name of Object.keys(attrs)) { | ||
const value = attrs[name]; | ||
@@ -182,0 +181,0 @@ switch (typeof value) { |
@@ -1,2 +0,2 @@ | ||
/*! typed-dom v0.0.327 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */ | ||
/*! typed-dom v0.0.328 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.327 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */ | ||
/*! typed-dom v0.0.328 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */ | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
@@ -653,3 +653,2 @@ if(typeof exports === 'object' && typeof module === 'object') | ||
exports.SVG = exports.HTML = exports.Shadow = exports.API = void 0; | ||
const alias_1 = __webpack_require__(406); | ||
const proxy_1 = __webpack_require__(965); | ||
@@ -690,4 +689,3 @@ const dom_1 = __webpack_require__(521); | ||
if (typeof value['nodeType'] === 'number') return true; | ||
for (const name in value) { | ||
if (!(0, alias_1.hasOwnProperty)(value, name)) continue; | ||
for (const name of Object.keys(value)) { | ||
const val = value[name]; | ||
@@ -803,3 +801,3 @@ return val !== null && typeof val === 'object'; | ||
this.$query = ''; | ||
this.isObserverUpdate = false; | ||
this.isInternalUpdate = false; | ||
this.isInit = true; | ||
@@ -886,6 +884,5 @@ this[_a] = new internal_1.Listeners(this.element); | ||
observe(children) { | ||
return Object.defineProperties(children, Object.keys(children).reduce((acc, name) => { | ||
if (name in {}) throw new Error(`TypedDOM: Child names conflicted with the object property names.`); | ||
for (const name of Object.keys(children)) { | ||
let child = children[name]; | ||
acc[name] = { | ||
Object.defineProperty(children, name, { | ||
configurable: true, | ||
@@ -897,3 +894,3 @@ enumerable: true, | ||
set: newChild => { | ||
if (!this.isObserverUpdate) { | ||
if (!this.isInternalUpdate) { | ||
this.children = { | ||
@@ -903,9 +900,9 @@ [name]: newChild | ||
} else { | ||
this.isObserverUpdate = false; | ||
child = newChild; | ||
this.isInternalUpdate = false; | ||
} | ||
child = newChild; | ||
} | ||
}; | ||
return acc; | ||
}, {})); | ||
}); | ||
} | ||
return children; | ||
} | ||
@@ -990,4 +987,3 @@ get children() { | ||
const targetChildren = this.$children; | ||
for (const name in sourceChildren) { | ||
if (!(0, alias_1.hasOwnProperty)(sourceChildren, name)) continue; | ||
for (const name of Object.keys(sourceChildren)) { | ||
const newChild = sourceChildren[name]; | ||
@@ -1017,5 +1013,4 @@ const oldChild = targetChildren[name]; | ||
isMutated = true; | ||
this.isObserverUpdate = true; | ||
this.isInternalUpdate = true; | ||
targetChildren[name] = newChild; | ||
this.isObserverUpdate = false; | ||
} | ||
@@ -1107,4 +1102,3 @@ break; | ||
function defineAttrs(el, attrs) { | ||
for (const name in attrs) { | ||
if (!(0, alias_1.hasOwnProperty)(attrs, name)) continue; | ||
for (const name of Object.keys(attrs)) { | ||
const value = attrs[name]; | ||
@@ -1111,0 +1105,0 @@ switch (typeof value) { |
@@ -1,2 +0,2 @@ | ||
/*! typed-dom v0.0.327 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */ | ||
/*! typed-dom v0.0.328 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.327 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */ | ||
/*! typed-dom v0.0.328 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') |
@@ -40,3 +40,3 @@ import { symbols, Listeners } from './internal'; | ||
private format; | ||
private isObserverUpdate; | ||
private isInternalUpdate; | ||
private observe; | ||
@@ -43,0 +43,0 @@ private readonly type; |
@@ -1,2 +0,2 @@ | ||
/*! typed-dom v0.0.327 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */ | ||
/*! typed-dom v0.0.328 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */ | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
@@ -178,4 +178,3 @@ if(typeof exports === 'object' && typeof module === 'object') | ||
function defineAttrs(el, attrs) { | ||
for (const name in attrs) { | ||
if (!(0, alias_1.hasOwnProperty)(attrs, name)) continue; | ||
for (const name of Object.keys(attrs)) { | ||
const value = attrs[name]; | ||
@@ -182,0 +181,0 @@ switch (typeof value) { |
@@ -1,2 +0,2 @@ | ||
/*! typed-dom v0.0.327 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */ | ||
/*! typed-dom v0.0.328 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') |
34
index.js
@@ -1,2 +0,2 @@ | ||
/*! typed-dom v0.0.327 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */ | ||
/*! typed-dom v0.0.328 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */ | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
@@ -653,3 +653,2 @@ if(typeof exports === 'object' && typeof module === 'object') | ||
exports.SVG = exports.HTML = exports.Shadow = exports.API = void 0; | ||
const alias_1 = __webpack_require__(406); | ||
const proxy_1 = __webpack_require__(965); | ||
@@ -690,4 +689,3 @@ const dom_1 = __webpack_require__(521); | ||
if (typeof value['nodeType'] === 'number') return true; | ||
for (const name in value) { | ||
if (!(0, alias_1.hasOwnProperty)(value, name)) continue; | ||
for (const name of Object.keys(value)) { | ||
const val = value[name]; | ||
@@ -803,3 +801,3 @@ return val !== null && typeof val === 'object'; | ||
this.$query = ''; | ||
this.isObserverUpdate = false; | ||
this.isInternalUpdate = false; | ||
this.isInit = true; | ||
@@ -886,6 +884,5 @@ this[_a] = new internal_1.Listeners(this.element); | ||
observe(children) { | ||
return Object.defineProperties(children, Object.keys(children).reduce((acc, name) => { | ||
if (name in {}) throw new Error(`TypedDOM: Child names conflicted with the object property names.`); | ||
for (const name of Object.keys(children)) { | ||
let child = children[name]; | ||
acc[name] = { | ||
Object.defineProperty(children, name, { | ||
configurable: true, | ||
@@ -897,3 +894,3 @@ enumerable: true, | ||
set: newChild => { | ||
if (!this.isObserverUpdate) { | ||
if (!this.isInternalUpdate) { | ||
this.children = { | ||
@@ -903,9 +900,9 @@ [name]: newChild | ||
} else { | ||
this.isObserverUpdate = false; | ||
child = newChild; | ||
this.isInternalUpdate = false; | ||
} | ||
child = newChild; | ||
} | ||
}; | ||
return acc; | ||
}, {})); | ||
}); | ||
} | ||
return children; | ||
} | ||
@@ -990,4 +987,3 @@ get children() { | ||
const targetChildren = this.$children; | ||
for (const name in sourceChildren) { | ||
if (!(0, alias_1.hasOwnProperty)(sourceChildren, name)) continue; | ||
for (const name of Object.keys(sourceChildren)) { | ||
const newChild = sourceChildren[name]; | ||
@@ -1017,5 +1013,4 @@ const oldChild = targetChildren[name]; | ||
isMutated = true; | ||
this.isObserverUpdate = true; | ||
this.isInternalUpdate = true; | ||
targetChildren[name] = newChild; | ||
this.isObserverUpdate = false; | ||
} | ||
@@ -1107,4 +1102,3 @@ break; | ||
function defineAttrs(el, attrs) { | ||
for (const name in attrs) { | ||
if (!(0, alias_1.hasOwnProperty)(attrs, name)) continue; | ||
for (const name of Object.keys(attrs)) { | ||
const value = attrs[name]; | ||
@@ -1111,0 +1105,0 @@ switch (typeof value) { |
@@ -1,2 +0,2 @@ | ||
/*! typed-dom v0.0.327 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */ | ||
/*! typed-dom v0.0.328 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.327", | ||
"version": "0.0.328", | ||
"description": "A value-level and type-level DOM builder.", | ||
@@ -5,0 +5,0 @@ "private": false, |
@@ -1,2 +0,2 @@ | ||
/*! typed-dom v0.0.327 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */ | ||
/*! typed-dom v0.0.328 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,1 @@ | ||
import { hasOwnProperty } from 'spica/alias'; | ||
import { El, ElementProxy } from './proxy'; | ||
@@ -113,4 +112,3 @@ import { Factory, TagNameMap, Attrs, shadow, html, svg, define } from './util/dom'; | ||
assert([value = value as Exclude<typeof value, El.Children.Node>]); | ||
for (const name in value) { | ||
if (!hasOwnProperty(value, name)) continue; | ||
for (const name of Object.keys(value)) { | ||
const val = value[name]; | ||
@@ -117,0 +115,0 @@ return val !== null && typeof val === 'object'; |
@@ -1,2 +0,2 @@ | ||
import { isArray, hasOwnProperty } from 'spica/alias'; | ||
import { isArray } from 'spica/alias'; | ||
import { symbols, Listeners } from './internal'; | ||
@@ -161,8 +161,7 @@ import { TagNameMap, Attrs, Factory as BaseFactory } from './util/dom'; | ||
} | ||
private isObserverUpdate = false; | ||
private isInternalUpdate = false; | ||
private observe(children: El.Children.Struct): El.Children.Struct { | ||
return Object.defineProperties(children, Object.keys(children).reduce((acc, name) => { | ||
if (name in {}) throw new Error(`TypedDOM: Child names conflicted with the object property names.`); | ||
for (const name of Object.keys(children)) { | ||
let child = children[name]; | ||
acc[name] = { | ||
Object.defineProperty(children, name, { | ||
configurable: true, | ||
@@ -174,13 +173,14 @@ enumerable: true, | ||
set: (newChild: El) => { | ||
if (!this.isObserverUpdate) { | ||
if (!this.isInternalUpdate) { | ||
this.children = { [name]: newChild } as El.Setter<C>; | ||
} | ||
else { | ||
this.isObserverUpdate = false; | ||
child = newChild; | ||
this.isInternalUpdate = false; | ||
} | ||
child = newChild; | ||
assert(!this.isInternalUpdate); | ||
}, | ||
}; | ||
return acc; | ||
}, {})); | ||
}); | ||
} | ||
return children; | ||
} | ||
@@ -201,3 +201,3 @@ private readonly type: ElChildType; | ||
public set children(children: El.Setter<C>) { | ||
assert(!this.isObserverUpdate); | ||
assert(!this.isInternalUpdate); | ||
const container = this.container; | ||
@@ -249,2 +249,3 @@ const removedChildren: El[] = []; | ||
else if (newChild === oldChild) { | ||
assert(newChild.element === oldChild.element); | ||
continue; | ||
@@ -257,2 +258,3 @@ } | ||
assert(newChild !== oldChild); | ||
assert(newChild.element !== oldChild?.element); | ||
isMutated = true; | ||
@@ -283,4 +285,3 @@ } | ||
const targetChildren = this.$children as El.Children.Struct; | ||
for (const name in sourceChildren) { | ||
if (!hasOwnProperty(sourceChildren, name)) continue; | ||
for (const name of Object.keys(sourceChildren)) { | ||
const newChild = sourceChildren[name]; | ||
@@ -304,2 +305,3 @@ const oldChild = targetChildren[name]; | ||
else if (newChild === oldChild) { | ||
assert(newChild.element === oldChild.element); | ||
continue; | ||
@@ -318,7 +320,7 @@ } | ||
assert(newChild !== oldChild); | ||
assert(newChild.element !== oldChild.element); | ||
isMutated = true; | ||
this.isObserverUpdate = true; | ||
this.isInternalUpdate = true; | ||
targetChildren[name] = newChild; | ||
assert(!this.isObserverUpdate); | ||
this.isObserverUpdate = false; | ||
assert(!this.isInternalUpdate); | ||
} | ||
@@ -325,0 +327,0 @@ break; |
@@ -127,4 +127,3 @@ import { isArray, hasOwnProperty } from 'spica/alias'; | ||
function defineAttrs<E extends Element>(el: E, attrs: Attrs): E { | ||
for (const name in attrs) { | ||
if (!hasOwnProperty(attrs, name)) continue; | ||
for (const name of Object.keys(attrs)) { | ||
const value = attrs[name]; | ||
@@ -131,0 +130,0 @@ switch (typeof value) { |
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
387371
8016