This commit is contained in:
2025-06-16 13:37:14 +02:00
parent ac273655e6
commit a8b82208f7
5100 changed files with 737524 additions and 2 deletions

21
node_modules/preact/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015-present Jason Miller
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.

185
node_modules/preact/README.md generated vendored Normal file
View File

@@ -0,0 +1,185 @@
<p align="center">
<a href="https://preactjs.com" target="_blank">
![Preact](https://raw.githubusercontent.com/preactjs/preact/8b0bcc927995c188eca83cba30fbc83491cc0b2f/logo.svg?sanitize=true 'Preact')
</a>
</p>
<p align="center">Fast <b>3kB</b> alternative to React with the same modern API.</p>
**All the power of Virtual DOM components, without the overhead:**
- Familiar React API & patterns: ES6 Class, hooks, and Functional Components
- Extensive React compatibility via a simple [preact/compat] alias
- Everything you need: JSX, <abbr title="Virtual DOM">VDOM</abbr>, [DevTools], <abbr title="Hot Module Replacement">HMR</abbr>, <abbr title="Server-Side Rendering">SSR</abbr>.
- Highly optimized diff algorithm and seamless hydration from Server Side Rendering
- Supports all modern browsers and IE11
- Transparent asynchronous rendering with a pluggable scheduler
### 💁 More information at the [Preact Website ➞](https://preactjs.com)
<table border="0">
<tbody>
<tr>
<td>
[![npm](https://img.shields.io/npm/v/preact.svg)](https://www.npmjs.com/package/preact)
[![Preact Slack Community](https://img.shields.io/badge/Slack%20Community-preact.slack.com-blue)](https://chat.preactjs.com)
[![OpenCollective Backers](https://opencollective.com/preact/backers/badge.svg)](#backers)
[![OpenCollective Sponsors](https://opencollective.com/preact/sponsors/badge.svg)](#sponsors)
[![coveralls](https://img.shields.io/coveralls/preactjs/preact/main.svg)](https://coveralls.io/github/preactjs/preact)
[![gzip size](https://img.badgesize.io/https://unpkg.com/preact/dist/preact.min.js?compression=gzip&label=gzip)](https://unpkg.com/preact/dist/preact.min.js)
[![brotli size](https://img.badgesize.io/https://unpkg.com/preact/dist/preact.min.js?compression=brotli&label=brotli)](https://unpkg.com/preact/dist/preact.min.js)
</td>
</tr>
</tbody>
</table>
You can find some awesome libraries in the [awesome-preact list](https://github.com/preactjs/awesome-preact) :sunglasses:
---
## Getting Started
> 💁 _**Note:** You [don't need ES2015 to use Preact](https://github.com/developit/preact-in-es3)... but give it a try!_
#### Tutorial: Building UI with Preact
With Preact, you create user interfaces by assembling trees of components and elements. Components are functions or classes that return a description of what their tree should output. These descriptions are typically written in [JSX](https://facebook.github.io/jsx/) (shown underneath), or [HTM](https://github.com/developit/htm) which leverages standard JavaScript Tagged Templates. Both syntaxes can express trees of elements with "props" (similar to HTML attributes) and children.
To get started using Preact, first look at the render() function. This function accepts a tree description and creates the structure described. Next, it appends this structure to a parent DOM element provided as the second argument. Future calls to render() will reuse the existing tree and update it in-place in the DOM. Internally, render() will calculate the difference from previous outputted structures in an attempt to perform as few DOM operations as possible.
```js
import { h, render } from 'preact';
// Tells babel to use h for JSX. It's better to configure this globally.
// See https://babeljs.io/docs/en/babel-plugin-transform-react-jsx#usage
// In tsconfig you can specify this with the jsxFactory
/** @jsx h */
// create our tree and append it to document.body:
render(
<main>
<h1>Hello</h1>
</main>,
document.body
);
// update the tree in-place:
render(
<main>
<h1>Hello World!</h1>
</main>,
document.body
);
// ^ this second invocation of render(...) will use a single DOM call to update the text of the <h1>
```
Hooray! render() has taken our structure and output a User Interface! This approach demonstrates a simple case, but would be difficult to use as an application grows in complexity. Each change would be forced to calculate the difference between the current and updated structure for the entire application. Components can help here by dividing the User Interface into nested Components each can calculate their difference from their mounted point. Here's an example:
```js
import { render, h } from 'preact';
import { useState } from 'preact/hooks';
/** @jsx h */
const App = () => {
const [input, setInput] = useState('');
return (
<div>
<p>Do you agree to the statement: "Preact is awesome"?</p>
<input value={input} onInput={e => setInput(e.target.value)} />
</div>
);
};
render(<App />, document.body);
```
---
## Sponsors
Become a sponsor and get your logo on our README on GitHub with a link to your site. [[Become a sponsor](https://opencollective.com/preact#sponsor)]
<a href="https://opencollective.com/preact/sponsor/0/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/0/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/1/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/1/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/2/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/2/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/3/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/3/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/4/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/4/avatar.svg"></a>
<a href="https://snyk.co/preact" target="_blank"><img src="https://res.cloudinary.com/snyk/image/upload/snyk-marketingui/brand-logos/wordmark-logo-color.svg" width="192" height="64"></a>
<a href="https://opencollective.com/preact/sponsor/5/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/5/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/6/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/7/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/8/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/9/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/9/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/10/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/10/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/11/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/11/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/12/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/12/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/13/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/13/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/14/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/14/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/15/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/15/avatar.svg"></a>
<a href="https://github.com/guardian" target="_blank"> &nbsp; &nbsp; &nbsp; <img src="https://github.com/guardian.png" width="64" height="64"> &nbsp; &nbsp; &nbsp; </a>
<a href="https://opencollective.com/preact/sponsor/16/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/16/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/17/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/17/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/18/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/18/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/19/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/19/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/20/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/20/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/21/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/21/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/22/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/22/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/23/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/23/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/24/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/24/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/25/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/25/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/26/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/26/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/27/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/27/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/28/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/28/avatar.svg"></a>
<a href="https://opencollective.com/preact/sponsor/29/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/29/avatar.svg"></a>
## Backers
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/preact#backer)]
<a href="https://opencollective.com/preact/backer/0/website" target="_blank"><img src="https://opencollective.com/preact/backer/0/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/1/website" target="_blank"><img src="https://opencollective.com/preact/backer/1/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/2/website" target="_blank"><img src="https://opencollective.com/preact/backer/2/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/3/website" target="_blank"><img src="https://opencollective.com/preact/backer/3/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/4/website" target="_blank"><img src="https://opencollective.com/preact/backer/4/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/5/website" target="_blank"><img src="https://opencollective.com/preact/backer/5/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/6/website" target="_blank"><img src="https://opencollective.com/preact/backer/6/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/7/website" target="_blank"><img src="https://opencollective.com/preact/backer/7/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/8/website" target="_blank"><img src="https://opencollective.com/preact/backer/8/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/9/website" target="_blank"><img src="https://opencollective.com/preact/backer/9/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/10/website" target="_blank"><img src="https://opencollective.com/preact/backer/10/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/11/website" target="_blank"><img src="https://opencollective.com/preact/backer/11/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/12/website" target="_blank"><img src="https://opencollective.com/preact/backer/12/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/13/website" target="_blank"><img src="https://opencollective.com/preact/backer/13/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/14/website" target="_blank"><img src="https://opencollective.com/preact/backer/14/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/15/website" target="_blank"><img src="https://opencollective.com/preact/backer/15/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/16/website" target="_blank"><img src="https://opencollective.com/preact/backer/16/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/17/website" target="_blank"><img src="https://opencollective.com/preact/backer/17/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/18/website" target="_blank"><img src="https://opencollective.com/preact/backer/18/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/19/website" target="_blank"><img src="https://opencollective.com/preact/backer/19/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/20/website" target="_blank"><img src="https://opencollective.com/preact/backer/20/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/21/website" target="_blank"><img src="https://opencollective.com/preact/backer/21/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/22/website" target="_blank"><img src="https://opencollective.com/preact/backer/22/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/23/website" target="_blank"><img src="https://opencollective.com/preact/backer/23/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/24/website" target="_blank"><img src="https://opencollective.com/preact/backer/24/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/25/website" target="_blank"><img src="https://opencollective.com/preact/backer/25/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/26/website" target="_blank"><img src="https://opencollective.com/preact/backer/26/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/27/website" target="_blank"><img src="https://opencollective.com/preact/backer/27/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/28/website" target="_blank"><img src="https://opencollective.com/preact/backer/28/avatar.svg"></a>
<a href="https://opencollective.com/preact/backer/29/website" target="_blank"><img src="https://opencollective.com/preact/backer/29/avatar.svg"></a>
---
## License
MIT
[![Preact](https://i.imgur.com/YqCHvEW.gif)](https://preactjs.com)
[preact/compat]: https://github.com/preactjs/preact/tree/main/compat
[hyperscript]: https://github.com/dominictarr/hyperscript
[DevTools]: https://github.com/preactjs/preact-devtools

13
node_modules/preact/compat/client.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
// Intentionally not using a relative path to take advantage of
// the TS version resolution mechanism
import * as preact from 'preact';
export function createRoot(container: preact.ContainerNode): {
render(children: preact.ComponentChild): void;
unmount(): void;
};
export function hydrateRoot(
container: preact.ContainerNode,
children: preact.ComponentChild
): ReturnType<typeof createRoot>;

21
node_modules/preact/compat/client.js generated vendored Normal file
View File

@@ -0,0 +1,21 @@
const { render, hydrate, unmountComponentAtNode } = require('preact/compat');
function createRoot(container) {
return {
// eslint-disable-next-line
render: function (children) {
render(children, container);
},
// eslint-disable-next-line
unmount: function () {
unmountComponentAtNode(container);
}
};
}
exports.createRoot = createRoot;
exports.hydrateRoot = function (container, children) {
hydrate(children, container);
return createRoot(container);
};

24
node_modules/preact/compat/client.mjs generated vendored Normal file
View File

@@ -0,0 +1,24 @@
import { render, hydrate, unmountComponentAtNode } from 'preact/compat';
export function createRoot(container) {
return {
// eslint-disable-next-line
render: function (children) {
render(children, container);
},
// eslint-disable-next-line
unmount: function () {
unmountComponentAtNode(container);
}
};
}
export function hydrateRoot(container, children) {
hydrate(children, container);
return createRoot(container);
}
export default {
createRoot,
hydrateRoot
};

2
node_modules/preact/compat/dist/compat.js generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/preact/compat/dist/compat.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

2
node_modules/preact/compat/dist/compat.mjs generated vendored Normal file

File diff suppressed because one or more lines are too long

2
node_modules/preact/compat/dist/compat.module.js generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/preact/compat/dist/compat.module.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

2
node_modules/preact/compat/dist/compat.umd.js generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/preact/compat/dist/compat.umd.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

3
node_modules/preact/compat/jsx-dev-runtime.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
require('preact/compat');
module.exports = require('preact/jsx-runtime');

3
node_modules/preact/compat/jsx-dev-runtime.mjs generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import 'preact/compat';
export * from 'preact/jsx-runtime';

3
node_modules/preact/compat/jsx-runtime.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
require('preact/compat');
module.exports = require('preact/jsx-runtime');

3
node_modules/preact/compat/jsx-runtime.mjs generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import 'preact/compat';
export * from 'preact/jsx-runtime';

55
node_modules/preact/compat/package.json generated vendored Normal file
View File

@@ -0,0 +1,55 @@
{
"name": "preact-compat",
"amdName": "preactCompat",
"version": "4.0.0",
"private": true,
"description": "A React compatibility layer for Preact",
"main": "dist/compat.js",
"module": "dist/compat.module.js",
"umd:main": "dist/compat.umd.js",
"source": "src/index.js",
"types": "src/index.d.ts",
"license": "MIT",
"mangle": {
"regex": "^_"
},
"peerDependencies": {
"preact": "^10.0.0"
},
"exports": {
".": {
"types": "./src/index.d.ts",
"browser": "./dist/compat.module.js",
"umd": "./dist/compat.umd.js",
"import": "./dist/compat.mjs",
"require": "./dist/compat.js"
},
"./client": {
"types": "./client.d.ts",
"import": "./client.mjs",
"require": "./client.js"
},
"./server": {
"browser": "./server.browser.js",
"import": "./server.mjs",
"require": "./server.js"
},
"./jsx-runtime": {
"import": "./jsx-runtime.mjs",
"require": "./jsx-runtime.js"
},
"./jsx-dev-runtime": {
"import": "./jsx-dev-runtime.mjs",
"require": "./jsx-dev-runtime.js"
},
"./scheduler": {
"import": "./scheduler.mjs",
"require": "./scheduler.js"
},
"./test-utils": {
"import": "./test-utils.mjs",
"require": "./test-utils.js"
},
"./package.json": "./package.json"
}
}

15
node_modules/preact/compat/scheduler.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
// see scheduler.mjs
function unstable_runWithPriority(priority, callback) {
return callback();
}
module.exports = {
unstable_ImmediatePriority: 1,
unstable_UserBlockingPriority: 2,
unstable_NormalPriority: 3,
unstable_LowPriority: 4,
unstable_IdlePriority: 5,
unstable_runWithPriority,
unstable_now: performance.now.bind(performance)
};

23
node_modules/preact/compat/scheduler.mjs generated vendored Normal file
View File

@@ -0,0 +1,23 @@
/* eslint-disable */
// This file includes experimental React APIs exported from the "scheduler"
// npm package. Despite being explicitely marked as unstable some libraries
// already make use of them. This file is not a full replacement for the
// scheduler package, but includes the necessary shims to make those libraries
// work with Preact.
export var unstable_ImmediatePriority = 1;
export var unstable_UserBlockingPriority = 2;
export var unstable_NormalPriority = 3;
export var unstable_LowPriority = 4;
export var unstable_IdlePriority = 5;
/**
* @param {number} priority
* @param {() => void} callback
*/
export function unstable_runWithPriority(priority, callback) {
return callback();
}
export var unstable_now = performance.now.bind(performance);

11
node_modules/preact/compat/server.browser.js generated vendored Normal file
View File

@@ -0,0 +1,11 @@
import { renderToString } from 'preact-render-to-string';
export {
renderToString,
renderToString as renderToStaticMarkup
} from 'preact-render-to-string';
export default {
renderToString,
renderToStaticMarkup: renderToString
};

36
node_modules/preact/compat/server.js generated vendored Normal file
View File

@@ -0,0 +1,36 @@
/* eslint-disable */
var renderToString;
try {
const mod = require('preact-render-to-string');
renderToString = mod.default || mod.renderToString || mod;
} catch (e) {
throw Error(
'renderToString() error: missing "preact-render-to-string" dependency.'
);
}
var renderToReadableStream;
try {
const mod = require('preact-render-to-string/stream');
renderToReadableStream = mod.default || mod.renderToReadableStream || mod;
} catch (e) {
throw Error(
'renderToReadableStream() error: update "preact-render-to-string" dependency to at least 6.5.0.'
);
}
var renderToPipeableStream;
try {
const mod = require('preact-render-to-string/stream-node');
renderToPipeableStream = mod.default || mod.renderToPipeableStream || mod;
} catch (e) {
throw Error(
'renderToPipeableStream() error: update "preact-render-to-string" dependency to at least 6.5.0.'
);
}
module.exports = {
renderToString: renderToString,
renderToStaticMarkup: renderToString,
renderToPipeableStream: renderToPipeableStream,
renderToReadableStream: renderToReadableStream
};

17
node_modules/preact/compat/server.mjs generated vendored Normal file
View File

@@ -0,0 +1,17 @@
import { renderToString } from 'preact-render-to-string';
import { renderToPipeableStream } from 'preact-render-to-string/stream-node';
import { renderToReadableStream } from 'preact-render-to-string/stream';
export {
renderToString,
renderToString as renderToStaticMarkup
} from 'preact-render-to-string';
export { renderToPipeableStream } from 'preact-render-to-string/stream-node';
export { renderToReadableStream } from 'preact-render-to-string/stream';
export default {
renderToString,
renderToStaticMarkup: renderToString,
renderToPipeableStream,
renderToReadableStream
};

21
node_modules/preact/compat/src/Children.js generated vendored Normal file
View File

@@ -0,0 +1,21 @@
import { toChildArray } from 'preact';
const mapFn = (children, fn) => {
if (children == null) return null;
return toChildArray(toChildArray(children).map(fn));
};
// This API is completely unnecessary for Preact, so it's basically passthrough.
export const Children = {
map: mapFn,
forEach: mapFn,
count(children) {
return children ? toChildArray(children).length : 0;
},
only(children) {
const normalized = toChildArray(children);
if (normalized.length !== 1) throw 'Children.only';
return normalized[0];
},
toArray: toChildArray
};

16
node_modules/preact/compat/src/PureComponent.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
import { Component } from 'preact';
import { shallowDiffers } from './util';
/**
* Component class with a predefined `shouldComponentUpdate` implementation
*/
export function PureComponent(p, c) {
this.props = p;
this.context = c;
}
PureComponent.prototype = new Component();
// Some third-party libraries check if this property is present
PureComponent.prototype.isPureReactComponent = true;
PureComponent.prototype.shouldComponentUpdate = function (props, state) {
return shallowDiffers(this.props, props) || shallowDiffers(this.state, state);
};

44
node_modules/preact/compat/src/forwardRef.js generated vendored Normal file
View File

@@ -0,0 +1,44 @@
import { options } from 'preact';
import { assign } from './util';
let oldDiffHook = options._diff;
options._diff = vnode => {
if (vnode.type && vnode.type._forwarded && vnode.ref) {
vnode.props.ref = vnode.ref;
vnode.ref = null;
}
if (oldDiffHook) oldDiffHook(vnode);
};
export const REACT_FORWARD_SYMBOL =
(typeof Symbol != 'undefined' &&
Symbol.for &&
Symbol.for('react.forward_ref')) ||
0xf47;
/**
* Pass ref down to a child. This is mainly used in libraries with HOCs that
* wrap components. Using `forwardRef` there is an easy way to get a reference
* of the wrapped component instead of one of the wrapper itself.
* @param {import('./index').ForwardFn} fn
* @returns {import('./internal').FunctionComponent}
*/
export function forwardRef(fn) {
function Forwarded(props) {
let clone = assign({}, props);
delete clone.ref;
return fn(clone, props.ref || null);
}
// mobx-react checks for this being present
Forwarded.$$typeof = REACT_FORWARD_SYMBOL;
// mobx-react heavily relies on implementation details.
// It expects an object here with a `render` property,
// and prototype.render will fail. Without this
// mobx-react throws.
Forwarded.render = Forwarded;
Forwarded.prototype.isReactComponent = Forwarded._forwarded = true;
Forwarded.displayName = 'ForwardRef(' + (fn.displayName || fn.name) + ')';
return Forwarded;
}

70
node_modules/preact/compat/src/hooks.js generated vendored Normal file
View File

@@ -0,0 +1,70 @@
import { useState, useLayoutEffect, useEffect } from 'preact/hooks';
import { is } from './util';
/**
* This is taken from https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/useSyncExternalStoreShimClient.js#L84
* on a high level this cuts out the warnings, ... and attempts a smaller implementation
* @typedef {{ _value: any; _getSnapshot: () => any }} Store
*/
export function useSyncExternalStore(subscribe, getSnapshot) {
const value = getSnapshot();
/**
* @typedef {{ _instance: Store }} StoreRef
* @type {[StoreRef, (store: StoreRef) => void]}
*/
const [{ _instance }, forceUpdate] = useState({
_instance: { _value: value, _getSnapshot: getSnapshot }
});
useLayoutEffect(() => {
_instance._value = value;
_instance._getSnapshot = getSnapshot;
if (didSnapshotChange(_instance)) {
forceUpdate({ _instance });
}
}, [subscribe, value, getSnapshot]);
useEffect(() => {
if (didSnapshotChange(_instance)) {
forceUpdate({ _instance });
}
return subscribe(() => {
if (didSnapshotChange(_instance)) {
forceUpdate({ _instance });
}
});
}, [subscribe]);
return value;
}
/** @type {(inst: Store) => boolean} */
function didSnapshotChange(inst) {
const latestGetSnapshot = inst._getSnapshot;
const prevValue = inst._value;
try {
const nextValue = latestGetSnapshot();
return !is(prevValue, nextValue);
} catch (error) {
return true;
}
}
export function startTransition(cb) {
cb();
}
export function useDeferredValue(val) {
return val;
}
export function useTransition() {
return [false, startTransition];
}
// TODO: in theory this should be done after a VNode is diffed as we want to insert
// styles/... before it attaches
export const useInsertionEffect = useLayoutEffect;

349
node_modules/preact/compat/src/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,349 @@
import * as _hooks from '../../hooks';
// Intentionally not using a relative path to take advantage of
// the TS version resolution mechanism
import * as preact from 'preact';
import { JSXInternal } from '../../src/jsx';
import * as _Suspense from './suspense';
import * as _SuspenseList from './suspense-list';
// export default React;
export = React;
export as namespace React;
declare namespace React {
// Export JSX
export import JSX = JSXInternal;
// Hooks
export import CreateHandle = _hooks.CreateHandle;
export import EffectCallback = _hooks.EffectCallback;
export import Inputs = _hooks.Inputs;
export import PropRef = _hooks.PropRef;
export import Reducer = _hooks.Reducer;
export import Dispatch = _hooks.Dispatch;
export import SetStateAction = _hooks.StateUpdater;
export import useCallback = _hooks.useCallback;
export import useContext = _hooks.useContext;
export import useDebugValue = _hooks.useDebugValue;
export import useEffect = _hooks.useEffect;
export import useImperativeHandle = _hooks.useImperativeHandle;
export import useId = _hooks.useId;
export import useLayoutEffect = _hooks.useLayoutEffect;
export import useMemo = _hooks.useMemo;
export import useReducer = _hooks.useReducer;
export import useRef = _hooks.useRef;
export import useState = _hooks.useState;
// React 18 hooks
export import useInsertionEffect = _hooks.useLayoutEffect;
export function useTransition(): [false, typeof startTransition];
export function useDeferredValue<T = any>(val: T): T;
export function useSyncExternalStore<T>(
subscribe: (flush: () => void) => () => void,
getSnapshot: () => T
): T;
// Preact Defaults
export import Context = preact.Context;
export import ContextType = preact.ContextType;
export import RefObject = preact.RefObject;
export import Component = preact.Component;
export import FunctionComponent = preact.FunctionComponent;
export import ComponentType = preact.ComponentType;
export import ComponentClass = preact.ComponentClass;
export import FC = preact.FunctionComponent;
export import createContext = preact.createContext;
export import Ref = preact.Ref;
export import createRef = preact.createRef;
export import Fragment = preact.Fragment;
export import createElement = preact.createElement;
export import cloneElement = preact.cloneElement;
export import ComponentProps = preact.ComponentProps;
export import ReactNode = preact.ComponentChild;
export import ReactElement = preact.VNode;
export import Consumer = preact.Consumer;
export import ErrorInfo = preact.ErrorInfo;
// Suspense
export import Suspense = _Suspense.Suspense;
export import lazy = _Suspense.lazy;
export import SuspenseList = _SuspenseList.SuspenseList;
// Compat
export import StrictMode = preact.Fragment;
export const version: string;
export function startTransition(cb: () => void): void;
// HTML
export interface HTMLAttributes<T extends EventTarget>
extends JSXInternal.HTMLAttributes<T> {}
export interface HTMLProps<T extends EventTarget>
extends JSXInternal.AllHTMLAttributes<T>,
preact.ClassAttributes<T> {}
export interface AllHTMLAttributes<T extends EventTarget>
extends JSXInternal.AllHTMLAttributes<T> {}
export import DetailedHTMLProps = JSXInternal.DetailedHTMLProps;
export import CSSProperties = JSXInternal.CSSProperties;
export interface SVGProps<T extends EventTarget>
extends JSXInternal.SVGAttributes<T>,
preact.ClassAttributes<T> {}
interface SVGAttributes extends JSXInternal.SVGAttributes {}
interface ReactSVG extends JSXInternal.IntrinsicSVGElements {}
export import AriaAttributes = JSXInternal.AriaAttributes;
export import HTMLAttributeReferrerPolicy = JSXInternal.HTMLAttributeReferrerPolicy;
export import HTMLAttributeAnchorTarget = JSXInternal.HTMLAttributeAnchorTarget;
export import HTMLInputTypeAttribute = JSXInternal.HTMLInputTypeAttribute;
export import HTMLAttributeCrossOrigin = JSXInternal.HTMLAttributeCrossOrigin;
export import AnchorHTMLAttributes = JSXInternal.AnchorHTMLAttributes;
export import AudioHTMLAttributes = JSXInternal.AudioHTMLAttributes;
export import AreaHTMLAttributes = JSXInternal.AreaHTMLAttributes;
export import BaseHTMLAttributes = JSXInternal.BaseHTMLAttributes;
export import BlockquoteHTMLAttributes = JSXInternal.BlockquoteHTMLAttributes;
export import ButtonHTMLAttributes = JSXInternal.ButtonHTMLAttributes;
export import CanvasHTMLAttributes = JSXInternal.CanvasHTMLAttributes;
export import ColHTMLAttributes = JSXInternal.ColHTMLAttributes;
export import ColgroupHTMLAttributes = JSXInternal.ColgroupHTMLAttributes;
export import DataHTMLAttributes = JSXInternal.DataHTMLAttributes;
export import DetailsHTMLAttributes = JSXInternal.DetailsHTMLAttributes;
export import DelHTMLAttributes = JSXInternal.DelHTMLAttributes;
export import DialogHTMLAttributes = JSXInternal.DialogHTMLAttributes;
export import EmbedHTMLAttributes = JSXInternal.EmbedHTMLAttributes;
export import FieldsetHTMLAttributes = JSXInternal.FieldsetHTMLAttributes;
export import FormHTMLAttributes = JSXInternal.FormHTMLAttributes;
export import IframeHTMLAttributes = JSXInternal.IframeHTMLAttributes;
export import ImgHTMLAttributes = JSXInternal.ImgHTMLAttributes;
export import InsHTMLAttributes = JSXInternal.InsHTMLAttributes;
export import InputHTMLAttributes = JSXInternal.InputHTMLAttributes;
export import KeygenHTMLAttributes = JSXInternal.KeygenHTMLAttributes;
export import LabelHTMLAttributes = JSXInternal.LabelHTMLAttributes;
export import LiHTMLAttributes = JSXInternal.LiHTMLAttributes;
export import LinkHTMLAttributes = JSXInternal.LinkHTMLAttributes;
export import MapHTMLAttributes = JSXInternal.MapHTMLAttributes;
export import MenuHTMLAttributes = JSXInternal.MenuHTMLAttributes;
export import MediaHTMLAttributes = JSXInternal.MediaHTMLAttributes;
export import MetaHTMLAttributes = JSXInternal.MetaHTMLAttributes;
export import MeterHTMLAttributes = JSXInternal.MeterHTMLAttributes;
export import QuoteHTMLAttributes = JSXInternal.QuoteHTMLAttributes;
export import ObjectHTMLAttributes = JSXInternal.ObjectHTMLAttributes;
export import OlHTMLAttributes = JSXInternal.OlHTMLAttributes;
export import OptgroupHTMLAttributes = JSXInternal.OptgroupHTMLAttributes;
export import OptionHTMLAttributes = JSXInternal.OptionHTMLAttributes;
export import OutputHTMLAttributes = JSXInternal.OutputHTMLAttributes;
export import ParamHTMLAttributes = JSXInternal.ParamHTMLAttributes;
export import ProgressHTMLAttributes = JSXInternal.ProgressHTMLAttributes;
export import SlotHTMLAttributes = JSXInternal.SlotHTMLAttributes;
export import ScriptHTMLAttributes = JSXInternal.ScriptHTMLAttributes;
export import SelectHTMLAttributes = JSXInternal.SelectHTMLAttributes;
export import SourceHTMLAttributes = JSXInternal.SourceHTMLAttributes;
export import StyleHTMLAttributes = JSXInternal.StyleHTMLAttributes;
export import TableHTMLAttributes = JSXInternal.TableHTMLAttributes;
export import TextareaHTMLAttributes = JSXInternal.TextareaHTMLAttributes;
export import TdHTMLAttributes = JSXInternal.TdHTMLAttributes;
export import ThHTMLAttributes = JSXInternal.ThHTMLAttributes;
export import TimeHTMLAttributes = JSXInternal.TimeHTMLAttributes;
export import TrackHTMLAttributes = JSXInternal.TrackHTMLAttributes;
export import VideoHTMLAttributes = JSXInternal.VideoHTMLAttributes;
// Events
export import TargetedEvent = JSXInternal.TargetedEvent;
export import ChangeEvent = JSXInternal.TargetedEvent;
export import ClipboardEvent = JSXInternal.TargetedClipboardEvent;
export import CompositionEvent = JSXInternal.TargetedCompositionEvent;
export import DragEvent = JSXInternal.TargetedDragEvent;
export import PointerEvent = JSXInternal.TargetedPointerEvent;
export import FocusEvent = JSXInternal.TargetedFocusEvent;
export import FormEvent = JSXInternal.TargetedEvent;
export import InvalidEvent = JSXInternal.TargetedEvent;
export import KeyboardEvent = JSXInternal.TargetedKeyboardEvent;
export import MouseEvent = JSXInternal.TargetedMouseEvent;
export import TouchEvent = JSXInternal.TargetedTouchEvent;
export import UIEvent = JSXInternal.TargetedUIEvent;
export import AnimationEvent = JSXInternal.TargetedAnimationEvent;
export import TransitionEvent = JSXInternal.TargetedTransitionEvent;
// Event Handler Types
export import EventHandler = JSXInternal.EventHandler;
export import ChangeEventHandler = JSXInternal.GenericEventHandler;
export import ClipboardEventHandler = JSXInternal.ClipboardEventHandler;
export import CompositionEventHandler = JSXInternal.CompositionEventHandler;
export import DragEventHandler = JSXInternal.DragEventHandler;
export import PointerEventHandler = JSXInternal.PointerEventHandler;
export import FocusEventHandler = JSXInternal.FocusEventHandler;
export import FormEventHandler = JSXInternal.GenericEventHandler;
export import InvalidEventHandler = JSXInternal.GenericEventHandler;
export import KeyboardEventHandler = JSXInternal.KeyboardEventHandler;
export import MouseEventHandler = JSXInternal.MouseEventHandler;
export import TouchEventHandler = JSXInternal.TouchEventHandler;
export import UIEventHandler = JSXInternal.UIEventHandler;
export import AnimationEventHandler = JSXInternal.AnimationEventHandler;
export import TransitionEventHandler = JSXInternal.TransitionEventHandler;
export function createPortal(
vnode: preact.ComponentChildren,
container: preact.ContainerNode
): preact.VNode<any>;
export function render(
vnode: preact.ComponentChild,
parent: preact.ContainerNode,
callback?: () => void
): Component | null;
export function hydrate(
vnode: preact.ComponentChild,
parent: preact.ContainerNode,
callback?: () => void
): Component | null;
export function unmountComponentAtNode(
container: preact.ContainerNode
): boolean;
export function createFactory(
type: preact.VNode<any>['type']
): (
props?: any,
...children: preact.ComponentChildren[]
) => preact.VNode<any>;
export function isValidElement(element: any): boolean;
export function isFragment(element: any): boolean;
export function isMemo(element: any): boolean;
export function findDOMNode(
component: preact.Component | Element
): Element | null;
export abstract class PureComponent<
P = {},
S = {},
SS = any
> extends preact.Component<P, S> {
isPureReactComponent: boolean;
}
export type MemoExoticComponent<C extends preact.FunctionalComponent<any>> =
preact.FunctionComponent<ComponentProps<C>> & {
readonly type: C;
};
export function memo<P = {}>(
component: preact.FunctionalComponent<P>,
comparer?: (prev: P, next: P) => boolean
): preact.FunctionComponent<P>;
export function memo<C extends preact.FunctionalComponent<any>>(
component: C,
comparer?: (
prev: preact.ComponentProps<C>,
next: preact.ComponentProps<C>
) => boolean
): C;
export interface RefAttributes<R> extends preact.Attributes {
ref?: preact.Ref<R> | undefined;
}
/**
* @deprecated Please use `ForwardRefRenderFunction` instead.
*/
export interface ForwardFn<P = {}, T = any> {
(props: P, ref: ForwardedRef<T>): preact.ComponentChild;
displayName?: string;
}
export interface ForwardRefRenderFunction<T = any, P = {}> {
(props: P, ref: ForwardedRef<T>): preact.ComponentChild;
displayName?: string;
}
export interface ForwardRefExoticComponent<P>
extends preact.FunctionComponent<P> {
defaultProps?: Partial<P> | undefined;
}
export function forwardRef<R, P = {}>(
fn: ForwardRefRenderFunction<R, P>
): preact.FunctionalComponent<PropsWithoutRef<P> & { ref?: preact.Ref<R> }>;
export type PropsWithoutRef<P> = Omit<P, 'ref'>;
interface MutableRefObject<T> {
current: T;
}
export type ForwardedRef<T> =
| ((instance: T | null) => void)
| MutableRefObject<T | null>
| null;
export type ElementType<
P = any,
Tag extends keyof JSX.IntrinsicElements = keyof JSX.IntrinsicElements
> =
| { [K in Tag]: P extends JSX.IntrinsicElements[K] ? K : never }[Tag]
| ComponentType<P>;
export type ComponentPropsWithoutRef<T extends ElementType> = PropsWithoutRef<
ComponentProps<T>
>;
export type ComponentPropsWithRef<C extends ElementType> = C extends new (
props: infer P
) => Component<any, any>
? PropsWithoutRef<P> & RefAttributes<InstanceType<C>>
: ComponentProps<C>;
export type ElementRef<
C extends
| ForwardRefExoticComponent<any>
| { new (props: any): Component<any, any> }
| ((props: any) => ReactNode)
| keyof JSXInternal.IntrinsicElements
> = 'ref' extends keyof ComponentPropsWithRef<C>
? NonNullable<ComponentPropsWithRef<C>['ref']> extends RefAttributes<
infer Instance
>['ref']
? Instance
: never
: never;
export function flushSync<R>(fn: () => R): R;
export function flushSync<A, R>(fn: (a: A) => R, a: A): R;
export function unstable_batchedUpdates(
callback: (arg?: any) => void,
arg?: any
): void;
export type PropsWithChildren<P = unknown> = P & {
children?: preact.ComponentChildren | undefined;
};
export const Children: {
map<T extends preact.ComponentChild, R>(
children: T | T[],
fn: (child: T, i: number) => R
): R[];
forEach<T extends preact.ComponentChild>(
children: T | T[],
fn: (child: T, i: number) => void
): void;
count: (children: preact.ComponentChildren) => number;
only: (children: preact.ComponentChildren) => preact.ComponentChild;
toArray: (children: preact.ComponentChildren) => preact.VNode<{}>[];
};
// scheduler
export const unstable_ImmediatePriority: number;
export const unstable_UserBlockingPriority: number;
export const unstable_NormalPriority: number;
export const unstable_LowPriority: number;
export const unstable_IdlePriority: number;
export function unstable_runWithPriority(
priority: number,
callback: () => void
): void;
export const unstable_now: () => number;
}

238
node_modules/preact/compat/src/index.js generated vendored Normal file
View File

@@ -0,0 +1,238 @@
import {
createElement,
render as preactRender,
cloneElement as preactCloneElement,
createRef,
Component,
createContext,
Fragment
} from 'preact';
import {
useState,
useId,
useReducer,
useEffect,
useLayoutEffect,
useRef,
useImperativeHandle,
useMemo,
useCallback,
useContext,
useDebugValue
} from 'preact/hooks';
import {
useInsertionEffect,
startTransition,
useDeferredValue,
useSyncExternalStore,
useTransition
} from './hooks';
import { PureComponent } from './PureComponent';
import { memo } from './memo';
import { forwardRef } from './forwardRef';
import { Children } from './Children';
import { Suspense, lazy } from './suspense';
import { SuspenseList } from './suspense-list';
import { createPortal } from './portals';
import {
hydrate,
render,
REACT_ELEMENT_TYPE,
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
} from './render';
const version = '18.3.1'; // trick libraries to think we are react
/**
* Legacy version of createElement.
* @param {import('./internal').VNode["type"]} type The node name or Component constructor
*/
function createFactory(type) {
return createElement.bind(null, type);
}
/**
* Check if the passed element is a valid (p)react node.
* @param {*} element The element to check
* @returns {boolean}
*/
function isValidElement(element) {
return !!element && element.$$typeof === REACT_ELEMENT_TYPE;
}
/**
* Check if the passed element is a Fragment node.
* @param {*} element The element to check
* @returns {boolean}
*/
function isFragment(element) {
return isValidElement(element) && element.type === Fragment;
}
/**
* Check if the passed element is a Memo node.
* @param {*} element The element to check
* @returns {boolean}
*/
function isMemo(element) {
return (
!!element &&
!!element.displayName &&
(typeof element.displayName === 'string' ||
element.displayName instanceof String) &&
element.displayName.startsWith('Memo(')
);
}
/**
* Wrap `cloneElement` to abort if the passed element is not a valid element and apply
* all vnode normalizations.
* @param {import('./internal').VNode} element The vnode to clone
* @param {object} props Props to add when cloning
* @param {Array<import('./internal').ComponentChildren>} rest Optional component children
*/
function cloneElement(element) {
if (!isValidElement(element)) return element;
return preactCloneElement.apply(null, arguments);
}
/**
* Remove a component tree from the DOM, including state and event handlers.
* @param {import('./internal').PreactElement} container
* @returns {boolean}
*/
function unmountComponentAtNode(container) {
if (container._children) {
preactRender(null, container);
return true;
}
return false;
}
/**
* Get the matching DOM node for a component
* @param {import('./internal').Component} component
* @returns {import('./internal').PreactElement | null}
*/
function findDOMNode(component) {
return (
(component &&
(component.base || (component.nodeType === 1 && component))) ||
null
);
}
/**
* Deprecated way to control batched rendering inside the reconciler, but we
* already schedule in batches inside our rendering code
* @template Arg
* @param {(arg: Arg) => void} callback function that triggers the updated
* @param {Arg} [arg] Optional argument that can be passed to the callback
*/
// eslint-disable-next-line camelcase
const unstable_batchedUpdates = (callback, arg) => callback(arg);
/**
* In React, `flushSync` flushes the entire tree and forces a rerender. It's
* implmented here as a no-op.
* @template Arg
* @template Result
* @param {(arg: Arg) => Result} callback function that runs before the flush
* @param {Arg} [arg] Optional argument that can be passed to the callback
* @returns
*/
const flushSync = (callback, arg) => callback(arg);
/**
* Strict Mode is not implemented in Preact, so we provide a stand-in for it
* that just renders its children without imposing any restrictions.
*/
const StrictMode = Fragment;
// compat to react-is
export const isElement = isValidElement;
export * from 'preact/hooks';
export {
version,
Children,
render,
hydrate,
unmountComponentAtNode,
createPortal,
createElement,
createContext,
createFactory,
cloneElement,
createRef,
Fragment,
isValidElement,
isFragment,
isMemo,
findDOMNode,
Component,
PureComponent,
memo,
forwardRef,
flushSync,
useInsertionEffect,
startTransition,
useDeferredValue,
useSyncExternalStore,
useTransition,
// eslint-disable-next-line camelcase
unstable_batchedUpdates,
StrictMode,
Suspense,
SuspenseList,
lazy,
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
};
// React copies the named exports to the default one.
export default {
useState,
useId,
useReducer,
useEffect,
useLayoutEffect,
useInsertionEffect,
useTransition,
useDeferredValue,
useSyncExternalStore,
startTransition,
useRef,
useImperativeHandle,
useMemo,
useCallback,
useContext,
useDebugValue,
version,
Children,
render,
hydrate,
unmountComponentAtNode,
createPortal,
createElement,
createContext,
createFactory,
cloneElement,
createRef,
Fragment,
isValidElement,
isElement,
isFragment,
isMemo,
findDOMNode,
Component,
PureComponent,
memo,
forwardRef,
flushSync,
unstable_batchedUpdates,
StrictMode,
Suspense,
SuspenseList,
lazy,
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
};

48
node_modules/preact/compat/src/internal.d.ts generated vendored Normal file
View File

@@ -0,0 +1,48 @@
import {
Component as PreactComponent,
VNode as PreactVNode,
FunctionComponent as PreactFunctionComponent,
PreactElement
} from '../../src/internal';
import { SuspenseProps } from './suspense';
export { ComponentChildren } from '../..';
export { PreactElement };
export interface Component<P = {}, S = {}> extends PreactComponent<P, S> {
isReactComponent?: object;
isPureReactComponent?: true;
_patchedLifecycles?: true;
// Suspense internal properties
_childDidSuspend?(error: Promise<void>, suspendingVNode: VNode): void;
_suspended: (vnode: VNode) => (unsuspend: () => void) => void;
_onResolve?(): void;
// Portal internal properties
_temp: any;
_container: PreactElement;
}
export interface FunctionComponent<P = {}> extends PreactFunctionComponent<P> {
shouldComponentUpdate?(nextProps: Readonly<P>): boolean;
_forwarded?: boolean;
_patchedLifecycles?: true;
}
export interface VNode<T = any> extends PreactVNode<T> {
$$typeof?: symbol | string;
preactCompatNormalized?: boolean;
}
export interface SuspenseState {
_suspended?: null | VNode<any>;
}
export interface SuspenseComponent
extends PreactComponent<SuspenseProps, SuspenseState> {
_pendingSuspensionCount: number;
_suspenders: Component[];
_detachOnNextRender: null | VNode<any>;
}

34
node_modules/preact/compat/src/memo.js generated vendored Normal file
View File

@@ -0,0 +1,34 @@
import { createElement } from 'preact';
import { shallowDiffers } from './util';
/**
* Memoize a component, so that it only updates when the props actually have
* changed. This was previously known as `React.pure`.
* @param {import('./internal').FunctionComponent} c functional component
* @param {(prev: object, next: object) => boolean} [comparer] Custom equality function
* @returns {import('./internal').FunctionComponent}
*/
export function memo(c, comparer) {
function shouldUpdate(nextProps) {
let ref = this.props.ref;
let updateRef = ref == nextProps.ref;
if (!updateRef && ref) {
ref.call ? ref(null) : (ref.current = null);
}
if (!comparer) {
return shallowDiffers(this.props, nextProps);
}
return !comparer(this.props, nextProps) || !updateRef;
}
function Memoed(props) {
this.shouldComponentUpdate = shouldUpdate;
return createElement(c, props);
}
Memoed.displayName = 'Memo(' + (c.displayName || c.name) + ')';
Memoed.prototype.isReactComponent = true;
Memoed._forwarded = true;
return Memoed;
}

77
node_modules/preact/compat/src/portals.js generated vendored Normal file
View File

@@ -0,0 +1,77 @@
import { createElement, render } from 'preact';
/**
* @param {import('../../src/index').RenderableProps<{ context: any }>} props
*/
function ContextProvider(props) {
this.getChildContext = () => props.context;
return props.children;
}
/**
* Portal component
* @this {import('./internal').Component}
* @param {object | null | undefined} props
*
* TODO: use createRoot() instead of fake root
*/
function Portal(props) {
const _this = this;
let container = props._container;
_this.componentWillUnmount = function () {
render(null, _this._temp);
_this._temp = null;
_this._container = null;
};
// When we change container we should clear our old container and
// indicate a new mount.
if (_this._container && _this._container !== container) {
_this.componentWillUnmount();
}
if (!_this._temp) {
// Ensure the element has a mask for useId invocations
let root = _this._vnode;
while (root !== null && !root._mask && root._parent !== null) {
root = root._parent;
}
_this._container = container;
// Create a fake DOM parent node that manages a subset of `container`'s children:
_this._temp = {
nodeType: 1,
parentNode: container,
childNodes: [],
_children: { _mask: root._mask },
contains: () => true,
insertBefore(child, before) {
this.childNodes.push(child);
_this._container.insertBefore(child, before);
},
removeChild(child) {
this.childNodes.splice(this.childNodes.indexOf(child) >>> 1, 1);
_this._container.removeChild(child);
}
};
}
// Render our wrapping element into temp.
render(
createElement(ContextProvider, { context: _this.context }, props._vnode),
_this._temp
);
}
/**
* Create a `Portal` to continue rendering the vnode tree at a different DOM node
* @param {import('./internal').VNode} vnode The vnode to render
* @param {import('./internal').PreactElement} container The DOM node to continue rendering in to.
*/
export function createPortal(vnode, container) {
const el = createElement(Portal, { _vnode: vnode, _container: container });
el.containerInfo = container;
return el;
}

313
node_modules/preact/compat/src/render.js generated vendored Normal file
View File

@@ -0,0 +1,313 @@
import {
render as preactRender,
hydrate as preactHydrate,
options,
toChildArray,
Component
} from 'preact';
import {
useCallback,
useContext,
useDebugValue,
useEffect,
useId,
useImperativeHandle,
useLayoutEffect,
useMemo,
useReducer,
useRef,
useState
} from 'preact/hooks';
import {
useDeferredValue,
useInsertionEffect,
useSyncExternalStore,
useTransition
} from './index';
export const REACT_ELEMENT_TYPE =
(typeof Symbol != 'undefined' && Symbol.for && Symbol.for('react.element')) ||
0xeac7;
const CAMEL_PROPS =
/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/;
const ON_ANI = /^on(Ani|Tra|Tou|BeforeInp|Compo)/;
const CAMEL_REPLACE = /[A-Z0-9]/g;
const IS_DOM = typeof document !== 'undefined';
// Input types for which onchange should not be converted to oninput.
// type="file|checkbox|radio", plus "range" in IE11.
// (IE11 doesn't support Symbol, which we use here to turn `rad` into `ra` which matches "range")
const onChangeInputType = type =>
(typeof Symbol != 'undefined' && typeof Symbol() == 'symbol'
? /fil|che|rad/
: /fil|che|ra/
).test(type);
// Some libraries like `react-virtualized` explicitly check for this.
Component.prototype.isReactComponent = {};
// `UNSAFE_*` lifecycle hooks
// Preact only ever invokes the unprefixed methods.
// Here we provide a base "fallback" implementation that calls any defined UNSAFE_ prefixed method.
// - If a component defines its own `componentDidMount()` (including via defineProperty), use that.
// - If a component defines `UNSAFE_componentDidMount()`, `componentDidMount` is the alias getter/setter.
// - If anything assigns to an `UNSAFE_*` property, the assignment is forwarded to the unprefixed property.
// See https://github.com/preactjs/preact/issues/1941
[
'componentWillMount',
'componentWillReceiveProps',
'componentWillUpdate'
].forEach(key => {
Object.defineProperty(Component.prototype, key, {
configurable: true,
get() {
return this['UNSAFE_' + key];
},
set(v) {
Object.defineProperty(this, key, {
configurable: true,
writable: true,
value: v
});
}
});
});
/**
* Proxy render() since React returns a Component reference.
* @param {import('./internal').VNode} vnode VNode tree to render
* @param {import('./internal').PreactElement} parent DOM node to render vnode tree into
* @param {() => void} [callback] Optional callback that will be called after rendering
* @returns {import('./internal').Component | null} The root component reference or null
*/
export function render(vnode, parent, callback) {
// React destroys any existing DOM nodes, see #1727
// ...but only on the first render, see #1828
if (parent._children == null) {
parent.textContent = '';
}
preactRender(vnode, parent);
if (typeof callback == 'function') callback();
return vnode ? vnode._component : null;
}
export function hydrate(vnode, parent, callback) {
preactHydrate(vnode, parent);
if (typeof callback == 'function') callback();
return vnode ? vnode._component : null;
}
let oldEventHook = options.event;
options.event = e => {
if (oldEventHook) e = oldEventHook(e);
e.persist = empty;
e.isPropagationStopped = isPropagationStopped;
e.isDefaultPrevented = isDefaultPrevented;
return (e.nativeEvent = e);
};
function empty() {}
function isPropagationStopped() {
return this.cancelBubble;
}
function isDefaultPrevented() {
return this.defaultPrevented;
}
const classNameDescriptorNonEnumberable = {
enumerable: false,
configurable: true,
get() {
return this.class;
}
};
function handleDomVNode(vnode) {
let props = vnode.props,
type = vnode.type,
normalizedProps = {};
let isNonDashedType = type.indexOf('-') === -1;
for (let i in props) {
let value = props[i];
if (
(i === 'value' && 'defaultValue' in props && value == null) ||
// Emulate React's behavior of not rendering the contents of noscript tags on the client.
(IS_DOM && i === 'children' && type === 'noscript') ||
i === 'class' ||
i === 'className'
) {
// Skip applying value if it is null/undefined and we already set
// a default value
continue;
}
let lowerCased = i.toLowerCase();
if (i === 'defaultValue' && 'value' in props && props.value == null) {
// `defaultValue` is treated as a fallback `value` when a value prop is present but null/undefined.
// `defaultValue` for Elements with no value prop is the same as the DOM defaultValue property.
i = 'value';
} else if (i === 'download' && value === true) {
// Calling `setAttribute` with a truthy value will lead to it being
// passed as a stringified value, e.g. `download="true"`. React
// converts it to an empty string instead, otherwise the attribute
// value will be used as the file name and the file will be called
// "true" upon downloading it.
value = '';
} else if (lowerCased === 'translate' && value === 'no') {
value = false;
} else if (lowerCased[0] === 'o' && lowerCased[1] === 'n') {
if (lowerCased === 'ondoubleclick') {
i = 'ondblclick';
} else if (
lowerCased === 'onchange' &&
(type === 'input' || type === 'textarea') &&
!onChangeInputType(props.type)
) {
lowerCased = i = 'oninput';
} else if (lowerCased === 'onfocus') {
i = 'onfocusin';
} else if (lowerCased === 'onblur') {
i = 'onfocusout';
} else if (ON_ANI.test(i)) {
i = lowerCased;
}
} else if (isNonDashedType && CAMEL_PROPS.test(i)) {
i = i.replace(CAMEL_REPLACE, '-$&').toLowerCase();
} else if (value === null) {
value = undefined;
}
// Add support for onInput and onChange, see #3561
// if we have an oninput prop already change it to oninputCapture
if (lowerCased === 'oninput') {
i = lowerCased;
if (normalizedProps[i]) {
i = 'oninputCapture';
}
}
normalizedProps[i] = value;
}
// Add support for array select values: <select multiple value={[]} />
if (
type == 'select' &&
normalizedProps.multiple &&
Array.isArray(normalizedProps.value)
) {
// forEach() always returns undefined, which we abuse here to unset the value prop.
normalizedProps.value = toChildArray(props.children).forEach(child => {
child.props.selected =
normalizedProps.value.indexOf(child.props.value) != -1;
});
}
// Adding support for defaultValue in select tag
if (type == 'select' && normalizedProps.defaultValue != null) {
normalizedProps.value = toChildArray(props.children).forEach(child => {
if (normalizedProps.multiple) {
child.props.selected =
normalizedProps.defaultValue.indexOf(child.props.value) != -1;
} else {
child.props.selected =
normalizedProps.defaultValue == child.props.value;
}
});
}
if (props.class && !props.className) {
normalizedProps.class = props.class;
Object.defineProperty(
normalizedProps,
'className',
classNameDescriptorNonEnumberable
);
} else if (props.className && !props.class) {
normalizedProps.class = normalizedProps.className = props.className;
} else if (props.class && props.className) {
normalizedProps.class = normalizedProps.className = props.className;
}
vnode.props = normalizedProps;
}
let oldVNodeHook = options.vnode;
options.vnode = vnode => {
// only normalize props on Element nodes
if (typeof vnode.type === 'string') {
handleDomVNode(vnode);
}
vnode.$$typeof = REACT_ELEMENT_TYPE;
if (oldVNodeHook) oldVNodeHook(vnode);
};
// Only needed for react-relay
let currentComponent;
const oldBeforeRender = options._render;
options._render = function (vnode) {
if (oldBeforeRender) {
oldBeforeRender(vnode);
}
currentComponent = vnode._component;
};
const oldDiffed = options.diffed;
/** @type {(vnode: import('./internal').VNode) => void} */
options.diffed = function (vnode) {
if (oldDiffed) {
oldDiffed(vnode);
}
const props = vnode.props;
const dom = vnode._dom;
if (
dom != null &&
vnode.type === 'textarea' &&
'value' in props &&
props.value !== dom.value
) {
dom.value = props.value == null ? '' : props.value;
}
currentComponent = null;
};
// This is a very very private internal function for React it
// is used to sort-of do runtime dependency injection.
export const __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {
ReactCurrentDispatcher: {
current: {
readContext(context) {
return currentComponent._globalContext[context._id].props.value;
},
useCallback,
useContext,
useDebugValue,
useDeferredValue,
useEffect,
useId,
useImperativeHandle,
useInsertionEffect,
useLayoutEffect,
useMemo,
// useMutableSource, // experimental-only and replaced by uSES, likely not worth supporting
useReducer,
useRef,
useState,
useSyncExternalStore,
useTransition
}
}
};

16
node_modules/preact/compat/src/suspense-list.d.ts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
// Intentionally not using a relative path to take advantage of
// the TS version resolution mechanism
import { Component, ComponentChild, ComponentChildren } from 'preact';
//
// SuspenseList
// -----------------------------------
export interface SuspenseListProps {
children?: ComponentChildren;
revealOrder?: 'forwards' | 'backwards' | 'together';
}
export class SuspenseList extends Component<SuspenseListProps> {
render(): ComponentChild;
}

127
node_modules/preact/compat/src/suspense-list.js generated vendored Normal file
View File

@@ -0,0 +1,127 @@
import { Component, toChildArray } from 'preact';
import { suspended } from './suspense.js';
// Indexes to linked list nodes (nodes are stored as arrays to save bytes).
const SUSPENDED_COUNT = 0;
const RESOLVED_COUNT = 1;
const NEXT_NODE = 2;
// Having custom inheritance instead of a class here saves a lot of bytes.
export function SuspenseList() {
this._next = null;
this._map = null;
}
// Mark one of child's earlier suspensions as resolved.
// Some pending callbacks may become callable due to this
// (e.g. the last suspended descendant gets resolved when
// revealOrder === 'together'). Process those callbacks as well.
const resolve = (list, child, node) => {
if (++node[RESOLVED_COUNT] === node[SUSPENDED_COUNT]) {
// The number a child (or any of its descendants) has been suspended
// matches the number of times it's been resolved. Therefore we
// mark the child as completely resolved by deleting it from ._map.
// This is used to figure out when *all* children have been completely
// resolved when revealOrder is 'together'.
list._map.delete(child);
}
// If revealOrder is falsy then we can do an early exit, as the
// callbacks won't get queued in the node anyway.
// If revealOrder is 'together' then also do an early exit
// if all suspended descendants have not yet been resolved.
if (
!list.props.revealOrder ||
(list.props.revealOrder[0] === 't' && list._map.size)
) {
return;
}
// Walk the currently suspended children in order, calling their
// stored callbacks on the way. Stop if we encounter a child that
// has not been completely resolved yet.
node = list._next;
while (node) {
while (node.length > 3) {
node.pop()();
}
if (node[RESOLVED_COUNT] < node[SUSPENDED_COUNT]) {
break;
}
list._next = node = node[NEXT_NODE];
}
};
// Things we do here to save some bytes but are not proper JS inheritance:
// - call `new Component()` as the prototype
// - do not set `Suspense.prototype.constructor` to `Suspense`
SuspenseList.prototype = new Component();
SuspenseList.prototype._suspended = function (child) {
const list = this;
const delegated = suspended(list._vnode);
let node = list._map.get(child);
node[SUSPENDED_COUNT]++;
return unsuspend => {
const wrappedUnsuspend = () => {
if (!list.props.revealOrder) {
// Special case the undefined (falsy) revealOrder, as there
// is no need to coordinate a specific order or unsuspends.
unsuspend();
} else {
node.push(unsuspend);
resolve(list, child, node);
}
};
if (delegated) {
delegated(wrappedUnsuspend);
} else {
wrappedUnsuspend();
}
};
};
SuspenseList.prototype.render = function (props) {
this._next = null;
this._map = new Map();
const children = toChildArray(props.children);
if (props.revealOrder && props.revealOrder[0] === 'b') {
// If order === 'backwards' (or, well, anything starting with a 'b')
// then flip the child list around so that the last child will be
// the first in the linked list.
children.reverse();
}
// Build the linked list. Iterate through the children in reverse order
// so that `_next` points to the first linked list node to be resolved.
for (let i = children.length; i--; ) {
// Create a new linked list node as an array of form:
// [suspended_count, resolved_count, next_node]
// where suspended_count and resolved_count are numeric counters for
// keeping track how many times a node has been suspended and resolved.
//
// Note that suspended_count starts from 1 instead of 0, so we can block
// processing callbacks until componentDidMount has been called. In a sense
// node is suspended at least until componentDidMount gets called!
//
// Pending callbacks are added to the end of the node:
// [suspended_count, resolved_count, next_node, callback_0, callback_1, ...]
this._map.set(children[i], (this._next = [1, 0, this._next]));
}
return props.children;
};
SuspenseList.prototype.componentDidUpdate =
SuspenseList.prototype.componentDidMount = function () {
// Iterate through all children after mounting for two reasons:
// 1. As each node[SUSPENDED_COUNT] starts from 1, this iteration increases
// each node[RELEASED_COUNT] by 1, therefore balancing the counters.
// The nodes can now be completely consumed from the linked list.
// 2. Handle nodes that might have gotten resolved between render and
// componentDidMount.
this._map.forEach((node, child) => {
resolve(this, child, node);
});
};

19
node_modules/preact/compat/src/suspense.d.ts generated vendored Normal file
View File

@@ -0,0 +1,19 @@
// Intentionally not using a relative path to take advantage of
// the TS version resolution mechanism
import { Component, ComponentChild, ComponentChildren } from 'preact';
//
// Suspense/lazy
// -----------------------------------
export function lazy<T>(
loader: () => Promise<{ default: T } | T>
): T extends { default: infer U } ? U : T;
export interface SuspenseProps {
children?: ComponentChildren;
fallback: ComponentChildren;
}
export class Suspense extends Component<SuspenseProps> {
render(): ComponentChild;
}

276
node_modules/preact/compat/src/suspense.js generated vendored Normal file
View File

@@ -0,0 +1,276 @@
import { Component, createElement, options, Fragment } from 'preact';
import { MODE_HYDRATE } from '../../src/constants';
import { assign } from './util';
const oldCatchError = options._catchError;
options._catchError = function (error, newVNode, oldVNode, errorInfo) {
if (error.then) {
/** @type {import('./internal').Component} */
let component;
let vnode = newVNode;
for (; (vnode = vnode._parent); ) {
if ((component = vnode._component) && component._childDidSuspend) {
if (newVNode._dom == null) {
newVNode._dom = oldVNode._dom;
newVNode._children = oldVNode._children;
}
// Don't call oldCatchError if we found a Suspense
return component._childDidSuspend(error, newVNode);
}
}
}
oldCatchError(error, newVNode, oldVNode, errorInfo);
};
const oldUnmount = options.unmount;
options.unmount = function (vnode) {
/** @type {import('./internal').Component} */
const component = vnode._component;
if (component && component._onResolve) {
component._onResolve();
}
// if the component is still hydrating
// most likely it is because the component is suspended
// we set the vnode.type as `null` so that it is not a typeof function
// so the unmount will remove the vnode._dom
if (component && vnode._flags & MODE_HYDRATE) {
vnode.type = null;
}
if (oldUnmount) oldUnmount(vnode);
};
function detachedClone(vnode, detachedParent, parentDom) {
if (vnode) {
if (vnode._component && vnode._component.__hooks) {
vnode._component.__hooks._list.forEach(effect => {
if (typeof effect._cleanup == 'function') effect._cleanup();
});
vnode._component.__hooks = null;
}
vnode = assign({}, vnode);
if (vnode._component != null) {
if (vnode._component._parentDom === parentDom) {
vnode._component._parentDom = detachedParent;
}
vnode._component._force = true;
vnode._component = null;
}
vnode._children =
vnode._children &&
vnode._children.map(child =>
detachedClone(child, detachedParent, parentDom)
);
}
return vnode;
}
function removeOriginal(vnode, detachedParent, originalParent) {
if (vnode && originalParent) {
vnode._original = null;
vnode._children =
vnode._children &&
vnode._children.map(child =>
removeOriginal(child, detachedParent, originalParent)
);
if (vnode._component) {
if (vnode._component._parentDom === detachedParent) {
if (vnode._dom) {
originalParent.appendChild(vnode._dom);
}
vnode._component._force = true;
vnode._component._parentDom = originalParent;
}
}
}
return vnode;
}
// having custom inheritance instead of a class here saves a lot of bytes
export function Suspense() {
// we do not call super here to golf some bytes...
this._pendingSuspensionCount = 0;
this._suspenders = null;
this._detachOnNextRender = null;
}
// Things we do here to save some bytes but are not proper JS inheritance:
// - call `new Component()` as the prototype
// - do not set `Suspense.prototype.constructor` to `Suspense`
Suspense.prototype = new Component();
/**
* @this {import('./internal').SuspenseComponent}
* @param {Promise} promise The thrown promise
* @param {import('./internal').VNode<any, any>} suspendingVNode The suspending component
*/
Suspense.prototype._childDidSuspend = function (promise, suspendingVNode) {
const suspendingComponent = suspendingVNode._component;
/** @type {import('./internal').SuspenseComponent} */
const c = this;
if (c._suspenders == null) {
c._suspenders = [];
}
c._suspenders.push(suspendingComponent);
const resolve = suspended(c._vnode);
let resolved = false;
const onResolved = () => {
if (resolved) return;
resolved = true;
suspendingComponent._onResolve = null;
if (resolve) {
resolve(onSuspensionComplete);
} else {
onSuspensionComplete();
}
};
suspendingComponent._onResolve = onResolved;
const onSuspensionComplete = () => {
if (!--c._pendingSuspensionCount) {
// If the suspension was during hydration we don't need to restore the
// suspended children into the _children array
if (c.state._suspended) {
const suspendedVNode = c.state._suspended;
c._vnode._children[0] = removeOriginal(
suspendedVNode,
suspendedVNode._component._parentDom,
suspendedVNode._component._originalParentDom
);
}
c.setState({ _suspended: (c._detachOnNextRender = null) });
let suspended;
while ((suspended = c._suspenders.pop())) {
suspended.forceUpdate();
}
}
};
/**
* We do not set `suspended: true` during hydration because we want the actual markup
* to remain on screen and hydrate it when the suspense actually gets resolved.
* While in non-hydration cases the usual fallback -> component flow would occour.
*/
if (
!c._pendingSuspensionCount++ &&
!(suspendingVNode._flags & MODE_HYDRATE)
) {
c.setState({ _suspended: (c._detachOnNextRender = c._vnode._children[0]) });
}
promise.then(onResolved, onResolved);
};
Suspense.prototype.componentWillUnmount = function () {
this._suspenders = [];
};
/**
* @this {import('./internal').SuspenseComponent}
* @param {import('./internal').SuspenseComponent["props"]} props
* @param {import('./internal').SuspenseState} state
*/
Suspense.prototype.render = function (props, state) {
if (this._detachOnNextRender) {
// When the Suspense's _vnode was created by a call to createVNode
// (i.e. due to a setState further up in the tree)
// it's _children prop is null, in this case we "forget" about the parked vnodes to detach
if (this._vnode._children) {
const detachedParent = document.createElement('div');
const detachedComponent = this._vnode._children[0]._component;
this._vnode._children[0] = detachedClone(
this._detachOnNextRender,
detachedParent,
(detachedComponent._originalParentDom = detachedComponent._parentDom)
);
}
this._detachOnNextRender = null;
}
// Wrap fallback tree in a VNode that prevents itself from being marked as aborting mid-hydration:
/** @type {import('./internal').VNode} */
const fallback =
state._suspended && createElement(Fragment, null, props.fallback);
if (fallback) fallback._flags &= ~MODE_HYDRATE;
return [
createElement(Fragment, null, state._suspended ? null : props.children),
fallback
];
};
/**
* Checks and calls the parent component's _suspended method, passing in the
* suspended vnode. This is a way for a parent (e.g. SuspenseList) to get notified
* that one of its children/descendants suspended.
*
* The parent MAY return a callback. The callback will get called when the
* suspension resolves, notifying the parent of the fact.
* Moreover, the callback gets function `unsuspend` as a parameter. The resolved
* child descendant will not actually get unsuspended until `unsuspend` gets called.
* This is a way for the parent to delay unsuspending.
*
* If the parent does not return a callback then the resolved vnode
* gets unsuspended immediately when it resolves.
*
* @param {import('./internal').VNode} vnode
* @returns {((unsuspend: () => void) => void)?}
*/
export function suspended(vnode) {
/** @type {import('./internal').Component} */
let component = vnode._parent._component;
return component && component._suspended && component._suspended(vnode);
}
export function lazy(loader) {
let prom;
let component;
let error;
function Lazy(props) {
if (!prom) {
prom = loader();
prom.then(
exports => {
component = exports.default || exports;
},
e => {
error = e;
}
);
}
if (error) {
throw error;
}
if (!component) {
throw prom;
}
return createElement(component, props);
}
Lazy.displayName = 'Lazy';
Lazy._forwarded = true;
return Lazy;
}

33
node_modules/preact/compat/src/util.js generated vendored Normal file
View File

@@ -0,0 +1,33 @@
/**
* Assign properties from `props` to `obj`
* @template O, P The obj and props types
* @param {O} obj The object to copy properties to
* @param {P} props The object to copy properties from
* @returns {O & P}
*/
export function assign(obj, props) {
for (let i in props) obj[i] = props[i];
return /** @type {O & P} */ (obj);
}
/**
* Check if two objects have a different shape
* @param {object} a
* @param {object} b
* @returns {boolean}
*/
export function shallowDiffers(a, b) {
for (let i in a) if (i !== '__source' && !(i in b)) return true;
for (let i in b) if (i !== '__source' && a[i] !== b[i]) return true;
return false;
}
/**
* Check if two values are the same value
* @param {*} x
* @param {*} y
* @returns {boolean}
*/
export function is(x, y) {
return (x === y && (x !== 0 || 1 / x === 1 / y)) || (x !== x && y !== y);
}

1
node_modules/preact/compat/test-utils.js generated vendored Normal file
View File

@@ -0,0 +1 @@
module.exports = require('preact/test-utils');

1
node_modules/preact/compat/test-utils.mjs generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from 'preact/test-utils';

2
node_modules/preact/debug/dist/debug.js generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/preact/debug/dist/debug.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

2
node_modules/preact/debug/dist/debug.mjs generated vendored Normal file

File diff suppressed because one or more lines are too long

2
node_modules/preact/debug/dist/debug.module.js generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/preact/debug/dist/debug.module.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

2
node_modules/preact/debug/dist/debug.umd.js generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/preact/debug/dist/debug.umd.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

27
node_modules/preact/debug/package.json generated vendored Normal file
View File

@@ -0,0 +1,27 @@
{
"name": "preact-debug",
"amdName": "preactDebug",
"version": "1.0.0",
"private": true,
"description": "Preact extensions for development",
"main": "dist/debug.js",
"module": "dist/debug.module.js",
"umd:main": "dist/debug.umd.js",
"source": "src/index.js",
"license": "MIT",
"mangle": {
"regex": "^(?!_renderer)^_"
},
"peerDependencies": {
"preact": "^10.0.0"
},
"exports": {
".": {
"types": "./src/index.d.ts",
"browser": "./dist/debug.module.js",
"umd": "./dist/debug.umd.js",
"import": "./dist/debug.mjs",
"require": "./dist/debug.js"
}
}
}

54
node_modules/preact/debug/src/check-props.js generated vendored Normal file
View File

@@ -0,0 +1,54 @@
const ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
let loggedTypeFailures = {};
/**
* Reset the history of which prop type warnings have been logged.
*/
export function resetPropWarnings() {
loggedTypeFailures = {};
}
/**
* Assert that the values match with the type specs.
* Error messages are memorized and will only be shown once.
*
* Adapted from https://github.com/facebook/prop-types/blob/master/checkPropTypes.js
*
* @param {object} typeSpecs Map of name to a ReactPropType
* @param {object} values Runtime values that need to be type-checked
* @param {string} location e.g. "prop", "context", "child context"
* @param {string} componentName Name of the component for error messages.
* @param {?Function} getStack Returns the component stack.
*/
export function checkPropTypes(
typeSpecs,
values,
location,
componentName,
getStack
) {
Object.keys(typeSpecs).forEach(typeSpecName => {
let error;
try {
error = typeSpecs[typeSpecName](
values,
typeSpecName,
componentName,
location,
null,
ReactPropTypesSecret
);
} catch (e) {
error = e;
}
if (error && !(error.message in loggedTypeFailures)) {
loggedTypeFailures[error.message] = true;
console.error(
`Failed ${location} type: ${error.message}${
(getStack && `\n${getStack()}`) || ''
}`
);
}
});
}

146
node_modules/preact/debug/src/component-stack.js generated vendored Normal file
View File

@@ -0,0 +1,146 @@
import { options, Fragment } from 'preact';
/**
* Get human readable name of the component/dom node
* @param {import('./internal').VNode} vnode
* @param {import('./internal').VNode} vnode
* @returns {string}
*/
export function getDisplayName(vnode) {
if (vnode.type === Fragment) {
return 'Fragment';
} else if (typeof vnode.type == 'function') {
return vnode.type.displayName || vnode.type.name;
} else if (typeof vnode.type == 'string') {
return vnode.type;
}
return '#text';
}
/**
* Used to keep track of the currently rendered `vnode` and print it
* in debug messages.
*/
let renderStack = [];
/**
* Keep track of the current owners. An owner describes a component
* which was responsible to render a specific `vnode`. This exclude
* children that are passed via `props.children`, because they belong
* to the parent owner.
*
* ```jsx
* const Foo = props => <div>{props.children}</div> // div's owner is Foo
* const Bar = props => {
* return (
* <Foo><span /></Foo> // Foo's owner is Bar, span's owner is Bar
* )
* }
* ```
*
* Note: A `vnode` may be hoisted to the root scope due to compiler
* optimiztions. In these cases the `_owner` will be different.
*/
let ownerStack = [];
/**
* Get the currently rendered `vnode`
* @returns {import('./internal').VNode | null}
*/
export function getCurrentVNode() {
return renderStack.length > 0 ? renderStack[renderStack.length - 1] : null;
}
/**
* If the user doesn't have `@babel/plugin-transform-react-jsx-source`
* somewhere in his tool chain we can't print the filename and source
* location of a component. In that case we just omit that, but we'll
* print a helpful message to the console, notifying the user of it.
*/
let showJsxSourcePluginWarning = true;
/**
* Check if a `vnode` is a possible owner.
* @param {import('./internal').VNode} vnode
*/
function isPossibleOwner(vnode) {
return typeof vnode.type == 'function' && vnode.type != Fragment;
}
/**
* Return the component stack that was captured up to this point.
* @param {import('./internal').VNode} vnode
* @returns {string}
*/
export function getOwnerStack(vnode) {
const stack = [vnode];
let next = vnode;
while (next._owner != null) {
stack.push(next._owner);
next = next._owner;
}
return stack.reduce((acc, owner) => {
acc += ` in ${getDisplayName(owner)}`;
const source = owner.__source;
if (source) {
acc += ` (at ${source.fileName}:${source.lineNumber})`;
} else if (showJsxSourcePluginWarning) {
console.warn(
'Add @babel/plugin-transform-react-jsx-source to get a more detailed component stack. Note that you should not add it to production builds of your App for bundle size reasons.'
);
}
showJsxSourcePluginWarning = false;
return (acc += '\n');
}, '');
}
/**
* Setup code to capture the component trace while rendering. Note that
* we cannot simply traverse `vnode._parent` upwards, because we have some
* debug messages for `this.setState` where the `vnode` is `undefined`.
*/
export function setupComponentStack() {
let oldDiff = options._diff;
let oldDiffed = options.diffed;
let oldRoot = options._root;
let oldVNode = options.vnode;
let oldRender = options._render;
options.diffed = vnode => {
if (isPossibleOwner(vnode)) {
ownerStack.pop();
}
renderStack.pop();
if (oldDiffed) oldDiffed(vnode);
};
options._diff = vnode => {
if (isPossibleOwner(vnode)) {
renderStack.push(vnode);
}
if (oldDiff) oldDiff(vnode);
};
options._root = (vnode, parent) => {
ownerStack = [];
if (oldRoot) oldRoot(vnode, parent);
};
options.vnode = vnode => {
vnode._owner =
ownerStack.length > 0 ? ownerStack[ownerStack.length - 1] : null;
if (oldVNode) oldVNode(vnode);
};
options._render = vnode => {
if (isPossibleOwner(vnode)) {
ownerStack.push(vnode);
}
if (oldRender) oldRender(vnode);
};
}

3
node_modules/preact/debug/src/constants.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export const ELEMENT_NODE = 1;
export const DOCUMENT_NODE = 9;
export const DOCUMENT_FRAGMENT_NODE = 11;

593
node_modules/preact/debug/src/debug.js generated vendored Normal file
View File

@@ -0,0 +1,593 @@
import { checkPropTypes } from './check-props';
import { options, Component } from 'preact';
import {
ELEMENT_NODE,
DOCUMENT_NODE,
DOCUMENT_FRAGMENT_NODE
} from './constants';
import {
getOwnerStack,
setupComponentStack,
getCurrentVNode,
getDisplayName
} from './component-stack';
import { assign, isNaN } from './util';
const isWeakMapSupported = typeof WeakMap == 'function';
/**
* @param {import('./internal').VNode} vnode
* @returns {Array<string>}
*/
function getDomChildren(vnode) {
let domChildren = [];
if (!vnode._children) return domChildren;
vnode._children.forEach(child => {
if (child && typeof child.type === 'function') {
domChildren.push.apply(domChildren, getDomChildren(child));
} else if (child && typeof child.type === 'string') {
domChildren.push(child.type);
}
});
return domChildren;
}
/**
* @param {import('./internal').VNode} parent
* @returns {string}
*/
function getClosestDomNodeParentName(parent) {
if (!parent) return '';
if (typeof parent.type == 'function') {
if (parent._parent == null) {
if (parent._dom != null && parent._dom.parentNode != null) {
return parent._dom.parentNode.localName;
}
return '';
}
return getClosestDomNodeParentName(parent._parent);
}
return /** @type {string} */ (parent.type);
}
export function initDebug() {
setupComponentStack();
let hooksAllowed = false;
/* eslint-disable no-console */
let oldBeforeDiff = options._diff;
let oldDiffed = options.diffed;
let oldVnode = options.vnode;
let oldRender = options._render;
let oldCatchError = options._catchError;
let oldRoot = options._root;
let oldHook = options._hook;
const warnedComponents = !isWeakMapSupported
? null
: {
useEffect: new WeakMap(),
useLayoutEffect: new WeakMap(),
lazyPropTypes: new WeakMap()
};
const deprecations = [];
options._catchError = (error, vnode, oldVNode, errorInfo) => {
let component = vnode && vnode._component;
if (component && typeof error.then == 'function') {
const promise = error;
error = new Error(
`Missing Suspense. The throwing component was: ${getDisplayName(vnode)}`
);
let parent = vnode;
for (; parent; parent = parent._parent) {
if (parent._component && parent._component._childDidSuspend) {
error = promise;
break;
}
}
// We haven't recovered and we know at this point that there is no
// Suspense component higher up in the tree
if (error instanceof Error) {
throw error;
}
}
try {
errorInfo = errorInfo || {};
errorInfo.componentStack = getOwnerStack(vnode);
oldCatchError(error, vnode, oldVNode, errorInfo);
// when an error was handled by an ErrorBoundary we will nonetheless emit an error
// event on the window object. This is to make up for react compatibility in dev mode
// and thus make the Next.js dev overlay work.
if (typeof error.then != 'function') {
setTimeout(() => {
throw error;
});
}
} catch (e) {
throw e;
}
};
options._root = (vnode, parentNode) => {
if (!parentNode) {
throw new Error(
'Undefined parent passed to render(), this is the second argument.\n' +
'Check if the element is available in the DOM/has the correct id.'
);
}
let isValid;
switch (parentNode.nodeType) {
case ELEMENT_NODE:
case DOCUMENT_FRAGMENT_NODE:
case DOCUMENT_NODE:
isValid = true;
break;
default:
isValid = false;
}
if (!isValid) {
let componentName = getDisplayName(vnode);
throw new Error(
`Expected a valid HTML node as a second argument to render. Received ${parentNode} instead: render(<${componentName} />, ${parentNode});`
);
}
if (oldRoot) oldRoot(vnode, parentNode);
};
options._diff = vnode => {
let { type } = vnode;
hooksAllowed = true;
if (type === undefined) {
throw new Error(
'Undefined component passed to createElement()\n\n' +
'You likely forgot to export your component or might have mixed up default and named imports' +
serializeVNode(vnode) +
`\n\n${getOwnerStack(vnode)}`
);
} else if (type != null && typeof type == 'object') {
if (type._children !== undefined && type._dom !== undefined) {
throw new Error(
`Invalid type passed to createElement(): ${type}\n\n` +
'Did you accidentally pass a JSX literal as JSX twice?\n\n' +
` let My${getDisplayName(vnode)} = ${serializeVNode(type)};\n` +
` let vnode = <My${getDisplayName(vnode)} />;\n\n` +
'This usually happens when you export a JSX literal and not the component.' +
`\n\n${getOwnerStack(vnode)}`
);
}
throw new Error(
'Invalid type passed to createElement(): ' +
(Array.isArray(type) ? 'array' : type)
);
}
if (
vnode.ref !== undefined &&
typeof vnode.ref != 'function' &&
typeof vnode.ref != 'object' &&
!('$$typeof' in vnode) // allow string refs when preact-compat is installed
) {
throw new Error(
`Component's "ref" property should be a function, or an object created ` +
`by createRef(), but got [${typeof vnode.ref}] instead\n` +
serializeVNode(vnode) +
`\n\n${getOwnerStack(vnode)}`
);
}
if (typeof vnode.type == 'string') {
for (const key in vnode.props) {
if (
key[0] === 'o' &&
key[1] === 'n' &&
typeof vnode.props[key] != 'function' &&
vnode.props[key] != null
) {
throw new Error(
`Component's "${key}" property should be a function, ` +
`but got [${typeof vnode.props[key]}] instead\n` +
serializeVNode(vnode) +
`\n\n${getOwnerStack(vnode)}`
);
}
}
}
// Check prop-types if available
if (typeof vnode.type == 'function' && vnode.type.propTypes) {
if (
vnode.type.displayName === 'Lazy' &&
warnedComponents &&
!warnedComponents.lazyPropTypes.has(vnode.type)
) {
const m =
'PropTypes are not supported on lazy(). Use propTypes on the wrapped component itself. ';
try {
const lazyVNode = vnode.type();
warnedComponents.lazyPropTypes.set(vnode.type, true);
console.warn(
m + `Component wrapped in lazy() is ${getDisplayName(lazyVNode)}`
);
} catch (promise) {
console.warn(
m + "We will log the wrapped component's name once it is loaded."
);
}
}
let values = vnode.props;
if (vnode.type._forwarded) {
values = assign({}, values);
delete values.ref;
}
checkPropTypes(
vnode.type.propTypes,
values,
'prop',
getDisplayName(vnode),
() => getOwnerStack(vnode)
);
}
if (oldBeforeDiff) oldBeforeDiff(vnode);
};
let renderCount = 0;
let currentComponent;
options._render = vnode => {
if (oldRender) {
oldRender(vnode);
}
hooksAllowed = true;
const nextComponent = vnode._component;
if (nextComponent === currentComponent) {
renderCount++;
} else {
renderCount = 1;
}
if (renderCount >= 25) {
throw new Error(
`Too many re-renders. This is limited to prevent an infinite loop ` +
`which may lock up your browser. The component causing this is: ${getDisplayName(
vnode
)}`
);
}
currentComponent = nextComponent;
};
options._hook = (comp, index, type) => {
if (!comp || !hooksAllowed) {
throw new Error('Hook can only be invoked from render methods.');
}
if (oldHook) oldHook(comp, index, type);
};
// Ideally we'd want to print a warning once per component, but we
// don't have access to the vnode that triggered it here. As a
// compromise and to avoid flooding the console with warnings we
// print each deprecation warning only once.
const warn = (property, message) => ({
get() {
const key = 'get' + property + message;
if (deprecations && deprecations.indexOf(key) < 0) {
deprecations.push(key);
console.warn(`getting vnode.${property} is deprecated, ${message}`);
}
},
set() {
const key = 'set' + property + message;
if (deprecations && deprecations.indexOf(key) < 0) {
deprecations.push(key);
console.warn(`setting vnode.${property} is not allowed, ${message}`);
}
}
});
const deprecatedAttributes = {
nodeName: warn('nodeName', 'use vnode.type'),
attributes: warn('attributes', 'use vnode.props'),
children: warn('children', 'use vnode.props.children')
};
const deprecatedProto = Object.create({}, deprecatedAttributes);
options.vnode = vnode => {
const props = vnode.props;
if (
vnode.type !== null &&
props != null &&
('__source' in props || '__self' in props)
) {
const newProps = (vnode.props = {});
for (let i in props) {
const v = props[i];
if (i === '__source') vnode.__source = v;
else if (i === '__self') vnode.__self = v;
else newProps[i] = v;
}
}
// eslint-disable-next-line
vnode.__proto__ = deprecatedProto;
if (oldVnode) oldVnode(vnode);
};
options.diffed = vnode => {
const { type, _parent: parent } = vnode;
// Check if the user passed plain objects as children. Note that we cannot
// move this check into `options.vnode` because components can receive
// children in any shape they want (e.g.
// `<MyJSONFormatter>{{ foo: 123, bar: "abc" }}</MyJSONFormatter>`).
// Putting this check in `options.diffed` ensures that
// `vnode._children` is set and that we only validate the children
// that were actually rendered.
if (vnode._children) {
vnode._children.forEach(child => {
if (typeof child === 'object' && child && child.type === undefined) {
const keys = Object.keys(child).join(',');
throw new Error(
`Objects are not valid as a child. Encountered an object with the keys {${keys}}.` +
`\n\n${getOwnerStack(vnode)}`
);
}
});
}
if (vnode._component === currentComponent) {
renderCount = 0;
}
if (
typeof type === 'string' &&
(isTableElement(type) ||
type === 'p' ||
type === 'a' ||
type === 'button')
) {
// Avoid false positives when Preact only partially rendered the
// HTML tree. Whilst we attempt to include the outer DOM in our
// validation, this wouldn't work on the server for
// `preact-render-to-string`. There we'd otherwise flood the terminal
// with false positives, which we'd like to avoid.
let domParentName = getClosestDomNodeParentName(parent);
if (domParentName !== '' && isTableElement(type)) {
if (
type === 'table' &&
// Tables can be nested inside each other if it's inside a cell.
// See https://developer.mozilla.org/en-US/docs/Learn/HTML/Tables/Advanced#nesting_tables
domParentName !== 'td' &&
isTableElement(domParentName)
) {
console.error(
'Improper nesting of table. Your <table> should not have a table-node parent.' +
serializeVNode(vnode) +
`\n\n${getOwnerStack(vnode)}`
);
} else if (
(type === 'thead' || type === 'tfoot' || type === 'tbody') &&
domParentName !== 'table'
) {
console.error(
'Improper nesting of table. Your <thead/tbody/tfoot> should have a <table> parent.' +
serializeVNode(vnode) +
`\n\n${getOwnerStack(vnode)}`
);
} else if (
type === 'tr' &&
domParentName !== 'thead' &&
domParentName !== 'tfoot' &&
domParentName !== 'tbody'
) {
console.error(
'Improper nesting of table. Your <tr> should have a <thead/tbody/tfoot> parent.' +
serializeVNode(vnode) +
`\n\n${getOwnerStack(vnode)}`
);
} else if (type === 'td' && domParentName !== 'tr') {
console.error(
'Improper nesting of table. Your <td> should have a <tr> parent.' +
serializeVNode(vnode) +
`\n\n${getOwnerStack(vnode)}`
);
} else if (type === 'th' && domParentName !== 'tr') {
console.error(
'Improper nesting of table. Your <th> should have a <tr>.' +
serializeVNode(vnode) +
`\n\n${getOwnerStack(vnode)}`
);
}
} else if (type === 'p') {
let illegalDomChildrenTypes = getDomChildren(vnode).filter(childType =>
ILLEGAL_PARAGRAPH_CHILD_ELEMENTS.test(childType)
);
if (illegalDomChildrenTypes.length) {
console.error(
'Improper nesting of paragraph. Your <p> should not have ' +
illegalDomChildrenTypes.join(', ') +
' as child-elements.' +
serializeVNode(vnode) +
`\n\n${getOwnerStack(vnode)}`
);
}
} else if (type === 'a' || type === 'button') {
if (getDomChildren(vnode).indexOf(type) !== -1) {
console.error(
`Improper nesting of interactive content. Your <${type}>` +
` should not have other ${type === 'a' ? 'anchor' : 'button'}` +
' tags as child-elements.' +
serializeVNode(vnode) +
`\n\n${getOwnerStack(vnode)}`
);
}
}
}
hooksAllowed = false;
if (oldDiffed) oldDiffed(vnode);
if (vnode._children != null) {
const keys = [];
for (let i = 0; i < vnode._children.length; i++) {
const child = vnode._children[i];
if (!child || child.key == null) continue;
const key = child.key;
if (keys.indexOf(key) !== -1) {
console.error(
'Following component has two or more children with the ' +
`same key attribute: "${key}". This may cause glitches and misbehavior ` +
'in rendering process. Component: \n\n' +
serializeVNode(vnode) +
`\n\n${getOwnerStack(vnode)}`
);
// Break early to not spam the console
break;
}
keys.push(key);
}
}
if (vnode._component != null && vnode._component.__hooks != null) {
// Validate that none of the hooks in this component contain arguments that are NaN.
// This is a common mistake that can be hard to debug, so we want to catch it early.
const hooks = vnode._component.__hooks._list;
if (hooks) {
for (let i = 0; i < hooks.length; i += 1) {
const hook = hooks[i];
if (hook._args) {
for (let j = 0; j < hook._args.length; j++) {
const arg = hook._args[j];
if (isNaN(arg)) {
const componentName = getDisplayName(vnode);
console.warn(
`Invalid argument passed to hook. Hooks should not be called with NaN in the dependency array. Hook index ${i} in component ${componentName} was called with NaN.`
);
}
}
}
}
}
}
};
}
const setState = Component.prototype.setState;
Component.prototype.setState = function (update, callback) {
if (this._vnode == null) {
// `this._vnode` will be `null` during componentWillMount. But it
// is perfectly valid to call `setState` during cWM. So we
// need an additional check to verify that we are dealing with a
// call inside constructor.
if (this.state == null) {
console.warn(
`Calling "this.setState" inside the constructor of a component is a ` +
`no-op and might be a bug in your application. Instead, set ` +
`"this.state = {}" directly.\n\n${getOwnerStack(getCurrentVNode())}`
);
}
}
return setState.call(this, update, callback);
};
function isTableElement(type) {
return (
type === 'table' ||
type === 'tfoot' ||
type === 'tbody' ||
type === 'thead' ||
type === 'td' ||
type === 'tr' ||
type === 'th'
);
}
const ILLEGAL_PARAGRAPH_CHILD_ELEMENTS =
/^(address|article|aside|blockquote|details|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|main|menu|nav|ol|p|pre|search|section|table|ul)$/;
const forceUpdate = Component.prototype.forceUpdate;
Component.prototype.forceUpdate = function (callback) {
if (this._vnode == null) {
console.warn(
`Calling "this.forceUpdate" inside the constructor of a component is a ` +
`no-op and might be a bug in your application.\n\n${getOwnerStack(
getCurrentVNode()
)}`
);
} else if (this._parentDom == null) {
console.warn(
`Can't call "this.forceUpdate" on an unmounted component. This is a no-op, ` +
`but it indicates a memory leak in your application. To fix, cancel all ` +
`subscriptions and asynchronous tasks in the componentWillUnmount method.` +
`\n\n${getOwnerStack(this._vnode)}`
);
}
return forceUpdate.call(this, callback);
};
/**
* Serialize a vnode tree to a string
* @param {import('./internal').VNode} vnode
* @returns {string}
*/
export function serializeVNode(vnode) {
let { props } = vnode;
let name = getDisplayName(vnode);
let attrs = '';
for (let prop in props) {
if (props.hasOwnProperty(prop) && prop !== 'children') {
let value = props[prop];
// If it is an object but doesn't have toString(), use Object.toString
if (typeof value == 'function') {
value = `function ${value.displayName || value.name}() {}`;
}
value =
Object(value) === value && !value.toString
? Object.prototype.toString.call(value)
: value + '';
attrs += ` ${prop}=${JSON.stringify(value)}`;
}
}
let children = props.children;
return `<${name}${attrs}${
children && children.length ? '>..</' + name + '>' : ' />'
}`;
}
options._hydrationMismatch = (newVNode, excessDomChildren) => {
const { type } = newVNode;
const availableTypes = excessDomChildren
.map(child => child && child.localName)
.filter(Boolean);
console.error(
`Expected a DOM node of type "${type}" but found "${availableTypes.join(', ')}" as available DOM-node(s), this is caused by the SSR'd HTML containing different DOM-nodes compared to the hydrated one.\n\n${getOwnerStack(newVNode)}`
);
};

4
node_modules/preact/debug/src/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
/**
* Reset the history of which prop type warnings have been logged.
*/
export function resetPropWarnings(): void;

6
node_modules/preact/debug/src/index.js generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import { initDebug } from './debug';
import 'preact/devtools';
initDebug();
export { resetPropWarnings } from './check-props';

82
node_modules/preact/debug/src/internal.d.ts generated vendored Normal file
View File

@@ -0,0 +1,82 @@
import { Component, PreactElement, VNode, Options } from '../../src/internal';
export { Component, PreactElement, VNode, Options };
export interface DevtoolsInjectOptions {
/** 1 = DEV, 0 = production */
bundleType: 1 | 0;
/** The devtools enable different features for different versions of react */
version: string;
/** Informative string, currently unused in the devtools */
rendererPackageName: string;
/** Find the root dom node of a vnode */
findHostInstanceByFiber(vnode: VNode): HTMLElement | null;
/** Find the closest vnode given a dom node */
findFiberByHostInstance(instance: HTMLElement): VNode | null;
}
export interface DevtoolsUpdater {
setState(objOrFn: any): void;
forceUpdate(): void;
setInState(path: Array<string | number>, value: any): void;
setInProps(path: Array<string | number>, value: any): void;
setInContext(): void;
}
export type NodeType = 'Composite' | 'Native' | 'Wrapper' | 'Text';
export interface DevtoolData {
nodeType: NodeType;
// Component type
type: any;
name: string;
ref: any;
key: string | number;
updater: DevtoolsUpdater | null;
text: string | number | null;
state: any;
props: any;
children: VNode[] | string | number | null;
publicInstance: PreactElement | Text | Component;
memoizedInteractions: any[];
actualDuration: number;
actualStartTime: number;
treeBaseDuration: number;
}
export type EventType =
| 'unmount'
| 'rootCommitted'
| 'root'
| 'mount'
| 'update'
| 'updateProfileTimes';
export interface DevtoolsEvent {
data?: DevtoolData;
internalInstance: VNode;
renderer: string;
type: EventType;
}
export interface DevtoolsHook {
_renderers: Record<string, any>;
_roots: Set<VNode>;
on(ev: string, listener: () => void): void;
emit(ev: string, data?: object): void;
helpers: Record<string, any>;
getFiberRoots(rendererId: string): Set<any>;
inject(config: DevtoolsInjectOptions): string;
onCommitFiberRoot(rendererId: string, root: VNode): void;
onCommitFiberUnmount(rendererId: string, vnode: VNode): void;
}
export interface DevtoolsWindow extends Window {
/**
* If the devtools extension is installed it will inject this object into
* the dom. This hook handles all communications between preact and the
* devtools panel.
*/
__REACT_DEVTOOLS_GLOBAL_HOOK__?: DevtoolsHook;
}

15
node_modules/preact/debug/src/util.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
/**
* Assign properties from `props` to `obj`
* @template O, P The obj and props types
* @param {O} obj The object to copy properties to
* @param {P} props The object to copy properties from
* @returns {O & P}
*/
export function assign(obj, props) {
for (let i in props) obj[i] = props[i];
return /** @type {O & P} */ (obj);
}
export function isNaN(value) {
return value !== value;
}

2
node_modules/preact/devtools/dist/devtools.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
var e,n=require("preact");null!=(e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0)&&e.__PREACT_DEVTOOLS__&&e.__PREACT_DEVTOOLS__.attachPreact("10.26.9",n.options,{Fragment:n.Fragment,Component:n.Component}),exports.addHookName=function(e,o){return n.options.__a&&n.options.__a(o),e};
//# sourceMappingURL=devtools.js.map

1
node_modules/preact/devtools/dist/devtools.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"devtools.js","sources":["../src/devtools.js","../src/index.js"],"sourcesContent":["import { Component, Fragment, options } from 'preact';\n\nexport function initDevTools() {\n\tconst globalVar =\n\t\ttypeof globalThis !== 'undefined'\n\t\t\t? globalThis\n\t\t\t: typeof window !== 'undefined'\n\t\t\t\t? window\n\t\t\t\t: undefined;\n\n\tif (\n\t\tglobalVar !== null &&\n\t\tglobalVar !== undefined &&\n\t\tglobalVar.__PREACT_DEVTOOLS__\n\t) {\n\t\tglobalVar.__PREACT_DEVTOOLS__.attachPreact('10.26.9', options, {\n\t\t\tFragment,\n\t\t\tComponent\n\t\t});\n\t}\n}\n","import { options } from 'preact';\nimport { initDevTools } from './devtools';\n\ninitDevTools();\n\n/**\n * Display a custom label for a custom hook for the devtools panel\n * @type {<T>(value: T, name: string) => T}\n */\nexport function addHookName(value, name) {\n\tif (options._addHookName) {\n\t\toptions._addHookName(name);\n\t}\n\treturn value;\n}\n"],"names":["globalVar","globalThis","window","undefined","__PREACT_DEVTOOLS__","attachPreact","options","Fragment","Component","value","name","__a"],"mappings":"IAGOA,sBAQLA,OARKA,EACiB,oBAAfC,WACJA,WACkB,oBAAXC,OACNA,YACAC,IAKJH,EAAUI,qBAEVJ,EAAUI,oBAAoBC,aAAa,UAAWC,EAAOA,QAAE,CAC9DC,SAAAA,EAAAA,SACAC,UAAAA,EAAAA,gCCRa,SAAYC,EAAOC,GAIlC,OAHIJ,EAAAA,QAAOK,KACVL,EAAAA,QAAOK,IAAcD,GAEfD,CACR"}

2
node_modules/preact/devtools/dist/devtools.mjs generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import{options as n,Fragment as o,Component as e}from"preact";var i;function t(o,e){return n.__a&&n.__a(e),o}null!=(i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0)&&i.__PREACT_DEVTOOLS__&&i.__PREACT_DEVTOOLS__.attachPreact("10.26.9",n,{Fragment:o,Component:e});export{t as addHookName};
//# sourceMappingURL=devtools.module.js.map

2
node_modules/preact/devtools/dist/devtools.module.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import{options as n,Fragment as o,Component as e}from"preact";var i;function t(o,e){return n.__a&&n.__a(e),o}null!=(i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0)&&i.__PREACT_DEVTOOLS__&&i.__PREACT_DEVTOOLS__.attachPreact("10.26.9",n,{Fragment:o,Component:e});export{t as addHookName};
//# sourceMappingURL=devtools.module.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"devtools.module.js","sources":["../src/devtools.js","../src/index.js"],"sourcesContent":["import { Component, Fragment, options } from 'preact';\n\nexport function initDevTools() {\n\tconst globalVar =\n\t\ttypeof globalThis !== 'undefined'\n\t\t\t? globalThis\n\t\t\t: typeof window !== 'undefined'\n\t\t\t\t? window\n\t\t\t\t: undefined;\n\n\tif (\n\t\tglobalVar !== null &&\n\t\tglobalVar !== undefined &&\n\t\tglobalVar.__PREACT_DEVTOOLS__\n\t) {\n\t\tglobalVar.__PREACT_DEVTOOLS__.attachPreact('10.26.9', options, {\n\t\t\tFragment,\n\t\t\tComponent\n\t\t});\n\t}\n}\n","import { options } from 'preact';\nimport { initDevTools } from './devtools';\n\ninitDevTools();\n\n/**\n * Display a custom label for a custom hook for the devtools panel\n * @type {<T>(value: T, name: string) => T}\n */\nexport function addHookName(value, name) {\n\tif (options._addHookName) {\n\t\toptions._addHookName(name);\n\t}\n\treturn value;\n}\n"],"names":["globalVar","addHookName","value","name","options","__a","globalThis","window","undefined","__PREACT_DEVTOOLS__","attachPreact","Fragment","Component"],"mappings":"8DAEgB,IACTA,ECMS,SAAAC,EAAYC,EAAOC,GAIlC,OAHIC,EAAOC,KACVD,EAAOC,IAAcF,GAEfD,CACR,CDHEF,OARKA,EACiB,oBAAfM,WACJA,WACkB,oBAAXC,OACNA,YACAC,IAKJR,EAAUS,qBAEVT,EAAUS,oBAAoBC,aAAa,UAAWN,EAAS,CAC9DO,SAAAA,EACAC,UAAAA"}

2
node_modules/preact/devtools/dist/devtools.umd.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],n):n((e||self).preactDevtools={},e.preact)}(this,function(e,n){var o;null!=(o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0)&&o.__PREACT_DEVTOOLS__&&o.__PREACT_DEVTOOLS__.attachPreact("10.26.9",n.options,{Fragment:n.Fragment,Component:n.Component}),e.addHookName=function(e,o){return n.options.__a&&n.options.__a(o),e}});
//# sourceMappingURL=devtools.umd.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"devtools.umd.js","sources":["../src/devtools.js","../src/index.js"],"sourcesContent":["import { Component, Fragment, options } from 'preact';\n\nexport function initDevTools() {\n\tconst globalVar =\n\t\ttypeof globalThis !== 'undefined'\n\t\t\t? globalThis\n\t\t\t: typeof window !== 'undefined'\n\t\t\t\t? window\n\t\t\t\t: undefined;\n\n\tif (\n\t\tglobalVar !== null &&\n\t\tglobalVar !== undefined &&\n\t\tglobalVar.__PREACT_DEVTOOLS__\n\t) {\n\t\tglobalVar.__PREACT_DEVTOOLS__.attachPreact('10.26.9', options, {\n\t\t\tFragment,\n\t\t\tComponent\n\t\t});\n\t}\n}\n","import { options } from 'preact';\nimport { initDevTools } from './devtools';\n\ninitDevTools();\n\n/**\n * Display a custom label for a custom hook for the devtools panel\n * @type {<T>(value: T, name: string) => T}\n */\nexport function addHookName(value, name) {\n\tif (options._addHookName) {\n\t\toptions._addHookName(name);\n\t}\n\treturn value;\n}\n"],"names":["globalVar","globalThis","window","undefined","__PREACT_DEVTOOLS__","attachPreact","options","Fragment","Component","value","name","__a"],"mappings":"8QAEgB,IACTA,EAQLA,OARKA,EACiB,oBAAfC,WACJA,WACkB,oBAAXC,OACNA,YACAC,IAKJH,EAAUI,qBAEVJ,EAAUI,oBAAoBC,aAAa,UAAWC,EAAOA,QAAE,CAC9DC,SAAAA,EAAAA,SACAC,UAAAA,EAAAA,0BCRa,SAAYC,EAAOC,GAIlC,OAHIJ,EAAAA,QAAOK,KACVL,EAAAA,QAAOK,IAAcD,GAEfD,CACR"}

25
node_modules/preact/devtools/package.json generated vendored Normal file
View File

@@ -0,0 +1,25 @@
{
"name": "preact-devtools",
"amdName": "preactDevtools",
"version": "1.0.0",
"private": true,
"description": "Preact bridge for Preact devtools",
"main": "dist/devtools.js",
"module": "dist/devtools.module.js",
"umd:main": "dist/devtools.umd.js",
"source": "src/index.js",
"license": "MIT",
"types": "src/index.d.ts",
"peerDependencies": {
"preact": "^10.0.0"
},
"exports": {
".": {
"types": "./src/index.d.ts",
"browser": "./dist/devtools.module.js",
"umd": "./dist/devtools.umd.js",
"import": "./dist/devtools.mjs",
"require": "./dist/devtools.js"
}
}
}

21
node_modules/preact/devtools/src/devtools.js generated vendored Normal file
View File

@@ -0,0 +1,21 @@
import { Component, Fragment, options } from 'preact';
export function initDevTools() {
const globalVar =
typeof globalThis !== 'undefined'
? globalThis
: typeof window !== 'undefined'
? window
: undefined;
if (
globalVar !== null &&
globalVar !== undefined &&
globalVar.__PREACT_DEVTOOLS__
) {
globalVar.__PREACT_DEVTOOLS__.attachPreact('10.26.9', options, {
Fragment,
Component
});
}
}

8
node_modules/preact/devtools/src/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
/**
* Customize the displayed name of a useState, useReducer or useRef hook
* in the devtools panel.
*
* @param value Wrapped native hook.
* @param name Custom name
*/
export function addHookName<T>(value: T, name: string): T;

15
node_modules/preact/devtools/src/index.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
import { options } from 'preact';
import { initDevTools } from './devtools';
initDevTools();
/**
* Display a custom label for a custom hook for the devtools panel
* @type {<T>(value: T, name: string) => T}
*/
export function addHookName(value, name) {
if (options._addHookName) {
options._addHookName(name);
}
return value;
}

2
node_modules/preact/dist/preact.js generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/preact/dist/preact.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

2
node_modules/preact/dist/preact.min.js generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/preact/dist/preact.min.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

2
node_modules/preact/dist/preact.min.module.js generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/preact/dist/preact.min.module.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

2
node_modules/preact/dist/preact.min.umd.js generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/preact/dist/preact.min.umd.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

2
node_modules/preact/dist/preact.mjs generated vendored Normal file

File diff suppressed because one or more lines are too long

2
node_modules/preact/dist/preact.module.js generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/preact/dist/preact.module.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

2
node_modules/preact/dist/preact.umd.js generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/preact/dist/preact.umd.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

2
node_modules/preact/hooks/dist/hooks.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
var n,t,r,u,o=require("preact"),i=0,f=[],c=o.options,e=c.__b,a=c.__r,v=c.diffed,s=c.__c,l=c.unmount,p=c.__;function x(n,r){c.__h&&c.__h(t,n,i||r),i=0;var u=t.__H||(t.__H={__:[],__h:[]});return n>=u.__.length&&u.__.push({}),u.__[n]}function m(n){return i=1,d(b,n)}function d(r,u,o){var i=x(n++,2);if(i.t=r,!i.__c&&(i.__=[o?o(u):b(void 0,u),function(n){var t=i.__N?i.__N[0]:i.__[0],r=i.t(t,n);t!==r&&(i.__N=[r,i.__[1]],i.__c.setState({}))}],i.__c=t,!t.__f)){var f=function(n,t,r){if(!i.__c.__H)return!0;var u=i.__c.__H.__.filter(function(n){return!!n.__c});if(u.every(function(n){return!n.__N}))return!c||c.call(this,n,t,r);var o=i.__c.props!==n;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(o=!0)}}),c&&c.call(this,n,t,r)||o};t.__f=!0;var c=t.shouldComponentUpdate,e=t.componentWillUpdate;t.componentWillUpdate=function(n,t,r){if(this.__e){var u=c;c=void 0,f(n,t,r),c=u}e&&e.call(this,n,t,r)},t.shouldComponentUpdate=f}return i.__N||i.__}function h(r,u){var o=x(n++,4);!c.__s&&P(o.__H,u)&&(o.__=r,o.u=u,t.__h.push(o))}function y(t,r){var u=x(n++,7);return P(u.__H,r)&&(u.__=t(),u.__H=r,u.__h=t),u.__}function _(){for(var n;n=f.shift();)if(n.__P&&n.__H)try{n.__H.__h.forEach(F),n.__H.__h.forEach(T),n.__H.__h=[]}catch(t){n.__H.__h=[],c.__e(t,n.__v)}}c.__b=function(n){t=null,e&&e(n)},c.__=function(n,t){n&&t.__k&&t.__k.__m&&(n.__m=t.__k.__m),p&&p(n,t)},c.__r=function(u){a&&a(u),n=0;var o=(t=u.__c).__H;o&&(r===t?(o.__h=[],t.__h=[],o.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(o.__h.forEach(F),o.__h.forEach(T),o.__h=[],n=0)),r=t},c.diffed=function(n){v&&v(n);var o=n.__c;o&&o.__H&&(o.__H.__h.length&&(1!==f.push(o)&&u===c.requestAnimationFrame||((u=c.requestAnimationFrame)||A)(_)),o.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),r=t=null},c.__c=function(n,t){t.some(function(n){try{n.__h.forEach(F),n.__h=n.__h.filter(function(n){return!n.__||T(n)})}catch(r){t.some(function(n){n.__h&&(n.__h=[])}),t=[],c.__e(r,n.__v)}}),s&&s(n,t)},c.unmount=function(n){l&&l(n);var t,r=n.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{F(n)}catch(n){t=n}}),r.__H=void 0,t&&c.__e(t,r.__v))};var q="function"==typeof requestAnimationFrame;function A(n){var t,r=function(){clearTimeout(u),q&&cancelAnimationFrame(t),setTimeout(n)},u=setTimeout(r,35);q&&(t=requestAnimationFrame(r))}function F(n){var r=t,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),t=r}function T(n){var r=t;n.__c=n.__(),t=r}function P(n,t){return!n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function b(n,t){return"function"==typeof t?t(n):t}exports.useCallback=function(n,t){return i=8,y(function(){return n},t)},exports.useContext=function(r){var u=t.context[r.__c],o=x(n++,9);return o.c=r,u?(null==o.__&&(o.__=!0,u.sub(t)),u.props.value):r.__},exports.useDebugValue=function(n,t){c.useDebugValue&&c.useDebugValue(t?t(n):n)},exports.useEffect=function(r,u){var o=x(n++,3);!c.__s&&P(o.__H,u)&&(o.__=r,o.u=u,t.__H.__h.push(o))},exports.useErrorBoundary=function(r){var u=x(n++,10),o=m();return u.__=r,t.componentDidCatch||(t.componentDidCatch=function(n,t){u.__&&u.__(n,t),o[1](n)}),[o[0],function(){o[1](void 0)}]},exports.useId=function(){var r=x(n++,11);if(!r.__){for(var u=t.__v;null!==u&&!u.__m&&null!==u.__;)u=u.__;var o=u.__m||(u.__m=[0,0]);r.__="P"+o[0]+"-"+o[1]++}return r.__},exports.useImperativeHandle=function(n,t,r){i=6,h(function(){if("function"==typeof n){var r=n(t());return function(){n(null),r&&"function"==typeof r&&r()}}if(n)return n.current=t(),function(){return n.current=null}},null==r?r:r.concat(n))},exports.useLayoutEffect=h,exports.useMemo=y,exports.useReducer=d,exports.useRef=function(n){return i=5,y(function(){return{current:n}},[])},exports.useState=m;
//# sourceMappingURL=hooks.js.map

1
node_modules/preact/hooks/dist/hooks.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

2
node_modules/preact/hooks/dist/hooks.mjs generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import{options as n}from"preact";var t,r,u,i,o=0,f=[],c=n,e=c.__b,a=c.__r,v=c.diffed,l=c.__c,m=c.unmount,s=c.__;function p(n,t){c.__h&&c.__h(r,n,o||t),o=0;var u=r.__H||(r.__H={__:[],__h:[]});return n>=u.__.length&&u.__.push({}),u.__[n]}function d(n){return o=1,h(D,n)}function h(n,u,i){var o=p(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):D(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}))}],o.__c=r,!r.__f)){var f=function(n,t,r){if(!o.__c.__H)return!0;var u=o.__c.__H.__.filter(function(n){return!!n.__c});if(u.every(function(n){return!n.__N}))return!c||c.call(this,n,t,r);var i=o.__c.props!==n;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0)}}),c&&c.call(this,n,t,r)||i};r.__f=!0;var c=r.shouldComponentUpdate,e=r.componentWillUpdate;r.componentWillUpdate=function(n,t,r){if(this.__e){var u=c;c=void 0,f(n,t,r),c=u}e&&e.call(this,n,t,r)},r.shouldComponentUpdate=f}return o.__N||o.__}function y(n,u){var i=p(t++,3);!c.__s&&C(i.__H,u)&&(i.__=n,i.u=u,r.__H.__h.push(i))}function _(n,u){var i=p(t++,4);!c.__s&&C(i.__H,u)&&(i.__=n,i.u=u,r.__h.push(i))}function A(n){return o=5,T(function(){return{current:n}},[])}function F(n,t,r){o=6,_(function(){if("function"==typeof n){var r=n(t());return function(){n(null),r&&"function"==typeof r&&r()}}if(n)return n.current=t(),function(){return n.current=null}},null==r?r:r.concat(n))}function T(n,r){var u=p(t++,7);return C(u.__H,r)&&(u.__=n(),u.__H=r,u.__h=n),u.__}function q(n,t){return o=8,T(function(){return n},t)}function x(n){var u=r.context[n.__c],i=p(t++,9);return i.c=n,u?(null==i.__&&(i.__=!0,u.sub(r)),u.props.value):n.__}function P(n,t){c.useDebugValue&&c.useDebugValue(t?t(n):n)}function b(n){var u=p(t++,10),i=d();return u.__=n,r.componentDidCatch||(r.componentDidCatch=function(n,t){u.__&&u.__(n,t),i[1](n)}),[i[0],function(){i[1](void 0)}]}function g(){var n=p(t++,11);if(!n.__){for(var u=r.__v;null!==u&&!u.__m&&null!==u.__;)u=u.__;var i=u.__m||(u.__m=[0,0]);n.__="P"+i[0]+"-"+i[1]++}return n.__}function j(){for(var n;n=f.shift();)if(n.__P&&n.__H)try{n.__H.__h.forEach(z),n.__H.__h.forEach(B),n.__H.__h=[]}catch(t){n.__H.__h=[],c.__e(t,n.__v)}}c.__b=function(n){r=null,e&&e(n)},c.__=function(n,t){n&&t.__k&&t.__k.__m&&(n.__m=t.__k.__m),s&&s(n,t)},c.__r=function(n){a&&a(n),t=0;var i=(r=n.__c).__H;i&&(u===r?(i.__h=[],r.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(i.__h.forEach(z),i.__h.forEach(B),i.__h=[],t=0)),u=r},c.diffed=function(n){v&&v(n);var t=n.__c;t&&t.__H&&(t.__H.__h.length&&(1!==f.push(t)&&i===c.requestAnimationFrame||((i=c.requestAnimationFrame)||w)(j)),t.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),u=r=null},c.__c=function(n,t){t.some(function(n){try{n.__h.forEach(z),n.__h=n.__h.filter(function(n){return!n.__||B(n)})}catch(r){t.some(function(n){n.__h&&(n.__h=[])}),t=[],c.__e(r,n.__v)}}),l&&l(n,t)},c.unmount=function(n){m&&m(n);var t,r=n.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{z(n)}catch(n){t=n}}),r.__H=void 0,t&&c.__e(t,r.__v))};var k="function"==typeof requestAnimationFrame;function w(n){var t,r=function(){clearTimeout(u),k&&cancelAnimationFrame(t),setTimeout(n)},u=setTimeout(r,35);k&&(t=requestAnimationFrame(r))}function z(n){var t=r,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r=t}function B(n){var t=r;n.__c=n.__(),r=t}function C(n,t){return!n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function D(n,t){return"function"==typeof t?t(n):t}export{q as useCallback,x as useContext,P as useDebugValue,y as useEffect,b as useErrorBoundary,g as useId,F as useImperativeHandle,_ as useLayoutEffect,T as useMemo,h as useReducer,A as useRef,d as useState};
//# sourceMappingURL=hooks.module.js.map

2
node_modules/preact/hooks/dist/hooks.module.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import{options as n}from"preact";var t,r,u,i,o=0,f=[],c=n,e=c.__b,a=c.__r,v=c.diffed,l=c.__c,m=c.unmount,s=c.__;function p(n,t){c.__h&&c.__h(r,n,o||t),o=0;var u=r.__H||(r.__H={__:[],__h:[]});return n>=u.__.length&&u.__.push({}),u.__[n]}function d(n){return o=1,h(D,n)}function h(n,u,i){var o=p(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):D(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}))}],o.__c=r,!r.__f)){var f=function(n,t,r){if(!o.__c.__H)return!0;var u=o.__c.__H.__.filter(function(n){return!!n.__c});if(u.every(function(n){return!n.__N}))return!c||c.call(this,n,t,r);var i=o.__c.props!==n;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0)}}),c&&c.call(this,n,t,r)||i};r.__f=!0;var c=r.shouldComponentUpdate,e=r.componentWillUpdate;r.componentWillUpdate=function(n,t,r){if(this.__e){var u=c;c=void 0,f(n,t,r),c=u}e&&e.call(this,n,t,r)},r.shouldComponentUpdate=f}return o.__N||o.__}function y(n,u){var i=p(t++,3);!c.__s&&C(i.__H,u)&&(i.__=n,i.u=u,r.__H.__h.push(i))}function _(n,u){var i=p(t++,4);!c.__s&&C(i.__H,u)&&(i.__=n,i.u=u,r.__h.push(i))}function A(n){return o=5,T(function(){return{current:n}},[])}function F(n,t,r){o=6,_(function(){if("function"==typeof n){var r=n(t());return function(){n(null),r&&"function"==typeof r&&r()}}if(n)return n.current=t(),function(){return n.current=null}},null==r?r:r.concat(n))}function T(n,r){var u=p(t++,7);return C(u.__H,r)&&(u.__=n(),u.__H=r,u.__h=n),u.__}function q(n,t){return o=8,T(function(){return n},t)}function x(n){var u=r.context[n.__c],i=p(t++,9);return i.c=n,u?(null==i.__&&(i.__=!0,u.sub(r)),u.props.value):n.__}function P(n,t){c.useDebugValue&&c.useDebugValue(t?t(n):n)}function b(n){var u=p(t++,10),i=d();return u.__=n,r.componentDidCatch||(r.componentDidCatch=function(n,t){u.__&&u.__(n,t),i[1](n)}),[i[0],function(){i[1](void 0)}]}function g(){var n=p(t++,11);if(!n.__){for(var u=r.__v;null!==u&&!u.__m&&null!==u.__;)u=u.__;var i=u.__m||(u.__m=[0,0]);n.__="P"+i[0]+"-"+i[1]++}return n.__}function j(){for(var n;n=f.shift();)if(n.__P&&n.__H)try{n.__H.__h.forEach(z),n.__H.__h.forEach(B),n.__H.__h=[]}catch(t){n.__H.__h=[],c.__e(t,n.__v)}}c.__b=function(n){r=null,e&&e(n)},c.__=function(n,t){n&&t.__k&&t.__k.__m&&(n.__m=t.__k.__m),s&&s(n,t)},c.__r=function(n){a&&a(n),t=0;var i=(r=n.__c).__H;i&&(u===r?(i.__h=[],r.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(i.__h.forEach(z),i.__h.forEach(B),i.__h=[],t=0)),u=r},c.diffed=function(n){v&&v(n);var t=n.__c;t&&t.__H&&(t.__H.__h.length&&(1!==f.push(t)&&i===c.requestAnimationFrame||((i=c.requestAnimationFrame)||w)(j)),t.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),u=r=null},c.__c=function(n,t){t.some(function(n){try{n.__h.forEach(z),n.__h=n.__h.filter(function(n){return!n.__||B(n)})}catch(r){t.some(function(n){n.__h&&(n.__h=[])}),t=[],c.__e(r,n.__v)}}),l&&l(n,t)},c.unmount=function(n){m&&m(n);var t,r=n.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{z(n)}catch(n){t=n}}),r.__H=void 0,t&&c.__e(t,r.__v))};var k="function"==typeof requestAnimationFrame;function w(n){var t,r=function(){clearTimeout(u),k&&cancelAnimationFrame(t),setTimeout(n)},u=setTimeout(r,35);k&&(t=requestAnimationFrame(r))}function z(n){var t=r,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r=t}function B(n){var t=r;n.__c=n.__(),r=t}function C(n,t){return!n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function D(n,t){return"function"==typeof t?t(n):t}export{q as useCallback,x as useContext,P as useDebugValue,y as useEffect,b as useErrorBoundary,g as useId,F as useImperativeHandle,_ as useLayoutEffect,T as useMemo,h as useReducer,A as useRef,d as useState};
//# sourceMappingURL=hooks.module.js.map

1
node_modules/preact/hooks/dist/hooks.module.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

2
node_modules/preact/hooks/dist/hooks.umd.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],t):t((n||self).preactHooks={},n.preact)}(this,function(n,t){var u,i,r,o,f=0,c=[],e=t.options,a=e.__b,v=e.__r,l=e.diffed,d=e.__c,s=e.unmount,p=e.__;function y(n,t){e.__h&&e.__h(i,n,f||t),f=0;var u=i.__H||(i.__H={__:[],__h:[]});return n>=u.__.length&&u.__.push({}),u.__[n]}function h(n){return f=1,m(j,n)}function m(n,t,r){var o=y(u++,2);if(o.t=n,!o.__c&&(o.__=[r?r(t):j(void 0,t),function(n){var t=o.__N?o.__N[0]:o.__[0],u=o.t(t,n);t!==u&&(o.__N=[u,o.__[1]],o.__c.setState({}))}],o.__c=i,!i.__f)){var f=function(n,t,u){if(!o.__c.__H)return!0;var i=o.__c.__H.__.filter(function(n){return!!n.__c});if(i.every(function(n){return!n.__N}))return!c||c.call(this,n,t,u);var r=o.__c.props!==n;return i.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(r=!0)}}),c&&c.call(this,n,t,u)||r};i.__f=!0;var c=i.shouldComponentUpdate,e=i.componentWillUpdate;i.componentWillUpdate=function(n,t,u){if(this.__e){var i=c;c=void 0,f(n,t,u),c=i}e&&e.call(this,n,t,u)},i.shouldComponentUpdate=f}return o.__N||o.__}function T(n,t){var r=y(u++,4);!e.__s&&g(r.__H,t)&&(r.__=n,r.u=t,i.__h.push(r))}function _(n,t){var i=y(u++,7);return g(i.__H,t)&&(i.__=n(),i.__H=t,i.__h=n),i.__}function b(){for(var n;n=c.shift();)if(n.__P&&n.__H)try{n.__H.__h.forEach(A),n.__H.__h.forEach(F),n.__H.__h=[]}catch(t){n.__H.__h=[],e.__e(t,n.__v)}}e.__b=function(n){i=null,a&&a(n)},e.__=function(n,t){n&&t.__k&&t.__k.__m&&(n.__m=t.__k.__m),p&&p(n,t)},e.__r=function(n){v&&v(n),u=0;var t=(i=n.__c).__H;t&&(r===i?(t.__h=[],i.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.forEach(A),t.__h.forEach(F),t.__h=[],u=0)),r=i},e.diffed=function(n){l&&l(n);var t=n.__c;t&&t.__H&&(t.__H.__h.length&&(1!==c.push(t)&&o===e.requestAnimationFrame||((o=e.requestAnimationFrame)||x)(b)),t.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),r=i=null},e.__c=function(n,t){t.some(function(n){try{n.__h.forEach(A),n.__h=n.__h.filter(function(n){return!n.__||F(n)})}catch(u){t.some(function(n){n.__h&&(n.__h=[])}),t=[],e.__e(u,n.__v)}}),d&&d(n,t)},e.unmount=function(n){s&&s(n);var t,u=n.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{A(n)}catch(n){t=n}}),u.__H=void 0,t&&e.__e(t,u.__v))};var q="function"==typeof requestAnimationFrame;function x(n){var t,u=function(){clearTimeout(i),q&&cancelAnimationFrame(t),setTimeout(n)},i=setTimeout(u,35);q&&(t=requestAnimationFrame(u))}function A(n){var t=i,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),i=t}function F(n){var t=i;n.__c=n.__(),i=t}function g(n,t){return!n||n.length!==t.length||t.some(function(t,u){return t!==n[u]})}function j(n,t){return"function"==typeof t?t(n):t}n.useCallback=function(n,t){return f=8,_(function(){return n},t)},n.useContext=function(n){var t=i.context[n.__c],r=y(u++,9);return r.c=n,t?(null==r.__&&(r.__=!0,t.sub(i)),t.props.value):n.__},n.useDebugValue=function(n,t){e.useDebugValue&&e.useDebugValue(t?t(n):n)},n.useEffect=function(n,t){var r=y(u++,3);!e.__s&&g(r.__H,t)&&(r.__=n,r.u=t,i.__H.__h.push(r))},n.useErrorBoundary=function(n){var t=y(u++,10),r=h();return t.__=n,i.componentDidCatch||(i.componentDidCatch=function(n,u){t.__&&t.__(n,u),r[1](n)}),[r[0],function(){r[1](void 0)}]},n.useId=function(){var n=y(u++,11);if(!n.__){for(var t=i.__v;null!==t&&!t.__m&&null!==t.__;)t=t.__;var r=t.__m||(t.__m=[0,0]);n.__="P"+r[0]+"-"+r[1]++}return n.__},n.useImperativeHandle=function(n,t,u){f=6,T(function(){if("function"==typeof n){var u=n(t());return function(){n(null),u&&"function"==typeof u&&u()}}if(n)return n.current=t(),function(){return n.current=null}},null==u?u:u.concat(n))},n.useLayoutEffect=T,n.useMemo=_,n.useReducer=m,n.useRef=function(n){return f=5,_(function(){return{current:n}},[])},n.useState=h});
//# sourceMappingURL=hooks.umd.js.map

