@symfony/ux-live-component 2.32.0 → 2.33.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 CHANGED
@@ -6,9 +6,10 @@ JavaScript assets of the [symfony/ux-live-component](https://packagist.org/packa
6
6
 
7
7
  This npm package is **reserved for advanced users** who want to decouple their JavaScript dependencies from their PHP dependencies (e.g., when building Docker images, running JavaScript-only pipelines, etc.).
8
8
 
9
- We **strongly recommend not installing this package directly**, but instead install the PHP package [symfony/ux-live-component](https://packagist.org/packages/symfony/ux-live-component) in your Symfony application with [Flex](https://github.com/symfony/flex) enabled.
9
+ We **strongly recommend not installing this package directly**, but instead install the PHP package [symfony/ux-live-component](https://packagist.org/packages/symfony/ux-live-component) in your Symfony application with [Flex](https://github.com/symfony/flex) enabled.
10
10
 
11
11
  If you still want to install this package directly, please make sure its version exactly matches [symfony/ux-live-component](https://packagist.org/packages/symfony/ux-live-component) PHP package version:
12
+
12
13
  ```shell
13
14
  composer require symfony/ux-live-component:2.23.0
14
15
  npm add @symfony/ux-live-component@2.23.0
@@ -18,7 +19,7 @@ npm add @symfony/ux-live-component@2.23.0
18
19
 
19
20
  ## Resources
20
21
 
21
- - [Documentation](https://symfony.com/bundles/ux-live-component/current/index.html)
22
- - [Report issues](https://github.com/symfony/ux/issues) and
23
- [send Pull Requests](https://github.com/symfony/ux/pulls)
24
- in the [main Symfony UX repository](https://github.com/symfony/ux)
22
+ - [Documentation](https://symfony.com/bundles/ux-live-component/current/index.html)
23
+ - [Report issues](https://github.com/symfony/ux/issues) and
24
+ [send Pull Requests](https://github.com/symfony/ux/pulls)
25
+ in the [main Symfony UX repository](https://github.com/symfony/ux)
@@ -1,247 +1,242 @@
1
- import { Controller } from '@hotwired/stimulus';
2
-
3
- declare class export_default$2{
4
- response: Response;
5
- private body;
6
- private liveUrl;
7
- constructor(response: Response);
8
- getBody(): Promise<string>;
9
- getLiveUrl(): string | null;
1
+ import { Controller } from "@hotwired/stimulus";
2
+ declare class export_default$2 {
3
+ response: Response;
4
+ private body;
5
+ private liveUrl;
6
+ constructor(response: Response);
7
+ getBody(): Promise<string>;
8
+ getLiveUrl(): string | null;
10
9
  }
11
-
12
- declare class export_default$1{
13
- promise: Promise<Response>;
14
- actions: string[];
15
- updatedModels: string[];
16
- isResolved: boolean;
17
- constructor(promise: Promise<Response>, actions: string[], updateModels: string[]);
18
- containsOneOfActions(targetedActions: string[]): boolean;
19
- areAnyModelsUpdated(targetedModels: string[]): boolean;
10
+ declare class export_default$1 {
11
+ promise: Promise<Response>;
12
+ actions: string[];
13
+ updatedModels: string[];
14
+ isResolved: boolean;
15
+ constructor(promise: Promise<Response>, actions: string[], updateModels: string[]);
16
+ containsOneOfActions(targetedActions: string[]): boolean;
17
+ areAnyModelsUpdated(targetedModels: string[]): boolean;
20
18
  }
21
-
22
19
  interface ChildrenFingerprints {
23
- [key: string]: {
24
- fingerprint: string;
25
- tag: string;
26
- };
20
+ [key: string]: {
21
+ fingerprint: string;
22
+ tag: string;
23
+ };
27
24
  }
28
25
  interface BackendInterface {
29
- makeRequest(props: any, actions: BackendAction[], updated: {
30
- [key: string]: any;
31
- }, children: ChildrenFingerprints, updatedPropsFromParent: {
32
- [key: string]: any;
33
- }, files: {
34
- [key: string]: FileList;
35
- }): export_default$1;
26
+ makeRequest(props: any, actions: BackendAction[], updated: {
27
+ [key: string]: any;
28
+ }, children: ChildrenFingerprints, updatedPropsFromParent: {
29
+ [key: string]: any;
30
+ }, files: {
31
+ [key: string]: FileList;
32
+ }): export_default$1;
36
33
  }
37
34
  interface BackendAction {
38
- name: string;
39
- args: Record<string, string>;
35
+ name: string;
36
+ args: Record<string, string>;
40
37
  }
41
-
42
38
  interface ElementDriver {
43
- getModelName(element: HTMLElement): string | null;
44
- getComponentProps(): any;
45
- getEventsToEmit(): Array<{
46
- event: string;
47
- data: any;
48
- target: string | null;
49
- componentName: string | null;
50
- }>;
51
- getBrowserEventsToDispatch(): Array<{
52
- event: string;
53
- payload: any;
54
- }>;
39
+ getModelName(element: HTMLElement): string | null;
40
+ getComponentProps(): any;
41
+ getEventsToEmit(): Array<{
42
+ event: string;
43
+ data: any;
44
+ target: string | null;
45
+ componentName: string | null;
46
+ }>;
47
+ getBrowserEventsToDispatch(): Array<{
48
+ event: string;
49
+ payload: any;
50
+ }>;
55
51
  }
56
-
57
52
  interface PluginInterface {
58
- attachToComponent(component: Component): void;
53
+ attachToComponent(component: Component): void;
59
54
  }
60
-
61
- declare class export_default{
62
- private props;
63
- private dirtyProps;
64
- private pendingProps;
65
- private updatedPropsFromParent;
66
- constructor(props: any);
67
- get(name: string): any;
68
- has(name: string): boolean;
69
- set(name: string, value: any): boolean;
70
- getOriginalProps(): any;
71
- getDirtyProps(): any;
72
- getUpdatedPropsFromParent(): any;
73
- flushDirtyPropsToPending(): void;
74
- reinitializeAllProps(props: any): void;
75
- pushPendingPropsBackToDirty(): void;
76
- storeNewPropsFromParent(props: any): boolean;
55
+ declare class export_default {
56
+ private props;
57
+ private dirtyProps;
58
+ private pendingProps;
59
+ private updatedPropsFromParent;
60
+ constructor(props: any);
61
+ get(name: string): any;
62
+ has(name: string): boolean;
63
+ set(name: string, value: any): boolean;
64
+ getOriginalProps(): any;
65
+ getDirtyProps(): any;
66
+ getUpdatedPropsFromParent(): any;
67
+ flushDirtyPropsToPending(): void;
68
+ reinitializeAllProps(props: any): void;
69
+ pushPendingPropsBackToDirty(): void;
70
+ storeNewPropsFromParent(props: any): boolean;
77
71
  }
78
-
79
72
  type MaybePromise<T = void> = T | Promise<T>;
80
73
  type ComponentHooks = {
81
- connect: (component: Component) => MaybePromise;
82
- disconnect: (component: Component) => MaybePromise;
83
- 'request:started': (requestConfig: any) => MaybePromise;
84
- 'render:finished': (component: Component) => MaybePromise;
85
- 'response:error': (backendResponse: export_default$2, controls: {
86
- displayError: boolean;
87
- }) => MaybePromise;
88
- 'loading.state:started': (element: HTMLElement, request: export_default$1) => MaybePromise;
89
- 'loading.state:finished': (element: HTMLElement) => MaybePromise;
90
- 'model:set': (model: string, value: any, component: Component) => MaybePromise;
74
+ connect: (component: Component) => MaybePromise;
75
+ disconnect: (component: Component) => MaybePromise;
76
+ 'request:started': (requestConfig: any) => MaybePromise;
77
+ 'render:finished': (component: Component) => MaybePromise;
78
+ 'response:error': (backendResponse: export_default$2, controls: {
79
+ displayError: boolean;
80
+ }) => MaybePromise;
81
+ 'loading.state:started': (element: HTMLElement, request: export_default$1) => MaybePromise;
82
+ 'loading.state:finished': (element: HTMLElement) => MaybePromise;
83
+ 'model:set': (model: string, value: any, component: Component) => MaybePromise;
91
84
  };
92
85
  type ComponentHookName = keyof ComponentHooks;
93
86
  type ComponentHookCallback<T extends string = ComponentHookName> = T extends ComponentHookName ? ComponentHooks[T] : (...args: any[]) => MaybePromise;
94
87
  declare class Component {
95
- readonly element: HTMLElement;
96
- readonly name: string;
97
- readonly listeners: Map<string, string[]>;
98
- private backend;
99
- readonly elementDriver: ElementDriver;
100
- id: string | null;
101
- fingerprint: string;
102
- readonly valueStore: export_default;
103
- private readonly unsyncedInputsTracker;
104
- private hooks;
105
- defaultDebounce: number;
106
- private backendRequest;
107
- private pendingActions;
108
- private pendingFiles;
109
- private isRequestPending;
110
- private requestDebounceTimeout;
111
- private nextRequestPromise;
112
- private nextRequestPromiseResolve;
113
- private externalMutationTracker;
114
- constructor(element: HTMLElement, name: string, props: any, listeners: Array<{
115
- event: string;
116
- action: string;
117
- }>, id: string | null, backend: BackendInterface, elementDriver: ElementDriver);
118
- addPlugin(plugin: PluginInterface): void;
119
- connect(): void;
120
- disconnect(): void;
121
- on<T extends string | ComponentHookName = ComponentHookName>(hookName: T, callback: ComponentHookCallback<T>): void;
122
- off<T extends string | ComponentHookName = ComponentHookName>(hookName: T, callback: ComponentHookCallback<T>): void;
123
- set(model: string, value: any, reRender?: boolean, debounce?: number | boolean): Promise<export_default$2>;
124
- getData(model: string): any;
125
- action(name: string, args?: any, debounce?: number | boolean): Promise<export_default$2>;
126
- files(key: string, input: HTMLInputElement): void;
127
- render(): Promise<export_default$2>;
128
- getUnsyncedModels(): string[];
129
- emit(name: string, data: any, onlyMatchingComponentsNamed?: string | null): void;
130
- emitUp(name: string, data: any, onlyMatchingComponentsNamed?: string | null): void;
131
- emitSelf(name: string, data: any): void;
132
- private performEmit;
133
- private doEmit;
134
- private isTurboEnabled;
135
- private tryStartingRequest;
136
- private performRequest;
137
- private processRerender;
138
- private calculateDebounce;
139
- private clearRequestDebounceTimeout;
140
- private debouncedStartRequest;
141
- private renderError;
142
- private resetPromise;
143
- _updateFromParentProps(props: any): void;
88
+ readonly element: HTMLElement;
89
+ readonly name: string;
90
+ readonly listeners: Map<string, string[]>;
91
+ private backend;
92
+ readonly elementDriver: ElementDriver;
93
+ id: string | null;
94
+ fingerprint: string;
95
+ readonly valueStore: export_default;
96
+ private readonly unsyncedInputsTracker;
97
+ private hooks;
98
+ defaultDebounce: number;
99
+ private backendRequest;
100
+ private pendingActions;
101
+ private pendingFiles;
102
+ private isRequestPending;
103
+ private requestDebounceTimeout;
104
+ private nextRequestPromise;
105
+ private nextRequestPromiseResolve;
106
+ private externalMutationTracker;
107
+ constructor(element: HTMLElement, name: string, props: any, listeners: Array<{
108
+ event: string;
109
+ action: string;
110
+ }>, id: string | null, backend: BackendInterface, elementDriver: ElementDriver);
111
+ addPlugin(plugin: PluginInterface): void;
112
+ connect(): void;
113
+ disconnect(): void;
114
+ on<T extends string | ComponentHookName = ComponentHookName>(hookName: T, callback: ComponentHookCallback<T>): void;
115
+ off<T extends string | ComponentHookName = ComponentHookName>(hookName: T, callback: ComponentHookCallback<T>): void;
116
+ set(model: string, value: any, reRender?: boolean, debounce?: number | boolean): Promise<export_default$2>;
117
+ getData(model: string): any;
118
+ action(name: string, args?: any, debounce?: number | boolean): Promise<export_default$2>;
119
+ files(key: string, input: HTMLInputElement): void;
120
+ render(): Promise<export_default$2>;
121
+ getUnsyncedModels(): string[];
122
+ emit(name: string, data: any, onlyMatchingComponentsNamed?: string | null): void;
123
+ emitUp(name: string, data: any, onlyMatchingComponentsNamed?: string | null): void;
124
+ emitSelf(name: string, data: any): void;
125
+ private performEmit;
126
+ private doEmit;
127
+ private isTurboEnabled;
128
+ private tryStartingRequest;
129
+ private performRequest;
130
+ private processRerender;
131
+ private calculateDebounce;
132
+ private clearRequestDebounceTimeout;
133
+ private debouncedStartRequest;
134
+ private renderError;
135
+ private resetPromise;
136
+ _updateFromParentProps(props: any): void;
144
137
  }
145
-
146
138
  declare const getComponent: (element: HTMLElement) => Promise<Component>;
147
-
148
139
  interface LiveEvent extends CustomEvent {
149
- detail: {
150
- controller: LiveController;
151
- component: Component;
152
- };
140
+ detail: {
141
+ controller: LiveController;
142
+ component: Component;
143
+ };
153
144
  }
154
145
  interface LiveController {
155
- element: HTMLElement;
156
- component: Component;
146
+ element: HTMLElement;
147
+ component: Component;
157
148
  }
158
149
  declare class LiveControllerDefault extends Controller<HTMLElement> implements LiveController {
159
- static values: {
160
- name: StringConstructor;
161
- url: StringConstructor;
162
- props: {
163
- type: ObjectConstructor;
164
- default: {};
165
- };
166
- propsUpdatedFromParent: {
167
- type: ObjectConstructor;
168
- default: {};
169
- };
170
- listeners: {
171
- type: ArrayConstructor;
172
- default: never[];
173
- };
174
- eventsToEmit: {
175
- type: ArrayConstructor;
176
- default: never[];
177
- };
178
- eventsToDispatch: {
179
- type: ArrayConstructor;
180
- default: never[];
181
- };
182
- debounce: {
183
- type: NumberConstructor;
184
- default: number;
185
- };
186
- fingerprint: {
187
- type: StringConstructor;
188
- default: string;
189
- };
190
- requestMethod: {
191
- type: StringConstructor;
192
- default: string;
193
- };
150
+ static values: {
151
+ name: StringConstructor;
152
+ url: StringConstructor;
153
+ props: {
154
+ type: ObjectConstructor;
155
+ default: {};
194
156
  };
195
- readonly nameValue: string;
196
- readonly urlValue: string;
197
- readonly propsValue: any;
198
- propsUpdatedFromParentValue: any;
199
- readonly listenersValue: Array<{
200
- event: string;
201
- action: string;
202
- }>;
203
- readonly eventsToEmitValue: Array<{
204
- event: string;
205
- data: any;
206
- target: string | null;
207
- componentName: string | null;
208
- }>;
209
- readonly eventsToDispatchValue: Array<{
210
- event: string;
211
- payload: any;
212
- }>;
213
- readonly hasDebounceValue: boolean;
214
- readonly debounceValue: number;
215
- readonly fingerprintValue: string;
216
- readonly requestMethodValue: 'get' | 'post';
217
- private proxiedComponent;
218
- private mutationObserver;
219
- component: Component;
220
- pendingActionTriggerModelElement: HTMLElement | null;
221
- private elementEventListeners;
222
- private pendingFiles;
223
- static backendFactory: (controller: LiveControllerDefault) => BackendInterface;
224
- initialize(): void;
225
- connect(): void;
226
- disconnect(): void;
227
- update(event: any): void;
228
- action(event: any): void;
229
- $render(): Promise<export_default$2>;
230
- emit(event: any): void;
231
- emitUp(event: any): void;
232
- emitSelf(event: any): void;
233
- $updateModel(model: string, value: any, shouldRender?: boolean, debounce?: number | boolean): Promise<export_default$2>;
234
- propsUpdatedFromParentValueChanged(): void;
235
- fingerprintValueChanged(): void;
236
- private getEmitDirectives;
237
- private createComponent;
238
- private connectComponent;
239
- private disconnectComponent;
240
- private handleInputEvent;
241
- private handleChangeEvent;
242
- private updateModelFromElementEvent;
243
- private dispatchEvent;
244
- private onMutations;
157
+ propsUpdatedFromParent: {
158
+ type: ObjectConstructor;
159
+ default: {};
160
+ };
161
+ listeners: {
162
+ type: ArrayConstructor;
163
+ default: never[];
164
+ };
165
+ eventsToEmit: {
166
+ type: ArrayConstructor;
167
+ default: never[];
168
+ };
169
+ eventsToDispatch: {
170
+ type: ArrayConstructor;
171
+ default: never[];
172
+ };
173
+ debounce: {
174
+ type: NumberConstructor;
175
+ default: number;
176
+ };
177
+ fingerprint: {
178
+ type: StringConstructor;
179
+ default: string;
180
+ };
181
+ requestMethod: {
182
+ type: StringConstructor;
183
+ default: string;
184
+ };
185
+ fetchCredentials: {
186
+ type: StringConstructor;
187
+ default: string;
188
+ };
189
+ };
190
+ readonly nameValue: string;
191
+ readonly urlValue: string;
192
+ readonly propsValue: any;
193
+ propsUpdatedFromParentValue: any;
194
+ readonly listenersValue: Array<{
195
+ event: string;
196
+ action: string;
197
+ }>;
198
+ readonly eventsToEmitValue: Array<{
199
+ event: string;
200
+ data: any;
201
+ target: string | null;
202
+ componentName: string | null;
203
+ }>;
204
+ readonly eventsToDispatchValue: Array<{
205
+ event: string;
206
+ payload: any;
207
+ }>;
208
+ readonly hasDebounceValue: boolean;
209
+ readonly debounceValue: number;
210
+ readonly fingerprintValue: string;
211
+ readonly requestMethodValue: 'get' | 'post';
212
+ readonly fetchCredentialsValue: RequestCredentials;
213
+ private proxiedComponent;
214
+ private mutationObserver;
215
+ component: Component;
216
+ pendingActionTriggerModelElement: HTMLElement | null;
217
+ private elementEventListeners;
218
+ private pendingFiles;
219
+ static backendFactory: (controller: LiveControllerDefault) => BackendInterface;
220
+ initialize(): void;
221
+ connect(): void;
222
+ disconnect(): void;
223
+ update(event: any): void;
224
+ action(event: any): void;
225
+ $render(): Promise<export_default$2>;
226
+ emit(event: any): void;
227
+ emitUp(event: any): void;
228
+ emitSelf(event: any): void;
229
+ $updateModel(model: string, value: any, shouldRender?: boolean, debounce?: number | boolean): Promise<export_default$2>;
230
+ propsUpdatedFromParentValueChanged(): void;
231
+ fingerprintValueChanged(): void;
232
+ private getEmitDirectives;
233
+ private createComponent;
234
+ private connectComponent;
235
+ private disconnectComponent;
236
+ private handleInputEvent;
237
+ private handleChangeEvent;
238
+ private updateModelFromElementEvent;
239
+ private dispatchEvent;
240
+ private onMutations;
245
241
  }
246
-
247
- export { Component, type LiveController, type LiveEvent, LiveControllerDefault as default, getComponent };
242
+ export { Component, LiveController, LiveEvent, LiveControllerDefault as default, getComponent };