@htmlplus/element 3.3.0 → 3.4.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/dist/bundlers.d.ts +5 -5
- package/dist/bundlers.js +4 -4
- package/dist/client.d.ts +51 -26
- package/dist/client.js +710 -633
- package/dist/constants.d.ts +2 -1
- package/dist/constants.js +2 -1
- package/dist/jsx-runtime.d.ts +183 -183
- package/dist/transformer.d.ts +45 -40
- package/dist/transformer.js +394 -278
- package/package.json +96 -92
package/dist/bundlers.d.ts
CHANGED
|
@@ -2,18 +2,18 @@ import { TransformerPlugin } from './transformer.js';
|
|
|
2
2
|
import '@babel/types';
|
|
3
3
|
import '@babel/parser';
|
|
4
4
|
|
|
5
|
-
declare const rollup: (...plugins:
|
|
5
|
+
declare const rollup: (...plugins: TransformerPlugin[]) => {
|
|
6
6
|
name: string;
|
|
7
7
|
buildStart(): Promise<void>;
|
|
8
|
-
load(id:
|
|
8
|
+
load(id: string): Promise<string | undefined>;
|
|
9
9
|
buildEnd(error?: Error): Promise<void>;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
declare const vite: (...plugins:
|
|
12
|
+
declare const vite: (...plugins: TransformerPlugin[]) => {
|
|
13
13
|
name: string;
|
|
14
14
|
buildStart(): Promise<void>;
|
|
15
|
-
load(id:
|
|
16
|
-
writeBundle(
|
|
15
|
+
load(id: string): Promise<string | undefined>;
|
|
16
|
+
writeBundle(_options: any, bundles: any): Promise<void>;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
export { rollup, vite };
|
package/dist/bundlers.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { KEY } from './constants.js';
|
|
2
|
-
import { transformer } from './transformer.js';
|
|
3
2
|
import 'fs-extra';
|
|
4
3
|
import 'glob';
|
|
5
4
|
import '@babel/template';
|
|
6
5
|
import '@babel/types';
|
|
7
6
|
import 'change-case';
|
|
8
|
-
import '
|
|
7
|
+
import { transformer } from './transformer.js';
|
|
9
8
|
import '@babel/parser';
|
|
10
|
-
import '@babel/generator';
|
|
11
9
|
import path from 'node:path';
|
|
10
|
+
import '@babel/traverse';
|
|
11
|
+
import '@babel/generator';
|
|
12
12
|
import 'ora';
|
|
13
13
|
|
|
14
14
|
const rollup = (...plugins) => {
|
|
@@ -52,7 +52,7 @@ const vite = (...plugins) => {
|
|
|
52
52
|
}
|
|
53
53
|
return context.script;
|
|
54
54
|
},
|
|
55
|
-
async writeBundle(
|
|
55
|
+
async writeBundle(_options, bundles) {
|
|
56
56
|
// TODO
|
|
57
57
|
global.contexts.forEach((context) => {
|
|
58
58
|
Object.keys(bundles).forEach((key) => {
|
package/dist/client.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Used to bind a method of a class to the current context,
|
|
3
3
|
* making it easier to reference `this` within the method.
|
|
4
4
|
*/
|
|
5
|
-
declare function Bind(): (
|
|
5
|
+
declare function Bind(): (_target: object, key: PropertyKey, descriptor: PropertyDescriptor) => {
|
|
6
6
|
configurable: boolean;
|
|
7
7
|
get(): any;
|
|
8
8
|
};
|
|
@@ -20,7 +20,7 @@ declare function Consumer(namespace: string): (target: HTMLPlusElement, key: Pro
|
|
|
20
20
|
*
|
|
21
21
|
* @param {number} delay - The debounce delay in milliseconds.
|
|
22
22
|
*/
|
|
23
|
-
declare function Debounce(delay?: number): (target:
|
|
23
|
+
declare function Debounce(delay?: number): (target: object, key: PropertyKey, descriptor: PropertyDescriptor) => {
|
|
24
24
|
configurable: boolean;
|
|
25
25
|
get(): any;
|
|
26
26
|
};
|
|
@@ -29,7 +29,7 @@ declare function Debounce(delay?: number): (target: Object, key: PropertyKey, de
|
|
|
29
29
|
* Indicates whether the [Direction](https://mdn.io/css-direction)
|
|
30
30
|
* of the element is `Right-To-Left` or `Left-To-Right`.
|
|
31
31
|
*/
|
|
32
|
-
declare function Direction(): (target: HTMLPlusElement, key: PropertyKey) => void;
|
|
32
|
+
declare function Direction$1(): (target: HTMLPlusElement, key: PropertyKey) => void;
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* The class marked with this decorator is considered a
|
|
@@ -41,7 +41,7 @@ declare function Element$1(): (constructor: HTMLPlusElement) => void;
|
|
|
41
41
|
/**
|
|
42
42
|
* A function type that generates a `CustomEvent`.
|
|
43
43
|
*/
|
|
44
|
-
type EventEmitter<T =
|
|
44
|
+
type EventEmitter<T = unknown> = (data?: T) => CustomEvent<T>;
|
|
45
45
|
/**
|
|
46
46
|
* An object that configures
|
|
47
47
|
* [options](https://developer.mozilla.org/docs/Web/API/Event/EventEvent#options)
|
|
@@ -71,7 +71,7 @@ interface EventOptions {
|
|
|
71
71
|
*
|
|
72
72
|
* @param options An object that configures options for the event dispatcher.
|
|
73
73
|
*/
|
|
74
|
-
declare function Event<T =
|
|
74
|
+
declare function Event<T = unknown>(options?: EventOptions): (target: HTMLPlusElement, key: PropertyKey) => void;
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
77
|
* Indicates the host of the element.
|
|
@@ -139,19 +139,11 @@ declare function Listen(type: string, options?: ListenOptions): (target: HTMLPlu
|
|
|
139
139
|
* Provides a way to encapsulate functionality within an element
|
|
140
140
|
* and invoke it as needed, both internally and externally.
|
|
141
141
|
*/
|
|
142
|
-
declare function Method(): (target: HTMLPlusElement, key: PropertyKey,
|
|
142
|
+
declare function Method(): (target: HTMLPlusElement, key: PropertyKey, _descriptor: PropertyDescriptor) => void;
|
|
143
143
|
|
|
144
|
-
type
|
|
145
|
-
type Overwrite<T, U> = DistributiveOmit<T, keyof U> & U;
|
|
146
|
-
type GenerateStringUnion<T> = Extract<{
|
|
147
|
-
[Key in keyof T]: true extends T[Key] ? Key : never;
|
|
148
|
-
}[keyof T], string>;
|
|
149
|
-
type OverridesConfigBreakpointCreator<T extends string, U = {}> = GenerateStringUnion<Overwrite<Record<T, true>, U>>;
|
|
150
|
-
type OverridesConfig<Breakpoint extends string, Properties = {}> = {
|
|
144
|
+
type OverridesConfig<Breakpoint extends string, Properties = unknown> = {
|
|
151
145
|
[Key in Breakpoint]?: Partial<Properties>;
|
|
152
146
|
};
|
|
153
|
-
interface ElementPropertiesAutoGenerated {
|
|
154
|
-
}
|
|
155
147
|
declare function Overrides(): (target: HTMLPlusElement, key: string) => void;
|
|
156
148
|
|
|
157
149
|
/**
|
|
@@ -171,7 +163,7 @@ interface PropertyOptions {
|
|
|
171
163
|
* [data types](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures).
|
|
172
164
|
* If this value is not set, it will be set automatically during transforming.
|
|
173
165
|
*/
|
|
174
|
-
type?:
|
|
166
|
+
type?: unknown;
|
|
175
167
|
}
|
|
176
168
|
/**
|
|
177
169
|
* Creates a reactive property, reflecting a corresponding attribute value,
|
|
@@ -215,6 +207,8 @@ declare function State(): (target: HTMLPlusElement, key: PropertyKey) => void;
|
|
|
215
207
|
|
|
216
208
|
declare function Style(): (target: HTMLPlusElement, key: PropertyKey) => void;
|
|
217
209
|
|
|
210
|
+
declare function Variant(): (target: HTMLPlusElement, key: string) => void;
|
|
211
|
+
|
|
218
212
|
/**
|
|
219
213
|
* Monitors `@Property` and `@State` to detect changes.
|
|
220
214
|
* The decorated method will be called after any changes,
|
|
@@ -229,7 +223,7 @@ declare function Watch(keys?: string | string[], immediate?: boolean): (target:
|
|
|
229
223
|
/**
|
|
230
224
|
* TODO
|
|
231
225
|
*/
|
|
232
|
-
declare const classes: (input:
|
|
226
|
+
declare const classes: (input: unknown, smart?: boolean) => string;
|
|
233
227
|
|
|
234
228
|
/**
|
|
235
229
|
* TODO
|
|
@@ -243,10 +237,10 @@ interface Config {
|
|
|
243
237
|
};
|
|
244
238
|
};
|
|
245
239
|
event?: {
|
|
246
|
-
resolver?: (parameters:
|
|
240
|
+
resolver?: (parameters: unknown) => CustomEvent | undefined;
|
|
247
241
|
};
|
|
248
242
|
assets?: {
|
|
249
|
-
[key: string]:
|
|
243
|
+
[key: string]: unknown;
|
|
250
244
|
};
|
|
251
245
|
elements?: {
|
|
252
246
|
[key: string]: {
|
|
@@ -255,6 +249,13 @@ interface Config {
|
|
|
255
249
|
default?: unknown;
|
|
256
250
|
};
|
|
257
251
|
};
|
|
252
|
+
variants?: {
|
|
253
|
+
[key: string]: {
|
|
254
|
+
properties: {
|
|
255
|
+
[key: string]: unknown;
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
};
|
|
258
259
|
};
|
|
259
260
|
};
|
|
260
261
|
}
|
|
@@ -288,16 +289,17 @@ declare const setConfig: (namespace: string, config: Config, options?: ConfigOpt
|
|
|
288
289
|
*/
|
|
289
290
|
declare const setConfigCreator: (namespace: string) => (config: Config, options?: ConfigOptions) => void;
|
|
290
291
|
|
|
292
|
+
type Direction = 'ltr' | 'rtl';
|
|
291
293
|
/**
|
|
292
294
|
* Indicates whether the [Direction](https://mdn.io/css-direction)
|
|
293
295
|
* of the element is `Right-To-Left` or `Left-To-Right`.
|
|
294
296
|
*/
|
|
295
|
-
declare const direction: (target: HTMLElement | HTMLPlusElement) =>
|
|
297
|
+
declare const direction: (target: HTMLElement | HTMLPlusElement) => Direction;
|
|
296
298
|
|
|
297
299
|
/**
|
|
298
300
|
* TODO
|
|
299
301
|
*/
|
|
300
|
-
declare const dispatch: <T =
|
|
302
|
+
declare const dispatch: <T = unknown>(target: HTMLElement | HTMLPlusElement, type: string, eventInitDict?: CustomEventInit<T>) => CustomEvent<T>;
|
|
301
303
|
/**
|
|
302
304
|
* TODO
|
|
303
305
|
*/
|
|
@@ -350,9 +352,32 @@ declare const toCSSUnit: (input?: number | string | null) => string | undefined;
|
|
|
350
352
|
*/
|
|
351
353
|
declare const toUnit: (input: string | number, unit?: string) => string;
|
|
352
354
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
355
|
+
/**
|
|
356
|
+
* Holds all details wrappers needed to render the content further on.
|
|
357
|
+
* @constructor
|
|
358
|
+
* @param {string} type The hole type, either `html` or `svg`.
|
|
359
|
+
* @param {string[]} template The template literals used to the define the content.
|
|
360
|
+
* @param {Array} values Zero, one, or more interpolated values to render.
|
|
361
|
+
*/
|
|
362
|
+
declare class Hole {
|
|
363
|
+
constructor(type: any, template: any, values: any);
|
|
364
|
+
type: any;
|
|
365
|
+
template: any;
|
|
366
|
+
values: any;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
type OverridableValue<Base, Overrides = unknown> = Exclude<Base, {
|
|
370
|
+
[K in keyof Overrides]: Overrides[K] extends false ? K : never;
|
|
371
|
+
}[keyof Overrides]> | {
|
|
372
|
+
[K in keyof Overrides]: Overrides[K] extends true ? K : never;
|
|
373
|
+
}[keyof Overrides];
|
|
374
|
+
|
|
375
|
+
declare const attributes: (target: HTMLElement | HTMLPlusElement, attributes: unknown[]) => void;
|
|
376
|
+
declare const html: ((template: any, ...values: any[]) => Hole) & {
|
|
377
|
+
for(ref: any, id: any): any;
|
|
378
|
+
node: (template: any, ...values: any[]) => any;
|
|
379
|
+
};
|
|
380
|
+
declare const styles: (input: object) => string;
|
|
356
381
|
|
|
357
|
-
export { Bind, Consumer, Debounce, Direction, Element$1 as Element, Event, Host, IsRTL, Listen, Method, Overrides, Property, Provider, Query, QueryAll, Slots$1 as Slots, State, Style, Watch, attributes as a, classes, direction, dispatch, getConfig, getConfigCreator, html as h, host, isCSSColor, isRTL, off, on, query, queryAll, styles as s, setConfig, setConfigCreator, slots, toCSSColor, toCSSUnit, toUnit };
|
|
358
|
-
export type { Config, ConfigOptions,
|
|
382
|
+
export { Bind, Consumer, Debounce, Direction$1 as Direction, Element$1 as Element, Event, Host, IsRTL, Listen, Method, Overrides, Property, Provider, Query, QueryAll, Slots$1 as Slots, State, Style, Variant, Watch, attributes as a, classes, direction, dispatch, getConfig, getConfigCreator, html as h, host, isCSSColor, isRTL, off, on, query, queryAll, styles as s, setConfig, setConfigCreator, slots, toCSSColor, toCSSUnit, toUnit };
|
|
383
|
+
export type { Config, ConfigOptions, EventEmitter, EventOptions, ListenOptions, OverridableValue, OverridesConfig, PropertyOptions };
|