svelte2tsx 0.5.6 → 0.5.9

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 CHANGED
@@ -1807,7 +1807,11 @@ function handleAttribute$1(htmlx, str, attr, parent, preserveCase) {
1807
1807
  //if we are on an "element" we are case insensitive, lowercase to match our JSX
1808
1808
  if (parent.type == 'Element') {
1809
1809
  const sapperLinkActions = ['sapper:prefetch', 'sapper:noscroll'];
1810
- const sveltekitLinkActions = ['sveltekit:prefetch', 'sveltekit:noscroll'];
1810
+ const sveltekitLinkActions = [
1811
+ 'sveltekit:prefetch',
1812
+ 'sveltekit:noscroll',
1813
+ 'sveltekit:reload'
1814
+ ];
1811
1815
  // skip Attribute shorthand, that is handled below
1812
1816
  if ((attr.value !== true &&
1813
1817
  !(attr.value.length &&
@@ -2811,7 +2815,7 @@ function handleStyleDirective$1(str, style) {
2811
2815
 
2812
2816
  /**
2813
2817
  * `<svelte:window>...</svelte:window>` ----> `<sveltewindow>...</sveltewindow>`
2814
- * (same for :head, :body, :options, :fragment)
2818
+ * (same for :head, :body, :options, :fragment, :element)
2815
2819
  */
2816
2820
  function handleSvelteTag(htmlx, str, node) {
2817
2821
  const colon = htmlx.indexOf(':', node.start);
@@ -3091,6 +3095,9 @@ function convertHtmlxToJsx$1(str, ast, onWalk = null, onLeave = null, options =
3091
3095
  handleComponent(htmlx, str, node, parent, ifScope, templateScopeManager.value);
3092
3096
  break;
3093
3097
  case 'Element':
3098
+ if (node.name === 'svelte:element') {
3099
+ handleSvelteTag(htmlx, str, node);
3100
+ }
3094
3101
  templateScopeManager.componentOrSlotTemplateOrElementEnter(node);
3095
3102
  handleElement(htmlx, str, node, parent, ifScope, templateScopeManager.value);
3096
3103
  break;
@@ -3383,7 +3390,7 @@ var svgAttributes = 'accent-height accumulate additive alignment-baseline allowR
3383
3390
 
3384
3391
  const voidTags = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr'.split(',');
3385
3392
  /**
3386
- * Handles HTML elements as well as svelte:options, svelte:head, svelte:window, svelte:body
3393
+ * Handles HTML elements as well as svelte:options, svelte:head, svelte:window, svelte:body, svelte:element
3387
3394
  *
3388
3395
  * Children of this element should call the methods on this class to add themselves to the correct
3389
3396
  * position within the transformation.
@@ -3452,6 +3459,18 @@ class Element {
3452
3459
  this.addNameConstDeclaration = () => (this.startTransformation[0] = `{ const ${this._name} = ${createElement}("${nodeName}", {`);
3453
3460
  break;
3454
3461
  }
3462
+ case 'svelte:element': {
3463
+ const nodeName = this.node.tag
3464
+ ? typeof this.node.tag !== 'string'
3465
+ ? [this.node.tag.start, this.node.tag.end]
3466
+ : `"${this.node.tag}"`
3467
+ : '""';
3468
+ this._name = '$$_svelteelement' + this.computeDepth();
3469
+ this.startTransformation.push(`{ ${createElement}(`, nodeName, ', {');
3470
+ this.addNameConstDeclaration = () => ((this.startTransformation[0] = `{ const ${this._name} = ${createElement}(`),
3471
+ ', {');
3472
+ break;
3473
+ }
3455
3474
  case 'slot': {
3456
3475
  // If the element is a <slot> tag, create the element with the createSlot-function
3457
3476
  // which is created inside createRenderFunction.ts to check that the name and attributes
@@ -3815,8 +3834,6 @@ const numberOnlyAttributes = new Set([
3815
3834
  'results',
3816
3835
  'volume'
3817
3836
  ]);
3818
- const sapperLinkActions = ['sapper:prefetch', 'sapper:noscroll'];
3819
- const sveltekitLinkActions = ['sveltekit:prefetch', 'sveltekit:noscroll'];
3820
3837
  /**
3821
3838
  * Handle various kinds of attributes and make them conform to being valid in context of a object definition
3822
3839
  * - {x} ---> x
@@ -3878,14 +3895,7 @@ function handleAttribute(str, attr, parent, preserveCase, element) {
3878
3895
  };
3879
3896
  // Handle attribute name
3880
3897
  const attributeName = [];
3881
- if (sapperLinkActions.includes(attr.name) || sveltekitLinkActions.includes(attr.name)) {
3882
- //strip ":" from out attribute name and uppercase the next letter to convert to jsx attribute
3883
- const parts = attr.name.split(':');
3884
- const name = parts[0] + parts[1][0].toUpperCase() + parts[1].substring(1);
3885
- str.overwrite(attr.start, attr.start + attr.name.length, name);
3886
- attributeName.push([attr.start, attr.start + attr.name.length]);
3887
- }
3888
- else if (attributeValueIsOfType(attr.value, 'AttributeShorthand')) {
3898
+ if (attributeValueIsOfType(attr.value, 'AttributeShorthand')) {
3889
3899
  // For the attribute shorthand, the name will be the mapped part
3890
3900
  addAttribute([[attr.value[0].start, attr.value[0].end]]);
3891
3901
  return;
@@ -4387,9 +4397,10 @@ function handleSpread(node, element) {
4387
4397
  */
4388
4398
  function handleStyleDirective(str, style, element) {
4389
4399
  const htmlx = str.original;
4400
+ const ensureType = '__sveltets_2_ensureType(String, Number, ';
4390
4401
  if (style.value === true || style.value.length === 0) {
4391
4402
  element.appendToStartEnd([
4392
- '__sveltets_2_ensureType(String, Number, ',
4403
+ ensureType,
4393
4404
  [htmlx.indexOf(':', style.start) + 1, style.end],
4394
4405
  ');'
4395
4406
  ]);
@@ -4411,11 +4422,7 @@ function handleStyleDirective(str, style, element) {
4411
4422
  str.appendRight(n.start, '$');
4412
4423
  }
4413
4424
  }
4414
- element.appendToStartEnd([
4415
- '__sveltets_2_ensureType(String, Number, `',
4416
- [start, end],
4417
- '`);'
4418
- ]);
4425
+ element.appendToStartEnd([ensureType + '`', [start, end], '`);']);
4419
4426
  return;
4420
4427
  }
4421
4428
  const styleVal = style.value[0];
@@ -4423,15 +4430,11 @@ function handleStyleDirective(str, style, element) {
4423
4430
  const quote = ['"', "'"].includes(str.original[styleVal.start - 1])
4424
4431
  ? str.original[styleVal.start - 1]
4425
4432
  : '"';
4426
- element.appendToStartEnd([
4427
- `__sveltets_2_ensureType(String, Number, ${quote}`,
4428
- [start, end],
4429
- `${quote});`
4430
- ]);
4433
+ element.appendToStartEnd([`${ensureType}${quote}`, [start, end], `${quote});`]);
4431
4434
  }
4432
4435
  else {
4433
4436
  // MustacheTag
4434
- element.appendToStartEnd(['__sveltets_2_ensureType(String, Number, ', [start, end], ');']);
4437
+ element.appendToStartEnd([ensureType, [start, end], ');']);
4435
4438
  }
4436
4439
  }
4437
4440
 
@@ -5675,11 +5678,14 @@ class Scripts {
5675
5678
  // Those have another type ('Element' with name 'script').
5676
5679
  this.scriptTags = this.htmlxAst.children.filter((child) => child.type === 'Script');
5677
5680
  this.topLevelScripts = this.scriptTags;
5678
- this.handleScriptTag = (node, parent) => {
5679
- if (parent !== this.htmlxAst && node.name === 'script') {
5680
- this.topLevelScripts = this.topLevelScripts.filter((tag) => tag.start !== node.start || tag.end !== node.end);
5681
- }
5682
- };
5681
+ }
5682
+ checkIfElementIsScriptTag(node, parent) {
5683
+ if (parent !== this.htmlxAst && node.name === 'script') {
5684
+ this.topLevelScripts = this.topLevelScripts.filter((tag) => tag.start !== node.start || tag.end !== node.end);
5685
+ }
5686
+ }
5687
+ checkIfContainsScriptTag(node) {
5688
+ this.topLevelScripts = this.topLevelScripts.filter((tag) => !(node.start <= tag.start && node.end >= tag.end));
5683
5689
  }
5684
5690
  getTopLevelScriptTags() {
5685
5691
  let scriptTag = null;
@@ -6168,12 +6174,15 @@ class ImplicitTopLevelNames {
6168
6174
  // to `let {a} = b;` produces valid code.
6169
6175
  if (ts__default['default'].isExpressionStatement(node.statement) &&
6170
6176
  isParenthesizedObjectOrArrayLiteralExpression(node.statement.expression)) {
6171
- const start = node.statement.expression.getStart() + this.astOffset;
6172
- this.str.overwrite(start, start + 1, '', { contentOnly: true });
6173
- const end = node.statement.expression.getEnd() + this.astOffset - 1;
6177
+ const parenthesizedExpression = node.statement.expression;
6178
+ const parenthesisStart = parenthesizedExpression.getStart() + this.astOffset;
6179
+ const expressionStart = parenthesizedExpression.expression.getStart() + this.astOffset;
6180
+ this.str.overwrite(parenthesisStart, expressionStart, '', { contentOnly: true });
6181
+ const parenthesisEnd = parenthesizedExpression.getEnd() + this.astOffset;
6182
+ const expressionEnd = parenthesizedExpression.expression.getEnd() + this.astOffset;
6174
6183
  // We need to keep the `)` of the "wrap with invalidate" expression above.
6175
6184
  // We overwrite the same range so it's needed.
6176
- overwriteStr(this.str, end, end + 1, ')', true);
6185
+ overwriteStr(this.str, expressionEnd, parenthesisEnd, ')', true);
6177
6186
  }
6178
6187
  }
6179
6188
  }
@@ -7041,7 +7050,10 @@ function processSvelteTemplate(str, options) {
7041
7050
  handleStyleTag(node);
7042
7051
  break;
7043
7052
  case 'Element':
7044
- scripts.handleScriptTag(node, parent);
7053
+ scripts.checkIfElementIsScriptTag(node, parent);
7054
+ break;
7055
+ case 'RawMustacheTag':
7056
+ scripts.checkIfContainsScriptTag(node);
7045
7057
  break;
7046
7058
  case 'BlockStatement':
7047
7059
  scopeStack.push();
package/index.mjs CHANGED
@@ -1777,7 +1777,11 @@ function handleAttribute$1(htmlx, str, attr, parent, preserveCase) {
1777
1777
  //if we are on an "element" we are case insensitive, lowercase to match our JSX
1778
1778
  if (parent.type == 'Element') {
1779
1779
  const sapperLinkActions = ['sapper:prefetch', 'sapper:noscroll'];
1780
- const sveltekitLinkActions = ['sveltekit:prefetch', 'sveltekit:noscroll'];
1780
+ const sveltekitLinkActions = [
1781
+ 'sveltekit:prefetch',
1782
+ 'sveltekit:noscroll',
1783
+ 'sveltekit:reload'
1784
+ ];
1781
1785
  // skip Attribute shorthand, that is handled below
1782
1786
  if ((attr.value !== true &&
1783
1787
  !(attr.value.length &&
@@ -2781,7 +2785,7 @@ function handleStyleDirective$1(str, style) {
2781
2785
 
2782
2786
  /**
2783
2787
  * `<svelte:window>...</svelte:window>` ----> `<sveltewindow>...</sveltewindow>`
2784
- * (same for :head, :body, :options, :fragment)
2788
+ * (same for :head, :body, :options, :fragment, :element)
2785
2789
  */
2786
2790
  function handleSvelteTag(htmlx, str, node) {
2787
2791
  const colon = htmlx.indexOf(':', node.start);
@@ -3061,6 +3065,9 @@ function convertHtmlxToJsx$1(str, ast, onWalk = null, onLeave = null, options =
3061
3065
  handleComponent(htmlx, str, node, parent, ifScope, templateScopeManager.value);
3062
3066
  break;
3063
3067
  case 'Element':
3068
+ if (node.name === 'svelte:element') {
3069
+ handleSvelteTag(htmlx, str, node);
3070
+ }
3064
3071
  templateScopeManager.componentOrSlotTemplateOrElementEnter(node);
3065
3072
  handleElement(htmlx, str, node, parent, ifScope, templateScopeManager.value);
3066
3073
  break;
@@ -3353,7 +3360,7 @@ var svgAttributes = 'accent-height accumulate additive alignment-baseline allowR
3353
3360
 
3354
3361
  const voidTags = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr'.split(',');
3355
3362
  /**
3356
- * Handles HTML elements as well as svelte:options, svelte:head, svelte:window, svelte:body
3363
+ * Handles HTML elements as well as svelte:options, svelte:head, svelte:window, svelte:body, svelte:element
3357
3364
  *
3358
3365
  * Children of this element should call the methods on this class to add themselves to the correct
3359
3366
  * position within the transformation.
@@ -3422,6 +3429,18 @@ class Element {
3422
3429
  this.addNameConstDeclaration = () => (this.startTransformation[0] = `{ const ${this._name} = ${createElement}("${nodeName}", {`);
3423
3430
  break;
3424
3431
  }
3432
+ case 'svelte:element': {
3433
+ const nodeName = this.node.tag
3434
+ ? typeof this.node.tag !== 'string'
3435
+ ? [this.node.tag.start, this.node.tag.end]
3436
+ : `"${this.node.tag}"`
3437
+ : '""';
3438
+ this._name = '$$_svelteelement' + this.computeDepth();
3439
+ this.startTransformation.push(`{ ${createElement}(`, nodeName, ', {');
3440
+ this.addNameConstDeclaration = () => ((this.startTransformation[0] = `{ const ${this._name} = ${createElement}(`),
3441
+ ', {');
3442
+ break;
3443
+ }
3425
3444
  case 'slot': {
3426
3445
  // If the element is a <slot> tag, create the element with the createSlot-function
3427
3446
  // which is created inside createRenderFunction.ts to check that the name and attributes
@@ -3785,8 +3804,6 @@ const numberOnlyAttributes = new Set([
3785
3804
  'results',
3786
3805
  'volume'
3787
3806
  ]);
3788
- const sapperLinkActions = ['sapper:prefetch', 'sapper:noscroll'];
3789
- const sveltekitLinkActions = ['sveltekit:prefetch', 'sveltekit:noscroll'];
3790
3807
  /**
3791
3808
  * Handle various kinds of attributes and make them conform to being valid in context of a object definition
3792
3809
  * - {x} ---> x
@@ -3848,14 +3865,7 @@ function handleAttribute(str, attr, parent, preserveCase, element) {
3848
3865
  };
3849
3866
  // Handle attribute name
3850
3867
  const attributeName = [];
3851
- if (sapperLinkActions.includes(attr.name) || sveltekitLinkActions.includes(attr.name)) {
3852
- //strip ":" from out attribute name and uppercase the next letter to convert to jsx attribute
3853
- const parts = attr.name.split(':');
3854
- const name = parts[0] + parts[1][0].toUpperCase() + parts[1].substring(1);
3855
- str.overwrite(attr.start, attr.start + attr.name.length, name);
3856
- attributeName.push([attr.start, attr.start + attr.name.length]);
3857
- }
3858
- else if (attributeValueIsOfType(attr.value, 'AttributeShorthand')) {
3868
+ if (attributeValueIsOfType(attr.value, 'AttributeShorthand')) {
3859
3869
  // For the attribute shorthand, the name will be the mapped part
3860
3870
  addAttribute([[attr.value[0].start, attr.value[0].end]]);
3861
3871
  return;
@@ -4357,9 +4367,10 @@ function handleSpread(node, element) {
4357
4367
  */
4358
4368
  function handleStyleDirective(str, style, element) {
4359
4369
  const htmlx = str.original;
4370
+ const ensureType = '__sveltets_2_ensureType(String, Number, ';
4360
4371
  if (style.value === true || style.value.length === 0) {
4361
4372
  element.appendToStartEnd([
4362
- '__sveltets_2_ensureType(String, Number, ',
4373
+ ensureType,
4363
4374
  [htmlx.indexOf(':', style.start) + 1, style.end],
4364
4375
  ');'
4365
4376
  ]);
@@ -4381,11 +4392,7 @@ function handleStyleDirective(str, style, element) {
4381
4392
  str.appendRight(n.start, '$');
4382
4393
  }
4383
4394
  }
4384
- element.appendToStartEnd([
4385
- '__sveltets_2_ensureType(String, Number, `',
4386
- [start, end],
4387
- '`);'
4388
- ]);
4395
+ element.appendToStartEnd([ensureType + '`', [start, end], '`);']);
4389
4396
  return;
4390
4397
  }
4391
4398
  const styleVal = style.value[0];
@@ -4393,15 +4400,11 @@ function handleStyleDirective(str, style, element) {
4393
4400
  const quote = ['"', "'"].includes(str.original[styleVal.start - 1])
4394
4401
  ? str.original[styleVal.start - 1]
4395
4402
  : '"';
4396
- element.appendToStartEnd([
4397
- `__sveltets_2_ensureType(String, Number, ${quote}`,
4398
- [start, end],
4399
- `${quote});`
4400
- ]);
4403
+ element.appendToStartEnd([`${ensureType}${quote}`, [start, end], `${quote});`]);
4401
4404
  }
4402
4405
  else {
4403
4406
  // MustacheTag
4404
- element.appendToStartEnd(['__sveltets_2_ensureType(String, Number, ', [start, end], ');']);
4407
+ element.appendToStartEnd([ensureType, [start, end], ');']);
4405
4408
  }
4406
4409
  }
4407
4410
 
@@ -5645,11 +5648,14 @@ class Scripts {
5645
5648
  // Those have another type ('Element' with name 'script').
5646
5649
  this.scriptTags = this.htmlxAst.children.filter((child) => child.type === 'Script');
5647
5650
  this.topLevelScripts = this.scriptTags;
5648
- this.handleScriptTag = (node, parent) => {
5649
- if (parent !== this.htmlxAst && node.name === 'script') {
5650
- this.topLevelScripts = this.topLevelScripts.filter((tag) => tag.start !== node.start || tag.end !== node.end);
5651
- }
5652
- };
5651
+ }
5652
+ checkIfElementIsScriptTag(node, parent) {
5653
+ if (parent !== this.htmlxAst && node.name === 'script') {
5654
+ this.topLevelScripts = this.topLevelScripts.filter((tag) => tag.start !== node.start || tag.end !== node.end);
5655
+ }
5656
+ }
5657
+ checkIfContainsScriptTag(node) {
5658
+ this.topLevelScripts = this.topLevelScripts.filter((tag) => !(node.start <= tag.start && node.end >= tag.end));
5653
5659
  }
5654
5660
  getTopLevelScriptTags() {
5655
5661
  let scriptTag = null;
@@ -6138,12 +6144,15 @@ class ImplicitTopLevelNames {
6138
6144
  // to `let {a} = b;` produces valid code.
6139
6145
  if (ts__default.isExpressionStatement(node.statement) &&
6140
6146
  isParenthesizedObjectOrArrayLiteralExpression(node.statement.expression)) {
6141
- const start = node.statement.expression.getStart() + this.astOffset;
6142
- this.str.overwrite(start, start + 1, '', { contentOnly: true });
6143
- const end = node.statement.expression.getEnd() + this.astOffset - 1;
6147
+ const parenthesizedExpression = node.statement.expression;
6148
+ const parenthesisStart = parenthesizedExpression.getStart() + this.astOffset;
6149
+ const expressionStart = parenthesizedExpression.expression.getStart() + this.astOffset;
6150
+ this.str.overwrite(parenthesisStart, expressionStart, '', { contentOnly: true });
6151
+ const parenthesisEnd = parenthesizedExpression.getEnd() + this.astOffset;
6152
+ const expressionEnd = parenthesizedExpression.expression.getEnd() + this.astOffset;
6144
6153
  // We need to keep the `)` of the "wrap with invalidate" expression above.
6145
6154
  // We overwrite the same range so it's needed.
6146
- overwriteStr(this.str, end, end + 1, ')', true);
6155
+ overwriteStr(this.str, expressionEnd, parenthesisEnd, ')', true);
6147
6156
  }
6148
6157
  }
6149
6158
  }
@@ -7011,7 +7020,10 @@ function processSvelteTemplate(str, options) {
7011
7020
  handleStyleTag(node);
7012
7021
  break;
7013
7022
  case 'Element':
7014
- scripts.handleScriptTag(node, parent);
7023
+ scripts.checkIfElementIsScriptTag(node, parent);
7024
+ break;
7025
+ case 'RawMustacheTag':
7026
+ scripts.checkIfContainsScriptTag(node);
7015
7027
  break;
7016
7028
  case 'BlockStatement':
7017
7029
  scopeStack.push();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte2tsx",
3
- "version": "0.5.6",
3
+ "version": "0.5.9",
4
4
  "description": "Convert Svelte components to TSX for type checking",
5
5
  "author": "David Pershouse",
6
6
  "license": "MIT",
@@ -22,19 +22,19 @@
22
22
  "@rollup/plugin-json": "^4.0.0",
23
23
  "@rollup/plugin-node-resolve": "^9.0.0",
24
24
  "@rollup/plugin-typescript": "^6.0.0",
25
- "@types/mocha": "^5.2.7",
25
+ "@types/mocha": "^9.1.0",
26
26
  "@types/node": "^8.10.53",
27
27
  "@types/unist": "^2.0.3",
28
28
  "@types/vfile": "^3.0.2",
29
29
  "magic-string": "^0.25.7",
30
- "mocha": "^9.0.0",
30
+ "mocha": "^9.2.0",
31
31
  "periscopic": "^2.0.2",
32
32
  "rollup": "2.52.7",
33
33
  "rollup-plugin-delete": "^2.0.0",
34
34
  "source-map": "^0.6.1",
35
35
  "source-map-support": "^0.5.16",
36
36
  "sourcemap-codec": "^1.4.8",
37
- "svelte": "~3.46.1",
37
+ "svelte": "~3.47.0",
38
38
  "tiny-glob": "^0.2.6",
39
39
  "tslib": "^1.10.0",
40
40
  "typescript": "^4.6.2"
package/svelte-jsx.d.ts CHANGED
@@ -11,11 +11,12 @@ declare namespace svelteHTML {
11
11
  ): SVGElementTagNameMap[K];
12
12
  function mapElementTag(
13
13
  tag: any
14
- ): HTMLElement;
14
+ ): any; // needs to be any because used in context of <svelte:element>
15
15
 
16
16
  function createElement<Elements extends IntrinsicElements, Key extends keyof Elements>(
17
- element: Key, attrs: Elements[Key]
18
- ): Key extends keyof ElementTagNameMap ? ElementTagNameMap[Key] : Key extends keyof SVGElementTagNameMap ? SVGElementTagNameMap[Key] : HTMLElement;
17
+ // "undefined | null" because of <svelte:element>
18
+ element: Key | undefined | null, attrs: Elements[Key]
19
+ ): Key extends keyof ElementTagNameMap ? ElementTagNameMap[Key] : Key extends keyof SVGElementTagNameMap ? SVGElementTagNameMap[Key] : any;
19
20
 
20
21
 
21
22
  type NativeElement = HTMLElement;
@@ -98,11 +99,16 @@ declare namespace svelteHTML {
98
99
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
99
100
  interface SvelteWindowProps extends svelte.JSX.SvelteWindowProps {}
100
101
 
101
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
102
- interface SapperAnchorProps extends svelte.JSX.SapperAnchorProps {}
103
-
104
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
105
- interface SvelteKitAnchorProps extends svelte.JSX.SvelteKitAnchorProps {}
102
+ interface SapperAnchorProps {
103
+ "sapper:noscroll"?: true | undefined | null;
104
+ "sapper:prefetch"?: true | undefined | null;
105
+ }
106
+
107
+ interface SvelteKitAnchorProps {
108
+ "sveltekit:noscroll"?: true | undefined | null;
109
+ "sveltekit:prefetch"?: true | undefined | null;
110
+ "sveltekit:reload"?: true | undefined | null;
111
+ }
106
112
 
107
113
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
108
114
  interface SvelteMediaTimeRange extends svelte.JSX.SvelteMediaTimeRange {}
@@ -819,6 +825,7 @@ declare namespace svelte.JSX {
819
825
  pattern?: string | undefined | null;
820
826
  placeholder?: string | undefined | null;
821
827
  playsinline?: boolean | undefined | null;
828
+ ping?: string | undefined | null;
822
829
  poster?: string | undefined | null;
823
830
  preload?: string | undefined | null;
824
831
  radiogroup?: string | undefined | null;
@@ -1230,6 +1237,7 @@ declare namespace svelte.JSX {
1230
1237
  // transformed from sveltekit:noscroll so it should be camel case
1231
1238
  sveltekitNoscroll?: true | undefined | null;
1232
1239
  sveltekitPrefetch?: true | undefined | null;
1240
+ sveltekitReload?: true | undefined | null;
1233
1241
  }
1234
1242
 
1235
1243
  interface SvelteMediaTimeRange {
@@ -1447,6 +1455,7 @@ declare namespace svelte.JSX {
1447
1455
  sveltefragment: { slot?: string; };
1448
1456
  svelteoptions: { [name: string]: any };
1449
1457
  sveltehead: { [name: string]: any };
1458
+ svelteelement: { 'this': string | undefined | null; } & HTMLProps<any> & SVGProps<any>;
1450
1459
 
1451
1460
  [name: string]: { [name: string]: any };
1452
1461
  }
package/svelte-shims.d.ts CHANGED
@@ -3,9 +3,11 @@
3
3
  // are loaded and their declarations conflict each other
4
4
  // See https://github.com/sveltejs/language-tools/issues/1059 for an example bug that stems from it
5
5
 
6
+ // -- start svelte-ls-remove --
6
7
  declare module '*.svelte' {
7
8
  export default Svelte2TsxComponent
8
9
  }
10
+ // -- end svelte-ls-remove --
9
11
 
10
12
  declare class Svelte2TsxComponent<
11
13
  Props extends {} = {},
@@ -119,8 +121,10 @@ declare function __sveltets_1_ensureAnimation(animationCall: SvelteAnimationRetu
119
121
  declare function __sveltets_1_ensureAction(actionCall: SvelteActionReturnType): {};
120
122
  declare function __sveltets_1_ensureTransition(transitionCall: SvelteTransitionReturnType): {};
121
123
  declare function __sveltets_1_ensureFunction(expression: (e: Event & { detail?: any }) => unknown ): {};
122
- declare function __sveltets_1_ensureType<T>(type: AConstructorTypeOf<T>, el: T): {};
123
- declare function __sveltets_1_ensureType<T1, T2>(type1: AConstructorTypeOf<T1>, type2: AConstructorTypeOf<T2>, el: T1 | T2): {};
124
+ // Includes undefined and null for all types as all usages also allow these
125
+ declare function __sveltets_1_ensureType<T>(type: AConstructorTypeOf<T>, el: T | undefined | null): {};
126
+ declare function __sveltets_1_ensureType<T1, T2>(type1: AConstructorTypeOf<T1>, type2: AConstructorTypeOf<T2>, el: T1 | T2 | undefined | null): {};
127
+
124
128
  declare function __sveltets_1_createEnsureSlot<Slots = Record<string, Record<string, any>>>(): <K1 extends keyof Slots, K2 extends keyof Slots[K1]>(k1: K1, k2: K2, val: Slots[K1][K2]) => Slots[K1][K2];
125
129
  declare function __sveltets_1_ensureRightProps<Props>(props: Props): {};
126
130
  declare function __sveltets_1_cssProp(prop: Record<string, any>): {};
@@ -183,7 +187,7 @@ declare function __sveltets_1_mapElementTag<K extends keyof SVGElementTagNameMap
183
187
  ): SVGElementTagNameMap[K];
184
188
  declare function __sveltets_1_mapElementTag(
185
189
  tag: any
186
- ): HTMLElement;
190
+ ): any; // needs to be any because used in context of <svelte:element>
187
191
 
188
192
  declare function __sveltets_1_bubbleEventDef<Events, K extends keyof Events>(
189
193
  events: Events, eventKey: K
@@ -253,8 +257,9 @@ type __sveltets_2_SvelteTransitionConfig = {
253
257
  type __sveltets_2_SvelteTransitionReturnType = __sveltets_2_SvelteTransitionConfig | (() => __sveltets_2_SvelteTransitionConfig)
254
258
  declare function __sveltets_2_ensureTransition(transitionCall: __sveltets_2_SvelteTransitionReturnType): {};
255
259
 
256
- declare function __sveltets_2_ensureType<T>(type: AConstructorTypeOf<T>, el: T): {};
257
- declare function __sveltets_2_ensureType<T1, T2>(type1: AConstructorTypeOf<T1>, type2: AConstructorTypeOf<T2>, el: T1 | T2): {};
260
+ // Includes undefined and null for all types as all usages also allow these
261
+ declare function __sveltets_2_ensureType<T>(type: AConstructorTypeOf<T>, el: T | undefined | null): {};
262
+ declare function __sveltets_2_ensureType<T1, T2>(type1: AConstructorTypeOf<T1>, type2: AConstructorTypeOf<T2>, el: T1 | T2 | undefined | null): {};
258
263
 
259
264
  // The following is necessary because there are two clashing errors that can't be solved at the same time
260
265
  // when using Svelte2TsxComponent, more precisely the event typings in