@formvk/reactive-react 0.0.0-stage → 1.0.0
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 +12 -0
- package/README.md +53 -2
- package/dist/index.d.ts +51 -0
- package/dist/index.js +121 -0
- package/dist/index.js.map +1 -0
- package/package.json +41 -3
package/CHANGELOG.md
ADDED
package/README.md
CHANGED
|
@@ -1,3 +1,54 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @formvk/reactive-react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React bindings for `@formvk/reactive`. Wrap a component with `observer` and it re-renders whenever observable data read during render changes.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @formvk/reactive-react
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
`react` and `react-dom` (`>= 18`) are peer dependencies.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { observable } from '@formvk/reactive'
|
|
17
|
+
import { observer } from '@formvk/reactive-react'
|
|
18
|
+
|
|
19
|
+
const state = observable({ count: 0 })
|
|
20
|
+
|
|
21
|
+
export const Counter = observer(() => <button onClick={() => (state.count += 1)}>count: {state.count}</button>)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Render-prop form for local subscriptions:
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import { Observer } from '@formvk/reactive-react'
|
|
28
|
+
|
|
29
|
+
function Count() {
|
|
30
|
+
return <Observer>{() => <span>{state.count}</span>}</Observer>
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`observer` accepts `{ forwardRef, displayName, scheduler }` options:
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
const Input = observer(MyInput, { forwardRef: true, displayName: 'Input' })
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## API
|
|
41
|
+
|
|
42
|
+
- `observer(Component, options?)` — memoized wrapper that tracks observable reads and re-renders.
|
|
43
|
+
- `Observer` — component with a render-prop `children`.
|
|
44
|
+
- `useObserver(view, options?)` — run a render function inside the observer tracker.
|
|
45
|
+
- `useForceUpdate()` — force a re-render.
|
|
46
|
+
- Types — `IObserverOptions`, `IObserverProps`, `ReactFC`.
|
|
47
|
+
|
|
48
|
+
## Documentation
|
|
49
|
+
|
|
50
|
+
https://formvk.github.io/core/api/react
|
|
51
|
+
|
|
52
|
+
## License
|
|
53
|
+
|
|
54
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { default as default_2 } from 'react';
|
|
2
|
+
import { Tracker } from '@formvk/reactive';
|
|
3
|
+
|
|
4
|
+
/* Excluded from this release type: createAdministration */
|
|
5
|
+
|
|
6
|
+
/* Excluded from this release type: createTracker */
|
|
7
|
+
|
|
8
|
+
export declare interface IObserverOptions {
|
|
9
|
+
/** 是否向被包裹组件透传 ref */
|
|
10
|
+
forwardRef?: boolean;
|
|
11
|
+
/** 自定义更新调度,收到响应式变更时默认直接触发 React 更新 */
|
|
12
|
+
scheduler?: (updater: () => void) => void;
|
|
13
|
+
/** 包裹后组件的 displayName */
|
|
14
|
+
displayName?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export declare interface IObserverProps {
|
|
18
|
+
children?: (() => default_2.ReactElement) | default_2.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export declare type Modify<T, R> = Omit<T, keyof R> & R;
|
|
22
|
+
|
|
23
|
+
export declare const Observer: ObserverComponent<IObserverProps, IObserverOptions>;
|
|
24
|
+
|
|
25
|
+
export declare function observer<P, Options extends IObserverOptions = IObserverOptions>(component: ReactFC<P>, options?: Options): ObserverComponent<P, Options>;
|
|
26
|
+
|
|
27
|
+
/* Excluded from this release type: ObserverAdministration */
|
|
28
|
+
|
|
29
|
+
/** observer 包裹后的组件类型:按 forwardRef 选项决定是否携带 ref */
|
|
30
|
+
declare type ObserverComponent<P, Options extends IObserverOptions> = default_2.MemoExoticComponent<ReactFC<Options extends {
|
|
31
|
+
forwardRef: true;
|
|
32
|
+
} ? P & {
|
|
33
|
+
ref?: 'ref' extends keyof P ? P['ref'] : default_2.RefAttributes<unknown>;
|
|
34
|
+
} : default_2.PropsWithoutRef<P>>>;
|
|
35
|
+
|
|
36
|
+
export declare type ReactFC<P = {}> = default_2.FC<ReactPropsWithChildren<P>>;
|
|
37
|
+
|
|
38
|
+
export declare type ReactPropsWithChildren<P> = Modify<{
|
|
39
|
+
children?: default_2.ReactNode | undefined;
|
|
40
|
+
}, P>;
|
|
41
|
+
|
|
42
|
+
/** 返回一个稳定的强制刷新函数,React 18+ 自动批处理会合并同一轮多次调用 */
|
|
43
|
+
export declare function useForceUpdate(): () => void;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 在渲染期执行 view 并追踪其中读取的响应式数据,
|
|
47
|
+
* 依赖变化时自动调度组件重渲染;每次渲染都会重新 track 以拿到最新 props 与依赖。
|
|
48
|
+
*/
|
|
49
|
+
export declare function useObserver<T>(view: () => T, options?: IObserverOptions): T;
|
|
50
|
+
|
|
51
|
+
export { }
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import hoistNonReactStatics from "hoist-non-react-statics";
|
|
2
|
+
import { Fragment, createElement, forwardRef, memo, useReducer, useRef, useSyncExternalStore } from "react";
|
|
3
|
+
import { Tracker } from "@formvk/reactive";
|
|
4
|
+
// src/hooks/trackerRegistry.ts
|
|
5
|
+
var FALLBACK_DELAY = 1e4;
|
|
6
|
+
/**
|
|
7
|
+
* 渲染期创建的 Tracker 在组件被放弃挂载(StrictMode/Concurrent 中断)时
|
|
8
|
+
* 等不到 effect 清理,需要垃圾回收兜底:原生 FinalizationRegistry 可用时用它,
|
|
9
|
+
* 否则退化为定时器,避免响应式订阅泄漏。
|
|
10
|
+
*/
|
|
11
|
+
var TrackerRegistry = class {
|
|
12
|
+
native;
|
|
13
|
+
timers = /* @__PURE__ */ new Map();
|
|
14
|
+
constructor() {
|
|
15
|
+
if (typeof FinalizationRegistry !== "undefined") this.native = new FinalizationRegistry((dispose) => dispose());
|
|
16
|
+
}
|
|
17
|
+
/** target 被 GC 时执行 dispose;token 用于后续 unregister */
|
|
18
|
+
register(target, dispose, token) {
|
|
19
|
+
this.unregister(token);
|
|
20
|
+
if (this.native) {
|
|
21
|
+
this.native.register(target, dispose, token);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
this.timers.set(token, setTimeout(() => {
|
|
25
|
+
this.timers.delete(token);
|
|
26
|
+
dispose();
|
|
27
|
+
}, FALLBACK_DELAY));
|
|
28
|
+
}
|
|
29
|
+
unregister(token) {
|
|
30
|
+
this.native?.unregister(token);
|
|
31
|
+
const timer = this.timers.get(token);
|
|
32
|
+
if (timer) {
|
|
33
|
+
clearTimeout(timer);
|
|
34
|
+
this.timers.delete(token);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var trackerRegistry = new TrackerRegistry();
|
|
39
|
+
// src/hooks/useObserver.ts
|
|
40
|
+
/** @internal 仅供单元测试验证订阅状态机,不通过包入口公开 */
|
|
41
|
+
function createTracker(adm, options) {
|
|
42
|
+
return new Tracker(() => {
|
|
43
|
+
adm.stateVersion = Symbol();
|
|
44
|
+
if (adm.onStoreChange) {
|
|
45
|
+
if (typeof options?.scheduler === "function") options.scheduler(adm.onStoreChange);
|
|
46
|
+
else adm.onStoreChange();
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/** @internal 仅供单元测试验证订阅状态机,不通过包入口公开 */
|
|
51
|
+
function createAdministration(options) {
|
|
52
|
+
const adm = {
|
|
53
|
+
tracker: null,
|
|
54
|
+
onStoreChange: null,
|
|
55
|
+
stateVersion: Symbol(),
|
|
56
|
+
subscribe(onStoreChange) {
|
|
57
|
+
trackerRegistry.unregister(adm);
|
|
58
|
+
adm.onStoreChange = onStoreChange;
|
|
59
|
+
if (!adm.tracker) {
|
|
60
|
+
adm.tracker = createTracker(adm, options);
|
|
61
|
+
adm.stateVersion = Symbol();
|
|
62
|
+
}
|
|
63
|
+
return () => {
|
|
64
|
+
adm.onStoreChange = null;
|
|
65
|
+
adm.tracker?.dispose();
|
|
66
|
+
adm.tracker = null;
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
getSnapshot() {
|
|
70
|
+
return adm.stateVersion;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
return adm;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* 在渲染期执行 view 并追踪其中读取的响应式数据,
|
|
77
|
+
* 依赖变化时自动调度组件重渲染;每次渲染都会重新 track 以拿到最新 props 与依赖。
|
|
78
|
+
*/
|
|
79
|
+
function useObserver(view, options) {
|
|
80
|
+
const admRef = useRef(null);
|
|
81
|
+
if (!admRef.current) admRef.current = createAdministration(options);
|
|
82
|
+
const adm = admRef.current;
|
|
83
|
+
if (!adm.tracker) {
|
|
84
|
+
adm.tracker = createTracker(adm, options);
|
|
85
|
+
trackerRegistry.register(admRef, () => adm.tracker?.dispose(), adm);
|
|
86
|
+
}
|
|
87
|
+
useSyncExternalStore(adm.subscribe, adm.getSnapshot, adm.getSnapshot);
|
|
88
|
+
return adm.tracker.track(view);
|
|
89
|
+
}
|
|
90
|
+
// src/observer.tsx
|
|
91
|
+
function observer(component, options) {
|
|
92
|
+
const realOptions = {
|
|
93
|
+
forwardRef: false,
|
|
94
|
+
...options
|
|
95
|
+
};
|
|
96
|
+
const wrappedComponent = realOptions.forwardRef ? forwardRef(((props, ref) => {
|
|
97
|
+
return useObserver(() => component({
|
|
98
|
+
...props,
|
|
99
|
+
ref
|
|
100
|
+
}), realOptions);
|
|
101
|
+
})) : (props) => {
|
|
102
|
+
return useObserver(() => component(props), realOptions);
|
|
103
|
+
};
|
|
104
|
+
const memoComponent = memo(wrappedComponent);
|
|
105
|
+
hoistNonReactStatics(memoComponent, component);
|
|
106
|
+
if (realOptions.displayName) memoComponent.displayName = realOptions.displayName;
|
|
107
|
+
return memoComponent;
|
|
108
|
+
}
|
|
109
|
+
var Observer = observer((props) => {
|
|
110
|
+
const children = typeof props.children === "function" ? props.children() : props.children;
|
|
111
|
+
return createElement(Fragment, null, children);
|
|
112
|
+
});
|
|
113
|
+
// src/hooks/useForceUpdate.ts
|
|
114
|
+
/** 返回一个稳定的强制刷新函数,React 18+ 自动批处理会合并同一轮多次调用 */
|
|
115
|
+
function useForceUpdate() {
|
|
116
|
+
const [, forceUpdate] = useReducer((tick) => tick + 1, 0);
|
|
117
|
+
return forceUpdate;
|
|
118
|
+
}
|
|
119
|
+
export { Observer, createAdministration, createTracker, observer, useForceUpdate, useObserver };
|
|
120
|
+
|
|
121
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/hooks/trackerRegistry.ts","../src/hooks/useObserver.ts","../src/observer.tsx","../src/hooks/useForceUpdate.ts"],"sourcesContent":["import type { Dispose } from '@formvk/reactive'\n\nconst FALLBACK_DELAY = 10000\n\n/**\n * 渲染期创建的 Tracker 在组件被放弃挂载(StrictMode/Concurrent 中断)时\n * 等不到 effect 清理,需要垃圾回收兜底:原生 FinalizationRegistry 可用时用它,\n * 否则退化为定时器,避免响应式订阅泄漏。\n */\nclass TrackerRegistry {\n private native: FinalizationRegistry<Dispose> | undefined\n private timers = new Map<object, ReturnType<typeof setTimeout>>()\n\n constructor() {\n if (typeof FinalizationRegistry !== 'undefined') {\n this.native = new FinalizationRegistry<Dispose>(dispose => dispose())\n }\n }\n\n /** target 被 GC 时执行 dispose;token 用于后续 unregister */\n register(target: object, dispose: Dispose, token: object): void {\n this.unregister(token)\n if (this.native) {\n this.native.register(target, dispose, token)\n return\n }\n this.timers.set(\n token,\n setTimeout(() => {\n this.timers.delete(token)\n dispose()\n }, FALLBACK_DELAY)\n )\n }\n\n unregister(token: object): void {\n this.native?.unregister(token)\n const timer = this.timers.get(token)\n if (timer) {\n clearTimeout(timer)\n this.timers.delete(token)\n }\n }\n}\n\nexport const trackerRegistry = new TrackerRegistry()\n","import { Tracker } from '@formvk/reactive'\nimport { useRef, useSyncExternalStore } from 'react'\n\nimport type { IObserverOptions } from '../types'\nimport { trackerRegistry } from './trackerRegistry'\n\n/** @internal 仅供单元测试验证订阅状态机,不通过包入口公开 */\nexport interface ObserverAdministration {\n tracker: Tracker | null\n onStoreChange: (() => void) | null\n /** 快照值:每次响应式变更都换成新 Symbol,驱动 useSyncExternalStore 重渲染 */\n stateVersion: symbol\n subscribe: (onStoreChange: () => void) => () => void\n getSnapshot: () => symbol\n}\n\n/** @internal 仅供单元测试验证订阅状态机,不通过包入口公开 */\nexport function createTracker(adm: ObserverAdministration, options?: IObserverOptions): Tracker {\n return new Tracker(() => {\n adm.stateVersion = Symbol()\n // 首次渲染到挂载之间 onStoreChange 还不存在,useSyncExternalStore 会靠快照版本补刷新\n if (adm.onStoreChange) {\n if (typeof options?.scheduler === 'function') {\n options.scheduler(adm.onStoreChange)\n } else {\n adm.onStoreChange()\n }\n }\n })\n}\n\n/** @internal 仅供单元测试验证订阅状态机,不通过包入口公开 */\nexport function createAdministration(options?: IObserverOptions): ObserverAdministration {\n const adm: ObserverAdministration = {\n tracker: null,\n onStoreChange: null,\n stateVersion: Symbol(),\n subscribe(onStoreChange) {\n // 正常挂载后取消 GC 兜底,改由 effect 清理负责\n trackerRegistry.unregister(adm)\n adm.onStoreChange = onStoreChange\n if (!adm.tracker) {\n // StrictMode 重挂载(中间不会重新渲染)或追踪器已被回收时,重建并刷新快照\n adm.tracker = createTracker(adm, options)\n adm.stateVersion = Symbol()\n }\n return () => {\n adm.onStoreChange = null\n adm.tracker?.dispose()\n adm.tracker = null\n }\n },\n getSnapshot() {\n return adm.stateVersion\n },\n }\n return adm\n}\n\n/**\n * 在渲染期执行 view 并追踪其中读取的响应式数据,\n * 依赖变化时自动调度组件重渲染;每次渲染都会重新 track 以拿到最新 props 与依赖。\n */\nexport function useObserver<T>(view: () => T, options?: IObserverOptions): T {\n const admRef = useRef<ObserverAdministration | null>(null)\n if (!admRef.current) {\n admRef.current = createAdministration(options)\n }\n const adm = admRef.current\n if (!adm.tracker) {\n adm.tracker = createTracker(adm, options)\n // 渲染可能被 StrictMode/Concurrent 放弃而永不挂载,注册 GC 兜底回收\n trackerRegistry.register(admRef, () => adm.tracker?.dispose(), adm)\n }\n useSyncExternalStore(adm.subscribe, adm.getSnapshot, adm.getSnapshot)\n return adm.tracker.track(view)\n}\n","import hoistNonReactStatics from 'hoist-non-react-statics'\nimport { createElement, forwardRef, memo, Fragment } from 'react'\nimport type React from 'react'\n\nimport { useObserver } from './hooks/useObserver'\nimport type { IObserverOptions, IObserverProps, ReactFC } from './types'\n\n/** observer 包裹后的组件类型:按 forwardRef 选项决定是否携带 ref */\ntype ObserverComponent<P, Options extends IObserverOptions> = React.MemoExoticComponent<\n ReactFC<\n Options extends { forwardRef: true }\n ? P & {\n ref?: 'ref' extends keyof P ? P['ref'] : React.RefAttributes<unknown>\n }\n : React.PropsWithoutRef<P>\n >\n>\n\nexport function observer<P, Options extends IObserverOptions = IObserverOptions>(\n component: ReactFC<P>,\n options?: Options\n): ObserverComponent<P, Options> {\n const realOptions: IObserverOptions = {\n forwardRef: false,\n ...options,\n }\n\n const wrappedComponent = realOptions.forwardRef\n ? forwardRef(\n // React 19 的 FC 返回类型含 Promise<ReactNode>,forwardRef 渲染函数不接受,此处为同步 observer 场景收窄\n ((props: any, ref: any) => {\n return useObserver(() => component({ ...props, ref }), realOptions)\n }) as React.ForwardRefRenderFunction<any, any>\n )\n : (props: any) => {\n return useObserver(() => component(props), realOptions)\n }\n\n const memoComponent = memo(wrappedComponent)\n\n hoistNonReactStatics(memoComponent, component)\n\n if (realOptions.displayName) {\n memoComponent.displayName = realOptions.displayName\n }\n\n // wrappedComponent 是 forwardRef/普通函数两种形态的联合,按 options 条件类型收窄到声明签名\n return memoComponent as ObserverComponent<P, Options>\n}\n\nexport const Observer = observer((props: IObserverProps) => {\n const children = typeof props.children === 'function' ? props.children() : props.children\n return createElement(Fragment, null, children)\n})\n","import { useReducer } from 'react'\n\n/** 返回一个稳定的强制刷新函数,React 18+ 自动批处理会合并同一轮多次调用 */\nexport function useForceUpdate(): () => void {\n const [, forceUpdate] = useReducer((tick: number) => tick + 1, 0)\n return forceUpdate\n}\n"],"mappings":";;;;AAEA,IAAM,iBAAiB;;;;;;AAOvB,IAAM,kBAAN,MAAsB;CACpB;CACA,yBAAiB,IAAI,IAA2C;CAEhE,cAAc;EACZ,IAAI,OAAO,yBAAyB,aAClC,KAAK,SAAS,IAAI,sBAA8B,YAAW,QAAQ,CAAC;CAExE;;CAGA,SAAS,QAAgB,SAAkB,OAAqB;EAC9D,KAAK,WAAW,KAAK;EACrB,IAAI,KAAK,QAAQ;GACf,KAAK,OAAO,SAAS,QAAQ,SAAS,KAAK;GAC3C;EACF;EACA,KAAK,OAAO,IACV,OACA,iBAAiB;GACf,KAAK,OAAO,OAAO,KAAK;GACxB,QAAQ;EACV,GAAG,cAAc,CACnB;CACF;CAEA,WAAW,OAAqB;EAC9B,KAAK,QAAQ,WAAW,KAAK;EAC7B,MAAM,QAAQ,KAAK,OAAO,IAAI,KAAK;EACnC,IAAI,OAAO;GACT,aAAa,KAAK;GAClB,KAAK,OAAO,OAAO,KAAK;EAC1B;CACF;AACF;AAEA,IAAa,kBAAkB,IAAI,gBAAgB;;;AC5BnD,SAAgB,cAAc,KAA6B,SAAqC;CAC9F,OAAO,IAAI,cAAc;EACvB,IAAI,eAAe,OAAO;EAE1B,IAAI,IAAI,eAAe;GACrB,IAAI,OAAO,SAAS,cAAc,YAChC,QAAQ,UAAU,IAAI,aAAa;QAEnC,IAAI,cAAc;EAEtB;CACF,CAAC;AACH;;AAGA,SAAgB,qBAAqB,SAAoD;CACvF,MAAM,MAA8B;EAClC,SAAS;EACT,eAAe;EACf,cAAc,OAAO;EACrB,UAAU,eAAe;GAEvB,gBAAgB,WAAW,GAAG;GAC9B,IAAI,gBAAgB;GACpB,IAAI,CAAC,IAAI,SAAS;IAEhB,IAAI,UAAU,cAAc,KAAK,OAAO;IACxC,IAAI,eAAe,OAAO;GAC5B;GACA,aAAa;IACX,IAAI,gBAAgB;IACpB,IAAI,SAAS,QAAQ;IACrB,IAAI,UAAU;GAChB;EACF;EACA,cAAc;GACZ,OAAO,IAAI;EACb;CACF;CACA,OAAO;AACT;;;;;AAMA,SAAgB,YAAe,MAAe,SAA+B;CAC3E,MAAM,SAAS,OAAsC,IAAI;CACzD,IAAI,CAAC,OAAO,SACV,OAAO,UAAU,qBAAqB,OAAO;CAE/C,MAAM,MAAM,OAAO;CACnB,IAAI,CAAC,IAAI,SAAS;EAChB,IAAI,UAAU,cAAc,KAAK,OAAO;EAExC,gBAAgB,SAAS,cAAc,IAAI,SAAS,QAAQ,GAAG,GAAG;CACpE;CACA,qBAAqB,IAAI,WAAW,IAAI,aAAa,IAAI,WAAW;CACpE,OAAO,IAAI,QAAQ,MAAM,IAAI;AAC/B;;AC1DA,SAAgB,SACd,WACA,SAC+B;CAC/B,MAAM,cAAgC;EACpC,YAAY;EACZ,GAAG;CACL;CAEA,MAAM,mBAAmB,YAAY,aACjC,aAEI,OAAY,QAAa;EACzB,OAAO,kBAAkB,UAAU;GAAE,GAAG;GAAO;EAAI,CAAC,GAAG,WAAW;CACpE,EACF,KACC,UAAe;EACd,OAAO,kBAAkB,UAAU,KAAK,GAAG,WAAW;CACxD;CAEJ,MAAM,gBAAgB,KAAK,gBAAgB;CAE3C,qBAAqB,eAAe,SAAS;CAE7C,IAAI,YAAY,aACd,cAAc,cAAc,YAAY;CAI1C,OAAO;AACT;AAEA,IAAa,WAAW,UAAU,UAA0B;CAC1D,MAAM,WAAW,OAAO,MAAM,aAAa,aAAa,MAAM,SAAS,IAAI,MAAM;CACjF,OAAO,cAAc,UAAU,MAAM,QAAQ;AAC/C,CAAC;;;AClDD,SAAgB,iBAA6B;CAC3C,MAAM,GAAG,eAAe,YAAY,SAAiB,OAAO,GAAG,CAAC;CAChE,OAAO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formvk/reactive-react",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Formvk Reactive React Bindings",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"form",
|
|
7
|
+
"formvk",
|
|
8
|
+
"formvk-reactive-react",
|
|
9
|
+
"observer",
|
|
10
|
+
"react"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"author": "yiyunwan",
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"CHANGELOG.md"
|
|
17
|
+
],
|
|
18
|
+
"type": "module",
|
|
19
|
+
"main": "dist/index.js",
|
|
20
|
+
"module": "dist/index.js",
|
|
21
|
+
"types": "dist/index.d.ts",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@formvk/reactive": "~1.0.0",
|
|
24
|
+
"hoist-non-react-statics": "^3.3.2"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@testing-library/react": "^16.3.3",
|
|
28
|
+
"@types/hoist-non-react-statics": "^3.3.7",
|
|
29
|
+
"@types/react": "^19.3.0",
|
|
30
|
+
"@types/react-dom": "^19.3.0",
|
|
31
|
+
"@vitejs/plugin-react": "^6.3.0",
|
|
32
|
+
"happy-dom": "^21.0.4",
|
|
33
|
+
"react": "^19.3.1",
|
|
34
|
+
"react-dom": "^19.3.1"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"react": ">=18",
|
|
38
|
+
"react-dom": ">=18"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsc --noEmit && vite build",
|
|
42
|
+
"test": "vitest"
|
|
43
|
+
}
|
|
6
44
|
}
|