Last commit july 5th

This commit is contained in:
2024-07-05 13:46:23 +02:00
parent dad0d86e8c
commit b0e4dfbb76
24982 changed files with 2621219 additions and 413 deletions

21
spa/node_modules/preact-router/LICENSE generated vendored Normal file
View File

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

281
spa/node_modules/preact-router/README.md generated vendored Normal file
View File

@@ -0,0 +1,281 @@
# preact-router
[![NPM](https://img.shields.io/npm/v/preact-router.svg)](https://www.npmjs.com/package/preact-router)
[![Build status](https://github.com/preactjs/preact-router/actions/workflows/node.js.yml/badge.svg)](https://github.com/preactjs/preact-router/actions/workflows/node.js.yml)
Connect your [Preact](https://github.com/preactjs/preact) components up to that address bar.
`preact-router` provides a `<Router />` component that conditionally renders its children when the URL matches their `path`. It also automatically wires up `<a />` elements to the router.
> 💁 **Note:** This is not a preact-compatible version of React Router. `preact-router` is a simple URL wiring and does no orchestration for you.
>
> If you're looking for more complex solutions like nested routes and view composition, [react-router](https://github.com/ReactTraining/react-router) works great with preact as long as you alias in [preact/compat](https://preactjs.com/guide/v10/getting-started#aliasing-react-to-preact).
#### [See a Real-world Example :arrow_right:](https://jsfiddle.net/developit/qc73v9va/)
---
### Usage Example
```js
import Router from 'preact-router';
import { h, render } from 'preact';
/** @jsx h */
const Main = () => (
<Router>
<Home path="/" />
<About path="/about" />
// Advanced is an optional query
<Search path="/search/:query/:advanced?" />
</Router>
);
render(<Main />, document.body);
```
If there is an error rendering the destination route, a 404 will be displayed.
### Handling URLS
:information_desk_person: Pages are just regular components that get mounted when you navigate to a certain URL.
Any URL parameters get passed to the component as `props`.
Defining what component(s) to load for a given URL is easy and declarative.
Querystring and `:parameter` values are passed to the matched component as props.
Parameters can be made optional by adding a `?`, or turned into a wildcard match by adding `*` (zero or more characters) or `+` (one or more characters):
```js
<Router>
<A path="/" />
<B path="/b" id="42" />
<C path="/c/:id" />
<C path="/d/:optional?/:params?" />
<D path="/e/:remaining_path*" />
<E path="/f/:remaining_path+" />
<F default />
</Router>
```
### Lazy Loading
Lazy loading (code splitting) with `preact-router` can be implemented easily using the [AsyncRoute](https://www.npmjs.com/package/preact-async-route) module:
```js
import AsyncRoute from 'preact-async-route';
<Router>
<Home path="/" />
<AsyncRoute
path="/friends"
getComponent={() => import('./friends').then(module => module.default)}
/>
<AsyncRoute
path="/friends/:id"
getComponent={() => import('./friend').then(module => module.default)}
loading={() => <div>loading...</div>}
/>
</Router>;
```
### Active Matching & Links
`preact-router` includes an add-on module called `match` that lets you wire your components up to Router changes.
Here's a demo of `<Match>`, which invokes the function you pass it (as its only child) in response to any routing:
```js
import Router from 'preact-router';
import Match from 'preact-router/match';
render(
<div>
<Match path="/">{({ matches, path, url }) => <pre>{url}</pre>}</Match>
<Router>
<div default>demo fallback route</div>
</Router>
</div>
);
// another example: render only if at a given URL:
render(
<div>
<Match path="/">{({ matches }) => matches && <h1>You are Home!</h1>}</Match>
<Router />
</div>
);
```
`<Link>` is just a normal link, but it automatically adds and removes an "active" classname to itself based on whether it matches the current URL.
```js
import { Router } from 'preact-router';
import { Link } from 'preact-router/match';
render(
<div>
<nav>
<Link activeClassName="active" href="/">
Home
</Link>
<Link activeClassName="active" href="/foo">
Foo
</Link>
<Link activeClassName="active" href="/bar">
Bar
</Link>
</nav>
<Router>
<div default>this is a demo route that always matches</div>
</Router>
</div>
);
```
### Default Link Behavior
Sometimes it's necessary to bypass preact-router's link handling and let the browser perform routing on its own.
This can be accomplished by adding a `data-native` boolean attribute to any link:
```html
<a href="/foo" data-native>Foo</a>
```
### Detecting Route Changes
The `Router` notifies you when a change event occurs for a route with the `onChange` callback:
```js
import { render, Component } from 'preact';
import { Router, route } from 'preact-router';
class App extends Component {
// some method that returns a promise
isAuthenticated() {}
handleRoute = async e => {
switch (e.url) {
case '/profile':
const isAuthed = await this.isAuthenticated();
if (!isAuthed) route('/', true);
break;
}
};
render() {
return (
<Router onChange={this.handleRoute}>
<Home path="/" />
<Profile path="/profile" />
</Router>
);
}
}
```
### Redirects
Can easily be implemented with a custom `Redirect` component;
```js
import { Component } from 'preact';
import { route } from 'preact-router';
export default class Redirect extends Component {
componentWillMount() {
route(this.props.to, true);
}
render() {
return null;
}
}
```
Now to create a redirect within your application, you can add this `Redirect` component to your router;
```js
<Router>
<Bar path="/bar" />
<Redirect path="/foo" to="/bar" />
</Router>
```
### Custom History
It's possible to use alternative history bindings, like `/#!/hash-history`:
```js
import { h } from 'preact';
import Router from 'preact-router';
import { createHashHistory } from 'history';
const Main = () => (
<Router history={createHashHistory()}>
<Home path="/" />
<About path="/about" />
<Search path="/search/:query" />
</Router>
);
render(<Main />, document.body);
```
### Programmatically Triggering Route
It's possible to programmatically trigger a route to a page (like `window.location = '/page-2'`)
```js
import { route } from 'preact-router';
route('/page-2'); // appends a history entry
route('/page-3', true); // replaces the current history entry
```
### Nested Routers
The `<Router>` is a self-contained component that renders based on the page URL. When nested a Router inside of another Router, the inner Router does not share or observe the outer's URL or matches. Instead, inner routes must include the full path to be matched against the page's URL:
```js
import { h, render } from 'preact';
import Router from 'preact-router';
function Profile(props) {
// `props.rest` is the rest of the URL after "/profile/"
return (
<div>
<h1>Profile</h1>
<Router>
<MyProfile path="/profile/me" />
<UserProfile path="/profile/:user" />
</Router>
</div>
);
}
const MyProfile = () => <h2>My Profile</h2>;
const UserProfile = props => <h2>{props.user}</h2>;
function App() {
return (
<div>
<Router>
<Home path="/" />
<Profile path="/profile/:rest*" />
</Router>
<nav>
<a href="/">Home</a>
<a href="/profile/me">My Profile</a>
<a href="/profile/alice">Alice's Profile</a>
</nav>
</div>
);
}
render(<App />, document.body);
```
### License
[MIT](./LICENSE)

2
spa/node_modules/preact-router/dist/preact-router.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
var n=require("preact"),t=require("preact/hooks"),r={};function i(n,t){for(var r in t)n[r]=t[r];return n}function e(n,t,i){var e,o=/(?:\?([^#]*))?(#.*)?$/,u=n.match(o),c={};if(u&&u[1])for(var a=u[1].split("&"),h=0;h<a.length;h++){var s=a[h].split("=");c[decodeURIComponent(s[0])]=decodeURIComponent(s.slice(1).join("="))}n=f(n.replace(o,"")),t=f(t||"");for(var v=Math.max(n.length,t.length),d=0;d<v;d++)if(t[d]&&":"===t[d].charAt(0)){var l=t[d].replace(/(^:|[+*?]+$)/g,""),p=(t[d].match(/[+*?]+$/)||r)[0]||"",m=~p.indexOf("+"),y=~p.indexOf("*"),U=n[d]||"";if(!U&&!y&&(p.indexOf("?")<0||m)){e=!1;break}if(c[l]=decodeURIComponent(U),m||y){c[l]=n.slice(d).map(decodeURIComponent).join("/");break}}else if(t[d]!==n[d]){e=!1;break}return(!0===i.default||!1!==e)&&c}function o(n,t){return n.rank<t.rank?1:n.rank>t.rank?-1:n.index-t.index}function u(n,t){return n.index=t,n.rank=function(n){return n.props.default?0:f(n.props.path).map(c).join("")}(n),n.props}function f(n){return n.replace(/(^\/+|\/+$)/g,"").split("/")}function c(n){return":"==n.charAt(0)?1+"*+?".indexOf(n.charAt(n.length-1))||4:5}var a={},h=[],s=[],v=null,d={url:p()},l=n.createContext(d);function p(){var n;return""+((n=v&&v.location?v.location:v&&v.getCurrentLocation?v.getCurrentLocation():"undefined"!=typeof location?location:a).pathname||"")+(n.search||"")}function m(n,t){return void 0===t&&(t=!1),"string"!=typeof n&&n.url&&(t=n.replace,n=n.url),function(n){for(var t=h.length;t--;)if(h[t].canRoute(n))return!0;return!1}(n)&&function(n,t){void 0===t&&(t="push"),v&&v[t]?v[t](n):"undefined"!=typeof history&&history[t+"State"]&&history[t+"State"](null,null,n)}(n,t?"replace":"push"),y(n)}function y(n){for(var t=!1,r=0;r<h.length;r++)h[r].routeTo(n)&&(t=!0);return t}function U(n){if(n&&n.getAttribute){var t=n.getAttribute("href"),r=n.getAttribute("target");if(t&&t.match(/^\//g)&&(!r||r.match(/^_?self$/i)))return m(t)}}function g(n){return n.stopImmediatePropagation&&n.stopImmediatePropagation(),n.stopPropagation&&n.stopPropagation(),n.preventDefault(),!1}function k(n){if(!(n.ctrlKey||n.metaKey||n.altKey||n.shiftKey||n.button)){var t=n.target;do{if("a"===t.localName&&t.getAttribute("href")){if(t.hasAttribute("data-native")||t.hasAttribute("native"))return;if(U(t))return g(n)}}while(t=t.parentNode)}}var C=!1;function R(n){n.history&&(v=n.history),this.state={url:n.url||p()}}i(R.prototype=new n.Component,{shouldComponentUpdate:function(n){return!0!==n.static||n.url!==this.props.url||n.onChange!==this.props.onChange},canRoute:function(t){var r=n.toChildArray(this.props.children);return void 0!==this.g(r,t)},routeTo:function(n){this.setState({url:n});var t=this.canRoute(n);return this.p||this.forceUpdate(),t},componentWillMount:function(){this.p=!0},componentDidMount:function(){var n=this;C||(C=!0,v||addEventListener("popstate",function(){y(p())}),addEventListener("click",k)),h.push(this),v&&(this.u=v.listen(function(t){var r=t.location||t;n.routeTo(""+(r.pathname||"")+(r.search||""))})),this.p=!1},componentWillUnmount:function(){"function"==typeof this.u&&this.u(),h.splice(h.indexOf(this),1)},componentWillUpdate:function(){this.p=!0},componentDidUpdate:function(){this.p=!1},g:function(n,t){n=n.filter(u).sort(o);for(var r=0;r<n.length;r++){var i=n[r],f=e(t,i.props.path,i.props);if(f)return[i,f]}},render:function(t,r){var e,o,u=t.onChange,f=r.url,c=this.c,a=this.g(n.toChildArray(t.children),f);if(a&&(o=n.cloneElement(a[0],i(i({url:f,matches:e=a[1]},e),{key:void 0,ref:void 0}))),f!==(c&&c.url)){i(d,c=this.c={url:f,previous:c&&c.url,current:o,path:o?o.props.path:null,matches:e}),c.router=this,c.active=o?[o]:[];for(var h=s.length;h--;)s[h]({});"function"==typeof u&&u(c)}return n.h(l.Provider,{value:c},o)}}),R.getCurrentUrl=p,R.route=m,R.Router=R,R.Route=function(t){return n.h(t.component,t)},R.Link=function(t){return n.h("a",i({onClick:k},t))},R.exec=e,R.useRouter=function(){var n=t.useContext(l);if(n===d){var r=t.useState()[1];t.useEffect(function(){return s.push(r),function(){return s.splice(s.indexOf(r),1)}},[])}return[n,m]},module.exports=R;
//# sourceMappingURL=preact-router.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
import{createContext as n,Component as t,toChildArray as r,cloneElement as i,h as o}from"preact";import{useContext as e,useState as u,useEffect as f}from"preact/hooks";var a={};function c(n,t){for(var r in t)n[r]=t[r];return n}function s(n,t,r){var i,o=/(?:\?([^#]*))?(#.*)?$/,e=n.match(o),u={};if(e&&e[1])for(var f=e[1].split("&"),c=0;c<f.length;c++){var s=f[c].split("=");u[decodeURIComponent(s[0])]=decodeURIComponent(s.slice(1).join("="))}n=d(n.replace(o,"")),t=d(t||"");for(var h=Math.max(n.length,t.length),v=0;v<h;v++)if(t[v]&&":"===t[v].charAt(0)){var l=t[v].replace(/(^:|[+*?]+$)/g,""),p=(t[v].match(/[+*?]+$/)||a)[0]||"",m=~p.indexOf("+"),y=~p.indexOf("*"),U=n[v]||"";if(!U&&!y&&(p.indexOf("?")<0||m)){i=!1;break}if(u[l]=decodeURIComponent(U),m||y){u[l]=n.slice(v).map(decodeURIComponent).join("/");break}}else if(t[v]!==n[v]){i=!1;break}return(!0===r.default||!1!==i)&&u}function h(n,t){return n.rank<t.rank?1:n.rank>t.rank?-1:n.index-t.index}function v(n,t){return n.index=t,n.rank=function(n){return n.props.default?0:d(n.props.path).map(l).join("")}(n),n.props}function d(n){return n.replace(/(^\/+|\/+$)/g,"").split("/")}function l(n){return":"==n.charAt(0)?1+"*+?".indexOf(n.charAt(n.length-1))||4:5}var p={},m=[],y=[],U=null,g={url:R()},k=n(g);function C(){var n=e(k);if(n===g){var t=u()[1];f(function(){return y.push(t),function(){return y.splice(y.indexOf(t),1)}},[])}return[n,$]}function R(){var n;return""+((n=U&&U.location?U.location:U&&U.getCurrentLocation?U.getCurrentLocation():"undefined"!=typeof location?location:p).pathname||"")+(n.search||"")}function $(n,t){return void 0===t&&(t=!1),"string"!=typeof n&&n.url&&(t=n.replace,n=n.url),function(n){for(var t=m.length;t--;)if(m[t].canRoute(n))return!0;return!1}(n)&&function(n,t){void 0===t&&(t="push"),U&&U[t]?U[t](n):"undefined"!=typeof history&&history[t+"State"]&&history[t+"State"](null,null,n)}(n,t?"replace":"push"),I(n)}function I(n){for(var t=!1,r=0;r<m.length;r++)m[r].routeTo(n)&&(t=!0);return t}function M(n){if(n&&n.getAttribute){var t=n.getAttribute("href"),r=n.getAttribute("target");if(t&&t.match(/^\//g)&&(!r||r.match(/^_?self$/i)))return $(t)}}function b(n){return n.stopImmediatePropagation&&n.stopImmediatePropagation(),n.stopPropagation&&n.stopPropagation(),n.preventDefault(),!1}function W(n){if(!(n.ctrlKey||n.metaKey||n.altKey||n.shiftKey||n.button)){var t=n.target;do{if("a"===t.localName&&t.getAttribute("href")){if(t.hasAttribute("data-native")||t.hasAttribute("native"))return;if(M(t))return b(n)}}while(t=t.parentNode)}}var w=!1;function D(n){n.history&&(U=n.history),this.state={url:n.url||R()}}c(D.prototype=new t,{shouldComponentUpdate:function(n){return!0!==n.static||n.url!==this.props.url||n.onChange!==this.props.onChange},canRoute:function(n){var t=r(this.props.children);return void 0!==this.g(t,n)},routeTo:function(n){this.setState({url:n});var t=this.canRoute(n);return this.p||this.forceUpdate(),t},componentWillMount:function(){this.p=!0},componentDidMount:function(){var n=this;w||(w=!0,U||addEventListener("popstate",function(){I(R())}),addEventListener("click",W)),m.push(this),U&&(this.u=U.listen(function(t){var r=t.location||t;n.routeTo(""+(r.pathname||"")+(r.search||""))})),this.p=!1},componentWillUnmount:function(){"function"==typeof this.u&&this.u(),m.splice(m.indexOf(this),1)},componentWillUpdate:function(){this.p=!0},componentDidUpdate:function(){this.p=!1},g:function(n,t){n=n.filter(v).sort(h);for(var r=0;r<n.length;r++){var i=n[r],o=s(t,i.props.path,i.props);if(o)return[i,o]}},render:function(n,t){var e,u,f=n.onChange,a=t.url,s=this.c,h=this.g(r(n.children),a);if(h&&(u=i(h[0],c(c({url:a,matches:e=h[1]},e),{key:void 0,ref:void 0}))),a!==(s&&s.url)){c(g,s=this.c={url:a,previous:s&&s.url,current:u,path:u?u.props.path:null,matches:e}),s.router=this,s.active=u?[u]:[];for(var v=y.length;v--;)y[v]({});"function"==typeof f&&f(s)}return o(k.Provider,{value:s},u)}});var E=function(n){return o("a",c({onClick:W},n))},L=function(n){return o(n.component,n)};export{E as Link,L as Route,D as Router,D as default,s as exec,R as getCurrentUrl,$ as route,C as useRouter};
//# sourceMappingURL=preact-router.module.js.map

View File

@@ -0,0 +1,2 @@
import{createContext as n,Component as t,toChildArray as r,cloneElement as i,h as o}from"preact";import{useContext as e,useState as u,useEffect as f}from"preact/hooks";var a={};function c(n,t){for(var r in t)n[r]=t[r];return n}function s(n,t,r){var i,o=/(?:\?([^#]*))?(#.*)?$/,e=n.match(o),u={};if(e&&e[1])for(var f=e[1].split("&"),c=0;c<f.length;c++){var s=f[c].split("=");u[decodeURIComponent(s[0])]=decodeURIComponent(s.slice(1).join("="))}n=d(n.replace(o,"")),t=d(t||"");for(var h=Math.max(n.length,t.length),v=0;v<h;v++)if(t[v]&&":"===t[v].charAt(0)){var l=t[v].replace(/(^:|[+*?]+$)/g,""),p=(t[v].match(/[+*?]+$/)||a)[0]||"",m=~p.indexOf("+"),y=~p.indexOf("*"),U=n[v]||"";if(!U&&!y&&(p.indexOf("?")<0||m)){i=!1;break}if(u[l]=decodeURIComponent(U),m||y){u[l]=n.slice(v).map(decodeURIComponent).join("/");break}}else if(t[v]!==n[v]){i=!1;break}return(!0===r.default||!1!==i)&&u}function h(n,t){return n.rank<t.rank?1:n.rank>t.rank?-1:n.index-t.index}function v(n,t){return n.index=t,n.rank=function(n){return n.props.default?0:d(n.props.path).map(l).join("")}(n),n.props}function d(n){return n.replace(/(^\/+|\/+$)/g,"").split("/")}function l(n){return":"==n.charAt(0)?1+"*+?".indexOf(n.charAt(n.length-1))||4:5}var p={},m=[],y=[],U=null,g={url:R()},k=n(g);function C(){var n=e(k);if(n===g){var t=u()[1];f(function(){return y.push(t),function(){return y.splice(y.indexOf(t),1)}},[])}return[n,$]}function R(){var n;return""+((n=U&&U.location?U.location:U&&U.getCurrentLocation?U.getCurrentLocation():"undefined"!=typeof location?location:p).pathname||"")+(n.search||"")}function $(n,t){return void 0===t&&(t=!1),"string"!=typeof n&&n.url&&(t=n.replace,n=n.url),function(n){for(var t=m.length;t--;)if(m[t].canRoute(n))return!0;return!1}(n)&&function(n,t){void 0===t&&(t="push"),U&&U[t]?U[t](n):"undefined"!=typeof history&&history[t+"State"]&&history[t+"State"](null,null,n)}(n,t?"replace":"push"),I(n)}function I(n){for(var t=!1,r=0;r<m.length;r++)m[r].routeTo(n)&&(t=!0);return t}function M(n){if(n&&n.getAttribute){var t=n.getAttribute("href"),r=n.getAttribute("target");if(t&&t.match(/^\//g)&&(!r||r.match(/^_?self$/i)))return $(t)}}function b(n){return n.stopImmediatePropagation&&n.stopImmediatePropagation(),n.stopPropagation&&n.stopPropagation(),n.preventDefault(),!1}function W(n){if(!(n.ctrlKey||n.metaKey||n.altKey||n.shiftKey||n.button)){var t=n.target;do{if("a"===t.localName&&t.getAttribute("href")){if(t.hasAttribute("data-native")||t.hasAttribute("native"))return;if(M(t))return b(n)}}while(t=t.parentNode)}}var w=!1;function D(n){n.history&&(U=n.history),this.state={url:n.url||R()}}c(D.prototype=new t,{shouldComponentUpdate:function(n){return!0!==n.static||n.url!==this.props.url||n.onChange!==this.props.onChange},canRoute:function(n){var t=r(this.props.children);return void 0!==this.g(t,n)},routeTo:function(n){this.setState({url:n});var t=this.canRoute(n);return this.p||this.forceUpdate(),t},componentWillMount:function(){this.p=!0},componentDidMount:function(){var n=this;w||(w=!0,U||addEventListener("popstate",function(){I(R())}),addEventListener("click",W)),m.push(this),U&&(this.u=U.listen(function(t){var r=t.location||t;n.routeTo(""+(r.pathname||"")+(r.search||""))})),this.p=!1},componentWillUnmount:function(){"function"==typeof this.u&&this.u(),m.splice(m.indexOf(this),1)},componentWillUpdate:function(){this.p=!0},componentDidUpdate:function(){this.p=!1},g:function(n,t){n=n.filter(v).sort(h);for(var r=0;r<n.length;r++){var i=n[r],o=s(t,i.props.path,i.props);if(o)return[i,o]}},render:function(n,t){var e,u,f=n.onChange,a=t.url,s=this.c,h=this.g(r(n.children),a);if(h&&(u=i(h[0],c(c({url:a,matches:e=h[1]},e),{key:void 0,ref:void 0}))),a!==(s&&s.url)){c(g,s=this.c={url:a,previous:s&&s.url,current:u,path:u?u.props.path:null,matches:e}),s.router=this,s.active=u?[u]:[];for(var v=y.length;v--;)y[v]({});"function"==typeof f&&f(s)}return o(k.Provider,{value:s},u)}});var E=function(n){return o("a",c({onClick:W},n))},L=function(n){return o(n.component,n)};export{E as Link,L as Route,D as Router,D as default,s as exec,R as getCurrentUrl,$ as route,C as useRouter};
//# sourceMappingURL=preact-router.module.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("preact"),require("preact/hooks")):"function"==typeof define&&define.amd?define(["preact","preact/hooks"],t):(n||self).preactRouter=t(n.preact,n.hooks)}(this,function(n,t){var e={};function r(n,t){for(var e in t)n[e]=t[e];return n}function i(n,t,r){var i,o=/(?:\?([^#]*))?(#.*)?$/,u=n.match(o),c={};if(u&&u[1])for(var a=u[1].split("&"),s=0;s<a.length;s++){var h=a[s].split("=");c[decodeURIComponent(h[0])]=decodeURIComponent(h.slice(1).join("="))}n=f(n.replace(o,"")),t=f(t||"");for(var d=Math.max(n.length,t.length),l=0;l<d;l++)if(t[l]&&":"===t[l].charAt(0)){var v=t[l].replace(/(^:|[+*?]+$)/g,""),p=(t[l].match(/[+*?]+$/)||e)[0]||"",m=~p.indexOf("+"),y=~p.indexOf("*"),g=n[l]||"";if(!g&&!y&&(p.indexOf("?")<0||m)){i=!1;break}if(c[v]=decodeURIComponent(g),m||y){c[v]=n.slice(l).map(decodeURIComponent).join("/");break}}else if(t[l]!==n[l]){i=!1;break}return(!0===r.default||!1!==i)&&c}function o(n,t){return n.rank<t.rank?1:n.rank>t.rank?-1:n.index-t.index}function u(n,t){return n.index=t,n.rank=function(n){return n.props.default?0:f(n.props.path).map(c).join("")}(n),n.props}function f(n){return n.replace(/(^\/+|\/+$)/g,"").split("/")}function c(n){return":"==n.charAt(0)?1+"*+?".indexOf(n.charAt(n.length-1))||4:5}var a={},s=[],h=[],d=null,l={url:p()},v=n.createContext(l);function p(){var n;return""+((n=d&&d.location?d.location:d&&d.getCurrentLocation?d.getCurrentLocation():"undefined"!=typeof location?location:a).pathname||"")+(n.search||"")}function m(n,t){return void 0===t&&(t=!1),"string"!=typeof n&&n.url&&(t=n.replace,n=n.url),function(n){for(var t=s.length;t--;)if(s[t].canRoute(n))return!0;return!1}(n)&&function(n,t){void 0===t&&(t="push"),d&&d[t]?d[t](n):"undefined"!=typeof history&&history[t+"State"]&&history[t+"State"](null,null,n)}(n,t?"replace":"push"),y(n)}function y(n){for(var t=!1,e=0;e<s.length;e++)s[e].routeTo(n)&&(t=!0);return t}function g(n){if(n&&n.getAttribute){var t=n.getAttribute("href"),e=n.getAttribute("target");if(t&&t.match(/^\//g)&&(!e||e.match(/^_?self$/i)))return m(t)}}function k(n){return n.stopImmediatePropagation&&n.stopImmediatePropagation(),n.stopPropagation&&n.stopPropagation(),n.preventDefault(),!1}function U(n){if(!(n.ctrlKey||n.metaKey||n.altKey||n.shiftKey||n.button)){var t=n.target;do{if("a"===t.localName&&t.getAttribute("href")){if(t.hasAttribute("data-native")||t.hasAttribute("native"))return;if(g(t))return k(n)}}while(t=t.parentNode)}}var C=!1;function b(n){n.history&&(d=n.history),this.state={url:n.url||p()}}return r(b.prototype=new n.Component,{shouldComponentUpdate:function(n){return!0!==n.static||n.url!==this.props.url||n.onChange!==this.props.onChange},canRoute:function(t){var e=n.toChildArray(this.props.children);return void 0!==this.g(e,t)},routeTo:function(n){this.setState({url:n});var t=this.canRoute(n);return this.p||this.forceUpdate(),t},componentWillMount:function(){this.p=!0},componentDidMount:function(){var n=this;C||(C=!0,d||addEventListener("popstate",function(){y(p())}),addEventListener("click",U)),s.push(this),d&&(this.u=d.listen(function(t){var e=t.location||t;n.routeTo(""+(e.pathname||"")+(e.search||""))})),this.p=!1},componentWillUnmount:function(){"function"==typeof this.u&&this.u(),s.splice(s.indexOf(this),1)},componentWillUpdate:function(){this.p=!0},componentDidUpdate:function(){this.p=!1},g:function(n,t){n=n.filter(u).sort(o);for(var e=0;e<n.length;e++){var r=n[e],f=i(t,r.props.path,r.props);if(f)return[r,f]}},render:function(t,e){var i,o,u=t.onChange,f=e.url,c=this.c,a=this.g(n.toChildArray(t.children),f);if(a&&(o=n.cloneElement(a[0],r(r({url:f,matches:i=a[1]},i),{key:void 0,ref:void 0}))),f!==(c&&c.url)){r(l,c=this.c={url:f,previous:c&&c.url,current:o,path:o?o.props.path:null,matches:i}),c.router=this,c.active=o?[o]:[];for(var s=h.length;s--;)h[s]({});"function"==typeof u&&u(c)}return n.h(v.Provider,{value:c},o)}}),b.getCurrentUrl=p,b.route=m,b.Router=b,b.Route=function(t){return n.h(t.component,t)},b.Link=function(t){return n.h("a",r({onClick:U},t))},b.exec=i,b.useRouter=function(){var n=t.useContext(v);if(n===l){var e=t.useState()[1];t.useEffect(function(){return h.push(e),function(){return h.splice(h.indexOf(e),1)}},[])}return[n,m]},b});
//# sourceMappingURL=preact-router.umd.js.map

File diff suppressed because one or more lines are too long

93
spa/node_modules/preact-router/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,93 @@
import * as preact from 'preact';
export function route(url: string, replace?: boolean): boolean;
export function route(options: { url: string; replace?: boolean }): boolean;
export function exec(url: string, route: string, opts: { default?: boolean }): false | Record<string, string | undefined>;
export function getCurrentUrl(): string;
export interface Location {
pathname: string;
search: string;
}
export interface CustomHistory {
listen(callback: (location: Location) => void): () => void;
location: Location;
push(path: string): void;
replace(path: string): void;
}
export interface RoutableProps {
path?: string;
default?: boolean | preact.JSX.SignalLike<boolean | undefined>;
}
export interface RouterOnChangeArgs<
RouteParams extends Record<string, string | undefined> | null = Record<
string,
string | undefined
> | null
> {
router: Router;
url: string;
previous?: string;
active: preact.VNode[];
current: preact.VNode;
path: string | null;
matches: RouteParams;
}
export interface RouterProps<
RouteParams extends Record<string, string | undefined> | null = Record<
string,
string | undefined
> | null
> extends RoutableProps {
history?: CustomHistory;
static?: boolean;
url?: string;
onChange?: (args: RouterOnChangeArgs<RouteParams>) => void;
}
export class Router extends preact.Component<RouterProps, {}> {
canRoute(url: string): boolean;
routeTo(url: string): boolean;
render(props: RouterProps, {}): preact.VNode;
}
type AnyComponent<Props> =
| preact.FunctionalComponent<Props>
| preact.ComponentConstructor<Props, any>;
export interface RouteProps<Props> extends RoutableProps {
component: AnyComponent<Props>;
}
export function Route<Props>(
props: RouteProps<Props> & Partial<Props>
): preact.VNode;
export function Link(
props: preact.JSX.HTMLAttributes<HTMLAnchorElement>
): preact.VNode;
export function useRouter<
RouteParams extends Record<string, string | undefined> | null = Record<
string,
string | undefined
> | null
>(): [
RouterOnChangeArgs<RouteParams>,
(
urlOrOptions: string | { url: string; replace?: boolean },
replace?: boolean
) => boolean
];
declare module 'preact' {
export interface Attributes extends RoutableProps {}
}
export default Router;

16
spa/node_modules/preact-router/match/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
import * as preact from 'preact';
import { Link as StaticLink, RoutableProps } from '..';
export class Match extends preact.Component<RoutableProps, {}> {
render(): preact.VNode;
}
export interface LinkProps extends preact.JSX.HTMLAttributes<HTMLAnchorElement> {
activeClassName?: string;
children?: preact.ComponentChildren;
}
export function Link(props: LinkProps): preact.VNode;
export default Match;

1
spa/node_modules/preact-router/match/index.js generated vendored Normal file
View File

@@ -0,0 +1 @@
var e=require("preact"),a=require("preact-router"),r=["className","activeClass","activeClassName","path"];function t(e){var r=a.useRouter()[0];return e.children({url:r.url,path:r.path,matches:!1!==a.exec(r.path||r.url,e.path,{})})}t.Link=function(t){var s=t.className,u=t.activeClass,c=t.activeClassName,l=t.path,n=function(e,a){if(null==e)return{};var r,t,s={},u=Object.keys(e);for(t=0;t<u.length;t++)a.indexOf(r=u[t])>=0||(s[r]=e[r]);return s}(t,r),i=a.useRouter()[0],h=l&&i.path&&a.exec(i.path,l,{})||a.exec(i.url,n.href,{}),p=n.class||s||"",o=h&&(u||c)||"";return n.class=p+(p&&o&&" ")+o,e.h(a.Link,n)},module.exports=t;

1
spa/node_modules/preact-router/match/index.mjs generated vendored Normal file
View File

@@ -0,0 +1 @@
import{h as a}from"preact";import{useRouter as t,exec as r,Link as e}from"preact-router";var s=["className","activeClass","activeClassName","path"];function l(a){var e=t()[0];return a.children({url:e.url,path:e.path,matches:!1!==r(e.path||e.url,a.path,{})})}function c(l){var c=l.className,n=l.activeClass,u=l.activeClassName,i=l.path,p=function(a,t){if(null==a)return{};var r,e,s={},l=Object.keys(a);for(e=0;e<l.length;e++)t.indexOf(r=l[e])>=0||(s[r]=a[r]);return s}(l,s),h=t()[0],f=i&&h.path&&r(h.path,i,{})||r(h.url,p.href,{}),o=p.class||c||"",m=f&&(n||u)||"";return p.class=o+(o&&m&&" ")+m,a(e,p)}export{c as Link,l as Match,l as default};

1
spa/node_modules/preact-router/match/index.module.js generated vendored Normal file
View File

@@ -0,0 +1 @@
import{h as a}from"preact";import{useRouter as t,exec as r,Link as e}from"preact-router";var s=["className","activeClass","activeClassName","path"];function l(a){var e=t()[0];return a.children({url:e.url,path:e.path,matches:!1!==r(e.path||e.url,a.path,{})})}function c(l){var c=l.className,n=l.activeClass,u=l.activeClassName,i=l.path,p=function(a,t){if(null==a)return{};var r,e,s={},l=Object.keys(a);for(e=0;e<l.length;e++)t.indexOf(r=l[e])>=0||(s[r]=a[r]);return s}(l,s),h=t()[0],f=i&&h.path&&r(h.path,i,{})||r(h.url,p.href,{}),o=p.class||c||"",m=f&&(n||u)||"";return p.class=o+(o&&m&&" ")+m,a(e,p)}export{c as Link,l as Match,l as default};

13
spa/node_modules/preact-router/match/package.json generated vendored Normal file
View File

@@ -0,0 +1,13 @@
{
"name": "index",
"main": "./index.js",
"module": "./index.module.js",
"types": "./index.d.ts",
"scripts": {
"build": "microbundle src/index.js -f es -o . --no-sourcemap --no-generateTypes && microbundle src/cjs.js -f cjs -o . --no-sourcemap --no-generateTypes"
},
"peerDependencies": {
"preact": "*",
"preact-router": "*"
}
}

4
spa/node_modules/preact-router/match/src/cjs.js generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import { Match, Link } from './index';
Match.Link = Link;
export default Match;

32
spa/node_modules/preact-router/match/src/index.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
import { h } from 'preact';
import { Link as StaticLink, exec, useRouter } from 'preact-router';
export function Match(props) {
const router = useRouter()[0];
return props.children({
url: router.url,
path: router.path,
matches: exec(router.path || router.url, props.path, {}) !== false
});
}
export function Link({
className,
activeClass,
activeClassName,
path,
...props
}) {
const router = useRouter()[0];
const matches =
(path && router.path && exec(router.path, path, {})) ||
exec(router.url, props.href, {});
let inactive = props.class || className || '';
let active = (matches && (activeClass || activeClassName)) || '';
props.class = inactive + (inactive && active && ' ') + active;
return <StaticLink {...props} />;
}
export default Match;

104
spa/node_modules/preact-router/package.json generated vendored Normal file
View File

@@ -0,0 +1,104 @@
{
"name": "preact-router",
"amdName": "preactRouter",
"version": "4.1.2",
"description": "Connect your components up to that address bar.",
"main": "dist/preact-router.js",
"module": "dist/preact-router.module.js",
"jsnext:main": "dist/preact-router.module.js",
"umd:main": "dist/preact-router.umd.js",
"unpkg": "dist/preact-router.umd.js",
"exports": {
".": {
"types": "./index.d.ts",
"module": "./dist/preact-router.mjs",
"import": "./dist/preact-router.mjs",
"require": "./dist/preact-router.js"
},
"./package.json": "./package.json",
"./match": {
"types": "./match/index.d.ts",
"module": "./match/index.mjs",
"import": "./match/index.mjs",
"require": "./match/index.js"
},
"./match/package.json": "./match/package.json"
},
"scripts": {
"build": "microbundle -f es --no-generateTypes && microbundle src/cjs.js -f cjs,umd --no-generateTypes && (cd match && npm run build)",
"postbuild": "cp dist/preact-router.module.js dist/preact-router.mjs && cp match/index.module.js match/index.mjs",
"test": "npm-run-all lint build test:unit test:ts",
"lint": "eslint src test",
"fix": "npm run lint -- --fix",
"test:unit": "karmatic",
"test:ts": "tsc -p ./test",
"prepublishOnly": "npm-run-all build",
"release": "npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish",
"format": "prettier --write ."
},
"files": [
"dist",
"match",
"index.d.ts"
],
"typings": "./index.d.ts",
"keywords": [
"preact",
"router"
],
"author": "Jason Miller <jason@developit.ca>",
"license": "MIT",
"repository": "preactjs/preact-router",
"homepage": "https://github.com/preactjs/preact-router",
"eslintConfig": {
"extends": "preact",
"rules": {
"jest/no-jasmine-globals": 0
},
"globals": {
"spyOn": "readonly"
}
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"**/*.{js,ts,jsx,tsx}": [
"prettier --write"
],
"*.json": [
"prettier --write"
]
},
"prettier": {
"singleQuote": true,
"useTabs": true,
"trailingComma": "none",
"arrowParens": "avoid"
},
"peerDependencies": {
"preact": ">=10"
},
"devDependencies": {
"@babel/plugin-transform-react-jsx": "^7.9.1",
"@types/jasmine": "^3.10.3",
"chai": "^4.3.7",
"eslint": "^6.8.0",
"eslint-config-preact": "^1.1.1",
"history": "^5.2.0",
"husky": "^7.0.2",
"karmatic": "^2.1.0",
"lint-staged": "^11.1.2",
"microbundle": "^0.14.2",
"mocha": "^5.2.0",
"npm-run-all": "^3.0.0",
"preact": "^10.16.0",
"prettier": "^2.3.2",
"sinon": "^7.1.0",
"sinon-chai": "^3.7.0",
"typescript": "^4.9.5",
"webpack": "^4.42.0"
}
}