@but212/atom-effect-jquery 0.30.1 → 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.
Files changed (78) hide show
  1. package/README.md +32 -28
  2. package/dist/atom-effect-jquery.min.js +9 -10
  3. package/dist/atom-effect-jquery.min.js.map +1 -1
  4. package/dist/bindings/chainable.d.ts +2 -0
  5. package/dist/bindings/chainable.d.ts.map +1 -0
  6. package/dist/bindings/form.d.ts +29 -0
  7. package/dist/bindings/form.d.ts.map +1 -0
  8. package/dist/bindings/input-binding.d.ts +31 -0
  9. package/dist/bindings/input-binding.d.ts.map +1 -0
  10. package/dist/bindings/list/context.d.ts +61 -0
  11. package/dist/bindings/list/context.d.ts.map +1 -0
  12. package/dist/bindings/list/diff.d.ts +32 -0
  13. package/dist/bindings/list/diff.d.ts.map +1 -0
  14. package/dist/bindings/list/dom.d.ts +63 -0
  15. package/dist/bindings/list/dom.d.ts.map +1 -0
  16. package/dist/bindings/list/index.d.ts +2 -0
  17. package/dist/bindings/list/index.d.ts.map +1 -0
  18. package/dist/bindings/list/types.d.ts +93 -0
  19. package/dist/bindings/list/types.d.ts.map +1 -0
  20. package/dist/bindings/list/utils.d.ts +33 -0
  21. package/dist/bindings/list/utils.d.ts.map +1 -0
  22. package/dist/bindings/mount.d.ts +2 -0
  23. package/dist/bindings/mount.d.ts.map +1 -0
  24. package/dist/bindings/unified.d.ts +135 -0
  25. package/dist/bindings/unified.d.ts.map +1 -0
  26. package/dist/constants.d.ts +108 -0
  27. package/dist/constants.d.ts.map +1 -0
  28. package/dist/core/dom.d.ts +26 -0
  29. package/dist/core/dom.d.ts.map +1 -0
  30. package/dist/core/effect-factory.d.ts +34 -0
  31. package/dist/core/effect-factory.d.ts.map +1 -0
  32. package/dist/core/jquery-patch.d.ts +12 -0
  33. package/dist/core/jquery-patch.d.ts.map +1 -0
  34. package/dist/core/namespace.d.ts +11 -0
  35. package/dist/core/namespace.d.ts.map +1 -0
  36. package/dist/core/navigation.d.ts +172 -0
  37. package/dist/core/navigation.d.ts.map +1 -0
  38. package/dist/core/registry.d.ts +189 -0
  39. package/dist/core/registry.d.ts.map +1 -0
  40. package/dist/core/symbols.d.ts +33 -0
  41. package/dist/core/symbols.d.ts.map +1 -0
  42. package/dist/features/fetch.d.ts +2 -0
  43. package/dist/features/fetch.d.ts.map +1 -0
  44. package/dist/features/nav.d.ts +23 -0
  45. package/dist/features/nav.d.ts.map +1 -0
  46. package/dist/features/route/core.d.ts +83 -0
  47. package/dist/features/route/core.d.ts.map +1 -0
  48. package/dist/features/route/index.d.ts +43 -0
  49. package/dist/features/route/index.d.ts.map +1 -0
  50. package/dist/features/route/router.d.ts +74 -0
  51. package/dist/features/route/router.d.ts.map +1 -0
  52. package/dist/features/route/types.d.ts +60 -0
  53. package/dist/features/route/types.d.ts.map +1 -0
  54. package/dist/features/route/view.d.ts +116 -0
  55. package/dist/features/route/view.d.ts.map +1 -0
  56. package/dist/features/web-component/index.d.ts +33 -0
  57. package/dist/features/web-component/index.d.ts.map +1 -0
  58. package/dist/features/web-component/setup.d.ts +77 -0
  59. package/dist/features/web-component/setup.d.ts.map +1 -0
  60. package/dist/features/web-component/state.d.ts +47 -0
  61. package/dist/features/web-component/state.d.ts.map +1 -0
  62. package/dist/features/web-component/utils.d.ts +13 -0
  63. package/dist/features/web-component/utils.d.ts.map +1 -0
  64. package/dist/index.cjs +9 -10
  65. package/dist/index.cjs.map +1 -1
  66. package/dist/index.d.ts +30 -232
  67. package/dist/index.d.ts.map +1 -0
  68. package/dist/index.mjs +3129 -2726
  69. package/dist/index.mjs.map +1 -1
  70. package/dist/types.d.ts +476 -0
  71. package/dist/types.d.ts.map +1 -0
  72. package/dist/utils/debug.d.ts +40 -0
  73. package/dist/utils/debug.d.ts.map +1 -0
  74. package/dist/utils/index.d.ts +51 -0
  75. package/dist/utils/index.d.ts.map +1 -0
  76. package/dist/utils/sanitize.d.ts +52 -0
  77. package/dist/utils/sanitize.d.ts.map +1 -0
  78. package/package.json +11 -7
