Comparing version 0.9.1 to 0.9.2
{ | ||
"name": "aurumjs", | ||
"version": "0.9.1", | ||
"version": "0.9.2", | ||
"main": "prebuilt/esnext/aurumjs.js", | ||
@@ -5,0 +5,0 @@ "typings": "prebuilt/esnext/aurumjs.d.ts", |
@@ -7,3 +7,3 @@ export * from './rendering/webcomponent.js'; | ||
export { TextAreaProps } from './nodes/textarea.js'; | ||
export * from './rendering/aurum_style.js'; | ||
export * from './nodes/string_adapter.js'; | ||
export * from './builtin_components/router.js'; | ||
@@ -21,2 +21,3 @@ export * from './builtin_components/suspense.js'; | ||
export * from './stream/stream.js'; | ||
export * from './stream/emitters.js'; | ||
export * from './utilities/aurum.js'; | ||
@@ -27,5 +28,5 @@ export * from './utilities/cancellation_token.js'; | ||
export * from './utilities/sources.js'; | ||
export * from './stream/emitters.js'; | ||
export * from './nodes/string_adapter.js'; | ||
export * from './utilities/transclusion.js'; | ||
export * from './utilities/storage_stream.js'; | ||
export * from './utilities/url_storage'; | ||
export { aurumToHTML } from './builtin_components/dom_adapter.js'; | ||
@@ -32,0 +33,0 @@ export { debugMode, enableDebugMode, enableDiagnosticMode } from './debug_mode.js'; |
export * from './rendering/webcomponent.js'; | ||
export { SingularAurumElement, ArrayAurumElement, createAPI, createLifeCycle, createRenderSession, AurumElement, aurumElementModelIdentitiy } from './rendering/aurum_element.js'; | ||
export * from './rendering/aurum_style.js'; | ||
export * from './nodes/string_adapter.js'; | ||
export * from './builtin_components/router.js'; | ||
@@ -16,2 +16,3 @@ export * from './builtin_components/suspense.js'; | ||
export * from './stream/stream.js'; | ||
export * from './stream/emitters.js'; | ||
export * from './utilities/aurum.js'; | ||
@@ -22,5 +23,5 @@ export * from './utilities/cancellation_token.js'; | ||
export * from './utilities/sources.js'; | ||
export * from './stream/emitters.js'; | ||
export * from './nodes/string_adapter.js'; | ||
export * from './utilities/transclusion.js'; | ||
export * from './utilities/storage_stream.js'; | ||
export * from './utilities/url_storage'; | ||
export { aurumToHTML } from './builtin_components/dom_adapter.js'; | ||
@@ -27,0 +28,0 @@ export { debugMode, enableDebugMode, enableDiagnosticMode } from './debug_mode.js'; |
@@ -53,6 +53,7 @@ import { ClassType, DataDrain, Callback, MapLike, AttributeValue, StyleType } from '../utilities/common.js'; | ||
/** | ||
* Renders Aurum content synchronously in line. | ||
* Renders Aurum content synchronously in line. In case no lifecycle sync object is provided you have to manually call fireOnAttach and dispose at the appropriate times to ensure proper lifecycle handling such as attach and detach events | ||
* @param content Content to render | ||
* @param syncLifecycle Optional lifecycle sync object. If provided the lifecycle of the rendered content will be synchronized with the provided lifecycle (meaning attach and detach events will be fired when the lifecycle fires them) | ||
*/ | ||
export declare function aurumToHTML(content: Renderable): { | ||
export declare function aurumToHTML(content: Renderable, syncLifecycle?: AurumComponentAPI): { | ||
content: HTMLElement; | ||
@@ -59,0 +60,0 @@ fireOnAttach(): void; |
@@ -138,8 +138,13 @@ import { ArrayDataSource, DataSource, MapDataSource } from '../stream/data_source.js'; | ||
/** | ||
* Renders Aurum content synchronously in line. | ||
* Renders Aurum content synchronously in line. In case no lifecycle sync object is provided you have to manually call fireOnAttach and dispose at the appropriate times to ensure proper lifecycle handling such as attach and detach events | ||
* @param content Content to render | ||
* @param syncLifecycle Optional lifecycle sync object. If provided the lifecycle of the rendered content will be synchronized with the provided lifecycle (meaning attach and detach events will be fired when the lifecycle fires them) | ||
*/ | ||
export function aurumToHTML(content) { | ||
export function aurumToHTML(content, syncLifecycle) { | ||
const rs = createRenderSession(); | ||
const renderedContent = renderInternal(content, rs); | ||
if (syncLifecycle) { | ||
syncLifecycle.onAttach(() => rs.attachCalls.forEach((c) => c())); | ||
syncLifecycle.onDetach(() => rs.sessionToken.cancel()); | ||
} | ||
return { | ||
@@ -146,0 +151,0 @@ content: renderedContent, |
@@ -62,5 +62,5 @@ import { createAPI } from '../rendering/aurum_element.js'; | ||
} | ||
return `<${item.name}${propString.trimRight()}>${children}</${item.name}>`; | ||
return `<${item.name}${propString.trimEnd()}>${children}</${item.name}>`; | ||
} | ||
} | ||
//# sourceMappingURL=string_adapter.js.map |
import { AurumComponentAPI, Renderable } from './aurum_element.js'; | ||
interface WebComponentProps { | ||
import { Constructor } from '../utilities/common.js'; | ||
interface WebComponentProps<Props> { | ||
/** | ||
@@ -11,5 +12,9 @@ * Name of the webcomponent, must be lower case kebab case and must have at least one hyphen as required by the spec | ||
*/ | ||
observedAttributes?: string[]; | ||
observedAttributes?: (keyof Props)[]; | ||
shadowRootMode?: 'open' | 'closed'; | ||
shadowRootDelegatesFocus?: boolean; | ||
/** | ||
* Base class of the web component, defaults to HTMLElement | ||
*/ | ||
baseClass?: Constructor<HTMLElement>; | ||
} | ||
@@ -19,4 +24,4 @@ /** | ||
*/ | ||
export declare function Webcomponent<T>(config: WebComponentProps, logic: (props: T, api: AurumComponentAPI) => Renderable): (props: T, children: Renderable[], api: AurumComponentAPI) => Renderable; | ||
export declare function Webcomponent<T>(config: WebComponentProps<T>, logic: (props: T, api: AurumComponentAPI) => Renderable): (props: T, children: Renderable[], api: AurumComponentAPI) => Renderable; | ||
export {}; | ||
//# sourceMappingURL=webcomponent.d.ts.map |
@@ -9,3 +9,4 @@ import { Aurum } from '../utilities/aurum.js'; | ||
export function Webcomponent(config, logic) { | ||
customElements.define(config.name, class extends HTMLElement { | ||
var _a; | ||
customElements.define(config.name, class extends ((_a = config.baseClass) !== null && _a !== void 0 ? _a : HTMLElement) { | ||
constructor() { | ||
@@ -12,0 +13,0 @@ super(); |
@@ -179,2 +179,3 @@ import { ThenArg, Callback } from '../utilities/common.js'; | ||
export declare function dsPipeAll<T>(...sources: Array<DataSource<T> | DuplexDataSource<T> | Stream<T, any>>): DataSourceNoopOperator<T>; | ||
export declare function dsAccumulate(initialValue: number): DataSourceMapOperator<number, number>; | ||
//# sourceMappingURL=data_source_operators.d.ts.map |
@@ -716,2 +716,13 @@ import { EventEmitter } from '../utilities/event_emitter.js'; | ||
} | ||
export function dsAccumulate(initialValue) { | ||
let sum = initialValue; | ||
return { | ||
name: `accumulate`, | ||
operationType: OperationType.MAP, | ||
operation: (v) => { | ||
sum += v; | ||
return sum; | ||
} | ||
}; | ||
} | ||
//# sourceMappingURL=data_source_operators.js.map |
@@ -709,2 +709,3 @@ import { AurumServerInfo } from '../aurum_server/aurum_server_client.js'; | ||
add(key: K): void; | ||
merge(newData: Set<K> | SetDataSource<K> | K[] | ArrayDataSource<K>): void; | ||
/** | ||
@@ -711,0 +712,0 @@ * Merge the key value pairs of an object into this object non recursively |
@@ -17,2 +17,3 @@ import { DataSourceOperator } from './operator_model.js'; | ||
private constructor(); | ||
static fromFunction<I, O>(func: (value: I) => O): Stream<I, O>; | ||
static fromFetchRaw(url: string): Stream<void | RequestInit, Promise<Response>>; | ||
@@ -19,0 +20,0 @@ static fromPreconnectedSources<I, O>(inputSource?: DataSource<I>, outputSource?: DataSource<O>): Stream<I, O>; |
@@ -17,2 +17,11 @@ import { CancellationToken } from '../utilities/cancellation_token.js'; | ||
constructor() { } | ||
static fromFunction(func) { | ||
const result = new Stream(); | ||
result.input = new DataSource(); | ||
result.output = new DataSource(); | ||
result.input.listen((value) => { | ||
result.output.update(func(value)); | ||
}); | ||
return result; | ||
} | ||
static fromFetchRaw(url) { | ||
@@ -19,0 +28,0 @@ const input = new DataSource(); |
import { ObjectDataSource } from '../aurumjs.js'; | ||
import { DataSource, ArrayDataSource } from '../stream/data_source.js'; | ||
import { DataSource, ArrayDataSource, MapDataSource } from '../stream/data_source.js'; | ||
import { DuplexDataSource } from '../stream/duplex_data_source.js'; | ||
import { Stream } from '../stream/stream.js'; | ||
export declare function getValueOf<T>(sourceOrPrimitive: T[] | ArrayDataSource<T>): ReadonlyArray<T>; | ||
export declare function getValueOf<T>(sourceOrPrimitive: T | DataSource<T> | DuplexDataSource<T> | Stream<T>): T; | ||
export type Data<T> = T | DataSource<T>; | ||
export type DataArray<T> = T[] | ArrayDataSource<T>; | ||
export type DataObject<T> = T | ObjectDataSource<T>; | ||
export type DataMap<T> = Map<string, T> | MapDataSource<string, T>; | ||
export declare function getValueOf<T>(sourceOrPrimitive: DataArray<T>): ReadonlyArray<T>; | ||
export declare function getValueOf<T>(sourceOrPrimitive: Data<T> | DuplexDataSource<T> | Stream<T>): T; | ||
export 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> : { | ||
@@ -8,0 +12,0 @@ [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]; |
@@ -53,4 +53,4 @@ export * from './rendering/webcomponent.js'; | ||
export { TextAreaProps } from './nodes/textarea.js'; | ||
export * from './nodes/string_adapter.js'; | ||
export * from './rendering/aurum_style.js'; | ||
export * from './builtin_components/router.js'; | ||
@@ -68,2 +68,4 @@ export * from './builtin_components/suspense.js'; | ||
export * from './stream/stream.js'; | ||
export * from './stream/emitters.js'; | ||
export * from './utilities/aurum.js'; | ||
@@ -74,9 +76,9 @@ export * from './utilities/cancellation_token.js'; | ||
export * from './utilities/sources.js'; | ||
export * from './stream/emitters.js'; | ||
export * from './nodes/string_adapter.js'; | ||
export * from './utilities/transclusion.js'; | ||
export * from './utilities/storage_stream.js'; | ||
export * from './utilities/url_storage'; | ||
export { aurumToHTML } from './builtin_components/dom_adapter.js'; | ||
export { debugMode, enableDebugMode, enableDiagnosticMode } from './debug_mode.js'; | ||
export { AttributeValue, ClassType, StyleType, DataDrain, StringSource } from './utilities/common.js'; | ||
export { RemoteProtocol, getRemoteFunction } from './aurum_server/aurum_server_client.js'; |
@@ -203,8 +203,15 @@ import { StringSource, ClassType, DataDrain, Callback, MapLike, AttributeValue, StyleType } from '../utilities/common.js'; | ||
/** | ||
* Renders Aurum content synchronously in line. | ||
* Renders Aurum content synchronously in line. In case no lifecycle sync object is provided you have to manually call fireOnAttach and dispose at the appropriate times to ensure proper lifecycle handling such as attach and detach events | ||
* @param content Content to render | ||
* @param syncLifecycle Optional lifecycle sync object. If provided the lifecycle of the rendered content will be synchronized with the provided lifecycle (meaning attach and detach events will be fired when the lifecycle fires them) | ||
*/ | ||
export function aurumToHTML(content: Renderable): { content: HTMLElement; fireOnAttach(): void; dispose(): void } { | ||
export function aurumToHTML(content: Renderable, syncLifecycle?: AurumComponentAPI): { content: HTMLElement; fireOnAttach(): void; dispose(): void } { | ||
const rs = createRenderSession(); | ||
const renderedContent = renderInternal(content, rs); | ||
if (syncLifecycle) { | ||
syncLifecycle.onAttach(() => rs.attachCalls.forEach((c) => c())); | ||
syncLifecycle.onDetach(() => rs.sessionToken.cancel()); | ||
} | ||
return { | ||
@@ -211,0 +218,0 @@ content: renderedContent, |
@@ -80,4 +80,4 @@ import { AurumElementModel, createAPI } from '../rendering/aurum_element.js'; | ||
} | ||
return `<${item.name}${propString.trimRight()}>${children}</${item.name}>`; | ||
return `<${item.name}${propString.trimEnd()}>${children}</${item.name}>`; | ||
} | ||
} |
@@ -5,4 +5,5 @@ import { Aurum } from '../utilities/aurum.js'; | ||
import { DomNodeCreator } from '../builtin_components/dom_adapter.js'; | ||
import { Constructor } from '../utilities/common.js'; | ||
interface WebComponentProps { | ||
interface WebComponentProps<Props> { | ||
/** | ||
@@ -16,5 +17,9 @@ * Name of the webcomponent, must be lower case kebab case and must have at least one hyphen as required by the spec | ||
*/ | ||
observedAttributes?: string[]; | ||
observedAttributes?: (keyof Props)[]; | ||
shadowRootMode?: 'open' | 'closed'; | ||
shadowRootDelegatesFocus?: boolean; | ||
/** | ||
* Base class of the web component, defaults to HTMLElement | ||
*/ | ||
baseClass?: Constructor<HTMLElement>; | ||
} | ||
@@ -26,3 +31,3 @@ | ||
export function Webcomponent<T>( | ||
config: WebComponentProps, | ||
config: WebComponentProps<T>, | ||
logic: (props: T, api: AurumComponentAPI) => Renderable | ||
@@ -32,3 +37,3 @@ ): (props: T, children: Renderable[], api: AurumComponentAPI) => Renderable { | ||
config.name, | ||
class extends HTMLElement { | ||
class extends (config.baseClass ?? HTMLElement) { | ||
private api: AurumComponentAPI; | ||
@@ -83,3 +88,3 @@ private session: RenderSession; | ||
return DomNodeCreator(config.name, config.observedAttributes, undefined, (node, props) => { | ||
return DomNodeCreator(config.name, config.observedAttributes as string[], undefined, (node, props) => { | ||
for (const key in props) { | ||
@@ -86,0 +91,0 @@ //@ts-ignore |
@@ -763,1 +763,13 @@ import { ThenArg, Callback } from '../utilities/common.js'; | ||
} | ||
export function dsAccumulate(initialValue: number): DataSourceMapOperator<number, number> { | ||
let sum = initialValue; | ||
return { | ||
name: `accumulate`, | ||
operationType: OperationType.MAP, | ||
operation: (v) => { | ||
sum += v; | ||
return sum; | ||
} | ||
}; | ||
} |
@@ -24,2 +24,14 @@ import { DataSourceOperator } from './operator_model.js'; | ||
public static fromFunction<I, O>(func: (value: I) => O): Stream<I, O> { | ||
const result = new Stream<I, O>(); | ||
result.input = new DataSource<I>(); | ||
result.output = new DataSource<O>(); | ||
result.input.listen((value) => { | ||
result.output.update(func(value)); | ||
}); | ||
return result; | ||
} | ||
public static fromFetchRaw(url: string): Stream<void | RequestInit, Promise<Response>> { | ||
@@ -26,0 +38,0 @@ const input = new DataSource<void | RequestInit>(); |
import { ObjectDataSource } from '../aurumjs.js'; | ||
import { DataSource, ArrayDataSource } from '../stream/data_source.js'; | ||
import { DataSource, ArrayDataSource, MapDataSource } from '../stream/data_source.js'; | ||
import { DuplexDataSource } from '../stream/duplex_data_source.js'; | ||
import { Stream } from '../stream/stream.js'; | ||
export function getValueOf<T>(sourceOrPrimitive: T[] | ArrayDataSource<T>): ReadonlyArray<T>; | ||
export function getValueOf<T>(sourceOrPrimitive: T | DataSource<T> | DuplexDataSource<T> | Stream<T>): T; | ||
export function getValueOf<T>(sourceOrPrimitive: T | T[] | DataSource<T> | DuplexDataSource<T> | Stream<T> | ArrayDataSource<T>): T | ReadonlyArray<T> { | ||
export type Data<T> = T | DataSource<T>; | ||
export type DataArray<T> = T[] | ArrayDataSource<T>; | ||
export type DataObject<T> = T | ObjectDataSource<T>; | ||
export type DataMap<T> = Map<string, T> | MapDataSource<string, T>; | ||
export function getValueOf<T>(sourceOrPrimitive: DataArray<T>): ReadonlyArray<T>; | ||
export function getValueOf<T>(sourceOrPrimitive: Data<T> | DuplexDataSource<T> | Stream<T>): T; | ||
export function getValueOf<T>(sourceOrPrimitive: Data<T> | DataArray<T> | DuplexDataSource<T> | Stream<T>): T | ReadonlyArray<T> { | ||
if (sourceOrPrimitive instanceof DataSource || sourceOrPrimitive instanceof DuplexDataSource || sourceOrPrimitive instanceof Stream) { | ||
@@ -10,0 +15,0 @@ return sourceOrPrimitive.value; |
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 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 too big to display
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
2371188
201
36000