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.346 to 0.0.347

8

dom.js

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

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

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

function elem(context, ns, tag, attrs) {
if (!('createElement' in context)) throw new Error(`TypedDOM: Scoped custom elements are not supported on this browser`);
if (!('createElement' in context)) throw new Error(`Typed-DOM: Scoped custom elements are not supported on this browser`);
const opts = 'is' in attrs ? {

@@ -230,6 +230,6 @@ is: attrs['is']

case 'function':
if (name.length < 3) throw new Error(`TypedDOM: Attribute names for event listeners must have an event name but got "${name}"`);
if (name.length < 3) throw new Error(`Typed-DOM: Attribute names for event listeners must have an event name but got "${name}"`);
const names = name.split(/\s+/);
for (const name of names) {
if (!name.startsWith('on')) throw new Error(`TypedDOM: Attribute names for event listeners must start with "on" but got "${name}"`);
if (!name.startsWith('on')) throw new Error(`Typed-DOM: Attribute names for event listeners must start with "on" but got "${name}"`);
const type = name.slice(2).toLowerCase();

@@ -236,0 +236,0 @@ el.addEventListener(type, value, {

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

/*! typed-dom v0.0.346 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
/*! typed-dom v0.0.347 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.346 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
/*! typed-dom v0.0.347 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
(function webpackUniversalModuleDefinition(root, factory) {

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

default:
throw new Error(`TypedDOM: Expected tag name is "${tag.toLowerCase()}" but actually "${el.tagName.toLowerCase()}"`);
throw new Error(`Typed-DOM: Expected tag name is "${tag.toLowerCase()}" but actually "${el.tagName.toLowerCase()}"`);
}

@@ -881,3 +881,3 @@ }

default:
throw new TypeError(`TypedDOM: Invalid children type`);
throw new TypeError(`Typed-DOM: Invalid children type`);
}

@@ -902,3 +902,3 @@ throwErrorIfUnavailable(this);

default:
throw new TypeError(`TypedDOM: Invalid children type`);
throw new TypeError(`Typed-DOM: Invalid children type`);
}

@@ -1094,3 +1094,3 @@ this.isInit = false;

if (!oldParent || oldParent === newParent || !(internal_1.symbols.proxy in oldParent)) return;
throw new Error(`TypedDOM: Proxy children must be removed from the old parent proxy before assigning to the new parent proxy`);
throw new Error(`Typed-DOM: Proxy children must be removed from the old parent proxy before assigning to the new parent proxy`);
}

@@ -1146,3 +1146,3 @@

function elem(context, ns, tag, attrs) {
if (!('createElement' in context)) throw new Error(`TypedDOM: Scoped custom elements are not supported on this browser`);
if (!('createElement' in context)) throw new Error(`Typed-DOM: Scoped custom elements are not supported on this browser`);
const opts = 'is' in attrs ? {

@@ -1198,6 +1198,6 @@ is: attrs['is']

case 'function':
if (name.length < 3) throw new Error(`TypedDOM: Attribute names for event listeners must have an event name but got "${name}"`);
if (name.length < 3) throw new Error(`Typed-DOM: Attribute names for event listeners must have an event name but got "${name}"`);
const names = name.split(/\s+/);
for (const name of names) {
if (!name.startsWith('on')) throw new Error(`TypedDOM: Attribute names for event listeners must start with "on" but got "${name}"`);
if (!name.startsWith('on')) throw new Error(`Typed-DOM: Attribute names for event listeners must start with "on" but got "${name}"`);
const type = name.slice(2).toLowerCase();

@@ -1204,0 +1204,0 @@ el.addEventListener(type, value, {

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

/*! typed-dom v0.0.346 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
/*! typed-dom v0.0.347 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.346 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
/*! typed-dom v0.0.347 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
(function webpackUniversalModuleDefinition(root, factory) {

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

default:
throw new Error(`TypedDOM: Expected tag name is "${tag.toLowerCase()}" but actually "${el.tagName.toLowerCase()}"`);
throw new Error(`Typed-DOM: Expected tag name is "${tag.toLowerCase()}" but actually "${el.tagName.toLowerCase()}"`);
}

@@ -881,3 +881,3 @@ }

default:
throw new TypeError(`TypedDOM: Invalid children type`);
throw new TypeError(`Typed-DOM: Invalid children type`);
}

@@ -902,3 +902,3 @@ throwErrorIfUnavailable(this);

default:
throw new TypeError(`TypedDOM: Invalid children type`);
throw new TypeError(`Typed-DOM: Invalid children type`);
}

@@ -1094,3 +1094,3 @@ this.isInit = false;

if (!oldParent || oldParent === newParent || !(internal_1.symbols.proxy in oldParent)) return;
throw new Error(`TypedDOM: Proxy children must be removed from the old parent proxy before assigning to the new parent proxy`);
throw new Error(`Typed-DOM: Proxy children must be removed from the old parent proxy before assigning to the new parent proxy`);
}

@@ -1146,3 +1146,3 @@

function elem(context, ns, tag, attrs) {
if (!('createElement' in context)) throw new Error(`TypedDOM: Scoped custom elements are not supported on this browser`);
if (!('createElement' in context)) throw new Error(`Typed-DOM: Scoped custom elements are not supported on this browser`);
const opts = 'is' in attrs ? {

@@ -1198,6 +1198,6 @@ is: attrs['is']

case 'function':
if (name.length < 3) throw new Error(`TypedDOM: Attribute names for event listeners must have an event name but got "${name}"`);
if (name.length < 3) throw new Error(`Typed-DOM: Attribute names for event listeners must have an event name but got "${name}"`);
const names = name.split(/\s+/);
for (const name of names) {
if (!name.startsWith('on')) throw new Error(`TypedDOM: Attribute names for event listeners must start with "on" but got "${name}"`);
if (!name.startsWith('on')) throw new Error(`Typed-DOM: Attribute names for event listeners must start with "on" but got "${name}"`);
const type = name.slice(2).toLowerCase();

@@ -1204,0 +1204,0 @@ el.addEventListener(type, value, {

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

@@ -42,10 +42,10 @@ "private": false,

"@types/power-assert": "1.5.8",
"@typescript-eslint/parser": "^6.2.0",
"@typescript-eslint/parser": "^6.5.0",
"babel-loader": "^9.1.3",
"babel-plugin-unassert": "^3.2.0",
"concurrently": "^8.2.0",
"eslint": "^8.45.0",
"concurrently": "^8.2.1",
"eslint": "^8.48.0",
"eslint-plugin-redos": "^4.4.5",
"eslint-webpack-plugin": "^4.0.1",
"glob": "^10.3.3",
"glob": "^10.3.4",
"i18next": "22.4.4",

@@ -59,6 +59,6 @@ "karma": "^6.4.2",

"mocha": "^10.2.0",
"npm-check-updates": "^16.10.17",
"spica": "0.0.751",
"npm-check-updates": "^16.13.2",
"spica": "0.0.757",
"ts-loader": "^9.4.4",
"typescript": "5.1.6",
"typescript": "5.2.2",
"webpack": "^5.88.2",

@@ -65,0 +65,0 @@ "webpack-cli": "^5.1.4",

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

/*! typed-dom v0.0.346 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
/*! typed-dom v0.0.347 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.346 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
/*! typed-dom v0.0.347 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
(function webpackUniversalModuleDefinition(root, factory) {

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

function elem(context, ns, tag, attrs) {
if (!('createElement' in context)) throw new Error(`TypedDOM: Scoped custom elements are not supported on this browser`);
if (!('createElement' in context)) throw new Error(`Typed-DOM: Scoped custom elements are not supported on this browser`);
const opts = 'is' in attrs ? {

@@ -230,6 +230,6 @@ is: attrs['is']

case 'function':
if (name.length < 3) throw new Error(`TypedDOM: Attribute names for event listeners must have an event name but got "${name}"`);
if (name.length < 3) throw new Error(`Typed-DOM: Attribute names for event listeners must have an event name but got "${name}"`);
const names = name.split(/\s+/);
for (const name of names) {
if (!name.startsWith('on')) throw new Error(`TypedDOM: Attribute names for event listeners must start with "on" but got "${name}"`);
if (!name.startsWith('on')) throw new Error(`Typed-DOM: Attribute names for event listeners must start with "on" but got "${name}"`);
const type = name.slice(2).toLowerCase();

@@ -236,0 +236,0 @@ el.addEventListener(type, value, {

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

|jQuery|Query|Implementation|Plugin|Breakable, Implicit dependency|
|React|Create all and search difference|Implementation|Component|Breakable, Waste, Complex, Severely dependent, Incomplete vain reinvention of the browser|
|React|Create all and search difference|Implementation|Component|Breakable, Waste, Complex, Severely dependent, Incomplete vain reinvention of the browsers|

@@ -226,3 +226,8 @@ ## Usage

Create a helper factory function for i18n.
However, client-side translation is inefficient except live updates due to the following increase in traffic data size.
- Schema of translation data.
- Logic of translation.
- Unused or duplicate data.
```ts

@@ -250,8 +255,8 @@ import { HTML, El, html, define } from 'typed-dom';

<K extends keyof TransDataMap>
(children: K, data: TransDataMap[K], factory?: El.Factory<HTMLElementTagNameMap, El.Children.Void>)
(text: K, data: TransDataMap[K], factory?: El.Factory<HTMLElementTagNameMap, El.Children.Void>)
: El.Factory<HTMLElementTagNameMap, El.Children.Void> {
return (html, tag) => {
const el = factory?.(html, tag, {}) ?? html(tag);
el.textContent = translator.t(children, data)
?? `{% Failed to translate "${children}". %}`;
el.textContent = translator.t(text, data)
?? `{% Failed to translate "${text}". %}`;
return el;

@@ -258,0 +263,0 @@ };

@@ -105,3 +105,3 @@ import { El, ElementProxy } from './proxy';

default:
throw new Error(`TypedDOM: Expected tag name is "${tag.toLowerCase()}" but actually "${el.tagName.toLowerCase()}"`);
throw new Error(`Typed-DOM: Expected tag name is "${tag.toLowerCase()}" but actually "${el.tagName.toLowerCase()}"`);
}

@@ -108,0 +108,0 @@ }

@@ -92,3 +92,3 @@ import { isArray } from 'spica/alias';

default:
throw new TypeError(`TypedDOM: Invalid children type`);
throw new TypeError(`Typed-DOM: Invalid children type`);
}

@@ -113,3 +113,3 @@ throwErrorIfUnavailable(this);

default:
throw new TypeError(`TypedDOM: Invalid children type`);
throw new TypeError(`Typed-DOM: Invalid children type`);
}

@@ -213,4 +213,4 @@ this.isInit = false;

if (this.isInit) {
assert(newChild === oldChild);
throwErrorIfUnavailable(newChild, container);
assert(newChild === oldChild);
this.format(newChild);

@@ -266,4 +266,4 @@ const hasListener = Listeners.of(newChild)?.haveConnectionListener();

if (this.isInit) {
assert(newChild === oldChild);
throwErrorIfUnavailable(newChild, container);
assert(newChild === oldChild);
this.format(newChild);

@@ -343,3 +343,3 @@ const hasListener = Listeners.of(newChild)?.haveConnectionListener();

if (!oldParent || oldParent === newParent || !(symbols.proxy in oldParent)) return;
throw new Error(`TypedDOM: Proxy children must be removed from the old parent proxy before assigning to the new parent proxy`);
throw new Error(`Typed-DOM: Proxy children must be removed from the old parent proxy before assigning to the new parent proxy`);
}

@@ -100,3 +100,3 @@ import { isArray, hasOwnProperty } from 'spica/alias';

function elem(context: Document | ShadowRoot, ns: NS, tag: string, attrs: Attrs): Element {
if (!('createElement' in context)) throw new Error(`TypedDOM: Scoped custom elements are not supported on this browser`);
if (!('createElement' in context)) throw new Error(`Typed-DOM: Scoped custom elements are not supported on this browser`);
const opts = 'is' in attrs ? { is: attrs['is'] as string } : undefined;

@@ -157,6 +157,6 @@ switch (ns) {

case 'function':
if (name.length < 3) throw new Error(`TypedDOM: Attribute names for event listeners must have an event name but got "${name}"`);
if (name.length < 3) throw new Error(`Typed-DOM: Attribute names for event listeners must have an event name but got "${name}"`);
const names = name.split(/\s+/);
for (const name of names) {
if (!name.startsWith('on')) throw new Error(`TypedDOM: Attribute names for event listeners must start with "on" but got "${name}"`);
if (!name.startsWith('on')) throw new Error(`Typed-DOM: Attribute names for event listeners must start with "on" but got "${name}"`);
const type = name.slice(2).toLowerCase();

@@ -163,0 +163,0 @@ el.addEventListener(type, value, {

@@ -744,8 +744,8 @@ import { Shadow, HTML, SVG, El, Attrs, shadow, frag, html, define } from '../../index';

<K extends keyof TransDataMap>
(children: K, data: TransDataMap[K], factory?: El.Factory<HTMLElementTagNameMap, El.Children.Void>)
(text: K, data: TransDataMap[K], factory?: El.Factory<HTMLElementTagNameMap, El.Children.Void>)
: El.Factory<HTMLElementTagNameMap, El.Children.Void> {
return (html, tag) => {
const el = factory?.(html, tag, {}) ?? html(tag);
el.textContent = translator.t(children, data)
?? `{% Failed to translate "${children}". %}`;
el.textContent = translator.t(text, data)
?? `{% Failed to translate "${text}". %}`;
return el;

@@ -752,0 +752,0 @@ };

Sorry, the diff of this file is too big to display

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