@ea-lab/reactive-json 0.7.0 → 1.0.0-alpha.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 (89) hide show
  1. package/README.md +1 -3
  2. package/dist/TemplateSystem-kQJEKjik.js +3568 -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 -13
  18. package/dist/component/element/debug/index.js +2 -2
  19. package/dist/component/element/html/FolderSortableTree.js +131 -8
  20. package/dist/component/element/html/FormatNumeral.js +57 -6
  21. package/dist/component/element/html/Html.js +1 -1
  22. package/dist/component/element/html/LabelFromValue.js +25 -6
  23. package/dist/component/element/html/PreformattedMarkup.js +50 -7
  24. package/dist/component/element/html/SortableTreeItemCollapseButton.js +10 -5
  25. package/dist/component/element/html/index.js +12 -10
  26. package/dist/component/element/index.js +35 -30
  27. package/dist/component/element/special/Count.js +21 -10
  28. package/dist/component/element/special/DataFilter.js +75 -6
  29. package/dist/component/element/special/DelayedActions.js +46 -7
  30. package/dist/component/element/special/Phantom.js +12 -3
  31. package/dist/component/element/special/ReactiveJsonBasicComponentWrapper.js +29 -0
  32. package/dist/component/element/special/ReactiveJsonSubroot.js +4 -3
  33. package/dist/component/element/special/Switch.js +78 -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 +85 -63
  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 +3 -2
  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 +4 -7
  53. package/dist/engine/ParsingDebugDisplay/ParsingDebugDisplay.js +692 -3
  54. package/dist/engine/ReactiveJsonRoot.js +8 -6
  55. package/dist/engine/TemplateSystem.js +3 -3
  56. package/dist/engine/View.js +2 -7
  57. package/dist/engine/index.js +38 -37
  58. package/dist/engine/utility/alterData.js +7 -1
  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 +12 -11
  63. package/dist/httpRequestCommon-BFntjNdS.js +1799 -0
  64. package/dist/index-BA09SSaJ.js +26 -0
  65. package/dist/index-Bzk15m61.js +19 -0
  66. package/dist/index-CACLSxWi.js +8 -0
  67. package/dist/index-NNBvIV0S.js +1873 -0
  68. package/dist/index-OhHUX6nj.js +460 -0
  69. package/dist/main.js +124 -102
  70. package/package.json +4 -4
  71. package/dist/HashChangeListener-D6HwdXBJ.js +0 -8526
  72. package/dist/ParsingDebugDisplay-8f4yL4Jw.js +0 -696
  73. package/dist/VariablesDebug-pv5GGWel.js +0 -9262
  74. package/dist/component/action/Popover.js +0 -6
  75. package/dist/component/action/Tooltip.js +0 -5
  76. package/dist/component/element/form/CheckBoxField.js +0 -8
  77. package/dist/component/element/form/DateField.js +0 -8
  78. package/dist/component/element/form/NumberField.js +0 -8
  79. package/dist/component/element/form/SelectField.js +0 -8
  80. package/dist/component/element/form/TextAreaField.js +0 -8
  81. package/dist/component/element/form/TextField.js +0 -8
  82. package/dist/component/element/form/formElementsCommon.js +0 -4
  83. package/dist/component/element/form/index.js +0 -10
  84. package/dist/component/element/html/AccordionItem.js +0 -6
  85. package/dist/component/element/html/Modal.js +0 -8
  86. package/dist/component/element/html/Tabs.js +0 -8
  87. package/dist/component/element/special/BootstrapElement.js +0 -5
  88. package/dist/engine/PaginationProvider.js +0 -30
  89. package/dist/usePagination-Bb6lefHG.js +0 -353
@@ -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 "../../HashChangeListener-D6HwdXBJ.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 { b as d } from "../../TemplateSystem-kQJEKjik.js";
7
+ const R = (n) => {
8
+ const e = h(x), a = h(L), o = h(T), s = a.plugins ?? {}, f = (s == null ? void 0 : s.reaction) ?? {}, t = (n == null ? void 0 : n.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: a,
12
+ templateContext: o,
13
+ valueToEvaluate: w
14
+ }), c = d({
15
+ globalDataContext: a,
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: a, templateContext: o });
23
+ };
24
+ return e == null || e.addEventListener("hashchange", m), () => {
25
+ e == null || e.removeEventListener("hashchange", m);
26
+ };
27
+ }, [e, a, t, o]), /* @__PURE__ */ C(H, { children: n.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 "../../lodash-CYNxjS-I.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 "../../HashChangeListener-D6HwdXBJ.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 { b as T } from "../../TemplateSystem-kQJEKjik.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 "../../HashChangeListener-D6HwdXBJ.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 "../../HashChangeListener-D6HwdXBJ.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 { a as m } from "../../TemplateSystem-kQJEKjik.js";
5
+ const f = (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
+ f 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 "../../HashChangeListener-D6HwdXBJ.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 { a as b } from "../../TemplateSystem-kQJEKjik.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 "../../HashChangeListener-D6HwdXBJ.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 { a as P } from "../../TemplateSystem-kQJEKjik.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 "../../HashChangeListener-D6HwdXBJ.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 { a as i } from "../../TemplateSystem-kQJEKjik.js";
5
+ const C = (e) => {
6
+ const a = r(c), n = 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: a,
14
+ templateContext: n
15
+ })
16
+ );
17
+ t.current.removeAttribute(m);
18
+ }, [o, a.data, n, 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 "../../HashChangeListener-D6HwdXBJ.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 { a as A } from "../../TemplateSystem-kQJEKjik.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 "../../HashChangeListener-D6HwdXBJ.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 "../../HashChangeListener-D6HwdXBJ.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
  };
