@xtia/jel 0.1.1 → 0.1.3
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 +1 -1
- package/index.d.ts +2 -3
- package/index.js +1 -1
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ See [demo/index.ts](https://github.com/tiadrop/jel-ts/blob/main/demo/index.ts) f
|
|
|
10
10
|
`$.[tagname](details)` produces an element of `<tagname>`. `details` can be content of various types or a descriptor object.
|
|
11
11
|
|
|
12
12
|
```ts
|
|
13
|
-
import { $ } from "jel
|
|
13
|
+
import { $ } from "@xtia/jel";
|
|
14
14
|
|
|
15
15
|
// wrap body
|
|
16
16
|
const body = $(document.body);
|
package/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export type ElementClassSpec = string | Record<string, boolean> | ElementClassSpec[];
|
|
2
2
|
export type DOMContent = number | null | string | Element | JelEntity<object, any> | Text | DOMContent[];
|
|
3
3
|
export type DomEntity<T extends HTMLElement> = JelEntity<ElementAPI<T>, HTMLElementEventMap>;
|
|
4
|
-
type Classes = string | Record<string, boolean> | Classes[];
|
|
5
4
|
type JelConstructor<Spec, API, EventDataMap> = (spec?: Partial<Spec & CommonOptions<EventDataMap>>) => JelEntity<API, EventDataMap>;
|
|
6
5
|
type CommonOptions<EventDataMap> = {
|
|
7
6
|
on?: Partial<{
|
|
@@ -13,7 +12,7 @@ type JelEntity<API, EventDataMap> = API & {
|
|
|
13
12
|
readonly [componentDataSymbol]: JelComponentData;
|
|
14
13
|
};
|
|
15
14
|
interface ElementDescriptor {
|
|
16
|
-
classes?:
|
|
15
|
+
classes?: ElementClassSpec;
|
|
17
16
|
content?: DOMContent;
|
|
18
17
|
attribs?: Record<string, string | number | boolean>;
|
|
19
18
|
on?: Partial<{
|
|
@@ -23,7 +22,7 @@ interface ElementDescriptor {
|
|
|
23
22
|
[key in keyof CSSStyleDeclaration]: string | number;
|
|
24
23
|
}> & Record<string, string | number>;
|
|
25
24
|
}
|
|
26
|
-
type DomHelper = ((<T extends keyof HTMLElementTagNameMap>(tagName: T, descriptor: ElementDescriptor) => DomEntity<HTMLElementTagNameMap[T]>) & ((selector: string, content?: DOMContent) => DomEntity<
|
|
25
|
+
type DomHelper = ((<T extends keyof HTMLElementTagNameMap>(tagName: T, descriptor: ElementDescriptor) => DomEntity<HTMLElementTagNameMap[T]>) & (<T extends keyof HTMLElementTagNameMap>(selector: `${T}#${string}`, content?: DOMContent) => DomEntity<HTMLElementTagNameMap[T]>) & (<T extends keyof HTMLElementTagNameMap>(selector: `${T}.${string}`, content?: DOMContent) => DomEntity<HTMLElementTagNameMap[T]>) & (<T extends keyof HTMLElementTagNameMap>(selector: T, content?: DOMContent) => DomEntity<HTMLElementTagNameMap[T]>) & (<T extends HTMLElement>(element: T) => DomEntity<T>) & {
|
|
27
26
|
[T in keyof HTMLElementTagNameMap]: (descriptor: ElementDescriptor) => DomEntity<HTMLElementTagNameMap[T]>;
|
|
28
27
|
} & {
|
|
29
28
|
[T in keyof HTMLElementTagNameMap]: (content?: DOMContent) => DomEntity<HTMLElementTagNameMap[T]>;
|
package/index.js
CHANGED
package/package.json
CHANGED