@code0-tech/pictor 0.0.0-mvp.20 → 0.0.0-mvp.21

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.
@@ -3,21 +3,21 @@ import f from "react";
3
3
  import { Card as u } from "../card/Card.js";
4
4
  import { useService as S, useStore as l } from "../../utils/contextStore.js";
5
5
  import "merge-props";
6
- import { DNamespaceProjectReactiveService as o } from "./DNamespaceProject.service.js";
6
+ import { DNamespaceProjectReactiveService as i } from "./DNamespaceProject.service.js";
7
7
  import v from "../card/CardSection.js";
8
8
  import { DNamespaceProjectContent as j } from "./DNamespaceProjectContent.js";
9
- const b = (i) => {
9
+ const b = (c) => {
10
10
  const {
11
- namespaceId: c,
11
+ namespaceId: t,
12
12
  filter: m = () => !0,
13
13
  onSetting: s,
14
- onSelect: t,
14
+ onSelect: o,
15
15
  ...n
16
- } = i, p = S(o), a = l(o), d = f.useMemo(() => p.values({
17
- namespaceId: c
18
- }), [a]);
16
+ } = c, p = S(i), a = l(i), d = f.useMemo(() => p.values({
17
+ namespaceId: t
18
+ }), [a, t]);
19
19
  return /* @__PURE__ */ r(u, { ...n, children: d.filter(m).map((e) => e.id && /* @__PURE__ */ r(v, { border: !0, hover: !0, onClick: () => {
20
- t && t(e.id);
20
+ o && o(e.id);
21
21
  }, children: /* @__PURE__ */ r(j, { onSetting: s, projectId: e?.id }) }, e.id)) });
22
22
  };