@@ -1,4 +1,95 @@
1
- import { s as a } from "../../HashChangeListener-D6HwdXBJ.js";
1
+ import { d as V, b as v } from "../../TemplateSystem-kQJEKjik.js";
2
+ function T({ config: h, globalDataContext: o, templateContext: i, responseData: m }) {
3
+ const { stringMap: M = {}, onErrorMap: p } = h, { updateData: g } = o;
4
+ try {
5
+ Object.entries(M).map(([r, t]) => l({
6
+ destinationDataLocation: r,
7
+ mappingConfig: t,
8
+ sourceDataRetriever: ({ location: n }) => u({ location: n, data: m })
9
+ })).filter(Boolean).forEach(s);
10
+ } catch (e) {
11
+ if (!p)
12
+ throw e;
13
+ Object.entries(p).map(([t, n]) => l({
14
+ destinationDataLocation: t,
15
+ mappingConfig: n,
16
+ sourceDataRetriever: w
17
+ })).filter(Boolean).forEach(s);
18
+ }
19
+ function s({ destinationPath: e, value: r, updateMode: t }) {
20
+ g(r, e, t);
21
+ }
22
+ function u({ location: e, data: r }) {
23
+ if (typeof r != "object")
24
+ throw new Error("simpleMapping: Could not find location in response data: " + e + ".");
25
+ if (!e || e === "")
26
+ throw new Error("simpleMapping: Location is empty.");
27
+ const t = e.split(".")[0];
28
+ if (t in r) {
29
+ const n = e.split(".").slice(1).join(".");
30
+ return n === "" ? r[t] : u({ location: n, data: r[t] });
31
+ }
32
+ throw new Error(
33
+ "simpleMapping: Could not find location in response data: " + e + " (location not found in data)."
34
+ );
35
+ }
36
+ function w({ location: e }) {
37
+ return v({
38
+ valueToEvaluate: e,
39
+ globalDataContext: o,
40
+ templateContext: i,
41
+ evaluationDepth: -1
42
+ });
43
+ }
44
+ function l({ destinationDataLocation: e, mappingConfig: r, sourceDataRetriever: t }) {
45
+ const { value: n, required: E = !0, defaultValue: c } = r;
46
+ let f = "";
47
+ if (!n) {
48
+ console.warn("simpleMapping: 'value' is missing for", e);
49
+ return;
50
+ }
51
+ const a = V({
52
+ dataLocation: e,
53
+ // TODO: This is incorrect because simpleMapping could be called from a fetchData reaction that is not located at the root of the data.
54
+ currentPath: "data",
55
+ globalDataContext: o,
56
+ templateContext: i
57
+ });
58
+ if (typeof a != "string" || !a.startsWith("data")) {
59
+ console.warn(
60
+ "simpleMapping: the given destination path is invalid:",
61
+ e,
62
+ "->",
63
+ a
64
+ );
65
+ return;
66
+ }
67
+ try {
68
+ const d = t({ location: n });
69
+ return {
70
+ destinationPath: a,
71
+ value: d,
72
+ updateMode: f
73
+ };
74
+ } catch {
75
+ if (E)
76
+ throw new Error("simpleMapping: Required value not found in response data: " + n + ".");
77
+ if (c !== void 0) {
78
+ const y = v({
79
+ valueToEvaluate: c,
80
+ globalDataContext: o,
81
+ templateContext: i,
82
+ evaluationDepth: -1
83
+ });
84
+ return {
85
+ destinationPath: a,
86
+ value: y,
87
+ updateMode: f
88
+ };
89
+ }
90
+ }
91
+ }
92
+ }
2
93
  export {
3
- a as simpleMapping
94
+ T as simpleMapping
4
95
  };