-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
489 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default { | ||
options: { | ||
generate: 'ssr', | ||
dev: true | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
var { debug, each, escape } = require("svelte/shared.js"); | ||
|
||
var SvelteComponent = {}; | ||
SvelteComponent.data = function() { | ||
return {}; | ||
}; | ||
|
||
SvelteComponent.render = function(state, options = {}) { | ||
var components = new Set(); | ||
|
||
function addComponent(component) { | ||
components.add(component); | ||
} | ||
|
||
var result = { head: '', addComponent }; | ||
var html = SvelteComponent._render(result, state, options); | ||
|
||
var cssCode = Array.from(components).map(c => c.css && c.css.code).filter(Boolean).join('\n'); | ||
|
||
return { | ||
html, | ||
head: result.head, | ||
css: { code: cssCode, map: null }, | ||
toString() { | ||
return html; | ||
} | ||
}; | ||
}; | ||
|
||
SvelteComponent._render = function(__result, ctx, options) { | ||
__result.addComponent(SvelteComponent); | ||
|
||
ctx = Object.assign({}, ctx); | ||
|
||
return `${ each(ctx.things, item => Object.assign({}, ctx, { thing: item }), ctx => `<span>${escape(ctx.thing.name)}</span> | ||
${debug(null, 2, 2, { foo: ctx.foo })}`)} | ||
<p>foo: ${escape(ctx.foo)}</p>`; | ||
}; | ||
|
||
SvelteComponent.css = { | ||
code: '', | ||
map: null | ||
}; | ||
|
||
module.exports = SvelteComponent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
"use strict"; | ||
|
||
var { debug, each, escape } = require("svelte/shared.js"); | ||
|
||
var SvelteComponent = {};; | ||
|
||
SvelteComponent.data = function() { | ||
return {}; | ||
}; | ||
|
||
SvelteComponent.render = function(state, options = {}) { | ||
var components = new Set(); | ||
|
||
function addComponent(component) { | ||
components.add(component); | ||
} | ||
|
||
var result = { head: '', addComponent }; | ||
var html = SvelteComponent._render(result, state, options); | ||
|
||
var cssCode = Array.from(components).map(c => c.css && c.css.code).filter(Boolean).join('\n'); | ||
|
||
return { | ||
html, | ||
head: result.head, | ||
css: { code: cssCode, map: null }, | ||
toString() { | ||
return html; | ||
} | ||
}; | ||
} | ||
|
||
SvelteComponent._render = function(__result, ctx, options) { | ||
__result.addComponent(SvelteComponent); | ||
|
||
ctx = Object.assign({}, ctx); | ||
|
||
return `${ each(ctx.things, item => Object.assign({}, ctx, { thing: item }), ctx => `<span>${escape(ctx.thing.name)}</span> | ||
${debug(null, 2, 2, { foo: ctx.foo })}`)} | ||
<p>foo: ${escape(ctx.foo)}</p>`; | ||
}; | ||
|
||
SvelteComponent.css = { | ||
code: '', | ||
map: null | ||
}; | ||
|
||
var warned = false; | ||
|
||
module.exports = SvelteComponent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{#each things as thing} | ||
<span>{thing.name}</span> | ||
{@debug foo} | ||
{/each} | ||
|
||
<p>foo: {foo}</p> |
Oops, something went wrong.