1
node_modules/preact/hooks/dist/hooks.umd.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

35
node_modules/preact/hooks/package.json generated vendored Normal file
View File

@@ -0,0 +1,35 @@
{
"name": "preact-hooks",
"amdName": "preactHooks",
"version": "0.1.0",
"private": true,
"description": "Hook addon for Preact",
"main": "dist/hooks.js",
"module": "dist/hooks.module.js",
"umd:main": "dist/hooks.umd.js",
"source": "src/index.js",
"license": "MIT",
"types": "src/index.d.ts",
"scripts": {
"build": "microbundle build --raw",
"dev": "microbundle watch --raw --format cjs",
"test": "npm-run-all build --parallel test:karma",
"test:karma": "karma start test/karma.conf.js --single-run",
"test:karma:watch": "karma start test/karma.conf.js --no-single-run"
},
"peerDependencies": {
"preact": "^10.0.0"
},
"mangle": {
"regex": "^_"
},
"exports": {
".": {
"types": "./src/index.d.ts",
"browser": "./dist/hooks.module.js",
"umd": "./dist/hooks.umd.js",
"import": "./dist/hooks.mjs",
"require": "./dist/hooks.js"
}
}
}

145
node_modules/preact/hooks/src/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,145 @@
// Intentionally not using a relative path to take advantage of
// the TS version resolution mechanism
import { ErrorInfo, PreactContext, Ref, RefObject } from 'preact';
type Inputs = ReadonlyArray<unknown>;
export type Dispatch<A> = (value: A) => void;
export type StateUpdater<S> = S | ((prevState: S) => S);
/**
* Returns a stateful value, and a function to update it.
* @param initialState The initial value (or a function that returns the initial value)
*/
export function useState<S>(
initialState: S | (() => S)
): [S, Dispatch<StateUpdater<S>>];
export function useState<S = undefined>(): [
S | undefined,
Dispatch<StateUpdater<S | undefined>>
];
export type Reducer<S, A> = (prevState: S, action: A) => S;
/**
* An alternative to `useState`.
*
* `useReducer` is usually preferable to `useState` when you have complex state logic that involves
* multiple sub-values. It also lets you optimize performance for components that trigger deep
* updates because you can pass `dispatch` down instead of callbacks.
* @param reducer Given the current state and an action, returns the new state
* @param initialState The initial value to store as state
*/
export function useReducer<S, A>(
reducer: Reducer<S, A>,
initialState: S
): [S, Dispatch<A>];
/**
* An alternative to `useState`.
*
* `useReducer` is usually preferable to `useState` when you have complex state logic that involves
* multiple sub-values. It also lets you optimize performance for components that trigger deep
* updates because you can pass `dispatch` down instead of callbacks.
* @param reducer Given the current state and an action, returns the new state
* @param initialArg The initial argument to pass to the `init` function
* @param init A function that, given the `initialArg`, returns the initial value to store as state
*/
export function useReducer<S, A, I>(
reducer: Reducer<S, A>,
initialArg: I,
init: (arg: I) => S
): [S, Dispatch<A>];
/** @deprecated Use the `Ref` type instead. */
type PropRef<T> = MutableRef<T>;
interface MutableRef<T> {
current: T;
}
/**
* `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument
* (`initialValue`). The returned object will persist for the full lifetime of the component.
*
* Note that `useRef()` is useful for more than the `ref` attribute. Its handy for keeping any mutable
* value around similar to how youd use instance fields in classes.
*
* @param initialValue the initial value to store in the ref object
*/
export function useRef<T>(initialValue: T): MutableRef<T>;
export function useRef<T>(initialValue: T | null): RefObject<T>;
export function useRef<T = undefined>(): MutableRef<T | undefined>;
type EffectCallback = () => void | (() => void);
/**
* Accepts a function that contains imperative, possibly effectful code.
* The effects run after browser paint, without blocking it.
*
* @param effect Imperative function that can return a cleanup function
* @param inputs If present, effect will only activate if the values in the list change (using ===).
*/
export function useEffect(effect: EffectCallback, inputs?: Inputs): void;
type CreateHandle = () => object;
/**
* @param ref The ref that will be mutated
* @param create The function that will be executed to get the value that will be attached to
* ref.current
* @param inputs If present, effect will only activate if the values in the list change (using ===).
*/
export function useImperativeHandle<T, R extends T>(
ref: Ref<T>,
create: () => R,
inputs?: Inputs
): void;
/**
* Accepts a function that contains imperative, possibly effectful code.
* Use this to read layout from the DOM and synchronously re-render.
* Updates scheduled inside `useLayoutEffect` will be flushed synchronously, after all DOM mutations but before the browser has a chance to paint.
* Prefer the standard `useEffect` hook when possible to avoid blocking visual updates.
*
* @param effect Imperative function that can return a cleanup function
* @param inputs If present, effect will only activate if the values in the list change (using ===).
*/
export function useLayoutEffect(effect: EffectCallback, inputs?: Inputs): void;
/**
* Returns a memoized version of the callback that only changes if one of the `inputs`
* has changed (using ===).
*/
export function useCallback<T extends Function>(callback: T, inputs: Inputs): T;
/**
* Pass a factory function and an array of inputs.
* useMemo will only recompute the memoized value when one of the inputs has changed.
* This optimization helps to avoid expensive calculations on every render.
* If no array is provided, a new value will be computed whenever a new function instance is passed as the first argument.
*/
// for `inputs`, allow undefined, but don't make it optional as that is very likely a mistake
export function useMemo<T>(factory: () => T, inputs: Inputs | undefined): T;
/**
* Returns the current context value, as given by the nearest context provider for the given context.
* When the provider updates, this Hook will trigger a rerender with the latest context value.
*
* @param context The context you want to use
*/
export function useContext<T>(context: PreactContext<T>): T;
/**
* Customize the displayed value in the devtools panel.
*
* @param value Custom hook name or object that is passed to formatter
* @param formatter Formatter to modify value before sending it to the devtools
*/
export function useDebugValue<T>(value: T, formatter?: (value: T) => any): void;
export function useErrorBoundary(
callback?: (error: any, errorInfo: ErrorInfo) => Promise<void> | void
): [any, () => void];
export function useId(): string;

