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

aurumjs

Package Overview
Dependencies
Maintainers
1
Versions
244
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aurumjs - npm Package Compare versions

Comparing version 0.6.4 to 0.6.5

prebuilt/cjs/utilities/classname.d.ts

2

package.json
{
"name": "aurumjs",
"version": "0.6.4",
"version": "0.6.5",
"description": "Stream based declarative DOM rendering library for javascript",

@@ -5,0 +5,0 @@ "main": "prebuilt/cjs/aurumjs.js",

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

}));
this.synchedDataSources.get(id).set(id, [{ source: dataSource, token: cancellation }]);
this.synchedDataSources.get(id).set(authenticationToken, [{ source: dataSource, token: cancellation }]);
}

@@ -104,3 +104,3 @@ else {

}));
this.synchedArrayDataSources.get(id).set(id, [{ source: dataSource, token: cancellation }]);
this.synchedArrayDataSources.get(id).set(authenticationToken, [{ source: dataSource, token: cancellation }]);
}

@@ -141,3 +141,3 @@ else {

}));
this.synchedDuplexDataSources.get(id).set(id, [{ source: dataSource, token: cancellation }]);
this.synchedDuplexDataSources.get(id).set(authenticationToken, [{ source: dataSource, token: cancellation }]);
}

@@ -151,3 +151,4 @@ else {

let started = false;
let latency = 0;
let latency = [0, 0, 0, 0];
let cycle = 0;
let latencyTs;

@@ -183,4 +184,10 @@ let lastBeat;

case RemoteProtocol.HEARTBEAT:
latency = Date.now() - latencyTs;
console.log(`AurumServer latency: ${latency}ms`);
latency[cycle] = Date.now() - latencyTs;
if ((cycle + 1) % latency.length === 0) {
console.log(`AurumServer latency: ${(latency.reduce((p, c) => p + c) / latency.length).toFixed(1)}ms`);
cycle = 0;
}
else {
cycle++;
}
break;

@@ -187,0 +194,0 @@ case RemoteProtocol.UPDATE_DATASOURCE:

@@ -19,3 +19,4 @@ export * from './rendering/webcomponent';

export * from './utilities/event_emitter';
export * from './rendering/classname';
export * from './utilities/classname';
export * from './utilities/sources';
export * from './stream/emitters';

@@ -22,0 +23,0 @@ export * from './nodes/string_adapter';

@@ -32,3 +32,4 @@ "use strict";

__exportStar(require("./utilities/event_emitter"), exports);
__exportStar(require("./rendering/classname"), exports);
__exportStar(require("./utilities/classname"), exports);
__exportStar(require("./utilities/sources"), exports);
__exportStar(require("./stream/emitters"), exports);

@@ -35,0 +36,0 @@ __exportStar(require("./nodes/string_adapter"), exports);

@@ -15,2 +15,3 @@ import { ClassType, DataDrain, Callback, MapLike, AttributeValue } from '../utilities/common';

contentEditable?: AttributeValue;
onContextMenu?: DataDrain<MouseEvent>;
onDblClick?: DataDrain<MouseEvent>;

@@ -17,0 +18,0 @@ onClick?: DataDrain<MouseEvent>;

@@ -26,2 +26,3 @@ "use strict";

keyup: 'onKeyUp',
contextmenu: 'onContextMenu',
mousedown: 'onMouseDown',

@@ -28,0 +29,0 @@ mouseup: 'onMouseUp',

@@ -6,3 +6,3 @@ import { AurumComponentAPI, Renderable } from '../rendering/aurum_element';

}
export declare function Suspense(props: SuspenseProps, children: Renderable[], api: AurumComponentAPI): DataSource<Renderable | Renderable[]>;
export declare function Suspense(props: SuspenseProps, children: Renderable[], api: AurumComponentAPI): any[] | DataSource<Renderable | Renderable[]>;
//# sourceMappingURL=suspense.d.ts.map

@@ -7,3 +7,2 @@ "use strict";

