j-templates 7.0.38 → 7.0.40
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/LICENSE +21 -0
- package/README.md +36 -0
- package/{Node → lib/Node}/vNode.js +21 -1
- package/lib/package.json +13 -0
- package/package.json +39 -3
- /package/{DOM → lib/DOM}/createAssignment.d.ts +0 -0
- /package/{DOM → lib/DOM}/createAssignment.js +0 -0
- /package/{DOM → lib/DOM}/createAttributeAssignment.d.ts +0 -0
- /package/{DOM → lib/DOM}/createAttributeAssignment.js +0 -0
- /package/{DOM → lib/DOM}/createEventAssignment.d.ts +0 -0
- /package/{DOM → lib/DOM}/createEventAssignment.js +0 -0
- /package/{DOM → lib/DOM}/createPropertyAssignment.d.ts +0 -0
- /package/{DOM → lib/DOM}/createPropertyAssignment.js +0 -0
- /package/{DOM → lib/DOM}/domNodeConfig.d.ts +0 -0
- /package/{DOM → lib/DOM}/domNodeConfig.js +0 -0
- /package/{DOM → lib/DOM}/elements.d.ts +0 -0
- /package/{DOM → lib/DOM}/elements.js +0 -0
- /package/{DOM → lib/DOM}/index.d.ts +0 -0
- /package/{DOM → lib/DOM}/index.js +0 -0
- /package/{DOM → lib/DOM}/svgElements.d.ts +0 -0
- /package/{DOM → lib/DOM}/svgElements.js +0 -0
- /package/{DOM → lib/DOM}/window.d.ts +0 -0
- /package/{DOM → lib/DOM}/window.js +0 -0
- /package/{Node → lib/Node}/component.d.ts +0 -0
- /package/{Node → lib/Node}/component.js +0 -0
- /package/{Node → lib/Node}/component.types.d.ts +0 -0
- /package/{Node → lib/Node}/component.types.js +0 -0
- /package/{Node → lib/Node}/nodeConfig.d.ts +0 -0
- /package/{Node → lib/Node}/nodeConfig.js +0 -0
- /package/{Node → lib/Node}/vNode.d.ts +0 -0
- /package/{Node → lib/Node}/vNode.types.d.ts +0 -0
- /package/{Node → lib/Node}/vNode.types.js +0 -0
- /package/{Store → lib/Store}/Diff/diffAsync.d.ts +0 -0
- /package/{Store → lib/Store}/Diff/diffAsync.js +0 -0
- /package/{Store → lib/Store}/Diff/diffSync.d.ts +0 -0
- /package/{Store → lib/Store}/Diff/diffSync.js +0 -0
- /package/{Store → lib/Store}/Diff/diffTree.d.ts +0 -0
- /package/{Store → lib/Store}/Diff/diffTree.js +0 -0
- /package/{Store → lib/Store}/Diff/diffWorker.d.ts +0 -0
- /package/{Store → lib/Store}/Diff/diffWorker.js +0 -0
- /package/{Store → lib/Store}/Diff/workerQueue.d.ts +0 -0
- /package/{Store → lib/Store}/Diff/workerQueue.js +0 -0
- /package/{Store → lib/Store}/Store/store.d.ts +0 -0
- /package/{Store → lib/Store}/Store/store.js +0 -0
- /package/{Store → lib/Store}/Store/storeAsync.d.ts +0 -0
- /package/{Store → lib/Store}/Store/storeAsync.js +0 -0
- /package/{Store → lib/Store}/Store/storeSync.d.ts +0 -0
- /package/{Store → lib/Store}/Store/storeSync.js +0 -0
- /package/{Store → lib/Store}/Tree/observableNode.d.ts +0 -0
- /package/{Store → lib/Store}/Tree/observableNode.js +0 -0
- /package/{Store → lib/Store}/Tree/observableScope.d.ts +0 -0
- /package/{Store → lib/Store}/Tree/observableScope.js +0 -0
- /package/{Store → lib/Store}/index.d.ts +0 -0
- /package/{Store → lib/Store}/index.js +0 -0
- /package/{Utils → lib/Utils}/animation.d.ts +0 -0
- /package/{Utils → lib/Utils}/animation.js +0 -0
- /package/{Utils → lib/Utils}/array.d.ts +0 -0
- /package/{Utils → lib/Utils}/array.js +0 -0
- /package/{Utils → lib/Utils}/asyncQueue.d.ts +0 -0
- /package/{Utils → lib/Utils}/asyncQueue.js +0 -0
- /package/{Utils → lib/Utils}/avlTree.d.ts +0 -0
- /package/{Utils → lib/Utils}/avlTree.js +0 -0
- /package/{Utils → lib/Utils}/decorators.d.ts +0 -0
- /package/{Utils → lib/Utils}/decorators.js +0 -0
- /package/{Utils → lib/Utils}/distinctArray.d.ts +0 -0
- /package/{Utils → lib/Utils}/distinctArray.js +0 -0
- /package/{Utils → lib/Utils}/emitter.d.ts +0 -0
- /package/{Utils → lib/Utils}/emitter.js +0 -0
- /package/{Utils → lib/Utils}/functions.d.ts +0 -0
- /package/{Utils → lib/Utils}/functions.js +0 -0
- /package/{Utils → lib/Utils}/index.d.ts +0 -0
- /package/{Utils → lib/Utils}/index.js +0 -0
- /package/{Utils → lib/Utils}/injector.d.ts +0 -0
- /package/{Utils → lib/Utils}/injector.js +0 -0
- /package/{Utils → lib/Utils}/json.d.ts +0 -0
- /package/{Utils → lib/Utils}/json.js +0 -0
- /package/{Utils → lib/Utils}/jsonType.d.ts +0 -0
- /package/{Utils → lib/Utils}/jsonType.js +0 -0
- /package/{Utils → lib/Utils}/list.d.ts +0 -0
- /package/{Utils → lib/Utils}/list.js +0 -0
- /package/{Utils → lib/Utils}/router.d.ts +0 -0
- /package/{Utils → lib/Utils}/router.js +0 -0
- /package/{Utils → lib/Utils}/thread.d.ts +0 -0
- /package/{Utils → lib/Utils}/thread.js +0 -0
- /package/{Utils → lib/Utils}/utils.types.d.ts +0 -0
- /package/{Utils → lib/Utils}/utils.types.js +0 -0
- /package/{index.d.ts → lib/index.d.ts} +0 -0
- /package/{index.debug.d.ts → lib/index.debug.d.ts} +0 -0
- /package/{index.debug.js → lib/index.debug.js} +0 -0
- /package/{index.js → lib/index.js} +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 TypesInCode
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# j-templates
|
|
2
|
+
Type-safe templating for the browser.
|
|
3
|
+
## Install
|
|
4
|
+
```
|
|
5
|
+
npm install --save-dev j-templates
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
Framework for building reactive browser applications:
|
|
9
|
+
* TypeScript only - no extra transpile or compile steps
|
|
10
|
+
* Bundler agnostic - bundle using your preferred library
|
|
11
|
+
* Low dependencies - hello world only requires this + a bundler to get started
|
|
12
|
+
|
|
13
|
+
## Hello World
|
|
14
|
+
```typescript
|
|
15
|
+
import { Component } from 'j-templates';
|
|
16
|
+
import { div } from 'j-templates/DOM';
|
|
17
|
+
|
|
18
|
+
class HelloWorld extends Component {
|
|
19
|
+
|
|
20
|
+
public Template() {
|
|
21
|
+
return div({}, () => "Hello world");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var helloWorld = Component.ToFunction("hello-world", HelloWorld);
|
|
27
|
+
Component.Attach(document.body, helloWorld({}));
|
|
28
|
+
```
|
|
29
|
+
### Resulting HTML
|
|
30
|
+
```html
|
|
31
|
+
<hello-world>
|
|
32
|
+
<div>Hello world</div>
|
|
33
|
+
</hello-world>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
[More Examples](https://typesincode.github.io/jTemplates/)
|
|
@@ -163,7 +163,6 @@ function CreateChildrenScope(vnode, children, data) {
|
|
|
163
163
|
}
|
|
164
164
|
const nodeList = list_1.List.Create();
|
|
165
165
|
const scope = Store_1.ObservableScope.Create(WrapChildren(vnode.injector, children, ToArray(data), nodeList));
|
|
166
|
-
scope.async = dataIsAsync;
|
|
167
166
|
Store_1.ObservableScope.OnDestroyed(scope, function () {
|
|
168
167
|
DestroyNodeList(nodeList);
|
|
169
168
|
});
|
|
@@ -183,6 +182,27 @@ function WrapChildren(injector, children, data, nodeList) {
|
|
|
183
182
|
case 0:
|
|
184
183
|
DestroyNodeList(nodeList);
|
|
185
184
|
return [];
|
|
185
|
+
case 1: {
|
|
186
|
+
const data = nextData[0];
|
|
187
|
+
const node = nodeList.head;
|
|
188
|
+
DestroyNodeList(nodeList);
|
|
189
|
+
if (node && node.data.data === data) {
|
|
190
|
+
node.data.nodes = Store_1.ObservableScope.Value(node.data.scope);
|
|
191
|
+
list_1.List.AddNode(nodeList, node);
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
const childrenScope = Store_1.ObservableScope.Create(function () {
|
|
195
|
+
const childNodes = injector_1.Injector.Scope(injector, children, data);
|
|
196
|
+
return CreateNodeArray(childNodes);
|
|
197
|
+
});
|
|
198
|
+
list_1.List.Add(nodeList, {
|
|
199
|
+
data,
|
|
200
|
+
nodes: Store_1.ObservableScope.Value(childrenScope),
|
|
201
|
+
scope: childrenScope
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
return nodeList.head.data.nodes;
|
|
205
|
+
}
|
|
186
206
|
default: {
|
|
187
207
|
const nodeListMap = list_1.List.ToListMap(nodeList, GetData);
|
|
188
208
|
const nextNodeList = list_1.List.Create();
|
package/lib/package.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "j-templates",
|
|
3
|
+
"version": "7.0.40",
|
|
4
|
+
"description": "j-templates",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": "https://github.com/TypesInCode/jTemplates",
|
|
7
|
+
"author": "Jay Landrum",
|
|
8
|
+
"keywords": [
|
|
9
|
+
""
|
|
10
|
+
],
|
|
11
|
+
"main": "./index.js",
|
|
12
|
+
"typings": "./index.d.ts"
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "j-templates",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.40",
|
|
4
4
|
"description": "j-templates",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/TypesInCode/jTemplates",
|
|
@@ -8,6 +8,42 @@
|
|
|
8
8
|
"keywords": [
|
|
9
9
|
""
|
|
10
10
|
],
|
|
11
|
-
"
|
|
12
|
-
|
|
11
|
+
"files": [
|
|
12
|
+
"lib"
|
|
13
|
+
],
|
|
14
|
+
"main": "lib/index.js",
|
|
15
|
+
"typings": "lib/index.d.ts",
|
|
16
|
+
"scripts": {
|
|
17
|
+
"clean": "rimraf lib",
|
|
18
|
+
"build": "npm run buildquick && node ./tools/copy-package-json.js",
|
|
19
|
+
"buildquick": "npm run clean && echo Using TypeScript && tsc --version && tsc --pretty",
|
|
20
|
+
"builddocs": "typedoc --out docs src/index.ts src/DOM/index.ts src/Utils/index.ts src/Store/index.ts && touch docs/.nojekyll",
|
|
21
|
+
"test": "mocha --require ts-node/register --recursive test/**/*-spec.ts",
|
|
22
|
+
"testcoverage": "nyc mocha --require ts-node/register --required source-map-support/register --recursive test/**/*-spec.ts"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/chai": "3.4.30",
|
|
26
|
+
"@types/mocha": "2.2.29",
|
|
27
|
+
"@types/node": "^13.1.2",
|
|
28
|
+
"chai": "^3.5.0",
|
|
29
|
+
"fs-extra": "^8.1.0",
|
|
30
|
+
"jsdom": "^13.2.0",
|
|
31
|
+
"mocha": "^7.0.0",
|
|
32
|
+
"nyc": "^15.1.0",
|
|
33
|
+
"rimraf": "^2.5.4",
|
|
34
|
+
"ts-node": "^10.9.2",
|
|
35
|
+
"typedoc": "^0.26.10",
|
|
36
|
+
"typescript": "^5.5.3"
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=4.0.0"
|
|
40
|
+
},
|
|
41
|
+
"nyc": {
|
|
42
|
+
"extension": [
|
|
43
|
+
".ts"
|
|
44
|
+
],
|
|
45
|
+
"reporter": [
|
|
46
|
+
"html"
|
|
47
|
+
]
|
|
48
|
+
}
|
|
13
49
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|