555
node_modules/preact/hooks/src/index.js generated vendored Normal file
View File

@@ -0,0 +1,555 @@
import { options as _options } from 'preact';
/** @type {number} */
let currentIndex;
/** @type {import('./internal').Component} */
let currentComponent;
/** @type {import('./internal').Component} */
let previousComponent;
/** @type {number} */
let currentHook = 0;
/** @type {Array<import('./internal').Component>} */
let afterPaintEffects = [];
// Cast to use internal Options type
const options = /** @type {import('./internal').Options} */ (_options);
let oldBeforeDiff = options._diff;
let oldBeforeRender = options._render;
let oldAfterDiff = options.diffed;
let oldCommit = options._commit;
let oldBeforeUnmount = options.unmount;
let oldRoot = options._root;
// We take the minimum timeout for requestAnimationFrame to ensure that
// the callback is invoked after the next frame. 35ms is based on a 30hz
// refresh rate, which is the minimum rate for a smooth user experience.
const RAF_TIMEOUT = 35;
let prevRaf;
/** @type {(vnode: import('./internal').VNode) => void} */
options._diff = vnode => {
currentComponent = null;
if (oldBeforeDiff) oldBeforeDiff(vnode);
};
options._root = (vnode, parentDom) => {
if (vnode && parentDom._children && parentDom._children._mask) {
vnode._mask = parentDom._children._mask;
}
if (oldRoot) oldRoot(vnode, parentDom);
};
/** @type {(vnode: import('./internal').VNode) => void} */
options._render = vnode => {
if (oldBeforeRender) oldBeforeRender(vnode);
currentComponent = vnode._component;
currentIndex = 0;
const hooks = currentComponent.__hooks;
if (hooks) {
if (previousComponent === currentComponent) {
hooks._pendingEffects = [];
currentComponent._renderCallbacks = [];
hooks._list.forEach(hookItem => {
if (hookItem._nextValue) {
hookItem._value = hookItem._nextValue;
}
hookItem._pendingArgs = hookItem._nextValue = undefined;
});
} else {
hooks._pendingEffects.forEach(invokeCleanup);
hooks._pendingEffects.forEach(invokeEffect);
hooks._pendingEffects = [];
currentIndex = 0;
}
}
previousComponent = currentComponent;
};
/** @type {(vnode: import('./internal').VNode) => void} */
options.diffed = vnode => {
if (oldAfterDiff) oldAfterDiff(vnode);
const c = vnode._component;
if (c && c.__hooks) {
if (c.__hooks._pendingEffects.length) afterPaint(afterPaintEffects.push(c));
c.__hooks._list.forEach(hookItem => {
if (hookItem._pendingArgs) {
hookItem._args = hookItem._pendingArgs;
}
hookItem._pendingArgs = undefined;
});
}
previousComponent = currentComponent = null;
};
// TODO: Improve typing of commitQueue parameter
/** @type {(vnode: import('./internal').VNode, commitQueue: any) => void} */
options._commit = (vnode, commitQueue) => {
commitQueue.some(component => {
try {
component._renderCallbacks.forEach(invokeCleanup);
component._renderCallbacks = component._renderCallbacks.filter(cb =>
cb._value ? invokeEffect(cb) : true
);
} catch (e) {
commitQueue.some(c => {
if (c._renderCallbacks) c._renderCallbacks = [];
});
commitQueue = [];
options._catchError(e, component._vnode);
}
});
if (oldCommit) oldCommit(vnode, commitQueue);
};
/** @type {(vnode: import('./internal').VNode) => void} */
options.unmount = vnode => {
if (oldBeforeUnmount) oldBeforeUnmount(vnode);
const c = vnode._component;
if (c && c.__hooks) {
let hasErrored;
c.__hooks._list.forEach(s => {
try {
invokeCleanup(s);
} catch (e) {
hasErrored = e;
}
});
c.__hooks = undefined;
if (hasErrored) options._catchError(hasErrored, c._vnode);
}
};
/**
* Get a hook's state from the currentComponent
* @param {number} index The index of the hook to get
* @param {number} type The index of the hook to get
* @returns {any}
*/
function getHookState(index, type) {
if (options._hook) {
options._hook(currentComponent, index, currentHook || type);
}
currentHook = 0;
// Largely inspired by:
// * https://github.com/michael-klein/funcy.js/blob/f6be73468e6ec46b0ff5aa3cc4c9baf72a29025a/src/hooks/core_hooks.mjs
// * https://github.com/michael-klein/funcy.js/blob/650beaa58c43c33a74820a3c98b3c7079cf2e333/src/renderer.mjs
// Other implementations to look at:
// * https://codesandbox.io/s/mnox05qp8
const hooks =
currentComponent.__hooks ||
(currentComponent.__hooks = {
_list: [],
_pendingEffects: []
});
if (index >= hooks._list.length) {
hooks._list.push({});
}
return hooks._list[index];
}
/**
* @template {unknown} S
* @param {import('./index').Dispatch<import('./index').StateUpdater<S>>} [initialState]
* @returns {[S, (state: S) => void]}
*/
export function useState(initialState) {
currentHook = 1;
return useReducer(invokeOrReturn, initialState);
}
/**
* @template {unknown} S
* @template {unknown} A
* @param {import('./index').Reducer<S, A>} reducer
* @param {import('./index').Dispatch<import('./index').StateUpdater<S>>} initialState
* @param {(initialState: any) => void} [init]
* @returns {[ S, (state: S) => void ]}
*/
export function useReducer(reducer, initialState, init) {
/** @type {import('./internal').ReducerHookState} */
const hookState = getHookState(currentIndex++, 2);
hookState._reducer = reducer;
if (!hookState._component) {
hookState._value = [
!init ? invokeOrReturn(undefined, initialState) : init(initialState),
action => {
const currentValue = hookState._nextValue
? hookState._nextValue[0]
: hookState._value[0];
const nextValue = hookState._reducer(currentValue, action);
if (currentValue !== nextValue) {
hookState._nextValue = [nextValue, hookState._value[1]];
hookState._component.setState({});
}
}
];
hookState._component = currentComponent;
if (!currentComponent._hasScuFromHooks) {
currentComponent._hasScuFromHooks = true;
let prevScu = currentComponent.shouldComponentUpdate;
const prevCWU = currentComponent.componentWillUpdate;
// If we're dealing with a forced update `shouldComponentUpdate` will
// not be called. But we use that to update the hook values, so we
// need to call it.
currentComponent.componentWillUpdate = function (p, s, c) {
if (this._force) {
let tmp = prevScu;
// Clear to avoid other sCU hooks from being called
prevScu = undefined;
updateHookState(p, s, c);
prevScu = tmp;
}
if (prevCWU) prevCWU.call(this, p, s, c);
};
// This SCU has the purpose of bailing out after repeated updates
// to stateful hooks.
// we store the next value in _nextValue[0] and keep doing that for all
// state setters, if we have next states and
// all next states within a component end up being equal to their original state
// we are safe to bail out for this specific component.
/**
*
* @type {import('./internal').Component["shouldComponentUpdate"]}
*/
// @ts-ignore - We don't use TS to downtranspile
// eslint-disable-next-line no-inner-declarations
function updateHookState(p, s, c) {
if (!hookState._component.__hooks) return true;
/** @type {(x: import('./internal').HookState) => x is import('./internal').ReducerHookState} */
const isStateHook = x => !!x._component;
const stateHooks =
hookState._component.__hooks._list.filter(isStateHook);
const allHooksEmpty = stateHooks.every(x => !x._nextValue);
// When we have no updated hooks in the component we invoke the previous SCU or
// traverse the VDOM tree further.
if (allHooksEmpty) {
return prevScu ? prevScu.call(this, p, s, c) : true;
}
// We check whether we have components with a nextValue set that
// have values that aren't equal to one another this pushes
// us to update further down the tree
let shouldUpdate = hookState._component.props !== p;
stateHooks.forEach(hookItem => {
if (hookItem._nextValue) {
const currentValue = hookItem._value[0];
hookItem._value = hookItem._nextValue;
hookItem._nextValue = undefined;
if (currentValue !== hookItem._value[0]) shouldUpdate = true;
}
});
return prevScu
? prevScu.call(this, p, s, c) || shouldUpdate
: shouldUpdate;
}
currentComponent.shouldComponentUpdate = updateHookState;
}
}
return hookState._nextValue || hookState._value;
}
/**
* @param {import('./internal').Effect} callback
* @param {unknown[]} args
* @returns {void}
*/
export function useEffect(callback, args) {
/** @type {import('./internal').EffectHookState} */
const state = getHookState(currentIndex++, 3);
if (!options._skipEffects && argsChanged(state._args, args)) {
state._value = callback;
state._pendingArgs = args;
currentComponent.__hooks._pendingEffects.push(state);
}
}
/**
* @param {import('./internal').Effect} callback
* @param {unknown[]} args
* @returns {void}
*/
export function useLayoutEffect(callback, args) {
/** @type {import('./internal').EffectHookState} */
const state = getHookState(currentIndex++, 4);
if (!options._skipEffects && argsChanged(state._args, args)) {
state._value = callback;
state._pendingArgs = args;
currentComponent._renderCallbacks.push(state);
}
}
/** @type {(initialValue: unknown) => unknown} */
export function useRef(initialValue) {
currentHook = 5;
return useMemo(() => ({ current: initialValue }), []);
}
/**
* @param {object} ref
* @param {() => object} createHandle
* @param {unknown[]} args
* @returns {void}
*/
export function useImperativeHandle(ref, createHandle, args) {
currentHook = 6;
useLayoutEffect(
() => {
if (typeof ref == 'function') {
const result = ref(createHandle());
return () => {
ref(null);
if (result && typeof result == 'function') result();
};
} else if (ref) {
ref.current = createHandle();
return () => (ref.current = null);
}
},
args == null ? args : args.concat(ref)
);
}
/**
* @template {unknown} T
* @param {() => T} factory
* @param {unknown[]} args
* @returns {T}
*/
export function useMemo(factory, args) {
/** @type {import('./internal').MemoHookState<T>} */
const state = getHookState(currentIndex++, 7);
if (argsChanged(state._args, args)) {
state._value = factory();
state._args = args;
state._factory = factory;
}
return state._value;
}
/**
* @param {() => void} callback
* @param {unknown[]} args
* @returns {() => void}
*/
export function useCallback(callback, args) {
currentHook = 8;
return useMemo(() => callback, args);
}
/**
* @param {import('./internal').PreactContext} context
*/
export function useContext(context) {
const provider = currentComponent.context[context._id];
// We could skip this call here, but than we'd not call
// `options._hook`. We need to do that in order to make
// the devtools aware of this hook.
/** @type {import('./internal').ContextHookState} */
const state = getHookState(currentIndex++, 9);
// The devtools needs access to the context object to
// be able to pull of the default value when no provider
// is present in the tree.
state._context = context;
if (!provider) return context._defaultValue;
// This is probably not safe to convert to "!"
if (state._value == null) {
state._value = true;
provider.sub(currentComponent);
}
return provider.props.value;
}
/**
* Display a custom label for a custom hook for the devtools panel
* @type {<T>(value: T, cb?: (value: T) => string | number) => void}
*/
export function useDebugValue(value, formatter) {
if (options.useDebugValue) {
options.useDebugValue(
formatter ? formatter(value) : /** @type {any}*/ (value)
);
}
}
/**
* @param {(error: unknown, errorInfo: import('preact').ErrorInfo) => void} cb
* @returns {[unknown, () => void]}
*/
export function useErrorBoundary(cb) {
/** @type {import('./internal').ErrorBoundaryHookState} */
const state = getHookState(currentIndex++, 10);
const errState = useState();
state._value = cb;
if (!currentComponent.componentDidCatch) {
currentComponent.componentDidCatch = (err, errorInfo) => {
if (state._value) state._value(err, errorInfo);
errState[1](err);
};
}
return [
errState[0],
() => {
errState[1](undefined);
}
];
}
/** @type {() => string} */
export function useId() {
/** @type {import('./internal').IdHookState} */
const state = getHookState(currentIndex++, 11);
if (!state._value) {
// Grab either the root node or the nearest async boundary node.
/** @type {import('./internal').VNode} */
let root = currentComponent._vnode;
while (root !== null && !root._mask && root._parent !== null) {
root = root._parent;
}
let mask = root._mask || (root._mask = [0, 0]);
state._value = 'P' + mask[0] + '-' + mask[1]++;
}
return state._value;
}
/**
* After paint effects consumer.
*/
function flushAfterPaintEffects() {
let component;
while ((component = afterPaintEffects.shift())) {
if (!component._parentDom || !component.__hooks) continue;
try {
component.__hooks._pendingEffects.forEach(invokeCleanup);
component.__hooks._pendingEffects.forEach(invokeEffect);
component.__hooks._pendingEffects = [];
} catch (e) {
component.__hooks._pendingEffects = [];
options._catchError(e, component._vnode);
}
}
}
let HAS_RAF = typeof requestAnimationFrame == 'function';
/**
* Schedule a callback to be invoked after the browser has a chance to paint a new frame.
* Do this by combining requestAnimationFrame (rAF) + setTimeout to invoke a callback after
* the next browser frame.
*
* Also, schedule a timeout in parallel to the the rAF to ensure the callback is invoked
* even if RAF doesn't fire (for example if the browser tab is not visible)
*
* @param {() => void} callback
*/
function afterNextFrame(callback) {
const done = () => {
clearTimeout(timeout);
if (HAS_RAF) cancelAnimationFrame(raf);
setTimeout(callback);
};
const timeout = setTimeout(done, RAF_TIMEOUT);
let raf;
if (HAS_RAF) {
raf = requestAnimationFrame(done);
}
}
// Note: if someone used options.debounceRendering = requestAnimationFrame,
// then effects will ALWAYS run on the NEXT frame instead of the current one, incurring a ~16ms delay.
// Perhaps this is not such a big deal.
/**
* Schedule afterPaintEffects flush after the browser paints
* @param {number} newQueueLength
* @returns {void}
*/
function afterPaint(newQueueLength) {
if (newQueueLength === 1 || prevRaf !== options.requestAnimationFrame) {
prevRaf = options.requestAnimationFrame;
(prevRaf || afterNextFrame)(flushAfterPaintEffects);
}
}
/**
* @param {import('./internal').HookState} hook
* @returns {void}
*/
function invokeCleanup(hook) {
// A hook cleanup can introduce a call to render which creates a new root, this will call options.vnode
// and move the currentComponent away.
const comp = currentComponent;
let cleanup = hook._cleanup;
if (typeof cleanup == 'function') {
hook._cleanup = undefined;
cleanup();
}
currentComponent = comp;
}
/**
* Invoke a Hook's effect
* @param {import('./internal').EffectHookState} hook
* @returns {void}
*/
function invokeEffect(hook) {
// A hook call can introduce a call to render which creates a new root, this will call options.vnode
// and move the currentComponent away.
const comp = currentComponent;
hook._cleanup = hook._value();
currentComponent = comp;
}
/**
* @param {unknown[]} oldArgs
* @param {unknown[]} newArgs
* @returns {boolean}
*/
function argsChanged(oldArgs, newArgs) {
return (
!oldArgs ||
oldArgs.length !== newArgs.length ||
newArgs.some((arg, index) => arg !== oldArgs[index])
);
}
/**
* @template Arg
* @param {Arg} arg
* @param {(arg: Arg) => any} f
* @returns {any}
*/
function invokeOrReturn(arg, f) {
return typeof f == 'function' ? f(arg) : f;
}

