diff --git a/.vscode/settings.json b/.vscode/settings.json
index fc6ec6c..2df65db 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,5 +1,5 @@
{
"search.exclude": {
- "**/api-document": true
+ "**/api-documents": true
}
}
diff --git a/api-documents/kit.watcher.enablesinglemode.md b/api-documents/kit.watcher.enablesinglemode.md
index 8338b9a..18cdafc 100644
--- a/api-documents/kit.watcher.enablesinglemode.md
+++ b/api-documents/kit.watcher.enablesinglemode.md
@@ -6,8 +6,6 @@
Enable single mode.
-Subclass need to implement it to get the correct type.
-
Signature:
```typescript
@@ -17,15 +15,3 @@ abstract enableSingleMode(): Watcher;
`Watcher`
-## Remarks
-
-Example to subclass implementor:
-
-```ts
-class MyWatcher
-extends Watcher {
- public enableSingleMode: MyWatcher = this.__enableSingleMode as any
-}
-
-```
-
diff --git a/api-documents/kit.watcher.md b/api-documents/kit.watcher.md
index db90f6d..30373c7 100644
--- a/api-documents/kit.watcher.md
+++ b/api-documents/kit.watcher.md
@@ -60,7 +60,7 @@ export declare abstract class WatcherSubclass need to implement it to get the correct type. |
+| [enableSingleMode()](./kit.watcher.enablesinglemode.md) | | Enable single mode. |
| [getVirtualNodeByKey(key)](./kit.watcher.getvirtualnodebykey.md) | | Get virtual node by key. Virtual node will be unavailable if it is deleted |
| [omitWarningForRepeatedKeys()](./kit.watcher.omitwarningforrepeatedkeys.md) | | If you're expecting repeating keys, call this function, this will omit the warning. |
| [removeListener(event, fn)](./kit.watcher.removelistener.md) | | |
diff --git a/api-extractor.json b/api-extractor.json
index b2d5de1..bf711f9 100644
--- a/api-extractor.json
+++ b/api-extractor.json
@@ -94,7 +94,7 @@
/**
* (REQUIRED) Whether to generate an API report.
*/
- "enabled": false
+ "enabled": true,
/**
* The filename for the API report files. It will be combined with "reportFolder" or "reportTempFolder" to produce
@@ -105,7 +105,7 @@
* SUPPORTED TOKENS: ,
* DEFAULT VALUE: ".api.md"
*/
- // "reportFileName": ".api.md",
+ "reportFileName": "holoflows-kit.api.report.md",
/**
* Specifies the folder where the API report file is written. The file name portion is determined by
@@ -120,7 +120,7 @@
* SUPPORTED TOKENS: , ,
* DEFAULT VALUE: "/etc/"
*/
- // "reportFolder": "/etc/",
+ "reportFolder": "/doc"
/**
* Specifies the folder where the temporary report file is written. The file name portion is determined by
diff --git a/doc/holoflows-kit.api.report.md b/doc/holoflows-kit.api.report.md
new file mode 100644
index 0000000..398ab75
--- /dev/null
+++ b/doc/holoflows-kit.api.report.md
@@ -0,0 +1,303 @@
+## API Report File for "@holoflows/kit"
+
+> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
+
+```ts
+
+import { EventEmitter } from 'events';
+
+// Warning: (ae-forgotten-export) The symbol "Default" needs to be exported by the entry point index.d.ts
+//
+// @public
+export function AsyncCall(implementation: Default, options?: Partial): OtherSideImplementedFunctions;
+
+// @alpha
+export interface AsyncCallExecutorOptions extends Partial<{
+ memorable: number;
+}> {
+}
+
+// @public
+export interface AsyncCallOptions {
+ // (undocumented)
+ dontThrowOnNotImplemented: boolean;
+ // (undocumented)
+ key: string;
+ // (undocumented)
+ MessageCenter: {
+ new (): {
+ on(event: string, cb: (data: any) => void): void;
+ send(event: string, data: any): void;
+ };
+ };
+ // (undocumented)
+ serializer: Serialization;
+ strictJSONRPC: boolean;
+ // (undocumented)
+ writeToConsole: boolean;
+}
+
+// @public
+export function AutomatedTabTask Promise>>(taskImplements: T, options?: Partial): ((url: string, options?: Partial) => T) | null;
+
+// Warning: (ae-forgotten-export) The symbol "AutomatedTabTaskSharedOptions" needs to be exported by the entry point index.d.ts
+//
+// @public
+export interface AutomatedTabTaskDefineTimeOptions extends AutomatedTabTaskSharedOptions {
+ concurrent: number;
+ key: string;
+ memorizeTTL: number;
+}
+
+// @public
+export interface AutomatedTabTaskRuntimeOptions extends AutomatedTabTaskSharedOptions {
+ important: boolean;
+ needRedirect: boolean;
+ runAtTabID: number;
+}
+
+// @public
+export type Contexts = 'background' | 'content' | 'webpage' | 'unknown' | 'options' | 'debugging';
+
+// @public
+export function DomProxy(options?: Partial>): DomProxy;
+
+// @public
+export interface DomProxy {
+ readonly after: After;
+ readonly afterShadow: ShadowRoot;
+ readonly before: Before;
+ readonly beforeShadow: ShadowRoot;
+ readonly current: ProxiedElement;
+ destroy(): void;
+ has(type: 'before'): Before | null;
+ has(type: 'after'): After | null;
+ has(type: 'beforeShadow' | 'afterShadow'): ShadowRoot | null;
+ readonly observer: {
+ readonly observer: MutationObserver | null;
+ callback: MutationCallback | undefined;
+ init: MutationObserverInit | undefined;
+ };
+ realCurrent: ProxiedElement | null;
+}
+
+// @public
+export interface DomProxyOptions {
+ afterShadowRootInit: ShadowRootInit;
+ beforeShadowRootInit: ShadowRootInit;
+ createAfter(): After;
+ createBefore(): Before;
+}
+
+// @public
+export class EventWatcher extends Watcher {
+ constructor(liveSelector: LiveSelector);
+ // (undocumented)
+ enableSingleMode: () => EventWatcher;
+ eventListener: () => void;
+}
+
+// @public
+export function GetContext(): Contexts;
+
+// @public
+export class IntervalWatcher extends Watcher {
+ // (undocumented)
+ enableSingleMode: () => IntervalWatcher;
+ startWatch(interval: number): this;
+ // (undocumented)
+ stopWatch(): void;
+ }
+
+// @public
+export const JSONSerialization: (replacer?: ((this: any, key: string, value: any) => any) | undefined) => Serialization;
+
+// @public
+export class LiveSelector {
+ clone(): LiveSelector;
+ closest(parentOfNth: number): LiveSelector;
+ // (undocumented)
+ closest(selectors: K): LiveSelector;
+ // (undocumented)
+ closest(selectors: K): LiveSelector;
+ // (undocumented)
+ closest(selectors: string): LiveSelector;
+ concat(newEle: LiveSelector): LiveSelector;
+ enableSingleMode(): LiveSelector;
+ evaluateOnce(): SingleMode extends true ? (T | undefined) : T[];
+ filter(f: (value: T, index: number, array: T[]) => any): LiveSelector, SingleMode>;
+ flat(): LiveSelector ? U : never, SingleMode>;
+ getElementsByClassName(className: string): LiveSelector;
+ getElementsByTagName(tag: K): LiveSelector;
+ // (undocumented)
+ getElementsByTagName(tag: K): LiveSelector;
+ // (undocumented)
+ getElementsByTagName(tag: string): LiveSelector;
+ map(callbackfn: (element: T, index: number, array: T[]) => NextType): LiveSelector, SingleMode>;
+ nth(n: number): LiveSelector;
+ querySelector(selector: K): LiveSelector;
+ // (undocumented)
+ querySelector(selector: K): LiveSelector;
+ // (undocumented)
+ querySelector(selector: string): LiveSelector;
+ querySelectorAll(selector: K): LiveSelector;
+ // (undocumented)
+ querySelectorAll(selector: K): LiveSelector;
+ // (undocumented)
+ querySelectorAll(selector: string): LiveSelector;
+ replace(f: (arr: T[]) => NextType[]): LiveSelector;
+ reverse(): LiveSelector;
+ slice(start?: number, end?: number): LiveSelector;
+ sort(compareFn?: (a: T, b: T) => number): LiveSelector;
+ // (undocumented)
+ protected readonly stack: string | undefined;
+}
+
+// @public
+export class MessageCenter {
+ constructor(instanceKey?: string);
+ on(event: Key, handler: (data: ITypedMessages[Key]) => void): void;
+ send(key: Key, data: ITypedMessages[Key], alsoSendToDocument?: boolean): void;
+ // (undocumented)
+ writeToConsole: boolean;
+}
+
+// @public
+export class MutationObserverWatcher extends Watcher {
+ constructor(liveSelector: LiveSelector,
+ consistentWatchRoot?: Node);
+ // (undocumented)
+ enableSingleMode: () => MutationObserverWatcher;
+ // (undocumented)
+ protected liveSelector: LiveSelector;
+ // (undocumented)
+ startWatch(options?: MutationObserverInit): this;
+ // (undocumented)
+ stopWatch(): void;
+}
+
+// @public
+export const NoSerialization: Serialization;
+
+// @public
+export function OnlyRunInContext(context: Contexts | Contexts[], name: string): void;
+
+// @public (undocumented)
+export function OnlyRunInContext(context: Contexts | Contexts[], throws: false): boolean;
+
+// @public
+export interface Serialization {
+ // (undocumented)
+ deserialization(serialized: unknown): Promise;
+ // (undocumented)
+ serialization(from: any): Promise;
+}
+
+// @public
+export class ValueRef {
+ constructor(_value: T);
+ // Warning: (ae-forgotten-export) The symbol "Fn" needs to be exported by the entry point index.d.ts
+ addListener(fn: Fn): () => void;
+ removeAllListener(): void;
+ removeListener(fn: Fn): void;
+ value: T;
+ }
+
+// Warning: (ae-forgotten-export) The symbol "ResultOf" needs to be exported by the entry point index.d.ts
+//
+// @public
+export abstract class Watcher implements PromiseLike> {
+ constructor(liveSelector: LiveSelector);
+ // Warning: (ae-forgotten-export) The symbol "EventCallback" needs to be exported by the entry point index.d.ts
+ // Warning: (ae-forgotten-export) The symbol "OnIterationEvent" needs to be exported by the entry point index.d.ts
+ //
+ // (undocumented)
+ addListener(event: 'onIteration', fn: EventCallback>): this;
+ // Warning: (ae-forgotten-export) The symbol "OnChangeEvent" needs to be exported by the entry point index.d.ts
+ //
+ // (undocumented)
+ addListener(event: 'onChange', fn: EventCallback>): this;
+ // Warning: (ae-forgotten-export) The symbol "OnAddOrRemoveEvent" needs to be exported by the entry point index.d.ts
+ //
+ // (undocumented)
+ addListener(event: 'onRemove', fn: EventCallback>): this;
+ // (undocumented)
+ addListener(event: 'onAdd', fn: EventCallback>): this;
+ assignKeys(keyAssigner: (node: T, index: number, arr: readonly T[]) => Q): this;
+ // (undocumented)
+ protected domProxyOption: Partial>;
+ // (undocumented)
+ protected emit(event: 'onIteration', data: OnIterationEvent): boolean;
+ // (undocumented)
+ protected emit(event: 'onChange', data: OnChangeEvent): boolean;
+ // (undocumented)
+ protected emit(event: 'onRemove', data: OnAddOrRemoveEvent): boolean;
+ // (undocumented)
+ protected emit(event: 'onAdd', data: OnAddOrRemoveEvent): boolean;
+ enableBatchMode(): this;
+ abstract enableSingleMode(): Watcher;
+ // (undocumented)
+ protected _enableSingleMode(): this;
+ protected readonly eventEmitter: EventEmitter;
+ protected findNodeFromListByKey: (list: readonly T[], keys: readonly unknown[]) => (key: unknown) => T | null;
+ readonly firstVirtualNode: T extends Element ? DomProxy : never;
+ // (undocumented)
+ protected _firstVirtualNode: DomProxy;
+ getVirtualNodeByKey(key: unknown): DomProxy | null;
+ protected isWatching: boolean;
+ protected keyComparer: (a: unknown, b: unknown) => boolean;
+ // Warning: (ae-forgotten-export) The symbol "useForeachReturns" needs to be exported by the entry point index.d.ts
+ protected lastCallbackMap: Map>;
+ protected lastKeyList: readonly unknown[];
+ protected lastNodeList: readonly T[];
+ protected lastVirtualNodesMap: Map>;
+ // (undocumented)
+ protected liveSelector: LiveSelector;
+ protected mapNodeToKey: (node: T, index: number, arr: readonly T[]) => unknown;
+ omitWarningForRepeatedKeys(): this;
+ // (undocumented)
+ removeListener(event: 'onIteration', fn: EventCallback>): this;
+ // (undocumented)
+ removeListener(event: 'onChange', fn: EventCallback>): this;
+ // (undocumented)
+ removeListener(event: 'onRemove', fn: EventCallback>): this;
+ // (undocumented)
+ removeListener(event: 'onAdd', fn: EventCallback>): this;
+ // Warning: (ae-forgotten-export) The symbol "requestIdleCallback" needs to be exported by the entry point index.d.ts
+ //
+ // (undocumented)
+ protected readonly requestIdleCallback: typeof requestIdleCallback;
+ // Warning: (ae-forgotten-export) The symbol "Deadline" needs to be exported by the entry point index.d.ts
+ //
+ // (undocumented)
+ protected scheduleWatcherCheck: (deadline?: Deadline | undefined) => void;
+ setComparer(keyComparer?: (a: Q, b: Q) => boolean, valueComparer?: (a: T, b: T) => boolean): this;
+ setDomProxyOption(option: Partial>): this;
+ // (undocumented)
+ protected singleMode: boolean;
+ protected singleModeCallback?: useForeachReturns;
+ protected singleModeHasLastValue: boolean;
+ protected singleModeLastValue?: T;
+ startWatch(...args: any[]): this;
+ stopWatch(...args: any[]): void;
+ then, TResult2 = never>(onfulfilled?: ((value: ResultOf) => TResult1 | PromiseLike) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null, options?: {
+ minimalResultsRequired?: number;
+ }, starter?: (this: this, self: this) => void): Promise;
+ useForeach(forEachFunction: useForeachFn): this;
+ // Warning: (ae-forgotten-export) The symbol "useForeachFn" needs to be exported by the entry point index.d.ts
+ protected useForeachFn?: useForeachFn;
+ protected valueComparer: (a: T, b: T) => boolean;
+ // (undocumented)
+ protected _warning_forget_watch_: {
+ warn(f?: (stack: string) => void): void;
+ ignored: boolean;
+ stack?: undefined;
+ } | {
+ ignored: boolean;
+ stack: string;
+ warn(f?: (stack: string) => void): void;
+ };
+ }
+
+
+```
diff --git a/src/DOM/Watcher.ts b/src/DOM/Watcher.ts
index 46bf19c..6c8ffae 100644
--- a/src/DOM/Watcher.ts
+++ b/src/DOM/Watcher.ts
@@ -350,14 +350,14 @@ export abstract class Watcher
* extends Watcher {
- * public enableSingleMode: MyWatcher = this.__enableSingleMode as any
+ * public enableSingleMode: MyWatcher = this._enableSingleMode as any
* }
* ```
*/