@htmlplus/element 3.2.6 → 3.3.1

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.
@@ -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: Array<TransformerPlugin>) => {
5
+ declare const rollup: (...plugins: TransformerPlugin[]) => {
6
6
  name: string;
7
7
  buildStart(): Promise<void>;
8
- load(id: any): Promise<string | undefined>;
8
+ load(id: string): Promise<string | undefined>;
9
9
  buildEnd(error?: Error): Promise<void>;
10
10
  };
11
11
 
12
- declare const vite: (...plugins: Array<TransformerPlugin>) => {
12
+ declare const vite: (...plugins: TransformerPlugin[]) => {
13
13
  name: string;
14
14
  buildStart(): Promise<void>;
15
- load(id: any): Promise<string | undefined>;
16
- writeBundle(options: any, bundles: any): Promise<void>;
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 '@babel/traverse';
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(options, bundles) {
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(): (target: Object, key: PropertyKey, descriptor: PropertyDescriptor) => {
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: Object, key: PropertyKey, descriptor: PropertyDescriptor) => {
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 = any> = (data?: T) => CustomEvent<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 = any>(options?: EventOptions): (target: HTMLPlusElement, key: PropertyKey) => void;
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,7 +139,20 @@ 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, descriptor: PropertyDescriptor) => void;
142
+ declare function Method(): (target: HTMLPlusElement, key: PropertyKey, _descriptor: PropertyDescriptor) => void;
143
+
144
+ type DistributiveOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : never;
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> = {
151
+ [Key in Breakpoint]?: Partial<Properties>;
152
+ };
153
+ interface ElementPropertiesAutoGenerated {
154
+ }
155
+ declare function Overrides(): (target: HTMLPlusElement, key: string) => void;
143
156
 
144
157
  /**
145
158
  * The configuration for property decorator.
@@ -158,7 +171,7 @@ interface PropertyOptions {
158
171
  * [data types](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures).
159
172
  * If this value is not set, it will be set automatically during transforming.
160
173
  */
161
- type?: any;
174
+ type?: unknown;
162
175
  }
163
176
  /**
164
177
  * Creates a reactive property, reflecting a corresponding attribute value,
@@ -216,22 +229,31 @@ declare function Watch(keys?: string | string[], immediate?: boolean): (target:
216
229
  /**
217
230
  * TODO
218
231
  */
219
- declare const classes: (input: any, smart?: boolean) => string;
232
+ declare const classes: (input: unknown, smart?: boolean) => string;
220
233
 
221
234
  /**
222
235
  * TODO
223
236
  */
224
237
  interface Config {
238
+ breakpoints?: {
239
+ [key: string]: {
240
+ type: 'container' | 'media';
241
+ min?: number;
242
+ max?: number;
243
+ };
244
+ };
225
245
  event?: {
226
- resolver?: (parameters: any) => CustomEvent | undefined;
246
+ resolver?: (parameters: unknown) => CustomEvent | undefined;
227
247
  };
228
- asset?: {
229
- [key: string]: any;
248
+ assets?: {
249
+ [key: string]: unknown;
230
250
  };
231
- element?: {
251
+ elements?: {
232
252
  [key: string]: {
233
- property?: {
234
- [key: string]: any;
253
+ properties?: {
254
+ [key: string]: {
255
+ default?: unknown;
256
+ };
235
257
  };
236
258
  };
237
259
  };
@@ -252,22 +274,31 @@ interface ConfigOptions {
252
274
  /**
253
275
  * TODO
254
276
  */
255
- declare const getConfig: (...keys: string[]) => any;
277
+ declare const getConfig: (namespace: string) => Config;
278
+ /**
279
+ * TODO
280
+ */
281
+ declare const getConfigCreator: (namespace: string) => () => Config;
256
282
  /**
257
283
  * TODO
258
284
  */
259
- declare const setConfig: (config: Config, options?: ConfigOptions) => void;
285
+ declare const setConfig: (namespace: string, config: Config, options?: ConfigOptions) => void;
286
+ /**
287
+ * TODO
288
+ */
289
+ declare const setConfigCreator: (namespace: string) => (config: Config, options?: ConfigOptions) => void;
260
290
 
291
+ type Direction = 'ltr' | 'rtl';
261
292
  /**
262
293
  * Indicates whether the [Direction](https://mdn.io/css-direction)
263
294
  * of the element is `Right-To-Left` or `Left-To-Right`.
264
295
  */
265
- declare const direction: (target: HTMLElement | HTMLPlusElement) => "ltr" | "rtl";
296
+ declare const direction: (target: HTMLElement | HTMLPlusElement) => Direction;
266
297
 
267
298
  /**
268
299
  * TODO
269
300
  */
270
- declare const dispatch: <T = any>(target: HTMLElement | HTMLPlusElement, type: string, eventInitDict?: CustomEventInit<T>) => CustomEvent<T>;
301
+ declare const dispatch: <T = unknown>(target: HTMLElement | HTMLPlusElement, type: string, eventInitDict?: CustomEventInit<T>) => CustomEvent<T>;
271
302
  /**
272
303
  * TODO
273
304
  */
@@ -320,9 +351,26 @@ declare const toCSSUnit: (input?: number | string | null) => string | undefined;
320
351
  */
321
352
  declare const toUnit: (input: string | number, unit?: string) => string;
322
353
 
323
- declare const attributes: any;
324
- declare const html: any;
325
- declare const styles: any;
354
+ /**
355
+ * Holds all details wrappers needed to render the content further on.
356
+ * @constructor
357
+ * @param {string} type The hole type, either `html` or `svg`.
358
+ * @param {string[]} template The template literals used to the define the content.
359
+ * @param {Array} values Zero, one, or more interpolated values to render.
360
+ */
361
+ declare class Hole {
362
+ constructor(type: any, template: any, values: any);
363
+ type: any;
364
+ template: any;
365
+ values: any;
366
+ }
367
+
368
+ declare const attributes: (target: HTMLElement | HTMLPlusElement, attributes: unknown[]) => void;
369
+ declare const html: ((template: any, ...values: any[]) => Hole) & {
370
+ for(ref: any, id: any): any;
371
+ node: (template: any, ...values: any[]) => any;
372
+ };
373
+ declare const styles: (input: object) => string;
326
374
 
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 };
375
+ 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, 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 };
376
+ export type { Config, ConfigOptions, ElementPropertiesAutoGenerated, EventEmitter, EventOptions, ListenOptions, OverridesConfig, OverridesConfigBreakpointCreator, PropertyOptions };