@@ -0,0 +1,476 @@
1
+ import { AtomOptions as BaseAtomOptions, ComputedAtom, ComputedOptions, Dependency, EffectObject, MergedDependencyValue, ReadonlyAtom, WritableAtom } from '@but212/atom-effect';
2
+ /** A function that performs cleanup tasks for a reactive effect or component. */
3
+ export type EffectCleanup = () => void;
4
+ /** Represents the unmounting phase of a component's lifecycle. */
5
+ export interface ComponentLifecycle {
6
+ /** Cleanup task executed during the unmount phase. */
7
+ unmount: EffectCleanup;
8
+ }
9
+ /** The result of a reactive effect function, which may include cleanup logic. */
10
+ export type EffectResult = undefined | EffectCleanup | ComponentLifecycle;
11
+ /** A function used to determine equality between two reactive values. */
12
+ export type EqualFn<T> = (a: T, b: T) => boolean;
13
+ /**
14
+ * Configuration options for creating reactive atoms.
15
+ *
16
+ * @public
17
+ */
18
+ export interface AtomOptions extends BaseAtomOptions {
19
+ /** Optional name for debugging and diagnostic purposes. */
20
+ name?: string;
21
+ /** Whether to trigger updates synchronously. Default is false (batched). */
22
+ sync?: boolean;
23
+ }
24
+ /**
25
+ * A value that can be a static literal, a reactive atom, or a getter function.
26
+ *
27
+ * Logic: Polymorphic Input
28
+ * Supports raw values for static initialization, reactive atoms for state-driven
29
+ * updates, or functional getters for deferred execution of complex logic.
30
+ *
31
+ * @public
32
+ */
33
+ export type ReactiveValue<T> = T | ReadonlyAtom<T> | (() => T);
34
+ /**
35
+ * A value that can be a static literal, a reactive atom, a promise, or a getter
36
+ * function that returns any of these.
37
+ *
38
+ * When to use:
39
+ * - CSS or Attribute bindings that require data from an asynchronous source.
40
+ * - Integration with fetch-based reactive atoms where values resolve over time.
41
+ *
42
+ * @public
43
+ */
44
+ export type AsyncReactiveValue<T> = T | ReadonlyAtom<T | Promise<T>> | Promise<T> | (() => T | Promise<T>);
45
+ /** Supported primitive types for attribute and property bindings. */
46
+ export type PrimitiveValue = string | number | boolean | null | undefined;
47
+ /** A CSS property value or a tuple containing a value and its unit (e.g., [10, 'px']). */
48
+ export type CssValue = AsyncReactiveValue<string | number> | [source: AsyncReactiveValue<number>, unit: string];
49
+ /** A mapping of CSS property names to their reactive values. */
50
+ export type CssBindings = Record<string, CssValue>;
51
+ /**
52
+ * Declaration of reactive bindings for a DOM element.
53
+ *
54
+ * Logic: Binding Strategy Map
55
+ * Maps reactive sources to specific DOM manipulation strategies (text, class,
56
+ * val, etc.). This declarative structure allows the engine to batch updates
57
+ * and optimize resource cleanup automatically.
58
+ *
59
+ * @public
60
+ */
61
+ export interface BindingOptions<T = unknown> {
62
+ /** Binds the element's text content. Can include an optional formatter. */
63
+ text?: AsyncReactiveValue<unknown> | [source: AsyncReactiveValue<unknown>, formatter: (v: unknown) => string];
64
+ /** Binds the element's inner HTML. Use with caution for untrusted content. */
65
+ html?: AsyncReactiveValue<string>;
66
+ /** Toggles CSS classes based on reactive conditions. */
67
+ class?: Record<string, AsyncReactiveValue<boolean>>;
68
+ /** Binds CSS styles reactively. */
69
+ css?: CssBindings;
70
+ /** Binds HTML attributes reactively. */
71
+ attr?: Record<string, AsyncReactiveValue<PrimitiveValue>>;
72
+ /** Binds DOM properties reactively. */
73
+ prop?: Record<string, AsyncReactiveValue<unknown>>;
74
+ /** Toggles element visibility (`display: block/none`) based on a condition. */
75
+ show?: AsyncReactiveValue<boolean>;
76
+ /** Hides the element (`display: none`) when the condition is true. */
77
+ hide?: AsyncReactiveValue<boolean>;
78
+ /** Two-way binding for form input values. */
79
+ val?: WritableAtom<T> | [atom: WritableAtom<T>, options: ValOptions<T>];
80
+ /** Two-way binding for checkbox and radio checked states. */
81
+ checked?: WritableAtom<boolean>;
82
+ /** Orchestrates two-way bindings for an entire form element. */
83
+ form?: WritableAtom<T extends object ? T : unknown> | [
84
+ atom: WritableAtom<T extends object ? T : unknown>,
85
+ options: FormOptions<T extends object ? T : unknown>
86
+ ];
87
+ /** Registers event listeners with automatic lifecycle management. */
88
+ on?: Record<string, (e: JQuery.Event) => void>;
89
+ }
90
+ /** A writable atom that includes an explicit disposal mechanism. @internal */
91
+ export interface DisposableWritableAtom<T> extends WritableAtom<T> {
92
+ /** Releases all reactive resources and observers associated with the atom. */
93
+ dispose(): void;
94
+ }
95
+ /** Supported key types for identifying items in a reactive list. */
96
+ export type ListKey = string | number;
97
+ /** Valid return types for a list item render function. */
98
+ export type ListRenderResult = string | Element | DocumentFragment | JQuery;
99
+ /** A function that extracts a unique identity key from a list item. */
100
+ export type ListKeyFn<T> = (item: T, index: number) => ListKey;
101
+ /**
102
+ * Configuration options for reactive list rendering.
103
+ *
104
+ * Optimization: DOM Reconciliation
105
+ * Uses unique keys for identity tracking to minimize DOM churn by reordering
106
+ * existing elements instead of re-rendering the entire list when data changes.
107
+ *
108
+ * @public
109
+ */
110
+ export interface ListOptions<T> {
111
+ /** The property name or function used to extract unique keys. */
112
+ key: keyof T | ListKeyFn<T>;
113
+ /** Function to generate the DOM representation for an item. */
114
+ render: (item: T, index: number) => ListRenderResult;
115
+ /** Optional callback to apply bindings to the rendered element. */
116
+ bind?: ($el: JQuery, item: T, index: number) => void;
117
+ /** Optional callback triggered when an item's data is updated. */
118
+ update?: ($el: JQuery, item: T, index: number) => void;
119
+ /** Callback triggered when a new element is added to the list. */
120
+ onAdd?: ($el: JQuery) => void;
121
+ /** Callback triggered when an element is removed (can be used for transitions). */
122
+ onRemove?: ($el: JQuery) => Promise<void> | void;
123
+ /** Content to display when the list is empty. */
124
+ empty?: ListRenderResult;
125
+ /** Event handlers bound to individual list items. */
126
+ events?: Record<string, (item: T, index: number, e: JQuery.TriggeredEvent) => void>;
127
+ /** Optional function for custom item equality checks. */
128
+ isEqual?: (a: T, b: T) => boolean;
129
+ }
130
+ /** Options for customizing two-way value bindings. */
131
+ export interface ValOptions<T> {
132
+ /** Time in milliseconds to delay atom synchronization after user input. */
133
+ debounce?: number;
134
+ /** The DOM event used to trigger synchronization (e.g., 'change'). */
135
+ event?: string;
136
+ /** Function to parse the DOM string value into the atom's type. */
137
+ parse?: (v: string) => T;
138
+ /** Function to format the atom's value for DOM display. */
139
+ format?: (v: T) => string;
140
+ /** Function for custom value equality checks. */
141
+ equal?: EqualFn<T>;
142
+ }
143
+ /** Options for orchestrating form-wide reactive synchronization. */
144
+ export interface FormOptions<T> extends ValOptions<T> {
145
+ /** Function to transform field values based on their object path before synchronization. */
146
+ transform?: (path: string, value: unknown) => unknown;
147
+ /** Callback triggered whenever any field in the form changes. */
148
+ onChange?: (path: string, value: unknown) => void;
149
+ /** Reactive validation schema mapping paths to validators. */
150
+ validation?: Record<string, (val: unknown) => string | boolean>;
151
+ }
152
+ /** Configuration for reactive AJAX requests. */
153
+ export interface FetchOptions<T> {
154
+ /** The value returned while the request is pending or if it fails. */
155
+ defaultValue: T;
156
+ /** Optional name for debugging and diagnostic logging. */
157
+ name?: string;
158
+ /** HTTP method to use for the request. */
159
+ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | (string & {});
160
+ /** Custom HTTP headers to include in the request. */
161
+ headers?: Record<string, string>;
162
+ /** Function to transform the raw response before it is stored in the atom. */
163
+ transform?: (raw: unknown, xhr: JQuery.jqXHR) => T | Promise<T>;
164
+ /** Direct overrides for the underlying jQuery AJAX settings. */
165
+ ajaxOptions?: JQuery.AjaxSettings | (() => JQuery.AjaxSettings);
166
+ /** Callback triggered when the request fails. */
167
+ onError?: (err: unknown) => void;
168
+ /** Whether to trigger the initial request immediately upon creation. */
169
+ eager?: boolean;
170
+ }
171
+ /** An error object containing the source jqXHR for diagnostic purposes. */
172
+ export interface FetchError extends Error {
173
+ /** The underlying jQuery XHR object that caused the error. */
174
+ jqXHR?: JQuery.jqXHR;
175
+ }
176
+ /** Definition for a mountable component that manages its own reactive lifecycle. */
177
+ export type ComponentFn<P = Record<string, unknown>> = ($el: JQuery, props: P) => EffectResult;
178
+ /** Lifecycle hooks for navigating between application routes. */
179
+ export interface RouteLifecycle {
180
+ /**
181
+ * Hook triggered before entering a route.
182
+ * Returning false aborts the navigation.
183
+ */
184
+ onEnter?: (params: Record<string, string>, router: Router) => Record<string, string> | undefined | false;
185
+ /**
186
+ * Hook triggered before leaving the current route.
187
+ * Returning false prevents navigation away.
188
+ */
189
+ onLeave?: (router: Router) => boolean | undefined;
190
+ /** Optional document title for the route. */
191
+ title?: string;
192
+ /** Optional metadata tags for the route (e.g., description, keywords). */
193
+ meta?: Record<string, string>;
194
+ }
195
+ /** Definition of a specific application route and its rendering logic. */
196
+ export interface RouteDefinition extends RouteLifecycle {
197
+ /** Selector for a template fragment to be cloned and rendered. */
198
+ template?: string;
199
+ /** Custom function to render the route content into the container. */
200
+ render?: (container: HTMLElement, route: string, params: Record<string, string>, onUnmount: (cleanupFn: () => void) => void, router: Router) => void;
201
+ /** Callback triggered after the route content has been mounted to the DOM. */
202
+ onMount?: ($content: JQuery, onUnmount: (cleanupFn: () => void) => void, router: Router) => void;
203
+ }
204
+ /** Global configuration for the reactive router. */
205
+ export interface RouteConfig {
206
+ /** The root element or selector where route content will be injected. */
207
+ target: string | JQuery<HTMLElement> | HTMLElement;
208
+ /** The default path to navigate to if no route matches. */
209
+ default?: string;
210
+ /** Mapping of path patterns to route definitions. */
211
+ routes?: Record<string, RouteDefinition>;
212
+ /** Synchronization mode: 'hash' or HTML5 'history' API. */
213
+ mode?: 'hash' | 'history';
214
+ /** Base path for the application (useful for history mode). */
215
+ basePath?: string;
216
+ /** Path to navigate to when a requested route is not found. */
217
+ notFound?: string;
218
+ /** Whether to automatically intercept and route link clicks. */
219
+ autoBindLinks?: boolean;
220
+ /** CSS class applied to navigation elements matching the active route. */
221
+ activeClass?: string;
222
+ /** Callback triggered immediately before a navigation transition starts. */
223
+ beforeTransition?: (from: string, to: string) => void;
224
+ /** Callback triggered after a navigation transition has completed. */
225
+ afterTransition?: (from: string, to: string) => void;
226
+ }
227
+ /** Represents a structured navigation location. */
228
+ export interface RouteLocation {
229
+ /** The normalized path part of the URL. */
230
+ path: string;
231
+ /** Key-value pairs of query string parameters. */
232
+ query: Record<string, string>;
233
+ /** Extracted parameters from dynamic segments (e.g., :id). */
234
+ params: Record<string, string>;
235
+ }
236
+ /** Interface for programmatically interacting with the application router. */
237
+ export interface Router {
238
+ /** Reactive atom containing the current route name. */
239
+ currentRoute: ReadonlyAtom<string>;
240
+ /** Reactive atom containing the current query string parameters. */
241
+ queryParams: ReadonlyAtom<Record<string, string>>;
242
+ /** Reactive atom containing the extracted path parameters. */
243
+ params: ReadonlyAtom<Record<string, string>>;
244
+ /** Reactive atom providing a unified snapshot of the current location. */
245
+ location: ReadonlyAtom<RouteLocation>;
246
+ /** Programmatically navigates to the specified path or location object. */
247
+ navigate: (to: string | Partial<RouteLocation>) => void;
248
+ /** Shuts down the router and releases all observers. */
249
+ destroy: () => void;
250
+ }
251
+ /** Options for AJAX-based fragment navigation. */
252
+ export interface AtomNavOptions {
253
+ /** The target container for injected content. */
254
+ target: string | JQuery<HTMLElement> | HTMLElement;
255
+ /** Optional sub-selector to extract from the loaded document. */
256
+ selector?: string;
257
+ /** Custom HTTP headers for navigation requests. */
258
+ headers?: Record<string, string>;
259
+ /** Hook triggered before a navigation request is initiated. */
260
+ onBeforeLoad?: (url: string) => boolean | undefined | Promise<boolean | undefined>;
261
+ /** Callback triggered after the content has been injected. */
262
+ onMount?: ($container: JQuery, url: string) => void;
263
+ /** Callback triggered before content is replaced. */
264
+ onUnmount?: ($container: JQuery, oldUrl: string) => void;
265
+ /** Callback for handling navigation errors. */
266
+ onError?: (err: unknown, url: string) => boolean | undefined;
267
+ /** Whether to reset scroll position to the top after navigation. */
268
+ scrollToTop?: boolean;
269
+ /** Whether to synchronize the document title with the loaded page. */
270
+ syncTitle?: boolean;
271
+ /** Optional window context for cross-origin navigation. */
272
+ window?: Window & typeof globalThis;
273
+ }
274
+ /** Interface for managing AJAX fragment navigation. */
275
+ export interface AtomNav {
276
+ /** Reactive atom containing the currently loaded URL. */
277
+ currentUrl: ReadonlyAtom<string>;
278
+ /** Reactive atom indicating whether a navigation request is in progress. */
279
+ isPending: ReadonlyAtom<boolean>;
280
+ /** Reactive atom indicating whether the last navigation failed. */
281
+ hasError: ReadonlyAtom<boolean>;
282
+ /** Navigates to a specific URL and replaces the container content. */
283
+ navigate(url: string, options?: {
284
+ replace?: boolean;
285
+ }): Promise<void>;
286
+ /** Disposes of the navigation manager and observers. */
287
+ destroy: () => void;
288
+ }
289
+ /**
290
+ * Internal state flags for two-way bindings.
291
+ *
292
+ * Logic: Feedback Loop Protection
293
+ * Prevents recursive update loops between the DOM and reactive atoms
294
+ * during two-way data flow (e.g., IME composition or rapid input events).
295
+ *
296
+ * @internal
297
+ */
298
+ export declare enum BindingFlags {
299
+ /** No active synchronization or interaction. */
300
+ None = 0,
301
+ /** The input element is currently focused by the user. */
302
+ Focused = 1,
303
+ /** The user is currently performing IME composition. */
304
+ Composing = 2,
305
+ /** Synchronization from DOM to Atom is currently active. */
306
+ SyncingToAtom = 4,
307
+ /** Synchronization from Atom to DOM is currently active. */
308
+ SyncingToDom = 8,
309
+ /** The binding is considered busy and will ignore external updates. */
310
+ Busy = 14
311
+ }
312
+ /**
313
+ * Options for customizing jQuery core method overrides.
314
+ *
315
+ * @public
316
+ */
317
+ export interface PatchOptions {
318
+ /**
319
+ * Automatically wraps .on()/.one() callbacks in $.batch() for reactivity.
320
+ * @default true
321
+ */
322
+ events?: boolean;
323
+ /**
324
+ * Hooks .remove()/.empty()/.detach() for automatic resource cleanup.
325
+ * @default true
326
+ */
327
+ lifecycle?: boolean;
328
+ }
329
+ /**
330
+ * Global configuration settings for the library.
331
+ *
332
+ * @public
333
+ */
334
+ export interface AEJConfig {
335
+ /**
336
+ * Configuration for jQuery prototype patches.
337
+ * Set to false to disable all automated overrides.
338
+ */
339
+ patch?: boolean | PatchOptions;
340
+ /**
341
+ * Configuration for the automated MutationObserver cleanup system.
342
+ * Set to false to manage reactive resource disposal manually.
343
+ */
344
+ autoCleanup?: boolean | {
345
+ root: Element | ShadowRoot | DocumentFragment;
346
+ };
347
+ }
348
+ /**
349
+ * A scoped version of the jQuery selector function.
350
+ *
351
+ * Logic: Scope Enforcement
352
+ * Restricts element selection to the component's internal DOM tree (ShadowRoot
353
+ * or host container) to ensure encapsulation and prevent cross-component leaks.
354
+ *
355
+ * @public
356
+ */
357
+ export type JQueryScopedSelector = (selector: string | JQuery | HTMLElement, context?: Element | Document | JQuery | ShadowRoot | DocumentFragment) => JQuery;
358
+ /**
359
+ * Composition-based controller for managing a component's reactive lifecycle.
360
+ *
361
+ * When to use:
362
+ * - To build Custom Elements that require reactive attribute and slot synchronization.
363
+ * - To manage complex component lifecycles with automated resource disposal.
364
+ * - To provide or inject reactive state across Shadow DOM boundaries.
365
+ *
366
+ * @public
367
+ */
368
+ export interface AtomComponentController {
369
+ /** The raw host element of the component. */
370
+ readonly host: HTMLElement;
371
+ /** The active root node (ShadowRoot or Host container). */
372
+ readonly root: Node | null;
373
+ /**
374
+ * Scoped jQuery selector.
375
+ * Limited to selecting elements within the component's encapsulated DOM.
376
+ */
377
+ readonly $: JQueryScopedSelector;
378
+ /**
379
+ * Factory function that returns a reactive lens atom for a specific HTML attribute.
380
+ * Accessing a name returns a WritableAtom<string | null>.
381
+ */
382
+ readonly attrs: (name: string) => WritableAtom<string | null>;
383
+ /**
384
+ * Factory function that returns a reactive lens atom for a specific Shadow DOM slot.
385
+ * Provides ReadonlyAtom<Node[]> for each named slot (or 'default' for unnamed).
386
+ */
387
+ readonly slots: (name: string) => ReadonlyAtom<Node[]>;
388
+ /**
389
+ * Access to the component's internal state and accessibility properties via ElementInternals.
390
+ * Available only if the browser supports attachInternals().
391
+ */
392
+ readonly internals?: ElementInternals | undefined;
393
+ /** Registers a reactive provider on this element for dependency injection. */
394
+ provideAtom<T = unknown>(key: string | symbol, val: T): void;
395
+ /** Injects a reactive value provided by an ancestor element. */
396
+ injectAtom<T = unknown>(key: string | symbol): WritableAtom<T> | null;
397
+ /**
398
+ * Initializes the component's reactive lifecycle and observers.
399
+ *
400
+ * Logic: Hybrid Options
401
+ * Accepts a raw ShadowRoot for traditional usage or a configuration object
402
+ * for declarative hydration and automatic event dispatching.
403
+ *
404
+ * @param options - ShadowRoot or configuration object for hydration and event dispatching.
405
+ */
406
+ setup(options?: ShadowRoot | {
407
+ shadowRoot?: ShadowRoot;
408
+ /** Maps event names to atoms or getter functions for automatic dispatching. */
409
+ dispatch?: Record<string, ReactiveValue<unknown>>;
410
+ /** Maps data-bind keys to atoms for declarative DOM hydration. */
411
+ bind?: Record<string, ReadonlyAtom<unknown>>;
412
+ /**
413
+ * Constructable stylesheets to be shared across instances.
414
+ * Strings are automatically converted to shared CSSStyleSheet objects.
415
+ */
416
+ styles?: (string | CSSStyleSheet)[];
417
+ /**
418
+ * Reactive accessibility bindings via AriaMixin (ElementInternals).
419
+ * Maps ARIA properties (e.g., 'ariaExpanded') to atoms.
420
+ */
421
+ aria?: Record<string, ReadonlyAtom<unknown>>;
422
+ /**
423
+ * Reactive CSS Part bindings.
424
+ * Maps element selectors or data-aej-part keys to atoms for dynamic part names.
425
+ */
426
+ parts?: Record<string, ReadonlyAtom<string | string[] | Record<string, boolean>>>;
427
+ /**
428
+ * Reactive value for Form-Associated Custom Elements (FACE).
429
+ * Automatically synchronized with the native <form> via internals.setFormValue().
430
+ */
431
+ value?: ReadonlyAtom<unknown> | {
432
+ val: ReadonlyAtom<unknown>;
433
+ state?: ReadonlyAtom<unknown>;
434
+ };
435
+ /**
436
+ * Reactive validation logic for Form-Associated Custom Elements (FACE).
437
+ * Can be a validation message string, a ValidityStateFlags object, or an atom/function returning either.
438
+ */
439
+ validation?: ReadonlyAtom<ValidityStateFlags | string> | ((val: unknown) => ValidityStateFlags | string);
440
+ }): void;
441
+ /**
442
+ * Tears down all reactive bindings and observers.
443
+ * Disconnects observers immediately; actual cleanup is deferred to a microtask.
444
+ *
445
+ * Logic: Cleanup Mechanism
446
+ * Releases all listeners, observers, and effects created during setup() or
447
+ * through reactive property access (attrs/slots).
448
+ */
449
+ teardown(): void;
450
+ }
451
+ /**
452
+ * Represents an HTMLElement that has been enhanced with an AEJ controller.
453
+ *
454
+ * @public
455
+ */
456
+ export type AtomComponentElement<T extends HTMLElement = HTMLElement> = T & {
457
+ readonly aej: AtomComponentController;
458
+ };
459
+ /**
460
+ * Declarative specification for Atom-Effect components.
461
+ * @internal
462
+ */
463
+ export interface AtomComponentStatic {
464
+ aejStyles?: (string | CSSStyleSheet)[];
465
+ aejBind?: Record<string, ReadonlyAtom<unknown>>;
466
+ aejAria?: Record<string, ReadonlyAtom<unknown>>;
467
+ aejParts?: Record<string, ReadonlyAtom<string | string[] | Record<string, boolean>>>;
468
+ aejDispatch?: Record<string, ReactiveValue<unknown>>;
469
+ aejValue?: ReadonlyAtom<unknown> | {
470
+ val: ReadonlyAtom<unknown>;
471
+ state?: ReadonlyAtom<unknown>;
472
+ };
473
+ aejValidation?: ReadonlyAtom<ValidityStateFlags | string> | ((val: unknown) => ValidityStateFlags | string);
474
+ }
475
+ export type { ComputedAtom, ComputedOptions, Dependency, EffectObject, MergedDependencyValue, ReadonlyAtom, WritableAtom, };
476
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,IAAI,eAAe,EAC9B,YAAY,EACZ,eAAe,EACf,UAAU,EACV,YAAY,EACZ,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACb,MAAM,qBAAqB,CAAC;AAE7B,iFAAiF;AACjF,MAAM,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC;AAEvC,kEAAkE;AAClE,MAAM,WAAW,kBAAkB;IACjC,sDAAsD;IACtD,OAAO,EAAE,aAAa,CAAC;CACxB;AAED,iFAAiF;AACjF,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,aAAa,GAAG,kBAAkB,CAAC;AAE1E,yEAAyE;AACzE,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EA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,QAAQ,CAAC,GAAG,EAAE,uBAAuB,CAAC;CACvC,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,CAAC,MAAM,GAAG,aAAa,CAAC,EAAE,CAAC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACrF,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;IACrD,QAAQ,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,GAAG;QAAE,GAAG,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;QAAC,KAAK,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAA;KAAE,CAAC;IACjG,aAAa,CAAC,EACV,YAAY,CAAC,kBAAkB,GAAG,MAAM,CAAC,GACzC,CAAC,CAAC,GAAG,EAAE,OAAO,KAAK,kBAAkB,GAAG,MAAM,CAAC,CAAC;CACrD;AAED,YAAY,EACV,YAAY,EACZ,eAAe,EACf,UAAU,EACV,YAAY,EACZ,qBAAqB,EACrB,YAAY,EACZ,YAAY,GACb,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Provides visual instrumentation and diagnostic logging for the reactive system.
3
+ *
4
+ * When to use:
5
+ * - To debug reactive updates and DOM mutations in real-time.
6
+ * - To inspect error causes and stack traces within binding hooks.
7
+ *
8
+ * Logic: Runtime Control
9
+ * The `debug.enabled` flag can be toggled at runtime (e.g., via the browser console)
10
+ * to activate or deactivate visual instrumentation without requiring a page reload.
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * // Enable visual highlights for DOM updates
15
+ * $.debug.enabled = true;
16
+ * ```
17
+ */
18
+ export declare const debug: {
19
+ /** Global toggle for the debug system. */
20
+ enabled: boolean;
21
+ /** Logs a warning message with the standardized library prefix. */
22
+ warn: (prefix: string, message: string, ...rest: unknown[]) => void;
23
+ /** Logs an error with the standardized library prefix and the associated cause. */
24
+ error: (prefix: string, message: string, cause: unknown) => void;
25
+ /**
26
+ * Logs a DOM mutation and triggers a visual highlight on the target element.
27
+ *
28
+ * Logic: Mutation Tracking
29
+ * When enabled, this method logs the property change and its new value to
30
+ * the console, followed by a "flash" effect on the element to assist in
31
+ * identifying the source of the mutation.
32
+ *
33
+ * @param prefix - The logging prefix.
34
+ * @param target - The DOM element or JQuery collection that was updated.
35
+ * @param type - The type of mutation (e.g., 'text', 'html', 'attr').
36
+ * @param value - The new value applied to the target.
37
+ */
38
+ domUpdated(prefix: string, target: Element | JQuery, type: string, value: unknown): void;
39
+ };
40
+ //# sourceMappingURL=debug.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/utils/debug.ts"],"names":[],"mappings":"AA0EA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,KAAK;IAChB,0CAA0C;;IAG1C,mEAAmE;mBACpD,MAAM,WAAW,MAAM,WAAW,OAAO,EAAE;IAG1D,mFAAmF;oBACnE,MAAM,WAAW,MAAM,SAAS,OAAO;IAGvD;;;;;;;;;;;;OAYG;uBACgB,MAAM,UAAU,OAAO,GAAG,MAAM,QAAQ,MAAM,SAAS,OAAO;CAUlF,CAAC"}
@@ -0,0 +1,51 @@
1
+ import { RouteDefinition } from '../types';
2
+ /**
3
+ * Determines if a value is a Promise or a thenable object.
4
+ *
5
+ * Logic: Duck-Typing
6
+ * Uses a standard thenable check to identify asynchronous objects across
7
+ * different implementation libraries.
8
+ *
9
+ * @internal
10
+ */
11
+ export declare const isPromise: <T>(v: unknown) => v is Promise<T>;
12
+ /**
13
+ * Generates a concise, human-readable CSS selector for a DOM element.
14
+ *
15
+ * Logic: Element Signature
16
+ * Prioritizes tag names, IDs, and class lists to create a reference string
17
+ * for debugging and diagnostic logging.
18
+ *
19
+ * Caution: SVG Compatibility
20
+ * SVG elements use `SVGAnimatedString` for the `className` property. This
21
+ * method detects and unpacks `baseVal` to ensure consistent selector
22
+ * generation across HTML and SVG namespaces.
23
+ *
24
+ * @internal
25
+ */
26
+ export declare function getSelector(el: Element): string;
27
+ /**
28
+ * Determines if a route is defined by a template selector.
29
+ * @internal
30
+ */
31
+ export declare const isTemplateRoute: (r: RouteDefinition) => boolean;
32
+ /**
33
+ * Determines if a route is defined by a custom render function.
34
+ * @internal
35
+ */
36
+ export declare const isRenderRoute: (r: RouteDefinition) => boolean;
37
+ /**
38
+ * Recursively flattens an object into a FormData instance.
39
+ *
40
+ * Logic: Nested Naming
41
+ * Converts nested structures into bracket-notation strings (e.g., 'user[profile][name]')
42
+ * to ensure compatibility with standard form parsers in most backend frameworks.
43
+ *
44
+ * @param fd - The FormData instance to populate.
45
+ * @param prefix - The name prefix for the current path.
46
+ * @param obj - The value to flatten.
47
+ *
48
+ * @internal
49
+ */
50
+ export declare function flattenToFormData(fd: FormData, prefix: string, obj: unknown): void;
51
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,GAAG,OAAO,KAAG,CAAC,IAAI,OAAO,CAAC,CAAC,CAGN,CAAC;AAEnD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,OAAO,GAAG,MAAM,CAyB/C;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,GAAG,eAAe,KAAG,OACkB,CAAC;AAExE;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,GAAG,eAAe,KAAG,OACoB,CAAC;AAExE;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,IAAI,CASlF"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Configuration for the HTML sanitization engine.
3
+ */
4
+ export interface SanitizationPolicy {
5
+ /** List of attribute names whose values should be validated as URIs. */
6
+ readonly urlAttributes: string[];
7
+ /** List of element local names that should be neutralized or stripped. */
8
+ readonly blacklistedTags: string[];
9
+ }
10
+ /**
11
+ * The standard sanitization policy used by the library.
12
+ *
13
+ * Logic: Strict Isolation
14
+ * Targets executable elements (script, iframe), metadata (base, meta),
15
+ * and layout-breaking tags (body, title).
16
+ */
17
+ export declare const DEFAULT_POLICY: SanitizationPolicy;
18
+ /**
19
+ * Sanitizes an HTML string based on a security policy.
20
+ *
21
+ * When to use:
22
+ * - Before injecting untrusted HTML content into the DOM via `atomHtml` or jQuery methods.
23
+ * - To filter potentially malicious attributes, event handlers, and active scripts.
24
+ *
25
+ * @param html The raw HTML string to be sanitized.
26
+ * @param policy Custom sanitization policy. Defaults to `DEFAULT_POLICY`.
27
+ *
28
+ * @returns A safe HTML string with dangerous elements neutralized and attributes scrubbed.
29
+ *
30
+ * @example
31
+ * const safeHtml = sanitizeHtml('<img src=x onerror=alert(1)>');
32
+ * // Returns: '<img src="x" data-unsafe-attr="onerror">'
33
+ */
34
+ export declare function sanitizeHtml(html: string | null | undefined, policy?: SanitizationPolicy): string;
35
+ /**
36
+ * Validates if a specific attribute/value pair is considered dangerous under the policy.
37
+ *
38
+ * @param attr The attribute name to check.
39
+ * @param val The value to validate.
40
+ * @param policy The policy defining URL-carrying attributes.
41
+ *
42
+ * @returns True if the value contains a dangerous protocol or is a restricted sink.
43
+ */
44
+ export declare const isDangerousUrl: (attr: string, val: string, policy?: SanitizationPolicy) => boolean;
45
+ /**
46
+ * Validates if a CSS value contains dangerous patterns.
47
+ *
48
+ * @param val The CSS property value to check.
49
+ * @returns True if dangerous patterns (e.g., expression, javascript) are detected.
50
+ */
51
+ export declare const isDangerousCssValue: (val: string) => boolean;
52
+ //# sourceMappingURL=sanitize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../src/utils/sanitize.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,wEAAwE;IACxE,QAAQ,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC;IACjC,0EAA0E;IAC1E,QAAQ,CAAC,eAAe,EAAE,MAAM,EAAE,CAAC;CACpC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,EAAE,kBAwC5B,CAAC;AAsXF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC/B,MAAM,GAAE,kBAAmC,GAC1C,MAAM,CAGR;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,GACzB,MAAM,MAAM,EACZ,KAAK,MAAM,EACX,SAAQ,kBAAmC,KAC1C,OAGF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,KAAK,MAAM,KAAG,OAAoC,CAAC"}