@ea-lab/reactive-json 0.7.1 → 1.0.0-alpha.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.
Files changed (93) hide show
  1. package/README.md +1 -3
  2. package/dist/View-D8TN1L2h.js +126 -0
  3. package/dist/assets/VariablesDebug.css +1 -4
  4. package/dist/assets/reset.css +4 -0
  5. package/dist/assets/usePagination.css +1 -0
  6. package/dist/component/action/HashChangeListener.js +29 -7
  7. package/dist/component/action/MessageListener.js +26 -8
  8. package/dist/component/action/ReactOnEvent.js +64 -8
  9. package/dist/component/action/Redirect.js +9 -5
  10. package/dist/component/action/SetAttributeValue.js +37 -5
  11. package/dist/component/action/ToggleAttributeValue.js +56 -5
  12. package/dist/component/action/UnsetAttribute.js +20 -5
  13. package/dist/component/action/UnsetAttributeValue.js +58 -5
  14. package/dist/component/action/index.js +19 -15
  15. package/dist/component/dataMapping/index.js +6 -3
  16. package/dist/component/dataMapping/simpleMapping.js +93 -2
  17. package/dist/component/element/debug/VariablesDebug/VariablesDebug.js +110 -12
  18. package/dist/component/element/debug/index.js +2 -2
  19. package/dist/component/element/html/FolderSortableTree.js +133 -7
  20. package/dist/component/element/html/FormatNumeral.js +58 -6
  21. package/dist/component/element/html/Html.js +5 -3
  22. package/dist/component/element/html/LabelFromValue.js +27 -6
  23. package/dist/component/element/html/PreformattedMarkup.js +51 -6
  24. package/dist/component/element/html/SortableTreeItemCollapseButton.js +10 -5
  25. package/dist/component/element/html/index.js +11 -10
  26. package/dist/component/element/index.js +34 -29
  27. package/dist/component/element/special/Count.js +23 -12
  28. package/dist/component/element/special/DataFilter.js +76 -6
  29. package/dist/component/element/special/DelayedActions.js +47 -7
  30. package/dist/component/element/special/Phantom.js +13 -3
  31. package/dist/component/element/special/ReactiveJsonBasicComponentWrapper.js +32 -0
  32. package/dist/component/element/special/ReactiveJsonSubroot.js +8 -5
  33. package/dist/component/element/special/Switch.js +80 -8
  34. package/dist/component/element/special/index.js +16 -10
  35. package/dist/component/hook/index.js +1 -1
  36. package/dist/component/hook/usePagination.js +172 -4
  37. package/dist/component/index.js +84 -62
  38. package/dist/component/reaction/addData.js +23 -3
  39. package/dist/component/reaction/fetchData.js +12 -2
  40. package/dist/component/reaction/index.js +34 -12
  41. package/dist/component/reaction/moveData.js +34 -2
  42. package/dist/component/reaction/postMessage.js +23 -2
  43. package/dist/component/reaction/redirectNow.js +6 -2
  44. package/dist/component/reaction/removeData.js +27 -2
  45. package/dist/component/reaction/setClipboardData.js +16 -2
  46. package/dist/component/reaction/setData.js +22 -3
  47. package/dist/component/reaction/submitData.js +25 -2
  48. package/dist/component/reaction/utility/httpRequestCommon.js +5 -4
  49. package/dist/component/reaction/utility/index.js +1 -1
  50. package/dist/coreComponentsPlugin.js +5 -2
  51. package/dist/dnd-kit-sortable-tree.esm-Cz1RJyIg.js +4135 -0
  52. package/dist/engine/Actions.js +161 -10
  53. package/dist/engine/ParsingDebugDisplay/ParsingDebugDisplay.js +692 -3
  54. package/dist/engine/ReactiveJsonRoot.js +10 -5
  55. package/dist/engine/TemplateSystem.js +117 -11
  56. package/dist/engine/View.js +3 -6
  57. package/dist/engine/index.js +45 -40
  58. package/dist/engine/utility/alterData.js +27 -2
  59. package/dist/engine/utility/analyzeDataOverrideReferences.js +41 -2
  60. package/dist/engine/utility/formElementsCommon.js +34 -0
  61. package/dist/engine/utility/formatString.js +19 -3
  62. package/dist/engine/utility/index.js +15 -12
  63. package/dist/engine/utility/parseRjBuild.js +23 -1002
  64. package/dist/engine/utility/reactJsxHelpers.js +15 -0
  65. package/dist/httpRequestCommon-DUo2Oxgl.js +1799 -0
  66. package/dist/index-B3RKTGQ2.js +18 -0
  67. package/dist/index-BA09SSaJ.js +26 -0
  68. package/dist/index-BYLJtf9L.js +462 -0
  69. package/dist/index-CACLSxWi.js +8 -0
  70. package/dist/index-NNBvIV0S.js +1873 -0
  71. package/dist/js-yaml-Bw0KO4XO.js +983 -0
  72. package/dist/jsonpath-B9kE9k9e.js +3168 -0
  73. package/dist/{alterData-CjaFWyAA.js → lodash-CYNxjS-I.js} +1348 -1368
  74. package/dist/main.js +127 -101
  75. package/package.json +4 -4
  76. package/dist/ParsingDebugDisplay-8f4yL4Jw.js +0 -696
  77. package/dist/VariablesDebug-1UzZWgD7.js +0 -17782
  78. package/dist/component/action/Popover.js +0 -6
  79. package/dist/component/action/Tooltip.js +0 -5
  80. package/dist/component/element/form/CheckBoxField.js +0 -8
  81. package/dist/component/element/form/DateField.js +0 -8
  82. package/dist/component/element/form/NumberField.js +0 -8
  83. package/dist/component/element/form/SelectField.js +0 -8
  84. package/dist/component/element/form/TextAreaField.js +0 -8
  85. package/dist/component/element/form/TextField.js +0 -8
  86. package/dist/component/element/form/formElementsCommon.js +0 -4
  87. package/dist/component/element/form/index.js +0 -10
  88. package/dist/component/element/html/AccordionItem.js +0 -6
  89. package/dist/component/element/html/Modal.js +0 -8
  90. package/dist/component/element/html/Tabs.js +0 -8
  91. package/dist/component/element/special/BootstrapElement.js +0 -5
  92. package/dist/engine/PaginationProvider.js +0 -30
  93. package/dist/usePagination-Bb6lefHG.js +0 -353