function Suspense(props, children, api) {
const data = new data_source_1.DataSource(props === null || props === void 0 ? void 0 : props.fallback);
const lc = aurum_element_1.createLifeCycle();

@@ -13,16 +12,23 @@ api.onDetach(() => {

});
Promise.all(api.prerender(children, lc)).then(function result(res) {
if (res instanceof Promise) {
res.then(result, onError);
}
else {
const nestedRendered = api.prerender(res, lc);
if (nestedRendered.some((s) => s instanceof Promise)) {
Promise.all(nestedRendered).then(result, onError);
const rendered = api.prerender(children, lc);
if (rendered.some((r) => r instanceof Promise)) {
Promise.all(api.prerender(children, lc)).then(function result(res) {
if (res instanceof Promise) {
res.then(result, onError);
}
else {
onDone(nestedRendered);
const nestedRendered = api.prerender(res, lc);
if (nestedRendered.some((s) => s instanceof Promise)) {
Promise.all(nestedRendered).then(result, onError);
}
else {
onDone(nestedRendered);
}
}
}
}, onError);
}, onError);
}
else {
return rendered;
}
const data = new data_source_1.DataSource(props === null || props === void 0 ? void 0 : props.fallback);
return data;

@@ -29,0 +35,0 @@ function onDone(res) {

@@ -24,5 +24,3 @@ "use strict";

return content
.toString()
.replace('<', '&lt;')
.replace('>', '&gt;');
.toString();
}

@@ -29,0 +27,0 @@ else if (content instanceof data_source_1.DataSource) {

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

const event_emitter_1 = require("../utilities/event_emitter");
const classname_1 = require("./classname");
const classname_1 = require("../utilities/classname");
function createRenderSession() {

@@ -118,2 +118,6 @@ const session = {

//@ts-ignore
if (this.hostNode.childNodes[workIndex].owner.disposed) {
break;
}
//@ts-ignore
this.hostNode.childNodes[workIndex].owner.dispose();

@@ -361,2 +365,3 @@ }

spliceChildren(index, amount, newItems) {
var _a;
let removed;

@@ -370,3 +375,3 @@ if (newItems) {

for (const item of removed) {
this.renderSessions.get(item).sessionToken.cancel();
(_a = this.renderSessions.get(item)) === null || _a === void 0 ? void 0 : _a.sessionToken.cancel();
}

@@ -413,3 +418,3 @@ }

case 'removeRight':
this.spliceChildren(change.index, change.count);
this.spliceChildren(flattenIndex(change.newState, change.index), flattenIndex(change.items, change.items.length));
break;

@@ -423,3 +428,3 @@ case 'append':

this.children = this.children.concat(rendered);
for (let i = rendered.length - 1; i >= 0; i--) {
for (let i = 0; i <= rendered.length; i++) {
if (rendered[i]) {

@@ -503,15 +508,4 @@ if (rendered[i] instanceof AurumElement) {

break;
case 'remove':
for (const item of change.items) {
const rendered = this.renderItem(item, ac);
if (Array.isArray(rendered)) {
throw new Error('illegal state');
}
else {
this.children.unshift(rendered);
}
}
break;
case 'clear':
this.children.length = 0;
this.spliceChildren(0, this.children.length);
this.renderSessions = new WeakMap();

@@ -547,2 +541,14 @@ break;

exports.ArrayAurumElement = ArrayAurumElement;
function flattenIndex(source, index) {
let flatIndex = 0;
for (let i = 0; i < index; i++) {
if (Array.isArray(source[i])) {
flatIndex += flattenIndex(source[i], source[i].length);
}
else {
flatIndex++;
}
}
return flatIndex;
}
class SingularAurumElement extends AurumElement {

@@ -549,0 +555,0 @@ constructor(dataSource, api) {

@@ -120,2 +120,5 @@ "use strict";

delete(key) {
if (!this.has(key)) {
return;
}
const old = this.data.get(key);

@@ -122,0 +125,0 @@ this.data.delete(key);

@@ -69,3 +69,3 @@ import { CancellationToken } from '../aurumjs';

}));
this.synchedDataSources.get(id).set(id, [{ source: dataSource, token: cancellation }]);
this.synchedDataSources.get(id).set(authenticationToken, [{ source: dataSource, token: cancellation }]);
}

@@ -98,3 +98,3 @@ else {

}));
this.synchedArrayDataSources.get(id).set(id, [{ source: dataSource, token: cancellation }]);
this.synchedArrayDataSources.get(id).set(authenticationToken, [{ source: dataSource, token: cancellation }]);
}

@@ -135,3 +135,3 @@ else {

}));
this.synchedDuplexDataSources.get(id).set(id, [{ source: dataSource, token: cancellation }]);
this.synchedDuplexDataSources.get(id).set(authenticationToken, [{ source: dataSource, token: cancellation }]);
}

@@ -145,3 +145,4 @@ else {

let started = false;
let latency = 0;
let latency = [0, 0, 0, 0];
let cycle = 0;
let latencyTs;

@@ -177,4 +178,10 @@ let lastBeat;

case RemoteProtocol.HEARTBEAT:
latency = Date.now() - latencyTs;
console.log(`AurumServer latency: ${latency}ms`);
latency[cycle] = Date.now() - latencyTs;
if ((cycle + 1) % latency.length === 0) {
console.log(`AurumServer latency: ${(latency.reduce((p, c) => p + c) / latency.length).toFixed(1)}ms`);
cycle = 0;
}
else {
cycle++;
}
break;

@@ -181,0 +188,0 @@ case RemoteProtocol.UPDATE_DATASOURCE:

@@ -19,3 +19,4 @@ export * from './rendering/webcomponent';

export * from './utilities/event_emitter';
export * from './rendering/classname';
export * from './utilities/classname';
export * from './utilities/sources';
export * from './stream/emitters';

@@ -22,0 +23,0 @@ export * from './nodes/string_adapter';

@@ -19,3 +19,4 @@ export * from './rendering/webcomponent';

export * from './utilities/event_emitter';
export * from './rendering/classname';
export * from './utilities/classname';
export * from './utilities/sources';
export * from './stream/emitters';

@@ -22,0 +23,0 @@ export * from './nodes/string_adapter';

@@ -15,2 +15,3 @@ import { ClassType, DataDrain, Callback, MapLike, AttributeValue } from '../utilities/common';

contentEditable?: AttributeValue;
onContextMenu?: DataDrain<MouseEvent>;
onDblClick?: DataDrain<MouseEvent>;

@@ -17,0 +18,0 @@ onClick?: DataDrain<MouseEvent>;

@@ -23,2 +23,3 @@ import { DataSource } from '../stream/data_source';

keyup: 'onKeyUp',
contextmenu: 'onContextMenu',
mousedown: 'onMouseDown',

@@ -25,0 +26,0 @@ mouseup: 'onMouseUp',

@@ -6,3 +6,3 @@ import { AurumComponentAPI, Renderable } from '../rendering/aurum_element';

}
export declare function Suspense(props: SuspenseProps, children: Renderable[], api: AurumComponentAPI): DataSource<Renderable | Renderable[]>;
export declare function Suspense(props: SuspenseProps, children: Renderable[], api: AurumComponentAPI): any[] | DataSource<Renderable | Renderable[]>;
//# sourceMappingURL=suspense.d.ts.map
import { createLifeCycle } from '../rendering/aurum_element';
import { DataSource } from '../stream/data_source';
export function Suspense(props, children, api) {
const data = new DataSource(props?.fallback);
const lc = createLifeCycle();

@@ -9,16 +8,23 @@ api.onDetach(() => {

});
Promise.all(api.prerender(children, lc)).then(function result(res) {
if (res instanceof Promise) {
res.then(result, onError);
}
else {
const nestedRendered = api.prerender(res, lc);
if (nestedRendered.some((s) => s instanceof Promise)) {
Promise.all(nestedRendered).then(result, onError);
const rendered = api.prerender(children, lc);
if (rendered.some((r) => r instanceof Promise)) {
Promise.all(api.prerender(children, lc)).then(function result(res) {
if (res instanceof Promise) {
res.then(result, onError);
}
else {
onDone(nestedRendered);
const nestedRendered = api.prerender(res, lc);
if (nestedRendered.some((s) => s instanceof Promise)) {
Promise.all(nestedRendered).then(result, onError);
}
else {
onDone(nestedRendered);
}
}
}
}, onError);
}, onError);
}
else {
return rendered;
}
const data = new DataSource(props?.fallback);
return data;

@@ -25,0 +31,0 @@ function onDone(res) {

@@ -21,5 +21,3 @@ import { createAPI } from '../rendering/aurum_element';

return content
.toString()
.replace('<', '&lt;')
.replace('>', '&gt;');
.toString();
}

@@ -26,0 +24,0 @@ else if (content instanceof DataSource) {

@@ -6,3 +6,3 @@ import { diagnosticMode } from '../debug_mode';

import { EventEmitter } from '../utilities/event_emitter';
import { aurumClassName } from './classname';
import { aurumClassName } from '../utilities/classname';
export function createRenderSession() {

@@ -113,2 +113,6 @@ const session = {

//@ts-ignore
if (this.hostNode.childNodes[workIndex].owner.disposed) {
break;
}
//@ts-ignore
this.hostNode.childNodes[workIndex].owner.dispose();

@@ -359,3 +363,3 @@ }

for (const item of removed) {
this.renderSessions.get(item).sessionToken.cancel();
this.renderSessions.get(item)?.sessionToken.cancel();
}

@@ -402,3 +406,3 @@ }

case 'removeRight':
this.spliceChildren(change.index, change.count);
this.spliceChildren(flattenIndex(change.newState, change.index), flattenIndex(change.items, change.items.length));
break;

@@ -412,3 +416,3 @@ case 'append':

this.children = this.children.concat(rendered);
for (let i = rendered.length - 1; i >= 0; i--) {
for (let i = 0; i <= rendered.length; i++) {
if (rendered[i]) {

@@ -492,15 +496,4 @@ if (rendered[i] instanceof AurumElement) {

break;
case 'remove':
for (const item of change.items) {
const rendered = this.renderItem(item, ac);
if (Array.isArray(rendered)) {
throw new Error('illegal state');
}
else {
this.children.unshift(rendered);
}
}
break;
case 'clear':
this.children.length = 0;
this.spliceChildren(0, this.children.length);
this.renderSessions = new WeakMap();

@@ -535,2 +528,14 @@ break;

}
function flattenIndex(source, index) {
let flatIndex = 0;
for (let i = 0; i < index; i++) {
if (Array.isArray(source[i])) {
flatIndex += flattenIndex(source[i], source[i].length);
}
else {
flatIndex++;
}
}
return flatIndex;
}
export class SingularAurumElement extends AurumElement {

@@ -537,0 +542,0 @@ constructor(dataSource, api) {

@@ -117,2 +117,5 @@ import { ArrayDataSource, DataSource } from './data_source';

delete(key) {
if (!this.has(key)) {
return;
}
const old = this.data.get(key);

@@ -119,0 +122,0 @@ this.data.delete(key);

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

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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