@vef-framework-react/core 2.1.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.
Files changed (120) hide show
  1. package/README +15 -0
  2. package/dist/cjs/_internal/_rolldown/runtime.cjs +1 -0
  3. package/dist/cjs/ai/index.cjs +1 -0
  4. package/dist/cjs/api/client.cjs +1 -0
  5. package/dist/cjs/api/constants.cjs +1 -0
  6. package/dist/cjs/api/helpers.cjs +1 -0
  7. package/dist/cjs/api/index.cjs +1 -0
  8. package/dist/cjs/auth/helpers.cjs +1 -0
  9. package/dist/cjs/auth/index.cjs +1 -0
  10. package/dist/cjs/context/api-client.cjs +1 -0
  11. package/dist/cjs/context/app.cjs +1 -0
  12. package/dist/cjs/context/context-selector.cjs +1 -0
  13. package/dist/cjs/context/disabled.cjs +1 -0
  14. package/dist/cjs/context/index.cjs +1 -0
  15. package/dist/cjs/dnd/index.cjs +1 -0
  16. package/dist/cjs/http/client.cjs +1 -0
  17. package/dist/cjs/http/constants.cjs +1 -0
  18. package/dist/cjs/http/errors.cjs +1 -0
  19. package/dist/cjs/http/helpers.cjs +1 -0
  20. package/dist/cjs/http/index.cjs +1 -0
  21. package/dist/cjs/immer/index.cjs +1 -0
  22. package/dist/cjs/index.cjs +1 -0
  23. package/dist/cjs/motion/features.cjs +1 -0
  24. package/dist/cjs/motion/index.cjs +1 -0
  25. package/dist/cjs/motion/motion-provider.cjs +1 -0
  26. package/dist/cjs/query/constants.cjs +1 -0
  27. package/dist/cjs/query/helpers.cjs +1 -0
  28. package/dist/cjs/query/hooks.cjs +1 -0
  29. package/dist/cjs/query/index.cjs +1 -0
  30. package/dist/cjs/sse/client.cjs +1 -0
  31. package/dist/cjs/sse/helpers.cjs +1 -0
  32. package/dist/cjs/sse/index.cjs +1 -0
  33. package/dist/cjs/state/index.cjs +1 -0
  34. package/dist/cjs/state-machine/index.cjs +1 -0
  35. package/dist/cjs/store/bound.cjs +1 -0
  36. package/dist/cjs/store/index.cjs +1 -0
  37. package/dist/cjs/store/unbound.cjs +1 -0
  38. package/dist/cjs/store/use-deep.cjs +1 -0
  39. package/dist/es/ai/index.js +3 -0
  40. package/dist/es/api/client.js +74 -0
  41. package/dist/es/api/constants.js +14 -0
  42. package/dist/es/api/helpers.js +8 -0
  43. package/dist/es/api/index.js +4 -0
  44. package/dist/es/auth/helpers.js +10 -0
  45. package/dist/es/auth/index.js +2 -0
  46. package/dist/es/context/api-client.js +23 -0
  47. package/dist/es/context/app.js +9 -0
  48. package/dist/es/context/context-selector.js +40 -0
  49. package/dist/es/context/disabled.js +10 -0
  50. package/dist/es/context/index.js +5 -0
  51. package/dist/es/dnd/index.js +8 -0
  52. package/dist/es/http/client.js +187 -0
  53. package/dist/es/http/constants.js +5 -0
  54. package/dist/es/http/errors.js +11 -0
  55. package/dist/es/http/helpers.js +9 -0
  56. package/dist/es/http/index.js +5 -0
  57. package/dist/es/immer/index.js +6 -0
  58. package/dist/es/index.js +27 -0
  59. package/dist/es/motion/features.js +3 -0
  60. package/dist/es/motion/index.js +5 -0
  61. package/dist/es/motion/motion-provider.js +24 -0
  62. package/dist/es/query/constants.js +5 -0
  63. package/dist/es/query/helpers.js +41 -0
  64. package/dist/es/query/hooks.js +26 -0
  65. package/dist/es/query/index.js +4 -0
  66. package/dist/es/sse/client.js +121 -0
  67. package/dist/es/sse/helpers.js +8 -0
  68. package/dist/es/sse/index.js +3 -0
  69. package/dist/es/state/index.js +3 -0
  70. package/dist/es/state-machine/index.js +14 -0
  71. package/dist/es/store/bound.js +20 -0
  72. package/dist/es/store/index.js +6 -0
  73. package/dist/es/store/unbound.js +44 -0
  74. package/dist/es/store/use-deep.js +13 -0
  75. package/dist/types/src/ai/index.d.ts +6 -0
  76. package/dist/types/src/api/client.d.ts +55 -0
  77. package/dist/types/src/api/constants.d.ts +12 -0
  78. package/dist/types/src/api/helpers.d.ts +9 -0
  79. package/dist/types/src/api/index.d.ts +4 -0
  80. package/dist/types/src/api/types.d.ts +48 -0
  81. package/dist/types/src/auth/helpers.d.ts +11 -0
  82. package/dist/types/src/auth/index.d.ts +2 -0
  83. package/dist/types/src/auth/types.d.ts +1 -0
  84. package/dist/types/src/common/index.d.ts +1 -0
  85. package/dist/types/src/common/types.d.ts +98 -0
  86. package/dist/types/src/context/api-client.d.ts +17 -0
  87. package/dist/types/src/context/app.d.ts +12 -0
  88. package/dist/types/src/context/context-selector.d.ts +32 -0
  89. package/dist/types/src/context/disabled.d.ts +9 -0
  90. package/dist/types/src/context/index.d.ts +6 -0
  91. package/dist/types/src/context/types.d.ts +26 -0
  92. package/dist/types/src/dnd/index.d.ts +8 -0
  93. package/dist/types/src/http/client.d.ts +112 -0
  94. package/dist/types/src/http/constants.d.ts +24 -0
  95. package/dist/types/src/http/errors.d.ts +14 -0
  96. package/dist/types/src/http/helpers.d.ts +17 -0
  97. package/dist/types/src/http/index.d.ts +5 -0
  98. package/dist/types/src/http/types.d.ts +101 -0
  99. package/dist/types/src/immer/index.d.ts +2 -0
  100. package/dist/types/src/index.d.ts +16 -0
  101. package/dist/types/src/motion/features.d.ts +1 -0
  102. package/dist/types/src/motion/index.d.ts +4 -0
  103. package/dist/types/src/motion/motion-provider.d.ts +10 -0
  104. package/dist/types/src/query/constants.d.ts +1 -0
  105. package/dist/types/src/query/helpers.d.ts +7 -0
  106. package/dist/types/src/query/hooks.d.ts +27 -0
  107. package/dist/types/src/query/index.d.ts +4 -0
  108. package/dist/types/src/query/types.d.ts +51 -0
  109. package/dist/types/src/sse/client.d.ts +16 -0
  110. package/dist/types/src/sse/helpers.d.ts +9 -0
  111. package/dist/types/src/sse/index.d.ts +3 -0
  112. package/dist/types/src/sse/types.d.ts +98 -0
  113. package/dist/types/src/state/index.d.ts +1 -0
  114. package/dist/types/src/state-machine/index.d.ts +15 -0
  115. package/dist/types/src/store/bound.d.ts +28 -0
  116. package/dist/types/src/store/index.d.ts +5 -0
  117. package/dist/types/src/store/types.d.ts +50 -0
  118. package/dist/types/src/store/unbound.d.ts +26 -0
  119. package/dist/types/src/store/use-deep.d.ts +8 -0
  120. package/package.json +79 -0
