svelte2tsx 0.5.17 → 0.5.18
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/index.js +3 -3
- package/index.mjs +3 -3
- package/package.json +1 -1
- package/svelte-jsx.d.ts +219 -5
package/index.js
CHANGED
|
@@ -4302,14 +4302,14 @@ function handleEach(str, eachBlock) {
|
|
|
4302
4302
|
transforms = [
|
|
4303
4303
|
`{ const $$_each = __sveltets_2_ensureArray(${containsComma ? '(' : ''}`,
|
|
4304
4304
|
[eachBlock.expression.start, eachBlock.expression.end],
|
|
4305
|
-
`${containsComma ? ')' : ''}); for(
|
|
4305
|
+
`${containsComma ? ')' : ''}); for(let `,
|
|
4306
4306
|
[eachBlock.context.start, eachBlock.context.end],
|
|
4307
4307
|
' of $$_each){'
|
|
4308
4308
|
];
|
|
4309
4309
|
}
|
|
4310
4310
|
else {
|
|
4311
4311
|
transforms = [
|
|
4312
|
-
'for(
|
|
4312
|
+
'for(let ',
|
|
4313
4313
|
[eachBlock.context.start, eachBlock.context.end],
|
|
4314
4314
|
` of __sveltets_2_ensureArray(${containsComma ? '(' : ''}`,
|
|
4315
4315
|
[eachBlock.expression.start, eachBlock.expression.end],
|
|
@@ -4372,7 +4372,7 @@ function handleEventHandler(str, attr, element) {
|
|
|
4372
4372
|
function handleIf(str, ifBlock) {
|
|
4373
4373
|
if (ifBlock.elseif) {
|
|
4374
4374
|
// {:else if expr} --> } else if(expr) {
|
|
4375
|
-
const start = str.original.lastIndexOf('{
|
|
4375
|
+
const start = str.original.lastIndexOf('{', ifBlock.expression.start);
|
|
4376
4376
|
str.overwrite(start, ifBlock.expression.start, '} else if (');
|
|
4377
4377
|
}
|
|
4378
4378
|
else {
|
package/index.mjs
CHANGED
|
@@ -4272,14 +4272,14 @@ function handleEach(str, eachBlock) {
|
|
|
4272
4272
|
transforms = [
|
|
4273
4273
|
`{ const $$_each = __sveltets_2_ensureArray(${containsComma ? '(' : ''}`,
|
|
4274
4274
|
[eachBlock.expression.start, eachBlock.expression.end],
|
|
4275
|
-
`${containsComma ? ')' : ''}); for(
|
|
4275
|
+
`${containsComma ? ')' : ''}); for(let `,
|
|
4276
4276
|
[eachBlock.context.start, eachBlock.context.end],
|
|
4277
4277
|
' of $$_each){'
|
|
4278
4278
|
];
|
|
4279
4279
|
}
|
|
4280
4280
|
else {
|
|
4281
4281
|
transforms = [
|
|
4282
|
-
'for(
|
|
4282
|
+
'for(let ',
|
|
4283
4283
|
[eachBlock.context.start, eachBlock.context.end],
|
|
4284
4284
|
` of __sveltets_2_ensureArray(${containsComma ? '(' : ''}`,
|
|
4285
4285
|
[eachBlock.expression.start, eachBlock.expression.end],
|
|
@@ -4342,7 +4342,7 @@ function handleEventHandler(str, attr, element) {
|
|
|
4342
4342
|
function handleIf(str, ifBlock) {
|
|
4343
4343
|
if (ifBlock.elseif) {
|
|
4344
4344
|
// {:else if expr} --> } else if(expr) {
|
|
4345
|
-
const start = str.original.lastIndexOf('{
|
|
4345
|
+
const start = str.original.lastIndexOf('{', ifBlock.expression.start);
|
|
4346
4346
|
str.overwrite(start, ifBlock.expression.start, '} else if (');
|
|
4347
4347
|
}
|
|
4348
4348
|
else {
|
package/package.json
CHANGED
package/svelte-jsx.d.ts
CHANGED
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
declare namespace svelteHTML {
|
|
4
4
|
|
|
5
5
|
// Every namespace eligible for use needs to implement the following two functions
|
|
6
|
+
/**
|
|
7
|
+
* @internal do not use
|
|
8
|
+
*/
|
|
6
9
|
function mapElementTag<K extends keyof ElementTagNameMap>(
|
|
7
10
|
tag: K
|
|
8
11
|
): ElementTagNameMap[K];
|
|
@@ -13,6 +16,9 @@ declare namespace svelteHTML {
|
|
|
13
16
|
tag: any
|
|
14
17
|
): any; // needs to be any because used in context of <svelte:element>
|
|
15
18
|
|
|
19
|
+
/**
|
|
20
|
+
* @internal do not use
|
|
21
|
+
*/
|
|
16
22
|
function createElement<Elements extends IntrinsicElements, Key extends keyof Elements>(
|
|
17
23
|
// "undefined | null" because of <svelte:element>
|
|
18
24
|
element: Key | undefined | null, attrs: Elements[Key]
|
|
@@ -43,15 +49,223 @@ declare namespace svelteHTML {
|
|
|
43
49
|
type TransitionEventHandler<T extends EventTarget> = svelte.JSX.TransitionEventHandler<T>;
|
|
44
50
|
type MessageEventHandler<T extends EventTarget> = svelte.JSX.MessageEventHandler<T>;
|
|
45
51
|
|
|
46
|
-
// For backwards-compatibility, in case someone enhanced the typings from
|
|
52
|
+
// For backwards-compatibility and ease-of-use, in case someone enhanced the typings from import('./svelte-html-do-not-use').HTMLAttributes/SVGAttributes
|
|
47
53
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
48
54
|
interface HTMLAttributes<T extends EventTarget = any> {}
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
56
|
+
interface SVGAttributes<T extends EventTarget = any> {}
|
|
49
57
|
|
|
58
|
+
/**
|
|
59
|
+
* @internal do not use
|
|
60
|
+
*/
|
|
50
61
|
type EventsWithColon<T> = {[Property in keyof T as Property extends `on${infer Key}` ? `on:${Key}` : Property]?: T[Property] }
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
62
|
+
/**
|
|
63
|
+
* @internal do not use
|
|
64
|
+
*/
|
|
65
|
+
type HTMLProps<Property extends string, Override> =
|
|
66
|
+
// This omit chain ensures that properties manually defined in the new transformation take precedence
|
|
67
|
+
// over those manually defined in the old, taking precendence over the defaults, to make sth like this possible
|
|
68
|
+
// https://github.com/sveltejs/language-tools/issues/1352#issuecomment-1248627516
|
|
69
|
+
Omit<
|
|
70
|
+
Omit<import('./svelte-html-do-not-use').SvelteHTMLElements[Property], keyof EventsWithColon<svelte.JSX.IntrinsicElements[Property & string]>> & EventsWithColon<svelte.JSX.IntrinsicElements[Property & string]>,
|
|
71
|
+
keyof Override
|
|
72
|
+
> & Override;
|
|
73
|
+
/**
|
|
74
|
+
* @internal do not use
|
|
75
|
+
*/
|
|
76
|
+
type RemoveIndex<T> = {
|
|
77
|
+
[ K in keyof T as string extends K ? never : K ] : T[K]
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// the following type construct makes sure that we can use the new typings while maintaining backwards-compatibility in case someone enhanced the old typings
|
|
81
|
+
interface IntrinsicElements extends Omit<RemoveIndex<svelte.JSX.IntrinsicElements>, keyof RemoveIndex<import('./svelte-html-do-not-use').SvelteHTMLElements>> {
|
|
82
|
+
a: HTMLProps<'a', HTMLAttributes>;
|
|
83
|
+
abbr: HTMLProps<'abbr', HTMLAttributes>;
|
|
84
|
+
address: HTMLProps<'address', HTMLAttributes>;
|
|
85
|
+
area: HTMLProps<'area', HTMLAttributes>;
|
|
86
|
+
article: HTMLProps<'article', HTMLAttributes>;
|
|
87
|
+
aside: HTMLProps<'aside', HTMLAttributes>;
|
|
88
|
+
audio: HTMLProps<'audio', HTMLAttributes>;
|
|
89
|
+
b: HTMLProps<'b', HTMLAttributes>;
|
|
90
|
+
base: HTMLProps<'base', HTMLAttributes>;
|
|
91
|
+
bdi: HTMLProps<'bdi', HTMLAttributes>;
|
|
92
|
+
bdo: HTMLProps<'bdo', HTMLAttributes>;
|
|
93
|
+
big: HTMLProps<'big', HTMLAttributes>;
|
|
94
|
+
blockquote: HTMLProps<'blockquote', HTMLAttributes>;
|
|
95
|
+
body: HTMLProps<'body', HTMLAttributes>;
|
|
96
|
+
br: HTMLProps<'br', HTMLAttributes>;
|
|
97
|
+
button: HTMLProps<'button', HTMLAttributes>;
|
|
98
|
+
canvas: HTMLProps<'canvas', HTMLAttributes>;
|
|
99
|
+
caption: HTMLProps<'caption', HTMLAttributes>;
|
|
100
|
+
cite: HTMLProps<'cite', HTMLAttributes>;
|
|
101
|
+
code: HTMLProps<'code', HTMLAttributes>;
|
|
102
|
+
col: HTMLProps<'col', HTMLAttributes>;
|
|
103
|
+
colgroup: HTMLProps<'colgroup', HTMLAttributes>;
|
|
104
|
+
data: HTMLProps<'data', HTMLAttributes>;
|
|
105
|
+
datalist: HTMLProps<'datalist', HTMLAttributes>;
|
|
106
|
+
dd: HTMLProps<'dd', HTMLAttributes>;
|
|
107
|
+
del: HTMLProps<'del', HTMLAttributes>;
|
|
108
|
+
details: HTMLProps<'details', HTMLAttributes>;
|
|
109
|
+
dfn: HTMLProps<'dfn', HTMLAttributes>;
|
|
110
|
+
dialog: HTMLProps<'dialog', HTMLAttributes>;
|
|
111
|
+
div: HTMLProps<'div', HTMLAttributes>;
|
|
112
|
+
dl: HTMLProps<'dl', HTMLAttributes>;
|
|
113
|
+
dt: HTMLProps<'dt', HTMLAttributes>;
|
|
114
|
+
em: HTMLProps<'em', HTMLAttributes>;
|
|
115
|
+
embed: HTMLProps<'embed', HTMLAttributes>;
|
|
116
|
+
fieldset: HTMLProps<'fieldset', HTMLAttributes>;
|
|
117
|
+
figcaption: HTMLProps<'figcaption', HTMLAttributes>;
|
|
118
|
+
figure: HTMLProps<'figure', HTMLAttributes>;
|
|
119
|
+
footer: HTMLProps<'footer', HTMLAttributes>;
|
|
120
|
+
form: HTMLProps<'form', HTMLAttributes>;
|
|
121
|
+
h1: HTMLProps<'h1', HTMLAttributes>;
|
|
122
|
+
h2: HTMLProps<'h2', HTMLAttributes>;
|
|
123
|
+
h3: HTMLProps<'h3', HTMLAttributes>;
|
|
124
|
+
h4: HTMLProps<'h4', HTMLAttributes>;
|
|
125
|
+
h5: HTMLProps<'h5', HTMLAttributes>;
|
|
126
|
+
h6: HTMLProps<'h6', HTMLAttributes>;
|
|
127
|
+
head: HTMLProps<'head', HTMLAttributes>;
|
|
128
|
+
header: HTMLProps<'header', HTMLAttributes>;
|
|
129
|
+
hgroup: HTMLProps<'hgroup', HTMLAttributes>;
|
|
130
|
+
hr: HTMLProps<'hr', HTMLAttributes>;
|
|
131
|
+
html: HTMLProps<'html', HTMLAttributes>;
|
|
132
|
+
i: HTMLProps<'i', HTMLAttributes>;
|
|
133
|
+
iframe: HTMLProps<'iframe', HTMLAttributes>;
|
|
134
|
+
img: HTMLProps<'img', HTMLAttributes>;
|
|
135
|
+
input: HTMLProps<'input', HTMLAttributes>;
|
|
136
|
+
ins: HTMLProps<'ins', HTMLAttributes>;
|
|
137
|
+
kbd: HTMLProps<'kbd', HTMLAttributes>;
|
|
138
|
+
keygen: HTMLProps<'keygen', HTMLAttributes>;
|
|
139
|
+
label: HTMLProps<'label', HTMLAttributes>;
|
|
140
|
+
legend: HTMLProps<'legend', HTMLAttributes>;
|
|
141
|
+
li: HTMLProps<'li', HTMLAttributes>;
|
|
142
|
+
link: HTMLProps<'link', HTMLAttributes>;
|
|
143
|
+
main: HTMLProps<'main', HTMLAttributes>;
|
|
144
|
+
map: HTMLProps<'map', HTMLAttributes>;
|
|
145
|
+
mark: HTMLProps<'mark', HTMLAttributes>;
|
|
146
|
+
menu: HTMLProps<'menu', HTMLAttributes>;
|
|
147
|
+
menuitem: HTMLProps<'menuitem', HTMLAttributes>;
|
|
148
|
+
meta: HTMLProps<'meta', HTMLAttributes>;
|
|
149
|
+
meter: HTMLProps<'meter', HTMLAttributes>;
|
|
150
|
+
nav: HTMLProps<'nav', HTMLAttributes>;
|
|
151
|
+
noscript: HTMLProps<'noscript', HTMLAttributes>;
|
|
152
|
+
object: HTMLProps<'object', HTMLAttributes>;
|
|
153
|
+
ol: HTMLProps<'ol', HTMLAttributes>;
|
|
154
|
+
optgroup: HTMLProps<'optgroup', HTMLAttributes>;
|
|
155
|
+
option: HTMLProps<'option', HTMLAttributes>;
|
|
156
|
+
output: HTMLProps<'output', HTMLAttributes>;
|
|
157
|
+
p: HTMLProps<'p', HTMLAttributes>;
|
|
158
|
+
param: HTMLProps<'param', HTMLAttributes>;
|
|
159
|
+
picture: HTMLProps<'picture', HTMLAttributes>;
|
|
160
|
+
pre: HTMLProps<'pre', HTMLAttributes>;
|
|
161
|
+
progress: HTMLProps<'progress', HTMLAttributes>;
|
|
162
|
+
q: HTMLProps<'q', HTMLAttributes>;
|
|
163
|
+
rp: HTMLProps<'rp', HTMLAttributes>;
|
|
164
|
+
rt: HTMLProps<'rt', HTMLAttributes>;
|
|
165
|
+
ruby: HTMLProps<'ruby', HTMLAttributes>;
|
|
166
|
+
s: HTMLProps<'s', HTMLAttributes>;
|
|
167
|
+
samp: HTMLProps<'samp', HTMLAttributes>;
|
|
168
|
+
slot: HTMLProps<'slot', HTMLAttributes>;
|
|
169
|
+
script: HTMLProps<'script', HTMLAttributes>;
|
|
170
|
+
section: HTMLProps<'section', HTMLAttributes>;
|
|
171
|
+
select: HTMLProps<'select', HTMLAttributes>;
|
|
172
|
+
small: HTMLProps<'small', HTMLAttributes>;
|
|
173
|
+
source: HTMLProps<'source', HTMLAttributes>;
|
|
174
|
+
span: HTMLProps<'span', HTMLAttributes>;
|
|
175
|
+
strong: HTMLProps<'strong', HTMLAttributes>;
|
|
176
|
+
style: HTMLProps<'style', HTMLAttributes>;
|
|
177
|
+
sub: HTMLProps<'sub', HTMLAttributes>;
|
|
178
|
+
summary: HTMLProps<'summary', HTMLAttributes>;
|
|
179
|
+
sup: HTMLProps<'sup', HTMLAttributes>;
|
|
180
|
+
table: HTMLProps<'table', HTMLAttributes>;
|
|
181
|
+
template: HTMLProps<'template', HTMLAttributes>;
|
|
182
|
+
tbody: HTMLProps<'tbody', HTMLAttributes>;
|
|
183
|
+
td: HTMLProps<'td', HTMLAttributes>;
|
|
184
|
+
textarea: HTMLProps<'textarea', HTMLAttributes>;
|
|
185
|
+
tfoot: HTMLProps<'tfoot', HTMLAttributes>;
|
|
186
|
+
th: HTMLProps<'th', HTMLAttributes>;
|
|
187
|
+
thead: HTMLProps<'thead', HTMLAttributes>;
|
|
188
|
+
time: HTMLProps<'time', HTMLAttributes>;
|
|
189
|
+
title: HTMLProps<'title', HTMLAttributes>;
|
|
190
|
+
tr: HTMLProps<'tr', HTMLAttributes>;
|
|
191
|
+
track: HTMLProps<'track', HTMLAttributes>;
|
|
192
|
+
u: HTMLProps<'u', HTMLAttributes>;
|
|
193
|
+
ul: HTMLProps<'ul', HTMLAttributes>;
|
|
194
|
+
var: HTMLProps<'var', HTMLAttributes>;
|
|
195
|
+
video: HTMLProps<'video', HTMLAttributes>;
|
|
196
|
+
wbr: HTMLProps<'wbr', HTMLAttributes>;
|
|
197
|
+
webview: HTMLProps<'webview', HTMLAttributes>;
|
|
198
|
+
// SVG
|
|
199
|
+
svg: HTMLProps<'svg', SVGAttributes>;
|
|
200
|
+
|
|
201
|
+
animate: HTMLProps<'animate', SVGAttributes>;
|
|
202
|
+
animateMotion: HTMLProps<'animateMotion', SVGAttributes>;
|
|
203
|
+
animateTransform: HTMLProps<'animateTransform', SVGAttributes>;
|
|
204
|
+
circle: HTMLProps<'circle', SVGAttributes>;
|
|
205
|
+
clipPath: HTMLProps<'clipPath', SVGAttributes>;
|
|
206
|
+
defs: HTMLProps<'defs', SVGAttributes>;
|
|
207
|
+
desc: HTMLProps<'desc', SVGAttributes>;
|
|
208
|
+
ellipse: HTMLProps<'ellipse', SVGAttributes>;
|
|
209
|
+
feBlend: HTMLProps<'feBlend', SVGAttributes>;
|
|
210
|
+
feColorMatrix: HTMLProps<'feColorMatrix', SVGAttributes>;
|
|
211
|
+
feComponentTransfer: HTMLProps<'feComponentTransfer', SVGAttributes>;
|
|
212
|
+
feComposite: HTMLProps<'feComposite', SVGAttributes>;
|
|
213
|
+
feConvolveMatrix: HTMLProps<'feConvolveMatrix', SVGAttributes>;
|
|
214
|
+
feDiffuseLighting: HTMLProps<'feDiffuseLighting', SVGAttributes>;
|
|
215
|
+
feDisplacementMap: HTMLProps<'feDisplacementMap', SVGAttributes>;
|
|
216
|
+
feDistantLight: HTMLProps<'feDistantLight', SVGAttributes>;
|
|
217
|
+
feDropShadow: HTMLProps<'feDropShadow', SVGAttributes>;
|
|
218
|
+
feFlood: HTMLProps<'feFlood', SVGAttributes>;
|
|
219
|
+
feFuncA: HTMLProps<'feFuncA', SVGAttributes>;
|
|
220
|
+
feFuncB: HTMLProps<'feFuncB', SVGAttributes>;
|
|
221
|
+
feFuncG: HTMLProps<'feFuncG', SVGAttributes>;
|
|
222
|
+
feFuncR: HTMLProps<'feFuncR', SVGAttributes>;
|
|
223
|
+
feGaussianBlur: HTMLProps<'feGaussianBlur', SVGAttributes>;
|
|
224
|
+
feImage: HTMLProps<'feImage', SVGAttributes>;
|
|
225
|
+
feMerge: HTMLProps<'feMerge', SVGAttributes>;
|
|
226
|
+
feMergeNode: HTMLProps<'feMergeNode', SVGAttributes>;
|
|
227
|
+
feMorphology: HTMLProps<'feMorphology', SVGAttributes>;
|
|
228
|
+
feOffset: HTMLProps<'feOffset', SVGAttributes>;
|
|
229
|
+
fePointLight: HTMLProps<'fePointLight', SVGAttributes>;
|
|
230
|
+
feSpecularLighting: HTMLProps<'feSpecularLighting', SVGAttributes>;
|
|
231
|
+
feSpotLight: HTMLProps<'feSpotLight', SVGAttributes>;
|
|
232
|
+
feTile: HTMLProps<'feTile', SVGAttributes>;
|
|
233
|
+
feTurbulence: HTMLProps<'feTurbulence', SVGAttributes>;
|
|
234
|
+
filter: HTMLProps<'filter', SVGAttributes>;
|
|
235
|
+
foreignObject: HTMLProps<'foreignObject', SVGAttributes>;
|
|
236
|
+
g: HTMLProps<'g', SVGAttributes>;
|
|
237
|
+
image: HTMLProps<'image', SVGAttributes>;
|
|
238
|
+
line: HTMLProps<'line', SVGAttributes>;
|
|
239
|
+
linearGradient: HTMLProps<'linearGradient', SVGAttributes>;
|
|
240
|
+
marker: HTMLProps<'marker', SVGAttributes>;
|
|
241
|
+
mask: HTMLProps<'mask', SVGAttributes>;
|
|
242
|
+
metadata: HTMLProps<'metadata', SVGAttributes>;
|
|
243
|
+
mpath: HTMLProps<'mpath', SVGAttributes>;
|
|
244
|
+
path: HTMLProps<'path', SVGAttributes>;
|
|
245
|
+
pattern: HTMLProps<'pattern', SVGAttributes>;
|
|
246
|
+
polygon: HTMLProps<'polygon', SVGAttributes>;
|
|
247
|
+
polyline: HTMLProps<'polyline', SVGAttributes>;
|
|
248
|
+
radialGradient: HTMLProps<'radialGradient', SVGAttributes>;
|
|
249
|
+
rect: HTMLProps<'rect', SVGAttributes>;
|
|
250
|
+
stop: HTMLProps<'stop', SVGAttributes>;
|
|
251
|
+
switch: HTMLProps<'switch', SVGAttributes>;
|
|
252
|
+
symbol: HTMLProps<'symbol', SVGAttributes>;
|
|
253
|
+
text: HTMLProps<'text', SVGAttributes>;
|
|
254
|
+
textPath: HTMLProps<'textPath', SVGAttributes>;
|
|
255
|
+
tspan: HTMLProps<'tspan', SVGAttributes>;
|
|
256
|
+
use: HTMLProps<'use', SVGAttributes>;
|
|
257
|
+
view: HTMLProps<'view', SVGAttributes>;
|
|
258
|
+
|
|
259
|
+
// Svelte specific
|
|
260
|
+
'svelte:window': HTMLProps<'svelte:window', HTMLAttributes>;
|
|
261
|
+
'svelte:body': HTMLProps<'svelte:body', HTMLAttributes>;
|
|
262
|
+
'svelte:fragment': { slot?: string };
|
|
263
|
+
'svelte:options': { [name: string]: any };
|
|
264
|
+
'svelte:head': { [name: string]: any };
|
|
265
|
+
|
|
266
|
+
[name: string]: { [name: string]: any };
|
|
267
|
+
}
|
|
268
|
+
|
|
55
269
|
}
|
|
56
270
|
|
|
57
271
|
/**
|