Merge branch 'code-red' of github.com:sveltejs/svelte into code-red

pull/3539/head
Richard Harris 6 years ago
commit 1b85b366fa

@ -0,0 +1,18 @@
name: CI
on: [push, pull_request]
jobs:
Tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [8, 10, 12]
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- run: git config --global core.autocrlf false
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: 'npm i && npm test'
env:
CI: true

@ -1,20 +0,0 @@
language: node_js
node_js:
- "8"
- "10"
- "12"
env:
global:
- BUILD_TIMEOUT=20000
addons:
apt:
packages:
- xvfb
install:
- export DISPLAY=':99.0'
- Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
- npm ci || npm install
after_success: npm run codecov

@ -1,8 +1,16 @@
# Svelte changelog
## Unreleased
* Fix edge cases in matching selectors against elements ([#1710](https://github.com/sveltejs/svelte/issues/1710))
## 3.12.1
* Escape `@` symbols in props, again ([#3545](https://github.com/sveltejs/svelte/issues/3545))
## 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))
## 3.11.0

@ -1,31 +0,0 @@
# http://www.appveyor.com/docs/appveyor-yml
version: "{build}"
clone_depth: 10
init:
- git config --global core.autocrlf false
environment:
matrix:
- nodejs_version: 8
- nodejs_version: 10
- nodejs_version: 12
install:
- ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version)
- npm ci || npm install
build: off
test_script:
- node --version && npm --version
- npm test
matrix:
fast_finish: false
# cache:
# - C:\Users\appveyor\AppData\Roaming\npm-cache -> package.json # npm cache
# - node_modules -> package.json # local npm modules

42
package-lock.json generated

@ -1,6 +1,6 @@
{
"name": "svelte",
"version": "3.12.0",
"version": "3.12.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -203,25 +203,13 @@
"dev": true
},
"agadoo": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/agadoo/-/agadoo-1.0.1.tgz",
"integrity": "sha512-rEOSqXQ3ABoxmgvxqEvUfS7mcMJBqRhcMbmJq4j+EpCXN0P1cFHYQT66V7rYSu0C+3jialSk58yHTBqzY0m+Sw==",
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/agadoo/-/agadoo-1.1.0.tgz",
"integrity": "sha512-MiTXQ3As5jARRXa0eZF+ObtzsseQurCXOc1RB19NOGDsimEvoT8DB8iQiC0zAGTfsF/nBhzEle+eV9UpXyWnbw==",
"dev": true,
"requires": {
"rollup": "^0.64.1",
"rollup": "^1",
"rollup-plugin-virtual": "^1.0.1"
},
"dependencies": {
"rollup": {
"version": "0.64.1",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-0.64.1.tgz",
"integrity": "sha512-+ThdVXrvonJdOTzyybMBipP0uz605Z8AnzWVY3rf+cSGnLO7uNkJBlN+9jXqWOomkvumXfm/esmBpA5d53qm7g==",
"dev": true,
"requires": {
"@types/estree": "0.0.39",
"@types/node": "*"
}
}
}
},
"agent-base": {
@ -3074,26 +3062,20 @@
}
},
"rollup": {
"version": "1.20.3",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-1.20.3.tgz",
"integrity": "sha512-/OMCkY0c6E8tleeVm4vQVDz24CkVgvueK3r8zTYu2AQNpjrcaPwO9hE+pWj5LTFrvvkaxt4MYIp2zha4y0lRvg==",
"version": "1.21.4",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-1.21.4.tgz",
"integrity": "sha512-Pl512XVCmVzgcBz5h/3Li4oTaoDcmpuFZ+kdhS/wLreALz//WuDAMfomD3QEYl84NkDu6Z6wV9twlcREb4qQsw==",
"dev": true,
"requires": {
"@types/estree": "0.0.39",
"@types/node": "^12.7.2",
"@types/node": "^12.7.5",
"acorn": "^7.0.0"
},
"dependencies": {
"@types/node": {
"version": "12.7.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.4.tgz",
"integrity": "sha512-W0+n1Y+gK/8G2P/piTkBBN38Qc5Q1ZSO6B5H3QmPCUewaiXOo2GCAWZ4ElZCcNhjJuBSUSLGFUJnmlCn5+nxOQ==",
"dev": true
},
"acorn": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.0.0.tgz",
"integrity": "sha512-PaF/MduxijYYt7unVGRuds1vBC9bFxbNf+VWqhOClfdgy7RlVkQqt610ig1/yxTgsDIfW1cWDel5EBbOy3jdtQ==",
"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
}
}

@ -1,6 +1,6 @@
{
"name": "svelte",
"version": "3.12.0",
"version": "3.12.1",
"description": "Cybernetically enhanced web apps",
"module": "index.mjs",
"main": "index",
@ -61,7 +61,7 @@
"@typescript-eslint/eslint-plugin": "^1.13.0",
"@typescript-eslint/parser": "^2.1.0",
"acorn": "^7.0.0",
"agadoo": "^1.0.1",
"agadoo": "^1.1.0",
"c8": "^5.0.1",
"code-red": "0.0.15",
"codecov": "^3.5.0",
@ -77,7 +77,7 @@
"magic-string": "^0.25.3",
"mocha": "^6.2.0",
"puppeteer": "^1.19.0",
"rollup": "^1.20.3",
"rollup": "^1.21.4",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-node-resolve": "^5.2.0",

@ -696,7 +696,7 @@ out:draw={params}
Animates the stroke of an SVG element, like a snake in a tube. `in` transitions begin with the path invisible and draw the path to the screen over time. `out` transitions start in a visible state and gradually erase the path. `draw` only works with elements that have a `getTotalLength` method, like `<path>` and `<polyline>`.
`scale` accepts the following parameters:
`draw` accepts the following parameters:
* `delay` (`number`, default 0) — milliseconds before starting
* `speed` (`number`, default undefined) - the speed of the animation, see below.

@ -315,7 +315,7 @@ walk(ast: Node, {
---
The `walk` function provides a way to walk to abstract syntax trees generated by the parser, using the compiler's own built-in instance of [estree-walker](https://github.com/Rich-Harris/estree-walker).
The `walk` function provides a way to walk the abstract syntax trees generated by the parser, using the compiler's own built-in instance of [estree-walker](https://github.com/Rich-Harris/estree-walker).
The walker takes an abstract syntax tree to walk and an object with two optional methods: `enter` and `leave`. For each node, `enter` is called (if present). Then, unless `this.skip()` is called during `enter`, each of the children are traversed, and then `leave` is called on the node.

@ -109,7 +109,11 @@
</style>
<div class='board'>
<input class="new-todo" placeholder="what needs to be done?" on:keydown="{event => event.which === 13 && add(this)}">
<input
class="new-todo"
placeholder="what needs to be done?"
on:keydown="{event => event.which === 13 && add(event.target)}"
>
<div class='left'>
<h2>todo</h2>

@ -4,13 +4,13 @@ title: Keyed each blocks
By default, when you modify the value of an `each` block, it will add and remove items at the *end* of the block, and update any values that have changed. That might not be what you want.
It's easier to show why than to explain. Click the 'Remove first thing' button a few times, and notice that it's removing `<Thing>` components from the end and updating the `value` for those that remain. Instead, we'd like to remove the first `<Thing>` component and leave the rest unaffected.
It's easier to show why than to explain. Click the 'Remove first thing' button a few times, and notice that it's removing `<Thing>` components from the end and updating the `color` for those that remain. Instead, we'd like to remove the first `<Thing>` component and leave the rest unaffected.
To do that, we specify a unique identifier for the `each` block:
```html
{#each things as thing (thing.id)}
<Thing current={thing.value}/>
<Thing current={thing.color}/>
{/each}
```

@ -1261,9 +1261,9 @@
"integrity": "sha512-ym6ooqMr09+cV+y52p5kszJ0jYcX+nJfm8POrQb7QYowvpPPuneZ71EclHrQSB7a50lcytgR/xtL6AUFdvyEkg=="
},
"@polka/send": {
"version": "1.0.0-next.3",
"resolved": "https://registry.npmjs.org/@polka/send/-/send-1.0.0-next.3.tgz",
"integrity": "sha512-54ftOGSZQMx8Xh8pnPgAj4499wppAEHQ892A7WacYOJ7ySuCWVgFmpODmXC2hU7qD9Scbi0iAu8rZls3ld+Eyg=="
"version": "1.0.0-next.6",
"resolved": "https://registry.npmjs.org/@polka/send/-/send-1.0.0-next.6.tgz",
"integrity": "sha512-4ON4Yf/QcP9I6HmFvn8rspRdBQ6NupSkUvAkUKo4gT2SSSWrrHMqDVQJsvDr4BRGRIVZSg+gr6W3M9Xj3V3JSQ=="
},
"@polka/url": {
"version": "1.0.0-next.3",
@ -3119,12 +3119,12 @@
"dev": true
},
"polka": {
"version": "1.0.0-next.4",
"resolved": "https://registry.npmjs.org/polka/-/polka-1.0.0-next.4.tgz",
"integrity": "sha512-14UAMEVp6UjRepYIjJ/KZcFD0wD4TpDqBGmdgeg5SmhmBHBFR2LdTTXxx/y7GPa4537ZcK28Nsld+hynBE/qDw==",
"version": "1.0.0-next.6",
"resolved": "https://registry.npmjs.org/polka/-/polka-1.0.0-next.6.tgz",
"integrity": "sha512-e3vZm2cMmPPrgn+0J5DO0rrSTfsCHGyh+YS6jjrqYP8BHJkPq8nCVSDxHkaiEN4f0c2dtR6FB+snDmLE/sRz7A==",
"requires": {
"@polka/url": "^1.0.0-next.3",
"trouter": "^3.0.2"
"trouter": "^3.1.0"
}
},
"postgres-array": {
@ -3342,9 +3342,9 @@
}
},
"rollup": {
"version": "1.21.0",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-1.21.0.tgz",
"integrity": "sha512-FDIPkcIdLg7262zzqteTWNr7GxU7hw3nJiiKY9P38LE3BAZ7tFC0Di/AzISIxHEQBvneu5bW51a7o50P1NgDCg==",
"version": "1.21.2",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-1.21.2.tgz",
"integrity": "sha512-sCAHlcQ/PExU5t/kRwkEWHdhGmQrZ2IgdQzbjPVNfhWbKHMMZGYqkASVTpQqRPLtQKg15xzEscc+BnIK/TE7/Q==",
"dev": true,
"requires": {
"@types/estree": "0.0.39",
@ -3775,9 +3775,9 @@
}
},
"svelte": {
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/svelte/-/svelte-3.10.1.tgz",
"integrity": "sha512-XjXJVHAhnLAXS0P735PiT3is+9Oq8nX8adtiyaLJSeoEbN6TwNxu58jhAHlxG2f9+LAq7QbVJvgHkGdkZTFBog==",
"version": "3.12.0",
"resolved": "https://registry.npmjs.org/svelte/-/svelte-3.12.0.tgz",
"integrity": "sha512-9/broj3bjShrsk3FuVDH0Bho2BchPKT8ubAqRcTqwkqrO9npOS3Vi98Yb5mBaa4bYV+ELTuvPvaQZbCJYMFRdg==",
"dev": true
},
"tar": {

@ -14,7 +14,7 @@
},
"dependencies": {
"@polka/redirect": "^1.0.0-next.0",
"@polka/send": "^1.0.0-next.3",
"@polka/send": "^1.0.0-next.6",
"cookie": "^0.4.0",
"devalue": "^2.0.0",
"do-not-zip": "^1.0.0",
@ -23,7 +23,7 @@
"jsonwebtoken": "^8.5.1",
"marked": "^0.7.0",
"pg": "^7.12.1",
"polka": "^1.0.0-next.4",
"polka": "^1.0.0-next.6",
"prismjs": "^1.17.1",
"sirv": "^0.4.2",
"yootils": "0.0.16"
@ -45,7 +45,7 @@
"node-fetch": "^2.6.0",
"node-pg-migrate": "^3.22.0",
"npm-run-all": "^4.1.5",
"rollup": "^1.21.0",
"rollup": "^1.21.2",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-json": "^4.0.0",
@ -55,7 +55,7 @@
"rollup-plugin-terser": "^5.1.1",
"sapper": "^0.27.8",
"shelljs": "^0.8.3",
"svelte": "^3.10.1"
"svelte": "^3.12.0"
},
"engines": {
"node": ">=10.0.0"

@ -38,7 +38,7 @@
{#each labels as label, index}
<button
class:selected={offset === index}
on:click={() => {offset = index}}
on:click={() => offset = index}
>
{label}
</button>

@ -56,6 +56,7 @@
<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>
@ -67,8 +68,10 @@
<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>

@ -4,7 +4,7 @@
let offset = null;
if (user) {
var url = 'apps.json';
let url = 'apps.json';
if (page.query.offset) {
url += `?offset=${encodeURIComponent(page.query.offset)}`;
}
@ -50,9 +50,9 @@
<h1>Your apps</h1>
<div class="user">
<img class="avatar" alt="{user.name} avatar" src="{user.avatar}">
<img class="avatar" alt="{user.name || user.username} avatar" src="{user.avatar}">
<span>
{user.name}
{user.name || user.username}
(<a on:click|preventDefault={logout} href="auth/logout">log out</a>)
</span>
</div>

@ -7,23 +7,6 @@ import marked from 'marked';
import PrismJS from 'prismjs';
import 'prismjs/components/prism-bash';
const escaped = {
'"': '&quot;',
"'": '&#39;',
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
};
const unescaped = Object.keys(escaped).reduce(
(unescaped, key) => ((unescaped[escaped[key]] = key), unescaped),
{}
);
function unescape(str) {
return String(str).replace(/&.+?;/g, match => unescaped[match] || match);
}
const blockTypes = [
'blockquote',
'html',

@ -95,7 +95,8 @@ export async function patch(req, res) {
const { user } = req;
if (!user) return;
let id, uid = req.params.id;
let id;
const uid = req.params.id;
try {
const [row] = await query(`select * from gists where uid = $1 limit 1`, [uid]);
@ -110,7 +111,9 @@ export async function patch(req, res) {
try {
const obj = await body(req);
obj.updated_at = 'now()';
let k, cols=[], vals=[];
let k;
const cols = [];
const vals = [];
for (k in obj) {
cols.push(k);
vals.push(k === 'files' ? JSON.stringify(obj[k]) : obj[k]);

@ -18,7 +18,6 @@
import { getContext } from 'svelte';
import ScreenToggle from '../../../components/ScreenToggle.svelte';
import { Icon } from '@sveltejs/site-kit';
import TableOfContents from './_TableOfContents.svelte';
import {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="735px" height="115px" viewBox="0 0 735 115" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 51.1 (57501) - http://www.bohemiancoding.com/sketch -->
<title>logo colour</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-3" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="concept-one-rough-test-copy" transform="translate(-23.000000, -11.000000)" fill="#373C8B">
<g id="logo-colour">
<path d="M185.446,92 L185.446,24.638 L226.131,24.638 L226.131,34.732 L197.394,34.732 L197.394,53.787 L221.805,53.787 L221.805,63.881 L197.394,63.881 L197.394,92 L185.446,92 Z M234.268,73.151 L234.268,41.427 L246.113,41.427 L246.113,71.606 C246.113,79.949 248.482,83.039 253.941,83.039 C258.37,83.039 261.357,80.979 265.168,76.035 L265.168,41.427 L277.013,41.427 L277.013,92 L267.331,92 L266.404,84.584 L266.095,84.584 C261.666,89.837 256.722,93.236 249.821,93.236 C239.006,93.236 234.268,85.923 234.268,73.151 Z M287.004,86.232 L292.566,78.61 C297.098,82.112 301.424,84.275 306.574,84.275 C312.033,84.275 314.608,81.7 314.608,78.198 C314.608,73.975 309.149,72.121 303.793,70.061 C297.098,67.589 289.579,63.778 289.579,55.332 C289.579,46.474 296.686,40.191 308.016,40.191 C315.02,40.191 320.685,43.075 324.805,46.268 L319.346,53.478 C315.844,50.903 312.239,49.152 308.222,49.152 C303.175,49.152 300.806,51.521 300.806,54.714 C300.806,58.628 305.853,60.276 311.312,62.233 C318.213,64.808 325.835,68.104 325.835,77.58 C325.835,86.232 318.934,93.236 306.162,93.236 C299.261,93.236 291.948,90.249 287.004,86.232 Z M342.418,32.569 C338.195,32.569 335.105,29.788 335.105,25.874 C335.105,21.857 338.195,19.076 342.418,19.076 C346.641,19.076 349.731,21.857 349.731,25.874 C349.731,29.788 346.641,32.569 342.418,32.569 Z M336.444,92 L336.444,41.427 L348.289,41.427 L348.289,92 L336.444,92 Z M360.134,66.765 C360.134,49.873 371.567,40.191 384.133,40.191 C396.802,40.191 408.235,49.873 408.235,66.765 C408.235,83.554 396.802,93.236 384.133,93.236 C371.567,93.236 360.134,83.554 360.134,66.765 Z M372.288,66.765 C372.288,76.859 376.717,83.554 384.133,83.554 C391.549,83.554 396.081,76.859 396.081,66.765 C396.081,56.568 391.549,49.873 384.133,49.873 C376.717,49.873 372.288,56.568 372.288,66.765 Z M419.977,92 L419.977,41.427 L429.762,41.427 L430.586,48.225 L430.998,48.225 C435.53,43.796 440.68,40.191 447.581,40.191 C458.396,40.191 463.134,47.504 463.134,60.276 L463.134,92 L451.289,92 L451.289,61.821 C451.289,53.478 448.92,50.388 443.358,50.388 C438.929,50.388 436.045,52.551 431.822,56.671 L431.822,92 L419.977,92 Z M474.979,58.525 C474.979,36.483 488.781,23.402 506.085,23.402 C514.325,23.402 521.02,27.419 525.243,31.951 L518.651,39.367 C515.149,35.968 511.338,33.805 506.188,33.805 C495.167,33.805 487.236,43.075 487.236,58.216 C487.236,73.563 494.549,82.833 505.776,82.833 C511.75,82.833 516.179,80.361 519.99,76.138 L526.582,83.451 C521.123,89.734 514.119,93.236 505.57,93.236 C488.472,93.236 474.979,80.876 474.979,58.525 Z M536.676,92 L536.676,19.282 L548.521,19.282 L548.521,38.028 L548.109,47.813 C552.332,43.796 557.379,40.191 564.28,40.191 C575.095,40.191 579.833,47.504 579.833,60.276 L579.833,92 L567.988,92 L567.988,61.821 C567.988,53.478 565.619,50.388 560.057,50.388 C555.628,50.388 552.744,52.551 548.521,56.671 L548.521,92 L536.676,92 Z M591.987,78.404 C591.987,67.589 601.051,61.924 621.754,59.658 C621.651,54.302 619.385,49.77 612.587,49.77 C607.54,49.77 602.802,52.036 598.373,54.714 L594.047,46.783 C599.609,43.281 606.716,40.191 614.75,40.191 C627.419,40.191 633.599,47.916 633.599,62.027 L633.599,92 L623.917,92 L622.99,86.438 L622.681,86.438 C618.149,90.249 612.999,93.236 607.025,93.236 C598.167,93.236 591.987,87.262 591.987,78.404 Z M603.523,77.477 C603.523,82.009 606.51,83.966 610.733,83.966 C614.853,83.966 618.046,81.906 621.754,78.404 L621.754,67.074 C608.055,68.825 603.523,72.43 603.523,77.477 Z M648.019,92 L648.019,41.427 L657.804,41.427 L658.628,50.388 L659.04,50.388 C662.645,43.796 668.001,40.191 673.357,40.191 C675.932,40.191 677.58,40.5 679.125,41.221 L677.065,51.521 C675.314,51.006 673.975,50.697 671.812,50.697 C667.795,50.697 662.954,53.478 659.864,61.1 L659.864,92 L648.019,92 Z M688.189,74.902 L688.189,50.8 L680.979,50.8 L680.979,41.942 L688.807,41.427 L690.249,27.625 L700.137,27.625 L700.137,41.427 L713.012,41.427 L713.012,50.8 L700.137,50.8 L700.137,74.902 C700.137,80.876 702.403,83.76 707.244,83.76 C708.995,83.76 711.055,83.245 712.497,82.627 L714.557,91.382 C711.776,92.309 708.274,93.236 704.257,93.236 C692.515,93.236 688.189,85.82 688.189,74.902 Z M718.574,86.232 L724.136,78.61 C728.668,82.112 732.994,84.275 738.144,84.275 C743.603,84.275 746.178,81.7 746.178,78.198 C746.178,73.975 740.719,72.121 735.363,70.061 C728.668,67.589 721.149,63.778 721.149,55.332 C721.149,46.474 728.256,40.191 739.586,40.191 C746.59,40.191 752.255,43.075 756.375,46.268 L750.916,53.478 C747.414,50.903 743.809,49.152 739.792,49.152 C734.745,49.152 732.376,51.521 732.376,54.714 C732.376,58.628 737.423,60.276 742.882,62.233 C749.783,64.808 757.405,68.104 757.405,77.58 C757.405,86.232 750.504,93.236 737.732,93.236 C730.831,93.236 723.518,90.249 718.574,86.232 Z" id="FusionCharts"></path>
<rect id="Rectangle-2-Copy-4" x="23.4041667" y="22.8571429" width="23.4041667" height="68.5714286"></rect>
<rect id="Rectangle-2-Copy-5" x="57.0833333" y="56.5714286" width="23.975" height="34.8571429"></rect>
<rect id="Rectangle-2-Copy-6" x="91.9041667" y="11.4285714" width="22.2625" height="80"></rect>
<rect id="Rectangle-2-Copy-7" x="91.9041667" y="101.714286" width="22.2625" height="23.4285714"></rect>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="800px" height="160px" viewBox="0 0 800 160" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 49.3 (51167) - http://www.bohemiancoding.com/sketch -->
<title>Dark</title>
<desc>Created with Sketch.</desc>
<defs>
<polygon id="path-1" points="0.321905678 0.275424046 91.2854215 0.275424046 91.2854215 120.758046 0.321905678 120.758046"></polygon>
<polygon id="path-3" points="0.000265185374 0.245106383 217.001549 0.245106383 217.001549 160 0.000265185374 160"></polygon>
</defs>
<g id="Dark" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Logo">
<path d="M275.066842,101.866245 L298.520492,101.866245 C310.08215,101.866245 318.670431,93.9910625 318.670431,83.3267532 C318.670431,72.8265103 310.08215,64.951328 299.015612,64.951328 L275.066842,64.951328 L275.066842,101.866245 Z M275.066842,120.405359 L275.066842,156 L252.439024,156 L252.439024,46.4122137 L304.466487,46.4122137 C325.111926,46.4122137 341.463415,61.6703793 341.463415,83.3267532 C341.463415,105.147193 325.442259,120.405359 303.970608,120.405359 L275.066842,120.405359 Z" id="Fill-1" fill="#2C3E50"></path>
<path d="M412.210747,116.169033 C412.210747,103.600873 402.12157,93.5132706 389.551448,93.5132706 C376.981707,93.5132706 366.727134,103.600873 366.727134,116.169033 C366.727134,128.737573 376.981707,138.990166 389.551448,138.990166 C402.12157,138.990166 412.210747,128.737573 412.210747,116.169033 M385.581936,73.5038168 C397.325456,73.5038168 409.564405,79.4571558 413.86471,89.0486465 L414.360899,89.0486465 L415.187881,75.6536337 L435.365854,75.6536337 L435.365854,156 L415.187881,156 L414.360899,143.45517 L413.86471,143.45517 C409.398629,153.377402 396.663491,159 385.581936,159 C365.07279,159 343.902439,141.801465 343.902439,116.169033 C343.902439,90.5369813 365.238567,73.5038168 385.581936,73.5038168 Z" id="Fill-3" fill="#2C3E50"></path>
<path d="M442.682927,75.6460779 L462.812052,75.6460779 L464.131994,88.9940123 L464.46198,88.9940123 C469.411765,79.4362321 479.971306,73.5038168 490.860832,73.5038168 C512.804499,73.5038168 526.829268,90.3123268 526.829268,111.899348 L526.829268,156 L504.059879,156 L504.059879,114.206777 C504.059879,103.001104 495.810238,93.7729023 484.756098,93.7729023 C474.196557,93.7729023 465.451937,103.165893 465.451937,114.701145 L465.451937,156 L442.682927,156 L442.682927,75.6460779 Z" id="Fill-5" fill="#2C3E50"></path>
<polygon id="Fill-7" fill="#2C3E50" points="534.146341 38.0839695 557.050183 38.0839695 557.050183 107.0289 557.382123 107.0289 588.086549 75.7649175 616.632984 75.7649175 579.621704 112.788055 617.914429 156 589.206787 156 557.382123 118.547209 557.050183 118.547209 557.050183 156 534.146341 156"></polygon>
<path d="M680.792588,117.169033 C680.792588,104.766624 670.354166,94.5132706 657.92702,94.5132706 C645.499874,94.5132706 635.061071,104.766624 635.061071,117.169033 C635.061071,129.737573 645.499874,139.990166 657.92702,139.990166 C670.354166,139.990166 680.792588,129.737573 680.792588,117.169033 M612.195122,117.169033 C612.195122,93.686418 632.741337,74.5038168 657.92702,74.5038168 C683.112322,74.5038168 703.658537,93.686418 703.658537,117.169033 C703.658537,140.652028 683.112322,160 657.92702,160 C632.741337,160 612.195122,140.652028 612.195122,117.169033" id="Fill-9" fill="#2C3E50"></path>
<g id="Group-13" transform="translate(708.536585, 37.862595)">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<g id="Clip-12"></g>
<path d="M68.5035169,78.1861569 C68.5035169,65.6940195 58.4330533,55.6674355 45.8862463,55.6674355 C33.3398188,55.6674355 23.1042658,65.6940195 23.1042658,78.1861569 C23.1042658,90.6786721 33.3398188,100.869248 45.8862463,100.869248 C58.4330533,100.869248 68.5035169,90.6786721 68.5035169,78.1861569 Z M91.2854974,0.275424046 L91.2854974,118.137405 L71.3027701,118.137405 L70.3195021,105.307245 L69.9893229,105.307245 C65.5319047,115.169458 52.6549185,120.758046 41.5942971,120.758046 C20.6275428,120.758046 0.321905678,103.663542 0.321905678,78.1861569 C0.321905678,52.7091492 20.6275428,35.7790156 41.0986489,35.7790156 C52.6549185,35.7790156 64.0460986,41.8607141 68.1733377,51.2298172 L68.5035169,51.2298172 L68.5035169,0.275424046 L91.2854974,0.275424046 Z" id="Fill-11" fill="#2C3E50" mask="url(#mask-2)"></path>
</g>
<g id="Group-16">
<mask id="mask-4" fill="white">
<use xlink:href="#path-3"></use>
</mask>
<g id="Clip-15"></g>
<path d="M182.173146,72.3045674 C179.882324,72.7406903 176.517879,72.4520851 172.983716,68.9373806 C169.314687,65.3250875 168.638464,63.1758676 168.732794,61.9972388 C168.784695,61.348539 169.590479,61.0701466 170.049629,61.5319905 C175.829533,67.3460804 179.87058,69.6632435 182.307255,70.5770969 C183.159257,70.8959622 183.066821,72.1343546 182.173146,72.3045674 M208.714793,77.9684917 C202.438992,73.3954421 181.685963,52.03374 159.689215,34.322156 C153.250514,28.1619669 145.345717,21.3685863 135.155401,15.1705721 C77.8814213,-19.6647943 18.2991925,17.3969551 18.2991925,17.3969551 C87.7360886,-8.66299764 129.308821,27.0866005 129.308821,27.0866005 C75.6527276,7.74437825 14.4218035,29.2055603 0.000265185374,46.0547329 C6.59466777,42.4590827 32.1161082,28.8768605 77.4082548,30.8399811 C107.795468,32.6922742 125.986806,45.028539 136.685142,57.3368132 C136.950706,57.7177116 137.28143,58.1092009 137.685269,58.5131726 C137.686785,58.5150638 137.688679,58.5169551 137.690194,58.5188463 C137.66216,58.5286809 123.69712,63.5155366 106.920356,56.5572388 C106.920356,56.5572388 117.255009,72.0348747 130.948045,72.8091537 C128.986052,80.5042837 127.100584,89.4154894 125.537885,101.514969 C121.14149,137.54069 172.870822,156.693787 181.428733,159.607073 L182.620173,160.000076 C182.620173,160.000076 163.760189,141.684804 165.568375,98.8630544 C153.16717,92.9298156 152.650438,83.1274515 151.875339,80.0318487 C151.875339,80.0318487 158.334497,90.3505248 164.018177,90.8660804 C169.702236,91.6399811 175.263173,89.971896 177.453226,89.5766241 C180.489977,89.028539 188.304232,90.3505248 188.820965,96.5413522 C189.079331,104.538326 186.754034,117.178326 198.380519,122.853598 C198.380519,122.853598 195.279744,106.602061 203.547466,106.344095 C207.939694,106.85965 211.298077,106.602061 211.815189,103.764426 C212.590288,100.410856 214.140107,96.2837636 215.94905,92.1559149 C217.757235,88.0284444 218.273968,84.9332199 208.714793,77.9684917" id="Fill-14" fill="#2C3E50" mask="url(#mask-4)"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 KiB

After

Width:  |  Height:  |  Size: 111 KiB

@ -138,8 +138,9 @@ function apply_selector(stylesheet: Stylesheet, blocks: Block[], node: CssNode,
while (i--) {
const selector = block.selectors[i];
const name = typeof selector.name === 'string' && selector.name.replace(/\\(.)/g, '$1');
if (selector.type === 'PseudoClassSelector' && selector.name === 'global') {
if (selector.type === 'PseudoClassSelector' && name === 'global') {
// TODO shouldn't see this here... maybe we should enforce that :global(...)
// cannot be sandwiched between non-global selectors?
return false;
@ -150,11 +151,11 @@ function apply_selector(stylesheet: Stylesheet, blocks: Block[], node: CssNode,
}
if (selector.type === 'ClassSelector') {
if (!attribute_matches(node, 'class', selector.name, '~=', false) && !class_matches(node, selector.name)) return false;
if (!attribute_matches(node, 'class', name, '~=', false) && !node.classes.some(c => c.name === name)) return false;
}
else if (selector.type === 'IdSelector') {
if (!attribute_matches(node, 'id', selector.name, '=', false)) return false;
if (!attribute_matches(node, 'id', name, '=', false)) return false;
}
else if (selector.type === 'AttributeSelector') {
@ -162,8 +163,7 @@ function apply_selector(stylesheet: Stylesheet, blocks: Block[], node: CssNode,
}
else if (selector.type === 'TypeSelector') {
// remove toLowerCase() in v2, when uppercase elements will be forbidden
if (node.name.toLowerCase() !== selector.name.toLowerCase() && selector.name !== '*') return false;
if (node.name.toLowerCase() !== name.toLowerCase() && name !== '*') return false;
}
else {
@ -206,14 +206,21 @@ function apply_selector(stylesheet: Stylesheet, blocks: Block[], node: CssNode,
return true;
}
const operators = {
'=' : (value: string, flags: string) => new RegExp(`^${value}$`, flags),
'~=': (value: string, flags: string) => new RegExp(`\\b${value}\\b`, flags),
'|=': (value: string, flags: string) => new RegExp(`^${value}(-.+)?$`, flags),
'^=': (value: string, flags: string) => new RegExp(`^${value}`, flags),
'$=': (value: string, flags: string) => new RegExp(`${value}$`, flags),
'*=': (value: string, flags: string) => new RegExp(value, flags)
};
function test_attribute(operator, expected_value, case_insensitive, value) {
if (case_insensitive) {
expected_value = expected_value.toLowerCase();
value = value.toLowerCase();
}
switch (operator) {
case '=': return value === expected_value;
case '~=': return ` ${value} `.includes(` ${expected_value} `);
case '|=': return `${value}-`.startsWith(`${expected_value}-`);
case '^=': return value.startsWith(expected_value);
case '$=': return value.endsWith(expected_value);
case '*=': return value.includes(expected_value);
default: throw new Error(`this shouldn't happen`);
}
}
function attribute_matches(node: CssNode, name: string, expected_value: string, operator: string, case_insensitive: boolean) {
const spread = node.attributes.find(attr => attr.type === 'Spread');
@ -227,18 +234,17 @@ function attribute_matches(node: CssNode, name: string, expected_value: string,
if (attr.chunks.length > 1) return true;
if (!expected_value) return true;
const pattern = operators[operator](expected_value, case_insensitive ? 'i' : '');
const value = attr.chunks[0];
if (!value) return false;
if (value.type === 'Text') return pattern.test(value.data);
if (value.type === 'Text') return test_attribute(operator, expected_value, case_insensitive, value.data);
const possible_values = new Set();
gather_possible_values(value.node, possible_values);
if (possible_values.has(UNKNOWN)) return true;
for (const x of Array.from(possible_values)) { // TypeScript for-of is slightly unlike JS
if (pattern.test(x)) return true;
for (const value of possible_values) {
if (test_attribute(operator, expected_value, case_insensitive, value)) return true;
}
return false;

@ -0,0 +1 @@
.-foo.svelte-xyz{color:red}[title='['].svelte-xyz{color:blue}

@ -0,0 +1,12 @@
<div class='-foo'>foo</div>
<div title='['>bar</div>
<style>
.-foo {
color: red;
}
[title='['] {
color: blue;
}
</style>

@ -1,4 +1,7 @@
export default {
compileOptions: {
dev: true
},
props: { foo: 'foo' },
html: `<div>foo @ foo # foo</div>`,
};

@ -3,4 +3,5 @@
export let foo;
</script>
<Widget value='foo @ {foo} # foo'/>
<Widget value='foo @ {foo} # foo'>
</Widget>
Loading…
Cancel
Save