@ixo/editor 3.0.0-beta.13 → 3.0.0-beta.14
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/{capabilityValidation-BrYCMvBB.d.ts → capabilityValidation-3AU8LEIv.d.ts} +1 -1
- package/dist/{chunk-255WVXBP.mjs → chunk-3AD37CJI.mjs} +989 -428
- package/dist/chunk-3AD37CJI.mjs.map +1 -0
- package/dist/{chunk-MVIGR7ZU.mjs → chunk-VITMEP3T.mjs} +55 -1
- package/dist/chunk-VITMEP3T.mjs.map +1 -0
- package/dist/chunk-VU34HOXM.mjs +36 -0
- package/dist/chunk-VU34HOXM.mjs.map +1 -0
- package/dist/cid-6O646X2I.mjs +9 -0
- package/dist/cid-6O646X2I.mjs.map +1 -0
- package/dist/core/index.d.ts +27 -3
- package/dist/core/index.mjs +7 -1
- package/dist/{graphql-client-DSJ3fRVn.d.ts → graphql-client-BKg1meMM.d.ts} +14 -1
- package/dist/{index-BE746hd_.d.ts → index-DkIk9-yx.d.ts} +2 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +2 -2
- package/dist/mantine/index.d.ts +9 -5
- package/dist/mantine/index.mjs +4 -2
- package/package.json +4 -1
- package/dist/chunk-255WVXBP.mjs.map +0 -1
- package/dist/chunk-MVIGR7ZU.mjs.map +0 -1
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
isActorAuthorized,
|
|
17
17
|
parseLinkedEntities,
|
|
18
18
|
transformSurveyToCredentialSubject
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-VITMEP3T.mjs";
|
|
20
20
|
|
|
21
21
|
// src/mantine/hooks/useCreateIxoEditor.ts
|
|
22
22
|
import { useCreateBlockNote } from "@blocknote/react";
|
|
@@ -6794,12 +6794,7 @@ import { Stack as Stack47, Text as Text47, Center as Center4, Loader as Loader10
|
|
|
6794
6794
|
|
|
6795
6795
|
// src/mantine/hooks/useBlockAuthorization.ts
|
|
6796
6796
|
import { useState as useState23, useEffect as useEffect22, useMemo as useMemo25 } from "react";
|
|
6797
|
-
function useBlockAuthorization({
|
|
6798
|
-
editor,
|
|
6799
|
-
flowNode,
|
|
6800
|
-
actorDid,
|
|
6801
|
-
flowUri
|
|
6802
|
-
}) {
|
|
6797
|
+
function useBlockAuthorization({ editor, flowNode, actorDid, flowUri }) {
|
|
6803
6798
|
const handlers = useBlocknoteHandlers();
|
|
6804
6799
|
const [result, setResult] = useState23({ authorized: true });
|
|
6805
6800
|
const [loading, setLoading] = useState23(true);
|
|
@@ -14872,10 +14867,7 @@ var ResponseSchemaTab = ({ schema, onSchemaChange, blockId }) => {
|
|
|
14872
14867
|
// src/mantine/components/EvaluationTab.tsx
|
|
14873
14868
|
import React147, { useMemo as useMemo46, useState as useState58, useEffect as useEffect46, useCallback as useCallback38 } from "react";
|
|
14874
14869
|
import { Stack as Stack110, TextInput as TextInput6, Text as Text86 } from "@mantine/core";
|
|
14875
|
-
var EvaluationTab = ({
|
|
14876
|
-
editor,
|
|
14877
|
-
block: initialBlock
|
|
14878
|
-
}) => {
|
|
14870
|
+
var EvaluationTab = ({ editor, block: initialBlock }) => {
|
|
14879
14871
|
const [, forceUpdate] = useState58({});
|
|
14880
14872
|
const block = useMemo46(() => {
|
|
14881
14873
|
const doc = editor?.document || [];
|
|
@@ -23106,6 +23098,20 @@ var DraggableLinkCard = ({ link, index, onRemove, onUpdate }) => {
|
|
|
23106
23098
|
},
|
|
23107
23099
|
description: "HTTP link to the target flow or page"
|
|
23108
23100
|
}
|
|
23101
|
+
), /* @__PURE__ */ React230.createElement(
|
|
23102
|
+
BaseTextInput,
|
|
23103
|
+
{
|
|
23104
|
+
label: "External URL",
|
|
23105
|
+
placeholder: "https://example.com",
|
|
23106
|
+
value: link.externalUrl || "",
|
|
23107
|
+
onChange: (e) => {
|
|
23108
|
+
const val = e.currentTarget.value;
|
|
23109
|
+
onUpdate(link.id, {
|
|
23110
|
+
externalUrl: val
|
|
23111
|
+
});
|
|
23112
|
+
},
|
|
23113
|
+
description: "Opens in a new tab instead of internal navigation."
|
|
23114
|
+
}
|
|
23109
23115
|
), /* @__PURE__ */ React230.createElement(
|
|
23110
23116
|
BaseTextArea,
|
|
23111
23117
|
{
|
|
@@ -23218,6 +23224,9 @@ var FlowLinkPanel = ({ editor, block }) => {
|
|
|
23218
23224
|
setLinksWithStatus((prev) => prev.map((link) => ({ ...link, isLoading: true, error: void 0 })));
|
|
23219
23225
|
const updatedLinks = await Promise.all(
|
|
23220
23226
|
links.map(async (link) => {
|
|
23227
|
+
if (link.externalUrl) {
|
|
23228
|
+
return { ...link, isLoading: false };
|
|
23229
|
+
}
|
|
23221
23230
|
try {
|
|
23222
23231
|
const statusData = await handlers.getFlowStatus(link.url);
|
|
23223
23232
|
return { ...link, statusData, isLoading: false };
|
|
@@ -23232,6 +23241,10 @@ var FlowLinkPanel = ({ editor, block }) => {
|
|
|
23232
23241
|
fetchStatuses();
|
|
23233
23242
|
}, []);
|
|
23234
23243
|
const handleNavigate = (link) => {
|
|
23244
|
+
if (link.externalUrl) {
|
|
23245
|
+
window.open(link.externalUrl, "_blank", "noopener,noreferrer");
|
|
23246
|
+
return;
|
|
23247
|
+
}
|
|
23235
23248
|
if (handlers.navigateToFlow && link.url) {
|
|
23236
23249
|
handlers.navigateToFlow(link.url);
|
|
23237
23250
|
}
|
|
@@ -23261,9 +23274,13 @@ var FlowLinkPanel = ({ editor, block }) => {
|
|
|
23261
23274
|
BaseContainer,
|
|
23262
23275
|
{
|
|
23263
23276
|
onClick: () => handleNavigate(link),
|
|
23264
|
-
style: {
|
|
23277
|
+
style: {
|
|
23278
|
+
opacity: link.externalUrl || handlers.navigateToFlow && link.url ? 1 : 0.6,
|
|
23279
|
+
minHeight: 84,
|
|
23280
|
+
cursor: link.externalUrl || handlers.navigateToFlow && link.url ? "pointer" : "not-allowed"
|
|
23281
|
+
}
|
|
23265
23282
|
},
|
|
23266
|
-
/* @__PURE__ */ React233.createElement(Group83, { wrap: "nowrap", align: "center", style: { flex: 1 } }, getIcon("external-link", block.props.icon), /* @__PURE__ */ React233.createElement(Stack152, { gap: 4, style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React233.createElement(Group83, { gap: "xs", align: "center" }, /* @__PURE__ */ React233.createElement(Text129, { size: "sm", fw: 600 }, link.title || "Untitled Flow"), getStatusBadge(link)), link.captionText && /* @__PURE__ */ React233.createElement(Text129, { size: "sm", c: "dimmed", lineClamp: 2 }, link.captionText)), link.statusData?.completedAt && /* @__PURE__ */ React233.createElement(Text129, { size: "sm", c: "dimmed" }, "Completed: ", new Date(link.statusData.completedAt).toLocaleDateString()))
|
|
23283
|
+
/* @__PURE__ */ React233.createElement(Group83, { wrap: "nowrap", align: "center", style: { flex: 1 } }, getIcon("external-link", block.props.icon), /* @__PURE__ */ React233.createElement(Stack152, { gap: 4, style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React233.createElement(Group83, { gap: "xs", align: "center" }, /* @__PURE__ */ React233.createElement(Text129, { size: "sm", fw: 600 }, link.title || (link.externalUrl ? "External Link" : "Untitled Flow")), link.externalUrl && /* @__PURE__ */ React233.createElement(Badge37, { size: "xs", variant: "light", color: "teal" }, "External"), !link.externalUrl && getStatusBadge(link)), link.captionText && /* @__PURE__ */ React233.createElement(Text129, { size: "sm", c: "dimmed", lineClamp: 2 }, link.captionText)), link.statusData?.completedAt && /* @__PURE__ */ React233.createElement(Text129, { size: "sm", c: "dimmed" }, "Completed: ", new Date(link.statusData.completedAt).toLocaleDateString()))
|
|
23267
23284
|
))))));
|
|
23268
23285
|
};
|
|
23269
23286
|
|
|
@@ -23359,11 +23376,11 @@ var FlowLinkBlockSpec = createReactBlockSpec20(
|
|
|
23359
23376
|
);
|
|
23360
23377
|
|
|
23361
23378
|
// src/mantine/blocks/action/ActionBlockSpec.tsx
|
|
23362
|
-
import
|
|
23379
|
+
import React268 from "react";
|
|
23363
23380
|
import { createReactBlockSpec as createReactBlockSpec21 } from "@blocknote/react";
|
|
23364
23381
|
|
|
23365
23382
|
// src/mantine/blocks/action/ActionBlock.tsx
|
|
23366
|
-
import
|
|
23383
|
+
import React267 from "react";
|
|
23367
23384
|
|
|
23368
23385
|
// src/mantine/blocks/action/template/TemplateView.tsx
|
|
23369
23386
|
import React240, { useMemo as useMemo88 } from "react";
|
|
@@ -23371,7 +23388,7 @@ import React240, { useMemo as useMemo88 } from "react";
|
|
|
23371
23388
|
// src/mantine/blocks/action/template/TemplateConfig.tsx
|
|
23372
23389
|
import React239, { useCallback as useCallback72, useMemo as useMemo87 } from "react";
|
|
23373
23390
|
import { Stack as Stack156 } from "@mantine/core";
|
|
23374
|
-
import { IconCheck as IconCheck15, IconContract as IconContract5, IconSettings as IconSettings19, IconShieldCheck as
|
|
23391
|
+
import { IconCheck as IconCheck15, IconContract as IconContract5, IconSettings as IconSettings19, IconShieldCheck as IconShieldCheck14, IconUserCheck as IconUserCheck4 } from "@tabler/icons-react";
|
|
23375
23392
|
|
|
23376
23393
|
// src/mantine/blocks/action/template/GeneralTab.tsx
|
|
23377
23394
|
import React238, { useEffect as useEffect73, useMemo as useMemo86, useState as useState88 } from "react";
|
|
@@ -23393,7 +23410,8 @@ import {
|
|
|
23393
23410
|
IconChecks as IconChecks4,
|
|
23394
23411
|
IconThumbUp as IconThumbUp2,
|
|
23395
23412
|
IconSignature as IconSignature3,
|
|
23396
|
-
IconBuildingEstate
|
|
23413
|
+
IconBuildingEstate,
|
|
23414
|
+
IconShieldCheck as IconShieldCheck13
|
|
23397
23415
|
} from "@tabler/icons-react";
|
|
23398
23416
|
|
|
23399
23417
|
// src/mantine/components/Base/BaseIconCombobox.tsx
|
|
@@ -23544,6 +23562,11 @@ var ACTION_TYPE_META = {
|
|
|
23544
23562
|
label: "Create Domain",
|
|
23545
23563
|
description: "Create a new domain entity on-chain",
|
|
23546
23564
|
icon: icon(IconBuildingEstate, COMBO_ICON_SIZE)
|
|
23565
|
+
},
|
|
23566
|
+
"credential.store": {
|
|
23567
|
+
label: "Store Credential",
|
|
23568
|
+
description: "Store a verifiable credential in Matrix room state",
|
|
23569
|
+
icon: icon(IconShieldCheck13, COMBO_ICON_SIZE)
|
|
23547
23570
|
}
|
|
23548
23571
|
};
|
|
23549
23572
|
function getActionMeta(actionType) {
|
|
@@ -23735,7 +23758,7 @@ var TemplateConfig17 = ({ editor, block }) => {
|
|
|
23735
23758
|
{
|
|
23736
23759
|
label: "Authorization",
|
|
23737
23760
|
value: "authorization",
|
|
23738
|
-
icon: icon(
|
|
23761
|
+
icon: icon(IconShieldCheck14),
|
|
23739
23762
|
content: /* @__PURE__ */ React239.createElement(AuthorizationTab, { editor, block })
|
|
23740
23763
|
},
|
|
23741
23764
|
{
|
|
@@ -28167,12 +28190,530 @@ registerActionTypeUI("domain.create", {
|
|
|
28167
28190
|
flowDetailComponent: DomainCreateFlowDetail
|
|
28168
28191
|
});
|
|
28169
28192
|
|
|
28193
|
+
// src/mantine/blocks/action/actionTypes/formSubmit/FormSubmitConfig.tsx
|
|
28194
|
+
import React263, { useCallback as useCallback92, useEffect as useEffect92, useState as useState111 } from "react";
|
|
28195
|
+
import { Stack as Stack180, Text as Text153 } from "@mantine/core";
|
|
28196
|
+
|
|
28197
|
+
// src/mantine/blocks/action/actionTypes/formSubmit/types.ts
|
|
28198
|
+
function parseFormSubmitActionInputs(json) {
|
|
28199
|
+
try {
|
|
28200
|
+
const parsed = typeof json === "string" ? JSON.parse(json) : json;
|
|
28201
|
+
const rawSchema = parsed?.surveySchema;
|
|
28202
|
+
if (typeof rawSchema === "string") {
|
|
28203
|
+
return { surveySchema: rawSchema };
|
|
28204
|
+
}
|
|
28205
|
+
if (rawSchema && typeof rawSchema === "object" && !Array.isArray(rawSchema)) {
|
|
28206
|
+
return { surveySchema: JSON.stringify(rawSchema, null, 2) };
|
|
28207
|
+
}
|
|
28208
|
+
return { surveySchema: "" };
|
|
28209
|
+
} catch {
|
|
28210
|
+
return { surveySchema: "" };
|
|
28211
|
+
}
|
|
28212
|
+
}
|
|
28213
|
+
function serializeFormSubmitActionInputs(inputs) {
|
|
28214
|
+
return JSON.stringify({
|
|
28215
|
+
surveySchema: inputs.surveySchema
|
|
28216
|
+
});
|
|
28217
|
+
}
|
|
28218
|
+
|
|
28219
|
+
// src/mantine/blocks/action/actionTypes/formSubmit/FormSubmitConfig.tsx
|
|
28220
|
+
function isValidSchemaJson(value) {
|
|
28221
|
+
try {
|
|
28222
|
+
const parsed = JSON.parse(value);
|
|
28223
|
+
return !!parsed && typeof parsed === "object" && !Array.isArray(parsed);
|
|
28224
|
+
} catch {
|
|
28225
|
+
return false;
|
|
28226
|
+
}
|
|
28227
|
+
}
|
|
28228
|
+
var FormSubmitConfig = ({ inputs, onInputsChange }) => {
|
|
28229
|
+
const [localSchema, setLocalSchema] = useState111(() => parseFormSubmitActionInputs(inputs).surveySchema);
|
|
28230
|
+
const [error, setError] = useState111(null);
|
|
28231
|
+
useEffect92(() => {
|
|
28232
|
+
setLocalSchema(parseFormSubmitActionInputs(inputs).surveySchema);
|
|
28233
|
+
setError(null);
|
|
28234
|
+
}, [inputs]);
|
|
28235
|
+
const handleChange = useCallback92(
|
|
28236
|
+
(value) => {
|
|
28237
|
+
setLocalSchema(value);
|
|
28238
|
+
setError(null);
|
|
28239
|
+
if (!value.trim()) {
|
|
28240
|
+
onInputsChange(serializeFormSubmitActionInputs({ surveySchema: "" }));
|
|
28241
|
+
return;
|
|
28242
|
+
}
|
|
28243
|
+
if (!isValidSchemaJson(value)) {
|
|
28244
|
+
setError("Survey schema must be a valid JSON object");
|
|
28245
|
+
return;
|
|
28246
|
+
}
|
|
28247
|
+
onInputsChange(serializeFormSubmitActionInputs({ surveySchema: value }));
|
|
28248
|
+
},
|
|
28249
|
+
[onInputsChange]
|
|
28250
|
+
);
|
|
28251
|
+
return /* @__PURE__ */ React263.createElement(Stack180, { gap: "xs" }, /* @__PURE__ */ React263.createElement(
|
|
28252
|
+
BaseTextArea,
|
|
28253
|
+
{
|
|
28254
|
+
label: "Survey Schema (JSON)",
|
|
28255
|
+
description: "Paste the SurveyJS schema JSON that should be rendered in flow mode.",
|
|
28256
|
+
placeholder: '{"elements":[{"type":"text","name":"name","title":"Your name"}]}',
|
|
28257
|
+
minRows: 10,
|
|
28258
|
+
value: localSchema,
|
|
28259
|
+
onChange: (event) => handleChange(event.currentTarget.value),
|
|
28260
|
+
error
|
|
28261
|
+
}
|
|
28262
|
+
), localSchema && !error && /* @__PURE__ */ React263.createElement(Text153, { size: "xs", c: "green" }, "\u2713 Valid JSON object"));
|
|
28263
|
+
};
|
|
28264
|
+
|
|
28265
|
+
// src/mantine/blocks/action/actionTypes/formSubmit/FormSubmitFlowDetail.tsx
|
|
28266
|
+
import React264, { useCallback as useCallback93, useEffect as useEffect93, useMemo as useMemo106, useState as useState112 } from "react";
|
|
28267
|
+
import { Alert as Alert49, Loader as Loader50, Stack as Stack181, Text as Text154 } from "@mantine/core";
|
|
28268
|
+
import { Survey as Survey13, SurveyModel as SurveyModel13 } from "@ixo/surveys";
|
|
28269
|
+
function parsePrimarySkill(rawSkill) {
|
|
28270
|
+
const coerce = (candidate) => {
|
|
28271
|
+
if (!candidate || typeof candidate !== "object") return null;
|
|
28272
|
+
const cid = String(candidate.cid || "").trim();
|
|
28273
|
+
const name = String(candidate.name || "").trim();
|
|
28274
|
+
if (!cid) return null;
|
|
28275
|
+
return name ? { cid, name } : { cid };
|
|
28276
|
+
};
|
|
28277
|
+
if (!rawSkill) return null;
|
|
28278
|
+
if (typeof rawSkill === "object") {
|
|
28279
|
+
if (Array.isArray(rawSkill)) {
|
|
28280
|
+
for (const entry of rawSkill) {
|
|
28281
|
+
const skill = coerce(entry);
|
|
28282
|
+
if (skill) return skill;
|
|
28283
|
+
}
|
|
28284
|
+
return null;
|
|
28285
|
+
}
|
|
28286
|
+
return coerce(rawSkill);
|
|
28287
|
+
}
|
|
28288
|
+
if (typeof rawSkill === "string") {
|
|
28289
|
+
const trimmed = rawSkill.trim();
|
|
28290
|
+
if (!trimmed) return null;
|
|
28291
|
+
try {
|
|
28292
|
+
const parsed = JSON.parse(trimmed);
|
|
28293
|
+
return parsePrimarySkill(parsed);
|
|
28294
|
+
} catch {
|
|
28295
|
+
return null;
|
|
28296
|
+
}
|
|
28297
|
+
}
|
|
28298
|
+
return null;
|
|
28299
|
+
}
|
|
28300
|
+
function buildCompanionPrompt(params) {
|
|
28301
|
+
const answersJson = JSON.stringify(params.answers || {}, null, 2);
|
|
28302
|
+
return [
|
|
28303
|
+
"Use the skill with this form context.",
|
|
28304
|
+
"IMPORTANT: First read the flow context and settings \u2014 the flow may contain parameters required by the skill. Also review all blocks in the flow to understand the basic workflow before executing.",
|
|
28305
|
+
`Skill name: ${params.skill.name || "(not provided)"}`,
|
|
28306
|
+
`Skill CID: ${params.skill.cid}`,
|
|
28307
|
+
`Action block title: ${params.blockTitle || "Form Submit Action"}`,
|
|
28308
|
+
`Action block description: ${params.blockDescription || "Complete the form to execute this action."}`,
|
|
28309
|
+
`Form answers JSON:
|
|
28310
|
+
${answersJson}`
|
|
28311
|
+
].join("\n");
|
|
28312
|
+
}
|
|
28313
|
+
var FormSubmitFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabled }) => {
|
|
28314
|
+
const handlers = useBlocknoteHandlers();
|
|
28315
|
+
const services = useMemo106(() => buildServicesFromHandlers(handlers), [handlers]);
|
|
28316
|
+
const flowNode = useMemo106(() => buildFlowNodeFromBlock(block), [block]);
|
|
28317
|
+
const runtimeManager = useMemo106(() => createRuntimeStateManager(editor), [editor]);
|
|
28318
|
+
const ucanManager = useMemo106(() => new SimpleUCANManager(), []);
|
|
28319
|
+
const delegationStore = useMemo106(() => {
|
|
28320
|
+
if (!editor?._yDelegations) return void 0;
|
|
28321
|
+
return createDelegationStore(editor._yDelegations);
|
|
28322
|
+
}, [editor?._yDelegations]);
|
|
28323
|
+
const verifySignature = useMemo106(() => {
|
|
28324
|
+
if (!handlers?.verifyCapabilitySignature) return void 0;
|
|
28325
|
+
return async (capabilityRaw, issuerDid) => handlers.verifyCapabilitySignature({ capabilityRaw, issuerDid });
|
|
28326
|
+
}, [handlers]);
|
|
28327
|
+
const flowOwnerDid = useMemo106(() => editor?.getFlowOwnerDid?.() || "", [editor]);
|
|
28328
|
+
const flowUri = useMemo106(() => {
|
|
28329
|
+
const docId = editor?.getFlowMetadata?.()?.doc_id || block.id;
|
|
28330
|
+
return `ixo:flow:${docId}`;
|
|
28331
|
+
}, [editor, block.id]);
|
|
28332
|
+
const actorDid = useMemo106(() => {
|
|
28333
|
+
try {
|
|
28334
|
+
return handlers?.getCurrentUser?.()?.address || "";
|
|
28335
|
+
} catch {
|
|
28336
|
+
return "";
|
|
28337
|
+
}
|
|
28338
|
+
}, [handlers]);
|
|
28339
|
+
const parsed = useMemo106(() => parseFormSubmitActionInputs(inputs), [inputs]);
|
|
28340
|
+
const editorDocument = editor?.document || [];
|
|
28341
|
+
const resolveOpts = useMemo106(() => ({ yRuntime: editor?._yRuntime }), [editor?._yRuntime]);
|
|
28342
|
+
const resolvedSchemaString = useMemo106(() => resolveReferences(parsed.surveySchema || "", editorDocument, resolveOpts).trim(), [parsed.surveySchema, editorDocument, resolveOpts]);
|
|
28343
|
+
const [submitting, setSubmitting] = useState112(false);
|
|
28344
|
+
const [error, setError] = useState112(null);
|
|
28345
|
+
const parsedSchema = useMemo106(() => {
|
|
28346
|
+
if (!resolvedSchemaString) return null;
|
|
28347
|
+
try {
|
|
28348
|
+
const schema = JSON.parse(resolvedSchemaString);
|
|
28349
|
+
if (!schema || typeof schema !== "object" || Array.isArray(schema)) return null;
|
|
28350
|
+
return schema;
|
|
28351
|
+
} catch {
|
|
28352
|
+
return null;
|
|
28353
|
+
}
|
|
28354
|
+
}, [resolvedSchemaString]);
|
|
28355
|
+
const isCompleted = runtime.state === "completed";
|
|
28356
|
+
const savedAnswers = isCompleted && runtime.output?.answers && typeof runtime.output.answers === "object" ? runtime.output.answers : null;
|
|
28357
|
+
const surveyModel = useMemo106(() => {
|
|
28358
|
+
if (!parsedSchema) return null;
|
|
28359
|
+
const model = new SurveyModel13(parsedSchema);
|
|
28360
|
+
model.applyTheme(surveyTheme);
|
|
28361
|
+
model.showQuestionNumbers = "off";
|
|
28362
|
+
model.questionsOnPageMode = "singlePage";
|
|
28363
|
+
model.completeText = "Execute";
|
|
28364
|
+
if (savedAnswers) {
|
|
28365
|
+
model.data = savedAnswers;
|
|
28366
|
+
model.mode = "display";
|
|
28367
|
+
model.showCompleteButton = false;
|
|
28368
|
+
} else if (isDisabled || submitting) {
|
|
28369
|
+
model.mode = "display";
|
|
28370
|
+
model.showCompleteButton = false;
|
|
28371
|
+
}
|
|
28372
|
+
return model;
|
|
28373
|
+
}, [parsedSchema, isDisabled, submitting, savedAnswers]);
|
|
28374
|
+
const handleSurveyComplete = useCallback93(
|
|
28375
|
+
async (sender) => {
|
|
28376
|
+
if (isDisabled || submitting) return;
|
|
28377
|
+
const actionType = String(block?.props?.actionType || "form.submit");
|
|
28378
|
+
const actionDef = getAction(actionType) || getAction("form.submit");
|
|
28379
|
+
if (!actionDef) {
|
|
28380
|
+
setError(`${actionType} action is not registered`);
|
|
28381
|
+
return;
|
|
28382
|
+
}
|
|
28383
|
+
setSubmitting(true);
|
|
28384
|
+
setError(null);
|
|
28385
|
+
updateRuntime({ state: "running", error: void 0 });
|
|
28386
|
+
try {
|
|
28387
|
+
const skill = parsePrimarySkill(block?.props?.skill);
|
|
28388
|
+
if (skill && typeof handlers?.askCompanion === "function") {
|
|
28389
|
+
const prompt = buildCompanionPrompt({
|
|
28390
|
+
skill,
|
|
28391
|
+
blockTitle: String(block?.props?.title || ""),
|
|
28392
|
+
blockDescription: String(block?.props?.description || ""),
|
|
28393
|
+
answers: sender.data || {}
|
|
28394
|
+
});
|
|
28395
|
+
handlers.askCompanion(prompt).catch((askError) => {
|
|
28396
|
+
console.error("askCompanion failed during form submit execution", askError);
|
|
28397
|
+
});
|
|
28398
|
+
}
|
|
28399
|
+
const outcome = await executeNode({
|
|
28400
|
+
node: flowNode,
|
|
28401
|
+
actorDid,
|
|
28402
|
+
context: {
|
|
28403
|
+
runtime: runtimeManager,
|
|
28404
|
+
ucanManager,
|
|
28405
|
+
delegationStore,
|
|
28406
|
+
verifySignature,
|
|
28407
|
+
rootIssuer: flowOwnerDid || void 0,
|
|
28408
|
+
flowUri
|
|
28409
|
+
},
|
|
28410
|
+
action: async () => {
|
|
28411
|
+
const result = await actionDef.run(
|
|
28412
|
+
{
|
|
28413
|
+
answers: sender.data || {}
|
|
28414
|
+
},
|
|
28415
|
+
{
|
|
28416
|
+
actorDid,
|
|
28417
|
+
flowId: flowUri,
|
|
28418
|
+
nodeId: block.id,
|
|
28419
|
+
services,
|
|
28420
|
+
flowNode,
|
|
28421
|
+
runtime: runtimeManager,
|
|
28422
|
+
delegationStore,
|
|
28423
|
+
verifySignature,
|
|
28424
|
+
rootIssuer: flowOwnerDid || void 0,
|
|
28425
|
+
flowUri,
|
|
28426
|
+
handlers,
|
|
28427
|
+
editor
|
|
28428
|
+
}
|
|
28429
|
+
);
|
|
28430
|
+
return {
|
|
28431
|
+
payload: result.output,
|
|
28432
|
+
submittedByDid: actorDid || void 0
|
|
28433
|
+
};
|
|
28434
|
+
}
|
|
28435
|
+
});
|
|
28436
|
+
if (!outcome.success) {
|
|
28437
|
+
throw new Error(outcome.error || "Form submit execution failed");
|
|
28438
|
+
}
|
|
28439
|
+
updateRuntime({
|
|
28440
|
+
state: "completed",
|
|
28441
|
+
executedAt: Date.now(),
|
|
28442
|
+
output: outcome.result?.payload || {}
|
|
28443
|
+
});
|
|
28444
|
+
} catch (err) {
|
|
28445
|
+
const message = err instanceof Error ? err.message : "Failed to execute form submit";
|
|
28446
|
+
setError(message);
|
|
28447
|
+
updateRuntime({
|
|
28448
|
+
state: "failed",
|
|
28449
|
+
error: { message, at: Date.now() }
|
|
28450
|
+
});
|
|
28451
|
+
} finally {
|
|
28452
|
+
setSubmitting(false);
|
|
28453
|
+
}
|
|
28454
|
+
},
|
|
28455
|
+
[
|
|
28456
|
+
actorDid,
|
|
28457
|
+
block,
|
|
28458
|
+
delegationStore,
|
|
28459
|
+
editor,
|
|
28460
|
+
flowNode,
|
|
28461
|
+
flowOwnerDid,
|
|
28462
|
+
flowUri,
|
|
28463
|
+
handlers,
|
|
28464
|
+
isDisabled,
|
|
28465
|
+
runtimeManager,
|
|
28466
|
+
services,
|
|
28467
|
+
submitting,
|
|
28468
|
+
ucanManager,
|
|
28469
|
+
updateRuntime,
|
|
28470
|
+
verifySignature
|
|
28471
|
+
]
|
|
28472
|
+
);
|
|
28473
|
+
useEffect93(() => {
|
|
28474
|
+
if (!surveyModel) return void 0;
|
|
28475
|
+
surveyModel.onComplete.add(handleSurveyComplete);
|
|
28476
|
+
return () => {
|
|
28477
|
+
surveyModel.onComplete.remove(handleSurveyComplete);
|
|
28478
|
+
};
|
|
28479
|
+
}, [surveyModel, handleSurveyComplete]);
|
|
28480
|
+
const statusMessage = runtime.state === "completed" ? "Last execution completed." : submitting ? "Executing..." : null;
|
|
28481
|
+
return /* @__PURE__ */ React264.createElement(Stack181, { gap: "md" }, !resolvedSchemaString ? /* @__PURE__ */ React264.createElement(Alert49, { color: "yellow", styles: actionAlertStyles }, "Configure Survey Schema JSON in template mode before running this action.") : !parsedSchema ? /* @__PURE__ */ React264.createElement(Alert49, { color: "red", styles: actionAlertStyles }, "Survey schema is invalid JSON. Fix it in template mode.") : /* @__PURE__ */ React264.createElement(Survey13, { model: surveyModel }), statusMessage && /* @__PURE__ */ React264.createElement(Stack181, { gap: 4 }, submitting && /* @__PURE__ */ React264.createElement(Loader50, { size: "xs" }), /* @__PURE__ */ React264.createElement(Text154, { size: "xs", c: "dimmed" }, statusMessage)), error && /* @__PURE__ */ React264.createElement(Alert49, { color: "red", styles: actionAlertStyles }, error), runtime.error?.message && /* @__PURE__ */ React264.createElement(Alert49, { color: "red", styles: actionAlertStyles }, runtime.error.message));
|
|
28482
|
+
};
|
|
28483
|
+
|
|
28484
|
+
// src/mantine/blocks/action/actionTypes/formSubmit/index.ts
|
|
28485
|
+
registerActionTypeUI("form.submit", {
|
|
28486
|
+
configComponent: FormSubmitConfig,
|
|
28487
|
+
flowDetailComponent: FormSubmitFlowDetail
|
|
28488
|
+
});
|
|
28489
|
+
registerActionTypeUI("human.form.submit", {
|
|
28490
|
+
configComponent: FormSubmitConfig,
|
|
28491
|
+
flowDetailComponent: FormSubmitFlowDetail
|
|
28492
|
+
});
|
|
28493
|
+
|
|
28494
|
+
// src/mantine/blocks/action/actionTypes/credentialStore/CredentialStoreConfig.tsx
|
|
28495
|
+
import React265, { useCallback as useCallback94, useEffect as useEffect94, useState as useState113 } from "react";
|
|
28496
|
+
import { Stack as Stack182, Text as Text155 } from "@mantine/core";
|
|
28497
|
+
|
|
28498
|
+
// src/mantine/blocks/action/actionTypes/credentialStore/types.ts
|
|
28499
|
+
function parseCredentialStoreInputs(json) {
|
|
28500
|
+
try {
|
|
28501
|
+
const parsed = typeof json === "string" ? JSON.parse(json) : json;
|
|
28502
|
+
let credential = parsed?.credential || "";
|
|
28503
|
+
if (typeof credential === "object" && credential !== null) {
|
|
28504
|
+
credential = JSON.stringify(credential);
|
|
28505
|
+
} else {
|
|
28506
|
+
credential = String(credential);
|
|
28507
|
+
}
|
|
28508
|
+
return {
|
|
28509
|
+
credentialKey: String(parsed?.credentialKey || ""),
|
|
28510
|
+
credential,
|
|
28511
|
+
roomId: String(parsed?.roomId || "")
|
|
28512
|
+
};
|
|
28513
|
+
} catch {
|
|
28514
|
+
return { credentialKey: "", credential: "", roomId: "" };
|
|
28515
|
+
}
|
|
28516
|
+
}
|
|
28517
|
+
function serializeCredentialStoreInputs(inputs) {
|
|
28518
|
+
return JSON.stringify({
|
|
28519
|
+
credentialKey: inputs.credentialKey,
|
|
28520
|
+
credential: inputs.credential,
|
|
28521
|
+
roomId: inputs.roomId
|
|
28522
|
+
});
|
|
28523
|
+
}
|
|
28524
|
+
|
|
28525
|
+
// src/mantine/blocks/action/actionTypes/credentialStore/CredentialStoreConfig.tsx
|
|
28526
|
+
var CredentialStoreConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
28527
|
+
const [local, setLocal] = useState113(() => parseCredentialStoreInputs(inputs));
|
|
28528
|
+
useEffect94(() => {
|
|
28529
|
+
setLocal(parseCredentialStoreInputs(inputs));
|
|
28530
|
+
}, [inputs]);
|
|
28531
|
+
const update = useCallback94(
|
|
28532
|
+
(patch) => {
|
|
28533
|
+
const updated = { ...local, ...patch };
|
|
28534
|
+
setLocal(updated);
|
|
28535
|
+
onInputsChange(serializeCredentialStoreInputs(updated));
|
|
28536
|
+
},
|
|
28537
|
+
[local, onInputsChange]
|
|
28538
|
+
);
|
|
28539
|
+
return /* @__PURE__ */ React265.createElement(Stack182, { gap: "lg" }, /* @__PURE__ */ React265.createElement(Stack182, { gap: "xs" }, /* @__PURE__ */ React265.createElement(Text155, { size: "sm", c: "neutralColor.7" }, "Credential Key"), /* @__PURE__ */ React265.createElement(
|
|
28540
|
+
BaseTextInput,
|
|
28541
|
+
{
|
|
28542
|
+
placeholder: "e.g. kycamllevel1",
|
|
28543
|
+
description: "The state key under which the credential will be stored",
|
|
28544
|
+
value: local.credentialKey,
|
|
28545
|
+
onChange: (e) => update({ credentialKey: e.currentTarget.value })
|
|
28546
|
+
}
|
|
28547
|
+
)), /* @__PURE__ */ React265.createElement(Stack182, { gap: "xs" }, /* @__PURE__ */ React265.createElement(Text155, { size: "sm", c: "neutralColor.7" }, "Credential"), /* @__PURE__ */ React265.createElement(
|
|
28548
|
+
DataInput,
|
|
28549
|
+
{
|
|
28550
|
+
placeholder: "Credential JSON or {{blockId.output.credential}}",
|
|
28551
|
+
description: "A verifiable credential as JSON, a block reference, or provided at execution time",
|
|
28552
|
+
value: local.credential,
|
|
28553
|
+
onChange: (value) => update({ credential: value }),
|
|
28554
|
+
editorDocument: editor?.document || [],
|
|
28555
|
+
currentBlockId: blockId
|
|
28556
|
+
}
|
|
28557
|
+
)), /* @__PURE__ */ React265.createElement(Stack182, { gap: "xs" }, /* @__PURE__ */ React265.createElement(Text155, { size: "sm", c: "neutralColor.7" }, "Room ID (optional)"), /* @__PURE__ */ React265.createElement(
|
|
28558
|
+
DataInput,
|
|
28559
|
+
{
|
|
28560
|
+
placeholder: "Defaults to the actor's room",
|
|
28561
|
+
description: "Target Matrix room ID. Leave empty to use the current user's room.",
|
|
28562
|
+
value: local.roomId,
|
|
28563
|
+
onChange: (value) => update({ roomId: value }),
|
|
28564
|
+
editorDocument: editor?.document || [],
|
|
28565
|
+
currentBlockId: blockId
|
|
28566
|
+
}
|
|
28567
|
+
)));
|
|
28568
|
+
};
|
|
28569
|
+
|
|
28570
|
+
// src/mantine/blocks/action/actionTypes/credentialStore/CredentialStoreFlowDetail.tsx
|
|
28571
|
+
import React266, { useCallback as useCallback95, useMemo as useMemo107, useState as useState114 } from "react";
|
|
28572
|
+
import { Alert as Alert50, Button as Button48, Loader as Loader51, Stack as Stack183, Text as Text156 } from "@mantine/core";
|
|
28573
|
+
import { IconShieldCheck as IconShieldCheck15 } from "@tabler/icons-react";
|
|
28574
|
+
var CredentialStoreFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabled }) => {
|
|
28575
|
+
const handlers = useBlocknoteHandlers();
|
|
28576
|
+
const services = useMemo107(() => buildServicesFromHandlers(handlers), [handlers]);
|
|
28577
|
+
const flowNode = useMemo107(() => buildFlowNodeFromBlock(block), [block]);
|
|
28578
|
+
const runtimeManager = useMemo107(() => createRuntimeStateManager(editor), [editor]);
|
|
28579
|
+
const ucanManager = useMemo107(() => new SimpleUCANManager(), []);
|
|
28580
|
+
const delegationStore = useMemo107(() => {
|
|
28581
|
+
if (!editor?._yDelegations) return void 0;
|
|
28582
|
+
return createDelegationStore(editor._yDelegations);
|
|
28583
|
+
}, [editor?._yDelegations]);
|
|
28584
|
+
const verifySignature = useMemo107(() => {
|
|
28585
|
+
if (!handlers?.verifyCapabilitySignature) return void 0;
|
|
28586
|
+
return async (capabilityRaw, issuerDid) => handlers.verifyCapabilitySignature({ capabilityRaw, issuerDid });
|
|
28587
|
+
}, [handlers]);
|
|
28588
|
+
const flowOwnerDid = useMemo107(() => editor?.getFlowOwnerDid?.() || "", [editor]);
|
|
28589
|
+
const flowUri = useMemo107(() => {
|
|
28590
|
+
const docId = editor?.getFlowMetadata?.()?.doc_id || block.id;
|
|
28591
|
+
return `ixo:flow:${docId}`;
|
|
28592
|
+
}, [editor, block.id]);
|
|
28593
|
+
const actorDid = useMemo107(() => {
|
|
28594
|
+
try {
|
|
28595
|
+
return handlers?.getCurrentUser?.()?.address || "";
|
|
28596
|
+
} catch {
|
|
28597
|
+
return "";
|
|
28598
|
+
}
|
|
28599
|
+
}, [handlers]);
|
|
28600
|
+
const parsed = useMemo107(() => parseCredentialStoreInputs(inputs), [inputs]);
|
|
28601
|
+
const editorDocument = editor?.document || [];
|
|
28602
|
+
const resolveOpts = useMemo107(() => ({ yRuntime: editor?._yRuntime }), [editor?._yRuntime]);
|
|
28603
|
+
const resolvedCredentialKey = useMemo107(
|
|
28604
|
+
() => resolveReferences(parsed.credentialKey || "", editorDocument, resolveOpts).trim(),
|
|
28605
|
+
[parsed.credentialKey, editorDocument, resolveOpts]
|
|
28606
|
+
);
|
|
28607
|
+
const resolvedCredential = useMemo107(() => resolveReferences(parsed.credential || "", editorDocument, resolveOpts).trim(), [parsed.credential, editorDocument, resolveOpts]);
|
|
28608
|
+
const resolvedRoomId = useMemo107(() => resolveReferences(parsed.roomId || "", editorDocument, resolveOpts).trim(), [parsed.roomId, editorDocument, resolveOpts]);
|
|
28609
|
+
const [submitting, setSubmitting] = useState114(false);
|
|
28610
|
+
const [error, setError] = useState114(null);
|
|
28611
|
+
const hasCredential = !!resolvedCredential;
|
|
28612
|
+
const hasKey = !!resolvedCredentialKey;
|
|
28613
|
+
const isCompleted = runtime.state === "completed";
|
|
28614
|
+
const handleExecute = useCallback95(async () => {
|
|
28615
|
+
if (isDisabled || submitting) return;
|
|
28616
|
+
const actionDef = getAction("credential.store");
|
|
28617
|
+
if (!actionDef) {
|
|
28618
|
+
setError("credential.store action is not registered");
|
|
28619
|
+
return;
|
|
28620
|
+
}
|
|
28621
|
+
setSubmitting(true);
|
|
28622
|
+
setError(null);
|
|
28623
|
+
updateRuntime({ state: "running", error: void 0 });
|
|
28624
|
+
try {
|
|
28625
|
+
const outcome = await executeNode({
|
|
28626
|
+
node: flowNode,
|
|
28627
|
+
actorDid,
|
|
28628
|
+
context: {
|
|
28629
|
+
runtime: runtimeManager,
|
|
28630
|
+
ucanManager,
|
|
28631
|
+
delegationStore,
|
|
28632
|
+
verifySignature,
|
|
28633
|
+
rootIssuer: flowOwnerDid || void 0,
|
|
28634
|
+
flowUri
|
|
28635
|
+
},
|
|
28636
|
+
action: async () => {
|
|
28637
|
+
const result = await actionDef.run(
|
|
28638
|
+
{
|
|
28639
|
+
credentialKey: resolvedCredentialKey,
|
|
28640
|
+
credential: resolvedCredential,
|
|
28641
|
+
roomId: resolvedRoomId
|
|
28642
|
+
},
|
|
28643
|
+
{
|
|
28644
|
+
actorDid,
|
|
28645
|
+
flowId: flowUri,
|
|
28646
|
+
nodeId: block.id,
|
|
28647
|
+
services,
|
|
28648
|
+
flowNode,
|
|
28649
|
+
runtime: runtimeManager,
|
|
28650
|
+
delegationStore,
|
|
28651
|
+
verifySignature,
|
|
28652
|
+
rootIssuer: flowOwnerDid || void 0,
|
|
28653
|
+
flowUri,
|
|
28654
|
+
handlers,
|
|
28655
|
+
editor
|
|
28656
|
+
}
|
|
28657
|
+
);
|
|
28658
|
+
return {
|
|
28659
|
+
payload: result.output,
|
|
28660
|
+
submittedByDid: actorDid || void 0
|
|
28661
|
+
};
|
|
28662
|
+
}
|
|
28663
|
+
});
|
|
28664
|
+
if (!outcome.success) {
|
|
28665
|
+
throw new Error(outcome.error || "Credential store execution failed");
|
|
28666
|
+
}
|
|
28667
|
+
updateRuntime({
|
|
28668
|
+
state: "completed",
|
|
28669
|
+
executedAt: Date.now(),
|
|
28670
|
+
output: outcome.result?.payload || {}
|
|
28671
|
+
});
|
|
28672
|
+
} catch (err) {
|
|
28673
|
+
const message = err instanceof Error ? err.message : "Failed to store credential";
|
|
28674
|
+
setError(message);
|
|
28675
|
+
updateRuntime({
|
|
28676
|
+
state: "failed",
|
|
28677
|
+
error: { message, at: Date.now() }
|
|
28678
|
+
});
|
|
28679
|
+
} finally {
|
|
28680
|
+
setSubmitting(false);
|
|
28681
|
+
}
|
|
28682
|
+
}, [
|
|
28683
|
+
actorDid,
|
|
28684
|
+
block.id,
|
|
28685
|
+
delegationStore,
|
|
28686
|
+
editor,
|
|
28687
|
+
flowNode,
|
|
28688
|
+
flowOwnerDid,
|
|
28689
|
+
flowUri,
|
|
28690
|
+
handlers,
|
|
28691
|
+
isDisabled,
|
|
28692
|
+
resolvedCredential,
|
|
28693
|
+
resolvedCredentialKey,
|
|
28694
|
+
resolvedRoomId,
|
|
28695
|
+
runtimeManager,
|
|
28696
|
+
services,
|
|
28697
|
+
submitting,
|
|
28698
|
+
ucanManager,
|
|
28699
|
+
updateRuntime,
|
|
28700
|
+
verifySignature
|
|
28701
|
+
]);
|
|
28702
|
+
return /* @__PURE__ */ React266.createElement(Stack183, { gap: "md" }, !hasKey && /* @__PURE__ */ React266.createElement(Alert50, { color: "yellow", styles: actionAlertStyles }, "No credential key configured. Set one in template mode."), hasKey && !hasCredential && !isCompleted && /* @__PURE__ */ React266.createElement(Alert50, { color: "yellow", styles: actionAlertStyles }, "Waiting for credential data. It will be provided by a block reference or at execution time."), hasKey && hasCredential && !isCompleted && /* @__PURE__ */ React266.createElement(Stack183, { gap: "xs" }, /* @__PURE__ */ React266.createElement(Text156, { size: "xs", c: "dimmed" }, "Credential key: ", resolvedCredentialKey), /* @__PURE__ */ React266.createElement(Button48, { leftSection: submitting ? /* @__PURE__ */ React266.createElement(Loader51, { size: 14 }) : /* @__PURE__ */ React266.createElement(IconShieldCheck15, { size: 14 }), onClick: handleExecute, disabled: isDisabled || submitting, size: "sm" }, submitting ? "Storing..." : "Store Credential")), isCompleted && /* @__PURE__ */ React266.createElement(Alert50, { color: runtime.output?.duplicate ? "yellow" : "green", styles: actionAlertStyles }, runtime.output?.duplicate ? `Credential already stored under key "${runtime.output?.credentialKey || resolvedCredentialKey}" (duplicate).` : `Credential stored successfully under key "${runtime.output?.credentialKey || resolvedCredentialKey}".`), error && /* @__PURE__ */ React266.createElement(Alert50, { color: "red", styles: actionAlertStyles }, error), runtime.error?.message && !error && /* @__PURE__ */ React266.createElement(Alert50, { color: "red", styles: actionAlertStyles }, runtime.error.message));
|
|
28703
|
+
};
|
|
28704
|
+
|
|
28705
|
+
// src/mantine/blocks/action/actionTypes/credentialStore/index.ts
|
|
28706
|
+
registerActionTypeUI("credential.store", {
|
|
28707
|
+
configComponent: CredentialStoreConfig,
|
|
28708
|
+
flowDetailComponent: CredentialStoreFlowDetail
|
|
28709
|
+
});
|
|
28710
|
+
|
|
28170
28711
|
// src/mantine/blocks/action/ActionBlock.tsx
|
|
28171
28712
|
function ActionBlock({ editor, block }) {
|
|
28172
28713
|
const { docType } = useBlocknoteContext();
|
|
28173
28714
|
const { actions } = useBlockConditions(block, editor);
|
|
28174
28715
|
if (docType === "template") {
|
|
28175
|
-
return /* @__PURE__ */
|
|
28716
|
+
return /* @__PURE__ */ React267.createElement(ActionTemplateView, { editor, block });
|
|
28176
28717
|
}
|
|
28177
28718
|
const conditionConfig = parseConditionConfig(block.props.conditions);
|
|
28178
28719
|
const hasVisibility = hasVisibilityConditions(conditionConfig);
|
|
@@ -28183,7 +28724,7 @@ function ActionBlock({ editor, block }) {
|
|
|
28183
28724
|
const hasEnable = hasEnableConditions(conditionConfig);
|
|
28184
28725
|
const enableActionExists = actions.some((a) => a.action === "enable");
|
|
28185
28726
|
const shouldDisable = hasEnable && !enableActionExists;
|
|
28186
|
-
return /* @__PURE__ */
|
|
28727
|
+
return /* @__PURE__ */ React267.createElement(
|
|
28187
28728
|
ActionFlowView,
|
|
28188
28729
|
{
|
|
28189
28730
|
block,
|
|
@@ -28253,36 +28794,36 @@ var ActionBlockSpec = createReactBlockSpec21(
|
|
|
28253
28794
|
{
|
|
28254
28795
|
render: (props) => {
|
|
28255
28796
|
const ixoProps = props;
|
|
28256
|
-
return /* @__PURE__ */
|
|
28797
|
+
return /* @__PURE__ */ React268.createElement(ActionBlock, { ...ixoProps });
|
|
28257
28798
|
}
|
|
28258
28799
|
}
|
|
28259
28800
|
);
|
|
28260
28801
|
|
|
28261
28802
|
// src/mantine/blocks/location/LocationBlockSpec.tsx
|
|
28262
|
-
import
|
|
28803
|
+
import React277 from "react";
|
|
28263
28804
|
import { createReactBlockSpec as createReactBlockSpec22 } from "@blocknote/react";
|
|
28264
28805
|
|
|
28265
28806
|
// src/mantine/blocks/location/LocationBlock.tsx
|
|
28266
|
-
import
|
|
28807
|
+
import React276 from "react";
|
|
28267
28808
|
|
|
28268
28809
|
// src/mantine/blocks/location/template/TemplateView.tsx
|
|
28269
|
-
import
|
|
28270
|
-
import { Group as Group101, Stack as
|
|
28810
|
+
import React273, { useMemo as useMemo108 } from "react";
|
|
28811
|
+
import { Group as Group101, Stack as Stack185, Text as Text159 } from "@mantine/core";
|
|
28271
28812
|
import { IconMapPin } from "@tabler/icons-react";
|
|
28272
28813
|
|
|
28273
28814
|
// src/mantine/blocks/location/template/TemplateConfig.tsx
|
|
28274
|
-
import
|
|
28815
|
+
import React271, { useCallback as useCallback97 } from "react";
|
|
28275
28816
|
import { IconSettings as IconSettings20 } from "@tabler/icons-react";
|
|
28276
28817
|
|
|
28277
28818
|
// src/mantine/blocks/location/template/GeneralTab.tsx
|
|
28278
|
-
import
|
|
28279
|
-
import { Box as Box52, Divider as Divider27, Stack as
|
|
28819
|
+
import React270, { useEffect as useEffect96, useRef as useRef23, useState as useState117 } from "react";
|
|
28820
|
+
import { Box as Box52, Divider as Divider27, Stack as Stack184, Text as Text157 } from "@mantine/core";
|
|
28280
28821
|
|
|
28281
28822
|
// src/core/hooks/useUnlMap.ts
|
|
28282
|
-
import { useEffect as
|
|
28823
|
+
import { useEffect as useEffect95, useState as useState115 } from "react";
|
|
28283
28824
|
function useUnlMap() {
|
|
28284
|
-
const [status, setStatus] =
|
|
28285
|
-
|
|
28825
|
+
const [status, setStatus] = useState115("loading");
|
|
28826
|
+
useEffect95(() => {
|
|
28286
28827
|
if (typeof window === "undefined") {
|
|
28287
28828
|
return;
|
|
28288
28829
|
}
|
|
@@ -28337,7 +28878,7 @@ function useUnlMap() {
|
|
|
28337
28878
|
}
|
|
28338
28879
|
|
|
28339
28880
|
// src/mantine/blocks/location/components/TileSelector.tsx
|
|
28340
|
-
import
|
|
28881
|
+
import React269, { useState as useState116, useCallback as useCallback96 } from "react";
|
|
28341
28882
|
import { ActionIcon as ActionIcon36, Group as Group100, Tooltip as Tooltip22 } from "@mantine/core";
|
|
28342
28883
|
import { IconMap, IconMoon, IconSatellite, IconMountain } from "@tabler/icons-react";
|
|
28343
28884
|
var TILE_LAYERS = {
|
|
@@ -28390,8 +28931,8 @@ function ensureLayer(map, config) {
|
|
|
28390
28931
|
);
|
|
28391
28932
|
}
|
|
28392
28933
|
var TileSelector = ({ mapRef }) => {
|
|
28393
|
-
const [active, setActive] =
|
|
28394
|
-
const switchTo =
|
|
28934
|
+
const [active, setActive] = useState116("map");
|
|
28935
|
+
const switchTo = useCallback96(
|
|
28395
28936
|
(type) => {
|
|
28396
28937
|
const map = mapRef.current;
|
|
28397
28938
|
if (!map || active === type) return;
|
|
@@ -28409,10 +28950,10 @@ var TileSelector = ({ mapRef }) => {
|
|
|
28409
28950
|
[mapRef, active]
|
|
28410
28951
|
);
|
|
28411
28952
|
const items = [
|
|
28412
|
-
{ type: "map", label: "Map", icon: /* @__PURE__ */
|
|
28953
|
+
{ type: "map", label: "Map", icon: /* @__PURE__ */ React269.createElement(IconMap, { size: 14 }) },
|
|
28413
28954
|
...OVERLAY_KEYS.map((key) => ({ type: key, label: TILE_LAYERS[key].label, icon: TILE_LAYERS[key].icon }))
|
|
28414
28955
|
];
|
|
28415
|
-
return /* @__PURE__ */
|
|
28956
|
+
return /* @__PURE__ */ React269.createElement(
|
|
28416
28957
|
Group100,
|
|
28417
28958
|
{
|
|
28418
28959
|
gap: 2,
|
|
@@ -28426,7 +28967,7 @@ var TileSelector = ({ mapRef }) => {
|
|
|
28426
28967
|
padding: 2
|
|
28427
28968
|
}
|
|
28428
28969
|
},
|
|
28429
|
-
items.map(({ type, label, icon: icon2 }) => /* @__PURE__ */
|
|
28970
|
+
items.map(({ type, label, icon: icon2 }) => /* @__PURE__ */ React269.createElement(Tooltip22, { key: type, label, withArrow: true }, /* @__PURE__ */ React269.createElement(
|
|
28430
28971
|
ActionIcon36,
|
|
28431
28972
|
{
|
|
28432
28973
|
variant: active === type ? "filled" : "subtle",
|
|
@@ -28447,22 +28988,22 @@ var DEFAULT_CENTER = [0, 20];
|
|
|
28447
28988
|
var DEFAULT_ZOOM = 2;
|
|
28448
28989
|
var PLACED_ZOOM = 14;
|
|
28449
28990
|
var GeneralTab18 = ({ title, description, latitude, longitude, onTitleChange, onDescriptionChange, onCoordinatesChange }) => {
|
|
28450
|
-
const [localTitle, setLocalTitle] =
|
|
28451
|
-
const [localDescription, setLocalDescription] =
|
|
28452
|
-
const [mapError, setMapError] =
|
|
28991
|
+
const [localTitle, setLocalTitle] = useState117(title);
|
|
28992
|
+
const [localDescription, setLocalDescription] = useState117(description);
|
|
28993
|
+
const [mapError, setMapError] = useState117(null);
|
|
28453
28994
|
const { status, UnlSdk } = useUnlMap();
|
|
28454
28995
|
const { mapConfig } = useBlocknoteContext();
|
|
28455
28996
|
const markerRef = useRef23(null);
|
|
28456
28997
|
const mapRef = useRef23(null);
|
|
28457
28998
|
const wrapperRef = useRef23(null);
|
|
28458
28999
|
const containerRef = useRef23(null);
|
|
28459
|
-
|
|
29000
|
+
useEffect96(() => {
|
|
28460
29001
|
setLocalTitle(title);
|
|
28461
29002
|
}, [title]);
|
|
28462
|
-
|
|
29003
|
+
useEffect96(() => {
|
|
28463
29004
|
setLocalDescription(description);
|
|
28464
29005
|
}, [description]);
|
|
28465
|
-
|
|
29006
|
+
useEffect96(() => {
|
|
28466
29007
|
if (status !== "ready" || !UnlSdk || mapRef.current || !mapConfig || !containerRef.current || !wrapperRef.current) return;
|
|
28467
29008
|
try {
|
|
28468
29009
|
const hasCoords = latitude && longitude;
|
|
@@ -28512,7 +29053,7 @@ var GeneralTab18 = ({ title, description, latitude, longitude, onTitleChange, on
|
|
|
28512
29053
|
markerRef.current = null;
|
|
28513
29054
|
};
|
|
28514
29055
|
}, [status, UnlSdk]);
|
|
28515
|
-
return /* @__PURE__ */
|
|
29056
|
+
return /* @__PURE__ */ React270.createElement(Stack184, { gap: "lg" }, /* @__PURE__ */ React270.createElement(Stack184, { gap: "xs" }, /* @__PURE__ */ React270.createElement(Text157, { size: "sm", fw: 600 }, "Title"), /* @__PURE__ */ React270.createElement(
|
|
28516
29057
|
BaseTextInput,
|
|
28517
29058
|
{
|
|
28518
29059
|
placeholder: "e.g. Project Location",
|
|
@@ -28523,7 +29064,7 @@ var GeneralTab18 = ({ title, description, latitude, longitude, onTitleChange, on
|
|
|
28523
29064
|
onTitleChange(v);
|
|
28524
29065
|
}
|
|
28525
29066
|
}
|
|
28526
|
-
)), /* @__PURE__ */
|
|
29067
|
+
)), /* @__PURE__ */ React270.createElement(Stack184, { gap: "xs" }, /* @__PURE__ */ React270.createElement(Text157, { size: "sm", fw: 600 }, "Description"), /* @__PURE__ */ React270.createElement(
|
|
28527
29068
|
BaseTextInput,
|
|
28528
29069
|
{
|
|
28529
29070
|
placeholder: "e.g. Main project site coordinates",
|
|
@@ -28534,7 +29075,7 @@ var GeneralTab18 = ({ title, description, latitude, longitude, onTitleChange, on
|
|
|
28534
29075
|
onDescriptionChange(v);
|
|
28535
29076
|
}
|
|
28536
29077
|
}
|
|
28537
|
-
)), /* @__PURE__ */
|
|
29078
|
+
)), /* @__PURE__ */ React270.createElement(Divider27, { variant: "dashed" }), /* @__PURE__ */ React270.createElement(Stack184, { gap: "xs" }, /* @__PURE__ */ React270.createElement(Text157, { size: "sm", fw: 600 }, "Location"), /* @__PURE__ */ React270.createElement(Text157, { size: "xs", c: "dimmed" }, "Click on the map to set the location."), mapError ? /* @__PURE__ */ React270.createElement(Text157, { size: "sm", c: "red" }, mapError) : /* @__PURE__ */ React270.createElement(Box52, { ref: wrapperRef, mx: "auto", w: "100%", miw: 280, h: 300, style: { borderRadius: 12, position: "relative", overflow: "hidden" } }, /* @__PURE__ */ React270.createElement(
|
|
28538
29079
|
Box52,
|
|
28539
29080
|
{
|
|
28540
29081
|
ref: containerRef,
|
|
@@ -28547,19 +29088,19 @@ var GeneralTab18 = ({ title, description, latitude, longitude, onTitleChange, on
|
|
|
28547
29088
|
height: "600px"
|
|
28548
29089
|
}
|
|
28549
29090
|
}
|
|
28550
|
-
), /* @__PURE__ */
|
|
29091
|
+
), /* @__PURE__ */ React270.createElement(TileSelector, { mapRef }))), /* @__PURE__ */ React270.createElement(Stack184, { gap: "xs" }, /* @__PURE__ */ React270.createElement(BaseTextInput, { label: "Latitude", value: latitude, readOnly: true, placeholder: "Not set" }), /* @__PURE__ */ React270.createElement(BaseTextInput, { label: "Longitude", value: longitude, readOnly: true, placeholder: "Not set" })));
|
|
28551
29092
|
};
|
|
28552
29093
|
|
|
28553
29094
|
// src/mantine/blocks/location/template/TemplateConfig.tsx
|
|
28554
29095
|
var TemplateConfig18 = ({ editor, block }) => {
|
|
28555
29096
|
const { closePanel } = usePanelStore();
|
|
28556
|
-
const updateProp =
|
|
29097
|
+
const updateProp = useCallback97(
|
|
28557
29098
|
(key, value) => {
|
|
28558
29099
|
editor.updateBlock(block, { props: { ...block.props, [key]: value } });
|
|
28559
29100
|
},
|
|
28560
29101
|
[editor, block]
|
|
28561
29102
|
);
|
|
28562
|
-
const updateProps =
|
|
29103
|
+
const updateProps = useCallback97(
|
|
28563
29104
|
(updates) => {
|
|
28564
29105
|
editor.updateBlock(block, { props: { ...block.props, ...updates } });
|
|
28565
29106
|
},
|
|
@@ -28570,7 +29111,7 @@ var TemplateConfig18 = ({ editor, block }) => {
|
|
|
28570
29111
|
label: "General",
|
|
28571
29112
|
value: "general",
|
|
28572
29113
|
icon: icon(IconSettings20),
|
|
28573
|
-
content: /* @__PURE__ */
|
|
29114
|
+
content: /* @__PURE__ */ React271.createElement(
|
|
28574
29115
|
GeneralTab18,
|
|
28575
29116
|
{
|
|
28576
29117
|
title: block.props.title || "",
|
|
@@ -28584,21 +29125,21 @@ var TemplateConfig18 = ({ editor, block }) => {
|
|
|
28584
29125
|
)
|
|
28585
29126
|
}
|
|
28586
29127
|
];
|
|
28587
|
-
return /* @__PURE__ */
|
|
29128
|
+
return /* @__PURE__ */ React271.createElement(BaseRightPanelLayout, { title: "Location Settings", onClose: closePanel, tabs, context: { editor, block } });
|
|
28588
29129
|
};
|
|
28589
29130
|
|
|
28590
29131
|
// src/mantine/blocks/location/components/LocationMap.tsx
|
|
28591
|
-
import
|
|
28592
|
-
import { Box as Box53, Flex as Flex32, Loader as
|
|
29132
|
+
import React272, { useEffect as useEffect97, useRef as useRef24, useState as useState118 } from "react";
|
|
29133
|
+
import { Box as Box53, Flex as Flex32, Loader as Loader52, Text as Text158 } from "@mantine/core";
|
|
28593
29134
|
var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker = true, showTilesControl = false }) => {
|
|
28594
|
-
const [mapError, setMapError] =
|
|
29135
|
+
const [mapError, setMapError] = useState118(null);
|
|
28595
29136
|
const { mapConfig } = useBlocknoteContext();
|
|
28596
29137
|
const wrapperRef = useRef24(null);
|
|
28597
29138
|
const containerRef = useRef24(null);
|
|
28598
29139
|
const mapRef = useRef24(null);
|
|
28599
29140
|
const markerRef = useRef24(null);
|
|
28600
29141
|
const { status, UnlSdk } = useUnlMap();
|
|
28601
|
-
|
|
29142
|
+
useEffect97(() => {
|
|
28602
29143
|
if (status !== "ready" || !UnlSdk || mapRef.current || !containerRef.current || !wrapperRef.current) return;
|
|
28603
29144
|
let ro;
|
|
28604
29145
|
let resizeTimer;
|
|
@@ -28629,7 +29170,7 @@ var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker =
|
|
|
28629
29170
|
ro?.disconnect();
|
|
28630
29171
|
};
|
|
28631
29172
|
}, [status, UnlSdk, mapConfig]);
|
|
28632
|
-
|
|
29173
|
+
useEffect97(() => {
|
|
28633
29174
|
if (!mapRef.current || !latitude || !longitude) return;
|
|
28634
29175
|
const coords = [Number(longitude), Number(latitude)];
|
|
28635
29176
|
mapRef.current.setCenter(coords);
|
|
@@ -28638,7 +29179,7 @@ var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker =
|
|
|
28638
29179
|
}
|
|
28639
29180
|
}, [latitude, longitude, showMarker]);
|
|
28640
29181
|
if (status === "loading") {
|
|
28641
|
-
return /* @__PURE__ */
|
|
29182
|
+
return /* @__PURE__ */ React272.createElement(
|
|
28642
29183
|
Box53,
|
|
28643
29184
|
{
|
|
28644
29185
|
style: {
|
|
@@ -28650,11 +29191,11 @@ var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker =
|
|
|
28650
29191
|
w,
|
|
28651
29192
|
h
|
|
28652
29193
|
},
|
|
28653
|
-
/* @__PURE__ */
|
|
29194
|
+
/* @__PURE__ */ React272.createElement(Loader52, null)
|
|
28654
29195
|
);
|
|
28655
29196
|
}
|
|
28656
29197
|
if (status === "error" || mapError) {
|
|
28657
|
-
return /* @__PURE__ */
|
|
29198
|
+
return /* @__PURE__ */ React272.createElement(
|
|
28658
29199
|
Box53,
|
|
28659
29200
|
{
|
|
28660
29201
|
style: {
|
|
@@ -28666,10 +29207,10 @@ var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker =
|
|
|
28666
29207
|
w,
|
|
28667
29208
|
h
|
|
28668
29209
|
},
|
|
28669
|
-
/* @__PURE__ */
|
|
29210
|
+
/* @__PURE__ */ React272.createElement(Text158, { size: "sm", c: "red" }, mapError || "Failed to load map")
|
|
28670
29211
|
);
|
|
28671
29212
|
}
|
|
28672
|
-
return /* @__PURE__ */
|
|
29213
|
+
return /* @__PURE__ */ React272.createElement(Box53, { ref: wrapperRef, style: { position: "relative", borderRadius: 16, overflow: "hidden" }, w, h }, /* @__PURE__ */ React272.createElement(
|
|
28673
29214
|
Box53,
|
|
28674
29215
|
{
|
|
28675
29216
|
ref: containerRef,
|
|
@@ -28682,55 +29223,55 @@ var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker =
|
|
|
28682
29223
|
height: "600px"
|
|
28683
29224
|
}
|
|
28684
29225
|
}
|
|
28685
|
-
), showTilesControl && /* @__PURE__ */
|
|
29226
|
+
), showTilesControl && /* @__PURE__ */ React272.createElement(TileSelector, { mapRef }));
|
|
28686
29227
|
};
|
|
28687
29228
|
function LocationMap(props) {
|
|
28688
29229
|
if (props.latitude === void 0 || props.longitude === void 0)
|
|
28689
|
-
return /* @__PURE__ */
|
|
28690
|
-
return /* @__PURE__ */
|
|
29230
|
+
return /* @__PURE__ */ React272.createElement(Flex32, { w: "100%", h: 200, align: "center", justify: "center" }, /* @__PURE__ */ React272.createElement(Loader52, null));
|
|
29231
|
+
return /* @__PURE__ */ React272.createElement(UnlMap, { ...props });
|
|
28691
29232
|
}
|
|
28692
29233
|
|
|
28693
29234
|
// src/mantine/blocks/location/template/TemplateView.tsx
|
|
28694
29235
|
var LOCATION_TEMPLATE_PANEL_ID = "location-template-panel";
|
|
28695
29236
|
var LocationTemplateView = ({ editor, block }) => {
|
|
28696
29237
|
const panelId = `${LOCATION_TEMPLATE_PANEL_ID}-${block.id}`;
|
|
28697
|
-
const panelContent =
|
|
29238
|
+
const panelContent = useMemo108(() => /* @__PURE__ */ React273.createElement(TemplateConfig18, { editor, block }), [editor, block]);
|
|
28698
29239
|
const { open } = usePanel(panelId, panelContent);
|
|
28699
29240
|
console.log("block.props:", block.props);
|
|
28700
29241
|
const hasLocation = block.props.latitude && block.props.longitude;
|
|
28701
|
-
return /* @__PURE__ */
|
|
29242
|
+
return /* @__PURE__ */ React273.createElement(BaseContainer, { blockId: block.id, onClick: open, style: { minHeight: 90, justifyContent: "center" } }, /* @__PURE__ */ React273.createElement(Stack185, { gap: "xs", justify: "center" }, /* @__PURE__ */ React273.createElement(Group101, { wrap: "nowrap", align: "center" }, /* @__PURE__ */ React273.createElement(IconMapPin, { color: "white", size: 26, stroke: 1.5 }), /* @__PURE__ */ React273.createElement(Stack185, { gap: 2 }, /* @__PURE__ */ React273.createElement(Text159, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "Location"), block.props.description && /* @__PURE__ */ React273.createElement(Text159, { size: "xs", c: "dimmed", contentEditable: false }, block.props.description))), hasLocation && /* @__PURE__ */ React273.createElement(LocationMap, { latitude: block.props.latitude, longitude: block.props.longitude, mapId: `location-template-map-${block.id}`, zoom: 14, showMarker: true, showTilesControl: true })));
|
|
28702
29243
|
};
|
|
28703
29244
|
|
|
28704
29245
|
// src/mantine/blocks/location/flow/FlowView.tsx
|
|
28705
|
-
import
|
|
28706
|
-
import { Center as Center13, Group as Group102, Stack as
|
|
29246
|
+
import React275, { useMemo as useMemo109 } from "react";
|
|
29247
|
+
import { Center as Center13, Group as Group102, Stack as Stack186, Text as Text160 } from "@mantine/core";
|
|
28707
29248
|
import { IconMapPin as IconMapPin2 } from "@tabler/icons-react";
|
|
28708
29249
|
|
|
28709
29250
|
// src/mantine/blocks/location/flow/FlowConfig.tsx
|
|
28710
|
-
import
|
|
29251
|
+
import React274 from "react";
|
|
28711
29252
|
var FlowConfig3 = ({ block }) => {
|
|
28712
29253
|
const { closePanel } = usePanelStore();
|
|
28713
29254
|
const hasLocation = block.props.latitude && block.props.longitude;
|
|
28714
|
-
return /* @__PURE__ */
|
|
29255
|
+
return /* @__PURE__ */ React274.createElement(BaseRightPanelLayout, { title: block.props.title || "Location", onClose: closePanel, isTemplate: false }, hasLocation ? /* @__PURE__ */ React274.createElement(LocationMap, { latitude: block.props.latitude, longitude: block.props.longitude, h: 600, zoom: 14, showMarker: true, showTilesControl: true }) : null);
|
|
28715
29256
|
};
|
|
28716
29257
|
|
|
28717
29258
|
// src/mantine/blocks/location/flow/FlowView.tsx
|
|
28718
29259
|
var LOCATION_FLOW_PANEL_ID = "location-flow-panel";
|
|
28719
29260
|
var LocationFlowView = ({ editor, block }) => {
|
|
28720
29261
|
const panelId = `${LOCATION_FLOW_PANEL_ID}-${block.id}`;
|
|
28721
|
-
const panelContent =
|
|
29262
|
+
const panelContent = useMemo109(() => /* @__PURE__ */ React275.createElement(FlowConfig3, { editor, block }), [editor, block]);
|
|
28722
29263
|
const { open } = usePanel(panelId, panelContent);
|
|
28723
29264
|
const hasLocation = block.props.latitude && block.props.longitude;
|
|
28724
|
-
return /* @__PURE__ */
|
|
29265
|
+
return /* @__PURE__ */ React275.createElement(BaseContainer, { blockId: block.id, onClick: open, style: { minHeight: 90, justifyContent: "center" } }, /* @__PURE__ */ React275.createElement(Stack186, { gap: "xs", justify: "center" }, /* @__PURE__ */ React275.createElement(Group102, { wrap: "nowrap", align: "center" }, /* @__PURE__ */ React275.createElement(IconMapPin2, { color: "white", size: 26, stroke: 1.5 }), /* @__PURE__ */ React275.createElement(Stack186, { gap: 2 }, /* @__PURE__ */ React275.createElement(Text160, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "Location"), block.props.description && /* @__PURE__ */ React275.createElement(Text160, { size: "xs", c: "dimmed", contentEditable: false }, block.props.description))), hasLocation ? /* @__PURE__ */ React275.createElement(LocationMap, { latitude: block.props.latitude, longitude: block.props.longitude, mapId: `location-flow-map-${block.id}`, zoom: 14, showMarker: true, showTilesControl: true }) : /* @__PURE__ */ React275.createElement(Center13, { py: "md" }, /* @__PURE__ */ React275.createElement(Text160, { size: "sm", c: "dimmed" }, "Location not configured"))));
|
|
28725
29266
|
};
|
|
28726
29267
|
|
|
28727
29268
|
// src/mantine/blocks/location/LocationBlock.tsx
|
|
28728
29269
|
function LocationBlock({ editor, block }) {
|
|
28729
29270
|
const { docType } = useBlocknoteContext();
|
|
28730
29271
|
if (docType === "template" || docType === "page") {
|
|
28731
|
-
return /* @__PURE__ */
|
|
29272
|
+
return /* @__PURE__ */ React276.createElement(LocationTemplateView, { editor, block });
|
|
28732
29273
|
}
|
|
28733
|
-
return /* @__PURE__ */
|
|
29274
|
+
return /* @__PURE__ */ React276.createElement(LocationFlowView, { editor, block });
|
|
28734
29275
|
}
|
|
28735
29276
|
|
|
28736
29277
|
// src/mantine/blocks/location/LocationBlockSpec.tsx
|
|
@@ -28749,7 +29290,7 @@ var LocationBlockSpec = createReactBlockSpec22(
|
|
|
28749
29290
|
{
|
|
28750
29291
|
render: (props) => {
|
|
28751
29292
|
const ixoProps = props;
|
|
28752
|
-
return /* @__PURE__ */
|
|
29293
|
+
return /* @__PURE__ */ React277.createElement(LocationBlock, { ...ixoProps });
|
|
28753
29294
|
}
|
|
28754
29295
|
}
|
|
28755
29296
|
);
|
|
@@ -28952,10 +29493,10 @@ blockRegistry.register({
|
|
|
28952
29493
|
});
|
|
28953
29494
|
|
|
28954
29495
|
// src/mantine/blocks/hooks/useBlockDependencies.ts
|
|
28955
|
-
import { useMemo as
|
|
29496
|
+
import { useMemo as useMemo110, useEffect as useEffect98, useState as useState119, useCallback as useCallback98 } from "react";
|
|
28956
29497
|
|
|
28957
29498
|
// src/mantine/blocks/hooks/useDependsOn.ts
|
|
28958
|
-
import { useMemo as
|
|
29499
|
+
import { useMemo as useMemo111 } from "react";
|
|
28959
29500
|
|
|
28960
29501
|
// src/mantine/blocks/index.ts
|
|
28961
29502
|
var blockSpecs = {
|
|
@@ -29426,15 +29967,15 @@ import { useCreateBlockNote as useCreateBlockNote2 } from "@blocknote/react";
|
|
|
29426
29967
|
import { BlockNoteSchema as BlockNoteSchema2, defaultBlockSpecs as defaultBlockSpecs2, defaultInlineContentSpecs as defaultInlineContentSpecs2, defaultStyleSpecs as defaultStyleSpecs2 } from "@blocknote/core";
|
|
29427
29968
|
|
|
29428
29969
|
// src/core/hooks/useMatrixProvider.ts
|
|
29429
|
-
import { useEffect as
|
|
29970
|
+
import { useEffect as useEffect99, useState as useState120, useRef as useRef25, useCallback as useCallback99, useMemo as useMemo112 } from "react";
|
|
29430
29971
|
import { MatrixProvider } from "@ixo/matrix-crdt";
|
|
29431
29972
|
function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
29432
|
-
const [matrixProvider, setProvider] =
|
|
29433
|
-
const [status, setStatus] =
|
|
29973
|
+
const [matrixProvider, setProvider] = useState120(null);
|
|
29974
|
+
const [status, setStatus] = useState120("disconnected");
|
|
29434
29975
|
const isMountedRef = useRef25(true);
|
|
29435
29976
|
const providerRef = useRef25(null);
|
|
29436
29977
|
const retryTimeoutRef = useRef25(null);
|
|
29437
|
-
const providerOptions =
|
|
29978
|
+
const providerOptions = useMemo112(
|
|
29438
29979
|
() => ({
|
|
29439
29980
|
translator: {
|
|
29440
29981
|
updateEventType: "matrix-crdt.doc_update",
|
|
@@ -29447,22 +29988,22 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
29447
29988
|
}),
|
|
29448
29989
|
[]
|
|
29449
29990
|
);
|
|
29450
|
-
const handleDocumentAvailable =
|
|
29991
|
+
const handleDocumentAvailable = useCallback99(() => {
|
|
29451
29992
|
if (isMountedRef.current) {
|
|
29452
29993
|
setStatus("connected");
|
|
29453
29994
|
}
|
|
29454
29995
|
}, []);
|
|
29455
|
-
const handleDocumentUnavailable =
|
|
29996
|
+
const handleDocumentUnavailable = useCallback99(() => {
|
|
29456
29997
|
if (isMountedRef.current) {
|
|
29457
29998
|
setStatus("failed");
|
|
29458
29999
|
}
|
|
29459
30000
|
}, []);
|
|
29460
|
-
const handleCanWriteChanged =
|
|
30001
|
+
const handleCanWriteChanged = useCallback99(() => {
|
|
29461
30002
|
if (isMountedRef.current && providerRef.current) {
|
|
29462
30003
|
setStatus(providerRef.current.canWrite ? "connected" : "failed");
|
|
29463
30004
|
}
|
|
29464
30005
|
}, []);
|
|
29465
|
-
const initProvider =
|
|
30006
|
+
const initProvider = useCallback99(async () => {
|
|
29466
30007
|
if (!isMountedRef.current) return;
|
|
29467
30008
|
if (retryTimeoutRef.current) {
|
|
29468
30009
|
clearTimeout(retryTimeoutRef.current);
|
|
@@ -29495,7 +30036,7 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
29495
30036
|
}
|
|
29496
30037
|
}
|
|
29497
30038
|
}, [matrixClient, providerOptions, handleDocumentAvailable, handleDocumentUnavailable, handleCanWriteChanged]);
|
|
29498
|
-
|
|
30039
|
+
useEffect99(() => {
|
|
29499
30040
|
isMountedRef.current = true;
|
|
29500
30041
|
initProvider();
|
|
29501
30042
|
return () => {
|
|
@@ -29512,7 +30053,7 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
29512
30053
|
setStatus("disconnected");
|
|
29513
30054
|
};
|
|
29514
30055
|
}, [initProvider]);
|
|
29515
|
-
|
|
30056
|
+
useEffect99(() => {
|
|
29516
30057
|
return () => {
|
|
29517
30058
|
isMountedRef.current = false;
|
|
29518
30059
|
};
|
|
@@ -29521,17 +30062,17 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
29521
30062
|
}
|
|
29522
30063
|
|
|
29523
30064
|
// src/mantine/hooks/useCollaborativeYDoc.ts
|
|
29524
|
-
import { useMemo as
|
|
30065
|
+
import { useMemo as useMemo113 } from "react";
|
|
29525
30066
|
import * as Y from "yjs";
|
|
29526
30067
|
function useCollaborativeYDoc(_options) {
|
|
29527
|
-
return
|
|
30068
|
+
return useMemo113(() => {
|
|
29528
30069
|
const doc = new Y.Doc();
|
|
29529
30070
|
return doc;
|
|
29530
30071
|
}, []);
|
|
29531
30072
|
}
|
|
29532
30073
|
|
|
29533
30074
|
// src/mantine/hooks/useCollaborativeIxoEditor.ts
|
|
29534
|
-
import { useMemo as
|
|
30075
|
+
import { useMemo as useMemo114, useEffect as useEffect100, useState as useState121, useRef as useRef26 } from "react";
|
|
29535
30076
|
|
|
29536
30077
|
// src/core/lib/matrixMetadata.ts
|
|
29537
30078
|
var COVER_IMAGE_EVENT_TYPE = "ixo.page.cover_image";
|
|
@@ -29700,7 +30241,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29700
30241
|
matrixClient,
|
|
29701
30242
|
permissions = { write: false }
|
|
29702
30243
|
} = options || {};
|
|
29703
|
-
const memoizedUser =
|
|
30244
|
+
const memoizedUser = useMemo114(
|
|
29704
30245
|
() => ({
|
|
29705
30246
|
id: user?.id || "",
|
|
29706
30247
|
name: user?.name || "",
|
|
@@ -29716,13 +30257,13 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29716
30257
|
matrixClient,
|
|
29717
30258
|
roomId: options.roomId
|
|
29718
30259
|
});
|
|
29719
|
-
const metadataManager =
|
|
29720
|
-
|
|
30260
|
+
const metadataManager = useMemo114(() => new MatrixMetadataManager(matrixClient, options.roomId), [matrixClient, options.roomId]);
|
|
30261
|
+
useEffect100(() => {
|
|
29721
30262
|
return () => {
|
|
29722
30263
|
metadataManager.dispose();
|
|
29723
30264
|
};
|
|
29724
30265
|
}, [metadataManager]);
|
|
29725
|
-
const defaultUploadFile =
|
|
30266
|
+
const defaultUploadFile = useMemo114(
|
|
29726
30267
|
() => uploadFile || (async (file) => {
|
|
29727
30268
|
return new Promise((resolve, reject) => {
|
|
29728
30269
|
const reader = new FileReader();
|
|
@@ -29736,7 +30277,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29736
30277
|
}),
|
|
29737
30278
|
[uploadFile]
|
|
29738
30279
|
);
|
|
29739
|
-
const schema =
|
|
30280
|
+
const schema = useMemo114(
|
|
29740
30281
|
() => BlockNoteSchema2.create({
|
|
29741
30282
|
blockSpecs: {
|
|
29742
30283
|
...defaultBlockSpecs2,
|
|
@@ -29751,16 +30292,16 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29751
30292
|
}),
|
|
29752
30293
|
[]
|
|
29753
30294
|
);
|
|
29754
|
-
const root =
|
|
29755
|
-
const documentFragment =
|
|
29756
|
-
const flowArray =
|
|
29757
|
-
const runtimeMap =
|
|
29758
|
-
const delegationsMap =
|
|
29759
|
-
const invocationsMap =
|
|
29760
|
-
const ucanDelegationStore =
|
|
29761
|
-
const invocationStore =
|
|
29762
|
-
const userFragment =
|
|
29763
|
-
const collaborationConfig =
|
|
30295
|
+
const root = useMemo114(() => yDoc.getMap("root"), [yDoc]);
|
|
30296
|
+
const documentFragment = useMemo114(() => yDoc.getXmlFragment("document"), [yDoc]);
|
|
30297
|
+
const flowArray = useMemo114(() => yDoc.getArray("flow"), [yDoc]);
|
|
30298
|
+
const runtimeMap = useMemo114(() => yDoc.getMap("runtime"), [yDoc]);
|
|
30299
|
+
const delegationsMap = useMemo114(() => yDoc.getMap("delegations"), [yDoc]);
|
|
30300
|
+
const invocationsMap = useMemo114(() => yDoc.getMap("invocations"), [yDoc]);
|
|
30301
|
+
const ucanDelegationStore = useMemo114(() => createUcanDelegationStore(delegationsMap), [delegationsMap]);
|
|
30302
|
+
const invocationStore = useMemo114(() => createInvocationStore(invocationsMap), [invocationsMap]);
|
|
30303
|
+
const userFragment = useMemo114(() => yDoc.getMap(memoizedUser.id), [yDoc, memoizedUser.id]);
|
|
30304
|
+
const collaborationConfig = useMemo114(
|
|
29764
30305
|
() => ({
|
|
29765
30306
|
provider: matrixProvider,
|
|
29766
30307
|
fragment: documentFragment,
|
|
@@ -29772,7 +30313,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29772
30313
|
}),
|
|
29773
30314
|
[matrixProvider, documentFragment, memoizedUser.name, memoizedUser.color]
|
|
29774
30315
|
);
|
|
29775
|
-
const ixoConfig =
|
|
30316
|
+
const ixoConfig = useMemo114(
|
|
29776
30317
|
() => ({
|
|
29777
30318
|
theme,
|
|
29778
30319
|
editable,
|
|
@@ -29792,7 +30333,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29792
30333
|
collaboration: collaborationConfig,
|
|
29793
30334
|
pasteHandler: ixoPasteHandler
|
|
29794
30335
|
});
|
|
29795
|
-
const titleText =
|
|
30336
|
+
const titleText = useMemo114(() => yDoc.getText("title"), [yDoc]);
|
|
29796
30337
|
let ixoEditor;
|
|
29797
30338
|
if (editor) {
|
|
29798
30339
|
ixoEditor = editor;
|
|
@@ -29813,16 +30354,12 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29813
30354
|
userFragment.set(block.id, { ...prev, ...updates });
|
|
29814
30355
|
};
|
|
29815
30356
|
ixoEditor.getFlowMetadata = () => {
|
|
29816
|
-
|
|
29817
|
-
|
|
29818
|
-
|
|
29819
|
-
|
|
29820
|
-
|
|
29821
|
-
|
|
29822
|
-
createdAt: root.get("createdAt") || "",
|
|
29823
|
-
createdBy: root.get("createdBy") || "",
|
|
29824
|
-
flowOwnerDid: root.get("flowOwnerDid") || ""
|
|
29825
|
-
};
|
|
30357
|
+
const result = {};
|
|
30358
|
+
root.forEach((value, key) => {
|
|
30359
|
+
result[key] = value;
|
|
30360
|
+
});
|
|
30361
|
+
result.title = titleText.toString() || result.title || "";
|
|
30362
|
+
return result;
|
|
29826
30363
|
};
|
|
29827
30364
|
ixoEditor.getFlowOwnerDid = () => {
|
|
29828
30365
|
return root.get("flowOwnerDid") || "";
|
|
@@ -29835,6 +30372,8 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29835
30372
|
if (key === "title") {
|
|
29836
30373
|
titleText.delete(0, titleText.length);
|
|
29837
30374
|
titleText.insert(0, value);
|
|
30375
|
+
} else if (value === void 0 || value === null) {
|
|
30376
|
+
root.delete(key);
|
|
29838
30377
|
} else {
|
|
29839
30378
|
root.set(key, value);
|
|
29840
30379
|
}
|
|
@@ -29986,12 +30525,12 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29986
30525
|
return void 0;
|
|
29987
30526
|
};
|
|
29988
30527
|
}
|
|
29989
|
-
|
|
30528
|
+
useEffect100(() => {
|
|
29990
30529
|
if (ixoEditor) {
|
|
29991
30530
|
ixoEditor.isEditable = editable;
|
|
29992
30531
|
}
|
|
29993
30532
|
}, [ixoEditor, editable]);
|
|
29994
|
-
|
|
30533
|
+
useEffect100(() => {
|
|
29995
30534
|
if (connectionStatus !== "connected") {
|
|
29996
30535
|
return;
|
|
29997
30536
|
}
|
|
@@ -30013,10 +30552,10 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
30013
30552
|
titleText.insert(0, options.title);
|
|
30014
30553
|
}
|
|
30015
30554
|
}, [connectionStatus, root, titleText, permissions.write, options.docId, options.title, memoizedUser.id]);
|
|
30016
|
-
const [connectedUsers, setConnectedUsers] =
|
|
30555
|
+
const [connectedUsers, setConnectedUsers] = useState121([]);
|
|
30017
30556
|
const activeBlockIdRef = useRef26(null);
|
|
30018
30557
|
const awarenessInstance = matrixProvider?.awarenessInstance ?? null;
|
|
30019
|
-
|
|
30558
|
+
useEffect100(() => {
|
|
30020
30559
|
if (!awarenessInstance || connectionStatus !== "connected") {
|
|
30021
30560
|
return;
|
|
30022
30561
|
}
|
|
@@ -30034,7 +30573,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
30034
30573
|
awarenessInstance.off("change", updateUsers);
|
|
30035
30574
|
};
|
|
30036
30575
|
}, [awarenessInstance, connectionStatus]);
|
|
30037
|
-
|
|
30576
|
+
useEffect100(() => {
|
|
30038
30577
|
if (!awarenessInstance || connectionStatus !== "connected") {
|
|
30039
30578
|
return;
|
|
30040
30579
|
}
|
|
@@ -30075,14 +30614,14 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
30075
30614
|
}
|
|
30076
30615
|
|
|
30077
30616
|
// src/mantine/IxoEditor.tsx
|
|
30078
|
-
import
|
|
30617
|
+
import React286, { useState as useState127, useEffect as useEffect106, useCallback as useCallback102 } from "react";
|
|
30079
30618
|
import { SuggestionMenuController } from "@blocknote/react";
|
|
30080
30619
|
import { BlockNoteView } from "@blocknote/mantine";
|
|
30081
30620
|
import { filterSuggestionItems } from "@blocknote/core";
|
|
30082
30621
|
import { MantineProvider } from "@mantine/core";
|
|
30083
30622
|
|
|
30084
30623
|
// src/mantine/components/PanelContent.tsx
|
|
30085
|
-
import
|
|
30624
|
+
import React278 from "react";
|
|
30086
30625
|
import { Box as Box54 } from "@mantine/core";
|
|
30087
30626
|
var panelStyles = {
|
|
30088
30627
|
light: {
|
|
@@ -30112,7 +30651,7 @@ function PanelContent({ theme }) {
|
|
|
30112
30651
|
const { activePanel, registeredPanels } = usePanelStore();
|
|
30113
30652
|
const isOpen = activePanel !== null;
|
|
30114
30653
|
const content = activePanel ? registeredPanels.get(activePanel) : null;
|
|
30115
|
-
return /* @__PURE__ */
|
|
30654
|
+
return /* @__PURE__ */ React278.createElement(
|
|
30116
30655
|
Box54,
|
|
30117
30656
|
{
|
|
30118
30657
|
pos: "sticky",
|
|
@@ -30132,8 +30671,8 @@ function PanelContent({ theme }) {
|
|
|
30132
30671
|
}
|
|
30133
30672
|
|
|
30134
30673
|
// src/mantine/components/CoverImage.tsx
|
|
30135
|
-
import
|
|
30136
|
-
import { Box as
|
|
30674
|
+
import React283, { useState as useState124, useRef as useRef27, useEffect as useEffect103, useMemo as useMemo117 } from "react";
|
|
30675
|
+
import { Box as Box58, Group as Group105 } from "@mantine/core";
|
|
30137
30676
|
|
|
30138
30677
|
// src/core/lib/imageTransform.ts
|
|
30139
30678
|
var CLOUDFLARE_CDN_BASE = "https://www.ixo.earth/cdn-cgi/image";
|
|
@@ -30266,10 +30805,10 @@ function transformIconImage(sourceUrl, size = "default", customOptions) {
|
|
|
30266
30805
|
}
|
|
30267
30806
|
|
|
30268
30807
|
// src/mantine/components/Base/CoverImageButton.tsx
|
|
30269
|
-
import
|
|
30270
|
-
import { Button as
|
|
30271
|
-
var CoverImageButton = forwardRef(({ isActive = false, onClick, children, style, ...props }, ref) => /* @__PURE__ */
|
|
30272
|
-
|
|
30808
|
+
import React279, { forwardRef } from "react";
|
|
30809
|
+
import { Button as Button49 } from "@mantine/core";
|
|
30810
|
+
var CoverImageButton = forwardRef(({ isActive = false, onClick, children, style, ...props }, ref) => /* @__PURE__ */ React279.createElement(
|
|
30811
|
+
Button49,
|
|
30273
30812
|
{
|
|
30274
30813
|
ref,
|
|
30275
30814
|
variant: "filled",
|
|
@@ -30291,8 +30830,8 @@ var CoverImageButton = forwardRef(({ isActive = false, onClick, children, style,
|
|
|
30291
30830
|
CoverImageButton.displayName = "CoverImageButton";
|
|
30292
30831
|
|
|
30293
30832
|
// src/mantine/components/Base/BaseIconPicker.tsx
|
|
30294
|
-
import
|
|
30295
|
-
import { TextInput as TextInput8, Tabs as Tabs4, Box as Box55, Stack as
|
|
30833
|
+
import React280, { useState as useState122, useMemo as useMemo115, useEffect as useEffect101 } from "react";
|
|
30834
|
+
import { TextInput as TextInput8, Tabs as Tabs4, Box as Box55, Stack as Stack187, UnstyledButton as UnstyledButton5, Text as Text161, Center as Center14, ScrollArea as ScrollArea9, Group as Group103, Popover as Popover6 } from "@mantine/core";
|
|
30296
30835
|
import * as TablerIcons from "@tabler/icons-react";
|
|
30297
30836
|
import { IconSearch as IconSearch6, IconX as IconX14, IconChevronLeft, IconChevronRight as IconChevronRight14 } from "@tabler/icons-react";
|
|
30298
30837
|
|
|
@@ -30324,28 +30863,28 @@ var localStorageService = {
|
|
|
30324
30863
|
var iconsKey = "editor_recent_icons";
|
|
30325
30864
|
var ICONS_PER_PAGE = 500;
|
|
30326
30865
|
function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children, currentIcon }) {
|
|
30327
|
-
const [searchQuery, setSearchQuery] =
|
|
30328
|
-
const [activeTab, setActiveTab] =
|
|
30329
|
-
const [currentPage, setCurrentPage] =
|
|
30330
|
-
const allIcons =
|
|
30866
|
+
const [searchQuery, setSearchQuery] = useState122("");
|
|
30867
|
+
const [activeTab, setActiveTab] = useState122("icons");
|
|
30868
|
+
const [currentPage, setCurrentPage] = useState122(1);
|
|
30869
|
+
const allIcons = useMemo115(() => {
|
|
30331
30870
|
const iconEntries = Object.entries(TablerIcons).filter(([name]) => name.startsWith("Icon") && name !== "IconProps");
|
|
30332
30871
|
return iconEntries;
|
|
30333
30872
|
}, []);
|
|
30334
|
-
const filteredIcons =
|
|
30873
|
+
const filteredIcons = useMemo115(() => {
|
|
30335
30874
|
if (!searchQuery) return allIcons;
|
|
30336
30875
|
const query = searchQuery.toLowerCase();
|
|
30337
30876
|
return allIcons.filter(([name]) => name.toLowerCase().includes(query));
|
|
30338
30877
|
}, [allIcons, searchQuery]);
|
|
30339
|
-
|
|
30878
|
+
useEffect101(() => {
|
|
30340
30879
|
setCurrentPage(1);
|
|
30341
30880
|
}, [searchQuery]);
|
|
30342
|
-
const paginatedIcons =
|
|
30881
|
+
const paginatedIcons = useMemo115(() => {
|
|
30343
30882
|
const startIndex = (currentPage - 1) * ICONS_PER_PAGE;
|
|
30344
30883
|
const endIndex = startIndex + ICONS_PER_PAGE;
|
|
30345
30884
|
return filteredIcons.slice(startIndex, endIndex);
|
|
30346
30885
|
}, [filteredIcons, currentPage]);
|
|
30347
30886
|
const totalPages = Math.ceil(filteredIcons.length / ICONS_PER_PAGE);
|
|
30348
|
-
const recentIcons =
|
|
30887
|
+
const recentIcons = useMemo115(() => {
|
|
30349
30888
|
const recentIconNames = localStorageService.get(iconsKey);
|
|
30350
30889
|
if (!recentIconNames || recentIconNames.length === 0) return [];
|
|
30351
30890
|
return recentIconNames.slice(0, 24).map((iconName) => allIcons.find(([name]) => name === iconName)).filter((entry) => entry !== void 0);
|
|
@@ -30360,9 +30899,9 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children
|
|
|
30360
30899
|
};
|
|
30361
30900
|
const renderIconGrid = (icons) => {
|
|
30362
30901
|
if (icons.length === 0) {
|
|
30363
|
-
return /* @__PURE__ */
|
|
30902
|
+
return /* @__PURE__ */ React280.createElement(Center14, { py: "xl" }, /* @__PURE__ */ React280.createElement(Text161, { c: "dimmed", size: "sm" }, "No icons found"));
|
|
30364
30903
|
}
|
|
30365
|
-
return /* @__PURE__ */
|
|
30904
|
+
return /* @__PURE__ */ React280.createElement(
|
|
30366
30905
|
Box55,
|
|
30367
30906
|
{
|
|
30368
30907
|
style: {
|
|
@@ -30374,7 +30913,7 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children
|
|
|
30374
30913
|
},
|
|
30375
30914
|
icons.map(([name, IconComponent]) => {
|
|
30376
30915
|
const isSelected = currentIcon === name.replace("Icon", "").replace(/([A-Z])/g, "-$1").toLowerCase().slice(1);
|
|
30377
|
-
return /* @__PURE__ */
|
|
30916
|
+
return /* @__PURE__ */ React280.createElement(
|
|
30378
30917
|
UnstyledButton5,
|
|
30379
30918
|
{
|
|
30380
30919
|
key: name,
|
|
@@ -30400,12 +30939,12 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children
|
|
|
30400
30939
|
}
|
|
30401
30940
|
}
|
|
30402
30941
|
},
|
|
30403
|
-
/* @__PURE__ */
|
|
30942
|
+
/* @__PURE__ */ React280.createElement(IconComponent, { color: "white", size: 24, stroke: 1.5 })
|
|
30404
30943
|
);
|
|
30405
30944
|
})
|
|
30406
30945
|
);
|
|
30407
30946
|
};
|
|
30408
|
-
return /* @__PURE__ */
|
|
30947
|
+
return /* @__PURE__ */ React280.createElement(Popover6, { opened, onClose, position: "right", width: 500, shadow: "xl" }, /* @__PURE__ */ React280.createElement(Popover6.Target, null, children), /* @__PURE__ */ React280.createElement(
|
|
30409
30948
|
Popover6.Dropdown,
|
|
30410
30949
|
{
|
|
30411
30950
|
style: {
|
|
@@ -30415,15 +30954,15 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children
|
|
|
30415
30954
|
},
|
|
30416
30955
|
p: 0
|
|
30417
30956
|
},
|
|
30418
|
-
/* @__PURE__ */
|
|
30957
|
+
/* @__PURE__ */ React280.createElement(Stack187, { gap: "md", p: "md" }, /* @__PURE__ */ React280.createElement(Tabs4, { value: activeTab, onChange: setActiveTab, variant: "pills" }, /* @__PURE__ */ React280.createElement(Tabs4.List, null, /* @__PURE__ */ React280.createElement(Tabs4.Tab, { value: "icons" }, "Icons"), /* @__PURE__ */ React280.createElement(Tabs4.Tab, { value: "upload" }, "Upload")), /* @__PURE__ */ React280.createElement(Tabs4.Panel, { value: "icons", pt: "md" }, /* @__PURE__ */ React280.createElement(
|
|
30419
30958
|
TextInput8,
|
|
30420
30959
|
{
|
|
30421
30960
|
mb: "md",
|
|
30422
30961
|
placeholder: "Filter",
|
|
30423
|
-
leftSection: /* @__PURE__ */
|
|
30962
|
+
leftSection: /* @__PURE__ */ React280.createElement(IconSearch6, { size: 18 }),
|
|
30424
30963
|
value: searchQuery,
|
|
30425
30964
|
onChange: (e) => setSearchQuery(e.currentTarget.value),
|
|
30426
|
-
rightSection: searchQuery && /* @__PURE__ */
|
|
30965
|
+
rightSection: searchQuery && /* @__PURE__ */ React280.createElement(UnstyledButton5, { onClick: () => setSearchQuery("") }, /* @__PURE__ */ React280.createElement(IconX14, { size: 18 })),
|
|
30427
30966
|
style: { flex: 1 },
|
|
30428
30967
|
styles: {
|
|
30429
30968
|
input: {
|
|
@@ -30433,26 +30972,26 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children
|
|
|
30433
30972
|
}
|
|
30434
30973
|
}
|
|
30435
30974
|
}
|
|
30436
|
-
), !searchQuery && /* @__PURE__ */
|
|
30975
|
+
), !searchQuery && /* @__PURE__ */ React280.createElement(Box55, { mb: "md" }, /* @__PURE__ */ React280.createElement(Text161, { size: "sm", fw: 500, mb: "xs", px: "xs" }, "Recent"), /* @__PURE__ */ React280.createElement(ScrollArea9.Autosize, { scrollbarSize: 0, mah: 60 }, renderIconGrid(recentIcons))), /* @__PURE__ */ React280.createElement(Box55, null, /* @__PURE__ */ React280.createElement(Group103, { justify: "space-between", mb: "xs", px: "xs" }, /* @__PURE__ */ React280.createElement(Text161, { size: "sm", fw: 500 }, searchQuery ? "Results" : "Icons"), totalPages > 1 && /* @__PURE__ */ React280.createElement(Group103, { gap: "xs" }, /* @__PURE__ */ React280.createElement(Text161, { size: "xs", c: "dimmed" }, "Page ", currentPage, " of ", totalPages, " (", filteredIcons.length, " total)"), /* @__PURE__ */ React280.createElement(BaseButton, { size: "xs", onClick: () => setCurrentPage((p) => Math.max(1, p - 1)), disabled: currentPage === 1, leftSection: /* @__PURE__ */ React280.createElement(IconChevronLeft, { size: 14 }) }, "Prev"), /* @__PURE__ */ React280.createElement(
|
|
30437
30976
|
BaseButton,
|
|
30438
30977
|
{
|
|
30439
30978
|
size: "xs",
|
|
30440
30979
|
onClick: () => setCurrentPage((p) => Math.min(totalPages, p + 1)),
|
|
30441
30980
|
disabled: currentPage === totalPages,
|
|
30442
|
-
leftSection: /* @__PURE__ */
|
|
30981
|
+
leftSection: /* @__PURE__ */ React280.createElement(IconChevronRight14, { size: 14 })
|
|
30443
30982
|
},
|
|
30444
30983
|
"Next"
|
|
30445
|
-
))), /* @__PURE__ */
|
|
30984
|
+
))), /* @__PURE__ */ React280.createElement(ScrollArea9.Autosize, { scrollbarSize: 0, mah: 200 }, renderIconGrid(paginatedIcons)))), /* @__PURE__ */ React280.createElement(Tabs4.Panel, { value: "upload", pt: "md" }, /* @__PURE__ */ React280.createElement(Center14, { py: "xl" }, /* @__PURE__ */ React280.createElement(Stack187, { align: "center", gap: "md" }, /* @__PURE__ */ React280.createElement(Text161, { size: "sm", c: "dimmed", ta: "center" }, "Upload a custom icon image", /* @__PURE__ */ React280.createElement("br", null), "(PNG, JPG, SVG)"), /* @__PURE__ */ React280.createElement(CoverImageButton, { onClick: onUploadClick }, "Choose File"))))))
|
|
30446
30985
|
));
|
|
30447
30986
|
}
|
|
30448
30987
|
|
|
30449
30988
|
// src/mantine/components/Base/PageIcon.tsx
|
|
30450
|
-
import
|
|
30989
|
+
import React281, { useMemo as useMemo116 } from "react";
|
|
30451
30990
|
import { Center as Center15, Box as Box56 } from "@mantine/core";
|
|
30452
30991
|
import * as TablerIcons2 from "@tabler/icons-react";
|
|
30453
30992
|
function PageIcon({ src, iconSize = 64, useCenter = false, style }) {
|
|
30454
30993
|
const isIconName = src && !src.startsWith("http");
|
|
30455
|
-
const IconComponent =
|
|
30994
|
+
const IconComponent = useMemo116(() => {
|
|
30456
30995
|
if (!isIconName || !src) return null;
|
|
30457
30996
|
const iconComponent = TablerIcons2[src];
|
|
30458
30997
|
if (iconComponent) {
|
|
@@ -30463,7 +31002,7 @@ function PageIcon({ src, iconSize = 64, useCenter = false, style }) {
|
|
|
30463
31002
|
const Container = useCenter ? Center15 : Box56;
|
|
30464
31003
|
if (!src) return null;
|
|
30465
31004
|
if (IconComponent) {
|
|
30466
|
-
return /* @__PURE__ */
|
|
31005
|
+
return /* @__PURE__ */ React281.createElement(
|
|
30467
31006
|
Container,
|
|
30468
31007
|
{
|
|
30469
31008
|
style: {
|
|
@@ -30475,10 +31014,10 @@ function PageIcon({ src, iconSize = 64, useCenter = false, style }) {
|
|
|
30475
31014
|
...style
|
|
30476
31015
|
}
|
|
30477
31016
|
},
|
|
30478
|
-
/* @__PURE__ */
|
|
31017
|
+
/* @__PURE__ */ React281.createElement(IconComponent, { size: iconSize, color: "white", stroke: 1.5 })
|
|
30479
31018
|
);
|
|
30480
31019
|
}
|
|
30481
|
-
return /* @__PURE__ */
|
|
31020
|
+
return /* @__PURE__ */ React281.createElement(
|
|
30482
31021
|
"img",
|
|
30483
31022
|
{
|
|
30484
31023
|
src,
|
|
@@ -30497,16 +31036,92 @@ function PageIcon({ src, iconSize = 64, useCenter = false, style }) {
|
|
|
30497
31036
|
|
|
30498
31037
|
// src/mantine/components/CoverImage.tsx
|
|
30499
31038
|
import { useDisclosure as useDisclosure7 } from "@mantine/hooks";
|
|
31039
|
+
|
|
31040
|
+
// src/mantine/components/FlowSettingsPanel.tsx
|
|
31041
|
+
import React282, { useState as useState123, useEffect as useEffect102, useCallback as useCallback100 } from "react";
|
|
31042
|
+
import { Stack as Stack188, Group as Group104, Button as Button50, ActionIcon as ActionIcon37, Text as Text162, Box as Box57 } from "@mantine/core";
|
|
31043
|
+
import { IconPlus as IconPlus11, IconTrash as IconTrash10 } from "@tabler/icons-react";
|
|
31044
|
+
var SYSTEM_KEYS = /* @__PURE__ */ new Set(["@context", "_type", "schema_version", "doc_id", "title", "createdAt", "createdBy", "flowOwnerDid"]);
|
|
31045
|
+
var FlowSettingsPanel = ({ editor }) => {
|
|
31046
|
+
const { closePanel } = usePanelStore();
|
|
31047
|
+
const [rows, setRows] = useState123([]);
|
|
31048
|
+
const loadSettings = useCallback100(() => {
|
|
31049
|
+
const metadata = editor.getFlowMetadata?.();
|
|
31050
|
+
if (!metadata) return;
|
|
31051
|
+
const customRows = [];
|
|
31052
|
+
for (const [key, value] of Object.entries(metadata)) {
|
|
31053
|
+
if (!SYSTEM_KEYS.has(key)) {
|
|
31054
|
+
customRows.push({ key, value: String(value ?? "") });
|
|
31055
|
+
}
|
|
31056
|
+
}
|
|
31057
|
+
setRows(customRows);
|
|
31058
|
+
}, [editor]);
|
|
31059
|
+
useEffect102(() => {
|
|
31060
|
+
loadSettings();
|
|
31061
|
+
}, [loadSettings]);
|
|
31062
|
+
const handleKeyChange = useCallback100(
|
|
31063
|
+
(index, newKey) => {
|
|
31064
|
+
setRows((prev) => {
|
|
31065
|
+
const updated = [...prev];
|
|
31066
|
+
const oldKey = updated[index].key;
|
|
31067
|
+
updated[index] = { ...updated[index], key: newKey };
|
|
31068
|
+
if (oldKey && oldKey !== newKey) {
|
|
31069
|
+
editor.updateFlowMetadata?.({ [oldKey]: void 0 });
|
|
31070
|
+
}
|
|
31071
|
+
if (newKey) {
|
|
31072
|
+
editor.updateFlowMetadata?.({ [newKey]: updated[index].value });
|
|
31073
|
+
}
|
|
31074
|
+
return updated;
|
|
31075
|
+
});
|
|
31076
|
+
},
|
|
31077
|
+
[editor]
|
|
31078
|
+
);
|
|
31079
|
+
const handleValueChange = useCallback100(
|
|
31080
|
+
(index, newValue) => {
|
|
31081
|
+
setRows((prev) => {
|
|
31082
|
+
const updated = [...prev];
|
|
31083
|
+
updated[index] = { ...updated[index], value: newValue };
|
|
31084
|
+
const key = updated[index].key;
|
|
31085
|
+
if (key) {
|
|
31086
|
+
editor.updateFlowMetadata?.({ [key]: newValue });
|
|
31087
|
+
}
|
|
31088
|
+
return updated;
|
|
31089
|
+
});
|
|
31090
|
+
},
|
|
31091
|
+
[editor]
|
|
31092
|
+
);
|
|
31093
|
+
const handleAdd = useCallback100(() => {
|
|
31094
|
+
setRows((prev) => [...prev, { key: "", value: "" }]);
|
|
31095
|
+
}, []);
|
|
31096
|
+
const handleDelete = useCallback100(
|
|
31097
|
+
(index) => {
|
|
31098
|
+
setRows((prev) => {
|
|
31099
|
+
const row = prev[index];
|
|
31100
|
+
if (row.key) {
|
|
31101
|
+
editor.updateFlowMetadata?.({ [row.key]: void 0 });
|
|
31102
|
+
}
|
|
31103
|
+
return prev.filter((_, i) => i !== index);
|
|
31104
|
+
});
|
|
31105
|
+
},
|
|
31106
|
+
[editor]
|
|
31107
|
+
);
|
|
31108
|
+
const subtitle = /* @__PURE__ */ React282.createElement(Box57, { px: 40, mb: "md" }, /* @__PURE__ */ React282.createElement(Text162, { size: "sm", c: "dimmed" }, "Add key-value settings for this flow. These are available to oracles and action blocks at runtime."));
|
|
31109
|
+
return /* @__PURE__ */ React282.createElement(BaseRightPanelLayout, { title: "Flow Settings", onClose: closePanel, isTemplate: true, captionContent: subtitle }, /* @__PURE__ */ React282.createElement(Stack188, { gap: "lg" }, rows.map((row, index) => /* @__PURE__ */ React282.createElement(Stack188, { key: index, gap: "xs" }, /* @__PURE__ */ React282.createElement(Group104, { gap: "xs", align: "center", wrap: "nowrap" }, /* @__PURE__ */ React282.createElement(BaseTextInput, { placeholder: "Key (e.g. protocolDid)", value: row.key, onChange: (e) => handleKeyChange(index, e.currentTarget.value), style: { flex: 1 } }), /* @__PURE__ */ React282.createElement(ActionIcon37, { variant: "subtle", color: "red", onClick: () => handleDelete(index), size: "lg" }, /* @__PURE__ */ React282.createElement(IconTrash10, { size: 16 }))), /* @__PURE__ */ React282.createElement(BaseTextArea, { placeholder: "Value", value: row.value, onChange: (e) => handleValueChange(index, e.currentTarget.value), minRows: 1, maxRows: 8 }))), /* @__PURE__ */ React282.createElement(Button50, { variant: "subtle", leftSection: /* @__PURE__ */ React282.createElement(IconPlus11, { size: 16 }), onClick: handleAdd, size: "sm" }, "Add setting")));
|
|
31110
|
+
};
|
|
31111
|
+
|
|
31112
|
+
// src/mantine/components/CoverImage.tsx
|
|
30500
31113
|
function CoverImage({ coverImageUrl, logoUrl }) {
|
|
30501
31114
|
const { editor, handlers, editable } = useBlocknoteContext();
|
|
30502
|
-
const [isHovering, setIsHovering] =
|
|
30503
|
-
const [isRepositioning, setIsRepositioning] =
|
|
30504
|
-
const [coverPosition, setCoverPosition] =
|
|
31115
|
+
const [isHovering, setIsHovering] = useState124(false);
|
|
31116
|
+
const [isRepositioning, setIsRepositioning] = useState124(false);
|
|
31117
|
+
const [coverPosition, setCoverPosition] = useState124(50);
|
|
30505
31118
|
const coverFileInputRef = useRef27(null);
|
|
30506
31119
|
const logoFileInputRef = useRef27(null);
|
|
30507
31120
|
const [opened, { open, close }] = useDisclosure7(false);
|
|
30508
|
-
const [metadata, setMetadata] =
|
|
30509
|
-
|
|
31121
|
+
const [metadata, setMetadata] = useState124(() => editor?.getPageMetadata?.() || null);
|
|
31122
|
+
const settingsPanelContent = useMemo117(() => editor ? /* @__PURE__ */ React283.createElement(FlowSettingsPanel, { editor }) : null, [editor]);
|
|
31123
|
+
const { open: openSettings } = usePanel("flow-settings-panel", settingsPanelContent);
|
|
31124
|
+
useEffect103(() => {
|
|
30510
31125
|
if (!editor?._metadataManager) {
|
|
30511
31126
|
return;
|
|
30512
31127
|
}
|
|
@@ -30588,8 +31203,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30588
31203
|
return null;
|
|
30589
31204
|
}
|
|
30590
31205
|
if (!hasCover) {
|
|
30591
|
-
return /* @__PURE__ */
|
|
30592
|
-
|
|
31206
|
+
return /* @__PURE__ */ React283.createElement(
|
|
31207
|
+
Box58,
|
|
30593
31208
|
{
|
|
30594
31209
|
style: {
|
|
30595
31210
|
position: "relative",
|
|
@@ -30601,8 +31216,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30601
31216
|
onMouseEnter: () => editable && setIsHovering(true),
|
|
30602
31217
|
onMouseLeave: () => editable && setIsHovering(false)
|
|
30603
31218
|
},
|
|
30604
|
-
/* @__PURE__ */
|
|
30605
|
-
|
|
31219
|
+
/* @__PURE__ */ React283.createElement("div", { style: { maxWidth: "900px", margin: "0 auto", position: "relative", height: "100%" } }, /* @__PURE__ */ React283.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }), /* @__PURE__ */ React283.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") }), editable && isHovering && !logoSrc && /* @__PURE__ */ React283.createElement(
|
|
31220
|
+
Group105,
|
|
30606
31221
|
{
|
|
30607
31222
|
gap: "xs",
|
|
30608
31223
|
style: {
|
|
@@ -30612,7 +31227,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30612
31227
|
zIndex: 10
|
|
30613
31228
|
}
|
|
30614
31229
|
},
|
|
30615
|
-
/* @__PURE__ */
|
|
31230
|
+
/* @__PURE__ */ React283.createElement(
|
|
30616
31231
|
BaseIconPicker,
|
|
30617
31232
|
{
|
|
30618
31233
|
opened,
|
|
@@ -30621,11 +31236,12 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30621
31236
|
onSelectIcon: (name) => handleSelectLogoIcon(name),
|
|
30622
31237
|
onUploadClick: () => logoFileInputRef.current?.click()
|
|
30623
31238
|
},
|
|
30624
|
-
/* @__PURE__ */
|
|
31239
|
+
/* @__PURE__ */ React283.createElement(CoverImageButton, { onClick: open }, "Add icon")
|
|
30625
31240
|
),
|
|
30626
|
-
/* @__PURE__ */
|
|
30627
|
-
|
|
30628
|
-
|
|
31241
|
+
/* @__PURE__ */ React283.createElement(CoverImageButton, { onClick: () => coverFileInputRef.current?.click() }, "Add cover"),
|
|
31242
|
+
/* @__PURE__ */ React283.createElement(CoverImageButton, { onClick: openSettings }, "Settings")
|
|
31243
|
+
), logoSrc && /* @__PURE__ */ React283.createElement(
|
|
31244
|
+
Box58,
|
|
30629
31245
|
{
|
|
30630
31246
|
style: {
|
|
30631
31247
|
position: "relative",
|
|
@@ -30638,8 +31254,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30638
31254
|
zIndex: 11
|
|
30639
31255
|
}
|
|
30640
31256
|
},
|
|
30641
|
-
/* @__PURE__ */
|
|
30642
|
-
editable && isHovering && /* @__PURE__ */
|
|
31257
|
+
/* @__PURE__ */ React283.createElement(PageIcon, { src: logoSrc, useCenter: true, iconSize: 64 }),
|
|
31258
|
+
editable && isHovering && /* @__PURE__ */ React283.createElement(
|
|
30643
31259
|
"div",
|
|
30644
31260
|
{
|
|
30645
31261
|
style: {
|
|
@@ -30654,7 +31270,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30654
31270
|
alignItems: "center"
|
|
30655
31271
|
}
|
|
30656
31272
|
},
|
|
30657
|
-
/* @__PURE__ */
|
|
31273
|
+
/* @__PURE__ */ React283.createElement(
|
|
30658
31274
|
BaseIconPicker,
|
|
30659
31275
|
{
|
|
30660
31276
|
opened,
|
|
@@ -30663,16 +31279,17 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30663
31279
|
onSelectIcon: (name) => handleSelectLogoIcon(name),
|
|
30664
31280
|
onUploadClick: () => logoFileInputRef.current?.click()
|
|
30665
31281
|
},
|
|
30666
|
-
/* @__PURE__ */
|
|
31282
|
+
/* @__PURE__ */ React283.createElement(CoverImageButton, { onClick: open }, "Change")
|
|
30667
31283
|
),
|
|
30668
|
-
/* @__PURE__ */
|
|
30669
|
-
/* @__PURE__ */
|
|
31284
|
+
/* @__PURE__ */ React283.createElement(CoverImageButton, { onClick: handleRemoveLogo }, "Remove"),
|
|
31285
|
+
/* @__PURE__ */ React283.createElement(CoverImageButton, { onClick: () => coverFileInputRef.current?.click() }, "Add cover"),
|
|
31286
|
+
/* @__PURE__ */ React283.createElement(CoverImageButton, { onClick: openSettings }, "Settings")
|
|
30670
31287
|
)
|
|
30671
31288
|
))
|
|
30672
31289
|
);
|
|
30673
31290
|
}
|
|
30674
|
-
return /* @__PURE__ */
|
|
30675
|
-
|
|
31291
|
+
return /* @__PURE__ */ React283.createElement(
|
|
31292
|
+
Box58,
|
|
30676
31293
|
{
|
|
30677
31294
|
style: {
|
|
30678
31295
|
position: "relative",
|
|
@@ -30691,7 +31308,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30691
31308
|
onMouseMove: handleMouseMove,
|
|
30692
31309
|
onClick: () => isRepositioning && setIsRepositioning(false)
|
|
30693
31310
|
},
|
|
30694
|
-
/* @__PURE__ */
|
|
31311
|
+
/* @__PURE__ */ React283.createElement(
|
|
30695
31312
|
"img",
|
|
30696
31313
|
{
|
|
30697
31314
|
src: coverUrl,
|
|
@@ -30709,8 +31326,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30709
31326
|
}
|
|
30710
31327
|
}
|
|
30711
31328
|
),
|
|
30712
|
-
editable && isHovering && /* @__PURE__ */
|
|
30713
|
-
|
|
31329
|
+
editable && isHovering && /* @__PURE__ */ React283.createElement(
|
|
31330
|
+
Group105,
|
|
30714
31331
|
{
|
|
30715
31332
|
gap: "xs",
|
|
30716
31333
|
style: {
|
|
@@ -30720,12 +31337,13 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30720
31337
|
zIndex: 10
|
|
30721
31338
|
}
|
|
30722
31339
|
},
|
|
30723
|
-
/* @__PURE__ */
|
|
30724
|
-
/* @__PURE__ */
|
|
30725
|
-
/* @__PURE__ */
|
|
31340
|
+
/* @__PURE__ */ React283.createElement(CoverImageButton, { onClick: () => coverFileInputRef.current?.click() }, "Change cover"),
|
|
31341
|
+
/* @__PURE__ */ React283.createElement(CoverImageButton, { onClick: () => setIsRepositioning(!isRepositioning), isActive: isRepositioning }, isRepositioning ? "Done" : "Reposition"),
|
|
31342
|
+
/* @__PURE__ */ React283.createElement(CoverImageButton, { onClick: handleRemoveCover }, "Remove"),
|
|
31343
|
+
/* @__PURE__ */ React283.createElement(CoverImageButton, { onClick: openSettings }, "Settings")
|
|
30726
31344
|
),
|
|
30727
|
-
/* @__PURE__ */
|
|
30728
|
-
|
|
31345
|
+
/* @__PURE__ */ React283.createElement("div", { style: { maxWidth: "900px", margin: "0 auto", position: "absolute", bottom: 0, left: -40, right: 0, height: "70px" } }, /* @__PURE__ */ React283.createElement(
|
|
31346
|
+
Box58,
|
|
30729
31347
|
{
|
|
30730
31348
|
style: {
|
|
30731
31349
|
position: "absolute",
|
|
@@ -30736,9 +31354,9 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30736
31354
|
zIndex: 11
|
|
30737
31355
|
}
|
|
30738
31356
|
},
|
|
30739
|
-
logoSrc && /* @__PURE__ */
|
|
30740
|
-
editable && isHovering && /* @__PURE__ */
|
|
30741
|
-
|
|
31357
|
+
logoSrc && /* @__PURE__ */ React283.createElement(PageIcon, { src: logoSrc, iconSize: 64 }),
|
|
31358
|
+
editable && isHovering && /* @__PURE__ */ React283.createElement(React283.Fragment, null, logoSrc ? /* @__PURE__ */ React283.createElement(
|
|
31359
|
+
Group105,
|
|
30742
31360
|
{
|
|
30743
31361
|
gap: "xs",
|
|
30744
31362
|
style: {
|
|
@@ -30748,7 +31366,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30748
31366
|
zIndex: 12
|
|
30749
31367
|
}
|
|
30750
31368
|
},
|
|
30751
|
-
/* @__PURE__ */
|
|
31369
|
+
/* @__PURE__ */ React283.createElement(
|
|
30752
31370
|
BaseIconPicker,
|
|
30753
31371
|
{
|
|
30754
31372
|
opened,
|
|
@@ -30757,10 +31375,10 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30757
31375
|
onSelectIcon: (name) => handleSelectLogoIcon(name),
|
|
30758
31376
|
onUploadClick: () => logoFileInputRef.current?.click()
|
|
30759
31377
|
},
|
|
30760
|
-
/* @__PURE__ */
|
|
31378
|
+
/* @__PURE__ */ React283.createElement(CoverImageButton, { onClick: open }, "Change")
|
|
30761
31379
|
),
|
|
30762
|
-
/* @__PURE__ */
|
|
30763
|
-
) : /* @__PURE__ */
|
|
31380
|
+
/* @__PURE__ */ React283.createElement(CoverImageButton, { onClick: handleRemoveLogo }, "Remove")
|
|
31381
|
+
) : /* @__PURE__ */ React283.createElement(
|
|
30764
31382
|
CoverImageButton,
|
|
30765
31383
|
{
|
|
30766
31384
|
onClick: open,
|
|
@@ -30775,13 +31393,13 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30775
31393
|
"Add icon"
|
|
30776
31394
|
))
|
|
30777
31395
|
)),
|
|
30778
|
-
/* @__PURE__ */
|
|
30779
|
-
/* @__PURE__ */
|
|
31396
|
+
/* @__PURE__ */ React283.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }),
|
|
31397
|
+
/* @__PURE__ */ React283.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") })
|
|
30780
31398
|
);
|
|
30781
31399
|
}
|
|
30782
31400
|
|
|
30783
31401
|
// src/mantine/components/PageHeader.tsx
|
|
30784
|
-
import
|
|
31402
|
+
import React284, { useState as useState125, useRef as useRef28, useEffect as useEffect104 } from "react";
|
|
30785
31403
|
function PageHeader({
|
|
30786
31404
|
title = "New page",
|
|
30787
31405
|
icon: icon2,
|
|
@@ -30793,11 +31411,11 @@ function PageHeader({
|
|
|
30793
31411
|
isFavorited = false,
|
|
30794
31412
|
menuItems = []
|
|
30795
31413
|
}) {
|
|
30796
|
-
const [isMenuOpen, setIsMenuOpen] =
|
|
30797
|
-
const [isPrivacyOpen, setIsPrivacyOpen] =
|
|
31414
|
+
const [isMenuOpen, setIsMenuOpen] = useState125(false);
|
|
31415
|
+
const [isPrivacyOpen, setIsPrivacyOpen] = useState125(false);
|
|
30798
31416
|
const menuRef = useRef28(null);
|
|
30799
31417
|
const privacyRef = useRef28(null);
|
|
30800
|
-
|
|
31418
|
+
useEffect104(() => {
|
|
30801
31419
|
function handleClickOutside(event) {
|
|
30802
31420
|
if (menuRef.current && !menuRef.current.contains(event.target)) {
|
|
30803
31421
|
setIsMenuOpen(false);
|
|
@@ -30819,7 +31437,7 @@ function PageHeader({
|
|
|
30819
31437
|
setIsMenuOpen(false);
|
|
30820
31438
|
}
|
|
30821
31439
|
};
|
|
30822
|
-
return /* @__PURE__ */
|
|
31440
|
+
return /* @__PURE__ */ React284.createElement("div", { style: styles.container }, /* @__PURE__ */ React284.createElement("div", { style: styles.leftSection }, /* @__PURE__ */ React284.createElement("span", { style: styles.icon }, icon2 || "\u{1F4C4}"), /* @__PURE__ */ React284.createElement("span", { style: styles.title }, title), /* @__PURE__ */ React284.createElement("div", { style: styles.privacyContainer, ref: privacyRef }, /* @__PURE__ */ React284.createElement("button", { style: styles.privacyBadge, onClick: () => onPrivacyChange && setIsPrivacyOpen(!isPrivacyOpen) }, /* @__PURE__ */ React284.createElement("span", { style: styles.lockIcon }, isPrivate ? "\u{1F512}" : "\u{1F310}"), /* @__PURE__ */ React284.createElement("span", null, isPrivate ? "Private" : "Public"), onPrivacyChange && /* @__PURE__ */ React284.createElement("span", { style: styles.chevron }, "\u25BE")), isPrivacyOpen && onPrivacyChange && /* @__PURE__ */ React284.createElement("div", { style: styles.dropdown }, /* @__PURE__ */ React284.createElement(
|
|
30823
31441
|
"button",
|
|
30824
31442
|
{
|
|
30825
31443
|
style: {
|
|
@@ -30831,9 +31449,9 @@ function PageHeader({
|
|
|
30831
31449
|
setIsPrivacyOpen(false);
|
|
30832
31450
|
}
|
|
30833
31451
|
},
|
|
30834
|
-
/* @__PURE__ */
|
|
30835
|
-
/* @__PURE__ */
|
|
30836
|
-
), /* @__PURE__ */
|
|
31452
|
+
/* @__PURE__ */ React284.createElement("span", { style: styles.menuItemIcon }, "\u{1F512}"),
|
|
31453
|
+
/* @__PURE__ */ React284.createElement("span", null, "Private")
|
|
31454
|
+
), /* @__PURE__ */ React284.createElement(
|
|
30837
31455
|
"button",
|
|
30838
31456
|
{
|
|
30839
31457
|
style: {
|
|
@@ -30845,9 +31463,9 @@ function PageHeader({
|
|
|
30845
31463
|
setIsPrivacyOpen(false);
|
|
30846
31464
|
}
|
|
30847
31465
|
},
|
|
30848
|
-
/* @__PURE__ */
|
|
30849
|
-
/* @__PURE__ */
|
|
30850
|
-
)))), /* @__PURE__ */
|
|
31466
|
+
/* @__PURE__ */ React284.createElement("span", { style: styles.menuItemIcon }, "\u{1F310}"),
|
|
31467
|
+
/* @__PURE__ */ React284.createElement("span", null, "Public")
|
|
31468
|
+
)))), /* @__PURE__ */ React284.createElement("div", { style: styles.rightSection }, lastEdited && /* @__PURE__ */ React284.createElement("span", { style: styles.editedText }, lastEdited), onShare && /* @__PURE__ */ React284.createElement("button", { style: styles.shareButton, onClick: onShare }, "Share"), onFavorite && /* @__PURE__ */ React284.createElement("button", { style: styles.iconButton, onClick: onFavorite }, isFavorited ? "\u2605" : "\u2606"), menuItems.length > 0 && /* @__PURE__ */ React284.createElement("div", { style: styles.menuContainer, ref: menuRef }, /* @__PURE__ */ React284.createElement("button", { style: styles.menuButton, onClick: () => setIsMenuOpen(!isMenuOpen), "aria-label": "Menu" }, /* @__PURE__ */ React284.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor" }, /* @__PURE__ */ React284.createElement("circle", { cx: "3", cy: "8", r: "1.5" }), /* @__PURE__ */ React284.createElement("circle", { cx: "8", cy: "8", r: "1.5" }), /* @__PURE__ */ React284.createElement("circle", { cx: "13", cy: "8", r: "1.5" }))), isMenuOpen && /* @__PURE__ */ React284.createElement("div", { style: styles.dropdown }, menuItems.map((item, index) => /* @__PURE__ */ React284.createElement(React284.Fragment, { key: index }, item.divider && index > 0 && /* @__PURE__ */ React284.createElement("div", { style: styles.divider }), /* @__PURE__ */ React284.createElement(
|
|
30851
31469
|
"button",
|
|
30852
31470
|
{
|
|
30853
31471
|
style: {
|
|
@@ -30857,8 +31475,8 @@ function PageHeader({
|
|
|
30857
31475
|
onClick: () => handleMenuItemClick(item),
|
|
30858
31476
|
disabled: item.disabled
|
|
30859
31477
|
},
|
|
30860
|
-
item.icon && /* @__PURE__ */
|
|
30861
|
-
/* @__PURE__ */
|
|
31478
|
+
item.icon && /* @__PURE__ */ React284.createElement("span", { style: styles.menuItemIcon }, item.icon),
|
|
31479
|
+
/* @__PURE__ */ React284.createElement("span", null, item.label)
|
|
30862
31480
|
)))))));
|
|
30863
31481
|
}
|
|
30864
31482
|
var styles = {
|
|
@@ -30995,8 +31613,8 @@ var styles = {
|
|
|
30995
31613
|
};
|
|
30996
31614
|
|
|
30997
31615
|
// src/mantine/components/ExternalDropZone.tsx
|
|
30998
|
-
import
|
|
30999
|
-
import { Box as
|
|
31616
|
+
import React285, { useCallback as useCallback101, useEffect as useEffect105, useRef as useRef29, useState as useState126 } from "react";
|
|
31617
|
+
import { Box as Box59 } from "@mantine/core";
|
|
31000
31618
|
var SCROLL_ZONE_SIZE = 80;
|
|
31001
31619
|
var SCROLL_SPEED = 12;
|
|
31002
31620
|
var ExternalDropZone = ({
|
|
@@ -31009,19 +31627,19 @@ var ExternalDropZone = ({
|
|
|
31009
31627
|
children
|
|
31010
31628
|
}) => {
|
|
31011
31629
|
const containerRef = useRef29(null);
|
|
31012
|
-
const [isValidDrag, setIsValidDrag] =
|
|
31013
|
-
const [isHoveringInPlacementMode, setIsHoveringInPlacementMode] =
|
|
31014
|
-
const [indicatorStyle, setIndicatorStyle] =
|
|
31630
|
+
const [isValidDrag, setIsValidDrag] = useState126(false);
|
|
31631
|
+
const [isHoveringInPlacementMode, setIsHoveringInPlacementMode] = useState126(false);
|
|
31632
|
+
const [indicatorStyle, setIndicatorStyle] = useState126({});
|
|
31015
31633
|
const dropPositionRef = useRef29(null);
|
|
31016
31634
|
const scrollAnimationRef = useRef29(null);
|
|
31017
31635
|
const scrollDirectionRef = useRef29(null);
|
|
31018
31636
|
const scrollContainerRef = useRef29(null);
|
|
31019
|
-
const getBlockElements =
|
|
31637
|
+
const getBlockElements = useCallback101(() => {
|
|
31020
31638
|
if (!containerRef.current) return [];
|
|
31021
31639
|
const blocks = containerRef.current.querySelectorAll('[data-node-type="blockContainer"]');
|
|
31022
31640
|
return Array.from(blocks);
|
|
31023
31641
|
}, []);
|
|
31024
|
-
const getScrollContainer =
|
|
31642
|
+
const getScrollContainer = useCallback101(() => {
|
|
31025
31643
|
if (scrollContainerRef.current) return scrollContainerRef.current;
|
|
31026
31644
|
let element = containerRef.current;
|
|
31027
31645
|
while (element) {
|
|
@@ -31036,7 +31654,7 @@ var ExternalDropZone = ({
|
|
|
31036
31654
|
scrollContainerRef.current = window;
|
|
31037
31655
|
return window;
|
|
31038
31656
|
}, []);
|
|
31039
|
-
const performScroll =
|
|
31657
|
+
const performScroll = useCallback101(() => {
|
|
31040
31658
|
const container = getScrollContainer();
|
|
31041
31659
|
const direction = scrollDirectionRef.current;
|
|
31042
31660
|
if (!direction) {
|
|
@@ -31051,7 +31669,7 @@ var ExternalDropZone = ({
|
|
|
31051
31669
|
}
|
|
31052
31670
|
scrollAnimationRef.current = requestAnimationFrame(performScroll);
|
|
31053
31671
|
}, [getScrollContainer]);
|
|
31054
|
-
const startAutoScroll =
|
|
31672
|
+
const startAutoScroll = useCallback101(
|
|
31055
31673
|
(direction) => {
|
|
31056
31674
|
if (scrollDirectionRef.current === direction) return;
|
|
31057
31675
|
scrollDirectionRef.current = direction;
|
|
@@ -31061,14 +31679,14 @@ var ExternalDropZone = ({
|
|
|
31061
31679
|
},
|
|
31062
31680
|
[performScroll]
|
|
31063
31681
|
);
|
|
31064
|
-
const stopAutoScroll =
|
|
31682
|
+
const stopAutoScroll = useCallback101(() => {
|
|
31065
31683
|
scrollDirectionRef.current = null;
|
|
31066
31684
|
if (scrollAnimationRef.current) {
|
|
31067
31685
|
cancelAnimationFrame(scrollAnimationRef.current);
|
|
31068
31686
|
scrollAnimationRef.current = null;
|
|
31069
31687
|
}
|
|
31070
31688
|
}, []);
|
|
31071
|
-
const checkAutoScroll =
|
|
31689
|
+
const checkAutoScroll = useCallback101(
|
|
31072
31690
|
(clientY) => {
|
|
31073
31691
|
const container = getScrollContainer();
|
|
31074
31692
|
let containerTop;
|
|
@@ -31091,7 +31709,7 @@ var ExternalDropZone = ({
|
|
|
31091
31709
|
},
|
|
31092
31710
|
[getScrollContainer, startAutoScroll, stopAutoScroll]
|
|
31093
31711
|
);
|
|
31094
|
-
const findDropPosition =
|
|
31712
|
+
const findDropPosition = useCallback101(
|
|
31095
31713
|
(clientY) => {
|
|
31096
31714
|
const blocks = getBlockElements();
|
|
31097
31715
|
if (blocks.length === 0 || !editor?.document) return null;
|
|
@@ -31124,7 +31742,7 @@ var ExternalDropZone = ({
|
|
|
31124
31742
|
},
|
|
31125
31743
|
[getBlockElements, editor]
|
|
31126
31744
|
);
|
|
31127
|
-
const handleDragOver =
|
|
31745
|
+
const handleDragOver = useCallback101(
|
|
31128
31746
|
(e) => {
|
|
31129
31747
|
if (!e.dataTransfer.types.includes(acceptedType)) return;
|
|
31130
31748
|
e.preventDefault();
|
|
@@ -31147,7 +31765,7 @@ var ExternalDropZone = ({
|
|
|
31147
31765
|
},
|
|
31148
31766
|
[acceptedType, findDropPosition, checkAutoScroll]
|
|
31149
31767
|
);
|
|
31150
|
-
const handleDragLeave =
|
|
31768
|
+
const handleDragLeave = useCallback101(
|
|
31151
31769
|
(e) => {
|
|
31152
31770
|
if (containerRef.current && !containerRef.current.contains(e.relatedTarget)) {
|
|
31153
31771
|
setIsValidDrag(false);
|
|
@@ -31157,7 +31775,7 @@ var ExternalDropZone = ({
|
|
|
31157
31775
|
},
|
|
31158
31776
|
[stopAutoScroll]
|
|
31159
31777
|
);
|
|
31160
|
-
const handleDrop =
|
|
31778
|
+
const handleDrop = useCallback101(
|
|
31161
31779
|
(e) => {
|
|
31162
31780
|
e.preventDefault();
|
|
31163
31781
|
e.stopPropagation();
|
|
@@ -31171,7 +31789,7 @@ var ExternalDropZone = ({
|
|
|
31171
31789
|
},
|
|
31172
31790
|
[onDrop, stopAutoScroll]
|
|
31173
31791
|
);
|
|
31174
|
-
|
|
31792
|
+
useEffect105(() => {
|
|
31175
31793
|
const handleGlobalDragEnd = () => {
|
|
31176
31794
|
setIsValidDrag(false);
|
|
31177
31795
|
dropPositionRef.current = null;
|
|
@@ -31180,7 +31798,7 @@ var ExternalDropZone = ({
|
|
|
31180
31798
|
window.addEventListener("dragend", handleGlobalDragEnd);
|
|
31181
31799
|
return () => window.removeEventListener("dragend", handleGlobalDragEnd);
|
|
31182
31800
|
}, [stopAutoScroll]);
|
|
31183
|
-
const handleOverlayMouseMove =
|
|
31801
|
+
const handleOverlayMouseMove = useCallback101(
|
|
31184
31802
|
(e) => {
|
|
31185
31803
|
setIsHoveringInPlacementMode(true);
|
|
31186
31804
|
checkAutoScroll(e.clientY);
|
|
@@ -31199,12 +31817,12 @@ var ExternalDropZone = ({
|
|
|
31199
31817
|
},
|
|
31200
31818
|
[findDropPosition, checkAutoScroll]
|
|
31201
31819
|
);
|
|
31202
|
-
const handleOverlayMouseLeave =
|
|
31820
|
+
const handleOverlayMouseLeave = useCallback101(() => {
|
|
31203
31821
|
setIsHoveringInPlacementMode(false);
|
|
31204
31822
|
dropPositionRef.current = null;
|
|
31205
31823
|
stopAutoScroll();
|
|
31206
31824
|
}, [stopAutoScroll]);
|
|
31207
|
-
const handleOverlayClick =
|
|
31825
|
+
const handleOverlayClick = useCallback101(
|
|
31208
31826
|
(e) => {
|
|
31209
31827
|
e.preventDefault();
|
|
31210
31828
|
e.stopPropagation();
|
|
@@ -31218,7 +31836,7 @@ var ExternalDropZone = ({
|
|
|
31218
31836
|
},
|
|
31219
31837
|
[onDrop, stopAutoScroll]
|
|
31220
31838
|
);
|
|
31221
|
-
const handleOverlayWheel =
|
|
31839
|
+
const handleOverlayWheel = useCallback101(
|
|
31222
31840
|
(e) => {
|
|
31223
31841
|
const container = getScrollContainer();
|
|
31224
31842
|
if (container === window) {
|
|
@@ -31229,7 +31847,7 @@ var ExternalDropZone = ({
|
|
|
31229
31847
|
},
|
|
31230
31848
|
[getScrollContainer]
|
|
31231
31849
|
);
|
|
31232
|
-
|
|
31850
|
+
useEffect105(() => {
|
|
31233
31851
|
if (!isPlacementMode) return;
|
|
31234
31852
|
const handleKeyDown = (e) => {
|
|
31235
31853
|
if (e.key === "Escape") {
|
|
@@ -31252,13 +31870,13 @@ var ExternalDropZone = ({
|
|
|
31252
31870
|
document.removeEventListener("click", handleGlobalClick, true);
|
|
31253
31871
|
};
|
|
31254
31872
|
}, [isPlacementMode, onPlacementCancel]);
|
|
31255
|
-
|
|
31873
|
+
useEffect105(() => {
|
|
31256
31874
|
if (!isPlacementMode) {
|
|
31257
31875
|
setIsHoveringInPlacementMode(false);
|
|
31258
31876
|
dropPositionRef.current = null;
|
|
31259
31877
|
}
|
|
31260
31878
|
}, [isPlacementMode]);
|
|
31261
|
-
|
|
31879
|
+
useEffect105(() => {
|
|
31262
31880
|
const isActive = isValidDrag || isPlacementMode && isHoveringInPlacementMode;
|
|
31263
31881
|
if (isActive) {
|
|
31264
31882
|
document.body.classList.add("external-artifact-drag-active");
|
|
@@ -31269,19 +31887,19 @@ var ExternalDropZone = ({
|
|
|
31269
31887
|
document.body.classList.remove("external-artifact-drag-active");
|
|
31270
31888
|
};
|
|
31271
31889
|
}, [isValidDrag, isPlacementMode, isHoveringInPlacementMode]);
|
|
31272
|
-
|
|
31890
|
+
useEffect105(() => {
|
|
31273
31891
|
return () => {
|
|
31274
31892
|
if (scrollAnimationRef.current) {
|
|
31275
31893
|
cancelAnimationFrame(scrollAnimationRef.current);
|
|
31276
31894
|
}
|
|
31277
31895
|
};
|
|
31278
31896
|
}, []);
|
|
31279
|
-
const indicatorWithPosition = dropIndicator &&
|
|
31897
|
+
const indicatorWithPosition = dropIndicator && React285.isValidElement(dropIndicator) ? React285.cloneElement(dropIndicator, {
|
|
31280
31898
|
indicatorTop: typeof indicatorStyle.top === "number" ? indicatorStyle.top : void 0
|
|
31281
31899
|
}) : dropIndicator;
|
|
31282
31900
|
const shouldShowIndicator = isValidDrag || isPlacementMode && isHoveringInPlacementMode;
|
|
31283
|
-
return /* @__PURE__ */
|
|
31284
|
-
|
|
31901
|
+
return /* @__PURE__ */ React285.createElement(
|
|
31902
|
+
Box59,
|
|
31285
31903
|
{
|
|
31286
31904
|
ref: containerRef,
|
|
31287
31905
|
style: {
|
|
@@ -31296,8 +31914,8 @@ var ExternalDropZone = ({
|
|
|
31296
31914
|
"data-placement-mode": isPlacementMode ? "true" : void 0
|
|
31297
31915
|
},
|
|
31298
31916
|
children,
|
|
31299
|
-
isPlacementMode && /* @__PURE__ */
|
|
31300
|
-
|
|
31917
|
+
isPlacementMode && /* @__PURE__ */ React285.createElement(
|
|
31918
|
+
Box59,
|
|
31301
31919
|
{
|
|
31302
31920
|
style: {
|
|
31303
31921
|
position: "absolute",
|
|
@@ -31316,7 +31934,7 @@ var ExternalDropZone = ({
|
|
|
31316
31934
|
onWheel: handleOverlayWheel
|
|
31317
31935
|
}
|
|
31318
31936
|
),
|
|
31319
|
-
shouldShowIndicator && indicatorWithPosition && /* @__PURE__ */
|
|
31937
|
+
shouldShowIndicator && indicatorWithPosition && /* @__PURE__ */ React285.createElement(Box59, { style: { ...indicatorStyle, background: "none", border: "none", boxShadow: "none" } }, indicatorWithPosition)
|
|
31320
31938
|
);
|
|
31321
31939
|
};
|
|
31322
31940
|
|
|
@@ -31342,8 +31960,8 @@ function IxoEditorContent({
|
|
|
31342
31960
|
}) {
|
|
31343
31961
|
const { activePanel } = usePanelStore();
|
|
31344
31962
|
const isPanelOpen = activePanel !== null;
|
|
31345
|
-
const [isRoomPrivate, setIsRoomPrivate] =
|
|
31346
|
-
|
|
31963
|
+
const [isRoomPrivate, setIsRoomPrivate] = useState127(pageHeaderProps?.isPrivate ?? true);
|
|
31964
|
+
useEffect106(() => {
|
|
31347
31965
|
const matrixClient = editor.getMatrixClient?.();
|
|
31348
31966
|
const roomId = editor.getRoomId?.();
|
|
31349
31967
|
if (!matrixClient || !roomId) return;
|
|
@@ -31359,7 +31977,7 @@ function IxoEditorContent({
|
|
|
31359
31977
|
} catch {
|
|
31360
31978
|
}
|
|
31361
31979
|
}, [editor]);
|
|
31362
|
-
const handlePrivacyChange =
|
|
31980
|
+
const handlePrivacyChange = useCallback102(
|
|
31363
31981
|
async (makePrivate) => {
|
|
31364
31982
|
const matrixClient = editor.getMatrixClient?.();
|
|
31365
31983
|
const roomId = editor.getRoomId?.();
|
|
@@ -31380,7 +31998,7 @@ function IxoEditorContent({
|
|
|
31380
31998
|
},
|
|
31381
31999
|
[editor]
|
|
31382
32000
|
);
|
|
31383
|
-
const editorContent = /* @__PURE__ */
|
|
32001
|
+
const editorContent = /* @__PURE__ */ React286.createElement(
|
|
31384
32002
|
BlockNoteView,
|
|
31385
32003
|
{
|
|
31386
32004
|
editor,
|
|
@@ -31395,7 +32013,7 @@ function IxoEditorContent({
|
|
|
31395
32013
|
onChange,
|
|
31396
32014
|
onSelectionChange
|
|
31397
32015
|
},
|
|
31398
|
-
config.slashMenu && /* @__PURE__ */
|
|
32016
|
+
config.slashMenu && /* @__PURE__ */ React286.createElement(
|
|
31399
32017
|
SuggestionMenuController,
|
|
31400
32018
|
{
|
|
31401
32019
|
triggerCharacter: "/",
|
|
@@ -31413,7 +32031,7 @@ function IxoEditorContent({
|
|
|
31413
32031
|
),
|
|
31414
32032
|
children
|
|
31415
32033
|
);
|
|
31416
|
-
return /* @__PURE__ */
|
|
32034
|
+
return /* @__PURE__ */ React286.createElement("div", { style: { display: "flex", height: "100%", width: "100%", gap: 0 } }, /* @__PURE__ */ React286.createElement(
|
|
31417
32035
|
"div",
|
|
31418
32036
|
{
|
|
31419
32037
|
className: `ixo-editor ixo-editor--theme-${config.theme} ${className}`,
|
|
@@ -31422,9 +32040,9 @@ function IxoEditorContent({
|
|
|
31422
32040
|
transition: "width 0.2s ease"
|
|
31423
32041
|
}
|
|
31424
32042
|
},
|
|
31425
|
-
selfNav && /* @__PURE__ */
|
|
31426
|
-
/* @__PURE__ */
|
|
31427
|
-
(onExternalDrop || isPlacementMode) && isEditable ? /* @__PURE__ */
|
|
32043
|
+
selfNav && /* @__PURE__ */ React286.createElement(PageHeader, { ...pageHeaderProps, isPrivate: isRoomPrivate, onPrivacyChange: handlePrivacyChange }),
|
|
32044
|
+
/* @__PURE__ */ React286.createElement(CoverImage, { coverImageUrl, logoUrl }),
|
|
32045
|
+
(onExternalDrop || isPlacementMode) && isEditable ? /* @__PURE__ */ React286.createElement(
|
|
31428
32046
|
ExternalDropZone,
|
|
31429
32047
|
{
|
|
31430
32048
|
editor,
|
|
@@ -31437,7 +32055,7 @@ function IxoEditorContent({
|
|
|
31437
32055
|
},
|
|
31438
32056
|
editorContent
|
|
31439
32057
|
) : editorContent
|
|
31440
|
-
), isPanelVisible && /* @__PURE__ */
|
|
32058
|
+
), isPanelVisible && /* @__PURE__ */ React286.createElement(PanelContent, { theme: config.theme }));
|
|
31441
32059
|
}
|
|
31442
32060
|
function IxoEditor({
|
|
31443
32061
|
editor,
|
|
@@ -31480,7 +32098,7 @@ function IxoEditor({
|
|
|
31480
32098
|
tableHandles: true
|
|
31481
32099
|
};
|
|
31482
32100
|
const isEditable = editable;
|
|
31483
|
-
const editorContent = /* @__PURE__ */
|
|
32101
|
+
const editorContent = /* @__PURE__ */ React286.createElement(
|
|
31484
32102
|
BlocknoteProvider,
|
|
31485
32103
|
{
|
|
31486
32104
|
editor,
|
|
@@ -31495,7 +32113,7 @@ function IxoEditor({
|
|
|
31495
32113
|
connectedUsers,
|
|
31496
32114
|
awarenessInstance
|
|
31497
32115
|
},
|
|
31498
|
-
/* @__PURE__ */
|
|
32116
|
+
/* @__PURE__ */ React286.createElement(
|
|
31499
32117
|
IxoEditorContent,
|
|
31500
32118
|
{
|
|
31501
32119
|
isPanelVisible,
|
|
@@ -31519,27 +32137,74 @@ function IxoEditor({
|
|
|
31519
32137
|
)
|
|
31520
32138
|
);
|
|
31521
32139
|
if (mantineTheme) {
|
|
31522
|
-
return /* @__PURE__ */
|
|
32140
|
+
return /* @__PURE__ */ React286.createElement(MantineProvider, { theme: mantineTheme }, editorContent);
|
|
31523
32141
|
}
|
|
31524
32142
|
return editorContent;
|
|
31525
32143
|
}
|
|
31526
32144
|
|
|
32145
|
+
// src/mantine/components/DebugButton.tsx
|
|
32146
|
+
import React287 from "react";
|
|
32147
|
+
function DebugButton({ editor }) {
|
|
32148
|
+
const yMapToObject = (map) => {
|
|
32149
|
+
if (!map) return null;
|
|
32150
|
+
const obj = {};
|
|
32151
|
+
map.forEach((value, key) => {
|
|
32152
|
+
obj[key] = value;
|
|
32153
|
+
});
|
|
32154
|
+
return Object.keys(obj).length === 0 ? "(empty)" : obj;
|
|
32155
|
+
};
|
|
32156
|
+
const handleClick = () => {
|
|
32157
|
+
const dump = {};
|
|
32158
|
+
dump.blocks = editor.document.map((block) => ({
|
|
32159
|
+
id: block.id,
|
|
32160
|
+
type: block.type,
|
|
32161
|
+
props: block.props,
|
|
32162
|
+
content: block.content,
|
|
32163
|
+
children: block.children
|
|
32164
|
+
}));
|
|
32165
|
+
dump.runtime = yMapToObject(editor._yRuntime);
|
|
32166
|
+
dump.delegations = yMapToObject(editor._yDelegations);
|
|
32167
|
+
dump.invocations = yMapToObject(editor._yInvocations);
|
|
32168
|
+
dump.flowMetadata = editor.getFlowMetadata?.() || null;
|
|
32169
|
+
dump.flowArray = editor.getFlow?.() || null;
|
|
32170
|
+
const json = JSON.stringify(dump, null, 2);
|
|
32171
|
+
console.log("Editor Debug Dump:\n" + json);
|
|
32172
|
+
};
|
|
32173
|
+
return /* @__PURE__ */ React287.createElement(
|
|
32174
|
+
"button",
|
|
32175
|
+
{
|
|
32176
|
+
onClick: handleClick,
|
|
32177
|
+
style: {
|
|
32178
|
+
position: "fixed",
|
|
32179
|
+
bottom: 16,
|
|
32180
|
+
right: 16,
|
|
32181
|
+
zIndex: 9999,
|
|
32182
|
+
padding: "8px 12px",
|
|
32183
|
+
background: "#1a1a2e",
|
|
32184
|
+
color: "#00ff88",
|
|
32185
|
+
border: "1px solid #00ff88",
|
|
32186
|
+
borderRadius: 6,
|
|
32187
|
+
fontSize: 12,
|
|
32188
|
+
fontFamily: "monospace",
|
|
32189
|
+
cursor: "pointer",
|
|
32190
|
+
opacity: 0.7
|
|
32191
|
+
},
|
|
32192
|
+
title: "Debug: Log all blocks + runtime state to console"
|
|
32193
|
+
},
|
|
32194
|
+
"Debug Y.Doc"
|
|
32195
|
+
);
|
|
32196
|
+
}
|
|
32197
|
+
|
|
31527
32198
|
// src/mantine/components/EntitySigningSetup.tsx
|
|
31528
|
-
import
|
|
31529
|
-
import { Modal as Modal3, Stack as
|
|
32199
|
+
import React288, { useState as useState128 } from "react";
|
|
32200
|
+
import { Modal as Modal3, Stack as Stack189, Text as Text163, TextInput as TextInput9, Button as Button51, Alert as Alert51, Group as Group106 } from "@mantine/core";
|
|
31530
32201
|
import { IconAlertCircle as IconAlertCircle20, IconCheck as IconCheck22, IconKey as IconKey2 } from "@tabler/icons-react";
|
|
31531
|
-
var EntitySigningSetup = ({
|
|
31532
|
-
|
|
31533
|
-
|
|
31534
|
-
|
|
31535
|
-
|
|
31536
|
-
|
|
31537
|
-
}) => {
|
|
31538
|
-
const [pin, setPin] = useState123("");
|
|
31539
|
-
const [confirmPin, setConfirmPin] = useState123("");
|
|
31540
|
-
const [loading, setLoading] = useState123(false);
|
|
31541
|
-
const [error, setError] = useState123(null);
|
|
31542
|
-
const [success, setSuccess] = useState123(false);
|
|
32202
|
+
var EntitySigningSetup = ({ opened, onClose, entityDid, entityName, onSetup }) => {
|
|
32203
|
+
const [pin, setPin] = useState128("");
|
|
32204
|
+
const [confirmPin, setConfirmPin] = useState128("");
|
|
32205
|
+
const [loading, setLoading] = useState128(false);
|
|
32206
|
+
const [error, setError] = useState128(null);
|
|
32207
|
+
const [success, setSuccess] = useState128(false);
|
|
31543
32208
|
const handleSetup = async () => {
|
|
31544
32209
|
if (pin.length < 4) {
|
|
31545
32210
|
setError("PIN must be at least 4 characters");
|
|
@@ -31579,15 +32244,15 @@ var EntitySigningSetup = ({
|
|
|
31579
32244
|
setSuccess(false);
|
|
31580
32245
|
}
|
|
31581
32246
|
};
|
|
31582
|
-
return /* @__PURE__ */
|
|
32247
|
+
return /* @__PURE__ */ React288.createElement(
|
|
31583
32248
|
Modal3,
|
|
31584
32249
|
{
|
|
31585
32250
|
opened,
|
|
31586
32251
|
onClose: handleClose,
|
|
31587
|
-
title: /* @__PURE__ */
|
|
32252
|
+
title: /* @__PURE__ */ React288.createElement(Group106, { gap: "xs" }, /* @__PURE__ */ React288.createElement(IconKey2, { size: 20 }), /* @__PURE__ */ React288.createElement(Text163, { fw: 600 }, "Entity Signing Setup")),
|
|
31588
32253
|
size: "md"
|
|
31589
32254
|
},
|
|
31590
|
-
/* @__PURE__ */
|
|
32255
|
+
/* @__PURE__ */ React288.createElement(Stack189, { gap: "md" }, success ? /* @__PURE__ */ React288.createElement(Alert51, { color: "green", icon: /* @__PURE__ */ React288.createElement(IconCheck22, { size: 16 }) }, "Entity signing key set up successfully!") : /* @__PURE__ */ React288.createElement(React288.Fragment, null, /* @__PURE__ */ React288.createElement(Text163, { size: "sm", c: "dimmed" }, "Flow authorization requires a signing key for", " ", /* @__PURE__ */ React288.createElement(Text163, { span: true, fw: 500 }, entityName || entityDid), "."), /* @__PURE__ */ React288.createElement(Alert51, { color: "blue", variant: "light" }, /* @__PURE__ */ React288.createElement(Text163, { size: "sm" }, "This is a ", /* @__PURE__ */ React288.createElement("strong", null, "one-time setup"), " that allows flows to grant permissions without requiring wallet signatures for each delegation.")), /* @__PURE__ */ React288.createElement(Stack189, { gap: "xs" }, /* @__PURE__ */ React288.createElement(Text163, { size: "sm", fw: 500 }, "What happens:"), /* @__PURE__ */ React288.createElement(Text163, { size: "sm", c: "dimmed" }, "1. A new signing key is generated"), /* @__PURE__ */ React288.createElement(Text163, { size: "sm", c: "dimmed" }, "2. Key is registered on the entity's DID document (requires wallet)"), /* @__PURE__ */ React288.createElement(Text163, { size: "sm", c: "dimmed" }, "3. Key is stored encrypted in the entity's Matrix room")), /* @__PURE__ */ React288.createElement(
|
|
31591
32256
|
TextInput9,
|
|
31592
32257
|
{
|
|
31593
32258
|
label: "Enter PIN to encrypt signing key",
|
|
@@ -31598,45 +32263,20 @@ var EntitySigningSetup = ({
|
|
|
31598
32263
|
onChange: (e) => setPin(e.currentTarget.value),
|
|
31599
32264
|
disabled: loading
|
|
31600
32265
|
}
|
|
31601
|
-
), /* @__PURE__ */
|
|
31602
|
-
TextInput9,
|
|
31603
|
-
{
|
|
31604
|
-
label: "Confirm PIN",
|
|
31605
|
-
type: "password",
|
|
31606
|
-
placeholder: "Confirm PIN",
|
|
31607
|
-
value: confirmPin,
|
|
31608
|
-
onChange: (e) => setConfirmPin(e.currentTarget.value),
|
|
31609
|
-
disabled: loading
|
|
31610
|
-
}
|
|
31611
|
-
), error && /* @__PURE__ */ React282.createElement(Alert49, { color: "red", icon: /* @__PURE__ */ React282.createElement(IconAlertCircle20, { size: 16 }) }, error), /* @__PURE__ */ React282.createElement(Group105, { justify: "flex-end", mt: "md" }, /* @__PURE__ */ React282.createElement(Button49, { variant: "subtle", onClick: handleClose, disabled: loading }, "Cancel"), /* @__PURE__ */ React282.createElement(
|
|
31612
|
-
Button49,
|
|
31613
|
-
{
|
|
31614
|
-
onClick: handleSetup,
|
|
31615
|
-
loading,
|
|
31616
|
-
leftSection: /* @__PURE__ */ React282.createElement(IconKey2, { size: 16 })
|
|
31617
|
-
},
|
|
31618
|
-
"Setup Entity Signing"
|
|
31619
|
-
))))
|
|
32266
|
+
), /* @__PURE__ */ React288.createElement(TextInput9, { label: "Confirm PIN", type: "password", placeholder: "Confirm PIN", value: confirmPin, onChange: (e) => setConfirmPin(e.currentTarget.value), disabled: loading }), error && /* @__PURE__ */ React288.createElement(Alert51, { color: "red", icon: /* @__PURE__ */ React288.createElement(IconAlertCircle20, { size: 16 }) }, error), /* @__PURE__ */ React288.createElement(Group106, { justify: "flex-end", mt: "md" }, /* @__PURE__ */ React288.createElement(Button51, { variant: "subtle", onClick: handleClose, disabled: loading }, "Cancel"), /* @__PURE__ */ React288.createElement(Button51, { onClick: handleSetup, loading, leftSection: /* @__PURE__ */ React288.createElement(IconKey2, { size: 16 }) }, "Setup Entity Signing"))))
|
|
31620
32267
|
);
|
|
31621
32268
|
};
|
|
31622
32269
|
|
|
31623
32270
|
// src/mantine/components/FlowPermissionsPanel.tsx
|
|
31624
|
-
import
|
|
31625
|
-
import { Stack as
|
|
31626
|
-
import { IconPlus as
|
|
31627
|
-
var FlowPermissionsPanel = ({
|
|
31628
|
-
|
|
31629
|
-
|
|
31630
|
-
|
|
31631
|
-
|
|
31632
|
-
|
|
31633
|
-
getUserDisplayName
|
|
31634
|
-
}) => {
|
|
31635
|
-
const [delegations, setDelegations] = useState124([]);
|
|
31636
|
-
const [loading, setLoading] = useState124(true);
|
|
31637
|
-
const [revoking, setRevoking] = useState124(null);
|
|
31638
|
-
const rootCapability = useMemo115(() => editor.getRootCapability?.(), [editor]);
|
|
31639
|
-
useEffect103(() => {
|
|
32271
|
+
import React289, { useState as useState129, useEffect as useEffect107, useMemo as useMemo118 } from "react";
|
|
32272
|
+
import { Stack as Stack190, Text as Text164, Paper as Paper18, Group as Group107, Badge as Badge43, Button as Button52, ActionIcon as ActionIcon38, Loader as Loader53, Alert as Alert52, Divider as Divider28 } from "@mantine/core";
|
|
32273
|
+
import { IconPlus as IconPlus12, IconTrash as IconTrash11, IconShieldCheck as IconShieldCheck16, IconUser as IconUser15, IconRobot as IconRobot4, IconBuilding as IconBuilding2 } from "@tabler/icons-react";
|
|
32274
|
+
var FlowPermissionsPanel = ({ editor, entityDid, entityName, onGrantPermission, onRevokePermission, getUserDisplayName }) => {
|
|
32275
|
+
const [delegations, setDelegations] = useState129([]);
|
|
32276
|
+
const [loading, setLoading] = useState129(true);
|
|
32277
|
+
const [revoking, setRevoking] = useState129(null);
|
|
32278
|
+
const rootCapability = useMemo118(() => editor.getRootCapability?.(), [editor]);
|
|
32279
|
+
useEffect107(() => {
|
|
31640
32280
|
const loadDelegations = async () => {
|
|
31641
32281
|
setLoading(true);
|
|
31642
32282
|
const allDelegations = editor.getAllDelegations?.() || [];
|
|
@@ -31675,11 +32315,11 @@ var FlowPermissionsPanel = ({
|
|
|
31675
32315
|
const getIcon2 = (type) => {
|
|
31676
32316
|
switch (type) {
|
|
31677
32317
|
case "oracle":
|
|
31678
|
-
return /* @__PURE__ */
|
|
32318
|
+
return /* @__PURE__ */ React289.createElement(IconRobot4, { size: 16 });
|
|
31679
32319
|
case "entity":
|
|
31680
|
-
return /* @__PURE__ */
|
|
32320
|
+
return /* @__PURE__ */ React289.createElement(IconBuilding2, { size: 16 });
|
|
31681
32321
|
default:
|
|
31682
|
-
return /* @__PURE__ */
|
|
32322
|
+
return /* @__PURE__ */ React289.createElement(IconUser15, { size: 16 });
|
|
31683
32323
|
}
|
|
31684
32324
|
};
|
|
31685
32325
|
const formatCapabilities = (caps) => {
|
|
@@ -31698,75 +32338,32 @@ var FlowPermissionsPanel = ({
|
|
|
31698
32338
|
if (date < /* @__PURE__ */ new Date()) return "Expired";
|
|
31699
32339
|
return date.toLocaleDateString();
|
|
31700
32340
|
};
|
|
31701
|
-
return /* @__PURE__ */
|
|
31702
|
-
ActionIcon37,
|
|
31703
|
-
{
|
|
31704
|
-
color: "red",
|
|
31705
|
-
variant: "subtle",
|
|
31706
|
-
onClick: () => handleRevoke(capability.id),
|
|
31707
|
-
loading: revoking === capability.id,
|
|
31708
|
-
disabled: !!revoking
|
|
31709
|
-
},
|
|
31710
|
-
/* @__PURE__ */ React283.createElement(IconTrash10, { size: 16 })
|
|
31711
|
-
))))), /* @__PURE__ */ React283.createElement(
|
|
31712
|
-
Button50,
|
|
31713
|
-
{
|
|
31714
|
-
leftSection: /* @__PURE__ */ React283.createElement(IconPlus11, { size: 16 }),
|
|
31715
|
-
variant: "light",
|
|
31716
|
-
onClick: onGrantPermission
|
|
31717
|
-
},
|
|
31718
|
-
"Grant Permission"
|
|
31719
|
-
));
|
|
32341
|
+
return /* @__PURE__ */ React289.createElement(Stack190, { gap: "md" }, /* @__PURE__ */ React289.createElement(Stack190, { gap: "xs" }, /* @__PURE__ */ React289.createElement(Text164, { fw: 600, size: "sm" }, "Root Authority"), /* @__PURE__ */ React289.createElement(Paper18, { p: "sm", withBorder: true }, /* @__PURE__ */ React289.createElement(Group107, { gap: "xs" }, /* @__PURE__ */ React289.createElement(IconShieldCheck16, { size: 20, color: "var(--mantine-color-green-6)" }), /* @__PURE__ */ React289.createElement(Stack190, { gap: 2, style: { flex: 1 } }, /* @__PURE__ */ React289.createElement(Text164, { size: "sm", fw: 500 }, entityName || entityDid), /* @__PURE__ */ React289.createElement(Text164, { size: "xs", c: "dimmed" }, rootCapability ? `Granted: ${new Date(rootCapability.issuedAt).toLocaleDateString()}` : "Root capability not set up")), /* @__PURE__ */ React289.createElement(Badge43, { color: "green", variant: "light" }, "Entity")))), /* @__PURE__ */ React289.createElement(Divider28, { label: "Delegated Permissions", labelPosition: "center" }), loading ? /* @__PURE__ */ React289.createElement(Group107, { justify: "center", py: "xl" }, /* @__PURE__ */ React289.createElement(Loader53, { size: "sm" })) : delegations.length === 0 ? /* @__PURE__ */ React289.createElement(Alert52, { color: "gray", variant: "light" }, /* @__PURE__ */ React289.createElement(Text164, { size: "sm" }, "No permissions have been granted yet.")) : /* @__PURE__ */ React289.createElement(Stack190, { gap: "xs" }, delegations.map(({ capability, displayName, type }) => /* @__PURE__ */ React289.createElement(Paper18, { key: capability.id, p: "sm", withBorder: true }, /* @__PURE__ */ React289.createElement(Group107, { justify: "space-between" }, /* @__PURE__ */ React289.createElement(Group107, { gap: "xs" }, getIcon2(type), /* @__PURE__ */ React289.createElement(Stack190, { gap: 2 }, /* @__PURE__ */ React289.createElement(Text164, { size: "sm", fw: 500 }, displayName), /* @__PURE__ */ React289.createElement(Text164, { size: "xs", c: "dimmed" }, formatCapabilities(capability.capabilities)), /* @__PURE__ */ React289.createElement(Group107, { gap: "xs" }, /* @__PURE__ */ React289.createElement(Text164, { size: "xs", c: "dimmed" }, "Expires: ", formatExpiration(capability.expiration)), /* @__PURE__ */ React289.createElement(Text164, { size: "xs", c: "dimmed" }, "\u2022"), /* @__PURE__ */ React289.createElement(Text164, { size: "xs", c: "dimmed" }, "Granted by: ", capability.issuer === entityDid ? "Entity" : capability.issuer.slice(-8))))), /* @__PURE__ */ React289.createElement(ActionIcon38, { color: "red", variant: "subtle", onClick: () => handleRevoke(capability.id), loading: revoking === capability.id, disabled: !!revoking }, /* @__PURE__ */ React289.createElement(IconTrash11, { size: 16 })))))), /* @__PURE__ */ React289.createElement(Button52, { leftSection: /* @__PURE__ */ React289.createElement(IconPlus12, { size: 16 }), variant: "light", onClick: onGrantPermission }, "Grant Permission"));
|
|
31720
32342
|
};
|
|
31721
32343
|
|
|
31722
32344
|
// src/mantine/components/GrantPermissionModal.tsx
|
|
31723
|
-
import
|
|
31724
|
-
import {
|
|
31725
|
-
Modal as Modal4,
|
|
31726
|
-
Stack as Stack186,
|
|
31727
|
-
Text as Text160,
|
|
31728
|
-
TextInput as TextInput10,
|
|
31729
|
-
Button as Button51,
|
|
31730
|
-
Group as Group107,
|
|
31731
|
-
Radio as Radio6,
|
|
31732
|
-
Checkbox as Checkbox13,
|
|
31733
|
-
Alert as Alert51,
|
|
31734
|
-
Paper as Paper19,
|
|
31735
|
-
Loader as Loader52,
|
|
31736
|
-
Badge as Badge44,
|
|
31737
|
-
ActionIcon as ActionIcon38,
|
|
31738
|
-
Divider as Divider29,
|
|
31739
|
-
NumberInput as NumberInput3
|
|
31740
|
-
} from "@mantine/core";
|
|
32345
|
+
import React290, { useState as useState130, useCallback as useCallback103 } from "react";
|
|
32346
|
+
import { Modal as Modal4, Stack as Stack191, Text as Text165, TextInput as TextInput10, Button as Button53, Group as Group108, Radio as Radio6, Checkbox as Checkbox13, Alert as Alert53, Paper as Paper19, Loader as Loader54, Badge as Badge44, ActionIcon as ActionIcon39, Divider as Divider29, NumberInput as NumberInput3 } from "@mantine/core";
|
|
31741
32347
|
import { IconSearch as IconSearch7, IconUser as IconUser16, IconRobot as IconRobot5, IconX as IconX15, IconShieldPlus as IconShieldPlus4 } from "@tabler/icons-react";
|
|
31742
|
-
var GrantPermissionModal = ({
|
|
31743
|
-
opened,
|
|
31744
|
-
onClose,
|
|
31745
|
-
flowUri,
|
|
31746
|
-
blocks,
|
|
31747
|
-
targetBlockId,
|
|
31748
|
-
searchUsers,
|
|
31749
|
-
getOracles,
|
|
31750
|
-
onGrant
|
|
31751
|
-
}) => {
|
|
32348
|
+
var GrantPermissionModal = ({ opened, onClose, flowUri, blocks, targetBlockId, searchUsers, getOracles, onGrant }) => {
|
|
31752
32349
|
const singleBlockMode = !!targetBlockId || blocks.length === 1;
|
|
31753
32350
|
const fixedBlockId = targetBlockId || (blocks.length === 1 ? blocks[0].id : null);
|
|
31754
32351
|
const fixedBlock = fixedBlockId ? blocks.find((b) => b.id === fixedBlockId) || blocks[0] : null;
|
|
31755
|
-
const [recipientType, setRecipientType] =
|
|
31756
|
-
const [searchQuery, setSearchQuery] =
|
|
31757
|
-
const [searchResults, setSearchResults] =
|
|
31758
|
-
const [searching, setSearching] =
|
|
31759
|
-
const [selectedRecipient, setSelectedRecipient] =
|
|
31760
|
-
const [manualDid, setManualDid] =
|
|
31761
|
-
const [scopeType, setScopeType] =
|
|
31762
|
-
const [selectedBlocks, setSelectedBlocks] =
|
|
31763
|
-
const [expirationEnabled, setExpirationEnabled] =
|
|
31764
|
-
const [expirationDays, setExpirationDays] =
|
|
31765
|
-
const [canDelegate, setCanDelegate] =
|
|
31766
|
-
const [pin, setPin] =
|
|
31767
|
-
const [loading, setLoading] =
|
|
31768
|
-
const [error, setError] =
|
|
31769
|
-
const handleSearch =
|
|
32352
|
+
const [recipientType, setRecipientType] = useState130("user");
|
|
32353
|
+
const [searchQuery, setSearchQuery] = useState130("");
|
|
32354
|
+
const [searchResults, setSearchResults] = useState130([]);
|
|
32355
|
+
const [searching, setSearching] = useState130(false);
|
|
32356
|
+
const [selectedRecipient, setSelectedRecipient] = useState130(null);
|
|
32357
|
+
const [manualDid, setManualDid] = useState130("");
|
|
32358
|
+
const [scopeType, setScopeType] = useState130("full");
|
|
32359
|
+
const [selectedBlocks, setSelectedBlocks] = useState130([]);
|
|
32360
|
+
const [expirationEnabled, setExpirationEnabled] = useState130(false);
|
|
32361
|
+
const [expirationDays, setExpirationDays] = useState130(30);
|
|
32362
|
+
const [canDelegate, setCanDelegate] = useState130(false);
|
|
32363
|
+
const [pin, setPin] = useState130("");
|
|
32364
|
+
const [loading, setLoading] = useState130(false);
|
|
32365
|
+
const [error, setError] = useState130(null);
|
|
32366
|
+
const handleSearch = useCallback103(async () => {
|
|
31770
32367
|
if (searchQuery.length < 2) return;
|
|
31771
32368
|
setSearching(true);
|
|
31772
32369
|
try {
|
|
@@ -31853,52 +32450,41 @@ var GrantPermissionModal = ({
|
|
|
31853
32450
|
resetForm();
|
|
31854
32451
|
}
|
|
31855
32452
|
};
|
|
31856
|
-
return /* @__PURE__ */
|
|
32453
|
+
return /* @__PURE__ */ React290.createElement(
|
|
31857
32454
|
Modal4,
|
|
31858
32455
|
{
|
|
31859
32456
|
opened,
|
|
31860
32457
|
onClose: handleClose,
|
|
31861
|
-
title: /* @__PURE__ */
|
|
32458
|
+
title: /* @__PURE__ */ React290.createElement(Group108, { gap: "xs" }, /* @__PURE__ */ React290.createElement(IconShieldPlus4, { size: 20 }), /* @__PURE__ */ React290.createElement(Text165, { fw: 600 }, "Grant Permission")),
|
|
31862
32459
|
size: "lg"
|
|
31863
32460
|
},
|
|
31864
|
-
/* @__PURE__ */
|
|
31865
|
-
|
|
31866
|
-
|
|
31867
|
-
|
|
31868
|
-
|
|
32461
|
+
/* @__PURE__ */ React290.createElement(Stack191, { gap: "md" }, /* @__PURE__ */ React290.createElement(Stack191, { gap: "xs" }, /* @__PURE__ */ React290.createElement(Text165, { size: "sm", fw: 500 }, "Recipient Type"), /* @__PURE__ */ React290.createElement(
|
|
32462
|
+
Radio6.Group,
|
|
32463
|
+
{
|
|
32464
|
+
value: recipientType,
|
|
32465
|
+
onChange: (v) => {
|
|
32466
|
+
setRecipientType(v);
|
|
32467
|
+
setSelectedRecipient(null);
|
|
32468
|
+
setSearchResults([]);
|
|
32469
|
+
}
|
|
32470
|
+
},
|
|
32471
|
+
/* @__PURE__ */ React290.createElement(Group108, null, /* @__PURE__ */ React290.createElement(Radio6, { value: "user", label: "User" }), /* @__PURE__ */ React290.createElement(Radio6, { value: "oracle", label: "Oracle" }), /* @__PURE__ */ React290.createElement(Radio6, { value: "manual", label: "Enter DID" }))
|
|
32472
|
+
)), recipientType !== "manual" ? /* @__PURE__ */ React290.createElement(Stack191, { gap: "xs" }, /* @__PURE__ */ React290.createElement(
|
|
31869
32473
|
TextInput10,
|
|
31870
32474
|
{
|
|
31871
32475
|
placeholder: recipientType === "oracle" ? "Search oracles..." : "Search users...",
|
|
31872
|
-
leftSection: /* @__PURE__ */
|
|
31873
|
-
rightSection: searching ? /* @__PURE__ */
|
|
32476
|
+
leftSection: /* @__PURE__ */ React290.createElement(IconSearch7, { size: 16 }),
|
|
32477
|
+
rightSection: searching ? /* @__PURE__ */ React290.createElement(Loader54, { size: 14 }) : null,
|
|
31874
32478
|
value: searchQuery,
|
|
31875
32479
|
onChange: (e) => setSearchQuery(e.currentTarget.value),
|
|
31876
32480
|
onKeyDown: (e) => e.key === "Enter" && handleSearch()
|
|
31877
32481
|
}
|
|
31878
|
-
), selectedRecipient ? /* @__PURE__ */
|
|
31879
|
-
Button51,
|
|
31880
|
-
{
|
|
31881
|
-
key: result.did,
|
|
31882
|
-
variant: "subtle",
|
|
31883
|
-
size: "sm",
|
|
31884
|
-
justify: "flex-start",
|
|
31885
|
-
onClick: () => setSelectedRecipient(result)
|
|
31886
|
-
},
|
|
31887
|
-
result.displayName
|
|
31888
|
-
)))) : null) : /* @__PURE__ */ React284.createElement(
|
|
31889
|
-
TextInput10,
|
|
31890
|
-
{
|
|
31891
|
-
label: "Recipient DID",
|
|
31892
|
-
placeholder: "did:ixo:...",
|
|
31893
|
-
value: manualDid,
|
|
31894
|
-
onChange: (e) => setManualDid(e.currentTarget.value)
|
|
31895
|
-
}
|
|
31896
|
-
), /* @__PURE__ */ React284.createElement(Divider29, null), /* @__PURE__ */ React284.createElement(Stack186, { gap: "xs" }, /* @__PURE__ */ React284.createElement(Text160, { size: "sm", fw: 500 }, "Permission Scope"), singleBlockMode && fixedBlock ? (
|
|
32482
|
+
), selectedRecipient ? /* @__PURE__ */ React290.createElement(Paper19, { p: "sm", withBorder: true }, /* @__PURE__ */ React290.createElement(Group108, { justify: "space-between" }, /* @__PURE__ */ React290.createElement(Group108, { gap: "xs" }, recipientType === "oracle" ? /* @__PURE__ */ React290.createElement(IconRobot5, { size: 16 }) : /* @__PURE__ */ React290.createElement(IconUser16, { size: 16 }), /* @__PURE__ */ React290.createElement(Text165, { size: "sm" }, selectedRecipient.displayName), /* @__PURE__ */ React290.createElement(Badge44, { size: "xs", variant: "light" }, selectedRecipient.did.slice(-12))), /* @__PURE__ */ React290.createElement(ActionIcon39, { size: "sm", variant: "subtle", onClick: () => setSelectedRecipient(null) }, /* @__PURE__ */ React290.createElement(IconX15, { size: 14 })))) : searchResults.length > 0 ? /* @__PURE__ */ React290.createElement(Paper19, { p: "xs", withBorder: true, style: { maxHeight: 150, overflow: "auto" } }, /* @__PURE__ */ React290.createElement(Stack191, { gap: 4 }, searchResults.map((result) => /* @__PURE__ */ React290.createElement(Button53, { key: result.did, variant: "subtle", size: "sm", justify: "flex-start", onClick: () => setSelectedRecipient(result) }, result.displayName)))) : null) : /* @__PURE__ */ React290.createElement(TextInput10, { label: "Recipient DID", placeholder: "did:ixo:...", value: manualDid, onChange: (e) => setManualDid(e.currentTarget.value) }), /* @__PURE__ */ React290.createElement(Divider29, null), /* @__PURE__ */ React290.createElement(Stack191, { gap: "xs" }, /* @__PURE__ */ React290.createElement(Text165, { size: "sm", fw: 500 }, "Permission Scope"), singleBlockMode && fixedBlock ? (
|
|
31897
32483
|
// Single block mode: show fixed block info
|
|
31898
|
-
/* @__PURE__ */
|
|
32484
|
+
/* @__PURE__ */ React290.createElement(Paper19, { p: "sm", withBorder: true }, /* @__PURE__ */ React290.createElement(Group108, { gap: "xs" }, /* @__PURE__ */ React290.createElement(Badge44, { variant: "light", color: "blue" }, fixedBlock.type), /* @__PURE__ */ React290.createElement(Text165, { size: "sm" }, fixedBlock.name || `Block ${fixedBlock.id.slice(-8)}`)), /* @__PURE__ */ React290.createElement(Text165, { size: "xs", c: "dimmed", mt: "xs" }, "Permission will be granted to execute this specific block."))
|
|
31899
32485
|
) : (
|
|
31900
32486
|
// Multi-block mode: show scope selection
|
|
31901
|
-
/* @__PURE__ */
|
|
32487
|
+
/* @__PURE__ */ React290.createElement(React290.Fragment, null, /* @__PURE__ */ React290.createElement(Radio6.Group, { value: scopeType, onChange: (v) => setScopeType(v) }, /* @__PURE__ */ React290.createElement(Stack191, { gap: "xs" }, /* @__PURE__ */ React290.createElement(Radio6, { value: "full", label: "Full flow access (can execute any block)" }), /* @__PURE__ */ React290.createElement(Radio6, { value: "blocks", label: "Specific blocks only" }))), scopeType === "blocks" && /* @__PURE__ */ React290.createElement(Paper19, { p: "sm", withBorder: true, style: { maxHeight: 150, overflow: "auto" } }, /* @__PURE__ */ React290.createElement(Stack191, { gap: "xs" }, blocks.map((block) => /* @__PURE__ */ React290.createElement(
|
|
31902
32488
|
Checkbox13,
|
|
31903
32489
|
{
|
|
31904
32490
|
key: block.id,
|
|
@@ -31913,24 +32499,7 @@ var GrantPermissionModal = ({
|
|
|
31913
32499
|
}
|
|
31914
32500
|
}
|
|
31915
32501
|
)))))
|
|
31916
|
-
)), /* @__PURE__ */
|
|
31917
|
-
Checkbox13,
|
|
31918
|
-
{
|
|
31919
|
-
label: "Set expiration",
|
|
31920
|
-
checked: expirationEnabled,
|
|
31921
|
-
onChange: (e) => setExpirationEnabled(e.currentTarget.checked)
|
|
31922
|
-
}
|
|
31923
|
-
), expirationEnabled && /* @__PURE__ */ React284.createElement(
|
|
31924
|
-
NumberInput3,
|
|
31925
|
-
{
|
|
31926
|
-
label: "Expires in (days)",
|
|
31927
|
-
placeholder: "30",
|
|
31928
|
-
value: expirationDays,
|
|
31929
|
-
onChange: setExpirationDays,
|
|
31930
|
-
min: 1,
|
|
31931
|
-
max: 365
|
|
31932
|
-
}
|
|
31933
|
-
)), /* @__PURE__ */ React284.createElement(
|
|
32502
|
+
)), /* @__PURE__ */ React290.createElement(Divider29, null), /* @__PURE__ */ React290.createElement(Stack191, { gap: "xs" }, /* @__PURE__ */ React290.createElement(Checkbox13, { label: "Set expiration", checked: expirationEnabled, onChange: (e) => setExpirationEnabled(e.currentTarget.checked) }), expirationEnabled && /* @__PURE__ */ React290.createElement(NumberInput3, { label: "Expires in (days)", placeholder: "30", value: expirationDays, onChange: setExpirationDays, min: 1, max: 365 })), /* @__PURE__ */ React290.createElement(
|
|
31934
32503
|
Checkbox13,
|
|
31935
32504
|
{
|
|
31936
32505
|
label: "Recipient can grant permissions to others",
|
|
@@ -31938,16 +32507,7 @@ var GrantPermissionModal = ({
|
|
|
31938
32507
|
checked: canDelegate,
|
|
31939
32508
|
onChange: (e) => setCanDelegate(e.currentTarget.checked)
|
|
31940
32509
|
}
|
|
31941
|
-
), /* @__PURE__ */
|
|
31942
|
-
TextInput10,
|
|
31943
|
-
{
|
|
31944
|
-
label: "Enter your PIN to sign this delegation",
|
|
31945
|
-
type: "password",
|
|
31946
|
-
placeholder: "PIN",
|
|
31947
|
-
value: pin,
|
|
31948
|
-
onChange: (e) => setPin(e.currentTarget.value)
|
|
31949
|
-
}
|
|
31950
|
-
), error && /* @__PURE__ */ React284.createElement(Alert51, { color: "red" }, error), /* @__PURE__ */ React284.createElement(Group107, { justify: "flex-end" }, /* @__PURE__ */ React284.createElement(Button51, { variant: "subtle", onClick: handleClose, disabled: loading }, "Cancel"), /* @__PURE__ */ React284.createElement(Button51, { onClick: handleGrant, loading }, "Grant Permission")))
|
|
32510
|
+
), /* @__PURE__ */ React290.createElement(Divider29, null), /* @__PURE__ */ React290.createElement(TextInput10, { label: "Enter your PIN to sign this delegation", type: "password", placeholder: "PIN", value: pin, onChange: (e) => setPin(e.currentTarget.value) }), error && /* @__PURE__ */ React290.createElement(Alert53, { color: "red" }, error), /* @__PURE__ */ React290.createElement(Group108, { justify: "flex-end" }, /* @__PURE__ */ React290.createElement(Button53, { variant: "subtle", onClick: handleClose, disabled: loading }, "Cancel"), /* @__PURE__ */ React290.createElement(Button53, { onClick: handleGrant, loading }, "Grant Permission")))
|
|
31951
32511
|
);
|
|
31952
32512
|
};
|
|
31953
32513
|
|
|
@@ -32039,6 +32599,7 @@ export {
|
|
|
32039
32599
|
PageHeader,
|
|
32040
32600
|
ExternalDropZone,
|
|
32041
32601
|
IxoEditor,
|
|
32602
|
+
DebugButton,
|
|
32042
32603
|
EvaluationTab,
|
|
32043
32604
|
EntitySigningSetup,
|
|
32044
32605
|
FlowPermissionsPanel,
|
|
@@ -32056,4 +32617,4 @@ export {
|
|
|
32056
32617
|
getExtraSlashMenuItems,
|
|
32057
32618
|
useCreateIxoEditor
|
|
32058
32619
|
};
|
|
32059
|
-
//# sourceMappingURL=chunk-
|
|
32620
|
+
//# sourceMappingURL=chunk-3AD37CJI.mjs.map
|