@arcmantle/lit-jsx 1.0.32 → 1.0.34
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 +153 -105
- package/dist/compiler/attribute-processor.d.ts +9 -19
- package/dist/compiler/attribute-processor.d.ts.map +1 -1
- package/dist/compiler/attribute-processor.js +22 -39
- package/dist/compiler/attribute-processor.js.map +1 -1
- package/dist/compiler/babel-plugin.d.ts +1 -0
- package/dist/compiler/babel-plugin.d.ts.map +1 -1
- package/dist/compiler/babel-plugin.js +2 -1
- package/dist/compiler/babel-plugin.js.map +1 -1
- package/dist/compiler/compiler-utils.d.ts +9 -1
- package/dist/compiler/compiler-utils.d.ts.map +1 -1
- package/dist/compiler/compiler-utils.js +71 -60
- package/dist/compiler/compiler-utils.js.map +1 -1
- package/dist/compiler/config.d.ts +23 -28
- package/dist/compiler/config.d.ts.map +1 -1
- package/dist/compiler/config.js +28 -28
- package/dist/compiler/config.js.map +1 -1
- package/dist/compiler/oxc-walker.d.ts +4 -4
- package/dist/compiler/oxc-walker.d.ts.map +1 -1
- package/dist/compiler/oxc-walker.js +1 -1
- package/dist/compiler/oxc-walker.js.map +1 -1
- package/dist/compiler/preprocess.d.ts +1 -0
- package/dist/compiler/preprocess.d.ts.map +1 -1
- package/dist/compiler/preprocess.js +31 -0
- package/dist/compiler/preprocess.js.map +1 -1
- package/dist/compiler/transpiler.d.ts.map +1 -1
- package/dist/compiler/transpiler.js +31 -13
- package/dist/compiler/transpiler.js.map +1 -1
- package/dist/compiler/vite-plugin.d.ts +3 -1
- package/dist/compiler/vite-plugin.d.ts.map +1 -1
- package/dist/compiler/vite-plugin.js +1 -0
- package/dist/compiler/vite-plugin.js.map +1 -1
- package/dist/runtime/choose-component.d.ts +2 -2
- package/dist/runtime/choose-component.d.ts.map +1 -1
- package/dist/runtime/for-component.d.ts +3 -3
- package/dist/runtime/for-component.d.ts.map +1 -1
- package/dist/runtime/for-component.js.map +1 -1
- package/dist/runtime/lit-reexports.d.ts +11 -0
- package/dist/runtime/lit-reexports.d.ts.map +1 -0
- package/dist/runtime/lit-reexports.js +14 -0
- package/dist/runtime/lit-reexports.js.map +1 -0
- package/dist/runtime/show-component.d.ts +4 -4
- package/dist/runtime/show-component.d.ts.map +1 -1
- package/dist/runtime/type-helpers.d.ts +1 -1
- package/dist/runtime/type-helpers.d.ts.map +1 -1
- package/dist/shared/jsx-core.d.ts +83 -0
- package/dist/shared/jsx-core.d.ts.map +1 -0
- package/dist/shared/jsx-core.js +2 -0
- package/dist/shared/jsx-core.js.map +1 -0
- package/dist/shared/jsx-dom.d.ts +26 -0
- package/dist/shared/jsx-dom.d.ts.map +1 -0
- package/dist/shared/jsx-dom.js +2 -0
- package/dist/shared/jsx-dom.js.map +1 -0
- package/dist/shared/jsx-hooks.d.ts +69 -0
- package/dist/shared/jsx-hooks.d.ts.map +1 -0
- package/dist/shared/jsx-hooks.js +2 -0
- package/dist/shared/jsx-hooks.js.map +1 -0
- package/dist/shared/jsx-types.d.ts +3 -2140
- package/dist/shared/jsx-types.d.ts.map +1 -1
- package/dist/shared/jsx-types.js +3 -1
- package/dist/shared/jsx-types.js.map +1 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +3 -0
- package/dist/utils.js.map +1 -1
- package/package.json +17 -17
- package/src/compiler/attribute-processor.ts +33 -60
- package/src/compiler/babel-plugin.ts +3 -1
- package/src/compiler/compiler-utils.ts +91 -259
- package/src/compiler/config.ts +52 -43
- package/src/compiler/oxc-walker.ts +5 -5
- package/src/compiler/preprocess.ts +41 -0
- package/src/compiler/transpiler.ts +31 -12
- package/src/compiler/vite-plugin.ts +4 -1
- package/src/runtime/choose-component.ts +2 -2
- package/src/runtime/for-component.ts +3 -3
- package/src/runtime/lit-reexports.ts +16 -0
- package/src/runtime/show-component.ts +4 -4
- package/src/runtime/type-helpers.ts +1 -1
- package/src/shared/jsx-core.ts +123 -0
- package/src/shared/jsx-dom.ts +29 -0
- package/src/shared/jsx-hooks.ts +86 -0
- package/src/shared/jsx-types.ts +3 -2559
- package/src/utils.ts +15 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"for-component.js","sourceRoot":"","sources":["../../src/runtime/for-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAGvD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"for-component.js","sourceRoot":"","sources":["../../src/runtime/for-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAGvD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,GAAG,CAA4B,KAK9C;IACA,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC;QACf,OAAO,MAAM,CACZ,KAAK,CAAC,IAAI,EACV,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,GAAI,CAAC,IAAI,EAAE,KAAK,CAAC,EACxC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YACf,IAAI,KAAK,CAAC,SAAS,IAAI,KAAK,GAAG,CAAC;gBAC/B,OAAO,CAAE,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAE,CAAC;YAEzD,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACpC,CAAC,CACD,CAAC;IACH,CAAC;IAED,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;QACrB,OAAO,IAAI,CAAC,GAAG,CACd,KAAK,CAAC,IAAI,EACV,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAC5C,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACrB,CAAC;IAED,OAAO,GAAG,CACT,KAAK,CAAC,IAAI,EACV,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAC5C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports of lit-html functionality used by the transpiler.
|
|
3
|
+
* This allows consumers to use @arcmantle/lit-jsx without having direct lit-html dependencies.
|
|
4
|
+
* Only exports what the transpiler actually generates in its output code.
|
|
5
|
+
*/
|
|
6
|
+
export { html, mathml, svg } from 'lit-html';
|
|
7
|
+
export { html as htmlStatic, mathml as mathmlStatic, svg as svgStatic, unsafeStatic } from 'lit-html/static.js';
|
|
8
|
+
export { classMap } from 'lit-html/directives/class-map.js';
|
|
9
|
+
export { ref } from 'lit-html/directives/ref.js';
|
|
10
|
+
export { styleMap } from 'lit-html/directives/style-map.js';
|
|
11
|
+
//# sourceMappingURL=lit-reexports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lit-reexports.d.ts","sourceRoot":"","sources":["../../src/runtime/lit-reexports.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAG7C,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,IAAI,YAAY,EAAE,GAAG,IAAI,SAAS,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGhH,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports of lit-html functionality used by the transpiler.
|
|
3
|
+
* This allows consumers to use @arcmantle/lit-jsx without having direct lit-html dependencies.
|
|
4
|
+
* Only exports what the transpiler actually generates in its output code.
|
|
5
|
+
*/
|
|
6
|
+
// Core template tags
|
|
7
|
+
export { html, mathml, svg } from 'lit-html';
|
|
8
|
+
// Static template tags
|
|
9
|
+
export { html as htmlStatic, mathml as mathmlStatic, svg as svgStatic, unsafeStatic } from 'lit-html/static.js';
|
|
10
|
+
// Directives
|
|
11
|
+
export { classMap } from 'lit-html/directives/class-map.js';
|
|
12
|
+
export { ref } from 'lit-html/directives/ref.js';
|
|
13
|
+
export { styleMap } from 'lit-html/directives/style-map.js';
|
|
14
|
+
//# sourceMappingURL=lit-reexports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lit-reexports.js","sourceRoot":"","sources":["../../src/runtime/lit-reexports.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,qBAAqB;AACrB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE7C,uBAAuB;AACvB,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,IAAI,YAAY,EAAE,GAAG,IAAI,SAAS,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEhH,aAAa;AACb,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC"}
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
*/
|
|
23
23
|
export declare function Show<C>(props: {
|
|
24
24
|
when: C;
|
|
25
|
-
children: ((value: NoInfer<C>) =>
|
|
26
|
-
true: ((value: NoInfer<C>) =>
|
|
27
|
-
false: ((value: NoInfer<C>) =>
|
|
25
|
+
children: ((value: NoInfer<C>) => LitJSX.Child) | [
|
|
26
|
+
true: ((value: NoInfer<C>) => LitJSX.Child),
|
|
27
|
+
false: ((value: NoInfer<C>) => LitJSX.Child)
|
|
28
28
|
];
|
|
29
|
-
}):
|
|
29
|
+
}): LitJSX.Child;
|
|
30
30
|
//# sourceMappingURL=show-component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"show-component.d.ts","sourceRoot":"","sources":["../../src/runtime/show-component.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE;IAC9B,IAAI,EAAM,CAAC,CAAC;IACZ,QAAQ,EACL,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"show-component.d.ts","sourceRoot":"","sources":["../../src/runtime/show-component.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE;IAC9B,IAAI,EAAM,CAAC,CAAC;IACZ,QAAQ,EACL,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK,CAAC,GACrC;QACD,IAAI,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK,CAAC;QAC3C,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK,CAAC;KAC5C,CAAC;CACH,GAAG,MAAM,CAAC,KAAK,CAKf"}
|
|
@@ -25,7 +25,7 @@ export declare const toComponent: <T extends {
|
|
|
25
25
|
new (...args: any): any;
|
|
26
26
|
tagName: string;
|
|
27
27
|
}>(element: T) => ToComponent<InstanceType<T>>;
|
|
28
|
-
export type ToComponent<T extends object = object> = (props:
|
|
28
|
+
export type ToComponent<T extends object = object> = (props: LitJSX.JSXProps<T> & {
|
|
29
29
|
static: any;
|
|
30
30
|
}) => string;
|
|
31
31
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-helpers.d.ts","sourceRoot":"","sources":["../../src/runtime/type-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS;IAAE,KAAI,GAAG,IAAI,EAAE,GAAG,GAAG,GAAG,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;CAAE,EACjF,SAAS,CAAC,KACR,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAU7B,CAAC;AAEF,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAChD,CAAC,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"type-helpers.d.ts","sourceRoot":"","sources":["../../src/runtime/type-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS;IAAE,KAAI,GAAG,IAAI,EAAE,GAAG,GAAG,GAAG,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;CAAE,EACjF,SAAS,CAAC,KACR,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAU7B,CAAC;AAEF,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAChD,CAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG;IAAE,MAAM,EAAE,GAAG,CAAC;CAAE,KAAK,MAAM,CAAC;AAG1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,SAAS,MAAM,GAAG,CAAC,iBAAiB,EAC1D,KAAK,CAAC,KACJ,KAAK,CAAC,CAAC,CAAe,CAAC;AAG1B,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,iBAAiB,IACtD,CAAC,KAAK,EAAE,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAAG;IAAE,MAAM,EAAE,GAAG,CAAC;CAAE,KAAK,MAAM,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { TemplateResult } from 'lit-html';
|
|
2
|
+
import type { DirectiveResult } from 'lit-html/async-directive.js';
|
|
3
|
+
import type { RefOrCallback } from 'lit-html/directives/ref.js';
|
|
4
|
+
declare global {
|
|
5
|
+
namespace LitJSX {
|
|
6
|
+
type HTMLElementAssignableProps<T extends object & Record<string, any>> = Partial<TrimReadonly<T>>;
|
|
7
|
+
type HTMLElementProps = HTMLElementAssignableProps<HTMLElement>;
|
|
8
|
+
type JSXElementProps<T extends object> = HTMLElementAssignableProps<T> & {
|
|
9
|
+
children?: LitJSX.Child;
|
|
10
|
+
ref?: RefOrCallback<HTMLElementAssignableProps<T>>;
|
|
11
|
+
classList?: {
|
|
12
|
+
[k: string]: boolean | undefined;
|
|
13
|
+
};
|
|
14
|
+
styleList?: CSSProperties;
|
|
15
|
+
/**
|
|
16
|
+
* This property takes in one or more element directives.
|
|
17
|
+
* This is akin to applying a directive through `<div ${myDirective()}></div>`.
|
|
18
|
+
*/
|
|
19
|
+
directive?: DirectiveResult<any> | DirectiveResult<any>[];
|
|
20
|
+
} & {
|
|
21
|
+
[key: `data-${string}`]: string | undefined;
|
|
22
|
+
};
|
|
23
|
+
type ElementMapToJSXElements<T extends object & Record<string, any>> = {
|
|
24
|
+
[K in keyof T]: JSXElementProps<T[K]>;
|
|
25
|
+
};
|
|
26
|
+
type IfEquals<X, Y, A = X> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? A : never;
|
|
27
|
+
type WritableKeys<T> = {
|
|
28
|
+
[P in keyof T]-?: IfEquals<{
|
|
29
|
+
[Q in P]: T[P];
|
|
30
|
+
}, {
|
|
31
|
+
-readonly [Q in P]: T[P];
|
|
32
|
+
}, P>;
|
|
33
|
+
}[keyof T];
|
|
34
|
+
type TrimReadonly<T> = Pick<T, WritableKeys<T>>;
|
|
35
|
+
type TrimHTMLElement<T extends object> = TrimReadonly<Omit<T, keyof HTMLElement | 'constructor'>>;
|
|
36
|
+
type JSXProps<T extends object> = TrimHTMLElement<T> & Omit<HTMLElementProps, keyof TrimHTMLElement<T>>;
|
|
37
|
+
type Child = unknown;
|
|
38
|
+
type Element = TemplateResult<any>;
|
|
39
|
+
type AnyTagName = string & Record<never, never>;
|
|
40
|
+
interface IntrinsicElements extends NativeHTMLElements, NativeSVGElements, NativeMathMLElements, SemanticTags {
|
|
41
|
+
}
|
|
42
|
+
type TagName = keyof IntrinsicElements | AnyTagName;
|
|
43
|
+
type DynamicTagProps<Tag extends string> = Tag extends keyof IntrinsicElements ? IntrinsicElements[Tag] : (Tag extends keyof HTMLElementTagNameMap ? JSXElementProps<HTMLElementTagNameMap[Tag]> : JSXElementProps<HTMLElement>);
|
|
44
|
+
type IntrinsicElementProps<Tag extends keyof IntrinsicElements> = IntrinsicElements[Tag];
|
|
45
|
+
type DynamicTag<Tag extends TagName> = ((props: DynamicTagProps<Tag> & StaticMarker) => Element);
|
|
46
|
+
interface StaticMarker {
|
|
47
|
+
/**
|
|
48
|
+
* Opt into the lit-jsx custom-element transform. \
|
|
49
|
+
* Example: `<MyElement static />`
|
|
50
|
+
*/
|
|
51
|
+
static: true;
|
|
52
|
+
}
|
|
53
|
+
type Component<P extends object = {}> = (props: P) => Element;
|
|
54
|
+
type ClassComponent<Instance extends object = any> = abstract new (...args: any[]) => Instance;
|
|
55
|
+
type ComponentLike<P extends object = object> = Component<P> | ClassComponent<any>;
|
|
56
|
+
type ComponentProps<T> = T extends Component<infer P> ? P : T extends ClassComponent<infer I> ? JSXProps<Extract<I, object>> : T extends abstract new (...args: any[]) => infer I ? JSXProps<Extract<I, object>> : {};
|
|
57
|
+
}
|
|
58
|
+
var as: {
|
|
59
|
+
/**
|
|
60
|
+
* Informs the compiler that the value should be bound as a property value.\
|
|
61
|
+
* This binds the expression value as a property, using the `.` syntax e.g `.key=${value}`\
|
|
62
|
+
* This function call is removed during compilation, therefore it has no runtime effect.
|
|
63
|
+
*/
|
|
64
|
+
prop: <T>(value: T) => T;
|
|
65
|
+
/**
|
|
66
|
+
* Informs the compiler that the value should be bound as a boolean attribute.\
|
|
67
|
+
* This allows the template to bind the value using the `?` syntax, e.g. `?disabled=${true}`\
|
|
68
|
+
* This function call is removed during compilation, therefore it has no runtime effect.
|
|
69
|
+
*/
|
|
70
|
+
bool: (value: boolean) => boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Creates a component-like value for an intrinsic tag, so it can be used in
|
|
73
|
+
* JSX as a dynamic tag identifier.
|
|
74
|
+
*
|
|
75
|
+
* The returned component requires `static`.
|
|
76
|
+
* Example:
|
|
77
|
+
* const Tag = as.tag('a');
|
|
78
|
+
* <Tag static href="..." />
|
|
79
|
+
*/
|
|
80
|
+
tag: <Tag extends LitJSX.TagName>(tag: Tag) => LitJSX.DynamicTag<Tag>;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=jsx-core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-core.d.ts","sourceRoot":"","sources":["../../src/shared/jsx-core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAGhE,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,MAAM,CAAC;QAChB,KAAK,0BAA0B,CAAC,CAAC,SAAS,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AC;KACvE,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-core.js","sourceRoot":"","sources":["../../src/shared/jsx-core.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type * as csstype from 'csstype';
|
|
2
|
+
declare global {
|
|
3
|
+
namespace LitJSX {
|
|
4
|
+
interface CSSProperties extends csstype.Properties {
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Interface for native HTML elements
|
|
8
|
+
*/
|
|
9
|
+
type NativeHTMLElements = ElementMapToJSXElements<HTMLElementTagNameMap>;
|
|
10
|
+
/**
|
|
11
|
+
* Interface for native SVG elements
|
|
12
|
+
*/
|
|
13
|
+
type NativeSVGElements = ElementMapToJSXElements<Omit<SVGElementTagNameMap, keyof HTMLElementTagNameMap>>;
|
|
14
|
+
/**
|
|
15
|
+
* Interface for native MathML elements
|
|
16
|
+
*/
|
|
17
|
+
type NativeMathMLElements = ElementMapToJSXElements<Omit<MathMLElementTagNameMap, keyof HTMLElementTagNameMap>>;
|
|
18
|
+
/**
|
|
19
|
+
* Interface for semantic tags that start with "s-".
|
|
20
|
+
*/
|
|
21
|
+
interface SemanticTags {
|
|
22
|
+
[key: `s-${string}`]: JSXElementProps<HTMLElement>;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=jsx-dom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-dom.d.ts","sourceRoot":"","sources":["../../src/shared/jsx-dom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AAGxC,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,MAAM,CAAC;QAEhB,UAAU,aAAc,SAAQ,OAAO,CAAC,UAAU;SAAI;QAEtD;;WAEG;QACH,KAAK,kBAAkB,GAAG,uBAAuB,CAAC,qBAAqB,CAAC,CAAC;QAEzE;;WAEG;QACH,KAAK,iBAAiB,GAAG,uBAAuB,CAAC,IAAI,CAAC,oBAAoB,EAAE,MAAM,qBAAqB,CAAC,CAAC,CAAC;QAE1G;;WAEG;QACH,KAAK,oBAAoB,GAAG,uBAAuB,CAAC,IAAI,CAAC,uBAAuB,EAAE,MAAM,qBAAqB,CAAC,CAAC,CAAC;QAEhH;;WAEG;QACH,UAAU,YAAY;YAAG,CAAC,GAAG,EAAE,KAAM,MAAO,EAAE,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;SAAE;KAChF;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-dom.js","sourceRoot":"","sources":["../../src/shared/jsx-dom.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
/**
|
|
3
|
+
* TSX hook declarations for lit-jsx.
|
|
4
|
+
*/
|
|
5
|
+
declare global {
|
|
6
|
+
namespace JSX {
|
|
7
|
+
/**
|
|
8
|
+
* TSX hook: the type produced by any JSX expression.
|
|
9
|
+
*
|
|
10
|
+
* In lit-jsx we return a lit `TemplateResult`, so `<div />` has this type.
|
|
11
|
+
*/
|
|
12
|
+
type Element = LitJSX.Element;
|
|
13
|
+
/**
|
|
14
|
+
* TSX hook: what values are allowed as JSX tags.
|
|
15
|
+
*
|
|
16
|
+
* Note: this intentionally references tag/component helper types declared in
|
|
17
|
+
* `jsx-core.ts`.
|
|
18
|
+
*/
|
|
19
|
+
type ElementType = keyof LitJSX.IntrinsicElements | (string & {}) | LitJSX.ComponentLike<any>;
|
|
20
|
+
/**
|
|
21
|
+
* TSX hook: computes the attribute (props) type for a JSX tag.
|
|
22
|
+
*
|
|
23
|
+
* lit-jsx uses this to:
|
|
24
|
+
* - require `static: true` for class-based component tags
|
|
25
|
+
* - preserve TSX generic arguments on class instances (avoid `unknown` props)
|
|
26
|
+
*/
|
|
27
|
+
type LibraryManagedAttributes<C, P> = C extends abstract new (...args: any[]) => infer I ? (P extends I ? LitJSX.JSXProps<Extract<P, object>> & LitJSX.StaticMarker : LitJSX.ComponentProps<C> & LitJSX.StaticMarker) : (C extends keyof LitJSX.IntrinsicElements ? LitJSX.IntrinsicElementProps<C> : LitJSX.ComponentProps<C>);
|
|
28
|
+
/**
|
|
29
|
+
* TSX hook: controls the instance type used for class components.
|
|
30
|
+
*
|
|
31
|
+
* We keep this empty because we don’t require any particular base class.
|
|
32
|
+
*/
|
|
33
|
+
interface ElementClass {
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* TSX hook: which property name TypeScript should read for “props”.
|
|
37
|
+
*
|
|
38
|
+
* Leaving it empty means TS uses its default behavior.
|
|
39
|
+
*/
|
|
40
|
+
interface ElementAttributesProperty {
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* TSX hook: which property name represents “children”.
|
|
44
|
+
*/
|
|
45
|
+
interface ElementChildrenAttribute {
|
|
46
|
+
children: {};
|
|
47
|
+
}
|
|
48
|
+
/** TSX hook: attributes allowed on *all* JSX elements (e.g. React's `key`). */
|
|
49
|
+
interface IntrinsicAttributes {
|
|
50
|
+
}
|
|
51
|
+
/** TSX hook: attributes allowed on class components specifically (often `ref`-like). */
|
|
52
|
+
interface IntrinsicClassAttributes<_T> {
|
|
53
|
+
}
|
|
54
|
+
/** TSX hook: base attribute bag TypeScript may intersect into component props. */
|
|
55
|
+
interface Attributes {
|
|
56
|
+
}
|
|
57
|
+
/** TSX hook: fragment typing for `<>...</>` */
|
|
58
|
+
type Fragment = Element;
|
|
59
|
+
/**
|
|
60
|
+
* TSX hook: mapping of intrinsic tag names to their attribute types.
|
|
61
|
+
*
|
|
62
|
+
* Note: this intentionally depends on DOM typings declared in `jsx-dom.ts`
|
|
63
|
+
* (e.g. `HTMLElementTags`, `SVGElementTags`, ...).
|
|
64
|
+
*/
|
|
65
|
+
interface IntrinsicElements extends LitJSX.IntrinsicElements {
|
|
66
|
+
}
|
|
67
|
+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