103
node_modules/preact/hooks/src/internal.d.ts generated vendored Normal file
View File

@@ -0,0 +1,103 @@
import {
Options as PreactOptions,
Component as PreactComponent,
VNode as PreactVNode,
PreactContext,
HookType,
ErrorInfo,
} from '../../src/internal';
import { Reducer, StateUpdater } from '.';
export { PreactContext };
export interface Options extends PreactOptions {
/** Attach a hook that is invoked before a vnode is diffed. */
_diff?(vnode: VNode): void;
diffed?(vnode: VNode): void;
/** Attach a hook that is invoked before a vnode has rendered. */
_render?(vnode: VNode): void;
/** Attach a hook that is invoked after a tree was mounted or was updated. */
_commit?(vnode: VNode, commitQueue: Component[]): void;
_unmount?(vnode: VNode): void;
/** Attach a hook that is invoked before a hook's state is queried. */
_hook?(component: Component, index: number, type: HookType): void;
}
// Hook tracking
export interface ComponentHooks {
/** The list of hooks a component uses */
_list: HookState[];
/** List of Effects to be invoked after the next frame is rendered */
_pendingEffects: EffectHookState[];
}
export interface Component extends Omit<PreactComponent<any, any>, '_renderCallbacks'> {
__hooks?: ComponentHooks;
// Extend to include HookStates
_renderCallbacks?: Array<HookState | (() => void)>;
_hasScuFromHooks?: boolean;
}
export interface VNode extends Omit<PreactVNode, '_component'> {
_mask?: [number, number];
_component?: Component; // Override with our specific Component type
}
export type HookState =
| EffectHookState
| MemoHookState
| ReducerHookState
| ContextHookState
| ErrorBoundaryHookState
| IdHookState;
interface BaseHookState {
_value?: unknown;
_nextValue?: unknown;
_pendingValue?: unknown;
_args?: unknown;
_pendingArgs?: unknown;
_component?: unknown;
_cleanup?: unknown;
}
export type Effect = () => void | Cleanup;
export type Cleanup = () => void;
export interface EffectHookState extends BaseHookState {
_value?: Effect;
_args?: unknown[];
_pendingArgs?: unknown[];
_cleanup?: Cleanup | void;
}
export interface MemoHookState<T = unknown> extends BaseHookState {
_value?: T;
_pendingValue?: T;
_args?: unknown[];
_pendingArgs?: unknown[];
_factory?: () => T;
}
export interface ReducerHookState<S = unknown, A = unknown>
extends BaseHookState {
_nextValue?: [S, StateUpdater<S>];
_value?: [S, StateUpdater<S>];
_component?: Component;
_reducer?: Reducer<S, A>;
}
export interface ContextHookState extends BaseHookState {
/** Whether this hooks as subscribed to updates yet */
_value?: boolean;
_context?: PreactContext;
}
export interface ErrorBoundaryHookState extends BaseHookState {
_value?: (error: unknown, errorInfo: ErrorInfo) => void;
}
export interface IdHookState extends BaseHookState {
_value?: string;
}

