@piying/view-react 1.4.1 → 1.5.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.
package/index.js CHANGED
@@ -1,8 +1,9 @@
1
- import me, { createContext as Z, useContext as D, useState as Y, useMemo as f, useRef as C, useEffect as M, useCallback as he } from "react";
2
- import { effect as be, createRootInjector as ge, ChangeDetectionSchedulerImpl as Ee, ChangeDetectionScheduler as pe, createInjector as Re, DestroyRef as ve, untracked as _e } from "static-injector";
3
- import { createViewControlLink as Te, CoreSchemaHandle as Ce, FormBuilder as je, convert as xe, initListen as ke } from "@piying/view-core";
1
+ import require$$0, { createContext, useContext, useState, useMemo, useRef, useEffect, useCallback } from "react";
2
+ import { effect, createRootInjector, ChangeDetectionSchedulerImpl, ChangeDetectionScheduler, createInjector, DestroyRef, untracked } from "static-injector";
3
+ import { createViewControlLink, CoreSchemaHandle, FormBuilder, convert, initListen } from "@piying/view-core";
4
4
  import "valibot";
5
- var w = { exports: {} }, x = {};
5
+ var jsxRuntime = { exports: {} };
6
+ var reactJsxRuntime_production = {};
6
7
  /**
7
8
  * @license React
8
9
  * react-jsx-runtime.production.js
@@ -12,29 +13,35 @@ var w = { exports: {} }, x = {};
12
13
  * This source code is licensed under the MIT license found in the
13
14
  * LICENSE file in the root directory of this source tree.
14
15
  */
