@openbytes/ts-react-directives 1.1.0 → 1.1.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 (47) hide show
  1. package/LICENSE.md +21 -21
  2. package/README.md +40 -27
  3. package/dist/__tests__/Check.test.d.ts +5 -0
  4. package/dist/__tests__/Config.test.d.ts +5 -0
  5. package/dist/__tests__/Funcs.test.d.ts +6 -0
  6. package/dist/__tests__/Loop.test.d.ts +1 -0
  7. package/dist/components/Errors.d.ts +12 -0
  8. package/dist/components/index.d.ts +1 -0
  9. package/dist/directives/check/Check.d.ts +10 -0
  10. package/dist/directives/check/Else.d.ts +10 -0
  11. package/dist/directives/check/ElseIf.d.ts +10 -0
  12. package/dist/directives/check/If.d.ts +10 -0
  13. package/dist/directives/check/index.d.ts +4 -0
  14. package/dist/directives/index.d.ts +2 -0
  15. package/dist/directives/loop/Loop.d.ts +13 -0
  16. package/dist/directives/loop/Template.d.ts +14 -0
  17. package/dist/directives/loop/index.d.ts +2 -0
  18. package/dist/examples/App.d.ts +2 -0
  19. package/dist/examples/example1.d.ts +10 -0
  20. package/dist/examples/example2.d.ts +5 -0
  21. package/dist/examples/example3.d.ts +11 -0
  22. package/dist/examples/example4.d.ts +10 -0
  23. package/dist/examples/example5.d.ts +10 -0
  24. package/dist/examples/example6.d.ts +8 -0
  25. package/dist/examples/example7.d.ts +19 -0
  26. package/dist/examples/example8.d.ts +9 -0
  27. package/dist/fixtures/constants.d.ts +2 -0
  28. package/dist/fixtures/enums.d.ts +33 -0
  29. package/dist/fixtures/index.d.ts +2 -0
  30. package/dist/hooks/index.d.ts +3 -0
  31. package/dist/hooks/useCheck.d.ts +39 -0
  32. package/dist/hooks/useLoop.d.ts +9 -0
  33. package/dist/hooks/useValidationFactory.d.ts +15 -0
  34. package/dist/index.css +2 -1
  35. package/dist/index.d.ts +3 -0
  36. package/dist/main.d.ts +1 -0
  37. package/dist/ts-react-directives.cjs.js +1 -1
  38. package/dist/ts-react-directives.d.ts +2 -24
  39. package/dist/ts-react-directives.es.js +232 -119
  40. package/dist/ts-react-directives.umd.js +3 -2
  41. package/dist/types/index.d.ts +51 -0
  42. package/dist/utils/config.d.ts +76 -0
  43. package/dist/utils/helpers.d.ts +34 -0
  44. package/dist/utils/index.d.ts +3 -0
  45. package/dist/utils/validators.d.ts +7 -0
  46. package/dist/vite-env.d.ts +1 -0
  47. package/package.json +43 -36
