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.8.1 to 0.8.2

test/data_sources/utils.ts

2

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

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

export * from './rendering/webcomponent.js';
export * from './rendering/aurum_element.js';
export { Renderable, AurumComponentAPI, ComponentLifeCycle, createAPI, createLifeCycle, createRenderSession, RenderSession } from './rendering/aurum_element.js';
export * from './rendering/aurum_style.js';

@@ -24,2 +24,3 @@ export * from './builtin_components/router.js';

export * from './utilities/transclusion.js';
export { aurumToHTML } from './builtin_components/dom_adapter.js';
export { debugMode, enableDebugMode, enableDiagnosticMode } from './debug_mode.js';

@@ -26,0 +27,0 @@ export { AttributeValue, ClassType, DataDrain } from './utilities/common.js';

@@ -13,5 +13,8 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.RemoteProtocol = exports.enableDiagnosticMode = exports.enableDebugMode = exports.debugMode = void 0;
exports.RemoteProtocol = exports.enableDiagnosticMode = exports.enableDebugMode = exports.debugMode = exports.aurumToHTML = exports.createRenderSession = exports.createLifeCycle = exports.createAPI = void 0;
__exportStar(require("./rendering/webcomponent.js"), exports);
__exportStar(require("./rendering/aurum_element.js"), exports);
var aurum_element_js_1 = require("./rendering/aurum_element.js");
Object.defineProperty(exports, "createAPI", { enumerable: true, get: function () { return aurum_element_js_1.createAPI; } });
Object.defineProperty(exports, "createLifeCycle", { enumerable: true, get: function () { return aurum_element_js_1.createLifeCycle; } });
Object.defineProperty(exports, "createRenderSession", { enumerable: true, get: function () { return aurum_element_js_1.createRenderSession; } });
__exportStar(require("./rendering/aurum_style.js"), exports);

@@ -38,2 +41,4 @@ __exportStar(require("./builtin_components/router.js"), exports);

__exportStar(require("./utilities/transclusion.js"), exports);
var dom_adapter_js_1 = require("./builtin_components/dom_adapter.js");
Object.defineProperty(exports, "aurumToHTML", { enumerable: true, get: function () { return dom_adapter_js_1.aurumToHTML; } });
var debug_mode_js_1 = require("./debug_mode.js");

@@ -40,0 +45,0 @@ Object.defineProperty(exports, "debugMode", { enumerable: true, get: function () { return debug_mode_js_1.debugMode; } });

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

export declare function createEventHandlers(node: HTMLElement, events: MapLike<string>, props: any): void;
/**
* Renders Aurum content synchronously in line.
* @param content Content to render
*/
export declare function aurumToHTML(content: Renderable): {
content: HTMLElement;
fireOnAttach(): void;
dispose(): void;
};
//# sourceMappingURL=dom_adapter.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createEventHandlers = exports.processHTMLNode = exports.DomNodeCreator = exports.defaultAttributes = exports.defaultEvents = void 0;
exports.aurumToHTML = exports.createEventHandlers = exports.processHTMLNode = exports.DomNodeCreator = exports.defaultAttributes = exports.defaultEvents = void 0;
const data_source_js_1 = require("../stream/data_source.js");

@@ -48,3 +48,3 @@ const duplex_data_source_js_1 = require("../stream/duplex_data_source.js");

//@ts-ignore
const renderedChildren = (0, aurum_element_js_1.render)(children, api.renderSession);
const renderedChildren = (0, aurum_element_js_1.renderInternal)(children, api.renderSession);
connectChildren(node, renderedChildren);

