apprun 3.28.6 → 3.28.9
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 +4 -2
- package/README.md +8 -40
- package/WHATSNEW.md +6 -6
- package/apprun-cli.js +3 -220
- package/dist/apprun-dev-tools.js +1 -2
- package/dist/apprun-dev-tools.js.map +1 -1
- package/dist/apprun-html.esm.js +10 -112
- package/dist/apprun-html.esm.js.map +1 -1
- package/dist/apprun-html.js +1 -1
- package/dist/apprun-html.js.LICENSE.txt +2 -24
- package/dist/apprun-html.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/apprun-dev-tools.js +2 -1
- package/esm/apprun-dev-tools.js.map +1 -1
- package/esm/apprun.js +1 -1
- package/esm/apprun.js.map +1 -1
- package/esm/component.js +1 -1
- package/esm/component.js.map +1 -1
- package/esm/vdom-lit-html.js +42 -21
- package/esm/vdom-lit-html.js.map +1 -1
- package/esm/vdom-to-html.js +1 -2
- package/esm/vdom-to-html.js.map +1 -1
- package/package.json +18 -19
- package/src/apprun.ts +1 -1
- package/src/component.ts +1 -1
- package/src/vdom-lit-html.ts +43 -20
- package/src/vdom-to-html.tsx +2 -2
- package/webpack.config.js +2 -1
- package/cli-templates/Layout.ts_ +0 -35
- package/cli-templates/_build.js +0 -27
- package/cli-templates/_eslintrc.js +0 -40
- package/cli-templates/_gitignore +0 -6
- package/cli-templates/component.ts_ +0 -14
- package/cli-templates/index.html +0 -10
- package/cli-templates/jest.config.js +0 -19
- package/cli-templates/karma.conf.js +0 -24
- package/cli-templates/main.ts_ +0 -13
- package/cli-templates/readme.md +0 -7
- package/cli-templates/spa_index.html +0 -14
- package/cli-templates/spa_main.ts_ +0 -12
- package/cli-templates/spec.ts_ +0 -12
- package/cli-templates/stories.js_ +0 -47
- package/cli-templates/tsconfig.es5.json +0 -15
- package/cli-templates/tsconfig.es6.json +0 -15
- package/cli-templates/webpack.config.js +0 -23
- package/index-apprun-play.html +0 -46
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apprun",
|
|
3
|
-
"version": "3.28.
|
|
3
|
+
"version": "3.28.9",
|
|
4
4
|
"description": "JavaScript library that has Elm inspired architecture, event pub-sub and components",
|
|
5
5
|
"main": "dist/apprun.js",
|
|
6
6
|
"module": "dist/apprun.esm.js",
|
|
@@ -37,30 +37,28 @@
|
|
|
37
37
|
"url": "https://github.com/yysun/apprun/issues"
|
|
38
38
|
},
|
|
39
39
|
"homepage": "https://github.com/yysun/apprun#readme",
|
|
40
|
-
"dependencies": {
|
|
41
|
-
"commander": "^7.2.0"
|
|
42
|
-
},
|
|
43
40
|
"devDependencies": {
|
|
44
|
-
"@rollup/plugin-commonjs": "^
|
|
45
|
-
"@rollup/plugin-node-resolve": "^13.
|
|
46
|
-
"@types/jest": "^
|
|
47
|
-
"jest": "^
|
|
41
|
+
"@rollup/plugin-commonjs": "^21.0.2",
|
|
42
|
+
"@rollup/plugin-node-resolve": "^13.1.3",
|
|
43
|
+
"@types/jest": "^27.4.1",
|
|
44
|
+
"jest": "^27.5.1",
|
|
48
45
|
"json-loader": "^0.5.7",
|
|
49
|
-
"lit-html": "
|
|
50
|
-
"marked": "^
|
|
51
|
-
"rollup": "^2.
|
|
52
|
-
"rollup-plugin-filesize": "^9.1.
|
|
46
|
+
"lit-html": "^2.2.0",
|
|
47
|
+
"marked": "^4.0.12",
|
|
48
|
+
"rollup": "^2.68.0",
|
|
49
|
+
"rollup-plugin-filesize": "^9.1.2",
|
|
53
50
|
"rollup-plugin-node-resolve": "^5.2.0",
|
|
54
51
|
"rollup-plugin-sourcemaps": "^0.6.3",
|
|
55
52
|
"rollup-plugin-terser": "^7.0.2",
|
|
56
|
-
"ts-jest": "^
|
|
57
|
-
"ts-loader": "^9.2.
|
|
58
|
-
"typescript": "^4.
|
|
59
|
-
"webpack": "^5.
|
|
60
|
-
"webpack-cli": "^4.
|
|
61
|
-
"webpack-dev-server": "^
|
|
53
|
+
"ts-jest": "^27.1.3",
|
|
54
|
+
"ts-loader": "^9.2.6",
|
|
55
|
+
"typescript": "^4.5.5",
|
|
56
|
+
"webpack": "^5.69.1",
|
|
57
|
+
"webpack-cli": "^4.9.2",
|
|
58
|
+
"webpack-dev-server": "^4.7.4"
|
|
62
59
|
},
|
|
63
60
|
"jest": {
|
|
61
|
+
"testEnvironment": "jsdom",
|
|
64
62
|
"transformIgnorePatterns": [
|
|
65
63
|
"/node_modules/(?!lit-html).+\\.js"
|
|
66
64
|
],
|
|
@@ -81,6 +79,7 @@
|
|
|
81
79
|
"diagnostics": true,
|
|
82
80
|
"tsconfig": "tsconfig.jest.json"
|
|
83
81
|
}
|
|
84
|
-
}
|
|
82
|
+
},
|
|
83
|
+
"testRunner": "jest-jasmine2"
|
|
85
84
|
}
|
|
86
85
|
}
|
package/src/apprun.ts
CHANGED
|
@@ -27,7 +27,7 @@ app.webComponent = webComponent;
|
|
|
27
27
|
|
|
28
28
|
app.start = <T, E = any>(element?: Element, model?: T, view?: View<T>, update?: Update<T, E>,
|
|
29
29
|
options?: AppStartOptions<T>): Component<T, E> => {
|
|
30
|
-
const opts = {
|
|
30
|
+
const opts = { render: true, global_event: true, ...options };
|
|
31
31
|
const component = new Component<T, E>(model, view, update);
|
|
32
32
|
if (options && options.rendered) component.rendered = options.rendered;
|
|
33
33
|
component.mount(element, opts);
|
package/src/component.ts
CHANGED
|
@@ -127,7 +127,7 @@ export class Component<T = any, E = any> {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
start = (element = null, options?: MountOptions): Component<T, E> => {
|
|
130
|
-
return this.mount(element, {
|
|
130
|
+
return this.mount(element, { render: true, ...options });
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
public mount(element = null, options?: MountOptions): Component<T, E> {
|
package/src/vdom-lit-html.ts
CHANGED
|
@@ -1,38 +1,61 @@
|
|
|
1
1
|
import { createElement, updateElement, Fragment } from './vdom-my';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { render, svg, html, noChange, nothing } from 'lit-html';
|
|
5
|
+
import { directive, Directive, Part, PartInfo, PartType, EventPart } from 'lit-html/directive.js';
|
|
6
|
+
import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
|
|
4
7
|
|
|
5
8
|
function _render(element, vdom, parent?) {
|
|
9
|
+
if (!vdom) return;
|
|
6
10
|
if (typeof vdom === 'string') {
|
|
11
|
+
if (!element['_$litPart$']) element.replaceChildren();
|
|
7
12
|
render(html`${unsafeHTML(vdom)}`, element);
|
|
8
|
-
} else if (
|
|
13
|
+
} else if ('_$litType$' in vdom) {
|
|
14
|
+
if (!element['_$litPart$']) element.replaceChildren();
|
|
9
15
|
render(vdom, element);
|
|
10
16
|
} else {
|
|
11
17
|
updateElement(element, vdom, parent);
|
|
12
|
-
|
|
18
|
+
element['_$litPart$'] = undefined;
|
|
13
19
|
}
|
|
14
20
|
}
|
|
15
21
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
22
|
+
export class RunDirective extends Directive {
|
|
23
|
+
// State stored in class field
|
|
24
|
+
value: number | undefined;
|
|
25
|
+
constructor(partInfo: PartInfo) {
|
|
26
|
+
super(partInfo);
|
|
27
|
+
// When necessary, validate part in constructor using `part.type`
|
|
28
|
+
if (partInfo.type !== PartType.EVENT) {
|
|
29
|
+
throw new Error('${run} can only be used in event handlers');
|
|
30
|
+
}
|
|
19
31
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
32
|
+
// Optional: override update to perform any direct DOM manipulation
|
|
33
|
+
update(part: Part, params) {
|
|
34
|
+
/* Any imperative updates to DOM/parts would go here */
|
|
35
|
+
|
|
36
|
+
let { element, name } = part as EventPart;
|
|
37
|
+
const getComponent = () => {
|
|
38
|
+
let component = element['_component'];
|
|
39
|
+
while (!component && element) {
|
|
40
|
+
element = element.parentElement;
|
|
41
|
+
component = element && element['_component'];
|
|
42
|
+
}
|
|
43
|
+
console.assert(!!component, 'Component not found.');
|
|
44
|
+
return component;
|
|
45
|
+
}
|
|
46
|
+
const [event, ...args] = params;
|
|
47
|
+
if (typeof event === 'string') {
|
|
48
|
+
element[`on${name}`] = e => getComponent().run(event, ...args, e);
|
|
49
|
+
} else if (typeof event === 'function') {
|
|
50
|
+
element[`on${name}`] = e => getComponent().setState(event(getComponent().state, ...args, e));
|
|
26
51
|
}
|
|
27
|
-
|
|
28
|
-
return component;
|
|
52
|
+
return this.render();
|
|
29
53
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
} else if (typeof event === 'function') {
|
|
33
|
-
element[`on${eventName}`] = e => getComponent().setState(event(getComponent().state, ...args, e));
|
|
54
|
+
render() {
|
|
55
|
+
return noChange;
|
|
34
56
|
}
|
|
35
|
-
}
|
|
57
|
+
}
|
|
36
58
|
|
|
59
|
+
const run = directive(RunDirective) as any;
|
|
37
60
|
export { createElement, Fragment, html, svg, _render as render, run };
|
|
38
61
|
|
package/src/vdom-to-html.tsx
CHANGED
package/webpack.config.js
CHANGED
package/cli-templates/Layout.ts_
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import app from 'apprun';
|
|
3
|
-
|
|
4
|
-
app.on('//', (route) => {
|
|
5
|
-
const menus = document.querySelectorAll('.navbar-nav li');
|
|
6
|
-
for (let i = 0; i < menus.length; ++i) {menus[i].classList.remove('active');}
|
|
7
|
-
const item = document.querySelector(`[href='${route}']`);
|
|
8
|
-
item && item.parentElement.classList.add('active');
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
export default () => <div class="container">
|
|
12
|
-
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
|
13
|
-
<a class="navbar-brand" href="#">Project Name</a>
|
|
14
|
-
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
|
|
15
|
-
aria-expanded="false" aria-label="Toggle navigation">
|
|
16
|
-
<span class="navbar-toggler-icon"></span>
|
|
17
|
-
</button>
|
|
18
|
-
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
|
19
|
-
<ul class="navbar-nav mr-auto">
|
|
20
|
-
<li class="nav-item active">
|
|
21
|
-
<a class="nav-link" href="#Home">Home
|
|
22
|
-
<span class="sr-only">(current)</span>
|
|
23
|
-
</a>
|
|
24
|
-
</li>
|
|
25
|
-
<li class="nav-item">
|
|
26
|
-
<a class="nav-link" href="#About">About</a>
|
|
27
|
-
</li>
|
|
28
|
-
<li class="nav-item">
|
|
29
|
-
<a class="nav-link" href="#Contact">Contact</a>
|
|
30
|
-
</li>
|
|
31
|
-
</ul>
|
|
32
|
-
</div>
|
|
33
|
-
</nav>
|
|
34
|
-
<div class="container" id="my-app"></div>
|
|
35
|
-
</div>;
|
package/cli-templates/_build.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const builder = require('esbuild');
|
|
3
|
-
const server = require('apprun-dev-server');
|
|
4
|
-
|
|
5
|
-
const build = (watch = false) => builder.build({
|
|
6
|
-
entryPoints: ['src/main.tsx'],
|
|
7
|
-
outfile: 'dist/main.js',
|
|
8
|
-
bundle: true,
|
|
9
|
-
minify: true,
|
|
10
|
-
sourcemap: true,
|
|
11
|
-
watch
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
const start = () => {
|
|
15
|
-
server.start({
|
|
16
|
-
host: 'localhost',
|
|
17
|
-
port: process.env.PORT || 8080,
|
|
18
|
-
watch: 'src'
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (!process.argv[2]) {
|
|
23
|
-
build();
|
|
24
|
-
} else {
|
|
25
|
-
build(true);
|
|
26
|
-
start();
|
|
27
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-undef */
|
|
2
|
-
module.exports = {
|
|
3
|
-
env: {
|
|
4
|
-
browser: true,
|
|
5
|
-
es2021: true,
|
|
6
|
-
},
|
|
7
|
-
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
|
|
8
|
-
parser: '@typescript-eslint/parser',
|
|
9
|
-
parserOptions: {
|
|
10
|
-
ecmaVersion: 12,
|
|
11
|
-
sourceType: 'module',
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
plugins: ['@typescript-eslint'],
|
|
15
|
-
|
|
16
|
-
/// https://devstephen.medium.com/style-guides-for-linting-ecmascript-2015-eslint-common-google-airbnb-6c25fd3dff0
|
|
17
|
-
rules: {
|
|
18
|
-
indent: ['error', 2],
|
|
19
|
-
quotes: ['error', 'single'],
|
|
20
|
-
semi: ['error', 'always'],
|
|
21
|
-
'no-trailing-spaces': 'error',
|
|
22
|
-
'no-multiple-empty-lines': ['error', { 'max': 1, 'maxEOF': 0 }],
|
|
23
|
-
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
24
|
-
'no-case-declarations': 'off',
|
|
25
|
-
'eqeqeq': 'error',
|
|
26
|
-
'curly': ['error', 'all'],
|
|
27
|
-
'brace-style': ['error', '1tbs', { 'allowSingleLine': true }],
|
|
28
|
-
'no-extra-parens': ['error', 'functions'],
|
|
29
|
-
'no-useless-catch': 'error',
|
|
30
|
-
'no-console': 'error',
|
|
31
|
-
'space-before-function-paren': ['error', { 'anonymous': 'always', 'named': 'never', 'asyncArrow': 'always' }],
|
|
32
|
-
'object-curly-spacing': ['error', 'always'],
|
|
33
|
-
'array-bracket-spacing': ['error', 'never'],
|
|
34
|
-
'no-unused-expressions': ['error', { allowShortCircuit: true }],
|
|
35
|
-
'arrow-parens': ['error', 'as-needed', { 'requireForBlockBody': true }],
|
|
36
|
-
'@typescript-eslint/no-unused-vars': ['error', { varsIgnorePattern: 'app' }],
|
|
37
|
-
'no-invalid-this': 'off',
|
|
38
|
-
'@typescript-eslint/no-invalid-this': ['error']
|
|
39
|
-
},
|
|
40
|
-
};
|
package/cli-templates/_gitignore
DELETED
package/cli-templates/index.html
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
"transform": {
|
|
3
|
-
"^.+\\.tsx?$": "ts-jest"
|
|
4
|
-
},
|
|
5
|
-
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
|
|
6
|
-
"moduleFileExtensions": [
|
|
7
|
-
"ts",
|
|
8
|
-
"tsx",
|
|
9
|
-
"js",
|
|
10
|
-
"jsx",
|
|
11
|
-
"json",
|
|
12
|
-
"node"
|
|
13
|
-
],
|
|
14
|
-
"globals": {
|
|
15
|
-
"ts-jest": {
|
|
16
|
-
"diagnostics": true
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
var webpackConfig = require('./webpack.config');
|
|
2
|
-
module.exports = function (config) {
|
|
3
|
-
config.set({
|
|
4
|
-
basePath: '',
|
|
5
|
-
frameworks: ["jasmine"],
|
|
6
|
-
files: [
|
|
7
|
-
{ pattern: "tests/*.spec.*" }
|
|
8
|
-
],
|
|
9
|
-
exclude: [
|
|
10
|
-
],
|
|
11
|
-
preprocessors: {
|
|
12
|
-
'tests/*.spec.*': ['webpack'],
|
|
13
|
-
},
|
|
14
|
-
webpack: webpackConfig,
|
|
15
|
-
reporters: ["progress"],
|
|
16
|
-
colors: true,
|
|
17
|
-
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
|
18
|
-
logLevel: config.LOG_INFO,
|
|
19
|
-
browsers: ['Chrome'],
|
|
20
|
-
mime: {
|
|
21
|
-
'text/x-typescript': ['ts', 'tsx']
|
|
22
|
-
}
|
|
23
|
-
})
|
|
24
|
-
}
|
package/cli-templates/main.ts_
DELETED
package/cli-templates/readme.md
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
6
|
-
<title>AppRun SPA</title>
|
|
7
|
-
<link rel="stylesheet" href="https://unpkg.com/bootstrap@4.4.1/dist/css/bootstrap.min.css">
|
|
8
|
-
<script src="https://unpkg.com/jquery@3.4.1/dist/jquery.slim.min.js"></script>
|
|
9
|
-
<script src="https://unpkg.com/popper.js@1.16.1/dist/umd/popper.min.js"></script>
|
|
10
|
-
<script src="https://unpkg.com/bootstrap@4.4.1/dist/js/bootstrap.min.js"></script>
|
|
11
|
-
<body>
|
|
12
|
-
<script type="module" src="./dist/main.js"></script>
|
|
13
|
-
</body>
|
|
14
|
-
</html>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import app from 'apprun';
|
|
2
|
-
import Home from './Home';
|
|
3
|
-
import About from './About';
|
|
4
|
-
import Contact from './Contact';
|
|
5
|
-
import Layout from './Layout';
|
|
6
|
-
|
|
7
|
-
app.render(document.body, <Layout />);
|
|
8
|
-
|
|
9
|
-
const element = 'my-app';
|
|
10
|
-
new Home().start(element);
|
|
11
|
-
new About().mount(element);
|
|
12
|
-
new Contact().mount(element);
|
package/cli-templates/spec.ts_
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import app from 'apprun';
|
|
2
|
-
import #name from '../src/#name';
|
|
3
|
-
|
|
4
|
-
describe('component', () => {
|
|
5
|
-
it('should render state upon route event', () => {
|
|
6
|
-
const element = document.createElement('div');
|
|
7
|
-
const component = new #name().mount(element);
|
|
8
|
-
app.run('##name');
|
|
9
|
-
expect(element.textContent).toBe('#name');
|
|
10
|
-
expect(component.state).toBe('#name');
|
|
11
|
-
});
|
|
12
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import #name from '../#name';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: '#name',
|
|
5
|
-
argTypes: {
|
|
6
|
-
event: {
|
|
7
|
-
name: 'event',
|
|
8
|
-
type: { name: 'string', required: false },
|
|
9
|
-
description: 'event',
|
|
10
|
-
control: {
|
|
11
|
-
type: 'text'
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
route: {
|
|
16
|
-
name: 'route',
|
|
17
|
-
type: { name: 'string', required: false },
|
|
18
|
-
description: 'route',
|
|
19
|
-
control: {
|
|
20
|
-
type: 'text'
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const #name_Event = ({ event }) => {
|
|
27
|
-
const div = document.createElement('div');
|
|
28
|
-
const component = new #name().mount(div);
|
|
29
|
-
const e = JSON.parse(event);
|
|
30
|
-
const [name, ...params] = e;
|
|
31
|
-
component.run(name, ...params);
|
|
32
|
-
return div;
|
|
33
|
-
};
|
|
34
|
-
#name_Event.args = {
|
|
35
|
-
event: '["."]',
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const #name_Route = ({ route }) => {
|
|
39
|
-
const div = document.createElement('div');
|
|
40
|
-
new #name().mount(div);
|
|
41
|
-
app.route(route);
|
|
42
|
-
return div;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
#name_Route.args = {
|
|
46
|
-
route: '##name',
|
|
47
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es5",
|
|
4
|
-
"module": "es2015",
|
|
5
|
-
"moduleResolution": "node",
|
|
6
|
-
"jsx": "react",
|
|
7
|
-
"jsxFactory": "app.h",
|
|
8
|
-
"jsxFragmentFactory": "app.Fragment",
|
|
9
|
-
"lib": ["dom", "es2015", "es5"],
|
|
10
|
-
"experimentalDecorators": true,
|
|
11
|
-
"sourceMap": true,
|
|
12
|
-
"esModuleInterop": true,
|
|
13
|
-
"outDir": "dist"
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es2015",
|
|
4
|
-
"module": "es2015",
|
|
5
|
-
"moduleResolution": "node",
|
|
6
|
-
"jsx": "react",
|
|
7
|
-
"jsxFactory": "app.h",
|
|
8
|
-
"jsxFragmentFactory": "app.Fragment",
|
|
9
|
-
"lib": ["dom", "es2015", "es5"],
|
|
10
|
-
"experimentalDecorators": true,
|
|
11
|
-
"sourceMap": true,
|
|
12
|
-
"esModuleInterop": true,
|
|
13
|
-
"outDir": "dist"
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
module.exports = {
|
|
3
|
-
entry: {
|
|
4
|
-
'dist/main': './src/main.tsx',
|
|
5
|
-
},
|
|
6
|
-
output: {
|
|
7
|
-
filename: '[name].js',
|
|
8
|
-
path: path.resolve(__dirname)
|
|
9
|
-
},
|
|
10
|
-
resolve: {
|
|
11
|
-
extensions: ['.ts', '.tsx', '.js']
|
|
12
|
-
},
|
|
13
|
-
module: {
|
|
14
|
-
rules: [
|
|
15
|
-
{ test: /\.tsx?$/, loader: 'ts-loader' },
|
|
16
|
-
{ test: /\.js$/, use: ["source-map-loader"], enforce: "pre" }
|
|
17
|
-
]
|
|
18
|
-
},
|
|
19
|
-
devServer: {
|
|
20
|
-
open: true
|
|
21
|
-
},
|
|
22
|
-
devtool: 'source-map'
|
|
23
|
-
}
|
package/index-apprun-play.html
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>AppRun Play</title>
|
|
6
|
-
<link rel="stylesheet" href="demo/lib/codemirror.css">
|
|
7
|
-
<script src="demo/lib/codemirror.js"></script>
|
|
8
|
-
<script src="demo/mode/javascript/javascript.js"></script>
|
|
9
|
-
<script src="demo/mode/xml/xml.js"></script>
|
|
10
|
-
<script src="demo/mode/jsx/jsx.js"></script>
|
|
11
|
-
<script src="dist/apprun-play.js"></script>
|
|
12
|
-
</head>
|
|
13
|
-
<body>
|
|
14
|
-
<textarea style="width:100%; height:300px">
|
|
15
|
-
const state = 0;
|
|
16
|
-
const view = state => {
|
|
17
|
-
return `<div>
|
|
18
|
-
<h1>${state}</h1>
|
|
19
|
-
<button onclick='app.run("-1")'>-1</button>
|
|
20
|
-
<button onclick='app.run("+1")'>+1</button>
|
|
21
|
-
</div>`;
|
|
22
|
-
};
|
|
23
|
-
const update = {
|
|
24
|
-
'+1': state => state + 1,
|
|
25
|
-
'-1': state => state - 1
|
|
26
|
-
};
|
|
27
|
-
app.start(document.body, state, view, update);
|
|
28
|
-
</textarea>
|
|
29
|
-
<apprun-play></apprun-play>
|
|
30
|
-
|
|
31
|
-
<textarea>
|
|
32
|
-
<html>
|
|
33
|
-
<body>
|
|
34
|
-
<script src="https://unpkg.com/apprun/dist/apprun-html.js"></script>
|
|
35
|
-
<script>
|
|
36
|
-
const view = state => `<div>${state}</div>`;
|
|
37
|
-
app.start(document.body, 'hello world', view);
|
|
38
|
-
</script>
|
|
39
|
-
</body>
|
|
40
|
-
</html>
|
|
41
|
-
</textarea>
|
|
42
|
-
<p>
|
|
43
|
-
<apprun-play></apprun-play>
|
|
44
|
-
</p>
|
|
45
|
-
</body>
|
|
46
|
-
</html>
|