@@ -1,121 +1,234 @@
1
- import { jsx as i, Fragment as p } from "react/jsx-runtime";
2
- import { Children as I, useMemo as E, createElement as m, isValidElement as k } from "react";
3
- import './index.css';var t = /* @__PURE__ */ ((e) => (e[e.IfBlockExpected = 2001] = "IfBlockExpected", e[e.OnlyOneIfBlockExpected = 2002] = "OnlyOneIfBlockExpected", e[e.OnlyOneElseBlockExpected = 2003] = "OnlyOneElseBlockExpected", e[e.CheckBlockExpected = 2005] = "CheckBlockExpected", e[e.InvalidIfBlockOrdinal = 2004] = "InvalidIfBlockOrdinal", e[e.InvalidElseBlockOrdinal = 2006] = "InvalidElseBlockOrdinal", e[e.InvalidElseIfBlockOrdinal = 2007] = "InvalidElseIfBlockOrdinal", e[e.MalformedLoop = 2008] = "MalformedLoop", e[e.InfiniteLoopCondition = 2009] = "InfiniteLoopCondition", e[e.TemplateBlockExpected = 2012] = "TemplateBlockExpected", e[e.OnlyOneTemplateBlockExpected = 2013] = "OnlyOneTemplateBlockExpected", e[e.EmptyLoopSource = 2014] = "EmptyLoopSource", e[e.InvalidElement = 3002] = "InvalidElement", e[e.ChildrenExpected = 3003] = "ChildrenExpected", e[e.SingleChildExpected = 3004] = "SingleChildExpected", e))(t || {}), o = /* @__PURE__ */ ((e) => (e.If = "If", e.ElseIf = "ElseIf", e.Else = "Else", e.Check = "Check", e.Loop = "Loop", e.LoopProps = "LoopProps", e.Template = "Template", e.Unknown = "Unknown", e))(o || {});
4
- const u = {
5
- [t.IfBlockExpected]: "Missing 'If'",
6
- [t.OnlyOneIfBlockExpected]: "Can only have one 'If'",
7
- [t.OnlyOneElseBlockExpected]: "Can only have one 'Else'",
8
- [t.CheckBlockExpected]: "'If', 'ElseIf', 'Else' need to be wrapped in 'Check'",
9
- [t.InvalidElseBlockOrdinal]: "Invalid ordinals, 'Else' should be the last",
10
- [t.InvalidIfBlockOrdinal]: "Invalid ordinals, 'If' block should be the first",
11
- [t.InvalidElseIfBlockOrdinal]: "Invalid ordinals, cannot have 'ElseIf' before 'If'",
12
- [t.ChildrenExpected]: "Should at least have one child",
13
- [t.InvalidElement]: "Invalid element",
14
- [t.MalformedLoop]: "Malformed loop",
15
- [t.EmptyLoopSource]: "Empty loop source",
16
- [t.InfiniteLoopCondition]: "Infinite loop condition",
17
- [t.TemplateBlockExpected]: "Missing 'Template'",
18
- [t.OnlyOneTemplateBlockExpected]: "Only one Template block expected",
19
- [t.SingleChildExpected]: "Can have only a single child"
20
- }, f = ({ errors: e }) => /* @__PURE__ */ i("ol", { className: "trd-error-list", children: e.map((l, n) => /* @__PURE__ */ i("li", { children: u[l] }, `${l}-${n}`)) }), B = (e) => {
21
- const l = [];
22
- return e.length === 0 ? (l.push(t.ChildrenExpected), l) : (e.forEach((n) => {
23
- const { displayName: c = o.Unknown } = n.type ?? {};
24
- (c === o.If || c === o.ElseIf || c === o.Else) && (l.push(t.InvalidElement), l.push(t.CheckBlockExpected));
25
- }), l);
1
+ import { Fragment as e, jsx as t, jsxs as n } from "react/jsx-runtime";
2
+ import { Children as r, cloneElement as i, createElement as a, isValidElement as o, useId as s, useMemo as c } from "react";
3
+ import './index.css';//#region src/fixtures/enums.ts
4
+ var l = /* @__PURE__ */ function(e) {
5
+ return e[e.InvalidElement = 3002] = "InvalidElement", e[e.ChildrenExpected = 3003] = "ChildrenExpected", e[e.SingleChildExpected = 3004] = "SingleChildExpected", e[e.IfBlockExpected = 1001] = "IfBlockExpected", e[e.OnlyOneIfBlockExpected = 1002] = "OnlyOneIfBlockExpected", e[e.OnlyOneElseBlockExpected = 1003] = "OnlyOneElseBlockExpected", e[e.CheckBlockExpected = 1005] = "CheckBlockExpected", e[e.InvalidIfBlockOrdinal = 1004] = "InvalidIfBlockOrdinal", e[e.InvalidElseBlockOrdinal = 1006] = "InvalidElseBlockOrdinal", e[e.InvalidElseIfBlockOrdinal = 1007] = "InvalidElseIfBlockOrdinal", e[e.MalformedLoopBounds = 2001] = "MalformedLoopBounds", e[e.MalformedLoopParams = 2002] = "MalformedLoopParams", e[e.MalformedLoop = 2008] = "MalformedLoop", e[e.InfiniteLoopCondition = 2009] = "InfiniteLoopCondition", e[e.TemplateBlockExpected = 2012] = "TemplateBlockExpected", e[e.OnlyOneTemplateBlockExpected = 2013] = "OnlyOneTemplateBlockExpected", e[e.EmptyLoopSource = 2014] = "EmptyLoopSource", e;
6
+ }({}), u = /* @__PURE__ */ function(e) {
7
+ return e.If = "If", e.ElseIf = "ElseIf", e.Else = "Else", e.Check = "Check", e.Loop = "Loop", e.LoopProps = "LoopProps", e.Template = "Template", e.Unknown = "Unknown", e;
8
+ }({}), d = {
9
+ [l.IfBlockExpected]: "Missing 'If'",
10
+ [l.OnlyOneIfBlockExpected]: "Can only have one 'If'",
11
+ [l.OnlyOneElseBlockExpected]: "Can only have one 'Else'",
12
+ [l.CheckBlockExpected]: "'If', 'ElseIf', 'Else' need to be wrapped in 'Check'",
13
+ [l.InvalidElseBlockOrdinal]: "Invalid ordinals, 'Else' should be the last",
14
+ [l.InvalidIfBlockOrdinal]: "Invalid ordinals, 'If' block should be the first",
15
+ [l.InvalidElseIfBlockOrdinal]: "Invalid ordinals, cannot have 'ElseIf' before 'If'",
16
+ [l.ChildrenExpected]: "Should at least have one child",
17
+ [l.InvalidElement]: "Invalid element",
18
+ [l.MalformedLoop]: "Malformed loop",
19
+ [l.EmptyLoopSource]: "Empty loop source",
20
+ [l.InfiniteLoopCondition]: "Infinite loop condition",
21
+ [l.TemplateBlockExpected]: "Missing 'Template'",
22
+ [l.OnlyOneTemplateBlockExpected]: "Only one Template block expected",
23
+ [l.SingleChildExpected]: "Can have only a single child",
24
+ [l.MalformedLoopBounds]: "Malformed loop bounds",
25
+ [l.MalformedLoopParams]: "Malformed loop params"
26
+ }, f = class e {
27
+ static __instance;
28
+ config = void 0;
29
+ overrides = {};
30
+ constructor() {}
31
+ static getInstance() {
32
+ return e.__instance ||= new e(), e.__instance;
33
+ }
34
+ configure(e) {
35
+ this.overrides = {
36
+ ...this.overrides,
37
+ ...e
38
+ }, this.config = void 0;
39
+ }
40
+ parseBoolean(e) {
41
+ return typeof e == "boolean" ? e : e == null || e === "" ? !1 : String(e).toLowerCase() === "true";
42
+ }
43
+ parseMode(e) {
44
+ return [
45
+ "development",
46
+ "production",
47
+ "test"
48
+ ].includes(e) ? e : "production";
49
+ }
50
+ getProcessEnv() {
51
+ return globalThis.process?.env ?? null;
52
+ }
53
+ getConfig() {
54
+ if (this.config) return this.config;
55
+ let e = this.getProcessEnv() ?? {};
56
+ return this.config = {
57
+ mode: this.overrides.mode ?? this.parseMode(e.MODE ?? e.NODE_ENV),
58
+ showErrors: this.overrides.showErrors ?? this.parseBoolean(e.TRD_SHOW_ERRORS),
59
+ showErrorsInProd: this.overrides.showErrorsInProd ?? this.parseBoolean(e.TRD_SHOW_ERRORS_IN_PROD),
60
+ showErrorsInPlace: this.overrides.showErrorsInPlace ?? this.parseBoolean(e.TRD_SHOW_ERRORS_IN_PLACE)
61
+ }, this.config;
62
+ }
63
+ getByKey(e) {
64
+ return this.getProcessEnv()?.[e];
65
+ }
66
+ get isShowErrors() {
67
+ let e = this.getConfig();
68
+ return e.showErrors && (e.mode !== "production" || e.showErrorsInProd);
69
+ }
70
+ get isShowErrorsInPlace() {
71
+ return this.getConfig().showErrorsInPlace;
72
+ }
73
+ }, p = (e) => f.getInstance().configure(e), m = ({ errors: e }) => /* @__PURE__ */ t("ol", {
74
+ className: "trd-error-list my-3 list-none space-y-1.5 rounded-lg border border-red-200 bg-red-50 p-4 shadow-sm",
75
+ children: e.map((e, r) => /* @__PURE__ */ n("li", {
76
+ className: "trd-error-list__item flex items-start gap-2",
77
+ children: [/* @__PURE__ */ t("svg", {
78
+ className: "trd-error-list__icon mt-0.5 h-4 w-4 shrink-0 text-red-500",
79
+ viewBox: "0 0 20 20",
80
+ fill: "currentColor",
81
+ "aria-hidden": "true",
82
+ children: /* @__PURE__ */ t("path", {
83
+ fillRule: "evenodd",
84
+ d: "M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495ZM10 5a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 10 5Zm0 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",
85
+ clipRule: "evenodd"
86
+ })
87
+ }), /* @__PURE__ */ t("i", {
88
+ className: "trd-error-list__item--text not-italic text-sm leading-5 text-red-700",
89
+ children: d[e]
90
+ })]
91
+ }, `${e}-${r}`))
92
+ }), h = (e) => {
93
+ if (e.length) {
94
+ let { isShowErrors: t, isShowErrorsInPlace: n } = f.getInstance(), r = null;
95
+ return t && n && (r = a(m, { errors: e })), r;
96
+ }
97
+ }, g = (e) => {
98
+ for (let t of e) {
99
+ if (!t || !o(t)) continue;
100
+ let { displayName: e } = t.type;
101
+ if (e) {
102
+ let { condition: n } = t.props;
103
+ if ((e === "If" || e === "ElseIf") && n === !0 || e === "Else") return t;
104
+ }
105
+ }
106
+ return null;
107
+ }, _ = ({ over: e, from: t, to: n, step: r }) => {
108
+ let i = e ?? null, a = i !== null, o = a ? i.length - 1 : null, s = t === void 0, c = n === void 0, u = !r, d = null, f = null, p = null, m = [];
109
+ return r === 0 ? m = [l.InfiniteLoopCondition] : a ? i?.length === 0 ? m = [l.EmptyLoopSource] : s && c ? u ? (d = 0, f = o, p = 1) : (p = r, d = p > 0 ? 0 : o, f = p > 0 ? o : 0) : s ? (d = n > 0 ? 0 : o, f = n, u ? p = n > 0 ? 1 : -1 : (p = r, Math.sign(f - d) !== Math.sign(p) && (m = [l.InfiniteLoopCondition]))) : c ? (d = t, u ? (f = t > 0 ? o : 0, p = t > 0 ? 1 : -1) : (p = r, f = p > 0 ? o : 0, Math.sign(f - d) !== Math.sign(p) && (m = [l.InfiniteLoopCondition]))) : (d = t, f = n, u ? p = f >= d ? 1 : -1 : (p = r, Math.sign(f - d) !== Math.sign(p) && (m = [l.InfiniteLoopCondition]))) : s && c && u || s && c || s && u || s || c ? m = [
110
+ l.MalformedLoop,
111
+ l.MalformedLoopParams,
112
+ l.MalformedLoopBounds
113
+ ] : (d = t, f = n, p = r || (f - d > 0 ? 1 : -1), Math.sign(f - d) !== Math.sign(p) && (m = [l.InfiniteLoopCondition])), i && (d < 0 || d > i.length || f < 0 || f > i.length) && (m = [
114
+ l.MalformedLoop,
115
+ l.MalformedLoopParams,
116
+ l.MalformedLoopBounds
117
+ ]), m.length && (i = d = f = p = null), {
118
+ over: i,
119
+ from: d,
120
+ to: f,
121
+ step: p,
122
+ errors: m
123
+ };
124
+ }, v = (e) => {
125
+ let t = [], n = r.toArray(e.children);
126
+ return n?.length === 0 ? (t.push(l.ChildrenExpected), t) : (n.forEach((e) => {
127
+ let { displayName: n = u.Unknown } = e.type ?? {};
128
+ (n === u.If || n === u.ElseIf || n === u.Else) && (t.push(l.InvalidElement), t.push(l.CheckBlockExpected));
129
+ }), t);
130
+ }, y = (e) => {
131
+ let t = [], n = {}, i = r.toArray(e.children);
132
+ return i.length === 0 ? (t.push(l.ChildrenExpected, l.IfBlockExpected), t) : (i.forEach((e, r) => {
133
+ let { displayName: a = u.Unknown } = e.type ?? {}, o = n[a] ?? 0;
134
+ n[a] = o + 1, b(a, r, n, t), x(a, r, i.length, n, t), S(a, r, t), C(a, t);
135
+ }), n[u.If] || t.push(l.IfBlockExpected), t);
136
+ }, b = (e, t, n, r) => {
137
+ e === u.If && (t !== 0 && r.push(l.InvalidIfBlockOrdinal), n[u.If] > 1 && r.push(l.OnlyOneIfBlockExpected));
138
+ }, x = (e, t, n, r, i) => {
139
+ e === u.Else && (r[u.Else] > 1 && i.push(l.OnlyOneElseBlockExpected), (t === 0 || t !== n - 1) && i.push(l.InvalidElseBlockOrdinal));
140
+ }, S = (e, t, n) => {
141
+ e === u.ElseIf && t === 0 && n.push(l.InvalidElseIfBlockOrdinal);
142
+ }, C = (e, t) => {
143
+ e !== u.If && e !== u.ElseIf && e !== u.Else && t.push(l.InvalidElement);
144
+ }, w = (e) => {
145
+ let t = [], { errors: n } = e;
146
+ t.push(...n);
147
+ let i = r.toArray(e.children);
148
+ if (i.length === 0) t.push(l.ChildrenExpected, l.TemplateBlockExpected);
149
+ else if (i.length > 1) t.push(l.SingleChildExpected, l.OnlyOneTemplateBlockExpected);
150
+ else {
151
+ let { displayName: e = u.Unknown } = i[0].type;
152
+ e !== u.Template && t.push(l.InvalidElement, l.TemplateBlockExpected);
153
+ }
154
+ return t;
155
+ }, T = class {
156
+ static get(e) {
157
+ let t = () => [];
158
+ switch (e) {
159
+ case u.Check:
160
+ t = y;
161
+ break;
162
+ case u.If:
163
+ case u.ElseIf:
164
+ case u.Else:
165
+ t = v;
166
+ break;
167
+ case u.Loop: t = w;
168
+ }
169
+ return t;
170
+ }
171
+ }, E = (e) => {
172
+ let t = j(e, u.Check);
173
+ return t.length ? h(t) : g(r.toArray(e.children).filter(o));
174
+ }, D = (e) => {
175
+ let t = j(e, "If");
176
+ if (t.length) return h(t);
177
+ let { condition: n, children: r } = e;
178
+ return n ? r : null;
26
179
  }, O = (e) => {
27
- const l = [], n = {};
28
- return e.length === 0 ? (l.push(t.ChildrenExpected, t.IfBlockExpected), l) : (e.forEach((c, d) => {
29
- const { displayName: a = o.Unknown } = c.type ?? {}, s = n[a] ?? 0;
30
- n[a] = s + 1, x(a, d, n, l), y(a, d, e.length, n, l), C(a, d, l), v(a, l);
31
- }), n[o.If] || l.push(t.IfBlockExpected), l);
32
- }, x = (e, l, n, c) => {
33
- e === o.If && (l !== 0 && c.push(t.InvalidIfBlockOrdinal), n[o.If] > 1 && c.push(t.OnlyOneIfBlockExpected));
34
- }, y = (e, l, n, c, d) => {
35
- e === o.Else && (c[o.Else] > 1 && d.push(t.OnlyOneElseBlockExpected), (l === 0 || l !== n - 1) && d.push(t.InvalidElseBlockOrdinal));
36
- }, C = (e, l, n) => {
37
- e === o.ElseIf && l === 0 && n.push(t.InvalidElseIfBlockOrdinal);
38
- }, v = (e, l) => {
39
- e !== o.If && e !== o.ElseIf && e !== o.Else && l.push(t.InvalidElement);
40
- }, r = (e, l) => {
41
- const n = [];
42
- if (e.length === 0)
43
- n.push(t.ChildrenExpected, t.TemplateBlockExpected);
44
- else if (e.length > 1)
45
- n.push(t.SingleChildExpected, t.OnlyOneTemplateBlockExpected);
46
- else {
47
- const { displayName: c = o.Unknown } = e[0].type;
48
- c !== o.Template && n.push(t.InvalidElement, t.TemplateBlockExpected);
49
- const { from: d = 0, to: a = 0, step: s = 0 } = l ?? {};
50
- (s === 0 || s > 0 && d > a || s < 0 && d < a) && n.push(t.InfiniteLoopCondition);
51
- }
52
- return n.length && n.push(t.MalformedLoop), n;
53
- };
54
- class T {
55
- static get(l) {
56
- let n = () => [];
57
- switch (l) {
58
- case o.Check:
59
- n = O;
60
- break;
61
- case o.If:
62
- case o.ElseIf:
63
- case o.Else:
64
- n = B;
65
- break;
66
- case o.Loop:
67
- n = r;
68
- break;
69
- }
70
- return n;
71
- }
72
- }
73
- const h = (e, l) => {
74
- const { children: n } = e, c = I.toArray(n);
75
- return E(() => T.get(l), [l])(c, e);
76
- }, b = (e) => {
77
- const l = h(e, o.Check);
78
- if (l.length)
79
- return { children: m(f, { errors: l }) };
80
- const c = I.toArray(e.children).filter(k);
81
- return { children: S(c) };
82
- }, S = (e) => {
83
- for (const l of e) {
84
- if (!l || !k(l))
85
- continue;
86
- const { displayName: n } = l.type;
87
- if (n) {
88
- const { condition: c } = l.props;
89
- if ((n === "If" || n === "ElseIf") && c === !0 || n === "Else")
90
- return l;
91
- }
92
- }
93
- return null;
94
- }, M = (e) => {
95
- const { children: l } = b(e);
96
- return /* @__PURE__ */ i(p, { children: l });
97
- };
98
- M.displayName = o.Check;
99
- const w = (e) => {
100
- const l = h(e, "If"), { condition: n } = e, c = l.length === 0 ? e.children : /* @__PURE__ */ i(f, { errors: l });
101
- return /* @__PURE__ */ i(p, { children: n && c });
102
- };
103
- w.displayName = o.If;
104
- const N = (e) => {
105
- const l = h(e, "ElseIf"), { condition: n } = e, c = l.length === 0 ? e.children : /* @__PURE__ */ i(f, { errors: l });
106
- return /* @__PURE__ */ i(p, { children: n && c });
107
- };
108
- N.displayName = o.ElseIf;
109
- const F = (e) => {
110
- const l = h(e, "Else"), n = l.length === 0 ? e.children : /* @__PURE__ */ i(f, { errors: l });
111
- return /* @__PURE__ */ i(p, { children: n });
112
- };
113
- F.displayName = o.Else;
114
- o.Loop;
115
- o.Template;
116
- export {
117
- M as Check,
118
- F as Else,
119
- N as ElseIf,
120
- w as If
180
+ let t = j(e, "ElseIf");
181
+ if (t.length) return h(t);
182
+ let { condition: n, children: r } = e;
183
+ return n ? r : null;
184
+ }, k = (e) => {
185
+ let t = j(e, "Else");
186
+ if (t.length) return h(t);
187
+ let { children: n } = e;
188
+ return n ?? null;
189
+ }, A = (e) => {
190
+ let t = s(), { over: n, from: r, to: a, step: o, errors: c } = _(e), { children: l } = e, d = [], f = j({
191
+ over: n,
192
+ from: r,
193
+ to: a,
194
+ step: o,
195
+ children: l,
196
+ errors: c
197
+ }, u.Loop);
198
+ if (f.length) return h(f);
199
+ for (let e = r; o > 0 ? e <= a : e >= a; e += o) d.push(i(l, {
200
+ key: `${t}-${e}`,
201
+ data: n?.[e] ?? e,
202
+ index: e
203
+ }));
204
+ return d;
205
+ }, j = (e, t) => c(() => T.get(t), [t])(e), M = (n) => /* @__PURE__ */ t(e, { children: E(n) });
206
+ M.displayName = u.Check;
207
+ //#endregion
208
+ //#region src/directives/check/Else.tsx
209
+ var N = (n) => /* @__PURE__ */ t(e, { children: k(n) });
210
+ N.displayName = u.Else;
211
+ //#endregion
212
+ //#region src/directives/check/ElseIf.tsx
213
+ var P = (n) => /* @__PURE__ */ t(e, { children: O(n) });
214
+ P.displayName = u.ElseIf;
215
+ //#endregion
216
+ //#region src/directives/check/If.tsx
217
+ var F = (n) => /* @__PURE__ */ t(e, { children: D(n) });
218
+ F.displayName = u.If;
219
+ //#endregion
220
+ //#region src/directives/loop/Loop.tsx
221
+ var I = (n) => /* @__PURE__ */ t(e, { children: A(n) });
222
+ I.displayName = u.Loop;
223
+ //#endregion
224
+ //#region src/directives/loop/Template.tsx
225
+ var L = (e) => {
226
+ let { index: t, data: n, children: r } = e;
227
+ return t === void 0 || n === void 0 ? null : r?.({
228
+ index: t,
229
+ data: n
230
+ }) ?? null;
121
231
  };
232
+ L.displayName = u.Template;
233
+ //#endregion
234
+ export { M as Check, N as Else, P as ElseIf, F as If, I as Loop, L as Template, p as configure };
@@ -1,2 +1,3 @@
1
- (function(a,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],c):(a=typeof globalThis<"u"?globalThis:a||self,c(a["ts-react-directives"]={},a["react/jsx-runtime"],a.React))})(this,function(a,c,p){"use strict";var I=document.createElement("style");I.textContent=`:root{--trd-color: 255, 100, 200;--trd-bg-color: 0, 100, 200}ol.trd-error-list{border:.2rem double rgb(var(--trd-bg-color));background-color:rgba(var(--trd-bg-color),.1);list-style-type:none;box-sizing:border-box;padding:.5rem;margin:0}.trd-error-list>li{color:#000;background-color:rgba(var(--trd-color),.1);padding:.125rem;margin:.125rem;border:2px solid rgb(var(--trd-color));font-size:1.5rem;font-family:monospace}.trd-error-list>li:before{content:"🛈 ";font-size:1.5rem;padding-left:.125rem;margin-right:.125rem}
2
- /*$vite$:1*/`,document.head.appendChild(I);var t=(e=>(e[e.IfBlockExpected=2001]="IfBlockExpected",e[e.OnlyOneIfBlockExpected=2002]="OnlyOneIfBlockExpected",e[e.OnlyOneElseBlockExpected=2003]="OnlyOneElseBlockExpected",e[e.CheckBlockExpected=2005]="CheckBlockExpected",e[e.InvalidIfBlockOrdinal=2004]="InvalidIfBlockOrdinal",e[e.InvalidElseBlockOrdinal=2006]="InvalidElseBlockOrdinal",e[e.InvalidElseIfBlockOrdinal=2007]="InvalidElseIfBlockOrdinal",e[e.MalformedLoop=2008]="MalformedLoop",e[e.InfiniteLoopCondition=2009]="InfiniteLoopCondition",e[e.TemplateBlockExpected=2012]="TemplateBlockExpected",e[e.OnlyOneTemplateBlockExpected=2013]="OnlyOneTemplateBlockExpected",e[e.EmptyLoopSource=2014]="EmptyLoopSource",e[e.InvalidElement=3002]="InvalidElement",e[e.ChildrenExpected=3003]="ChildrenExpected",e[e.SingleChildExpected=3004]="SingleChildExpected",e))(t||{}),o=(e=>(e.If="If",e.ElseIf="ElseIf",e.Else="Else",e.Check="Check",e.Loop="Loop",e.LoopProps="LoopProps",e.Template="Template",e.Unknown="Unknown",e))(o||{});const y={[t.IfBlockExpected]:"Missing 'If'",[t.OnlyOneIfBlockExpected]:"Can only have one 'If'",[t.OnlyOneElseBlockExpected]:"Can only have one 'Else'",[t.CheckBlockExpected]:"'If', 'ElseIf', 'Else' need to be wrapped in 'Check'",[t.InvalidElseBlockOrdinal]:"Invalid ordinals, 'Else' should be the last",[t.InvalidIfBlockOrdinal]:"Invalid ordinals, 'If' block should be the first",[t.InvalidElseIfBlockOrdinal]:"Invalid ordinals, cannot have 'ElseIf' before 'If'",[t.ChildrenExpected]:"Should at least have one child",[t.InvalidElement]:"Invalid element",[t.MalformedLoop]:"Malformed loop",[t.EmptyLoopSource]:"Empty loop source",[t.InfiniteLoopCondition]:"Infinite loop condition",[t.TemplateBlockExpected]:"Missing 'Template'",[t.OnlyOneTemplateBlockExpected]:"Only one Template block expected",[t.SingleChildExpected]:"Can have only a single child"},r=({errors:e})=>c.jsx("ol",{className:"trd-error-list",children:e.map((l,n)=>c.jsx("li",{children:y[l]},`${l}-${n}`))}),v=e=>{const l=[];return e.length===0?(l.push(t.ChildrenExpected),l):(e.forEach(n=>{const{displayName:d=o.Unknown}=n.type??{};(d===o.If||d===o.ElseIf||d===o.Else)&&(l.push(t.InvalidElement),l.push(t.CheckBlockExpected))}),l)},B=e=>{const l=[],n={};return e.length===0?(l.push(t.ChildrenExpected,t.IfBlockExpected),l):(e.forEach((d,i)=>{const{displayName:s=o.Unknown}=d.type??{},f=n[s]??0;n[s]=f+1,C(s,i,n,l),O(s,i,e.length,n,l),x(s,i,l),b(s,l)}),n[o.If]||l.push(t.IfBlockExpected),l)},C=(e,l,n,d)=>{e===o.If&&(l!==0&&d.push(t.InvalidIfBlockOrdinal),n[o.If]>1&&d.push(t.OnlyOneIfBlockExpected))},O=(e,l,n,d,i)=>{e===o.Else&&(d[o.Else]>1&&i.push(t.OnlyOneElseBlockExpected),(l===0||l!==n-1)&&i.push(t.InvalidElseBlockOrdinal))},x=(e,l,n)=>{e===o.ElseIf&&l===0&&n.push(t.InvalidElseIfBlockOrdinal)},b=(e,l)=>{e!==o.If&&e!==o.ElseIf&&e!==o.Else&&l.push(t.InvalidElement)},T=(e,l)=>{const n=[];if(e.length===0)n.push(t.ChildrenExpected,t.TemplateBlockExpected);else if(e.length>1)n.push(t.SingleChildExpected,t.OnlyOneTemplateBlockExpected);else{const{displayName:d=o.Unknown}=e[0].type;d!==o.Template&&n.push(t.InvalidElement,t.TemplateBlockExpected);const{from:i=0,to:s=0,step:f=0}=l??{};(f===0||f>0&&i>s||f<0&&i<s)&&n.push(t.InfiniteLoopCondition)}return n.length&&n.push(t.MalformedLoop),n};class g{static get(l){let n=()=>[];switch(l){case o.Check:n=B;break;case o.If:case o.ElseIf:case o.Else:n=v;break;case o.Loop:n=T;break}return n}}const h=(e,l)=>{const{children:n}=e,d=p.Children.toArray(n);return p.useMemo(()=>g.get(l),[l])(d,e)},S=e=>{const l=h(e,o.Check);if(l.length)return{children:p.createElement(r,{errors:l})};const d=p.Children.toArray(e.children).filter(p.isValidElement);return{children:F(d)}},F=e=>{for(const l of e){if(!l||!p.isValidElement(l))continue;const{displayName:n}=l.type;if(n){const{condition:d}=l.props;if((n==="If"||n==="ElseIf")&&d===!0||n==="Else")return l}}return null},k=e=>{const{children:l}=S(e);return c.jsx(c.Fragment,{children:l})};k.displayName=o.Check;const E=e=>{const l=h(e,"If"),{condition:n}=e,d=l.length===0?e.children:c.jsx(r,{errors:l});return c.jsx(c.Fragment,{children:n&&d})};E.displayName=o.If;const m=e=>{const l=h(e,"ElseIf"),{condition:n}=e,d=l.length===0?e.children:c.jsx(r,{errors:l});return c.jsx(c.Fragment,{children:n&&d})};m.displayName=o.ElseIf;const u=e=>{const l=h(e,"Else"),n=l.length===0?e.children:c.jsx(r,{errors:l});return c.jsx(c.Fragment,{children:n})};u.displayName=o.Else,o.Loop,o.Template,a.Check=k,a.Else=u,a.ElseIf=m,a.If=E,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("react/jsx-runtime"),require("react")):typeof define==`function`&&define.amd?define([`exports`,`react/jsx-runtime`,`react`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e[`ts-react-directives`]={},e[`react/jsx-runtime`],e.React))})(this,function(e,t,n){var r=document.createElement(`style`);r.textContent=`/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
2
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-space-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-orange-700:oklch(55.3% .195 38.402);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-yellow-400:oklch(85.2% .199 91.936);--color-green-100:oklch(96.2% .044 156.743);--color-green-400:oklch(79.2% .209 151.711);--color-green-700:oklch(52.7% .154 150.069);--color-green-800:oklch(44.8% .119 151.328);--color-emerald-500:oklch(69.6% .17 162.48);--color-teal-100:oklch(95.3% .051 180.801);--color-teal-800:oklch(43.7% .078 188.216);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-700:oklch(48.8% .243 264.376);--color-blue-800:oklch(42.4% .199 265.638);--color-indigo-500:oklch(58.5% .233 277.117);--color-purple-100:oklch(94.6% .033 307.174);--color-purple-800:oklch(43.8% .218 303.724);--color-slate-50:oklch(98.4% .003 247.858);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-700:oklch(37.2% .044 257.287);--color-slate-800:oklch(27.9% .041 260.031);--color-slate-900:oklch(20.8% .042 265.755);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--font-weight-medium:500;--font-weight-semibold:600;--tracking-wider:.05em;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.static{position:static}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.my-3{margin-block:calc(var(--spacing) * 3)}.my-6{margin-block:calc(var(--spacing) * 6)}.mt-0\\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.block{display:block}.contents{display:contents}.flex{display:flex}.hidden{display:none}.inline{display:inline}.inline-flex{display:inline-flex}.h-2{height:calc(var(--spacing) * 2)}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-8{height:calc(var(--spacing) * 8)}.h-10{height:calc(var(--spacing) * 10)}.h-12{height:calc(var(--spacing) * 12)}.h-16{height:calc(var(--spacing) * 16)}.min-h-screen{min-height:100vh}.w-2{width:calc(var(--spacing) * 2)}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-8{width:calc(var(--spacing) * 8)}.w-10{width:calc(var(--spacing) * 10)}.w-72{width:calc(var(--spacing) * 72)}.w-full{width:100%}.min-w-10{min-width:calc(var(--spacing) * 10)}.flex-1{flex:1}.shrink-0{flex-shrink:0}.list-none{list-style-type:none}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-gray-200{border-color:var(--color-gray-200)}.border-red-200{border-color:var(--color-red-200)}.border-red-500{border-color:var(--color-red-500)}.border-slate-200{border-color:var(--color-slate-200)}.border-slate-800{border-color:var(--color-slate-800)}.bg-\\[\\#0d1117\\]{background-color:#0d1117}.bg-\\[\\#161b22\\]{background-color:#161b22}.bg-amber-100{background-color:var(--color-amber-100)}.bg-blue-100{background-color:var(--color-blue-100)}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-green-100{background-color:var(--color-green-100)}.bg-green-400{background-color:var(--color-green-400)}.bg-indigo-500{background-color:var(--color-indigo-500)}.bg-purple-100{background-color:var(--color-purple-100)}.bg-red-50{background-color:var(--color-red-50)}.bg-red-100{background-color:var(--color-red-100)}.bg-red-400{background-color:var(--color-red-400)}.bg-slate-50{background-color:var(--color-slate-50)}.bg-slate-900{background-color:var(--color-slate-900)}.bg-teal-100{background-color:var(--color-teal-100)}.bg-white{background-color:var(--color-white)}.bg-yellow-400{background-color:var(--color-yellow-400)}.bg-linear-to-br{--tw-gradient-position:to bottom right}@supports (background-image:linear-gradient(in lab, red, red)){.bg-linear-to-br{--tw-gradient-position:to bottom right in oklab}}.bg-linear-to-br{background-image:linear-gradient(var(--tw-gradient-stops))}.from-slate-900{--tw-gradient-from:var(--color-slate-900);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-slate-700{--tw-gradient-to:var(--color-slate-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-6{padding:calc(var(--spacing) * 6)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.text-center{text-align:center}.text-left{text-align:left}.font-mono{font-family:var(--font-mono)}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-5{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.text-amber-700{color:var(--color-amber-700)}.text-amber-800{color:var(--color-amber-800)}.text-blue-700{color:var(--color-blue-700)}.text-blue-800{color:var(--color-blue-800)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-green-700{color:var(--color-green-700)}.text-green-800{color:var(--color-green-800)}.text-orange-700{color:var(--color-orange-700)}.text-purple-800{color:var(--color-purple-800)}.text-red-500{color:var(--color-red-500)}.text-red-700{color:var(--color-red-700)}.text-red-800{color:var(--color-red-800)}.text-slate-400{color:var(--color-slate-400)}.text-slate-500{color:var(--color-slate-500)}.text-slate-700{color:var(--color-slate-700)}.text-slate-800{color:var(--color-slate-800)}.text-slate-900{color:var(--color-slate-900)}.text-teal-800{color:var(--color-teal-800)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.not-italic{font-style:normal}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media (hover:hover){.hover\\:bg-slate-100:hover{background-color:var(--color-slate-100)}}@media (width>=40rem){.sm\\:flex{display:flex}}}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}
3
+ /*$vite$:1*/`,document.head.appendChild(r),Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=function(e){return e[e.InvalidElement=3002]=`InvalidElement`,e[e.ChildrenExpected=3003]=`ChildrenExpected`,e[e.SingleChildExpected=3004]=`SingleChildExpected`,e[e.IfBlockExpected=1001]=`IfBlockExpected`,e[e.OnlyOneIfBlockExpected=1002]=`OnlyOneIfBlockExpected`,e[e.OnlyOneElseBlockExpected=1003]=`OnlyOneElseBlockExpected`,e[e.CheckBlockExpected=1005]=`CheckBlockExpected`,e[e.InvalidIfBlockOrdinal=1004]=`InvalidIfBlockOrdinal`,e[e.InvalidElseBlockOrdinal=1006]=`InvalidElseBlockOrdinal`,e[e.InvalidElseIfBlockOrdinal=1007]=`InvalidElseIfBlockOrdinal`,e[e.MalformedLoopBounds=2001]=`MalformedLoopBounds`,e[e.MalformedLoopParams=2002]=`MalformedLoopParams`,e[e.MalformedLoop=2008]=`MalformedLoop`,e[e.InfiniteLoopCondition=2009]=`InfiniteLoopCondition`,e[e.TemplateBlockExpected=2012]=`TemplateBlockExpected`,e[e.OnlyOneTemplateBlockExpected=2013]=`OnlyOneTemplateBlockExpected`,e[e.EmptyLoopSource=2014]=`EmptyLoopSource`,e}({}),a=function(e){return e.If=`If`,e.ElseIf=`ElseIf`,e.Else=`Else`,e.Check=`Check`,e.Loop=`Loop`,e.LoopProps=`LoopProps`,e.Template=`Template`,e.Unknown=`Unknown`,e}({}),o={[i.IfBlockExpected]:`Missing 'If'`,[i.OnlyOneIfBlockExpected]:`Can only have one 'If'`,[i.OnlyOneElseBlockExpected]:`Can only have one 'Else'`,[i.CheckBlockExpected]:`'If', 'ElseIf', 'Else' need to be wrapped in 'Check'`,[i.InvalidElseBlockOrdinal]:`Invalid ordinals, 'Else' should be the last`,[i.InvalidIfBlockOrdinal]:`Invalid ordinals, 'If' block should be the first`,[i.InvalidElseIfBlockOrdinal]:`Invalid ordinals, cannot have 'ElseIf' before 'If'`,[i.ChildrenExpected]:`Should at least have one child`,[i.InvalidElement]:`Invalid element`,[i.MalformedLoop]:`Malformed loop`,[i.EmptyLoopSource]:`Empty loop source`,[i.InfiniteLoopCondition]:`Infinite loop condition`,[i.TemplateBlockExpected]:`Missing 'Template'`,[i.OnlyOneTemplateBlockExpected]:`Only one Template block expected`,[i.SingleChildExpected]:`Can have only a single child`,[i.MalformedLoopBounds]:`Malformed loop bounds`,[i.MalformedLoopParams]:`Malformed loop params`},s=class e{static __instance;config=void 0;overrides={};constructor(){}static getInstance(){return e.__instance||=new e,e.__instance}configure(e){this.overrides={...this.overrides,...e},this.config=void 0}parseBoolean(e){return typeof e==`boolean`?e:e==null||e===``?!1:String(e).toLowerCase()===`true`}parseMode(e){return[`development`,`production`,`test`].includes(e)?e:`production`}getProcessEnv(){return globalThis.process?.env??null}getConfig(){if(this.config)return this.config;let e=this.getProcessEnv()??{};return this.config={mode:this.overrides.mode??this.parseMode(e.MODE??e.NODE_ENV),showErrors:this.overrides.showErrors??this.parseBoolean(e.TRD_SHOW_ERRORS),showErrorsInProd:this.overrides.showErrorsInProd??this.parseBoolean(e.TRD_SHOW_ERRORS_IN_PROD),showErrorsInPlace:this.overrides.showErrorsInPlace??this.parseBoolean(e.TRD_SHOW_ERRORS_IN_PLACE)},this.config}getByKey(e){return this.getProcessEnv()?.[e]}get isShowErrors(){let e=this.getConfig();return e.showErrors&&(e.mode!==`production`||e.showErrorsInProd)}get isShowErrorsInPlace(){return this.getConfig().showErrorsInPlace}},c=e=>s.getInstance().configure(e),l=({errors:e})=>(0,t.jsx)(`ol`,{className:`trd-error-list my-3 list-none space-y-1.5 rounded-lg border border-red-200 bg-red-50 p-4 shadow-sm`,children:e.map((e,n)=>(0,t.jsxs)(`li`,{className:`trd-error-list__item flex items-start gap-2`,children:[(0,t.jsx)(`svg`,{className:`trd-error-list__icon mt-0.5 h-4 w-4 shrink-0 text-red-500`,viewBox:`0 0 20 20`,fill:`currentColor`,"aria-hidden":`true`,children:(0,t.jsx)(`path`,{fillRule:`evenodd`,d:`M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495ZM10 5a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 10 5Zm0 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z`,clipRule:`evenodd`})}),(0,t.jsx)(`i`,{className:`trd-error-list__item--text not-italic text-sm leading-5 text-red-700`,children:o[e]})]},`${e}-${n}`))}),u=e=>{if(e.length){let{isShowErrors:t,isShowErrorsInPlace:r}=s.getInstance(),i=null;return t&&r&&(i=(0,n.createElement)(l,{errors:e})),i}},d=e=>{for(let t of e){if(!t||!(0,n.isValidElement)(t))continue;let{displayName:e}=t.type;if(e){let{condition:n}=t.props;if((e===`If`||e===`ElseIf`)&&n===!0||e===`Else`)return t}}return null},f=({over:e,from:t,to:n,step:r})=>{let a=e??null,o=a!==null,s=o?a.length-1:null,c=t===void 0,l=n===void 0,u=!r,d=null,f=null,p=null,m=[];return r===0?m=[i.InfiniteLoopCondition]:o?a?.length===0?m=[i.EmptyLoopSource]:c&&l?u?(d=0,f=s,p=1):(p=r,d=p>0?0:s,f=p>0?s:0):c?(d=n>0?0:s,f=n,u?p=n>0?1:-1:(p=r,Math.sign(f-d)!==Math.sign(p)&&(m=[i.InfiniteLoopCondition]))):l?(d=t,u?(f=t>0?s:0,p=t>0?1:-1):(p=r,f=p>0?s:0,Math.sign(f-d)!==Math.sign(p)&&(m=[i.InfiniteLoopCondition]))):(d=t,f=n,u?p=f>=d?1:-1:(p=r,Math.sign(f-d)!==Math.sign(p)&&(m=[i.InfiniteLoopCondition]))):c&&l&&u||c&&l||c&&u||c||l?m=[i.MalformedLoop,i.MalformedLoopParams,i.MalformedLoopBounds]:(d=t,f=n,p=r||(f-d>0?1:-1),Math.sign(f-d)!==Math.sign(p)&&(m=[i.InfiniteLoopCondition])),a&&(d<0||d>a.length||f<0||f>a.length)&&(m=[i.MalformedLoop,i.MalformedLoopParams,i.MalformedLoopBounds]),m.length&&(a=d=f=p=null),{over:a,from:d,to:f,step:p,errors:m}},p=e=>{let t=[],r=n.Children.toArray(e.children);return r?.length===0?(t.push(i.ChildrenExpected),t):(r.forEach(e=>{let{displayName:n=a.Unknown}=e.type??{};(n===a.If||n===a.ElseIf||n===a.Else)&&(t.push(i.InvalidElement),t.push(i.CheckBlockExpected))}),t)},m=e=>{let t=[],r={},o=n.Children.toArray(e.children);return o.length===0?(t.push(i.ChildrenExpected,i.IfBlockExpected),t):(o.forEach((e,n)=>{let{displayName:i=a.Unknown}=e.type??{},s=r[i]??0;r[i]=s+1,h(i,n,r,t),g(i,n,o.length,r,t),_(i,n,t),v(i,t)}),r[a.If]||t.push(i.IfBlockExpected),t)},h=(e,t,n,r)=>{e===a.If&&(t!==0&&r.push(i.InvalidIfBlockOrdinal),n[a.If]>1&&r.push(i.OnlyOneIfBlockExpected))},g=(e,t,n,r,o)=>{e===a.Else&&(r[a.Else]>1&&o.push(i.OnlyOneElseBlockExpected),(t===0||t!==n-1)&&o.push(i.InvalidElseBlockOrdinal))},_=(e,t,n)=>{e===a.ElseIf&&t===0&&n.push(i.InvalidElseIfBlockOrdinal)},v=(e,t)=>{e!==a.If&&e!==a.ElseIf&&e!==a.Else&&t.push(i.InvalidElement)},y=e=>{let t=[],{errors:r}=e;t.push(...r);let o=n.Children.toArray(e.children);if(o.length===0)t.push(i.ChildrenExpected,i.TemplateBlockExpected);else if(o.length>1)t.push(i.SingleChildExpected,i.OnlyOneTemplateBlockExpected);else{let{displayName:e=a.Unknown}=o[0].type;e!==a.Template&&t.push(i.InvalidElement,i.TemplateBlockExpected)}return t},b=class{static get(e){let t=()=>[];switch(e){case a.Check:t=m;break;case a.If:case a.ElseIf:case a.Else:t=p;break;case a.Loop:t=y}return t}},x=e=>{let t=E(e,a.Check);return t.length?u(t):d(n.Children.toArray(e.children).filter(n.isValidElement))},S=e=>{let t=E(e,`If`);if(t.length)return u(t);let{condition:n,children:r}=e;return n?r:null},C=e=>{let t=E(e,`ElseIf`);if(t.length)return u(t);let{condition:n,children:r}=e;return n?r:null},w=e=>{let t=E(e,`Else`);if(t.length)return u(t);let{children:n}=e;return n??null},T=e=>{let t=(0,n.useId)(),{over:r,from:i,to:o,step:s,errors:c}=f(e),{children:l}=e,d=[],p=E({over:r,from:i,to:o,step:s,children:l,errors:c},a.Loop);if(p.length)return u(p);for(let e=i;s>0?e<=o:e>=o;e+=s)d.push((0,n.cloneElement)(l,{key:`${t}-${e}`,data:r?.[e]??e,index:e}));return d},E=(e,t)=>(0,n.useMemo)(()=>b.get(t),[t])(e),D=e=>(0,t.jsx)(t.Fragment,{children:x(e)});D.displayName=a.Check;var O=e=>(0,t.jsx)(t.Fragment,{children:w(e)});O.displayName=a.Else;var k=e=>(0,t.jsx)(t.Fragment,{children:C(e)});k.displayName=a.ElseIf;var A=e=>(0,t.jsx)(t.Fragment,{children:S(e)});A.displayName=a.If;var j=e=>(0,t.jsx)(t.Fragment,{children:T(e)});j.displayName=a.Loop;var M=e=>{let{index:t,data:n,children:r}=e;return t===void 0||n===void 0?null:r?.({index:t,data:n})??null};M.displayName=a.Template,e.Check=D,e.Else=O,e.ElseIf=k,e.If=A,e.Loop=j,e.Template=M,e.configure=c});
@@ -0,0 +1,51 @@
1
+ import { LogicErrors } from '../fixtures';
2
+ import { PropsWithChildren, ReactNode } from 'react';
3
+ type Nullable<T> = {
4
+ [P in keyof T]: T[P] | null;
5
+ };
6
+ export type EnvConfigs = {
7
+ mode: 'development' | 'production' | 'test';
8
+ showErrors: boolean;
9
+ showErrorsInProd: boolean;
10
+ showErrorsInPlace: boolean;
11
+ };
12
+ export type ErrorReportingOptions = {
13
+ mode?: EnvConfigs['mode'];
14
+ showErrors?: boolean;
15
+ showErrorsInProd?: boolean;
16
+ showErrorsInPlace?: boolean;
17
+ };
18
+ export type ProcessDataShape = {
19
+ process?: any;
20
+ prefix: string;
21
+ };
22
+ export type DataShape<T = any> = undefined | null | string | number | boolean | [] | {} | T | T[];
23
+ export type CheckProps = PropsWithChildren<{}>;
24
+ export type IfProps = PropsWithChildren<{
25
+ condition: boolean;
26
+ }>;
27
+ export type ElseIfProps = PropsWithChildren<{
28
+ condition: boolean;
29
+ }>;
30
+ export type ElseProps = PropsWithChildren<{}>;
31
+ export type LoopDataShape<T extends DataShape> = {
32
+ from?: number;
33
+ to?: number;
34
+ step?: number;
35
+ over?: T[];
36
+ };
37
+ export type LoopComputedShape<T> = {
38
+ errors: LogicErrors[];
39
+ } & Nullable<LoopDataShape<T>>;
40
+ export type LoopProps<T extends DataShape> = PropsWithChildren<LoopDataShape<T>>;
41
+ export type TemplateDataShape<T extends DataShape> = {
42
+ data: T;
43
+ index: number;
44
+ };
45
+ export type RenderFunction<T extends DataShape> = (data: TemplateDataShape<T>) => ReactNode;
46
+ export type TemplateProps<T extends DataShape> = Partial<TemplateDataShape<T>> & {
47
+ children: RenderFunction<T>;
48
+ };
49
+ export type ValidationProps = IfProps | ElseIfProps | ElseProps | LoopProps<DataShape>;
50
+ export type ValidatorFn<T extends ValidationProps> = (props: T) => LogicErrors[];
51
+ export {};
@@ -0,0 +1,76 @@
1
+ import { EnvConfigs, ErrorReportingOptions } from '../types';
2
+ /**
3
+ * Singleton class to manage runtime configurations. Values set through `configure()` always win over
4
+ * anything derived from the environment. When neither is set the library falls back to safe defaults.
5
+ */
6
+ export declare class ConfigManager {
7
+ private static __instance;
8
+ private config;
9
+ private overrides;
10
+ private constructor();
11
+ static getInstance(): ConfigManager;
12
+ /**
13
+ * Overrides the runtime configuration. Values provided here are always used. Call it any time to
14
+ * change behavior, e.g.:
15
+ *
16
+ * configure({ showErrors: true, showErrorsInProd: true, showErrorsInPlace: true });
17
+ *
18
+ * This is the recommended way to control the library - it works the same in every bundler/runtime.
19
+ *
20
+ * @param options Partial configuration to apply on top of any existing settings.
21
+ */
22
+ configure(options: ErrorReportingOptions): void;
23
+ /**
24
+ * Boolean env values only resolve to `true` when explicitly set to "true". Any variable not defined
25
+ * (undefined, null or empty) resolves to false.
26
+ */
27
+ private parseBoolean;
28
+ /**
29
+ * Parses the mode from an environment value.
30
+ * @param value The environment value for the mode.
31
+ */
32
+ private parseMode;
33
+ /**
34
+ * Reads the process environment when running on Node (SSR, tests, server-side). In browsers `process`
35
+ * is not defined, so this returns null and the configuration comes from `configure()` overrides and
36
+ * defaults only. `process.env` is a genuine runtime read - it is never baked into the build.
37
+ */
38
+ private getProcessEnv;
39
+ /**
40
+ * Gets the resolved configuration.
41
+ *
42
+ * Precedence: `configure()` override -> environment value -> default.
43
+ *
44
+ * Env keys read (Node/SSR only): `TRD_SHOW_ERRORS`, `TRD_SHOW_ERRORS_IN_PROD`, `TRD_SHOW_ERRORS_IN_PLACE`,
45
+ * plus `MODE`/`NODE_ENV` for the mode.
46
+ *
47
+ * @returns The resolved configuration.
48
+ */
49
+ getConfig(): EnvConfigs;
50
+ /**
51
+ * Reads a raw value from the process environment (Node/SSR only).
52
+ *
53
+ * @param key The environment variable name, e.g. `TRD_SHOW_ERRORS`.
54
+ * @returns The value of the key, or undefined when not defined.
55
+ */
56
+ getByKey(key: string): string | undefined;
57
+ /**
58
+ * Determines if errors should be shown based on the resolved configuration. Errors are shown if
59
+ * `showErrors` is true and either the mode is not 'production' or `showErrorsInProd` is true.
60
+ *
61
+ * @returns true if errors should be shown, false otherwise
62
+ */
63
+ get isShowErrors(): boolean;
64
+ /**
65
+ * Determines if errors should be shown in place based on the resolved configuration.
66
+ *
67
+ * @returns true if errors should be shown in place, false otherwise
68
+ */
69
+ get isShowErrorsInPlace(): boolean;
70
+ }
71
+ /**
72
+ * Public helper to configure the library at runtime. See {@link ConfigManager.configure}.
73
+ *
74
+ * @param options Partial configuration to apply.
75
+ */
76
+ export declare const configure: (options: ErrorReportingOptions) => void;
@@ -0,0 +1,34 @@
1
+ import { LogicErrors } from '../fixtures';
2
+ import { DataShape, LoopComputedShape, LoopProps } from '../types';
3
+ import { ReactElement, FunctionComponentElement, JSXElementConstructor } from 'react';
4
+ /**
5
+ * Create error components for the given errors if showErrors and showErrorsInPlace are true.
6
+ *
7
+ *
8
+ * @param errors Array of errors to be rendered.
9
+ * @returns An Error component with the errors if showErrors and showErrorsInPlace are true, otherwise null.
10
+ */
11
+ export declare const getErrors: (errors: LogicErrors[]) => FunctionComponentElement<{
12
+ errors: LogicErrors[];
13
+ }> | null | undefined;
14
+ /**
15
+ * Conditional elements to be rendered.
16
+ *
17
+ * WARNING!! DO NOT use this function, internal use only. This function is used by the If, ElseIf and Else components to determine which element to render.
18
+ *
19
+ * @param elements Array of react elements. Namely If, ElseIf, Else
20
+ * @returns Returns the first element that has a true condition, or the Else element if present, otherwise null.
21
+ */
22
+ export declare const getElementRenderer: (elements: ReactElement[]) => ReactElement<unknown, string | JSXElementConstructor<any>> | null;
23
+ /**
24
+ * A helper function to compute the loop parameters based on the provided props.
25
+ *
26
+ * WARNING!! DO NOT use this function, internal use only. This function is used by the useLoop hook to compute the loop parameters.
27
+ *
28
+ * TODO: Might be able to optimize this in the future.
29
+ *
30
+ * @param props LoopProps<T> object containing the loop parameters: over, from, to, step
31
+ *
32
+ * @returns Computed props
33
+ */
34
+ export declare const getComputedProps: <T extends DataShape>({ over, from, to, step }: LoopProps<T>) => LoopComputedShape<T>;
@@ -0,0 +1,3 @@
1
+ export { ConfigManager, configure } from './config';
2
+ export { getComputedProps, getElementRenderer, getErrors } from './helpers';
3
+ export { ValidationFactory } from './validators';
@@ -0,0 +1,7 @@
1
+ import { ValidatorFn } from '../types';
2
+ /**
3
+ * Factory class to get the validator function based on the directive name
4
+ */
5
+ export declare class ValidationFactory {
6
+ static get(validator: string): ValidatorFn<any>;
7
+ }
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />