j-templates 7.0.26 → 7.0.28

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/DOM/elements.d.ts CHANGED
@@ -14,6 +14,14 @@ export declare const a: <T>(config: {
14
14
  on?: import("../Node/vNode.types").FunctionOr<import("../Node/vNode.types").vNodeEvents<HTMLElementEventMap>>;
15
15
  data?: () => T | Array<T> | Promise<Array<T>> | Promise<T>;
16
16
  }, children?: import("../Node/vNode.types").vNode[] | import("../Node/vNode.types").vNodeChildrenFunction<T>) => import("../Node/vNode.types").vNode;
17
+ export declare const b: <T>(config: {
18
+ props?: import("../Node/vNode.types").FunctionOr<import("../Utils/utils.types").RecursivePartial<HTMLElement>>;
19
+ attrs?: import("../Node/vNode.types").FunctionOr<{
20
+ [name: string]: string;
21
+ }>;
22
+ on?: import("../Node/vNode.types").FunctionOr<import("../Node/vNode.types").vNodeEvents<HTMLElementEventMap>>;
23
+ data?: () => T | Array<T> | Promise<Array<T>> | Promise<T>;
24
+ }, children?: import("../Node/vNode.types").vNode[] | import("../Node/vNode.types").vNodeChildrenFunction<T>) => import("../Node/vNode.types").vNode;
17
25
  export declare const button: <T>(config: {
18
26
  props?: import("../Node/vNode.types").FunctionOr<import("../Utils/utils.types").RecursivePartial<HTMLButtonElement>>;
19
27
  attrs?: import("../Node/vNode.types").FunctionOr<{
package/DOM/elements.js CHANGED
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.text = exports.video = exports.img = exports.td = exports.tr = exports.tbody = exports.table = exports.span = exports.input = exports.h1 = exports.button = exports.a = exports.div = void 0;
3
+ exports.text = exports.video = exports.img = exports.td = exports.tr = exports.tbody = exports.table = exports.span = exports.input = exports.h1 = exports.button = exports.b = exports.a = exports.div = void 0;
4
4
  const vNode_1 = require("../Node/vNode");
5
5
  exports.div = vNode_1.vNode.ToFunction("div");
6
6
  exports.a = vNode_1.vNode.ToFunction("a");
7
+ exports.b = vNode_1.vNode.ToFunction("b");
7
8
  exports.button = vNode_1.vNode.ToFunction("button");
8
9
  exports.h1 = vNode_1.vNode.ToFunction("h1");
9
10
  exports.input = vNode_1.vNode.ToFunction("input");
package/Node/vNode.js CHANGED
@@ -200,12 +200,13 @@ function DynamicChildren(vnode, children, data) {
200
200
  }));
201
201
  vnode.children = Store_1.ObservableScope.Value(childrenScope);
202
202
  }
203
+ function GetData(data) {
204
+ return data.data;
205
+ }
203
206
  function WrapDynamicChildren(dataScope, nodeList, injector, children) {
204
207
  return function () {
205
208
  const nextData = Store_1.ObservableScope.Value(dataScope);
206
- const nodeMap = list_1.List.ToNodeMap(nodeList, function (data) {
207
- return data.data;
208
- });
209
+ const nodeMap = list_1.List.ToNodeMap(nodeList, GetData);
209
210
  const nextNodeList = list_1.List.Create();
210
211
  const nextNodeArray = [];
211
212
  for (let x = 0; x < nextData.length; x++) {
@@ -222,26 +223,20 @@ function WrapDynamicChildren(dataScope, nodeList, injector, children) {
222
223
  list_1.List.RemoveNode(nodeList, existingNode);
223
224
  list_1.List.AddNode(nextNodeList, existingNode);
224
225
  if (existingNode.data.scope.dirty) {
225
- const newNodes = Store_1.ObservableScope.Value(existingNode.data.scope);
226
226
  vNode.DestroyAll(existingNode.data.nodes);
227
- existingNode.data.nodes = newNodes;
228
227
  existingNode.data.nodes = Store_1.ObservableScope.Value(existingNode.data.scope);
229
228
  }
230
229
  }
231
230
  else {
232
231
  const childrenScope = Store_1.ObservableScope.Create(function () {
233
232
  const childNodes = injector_1.Injector.Scope(injector, children, data);
234
- const nodes = Array.isArray(childNodes) ? childNodes : [childNodes];
235
- for (let x = 0; x < nodes.length; x++) {
236
- if (typeof nodes[x] === "string")
237
- nodes[x] = vNode.Create({
238
- type: "text",
239
- namespace: null,
240
- props: {
241
- nodeValue: nodes[x],
242
- },
243
- });
244
- }
233
+ const nodes = typeof childNodes === 'string' ? [vNode.Create({
234
+ type: 'text',
235
+ namespace: null,
236
+ props: {
237
+ nodeValue: childNodes
238
+ }
239
+ })] : Array.isArray(childNodes) ? childNodes : [childNodes];
245
240
  return nodes;
246
241
  });
247
242
  list_1.List.Add(nextNodeList, {
package/Utils/array.js CHANGED
@@ -34,7 +34,9 @@ function ReconcileSortedEmitters(left, right, add, remove) {
34
34
  let ri = rightIndex;
35
35
  for (; li < left.length && left[li][0] < right[ri][0]; li++)
36
36
  remove(left[li]);
37
- while (li < left.length && ri < right.length && left[li][0] === right[ri][0]) {
37
+ while (li < left.length &&
38
+ ri < right.length &&
39
+ left[li][0] === right[ri][0]) {
38
40
  li++;
39
41
  ri++;
40
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "j-templates",
3
- "version": "7.0.26",
3
+ "version": "7.0.28",
4
4
  "description": "j-templates",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/TypesInCode/jTemplates",