@@ -136,2 +136,16 @@ if (props) {

}
/**
* Renders Aurum content synchronously in line.
* @param content Content to render
*/
function aurumToHTML(content) {
const rs = (0, aurum_element_js_1.createRenderSession)();
const renderedContent = (0, aurum_element_js_1.renderInternal)(content, rs);
return {
content: renderedContent,
fireOnAttach: () => rs.attachCalls.forEach((c) => c()),
dispose: () => rs.sessionToken.cancel()
};
}
exports.aurumToHTML = aurumToHTML;
function assignStringSourceToAttribute(node, data, key, cleanUp) {

@@ -138,0 +152,0 @@ if (typeof data === 'string') {

@@ -72,3 +72,3 @@ import { DataSource, ArrayDataSource, ReadOnlyDataSource, ReadOnlyArrayDataSource } from '../stream/data_source.js';

*/
export declare function render<T extends Renderable | Renderable[]>(element: T, session: RenderSession, prerendering?: boolean): any;
export declare function renderInternal<T extends Renderable | Renderable[]>(element: T, session: RenderSession, prerendering?: boolean): any;
/**

@@ -75,0 +75,0 @@ * @internal

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SingularAurumElement = exports.ArrayAurumElement = exports.createAPI = exports.render = exports.AurumElement = exports.createLifeCycle = exports.nodeData = exports.aurumElementModelIdentitiy = exports.createRenderSession = void 0;
exports.SingularAurumElement = exports.ArrayAurumElement = exports.createAPI = exports.renderInternal = exports.AurumElement = exports.createLifeCycle = exports.nodeData = exports.aurumElementModelIdentitiy = exports.createRenderSession = void 0;
const debug_mode_js_1 = require("../debug_mode.js");

@@ -206,3 +206,3 @@ const data_source_js_1 = require("../stream/data_source.js");

*/
function render(element, session, prerendering = false) {
function renderInternal(element, session, prerendering = false) {
var _a;

@@ -215,3 +215,3 @@ if (element == undefined) {

for (const item of element) {
const rendered = render(item, session, prerendering);
const rendered = renderInternal(item, session, prerendering);
// Flatten the rendered content into a single array to avoid having to iterate over nested arrays later

@@ -282,3 +282,3 @@ if (rendered !== undefined && rendered !== null) {

}
return render(componentResult, session, prerendering);
return renderInternal(componentResult, session, prerendering);
}

@@ -288,3 +288,3 @@ // Unsupported types are returned as is in hope that a transclusion component will transform it into something compatible

}
exports.render = render;
exports.renderInternal = renderInternal;
/**

@@ -321,3 +321,3 @@ * @internal

const subSession = createRenderSession();
const result = render(target, subSession, true);
const result = renderInternal(target, subSession, true);
lc.attach.subscribeOnce(() => {

@@ -539,3 +539,3 @@ subSession.attachCalls.forEach((cb) => cb());

const s = createRenderSession();
const rendered = render(item, s);
const rendered = renderInternal(item, s);
if (rendered === undefined || rendered === null) {

@@ -617,3 +617,3 @@ return;

this.renderSession = createRenderSession();
let rendered = render(newValue, this.renderSession);
let rendered = renderInternal(newValue, this.renderSession);
if (rendered === undefined) {

@@ -620,0 +620,0 @@ this.children = [];

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

const session = (0, aurum_element_js_1.createRenderSession)();
const content = (0, aurum_element_js_1.render)(aurumRenderable, session);
const content = (0, aurum_element_js_1.renderInternal)(aurumRenderable, session);
if (content instanceof aurum_element_js_1.AurumElement) {

@@ -106,0 +106,0 @@ content.attachToDom(dom, dom.childNodes.length);

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

import { ObjectDataSource } from '../aurumjs.js';
import { DataSource, ArrayDataSource } from '../stream/data_source.js';

@@ -6,2 +7,6 @@ import { DuplexDataSource } from '../stream/duplex_data_source.js';

export declare function getValueOf<T>(sourceOrPrimitive: T | DataSource<T> | DuplexDataSource<T> | Stream<T>): T;
export declare type UnwrapObjectRecursive<T> = T extends ArrayDataSource<infer U> ? UnwrapObjectRecursive<U[]> : T extends DataSource<infer U> ? UnwrapObjectRecursive<U> : T extends DuplexDataSource<infer U> ? UnwrapObjectRecursive<U> : T extends ObjectDataSource<infer U> ? UnwrapObjectRecursive<U> : T extends Stream<infer U> ? UnwrapObjectRecursive<U> : {
[K in keyof T]: T[K] extends DataSource<infer U> ? UnwrapObjectRecursive<U> : T[K] extends DuplexDataSource<infer U> ? UnwrapObjectRecursive<U> : T[K] extends Stream<infer U> ? UnwrapObjectRecursive<U> : T[K] extends ObjectDataSource<infer U> ? UnwrapObjectRecursive<U> : T[K] extends object ? UnwrapObjectRecursive<T[K]> : T[K];
};
export declare function unwrapObjectRecursive<T>(object: T): UnwrapObjectRecursive<T>;
//# sourceMappingURL=sources.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getValueOf = void 0;
exports.unwrapObjectRecursive = exports.getValueOf = void 0;
const aurumjs_js_1 = require("../aurumjs.js");
const data_source_js_1 = require("../stream/data_source.js");

@@ -17,2 +18,38 @@ const duplex_data_source_js_1 = require("../stream/duplex_data_source.js");

exports.getValueOf = getValueOf;
function unwrapObjectRecursive(object) {
if (object instanceof data_source_js_1.DataSource || object instanceof duplex_data_source_js_1.DuplexDataSource || object instanceof stream_js_1.Stream) {
//@ts-ignore
return unwrapObjectRecursive(object.value);
}
if (object instanceof data_source_js_1.ArrayDataSource) {
//@ts-ignore
return unwrapObjectRecursive(object.toArray());
}
if (object instanceof aurumjs_js_1.ObjectDataSource) {
//@ts-ignore
return unwrapObjectRecursive(object.getData());
}
if (object instanceof duplex_data_source_js_1.DuplexDataSource) {
//@ts-ignore
return unwrapObjectRecursive(object.value);
}
if (object instanceof stream_js_1.Stream) {
//@ts-ignore
return unwrapObjectRecursive(object.value);
}
if (Array.isArray(object)) {
//@ts-ignore
return object.map(unwrapObjectRecursive);
}
if (object instanceof Object) {
const result = {};
for (const key in object) {
result[key] = unwrapObjectRecursive(object[key]);
}
return result;
}
//@ts-ignore
return object;
}
exports.unwrapObjectRecursive = unwrapObjectRecursive;
//# sourceMappingURL=sources.js.map
export * from './rendering/webcomponent.js';
export * from './rendering/aurum_element.js';
export { Renderable, AurumComponentAPI, ComponentLifeCycle, createAPI, createLifeCycle, createRenderSession, RenderSession } from './rendering/aurum_element.js';
export * from './rendering/aurum_style.js';

@@ -24,2 +24,3 @@ export * from './builtin_components/router.js';

export * from './utilities/transclusion.js';
export { aurumToHTML } from './builtin_components/dom_adapter.js';
export { debugMode, enableDebugMode, enableDiagnosticMode } from './debug_mode.js';

@@ -26,0 +27,0 @@ export { AttributeValue, ClassType, DataDrain } from './utilities/common.js';

export * from './rendering/webcomponent.js';
export * from './rendering/aurum_element.js';
export { createAPI, createLifeCycle, createRenderSession } from './rendering/aurum_element.js';
export * from './rendering/aurum_style.js';

@@ -24,4 +24,5 @@ export * from './builtin_components/router.js';

export * from './utilities/transclusion.js';
export { aurumToHTML } from './builtin_components/dom_adapter.js';
export { debugMode, enableDebugMode, enableDiagnosticMode } from './debug_mode.js';
export { RemoteProtocol } from './aurum_server/aurum_server_client.js';
//# sourceMappingURL=aurumjs.js.map

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

export declare function createEventHandlers(node: HTMLElement, events: MapLike<string>, props: any): void;
/**
* Renders Aurum content synchronously in line.
* @param content Content to render
*/
export declare function aurumToHTML(content: Renderable): {
content: HTMLElement;
fireOnAttach(): void;
dispose(): void;
};
//# sourceMappingURL=dom_adapter.d.ts.map
import { DataSource } from '../stream/data_source.js';
import { DuplexDataSource } from '../stream/duplex_data_source.js';
import { AurumElement, render } from '../rendering/aurum_element.js';
import { AurumElement, renderInternal, createRenderSession } from '../rendering/aurum_element.js';
import { dsUnique } from '../stream/data_source_operators.js';

@@ -45,3 +45,3 @@ /**

//@ts-ignore
const renderedChildren = render(children, api.renderSession);
const renderedChildren = renderInternal(children, api.renderSession);
connectChildren(node, renderedChildren);

@@ -130,2 +130,15 @@ if (props) {

}
/**
* Renders Aurum content synchronously in line.
* @param content Content to render
*/
export function aurumToHTML(content) {
const rs = createRenderSession();
const renderedContent = renderInternal(content, rs);
return {
content: renderedContent,
fireOnAttach: () => rs.attachCalls.forEach((c) => c()),
dispose: () => rs.sessionToken.cancel()
};
}
function assignStringSourceToAttribute(node, data, key, cleanUp) {

@@ -132,0 +145,0 @@ if (typeof data === 'string') {

@@ -72,3 +72,3 @@ import { DataSource, ArrayDataSource, ReadOnlyDataSource, ReadOnlyArrayDataSource } from '../stream/data_source.js';

*/
export declare function render<T extends Renderable | Renderable[]>(element: T, session: RenderSession, prerendering?: boolean): any;
export declare function renderInternal<T extends Renderable | Renderable[]>(element: T, session: RenderSession, prerendering?: boolean): any;
/**

@@ -75,0 +75,0 @@ * @internal

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

*/
export function render(element, session, prerendering = false) {
export function renderInternal(element, session, prerendering = false) {
if (element == undefined) {

@@ -214,3 +214,3 @@ return undefined;

for (const item of element) {
const rendered = render(item, session, prerendering);
const rendered = renderInternal(item, session, prerendering);
// Flatten the rendered content into a single array to avoid having to iterate over nested arrays later

@@ -281,3 +281,3 @@ if (rendered !== undefined && rendered !== null) {

}
return render(componentResult, session, prerendering);
return renderInternal(componentResult, session, prerendering);
}

@@ -318,3 +318,3 @@ // Unsupported types are returned as is in hope that a transclusion component will transform it into something compatible

const subSession = createRenderSession();
const result = render(target, subSession, true);
const result = renderInternal(target, subSession, true);
lc.attach.subscribeOnce(() => {

@@ -536,3 +536,3 @@ subSession.attachCalls.forEach((cb) => cb());

const s = createRenderSession();
const rendered = render(item, s);
const rendered = renderInternal(item, s);
if (rendered === undefined || rendered === null) {

@@ -616,3 +616,3 @@ return;

this.renderSession = createRenderSession();
let rendered = render(newValue, this.renderSession);
let rendered = renderInternal(newValue, this.renderSession);
if (rendered === undefined) {

@@ -619,0 +619,0 @@ this.children = [];

@@ -5,3 +5,3 @@ import { Input } from '../nodes/input.js';

import { TextArea } from '../nodes/textarea.js';
import { ArrayAurumElement, AurumElement, aurumElementModelIdentitiy, createAPI, createRenderSession, render } from '../rendering/aurum_element.js';
import { ArrayAurumElement, AurumElement, aurumElementModelIdentitiy, createAPI, createRenderSession, renderInternal } from '../rendering/aurum_element.js';
import { ArrayDataSource } from '../stream/data_source.js';

@@ -101,3 +101,3 @@ const nodeMap = {

const session = createRenderSession();
const content = render(aurumRenderable, session);
const content = renderInternal(aurumRenderable, session);
if (content instanceof AurumElement) {

@@ -104,0 +104,0 @@ content.attachToDom(dom, dom.childNodes.length);

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

import { ObjectDataSource } from '../aurumjs.js';
import { DataSource, ArrayDataSource } from '../stream/data_source.js';

@@ -6,2 +7,6 @@ import { DuplexDataSource } from '../stream/duplex_data_source.js';

export declare function getValueOf<T>(sourceOrPrimitive: T | DataSource<T> | DuplexDataSource<T> | Stream<T>): T;
export declare type UnwrapObjectRecursive<T> = T extends ArrayDataSource<infer U> ? UnwrapObjectRecursive<U[]> : T extends DataSource<infer U> ? UnwrapObjectRecursive<U> : T extends DuplexDataSource<infer U> ? UnwrapObjectRecursive<U> : T extends ObjectDataSource<infer U> ? UnwrapObjectRecursive<U> : T extends Stream<infer U> ? UnwrapObjectRecursive<U> : {
[K in keyof T]: T[K] extends DataSource<infer U> ? UnwrapObjectRecursive<U> : T[K] extends DuplexDataSource<infer U> ? UnwrapObjectRecursive<U> : T[K] extends Stream<infer U> ? UnwrapObjectRecursive<U> : T[K] extends ObjectDataSource<infer U> ? UnwrapObjectRecursive<U> : T[K] extends object ? UnwrapObjectRecursive<T[K]> : T[K];
};
export declare function unwrapObjectRecursive<T>(object: T): UnwrapObjectRecursive<T>;
//# sourceMappingURL=sources.d.ts.map

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

import { ObjectDataSource } from '../aurumjs.js';
import { DataSource, ArrayDataSource } from '../stream/data_source.js';

@@ -13,2 +14,37 @@ import { DuplexDataSource } from '../stream/duplex_data_source.js';

}
export function unwrapObjectRecursive(object) {
if (object instanceof DataSource || object instanceof DuplexDataSource || object instanceof Stream) {
//@ts-ignore
return unwrapObjectRecursive(object.value);
}
if (object instanceof ArrayDataSource) {
//@ts-ignore
return unwrapObjectRecursive(object.toArray());
}
if (object instanceof ObjectDataSource) {
//@ts-ignore
return unwrapObjectRecursive(object.getData());
}
if (object instanceof DuplexDataSource) {
//@ts-ignore
return unwrapObjectRecursive(object.value);
}
if (object instanceof Stream) {
//@ts-ignore
return unwrapObjectRecursive(object.value);
}
if (Array.isArray(object)) {
//@ts-ignore
return object.map(unwrapObjectRecursive);
}
if (object instanceof Object) {
const result = {};
for (const key in object) {
result[key] = unwrapObjectRecursive(object[key]);
}
return result;
}
//@ts-ignore
return object;
}
//# sourceMappingURL=sources.js.map

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

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