apprun 3.38.0 → 6.0.0-rc.0

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.
Files changed (113) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/README.md +18 -10
  3. package/apprun.d.ts +67 -23
  4. package/dist/apprun-code.js +1 -1
  5. package/dist/apprun-code.js.map +1 -1
  6. package/dist/apprun-dev-tools.js +1 -1
  7. package/dist/apprun-dev-tools.js.map +1 -1
  8. package/dist/apprun-html.esm.js +7 -7
  9. package/dist/apprun-html.esm.js.map +1 -1
  10. package/dist/apprun-html.js +1 -1
  11. package/dist/apprun-html.js.map +1 -1
  12. package/dist/apprun-play.js +1 -1
  13. package/dist/apprun-play.js.map +1 -1
  14. package/dist/apprun.esm.js +1 -1
  15. package/dist/apprun.esm.js.map +1 -1
  16. package/dist/apprun.js +1 -1
  17. package/dist/apprun.js.map +1 -1
  18. package/esm/add-components.js +7 -7
  19. package/esm/add-components.js.map +1 -1
  20. package/esm/app.js +81 -32
  21. package/esm/app.js.map +1 -1
  22. package/esm/apprun-code.js +8 -2
  23. package/esm/apprun-code.js.map +1 -1
  24. package/esm/apprun-html.js +14 -9
  25. package/esm/apprun-html.js.map +1 -1
  26. package/esm/apprun-play.js +7 -1
  27. package/esm/apprun-play.js.map +1 -1
  28. package/esm/apprun.js +38 -19
  29. package/esm/apprun.js.map +1 -1
  30. package/esm/component.js +90 -37
  31. package/esm/component.js.map +1 -1
  32. package/esm/directive.js +1 -1
  33. package/esm/directive.js.map +1 -1
  34. package/esm/router.js +73 -19
  35. package/esm/router.js.map +1 -1
  36. package/esm/types.js +2 -1
  37. package/esm/types.js.map +1 -1
  38. package/esm/vdom-my.js +52 -52
  39. package/esm/vdom-my.js.map +1 -1
  40. package/esm/vdom-to-html.js +8 -1
  41. package/esm/vdom-to-html.js.map +1 -1
  42. package/esm/vdom.js +3 -3
  43. package/esm/vdom.js.map +1 -1
  44. package/esm/version.js +1 -1
  45. package/esm/version.js.map +1 -1
  46. package/esm/web-component.js +23 -6
  47. package/esm/web-component.js.map +1 -1
  48. package/jsx-runtime.js +1 -1
  49. package/jsx-runtime.js.map +1 -1
  50. package/package.json +62 -2
  51. package/.clinerules +0 -1
  52. package/.travis.yml +0 -10
  53. package/BACKERS.md +0 -8
  54. package/CNAME +0 -1
  55. package/WHATSNEW.md +0 -367
  56. package/ai/apprun-html.prompt.md +0 -290
  57. package/ai/apprun.prompt.md +0 -602
  58. package/apprun-book.jpg +0 -0
  59. package/dist/apprun-dev-tools-tests.js +0 -1
  60. package/dist/apprun-dev-tools.js.LICENSE.txt +0 -1
  61. package/dist/apprun-play-html.esm.js +0 -34
  62. package/dist/apprun-play-html.esm.js.map +0 -1
  63. package/error.log +0 -0
  64. package/esm/apprun-play-html.js +0 -210
  65. package/esm/apprun-play-html.js.map +0 -1
  66. package/esm/shadow.js +0 -8
  67. package/esm/shadow.js.map +0 -1
  68. package/esm/vdom-html.js +0 -22
  69. package/esm/vdom-html.js.map +0 -1
  70. package/esm/vdom-my-new.js +0 -327
  71. package/esm/vdom-my-new.js.map +0 -1
  72. package/esm/vdom-patch.js +0 -103
  73. package/esm/vdom-patch.js.map +0 -1
  74. package/index.html +0 -87
  75. package/jest.config.js +0 -57
  76. package/jest.setup.js +0 -73
  77. package/logo.png +0 -0
  78. package/react.js +0 -13
  79. package/rollup.config.js +0 -62
  80. package/src/add-components.ts +0 -103
  81. package/src/app.ts +0 -173
  82. package/src/apprun-code.tsx +0 -177
  83. package/src/apprun-dev-tools-tests.tsx +0 -101
  84. package/src/apprun-dev-tools.tsx +0 -307
  85. package/src/apprun-html.ts +0 -25
  86. package/src/apprun-play.tsx +0 -249
  87. package/src/apprun.ts +0 -238
  88. package/src/component.ts +0 -388
  89. package/src/createState.ts +0 -11
  90. package/src/decorator.ts +0 -98
  91. package/src/directive.ts +0 -303
  92. package/src/global.d.ts +0 -22
  93. package/src/router.ts +0 -311
  94. package/src/shadow.tsx +0 -8
  95. package/src/tsconfig.json +0 -16
  96. package/src/type-utils.ts +0 -130
  97. package/src/types.ts +0 -151
  98. package/src/vdom-html.ts_ +0 -20
  99. package/src/vdom-lit-html.ts +0 -67
  100. package/src/vdom-my-new.ts +0 -311
  101. package/src/vdom-my-prop-attr.ts +0 -241
  102. package/src/vdom-my.ts +0 -286
  103. package/src/vdom-patch.ts +0 -108
  104. package/src/vdom-to-html.tsx +0 -49
  105. package/src/vdom.ts +0 -28
  106. package/src/version.ts +0 -16
  107. package/src/web-component.ts +0 -154
  108. package/tsconfig.jest.json +0 -49
  109. package/tsconfig.json +0 -16
  110. package/tslint.json +0 -114
  111. package/typescriptreact.json +0 -87
  112. package/viewEngine.js +0 -54
  113. package/webpack.config.cjs +0 -41
