New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jaxs

Package Overview
Dependencies
Maintainers
0
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jaxs - npm Package Compare versions

Comparing version 0.6.0 to 0.6.2

1507

dist/jaxs.d.ts

@@ -1,671 +0,944 @@

declare module "state/is" {
export const isBoolean: (value: any) => value is boolean;
export const isNumber: (value: any) => value is number;
export const isString: (value: any) => value is string;
export const isArray: (value: any) => value is any[];
export const isObject: (value: any) => boolean;
declare module 'state/is' {
export const isBoolean: (value: any) => value is boolean
export const isNumber: (value: any) => value is number
export const isString: (value: any) => value is string
export const isArray: (value: any) => value is any[]
export const isObject: (value: any) => boolean
}
declare module "state/equality" {
type Object = Record<string, any>;
export const areElementsEqual: (oldValue: any, newValue: any) => boolean;
export const areObjectsEqual: (oldValue: Object, newValue: Object) => any;
export const areArraysEqual: (oldValue: any[], newValue: any[]) => any;
export const areEqual: (oldValue: any, newValue: any) => any;
declare module 'state/equality' {
type Object = Record<string, any>
export const areElementsEqual: (oldValue: any, newValue: any) => boolean
export const areObjectsEqual: (oldValue: Object, newValue: Object) => any
export const areArraysEqual: (oldValue: any[], newValue: any[]) => any
export const areEqual: (oldValue: any, newValue: any) => any
}
declare module "state/store" {
import type { State, StoreInitializationOptions, StoreUpdaterOrValue, StoreUpdater } from "types";
export class Store<T> {
parent: State;
name: string;
updater: StoreUpdater<T>;
_value: T;
initialValue: T;
constructor(options: StoreInitializationOptions<T>);
get ['value'](): T;
set ['value'](value: T);
reset(): void;
update(updater: StoreUpdaterOrValue<T>): void;
private updateValue;
private getUpdatedValue;
}
declare module 'state/store' {
import type {
State,
StoreInitializationOptions,
StoreUpdaterOrValue,
StoreUpdater,
} from 'types'
export class Store<T> {
parent: State
name: string
updater: StoreUpdater<T>
_value: T
initialValue: T
constructor(options: StoreInitializationOptions<T>)
get ['value'](): T
set ['value'](value: T)
reset(): void
update(updater: StoreUpdaterOrValue<T>): void
private updateValue
private getUpdatedValue
}
}
declare module "state/store-updater" {
import type { Store, StoreUpdaterOrValue } from "types";
export class StoreUpdaterBase<T> {
store: Store<T>;
constructor(store: Store<T>);
update(updater: StoreUpdaterOrValue<T>): void;
reset(): void;
get value(): T;
}
declare module 'state/store-updater' {
import type { Store, StoreUpdaterOrValue } from 'types'
export class StoreUpdaterBase<T> {
store: Store<T>
constructor(store: Store<T>)
update(updater: StoreUpdaterOrValue<T>): void
reset(): void
get value(): T
}
}
declare module "state/updaters/boolean" {
import { Store } from "types";
import { StoreUpdaterBase } from "state/store-updater";
export class StoreUpdaterBoolean extends StoreUpdaterBase<boolean> {
toggle(): void;
setTrue(): void;
setFalse(): void;
}
export const booleanUpdater: (store: Store<boolean>) => StoreUpdaterBoolean;
declare module 'state/updaters/object' {
import { Store } from 'types'
import { StoreUpdaterBase } from 'state/store-updater'
export class StoreUpdaterObject<T> extends StoreUpdaterBase<T> {
updateAttribute(name: keyof T, value: T[keyof T]): void
resetAttribute(name: keyof T): void
}
export const objectUpdater: <T>(store: Store<T>) => StoreUpdaterObject<T>
}
declare module "state/updaters/list" {
import { StoreListSorterFunction, Store } from "types";
import { StoreUpdaterBase } from "state/store-updater";
export class StoreUpdaterList<T> extends StoreUpdaterBase<T[]> {
push(element: T): void;
pop(): T;
unshift(element: T): void;
shift(): T;
addSorter(name: string, sorter: StoreListSorterFunction<T>): void;
sortBy(sorter: StoreListSorterFunction<T>): void;
insertAt(index: number, item: T): void;
remove(value: T): void;
removeBy(matcherFunction: (value: T) => boolean): void;
}
export const listUpdater: <T>(store: Store<T[]>) => StoreUpdaterList<T>;
declare module 'state/updaters/list' {
import { StoreListSorterFunction, Store } from 'types'
import { StoreUpdaterBase } from 'state/store-updater'
export class StoreUpdaterList<T> extends StoreUpdaterBase<T[]> {
push(element: T): void
pop(): T
unshift(element: T): void
shift(): T
addSorter(name: string, sorter: StoreListSorterFunction<T>): void
sortBy(sorter: StoreListSorterFunction<T>): void
insertAt(index: number, item: T): void
remove(value: T): void
removeBy(matcherFunction: (value: T) => boolean): void
}
export const listUpdater: <T>(store: Store<T[]>) => StoreUpdaterList<T>
}
declare module "state/updaters/object" {
import { Store } from "types";
import { StoreUpdaterBase } from "state/store-updater";
export class StoreUpdaterObject<T> extends StoreUpdaterBase<T> {
updateAttribute(name: keyof T, value: T[keyof T]): void;
resetAttribute(name: keyof T): void;
}
export const objectUpdater: <T>(store: Store<T>) => StoreUpdaterObject<T>;
declare module 'state/updaters/boolean' {
import { Store } from 'types'
import { StoreUpdaterBase } from 'state/store-updater'
export class StoreUpdaterBoolean extends StoreUpdaterBase<boolean> {
toggle(): void
setTrue(): void
setFalse(): void
}
export const booleanUpdater: (store: Store<boolean>) => StoreUpdaterBoolean
}
declare module "state/updaters" {
export const updaters: {
object: <T>(store: import("state").Store<T>) => import("state/updaters/object").StoreUpdaterObject<T>;
list: <T>(store: import("state").Store<T[]>) => import("state/updaters/list").StoreUpdaterList<T>;
boolean: (store: import("state").Store<boolean>) => import("state/updaters/boolean").StoreUpdaterBoolean;
};
declare module 'state/updaters' {
export const updaters: {
object: <T>(
store: import('state').Store<T>,
) => import('state/updaters/object').StoreUpdaterObject<T>
list: <T>(
store: import('state').Store<T[]>,
) => import('state/updaters/list').StoreUpdaterList<T>
boolean: (
store: import('state').Store<boolean>,
) => import('state/updaters/boolean').StoreUpdaterBoolean
}
}
declare module "state/index" {
import { Store } from "state/store";
import type { StatePublisher, StateTransactionUpdater, StoresCollection } from "types";
import { updaters } from "state/updaters";
export const eventName = "state";
export class State {
publisher: StatePublisher;
stores: StoresCollection;
eventNamePrefix: string;
notifications: Set<string>;
inTransaction: boolean;
constructor(publisher: StatePublisher);
create<T>(name: string, initialState: T): Store<T>;
createBoolean(name: string, initialState: boolean): Store<boolean>;
createRecord<T>(name: string, initialState: T): Store<T>;
createList<T>(name: string, initialState: T[]): Store<T[]>;
store<T>(name: string): Store<T>;
get<T>(name: string): T;
getAll(names: string[]): {};
notify(name: string): void;
update(name: string, newValue: any): void;
transaction(updater: StateTransactionUpdater): void;
publishAll(): void;
publish(name: string): void;
event(name: string): string;
}
export const createState: (publisher: StatePublisher) => State;
export { Store, updaters };
declare module 'state/index' {
import { Store } from 'state/store'
import type {
StatePublisher,
StateTransactionUpdater,
StoresCollection,
} from 'types'
import { updaters } from 'state/updaters'
export const eventName = 'state'
export class State {
publisher: StatePublisher
stores: StoresCollection
eventNamePrefix: string
notifications: Set<string>
inTransaction: boolean
constructor(publisher: StatePublisher)
create<T>(name: string, initialState: T): Store<T>
store<T>(name: string): Store<T>
get<T>(name: string): T
getAll(names: string[]): {}
notify(name: string): void
update(name: string, newValue: any): void
transaction(updater: StateTransactionUpdater): void
publishAll(): void
publish(name: string): void
event(name: string): string
}
export const createState: (publisher: StatePublisher) => State
export { Store, updaters }
}
declare module "bus/exact-subscriptions" {
import { ExactSubscriptionData, BusListener, Unsubscribe } from "types";
export class ExactSubscriptions {
lookup: Record<string, ExactSubscriptionData<any>[]>;
constructor();
add<T>(matcher: string, listener: BusListener<T>, index: number): Unsubscribe;
remove<T>(subscription: ExactSubscriptionData<T>): void;
matches(event: string): ExactSubscriptionData<any>[];
ensureArrayFor(matcher: string): void;
}
declare module 'bus/exact-subscriptions' {
import { ExactSubscriptionData, BusListener, Unsubscribe } from 'types'
export class ExactSubscriptions {
lookup: Record<string, ExactSubscriptionData<any>[]>
constructor()
add<T>(
matcher: string,
listener: BusListener<T>,
index: number,
): Unsubscribe
remove<T>(subscription: ExactSubscriptionData<T>): void
matches(event: string): ExactSubscriptionData<any>[]
ensureArrayFor(matcher: string): void
}
}
declare module "bus/fuzzy-subscriptions" {
import { FuzzySubscriptionData, BusListener, Unsubscribe } from "types";
export class FuzzySubscriptions {
lookup: FuzzySubscriptionData<any>[];
constructor();
add<T>(matcher: RegExp, listener: BusListener<T>, index: number): Unsubscribe;
remove<T>(subscription: FuzzySubscriptionData<T>): void;
matches(event: string): FuzzySubscriptionData<any>[];
}
declare module 'bus/fuzzy-subscriptions' {
import { FuzzySubscriptionData, BusListener, Unsubscribe } from 'types'
export class FuzzySubscriptions {
lookup: FuzzySubscriptionData<any>[]
constructor()
add<T>(
matcher: RegExp,
listener: BusListener<T>,
index: number,
): Unsubscribe
remove<T>(subscription: FuzzySubscriptionData<T>): void
matches(event: string): FuzzySubscriptionData<any>[]
}
}
declare module "bus/index" {
import { BusEventMatcher, BusListener, Unsubscribe, AppAdditionListenerOptions, ListenerKit } from "types";
import { ExactSubscriptions } from "bus/exact-subscriptions";
import { FuzzySubscriptions } from "bus/fuzzy-subscriptions";
class JaxsBus {
options?: AppAdditionListenerOptions;
exactSubscriptions: ExactSubscriptions;
fuzzySubscriptions: FuzzySubscriptions;
currentIndex: number;
constructor();
subscribe<T>(matcher: BusEventMatcher, listener: BusListener<T>): Unsubscribe;
publish<T>(event: string, payload: T): void;
addListenerOptions(options: AppAdditionListenerOptions): void;
listenerOptions(event: string): ListenerKit;
}
const createBus: () => {
bus: JaxsBus;
publish: (event: string, payload: any) => void;
subscribe: (matcher: BusEventMatcher, listener: BusListener<any>) => Unsubscribe;
};
export { createBus, JaxsBus, ExactSubscriptions, FuzzySubscriptions };
declare module 'bus/index' {
import {
BusEventMatcher,
BusListener,
Unsubscribe,
AppAdditionListenerOptions,
ListenerKit,
} from 'types'
import { ExactSubscriptions } from 'bus/exact-subscriptions'
import { FuzzySubscriptions } from 'bus/fuzzy-subscriptions'
class JaxsBus {
options?: AppAdditionListenerOptions
exactSubscriptions: ExactSubscriptions
fuzzySubscriptions: FuzzySubscriptions
currentIndex: number
constructor()
subscribe<T>(
matcher: BusEventMatcher,
listener: BusListener<T>,
): Unsubscribe
publish<T>(event: string, payload: T): void
addListenerOptions(options: AppAdditionListenerOptions): void
listenerOptions(event: string): ListenerKit
}
const createBus: () => {
bus: JaxsBus
publish: (event: string, payload: any) => void
subscribe: (
matcher: BusEventMatcher,
listener: BusListener<any>,
) => Unsubscribe
}
export { createBus, JaxsBus, ExactSubscriptions, FuzzySubscriptions }
}
declare module "rendering/templates/root" {
import type { JaxsElement, JaxsNodes, RenderKit, Renderable, JaxsNode } from "types";
export class Root {
template: Renderable;
selector: string;
renderKit: RenderKit;
dom: JaxsNodes;
parentElement?: JaxsElement | null;
constructor(template: Renderable, selector: string, renderKit: RenderKit);
renderAndAttach(renderKit: RenderKit): void;
render(renderKit: RenderKit): JaxsNode[];
attach(): void;
getParentElement(): Element;
}
export const render: (template: Renderable, selector: string, renderKit: RenderKit) => Root;
declare module 'rendering/templates/root' {
import type {
JaxsElement,
JaxsNodes,
RenderKit,
Renderable,
JaxsNode,
} from 'types'
export class Root {
template: Renderable
selector: string
renderKit: RenderKit
dom: JaxsNodes
parentElement?: JaxsElement | null
constructor(template: Renderable, selector: string, renderKit: RenderKit)
renderAndAttach(renderKit: RenderKit): void
render(renderKit: RenderKit): JaxsNode[]
attach(): void
getParentElement(): Element
}
export const render: (
template: Renderable,
selector: string,
renderKit: RenderKit,
) => Root
}
declare module "navigation/events" {
export const linkNavigationEvent = "go-to-href";
export const locationChangeEvent = "navigation:location-change";
export const routeChangeEvent = "navigation:route-change";
declare module 'navigation/events' {
export const linkNavigationEvent = 'go-to-href'
export const navigationEvent = 'go-to'
export const locationChangeEvent = 'navigation:location-change'
export const routeChangeEvent = 'navigation:route-change'
}
declare module "navigation/route-state" {
import { State } from "state/index";
export const createRouteState: (state: State) => void;
declare module 'navigation/route-state' {
import { State } from 'state/index'
export const createRouteState: (state: State) => void
}
declare module "navigation/find-href" {
export const findHref: (node: HTMLElement) => string;
declare module 'navigation/find-href' {
export const findHref: (node: HTMLElement) => string
}
declare module "navigation/navigate" {
import { ListenerKit } from "types";
export const navigate: (path: string, { publish, window }: ListenerKit) => void;
declare module 'navigation/navigate' {
import { ListenerKit } from 'types'
export const navigate: (
path: string,
{ publish, window }: ListenerKit,
) => void
}
declare module "navigation/on-link-click" {
import { ListenerKit } from "types";
export const onLinkClick: (domEvent: MouseEvent, options: ListenerKit) => void;
declare module 'navigation/on-link-click' {
import { ListenerKit } from 'types'
export const onLinkClick: (domEvent: MouseEvent, options: ListenerKit) => void
}
declare module "navigation/extract-query-params" {
export const extractQueryParams: (queryString: string) => {};
declare module 'navigation/extract-query-params' {
export const extractQueryParams: (queryString: string) => {}
}
declare module "navigation/on-location-change" {
import { ListenerKit } from "types";
export const onLocationChange: (_: null, listenerOptions: ListenerKit) => void;
declare module 'navigation/on-location-change' {
import { ListenerKit } from 'types'
export const onLocationChange: (_: null, listenerOptions: ListenerKit) => void
}
declare module "navigation/start" {
import type { App } from "app/index";
export const subscribeToNavigation: (app: App) => void;
export const subscribeToHistoryChange: (app: App) => void;
export const publishLocation: (app: App) => void;
export const startNavigation: (app: App) => void;
declare module 'navigation/start' {
import type { App } from 'app/index'
export const subscribeToNavigation: (app: App) => void
export const subscribeToHistoryChange: (app: App) => void
export const publishLocation: (app: App) => void
export const startNavigation: (app: App) => void
}
declare module "app/index" {
import type { Renderable, RenderKit, Subscribe, PublishFunction } from "types";
import type { State } from "state/index";
import type { JaxsBus } from "bus/index";
import { Root } from "rendering/templates/root";
export class App {
window: Window;
document: Document;
publish: PublishFunction;
subscribe: Subscribe;
bus: JaxsBus;
state: State;
renderKit: RenderKit;
roots: Root[];
constructor({ window, document, publish, subscribe, bus, state, renderKit }: {
window: any;
document: any;
publish: any;
subscribe: any;
bus: any;
state: any;
renderKit: any;
});
render(template: Renderable, selector: string): Root;
startNavigation(): void;
}
declare module 'app/index' {
import type { Renderable, RenderKit, Subscribe, PublishFunction } from 'types'
import type { State } from 'state/index'
import type { JaxsBus } from 'bus/index'
import { Root } from 'rendering/templates/root'
export class App {
window: Window
document: Document
publish: PublishFunction
subscribe: Subscribe
bus: JaxsBus
state: State
renderKit: RenderKit
roots: Root[]
constructor({
window,
document,
publish,
subscribe,
bus,
state,
renderKit,
}: {
window: any
document: any
publish: any
subscribe: any
bus: any
state: any
renderKit: any
})
render(template: Renderable, selector: string): Root
startNavigation(): void
}
}
declare module "types" {
import type { State } from "state/index";
import type { Store } from "state/store";
import type { StoreUpdaterBase } from "state/store-updater";
import type { StoreUpdaterBoolean } from "state/updaters/boolean";
import type { StoreUpdaterList } from "state/updaters/list";
import type { StoreUpdaterObject } from "state/updaters/object";
export type { App } from "app/index";
export { State, Store, StoreUpdaterBase, StoreUpdaterBoolean, StoreUpdaterList, StoreUpdaterObject, };
export type StoreUpdater<T> = StoreUpdaterBase<T> | StoreUpdaterObject<T> | StoreUpdaterBoolean | StoreUpdaterList<T>;
export type TextValue = string | number;
export interface JsxIded {
__jsx?: string;
}
export type JsxChangeId = {
element: JaxsNode;
index: number;
};
export type EventMap = {
domEvent: string;
busEvent: string;
listener: EventListener;
};
export type EventMaps = Record<string, EventMap>;
interface JsxEventMapped {
eventMaps: EventMaps;
}
export type JaxsElement = Element & JsxIded & JsxEventMapped;
export type JaxsText = Text & JsxIded;
export type JaxsSvgElement = SVGElement & JsxIded;
export type JaxsNode = JaxsElement | JaxsText | JaxsSvgElement;
export type JaxsNodes = JaxsNode[] | NodeListOf<JaxsNode>;
export type JaxsInput = HTMLInputElement & JsxIded & JsxEventMapped;
type NullValues = null | undefined;
export type ReactSourceObject = {
fileName: string;
lineNumber: string;
columnNumber: string;
};
interface SourceMap {
__source?: ReactSourceObject;
}
export type Props<T> = Partial<{
__source: ReactSourceObject;
children: JsxCollection;
}> & T;
export type PropValue = TextValue | NullValues | boolean | ReactSourceObject | JsxCollection;
export type TagAttributes = SourceMap & Record<string, string>;
export type TagEventAttributes = Record<string, string>;
export type TagAttributesAndEvents = {
attributes: TagAttributes;
events: TagEventAttributes;
};
export type DomPublish = (eventName: string, domEvent: Event) => void;
export type Subscribe = (matcher: BusEventMatcher, listener: BusListener<any>) => void;
export type RenderKit = {
document: Document;
window: Window;
publish: DomPublish;
subscribe: Subscribe;
state: State;
parent?: JaxsNode | null;
};
export interface Renderable {
render: (renderKit: RenderKit, parentElement?: JaxsElement) => JaxsNode[];
}
export type StaticTemplate = () => Renderable;
export type TypedTemplate<T> = (props: Props<T>) => Renderable;
export type Template<T> = StaticTemplate | TypedTemplate<T>;
export type JsxCollection = (Renderable | TextValue)[];
export enum ChangeInstructionTypes {
removeNode = 0,
insertNode = 1,// can be to move an existing element in the dom, or to add one
replaceNode = 2,
removeAttribute = 3,
addAttribute = 4,
updateAttribute = 5,
removeEvent = 6,
addEvent = 7,
updateEvent = 8,
changeValue = 9,
changeText = 10
}
export type RemoveInstructionData = {
name: string;
isSvg?: boolean;
};
export type AttributeInstructionData = {
name: string;
value: string;
isSvg?: boolean;
};
export type EventInstructionData = {
name: string;
value: EventListener;
};
export type UpdateEventInstructionData = {
name: string;
sourceValue: EventListener;
targetValue: EventListener;
};
export type InsertNodeData = {
parent: JaxsElement;
index: number;
};
type NullInstructionData = Record<string, never>;
export type InstructionData = RemoveInstructionData | AttributeInstructionData | EventInstructionData | UpdateEventInstructionData | InsertNodeData | NullInstructionData;
export type ChangeInstruction = {
source: JaxsNode;
target: JaxsNode;
type: ChangeInstructionTypes;
data: InstructionData;
};
export type ChangeInstructions = Array<ChangeInstruction>;
export type InstructionsUpdater = (instruction: ChangeInstruction) => void;
export type StoreMap = {
[key: string]: any;
};
export type ViewModel<ATTRIBUTES, STORE_MAP> = (storeMap: STORE_MAP) => Partial<ATTRIBUTES>;
export type BindSubscriptionList = string[];
export type BindParams<T, U> = {
Template: Template<T>;
viewModel?: ViewModel<T, U>;
subscriptions?: BindSubscriptionList;
};
export type AppAdditionListenerOptions = {
state: State;
document: Document;
window: Window;
};
export type DefaultBusListenerOptions = {
publish: PublishFunction;
eventName: string;
};
export type ListenerKit = AppAdditionListenerOptions & DefaultBusListenerOptions;
export type PublishFunction = (event: string, payload: any) => void;
export type BusListener<T> = (payload: T, listenerKit: ListenerKit) => void;
export type BusEventMatcher = string | RegExp;
export type ExactSubscriptionData<T> = {
listener: BusListener<T>;
index: number;
matcher: string;
};
export type FuzzySubscriptionData<T> = {
listener: BusListener<T>;
index: number;
matcher: RegExp;
};
export type Unsubscribe = () => void;
export type CreateAppBuilderArguments = {
window?: Window;
document?: Document;
};
export type RouteState = {
host: string;
path: string;
query: Record<string, string>;
};
export type AttributesWithChildren<T> = Props<T> & {
children?: JsxCollection;
};
export type DiffPair = {
source: JaxsNode;
target: JaxsNode;
};
export type CompileChildren = (sourceList: JaxsNodes, targetList: JaxsNodes, parent: JaxsElement) => ChangeInstructions;
export type StatePublisher = (event: string, payload: any) => void;
export type StateTransactionUpdater = (collection: StoresCollection) => void;
export type StoresCollection = Record<string, Store<any>>;
export type StoreInitializationOptions<T> = {
name: string;
parent: State;
value: T;
};
export type StoreDataUpdater<T> = (originalValue: T) => T;
export type UpdaterValue<T> = boolean | T | T[];
export type StoreUpdaterOrValue<T> = UpdaterValue<T> | StoreDataUpdater<T>;
export type StoreListSorterFunction<T> = (left: T, right: T) => number;
export type RouteMatcher = (routeState: RouteState) => boolean;
export type RenderedRoute = {
Partial: StaticTemplate;
match: RouteMatcher;
};
declare module 'types' {
import type { State } from 'state/index'
import type { Store } from 'state/store'
import type { StoreUpdaterBase } from 'state/store-updater'
import type { StoreUpdaterBoolean } from 'state/updaters/boolean'
import type { StoreUpdaterList } from 'state/updaters/list'
import type { StoreUpdaterObject } from 'state/updaters/object'
export type { App } from 'app/index'
export {
State,
Store,
StoreUpdaterBase,
StoreUpdaterBoolean,
StoreUpdaterList,
StoreUpdaterObject,
}
export type StoreUpdater<T> =
| StoreUpdaterBase<T>
| StoreUpdaterObject<T>
| StoreUpdaterBoolean
| StoreUpdaterList<T>
export type TextValue = string | number
export interface JsxIded {
__jsx?: string
}
export type JsxChangeId = {
element: JaxsNode
index: number
}
export type EventMap = {
domEvent: string
busEvent: string
listener: EventListener
}
export type EventMaps = Record<string, EventMap>
interface JsxEventMapped {
eventMaps: EventMaps
}
export type JaxsElement = Element & JsxIded & JsxEventMapped
export type JaxsText = Text & JsxIded
export type JaxsSvgElement = SVGElement & JsxIded
export type JaxsNode = JaxsElement | JaxsText | JaxsSvgElement
export type JaxsNodes = JaxsNode[] | NodeListOf<JaxsNode>
export type JaxsInput = HTMLInputElement & JsxIded & JsxEventMapped
type NullValues = null | undefined
export type ReactSourceObject = {
fileName: string
lineNumber: string
columnNumber: string
}
interface SourceMap {
__source?: ReactSourceObject
}
export type Props<T> = Partial<{
__source: ReactSourceObject
children: JsxCollection
}> &
T
export type PropValue =
| TextValue
| NullValues
| boolean
| ReactSourceObject
| JsxCollection
export type TagAttributes = SourceMap & Record<string, string>
export type TagEventAttributes = Record<string, string>
export type TagAttributesAndEvents = {
attributes: TagAttributes
events: TagEventAttributes
}
export type DomPublish = (eventName: string, domEvent: Event) => void
export type Subscribe = (
matcher: BusEventMatcher,
listener: BusListener<any>,
) => void
export type RenderKit = {
document: Document
window: Window
publish: DomPublish
subscribe: Subscribe
state: State
parent?: JaxsNode | null
}
export interface Renderable {
render: (renderKit: RenderKit, parentElement?: JaxsElement) => JaxsNode[]
}
export type StaticTemplate = () => Renderable
export type TypedTemplate<T> = (props: Props<T>) => Renderable
export type Template<T> = StaticTemplate | TypedTemplate<T>
export type JsxCollection = (Renderable | TextValue)[]
export enum ChangeInstructionTypes {
removeNode = 0,
insertNode = 1, // can be to move an existing element in the dom, or to add one
replaceNode = 2,
removeAttribute = 3,
addAttribute = 4,
updateAttribute = 5,
removeEvent = 6,
addEvent = 7,
updateEvent = 8,
changeValue = 9,
changeText = 10,
}
export type RemoveInstructionData = {
name: string
isSvg?: boolean
}
export type AttributeInstructionData = {
name: string
value: string
isSvg?: boolean
}
export type EventInstructionData = {
name: string
value: EventListener
}
export type UpdateEventInstructionData = {
name: string
sourceValue: EventListener
targetValue: EventListener
}
export type InsertNodeData = {
parent: JaxsElement
index: number
}
type NullInstructionData = Record<string, never>
export type InstructionData =
| RemoveInstructionData
| AttributeInstructionData
| EventInstructionData
| UpdateEventInstructionData
| InsertNodeData
| NullInstructionData
export type ChangeInstruction = {
source: JaxsNode
target: JaxsNode
type: ChangeInstructionTypes
data: InstructionData
}
export type ChangeInstructions = Array<ChangeInstruction>
export type InstructionsUpdater = (instruction: ChangeInstruction) => void
export type StoreMap = {
[key: string]: any
}
export type ViewModel<ATTRIBUTES, STORE_MAP> = (
storeMap: STORE_MAP,
) => Partial<ATTRIBUTES>
export type BindSubscriptionList = string[]
export type BindParams<T, U> = {
Template: Template<T>
viewModel?: ViewModel<T, U>
subscriptions?: BindSubscriptionList
}
export type AppAdditionListenerOptions = {
state: State
document: Document
window: Window
}
export type DefaultBusListenerOptions = {
publish: PublishFunction
eventName: string
}
export type ListenerKit = AppAdditionListenerOptions &
DefaultBusListenerOptions
export type PublishFunction = (event: string, payload: any) => void
export type BusListener<T> = (payload: T, listenerKit: ListenerKit) => void
export type BusEventMatcher = string | RegExp
export type ExactSubscriptionData<T> = {
listener: BusListener<T>
index: number
matcher: string
}
export type FuzzySubscriptionData<T> = {
listener: BusListener<T>
index: number
matcher: RegExp
}
export type Unsubscribe = () => void
export type CreateAppBuilderArguments = {
window?: Window
document?: Document
}
export type RouteState = {
host: string
path: string
query: Record<string, string>
}
export type AttributesWithChildren<T> = Props<T> & {
children?: JsxCollection
}
export type DiffPair = {
source: JaxsNode
target: JaxsNode
}
export type CompileChildren = (
sourceList: JaxsNodes,
targetList: JaxsNodes,
parent: JaxsElement,
) => ChangeInstructions
export type StatePublisher = (event: string, payload: any) => void
export type StateTransactionUpdater = (collection: StoresCollection) => void
export type StoresCollection = Record<string, Store<any>>
export type StoreInitializationOptions<T> = {
name: string
parent: State
value: T
}
export type StoreDataUpdater<T> = (originalValue: T) => T
export type UpdaterValue<T> = boolean | T | T[]
export type StoreUpdaterOrValue<T> = UpdaterValue<T> | StoreDataUpdater<T>
export type StoreListSorterFunction<T> = (left: T, right: T) => number
export type RouteMatcher = (routeState: RouteState) => boolean
export type RenderedRoute = {
Partial: StaticTemplate
match: RouteMatcher
}
}
declare module "rendering/dom/tag" {
import type { JaxsElement, TagAttributes, TagEventAttributes, DomPublish, RenderKit } from "types";
export const createNode: (type: string, document: Document) => HTMLElement;
export const setAttributesOnElement: (element: Element, attributes: TagAttributes) => void;
export const setEventsOnElement: (element: JaxsElement, events: TagEventAttributes, publish: DomPublish) => void;
export const createDecoratedNode: (type: string, attributes: TagAttributes, events: TagEventAttributes, renderKit: RenderKit) => JaxsElement;
declare module 'rendering/dom/tag' {
import type {
JaxsElement,
TagAttributes,
TagEventAttributes,
DomPublish,
RenderKit,
} from 'types'
export const createNode: (type: string, document: Document) => HTMLElement
export const setAttributesOnElement: (
element: Element,
attributes: TagAttributes,
) => void
export const setEventsOnElement: (
element: JaxsElement,
events: TagEventAttributes,
publish: DomPublish,
) => void
export const createDecoratedNode: (
type: string,
attributes: TagAttributes,
events: TagEventAttributes,
renderKit: RenderKit,
) => JaxsElement
}
declare module "rendering/dom/svg" {
import type { TagAttributes, JaxsElement } from "types";
export const namespace = "http://www.w3.org/2000/svg";
export const isSvgTag: (tagType: string, attributeNamespace?: string) => boolean;
export const createSvgNode: (type: string, attributes: TagAttributes, document: Document) => JaxsElement;
export const elementIsSvg: (element: JaxsElement) => boolean;
declare module 'rendering/dom/svg' {
import type { TagAttributes, JaxsElement } from 'types'
export const namespace = 'http://www.w3.org/2000/svg'
export const isSvgTag: (
tagType: string,
attributeNamespace?: string,
) => boolean
export const createSvgNode: (
type: string,
attributes: TagAttributes,
document: Document,
) => JaxsElement
export const elementIsSvg: (element: JaxsElement) => boolean
}
declare module "rendering/dom/text" {
export const createTextNode: (value: string, document: Document) => Text;
declare module 'rendering/dom/text' {
export const createTextNode: (value: string, document: Document) => Text
}
declare module "rendering/templates/text" {
import { Renderable, TextValue, RenderKit } from "types";
export class TextTemplate implements Renderable {
value: string;
constructor(content: TextValue);
render(renderKit: RenderKit): Text[];
}
declare module 'rendering/templates/text' {
import { Renderable, TextValue, RenderKit } from 'types'
export class TextTemplate implements Renderable {
value: string
constructor(content: TextValue)
render(renderKit: RenderKit): Text[]
}
}
declare module "rendering/templates/children/text" {
import { TextValue, Renderable } from "types";
import { TextTemplate } from "rendering/templates/text";
export const isTextValue: <T>(child: TextValue | T) => child is string | number | (T & string) | (T & number);
export const textNode: (content: TextValue) => TextTemplate;
export const replaceTextNodes: (child: TextValue | Renderable) => Renderable | TextTemplate;
declare module 'rendering/templates/children/text' {
import { TextValue, Renderable } from 'types'
import { TextTemplate } from 'rendering/templates/text'
export const isTextValue: <T>(
child: TextValue | T,
) => child is string | number | (T & string) | (T & number)
export const textNode: (content: TextValue) => TextTemplate
export const replaceTextNodes: (
child: TextValue | Renderable,
) => Renderable | TextTemplate
}
declare module "rendering/templates/children/normalize" {
import { JsxCollection, AttributesWithChildren } from "types";
export const normalizeJsxChildren: (jsxChildren: JsxCollection) => (import("types").Renderable | import("rendering/templates/text").TextTemplate)[];
export const normalizeToArray: <T>(children: T | T[]) => T[];
export const ensureJsxChildrenArray: <T>(maybeChildren?: JsxCollection, attributes?: AttributesWithChildren<T>) => JsxCollection;
declare module 'rendering/templates/children/normalize' {
import { JsxCollection, AttributesWithChildren } from 'types'
export const normalizeJsxChildren: (
jsxChildren: JsxCollection,
) => (
| import('types').Renderable
| import('rendering/templates/text').TextTemplate
)[]
export const normalizeToArray: <T>(children: T | T[]) => T[]
export const ensureJsxChildrenArray: <T>(
maybeChildren?: JsxCollection,
attributes?: AttributesWithChildren<T>,
) => JsxCollection
}
declare module "rendering/templates/tag/attributes-and-events" {
import type { Props, TagAttributesAndEvents, JsxCollection } from "types";
export const separateAttrsAndEvents: <T>(props: Props<T>, defaultValue?: string) => TagAttributesAndEvents;
export const packageJsxAttributes: <T>(maybeAttributes?: Props<T>, maybeChildren?: JsxCollection) => Props<T>;
declare module 'rendering/templates/tag/attributes-and-events' {
import type { Props, TagAttributesAndEvents, JsxCollection } from 'types'
export const separateAttrsAndEvents: <T>(
props: Props<T>,
defaultValue?: string,
) => TagAttributesAndEvents
export const packageJsxAttributes: <T>(
maybeAttributes?: Props<T>,
maybeChildren?: JsxCollection,
) => Props<T>
}
declare module "rendering/templates/children/render" {
import { Renderable, RenderKit, JaxsNode, JaxsElement } from "types";
export const recursiveRender: (children: Renderable[], renderKit: RenderKit, parentElement?: JaxsElement, rendered?: JaxsNode[]) => JaxsNode[];
declare module 'rendering/templates/children/render' {
import { Renderable, RenderKit, JaxsNode, JaxsElement } from 'types'
export const recursiveRender: (
children: Renderable[],
renderKit: RenderKit,
parentElement?: JaxsElement,
rendered?: JaxsNode[],
) => JaxsNode[]
}
declare module "rendering/templates/children" {
import { JaxsElement, Renderable, JsxCollection, RenderKit, JaxsNodes, JaxsNode } from "types";
export class Children implements Renderable {
collection: Renderable[];
parentElement?: JaxsElement;
constructor(jsxChildren: JsxCollection);
render(renderKit: RenderKit, parentElement?: JaxsElement): JaxsNode[];
generateDom(renderKit: RenderKit): JaxsNode[];
attachToParent(dom: JaxsNodes): void;
}
declare module 'rendering/templates/children' {
import {
JaxsElement,
Renderable,
JsxCollection,
RenderKit,
JaxsNodes,
JaxsNode,
} from 'types'
export class Children implements Renderable {
collection: Renderable[]
parentElement?: JaxsElement
constructor(jsxChildren: JsxCollection)
render(renderKit: RenderKit, parentElement?: JaxsElement): JaxsNode[]
generateDom(renderKit: RenderKit): JaxsNode[]
attachToParent(dom: JaxsNodes): void
}
}
declare module "rendering/templates/tag/jsx-key" {
import { TagAttributes } from "types";
export class JsxKey {
attributes: TagAttributes;
type: string;
constructor(type: string, attributes: TagAttributes);
generate(): string;
sourceKey(): string;
createKeyFromAttributes(): string;
}
declare module 'rendering/templates/tag/jsx-key' {
import { TagAttributes } from 'types'
export class JsxKey {
attributes: TagAttributes
type: string
constructor(type: string, attributes: TagAttributes)
generate(): string
sourceKey(): string
createKeyFromAttributes(): string
}
}
declare module "rendering/templates/tag" {
import type { Props, JaxsNode, TagEventAttributes, Renderable, RenderKit, TagAttributes, JsxCollection } from "types";
import { Children } from "rendering/templates/children";
export class Tag<T> implements Renderable {
type: string;
events: TagEventAttributes;
attributes: TagAttributes;
props: Props<T>;
children: Children;
isSvg: boolean;
constructor(tagType: string, props: Props<T>, children?: JsxCollection);
render(renderKit: RenderKit): JaxsNode[];
generateDom(renderKit: RenderKit): import("types").JaxsElement;
generateHtmlDom(renderKit: RenderKit): import("types").JaxsElement;
generateSvgDom(renderKit: RenderKit): import("types").JaxsElement;
jsxKey(): string;
}
declare module 'rendering/templates/tag' {
import type {
Props,
JaxsNode,
TagEventAttributes,
Renderable,
RenderKit,
TagAttributes,
JsxCollection,
} from 'types'
import { Children } from 'rendering/templates/children'
export class Tag<T> implements Renderable {
type: string
events: TagEventAttributes
attributes: TagAttributes
props: Props<T>
children: Children
isSvg: boolean
constructor(tagType: string, props: Props<T>, children?: JsxCollection)
render(renderKit: RenderKit): JaxsNode[]
generateDom(renderKit: RenderKit): import('types').JaxsElement
generateHtmlDom(renderKit: RenderKit): import('types').JaxsElement
generateSvgDom(renderKit: RenderKit): import('types').JaxsElement
jsxKey(): string
}
}
declare module "rendering/jsx" {
import type { JsxCollection, Props, Template, Renderable } from "types";
import { Children } from "rendering/templates/children";
const jsx: {
<T>(type: string | Template<T>, attributes: Props<T>, ...children: JsxCollection): Renderable;
fragment<T>(attributes: Props<T>, maybeChildren: JsxCollection): Children;
};
export { jsx };
declare module 'rendering/jsx' {
import type { JsxCollection, Props, Template, Renderable } from 'types'
import { Children } from 'rendering/templates/children'
const jsx: {
<T>(
type: string | Template<T>,
attributes: Props<T>,
...children: JsxCollection
): Renderable
fragment<T>(attributes: Props<T>, maybeChildren: JsxCollection): Children
}
export { jsx }
}
declare module "app/builder" {
import { App } from "app/index";
import { JaxsBus } from "bus/index";
import { State } from "state/index";
import { PublishFunction, Subscribe, RenderKit, CreateAppBuilderArguments } from "types";
class AppBuilder {
window: Window;
document: Document;
publish: PublishFunction;
subscribe: Subscribe;
bus: JaxsBus;
state: State;
renderKit: RenderKit;
constructor(domEnvironment: CreateAppBuilderArguments);
setup(): App;
setupDomEnvironment(domEnvironment: CreateAppBuilderArguments): void;
setupBus(): void;
setupState(): void;
addBusOptions(): void;
setRenderKit(): void;
}
const createApp: (domEnvironment?: CreateAppBuilderArguments) => App;
export { App, AppBuilder, createApp };
declare module 'app/builder' {
import { App } from 'app/index'
import { JaxsBus } from 'bus/index'
import { State } from 'state/index'
import {
PublishFunction,
Subscribe,
RenderKit,
CreateAppBuilderArguments,
} from 'types'
class AppBuilder {
window: Window
document: Document
publish: PublishFunction
subscribe: Subscribe
bus: JaxsBus
state: State
renderKit: RenderKit
constructor(domEnvironment: CreateAppBuilderArguments)
setup(): App
setupDomEnvironment(domEnvironment: CreateAppBuilderArguments): void
setupBus(): void
setupState(): void
addBusOptions(): void
setRenderKit(): void
}
const createApp: (domEnvironment?: CreateAppBuilderArguments) => App
export { App, AppBuilder, createApp }
}
declare module "rendering/update/instructions/instructions" {
import { JaxsInput, ChangeInstruction, JaxsElement, RemoveInstructionData, AttributeInstructionData, EventInstructionData, UpdateEventInstructionData, InsertNodeData } from "types";
export const changeText: (source: Text, target: Text) => ChangeInstruction;
export const replaceNode: (source: JaxsElement, target: JaxsElement) => ChangeInstruction;
export const removeAttribute: (source: JaxsElement, target: JaxsElement, data: RemoveInstructionData) => ChangeInstruction;
export const addAttribute: (source: JaxsElement, target: JaxsElement, data: AttributeInstructionData) => ChangeInstruction;
export const updateAttribute: (source: JaxsElement, target: JaxsElement, data: AttributeInstructionData) => ChangeInstruction;
export const removeEvent: (source: JaxsElement, target: JaxsElement, data: EventInstructionData) => ChangeInstruction;
export const addEvent: (source: JaxsElement, target: JaxsElement, data: EventInstructionData) => ChangeInstruction;
export const updateEvent: (source: JaxsElement, target: JaxsElement, data: UpdateEventInstructionData) => ChangeInstruction;
export const removeNode: (source: JaxsElement) => ChangeInstruction;
export const insertNode: (target: JaxsElement, data: InsertNodeData) => ChangeInstruction;
export const changeValue: (source: JaxsInput, target: JaxsInput, data: AttributeInstructionData) => ChangeInstruction;
export const instructionsSorter: (left: ChangeInstruction, right: ChangeInstruction) => 0 | 1 | -1;
declare module 'rendering/update/instructions/instructions' {
import {
JaxsInput,
ChangeInstruction,
JaxsElement,
RemoveInstructionData,
AttributeInstructionData,
EventInstructionData,
UpdateEventInstructionData,
InsertNodeData,
} from 'types'
export const changeText: (source: Text, target: Text) => ChangeInstruction
export const replaceNode: (
source: JaxsElement,
target: JaxsElement,
) => ChangeInstruction
export const removeAttribute: (
source: JaxsElement,
target: JaxsElement,
data: RemoveInstructionData,
) => ChangeInstruction
export const addAttribute: (
source: JaxsElement,
target: JaxsElement,
data: AttributeInstructionData,
) => ChangeInstruction
export const updateAttribute: (
source: JaxsElement,
target: JaxsElement,
data: AttributeInstructionData,
) => ChangeInstruction
export const removeEvent: (
source: JaxsElement,
target: JaxsElement,
data: EventInstructionData,
) => ChangeInstruction
export const addEvent: (
source: JaxsElement,
target: JaxsElement,
data: EventInstructionData,
) => ChangeInstruction
export const updateEvent: (
source: JaxsElement,
target: JaxsElement,
data: UpdateEventInstructionData,
) => ChangeInstruction
export const removeNode: (source: JaxsElement) => ChangeInstruction
export const insertNode: (
target: JaxsElement,
data: InsertNodeData,
) => ChangeInstruction
export const changeValue: (
source: JaxsInput,
target: JaxsInput,
data: AttributeInstructionData,
) => ChangeInstruction
export const instructionsSorter: (
left: ChangeInstruction,
right: ChangeInstruction,
) => 0 | 1 | -1
}
declare module "rendering/update/instructions/id-map" {
import type { JaxsNode, JaxsNodes, JsxChangeId } from "types";
export class IdMap {
map: Record<string, JsxChangeId[]>;
constructor();
populate(list: JaxsNodes): void;
pullMatch(element: JaxsNode): JsxChangeId;
clear(element: JaxsNode): void;
check(element: JaxsNode): boolean;
remaining(): JsxChangeId[];
}
export const createIdMap: (list: JaxsNodes) => IdMap;
declare module 'rendering/update/instructions/id-map' {
import type { JaxsNode, JaxsNodes, JsxChangeId } from 'types'
export class IdMap {
map: Record<string, JsxChangeId[]>
constructor()
populate(list: JaxsNodes): void
pullMatch(element: JaxsNode): JsxChangeId
clear(element: JaxsNode): void
check(element: JaxsNode): boolean
remaining(): JsxChangeId[]
}
export const createIdMap: (list: JaxsNodes) => IdMap
}
declare module "rendering/update/instructions/nodes/element/attributes" {
import type { JaxsElement, ChangeInstructions } from "types";
export const compileForAttributes: (source: JaxsElement, target: JaxsElement, isSvg?: boolean) => ChangeInstructions;
declare module 'rendering/update/instructions/nodes/element/attributes' {
import type { JaxsElement, ChangeInstructions } from 'types'
export const compileForAttributes: (
source: JaxsElement,
target: JaxsElement,
isSvg?: boolean,
) => ChangeInstructions
}
declare module "rendering/update/instructions/nodes/element/events" {
import type { JaxsElement, ChangeInstructions } from "types";
export const compileForEvents: (source: JaxsElement, target: JaxsElement) => ChangeInstructions;
declare module 'rendering/update/instructions/nodes/element/events' {
import type { JaxsElement, ChangeInstructions } from 'types'
export const compileForEvents: (
source: JaxsElement,
target: JaxsElement,
) => ChangeInstructions
}
declare module "rendering/update/instructions/nodes/input" {
import { ChangeInstructions, JaxsElement } from "types";
export const compileForInputValue: (sourceElement: JaxsElement, targetElement: JaxsElement) => ChangeInstructions;
declare module 'rendering/update/instructions/nodes/input' {
import { ChangeInstructions, JaxsElement } from 'types'
export const compileForInputValue: (
sourceElement: JaxsElement,
targetElement: JaxsElement,
) => ChangeInstructions
}
declare module "rendering/update/instructions/nodes/element" {
import type { JaxsElement } from "types";
export const compileForElement: (source: JaxsElement, target: JaxsElement) => import("types").ChangeInstruction[];
declare module 'rendering/update/instructions/nodes/element' {
import type { JaxsElement } from 'types'
export const compileForElement: (
source: JaxsElement,
target: JaxsElement,
) => import('types').ChangeInstruction[]
}
declare module "rendering/update/instructions/nodes/svg" {
import { JaxsElement } from "types";
export const compileForSvg: (source: JaxsElement, target: JaxsElement) => import("types").ChangeInstructions;
declare module 'rendering/update/instructions/nodes/svg' {
import { JaxsElement } from 'types'
export const compileForSvg: (
source: JaxsElement,
target: JaxsElement,
) => import('types').ChangeInstructions
}
declare module "rendering/update/instructions/nodes/text" {
import type { ChangeInstructions } from "types";
export const compileForText: (source: Text, target: Text) => ChangeInstructions;
declare module 'rendering/update/instructions/nodes/text' {
import type { ChangeInstructions } from 'types'
export const compileForText: (
source: Text,
target: Text,
) => ChangeInstructions
}
declare module "rendering/update/instructions/node" {
import type { JaxsNode, ChangeInstructions, CompileChildren } from "types";
export const compileForNode: (source: JaxsNode, target: JaxsNode, compileChildren: CompileChildren) => ChangeInstructions;
declare module 'rendering/update/instructions/node' {
import type { JaxsNode, ChangeInstructions, CompileChildren } from 'types'
export const compileForNode: (
source: JaxsNode,
target: JaxsNode,
compileChildren: CompileChildren,
) => ChangeInstructions
}
declare module "rendering/update/instructions/collection" {
import type { JaxsElement, JaxsNodes } from "types";
export const compileCollection: (sourceList: JaxsNodes, targetList: JaxsNodes, parent: JaxsElement) => import("types").ChangeInstruction[];
declare module 'rendering/update/instructions/collection' {
import type { JaxsElement, JaxsNodes } from 'types'
export const compileCollection: (
sourceList: JaxsNodes,
targetList: JaxsNodes,
parent: JaxsElement,
) => import('types').ChangeInstruction[]
}
declare module "rendering/update/perform-change" {
import type { ChangeInstruction, JaxsElement, JaxsNodes } from "types";
export const performChange: (source: JaxsNodes, target: JaxsNodes, parent: JaxsElement) => ChangeInstruction[];
declare module 'rendering/update/perform-change' {
import type { ChangeInstruction, JaxsElement, JaxsNodes } from 'types'
export const performChange: (
source: JaxsNodes,
target: JaxsNodes,
parent: JaxsElement,
) => ChangeInstruction[]
}
declare module "rendering/templates/bound/modify-dom-cache" {
import { ChangeInstructions, JaxsNode, JaxsElement } from "types";
export const modifyDomCache: (instructions: ChangeInstructions, dom: JaxsNode[], parentElement: JaxsElement) => JaxsNode[];
declare module 'rendering/templates/bound/modify-dom-cache' {
import { ChangeInstructions, JaxsNode, JaxsElement } from 'types'
export const modifyDomCache: (
instructions: ChangeInstructions,
dom: JaxsNode[],
parentElement: JaxsElement,
) => JaxsNode[]
}
declare module "rendering/templates/bound" {
import { JaxsElement, Props, Template, RenderKit, ViewModel, BindParams, BindSubscriptionList, JaxsNode } from "types";
export class Bound<ATTRIBUTES, STATE_MAP> {
Template: Template<ATTRIBUTES>;
viewModel: ViewModel<ATTRIBUTES, STATE_MAP>;
attributes: Partial<Props<ATTRIBUTES>>;
subscriptions: BindSubscriptionList;
dom: JaxsNode[];
parentElement: JaxsElement | null;
renderKit?: RenderKit;
constructor({ Template, subscriptions, attributes, viewModel }: {
Template: any;
subscriptions: any;
attributes: any;
viewModel: any;
});
render(renderKit: RenderKit): JaxsNode[];
generateDom(renderKit: RenderKit): JaxsNode[];
rerender(): void;
subscribeForRerender(): void;
eventName(storeName: string): string;
}
export const bind: <ATTRIBUTES, STATE_MAP>({ Template, viewModel, subscriptions, }: BindParams<ATTRIBUTES, STATE_MAP>) => (attributes: Partial<Props<ATTRIBUTES>>) => Bound<unknown, unknown>;
declare module 'rendering/templates/bound' {
import {
JaxsElement,
Props,
Template,
RenderKit,
ViewModel,
BindParams,
BindSubscriptionList,
JaxsNode,
} from 'types'
export class Bound<ATTRIBUTES, STATE_MAP> {
Template: Template<ATTRIBUTES>
viewModel: ViewModel<ATTRIBUTES, STATE_MAP>
attributes: Partial<Props<ATTRIBUTES>>
subscriptions: BindSubscriptionList
dom: JaxsNode[]
parentElement: JaxsElement | null
renderKit?: RenderKit
constructor({
Template,
subscriptions,
attributes,
viewModel,
}: {
Template: any
subscriptions: any
attributes: any
viewModel: any
})
render(renderKit: RenderKit): JaxsNode[]
generateDom(renderKit: RenderKit): JaxsNode[]
rerender(): void
subscribeForRerender(): void
eventName(storeName: string): string
}
export const bind: <ATTRIBUTES, STATE_MAP>({
Template,
viewModel,
subscriptions,
}: BindParams<ATTRIBUTES, STATE_MAP>) => (
attributes: Partial<Props<ATTRIBUTES>>,
) => Bound<unknown, unknown>
}
declare module "navigation/index" {
import * as events from "navigation/events";
import { extractQueryParams } from "navigation/extract-query-params";
import { findHref } from "navigation/find-href";
import { navigate } from "navigation/navigate";
import { onLinkClick } from "navigation/on-link-click";
import { onLocationChange } from "navigation/on-location-change";
import { createRouteState } from "navigation/route-state";
import * as start from "navigation/start";
export { events, extractQueryParams, findHref, navigate, onLinkClick, onLocationChange, createRouteState, start, };
declare module 'navigation/index' {
import * as events from 'navigation/events'
import { extractQueryParams } from 'navigation/extract-query-params'
import { findHref } from 'navigation/find-href'
import { navigate } from 'navigation/navigate'
import { onLinkClick } from 'navigation/on-link-click'
import { onLocationChange } from 'navigation/on-location-change'
import { createRouteState } from 'navigation/route-state'
import * as start from 'navigation/start'
export {
events,
extractQueryParams,
findHref,
navigate,
onLinkClick,
onLocationChange,
createRouteState,
start,
}
}
declare module "app/routing" {
import { RenderedRoute, RouteMatcher } from "types";
export const exactPathMatch: (exactPath: string) => RouteMatcher;
export const catchAll: RouteMatcher;
export const buildRouter: (pages: RenderedRoute[]) => ({ route }: {
route: any;
}) => import("types").StaticTemplate;
declare module 'app/routing' {
import { RenderedRoute, RouteMatcher } from 'types'
export const exactPathMatch: (exactPath: string) => RouteMatcher
export const catchAll: RouteMatcher
export const buildRouter: (
pages: RenderedRoute[],
) => ({ route }: { route: any }) => import('types').StaticTemplate
}
declare module "rendering/null" {
import { RenderKit, JaxsElement, JaxsNode } from "types";
export const NullTemplate: () => {
render: (renderKit: RenderKit, parentElement?: JaxsElement) => JaxsNode[];
};
declare module 'rendering/null' {
import { RenderKit, JaxsElement, JaxsNode } from 'types'
export const NullTemplate: () => {
render: (renderKit: RenderKit, parentElement?: JaxsElement) => JaxsNode[]
}
}
declare module "app/routed-view" {
import { RenderedRoute, RouteState } from "types";
export const routedView: (routes: RenderedRoute[]) => (attributes: Partial<import("types").Props<{
route: RouteState;
}>>) => import("rendering/templates/bound").Bound<unknown, unknown>;
declare module 'app/routed-view' {
import { RenderedRoute, RouteState } from 'types'
export const routedView: (routes: RenderedRoute[]) => (
attributes: Partial<
import('types').Props<{
route: RouteState
}>
>,
) => import('rendering/templates/bound').Bound<unknown, unknown>
}
declare module "jaxs" {
export { jsx } from "rendering/jsx";
export { createApp } from "app/builder";
export { bind } from "rendering/templates/bound";
export * as JaxsTypes from "types";
export * as navigation from "navigation/index";
export * as appBuilding from "app/index";
export * as messageBus from "bus/index";
export * as state from "state/index";
export * as routing from "app/routing";
export { routedView } from "app/routed-view";
declare module 'jaxs' {
export { jsx } from 'rendering/jsx'
export { createApp } from 'app/builder'
export { bind } from 'rendering/templates/bound'
export * as JaxsTypes from 'types'
export * as navigation from 'navigation/index'
export * as appBuilding from 'app/index'
export * as messageBus from 'bus/index'
export * as state from 'state/index'
export * as routing from 'app/routing'
export { routedView } from 'app/routed-view'
}

@@ -1,356 +0,458 @@

const et = (e, t) => t.createElement(e), st = (e, t) => {
for (const s in t) {
if (s === "__self") continue;
const r = t[s].toString();
if (s === "value") {
const n = e;
n.value !== r && (n.value = r);
} else
e.setAttribute(s, r);
}
}, rt = (e, t, s) => {
const r = {};
for (const n in t) {
const o = t[n], a = (l) => s(o, l);
e.addEventListener(n, a), r[n] = {
domEvent: n,
busEvent: o,
listener: a
};
}
e.eventMaps = r;
}, nt = (e, t, s, r) => {
const n = et(e, r.document);
return st(n, t), rt(n, s, r.publish), n;
}, y = "http://www.w3.org/2000/svg", ot = {
animate: !0,
animateMotion: !0,
animateTransform: !0,
circle: !0,
clipPath: !0,
defs: !0,
desc: !0,
ellipse: !0,
feBlend: !0,
feColorMatrix: !0,
feComponentTransfer: !0,
feComposite: !0,
feConvolveMatrix: !0,
feDiffuseLighting: !0,
feDisplacementMap: !0,
feDistantLight: !0,
feDropShadow: !0,
feFlood: !0,
feFuncA: !0,
feFuncB: !0,
feFuncG: !0,
feFuncR: !0,
feGaussianBlur: !0,
feImage: !0,
feMerge: !0,
feMergeNode: !0,
feMorphology: !0,
feOffset: !0,
fePointLight: !0,
feSpecularLighting: !0,
feSpotLight: !0,
feTile: !0,
feTurbulence: !0,
filter: !0,
foreignObject: !0,
g: !0,
image: !0,
line: !0,
linearGradient: !0,
marker: !0,
mask: !0,
metadata: !0,
mpath: !0,
path: !0,
pattern: !0,
polygon: !0,
polyline: !0,
radialGradient: !0,
rect: !0,
script: !0,
set: !0,
stop: !0,
style: !0,
svg: !0,
switch: !0,
symbol: !0,
text: !0,
textPath: !0,
title: !0,
tspan: !0,
use: !0,
view: !0
}, it = (e, t) => !!(ot[e] || e === "a" && t === y), ut = (e, t, s) => {
const r = s.createElementNS(y, e);
for (const n in t)
n === "__self" || n === "xmlns" || r.setAttributeNS(null, n, t[n].toString());
return r;
}, at = (e) => e.namespaceURI === y, ct = (e, t) => t.createTextNode(e);
class lt {
const Z = (e, t) => t.createElement(e),
tt = (e, t) => {
for (const s in t) {
if (s === '__self') continue
const n = t[s].toString()
if (s === 'value') {
const r = e
r.value !== n && (r.value = n)
} else e.setAttribute(s, n)
}
},
et = (e, t, s) => {
const n = {}
for (const r in t) {
const o = t[r],
a = (l) => s(o, l)
e.addEventListener(r, a),
(n[r] = {
domEvent: r,
busEvent: o,
listener: a,
})
}
e.eventMaps = n
},
st = (e, t, s, n) => {
const r = Z(e, n.document)
return tt(r, t), et(r, s, n.publish), r
},
y = 'http://www.w3.org/2000/svg',
nt = {
animate: !0,
animateMotion: !0,
animateTransform: !0,
circle: !0,
clipPath: !0,
defs: !0,
desc: !0,
ellipse: !0,
feBlend: !0,
feColorMatrix: !0,
feComponentTransfer: !0,
feComposite: !0,
feConvolveMatrix: !0,
feDiffuseLighting: !0,
feDisplacementMap: !0,
feDistantLight: !0,
feDropShadow: !0,
feFlood: !0,
feFuncA: !0,
feFuncB: !0,
feFuncG: !0,
feFuncR: !0,
feGaussianBlur: !0,
feImage: !0,
feMerge: !0,
feMergeNode: !0,
feMorphology: !0,
feOffset: !0,
fePointLight: !0,
feSpecularLighting: !0,
feSpotLight: !0,
feTile: !0,
feTurbulence: !0,
filter: !0,
foreignObject: !0,
g: !0,
image: !0,
line: !0,
linearGradient: !0,
marker: !0,
mask: !0,
metadata: !0,
mpath: !0,
path: !0,
pattern: !0,
polygon: !0,
polyline: !0,
radialGradient: !0,
rect: !0,
script: !0,
set: !0,
stop: !0,
style: !0,
svg: !0,
switch: !0,
symbol: !0,
text: !0,
textPath: !0,
title: !0,
tspan: !0,
use: !0,
view: !0,
},
rt = (e, t) => !!(nt[e] || (e === 'a' && t === y)),
ot = (e, t, s) => {
const n = s.createElementNS(y, e)
for (const r in t)
r === '__self' ||
r === 'xmlns' ||
n.setAttributeNS(null, r, t[r].toString())
return n
},
it = (e) => e.namespaceURI === y,
ut = (e, t) => t.createTextNode(e)
class at {
constructor(t) {
this.value = t.toString();
this.value = t.toString()
}
render(t) {
const s = ct(this.value, t.document);
return s.__jsx = "TextNode", [s];
const s = ut(this.value, t.document)
return (s.__jsx = 'TextNode'), [s]
}
}
const ht = (e) => typeof e == "string" || typeof e == "number", dt = (e) => new lt(e), pt = (e) => ht(e) ? dt(e) : e, mt = (e) => ft(e).map(pt).flat(), ft = (e) => Array.isArray(e) ? e.flat() : e ? [e] : [], S = (e, t = {}) => e || t.children || [], bt = (e, t = "") => {
const s = {}, r = {};
for (const n in e) {
const o = e[n];
if (n.match(/^on.+/i)) {
const a = n.slice(2).toLowerCase();
r[a] = o ? o.toString() : "";
} else {
if (o === !1) continue;
n === "__source" ? s.__source = e.__source : s[n] = vt(n, o, t);
const ct = (e) => typeof e == 'string' || typeof e == 'number',
lt = (e) => new at(e),
ht = (e) => (ct(e) ? lt(e) : e),
dt = (e) => pt(e).map(ht).flat(),
pt = (e) => (Array.isArray(e) ? e.flat() : e ? [e] : []),
j = (e, t = {}) => e || t.children || [],
mt = (e, t = '') => {
const s = {},
n = {}
for (const r in e) {
const o = e[r]
if (r.match(/^on.+/i)) {
const a = r.slice(2).toLowerCase()
n[a] = o ? o.toString() : ''
} else {
if (o === !1) continue
r === '__source' ? (s.__source = e.__source) : (s[r] = ft(r, o, t))
}
}
}
return {
attributes: s,
events: r
};
}, vt = (e, t, s = "") => t == null ? s : t.toString(), gt = (e, t) => {
const s = e || {}, r = S(t, s);
return s.children = s.children || r, s;
}, j = (e, t, s, r = []) => e.reduce(yt(t, s), r).flat(), yt = (e, t) => (s, r) => r ? Array.isArray(r) ? j(
r,
e,
t,
s
) : (r.render(e, t).forEach((n) => s.push(n)), s) : s;
class O {
return {
attributes: s,
events: n,
}
},
ft = (e, t, s = '') => (t == null ? s : t.toString()),
bt = (e, t) => {
const s = e || {},
n = j(t, s)
return (s.children = s.children || n), s
},
O = (e, t, s, n = []) => e.reduce(vt(t, s), n).flat(),
vt = (e, t) => (s, n) =>
n
? Array.isArray(n)
? O(n, e, t, s)
: (n.render(e, t).forEach((r) => s.push(r)), s)
: s
class M {
constructor(t) {
this.collection = mt(t);
this.collection = dt(t)
}
render(t, s) {
this.parentElement = s;
const r = this.generateDom(t);
return this.attachToParent(r), r;
this.parentElement = s
const n = this.generateDom(t)
return this.attachToParent(n), n
}
generateDom(t) {
return j(this.collection, t, this.parentElement);
return O(this.collection, t, this.parentElement)
}
attachToParent(t) {
if (this.parentElement === void 0) return;
const s = this.parentElement;
t.forEach((r) => s.appendChild(r));
if (this.parentElement === void 0) return
const s = this.parentElement
t.forEach((n) => s.appendChild(n))
}
}
class Et {
class gt {
constructor(t, s) {
this.type = t, this.attributes = s;
;(this.type = t), (this.attributes = s)
}
generate() {
return this.attributes.key || this.sourceKey() || this.createKeyFromAttributes();
return (
this.attributes.key || this.sourceKey() || this.createKeyFromAttributes()
)
}
sourceKey() {
if (this.attributes.__source) {
const { fileName: t, lineNumber: s, columnNumber: r } = this.attributes.__source;
return `${t}:${s}:${r}`;
const {
fileName: t,
lineNumber: s,
columnNumber: n,
} = this.attributes.__source
return `${t}:${s}:${n}`
}
}
createKeyFromAttributes() {
const t = this.attributes.id ? `#${this.attributes.id}` : "", s = this.attributes.type ? `[type=${this.attributes.type}]` : "", r = this.attributes.name ? `[name=${this.attributes.name}]` : "";
return `${this.type}${t}${s}${r}`;
const t = this.attributes.id ? `#${this.attributes.id}` : '',
s = this.attributes.type ? `[type=${this.attributes.type}]` : '',
n = this.attributes.name ? `[name=${this.attributes.name}]` : ''
return `${this.type}${t}${s}${n}`
}
}
class xt {
constructor(t, s, r = []) {
this.type = t;
const { events: n, attributes: o } = bt(s);
this.events = n, this.attributes = o, this.isSvg = it(this.type, this.attributes.xmlns), this.children = new O(r);
class yt {
constructor(t, s, n = []) {
this.type = t
const { events: r, attributes: o } = mt(s)
;(this.events = r),
(this.attributes = o),
(this.isSvg = rt(this.type, this.attributes.xmlns)),
(this.children = new M(n))
}
render(t) {
const s = this.generateDom(t);
return s ? (this.children.render(t, s), [s]) : [];
const s = this.generateDom(t)
return s ? (this.children.render(t, s), [s]) : []
}
generateDom(t) {
return this.isSvg ? this.generateSvgDom(t) : this.generateHtmlDom(t);
return this.isSvg ? this.generateSvgDom(t) : this.generateHtmlDom(t)
}
generateHtmlDom(t) {
const s = nt(
this.type,
this.attributes,
this.events,
t
);
return s.__jsx = this.jsxKey(), s;
const s = st(this.type, this.attributes, this.events, t)
return (s.__jsx = this.jsxKey()), s
}
generateSvgDom(t) {
const s = ut(this.type, this.attributes, t.document);
return s.__jsx = this.jsxKey(), s;
const s = ot(this.type, this.attributes, t.document)
return (s.__jsx = this.jsxKey()), s
}
jsxKey() {
return new Et(this.type, this.attributes).generate();
return new gt(this.type, this.attributes).generate()
}
}
const At = (e, t, ...s) => typeof e == "string" ? new xt(e, t, s) : e(gt(t, s));
At.fragment = (e, t) => {
const s = S(t, e);
return new O(s);
};
class _t {
constructor(t, s, r) {
this.template = t, this.selector = s, this.renderKit = r, this.dom = [];
const Et = (e, t, ...s) =>
typeof e == 'string' ? new yt(e, t, s) : e(bt(t, s))
Et.fragment = (e, t) => {
const s = j(t, e)
return new M(s)
}
class xt {
constructor(t, s, n) {
;(this.template = t),
(this.selector = s),
(this.renderKit = n),
(this.dom = [])
}
renderAndAttach(t) {
this.parentElement = this.getParentElement(), this.dom = this.render({ ...t, parent: this.parentElement }), this.parentElement && this.attach();
;(this.parentElement = this.getParentElement()),
(this.dom = this.render({ ...t, parent: this.parentElement })),
this.parentElement && this.attach()
}
render(t) {
return this.template.render(t);
return this.template.render(t)
}
attach() {
this.parentElement && (this.parentElement.innerHTML = ""), this.dom.forEach((t) => {
this.parentElement && this.parentElement.appendChild(t);
});
this.parentElement && (this.parentElement.innerHTML = ''),
this.dom.forEach((t) => {
this.parentElement && this.parentElement.appendChild(t)
})
}
getParentElement() {
return this.renderKit.document.querySelector(this.selector);
return this.renderKit.document.querySelector(this.selector)
}
}
const wt = (e, t, s) => {
const r = new _t(e, t, s);
return r.renderAndAttach(s), r;
}, M = "go-to-href", m = "navigation:location-change", k = "navigation:route-change", Nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
linkNavigationEvent: M,
locationChangeEvent: m,
routeChangeEvent: k
}, Symbol.toStringTag, { value: "Module" })), T = (e) => {
e.createRecord("route", {
host: "",
path: "",
query: {}
});
}, $ = (e) => {
const t = e.closest("[href]");
return t && t.getAttribute("href") || "";
}, D = (e, { publish: t, window: s }) => {
s.history.pushState(null, "", e), t(m, null);
}, P = (e, t) => {
if (!e || !e.target) return;
e.preventDefault();
const s = $(e.target);
D(s, t);
}, L = (e) => e.replace(/^\?/, "").split("&").reduce((t, s) => {
if (!s) return t;
const r = s.split("=");
return t[r[0]] = r[1], t;
}, {}), F = (e, t) => {
const { state: s, publish: r, window: n } = t, { host: o, pathname: a, search: l } = n.location, u = a, d = L(l), c = {
host: o,
path: u,
query: d
};
s.store("route").update(c), r(k, c);
}, B = (e) => {
const { subscribe: t } = e;
t(M, P);
}, z = (e) => {
const { publish: t, subscribe: s, state: r, window: n } = e;
T(r), n.addEventListener("popstate", () => t(m, null)), s(m, F);
}, V = (e) => {
setTimeout(() => e.publish(m, null), 0);
}, K = (e) => {
z(e), B(e), V(e);
}, St = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
publishLocation: V,
startNavigation: K,
subscribeToHistoryChange: z,
subscribeToNavigation: B
}, Symbol.toStringTag, { value: "Module" }));
class R {
constructor({ window: t, document: s, publish: r, subscribe: n, bus: o, state: a, renderKit: l }) {
this.window = t, this.document = s, this.publish = r, this.subscribe = n, this.bus = o, this.state = a, this.renderKit = l, this.roots = [];
const At = (e, t, s) => {
const n = new xt(e, t, s)
return n.renderAndAttach(s), n
},
k = 'go-to-href',
T = 'go-to',
m = 'navigation:location-change',
$ = 'navigation:route-change',
_t = /* @__PURE__ */ Object.freeze(
/* @__PURE__ */ Object.defineProperty(
{
__proto__: null,
linkNavigationEvent: k,
locationChangeEvent: m,
navigationEvent: T,
routeChangeEvent: $,
},
Symbol.toStringTag,
{ value: 'Module' },
),
),
D = (e) => {
e.create('route', {
host: '',
path: '',
query: {},
})
},
P = (e) => {
const t = e.closest('[href]')
return (t && t.getAttribute('href')) || ''
},
E = (e, { publish: t, window: s }) => {
s.history.pushState(null, '', e), t(m, null)
},
F = (e, t) => {
if (!e || !e.target) return
e.preventDefault()
const s = P(e.target)
E(s, t)
},
L = (e) =>
e
.replace(/^\?/, '')
.split('&')
.reduce((t, s) => {
if (!s) return t
const n = s.split('=')
return (t[n[0]] = n[1]), t
}, {}),
z = (e, t) => {
const { state: s, publish: n, window: r } = t,
{ host: o, pathname: a, search: l } = r.location,
u = a,
d = L(l),
c = {
host: o,
path: u,
query: d,
}
s.store('route').update(c), n($, c)
},
B = (e) => {
const { subscribe: t } = e
t(k, F),
t(T, (s, n) => {
E(s, n)
})
},
V = (e) => {
const { publish: t, subscribe: s, state: n, window: r } = e
D(n), r.addEventListener('popstate', () => t(m, null)), s(m, z)
},
K = (e) => {
setTimeout(() => e.publish(m, null), 0)
},
R = (e) => {
V(e), B(e), K(e)
},
wt = /* @__PURE__ */ Object.freeze(
/* @__PURE__ */ Object.defineProperty(
{
__proto__: null,
publishLocation: K,
startNavigation: R,
subscribeToHistoryChange: V,
subscribeToNavigation: B,
},
Symbol.toStringTag,
{ value: 'Module' },
),
)
class U {
constructor({
window: t,
document: s,
publish: n,
subscribe: r,
bus: o,
state: a,
renderKit: l,
}) {
;(this.window = t),
(this.document = s),
(this.publish = n),
(this.subscribe = r),
(this.bus = o),
(this.state = a),
(this.renderKit = l),
(this.roots = [])
}
render(t, s) {
const r = wt(t, s, this.renderKit);
return this.roots.push(r), r;
const n = At(t, s, this.renderKit)
return this.roots.push(n), n
}
startNavigation() {
K(this);
R(this)
}
}
const Oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
App: R
}, Symbol.toStringTag, { value: "Module" }));
class U {
const Me = /* @__PURE__ */ Object.freeze(
/* @__PURE__ */ Object.defineProperty(
{
__proto__: null,
App: U,
},
Symbol.toStringTag,
{ value: 'Module' },
),
)
class q {
constructor() {
this.lookup = {};
this.lookup = {}
}
add(t, s, r) {
this.ensureArrayFor(t);
const n = {
add(t, s, n) {
this.ensureArrayFor(t)
const r = {
listener: s,
index: r,
matcher: t
};
return this.lookup[t].push(n), () => this.remove(n);
index: n,
matcher: t,
}
return this.lookup[t].push(r), () => this.remove(r)
}
remove(t) {
this.lookup[t.matcher] && (this.lookup[t.matcher] = this.lookup[t.matcher].reduce((s, r) => (r !== t && s.push(r), s), []));
this.lookup[t.matcher] &&
(this.lookup[t.matcher] = this.lookup[t.matcher].reduce(
(s, n) => (n !== t && s.push(n), s),
[],
))
}
matches(t) {
return this.lookup[t] || [];
return this.lookup[t] || []
}
ensureArrayFor(t) {
this.lookup[t] || (this.lookup[t] = []);
this.lookup[t] || (this.lookup[t] = [])
}
}
class q {
class I {
constructor() {
this.lookup = [];
this.lookup = []
}
add(t, s, r) {
const n = {
add(t, s, n) {
const r = {
listener: s,
index: r,
matcher: t
};
return this.lookup.push(n), () => this.remove(n);
index: n,
matcher: t,
}
return this.lookup.push(r), () => this.remove(r)
}
remove(t) {
this.lookup = this.lookup.reduce((s, r) => (r !== t && s.push(r), s), []);
this.lookup = this.lookup.reduce((s, n) => (n !== t && s.push(n), s), [])
}
matches(t) {
return this.lookup.filter(
(s) => s.matcher.test(t)
);
return this.lookup.filter((s) => s.matcher.test(t))
}
}
class I {
class J {
constructor() {
this.exactSubscriptions = new U(), this.fuzzySubscriptions = new q(), this.currentIndex = 0;
;(this.exactSubscriptions = new q()),
(this.fuzzySubscriptions = new I()),
(this.currentIndex = 0)
}
subscribe(t, s) {
let r;
return typeof t == "string" ? r = this.exactSubscriptions.add(
t,
s,
this.currentIndex
) : r = this.fuzzySubscriptions.add(
t,
s,
this.currentIndex
), this.currentIndex += 1, r;
let n
return (
typeof t == 'string'
? (n = this.exactSubscriptions.add(t, s, this.currentIndex))
: (n = this.fuzzySubscriptions.add(t, s, this.currentIndex)),
(this.currentIndex += 1),
n
)
}
publish(t, s) {
[
;[
...this.exactSubscriptions.matches(t),
...this.fuzzySubscriptions.matches(t)
].sort((n, o) => n.index - o.index).forEach((n) => {
n.listener(s, this.listenerOptions(t));
});
...this.fuzzySubscriptions.matches(t),
]
.sort((r, o) => r.index - o.index)
.forEach((r) => {
r.listener(s, this.listenerOptions(t))
})
}
addListenerOptions(t) {
this.options = t;
this.options = t
}

@@ -361,185 +463,212 @@ listenerOptions(t) {

...this.options,
publish: this.publish.bind(this)
};
publish: this.publish.bind(this),
}
}
}
const J = () => {
const e = new I();
return {
bus: e,
publish: (r, n) => e.publish(r, n),
subscribe: (r, n) => e.subscribe(r, n)
};
}, Me = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
ExactSubscriptions: U,
FuzzySubscriptions: q,
JaxsBus: I,
createBus: J
}, Symbol.toStringTag, { value: "Module" })), f = (e) => Array.isArray(e), v = (e) => e !== null && !f(e) && typeof e == "object", jt = (e, t) => e === t, Ot = (e, t) => Object.keys(e).length === Object.keys(t).length, Mt = (e, t) => !(v(e) && v(t)) || !Ot(e, t) ? !1 : Object.keys(e).every((s) => {
const r = e[s], n = t[s];
return E(r, n);
}), kt = (e, t) => !(f(e) && f(t)) || e.length !== t.length ? !1 : e.every((s, r) => {
const n = t[r];
return E(s, n);
}), E = (e, t) => v(e) ? Mt(e, t) : f(e) ? kt(e, t) : jt(e, t);
const H = () => {
const e = new J()
return {
bus: e,
publish: (n, r) => e.publish(n, r),
subscribe: (n, r) => e.subscribe(n, r),
}
},
ke = /* @__PURE__ */ Object.freeze(
/* @__PURE__ */ Object.defineProperty(
{
__proto__: null,
ExactSubscriptions: q,
FuzzySubscriptions: I,
JaxsBus: J,
createBus: H,
},
Symbol.toStringTag,
{ value: 'Module' },
),
),
f = (e) => Array.isArray(e),
v = (e) => e !== null && !f(e) && typeof e == 'object',
Nt = (e, t) => e === t,
St = (e, t) => Object.keys(e).length === Object.keys(t).length,
jt = (e, t) =>
!(v(e) && v(t)) || !St(e, t)
? !1
: Object.keys(e).every((s) => {
const n = e[s],
r = t[s]
return x(n, r)
}),
Ot = (e, t) =>
!(f(e) && f(t)) || e.length !== t.length
? !1
: e.every((s, n) => {
const r = t[n]
return x(s, r)
}),
x = (e, t) => (v(e) ? jt(e, t) : f(e) ? Ot(e, t) : Nt(e, t))
class g {
constructor(t) {
this.name = t.name, this.parent = t.parent, this._value = t.value, this.initialValue = structuredClone(t.value);
;(this.name = t.name),
(this.parent = t.parent),
(this._value = t.value),
(this.initialValue = structuredClone(t.value))
}
get value() {
return this._value;
return this._value
}
set value(t) {
throw new Error("Cannot set value directly. Use an updater!");
throw new Error('Cannot set value directly. Use an updater!')
}
reset() {
this._value = this.initialValue;
this._value = this.initialValue
}
update(t) {
if (typeof t == "function") {
const s = this.getUpdatedValue(t);
this.updateValue(s);
} else
this.updateValue(t);
if (typeof t == 'function') {
const s = this.getUpdatedValue(t)
this.updateValue(s)
} else this.updateValue(t)
}
updateValue(t) {
E(this._value, t) || (this._value = t, this.parent.notify(this.name));
x(this._value, t) || ((this._value = t), this.parent.notify(this.name))
}
getUpdatedValue(t) {
return t(this.value);
return t(this.value)
}
}
class x {
class A {
constructor(t) {
this.store = t;
this.store = t
}
update(t) {
this.store.update(t);
this.store.update(t)
}
reset() {
this.store.update(this.store.initialValue);
this.store.update(this.store.initialValue)
}
get value() {
return this.store.value;
return this.store.value
}
}
class H extends x {
toggle() {
const t = !this.value;
this.update(t);
class Mt extends A {
updateAttribute(t, s) {
const n = { ...this.value }
;(n[t] = s), this.update(n)
}
setTrue() {
this.update(!0);
resetAttribute(t) {
const s = { ...this.value },
n = this.store.initialValue[t]
;(s[t] = n), this.update(s)
}
setFalse() {
this.update(!1);
}
}
const Tt = (e) => new H(e);
class G extends x {
const kt = (e) => new Mt(e)
class Tt extends A {
push(t) {
const s = [...this.value, t];
this.update(s);
const s = [...this.value, t]
this.update(s)
}
pop() {
const t = [...this.value], s = t.pop();
return this.update(t), s;
const t = [...this.value],
s = t.pop()
return this.update(t), s
}
unshift(t) {
const s = [t, ...this.value];
this.update(s);
const s = [t, ...this.value]
this.update(s)
}
shift() {
const t = [...this.value], s = t.shift();
return this.update(t), s;
const t = [...this.value],
s = t.shift()
return this.update(t), s
}
addSorter(t, s) {
this[t] = () => {
this.sortBy(s);
};
this.sortBy(s)
}
}
sortBy(t) {
const s = [...this.value];
s.sort(t), this.update(s);
const s = [...this.value]
s.sort(t), this.update(s)
}
insertAt(t, s) {
const r = [...this.value];
r.splice(t, 0, s), this.update(r);
const n = [...this.value]
n.splice(t, 0, s), this.update(n)
}
remove(t) {
const s = this.value.reduce((r, n) => (n !== t && r.push(n), r), []);
this.update(s);
const s = this.value.reduce((n, r) => (r !== t && n.push(r), n), [])
this.update(s)
}
removeBy(t) {
const s = this.value.reduce((r, n) => (t(n) || r.push(n), r), []);
this.update(s);
const s = this.value.reduce((n, r) => (t(r) || n.push(r), n), [])
this.update(s)
}
}
const $t = (e) => new G(e);
class C extends x {
updateAttribute(t, s) {
const r = { ...this.value };
r[t] = s, this.update(r);
const $t = (e) => new Tt(e)
class Dt extends A {
toggle() {
const t = !this.value
this.update(t)
}
resetAttribute(t) {
const s = { ...this.value }, r = this.store.initialValue[t];
s[t] = r, this.update(s);
setTrue() {
this.update(!0)
}
setFalse() {
this.update(!1)
}
}
const Dt = (e) => new C(e), Pt = {
object: Dt,
list: $t,
boolean: Tt
}, A = "state";
class Q {
const Pt = (e) => new Dt(e),
Ft = {
object: kt,
list: $t,
boolean: Pt,
},
_ = 'state'
class G {
constructor(t) {
this.publisher = t, this.stores = {}, this.eventNamePrefix = A, this.notifications = /* @__PURE__ */ new Set(), this.inTransaction = !1;
;(this.publisher = t),
(this.stores = {}),
(this.eventNamePrefix = _),
(this.notifications = /* @__PURE__ */ new Set()),
(this.inTransaction = !1)
}
create(t, s) {
const r = new g({
const n = new g({
name: t,
parent: this,
value: s
});
return this.stores[t] = r, r;
value: s,
})
return (this.stores[t] = n), n
}
createBoolean(t, s) {
const r = this.create(t, s);
return r.updater = new H(r), r;
}
createRecord(t, s) {
const r = this.create(t, s);
return r.updater = new C(r), r;
}
createList(t, s) {
const r = this.create(t, s);
return r.updater = new G(r), r;
}
store(t) {
return this.stores[t] || new g({
name: t,
parent: this,
value: void 0
});
return (
this.stores[t] ||
new g({
name: t,
parent: this,
value: void 0,
})
)
}
get(t) {
return this.store(t).value;
return this.store(t).value
}
getAll(t) {
return t.reduce((s, r) => (s[r] = this.get(r), s), {});
return t.reduce((s, n) => ((s[n] = this.get(n)), s), {})
}
notify(t) {
this.inTransaction ? this.notifications.add(t) : this.publish(t);
this.inTransaction ? this.notifications.add(t) : this.publish(t)
}
update(t, s) {
this.store(t).update(s);
this.store(t).update(s)
}
transaction(t) {
this.inTransaction = !0, t(this.stores), this.inTransaction = !1, this.publishAll();
;(this.inTransaction = !0),
t(this.stores),
(this.inTransaction = !1),
this.publishAll()
}
publishAll() {
this.notifications.forEach((t) => {
this.publish(t);
}), this.notifications.clear();
this.publish(t)
}),
this.notifications.clear()
}

@@ -549,41 +678,58 @@ publish(t) {

state: this,
store: this.store(t)
});
store: this.store(t),
})
}
event(t) {
return `${this.eventNamePrefix}:${t}`;
return `${this.eventNamePrefix}:${t}`
}
}
const W = (e) => new Q(e), ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
State: Q,
Store: g,
createState: W,
eventName: A,
updaters: Pt
}, Symbol.toStringTag, { value: "Module" }));
const C = (e) => new G(e),
Te = /* @__PURE__ */ Object.freeze(
/* @__PURE__ */ Object.defineProperty(
{
__proto__: null,
State: G,
Store: g,
createState: C,
eventName: _,
updaters: Ft,
},
Symbol.toStringTag,
{ value: 'Module' },
),
)
class Lt {
constructor(t) {
this.setupDomEnvironment(t);
this.setupDomEnvironment(t)
}
setup() {
return this.setupBus(), this.setupState(), this.addBusOptions(), this.setRenderKit(), new R({
window: this.window,
document: this.document,
publish: this.publish,
subscribe: this.subscribe,
bus: this.bus,
state: this.state,
renderKit: this.renderKit
});
return (
this.setupBus(),
this.setupState(),
this.addBusOptions(),
this.setRenderKit(),
new U({
window: this.window,
document: this.document,
publish: this.publish,
subscribe: this.subscribe,
bus: this.bus,
state: this.state,
renderKit: this.renderKit,
})
)
}
setupDomEnvironment(t) {
t.window ? (this.window = t.window, this.document = this.window.document) : t.document ? (this.window = t.document.defaultView, this.document = t.document) : (this.window = window, this.document = document);
t.window
? ((this.window = t.window), (this.document = this.window.document))
: t.document
? ((this.window = t.document.defaultView), (this.document = t.document))
: ((this.window = window), (this.document = document))
}
setupBus() {
const { publish: t, subscribe: s, bus: r } = J();
this.publish = t, this.subscribe = s, this.bus = r;
const { publish: t, subscribe: s, bus: n } = H()
;(this.publish = t), (this.subscribe = s), (this.bus = n)
}
setupState() {
this.state = W(this.publish);
this.state = C(this.publish)
}

@@ -594,4 +740,4 @@ addBusOptions() {

document: this.document,
window: this.window
});
window: this.window,
})
}

@@ -604,395 +750,541 @@ setRenderKit() {

document: this.document,
window: this.window
};
window: this.window,
}
}
}
const Te = (e = {}) => {
const s = new Lt(e).setup();
return s.startNavigation(), s;
};
var i = /* @__PURE__ */ ((e) => (e[e.removeNode = 0] = "removeNode", e[e.insertNode = 1] = "insertNode", e[e.replaceNode = 2] = "replaceNode", e[e.removeAttribute = 3] = "removeAttribute", e[e.addAttribute = 4] = "addAttribute", e[e.updateAttribute = 5] = "updateAttribute", e[e.removeEvent = 6] = "removeEvent", e[e.addEvent = 7] = "addEvent", e[e.updateEvent = 8] = "updateEvent", e[e.changeValue = 9] = "changeValue", e[e.changeText = 10] = "changeText", e))(i || {});
const $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
ChangeInstructionTypes: i
}, Symbol.toStringTag, { value: "Module" })), Ft = (e, t) => ({
source: e,
target: t,
type: i.changeText,
data: {}
}), Bt = (e, t) => ({
source: e,
target: t,
type: i.replaceNode,
data: {}
}), zt = (e, t, s) => ({
source: e,
target: t,
data: s,
type: i.removeAttribute
}), Vt = (e, t, s) => ({
source: e,
target: t,
data: s,
type: i.addAttribute
}), Kt = (e, t, s) => ({
source: e,
target: t,
data: s,
type: i.updateAttribute
}), Rt = (e, t, s) => ({
source: e,
target: t,
data: s,
type: i.removeEvent
}), Ut = (e, t, s) => ({
source: e,
target: t,
data: s,
type: i.addEvent
}), qt = (e, t, s) => ({
source: e,
target: t,
data: s,
type: i.updateEvent
}), _ = (e) => ({
source: e,
target: e,
// for type crap only
type: i.removeNode,
data: {}
}), b = (e, t) => ({
target: e,
source: e,
// for type crap only
type: i.insertNode,
data: t
}), It = (e, t, s) => ({
source: e,
target: t,
type: i.changeValue,
data: s
}), Jt = (e, t) => e.type > t.type ? 1 : e.type < t.type ? -1 : 0, w = { index: -1 };
class Ht {
const $e = (e = {}) => {
const s = new Lt(e).setup()
return s.startNavigation(), s
}
var i = /* @__PURE__ */ ((e) => (
(e[(e.removeNode = 0)] = 'removeNode'),
(e[(e.insertNode = 1)] = 'insertNode'),
(e[(e.replaceNode = 2)] = 'replaceNode'),
(e[(e.removeAttribute = 3)] = 'removeAttribute'),
(e[(e.addAttribute = 4)] = 'addAttribute'),
(e[(e.updateAttribute = 5)] = 'updateAttribute'),
(e[(e.removeEvent = 6)] = 'removeEvent'),
(e[(e.addEvent = 7)] = 'addEvent'),
(e[(e.updateEvent = 8)] = 'updateEvent'),
(e[(e.changeValue = 9)] = 'changeValue'),
(e[(e.changeText = 10)] = 'changeText'),
e
))(i || {})
const De = /* @__PURE__ */ Object.freeze(
/* @__PURE__ */ Object.defineProperty(
{
__proto__: null,
ChangeInstructionTypes: i,
},
Symbol.toStringTag,
{ value: 'Module' },
),
),
zt = (e, t) => ({
source: e,
target: t,
type: i.changeText,
data: {},
}),
Bt = (e, t) => ({
source: e,
target: t,
type: i.replaceNode,
data: {},
}),
Vt = (e, t, s) => ({
source: e,
target: t,
data: s,
type: i.removeAttribute,
}),
Kt = (e, t, s) => ({
source: e,
target: t,
data: s,
type: i.addAttribute,
}),
Rt = (e, t, s) => ({
source: e,
target: t,
data: s,
type: i.updateAttribute,
}),
Ut = (e, t, s) => ({
source: e,
target: t,
data: s,
type: i.removeEvent,
}),
qt = (e, t, s) => ({
source: e,
target: t,
data: s,
type: i.addEvent,
}),
It = (e, t, s) => ({
source: e,
target: t,
data: s,
type: i.updateEvent,
}),
w = (e) => ({
source: e,
target: e,
// for type crap only
type: i.removeNode,
data: {},
}),
b = (e, t) => ({
target: e,
source: e,
// for type crap only
type: i.insertNode,
data: t,
}),
Jt = (e, t, s) => ({
source: e,
target: t,
type: i.changeValue,
data: s,
}),
Ht = (e, t) => (e.type > t.type ? 1 : e.type < t.type ? -1 : 0),
N = { index: -1 }
class Gt {
constructor() {
this.map = {};
this.map = {}
}
populate(t) {
t.forEach((s, r) => {
const n = s.__jsx;
n && (this.map[n] = this.map[n] || [], this.map[n].push({
element: s,
index: r
}));
});
t.forEach((s, n) => {
const r = s.__jsx
r &&
((this.map[r] = this.map[r] || []),
this.map[r].push({
element: s,
index: n,
}))
})
}
pullMatch(t) {
const s = t && t.__jsx;
return !s || !(this.map[s] && this.map[s].length) ? w : this.map[s].shift();
const s = t && t.__jsx
return !s || !(this.map[s] && this.map[s].length) ? N : this.map[s].shift()
}
clear(t) {
const s = t && t.__jsx;
if (!(s && this.map[s] && this.map[s].length)) return;
const r = this.map[s];
this.map[s] = r.reduce((n, o) => (o.element !== t && n.push(o), n), []);
const s = t && t.__jsx
if (!(s && this.map[s] && this.map[s].length)) return
const n = this.map[s]
this.map[s] = n.reduce((r, o) => (o.element !== t && r.push(o), r), [])
}
check(t) {
const s = t && t.__jsx;
return s && this.map[s] ? this.map[s].length > 0 : !1;
const s = t && t.__jsx
return s && this.map[s] ? this.map[s].length > 0 : !1
}
remaining() {
return Object.values(this.map).flat();
return Object.values(this.map).flat()
}
}
const N = (e) => {
const t = new Ht();
return t.populate(e), t;
}, X = (e, t, s = !1) => {
const r = [], n = e.attributes, o = n.length, a = t.attributes, l = a.length;
let u, d, c;
for (u = 0; u < o; u++) {
c = null;
const h = n.item(u);
if (h) {
for (d = 0; d < l; d++) {
const p = a.item(d);
if (p && h.name == p.name) {
c = p;
break;
const S = (e) => {
const t = new Gt()
return t.populate(e), t
},
Q = (e, t, s = !1) => {
const n = [],
r = e.attributes,
o = r.length,
a = t.attributes,
l = a.length
let u, d, c
for (u = 0; u < o; u++) {
c = null
const h = r.item(u)
if (h) {
for (d = 0; d < l; d++) {
const p = a.item(d)
if (p && h.name == p.name) {
c = p
break
}
}
c
? h.value !== c.value &&
n.push(
Rt(e, t, {
name: h.name,
value: c.value,
isSvg: s,
}),
)
: n.push(Vt(e, t, { name: h.name, isSvg: s }))
}
c ? h.value !== c.value && r.push(
Kt(e, t, {
name: h.name,
value: c.value,
isSvg: s
})
) : r.push(
zt(e, t, { name: h.name, isSvg: s })
);
}
}
for (u = 0; u < l; u++) {
c = null;
const h = a.item(u);
if (h) {
for (d = 0; d < o; d++) {
const p = n.item(d);
if (p && p.name == h.name) {
c = p;
break;
for (u = 0; u < l; u++) {
c = null
const h = a.item(u)
if (h) {
for (d = 0; d < o; d++) {
const p = r.item(d)
if (p && p.name == h.name) {
c = p
break
}
}
c ||
n.push(
Kt(e, t, {
name: h.name,
value: h.value,
isSvg: s,
}),
)
}
c || r.push(
Vt(e, t, {
name: h.name,
value: h.value,
isSvg: s
})
);
}
}
return r;
}, Gt = (e, t) => {
const s = [], r = e.eventMaps, n = t.eventMaps, o = Object.keys(r), a = Object.keys(n);
return o.forEach((l) => {
const u = r[l], d = n[l];
d ? d.busEvent !== u.busEvent && s.push(
qt(e, t, {
name: l,
targetValue: d.listener,
sourceValue: u.listener
})
) : s.push(
Rt(e, t, {
name: u.domEvent,
value: u.listener
})
);
}), a.forEach((l) => {
const u = r[l], d = n[l];
u || s.push(
Ut(e, t, {
name: d.domEvent,
value: d.listener
})
);
}), s;
}, Ct = (e) => e.tagName !== "INPUT", Qt = (e, t) => e.value === t.value, Wt = (e, t) => {
if (Ct(e) || Qt(e, t))
return [];
const s = e, r = t;
return [It(s, r, { name: "value", value: r.value })];
}, Xt = (e, t) => {
const s = X(e, t), r = Gt(e, t), n = Wt(e, t);
return s.concat(r).concat(n);
}, Yt = (e, t) => X(e, t, !0), Zt = (e, t) => e.textContent !== t.textContent ? [Ft(e, t)] : [], te = (e, t, s) => {
let r = [];
if (e.nodeType === 1 && at(e)) {
const n = e, o = t, a = Yt(n, o), l = s(
n.childNodes,
o.childNodes,
return n
},
Ct = (e, t) => {
const s = [],
n = e.eventMaps,
r = t.eventMaps,
o = Object.keys(n),
a = Object.keys(r)
return (
o.forEach((l) => {
const u = n[l],
d = r[l]
d
? d.busEvent !== u.busEvent &&
s.push(
It(e, t, {
name: l,
targetValue: d.listener,
sourceValue: u.listener,
}),
)
: s.push(
Ut(e, t, {
name: u.domEvent,
value: u.listener,
}),
)
}),
a.forEach((l) => {
const u = n[l],
d = r[l]
u ||
s.push(
qt(e, t, {
name: d.domEvent,
value: d.listener,
}),
)
}),
s
)
},
Qt = (e) => e.tagName !== 'INPUT',
Wt = (e, t) => e.value === t.value,
Xt = (e, t) => {
if (Qt(e) || Wt(e, t)) return []
const s = e,
n = t
return [Jt(s, n, { name: 'value', value: n.value })]
},
Yt = (e, t) => {
const s = Q(e, t),
n = Ct(e, t),
r = Xt(e, t)
return s.concat(n).concat(r)
},
Zt = (e, t) => Q(e, t, !0),
te = (e, t) => (e.textContent !== t.textContent ? [zt(e, t)] : []),
ee = (e, t, s) => {
let n = []
if (e.nodeType === 1 && it(e)) {
const r = e,
o = t,
a = Zt(r, o),
l = s(r.childNodes, o.childNodes, r)
n = a.concat(l)
} else if (e.nodeType === 1) {
const r = e,
o = t,
a = Yt(r, o),
l = s(r.childNodes, o.childNodes, r)
n = a.concat(l)
} else e.nodeType === 3 && (n = te(e, t))
return n
},
W = (e, t, s) => {
const n = [],
r = se(e, t),
o = S(e),
a = S(t),
l = []
let u = 0
for (; u < r; u++) {
const c = e[u],
h = t[u]
if (h && a.check(h)) {
const p = o.pullMatch(h)
a.clear(h),
p.element
? (p.index !== u &&
n.push(
b(p.element, {
parent: s,
index: u,
}),
),
l.push({
source: p.element,
target: h,
}))
: c
? a.check(c)
? n.push(b(h, { parent: s, index: u }))
: (o.clear(c), n.push(Bt(c, h)))
: n.push(b(h, { parent: s, index: u }))
} else c && o.pullMatch(c).element && n.push(w(c))
}
o.remaining().forEach(({ element: c }) => {
n.push(w(c))
})
const d = l.reduce(
(c, { source: h, target: p }) => c.concat(ee(h, p, W)),
[],
)
return n.concat(d).sort(Ht)
},
se = (e, t) => {
const s = e.length,
n = t.length
return s > n ? s : n
},
ne = (e, t, s) => {
const n = W(e, t, s)
return (
n.forEach((r) => {
re(r)
}),
n
);
r = a.concat(l);
} else if (e.nodeType === 1) {
const n = e, o = t, a = Xt(n, o), l = s(
n.childNodes,
o.childNodes,
)
},
re = (e) => {
;(be[e.type] || oe)(e)
},
oe = (e) => {},
ie = (e) => {
const { source: t, target: s } = e
t.nodeValue = s.textContent
},
ue = (e) => {
const { source: t } = e
t.remove()
},
ae = (e) => {
const { target: t, data: s } = e,
{ parent: n, index: r } = s,
o = n.childNodes[r]
o ? o && o !== t && n.insertBefore(t, o) : n.appendChild(t)
},
ce = (e) => {
const { source: t, target: s } = e
t.replaceWith(s)
},
le = (e) => {
const { source: t, data: s } = e,
{ name: n, isSvg: r } = s
r ? t.removeAttributeNS(null, n) : t.removeAttribute(n)
},
X = (e) => {
const { source: t, data: s } = e,
{ name: n, value: r, isSvg: o } = s
o ? t.setAttributeNS(null, n, r) : t.setAttribute(n, r)
},
he = (e) => {
X(e)
},
de = (e) => {
const t = e.data,
s = e.source,
{ name: n, value: r } = t
s.removeEventListener(n, r)
},
pe = (e) => {
const t = e.data,
s = e.source,
{ name: n, value: r } = t
s.addEventListener(n, r)
},
me = (e) => {
const t = e.data,
s = e.source,
{ name: n, sourceValue: r, targetValue: o } = t
s.removeEventListener(n, r), s.addEventListener(n, o)
},
fe = (e) => {
const t = e.data,
s = e.source,
{ value: n } = t
s.value = n
},
be = {
[i.changeText]: ie,
[i.removeNode]: ue,
[i.insertNode]: ae,
[i.replaceNode]: ce,
[i.removeAttribute]: le,
[i.addAttribute]: X,
[i.updateAttribute]: he,
[i.removeEvent]: de,
[i.addEvent]: pe,
[i.updateEvent]: me,
[i.changeValue]: fe,
},
ve = (e, t, s) => {
const n = [...t]
return (
e.forEach((r) => {
ge(r, n, s)
}),
n
);
r = a.concat(l);
} else e.nodeType === 3 && (r = Zt(e, t));
return r;
}, Y = (e, t, s) => {
const r = [], n = ee(e, t), o = N(e), a = N(t), l = [];
let u = 0;
for (; u < n; u++) {
const c = e[u], h = t[u];
if (h && a.check(h)) {
const p = o.pullMatch(h);
a.clear(h), p.element ? (p.index !== u && r.push(
b(p.element, {
parent: s,
index: u
})
), l.push({
source: p.element,
target: h
})) : c ? a.check(c) ? r.push(
b(h, { parent: s, index: u })
) : (o.clear(c), r.push(
Bt(c, h)
)) : r.push(
b(h, { parent: s, index: u })
);
} else c && o.pullMatch(c).element && r.push(_(c));
)
},
ge = (e, t, s) => {
const n = Ae[e.type]
n && n(e, t, s)
},
ye = (e, t) => {
const { source: s } = e,
n = t.indexOf(s)
n >= 0 && t.splice(n, 1)
},
Ee = (e, t, s) => {
const { target: n } = e,
r = e.data,
{ index: o, parent: a } = r
s === a && t.splice(o, 0, n)
},
xe = (e, t) => {
const { target: s, source: n } = e,
r = t.indexOf(n)
r >= 0 && (t[r] = s)
},
Ae = {
[i.removeNode]: ye,
[i.insertNode]: Ee,
[i.replaceNode]: xe,
}
o.remaining().forEach(({ element: c }) => {
r.push(_(c));
});
const d = l.reduce(
(c, { source: h, target: p }) => c.concat(
te(h, p, Y)
),
[]
);
return r.concat(d).sort(Jt);
}, ee = (e, t) => {
const s = e.length, r = t.length;
return s > r ? s : r;
}, se = (e, t, s) => {
const r = Y(e, t, s);
return r.forEach((n) => {
re(n);
}), r;
}, re = (e) => {
(fe[e.type] || ne)(e);
}, ne = (e) => {
}, oe = (e) => {
const { source: t, target: s } = e;
t.nodeValue = s.textContent;
}, ie = (e) => {
const { source: t } = e;
t.remove();
}, ue = (e) => {
const { target: t, data: s } = e, { parent: r, index: n } = s, o = r.childNodes[n];
o ? o && o !== t && r.insertBefore(t, o) : r.appendChild(t);
}, ae = (e) => {
const { source: t, target: s } = e;
t.replaceWith(s);
}, ce = (e) => {
const { source: t, data: s } = e, { name: r, isSvg: n } = s;
n ? t.removeAttributeNS(null, r) : t.removeAttribute(r);
}, Z = (e) => {
const { source: t, data: s } = e, { name: r, value: n, isSvg: o } = s;
o ? t.setAttributeNS(null, r, n) : t.setAttribute(r, n);
}, le = (e) => {
Z(e);
}, he = (e) => {
const t = e.data, s = e.source, { name: r, value: n } = t;
s.removeEventListener(r, n);
}, de = (e) => {
const t = e.data, s = e.source, { name: r, value: n } = t;
s.addEventListener(r, n);
}, pe = (e) => {
const t = e.data, s = e.source, { name: r, sourceValue: n, targetValue: o } = t;
s.removeEventListener(r, n), s.addEventListener(r, o);
}, me = (e) => {
const t = e.data, s = e.source, { value: r } = t;
s.value = r;
}, fe = {
[i.changeText]: oe,
[i.removeNode]: ie,
[i.insertNode]: ue,
[i.replaceNode]: ae,
[i.removeAttribute]: ce,
[i.addAttribute]: Z,
[i.updateAttribute]: le,
[i.removeEvent]: he,
[i.addEvent]: de,
[i.updateEvent]: pe,
[i.changeValue]: me
}, be = (e, t, s) => {
const r = [...t];
return e.forEach((n) => {
ve(n, r, s);
}), r;
}, ve = (e, t, s) => {
const r = xe[e.type];
r && r(e, t, s);
}, ge = (e, t) => {
const { source: s } = e, r = t.indexOf(s);
r >= 0 && t.splice(r, 1);
}, ye = (e, t, s) => {
const { target: r } = e, n = e.data, { index: o, parent: a } = n;
s === a && t.splice(o, 0, r);
}, Ee = (e, t) => {
const { target: s, source: r } = e, n = t.indexOf(r);
n >= 0 && (t[n] = s);
}, xe = {
[i.removeNode]: ge,
[i.insertNode]: ye,
[i.replaceNode]: Ee
};
class Ae {
constructor({ Template: t, subscriptions: s, attributes: r, viewModel: n }) {
this.Template = t, this.viewModel = n, this.attributes = r, this.subscriptions = s, this.dom = [], this.parentElement = null;
class _e {
constructor({ Template: t, subscriptions: s, attributes: n, viewModel: r }) {
;(this.Template = t),
(this.viewModel = r),
(this.attributes = n),
(this.subscriptions = s),
(this.dom = []),
(this.parentElement = null)
}
render(t) {
return this.parentElement = t.parent, this.renderKit = t, this.subscribeForRerender(), this.dom = this.generateDom(t), this.dom;
return (
(this.parentElement = t.parent),
(this.renderKit = t),
this.subscribeForRerender(),
(this.dom = this.generateDom(t)),
this.dom
)
}
generateDom(t) {
const s = {
...this.attributes,
...this.viewModel(
t.state.getAll(this.subscriptions)
)
}, r = this.Template(s);
return r ? r.render(t) : [];
...this.attributes,
...this.viewModel(t.state.getAll(this.subscriptions)),
},
n = this.Template(s)
return n ? n.render(t) : []
}
rerender() {
if (!this.parentElement && this.dom[0]) {
const r = this.dom[0].parentElement;
this.parentElement = r;
const n = this.dom[0].parentElement
this.parentElement = n
}
const t = this.generateDom(this.renderKit), s = se(
this.dom,
t,
this.parentElement
);
this.dom = be(
s,
this.dom,
this.parentElement
);
const t = this.generateDom(this.renderKit),
s = ne(this.dom, t, this.parentElement)
this.dom = ve(s, this.dom, this.parentElement)
}
subscribeForRerender() {
const { subscribe: t } = this.renderKit;
const { subscribe: t } = this.renderKit
this.subscriptions.forEach((s) => {
t(this.eventName(s), () => this.rerender());
});
t(this.eventName(s), () => this.rerender())
})
}
eventName(t) {
return `${A}:${t}`;
return `${_}:${t}`
}
}
const _e = (e) => e, we = ({
Template: e,
viewModel: t,
subscriptions: s
}) => (s = s || [], t = t || _e, (r) => new Ae({ Template: e, viewModel: t, subscriptions: s, attributes: r })), De = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
createRouteState: T,
events: Nt,
extractQueryParams: L,
findHref: $,
navigate: D,
onLinkClick: P,
onLocationChange: F,
start: St
}, Symbol.toStringTag, { value: "Module" })), Ne = (e) => ({ path: t }) => t === e, Se = () => !0, tt = (e) => ({ route: t }) => {
const s = e.find((r) => r.match(t));
return s && s.Partial;
}, Pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
buildRouter: tt,
catchAll: Se,
exactPathMatch: Ne
}, Symbol.toStringTag, { value: "Module" })), je = () => ({
render: (e, t) => []
}), Le = (e) => {
const t = tt(e);
return we({ Template: ({ route: r }) => (t({ route: r }) || je)(), subscriptions: ["route"] });
};
const we = (e) => e,
Ne = ({ Template: e, viewModel: t, subscriptions: s }) => (
(s = s || []),
(t = t || we),
(n) =>
new _e({ Template: e, viewModel: t, subscriptions: s, attributes: n })
),
Pe = /* @__PURE__ */ Object.freeze(
/* @__PURE__ */ Object.defineProperty(
{
__proto__: null,
createRouteState: D,
events: _t,
extractQueryParams: L,
findHref: P,
navigate: E,
onLinkClick: F,
onLocationChange: z,
start: wt,
},
Symbol.toStringTag,
{ value: 'Module' },
),
),
Se =
(e) =>
({ path: t }) =>
t === e,
je = () => !0,
Y =
(e) =>
({ route: t }) => {
const s = e.find((n) => n.match(t))
return s && s.Partial
},
Fe = /* @__PURE__ */ Object.freeze(
/* @__PURE__ */ Object.defineProperty(
{
__proto__: null,
buildRouter: Y,
catchAll: je,
exactPathMatch: Se,
},
Symbol.toStringTag,
{ value: 'Module' },
),
),
Oe = () => ({
render: (e, t) => [],
}),
Le = (e) => {
const t = Y(e)
return Ne({
Template: ({ route: n }) => (t({ route: n }) || Oe)(),
subscriptions: ['route'],
})
}
export {
$e as JaxsTypes,
Oe as appBuilding,
we as bind,
Te as createApp,
At as jsx,
Me as messageBus,
De as navigation,
De as JaxsTypes,
Me as appBuilding,
Ne as bind,
$e as createApp,
Et as jsx,
ke as messageBus,
Pe as navigation,
Le as routedView,
Pe as routing,
ke as state
};
Fe as routing,
Te as state,
}

@@ -5,3 +5,3 @@ {

"private": false,
"version": "0.6.0",
"version": "0.6.2",
"type": "module",

@@ -8,0 +8,0 @@ "scripts": {

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