2
node_modules/preact/jsx-runtime/dist/jsxRuntime.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
var r=require("preact"),e=/["&<]/;function t(r){if(0===r.length||!1===e.test(r))return r;for(var t=0,n=0,o="",f="";n<r.length;n++){switch(r.charCodeAt(n)){case 34:f="&quot;";break;case 38:f="&amp;";break;case 60:f="&lt;";break;default:continue}n!==t&&(o+=r.slice(t,n)),o+=f,t=n+1}return n!==t&&(o+=r.slice(t,n)),o}var n=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,o=0,f=Array.isArray;function u(e,t,n,f,u,i){t||(t={});var c,a,p=t;if("ref"in p)for(a in p={},t)"ref"==a?c=t[a]:p[a]=t[a];var l={type:e,props:p,key:n,ref:c,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--o,__i:-1,__u:0,__source:u,__self:i};if("function"==typeof e&&(c=e.defaultProps))for(a in c)void 0===p[a]&&(p[a]=c[a]);return r.options.vnode&&r.options.vnode(l),l}var i={},c=/[A-Z]/g;Object.defineProperty(exports,"Fragment",{enumerable:!0,get:function(){return r.Fragment}}),exports.jsx=u,exports.jsxAttr=function(e,o){if(r.options.attr){var f=r.options.attr(e,o);if("string"==typeof f)return f}if(o=function(r){return null!==r&&"object"==typeof r&&"function"==typeof r.valueOf?r.valueOf():r}(o),"ref"===e||"key"===e)return"";if("style"===e&&"object"==typeof o){var u="";for(var a in o){var p=o[a];if(null!=p&&""!==p){var l="-"==a[0]?a:i[a]||(i[a]=a.replace(c,"-$&").toLowerCase()),s=";";"number"!=typeof p||l.startsWith("--")||n.test(l)||(s="px;"),u=u+l+":"+p+s}}return e+'="'+t(u)+'"'}return null==o||!1===o||"function"==typeof o||"object"==typeof o?"":!0===o?e:e+'="'+t(""+o)+'"'},exports.jsxDEV=u,exports.jsxEscape=function r(e){if(null==e||"boolean"==typeof e||"function"==typeof e)return null;if("object"==typeof e){if(void 0===e.constructor)return e;if(f(e)){for(var n=0;n<e.length;n++)e[n]=r(e[n]);return e}}return t(""+e)},exports.jsxTemplate=function(e){var t=u(r.Fragment,{tpl:e,exprs:[].slice.call(arguments,1)});return t.key=t.__v,t},exports.jsxs=u;
//# sourceMappingURL=jsxRuntime.js.map

File diff suppressed because one or more lines are too long

2
node_modules/preact/jsx-runtime/dist/jsxRuntime.mjs generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import{options as r,Fragment as e}from"preact";export{Fragment}from"preact";var t=/["&<]/;function n(r){if(0===r.length||!1===t.test(r))return r;for(var e=0,n=0,o="",f="";n<r.length;n++){switch(r.charCodeAt(n)){case 34:f="&quot;";break;case 38:f="&amp;";break;case 60:f="&lt;";break;default:continue}n!==e&&(o+=r.slice(e,n)),o+=f,e=n+1}return n!==e&&(o+=r.slice(e,n)),o}var o=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,f=0,i=Array.isArray;function u(e,t,n,o,i,u){t||(t={});var a,c,p=t;if("ref"in p)for(c in p={},t)"ref"==c?a=t[c]:p[c]=t[c];var l={type:e,props:p,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--f,__i:-1,__u:0,__source:i,__self:u};if("function"==typeof e&&(a=e.defaultProps))for(c in a)void 0===p[c]&&(p[c]=a[c]);return r.vnode&&r.vnode(l),l}function a(r){var t=u(e,{tpl:r,exprs:[].slice.call(arguments,1)});return t.key=t.__v,t}var c={},p=/[A-Z]/g;function l(e,t){if(r.attr){var f=r.attr(e,t);if("string"==typeof f)return f}if(t=function(r){return null!==r&&"object"==typeof r&&"function"==typeof r.valueOf?r.valueOf():r}(t),"ref"===e||"key"===e)return"";if("style"===e&&"object"==typeof t){var i="";for(var u in t){var a=t[u];if(null!=a&&""!==a){var l="-"==u[0]?u:c[u]||(c[u]=u.replace(p,"-$&").toLowerCase()),s=";";"number"!=typeof a||l.startsWith("--")||o.test(l)||(s="px;"),i=i+l+":"+a+s}}return e+'="'+n(i)+'"'}return null==t||!1===t||"function"==typeof t||"object"==typeof t?"":!0===t?e:e+'="'+n(""+t)+'"'}function s(r){if(null==r||"boolean"==typeof r||"function"==typeof r)return null;if("object"==typeof r){if(void 0===r.constructor)return r;if(i(r)){for(var e=0;e<r.length;e++)r[e]=s(r[e]);return r}}return n(""+r)}export{u as jsx,l as jsxAttr,u as jsxDEV,s as jsxEscape,a as jsxTemplate,u as jsxs};
//# sourceMappingURL=jsxRuntime.module.js.map

View File

@@ -0,0 +1,2 @@
import{options as r,Fragment as e}from"preact";export{Fragment}from"preact";var t=/["&<]/;function n(r){if(0===r.length||!1===t.test(r))return r;for(var e=0,n=0,o="",f="";n<r.length;n++){switch(r.charCodeAt(n)){case 34:f="&quot;";break;case 38:f="&amp;";break;case 60:f="&lt;";break;default:continue}n!==e&&(o+=r.slice(e,n)),o+=f,e=n+1}return n!==e&&(o+=r.slice(e,n)),o}var o=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,f=0,i=Array.isArray;function u(e,t,n,o,i,u){t||(t={});var a,c,p=t;if("ref"in p)for(c in p={},t)"ref"==c?a=t[c]:p[c]=t[c];var l={type:e,props:p,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--f,__i:-1,__u:0,__source:i,__self:u};if("function"==typeof e&&(a=e.defaultProps))for(c in a)void 0===p[c]&&(p[c]=a[c]);return r.vnode&&r.vnode(l),l}function a(r){var t=u(e,{tpl:r,exprs:[].slice.call(arguments,1)});return t.key=t.__v,t}var c={},p=/[A-Z]/g;function l(e,t){if(r.attr){var f=r.attr(e,t);if("string"==typeof f)return f}if(t=function(r){return null!==r&&"object"==typeof r&&"function"==typeof r.valueOf?r.valueOf():r}(t),"ref"===e||"key"===e)return"";if("style"===e&&"object"==typeof t){var i="";for(var u in t){var a=t[u];if(null!=a&&""!==a){var l="-"==u[0]?u:c[u]||(c[u]=u.replace(p,"-$&").toLowerCase()),s=";";"number"!=typeof a||l.startsWith("--")||o.test(l)||(s="px;"),i=i+l+":"+a+s}}return e+'="'+n(i)+'"'}return null==t||!1===t||"function"==typeof t||"object"==typeof t?"":!0===t?e:e+'="'+n(""+t)+'"'}function s(r){if(null==r||"boolean"==typeof r||"function"==typeof r)return null;if("object"==typeof r){if(void 0===r.constructor)return r;if(i(r)){for(var e=0;e<r.length;e++)r[e]=s(r[e]);return r}}return n(""+r)}export{u as jsx,l as jsxAttr,u as jsxDEV,s as jsxEscape,a as jsxTemplate,u as jsxs};
//# sourceMappingURL=jsxRuntime.module.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],r):r((e||self).jsxRuntime={},e.preact)}(this,function(e,r){var n=/["&<]/;function t(e){if(0===e.length||!1===n.test(e))return e;for(var r=0,t=0,o="",f="";t<e.length;t++){switch(e.charCodeAt(t)){case 34:f="&quot;";break;case 38:f="&amp;";break;case 60:f="&lt;";break;default:continue}t!==r&&(o+=e.slice(r,t)),o+=f,r=t+1}return t!==r&&(o+=e.slice(r,t)),o}var o=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,f=0,i=Array.isArray;function u(e,n,t,o,i,u){n||(n={});var c,a,l=n;if("ref"in l)for(a in l={},n)"ref"==a?c=n[a]:l[a]=n[a];var p={type:e,props:l,key:t,ref:c,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--f,__i:-1,__u:0,__source:i,__self:u};if("function"==typeof e&&(c=e.defaultProps))for(a in c)void 0===l[a]&&(l[a]=c[a]);return r.options.vnode&&r.options.vnode(p),p}var c={},a=/[A-Z]/g;Object.defineProperty(e,"Fragment",{enumerable:!0,get:function(){return r.Fragment}}),e.jsx=u,e.jsxAttr=function(e,n){if(r.options.attr){var f=r.options.attr(e,n);if("string"==typeof f)return f}if(n=function(e){return null!==e&&"object"==typeof e&&"function"==typeof e.valueOf?e.valueOf():e}(n),"ref"===e||"key"===e)return"";if("style"===e&&"object"==typeof n){var i="";for(var u in n){var l=n[u];if(null!=l&&""!==l){var p="-"==u[0]?u:c[u]||(c[u]=u.replace(a,"-$&").toLowerCase()),s=";";"number"!=typeof l||p.startsWith("--")||o.test(p)||(s="px;"),i=i+p+":"+l+s}}return e+'="'+t(i)+'"'}return null==n||!1===n||"function"==typeof n||"object"==typeof n?"":!0===n?e:e+'="'+t(""+n)+'"'},e.jsxDEV=u,e.jsxEscape=function e(r){if(null==r||"boolean"==typeof r||"function"==typeof r)return null;if("object"==typeof r){if(void 0===r.constructor)return r;if(i(r)){for(var n=0;n<r.length;n++)r[n]=e(r[n]);return r}}return t(""+r)},e.jsxTemplate=function(e){var n=u(r.Fragment,{tpl:e,exprs:[].slice.call(arguments,1)});return n.key=n.__v,n},e.jsxs=u});
//# sourceMappingURL=jsxRuntime.umd.js.map

File diff suppressed because one or more lines are too long

28
node_modules/preact/jsx-runtime/package.json generated vendored Normal file
View File

@@ -0,0 +1,28 @@
{
"name": "jsx-runtime",
"amdName": "jsxRuntime",
"version": "1.0.0",
"private": true,
"description": "Preact JSX runtime",
"main": "dist/jsxRuntime.js",
"module": "dist/jsxRuntime.module.js",
"umd:main": "dist/jsxRuntime.umd.js",
"source": "src/index.js",
"types": "src/index.d.ts",
"license": "MIT",
"peerDependencies": {
"preact": "^10.0.0"
},
"mangle": {
"regex": "^_"
},
"exports": {
".": {
"types": "./src/index.d.ts",
"browser": "./dist/jsxRuntime.module.js",
"umd": "./dist/jsxRuntime.umd.js",
"import": "./dist/jsxRuntime.mjs",
"require": "./dist/jsxRuntime.js"
}
}
}

62
node_modules/preact/jsx-runtime/src/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,62 @@
// Intentionally not using a relative path to take advantage of
// the TS version resolution mechanism
export { Fragment } from 'preact';
import {
ComponentType,
ComponentChild,
ComponentChildren,
VNode,
Attributes
} from 'preact';
import { JSXInternal } from '../../src/jsx';
export function jsx(
type: string,
props: JSXInternal.HTMLAttributes &
JSXInternal.SVGAttributes &
Record<string, any> & { children?: ComponentChild },
key?: string
): VNode<any>;
export function jsx<P>(
type: ComponentType<P>,
props: Attributes & P & { children?: ComponentChild },
key?: string
): VNode<any>;
export function jsxs(
type: string,
props: JSXInternal.HTMLAttributes &
JSXInternal.SVGAttributes &
Record<string, any> & { children?: ComponentChild[] },
key?: string
): VNode<any>;
export function jsxs<P>(
type: ComponentType<P>,
props: Attributes & P & { children?: ComponentChild[] },
key?: string
): VNode<any>;
export function jsxDEV(
type: string,
props: JSXInternal.HTMLAttributes &
JSXInternal.SVGAttributes &
Record<string, any> & { children?: ComponentChildren },
key?: string
): VNode<any>;
export function jsxDEV<P>(
type: ComponentType<P>,
props: Attributes & P & { children?: ComponentChildren },
key?: string
): VNode<any>;
// These are not expected to be used manually, but by a JSX transform
export function jsxTemplate(
template: string[],
...expressions: any[]
): VNode<any>;
export function jsxAttr(name: string, value: any): string | null;
export function jsxEscape<T>(
value: T
): string | null | VNode<any> | Array<string | null | VNode>;
export { JSXInternal as JSX };

206
node_modules/preact/jsx-runtime/src/index.js generated vendored Normal file
View File

@@ -0,0 +1,206 @@
import { options, Fragment } from 'preact';
import { encodeEntities } from './utils';
import { IS_NON_DIMENSIONAL } from '../../src/constants';
let vnodeId = 0;
const isArray = Array.isArray;
/**
* @fileoverview
* This file exports various methods that implement Babel's "automatic" JSX runtime API:
* - jsx(type, props, key)
* - jsxs(type, props, key)
* - jsxDEV(type, props, key, __source, __self)
*
* The implementation of createVNode here is optimized for performance.
* Benchmarks: https://esbench.com/bench/5f6b54a0b4632100a7dcd2b3
*/
/**
* JSX.Element factory used by Babel's {runtime:"automatic"} JSX transform
* @param {VNode['type']} type
* @param {VNode['props']} props
* @param {VNode['key']} [key]
* @param {unknown} [isStaticChildren]
* @param {unknown} [__source]
* @param {unknown} [__self]
*/
function createVNode(type, props, key, isStaticChildren, __source, __self) {
if (!props) props = {};
// We'll want to preserve `ref` in props to get rid of the need for
// forwardRef components in the future, but that should happen via
// a separate PR.
let normalizedProps = props,
ref,
i;
if ('ref' in normalizedProps) {
normalizedProps = {};
for (i in props) {
if (i == 'ref') {
ref = props[i];
} else {
normalizedProps[i] = props[i];
}
}
}
/** @type {VNode & { __source: any; __self: any }} */
const vnode = {
type,
props: normalizedProps,
key,
ref,
_children: null,
_parent: null,
_depth: 0,
_dom: null,
_component: null,
constructor: undefined,
_original: --vnodeId,
_index: -1,
_flags: 0,
__source,
__self
};
// If a Component VNode, check for and apply defaultProps.
// Note: `type` is often a String, and can be `undefined` in development.
if (typeof type === 'function' && (ref = type.defaultProps)) {
for (i in ref)
if (normalizedProps[i] === undefined) {
normalizedProps[i] = ref[i];
}
}
if (options.vnode) options.vnode(vnode);
return vnode;
}
/**
* Create a template vnode. This function is not expected to be
* used directly, but rather through a precompile JSX transform
* @param {string[]} templates
* @param {Array<string | null | VNode>} exprs
* @returns {VNode}
*/
function jsxTemplate(templates, ...exprs) {
const vnode = createVNode(Fragment, { tpl: templates, exprs });
// Bypass render to string top level Fragment optimization
vnode.key = vnode._vnode;
return vnode;
}
const JS_TO_CSS = {};
const CSS_REGEX = /[A-Z]/g;
/**
* Unwrap potential signals.
* @param {*} value
* @returns {*}
*/
function normalizeAttrValue(value) {
return value !== null &&
typeof value === 'object' &&
typeof value.valueOf === 'function'
? value.valueOf()
: value;
}
/**
* Serialize an HTML attribute to a string. This function is not
* expected to be used directly, but rather through a precompile
* JSX transform
* @param {string} name The attribute name
* @param {*} value The attribute value
* @returns {string}
*/
function jsxAttr(name, value) {
if (options.attr) {
const result = options.attr(name, value);
if (typeof result === 'string') return result;
}
value = normalizeAttrValue(value);
if (name === 'ref' || name === 'key') return '';
if (name === 'style' && typeof value === 'object') {
let str = '';
for (let prop in value) {
let val = value[prop];
if (val != null && val !== '') {
const name =
prop[0] == '-'
? prop
: JS_TO_CSS[prop] ||
(JS_TO_CSS[prop] = prop.replace(CSS_REGEX, '-$&').toLowerCase());
let suffix = ';';
if (
typeof val === 'number' &&
// Exclude custom-attributes
!name.startsWith('--') &&
!IS_NON_DIMENSIONAL.test(name)
) {
suffix = 'px;';
}
str = str + name + ':' + val + suffix;
}
}
return name + '="' + encodeEntities(str) + '"';
}
if (
value == null ||
value === false ||
typeof value === 'function' ||
typeof value === 'object'
) {
return '';
} else if (value === true) return name;
return name + '="' + encodeEntities('' + value) + '"';
}
/**
* Escape a dynamic child passed to `jsxTemplate`. This function
* is not expected to be used directly, but rather through a
* precompile JSX transform
* @param {*} value
* @returns {string | null | VNode | Array<string | null | VNode>}
*/
function jsxEscape(value) {
if (
value == null ||
typeof value === 'boolean' ||
typeof value === 'function'
) {
return null;
}
if (typeof value === 'object') {
// Check for VNode
if (value.constructor === undefined) return value;
if (isArray(value)) {
for (let i = 0; i < value.length; i++) {
value[i] = jsxEscape(value[i]);
}
return value;
}
}
return encodeEntities('' + value);
}
export {
createVNode as jsx,
createVNode as jsxs,
createVNode as jsxDEV,
Fragment,
// precompiled JSX transform
jsxTemplate,
jsxAttr,
jsxEscape
};

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