@declarion/react 0.1.85 → 0.1.88
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-CVdCUPGE.js → DraggableChildrenTable-BvQY_1ew.js} +2 -2
- package/dist-lib/{DraggableChildrenTable-CVdCUPGE.js.map → DraggableChildrenTable-BvQY_1ew.js.map} +1 -1
- package/dist-lib/{Grid-By_Ere-W.js → Grid-BJAiAeHo.js} +2 -2
- package/dist-lib/{Grid-By_Ere-W.js.map → Grid-BJAiAeHo.js.map} +1 -1
- package/dist-lib/JsonEditor-CexL5HXN.js.map +1 -1
- package/dist-lib/MarkdownRenderer-Dl3GDuY9.js.map +1 -1
- package/dist-lib/components/shared/ActionRunner.d.ts +8 -1
- package/dist-lib/components/shared/ResponsiveActionBar.d.ts +8 -1
- package/dist-lib/declarion-react.css +2 -2
- package/dist-lib/index.js +9049 -8914
- package/dist-lib/index.js.map +1 -1
- package/dist-lib/lib/children-validation.d.ts +1 -0
- package/dist-lib/lib/toast.d.ts +16 -0
- package/dist-lib/rich-text-CaQ6-8Gx.js.map +1 -1
- package/dist-lib/types/schema.d.ts +1 -0
- package/dist-lib/{useUserLocale-B3bnZHMZ.js → useUserLocale-C7cAecf5.js} +4 -3
- package/dist-lib/useUserLocale-C7cAecf5.js.map +1 -0
- package/dist-lib/{value-DgzPSFZM.js → value-Bhy_PJo2.js} +123 -112
- package/dist-lib/value-Bhy_PJo2.js.map +1 -0
- package/dist-lib/vite/index.js.map +1 -1
- package/package.json +31 -31
- package/dist-lib/useUserLocale-B3bnZHMZ.js.map +0 -1
- package/dist-lib/value-DgzPSFZM.js.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Entity, Schema } from "../types/schema";
|
|
2
2
|
import type { PendingChildRow } from "../components/detail-layout/LayoutRenderer";
|
|
3
3
|
export declare function findMissingRequiredFields(entity: Entity, formData: Record<string, unknown>, isNew: boolean): string[];
|
|
4
|
+
export declare function findInvalidEmailFields(entity: Entity, formData: Record<string, unknown>): string[];
|
|
4
5
|
export declare function validatePendingChildren(pendingChildren: Record<string, PendingChildRow[]> | undefined, schema: Schema | undefined): Record<string, Record<string, string[]>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared toast configuration constants.
|
|
3
|
+
*
|
|
4
|
+
* The toaster is mounted once in `app.tsx` (sonner `<Toaster>` with
|
|
5
|
+
* `closeButton` + `visibleToasts={5}`). Every toast emitter - the central
|
|
6
|
+
* `ActionRunner` and the handful of direct `toast.error` callsites in
|
|
7
|
+
* `useMutations`, `useVersionWatcher`, and form gates in `SmartDetailPage` -
|
|
8
|
+
* MUST import this constant rather than hardcoding `Infinity` (which
|
|
9
|
+
* piles toasts up indefinitely and overwhelms the surface).
|
|
10
|
+
*
|
|
11
|
+
* 60s is the chosen balance: well past human read time, short enough that
|
|
12
|
+
* walking away does not produce a stale wall of red on return. `closeButton`
|
|
13
|
+
* on the Toaster and the in-description Copy button cover the explicit
|
|
14
|
+
* read-and-keep flow for users who need longer than 60s.
|
|
15
|
+
*/
|
|
16
|
+
export declare const ERROR_TOAST_DURATION_MS = 60000;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rich-text-CaQ6-8Gx.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,IAAuB;AAE7B,SAAgB,EAAiB,GAAwB;
|
|
1
|
+
{"version":3,"file":"rich-text-CaQ6-8Gx.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,IAAuB;AAE7B,SAAgB,EAAiB,GAAwB;CAGvD,OAFI,OAAO,KAAU,WAAiB,IAClC,EAAS,CAAK,KAAK,OAAO,EAAM,YAAa,WAAiB,EAAM,WACjE;AACT;AAaA,SAAgB,EAAoB,GAAwB,GAA0C;CACpG,OAAO;EACL,UAAU,EAAiB,CAAa;EACxC,OAAO,EAAgB,CAAgB;CACzC;AACF;AAEA,SAAgB,EAAiB,GAAgB,GAAmC;CAClF,IAAM,IAAO,EAAoB,GAAO,IAAI;CAE5C,OADA,EAAK,MAAM,EAAK,MAAM,GACf;AACT;AAEA,SAAgB,EAAqB,GAAgB,GAA6C;CAChG,IAAM,IAAO,EAAoB,GAAO,IAAI;CAC5C,KAAK,IAAM,KAAU,GAAY,OAAO,EAAK,MAAM;CACnD,OAAO;AACT;AAEA,SAAgB,EAAgB,GAA8C;CAC5E,IAAI,CAAC,MAAM,QAAQ,CAAK,GAAG,OAAO,CAAC;CACnC,IAAM,IAAsC,CAAC;CAC7C,KAAK,IAAM,KAAQ,GACjB,AAAI,EAAS,CAAI,KAAK,OAAO,EAAK,MAAO,aACvC,EAAM,EAAK,MAAM;CAGrB,OAAO;AACT;AAEA,SAAgB,EAAwB,GAA4B;CAClE,IAAM,oBAAO,IAAI,IAAY,GACvB,IAAgB,CAAC,GACnB;CAEJ,KADA,EAAqB,YAAY,IACzB,IAAQ,EAAqB,KAAK,CAAQ,OAAO,OAAM;EAC7D,IAAM,IAAS,EAAM;EACjB,EAAK,IAAI,CAAM,MACnB,EAAK,IAAI,CAAM,GACf,EAAI,KAAK,CAAM;CACjB;CACA,OAAO;AACT;AAEA,SAAgB,EAAuB,GAAwC;CAG7E,OAFK,IACS,2CAA2C,KAAK,CACvD,IAAQ,MAAM,OAFJ;AAGnB;AAEA,SAAgB,EAAqB,GAAsE;CACzG,IAAM,IAAM,oBAAoB,EAAK;CAGrC,OAFI,EAAK,aAAa,WAAW,QAAQ,IAAU,OAAO,EAAI,KAEvD,IADO,EAAK,YAAY,EAAK,GACnB,IAAI,EAAI;AAC3B;AAEA,SAAS,EAAS,GAAkD;CAClE,OAAO,OAAO,KAAU,cAAY;AACtC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as e, _ as t, b as n, c as r, d as i, f as a, g as o, h as s, i as c, k as l, l as u, m as d, n as f, o as p, p as m, s as h, t as g, u as _, v as ee, x as v } from "./value-
|
|
1
|
+
import { S as e, _ as t, b as n, c as r, d as i, f as a, g as o, h as s, i as c, k as l, l as u, m as d, n as f, o as p, p as m, s as h, t as g, u as _, v as ee, x as v } from "./value-Bhy_PJo2.js";
|
|
2
2
|
import { a as y, i as b, o as x, r as S, s as C, t as w } from "./rich-text-CaQ6-8Gx.js";
|
|
3
3
|
import { Suspense as T, forwardRef as E, lazy as D, useCallback as O, useEffect as k, useLayoutEffect as A, useMemo as j, useRef as M, useState as N } from "react";
|
|
4
4
|
import { useQuery as P } from "@tanstack/react-query";
|
|
@@ -1324,6 +1324,7 @@ var xe = ({ children: e, required: t, hint: n }) => /* @__PURE__ */ L("div", {
|
|
|
1324
1324
|
children: [
|
|
1325
1325
|
/* @__PURE__ */ I("span", { children: e }),
|
|
1326
1326
|
t && /* @__PURE__ */ I("span", {
|
|
1327
|
+
"aria-hidden": "true",
|
|
1327
1328
|
style: { color: "var(--danger)" },
|
|
1328
1329
|
children: "*"
|
|
1329
1330
|
}),
|
|
@@ -3956,7 +3957,7 @@ function gr(e) {
|
|
|
3956
3957
|
}
|
|
3957
3958
|
//#endregion
|
|
3958
3959
|
//#region src/components/file-widgets/GridLazy.tsx
|
|
3959
|
-
var _r = D(() => import("./Grid-
|
|
3960
|
+
var _r = D(() => import("./Grid-BJAiAeHo.js").then((e) => ({ default: e.Grid })));
|
|
3960
3961
|
function vr() {
|
|
3961
3962
|
return /* @__PURE__ */ I("div", { className: "h-24 w-full rounded-md bg-muted animate-pulse" });
|
|
3962
3963
|
}
|
|
@@ -5854,4 +5855,4 @@ function Va() {
|
|
|
5854
5855
|
//#endregion
|
|
5855
5856
|
export { ft as $, en as A, be as At, xt as B, ie as Bt, gn as C, Pe as Ct, Yt as D, Ce as Dt, rn as E, Ae as Et, Xt as F, he as Ft, vt as G, K as Gt, yt as H, re as Ht, Gt as I, fe as It, mt as J, gt as K, G as Kt, Vt as L, Z as Lt, qt as M, ve as Mt, on as N, _e as Nt, Zt as O, Q as Ot, $t as P, ge as Pt, ht as Q, Ht as R, de as Rt, _n as S, ke as St, tn as T, we as Tt, st as U, J as Ut, bt as V, Y as Vt, ut as W, q as Wt, ct as X, dt as Y, lt as Z, er as _, Ve as _t, Kr as a, Ke as at, An as b, xe as bt, Lr as c, Ge as ct, gr as d, qe as dt, Ie as et, hr as f, Xe as ft, $n as g, Ze as gt, rr as h, Ue as ht, Gr as i, We as it, Jt as j, ye as jt, an as k, Ne as kt, Ir as l, tt as lt, ir as m, Je as mt, Ra as n, $e as nt, Mr as o, He as ot, mr as p, Ye as pt, _t as q, ne as qt, Ia as r, et as rt, Pr as s, Le as st, Va as t, Qe as tt, Fr as u, $ as ut, Qn as v, Fe as vt, cn as w, Me as wt, kn as x, je as xt, jn as y, Te as yt, Bt as z, ae as zt };
|
|
5856
5857
|
|
|
5857
|
-
//# sourceMappingURL=useUserLocale-
|
|
5858
|
+
//# sourceMappingURL=useUserLocale-C7cAecf5.js.map
|