apprun 3.35.0 → 3.36.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/README.md +134 -16
- package/WHATSNEW.md +28 -12
- package/apprun-book.jpg +0 -0
- package/apprun.d.ts +9 -6
- package/cli/app.js +29 -0
- package/cli/index.html +13 -0
- package/{apprun-cli.js → cli/index.js} +8 -14
- package/dist/apprun-dev-tools.js +1 -2
- package/dist/apprun-dev-tools.js.map +1 -1
- package/dist/apprun-html.esm.js +7 -7
- package/dist/apprun-html.esm.js.map +1 -1
- package/dist/apprun-html.js +1 -1
- package/dist/apprun-html.js.map +1 -1
- package/dist/apprun-play-html.esm.js +7 -7
- package/dist/apprun-play-html.esm.js.map +1 -1
- package/dist/apprun-play.js +1 -1
- package/dist/apprun-play.js.map +1 -1
- package/dist/apprun.esm.js +1 -1
- package/dist/apprun.esm.js.map +1 -1
- package/dist/apprun.js +1 -1
- package/dist/apprun.js.map +1 -1
- package/esm/app.js +60 -12
- package/esm/app.js.map +1 -1
- package/esm/apprun-dev-tools.js +1 -7
- package/esm/apprun-dev-tools.js.map +1 -1
- package/esm/apprun-html.js +8 -4
- package/esm/apprun-html.js.map +1 -1
- package/esm/apprun.js +81 -17
- package/esm/apprun.js.map +1 -1
- package/esm/component.js +60 -19
- package/esm/component.js.map +1 -1
- package/esm/decorator.js +22 -5
- package/esm/decorator.js.map +1 -1
- package/esm/directive.js +64 -13
- package/esm/directive.js.map +1 -1
- package/esm/router.js +263 -22
- package/esm/router.js.map +1 -1
- package/esm/type-utils.js +91 -0
- package/esm/type-utils.js.map +1 -0
- package/esm/types.js +32 -11
- package/esm/types.js.map +1 -1
- package/esm/vdom-my-new.js +329 -0
- package/esm/vdom-my-new.js.map +1 -0
- package/esm/vdom-my-prop-attr.js +227 -0
- package/esm/vdom-my-prop-attr.js.map +1 -0
- package/esm/vdom-my.js +77 -88
- package/esm/vdom-my.js.map +1 -1
- package/esm/version.js +15 -0
- package/esm/version.js.map +1 -0
- package/esm/web-component.js +30 -10
- package/esm/web-component.js.map +1 -1
- package/index.html +1 -1
- package/jest.config.js +3 -8
- package/jest.setup.js +29 -3
- package/jsx-runtime.js +1 -1
- package/jsx-runtime.js.map +1 -1
- package/package.json +7 -7
- package/src/app.ts +58 -12
- package/src/apprun-dev-tools.tsx +1 -7
- package/src/apprun-html.ts +8 -4
- package/src/apprun.ts +97 -20
- package/src/component.ts +62 -20
- package/src/decorator.ts +23 -6
- package/src/directive.ts +64 -13
- package/src/router.ts +282 -20
- package/src/type-utils.ts +130 -0
- package/src/types.ts +33 -12
- package/src/vdom-my-new.ts +311 -0
- package/src/vdom-my-prop-attr.ts +241 -0
- package/src/vdom-my.ts +82 -71
- package/src/version.ts +16 -0
- package/src/web-component.ts +31 -11
- package/cli/export.js +0 -92
- package/cli/import.js +0 -68
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
## Releases
|
|
4
4
|
|
|
5
|
+
## 3.36.1
|
|
6
|
+
|
|
7
|
+
* Continue code review with AI
|
|
8
|
+
* Use property-information to improve property and attribute handling
|
|
9
|
+
* Performance improvements in virtual DOM handling, see [analysis reports](docs/done/framework-reordering-comparison.md)
|
|
10
|
+
* New hierarchical matching behavior, see [hierarchical routing requirements](docs/requirements/req-hierarchical-routing.md)
|
|
11
|
+
|
|
12
|
+
## 3.36.0
|
|
13
|
+
|
|
14
|
+
* Code review by using Copilot and Claude Sonnet 4, see [plan-apprun-bugfixes.md](docs/plan/plan-apprun-bugfixes.md) for details.
|
|
15
|
+
* Enhanced type definitions (apprun.d.ts) for better TypeScript support
|
|
16
|
+
* Fixed minor bugs and edge cases in virtual DOM handling
|
|
17
|
+
* Fixed bugs in router initialization logic
|
|
18
|
+
|
|
19
|
+
## 3.35.0
|
|
20
|
+
|
|
21
|
+
* Support auto use router for pretty links
|
|
22
|
+
* AppRun now supports pretty links with components subscribing to route events like '/about'
|
|
23
|
+
* Routing component events with pretty links
|
|
24
|
+
* Fallback to hash-based routing when components subscribe to '#' or '#/'
|
|
25
|
+
|
|
26
|
+
## 3.33.10
|
|
27
|
+
|
|
28
|
+
* Support async generator for event handlers
|
|
29
|
+
* Async generator functions can return multiple values rendered in order
|
|
30
|
+
* Use lit-html V3 for apprun-html.js
|
|
31
|
+
* Standalone version of AppRun using lit-html for rendering without JSX
|
|
32
|
+
|
|
5
33
|
## 3.30.0
|
|
6
34
|
|
|
7
35
|
* Add React-safe apprun-play-html
|
package/README.md
CHANGED
|
@@ -1,11 +1,27 @@
|
|
|
1
|
-
# AppRun
|
|
1
|
+
# AppRun
|
|
2
2
|
|
|
3
|
+
[](https://apprun.js.org/docs)
|
|
4
|
+
[](https://apprun.js.org/#play)
|
|
5
|
+
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][downloads-url] [![License][license-image]][license-url] [![twitter][twitter-badge]][twitter] [![Discord Chat][discord-image]][discord-invite]
|
|
6
|
+
|
|
7
|
+
🚀 July 2025, We have started to improve the codebase using AI. See [whats new](#new) for details.
|
|
3
8
|
|
|
4
9
|
## Introduction
|
|
5
10
|
|
|
6
|
-
AppRun is a lightweight
|
|
11
|
+
AppRun is a lightweight framework for building web apps. It has a [unique architecture](https://apprun.js.org/docs/architecture/) inspired by the Elm architecture that can help you manage states, routing, and other essential aspects of your web application, leveraging the power of the [event publish-subscribe](https://apprun.js.org/docs/event-pubsub/) pattern.
|
|
12
|
+
|
|
13
|
+
## AppRun Benefits
|
|
14
|
+
|
|
15
|
+
* Clean architecture that needs minimal setup and boilerplate code.
|
|
16
|
+
* Decoupled architecture that is test friendly.
|
|
17
|
+
* No proprietary syntax to learn (no hooks, no reducers, no signals)
|
|
18
|
+
* State management and routing included
|
|
19
|
+
* Use directly in the browser or with a compiler/bundler
|
|
20
|
+
* Advanced features: JSX, Web Components, Dev Tools, SSR, etc.
|
|
21
|
+
|
|
22
|
+
## Examples
|
|
7
23
|
|
|
8
|
-
|
|
24
|
+
Let's use a _Counter_ as an example to demonstrate the AppRun architecture:
|
|
9
25
|
|
|
10
26
|
```js
|
|
11
27
|
// define the initial state
|
|
@@ -29,21 +45,122 @@ app.start(document.body, state, view, update);
|
|
|
29
45
|
```
|
|
30
46
|
<apprun-code></apprun-code>
|
|
31
47
|
|
|
32
|
-
|
|
48
|
+
With [directives](https://apprun.js.org/docs/directives/) syntax sugar you can write more concise code:
|
|
33
49
|
|
|
34
|
-
|
|
50
|
+
```js
|
|
51
|
+
// define the initial state
|
|
52
|
+
const state = 0;
|
|
35
53
|
|
|
36
|
-
|
|
54
|
+
// view is a function to display the state (JSX)
|
|
55
|
+
const view = state => <div>
|
|
56
|
+
<h1>{state}</h1>
|
|
57
|
+
<button $onclick="-1">-1</button>
|
|
58
|
+
<button $onclick="+1">+1</button>
|
|
59
|
+
</div>;
|
|
37
60
|
|
|
38
|
-
|
|
61
|
+
// update is a collection of event handlers
|
|
62
|
+
const update = {
|
|
63
|
+
'+1': state => state + 1,
|
|
64
|
+
'-1': state => state - 1
|
|
65
|
+
};
|
|
39
66
|
|
|
40
|
-
|
|
67
|
+
// start the app
|
|
68
|
+
app.start(document.body, state, view, update);
|
|
69
|
+
```
|
|
70
|
+
<apprun-code></apprun-code>
|
|
41
71
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
72
|
+
Alternatively, you can invoke state update functions without events for local state updates:
|
|
73
|
+
|
|
74
|
+
```js
|
|
75
|
+
// define the initial state
|
|
76
|
+
const state = 0;
|
|
77
|
+
|
|
78
|
+
// state update function
|
|
79
|
+
const add = (state, value) => state + value;
|
|
80
|
+
|
|
81
|
+
// view is a function to display the state (JSX)
|
|
82
|
+
const view = state => <div>
|
|
83
|
+
<h1>{state}</h1>
|
|
84
|
+
<button $onclick={[add, -1]}>-1</button>
|
|
85
|
+
<button $onclick={[add, 1]}>+1</button>
|
|
86
|
+
</div>;
|
|
87
|
+
|
|
88
|
+
// start the app
|
|
89
|
+
app.start(document.body, state, view);
|
|
90
|
+
```
|
|
91
|
+
<apprun-code></apprun-code>
|
|
92
|
+
|
|
93
|
+
And, of course, you can use Components to encapsulate the logic blocks, e.g., SPA pages. AppRun supports routing to `/<path>`, `#<path>`, and `#/<path>` URLs with [hierarchical routing](docs/requirements/req-hierarchical-routing.md).
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
class Home extends Component {
|
|
97
|
+
view = () => <div>Home</div>;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
class Contact extends Component {
|
|
101
|
+
view = () => <div>Contact</div>;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
class About extends Component {
|
|
105
|
+
view = () => <div>About</div>;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const App = () => <>
|
|
109
|
+
<div id="menus">
|
|
110
|
+
<a href="/home">Home</a>{' | '}
|
|
111
|
+
<a href="/contact">Contact</a>{' | '}
|
|
112
|
+
<a href="/about">About</a></div>
|
|
113
|
+
<div id="pages"></div>
|
|
114
|
+
</>
|
|
115
|
+
|
|
116
|
+
app.render(document.body, <App />);
|
|
117
|
+
[
|
|
118
|
+
[About, '/about'],
|
|
119
|
+
[Contact, '/contact'],
|
|
120
|
+
[Home, '/, /home'],
|
|
121
|
+
].map(([C, route]) => new C().start('pages', {route}));
|
|
122
|
+
```
|
|
123
|
+
<apprun-code></apprun-code>
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
One cool feature of AppRun is that you can use async generator functions for event handlers to return multiple values. AppRun will render each value in the order they are generated.
|
|
127
|
+
|
|
128
|
+
```js
|
|
129
|
+
const state = {};
|
|
130
|
+
const view = state => html`
|
|
131
|
+
<div><button @click=${run(getComic)}>fetch ...</button></div>
|
|
132
|
+
${state.loading && html`<div>loading ... </div>`}
|
|
133
|
+
${state.comic && html`<img src=${state.comic.img} />`}
|
|
134
|
+
`;
|
|
135
|
+
async function* getComic() { // async generator function returns loading flag and then the comic object
|
|
136
|
+
yield { loading: true };
|
|
137
|
+
const response = await fetch('https://xkcd-api.netlify.app');
|
|
138
|
+
const comic = await response.json();
|
|
139
|
+
yield { comic };
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
app.start(document.body, state, view);
|
|
143
|
+
```
|
|
144
|
+
<apprun-code></apprun-code>
|
|
145
|
+
|
|
146
|
+
Finally, you can use AppRun with [React](https://reactjs.org/). The `app.use_react` function allows you to use React for rendering the view.
|
|
147
|
+
|
|
148
|
+
```js
|
|
149
|
+
import React from 'react'
|
|
150
|
+
import ReactDOM from 'react-dom/client'
|
|
151
|
+
import app from 'apprun';
|
|
152
|
+
use_react(React, ReactDOM);
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
The `app.use_render` function allows you to use a other render library for rendering the view.
|
|
156
|
+
|
|
157
|
+
```js
|
|
158
|
+
import { render } from 'preact'
|
|
159
|
+
import app from 'apprun';
|
|
160
|
+
app.use_render(render);
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
There are many more examples and interactive demos available in [the AppRun Playground](https://apprun.js.org/#play).
|
|
47
164
|
|
|
48
165
|
|
|
49
166
|
## Getting Started
|
|
@@ -53,7 +170,8 @@ AppRun is distributed on npm. To get it, run:
|
|
|
53
170
|
```sh
|
|
54
171
|
npm install apprun
|
|
55
172
|
```
|
|
56
|
-
|
|
173
|
+
|
|
174
|
+
When you want to do a rapid prototyping or demo, you can use AppRun directly in the browser without JSX or any build step. The `app`, `html` and `run` functions are available globally. The `html` is a HTML template from lit-html. The `run` function is a equivalent to the `$on` directive, which can be used to invoke state update functions.
|
|
57
175
|
|
|
58
176
|
```js
|
|
59
177
|
<html>
|
|
@@ -92,11 +210,11 @@ npm create apprun-app [my-app]
|
|
|
92
210
|
|
|
93
211
|
### Learn More
|
|
94
212
|
|
|
95
|
-
You can
|
|
213
|
+
You can read [AppRun Docs](https://apprun.js.org/docs).
|
|
96
214
|
|
|
97
215
|
### AppRun Book from Apress
|
|
98
216
|
|
|
99
|
-
[](https://www.amazon.com/Practical-Application-Development-AppRun-High-Performance/dp/1484240685/)
|
|
100
218
|
|
|
101
219
|
* [Order from Amazon](https://www.amazon.com/Practical-Application-Development-AppRun-High-Performance/dp/1484240685/)
|
|
102
220
|
|
package/WHATSNEW.md
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
## What's New
|
|
2
2
|
|
|
3
|
-
> July
|
|
3
|
+
> July 15, 2025, V3.36.1
|
|
4
|
+
|
|
5
|
+
- Continue code review with AI
|
|
6
|
+
- Use property-information to improve property and attribute handling
|
|
7
|
+
- Performance improvements in virtual DOM handling, see [analysis reports](docs/done/framework-reordering-comparison.md)
|
|
8
|
+
- New hierarchical matching behavior, see [hierarchical routing document](docs/requirements/req-hierarchical-routing.md)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
> July 12, 2025, V3.36.0
|
|
12
|
+
|
|
13
|
+
Code review by using Copilot and Claude Sonnet 4, see [plan-apprun-bugfixes.md](docs/plan/plan-apprun-bugfixes.md) for details.
|
|
14
|
+
- Enhanced type definitions (apprun.d.ts) for better TypeScript support
|
|
15
|
+
- Fixed minor bugs and edge cases in virtual DOM handling
|
|
16
|
+
- Fixed bugs in router initialization logic
|
|
17
|
+
|
|
18
|
+
> July 11, 2025, V3.35.0
|
|
19
|
+
|
|
4
20
|
|
|
5
21
|
### Support auto use router for pretty links
|
|
6
22
|
|
|
@@ -55,20 +71,20 @@ If you have components subscribe to '#', or '#/', Apprun will fallback to the ha
|
|
|
55
71
|
You can now use async generator functions for event handlers. The async generator function can return multiple values. AppRun will render each value in the order they are generated.
|
|
56
72
|
|
|
57
73
|
```js
|
|
58
|
-
|
|
59
|
-
|
|
74
|
+
const state = {};
|
|
75
|
+
const view = state => html`
|
|
60
76
|
<div><button @click=${run(getComic)}>fetch ...</button></div>
|
|
61
77
|
${state.loading && html`<div>loading ... </div>`}
|
|
62
78
|
${state.comic && html`<img src=${state.comic.img} />`}
|
|
63
79
|
`;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
80
|
+
async function* getComic() { // async generator function returns loading flag and then the comic object
|
|
81
|
+
yield { loading: true };
|
|
82
|
+
const response = await fetch('https://xkcd-api.netlify.app');
|
|
83
|
+
const comic = await response.json();
|
|
84
|
+
yield { comic };
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
app.start(document.body, state, view);
|
|
72
88
|
```
|
|
73
89
|
<apprun-code></apprun-code>
|
|
74
90
|
|
|
@@ -85,7 +101,7 @@ The `apprun-html.js` now uses `lit-html` V3 for rendering the view. The `apprun-
|
|
|
85
101
|
<title>Counter</title>
|
|
86
102
|
</head>
|
|
87
103
|
<body>
|
|
88
|
-
<script src="https://unpkg.com/dist/apprun-html"></script>
|
|
104
|
+
<script src="https://unpkg.com/apprun/dist/apprun-html"></script>
|
|
89
105
|
<script>
|
|
90
106
|
const add = (state, delta) => state + delta;
|
|
91
107
|
const view = state => {
|
package/apprun-book.jpg
ADDED
|
Binary file
|
package/apprun.d.ts
CHANGED
|
@@ -3,11 +3,11 @@ declare module 'apprun' {
|
|
|
3
3
|
export type Element = HTMLElement | string;
|
|
4
4
|
|
|
5
5
|
export type VNode = {
|
|
6
|
-
tag: string,
|
|
6
|
+
tag: string | Function,
|
|
7
7
|
props: {},
|
|
8
8
|
children: Array<VNode | string>
|
|
9
9
|
};
|
|
10
|
-
export type VDOM = false | string | VNode | Array<VNode | string
|
|
10
|
+
export type VDOM = false | string | VNode | Array<VNode | string> | any; // TemplateResult from lit-html
|
|
11
11
|
export type View<T> = (state: T) => VDOM | void;
|
|
12
12
|
export type Action<T> = (state: T, ...p: any[]) => T | Promise<T> | void;
|
|
13
13
|
export type ActionDef<T, E> = (readonly [E, Action<T>, {}?]);
|
|
@@ -37,7 +37,8 @@ declare module 'apprun' {
|
|
|
37
37
|
transition?: boolean;
|
|
38
38
|
history?;
|
|
39
39
|
route?: string;
|
|
40
|
-
rendered?: (state: T) => void
|
|
40
|
+
rendered?: (state: T) => void;
|
|
41
|
+
mounted?: (props: any, children: any[], state: T) => T | void;
|
|
41
42
|
};
|
|
42
43
|
|
|
43
44
|
export interface IApp {
|
|
@@ -48,13 +49,15 @@ declare module 'apprun' {
|
|
|
48
49
|
off(name: string, fn: (...args: any[]) => void): void;
|
|
49
50
|
find(name: string): any;
|
|
50
51
|
run(name: string, ...args: any[]): number;
|
|
51
|
-
|
|
52
|
+
/** @deprecated Use runAsync() instead. query() will be removed in a future version. */
|
|
53
|
+
query(name: string, ...args): Promise<any[]>;
|
|
52
54
|
runAsync(name: string, ...args): Promise<any[]>;
|
|
53
55
|
h(tag: string | Function, ...children: any[]): VNode | VNode[];
|
|
54
56
|
createElement(tag: string | Function, ...children: any[]): VNode | VNode[];
|
|
55
57
|
render(element: Element | string, node: VDOM): void;
|
|
56
58
|
Fragment(props: any[], ...children: any[]): any[];
|
|
57
59
|
route?: Route;
|
|
60
|
+
basePath?: string; // Base path for sub-directory deployments
|
|
58
61
|
webComponent(name: string, componentClass, options?: CustomElementOptions): void;
|
|
59
62
|
safeHTML(html: string): any[];
|
|
60
63
|
use_render(render, mode?: 0 | 1);
|
|
@@ -70,13 +73,13 @@ declare module 'apprun' {
|
|
|
70
73
|
start(element?: Element | string, options?: MountOptions): Component<T, E>;
|
|
71
74
|
on(name: E, fn: (...args: any[]) => void, options?: any): void;
|
|
72
75
|
run(name: E, ...args: any[]): number;
|
|
73
|
-
|
|
76
|
+
/** @deprecated Use runAsync() instead. query() will be removed in a future version. */
|
|
77
|
+
query(name: string, ...args): Promise<any[]>;
|
|
74
78
|
runAsync(name: string, ...args): Promise<any[]>;
|
|
75
79
|
rendered: (state: T) => void;
|
|
76
80
|
mounted: (props: any, children: any[], state: T) => T | void;
|
|
77
81
|
unmount: () => void;
|
|
78
82
|
unload: (state: T) => void;
|
|
79
|
-
render(element: HTMLElement, node: any): void;
|
|
80
83
|
}
|
|
81
84
|
|
|
82
85
|
export function on<E>(name?: E, options?: EventOptions): any;
|
package/cli/app.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const { app, html } = window["apprun"];
|
|
2
|
+
|
|
3
|
+
// Routing (component event)
|
|
4
|
+
class Home extends Component {
|
|
5
|
+
view = () => html`<div>Home</div>`;
|
|
6
|
+
update = { '/, /home': state => state };
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
class Contact extends Component {
|
|
10
|
+
view = () => html`<div>Contact</div>`;
|
|
11
|
+
update = { '/contact': state => state };
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
class About extends Component {
|
|
15
|
+
view = () => html`<div>About</div>`;
|
|
16
|
+
update = { '/about': state => state };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const App = () => html`<div id="menus">
|
|
20
|
+
<a href="/home">Home</a> |
|
|
21
|
+
<a href="/contact">Contact</a> |
|
|
22
|
+
<a href="/about">About</a></div>
|
|
23
|
+
<div id="pages"></div>
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
// app.basePath = '/'; // Uncomment this line if you want to set a base path for routing
|
|
27
|
+
app.start('#app', {}, App);
|
|
28
|
+
|
|
29
|
+
[About, Contact, Home].map(C => new C().start('pages'));
|
package/cli/index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>AppRun App</title>
|
|
7
|
+
<script src="https://unpkg.com/apprun/dist/apprun-html.js"></script>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="app.js"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const { program } = require('commander');
|
|
4
|
-
const { existsSync, writeFileSync, mkdirSync } = require('fs');
|
|
4
|
+
const { existsSync, writeFileSync, mkdirSync, copyFileSync } = require('fs');
|
|
5
5
|
const { resolve, dirname } = require('path');
|
|
6
|
-
const { red, green, yellow } = require('./
|
|
6
|
+
const { red, green, yellow } = require('./colors');
|
|
7
|
+
const execSync = require('child_process').execSync;
|
|
7
8
|
|
|
8
9
|
const component_template = `import {app, Component} from 'apprun';
|
|
9
10
|
|
|
@@ -26,31 +27,28 @@ import #name from './#fn';
|
|
|
26
27
|
describe('component', () => {
|
|
27
28
|
it('should render state upon route event', () => {
|
|
28
29
|
const element = document.createElement('div');
|
|
29
|
-
const component = new #name().
|
|
30
|
-
//app.run('/#name');
|
|
31
|
-
component.run('.');
|
|
30
|
+
const component = new #name().start(element);
|
|
32
31
|
expect(element.textContent).toBe('#name');
|
|
33
32
|
})
|
|
34
33
|
})
|
|
35
34
|
`;
|
|
36
35
|
|
|
37
36
|
program
|
|
38
|
-
.version('3.
|
|
37
|
+
.version('3.36.0')
|
|
39
38
|
.description('AppRun CLI')
|
|
40
39
|
.option('-i, --init', 'Initialize AppRun Project')
|
|
41
40
|
.option('-c, --component <name>', 'Create a component')
|
|
42
41
|
.option('-t, --test <name>', 'Create a component spec')
|
|
43
42
|
.option('-p, --pages [directory]', 'Create example pages')
|
|
44
43
|
|
|
45
|
-
|
|
46
44
|
program.parse(process.argv);
|
|
47
45
|
|
|
48
46
|
const options = program.opts();
|
|
49
47
|
if (options.init) {
|
|
50
|
-
|
|
51
|
-
return;
|
|
48
|
+
execSync('npm create apprun-app@latest', { stdio: 'inherit' });
|
|
52
49
|
}
|
|
53
50
|
|
|
51
|
+
|
|
54
52
|
function createTestFile(fn, name) {
|
|
55
53
|
const component_name = name || fn.split('/').pop();
|
|
56
54
|
const component_file = fn.split('/').pop();
|
|
@@ -95,8 +93,4 @@ if (options.pages) {
|
|
|
95
93
|
createTestFile(`${pages}/About/index`, 'About');
|
|
96
94
|
createComponent(`${pages}/Contact/index`, 'Contact');
|
|
97
95
|
createTestFile(`${pages}/Contact/index`, 'Contact');
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
96
|
+
}
|
package/dist/apprun-dev-tools.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
/*! For license information please see apprun-dev-tools.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.apprun=t():e.apprun=t()}(this,(()=>(()=>{"use strict";var e={859:(e,t,n)=>{n.d(t,{A:()=>r});let i;const o="undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};o.app&&o._AppRunVersions?i=o.app:(i=new class{constructor(){this._events={}}on(e,t,n={}){this._events[e]=this._events[e]||[],this._events[e].push({fn:t,options:n})}off(e,t){const n=this._events[e]||[];this._events[e]=n.filter((e=>e.fn!==t))}find(e){return this._events[e]}run(e,...t){const n=this.getSubscribers(e,this._events);return console.assert(n&&n.length>0,"No subscriber for event: "+e),n.forEach((n=>{const{fn:i,options:o}=n;return o.delay?this.delay(e,i,t,o):Object.keys(o).length>0?i.apply(this,[...t,o]):i.apply(this,t),!n.options.once})),n.length}once(e,t,n={}){this.on(e,t,Object.assign(Object.assign({},n),{once:!0}))}delay(e,t,n,i){i._t&&clearTimeout(i._t),i._t=setTimeout((()=>{clearTimeout(i._t),Object.keys(i).length>0?t.apply(this,[...n,i]):t.apply(this,n)}),i.delay)}runAsync(e,...t){const n=this.getSubscribers(e,this._events);console.assert(n&&n.length>0,"No subscriber for event: "+e);const i=n.map((e=>{const{fn:n,options:i}=e;return Object.keys(i).length>0?n.apply(this,[...t,i]):n.apply(this,t)}));return Promise.all(i)}query(e,...t){return this.runAsync(e,...t)}getSubscribers(e,t){const n=t[e]||[];return t[e]=n.filter((e=>!e.options.once)),Object.keys(t).filter((t=>t.endsWith("*")&&e.startsWith(t.replace("*","")))).sort(((e,t)=>t.length-e.length)).forEach((i=>n.push(...t[i].map((t=>Object.assign(Object.assign({},t),{options:Object.assign(Object.assign({},t.options),{event:e})})))))),n}},o.app=i,o._AppRunVersions="AppRun-3.3.11");const r=i}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var r=t[i]={exports:{}};return e[i](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var i=n(859);function o(e){return e.map((e=>a(e))).join("")}function r(e){for(var t in e)null==e[t]?delete e[t]:"object"==typeof e[t]&&r(e[t])}function a(e){if(!e)return"";if(e._$litType$)return e.toString();if(r(e),Array.isArray(e))return o(e);if("string"==typeof e)return e.startsWith("_html:")?e.substring(6):e;if(e.tag){const t=e.props?function(e){return Object.keys(e).map((t=>{return` ${"className"===t?"class":t}="${n=e[t],"object"==typeof n?Object.keys(n).map((e=>`${e}:${n[e]}`)).join(";"):n.toString()}"`;var n})).join("")}(e.props):"",n=e.children?o(e.children):"";return`<${e.tag}${t}>${n}</${e.tag}>`}return"object"==typeof e?JSON.stringify(e):void 0}const l=a;let s;function c(e){s=window.open("",e),s.document.write(`<html>\n <title>AppRun Analyzer | ${document.location.href}</title>\n <style>\n body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI" }\n </style>\n <body><pre>`)}function u(e){s.document.write(e+"\n")}function p(){s.document.write("</pre>\n </body>\n </html>"),s.document.close()}app.debug=!0;const f=e=>{u(`import ${e.constructor.name} from '../src/${e.constructor.name}'`),u(`describe('${e.constructor.name}', ()=>{`),e._actions.forEach((t=>{"."!==t.name&&(u(` it ('should handle event: ${t.name}', (done)=>{`),u(` const component = new ${e.constructor.name}().mount();`),u(` component.run('${t.name}');`),u(" setTimeout(() => {"),u(" //expect(?).toHaveBeenCalled();"),u(" //expect(component.state).toBe(?);"),u(" done();"),u(" })"))})),u("});")};let d=!1,h=[];app.on("debug",(e=>{d&&e.vdom&&(h.push(e),console.log(`* ${h.length} state(s) recorded.`))}));function g(e){return null==e}var m={isNothing:g,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e:g(e)?[]:[e]},repeat:function(e,t){var n,i="";for(n=0;n<t;n+=1)i+=e;return i},isNegativeZero:function(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e},extend:function(e,t){var n,i,o,r;if(t)for(n=0,i=(r=Object.keys(t)).length;n<i;n+=1)e[o=r[n]]=t[o];return e}};function y(e,t){var n="",i=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+="\n\n"+e.mark.snippet),i+" "+n):i}function b(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=y(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}b.prototype=Object.create(Error.prototype),b.prototype.constructor=b,b.prototype.toString=function(e){return this.name+": "+y(this,e)};var v=b;function A(e,t,n,i,o){var r="",a="",l=Math.floor(o/2)-1;return i-t>l&&(t=i-l+(r=" ... ").length),n-i>l&&(n=i+l-(a=" ...").length),{str:r+e.slice(t,n).replace(/\t/g,"→")+a,pos:i-t+r.length}}function w(e,t){return m.repeat(" ",t-e.length)+e}var k=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],x=["scalar","sequence","mapping"],C=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===k.indexOf(t))throw new v('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===x.indexOf(this.kind))throw new v('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function O(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,i){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=i)})),n[t]=e})),n}function S(e){return this.extend(e)}S.prototype.extend=function(e){var t=[],n=[];if(e instanceof C)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new v("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof C))throw new v("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new v("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new v("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof C))throw new v("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var i=Object.create(S.prototype);return i.implicit=(this.implicit||[]).concat(t),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=O(i,"implicit"),i.compiledExplicit=O(i,"explicit"),i.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function i(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(i);return n}(i.compiledImplicit,i.compiledExplicit),i};var j=S,I=new C("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}}),_=new C("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}}),T=new C("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}}),E=new j({explicit:[I,_,T]}),N=new C("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"}),L=new C("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function F(e){return 48<=e&&e<=55}function M(e){return 48<=e&&e<=57}var $=new C("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,i=e.length,o=0,r=!1;if(!i)return!1;if("-"!==(t=e[o])&&"+"!==t||(t=e[++o]),"0"===t){if(o+1===i)return!0;if("b"===(t=e[++o])){for(o++;o<i;o++)if("_"!==(t=e[o])){if("0"!==t&&"1"!==t)return!1;r=!0}return r&&"_"!==t}if("x"===t){for(o++;o<i;o++)if("_"!==(t=e[o])){if(!(48<=(n=e.charCodeAt(o))&&n<=57||65<=n&&n<=70||97<=n&&n<=102))return!1;r=!0}return r&&"_"!==t}if("o"===t){for(o++;o<i;o++)if("_"!==(t=e[o])){if(!F(e.charCodeAt(o)))return!1;r=!0}return r&&"_"!==t}}if("_"===t)return!1;for(;o<i;o++)if("_"!==(t=e[o])){if(!M(e.charCodeAt(o)))return!1;r=!0}return!(!r||"_"===t)},construct:function(e){var t,n=e,i=1;if(-1!==n.indexOf("_")&&(n=n.replace(/_/g,"")),"-"!==(t=n[0])&&"+"!==t||("-"===t&&(i=-1),t=(n=n.slice(1))[0]),"0"===n)return 0;if("0"===t){if("b"===n[1])return i*parseInt(n.slice(2),2);if("x"===n[1])return i*parseInt(n.slice(2),16);if("o"===n[1])return i*parseInt(n.slice(2),8)}return i*parseInt(n,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&e%1==0&&!m.isNegativeZero(e)},represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),D=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),R=/^[-+]?[0-9]+e/,U=new C("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!D.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||m.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(m.isNegativeZero(e))return"-0.0";return n=e.toString(10),R.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),q=E.extend({implicit:[N,L,$,U]}),Y=q,B=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),P=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"),V=new C("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==B.exec(e)||null!==P.exec(e))},construct:function(e){var t,n,i,o,r,a,l,s,c=0,u=null;if(null===(t=B.exec(e))&&(t=P.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],i=+t[2]-1,o=+t[3],!t[4])return new Date(Date.UTC(n,i,o));if(r=+t[4],a=+t[5],l=+t[6],t[7]){for(c=t[7].slice(0,3);c.length<3;)c+="0";c=+c}return t[9]&&(u=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(u=-u)),s=new Date(Date.UTC(n,i,o,r,a,l,c)),u&&s.setTime(s.getTime()-u),s},instanceOf:Date,represent:function(e){return e.toISOString()}}),W=new C("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),G="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r",K=new C("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,i=0,o=e.length,r=G;for(n=0;n<o;n++)if(!((t=r.indexOf(e.charAt(n)))>64)){if(t<0)return!1;i+=6}return i%8==0},construct:function(e){var t,n,i=e.replace(/[\r\n=]/g,""),o=i.length,r=G,a=0,l=[];for(t=0;t<o;t++)t%4==0&&t&&(l.push(a>>16&255),l.push(a>>8&255),l.push(255&a)),a=a<<6|r.indexOf(i.charAt(t));return 0==(n=o%4*6)?(l.push(a>>16&255),l.push(a>>8&255),l.push(255&a)):18===n?(l.push(a>>10&255),l.push(a>>2&255)):12===n&&l.push(a>>4&255),new Uint8Array(l)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,i="",o=0,r=e.length,a=G;for(t=0;t<r;t++)t%3==0&&t&&(i+=a[o>>18&63],i+=a[o>>12&63],i+=a[o>>6&63],i+=a[63&o]),o=(o<<8)+e[t];return 0==(n=r%3)?(i+=a[o>>18&63],i+=a[o>>12&63],i+=a[o>>6&63],i+=a[63&o]):2===n?(i+=a[o>>10&63],i+=a[o>>4&63],i+=a[o<<2&63],i+=a[64]):1===n&&(i+=a[o>>2&63],i+=a[o<<4&63],i+=a[64],i+=a[64]),i}}),H=Object.prototype.hasOwnProperty,J=Object.prototype.toString,Z=new C("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,i,o,r,a=[],l=e;for(t=0,n=l.length;t<n;t+=1){if(i=l[t],r=!1,"[object Object]"!==J.call(i))return!1;for(o in i)if(H.call(i,o)){if(r)return!1;r=!0}if(!r)return!1;if(-1!==a.indexOf(o))return!1;a.push(o)}return!0},construct:function(e){return null!==e?e:[]}}),z=Object.prototype.toString,X=new C("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,i,o,r,a=e;for(r=new Array(a.length),t=0,n=a.length;t<n;t+=1){if(i=a[t],"[object Object]"!==z.call(i))return!1;if(1!==(o=Object.keys(i)).length)return!1;r[t]=[o[0],i[o[0]]]}return!0},construct:function(e){if(null===e)return[];var t,n,i,o,r,a=e;for(r=new Array(a.length),t=0,n=a.length;t<n;t+=1)i=a[t],o=Object.keys(i),r[t]=[o[0],i[o[0]]];return r}}),Q=Object.prototype.hasOwnProperty,ee=new C("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0;var t,n=e;for(t in n)if(Q.call(n,t)&&null!==n[t])return!1;return!0},construct:function(e){return null!==e?e:{}}}),te=Y.extend({implicit:[V,W],explicit:[K,Z,X,ee]}),ne=Object.prototype.hasOwnProperty,ie=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,oe=/[\x85\u2028\u2029]/,re=/[,\[\]\{\}]/,ae=/^(?:!|!!|![a-z\-]+!)$/i,le=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function se(e){return Object.prototype.toString.call(e)}function ce(e){return 10===e||13===e}function ue(e){return 9===e||32===e}function pe(e){return 9===e||32===e||10===e||13===e}function fe(e){return 44===e||91===e||93===e||123===e||125===e}function de(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function he(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"
":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function ge(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}for(var me=new Array(256),ye=new Array(256),be=0;be<256;be++)me[be]=he(be)?1:0,ye[be]=he(be);function ve(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||te,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function Ae(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,i=/\r?\n|\r|\0/g,o=[0],r=[],a=-1;n=i.exec(e.buffer);)r.push(n.index),o.push(n.index+n[0].length),e.position<=n.index&&a<0&&(a=o.length-2);a<0&&(a=o.length-1);var l,s,c="",u=Math.min(e.line+t.linesAfter,r.length).toString().length,p=t.maxLength-(t.indent+u+3);for(l=1;l<=t.linesBefore&&!(a-l<0);l++)s=A(e.buffer,o[a-l],r[a-l],e.position-(o[a]-o[a-l]),p),c=m.repeat(" ",t.indent)+w((e.line-l+1).toString(),u)+" | "+s.str+"\n"+c;for(s=A(e.buffer,o[a],r[a],e.position,p),c+=m.repeat(" ",t.indent)+w((e.line+1).toString(),u)+" | "+s.str+"\n",c+=m.repeat("-",t.indent+u+3+s.pos)+"^\n",l=1;l<=t.linesAfter&&!(a+l>=r.length);l++)s=A(e.buffer,o[a+l],r[a+l],e.position-(o[a]-o[a+l]),p),c+=m.repeat(" ",t.indent)+w((e.line+l+1).toString(),u)+" | "+s.str+"\n";return c.replace(/\n$/,"")}(n),new v(t,n)}function we(e,t){throw Ae(e,t)}function ke(e,t){e.onWarning&&e.onWarning.call(null,Ae(e,t))}var xe={YAML:function(e,t,n){var i,o,r;null!==e.version&&we(e,"duplication of %YAML directive"),1!==n.length&&we(e,"YAML directive accepts exactly one argument"),null===(i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&we(e,"ill-formed argument of the YAML directive"),o=parseInt(i[1],10),r=parseInt(i[2],10),1!==o&&we(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=r<2,1!==r&&2!==r&&ke(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var i,o;2!==n.length&&we(e,"TAG directive accepts exactly two arguments"),i=n[0],o=n[1],ae.test(i)||we(e,"ill-formed tag handle (first argument) of the TAG directive"),ne.call(e.tagMap,i)&&we(e,'there is a previously declared suffix for "'+i+'" tag handle'),le.test(o)||we(e,"ill-formed tag prefix (second argument) of the TAG directive");try{o=decodeURIComponent(o)}catch(t){we(e,"tag prefix is malformed: "+o)}e.tagMap[i]=o}};function Ce(e,t,n,i){var o,r,a,l;if(t<n){if(l=e.input.slice(t,n),i)for(o=0,r=l.length;o<r;o+=1)9===(a=l.charCodeAt(o))||32<=a&&a<=1114111||we(e,"expected valid JSON character");else ie.test(l)&&we(e,"the stream contains non-printable characters");e.result+=l}}function Oe(e,t,n,i){var o,r,a,l;for(m.isObject(n)||we(e,"cannot merge mappings; the provided source object is unacceptable"),a=0,l=(o=Object.keys(n)).length;a<l;a+=1)r=o[a],ne.call(t,r)||(t[r]=n[r],i[r]=!0)}function Se(e,t,n,i,o,r,a,l,s){var c,u;if(Array.isArray(o))for(c=0,u=(o=Array.prototype.slice.call(o)).length;c<u;c+=1)Array.isArray(o[c])&&we(e,"nested arrays are not supported inside keys"),"object"==typeof o&&"[object Object]"===se(o[c])&&(o[c]="[object Object]");if("object"==typeof o&&"[object Object]"===se(o)&&(o="[object Object]"),o=String(o),null===t&&(t={}),"tag:yaml.org,2002:merge"===i)if(Array.isArray(r))for(c=0,u=r.length;c<u;c+=1)Oe(e,t,r[c],n);else Oe(e,t,r,n);else e.json||ne.call(n,o)||!ne.call(t,o)||(e.line=a||e.line,e.lineStart=l||e.lineStart,e.position=s||e.position,we(e,"duplicated mapping key")),"__proto__"===o?Object.defineProperty(t,o,{configurable:!0,enumerable:!0,writable:!0,value:r}):t[o]=r,delete n[o];return t}function je(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):we(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function Ie(e,t,n){for(var i=0,o=e.input.charCodeAt(e.position);0!==o;){for(;ue(o);)9===o&&-1===e.firstTabInLine&&(e.firstTabInLine=e.position),o=e.input.charCodeAt(++e.position);if(t&&35===o)do{o=e.input.charCodeAt(++e.position)}while(10!==o&&13!==o&&0!==o);if(!ce(o))break;for(je(e),o=e.input.charCodeAt(e.position),i++,e.lineIndent=0;32===o;)e.lineIndent++,o=e.input.charCodeAt(++e.position)}return-1!==n&&0!==i&&e.lineIndent<n&&ke(e,"deficient indentation"),i}function _e(e){var t,n=e.position;return!(45!==(t=e.input.charCodeAt(n))&&46!==t||t!==e.input.charCodeAt(n+1)||t!==e.input.charCodeAt(n+2)||(n+=3,0!==(t=e.input.charCodeAt(n))&&!pe(t)))}function Te(e,t){1===t?e.result+=" ":t>1&&(e.result+=m.repeat("\n",t-1))}function Ee(e,t){var n,i,o=e.tag,r=e.anchor,a=[],l=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),i=e.input.charCodeAt(e.position);0!==i&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,we(e,"tab characters must not be used in indentation")),45===i)&&pe(e.input.charCodeAt(e.position+1));)if(l=!0,e.position++,Ie(e,!0,-1)&&e.lineIndent<=t)a.push(null),i=e.input.charCodeAt(e.position);else if(n=e.line,Fe(e,t,3,!1,!0),a.push(e.result),Ie(e,!0,-1),i=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==i)we(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break;return!!l&&(e.tag=o,e.anchor=r,e.kind="sequence",e.result=a,!0)}function Ne(e){var t,n,i,o,r=!1,a=!1;if(33!==(o=e.input.charCodeAt(e.position)))return!1;if(null!==e.tag&&we(e,"duplication of a tag property"),60===(o=e.input.charCodeAt(++e.position))?(r=!0,o=e.input.charCodeAt(++e.position)):33===o?(a=!0,n="!!",o=e.input.charCodeAt(++e.position)):n="!",t=e.position,r){do{o=e.input.charCodeAt(++e.position)}while(0!==o&&62!==o);e.position<e.length?(i=e.input.slice(t,e.position),o=e.input.charCodeAt(++e.position)):we(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==o&&!pe(o);)33===o&&(a?we(e,"tag suffix cannot contain exclamation marks"):(n=e.input.slice(t-1,e.position+1),ae.test(n)||we(e,"named tag handle cannot contain such characters"),a=!0,t=e.position+1)),o=e.input.charCodeAt(++e.position);i=e.input.slice(t,e.position),re.test(i)&&we(e,"tag suffix cannot contain flow indicator characters")}i&&!le.test(i)&&we(e,"tag name cannot contain such characters: "+i);try{i=decodeURIComponent(i)}catch(t){we(e,"tag name is malformed: "+i)}return r?e.tag=i:ne.call(e.tagMap,n)?e.tag=e.tagMap[n]+i:"!"===n?e.tag="!"+i:"!!"===n?e.tag="tag:yaml.org,2002:"+i:we(e,'undeclared tag handle "'+n+'"'),!0}function Le(e){var t,n;if(38!==(n=e.input.charCodeAt(e.position)))return!1;for(null!==e.anchor&&we(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!pe(n)&&!fe(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&we(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function Fe(e,t,n,i,o){var r,a,l,s,c,u,p,f,d,h=1,g=!1,y=!1;if(null!==e.listener&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,r=a=l=4===n||3===n,i&&Ie(e,!0,-1)&&(g=!0,e.lineIndent>t?h=1:e.lineIndent===t?h=0:e.lineIndent<t&&(h=-1)),1===h)for(;Ne(e)||Le(e);)Ie(e,!0,-1)?(g=!0,l=r,e.lineIndent>t?h=1:e.lineIndent===t?h=0:e.lineIndent<t&&(h=-1)):l=!1;if(l&&(l=g||o),1!==h&&4!==n||(f=1===n||2===n?t:t+1,d=e.position-e.lineStart,1===h?l&&(Ee(e,d)||function(e,t,n){var i,o,r,a,l,s,c,u=e.tag,p=e.anchor,f={},d=Object.create(null),h=null,g=null,m=null,y=!1,b=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=f),c=e.input.charCodeAt(e.position);0!==c;){if(y||-1===e.firstTabInLine||(e.position=e.firstTabInLine,we(e,"tab characters must not be used in indentation")),i=e.input.charCodeAt(e.position+1),r=e.line,63!==c&&58!==c||!pe(i)){if(a=e.line,l=e.lineStart,s=e.position,!Fe(e,n,2,!1,!0))break;if(e.line===r){for(c=e.input.charCodeAt(e.position);ue(c);)c=e.input.charCodeAt(++e.position);if(58===c)pe(c=e.input.charCodeAt(++e.position))||we(e,"a whitespace character is expected after the key-value separator within a block mapping"),y&&(Se(e,f,d,h,g,null,a,l,s),h=g=m=null),b=!0,y=!1,o=!1,h=e.tag,g=e.result;else{if(!b)return e.tag=u,e.anchor=p,!0;we(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!b)return e.tag=u,e.anchor=p,!0;we(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===c?(y&&(Se(e,f,d,h,g,null,a,l,s),h=g=m=null),b=!0,y=!0,o=!0):y?(y=!1,o=!0):we(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,c=i;if((e.line===r||e.lineIndent>t)&&(y&&(a=e.line,l=e.lineStart,s=e.position),Fe(e,t,4,!0,o)&&(y?g=e.result:m=e.result),y||(Se(e,f,d,h,g,m,a,l,s),h=g=m=null),Ie(e,!0,-1),c=e.input.charCodeAt(e.position)),(e.line===r||e.lineIndent>t)&&0!==c)we(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return y&&Se(e,f,d,h,g,null,a,l,s),b&&(e.tag=u,e.anchor=p,e.kind="mapping",e.result=f),b}(e,d,f))||function(e,t){var n,i,o,r,a,l,s,c,u,p,f,d,h=!0,g=e.tag,m=e.anchor,y=Object.create(null);if(91===(d=e.input.charCodeAt(e.position)))a=93,c=!1,r=[];else{if(123!==d)return!1;a=125,c=!0,r={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=r),d=e.input.charCodeAt(++e.position);0!==d;){if(Ie(e,!0,t),(d=e.input.charCodeAt(e.position))===a)return e.position++,e.tag=g,e.anchor=m,e.kind=c?"mapping":"sequence",e.result=r,!0;h?44===d&&we(e,"expected the node content, but found ','"):we(e,"missed comma between flow collection entries"),f=null,l=s=!1,63===d&&pe(e.input.charCodeAt(e.position+1))&&(l=s=!0,e.position++,Ie(e,!0,t)),n=e.line,i=e.lineStart,o=e.position,Fe(e,t,1,!1,!0),p=e.tag,u=e.result,Ie(e,!0,t),d=e.input.charCodeAt(e.position),!s&&e.line!==n||58!==d||(l=!0,d=e.input.charCodeAt(++e.position),Ie(e,!0,t),Fe(e,t,1,!1,!0),f=e.result),c?Se(e,r,y,p,u,f,n,i,o):l?r.push(Se(e,null,y,p,u,f,n,i,o)):r.push(u),Ie(e,!0,t),44===(d=e.input.charCodeAt(e.position))?(h=!0,d=e.input.charCodeAt(++e.position)):h=!1}we(e,"unexpected end of the stream within a flow collection")}(e,f)?y=!0:(a&&function(e,t){var n,i,o,r,a,l=1,s=!1,c=!1,u=t,p=0,f=!1;if(124===(r=e.input.charCodeAt(e.position)))i=!1;else{if(62!==r)return!1;i=!0}for(e.kind="scalar",e.result="";0!==r;)if(43===(r=e.input.charCodeAt(++e.position))||45===r)1===l?l=43===r?3:2:we(e,"repeat of a chomping mode identifier");else{if(!((o=48<=(a=r)&&a<=57?a-48:-1)>=0))break;0===o?we(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?we(e,"repeat of an indentation width identifier"):(u=t+o-1,c=!0)}if(ue(r)){do{r=e.input.charCodeAt(++e.position)}while(ue(r));if(35===r)do{r=e.input.charCodeAt(++e.position)}while(!ce(r)&&0!==r)}for(;0!==r;){for(je(e),e.lineIndent=0,r=e.input.charCodeAt(e.position);(!c||e.lineIndent<u)&&32===r;)e.lineIndent++,r=e.input.charCodeAt(++e.position);if(!c&&e.lineIndent>u&&(u=e.lineIndent),ce(r))p++;else{if(e.lineIndent<u){3===l?e.result+=m.repeat("\n",s?1+p:p):1===l&&s&&(e.result+="\n");break}for(i?ue(r)?(f=!0,e.result+=m.repeat("\n",s?1+p:p)):f?(f=!1,e.result+=m.repeat("\n",p+1)):0===p?s&&(e.result+=" "):e.result+=m.repeat("\n",p):e.result+=m.repeat("\n",s?1+p:p),s=!0,c=!0,p=0,n=e.position;!ce(r)&&0!==r;)r=e.input.charCodeAt(++e.position);Ce(e,n,e.position,!1)}}return!0}(e,f)||function(e,t){var n,i,o;if(39!==(n=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,i=o=e.position;0!==(n=e.input.charCodeAt(e.position));)if(39===n){if(Ce(e,i,e.position,!0),39!==(n=e.input.charCodeAt(++e.position)))return!0;i=e.position,e.position++,o=e.position}else ce(n)?(Ce(e,i,o,!0),Te(e,Ie(e,!1,t)),i=o=e.position):e.position===e.lineStart&&_e(e)?we(e,"unexpected end of the document within a single quoted scalar"):(e.position++,o=e.position);we(e,"unexpected end of the stream within a single quoted scalar")}(e,f)||function(e,t){var n,i,o,r,a,l,s;if(34!==(l=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,n=i=e.position;0!==(l=e.input.charCodeAt(e.position));){if(34===l)return Ce(e,n,e.position,!0),e.position++,!0;if(92===l){if(Ce(e,n,e.position,!0),ce(l=e.input.charCodeAt(++e.position)))Ie(e,!1,t);else if(l<256&&me[l])e.result+=ye[l],e.position++;else if((a=120===(s=l)?2:117===s?4:85===s?8:0)>0){for(o=a,r=0;o>0;o--)(a=de(l=e.input.charCodeAt(++e.position)))>=0?r=(r<<4)+a:we(e,"expected hexadecimal character");e.result+=ge(r),e.position++}else we(e,"unknown escape sequence");n=i=e.position}else ce(l)?(Ce(e,n,i,!0),Te(e,Ie(e,!1,t)),n=i=e.position):e.position===e.lineStart&&_e(e)?we(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}we(e,"unexpected end of the stream within a double quoted scalar")}(e,f)?y=!0:function(e){var t,n,i;if(42!==(i=e.input.charCodeAt(e.position)))return!1;for(i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!pe(i)&&!fe(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&we(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),ne.call(e.anchorMap,n)||we(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],Ie(e,!0,-1),!0}(e)?(y=!0,null===e.tag&&null===e.anchor||we(e,"alias node should not have any properties")):function(e,t,n){var i,o,r,a,l,s,c,u,p=e.kind,f=e.result;if(pe(u=e.input.charCodeAt(e.position))||fe(u)||35===u||38===u||42===u||33===u||124===u||62===u||39===u||34===u||37===u||64===u||96===u)return!1;if((63===u||45===u)&&(pe(i=e.input.charCodeAt(e.position+1))||n&&fe(i)))return!1;for(e.kind="scalar",e.result="",o=r=e.position,a=!1;0!==u;){if(58===u){if(pe(i=e.input.charCodeAt(e.position+1))||n&&fe(i))break}else if(35===u){if(pe(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&_e(e)||n&&fe(u))break;if(ce(u)){if(l=e.line,s=e.lineStart,c=e.lineIndent,Ie(e,!1,-1),e.lineIndent>=t){a=!0,u=e.input.charCodeAt(e.position);continue}e.position=r,e.line=l,e.lineStart=s,e.lineIndent=c;break}}a&&(Ce(e,o,r,!1),Te(e,e.line-l),o=r=e.position,a=!1),ue(u)||(r=e.position+1),u=e.input.charCodeAt(++e.position)}return Ce(e,o,r,!1),!!e.result||(e.kind=p,e.result=f,!1)}(e,f,1===n)&&(y=!0,null===e.tag&&(e.tag="?")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===h&&(y=l&&Ee(e,d))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&we(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),s=0,c=e.implicitTypes.length;s<c;s+=1)if((p=e.implicitTypes[s]).resolve(e.result)){e.result=p.construct(e.result),e.tag=p.tag,null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);break}}else if("!"!==e.tag){if(ne.call(e.typeMap[e.kind||"fallback"],e.tag))p=e.typeMap[e.kind||"fallback"][e.tag];else for(p=null,s=0,c=(u=e.typeMap.multi[e.kind||"fallback"]).length;s<c;s+=1)if(e.tag.slice(0,u[s].tag.length)===u[s].tag){p=u[s];break}p||we(e,"unknown tag !<"+e.tag+">"),null!==e.result&&p.kind!==e.kind&&we(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+p.kind+'", not "'+e.kind+'"'),p.resolve(e.result,e.tag)?(e.result=p.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):we(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||y}function Me(e){var t,n,i,o,r=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(o=e.input.charCodeAt(e.position))&&(Ie(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==o));){for(a=!0,o=e.input.charCodeAt(++e.position),t=e.position;0!==o&&!pe(o);)o=e.input.charCodeAt(++e.position);for(i=[],(n=e.input.slice(t,e.position)).length<1&&we(e,"directive name must not be less than one character in length");0!==o;){for(;ue(o);)o=e.input.charCodeAt(++e.position);if(35===o){do{o=e.input.charCodeAt(++e.position)}while(0!==o&&!ce(o));break}if(ce(o))break;for(t=e.position;0!==o&&!pe(o);)o=e.input.charCodeAt(++e.position);i.push(e.input.slice(t,e.position))}0!==o&&je(e),ne.call(xe,n)?xe[n](e,n,i):ke(e,'unknown document directive "'+n+'"')}Ie(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,Ie(e,!0,-1)):a&&we(e,"directives end mark is expected"),Fe(e,e.lineIndent-1,4,!1,!0),Ie(e,!0,-1),e.checkLineBreaks&&oe.test(e.input.slice(r,e.position))&&ke(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&_e(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,Ie(e,!0,-1)):e.position<e.length-1&&we(e,"end of the stream or a document separator is expected")}function $e(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var n=new ve(e,t),i=e.indexOf("\0");for(-1!==i&&(n.position=i,we(n,"null byte is not allowed in input")),n.input+="\0";32===n.input.charCodeAt(n.position);)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)Me(n);return n.documents}var De={loadAll:function(e,t,n){null!==t&&"object"==typeof t&&void 0===n&&(n=t,t=null);var i=$e(e,n);if("function"!=typeof t)return i;for(var o=0,r=i.length;o<r;o+=1)t(i[o])},load:function(e,t){var n=$e(e,t);if(0!==n.length){if(1===n.length)return n[0];throw new v("expected a single document in the stream, but found more")}}},Re=Object.prototype.toString,Ue=Object.prototype.hasOwnProperty,qe=65279,Ye={0:"\\0",7:"\\a",8:"\\b",9:"\\t",10:"\\n",11:"\\v",12:"\\f",13:"\\r",27:"\\e",34:'\\"',92:"\\\\",133:"\\N",160:"\\_",8232:"\\L",8233:"\\P"},Be=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],Pe=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Ve(e){var t,n,i;if(t=e.toString(16).toUpperCase(),e<=255)n="x",i=2;else if(e<=65535)n="u",i=4;else{if(!(e<=4294967295))throw new v("code point within a string may not be greater than 0xFFFFFFFF");n="U",i=8}return"\\"+n+m.repeat("0",i-t.length)+t}function We(e){this.schema=e.schema||te,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=m.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=function(e,t){var n,i,o,r,a,l,s;if(null===t)return{};for(n={},o=0,r=(i=Object.keys(t)).length;o<r;o+=1)a=i[o],l=String(t[a]),"!!"===a.slice(0,2)&&(a="tag:yaml.org,2002:"+a.slice(2)),(s=e.compiledTypeMap.fallback[a])&&Ue.call(s.styleAliases,l)&&(l=s.styleAliases[l]),n[a]=l;return n}(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType='"'===e.quotingType?2:1,this.forceQuotes=e.forceQuotes||!1,this.replacer="function"==typeof e.replacer?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Ge(e,t){for(var n,i=m.repeat(" ",t),o=0,r=-1,a="",l=e.length;o<l;)-1===(r=e.indexOf("\n",o))?(n=e.slice(o),o=l):(n=e.slice(o,r+1),o=r+1),n.length&&"\n"!==n&&(a+=i),a+=n;return a}function Ke(e,t){return"\n"+m.repeat(" ",e.indent*t)}function He(e){return 32===e||9===e}function Je(e){return 32<=e&&e<=126||161<=e&&e<=55295&&8232!==e&&8233!==e||57344<=e&&e<=65533&&e!==qe||65536<=e&&e<=1114111}function Ze(e){return Je(e)&&e!==qe&&13!==e&&10!==e}function ze(e,t,n){var i=Ze(e),o=i&&!He(e);return(n?i:i&&44!==e&&91!==e&&93!==e&&123!==e&&125!==e)&&35!==e&&!(58===t&&!o)||Ze(t)&&!He(t)&&35===e||58===t&&o}function Xe(e,t){var n,i=e.charCodeAt(t);return i>=55296&&i<=56319&&t+1<e.length&&(n=e.charCodeAt(t+1))>=56320&&n<=57343?1024*(i-55296)+n-56320+65536:i}function Qe(e){return/^\n* /.test(e)}function et(e,t,n,i,o){e.dump=function(){if(0===t.length)return 2===e.quotingType?'""':"''";if(!e.noCompatMode&&(-1!==Be.indexOf(t)||Pe.test(t)))return 2===e.quotingType?'"'+t+'"':"'"+t+"'";var r=e.indent*Math.max(1,n),a=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-r),l=i||e.flowLevel>-1&&n>=e.flowLevel;switch(function(e,t,n,i,o,r,a,l){var s,c,u=0,p=null,f=!1,d=!1,h=-1!==i,g=-1,m=Je(c=Xe(e,0))&&c!==qe&&!He(c)&&45!==c&&63!==c&&58!==c&&44!==c&&91!==c&&93!==c&&123!==c&&125!==c&&35!==c&&38!==c&&42!==c&&33!==c&&124!==c&&61!==c&&62!==c&&39!==c&&34!==c&&37!==c&&64!==c&&96!==c&&function(e){return!He(e)&&58!==e}(Xe(e,e.length-1));if(t||a)for(s=0;s<e.length;u>=65536?s+=2:s++){if(!Je(u=Xe(e,s)))return 5;m=m&&ze(u,p,l),p=u}else{for(s=0;s<e.length;u>=65536?s+=2:s++){if(10===(u=Xe(e,s)))f=!0,h&&(d=d||s-g-1>i&&" "!==e[g+1],g=s);else if(!Je(u))return 5;m=m&&ze(u,p,l),p=u}d=d||h&&s-g-1>i&&" "!==e[g+1]}return f||d?n>9&&Qe(e)?5:a?2===r?5:2:d?4:3:!m||a||o(e)?2===r?5:2:1}(t,l,e.indent,a,(function(t){return function(e,t){var n,i;for(n=0,i=e.implicitTypes.length;n<i;n+=1)if(e.implicitTypes[n].resolve(t))return!0;return!1}(e,t)}),e.quotingType,e.forceQuotes&&!i,o)){case 1:return t;case 2:return"'"+t.replace(/'/g,"''")+"'";case 3:return"|"+tt(t,e.indent)+nt(Ge(t,r));case 4:return">"+tt(t,e.indent)+nt(Ge(function(e,t){for(var n,i,o,r=/(\n+)([^\n]*)/g,a=(o=-1!==(o=e.indexOf("\n"))?o:e.length,r.lastIndex=o,it(e.slice(0,o),t)),l="\n"===e[0]||" "===e[0];i=r.exec(e);){var s=i[1],c=i[2];n=" "===c[0],a+=s+(l||n||""===c?"":"\n")+it(c,t),l=n}return a}(t,a),r));case 5:return'"'+function(e){for(var t,n="",i=0,o=0;o<e.length;i>=65536?o+=2:o++)i=Xe(e,o),!(t=Ye[i])&&Je(i)?(n+=e[o],i>=65536&&(n+=e[o+1])):n+=t||Ve(i);return n}(t)+'"';default:throw new v("impossible error: invalid scalar style")}}()}function tt(e,t){var n=Qe(e)?String(t):"",i="\n"===e[e.length-1];return n+(!i||"\n"!==e[e.length-2]&&"\n"!==e?i?"":"-":"+")+"\n"}function nt(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function it(e,t){if(""===e||" "===e[0])return e;for(var n,i,o=/ [^ ]/g,r=0,a=0,l=0,s="";n=o.exec(e);)(l=n.index)-r>t&&(i=a>r?a:l,s+="\n"+e.slice(r,i),r=i+1),a=l;return s+="\n",e.length-r>t&&a>r?s+=e.slice(r,a)+"\n"+e.slice(a+1):s+=e.slice(r),s.slice(1)}function ot(e,t,n,i){var o,r,a,l="",s=e.tag;for(o=0,r=n.length;o<r;o+=1)a=n[o],e.replacer&&(a=e.replacer.call(n,String(o),a)),(at(e,t+1,a,!0,!0,!1,!0)||void 0===a&&at(e,t+1,null,!0,!0,!1,!0))&&(i&&""===l||(l+=Ke(e,t)),e.dump&&10===e.dump.charCodeAt(0)?l+="-":l+="- ",l+=e.dump);e.tag=s,e.dump=l||"[]"}function rt(e,t,n){var i,o,r,a,l,s;for(r=0,a=(o=n?e.explicitTypes:e.implicitTypes).length;r<a;r+=1)if(((l=o[r]).instanceOf||l.predicate)&&(!l.instanceOf||"object"==typeof t&&t instanceof l.instanceOf)&&(!l.predicate||l.predicate(t))){if(n?l.multi&&l.representName?e.tag=l.representName(t):e.tag=l.tag:e.tag="?",l.represent){if(s=e.styleMap[l.tag]||l.defaultStyle,"[object Function]"===Re.call(l.represent))i=l.represent(t,s);else{if(!Ue.call(l.represent,s))throw new v("!<"+l.tag+'> tag resolver accepts not "'+s+'" style');i=l.represent[s](t,s)}e.dump=i}return!0}return!1}function at(e,t,n,i,o,r,a){e.tag=null,e.dump=n,rt(e,n,!1)||rt(e,n,!0);var l,s=Re.call(e.dump),c=i;i&&(i=e.flowLevel<0||e.flowLevel>t);var u,p,f="[object Object]"===s||"[object Array]"===s;if(f&&(p=-1!==(u=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||p||2!==e.indent&&t>0)&&(o=!1),p&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(f&&p&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),"[object Object]"===s)i&&0!==Object.keys(e.dump).length?(function(e,t,n,i){var o,r,a,l,s,c,u="",p=e.tag,f=Object.keys(n);if(!0===e.sortKeys)f.sort();else if("function"==typeof e.sortKeys)f.sort(e.sortKeys);else if(e.sortKeys)throw new v("sortKeys must be a boolean or a function");for(o=0,r=f.length;o<r;o+=1)c="",i&&""===u||(c+=Ke(e,t)),l=n[a=f[o]],e.replacer&&(l=e.replacer.call(n,a,l)),at(e,t+1,a,!0,!0,!0)&&((s=null!==e.tag&&"?"!==e.tag||e.dump&&e.dump.length>1024)&&(e.dump&&10===e.dump.charCodeAt(0)?c+="?":c+="? "),c+=e.dump,s&&(c+=Ke(e,t)),at(e,t+1,l,!0,s)&&(e.dump&&10===e.dump.charCodeAt(0)?c+=":":c+=": ",u+=c+=e.dump));e.tag=p,e.dump=u||"{}"}(e,t,e.dump,o),p&&(e.dump="&ref_"+u+e.dump)):(function(e,t,n){var i,o,r,a,l,s="",c=e.tag,u=Object.keys(n);for(i=0,o=u.length;i<o;i+=1)l="",""!==s&&(l+=", "),e.condenseFlow&&(l+='"'),a=n[r=u[i]],e.replacer&&(a=e.replacer.call(n,r,a)),at(e,t,r,!1,!1)&&(e.dump.length>1024&&(l+="? "),l+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),at(e,t,a,!1,!1)&&(s+=l+=e.dump));e.tag=c,e.dump="{"+s+"}"}(e,t,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump));else if("[object Array]"===s)i&&0!==e.dump.length?(e.noArrayIndent&&!a&&t>0?ot(e,t-1,e.dump,o):ot(e,t,e.dump,o),p&&(e.dump="&ref_"+u+e.dump)):(function(e,t,n){var i,o,r,a="",l=e.tag;for(i=0,o=n.length;i<o;i+=1)r=n[i],e.replacer&&(r=e.replacer.call(n,String(i),r)),(at(e,t,r,!1,!1)||void 0===r&&at(e,t,null,!1,!1))&&(""!==a&&(a+=","+(e.condenseFlow?"":" ")),a+=e.dump);e.tag=l,e.dump="["+a+"]"}(e,t,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump));else{if("[object String]"!==s){if("[object Undefined]"===s)return!1;if(e.skipInvalid)return!1;throw new v("unacceptable kind of an object to dump "+s)}"?"!==e.tag&&et(e,e.dump,t,r,c)}null!==e.tag&&"?"!==e.tag&&(l=encodeURI("!"===e.tag[0]?e.tag.slice(1):e.tag).replace(/!/g,"%21"),l="!"===e.tag[0]?"!"+l:"tag:yaml.org,2002:"===l.slice(0,18)?"!!"+l.slice(18):"!<"+l+">",e.dump=l+" "+e.dump)}return!0}function lt(e,t){var n,i,o=[],r=[];for(st(e,o,r),n=0,i=r.length;n<i;n+=1)t.duplicates.push(o[r[n]]);t.usedDuplicates=new Array(i)}function st(e,t,n){var i,o,r;if(null!==e&&"object"==typeof e)if(-1!==(o=t.indexOf(e)))-1===n.indexOf(o)&&n.push(o);else if(t.push(e),Array.isArray(e))for(o=0,r=e.length;o<r;o+=1)st(e[o],t,n);else for(o=0,r=(i=Object.keys(e)).length;o<r;o+=1)st(e[i[o]],t,n)}function ct(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}const ut={Type:C,Schema:j,FAILSAFE_SCHEMA:E,JSON_SCHEMA:q,CORE_SCHEMA:Y,DEFAULT_SCHEMA:te,load:De.load,loadAll:De.loadAll,dump:function(e,t){var n=new We(t=t||{});n.noRefs||lt(e,n);var i=e;return n.replacer&&(i=n.replacer.call({"":i},"",i)),at(n,0,i,!0,!0)?n.dump+"\n":""},YAMLException:v,types:{binary:K,float:U,map:T,null:N,pairs:X,set:ee,timestamp:V,bool:L,int:$,merge:W,omap:Z,seq:_,str:I},safeLoad:ct("safeLoad","load"),safeLoadAll:ct("safeLoadAll","loadAll"),safeDump:ct("safeDump","dump")};var pt;function ft(e,t){return"function"==typeof t?t.toString():["",null].includes(t)||"object"==typeof t&&(0===t.length||0===Object.keys(t).length)?void 0:t}function dt(e){const t={get(e,t,n){const i=Reflect.get(e,t,n);return"object"==typeof i&&null!==i?Array.isArray(i)?i.map((e=>dt(e))):dt(i):`{${t}}`}};return Array.isArray(e)?e.map((e=>dt(e))):new Proxy(e,t)}function ht(e){let t;if("object"==typeof e.state){const n=dt(e.state);t=e.view(n)}else t=e.view(e.state);return t}function gt(e){const t=window.open("","_apprun_debug","toolbar=0");t.document.write(`<html>\n <title>AppRun Analyzer | ${document.location.href}</title>\n <style>\n body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI" }\n li { margin-left: 80px; }\n </style>\n <body>\n <div id="main">${e}</div>\n <\/script>\n </body>\n </html>`),t.document.close()}i.A.debug=!0,window["_apprun-help"]=["",()=>{Object.keys(window).forEach((e=>{e.startsWith("_apprun-")&&("_apprun-help"===e?console.log("AppRun Commands:"):console.log(`* ${e.substring(8)}: ${window[e][0]}`))}))}];const mt=()=>{const e={components:{}};i.A.run("get-components",e);const{components:t}=e;return t};let yt=Number(null===(pt=null===window||void 0===window?void 0:window.localStorage)||void 0===pt?void 0:pt.getItem("__apprun_debugging__"))||0;if(i.A.on("debug",(e=>{1&yt&&e.event&&console.log(e),2&yt&&e.vdom&&console.log(e)})),window["_apprun-components"]=["components [print]",e=>{(e=>{const t=mt(),n=[];if(t instanceof Map)for(let[e,i]of t){const t="string"==typeof e?document.getElementById(e)||document.querySelector(e):e;n.push({element:t,comps:i})}else Object.keys(t).forEach((e=>{const i="string"==typeof e?document.getElementById(e)||document.querySelector(e):e;n.push({element:i,comps:t[e]})}));if(e){const e=(e=>{const t=({components:e})=>i.A.h("ul",null,e.map((e=>{const t=ht(e),n=e._actions.map((e=>e.name)),o={state:e.state,view:t,actions:n,update:e.update};return i.A.h("li",null,i.A.h("div",null,e.constructor.name),i.A.h("div",null,i.A.h("pre",null,(r=ut.dump(o,{replacer:ft}))?r.toString().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"):r)),i.A.h("br",null));var r})));return i.A.h("ul",null,e.map((({element:e,comps:n})=>i.A.h("li",null,i.A.h("div",null,(e=>i.A.h("div",null,e.tagName.toLowerCase(),e.id?"#"+e.id:""," ",e.className&&e.className.split(" ").map((e=>"."+e)).join()))(e)),i.A.h(t,{components:n})))))})(n);gt(l(e))}else n.forEach((({element:e,comps:t})=>console.log(e,t)))})("print"===e)}],window["_apprun-events"]=["events [print]",e=>{(e=>{const t=i.A._events,n={},o=mt(),r=e=>e._actions.forEach((t=>{n[t.name]=n[t.name]||[],n[t.name].push(e)}));if(o instanceof Map)for(let[e,t]of o)t.forEach(r);else Object.keys(o).forEach((e=>o[e].forEach(r)));const a=[];if(Object.keys(n).forEach((e=>{a.push({event:e,components:n[e],global:!!t[e]})})),a.sort(((e,t)=>e.event>t.event?1:-1)).map((e=>e.event)),e){const e=(e=>{const t=({components:e})=>i.A.h("ul",null,e.map((e=>i.A.h("li",null,i.A.h("div",null,e.constructor.name))))),n=({events:e,global:n})=>i.A.h("ul",null,e&&e.filter((e=>e.global===n&&"."!==e.event)).map((({event:e,components:n})=>i.A.h("li",null,i.A.h("div",null,e),i.A.h(t,{components:n})))));return i.A.h("div",null,i.A.h("div",null,"GLOBAL EVENTS"),i.A.h(n,{events:e,global:!0}),i.A.h("div",null,"LOCAL EVENTS"),i.A.h(n,{events:e,global:!1}))})(a);gt(l(e))}else console.log("=== GLOBAL EVENTS ==="),a.filter((e=>e.global&&"."!==e.event)).forEach((({event:e,components:t})=>console.log({event:e},t))),console.log("=== LOCAL EVENTS ==="),a.filter((e=>!e.global&&"."!==e.event)).forEach((({event:e,components:t})=>console.log({event:e},t)))})("print"===e)}],window["_apprun-log"]=["log [event|view] on|off",(e,t)=>{var n;"on"===e?yt=3:"off"===e?yt=0:"event"===e?"on"===t?yt|=1:"off"===t&&(yt&=-2):"view"===e&&("on"===t?yt|=2:"off"===t&&(yt&=-3)),console.log(`* log ${e} ${t||""}`),null===(n=null===window||void 0===window?void 0:window.localStorage)||void 0===n||n.setItem("__apprun_debugging__",`${yt}`)}],window["_apprun-create-event-tests"]=["create-event-tests",()=>(()=>{const e={components:{}};app.run("get-components",e);const{components:t}=e;if(c(""),t instanceof Map)for(let[e,n]of t)n.forEach(f);else Object.keys(t).forEach((e=>{t[e].forEach(f)}));p()})()],window["_apprun-create-state-tests"]=["create-state-tests <start|stop>",e=>{var t;"start"===(t=e)?(h=[],d=!0,console.log("* State logging started.")):"stop"===t?(0!==h.length?(c(""),h.forEach(((e,t)=>{u(` it ('view snapshot: #${t+1}', ()=>{`),u(` const component = new ${e.component.constructor.name}()`),u(` const state = ${JSON.stringify(e.state,void 0,2)};`),u(" const vdom = component['view'](state);"),u(" expect(JSON.stringify(vdom)).toMatchSnapshot();"),u(" })")})),p()):console.log("* No state recorded."),d=!1,h=[],console.log("* State logging stopped.")):console.log("create-state-tests <start|stop>")}],window._apprun=e=>{const[t,...n]=e[0].split(" ").filter((e=>!!e)),i=window[`_apprun-${t}`];i?i[1](...n):window["_apprun-help"][1]()},console.info('AppRun DevTools 2.27: type "_apprun `help`" to list all available commands.'),window.__REDUX_DEVTOOLS_EXTENSION__){let e=!1;const t=window.__REDUX_DEVTOOLS_EXTENSION__.connect();if(t){const n=location.hash||"#";t.send(n,"");const o=[{component:null,state:""}];console.info("Connected to the Redux DevTools"),t.subscribe((t=>{if("START"===t.type)e=!0;else if("STOP"===t.type)e=!1;else if("DISPATCH"===t.type){const e=t.payload.index;if(0===e)i.A.run(n);else{const{component:t,state:n}=o[e];null==t||t.setState(n)}}}));const r=(e,n,i)=>{null!=i&&(o.push({component:e,state:i}),t.send(n,i))};i.A.on("debug",(t=>{if(e&&t.event){const e=t.newState,n={type:t.event,payload:t.p},i=t.component;e instanceof Promise?e.then((e=>r(i,n,e))):r(i,n,e)}}))}}return{}})()));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.apprun=t():e.apprun=t()}(this,(()=>(()=>{"use strict";var e={859:(e,t,n)=>{n.d(t,{A:()=>l});var o=n(672);const s=o.C;let r;const c="undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};c.app&&c._AppRunVersions?r=c.app:(r=new class{constructor(){this._events={}}on(e,t,n={}){this._events[e]=this._events[e]||[],this._events[e].push({fn:t,options:n})}off(e,t){const n=this._events[e]||[];this._events[e]=n.filter((e=>e.fn!==t))}find(e){return this._events[e]}run(e,...t){const n=this.getSubscribers(e,this._events);return console.assert(n&&n.length>0,"No subscriber for event: "+e),n.forEach((n=>{const{fn:o,options:s}=n;if(!o||"function"!=typeof o)return console.error(`AppRun event handler for '${e}' is not a function:`,o),!1;if(s.delay)this.delay(e,o,t,s);else try{Object.keys(s).length>0?o.apply(this,[...t,s]):o.apply(this,t)}catch(t){console.error(`Error in event handler for '${e}':`,t)}return!n.options.once})),n.length}once(e,t,n={}){this.on(e,t,Object.assign(Object.assign({},n),{once:!0}))}delay(e,t,n,o){o._t&&clearTimeout(o._t),o._t=setTimeout((()=>{clearTimeout(o._t);try{Object.keys(o).length>0?t.apply(this,[...n,o]):t.apply(this,n)}catch(t){console.error(`Error in delayed event handler for '${e}':`,t)}}),o.delay)}runAsync(e,...t){const n=this.getSubscribers(e,this._events);console.assert(n&&n.length>0,"No subscriber for event: "+e);const o=n.map((n=>{const{fn:o,options:s}=n;if(!o||"function"!=typeof o)return console.error(`AppRun async event handler for '${e}' is not a function:`,o),Promise.resolve(null);try{return Object.keys(s).length>0?o.apply(this,[...t,s]):o.apply(this,t)}catch(t){return console.error(`Error in async event handler for '${e}':`,t),Promise.reject(t)}}));return Promise.all(o)}query(e,...t){return console.warn("app.query() is deprecated. Use app.runAsync() instead."),this.runAsync(e,...t)}getSubscribers(e,t){const n=t[e]||[];return t[e]=n.filter((e=>!e.options.once)),Object.keys(t).filter((t=>t.endsWith("*")&&e.startsWith(t.replace("*","")))).sort(((e,t)=>t.length-e.length)).forEach((o=>n.push(...t[o].map((t=>Object.assign(Object.assign({},t),{options:Object.assign(Object.assign({},t.options),{event:e})})))))),n}},c.app=r,c._AppRunVersions=s);const l=r},672:(e,t,n)=>{n.d(t,{C:()=>o});const o="AppRun-3.36.1"}},t={};function n(o){var s=t[o];if(void 0!==s)return s.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var o=n(859);function s(e){return e.map((e=>c(e))).join("")}function r(e){for(var t in e)null==e[t]?delete e[t]:"object"==typeof e[t]&&r(e[t])}function c(e){if(!e)return"";if(e._$litType$)return e.toString();if(r(e),Array.isArray(e))return s(e);if("string"==typeof e)return e.startsWith("_html:")?e.substring(6):e;if(e.tag){const t=e.props?function(e){return Object.keys(e).map((t=>{return` ${"className"===t?"class":t}="${n=e[t],"object"==typeof n?Object.keys(n).map((e=>`${e}:${n[e]}`)).join(";"):n.toString()}"`;var n})).join("")}(e.props):"",n=e.children?s(e.children):"";return`<${e.tag}${t}>${n}</${e.tag}>`}return"object"==typeof e?JSON.stringify(e):void 0}const l=c;let i;function a(e){i=window.open("",e),i.document.write(`<html>\n <title>AppRun Analyzer | ${document.location.href}</title>\n <style>\n body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI" }\n </style>\n <body><pre>`)}function p(e){i.document.write(e+"\n")}function u(){i.document.write("</pre>\n </body>\n </html>"),i.document.close()}app.debug=!0;const f=e=>{p(`import ${e.constructor.name} from '../src/${e.constructor.name}'`),p(`describe('${e.constructor.name}', ()=>{`),e._actions.forEach((t=>{"."!==t.name&&(p(` it ('should handle event: ${t.name}', (done)=>{`),p(` const component = new ${e.constructor.name}().mount();`),p(` component.run('${t.name}');`),p(" setTimeout(() => {"),p(" //expect(?).toHaveBeenCalled();"),p(" //expect(component.state).toBe(?);"),p(" done();"),p(" })"))})),p("});")};let d=!1,m=[];app.on("debug",(e=>{d&&e.vdom&&(m.push(e),console.log(`* ${m.length} state(s) recorded.`))}));var h;function g(e){const t={get(e,t,n){const o=Reflect.get(e,t,n);return"object"==typeof o&&null!==o?Array.isArray(o)?o.map((e=>g(e))):g(o):`{${t}}`}};return Array.isArray(e)?e.map((e=>g(e))):new Proxy(e,t)}function y(e){let t;if("object"==typeof e.state){const n=g(e.state);t=e.view(n)}else t=e.view(e.state);return t}function v(e){const t=window.open("","_apprun_debug","toolbar=0");t.document.write(`<html>\n <title>AppRun Analyzer | ${document.location.href}</title>\n <style>\n body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI" }\n li { margin-left: 80px; }\n </style>\n <body>\n <div id="main">${e}</div>\n <\/script>\n </body>\n </html>`),t.document.close()}o.A.debug=!0,window["_apprun-help"]=["",()=>{Object.keys(window).forEach((e=>{e.startsWith("_apprun-")&&("_apprun-help"===e?console.log("AppRun Commands:"):console.log(`* ${e.substring(8)}: ${window[e][0]}`))}))}];const b=()=>{const e={components:{}};o.A.run("get-components",e);const{components:t}=e;return t};let w=Number(null===(h=null===window||void 0===window?void 0:window.localStorage)||void 0===h?void 0:h.getItem("__apprun_debugging__"))||0;if(o.A.on("debug",(e=>{1&w&&e.event&&console.log(e),2&w&&e.vdom&&console.log(e)})),window["_apprun-components"]=["components [print]",e=>{(e=>{const t=b(),n=[];if(t instanceof Map)for(let[e,o]of t){const t="string"==typeof e?document.getElementById(e)||document.querySelector(e):e;n.push({element:t,comps:o})}else Object.keys(t).forEach((e=>{const o="string"==typeof e?document.getElementById(e)||document.querySelector(e):e;n.push({element:o,comps:t[e]})}));if(e){const e=(e=>{const t=({components:e})=>o.A.h("ul",null,e.map((e=>{const t=y(e),n=e._actions.map((e=>e.name)),s={state:e.state,view:t,actions:n,update:e.update};return o.A.h("li",null,o.A.h("div",null,e.constructor.name),o.A.h("div",null,o.A.h("pre",null,(r=JSON.stringify(s,null,2))?r.toString().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"):r)),o.A.h("br",null));var r})));return o.A.h("ul",null,e.map((({element:e,comps:n})=>o.A.h("li",null,o.A.h("div",null,(e=>o.A.h("div",null,e.tagName.toLowerCase(),e.id?"#"+e.id:""," ",e.className&&e.className.split(" ").map((e=>"."+e)).join()))(e)),o.A.h(t,{components:n})))))})(n);v(l(e))}else n.forEach((({element:e,comps:t})=>console.log(e,t)))})("print"===e)}],window["_apprun-events"]=["events [print]",e=>{(e=>{const t=o.A._events,n={},s=b(),r=e=>e._actions.forEach((t=>{n[t.name]=n[t.name]||[],n[t.name].push(e)}));if(s instanceof Map)for(let[e,t]of s)t.forEach(r);else Object.keys(s).forEach((e=>s[e].forEach(r)));const c=[];if(Object.keys(n).forEach((e=>{c.push({event:e,components:n[e],global:!!t[e]})})),c.sort(((e,t)=>e.event>t.event?1:-1)).map((e=>e.event)),e){const e=(e=>{const t=({components:e})=>o.A.h("ul",null,e.map((e=>o.A.h("li",null,o.A.h("div",null,e.constructor.name))))),n=({events:e,global:n})=>o.A.h("ul",null,e&&e.filter((e=>e.global===n&&"."!==e.event)).map((({event:e,components:n})=>o.A.h("li",null,o.A.h("div",null,e),o.A.h(t,{components:n})))));return o.A.h("div",null,o.A.h("div",null,"GLOBAL EVENTS"),o.A.h(n,{events:e,global:!0}),o.A.h("div",null,"LOCAL EVENTS"),o.A.h(n,{events:e,global:!1}))})(c);v(l(e))}else console.log("=== GLOBAL EVENTS ==="),c.filter((e=>e.global&&"."!==e.event)).forEach((({event:e,components:t})=>console.log({event:e},t))),console.log("=== LOCAL EVENTS ==="),c.filter((e=>!e.global&&"."!==e.event)).forEach((({event:e,components:t})=>console.log({event:e},t)))})("print"===e)}],window["_apprun-log"]=["log [event|view] on|off",(e,t)=>{var n;"on"===e?w=3:"off"===e?w=0:"event"===e?"on"===t?w|=1:"off"===t&&(w&=-2):"view"===e&&("on"===t?w|=2:"off"===t&&(w&=-3)),console.log(`* log ${e} ${t||""}`),null===(n=null===window||void 0===window?void 0:window.localStorage)||void 0===n||n.setItem("__apprun_debugging__",`${w}`)}],window["_apprun-create-event-tests"]=["create-event-tests",()=>(()=>{const e={components:{}};app.run("get-components",e);const{components:t}=e;if(a(""),t instanceof Map)for(let[e,n]of t)n.forEach(f);else Object.keys(t).forEach((e=>{t[e].forEach(f)}));u()})()],window["_apprun-create-state-tests"]=["create-state-tests <start|stop>",e=>{var t;"start"===(t=e)?(m=[],d=!0,console.log("* State logging started.")):"stop"===t?(0!==m.length?(a(""),m.forEach(((e,t)=>{p(` it ('view snapshot: #${t+1}', ()=>{`),p(` const component = new ${e.component.constructor.name}()`),p(` const state = ${JSON.stringify(e.state,void 0,2)};`),p(" const vdom = component['view'](state);"),p(" expect(JSON.stringify(vdom)).toMatchSnapshot();"),p(" })")})),u()):console.log("* No state recorded."),d=!1,m=[],console.log("* State logging stopped.")):console.log("create-state-tests <start|stop>")}],window._apprun=e=>{const[t,...n]=e[0].split(" ").filter((e=>!!e)),o=window[`_apprun-${t}`];o?o[1](...n):window["_apprun-help"][1]()},console.info('AppRun DevTools 2.27: type "_apprun `help`" to list all available commands.'),window.__REDUX_DEVTOOLS_EXTENSION__){let e=!1;const t=window.__REDUX_DEVTOOLS_EXTENSION__.connect();if(t){const n=location.hash||"#";t.send(n,"");const s=[{component:null,state:""}];console.info("Connected to the Redux DevTools"),t.subscribe((t=>{if("START"===t.type)e=!0;else if("STOP"===t.type)e=!1;else if("DISPATCH"===t.type){const e=t.payload.index;if(0===e)o.A.run(n);else{const{component:t,state:n}=s[e];null==t||t.setState(n)}}}));const r=(e,n,o)=>{null!=o&&(s.push({component:e,state:o}),t.send(n,o))};o.A.on("debug",(t=>{if(e&&t.event){const e=t.newState,n={type:t.event,payload:t.p},o=t.component;e instanceof Promise?e.then((e=>r(o,n,e))):r(o,n,e)}}))}}return{}})()));
|
|
3
2
|
//# sourceMappingURL=apprun-dev-tools.js.map
|