diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml
index 9acc6de3f..cb004fcf5 100644
--- a/.github/workflows/node.js.yml
+++ b/.github/workflows/node.js.yml
@@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
- node-version: [18.x]
+ node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
diff --git a/LICENSE.md b/LICENSE.md
new file mode 100644
index 000000000..0598ad131
--- /dev/null
+++ b/LICENSE.md
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) 2023 [these people](https://github.com/sveltejs/learn.svelte.dev/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:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/README.md b/README.md
index d99fc947c..8866c4475 100644
--- a/README.md
+++ b/README.md
@@ -6,21 +6,21 @@ A soup-to-nuts interactive tutorial on how to build apps with Svelte.
This repo uses [pnpm](https://pnpm.io/).
-## Running the app
+## Developing the app
-First, run `node scripts/create-common-bundle`. This packages up everything that's needed to run a SvelteKit app (Vite, Esbuild, SvelteKit, Svelte compiler etc) which can subsequently be unpacked on a server to create and run and instance of a SvelteKit application (which powers the output window of the tutorial).
+First, run `node scripts/create-common-bundle`. This packages up everything that's needed to run a SvelteKit app (Vite, esbuild, SvelteKit, Svelte compiler, etc.) which can subsequently be unpacked on a server to create and run an instance of a SvelteKit application (which powers the output window of the tutorial). Then, run `dev`:
-The next steps depend on whether you want to run this locally in filesystem mode, or in WebContainer mode. For now, it works with filesystem mode only locally. In future, it will run both locally and on the web (using [WebContainers](https://blog.stackblitz.com/posts/introducing-webcontainers/)).
+```bash
+node scripts/create-common-bundle
+pnpm dev
+```
-### Local/filesystem mode
+To build for production and run locally:
-1. add an `.env` file with `PUBLIC_USE_FILESYSTEM=true` in it
-2. Run the app locally with `pnpm dev` or `pnpm build && pnpm preview`.
-
-### WebContainer mode
-
-1. if an `.env` file exists, modify it so there's `PUBLIC_USE_FILESYSTEM=` in it
-2. Run the app locally with `pnpm dev` or `pnpm build && pnpm preview`.
+```bash
+pnpm build
+pnpm preview
+```
## Creating new tutorials
@@ -28,4 +28,4 @@ Tutorials live inside `content`. Each tutorial consists of a `README.md`, which
## Bumping tutorial dependencies
-Bump the dependency (for example Svelte) in both the root and the `content/common` `package.json`. In the root do `pnpm i` (to update `pnpm-lock.yaml`), in `content/common` do `npm i` (to update `package-lock.json`). After deployment things might be out of date because Vercel caches things, redeploy without cache in that case.
+Bump the dependency (for example Svelte) in both the root and the `content/common` `package.json`. In the root do `pnpm i` (to update `pnpm-lock.yaml`), in `content/common` do `npm i` (to update `package-lock.json`).
\ No newline at end of file
diff --git a/backend/+server.js b/backend/+server.js
deleted file mode 100644
index 951581de2..000000000
--- a/backend/+server.js
+++ /dev/null
@@ -1,14 +0,0 @@
-import { json } from '@sveltejs/kit';
-import { create } from './apps';
-
-/** @type {import('./$types').RequestHandler} */
-export async function POST({ request }) {
- return json(
- await create({
- files: await request.json()
- }),
- {
- status: 201 // should this be a 200?
- }
- );
-}
diff --git a/backend/README.md b/backend/README.md
deleted file mode 100644
index 39de3f70c..000000000
--- a/backend/README.md
+++ /dev/null
@@ -1 +0,0 @@
-This used to live in src/routes/backend, but it makes it impossible to use with edge functions. Keeping it here in case we need it in future.
diff --git a/backend/[id]/+server.js b/backend/[id]/+server.js
deleted file mode 100644
index 918ddfefd..000000000
--- a/backend/[id]/+server.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import { clear, update } from '../apps';
-
-/** @type {import('./$types').RequestHandler} */
-export async function PUT({ url, request, params }) {
- const { id } = params;
- const files = await request.json();
-
- if (url.searchParams.has('reset')) {
- clear({ id, files });
- }
-
- update({ id, files });
-
- return new Response(undefined, {
- status: 201
- });
-}
diff --git a/backend/apps.js b/backend/apps.js
deleted file mode 100644
index 80b0669d8..000000000
--- a/backend/apps.js
+++ /dev/null
@@ -1,208 +0,0 @@
-import fs from 'node:fs';
-import path from 'node:path';
-import { spawn } from 'node:child_process';
-import { createRequire } from 'node:module';
-import * as ports from 'port-authority';
-import { broadcast, ready } from './ws';
-
-/**
- * @typedef {{
- * process: import('child_process').ChildProcess,
- * filenames: string[]
- * }} App */
-
-fs.rmSync('.apps', { recursive: true, force: true });
-fs.mkdirSync('.apps', { recursive: true });
-
-// poor man's HMR, pending https://github.com/vitejs/vite/issues/7887
-// @ts-expect-error
-if (globalThis.__apps) {
- globalThis.__apps.forEach((app) => {
- app.process.kill();
- });
-}
-
-const require = createRequire(import.meta.url);
-const vite_pkg_file = require.resolve('vite/package.json');
-const vite_pkg = JSON.parse(fs.readFileSync(vite_pkg_file, 'utf-8'));
-const vite = path.resolve(vite_pkg_file, '..', vite_pkg.bin['vite']);
-
-/** @type {Map} */
-const apps = new Map();
-globalThis.__apps = apps;
-
-const hooks_src = `/** @type {import('@sveltejs/kit').Handle} */
-export async function handle({ event, resolve }) {
- const response = await resolve(event);
-
- response.headers.set('cross-origin-opener-policy', 'same-origin');
- response.headers.set('cross-origin-embedder-policy', 'require-corp');
- response.headers.set('cross-origin-resource-policy', 'cross-origin');
-
- return response;
-}`;
-
-/**
- * @param {{
- * files: import('$lib/types').FileStub[]
- * }} options
- */
-export async function create({ files }) {
- const id = String(Date.now());
- const filenames = write_files(id, files);
-
- // TODO this enables embedding on cross-origin sites, which is
- // necessary for the JSNation talk, but will currently break if an app
- // already has a src/hooks.server.js file (though it could be worked
- // around easily enough if necessary)
- if (!files.find((stub) => stub.name === '/src/hooks.server.js')) {
- fs.writeFileSync(`.apps/${id}/src/hooks.server.js`, hooks_src);
- }
-
- const port = await ports.find(3001);
-
- apps.set(id, {
- process: launch(id, String(port)),
- filenames
- });
-
- await ports.waitUntilBusy(port);
-
- await ready;
-
- return {
- id,
- port
- };
-}
-
-/**
- * @param {{
- * id: string;
- * files: import('$lib/types').FileStub[]
- * }} options
- */
-export function clear({ id, files }) {
- const app = apps.get(id);
-
- if (!app) {
- throw new Error(`app ${id} does not exist`);
- }
-
- const dir = `.apps/${id}`;
- const old_filenames = new Set(app.filenames);
-
- /** @type {string[]} */
- const filenames = [];
-
- for (const file of files) {
- if (file.type === 'file') {
- filenames.push(file.name);
- old_filenames.delete(file.name);
- }
- }
-
- for (const file of old_filenames) {
- if (fs.existsSync(dir + file)) {
- fs.unlinkSync(dir + file);
- }
- }
-
- app.filenames = filenames;
-}
-
-/**
- * @param {{
- * id: string;
- * files: import('$lib/types').FileStub[]
- * }} options
- */
-export function update({ id, files }) {
- if (!apps.has(id)) {
- throw new Error(`app ${id} does not exist`);
- }
-
- write_files(id, files);
-}
-
-/**
- * @param {{ id: string }} options
- */
-export function destroy({ id }) {
- const dir = `.apps/${id}`;
-
- fs.rmSync(dir, { recursive: true, force: true });
-
- apps.get(id)?.process.kill();
- apps.delete(id);
-}
-
-/**
- * @param {string} id
- * @param {string} port
- */
-function launch(id, port) {
- const cwd = `.apps/${id}`;
-
- const process = spawn('node', [vite, 'dev', '--port', port], {
- cwd
- });
-
- process.stdout.on('data', (data) => {
- broadcast({ id, data: data.toString(), type: 'stdout' });
- });
-
- process.stderr.on('data', (data) => {
- broadcast({ id, data: data.toString(), type: 'stderr' });
- });
-
- return process;
-}
-
-/**
- *
- * @param {string} file
- * @param {string | Buffer} contents
- */
-function write_if_changed(file, contents) {
- if (typeof contents === 'string' && fs.existsSync(file)) {
- const existing = fs.readFileSync(file, 'utf-8');
- if (contents === existing) return;
- }
-
- fs.mkdirSync(path.dirname(file), { recursive: true });
- fs.writeFileSync(file, contents);
-}
-
-/**
- *
- * @param {string} id
- * @param {import('$lib/types').FileStub[]} files
- */
-function write_files(id, files) {
- const dir = `.apps/${id}`;
-
- /** @type {string[]} */
- const filenames = [];
-
- for (const file of files) {
- if (file.type === 'file') {
- filenames.push(file.name);
-
- const dest = `${dir}/${file.name}`;
- let content = file.text ? file.contents : Buffer.from(file.contents, 'base64');
-
- if (file.name === '/src/app.html' && typeof content === 'string') {
- // TODO handle case where config.kit.files.template is different
- content = content.replace(
- '',
- ''
- );
- }
-
- write_if_changed(dest, content);
- }
- }
-
- return filenames;
-}
diff --git a/backend/destroy/+server.js b/backend/destroy/+server.js
deleted file mode 100644
index ad9c89efd..000000000
--- a/backend/destroy/+server.js
+++ /dev/null
@@ -1,14 +0,0 @@
-import { destroy } from '../apps';
-
-// this is implemented as a POST handler because it is
-// triggered by `navigator.sendBeacon` rather than `fetch`
-
-/** @type {import('./$types').RequestHandler} */
-export function POST({ url }) {
- const id = /** @type {string} */ (url.searchParams.get('id'));
- destroy({ id });
-
- return new Response(undefined, {
- status: 204
- });
-}
diff --git a/backend/ws.js b/backend/ws.js
deleted file mode 100644
index e02317c0d..000000000
--- a/backend/ws.js
+++ /dev/null
@@ -1,33 +0,0 @@
-// import './websocket.js';
-import { WebSocketServer } from 'ws';
-
-// poor man's HMR, pending https://github.com/vitejs/vite/issues/7887
-// @ts-expect-error
-if (globalThis.__wss) globalThis.__wss.close();
-
-const wss = new WebSocketServer({ port: 4567 });
-globalThis.__wss = wss;
-
-/** @type {Set} */
-const connections = new Set();
-
-wss.on('connection', (ws) => {
- connections.add(ws);
-
- ws.on('close', () => {
- connections.delete(ws);
- });
-});
-
-export const ready = new Promise((fulfil) => {
- wss.on('listening', () => {
- fulfil(undefined);
- });
-});
-
-/** @param {any} data */
-export function broadcast(data) {
- for (const connection of connections) {
- connection.send(JSON.stringify(data));
- }
-}
diff --git a/content/tutorial/01-svelte/01-introduction/01-welcome-to-svelte/README.md b/content/tutorial/01-svelte/01-introduction/01-welcome-to-svelte/README.md
index 14105cdf0..0701a6901 100644
--- a/content/tutorial/01-svelte/01-introduction/01-welcome-to-svelte/README.md
+++ b/content/tutorial/01-svelte/01-introduction/01-welcome-to-svelte/README.md
@@ -20,9 +20,9 @@ You can build your entire app with Svelte (for example, using an application fra
This tutorial is split into four main parts:
-- [Welcome to Svelte](/tutorial/welcome-to-svelte) (you are here)
-- [Introduction to SvelteKit](/tutorial/introducing-sveltekit)
+- [Basic Svelte](/tutorial/welcome-to-svelte) (you are here)
- [Advanced Svelte](/tutorial/tweens)
+- [Basic SvelteKit](/tutorial/introducing-sveltekit)
- [Advanced SvelteKit](/tutorial/optional-params)
Each section will present an exercise designed to illustrate a feature. Later exercises build on the knowledge gained in earlier ones, so it's recommended that you go from start to finish. If necessary, you can navigate via the menu above.
diff --git a/content/tutorial/01-svelte/01-introduction/03-dynamic-attributes/README.md b/content/tutorial/01-svelte/01-introduction/03-dynamic-attributes/README.md
index e03524b1a..6c325239f 100644
--- a/content/tutorial/01-svelte/01-introduction/03-dynamic-attributes/README.md
+++ b/content/tutorial/01-svelte/01-introduction/03-dynamic-attributes/README.md
@@ -32,5 +32,5 @@ It's not uncommon to have an attribute where the name and value are the same, li
```svelte
/// file: App.svelte
-
+
```
diff --git a/content/tutorial/03-advanced-svelte/11-special-tags/02-html-tags/README.md b/content/tutorial/01-svelte/01-introduction/06-html-tags/README.md
similarity index 60%
rename from content/tutorial/03-advanced-svelte/11-special-tags/02-html-tags/README.md
rename to content/tutorial/01-svelte/01-introduction/06-html-tags/README.md
index 914e76bbf..801b22a1d 100644
--- a/content/tutorial/03-advanced-svelte/11-special-tags/02-html-tags/README.md
+++ b/content/tutorial/01-svelte/01-introduction/06-html-tags/README.md
@@ -13,4 +13,4 @@ In Svelte, you do this with the special `{@html ...}` tag:
{+++@html+++ string}
```
-> **Warning!** Svelte doesn't perform any sanitization of the expression inside `{@html ...}` before it gets inserted into the DOM. In other words, if you use this feature it's critical that you manually escape HTML that comes from sources you don't trust, otherwise you risk exposing your users to Cross-Site Scripting (XSS) attacks.
+> **Warning!** Svelte doesn't perform any sanitization of the expression inside `{@html ...}` before it gets inserted into the DOM. This isn't an issue if the content is something you trust like an article you wrote yourself. However if it's some untrusted user content, e.g. a comment on an article, then it's critical that you manually escape it, otherwise you risk exposing your users to Cross-Site Scripting (XSS) attacks.
diff --git a/content/tutorial/03-advanced-svelte/11-special-tags/02-html-tags/app-a/src/lib/App.svelte b/content/tutorial/01-svelte/01-introduction/06-html-tags/app-a/src/lib/App.svelte
similarity index 100%
rename from content/tutorial/03-advanced-svelte/11-special-tags/02-html-tags/app-a/src/lib/App.svelte
rename to content/tutorial/01-svelte/01-introduction/06-html-tags/app-a/src/lib/App.svelte
diff --git a/content/tutorial/03-advanced-svelte/11-special-tags/02-html-tags/app-b/src/lib/App.svelte b/content/tutorial/01-svelte/01-introduction/06-html-tags/app-b/src/lib/App.svelte
similarity index 100%
rename from content/tutorial/03-advanced-svelte/11-special-tags/02-html-tags/app-b/src/lib/App.svelte
rename to content/tutorial/01-svelte/01-introduction/06-html-tags/app-b/src/lib/App.svelte
diff --git a/content/tutorial/01-svelte/02-reactivity/02-reactive-declarations/README.md b/content/tutorial/01-svelte/02-reactivity/02-reactive-declarations/README.md
index 16fb5dfb1..0ef6f276f 100644
--- a/content/tutorial/01-svelte/02-reactivity/02-reactive-declarations/README.md
+++ b/content/tutorial/01-svelte/02-reactivity/02-reactive-declarations/README.md
@@ -12,6 +12,8 @@ let count = 0;
+++$: doubled = count * 2;+++
```
+If a reactive statement consists entirely of an assignment to an undeclared variable, Svelte will inject a `let` declaration on your behalf.
+
> 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:
@@ -24,3 +26,5 @@ Let's use `doubled` in our markup:
```
Of course, you could just write `{count * 2}` in the markup instead — you don't have to use reactive values. Reactive values become particularly valuable (no pun intended) when you need to reference them multiple times, or you have values that depend on _other_ reactive values.
+
+> Note that reactive declarations and statements will run after other script code and before component markup is rendered.
diff --git a/content/tutorial/01-svelte/02-reactivity/04-updating-arrays-and-objects/README.md b/content/tutorial/01-svelte/02-reactivity/04-updating-arrays-and-objects/README.md
index 74e3a581f..49e0654ab 100644
--- a/content/tutorial/01-svelte/02-reactivity/04-updating-arrays-and-objects/README.md
+++ b/content/tutorial/01-svelte/02-reactivity/04-updating-arrays-and-objects/README.md
@@ -38,8 +38,9 @@ A simple rule of thumb: the name of the updated variable must appear on the left
```js
/// no-file
+const obj = { foo: { bar: 1 } };
const foo = obj.foo;
-foo.bar = 'baz';
+foo.bar = 2;
```
...won't trigger reactivity on `obj.foo.bar`, unless you follow it up with `obj = obj`.
diff --git a/content/tutorial/01-svelte/02-reactivity/04-updating-arrays-and-objects/app-a/src/lib/App.svelte b/content/tutorial/01-svelte/02-reactivity/04-updating-arrays-and-objects/app-a/src/lib/App.svelte
index 77d176923..ab6ef7074 100644
--- a/content/tutorial/01-svelte/02-reactivity/04-updating-arrays-and-objects/app-a/src/lib/App.svelte
+++ b/content/tutorial/01-svelte/02-reactivity/04-updating-arrays-and-objects/app-a/src/lib/App.svelte
@@ -5,7 +5,7 @@
numbers.push(numbers.length + 1);
}
- $: sum = numbers.reduce((t, n) => t + n, 0);
+ $: sum = numbers.reduce((total, currentNumber) => total + currentNumber, 0);
{numbers.join(' + ')} = {sum}
diff --git a/content/tutorial/01-svelte/02-reactivity/04-updating-arrays-and-objects/app-b/src/lib/App.svelte b/content/tutorial/01-svelte/02-reactivity/04-updating-arrays-and-objects/app-b/src/lib/App.svelte
index d15f58c4d..730ae8cc7 100644
--- a/content/tutorial/01-svelte/02-reactivity/04-updating-arrays-and-objects/app-b/src/lib/App.svelte
+++ b/content/tutorial/01-svelte/02-reactivity/04-updating-arrays-and-objects/app-b/src/lib/App.svelte
@@ -5,7 +5,7 @@
numbers = [...numbers, numbers.length + 1];
}
- $: sum = numbers.reduce((t, n) => t + n, 0);
+ $: sum = numbers.reduce((total, currentNumber) => total + currentNumber, 0);
{numbers.join(' + ')} = {sum}
diff --git a/content/tutorial/01-svelte/03-props/03-spread-props/app-a/src/lib/App.svelte b/content/tutorial/01-svelte/03-props/03-spread-props/app-a/src/lib/App.svelte
index 4fb555240..2d5d7123b 100644
--- a/content/tutorial/01-svelte/03-props/03-spread-props/app-a/src/lib/App.svelte
+++ b/content/tutorial/01-svelte/03-props/03-spread-props/app-a/src/lib/App.svelte
@@ -4,7 +4,7 @@
const pkg = {
name: 'svelte',
speed: 'blazing',
- version: 3,
+ version: 4,
website: 'https://svelte.dev'
};
diff --git a/content/tutorial/01-svelte/03-props/03-spread-props/app-b/src/lib/App.svelte b/content/tutorial/01-svelte/03-props/03-spread-props/app-b/src/lib/App.svelte
index 5934bdabf..3ded4fd56 100644
--- a/content/tutorial/01-svelte/03-props/03-spread-props/app-b/src/lib/App.svelte
+++ b/content/tutorial/01-svelte/03-props/03-spread-props/app-b/src/lib/App.svelte
@@ -4,7 +4,7 @@
const pkg = {
name: 'svelte',
speed: 'blazing',
- version: 3,
+ version: 4,
website: 'https://svelte.dev'
};
diff --git a/content/tutorial/01-svelte/04-logic/01-if-blocks/README.md b/content/tutorial/01-svelte/04-logic/01-if-blocks/README.md
index 810bc08dd..845b4ab99 100644
--- a/content/tutorial/01-svelte/04-logic/01-if-blocks/README.md
+++ b/content/tutorial/01-svelte/04-logic/01-if-blocks/README.md
@@ -4,21 +4,18 @@ title: If blocks
HTML doesn't have a way of expressing _logic_, like conditionals and loops. Svelte does.
-To conditionally render some markup, we wrap it in an `if` block:
+To conditionally render some markup, we wrap it in an `if` block. Let's add some text that appears when `count` is greater than `10`:
```svelte
/// file: App.svelte
-+++{#if user.loggedIn}+++
-
-+++{/if}+++
+
-+++{#if !user.loggedIn}+++
-
-+++{/if}+++
++++{#if count > 10}
+
{count} is greater than 10
+{/if}+++
```
-Try it — update the component, and click on the buttons.
+Try it — update the component, and click on the button.
diff --git a/content/tutorial/01-svelte/04-logic/01-if-blocks/app-a/src/lib/App.svelte b/content/tutorial/01-svelte/04-logic/01-if-blocks/app-a/src/lib/App.svelte
index b955f6d0d..bb0ebe43a 100644
--- a/content/tutorial/01-svelte/04-logic/01-if-blocks/app-a/src/lib/App.svelte
+++ b/content/tutorial/01-svelte/04-logic/01-if-blocks/app-a/src/lib/App.svelte
@@ -1,15 +1,12 @@
-
-
-
-
-
{$page.error?.stack || ''}
{/if}
diff --git a/content/tutorial/01-svelte/meta.json b/content/tutorial/01-svelte/meta.json
index 55c38c336..0f82ec454 100644
--- a/content/tutorial/01-svelte/meta.json
+++ b/content/tutorial/01-svelte/meta.json
@@ -1,5 +1,5 @@
{
- "title": "Welcome to Svelte",
+ "title": "Basic Svelte",
"scope": {
"prefix": "/src/lib/",
"name": "src"
diff --git a/content/tutorial/03-advanced-svelte/01-motion/01-tweens/README.md b/content/tutorial/02-advanced-svelte/01-motion/01-tweens/README.md
similarity index 91%
rename from content/tutorial/03-advanced-svelte/01-motion/01-tweens/README.md
rename to content/tutorial/02-advanced-svelte/01-motion/01-tweens/README.md
index dcdd41fc7..68f96f811 100644
--- a/content/tutorial/03-advanced-svelte/01-motion/01-tweens/README.md
+++ b/content/tutorial/02-advanced-svelte/01-motion/01-tweens/README.md
@@ -2,11 +2,11 @@
title: Tweens
---
-Now that we've covered the basics of SvelteKit, it's time to learn some advanced Svelte techniques, starting with _motion_.
+Now that we've covered the basics, it's time to learn some advanced Svelte techniques, starting with _motion_.
Setting values and watching the DOM update automatically is cool. Know what's even cooler? Tweening those values. Svelte includes tools to help you build slick user interfaces that use animation to communicate changes.
-Let's start by changing the `progress` store to a `tweened` value:
+Let's start by changing the `progress` store to a `tweened` store:
```svelte
/// file: App.svelte
diff --git a/content/tutorial/03-advanced-svelte/01-motion/01-tweens/app-a/src/lib/App.svelte b/content/tutorial/02-advanced-svelte/01-motion/01-tweens/app-a/src/lib/App.svelte
similarity index 91%
rename from content/tutorial/03-advanced-svelte/01-motion/01-tweens/app-a/src/lib/App.svelte
rename to content/tutorial/02-advanced-svelte/01-motion/01-tweens/app-a/src/lib/App.svelte
index f0b3b7058..f0d3d3d1c 100644
--- a/content/tutorial/03-advanced-svelte/01-motion/01-tweens/app-a/src/lib/App.svelte
+++ b/content/tutorial/02-advanced-svelte/01-motion/01-tweens/app-a/src/lib/App.svelte
@@ -4,7 +4,7 @@
const progress = writable(0);
-
+
progress.set(0)}>
0%
diff --git a/content/tutorial/03-advanced-svelte/01-motion/01-tweens/app-b/src/lib/App.svelte b/content/tutorial/02-advanced-svelte/01-motion/01-tweens/app-b/src/lib/App.svelte
similarity index 93%
rename from content/tutorial/03-advanced-svelte/01-motion/01-tweens/app-b/src/lib/App.svelte
rename to content/tutorial/02-advanced-svelte/01-motion/01-tweens/app-b/src/lib/App.svelte
index 93fc5ba9c..ffe7716e1 100644
--- a/content/tutorial/03-advanced-svelte/01-motion/01-tweens/app-b/src/lib/App.svelte
+++ b/content/tutorial/02-advanced-svelte/01-motion/01-tweens/app-b/src/lib/App.svelte
@@ -8,7 +8,7 @@
});
-
+
progress.set(0)}>
0%
diff --git a/content/tutorial/03-advanced-svelte/01-motion/02-springs/README.md b/content/tutorial/02-advanced-svelte/01-motion/02-springs/README.md
similarity index 100%
rename from content/tutorial/03-advanced-svelte/01-motion/02-springs/README.md
rename to content/tutorial/02-advanced-svelte/01-motion/02-springs/README.md
diff --git a/content/tutorial/03-advanced-svelte/01-motion/02-springs/app-a/src/lib/App.svelte b/content/tutorial/02-advanced-svelte/01-motion/02-springs/app-a/src/lib/App.svelte
similarity index 95%
rename from content/tutorial/03-advanced-svelte/01-motion/02-springs/app-a/src/lib/App.svelte
rename to content/tutorial/02-advanced-svelte/01-motion/02-springs/app-a/src/lib/App.svelte
index 94dce49d8..92805f88c 100644
--- a/content/tutorial/03-advanced-svelte/01-motion/02-springs/app-a/src/lib/App.svelte
+++ b/content/tutorial/02-advanced-svelte/01-motion/02-springs/app-a/src/lib/App.svelte
@@ -11,6 +11,7 @@
}}
on:mousedown={() => size.set(30)}
on:mouseup={() => size.set(10)}
+ role="presentation"
>
@@ -36,7 +37,7 @@
diff --git a/content/tutorial/03-advanced-svelte/01-motion/02-springs/app-b/src/lib/App.svelte b/content/tutorial/02-advanced-svelte/01-motion/02-springs/app-b/src/lib/App.svelte
similarity index 95%
rename from content/tutorial/03-advanced-svelte/01-motion/02-springs/app-b/src/lib/App.svelte
rename to content/tutorial/02-advanced-svelte/01-motion/02-springs/app-b/src/lib/App.svelte
index 14b5ea87d..18c28a4a7 100644
--- a/content/tutorial/03-advanced-svelte/01-motion/02-springs/app-b/src/lib/App.svelte
+++ b/content/tutorial/02-advanced-svelte/01-motion/02-springs/app-b/src/lib/App.svelte
@@ -15,6 +15,7 @@
}}
on:mousedown={() => size.set(30)}
on:mouseup={() => size.set(10)}
+ role="presentation"
>
@@ -40,7 +41,7 @@
diff --git a/content/tutorial/03-advanced-svelte/01-motion/meta.json b/content/tutorial/02-advanced-svelte/01-motion/meta.json
similarity index 100%
rename from content/tutorial/03-advanced-svelte/01-motion/meta.json
rename to content/tutorial/02-advanced-svelte/01-motion/meta.json
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/01-transition/README.md b/content/tutorial/02-advanced-svelte/02-transitions/01-transition/README.md
similarity index 90%
rename from content/tutorial/03-advanced-svelte/02-transitions/01-transition/README.md
rename to content/tutorial/02-advanced-svelte/02-transitions/01-transition/README.md
index 9d7d44929..7eb3ddc8a 100644
--- a/content/tutorial/03-advanced-svelte/02-transitions/01-transition/README.md
+++ b/content/tutorial/02-advanced-svelte/02-transitions/01-transition/README.md
@@ -18,5 +18,7 @@ First, import the `fade` function from `svelte/transition`...
```svelte
/// file: App.svelte
-
Fades in and out
+
+ Fades in and out
+
```
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/01-transition/app-a/src/lib/App.svelte b/content/tutorial/02-advanced-svelte/02-transitions/01-transition/app-a/src/lib/App.svelte
similarity index 82%
rename from content/tutorial/03-advanced-svelte/02-transitions/01-transition/app-a/src/lib/App.svelte
rename to content/tutorial/02-advanced-svelte/02-transitions/01-transition/app-a/src/lib/App.svelte
index 5ba3e7fb7..6f955a5b1 100644
--- a/content/tutorial/03-advanced-svelte/02-transitions/01-transition/app-a/src/lib/App.svelte
+++ b/content/tutorial/02-advanced-svelte/02-transitions/01-transition/app-a/src/lib/App.svelte
@@ -8,5 +8,7 @@
{#if visible}
-
Fades in and out
+
+ Fades in and out
+
{/if}
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/01-transition/app-b/src/lib/App.svelte b/content/tutorial/02-advanced-svelte/02-transitions/01-transition/app-b/src/lib/App.svelte
similarity index 79%
rename from content/tutorial/03-advanced-svelte/02-transitions/01-transition/app-b/src/lib/App.svelte
rename to content/tutorial/02-advanced-svelte/02-transitions/01-transition/app-b/src/lib/App.svelte
index 29e9254d1..1700bfbb0 100644
--- a/content/tutorial/03-advanced-svelte/02-transitions/01-transition/app-b/src/lib/App.svelte
+++ b/content/tutorial/02-advanced-svelte/02-transitions/01-transition/app-b/src/lib/App.svelte
@@ -9,5 +9,7 @@
{#if visible}
-
Fades in and out
+
+ Fades in and out
+
{/if}
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/02-adding-parameters-to-transitions/README.md b/content/tutorial/02-advanced-svelte/02-transitions/02-adding-parameters-to-transitions/README.md
similarity index 100%
rename from content/tutorial/03-advanced-svelte/02-transitions/02-adding-parameters-to-transitions/README.md
rename to content/tutorial/02-advanced-svelte/02-transitions/02-adding-parameters-to-transitions/README.md
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/02-adding-parameters-to-transitions/app-b/src/lib/App.svelte b/content/tutorial/02-advanced-svelte/02-transitions/02-adding-parameters-to-transitions/app-b/src/lib/App.svelte
similarity index 100%
rename from content/tutorial/03-advanced-svelte/02-transitions/02-adding-parameters-to-transitions/app-b/src/lib/App.svelte
rename to content/tutorial/02-advanced-svelte/02-transitions/02-adding-parameters-to-transitions/app-b/src/lib/App.svelte
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/03-in-and-out/README.md b/content/tutorial/02-advanced-svelte/02-transitions/03-in-and-out/README.md
similarity index 100%
rename from content/tutorial/03-advanced-svelte/02-transitions/03-in-and-out/README.md
rename to content/tutorial/02-advanced-svelte/02-transitions/03-in-and-out/README.md
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/03-in-and-out/app-b/src/lib/App.svelte b/content/tutorial/02-advanced-svelte/02-transitions/03-in-and-out/app-b/src/lib/App.svelte
similarity index 100%
rename from content/tutorial/03-advanced-svelte/02-transitions/03-in-and-out/app-b/src/lib/App.svelte
rename to content/tutorial/02-advanced-svelte/02-transitions/03-in-and-out/app-b/src/lib/App.svelte
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/04-custom-css-transitions/README.md b/content/tutorial/02-advanced-svelte/02-transitions/04-custom-css-transitions/README.md
similarity index 91%
rename from content/tutorial/03-advanced-svelte/02-transitions/04-custom-css-transitions/README.md
rename to content/tutorial/02-advanced-svelte/02-transitions/04-custom-css-transitions/README.md
index ebc6e9b1f..e10576f8c 100644
--- a/content/tutorial/03-advanced-svelte/02-transitions/04-custom-css-transitions/README.md
+++ b/content/tutorial/02-advanced-svelte/02-transitions/04-custom-css-transitions/README.md
@@ -33,19 +33,11 @@ For example, the `fade` transition generates a CSS animation somewhat like this:
```css
/// no-file
-0% {
- opacity: 0;
-}
-10% {
- opacity: 0.1;
-}
-20% {
- opacity: 0.2;
-}
+0% { opacity: 0 }
+10% { opacity: 0.1 }
+20% { opacity: 0.2 }
/* ... */
-100% {
- opacity: 1;
-}
+100% { opacity: 1 }
```
We can get a lot more creative though. Let's make something truly gratuitous:
@@ -61,16 +53,16 @@ We can get a lot more creative though. Let's make something truly gratuitous:
function spin(node, { duration }) {
return {
duration,
- css: t => +++{
+ css: (t) => +++{
const eased = elasticOut(t);
return `
transform: scale(${eased}) rotate(${eased * 1080}deg);
color: hsl(
${Math.trunc(t * 360)},
- ${Math.min(100, 1000 - 1000 * t)}%,
- ${Math.min(50, 500 - 500 * t)}%
- );`
+ ${Math.min(100, 1000 * (1 - t))}%,
+ ${Math.min(50, 500 * (1 - t))}%
+ );`;
}+++
};
}
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/04-custom-css-transitions/app-a/src/lib/App.svelte b/content/tutorial/02-advanced-svelte/02-transitions/04-custom-css-transitions/app-a/src/lib/App.svelte
similarity index 100%
rename from content/tutorial/03-advanced-svelte/02-transitions/04-custom-css-transitions/app-a/src/lib/App.svelte
rename to content/tutorial/02-advanced-svelte/02-transitions/04-custom-css-transitions/app-a/src/lib/App.svelte
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/04-custom-css-transitions/app-b/src/lib/App.svelte b/content/tutorial/02-advanced-svelte/02-transitions/04-custom-css-transitions/app-b/src/lib/App.svelte
similarity index 90%
rename from content/tutorial/03-advanced-svelte/02-transitions/04-custom-css-transitions/app-b/src/lib/App.svelte
rename to content/tutorial/02-advanced-svelte/02-transitions/04-custom-css-transitions/app-b/src/lib/App.svelte
index 2957b19dc..d0c84c2c2 100644
--- a/content/tutorial/03-advanced-svelte/02-transitions/04-custom-css-transitions/app-b/src/lib/App.svelte
+++ b/content/tutorial/02-advanced-svelte/02-transitions/04-custom-css-transitions/app-b/src/lib/App.svelte
@@ -14,8 +14,8 @@
transform: scale(${eased}) rotate(${eased * 1080}deg);
color: hsl(
${Math.trunc(t * 360)},
- ${Math.min(100, 1000 - 1000 * t)}%,
- ${Math.min(50, 500 - 500 * t)}%
+ ${Math.min(100, 1000 * (1 - t))}%,
+ ${Math.min(50, 500 * (1 - t))}%
);`;
}
};
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/05-custom-js-transitions/README.md b/content/tutorial/02-advanced-svelte/02-transitions/05-custom-js-transitions/README.md
similarity index 100%
rename from content/tutorial/03-advanced-svelte/02-transitions/05-custom-js-transitions/README.md
rename to content/tutorial/02-advanced-svelte/02-transitions/05-custom-js-transitions/README.md
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/05-custom-js-transitions/app-a/src/lib/App.svelte b/content/tutorial/02-advanced-svelte/02-transitions/05-custom-js-transitions/app-a/src/lib/App.svelte
similarity index 100%
rename from content/tutorial/03-advanced-svelte/02-transitions/05-custom-js-transitions/app-a/src/lib/App.svelte
rename to content/tutorial/02-advanced-svelte/02-transitions/05-custom-js-transitions/app-a/src/lib/App.svelte
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/05-custom-js-transitions/app-b/src/lib/App.svelte b/content/tutorial/02-advanced-svelte/02-transitions/05-custom-js-transitions/app-b/src/lib/App.svelte
similarity index 100%
rename from content/tutorial/03-advanced-svelte/02-transitions/05-custom-js-transitions/app-b/src/lib/App.svelte
rename to content/tutorial/02-advanced-svelte/02-transitions/05-custom-js-transitions/app-b/src/lib/App.svelte
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/06-transition-events/README.md b/content/tutorial/02-advanced-svelte/02-transitions/06-transition-events/README.md
similarity index 100%
rename from content/tutorial/03-advanced-svelte/02-transitions/06-transition-events/README.md
rename to content/tutorial/02-advanced-svelte/02-transitions/06-transition-events/README.md
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/06-transition-events/app-a/src/lib/App.svelte b/content/tutorial/02-advanced-svelte/02-transitions/06-transition-events/app-a/src/lib/App.svelte
similarity index 100%
rename from content/tutorial/03-advanced-svelte/02-transitions/06-transition-events/app-a/src/lib/App.svelte
rename to content/tutorial/02-advanced-svelte/02-transitions/06-transition-events/app-a/src/lib/App.svelte
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/06-transition-events/app-b/src/lib/App.svelte b/content/tutorial/02-advanced-svelte/02-transitions/06-transition-events/app-b/src/lib/App.svelte
similarity index 60%
rename from content/tutorial/03-advanced-svelte/02-transitions/06-transition-events/app-b/src/lib/App.svelte
rename to content/tutorial/02-advanced-svelte/02-transitions/06-transition-events/app-b/src/lib/App.svelte
index 17686585e..f52074ddc 100644
--- a/content/tutorial/03-advanced-svelte/02-transitions/06-transition-events/app-b/src/lib/App.svelte
+++ b/content/tutorial/02-advanced-svelte/02-transitions/06-transition-events/app-b/src/lib/App.svelte
@@ -15,12 +15,10 @@
{#if visible}
- (status = 'intro started')}
- on:outrostart={() =>
- (status = 'outro started')}
- on:introend={() => (status = 'intro ended')}
- on:outroend={() => (status = 'outro ended')}
+ on:introstart={() => status = 'intro started'}
+ on:outrostart={() => status = 'outro started'}
+ on:introend={() => status = 'intro ended'}
+ on:outroend={() => status = 'outro ended'}
>
Flies in and out
diff --git a/content/tutorial/02-advanced-svelte/02-transitions/07-global-transitions/README.md b/content/tutorial/02-advanced-svelte/02-transitions/07-global-transitions/README.md
new file mode 100644
index 000000000..10135b894
--- /dev/null
+++ b/content/tutorial/02-advanced-svelte/02-transitions/07-global-transitions/README.md
@@ -0,0 +1,18 @@
+---
+title: Global transitions
+---
+
+Ordinarily, transitions will only play on elements when their direct containing block is added or destroyed. In the example here, toggling the visibility of the entire list does not apply transitions to individual list elements.
+
+Instead, we'd like transitions to not only play when individual items are added and removed with the slider but also when we toggle the checkbox.
+
+We can achieve this with a _global_ transition, which plays when _any_ block containing the transitions is added or removed:
+
+```svelte
+/// file: App.svelte
+
+ {item}
+
+```
+
+> In Svelte 3, transitions were global by default and you had to use the `|local` modifier to make them local.
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/07-local-transitions/app-a/src/lib/App.svelte b/content/tutorial/02-advanced-svelte/02-transitions/07-global-transitions/app-a/src/lib/App.svelte
similarity index 100%
rename from content/tutorial/03-advanced-svelte/02-transitions/07-local-transitions/app-a/src/lib/App.svelte
rename to content/tutorial/02-advanced-svelte/02-transitions/07-global-transitions/app-a/src/lib/App.svelte
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/07-local-transitions/app-b/src/lib/App.svelte b/content/tutorial/02-advanced-svelte/02-transitions/07-global-transitions/app-b/src/lib/App.svelte
similarity index 94%
rename from content/tutorial/03-advanced-svelte/02-transitions/07-local-transitions/app-b/src/lib/App.svelte
rename to content/tutorial/02-advanced-svelte/02-transitions/07-global-transitions/app-b/src/lib/App.svelte
index 57f24e93b..93de6a0cd 100644
--- a/content/tutorial/03-advanced-svelte/02-transitions/07-local-transitions/app-b/src/lib/App.svelte
+++ b/content/tutorial/02-advanced-svelte/02-transitions/07-global-transitions/app-b/src/lib/App.svelte
@@ -17,7 +17,7 @@
{#if showItems}
{#each items.slice(0, i) as item}
-
+
{item}
{/each}
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/08-key-blocks/README.md b/content/tutorial/02-advanced-svelte/02-transitions/08-key-blocks/README.md
similarity index 80%
rename from content/tutorial/03-advanced-svelte/02-transitions/08-key-blocks/README.md
rename to content/tutorial/02-advanced-svelte/02-transitions/08-key-blocks/README.md
index 9e79213d5..33f7d7ea7 100644
--- a/content/tutorial/03-advanced-svelte/02-transitions/08-key-blocks/README.md
+++ b/content/tutorial/02-advanced-svelte/02-transitions/08-key-blocks/README.md
@@ -4,7 +4,7 @@ title: Key blocks
Key blocks destroy and recreate their contents when the value of an expression changes. 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.
-Here, for example, we'd like to play the `typewriter` transition from `transition.js` whenever the loading message changes. Wrap the `
` element in a key block:
+Here, for example, we'd like to play the `typewriter` transition from `transition.js` whenever the loading message, i.e. `i` changes. Wrap the `
` element in a key block:
```svelte
/// file: App.svelte
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/08-key-blocks/app-a/src/lib/App.svelte b/content/tutorial/02-advanced-svelte/02-transitions/08-key-blocks/app-a/src/lib/App.svelte
similarity index 100%
rename from content/tutorial/03-advanced-svelte/02-transitions/08-key-blocks/app-a/src/lib/App.svelte
rename to content/tutorial/02-advanced-svelte/02-transitions/08-key-blocks/app-a/src/lib/App.svelte
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/08-key-blocks/app-a/src/lib/loading-messages.js b/content/tutorial/02-advanced-svelte/02-transitions/08-key-blocks/app-a/src/lib/loading-messages.js
similarity index 100%
rename from content/tutorial/03-advanced-svelte/02-transitions/08-key-blocks/app-a/src/lib/loading-messages.js
rename to content/tutorial/02-advanced-svelte/02-transitions/08-key-blocks/app-a/src/lib/loading-messages.js
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/08-key-blocks/app-a/src/lib/transition.js b/content/tutorial/02-advanced-svelte/02-transitions/08-key-blocks/app-a/src/lib/transition.js
similarity index 100%
rename from content/tutorial/03-advanced-svelte/02-transitions/08-key-blocks/app-a/src/lib/transition.js
rename to content/tutorial/02-advanced-svelte/02-transitions/08-key-blocks/app-a/src/lib/transition.js
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/08-key-blocks/app-b/src/lib/App.svelte b/content/tutorial/02-advanced-svelte/02-transitions/08-key-blocks/app-b/src/lib/App.svelte
similarity index 100%
rename from content/tutorial/03-advanced-svelte/02-transitions/08-key-blocks/app-b/src/lib/App.svelte
rename to content/tutorial/02-advanced-svelte/02-transitions/08-key-blocks/app-b/src/lib/App.svelte
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/09-deferred-transitions/README.md b/content/tutorial/02-advanced-svelte/02-transitions/09-deferred-transitions/README.md
similarity index 68%
rename from content/tutorial/03-advanced-svelte/02-transitions/09-deferred-transitions/README.md
rename to content/tutorial/02-advanced-svelte/02-transitions/09-deferred-transitions/README.md
index c48b8ff31..8a3a945fb 100644
--- a/content/tutorial/03-advanced-svelte/02-transitions/09-deferred-transitions/README.md
+++ b/content/tutorial/02-advanced-svelte/02-transitions/09-deferred-transitions/README.md
@@ -6,7 +6,7 @@ A particularly powerful feature of Svelte's transition engine is the ability to
Take this pair of todo lists, in which toggling a todo sends it to the opposite list. In the real world, objects don't behave like that — instead of disappearing and reappearing in another place, they move through a series of intermediate positions. Using motion can go a long way towards helping users understand what's happening in your app.
-We can achieve this effect using the `crossfade` function, as seen in transition.js, which creates a pair of transitions called `send` and `receive`. When an element is 'sent', it looks for a corresponding element being 'received', and generates a transition that transforms the element to its counterpart's position and fades it out. When an element is 'received', the reverse happens. If there is no counterpart, the `fallback` transition is used.
+We can achieve this effect using the `crossfade` function, as seen in `transition.js`, which creates a pair of transitions called `send` and `receive`. When an element is 'sent', it looks for a corresponding element being 'received', and generates a transition that transforms the element to its counterpart's position and fades it out. When an element is 'received', the reverse happens. If there is no counterpart, the `fallback` transition is used.
Open `TodoList.svelte`. First, import the `send` and `receive` transitions from transition.js:
@@ -16,15 +16,16 @@ Open `TodoList.svelte`. First, import the `send` and `receive` transitions from
+++import { send, receive } from './transition.js';+++
export let store;
- export let filter;
+ export let done;
```
-Then, add them to the `
+
+
\ No newline at end of file
diff --git a/content/tutorial/02-advanced-svelte/02-transitions/09-deferred-transitions/app-a/src/lib/remove.svg b/content/tutorial/02-advanced-svelte/02-transitions/09-deferred-transitions/app-a/src/lib/remove.svg
new file mode 100644
index 000000000..434ab0956
--- /dev/null
+++ b/content/tutorial/02-advanced-svelte/02-transitions/09-deferred-transitions/app-a/src/lib/remove.svg
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/09-deferred-transitions/app-a/src/lib/todos.js b/content/tutorial/02-advanced-svelte/02-transitions/09-deferred-transitions/app-a/src/lib/todos.js
similarity index 100%
rename from content/tutorial/03-advanced-svelte/02-transitions/09-deferred-transitions/app-a/src/lib/todos.js
rename to content/tutorial/02-advanced-svelte/02-transitions/09-deferred-transitions/app-a/src/lib/todos.js
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/09-deferred-transitions/app-a/src/lib/transition.js b/content/tutorial/02-advanced-svelte/02-transitions/09-deferred-transitions/app-a/src/lib/transition.js
similarity index 100%
rename from content/tutorial/03-advanced-svelte/02-transitions/09-deferred-transitions/app-a/src/lib/transition.js
rename to content/tutorial/02-advanced-svelte/02-transitions/09-deferred-transitions/app-a/src/lib/transition.js
diff --git a/content/tutorial/02-advanced-svelte/02-transitions/09-deferred-transitions/app-b/src/lib/TodoList.svelte b/content/tutorial/02-advanced-svelte/02-transitions/09-deferred-transitions/app-b/src/lib/TodoList.svelte
new file mode 100644
index 000000000..680de1fd9
--- /dev/null
+++ b/content/tutorial/02-advanced-svelte/02-transitions/09-deferred-transitions/app-b/src/lib/TodoList.svelte
@@ -0,0 +1,44 @@
+
+
+
+ {#each $store.filter((todo) => todo.done === done) as todo (todo.id)}
+
+
+
\ No newline at end of file
diff --git a/content/tutorial/03-advanced-svelte/02-transitions/meta.json b/content/tutorial/02-advanced-svelte/02-transitions/meta.json
similarity index 100%
rename from content/tutorial/03-advanced-svelte/02-transitions/meta.json
rename to content/tutorial/02-advanced-svelte/02-transitions/meta.json
diff --git a/content/tutorial/03-advanced-svelte/03-animations/01-animate/README.md b/content/tutorial/02-advanced-svelte/03-animations/01-animate/README.md
similarity index 93%
rename from content/tutorial/03-advanced-svelte/03-animations/01-animate/README.md
rename to content/tutorial/02-advanced-svelte/03-animations/01-animate/README.md
index 69cb3a625..53f0221a1 100644
--- a/content/tutorial/03-advanced-svelte/03-animations/01-animate/README.md
+++ b/content/tutorial/02-advanced-svelte/03-animations/01-animate/README.md
@@ -15,15 +15,16 @@ First, import the `flip` function — flip stands for ['First, Last, Invert, Pla
import { send, receive } from './transition.js';
export let store;
- export let filter;
+ export let done;
```
-Then add it to the `` elements:
+Then add it to the `
` elements:
```svelte
/// file: TodoList.svelte
-
+ import { flip } from 'svelte/animate';
+ import { send, receive } from './transition.js';
+
+ export let store;
+ export let done;
+
+
+
+ {#each $store.filter((todo) => todo.done === done) as todo (todo.id)}
+
+
+
\ No newline at end of file
diff --git a/content/tutorial/03-advanced-svelte/03-animations/meta.json b/content/tutorial/02-advanced-svelte/03-animations/meta.json
similarity index 69%
rename from content/tutorial/03-advanced-svelte/03-animations/meta.json
rename to content/tutorial/02-advanced-svelte/03-animations/meta.json
index a0c86c1af..e67245925 100644
--- a/content/tutorial/03-advanced-svelte/03-animations/meta.json
+++ b/content/tutorial/02-advanced-svelte/03-animations/meta.json
@@ -4,5 +4,5 @@
"prefix": "/src/lib/",
"name": "src"
},
- "focus": "/src/lib/App.svelte"
+ "focus": "/src/lib/TodoList.svelte"
}
diff --git a/content/tutorial/02-advanced-svelte/04-actions/01-actions/README.md b/content/tutorial/02-advanced-svelte/04-actions/01-actions/README.md
new file mode 100644
index 000000000..7f810312b
--- /dev/null
+++ b/content/tutorial/02-advanced-svelte/04-actions/01-actions/README.md
@@ -0,0 +1,64 @@
+---
+title: The use directive
+---
+
+Actions are essentially element-level lifecycle functions. They're useful for things like:
+
+- interfacing with third-party libraries
+- lazy-loaded images
+- tooltips
+- adding custom event handlers
+
+In this app, you can scribble on the ``, and change colours and brush size via the menu. But if you open the menu and cycle through the options with the Tab key, you'll soon find that the focus isn't _trapped_ inside the modal.
+
+We can fix that with an action. Import `trapFocus` from `actions.js`...
+
+```svelte
+/// file: App.svelte
+
+```
+
+...then add it to the menu with the `use:` directive:
+
+```svelte
+/// file: App.svelte
+
+```
+
+Let's take a look at the `trapFocus` function in `actions.js`. An action function is called with a `node` — the `
` in our case — when the node is mounted to the DOM, and can return an action object with a `destroy` method.
+
+First, we need to add an event listener that intercepts Tab key presses:
+
+```js
+/// file: actions.js
+focusable()[0]?.focus();
+
++++node.addEventListener('keydown', handleKeydown);+++
+```
+
+Second, we need to do some cleanup when the node is unmounted — removing the event listener, and restoring focus to where it was before the element mounted:
+
+```js
+/// file: actions.js
+focusable()[0]?.focus();
+
+node.addEventListener('keydown', handleKeydown);
+
++++return {
+ destroy() {
+ node.removeEventListener('keydown', handleKeydown);
+ previous?.focus();
+ }
+};+++
+```
+
+Now, when you open the menu, you can cycle through the options with the Tab key.
diff --git a/content/tutorial/02-advanced-svelte/04-actions/01-actions/app-a/src/lib/App.svelte b/content/tutorial/02-advanced-svelte/04-actions/01-actions/app-a/src/lib/App.svelte
new file mode 100644
index 000000000..ceacc6d80
--- /dev/null
+++ b/content/tutorial/02-advanced-svelte/04-actions/01-actions/app-a/src/lib/App.svelte
@@ -0,0 +1,127 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/content/tutorial/02-advanced-svelte/04-actions/01-actions/app-b/src/lib/actions.js b/content/tutorial/02-advanced-svelte/04-actions/01-actions/app-b/src/lib/actions.js
new file mode 100644
index 000000000..8d5feade1
--- /dev/null
+++ b/content/tutorial/02-advanced-svelte/04-actions/01-actions/app-b/src/lib/actions.js
@@ -0,0 +1,38 @@
+export function trapFocus(node) {
+ const previous = document.activeElement;
+
+ function focusable() {
+ return Array.from(node.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'));
+ }
+
+ function handleKeydown(event) {
+ if (event.key !== 'Tab') return;
+
+ const current = document.activeElement;
+
+ const elements = focusable();
+ const first = elements.at(0);
+ const last = elements.at(-1)
+
+ if (event.shiftKey && current === first) {
+ last.focus();
+ event.preventDefault();
+ }
+
+ if (!event.shiftKey && current === last) {
+ first.focus();
+ event.preventDefault();
+ }
+ }
+
+ focusable()[0]?.focus();
+
+ node.addEventListener('keydown', handleKeydown);
+
+ return {
+ destroy() {
+ node.removeEventListener('keydown', handleKeydown);
+ previous?.focus();
+ }
+ };
+}
diff --git a/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/README.md b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/README.md
new file mode 100644
index 000000000..7c765ef45
--- /dev/null
+++ b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/README.md
@@ -0,0 +1,49 @@
+---
+title: Adding parameters
+---
+
+Like transitions and animations, an action can take an argument, which the action function will be called with alongside the element it belongs to.
+
+In this exercise, we want to add a tooltip to the `` using the [`Tippy.js`](https://atomiks.github.io/tippyjs/) library. The action is already wired up with `use:tooltip`, but if you hover over the button (or focus it with the keyboard) the tooltip contains no content.
+
+First, the action needs to accept some options and pass them to Tippy:
+
+```js
+/// file: App.svelte
+function tooltip(node, +++options+++) {
+ const tooltip = tippy(node, +++options+++);
+
+ return {
+ destroy() {
+ tooltip.destroy();
+ }
+ };
+}
+```
+
+Then, we need to pass some options into the action:
+
+```svelte
+/// file: App.svelte
+
+ Hover me
+
+```
+
+The tooltip now works — almost. If we change the text in the ``, the tooltip will not reflect the new content. We can fix that by adding an `update` method to the returned object.
+
+```js
+/// file: App.svelte
+function tooltip(node, options) {
+ const tooltip = tippy(node, options);
+
+ return {
++++ update(options) {
+ tooltip.setProps(options);
+ },+++
+ destroy() {
+ tooltip.destroy();
+ }
+ };
+}
+```
diff --git a/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/.package-lock.json b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/.package-lock.json
new file mode 100644
index 000000000..c0d535373
--- /dev/null
+++ b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/.package-lock.json
@@ -0,0 +1,25 @@
+{
+ "name": "~TODO~",
+ "version": "0.0.1",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "node_modules/@popperjs/core": {
+ "version": "2.11.7",
+ "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.7.tgz",
+ "integrity": "sha512-Cr4OjIkipTtcXKjAsm8agyleBuDHvxzeBoa1v543lbv1YaIwQjESsVcmjiWiPEbC1FIeHOG/Op9kdCmAmiS3Kw==",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/popperjs"
+ }
+ },
+ "node_modules/tippy.js": {
+ "version": "6.3.7",
+ "resolved": "https://registry.npmjs.org/tippy.js/-/tippy.js-6.3.7.tgz",
+ "integrity": "sha512-E1d3oP2emgJ9dRQZdf3Kkn0qJgI6ZLpyS5z6ZkY1DF3kaQaBsGZsndEpHwx+eC+tYM41HaSNvNtLx8tU57FzTQ==",
+ "dependencies": {
+ "@popperjs/core": "^2.9.0"
+ }
+ }
+ }
+}
diff --git a/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/@popperjs/core/LICENSE.md b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/@popperjs/core/LICENSE.md
new file mode 100644
index 000000000..0370c4581
--- /dev/null
+++ b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/@popperjs/core/LICENSE.md
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+
+Copyright (c) 2019 Federico Zivolo
+
+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:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/@popperjs/core/README.md b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/@popperjs/core/README.md
new file mode 100644
index 000000000..53be7b9d8
--- /dev/null
+++ b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/@popperjs/core/README.md
@@ -0,0 +1,376 @@
+
+
+
+
+
+
+**Positioning tooltips and popovers is difficult. Popper is here to help!**
+
+Given an element, such as a button, and a tooltip element describing it, Popper
+will automatically put the tooltip in the right place near the button.
+
+It will position _any_ UI element that "pops out" from the flow of your document
+and floats near a target element. The most common example is a tooltip, but it
+also includes popovers, drop-downs, and more. All of these can be generically
+described as a "popper" element.
+
+## Demo
+
+[](https://popper.js.org)
+
+## Docs
+
+- [v2.x (latest)](https://popper.js.org/docs/v2/)
+- [v1.x](https://popper.js.org/docs/v1/)
+
+We've created a
+[Migration Guide](https://popper.js.org/docs/v2/migration-guide/) to help you
+migrate from Popper 1 to Popper 2.
+
+To contribute to the Popper website and documentation, please visit the
+[dedicated repository](https://github.com/popperjs/website).
+
+## Why not use pure CSS?
+
+- **Clipping and overflow issues**: Pure CSS poppers will not be prevented from
+ overflowing clipping boundaries, such as the viewport. It will get partially
+ cut off or overflows if it's near the edge since there is no dynamic
+ positioning logic. When using Popper, your popper will always be positioned in
+ the right place without needing manual adjustments.
+- **No flipping**: CSS poppers will not flip to a different placement to fit
+ better in view if necessary. While you can manually adjust for the main axis
+ overflow, this feature cannot be achieved via CSS alone. Popper automatically
+ flips the tooltip to make it fit in view as best as possible for the user.
+- **No virtual positioning**: CSS poppers cannot follow the mouse cursor or be
+ used as a context menu. Popper allows you to position your tooltip relative to
+ any coordinates you desire.
+- **Slower development cycle**: When pure CSS is used to position popper
+ elements, the lack of dynamic positioning means they must be carefully placed
+ to consider overflow on all screen sizes. In reusable component libraries,
+ this means a developer can't just add the component anywhere on the page,
+ because these issues need to be considered and adjusted for every time. With
+ Popper, you can place your elements anywhere and they will be positioned
+ correctly, without needing to consider different screen sizes, layouts, etc.
+ This massively speeds up development time because this work is automatically
+ offloaded to Popper.
+- **Lack of extensibility**: CSS poppers cannot be easily extended to fit any
+ arbitrary use case you may need to adjust for. Popper is built with
+ extensibility in mind.
+
+## Why Popper?
+
+With the CSS drawbacks out of the way, we now move on to Popper in the
+JavaScript space itself.
+
+Naive JavaScript tooltip implementations usually have the following problems:
+
+- **Scrolling containers**: They don't ensure the tooltip stays with the
+ reference element while scrolling when inside any number of scrolling
+ containers.
+- **DOM context**: They often require the tooltip move outside of its original
+ DOM context because they don't handle `offsetParent` contexts.
+- **Compatibility**: Popper handles an incredible number of edge cases regarding
+ different browsers and environments (mobile viewports, RTL, scrollbars enabled
+ or disabled, etc.). Popper is a popular and well-maintained library, so you
+ can be confident positioning will work for your users on any device.
+- **Configurability**: They often lack advanced configurability to suit any
+ possible use case.
+- **Size**: They are usually relatively large in size, or require an ancient
+ jQuery dependency.
+- **Performance**: They often have runtime performance issues and update the
+ tooltip position too slowly.
+
+**Popper solves all of these key problems in an elegant, performant manner.** It
+is a lightweight ~3 kB library that aims to provide a reliable and extensible
+positioning engine you can use to ensure all your popper elements are positioned
+in the right place.
+
+When you start writing your own popper implementation, you'll quickly run into
+all of the problems mentioned above. These widgets are incredibly common in our
+UIs; we've done the hard work figuring this out so you don't need to spend hours
+fixing and handling numerous edge cases that we already ran into while building
+the library!
+
+Popper is used in popular libraries like Bootstrap, Foundation, Material UI, and
+more. It's likely you've already used popper elements on the web positioned by
+Popper at some point in the past few years.
+
+Since we write UIs using powerful abstraction libraries such as React or Angular
+nowadays, you'll also be glad to know Popper can fully integrate with them and
+be a good citizen together with your other components. Check out `react-popper`
+for the official Popper wrapper for React.
+
+## Installation
+
+### 1. Package Manager
+
+```bash
+# With npm
+npm i @popperjs/core
+
+# With Yarn
+yarn add @popperjs/core
+```
+
+### 2. CDN
+
+```html
+
+
+
+
+
+```
+
+### 3. Direct Download?
+
+Managing dependencies by "directly downloading" them and placing them into your
+source code is not recommended for a variety of reasons, including missing out
+on feat/fix updates easily. Please use a versioning management system like a CDN
+or npm/Yarn.
+
+## Usage
+
+The most straightforward way to get started is to import Popper from the `unpkg`
+CDN, which includes all of its features. You can call the `Popper.createPopper`
+constructor to create new popper instances.
+
+Here is a complete example:
+
+```html
+
+Popper example
+
+
+
+I'm a button
+
I'm a tooltip
+
+
+
+```
+
+Visit the [tutorial](https://popper.js.org/docs/v2/tutorial/) for an example of
+how to build your own tooltip from scratch using Popper.
+
+### Module bundlers
+
+You can import the `createPopper` constructor from the fully-featured file:
+
+```js
+import { createPopper } from '@popperjs/core';
+
+const button = document.querySelector('#button');
+const tooltip = document.querySelector('#tooltip');
+
+// Pass the button, the tooltip, and some options, and Popper will do the
+// magic positioning for you:
+createPopper(button, tooltip, {
+ placement: 'right',
+});
+```
+
+All the modifiers listed in the docs menu will be enabled and "just work", so
+you don't need to think about setting Popper up. The size of Popper including
+all of its features is about 5 kB minzipped, but it may grow a bit in the
+future.
+
+#### Popper Lite (tree-shaking)
+
+If bundle size is important, you'll want to take advantage of tree-shaking. The
+library is built in a modular way to allow to import only the parts you really
+need.
+
+```js
+import { createPopperLite as createPopper } from '@popperjs/core';
+```
+
+The Lite version includes the most necessary modifiers that will compute the
+offsets of the popper, compute and add the positioning styles, and add event
+listeners. This is close in bundle size to pure CSS tooltip libraries, and
+behaves somewhat similarly.
+
+However, this does not include the features that makes Popper truly useful.
+
+The two most useful modifiers not included in Lite are `preventOverflow` and
+`flip`:
+
+```js
+import {
+ createPopperLite as createPopper,
+ preventOverflow,
+ flip,
+} from '@popperjs/core';
+
+const button = document.querySelector('#button');
+const tooltip = document.querySelector('#tooltip');
+
+createPopper(button, tooltip, {
+ modifiers: [preventOverflow, flip],
+});
+```
+
+As you make more poppers, you may be finding yourself needing other modifiers
+provided by the library.
+
+See [tree-shaking](https://popper.js.org/docs/v2/performance/#tree-shaking) for more
+information.
+
+## Distribution targets
+
+Popper is distributed in 3 different versions, in 3 different file formats.
+
+The 3 file formats are:
+
+- `esm` (works with `import` syntax — **recommended**)
+- `umd` (works with `
+
+```
+
+The core CSS comes bundled with the default unpkg import.
+
+## Usage
+
+For detailed usage information,
+[visit the docs](https://atomiks.github.io/tippyjs/v6/getting-started/).
+
+## Component Wrappers
+
+React: [@tippyjs/react](https://github.com/atomiks/tippyjs-react)
+
+## License
+
+MIT
diff --git a/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/dist/tippy.css b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/dist/tippy.css
new file mode 100644
index 000000000..e6ae635cb
--- /dev/null
+++ b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/dist/tippy.css
@@ -0,0 +1 @@
+.tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}
\ No newline at end of file
diff --git a/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/dist/tippy.esm.js b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/dist/tippy.esm.js
new file mode 100644
index 000000000..55346f578
--- /dev/null
+++ b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/dist/tippy.esm.js
@@ -0,0 +1,2486 @@
+/**!
+* tippy.js v6.3.7
+* (c) 2017-2021 atomiks
+* MIT License
+*/
+import { createPopper, applyStyles } from '@popperjs/core';
+
+var ROUND_ARROW = '';
+var BOX_CLASS = "tippy-box";
+var CONTENT_CLASS = "tippy-content";
+var BACKDROP_CLASS = "tippy-backdrop";
+var ARROW_CLASS = "tippy-arrow";
+var SVG_ARROW_CLASS = "tippy-svg-arrow";
+var TOUCH_OPTIONS = {
+ passive: true,
+ capture: true
+};
+var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO() {
+ return document.body;
+};
+
+function hasOwnProperty(obj, key) {
+ return {}.hasOwnProperty.call(obj, key);
+}
+function getValueAtIndexOrReturn(value, index, defaultValue) {
+ if (Array.isArray(value)) {
+ var v = value[index];
+ return v == null ? Array.isArray(defaultValue) ? defaultValue[index] : defaultValue : v;
+ }
+
+ return value;
+}
+function isType(value, type) {
+ var str = {}.toString.call(value);
+ return str.indexOf('[object') === 0 && str.indexOf(type + "]") > -1;
+}
+function invokeWithArgsOrReturn(value, args) {
+ return typeof value === 'function' ? value.apply(void 0, args) : value;
+}
+function debounce(fn, ms) {
+ // Avoid wrapping in `setTimeout` if ms is 0 anyway
+ if (ms === 0) {
+ return fn;
+ }
+
+ var timeout;
+ return function (arg) {
+ clearTimeout(timeout);
+ timeout = setTimeout(function () {
+ fn(arg);
+ }, ms);
+ };
+}
+function removeProperties(obj, keys) {
+ var clone = Object.assign({}, obj);
+ keys.forEach(function (key) {
+ delete clone[key];
+ });
+ return clone;
+}
+function splitBySpaces(value) {
+ return value.split(/\s+/).filter(Boolean);
+}
+function normalizeToArray(value) {
+ return [].concat(value);
+}
+function pushIfUnique(arr, value) {
+ if (arr.indexOf(value) === -1) {
+ arr.push(value);
+ }
+}
+function unique(arr) {
+ return arr.filter(function (item, index) {
+ return arr.indexOf(item) === index;
+ });
+}
+function getBasePlacement(placement) {
+ return placement.split('-')[0];
+}
+function arrayFrom(value) {
+ return [].slice.call(value);
+}
+function removeUndefinedProps(obj) {
+ return Object.keys(obj).reduce(function (acc, key) {
+ if (obj[key] !== undefined) {
+ acc[key] = obj[key];
+ }
+
+ return acc;
+ }, {});
+}
+
+function div() {
+ return document.createElement('div');
+}
+function isElement(value) {
+ return ['Element', 'Fragment'].some(function (type) {
+ return isType(value, type);
+ });
+}
+function isNodeList(value) {
+ return isType(value, 'NodeList');
+}
+function isMouseEvent(value) {
+ return isType(value, 'MouseEvent');
+}
+function isReferenceElement(value) {
+ return !!(value && value._tippy && value._tippy.reference === value);
+}
+function getArrayOfElements(value) {
+ if (isElement(value)) {
+ return [value];
+ }
+
+ if (isNodeList(value)) {
+ return arrayFrom(value);
+ }
+
+ if (Array.isArray(value)) {
+ return value;
+ }
+
+ return arrayFrom(document.querySelectorAll(value));
+}
+function setTransitionDuration(els, value) {
+ els.forEach(function (el) {
+ if (el) {
+ el.style.transitionDuration = value + "ms";
+ }
+ });
+}
+function setVisibilityState(els, state) {
+ els.forEach(function (el) {
+ if (el) {
+ el.setAttribute('data-state', state);
+ }
+ });
+}
+function getOwnerDocument(elementOrElements) {
+ var _element$ownerDocumen;
+
+ var _normalizeToArray = normalizeToArray(elementOrElements),
+ element = _normalizeToArray[0]; // Elements created via a have an ownerDocument with no reference to the body
+
+
+ return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
+}
+function isCursorOutsideInteractiveBorder(popperTreeData, event) {
+ var clientX = event.clientX,
+ clientY = event.clientY;
+ return popperTreeData.every(function (_ref) {
+ var popperRect = _ref.popperRect,
+ popperState = _ref.popperState,
+ props = _ref.props;
+ var interactiveBorder = props.interactiveBorder;
+ var basePlacement = getBasePlacement(popperState.placement);
+ var offsetData = popperState.modifiersData.offset;
+
+ if (!offsetData) {
+ return true;
+ }
+
+ var topDistance = basePlacement === 'bottom' ? offsetData.top.y : 0;
+ var bottomDistance = basePlacement === 'top' ? offsetData.bottom.y : 0;
+ var leftDistance = basePlacement === 'right' ? offsetData.left.x : 0;
+ var rightDistance = basePlacement === 'left' ? offsetData.right.x : 0;
+ var exceedsTop = popperRect.top - clientY + topDistance > interactiveBorder;
+ var exceedsBottom = clientY - popperRect.bottom - bottomDistance > interactiveBorder;
+ var exceedsLeft = popperRect.left - clientX + leftDistance > interactiveBorder;
+ var exceedsRight = clientX - popperRect.right - rightDistance > interactiveBorder;
+ return exceedsTop || exceedsBottom || exceedsLeft || exceedsRight;
+ });
+}
+function updateTransitionEndListener(box, action, listener) {
+ var method = action + "EventListener"; // some browsers apparently support `transition` (unprefixed) but only fire
+ // `webkitTransitionEnd`...
+
+ ['transitionend', 'webkitTransitionEnd'].forEach(function (event) {
+ box[method](event, listener);
+ });
+}
+/**
+ * Compared to xxx.contains, this function works for dom structures with shadow
+ * dom
+ */
+
+function actualContains(parent, child) {
+ var target = child;
+
+ while (target) {
+ var _target$getRootNode;
+
+ if (parent.contains(target)) {
+ return true;
+ }
+
+ target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
+ }
+
+ return false;
+}
+
+var currentInput = {
+ isTouch: false
+};
+var lastMouseMoveTime = 0;
+/**
+ * When a `touchstart` event is fired, it's assumed the user is using touch
+ * input. We'll bind a `mousemove` event listener to listen for mouse input in
+ * the future. This way, the `isTouch` property is fully dynamic and will handle
+ * hybrid devices that use a mix of touch + mouse input.
+ */
+
+function onDocumentTouchStart() {
+ if (currentInput.isTouch) {
+ return;
+ }
+
+ currentInput.isTouch = true;
+
+ if (window.performance) {
+ document.addEventListener('mousemove', onDocumentMouseMove);
+ }
+}
+/**
+ * When two `mousemove` event are fired consecutively within 20ms, it's assumed
+ * the user is using mouse input again. `mousemove` can fire on touch devices as
+ * well, but very rarely that quickly.
+ */
+
+function onDocumentMouseMove() {
+ var now = performance.now();
+
+ if (now - lastMouseMoveTime < 20) {
+ currentInput.isTouch = false;
+ document.removeEventListener('mousemove', onDocumentMouseMove);
+ }
+
+ lastMouseMoveTime = now;
+}
+/**
+ * When an element is in focus and has a tippy, leaving the tab/window and
+ * returning causes it to show again. For mouse users this is unexpected, but
+ * for keyboard use it makes sense.
+ * TODO: find a better technique to solve this problem
+ */
+
+function onWindowBlur() {
+ var activeElement = document.activeElement;
+
+ if (isReferenceElement(activeElement)) {
+ var instance = activeElement._tippy;
+
+ if (activeElement.blur && !instance.state.isVisible) {
+ activeElement.blur();
+ }
+ }
+}
+function bindGlobalEventListeners() {
+ document.addEventListener('touchstart', onDocumentTouchStart, TOUCH_OPTIONS);
+ window.addEventListener('blur', onWindowBlur);
+}
+
+var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
+var isIE11 = isBrowser ? // @ts-ignore
+!!window.msCrypto : false;
+
+function createMemoryLeakWarning(method) {
+ var txt = method === 'destroy' ? 'n already-' : ' ';
+ return [method + "() was called on a" + txt + "destroyed instance. This is a no-op but", 'indicates a potential memory leak.'].join(' ');
+}
+function clean(value) {
+ var spacesAndTabs = /[ \t]{2,}/g;
+ var lineStartWithSpaces = /^[ \t]*/gm;
+ return value.replace(spacesAndTabs, ' ').replace(lineStartWithSpaces, '').trim();
+}
+
+function getDevMessage(message) {
+ return clean("\n %ctippy.js\n\n %c" + clean(message) + "\n\n %c\uD83D\uDC77\u200D This is a development-only message. It will be removed in production.\n ");
+}
+
+function getFormattedMessage(message) {
+ return [getDevMessage(message), // title
+ 'color: #00C584; font-size: 1.3em; font-weight: bold;', // message
+ 'line-height: 1.5', // footer
+ 'color: #a6a095;'];
+} // Assume warnings and errors never have the same message
+
+var visitedMessages;
+
+if (process.env.NODE_ENV !== "production") {
+ resetVisitedMessages();
+}
+
+function resetVisitedMessages() {
+ visitedMessages = new Set();
+}
+function warnWhen(condition, message) {
+ if (condition && !visitedMessages.has(message)) {
+ var _console;
+
+ visitedMessages.add(message);
+
+ (_console = console).warn.apply(_console, getFormattedMessage(message));
+ }
+}
+function errorWhen(condition, message) {
+ if (condition && !visitedMessages.has(message)) {
+ var _console2;
+
+ visitedMessages.add(message);
+
+ (_console2 = console).error.apply(_console2, getFormattedMessage(message));
+ }
+}
+function validateTargets(targets) {
+ var didPassFalsyValue = !targets;
+ var didPassPlainObject = Object.prototype.toString.call(targets) === '[object Object]' && !targets.addEventListener;
+ errorWhen(didPassFalsyValue, ['tippy() was passed', '`' + String(targets) + '`', 'as its targets (first) argument. Valid types are: String, Element,', 'Element[], or NodeList.'].join(' '));
+ errorWhen(didPassPlainObject, ['tippy() was passed a plain object which is not supported as an argument', 'for virtual positioning. Use props.getReferenceClientRect instead.'].join(' '));
+}
+
+var pluginProps = {
+ animateFill: false,
+ followCursor: false,
+ inlinePositioning: false,
+ sticky: false
+};
+var renderProps = {
+ allowHTML: false,
+ animation: 'fade',
+ arrow: true,
+ content: '',
+ inertia: false,
+ maxWidth: 350,
+ role: 'tooltip',
+ theme: '',
+ zIndex: 9999
+};
+var defaultProps = Object.assign({
+ appendTo: TIPPY_DEFAULT_APPEND_TO,
+ aria: {
+ content: 'auto',
+ expanded: 'auto'
+ },
+ delay: 0,
+ duration: [300, 250],
+ getReferenceClientRect: null,
+ hideOnClick: true,
+ ignoreAttributes: false,
+ interactive: false,
+ interactiveBorder: 2,
+ interactiveDebounce: 0,
+ moveTransition: '',
+ offset: [0, 10],
+ onAfterUpdate: function onAfterUpdate() {},
+ onBeforeUpdate: function onBeforeUpdate() {},
+ onCreate: function onCreate() {},
+ onDestroy: function onDestroy() {},
+ onHidden: function onHidden() {},
+ onHide: function onHide() {},
+ onMount: function onMount() {},
+ onShow: function onShow() {},
+ onShown: function onShown() {},
+ onTrigger: function onTrigger() {},
+ onUntrigger: function onUntrigger() {},
+ onClickOutside: function onClickOutside() {},
+ placement: 'top',
+ plugins: [],
+ popperOptions: {},
+ render: null,
+ showOnCreate: false,
+ touch: true,
+ trigger: 'mouseenter focus',
+ triggerTarget: null
+}, pluginProps, renderProps);
+var defaultKeys = Object.keys(defaultProps);
+var setDefaultProps = function setDefaultProps(partialProps) {
+ /* istanbul ignore else */
+ if (process.env.NODE_ENV !== "production") {
+ validateProps(partialProps, []);
+ }
+
+ var keys = Object.keys(partialProps);
+ keys.forEach(function (key) {
+ defaultProps[key] = partialProps[key];
+ });
+};
+function getExtendedPassedProps(passedProps) {
+ var plugins = passedProps.plugins || [];
+ var pluginProps = plugins.reduce(function (acc, plugin) {
+ var name = plugin.name,
+ defaultValue = plugin.defaultValue;
+
+ if (name) {
+ var _name;
+
+ acc[name] = passedProps[name] !== undefined ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
+ }
+
+ return acc;
+ }, {});
+ return Object.assign({}, passedProps, pluginProps);
+}
+function getDataAttributeProps(reference, plugins) {
+ var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
+ plugins: plugins
+ }))) : defaultKeys;
+ var props = propKeys.reduce(function (acc, key) {
+ var valueAsString = (reference.getAttribute("data-tippy-" + key) || '').trim();
+
+ if (!valueAsString) {
+ return acc;
+ }
+
+ if (key === 'content') {
+ acc[key] = valueAsString;
+ } else {
+ try {
+ acc[key] = JSON.parse(valueAsString);
+ } catch (e) {
+ acc[key] = valueAsString;
+ }
+ }
+
+ return acc;
+ }, {});
+ return props;
+}
+function evaluateProps(reference, props) {
+ var out = Object.assign({}, props, {
+ content: invokeWithArgsOrReturn(props.content, [reference])
+ }, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
+ out.aria = Object.assign({}, defaultProps.aria, out.aria);
+ out.aria = {
+ expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
+ content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
+ };
+ return out;
+}
+function validateProps(partialProps, plugins) {
+ if (partialProps === void 0) {
+ partialProps = {};
+ }
+
+ if (plugins === void 0) {
+ plugins = [];
+ }
+
+ var keys = Object.keys(partialProps);
+ keys.forEach(function (prop) {
+ var nonPluginProps = removeProperties(defaultProps, Object.keys(pluginProps));
+ var didPassUnknownProp = !hasOwnProperty(nonPluginProps, prop); // Check if the prop exists in `plugins`
+
+ if (didPassUnknownProp) {
+ didPassUnknownProp = plugins.filter(function (plugin) {
+ return plugin.name === prop;
+ }).length === 0;
+ }
+
+ warnWhen(didPassUnknownProp, ["`" + prop + "`", "is not a valid prop. You may have spelled it incorrectly, or if it's", 'a plugin, forgot to pass it in an array as props.plugins.', '\n\n', 'All props: https://atomiks.github.io/tippyjs/v6/all-props/\n', 'Plugins: https://atomiks.github.io/tippyjs/v6/plugins/'].join(' '));
+ });
+}
+
+var innerHTML = function innerHTML() {
+ return 'innerHTML';
+};
+
+function dangerouslySetInnerHTML(element, html) {
+ element[innerHTML()] = html;
+}
+
+function createArrowElement(value) {
+ var arrow = div();
+
+ if (value === true) {
+ arrow.className = ARROW_CLASS;
+ } else {
+ arrow.className = SVG_ARROW_CLASS;
+
+ if (isElement(value)) {
+ arrow.appendChild(value);
+ } else {
+ dangerouslySetInnerHTML(arrow, value);
+ }
+ }
+
+ return arrow;
+}
+
+function setContent(content, props) {
+ if (isElement(props.content)) {
+ dangerouslySetInnerHTML(content, '');
+ content.appendChild(props.content);
+ } else if (typeof props.content !== 'function') {
+ if (props.allowHTML) {
+ dangerouslySetInnerHTML(content, props.content);
+ } else {
+ content.textContent = props.content;
+ }
+ }
+}
+function getChildren(popper) {
+ var box = popper.firstElementChild;
+ var boxChildren = arrayFrom(box.children);
+ return {
+ box: box,
+ content: boxChildren.find(function (node) {
+ return node.classList.contains(CONTENT_CLASS);
+ }),
+ arrow: boxChildren.find(function (node) {
+ return node.classList.contains(ARROW_CLASS) || node.classList.contains(SVG_ARROW_CLASS);
+ }),
+ backdrop: boxChildren.find(function (node) {
+ return node.classList.contains(BACKDROP_CLASS);
+ })
+ };
+}
+function render(instance) {
+ var popper = div();
+ var box = div();
+ box.className = BOX_CLASS;
+ box.setAttribute('data-state', 'hidden');
+ box.setAttribute('tabindex', '-1');
+ var content = div();
+ content.className = CONTENT_CLASS;
+ content.setAttribute('data-state', 'hidden');
+ setContent(content, instance.props);
+ popper.appendChild(box);
+ box.appendChild(content);
+ onUpdate(instance.props, instance.props);
+
+ function onUpdate(prevProps, nextProps) {
+ var _getChildren = getChildren(popper),
+ box = _getChildren.box,
+ content = _getChildren.content,
+ arrow = _getChildren.arrow;
+
+ if (nextProps.theme) {
+ box.setAttribute('data-theme', nextProps.theme);
+ } else {
+ box.removeAttribute('data-theme');
+ }
+
+ if (typeof nextProps.animation === 'string') {
+ box.setAttribute('data-animation', nextProps.animation);
+ } else {
+ box.removeAttribute('data-animation');
+ }
+
+ if (nextProps.inertia) {
+ box.setAttribute('data-inertia', '');
+ } else {
+ box.removeAttribute('data-inertia');
+ }
+
+ box.style.maxWidth = typeof nextProps.maxWidth === 'number' ? nextProps.maxWidth + "px" : nextProps.maxWidth;
+
+ if (nextProps.role) {
+ box.setAttribute('role', nextProps.role);
+ } else {
+ box.removeAttribute('role');
+ }
+
+ if (prevProps.content !== nextProps.content || prevProps.allowHTML !== nextProps.allowHTML) {
+ setContent(content, instance.props);
+ }
+
+ if (nextProps.arrow) {
+ if (!arrow) {
+ box.appendChild(createArrowElement(nextProps.arrow));
+ } else if (prevProps.arrow !== nextProps.arrow) {
+ box.removeChild(arrow);
+ box.appendChild(createArrowElement(nextProps.arrow));
+ }
+ } else if (arrow) {
+ box.removeChild(arrow);
+ }
+ }
+
+ return {
+ popper: popper,
+ onUpdate: onUpdate
+ };
+} // Runtime check to identify if the render function is the default one; this
+// way we can apply default CSS transitions logic and it can be tree-shaken away
+
+render.$$tippy = true;
+
+var idCounter = 1;
+var mouseMoveListeners = []; // Used by `hideAll()`
+
+var mountedInstances = [];
+function createTippy(reference, passedProps) {
+ var props = evaluateProps(reference, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
+ // 🔒 Private members
+ // ===========================================================================
+
+ var showTimeout;
+ var hideTimeout;
+ var scheduleHideAnimationFrame;
+ var isVisibleFromClick = false;
+ var didHideDueToDocumentMouseDown = false;
+ var didTouchMove = false;
+ var ignoreOnFirstUpdate = false;
+ var lastTriggerEvent;
+ var currentTransitionEndListener;
+ var onFirstUpdate;
+ var listeners = [];
+ var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);
+ var currentTarget; // ===========================================================================
+ // 🔑 Public members
+ // ===========================================================================
+
+ var id = idCounter++;
+ var popperInstance = null;
+ var plugins = unique(props.plugins);
+ var state = {
+ // Is the instance currently enabled?
+ isEnabled: true,
+ // Is the tippy currently showing and not transitioning out?
+ isVisible: false,
+ // Has the instance been destroyed?
+ isDestroyed: false,
+ // Is the tippy currently mounted to the DOM?
+ isMounted: false,
+ // Has the tippy finished transitioning in?
+ isShown: false
+ };
+ var instance = {
+ // properties
+ id: id,
+ reference: reference,
+ popper: div(),
+ popperInstance: popperInstance,
+ props: props,
+ state: state,
+ plugins: plugins,
+ // methods
+ clearDelayTimeouts: clearDelayTimeouts,
+ setProps: setProps,
+ setContent: setContent,
+ show: show,
+ hide: hide,
+ hideWithInteractivity: hideWithInteractivity,
+ enable: enable,
+ disable: disable,
+ unmount: unmount,
+ destroy: destroy
+ }; // TODO: Investigate why this early return causes a TDZ error in the tests —
+ // it doesn't seem to happen in the browser
+
+ /* istanbul ignore if */
+
+ if (!props.render) {
+ if (process.env.NODE_ENV !== "production") {
+ errorWhen(true, 'render() function has not been supplied.');
+ }
+
+ return instance;
+ } // ===========================================================================
+ // Initial mutations
+ // ===========================================================================
+
+
+ var _props$render = props.render(instance),
+ popper = _props$render.popper,
+ onUpdate = _props$render.onUpdate;
+
+ popper.setAttribute('data-tippy-root', '');
+ popper.id = "tippy-" + instance.id;
+ instance.popper = popper;
+ reference._tippy = instance;
+ popper._tippy = instance;
+ var pluginsHooks = plugins.map(function (plugin) {
+ return plugin.fn(instance);
+ });
+ var hasAriaExpanded = reference.hasAttribute('aria-expanded');
+ addListeners();
+ handleAriaExpandedAttribute();
+ handleStyles();
+ invokeHook('onCreate', [instance]);
+
+ if (props.showOnCreate) {
+ scheduleShow();
+ } // Prevent a tippy with a delay from hiding if the cursor left then returned
+ // before it started hiding
+
+
+ popper.addEventListener('mouseenter', function () {
+ if (instance.props.interactive && instance.state.isVisible) {
+ instance.clearDelayTimeouts();
+ }
+ });
+ popper.addEventListener('mouseleave', function () {
+ if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
+ getDocument().addEventListener('mousemove', debouncedOnMouseMove);
+ }
+ });
+ return instance; // ===========================================================================
+ // 🔒 Private methods
+ // ===========================================================================
+
+ function getNormalizedTouchSettings() {
+ var touch = instance.props.touch;
+ return Array.isArray(touch) ? touch : [touch, 0];
+ }
+
+ function getIsCustomTouchBehavior() {
+ return getNormalizedTouchSettings()[0] === 'hold';
+ }
+
+ function getIsDefaultRenderFn() {
+ var _instance$props$rende;
+
+ // @ts-ignore
+ return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
+ }
+
+ function getCurrentTarget() {
+ return currentTarget || reference;
+ }
+
+ function getDocument() {
+ var parent = getCurrentTarget().parentNode;
+ return parent ? getOwnerDocument(parent) : document;
+ }
+
+ function getDefaultTemplateChildren() {
+ return getChildren(popper);
+ }
+
+ function getDelay(isShow) {
+ // For touch or keyboard input, force `0` delay for UX reasons
+ // Also if the instance is mounted but not visible (transitioning out),
+ // ignore delay
+ if (instance.state.isMounted && !instance.state.isVisible || currentInput.isTouch || lastTriggerEvent && lastTriggerEvent.type === 'focus') {
+ return 0;
+ }
+
+ return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
+ }
+
+ function handleStyles(fromHide) {
+ if (fromHide === void 0) {
+ fromHide = false;
+ }
+
+ popper.style.pointerEvents = instance.props.interactive && !fromHide ? '' : 'none';
+ popper.style.zIndex = "" + instance.props.zIndex;
+ }
+
+ function invokeHook(hook, args, shouldInvokePropsHook) {
+ if (shouldInvokePropsHook === void 0) {
+ shouldInvokePropsHook = true;
+ }
+
+ pluginsHooks.forEach(function (pluginHooks) {
+ if (pluginHooks[hook]) {
+ pluginHooks[hook].apply(pluginHooks, args);
+ }
+ });
+
+ if (shouldInvokePropsHook) {
+ var _instance$props;
+
+ (_instance$props = instance.props)[hook].apply(_instance$props, args);
+ }
+ }
+
+ function handleAriaContentAttribute() {
+ var aria = instance.props.aria;
+
+ if (!aria.content) {
+ return;
+ }
+
+ var attr = "aria-" + aria.content;
+ var id = popper.id;
+ var nodes = normalizeToArray(instance.props.triggerTarget || reference);
+ nodes.forEach(function (node) {
+ var currentValue = node.getAttribute(attr);
+
+ if (instance.state.isVisible) {
+ node.setAttribute(attr, currentValue ? currentValue + " " + id : id);
+ } else {
+ var nextValue = currentValue && currentValue.replace(id, '').trim();
+
+ if (nextValue) {
+ node.setAttribute(attr, nextValue);
+ } else {
+ node.removeAttribute(attr);
+ }
+ }
+ });
+ }
+
+ function handleAriaExpandedAttribute() {
+ if (hasAriaExpanded || !instance.props.aria.expanded) {
+ return;
+ }
+
+ var nodes = normalizeToArray(instance.props.triggerTarget || reference);
+ nodes.forEach(function (node) {
+ if (instance.props.interactive) {
+ node.setAttribute('aria-expanded', instance.state.isVisible && node === getCurrentTarget() ? 'true' : 'false');
+ } else {
+ node.removeAttribute('aria-expanded');
+ }
+ });
+ }
+
+ function cleanupInteractiveMouseListeners() {
+ getDocument().removeEventListener('mousemove', debouncedOnMouseMove);
+ mouseMoveListeners = mouseMoveListeners.filter(function (listener) {
+ return listener !== debouncedOnMouseMove;
+ });
+ }
+
+ function onDocumentPress(event) {
+ // Moved finger to scroll instead of an intentional tap outside
+ if (currentInput.isTouch) {
+ if (didTouchMove || event.type === 'mousedown') {
+ return;
+ }
+ }
+
+ var actualTarget = event.composedPath && event.composedPath()[0] || event.target; // Clicked on interactive popper
+
+ if (instance.props.interactive && actualContains(popper, actualTarget)) {
+ return;
+ } // Clicked on the event listeners target
+
+
+ if (normalizeToArray(instance.props.triggerTarget || reference).some(function (el) {
+ return actualContains(el, actualTarget);
+ })) {
+ if (currentInput.isTouch) {
+ return;
+ }
+
+ if (instance.state.isVisible && instance.props.trigger.indexOf('click') >= 0) {
+ return;
+ }
+ } else {
+ invokeHook('onClickOutside', [instance, event]);
+ }
+
+ if (instance.props.hideOnClick === true) {
+ instance.clearDelayTimeouts();
+ instance.hide(); // `mousedown` event is fired right before `focus` if pressing the
+ // currentTarget. This lets a tippy with `focus` trigger know that it
+ // should not show
+
+ didHideDueToDocumentMouseDown = true;
+ setTimeout(function () {
+ didHideDueToDocumentMouseDown = false;
+ }); // The listener gets added in `scheduleShow()`, but this may be hiding it
+ // before it shows, and hide()'s early bail-out behavior can prevent it
+ // from being cleaned up
+
+ if (!instance.state.isMounted) {
+ removeDocumentPress();
+ }
+ }
+ }
+
+ function onTouchMove() {
+ didTouchMove = true;
+ }
+
+ function onTouchStart() {
+ didTouchMove = false;
+ }
+
+ function addDocumentPress() {
+ var doc = getDocument();
+ doc.addEventListener('mousedown', onDocumentPress, true);
+ doc.addEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
+ doc.addEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
+ doc.addEventListener('touchmove', onTouchMove, TOUCH_OPTIONS);
+ }
+
+ function removeDocumentPress() {
+ var doc = getDocument();
+ doc.removeEventListener('mousedown', onDocumentPress, true);
+ doc.removeEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
+ doc.removeEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
+ doc.removeEventListener('touchmove', onTouchMove, TOUCH_OPTIONS);
+ }
+
+ function onTransitionedOut(duration, callback) {
+ onTransitionEnd(duration, function () {
+ if (!instance.state.isVisible && popper.parentNode && popper.parentNode.contains(popper)) {
+ callback();
+ }
+ });
+ }
+
+ function onTransitionedIn(duration, callback) {
+ onTransitionEnd(duration, callback);
+ }
+
+ function onTransitionEnd(duration, callback) {
+ var box = getDefaultTemplateChildren().box;
+
+ function listener(event) {
+ if (event.target === box) {
+ updateTransitionEndListener(box, 'remove', listener);
+ callback();
+ }
+ } // Make callback synchronous if duration is 0
+ // `transitionend` won't fire otherwise
+
+
+ if (duration === 0) {
+ return callback();
+ }
+
+ updateTransitionEndListener(box, 'remove', currentTransitionEndListener);
+ updateTransitionEndListener(box, 'add', listener);
+ currentTransitionEndListener = listener;
+ }
+
+ function on(eventType, handler, options) {
+ if (options === void 0) {
+ options = false;
+ }
+
+ var nodes = normalizeToArray(instance.props.triggerTarget || reference);
+ nodes.forEach(function (node) {
+ node.addEventListener(eventType, handler, options);
+ listeners.push({
+ node: node,
+ eventType: eventType,
+ handler: handler,
+ options: options
+ });
+ });
+ }
+
+ function addListeners() {
+ if (getIsCustomTouchBehavior()) {
+ on('touchstart', onTrigger, {
+ passive: true
+ });
+ on('touchend', onMouseLeave, {
+ passive: true
+ });
+ }
+
+ splitBySpaces(instance.props.trigger).forEach(function (eventType) {
+ if (eventType === 'manual') {
+ return;
+ }
+
+ on(eventType, onTrigger);
+
+ switch (eventType) {
+ case 'mouseenter':
+ on('mouseleave', onMouseLeave);
+ break;
+
+ case 'focus':
+ on(isIE11 ? 'focusout' : 'blur', onBlurOrFocusOut);
+ break;
+
+ case 'focusin':
+ on('focusout', onBlurOrFocusOut);
+ break;
+ }
+ });
+ }
+
+ function removeListeners() {
+ listeners.forEach(function (_ref) {
+ var node = _ref.node,
+ eventType = _ref.eventType,
+ handler = _ref.handler,
+ options = _ref.options;
+ node.removeEventListener(eventType, handler, options);
+ });
+ listeners = [];
+ }
+
+ function onTrigger(event) {
+ var _lastTriggerEvent;
+
+ var shouldScheduleClickHide = false;
+
+ if (!instance.state.isEnabled || isEventListenerStopped(event) || didHideDueToDocumentMouseDown) {
+ return;
+ }
+
+ var wasFocused = ((_lastTriggerEvent = lastTriggerEvent) == null ? void 0 : _lastTriggerEvent.type) === 'focus';
+ lastTriggerEvent = event;
+ currentTarget = event.currentTarget;
+ handleAriaExpandedAttribute();
+
+ if (!instance.state.isVisible && isMouseEvent(event)) {
+ // If scrolling, `mouseenter` events can be fired if the cursor lands
+ // over a new target, but `mousemove` events don't get fired. This
+ // causes interactive tooltips to get stuck open until the cursor is
+ // moved
+ mouseMoveListeners.forEach(function (listener) {
+ return listener(event);
+ });
+ } // Toggle show/hide when clicking click-triggered tooltips
+
+
+ if (event.type === 'click' && (instance.props.trigger.indexOf('mouseenter') < 0 || isVisibleFromClick) && instance.props.hideOnClick !== false && instance.state.isVisible) {
+ shouldScheduleClickHide = true;
+ } else {
+ scheduleShow(event);
+ }
+
+ if (event.type === 'click') {
+ isVisibleFromClick = !shouldScheduleClickHide;
+ }
+
+ if (shouldScheduleClickHide && !wasFocused) {
+ scheduleHide(event);
+ }
+ }
+
+ function onMouseMove(event) {
+ var target = event.target;
+ var isCursorOverReferenceOrPopper = getCurrentTarget().contains(target) || popper.contains(target);
+
+ if (event.type === 'mousemove' && isCursorOverReferenceOrPopper) {
+ return;
+ }
+
+ var popperTreeData = getNestedPopperTree().concat(popper).map(function (popper) {
+ var _instance$popperInsta;
+
+ var instance = popper._tippy;
+ var state = (_instance$popperInsta = instance.popperInstance) == null ? void 0 : _instance$popperInsta.state;
+
+ if (state) {
+ return {
+ popperRect: popper.getBoundingClientRect(),
+ popperState: state,
+ props: props
+ };
+ }
+
+ return null;
+ }).filter(Boolean);
+
+ if (isCursorOutsideInteractiveBorder(popperTreeData, event)) {
+ cleanupInteractiveMouseListeners();
+ scheduleHide(event);
+ }
+ }
+
+ function onMouseLeave(event) {
+ var shouldBail = isEventListenerStopped(event) || instance.props.trigger.indexOf('click') >= 0 && isVisibleFromClick;
+
+ if (shouldBail) {
+ return;
+ }
+
+ if (instance.props.interactive) {
+ instance.hideWithInteractivity(event);
+ return;
+ }
+
+ scheduleHide(event);
+ }
+
+ function onBlurOrFocusOut(event) {
+ if (instance.props.trigger.indexOf('focusin') < 0 && event.target !== getCurrentTarget()) {
+ return;
+ } // If focus was moved to within the popper
+
+
+ if (instance.props.interactive && event.relatedTarget && popper.contains(event.relatedTarget)) {
+ return;
+ }
+
+ scheduleHide(event);
+ }
+
+ function isEventListenerStopped(event) {
+ return currentInput.isTouch ? getIsCustomTouchBehavior() !== event.type.indexOf('touch') >= 0 : false;
+ }
+
+ function createPopperInstance() {
+ destroyPopperInstance();
+ var _instance$props2 = instance.props,
+ popperOptions = _instance$props2.popperOptions,
+ placement = _instance$props2.placement,
+ offset = _instance$props2.offset,
+ getReferenceClientRect = _instance$props2.getReferenceClientRect,
+ moveTransition = _instance$props2.moveTransition;
+ var arrow = getIsDefaultRenderFn() ? getChildren(popper).arrow : null;
+ var computedReference = getReferenceClientRect ? {
+ getBoundingClientRect: getReferenceClientRect,
+ contextElement: getReferenceClientRect.contextElement || getCurrentTarget()
+ } : reference;
+ var tippyModifier = {
+ name: '$$tippy',
+ enabled: true,
+ phase: 'beforeWrite',
+ requires: ['computeStyles'],
+ fn: function fn(_ref2) {
+ var state = _ref2.state;
+
+ if (getIsDefaultRenderFn()) {
+ var _getDefaultTemplateCh = getDefaultTemplateChildren(),
+ box = _getDefaultTemplateCh.box;
+
+ ['placement', 'reference-hidden', 'escaped'].forEach(function (attr) {
+ if (attr === 'placement') {
+ box.setAttribute('data-placement', state.placement);
+ } else {
+ if (state.attributes.popper["data-popper-" + attr]) {
+ box.setAttribute("data-" + attr, '');
+ } else {
+ box.removeAttribute("data-" + attr);
+ }
+ }
+ });
+ state.attributes.popper = {};
+ }
+ }
+ };
+ var modifiers = [{
+ name: 'offset',
+ options: {
+ offset: offset
+ }
+ }, {
+ name: 'preventOverflow',
+ options: {
+ padding: {
+ top: 2,
+ bottom: 2,
+ left: 5,
+ right: 5
+ }
+ }
+ }, {
+ name: 'flip',
+ options: {
+ padding: 5
+ }
+ }, {
+ name: 'computeStyles',
+ options: {
+ adaptive: !moveTransition
+ }
+ }, tippyModifier];
+
+ if (getIsDefaultRenderFn() && arrow) {
+ modifiers.push({
+ name: 'arrow',
+ options: {
+ element: arrow,
+ padding: 3
+ }
+ });
+ }
+
+ modifiers.push.apply(modifiers, (popperOptions == null ? void 0 : popperOptions.modifiers) || []);
+ instance.popperInstance = createPopper(computedReference, popper, Object.assign({}, popperOptions, {
+ placement: placement,
+ onFirstUpdate: onFirstUpdate,
+ modifiers: modifiers
+ }));
+ }
+
+ function destroyPopperInstance() {
+ if (instance.popperInstance) {
+ instance.popperInstance.destroy();
+ instance.popperInstance = null;
+ }
+ }
+
+ function mount() {
+ var appendTo = instance.props.appendTo;
+ var parentNode; // By default, we'll append the popper to the triggerTargets's parentNode so
+ // it's directly after the reference element so the elements inside the
+ // tippy can be tabbed to
+ // If there are clipping issues, the user can specify a different appendTo
+ // and ensure focus management is handled correctly manually
+
+ var node = getCurrentTarget();
+
+ if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === 'parent') {
+ parentNode = node.parentNode;
+ } else {
+ parentNode = invokeWithArgsOrReturn(appendTo, [node]);
+ } // The popper element needs to exist on the DOM before its position can be
+ // updated as Popper needs to read its dimensions
+
+
+ if (!parentNode.contains(popper)) {
+ parentNode.appendChild(popper);
+ }
+
+ instance.state.isMounted = true;
+ createPopperInstance();
+ /* istanbul ignore else */
+
+ if (process.env.NODE_ENV !== "production") {
+ // Accessibility check
+ warnWhen(instance.props.interactive && appendTo === defaultProps.appendTo && node.nextElementSibling !== popper, ['Interactive tippy element may not be accessible via keyboard', 'navigation because it is not directly after the reference element', 'in the DOM source order.', '\n\n', 'Using a wrapper
or tag around the reference element', 'solves this by creating a new parentNode context.', '\n\n', 'Specifying `appendTo: document.body` silences this warning, but it', 'assumes you are using a focus management solution to handle', 'keyboard navigation.', '\n\n', 'See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity'].join(' '));
+ }
+ }
+
+ function getNestedPopperTree() {
+ return arrayFrom(popper.querySelectorAll('[data-tippy-root]'));
+ }
+
+ function scheduleShow(event) {
+ instance.clearDelayTimeouts();
+
+ if (event) {
+ invokeHook('onTrigger', [instance, event]);
+ }
+
+ addDocumentPress();
+ var delay = getDelay(true);
+
+ var _getNormalizedTouchSe = getNormalizedTouchSettings(),
+ touchValue = _getNormalizedTouchSe[0],
+ touchDelay = _getNormalizedTouchSe[1];
+
+ if (currentInput.isTouch && touchValue === 'hold' && touchDelay) {
+ delay = touchDelay;
+ }
+
+ if (delay) {
+ showTimeout = setTimeout(function () {
+ instance.show();
+ }, delay);
+ } else {
+ instance.show();
+ }
+ }
+
+ function scheduleHide(event) {
+ instance.clearDelayTimeouts();
+ invokeHook('onUntrigger', [instance, event]);
+
+ if (!instance.state.isVisible) {
+ removeDocumentPress();
+ return;
+ } // For interactive tippies, scheduleHide is added to a document.body handler
+ // from onMouseLeave so must intercept scheduled hides from mousemove/leave
+ // events when trigger contains mouseenter and click, and the tip is
+ // currently shown as a result of a click.
+
+
+ if (instance.props.trigger.indexOf('mouseenter') >= 0 && instance.props.trigger.indexOf('click') >= 0 && ['mouseleave', 'mousemove'].indexOf(event.type) >= 0 && isVisibleFromClick) {
+ return;
+ }
+
+ var delay = getDelay(false);
+
+ if (delay) {
+ hideTimeout = setTimeout(function () {
+ if (instance.state.isVisible) {
+ instance.hide();
+ }
+ }, delay);
+ } else {
+ // Fixes a `transitionend` problem when it fires 1 frame too
+ // late sometimes, we don't want hide() to be called.
+ scheduleHideAnimationFrame = requestAnimationFrame(function () {
+ instance.hide();
+ });
+ }
+ } // ===========================================================================
+ // 🔑 Public methods
+ // ===========================================================================
+
+
+ function enable() {
+ instance.state.isEnabled = true;
+ }
+
+ function disable() {
+ // Disabling the instance should also hide it
+ // https://github.com/atomiks/tippy.js-react/issues/106
+ instance.hide();
+ instance.state.isEnabled = false;
+ }
+
+ function clearDelayTimeouts() {
+ clearTimeout(showTimeout);
+ clearTimeout(hideTimeout);
+ cancelAnimationFrame(scheduleHideAnimationFrame);
+ }
+
+ function setProps(partialProps) {
+ /* istanbul ignore else */
+ if (process.env.NODE_ENV !== "production") {
+ warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('setProps'));
+ }
+
+ if (instance.state.isDestroyed) {
+ return;
+ }
+
+ invokeHook('onBeforeUpdate', [instance, partialProps]);
+ removeListeners();
+ var prevProps = instance.props;
+ var nextProps = evaluateProps(reference, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
+ ignoreAttributes: true
+ }));
+ instance.props = nextProps;
+ addListeners();
+
+ if (prevProps.interactiveDebounce !== nextProps.interactiveDebounce) {
+ cleanupInteractiveMouseListeners();
+ debouncedOnMouseMove = debounce(onMouseMove, nextProps.interactiveDebounce);
+ } // Ensure stale aria-expanded attributes are removed
+
+
+ if (prevProps.triggerTarget && !nextProps.triggerTarget) {
+ normalizeToArray(prevProps.triggerTarget).forEach(function (node) {
+ node.removeAttribute('aria-expanded');
+ });
+ } else if (nextProps.triggerTarget) {
+ reference.removeAttribute('aria-expanded');
+ }
+
+ handleAriaExpandedAttribute();
+ handleStyles();
+
+ if (onUpdate) {
+ onUpdate(prevProps, nextProps);
+ }
+
+ if (instance.popperInstance) {
+ createPopperInstance(); // Fixes an issue with nested tippies if they are all getting re-rendered,
+ // and the nested ones get re-rendered first.
+ // https://github.com/atomiks/tippyjs-react/issues/177
+ // TODO: find a cleaner / more efficient solution(!)
+
+ getNestedPopperTree().forEach(function (nestedPopper) {
+ // React (and other UI libs likely) requires a rAF wrapper as it flushes
+ // its work in one
+ requestAnimationFrame(nestedPopper._tippy.popperInstance.forceUpdate);
+ });
+ }
+
+ invokeHook('onAfterUpdate', [instance, partialProps]);
+ }
+
+ function setContent(content) {
+ instance.setProps({
+ content: content
+ });
+ }
+
+ function show() {
+ /* istanbul ignore else */
+ if (process.env.NODE_ENV !== "production") {
+ warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('show'));
+ } // Early bail-out
+
+
+ var isAlreadyVisible = instance.state.isVisible;
+ var isDestroyed = instance.state.isDestroyed;
+ var isDisabled = !instance.state.isEnabled;
+ var isTouchAndTouchDisabled = currentInput.isTouch && !instance.props.touch;
+ var duration = getValueAtIndexOrReturn(instance.props.duration, 0, defaultProps.duration);
+
+ if (isAlreadyVisible || isDestroyed || isDisabled || isTouchAndTouchDisabled) {
+ return;
+ } // Normalize `disabled` behavior across browsers.
+ // Firefox allows events on disabled elements, but Chrome doesn't.
+ // Using a wrapper element (i.e. ) is recommended.
+
+
+ if (getCurrentTarget().hasAttribute('disabled')) {
+ return;
+ }
+
+ invokeHook('onShow', [instance], false);
+
+ if (instance.props.onShow(instance) === false) {
+ return;
+ }
+
+ instance.state.isVisible = true;
+
+ if (getIsDefaultRenderFn()) {
+ popper.style.visibility = 'visible';
+ }
+
+ handleStyles();
+ addDocumentPress();
+
+ if (!instance.state.isMounted) {
+ popper.style.transition = 'none';
+ } // If flipping to the opposite side after hiding at least once, the
+ // animation will use the wrong placement without resetting the duration
+
+
+ if (getIsDefaultRenderFn()) {
+ var _getDefaultTemplateCh2 = getDefaultTemplateChildren(),
+ box = _getDefaultTemplateCh2.box,
+ content = _getDefaultTemplateCh2.content;
+
+ setTransitionDuration([box, content], 0);
+ }
+
+ onFirstUpdate = function onFirstUpdate() {
+ var _instance$popperInsta2;
+
+ if (!instance.state.isVisible || ignoreOnFirstUpdate) {
+ return;
+ }
+
+ ignoreOnFirstUpdate = true; // reflow
+
+ void popper.offsetHeight;
+ popper.style.transition = instance.props.moveTransition;
+
+ if (getIsDefaultRenderFn() && instance.props.animation) {
+ var _getDefaultTemplateCh3 = getDefaultTemplateChildren(),
+ _box = _getDefaultTemplateCh3.box,
+ _content = _getDefaultTemplateCh3.content;
+
+ setTransitionDuration([_box, _content], duration);
+ setVisibilityState([_box, _content], 'visible');
+ }
+
+ handleAriaContentAttribute();
+ handleAriaExpandedAttribute();
+ pushIfUnique(mountedInstances, instance); // certain modifiers (e.g. `maxSize`) require a second update after the
+ // popper has been positioned for the first time
+
+ (_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
+ invokeHook('onMount', [instance]);
+
+ if (instance.props.animation && getIsDefaultRenderFn()) {
+ onTransitionedIn(duration, function () {
+ instance.state.isShown = true;
+ invokeHook('onShown', [instance]);
+ });
+ }
+ };
+
+ mount();
+ }
+
+ function hide() {
+ /* istanbul ignore else */
+ if (process.env.NODE_ENV !== "production") {
+ warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hide'));
+ } // Early bail-out
+
+
+ var isAlreadyHidden = !instance.state.isVisible;
+ var isDestroyed = instance.state.isDestroyed;
+ var isDisabled = !instance.state.isEnabled;
+ var duration = getValueAtIndexOrReturn(instance.props.duration, 1, defaultProps.duration);
+
+ if (isAlreadyHidden || isDestroyed || isDisabled) {
+ return;
+ }
+
+ invokeHook('onHide', [instance], false);
+
+ if (instance.props.onHide(instance) === false) {
+ return;
+ }
+
+ instance.state.isVisible = false;
+ instance.state.isShown = false;
+ ignoreOnFirstUpdate = false;
+ isVisibleFromClick = false;
+
+ if (getIsDefaultRenderFn()) {
+ popper.style.visibility = 'hidden';
+ }
+
+ cleanupInteractiveMouseListeners();
+ removeDocumentPress();
+ handleStyles(true);
+
+ if (getIsDefaultRenderFn()) {
+ var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
+ box = _getDefaultTemplateCh4.box,
+ content = _getDefaultTemplateCh4.content;
+
+ if (instance.props.animation) {
+ setTransitionDuration([box, content], duration);
+ setVisibilityState([box, content], 'hidden');
+ }
+ }
+
+ handleAriaContentAttribute();
+ handleAriaExpandedAttribute();
+
+ if (instance.props.animation) {
+ if (getIsDefaultRenderFn()) {
+ onTransitionedOut(duration, instance.unmount);
+ }
+ } else {
+ instance.unmount();
+ }
+ }
+
+ function hideWithInteractivity(event) {
+ /* istanbul ignore else */
+ if (process.env.NODE_ENV !== "production") {
+ warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hideWithInteractivity'));
+ }
+
+ getDocument().addEventListener('mousemove', debouncedOnMouseMove);
+ pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
+ debouncedOnMouseMove(event);
+ }
+
+ function unmount() {
+ /* istanbul ignore else */
+ if (process.env.NODE_ENV !== "production") {
+ warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('unmount'));
+ }
+
+ if (instance.state.isVisible) {
+ instance.hide();
+ }
+
+ if (!instance.state.isMounted) {
+ return;
+ }
+
+ destroyPopperInstance(); // If a popper is not interactive, it will be appended outside the popper
+ // tree by default. This seems mainly for interactive tippies, but we should
+ // find a workaround if possible
+
+ getNestedPopperTree().forEach(function (nestedPopper) {
+ nestedPopper._tippy.unmount();
+ });
+
+ if (popper.parentNode) {
+ popper.parentNode.removeChild(popper);
+ }
+
+ mountedInstances = mountedInstances.filter(function (i) {
+ return i !== instance;
+ });
+ instance.state.isMounted = false;
+ invokeHook('onHidden', [instance]);
+ }
+
+ function destroy() {
+ /* istanbul ignore else */
+ if (process.env.NODE_ENV !== "production") {
+ warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('destroy'));
+ }
+
+ if (instance.state.isDestroyed) {
+ return;
+ }
+
+ instance.clearDelayTimeouts();
+ instance.unmount();
+ removeListeners();
+ delete reference._tippy;
+ instance.state.isDestroyed = true;
+ invokeHook('onDestroy', [instance]);
+ }
+}
+
+function tippy(targets, optionalProps) {
+ if (optionalProps === void 0) {
+ optionalProps = {};
+ }
+
+ var plugins = defaultProps.plugins.concat(optionalProps.plugins || []);
+ /* istanbul ignore else */
+
+ if (process.env.NODE_ENV !== "production") {
+ validateTargets(targets);
+ validateProps(optionalProps, plugins);
+ }
+
+ bindGlobalEventListeners();
+ var passedProps = Object.assign({}, optionalProps, {
+ plugins: plugins
+ });
+ var elements = getArrayOfElements(targets);
+ /* istanbul ignore else */
+
+ if (process.env.NODE_ENV !== "production") {
+ var isSingleContentElement = isElement(passedProps.content);
+ var isMoreThanOneReferenceElement = elements.length > 1;
+ warnWhen(isSingleContentElement && isMoreThanOneReferenceElement, ['tippy() was passed an Element as the `content` prop, but more than', 'one tippy instance was created by this invocation. This means the', 'content element will only be appended to the last tippy instance.', '\n\n', 'Instead, pass the .innerHTML of the element, or use a function that', 'returns a cloned version of the element instead.', '\n\n', '1) content: element.innerHTML\n', '2) content: () => element.cloneNode(true)'].join(' '));
+ }
+
+ var instances = elements.reduce(function (acc, reference) {
+ var instance = reference && createTippy(reference, passedProps);
+
+ if (instance) {
+ acc.push(instance);
+ }
+
+ return acc;
+ }, []);
+ return isElement(targets) ? instances[0] : instances;
+}
+
+tippy.defaultProps = defaultProps;
+tippy.setDefaultProps = setDefaultProps;
+tippy.currentInput = currentInput;
+var hideAll = function hideAll(_temp) {
+ var _ref = _temp === void 0 ? {} : _temp,
+ excludedReferenceOrInstance = _ref.exclude,
+ duration = _ref.duration;
+
+ mountedInstances.forEach(function (instance) {
+ var isExcluded = false;
+
+ if (excludedReferenceOrInstance) {
+ isExcluded = isReferenceElement(excludedReferenceOrInstance) ? instance.reference === excludedReferenceOrInstance : instance.popper === excludedReferenceOrInstance.popper;
+ }
+
+ if (!isExcluded) {
+ var originalDuration = instance.props.duration;
+ instance.setProps({
+ duration: duration
+ });
+ instance.hide();
+
+ if (!instance.state.isDestroyed) {
+ instance.setProps({
+ duration: originalDuration
+ });
+ }
+ }
+ });
+};
+
+// every time the popper is destroyed (i.e. a new target), removing the styles
+// and causing transitions to break for singletons when the console is open, but
+// most notably for non-transform styles being used, `gpuAcceleration: false`.
+
+var applyStylesModifier = Object.assign({}, applyStyles, {
+ effect: function effect(_ref) {
+ var state = _ref.state;
+ var initialStyles = {
+ popper: {
+ position: state.options.strategy,
+ left: '0',
+ top: '0',
+ margin: '0'
+ },
+ arrow: {
+ position: 'absolute'
+ },
+ reference: {}
+ };
+ Object.assign(state.elements.popper.style, initialStyles.popper);
+ state.styles = initialStyles;
+
+ if (state.elements.arrow) {
+ Object.assign(state.elements.arrow.style, initialStyles.arrow);
+ } // intentionally return no cleanup function
+ // return () => { ... }
+
+ }
+});
+
+var createSingleton = function createSingleton(tippyInstances, optionalProps) {
+ var _optionalProps$popper;
+
+ if (optionalProps === void 0) {
+ optionalProps = {};
+ }
+
+ /* istanbul ignore else */
+ if (process.env.NODE_ENV !== "production") {
+ errorWhen(!Array.isArray(tippyInstances), ['The first argument passed to createSingleton() must be an array of', 'tippy instances. The passed value was', String(tippyInstances)].join(' '));
+ }
+
+ var individualInstances = tippyInstances;
+ var references = [];
+ var triggerTargets = [];
+ var currentTarget;
+ var overrides = optionalProps.overrides;
+ var interceptSetPropsCleanups = [];
+ var shownOnCreate = false;
+
+ function setTriggerTargets() {
+ triggerTargets = individualInstances.map(function (instance) {
+ return normalizeToArray(instance.props.triggerTarget || instance.reference);
+ }).reduce(function (acc, item) {
+ return acc.concat(item);
+ }, []);
+ }
+
+ function setReferences() {
+ references = individualInstances.map(function (instance) {
+ return instance.reference;
+ });
+ }
+
+ function enableInstances(isEnabled) {
+ individualInstances.forEach(function (instance) {
+ if (isEnabled) {
+ instance.enable();
+ } else {
+ instance.disable();
+ }
+ });
+ }
+
+ function interceptSetProps(singleton) {
+ return individualInstances.map(function (instance) {
+ var originalSetProps = instance.setProps;
+
+ instance.setProps = function (props) {
+ originalSetProps(props);
+
+ if (instance.reference === currentTarget) {
+ singleton.setProps(props);
+ }
+ };
+
+ return function () {
+ instance.setProps = originalSetProps;
+ };
+ });
+ } // have to pass singleton, as it maybe undefined on first call
+
+
+ function prepareInstance(singleton, target) {
+ var index = triggerTargets.indexOf(target); // bail-out
+
+ if (target === currentTarget) {
+ return;
+ }
+
+ currentTarget = target;
+ var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
+ acc[prop] = individualInstances[index].props[prop];
+ return acc;
+ }, {});
+ singleton.setProps(Object.assign({}, overrideProps, {
+ getReferenceClientRect: typeof overrideProps.getReferenceClientRect === 'function' ? overrideProps.getReferenceClientRect : function () {
+ var _references$index;
+
+ return (_references$index = references[index]) == null ? void 0 : _references$index.getBoundingClientRect();
+ }
+ }));
+ }
+
+ enableInstances(false);
+ setReferences();
+ setTriggerTargets();
+ var plugin = {
+ fn: function fn() {
+ return {
+ onDestroy: function onDestroy() {
+ enableInstances(true);
+ },
+ onHidden: function onHidden() {
+ currentTarget = null;
+ },
+ onClickOutside: function onClickOutside(instance) {
+ if (instance.props.showOnCreate && !shownOnCreate) {
+ shownOnCreate = true;
+ currentTarget = null;
+ }
+ },
+ onShow: function onShow(instance) {
+ if (instance.props.showOnCreate && !shownOnCreate) {
+ shownOnCreate = true;
+ prepareInstance(instance, references[0]);
+ }
+ },
+ onTrigger: function onTrigger(instance, event) {
+ prepareInstance(instance, event.currentTarget);
+ }
+ };
+ }
+ };
+ var singleton = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), {
+ plugins: [plugin].concat(optionalProps.plugins || []),
+ triggerTarget: triggerTargets,
+ popperOptions: Object.assign({}, optionalProps.popperOptions, {
+ modifiers: [].concat(((_optionalProps$popper = optionalProps.popperOptions) == null ? void 0 : _optionalProps$popper.modifiers) || [], [applyStylesModifier])
+ })
+ }));
+ var originalShow = singleton.show;
+
+ singleton.show = function (target) {
+ originalShow(); // first time, showOnCreate or programmatic call with no params
+ // default to showing first instance
+
+ if (!currentTarget && target == null) {
+ return prepareInstance(singleton, references[0]);
+ } // triggered from event (do nothing as prepareInstance already called by onTrigger)
+ // programmatic call with no params when already visible (do nothing again)
+
+
+ if (currentTarget && target == null) {
+ return;
+ } // target is index of instance
+
+
+ if (typeof target === 'number') {
+ return references[target] && prepareInstance(singleton, references[target]);
+ } // target is a child tippy instance
+
+
+ if (individualInstances.indexOf(target) >= 0) {
+ var ref = target.reference;
+ return prepareInstance(singleton, ref);
+ } // target is a ReferenceElement
+
+
+ if (references.indexOf(target) >= 0) {
+ return prepareInstance(singleton, target);
+ }
+ };
+
+ singleton.showNext = function () {
+ var first = references[0];
+
+ if (!currentTarget) {
+ return singleton.show(0);
+ }
+
+ var index = references.indexOf(currentTarget);
+ singleton.show(references[index + 1] || first);
+ };
+
+ singleton.showPrevious = function () {
+ var last = references[references.length - 1];
+
+ if (!currentTarget) {
+ return singleton.show(last);
+ }
+
+ var index = references.indexOf(currentTarget);
+ var target = references[index - 1] || last;
+ singleton.show(target);
+ };
+
+ var originalSetProps = singleton.setProps;
+
+ singleton.setProps = function (props) {
+ overrides = props.overrides || overrides;
+ originalSetProps(props);
+ };
+
+ singleton.setInstances = function (nextInstances) {
+ enableInstances(true);
+ interceptSetPropsCleanups.forEach(function (fn) {
+ return fn();
+ });
+ individualInstances = nextInstances;
+ enableInstances(false);
+ setReferences();
+ setTriggerTargets();
+ interceptSetPropsCleanups = interceptSetProps(singleton);
+ singleton.setProps({
+ triggerTarget: triggerTargets
+ });
+ };
+
+ interceptSetPropsCleanups = interceptSetProps(singleton);
+ return singleton;
+};
+
+var BUBBLING_EVENTS_MAP = {
+ mouseover: 'mouseenter',
+ focusin: 'focus',
+ click: 'click'
+};
+/**
+ * Creates a delegate instance that controls the creation of tippy instances
+ * for child elements (`target` CSS selector).
+ */
+
+function delegate(targets, props) {
+ /* istanbul ignore else */
+ if (process.env.NODE_ENV !== "production") {
+ errorWhen(!(props && props.target), ['You must specity a `target` prop indicating a CSS selector string matching', 'the target elements that should receive a tippy.'].join(' '));
+ }
+
+ var listeners = [];
+ var childTippyInstances = [];
+ var disabled = false;
+ var target = props.target;
+ var nativeProps = removeProperties(props, ['target']);
+ var parentProps = Object.assign({}, nativeProps, {
+ trigger: 'manual',
+ touch: false
+ });
+ var childProps = Object.assign({
+ touch: defaultProps.touch
+ }, nativeProps, {
+ showOnCreate: true
+ });
+ var returnValue = tippy(targets, parentProps);
+ var normalizedReturnValue = normalizeToArray(returnValue);
+
+ function onTrigger(event) {
+ if (!event.target || disabled) {
+ return;
+ }
+
+ var targetNode = event.target.closest(target);
+
+ if (!targetNode) {
+ return;
+ } // Get relevant trigger with fallbacks:
+ // 1. Check `data-tippy-trigger` attribute on target node
+ // 2. Fallback to `trigger` passed to `delegate()`
+ // 3. Fallback to `defaultProps.trigger`
+
+
+ var trigger = targetNode.getAttribute('data-tippy-trigger') || props.trigger || defaultProps.trigger; // @ts-ignore
+
+ if (targetNode._tippy) {
+ return;
+ }
+
+ if (event.type === 'touchstart' && typeof childProps.touch === 'boolean') {
+ return;
+ }
+
+ if (event.type !== 'touchstart' && trigger.indexOf(BUBBLING_EVENTS_MAP[event.type]) < 0) {
+ return;
+ }
+
+ var instance = tippy(targetNode, childProps);
+
+ if (instance) {
+ childTippyInstances = childTippyInstances.concat(instance);
+ }
+ }
+
+ function on(node, eventType, handler, options) {
+ if (options === void 0) {
+ options = false;
+ }
+
+ node.addEventListener(eventType, handler, options);
+ listeners.push({
+ node: node,
+ eventType: eventType,
+ handler: handler,
+ options: options
+ });
+ }
+
+ function addEventListeners(instance) {
+ var reference = instance.reference;
+ on(reference, 'touchstart', onTrigger, TOUCH_OPTIONS);
+ on(reference, 'mouseover', onTrigger);
+ on(reference, 'focusin', onTrigger);
+ on(reference, 'click', onTrigger);
+ }
+
+ function removeEventListeners() {
+ listeners.forEach(function (_ref) {
+ var node = _ref.node,
+ eventType = _ref.eventType,
+ handler = _ref.handler,
+ options = _ref.options;
+ node.removeEventListener(eventType, handler, options);
+ });
+ listeners = [];
+ }
+
+ function applyMutations(instance) {
+ var originalDestroy = instance.destroy;
+ var originalEnable = instance.enable;
+ var originalDisable = instance.disable;
+
+ instance.destroy = function (shouldDestroyChildInstances) {
+ if (shouldDestroyChildInstances === void 0) {
+ shouldDestroyChildInstances = true;
+ }
+
+ if (shouldDestroyChildInstances) {
+ childTippyInstances.forEach(function (instance) {
+ instance.destroy();
+ });
+ }
+
+ childTippyInstances = [];
+ removeEventListeners();
+ originalDestroy();
+ };
+
+ instance.enable = function () {
+ originalEnable();
+ childTippyInstances.forEach(function (instance) {
+ return instance.enable();
+ });
+ disabled = false;
+ };
+
+ instance.disable = function () {
+ originalDisable();
+ childTippyInstances.forEach(function (instance) {
+ return instance.disable();
+ });
+ disabled = true;
+ };
+
+ addEventListeners(instance);
+ }
+
+ normalizedReturnValue.forEach(applyMutations);
+ return returnValue;
+}
+
+var animateFill = {
+ name: 'animateFill',
+ defaultValue: false,
+ fn: function fn(instance) {
+ var _instance$props$rende;
+
+ // @ts-ignore
+ if (!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy)) {
+ if (process.env.NODE_ENV !== "production") {
+ errorWhen(instance.props.animateFill, 'The `animateFill` plugin requires the default render function.');
+ }
+
+ return {};
+ }
+
+ var _getChildren = getChildren(instance.popper),
+ box = _getChildren.box,
+ content = _getChildren.content;
+
+ var backdrop = instance.props.animateFill ? createBackdropElement() : null;
+ return {
+ onCreate: function onCreate() {
+ if (backdrop) {
+ box.insertBefore(backdrop, box.firstElementChild);
+ box.setAttribute('data-animatefill', '');
+ box.style.overflow = 'hidden';
+ instance.setProps({
+ arrow: false,
+ animation: 'shift-away'
+ });
+ }
+ },
+ onMount: function onMount() {
+ if (backdrop) {
+ var transitionDuration = box.style.transitionDuration;
+ var duration = Number(transitionDuration.replace('ms', '')); // The content should fade in after the backdrop has mostly filled the
+ // tooltip element. `clip-path` is the other alternative but is not
+ // well-supported and is buggy on some devices.
+
+ content.style.transitionDelay = Math.round(duration / 10) + "ms";
+ backdrop.style.transitionDuration = transitionDuration;
+ setVisibilityState([backdrop], 'visible');
+ }
+ },
+ onShow: function onShow() {
+ if (backdrop) {
+ backdrop.style.transitionDuration = '0ms';
+ }
+ },
+ onHide: function onHide() {
+ if (backdrop) {
+ setVisibilityState([backdrop], 'hidden');
+ }
+ }
+ };
+ }
+};
+
+function createBackdropElement() {
+ var backdrop = div();
+ backdrop.className = BACKDROP_CLASS;
+ setVisibilityState([backdrop], 'hidden');
+ return backdrop;
+}
+
+var mouseCoords = {
+ clientX: 0,
+ clientY: 0
+};
+var activeInstances = [];
+
+function storeMouseCoords(_ref) {
+ var clientX = _ref.clientX,
+ clientY = _ref.clientY;
+ mouseCoords = {
+ clientX: clientX,
+ clientY: clientY
+ };
+}
+
+function addMouseCoordsListener(doc) {
+ doc.addEventListener('mousemove', storeMouseCoords);
+}
+
+function removeMouseCoordsListener(doc) {
+ doc.removeEventListener('mousemove', storeMouseCoords);
+}
+
+var followCursor = {
+ name: 'followCursor',
+ defaultValue: false,
+ fn: function fn(instance) {
+ var reference = instance.reference;
+ var doc = getOwnerDocument(instance.props.triggerTarget || reference);
+ var isInternalUpdate = false;
+ var wasFocusEvent = false;
+ var isUnmounted = true;
+ var prevProps = instance.props;
+
+ function getIsInitialBehavior() {
+ return instance.props.followCursor === 'initial' && instance.state.isVisible;
+ }
+
+ function addListener() {
+ doc.addEventListener('mousemove', onMouseMove);
+ }
+
+ function removeListener() {
+ doc.removeEventListener('mousemove', onMouseMove);
+ }
+
+ function unsetGetReferenceClientRect() {
+ isInternalUpdate = true;
+ instance.setProps({
+ getReferenceClientRect: null
+ });
+ isInternalUpdate = false;
+ }
+
+ function onMouseMove(event) {
+ // If the instance is interactive, avoid updating the position unless it's
+ // over the reference element
+ var isCursorOverReference = event.target ? reference.contains(event.target) : true;
+ var followCursor = instance.props.followCursor;
+ var clientX = event.clientX,
+ clientY = event.clientY;
+ var rect = reference.getBoundingClientRect();
+ var relativeX = clientX - rect.left;
+ var relativeY = clientY - rect.top;
+
+ if (isCursorOverReference || !instance.props.interactive) {
+ instance.setProps({
+ // @ts-ignore - unneeded DOMRect properties
+ getReferenceClientRect: function getReferenceClientRect() {
+ var rect = reference.getBoundingClientRect();
+ var x = clientX;
+ var y = clientY;
+
+ if (followCursor === 'initial') {
+ x = rect.left + relativeX;
+ y = rect.top + relativeY;
+ }
+
+ var top = followCursor === 'horizontal' ? rect.top : y;
+ var right = followCursor === 'vertical' ? rect.right : x;
+ var bottom = followCursor === 'horizontal' ? rect.bottom : y;
+ var left = followCursor === 'vertical' ? rect.left : x;
+ return {
+ width: right - left,
+ height: bottom - top,
+ top: top,
+ right: right,
+ bottom: bottom,
+ left: left
+ };
+ }
+ });
+ }
+ }
+
+ function create() {
+ if (instance.props.followCursor) {
+ activeInstances.push({
+ instance: instance,
+ doc: doc
+ });
+ addMouseCoordsListener(doc);
+ }
+ }
+
+ function destroy() {
+ activeInstances = activeInstances.filter(function (data) {
+ return data.instance !== instance;
+ });
+
+ if (activeInstances.filter(function (data) {
+ return data.doc === doc;
+ }).length === 0) {
+ removeMouseCoordsListener(doc);
+ }
+ }
+
+ return {
+ onCreate: create,
+ onDestroy: destroy,
+ onBeforeUpdate: function onBeforeUpdate() {
+ prevProps = instance.props;
+ },
+ onAfterUpdate: function onAfterUpdate(_, _ref2) {
+ var followCursor = _ref2.followCursor;
+
+ if (isInternalUpdate) {
+ return;
+ }
+
+ if (followCursor !== undefined && prevProps.followCursor !== followCursor) {
+ destroy();
+
+ if (followCursor) {
+ create();
+
+ if (instance.state.isMounted && !wasFocusEvent && !getIsInitialBehavior()) {
+ addListener();
+ }
+ } else {
+ removeListener();
+ unsetGetReferenceClientRect();
+ }
+ }
+ },
+ onMount: function onMount() {
+ if (instance.props.followCursor && !wasFocusEvent) {
+ if (isUnmounted) {
+ onMouseMove(mouseCoords);
+ isUnmounted = false;
+ }
+
+ if (!getIsInitialBehavior()) {
+ addListener();
+ }
+ }
+ },
+ onTrigger: function onTrigger(_, event) {
+ if (isMouseEvent(event)) {
+ mouseCoords = {
+ clientX: event.clientX,
+ clientY: event.clientY
+ };
+ }
+
+ wasFocusEvent = event.type === 'focus';
+ },
+ onHidden: function onHidden() {
+ if (instance.props.followCursor) {
+ unsetGetReferenceClientRect();
+ removeListener();
+ isUnmounted = true;
+ }
+ }
+ };
+ }
+};
+
+function getProps(props, modifier) {
+ var _props$popperOptions;
+
+ return {
+ popperOptions: Object.assign({}, props.popperOptions, {
+ modifiers: [].concat((((_props$popperOptions = props.popperOptions) == null ? void 0 : _props$popperOptions.modifiers) || []).filter(function (_ref) {
+ var name = _ref.name;
+ return name !== modifier.name;
+ }), [modifier])
+ })
+ };
+}
+
+var inlinePositioning = {
+ name: 'inlinePositioning',
+ defaultValue: false,
+ fn: function fn(instance) {
+ var reference = instance.reference;
+
+ function isEnabled() {
+ return !!instance.props.inlinePositioning;
+ }
+
+ var placement;
+ var cursorRectIndex = -1;
+ var isInternalUpdate = false;
+ var triedPlacements = [];
+ var modifier = {
+ name: 'tippyInlinePositioning',
+ enabled: true,
+ phase: 'afterWrite',
+ fn: function fn(_ref2) {
+ var state = _ref2.state;
+
+ if (isEnabled()) {
+ if (triedPlacements.indexOf(state.placement) !== -1) {
+ triedPlacements = [];
+ }
+
+ if (placement !== state.placement && triedPlacements.indexOf(state.placement) === -1) {
+ triedPlacements.push(state.placement);
+ instance.setProps({
+ // @ts-ignore - unneeded DOMRect properties
+ getReferenceClientRect: function getReferenceClientRect() {
+ return _getReferenceClientRect(state.placement);
+ }
+ });
+ }
+
+ placement = state.placement;
+ }
+ }
+ };
+
+ function _getReferenceClientRect(placement) {
+ return getInlineBoundingClientRect(getBasePlacement(placement), reference.getBoundingClientRect(), arrayFrom(reference.getClientRects()), cursorRectIndex);
+ }
+
+ function setInternalProps(partialProps) {
+ isInternalUpdate = true;
+ instance.setProps(partialProps);
+ isInternalUpdate = false;
+ }
+
+ function addModifier() {
+ if (!isInternalUpdate) {
+ setInternalProps(getProps(instance.props, modifier));
+ }
+ }
+
+ return {
+ onCreate: addModifier,
+ onAfterUpdate: addModifier,
+ onTrigger: function onTrigger(_, event) {
+ if (isMouseEvent(event)) {
+ var rects = arrayFrom(instance.reference.getClientRects());
+ var cursorRect = rects.find(function (rect) {
+ return rect.left - 2 <= event.clientX && rect.right + 2 >= event.clientX && rect.top - 2 <= event.clientY && rect.bottom + 2 >= event.clientY;
+ });
+ var index = rects.indexOf(cursorRect);
+ cursorRectIndex = index > -1 ? index : cursorRectIndex;
+ }
+ },
+ onHidden: function onHidden() {
+ cursorRectIndex = -1;
+ }
+ };
+ }
+};
+function getInlineBoundingClientRect(currentBasePlacement, boundingRect, clientRects, cursorRectIndex) {
+ // Not an inline element, or placement is not yet known
+ if (clientRects.length < 2 || currentBasePlacement === null) {
+ return boundingRect;
+ } // There are two rects and they are disjoined
+
+
+ if (clientRects.length === 2 && cursorRectIndex >= 0 && clientRects[0].left > clientRects[1].right) {
+ return clientRects[cursorRectIndex] || boundingRect;
+ }
+
+ switch (currentBasePlacement) {
+ case 'top':
+ case 'bottom':
+ {
+ var firstRect = clientRects[0];
+ var lastRect = clientRects[clientRects.length - 1];
+ var isTop = currentBasePlacement === 'top';
+ var top = firstRect.top;
+ var bottom = lastRect.bottom;
+ var left = isTop ? firstRect.left : lastRect.left;
+ var right = isTop ? firstRect.right : lastRect.right;
+ var width = right - left;
+ var height = bottom - top;
+ return {
+ top: top,
+ bottom: bottom,
+ left: left,
+ right: right,
+ width: width,
+ height: height
+ };
+ }
+
+ case 'left':
+ case 'right':
+ {
+ var minLeft = Math.min.apply(Math, clientRects.map(function (rects) {
+ return rects.left;
+ }));
+ var maxRight = Math.max.apply(Math, clientRects.map(function (rects) {
+ return rects.right;
+ }));
+ var measureRects = clientRects.filter(function (rect) {
+ return currentBasePlacement === 'left' ? rect.left === minLeft : rect.right === maxRight;
+ });
+ var _top = measureRects[0].top;
+ var _bottom = measureRects[measureRects.length - 1].bottom;
+ var _left = minLeft;
+ var _right = maxRight;
+
+ var _width = _right - _left;
+
+ var _height = _bottom - _top;
+
+ return {
+ top: _top,
+ bottom: _bottom,
+ left: _left,
+ right: _right,
+ width: _width,
+ height: _height
+ };
+ }
+
+ default:
+ {
+ return boundingRect;
+ }
+ }
+}
+
+var sticky = {
+ name: 'sticky',
+ defaultValue: false,
+ fn: function fn(instance) {
+ var reference = instance.reference,
+ popper = instance.popper;
+
+ function getReference() {
+ return instance.popperInstance ? instance.popperInstance.state.elements.reference : reference;
+ }
+
+ function shouldCheck(value) {
+ return instance.props.sticky === true || instance.props.sticky === value;
+ }
+
+ var prevRefRect = null;
+ var prevPopRect = null;
+
+ function updatePosition() {
+ var currentRefRect = shouldCheck('reference') ? getReference().getBoundingClientRect() : null;
+ var currentPopRect = shouldCheck('popper') ? popper.getBoundingClientRect() : null;
+
+ if (currentRefRect && areRectsDifferent(prevRefRect, currentRefRect) || currentPopRect && areRectsDifferent(prevPopRect, currentPopRect)) {
+ if (instance.popperInstance) {
+ instance.popperInstance.update();
+ }
+ }
+
+ prevRefRect = currentRefRect;
+ prevPopRect = currentPopRect;
+
+ if (instance.state.isMounted) {
+ requestAnimationFrame(updatePosition);
+ }
+ }
+
+ return {
+ onMount: function onMount() {
+ if (instance.props.sticky) {
+ updatePosition();
+ }
+ }
+ };
+ }
+};
+
+function areRectsDifferent(rectA, rectB) {
+ if (rectA && rectB) {
+ return rectA.top !== rectB.top || rectA.right !== rectB.right || rectA.bottom !== rectB.bottom || rectA.left !== rectB.left;
+ }
+
+ return true;
+}
+
+tippy.setDefaultProps({
+ render: render
+});
+
+export default tippy;
+export { animateFill, createSingleton, delegate, followCursor, hideAll, inlinePositioning, ROUND_ARROW as roundArrow, sticky };
+//# sourceMappingURL=tippy.esm.js.map
diff --git a/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/dist/tippy.esm.js.map b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/dist/tippy.esm.js.map
new file mode 100644
index 000000000..58a88faf1
--- /dev/null
+++ b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/dist/tippy.esm.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"tippy.esm.js","sources":["../src/constants.ts","../src/utils.ts","../src/dom-utils.ts","../src/bindGlobalEventListeners.ts","../src/browser.ts","../src/validation.ts","../src/props.ts","../src/template.ts","../src/createTippy.ts","../src/index.ts","../src/addons/createSingleton.ts","../src/addons/delegate.ts","../src/plugins/animateFill.ts","../src/plugins/followCursor.ts","../src/plugins/inlinePositioning.ts","../src/plugins/sticky.ts","../build/base.js"],"sourcesContent":["export const ROUND_ARROW =\n '';\n\nexport const BOX_CLASS = `__NAMESPACE_PREFIX__-box`;\nexport const CONTENT_CLASS = `__NAMESPACE_PREFIX__-content`;\nexport const BACKDROP_CLASS = `__NAMESPACE_PREFIX__-backdrop`;\nexport const ARROW_CLASS = `__NAMESPACE_PREFIX__-arrow`;\nexport const SVG_ARROW_CLASS = `__NAMESPACE_PREFIX__-svg-arrow`;\n\nexport const TOUCH_OPTIONS = {passive: true, capture: true};\n\nexport const TIPPY_DEFAULT_APPEND_TO = () => document.body;\n","import {BasePlacement, Placement} from './types';\n\nexport function hasOwnProperty(\n obj: Record,\n key: string\n): boolean {\n return {}.hasOwnProperty.call(obj, key);\n}\n\nexport function getValueAtIndexOrReturn(\n value: T | [T | null, T | null],\n index: number,\n defaultValue: T | [T, T]\n): T {\n if (Array.isArray(value)) {\n const v = value[index];\n return v == null\n ? Array.isArray(defaultValue)\n ? defaultValue[index]\n : defaultValue\n : v;\n }\n\n return value;\n}\n\nexport function isType(value: any, type: string): boolean {\n const str = {}.toString.call(value);\n return str.indexOf('[object') === 0 && str.indexOf(`${type}]`) > -1;\n}\n\nexport function invokeWithArgsOrReturn(value: any, args: any[]): any {\n return typeof value === 'function' ? value(...args) : value;\n}\n\nexport function debounce(\n fn: (arg: T) => void,\n ms: number\n): (arg: T) => void {\n // Avoid wrapping in `setTimeout` if ms is 0 anyway\n if (ms === 0) {\n return fn;\n }\n\n let timeout: any;\n\n return (arg): void => {\n clearTimeout(timeout);\n timeout = setTimeout(() => {\n fn(arg);\n }, ms);\n };\n}\n\nexport function removeProperties(obj: T, keys: string[]): Partial {\n const clone = {...obj};\n keys.forEach((key) => {\n delete (clone as any)[key];\n });\n return clone;\n}\n\nexport function splitBySpaces(value: string): string[] {\n return value.split(/\\s+/).filter(Boolean);\n}\n\nexport function normalizeToArray(value: T | T[]): T[] {\n return ([] as T[]).concat(value);\n}\n\nexport function pushIfUnique(arr: T[], value: T): void {\n if (arr.indexOf(value) === -1) {\n arr.push(value);\n }\n}\n\nexport function appendPxIfNumber(value: string | number): string {\n return typeof value === 'number' ? `${value}px` : value;\n}\n\nexport function unique(arr: T[]): T[] {\n return arr.filter((item, index) => arr.indexOf(item) === index);\n}\n\nexport function getNumber(value: string | number): number {\n return typeof value === 'number' ? value : parseFloat(value);\n}\n\nexport function getBasePlacement(placement: Placement): BasePlacement {\n return placement.split('-')[0] as BasePlacement;\n}\n\nexport function arrayFrom(value: ArrayLike): any[] {\n return [].slice.call(value);\n}\n\nexport function removeUndefinedProps(\n obj: Record\n): Partial> {\n return Object.keys(obj).reduce((acc, key) => {\n if (obj[key] !== undefined) {\n (acc as any)[key] = obj[key];\n }\n\n return acc;\n }, {});\n}\n","import {ReferenceElement, Targets} from './types';\nimport {PopperTreeData} from './types-internal';\nimport {arrayFrom, isType, normalizeToArray, getBasePlacement} from './utils';\n\nexport function div(): HTMLDivElement {\n return document.createElement('div');\n}\n\nexport function isElement(value: unknown): value is Element | DocumentFragment {\n return ['Element', 'Fragment'].some((type) => isType(value, type));\n}\n\nexport function isNodeList(value: unknown): value is NodeList {\n return isType(value, 'NodeList');\n}\n\nexport function isMouseEvent(value: unknown): value is MouseEvent {\n return isType(value, 'MouseEvent');\n}\n\nexport function isReferenceElement(value: any): value is ReferenceElement {\n return !!(value && value._tippy && value._tippy.reference === value);\n}\n\nexport function getArrayOfElements(value: Targets): Element[] {\n if (isElement(value)) {\n return [value];\n }\n\n if (isNodeList(value)) {\n return arrayFrom(value);\n }\n\n if (Array.isArray(value)) {\n return value;\n }\n\n return arrayFrom(document.querySelectorAll(value));\n}\n\nexport function setTransitionDuration(\n els: (HTMLDivElement | null)[],\n value: number\n): void {\n els.forEach((el) => {\n if (el) {\n el.style.transitionDuration = `${value}ms`;\n }\n });\n}\n\nexport function setVisibilityState(\n els: (HTMLDivElement | null)[],\n state: 'visible' | 'hidden'\n): void {\n els.forEach((el) => {\n if (el) {\n el.setAttribute('data-state', state);\n }\n });\n}\n\nexport function getOwnerDocument(\n elementOrElements: Element | Element[]\n): Document {\n const [element] = normalizeToArray(elementOrElements);\n\n // Elements created via a have an ownerDocument with no reference to the body\n return element?.ownerDocument?.body ? element.ownerDocument : document;\n}\n\nexport function isCursorOutsideInteractiveBorder(\n popperTreeData: PopperTreeData[],\n event: MouseEvent\n): boolean {\n const {clientX, clientY} = event;\n\n return popperTreeData.every(({popperRect, popperState, props}) => {\n const {interactiveBorder} = props;\n const basePlacement = getBasePlacement(popperState.placement);\n const offsetData = popperState.modifiersData.offset;\n\n if (!offsetData) {\n return true;\n }\n\n const topDistance = basePlacement === 'bottom' ? offsetData.top!.y : 0;\n const bottomDistance = basePlacement === 'top' ? offsetData.bottom!.y : 0;\n const leftDistance = basePlacement === 'right' ? offsetData.left!.x : 0;\n const rightDistance = basePlacement === 'left' ? offsetData.right!.x : 0;\n\n const exceedsTop =\n popperRect.top - clientY + topDistance > interactiveBorder;\n const exceedsBottom =\n clientY - popperRect.bottom - bottomDistance > interactiveBorder;\n const exceedsLeft =\n popperRect.left - clientX + leftDistance > interactiveBorder;\n const exceedsRight =\n clientX - popperRect.right - rightDistance > interactiveBorder;\n\n return exceedsTop || exceedsBottom || exceedsLeft || exceedsRight;\n });\n}\n\nexport function updateTransitionEndListener(\n box: HTMLDivElement,\n action: 'add' | 'remove',\n listener: (event: TransitionEvent) => void\n): void {\n const method = `${action}EventListener` as\n | 'addEventListener'\n | 'removeEventListener';\n\n // some browsers apparently support `transition` (unprefixed) but only fire\n // `webkitTransitionEnd`...\n ['transitionend', 'webkitTransitionEnd'].forEach((event) => {\n box[method](event, listener as EventListener);\n });\n}\n\n/**\n * Compared to xxx.contains, this function works for dom structures with shadow\n * dom\n */\nexport function actualContains(parent: Element, child: Element): boolean {\n let target = child;\n while (target) {\n if (parent.contains(target)) {\n return true;\n }\n target = (target.getRootNode?.() as any)?.host;\n }\n return false;\n}\n","import {TOUCH_OPTIONS} from './constants';\nimport {isReferenceElement} from './dom-utils';\n\nexport const currentInput = {isTouch: false};\nlet lastMouseMoveTime = 0;\n\n/**\n * When a `touchstart` event is fired, it's assumed the user is using touch\n * input. We'll bind a `mousemove` event listener to listen for mouse input in\n * the future. This way, the `isTouch` property is fully dynamic and will handle\n * hybrid devices that use a mix of touch + mouse input.\n */\nexport function onDocumentTouchStart(): void {\n if (currentInput.isTouch) {\n return;\n }\n\n currentInput.isTouch = true;\n\n if (window.performance) {\n document.addEventListener('mousemove', onDocumentMouseMove);\n }\n}\n\n/**\n * When two `mousemove` event are fired consecutively within 20ms, it's assumed\n * the user is using mouse input again. `mousemove` can fire on touch devices as\n * well, but very rarely that quickly.\n */\nexport function onDocumentMouseMove(): void {\n const now = performance.now();\n\n if (now - lastMouseMoveTime < 20) {\n currentInput.isTouch = false;\n\n document.removeEventListener('mousemove', onDocumentMouseMove);\n }\n\n lastMouseMoveTime = now;\n}\n\n/**\n * When an element is in focus and has a tippy, leaving the tab/window and\n * returning causes it to show again. For mouse users this is unexpected, but\n * for keyboard use it makes sense.\n * TODO: find a better technique to solve this problem\n */\nexport function onWindowBlur(): void {\n const activeElement = document.activeElement as HTMLElement | null;\n\n if (isReferenceElement(activeElement)) {\n const instance = activeElement._tippy!;\n\n if (activeElement.blur && !instance.state.isVisible) {\n activeElement.blur();\n }\n }\n}\n\nexport default function bindGlobalEventListeners(): void {\n document.addEventListener('touchstart', onDocumentTouchStart, TOUCH_OPTIONS);\n window.addEventListener('blur', onWindowBlur);\n}\n","export const isBrowser =\n typeof window !== 'undefined' && typeof document !== 'undefined';\n\nexport const isIE11 = isBrowser\n ? // @ts-ignore\n !!window.msCrypto\n : false;\n","import {Targets} from './types';\n\nexport function createMemoryLeakWarning(method: string): string {\n const txt = method === 'destroy' ? 'n already-' : ' ';\n\n return [\n `${method}() was called on a${txt}destroyed instance. This is a no-op but`,\n 'indicates a potential memory leak.',\n ].join(' ');\n}\n\nexport function clean(value: string): string {\n const spacesAndTabs = /[ \\t]{2,}/g;\n const lineStartWithSpaces = /^[ \\t]*/gm;\n\n return value\n .replace(spacesAndTabs, ' ')\n .replace(lineStartWithSpaces, '')\n .trim();\n}\n\nfunction getDevMessage(message: string): string {\n return clean(`\n %ctippy.js\n\n %c${clean(message)}\n\n %c👷 This is a development-only message. It will be removed in production.\n `);\n}\n\nexport function getFormattedMessage(message: string): string[] {\n return [\n getDevMessage(message),\n // title\n 'color: #00C584; font-size: 1.3em; font-weight: bold;',\n // message\n 'line-height: 1.5',\n // footer\n 'color: #a6a095;',\n ];\n}\n\n// Assume warnings and errors never have the same message\nlet visitedMessages: Set;\nif (__DEV__) {\n resetVisitedMessages();\n}\n\nexport function resetVisitedMessages(): void {\n visitedMessages = new Set();\n}\n\nexport function warnWhen(condition: boolean, message: string): void {\n if (condition && !visitedMessages.has(message)) {\n visitedMessages.add(message);\n console.warn(...getFormattedMessage(message));\n }\n}\n\nexport function errorWhen(condition: boolean, message: string): void {\n if (condition && !visitedMessages.has(message)) {\n visitedMessages.add(message);\n console.error(...getFormattedMessage(message));\n }\n}\n\nexport function validateTargets(targets: Targets): void {\n const didPassFalsyValue = !targets;\n const didPassPlainObject =\n Object.prototype.toString.call(targets) === '[object Object]' &&\n !(targets as any).addEventListener;\n\n errorWhen(\n didPassFalsyValue,\n [\n 'tippy() was passed',\n '`' + String(targets) + '`',\n 'as its targets (first) argument. Valid types are: String, Element,',\n 'Element[], or NodeList.',\n ].join(' ')\n );\n\n errorWhen(\n didPassPlainObject,\n [\n 'tippy() was passed a plain object which is not supported as an argument',\n 'for virtual positioning. Use props.getReferenceClientRect instead.',\n ].join(' ')\n );\n}\n","import {DefaultProps, Plugin, Props, ReferenceElement, Tippy} from './types';\nimport {\n hasOwnProperty,\n removeProperties,\n invokeWithArgsOrReturn,\n} from './utils';\nimport {warnWhen} from './validation';\nimport {TIPPY_DEFAULT_APPEND_TO} from './constants';\n\nconst pluginProps = {\n animateFill: false,\n followCursor: false,\n inlinePositioning: false,\n sticky: false,\n};\n\nconst renderProps = {\n allowHTML: false,\n animation: 'fade',\n arrow: true,\n content: '',\n inertia: false,\n maxWidth: 350,\n role: 'tooltip',\n theme: '',\n zIndex: 9999,\n};\n\nexport const defaultProps: DefaultProps = {\n appendTo: TIPPY_DEFAULT_APPEND_TO,\n aria: {\n content: 'auto',\n expanded: 'auto',\n },\n delay: 0,\n duration: [300, 250],\n getReferenceClientRect: null,\n hideOnClick: true,\n ignoreAttributes: false,\n interactive: false,\n interactiveBorder: 2,\n interactiveDebounce: 0,\n moveTransition: '',\n offset: [0, 10],\n onAfterUpdate() {},\n onBeforeUpdate() {},\n onCreate() {},\n onDestroy() {},\n onHidden() {},\n onHide() {},\n onMount() {},\n onShow() {},\n onShown() {},\n onTrigger() {},\n onUntrigger() {},\n onClickOutside() {},\n placement: 'top',\n plugins: [],\n popperOptions: {},\n render: null,\n showOnCreate: false,\n touch: true,\n trigger: 'mouseenter focus',\n triggerTarget: null,\n ...pluginProps,\n ...renderProps,\n};\n\nconst defaultKeys = Object.keys(defaultProps);\n\nexport const setDefaultProps: Tippy['setDefaultProps'] = (partialProps) => {\n /* istanbul ignore else */\n if (__DEV__) {\n validateProps(partialProps, []);\n }\n\n const keys = Object.keys(partialProps) as Array;\n keys.forEach((key) => {\n (defaultProps as any)[key] = partialProps[key];\n });\n};\n\nexport function getExtendedPassedProps(\n passedProps: Partial & Record\n): Partial {\n const plugins = passedProps.plugins || [];\n const pluginProps = plugins.reduce>((acc, plugin) => {\n const {name, defaultValue} = plugin;\n\n if (name) {\n acc[name] =\n passedProps[name] !== undefined\n ? passedProps[name]\n : (defaultProps as any)[name] ?? defaultValue;\n }\n\n return acc;\n }, {});\n\n return {\n ...passedProps,\n ...pluginProps,\n };\n}\n\nexport function getDataAttributeProps(\n reference: ReferenceElement,\n plugins: Plugin[]\n): Record {\n const propKeys = plugins\n ? Object.keys(getExtendedPassedProps({...defaultProps, plugins}))\n : defaultKeys;\n\n const props = propKeys.reduce(\n (acc: Partial & Record, key) => {\n const valueAsString = (\n reference.getAttribute(`data-tippy-${key}`) || ''\n ).trim();\n\n if (!valueAsString) {\n return acc;\n }\n\n if (key === 'content') {\n acc[key] = valueAsString;\n } else {\n try {\n acc[key] = JSON.parse(valueAsString);\n } catch (e) {\n acc[key] = valueAsString;\n }\n }\n\n return acc;\n },\n {}\n );\n\n return props;\n}\n\nexport function evaluateProps(\n reference: ReferenceElement,\n props: Props\n): Props {\n const out = {\n ...props,\n content: invokeWithArgsOrReturn(props.content, [reference]),\n ...(props.ignoreAttributes\n ? {}\n : getDataAttributeProps(reference, props.plugins)),\n };\n\n out.aria = {\n ...defaultProps.aria,\n ...out.aria,\n };\n\n out.aria = {\n expanded:\n out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,\n content:\n out.aria.content === 'auto'\n ? props.interactive\n ? null\n : 'describedby'\n : out.aria.content,\n };\n\n return out;\n}\n\nexport function validateProps(\n partialProps: Partial = {},\n plugins: Plugin[] = []\n): void {\n const keys = Object.keys(partialProps) as Array;\n keys.forEach((prop) => {\n const nonPluginProps = removeProperties(\n defaultProps,\n Object.keys(pluginProps)\n );\n\n let didPassUnknownProp = !hasOwnProperty(nonPluginProps, prop);\n\n // Check if the prop exists in `plugins`\n if (didPassUnknownProp) {\n didPassUnknownProp =\n plugins.filter((plugin) => plugin.name === prop).length === 0;\n }\n\n warnWhen(\n didPassUnknownProp,\n [\n `\\`${prop}\\``,\n \"is not a valid prop. You may have spelled it incorrectly, or if it's\",\n 'a plugin, forgot to pass it in an array as props.plugins.',\n '\\n\\n',\n 'All props: https://atomiks.github.io/tippyjs/v6/all-props/\\n',\n 'Plugins: https://atomiks.github.io/tippyjs/v6/plugins/',\n ].join(' ')\n );\n });\n}\n","import {\n ARROW_CLASS,\n BACKDROP_CLASS,\n BOX_CLASS,\n CONTENT_CLASS,\n SVG_ARROW_CLASS,\n} from './constants';\nimport {div, isElement} from './dom-utils';\nimport {Instance, PopperElement, Props} from './types';\nimport {PopperChildren} from './types-internal';\nimport {arrayFrom} from './utils';\n\n// Firefox extensions don't allow .innerHTML = \"...\" property. This tricks it.\nconst innerHTML = (): 'innerHTML' => 'innerHTML';\n\nfunction dangerouslySetInnerHTML(element: Element, html: string): void {\n element[innerHTML()] = html;\n}\n\nfunction createArrowElement(value: Props['arrow']): HTMLDivElement {\n const arrow = div();\n\n if (value === true) {\n arrow.className = ARROW_CLASS;\n } else {\n arrow.className = SVG_ARROW_CLASS;\n\n if (isElement(value)) {\n arrow.appendChild(value);\n } else {\n dangerouslySetInnerHTML(arrow, value as string);\n }\n }\n\n return arrow;\n}\n\nexport function setContent(content: HTMLDivElement, props: Props): void {\n if (isElement(props.content)) {\n dangerouslySetInnerHTML(content, '');\n content.appendChild(props.content);\n } else if (typeof props.content !== 'function') {\n if (props.allowHTML) {\n dangerouslySetInnerHTML(content, props.content);\n } else {\n content.textContent = props.content;\n }\n }\n}\n\nexport function getChildren(popper: PopperElement): PopperChildren {\n const box = popper.firstElementChild as HTMLDivElement;\n const boxChildren = arrayFrom(box.children);\n\n return {\n box,\n content: boxChildren.find((node) => node.classList.contains(CONTENT_CLASS)),\n arrow: boxChildren.find(\n (node) =>\n node.classList.contains(ARROW_CLASS) ||\n node.classList.contains(SVG_ARROW_CLASS)\n ),\n backdrop: boxChildren.find((node) =>\n node.classList.contains(BACKDROP_CLASS)\n ),\n };\n}\n\nexport function render(\n instance: Instance\n): {\n popper: PopperElement;\n onUpdate?: (prevProps: Props, nextProps: Props) => void;\n} {\n const popper = div();\n\n const box = div();\n box.className = BOX_CLASS;\n box.setAttribute('data-state', 'hidden');\n box.setAttribute('tabindex', '-1');\n\n const content = div();\n content.className = CONTENT_CLASS;\n content.setAttribute('data-state', 'hidden');\n\n setContent(content, instance.props);\n\n popper.appendChild(box);\n box.appendChild(content);\n\n onUpdate(instance.props, instance.props);\n\n function onUpdate(prevProps: Props, nextProps: Props): void {\n const {box, content, arrow} = getChildren(popper);\n\n if (nextProps.theme) {\n box.setAttribute('data-theme', nextProps.theme);\n } else {\n box.removeAttribute('data-theme');\n }\n\n if (typeof nextProps.animation === 'string') {\n box.setAttribute('data-animation', nextProps.animation);\n } else {\n box.removeAttribute('data-animation');\n }\n\n if (nextProps.inertia) {\n box.setAttribute('data-inertia', '');\n } else {\n box.removeAttribute('data-inertia');\n }\n\n box.style.maxWidth =\n typeof nextProps.maxWidth === 'number'\n ? `${nextProps.maxWidth}px`\n : nextProps.maxWidth;\n\n if (nextProps.role) {\n box.setAttribute('role', nextProps.role);\n } else {\n box.removeAttribute('role');\n }\n\n if (\n prevProps.content !== nextProps.content ||\n prevProps.allowHTML !== nextProps.allowHTML\n ) {\n setContent(content, instance.props);\n }\n\n if (nextProps.arrow) {\n if (!arrow) {\n box.appendChild(createArrowElement(nextProps.arrow));\n } else if (prevProps.arrow !== nextProps.arrow) {\n box.removeChild(arrow);\n box.appendChild(createArrowElement(nextProps.arrow));\n }\n } else if (arrow) {\n box.removeChild(arrow!);\n }\n }\n\n return {\n popper,\n onUpdate,\n };\n}\n\n// Runtime check to identify if the render function is the default one; this\n// way we can apply default CSS transitions logic and it can be tree-shaken away\nrender.$$tippy = true;\n","import {createPopper, StrictModifiers, Modifier} from '@popperjs/core';\nimport {currentInput} from './bindGlobalEventListeners';\nimport {isIE11} from './browser';\nimport {TIPPY_DEFAULT_APPEND_TO, TOUCH_OPTIONS} from './constants';\nimport {\n actualContains,\n div,\n getOwnerDocument,\n isCursorOutsideInteractiveBorder,\n isMouseEvent,\n setTransitionDuration,\n setVisibilityState,\n updateTransitionEndListener,\n} from './dom-utils';\nimport {defaultProps, evaluateProps, getExtendedPassedProps} from './props';\nimport {getChildren} from './template';\nimport {\n Content,\n Instance,\n LifecycleHooks,\n PopperElement,\n Props,\n ReferenceElement,\n} from './types';\nimport {ListenerObject, PopperTreeData, PopperChildren} from './types-internal';\nimport {\n arrayFrom,\n debounce,\n getValueAtIndexOrReturn,\n invokeWithArgsOrReturn,\n normalizeToArray,\n pushIfUnique,\n splitBySpaces,\n unique,\n removeUndefinedProps,\n} from './utils';\nimport {createMemoryLeakWarning, errorWhen, warnWhen} from './validation';\n\nlet idCounter = 1;\nlet mouseMoveListeners: ((event: MouseEvent) => void)[] = [];\n\n// Used by `hideAll()`\nexport let mountedInstances: Instance[] = [];\n\nexport default function createTippy(\n reference: ReferenceElement,\n passedProps: Partial\n): Instance {\n const props = evaluateProps(reference, {\n ...defaultProps,\n ...getExtendedPassedProps(removeUndefinedProps(passedProps)),\n });\n\n // ===========================================================================\n // 🔒 Private members\n // ===========================================================================\n let showTimeout: any;\n let hideTimeout: any;\n let scheduleHideAnimationFrame: number;\n let isVisibleFromClick = false;\n let didHideDueToDocumentMouseDown = false;\n let didTouchMove = false;\n let ignoreOnFirstUpdate = false;\n let lastTriggerEvent: Event | undefined;\n let currentTransitionEndListener: (event: TransitionEvent) => void;\n let onFirstUpdate: () => void;\n let listeners: ListenerObject[] = [];\n let debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);\n let currentTarget: Element;\n\n // ===========================================================================\n // 🔑 Public members\n // ===========================================================================\n const id = idCounter++;\n const popperInstance = null;\n const plugins = unique(props.plugins);\n\n const state = {\n // Is the instance currently enabled?\n isEnabled: true,\n // Is the tippy currently showing and not transitioning out?\n isVisible: false,\n // Has the instance been destroyed?\n isDestroyed: false,\n // Is the tippy currently mounted to the DOM?\n isMounted: false,\n // Has the tippy finished transitioning in?\n isShown: false,\n };\n\n const instance: Instance = {\n // properties\n id,\n reference,\n popper: div(),\n popperInstance,\n props,\n state,\n plugins,\n // methods\n clearDelayTimeouts,\n setProps,\n setContent,\n show,\n hide,\n hideWithInteractivity,\n enable,\n disable,\n unmount,\n destroy,\n };\n\n // TODO: Investigate why this early return causes a TDZ error in the tests —\n // it doesn't seem to happen in the browser\n /* istanbul ignore if */\n if (!props.render) {\n if (__DEV__) {\n errorWhen(true, 'render() function has not been supplied.');\n }\n\n return instance;\n }\n\n // ===========================================================================\n // Initial mutations\n // ===========================================================================\n const {popper, onUpdate} = props.render(instance);\n\n popper.setAttribute('data-__NAMESPACE_PREFIX__-root', '');\n popper.id = `__NAMESPACE_PREFIX__-${instance.id}`;\n\n instance.popper = popper;\n reference._tippy = instance;\n popper._tippy = instance;\n\n const pluginsHooks = plugins.map((plugin) => plugin.fn(instance));\n const hasAriaExpanded = reference.hasAttribute('aria-expanded');\n\n addListeners();\n handleAriaExpandedAttribute();\n handleStyles();\n\n invokeHook('onCreate', [instance]);\n\n if (props.showOnCreate) {\n scheduleShow();\n }\n\n // Prevent a tippy with a delay from hiding if the cursor left then returned\n // before it started hiding\n popper.addEventListener('mouseenter', () => {\n if (instance.props.interactive && instance.state.isVisible) {\n instance.clearDelayTimeouts();\n }\n });\n\n popper.addEventListener('mouseleave', () => {\n if (\n instance.props.interactive &&\n instance.props.trigger.indexOf('mouseenter') >= 0\n ) {\n getDocument().addEventListener('mousemove', debouncedOnMouseMove);\n }\n });\n\n return instance;\n\n // ===========================================================================\n // 🔒 Private methods\n // ===========================================================================\n function getNormalizedTouchSettings(): [string | boolean, number] {\n const {touch} = instance.props;\n return Array.isArray(touch) ? touch : [touch, 0];\n }\n\n function getIsCustomTouchBehavior(): boolean {\n return getNormalizedTouchSettings()[0] === 'hold';\n }\n\n function getIsDefaultRenderFn(): boolean {\n // @ts-ignore\n return !!instance.props.render?.$$tippy;\n }\n\n function getCurrentTarget(): Element {\n return currentTarget || reference;\n }\n\n function getDocument(): Document {\n const parent = getCurrentTarget().parentNode as Element;\n return parent ? getOwnerDocument(parent) : document;\n }\n\n function getDefaultTemplateChildren(): PopperChildren {\n return getChildren(popper);\n }\n\n function getDelay(isShow: boolean): number {\n // For touch or keyboard input, force `0` delay for UX reasons\n // Also if the instance is mounted but not visible (transitioning out),\n // ignore delay\n if (\n (instance.state.isMounted && !instance.state.isVisible) ||\n currentInput.isTouch ||\n (lastTriggerEvent && lastTriggerEvent.type === 'focus')\n ) {\n return 0;\n }\n\n return getValueAtIndexOrReturn(\n instance.props.delay,\n isShow ? 0 : 1,\n defaultProps.delay\n );\n }\n\n function handleStyles(fromHide = false): void {\n popper.style.pointerEvents =\n instance.props.interactive && !fromHide ? '' : 'none';\n popper.style.zIndex = `${instance.props.zIndex}`;\n }\n\n function invokeHook(\n hook: keyof LifecycleHooks,\n args: [Instance, any?],\n shouldInvokePropsHook = true\n ): void {\n pluginsHooks.forEach((pluginHooks) => {\n if (pluginHooks[hook]) {\n pluginHooks[hook]!(...args);\n }\n });\n\n if (shouldInvokePropsHook) {\n instance.props[hook](...args);\n }\n }\n\n function handleAriaContentAttribute(): void {\n const {aria} = instance.props;\n\n if (!aria.content) {\n return;\n }\n\n const attr = `aria-${aria.content}`;\n const id = popper.id;\n const nodes = normalizeToArray(instance.props.triggerTarget || reference);\n\n nodes.forEach((node) => {\n const currentValue = node.getAttribute(attr);\n\n if (instance.state.isVisible) {\n node.setAttribute(attr, currentValue ? `${currentValue} ${id}` : id);\n } else {\n const nextValue = currentValue && currentValue.replace(id, '').trim();\n\n if (nextValue) {\n node.setAttribute(attr, nextValue);\n } else {\n node.removeAttribute(attr);\n }\n }\n });\n }\n\n function handleAriaExpandedAttribute(): void {\n if (hasAriaExpanded || !instance.props.aria.expanded) {\n return;\n }\n\n const nodes = normalizeToArray(instance.props.triggerTarget || reference);\n\n nodes.forEach((node) => {\n if (instance.props.interactive) {\n node.setAttribute(\n 'aria-expanded',\n instance.state.isVisible && node === getCurrentTarget()\n ? 'true'\n : 'false'\n );\n } else {\n node.removeAttribute('aria-expanded');\n }\n });\n }\n\n function cleanupInteractiveMouseListeners(): void {\n getDocument().removeEventListener('mousemove', debouncedOnMouseMove);\n mouseMoveListeners = mouseMoveListeners.filter(\n (listener) => listener !== debouncedOnMouseMove\n );\n }\n\n function onDocumentPress(event: MouseEvent | TouchEvent): void {\n // Moved finger to scroll instead of an intentional tap outside\n if (currentInput.isTouch) {\n if (didTouchMove || event.type === 'mousedown') {\n return;\n }\n }\n\n const actualTarget =\n (event.composedPath && event.composedPath()[0]) || event.target;\n\n // Clicked on interactive popper\n if (\n instance.props.interactive &&\n actualContains(popper, actualTarget as Element)\n ) {\n return;\n }\n\n // Clicked on the event listeners target\n if (\n normalizeToArray(instance.props.triggerTarget || reference).some((el) =>\n actualContains(el, actualTarget as Element)\n )\n ) {\n if (currentInput.isTouch) {\n return;\n }\n\n if (\n instance.state.isVisible &&\n instance.props.trigger.indexOf('click') >= 0\n ) {\n return;\n }\n } else {\n invokeHook('onClickOutside', [instance, event]);\n }\n\n if (instance.props.hideOnClick === true) {\n instance.clearDelayTimeouts();\n instance.hide();\n\n // `mousedown` event is fired right before `focus` if pressing the\n // currentTarget. This lets a tippy with `focus` trigger know that it\n // should not show\n didHideDueToDocumentMouseDown = true;\n setTimeout(() => {\n didHideDueToDocumentMouseDown = false;\n });\n\n // The listener gets added in `scheduleShow()`, but this may be hiding it\n // before it shows, and hide()'s early bail-out behavior can prevent it\n // from being cleaned up\n if (!instance.state.isMounted) {\n removeDocumentPress();\n }\n }\n }\n\n function onTouchMove(): void {\n didTouchMove = true;\n }\n\n function onTouchStart(): void {\n didTouchMove = false;\n }\n\n function addDocumentPress(): void {\n const doc = getDocument();\n doc.addEventListener('mousedown', onDocumentPress, true);\n doc.addEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);\n doc.addEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);\n doc.addEventListener('touchmove', onTouchMove, TOUCH_OPTIONS);\n }\n\n function removeDocumentPress(): void {\n const doc = getDocument();\n doc.removeEventListener('mousedown', onDocumentPress, true);\n doc.removeEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);\n doc.removeEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);\n doc.removeEventListener('touchmove', onTouchMove, TOUCH_OPTIONS);\n }\n\n function onTransitionedOut(duration: number, callback: () => void): void {\n onTransitionEnd(duration, () => {\n if (\n !instance.state.isVisible &&\n popper.parentNode &&\n popper.parentNode.contains(popper)\n ) {\n callback();\n }\n });\n }\n\n function onTransitionedIn(duration: number, callback: () => void): void {\n onTransitionEnd(duration, callback);\n }\n\n function onTransitionEnd(duration: number, callback: () => void): void {\n const box = getDefaultTemplateChildren().box;\n\n function listener(event: TransitionEvent): void {\n if (event.target === box) {\n updateTransitionEndListener(box, 'remove', listener);\n callback();\n }\n }\n\n // Make callback synchronous if duration is 0\n // `transitionend` won't fire otherwise\n if (duration === 0) {\n return callback();\n }\n\n updateTransitionEndListener(box, 'remove', currentTransitionEndListener);\n updateTransitionEndListener(box, 'add', listener);\n\n currentTransitionEndListener = listener;\n }\n\n function on(\n eventType: string,\n handler: EventListener,\n options: boolean | Record = false\n ): void {\n const nodes = normalizeToArray(instance.props.triggerTarget || reference);\n nodes.forEach((node) => {\n node.addEventListener(eventType, handler, options);\n listeners.push({node, eventType, handler, options});\n });\n }\n\n function addListeners(): void {\n if (getIsCustomTouchBehavior()) {\n on('touchstart', onTrigger, {passive: true});\n on('touchend', onMouseLeave as EventListener, {passive: true});\n }\n\n splitBySpaces(instance.props.trigger).forEach((eventType) => {\n if (eventType === 'manual') {\n return;\n }\n\n on(eventType, onTrigger);\n\n switch (eventType) {\n case 'mouseenter':\n on('mouseleave', onMouseLeave as EventListener);\n break;\n case 'focus':\n on(isIE11 ? 'focusout' : 'blur', onBlurOrFocusOut as EventListener);\n break;\n case 'focusin':\n on('focusout', onBlurOrFocusOut as EventListener);\n break;\n }\n });\n }\n\n function removeListeners(): void {\n listeners.forEach(({node, eventType, handler, options}: ListenerObject) => {\n node.removeEventListener(eventType, handler, options);\n });\n listeners = [];\n }\n\n function onTrigger(event: Event): void {\n let shouldScheduleClickHide = false;\n\n if (\n !instance.state.isEnabled ||\n isEventListenerStopped(event) ||\n didHideDueToDocumentMouseDown\n ) {\n return;\n }\n\n const wasFocused = lastTriggerEvent?.type === 'focus';\n\n lastTriggerEvent = event;\n currentTarget = event.currentTarget as Element;\n\n handleAriaExpandedAttribute();\n\n if (!instance.state.isVisible && isMouseEvent(event)) {\n // If scrolling, `mouseenter` events can be fired if the cursor lands\n // over a new target, but `mousemove` events don't get fired. This\n // causes interactive tooltips to get stuck open until the cursor is\n // moved\n mouseMoveListeners.forEach((listener) => listener(event));\n }\n\n // Toggle show/hide when clicking click-triggered tooltips\n if (\n event.type === 'click' &&\n (instance.props.trigger.indexOf('mouseenter') < 0 ||\n isVisibleFromClick) &&\n instance.props.hideOnClick !== false &&\n instance.state.isVisible\n ) {\n shouldScheduleClickHide = true;\n } else {\n scheduleShow(event);\n }\n\n if (event.type === 'click') {\n isVisibleFromClick = !shouldScheduleClickHide;\n }\n\n if (shouldScheduleClickHide && !wasFocused) {\n scheduleHide(event);\n }\n }\n\n function onMouseMove(event: MouseEvent): void {\n const target = event.target as Node;\n const isCursorOverReferenceOrPopper =\n getCurrentTarget().contains(target) || popper.contains(target);\n\n if (event.type === 'mousemove' && isCursorOverReferenceOrPopper) {\n return;\n }\n\n const popperTreeData = getNestedPopperTree()\n .concat(popper)\n .map((popper) => {\n const instance = popper._tippy!;\n const state = instance.popperInstance?.state;\n\n if (state) {\n return {\n popperRect: popper.getBoundingClientRect(),\n popperState: state,\n props,\n };\n }\n\n return null;\n })\n .filter(Boolean) as PopperTreeData[];\n\n if (isCursorOutsideInteractiveBorder(popperTreeData, event)) {\n cleanupInteractiveMouseListeners();\n scheduleHide(event);\n }\n }\n\n function onMouseLeave(event: MouseEvent): void {\n const shouldBail =\n isEventListenerStopped(event) ||\n (instance.props.trigger.indexOf('click') >= 0 && isVisibleFromClick);\n\n if (shouldBail) {\n return;\n }\n\n if (instance.props.interactive) {\n instance.hideWithInteractivity(event);\n return;\n }\n\n scheduleHide(event);\n }\n\n function onBlurOrFocusOut(event: FocusEvent): void {\n if (\n instance.props.trigger.indexOf('focusin') < 0 &&\n event.target !== getCurrentTarget()\n ) {\n return;\n }\n\n // If focus was moved to within the popper\n if (\n instance.props.interactive &&\n event.relatedTarget &&\n popper.contains(event.relatedTarget as Element)\n ) {\n return;\n }\n\n scheduleHide(event);\n }\n\n function isEventListenerStopped(event: Event): boolean {\n return currentInput.isTouch\n ? getIsCustomTouchBehavior() !== event.type.indexOf('touch') >= 0\n : false;\n }\n\n function createPopperInstance(): void {\n destroyPopperInstance();\n\n const {\n popperOptions,\n placement,\n offset,\n getReferenceClientRect,\n moveTransition,\n } = instance.props;\n\n const arrow = getIsDefaultRenderFn() ? getChildren(popper).arrow : null;\n\n const computedReference = getReferenceClientRect\n ? {\n getBoundingClientRect: getReferenceClientRect,\n contextElement:\n getReferenceClientRect.contextElement || getCurrentTarget(),\n }\n : reference;\n\n const tippyModifier: Modifier<'$$tippy', Record> = {\n name: '$$tippy',\n enabled: true,\n phase: 'beforeWrite',\n requires: ['computeStyles'],\n fn({state}) {\n if (getIsDefaultRenderFn()) {\n const {box} = getDefaultTemplateChildren();\n\n ['placement', 'reference-hidden', 'escaped'].forEach((attr) => {\n if (attr === 'placement') {\n box.setAttribute('data-placement', state.placement);\n } else {\n if (state.attributes.popper[`data-popper-${attr}`]) {\n box.setAttribute(`data-${attr}`, '');\n } else {\n box.removeAttribute(`data-${attr}`);\n }\n }\n });\n\n state.attributes.popper = {};\n }\n },\n };\n\n type TippyModifier = Modifier<'$$tippy', Record>;\n type ExtendedModifiers = StrictModifiers | Partial;\n\n const modifiers: Array = [\n {\n name: 'offset',\n options: {\n offset,\n },\n },\n {\n name: 'preventOverflow',\n options: {\n padding: {\n top: 2,\n bottom: 2,\n left: 5,\n right: 5,\n },\n },\n },\n {\n name: 'flip',\n options: {\n padding: 5,\n },\n },\n {\n name: 'computeStyles',\n options: {\n adaptive: !moveTransition,\n },\n },\n tippyModifier,\n ];\n\n if (getIsDefaultRenderFn() && arrow) {\n modifiers.push({\n name: 'arrow',\n options: {\n element: arrow,\n padding: 3,\n },\n });\n }\n\n modifiers.push(...(popperOptions?.modifiers || []));\n\n instance.popperInstance = createPopper(\n computedReference,\n popper,\n {\n ...popperOptions,\n placement,\n onFirstUpdate,\n modifiers,\n }\n );\n }\n\n function destroyPopperInstance(): void {\n if (instance.popperInstance) {\n instance.popperInstance.destroy();\n instance.popperInstance = null;\n }\n }\n\n function mount(): void {\n const {appendTo} = instance.props;\n\n let parentNode: any;\n\n // By default, we'll append the popper to the triggerTargets's parentNode so\n // it's directly after the reference element so the elements inside the\n // tippy can be tabbed to\n // If there are clipping issues, the user can specify a different appendTo\n // and ensure focus management is handled correctly manually\n const node = getCurrentTarget();\n\n if (\n (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO) ||\n appendTo === 'parent'\n ) {\n parentNode = node.parentNode;\n } else {\n parentNode = invokeWithArgsOrReturn(appendTo, [node]);\n }\n\n // The popper element needs to exist on the DOM before its position can be\n // updated as Popper needs to read its dimensions\n if (!parentNode.contains(popper)) {\n parentNode.appendChild(popper);\n }\n\n instance.state.isMounted = true;\n\n createPopperInstance();\n\n /* istanbul ignore else */\n if (__DEV__) {\n // Accessibility check\n warnWhen(\n instance.props.interactive &&\n appendTo === defaultProps.appendTo &&\n node.nextElementSibling !== popper,\n [\n 'Interactive tippy element may not be accessible via keyboard',\n 'navigation because it is not directly after the reference element',\n 'in the DOM source order.',\n '\\n\\n',\n 'Using a wrapper
or tag around the reference element',\n 'solves this by creating a new parentNode context.',\n '\\n\\n',\n 'Specifying `appendTo: document.body` silences this warning, but it',\n 'assumes you are using a focus management solution to handle',\n 'keyboard navigation.',\n '\\n\\n',\n 'See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity',\n ].join(' ')\n );\n }\n }\n\n function getNestedPopperTree(): PopperElement[] {\n return arrayFrom(\n popper.querySelectorAll('[data-__NAMESPACE_PREFIX__-root]')\n );\n }\n\n function scheduleShow(event?: Event): void {\n instance.clearDelayTimeouts();\n\n if (event) {\n invokeHook('onTrigger', [instance, event]);\n }\n\n addDocumentPress();\n\n let delay = getDelay(true);\n const [touchValue, touchDelay] = getNormalizedTouchSettings();\n\n if (currentInput.isTouch && touchValue === 'hold' && touchDelay) {\n delay = touchDelay;\n }\n\n if (delay) {\n showTimeout = setTimeout(() => {\n instance.show();\n }, delay);\n } else {\n instance.show();\n }\n }\n\n function scheduleHide(event: Event): void {\n instance.clearDelayTimeouts();\n\n invokeHook('onUntrigger', [instance, event]);\n\n if (!instance.state.isVisible) {\n removeDocumentPress();\n\n return;\n }\n\n // For interactive tippies, scheduleHide is added to a document.body handler\n // from onMouseLeave so must intercept scheduled hides from mousemove/leave\n // events when trigger contains mouseenter and click, and the tip is\n // currently shown as a result of a click.\n if (\n instance.props.trigger.indexOf('mouseenter') >= 0 &&\n instance.props.trigger.indexOf('click') >= 0 &&\n ['mouseleave', 'mousemove'].indexOf(event.type) >= 0 &&\n isVisibleFromClick\n ) {\n return;\n }\n\n const delay = getDelay(false);\n\n if (delay) {\n hideTimeout = setTimeout(() => {\n if (instance.state.isVisible) {\n instance.hide();\n }\n }, delay);\n } else {\n // Fixes a `transitionend` problem when it fires 1 frame too\n // late sometimes, we don't want hide() to be called.\n scheduleHideAnimationFrame = requestAnimationFrame(() => {\n instance.hide();\n });\n }\n }\n\n // ===========================================================================\n // 🔑 Public methods\n // ===========================================================================\n function enable(): void {\n instance.state.isEnabled = true;\n }\n\n function disable(): void {\n // Disabling the instance should also hide it\n // https://github.com/atomiks/tippy.js-react/issues/106\n instance.hide();\n instance.state.isEnabled = false;\n }\n\n function clearDelayTimeouts(): void {\n clearTimeout(showTimeout);\n clearTimeout(hideTimeout);\n cancelAnimationFrame(scheduleHideAnimationFrame);\n }\n\n function setProps(partialProps: Partial): void {\n /* istanbul ignore else */\n if (__DEV__) {\n warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('setProps'));\n }\n\n if (instance.state.isDestroyed) {\n return;\n }\n\n invokeHook('onBeforeUpdate', [instance, partialProps]);\n\n removeListeners();\n\n const prevProps = instance.props;\n const nextProps = evaluateProps(reference, {\n ...prevProps,\n ...removeUndefinedProps(partialProps),\n ignoreAttributes: true,\n });\n\n instance.props = nextProps;\n\n addListeners();\n\n if (prevProps.interactiveDebounce !== nextProps.interactiveDebounce) {\n cleanupInteractiveMouseListeners();\n debouncedOnMouseMove = debounce(\n onMouseMove,\n nextProps.interactiveDebounce\n );\n }\n\n // Ensure stale aria-expanded attributes are removed\n if (prevProps.triggerTarget && !nextProps.triggerTarget) {\n normalizeToArray(prevProps.triggerTarget).forEach((node) => {\n node.removeAttribute('aria-expanded');\n });\n } else if (nextProps.triggerTarget) {\n reference.removeAttribute('aria-expanded');\n }\n\n handleAriaExpandedAttribute();\n handleStyles();\n\n if (onUpdate) {\n onUpdate(prevProps, nextProps);\n }\n\n if (instance.popperInstance) {\n createPopperInstance();\n\n // Fixes an issue with nested tippies if they are all getting re-rendered,\n // and the nested ones get re-rendered first.\n // https://github.com/atomiks/tippyjs-react/issues/177\n // TODO: find a cleaner / more efficient solution(!)\n getNestedPopperTree().forEach((nestedPopper) => {\n // React (and other UI libs likely) requires a rAF wrapper as it flushes\n // its work in one\n requestAnimationFrame(nestedPopper._tippy!.popperInstance!.forceUpdate);\n });\n }\n\n invokeHook('onAfterUpdate', [instance, partialProps]);\n }\n\n function setContent(content: Content): void {\n instance.setProps({content});\n }\n\n function show(): void {\n /* istanbul ignore else */\n if (__DEV__) {\n warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('show'));\n }\n\n // Early bail-out\n const isAlreadyVisible = instance.state.isVisible;\n const isDestroyed = instance.state.isDestroyed;\n const isDisabled = !instance.state.isEnabled;\n const isTouchAndTouchDisabled =\n currentInput.isTouch && !instance.props.touch;\n const duration = getValueAtIndexOrReturn(\n instance.props.duration,\n 0,\n defaultProps.duration\n );\n\n if (\n isAlreadyVisible ||\n isDestroyed ||\n isDisabled ||\n isTouchAndTouchDisabled\n ) {\n return;\n }\n\n // Normalize `disabled` behavior across browsers.\n // Firefox allows events on disabled elements, but Chrome doesn't.\n // Using a wrapper element (i.e. ) is recommended.\n if (getCurrentTarget().hasAttribute('disabled')) {\n return;\n }\n\n invokeHook('onShow', [instance], false);\n if (instance.props.onShow(instance) === false) {\n return;\n }\n\n instance.state.isVisible = true;\n\n if (getIsDefaultRenderFn()) {\n popper.style.visibility = 'visible';\n }\n\n handleStyles();\n addDocumentPress();\n\n if (!instance.state.isMounted) {\n popper.style.transition = 'none';\n }\n\n // If flipping to the opposite side after hiding at least once, the\n // animation will use the wrong placement without resetting the duration\n if (getIsDefaultRenderFn()) {\n const {box, content} = getDefaultTemplateChildren();\n setTransitionDuration([box, content], 0);\n }\n\n onFirstUpdate = (): void => {\n if (!instance.state.isVisible || ignoreOnFirstUpdate) {\n return;\n }\n\n ignoreOnFirstUpdate = true;\n\n // reflow\n void popper.offsetHeight;\n\n popper.style.transition = instance.props.moveTransition;\n\n if (getIsDefaultRenderFn() && instance.props.animation) {\n const {box, content} = getDefaultTemplateChildren();\n setTransitionDuration([box, content], duration);\n setVisibilityState([box, content], 'visible');\n }\n\n handleAriaContentAttribute();\n handleAriaExpandedAttribute();\n\n pushIfUnique(mountedInstances, instance);\n\n // certain modifiers (e.g. `maxSize`) require a second update after the\n // popper has been positioned for the first time\n instance.popperInstance?.forceUpdate();\n\n invokeHook('onMount', [instance]);\n\n if (instance.props.animation && getIsDefaultRenderFn()) {\n onTransitionedIn(duration, () => {\n instance.state.isShown = true;\n invokeHook('onShown', [instance]);\n });\n }\n };\n\n mount();\n }\n\n function hide(): void {\n /* istanbul ignore else */\n if (__DEV__) {\n warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hide'));\n }\n\n // Early bail-out\n const isAlreadyHidden = !instance.state.isVisible;\n const isDestroyed = instance.state.isDestroyed;\n const isDisabled = !instance.state.isEnabled;\n const duration = getValueAtIndexOrReturn(\n instance.props.duration,\n 1,\n defaultProps.duration\n );\n\n if (isAlreadyHidden || isDestroyed || isDisabled) {\n return;\n }\n\n invokeHook('onHide', [instance], false);\n if (instance.props.onHide(instance) === false) {\n return;\n }\n\n instance.state.isVisible = false;\n instance.state.isShown = false;\n ignoreOnFirstUpdate = false;\n isVisibleFromClick = false;\n\n if (getIsDefaultRenderFn()) {\n popper.style.visibility = 'hidden';\n }\n\n cleanupInteractiveMouseListeners();\n removeDocumentPress();\n handleStyles(true);\n\n if (getIsDefaultRenderFn()) {\n const {box, content} = getDefaultTemplateChildren();\n\n if (instance.props.animation) {\n setTransitionDuration([box, content], duration);\n setVisibilityState([box, content], 'hidden');\n }\n }\n\n handleAriaContentAttribute();\n handleAriaExpandedAttribute();\n\n if (instance.props.animation) {\n if (getIsDefaultRenderFn()) {\n onTransitionedOut(duration, instance.unmount);\n }\n } else {\n instance.unmount();\n }\n }\n\n function hideWithInteractivity(event: MouseEvent): void {\n /* istanbul ignore else */\n if (__DEV__) {\n warnWhen(\n instance.state.isDestroyed,\n createMemoryLeakWarning('hideWithInteractivity')\n );\n }\n\n getDocument().addEventListener('mousemove', debouncedOnMouseMove);\n pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);\n debouncedOnMouseMove(event);\n }\n\n function unmount(): void {\n /* istanbul ignore else */\n if (__DEV__) {\n warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('unmount'));\n }\n\n if (instance.state.isVisible) {\n instance.hide();\n }\n\n if (!instance.state.isMounted) {\n return;\n }\n\n destroyPopperInstance();\n\n // If a popper is not interactive, it will be appended outside the popper\n // tree by default. This seems mainly for interactive tippies, but we should\n // find a workaround if possible\n getNestedPopperTree().forEach((nestedPopper) => {\n nestedPopper._tippy!.unmount();\n });\n\n if (popper.parentNode) {\n popper.parentNode.removeChild(popper);\n }\n\n mountedInstances = mountedInstances.filter((i) => i !== instance);\n\n instance.state.isMounted = false;\n invokeHook('onHidden', [instance]);\n }\n\n function destroy(): void {\n /* istanbul ignore else */\n if (__DEV__) {\n warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('destroy'));\n }\n\n if (instance.state.isDestroyed) {\n return;\n }\n\n instance.clearDelayTimeouts();\n instance.unmount();\n\n removeListeners();\n\n delete reference._tippy;\n\n instance.state.isDestroyed = true;\n\n invokeHook('onDestroy', [instance]);\n }\n}\n","import bindGlobalEventListeners, {\n currentInput,\n} from './bindGlobalEventListeners';\nimport createTippy, {mountedInstances} from './createTippy';\nimport {getArrayOfElements, isElement, isReferenceElement} from './dom-utils';\nimport {defaultProps, setDefaultProps, validateProps} from './props';\nimport {HideAll, HideAllOptions, Instance, Props, Targets} from './types';\nimport {validateTargets, warnWhen} from './validation';\n\nfunction tippy(\n targets: Targets,\n optionalProps: Partial = {}\n): Instance | Instance[] {\n const plugins = defaultProps.plugins.concat(optionalProps.plugins || []);\n\n /* istanbul ignore else */\n if (__DEV__) {\n validateTargets(targets);\n validateProps(optionalProps, plugins);\n }\n\n bindGlobalEventListeners();\n\n const passedProps: Partial = {...optionalProps, plugins};\n\n const elements = getArrayOfElements(targets);\n\n /* istanbul ignore else */\n if (__DEV__) {\n const isSingleContentElement = isElement(passedProps.content);\n const isMoreThanOneReferenceElement = elements.length > 1;\n warnWhen(\n isSingleContentElement && isMoreThanOneReferenceElement,\n [\n 'tippy() was passed an Element as the `content` prop, but more than',\n 'one tippy instance was created by this invocation. This means the',\n 'content element will only be appended to the last tippy instance.',\n '\\n\\n',\n 'Instead, pass the .innerHTML of the element, or use a function that',\n 'returns a cloned version of the element instead.',\n '\\n\\n',\n '1) content: element.innerHTML\\n',\n '2) content: () => element.cloneNode(true)',\n ].join(' ')\n );\n }\n\n const instances = elements.reduce(\n (acc, reference): Instance[] => {\n const instance = reference && createTippy(reference, passedProps);\n\n if (instance) {\n acc.push(instance);\n }\n\n return acc;\n },\n []\n );\n\n return isElement(targets) ? instances[0] : instances;\n}\n\ntippy.defaultProps = defaultProps;\ntippy.setDefaultProps = setDefaultProps;\ntippy.currentInput = currentInput;\n\nexport default tippy;\n\nexport const hideAll: HideAll = ({\n exclude: excludedReferenceOrInstance,\n duration,\n}: HideAllOptions = {}) => {\n mountedInstances.forEach((instance) => {\n let isExcluded = false;\n\n if (excludedReferenceOrInstance) {\n isExcluded = isReferenceElement(excludedReferenceOrInstance)\n ? instance.reference === excludedReferenceOrInstance\n : instance.popper === (excludedReferenceOrInstance as Instance).popper;\n }\n\n if (!isExcluded) {\n const originalDuration = instance.props.duration;\n\n instance.setProps({duration});\n instance.hide();\n\n if (!instance.state.isDestroyed) {\n instance.setProps({duration: originalDuration});\n }\n }\n });\n};\n","import tippy from '..';\nimport {div} from '../dom-utils';\nimport {\n CreateSingleton,\n Plugin,\n CreateSingletonProps,\n ReferenceElement,\n CreateSingletonInstance,\n Instance,\n Props,\n} from '../types';\nimport {normalizeToArray, removeProperties} from '../utils';\nimport {errorWhen} from '../validation';\nimport {applyStyles, Modifier} from '@popperjs/core';\n\n// The default `applyStyles` modifier has a cleanup function that gets called\n// every time the popper is destroyed (i.e. a new target), removing the styles\n// and causing transitions to break for singletons when the console is open, but\n// most notably for non-transform styles being used, `gpuAcceleration: false`.\nconst applyStylesModifier: Modifier<'applyStyles', Record> = {\n ...applyStyles,\n effect({state}) {\n const initialStyles = {\n popper: {\n position: state.options.strategy,\n left: '0',\n top: '0',\n margin: '0',\n },\n arrow: {\n position: 'absolute',\n },\n reference: {},\n };\n\n Object.assign(state.elements.popper.style, initialStyles.popper);\n state.styles = initialStyles;\n\n if (state.elements.arrow) {\n Object.assign(state.elements.arrow.style, initialStyles.arrow);\n }\n\n // intentionally return no cleanup function\n // return () => { ... }\n },\n};\n\nconst createSingleton: CreateSingleton = (\n tippyInstances,\n optionalProps = {}\n) => {\n /* istanbul ignore else */\n if (__DEV__) {\n errorWhen(\n !Array.isArray(tippyInstances),\n [\n 'The first argument passed to createSingleton() must be an array of',\n 'tippy instances. The passed value was',\n String(tippyInstances),\n ].join(' ')\n );\n }\n\n let individualInstances = tippyInstances;\n let references: Array = [];\n let triggerTargets: Array = [];\n let currentTarget: Element | null;\n let overrides = optionalProps.overrides;\n let interceptSetPropsCleanups: Array<() => void> = [];\n let shownOnCreate = false;\n\n function setTriggerTargets(): void {\n triggerTargets = individualInstances\n .map((instance) =>\n normalizeToArray(instance.props.triggerTarget || instance.reference)\n )\n .reduce((acc, item) => acc.concat(item), []);\n }\n\n function setReferences(): void {\n references = individualInstances.map((instance) => instance.reference);\n }\n\n function enableInstances(isEnabled: boolean): void {\n individualInstances.forEach((instance) => {\n if (isEnabled) {\n instance.enable();\n } else {\n instance.disable();\n }\n });\n }\n\n function interceptSetProps(singleton: Instance): Array<() => void> {\n return individualInstances.map((instance) => {\n const originalSetProps = instance.setProps;\n\n instance.setProps = (props): void => {\n originalSetProps(props);\n\n if (instance.reference === currentTarget) {\n singleton.setProps(props);\n }\n };\n\n return (): void => {\n instance.setProps = originalSetProps;\n };\n });\n }\n\n // have to pass singleton, as it maybe undefined on first call\n function prepareInstance(\n singleton: Instance,\n target: ReferenceElement\n ): void {\n const index = triggerTargets.indexOf(target);\n\n // bail-out\n if (target === currentTarget) {\n return;\n }\n\n currentTarget = target;\n\n const overrideProps: Partial = (overrides || [])\n .concat('content')\n .reduce((acc, prop) => {\n (acc as any)[prop] = individualInstances[index].props[prop];\n return acc;\n }, {});\n\n singleton.setProps({\n ...overrideProps,\n getReferenceClientRect:\n typeof overrideProps.getReferenceClientRect === 'function'\n ? overrideProps.getReferenceClientRect\n : (): ClientRect => references[index]?.getBoundingClientRect(),\n });\n }\n\n enableInstances(false);\n setReferences();\n setTriggerTargets();\n\n const plugin: Plugin = {\n fn() {\n return {\n onDestroy(): void {\n enableInstances(true);\n },\n onHidden(): void {\n currentTarget = null;\n },\n onClickOutside(instance): void {\n if (instance.props.showOnCreate && !shownOnCreate) {\n shownOnCreate = true;\n currentTarget = null;\n }\n },\n onShow(instance): void {\n if (instance.props.showOnCreate && !shownOnCreate) {\n shownOnCreate = true;\n prepareInstance(instance, references[0]);\n }\n },\n onTrigger(instance, event): void {\n prepareInstance(instance, event.currentTarget as Element);\n },\n };\n },\n };\n\n const singleton = tippy(div(), {\n ...removeProperties(optionalProps, ['overrides']),\n plugins: [plugin, ...(optionalProps.plugins || [])],\n triggerTarget: triggerTargets,\n popperOptions: {\n ...optionalProps.popperOptions,\n modifiers: [\n ...(optionalProps.popperOptions?.modifiers || []),\n applyStylesModifier,\n ],\n },\n }) as CreateSingletonInstance;\n\n const originalShow = singleton.show;\n\n singleton.show = (target?: ReferenceElement | Instance | number): void => {\n originalShow();\n\n // first time, showOnCreate or programmatic call with no params\n // default to showing first instance\n if (!currentTarget && target == null) {\n return prepareInstance(singleton, references[0]);\n }\n\n // triggered from event (do nothing as prepareInstance already called by onTrigger)\n // programmatic call with no params when already visible (do nothing again)\n if (currentTarget && target == null) {\n return;\n }\n\n // target is index of instance\n if (typeof target === 'number') {\n return (\n references[target] && prepareInstance(singleton, references[target])\n );\n }\n\n // target is a child tippy instance\n if (individualInstances.indexOf(target as Instance) >= 0) {\n const ref = (target as Instance).reference;\n return prepareInstance(singleton, ref);\n }\n\n // target is a ReferenceElement\n if (references.indexOf(target as ReferenceElement) >= 0) {\n return prepareInstance(singleton, target as ReferenceElement);\n }\n };\n\n singleton.showNext = (): void => {\n const first = references[0];\n if (!currentTarget) {\n return singleton.show(0);\n }\n const index = references.indexOf(currentTarget);\n singleton.show(references[index + 1] || first);\n };\n\n singleton.showPrevious = (): void => {\n const last = references[references.length - 1];\n if (!currentTarget) {\n return singleton.show(last);\n }\n const index = references.indexOf(currentTarget);\n const target = references[index - 1] || last;\n singleton.show(target);\n };\n\n const originalSetProps = singleton.setProps;\n\n singleton.setProps = (props): void => {\n overrides = props.overrides || overrides;\n originalSetProps(props);\n };\n\n singleton.setInstances = (nextInstances): void => {\n enableInstances(true);\n interceptSetPropsCleanups.forEach((fn) => fn());\n\n individualInstances = nextInstances;\n\n enableInstances(false);\n setReferences();\n setTriggerTargets();\n interceptSetPropsCleanups = interceptSetProps(singleton);\n\n singleton.setProps({triggerTarget: triggerTargets});\n };\n\n interceptSetPropsCleanups = interceptSetProps(singleton);\n\n return singleton;\n};\n\nexport default createSingleton;\n","import tippy from '..';\nimport {TOUCH_OPTIONS} from '../constants';\nimport {defaultProps} from '../props';\nimport {Instance, Props, Targets} from '../types';\nimport {ListenerObject} from '../types-internal';\nimport {normalizeToArray, removeProperties} from '../utils';\nimport {errorWhen} from '../validation';\n\nconst BUBBLING_EVENTS_MAP = {\n mouseover: 'mouseenter',\n focusin: 'focus',\n click: 'click',\n};\n\n/**\n * Creates a delegate instance that controls the creation of tippy instances\n * for child elements (`target` CSS selector).\n */\nfunction delegate(\n targets: Targets,\n props: Partial & {target: string}\n): Instance | Instance[] {\n /* istanbul ignore else */\n if (__DEV__) {\n errorWhen(\n !(props && props.target),\n [\n 'You must specity a `target` prop indicating a CSS selector string matching',\n 'the target elements that should receive a tippy.',\n ].join(' ')\n );\n }\n\n let listeners: ListenerObject[] = [];\n let childTippyInstances: Instance[] = [];\n let disabled = false;\n\n const {target} = props;\n\n const nativeProps = removeProperties(props, ['target']);\n const parentProps = {...nativeProps, trigger: 'manual', touch: false};\n const childProps = {\n touch: defaultProps.touch,\n ...nativeProps,\n showOnCreate: true,\n };\n\n const returnValue = tippy(targets, parentProps);\n const normalizedReturnValue = normalizeToArray(returnValue);\n\n function onTrigger(event: Event): void {\n if (!event.target || disabled) {\n return;\n }\n\n const targetNode = (event.target as Element).closest(target);\n\n if (!targetNode) {\n return;\n }\n\n // Get relevant trigger with fallbacks:\n // 1. Check `data-tippy-trigger` attribute on target node\n // 2. Fallback to `trigger` passed to `delegate()`\n // 3. Fallback to `defaultProps.trigger`\n const trigger =\n targetNode.getAttribute('data-tippy-trigger') ||\n props.trigger ||\n defaultProps.trigger;\n\n // @ts-ignore\n if (targetNode._tippy) {\n return;\n }\n\n if (event.type === 'touchstart' && typeof childProps.touch === 'boolean') {\n return;\n }\n\n if (\n event.type !== 'touchstart' &&\n trigger.indexOf((BUBBLING_EVENTS_MAP as any)[event.type]) < 0\n ) {\n return;\n }\n\n const instance = tippy(targetNode, childProps);\n\n if (instance) {\n childTippyInstances = childTippyInstances.concat(instance);\n }\n }\n\n function on(\n node: Element,\n eventType: string,\n handler: EventListener,\n options: boolean | Record = false\n ): void {\n node.addEventListener(eventType, handler, options);\n listeners.push({node, eventType, handler, options});\n }\n\n function addEventListeners(instance: Instance): void {\n const {reference} = instance;\n\n on(reference, 'touchstart', onTrigger, TOUCH_OPTIONS);\n on(reference, 'mouseover', onTrigger);\n on(reference, 'focusin', onTrigger);\n on(reference, 'click', onTrigger);\n }\n\n function removeEventListeners(): void {\n listeners.forEach(({node, eventType, handler, options}: ListenerObject) => {\n node.removeEventListener(eventType, handler, options);\n });\n listeners = [];\n }\n\n function applyMutations(instance: Instance): void {\n const originalDestroy = instance.destroy;\n const originalEnable = instance.enable;\n const originalDisable = instance.disable;\n\n instance.destroy = (shouldDestroyChildInstances = true): void => {\n if (shouldDestroyChildInstances) {\n childTippyInstances.forEach((instance) => {\n instance.destroy();\n });\n }\n\n childTippyInstances = [];\n\n removeEventListeners();\n originalDestroy();\n };\n\n instance.enable = (): void => {\n originalEnable();\n childTippyInstances.forEach((instance) => instance.enable());\n disabled = false;\n };\n\n instance.disable = (): void => {\n originalDisable();\n childTippyInstances.forEach((instance) => instance.disable());\n disabled = true;\n };\n\n addEventListeners(instance);\n }\n\n normalizedReturnValue.forEach(applyMutations);\n\n return returnValue;\n}\n\nexport default delegate;\n","import {BACKDROP_CLASS} from '../constants';\nimport {div, setVisibilityState} from '../dom-utils';\nimport {getChildren} from '../template';\nimport {AnimateFill} from '../types';\nimport {errorWhen} from '../validation';\n\nconst animateFill: AnimateFill = {\n name: 'animateFill',\n defaultValue: false,\n fn(instance) {\n // @ts-ignore\n if (!instance.props.render?.$$tippy) {\n if (__DEV__) {\n errorWhen(\n instance.props.animateFill,\n 'The `animateFill` plugin requires the default render function.'\n );\n }\n\n return {};\n }\n\n const {box, content} = getChildren(instance.popper);\n\n const backdrop = instance.props.animateFill\n ? createBackdropElement()\n : null;\n\n return {\n onCreate(): void {\n if (backdrop) {\n box.insertBefore(backdrop, box.firstElementChild!);\n box.setAttribute('data-animatefill', '');\n box.style.overflow = 'hidden';\n\n instance.setProps({arrow: false, animation: 'shift-away'});\n }\n },\n onMount(): void {\n if (backdrop) {\n const {transitionDuration} = box.style;\n const duration = Number(transitionDuration.replace('ms', ''));\n\n // The content should fade in after the backdrop has mostly filled the\n // tooltip element. `clip-path` is the other alternative but is not\n // well-supported and is buggy on some devices.\n content.style.transitionDelay = `${Math.round(duration / 10)}ms`;\n\n backdrop.style.transitionDuration = transitionDuration;\n setVisibilityState([backdrop], 'visible');\n }\n },\n onShow(): void {\n if (backdrop) {\n backdrop.style.transitionDuration = '0ms';\n }\n },\n onHide(): void {\n if (backdrop) {\n setVisibilityState([backdrop], 'hidden');\n }\n },\n };\n },\n};\n\nexport default animateFill;\n\nfunction createBackdropElement(): HTMLDivElement {\n const backdrop = div();\n backdrop.className = BACKDROP_CLASS;\n setVisibilityState([backdrop], 'hidden');\n return backdrop;\n}\n","import {getOwnerDocument, isMouseEvent} from '../dom-utils';\nimport {FollowCursor, Instance} from '../types';\n\nlet mouseCoords = {clientX: 0, clientY: 0};\nlet activeInstances: Array<{instance: Instance; doc: Document}> = [];\n\nfunction storeMouseCoords({clientX, clientY}: MouseEvent): void {\n mouseCoords = {clientX, clientY};\n}\n\nfunction addMouseCoordsListener(doc: Document): void {\n doc.addEventListener('mousemove', storeMouseCoords);\n}\n\nfunction removeMouseCoordsListener(doc: Document): void {\n doc.removeEventListener('mousemove', storeMouseCoords);\n}\n\nconst followCursor: FollowCursor = {\n name: 'followCursor',\n defaultValue: false,\n fn(instance) {\n const reference = instance.reference;\n const doc = getOwnerDocument(instance.props.triggerTarget || reference);\n\n let isInternalUpdate = false;\n let wasFocusEvent = false;\n let isUnmounted = true;\n let prevProps = instance.props;\n\n function getIsInitialBehavior(): boolean {\n return (\n instance.props.followCursor === 'initial' && instance.state.isVisible\n );\n }\n\n function addListener(): void {\n doc.addEventListener('mousemove', onMouseMove);\n }\n\n function removeListener(): void {\n doc.removeEventListener('mousemove', onMouseMove);\n }\n\n function unsetGetReferenceClientRect(): void {\n isInternalUpdate = true;\n instance.setProps({getReferenceClientRect: null});\n isInternalUpdate = false;\n }\n\n function onMouseMove(event: MouseEvent): void {\n // If the instance is interactive, avoid updating the position unless it's\n // over the reference element\n const isCursorOverReference = event.target\n ? reference.contains(event.target as Node)\n : true;\n const {followCursor} = instance.props;\n const {clientX, clientY} = event;\n\n const rect = reference.getBoundingClientRect();\n const relativeX = clientX - rect.left;\n const relativeY = clientY - rect.top;\n\n if (isCursorOverReference || !instance.props.interactive) {\n instance.setProps({\n // @ts-ignore - unneeded DOMRect properties\n getReferenceClientRect() {\n const rect = reference.getBoundingClientRect();\n\n let x = clientX;\n let y = clientY;\n\n if (followCursor === 'initial') {\n x = rect.left + relativeX;\n y = rect.top + relativeY;\n }\n\n const top = followCursor === 'horizontal' ? rect.top : y;\n const right = followCursor === 'vertical' ? rect.right : x;\n const bottom = followCursor === 'horizontal' ? rect.bottom : y;\n const left = followCursor === 'vertical' ? rect.left : x;\n\n return {\n width: right - left,\n height: bottom - top,\n top,\n right,\n bottom,\n left,\n };\n },\n });\n }\n }\n\n function create(): void {\n if (instance.props.followCursor) {\n activeInstances.push({instance, doc});\n addMouseCoordsListener(doc);\n }\n }\n\n function destroy(): void {\n activeInstances = activeInstances.filter(\n (data) => data.instance !== instance\n );\n\n if (activeInstances.filter((data) => data.doc === doc).length === 0) {\n removeMouseCoordsListener(doc);\n }\n }\n\n return {\n onCreate: create,\n onDestroy: destroy,\n onBeforeUpdate(): void {\n prevProps = instance.props;\n },\n onAfterUpdate(_, {followCursor}): void {\n if (isInternalUpdate) {\n return;\n }\n\n if (\n followCursor !== undefined &&\n prevProps.followCursor !== followCursor\n ) {\n destroy();\n\n if (followCursor) {\n create();\n\n if (\n instance.state.isMounted &&\n !wasFocusEvent &&\n !getIsInitialBehavior()\n ) {\n addListener();\n }\n } else {\n removeListener();\n unsetGetReferenceClientRect();\n }\n }\n },\n onMount(): void {\n if (instance.props.followCursor && !wasFocusEvent) {\n if (isUnmounted) {\n onMouseMove(mouseCoords as MouseEvent);\n isUnmounted = false;\n }\n\n if (!getIsInitialBehavior()) {\n addListener();\n }\n }\n },\n onTrigger(_, event): void {\n if (isMouseEvent(event)) {\n mouseCoords = {clientX: event.clientX, clientY: event.clientY};\n }\n wasFocusEvent = event.type === 'focus';\n },\n onHidden(): void {\n if (instance.props.followCursor) {\n unsetGetReferenceClientRect();\n removeListener();\n isUnmounted = true;\n }\n },\n };\n },\n};\n\nexport default followCursor;\n","import {Modifier, Placement} from '@popperjs/core';\nimport {isMouseEvent} from '../dom-utils';\nimport {BasePlacement, InlinePositioning, Props} from '../types';\nimport {arrayFrom, getBasePlacement} from '../utils';\n\nfunction getProps(props: Props, modifier: Modifier): Partial {\n return {\n popperOptions: {\n ...props.popperOptions,\n modifiers: [\n ...(props.popperOptions?.modifiers || []).filter(\n ({name}) => name !== modifier.name\n ),\n modifier,\n ],\n },\n };\n}\n\nconst inlinePositioning: InlinePositioning = {\n name: 'inlinePositioning',\n defaultValue: false,\n fn(instance) {\n const {reference} = instance;\n\n function isEnabled(): boolean {\n return !!instance.props.inlinePositioning;\n }\n\n let placement: Placement;\n let cursorRectIndex = -1;\n let isInternalUpdate = false;\n let triedPlacements: Array = [];\n\n const modifier: Modifier<\n 'tippyInlinePositioning',\n Record\n > = {\n name: 'tippyInlinePositioning',\n enabled: true,\n phase: 'afterWrite',\n fn({state}) {\n if (isEnabled()) {\n if (triedPlacements.indexOf(state.placement) !== -1) {\n triedPlacements = [];\n }\n\n if (\n placement !== state.placement &&\n triedPlacements.indexOf(state.placement) === -1\n ) {\n triedPlacements.push(state.placement);\n instance.setProps({\n // @ts-ignore - unneeded DOMRect properties\n getReferenceClientRect: () =>\n getReferenceClientRect(state.placement),\n });\n }\n\n placement = state.placement;\n }\n },\n };\n\n function getReferenceClientRect(placement: Placement): Partial {\n return getInlineBoundingClientRect(\n getBasePlacement(placement),\n reference.getBoundingClientRect(),\n arrayFrom(reference.getClientRects()),\n cursorRectIndex\n );\n }\n\n function setInternalProps(partialProps: Partial): void {\n isInternalUpdate = true;\n instance.setProps(partialProps);\n isInternalUpdate = false;\n }\n\n function addModifier(): void {\n if (!isInternalUpdate) {\n setInternalProps(getProps(instance.props, modifier));\n }\n }\n\n return {\n onCreate: addModifier,\n onAfterUpdate: addModifier,\n onTrigger(_, event): void {\n if (isMouseEvent(event)) {\n const rects = arrayFrom(instance.reference.getClientRects());\n const cursorRect = rects.find(\n (rect) =>\n rect.left - 2 <= event.clientX &&\n rect.right + 2 >= event.clientX &&\n rect.top - 2 <= event.clientY &&\n rect.bottom + 2 >= event.clientY\n );\n const index = rects.indexOf(cursorRect);\n cursorRectIndex = index > -1 ? index : cursorRectIndex;\n }\n },\n onHidden(): void {\n cursorRectIndex = -1;\n },\n };\n },\n};\n\nexport default inlinePositioning;\n\nexport function getInlineBoundingClientRect(\n currentBasePlacement: BasePlacement | null,\n boundingRect: DOMRect,\n clientRects: DOMRect[],\n cursorRectIndex: number\n): {\n top: number;\n bottom: number;\n left: number;\n right: number;\n width: number;\n height: number;\n} {\n // Not an inline element, or placement is not yet known\n if (clientRects.length < 2 || currentBasePlacement === null) {\n return boundingRect;\n }\n\n // There are two rects and they are disjoined\n if (\n clientRects.length === 2 &&\n cursorRectIndex >= 0 &&\n clientRects[0].left > clientRects[1].right\n ) {\n return clientRects[cursorRectIndex] || boundingRect;\n }\n\n switch (currentBasePlacement) {\n case 'top':\n case 'bottom': {\n const firstRect = clientRects[0];\n const lastRect = clientRects[clientRects.length - 1];\n const isTop = currentBasePlacement === 'top';\n\n const top = firstRect.top;\n const bottom = lastRect.bottom;\n const left = isTop ? firstRect.left : lastRect.left;\n const right = isTop ? firstRect.right : lastRect.right;\n const width = right - left;\n const height = bottom - top;\n\n return {top, bottom, left, right, width, height};\n }\n case 'left':\n case 'right': {\n const minLeft = Math.min(...clientRects.map((rects) => rects.left));\n const maxRight = Math.max(...clientRects.map((rects) => rects.right));\n const measureRects = clientRects.filter((rect) =>\n currentBasePlacement === 'left'\n ? rect.left === minLeft\n : rect.right === maxRight\n );\n\n const top = measureRects[0].top;\n const bottom = measureRects[measureRects.length - 1].bottom;\n const left = minLeft;\n const right = maxRight;\n const width = right - left;\n const height = bottom - top;\n\n return {top, bottom, left, right, width, height};\n }\n default: {\n return boundingRect;\n }\n }\n}\n","import {VirtualElement} from '@popperjs/core';\nimport {ReferenceElement, Sticky} from '../types';\n\nconst sticky: Sticky = {\n name: 'sticky',\n defaultValue: false,\n fn(instance) {\n const {reference, popper} = instance;\n\n function getReference(): ReferenceElement | VirtualElement {\n return instance.popperInstance\n ? instance.popperInstance.state.elements.reference\n : reference;\n }\n\n function shouldCheck(value: 'reference' | 'popper'): boolean {\n return instance.props.sticky === true || instance.props.sticky === value;\n }\n\n let prevRefRect: ClientRect | null = null;\n let prevPopRect: ClientRect | null = null;\n\n function updatePosition(): void {\n const currentRefRect = shouldCheck('reference')\n ? getReference().getBoundingClientRect()\n : null;\n const currentPopRect = shouldCheck('popper')\n ? popper.getBoundingClientRect()\n : null;\n\n if (\n (currentRefRect && areRectsDifferent(prevRefRect, currentRefRect)) ||\n (currentPopRect && areRectsDifferent(prevPopRect, currentPopRect))\n ) {\n if (instance.popperInstance) {\n instance.popperInstance.update();\n }\n }\n\n prevRefRect = currentRefRect;\n prevPopRect = currentPopRect;\n\n if (instance.state.isMounted) {\n requestAnimationFrame(updatePosition);\n }\n }\n\n return {\n onMount(): void {\n if (instance.props.sticky) {\n updatePosition();\n }\n },\n };\n },\n};\n\nexport default sticky;\n\nfunction areRectsDifferent(\n rectA: ClientRect | null,\n rectB: ClientRect | null\n): boolean {\n if (rectA && rectB) {\n return (\n rectA.top !== rectB.top ||\n rectA.right !== rectB.right ||\n rectA.bottom !== rectB.bottom ||\n rectA.left !== rectB.left\n );\n }\n\n return true;\n}\n","import tippy from '../src';\nimport {render} from '../src/template';\n\ntippy.setDefaultProps({render});\n\nexport {default, hideAll} from '../src';\nexport {default as createSingleton} from '../src/addons/createSingleton';\nexport {default as delegate} from '../src/addons/delegate';\nexport {default as animateFill} from '../src/plugins/animateFill';\nexport {default as followCursor} from '../src/plugins/followCursor';\nexport {default as inlinePositioning} from '../src/plugins/inlinePositioning';\nexport {default as sticky} from '../src/plugins/sticky';\nexport {ROUND_ARROW as roundArrow} from '../src/constants';\n"],"names":["ROUND_ARROW","BOX_CLASS","CONTENT_CLASS","BACKDROP_CLASS","ARROW_CLASS","SVG_ARROW_CLASS","TOUCH_OPTIONS","passive","capture","TIPPY_DEFAULT_APPEND_TO","document","body","hasOwnProperty","obj","key","call","getValueAtIndexOrReturn","value","index","defaultValue","Array","isArray","v","isType","type","str","toString","indexOf","invokeWithArgsOrReturn","args","debounce","fn","ms","timeout","arg","clearTimeout","setTimeout","removeProperties","keys","clone","forEach","splitBySpaces","split","filter","Boolean","normalizeToArray","concat","pushIfUnique","arr","push","unique","item","getBasePlacement","placement","arrayFrom","slice","removeUndefinedProps","Object","reduce","acc","undefined","div","createElement","isElement","some","isNodeList","isMouseEvent","isReferenceElement","_tippy","reference","getArrayOfElements","querySelectorAll","setTransitionDuration","els","el","style","transitionDuration","setVisibilityState","state","setAttribute","getOwnerDocument","elementOrElements","element","ownerDocument","isCursorOutsideInteractiveBorder","popperTreeData","event","clientX","clientY","every","popperRect","popperState","props","interactiveBorder","basePlacement","offsetData","modifiersData","offset","topDistance","top","y","bottomDistance","bottom","leftDistance","left","x","rightDistance","right","exceedsTop","exceedsBottom","exceedsLeft","exceedsRight","updateTransitionEndListener","box","action","listener","method","actualContains","parent","child","target","contains","getRootNode","host","currentInput","isTouch","lastMouseMoveTime","onDocumentTouchStart","window","performance","addEventListener","onDocumentMouseMove","now","removeEventListener","onWindowBlur","activeElement","instance","blur","isVisible","bindGlobalEventListeners","isBrowser","isIE11","msCrypto","createMemoryLeakWarning","txt","join","clean","spacesAndTabs","lineStartWithSpaces","replace","trim","getDevMessage","message","getFormattedMessage","visitedMessages","resetVisitedMessages","Set","warnWhen","condition","has","add","console","warn","errorWhen","error","validateTargets","targets","didPassFalsyValue","didPassPlainObject","prototype","String","pluginProps","animateFill","followCursor","inlinePositioning","sticky","renderProps","allowHTML","animation","arrow","content","inertia","maxWidth","role","theme","zIndex","defaultProps","appendTo","aria","expanded","delay","duration","getReferenceClientRect","hideOnClick","ignoreAttributes","interactive","interactiveDebounce","moveTransition","onAfterUpdate","onBeforeUpdate","onCreate","onDestroy","onHidden","onHide","onMount","onShow","onShown","onTrigger","onUntrigger","onClickOutside","plugins","popperOptions","render","showOnCreate","touch","trigger","triggerTarget","defaultKeys","setDefaultProps","partialProps","validateProps","getExtendedPassedProps","passedProps","plugin","name","getDataAttributeProps","propKeys","valueAsString","getAttribute","JSON","parse","e","evaluateProps","out","prop","nonPluginProps","didPassUnknownProp","length","innerHTML","dangerouslySetInnerHTML","html","createArrowElement","className","appendChild","setContent","textContent","getChildren","popper","firstElementChild","boxChildren","children","find","node","classList","backdrop","onUpdate","prevProps","nextProps","removeAttribute","removeChild","$$tippy","idCounter","mouseMoveListeners","mountedInstances","createTippy","showTimeout","hideTimeout","scheduleHideAnimationFrame","isVisibleFromClick","didHideDueToDocumentMouseDown","didTouchMove","ignoreOnFirstUpdate","lastTriggerEvent","currentTransitionEndListener","onFirstUpdate","listeners","debouncedOnMouseMove","onMouseMove","currentTarget","id","popperInstance","isEnabled","isDestroyed","isMounted","isShown","clearDelayTimeouts","setProps","show","hide","hideWithInteractivity","enable","disable","unmount","destroy","pluginsHooks","map","hasAriaExpanded","hasAttribute","addListeners","handleAriaExpandedAttribute","handleStyles","invokeHook","scheduleShow","getDocument","getNormalizedTouchSettings","getIsCustomTouchBehavior","getIsDefaultRenderFn","getCurrentTarget","parentNode","getDefaultTemplateChildren","getDelay","isShow","fromHide","pointerEvents","hook","shouldInvokePropsHook","pluginHooks","handleAriaContentAttribute","attr","nodes","currentValue","nextValue","cleanupInteractiveMouseListeners","onDocumentPress","actualTarget","composedPath","removeDocumentPress","onTouchMove","onTouchStart","addDocumentPress","doc","onTransitionedOut","callback","onTransitionEnd","onTransitionedIn","on","eventType","handler","options","onMouseLeave","onBlurOrFocusOut","removeListeners","shouldScheduleClickHide","isEventListenerStopped","wasFocused","scheduleHide","isCursorOverReferenceOrPopper","getNestedPopperTree","getBoundingClientRect","shouldBail","relatedTarget","createPopperInstance","destroyPopperInstance","computedReference","contextElement","tippyModifier","enabled","phase","requires","attributes","modifiers","padding","adaptive","createPopper","mount","nextElementSibling","touchValue","touchDelay","requestAnimationFrame","cancelAnimationFrame","nestedPopper","forceUpdate","isAlreadyVisible","isDisabled","isTouchAndTouchDisabled","visibility","transition","offsetHeight","isAlreadyHidden","i","tippy","optionalProps","elements","isSingleContentElement","isMoreThanOneReferenceElement","instances","hideAll","excludedReferenceOrInstance","exclude","isExcluded","originalDuration","applyStylesModifier","applyStyles","effect","initialStyles","position","strategy","margin","assign","styles","createSingleton","tippyInstances","individualInstances","references","triggerTargets","overrides","interceptSetPropsCleanups","shownOnCreate","setTriggerTargets","setReferences","enableInstances","interceptSetProps","singleton","originalSetProps","prepareInstance","overrideProps","originalShow","ref","showNext","first","showPrevious","last","setInstances","nextInstances","BUBBLING_EVENTS_MAP","mouseover","focusin","click","delegate","childTippyInstances","disabled","nativeProps","parentProps","childProps","returnValue","normalizedReturnValue","targetNode","closest","addEventListeners","removeEventListeners","applyMutations","originalDestroy","originalEnable","originalDisable","shouldDestroyChildInstances","createBackdropElement","insertBefore","overflow","Number","transitionDelay","Math","round","mouseCoords","activeInstances","storeMouseCoords","addMouseCoordsListener","removeMouseCoordsListener","isInternalUpdate","wasFocusEvent","isUnmounted","getIsInitialBehavior","addListener","removeListener","unsetGetReferenceClientRect","isCursorOverReference","rect","relativeX","relativeY","width","height","create","data","_","getProps","modifier","cursorRectIndex","triedPlacements","getInlineBoundingClientRect","getClientRects","setInternalProps","addModifier","rects","cursorRect","currentBasePlacement","boundingRect","clientRects","firstRect","lastRect","isTop","minLeft","min","maxRight","max","measureRects","getReference","shouldCheck","prevRefRect","prevPopRect","updatePosition","currentRefRect","currentPopRect","areRectsDifferent","update","rectA","rectB"],"mappings":";;;;;;;IAAaA,WAAW,GACtB;AAEK,IAAMC,SAAS,cAAf;AACA,IAAMC,aAAa,kBAAnB;AACA,IAAMC,cAAc,mBAApB;AACA,IAAMC,WAAW,gBAAjB;AACA,IAAMC,eAAe,oBAArB;AAEA,I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FtC,EAGE;AACA,YAAI5W,QAAQ,CAACgJ,cAAb,EAA6B;AAC3BhJ,UAAAA,QAAQ,CAACgJ,cAAT,CAAwB8N,MAAxB;AACD;AACF;;AAEDN,MAAAA,WAAW,GAAGG,cAAd;AACAF,MAAAA,WAAW,GAAGG,cAAd;;AAEA,UAAI5W,QAAQ,CAAC1D,KAAT,CAAe6M,SAAnB,EAA8B;AAC5BqF,QAAAA,qBAAqB,CAACkI,cAAD,CAArB;AACD;AACF;;AAED,WAAO;AACLtS,MAAAA,OADK,qBACW;AACd,YAAIpE,QAAQ,CAAC5C,KAAT,CAAemF,MAAnB,EAA2B;AACzBmU,UAAAA,cAAc;AACf;AACF;AALI,KAAP;AAOD;AAnDoB,CAAvB;AAsDA;AAEA,SAASG,iBAAT,CACEE,KADF,EAEEC,KAFF,EAGW;AACT,MAAID,KAAK,IAAIC,KAAb,EAAoB;AAClB,WACED,KAAK,CAACpZ,GAAN,KAAcqZ,KAAK,CAACrZ,GAApB,IACAoZ,KAAK,CAAC5Y,KAAN,KAAgB6Y,KAAK,CAAC7Y,KADtB,IAEA4Y,KAAK,CAACjZ,MAAN,KAAiBkZ,KAAK,CAAClZ,MAFvB,IAGAiZ,KAAK,CAAC/Y,IAAN,KAAegZ,KAAK,CAAChZ,IAJvB;AAMD;;AAED,SAAO,IAAP;AACD;;ACtEDoR,KAAK,CAAClK,eAAN,CAAsB;AAACN,EAAAA,MAAM,EAANA;AAAD,CAAtB;;;;;"}
\ No newline at end of file
diff --git a/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/index.d.ts b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/index.d.ts
new file mode 100644
index 000000000..4c3891888
--- /dev/null
+++ b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/index.d.ts
@@ -0,0 +1,260 @@
+import * as Popper from '@popperjs/core';
+
+export type BasePlacement = Popper.BasePlacement;
+
+export type Placement = Popper.Placement;
+
+export type Content =
+ | string
+ | Element
+ | DocumentFragment
+ | ((ref: Element) => string | Element | DocumentFragment);
+
+export type SingleTarget = Element;
+
+export type MultipleTargets = string | Element[] | NodeList;
+
+export type Targets = SingleTarget | MultipleTargets;
+
+export interface ReferenceElement extends Element {
+ _tippy?: Instance;
+}
+
+export interface PopperElement extends HTMLDivElement {
+ _tippy?: Instance;
+}
+
+export interface LifecycleHooks {
+ onAfterUpdate(
+ instance: Instance,
+ partialProps: Partial
+ ): void;
+ onBeforeUpdate(
+ instance: Instance,
+ partialProps: Partial
+ ): void;
+ onCreate(instance: Instance): void;
+ onDestroy(instance: Instance): void;
+ onHidden(instance: Instance): void;
+ onHide(instance: Instance): void | false;
+ onMount(instance: Instance): void;
+ onShow(instance: Instance): void | false;
+ onShown(instance: Instance): void;
+ onTrigger(instance: Instance, event: Event): void;
+ onUntrigger(instance: Instance, event: Event): void;
+ onClickOutside(instance: Instance, event: Event): void;
+}
+
+export interface RenderProps {
+ allowHTML: boolean;
+ animation: string | boolean;
+ arrow: boolean | string | SVGElement | DocumentFragment;
+ content: Content;
+ inertia: boolean;
+ maxWidth: number | string;
+ role: string;
+ theme: string;
+ zIndex: number;
+}
+
+export interface GetReferenceClientRect {
+ (): ClientRect | DOMRect;
+ contextElement?: Element;
+}
+
+export interface Props extends LifecycleHooks, RenderProps {
+ animateFill: boolean;
+ appendTo: 'parent' | Element | ((ref: Element) => Element);
+ aria: {
+ content?: 'auto' | 'describedby' | 'labelledby' | null;
+ expanded?: 'auto' | boolean;
+ };
+ delay: number | [number | null, number | null];
+ duration: number | [number | null, number | null];
+ followCursor: boolean | 'horizontal' | 'vertical' | 'initial';
+ getReferenceClientRect: null | GetReferenceClientRect;
+ hideOnClick: boolean | 'toggle';
+ ignoreAttributes: boolean;
+ inlinePositioning: boolean;
+ interactive: boolean;
+ interactiveBorder: number;
+ interactiveDebounce: number;
+ moveTransition: string;
+ offset:
+ | [number, number]
+ | (({
+ placement,
+ popper,
+ reference,
+ }: {
+ placement: Placement;
+ popper: Popper.Rect;
+ reference: Popper.Rect;
+ }) => [number, number]);
+ placement: Placement;
+ plugins: Plugin[];
+ popperOptions: Partial;
+ render:
+ | ((
+ instance: Instance
+ ) => {
+ popper: PopperElement;
+ onUpdate?: (prevProps: Props, nextProps: Props) => void;
+ })
+ | null;
+ showOnCreate: boolean;
+ sticky: boolean | 'reference' | 'popper';
+ touch: boolean | 'hold' | ['hold', number];
+ trigger: string;
+ triggerTarget: Element | Element[] | null;
+}
+
+export interface DefaultProps extends Omit {
+ delay: number | [number, number];
+ duration: number | [number, number];
+}
+
+export interface Instance {
+ clearDelayTimeouts(): void;
+ destroy(): void;
+ disable(): void;
+ enable(): void;
+ hide(): void;
+ hideWithInteractivity(event: MouseEvent): void;
+ id: number;
+ plugins: Plugin[];
+ popper: PopperElement;
+ popperInstance: Popper.Instance | null;
+ props: TProps;
+ reference: ReferenceElement;
+ setContent(content: Content): void;
+ setProps(partialProps: Partial): void;
+ show(): void;
+ state: {
+ isEnabled: boolean;
+ isVisible: boolean;
+ isDestroyed: boolean;
+ isMounted: boolean;
+ isShown: boolean;
+ };
+ unmount(): void;
+}
+
+export interface TippyStatics {
+ readonly currentInput: {isTouch: boolean};
+ readonly defaultProps: DefaultProps;
+ setDefaultProps(partialProps: Partial): void;
+}
+
+export interface Tippy extends TippyStatics {
+ (targets: SingleTarget, optionalProps?: Partial): Instance;
+}
+
+export interface Tippy extends TippyStatics {
+ (targets: MultipleTargets, optionalProps?: Partial): Instance<
+ TProps
+ >[];
+}
+
+declare const tippy: Tippy;
+
+// =============================================================================
+// Addon types
+// =============================================================================
+export interface DelegateInstance extends Instance {
+ destroy(shouldDestroyTargetInstances?: boolean): void;
+}
+
+export interface Delegate {
+ (
+ targets: SingleTarget,
+ props: Partial & {target: string}
+ ): DelegateInstance;
+}
+
+export interface Delegate {
+ (
+ targets: MultipleTargets,
+ props: Partial & {target: string}
+ ): DelegateInstance[];
+}
+
+export type CreateSingletonProps = TProps & {
+ overrides: Array;
+};
+
+export type CreateSingletonInstance = Instance<
+ TProps
+> & {
+ setInstances(instances: Instance[]): void;
+ show(target?: ReferenceElement | Instance | number): void;
+ showNext(): void;
+ showPrevious(): void;
+};
+
+export type CreateSingleton = (
+ tippyInstances: Instance[],
+ optionalProps?: Partial>
+) => CreateSingletonInstance>;
+
+declare const delegate: Delegate;
+declare const createSingleton: CreateSingleton;
+
+// =============================================================================
+// Plugin types
+// =============================================================================
+export interface Plugin {
+ name?: string;
+ defaultValue?: any;
+ fn(instance: Instance): Partial>;
+}
+
+export interface AnimateFill extends Plugin {
+ name: 'animateFill';
+ defaultValue: false;
+}
+
+export interface FollowCursor extends Plugin {
+ name: 'followCursor';
+ defaultValue: false;
+}
+
+export interface InlinePositioning extends Plugin {
+ name: 'inlinePositioning';
+ defaultValue: false;
+}
+
+export interface Sticky extends Plugin {
+ name: 'sticky';
+ defaultValue: false;
+}
+
+declare const animateFill: AnimateFill;
+declare const followCursor: FollowCursor;
+declare const inlinePositioning: InlinePositioning;
+declare const sticky: Sticky;
+
+// =============================================================================
+// Misc types
+// =============================================================================
+export interface HideAllOptions {
+ duration?: number;
+ exclude?: Instance | ReferenceElement;
+}
+
+export type HideAll = (options?: HideAllOptions) => void;
+
+declare const hideAll: HideAll;
+declare const roundArrow: string;
+
+export default tippy;
+export {
+ hideAll,
+ delegate,
+ createSingleton,
+ animateFill,
+ followCursor,
+ inlinePositioning,
+ sticky,
+ roundArrow,
+};
diff --git a/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/package.json b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/package.json
new file mode 100644
index 000000000..13d211d45
--- /dev/null
+++ b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/package.json
@@ -0,0 +1,157 @@
+{
+ "name": "tippy.js",
+ "version": "6.3.7",
+ "description": "The complete tooltip, popover, dropdown, and menu solution for the web",
+ "main": "dist/tippy.cjs.js",
+ "module": "dist/tippy.esm.js",
+ "unpkg": "dist/tippy-bundle.umd.min.js",
+ "types": "index.d.ts",
+ "sideEffects": [
+ "**/*.css"
+ ],
+ "author": "atomiks",
+ "contributors": [
+ "Brett Zamir"
+ ],
+ "license": "MIT",
+ "bugs": "https://github.com/atomiks/tippyjs/issues",
+ "homepage": "https://atomiks.github.io/tippyjs/",
+ "keywords": [
+ "tooltip",
+ "popover",
+ "popper",
+ "dropdown",
+ "popup",
+ "tippy",
+ "tippy.js"
+ ],
+ "files": [
+ "dist/",
+ "animations/",
+ "themes/",
+ "headless/",
+ "index.d.ts"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/atomiks/tippyjs.git"
+ },
+ "scripts": {
+ "dev": "cross-env NODE_ENV=dev rollup -c .config/rollup.config.js --watch",
+ "build": "node build/index.js && rollup -c .config/rollup.config.js && bundlesize",
+ "build:visual": "cross-env NODE_ENV=test rollup -c .config/rollup.config.js",
+ "serve": "serve test/visual",
+ "test:dom": "jest unit integration --coverage",
+ "test:functional": "jest functional",
+ "test:types": "tsc && tsd",
+ "test": "yarn test:types && yarn test:dom && yarn test:functional",
+ "lint": "eslint . --ext .ts,.js",
+ "format": "prettier --write \"**/*.{js,ts,json,md,mdx,scss,css}\" --ignore-path .config/.prettierignore",
+ "clean": "rimraf dist/ themes/ animations/ coverage/ .devserver/ .cache/ ./index.d.ts",
+ "prepare": "yarn clean && yarn build"
+ },
+ "babel": {
+ "extends": "./.config/babel.config"
+ },
+ "jest": {
+ "preset": "./.config/jest.config"
+ },
+ "eslintConfig": {
+ "extends": "./.config/eslint.config"
+ },
+ "prettier": {
+ "singleQuote": true,
+ "bracketSpacing": false,
+ "proseWrap": "always"
+ },
+ "browserslist": [
+ "> 0.5%",
+ "not dead",
+ "not safari < 8"
+ ],
+ "bundlesize": [
+ {
+ "path": "dist/tippy-bundle.umd.min.js",
+ "maxSize": "10 kB"
+ },
+ {
+ "path": "headless/dist/tippy-headless.umd.min.js",
+ "maxSize": "10 kB"
+ },
+ {
+ "path": "dist/tippy.umd.min.js",
+ "maxSize": "10 kB"
+ },
+ {
+ "path": "dist/tippy.css",
+ "maxSize": "5 kB"
+ }
+ ],
+ "husky": {
+ "hooks": {
+ "pre-commit": "lint-staged"
+ }
+ },
+ "lint-staged": {
+ "src/**/*.ts": [
+ "jest --findRelatedTests",
+ "eslint . --ext .ts,.js",
+ "git add"
+ ],
+ "{build,src,test,website/src}/**/*.{ts,js,json,css,scss,md}": [
+ "prettier --write",
+ "git add"
+ ]
+ },
+ "devDependencies": {
+ "@babel/core": "^7.8.3",
+ "@babel/preset-env": "^7.8.3",
+ "@babel/preset-typescript": "^7.13.0",
+ "@testing-library/dom": "^6.11.0",
+ "@types/node": "^12.12.25",
+ "@typescript-eslint/eslint-plugin": "^4.16.1",
+ "@typescript-eslint/parser": "^4.16.1",
+ "autoprefixer": "^9.7.4",
+ "babel-jest": "^25.3.0",
+ "babel-plugin-dev-expression": "^0.2.2",
+ "bundlesize": "^0.18.0",
+ "colorette": "^1.1.0",
+ "core-js": "^3.6.4",
+ "cross-env": "^7.0.0",
+ "cssnano": "^4.1.10",
+ "dotenv": "^8.2.0",
+ "eslint": "^6.8.0",
+ "eslint-config-prettier": "^6.9.0",
+ "husky": "^3.1.0",
+ "jest": "^25.3.0",
+ "jest-environment-jsdom-fourteen": "^1.0.1",
+ "jest-image-snapshot": "^2.12.0",
+ "jest-puppeteer": "^4.4.0",
+ "jest-puppeteer-docker": "^1.3.2",
+ "lint-staged": "^9.5.0",
+ "postcss": "^7.0.26",
+ "poster": "0.0.9",
+ "prettier": "^2.0.1",
+ "promise": "^8.0.3",
+ "puppeteer": "^2.1.1",
+ "rimraf": "^3.0.0",
+ "rollup": "^1.29.1",
+ "rollup-plugin-babel": "^4.3.3",
+ "rollup-plugin-commonjs": "^10.0.2",
+ "rollup-plugin-css-only": "^1.0.0",
+ "rollup-plugin-json": "^4.0.0",
+ "rollup-plugin-livereload": "^1.0.4",
+ "rollup-plugin-node-resolve": "^5.2.0",
+ "rollup-plugin-replace": "^2.2.0",
+ "rollup-plugin-sass": "^1.2.2",
+ "rollup-plugin-serve": "^1.0.1",
+ "rollup-plugin-terser": "^5.2.0",
+ "sass": "^1.25.0",
+ "serve": "^11.3.0",
+ "tsd": "^0.14.0",
+ "typescript": "^4.2.2"
+ },
+ "dependencies": {
+ "@popperjs/core": "^2.9.0"
+ }
+}
diff --git a/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/themes/light-border.css b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/themes/light-border.css
new file mode 100644
index 000000000..2b25c61af
--- /dev/null
+++ b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/themes/light-border.css
@@ -0,0 +1 @@
+.tippy-box[data-theme~=light-border]{background-color:#fff;background-clip:padding-box;border:1px solid rgba(0,8,16,.15);color:#333;box-shadow:0 4px 14px -2px rgba(0,8,16,.08)}.tippy-box[data-theme~=light-border]>.tippy-backdrop{background-color:#fff}.tippy-box[data-theme~=light-border]>.tippy-arrow:after,.tippy-box[data-theme~=light-border]>.tippy-svg-arrow:after{content:"";position:absolute;z-index:-1}.tippy-box[data-theme~=light-border]>.tippy-arrow:after{border-color:transparent;border-style:solid}.tippy-box[data-theme~=light-border][data-placement^=top]>.tippy-arrow:before{border-top-color:#fff}.tippy-box[data-theme~=light-border][data-placement^=top]>.tippy-arrow:after{border-top-color:rgba(0,8,16,.2);border-width:7px 7px 0;top:17px;left:1px}.tippy-box[data-theme~=light-border][data-placement^=top]>.tippy-svg-arrow>svg{top:16px}.tippy-box[data-theme~=light-border][data-placement^=top]>.tippy-svg-arrow:after{top:17px}.tippy-box[data-theme~=light-border][data-placement^=bottom]>.tippy-arrow:before{border-bottom-color:#fff;bottom:16px}.tippy-box[data-theme~=light-border][data-placement^=bottom]>.tippy-arrow:after{border-bottom-color:rgba(0,8,16,.2);border-width:0 7px 7px;bottom:17px;left:1px}.tippy-box[data-theme~=light-border][data-placement^=bottom]>.tippy-svg-arrow>svg{bottom:16px}.tippy-box[data-theme~=light-border][data-placement^=bottom]>.tippy-svg-arrow:after{bottom:17px}.tippy-box[data-theme~=light-border][data-placement^=left]>.tippy-arrow:before{border-left-color:#fff}.tippy-box[data-theme~=light-border][data-placement^=left]>.tippy-arrow:after{border-left-color:rgba(0,8,16,.2);border-width:7px 0 7px 7px;left:17px;top:1px}.tippy-box[data-theme~=light-border][data-placement^=left]>.tippy-svg-arrow>svg{left:11px}.tippy-box[data-theme~=light-border][data-placement^=left]>.tippy-svg-arrow:after{left:12px}.tippy-box[data-theme~=light-border][data-placement^=right]>.tippy-arrow:before{border-right-color:#fff;right:16px}.tippy-box[data-theme~=light-border][data-placement^=right]>.tippy-arrow:after{border-width:7px 7px 7px 0;right:17px;top:1px;border-right-color:rgba(0,8,16,.2)}.tippy-box[data-theme~=light-border][data-placement^=right]>.tippy-svg-arrow>svg{right:11px}.tippy-box[data-theme~=light-border][data-placement^=right]>.tippy-svg-arrow:after{right:12px}.tippy-box[data-theme~=light-border]>.tippy-svg-arrow{fill:#fff}.tippy-box[data-theme~=light-border]>.tippy-svg-arrow:after{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMCA2czEuNzk2LS4wMTMgNC42Ny0zLjYxNUM1Ljg1MS45IDYuOTMuMDA2IDggMGMxLjA3LS4wMDYgMi4xNDguODg3IDMuMzQzIDIuMzg1QzE0LjIzMyA2LjAwNSAxNiA2IDE2IDZIMHoiIGZpbGw9InJnYmEoMCwgOCwgMTYsIDAuMikiLz48L3N2Zz4=);background-size:16px 6px;width:16px;height:6px}
\ No newline at end of file
diff --git a/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/themes/light.css b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/themes/light.css
new file mode 100644
index 000000000..3ed9d4e6b
--- /dev/null
+++ b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/themes/light.css
@@ -0,0 +1 @@
+.tippy-box[data-theme~=light]{color:#26323d;box-shadow:0 0 20px 4px rgba(154,161,177,.15),0 4px 80px -8px rgba(36,40,47,.25),0 4px 4px -2px rgba(91,94,105,.15);background-color:#fff}.tippy-box[data-theme~=light][data-placement^=top]>.tippy-arrow:before{border-top-color:#fff}.tippy-box[data-theme~=light][data-placement^=bottom]>.tippy-arrow:before{border-bottom-color:#fff}.tippy-box[data-theme~=light][data-placement^=left]>.tippy-arrow:before{border-left-color:#fff}.tippy-box[data-theme~=light][data-placement^=right]>.tippy-arrow:before{border-right-color:#fff}.tippy-box[data-theme~=light]>.tippy-backdrop{background-color:#fff}.tippy-box[data-theme~=light]>.tippy-svg-arrow{fill:#fff}
\ No newline at end of file
diff --git a/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/themes/material.css b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/themes/material.css
new file mode 100644
index 000000000..b3bda3b7f
--- /dev/null
+++ b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/themes/material.css
@@ -0,0 +1 @@
+.tippy-box[data-theme~=material]{background-color:#505355;font-weight:600}.tippy-box[data-theme~=material][data-placement^=top]>.tippy-arrow:before{border-top-color:#505355}.tippy-box[data-theme~=material][data-placement^=bottom]>.tippy-arrow:before{border-bottom-color:#505355}.tippy-box[data-theme~=material][data-placement^=left]>.tippy-arrow:before{border-left-color:#505355}.tippy-box[data-theme~=material][data-placement^=right]>.tippy-arrow:before{border-right-color:#505355}.tippy-box[data-theme~=material]>.tippy-backdrop{background-color:#505355}.tippy-box[data-theme~=material]>.tippy-svg-arrow{fill:#505355}
\ No newline at end of file
diff --git a/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/themes/translucent.css b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/themes/translucent.css
new file mode 100644
index 000000000..742b141ad
--- /dev/null
+++ b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/node_modules/tippy.js/themes/translucent.css
@@ -0,0 +1 @@
+.tippy-box[data-theme~=translucent]{background-color:rgba(0,0,0,.7)}.tippy-box[data-theme~=translucent]>.tippy-arrow{width:14px;height:14px}.tippy-box[data-theme~=translucent][data-placement^=top]>.tippy-arrow:before{border-width:7px 7px 0;border-top-color:rgba(0,0,0,.7)}.tippy-box[data-theme~=translucent][data-placement^=bottom]>.tippy-arrow:before{border-width:0 7px 7px;border-bottom-color:rgba(0,0,0,.7)}.tippy-box[data-theme~=translucent][data-placement^=left]>.tippy-arrow:before{border-width:7px 0 7px 7px;border-left-color:rgba(0,0,0,.7)}.tippy-box[data-theme~=translucent][data-placement^=right]>.tippy-arrow:before{border-width:7px 7px 7px 0;border-right-color:rgba(0,0,0,.7)}.tippy-box[data-theme~=translucent]>.tippy-backdrop{background-color:rgba(0,0,0,.7)}.tippy-box[data-theme~=translucent]>.tippy-svg-arrow{fill:rgba(0,0,0,.7)}
\ No newline at end of file
diff --git a/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/package.json b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/package.json
new file mode 100644
index 000000000..e81594a48
--- /dev/null
+++ b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/package.json
@@ -0,0 +1,13 @@
+{
+ "name": "~TODO~",
+ "version": "0.0.1",
+ "scripts": {
+ "dev": "./node_modules/vite/bin/vite.js dev",
+ "build": "./node_modules/vite/bin/vite.js build",
+ "preview": "./node_modules/vite/bin/vite.js preview"
+ },
+ "dependencies": {
+ "tippy.js": "^6.3.7"
+ },
+ "type": "module"
+}
diff --git a/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/src/lib/App.svelte b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/src/lib/App.svelte
new file mode 100644
index 000000000..a15a5222d
--- /dev/null
+++ b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-a/src/lib/App.svelte
@@ -0,0 +1,23 @@
+
+
+
+
+
+ Hover me
+
\ No newline at end of file
diff --git a/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-b/src/lib/App.svelte b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-b/src/lib/App.svelte
new file mode 100644
index 000000000..facd7786c
--- /dev/null
+++ b/content/tutorial/02-advanced-svelte/04-actions/02-adding-parameters-to-actions/app-b/src/lib/App.svelte
@@ -0,0 +1,26 @@
+
+
+
+
+
+ Hover me
+
\ No newline at end of file
diff --git a/content/tutorial/03-advanced-svelte/04-actions/meta.json b/content/tutorial/02-advanced-svelte/04-actions/meta.json
similarity index 100%
rename from content/tutorial/03-advanced-svelte/04-actions/meta.json
rename to content/tutorial/02-advanced-svelte/04-actions/meta.json
diff --git a/content/tutorial/02-advanced-svelte/05-bindings/01-contenteditable-bindings/README.md b/content/tutorial/02-advanced-svelte/05-bindings/01-contenteditable-bindings/README.md
new file mode 100644
index 000000000..c3ec72544
--- /dev/null
+++ b/content/tutorial/02-advanced-svelte/05-bindings/01-contenteditable-bindings/README.md
@@ -0,0 +1,10 @@
+---
+title: Contenteditable bindings
+---
+
+Elements with a `contenteditable` attribute support `textContent` and `innerHTML` bindings:
+
+```svelte
+/// file: App.svelte
+
+```
diff --git a/content/tutorial/03-advanced-svelte/05-bindings/01-contenteditable-bindings/app-a/src/lib/App.svelte b/content/tutorial/02-advanced-svelte/05-bindings/01-contenteditable-bindings/app-a/src/lib/App.svelte
similarity index 85%
rename from content/tutorial/03-advanced-svelte/05-bindings/01-contenteditable-bindings/app-a/src/lib/App.svelte
rename to content/tutorial/02-advanced-svelte/05-bindings/01-contenteditable-bindings/app-a/src/lib/App.svelte
index 2d01a6ced..2724120ac 100644
--- a/content/tutorial/03-advanced-svelte/05-bindings/01-contenteditable-bindings/app-a/src/lib/App.svelte
+++ b/content/tutorial/02-advanced-svelte/05-bindings/01-contenteditable-bindings/app-a/src/lib/App.svelte
@@ -2,7 +2,7 @@
let html = '
Write some text!
';
-
+
{html}
diff --git a/content/tutorial/03-advanced-svelte/05-bindings/01-contenteditable-bindings/app-b/src/lib/App.svelte b/content/tutorial/02-advanced-svelte/05-bindings/01-contenteditable-bindings/app-b/src/lib/App.svelte
similarity index 77%
rename from content/tutorial/03-advanced-svelte/05-bindings/01-contenteditable-bindings/app-b/src/lib/App.svelte
rename to content/tutorial/02-advanced-svelte/05-bindings/01-contenteditable-bindings/app-b/src/lib/App.svelte
index 45c87471e..d80585640 100644
--- a/content/tutorial/03-advanced-svelte/05-bindings/01-contenteditable-bindings/app-b/src/lib/App.svelte
+++ b/content/tutorial/02-advanced-svelte/05-bindings/01-contenteditable-bindings/app-b/src/lib/App.svelte
@@ -2,10 +2,7 @@
let html = '
Write some text!
';
-
+
{html}
diff --git a/content/tutorial/03-advanced-svelte/05-bindings/02-each-block-bindings/README.md b/content/tutorial/02-advanced-svelte/05-bindings/02-each-block-bindings/README.md
similarity index 62%
rename from content/tutorial/03-advanced-svelte/05-bindings/02-each-block-bindings/README.md
rename to content/tutorial/02-advanced-svelte/05-bindings/02-each-block-bindings/README.md
index 0e922aef1..c898b5869 100644
--- a/content/tutorial/03-advanced-svelte/05-bindings/02-each-block-bindings/README.md
+++ b/content/tutorial/02-advanced-svelte/05-bindings/02-each-block-bindings/README.md
@@ -7,15 +7,18 @@ You can even bind to properties inside an `each` block.
```svelte
/// file: App.svelte
{#each todos as todo}
-
+
+
+
diff --git a/content/tutorial/02-advanced-svelte/05-bindings/03-media-elements/README.md b/content/tutorial/02-advanced-svelte/05-bindings/03-media-elements/README.md
new file mode 100644
index 000000000..30ca4b8d0
--- /dev/null
+++ b/content/tutorial/02-advanced-svelte/05-bindings/03-media-elements/README.md
@@ -0,0 +1,84 @@
+---
+title: Media elements
+---
+
+You can bind to properties of `