mirror of https://github.com/sveltejs/svelte
commit
c9d5b1b4a3
@ -0,0 +1,50 @@
|
|||||||
|
name: "\U0001F41E Bug report"
|
||||||
|
description: Report an issue with Svelte
|
||||||
|
labels: ["triage: bug"]
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Thanks for taking the time to fill out this bug report!
|
||||||
|
- type: textarea
|
||||||
|
id: bug-description
|
||||||
|
attributes:
|
||||||
|
label: Describe the bug
|
||||||
|
description: A clear and concise description of what the bug is. If you intend to submit a PR for this issue, tell us in the description. Thanks!
|
||||||
|
placeholder: Bug description
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: reproduction
|
||||||
|
attributes:
|
||||||
|
label: Reproduction
|
||||||
|
description: Please provide a link to a repo or REPL that can reproduce the problem you ran into. If a report is vague (e.g. just a generic error message) and has no reproduction, it will receive a "need reproduction" label. If no reproduction is provided within a reasonable time-frame, the issue will be closed.
|
||||||
|
placeholder: Reproduction
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: logs
|
||||||
|
attributes:
|
||||||
|
label: Logs
|
||||||
|
description: "Please include browser console and server logs around the time this bug occurred. Optional if provided reproduction. Please try not to insert an image but copy paste the log text."
|
||||||
|
render: shell
|
||||||
|
- type: textarea
|
||||||
|
id: system-info
|
||||||
|
attributes:
|
||||||
|
label: System Info
|
||||||
|
description: Output of `npx envinfo --system --npmPackages svelte,rollup,webpack --binaries --browsers`
|
||||||
|
render: shell
|
||||||
|
placeholder: System, Binaries, Browsers
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: dropdown
|
||||||
|
id: severity
|
||||||
|
attributes:
|
||||||
|
label: Severity
|
||||||
|
description: Select the severity of this issue
|
||||||
|
options:
|
||||||
|
- annoyance
|
||||||
|
- blocking an upgrade
|
||||||
|
- blocking all usage of svelte
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
blank_issues_enabled: false
|
||||||
|
contact_links:
|
||||||
|
- name: Discord Chat
|
||||||
|
url: https://svelte.dev/chat
|
||||||
|
about: Ask questions and discuss with other Svelte users in real time.
|
||||||
@ -1,28 +0,0 @@
|
|||||||
---
|
|
||||||
name: Feature request
|
|
||||||
about: Suggest an idea for this project
|
|
||||||
title: ''
|
|
||||||
labels: 'New Feature'
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
<!--
|
|
||||||
If you'd like to propose an implementation for a large new feature or change then please create an RFC:
|
|
||||||
https://github.com/sveltejs/rfcs
|
|
||||||
-->
|
|
||||||
|
|
||||||
**Is your feature request related to a problem? Please describe.**
|
|
||||||
A clear and concise description of what the problem is. For example: I'm always frustrated when [...]
|
|
||||||
|
|
||||||
**Describe the solution you'd like**
|
|
||||||
A clear and concise description of what you want to happen.
|
|
||||||
|
|
||||||
**Describe alternatives you've considered**
|
|
||||||
A clear and concise description of any alternative solutions or features you've considered.
|
|
||||||
|
|
||||||
**How important is this feature to you?**
|
|
||||||
Note: the more honest and specific you are here the more we will take you seriously.
|
|
||||||
|
|
||||||
**Additional context**
|
|
||||||
Add any other context or screenshots about the feature request here.
|
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
name: "Feature Request"
|
||||||
|
description: Request a new Svelte feature
|
||||||
|
labels: [enhancement]
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Thanks for taking the time to request this feature! If your feature request is complex or substantial enough to warrant in-depth discussion, maintainers may close the issue and ask you to open an [RFC](https://github.com/sveltejs/rfcs).
|
||||||
|
- type: textarea
|
||||||
|
id: problem
|
||||||
|
attributes:
|
||||||
|
label: Describe the problem
|
||||||
|
description: Please provide a clear and concise description the problem this feature would solve. The more information you can provide here, the better.
|
||||||
|
placeholder: I'm always frustrated when...
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: solution
|
||||||
|
attributes:
|
||||||
|
label: Describe the proposed solution
|
||||||
|
description: Please provide a clear and concise description of what you would like to happen.
|
||||||
|
placeholder: I would like to see...
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: alternatives
|
||||||
|
attributes:
|
||||||
|
label: Alternatives considered
|
||||||
|
description: "Please provide a clear and concise description of any alternative solutions or features you've considered."
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: dropdown
|
||||||
|
id: importance
|
||||||
|
attributes:
|
||||||
|
label: Importance
|
||||||
|
description: How important is this feature to you?
|
||||||
|
options:
|
||||||
|
- nice to have
|
||||||
|
- would make my life easier
|
||||||
|
- i cannot use svelte without it
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
name: Questions and help
|
|
||||||
about: If you think you need help with something related to Svelte
|
|
||||||
title: ''
|
|
||||||
labels: 'Question'
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
This issue tracker is intended to collect bug reports and feature requests.
|
|
||||||
|
|
||||||
For help with installation, information on how features work, or questions about specific features of Svelte, please come and join us in the [Svelte Discord](https://svelte.dev/chat), or ask your question on [Stack Overflow](https://stackoverflow.com/questions/tagged/svelte). Any issues open for help requests will be closed to keep from clogging up the issue tracker.
|
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
# Configuration for probot-stale - https://github.com/probot/stale
|
||||||
|
|
||||||
|
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
|
||||||
|
onlyLabels: []
|
||||||
|
|
||||||
|
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
|
||||||
|
exemptLabels:
|
||||||
|
- popular
|
||||||
|
- pinned
|
||||||
|
- security
|
||||||
|
- bug
|
||||||
|
- "[Status] Maybe Later"
|
||||||
|
|
||||||
|
# Set to true to ignore issues in a project (defaults to false)
|
||||||
|
exemptProjects: false
|
||||||
|
|
||||||
|
# Set to true to ignore issues in a milestone (defaults to false)
|
||||||
|
exemptMilestones: false
|
||||||
|
|
||||||
|
# Set to true to ignore issues with an assignee (defaults to false)
|
||||||
|
exemptAssignees: false
|
||||||
|
|
||||||
|
# Label to use when marking as stale
|
||||||
|
staleLabel: stale-bot
|
||||||
|
|
||||||
|
# Comment to post when removing the stale label.
|
||||||
|
# unmarkComment: >
|
||||||
|
# Your comment here.
|
||||||
|
|
||||||
|
# Limit the number of actions per hour, from 1-30. Default is 30
|
||||||
|
limitPerRun: 30
|
||||||
|
|
||||||
|
# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
|
||||||
|
pulls:
|
||||||
|
daysUntilStale: 210
|
||||||
|
daysUntilClose: 25
|
||||||
|
markComment: >
|
||||||
|
This pull request has been automatically marked as stale because it has not had
|
||||||
|
recent activity. It will be closed if no further activity occurs. Thank you
|
||||||
|
for your contributions.
|
||||||
|
closeComment: >
|
||||||
|
This pull request has been closed as it was previously marked as stale and saw no subsequent activity.
|
||||||
|
|
||||||
|
issues:
|
||||||
|
daysUntilStale: 180
|
||||||
|
daysUntilClose: 14
|
||||||
|
markComment: >
|
||||||
|
This issue has been automatically marked as stale because it has not had
|
||||||
|
recent activity. It will be closed if no further activity occurs. Thank you
|
||||||
|
for your contributions.
|
||||||
|
closeComment: >
|
||||||
|
This issue has been closed as it was previously marked as stale and saw no subsequent activity.
|
||||||
@ -0,0 +1,65 @@
|
|||||||
|
---
|
||||||
|
title: What's new in Svelte: June 2021
|
||||||
|
description: Progress towards SvelteKit 1.0 and tighter TypeScript/Svelte integrations in language tools
|
||||||
|
author: Daniel Sandoval
|
||||||
|
authorURL: https://desandoval.net
|
||||||
|
---
|
||||||
|
|
||||||
|
This month, we saw lots of contributions to SvelteKit and its docs. The language tools also got some new features, most notably deeper integration with Svelte files within JavaScript or TypeScript files. Let's jump into the updates...
|
||||||
|
|
||||||
|
## New in SvelteKit
|
||||||
|
- `svelte.config.js` config files are now loaded in ESM format (`.js` instead of `.cjs`).
|
||||||
|
- AMP pages will now use the rendered CSS, rather than emitted CSS
|
||||||
|
- `svelte-check` has been added to the TypeScript template ([sveltejs/kit#1556](https://github.com/sveltejs/kit/pull/1556))
|
||||||
|
- Support for https keypair [sveltejs/kit#1456](https://github.com/sveltejs/kit/pull/1456)
|
||||||
|
- Now bundling Vite with SvelteKit and using an upgraded version. Remove Vite from your `package.json` if it's there
|
||||||
|
- Etags for binary responses [sveltejs/kit#1382](https://github.com/sveltejs/kit/pull/1382)
|
||||||
|
- Renamed `$layout` to `__layout` and `$error` to `__error`
|
||||||
|
- Removed `getContext` in favor of `request.locals`
|
||||||
|
- Renamed `.svelte` output directory to `.svelte-kit`. Update your `.gitignore` accordingly
|
||||||
|
- `trailingSlash: 'never' | 'always' | 'ignore'` is now available in the config. This should make it easier to build sites that work with static hosting providers that expect a trailing slash for `index.html` pages, and provides an escape hatch for anyone that needs more complex behaviour.
|
||||||
|
|
||||||
|
## Notable bug fixes in SvelteKit
|
||||||
|
- `adapter-netlify` got a fix [sveltejs/kit#1467](https://github.com/sveltejs/kit/pull/1467) and new documentation in the readme https://github.com/sveltejs/kit/tree/master/packages/adapter-netlify
|
||||||
|
- The router will no longer intercept navigation for URLs that the app does not own. This fixes a crash for apps that have `<a>` elements on the page with the same origin but don't share a base path with the app.
|
||||||
|
- Hash only changes are now handled by the router fixing the browser's "back" navigation between hash changes in some circumstances.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## New in Svelte & Language Tools
|
||||||
|
- Svelte 3.38.1 and 3.38.2 fixed an issue with hydration that was causing duplicate elements. If you're seeing this in your project, be sure to update the latest version!
|
||||||
|
- A new TypeScript plugin provides deeper integration with Svelte files within JavaScript or TypeScript files. This includes diagnostics, references and renaming of variables. It comes packaged with the VS Code extension but is turned off by default for now. You can enable it through [this setting](https://github.com/sveltejs/language-tools/tree/master/packages/svelte-vscode#svelteenable-ts-plugin). We encourage you to test it out and [provide feedback](https://github.com/sveltejs/language-tools/issues/580)
|
||||||
|
- In the latest version of `svelte-check` you can now provide the path to your `tsconfig.json` or `jsconfig.json`. Example: `svelte-check --tsconfig "./tsconfig.json"`. This ensures the diagnostics are only run on files that are referenced in that config. It also runs diagnostics on JavaScript and/or TypeScript files which removes the need to run another check (like `tsc --noEmit`) for non-Svelte files (`svelte-check` version [**1.6.0**](https://github.com/sveltejs/language-tools/releases/tag/svelte-check-1.6.0))
|
||||||
|
- The VS Code extension and `svelte-check` got a new major release. Previously, properties that had no initializer (`export let foo;`) were only required if the user was using both TypeScript and activated `strict` mode. This is changed now: People using TypeScript, and those using `checkJs` also in JavaScript files, will now always have these properties marked as required (`svelte-check` version [**2.0.0**](https://github.com/sveltejs/language-tools/releases/tag/svelte-check-2.0.0), extension version [**105.0.0**](https://github.com/sveltejs/language-tools/releases/tag/extensions-105.0.0))
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Community Showcase
|
||||||
|
|
||||||
|
**Apps & Sites**
|
||||||
|
|
||||||
|
- [vidu](https://github.com/pa-nic/vidu) is a minimal web analytics collector and dashboard
|
||||||
|
- [River Runner](https://river-runner.samlearner.com/) is a virtual way to follow rivers downstream - built with Mapbox and Svelte.
|
||||||
|
- [JSDoc Type Generator](https://rafistrauss.github.io/jsdoc-generator/) generates JSDoc types for valid JSON.
|
||||||
|
- [pagereview.io](https://pagereview.io/) is a website feedback tool that lets you leave comments directly on the site being reviewed.
|
||||||
|
- [gamesroom.io](https://gamesroom.io/) is an online board game platform with video chat built-in.
|
||||||
|
- [Greedy Goblin](https://greedygoblin-fe11c.web.app/) is a recipe app for old-school Runescape players.
|
||||||
|
- [hashbrown.geopjr.dev](https://hashbrown.geopjr.dev/) is a GNOME-shell inspired webpage to learn about, explore the source code and download the Hashbrown GTK app ([link to source](https://github.com/GeopJr/Hashbrown/tree/website)).
|
||||||
|
|
||||||
|
|
||||||
|
**Libraries, Tools & Components**
|
||||||
|
|
||||||
|
- [svelte-image-crop](https://novacbn.github.io/svelte-image-crop/) is a simple click'n'drag image cropping library using Web APIs.
|
||||||
|
- [svelte-datepicker](https://github.com/andrew-secret/svelte-datepicker) is a lightweight and inclusive date picker build with Svelte.
|
||||||
|
- [svelte-regex-router](https://www.npmjs.com/package/svelte-regex-router) is a simple, lightweight library for you to easily handle routes in your Svelte application.
|
||||||
|
- [Svelte Micro](https://www.npmjs.com/package/svelte-micro) is a light & reactive one-component router for Svelte.
|
||||||
|
- [svelte-entity-store](https://www.npmjs.com/package/svelte-entity-store) is to provide a simple, generic solution for storing collections of entity objects.
|
||||||
|
- [svelte-animation-store](https://github.com/joshnuss/svelte-animation-store) is a store that is based on Svelte's tweened store, that lets you pause, continue, reset, replay, reverse or adjust speed of a tween.
|
||||||
|
|
||||||
|
|
||||||
|
**Want to contribute a component?** Submit a [Component](https://sveltesociety.dev/components) to the Svelte Society site by making [a PR to this file](https://github.com/svelte-society/sveltesociety.dev/blob/master/src/pages/components/components.json).
|
||||||
|
|
||||||
|
|
||||||
|
## See you next month!
|
||||||
|
|
||||||
|
Did we miss something? Join us on [Svelte Society](https://sveltesociety.dev/), [Reddit](https://www.reddit.com/r/sveltejs/) and [Discord](https://discord.com/invite/yy75DKs)!
|
||||||
@ -0,0 +1,65 @@
|
|||||||
|
---
|
||||||
|
title: What's new in Svelte: July 2021
|
||||||
|
description: Keeping cool with fixes, TypeScript tooling and tonnes of new features
|
||||||
|
author: Daniel Sandoval
|
||||||
|
authorURL: https://desandoval.net
|
||||||
|
---
|
||||||
|
|
||||||
|
As the northern hemisphere heats up, Svelte has stayed cool with lots of performance and bug fixes, better TypeScript support, and lots of new components & tools from around the ecosystem. Let's take a peek 👀
|
||||||
|
|
||||||
|
## New in SvelteKit
|
||||||
|
- `adapter-node` now precompresses assets using gzip & brotli ([#1693](https://github.com/sveltejs/kit/pull/1693))
|
||||||
|
- Support for TypeScript transpilation has been added to the `svelte-kit package` tooling ([#1633](https://github.com/sveltejs/kit/pull/1633))
|
||||||
|
- Improved caching defaults in `adapter-node` ([#1416](https://github.com/sveltejs/kit/pull/1416))
|
||||||
|
- Allow configuring Rollup output options ([#1572](https://github.com/sveltejs/kit/pull/1572))
|
||||||
|
- Fixed usage of SSL with HMR ([#1517](https://github.com/sveltejs/kit/pull/1517))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Features & bug fixes from around svelte/*
|
||||||
|
- [Svelte 3.38.3](https://github.com/sveltejs/svelte/blob/master/CHANGELOG.md#3383) (released June 22) includes a bunch of performance and bug fixes - including hydration optimizations, `this` preservation in bubbled events, and more!
|
||||||
|
- The latest language tools releases added support for prop renaming from outside of a component, PostCSS syntax grammar, and a `.d.ts` output target in `svelte2tsx` which can be used to create type definitions from Svelte files.
|
||||||
|
- Also in language tools, some long-awaited experimental features for enhanced TypeScript support were added - including explicitly typing all possible component events or slots, and using generics. Have a look at [the RFC](https://github.com/sveltejs/rfcs/pull/38) for more details and leave feedback in [this issue](https://github.com/sveltejs/language-tools/issues/442) if you are using it.
|
||||||
|
- `svelte-scroller` got some quality-of-life fixes in 2.0.7 - fixing an initial width bug and updating its `index` more conservatively
|
||||||
|
|
||||||
|
|
||||||
|
## Coming soon to Svelte
|
||||||
|
- Constants in markup ([RFC](https://github.com/sveltejs/rfcs/blob/master/text/0000-markup-constants.md)): Adds a new `{@const ...}` tag that defines a local constant ([PR](https://github.com/sveltejs/svelte/pull/6413))
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Community Showcase
|
||||||
|
|
||||||
|
**Apps & Sites**
|
||||||
|
- [SvelteThemes](https://sveltethemes.dev/) is a curated list of Svelte themes and templates built using svelte, sveltekit, elderjs, routify etc.
|
||||||
|
- [Beatbump](https://github.com/snuffyDev/Beatbump) is an alternative frontend for YouTube Music created using Svelte/SvelteKit.
|
||||||
|
- [Sveltuir](https://github.com/webspaceadam/sveltuir) is an app help you memorize the guitar fretboard
|
||||||
|
|
||||||
|
|
||||||
|
**Educational Content**
|
||||||
|
- [Svelte Radio: A Jolly Good Svelte Summer](https://share.transistor.fm/s/60880542) is a conversation about what's new in Svelte and a celebration of Svelte Radio's 1-year anniversary
|
||||||
|
- [Class properties in Svelte](https://navillus.dev/blog/svelte-class-props) is a refresher on the power of `class` for developers switching over to Svelte from React
|
||||||
|
- [Sveltekit Tutorial for Beginners](https://www.youtube.com/playlist?list=PLm_Qt4aKpfKjf77S8UD79Ockhwp_699Ms) is a video playlist for learning SvelteKit by WebJeda
|
||||||
|
- [How To Cache Dynamic Pages On Demand With A Service Worker In SvelteKit](https://jochemvogel.medium.com/how-to-cache-dynamic-pages-on-demand-with-a-service-worker-in-sveltekit-4b4a7652583d) walks through the power of service workers when used within SvelteKit for on-demand caching
|
||||||
|
- [Vue vs Svelte: Comparing Framework Internals](https://www.vuemastery.com/blog/vue-vs-svelte-comparing-framework-internals/) dives deep into the differences between Vue and Svelte from the inside out
|
||||||
|
- [Setting up a development environment for SvelteKit with Docker and Docker Compose](https://jenyus.web.app/blog/2021-05-30-setting-up-a-development-environment-for-sveltekit-with-docker-and-compose) walks through how to use Docker to create reusable development environments, no matter what kind of device you run your code on
|
||||||
|
- Scalable Scripts released three videos this month documenting how to deploy dockerized Svelte Apps to [AWS](https://youtu.be/VOs2Od5jYOc), [Azure](https://youtu.be/gdg4ne_uDm8) and [Google Cloud](https://youtu.be/_-uBb61Tikw)
|
||||||
|
- [Render Katex with Svelte from zero to hero](https://www.youtube.com/watch?v=euowJs9CblA) demonstrates how to implement Katex in a Svelte project
|
||||||
|
- [Using Custom Elements in Svelte](https://css-tricks.com/using-custom-elements-in-svelte/) shows some of the quirks to look out for when using custom elements in a Svelte site
|
||||||
|
|
||||||
|
|
||||||
|
**Libraries, Tools & Components**
|
||||||
|
- [svelte-pipeline](https://github.com/novacbn/svelte-pipeline) provides custom Javascript contexts and the Svelte Compiler as Svelte Stores, for REPLs, Editors, etc.
|
||||||
|
- [Sveltotron](https://github.com/Salemmous/sveltotron) is an Electron-based app made to inspect your Svelte app
|
||||||
|
- [svelte-qr-reader-writer](https://github.com/pleasemarkdarkly/svelte-qr-reader-writer) is a Svelte component that helps read and write data from QR codes
|
||||||
|
- [svelte-stack-router](https://www.npmjs.com/package/svelte-stack-router) Aims to make Svelte apps feel more native by routing with Stacks
|
||||||
|
- [svelte-typed-context](https://www.npmjs.com/package/svelte-typed-context) provides an interface which, when provided to `getContext` or `setContext`, allows for stricter types
|
||||||
|
- [svelte-modals](https://svelte-modals.mattjennings.io/) is a simple, flexible, zero-dependency modal manager for Svelte
|
||||||
|
|
||||||
|
|
||||||
|
**Want to contribute a component? Interested in helping make Svelte's presence on the web better?** Submit a Component to the Svelte Society site by making [a PR to this file](https://github.com/svelte-society/sveltesociety-2021/blob/main/src/routes/components/components.json) or check out [the list of open issues](https://github.com/svelte-society/sveltesociety-2021/issues) if you'd like to contribute to the Svelte Society rewrite in SvelteKit.
|
||||||
|
|
||||||
|
|
||||||
|
## See you next month!
|
||||||
|
|
||||||
|
Want more updates? Join us on [Reddit](https://www.reddit.com/r/sveltejs/) or [Discord](https://discord.com/invite/yy75DKs)!
|
||||||
@ -0,0 +1,258 @@
|
|||||||
|
---
|
||||||
|
title: Accessibility warnings
|
||||||
|
---
|
||||||
|
|
||||||
|
Accessibility (shortened to a11y) isn't always easy to get right, but Svelte will help by warning you at compile time if you write inaccessible markup. However, keep in mind that many accessibility issues can only be identified at runtime using other automated tools and by manually testing your application.
|
||||||
|
|
||||||
|
Here is a list of accessibility checks Svelte will do for you.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `a11y-accesskey`
|
||||||
|
|
||||||
|
Enforce no `accesskey` on element. Access keys are HTML attributes that allow web developers to assign keyboard shortcuts to elements. Inconsistencies between keyboard shortcuts and keyboard commands used by screen reader and keyboard-only users create accessibility complications. To avoid complications, access keys should not be used.
|
||||||
|
|
||||||
|
```sv
|
||||||
|
<!-- A11y: Avoid using accesskey -->
|
||||||
|
<div accessKey='z'></div>
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `a11y-aria-attributes`
|
||||||
|
|
||||||
|
Certain reserved DOM elements do not support ARIA roles, states and properties. This is often because they are not visible, for example `meta`, `html`, `script`, `style`. This rule enforces that these DOM elements do not contain the `aria-*` props.
|
||||||
|
|
||||||
|
```sv
|
||||||
|
<!-- A11y: <meta> should not have aria-* attributes -->
|
||||||
|
<meta aria-hidden="false">
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `a11y-autofocus`
|
||||||
|
|
||||||
|
Enforce that `autofocus` is not used on elements. Autofocusing elements can cause usability issues for sighted and non-sighted users alike.
|
||||||
|
|
||||||
|
```sv
|
||||||
|
<!-- A11y: Avoid using autofocus -->
|
||||||
|
<input autofocus>
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `a11y-distracting-elements`
|
||||||
|
|
||||||
|
Enforces that no distracting elements are used. Elements that can be visually distracting can cause accessibility issues with visually impaired users. Such elements are most likely deprecated, and should be avoided.
|
||||||
|
|
||||||
|
The following elements are visually distracting: `<marquee>` and `<blink>`.
|
||||||
|
|
||||||
|
```sv
|
||||||
|
<!-- A11y: Avoid <marquee> elements -->
|
||||||
|
<marquee />
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `a11y-hidden`
|
||||||
|
|
||||||
|
Certain DOM elements are useful for screen reader navigation and should not be hidden.
|
||||||
|
|
||||||
|
```sv
|
||||||
|
<!-- A11y: <h2> element should not be hidden -->
|
||||||
|
<h2 aria-hidden="true">invisible header</h2>
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `a11y-img-redundant-alt`
|
||||||
|
|
||||||
|
Enforce img alt attribute does not contain the word image, picture, or photo. Screen readers already announce `img` elements as an image. There is no need to use words such as _image_, _photo_, and/or _picture_.
|
||||||
|
|
||||||
|
```sv
|
||||||
|
<img src="foo" alt="Foo eating a sandwich." />
|
||||||
|
|
||||||
|
<!-- aria-hidden, won't be announced by screen reader -->
|
||||||
|
<img src="bar" aria-hidden="true" alt="Picture of me taking a photo of an image" />
|
||||||
|
|
||||||
|
<!-- A11y: Screen readers already announce <img> elements as an image. -->
|
||||||
|
<img src="foo" alt="Photo of foo being weird." />
|
||||||
|
|
||||||
|
<!-- A11y: Screen readers already announce <img> elements as an image. -->
|
||||||
|
<img src="bar" alt="Image of me at a bar!" />
|
||||||
|
|
||||||
|
<!-- A11y: Screen readers already announce <img> elements as an image. -->
|
||||||
|
<img src="foo" alt="Picture of baz fixing a bug." />
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `a11y-invalid-attribute`
|
||||||
|
|
||||||
|
Enforce that attributes important for accessibility have a valid value. For example, `href` should not be empty, `'#'`, or `javascript:`.
|
||||||
|
|
||||||
|
```sv
|
||||||
|
<!-- A11y: '' is not a valid href attribute -->
|
||||||
|
<a href=''>invalid</a>
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `a11y-label-has-associated-control`
|
||||||
|
|
||||||
|
Enforce that a label tag has a text label and an associated control.
|
||||||
|
|
||||||
|
There are two supported ways to associate a label with a control:
|
||||||
|
|
||||||
|
- Wrapping a control in a label tag.
|
||||||
|
- Adding `for` to a label and assigning it the ID of an input on the page.
|
||||||
|
|
||||||
|
```sv
|
||||||
|
<label for="id">B</label>
|
||||||
|
|
||||||
|
<label>C <input type="text" /></label>
|
||||||
|
|
||||||
|
<!-- A11y: A form label must be associated with a control. -->
|
||||||
|
<label>A</label>
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `a11y-media-has-caption`
|
||||||
|
|
||||||
|
Providing captions for media is essential for deaf users to follow along. Captions should be a transcription or translation of the dialogue, sound effects, relevant musical cues, and other relevant audio information. Not only is this important for accessibility, but can also be useful for all users in the case that the media is unavailable (similar to `alt` text on an image when an image is unable to load).
|
||||||
|
|
||||||
|
The captions should contain all important and relevant information to understand the corresponding media. This may mean that the captions are not a 1:1 mapping of the dialogue in the media content. However, captions are not necessary for video components with the `muted` attribute.
|
||||||
|
|
||||||
|
```sv
|
||||||
|
<video><track kind="captions"/></video>
|
||||||
|
|
||||||
|
<audio muted></audio>
|
||||||
|
|
||||||
|
<!-- A11y: Media elements must have a <track kind=\"captions\"> -->
|
||||||
|
<video></video>
|
||||||
|
|
||||||
|
<!-- A11y: Media elements must have a <track kind=\"captions\"> -->
|
||||||
|
<video><track /></video>
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `a11y-misplaced-role`
|
||||||
|
|
||||||
|
Certain reserved DOM elements do not support ARIA roles, states and properties. This is often because they are not visible, for example `meta`, `html`, `script`, `style`. This rule enforces that these DOM elements do not contain the `role` props.
|
||||||
|
|
||||||
|
```sv
|
||||||
|
<!-- A11y: <meta> should not have role attribute -->
|
||||||
|
<meta role="tooltip">
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `a11y-misplaced-scope`
|
||||||
|
|
||||||
|
The scope attribute should only be used on `<th>` elements.
|
||||||
|
|
||||||
|
```sv
|
||||||
|
<!-- A11y: The scope attribute should only be used with <th> elements -->
|
||||||
|
<div scope="row" />
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `a11y-missing-attribute`
|
||||||
|
|
||||||
|
Enforce that attributes required for accessibility are present on an element. This includes the following checks:
|
||||||
|
|
||||||
|
- `<a>` should have an href (unless it's a [fragment-defining tag](https://github.com/sveltejs/svelte/issues/4697))
|
||||||
|
- `<area>` should have alt, aria-label, or aria-labelledby
|
||||||
|
- `<html>` should have lang
|
||||||
|
- `<iframe>` should have title
|
||||||
|
- `<img>` should have alt
|
||||||
|
- `<object>` should have title, aria-label, or aria-labelledby
|
||||||
|
- `<input type="image">` should have alt, aria-label, or aria-labelledby
|
||||||
|
|
||||||
|
```sv
|
||||||
|
<!-- A11y: <input type=\"image\"> element should have an alt, aria-label or aria-labelledby attribute -->
|
||||||
|
<input type="image">
|
||||||
|
|
||||||
|
<!-- A11y: <html> element should have a lang attribute -->
|
||||||
|
<html></html>
|
||||||
|
|
||||||
|
<!-- A11y: <a> element should have an href attribute -->
|
||||||
|
<a>text</a>
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `a11y-missing-content`
|
||||||
|
|
||||||
|
Enforce that heading elements (`h1`, `h2`, etc.) and anchors have content and that the content is accessible to screen readers
|
||||||
|
|
||||||
|
```sv
|
||||||
|
<!-- A11y: <a> element should have child content -->
|
||||||
|
<a href='/foo'></a>
|
||||||
|
|
||||||
|
<!-- A11y: <h1> element should have child content -->
|
||||||
|
<h1></h1>
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `a11y-mouse-events-have-key-events`
|
||||||
|
|
||||||
|
Enforce that `on:mouseover` and `on:mouseout` are accompanied by `on:focus` and `on:blur`, respectively. This helps to ensure that any functionality triggered by these mouse events is also accessible to keyboard users.
|
||||||
|
|
||||||
|
```sv
|
||||||
|
<!-- A11y: on:mouseover must be accompanied by on:focus -->
|
||||||
|
<div on:mouseover={handleMouseover} />
|
||||||
|
|
||||||
|
<!-- A11y: on:mouseout must be accompanied by on:blur -->
|
||||||
|
<div on:mouseout={handleMouseout} />
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `a11y-positive-tabindex`
|
||||||
|
|
||||||
|
Avoid positive `tabindex` property values. This will move elements out of the expected tab order, creating a confusing experience for keyboard users.
|
||||||
|
|
||||||
|
```sv
|
||||||
|
<!-- A11y: avoid tabindex values above zero -->
|
||||||
|
<div tabindex='1'/>
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `a11y-structure`
|
||||||
|
|
||||||
|
Enforce that certain DOM elements have the correct structure.
|
||||||
|
|
||||||
|
```sv
|
||||||
|
<!-- A11y: <figcaption> must be an immediate child of <figure> -->
|
||||||
|
<div>
|
||||||
|
<figcaption>Image caption</figcaption>
|
||||||
|
</div>
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `a11y-unknown-aria-attribute`
|
||||||
|
|
||||||
|
Enforce that only known ARIA attributes are used. This is based on the [WAI-ARIA States and Properties spec](https://www.w3.org/WAI/PF/aria-1.1/states_and_properties).
|
||||||
|
|
||||||
|
```sv
|
||||||
|
<!-- A11y: Unknown aria attribute 'aria-labeledby' (did you mean 'labelledby'?) -->
|
||||||
|
<input type="image" aria-labeledby="foo">
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `a11y-unknown-role`
|
||||||
|
|
||||||
|
Elements with ARIA roles must use a valid, non-abstract ARIA role. A reference to role definitions can be found at [WAI-ARIA](https://www.w3.org/TR/wai-aria/#role_definitions) site.
|
||||||
|
|
||||||
|
```sv
|
||||||
|
<!-- A11y: Unknown role 'toooltip' (did you mean 'tooltip'?) -->
|
||||||
|
<div role="toooltip"></div>
|
||||||
|
```
|
||||||
@ -1,11 +1,11 @@
|
|||||||
<script>
|
<script>
|
||||||
let count = 0;
|
let count = 0;
|
||||||
|
|
||||||
function handleClick() {
|
function incrementCount() {
|
||||||
count += 1;
|
count += 1;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button on:click={handleClick}>
|
<button on:click={incrementCount}>
|
||||||
Clicked {count} {count === 1 ? 'time' : 'times'}
|
Clicked {count} {count === 1 ? 'time' : 'times'}
|
||||||
</button>
|
</button>
|
||||||
@ -1,24 +1,32 @@
|
|||||||
<script>
|
<script>
|
||||||
// `current` is updated whenever the prop value changes...
|
const emojis = {
|
||||||
export let current;
|
apple: "🍎",
|
||||||
|
banana: "🍌",
|
||||||
|
carrot: "🥕",
|
||||||
|
doughnut: "🍩",
|
||||||
|
egg: "🥚"
|
||||||
|
}
|
||||||
|
|
||||||
|
// the name is updated whenever the prop value changes...
|
||||||
|
export let name;
|
||||||
|
|
||||||
// ...but `initial` is fixed upon initialisation
|
// ...but the "emoji" variable is fixed upon initialisation of the component
|
||||||
const initial = current;
|
const emoji = emojis[name];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<span style="background-color: {initial}">initial</span>
|
<span>The emoji for { name } is { emoji }</span>
|
||||||
<span style="background-color: {current}">current</span>
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
p {
|
||||||
|
margin: 0.8em 0;
|
||||||
|
}
|
||||||
span {
|
span {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 0.2em 0.5em;
|
padding: 0.2em 1em 0.3em;
|
||||||
margin: 0 0.2em 0.2em 0;
|
|
||||||
width: 4em;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border-radius: 0.2em;
|
border-radius: 0.2em;
|
||||||
color: white;
|
background-color: #FFDFD3;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -1,24 +1,32 @@
|
|||||||
<script>
|
<script>
|
||||||
// `current` is updated whenever the prop value changes...
|
const emojis = {
|
||||||
export let current;
|
apple: "🍎",
|
||||||
|
banana: "🍌",
|
||||||
|
carrot: "🥕",
|
||||||
|
doughnut: "🍩",
|
||||||
|
egg: "🥚"
|
||||||
|
}
|
||||||
|
|
||||||
|
// the name is updated whenever the prop value changes...
|
||||||
|
export let name;
|
||||||
|
|
||||||
// ...but `initial` is fixed upon initialisation
|
// ...but the "emoji" variable is fixed upon initialisation of the component
|
||||||
const initial = current;
|
const emoji = emojis[name];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<span style="background-color: {initial}">initial</span>
|
<span>The emoji for { name } is { emoji }</span>
|
||||||
<span style="background-color: {current}">current</span>
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
p {
|
||||||
|
margin: 0.8em 0;
|
||||||
|
}
|
||||||
span {
|
span {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 0.2em 0.5em;
|
padding: 0.2em 1em 0.3em;
|
||||||
margin: 0 0.2em 0.2em 0;
|
|
||||||
width: 4em;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border-radius: 0.2em;
|
border-radius: 0.2em;
|
||||||
color: white;
|
background-color: #FFDFD3;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
<script>
|
||||||
|
import InputField from './InputField.svelte';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<InputField />
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
<script>
|
||||||
|
let input;
|
||||||
|
|
||||||
|
export function focus() {
|
||||||
|
input.focus();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<input bind:this={input} />
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
<script>
|
||||||
|
import InputField from './InputField.svelte';
|
||||||
|
|
||||||
|
let field;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<InputField bind:this={field}/>
|
||||||
|
|
||||||
|
<button on:click={() => field.focus()}>Focus field</button>
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
<script>
|
||||||
|
let input;
|
||||||
|
|
||||||
|
export function focus() {
|
||||||
|
input.focus();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<input bind:this={input} />
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
title: Binding to component instances
|
||||||
|
---
|
||||||
|
|
||||||
|
Just as you can bind to DOM elements, you can bind to component instances themselves. For example, we can bind the instance of `<InputField>` to a prop named `field` in the same way we did when binding DOM Elements
|
||||||
|
|
||||||
|
```html
|
||||||
|
<InputField bind:this={field} />
|
||||||
|
```
|
||||||
|
|
||||||
|
Now we can programmatically interact with this component using `field`.
|
||||||
|
|
||||||
|
```html
|
||||||
|
<button on:click="{() => field.focus()}">
|
||||||
|
Focus field
|
||||||
|
</button>
|
||||||
|
```
|
||||||
|
|
||||||
|
> Note that we can't do `{field.focus}` since field is undefined when the button is first rendered and throws an error.
|
||||||
@ -1,10 +1,20 @@
|
|||||||
<script>
|
<script>
|
||||||
import { onDestroy } from 'svelte';
|
import Timer from './Timer.svelte';
|
||||||
|
|
||||||
|
let open = false;
|
||||||
let seconds = 0;
|
let seconds = 0;
|
||||||
|
|
||||||
|
const toggle = () => (open = !open);
|
||||||
|
const handleTick = () => (seconds += 1);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<p>
|
<div>
|
||||||
The page has been open for
|
<button on:click={toggle}>{open ? 'Close' : 'Open'} Timer</button>
|
||||||
|
<p>
|
||||||
|
The Timer component has been open for
|
||||||
{seconds} {seconds === 1 ? 'second' : 'seconds'}
|
{seconds} {seconds === 1 ? 'second' : 'seconds'}
|
||||||
</p>
|
</p>
|
||||||
|
{#if open}
|
||||||
|
<Timer callback={handleTick} />
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|||||||
@ -0,0 +1,20 @@
|
|||||||
|
<script>
|
||||||
|
import { onInterval } from './utils.js';
|
||||||
|
|
||||||
|
export let callback;
|
||||||
|
export let interval = 1000;
|
||||||
|
|
||||||
|
onInterval(callback, interval);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
This component executes a callback every
|
||||||
|
{interval} millisecond{interval === 1 ? '' : 's'}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
p {
|
||||||
|
border: 1px solid blue;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -1,5 +1,9 @@
|
|||||||
import { onDestroy } from 'svelte';
|
import { onDestroy } from 'svelte';
|
||||||
|
|
||||||
export function onInterval(callback, milliseconds) {
|
export function onInterval(callback, milliseconds) {
|
||||||
// implementation goes here
|
const interval = setInterval(callback, milliseconds);
|
||||||
|
|
||||||
|
onDestroy(() => {
|
||||||
|
// Fix the memory leak here
|
||||||
|
});
|
||||||
}
|
}
|
||||||
@ -1,11 +1,20 @@
|
|||||||
<script>
|
<script>
|
||||||
import { onInterval } from './utils.js';
|
import Timer from './Timer.svelte';
|
||||||
|
|
||||||
|
let open = true;
|
||||||
let seconds = 0;
|
let seconds = 0;
|
||||||
onInterval(() => seconds += 1, 1000);
|
|
||||||
|
const toggle = () => (open = !open);
|
||||||
|
const handleTick = () => (seconds += 1);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<p>
|
<div>
|
||||||
The page has been open for
|
<button on:click={toggle}>{open ? 'Close' : 'Open'} Timer</button>
|
||||||
|
<p>
|
||||||
|
The Timer component has been open for
|
||||||
{seconds} {seconds === 1 ? 'second' : 'seconds'}
|
{seconds} {seconds === 1 ? 'second' : 'seconds'}
|
||||||
</p>
|
</p>
|
||||||
|
{#if open}
|
||||||
|
<Timer callback={handleTick} />
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|||||||
@ -0,0 +1,20 @@
|
|||||||
|
<script>
|
||||||
|
import { onInterval } from './utils.js';
|
||||||
|
|
||||||
|
export let callback;
|
||||||
|
export let interval = 1000;
|
||||||
|
|
||||||
|
onInterval(callback, interval);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
This component executes a callback every
|
||||||
|
{interval} millisecond{interval === 1 ? '' : 's'}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
p {
|
||||||
|
border: 1px solid blue;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
<script>
|
||||||
|
import { fly } from 'svelte/transition';
|
||||||
|
|
||||||
|
let number = 0;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
The number is:
|
||||||
|
<span style="display: inline-block" in:fly={{ y: -20 }}>
|
||||||
|
{number}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<button
|
||||||
|
on:click={() => {
|
||||||
|
number += 1;
|
||||||
|
}}>
|
||||||
|
Increment
|
||||||
|
</button>
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
<script>
|
||||||
|
import { fly } from 'svelte/transition';
|
||||||
|
|
||||||
|
let number = 0;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
The number is:
|
||||||
|
{#key number}
|
||||||
|
<span style="display: inline-block" in:fly={{ y: -20 }}>
|
||||||
|
{number}
|
||||||
|
</span>
|
||||||
|
{/key}
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<button
|
||||||
|
on:click={() => {
|
||||||
|
number += 1;
|
||||||
|
}}>
|
||||||
|
Increment
|
||||||
|
</button>
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
title: Key blocks
|
||||||
|
---
|
||||||
|
|
||||||
|
Key blocks destroy and recreate their contents when the value of an expression changes.
|
||||||
|
|
||||||
|
```html
|
||||||
|
{#key value}
|
||||||
|
<div transition:fade>{value}</div>
|
||||||
|
{/key}
|
||||||
|
```
|
||||||
|
|
||||||
|
This is useful if you want an element to play its transition whenever a value changes instead of only when the element enters or leaves the DOM.
|
||||||
|
|
||||||
|
Wrap the `<span>` element in a key block depending on `number`. This will make the
|
||||||
|
animation play whenever you press the increment button.
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
const sh = require('shelljs');
|
||||||
|
|
||||||
|
sh.env['FORCE_UPDATE'] = process.argv.includes('--force=true');
|
||||||
|
|
||||||
|
Promise.all([
|
||||||
|
sh.exec('node ./scripts/get_contributors.js'),
|
||||||
|
sh.exec('node ./scripts/update_template.js')
|
||||||
|
]);
|
||||||
@ -1,13 +0,0 @@
|
|||||||
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.cp('scripts/community/whos-using-svelte/WhosUsingSvelte.js', 'src/routes/_components/WhosUsingSvelte.js');
|
|
||||||
sh.rm('-rf', 'static/organisations');
|
|
||||||
sh.cp('-r', 'scripts/community/whos-using-svelte/organisations', 'static');
|
|
||||||
@ -0,0 +1,80 @@
|
|||||||
|
export const companies = [
|
||||||
|
{
|
||||||
|
href: "https://1password.com",
|
||||||
|
filename: "1password.svg",
|
||||||
|
alt: "1Password logo",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: "https://www.alaskaair.com/",
|
||||||
|
style: "background-color: #01426a;",
|
||||||
|
filename: "alaskaairlines.svg",
|
||||||
|
alt: "Alaska Airlines logo",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: "https://avast.com",
|
||||||
|
filename: "avast.svg",
|
||||||
|
alt: "Avast logo",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: "https://chess.com",
|
||||||
|
style: "background-color: #312e2b;",
|
||||||
|
filename: "chess.svg",
|
||||||
|
alt: "Chess.com logo",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: "https://fusioncharts.com",
|
||||||
|
filename: "fusioncharts.svg",
|
||||||
|
alt: "FusionCharts logo",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: "https://godaddy.com",
|
||||||
|
filename: "godaddy.svg",
|
||||||
|
alt: "GoDaddy logo",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: "https://www.ibm.com/",
|
||||||
|
filename: "ibm.svg",
|
||||||
|
alt: "IBM logo",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: "https://media.lesechos.fr/infographie",
|
||||||
|
filename: "les-echos.svg",
|
||||||
|
alt: "Les Echos",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: "https://www.philips.co.uk",
|
||||||
|
filename: "philips.svg",
|
||||||
|
alt: "Philips logo",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: "https://global.rakuten.com/corp/",
|
||||||
|
filename: "rakuten.svg",
|
||||||
|
alt: "Rakuten logo",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: "https://razorpay.com",
|
||||||
|
filename: "razorpay.svg",
|
||||||
|
alt: "Razorpay logo",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: "https://www.se.com",
|
||||||
|
style: " background-color: #3dcd58; ",
|
||||||
|
filename: "Schneider_Electric.svg",
|
||||||
|
alt: "Schneider Electric",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: "https://squareup.com",
|
||||||
|
filename: "square.svg",
|
||||||
|
alt: "Square",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: "https://nytimes.com",
|
||||||
|
filename: "nyt.svg",
|
||||||
|
alt: "The New York Times logo",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: "https://transloadit.com",
|
||||||
|
filename: "transloadit.svg",
|
||||||
|
alt: "Transloadit",
|
||||||
|
},
|
||||||
|
];
|
||||||
@ -0,0 +1,60 @@
|
|||||||
|
<script>
|
||||||
|
import { companies } from './WhosUsingSvelte.js';
|
||||||
|
const randomizer = ({prominent}) => Math.random();
|
||||||
|
const doSort = (a, b) => randomizer(b) - randomizer(a);
|
||||||
|
const sortedCompanies = companies.sort(doSort);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<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);
|
||||||
|
}
|
||||||
|
picture,
|
||||||
|
img {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
@media (min-width: 540px) {
|
||||||
|
a {
|
||||||
|
height: 60px;
|
||||||
|
padding: 10px 20px;
|
||||||
|
border-radius: 30px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="logos">
|
||||||
|
{#each sortedCompanies as {href, filename, alt, style, picture, span}, index}
|
||||||
|
<a
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener"
|
||||||
|
{href}
|
||||||
|
style="{style || ''}"
|
||||||
|
>
|
||||||
|
{#if picture}
|
||||||
|
<picture>
|
||||||
|
{#each picture as {type, srcset}}
|
||||||
|
<source {type} {srcset}>
|
||||||
|
{/each}
|
||||||
|
<img src="/whos-using-svelte/{filename}" {alt} loading="lazy">
|
||||||
|
</picture>
|
||||||
|
{:else}
|
||||||
|
<img src="/whos-using-svelte/{filename}" {alt} loading="lazy">
|
||||||
|
{#if span}
|
||||||
|
<span>{span}</span>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
</a>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue