@declarion/react 0.2.9 → 0.2.11
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/dist-lib/{DraggableChildrenTable-BJ3W4Wxm.js → DraggableChildrenTable-B4JD8tAe.js} +2 -2
- package/dist-lib/{DraggableChildrenTable-BJ3W4Wxm.js.map → DraggableChildrenTable-B4JD8tAe.js.map} +1 -1
- package/dist-lib/{Grid-POpRhlPk.js → Grid-BEEwkvX8.js} +2 -2
- package/dist-lib/{Grid-POpRhlPk.js.map → Grid-BEEwkvX8.js.map} +1 -1
- package/dist-lib/{JsonEditor-CexL5HXN.js → JsonEditor-KelPV-OQ.js} +1 -1
- package/dist-lib/{JsonEditor-CexL5HXN.js.map → JsonEditor-KelPV-OQ.js.map} +1 -1
- package/dist-lib/{MarkdownRenderer-bs52XQ7M.js → MarkdownRenderer-Dvo_0Zcx.js} +2 -2
- package/dist-lib/{MarkdownRenderer-bs52XQ7M.js.map → MarkdownRenderer-Dvo_0Zcx.js.map} +1 -1
- package/dist-lib/{dataTableStyles-DctG2tMU.js → dataTableStyles-DQdH4Ilw.js} +6 -6
- package/dist-lib/{dataTableStyles-DctG2tMU.js.map → dataTableStyles-DQdH4Ilw.js.map} +1 -1
- package/dist-lib/hooks/useAllEntityData.d.ts +1 -1
- package/dist-lib/hooks/useChildrenData.d.ts +1 -1
- package/dist-lib/hooks/useEntityData.d.ts +2 -2
- package/dist-lib/hooks/useEntityItem.d.ts +1 -1
- package/dist-lib/hooks/useParams.d.ts +2 -2
- package/dist-lib/hooks/useSchema.d.ts +1 -1
- package/dist-lib/index.js +7 -7
- package/dist-lib/{rich-text-CaQ6-8Gx.js → rich-text-CJpzFOG5.js} +1 -1
- package/dist-lib/{rich-text-CaQ6-8Gx.js.map → rich-text-CJpzFOG5.js.map} +1 -1
- package/dist-lib/{value-CXFBdyeL.js → value-DaEUgsnK.js} +10 -10
- package/dist-lib/{value-CXFBdyeL.js.map → value-DaEUgsnK.js.map} +1 -1
- package/package.json +8 -8
|
@@ -13,4 +13,4 @@ import type { ListParams, ListResponse } from "../types/api";
|
|
|
13
13
|
* The caller's `page` / `per_page` in `params` are ignored - this hook owns
|
|
14
14
|
* pagination - while `filters`, `search`, `sort`, and `expand` are honored.
|
|
15
15
|
*/
|
|
16
|
-
export declare function useAllEntityData(entity: string | undefined, params?: ListParams): import("@tanstack/react-query").UseQueryResult<ListResponse<Record<string, unknown
|
|
16
|
+
export declare function useAllEntityData(entity: string | undefined, params?: ListParams): import("@tanstack/react-query").UseQueryResult<NoInfer<ListResponse<Record<string, unknown>>>, Error>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ListResponse } from "../types/api";
|
|
2
2
|
export declare const ENTITY_CHILDREN_KEY: "entity-children";
|
|
3
|
-
export declare function useChildrenData(parentEntity: string, parentId: string, childCode: string, foreignKey: string | string[], sort?: string, limit?: number): import("@tanstack/react-query").UseQueryResult<ListResponse<Record<string, unknown
|
|
3
|
+
export declare function useChildrenData(parentEntity: string, parentId: string, childCode: string, foreignKey: string | string[], sort?: string, limit?: number): import("@tanstack/react-query").UseQueryResult<NoInfer<ListResponse<Record<string, unknown>>>, Error>;
|
|
@@ -8,7 +8,7 @@ import type { ListParams, ListResponse } from "../types/api";
|
|
|
8
8
|
* is fetched separately by `useEntityCount`; the table renders rows the
|
|
9
9
|
* moment this query resolves, independent of count latency.
|
|
10
10
|
*/
|
|
11
|
-
export declare function useEntityData(entity: string | undefined, params: ListParams): import("@tanstack/react-query").UseQueryResult<ListResponse<Record<string, unknown
|
|
11
|
+
export declare function useEntityData(entity: string | undefined, params: ListParams): import("@tanstack/react-query").UseQueryResult<NoInfer<ListResponse<Record<string, unknown>>>, Error>;
|
|
12
12
|
/**
|
|
13
13
|
* useEntityCount fetches the total row count for a list view in a SEPARATE
|
|
14
14
|
* request from the window (`count: "only"` - the server skips the data
|
|
@@ -23,4 +23,4 @@ export declare function useEntityData(entity: string | undefined, params: ListPa
|
|
|
23
23
|
* to render. A count failure does NOT break the table: callers treat a
|
|
24
24
|
* failed/absent count as "unknown" and fall back to the loaded row count.
|
|
25
25
|
*/
|
|
26
|
-
export declare function useEntityCount(entity: string | undefined, params: ListParams): import("@tanstack/react-query").UseQueryResult<ListResponse<Record<string, unknown
|
|
26
|
+
export declare function useEntityCount(entity: string | undefined, params: ListParams): import("@tanstack/react-query").UseQueryResult<NoInfer<ListResponse<Record<string, unknown>>>, Error>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { PkValues } from "../types/schema";
|
|
2
|
-
export declare function useEntityItem(entity: string | undefined, pkValues: PkValues | string | undefined): import("@tanstack/react-query").UseQueryResult<import("..").DataResponse<Record<string, unknown
|
|
2
|
+
export declare function useEntityItem(entity: string | undefined, pkValues: PkValues | string | undefined): import("@tanstack/react-query").UseQueryResult<NoInfer<import("..").DataResponse<Record<string, unknown>>>, Error>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ParamLookup } from "../types/api";
|
|
2
|
-
export declare function usePublicParams(): import("@tanstack/react-query").UseQueryResult<import("../types/api").PublicParamsResponse
|
|
2
|
+
export declare function usePublicParams(): import("@tanstack/react-query").UseQueryResult<NoInfer<import("../types/api").PublicParamsResponse>, Error>;
|
|
3
3
|
/**
|
|
4
4
|
* Looks up the platform's record for a parameter without a default.
|
|
5
5
|
* Returns the full ParamLookup envelope (`found`, `value`, `source`).
|
|
6
6
|
* Prefer `useParam` for typical reads where the call site has a default.
|
|
7
7
|
*/
|
|
8
|
-
export declare function useResolvedParam(code: string): import("@tanstack/react-query").UseQueryResult<ParamLookup
|
|
8
|
+
export declare function useResolvedParam(code: string): import("@tanstack/react-query").UseQueryResult<NoInfer<ParamLookup>, Error>;
|
|
9
9
|
/**
|
|
10
10
|
* Reads a parameter and substitutes a caller-supplied default when the
|
|
11
11
|
* platform has no value for it. The default never crosses the wire; the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useSchema(): import("@tanstack/react-query").UseQueryResult<import("..").Schema
|
|
1
|
+
export declare function useSchema(): import("@tanstack/react-query").UseQueryResult<NoInfer<import("..").Schema>, Error>;
|
package/dist-lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as e, $t as t, A as n, At as r, B as i, Bt as a, C as o, Ct as s, D as c, Dt as l, E as u, Et as d, F as f, Ft as p, G as m, Gt as h, H as g, Ht as _, I as v, It as y, J as b, Jt as x, K as S, Kt as C, L as w, Lt as T, M as E, Mt as D, N as O, Nt as k, O as A, Ot as j, P as M, Pt as N, Q as P, Qt as F, R as I, Rt as L, S as ee, St as te, T as ne, Tt as re, U as ie, Ut as ae, V as R, Vt as oe, W as se, Wt as ce, X as le, Xt as z, Y as ue, Yt as de, Z as fe, Zt as B, _ as pe, _t as me, a as V, at as he, b as ge, bt as _e, c as ve, ct as ye, d as be, dt as xe, en as Se, et as Ce, f as H, ft as we, g as Te, gt as U, h as Ee, ht as De, i as Oe, it as ke, j as Ae, jt as je, k as Me, kt as Ne, l as Pe, lt as Fe, m as Ie, mt as Le, n as Re, nt as ze, o as Be, ot as Ve, p as He, pt as Ue, q as We, qt as Ge, r as Ke, rt as qe, s as Je, st as Ye, t as Xe, tt as Ze, u as Qe, ut as $e, v as et, vt as tt, w as nt, wt as rt, x as it, xt as at, y as ot, yt as st, z as ct, zt as W } from "./dataTableStyles-
|
|
2
|
-
import { A as lt, B as ut, C as dt, D as ft, F as pt, H as mt, I as ht, L as gt, M as _t, N as vt, O as yt, P as bt, R as xt, S as St, T as Ct, U as wt, V as Tt, W as Et, _ as Dt, a as Ot, b as kt, j as At, o as jt, s as Mt, v as Nt, x as Pt, y as Ft } from "./value-
|
|
1
|
+
import { $ as e, $t as t, A as n, At as r, B as i, Bt as a, C as o, Ct as s, D as c, Dt as l, E as u, Et as d, F as f, Ft as p, G as m, Gt as h, H as g, Ht as _, I as v, It as y, J as b, Jt as x, K as S, Kt as C, L as w, Lt as T, M as E, Mt as D, N as O, Nt as k, O as A, Ot as j, P as M, Pt as N, Q as P, Qt as F, R as I, Rt as L, S as ee, St as te, T as ne, Tt as re, U as ie, Ut as ae, V as R, Vt as oe, W as se, Wt as ce, X as le, Xt as z, Y as ue, Yt as de, Z as fe, Zt as B, _ as pe, _t as me, a as V, at as he, b as ge, bt as _e, c as ve, ct as ye, d as be, dt as xe, en as Se, et as Ce, f as H, ft as we, g as Te, gt as U, h as Ee, ht as De, i as Oe, it as ke, j as Ae, jt as je, k as Me, kt as Ne, l as Pe, lt as Fe, m as Ie, mt as Le, n as Re, nt as ze, o as Be, ot as Ve, p as He, pt as Ue, q as We, qt as Ge, r as Ke, rt as qe, s as Je, st as Ye, t as Xe, tt as Ze, u as Qe, ut as $e, v as et, vt as tt, w as nt, wt as rt, x as it, xt as at, y as ot, yt as st, z as ct, zt as W } from "./dataTableStyles-DQdH4Ilw.js";
|
|
2
|
+
import { A as lt, B as ut, C as dt, D as ft, F as pt, H as mt, I as ht, L as gt, M as _t, N as vt, O as yt, P as bt, R as xt, S as St, T as Ct, U as wt, V as Tt, W as Et, _ as Dt, a as Ot, b as kt, j as At, o as jt, s as Mt, v as Nt, x as Pt, y as Ft } from "./value-DaEUgsnK.js";
|
|
3
3
|
import { Component as It, Fragment as Lt, Suspense as Rt, createContext as zt, createElement as Bt, lazy as Vt, useCallback as G, useContext as Ht, useEffect as K, useLayoutEffect as Ut, useMemo as q, useRef as J, useState as Y } from "react";
|
|
4
4
|
import { BrowserRouter as Wt, Link as Gt, Navigate as Kt, Outlet as qt, Route as Jt, Routes as Yt, useLocation as Xt, useLocation as Zt, useNavigate as Qt, useNavigate as $t, useParams as en, useParams as tn, useSearchParams as nn, useSearchParams as rn } from "react-router-dom";
|
|
5
5
|
import { QueryClient as an, QueryClientProvider as on, useInfiniteQuery as sn, useMutation as cn, useQuery as ln, useQueryClient as un } from "@tanstack/react-query";
|
|
@@ -17103,7 +17103,7 @@ function Md({ config: e, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
17103
17103
|
}
|
|
17104
17104
|
//#endregion
|
|
17105
17105
|
//#region src/components/detail-layout/ChildrenBlock.tsx
|
|
17106
|
-
var Nd = Vt(() => import("./DraggableChildrenTable-
|
|
17106
|
+
var Nd = Vt(() => import("./DraggableChildrenTable-B4JD8tAe.js").then((e) => ({ default: e.DraggableChildrenTable })));
|
|
17107
17107
|
function Pd({ node: e, ctx: t }) {
|
|
17108
17108
|
let n = e.children;
|
|
17109
17109
|
if (!n || t.isNew && t.mode !== "edit") return null;
|
|
@@ -19477,10 +19477,10 @@ function jf() {
|
|
|
19477
19477
|
//#endregion
|
|
19478
19478
|
//#region src/lib/capabilityPrefetch.ts
|
|
19479
19479
|
var Mf = [
|
|
19480
|
-
() => import("./MarkdownRenderer-
|
|
19481
|
-
() => import("./JsonEditor-
|
|
19482
|
-
() => import("./Grid-
|
|
19483
|
-
() => import("./DraggableChildrenTable-
|
|
19480
|
+
() => import("./MarkdownRenderer-Dvo_0Zcx.js"),
|
|
19481
|
+
() => import("./JsonEditor-KelPV-OQ.js"),
|
|
19482
|
+
() => import("./Grid-BEEwkvX8.js"),
|
|
19483
|
+
() => import("./DraggableChildrenTable-B4JD8tAe.js")
|
|
19484
19484
|
];
|
|
19485
19485
|
function Nf() {
|
|
19486
19486
|
for (let e of Mf) e().catch(() => {});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rich-text-
|
|
1
|
+
{"version":3,"file":"rich-text-CJpzFOG5.js","names":[],"sources":["../src/lib/rich-text.ts"],"sourcesContent":["import type { HydratedFile } from \"@/types/files\";\n\nexport interface RichTextValue {\n markdown: string;\n files: Record<string, HydratedFile>;\n}\n\nconst declarionFilePattern = /declarion:\\/\\/file\\/([0-9a-fA-F-]{36})/g;\n\nexport function richTextMarkdown(value: unknown): string {\n if (typeof value === \"string\") return value;\n if (isRecord(value) && typeof value.markdown === \"string\") return value.markdown;\n return \"\";\n}\n\nexport function richTextFiles(value: unknown): Record<string, HydratedFile> {\n if (!isRecord(value) || !isRecord(value.files)) return {};\n const files: Record<string, HydratedFile> = {};\n for (const [fileId, file] of Object.entries(value.files)) {\n if (isRecord(file) && typeof file.id === \"string\") {\n files[fileId] = file as unknown as HydratedFile;\n }\n }\n return files;\n}\n\nexport function createRichTextValue(markdownValue: unknown, inlineFilesValue: unknown): RichTextValue {\n return {\n markdown: richTextMarkdown(markdownValue),\n files: inlineFilesById(inlineFilesValue),\n };\n}\n\nexport function withRichTextFile(value: unknown, file: HydratedFile): RichTextValue {\n const next = createRichTextValue(value, null);\n next.files[file.id] = file;\n return next;\n}\n\nexport function withoutRichTextFiles(value: unknown, removedIds: Iterable<string>): RichTextValue {\n const next = createRichTextValue(value, null);\n for (const fileId of removedIds) delete next.files[fileId];\n return next;\n}\n\nexport function inlineFilesById(value: unknown): Record<string, HydratedFile> {\n if (!Array.isArray(value)) return {};\n const files: Record<string, HydratedFile> = {};\n for (const item of value) {\n if (isRecord(item) && typeof item.id === \"string\") {\n files[item.id] = item as unknown as HydratedFile;\n }\n }\n return files;\n}\n\nexport function extractDeclarionFileIds(markdown: string): string[] {\n const seen = new Set<string>();\n const ids: string[] = [];\n let match: RegExpExecArray | null;\n declarionFilePattern.lastIndex = 0;\n while ((match = declarionFilePattern.exec(markdown)) !== null) {\n const fileId = match[1];\n if (seen.has(fileId)) continue;\n seen.add(fileId);\n ids.push(fileId);\n }\n return ids;\n}\n\nexport function extractDeclarionFileId(url: string | undefined): string | null {\n if (!url) return null;\n const match = /^declarion:\\/\\/file\\/([0-9a-fA-F-]{36})$/.exec(url);\n return match?.[1] ?? null;\n}\n\nexport function richTextTokenForFile(file: Pick<HydratedFile, \"id\" | \"content_type\" | \"filename\">): string {\n const ref = `declarion://file/${file.id}`;\n if (file.content_type.startsWith(\"image/\")) return ``;\n const label = file.filename || file.id;\n return `[${label}](${ref})`;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null;\n}\n"],"mappings":";AAOA,IAAM,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,EAAK,GACnB,IAAI,EAAI;AAC3B;AAEA,SAAS,EAAS,GAAkD;CAClE,OAAO,OAAO,KAAU,cAAY;AACtC"}
|
|
@@ -219,32 +219,32 @@ var O = (e) => JSON.stringify(e ?? {}), k = null, A = class extends Error {
|
|
|
219
219
|
constructor(e) {
|
|
220
220
|
super(`refresh failed terminally (${e})`), this.status = e, this.name = "RefreshDeadError";
|
|
221
221
|
}
|
|
222
|
-
}, j = null, M = null,
|
|
223
|
-
function
|
|
222
|
+
}, j = null, M = null, pe = 3e4, me = 5e3;
|
|
223
|
+
function he() {
|
|
224
224
|
F().catch((e) => {
|
|
225
225
|
e instanceof A && I();
|
|
226
226
|
});
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function N(e) {
|
|
229
229
|
if (j &&= (clearTimeout(j), null), M = null, !e || typeof window > "u") return;
|
|
230
230
|
let t = Date.parse(e);
|
|
231
231
|
if (Number.isNaN(t)) return;
|
|
232
232
|
M = t;
|
|
233
|
-
let n = Math.max(t - Date.now() -
|
|
233
|
+
let n = Math.max(t - Date.now() - pe, me);
|
|
234
234
|
j = setTimeout(() => {
|
|
235
|
-
j = null,
|
|
235
|
+
j = null, he();
|
|
236
236
|
}, n);
|
|
237
237
|
}
|
|
238
238
|
function ge() {
|
|
239
239
|
j &&= (clearTimeout(j), null), M = null;
|
|
240
240
|
}
|
|
241
241
|
typeof document < "u" && document.addEventListener("visibilitychange", () => {
|
|
242
|
-
document.visibilityState === "visible" && M !== null && Date.now() >= M -
|
|
242
|
+
document.visibilityState === "visible" && M !== null && Date.now() >= M - pe && he();
|
|
243
243
|
});
|
|
244
244
|
async function P(e) {
|
|
245
245
|
try {
|
|
246
246
|
let t = await e.json();
|
|
247
|
-
|
|
247
|
+
N(t?.result?.expires_at ?? t?.expires_at);
|
|
248
248
|
} catch {}
|
|
249
249
|
}
|
|
250
250
|
async function _e() {
|
|
@@ -410,7 +410,7 @@ async function K(e, t, n) {
|
|
|
410
410
|
url: i.url,
|
|
411
411
|
kind: "direct"
|
|
412
412
|
};
|
|
413
|
-
if (!i.url.startsWith(
|
|
413
|
+
if (!i.url.startsWith("/api/files/")) throw Error(`embed file proxy: refusing non-files-route URL ${JSON.stringify(i.url)}`);
|
|
414
414
|
let a = await G(t === "download" ? Ee(i.url) : i.url, n);
|
|
415
415
|
if (!a.ok) throw Error(`embed file proxy fetch failed: ${a.status} ${a.statusText}`);
|
|
416
416
|
let o = await a.blob();
|
|
@@ -764,6 +764,6 @@ function it(e) {
|
|
|
764
764
|
return e ? Array.isArray(e) ? e.filter($) : $(e) ? [e] : [] : [];
|
|
765
765
|
}
|
|
766
766
|
//#endregion
|
|
767
|
-
export { ve as A, g as B, B as C, F as D, ge as E, x as F, m as H, re as I, b as L, fe as M, C as N, L as O, S as P, oe as R, A as S, V as T, p as U, _ as V, c as W, q as _, Xe as a, De as b, Be as c, Ue as d, We as f, Je as g, Re as h, tt as i, E as j,
|
|
767
|
+
export { ve as A, g as B, B as C, F as D, ge as E, x as F, m as H, re as I, b as L, fe as M, C as N, L as O, S as P, oe as R, A as S, V as T, p as U, _ as V, c as W, q as _, Xe as a, De as b, Be as c, Ue as d, We as f, Je as g, Re as h, tt as i, E as j, N as k, He as l, Ke as m, rt as n, Qe as o, Ve as p, nt as r, Ze as s, it as t, qe as u, Me as v, Se as w, Ne as x, Q as y, h as z };
|
|
768
768
|
|
|
769
|
-
//# sourceMappingURL=value-
|
|
769
|
+
//# sourceMappingURL=value-DaEUgsnK.js.map
|