package/tsconfig.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es2020",
4
- "module": "esnext",
5
- "moduleResolution": "node",
6
- "jsx": "react",
7
- "jsxFactory": "app.h",
8
- "jsxFragmentFactory": "app.Fragment",
9
- "lib": ["dom", "es2020", "esnext.asynciterable"],
10
- "experimentalDecorators": true,
11
- "sourceMap": true,
12
- "esModuleInterop": true,
13
- "downlevelIteration": true,
14
- "skipLibCheck": true
15
- }
16
- }
package/tslint.json DELETED
@@ -1,114 +0,0 @@
1
- {
2
- "rules": {
3
- // -- Strict errors --
4
- // These lint rules are likely always a good idea.
5
- // Force function overloads to be declared together. This ensures readers understand APIs.
6
- "adjacent-overload-signatures": true,
7
- // Do not allow the subtle/obscure comma operator.
8
- "ban-comma-operator": true,
9
- // Do not allow internal modules or namespaces . These are deprecated in favor of ES6 modules.
10
- "no-namespace": true,
11
- // Do not allow parameters to be reassigned. To avoid bugs, developers should instead assign new values to new vars.
12
- "no-parameter-reassignment": false,
13
- // Force the use of ES6-style imports instead of /// <reference path=> imports.
14
- "no-reference": true,
15
- // Do not allow type assertions that do nothing. This is a big warning that the developer may not understand the
16
- // code currently being edited (they may be incorrectly handling a different type case that does not exist).
17
- "no-unnecessary-type-assertion": true,
18
- // Disallow nonsensical label usage.
19
- "label-position": true,
20
- // Disallows the (often typo) syntax if (var1 = var2). Replace with if (var2) { var1 = var2 }.
21
- "no-conditional-assignment": true,
22
- // Disallows constructors for primitive types (e.g. new Number('123'), though Number('123') is still allowed).
23
- "no-construct": true,
24
- // Do not allow super() to be called twice in a constructor.
25
- "no-duplicate-super": true,
26
- // Do not allow the same case to appear more than once in a switch block.
27
- "no-duplicate-switch-case": true,
28
- // Do not allow a variable to be declared more than once in the same block. Consider function parameters in this
29
- // rule.
30
- "no-duplicate-variable": [
31
- true,
32
- "check-parameters"
33
- ],
34
- // Disallows a variable definition in an inner scope from shadowing a variable in an outer scope. Developers should
35
- // instead use a separate variable name.
36
- "no-shadowed-variable": false,
37
- // Empty blocks are almost never needed. Allow the one general exception: empty catch blocks.
38
- "no-empty": [
39
- false,
40
- "allow-empty-catch"
41
- ],
42
- // Functions must either be handled directly (e.g. with a catch() handler) or returned to another function.
43
- // This is a major source of errors in Cloud Functions and the team strongly recommends leaving this rule on.
44
- "no-floating-promises": true,
45
- // Do not allow any imports for modules that are not in package.json. These will almost certainly fail when
46
- // deployed.
47
- "no-implicit-dependencies": true,
48
- // The 'this' keyword can only be used inside of classes.
49
- "no-invalid-this": true,
50
- // Do not allow strings to be thrown because they will not include stack traces. Throw Errors instead.
51
- "no-string-throw": true,
52
- // Disallow control flow statements, such as return, continue, break, and throw in finally blocks.
53
- "no-unsafe-finally": true,
54
- // Do not allow variables to be used before they are declared.
55
- "no-use-before-declare": true,
56
- // Expressions must always return a value. Avoids common errors like const myValue = functionReturningVoid();
57
- "no-void-expression": [
58
- true,
59
- "ignore-arrow-function-shorthand"
60
- ],
61
- // Disallow duplicate imports in the same file.
62
- "no-duplicate-imports": true,
63
- // -- Strong Warnings --
64
- // These rules should almost never be needed, but may be included due to legacy code.
65
- // They are left as a warning to avoid frustration with blocked deploys when the developer
66
- // understand the warning and wants to deploy anyway.
67
- // Warn when an empty interface is defined. These are generally not useful.
68
- "no-empty-interface": {
69
- "severity": "warning"
70
- },
71
- // Warn when an import will have side effects.
72
- "no-import-side-effect": {
73
- "severity": "warning"
74
- },
75
- // Warn when variables are defined with var. Var has subtle meaning that can lead to bugs. Strongly prefer const for
76
- // most values and let for values that will change.
77
- "no-var-keyword": {
78
- "severity": "warning"
79
- },
80
- // Prefer === and !== over == and !=. The latter operators support overloads that are often accidental.
81
- "triple-equals": {
82
- "severity": "warning"
83
- },
84
- // Warn when using deprecated APIs.
85
- "deprecation": {
86
- "severity": "warning"
87
- },
88
- // -- Light Warnigns --
89
- // These rules are intended to help developers use better style. Simpler code has fewer bugs. These would be "info"
90
- // if TSLint supported such a level.
91
- // prefer for( ... of ... ) to an index loop when the index is only used to fetch an object from an array.
92
- // (Even better: check out utils like .map if transforming an array!)
93
- "prefer-for-of": {
94
- "severity": "warning"
95
- },
96
- // Warns if function overloads could be unified into a single function with optional or rest parameters.
97
- "unified-signatures": {
98
- "severity": "warning"
99
- },
100
- // Warns if code has an import or variable that is unused.
101
- "no-unused-variable": {
102
- "severity": "warning"
103
- },
104
- // Prefer const for values that will not change. This better documents code.
105
- "prefer-const": {
106
- "severity": "warning"
107
- },
108
- // Multi-line object liiterals and function calls should have a trailing comma. This helps avoid merge conflicts.
109
- "trailing-comma": {
110
- "severity": "warning"
111
- }
112
- },
113
- "defaultSeverity": "error"
114
- }
@@ -1,87 +0,0 @@
1
- {
2
- "AppRun Application": {
3
- "prefix": "apprun",
4
- "body": [
5
- "import app from 'apprun';",
6
- "",
7
- "const state = {}",
8
- "",
9
- "const view = (state) => {",
10
- "\treturn <div>",
11
- "\t\t{state}",
12
- "\t</div>",
13
- "}",
14
- "",
15
- "const update = {",
16
- "\t'#': (state) => state",
17
- "}",
18
- "",
19
- "app.start('${0:my-app}', state, view, update);"
20
- ],
21
- "description": "AppRun application"
22
- },
23
- "AppRun Component": {
24
- "prefix": "component",
25
- "body": [
26
- "import { app, Component } from 'apprun';",
27
- "",
28
- "export default class extends Component {",
29
- "\tstate = {}",
30
- "",
31
- "\tview = (state) => {",
32
- "\t\treturn <div>",
33
- "\t\t\t{state}",
34
- "\t\t</div>",
35
- "\t}",
36
- "",
37
- "\tupdate = {",
38
- "\t\t'#': (state) => state",
39
- "\t}",
40
- "}"
41
- ],
42
- "description": "AppRun application"
43
- },
44
- "AppRun Pure Function Component": {
45
- "prefix": "pfc",
46
- "body": [
47
- "const ${1:Name} = ({ ${2:prop} }) => {",
48
- "\treturn <div>",
49
- "\t\t$0",
50
- "\t</div>",
51
- "}"
52
- ],
53
- "description": "AppRun view function"
54
- },
55
- "AppRun Update": {
56
- "prefix": "@on",
57
- "body": [
58
- "@on() ${1:name} = (state, ${2:e}) => {",
59
- "\treturn { ...state, $2 }",
60
- "}"
61
- ],
62
- "description": "AppRun update function"
63
- },
64
- "AppRun Log State": {
65
- "prefix": "log",
66
- "body": [
67
- "console.log(${1:state})"
68
- ],
69
- "description": "Log state"
70
- },
71
- "AppRun Event Publication": {
72
- "prefix": "run",
73
- "body": [
74
- "{e => ${1|this,app|}.run('$2', e)}"
75
- ],
76
- "description": "AppRun publish event"
77
- },
78
- "AppRun Event Subscription": {
79
- "prefix": "on",
80
- "body": [
81
- "app.on('$1', ($2) => {",
82
- "\t$3",
83
- "})"
84
- ],
85
- "description": "AppRun subscribe to event"
86
- }
87
- }
package/viewEngine.js DELETED
@@ -1,54 +0,0 @@
1
- function getProp(prop) {
2
- if (typeof prop === 'object') {
3
- return Object.keys(prop).map(name => `${name}:${prop[name]}`).join(';');
4
- }
5
- else return prop.toString();
6
- }
7
-
8
- function toProps(props) {
9
- return Object.keys(props)
10
- .map(name => ` ${name === 'className' ? 'class' : name}="${getProp(props[name])}"`)
11
- .join('');
12
- }
13
-
14
- function toHTML(vdom) {
15
- if (!vdom) return '';
16
- if (Array.isArray(vdom)) return toHTMLArray(vdom)
17
- if (vdom.tag) {
18
- const props = vdom.props ? toProps(vdom.props) : '';
19
- const children = vdom.children ? toHTMLArray(vdom.children) : '';
20
- return `<${vdom.tag}${props}>${children}</${vdom.tag}>`;
21
- }
22
- if (typeof vdom === 'object') return JSON.stringify(vdom);
23
- else {
24
- const html = vdom.toString();
25
- return html.startsWith('_html:') ? html.substring(6) : html;
26
- }
27
- }
28
-
29
- function toHTMLArray(nodes) {
30
- return nodes.map(node => toHTML(node)).join('');
31
- }
32
-
33
- function clean(obj) {
34
- for (var i in obj) {
35
- if (obj[i] == null) {
36
- delete obj[i];
37
- } else if (typeof obj[i] === 'object') {
38
- clean(obj[i]);
39
- }
40
- }
41
- }
42
-
43
- function engine(name, options, callback) {
44
- const fn = require(name).default;
45
- const rendered = fn(options);
46
- clean(rendered);
47
- return options.ssr ?
48
- callback(null, toHTML(rendered)) :
49
- callback(null, rendered);
50
- }
51
-
52
- module.exports = function (mode) {
53
- return mode === 'html' ? toHTML : engine
54
- }
@@ -1,41 +0,0 @@
1
- const path = require('path');
2
- const webpack = require('webpack');
3
-
4
- module.exports = {
5
- entry: {
6
- 'dist/apprun': './src/apprun.ts',
7
- 'dist/apprun-play': './src/apprun-play.tsx',
8
- 'dist/apprun-code': './src/apprun-code.tsx',
9
- 'dist/apprun-html': './src/apprun-html.ts',
10
- 'dist/apprun-dev-tools': './src/apprun-dev-tools.tsx',
11
- 'dist/createState': './src/createState.ts',
12
- 'jsx-runtime': './src/vdom.ts',
13
- 'demo/app': './demo/main.ts'
14
- },
15
- output: {
16
- filename: '[name].js',
17
- library: 'apprun',
18
- libraryTarget: 'umd',
19
- path: path.resolve(__dirname),
20
- globalObject: 'this'
21
- },
22
- resolve: {
23
- extensions: ['.ts', '.tsx', '.js']
24
- },
25
- module: {
26
- rules: [
27
- { test: /\.tsx?$/, loader: 'ts-loader' }
28
- ]
29
- },
30
- devServer: {
31
- open: true,
32
- static: path.join(__dirname),
33
- },
34
- devtool: 'source-map',
35
- plugins: [
36
- new webpack.DefinePlugin({
37
- // This tells Lit to run in production mode
38
- 'globalThis.DEV_MODE': JSON.stringify(false)
39
- })
40
- ]
41
- }