@@ -0,0 +1,9 @@
1
+ /*! @vef-framework-react/core v2.1.0 made by Venus | 2026-03-27T08:01:41.111Z */
2
+ import "./errors.js";
3
+ import { HttpClient as e } from "./client.js";
4
+ //#region src/http/helpers.ts
5
+ function t(t) {
6
+ return Object.freeze(new e(t));
7
+ }
8
+ //#endregion
9
+ export { t as createHttpClient };
@@ -0,0 +1,5 @@
1
+ /*! @vef-framework-react/core v2.1.0 made by Venus | 2026-03-27T08:01:41.111Z */
2
+ import "./constants.js";
3
+ import "./errors.js";
4
+ import "./client.js";
5
+ import "./helpers.js";
@@ -0,0 +1,6 @@
1
+ /*! @vef-framework-react/core v2.1.0 made by Venus | 2026-03-27T08:01:41.111Z */
2
+ import { applyPatches as e, current as t, enableMapSet as n, enablePatches as r, original as i, produce as a, produceWithPatches as o, setAutoFreeze as s } from "immer";
3
+ import { useImmer as c, useImmerReducer as l } from "use-immer";
4
+ n(), r(), s(!1);
5
+ //#endregion
6
+ export { e as applyPatches, t as currentState, i as originalState, a as produce, o as produceWithPatches, c as useImmer, l as useImmerReducer };
@@ -0,0 +1,27 @@
1
+ /*! @vef-framework-react/core v2.1.0 made by Venus | 2026-03-27T08:01:41.111Z */
2
+ import { DefaultChatTransport as e, TextStreamChatTransport as t, getToolName as n, getToolOrDynamicToolName as r, isDataUIPart as i, isDeepEqualData as a, isFileUIPart as o, isReasoningUIPart as s, isTextUIPart as c, isToolOrDynamicToolUIPart as l, isToolUIPart as u, parsePartialJson as d } from "./ai/index.js";
3
+ import { SKIP_AUTH_HEADER as f, SKIP_AUTH_VALUE as p } from "./http/constants.js";
4
+ import { keepPreviousData as m } from "./query/helpers.js";
5
+ import { matchMutation as h, matchQuery as g, skipQueryToken as _, useInfiniteQuery as v, useIsFetching as y, useIsMutating as b, useMutation as x, useMutationState as S, useQueries as C, useQuery as w, useQueryErrorResetBoundary as T } from "./query/hooks.js";
6
+ import { HTTP_CLIENT as E, QUERY_CLIENT as D } from "./api/constants.js";
7
+ import { ApiClient as O } from "./api/client.js";
8
+ import { createApiClient as k } from "./api/helpers.js";
9
+ import { checkPermission as A } from "./auth/helpers.js";
10
+ import { ApiClientProvider as j, useApiClient as M } from "./context/api-client.js";
11
+ import { AppContextProvider as N, useAppContext as P } from "./context/app.js";
12
+ import { createContextWithSelector as F } from "./context/context-selector.js";
13
+ import { DisabledProvider as I, useDisabled as L } from "./context/disabled.js";
14
+ import { AxisModifier as R, DragDropContext as z, DragDropProvider as B, DragOverlay as V, Draggable as H, Droppable as U, KeyboardSensor as W, PointerSensor as G, RestrictToElement as K, RestrictToHorizontalAxis as q, RestrictToVerticalAxis as J, RestrictToWindow as Y, SnapModifier as X, moveArrayItem as Z, moveDragItem as Q, restrictShapeToBoundingRectangle as $, swapArrayItem as ee, swapDragItem as te, useDragDropMonitor as ne, useDraggable as re, useDroppable as ie, useSortable as ae } from "./dnd/index.js";
15
+ import { applyPatches as oe, currentState as se, originalState as ce, produce as le, produceWithPatches as ue, useImmer as de, useImmerReducer as fe } from "./immer/index.js";
16
+ import pe from "./motion/motion-provider.js";
17
+ import { AnimatePresence as me, LayoutGroup as he, Reorder as ge, motion as _e, useDragControls as ve, useInView as ye } from "./motion/index.js";
18
+ import { SseClient as be } from "./sse/client.js";
19
+ import { createSseClient as xe } from "./sse/helpers.js";
20
+ import { AtomStoreProvider as Se, atom as Ce, createAtomStore as we, getDefaultAtomStore as Te, useAtom as Ee, useAtomStore as De, useAtomValue as Oe, useSetAtom as ke } from "./state/index.js";
21
+ import { Actor as Ae, createActor as je, createMachine as Me, updateContext as Ne, useActor as Pe, useActorRef as Fe } from "./state-machine/index.js";
22
+ import { createPersistedStore as Ie, createStore as Le } from "./store/bound.js";
23
+ import { createComponentStore as Re } from "./store/unbound.js";
24
+ import { useDeep as ze } from "./store/use-deep.js";
25
+ import { useShallow as Be } from "./store/index.js";
26
+ import { clsx as Ve } from "clsx";
27
+ export { Ae as Actor, me as AnimatePresence, O as ApiClient, j as ApiClientProvider, N as AppContextProvider, Se as AtomStoreProvider, R as AxisModifier, e as DefaultChatTransport, I as DisabledProvider, z as DragDropContext, B as DragDropProvider, V as DragOverlay, H as Draggable, U as Droppable, E as HTTP_CLIENT, W as KeyboardSensor, he as LayoutGroup, pe as MotionProvider, G as PointerSensor, D as QUERY_CLIENT, ge as Reorder, K as RestrictToElement, q as RestrictToHorizontalAxis, J as RestrictToVerticalAxis, Y as RestrictToWindow, X as SnapModifier, be as SseClient, t as TextStreamChatTransport, oe as applyPatches, Ce as atom, A as checkPermission, Ve as clsx, je as createActor, k as createApiClient, we as createAtomStore, Re as createComponentStore, F as createContextWithSelector, Me as createMachine, Ie as createPersistedStore, xe as createSseClient, Le as createStore, se as currentState, Te as getDefaultAtomStore, n as getToolName, r as getToolOrDynamicToolName, i as isDataUIPart, a as isDeepEqualData, o as isFileUIPart, s as isReasoningUIPart, c as isTextUIPart, l as isToolOrDynamicToolUIPart, u as isToolUIPart, m as keepPreviousData, h as matchMutation, g as matchQuery, _e as motion, Z as moveArrayItem, Q as moveDragItem, ce as originalState, d as parsePartialJson, le as produce, ue as produceWithPatches, $ as restrictShapeToBoundingRectangle, f as skipAuthenticationHeader, p as skipAuthenticationValue, _ as skipQueryToken, ee as swapArrayItem, te as swapDragItem, Ne as updateContext, Pe as useActor, Fe as useActorRef, M as useApiClient, P as useAppContext, Ee as useAtom, De as useAtomStore, Oe as useAtomValue, ze as useDeep, L as useDisabled, ve as useDragControls, ne as useDragDropMonitor, re as useDraggable, ie as useDroppable, de as useImmer, fe as useImmerReducer, ye as useInView, v as useInfiniteQuery, y as useIsFetching, b as useIsMutating, x as useMutation, S as useMutationState, C as useQueries, w as useQuery, T as useQueryErrorResetBoundary, ke as useSetAtom, Be as useShallow, ae as useSortable };
@@ -0,0 +1,3 @@
1
+ /*! @vef-framework-react/core v2.1.0 made by Venus | 2026-03-27T08:01:41.111Z */
2
+ import { domMax as e } from "motion/react";
3
+ export { e as default };
@@ -0,0 +1,5 @@
1
+ /*! @vef-framework-react/core v2.1.0 made by Venus | 2026-03-27T08:01:41.111Z */
2
+ import "./motion-provider.js";
3
+ import { AnimatePresence as e, LayoutGroup as t, Reorder as n, useDragControls as r, useInView as i } from "motion/react";
4
+ import * as a from "motion/react-m";
5
+ export { e as AnimatePresence, t as LayoutGroup, n as Reorder, a as motion, r as useDragControls, i as useInView };
@@ -0,0 +1,24 @@
1
+ /*! @vef-framework-react/core v2.1.0 made by Venus | 2026-03-27T08:01:41.111Z */
2
+ import { generateId as e } from "@vef-framework-react/shared";
3
+ import { useState as t } from "react";
4
+ import { jsx as n } from "@emotion/react/jsx-runtime";
5
+ import { LazyMotion as r, MotionConfig as i } from "motion/react";
6
+ //#region src/motion/motion-provider.tsx
7
+ var a = () => import("./features.js").then((e) => e.default), o = {
8
+ duration: .2,
9
+ ease: "easeInOut"
10
+ };
11
+ function s({ children: s }) {
12
+ let [c] = t(e);
13
+ return /* @__PURE__ */ n(r, {
14
+ features: a,
15
+ children: /* @__PURE__ */ n(i, {
16
+ nonce: c,
17
+ reducedMotion: "user",
18
+ transition: o,
19
+ children: s
20
+ })
21
+ });
22
+ }
23
+ //#endregion
24
+ export { s as default };
@@ -0,0 +1,5 @@
1
+ /*! @vef-framework-react/core v2.1.0 made by Venus | 2026-03-27T08:01:41.111Z */
2
+ //#region src/query/constants.ts
3
+ var e = "__vef_query_client_key";
4
+ //#endregion
5
+ export { e as QUERY_CLIENT_KEY };
@@ -0,0 +1,41 @@
1
+ /*! @vef-framework-react/core v2.1.0 made by Venus | 2026-03-27T08:01:41.111Z */
2
+ import { hashKey as e, isPlainObject as t } from "@vef-framework-react/shared";
3
+ import { MutationCache as n, QueryClient as r, keepPreviousData as i, matchQuery as a } from "@tanstack/react-query";
4
+ //#region src/query/helpers.ts
5
+ function o(i) {
6
+ let { staleTime: o = 5e3, gcTime: s = 3e5, showSuccessMessage: c } = i ?? {}, l = new r({
7
+ mutationCache: new n({ onSuccess: async (e, n, r, i) => {
8
+ let { invalidates: o, shouldShowSuccessFeedback: s = !0 } = i.meta ?? {};
9
+ o && await l.invalidateQueries({
10
+ stale: !1,
11
+ type: "all",
12
+ predicate: (e) => o.some((t) => a({ queryKey: t }, e))
13
+ }), s && t(e) && Object.hasOwn(e, "message") && c?.(e.message);
14
+ } }),
15
+ defaultOptions: {
16
+ queries: {
17
+ staleTime: o,
18
+ gcTime: s,
19
+ networkMode: "online",
20
+ retry: !1,
21
+ structuralSharing: !0,
22
+ throwOnError: !1,
23
+ refetchOnMount: !0,
24
+ refetchOnReconnect: !0,
25
+ refetchOnWindowFocus: !0,
26
+ retryOnMount: !0,
27
+ queryKeyHashFn: e,
28
+ experimental_prefetchInRender: !0
29
+ },
30
+ mutations: {
31
+ gcTime: s,
32
+ networkMode: "online",
33
+ retry: !1,
34
+ throwOnError: !1
35
+ }
36
+ }
37
+ });
38
+ return l;
39
+ }
40
+ //#endregion
41
+ export { o as createQueryClient, i as keepPreviousData };
@@ -0,0 +1,26 @@
1
+ /*! @vef-framework-react/core v2.1.0 made by Venus | 2026-03-27T08:01:41.111Z */
2
+ import { matchMutation as e, matchQuery as t, skipToken as n, useInfiniteQuery as r, useIsFetching as i, useIsMutating as a, useMutation as o, useMutationState as s, useQueries as c, useQuery as l, useQueryErrorResetBoundary as u } from "@tanstack/react-query";
3
+ //#region src/query/hooks.ts
4
+ function d(e) {
5
+ return l(e);
6
+ }
7
+ function f(e) {
8
+ return r(e);
9
+ }
10
+ function p(e) {
11
+ return c(e);
12
+ }
13
+ function m(e) {
14
+ return o(e);
15
+ }
16
+ function h(e) {
17
+ return s(e);
18
+ }
19
+ function g(e) {
20
+ return i(e);
21
+ }
22
+ function _(e) {
23
+ return a(e);
24
+ }
25
+ //#endregion
26
+ export { e as matchMutation, t as matchQuery, n as skipQueryToken, f as useInfiniteQuery, g as useIsFetching, _ as useIsMutating, m as useMutation, h as useMutationState, p as useQueries, d as useQuery, u as useQueryErrorResetBoundary };
@@ -0,0 +1,4 @@
1
+ /*! @vef-framework-react/core v2.1.0 made by Venus | 2026-03-27T08:01:41.111Z */
2
+ import "./constants.js";
3
+ import "./helpers.js";
4
+ import "./hooks.js";
@@ -0,0 +1,121 @@
1
+ /*! @vef-framework-react/core v2.1.0 made by Venus | 2026-03-27T08:01:41.111Z */
2
+ import { isString as e } from "@vef-framework-react/shared";
3
+ import { fetchEventSource as t } from "@microsoft/fetch-event-source";
4
+ //#region src/sse/client.ts
5
+ var n = class extends Error {
6
+ constructor() {
7
+ super("Token expired"), this.name = "TokenExpiredError";
8
+ }
9
+ };
10
+ function r(e, t) {
11
+ let n = t.toLowerCase();
12
+ return Object.keys(e).some((e) => e.toLowerCase() === n);
13
+ }
14
+ function i(t, n) {
15
+ if (t !== void 0) return e(t) ? t : (r(n, "content-type") || (n["Content-Type"] = "application/json"), JSON.stringify(t));
16
+ }
17
+ var a = class {
18
+ #e;
19
+ #t = /* @__PURE__ */ new Set();
20
+ constructor(e = {}) {
21
+ this.#e = {
22
+ enableRetry: !0,
23
+ maxRetries: 3,
24
+ ...e
25
+ };
26
+ }
27
+ stream(e, t) {
28
+ return this.#n(e, t, !1);
29
+ }
30
+ abort() {
31
+ for (let e of this.#t) e.abort();
32
+ this.#t.clear();
33
+ }
34
+ async #n(e, r, a) {
35
+ let o = new AbortController();
36
+ this.#t.add(o);
37
+ let s = this.#r(e.signal, o), c = await this.#i(e.headers), l = i(e.body, c), u = 0, d = !1, f = () => {
38
+ d || (d = !0, s?.(), this.#t.delete(o));
39
+ };
40
+ try {
41
+ await t(e.url, {
42
+ method: e.method ?? "POST",
43
+ headers: c,
44
+ body: l,
45
+ signal: o.signal,
46
+ onopen: async (e) => {
47
+ if (e.status === 401) throw new n();
48
+ if (!e.ok) throw Error(`HTTP ${e.status}: ${e.statusText}`);
49
+ let t = e.headers.get("content-type");
50
+ if (t && !t.includes("text/event-stream")) throw Error(`Expected content-type to be text/event-stream, got ${t}`);
51
+ u = 0, await r.onOpen?.(e);
52
+ },
53
+ onmessage: (e) => {
54
+ r.onMessage({
55
+ id: e.id,
56
+ event: e.event,
57
+ data: e.data
58
+ });
59
+ },
60
+ onerror: (e) => {
61
+ if (o.signal.aborted) return;
62
+ if (e instanceof n) throw e;
63
+ if (this.#e.enableRetry && u < this.#e.maxRetries) {
64
+ u++, console.warn(`SSE connection error, retrying (${u}/${this.#e.maxRetries})...`);
65
+ return;
66
+ }
67
+ let t = e;
68
+ throw r.onError?.(t), this.#e.showErrorMessage?.(t.message), e;
69
+ },
70
+ onclose: () => {
71
+ r.onClose?.();
72
+ }
73
+ });
74
+ } catch (t) {
75
+ if (!await this.#a(t, e, r, a, f)) throw t;
76
+ } finally {
77
+ f();
78
+ }
79
+ }
80
+ #r(e, t) {
81
+ if (!e) return;
82
+ let n = () => {
83
+ t.abort(e.reason);
84
+ };
85
+ if (e.aborted) {
86
+ n();
87
+ return;
88
+ }
89
+ return e.addEventListener("abort", n, { once: !0 }), () => e.removeEventListener("abort", n);
90
+ }
91
+ async #i(e) {
92
+ let t = { ...e };
93
+ try {
94
+ let e = await this.#e.getAuthTokens?.();
95
+ e?.accessToken && !r(t, "authorization") && (t.Authorization = `Bearer ${e.accessToken}`);
96
+ } catch (e) {
97
+ console.error("Failed to get auth tokens:", e);
98
+ }
99
+ return t;
100
+ }
101
+ async #a(e, t, r, i, a) {
102
+ if (e instanceof Error && e.name === "AbortError") return !0;
103
+ if (e instanceof n && !i) {
104
+ if (await this.#o()) return a(), await this.#n(t, r, !0), !0;
105
+ let e = /* @__PURE__ */ Error("Authentication failed: token expired");
106
+ return r.onError?.(e), this.#e.showErrorMessage?.(e.message), !0;
107
+ }
108
+ return !1;
109
+ }
110
+ async #o() {
111
+ let { onTokenExpired: e } = this.#e;
112
+ if (!e) return !1;
113
+ try {
114
+ return await e();
115
+ } catch (e) {
116
+ return console.error("Failed to refresh token:", e), !1;
117
+ }
118
+ }
119
+ };
120
+ //#endregion
121
+ export { a as SseClient };
@@ -0,0 +1,8 @@
1
+ /*! @vef-framework-react/core v2.1.0 made by Venus | 2026-03-27T08:01:41.111Z */
2
+ import { SseClient as e } from "./client.js";
3
+ //#region src/sse/helpers.ts
4
+ function t(t) {
5
+ return new e(t);
6
+ }
7
+ //#endregion
8
+ export { t as createSseClient };
@@ -0,0 +1,3 @@
1
+ /*! @vef-framework-react/core v2.1.0 made by Venus | 2026-03-27T08:01:41.111Z */
2
+ import "./client.js";
3
+ import "./helpers.js";
@@ -0,0 +1,3 @@
1
+ /*! @vef-framework-react/core v2.1.0 made by Venus | 2026-03-27T08:01:41.111Z */
2
+ import { Provider as e, atom as t, createStore as n, getDefaultStore as r, useAtom as i, useAtomValue as a, useSetAtom as o, useStore as s } from "jotai";
3
+ export { e as AtomStoreProvider, t as atom, n as createAtomStore, r as getDefaultAtomStore, i as useAtom, s as useAtomStore, a as useAtomValue, o as useSetAtom };
@@ -0,0 +1,14 @@
1
+ /*! @vef-framework-react/core v2.1.0 made by Venus | 2026-03-27T08:01:41.111Z */
2
+ import { useActorRef as e, useActorRef as t, useSelector as n } from "@xstate/react";
3
+ import { Actor as r, assign as i, createActor as a, createMachine as o } from "xstate";
4
+ //#region src/state-machine/index.ts
5
+ function s(t, r, ...[i]) {
6
+ let a = e(t, i);
7
+ return [
8
+ n(a, r, Object.is),
9
+ a.send,
10
+ a
11
+ ];
12
+ }
13
+ //#endregion
14
+ export { r as Actor, a as createActor, o as createMachine, i as updateContext, s as useActor, t as useActorRef };
@@ -0,0 +1,20 @@
1
+ /*! @vef-framework-react/core v2.1.0 made by Venus | 2026-03-27T08:01:41.111Z */
2
+ import { constantCase as e, identity as t } from "@vef-framework-react/shared";
3
+ import { create as n } from "zustand";
4
+ import { createJSONStorage as r, persist as i, subscribeWithSelector as a } from "zustand/middleware";
5
+ import { immer as o } from "zustand/middleware/immer";
6
+ //#region src/store/bound.ts
7
+ function s(e) {
8
+ return n()(a(o(e)));
9
+ }
10
+ function c(s, c) {
11
+ let { name: l, storage: u, selector: d } = c, f = `__VEF_STORE__${e(l)}__`, p = u === "local" ? localStorage : sessionStorage;
12
+ return n()(a(i(o(s), {
13
+ name: f,
14
+ version: 1,
15
+ storage: r(() => p),
16
+ partialize: d ?? t
17
+ })));
18
+ }
19
+ //#endregion
20
+ export { c as createPersistedStore, s as createStore };
@@ -0,0 +1,6 @@
1
+ /*! @vef-framework-react/core v2.1.0 made by Venus | 2026-03-27T08:01:41.111Z */
2
+ import "./bound.js";
3
+ import "./unbound.js";
4
+ import "./use-deep.js";
5
+ import { useShallow as e } from "zustand/shallow";
6
+ export { e as useShallow };
@@ -0,0 +1,44 @@
1
+ /*! @vef-framework-react/core v2.1.0 made by Venus | 2026-03-27T08:01:41.111Z */
2
+ import { isPlainObject as e, mergeWith as t } from "@vef-framework-react/shared";
3
+ import { createContext as n, use as r, useRef as i } from "react";
4
+ import { jsx as a } from "@emotion/react/jsx-runtime";
5
+ import { useIsomorphicLayoutEffect as o } from "motion/react";
6
+ import { createStore as s, useStore as c } from "zustand";
7
+ import { subscribeWithSelector as l } from "zustand/middleware";
8
+ import { immer as u } from "zustand/middleware/immer";
9
+ //#region src/store/unbound.tsx
10
+ var d = /* @__PURE__ */ new Map();
11
+ function f(f, p) {
12
+ let m = `${f}StoreContext`, h = d.get(m);
13
+ h || (h = n(null), h.displayName = m, d.set(m, h));
14
+ let g = h;
15
+ function _({ children: n, initialState: r }) {
16
+ let c = i(null), d = i(!1), f = i(r);
17
+ return f.current = r, (!c.current || !d.current) && (c.current = s()(l(u(p))), d.current = !0), o(() => {
18
+ !e(f.current) || !c.current || c.current.setState((e) => {
19
+ t(e, f.current, !0);
20
+ });
21
+ }, []), /* @__PURE__ */ a(g, {
22
+ value: c.current,
23
+ children: n
24
+ });
25
+ }
26
+ function v() {
27
+ let e = r(g);
28
+ if (!e) {
29
+ let e = `${f}Store is not found in the React context. Ensure the component is wrapped in ${f}StoreProvider.`;
30
+ throw Error(e + "");
31
+ }
32
+ return e;
33
+ }
34
+ function y(e) {
35
+ return c(v(), e);
36
+ }
37
+ return {
38
+ StoreProvider: _,
39
+ useStoreApi: v,
40
+ useStore: y
41
+ };
42
+ }
43
+ //#endregion
44
+ export { f as createComponentStore };
@@ -0,0 +1,13 @@
1
+ /*! @vef-framework-react/core v2.1.0 made by Venus | 2026-03-27T08:01:41.111Z */
2
+ import { isDeepEqual as e } from "@vef-framework-react/shared";
3
+ import { useRef as t } from "react";
4
+ //#region src/store/use-deep.ts
5
+ function n(n) {
6
+ let r = t(null);
7
+ return (t) => {
8
+ let i = n(t);
9
+ return e(r.current, i) ? r.current : (r.current = i, i);
10
+ };
11
+ }
12
+ //#endregion
13
+ export { n as useDeep };
@@ -0,0 +1,6 @@
1
+ export { DefaultChatTransport, TextStreamChatTransport, type ChatTransport } from 'ai';
2
+ export type { DataUIPart, DynamicToolUIPart, FileUIPart, ReasoningUIPart, SourceDocumentUIPart, SourceUrlUIPart, StepStartUIPart, TextUIPart, ToolUIPart, UIMessage, UIMessageChunk, UIMessagePart } from 'ai';
3
+ export type { UIToolInvocation, UITools } from 'ai';
4
+ export { getToolName, getToolOrDynamicToolName } from 'ai';
5
+ export { isDataUIPart, isFileUIPart, isReasoningUIPart, isTextUIPart, isToolOrDynamicToolUIPart, isToolUIPart } from 'ai';
6
+ export { isDeepEqualData, parsePartialJson } from 'ai';
@@ -0,0 +1,55 @@
1
+ import { FetchQueryOptions, MutationOptions, QueryClient, QueryMeta } from '@tanstack/react-query';
2
+ import { Awaitable, Except, If, IsNever, IsOptional } from '@vef-framework-react/shared';
3
+ import { HttpClient } from '../http';
4
+ import { ApiClientOptions, MutationFunction, QueryFunction, QueryKey } from './types';
5
+ import { HTTP_CLIENT, QUERY_CLIENT } from './constants';
6
+ /**
7
+ * API client that combines HttpClient and QueryClient for data fetching.
8
+ */
9
+ export declare class ApiClient {
10
+ #private;
11
+ /**
12
+ * Access the underlying QueryClient.
13
+ */
14
+ get [QUERY_CLIENT](): QueryClient;
15
+ /**
16
+ * Access the underlying HttpClient.
17
+ */
18
+ get [HTTP_CLIENT](): Readonly<HttpClient>;
19
+ constructor(options: ApiClientOptions);
20
+ /**
21
+ * Create a proxied HttpClient that injects the current abort signal.
22
+ */
23
+ private createProxiedHttpClient;
24
+ /**
25
+ * Create a query function with automatic signal injection.
26
+ */
27
+ createQueryFn<TResult = unknown, TParams = never, TPageParam = never>(key: string, factory: (http: Readonly<HttpClient>) => (queryParams: TParams, pageParam: TPageParam, meta?: QueryMeta) => Awaitable<TResult>): QueryFunction<TResult, TParams, TPageParam>;
28
+ /**
29
+ * Create a mutation function.
30
+ */
31
+ createMutationFn<TResult = unknown, TParams = never>(key: string, factory: (http: Readonly<HttpClient>) => (params: TParams) => Awaitable<TResult>): MutationFunction<TResult, TParams>;
32
+ /**
33
+ * Fetch a query and return the result.
34
+ */
35
+ fetchQuery<TQueryFnData = unknown, TData = TQueryFnData, TParams = unknown, TPageParam = never>(options: Except<FetchQueryOptions<TQueryFnData, Error, TData, QueryKey<TParams>, TPageParam>, "queryHash" | "queryKeyHashFn">): Promise<TData>;
36
+ /**
37
+ * Prefetch a query and store the result in cache.
38
+ */
39
+ prefetchQuery<TQueryFnData = unknown, TData = TQueryFnData, TParams = unknown, TPageParam = never>(options: Except<FetchQueryOptions<TQueryFnData, Error, TData, QueryKey<TParams>, TPageParam>, "queryHash" | "queryKeyHashFn">): Promise<void>;
40
+ /**
41
+ * Execute a mutation imperatively outside of React components.
42
+ *
43
+ * Useful for scenarios like login flows, event handlers, or any code outside React components.
44
+ * Lifecycle callbacks (onMutate, onSuccess, etc.) still fire.
45
+ */
46
+ executeMutation<TData = unknown, TParams = unknown, TOnMutateResult = unknown>({ mutationFn, params, ...options }: Except<MutationOptions<TData, Error, TParams, TOnMutateResult>, "mutationKey" | "mutationFn"> & {
47
+ mutationFn: MutationFunction<TData, TParams>;
48
+ } & If<IsNever<TParams>, {
49
+ params?: never;
50
+ }, If<IsOptional<TParams>, {
51
+ params?: TParams;
52
+ }, {
53
+ params: TParams;
54
+ }>>): Promise<TData>;
55
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * HTTP methods that should have the abort signal injected.
3
+ */
4
+ export declare const PROXIED_METHODS: Set<string>;
5
+ /**
6
+ * Symbol for accessing the query client.
7
+ */
8
+ export declare const QUERY_CLIENT: unique symbol;
9
+ /**
10
+ * Symbol for accessing the HTTP client.
11
+ */
12
+ export declare const HTTP_CLIENT: unique symbol;
@@ -0,0 +1,9 @@
1
+ import { ApiClientOptions } from './types';
2
+ import { ApiClient } from './client';
3
+ /**
4
+ * Creates a new API client.
5
+ *
6
+ * @param options - The options for the API client.
7
+ * @returns The API client.
8
+ */
9
+ export declare function createApiClient(options: ApiClientOptions): ApiClient;
@@ -0,0 +1,4 @@
1
+ export { ApiClient } from './client';
2
+ export { HTTP_CLIENT, QUERY_CLIENT } from './constants';
3
+ export { createApiClient } from './helpers';
4
+ export type * from './types';
@@ -0,0 +1,48 @@
1
+ import { MutationFunction as MutationFunctionInternal, QueryFunction as QueryFunctionInternal } from '@tanstack/react-query';
2
+ import { If, IsNever, Key } from '@vef-framework-react/shared';
3
+ import { HttpClientOptions } from '../http';
4
+ import { QueryClientOptions } from '../query';
5
+ /**
6
+ * The options for the API client.
7
+ */
8
+ export interface ApiClientOptions {
9
+ /**
10
+ * The options for the HTTP client.
11
+ */
12
+ http: HttpClientOptions;
13
+ /**
14
+ * The options for the query client.
15
+ */
16
+ query?: QueryClientOptions;
17
+ }
18
+ /**
19
+ * The key of the query.
20
+ *
21
+ * @param TParams - The parameters of the query.
22
+ */
23
+ export type QueryKey<TParams = never> = readonly [Key, ...If<IsNever<TParams>, [], [TParams]>];
24
+ /**
25
+ * The query function.
26
+ *
27
+ * @param TResult - The result of the query.
28
+ * @param TParams - The parameters of the query.
29
+ * @param TPageParam - The page parameter of the query.
30
+ */
31
+ export interface QueryFunction<TData = unknown, TParams = never, TPageParam = never> extends QueryFunctionInternal<TData, QueryKey<TParams>, TPageParam> {
32
+ /**
33
+ * The API identifier.
34
+ */
35
+ key: Key;
36
+ }
37
+ /**
38
+ * The mutation function.
39
+ *
40
+ * @param TResult - The result of the mutation.
41
+ * @param TParams - The parameters of the mutation.
42
+ */
43
+ export interface MutationFunction<TData = unknown, TParams = never> extends MutationFunctionInternal<TData, TParams> {
44
+ /**
45
+ * The API identifier.
46
+ */
47
+ key: Key;
48
+ }
@@ -0,0 +1,11 @@
1
+ import { MaybeArray } from '@vef-framework-react/shared';
2
+ import { PermissionCheckMode } from './types.js';
3
+ /**
4
+ * Check if the user is authorized to access the resource identified by the permission token.
5
+ *
6
+ * @param hasPermission - Function to check if the user has a specific permission token.
7
+ * @param permTokens - Single token or array of tokens to check. If nullish, returns true (no permission required).
8
+ * @param checkMode - "any" requires at least one token match, "all" requires all tokens to match.
9
+ * @returns True if the user has the required permission(s), false otherwise.
10
+ */
11
+ export declare function checkPermission(hasPermission: (token: string) => boolean, permTokens?: MaybeArray<string>, checkMode?: PermissionCheckMode): boolean;
@@ -0,0 +1,2 @@
1
+ export { checkPermission } from './helpers.js';
2
+ export type * from './types.js';
@@ -0,0 +1 @@
1
+ export type PermissionCheckMode = "any" | "all";
@@ -0,0 +1 @@
1
+ export type * from './types.js';