@but212/atom-effect-jquery 0.31.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -28
- package/dist/atom-effect-jquery.min.js +9 -5
- package/dist/atom-effect-jquery.min.js.map +1 -1
- package/dist/bindings/chainable.d.ts +2 -0
- package/dist/bindings/chainable.d.ts.map +1 -0
- package/dist/bindings/form.d.ts +29 -0
- package/dist/bindings/form.d.ts.map +1 -0
- package/dist/bindings/input-binding.d.ts +31 -0
- package/dist/bindings/input-binding.d.ts.map +1 -0
- package/dist/bindings/list/context.d.ts +61 -0
- package/dist/bindings/list/context.d.ts.map +1 -0
- package/dist/bindings/list/diff.d.ts +32 -0
- package/dist/bindings/list/diff.d.ts.map +1 -0
- package/dist/bindings/list/dom.d.ts +63 -0
- package/dist/bindings/list/dom.d.ts.map +1 -0
- package/dist/bindings/list/index.d.ts +2 -0
- package/dist/bindings/list/index.d.ts.map +1 -0
- package/dist/bindings/list/types.d.ts +93 -0
- package/dist/bindings/list/types.d.ts.map +1 -0
- package/dist/bindings/list/utils.d.ts +33 -0
- package/dist/bindings/list/utils.d.ts.map +1 -0
- package/dist/bindings/mount.d.ts +2 -0
- package/dist/bindings/mount.d.ts.map +1 -0
- package/dist/bindings/unified.d.ts +135 -0
- package/dist/bindings/unified.d.ts.map +1 -0
- package/dist/constants.d.ts +108 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/core/dom.d.ts +26 -0
- package/dist/core/dom.d.ts.map +1 -0
- package/dist/core/effect-factory.d.ts +34 -0
- package/dist/core/effect-factory.d.ts.map +1 -0
- package/dist/core/jquery-patch.d.ts +12 -0
- package/dist/core/jquery-patch.d.ts.map +1 -0
- package/dist/core/namespace.d.ts +11 -0
- package/dist/core/namespace.d.ts.map +1 -0
- package/dist/core/navigation.d.ts +172 -0
- package/dist/core/navigation.d.ts.map +1 -0
- package/dist/core/registry.d.ts +189 -0
- package/dist/core/registry.d.ts.map +1 -0
- package/dist/core/symbols.d.ts +33 -0
- package/dist/core/symbols.d.ts.map +1 -0
- package/dist/features/fetch.d.ts +2 -0
- package/dist/features/fetch.d.ts.map +1 -0
- package/dist/features/nav.d.ts +23 -0
- package/dist/features/nav.d.ts.map +1 -0
- package/dist/features/route/core.d.ts +83 -0
- package/dist/features/route/core.d.ts.map +1 -0
- package/dist/features/route/index.d.ts +43 -0
- package/dist/features/route/index.d.ts.map +1 -0
- package/dist/features/route/router.d.ts +74 -0
- package/dist/features/route/router.d.ts.map +1 -0
- package/dist/features/route/types.d.ts +60 -0
- package/dist/features/route/types.d.ts.map +1 -0
- package/dist/features/route/view.d.ts +116 -0
- package/dist/features/route/view.d.ts.map +1 -0
- package/dist/features/web-component/index.d.ts +33 -0
- package/dist/features/web-component/index.d.ts.map +1 -0
- package/dist/features/web-component/setup.d.ts +77 -0
- package/dist/features/web-component/setup.d.ts.map +1 -0
- package/dist/features/web-component/state.d.ts +47 -0
- package/dist/features/web-component/state.d.ts.map +1 -0
- package/dist/features/web-component/utils.d.ts +13 -0
- package/dist/features/web-component/utils.d.ts.map +1 -0
- package/dist/index.cjs +9 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +30 -230
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +3127 -2967
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +476 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/debug.d.ts +40 -0
- package/dist/utils/debug.d.ts.map +1 -0
- package/dist/utils/index.d.ts +51 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/sanitize.d.ts +52 -0
- package/dist/utils/sanitize.d.ts.map +1 -0
- package/package.json +10 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chainable.d.ts","sourceRoot":"","sources":["../../src/bindings/chainable.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { WritableAtom } from '@but212/atom-effect';
|
|
2
|
+
import { FormOptions } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Establishes a two-way reactive binding between a `<form>` and an object atom.
|
|
5
|
+
*
|
|
6
|
+
* When to use:
|
|
7
|
+
* - Recommended for synchronizing standard HTML forms with complex, nested
|
|
8
|
+
* reactive state objects.
|
|
9
|
+
* - Suitable for scenarios requiring declarative validation integrated with
|
|
10
|
+
* browser-native APIs.
|
|
11
|
+
*
|
|
12
|
+
* @param form - The target form element to bind.
|
|
13
|
+
* @param atom - A writable atom containing the state model.
|
|
14
|
+
* @param options - Configuration for transformations and reactive validation.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const user = $.atom({ profile: { name: 'Alice' }, items: [] });
|
|
19
|
+
*
|
|
20
|
+
* $.bindForm($('form')[0], user, {
|
|
21
|
+
* validation: {
|
|
22
|
+
* 'profile.name': (v) => v ? true : 'Name is required'
|
|
23
|
+
* },
|
|
24
|
+
* onChange: (path, val) => console.log(`${path} changed to ${val}`)
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function bindForm<T extends object>(form: HTMLFormElement, atom: WritableAtom<T>, options?: FormOptions<unknown>): void;
|
|
29
|
+
//# sourceMappingURL=form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../src/bindings/form.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAI7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AA0S3C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EACvC,IAAI,EAAE,eAAe,EACrB,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,EACrB,OAAO,GAAE,WAAW,CAAC,OAAO,CAAM,GACjC,IAAI,CAGN"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { EffectObject, ValOptions, WritableAtom } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Applies a two-way reactive binding to a form input element.
|
|
4
|
+
*
|
|
5
|
+
* This function handles text inputs, textareas, and select menus, ensuring
|
|
6
|
+
* stability during IME composition and maintaining cursor positions during
|
|
7
|
+
* background state updates.
|
|
8
|
+
*
|
|
9
|
+
* When to use:
|
|
10
|
+
* - To synchronize a form control with a `WritableAtom` state.
|
|
11
|
+
* - To implement debounced or custom-formatted input fields.
|
|
12
|
+
*
|
|
13
|
+
* @param $element - The jQuery collection containing the target form element.
|
|
14
|
+
* @param atom - The writable atom to synchronize with.
|
|
15
|
+
* @param options - Configuration for debouncing, event triggers, and data transformation.
|
|
16
|
+
* @returns A handle containing the reactive effect and a cleanup function.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const name = atom('John');
|
|
21
|
+
* const { cleanup } = applyInputBinding($('#name-input'), name, {
|
|
22
|
+
* debounce: 200,
|
|
23
|
+
* format: (v) => v.toUpperCase()
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function applyInputBinding<T>($element: JQuery, atom: WritableAtom<T>, options: ValOptions<T>): {
|
|
28
|
+
reactiveEffect: EffectObject;
|
|
29
|
+
cleanup: () => void;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=input-binding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-binding.d.ts","sourceRoot":"","sources":["../../src/bindings/input-binding.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AA+QtE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,EACrB,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,GACrB;IAAE,cAAc,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CAMvD"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { EffectObject, ListKey } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Manages the reconciliation state and lifecycle for the `$.fn.atomList` binding.
|
|
4
|
+
*
|
|
5
|
+
* This context tracks historical DOM nodes and keys to enable efficient diffing.
|
|
6
|
+
* Its primary responsibility is coordinating asynchronous item removals (e.g., animations)
|
|
7
|
+
* while ensuring that elements reused in the same cycle are not accidentally destroyed.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare class ListContext<T> {
|
|
12
|
+
readonly $container: JQuery;
|
|
13
|
+
readonly containerSelector: string;
|
|
14
|
+
readonly onRemove: (($el: JQuery) => Promise<void> | void) | undefined;
|
|
15
|
+
private _oldKeys;
|
|
16
|
+
private _oldItems;
|
|
17
|
+
private _oldNodes;
|
|
18
|
+
private readonly _removingKeys;
|
|
19
|
+
private _emptyEl;
|
|
20
|
+
private readonly _keyToIndex;
|
|
21
|
+
fx?: EffectObject;
|
|
22
|
+
constructor($container: JQuery, containerSelector: string, onRemove: (($el: JQuery) => Promise<void> | void) | undefined);
|
|
23
|
+
get oldKeys(): ListKey[];
|
|
24
|
+
set oldKeys(v: ListKey[]);
|
|
25
|
+
get oldItems(): T[];
|
|
26
|
+
set oldItems(v: T[]);
|
|
27
|
+
get oldNodes(): (Element | JQuery<HTMLElement> | undefined)[];
|
|
28
|
+
set oldNodes(v: (Element | JQuery<HTMLElement> | undefined)[]);
|
|
29
|
+
get removingKeys(): Set<ListKey>;
|
|
30
|
+
get keyToIndex(): Map<ListKey, number>;
|
|
31
|
+
get $emptyEl(): JQuery<HTMLElement> | null;
|
|
32
|
+
set $emptyEl(v: JQuery<HTMLElement> | null);
|
|
33
|
+
/**
|
|
34
|
+
* Retrieves the index of a key, supporting string-to-number normalization.
|
|
35
|
+
*
|
|
36
|
+
* Reason: DOM attributes (like `data-atom-key`) are always returned as strings,
|
|
37
|
+
* but the internal `_keyToIndex` map might use numbers.
|
|
38
|
+
*/
|
|
39
|
+
getIndex(key: ListKey | string): number | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Orchestrates the physical removal of an element from the DOM.
|
|
42
|
+
*
|
|
43
|
+
* Logic:
|
|
44
|
+
* 1. If `onRemove` returns a Promise, it waits for completion (e.g., a fade-out animation).
|
|
45
|
+
* 2. Constraint: Before calling `.remove()`, it checks if the element has been "resurrected"
|
|
46
|
+
* (assigned a new `data-atom-key`) by a subsequent render cycle.
|
|
47
|
+
*/
|
|
48
|
+
scheduleRemoval(k: ListKey, $el: JQuery): void;
|
|
49
|
+
/**
|
|
50
|
+
* Marks a key as "removing" and initiates the removal sequence.
|
|
51
|
+
*
|
|
52
|
+
* Note: The `data-atom-key` attribute is cleared immediately to prevent the reconciler
|
|
53
|
+
* from finding this "ghost" element via DOM lookups while animations are still running.
|
|
54
|
+
*/
|
|
55
|
+
removeItem(k: ListKey, $el: JQuery): void;
|
|
56
|
+
/**
|
|
57
|
+
* Performs full cleanup of the list state and event listeners.
|
|
58
|
+
*/
|
|
59
|
+
dispose(): void;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/bindings/list/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGrD;;;;;;;;GAQG;AACH,qBAAa,WAAW,CAAC,CAAC;aAWN,UAAU,EAAE,MAAM;aAClB,iBAAiB,EAAE,MAAM;aACzB,QAAQ,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAA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+
* Generates a reconciliation plan by calculating the difference between the
|
|
6
|
+
* current list state and the new item set.
|
|
7
|
+
*
|
|
8
|
+
* Logic: This function implements a double-ended diffing algorithm to identify
|
|
9
|
+
* reusable DOM nodes, new entries, and required replacements. It optimizes
|
|
10
|
+
* performance by isolating the "dirty" range — skipping unchanged items at
|
|
11
|
+
* both the head and tail of the list.
|
|
12
|
+
*
|
|
13
|
+
* When to use:
|
|
14
|
+
* - Internal orchestration of DOM mutations for the `atomList` binding.
|
|
15
|
+
*
|
|
16
|
+
* @param ctx - The current list context containing historical DOM state.
|
|
17
|
+
* @param items - The new set of items to render.
|
|
18
|
+
* @param itemCount - The total number of new items.
|
|
19
|
+
* @param getKey - A function to derive a unique key for each item.
|
|
20
|
+
* @param update - An optional callback used to patch existing DOM nodes.
|
|
21
|
+
* @param isEqual - An optional equality comparator for items.
|
|
22
|
+
* @returns A detailed diff plan used to execute DOM updates.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const diff = buildIndices(context, nextItems, nextItems.length, getKey, onUpdate, onEqual);
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export declare function buildIndices<T>(ctx: ListContext<T>, items: T[], itemCount: number, getKey: ListKeyFn<T>, update: ListOptions<T>['update'], isEqual: ListOptions<T>['isEqual']): PreparedDiff<T>;
|
|
32
|
+
//# sourceMappingURL=diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../src/bindings/list/diff.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAW,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAa,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,EACnB,KAAK,EAAE,CAAC,EAAE,EACV,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EACpB,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAChC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GACjC,YAAY,CAAC,CAAC,CAAC,CA6HjB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ListOptions } from '../../types';
|
|
2
|
+
import { ListContext } from './context';
|
|
3
|
+
import { PlaceCallbacks, PreparedDiff } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* A low-level DOM utility for inserting elements before a specific reference node.
|
|
6
|
+
*
|
|
7
|
+
* This helper supports both raw `Element` instances and jQuery collections,
|
|
8
|
+
* ensuring consistent insertion behavior regardless of the input type.
|
|
9
|
+
*
|
|
10
|
+
* @param elOrJq - The element or jQuery collection to insert.
|
|
11
|
+
* @param nextNode - The reference node to insert before. If null, appends to the container.
|
|
12
|
+
* @param container - The parent container element.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare function insertOrAppend(elOrJq: Element | JQuery | undefined, nextNode: Node | null, container: Element): void;
|
|
16
|
+
/**
|
|
17
|
+
* Orchestrates the cleanup of a list container and the rendering of empty placeholders.
|
|
18
|
+
*
|
|
19
|
+
* Logic: If an `onRemove` callback is provided, the function performs asynchronous
|
|
20
|
+
* removals for each item to allow for exit animations. Otherwise, it executes a
|
|
21
|
+
* destructive `empty()` on the container for efficiency.
|
|
22
|
+
*
|
|
23
|
+
* When to use:
|
|
24
|
+
* - To reset a list container during reconciliation or when the data source becomes empty.
|
|
25
|
+
*
|
|
26
|
+
* @param ctx - The list context containing historical state.
|
|
27
|
+
* @param itemCount - The number of items in the new data set.
|
|
28
|
+
* @param $container - The jQuery-wrapped container.
|
|
29
|
+
* @param empty - The template or element to display when the list is empty.
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
export declare function handleEmpty<T>(ctx: ListContext<T>, itemCount: number, $container: JQuery, empty: ListOptions<T>['empty']): void;
|
|
33
|
+
/**
|
|
34
|
+
* Transforms items into DOM handles based on the reconciliation plan.
|
|
35
|
+
*
|
|
36
|
+
* Optimization: If all items utilize string templates and the list is undergoing
|
|
37
|
+
* an initial render (cold start), the function returns sanitized HTML fragments
|
|
38
|
+
* for direct `innerHTML` injection, bypassing the overhead of individual jQuery
|
|
39
|
+
* object construction.
|
|
40
|
+
*
|
|
41
|
+
* When to use:
|
|
42
|
+
* - Internal processing of new items within the `atomList` lifecycle.
|
|
43
|
+
*
|
|
44
|
+
* @param diff - The prepared diff plan.
|
|
45
|
+
* @param options - Configuration options for the list.
|
|
46
|
+
* @param isInitial - Indicates whether this is the first render of the list.
|
|
47
|
+
* @returns An array of sanitized HTML strings if the fast-path is applicable; otherwise null.
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
export declare function renderItems<T>(diff: PreparedDiff<T>, options: ListOptions<T>, isInitial: boolean): string[] | null;
|
|
51
|
+
/**
|
|
52
|
+
* Identifies and removes items that are no longer present in the reactive data set.
|
|
53
|
+
*
|
|
54
|
+
* Logic: Iterates through the historical key set and triggers the removal
|
|
55
|
+
* lifecycle for any key that is not found in the new state.
|
|
56
|
+
*
|
|
57
|
+
* @param ctx - The list context containing historical state.
|
|
58
|
+
* @param diff - The prepared diff plan.
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
export declare function cleanupRemoved<T>(ctx: ListContext<T>, diff: PreparedDiff<T>): void;
|
|
62
|
+
export declare function placeItems<T>(ctx: ListContext<T>, diff: PreparedDiff<T>, container: Element, callbacks: PlaceCallbacks<T>, htmlFragments: string[] | null): void;
|
|
63
|
+
//# sourceMappingURL=dom.d.ts.map
|
|
@@ -0,0 +1 @@
|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a,EAAE,MAAM,EAAE,GAAG,IAAI,GAC7B,IAAI,CA8EN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bindings/list/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { ListKey, ListKeyFn, ListOptions } from '../../types';
|
|
2
|
+
export type { ListKey, ListKeyFn };
|
|
3
|
+
/**
|
|
4
|
+
* Enumeration of lifecycle flags representing the reconciliation status of a list item.
|
|
5
|
+
*
|
|
6
|
+
* These flags are used by the internal DOM synchronizer to determine the minimum
|
|
7
|
+
* required action (skipping, patching, or re-rendering) for each element.
|
|
8
|
+
*
|
|
9
|
+
* When to use:
|
|
10
|
+
* - Internal orchestration of DOM updates within the `atomList` binding engine.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare const ItemState: {
|
|
15
|
+
/**
|
|
16
|
+
* Logic: The item's key and data are identical to the previous state.
|
|
17
|
+
* Optimization: No DOM manipulation is required; this is the fastest execution path.
|
|
18
|
+
*/
|
|
19
|
+
readonly Unchanged: 0;
|
|
20
|
+
/**
|
|
21
|
+
* Logic: The key has been identified in the previous state, but its position
|
|
22
|
+
* or data may require a patch or an update callback execution.
|
|
23
|
+
*/
|
|
24
|
+
readonly Existing: number;
|
|
25
|
+
/**
|
|
26
|
+
* Logic: The item's key was not found in the previous state.
|
|
27
|
+
* Action: A fresh DOM node must be created and inserted.
|
|
28
|
+
*/
|
|
29
|
+
readonly New: number;
|
|
30
|
+
/**
|
|
31
|
+
* Logic: The key matched, but the item's data has changed and no custom
|
|
32
|
+
* `update` callback was provided by the user.
|
|
33
|
+
* Action: Requires a full destruction of the existing node followed by a
|
|
34
|
+
* re-creation to ensure the DOM accurately reflects the new data.
|
|
35
|
+
*/
|
|
36
|
+
readonly ForceReplace: number;
|
|
37
|
+
};
|
|
38
|
+
export type ItemState = (typeof ItemState)[keyof typeof ItemState];
|
|
39
|
+
/**
|
|
40
|
+
* A reconciliation plan generated by the diffing algorithm.
|
|
41
|
+
*
|
|
42
|
+
* Logic: This interface provides index-based buffers and metadata required by
|
|
43
|
+
* the DOM synchronizer to perform atomic mutations with minimal overhead.
|
|
44
|
+
*
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
export interface PreparedDiff<T> {
|
|
48
|
+
/** The collection of unique keys for the new item set. */
|
|
49
|
+
newKeys: ListKey[];
|
|
50
|
+
/** The collection of data items for the new state. */
|
|
51
|
+
newItems: T[];
|
|
52
|
+
/** A set containing all unique keys used for duplicate detection. */
|
|
53
|
+
newKeySet: Set<ListKey>;
|
|
54
|
+
/** A map of new indices to their corresponding indices in the previous state. */
|
|
55
|
+
newIndices: number[];
|
|
56
|
+
/** The reconciliation state assigned to each item. */
|
|
57
|
+
newStates: ItemState[];
|
|
58
|
+
/** The current DOM handles (Element or jQuery) for each item. */
|
|
59
|
+
newNodes: (Element | JQuery | undefined)[];
|
|
60
|
+
/**
|
|
61
|
+
* A collection of items that require new DOM construction or HTML parsing
|
|
62
|
+
* during this rendering cycle.
|
|
63
|
+
*/
|
|
64
|
+
toRender: {
|
|
65
|
+
key: ListKey;
|
|
66
|
+
item: T;
|
|
67
|
+
index: number;
|
|
68
|
+
}[];
|
|
69
|
+
/** The starting index of the "dirty" middle section after prefix optimization. */
|
|
70
|
+
startIndex: number;
|
|
71
|
+
/** The ending index of the "dirty" section relative to the old list state. */
|
|
72
|
+
oldEndIndex: number;
|
|
73
|
+
/** The ending index of the "dirty" section relative to the new list state. */
|
|
74
|
+
newEndIndex: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A collection of user-provided lifecycle hooks and event configurations.
|
|
78
|
+
*
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
export interface PlaceCallbacks<T> {
|
|
82
|
+
/** Invoked once when an element is first bound to a reactive item. */
|
|
83
|
+
bind?: (($el: JQuery, item: T, index: number) => void) | undefined;
|
|
84
|
+
/** Invoked on subsequent updates when item data changes. */
|
|
85
|
+
update?: (($el: JQuery, item: T, index: number) => void) | undefined;
|
|
86
|
+
/** Invoked when a new item is physically added to the DOM. */
|
|
87
|
+
onAdd?: (($el: JQuery) => void) | undefined;
|
|
88
|
+
/** Invoked to manage the removal of an item, supporting asynchronous transitions. */
|
|
89
|
+
onRemove?: ListOptions<T>['onRemove'] | undefined;
|
|
90
|
+
/** Delegated event listeners for the list container. */
|
|
91
|
+
events?: ListOptions<T>['events'] | undefined;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/bindings/list/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE/D,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AAEnC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS;IACpB;;;OAGG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;CAEK,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAEnE;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,0DAA0D;IAC1D,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,sDAAsD;IACtD,QAAQ,EAAE,CAAC,EAAE,CAAC;IACd,qEAAqE;IACrE,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACxB,iFAAiF;IACjF,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,sDAAsD;IACtD,SAAS,EAAE,SAAS,EAAE,CAAC;IACvB,iEAAiE;IACjE,QAAQ,EAAE,CAAC,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;IAE3C;;;OAGG;IACH,QAAQ,EAAE;QAAE,GAAG,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,CAAC,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAErD,kFAAkF;IAClF,UAAU,EAAE,MAAM,CAAC;IACnB,8EAA8E;IAC9E,WAAW,EAAE,MAAM,CAAC;IACpB,8EAA8E;IAC9E,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,sEAAsE;IACtE,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACnE,4DAA4D;IAC5D,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACrE,8DAA8D;IAC9D,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAC5C,qFAAqF;IACrF,QAAQ,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,SAAS,CAAC;IAClD,wDAAwD;IACxD,MAAM,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;CAC/C"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalizes a raw DOM element or a jQuery collection into a standard jQuery object.
|
|
3
|
+
*
|
|
4
|
+
* @param $el - The element or collection to normalize.
|
|
5
|
+
* @returns A standard jQuery object.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare function wrap($el: Element | JQuery<Element>): JQuery;
|
|
9
|
+
/**
|
|
10
|
+
* Assigns or removes a stable reactive identifier on a DOM node or collection.
|
|
11
|
+
*
|
|
12
|
+
* Logic: The `data-atom-key` attribute serves as the primary stable identifier
|
|
13
|
+
* for DOM nodes within the list reconciliation engine. This allows the diffing
|
|
14
|
+
* algorithm to perform O(N) re-ordering and node reuse, avoiding the overhead
|
|
15
|
+
* of positional comparisons.
|
|
16
|
+
*
|
|
17
|
+
* @param node - The DOM element, Node, or jQuery collection.
|
|
18
|
+
* @param key - The unique string key to assign, or null to remove the identifier.
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare function setAtomKey(node: Element | Node | JQuery, key: string | null): void;
|
|
22
|
+
/**
|
|
23
|
+
* Performs a deep recursive cleanup of reactive resources associated with a DOM tree.
|
|
24
|
+
*
|
|
25
|
+
* Caution: This method must be executed before an element is permanently detached
|
|
26
|
+
* from the DOM or replaced. Failure to do so may result in "zombie" reactive
|
|
27
|
+
* effects remaining in the registry, leading to significant memory leaks.
|
|
28
|
+
*
|
|
29
|
+
* @param node - The root element or jQuery collection to clean up.
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
export declare function cleanupNodes(node: Element | JQuery): void;
|
|
33
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/bindings/list/utils.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,CAE3D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,GAAG,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAoBlF;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAYzD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../src/bindings/mount.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { AsyncReactiveValue, BindingOptions, CssValue, PrimitiveValue, ValOptions, WritableAtom } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Binds the text content of an element to a reactive source.
|
|
4
|
+
*
|
|
5
|
+
* When to use:
|
|
6
|
+
* - To synchronize labels or counts with an atom without the risk of XSS.
|
|
7
|
+
*
|
|
8
|
+
* @param element - The target HTMLElement.
|
|
9
|
+
* @param value - The reactive source atom or computed.
|
|
10
|
+
* @param formatter - An optional function to format the value before display.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function bindText<T = unknown>(element: HTMLElement, value: AsyncReactiveValue<T>, formatter?: (value: T) => string): void;
|
|
14
|
+
/**
|
|
15
|
+
* Binds the HTML content of an element to a reactive source.
|
|
16
|
+
*
|
|
17
|
+
* Logic: To prevent memory leaks from detached nodes, all reactive bindings
|
|
18
|
+
* within the element's descendants are automatically cleaned up via the
|
|
19
|
+
* registry before the `innerHTML` is overwritten.
|
|
20
|
+
*
|
|
21
|
+
* Caution: Even with sanitization, rendering user-provided HTML remains a
|
|
22
|
+
* security risk. Prefer `bindText` whenever possible.
|
|
23
|
+
*
|
|
24
|
+
* When to use:
|
|
25
|
+
* - To render trusted templates or rich text containing formatting tags.
|
|
26
|
+
*
|
|
27
|
+
* @param element - The target HTMLElement.
|
|
28
|
+
* @param value - The reactive source containing the HTML string.
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export declare function bindHtml(element: HTMLElement, value: AsyncReactiveValue<string>): void;
|
|
32
|
+
/**
|
|
33
|
+
* Binds a set of CSS classes to reactive conditions.
|
|
34
|
+
*
|
|
35
|
+
* Logic: Token Management
|
|
36
|
+
* - Supports space-separated class names within keys.
|
|
37
|
+
* - Active tokens are tracked in a `Set` to ensure classes are only removed
|
|
38
|
+
* if no other active definition within the map requires them.
|
|
39
|
+
*
|
|
40
|
+
* @param element - The target HTMLElement.
|
|
41
|
+
* @param classMap - A record mapping class names to reactive boolean conditions.
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
export declare function bindClass(element: HTMLElement, classMap: Record<string, AsyncReactiveValue<boolean>>): void;
|
|
45
|
+
/**
|
|
46
|
+
* Binds inline CSS styles to reactive sources.
|
|
47
|
+
*
|
|
48
|
+
* Security: Dangerous CSS values (e.g., `url()` containing javascript: protocols)
|
|
49
|
+
* are blocked to prevent XSS and style-based injection attacks.
|
|
50
|
+
*
|
|
51
|
+
* @param element - The target HTMLElement.
|
|
52
|
+
* @param cssMap - A record mapping style properties to reactive values.
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
export declare function bindCss(element: HTMLElement, cssMap: Record<string, CssValue>): void;
|
|
56
|
+
/**
|
|
57
|
+
* Binds HTML attributes to reactive sources.
|
|
58
|
+
*
|
|
59
|
+
* Logic: Attribute Transformation Pipeline
|
|
60
|
+
* Implements a unified transformation flow for different attribute categories:
|
|
61
|
+
* - Boolean Attributes: Automatically removed when the condition is `false`.
|
|
62
|
+
* - ARIA Attributes: Boolean values are mapped to 'true'/'false' strings.
|
|
63
|
+
* - Standard Attributes: Values are coerced to strings.
|
|
64
|
+
*
|
|
65
|
+
* Security: Protocol Validation
|
|
66
|
+
* Validates 'href' and 'src' attributes against dangerous URL protocols to
|
|
67
|
+
* mitigate potential XSS vectors.
|
|
68
|
+
*
|
|
69
|
+
* @param element - The target HTMLElement.
|
|
70
|
+
* @param attrMap - A record mapping attribute names to reactive values.
|
|
71
|
+
* @internal
|
|
72
|
+
*/
|
|
73
|
+
export declare function bindAttr(element: HTMLElement, attrMap: Record<string, AsyncReactiveValue<PrimitiveValue>>): void;
|
|
74
|
+
/**
|
|
75
|
+
* Binds DOM properties directly to reactive sources.
|
|
76
|
+
*
|
|
77
|
+
* Security: Blocks sensitive properties (e.g., `innerHTML`, event handlers)
|
|
78
|
+
* and validates URL-based properties to prevent prototype pollution or XSS.
|
|
79
|
+
*
|
|
80
|
+
* @param element - The target HTMLElement.
|
|
81
|
+
* @param propMap - A record mapping property names to reactive values.
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
84
|
+
export declare function bindProp(element: HTMLElement, propMap: Record<string, AsyncReactiveValue<unknown>>): void;
|
|
85
|
+
/**
|
|
86
|
+
* Manages element visibility based on a reactive condition.
|
|
87
|
+
*
|
|
88
|
+
* Logic: Layout Preservation
|
|
89
|
+
* Transitions between 'visible' and 'hidden' states while preserving the
|
|
90
|
+
* element's original 'display' mode (e.g., flex, grid) when restored.
|
|
91
|
+
*
|
|
92
|
+
* @param element - The target HTMLElement.
|
|
93
|
+
* @param condition - The reactive boolean condition governing visibility.
|
|
94
|
+
* @param invert - If true, hides the element when the condition is met.
|
|
95
|
+
* @internal
|
|
96
|
+
*/
|
|
97
|
+
export declare function bindVisibility(element: HTMLElement, condition: AsyncReactiveValue<boolean>, invert: boolean): void;
|
|
98
|
+
/**
|
|
99
|
+
* Binds a form control's value to a writable atom.
|
|
100
|
+
*
|
|
101
|
+
* When to use:
|
|
102
|
+
* - To implement two-way synchronization for inputs, selects, and textareas.
|
|
103
|
+
*
|
|
104
|
+
* @param element - The form control element.
|
|
105
|
+
* @param atom - The writable atom to synchronize with.
|
|
106
|
+
* @param options - Configuration for debouncing and transformation.
|
|
107
|
+
* @internal
|
|
108
|
+
*/
|
|
109
|
+
export declare function bindVal(element: HTMLElement, atom: WritableAtom<unknown>, options?: ValOptions<unknown>): void;
|
|
110
|
+
/**
|
|
111
|
+
* Binds a checkbox or radio button's checked state to a writable atom.
|
|
112
|
+
*
|
|
113
|
+
* @param element - The target input element.
|
|
114
|
+
* @param atom - The writable atom to synchronize with the checked state.
|
|
115
|
+
* @internal
|
|
116
|
+
*/
|
|
117
|
+
export declare function bindChecked(element: HTMLElement, atom: WritableAtom<boolean>): void;
|
|
118
|
+
/**
|
|
119
|
+
* Binds a mapping of event listeners to an element.
|
|
120
|
+
*
|
|
121
|
+
* @param element - The target HTMLElement.
|
|
122
|
+
* @param eventMap - A record mapping event names to handler functions.
|
|
123
|
+
* @internal
|
|
124
|
+
*/
|
|
125
|
+
export declare function bindEvents(element: HTMLElement, eventMap: NonNullable<BindingOptions['on']>): void;
|
|
126
|
+
/**
|
|
127
|
+
* Binds a single event listener to an element.
|
|
128
|
+
*
|
|
129
|
+
* @param element - The target HTMLElement.
|
|
130
|
+
* @param event - The name of the event.
|
|
131
|
+
* @param handler - The handler function to execute.
|
|
132
|
+
* @internal
|
|
133
|
+
*/
|
|
134
|
+
export declare function bindOn(element: HTMLElement, event: string, handler: (event: JQuery.TriggeredEvent) => void): void;
|
|
135
|
+
//# sourceMappingURL=unified.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unified.d.ts","sourceRoot":"","sources":["../../src/bindings/unified.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACd,QAAQ,EACR,cAAc,EAEd,UAAU,EACV,YAAY,EACb,MAAM,SAAS,CAAC;AAqCjB;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,CAAC,GAAG,OAAO,EAClC,OAAO,EAAE,WAAW,EACpB,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAC5B,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,GAC/B,IAAI,CAeN;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,kBAAkB,CAAC,MAAM,CAAC,GAAG,IAAI,CAgBtF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CA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,KAAK,IAAI,GAC9C,IAAI,CAIN"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized repository for library-wide constants, defaults, and error templates.
|
|
3
|
+
*
|
|
4
|
+
* Logic: Subsystem Organization
|
|
5
|
+
* Consolidates global prefixes, defaults, and error templates into logical
|
|
6
|
+
* namespaces. This organization ensures consistency across the library and
|
|
7
|
+
* provides a central location for modifying system behavior.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
/** Constants for the core reactive engine. @internal */
|
|
12
|
+
export declare const SYSTEM_CORE: {
|
|
13
|
+
readonly ERRORS: {
|
|
14
|
+
readonly EFFECT_DISPOSE_ERROR: (i?: string) => string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
/** Configuration and error templates for the routing subsystem. @internal */
|
|
18
|
+
export declare const SYSTEM_ROUTE: {
|
|
19
|
+
readonly PREFIX: "[atom-route]";
|
|
20
|
+
readonly DEFAULTS: Readonly<{
|
|
21
|
+
readonly mode: "hash";
|
|
22
|
+
readonly basePath: "";
|
|
23
|
+
readonly autoBindLinks: false;
|
|
24
|
+
readonly activeClass: "active";
|
|
25
|
+
}>;
|
|
26
|
+
readonly ERRORS: {
|
|
27
|
+
readonly NOT_FOUND: (n: string) => string;
|
|
28
|
+
readonly TEMPLATE_NOT_FOUND: (s: string) => string;
|
|
29
|
+
readonly TARGET_NOT_FOUND: (s: string) => string;
|
|
30
|
+
readonly MALFORMED_URI: (r: string) => string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
/** Configuration and error templates for reactive bindings. @internal */
|
|
34
|
+
export declare const SYSTEM_BINDING: {
|
|
35
|
+
readonly PREFIX: "[atom-binding]";
|
|
36
|
+
readonly INPUT_DEFAULTS: Readonly<{
|
|
37
|
+
readonly event: "input change";
|
|
38
|
+
readonly debounce: 0;
|
|
39
|
+
}>;
|
|
40
|
+
readonly VALID_INPUT_TAGS: readonly ["input", "select", "textarea"];
|
|
41
|
+
readonly ERRORS: {
|
|
42
|
+
readonly INVALID_INPUT_ELEMENT: (t: string) => string;
|
|
43
|
+
readonly MISSING_SOURCE: (m: string) => string;
|
|
44
|
+
readonly MISSING_CONDITION: (m: string) => string;
|
|
45
|
+
readonly UPDATER_ERROR: (d: string, s?: boolean) => string;
|
|
46
|
+
readonly CLEANUP_ERROR: (i?: string) => string;
|
|
47
|
+
readonly PARSE_ERROR: (d?: string) => string;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Constants for the security and sanitization engine.
|
|
52
|
+
*
|
|
53
|
+
* Logic: Sanitization Schema
|
|
54
|
+
* Defines the properties and URI protocols considered inherently dangerous.
|
|
55
|
+
* These constants form the basis of the library's XSS and DOM Clobbering
|
|
56
|
+
* prevention strategy.
|
|
57
|
+
*
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
60
|
+
export declare const SYSTEM_SECURITY: {
|
|
61
|
+
/** Property names that are blocked to prevent XSS and property hijacking. */
|
|
62
|
+
readonly DANGEROUS_PROPS: readonly ["innerHTML", "outerHTML", "srcdoc", "__proto__", "constructor", "prototype"];
|
|
63
|
+
/** Attributes that must be validated for dangerous URI protocols. */
|
|
64
|
+
readonly URL_PROPS: readonly ["src", "href", "action", "formaction", "data", "poster", "background", "cite", "longdesc", "profile", "usemap", "classid", "codebase", "xlink:href"];
|
|
65
|
+
/** Pattern for identifying malicious URI protocols. */
|
|
66
|
+
readonly DANGEROUS_PROTOCOL_PATTERN: "(?:javascript|vbscript)";
|
|
67
|
+
readonly ERRORS: {
|
|
68
|
+
readonly UNSAFE_CONTENT: () => string;
|
|
69
|
+
readonly BLOCKED_CSS_VALUE: (p: string) => string;
|
|
70
|
+
readonly BLOCKED_EVENT_HANDLER: (n: string) => string;
|
|
71
|
+
readonly BLOCKED_PROTOCOL: (n: string) => string;
|
|
72
|
+
readonly BLOCKED_PROP: (n: string) => string;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
/** Error templates for list rendering. @internal */
|
|
76
|
+
export declare const SYSTEM_LIST: {
|
|
77
|
+
readonly PREFIX: "[atom-list]";
|
|
78
|
+
readonly ERRORS: {
|
|
79
|
+
readonly DUPLICATE_KEY: (k: string | number, i: number) => string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
/** Error templates for component mounting. @internal */
|
|
83
|
+
export declare const SYSTEM_MOUNT: {
|
|
84
|
+
readonly PREFIX: "[atom-mount]";
|
|
85
|
+
readonly ERRORS: {
|
|
86
|
+
readonly ERROR: (n?: string) => string;
|
|
87
|
+
readonly CLEANUP_ERROR: (n?: string) => string;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
/** Error templates for Web Components. @internal */
|
|
91
|
+
export declare const SYSTEM_COMPONENT: {
|
|
92
|
+
readonly PREFIX: "[atom-component]";
|
|
93
|
+
readonly ATTRS: {
|
|
94
|
+
readonly BIND: "data-aej-bind";
|
|
95
|
+
readonly PART: "data-aej-part";
|
|
96
|
+
readonly LEGACY_BIND: "data-bind";
|
|
97
|
+
};
|
|
98
|
+
readonly ERRORS: {
|
|
99
|
+
readonly NOT_REGISTERED: (tagName: string) => string;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
/** Defaults for the visual debug system. @internal */
|
|
103
|
+
export declare const SYSTEM_DEBUG: {
|
|
104
|
+
readonly DEFAULTS: {
|
|
105
|
+
readonly HIGHLIGHT_DURATION_MS: 500;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,wDAAwD;AACxD,eAAO,MAAM,WAAW;;4CAEO,MAAM;;CAE3B,CAAC;AAEX,6EAA6E;AAC7E,eAAO,MAAM,YAAY;;;;;;;;;gCASN,MAAM;yCACG,MAAM;uCACR,MAAM;oCACT,MAAM;;CAEnB,CAAC;AAEX,yEAAyE;AACzE,eAAO,MAAM,cAAc;;;;;;;;4CAOI,MAAM;qCACb,MAAM;wCACH,MAAM;oCACV,MAAM,MAAM,OAAO;qCAClB,MAAM;mCACR,MAAM;;CAElB,CAAC;AAEX;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe;IAC1B,6EAA6E;;IAS7E,qEAAqE;;IAiBrE,uDAAuD;;;;wCAI9B,MAAM;4CACF,MAAM;uCACX,MAAM;mCACV,MAAM;;CAElB,CAAC;AAEX,oDAAoD;AACpD,eAAO,MAAM,WAAW;;;oCAGD,MAAM,GAAG,MAAM,KAAK,MAAM;;CAEvC,CAAC;AAEX,wDAAwD;AACxD,eAAO,MAAM,YAAY;;;6BAGT,MAAM;qCACE,MAAM;;CAEpB,CAAC;AAEX,oDAAoD;AACpD,eAAO,MAAM,gBAAgB;;;;;;;;2CAQC,MAAM;;CAE1B,CAAC;AAEX,sDAAsD;AACtD,eAAO,MAAM,YAAY;;;;CAIf,CAAC"}
|