@junojs/core 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,93 +1,93 @@
1
- var C = Object.defineProperty;
2
- var k = (i, t, e) => t in i ? C(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
- var h = (i, t, e) => k(i, typeof t != "symbol" ? t + "" : t, e);
1
+ var j = Object.defineProperty;
2
+ var O = (i, t, e) => t in i ? j(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
+ var h = (i, t, e) => O(i, typeof t != "symbol" ? t + "" : t, e);
4
4
  import "reflect-metadata";
5
- function J(i) {
5
+ function z(i) {
6
6
  return (t) => {
7
7
  i.shadow === void 0 && (i.shadow = !0), Reflect.defineMetadata("nf:config", i, t);
8
8
  };
9
9
  }
10
- function W() {
10
+ function K() {
11
11
  return (i, t) => {
12
12
  const e = Reflect.getMetadata("nf:states", i) || [];
13
13
  e.push(t), Reflect.defineMetadata("nf:states", e, i);
14
14
  };
15
15
  }
16
- function K() {
16
+ function Z() {
17
17
  return (i, t) => {
18
18
  const e = Reflect.getMetadata("nf:inputs", i) || [];
19
19
  e.push(t), Reflect.defineMetadata("nf:inputs", e, i);
20
20
  };
21
21
  }
22
- function z(i) {
22
+ function G(i) {
23
23
  return (t, e) => {
24
24
  const s = Reflect.getMetadata("nf:params", t) || [];
25
25
  s.push({ key: e, paramName: i || e }), Reflect.defineMetadata("nf:params", s, t);
26
26
  };
27
27
  }
28
- function G(i) {
28
+ function Q(i) {
29
29
  return (t, e) => {
30
30
  Reflect.defineMetadata("nf:inject", i, t, e);
31
31
  };
32
32
  }
33
- function Q() {
33
+ function X() {
34
34
  return (i, t) => {
35
35
  const e = Reflect.getMetadata("nf:transforms", i) || [];
36
36
  e.push(t), Reflect.defineMetadata("nf:transforms", e, i);
37
37
  };
38
38
  }
39
- function X() {
39
+ function B() {
40
40
  return (i, t) => {
41
41
  const e = Reflect.getMetadata("nf:actions", i) || [];
42
42
  e.push(t), Reflect.defineMetadata("nf:actions", e, i);
43
43
  };
44
44
  }
45
- function B(i) {
45
+ function Y(i) {
46
46
  return (t, e) => {
47
47
  const s = Reflect.getMetadata("nf:provides", t) || [];
48
48
  s.push({ key: i, property: e }), Reflect.defineMetadata("nf:provides", s, t);
49
49
  };
50
50
  }
51
- function Y(i) {
51
+ function tt(i) {
52
52
  return (t, e) => {
53
53
  const s = Reflect.getMetadata("nf:injects", t) || [];
54
54
  s.push({ key: i, property: e }), Reflect.defineMetadata("nf:injects", s, t);
55
55
  };
56
56
  }
57
- function Z(i) {
57
+ function et(i) {
58
58
  return (t) => {
59
59
  const e = Reflect.getMetadata("nf:refine", t) || [];
60
60
  e.push(i), Reflect.defineMetadata("nf:refine", e, t);
61
61
  };
62
62
  }
63
- function tt(i, t) {
63
+ function st(i, t) {
64
64
  return (e, s) => {
65
65
  const n = Reflect.getMetadata("nf:validates", e) || [];
66
66
  n.push({ key: s, predicate: i, message: t }), Reflect.defineMetadata("nf:validates", n, e);
67
67
  };
68
68
  }
69
- function et(i) {
69
+ function nt(i) {
70
70
  return (t, e) => {
71
71
  Reflect.defineMetadata("nf:intercept", i, t, e);
72
72
  };
73
73
  }
74
- function st(i) {
74
+ function it(i) {
75
75
  return (t) => {
76
76
  Reflect.defineMetadata("nf:canActivate", i, t);
77
77
  };
78
78
  }
79
- function nt() {
79
+ function rt() {
80
80
  return (i, t) => {
81
81
  const e = Reflect.getMetadata("nf:host-properties", i) || [];
82
82
  e.push(t), Reflect.defineMetadata("nf:host-properties", e, i);
83
83
  };
84
84
  }
85
- function it(i) {
85
+ function at(i) {
86
86
  return (t) => {
87
87
  Reflect.defineMetadata("nf:schema", i, t);
88
88
  };
89
89
  }
90
- function rt(i = "local") {
90
+ function ot(i = "local") {
91
91
  return (t, e) => {
92
92
  const s = Reflect.getMetadata("nf:persist", t) || [];
93
93
  s.push({
@@ -97,14 +97,14 @@ function rt(i = "local") {
97
97
  }), Reflect.defineMetadata("nf:persist", s, t);
98
98
  };
99
99
  }
100
- function $(i) {
100
+ function L(i) {
101
101
  if (!(typeof window > "u"))
102
102
  return i === "session" ? window.sessionStorage : window.localStorage;
103
103
  }
104
- function j(i) {
104
+ function q(i) {
105
105
  const t = Reflect.getMetadata("nf:persist", i) || [];
106
106
  for (const e of t) {
107
- const s = $(e.storage);
107
+ const s = L(e.storage);
108
108
  if (!s) continue;
109
109
  const n = s.getItem(e.key);
110
110
  if (n !== null)
@@ -115,20 +115,20 @@ function j(i) {
115
115
  }
116
116
  }
117
117
  }
118
- function O(i, t, e) {
118
+ function D(i, t, e) {
119
119
  const n = (Reflect.getMetadata("nf:persist", i) || []).find((r) => r.property === t);
120
120
  if (n) {
121
- const r = $(n.storage);
121
+ const r = L(n.storage);
122
122
  r && r.setItem(n.key, JSON.stringify(e));
123
123
  }
124
124
  }
125
- function q(i, t) {
125
+ function U(i, t) {
126
126
  const e = Reflect.getMetadata("nf:states", i) || [], s = Reflect.getMetadata("nf:inputs", i) || [], n = [...e, ...s, "errors"];
127
127
  let r;
128
128
  return r = new Proxy(i, {
129
129
  set(o, a, c) {
130
130
  const l = o[a];
131
- return o[a] = c, n.includes(a) && l !== c && (O(o, a, c), t()), !0;
131
+ return o[a] = c, n.includes(a) && l !== c && (D(o, a, c), t()), !0;
132
132
  },
133
133
  get(o, a) {
134
134
  const c = o[a];
@@ -136,7 +136,7 @@ function q(i, t) {
136
136
  }
137
137
  }), r;
138
138
  }
139
- class D {
139
+ class V {
140
140
  static render(t, e) {
141
141
  const r = new DOMParser().parseFromString(`<div>${t}</div>`, "text/html").body.firstElementChild;
142
142
  return r ? (this.processNode(r, e), r) : document.createElement("div");
@@ -150,16 +150,16 @@ class D {
150
150
  if (t.nodeType !== Node.ELEMENT_NODE) return;
151
151
  const s = t, n = s.tagName.toLowerCase();
152
152
  if (n === "for") {
153
- const m = (((c = s.getAttribute("each")) == null ? void 0 : c.trim()) || "").replace(/^\{/, "").replace(/\}$/, "").match(/(\w+)\s+in\s+(.+)/);
153
+ const m = (((c = s.getAttribute("each")) == null ? void 0 : c.trim()) || "").replace(/^\{/, "").replace(/\}$/, "").match(/(?:\(\s*([a-zA-Z_$]\w*)\s*,\s*([a-zA-Z_$]\w*)\s*\)|([a-zA-Z_$]\w*))\s+in\s+(.+)/);
154
154
  if (m) {
155
- const g = m[1], y = m[2], v = this.evaluateExpression(y, e), A = document.createDocumentFragment();
156
- Array.isArray(v) && v.forEach((E) => {
157
- const w = Object.create(e);
158
- w[g] = E;
155
+ const g = m[1] || m[3], y = m[2], v = m[4], T = this.evaluateExpression(v, e), w = document.createDocumentFragment();
156
+ Array.isArray(T) && T.forEach((E, C) => {
157
+ const _ = Object.create(e);
158
+ _[g] = E, y && (_[y] = C);
159
159
  const P = s.cloneNode(!0);
160
- for (Array.from(P.childNodes).forEach((I) => this.processNode(I, w)); P.firstChild; )
161
- A.appendChild(P.firstChild);
162
- }), (l = s.parentNode) == null || l.replaceChild(A, s);
160
+ for (Array.from(P.childNodes).forEach((k) => this.processNode(k, _)); P.firstChild; )
161
+ w.appendChild(P.firstChild);
162
+ }), (l = s.parentNode) == null || l.replaceChild(w, s);
163
163
  }
164
164
  return;
165
165
  }
@@ -168,16 +168,16 @@ class D {
168
168
  let m = !1;
169
169
  try {
170
170
  m = !!new Function("ctx", `with(ctx) { return ${d} }`)(e);
171
- } catch (E) {
172
- console.error(`JunoEngine condition error: ${d}`, E);
171
+ } catch (w) {
172
+ console.error(`JunoEngine condition error: ${d}`, w);
173
173
  }
174
- const g = document.createDocumentFragment(), y = Array.from(s.childNodes), v = y.findIndex((E) => {
175
- var w;
176
- return ((w = E.tagName) == null ? void 0 : w.toLowerCase()) === "else";
174
+ const g = document.createDocumentFragment(), y = Array.from(s.childNodes), v = y.findIndex((w) => {
175
+ var E;
176
+ return ((E = w.tagName) == null ? void 0 : E.toLowerCase()) === "else";
177
177
  });
178
- (m ? v !== -1 ? y.slice(0, v) : y : v !== -1 ? Array.from(y[v].childNodes) : []).forEach((E) => {
179
- const w = E.cloneNode(!0);
180
- this.processNode(w, e), g.appendChild(w);
178
+ (m ? v !== -1 ? y.slice(0, v) : y : v !== -1 ? Array.from(y[v].childNodes) : []).forEach((w) => {
179
+ const E = w.cloneNode(!0);
180
+ this.processNode(E, e), g.appendChild(E);
181
181
  }), (p = s.parentNode) == null || p.replaceChild(g, s);
182
182
  return;
183
183
  }
@@ -210,16 +210,16 @@ class D {
210
210
  });
211
211
  }
212
212
  }
213
- function U(i, t) {
213
+ function F(i, t) {
214
214
  let e;
215
215
  typeof t == "string" ? e = new DOMParser().parseFromString(`<body>${t}</body>`, "text/html").body : e = t;
216
216
  const s = i instanceof ShadowRoot ? i : document, n = s.activeElement, r = n && n.id ? `#${n.id}` : null, o = n ? n.selectionStart : null, a = n ? n.selectionEnd : null;
217
- if (L(i, e, i), r) {
217
+ if (I(i, e, i), r) {
218
218
  const c = i.querySelector(r);
219
219
  c && c !== s.activeElement && (c.focus(), o !== null && a !== null && c.setSelectionRange(o, a));
220
220
  }
221
221
  }
222
- function L(i, t, e) {
222
+ function I(i, t, e) {
223
223
  const s = Array.from(i.childNodes), n = Array.from(t.childNodes), r = Math.max(s.length, n.length);
224
224
  for (let o = 0; o < r; o++) {
225
225
  const a = s[o], c = n[o];
@@ -253,7 +253,7 @@ function L(i, t, e) {
253
253
  const d = f.value || f.getAttribute("value") || "";
254
254
  l.value !== d && (l.value = d);
255
255
  }
256
- (!l.tagName.includes("-") || l === e) && L(l, f, e);
256
+ (!l.tagName.includes("-") || l === e) && I(l, f, e);
257
257
  }
258
258
  }
259
259
  }
@@ -356,7 +356,7 @@ const x = class x {
356
356
  };
357
357
  h(x, "_instance");
358
358
  let N = x;
359
- async function at(i) {
359
+ async function ct(i) {
360
360
  const t = Reflect.getMetadata("nf:config", i);
361
361
  if (!t || !t.tag)
362
362
  throw new Error("Missing @Component decorator or tag!");
@@ -416,7 +416,7 @@ async function at(i) {
416
416
  }
417
417
  }
418
418
  return l.length > 0 ? Promise.all(l).then(() => r) : r;
419
- }), j(this.instance), this.proxy = q(this.instance, () => this.update()), t.shadow ? this.target = this.shadowRoot || this.attachShadow({ mode: "open" }) : this.target = this;
419
+ }), q(this.instance), this.proxy = U(this.instance, () => this.update()), t.shadow ? this.target = this.shadowRoot || this.attachShadow({ mode: "open" }) : this.target = this;
420
420
  const n = (r, o) => {
421
421
  let a = r.target;
422
422
  for (; a && a !== this.parentElement; ) {
@@ -525,8 +525,8 @@ async function at(i) {
525
525
  typeof this.proxy[c] == "function" && (r[c] = this.proxy[c]);
526
526
  const o = Object.create(this.proxy);
527
527
  o.__transforms__ = r;
528
- const a = D.render(s, o);
529
- U(this.target, a);
528
+ const a = V.render(s, o);
529
+ F(this.target, a);
530
530
  }
531
531
  }
532
532
  );
@@ -572,7 +572,7 @@ const M = class M {
572
572
  // ── Singleton ─────────────────────────────────────────────
573
573
  h(M, "_instance");
574
574
  let S = M;
575
- class ot {
575
+ class lt {
576
576
  constructor() {
577
577
  h(this, "_initialValues", {});
578
578
  h(this, "_touched", {});
@@ -621,40 +621,40 @@ class ot {
621
621
  });
622
622
  }
623
623
  }
624
- function T(i, t, e) {
624
+ function A(i, t, e) {
625
625
  const s = Reflect.getMetadata("nf:validators", i) || /* @__PURE__ */ new Map(), n = s.get(t) || [];
626
626
  n.push(e), s.set(t, n), Reflect.defineMetadata("nf:validators", s, i);
627
627
  }
628
- function ct(i = "This field is required") {
628
+ function ft(i = "This field is required") {
629
629
  return (t, e) => {
630
- T(t, e, {
630
+ A(t, e, {
631
631
  name: "required",
632
632
  message: i,
633
633
  validate: (s) => s != null && String(s).trim().length > 0
634
634
  });
635
635
  };
636
636
  }
637
- function lt(i = "Invalid email address") {
637
+ function dt(i = "Invalid email address") {
638
638
  return (t, e) => {
639
- T(t, e, {
639
+ A(t, e, {
640
640
  name: "email",
641
641
  message: i,
642
642
  validate: (s) => s ? /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(s)) : !0
643
643
  });
644
644
  };
645
645
  }
646
- function ft(i, t) {
646
+ function ut(i, t) {
647
647
  return (e, s) => {
648
- T(e, s, {
648
+ A(e, s, {
649
649
  name: "match",
650
650
  message: t || `Must match ${i}`,
651
651
  validate: (n, r) => n === r[i]
652
652
  });
653
653
  };
654
654
  }
655
- function dt(i, t = "Invalid format") {
655
+ function ht(i, t = "Invalid format") {
656
656
  return (e, s) => {
657
- T(e, s, {
657
+ A(e, s, {
658
658
  name: "pattern",
659
659
  message: t,
660
660
  validate: (n) => n ? i.test(String(n)) : !0
@@ -694,7 +694,7 @@ class b {
694
694
  }
695
695
  }
696
696
  }
697
- class V {
697
+ class H {
698
698
  constructor() {
699
699
  h(this, "fields", {});
700
700
  h(this, "refines", []);
@@ -728,13 +728,13 @@ class V {
728
728
  return { success: s, errors: s ? void 0 : e };
729
729
  }
730
730
  }
731
- const ut = {
731
+ const pt = {
732
732
  string: () => new b(),
733
733
  number: () => new b(),
734
734
  boolean: () => new b(),
735
- object: (i) => new V().shape(i)
735
+ object: (i) => new H().shape(i)
736
736
  };
737
- class ht {
737
+ class mt {
738
738
  constructor() {
739
739
  h(this, "requestInterceptors", []);
740
740
  h(this, "responseInterceptors", []);
@@ -859,38 +859,38 @@ const R = class R {
859
859
  };
860
860
  // ── Singleton ─────────────────────────────────────────────
861
861
  h(R, "_instance");
862
- let _ = R;
862
+ let $ = R;
863
863
  export {
864
- X as Action,
865
- st as CanActivate,
866
- J as Component,
867
- lt as Email,
864
+ B as Action,
865
+ it as CanActivate,
866
+ z as Component,
867
+ dt as Email,
868
868
  S as ErrorHandler,
869
- ot as FormModel,
870
- V as FormSchema,
871
- nt as HostElement,
872
- ht as HttpClient,
873
- _ as I18nService,
874
- Y as Inject,
875
- K as Input,
876
- et as Intercept,
877
- D as JunoEngine,
878
- ft as Match,
879
- z as Param,
880
- dt as Pattern,
881
- rt as Persist,
882
- B as Provide,
883
- Z as Refine,
884
- ct as Required,
869
+ lt as FormModel,
870
+ H as FormSchema,
871
+ rt as HostElement,
872
+ mt as HttpClient,
873
+ $ as I18nService,
874
+ tt as Inject,
875
+ Z as Input,
876
+ nt as Intercept,
877
+ V as JunoEngine,
878
+ ut as Match,
879
+ G as Param,
880
+ ht as Pattern,
881
+ ot as Persist,
882
+ Y as Provide,
883
+ et as Refine,
884
+ ft as Required,
885
885
  N as RouterService,
886
- it as Schema,
886
+ at as Schema,
887
887
  b as SchemaField,
888
- W as State,
889
- Q as Transform,
890
- G as Use,
891
- tt as Validate,
892
- at as bootstrap,
893
- q as createReactiveProxy,
894
- ut as s
888
+ K as State,
889
+ X as Transform,
890
+ Q as Use,
891
+ st as Validate,
892
+ ct as bootstrap,
893
+ U as createReactiveProxy,
894
+ pt as s
895
895
  };
896
896
  //# sourceMappingURL=index.js.map