package/README.md CHANGED
@@ -144,11 +144,9 @@ This project was bootstrapped with [Vite](https://vite.dev/).
144
144
  This is where the main component code is located.
145
145
 
146
146
  We provided a basic set of components that people will mostly need.
147
- Those components usually wrap around famous third-party libs such as
148
- *React-Bootstrap* and *Chart.js*.
149
147
 
150
148
  Of course, you can add your own components in your React project,
151
- by following the same pattern.
149
+ by following the same pattern, or extend by using plugins.
152
150
 
153
151
  #### Actions `/lib/component/action`
154
152
 
@@ -0,0 +1,126 @@
1
+ import { jsx as n, jsxs as x, Fragment as C } from "react/jsx-runtime";
2
+ import { useContext as h, useRef as j } from "react";
3
+ import { ActionDependant as k } from "./engine/Actions.js";
4
+ import { GlobalDataContext as D } from "./engine/GlobalDataContext.js";
5
+ import { normalizeAttributesForReactJsx as A } from "./engine/utility/reactJsxHelpers.js";
6
+ import { TemplateContext as T } from "./engine/TemplateContext.js";
7
+ import H, { evaluateAttributes as R, evaluateTemplateValue as V, dataLocationToPath as O } from "./engine/TemplateSystem.js";
8
+ const y = ({ props: t, currentData: o, datafield: s, path: l }) => {
9
+ const d = h(D), b = h(T), r = j(null), c = `${t.tag}`, f = t.extra ?? {}, e = A(t.attributes), a = A(o.attributes);
10
+ for (const i of Object.keys(a)) {
11
+ if (i.charAt(0) === "+") {
12
+ const g = i.substring(1);
13
+ e[g] = (e[g] ?? "").length > 0 ? (
14
+ // Append using a space.
15
+ " " + a[i]
16
+ ) : (
17
+ // Set directly.
18
+ a[i]
19
+ );
20
+ continue;
21
+ }
22
+ e[i] = a[i];
23
+ }
24
+ const u = R({ attrs: e, globalDataContext: d, templateContext: b });
25
+ return /* @__PURE__ */ n(k, { ...t, attributesHolderRef: r, children: ((i) => i && [
26
+ "area",
27
+ "base",
28
+ "br",
29
+ "col",
30
+ "embed",
31
+ "hr",
32
+ "img",
33
+ "input",
34
+ "link",
35
+ "meta",
36
+ "param",
37
+ "source",
38
+ "track",
39
+ "wbr"
40
+ ].indexOf(i) !== -1)(t.tag) ? /* @__PURE__ */ x(C, { children: [
41
+ /* @__PURE__ */ n(c, { ref: r, ...u }),
42
+ Object.keys(f).length ? /* @__PURE__ */ n(m, { props: f }) : ""
43
+ ] }) : /* @__PURE__ */ x(C, { children: [
44
+ /* @__PURE__ */ n(c, { ref: r, ...u, children: t.content && /* @__PURE__ */ n(
45
+ m,
46
+ {
47
+ currentData: o.content ?? void 0,
48
+ datafield: "content",
49
+ path: l + ".content",
50
+ props: t.content
51
+ }
52
+ ) }),
53
+ Object.keys(f).length ? /* @__PURE__ */ n(m, { props: f }) : ""
54
+ ] }) });
55
+ };
56
+ function m({ props: t, currentData: o, datafield: s, path: l }) {
57
+ const d = h(D), b = h(T), r = d.plugins ?? {}, c = (r == null ? void 0 : r.element) ?? {};
58
+ if (!c)
59
+ return null;
60
+ const { element: f } = d;
61
+ if (o === void 0 && (o = ""), t != null && t.type) {
62
+ let e = c[t.type] ?? void 0;
63
+ return e === void 0 && (e = c.Html ?? y), (c.Html ?? y) === e && (t.tag = t.tag ?? t.type), /* @__PURE__ */ n(e, { path: l, props: t, currentData: o, datafield: s });
64
+ }
65
+ if (t != null && t.load) {
66
+ let e;
67
+ const a = (t == null ? void 0 : t.customDataLocation) ?? void 0, u = a ? (
68
+ // The data is located somewhere in the current data.
69
+ V({
70
+ globalDataContext: d,
71
+ templateContext: b,
72
+ valueToEvaluate: a
73
+ })
74
+ ) : (
75
+ // The data is the current data.
76
+ o
77
+ ), v = a ? O({
78
+ dataLocation: a,
79
+ currentPath: l,
80
+ globalDataContext: d,
81
+ templateContext: b
82
+ }) : l;
83
+ typeof t.load == "function" ? e = t.load(u) : e = f[t.load];
84
+ const { load: i, customDataLocation: g, ...L } = t;
85
+ return e = { ...e, ...L }, t.keepTemplateContext ? /* @__PURE__ */ n(
86
+ m,
87
+ {
88
+ currentData: u,
89
+ datafield: s,
90
+ path: v,
91
+ props: e
92
+ }
93
+ ) : /* @__PURE__ */ n(T.Provider, { value: { templateData: u, templatePath: v }, children: /* @__PURE__ */ n(
94
+ m,
95
+ {
96
+ currentData: u,
97
+ datafield: s,
98
+ path: v,
99
+ props: e
100
+ }
101
+ ) });
102
+ }
103
+ return Array.isArray(t) ? t.map((e, a) => /* @__PURE__ */ n(
104
+ m,
105
+ {
106
+ currentData: o[a] ?? void 0,
107
+ datafield: a,
108
+ path: l + "." + a,
109
+ props: e ?? void 0
110
+ },
111
+ l + "." + a
112
+ )) : typeof t == "object" ? Object.entries(t).map(([e, a]) => /* @__PURE__ */ n(
113
+ m,
114
+ {
115
+ currentData: o[e] ?? void 0,
116
+ datafield: e ?? void 0,
117
+ path: l + "." + e,
118
+ props: a
119
+ },
120
+ l + "." + e
121
+ )) : /* @__PURE__ */ n(H, { valueToEvaluate: o || (t ?? null) });
122
+ }
123
+ export {
124
+ y as H,
125
+ m as V
126
+ };
@@ -1,4 +1 @@
1
- /*!
2
- https://serp.co/tools/css-reset/
3
- <link rel="stylesheet" href="https://css.serp.co/css-reset/normalize.css/">
4
- */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}._debugRoot_n8k8a_1{position:fixed;bottom:12px;right:12px;display:flex;flex-direction:column;align-items:stretch;gap:8px;width:min(560px,96vw);max-height:70vh;overflow-y:auto;z-index:9998;pointer-events:none}._container_n8k8a_16{position:relative;bottom:auto;right:auto;background-color:#111827;color:#e5e7eb;padding:10px;border-radius:8px;box-shadow:0 2px 12px #0000004d;cursor:pointer;border:1px solid #374151;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;z-index:9999;width:100%;overflow:hidden;pointer-events:auto}._container_n8k8a_16._expanded_n8k8a_35{width:100%;max-height:64vh}._header_n8k8a_40{display:flex;align-items:center;justify-content:space-between}._actions_n8k8a_46{display:flex;gap:8px}._btn_n8k8a_51{background:transparent;color:#e5e7eb;border:1px solid #4b5563;border-radius:6px;padding:2px 8px}._btn_n8k8a_51._active_n8k8a_59{background:#1f2937}._path_n8k8a_63{color:#93c5fd}._value_n8k8a_67{color:#fbbf24}._copyBtn_n8k8a_71{transition:background-color .2s ease-in-out}._copyBtnSuccess_n8k8a_75{background-color:#10b932}._copyBtnError_n8k8a_79{background-color:#ef4444}._info_n8k8a_83{margin-top:8px}@media (max-width: 480px){._debugRoot_n8k8a_1{right:8px;left:8px;width:auto}}
1
+ ._debugRoot_1ny7q_1{position:fixed;bottom:12px;right:12px;display:flex;flex-direction:column;align-items:stretch;gap:8px;width:min(560px,96vw);max-height:70vh;overflow-y:auto;z-index:9998;pointer-events:none}._container_1ny7q_16{position:relative;bottom:auto;right:auto;background-color:#111827;color:#e5e7eb;padding:10px;border-radius:8px;box-shadow:0 2px 12px #0000004d;cursor:pointer;border:1px solid #374151;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;z-index:9999;width:100%;overflow:hidden;pointer-events:auto}._container_1ny7q_16._expanded_1ny7q_34{width:100%;max-height:64vh}._header_1ny7q_39{display:flex;align-items:center;justify-content:space-between}._actions_1ny7q_45{display:flex;gap:8px}._btn_1ny7q_50{background:transparent;color:#e5e7eb;border:1px solid #4b5563;border-radius:6px;padding:2px 8px}._btn_1ny7q_50._active_1ny7q_58{background:#1f2937}._path_1ny7q_62{color:#93c5fd}._value_1ny7q_66{color:#fbbf24}._copyBtn_1ny7q_70{transition:background-color .2s ease-in-out}._copyBtnSuccess_1ny7q_74{background-color:#10b932}._copyBtnError_1ny7q_78{background-color:#ef4444}._info_1ny7q_82{margin-top:8px}@media (max-width: 480px){._debugRoot_1ny7q_1{right:8px;left:8px;width:auto}}
@@ -0,0 +1,4 @@
1
+ /*!
2
+ https://serp.co/tools/css-reset/
3
+ <link rel="stylesheet" href="https://css.serp.co/css-reset/normalize.css/">
4
+ */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}
@@ -0,0 +1 @@
1
+ ._paginationContainer_1uiid_1{display:flex;flex-wrap:wrap;align-items:center;gap:.25rem;padding:0;margin:0;list-style:none}._paginationFirst_1uiid_11,._paginationPrev_1uiid_12,._paginationItem_1uiid_13,._paginationNext_1uiid_14,._paginationLast_1uiid_15{position:relative;display:block;padding:.375rem .75rem;margin-left:-1px;line-height:1.25;color:#007bff;text-decoration:none;background-color:#fff;border:1px solid #dee2e6;cursor:pointer;font-family:inherit;font-size:inherit;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out}._paginationFirst_1uiid_11:hover:not(:disabled),._paginationPrev_1uiid_12:hover:not(:disabled),._paginationItem_1uiid_13:hover:not(:disabled),._paginationNext_1uiid_14:hover:not(:disabled),._paginationLast_1uiid_15:hover:not(:disabled){z-index:2;color:#0056b3;text-decoration:none;background-color:#e9ecef;border-color:#dee2e6}._paginationFirst_1uiid_11:focus,._paginationPrev_1uiid_12:focus,._paginationItem_1uiid_13:focus,._paginationNext_1uiid_14:focus,._paginationLast_1uiid_15:focus{z-index:3;outline:0;box-shadow:0 0 0 .2rem #007bff40}._paginationFirst_1uiid_11:disabled,._paginationPrev_1uiid_12:disabled,._paginationItem_1uiid_13:disabled,._paginationNext_1uiid_14:disabled,._paginationLast_1uiid_15:disabled{color:#6c757d;pointer-events:none;background-color:#fff;border-color:#dee2e6;cursor:not-allowed;opacity:.65}._paginationFirst_1uiid_11{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}._paginationItem_1uiid_13._active_1uiid_71{z-index:3;color:#fff;background-color:#007bff;border-color:#007bff}._paginationLast_1uiid_15{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}._paginationEllipsis_1uiid_83{position:relative;display:block;padding:.375rem .75rem;margin-left:-1px;line-height:1.25;color:#6c757d;background-color:#fff;border:1px solid #dee2e6;cursor:default}
@@ -1,9 +1,31 @@
1
- import "react/jsx-runtime";
2
- import "react";
3
- import "../../engine/EventDispatcherContext.js";
4
- import "../../engine/GlobalDataContext.js";
5
- import "../../engine/TemplateContext.js";
6
- import { H as a } from "../../VariablesDebug-1UzZWgD7.js";
1
+ import { jsx as C, Fragment as H } from "react/jsx-runtime";
2
+ import { useContext as h, useEffect as E } from "react";
3
+ import { EventDispatcherContext as x } from "../../engine/EventDispatcherContext.js";
4
+ import { GlobalDataContext as L } from "../../engine/GlobalDataContext.js";
5
+ import { TemplateContext as T } from "../../engine/TemplateContext.js";
6
+ import { evaluateTemplateValueCollection as d } from "../../engine/TemplateSystem.js";
7
+ const R = (a) => {
8
+ const e = h(x), n = h(L), o = h(T), s = n.plugins ?? {}, f = (s == null ? void 0 : s.reaction) ?? {}, t = (a == null ? void 0 : a.actionProps) ?? void 0;
9
+ return E(() => {
10
+ const v = t ?? void 0, r = (t == null ? void 0 : t.what) ?? void 0, w = (t == null ? void 0 : t.whenHashIs) ?? void 0, g = (t == null ? void 0 : t.whenHashWas) ?? void 0, i = d({
11
+ globalDataContext: n,
12
+ templateContext: o,
13
+ valueToEvaluate: w
14
+ }), c = d({
15
+ globalDataContext: n,
16
+ templateContext: o,
17
+ valueToEvaluate: g
18
+ }), m = (l) => {
19
+ if (typeof i == "string" && new URL(l.newUrl).hash !== i || typeof c == "string" && new URL(l.oldUrl).hash !== c)
20
+ return;
21
+ const u = r && (f[r] ?? void 0);
22
+ u && u({ args: v, event: l, globalDataContext: n, templateContext: o });
23
+ };
24
+ return e == null || e.addEventListener("hashchange", m), () => {
25
+ e == null || e.removeEventListener("hashchange", m);
26
+ };
27
+ }, [e, n, t, o]), /* @__PURE__ */ C(H, { children: a.children });
28
+ };
7
29
  export {
8
- a as HashChangeListener
30
+ R as HashChangeListener
9
31
  };
@@ -1,10 +1,28 @@
1
- import "react/jsx-runtime";
2
- import "../../alterData-CjaFWyAA.js";
3
- import "react";
4
- import "../../engine/EventDispatcherContext.js";
5
- import "../../engine/GlobalDataContext.js";
6
- import "../../engine/TemplateContext.js";
7
- import { M as a } from "../../VariablesDebug-1UzZWgD7.js";
1
+ import { jsx as v, Fragment as E } from "react/jsx-runtime";
2
+ import { l as w } from "../../lodash-CYNxjS-I.js";
3
+ import { useContext as r, useEffect as x } from "react";
4
+ import { EventDispatcherContext as C } from "../../engine/EventDispatcherContext.js";
5
+ import { GlobalDataContext as h } from "../../engine/GlobalDataContext.js";
6
+ import { TemplateContext as M } from "../../engine/TemplateContext.js";
7
+ import { evaluateTemplateValueCollection as T } from "../../engine/TemplateSystem.js";
8
+ const G = (e) => {
9
+ const o = r(C), n = r(h), a = r(M), s = n.plugins ?? {}, d = (s == null ? void 0 : s.reaction) ?? {}, t = (e == null ? void 0 : e.actionProps) ?? void 0;
10
+ return x(() => {
11
+ const u = t ?? void 0, l = (t == null ? void 0 : t.what) ?? void 0, f = (t == null ? void 0 : t.whenMessageIs) ?? void 0, g = T({
12
+ globalDataContext: n,
13
+ templateContext: a,
14
+ valueToEvaluate: f
15
+ }), m = (i) => {
16
+ if (i.origin !== window.location.origin || !w.isEqual(i.data, g))
17
+ return;
18
+ const c = l && (d[l] ?? void 0);
19
+ c && c({ args: u, event: i, globalDataContext: n, templateContext: a });
20
+ };
21
+ return o == null || o.addEventListener("message", m), () => {
22
+ o == null || o.removeEventListener("message", m);
23
+ };
24
+ }, [o, n, t, a]), /* @__PURE__ */ v(E, { children: e.children });
25
+ };
8
26
  export {
9
- a as MessageListener
27
+ G as MessageListener
10
28
  };
@@ -1,10 +1,66 @@
1
- import "react/jsx-runtime";
2
- import "react";
3
- import "../../engine/GlobalDataContext.js";
4
- import "../../engine/TemplateContext.js";
5
- import { R as a, r as e } from "../../VariablesDebug-1UzZWgD7.js";
6
- import "../reaction/triggerEvent.js";
1
+ import { jsx as A, Fragment as C } from "react/jsx-runtime";
2
+ import { useContext as E, Children as d, Fragment as h, isValidElement as j, cloneElement as k } from "react";
3
+ import { GlobalDataContext as R } from "../../engine/GlobalDataContext.js";
4
+ import { TemplateContext as L } from "../../engine/TemplateContext.js";
5
+ const w = (s) => {
6
+ const f = E(R), g = E(L), a = f.plugins ?? {}, P = (a == null ? void 0 : a.reaction) ?? {}, { actionProps: y } = s, p = {}, u = "<reactive-json:event>", v = "<reactive-json:event-new-value>", F = (e) => {
7
+ if (e && e.target) {
8
+ const r = e.target;
9
+ if (r.type === "checkbox")
10
+ return r.checked;
11
+ if (r.type === "radio")
12
+ return r.checked ? r.value : void 0;
13
+ if (typeof r.value < "u")
14
+ return r.value;
15
+ if (typeof r.checked < "u")
16
+ return r.checked;
17
+ }
18
+ }, b = (e, r) => {
19
+ if (e === v)
20
+ return F(r);
21
+ if (typeof e != "string" || !e.startsWith(u))
22
+ return e;
23
+ let t = e.slice(u.length);
24
+ if (t.startsWith(".") && (t = t.slice(1)), !!t)
25
+ return t.split(".").reduce((n, o) => n ? n[o] : void 0, r);
26
+ }, i = (e, r) => {
27
+ if (Array.isArray(e))
28
+ return e.map((t) => i(t, r));
29
+ if (e && typeof e == "object") {
30
+ const t = {};
31
+ for (const [n, o] of Object.entries(e))
32
+ t[n] = i(o, r);
33
+ return t;
34
+ }
35
+ return b(e, r);
36
+ };
37
+ for (const [e, r] of Object.entries(y))
38
+ p[e] = (t) => {
39
+ let n = !0;
40
+ for (const o of r) {
41
+ if (!o)
42
+ continue;
43
+ const m = o.what && (P[o.what] ?? null);
44
+ if (!m)
45
+ continue;
46
+ const c = i(o, t);
47
+ if (m({ args: c, event: t, globalDataContext: f, templateContext: g }), c.stopPropagation === !0)
48
+ break;
49
+ n = c.stopPropagation ?? !0;
50
+ }
51
+ n !== !1 && t.stopPropagation();
52
+ };
53
+ const l = (e) => {
54
+ if (!e)
55
+ return e;
56
+ const r = d.toArray(e);
57
+ return d.map(r, (t) => {
58
+ var n;
59
+ return t.type === h ? l((n = t == null ? void 0 : t.props) == null ? void 0 : n.children) : typeof t != "object" || !j(t) ? t : k(t, p);
60
+ });
61
+ }, x = l(s.children);
62
+ return /* @__PURE__ */ A(C, { children: x });
63
+ };
7
64
  export {
8
- a as ReactOnEvent,
9
- e as reactionFunctions
65
+ w as ReactOnEvent
10
66
  };
@@ -1,7 +1,11 @@
1
- import "react";
2
- import "../../engine/GlobalDataContext.js";
3
- import "../../engine/TemplateContext.js";
4
- import { a as p } from "../../VariablesDebug-1UzZWgD7.js";
1
+ import { useContext as o } from "react";
2
+ import { GlobalDataContext as n } from "../../engine/GlobalDataContext.js";
3
+ import { TemplateContext as l } from "../../engine/TemplateContext.js";
4
+ import { evaluateTemplateValue as m } from "../../engine/TemplateSystem.js";
5
+ const s = (e) => {
6
+ const a = o(n), r = o(l), { to: t } = e.actionProps;
7
+ !t || typeof t != "string" || (window.location.href = m({ valueToEvaluate: t, globalDataContext: a, templateContext: r }));
8
+ };
5
9
  export {
6
- p as Redirect
10
+ s as Redirect
7
11
  };
@@ -1,7 +1,39 @@
1
- import "react";
2
- import "../../engine/GlobalDataContext.js";
3
- import "../../engine/TemplateContext.js";
4
- import { S as m } from "../../VariablesDebug-1UzZWgD7.js";
1
+ import { useContext as f, useEffect as V } from "react";
2
+ import { GlobalDataContext as d } from "../../engine/GlobalDataContext.js";
3
+ import { TemplateContext as x } from "../../engine/TemplateContext.js";
4
+ import { evaluateTemplateValue as b } from "../../engine/TemplateSystem.js";
5
+ const T = (a) => {
6
+ const l = f(d), c = f(x), { attributesHolderRef: t } = a, { name: e, mode: s = "append", value: n, preventDuplicateValues: i = !0, separator: o = " " } = a.actionProps;
7
+ return V(() => {
8
+ if (!(t != null && t.current) || !e || n === void 0)
9
+ return;
10
+ const r = String(
11
+ b({
12
+ valueToEvaluate: n,
13
+ globalDataContext: l,
14
+ templateContext: c
15
+ })
16
+ ), u = t.current;
17
+ if (s === "replace")
18
+ u.setAttribute(e, r);
19
+ else {
20
+ const m = u.getAttribute(e) || "", p = m ? m.split(o) : [];
21
+ if (!i || !p.includes(r)) {
22
+ const v = [...p, r];
23
+ u.setAttribute(e, v.join(o));
24
+ }
25
+ }
26
+ }, [
27
+ e,
28
+ s,
29
+ n,
30
+ i,
31
+ o,
32
+ l.data,
33
+ c,
34
+ t
35
+ ]), a.children;
36
+ };
5
37
  export {
6
- m as SetAttributeValue
38
+ T as SetAttributeValue
7
39
  };
@@ -1,7 +1,58 @@
1
- import "react";
2
- import "../../engine/GlobalDataContext.js";
3
- import "../../engine/TemplateContext.js";
4
- import { T as m } from "../../VariablesDebug-1UzZWgD7.js";
1
+ import { useContext as y, useEffect as E } from "react";
2
+ import { GlobalDataContext as D } from "../../engine/GlobalDataContext.js";
3
+ import { TemplateContext as O } from "../../engine/TemplateContext.js";
4
+ import { evaluateTemplateValue as P } from "../../engine/TemplateSystem.js";
5
+ const q = (i) => {
6
+ const x = y(D), b = y(O), { attributesHolderRef: l } = i, { name: o, value: m, separator: u = " ", keepAttributeWhenEmpty: V = !1 } = i.actionProps || {};
7
+ return E(() => {
8
+ if (!(l != null && l.current) || !o || m === void 0)
9
+ return;
10
+ const p = P({
11
+ valueToEvaluate: m,
12
+ globalDataContext: x,
13
+ templateContext: b
14
+ }), g = ((i.componentProps || {}).attributes || {})[o] || "", d = g ? g.split(u).filter((e) => e.trim() !== "") : [];
15
+ let n = [...d];
16
+ if (Array.isArray(p)) {
17
+ const e = p.map((t) => String(t));
18
+ if (e.length === 0)
19
+ return;
20
+ if (e.length === 1) {
21
+ const t = e[0], a = n.indexOf(t);
22
+ a > -1 ? n.splice(a, 1) : t !== "" && n.push(t);
23
+ } else {
24
+ let t = -1, a = -1;
25
+ for (let s = 0; s < e.length; s++) {
26
+ const f = e[s], v = n.indexOf(f);
27
+ if (v > -1) {
28
+ t = v, a = s;
29
+ break;
30
+ }
31
+ }
32
+ if (t > -1) {
33
+ const s = (a + 1) % e.length, f = e[s];
34
+ n.splice(t, 1), f !== "" && n.push(f);
35
+ } else {
36
+ const s = e[0];
37
+ s !== "" && n.push(s);
38
+ }
39
+ }
40
+ } else {
41
+ const e = String(p), t = n.indexOf(e);
42
+ t > -1 ? n.splice(t, 1) : n.push(e);
43
+ }
44
+ const c = l.current, A = c.getAttribute(o) || "", I = A ? A.split(u).filter((e) => e.trim() !== "") : [], T = d.filter((e) => !n.includes(e)), C = n.filter((e) => !d.includes(e));
45
+ let r = [...I];
46
+ T.forEach((e) => {
47
+ const t = r.indexOf(e);
48
+ t > -1 && r.splice(t, 1);
49
+ }), C.forEach((e) => {
50
+ r.includes(e) || r.push(e);
51
+ });
52
+ const h = r.join(u);
53
+ h.trim() === "" ? V ? c.setAttribute(o, "") : c.removeAttribute(o) : c.setAttribute(o, h);
54
+ }, [o, m, u, V, x.data, b, l]), i.children;
55
+ };
5
56
  export {
6
- m as ToggleAttributeValue
57
+ q as ToggleAttributeValue
7
58
  };
@@ -1,7 +1,22 @@
1
- import "react";
2
- import "../../engine/GlobalDataContext.js";
3
- import "../../engine/TemplateContext.js";
4
- import { U as p } from "../../VariablesDebug-1UzZWgD7.js";
1
+ import { useContext as r, useEffect as l } from "react";
2
+ import { GlobalDataContext as c } from "../../engine/GlobalDataContext.js";
3
+ import { TemplateContext as u } from "../../engine/TemplateContext.js";
4
+ import { evaluateTemplateValue as i } from "../../engine/TemplateSystem.js";
5
+ const C = (e) => {
6
+ const n = r(c), a = r(u), { attributesHolderRef: t } = e, { name: o } = e.actionProps || {};
7
+ return l(() => {
8
+ if (!(t != null && t.current) || !o)
9
+ return;
10
+ const m = String(
11
+ i({
12
+ valueToEvaluate: o,
13
+ globalDataContext: n,
14
+ templateContext: a
15
+ })
16
+ );
17
+ t.current.removeAttribute(m);
18
+ }, [o, n.data, a, t]), e.children;
19
+ };
5
20
  export {
6
- p as UnsetAttribute
21
+ C as UnsetAttribute
7
22
  };
@@ -1,7 +1,60 @@
1
- import "react";
2
- import "../../engine/GlobalDataContext.js";
3
- import "../../engine/TemplateContext.js";
4
- import { c as m } from "../../VariablesDebug-1UzZWgD7.js";
1
+ import { useContext as p, useEffect as g } from "react";
2
+ import { GlobalDataContext as E } from "../../engine/GlobalDataContext.js";
3
+ import { TemplateContext as N } from "../../engine/TemplateContext.js";
4
+ import { evaluateTemplateValue as A } from "../../engine/TemplateSystem.js";
5
+ const I = (a) => {
6
+ const l = p(E), s = p(N), { attributesHolderRef: r } = a, { name: n, value: i, separator: c = " ", unsetAllOccurrences: C, unsetCount: f } = a.actionProps || {};
7
+ return g(() => {
8
+ if (!(r != null && r.current) || !n || i === void 0)
9
+ return;
10
+ const o = String(
11
+ A({
12
+ valueToEvaluate: i,
13
+ globalDataContext: l,
14
+ templateContext: s
15
+ })
16
+ ), m = f !== void 0 ? A({
17
+ valueToEvaluate: f,
18
+ globalDataContext: l,
19
+ templateContext: s
20
+ }) : void 0, v = r.current, d = v.getAttribute(n) || "";
21
+ if (!d)
22
+ return;
23
+ let t = [...d.split(c)];
24
+ (() => {
25
+ if (C === !0) {
26
+ t = t.filter((e) => e !== o);
27
+ return;
28
+ }
29
+ const u = parseInt(m, 10);
30
+ if (!(!isNaN(u) && m !== void 0 && m !== null)) {
31
+ t = t.filter((e) => e !== o);
32
+ return;
33
+ }
34
+ if (u === 0)
35
+ return;
36
+ if (u > 0) {
37
+ let e = 0;
38
+ t = t.filter((T) => T === o && e < u ? (e++, !1) : !0);
39
+ return;
40
+ }
41
+ const x = Math.abs(u);
42
+ let b = 0;
43
+ t = t.reverse().filter((e) => e === o && b < x ? (b++, !1) : !0).reverse();
44
+ })();
45
+ const V = t.join(c);
46
+ V.trim() === "" ? v.removeAttribute(n) : v.setAttribute(n, V);
47
+ }, [
48
+ n,
49
+ i,
50
+ c,
51
+ C,
52
+ f,
53
+ l.data,
54
+ s,
55
+ r
56
+ ]), a.children;
57
+ };
5
58
  export {
6
- m as UnsetAttributeValue
59
+ I as UnsetAttributeValue
7
60
  };
@@ -1,18 +1,22 @@
1
- import { H as a, M as s, P as r, R as i, a as o, S as n, T as u, b as l, U as b, c, r as p } from "../../VariablesDebug-1UzZWgD7.js";
2
- import { Hide as A } from "./Hide.js";
3
- import { VisuallyHide as V } from "./VisuallyHide.js";
1
+ import { HashChangeListener as r } from "./HashChangeListener.js";
2
+ import { Hide as f } from "./Hide.js";
3
+ import { MessageListener as m } from "./MessageListener.js";
4
+ import { ReactOnEvent as x } from "./ReactOnEvent.js";
5
+ import { Redirect as s } from "./Redirect.js";
6
+ import { SetAttributeValue as n } from "./SetAttributeValue.js";
7
+ import { ToggleAttributeValue as b } from "./ToggleAttributeValue.js";
8
+ import { UnsetAttribute as A } from "./UnsetAttribute.js";
9
+ import { UnsetAttributeValue as d } from "./UnsetAttributeValue.js";
10
+ import { VisuallyHide as c } from "./VisuallyHide.js";
4
11
  export {
5
- a as HashChangeListener,
6
- A as Hide,
7
- s as MessageListener,
8
- r as Popover,
9
- i as ReactOnEvent,
10
- o as Redirect,
12
+ r as HashChangeListener,
13
+ f as Hide,
14
+ m as MessageListener,
15
+ x as ReactOnEvent,
16
+ s as Redirect,
11
17
  n as SetAttributeValue,
12
- u as ToggleAttributeValue,
13
- l as Tooltip,
14
- b as UnsetAttribute,
15
- c as UnsetAttributeValue,
16
- V as VisuallyHide,
17
- p as reactionFunctions
18
+ b as ToggleAttributeValue,
19
+ A as UnsetAttribute,
20
+ d as UnsetAttributeValue,
21
+ c as VisuallyHide
18
22
  };
@@ -1,5 +1,8 @@
1
- import { d as o, s } from "../../VariablesDebug-1UzZWgD7.js";
1
+ import { simpleMapping as p } from "./simpleMapping.js";
2
+ const n = {
3
+ simpleMapping: p
4
+ };
2
5
  export {
3
- o as coreDataMappingComponents,
4
- s as simpleMapping
6
+ n as coreDataMappingComponents,
7
+ p as simpleMapping
5
8
  };