Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/svelte2tsx/src/htmlxtojsx_v2/nodes/Element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ export class Element {
// remove the colon: svelte:xxx -> sveltexxx
const nodeName = `svelte${this.node.name.substring(7)}`;
this._name = '$$_' + nodeName + this.computeDepth();
this.startTransformation.push(`{ ${createElement}("${nodeName}", {`);
this.startTransformation.push(`{ ${createElement}("${this.node.name}", {`);
this.addNameConstDeclaration = () =>
(this.startTransformation[0] = `{ const ${this._name} = ${createElement}("${nodeName}", {`);
(this.startTransformation[0] = `{ const ${this._name} = ${createElement}("${this.node.name}", {`);
break;
}
case 'svelte:element': {
Expand Down
10 changes: 5 additions & 5 deletions packages/svelte2tsx/svelte-jsx.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,11 @@ declare namespace svelteHTML {
view: SVGProps<SVGViewElement>;

// Svelte specific
sveltewindow: HTMLProps<Window> & SvelteWindowProps;
sveltebody: HTMLProps<HTMLElement>;
sveltefragment: { slot?: string; };
svelteoptions: { [name: string]: any };
sveltehead: { [name: string]: any };
'svelte:window': HTMLProps<Window> & SvelteWindowProps;
'svelte:body': HTMLProps<HTMLElement>;
'svelte:fragment': { slot?: string; };
'svelte:options': { [name: string]: any };
'svelte:head': { [name: string]: any };

[name: string]: { [name: string]: any };
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ const $$_sveltebody0 = svelteHTML.createElement("sveltebody", { });element = $$_sveltebody0;}
{ const $$_sveltebody0 = svelteHTML.createElement("svelte:body", { });element = $$_sveltebody0;}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if(hello && hello1){
hello;
}
}Comp}
{const {/*Ωignore_startΩ*/$$_$$/*Ωignore_endΩ*/,hello,} = $$_Comp0.$$slot_def["named1"];$$_$$;{ svelteHTML.createElement("sveltefragment", { });
{const {/*Ωignore_startΩ*/$$_$$/*Ωignore_endΩ*/,hello,} = $$_Comp0.$$slot_def["named1"];$$_$$;{ svelteHTML.createElement("svelte:fragment", { });
if(hello){
hello;
}
Expand Down Expand Up @@ -67,7 +67,7 @@ if(hello && hello1){
}else{
hello; bye;
}
{const {/*Ωignore_startΩ*/$$_$$/*Ωignore_endΩ*/,hello,} = $$_Comp0.$$slot_def["named1"];$$_$$;{ svelteHTML.createElement("sveltefragment", { });
{const {/*Ωignore_startΩ*/$$_$$/*Ωignore_endΩ*/,hello,} = $$_Comp0.$$slot_def["named1"];$$_$$;{ svelteHTML.createElement("svelte:fragment", { });
if(hello && bye){
hello; bye;
} else if (hello && bye){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{ const $$_Component0C = __sveltets_2_ensureComponent(Component); const $$_Component0 = new $$_Component0C({ target: __sveltets_2_any(), props: {}});
{ svelteHTML.createElement("sveltefragment", {});
{ svelteHTML.createElement("svelte:fragment", {});
{ svelteHTML.createElement("p", {}); }
}

{const {/*Ωignore_startΩ*/$$_$$/*Ωignore_endΩ*/,} = $$_Component0.$$slot_def["named"];$$_$$;{ svelteHTML.createElement("sveltefragment", { });
{const {/*Ωignore_startΩ*/$$_$$/*Ωignore_endΩ*/,} = $$_Component0.$$slot_def["named"];$$_$$;{ svelteHTML.createElement("svelte:fragment", { });
{ svelteHTML.createElement("p", {}); }
}}
Component}

{ const $$_Component0C = __sveltets_2_ensureComponent(Component); const $$_Component0 = new $$_Component0C({ target: __sveltets_2_any(), props: {}});
{const {/*Ωignore_startΩ*/$$_$$/*Ωignore_endΩ*/,foo,bar:baz,} = $$_Component0.$$slot_def.default;$$_$$;{ svelteHTML.createElement("sveltefragment", { });
{const {/*Ωignore_startΩ*/$$_$$/*Ωignore_endΩ*/,foo,bar:baz,} = $$_Component0.$$slot_def.default;$$_$$;{ svelteHTML.createElement("svelte:fragment", { });
{ svelteHTML.createElement("p", {});foo; baz; }
}}

{const {/*Ωignore_startΩ*/$$_$$/*Ωignore_endΩ*/,foo,bar:baz,} = $$_Component0.$$slot_def["named"];$$_$$;{ svelteHTML.createElement("sveltefragment", { });
{const {/*Ωignore_startΩ*/$$_$$/*Ωignore_endΩ*/,foo,bar:baz,} = $$_Component0.$$slot_def["named"];$$_$$;{ svelteHTML.createElement("svelte:fragment", { });
{ svelteHTML.createElement("p", {});foo; baz; }
}}
Component}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{ svelteHTML.createElement("sveltehead", {});
{ svelteHTML.createElement("svelte:head", {});
{ svelteHTML.createElement("title", {}); }
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

let foo: number = undefined/*Ωignore_startΩ*/;foo = __sveltets_1_any(foo);/*Ωignore_endΩ*/;
;
async () => { { svelteHTML.createElement("svelteoptions", { "accessors":false,});}
async () => { { svelteHTML.createElement("svelte:options", { "accessors":false,});}
};
return { props: {foo: foo}, slots: {}, getters: {}, events: {} }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ function render() {
async () => {

{ const $$_Component0C = __sveltets_2_ensureComponent(Component); const $$_Component0 = new $$_Component0C({ target: __sveltets_2_any(), props: {box,}});
{const {/*Ωignore_startΩ*/$$_$$/*Ωignore_endΩ*/,box,} = $$_Component0.$$slot_def["box1"];$$_$$;{ svelteHTML.createElement("sveltefragment", { });
{const {/*Ωignore_startΩ*/$$_$$/*Ωignore_endΩ*/,box,} = $$_Component0.$$slot_def["box1"];$$_$$;{ svelteHTML.createElement("svelte:fragment", { });
const {area, volume} = calculate(box.width, box.height, constant);
const perimeter = (box.width + box.height) * constant;
const [width, height, sum] = [box.width * constant, box.height, box.width * constant + box.height];
{ svelteHTML.createElement("div", {});area; volume; perimeter; width; height; sum; }
}}

{const {/*Ωignore_startΩ*/$$_$$/*Ωignore_endΩ*/,width,height,} = $$_Component0.$$slot_def["box2"];$$_$$;{ svelteHTML.createElement("sveltefragment", { });
{const {/*Ωignore_startΩ*/$$_$$/*Ωignore_endΩ*/,width,height,} = $$_Component0.$$slot_def["box2"];$$_$$;{ svelteHTML.createElement("svelte:fragment", { });
const {area, volume} = calculate(width, height, constant);
const perimeter = (width + height) * constant;
const [_width, _height, sum] = [width * constant, height, width * constant + height];
{ svelteHTML.createElement("div", {});area; volume; perimeter; _width; _height; sum; }
}}

{const {/*Ωignore_startΩ*/$$_$$/*Ωignore_endΩ*/,box:{width, height},} = $$_Component0.$$slot_def.default;$$_$$;{ svelteHTML.createElement("sveltefragment", { });
{const {/*Ωignore_startΩ*/$$_$$/*Ωignore_endΩ*/,box:{width, height},} = $$_Component0.$$slot_def.default;$$_$$;{ svelteHTML.createElement("svelte:fragment", { });
const {area, volume} = calculate(width, height, constant);
const perimeter = (width + height) * constant;
const [_width, _height, sum] = [width * constant, height, width * constant + height];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
///<reference types="svelte" />
;function render() {
async () => { { svelteHTML.createElement("sveltebody", { "onclick":undefined,}); }
{ svelteHTML.createElement("sveltewindow", { "onresize":undefined,}); }};
async () => { { svelteHTML.createElement("svelte:body", { "onclick":undefined,}); }
{ svelteHTML.createElement("svelte:window", { "onresize":undefined,}); }};
return { props: {}, slots: {}, getters: {}, events: {'click':__sveltets_1_mapBodyEvent('click'), 'resize':__sveltets_1_mapWindowEvent('resize')} }}

export default class Input__SvelteComponent_ extends __sveltets_1_createSvelte2TsxComponent(__sveltets_1_partial(__sveltets_1_with_any_event(render()))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ async () => { { svelteHTML.createElement("div", {});



{ svelteHTML.createElement("sveltehead", {});
{ svelteHTML.createElement("svelte:head", {});
{ svelteHTML.createElement("link", { "rel":`stylesheet`,"href":`/lib/jodit.es2018.min.css`,});}

}};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
let foo: number = undefined/*Ωignore_startΩ*/;foo = __sveltets_1_any(foo);/*Ωignore_endΩ*/
const bar: string = ''
;
async () => { { svelteHTML.createElement("svelteoptions", {});}
async () => { { svelteHTML.createElement("svelte:options", {});}
};
return { props: {foo: foo , bar: bar}, slots: {}, getters: {bar: bar}, events: {} }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

const bar: string = ''
;
async () => { { svelteHTML.createElement("svelteoptions", {"accessors":true,});}
async () => { { svelteHTML.createElement("svelte:options", {"accessors":true,});}
};
return { props: {foo: foo , foo2: foo2 , class: clazz , bar: bar}, slots: {}, getters: {bar: bar}, events: {} }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
let foo: number = undefined/*Ωignore_startΩ*/;foo = __sveltets_1_any(foo);/*Ωignore_endΩ*/
const bar: string = ''
;
async () => { { svelteHTML.createElement("svelteoptions", { "accessors":false,});}
async () => { { svelteHTML.createElement("svelte:options", { "accessors":false,});}
};
return { props: {foo: foo , bar: bar}, slots: {}, getters: {bar: bar}, events: {} }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

const bar: string = ''
;
async () => { { svelteHTML.createElement("svelteoptions", { "accessors":true,});}
async () => { { svelteHTML.createElement("svelte:options", { "accessors":true,});}
};
return { props: {foo: foo , foo2: foo2 , class: clazz , bar: bar}, slots: {}, getters: {bar: bar}, events: {} }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ async () => {if(true){
{ const $$_svelte_component0C = __sveltets_2_ensureComponent(testComponent); new $$_svelte_component0C({ target: __sveltets_2_any(), props: { "propa":5,}});
{ svelteHTML.createElement("h1", {}); }
}
{ svelteHTML.createElement("sveltewindow", { "onclick":e => {},});}
{ svelteHTML.createElement("sveltebody", { "onclick":e => {},});}
{ svelteHTML.createElement("sveltehead", {});
{ svelteHTML.createElement("svelte:window", { "onclick":e => {},});}
{ svelteHTML.createElement("svelte:body", { "onclick":e => {},});}
{ svelteHTML.createElement("svelte:head", {});
{ svelteHTML.createElement("h1", {}); }
}
{ svelteHTML.createElement("svelteoptions", {});}
{ svelteHTML.createElement("sveltefragment", {});}};
{ svelteHTML.createElement("svelte:options", {});}
{ svelteHTML.createElement("svelte:fragment", {});}};
return { props: {}, slots: {}, getters: {}, events: {} }}

export default class Input__SvelteComponent_ extends __sveltets_1_createSvelte2TsxComponent(__sveltets_1_partial(__sveltets_1_with_any_event(render()))) {
Expand Down