Merge branch 'master' into gh-3624

pull/3625/head
Jacob Wright 6 years ago
commit 655f80177c

@ -1,8 +1,12 @@
**/_actual.js **/_actual.js
**/expected.js **/expected.js
_output
test/*/samples/*/output.js test/*/samples/*/output.js
node_modules node_modules
# automatically generated
internal_exports.ts
# output files # output files
animate/*.js animate/*.js
esing/*.js esing/*.js

@ -22,14 +22,7 @@ module.exports = {
'arrow-spacing': 2, 'arrow-spacing': 2,
'no-inner-declarations': 0, 'no-inner-declarations': 0,
'require-atomic-updates': 'off', 'require-atomic-updates': 'off',
'@typescript-eslint/indent': [ '@typescript-eslint/indent': 'off',
'error',
'tab',
{
SwitchCase: 1,
ignoredNodes: ['TemplateLiteral']
}
],
'@typescript-eslint/camelcase': 'off', '@typescript-eslint/camelcase': 'off',
'@typescript-eslint/no-use-before-define': 'off', '@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/array-type': ['error', 'array-simple'], '@typescript-eslint/array-type': ['error', 'array-simple'],
@ -42,13 +35,9 @@ module.exports = {
argsIgnorePattern: '^_' argsIgnorePattern: '^_'
} }
], ],
'@typescript-eslint/no-object-literal-type-assertion': [ '@typescript-eslint/no-object-literal-type-assertion': 'off',
'error', '@typescript-eslint/no-unused-vars': 'off',
{ '@typescript-eslint/prefer-interface': 'off'
allowAsParameter: true
}
],
'@typescript-eslint/no-unused-vars': 'off'
}, },
globals: { globals: {
globalThis: false globalThis: false

@ -13,6 +13,19 @@ jobs:
- uses: actions/setup-node@v1 - uses: actions/setup-node@v1
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
- run: 'npm i && npm test' - run: npm install
- run: npm test
env: env:
CI: true CI: true
Lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- run: 'npm i && npm run lint'
Unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- run: 'npm i && npm run test:unit'

5
.gitignore vendored

@ -16,12 +16,14 @@ node_modules
/scratch/ /scratch/
/coverage/ /coverage/
/coverage.lcov /coverage.lcov
/test/*/samples/_
/test/sourcemaps/samples/*/output.js /test/sourcemaps/samples/*/output.js
/test/sourcemaps/samples/*/output.js.map /test/sourcemaps/samples/*/output.js.map
/test/sourcemaps/samples/*/output.css /test/sourcemaps/samples/*/output.css
/test/sourcemaps/samples/*/output.css.map /test/sourcemaps/samples/*/output.css.map
/yarn-error.log /yarn-error.log
_actual*.* _actual*.*
_output
/types /types
/site/cypress/screenshots/ /site/cypress/screenshots/
@ -31,5 +33,8 @@ _actual*.*
/site/static/svelte-app.json /site/static/svelte-app.json
/site/static/contributors.jpg /site/static/contributors.jpg
/site/static/workers /site/static/workers
/site/static/organisations
/site/scripts/svelte-app /site/scripts/svelte-app
/site/scripts/community
/site/src/routes/_contributors.js /site/src/routes/_contributors.js
/site/src/routes/_components/WhosUsingSvelte.svelte

@ -1,3 +0,0 @@
useTabs: true
singleQuote: true
trailingComma: es5

