@htmlplus/element 3.2.4 → 3.2.6
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 +0 -23
- package/dist/client.d.ts +328 -1
- package/dist/client.js +1919 -3
- package/dist/constants.d.ts +1 -2
- package/dist/constants.js +1 -2
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/dist/transformer.d.ts +2 -1
- package/dist/transformer.js +3 -3
- package/package.json +2 -2
- package/dist/client-B2DGXsxR.d.ts +0 -327
- package/dist/client-aQIGQIWV.js +0 -1929
package/README.md
CHANGED
|
@@ -970,29 +970,6 @@ export class MyElement {
|
|
|
970
970
|
|
|
971
971
|
</details>
|
|
972
972
|
|
|
973
|
-
<details>
|
|
974
|
-
<summary>prepareCallback</summary>
|
|
975
|
-
|
|
976
|
-
This lifecycle is asynchronous and is invoked before all other lifecycles.
|
|
977
|
-
|
|
978
|
-
```js
|
|
979
|
-
import { Element } from '@htmlplus/element';
|
|
980
|
-
|
|
981
|
-
@Element()
|
|
982
|
-
export class MyElement {
|
|
983
|
-
prepareCallback() {
|
|
984
|
-
return new Promise((resolve) => {
|
|
985
|
-
setTimeout(resolve, 2500);
|
|
986
|
-
})
|
|
987
|
-
}
|
|
988
|
-
connectedCallback() {
|
|
989
|
-
console.log('The element connects after 2500 milliseconds!');
|
|
990
|
-
}
|
|
991
|
-
}
|
|
992
|
-
```
|
|
993
|
-
|
|
994
|
-
</details>
|
|
995
|
-
|
|
996
973
|
<details>
|
|
997
974
|
<summary>readyCallback</summary>
|
|
998
975
|
|
package/dist/client.d.ts
CHANGED
|
@@ -1 +1,328 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Used to bind a method of a class to the current context,
|
|
3
|
+
* making it easier to reference `this` within the method.
|
|
4
|
+
*/
|
|
5
|
+
declare function Bind(): (target: Object, key: PropertyKey, descriptor: PropertyDescriptor) => {
|
|
6
|
+
configurable: boolean;
|
|
7
|
+
get(): any;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
interface HTMLPlusElement {
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare function Provider(namespace: string): (target: HTMLPlusElement, key: PropertyKey) => void;
|
|
14
|
+
declare function Consumer(namespace: string): (target: HTMLPlusElement, key: PropertyKey) => void;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A method decorator that applies debounce behavior to a class method.
|
|
18
|
+
* Ensures that the method executes only after the specified delay,
|
|
19
|
+
* resetting the timer if called again within the delay period.
|
|
20
|
+
*
|
|
21
|
+
* @param {number} delay - The debounce delay in milliseconds.
|
|
22
|
+
*/
|
|
23
|
+
declare function Debounce(delay?: number): (target: Object, key: PropertyKey, descriptor: PropertyDescriptor) => {
|
|
24
|
+
configurable: boolean;
|
|
25
|
+
get(): any;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Indicates whether the [Direction](https://mdn.io/css-direction)
|
|
30
|
+
* of the element is `Right-To-Left` or `Left-To-Right`.
|
|
31
|
+
*/
|
|
32
|
+
declare function Direction(): (target: HTMLPlusElement, key: PropertyKey) => void;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The class marked with this decorator is considered a
|
|
36
|
+
* [Custom Element](https://mdn.io/using-custom-elements),
|
|
37
|
+
* and its name, in kebab-case, serves as the element name.
|
|
38
|
+
*/
|
|
39
|
+
declare function Element$1(): (constructor: HTMLPlusElement) => void;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* A function type that generates a `CustomEvent`.
|
|
43
|
+
*/
|
|
44
|
+
type EventEmitter<T = any> = (data?: T) => CustomEvent<T>;
|
|
45
|
+
/**
|
|
46
|
+
* An object that configures
|
|
47
|
+
* [options](https://developer.mozilla.org/docs/Web/API/Event/EventEvent#options)
|
|
48
|
+
* for the event dispatcher.
|
|
49
|
+
*/
|
|
50
|
+
interface EventOptions {
|
|
51
|
+
/**
|
|
52
|
+
* A boolean value indicating whether the event bubbles.
|
|
53
|
+
* The default is `false`.
|
|
54
|
+
*/
|
|
55
|
+
bubbles?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* A boolean value indicating whether the event can be cancelled.
|
|
58
|
+
* The default is `false`.
|
|
59
|
+
*/
|
|
60
|
+
cancelable?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* A boolean value indicating whether the event will trigger listeners outside of a shadow root
|
|
63
|
+
* (see [Event.composed](https://mdn.io/event-composed) for more details).
|
|
64
|
+
* The default is `false`.
|
|
65
|
+
*/
|
|
66
|
+
composed?: boolean;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Provides the capability to dispatch a [CustomEvent](https://mdn.io/custom-event)
|
|
70
|
+
* from an element.
|
|
71
|
+
*
|
|
72
|
+
* @param options An object that configures options for the event dispatcher.
|
|
73
|
+
*/
|
|
74
|
+
declare function Event<T = any>(options?: EventOptions): (target: HTMLPlusElement, key: PropertyKey) => void;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Indicates the host of the element.
|
|
78
|
+
*/
|
|
79
|
+
declare function Host(): (target: HTMLPlusElement, key: PropertyKey) => void;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Indicates whether the direction of the element is `Right-To-Left` or not.
|
|
83
|
+
*/
|
|
84
|
+
declare function IsRTL(): (target: HTMLPlusElement, key: PropertyKey) => void;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* An object that configures
|
|
88
|
+
* [options](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener#options)
|
|
89
|
+
* for the event listener.
|
|
90
|
+
*/
|
|
91
|
+
interface ListenOptions {
|
|
92
|
+
/**
|
|
93
|
+
* A boolean value indicating that events of this type will be dispatched to the registered
|
|
94
|
+
* `listener` before being dispatched to any `EventTarget` beneath it in the DOM tree.
|
|
95
|
+
* If not specified, defaults to `false`.
|
|
96
|
+
*/
|
|
97
|
+
capture?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* A boolean value indicating that the `listener` should be invoked at most once after being added.
|
|
100
|
+
* If `true`, the `listener` would be automatically removed when invoked.
|
|
101
|
+
* If not specified, defaults to `false`.
|
|
102
|
+
*/
|
|
103
|
+
once?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* A boolean value that, if `true`,
|
|
106
|
+
* indicates that the function specified by `listener` will never call
|
|
107
|
+
* [preventDefault()](https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault).
|
|
108
|
+
* If a passive listener does call `preventDefault()`,
|
|
109
|
+
* the user agent will do nothing other than generate a console warning.
|
|
110
|
+
*/
|
|
111
|
+
passive?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* An [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal).
|
|
114
|
+
* The listener will be removed when the given `AbortSignal` object's
|
|
115
|
+
* [abort()](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort) method is called.
|
|
116
|
+
* If not specified, no `AbortSignal` is associated with the listener.
|
|
117
|
+
*/
|
|
118
|
+
signal?: AbortSignal;
|
|
119
|
+
/**
|
|
120
|
+
* The target element, defaults to `host`.
|
|
121
|
+
*/
|
|
122
|
+
target?: 'host' | 'body' | 'document' | 'window';
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Will be called whenever the specified event is delivered to the target
|
|
126
|
+
* [More](https://mdn.io/add-event-listener).
|
|
127
|
+
*
|
|
128
|
+
* @param type A case-sensitive string representing the [Event Type](https://mdn.io/events) to listen for.
|
|
129
|
+
* @param options An object that configures
|
|
130
|
+
* [options](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener#options)
|
|
131
|
+
* for the event listener.
|
|
132
|
+
*/
|
|
133
|
+
declare function Listen(type: string, options?: ListenOptions): (target: HTMLPlusElement, key: PropertyKey, descriptor: PropertyDescriptor) => {
|
|
134
|
+
configurable: boolean;
|
|
135
|
+
get(): any;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Provides a way to encapsulate functionality within an element
|
|
140
|
+
* and invoke it as needed, both internally and externally.
|
|
141
|
+
*/
|
|
142
|
+
declare function Method(): (target: HTMLPlusElement, key: PropertyKey, descriptor: PropertyDescriptor) => void;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* The configuration for property decorator.
|
|
146
|
+
*/
|
|
147
|
+
interface PropertyOptions {
|
|
148
|
+
/**
|
|
149
|
+
* Specifies the name of the attribute related to the property.
|
|
150
|
+
*/
|
|
151
|
+
attribute?: string;
|
|
152
|
+
/**
|
|
153
|
+
* Whether property value is reflected back to the associated attribute. default is `false`.
|
|
154
|
+
*/
|
|
155
|
+
reflect?: boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Specifies the property `type` and supports
|
|
158
|
+
* [data types](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures).
|
|
159
|
+
* If this value is not set, it will be set automatically during transforming.
|
|
160
|
+
*/
|
|
161
|
+
type?: any;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Creates a reactive property, reflecting a corresponding attribute value,
|
|
165
|
+
* and updates the element when the property is set.
|
|
166
|
+
*/
|
|
167
|
+
declare function Property(options?: PropertyOptions): (target: HTMLPlusElement, key: string, descriptor?: PropertyDescriptor) => void;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Selects the first element in the shadow dom that matches a specified CSS selector.
|
|
171
|
+
*
|
|
172
|
+
* @param selectors A string containing one or more selectors to match.
|
|
173
|
+
* This string must be a valid CSS selector string; if it isn't, a `SyntaxError` exception is thrown. See
|
|
174
|
+
* [Locating DOM elements using selectors](https://developer.mozilla.org/en-US/docs/Web/API/Document_object_model/Locating_DOM_elements_using_selectors)
|
|
175
|
+
* for more about selectors and how to manage them.
|
|
176
|
+
*/
|
|
177
|
+
declare function Query(selectors: string): (target: HTMLPlusElement, key: PropertyKey) => void;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Selects all elements in the shadow dom that match a specified CSS selector.
|
|
181
|
+
*
|
|
182
|
+
* @param selectors A string containing one or more selectors to match against.
|
|
183
|
+
* This string must be a valid
|
|
184
|
+
* [CSS selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_selectors)
|
|
185
|
+
* string; if it's not, a `SyntaxError` exception is thrown. See
|
|
186
|
+
* [Locating DOM elements using selectors](https://developer.mozilla.org/en-US/docs/Web/API/Document_object_model/Locating_DOM_elements_using_selectors)
|
|
187
|
+
* for more information about using selectors to identify elements.
|
|
188
|
+
* Multiple selectors may be specified by separating them using commas.
|
|
189
|
+
*/
|
|
190
|
+
declare function QueryAll(selectors: string): (target: HTMLPlusElement, key: PropertyKey) => void;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Returns the slots name.
|
|
194
|
+
*/
|
|
195
|
+
declare function Slots$1(): (target: HTMLPlusElement, key: PropertyKey) => void;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Applying this decorator to any `class property` will trigger the
|
|
199
|
+
* element to re-render upon the desired property changes.
|
|
200
|
+
*/
|
|
201
|
+
declare function State(): (target: HTMLPlusElement, key: PropertyKey) => void;
|
|
202
|
+
|
|
203
|
+
declare function Style(): (target: HTMLPlusElement, key: PropertyKey) => void;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Monitors `@Property` and `@State` to detect changes.
|
|
207
|
+
* The decorated method will be called after any changes,
|
|
208
|
+
* with the `key`, `newValue`, and `oldValue` as parameters.
|
|
209
|
+
* If the `key` is not defined, all `@Property` and `@State` are considered.
|
|
210
|
+
*
|
|
211
|
+
* @param keys Collection of `@Property` and `@State` names.
|
|
212
|
+
* @param immediate Triggers the callback immediately after initialization.
|
|
213
|
+
*/
|
|
214
|
+
declare function Watch(keys?: string | string[], immediate?: boolean): (target: HTMLPlusElement, key: PropertyKey) => void;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* TODO
|
|
218
|
+
*/
|
|
219
|
+
declare const classes: (input: any, smart?: boolean) => string;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* TODO
|
|
223
|
+
*/
|
|
224
|
+
interface Config {
|
|
225
|
+
event?: {
|
|
226
|
+
resolver?: (parameters: any) => CustomEvent | undefined;
|
|
227
|
+
};
|
|
228
|
+
asset?: {
|
|
229
|
+
[key: string]: any;
|
|
230
|
+
};
|
|
231
|
+
element?: {
|
|
232
|
+
[key: string]: {
|
|
233
|
+
property?: {
|
|
234
|
+
[key: string]: any;
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* TODO
|
|
241
|
+
*/
|
|
242
|
+
interface ConfigOptions {
|
|
243
|
+
/**
|
|
244
|
+
* TODO
|
|
245
|
+
*/
|
|
246
|
+
force?: boolean;
|
|
247
|
+
/**
|
|
248
|
+
* TODO
|
|
249
|
+
*/
|
|
250
|
+
override?: boolean;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* TODO
|
|
254
|
+
*/
|
|
255
|
+
declare const getConfig: (...keys: string[]) => any;
|
|
256
|
+
/**
|
|
257
|
+
* TODO
|
|
258
|
+
*/
|
|
259
|
+
declare const setConfig: (config: Config, options?: ConfigOptions) => void;
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Indicates whether the [Direction](https://mdn.io/css-direction)
|
|
263
|
+
* of the element is `Right-To-Left` or `Left-To-Right`.
|
|
264
|
+
*/
|
|
265
|
+
declare const direction: (target: HTMLElement | HTMLPlusElement) => "ltr" | "rtl";
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* TODO
|
|
269
|
+
*/
|
|
270
|
+
declare const dispatch: <T = any>(target: HTMLElement | HTMLPlusElement, type: string, eventInitDict?: CustomEventInit<T>) => CustomEvent<T>;
|
|
271
|
+
/**
|
|
272
|
+
* TODO
|
|
273
|
+
*/
|
|
274
|
+
declare const on: (target: Window | Document | HTMLElement | HTMLPlusElement, type: string, handler: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => void;
|
|
275
|
+
/**
|
|
276
|
+
* TODO
|
|
277
|
+
*/
|
|
278
|
+
declare const off: (target: Window | Document | HTMLElement | HTMLPlusElement, type: string, handler: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => void;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Indicates the host of the element.
|
|
282
|
+
*/
|
|
283
|
+
declare const host: (target: HTMLElement | HTMLPlusElement) => HTMLElement;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Determines whether the given input string is a valid
|
|
287
|
+
* [CSS Color](https://mdn.io/color-value) or not.
|
|
288
|
+
*/
|
|
289
|
+
declare const isCSSColor: (input: string) => boolean;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Indicates whether the direction of the element is `Right-To-Left` or not.
|
|
293
|
+
*/
|
|
294
|
+
declare const isRTL: (target: HTMLPlusElement) => boolean;
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Selects the first element in the shadow dom that matches a specified CSS selector.
|
|
298
|
+
*/
|
|
299
|
+
declare function query(target: HTMLPlusElement, selectors: string): Element | null | undefined;
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Selects all elements in the shadow dom that match a specified CSS selector.
|
|
303
|
+
*/
|
|
304
|
+
declare function queryAll(target: HTMLPlusElement, selectors: string): NodeListOf<Element> | undefined;
|
|
305
|
+
|
|
306
|
+
type Slots = {
|
|
307
|
+
[key: string]: boolean;
|
|
308
|
+
};
|
|
309
|
+
/**
|
|
310
|
+
* Returns the slots name.
|
|
311
|
+
*/
|
|
312
|
+
declare const slots: (target: HTMLElement | HTMLPlusElement) => Slots;
|
|
313
|
+
|
|
314
|
+
declare const toCSSColor: (input: string) => string | undefined;
|
|
315
|
+
|
|
316
|
+
declare const toCSSUnit: (input?: number | string | null) => string | undefined;
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Converts a value to a unit.
|
|
320
|
+
*/
|
|
321
|
+
declare const toUnit: (input: string | number, unit?: string) => string;
|
|
322
|
+
|
|
323
|
+
declare const attributes: any;
|
|
324
|
+
declare const html: any;
|
|
325
|
+
declare const styles: any;
|
|
326
|
+
|
|
327
|
+
export { Bind, Consumer, Debounce, Direction, Element$1 as Element, Event, Host, IsRTL, Listen, Method, Property, Provider, Query, QueryAll, Slots$1 as Slots, State, Style, Watch, attributes as a, classes, direction, dispatch, getConfig, html as h, host, isCSSColor, isRTL, off, on, query, queryAll, styles as s, setConfig, slots, toCSSColor, toCSSUnit, toUnit };
|
|
328
|
+
export type { Config, ConfigOptions, EventEmitter, EventOptions, ListenOptions, PropertyOptions };
|