@glint/template 1.7.3-unstable.c503511 → 1.7.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/-private/dsl/elements.d.ts +23 -31
- package/-private/dsl/lib.dom.augmentation.d.ts +26 -23
- package/-private/dsl/types.d.ts +34 -33
- package/LICENSE +21 -0
- package/package.json +7 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//generated by
|
|
1
|
+
// Auto-generated by bin/build-elements.mjs
|
|
2
2
|
// this server to provide the html attributes for each element
|
|
3
3
|
|
|
4
4
|
import { AttrValue } from '../index';
|
|
@@ -628,7 +628,6 @@ interface HTMLVideoElementAttributes extends GlobalHTMLAttributes {
|
|
|
628
628
|
}
|
|
629
629
|
interface HTMLElementAttributes extends GlobalHTMLAttributes {
|
|
630
630
|
}
|
|
631
|
-
|
|
632
631
|
/**
|
|
633
632
|
* @internal
|
|
634
633
|
* @private - not for use outside of Glint
|
|
@@ -637,49 +636,44 @@ interface GlintHtmlElementAttributesMap {
|
|
|
637
636
|
['HTMLAnchorElement']: HTMLAnchorElementAttributes;
|
|
638
637
|
['HTMLAreaElement']: HTMLAreaElementAttributes;
|
|
639
638
|
['HTMLAudioElement']: HTMLAudioElementAttributes;
|
|
640
|
-
['HTMLBaseElement']: HTMLBaseElementAttributes;
|
|
641
|
-
['HTMLQuoteElement']: HTMLQuoteElementAttributes;
|
|
642
639
|
['HTMLBRElement']: HTMLBRElementAttributes;
|
|
640
|
+
['HTMLBaseElement']: HTMLBaseElementAttributes;
|
|
641
|
+
['HTMLBodyElement']: GlobalHTMLAttributes;
|
|
643
642
|
['HTMLButtonElement']: HTMLButtonElementAttributes;
|
|
644
643
|
['HTMLCanvasElement']: HTMLCanvasElementAttributes;
|
|
645
|
-
['
|
|
646
|
-
['HTMLTableColElement']: HTMLTableColElementAttributes;
|
|
647
|
-
['HTMLTableColElement']: HTMLTableColElementAttributes;
|
|
644
|
+
['HTMLDListElement']: HTMLDListElementAttributes;
|
|
648
645
|
['HTMLDataElement']: HTMLDataElementAttributes;
|
|
649
|
-
['
|
|
646
|
+
['HTMLDataListElement']: GlobalHTMLAttributes;
|
|
650
647
|
['HTMLDetailsElement']: HTMLDetailsElementAttributes;
|
|
651
648
|
['HTMLDialogElement']: HTMLDialogElementAttributes;
|
|
652
649
|
['HTMLDivElement']: HTMLDivElementAttributes;
|
|
653
|
-
['
|
|
650
|
+
['HTMLElement']: GlobalHTMLAttributes;
|
|
654
651
|
['HTMLEmbedElement']: HTMLEmbedElementAttributes;
|
|
655
652
|
['HTMLFieldSetElement']: HTMLFieldSetElementAttributes;
|
|
656
653
|
['HTMLFormElement']: HTMLFormElementAttributes;
|
|
657
|
-
['HTMLHeadingElement']: HTMLHeadingElementAttributes;
|
|
658
|
-
['HTMLHeadingElement']: HTMLHeadingElementAttributes;
|
|
659
|
-
['HTMLHeadingElement']: HTMLHeadingElementAttributes;
|
|
660
|
-
['HTMLHeadingElement']: HTMLHeadingElementAttributes;
|
|
661
|
-
['HTMLHeadingElement']: HTMLHeadingElementAttributes;
|
|
662
|
-
['HTMLHeadingElement']: HTMLHeadingElementAttributes;
|
|
663
|
-
['HTMLHeadElement']: HTMLHeadElementAttributes;
|
|
664
654
|
['HTMLHRElement']: HTMLHRElementAttributes;
|
|
655
|
+
['HTMLHeadElement']: HTMLHeadElementAttributes;
|
|
656
|
+
['HTMLHeadingElement']: HTMLHeadingElementAttributes;
|
|
657
|
+
['HTMLHtmlElement']: GlobalHTMLAttributes;
|
|
665
658
|
['HTMLIFrameElement']: HTMLIFrameElementAttributes;
|
|
666
659
|
['HTMLImageElement']: HTMLImageElementAttributes;
|
|
667
660
|
['HTMLInputElement']: HTMLInputElementAttributes;
|
|
668
|
-
['
|
|
661
|
+
['HTMLLIElement']: HTMLLIElementAttributes;
|
|
669
662
|
['HTMLLabelElement']: HTMLLabelElementAttributes;
|
|
670
663
|
['HTMLLegendElement']: HTMLLegendElementAttributes;
|
|
671
|
-
['HTMLLIElement']: HTMLLIElementAttributes;
|
|
672
664
|
['HTMLLinkElement']: HTMLLinkElementAttributes;
|
|
673
665
|
['HTMLMapElement']: HTMLMapElementAttributes;
|
|
674
666
|
['HTMLMenuElement']: HTMLMenuElementAttributes;
|
|
675
667
|
['HTMLMetaElement']: HTMLMetaElementAttributes;
|
|
676
668
|
['HTMLMeterElement']: HTMLMeterElementAttributes;
|
|
677
|
-
['
|
|
669
|
+
['HTMLModElement']: HTMLModElementAttributes;
|
|
678
670
|
['HTMLOListElement']: HTMLOListElementAttributes;
|
|
671
|
+
['HTMLObjectElement']: HTMLObjectElementAttributes;
|
|
679
672
|
['HTMLOptGroupElement']: HTMLOptGroupElementAttributes;
|
|
680
673
|
['HTMLOptionElement']: HTMLOptionElementAttributes;
|
|
681
674
|
['HTMLOutputElement']: HTMLOutputElementAttributes;
|
|
682
675
|
['HTMLParagraphElement']: HTMLParagraphElementAttributes;
|
|
676
|
+
['HTMLPictureElement']: GlobalHTMLAttributes;
|
|
683
677
|
['HTMLPreElement']: HTMLPreElementAttributes;
|
|
684
678
|
['HTMLProgressElement']: HTMLProgressElementAttributes;
|
|
685
679
|
['HTMLQuoteElement']: HTMLQuoteElementAttributes;
|
|
@@ -687,21 +681,21 @@ interface GlintHtmlElementAttributesMap {
|
|
|
687
681
|
['HTMLSelectElement']: HTMLSelectElementAttributes;
|
|
688
682
|
['HTMLSlotElement']: HTMLSlotElementAttributes;
|
|
689
683
|
['HTMLSourceElement']: HTMLSourceElementAttributes;
|
|
684
|
+
['HTMLSpanElement']: GlobalHTMLAttributes;
|
|
690
685
|
['HTMLStyleElement']: HTMLStyleElementAttributes;
|
|
686
|
+
['HTMLTableCaptionElement']: HTMLTableCaptionElementAttributes;
|
|
687
|
+
['HTMLTableCellElement']: HTMLTableCellElementAttributes;
|
|
688
|
+
['HTMLTableColElement']: HTMLTableColElementAttributes;
|
|
691
689
|
['HTMLTableElement']: HTMLTableElementAttributes;
|
|
690
|
+
['HTMLTableRowElement']: HTMLTableRowElementAttributes;
|
|
692
691
|
['HTMLTableSectionElement']: HTMLTableSectionElementAttributes;
|
|
693
|
-
['HTMLTableCellElement']: HTMLTableCellElementAttributes;
|
|
694
692
|
['HTMLTemplateElement']: HTMLTemplateElementAttributes;
|
|
695
693
|
['HTMLTextAreaElement']: HTMLTextAreaElementAttributes;
|
|
696
|
-
['HTMLTableSectionElement']: HTMLTableSectionElementAttributes;
|
|
697
|
-
['HTMLTableCellElement']: HTMLTableCellElementAttributes;
|
|
698
|
-
['HTMLTableSectionElement']: HTMLTableSectionElementAttributes;
|
|
699
694
|
['HTMLTimeElement']: HTMLTimeElementAttributes;
|
|
700
|
-
['
|
|
695
|
+
['HTMLTitleElement']: GlobalHTMLAttributes;
|
|
701
696
|
['HTMLTrackElement']: HTMLTrackElementAttributes;
|
|
702
697
|
['HTMLUListElement']: HTMLUListElementAttributes;
|
|
703
698
|
['HTMLVideoElement']: HTMLVideoElementAttributes;
|
|
704
|
-
['HTMLElement']: GlobalHTMLAttributes;
|
|
705
699
|
}
|
|
706
700
|
}
|
|
707
701
|
|
|
@@ -4323,8 +4317,6 @@ interface SVGViewElementAttributes extends GlobalSVGAttributes {
|
|
|
4323
4317
|
}
|
|
4324
4318
|
interface SVGElementAttributes extends GlobalSVGAttributes {
|
|
4325
4319
|
}
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
4320
|
/**
|
|
4329
4321
|
* @internal
|
|
4330
4322
|
* @private - not for use outside of Glint
|
|
@@ -4338,6 +4330,7 @@ interface GlintSvgElementAttributesMap {
|
|
|
4338
4330
|
['SVGClipPathElement']: SVGClipPathElementAttributes;
|
|
4339
4331
|
['SVGDefsElement']: SVGDefsElementAttributes;
|
|
4340
4332
|
['SVGDescElement']: SVGDescElementAttributes;
|
|
4333
|
+
['SVGElement']: GlobalSVGAttributes;
|
|
4341
4334
|
['SVGEllipseElement']: SVGEllipseElementAttributes;
|
|
4342
4335
|
['SVGFEBlendElement']: SVGFEBlendElementAttributes;
|
|
4343
4336
|
['SVGFEColorMatrixElement']: SVGFEColorMatrixElementAttributes;
|
|
@@ -4370,29 +4363,28 @@ interface GlintSvgElementAttributesMap {
|
|
|
4370
4363
|
['SVGImageElement']: SVGImageElementAttributes;
|
|
4371
4364
|
['SVGLineElement']: SVGLineElementAttributes;
|
|
4372
4365
|
['SVGLinearGradientElement']: SVGLinearGradientElementAttributes;
|
|
4366
|
+
['SVGMPathElement']: SVGMPathElementAttributes;
|
|
4373
4367
|
['SVGMarkerElement']: SVGMarkerElementAttributes;
|
|
4374
4368
|
['SVGMaskElement']: SVGMaskElementAttributes;
|
|
4375
4369
|
['SVGMetadataElement']: SVGMetadataElementAttributes;
|
|
4376
|
-
['SVGMPathElement']: SVGMPathElementAttributes;
|
|
4377
4370
|
['SVGPathElement']: SVGPathElementAttributes;
|
|
4378
4371
|
['SVGPatternElement']: SVGPatternElementAttributes;
|
|
4379
4372
|
['SVGPolygonElement']: SVGPolygonElementAttributes;
|
|
4380
4373
|
['SVGPolylineElement']: SVGPolylineElementAttributes;
|
|
4381
4374
|
['SVGRadialGradientElement']: SVGRadialGradientElementAttributes;
|
|
4382
4375
|
['SVGRectElement']: SVGRectElementAttributes;
|
|
4376
|
+
['SVGSVGElement']: SVGSVGElementAttributes;
|
|
4383
4377
|
['SVGScriptElement']: SVGScriptElementAttributes;
|
|
4384
4378
|
['SVGSetElement']: SVGSetElementAttributes;
|
|
4385
4379
|
['SVGStopElement']: SVGStopElementAttributes;
|
|
4386
4380
|
['SVGStyleElement']: SVGStyleElementAttributes;
|
|
4387
|
-
['SVGSVGElement']: SVGSVGElementAttributes;
|
|
4388
4381
|
['SVGSwitchElement']: SVGSwitchElementAttributes;
|
|
4389
4382
|
['SVGSymbolElement']: SVGSymbolElementAttributes;
|
|
4383
|
+
['SVGTSpanElement']: SVGTSpanElementAttributes;
|
|
4390
4384
|
['SVGTextElement']: SVGTextElementAttributes;
|
|
4391
4385
|
['SVGTextPathElement']: SVGTextPathElementAttributes;
|
|
4392
4386
|
['SVGTitleElement']: SVGTitleElementAttributes;
|
|
4393
|
-
['SVGTSpanElement']: SVGTSpanElementAttributes;
|
|
4394
4387
|
['SVGUseElement']: SVGUseElementAttributes;
|
|
4395
4388
|
['SVGViewElement']: SVGViewElementAttributes;
|
|
4396
|
-
['SVGElement']: GlobalSVGAttributes;
|
|
4397
4389
|
}
|
|
4398
4390
|
}
|
|
@@ -1,53 +1,49 @@
|
|
|
1
|
-
// generated by
|
|
1
|
+
// Auto-generated by bin/build-augmentations.mjs
|
|
2
2
|
//
|
|
3
|
-
// This serves to provide a UNIQUE mapping for
|
|
3
|
+
// This serves to provide a UNIQUE mapping for element type -> element name -> element attributes
|
|
4
4
|
// (in combination with elements.d.ts)
|
|
5
|
-
//
|
|
6
|
-
// The TypeScript lib.dom.d.ts already has HTMLElementTagNameMap,
|
|
5
|
+
//
|
|
6
|
+
// The TypeScript lib.dom.d.ts already has HTMLElementTagNameMap,
|
|
7
7
|
// but it does not provide unique types for each element, and the technique
|
|
8
8
|
// we use for looking up the type-string for each element does not work with the built in types.
|
|
9
9
|
|
|
10
|
-
export
|
|
11
|
-
'SVGElement': SVGElement;
|
|
10
|
+
export type HTMLElementMap = {
|
|
12
11
|
'HTMLAnchorElement': HTMLAnchorElement;
|
|
13
|
-
'HTMLElement': HTMLElement;
|
|
14
12
|
'HTMLAreaElement': HTMLAreaElement;
|
|
15
13
|
'HTMLAudioElement': HTMLAudioElement;
|
|
14
|
+
'HTMLBRElement': HTMLBRElement;
|
|
16
15
|
'HTMLBaseElement': HTMLBaseElement;
|
|
17
|
-
'HTMLQuoteElement': HTMLQuoteElement;
|
|
18
16
|
'HTMLBodyElement': HTMLBodyElement;
|
|
19
|
-
'HTMLBRElement': HTMLBRElement;
|
|
20
17
|
'HTMLButtonElement': HTMLButtonElement;
|
|
21
18
|
'HTMLCanvasElement': HTMLCanvasElement;
|
|
22
|
-
'
|
|
23
|
-
'HTMLTableColElement': HTMLTableColElement;
|
|
19
|
+
'HTMLDListElement': HTMLDListElement;
|
|
24
20
|
'HTMLDataElement': HTMLDataElement;
|
|
25
21
|
'HTMLDataListElement': HTMLDataListElement;
|
|
26
|
-
'HTMLModElement': HTMLModElement;
|
|
27
22
|
'HTMLDetailsElement': HTMLDetailsElement;
|
|
28
23
|
'HTMLDialogElement': HTMLDialogElement;
|
|
29
24
|
'HTMLDivElement': HTMLDivElement;
|
|
30
|
-
'
|
|
25
|
+
'HTMLElement': HTMLElement;
|
|
31
26
|
'HTMLEmbedElement': HTMLEmbedElement;
|
|
32
27
|
'HTMLFieldSetElement': HTMLFieldSetElement;
|
|
33
28
|
'HTMLFormElement': HTMLFormElement;
|
|
34
|
-
'HTMLHeadingElement': HTMLHeadingElement;
|
|
35
|
-
'HTMLHeadElement': HTMLHeadElement;
|
|
36
29
|
'HTMLHRElement': HTMLHRElement;
|
|
30
|
+
'HTMLHeadElement': HTMLHeadElement;
|
|
31
|
+
'HTMLHeadingElement': HTMLHeadingElement;
|
|
37
32
|
'HTMLHtmlElement': HTMLHtmlElement;
|
|
38
33
|
'HTMLIFrameElement': HTMLIFrameElement;
|
|
39
34
|
'HTMLImageElement': HTMLImageElement;
|
|
40
35
|
'HTMLInputElement': HTMLInputElement;
|
|
36
|
+
'HTMLLIElement': HTMLLIElement;
|
|
41
37
|
'HTMLLabelElement': HTMLLabelElement;
|
|
42
38
|
'HTMLLegendElement': HTMLLegendElement;
|
|
43
|
-
'HTMLLIElement': HTMLLIElement;
|
|
44
39
|
'HTMLLinkElement': HTMLLinkElement;
|
|
45
40
|
'HTMLMapElement': HTMLMapElement;
|
|
46
41
|
'HTMLMenuElement': HTMLMenuElement;
|
|
47
42
|
'HTMLMetaElement': HTMLMetaElement;
|
|
48
43
|
'HTMLMeterElement': HTMLMeterElement;
|
|
49
|
-
'
|
|
44
|
+
'HTMLModElement': HTMLModElement;
|
|
50
45
|
'HTMLOListElement': HTMLOListElement;
|
|
46
|
+
'HTMLObjectElement': HTMLObjectElement;
|
|
51
47
|
'HTMLOptGroupElement': HTMLOptGroupElement;
|
|
52
48
|
'HTMLOptionElement': HTMLOptionElement;
|
|
53
49
|
'HTMLOutputElement': HTMLOutputElement;
|
|
@@ -55,23 +51,29 @@ export interface GlintElementRegistry {
|
|
|
55
51
|
'HTMLPictureElement': HTMLPictureElement;
|
|
56
52
|
'HTMLPreElement': HTMLPreElement;
|
|
57
53
|
'HTMLProgressElement': HTMLProgressElement;
|
|
54
|
+
'HTMLQuoteElement': HTMLQuoteElement;
|
|
58
55
|
'HTMLScriptElement': HTMLScriptElement;
|
|
59
56
|
'HTMLSelectElement': HTMLSelectElement;
|
|
60
57
|
'HTMLSlotElement': HTMLSlotElement;
|
|
61
58
|
'HTMLSourceElement': HTMLSourceElement;
|
|
62
59
|
'HTMLSpanElement': HTMLSpanElement;
|
|
63
60
|
'HTMLStyleElement': HTMLStyleElement;
|
|
61
|
+
'HTMLTableCaptionElement': HTMLTableCaptionElement;
|
|
62
|
+
'HTMLTableCellElement': HTMLTableCellElement;
|
|
63
|
+
'HTMLTableColElement': HTMLTableColElement;
|
|
64
64
|
'HTMLTableElement': HTMLTableElement;
|
|
65
|
+
'HTMLTableRowElement': HTMLTableRowElement;
|
|
65
66
|
'HTMLTableSectionElement': HTMLTableSectionElement;
|
|
66
|
-
'HTMLTableCellElement': HTMLTableCellElement;
|
|
67
67
|
'HTMLTemplateElement': HTMLTemplateElement;
|
|
68
68
|
'HTMLTextAreaElement': HTMLTextAreaElement;
|
|
69
69
|
'HTMLTimeElement': HTMLTimeElement;
|
|
70
70
|
'HTMLTitleElement': HTMLTitleElement;
|
|
71
|
-
'HTMLTableRowElement': HTMLTableRowElement;
|
|
72
71
|
'HTMLTrackElement': HTMLTrackElement;
|
|
73
72
|
'HTMLUListElement': HTMLUListElement;
|
|
74
73
|
'HTMLVideoElement': HTMLVideoElement;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export type SVGElementMap = {
|
|
75
77
|
'SVGAElement': SVGAElement;
|
|
76
78
|
'SVGAnimateElement': SVGAnimateElement;
|
|
77
79
|
'SVGAnimateMotionElement': SVGAnimateMotionElement;
|
|
@@ -80,6 +82,7 @@ export interface GlintElementRegistry {
|
|
|
80
82
|
'SVGClipPathElement': SVGClipPathElement;
|
|
81
83
|
'SVGDefsElement': SVGDefsElement;
|
|
82
84
|
'SVGDescElement': SVGDescElement;
|
|
85
|
+
'SVGElement': SVGElement;
|
|
83
86
|
'SVGEllipseElement': SVGEllipseElement;
|
|
84
87
|
'SVGFEBlendElement': SVGFEBlendElement;
|
|
85
88
|
'SVGFEColorMatrixElement': SVGFEColorMatrixElement;
|
|
@@ -112,27 +115,27 @@ export interface GlintElementRegistry {
|
|
|
112
115
|
'SVGImageElement': SVGImageElement;
|
|
113
116
|
'SVGLineElement': SVGLineElement;
|
|
114
117
|
'SVGLinearGradientElement': SVGLinearGradientElement;
|
|
118
|
+
'SVGMPathElement': SVGMPathElement;
|
|
115
119
|
'SVGMarkerElement': SVGMarkerElement;
|
|
116
120
|
'SVGMaskElement': SVGMaskElement;
|
|
117
121
|
'SVGMetadataElement': SVGMetadataElement;
|
|
118
|
-
'SVGMPathElement': SVGMPathElement;
|
|
119
122
|
'SVGPathElement': SVGPathElement;
|
|
120
123
|
'SVGPatternElement': SVGPatternElement;
|
|
121
124
|
'SVGPolygonElement': SVGPolygonElement;
|
|
122
125
|
'SVGPolylineElement': SVGPolylineElement;
|
|
123
126
|
'SVGRadialGradientElement': SVGRadialGradientElement;
|
|
124
127
|
'SVGRectElement': SVGRectElement;
|
|
128
|
+
'SVGSVGElement': SVGSVGElement;
|
|
125
129
|
'SVGScriptElement': SVGScriptElement;
|
|
126
130
|
'SVGSetElement': SVGSetElement;
|
|
127
131
|
'SVGStopElement': SVGStopElement;
|
|
128
132
|
'SVGStyleElement': SVGStyleElement;
|
|
129
|
-
'SVGSVGElement': SVGSVGElement;
|
|
130
133
|
'SVGSwitchElement': SVGSwitchElement;
|
|
131
134
|
'SVGSymbolElement': SVGSymbolElement;
|
|
135
|
+
'SVGTSpanElement': SVGTSpanElement;
|
|
132
136
|
'SVGTextElement': SVGTextElement;
|
|
133
137
|
'SVGTextPathElement': SVGTextPathElement;
|
|
134
138
|
'SVGTitleElement': SVGTitleElement;
|
|
135
|
-
'SVGTSpanElement': SVGTSpanElement;
|
|
136
139
|
'SVGUseElement': SVGUseElement;
|
|
137
140
|
'SVGViewElement': SVGViewElement;
|
|
138
|
-
}
|
|
141
|
+
};
|
package/-private/dsl/types.d.ts
CHANGED
|
@@ -1,28 +1,6 @@
|
|
|
1
1
|
import './elements';
|
|
2
2
|
import { AttrValue } from '../index';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
type Registry = GlintElementRegistry;
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* This doesn't generate _totally_ unique mappings, but they all have the same attributes.
|
|
9
|
-
*
|
|
10
|
-
* For example, given T = HTMLDivElement,
|
|
11
|
-
* we get back:
|
|
12
|
-
* - "HTMLTableCaptionElement"
|
|
13
|
-
* | "HTMLDivElement"
|
|
14
|
-
* | "HTMLHeadingElement"
|
|
15
|
-
* | "HTMLParagraphElement"
|
|
16
|
-
*
|
|
17
|
-
* And for the purposes of attribute lookup, that's good enough.
|
|
18
|
-
*/
|
|
19
|
-
type Lookup<T> = {
|
|
20
|
-
[K in keyof Registry]: [Registry[K]] extends [T] // check assignability in one direction
|
|
21
|
-
? [T] extends [Registry[K]] // and in the other
|
|
22
|
-
? K // if both true, exact match
|
|
23
|
-
: never
|
|
24
|
-
: never;
|
|
25
|
-
}[keyof Registry];
|
|
3
|
+
import type { HTMLElementMap, SVGElementMap } from './lib.dom.augmentation';
|
|
26
4
|
|
|
27
5
|
/**
|
|
28
6
|
* A utility for constructing the type of an environment's `resolveOrReturn` from
|
|
@@ -45,15 +23,38 @@ export type SVGElementForTagName<Name extends string> = Name extends keyof SVGEl
|
|
|
45
23
|
export type MathMlElementForTagName<Name extends string> =
|
|
46
24
|
Name extends keyof MathMLElementTagNameMap ? MathMLElementTagNameMap[Name] : Element;
|
|
47
25
|
|
|
26
|
+
/**
|
|
27
|
+
* This doesn't generate _totally_ unique mappings, but they all have the same attributes.
|
|
28
|
+
*
|
|
29
|
+
* For example, given T = HTMLDivElement,
|
|
30
|
+
* we get back:
|
|
31
|
+
* - "HTMLTableCaptionElement"
|
|
32
|
+
* | "HTMLDivElement"
|
|
33
|
+
* | "HTMLHeadingElement"
|
|
34
|
+
* | "HTMLParagraphElement"
|
|
35
|
+
*
|
|
36
|
+
* And for the purposes of attribute lookup, that's good enough.
|
|
37
|
+
*/
|
|
38
|
+
type HTMLElementLookup<T> = {
|
|
39
|
+
[K in keyof HTMLElementMap]: T extends HTMLElementMap[K]
|
|
40
|
+
? HTMLElementMap[K] extends T
|
|
41
|
+
? K
|
|
42
|
+
: never
|
|
43
|
+
: never;
|
|
44
|
+
}[keyof HTMLElementMap];
|
|
45
|
+
|
|
46
|
+
type SVGElementLookup<T> = {
|
|
47
|
+
[K in keyof SVGElementMap]: T extends SVGElementMap[K]
|
|
48
|
+
? SVGElementMap[K] extends T
|
|
49
|
+
? K
|
|
50
|
+
: never
|
|
51
|
+
: never;
|
|
52
|
+
}[keyof SVGElementMap];
|
|
53
|
+
|
|
48
54
|
type WithDataAttributes<T> = T & Record<`data-${string}`, AttrValue>;
|
|
49
55
|
|
|
50
|
-
export type AttributesForElement<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
? WithDataAttributes<
|
|
54
|
-
:
|
|
55
|
-
K extends keyof GlintSvgElementAttributesMap
|
|
56
|
-
? WithDataAttributes<GlintSvgElementAttributesMap[K]>
|
|
57
|
-
: // If the element can't be found: fallback to just allow general AttrValue
|
|
58
|
-
// NOTE: MathML has no attributes
|
|
59
|
-
Record<string, AttrValue>;
|
|
56
|
+
export type AttributesForElement<T extends Element> = T extends HTMLElement
|
|
57
|
+
? WithDataAttributes<GlintHtmlElementAttributesMap[HTMLElementLookup<T>]>
|
|
58
|
+
: T extends SVGElement
|
|
59
|
+
? WithDataAttributes<GlintSvgElementAttributesMap[SVGElementLookup<T>]>
|
|
60
|
+
: Record<string, AttrValue>;
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 The Ember TypeScript team and contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glint/template",
|
|
3
|
-
"version": "1.7.3
|
|
3
|
+
"version": "1.7.3",
|
|
4
4
|
"repository": "typed-ember/glint",
|
|
5
5
|
"description": "Type definitions to back typechecking for Glimmer templates",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,11 +14,6 @@
|
|
|
14
14
|
"types": "./*.d.ts"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
|
-
"scripts": {
|
|
18
|
-
"test": "echo 'no standalone tests within this project'",
|
|
19
|
-
"test:typecheck": "tsc --project __tests__",
|
|
20
|
-
"test:tsc": "echo 'no standalone typecheck within this project'"
|
|
21
|
-
},
|
|
22
17
|
"files": [
|
|
23
18
|
"README.md",
|
|
24
19
|
"-private",
|
|
@@ -38,5 +33,10 @@
|
|
|
38
33
|
},
|
|
39
34
|
"publishConfig": {
|
|
40
35
|
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"test": "echo 'no standalone tests within this project'",
|
|
39
|
+
"test:typecheck": "tsc --project __tests__",
|
|
40
|
+
"test:tsc": "echo 'no standalone typecheck within this project'"
|
|
41
41
|
}
|
|
42
|
-
}
|
|
42
|
+
}
|