15
- var J;
16
- function Oe() {
17
- if (J) return x;
18
- J = 1;
19
- var r = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
20
- function t(s, o, l) {
21
- var c = null;
22
- if (l !== void 0 && (c = "" + l), o.key !== void 0 && (c = "" + o.key), "key" in o) {
23
- l = {};
24
- for (var g in o)
25
- g !== "key" && (l[g] = o[g]);
26
- } else l = o;
27
- return o = l.ref, {
28
- $$typeof: r,
29
- type: s,
30
- key: c,
31
- ref: o !== void 0 ? o : null,
32
- props: l
16
+ var hasRequiredReactJsxRuntime_production;
17
+ function requireReactJsxRuntime_production() {
18
+ if (hasRequiredReactJsxRuntime_production) return reactJsxRuntime_production;
19
+ hasRequiredReactJsxRuntime_production = 1;
20
+ var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
21
+ function jsxProd(type, config, maybeKey) {
22
+ var key = null;
23
+ void 0 !== maybeKey && (key = "" + maybeKey);
24
+ void 0 !== config.key && (key = "" + config.key);
25
+ if ("key" in config) {
26
+ maybeKey = {};
27
+ for (var propName in config)
28
+ "key" !== propName && (maybeKey[propName] = config[propName]);
29
+ } else maybeKey = config;
30
+ config = maybeKey.ref;
31
+ return {
32
+ $$typeof: REACT_ELEMENT_TYPE,
33
+ type,
34
+ key,
35
+ ref: void 0 !== config ? config : null,
36
+ props: maybeKey
33
37
  };
34
38
  }
35
- return x.Fragment = n, x.jsx = t, x.jsxs = t, x;
39
+ reactJsxRuntime_production.Fragment = REACT_FRAGMENT_TYPE;
40
+ reactJsxRuntime_production.jsx = jsxProd;
41
+ reactJsxRuntime_production.jsxs = jsxProd;
42
+ return reactJsxRuntime_production;
36
43
  }
37
- var k = {};
44
+ var reactJsxRuntime_development = {};
38
45
  /**
39
46
  * @license React
40
47
  * react-jsx-runtime.development.js
@@ -44,501 +51,603 @@ var k = {};
44
51
  * This source code is licensed under the MIT license found in the
45
52
  * LICENSE file in the root directory of this source tree.
46
53
  */
47
- var z;
48
- function Se() {
49
- return z || (z = 1, process.env.NODE_ENV !== "production" && function() {
50
- function r(e) {
51
- if (e == null) return null;
52
- if (typeof e == "function")
53
- return e.$$typeof === ie ? null : e.displayName || e.name || null;
54
- if (typeof e == "string") return e;
55
- switch (e) {
56
- case A:
54
+ var hasRequiredReactJsxRuntime_development;
55
+ function requireReactJsxRuntime_development() {
56
+ if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
57
+ hasRequiredReactJsxRuntime_development = 1;
58
+ "production" !== process.env.NODE_ENV && function() {
59
+ function getComponentNameFromType(type) {
60
+ if (null == type) return null;
61
+ if ("function" === typeof type)
62
+ return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
63
+ if ("string" === typeof type) return type;
64
+ switch (type) {
65
+ case REACT_FRAGMENT_TYPE:
57
66
  return "Fragment";
58
- case te:
67
+ case REACT_PROFILER_TYPE:
59
68
  return "Profiler";
60
- case re:
69
+ case REACT_STRICT_MODE_TYPE:
61
70
  return "StrictMode";
62
- case se:
71
+ case REACT_SUSPENSE_TYPE:
63
72
  return "Suspense";
64
- case le:
73
+ case REACT_SUSPENSE_LIST_TYPE:
65
74
  return "SuspenseList";
66
- case ce:
75
+ case REACT_ACTIVITY_TYPE:
67
76
  return "Activity";
68
77
  }
69
- if (typeof e == "object")
70
- switch (typeof e.tag == "number" && console.error(
78
+ if ("object" === typeof type)
79
+ switch ("number" === typeof type.tag && console.error(
71
80
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
72
- ), e.$$typeof) {
73
- case m:
81
+ ), type.$$typeof) {
82
+ case REACT_PORTAL_TYPE:
74
83
  return "Portal";
75
- case oe:
76
- return (e.displayName || "Context") + ".Provider";
77
- case ne:
78
- return (e._context.displayName || "Context") + ".Consumer";
79
- case ue:
80
- var u = e.render;
81
- return e = e.displayName, e || (e = u.displayName || u.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
82
- case ae:
83
- return u = e.displayName || null, u !== null ? u : r(e.type) || "Memo";
84
- case $:
85
- u = e._payload, e = e._init;
84
+ case REACT_CONTEXT_TYPE:
85
+ return (type.displayName || "Context") + ".Provider";
86
+ case REACT_CONSUMER_TYPE:
87
+ return (type._context.displayName || "Context") + ".Consumer";
88
+ case REACT_FORWARD_REF_TYPE:
89
+ var innerType = type.render;
90
+ type = type.displayName;
91
+ type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
92
+ return type;
93
+ case REACT_MEMO_TYPE:
94
+ return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
95
+ case REACT_LAZY_TYPE:
96
+ innerType = type._payload;
97
+ type = type._init;
86
98
  try {
87
- return r(e(u));
88
- } catch {
99
+ return getComponentNameFromType(type(innerType));
100
+ } catch (x) {
89
101
  }
90
102
  }
91
103
  return null;
92
104
  }
93
- function n(e) {
94
- return "" + e;
105
+ function testStringCoercion(value) {
106
+ return "" + value;
95
107
  }
96
- function t(e) {
108
+ function checkKeyStringCoercion(value) {
97
109
  try {
98
- n(e);
99
- var u = !1;
100
- } catch {
101
- u = !0;
110
+ testStringCoercion(value);
111
+ var JSCompiler_inline_result = false;
112
+ } catch (e) {
113
+ JSCompiler_inline_result = true;
102
114
  }
103
- if (u) {
104
- u = console;
105
- var a = u.error, h = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
106
- return a.call(
107
- u,
115
+ if (JSCompiler_inline_result) {
116
+ JSCompiler_inline_result = console;
117
+ var JSCompiler_temp_const = JSCompiler_inline_result.error;
118
+ var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
119
+ JSCompiler_temp_const.call(
120
+ JSCompiler_inline_result,
108
121
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
109
- h
110
- ), n(e);
122
+ JSCompiler_inline_result$jscomp$0
123
+ );
124
+ return testStringCoercion(value);
111
125
  }
112
126
  }
113
- function s(e) {
114
- if (e === A) return "<>";
115
- if (typeof e == "object" && e !== null && e.$$typeof === $)
127
+ function getTaskName(type) {
128
+ if (type === REACT_FRAGMENT_TYPE) return "<>";
129
+ if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE)
116
130
  return "<...>";
117
131
  try {
118
- var u = r(e);
119
- return u ? "<" + u + ">" : "<...>";
120
- } catch {
132
+ var name = getComponentNameFromType(type);
133
+ return name ? "<" + name + ">" : "<...>";
134
+ } catch (x) {
121
135
  return "<...>";
122
136
  }
123
137
  }
124
- function o() {
125
- var e = y.A;
126
- return e === null ? null : e.getOwner();
138
+ function getOwner() {
139
+ var dispatcher = ReactSharedInternals.A;
140
+ return null === dispatcher ? null : dispatcher.getOwner();
127
141
  }
128
- function l() {
142
+ function UnknownOwner() {
129
143
  return Error("react-stack-top-frame");
130
144
  }
131
- function c(e) {
132
- if (L.call(e, "key")) {
133
- var u = Object.getOwnPropertyDescriptor(e, "key").get;
134
- if (u && u.isReactWarning) return !1;
145
+ function hasValidKey(config) {
146
+ if (hasOwnProperty.call(config, "key")) {
147
+ var getter = Object.getOwnPropertyDescriptor(config, "key").get;
148
+ if (getter && getter.isReactWarning) return false;
135
149
  }
136
- return e.key !== void 0;
150
+ return void 0 !== config.key;
137
151
  }
138
- function g(e, u) {
139
- function a() {
140
- W || (W = !0, console.error(
152
+ function defineKeyPropWarningGetter(props, displayName) {
153
+ function warnAboutAccessingKey() {
154
+ specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error(
141
155
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
142
- u
156
+ displayName
143
157
  ));
144
158
  }
145
- a.isReactWarning = !0, Object.defineProperty(e, "key", {
146
- get: a,
147
- configurable: !0
159
+ warnAboutAccessingKey.isReactWarning = true;
160
+ Object.defineProperty(props, "key", {
161
+ get: warnAboutAccessingKey,
162
+ configurable: true
148
163
  });
149
164
  }
150
- function i() {
151
- var e = r(this.type);
152
- return G[e] || (G[e] = !0, console.error(
165
+ function elementRefGetterWithDeprecationWarning() {
166
+ var componentName = getComponentNameFromType(this.type);
167
+ didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error(
153
168
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
154
- )), e = this.props.ref, e !== void 0 ? e : null;
169
+ ));
170
+ componentName = this.props.ref;
171
+ return void 0 !== componentName ? componentName : null;
155
172
  }
156
- function _(e, u, a, h, R, p, I, N) {
157
- return a = p.ref, e = {
158
- $$typeof: S,
159
- type: e,
160
- key: u,
161
- props: p,
162
- _owner: R
163
- }, (a !== void 0 ? a : null) !== null ? Object.defineProperty(e, "ref", {
164
- enumerable: !1,
165
- get: i
166
- }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
167
- configurable: !1,
168
- enumerable: !1,
169
- writable: !0,
173
+ function ReactElement(type, key, self, source, owner, props, debugStack, debugTask) {
174
+ self = props.ref;
175
+ type = {
176
+ $$typeof: REACT_ELEMENT_TYPE,
177
+ type,
178
+ key,
179
+ props,
180
+ _owner: owner
181
+ };
182
+ null !== (void 0 !== self ? self : null) ? Object.defineProperty(type, "ref", {
183
+ enumerable: false,
184
+ get: elementRefGetterWithDeprecationWarning
185
+ }) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
186
+ type._store = {};
187
+ Object.defineProperty(type._store, "validated", {
188
+ configurable: false,
189
+ enumerable: false,
190
+ writable: true,
170
191
  value: 0
171
- }), Object.defineProperty(e, "_debugInfo", {
172
- configurable: !1,
173
- enumerable: !1,
174
- writable: !0,
192
+ });
193
+ Object.defineProperty(type, "_debugInfo", {
194
+ configurable: false,
195
+ enumerable: false,
196
+ writable: true,
175
197
  value: null
176
- }), Object.defineProperty(e, "_debugStack", {
177
- configurable: !1,
178
- enumerable: !1,
179
- writable: !0,
180
- value: I
181
- }), Object.defineProperty(e, "_debugTask", {
182
- configurable: !1,
183
- enumerable: !1,
184
- writable: !0,
185
- value: N
186
- }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
198
+ });
199
+ Object.defineProperty(type, "_debugStack", {
200
+ configurable: false,
201
+ enumerable: false,
202
+ writable: true,
203
+ value: debugStack
204
+ });
205
+ Object.defineProperty(type, "_debugTask", {
206
+ configurable: false,
207
+ enumerable: false,
208
+ writable: true,
209
+ value: debugTask
210
+ });
211
+ Object.freeze && (Object.freeze(type.props), Object.freeze(type));
212
+ return type;
187
213
  }
188
- function O(e, u, a, h, R, p, I, N) {
189
- var b = u.children;
190
- if (b !== void 0)
191
- if (h)
192
- if (de(b)) {
193
- for (h = 0; h < b.length; h++)
194
- j(b[h]);
195
- Object.freeze && Object.freeze(b);
214
+ function jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self, debugStack, debugTask) {
215
+ var children = config.children;
216
+ if (void 0 !== children)
217
+ if (isStaticChildren)
218
+ if (isArrayImpl(children)) {
219
+ for (isStaticChildren = 0; isStaticChildren < children.length; isStaticChildren++)
220
+ validateChildKeys(children[isStaticChildren]);
221
+ Object.freeze && Object.freeze(children);
196
222
  } else
197
223
  console.error(
198
224
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
199
225
  );
200
- else j(b);
201
- if (L.call(u, "key")) {
202
- b = r(e);
203
- var T = Object.keys(u).filter(function(fe) {
204
- return fe !== "key";
226
+ else validateChildKeys(children);
227
+ if (hasOwnProperty.call(config, "key")) {
228
+ children = getComponentNameFromType(type);
229
+ var keys = Object.keys(config).filter(function(k) {
230
+ return "key" !== k;
205
231
  });
206
- h = 0 < T.length ? "{key: someKey, " + T.join(": ..., ") + ": ...}" : "{key: someKey}", q[b + h] || (T = 0 < T.length ? "{" + T.join(": ..., ") + ": ...}" : "{}", console.error(
207
- `A props object containing a "key" prop is being spread into JSX:
208
- let props = %s;
209
- <%s {...props} />
210
- React keys must be passed directly to JSX without using spread:
211
- let props = %s;
212
- <%s key={someKey} {...props} />`,
213
- h,
214
- b,
215
- T,
216
- b
217
- ), q[b + h] = !0);
232
+ isStaticChildren = 0 < keys.length ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
233
+ didWarnAboutKeySpread[children + isStaticChildren] || (keys = 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}", console.error(
234
+ 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
235
+ isStaticChildren,
236
+ children,
237
+ keys,
238
+ children
239
+ ), didWarnAboutKeySpread[children + isStaticChildren] = true);
218
240
  }
219
- if (b = null, a !== void 0 && (t(a), b = "" + a), c(u) && (t(u.key), b = "" + u.key), "key" in u) {
220
- a = {};
221
- for (var F in u)
222
- F !== "key" && (a[F] = u[F]);
223
- } else a = u;
224
- return b && g(
225
- a,
226
- typeof e == "function" ? e.displayName || e.name || "Unknown" : e
227
- ), _(
228
- e,
229
- b,
230
- p,
231
- R,
232
- o(),
233
- a,
234
- I,
235
- N
241
+ children = null;
242
+ void 0 !== maybeKey && (checkKeyStringCoercion(maybeKey), children = "" + maybeKey);
243
+ hasValidKey(config) && (checkKeyStringCoercion(config.key), children = "" + config.key);
244
+ if ("key" in config) {
245
+ maybeKey = {};
246
+ for (var propName in config)
247
+ "key" !== propName && (maybeKey[propName] = config[propName]);
248
+ } else maybeKey = config;
249
+ children && defineKeyPropWarningGetter(
250
+ maybeKey,
251
+ "function" === typeof type ? type.displayName || type.name || "Unknown" : type
252
+ );
253
+ return ReactElement(
254
+ type,
255
+ children,
256
+ self,
257
+ source,
258
+ getOwner(),
259
+ maybeKey,
260
+ debugStack,
261
+ debugTask
236
262
  );
237
263
  }
238
- function j(e) {
239
- typeof e == "object" && e !== null && e.$$typeof === S && e._store && (e._store.validated = 1);
264
+ function validateChildKeys(node) {
265
+ "object" === typeof node && null !== node && node.$$typeof === REACT_ELEMENT_TYPE && node._store && (node._store.validated = 1);
240
266
  }
241
- var E = me, S = Symbol.for("react.transitional.element"), m = Symbol.for("react.portal"), A = Symbol.for("react.fragment"), re = Symbol.for("react.strict_mode"), te = Symbol.for("react.profiler"), ne = Symbol.for("react.consumer"), oe = Symbol.for("react.context"), ue = Symbol.for("react.forward_ref"), se = Symbol.for("react.suspense"), le = Symbol.for("react.suspense_list"), ae = Symbol.for("react.memo"), $ = Symbol.for("react.lazy"), ce = Symbol.for("react.activity"), ie = Symbol.for("react.client.reference"), y = E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, L = Object.prototype.hasOwnProperty, de = Array.isArray, P = console.createTask ? console.createTask : function() {
267
+ var React = require$$0, REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler");
268
+ var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
242
269
  return null;
243
270
  };
244
- E = {
245
- react_stack_bottom_frame: function(e) {
246
- return e();
271
+ React = {
272
+ react_stack_bottom_frame: function(callStackForError) {
273
+ return callStackForError();
247
274
  }
248
275
  };
249
- var W, G = {}, U = E.react_stack_bottom_frame.bind(
250
- E,
251
- l
252
- )(), B = P(s(l)), q = {};
253
- k.Fragment = A, k.jsx = function(e, u, a, h, R) {
254
- var p = 1e4 > y.recentlyCreatedOwnerStacks++;
255
- return O(
256
- e,
257
- u,
258
- a,
259
- !1,
260
- h,
261
- R,
262
- p ? Error("react-stack-top-frame") : U,
263
- p ? P(s(e)) : B
276
+ var specialPropKeyWarningShown;
277
+ var didWarnAboutElementRef = {};
278
+ var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(
279
+ React,
280
+ UnknownOwner
281
+ )();
282
+ var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
283
+ var didWarnAboutKeySpread = {};
284
+ reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
285
+ reactJsxRuntime_development.jsx = function(type, config, maybeKey, source, self) {
286
+ var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
287
+ return jsxDEVImpl(
288
+ type,
289
+ config,
290
+ maybeKey,
291
+ false,
292
+ source,
293
+ self,
294
+ trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
295
+ trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
264
296
  );
265
- }, k.jsxs = function(e, u, a, h, R) {
266
- var p = 1e4 > y.recentlyCreatedOwnerStacks++;
267
- return O(
268
- e,
269
- u,
270
- a,
271
- !0,
272
- h,
273
- R,
274
- p ? Error("react-stack-top-frame") : U,
275
- p ? P(s(e)) : B
297
+ };
298
+ reactJsxRuntime_development.jsxs = function(type, config, maybeKey, source, self) {
299
+ var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
300
+ return jsxDEVImpl(
301
+ type,
302
+ config,
303
+ maybeKey,
304
+ true,
305
+ source,
306
+ self,
307
+ trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
308
+ trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
276
309
  );
277
310
  };
278
- }()), k;
311
+ }();
312
+ return reactJsxRuntime_development;
279
313
  }
280
- var H;
281
- function we() {
282
- return H || (H = 1, process.env.NODE_ENV === "production" ? w.exports = Oe() : w.exports = Se()), w.exports;
314
+ var hasRequiredJsxRuntime;
315
+ function requireJsxRuntime() {
316
+ if (hasRequiredJsxRuntime) return jsxRuntime.exports;
317
+ hasRequiredJsxRuntime = 1;
318
+ if (process.env.NODE_ENV === "production") {
319
+ jsxRuntime.exports = requireReactJsxRuntime_production();
320
+ } else {
321
+ jsxRuntime.exports = requireReactJsxRuntime_development();
322
+ }
323
+ return jsxRuntime.exports;
283
324
  }
284
- var d = we();
285
- const Q = Z(void 0), V = Z(void 0);
286
- function v(r, n) {
287
- const t = D(V), [s, o] = Y(f(() => n(r), [])), l = C(s);
288
- return M(() => {
289
- const c = n(r);
290
- Object.is(l.current, c) || (o(c), l.current = c);
291
- const g = be(
325
+ var jsxRuntimeExports = requireJsxRuntime();
326
+ const PI_VIEW_FIELD_TOKEN = createContext(void 0);
327
+ const InjectorToken = createContext(void 0);
328
+ const CVA = Symbol.for("ControlValueAccessor");
329
+ function useSignalToRef(listen, value) {
330
+ const injector = useContext(InjectorToken);
331
+ const [result, setResult] = useState(useMemo(() => value(listen), []));
332
+ const resultRef = useRef(result);
333
+ useEffect(() => {
334
+ const currentValue = value(listen);
335
+ if (!Object.is(resultRef.current, currentValue)) {
336
+ setResult(currentValue);
337
+ resultRef.current = currentValue;
338
+ }
339
+ const ref = effect(
292
340
  () => {
293
- const i = n(r);
294
- Object.is(l.current, i) || (o(i), l.current = i);
341
+ const currentValue2 = value(listen);
342
+ if (!Object.is(resultRef.current, currentValue2)) {
343
+ setResult(currentValue2);
344
+ resultRef.current = currentValue2;
345
+ }
295
346
  },
296
- { injector: t }
347
+ { injector }
297
348
  );
298
349
  return () => {
299
- g.destroy();
350
+ ref.destroy();
300
351
  };
301
- }, [r, f(() => n, [])]), s;
352
+ }, [listen, useMemo(() => value, [])]);
353
+ return result;
302
354
  }
303
- function K(r) {
304
- const n = f(
305
- () => r.wrappers.slice(1),
306
- [r.wrappers]
307
- ), t = r.wrappers[0], s = v(t, () => ({
308
- ...t?.inputs(),
309
- ...t?.attributes(),
310
- ...t?.outputs
355
+ function PiyingWrapper(props) {
356
+ const restWrappers = useMemo(
357
+ () => props.wrappers.slice(1),
358
+ [props.wrappers]
359
+ );
360
+ const wrapper = props.wrappers[0];
361
+ const inputs = useSignalToRef(wrapper, () => ({
362
+ ...wrapper?.inputs(),
363
+ ...wrapper?.attributes(),
364
+ ...wrapper?.outputs
311
365
  }));
312
- return /* @__PURE__ */ d.jsx(d.Fragment, { children: t ? /* @__PURE__ */ d.jsx(t.type, { ...s, children: /* @__PURE__ */ d.jsx(K, { wrappers: n, children: r.children }) }) : r.children });
366
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: wrapper ? /* @__PURE__ */ jsxRuntimeExports.jsx(wrapper.type, { ...inputs, children: /* @__PURE__ */ jsxRuntimeExports.jsx(PiyingWrapper, { wrappers: restWrappers, children: props.children }) }) : props.children });
313
367
  }
314
- const Ae = Symbol.for("ControlValueAccessor");
315
- function ee(r) {
316
- const n = v(r.field, (m) => m.inputs()), t = v(r.field, (m) => m.outputs()), s = v(r.field, (m) => m.attributes()), o = f(
317
- () => ({ ...s, ...n, ...t }),
318
- [s, n, t]
319
- ), l = v(
320
- r.field,
321
- (m) => m.renderConfig()
322
- ), c = v(
323
- r.field,
324
- (m) => m.children?.()
325
- ), g = v(r.field, (m) => m.wrappers()), i = r.field.form.control, _ = r.field.define?.type, O = f(() => !!l.hidden || !_, [l.hidden, _]), j = D(V), E = C(void 0), S = f(
326
- () => ({ ...o, [Ae]: E }),
327
- [o, E]
368
+ function PiyingFieldTemplate(props) {
369
+ const fieldInputs = useSignalToRef(props.field, (field) => ({
370
+ ...field.attributes(),
371
+ ...field.inputs(),
372
+ ...field.outputs()
373
+ }));
374
+ const renderConfig = useSignalToRef(
375
+ props.field,
376
+ (field) => field.renderConfig()
328
377
  );
329
- return M(() => {
330
- let m;
331
- return E.current && (m = Te(
332
- () => i,
333
- E.current,
334
- j
335
- )), () => {
336
- m?.(), m = void 0;
378
+ const wrappers = useSignalToRef(props.field, (field) => field.wrappers());
379
+ const control = props.field.form.control;
380
+ const ComponentType = props.field.define?.type;
381
+ const isHidden = useMemo(() => {
382
+ return !!renderConfig.hidden || !ComponentType;
383
+ }, [renderConfig.hidden, ComponentType]);
384
+ const injector = useContext(InjectorToken);
385
+ const controlRef = useRef(void 0);
386
+ const fieldControlInput = useMemo(
387
+ () => ({ ...fieldInputs, [CVA]: controlRef }),
388
+ [fieldInputs, controlRef]
389
+ );
390
+ useEffect(() => {
391
+ let dispose;
392
+ if (controlRef.current) {
393
+ dispose = createViewControlLink(
394
+ () => control,
395
+ controlRef.current,
396
+ injector
397
+ );
398
+ }
399
+ return () => {
400
+ dispose?.();
401
+ dispose = void 0;
337
402
  };
338
- }, [E.current, i, j]), /* @__PURE__ */ d.jsx(d.Fragment, { children: /* @__PURE__ */ d.jsx(Q, { value: r.field, children: O ? void 0 : /* @__PURE__ */ d.jsx(K, { wrappers: g, children: c ? /* @__PURE__ */ d.jsx(_, { ...o }) : r.field.form.control ? /* @__PURE__ */ d.jsx(_, { ...S }) : /* @__PURE__ */ d.jsx(_, { ...o }) }) }) });
403
+ }, [controlRef.current, control, injector]);
404
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(PI_VIEW_FIELD_TOKEN, { value: props.field, children: !isHidden ? /* @__PURE__ */ jsxRuntimeExports.jsx(PiyingWrapper, { wrappers, children: props.field.form.control ? /* @__PURE__ */ jsxRuntimeExports.jsx(ComponentType, { ...fieldControlInput }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ComponentType, { ...fieldInputs }) }) : void 0 }) });
339
405
  }
340
- function De() {
341
- const [r, n] = Y(void 0), [t, s] = Y(!1), o = C(void 0), l = C(void 0), c = f(() => ({
342
- writeValue(i) {
343
- n(i);
344
- },
345
- registerOnChange(i) {
346
- o.current = i;
347
- },
348
- registerOnTouched(i) {
349
- l.current = i;
350
- },
351
- setDisabledState(i) {
352
- s(i);
353
- }
354
- }), []), g = f(() => ({
355
- value: r,
356
- disabled: t,
357
- valueChange: (i) => {
358
- o.current?.(i), n(i);
359
- },
360
- touchedChange: () => {
361
- l.current?.();
362
- }
363
- }), [r, t]);
364
- return f(() => ({
365
- cva: c,
366
- cvaa: g
367
- }), [g]);
406
+ function useControlValueAccessor() {
407
+ const [value, setValue] = useState(void 0);
408
+ const [disabled, setDisabled] = useState(false);
409
+ const onChange = useRef(void 0);
410
+ const touched = useRef(void 0);
411
+ const cva = useMemo(() => {
412
+ return {
413
+ writeValue(obj) {
414
+ setValue(obj);
415
+ },
416
+ registerOnChange(fn) {
417
+ onChange.current = fn;
418
+ },
419
+ registerOnTouched(fn) {
420
+ touched.current = fn;
421
+ },
422
+ setDisabledState(value2) {
423
+ setDisabled(value2);
424
+ }
425
+ };
426
+ }, []);
427
+ const cvaa = useMemo(() => {
428
+ return {
429
+ value,
430
+ disabled,
431
+ valueChange: (value2) => {
432
+ onChange.current?.(value2);
433
+ setValue(value2);
434
+ },
435
+ touchedChange: () => {
436
+ touched.current?.();
437
+ }
438
+ };
439
+ }, [value, disabled]);
440
+ return useMemo(() => {
441
+ return {
442
+ cva,
443
+ cvaa
444
+ };
445
+ }, [cvaa]);
368
446
  }
369
- function X(r, n) {
370
- const t = he(r, n), s = C(void 0);
371
- f(() => (s.current = t(), s.current), n), M(() => () => {
372
- s.current?.(), s.current = void 0;
447
+ function useEffectSync(fn, deps) {
448
+ const cb = useCallback(fn, deps);
449
+ const dispose = useRef(void 0);
450
+ useMemo(() => {
451
+ dispose.current = cb();
452
+ return dispose.current;
453
+ }, deps);
454
+ useEffect(() => {
455
+ return () => {
456
+ dispose.current?.();
457
+ dispose.current = void 0;
458
+ };
373
459
  }, []);
374
460
  }
375
- function Me() {
376
- const r = D(Q), n = v(r, (t) => t?.children());
377
- return /* @__PURE__ */ d.jsx(d.Fragment, { children: n.map((t, s) => /* @__PURE__ */ d.jsx(ee, { field: t }, s)) });
461
+ function PiyingGroup() {
462
+ const field = useContext(PI_VIEW_FIELD_TOKEN);
463
+ const children = useSignalToRef(field, (field2) => field2?.children());
464
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: children.map((field2, index) => {
465
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(PiyingFieldTemplate, { field: field2 }, index);
466
+ }) });
378
467
  }
379
- class ye extends Ce {
380
- // contents?: any[];
468
+ class ReactSchemaHandle extends CoreSchemaHandle {
381
469
  }
382
- class Pe extends je {
470
+ class ReactFormBuilder extends FormBuilder {
383
471
  }
384
- function Ve(r) {
385
- const n = f(() => ge({
386
- providers: [
387
- {
388
- provide: pe,
389
- useClass: Ee
390
- }
391
- ]
392
- }), []), [t, s] = f(() => {
393
- const o = Re({ providers: [], parent: n });
394
- return [xe(r.schema, {
395
- handle: ye,
396
- builder: Pe,
397
- injector: o,
398
- registerOnDestroy: (c) => {
399
- o.get(ve).onDestroy(c);
472
+ function PiyingView(props) {
473
+ const rootInjector = useMemo(() => {
474
+ return createRootInjector({
475
+ providers: [
476
+ {
477
+ provide: ChangeDetectionScheduler,
478
+ useClass: ChangeDetectionSchedulerImpl
479
+ }
480
+ ]
481
+ });
482
+ }, []);
483
+ const [field, subInjector] = useMemo(() => {
484
+ const subInjector2 = createInjector({ providers: [], parent: rootInjector });
485
+ const field2 = convert(props.schema, {
486
+ handle: ReactSchemaHandle,
487
+ builder: ReactFormBuilder,
488
+ injector: subInjector2,
489
+ registerOnDestroy: (fn) => {
490
+ subInjector2.get(DestroyRef).onDestroy(fn);
400
491
  },
401
- ...r.options
402
- }), o];
403
- }, [r.schema, r.options]);
404
- return X(() => {
405
- let o;
406
- if (t.form.control) {
407
- const l = r.model;
408
- o = ke(
409
- typeof l < "u" ? l : void 0,
410
- t.form.control,
411
- s,
412
- (c) => {
413
- _e(() => {
414
- t.form.control?.valueNoError$$() && r.modelChange?.(c);
492
+ ...props.options
493
+ });
494
+ return [field2, subInjector2];
495
+ }, [props.schema, props.options]);
496
+ useEffectSync(() => {
497
+ let ref;
498
+ if (field.form.control) {
499
+ const model = props.model;
500
+ ref = initListen(
501
+ typeof model !== "undefined" ? model : void 0,
502
+ field.form.control,
503
+ subInjector,
504
+ (value) => {
505
+ untracked(() => {
506
+ if (field.form.control?.valueNoError$$()) {
507
+ props.modelChange?.(value);
508
+ }
415
509
  });
416
510
  }
417
511
  );
418
512
  }
419
513
  return () => {
420
- s.destroy(), o?.destroy();
514
+ subInjector.destroy();
515
+ ref?.destroy();
421
516
  };
422
- }, [t]), X(() => {
423
- t.form.control?.updateValue(r.model);
424
- }, [t, r.model]), /* @__PURE__ */ d.jsx(d.Fragment, { children: /* @__PURE__ */ d.jsx(V, { value: n, children: /* @__PURE__ */ d.jsx(ee, { field: t }) }) });
517
+ }, [field]);
518
+ useEffectSync(() => {
519
+ field.form.control?.updateValue(props.model);
520
+ }, [field, props.model]);
521
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(InjectorToken, { value: rootInjector, children: /* @__PURE__ */ jsxRuntimeExports.jsx(PiyingFieldTemplate, { field }) }) });
425
522
  }
426
- const $e = [], Le = {
427
- directives: "merge",
428
- formConfig: "merge",
429
- inputs: "merge",
430
- outputs: "merge",
431
- props: "merge",
432
- renderConfig: "merge",
433
- wrappers: "replace"
434
- };
435
- function We(r, n) {
436
- const t = C(!1);
437
- return f(() => {
438
- const s = {
439
- value: r.value == null ? "" : r.value,
440
- disabled: r.disabled,
441
- onBlur: r.touchedChange
442
- };
443
- return n ? {
444
- ...s,
445
- onCompositionStart: () => {
446
- t.current = !0;
447
- },
448
- onCompositionEnd: (o) => {
449
- t.current = !1, r.valueChange(o.target.value);
523
+ function useInputTextModel(cvaa, compositionMode) {
524
+ const composing = useRef(false);
525
+ return useMemo(() => {
526
+ const obj = {
527
+ value: cvaa.value == null ? "" : cvaa.value,
528
+ disabled: cvaa.disabled,
529
+ onBlur: cvaa.touchedChange,
530
+ onInput: (event) => {
531
+ if (!compositionMode || compositionMode && !composing.current) {
532
+ cvaa.valueChange(event.target.value);
533
+ }
450
534
  }
451
- } : {
452
- ...s,
453
- onInput: (o) => r.valueChange(o.target.value)
454
535
  };
455
- }, [r, n]);
536
+ if (compositionMode) {
537
+ return {
538
+ ...obj,
539
+ onCompositionStart: () => {
540
+ composing.current = true;
541
+ },
542
+ onCompositionEnd: (event) => {
543
+ composing.current = false;
544
+ cvaa.valueChange(event.target.value);
545
+ }
546
+ };
547
+ }
548
+ return obj;
549
+ }, [cvaa, compositionMode, composing]);
456
550
  }
457
- function Ge(r) {
458
- return f(() => ({
459
- checked: r.value ?? !1,
460
- disabled: r.disabled,
461
- onBlur: r.touchedChange,
462
- onChange: (n) => r.valueChange(n.target.checked)
463
- }), [r]);
551
+ function useInputCheckboxModel(cvaa) {
552
+ return useMemo(() => {
553
+ return {
554
+ checked: cvaa.value ?? false,
555
+ disabled: cvaa.disabled,
556
+ onBlur: cvaa.touchedChange,
557
+ onChange: (event) => cvaa.valueChange(event.target.checked)
558
+ };
559
+ }, [cvaa]);
464
560
  }
465
- function Ue(r) {
466
- return f(() => ({
467
- value: r.value == null ? "" : r.value,
468
- disabled: r.disabled,
469
- onBlur: r.touchedChange,
470
- onInput: (n) => {
471
- const t = n.target.value;
472
- r.valueChange(t == "" ? void 0 : parseFloat(t));
473
- }
474
- }), [r]);
561
+ function useInputNumberModel(cvaa) {
562
+ return useMemo(() => {
563
+ return {
564
+ value: cvaa.value == null ? "" : cvaa.value,
565
+ disabled: cvaa.disabled,
566
+ onBlur: cvaa.touchedChange,
567
+ onInput: (event) => {
568
+ const value = event.target.value;
569
+ cvaa.valueChange(value == "" ? void 0 : parseFloat(value));
570
+ }
571
+ };
572
+ }, [cvaa]);
475
573
  }
476
- function Be(r, n) {
477
- return f(() => ({
478
- value: n,
479
- checked: Object.is(r.value, n),
480
- disabled: r.disabled,
481
- onBlur: r.touchedChange,
482
- onChange: () => r.valueChange(n)
483
- }), [r]);
574
+ function useInputRadioModel(cvaa, value) {
575
+ return useMemo(() => {
576
+ return {
577
+ value,
578
+ checked: Object.is(cvaa.value, value),
579
+ disabled: cvaa.disabled,
580
+ onBlur: cvaa.touchedChange,
581
+ onChange: () => cvaa.valueChange(value)
582
+ };
583
+ }, [cvaa]);
484
584
  }
485
- function qe(r) {
486
- return f(() => {
487
- const n = (t) => {
488
- const s = t.target.value;
489
- r.valueChange(s == "" ? void 0 : parseFloat(s));
585
+ function useInputRangeModel(cvaa) {
586
+ return useMemo(() => {
587
+ const onInput = (event) => {
588
+ const value = event.target.value;
589
+ cvaa.valueChange(value == "" ? void 0 : parseFloat(value));
490
590
  };
491
591
  return {
492
- value: r.value == null ? "" : r.value,
493
- disabled: r.disabled,
494
- onBlur: r.touchedChange,
495
- onInput: n,
496
- onChange: n
592
+ value: cvaa.value == null ? "" : cvaa.value,
593
+ disabled: cvaa.disabled,
594
+ onBlur: cvaa.touchedChange,
595
+ onInput,
596
+ onChange: onInput
497
597
  };
498
- }, [r]);
598
+ }, [cvaa]);
499
599
  }
500
- function Je(r, n = !1) {
501
- return f(() => ({
502
- value: r.value,
503
- disabled: r.disabled,
504
- onBlur: r.touchedChange,
505
- onChange: (t) => {
506
- const s = [], o = t.target;
507
- if (o.selectedOptions !== void 0)
508
- for (let l = 0; l < o.selectedOptions.length; l++) {
509
- const c = o.selectedOptions[l];
510
- if (s.push(c.value), !n)
511
- break;
512
- }
513
- else
514
- for (let l = 0; l < o.options.length; l++) {
515
- const c = o.options[l];
516
- if (c.selected && (s.push(c.value), !n))
517
- break;
600
+ function useSelectModel(cvaa, multiple = false) {
601
+ return useMemo(() => {
602
+ return {
603
+ value: cvaa.value,
604
+ disabled: cvaa.disabled,
605
+ onBlur: cvaa.touchedChange,
606
+ onChange: (event) => {
607
+ const selected = [];
608
+ const el = event.target;
609
+ if (el.selectedOptions !== void 0) {
610
+ for (let index = 0; index < el.selectedOptions.length; index++) {
611
+ const item = el.selectedOptions[index];
612
+ selected.push(item.value);
613
+ if (!multiple) {
614
+ break;
615
+ }
616
+ }
617
+ } else {
618
+ for (let index = 0; index < el.options.length; index++) {
619
+ const option = el.options[index];
620
+ if (option.selected) {
621
+ selected.push(option.value);
622
+ if (!multiple) {
623
+ break;
624
+ }
625
+ }
626
+ }
518
627
  }
519
- r.valueChange(n ? s : s[0]);
520
- }
521
- }), [r]);
628
+ cvaa.valueChange(multiple ? selected : selected[0]);
629
+ }
630
+ };
631
+ }, [cvaa]);
522
632
  }
523
633
  export {
524
- Ae as CVA,
525
- $e as EMPTY_ARRAY,
526
- V as InjectorToken,
527
- Le as NG_CONFIG_DEFAULT_MERGE_STRAGEGY,
528
- Q as PI_VIEW_FIELD_TOKEN,
529
- ee as PiyingFieldTemplate,
530
- Me as PiyingGroup,
531
- Ve as PiyingView,
532
- K as PiyingWrapper,
533
- Pe as ReactFormBuilder,
534
- ye as ReactSchemaHandle,
535
- De as useControlValueAccessor,
536
- X as useEffectSync,
537
- Ge as useInputCheckboxModel,
538
- Ue as useInputNumberModel,
539
- Be as useInputRadioModel,
540
- qe as useInputRangeModel,
541
- We as useInputTextModel,
542
- Je as useSelectModel,
543
- v as useSignalToRef
634
+ CVA,
635
+ InjectorToken,
636
+ PI_VIEW_FIELD_TOKEN,
637
+ PiyingFieldTemplate,
638
+ PiyingGroup,
639
+ PiyingView,
640
+ PiyingWrapper,
641
+ ReactFormBuilder,
642
+ ReactSchemaHandle,
643
+ useControlValueAccessor,
644
+ useEffectSync,
645
+ useInputCheckboxModel,
646
+ useInputNumberModel,
647
+ useInputRadioModel,
648
+ useInputRangeModel,
649
+ useInputTextModel,
650
+ useSelectModel,
651
+ useSignalToRef
544
652
  };
653
+ //# sourceMappingURL=index.js.map