@texaryn/react 0.5.1 → 0.5.3
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/CHANGELOG.md +28 -0
- package/dist/hooks/use-form.d.ts.map +1 -1
- package/dist/hooks/use-form.js +11 -1
- package/dist/hooks/use-form.js.map +1 -1
- package/dist/widgets/ObjectLayout.d.ts.map +1 -1
- package/dist/widgets/ObjectLayout.js +2 -1
- package/dist/widgets/ObjectLayout.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @texaryn/react
|
|
2
2
|
|
|
3
|
+
## 0.5.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- eae5f41: Object children are keyed by property name, with `objectChildKey` from
|
|
8
|
+
`@texaryn/core`, so a field keeps its element and its focus when the form grows
|
|
9
|
+
ahead of it, for example when typing into a recursive object exposes the next
|
|
10
|
+
level.
|
|
11
|
+
- Updated dependencies [eae5f41]
|
|
12
|
+
- @texaryn/core@0.13.0
|
|
13
|
+
|
|
14
|
+
## 0.5.2
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 5f510b7: `useForm` works inside `<StrictMode>`, which Vite's React template and the
|
|
19
|
+
Next.js App Router turn on by default. In development StrictMode runs every
|
|
20
|
+
effect's cleanup and setup a second time, and that cleanup destroyed the
|
|
21
|
+
runtime, so the form ignored typing and Submit did nothing.
|
|
22
|
+
|
|
23
|
+
The destroy now waits one task after the cleanup and the repeated setup cancels
|
|
24
|
+
it, so the form keeps its mounted runtime and that runtime's state. A real
|
|
25
|
+
unmount still destroys the runtime, one task later: a test that expects
|
|
26
|
+
`runtime.destroy()` to have run right after `unmount()` has to wait for the
|
|
27
|
+
next task. Work in flight at unmount, for example a submit dispatched just
|
|
28
|
+
before the component unmounts, now completes if it settles within the next
|
|
29
|
+
task, instead of being dropped.
|
|
30
|
+
|
|
3
31
|
## 0.5.1
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["../../src/hooks/use-form.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACX,kBAAkB,EAClB,MAAM,EACN,SAAS,EACT,oBAAoB,EACpB,eAAe,EACf,UAAU,EACX,MAAM,eAAe,CAAA;AAGtB,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,WAAW,CAAA;IACpB,QAAQ,EAAE,UAAU,CAAA;IACpB,IAAI,EAAE,OAAO,CAAA;IACb,UAAU,EAAE,eAAe,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAA;IAChC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;CACpD;AAED,wBAAgB,OAAO,CACrB,IAAI,EAAE,oBAAoB,EAC1B,OAAO,CAAC,EAAE,kBAAkB,GAC3B,aAAa,
|
|
1
|
+
{"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["../../src/hooks/use-form.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACX,kBAAkB,EAClB,MAAM,EACN,SAAS,EACT,oBAAoB,EACpB,eAAe,EACf,UAAU,EACX,MAAM,eAAe,CAAA;AAGtB,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,WAAW,CAAA;IACpB,QAAQ,EAAE,UAAU,CAAA;IACpB,IAAI,EAAE,OAAO,CAAA;IACb,UAAU,EAAE,eAAe,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAA;IAChC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;CACpD;AAED,wBAAgB,OAAO,CACrB,IAAI,EAAE,oBAAoB,EAC1B,OAAO,CAAC,EAAE,kBAAkB,GAC3B,aAAa,CAsCf"}
|
package/dist/hooks/use-form.js
CHANGED
|
@@ -7,9 +7,19 @@ export function useForm(port, options) {
|
|
|
7
7
|
runtimeRef.current = createFormRuntime(port, options);
|
|
8
8
|
}
|
|
9
9
|
const runtime = runtimeRef.current;
|
|
10
|
+
const pendingDestroy = useRef(null);
|
|
11
|
+
// StrictMode reruns cleanup then setup synchronously in one commit, so that
|
|
12
|
+
// setup cancels the deferred destroy. After a real unmount the destroy runs.
|
|
10
13
|
useEffect(() => {
|
|
14
|
+
if (pendingDestroy.current !== null) {
|
|
15
|
+
clearTimeout(pendingDestroy.current);
|
|
16
|
+
pendingDestroy.current = null;
|
|
17
|
+
}
|
|
11
18
|
return () => {
|
|
12
|
-
|
|
19
|
+
pendingDestroy.current = setTimeout(() => {
|
|
20
|
+
pendingDestroy.current = null;
|
|
21
|
+
runtime.destroy();
|
|
22
|
+
}, 0);
|
|
13
23
|
};
|
|
14
24
|
}, [runtime]);
|
|
15
25
|
const document = useStore(runtime.document);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-form.js","sourceRoot":"","sources":["../../src/hooks/use-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAWjD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAWzC,MAAM,UAAU,OAAO,CACrB,IAA0B,EAC1B,OAA4B;IAE5B,MAAM,UAAU,GAAG,MAAM,CAAqB,IAAI,CAAC,CAAA;IACnD,IAAI,UAAU,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;QAChC,UAAU,CAAC,OAAO,GAAG,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IACvD,CAAC;IACD,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAA;
|
|
1
|
+
{"version":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AQ,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;IAE/C,MAAM,QAAQ,GAAG,WAAW,CAC1B,CAAC,OAAgB,EAAE,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA,CAAC,CAAC,EACnD,CAAC,OAAO,CAAC,CACV,CAAA;IAED,MAAM,YAAY,GAAG,WAAW,CAC9B,CAAC,MAAc,EAAE,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,EAChD,CAAC,OAAO,CAAC,CACV,CAAA;IAED,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAA;AACxE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectLayout.d.ts","sourceRoot":"","sources":["../../src/widgets/ObjectLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"ObjectLayout.d.ts","sourceRoot":"","sources":["../../src/widgets/ObjectLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAK3C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;CACb;AAED,iBAAS,gBAAgB,CAAC,EAAE,IAAI,EAAE,EAAE,WAAW,qBAsB9C;AAED,eAAO,MAAM,YAAY,oDAGxB,CAAA"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { objectChildKey } from '@texaryn/core';
|
|
3
4
|
import { NodeRenderer } from '../components/NodeRenderer.js';
|
|
4
5
|
import { useRendererContext } from '../components/renderer-context.js';
|
|
5
6
|
import { useObjectGroup } from '../hooks/use-object-group.js';
|
|
6
7
|
function ObjectLayoutImpl({ node }) {
|
|
7
8
|
const { document, registry } = useRendererContext();
|
|
8
9
|
const { nested, title, children } = useObjectGroup(node);
|
|
9
|
-
const rendered = children.map((child) => (_jsx(NodeRenderer, { node: child, document: document, registry: registry }, child
|
|
10
|
+
const rendered = children.map((child) => (_jsx(NodeRenderer, { node: child, document: document, registry: registry }, objectChildKey(child))));
|
|
10
11
|
if (!nested) {
|
|
11
12
|
return _jsx("div", { children: rendered });
|
|
12
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectLayout.js","sourceRoot":"","sources":["../../src/widgets/ObjectLayout.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"ObjectLayout.js","sourceRoot":"","sources":["../../src/widgets/ObjectLayout.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAM7D,SAAS,gBAAgB,CAAC,EAAE,IAAI,EAAe;IAC7C,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,kBAAkB,EAAE,CAAA;IACnD,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAC,IAAI,CAAC,CAAA;IAExD,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CACvC,KAAC,YAAY,IAA6B,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,IAA1E,cAAc,CAAC,KAAK,CAAC,CAAyD,CAClG,CAAC,CAAA;IAEF,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,wBAAM,QAAQ,GAAO,CAAA;IAC9B,CAAC;IAED,6EAA6E;IAC7E,2EAA2E;IAC3E,6EAA6E;IAC7E,yBAAyB;IACzB,OAAO,CACL,oBAAU,IAAI,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,aACrD,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,2BAAS,KAAK,GAAU,EACtD,wBAAM,QAAQ,GAAO,IACZ,CACZ,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CACpC,gBAAgB,EAChB,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,CAC9C,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@texaryn/react",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "React bindings, hooks, prop getters, and default widgets for Texaryn",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"CHANGELOG.md"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@texaryn/core": "^0.
|
|
47
|
+
"@texaryn/core": "^0.13.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"react": ">=18.0.0"
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"jsdom": "^25.0.0",
|
|
57
57
|
"react": "^19.0.0",
|
|
58
58
|
"react-dom": "^19.0.0",
|
|
59
|
-
"@texaryn/schema-json": "0.
|
|
59
|
+
"@texaryn/schema-json": "0.7.0"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "tsc --build"
|