@symfony/ux-live-component 2.23.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/LICENSE +21 -0
- package/README.md +14 -0
- package/dist/Backend/Backend.d.ts +31 -0
- package/dist/Backend/BackendRequest.d.ts +9 -0
- package/dist/Backend/BackendResponse.d.ts +6 -0
- package/dist/Backend/RequestBuilder.d.ts +17 -0
- package/dist/Component/ElementDriver.d.ts +31 -0
- package/dist/Component/UnsyncedInputsTracker.d.ts +28 -0
- package/dist/Component/ValueStore.d.ts +17 -0
- package/dist/Component/index.d.ts +74 -0
- package/dist/Component/plugins/ChildComponentPlugin.d.ts +11 -0
- package/dist/Component/plugins/LazyPlugin.d.ts +7 -0
- package/dist/Component/plugins/LoadingPlugin.d.ts +23 -0
- package/dist/Component/plugins/PageUnloadingPlugin.d.ts +6 -0
- package/dist/Component/plugins/PluginInterface.d.ts +4 -0
- package/dist/Component/plugins/PollingPlugin.d.ts +10 -0
- package/dist/Component/plugins/QueryStringPlugin.d.ts +13 -0
- package/dist/Component/plugins/SetValueOntoModelFieldsPlugin.d.ts +6 -0
- package/dist/Component/plugins/ValidatedFieldsPlugin.d.ts +6 -0
- package/dist/ComponentRegistry.d.ts +8 -0
- package/dist/Directive/directives_parser.d.ts +11 -0
- package/dist/Directive/get_model_binding.d.ts +9 -0
- package/dist/HookManager.d.ts +7 -0
- package/dist/PollingDirector.d.ts +16 -0
- package/dist/Rendering/ChangingItemsTracker.d.ts +12 -0
- package/dist/Rendering/ElementChanges.d.ts +26 -0
- package/dist/Rendering/ExternalMutationTracker.d.ts +26 -0
- package/dist/Util/getElementAsTagText.d.ts +1 -0
- package/dist/data_manipulation_utils.d.ts +2 -0
- package/dist/dom_utils.d.ts +10 -0
- package/dist/live.min.css +1 -0
- package/dist/live_controller.d.ts +112 -0
- package/dist/live_controller.js +3190 -0
- package/dist/morphdom.d.ts +2 -0
- package/dist/normalize_attributes_for_comparison.d.ts +1 -0
- package/dist/string_utils.d.ts +3 -0
- package/dist/url_utils.d.ts +11 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021-present Fabien Potencier
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is furnished
|
|
10
|
+
to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# @symfony/ux-live-component
|
|
2
|
+
|
|
3
|
+
Live Component: bring server-side re-rendering & model binding to any element.
|
|
4
|
+
|
|
5
|
+
**ℹ️ Direct installation of this package is for advanced users only.** We strongly recommend installing it through the PHP package [symfony/ux-live-component](https://packagist.org/packages/symfony/ux-live-component) in a Symfony application with Flex enabled.
|
|
6
|
+
|
|
7
|
+
If you still want to install this package directly, **make sure its version exactly matches [symfony/ux-live-component](https://packagist.org/packages/symfony/ux-live-component) PHP package version.**
|
|
8
|
+
|
|
9
|
+
## Resources
|
|
10
|
+
|
|
11
|
+
- [Documentation](https://symfony.com/bundles/ux-live-component/current/index.html)
|
|
12
|
+
- [Report issues](https://github.com/symfony/ux/issues) and
|
|
13
|
+
[send Pull Requests](https://github.com/symfony/ux/pulls)
|
|
14
|
+
in the [main Symfony UX repository](https://github.com/symfony/ux)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import BackendRequest from './BackendRequest';
|
|
2
|
+
export interface ChildrenFingerprints {
|
|
3
|
+
[key: string]: {
|
|
4
|
+
fingerprint: string;
|
|
5
|
+
tag: string;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export interface BackendInterface {
|
|
9
|
+
makeRequest(props: any, actions: BackendAction[], updated: {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}, children: ChildrenFingerprints, updatedPropsFromParent: {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}, files: {
|
|
14
|
+
[key: string]: FileList;
|
|
15
|
+
}): BackendRequest;
|
|
16
|
+
}
|
|
17
|
+
export interface BackendAction {
|
|
18
|
+
name: string;
|
|
19
|
+
args: Record<string, string>;
|
|
20
|
+
}
|
|
21
|
+
export default class implements BackendInterface {
|
|
22
|
+
private readonly requestBuilder;
|
|
23
|
+
constructor(url: string, method?: 'get' | 'post');
|
|
24
|
+
makeRequest(props: any, actions: BackendAction[], updated: {
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}, children: ChildrenFingerprints, updatedPropsFromParent: {
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
}, files: {
|
|
29
|
+
[key: string]: FileList;
|
|
30
|
+
}): BackendRequest;
|
|
31
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export default class {
|
|
2
|
+
promise: Promise<Response>;
|
|
3
|
+
actions: string[];
|
|
4
|
+
updatedModels: string[];
|
|
5
|
+
isResolved: boolean;
|
|
6
|
+
constructor(promise: Promise<Response>, actions: string[], updateModels: string[]);
|
|
7
|
+
containsOneOfActions(targetedActions: string[]): boolean;
|
|
8
|
+
areAnyModelsUpdated(targetedModels: string[]): boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { BackendAction, ChildrenFingerprints } from './Backend';
|
|
2
|
+
export default class {
|
|
3
|
+
private url;
|
|
4
|
+
private method;
|
|
5
|
+
constructor(url: string, method?: 'get' | 'post');
|
|
6
|
+
buildRequest(props: any, actions: BackendAction[], updated: {
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}, children: ChildrenFingerprints, updatedPropsFromParent: {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}, files: {
|
|
11
|
+
[key: string]: FileList;
|
|
12
|
+
}): {
|
|
13
|
+
url: string;
|
|
14
|
+
fetchOptions: RequestInit;
|
|
15
|
+
};
|
|
16
|
+
private willDataFitInUrl;
|
|
17
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type LiveControllerDefault from '../live_controller';
|
|
2
|
+
export interface ElementDriver {
|
|
3
|
+
getModelName(element: HTMLElement): string | null;
|
|
4
|
+
getComponentProps(): any;
|
|
5
|
+
getEventsToEmit(): Array<{
|
|
6
|
+
event: string;
|
|
7
|
+
data: any;
|
|
8
|
+
target: string | null;
|
|
9
|
+
componentName: string | null;
|
|
10
|
+
}>;
|
|
11
|
+
getBrowserEventsToDispatch(): Array<{
|
|
12
|
+
event: string;
|
|
13
|
+
payload: any;
|
|
14
|
+
}>;
|
|
15
|
+
}
|
|
16
|
+
export declare class StimulusElementDriver implements ElementDriver {
|
|
17
|
+
private readonly controller;
|
|
18
|
+
constructor(controller: LiveControllerDefault);
|
|
19
|
+
getModelName(element: HTMLElement): string | null;
|
|
20
|
+
getComponentProps(): any;
|
|
21
|
+
getEventsToEmit(): Array<{
|
|
22
|
+
event: string;
|
|
23
|
+
data: any;
|
|
24
|
+
target: string | null;
|
|
25
|
+
componentName: string | null;
|
|
26
|
+
}>;
|
|
27
|
+
getBrowserEventsToDispatch(): Array<{
|
|
28
|
+
event: string;
|
|
29
|
+
payload: any;
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ElementDriver } from './ElementDriver';
|
|
2
|
+
import type Component from './index';
|
|
3
|
+
export default class {
|
|
4
|
+
private readonly component;
|
|
5
|
+
private readonly modelElementResolver;
|
|
6
|
+
private readonly unsyncedInputs;
|
|
7
|
+
private elementEventListeners;
|
|
8
|
+
constructor(component: Component, modelElementResolver: ElementDriver);
|
|
9
|
+
activate(): void;
|
|
10
|
+
deactivate(): void;
|
|
11
|
+
markModelAsSynced(modelName: string): void;
|
|
12
|
+
private handleInputEvent;
|
|
13
|
+
private updateModelFromElement;
|
|
14
|
+
getUnsyncedInputs(): HTMLElement[];
|
|
15
|
+
getUnsyncedModels(): string[];
|
|
16
|
+
resetUnsyncedFields(): void;
|
|
17
|
+
}
|
|
18
|
+
export declare class UnsyncedInputContainer {
|
|
19
|
+
private unsyncedModelFields;
|
|
20
|
+
private unsyncedNonModelFields;
|
|
21
|
+
private unsyncedModelNames;
|
|
22
|
+
constructor();
|
|
23
|
+
add(element: HTMLElement, modelName?: string | null): void;
|
|
24
|
+
resetUnsyncedFields(): void;
|
|
25
|
+
allUnsyncedInputs(): HTMLElement[];
|
|
26
|
+
markModelAsSynced(modelName: string): void;
|
|
27
|
+
getUnsyncedModelNames(): string[];
|
|
28
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default class {
|
|
2
|
+
private props;
|
|
3
|
+
private dirtyProps;
|
|
4
|
+
private pendingProps;
|
|
5
|
+
private updatedPropsFromParent;
|
|
6
|
+
constructor(props: any);
|
|
7
|
+
get(name: string): any;
|
|
8
|
+
has(name: string): boolean;
|
|
9
|
+
set(name: string, value: any): boolean;
|
|
10
|
+
getOriginalProps(): any;
|
|
11
|
+
getDirtyProps(): any;
|
|
12
|
+
getUpdatedPropsFromParent(): any;
|
|
13
|
+
flushDirtyPropsToPending(): void;
|
|
14
|
+
reinitializeAllProps(props: any): void;
|
|
15
|
+
pushPendingPropsBackToDirty(): void;
|
|
16
|
+
storeNewPropsFromParent(props: any): boolean;
|
|
17
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { BackendInterface } from '../Backend/Backend';
|
|
2
|
+
import type BackendRequest from '../Backend/BackendRequest';
|
|
3
|
+
import BackendResponse from '../Backend/BackendResponse';
|
|
4
|
+
import type { ElementDriver } from './ElementDriver';
|
|
5
|
+
import ValueStore from './ValueStore';
|
|
6
|
+
import type { PluginInterface } from './plugins/PluginInterface';
|
|
7
|
+
type MaybePromise<T = void> = T | Promise<T>;
|
|
8
|
+
export type ComponentHooks = {
|
|
9
|
+
connect: (component: Component) => MaybePromise;
|
|
10
|
+
disconnect: (component: Component) => MaybePromise;
|
|
11
|
+
'request:started': (requestConfig: any) => MaybePromise;
|
|
12
|
+
'render:finished': (component: Component) => MaybePromise;
|
|
13
|
+
'response:error': (backendResponse: BackendResponse, controls: {
|
|
14
|
+
displayError: boolean;
|
|
15
|
+
}) => MaybePromise;
|
|
16
|
+
'loading.state:started': (element: HTMLElement, request: BackendRequest) => MaybePromise;
|
|
17
|
+
'loading.state:finished': (element: HTMLElement) => MaybePromise;
|
|
18
|
+
'model:set': (model: string, value: any, component: Component) => MaybePromise;
|
|
19
|
+
};
|
|
20
|
+
export type ComponentHookName = keyof ComponentHooks;
|
|
21
|
+
export type ComponentHookCallback<T extends string = ComponentHookName> = T extends ComponentHookName ? ComponentHooks[T] : (...args: any[]) => MaybePromise;
|
|
22
|
+
export default class Component {
|
|
23
|
+
readonly element: HTMLElement;
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly listeners: Map<string, string[]>;
|
|
26
|
+
private backend;
|
|
27
|
+
readonly elementDriver: ElementDriver;
|
|
28
|
+
id: string | null;
|
|
29
|
+
fingerprint: string;
|
|
30
|
+
readonly valueStore: ValueStore;
|
|
31
|
+
private readonly unsyncedInputsTracker;
|
|
32
|
+
private hooks;
|
|
33
|
+
defaultDebounce: number;
|
|
34
|
+
private backendRequest;
|
|
35
|
+
private pendingActions;
|
|
36
|
+
private pendingFiles;
|
|
37
|
+
private isRequestPending;
|
|
38
|
+
private requestDebounceTimeout;
|
|
39
|
+
private nextRequestPromise;
|
|
40
|
+
private nextRequestPromiseResolve;
|
|
41
|
+
private externalMutationTracker;
|
|
42
|
+
constructor(element: HTMLElement, name: string, props: any, listeners: Array<{
|
|
43
|
+
event: string;
|
|
44
|
+
action: string;
|
|
45
|
+
}>, id: string | null, backend: BackendInterface, elementDriver: ElementDriver);
|
|
46
|
+
addPlugin(plugin: PluginInterface): void;
|
|
47
|
+
connect(): void;
|
|
48
|
+
disconnect(): void;
|
|
49
|
+
on<T extends string | ComponentHookName = ComponentHookName>(hookName: T, callback: ComponentHookCallback<T>): void;
|
|
50
|
+
off<T extends string | ComponentHookName = ComponentHookName>(hookName: T, callback: ComponentHookCallback<T>): void;
|
|
51
|
+
set(model: string, value: any, reRender?: boolean, debounce?: number | boolean): Promise<BackendResponse>;
|
|
52
|
+
getData(model: string): any;
|
|
53
|
+
action(name: string, args?: any, debounce?: number | boolean): Promise<BackendResponse>;
|
|
54
|
+
files(key: string, input: HTMLInputElement): void;
|
|
55
|
+
render(): Promise<BackendResponse>;
|
|
56
|
+
getUnsyncedModels(): string[];
|
|
57
|
+
emit(name: string, data: any, onlyMatchingComponentsNamed?: string | null): void;
|
|
58
|
+
emitUp(name: string, data: any, onlyMatchingComponentsNamed?: string | null): void;
|
|
59
|
+
emitSelf(name: string, data: any): void;
|
|
60
|
+
private performEmit;
|
|
61
|
+
private doEmit;
|
|
62
|
+
private isTurboEnabled;
|
|
63
|
+
private tryStartingRequest;
|
|
64
|
+
private performRequest;
|
|
65
|
+
private processRerender;
|
|
66
|
+
private calculateDebounce;
|
|
67
|
+
private clearRequestDebounceTimeout;
|
|
68
|
+
private debouncedStartRequest;
|
|
69
|
+
private renderError;
|
|
70
|
+
private resetPromise;
|
|
71
|
+
_updateFromParentProps(props: any): void;
|
|
72
|
+
}
|
|
73
|
+
export declare function proxifyComponent(component: Component): Component;
|
|
74
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type Component from '../../Component';
|
|
2
|
+
import type { PluginInterface } from './PluginInterface';
|
|
3
|
+
export default class implements PluginInterface {
|
|
4
|
+
private readonly component;
|
|
5
|
+
private parentModelBindings;
|
|
6
|
+
constructor(component: Component);
|
|
7
|
+
attachToComponent(component: Component): void;
|
|
8
|
+
private getChildrenFingerprints;
|
|
9
|
+
private notifyParentModelChange;
|
|
10
|
+
private getChildren;
|
|
11
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type BackendRequest from '../../Backend/BackendRequest';
|
|
2
|
+
import type Component from '../../Component';
|
|
3
|
+
import { type Directive } from '../../Directive/directives_parser';
|
|
4
|
+
import type { PluginInterface } from './PluginInterface';
|
|
5
|
+
interface ElementLoadingDirectives {
|
|
6
|
+
element: HTMLElement | SVGElement;
|
|
7
|
+
directives: Directive[];
|
|
8
|
+
}
|
|
9
|
+
export default class implements PluginInterface {
|
|
10
|
+
attachToComponent(component: Component): void;
|
|
11
|
+
startLoading(component: Component, targetElement: HTMLElement | SVGElement, backendRequest: BackendRequest): void;
|
|
12
|
+
finishLoading(component: Component, targetElement: HTMLElement | SVGElement): void;
|
|
13
|
+
private handleLoadingToggle;
|
|
14
|
+
private handleLoadingDirective;
|
|
15
|
+
getLoadingDirectives(component: Component, element: HTMLElement | SVGElement): ElementLoadingDirectives[];
|
|
16
|
+
private showElement;
|
|
17
|
+
private hideElement;
|
|
18
|
+
private addClass;
|
|
19
|
+
private removeClass;
|
|
20
|
+
private addAttributes;
|
|
21
|
+
private removeAttributes;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type Component from '../index';
|
|
2
|
+
import type { PluginInterface } from './PluginInterface';
|
|
3
|
+
export default class implements PluginInterface {
|
|
4
|
+
private element;
|
|
5
|
+
private pollingDirector;
|
|
6
|
+
attachToComponent(component: Component): void;
|
|
7
|
+
addPoll(actionName: string, duration: number): void;
|
|
8
|
+
clearPolling(): void;
|
|
9
|
+
private initializePolling;
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type Component from '../index';
|
|
2
|
+
import type { PluginInterface } from './PluginInterface';
|
|
3
|
+
interface QueryMapping {
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
export default class implements PluginInterface {
|
|
7
|
+
private readonly mapping;
|
|
8
|
+
constructor(mapping: {
|
|
9
|
+
[p: string]: QueryMapping;
|
|
10
|
+
});
|
|
11
|
+
attachToComponent(component: Component): void;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type Component from './Component';
|
|
2
|
+
export declare const resetRegistry: () => void;
|
|
3
|
+
export declare const registerComponent: (component: Component) => void;
|
|
4
|
+
export declare const unregisterComponent: (component: Component) => void;
|
|
5
|
+
export declare const getComponent: (element: HTMLElement) => Promise<Component>;
|
|
6
|
+
export declare const findComponents: (currentComponent: Component, onlyParents: boolean, onlyMatchName: string | null) => Component[];
|
|
7
|
+
export declare const findChildren: (currentComponent: Component) => Component[];
|
|
8
|
+
export declare const findParent: (currentComponent: Component) => Component | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface DirectiveModifier {
|
|
2
|
+
name: string;
|
|
3
|
+
value: string | null;
|
|
4
|
+
}
|
|
5
|
+
export interface Directive {
|
|
6
|
+
action: string;
|
|
7
|
+
args: string[];
|
|
8
|
+
modifiers: DirectiveModifier[];
|
|
9
|
+
getString: () => string;
|
|
10
|
+
}
|
|
11
|
+
export declare function parseDirectives(content: string | null): Directive[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Directive } from './directives_parser';
|
|
2
|
+
export interface ModelBinding {
|
|
3
|
+
modelName: string;
|
|
4
|
+
innerModelName: string | null;
|
|
5
|
+
shouldRender: boolean;
|
|
6
|
+
debounce: number | boolean;
|
|
7
|
+
targetEventName: string | null;
|
|
8
|
+
}
|
|
9
|
+
export default function (modelDirective: Directive): ModelBinding;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ComponentHookCallback, ComponentHookName } from './Component';
|
|
2
|
+
export default class {
|
|
3
|
+
private hooks;
|
|
4
|
+
register<T extends string | ComponentHookName = ComponentHookName>(hookName: T, callback: ComponentHookCallback<T>): void;
|
|
5
|
+
unregister<T extends string | ComponentHookName = ComponentHookName>(hookName: T, callback: ComponentHookCallback<T>): void;
|
|
6
|
+
triggerHook<T extends string | ComponentHookName = ComponentHookName>(hookName: T, ...args: Parameters<ComponentHookCallback<T>>): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type Component from './Component';
|
|
2
|
+
export default class {
|
|
3
|
+
component: Component;
|
|
4
|
+
isPollingActive: boolean;
|
|
5
|
+
polls: Array<{
|
|
6
|
+
actionName: string;
|
|
7
|
+
duration: number;
|
|
8
|
+
}>;
|
|
9
|
+
pollingIntervals: number[];
|
|
10
|
+
constructor(component: Component);
|
|
11
|
+
addPoll(actionName: string, duration: number): void;
|
|
12
|
+
startAllPolling(): void;
|
|
13
|
+
stopAllPolling(): void;
|
|
14
|
+
clearPolling(): void;
|
|
15
|
+
private initiatePoll;
|
|
16
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default class {
|
|
2
|
+
private changedItems;
|
|
3
|
+
private removedItems;
|
|
4
|
+
setItem(itemName: string, newValue: string, previousValue: string | null): void;
|
|
5
|
+
removeItem(itemName: string, currentValue: string | null): void;
|
|
6
|
+
getChangedItems(): {
|
|
7
|
+
name: string;
|
|
8
|
+
value: string;
|
|
9
|
+
}[];
|
|
10
|
+
getRemovedItems(): string[];
|
|
11
|
+
isEmpty(): boolean;
|
|
12
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default class ElementChanges {
|
|
2
|
+
private addedClasses;
|
|
3
|
+
private removedClasses;
|
|
4
|
+
private styleChanges;
|
|
5
|
+
private attributeChanges;
|
|
6
|
+
addClass(className: string): void;
|
|
7
|
+
removeClass(className: string): void;
|
|
8
|
+
addStyle(styleName: string, newValue: string, originalValue: string | null): void;
|
|
9
|
+
removeStyle(styleName: string, originalValue: string): void;
|
|
10
|
+
addAttribute(attributeName: string, newValue: string, originalValue: string | null): void;
|
|
11
|
+
removeAttribute(attributeName: string, originalValue: string | null): void;
|
|
12
|
+
getAddedClasses(): string[];
|
|
13
|
+
getRemovedClasses(): string[];
|
|
14
|
+
getChangedStyles(): {
|
|
15
|
+
name: string;
|
|
16
|
+
value: string;
|
|
17
|
+
}[];
|
|
18
|
+
getRemovedStyles(): string[];
|
|
19
|
+
getChangedAttributes(): {
|
|
20
|
+
name: string;
|
|
21
|
+
value: string;
|
|
22
|
+
}[];
|
|
23
|
+
getRemovedAttributes(): string[];
|
|
24
|
+
applyToElement(element: HTMLElement): void;
|
|
25
|
+
isEmpty(): boolean;
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import ElementChanges from './ElementChanges';
|
|
2
|
+
export default class {
|
|
3
|
+
private element;
|
|
4
|
+
private shouldTrackChangeCallback;
|
|
5
|
+
private mutationObserver;
|
|
6
|
+
private changedElements;
|
|
7
|
+
changedElementsCount: number;
|
|
8
|
+
private addedElements;
|
|
9
|
+
private removedElements;
|
|
10
|
+
private isStarted;
|
|
11
|
+
constructor(element: Element, shouldTrackChangeCallback: (element: Element) => boolean);
|
|
12
|
+
start(): void;
|
|
13
|
+
stop(): void;
|
|
14
|
+
getChangedElement(element: Element): ElementChanges | null;
|
|
15
|
+
getAddedElements(): Element[];
|
|
16
|
+
wasElementAdded(element: Element): boolean;
|
|
17
|
+
handlePendingChanges(): void;
|
|
18
|
+
private onMutations;
|
|
19
|
+
private handleChildListMutation;
|
|
20
|
+
private handleAttributeMutation;
|
|
21
|
+
private handleClassAttributeMutation;
|
|
22
|
+
private handleStyleAttributeMutation;
|
|
23
|
+
private handleGenericAttributeMutation;
|
|
24
|
+
private extractStyles;
|
|
25
|
+
private isElementAddedByTranslation;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function getElementAsTagText(element: HTMLElement): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type Component from './Component';
|
|
2
|
+
import type ValueStore from './Component/ValueStore';
|
|
3
|
+
import { type Directive } from './Directive/directives_parser';
|
|
4
|
+
export declare function getValueFromElement(element: HTMLElement, valueStore: ValueStore): string | string[] | null | boolean;
|
|
5
|
+
export declare function setValueOnElement(element: HTMLElement, value: any): void;
|
|
6
|
+
export declare function getAllModelDirectiveFromElements(element: HTMLElement): Directive[];
|
|
7
|
+
export declare function getModelDirectiveFromElement(element: HTMLElement, throwOnMissing?: boolean): null | Directive;
|
|
8
|
+
export declare function elementBelongsToThisComponent(element: Element, component: Component): boolean;
|
|
9
|
+
export declare function cloneHTMLElement(element: HTMLElement): HTMLElement;
|
|
10
|
+
export declare function htmlToElement(html: string): HTMLElement;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[data-loading=""],[data-loading=show],[data-loading=delay\|show]{display:none}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Controller } from '@hotwired/stimulus';
|
|
2
|
+
import { type BackendInterface } from './Backend/Backend';
|
|
3
|
+
import Component from './Component';
|
|
4
|
+
export { Component };
|
|
5
|
+
export { getComponent } from './ComponentRegistry';
|
|
6
|
+
export interface LiveEvent extends CustomEvent {
|
|
7
|
+
detail: {
|
|
8
|
+
controller: LiveController;
|
|
9
|
+
component: Component;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export interface LiveController {
|
|
13
|
+
element: HTMLElement;
|
|
14
|
+
component: Component;
|
|
15
|
+
}
|
|
16
|
+
export default class LiveControllerDefault extends Controller<HTMLElement> implements LiveController {
|
|
17
|
+
static values: {
|
|
18
|
+
name: StringConstructor;
|
|
19
|
+
url: StringConstructor;
|
|
20
|
+
props: {
|
|
21
|
+
type: ObjectConstructor;
|
|
22
|
+
default: {};
|
|
23
|
+
};
|
|
24
|
+
propsUpdatedFromParent: {
|
|
25
|
+
type: ObjectConstructor;
|
|
26
|
+
default: {};
|
|
27
|
+
};
|
|
28
|
+
listeners: {
|
|
29
|
+
type: ArrayConstructor;
|
|
30
|
+
default: never[];
|
|
31
|
+
};
|
|
32
|
+
eventsToEmit: {
|
|
33
|
+
type: ArrayConstructor;
|
|
34
|
+
default: never[];
|
|
35
|
+
};
|
|
36
|
+
eventsToDispatch: {
|
|
37
|
+
type: ArrayConstructor;
|
|
38
|
+
default: never[];
|
|
39
|
+
};
|
|
40
|
+
debounce: {
|
|
41
|
+
type: NumberConstructor;
|
|
42
|
+
default: number;
|
|
43
|
+
};
|
|
44
|
+
fingerprint: {
|
|
45
|
+
type: StringConstructor;
|
|
46
|
+
default: string;
|
|
47
|
+
};
|
|
48
|
+
requestMethod: {
|
|
49
|
+
type: StringConstructor;
|
|
50
|
+
default: string;
|
|
51
|
+
};
|
|
52
|
+
queryMapping: {
|
|
53
|
+
type: ObjectConstructor;
|
|
54
|
+
default: {};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
readonly nameValue: string;
|
|
58
|
+
readonly urlValue: string;
|
|
59
|
+
readonly propsValue: any;
|
|
60
|
+
propsUpdatedFromParentValue: any;
|
|
61
|
+
readonly listenersValue: Array<{
|
|
62
|
+
event: string;
|
|
63
|
+
action: string;
|
|
64
|
+
}>;
|
|
65
|
+
readonly eventsToEmitValue: Array<{
|
|
66
|
+
event: string;
|
|
67
|
+
data: any;
|
|
68
|
+
target: string | null;
|
|
69
|
+
componentName: string | null;
|
|
70
|
+
}>;
|
|
71
|
+
readonly eventsToDispatchValue: Array<{
|
|
72
|
+
event: string;
|
|
73
|
+
payload: any;
|
|
74
|
+
}>;
|
|
75
|
+
readonly hasDebounceValue: boolean;
|
|
76
|
+
readonly debounceValue: number;
|
|
77
|
+
readonly fingerprintValue: string;
|
|
78
|
+
readonly requestMethodValue: 'get' | 'post';
|
|
79
|
+
readonly queryMappingValue: {
|
|
80
|
+
[p: string]: {
|
|
81
|
+
name: string;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
private proxiedComponent;
|
|
85
|
+
private mutationObserver;
|
|
86
|
+
component: Component;
|
|
87
|
+
pendingActionTriggerModelElement: HTMLElement | null;
|
|
88
|
+
private elementEventListeners;
|
|
89
|
+
private pendingFiles;
|
|
90
|
+
static backendFactory: (controller: LiveControllerDefault) => BackendInterface;
|
|
91
|
+
initialize(): void;
|
|
92
|
+
connect(): void;
|
|
93
|
+
disconnect(): void;
|
|
94
|
+
update(event: any): void;
|
|
95
|
+
action(event: any): void;
|
|
96
|
+
$render(): Promise<import("./Backend/BackendResponse").default>;
|
|
97
|
+
emit(event: any): void;
|
|
98
|
+
emitUp(event: any): void;
|
|
99
|
+
emitSelf(event: any): void;
|
|
100
|
+
$updateModel(model: string, value: any, shouldRender?: boolean, debounce?: number | boolean): Promise<import("./Backend/BackendResponse").default>;
|
|
101
|
+
propsUpdatedFromParentValueChanged(): void;
|
|
102
|
+
fingerprintValueChanged(): void;
|
|
103
|
+
private getEmitDirectives;
|
|
104
|
+
private createComponent;
|
|
105
|
+
private connectComponent;
|
|
106
|
+
private disconnectComponent;
|
|
107
|
+
private handleInputEvent;
|
|
108
|
+
private handleChangeEvent;
|
|
109
|
+
private updateModelFromElementEvent;
|
|
110
|
+
private dispatchEvent;
|
|
111
|
+
private onMutations;
|
|
112
|
+
}
|