@ea-lab/reactive-json 1.0.0-alpha.7 → 1.0.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.
@@ -1,18 +1,18 @@
1
- import { jsx as n, jsxs as g, Fragment as v } from "react/jsx-runtime";
2
- import { useContext as x, useRef as A } from "react";
3
- import { ActionDependant as k } from "../../../engine/Actions.js";
4
- import { GlobalDataContext as y } from "../../../engine/GlobalDataContext.js";
5
- import { normalizeAttributesForReactJsx as h } from "../../../engine/utility/reactJsxHelpers.js";
6
- import { TemplateContext as C } from "../../../engine/TemplateContext.js";
7
- import { evaluateAttributes as j, evaluateTemplateValue as O } from "../../../engine/TemplateSystem.js";
8
- import { View as s } from "../../../engine/View.js";
9
- import { useTransformedAttributes as V } from "../../hook/useTransformedAttributes.js";
10
- const J = ({ props: t, currentData: u, datafield: D, path: T }) => {
11
- const m = x(y), f = x(C), c = A(null), d = `${t.tag}`, o = t.extra ?? {}, r = h(t.attributes), i = h(u.attributes);
1
+ import { jsx as n, jsxs as h, Fragment as x } from "react/jsx-runtime";
2
+ import { useContext as T, useRef as y } from "react";
3
+ import { ActionDependant as C } from "../../../engine/Actions.js";
4
+ import { GlobalDataContext as j } from "../../../engine/GlobalDataContext.js";
5
+ import { normalizeAttributesForReactJsx as k } from "../../../engine/utility/reactJsxHelpers.js";
6
+ import { TemplateContext as O } from "../../../engine/TemplateContext.js";
7
+ import { evaluateAttributes as V, evaluateTemplateValue as D } from "../../../engine/TemplateSystem.js";
8
+ import { View as u } from "../../../engine/View.js";
9
+ const J = ({ props: t, currentData: f, datafield: R, path: A }) => {
10
+ var v;
11
+ const c = T(j), m = T(O), l = y(null), d = `${t.tag}`, o = t.extra ?? {}, r = k(t.attributes), i = k(f.attributes);
12
12
  for (const e of Object.keys(i)) {
13
13
  if (e.charAt(0) === "+") {
14
- const l = e.substring(1);
15
- r[l] = (r[l] ?? "").length > 0 ? (
14
+ const s = e.substring(1);
15
+ r[s] = (r[s] ?? "").length > 0 ? (
16
16
  // Append using a space.
17
17
  " " + i[e]
18
18
  ) : (
@@ -23,22 +23,22 @@ const J = ({ props: t, currentData: u, datafield: D, path: T }) => {
23
23
  }
24
24
  r[e] = i[e];
25
25
  }
26
- const a = j({ attrs: r, globalDataContext: m, templateContext: f });
26
+ const a = V({ attrs: r, globalDataContext: c, templateContext: m });
27
27
  if (t.tag === "option" && t.content && a.value === void 0) {
28
28
  if (typeof t.content != "string")
29
29
  return null;
30
- const e = O({
30
+ const e = D({
31
31
  valueToEvaluate: t.content,
32
- globalDataContext: m,
33
- templateContext: f
32
+ globalDataContext: c,
33
+ templateContext: m
34
34
  });
35
35
  if (typeof e != "string")
36
36
  return null;
37
37
  a.value = e;
38
38
  }
39
39
  (t.tag === "input" || t.tag === "textarea" || t.tag === "select") && (a.value === void 0 && (a.value = ""), t.tag === "input" && (a.type === "checkbox" || a.type === "radio") && a.checked === void 0 && (a.checked = !1));
40
- const b = V(a, t.attributeTransforms ?? []);
41
- return /* @__PURE__ */ n(k, { ...t, attributesHolderRef: c, children: ((e) => e && [
40
+ const { useTransformedAttributes: g } = ((v = c.plugins) == null ? void 0 : v.hook) ?? {}, b = g ? g(a, t.attributeTransforms ?? []) : a;
41
+ return /* @__PURE__ */ n(C, { ...t, attributesHolderRef: l, children: ((e) => e && [
42
42
  "area",
43
43
  "base",
44
44
  "br",
@@ -53,20 +53,20 @@ const J = ({ props: t, currentData: u, datafield: D, path: T }) => {
53
53
  "source",
54
54
  "track",
55
55
  "wbr"
56
- ].indexOf(e) !== -1)(t.tag) ? /* @__PURE__ */ g(v, { children: [
57
- /* @__PURE__ */ n(d, { ref: c, ...b }),
58
- Object.keys(o).length ? /* @__PURE__ */ n(s, { props: o }) : ""
59
- ] }) : /* @__PURE__ */ g(v, { children: [
60
- /* @__PURE__ */ n(d, { ref: c, ...b, children: t.content && /* @__PURE__ */ n(
61
- s,
56
+ ].indexOf(e) !== -1)(t.tag) ? /* @__PURE__ */ h(x, { children: [
57
+ /* @__PURE__ */ n(d, { ref: l, ...b }),
58
+ Object.keys(o).length ? /* @__PURE__ */ n(u, { props: o }) : ""
59
+ ] }) : /* @__PURE__ */ h(x, { children: [
60
+ /* @__PURE__ */ n(d, { ref: l, ...b, children: t.content && /* @__PURE__ */ n(
61
+ u,
62
62
  {
63
- currentData: u.content ?? void 0,
63
+ currentData: f.content ?? void 0,
64
64
  datafield: "content",
65
- path: T + ".content",
65
+ path: A + ".content",
66
66
  props: t.content
67
67
  }
68
68
  ) }),
69
- Object.keys(o).length ? /* @__PURE__ */ n(s, { props: o }) : ""
69
+ Object.keys(o).length ? /* @__PURE__ */ n(u, { props: o }) : ""
70
70
  ] }) });
71
71
  };
72
72
  export {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ea-lab/reactive-json",
3
3
  "private": false,
4
- "version": "1.0.0-alpha.7",
4
+ "version": "1.0.1",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",