23
23
  export {
@@ -1,47 +1,49 @@
1
- import { useState as c, useMemo as p, useCallback as g } from "react";
2
- function l(e, t, i) {
3
- return (t = b(t)) in e ? Object.defineProperty(e, t, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = i, e;
1
+ import { c as j } from "../../_virtual/compiler-runtime.js";
2
+ import { useState as w, useEffect as E } from "react";
3
+ function h(i, t, e) {
4
+ return (t = x(t)) in i ? Object.defineProperty(i, t, { value: e, enumerable: !0, configurable: !0, writable: !0 }) : i[t] = e, i;
4
5
  }
5
- function b(e) {
6
- var t = P(e, "string");
6
+ function x(i) {
7
+ var t = N(i, "string");
7
8
  return typeof t == "symbol" ? t : t + "";
8
9
  }
9
- function P(e, t) {
10
- if (typeof e != "object" || !e) return e;
11
- var i = e[Symbol.toPrimitive];
12
- if (i !== void 0) {
13
- var r = i.call(e, t);
10
+ function N(i, t) {
11
+ if (typeof i != "object" || !i) return i;
12
+ var e = i[Symbol.toPrimitive];
13
+ if (e !== void 0) {
14
+ var r = e.call(i, t);
14
15
  if (typeof r != "object") return r;
15
16
  throw new TypeError("@@toPrimitive must return a primitive value.");
16
17
  }
17
- return (t === "string" ? String : Number)(e);
18
+ return (t === "string" ? String : Number)(i);
18
19
  }
19
- class d {
20
- constructor(t, i, r, n) {
21
- l(this, "changeValue", void 0), l(this, "initialRender", void 0), l(this, "currentValues", void 0), l(this, "currentValidations", void 0), this.changeValue = t, this.currentValues = i, this.currentValidations = r, this.initialRender = n;
20
+ class _ {
21
+ constructor(t, e, r, s) {
22
+ h(this, "changeValue", void 0), h(this, "initialRender", void 0), h(this, "currentValues", void 0), h(this, "currentValidations", void 0), this.changeValue = t, this.currentValues = e, this.currentValidations = r, this.initialRender = s;
22
23
  }
23
24
  isValid() {
24
25
  if (!this.currentValidations) return !0;
25
26
  for (const t in this.currentValidations) {
26
- const i = this.currentValidations[t];
27
- if (i && i(this.currentValues[t], this.currentValues) !== null)
27
+ const e = this.currentValidations[t];
28
+ if (e && e(this.currentValues[t], this.currentValues) !== null)
28
29
  return !1;
29
30
  }
30
31
  return !0;
31
32
  }
32
33
  getInputProps(t) {
33
- const i = this.currentValues[t] || null, r = t, n = this.currentValidations && this.currentValidations[t] ? this.currentValidations[t] : (u) => null, s = this.initialRender ? null : n(i, this.currentValues);
34
+ const e = this.currentValues[t], r = e ?? null, s = t, l = this.currentValidations && this.currentValidations[t] ? this.currentValidations[t] : (n) => null, a = this.initialRender ? null : l(e, this.currentValues);
34
35
  return {
35
- initialValue: i,
36
+ // @ts-ignore – z.B. wenn dein Input `defaultValue` kennt
37
+ defaultValue: r,
36
38
  formValidation: {
37
- setValue: (u) => {
38
- this.changeValue(r, u);
39
+ setValue: (n) => {
40
+ this.changeValue(s, n);
39
41
  },
40
42
  ...this.initialRender ? {
41
43
  valid: !0
42
44
  } : {
43
- notValidMessage: s,
44
- valid: s === null ? !0 : !s
45
+ notValidMessage: a,
46
+ valid: a === null
45
47
  }
46
48
  },
47
49
  ...this.currentValidations && this.currentValidations[t] ? {
@@ -50,17 +52,40 @@ class d {
50
52
  };
51
53
  }
52
54
  }
53
- const w = (e) => {
54
- const {
55
- initialValues: t,
56
- validate: i = {},
57
- onSubmit: r
58
- } = e, [n, s] = c(t), u = (a, m) => s((o) => (o[a] = m, o)), V = p(() => new d(u, t, i, !0), []), [h, f] = c(V), v = g(() => {
59
- let a = new d(u, n, i, !1);
60
- f(() => a), r && a.isValid() && r(n);
61
- }, []);
62
- return [h, v];
55
+ const I = (i) => {
56
+ const t = j.c(17), {
57
+ initialValues: e,
58
+ validate: r,
59
+ onSubmit: s
60
+ } = i;
61
+ let l;
62
+ t[0] !== r ? (l = r === void 0 ? {} : r, t[0] = r, t[1] = l) : l = t[1];
63
+ const a = l, [n, b] = w(e), [R, y] = w(!1);
64
+ let u, o;
65
+ t[2] !== e ? (u = () => {
66
+ b(e), y(!1);
67
+ }, o = [e], t[2] = e, t[3] = u, t[4] = o) : (u = t[3], o = t[4]), E(u, o);
68
+ let c;
69
+ t[5] === Symbol.for("react.memo_cache_sentinel") ? (c = (g, S) => {
70
+ b((F) => ({
71
+ ...F,
72
+ [g]: S
73
+ }));
74
+ }, t[5] = c) : c = t[5];
75
+ const P = c, m = !R;
76
+ let d;
77
+ t[6] !== m || t[7] !== a || t[8] !== n ? (d = new _(P, n, a, m), t[6] = m, t[7] = a, t[8] = n, t[9] = d) : d = t[9];
78
+ const v = d;
79
+ let f;
80
+ t[10] !== s || t[11] !== a || t[12] !== n ? (f = () => {
81
+ y(!0);
82
+ const g = new _(P, n, a, !1);
83
+ s && g.isValid() && s(n);
84
+ }, t[10] = s, t[11] = a, t[12] = n, t[13] = f) : f = t[13];
85
+ const p = f;
86
+ let V;
87
+ return t[14] !== p || t[15] !== v ? (V = [v, p], t[14] = p, t[15] = v, t[16] = V) : V = t[16], V;
63
88
  };
64
89
  export {
65
- w as useForm
90
+ I as useForm
66
91
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code0-tech/pictor",
3
- "version": "0.0.0-mvp.20",
3
+ "version": "0.0.0-mvp.21",
4
4
  "type": "module",
5
5
  "description": "A simple template for a custom React component library",
6
6
  "scripts": {