@declarion/react 0.1.79 → 0.1.80
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-CcXR8Vm6.js +281 -0
- package/dist-lib/DraggableChildrenTable-CcXR8Vm6.js.map +1 -0
- package/dist-lib/Grid-CseTLMLv.js +405 -0
- package/dist-lib/Grid-CseTLMLv.js.map +1 -0
- package/dist-lib/{JsonEditor-CWueGEgA.js → JsonEditor-Tew1oNqZ.js} +1 -1
- package/dist-lib/{JsonEditor-CWueGEgA.js.map → JsonEditor-Tew1oNqZ.js.map} +1 -1
- package/dist-lib/MarkdownRenderer-Dl3GDuY9.js +72 -0
- package/dist-lib/MarkdownRenderer-Dl3GDuY9.js.map +1 -0
- package/dist-lib/components/detail-layout/index.d.ts +0 -1
- package/dist-lib/components/fields/cells/factories/markdownToPlainText.d.ts +7 -14
- package/dist-lib/components/file-widgets/GridLazy.d.ts +2 -0
- package/dist-lib/components/file-widgets/index.d.ts +1 -1
- package/dist-lib/components/shared/Markdown.d.ts +3 -0
- package/dist-lib/components/shared/MarkdownRenderer.d.ts +11 -0
- package/dist-lib/declarion-react.css +1 -1
- package/dist-lib/hooks/useAllEntityData.d.ts +16 -0
- package/dist-lib/index.d.ts +1 -0
- package/dist-lib/index.js +7557 -14512
- package/dist-lib/index.js.map +1 -1
- package/dist-lib/lib/capabilityPrefetch.d.ts +6 -0
- package/dist-lib/rich-text-CaQ6-8Gx.js +48 -0
- package/dist-lib/rich-text-CaQ6-8Gx.js.map +1 -0
- package/dist-lib/stores/tabs.d.ts +1 -0
- package/dist-lib/useUserLocale-D9wc5kzQ.js +5723 -0
- package/dist-lib/useUserLocale-D9wc5kzQ.js.map +1 -0
- package/dist-lib/value-FIp50R1-.js +571 -0
- package/dist-lib/value-FIp50R1-.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//#region src/lib/rich-text.ts
|
|
2
|
+
var e = /declarion:\/\/file\/([0-9a-fA-F-]{36})/g;
|
|
3
|
+
function t(e) {
|
|
4
|
+
return typeof e == "string" ? e : l(e) && typeof e.markdown == "string" ? e.markdown : "";
|
|
5
|
+
}
|
|
6
|
+
function n(e, n) {
|
|
7
|
+
return {
|
|
8
|
+
markdown: t(e),
|
|
9
|
+
files: a(n)
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function r(e, t) {
|
|
13
|
+
let r = n(e, null);
|
|
14
|
+
return r.files[t.id] = t, r;
|
|
15
|
+
}
|
|
16
|
+
function i(e, t) {
|
|
17
|
+
let r = n(e, null);
|
|
18
|
+
for (let e of t) delete r.files[e];
|
|
19
|
+
return r;
|
|
20
|
+
}
|
|
21
|
+
function a(e) {
|
|
22
|
+
if (!Array.isArray(e)) return {};
|
|
23
|
+
let t = {};
|
|
24
|
+
for (let n of e) l(n) && typeof n.id == "string" && (t[n.id] = n);
|
|
25
|
+
return t;
|
|
26
|
+
}
|
|
27
|
+
function o(t) {
|
|
28
|
+
let n = /* @__PURE__ */ new Set(), r = [], i;
|
|
29
|
+
for (e.lastIndex = 0; (i = e.exec(t)) !== null;) {
|
|
30
|
+
let e = i[1];
|
|
31
|
+
n.has(e) || (n.add(e), r.push(e));
|
|
32
|
+
}
|
|
33
|
+
return r;
|
|
34
|
+
}
|
|
35
|
+
function s(e) {
|
|
36
|
+
return e ? /^declarion:\/\/file\/([0-9a-fA-F-]{36})$/.exec(e)?.[1] ?? null : null;
|
|
37
|
+
}
|
|
38
|
+
function c(e) {
|
|
39
|
+
let t = `declarion://file/${e.id}`;
|
|
40
|
+
return e.content_type.startsWith("image/") ? `` : `[${e.filename || e.id}](${t})`;
|
|
41
|
+
}
|
|
42
|
+
function l(e) {
|
|
43
|
+
return typeof e == "object" && !!e;
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { c as a, t as i, s as n, r as o, o as r, i as s, n as t };
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=rich-text-CaQ6-8Gx.js.map
|
|
@@ -0,0 +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;AAGvD,QAFI,OAAO,KAAU,WAAiB,IAClC,EAAS,EAAM,IAAI,OAAO,EAAM,YAAa,WAAiB,EAAM,WACjE;;AAcT,SAAgB,EAAoB,GAAwB,GAA0C;AACpG,QAAO;EACL,UAAU,EAAiB,EAAc;EACzC,OAAO,EAAgB,EAAiB;EACzC;;AAGH,SAAgB,EAAiB,GAAgB,GAAmC;CAClF,IAAM,IAAO,EAAoB,GAAO,KAAK;AAE7C,QADA,EAAK,MAAM,EAAK,MAAM,GACf;;AAGT,SAAgB,EAAqB,GAAgB,GAA6C;CAChG,IAAM,IAAO,EAAoB,GAAO,KAAK;AAC7C,MAAK,IAAM,KAAU,EAAY,QAAO,EAAK,MAAM;AACnD,QAAO;;AAGT,SAAgB,EAAgB,GAA8C;AAC5E,KAAI,CAAC,MAAM,QAAQ,EAAM,CAAE,QAAO,EAAE;CACpC,IAAM,IAAsC,EAAE;AAC9C,MAAK,IAAM,KAAQ,EACjB,CAAI,EAAS,EAAK,IAAI,OAAO,EAAK,MAAO,aACvC,EAAM,EAAK,MAAM;AAGrB,QAAO;;AAGT,SAAgB,EAAwB,GAA4B;CAClE,IAAM,oBAAO,IAAI,KAAa,EACxB,IAAgB,EAAE,EACpB;AAEJ,MADA,EAAqB,YAAY,IACzB,IAAQ,EAAqB,KAAK,EAAS,MAAM,OAAM;EAC7D,IAAM,IAAS,EAAM;AACjB,IAAK,IAAI,EAAO,KACpB,EAAK,IAAI,EAAO,EAChB,EAAI,KAAK,EAAO;;AAElB,QAAO;;AAGT,SAAgB,EAAuB,GAAwC;AAG7E,QAFK,IACS,2CAA2C,KAAK,EAAI,GACnD,MAAM,OAFJ;;AAKnB,SAAgB,EAAqB,GAAsE;CACzG,IAAM,IAAM,oBAAoB,EAAK;AAGrC,QAFI,EAAK,aAAa,WAAW,SAAS,GAAS,OAAO,EAAI,KAEvD,IADO,EAAK,YAAY,EAAK,GACnB,IAAI,EAAI;;AAG3B,SAAS,EAAS,GAAkD;AAClE,QAAO,OAAO,KAAU,cAAY"}
|
|
@@ -30,5 +30,6 @@ interface TabState {
|
|
|
30
30
|
setScope: (tenantId: string | null, userId: string | null) => void;
|
|
31
31
|
hydrate: () => void;
|
|
32
32
|
}
|
|
33
|
+
export declare function peekTenantLandingPath(tenantId: string, userId: string): string | null;
|
|
33
34
|
export declare const useTabStore: import("zustand").UseBoundStore<import("zustand").StoreApi<TabState>>;
|
|
34
35
|
export {};
|