@ -2,7 +2,197 @@
## Unreleased ## Unreleased
* Exclude global variables from `$capture_state` ([#4463](https://github.com/sveltejs/svelte/issues/4463))
## 3.19.1
* Do not treat modifications to `$$props` as updates to a store called `$props` ([#4368](https://github.com/sveltejs/svelte/issues/4368))
* Deconflict `value` parameter name used in contextual bindings ([#4445](https://github.com/sveltejs/svelte/issues/4445))
* Fix dev mode validation of `{#each}` blocks using strings ([#4450](https://github.com/sveltejs/svelte/issues/4450))
## 3.19.0
* Fix indirect bindings involving elements with spreads ([#3680](https://github.com/sveltejs/svelte/issues/3680))
* `$capture_state`/`$inject_state` now act on the component's entire state, rather than its props ([#3822](https://github.com/sveltejs/svelte/pull/3822))
* Warn when using `<Foo/>` and `Foo` is dynamic ([#4331](https://github.com/sveltejs/svelte/issues/4331))
* Display compilation warnings in `svelte/register` in dev mode ([#4364](https://github.com/sveltejs/svelte/issues/4364))
* Fix unneeded updating of keyed each blocks ([#4373](https://github.com/sveltejs/svelte/issues/4373))
* Throw runtime error in dev mode for non-array-like values in `{#each}` blocks ([#4408](https://github.com/sveltejs/svelte/issues/4408))
## 3.18.2
* Fix binding to module-level variables ([#4086](https://github.com/sveltejs/svelte/issues/4086))
* Improve parsing error messages when there is a pending unclosed tag ([#4131](https://github.com/sveltejs/svelte/issues/4131))
* Disallow attribute/prop names from matching two-way-bound names or `{shorthand}` attribute/prop names ([#4325](https://github.com/sveltejs/svelte/issues/4325))
* Improve performance of `flush()` by not using `.shift()` ([#4356](https://github.com/sveltejs/svelte/pull/4356))
* Permit reserved keywords as destructuring keys in `{#each}` ([#4372](https://github.com/sveltejs/svelte/issues/4372))
* Disallow reserved keywords in `{expressions}` ([#4372](https://github.com/sveltejs/svelte/issues/4372))
* Fix code generation error with precedence of arrow functions ([#4384](https://github.com/sveltejs/svelte/issues/4384))
* Fix event handlers that are dynamic via reactive declarations or stores ([#4388](https://github.com/sveltejs/svelte/issues/4388))
* Fix invalidation in expressions like `++foo.bar` ([#4393](https://github.com/sveltejs/svelte/issues/4393))
## 3.18.1
* Fix code generation error with adjacent inline and block comments ([#4312](https://github.com/sveltejs/svelte/issues/4312))
* Fix detection of unused CSS selectors that begin with a `:global()` but contain a scoped portion ([#4314](https://github.com/sveltejs/svelte/issues/4314))
## 3.18.0
* Fix infinite loop when instantiating another component during `onMount` ([#3218](https://github.com/sveltejs/svelte/issues/3218))
* Make autosubscribing to a nullish store a no-op ([#2181](https://github.com/sveltejs/svelte/issues/2181))
## 3.17.3
* Fix updating a `<slot>` inside an `{#if}` or other block ([#4292](https://github.com/sveltejs/svelte/issues/4292))
* Fix using RxJS observables in `derived` stores ([#4298](https://github.com/sveltejs/svelte/issues/4298))
* Add dev mode check to disallow duplicate keys in a keyed `{#each}` ([#4301](https://github.com/sveltejs/svelte/issues/4301))
* Fix hydration of `<title>` when starting from SSR-generated code with `hydratable: true` ([#4310](https://github.com/sveltejs/svelte/issues/4310))
## 3.17.2
* Fix removing attributes during hydration ([#1733](https://github.com/sveltejs/svelte/issues/1733))
* Disallow two-way binding to a variable declared by an `{#await}` block ([#4012](https://github.com/sveltejs/svelte/issues/4012))
* Allow access to `let:` variables in sibling attributes on slot root ([#4173](https://github.com/sveltejs/svelte/issues/4173))
* Fix `~=` and class selector matching against values separated by any whitespace characters ([#4242](https://github.com/sveltejs/svelte/issues/4242))
* Fix code generation for `await`ed expressions that need parentheses ([#4267](https://github.com/sveltejs/svelte/issues/4267))
* Preserve JavaScript comments from the original component source where possible ([#4268](https://github.com/sveltejs/svelte/issues/4268))
* Add some more known globals ([#4276](https://github.com/sveltejs/svelte/pull/4276))
* Correctly apply event modifiers to `<svelte:body>` events ([#4278](https://github.com/sveltejs/svelte/issues/4278))
## 3.17.1
* Only attach SSR mode markers to a component's `<head>` elements when compiling with `hydratable: true` ([#4258](https://github.com/sveltejs/svelte/issues/4258))
## 3.17.0
* Remove old `<head>` elements during hydration so they aren't duplicated ([#1607](https://github.com/sveltejs/svelte/issues/1607))
* Prevent text input cursor jumping in Safari with one-way binding ([#3449](https://github.com/sveltejs/svelte/issues/3449))
* Expose compiler version in dev events ([#4047](https://github.com/sveltejs/svelte/issues/4047))
* Don't run actions before their element is in the document ([#4166](https://github.com/sveltejs/svelte/issues/4166))
* Fix reactive assignments with destructuring and stores where the destructured value should be undefined ([#4170](https://github.com/sveltejs/svelte/issues/4170))
* Fix hydrating `{:else}` in `{#each}` ([#4202](https://github.com/sveltejs/svelte/issues/4202))
* Do not automatically declare variables in reactive declarations when assigning to a member expression ([#4212](https://github.com/sveltejs/svelte/issues/4212))
* Fix stringifying of attributes in SSR mode when there are spread attributes ([#4240](https://github.com/sveltejs/svelte/issues/4240))
* Only render one `<title>` in SSR mode when multiple components provide one ([#4250](https://github.com/sveltejs/svelte/pull/4250))
## 3.16.7
* Also apply actions in the order they're given along with other directives ([#2446](https://github.com/sveltejs/svelte/issues/2446), [#4156](https://github.com/sveltejs/svelte/pull/4156))
* Check whether a dynamic event handler is a function before calling it ([#4090](https://github.com/sveltejs/svelte/issues/4090))
* Correctly mark event handlers as dynamic when they involve an expression used in a `bind:` elsewhere ([#4155](https://github.com/sveltejs/svelte/pull/4155))
## 3.16.6
* Fix CSS specificity bug when encapsulating styles ([#1277](https://github.com/sveltejs/svelte/issues/1277))
* Apply directives in the order they're given ([#2446](https://github.com/sveltejs/svelte/issues/2446))
* Fix destructuring in `let:` directives ([#2751](https://github.com/sveltejs/svelte/issues/2751))
* Preserve whitespace around `<tspan>`s in `<svg>`s ([#3998](https://github.com/sveltejs/svelte/issues/3998))
## 3.16.5
* Better fix for cascading invalidations and fix some regressions ([#4098](https://github.com/sveltejs/svelte/issues/4098), [#4114](https://github.com/sveltejs/svelte/issues/4114), [#4120](https://github.com/sveltejs/svelte/issues/4120))
## 3.16.4
* Fix slots with props not propagating through to inner slots ([#4061](https://github.com/sveltejs/svelte/issues/4061))
* Fix noting autosubscribed stores as `referenced` in `vars` for tooling ([#4081](https://github.com/sveltejs/svelte/issues/4081))
* Fix cascading invalidations in certain situations ([#4094](https://github.com/sveltejs/svelte/issues/4094))
## 3.16.3
* Fix bitmask overflow when using slotted components ([#4077](https://github.com/sveltejs/svelte/issues/4077))
* Remove unnecessary `$$invalidate` calls from init block ([#4018](https://github.com/sveltejs/svelte/issues/4018))
## 3.16.2
* Handle slot updates when parent component has a bitmask overflow ([#4078](https://github.com/sveltejs/svelte/pull/4078))
## 3.16.1
* Fix unused export warning for props used as stores ([#4021](https://github.com/sveltejs/svelte/issues/4021))
* Fix `{:then}` without resolved value containing `{#each}` ([#4022](https://github.com/sveltejs/svelte/issues/4022))
* Fix incorrect code generated with `loopGuardTimeout` ([#4034](https://github.com/sveltejs/svelte/issues/4034))
* Fix handling of bitmask overflow and globals ([#4037](https://github.com/sveltejs/svelte/issues/4037))
* Fix `{:then}` containing `{#if}` ([#4044](https://github.com/sveltejs/svelte/issues/4044))
* Fix bare `import`s in `format: 'cjs'` output mode ([#4055](https://github.com/sveltejs/svelte/issues/4050))
* Warn when using a known global as a component name ([#4070](https://github.com/sveltejs/svelte/issues/4070))
## 3.16.0
* Use bitmasks to track changes ([#3945](https://github.com/sveltejs/svelte/pull/3945))
* Fix heisenbug with component styles ([#3977](https://github.com/sveltejs/svelte/issues/3977))
* Do not warn about missing expected props for `export function foo() {}` ([#3954](https://github.com/sveltejs/svelte/issues/3954))
* Fix `context="module"` exports with the same name as an instance variable ([#3983](https://github.com/sveltejs/svelte/issues/3983))
* Fix binding to contextual values from `{#each}` blocks referring to global variables ([#3992](https://github.com/sveltejs/svelte/issues/3992))
* Use `requestAnimationFrame` callback argument for smoother transitions ([#4014](https://github.com/sveltejs/svelte/pull/4014))
* Fix `listen_dev` argument order ([#4016](https://github.com/sveltejs/svelte/pull/4016))
## 3.15.0
* Hide commented sections from preprocessors ([#3894](https://github.com/sveltejs/svelte/pull/3894))
* Add `seeking` and `ended` bindings to media elements ([#3650](https://github.com/sveltejs/svelte/pull/3650))
* Add `videoWidth` and `videoHeight` bindings to video elements ([#3927](https://github.com/sveltejs/svelte/pull/3927))
* Fix for dynamic event handlers ([#3934](https://github.com/sveltejs/svelte/pull/3934))
* Handle scale transforms when using the `flip` animation ([#3555](https://github.com/sveltejs/svelte/issues/3555))
* Fix some code generation bugs ([#3929](https://github.com/sveltejs/svelte/issues/3929), [#3939](https://github.com/sveltejs/svelte/issues/3939))
* Add `aria-hidden="true"` to objects generated when adding resize-listeners, to improve accessibility ([#3948](https://github.com/sveltejs/svelte/issues/3948))
## 3.14.1
* Deconflict block method names with other variables ([#3900](https://github.com/sveltejs/svelte/issues/3900))
* Fix entity encoding issue in text nodes with constant expressions ([#3911](https://github.com/sveltejs/svelte/issues/3911))
* Make code for unknown prop warnings compatible with older js engines ([#3914](https://github.com/sveltejs/svelte/issues/3914))
## 3.14.0
* Add `loopGuardTimeout` option that augments `for`/`while` loops to prevent infinite loops, primarily for use in the REPL ([#3887](https://github.com/sveltejs/svelte/pull/3887))
* Keep component bindings in sync when changed in reactive statements ([#3382](https://github.com/sveltejs/svelte/issues/3382))
* Update attributes before bindings ([#3857](https://github.com/sveltejs/svelte/issues/3857))
* Prevent variable naming conflict ([#3899](https://github.com/sveltejs/svelte/issues/3899))
## 3.13.0
* New structured code generation, which eliminates a number of edge cases and obscure bugs ([#3539](https://github.com/sveltejs/svelte/pull/3539))
Also:
* Fix `{#each}` context not shadowing outer scope when using `bind:` ([#1565](https://github.com/sveltejs/svelte/issues/1565))
* Fix edge cases in matching selectors against elements ([#1710](https://github.com/sveltejs/svelte/issues/1710)) * Fix edge cases in matching selectors against elements ([#1710](https://github.com/sveltejs/svelte/issues/1710))
* Fix several bugs related to interaction of `{...spread}` attributes with other features ([#2721](https://github.com/sveltejs/svelte/issues/2721), [#2916](https://github.com/sveltejs/svelte/issues/2916), [#3421](https://github.com/sveltejs/svelte/issues/3421), [#3681](https://github.com/sveltejs/svelte/issues/3681), [#3764](https://github.com/sveltejs/svelte/issues/3764), [#3790](https://github.com/sveltejs/svelte/issues/3790))
* Allow exiting a reactive block early with `break $` ([#2828](https://github.com/sveltejs/svelte/issues/2828))
* Fix binding to props that have been renamed with `export { ... as ... }` ([#3508](https://github.com/sveltejs/svelte/issues/3508))
* Fix application of style scoping class in cases of ambiguity ([#3544](https://github.com/sveltejs/svelte/issues/3544))
* Check attributes have changed before setting them to avoid image flicker ([#3579](https://github.com/sveltejs/svelte/pull/3579))
* Fix generating malformed code for `{@debug}` tags with no dependencies ([#3588](https://github.com/sveltejs/svelte/issues/3588))
* Fix generated code in specific case involving compound ifs and child components ([#3595](https://github.com/sveltejs/svelte/issues/3595))
* Fix `bind:this` binding to a store ([#3591](https://github.com/sveltejs/svelte/issues/3591))
* Use safer `HTMLElement` check before extending class ([#3608](https://github.com/sveltejs/svelte/issues/3608))
* Add `location` as a known global ([#3619](https://github.com/sveltejs/svelte/pull/3619))
* Support `{#await}` with `{:catch}` but no `{:then}` ([#3623](https://github.com/sveltejs/svelte/issues/3623))
* Clean up dead code emitted for `<slot/>`s ([#3631](https://github.com/sveltejs/svelte/issues/3631))
* Fix tracking of dependencies of compound assignments in reactive statements ([#3634](https://github.com/sveltejs/svelte/issues/3634))
* Flush changes in newly attached block when using `{#await}` ([#3660](https://github.com/sveltejs/svelte/issues/3660))
* Throw exception immediately when calling `createEventDispatcher()` after component instantiation ([#3667](https://github.com/sveltejs/svelte/pull/3667))
* Fix globals shadowing contextual template scope ([#3674](https://github.com/sveltejs/svelte/issues/3674))
* Fix `<svelte:window>` bindings to stores ([#3832](https://github.com/sveltejs/svelte/issues/3832))
* Deconflict generated var names with builtins ([#3724](https://github.com/sveltejs/svelte/issues/3724))
* Allow spring/tweened values to be initially undefined ([#3761](https://github.com/sveltejs/svelte/issues/3761))
* Warn if using `<svelte:options tag="...">` without `customElement: true` option ([#3782](https://github.com/sveltejs/svelte/pull/3782))
* Add `Event` to list of known globals ([#3810](https://github.com/sveltejs/svelte/pull/3810))
* Throw helpful error on empty CSS declaration ([#3801](https://github.com/sveltejs/svelte/issues/3801))
* Support `easing` param on `fade` transition ([#3823](https://github.com/sveltejs/svelte/pull/3823))
* Generate valid names from filenames with unicode characters ([#3845](https://github.com/sveltejs/svelte/issues/3845))
* Don't generate any code for markup-less components ([#2200](https://github.com/sveltejs/svelte/issues/2200))
* Deconflict with internal name `block` ([#3854](https://github.com/sveltejs/svelte/issues/3854))
* Set attributes before bindings, to prevent erroneous assignments to `input.files` ([#3828](https://github.com/sveltejs/svelte/issues/3828))
* Smarter unused CSS detection ([#3825](https://github.com/sveltejs/svelte/pull/3825))
* Allow dynamic event handlers ([#3040](https://github.com/sveltejs/svelte/issues/3040))
* Prevent erroneous `"undefined"` class name ([#3876](https://github.com/sveltejs/svelte/pull/3876))
* Prevent resetting of `src` attribute unless changed ([#3579](https://github.com/sveltejs/svelte/pull/3579))
* Prevent hydration of void element 'children' ([#3882](https://github.com/sveltejs/svelte/issues/3882))
* Hoist globals even if mentioned in `<script>` block ([#3745](https://github.com/sveltejs/svelte/pull/3745))
## 3.12.1 ## 3.12.1
@ -11,6 +201,7 @@
## 3.12.0 ## 3.12.0
* Fire events on `document` in development to facilitate dev tooling ([#3005](https://github.com/sveltejs/svelte/pull/3005)) * Fire events on `document` in development to facilitate dev tooling ([#3005](https://github.com/sveltejs/svelte/pull/3005))
* Remove old props when the keys in spread props are removed ([#2282](https://github.com/sveltejs/svelte/issues/2282))
## 3.11.0 ## 3.11.0

@ -0,0 +1,138 @@
# Contributing to Svelte
Svelte is a new way to build web applications. It's a compiler that takes your declarative components and converts them into efficient JavaScript that surgically updates the DOM.
The [Open Source Guides](https://opensource.guide/) website has a collection of resources for individuals, communities, and companies. These resources help people who want to learn how to run and contribute to open source projects. Contributors and people new to open source alike will find the following guides especially useful:
* [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
* [Building Welcoming Communities](https://opensource.guide/building-community/)
## Get involved
There are many ways to contribute to Svelte, and many of them do not involve writing any code. Here's a few ideas to get started:
- Simply start using Svelte. Go through the [Getting Started](https://svelte.dev/blog/the-easiest-way-to-get-started) guide. Does everything work as expected? If not, we're always looking for improvements. Let us know by [opening an issue](#reporting-new-issues).
- Look through the [open issues](https://github.com/sveltejs/svelte/issues). Provide workarounds, ask for clarification, or suggest labels. Help [triage issues](#triaging-issues-and-pull-requests).
- If you find an issue you would like to fix, [open a pull request](#your-first-pull-request).
- Read through our [tutorials](https://svelte.dev/tutorial/basics). If you find anything that is confusing or can be improved, you can make edits by clicking "Edit this chapter" at the bottom left of the tutorial page.
- Take a look at the [features requested](https://github.com/sveltejs/svelte/labels/enhancement) by others in the community and consider opening a pull request if you see something you want to work on.
Contributions are very welcome. If you think you need help planning your contribution, please ping us on Discord at [svelte.dev/chat](https://svelte.dev/chat) and let us know you are looking for a bit of help.
### Triaging issues and pull requests
One great way you can contribute to the project without writing any code is to help triage issues and pull requests as they come in.
- Ask for more information if you believe the issue does not provide all the details required to solve it.
- Suggest [labels](https://github.com/sveltejs/svelte/labels) that can help categorize issues.
- Flag issues that are stale or that should be closed.
- Ask for test plans and review code.
## Bugs
We use [GitHub issues](https://github.com/sveltejs/svelte/issues) for our public bugs. If you would like to report a problem, take a look around and see if someone already opened an issue about it. If you are certain this is a new unreported bug, you can submit a [bug report](#reporting-new-issues).
If you have questions about using Svelte, contact us on Discord at [svelte.dev/chat](https://svelte.dev/chat), and we will do our best to answer your questions.
If you see anything you'd like to be implemented, create a [feature request issue](https://github.com/sveltejs/svelte/issues/new?template=feature_request.md)
## Reporting new issues
When [opening a new issue](https://github.com/sveltejs/svelte/issues/new/choose), always make sure to fill out the issue template. **This step is very important!** Not doing so may result in your issue not being managed in a timely fashion. Don't take this personally if this happens, and feel free to open a new issue once you've gathered all the information required by the template.
- **One issue, one bug:** Please report a single bug per issue.
- **Provide reproduction steps:** List all the steps necessary to reproduce the issue. The person reading your bug report should be able to follow these steps to reproduce your issue with minimal effort. If possible, use the [REPL](https://svelte.dev/repl) to create your reproduction.
## Installation
1. Ensure you have [npm](https://www.npmjs.com/get-npm) installed.
1. After cloning the repository, run `npm install` in the root of the repository.
1. To start a development server, run `npm run dev`.
## Pull requests
### Your first pull request
So you have decided to contribute code back to upstream by opening a pull request. You've invested a good chunk of time, and we appreciate it. We will do our best to work with you and get the PR looked at.
Working on your first Pull Request? You can learn how from this free video series:
[**How to Contribute to an Open Source Project on GitHub**](https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github)
### Proposing a change
If you would like to request a new feature or enhancement but are not yet thinking about opening a pull request, you can also file an issue with [feature template](https://github.com/sveltejs/svelte/issues/new?template=feature_request.md).
If you're only fixing a bug, it's fine to submit a pull request right away but we still recommend that you file an issue detailing what you're fixing. This is helpful in case we don't accept that specific fix but want to keep track of the issue.
### Sending a pull request
Small pull requests are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.
Please make sure the following is done when submitting a pull request:
1. Fork [the repository](https://github.com/sveltejs/svelte) and create your branch from `master`.
1. Describe your **test plan** in your pull request description. Make sure to test your changes.
1. Make sure your code lints (`npm run lint`).
1. Make sure your tests pass (`npm run test`).
All pull requests should be opened against the `master` branch.
#### Test plan
A good test plan has the exact commands you ran and their output, provides screenshots or videos if the pull request changes UI.
- If you've changed APIs, update the documentation.
#### Writing tests
All tests are located in `/test` folder.
Test samples are kept in `/test/xxx/samples` folder.
#### Running tests
1. To run test, run `npm run test`
1. To run test for a specific feature, you can use the `-g` (aka `--grep`) option. For example, to only run test involving transitions, run `npm run test -- -g transition`.
##### Running solo test
1. To run only one test, rename the test sample folder to end with `.solo`. For example, to run the `test/js/samples/action` only, rename it to `test/js/samples/action.solo`.
1. To run only one test suite, rename the test suite folder to end with `.solo`. For example, to run the `test/js` test suite only, rename it to `test/js.solo`.
1. Remember to rename the test folder back. The CI will fail if there's a solo test.
##### Updating `.expected` files
1. Tests suites like `css`, `js`, `server-side-rendering` asserts that the generated output has to match the content in the `.expected` file. For example, in the `js` test suites, the generated js code is compared against the content in `expected.js`.
1. To update the content of the `.expected` file, run the test with `--update` flag. (`npm run test --update`)
#### Breaking changes
When adding a new breaking change, follow this template in your pull request:
```md
### New breaking change here
- **Who does this affect**:
- **How to migrate**:
- **Why make this breaking change**:
- **Severity (number of people affected x effort)**:
```
### What happens next?
The core Svelte team will be monitoring for pull requests. Do help us by making your pull request easy to review by following the guidelines above.
## Style guide
[Eslint](https://eslint.org) will catch most styling issues that may exist in your code. You can check the status of your code styling by simply running `npm run lint`.
### Code conventions
- `snake_case` for internal variable names and methods
- `camelCase` for public variable names and methods.
## License
By contributing to Svelte, you agree that your contributions will be licensed under its [MIT license](https://github.com/sveltejs/svelte/blob/master/LICENSE).

@ -1,4 +1,4 @@
Copyright (c) 2016-19 [these people](https://github.com/sveltejs/svelte/graphs/contributors) Copyright (c) 2016-20 [these people](https://github.com/sveltejs/svelte/graphs/contributors)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

@ -7,15 +7,6 @@
<img src="https://img.shields.io/npm/v/svelte.svg" alt="npm version"> <img src="https://img.shields.io/npm/v/svelte.svg" alt="npm version">
</a> </a>
<a href="https://packagephobia.now.sh/result?p=svelte">
<img src="https://packagephobia.now.sh/badge?p=svelte" alt="install size">
</a>
<a href="https://travis-ci.org/sveltejs/svelte">
<img src="https://api.travis-ci.org/sveltejs/svelte.svg?branch=master"
alt="build status">
</a>
<a href="https://github.com/sveltejs/svelte/blob/master/LICENSE"> <a href="https://github.com/sveltejs/svelte/blob/master/LICENSE">
<img src="https://img.shields.io/npm/l/svelte.svg" alt="license"> <img src="https://img.shields.io/npm/l/svelte.svg" alt="license">
</a> </a>

313
package-lock.json generated

@ -1,6 +1,6 @@
{ {
"name": "svelte", "name": "svelte",
"version": "3.12.1", "version": "3.19.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -30,6 +30,113 @@
"integrity": "sha512-KioOCsSvSvXx6xUNLiJz+P+VMb7NRcePjoefOr74Y5P6lEKsiOn35eZyZzgpK4XCNJdXTDR7+zykj0lwxRvZ2g==", "integrity": "sha512-KioOCsSvSvXx6xUNLiJz+P+VMb7NRcePjoefOr74Y5P6lEKsiOn35eZyZzgpK4XCNJdXTDR7+zykj0lwxRvZ2g==",
"dev": true "dev": true
}, },
"@rollup/plugin-commonjs": {
"version": "11.0.0",
"resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-11.0.0.tgz",
"integrity": "sha512-jnm//T5ZWOZ6zmJ61fReSCBOif+Ax8dHVoVggA+d2NA7T4qCWgQ3KYr+zN2faGEYLpe1wa03IzvhR+sqVLxUWg==",
"dev": true,
"requires": {
"@rollup/pluginutils": "^3.0.0",
"estree-walker": "^0.6.1",
"is-reference": "^1.1.2",
"magic-string": "^0.25.2",
"resolve": "^1.11.0"
},
"dependencies": {
"estree-walker": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz",
"integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==",
"dev": true
}
}
},
"@rollup/plugin-json": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-4.0.1.tgz",
"integrity": "sha512-soxllkhOGgchswBAAaTe7X9G80U2tjjHvXv0sBrriLJcC/89PkP59iTrKPOfbz3SjX088mKDmMhAscuyLz8ZSg==",
"dev": true,
"requires": {
"rollup-pluginutils": "^2.5.0"
}
},
"@rollup/plugin-node-resolve": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-6.0.0.tgz",
"integrity": "sha512-GqWz1CfXOsqpeVMcoM315+O7zMxpRsmhWyhJoxLFHVSp9S64/u02i7len/FnbTNbmgYs+sZyilasijH8UiuboQ==",
"dev": true,
"requires": {
"@rollup/pluginutils": "^3.0.0",
"@types/resolve": "0.0.8",
"builtin-modules": "^3.1.0",
"is-module": "^1.0.0",
"resolve": "^1.11.1"
}
},
"@rollup/plugin-replace": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/@rollup/plugin-replace/-/plugin-replace-2.3.0.tgz",
"integrity": "sha512-rzWAMqXAHC1w3eKpK6LxRqiF4f3qVFaa1sGii6Bp3rluKcwHNOpPt+hWRCmAH6SDEPtbPiLFf0pfNQyHs6Btlg==",
"dev": true,
"requires": {
"magic-string": "^0.25.2",
"rollup-pluginutils": "^2.6.0"
}
},
"@rollup/plugin-sucrase": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@rollup/plugin-sucrase/-/plugin-sucrase-3.0.0.tgz",
"integrity": "sha512-sUQkoAXdw+bnd/cNZHGy5yQKW6OYYU7QlYBGhReI95uZljxO8t1LlbqCO2viIMV/u9pcCjgi8N9PcApcrJCA8Q==",
"dev": true,
"requires": {
"@rollup/pluginutils": "^3.0.1",
"sucrase": "^3.10.1"
}
},
"@rollup/plugin-typescript": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-2.0.1.tgz",
"integrity": "sha512-UA/bN/DlHN19xdOllXmp7G7pM2ac9dQMg0q2T1rg4Bogzb7oHXj2WGafpiNpEm54PivcJdzGRJvRnI6zCISW3w==",
"dev": true,
"requires": {
"@rollup/pluginutils": "^3.0.0",
"resolve": "^1.12.2"
},
"dependencies": {
"resolve": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.14.1.tgz",
"integrity": "sha512-fn5Wobh4cxbLzuHaE+nphztHy43/b++4M6SsGFC2gB8uYwf0C8LcarfCz1un7UTW8OFQg9iNjZ4xpcFVGebDPg==",
"dev": true,
"requires": {
"path-parse": "^1.0.6"
}
}
}
},
"@rollup/plugin-virtual": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@rollup/plugin-virtual/-/plugin-virtual-2.0.0.tgz",
"integrity": "sha512-yUyQjcflsN1DGcUHj3I0NYL6Y6xrna6qjdaGjM93LjFLq8NFowhR0655ICeV9bNDbk+LI4pz7Q6xqeDdj1RdlA==",
"dev": true
},
"@rollup/pluginutils": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.0.1.tgz",
"integrity": "sha512-PmNurkecagFimv7ZdKCVOfQuqKDPkrcpLFxRBcQ00LYr4HAjJwhCFxBiY2Xoletll2htTIiXBg6g0Yg21h2M3w==",
"dev": true,
"requires": {
"estree-walker": "^0.6.1"
},
"dependencies": {
"estree-walker": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz",
"integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==",
"dev": true
}
}
},
"@types/eslint-visitor-keys": { "@types/eslint-visitor-keys": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", "resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz",
@ -167,9 +274,9 @@
"dev": true "dev": true
}, },
"acorn": { "acorn": {
"version": "7.0.0", "version": "7.1.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.0.0.tgz", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz",
"integrity": "sha512-PaF/MduxijYYt7unVGRuds1vBC9bFxbNf+VWqhOClfdgy7RlVkQqt610ig1/yxTgsDIfW1cWDel5EBbOy3jdtQ==", "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==",
"dev": true "dev": true
}, },
"acorn-globals": { "acorn-globals": {
@ -489,6 +596,18 @@
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
"dev": true "dev": true
}, },
"code-red": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/code-red/-/code-red-0.1.1.tgz",
"integrity": "sha512-2pEIyya4fxI9HxQcrl9dJl20+9He1nLeja50zkf7gK2OTTV9NpD3CgA74gzXnPqWv2zJpa6uXNSaE0haOCpOsw==",
"dev": true,
"requires": {
"acorn": "^7.1.0",
"is-reference": "^1.1.4",
"periscopic": "^2.0.1",
"sourcemap-codec": "^1.4.6"
}
},
"codecov": { "codecov": {
"version": "3.5.0", "version": "3.5.0",
"resolved": "https://registry.npmjs.org/codecov/-/codecov-3.5.0.tgz", "resolved": "https://registry.npmjs.org/codecov/-/codecov-3.5.0.tgz",
@ -792,6 +911,13 @@
"resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz",
"integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=",
"dev": true "dev": true
},
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true,
"optional": true
} }
} }
}, },
@ -1128,14 +1254,6 @@
"acorn": "^7.0.0", "acorn": "^7.0.0",
"acorn-jsx": "^5.0.2", "acorn-jsx": "^5.0.2",
"eslint-visitor-keys": "^1.1.0" "eslint-visitor-keys": "^1.1.0"
},
"dependencies": {
"acorn": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.0.0.tgz",
"integrity": "sha512-PaF/MduxijYYt7unVGRuds1vBC9bFxbNf+VWqhOClfdgy7RlVkQqt610ig1/yxTgsDIfW1cWDel5EBbOy3jdtQ==",
"dev": true
}
} }
}, },
"esprima": { "esprima": {
@ -1169,9 +1287,9 @@
"dev": true "dev": true
}, },
"estree-walker": { "estree-walker": {
"version": "0.6.1", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.0.tgz",
"integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", "integrity": "sha512-vY6xMN2j47HfQfVWGRqHshr1olf+XS1Y488NoqjDP1c8E1TcoZr/D3eSGa6akBs76WL1X9nluWjgBsCKdt/qKg==",
"dev": true "dev": true
}, },
"esutils": { "esutils": {
@ -1475,15 +1593,23 @@
"dev": true "dev": true
}, },
"handlebars": { "handlebars": {
"version": "4.1.2", "version": "4.5.3",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.2.tgz", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.3.tgz",
"integrity": "sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw==", "integrity": "sha512-3yPecJoJHK/4c6aZhSvxOyG4vJKDshV36VHp0iVCDVh7o9w2vwi3NSnL2MMPj3YdduqaBcu7cGbggJQM0br9xA==",
"dev": true, "dev": true,
"requires": { "requires": {
"neo-async": "^2.6.0", "neo-async": "^2.6.0",
"optimist": "^0.6.1", "optimist": "^0.6.1",
"source-map": "^0.6.1", "source-map": "^0.6.1",
"uglify-js": "^3.1.4" "uglify-js": "^3.1.4"
},
"dependencies": {
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
}
} }
}, },
"har-schema": { "har-schema": {
@ -1556,9 +1682,9 @@
} }
}, },
"https-proxy-agent": { "https-proxy-agent": {
"version": "2.2.2", "version": "2.2.4",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.2.tgz", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz",
"integrity": "sha512-c8Ndjc9Bkpfx/vCJueCPy0jlP4ccCCSNDp8xwCZzPjKJUm+B+u9WX2x98Qx4n1PiMNTWo3D7KK5ifNV/yJyRzg==", "integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==",
"dev": true, "dev": true,
"requires": { "requires": {
"agent-base": "^4.3.0", "agent-base": "^4.3.0",
@ -1741,9 +1867,9 @@
"dev": true "dev": true
}, },
"is-reference": { "is-reference": {
"version": "1.1.3", "version": "1.1.4",
"resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.1.3.tgz", "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.1.4.tgz",
"integrity": "sha512-W1iHHv/oyBb2pPxkBxtaewxa1BC58Pn5J0hogyCdefwUIvb6R+TGbAcIa4qPNYLqLhb3EnOgUf2MQkkF76BcKw==", "integrity": "sha512-uJA/CDPO3Tao3GTrxYn6AwkM4nUPJiGGYu5+cB8qbC7WGFlrKZbiRo7SFKxUAEpFUfiHofWCXBUNhvYJMh+6zw==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/estree": "0.0.39" "@types/estree": "0.0.39"
@ -2693,6 +2819,15 @@
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=",
"dev": true "dev": true
}, },
"periscopic": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/periscopic/-/periscopic-2.0.1.tgz",
"integrity": "sha512-twJ8e4RatllMAcbmBqKj8cvZ94HtqSzbb8hJoGj4iSCcCHXxKb06HRxOq4heyq2x/6mKynJDvTTreHCz+m6lJw==",
"dev": true,
"requires": {
"is-reference": "^1.1.4"
}
},
"pify": { "pify": {
"version": "4.0.1", "version": "4.0.1",
"resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz",
@ -3020,87 +3155,14 @@
} }
}, },
"rollup": { "rollup": {
"version": "1.21.4", "version": "1.27.14",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-1.21.4.tgz", "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.27.14.tgz",
"integrity": "sha512-Pl512XVCmVzgcBz5h/3Li4oTaoDcmpuFZ+kdhS/wLreALz//WuDAMfomD3QEYl84NkDu6Z6wV9twlcREb4qQsw==", "integrity": "sha512-DuDjEyn8Y79ALYXMt+nH/EI58L5pEw5HU9K38xXdRnxQhvzUTI/nxAawhkAHUQeudANQ//8iyrhVRHJBuR6DSQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/estree": "0.0.39", "@types/estree": "*",
"@types/node": "^12.7.5", "@types/node": "*",
"acorn": "^7.0.0" "acorn": "^7.1.0"
},
"dependencies": {
"@types/node": {
"version": "12.7.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.5.tgz",
"integrity": "sha512-9fq4jZVhPNW8r+UYKnxF1e2HkDWOWKM5bC2/7c9wPV835I0aOrVbS/Hw/pWPk2uKrNXQqg9Z959Kz+IYDd5p3w==",
"dev": true
}
}
},
"rollup-plugin-commonjs": {
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/rollup-plugin-commonjs/-/rollup-plugin-commonjs-10.1.0.tgz",
"integrity": "sha512-jlXbjZSQg8EIeAAvepNwhJj++qJWNJw1Cl0YnOqKtP5Djx+fFGkp3WRh+W0ASCaFG5w1jhmzDxgu3SJuVxPF4Q==",
"dev": true,
"requires": {
"estree-walker": "^0.6.1",
"is-reference": "^1.1.2",
"magic-string": "^0.25.2",
"resolve": "^1.11.0",
"rollup-pluginutils": "^2.8.1"
}
},
"rollup-plugin-json": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/rollup-plugin-json/-/rollup-plugin-json-4.0.0.tgz",
"integrity": "sha512-hgb8N7Cgfw5SZAkb3jf0QXii6QX/FOkiIq2M7BAQIEydjHvTyxXHQiIzZaTFgx1GK0cRCHOCBHIyEkkLdWKxow==",
"dev": true,
"requires": {
"rollup-pluginutils": "^2.5.0"
}
},
"rollup-plugin-node-resolve": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.2.0.tgz",
"integrity": "sha512-jUlyaDXts7TW2CqQ4GaO5VJ4PwwaV8VUGA7+km3n6k6xtOEacf61u0VXwN80phY/evMcaS+9eIeJ9MOyDxt5Zw==",
"dev": true,
"requires": {
"@types/resolve": "0.0.8",
"builtin-modules": "^3.1.0",
"is-module": "^1.0.0",
"resolve": "^1.11.1",
"rollup-pluginutils": "^2.8.1"
}
},
"rollup-plugin-replace": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/rollup-plugin-replace/-/rollup-plugin-replace-2.2.0.tgz",
"integrity": "sha512-/5bxtUPkDHyBJAKketb4NfaeZjL5yLZdeUihSfbF2PQMz+rSTEb8ARKoOl3UBT4m7/X+QOXJo3sLTcq+yMMYTA==",
"dev": true,
"requires": {
"magic-string": "^0.25.2",
"rollup-pluginutils": "^2.6.0"
}
},
"rollup-plugin-sucrase": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/rollup-plugin-sucrase/-/rollup-plugin-sucrase-2.1.0.tgz",
"integrity": "sha512-chdA3OruR1FH/IIKrzZCpGKLXAx3DOHoK24RIPtlVccK0wbTpHE0HpGEQYCxte1XaB17NgRe/frFyKR7g45qxQ==",
"dev": true,
"requires": {
"rollup-pluginutils": "^2.3.0",
"sucrase": "3.x"
}
},
"rollup-plugin-typescript": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/rollup-plugin-typescript/-/rollup-plugin-typescript-1.0.1.tgz",
"integrity": "sha512-rwJDNn9jv/NsKZuyBb/h0jsclP4CJ58qbvZt2Q9zDIGILF2LtdtvCqMOL+Gq9IVq5MTrTlHZNrn8h7VjQgd8tw==",
"dev": true,
"requires": {
"resolve": "^1.10.0",
"rollup-pluginutils": "^2.5.0"
} }
}, },
"rollup-plugin-virtual": { "rollup-plugin-virtual": {
@ -3110,12 +3172,20 @@
"dev": true "dev": true
}, },
"rollup-pluginutils": { "rollup-pluginutils": {
"version": "2.8.1", "version": "2.8.2",
"resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.1.tgz", "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz",
"integrity": "sha512-J5oAoysWar6GuZo0s+3bZ6sVZAC0pfqKz68De7ZgDi5z63jOVZn1uJL/+z1jeKHNbGII8kAyHF5q8LnxSX5lQg==", "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"estree-walker": "^0.6.1" "estree-walker": "^0.6.1"
},
"dependencies": {
"estree-walker": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz",
"integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==",
"dev": true
}
} }
}, },
"run-async": { "run-async": {
@ -3202,9 +3272,9 @@
} }
}, },
"source-map": { "source-map": {
"version": "0.6.1", "version": "0.7.3",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==",
"dev": true "dev": true
}, },
"source-map-support": { "source-map-support": {
@ -3215,6 +3285,14 @@
"requires": { "requires": {
"buffer-from": "^1.0.0", "buffer-from": "^1.0.0",
"source-map": "^0.6.0" "source-map": "^0.6.0"
},
"dependencies": {
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
}
} }
}, },
"sourcemap-codec": { "sourcemap-codec": {
@ -3522,6 +3600,15 @@
"requires": { "requires": {
"commander": "~2.20.0", "commander": "~2.20.0",
"source-map": "~0.6.1" "source-map": "~0.6.1"
},
"dependencies": {
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true,
"optional": true
}
} }
}, },
"uri-js": { "uri-js": {
@ -3566,14 +3653,6 @@
"@types/istanbul-lib-coverage": "^2.0.1", "@types/istanbul-lib-coverage": "^2.0.1",
"convert-source-map": "^1.6.0", "convert-source-map": "^1.6.0",
"source-map": "^0.7.3" "source-map": "^0.7.3"
},
"dependencies": {
"source-map": {
"version": "0.7.3",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
"integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==",
"dev": true
}
} }
}, },
"validate-npm-package-license": { "validate-npm-package-license": {

@ -1,6 +1,6 @@
{ {
"name": "svelte", "name": "svelte",
"version": "3.12.1", "version": "3.19.1",
"description": "Cybernetically enhanced web apps", "description": "Cybernetically enhanced web apps",
"module": "index.mjs", "module": "index.mjs",
"main": "index", "main": "index",
@ -56,35 +56,37 @@
}, },
"homepage": "https://github.com/sveltejs/svelte#README", "homepage": "https://github.com/sveltejs/svelte#README",
"devDependencies": { "devDependencies": {
"@rollup/plugin-commonjs": "^11.0.0",
"@rollup/plugin-json": "^4.0.1",
"@rollup/plugin-node-resolve": "^6.0.0",
"@rollup/plugin-replace": "^2.3.0",
"@rollup/plugin-sucrase": "^3.0.0",
"@rollup/plugin-typescript": "^2.0.1",
"@rollup/plugin-virtual": "^2.0.0",
"@types/mocha": "^5.2.7", "@types/mocha": "^5.2.7",
"@types/node": "^8.10.53", "@types/node": "^8.10.53",
"@typescript-eslint/eslint-plugin": "^1.13.0", "@typescript-eslint/eslint-plugin": "^1.13.0",
"@typescript-eslint/parser": "^2.1.0", "@typescript-eslint/parser": "^2.1.0",
"acorn": "^7.0.0", "acorn": "^7.1.0",
"agadoo": "^1.1.0", "agadoo": "^1.1.0",
"c8": "^5.0.1", "c8": "^5.0.1",
"code-red": "0.1.1",
"codecov": "^3.5.0", "codecov": "^3.5.0",
"css-tree": "1.0.0-alpha22", "css-tree": "1.0.0-alpha22",
"eslint": "^6.3.0", "eslint": "^6.3.0",
"eslint-plugin-import": "^2.18.2", "eslint-plugin-import": "^2.18.2",
"eslint-plugin-svelte3": "^2.7.3", "eslint-plugin-svelte3": "^2.7.3",
"estree-walker": "^0.6.1", "estree-walker": "^1.0.0",
"is-reference": "^1.1.3", "is-reference": "^1.1.4",
"jsdom": "^15.1.1", "jsdom": "^15.1.1",
"kleur": "^3.0.3", "kleur": "^3.0.3",
"locate-character": "^2.0.5", "locate-character": "^2.0.5",
"magic-string": "^0.25.3", "magic-string": "^0.25.3",
"mocha": "^6.2.0", "mocha": "^6.2.0",
"periscopic": "^2.0.1",
"puppeteer": "^1.19.0", "puppeteer": "^1.19.0",
"rollup": "^1.21.4", "rollup": "^1.27.14",
"rollup-plugin-commonjs": "^10.1.0", "source-map": "^0.7.3",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-sucrase": "^2.1.0",
"rollup-plugin-typescript": "^1.0.1",
"rollup-plugin-virtual": "^1.0.1",
"source-map": "^0.6.1",
"source-map-support": "^0.5.13", "source-map-support": "^0.5.13",
"tiny-glob": "^0.2.6", "tiny-glob": "^0.2.6",
"tslib": "^1.10.0", "tslib": "^1.10.0",

@ -36,7 +36,15 @@ function registerExtension(extension) {
format: 'cjs' format: 'cjs'
}); });
const { js } = compile(fs.readFileSync(filename, 'utf-8'), options); const { js, warnings } = compile(fs.readFileSync(filename, 'utf-8'), options);
if (options.dev) {
warnings.forEach(warning => {
console.warn(`\nSvelte Warning in ${warning.filename}:`);
console.warn(warning.message);
console.warn(warning.frame);
})
}
return module._compile(js.code, filename); return module._compile(js.code, filename);
}; };

@ -1,10 +1,10 @@
import fs from 'fs'; import fs from 'fs';
import replace from 'rollup-plugin-replace'; import replace from '@rollup/plugin-replace';
import resolve from 'rollup-plugin-node-resolve'; import resolve from '@rollup/plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs'; import commonjs from '@rollup/plugin-commonjs';
import json from 'rollup-plugin-json'; import json from '@rollup/plugin-json';
import sucrase from 'rollup-plugin-sucrase'; import sucrase from '@rollup/plugin-sucrase';
import typescript from 'rollup-plugin-typescript'; import typescript from '@rollup/plugin-typescript';
import pkg from './package.json'; import pkg from './package.json';
const is_publish = !!process.env.PUBLISH; const is_publish = !!process.env.PUBLISH;
@ -20,8 +20,7 @@ const ts_plugin = is_publish
const external = id => id.startsWith('svelte/'); const external = id => id.startsWith('svelte/');
const inlined_estree = fs.readFileSync('./node_modules/estree-walker/index.d.ts', 'utf-8').replace(/declare.*\{((.|[\n\r])+)\}/m, '$1'); fs.writeFileSync(`./compiler.d.ts`, `export { compile, parse, preprocess, VERSION } from './types/compiler/index';`);
fs.writeFileSync(`./compiler.d.ts`, `export { compile, parse, preprocess, VERSION } from './types/compiler/index';\n${inlined_estree}`);
export default [ export default [
/* runtime */ /* runtime */
@ -61,6 +60,9 @@ export default [
], ],
external, external,
plugins: [ plugins: [
replace({
__VERSION__: pkg.version
}),
ts_plugin, ts_plugin,
{ {
writeBundle(bundle) { writeBundle(bundle) {

@ -2,7 +2,12 @@ NODE_ENV=
PORT= PORT=
BASEURL= BASEURL=
DATABASE_URL=
GITHUB_CLIENT_ID= GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET= GITHUB_CLIENT_SECRET=
MAPBOX_ACCESS_TOKEN= MAPBOX_ACCESS_TOKEN=
PGHOST=hostname
PGPORT=port
PGUSER=username
PGPASSWORD=password
PGDATABASE=database_name

@ -47,6 +47,12 @@ module.exports = {
}, },
settings: { settings: {
'import/core-modules': ['svelte'], 'import/core-modules': ['svelte'],
'svelte3/compiler': require('svelte/compiler') 'svelte3/compiler': (() => {
try {
return require('svelte/compiler');
} catch (e) {
return null;
}
})()
} }
}; };

@ -1,3 +1,6 @@
# IMPORTANT: Don't use this Dockerfile in your own Sapper projects without also looking at the .dockerignore file.
# Without an appropriate .dockerignore, this Dockerfile will copy a large number of unneeded files into your image.
FROM mhart/alpine-node:12 FROM mhart/alpine-node:12
# install dependencies # install dependencies

@ -14,9 +14,9 @@ sapper:
docker: docker:
@echo "\n~> building docker image" @echo "\n~> building docker image"
@gcloud builds submit -t $(IMAGE) @gcloud builds submit --project $(PROJECT) -t $(IMAGE)
deploy: sapper docker deploy: sapper docker
@echo "\n~> deploying $(SERVICE) to Cloud Run servers" @echo "\n~> deploying $(SERVICE) to Cloud Run servers"
@gcloud beta run deploy $(SERVICE) --allow-unauthenticated --platform managed --region us-central1 --image $(IMAGE) --memory=512Mi @gcloud run deploy $(SERVICE) --project $(PROJECT) --allow-unauthenticated --platform managed --region us-central1 --image $(IMAGE) --memory=512Mi

@ -53,7 +53,7 @@ What happens if we use the new model as a starting point?
The same 'hello world' app that took 204kb with React and Next weighs just 7kb with Sapper. That number is likely to fall further in the future as we explore the space of optimisation possibilities, such as not shipping any JavaScript *at all* for pages that aren't interactive, beyond the tiny Sapper runtime that handles client-side routing. The same 'hello world' app that took 204kb with React and Next weighs just 7kb with Sapper. That number is likely to fall further in the future as we explore the space of optimisation possibilities, such as not shipping any JavaScript *at all* for pages that aren't interactive, beyond the tiny Sapper runtime that handles client-side routing.
What about a more 'real world' example? Conveniently, the [RealWorld](https://github.com/gothinkster/realworld) project, which challenges frameworks to develop an implementation of a Medium clone, gives us a way to find out. The [Sapper implementation](http://svelte-realworld.now.sh/) takes 39.6kb (11.8kb zipped) to render an interactive homepage. What about a more 'real world' example? Conveniently, the [RealWorld](https://github.com/gothinkster/realworld) project, which challenges frameworks to develop an implementation of a Medium clone, gives us a way to find out. The [Sapper implementation](https://github.com/sveltejs/realworld) takes 39.6kb (11.8kb zipped) to render an interactive homepage.
<aside><p>Code-splitting isn't free — if the reference implementation used code-splitting, it would be larger still</p></aside> <aside><p>Code-splitting isn't free — if the reference implementation used code-splitting, it would be larger still</p></aside>

@ -6,28 +6,64 @@ authorURL: https://twitter.com/Rich_Harris
draft: true draft: true
--- ---
*Coming soon* This post will walk you through setting up your editor so that recognises Svelte files: *__Coming soon__*
This post will walk you through setting up your editor so that recognises Svelte files:
* eslint-plugin-svelte3 * eslint-plugin-svelte3
* svelte-vscode * svelte-vscode
* associating .svelte files with HTML in VSCode, Sublime, Atom, etc etc etc * associating .svelte files with HTML in VSCode, Sublime, etc.
## Atom
To treat `*.svelte` files as HTML, open *__Edit → Config...__* and add the following lines to your `core` section:
```cson
"*":
core:
customFileTypes:
"text.html.basic": [
"svelte"
]
```
## Vim/Neovim ## Vim/Neovim
To treat all `*.svelte` files as HTML, add the following line to your `init.vim`: To treat all `*.svelte` files as HTML, add the following line to your `init.vim`:
```bash ```
au! BufNewFile,BufRead *.svelte set ft=html au! BufNewFile,BufRead *.svelte set ft=html
``` ```
To temporarily turn on HTML syntax highlighting for the current buffer, use: To temporarily turn on HTML syntax highlighting for the current buffer, use:
```bash ```
:set ft=html :set ft=html
``` ```
To set the filetype for a single file, use a [modeline](https://vim.fandom.com/wiki/Modeline_magic): To set the filetype for a single file, use a [modeline](https://vim.fandom.com/wiki/Modeline_magic):
```bash ```
<!-- vim: set ft=html :--> <!-- vim: set ft=html :-->
``` ```
## Visual Studio Code
To treat `*.svelte` files as HTML, add the following lines to your `settings.json` file:
```cson
"files.associations": {
"*.svelte": "html"
}
```
## JetBrains WebStorm
The [Svelte Framework Integration](https://plugins.jetbrains.com/plugin/12375-svelte/) can be used to add support for Svelte to WebStorm, or other Jetbrains IDEs. Consult the [WebStorm plugin installation guide](https://www.jetbrains.com/help/webstorm/managing-plugins.html) on the JetBrains website for more details.
## Sublime Text 3
Open any `.svelte` file.
Go to *__View → Syntax → Open all with current extension as... → HTML__*.

@ -3,7 +3,109 @@ title: Svelte for new developers
description: Never used Node.js or the command line? No problem description: Never used Node.js or the command line? No problem
author: Rich Harris author: Rich Harris
authorURL: https://twitter.com/Rich_Harris authorURL: https://twitter.com/Rich_Harris
draft: true
--- ---
*Coming soon* This blog post will walk you through installing Node.js and git and using Terminal.app to clone a project template and start developing with Svelte This short guide is designed to help you — someone who has looked at the [tutorial](/tutorial) and wants to start creating Svelte apps, but doesn't have a ton of experience using JavaScript build tooling — get up and running.
If there are things that don't make sense, or that we're glossing over, feel free to [raise an issue](https://github.com/sveltejs/svelte/issues) or [suggest edits to this page](https://github.com/sveltejs/svelte/blob/master/site/content/blog/2019-04-16-svelte-for-new-developers.md) that will help us help more people.
If you get stuck at any point following this guide, the best place to ask for help is in the [chatroom](https://svelte.dev/chat).
## First things first
You'll be using the *command line*, also known as the terminal. On Windows, you can access it by running **Command Prompt** from the Start menu; on a Mac, hit `Cmd` and `Space` together to bring up **Spotlight**, then start typing `Terminal.app`. On most Linux systems, `Ctrl-Alt-T` brings up the command line.
The command line is a way to interact with your computer (or another computer! but that's a topic for another time) with more power and control than the GUI (graphical user interface) that most people use day-to-day.
Once on the command line, you can navigate the filesystem using `ls` (`dir` on Windows) to list the contents of your current directory, and `cd` to change the current directory. For example, if you had a `Development` directory of your projects inside your home directory, you would type
```bash
cd Development
```
to go to it. From there, you could create a new project directory with the `mkdir` command:
```bash
mkdir svelte-projects
cd svelte-projects
```
A full introduction to the command line is out of the scope of this guide, but here are a few more useful commands:
* `cd ..` — navigates to the parent of the current directory
* `cat my-file.txt` — on Mac/Linux (`type my-file.txt` on Windows), lists the contents of `my-file.txt`
* `open .` (or `start .` on Windows) — opens the current directory in Finder or File Explorer
## Installing Node.js
[Node](https://nodejs.org/en/) is a way to run JavaScript on the command line. It's used by many tools, including Svelte. If you don't yet have it installed, the easiest way is to download the latest version straight from the [website](https://nodejs.org/en/).
Once installed, you'll have access to three new commands:
* `node my-file.js` — runs the JavaScript in `my-file.js`
* `npm [subcommand]` — [npm](https://www.npmjs.com/) is a way to install 'packages' that your application depends on, such as the [svelte](https://www.npmjs.com/) package
* `npx [subcommand]` — a convenient way to run programs available on npm without permanently installing them
## Installing a text editor
To write code, you need a good editor. The most popular choice is [Visual Studio Code](https://code.visualstudio.com/) or VSCode, and justifiably so — it's well-designed and fully-featured, and has a wealth of extensions ([including one for Svelte](https://marketplace.visualstudio.com/items?itemName=JamesBirtles.svelte-vscode), which provides syntax highlighting and diagnostic messages when you're writing components).
## Creating a project
We're going to follow the instructions in part two of [The easiest way to get started with Svelte](/blog/the-easiest-way-to-get-started).
First, we'll use npx to run [degit](https://github.com/Rich-Harris/degit), a program for cloning project templates from [GitHub](https://github.com) and other code storage websites. You don't have to use a project template, but it means you have to do a lot less setup work.
(Eventually you'll probably have to learn [git](https://git-scm.com/), which most programmers use to manage their projects. But you don't need to worry about it just yet.)
On the command line, navigate to where you want to create a new project, then type the following lines (you can paste the whole lot, but you'll develop better muscle memory if you get into the habit of writing each line out one at a time then running it):
```bash
npx degit sveltejs/template my-svelte-project
cd my-svelte-project
npm install
```
This creates a new directory, `my-svelte-project`, adds files from the [sveltejs/template](https://github.com/sveltejs/template) code repository, and installs a number of packages from npm. Open the directory in your text editor and take a look around. The app's 'source code' lives in the `src` directory, while the files your app can load are in `public`.
In the `package.json` file, there is a section called `"scripts"`. These scripts define shortcuts for working with your application — `dev`, `build` and `start`. To launch your app in development mode, type the following:
> TODO update the template, it needs... some work
```bash
npm run dev
```
Running the `dev` script starts a program called [Rollup](https://rollupjs.org/guide/en/). Rollup's job is to take your application's source files (so far, just `src/main.js` and `src/App.svelte`), pass them to other programs (including Svelte, in our case) and convert them into the code that will actually run when you open the application in a browser.
Speaking of which, open a browser and navigate to http://localhost:5000. This is your application running on a local *web server* (hence 'localhost') on port 5000.
Try changing `src/App.svelte` and saving it. The application will reload with your changes.
## Building your app
In the last step, we were running the app in 'development mode'. In dev mode, Svelte adds extra code that helps with debugging, and Rollup skips the final step where your app's JavaScript is compressed using [Terser](https://terser.org/).
When you share your app with the world, you want to build it in 'production mode', so that it's as small and efficient as possible for end users. To do that, use the `build` command:
```bash
npm run build
```
Your `public` directory now contains a compressed `bundle.js` file containing your app's JavaScript. You can run it like so:
```bash
npm run start
```
This will run the app on http://localhost:5000.
## Next steps
To share your app with the world you'll need to *deploy* it. There are many ways to do so — some are listed in the `README.md` file inside your project.

@ -159,6 +159,6 @@ In Vue, meanwhile, we have a default export with a `data` function that returns
## Death to boilerplate ## Death to boilerplate
These are just some of the ways that Svelte helps you build user interfaces with a minimum of fuss. There are plenty of others — for example, [reactive declarations](https://svelte.dev/tutorial/reactive-declarations) essentially do the work of React's `useMemo`, `useCallback` and `useEffect` without the boilerplate (or indeed the garbage collection overhead of creating inline functions and arrays on each state change). These are just some of the ways that Svelte helps you build user interfaces with a minimum of fuss. There are plenty of others — for example, [reactive declarations](tutorial/reactive-declarations) essentially do the work of React's `useMemo`, `useCallback` and `useEffect` without the boilerplate (or indeed the garbage collection overhead of creating inline functions and arrays on each state change).
How? By choosing a different set of constraints. Because [Svelte is a compiler](blog/frameworks-without-the-framework), we're not bound to the peculiarities of JavaScript: we can *design* a component authoring experience, rather than having to fit it around the semantics of the language. Paradoxically, this results in *more* idiomatic code — for example using variables naturally rather than via proxies or hooks — while delivering significantly more performant apps. How? By choosing a different set of constraints. Because [Svelte is a compiler](blog/frameworks-without-the-framework), we're not bound to the peculiarities of JavaScript: we can *design* a component authoring experience, rather than having to fit it around the semantics of the language. Paradoxically, this results in *more* idiomatic code — for example using variables naturally rather than via proxies or hooks — while delivering significantly more performant apps.

@ -2,8 +2,8 @@
title: Before we begin title: Before we begin
--- ---
> Temporary note: This document is a work-in-progress. Please forgive any missing or misleading parts, and don't be shy about asking for help in the [Discord chatroom](chat). The [tutorial](tutorial) is more complete; start there.
This page contains detailed API reference documentation. It's intended to be a resource for people who already have some familiarity with Svelte. This page contains detailed API reference documentation. It's intended to be a resource for people who already have some familiarity with Svelte.
If that's not you (yet), you may prefer to visit the [interactive tutorial](tutorial) or the [examples](examples) before consulting this reference. If that's not you (yet), you may prefer to visit the [interactive tutorial](tutorial) or the [examples](examples) before consulting this reference.
Don't be shy about asking for help in the [Discord chatroom](chat).

@ -42,13 +42,13 @@ Svelte uses the `export` keyword to mark a variable declaration as a *property*
--- ---
You can specify a default value, which will be used if the component's consumer doesn't specify a prop. You can specify a default initial value for a prop. It will be used if the component's consumer doesn't specify the prop on the component (or if its initial value is `undefined`) when instantiating the component. Note that whenever a prop is removed by the consumer, its value is set to `undefined` rather than the initial value.
In development mode (see the [compiler options](docs#svelte_compile)), a warning will be printed if no default is provided and the consumer does not specify a value. To squelch this warning, ensure that a default is specified, even if it is `undefined`. In development mode (see the [compiler options](docs#svelte_compile)), a warning will be printed if no default initial value is provided and the consumer does not specify a value. To squelch this warning, ensure that a default initial value is specified, even if it is `undefined`.
```html ```html
<script> <script>
export let bar = 'optional default value'; export let bar = 'optional default initial value';
export let baz = undefined; export let baz = undefined;
</script> </script>
``` ```
@ -147,24 +147,7 @@ If a statement consists entirely of an assignment to an undeclared variable, Sve
--- ---
A *store* is any object that allows reactive access to a value via a simple *store contract*. A *store* is an object that allows reactive access to a value via a simple *store contract*. The [`svelte/store` module](docs#svelte_store) contains minimal store implementations which fulfil this contract.
The [`svelte/store` module](docs#svelte_store) contains minimal store implementations which fulfil this contract. You can use these as the basis for your own stores, or you can implement your stores from scratch.
A store must contain a `.subscribe` method, which must accept as its argument a subscription function. This subscription function must be immediately and synchronously called with the store's current value upon calling `.subscribe`. All of a store's active subscription functions must later be synchronously called whenever the store's value changes. The `.subscribe` method must also return an unsubscription function. Calling an unsubscription function must stop its subscription, and its corresponding subscription function must not be called again by the store.
A store may optionally contain a `.set` method, which must accept as its argument a new value for the store, and which synchronously calls all of the store's active subscription functions. Such a store is called a *writable store*.
```js
const unsubscribe = store.subscribe(value => {
console.log(value);
}); // logs `value`
// later...
unsubscribe();
```
---
Any time you have a reference to a store, you can access its value inside a component by prefixing it with the `$` character. This causes Svelte to declare the prefixed variable, and set up a store subscription that will be unsubscribed when appropriate. Any time you have a reference to a store, you can access its value inside a component by prefixing it with the `$` character. This causes Svelte to declare the prefixed variable, and set up a store subscription that will be unsubscribed when appropriate.
@ -189,6 +172,20 @@ Local variables (that do not represent store values) must *not* have a `$` prefi
</script> </script>
``` ```
##### Store contract
```js
store = { subscribe: (subscription: (value: any) => void) => () => void, set?: (value: any) => void }
```
You can create your own stores without relying on [`svelte/store`](docs#svelte_store), by implementing the *store contract*:
1. A store must contain a `.subscribe` method, which must accept as its argument a subscription function. This subscription function must be immediately and synchronously called with the store's current value upon calling `.subscribe`. All of a store's active subscription functions must later be synchronously called whenever the store's value changes.
2. The `.subscribe` method must return an unsubscribe function. Calling an unsubscribe function must stop its subscription, and its corresponding subscription function must not be called again by the store.
3. A store may *optionally* contain a `.set` method, which must accept as its argument a new value for the store, and which synchronously calls all of the store's active subscription functions. Such a store is called a *writable store*.
For interoperability with RxJS Observables, the `.subscribe` method is also allowed to return an object with an `.unsubscribe` method, rather than return the unsubscription function directly. Note however that unless `.subscribe` synchronously calls the subscription (which is not required by the Observable spec), Svelte will see the value of the store as `undefined` until it does.
### &lt;script context="module"&gt; ### &lt;script context="module"&gt;
@ -200,7 +197,7 @@ You can `export` bindings from this block, and they will become exports of the c
You cannot `export default`, since the default export is the component itself. You cannot `export default`, since the default export is the component itself.
> Variables defined in `module` scripts are not reactive — reassigning them will not trigger a rerender even though the variable itself will update. For values shared between multiple components, consider using a [store](https://svelte.dev/docs#svelte_store). > Variables defined in `module` scripts are not reactive — reassigning them will not trigger a rerender even though the variable itself will update. For values shared between multiple components, consider using a [store](docs#svelte_store).
```html ```html
<script context="module"> <script context="module">
@ -256,3 +253,15 @@ To apply styles to a selector globally, use the `:global(...)` modifier.
} }
</style> </style>
``` ```
---
If you want to make @keyframes that are accessible globally, you need to prepend your keyframe names with `-global-`.
The `-global-` part will be removed when compiled, and the keyframe then be referenced using just `my-animation-name` elsewhere in your code.
```html
<style>
@keyframes -global-my-animation-name {...}
</style>
```

@ -205,6 +205,8 @@ Iterating over lists of values can be done with an each block.
</ul> </ul>
``` ```
You can use each blocks to iterate over any array or array-like value — that is, any object with a `length` property.
--- ---
An each block can also specify an *index*, equivalent to the second argument in an `array.map(...)` callback: An each block can also specify an *index*, equivalent to the second argument in an `array.map(...)` callback:
@ -563,29 +565,38 @@ Elements with the `contenteditable` attribute support `innerHTML` and `textConte
--- ---
Media elements (`<audio>` and `<video>`) have their own set of bindings — four *readonly* ones... Media elements (`<audio>` and `<video>`) have their own set of bindings — six *readonly* ones...
* `duration` (readonly) — the total duration of the video, in seconds * `duration` (readonly) — the total duration of the video, in seconds
* `buffered` (readonly) — an array of `{start, end}` objects * `buffered` (readonly) — an array of `{start, end}` objects
* `seekable` (readonly) — ditto * `seekable` (readonly) — ditto
* `played` (readonly) — ditto * `played` (readonly) — ditto
* `seeking` (readonly) — boolean
* `ended` (readonly) — boolean
...and three *two-way* bindings: ...and four *two-way* bindings:
* `currentTime` — the current point in the video, in seconds * `currentTime` — the current point in the video, in seconds
* `playbackRate` — how fast to play the video, where 1 is 'normal'
* `paused` — this one should be self-explanatory * `paused` — this one should be self-explanatory
* `volume` — a value between 0 and 1 * `volume` — a value between 0 and 1
Videos additionally have readonly `videoWidth` and `videoHeight` bindings.
```html ```html
<video <video
src={clip} src={clip}
bind:duration bind:duration
bind:buffered bind:buffered
bind:seekable bind:seekable
bind:seeking
bind:played bind:played
bind:ended
bind:currentTime bind:currentTime
bind:paused bind:paused
bind:volume bind:volume
bind:videoWidth
bind:videoHeight
></video> ></video>
``` ```
@ -784,7 +795,7 @@ transition = (node: HTMLElement, params: any) => {
A transition is triggered by an element entering or leaving the DOM as a result of a state change. A transition is triggered by an element entering or leaving the DOM as a result of a state change.
Elements inside an *outroing* block are kept in the DOM until all current transitions have completed. When a block is transitioning out, elements inside the block are kept in the DOM until all current transitions have completed.
The `transition:` directive indicates a *bidirectional* transition, which means it can be smoothly reversed while the transition is in progress. The `transition:` directive indicates a *bidirectional* transition, which means it can be smoothly reversed while the transition is in progress.
@ -1145,7 +1156,7 @@ bind:property={variable}
--- ---
You can bind to component props using the same mechanism. You can bind to component props using the same syntax as for elements.
```html ```html
<Keypad bind:value={pin}/> <Keypad bind:value={pin}/>
@ -1193,14 +1204,16 @@ The content is exposed in the child component using the `<slot>` element, which
```html ```html
<!-- App.svelte --> <!-- App.svelte -->
<Widget></Widget>
<Widget> <Widget>
<p>this is some child content</p> <p>this is some child content that will overwrite the default slot content</p>
</Widget> </Widget>
<!-- Widget.svelte --> <!-- Widget.svelte -->
<div> <div>
<slot> <slot>
this will be rendered if someone does <Widget/> this fallback content will be rendered when no content is provided, like in the first example
</slot> </slot>
</div> </div>
``` ```
@ -1236,15 +1249,15 @@ The usual shorthand rules apply — `let:item` is equivalent to `let:item={item}
```html ```html
<!-- App.svelte --> <!-- App.svelte -->
<FancyList {items} let:item={item}> <FancyList {items} let:prop={thing}>
<div>{item.text}</div> <div>{thing.text}</div>
</FancyList> </FancyList>
<!-- FancyList.svelte --> <!-- FancyList.svelte -->
<ul> <ul>
{#each items as item} {#each items as item}
<li class="fancy"> <li class="fancy">
<slot item={item}></slot> <slot prop={item}></slot>
</li> </li>
{/each} {/each}
</ul> </ul>
@ -1257,7 +1270,7 @@ Named slots can also expose values. The `let:` directive goes on the element wit
```html ```html
<!-- App.svelte --> <!-- App.svelte -->
<FancyList {items}> <FancyList {items}>
<div slot="item" let:item={item}>{item.text}</div> <div slot="item" let:item>{item.text}</div>
<p slot="footer">Copyright (c) 2019 Svelte Industries</p> <p slot="footer">Copyright (c) 2019 Svelte Industries</p>
</FancyList> </FancyList>
@ -1265,7 +1278,7 @@ Named slots can also expose values. The `let:` directive goes on the element wit
<ul> <ul>
{#each items as item} {#each items as item}
<li class="fancy"> <li class="fancy">
<slot name="item" item={item}></slot> <slot name="item" {item}></slot>
</li> </li>
{/each} {/each}
</ul> </ul>
@ -1380,7 +1393,7 @@ As with `<svelte:window>`, this element allows you to add listeners to events on
--- ---
This element makes it possible to insert elements into `document.head`. During server-side rendering, `head` content exposed separately to the main `html` content. This element makes it possible to insert elements into `document.head`. During server-side rendering, `head` content is exposed separately to the main `html` content.
```html ```html
<svelte:head> <svelte:head>

@ -184,7 +184,7 @@ dispatch: ((name: string, detail?: any) => void) = createEventDispatcher();
--- ---
Creates an event dispatcher that can be used to dispatch [component events](docs#Component_events). Event dispatchers are functions that can take two arguments: `name` and `detail`. Creates an event dispatcher that can be used to dispatch [component events](docs#on_component_event). Event dispatchers are functions that can take two arguments: `name` and `detail`.
Component events created with `createEventDispatcher` create a [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent). These events do not [bubble](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events#Event_bubbling_and_capture) and are not cancellable with `event.preventDefault()`. The `detail` argument corresponds to the [CustomEvent.detail](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail) property and can contain any type of data. Component events created with `createEventDispatcher` create a [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent). These events do not [bubble](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events#Event_bubbling_and_capture) and are not cancellable with `event.preventDefault()`. The `detail` argument corresponds to the [CustomEvent.detail](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail) property and can contain any type of data.
@ -214,7 +214,11 @@ Events dispatched from child components can be listened to in their parent. Any
### `svelte/store` ### `svelte/store`
The `svelte/store` module exports functions for creating [stores](docs#4_Prefix_stores_with_$_to_access_their_values). The `svelte/store` module exports functions for creating [readable](docs#readable), [writable](docs#writable) and [derived](docs#derived) stores.
Keep in mind that you don't *have* to use these functions to enjoy the [reactive `$store` syntax](docs#4_Prefix_stores_with_$_to_access_their_values) in your components. Any object that correctly implements `.subscribe`, unsubscribe, and (optionally) `.set` is a valid store, and will work both with the special syntax, and with Svelte's built-in [`derived` stores](docs#derived).
This makes it possible to wrap almost any other reactive state handling library for use in Svelte. Read more about the [store contract](docs#Store_contract) to see what a correct implementation looks like.
#### `writable` #### `writable`
@ -433,6 +437,19 @@ Out of the box, Svelte will interpolate between two numbers, two arrays or two o
--- ---
If the initial value is `undefined` or `null`, the first value change will take effect immediately. This is useful when you have tweened values that are based on props, and don't want any motion when the component first renders.
```js
const size = tweened(undefined, {
duration: 300,
easing: cubicOut
});
$: $size = big ? 100 : 10;
```
---
The `interpolate` option allows you to tween between *any* arbitrary values. It must be an `(a, b) => t => value` function, where `a` is the starting value, `b` is the target value, `t` is a number between 0 and 1, and `value` is the result. For example, we can use the [d3-interpolate](https://github.com/d3/d3-interpolate) package to smoothly interpolate between two colours. The `interpolate` option allows you to tween between *any* arbitrary values. It must be an `(a, b) => t => value` function, where `a` is the starting value, `b` is the target value, `t` is a number between 0 and 1, and `value` is the result. For example, we can use the [d3-interpolate](https://github.com/d3/d3-interpolate) package to smoothly interpolate between two colours.
```html ```html
@ -476,7 +493,7 @@ A `spring` store gradually changes to its target value based on its `stiffness`
--- ---
As with [`tweened`](#tweened) stores, `set` and `update` return a Promise that resolves if the spring settles. The `store.stiffness` and `store.damping` properties can be changed while the spring is in motion, and will take immediate effect. As with [`tweened`](docs#tweened) stores, `set` and `update` return a Promise that resolves if the spring settles. The `store.stiffness` and `store.damping` properties can be changed while the spring is in motion, and will take immediate effect.
Both `set` and `update` can take a second argument — an object with `hard` or `soft` properties. `{ hard: true }` sets the target value immediately; `{ soft: n }` preserves existing momentum for `n` seconds before settling. `{ soft: true }` is equivalent to `{ soft: 0.5 }`. Both `set` and `update` can take a second argument — an object with `hard` or `soft` properties. `{ hard: true }` sets the target value immediately; `{ soft: n }` preserves existing momentum for `n` seconds before settling. `{ soft: true }` is equivalent to `{ soft: 0.5 }`.
@ -493,6 +510,15 @@ Both `set` and `update` can take a second argument — an object with `hard` or
</script> </script>
``` ```
---
If the initial value is `undefined` or `null`, the first value change will take effect immediately, just as with `tweened` values (see above).
```js
const size = spring();
$: $size = big ? 100 : 10;
```
### `svelte/transition` ### `svelte/transition`
The `svelte/transition` module exports six functions: `fade`, `fly`, `slide`, `scale`, `draw` and `crossfade`. They are for use with svelte [`transitions`](docs#Transitions). The `svelte/transition` module exports six functions: `fade`, `fly`, `slide`, `scale`, `draw` and `crossfade`. They are for use with svelte [`transitions`](docs#Transitions).
@ -861,7 +887,7 @@ Existing children of `target` are left where they are.
--- ---
The `hydrate` option instructs Svelte to upgrade existing DOM (usually from server-side rendering) rather than creating new elements. It will only work if the component was compiled with the [`hydratable: true` option](docs#svelte_compile). The `hydrate` option instructs Svelte to upgrade existing DOM (usually from server-side rendering) rather than creating new elements. It will only work if the component was compiled with the [`hydratable: true` option](docs#svelte_compile). Hydration of `<head>` elements only works properly if the server-side rendering code was also compiled with `hydratable: true`, which adds a marker to each element in the `<head>` so that the component knows which elements it's responsible for removing during hydration.
Whereas children of `target` are normally left alone, `hydrate: true` will cause any children to be removed. For that reason, the `anchor` option cannot be used alongside `hydrate: true`. Whereas children of `target` are normally left alone, `hydrate: true` will cause any children to be removed. For that reason, the `anchor` option cannot be used alongside `hydrate: true`.
@ -945,7 +971,7 @@ app.count += 1;
--- ---
Svelte components can also be compiled to custom elements (aka web components) using the `customElements: true` compiler option. You should specify a tag name for the component using the `<svelte:options>` [element](docs#svelte_options). Svelte components can also be compiled to custom elements (aka web components) using the `customElement: true` compiler option. You should specify a tag name for the component using the `<svelte:options>` [element](docs#svelte_options).
```html ```html
<svelte:options tag="my-element"> <svelte:options tag="my-element">
@ -1019,8 +1045,12 @@ Unlike client-side components, server-side components don't have a lifespan afte
A server-side component exposes a `render` method that can be called with optional props. It returns an object with `head`, `html`, and `css` properties, where `head` contains the contents of any `<svelte:head>` elements encountered. A server-side component exposes a `render` method that can be called with optional props. It returns an object with `head`, `html`, and `css` properties, where `head` contains the contents of any `<svelte:head>` elements encountered.
You can import a Svelte component directly into Node using [`svelte/register`](docs#svelte_register).
```js ```js
const App = require('./App.svelte'); require('svelte/register');
const App = require('./App.svelte').default;
const { head, html, css } = App.render({ const { head, html, css } = App.render({
answer: 42 answer: 42

@ -4,9 +4,9 @@ title: Compile time
Typically, you won't interact with the Svelte compiler directly, but will instead integrate it into your build system using a bundler plugin: Typically, you won't interact with the Svelte compiler directly, but will instead integrate it into your build system using a bundler plugin:
* [rollup-plugin-svelte](https://github.com/rollup/rollup-plugin-svelte) for users of [Rollup](https://rollupjs.org) * [rollup-plugin-svelte](https://github.com/sveltejs/rollup-plugin-svelte) for users of [Rollup](https://rollupjs.org)
* [svelte-loader](https://github.com/sveltejs/svelte-loader) for users of [webpack](https://webpack.js.org) * [svelte-loader](https://github.com/sveltejs/svelte-loader) for users of [webpack](https://webpack.js.org)
* [parcel-plugin-svelte](https://github.com/DeMoorJasper/parcel-plugin-svelte) for users of [Parcel](https://parceljs.org/) * or one of the [community-maintained plugins](https://github.com/sveltejs/integrations#bundler-plugins)
Nonetheless, it's useful to understand how to use the compiler, since bundler plugins generally expose compiler options to you. Nonetheless, it's useful to understand how to use the compiler, since bundler plugins generally expose compiler options to you.
@ -53,6 +53,7 @@ The following options can be passed to the compiler. None are required:
| `tag` | string | null | `tag` | string | null
| `accessors` | boolean | `false` | `accessors` | boolean | `false`
| `css` | boolean | `true` | `css` | boolean | `true`
| `loopGuardTimeout` | number | 0
| `preserveComments` | boolean | `false` | `preserveComments` | boolean | `false`
| `preserveWhitespace` | boolean | `false` | `preserveWhitespace` | boolean | `false`
| `outputFilename` | string | `null` | `outputFilename` | string | `null`
@ -67,14 +68,15 @@ The following options can be passed to the compiler. None are required:
| `generate` | `"dom"` | If `"dom"`, Svelte emits a JavaScript class for mounting to the DOM. If `"ssr"`, Svelte emits an object with a `render` method suitable for server-side rendering. If `false`, no JavaScript or CSS is returned; just metadata. | `generate` | `"dom"` | If `"dom"`, Svelte emits a JavaScript class for mounting to the DOM. If `"ssr"`, Svelte emits an object with a `render` method suitable for server-side rendering. If `false`, no JavaScript or CSS is returned; just metadata.
| `dev` | `false` | If `true`, causes extra code to be added to components that will perform runtime checks and provide debugging information during development. | `dev` | `false` | If `true`, causes extra code to be added to components that will perform runtime checks and provide debugging information during development.
| `immutable` | `false` | If `true`, tells the compiler that you promise not to mutate any objects. This allows it to be less conservative about checking whether values have changed. | `immutable` | `false` | If `true`, tells the compiler that you promise not to mutate any objects. This allows it to be less conservative about checking whether values have changed.
| `hydratable` | `false` | If `true`, enables the `hydrate: true` runtime option, which allows a component to upgrade existing DOM rather than creating new DOM from scratch. | `hydratable` | `false` | If `true` when generating DOM code, enables the `hydrate: true` runtime option, which allows a component to upgrade existing DOM rather than creating new DOM from scratch. When generating SSR code, this adds markers to `<head>` elements so that hydration knows which to replace.
| `legacy` | `false` | If `true`, generates code that will work in IE9 and IE10, which don't support things like `element.dataset`. | `legacy` | `false` | If `true`, generates code that will work in IE9 and IE10, which don't support things like `element.dataset`.
| `accessors` | `false` | If `true`, getters and setters will be created for the component's props. If `false`, they will only be created for readonly exported values (i.e. those declared with `const`, `class` and `function`). If compiling with `customElement: true` this option defaults to `true`. | `accessors` | `false` | If `true`, getters and setters will be created for the component's props. If `false`, they will only be created for readonly exported values (i.e. those declared with `const`, `class` and `function`). If compiling with `customElement: true` this option defaults to `true`.
| `customElement` | `false` | If `true`, tells the compiler to generate a custom element constructor instead of a regular Svelte component. | `customElement` | `false` | If `true`, tells the compiler to generate a custom element constructor instead of a regular Svelte component.
| `tag` | `null` | A `string` that tells Svelte what tag name to register the custom element with. It must be a lowercase alphanumeric string with at least one hyphen, e.g. `"my-element"`. | `tag` | `null` | A `string` that tells Svelte what tag name to register the custom element with. It must be a lowercase alphanumeric string with at least one hyphen, e.g. `"my-element"`.
| `css` | `true` | If `true`, styles will be included in the JavaScript class and injected at runtime. It's recommended that you set this to `false` and use the CSS that is statically generated, as it will result in smaller JavaScript bundles and better performance. | `css` | `true` | If `true`, styles will be included in the JavaScript class and injected at runtime. It's recommended that you set this to `false` and use the CSS that is statically generated, as it will result in smaller JavaScript bundles and better performance.
| `loopGuardTimeout` | 0 | A `number` that tells Svelte to break the loop if it blocks the thread for more than `loopGuardTimeout` ms. This is useful to prevent infinite loops. **Only available when `dev: true`**
| `preserveComments` | `false` | If `true`, your HTML comments will be preserved during server-side rendering. By default, they are stripped out. | `preserveComments` | `false` | If `true`, your HTML comments will be preserved during server-side rendering. By default, they are stripped out.
| `preserveWhitespace` | `false` | If `true`, whitespace inside and between elements is kept as you typed it, rather than optimised by Svelte. | `preserveWhitespace` | `false` | If `true`, whitespace inside and between elements is kept as you typed it, rather than removed or collapsed to a single space where possible.
| `outputFilename` | `null` | A `string` used for your JavaScript sourcemap. | `outputFilename` | `null` | A `string` used for your JavaScript sourcemap.
| `cssOutputFilename` | `null` | A `string` used for your CSS sourcemap. | `cssOutputFilename` | `null` | A `string` used for your CSS sourcemap.
| `sveltePath` | `"svelte"` | The location of the `svelte` package. Any imports from `svelte` or `svelte/[module]` will be modified accordingly. | `sveltePath` | `"svelte"` | The location of the `svelte` package. Any imports from `svelte` or `svelte/[module]` will be modified accordingly.
@ -183,7 +185,7 @@ const ast = svelte.parse(source, { filename: 'App.svelte' });
result: { result: {
code: string, code: string,
dependencies: Array<string> dependencies: Array<string>
} = svelte.preprocess( } = await svelte.preprocess(
source: string, source: string,
preprocessors: Array<{ preprocessors: Array<{
markup?: (input: { content: string, filename: string }) => Promise<{ markup?: (input: { content: string, filename: string }) => Promise<{
@ -220,7 +222,7 @@ The `markup` function receives the entire component source text, along with the
```js ```js
const svelte = require('svelte/compiler'); const svelte = require('svelte/compiler');
const { code } = svelte.preprocess(source, { const { code } = await svelte.preprocess(source, {
markup: ({ content, filename }) => { markup: ({ content, filename }) => {
return { return {
code: content.replace(/foo/g, 'bar') code: content.replace(/foo/g, 'bar')
@ -235,14 +237,14 @@ const { code } = svelte.preprocess(source, {
The `script` and `style` functions receive the contents of `<script>` and `<style>` elements respectively. In addition to `filename`, they get an object of the element's attributes. The `script` and `style` functions receive the contents of `<script>` and `<style>` elements respectively. In addition to `filename`, they get an object of the element's attributes.
If a `dependencies` array is returned, it will be included in the result object. This is used by packages like [rollup-plugin-svelte](https://github.com/rollup/rollup-plugin-svelte) to watch additional files for changes, in the case where your `<style>` tag has an `@import` (for example). If a `dependencies` array is returned, it will be included in the result object. This is used by packages like [rollup-plugin-svelte](https://github.com/sveltejs/rollup-plugin-svelte) to watch additional files for changes, in the case where your `<style>` tag has an `@import` (for example).
```js ```js
const svelte = require('svelte/compiler'); const svelte = require('svelte/compiler');
const sass = require('node-sass'); const sass = require('node-sass');
const { dirname } = require('path'); const { dirname } = require('path');
const { code, dependencies } = svelte.preprocess(source, { const { code, dependencies } = await svelte.preprocess(source, {
style: async ({ content, attributes, filename }) => { style: async ({ content, attributes, filename }) => {
// only process <style lang="sass"> // only process <style lang="sass">
if (attributes.lang !== 'sass') return; if (attributes.lang !== 'sass') return;
@ -275,7 +277,7 @@ Multiple preprocessors can be used together. The output of the first becomes the
```js ```js
const svelte = require('svelte/compiler'); const svelte = require('svelte/compiler');
const { code } = svelte.preprocess(source, [ const { code } = await svelte.preprocess(source, [
{ {
markup: () => { markup: () => {
console.log('this runs first'); console.log('this runs first');

@ -1,7 +1,7 @@
<style> <style>
p { p {
color: purple; color: purple;
font-family: 'Comic Sans MS'; font-family: 'Comic Sans MS', cursive;
font-size: 2em; font-size: 2em;
} }
</style> </style>

@ -5,7 +5,7 @@
<style> <style>
p { p {
color: purple; color: purple;
font-family: 'Comic Sans MS'; font-family: 'Comic Sans MS', cursive;
font-size: 2em; font-size: 2em;
} }
</style> </style>

@ -1,9 +1,9 @@
<script> <script>
import FancyButton from './FancyButton.svelte'; import CustomButton from './CustomButton.svelte';
function handleClick() { function handleClick() {
alert('clicked'); alert('clicked');
} }
</script> </script>
<FancyButton on:click={handleClick}/> <CustomButton on:click={handleClick}/>

@ -0,0 +1,22 @@
<style>
button {
height: 4rem;
width: 8rem;
background-color: #aaa;
border-color: #f1c40f;
color: #f1c40f;
font-size: 1.25rem;
background-image: linear-gradient(45deg, #f1c40f 50%, transparent 50%);
background-position: 100%;
background-size: 400%;
transition: background 300ms ease-in-out;
}
button:hover {
background-position: 0;
color: #aaa;
}
</style>
<button on:click>
Click me
</button>

@ -1,15 +0,0 @@
<style>
button {
font-family: 'Comic Sans MS';
font-size: 2em;
padding: 0.5em 1em;
color: royalblue;
background: gold;
border-radius: 1em;
box-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}
</style>
<button on:click>
Click me
</button>

@ -14,7 +14,7 @@
showControlsTimeout = setTimeout(() => showControls = false, 2500); showControlsTimeout = setTimeout(() => showControls = false, 2500);
showControls = true; showControls = true;
if (e.which !== 1) return; // mouse not down if (!(e.buttons & 1)) return; // mouse not down
if (!duration) return; // video not loaded yet if (!duration) return; // video not loaded yet
const { left, right } = this.getBoundingClientRect(); const { left, right } = this.getBoundingClientRect();

@ -43,8 +43,8 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
background-color: #666; background-color: #666;
-webkit-mask: url(logo-mask.svg) 50% 50% no-repeat; -webkit-mask: url(svelte-logo-mask.svg) 50% 50% no-repeat;
mask: url(logo-mask.svg) 50% 50% no-repeat; mask: url(svelte-logo-mask.svg) 50% 50% no-repeat;
} }
</style> </style>

@ -33,7 +33,7 @@
font-family: 'Overpass'; font-family: 'Overpass';
letter-spacing: 0.12em; letter-spacing: 0.12em;
color: #676778; color: #676778;
font-weight: 100; font-weight: 400;
} }
.centered span { .centered span {
@ -71,4 +71,4 @@
toggle me toggle me
</label> </label>
<link href="https://fonts.googleapis.com/css?family=Overpass:100" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Overpass:100,400" rel="stylesheet">

@ -1,70 +1,20 @@
<script> <script>
let language = "english"; import { longpress } from './longpress.js';
const translations = { let pressed = false;
english: { let duration = 2000;
tooltip: "Switch Languages", </script>
},
latin: {
tooltip: "Itchsway Anguageslay",
}
};
function tooltip(node, text) {
const tooltip = document.createElement('div');
tooltip.textContent = text;
Object.assign(tooltip.style, {
position: 'absolute',
background: 'black',
color: 'white',
padding: '0.5em 1em',
fontSize: '12px',
pointerEvents: 'none',
transform: 'translate(5px, -50%)',
borderRadius: '2px',
transition: 'opacity 0.4s'
});
function position() {
const { top, right, bottom } = node.getBoundingClientRect();
tooltip.style.top = `${(top + bottom) / 2}px`;
tooltip.style.left = `${right}px`;
}
function append() {
document.body.appendChild(tooltip);
tooltip.style.opacity = 0;
setTimeout(() => tooltip.style.opacity = 1);
position();
}
function remove() {
tooltip.remove();
}
node.addEventListener('mouseenter', append);
node.addEventListener('mouseleave', remove);
return {
update(text) {
tooltip.textContent = text;
position();
},
destroy() { <label>
tooltip.remove(); <input type=range bind:value={duration} max={2000} step={100}>
node.removeEventListener('mouseenter', append); {duration}ms
node.removeEventListener('mouseleave', remove); </label>
}
};
}
function toggleLanguage() { <button use:longpress={duration}
language = language === 'english' ? 'latin' : 'english' on:longpress="{() => pressed = true}"
} on:mouseenter="{() => pressed = false}"
</script> >press and hold</button>
<button on:click={toggleLanguage} use:tooltip={translations[language].tooltip}> {#if pressed}
{language} <p>congratulations, you pressed and held for {duration}ms</p>
</button> {/if}

@ -0,0 +1,28 @@
export function longpress(node, duration) {
let timer;
const handleMousedown = () => {
timer = setTimeout(() => {
node.dispatchEvent(
new CustomEvent('longpress')
);
}, duration);
};
const handleMouseup = () => {
clearTimeout(timer)
};
node.addEventListener('mousedown', handleMousedown);
node.addEventListener('mouseup', handleMouseup);
return {
update(newDuration) {
duration = newDuration;
},
destroy() {
node.removeEventListener('mousedown', handleMousedown);
node.removeEventListener('mouseup', handleMouseup);
}
};
}

@ -1,9 +1,56 @@
<script> <script>
import { createEventDispatcher } from 'svelte'; import { createEventDispatcher, onDestroy } from 'svelte';
const dispatch = createEventDispatcher(); const dispatch = createEventDispatcher();
const close = () => dispatch('close');
let modal;
const handle_keydown = e => {
if (e.key === 'Escape') {
close();
return;
}
if (e.key === 'Tab') {
// trap focus
const nodes = modal.querySelectorAll('*');
const tabbable = Array.from(nodes).filter(n => n.tabIndex >= 0);
let index = tabbable.indexOf(document.activeElement);
if (index === -1 && e.shiftKey) index = 0;
index += tabbable.length + (e.shiftKey ? -1 : 1);
index %= tabbable.length;
tabbable[index].focus();
e.preventDefault();
}
};
const previously_focused = typeof document !== 'undefined' && document.activeElement;
if (previously_focused) {
onDestroy(() => {
previously_focused.focus();
});
}
</script> </script>
<svelte:window on:keydown={handle_keydown}/>
<div class="modal-background" on:click={close}></div>
<div class="modal" role="dialog" aria-modal="true" bind:this={modal}>
<slot name="header"></slot>
<hr>
<slot></slot>
<hr>
<!-- svelte-ignore a11y-autofocus -->
<button autofocus on:click={close}>close modal</button>
</div>
<style> <style>
.modal-background { .modal-background {
position: fixed; position: fixed;
@ -32,14 +79,3 @@
display: block; display: block;
} }
</style> </style>
<div class='modal-background' on:click='{() => dispatch("close")}'></div>
<div class='modal'>
<slot name='header'></slot>
<hr>
<slot></slot>
<hr>
<button on:click='{() => dispatch("close")}'>close modal</button>
</div>

@ -2,18 +2,9 @@
<script> <script>
let people = [ let people = [
{ { first: 'Hans', last: 'Emil' },
first: 'Hans', { first: 'Max', last: 'Mustermann' },
last: 'Emil' { first: 'Roman', last: 'Tisch' }
},
{
first: 'Max',
last: 'Mustermann'
},
{
first: 'Roman',
last: 'Tisch'
}
]; ];
let prefix = ''; let prefix = '';
@ -39,7 +30,9 @@
} }
function update() { function update() {
people[i] = { first, last }; selected.first = first;
selected.last = last;
people = people;
} }
function remove() { function remove() {

@ -11,7 +11,7 @@ export const title = css`
`; `;
export const comicSans = css` export const comicSans = css`
font-family: 'Comic Sans MS'; font-family: 'Comic Sans MS', cursive;
`; `;
export const box = css` export const box = css`

@ -1,7 +1,7 @@
<style> <style>
p { p {
color: purple; color: purple;
font-family: 'Comic Sans MS'; font-family: 'Comic Sans MS', cursive;
font-size: 2em; font-size: 2em;
} }
</style> </style>

@ -8,7 +8,7 @@ Just like in HTML, you can add a `<style>` tag to your component. Let's add some
<style> <style>
p { p {
color: purple; color: purple;
font-family: 'Comic Sans MS'; font-family: 'Comic Sans MS', cursive;
font-size: 2em; font-size: 2em;
} }
</style> </style>

@ -1,7 +1,7 @@
<style> <style>
p { p {
color: purple; color: purple;
font-family: 'Comic Sans MS'; font-family: 'Comic Sans MS', cursive;
font-size: 2em; font-size: 2em;
} }
</style> </style>

@ -5,7 +5,7 @@
<style> <style>
p { p {
color: purple; color: purple;
font-family: 'Comic Sans MS'; font-family: 'Comic Sans MS', cursive;
font-size: 2em; font-size: 2em;
} }
</style> </style>

@ -4,11 +4,12 @@ title: Making an app
This tutorial is designed to get you familiar with the process of writing components. But at some point, you'll want to start writing components in the comfort of your own text editor. This tutorial is designed to get you familiar with the process of writing components. But at some point, you'll want to start writing components in the comfort of your own text editor.
First, you'll need to integrate Svelte with a build tool. Popular choices are: First, you'll need to integrate Svelte with a build tool. There are officially maintained plugins for [Rollup](https://rollupjs.org) and [webpack](https://webpack.js.org/)...
* [Rollup](https://rollupjs.org) / [rollup-plugin-svelte](https://github.com/rollup/rollup-plugin-svelte) * [rollup-plugin-svelte](https://github.com/sveltejs/rollup-plugin-svelte)
* [webpack](https://webpack.js.org/) / [svelte-loader](https://github.com/sveltejs/svelte-loader) * [svelte-loader](https://github.com/sveltejs/svelte-loader)
* [Parcel](https://parceljs.org/) / [parcel-plugin-svelte](https://github.com/DeMoorJasper/parcel-plugin-svelte)
...and a variety of [community-maintained ones](https://github.com/sveltejs/integrations#bundler-plugins).
Don't worry if you're relatively new to web development and haven't used these tools before. We've prepared a simple step-by-step guide, [Svelte for new developers](blog/svelte-for-new-developers), which walks you through the process. Don't worry if you're relatively new to web development and haven't used these tools before. We've prepared a simple step-by-step guide, [Svelte for new developers](blog/svelte-for-new-developers), which walks you through the process.

@ -11,7 +11,7 @@ let count = 0;
$: doubled = count * 2; $: doubled = count * 2;
``` ```
> Don't worry if this looks a little alien. It's valid (if unconventional) JavaScript, which Svelte interprets to mean 're-run this code whenever any of the referenced values change'. Once you get used to it, there's no going back. > Don't worry if this looks a little alien. It's [valid](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label) (if unconventional) JavaScript, which Svelte interprets to mean 're-run this code whenever any of the referenced values change'. Once you get used to it, there's no going back.
Let's use `doubled` in our markup: Let's use `doubled` in our markup:

@ -30,3 +30,12 @@ function addNumber() {
numbers[numbers.length] = numbers.length + 1; numbers[numbers.length] = numbers.length + 1;
} }
``` ```
A simple rule of thumb: the name of the updated variable must appear on the left hand side of the assignment. For example this...
```js
const foo = obj.foo;
foo.bar = 'baz';
```
...won't update references to `obj.foo.bar`, unless you follow it up with `obj = obj`.

@ -1,9 +1,9 @@
<script> <script>
import FancyButton from './FancyButton.svelte'; import CustomButton from './CustomButton.svelte';
function handleClick() { function handleClick() {
alert('clicked'); alert('clicked');
} }
</script> </script>
<FancyButton on:click={handleClick}/> <CustomButton on:click={handleClick}/>

@ -0,0 +1,22 @@
<style>
button {
height: 4rem;
width: 8rem;
background-color: #aaa;
border-color: #f1c40f;
color: #f1c40f;
font-size: 1.25rem;
background-image: linear-gradient(45deg, #f1c40f 50%, transparent 50%);
background-position: 100%;
background-size: 400%;
transition: background 300ms ease-in-out;
}
button:hover {
background-position: 0;
color: #aaa;
}
</style>
<button>
Click me
</button>

@ -1,15 +0,0 @@
<style>
button {
font-family: 'Comic Sans MS';
font-size: 2em;
padding: 0.5em 1em;
color: royalblue;
background: gold;
border-radius: 1em;
box-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}
</style>
<button>
Click me
</button>

@ -1,9 +1,9 @@
<script> <script>
import FancyButton from './FancyButton.svelte'; import CustomButton from './CustomButton.svelte';
function handleClick() { function handleClick() {
alert('clicked'); alert('clicked');
} }
</script> </script>
<FancyButton on:click={handleClick}/> <CustomButton on:click={handleClick}/>

@ -0,0 +1,22 @@
<style>
button {
height: 4rem;
width: 8rem;
background-color: #aaa;
border-color: #f1c40f;
color: #f1c40f;
font-size: 1.25rem;
background-image: linear-gradient(45deg, #f1c40f 50%, transparent 50%);
background-position: 100%;
background-size: 400%;
transition: background 300ms ease-in-out;
}
button:hover {
background-position: 0;
color: #aaa;
}
</style>
<button on:click>
Click me
</button>

@ -1,15 +0,0 @@
<style>
button {
font-family: 'Comic Sans MS';
font-size: 2em;
padding: 0.5em 1em;
color: royalblue;
background: gold;
border-radius: 1em;
box-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}
</style>
<button on:click>
Click me
</button>

@ -4,7 +4,7 @@ title: DOM event forwarding
Event forwarding works for DOM events too. Event forwarding works for DOM events too.
We want to get notified of clicks on our `<FancyButton>` — to do that, we just need to forward `click` events on the `<button>` element in `FancyButton.svelte`: We want to get notified of clicks on our `<CustomButton>` — to do that, we just need to forward `click` events on the `<button>` element in `CustomButton.svelte`:
```html ```html
<button on:click> <button on:click>

@ -14,7 +14,7 @@
showControlsTimeout = setTimeout(() => showControls = false, 2500); showControlsTimeout = setTimeout(() => showControls = false, 2500);
showControls = true; showControls = true;
if (e.which !== 1) return; // mouse not down if (!(e.buttons & 1)) return; // mouse not down
if (!duration) return; // video not loaded yet if (!duration) return; // video not loaded yet
const { left, right } = this.getBoundingClientRect(); const { left, right } = this.getBoundingClientRect();

@ -14,7 +14,7 @@
showControlsTimeout = setTimeout(() => showControls = false, 2500); showControlsTimeout = setTimeout(() => showControls = false, 2500);
showControls = true; showControls = true;
if (e.which !== 1) return; // mouse not down if (!(e.buttons & 1)) return; // mouse not down
if (!duration) return; // video not loaded yet if (!duration) return; // video not loaded yet
const { left, right } = this.getBoundingClientRect(); const { left, right } = this.getBoundingClientRect();

@ -24,12 +24,14 @@ Now, when you click on the video, it will update `time`, `duration` and `paused`
> Ordinarily on the web, you would track `currentTime` by listening for `timeupdate` events. But these events fire too infrequently, resulting in choppy UI. Svelte does better — it checks `currentTime` using `requestAnimationFrame`. > Ordinarily on the web, you would track `currentTime` by listening for `timeupdate` events. But these events fire too infrequently, resulting in choppy UI. Svelte does better — it checks `currentTime` using `requestAnimationFrame`.
The complete set of bindings for `<audio>` and `<video>` is as follows — four *readonly* bindings... The complete set of bindings for `<audio>` and `<video>` is as follows — six *readonly* bindings...
* `duration` (readonly) — the total duration of the video, in seconds * `duration` (readonly) — the total duration of the video, in seconds
* `buffered` (readonly) — an array of `{start, end}` objects * `buffered` (readonly) — an array of `{start, end}` objects
* `seekable` (readonly) — ditto * `seekable` (readonly) — ditto
* `played` (readonly) — ditto * `played` (readonly) — ditto
* `seeking` (readonly) — boolean
* `ended` (readonly) — boolean
...and four *two-way* bindings: ...and four *two-way* bindings:
@ -37,3 +39,5 @@ The complete set of bindings for `<audio>` and `<video>` is as follows — four
* `playbackRate` — how fast to play the video, where `1` is 'normal' * `playbackRate` — how fast to play the video, where `1` is 'normal'
* `paused` — this one should be self-explanatory * `paused` — this one should be self-explanatory
* `volume` — a value between 0 and 1 * `volume` — a value between 0 and 1
Videos additionally have readonly `videoWidth` and `videoHeight` bindings.

@ -8,6 +8,7 @@
<style> <style>
input { display: block; } input { display: block; }
div { display: inline-block; } div { display: inline-block; }
span { word-break: break-all; }
</style> </style>
<input type=range bind:value={size}> <input type=range bind:value={size}>

@ -8,6 +8,7 @@
<style> <style>
input { display: block; } input { display: block; }
div { display: inline-block; } div { display: inline-block; }
span { word-break: break-all; }
</style> </style>
<input type=range bind:value={size}> <input type=range bind:value={size}>

@ -43,8 +43,8 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
background-color: #666; background-color: #666;
-webkit-mask: url(logo-mask.svg) 50% 50% no-repeat; -webkit-mask: url(svelte-logo-mask.svg) 50% 50% no-repeat;
mask: url(logo-mask.svg) 50% 50% no-repeat; mask: url(svelte-logo-mask.svg) 50% 50% no-repeat;
} }
</style> </style>

@ -43,8 +43,8 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
background-color: #666; background-color: #666;
-webkit-mask: url(logo-mask.svg) 50% 50% no-repeat; -webkit-mask: url(svelte-logo-mask.svg) 50% 50% no-repeat;
mask: url(logo-mask.svg) 50% 50% no-repeat; mask: url(svelte-logo-mask.svg) 50% 50% no-repeat;
} }
</style> </style>

@ -88,6 +88,7 @@
background-color: #0074D9; background-color: #0074D9;
color: white; color: white;
border-radius: 1em 1em 0 1em; border-radius: 1em 1em 0 1em;
word-break: break-all;
} }
</style> </style>

@ -88,6 +88,7 @@
background-color: #0074D9; background-color: #0074D9;
color: white; color: white;
border-radius: 1em 1em 0 1em; border-radius: 1em 1em 0 1em;
word-break: break-all;
} }
</style> </style>

@ -28,7 +28,7 @@ Clicking the buttons causes the progress bar to animate to its new value. It's a
</script> </script>
``` ```
> The `svelte/easing` module contains the [Penner easing equations](http://robertpenner.com/easing/), or you can supply your own `p => t` function where `p` and `t` are both values between 0 and 1. > The `svelte/easing` module contains the [Penner easing equations](https://web.archive.org/web/20190805215728/http://robertpenner.com/easing/), or you can supply your own `p => t` function where `p` and `t` are both values between 0 and 1.
The full set of options available to `tweened`: The full set of options available to `tweened`:

@ -23,7 +23,9 @@ import { pannable } from './pannable.js';
on:panstart={handlePanStart} on:panstart={handlePanStart}
on:panmove={handlePanMove} on:panmove={handlePanMove}
on:panend={handlePanEnd} on:panend={handlePanEnd}
style="transform: translate({$coords.x}px,{$coords.y}px)" style="transform:
translate({$coords.x}px,{$coords.y}px)
rotate({$coords.x * 0.2}deg)"
></div> ></div>
``` ```

@ -1,70 +1,20 @@
<script> <script>
let language = "english"; import { longpress } from './longpress.js';
const translations = { let pressed = false;
english: { let duration = 2000;
tooltip: "Switch Languages", </script>
},
latin: {
tooltip: "Itchsway Anguageslay",
}
};
function tooltip(node, text) {
const tooltip = document.createElement('div');
tooltip.textContent = text;
Object.assign(tooltip.style, {
position: 'absolute',
background: 'black',
color: 'white',
padding: '0.5em 1em',
fontSize: '12px',
pointerEvents: 'none',
transform: 'translate(5px, -50%)',
borderRadius: '2px',
transition: 'opacity 0.4s'
});
function position() {
const { top, right, bottom } = node.getBoundingClientRect();
tooltip.style.top = `${(top + bottom) / 2}px`;
tooltip.style.left = `${right}px`;
}
function append() {
document.body.appendChild(tooltip);
tooltip.style.opacity = 0;
setTimeout(() => tooltip.style.opacity = 1);
position();
}
function remove() {
tooltip.remove();
}
node.addEventListener('mouseenter', append);
node.addEventListener('mouseleave', remove);
return {
update(text) {
tooltip.textContent = text;
position();
},
destroy() { <label>
tooltip.remove(); <input type=range bind:value={duration} max={2000} step={100}>
node.removeEventListener('mouseenter', append); {duration}ms
node.removeEventListener('mouseleave', remove); </label>
}
};
}
function toggleLanguage() { <button use:longpress
language = language === 'english' ? 'latin' : 'english' on:longpress="{() => pressed = true}"
} on:mouseenter="{() => pressed = false}"
</script> >press and hold</button>
<button on:click={toggleLanguage} use:tooltip={translations[language].tooltip}> {#if pressed}
{language} <p>congratulations, you pressed and held for {duration}ms</p>
</button> {/if}

@ -0,0 +1,25 @@
export function longpress(node, duration) {
let timer;
const handleMousedown = () => {
timer = setTimeout(() => {
node.dispatchEvent(
new CustomEvent('longpress')
);
}, 500);
};
const handleMouseup = () => {
clearTimeout(timer)
};
node.addEventListener('mousedown', handleMousedown);
node.addEventListener('mouseup', handleMouseup);
return {
destroy() {
node.removeEventListener('mousedown', handleMousedown);
node.removeEventListener('mouseup', handleMouseup);
}
};
}

@ -1,70 +1,20 @@
<script> <script>
let language = "english"; import { longpress } from './longpress.js';
const translations = { let pressed = false;
english: { let duration = 2000;
tooltip: "Switch Languages", </script>
},
latin: {
tooltip: "Itchsway Anguageslay",
}
};
function tooltip(node, text) {
const tooltip = document.createElement('div');
tooltip.textContent = text;
Object.assign(tooltip.style, {
position: 'absolute',
background: 'black',
color: 'white',
padding: '0.5em 1em',
fontSize: '12px',
pointerEvents: 'none',
transform: 'translate(5px, -50%)',
borderRadius: '2px',
transition: 'opacity 0.4s'
});
function position() {
const { top, right, bottom } = node.getBoundingClientRect();
tooltip.style.top = `${(top + bottom) / 2}px`;
tooltip.style.left = `${right}px`;
}
function append() {
document.body.appendChild(tooltip);
tooltip.style.opacity = 0;
setTimeout(() => tooltip.style.opacity = 1);
position();
}
function remove() {
tooltip.remove();
}
node.addEventListener('mouseenter', append);
node.addEventListener('mouseleave', remove);
return {
update(text) {
tooltip.textContent = text;
position();
},
destroy() { <label>
tooltip.remove(); <input type=range bind:value={duration} max={2000} step={100}>
node.removeEventListener('mouseenter', append); {duration}ms
node.removeEventListener('mouseleave', remove); </label>
}
};
}
function toggleLanguage() { <button use:longpress={duration}
language = language === 'english' ? 'latin' : 'english' on:longpress="{() => pressed = true}"
} on:mouseenter="{() => pressed = false}"
</script> >press and hold</button>
<button on:click={toggleLanguage} use:tooltip={translations[language].tooltip}> {#if pressed}
{language} <p>congratulations, you pressed and held for {duration}ms</p>
</button> {/if}

@ -0,0 +1,28 @@
export function longpress(node, duration) {
let timer;
const handleMousedown = () => {
timer = setTimeout(() => {
node.dispatchEvent(
new CustomEvent('longpress')
);
}, duration);
};
const handleMouseup = () => {
clearTimeout(timer)
};
node.addEventListener('mousedown', handleMousedown);
node.addEventListener('mouseup', handleMouseup);
return {
update(newDuration) {
duration = newDuration;
},
destroy() {
node.removeEventListener('mousedown', handleMousedown);
node.removeEventListener('mouseup', handleMouseup);
}
};
}

@ -2,4 +2,45 @@
title: Adding parameters title: Adding parameters
--- ---
TODO come up with a better example Like transitions and animations, an action can take an argument, which the action function will be called with alongside the element it belongs to.
Here, we're using a `longpress` action that fires an event with the same name whenever the user presses and holds the button for a given duration. Right now, if you switch over to the `longpress.js` file, you'll see it's hardcoded to 500ms.
We can change the action function to accept a `duration` as a second argument, and pass that `duration` to the `setTimeout` call:
```js
export function longpress(node, duration) {
// ...
const handleMousedown = () => {
timer = setTimeout(() => {
node.dispatchEvent(
new CustomEvent('longpress')
);
}, duration);
};
// ...
}
```
Back in `App.svelte`, we can pass the `duration` value to the action:
```html
<button use:longpress={duration}
```
This *almost* works — the event now only fires after 2 seconds. But if you slide the duration down, it will still take two seconds.
To change that, we can add an `update` method in `longpress.js`. This will be called whenever the argument changes:
```js
return {
update(newDuration) {
duration = newDuration;
},
// ...
};
```
> If you need to pass multiple arguments to an action, combine them into a single object, as in `use:longpress={{duration, spiciness}}`

@ -3,7 +3,6 @@
import flash from './flash.js'; import flash from './flash.js';
export let todo; export let todo;
export let toggle;
let div; let div;

@ -5,7 +5,6 @@
import flash from './flash.js'; import flash from './flash.js';
export let todo; export let todo;
export let toggle;
let div; let div;

@ -1256,19 +1256,19 @@
} }
}, },
"@polka/redirect": { "@polka/redirect": {
"version": "1.0.0-next.0", "version": "1.0.0-next.7",
"resolved": "https://registry.npmjs.org/@polka/redirect/-/redirect-1.0.0-next.0.tgz", "resolved": "https://registry.npmjs.org/@polka/redirect/-/redirect-1.0.0-next.7.tgz",
"integrity": "sha512-ym6ooqMr09+cV+y52p5kszJ0jYcX+nJfm8POrQb7QYowvpPPuneZ71EclHrQSB7a50lcytgR/xtL6AUFdvyEkg==" "integrity": "sha512-sHh1oVy9VBVhn41fOlrUdlxFkcbKrYdBcqePTSxvf2NqKu7UcMPZse/wDeQZk17A8cqDArKsR4m0MXd+3/Q83g=="
}, },
"@polka/send": { "@polka/send": {
"version": "1.0.0-next.6", "version": "1.0.0-next.7",
"resolved": "https://registry.npmjs.org/@polka/send/-/send-1.0.0-next.6.tgz", "resolved": "https://registry.npmjs.org/@polka/send/-/send-1.0.0-next.7.tgz",
"integrity": "sha512-4ON4Yf/QcP9I6HmFvn8rspRdBQ6NupSkUvAkUKo4gT2SSSWrrHMqDVQJsvDr4BRGRIVZSg+gr6W3M9Xj3V3JSQ==" "integrity": "sha512-X/7sxWMfzuHuMXSls3SuOgfwcoNakuaNWciVS/KX3RML8NIPKQYgbhpqYPCujtXK9Z/KvW3/gzr2TUpabIJRMg=="
}, },
"@polka/url": { "@polka/url": {
"version": "1.0.0-next.3", "version": "1.0.0-next.9",
"resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.3.tgz", "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.9.tgz",
"integrity": "sha512-Uom7l6OeP6vcf85lMImelYu5WKVWjXyhkpi9WsRdRzlJFJFPVhjBtBCktgDUj7dk1N5FURUdegSZ5XOjxf8JZg==" "integrity": "sha512-VZqSaulg2kVQYMulmuZcvapPwH5/y81YHANiFIKz1GNZoG/F4o1JSeLlrvXJ8tC+RPUjxdrebfT3Qn+bnMi0bA=="
}, },
"@sindresorhus/slugify": { "@sindresorhus/slugify": {
"version": "0.9.1", "version": "0.9.1",
@ -1281,9 +1281,9 @@
} }
}, },
"@sveltejs/site-kit": { "@sveltejs/site-kit": {
"version": "1.1.3", "version": "1.1.4",
"resolved": "https://registry.npmjs.org/@sveltejs/site-kit/-/site-kit-1.1.3.tgz", "resolved": "https://registry.npmjs.org/@sveltejs/site-kit/-/site-kit-1.1.4.tgz",
"integrity": "sha512-cJfz45cqq1nfPnk1V3oYVMcSySI/GnbHyvr+vQAyHhmOpmknO3pYavXDj545YXWJvEXg2sk8Fxcah+Z/56Ka0Q==", "integrity": "sha512-PsFUX1C/fhV0ODdCJaEQ8OwzgmaPJVmdefiSYA+i6zttBeV19d/ow+l7SPMXxBkux+vUIl5can4BwValCukCsw==",
"dev": true, "dev": true,
"requires": { "requires": {
"@sindresorhus/slugify": "^0.9.1", "@sindresorhus/slugify": "^0.9.1",
@ -1291,17 +1291,24 @@
} }
}, },
"@sveltejs/svelte-repl": { "@sveltejs/svelte-repl": {
"version": "0.1.9", "version": "0.1.17",
"resolved": "https://registry.npmjs.org/@sveltejs/svelte-repl/-/svelte-repl-0.1.9.tgz", "resolved": "https://registry.npmjs.org/@sveltejs/svelte-repl/-/svelte-repl-0.1.17.tgz",
"integrity": "sha512-OXDfHwT5O7UXVYnf4ndTk3dKMITTmWcMty4/lOFte80ui01i47QiVy3GEe9G8FkcU1YBe+c06MMnIgm7j0Ln7Q==", "integrity": "sha512-rM0DC+pZnqwH6PiuxXUmFRwYZ9XNkexxTNt+prR91Qs7ssxGgf0QkH6kGivSNLbrOtOvcgJbt1nUDybWra5HKA==",
"dev": true, "dev": true,
"requires": { "requires": {
"codemirror": "^5.48.4", "codemirror": "^5.49.2",
"estree-walker": "^0.6.1", "estree-walker": "^0.9.0",
"sourcemap-codec": "^1.4.6", "sourcemap-codec": "^1.4.6",
"svelte-json-tree": "0.0.5",
"yootils": "0.0.16" "yootils": "0.0.16"
}, },
"dependencies": { "dependencies": {
"estree-walker": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.9.0.tgz",
"integrity": "sha512-12U47o7XHUX329+x3FzNVjCx3SHEzMF0nkDv7r/HnBzX/xNTKxajBk6gyygaxrAFtLj39219oMfbtxv4KpaOiA==",
"dev": true
},
"sourcemap-codec": { "sourcemap-codec": {
"version": "1.4.6", "version": "1.4.6",
"resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.6.tgz", "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.6.tgz",
@ -1587,9 +1594,9 @@
"dev": true "dev": true
}, },
"codemirror": { "codemirror": {
"version": "5.48.4", "version": "5.49.2",
"resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.48.4.tgz", "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.49.2.tgz",
"integrity": "sha512-pUhZXDQ6qXSpWdwlgAwHEkd4imA0kf83hINmUEzJpmG80T/XLtDDEzZo8f6PQLuRCcUQhmzqqIo3ZPTRaWByRA==", "integrity": "sha512-dwJ2HRPHm8w51WB5YTF9J7m6Z5dtkqbU9ntMZ1dqXyFB9IpjoUFDj80ahRVEoVanfIp6pfASJbOlbWdEf8FOzQ==",
"dev": true "dev": true
}, },
"color-convert": { "color-convert": {
@ -2510,9 +2517,9 @@
} }
}, },
"mime": { "mime": {
"version": "2.4.3", "version": "2.4.4",
"resolved": "https://registry.npmjs.org/mime/-/mime-2.4.3.tgz", "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz",
"integrity": "sha512-QgrPRJfE+riq5TPZMcHZOtm8c6K/yYrMbKIoRfapfiGLxS8OTeIfRhUGW5LU7MlRa52KOAGCfUNruqLrIBvWZw==" "integrity": "sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA=="
}, },
"mimic-fn": { "mimic-fn": {
"version": "2.1.0", "version": "2.1.0",
@ -3119,11 +3126,11 @@
"dev": true "dev": true
}, },
"polka": { "polka": {
"version": "1.0.0-next.6", "version": "1.0.0-next.9",
"resolved": "https://registry.npmjs.org/polka/-/polka-1.0.0-next.6.tgz", "resolved": "https://registry.npmjs.org/polka/-/polka-1.0.0-next.9.tgz",
"integrity": "sha512-e3vZm2cMmPPrgn+0J5DO0rrSTfsCHGyh+YS6jjrqYP8BHJkPq8nCVSDxHkaiEN4f0c2dtR6FB+snDmLE/sRz7A==", "integrity": "sha512-oAWH5O3CIPTzPKNx9KF9NDfy3KRyy9NtUhDEJGmMRCDT6s3CZaGDm7xafcKtm0uK6g0CBiNtoeGWpPFSLUXeaw==",
"requires": { "requires": {
"@polka/url": "^1.0.0-next.3", "@polka/url": "^1.0.0-next.9",
"trouter": "^3.1.0" "trouter": "^3.1.0"
} }
}, },
@ -3368,12 +3375,6 @@
"requires": { "requires": {
"@babel/helper-module-imports": "^7.0.0", "@babel/helper-module-imports": "^7.0.0",
"rollup-pluginutils": "^2.8.1" "rollup-pluginutils": "^2.8.1"
},
"dependencies": {
"estree-walker": {
"version": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz",
"integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w=="
}
} }
}, },
"rollup-plugin-commonjs": { "rollup-plugin-commonjs": {
@ -3411,10 +3412,6 @@
"rollup-pluginutils": "^2.8.1" "rollup-pluginutils": "^2.8.1"
}, },
"dependencies": { "dependencies": {
"estree-walker": {
"version": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz",
"integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w=="
},
"resolve": { "resolve": {
"version": "1.11.1", "version": "1.11.1",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.1.tgz", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.1.tgz",
@ -3458,12 +3455,6 @@
"rollup-pluginutils": "^2.8.1", "rollup-pluginutils": "^2.8.1",
"serialize-javascript": "^1.7.0", "serialize-javascript": "^1.7.0",
"terser": "^4.1.0" "terser": "^4.1.0"
},
"dependencies": {
"estree-walker": {
"version": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz",
"integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w=="
}
} }
}, },
"rollup-pluginutils": { "rollup-pluginutils": {
@ -3473,14 +3464,6 @@
"dev": true, "dev": true,
"requires": { "requires": {
"estree-walker": "^0.6.1" "estree-walker": "^0.6.1"
},
"dependencies": {
"estree-walker": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz",
"integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==",
"dev": true
}
} }
}, },
"safe-buffer": { "safe-buffer": {
@ -3600,19 +3583,13 @@
"dev": true "dev": true
}, },
"sirv": { "sirv": {
"version": "0.4.2", "version": "1.0.0-next.2",
"resolved": "https://registry.npmjs.org/sirv/-/sirv-0.4.2.tgz", "resolved": "https://registry.npmjs.org/sirv/-/sirv-1.0.0-next.2.tgz",
"integrity": "sha512-dQbZnsMaIiTQPZmbGmktz+c74zt/hyrJEB4tdp2Jj0RNv9J6B/OWR5RyrZEvIn9fyh9Zlg2OlE2XzKz6wMKGAw==", "integrity": "sha512-hWp0todr4jSb1BFBiANRmqYRXzX02l36/X4tyHPYKqMZ+e1hrDZKUjIIXrAOBRWlAE/G5cGImUciMrUcU8DeOg==",
"requires": { "requires": {
"@polka/url": "^0.5.0", "@polka/url": "^1.0.0-next.9",
"mime": "^2.3.1" "mime": "^2.3.1",
}, "totalist": "^1.0.0"
"dependencies": {
"@polka/url": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/@polka/url/-/url-0.5.0.tgz",
"integrity": "sha512-oZLYFEAzUKyi3SKnXvj32ZCEGH6RDnao7COuCVhDydMS9NrCSVXhM79VaKyP5+Zc33m0QXEd2DN3UkU7OsHcfw=="
}
} }
}, },
"source-map": { "source-map": {
@ -3780,6 +3757,12 @@
"integrity": "sha512-9/broj3bjShrsk3FuVDH0Bho2BchPKT8ubAqRcTqwkqrO9npOS3Vi98Yb5mBaa4bYV+ELTuvPvaQZbCJYMFRdg==", "integrity": "sha512-9/broj3bjShrsk3FuVDH0Bho2BchPKT8ubAqRcTqwkqrO9npOS3Vi98Yb5mBaa4bYV+ELTuvPvaQZbCJYMFRdg==",
"dev": true "dev": true
}, },
"svelte-json-tree": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/svelte-json-tree/-/svelte-json-tree-0.0.5.tgz",
"integrity": "sha512-kTcOVlsldI2neszYNQAfFCt+u62OWWAZgpeoW9RN3hjtJCWI5bkVj0gtljZWUlyEWTfgpmag5L5AHDKg8w8ZmQ==",
"dev": true
},
"tar": { "tar": {
"version": "4.4.10", "version": "4.4.10",
"resolved": "https://registry.npmjs.org/tar/-/tar-4.4.10.tgz", "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.10.tgz",
@ -3843,6 +3826,11 @@
"integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=",
"dev": true "dev": true
}, },
"totalist": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/totalist/-/totalist-1.0.1.tgz",
"integrity": "sha512-HuAt9bWDCdLkebrIQr+i63NgQSvjeD2VTNUIEBqof/4pG4Gb6omuBOMUX0vF371cbfImXQzmb4Ue/0c9MUWGew=="
},
"trim-right": { "trim-right": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz",

@ -7,14 +7,14 @@
"copy-workers": "rm -rf static/workers && cp -r node_modules/@sveltejs/svelte-repl/workers static", "copy-workers": "rm -rf static/workers && cp -r node_modules/@sveltejs/svelte-repl/workers static",
"migrate": "node-pg-migrate -r dotenv/config", "migrate": "node-pg-migrate -r dotenv/config",
"sapper": "npm run copy-workers && sapper build --legacy", "sapper": "npm run copy-workers && sapper build --legacy",
"update": "node scripts/update_template.js && node scripts/get-contributors.js", "update": "node scripts/update_template.js && node scripts/get-contributors.js && node scripts/update_whos_using.js",
"start": "node __sapper__/build", "start": "node __sapper__/build",
"test": "mocha -r esm test/**", "test": "mocha -r esm test/**",
"deploy": "make deploy" "deploy": "make deploy"
}, },
"dependencies": { "dependencies": {
"@polka/redirect": "^1.0.0-next.0", "@polka/redirect": "^1.0.0-next.7",
"@polka/send": "^1.0.0-next.6", "@polka/send": "^1.0.0-next.7",
"cookie": "^0.4.0", "cookie": "^0.4.0",
"devalue": "^2.0.0", "devalue": "^2.0.0",
"do-not-zip": "^1.0.0", "do-not-zip": "^1.0.0",
@ -23,9 +23,9 @@
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^8.5.1",
"marked": "^0.7.0", "marked": "^0.7.0",
"pg": "^7.12.1", "pg": "^7.12.1",
"polka": "^1.0.0-next.6", "polka": "^1.0.0-next.9",
"prismjs": "^1.17.1", "prismjs": "^1.17.1",
"sirv": "^0.4.2", "sirv": "^1.0.0-next.2",
"yootils": "0.0.16" "yootils": "0.0.16"
}, },
"devDependencies": { "devDependencies": {
@ -35,8 +35,8 @@
"@babel/preset-env": "^7.6.0", "@babel/preset-env": "^7.6.0",
"@babel/runtime": "^7.6.0", "@babel/runtime": "^7.6.0",
"@sindresorhus/slugify": "^0.9.1", "@sindresorhus/slugify": "^0.9.1",
"@sveltejs/site-kit": "^1.1.3", "@sveltejs/site-kit": "^1.1.4",
"@sveltejs/svelte-repl": "^0.1.9", "@sveltejs/svelte-repl": "^0.1.17",
"degit": "^2.1.4", "degit": "^2.1.4",
"dotenv": "^8.1.0", "dotenv": "^8.1.0",
"esm": "^3.2.25", "esm": "^3.2.25",

@ -13,6 +13,9 @@ const mode = process.env.NODE_ENV;
const dev = mode === 'development'; const dev = mode === 'development';
const legacy = !!process.env.SAPPER_LEGACY_BUILD; const legacy = !!process.env.SAPPER_LEGACY_BUILD;
const onwarn = (warning, onwarn) => (warning.code === 'CIRCULAR_DEPENDENCY' && /[/\\]@sapper[/\\]/.test(warning.message)) || onwarn(warning);
const dedupe = importee => importee === 'svelte' || importee.startsWith('svelte/');
export default { export default {
client: { client: {
input: config.client.input(), input: config.client.input(),
@ -28,7 +31,10 @@ export default {
hydratable: true, hydratable: true,
emitCss: true emitCss: true
}), }),
resolve(), resolve({
browser: true,
dedupe
}),
commonjs(), commonjs(),
json(), json(),
@ -53,6 +59,7 @@ export default {
module: true module: true
}) })
], ],
onwarn
}, },
server: { server: {
@ -67,7 +74,9 @@ export default {
generate: 'ssr', generate: 'ssr',
dev dev
}), }),
resolve(), resolve({
dedupe
}),
commonjs(), commonjs(),
json() json()
], ],
@ -78,6 +87,7 @@ export default {
require('module').builtinModules || Object.keys(process.binding('natives')) require('module').builtinModules || Object.keys(process.binding('natives'))
) )
], ],
onwarn
}, },
serviceworker: { serviceworker: {

@ -0,0 +1,12 @@
const sh = require('shelljs');
sh.cd(__dirname + '/../');
// fetch community repo
sh.rm('-rf','scripts/community');
sh.exec('npx degit sveltejs/community scripts/community');
// copy over relevant files
sh.cp('scripts/community/whos-using-svelte/WhosUsingSvelte.svelte', 'src/routes/_components/WhosUsingSvelte.svelte');
sh.rm('-rf', 'static/organisations');
sh.cp('-r', 'scripts/community/whos-using-svelte/organisations', 'static');

@ -0,0 +1,26 @@
<script>
import contributors from '../_contributors.js';
</script>
<style>
.contributor {
width: 2.4em;
height: 2.4em;
border-radius: 50%;
text-indent: -9999px;
display: inline-block;
background: no-repeat url(/contributors.jpg);
background-size: auto 102%;
margin: 0 0.5em 0.5em 0;
border: 2px solid var(--second);
}
</style>
{#each contributors as contributor, i}
<a
class="contributor"
style="background-position: {(100 * i) / (contributors.length - 1)}% 0"
href="https://github.com/{contributor}">
{contributor}
</a>
{/each}

@ -1,85 +0,0 @@
<!--
Instructions for adding new logos:
* Fork this repo, and clone your fork
* Create a branch called e.g. `add-myorganisation-logo`
* Add the logo to the `static/organisations` directory (preferably SVG)
* Add a new <a> tag in this component, in alphabetical order
* Create a pull request. Thanks!
-->
<style>
.logos {
margin: 1em 0 0 0;
display: flex;
flex-wrap: wrap;
}
a {
height: 40px;
margin: 0 0.5em 0.5em 0;
display: flex;
align-items: center;
border: 2px solid var(--second);
padding: 5px 10px;
border-radius: 20px;
color: var(--text);
}
.add-yourself {
color: var(--prime);
}
picture,
img {
height: 100%;
}
@media (min-width: 540px) {
a {
height: 60px;
padding: 10px 20px;
border-radius: 30px;
}
}
</style>
<div class="logos">
<a target="_blank" rel="noopener" href="https://bekchy.com"><img src="organisations/bekchy.png" alt="Bekchy logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://beyonk.com"><img src="organisations/beyonk.svg" alt="Beyonk logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://buydotstar.com"><img src="organisations/buydotstar.svg" alt="buy.* logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://chess.com" style="background-color: rgb(49,46,43);"><img src="organisations/chess.svg" alt="Chess.com logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://comigosaude.com.br"><img src="organisations/comigo.svg" alt="Comigo logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://datawrapper.de"><img src="organisations/datawrapper.svg" alt="Datawrapper logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://db.nomics.world" style="background-color: rgb(15,39,47);"><picture><source type="image/webp" srcset="organisations/dbnomics.webp"><img src="organisations/dbnomics.jpg" alt="DBNomics logo" loading="lazy"></picture></a>
<a target="_blank" rel="noopener" href="https://deck.nl"><img src="organisations/deck.svg" alt="Deck logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://dextra.com.br/pt/"><img src="organisations/dextra.png" alt="Dextra logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://www.entriwise.com/"><img src="organisations/entriwise.png" alt="Entriwise logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://from-now-on.com"><img src="organisations/from-now-on.png" alt="From-Now-On logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://fusioncharts.com"><img src="organisations/fusioncharts.svg" alt="FusionCharts logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://godaddy.com"><img src="organisations/godaddy.svg" alt="GoDaddy logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://www.grainger.com"><img src="organisations/grainger.svg" alt="Grainger logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="http://healthtree.org/"><img src="organisations/healthtree.png" alt="HealthTree logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://itslearning.com"><img src="organisations/itslearning.svg" alt="itslearning logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://www.metrovias.com.ar/"><img src="organisations/metrovias.svg" alt="Metrovias logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="http://mustlab.ru"><img src="organisations/mustlab.png" alt="Mustlab logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://www.nesta.org.uk"><img src="organisations/nesta.svg" alt="Nesta logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://www.nonkositelecoms.com"><img src="organisations/nonkosi.svg" alt="Nonkosi Telecoms logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://www.nzz.ch"><img src="organisations/nzz.svg" alt="Neue Zürcher Zeitung logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://nytimes.com"><img src="organisations/nyt.svg" alt="The New York Times logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://oberonspace.xyz"><img src="organisations/oberonspace.svg" alt="OberonSPACE logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://ofof.nl"><img src="organisations/ofof.png" alt="Ofof logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://openstate.eu"><img src="organisations/open-state-foundation.svg" alt="Open State Foundation logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://panascais.net"><img src="organisations/panascais.svg" alt="Panascais logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://pankod.com"><img src="organisations/pankod.svg" alt="Pankod logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://razorpay.com"><img src="organisations/razorpay.svg" alt="Razorpay logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://sp.nl"><img src="organisations/socialist-party.svg" alt="Socialist Party logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://www.stone.co"><img src="organisations/stone.svg" alt="Stone Payments logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://www.strixengine.com"><img src="organisations/strixcloud.svg" alt="Strix Cloud logo" loading="lazy"><span>Strix Cloud</span></a>
<a target="_blank" rel="noopener" href="https://sucuri.net" style="background-color: rgb(93, 93, 93);"><img src="organisations/sucuri.png" alt="Sucuri logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://thunderdome.dev"><img src="organisations/thunderdome.svg" alt="Thunderdome logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://m.tokopedia.com"><img src="organisations/tokopedia.png" alt="Tokopedia logo" srcset="organisations/tokopedia.2x.png 2x, organisations/tokopedia.3x.png 3x" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://webdesq.net"><img src="organisations/webdesq.svg" alt="Webdesq logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://zevvle.com/"><img src="organisations/zevvle.svg" alt="Zevvle logo" loading="lazy"></a>
<a target="_blank" rel="noopener" href="https://github.com/sveltejs/svelte/blob/master/site/src/routes/_components/WhosUsingSvelte.svelte" class="add-yourself"><span>+ your company?</span></a>
</div>

@ -1,11 +1,10 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import { extract_frontmatter, langs, link_renderer } from '@sveltejs/site-kit/utils/markdown.js'; import { extract_frontmatter, link_renderer } from '@sveltejs/site-kit/utils/markdown.js';
import marked from 'marked'; import marked from 'marked';
import { makeSlugProcessor } from '../../utils/slug'; import { makeSlugProcessor } from '../../utils/slug';
import { highlight } from '../../utils/highlight';
import { SLUG_PRESERVE_UNICODE } from '../../../config'; import { SLUG_PRESERVE_UNICODE } from '../../../config';
import PrismJS from 'prismjs';
import 'prismjs/components/prism-bash';
const makeSlug = makeSlugProcessor(SLUG_PRESERVE_UNICODE); const makeSlug = makeSlugProcessor(SLUG_PRESERVE_UNICODE);
@ -32,16 +31,7 @@ export default function get_posts() {
renderer.link = link_renderer; renderer.link = link_renderer;
renderer.code = (source, lang) => { renderer.code = highlight;
const plang = langs[lang];
const highlighted = PrismJS.highlight(
source,
PrismJS.languages[plang],
lang,
);
return `<pre class='language-${plang}'><code>${highlighted}</code></pre>`;
};
renderer.heading = (text, level, rawtext) => { renderer.heading = (text, level, rawtext) => {
const fragment = makeSlug(rawtext); const fragment = makeSlug(rawtext);

@ -11,7 +11,7 @@
<svelte:head> <svelte:head>
<title>Blog • Svelte</title> <title>Blog • Svelte</title>
<link rel="alternate" type="application/rss+xml" title="Svelte blog" href="blog/rss.xml"> <link rel="alternate" type="application/rss+xml" title="Svelte blog" href="https://svelte.dev/blog/rss.xml">
<meta name="twitter:title" content="Svelte blog"> <meta name="twitter:title" content="Svelte blog">
<meta name="twitter:description" content="Articles about Svelte and UI development"> <meta name="twitter:description" content="Articles about Svelte and UI development">

@ -1,11 +1,10 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import { SLUG_PRESERVE_UNICODE, SLUG_SEPARATOR } from '../../../config'; import { SLUG_PRESERVE_UNICODE, SLUG_SEPARATOR } from '../../../config';
import { extract_frontmatter, extract_metadata, langs, link_renderer } from '@sveltejs/site-kit/utils/markdown.js'; import { extract_frontmatter, extract_metadata, link_renderer } from '@sveltejs/site-kit/utils/markdown.js';
import { make_session_slug_processor } from '@sveltejs/site-kit/utils/slug'; import { make_session_slug_processor } from '@sveltejs/site-kit/utils/slug';
import { highlight } from '../../utils/highlight';
import marked from 'marked'; import marked from 'marked';
import PrismJS from 'prismjs';
import 'prismjs/components/prism-bash';
const blockTypes = [ const blockTypes = [
'blockquote', 'blockquote',
@ -73,14 +72,7 @@ export default function() {
if (meta && meta.hidden) return ''; if (meta && meta.hidden) return '';
const plang = langs[lang]; const html = `<div class='${className}'>${prefix}${highlight(source, lang)}</div>`;
const highlighted = PrismJS.highlight(
source,
PrismJS.languages[plang],
lang
);
const html = `<div class='${className}'>${prefix}<pre class='language-${plang}'><code>${highlighted}</code></pre></div>`;
if (block_open) { if (block_open) {
block_open = false; block_open = false;

@ -29,34 +29,48 @@
font-weight: 700; font-weight: 700;
} }
div {
display: flex;
flex-direction: row;
padding: 0.2rem 3rem;
margin: 0 -3rem;
}
div.active {
background: rgba(0, 0, 0, 0.15) calc(100% - 3rem) 47% no-repeat
url(/icons/arrow-right.svg);
background-size: 1em 1em;
color: white;
}
div.active.loading {
background: rgba(0, 0, 0, 0.1) calc(100% - 3rem) 47% no-repeat
url(/icons/loading.svg);
background-size: 1em 1em;
color: white;
}
a { a {
display: flex; display: flex;
flex: 1 1 auto;
position: relative; position: relative;
color: var(--sidebar-text); color: var(--sidebar-text);
border-bottom: none; border-bottom: none;
padding: 0.2rem 3rem;
margin: 0 -3rem;
font-size: 1.6rem; font-size: 1.6rem;
align-items: center; align-items: center;
justify-content: start; justify-content: start;
padding: 0;
} }
a:hover { a:hover {
color: white; color: white;
} }
a.active { .repl-link {
background: rgba(0, 0, 0, 0.15) calc(100% - 3rem) 50% no-repeat flex: 0 1 auto;
url(/icons/arrow-right.svg); font-size: 1.2rem;
background-size: 1em 1em; font-weight: 700;
color: white; margin-right: 2.5rem;
}
a.active.loading {
background: rgba(0, 0, 0, 0.1) calc(100% - 3rem) 50% no-repeat
url(/icons/loading.svg);
background-size: 1em 1em;
color: white;
} }
.thumbnail { .thumbnail {
@ -73,25 +87,29 @@
<ul class="examples-toc"> <ul class="examples-toc">
{#each sections as section} {#each sections as section}
<li> <li>
<span class="section-title"> <span class="section-title">{section.title}</span>
{section.title}
</span>
{#each section.examples as example} {#each section.examples as example}
<div
class="row"
class:active={example.slug === active_section}
class:loading={isLoading}>
<a <a
href="examples#{example.slug}" href="examples#{example.slug}"
class="row" class="row"
class:active="{example.slug === active_section}" class:active={example.slug === active_section}
class:loading="{isLoading}" class:loading={isLoading}>
>
<img <img
class="thumbnail" class="thumbnail"
alt="{example.title} thumbnail" alt="{example.title} thumbnail"
src="examples/thumbnails/{example.slug}.jpg" src="examples/thumbnails/{example.slug}.jpg" />
/>
<span>{example.title}</span> <span>{example.title}</span>
</a> </a>
{#if example.slug === active_section}
<a href="repl/{example.slug}" class="repl-link">REPL</a>
{/if}
</div>
{/each} {/each}
</li> </li>
{/each} {/each}

@ -1,9 +1,9 @@
<script> <script>
import { Blurb, Hero, Section } from '@sveltejs/site-kit'; import { Blurb, Hero, Section } from '@sveltejs/site-kit';
import Contributors from './_components/Contributors.svelte';
import Example from './_components/Example.svelte'; import Example from './_components/Example.svelte';
import WhosUsingSvelte from './_components/WhosUsingSvelte.svelte'; import WhosUsingSvelte from './_components/WhosUsingSvelte.svelte';
// import Lazy from '../components/Lazy.svelte'; // import Lazy from '../components/Lazy.svelte';
import contributors from './_contributors.js';
// TODO this causes a Sapper CSS bug... // TODO this causes a Sapper CSS bug...
// function loadReplWidget() { // function loadReplWidget() {
@ -24,18 +24,6 @@
color: white; color: white;
overflow: hidden; overflow: hidden;
} }
.contributor {
width: 2.4em;
height: 2.4em;
border-radius: 50%;
text-indent: -9999px;
display: inline-block;
background: no-repeat url(/contributors.jpg);
background-size: auto 102%;
margin: 0 0.5em 0.5em 0;
border: 2px solid var(--second);
}
</style> </style>
<svelte:head> <svelte:head>
@ -85,7 +73,8 @@
<div style="grid-area: start; display: flex; flex-direction: column; min-width: 0" slot="how"> <div style="grid-area: start; display: flex; flex-direction: column; min-width: 0" slot="how">
<pre class="language-bash" style="margin: 0 0 1em 0; min-width: 0; min-height: 0"> <pre class="language-bash" style="margin: 0 0 1em 0; min-width: 0; min-height: 0">
npx degit sveltejs/template my-svelte-project npx degit <a href="https://github.com/sveltejs/template" style="user-select: initial;">sveltejs/template</a> my-svelte-project
<span class="token comment"># or download and extract <a href="https://github.com/sveltejs/template/archive/master.zip">this .zip file</a></span>
cd my-svelte-project cd my-svelte-project
npm install npm install
@ -127,11 +116,5 @@ npm run dev
<p>Svelte is free and open source software, made possible by the work of dozens of volunteers. <a href="https://github.com/sveltejs/svelte">Join us!</a></p> <p>Svelte is free and open source software, made possible by the work of dozens of volunteers. <a href="https://github.com/sveltejs/svelte">Join us!</a></p>
{#each contributors as contributor, i} <Contributors/>
<a
class="contributor"
style="background-position: {100 * i / (contributors.length - 1)}% 0"
href="https://github.com/{contributor}"
>{contributor}</a>
{/each}
</Section> </Section>

@ -140,12 +140,12 @@
if (imports.length > 0) { if (imports.length > 0) {
const idx = files.findIndex(({ path }) => path === 'package.json'); const idx = files.findIndex(({ path }) => path === 'package.json');
const pkg = JSON.parse(files[idx].data); const pkg = JSON.parse(files[idx].data);
const deps = {}; const { devDependencies } = pkg;
imports.forEach(mod => { imports.forEach(mod => {
const match = /^(@[^/]+\/)?[^@/]+/.exec(mod); const match = /^(@[^/]+\/)?[^@/]+/.exec(mod);
deps[match[0]] = 'latest'; devDependencies[match[0]] = 'latest';
}); });
pkg.dependencies = deps; pkg.devDependencies = devDependencies;
files[idx].data = JSON.stringify(pkg, null, ' '); files[idx].data = JSON.stringify(pkg, null, ' ');
} }

@ -73,6 +73,18 @@ export async function get(req, res) {
}); });
} }
if (process.env.NODE_ENV === 'development') {
// In dev, proxy requests to load particular REPLs to the real server.
// This avoids needing to connect to the real database server.
req.pipe(
require('https').request({ host: 'svelte.dev', path: req.url })
).once('response', res_proxy => {
res_proxy.pipe(res);
res.writeHead(res_proxy.statusCode, res_proxy.headers);
}).once('error', () => res.end());
return;
}
const [row] = await query(` const [row] = await query(`
select g.*, u.uid as owner from gists g select g.*, u.uid as owner from gists g
left join users u on g.user_id = u.id left join users u on g.user_id = u.id

@ -57,7 +57,10 @@
is_relaxed_gist = data.relaxed; is_relaxed_gist = data.relaxed;
const components = data.files.map(file => { const components = data.files.map(file => {
let [name, type] = file.name.split('.'); const dot = file.name.lastIndexOf(".");
let name = file.name.slice(0, dot);
let type = file.name.slice(dot + 1);
if (type === 'html') type = 'svelte'; // TODO do this on the server if (type === 'html') type = 'svelte'; // TODO do this on the server
return { name, type, source: file.source }; return { name, type, source: file.source };
}); });

@ -1,9 +1,9 @@
import * as fs from 'fs'; import * as fs from 'fs';
import * as path from 'path'; import * as path from 'path';
import marked from 'marked'; import marked from 'marked';
import PrismJS from 'prismjs';
import send from '@polka/send'; import send from '@polka/send';
import { extract_frontmatter, extract_metadata, langs, link_renderer } from '@sveltejs/site-kit/utils/markdown'; import { extract_frontmatter, extract_metadata, link_renderer } from '@sveltejs/site-kit/utils/markdown';
import { highlight } from '../../../utils/highlight';
const cache = new Map(); const cache = new Map();
@ -57,14 +57,7 @@ function get_tutorial(slug) {
} }
} }
const plang = langs[lang]; return `<div class='${className}'>${prefix}${highlight(source, lang)}</div>`;
const highlighted = PrismJS.highlight(
source,
PrismJS.languages[plang],
lang
);
return `<div class='${className}'>${prefix}<pre class='language-${plang}'><code>${highlighted}</code></pre></div>`;
}; };
let html = marked(content, { renderer }); let html = marked(content, { renderer });

@ -218,17 +218,17 @@
} }
.show { .show {
background: rgba(0,0,0,.4); background: var(--prime);
padding: .3em .7em; padding: .3em .7em;
border-radius: var(--border-r); border-radius: var(--border-r);
top: .1em; top: .1em;
position: relative; position: relative;
font-size: var(--h5); font-size: var(--h5);
font-weight: 300; font-weight: 300;
color: rgba(255,255,255,0.7);
} }
.show:hover { .show:hover {
background: rgba(0,0,0,.65);
color: white; color: white;
} }

@ -14,9 +14,11 @@ const app = polka({
} }
}); });
app.use( if (process.env.PGHOST) {
authenticate(), app.use(authenticate());
}
app.use(
sirv('static', { sirv('static', {
dev: process.env.NODE_ENV === 'development', dev: process.env.NODE_ENV === 'development',
setHeaders(res) { setHeaders(res) {

@ -15,6 +15,7 @@
<meta name='twitter:site' content='@sveltejs'> <meta name='twitter:site' content='@sveltejs'>
<meta name='twitter:creator' content='@sveltejs'> <meta name='twitter:creator' content='@sveltejs'>
<meta name='twitter:image' content='https://svelte.dev/images/twitter-card.png'> <meta name='twitter:image' content='https://svelte.dev/images/twitter-card.png'>
<meta name='og:image' content='https://svelte.dev/images/twitter-card.png'>
<!-- Sapper generates a <style> tag containing critical CSS <!-- Sapper generates a <style> tag containing critical CSS
for the current page. CSS for the rest of the app is for the current page. CSS for the rest of the app is

@ -1,8 +1,7 @@
import { Pool } from 'pg'; import { Pool } from 'pg';
export const DB = new Pool({ // Uses `PG*` ENV vars
connectionString: process.env.DATABASE_URL export const DB = process.env.PGHOST ? new Pool() : null;
});
export function query(text, values=[]) { export function query(text, values=[]) {
return DB.query(text, values).then(r => r.rows); return DB.query(text, values).then(r => r.rows);

@ -0,0 +1,14 @@
import { langs } from '@sveltejs/site-kit/utils/markdown.js';
import PrismJS from 'prismjs';
import 'prismjs/components/prism-bash';
export function highlight(source, lang) {
const plang = langs[lang] || '';
const highlighted = plang ? PrismJS.highlight(
source,
PrismJS.languages[plang],
lang,
) : source.replace(/[&<>]/g, c => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;' })[c]);
return `<pre class='language-${plang}'><code>${highlighted}</code></pre>`;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 103 124">
<path style="fill:black" d='M96.33,20.61C85.38,4.93,63.74.28,48.09,10.25L20.61,27.77A31.46,31.46,0,0,0,6.37,48.88,33.22,33.22,0,0,0,9.64,70.2,31.52,31.52,0,0,0,4.93,82a33.61,33.61,0,0,0,5.73,25.41c11,15.68,32.6,20.33,48.25,10.36l27.48-17.52a31.48,31.48,0,0,0,14.24-21.11A33.22,33.22,0,0,0,97.36,57.8,31.52,31.52,0,0,0,102.07,46a33.57,33.57,0,0,0-5.74-25.41
M45.41,108.86A21.81,21.81,0,0,1,22,100.18,20.2,20.2,0,0,1,18.53,84.9a19,19,0,0,1,.65-2.57l.52-1.58,1.41,1a35.32,35.32,0,0,0,10.75,5.37l1,.31-.1,1a6.2,6.2,0,0,0,1.11,4.08A6.57,6.57,0,0,0,41,95.19a6,6,0,0,0,1.68-.74L70.11,76.94a5.76,5.76,0,0,0,2.59-3.83,6.09,6.09,0,0,0-1-4.6,6.58,6.58,0,0,0-7.06-2.62,6.21,6.21,0,0,0-1.69.74L52.43,73.31a19.88,19.88,0,0,1-5.58,2.45,21.82,21.82,0,0,1-23.43-8.68A20.2,20.2,0,0,1,20,51.8a19,19,0,0,1,8.56-12.7L56,21.59a19.88,19.88,0,0,1,5.58-2.45A21.81,21.81,0,0,1,85,27.82,20.2,20.2,0,0,1,88.47,43.1a19,19,0,0,1-.65,2.57l-.52,1.58-1.41-1a35.32,35.32,0,0,0-10.75-5.37l-1-.31.1-1a6.2,6.2,0,0,0-1.11-4.08,6.57,6.57,0,0,0-7.06-2.62,6,6,0,0,0-1.68.74L36.89,51.06a5.71,5.71,0,0,0-2.58,3.83,6,6,0,0,0,1,4.6,6.58,6.58,0,0,0,7.06,2.62,6.21,6.21,0,0,0,1.69-.74l10.48-6.68a19.88,19.88,0,0,1,5.58-2.45,21.82,21.82,0,0,1,23.43,8.68A20.2,20.2,0,0,1,87,76.2a19,19,0,0,1-8.56,12.7L51,106.41a19.88,19.88,0,0,1-5.58,2.45' />
</svg>

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

@ -1 +0,0 @@
<svg enable-background="new 0 0 263.2 127" viewBox="0 0 263.2 127" xmlns="http://www.w3.org/2000/svg"><path d="m263.2 28.5v-5.9h-22.5v-22.6h-5.9v22.5h-206.3v-22.5h-5.9v22.5h-22.6v5.9h22.5v70.1h-22.5v5.9h22.5v22.6h5.9v-22.5h206.4v22.5h5.9v-22.5h22.5v-5.9h-22.5v-70.1zm-28.4 70h-206.3v-70h206.4v70zm-183.9-46.3h9.3c1.7-.1 3.4.4 4.7 1.5 1.1 1.1 1.7 2.7 1.6 4.3 0 1-.2 2-.6 2.8s-1.1 1.4-1.9 1.9c.7.1 1.5.4 2.1.7s1 .7 1.4 1.2.6 1 .8 1.6.2 1.3.2 1.9c0 1-.2 1.9-.6 2.8-.4.8-.9 1.5-1.6 2.1s-1.5 1-2.4 1.2c-1.1.3-2.1.4-3.2.4h-9.7zm5.9 8.9h1.7c1.8 0 2.8-.7 2.8-2.2s-.9-2.2-2.8-2.2h-1.7zm0 9.1h1.9c1.1.1 2.2-.1 3.2-.6 1-.7 1.3-2.1.5-3.1-.1-.2-.3-.4-.5-.5-1-.5-2.1-.6-3.2-.6h-1.9zm36.2-13h-9.9v3.8h9.6v5h-9.6v3.9h9.9v5h-15.8v-22.7h15.8zm15.2 8.5-8.2-13.5h7l4.2 7.3 4.2-7.3h7l-8.4 13.5v9h-5.8zm17.8-2.2c0-1.6.3-3.2.9-4.7 1.2-2.9 3.6-5.2 6.5-6.3 3.2-1.2 6.8-1.2 10.1 0 1.5.6 2.9 1.4 4 2.5s2 2.4 2.5 3.8c1.2 3 1.2 6.4 0 9.4-.6 1.4-1.5 2.7-2.6 3.8s-2.5 2-4 2.5c-3.2 1.2-6.8 1.2-10.1 0-1.5-.6-2.8-1.4-3.9-2.5s-2-2.4-2.6-3.8c-.5-1.5-.8-3.1-.8-4.7zm6.1 0c0 .9.2 1.7.5 2.5.6 1.5 1.9 2.7 3.4 3.3 2.4 1 5.1.4 6.9-1.3.6-.6 1.1-1.2 1.4-2 .7-1.6.7-3.4 0-5-.3-.8-.8-1.4-1.4-2-1.9-1.7-4.5-2.2-6.9-1.3-1.5.6-2.7 1.8-3.4 3.4-.3.7-.5 1.5-.5 2.4zm26.5 11.3v-22.6h5.9l10.8 13.8v-13.8h5.8v22.5h-5.8l-10.8-13.7v13.8zm38.1-13.3 7.1-9.3h7.2l-8.9 10.7 9.8 11.9h-7.6l-7.6-9.8v9.8h-5.9v-22.6h5.9z"/></svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg viewBox="0 0 257 60" xmlns="http://www.w3.org/2000/svg">
<style>
.logo {
font-size: 60px;
text-align: center;
font-family: "Times New Roman", Times, serif;
}
</style>
<text x="65" y="46" class="logo">buy.*</text>
</svg>

Before

Width:  |  Height:  |  Size: 411 B

@ -1 +0,0 @@
<svg viewBox="0 0 109 31" xmlns="http://www.w3.org/2000/svg"><path d="m19.2 25.6c-1.5-.4-2.9-1.3-4-2.4-1.9-2.1-2.9-4.9-2.7-7.7-.1-2.1.5-4.2 1.5-6l-1-.5a4.96 4.96 0 1 0 -6.9-1.2c.3.5.7.9 1.2 1.2-.7.4-2.5 1.4-3 1.7-.1.1-.1.3-.1.3 0 .7.2 1.4.5 2 1 .2 2 .3 2.9.3-.2 2.3-.5 4.7-.9 7-.4 1.3-4.6 1.5-5.3 3.1-.1.3-.2.6-.2.9 0 .4.1.8.4 1.2.1.1-1.5.5-1.5 2-.1.5.2 1.1.6 1.5.9.6 1.9 1.1 3 1.4 2.1.5 4.2.7 6.3.7s4.3-.2 6.4-.7c1.1-.2 2.1-.7 3-1.4.4-.4.7-1 .7-1.6 0-.7-.3-1.4-.9-1.8z" fill="#4e7838"/><path d="m8.4 27.9c-1.4-.2-5.9-.9-7-2.5-.4.2-.7.4-1 .8 0 1.7 5.5 2.5 8 2.2.9-.1.5-.4 0-.5zm1.7-13c-.4-.2-2.6-1-2.6-1-.2 2.1-.5 4.2-.8 6.2-.4 1.3-4.6 1.5-5.3 3.1-.3.8 1.3 1.8 5.1 1.8 3.6 0 4-4.9 4.6-8.7.1-.7-.6-1.2-1-1.4zm1.9-4.2c-.7-.6-1.5-1.2-2.3-1.7 2.3-.6 3.9-2.7 3.8-5 0-3-1.9-4-3.3-4h-.1c-2.7.1-4.9 2.4-4.8 5.2.1 1.5.8 2.9 2 3.8-.7.4-2.5 1.4-3 1.7-.1.1-.1.3-.1.3 0 .7.2 1.4.5 2 1.7.3 3.4.4 5.1.4h1.8c.3 0 .5-1.9.5-2.3 0-.1 0-.3-.1-.4z" fill="#6c9d40"/><path d="m9.3 1.2c2.2.3-1 2.8-2 2.7s0-3 2-2.7zm13.1 22.9c-2.2.1-4.3-.7-5.9-2.2a9 9 0 0 1 -2.2-6.3c-.1-2.3.7-4.5 2.2-6.3 1.5-1.6 3.7-2.4 5.9-2.3.6 0 1.2 0 1.8.1l1.5.3c.4.1.9.3 1.3.5s.8.4 1.1.5v3.9h-.4l-.8-.6c-.3-.3-.7-.5-1-.7-.4-.2-.8-.4-1.3-.6a4.15 4.15 0 0 0 -3.1 0c-.5.2-1 .6-1.4 1-.5.5-.8 1.1-1.1 1.7-.3.8-.4 1.7-.4 2.5 0 .9.1 1.8.4 2.6.2.6.6 1.2 1.1 1.7a4.2 4.2 0 0 0 3 1.2c.5 0 1.1-.1 1.6-.3.4-.2.9-.4 1.2-.6.4-.2.7-.4 1-.7l.7-.6h.4v3.9l-1 .5c-.4.2-.8.3-1.2.5-.5.2-1 .3-1.5.4-.6-.1-1.2-.1-1.9-.1zm19.3-.3h-3.9v-6.2c0-.5 0-1-.1-1.5 0-.4-.1-.7-.2-1.1a.9.9 0 0 0 -.6-.6c-.3-.1-.7-.2-1-.2s-.7.1-1 .2c-.4.1-.7.3-1 .6v8.8h-3.9v-16.9h4v5.8c.6-.5 1.2-.9 1.8-1.3.6-.3 1.3-.5 2-.4 1.1-.1 2.2.4 2.9 1.2.7 1 1.1 2.2 1 3.5zm9.1.3c-1.9.1-3.9-.5-5.4-1.7-1.3-1.2-2-3-1.9-4.8-.1-1.8.5-3.5 1.8-4.9 1.3-1.3 3.1-1.9 4.9-1.8 1.6-.1 3.1.4 4.3 1.5 1 1.2 1.5 2.8 1.4 4.4v1.4h-8.5c0 .5.1 1 .4 1.5.2.4.5.7.8.9.4.2.7.4 1.2.5s1 .2 1.5.1c.4 0 .9-.1 1.3-.1.4-.1.8-.2 1.2-.4.3-.1.6-.3.9-.5.2-.1.4-.3.7-.4h.4v3.2l-.9.4-1.1.3-1.3.3c-.6.1-1.2.1-1.7.1zm1.3-8.2c0-.7-.2-1.4-.6-1.9s-1-.7-1.7-.6c-.7 0-1.3.2-1.8.7-.4.5-.7 1.2-.7 1.9zm9.9 8.2c-.9 0-1.7-.1-2.6-.3-.7-.2-1.4-.4-2-.7v-3.3h.3l.6.5c.3.2.6.4 1 .5.4.2.8.3 1.2.4.5.1 1 .2 1.5.2s1-.1 1.4-.2.6-.4.6-.8c0-.3-.1-.5-.3-.7-.3-.2-.7-.3-1.1-.4-.3-.1-.7-.1-1.1-.2l-1.2-.3c-.8-.2-1.6-.7-2.2-1.3-.5-.7-.8-1.5-.7-2.3 0-.5.1-1.1.4-1.6s.7-1 1.1-1.3c.5-.4 1.2-.7 1.8-.9a9.86 9.86 0 0 1 4.8 0c.6.1 1.3.3 1.8.6v3h-.3c-.2-.1-.4-.3-.6-.4-.3-.2-.6-.3-.8-.4-.4-.2-.7-.3-1.1-.4s-.8-.1-1.2-.1c-.5 0-1 .1-1.4.3-.3.1-.6.4-.6.8 0 .3.1.5.3.7.4.2.8.4 1.2.5.3.1.7.2 1.1.2l1.2.3c.8.2 1.5.7 2 1.3s.8 1.4.7 2.2c0 .6-.1 1.1-.4 1.7-.3.5-.7 1-1.2 1.3-.6.4-1.2.7-1.9.9-.6.1-1.4.2-2.3.2zm11.9 0c-.9 0-1.7-.1-2.6-.3-.7-.2-1.4-.4-2-.7v-3.3h.3l.6.5c.3.2.6.4 1 .5.4.2.8.3 1.2.4.5.1 1 .2 1.5.2s1-.1 1.4-.2.6-.4.6-.8c0-.3-.1-.5-.3-.7-.3-.2-.7-.3-1.1-.4-.3-.1-.7-.1-1.1-.2l-1.2-.3c-.8-.2-1.6-.7-2.2-1.3-.5-.7-.8-1.5-.7-2.3 0-.5.1-1.1.4-1.6s.7-1 1.1-1.3c.5-.4 1.2-.7 1.8-.9a9.86 9.86 0 0 1 4.8 0c.6.1 1.3.3 1.8.6v3h-.3c-.2-.1-.4-.3-.6-.4-.3-.2-.6-.3-.8-.4-.4-.2-.7-.3-1.1-.4s-.8-.1-1.2-.1c-.5 0-1 .1-1.4.3-.3.1-.6.4-.6.8 0 .3.1.5.3.7.4.2.8.4 1.2.5.3.1.7.2 1.1.2l1.2.3c.8.2 1.5.7 2 1.3s.7 1.4.7 2.2c0 .6-.1 1.1-.4 1.7-.3.5-.7 1-1.2 1.3-.6.4-1.2.7-1.9.9-.6.1-1.4.2-2.3.2zm7.7-.4h-.6c-.3 0-.5-.2-.5-.5v-1c0-.3.2-.5.5-.5h.6c.3 0 .5.2.5.5v1c.1.3-.2.5-.5.5zm5 .2c-.5 0-1-.1-1.5-.2-.4-.2-.8-.4-1.2-.8-.3-.4-.6-.8-.8-1.3a5.66 5.66 0 0 1 0-3.6c.2-.5.4-.9.7-1.3.3-.3.7-.6 1.2-.7.5-.2 1-.3 1.5-.3.4 0 .8.1 1.2.2s.7.2 1.1.4v1.5h-.1c-.1-.1-.2-.2-.4-.3s-.4-.2-.5-.3c-.2-.1-.4-.2-.7-.2-.2-.1-.5-.1-.7-.1-.6 0-1.3.3-1.7.8-.5.6-.7 1.4-.6 2.2 0 .8.2 1.5.6 2.2.4.5 1 .8 1.7.8.4 0 .9-.1 1.2-.3.4-.2.7-.4 1-.7h.1v1.5l-.5.2c-.2.1-.4.1-.5.2l-.6.1zm10.2-4.1c.1 1.1-.3 2.2-1 3-.6.7-1.6 1.1-2.5 1.1-1 0-1.9-.4-2.6-1.1-.7-.9-1-1.9-.9-3-.1-1.1.3-2.2 1-3a3.6 3.6 0 0 1 5-.1l.1.1c.6.9 1 2 .9 3zm-1.4 0c.1-.8-.1-1.6-.6-2.2-.7-.9-2.1-1-2.9-.2l-.2.2c-.4.7-.6 1.5-.6 2.2-.1.8.1 1.6.6 2.2.7.9 2 1 2.9.3l.3-.3c.4-.6.6-1.4.5-2.2zm11.5 4.1v-5.6c0-.3-.1-.5-.2-.7s-.2-.3-.4-.4-.5-.2-.7-.1c-.3 0-.6.1-.9.2-.4.2-.7.5-1 .8v6h-1.4v-5.7c0-.3-.1-.5-.2-.7s-.2-.3-.4-.4-.5-.1-.8-.1-.6.1-.9.3-.7.4-.9.7v6h-1.4v-8h1.4v.9c.3-.3.7-.6 1.1-.9.3-.2.7-.3 1.2-.3.4 0 .9.1 1.3.3s.7.6.8 1.1c.3-.4.8-.7 1.2-1 .4-.2.8-.4 1.3-.4.3 0 .6.1.9.2s.5.3.7.5c.2.3.4.6.5.9.1.4.2.9.2 1.4v5.1z" fill="#fff"/></svg>

Before

Width:  |  Height:  |  Size: 4.2 KiB

@ -1 +0,0 @@
<svg viewBox="0 0 102.292 25" xmlns="http://www.w3.org/2000/svg"><g fill="#00c6fb"><path d="m4.417 17.624a7.686 7.686 0 0 1 -3.282-3.224 10.388 10.388 0 0 1 -1.135-5 10.464 10.464 0 0 1 1.135-5.015 7.765 7.765 0 0 1 3.265-3.254 10.574 10.574 0 0 1 5.033-1.131 11.666 11.666 0 0 1 4.443.833 6.686 6.686 0 0 1 3.024 2.211 1.423 1.423 0 0 1 .312.859 1.467 1.467 0 0 1 -.7 1.172 1.25 1.25 0 0 1 -.775.235 1.913 1.913 0 0 1 -.775-.17 1.716 1.716 0 0 1 -.646-.481 5.181 5.181 0 0 0 -2.044-1.474 7.835 7.835 0 0 0 -2.841-.455 5.6 5.6 0 0 0 -4.394 1.759 7.094 7.094 0 0 0 -1.576 4.911 6.966 6.966 0 0 0 1.59 4.869 5.7 5.7 0 0 0 4.431 1.741 7.044 7.044 0 0 0 5.195-1.926 2.267 2.267 0 0 1 1.472-.755 1.329 1.329 0 0 1 .854.312 1.512 1.512 0 0 1 .594 1.145 1.493 1.493 0 0 1 -.336.912 7.233 7.233 0 0 1 -3.166 2.24 12.536 12.536 0 0 1 -4.613.807 10.8 10.8 0 0 1 -5.066-1.12z" transform="translate(.006 .005)"/><path d="m34.231 21.208a6.43 6.43 0 0 1 -2.731-2.331 6.249 6.249 0 0 1 -.982-3.489 6.258 6.258 0 0 1 .985-3.489 6.44 6.44 0 0 1 2.726-2.329 10.127 10.127 0 0 1 7.986 0 6.436 6.436 0 0 1 2.727 2.33 6.252 6.252 0 0 1 .982 3.489 6.249 6.249 0 0 1 -.982 3.489 6.428 6.428 0 0 1 -2.726 2.331 10.133 10.133 0 0 1 -7.985 0zm7.133-2.929a3.7 3.7 0 0 0 1.15-2.891 3.7 3.7 0 0 0 -1.15-2.89 4.5 4.5 0 0 0 -3.14-1.041 4.5 4.5 0 0 0 -3.14 1.043 3.7 3.7 0 0 0 -1.15 2.89 3.7 3.7 0 0 0 1.15 2.891 4.5 4.5 0 0 0 3.139 1.041 4.5 4.5 0 0 0 3.14-1.044z" transform="translate(-11.447 -3.278)"/><path d="m58.384 21.61a1.5 1.5 0 0 1 -.437-1.146v-10.154a1.5 1.5 0 0 1 .437-1.145 1.732 1.732 0 0 1 1.24-.417 1.79 1.79 0 0 1 1.24.417 1.458 1.458 0 0 1 .465 1.145v.625a4.518 4.518 0 0 1 1.5-1.615 3.608 3.608 0 0 1 1.965-.572 3.462 3.462 0 0 1 1.964.586 3.594 3.594 0 0 1 1.318 1.6 5.355 5.355 0 0 1 4.16-2.187 3.9 3.9 0 0 1 3.23 1.458 6.361 6.361 0 0 1 1.163 4.062v6.2a1.458 1.458 0 0 1 -.466 1.146 1.79 1.79 0 0 1 -1.24.416 1.732 1.732 0 0 1 -1.24-.416 1.5 1.5 0 0 1 -.437-1.146v-6.4a3.449 3.449 0 0 0 -.452-1.937 1.508 1.508 0 0 0 -1.33-.664 2.172 2.172 0 0 0 -1.318.416 3.916 3.916 0 0 0 -1.06 1.318v7.261a1.46 1.46 0 0 1 -.466 1.146 1.791 1.791 0 0 1 -1.243.416 1.733 1.733 0 0 1 -1.241-.416 1.5 1.5 0 0 1 -.437-1.146v-5.856q0-3.151-1.783-3.15a2.2 2.2 0 0 0 -1.9.963 4.515 4.515 0 0 0 -.687 2.656v5.389a1.458 1.458 0 0 1 -.465 1.146 1.79 1.79 0 0 1 -1.24.416 1.732 1.732 0 0 1 -1.24-.416z" transform="translate(-21.734 -3.277)"/><path d="m92.026 3.318a1.8 1.8 0 0 1 -.581-1.392 1.8 1.8 0 0 1 .581-1.394 2.187 2.187 0 0 1 1.538-.532 2.284 2.284 0 0 1 1.562.534 1.767 1.767 0 0 1 .607 1.393 1.763 1.763 0 0 1 -.607 1.392 2.281 2.281 0 0 1 -1.562.534 2.183 2.183 0 0 1 -1.538-.534zm.323 15.01a1.5 1.5 0 0 1 -.437-1.146v-10.154a1.5 1.5 0 0 1 .437-1.145 1.733 1.733 0 0 1 1.24-.417 1.791 1.791 0 0 1 1.24.417 1.461 1.461 0 0 1 .471 1.145v10.154a1.46 1.46 0 0 1 -.466 1.146 1.791 1.791 0 0 1 -1.24.416 1.733 1.733 0 0 1 -1.24-.416z" transform="translate(-34.303 .005)"/><path d="m105.688 27.678a6.424 6.424 0 0 1 -2.649-1.64 1.268 1.268 0 0 1 -.362-.885 1.51 1.51 0 0 1 .62-1.172 1.3 1.3 0 0 1 .827-.312 2.364 2.364 0 0 1 1.5.755 4.374 4.374 0 0 0 1.562.9 6.163 6.163 0 0 0 2.029.326 4.007 4.007 0 0 0 3.124-1.223 4.679 4.679 0 0 0 1.062-3.384l-.023-1.043a5.411 5.411 0 0 1 -2.054 1.537 7.456 7.456 0 0 1 -2.882.494 6.765 6.765 0 0 1 -4.962-1.757 6.553 6.553 0 0 1 -1.786-4.882 6.464 6.464 0 0 1 1.821-4.881 7.016 7.016 0 0 1 5.079-1.758 6.344 6.344 0 0 1 2.584.547 7.206 7.206 0 0 1 2.223 1.537v-.521a1.46 1.46 0 0 1 .464-1.145 2.062 2.062 0 0 1 2.468-.013 1.473 1.473 0 0 1 .452 1.158v10.723a7.663 7.663 0 0 1 -.892 3.723 6.436 6.436 0 0 1 -2.559 2.578 7.909 7.909 0 0 1 -3.94.937 11.035 11.035 0 0 1 -3.707-.6zm6.577-9.4a3.722 3.722 0 0 0 1.138-2.891 3.721 3.721 0 0 0 -1.138-2.89 4.493 4.493 0 0 0 -3.152-1.041 4.023 4.023 0 0 0 -2.947 1.041 3.866 3.866 0 0 0 -1.059 2.89 3.868 3.868 0 0 0 1.059 2.891 4.025 4.025 0 0 0 2.947 1.041 4.5 4.5 0 0 0 3.152-1.041z" transform="translate(-38.143 -3.279)"/><path d="m132.955 21.209a6.43 6.43 0 0 1 -2.726-2.331 6.249 6.249 0 0 1 -.982-3.489 6.257 6.257 0 0 1 .982-3.489 6.44 6.44 0 0 1 2.726-2.329 10.127 10.127 0 0 1 7.986 0 6.436 6.436 0 0 1 2.726 2.329 6.257 6.257 0 0 1 .982 3.489 6.249 6.249 0 0 1 -.982 3.489 6.429 6.429 0 0 1 -2.726 2.331 10.134 10.134 0 0 1 -7.986 0zm7.134-2.929a3.7 3.7 0 0 0 1.15-2.891 3.7 3.7 0 0 0 -1.15-2.889 5.255 5.255 0 0 0 -6.279 0 3.7 3.7 0 0 0 -1.15 2.89 3.7 3.7 0 0 0 1.148 2.89 5.255 5.255 0 0 0 6.281 0z" transform="translate(-48.482 -3.279)"/><path d="m157.635 26.619a1.847 1.847 0 0 1 -.594-1.38 1.949 1.949 0 0 1 .594-1.445 2.048 2.048 0 0 1 1.5-.586 2.016 2.016 0 0 1 2.067 2.031 1.865 1.865 0 0 1 -.581 1.38 2.028 2.028 0 0 1 -1.486.572 2.073 2.073 0 0 1 -1.5-.572z" transform="translate(-58.91 -8.703)"/></g></svg>

Before

Width:  |  Height:  |  Size: 4.7 KiB

@ -1 +0,0 @@
<svg viewBox="2.80001831 3.70000458 320.40002441 89.69999695" xmlns="http://www.w3.org/2000/svg"><path d="m33.2 64v-35.5h9.9c2.9 0 5.5.7 7.8 2s4.1 3.2 5.4 5.7 1.9 5.3 1.9 8.4v3.3c0 3.2-.6 6-1.9 8.4-1.3 2.5-3.1 4.4-5.4 5.7s-5 2-8 2zm3-33v30.5h6.8c3.7 0 6.7-1.2 9-3.7s3.4-5.8 3.4-10.1v-3.1c0-4.1-1.1-7.4-3.3-9.8-2.2-2.5-5.2-3.7-8.8-3.7h-7.1z"/><path d="m81 64c-.3-.8-.5-2.1-.6-3.7-1 1.3-2.3 2.4-3.9 3.1s-3.3 1.1-5 1.1c-2.5 0-4.6-.7-6.2-2.1s-2.4-3.2-2.4-5.4c0-2.6 1.1-4.6 3.2-6.1s5.1-2.2 8.9-2.2h5.3v-3c0-1.9-.6-3.4-1.7-4.5-1.2-1.1-2.9-1.6-5.1-1.6-2 0-3.7.5-5.1 1.6-1.3 1-2 2.3-2 3.8h-2.9c0-2.1 1-3.9 2.9-5.5s4.4-2.3 7.2-2.3c2.9 0 5.3.7 7 2.2s2.6 3.5 2.6 6.2v12.4c0 2.6.3 4.5.8 5.7v.3zm-9.2-2.1c2 0 3.7-.5 5.2-1.4s2.7-2.2 3.4-3.8v-5.8h-5.2c-2.9 0-5.2.6-6.8 1.6s-2.5 2.5-2.5 4.3c0 1.5.5 2.7 1.6 3.7s2.5 1.4 4.3 1.4z"/><path d="m94.6 30.9v6.8h5.5v2.3h-5.5v17.6c0 1.5.3 2.6.8 3.3s1.4 1.1 2.6 1.1c.5 0 1.3-.1 2.4-.2l.1 2.4c-.8.3-1.8.4-3.1.4-2 0-3.5-.6-4.4-1.7-.9-1.2-1.4-2.9-1.4-5.1v-17.8h-4.9v-2.4h4.9v-6.8h3z"/><path d="m121.8 64c-.3-.8-.5-2.1-.6-3.7-1 1.3-2.3 2.4-3.9 3.1s-3.3 1.1-5 1.1c-2.5 0-4.6-.7-6.2-2.1s-2.4-3.2-2.4-5.4c0-2.6 1.1-4.6 3.2-6.1s5.1-2.2 8.9-2.2h5.3v-3c0-1.9-.6-3.4-1.7-4.5-1.2-1.1-2.9-1.6-5.1-1.6-2 0-3.7.5-5.1 1.6-1.3 1-2 2.3-2 3.8h-2.9c0-2.1 1-3.9 2.9-5.5s4.4-2.3 7.2-2.3c2.9 0 5.3.7 7 2.2s2.6 3.5 2.6 6.2v12.4c0 2.6.3 4.5.8 5.7v.3zm-9.2-2.1c2 0 3.7-.5 5.2-1.4s2.7-2.2 3.4-3.8v-5.8h-5.2c-2.9 0-5.2.6-6.8 1.6s-2.5 2.5-2.5 4.3c0 1.5.5 2.7 1.6 3.7s2.6 1.4 4.3 1.4z"/><path d="m137.2 58 .4 2.3.6-2.4 6.3-20.2h2.5l6.3 20 .7 2.8.6-2.6 5.4-20.3h3l-7.6 26.4h-2.5l-6.8-20.9-.3-1.4-.3 1.5-6.7 20.8h-2.5l-7.7-26.4h3z"/><path d="m179.8 40.1c-.6-.1-1.3-.2-2-.2-1.8 0-3.4.5-4.6 1.5-1.3 1-2.2 2.5-2.7 4.4v18.2h-2.9v-26.4h2.9v4.2c1.5-3.1 4-4.7 7.4-4.7.8 0 1.5.1 1.9.3z"/><path d="m199.1 64c-.3-.8-.5-2.1-.6-3.7-1 1.3-2.3 2.4-3.9 3.1s-3.3 1.1-5 1.1c-2.5 0-4.6-.7-6.2-2.1s-2.4-3.2-2.4-5.4c0-2.6 1.1-4.6 3.2-6.1s5.1-2.2 8.9-2.2h5.3v-3c0-1.9-.6-3.4-1.7-4.5-1.2-1.1-2.9-1.6-5.1-1.6-2 0-3.7.5-5.1 1.6-1.3 1-2 2.3-2 3.8h-2.9c0-2.1 1-3.9 2.9-5.5s4.4-2.3 7.2-2.3c2.9 0 5.3.7 7 2.2s2.6 3.5 2.6 6.2v12.4c0 2.6.3 4.5.8 5.7v.3zm-9.2-2.1c2 0 3.7-.5 5.2-1.4s2.7-2.2 3.4-3.8v-5.8h-5.2c-2.9 0-5.2.6-6.8 1.6s-2.5 2.5-2.5 4.3c0 1.5.5 2.7 1.6 3.7 1.2.9 2.6 1.4 4.3 1.4z"/><path d="m229.5 51.1c0 4.1-.9 7.4-2.7 9.8s-4.3 3.6-7.3 3.6c-3.6 0-6.4-1.3-8.3-3.8v13.5h-2.9v-36.6h2.7l.1 3.7c1.9-2.8 4.7-4.2 8.3-4.2 3.2 0 5.6 1.2 7.4 3.6s2.7 5.7 2.7 10zm-3-.5c0-3.4-.7-6-2.1-8s-3.3-2.9-5.8-2.9c-1.8 0-3.3.4-4.6 1.3s-2.3 2.1-3 3.8v12.7c.7 1.5 1.7 2.7 3 3.5s2.8 1.2 4.6 1.2c2.5 0 4.4-1 5.8-2.9 1.5-2.2 2.1-5 2.1-8.7z"/><path d="m256.2 51.1c0 4.1-.9 7.4-2.7 9.8s-4.3 3.6-7.3 3.6c-3.6 0-6.4-1.3-8.3-3.8v13.5h-2.9v-36.6h2.7l.1 3.7c1.9-2.8 4.7-4.2 8.3-4.2 3.2 0 5.6 1.2 7.4 3.6s2.7 5.7 2.7 10zm-3-.5c0-3.4-.7-6-2.1-8s-3.3-2.9-5.8-2.9c-1.8 0-3.3.4-4.6 1.3s-2.3 2.1-3 3.8v12.7c.7 1.5 1.7 2.7 3 3.5s2.8 1.2 4.6 1.2c2.5 0 4.4-1 5.8-2.9 1.5-2.2 2.1-5 2.1-8.7z"/><path d="m271.9 64.5c-2.2 0-4.3-.6-6.1-1.7s-3.2-2.6-4.2-4.6-1.5-4.2-1.5-6.7v-1c0-2.5.5-4.8 1.5-6.9 1-2 2.4-3.6 4.1-4.8s3.7-1.7 5.7-1.7c3.2 0 5.7 1.1 7.6 3.3s2.8 5.2 2.8 9v1.6h-18.8v.6c0 3 .9 5.5 2.6 7.5s3.9 3 6.5 3c1.6 0 2.9-.3 4.1-.9s2.3-1.5 3.3-2.7l1.8 1.4c-2.2 3.1-5.3 4.6-9.4 4.6zm-.6-24.9c-2.2 0-4 .8-5.6 2.4-1.5 1.6-2.4 3.8-2.7 6.5h15.8v-.3c-.1-2.5-.8-4.6-2.2-6.2-1.3-1.6-3-2.4-5.3-2.4z"/><path d="m298.7 40.1c-.6-.1-1.3-.2-2-.2-1.8 0-3.4.5-4.6 1.5-1.3 1-2.2 2.5-2.7 4.4v18.2h-2.9v-26.4h2.9v4.2c1.5-3.1 4-4.7 7.4-4.7.8 0 1.5.1 1.9.3z"/><path d="m323.2 93.4h-320.4v-89.7h2.7v87h317.7z"/></svg>

Before

Width:  |  Height:  |  Size: 3.4 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save