@ixo/editor 3.0.0-beta.25 → 3.0.0-beta.26
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/{chunk-TLYT3OAQ.mjs → chunk-K75BAQDR.mjs} +430 -376
- package/dist/chunk-K75BAQDR.mjs.map +1 -0
- package/dist/{chunk-3RYZSIC2.mjs → chunk-SUFKRSSM.mjs} +89 -1
- package/dist/chunk-SUFKRSSM.mjs.map +1 -0
- package/dist/core/index.mjs +1 -1
- package/dist/index.mjs +2 -2
- package/dist/mantine/index.mjs +7 -6
- package/package.json +10 -3
- package/dist/chunk-3RYZSIC2.mjs.map +0 -1
- package/dist/chunk-TLYT3OAQ.mjs.map +0 -1
|
@@ -15,8 +15,9 @@ import {
|
|
|
15
15
|
getAllActions,
|
|
16
16
|
isActorAuthorized,
|
|
17
17
|
parseLinkedEntities,
|
|
18
|
+
sendDirectMessage,
|
|
18
19
|
transformSurveyToCredentialSubject
|
|
19
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-SUFKRSSM.mjs";
|
|
20
21
|
|
|
21
22
|
// src/mantine/hooks/useCreateIxoEditor.ts
|
|
22
23
|
import { useCreateBlockNote } from "@blocknote/react";
|
|
@@ -1380,62 +1381,6 @@ var addLinkedEntityAction = {
|
|
|
1380
1381
|
}
|
|
1381
1382
|
};
|
|
1382
1383
|
|
|
1383
|
-
// src/core/lib/matrixDm.ts
|
|
1384
|
-
function getHomeserver(matrixClient) {
|
|
1385
|
-
const userId = matrixClient.getUserId();
|
|
1386
|
-
if (!userId) throw new Error("Matrix client has no user ID");
|
|
1387
|
-
const idx = userId.indexOf(":");
|
|
1388
|
-
if (idx === -1) throw new Error(`Invalid Matrix user ID: ${userId}`);
|
|
1389
|
-
return userId.substring(idx + 1);
|
|
1390
|
-
}
|
|
1391
|
-
function didToMatrixUserId(did, homeserver) {
|
|
1392
|
-
const localpart = did.replace(/:/g, "-");
|
|
1393
|
-
return `@${localpart}:${homeserver}`;
|
|
1394
|
-
}
|
|
1395
|
-
async function findOrCreateDMRoom(matrixClient, targetUserId) {
|
|
1396
|
-
try {
|
|
1397
|
-
const directEvent = matrixClient.getAccountData("m.direct");
|
|
1398
|
-
const directContent = directEvent?.getContent() || {};
|
|
1399
|
-
const existingRooms = directContent[targetUserId];
|
|
1400
|
-
if (existingRooms && existingRooms.length > 0) {
|
|
1401
|
-
return existingRooms[0];
|
|
1402
|
-
}
|
|
1403
|
-
} catch {
|
|
1404
|
-
}
|
|
1405
|
-
const response = await matrixClient.createRoom({
|
|
1406
|
-
is_direct: true,
|
|
1407
|
-
invite: [targetUserId],
|
|
1408
|
-
preset: "trusted_private_chat",
|
|
1409
|
-
initial_state: []
|
|
1410
|
-
});
|
|
1411
|
-
const roomId = response.room_id;
|
|
1412
|
-
try {
|
|
1413
|
-
const directEvent = matrixClient.getAccountData("m.direct");
|
|
1414
|
-
const directContent = directEvent?.getContent() || {};
|
|
1415
|
-
const updatedContent = {
|
|
1416
|
-
...directContent,
|
|
1417
|
-
[targetUserId]: [...directContent[targetUserId] || [], roomId]
|
|
1418
|
-
};
|
|
1419
|
-
await matrixClient.setAccountData("m.direct", updatedContent);
|
|
1420
|
-
} catch (error) {
|
|
1421
|
-
console.warn("[MatrixDM] Failed to update m.direct account data:", error);
|
|
1422
|
-
}
|
|
1423
|
-
return roomId;
|
|
1424
|
-
}
|
|
1425
|
-
async function sendMatrixMessage(matrixClient, roomId, message) {
|
|
1426
|
-
await matrixClient.sendEvent(roomId, "m.room.message", {
|
|
1427
|
-
msgtype: "m.text",
|
|
1428
|
-
body: message
|
|
1429
|
-
});
|
|
1430
|
-
}
|
|
1431
|
-
async function sendDirectMessage(matrixClient, targetDid, message) {
|
|
1432
|
-
const homeserver = getHomeserver(matrixClient);
|
|
1433
|
-
const targetUserId = didToMatrixUserId(targetDid, homeserver);
|
|
1434
|
-
const roomId = await findOrCreateDMRoom(matrixClient, targetUserId);
|
|
1435
|
-
await sendMatrixMessage(matrixClient, roomId, message);
|
|
1436
|
-
return { roomId };
|
|
1437
|
-
}
|
|
1438
|
-
|
|
1439
1384
|
// src/mantine/blocks/hooks/hookedActions/actionTypes/sendMatrixDM.ts
|
|
1440
1385
|
var sendMatrixDMAction = {
|
|
1441
1386
|
type: "sendMatrixDM",
|
|
@@ -22905,11 +22850,11 @@ var FlowLinkBlockSpec = createReactBlockSpec19(
|
|
|
22905
22850
|
);
|
|
22906
22851
|
|
|
22907
22852
|
// src/mantine/blocks/action/ActionBlockSpec.tsx
|
|
22908
|
-
import
|
|
22853
|
+
import React270 from "react";
|
|
22909
22854
|
import { createReactBlockSpec as createReactBlockSpec20 } from "@blocknote/react";
|
|
22910
22855
|
|
|
22911
22856
|
// src/mantine/blocks/action/ActionBlock.tsx
|
|
22912
|
-
import
|
|
22857
|
+
import React269 from "react";
|
|
22913
22858
|
|
|
22914
22859
|
// src/mantine/blocks/action/template/TemplateView.tsx
|
|
22915
22860
|
import React234, { useMemo as useMemo85 } from "react";
|
|
@@ -22941,7 +22886,8 @@ import {
|
|
|
22941
22886
|
IconSignature as IconSignature3,
|
|
22942
22887
|
IconBuildingEstate,
|
|
22943
22888
|
IconShieldCheck as IconShieldCheck12,
|
|
22944
|
-
IconCash
|
|
22889
|
+
IconCash,
|
|
22890
|
+
IconMessageCircle
|
|
22945
22891
|
} from "@tabler/icons-react";
|
|
22946
22892
|
|
|
22947
22893
|
// src/mantine/components/Base/BaseIconCombobox.tsx
|
|
@@ -23102,6 +23048,11 @@ var ACTION_TYPE_META = {
|
|
|
23102
23048
|
label: "Payment",
|
|
23103
23049
|
description: "Calculate, propose, and execute a payment",
|
|
23104
23050
|
icon: icon(IconCash, COMBO_ICON_SIZE)
|
|
23051
|
+
},
|
|
23052
|
+
"matrix.dm": {
|
|
23053
|
+
label: "Matrix DM",
|
|
23054
|
+
description: "Send a direct message via Matrix",
|
|
23055
|
+
icon: icon(IconMessageCircle, COMBO_ICON_SIZE)
|
|
23105
23056
|
}
|
|
23106
23057
|
};
|
|
23107
23058
|
function getActionMeta(actionType) {
|
|
@@ -29027,12 +28978,119 @@ registerActionTypeUI("payment", {
|
|
|
29027
28978
|
flowDetailComponent: PaymentFlowDetail
|
|
29028
28979
|
});
|
|
29029
28980
|
|
|
28981
|
+
// src/mantine/blocks/action/actionTypes/matrixDm/MatrixDmConfig.tsx
|
|
28982
|
+
import React268, { useCallback as useCallback99, useEffect as useEffect98, useMemo as useMemo108, useState as useState120 } from "react";
|
|
28983
|
+
import { Flex as Flex32, Stack as Stack188, Text as Text158 } from "@mantine/core";
|
|
28984
|
+
|
|
28985
|
+
// src/mantine/blocks/action/actionTypes/matrixDm/types.ts
|
|
28986
|
+
function parseMatrixDmInputs(json) {
|
|
28987
|
+
try {
|
|
28988
|
+
const parsed = typeof json === "string" ? JSON.parse(json) : json;
|
|
28989
|
+
return {
|
|
28990
|
+
targetDid: parsed?.targetDid || "",
|
|
28991
|
+
message: parsed?.message || ""
|
|
28992
|
+
};
|
|
28993
|
+
} catch {
|
|
28994
|
+
return {
|
|
28995
|
+
targetDid: "",
|
|
28996
|
+
message: ""
|
|
28997
|
+
};
|
|
28998
|
+
}
|
|
28999
|
+
}
|
|
29000
|
+
function serializeMatrixDmInputs(inputs) {
|
|
29001
|
+
return JSON.stringify(inputs);
|
|
29002
|
+
}
|
|
29003
|
+
|
|
29004
|
+
// src/mantine/blocks/action/actionTypes/matrixDm/MatrixDmConfig.tsx
|
|
29005
|
+
var MatrixDmConfig = ({ inputs, onInputsChange, editor }) => {
|
|
29006
|
+
const handlers = useBlocknoteHandlers();
|
|
29007
|
+
const [local, setLocal] = useState120(() => parseMatrixDmInputs(inputs));
|
|
29008
|
+
const [roomMembers, setRoomMembers] = useState120([]);
|
|
29009
|
+
const [searchValue, setSearchValue] = useState120("");
|
|
29010
|
+
const roomId = editor?.getRoomId?.() || null;
|
|
29011
|
+
const mx = editor?.getMatrixClient?.() || null;
|
|
29012
|
+
useEffect98(() => {
|
|
29013
|
+
setLocal(parseMatrixDmInputs(inputs));
|
|
29014
|
+
}, [inputs]);
|
|
29015
|
+
useEffect98(() => {
|
|
29016
|
+
(async () => {
|
|
29017
|
+
if (!roomId || !mx) return;
|
|
29018
|
+
try {
|
|
29019
|
+
const members = await handlers.getRoomMembers(roomId, mx);
|
|
29020
|
+
setRoomMembers(members);
|
|
29021
|
+
} catch (error) {
|
|
29022
|
+
console.error("MatrixDmConfig: Failed to fetch room members:", error);
|
|
29023
|
+
}
|
|
29024
|
+
})();
|
|
29025
|
+
}, [roomId, mx]);
|
|
29026
|
+
const update = useCallback99(
|
|
29027
|
+
(patch) => {
|
|
29028
|
+
const updated = { ...local, ...patch };
|
|
29029
|
+
setLocal(updated);
|
|
29030
|
+
onInputsChange(serializeMatrixDmInputs(updated));
|
|
29031
|
+
},
|
|
29032
|
+
[local, onInputsChange]
|
|
29033
|
+
);
|
|
29034
|
+
const selectData = useMemo108(() => {
|
|
29035
|
+
return roomMembers.map((member) => ({
|
|
29036
|
+
value: member.did,
|
|
29037
|
+
label: member.name || member.did
|
|
29038
|
+
}));
|
|
29039
|
+
}, [roomMembers]);
|
|
29040
|
+
const memberLookup = useMemo108(() => {
|
|
29041
|
+
const lookup = {};
|
|
29042
|
+
roomMembers.forEach((member) => {
|
|
29043
|
+
lookup[member.did] = member;
|
|
29044
|
+
});
|
|
29045
|
+
return lookup;
|
|
29046
|
+
}, [roomMembers]);
|
|
29047
|
+
const selectedMember = local.targetDid ? memberLookup[local.targetDid] : void 0;
|
|
29048
|
+
return /* @__PURE__ */ React268.createElement(Stack188, { gap: "md" }, /* @__PURE__ */ React268.createElement(
|
|
29049
|
+
BaseSelect,
|
|
29050
|
+
{
|
|
29051
|
+
label: "Recipient",
|
|
29052
|
+
description: "Select a person from this flow or search by name",
|
|
29053
|
+
placeholder: "Search for a recipient...",
|
|
29054
|
+
searchable: true,
|
|
29055
|
+
value: local.targetDid || null,
|
|
29056
|
+
onChange: (value) => update({ targetDid: value || "" }),
|
|
29057
|
+
searchValue,
|
|
29058
|
+
onSearchChange: setSearchValue,
|
|
29059
|
+
data: selectData,
|
|
29060
|
+
clearable: true,
|
|
29061
|
+
required: true,
|
|
29062
|
+
renderOption: ({ option, checked }) => {
|
|
29063
|
+
const member = memberLookup[option.value];
|
|
29064
|
+
if (!member) return /* @__PURE__ */ React268.createElement(Text158, { size: "sm" }, option.label);
|
|
29065
|
+
return /* @__PURE__ */ React268.createElement(Flex32, { align: "center", gap: "sm" }, /* @__PURE__ */ React268.createElement(BaseAvatar, { src: member.src, did: member.did, size: 24 }), /* @__PURE__ */ React268.createElement(Text158, { size: "sm", c: checked ? "accent" : void 0 }, option.label));
|
|
29066
|
+
},
|
|
29067
|
+
leftSection: selectedMember ? /* @__PURE__ */ React268.createElement(BaseAvatar, { src: selectedMember.src, did: selectedMember.did, size: 20, withCenter: true }) : null
|
|
29068
|
+
}
|
|
29069
|
+
), /* @__PURE__ */ React268.createElement(
|
|
29070
|
+
BaseTextArea,
|
|
29071
|
+
{
|
|
29072
|
+
label: "Message",
|
|
29073
|
+
description: "The message to send as a direct message",
|
|
29074
|
+
placeholder: "Enter the message to send...",
|
|
29075
|
+
value: local.message,
|
|
29076
|
+
onChange: (event) => update({ message: event.currentTarget.value }),
|
|
29077
|
+
minRows: 3,
|
|
29078
|
+
required: true
|
|
29079
|
+
}
|
|
29080
|
+
));
|
|
29081
|
+
};
|
|
29082
|
+
|
|
29083
|
+
// src/mantine/blocks/action/actionTypes/matrixDm/index.ts
|
|
29084
|
+
registerActionTypeUI("matrix.dm", {
|
|
29085
|
+
configComponent: MatrixDmConfig
|
|
29086
|
+
});
|
|
29087
|
+
|
|
29030
29088
|
// src/mantine/blocks/action/ActionBlock.tsx
|
|
29031
29089
|
function ActionBlock({ editor, block }) {
|
|
29032
29090
|
const { docType } = useBlocknoteContext();
|
|
29033
29091
|
const { actions } = useBlockConditions(block, editor);
|
|
29034
29092
|
if (docType === "template") {
|
|
29035
|
-
return /* @__PURE__ */
|
|
29093
|
+
return /* @__PURE__ */ React269.createElement(ActionTemplateView, { editor, block });
|
|
29036
29094
|
}
|
|
29037
29095
|
const conditionConfig = parseConditionConfig(block.props.conditions);
|
|
29038
29096
|
const hasVisibility = hasVisibilityConditions(conditionConfig);
|
|
@@ -29043,7 +29101,7 @@ function ActionBlock({ editor, block }) {
|
|
|
29043
29101
|
const hasEnable = hasEnableConditions(conditionConfig);
|
|
29044
29102
|
const enableActionExists = actions.some((a) => a.action === "enable");
|
|
29045
29103
|
const shouldDisable = hasEnable && !enableActionExists;
|
|
29046
|
-
return /* @__PURE__ */
|
|
29104
|
+
return /* @__PURE__ */ React269.createElement(
|
|
29047
29105
|
ActionFlowView,
|
|
29048
29106
|
{
|
|
29049
29107
|
block,
|
|
@@ -29119,36 +29177,36 @@ var ActionBlockSpec = createReactBlockSpec20(
|
|
|
29119
29177
|
{
|
|
29120
29178
|
render: (props) => {
|
|
29121
29179
|
const ixoProps = props;
|
|
29122
|
-
return /* @__PURE__ */
|
|
29180
|
+
return /* @__PURE__ */ React270.createElement(ActionBlock, { ...ixoProps });
|
|
29123
29181
|
}
|
|
29124
29182
|
}
|
|
29125
29183
|
);
|
|
29126
29184
|
|
|
29127
29185
|
// src/mantine/blocks/location/LocationBlockSpec.tsx
|
|
29128
|
-
import
|
|
29186
|
+
import React279 from "react";
|
|
29129
29187
|
import { createReactBlockSpec as createReactBlockSpec21 } from "@blocknote/react";
|
|
29130
29188
|
|
|
29131
29189
|
// src/mantine/blocks/location/LocationBlock.tsx
|
|
29132
|
-
import
|
|
29190
|
+
import React278 from "react";
|
|
29133
29191
|
|
|
29134
29192
|
// src/mantine/blocks/location/template/TemplateView.tsx
|
|
29135
|
-
import
|
|
29136
|
-
import { Group as Group101, Stack as
|
|
29193
|
+
import React275, { useMemo as useMemo109 } from "react";
|
|
29194
|
+
import { Group as Group101, Stack as Stack190, Text as Text161 } from "@mantine/core";
|
|
29137
29195
|
import { IconMapPin } from "@tabler/icons-react";
|
|
29138
29196
|
|
|
29139
29197
|
// src/mantine/blocks/location/template/TemplateConfig.tsx
|
|
29140
|
-
import
|
|
29198
|
+
import React273, { useCallback as useCallback101 } from "react";
|
|
29141
29199
|
import { IconSettings as IconSettings19 } from "@tabler/icons-react";
|
|
29142
29200
|
|
|
29143
29201
|
// src/mantine/blocks/location/template/GeneralTab.tsx
|
|
29144
|
-
import
|
|
29145
|
-
import { Box as Box52, Divider as Divider28, Stack as
|
|
29202
|
+
import React272, { useEffect as useEffect100, useRef as useRef23, useState as useState123 } from "react";
|
|
29203
|
+
import { Box as Box52, Divider as Divider28, Stack as Stack189, Text as Text159 } from "@mantine/core";
|
|
29146
29204
|
|
|
29147
29205
|
// src/core/hooks/useUnlMap.ts
|
|
29148
|
-
import { useEffect as
|
|
29206
|
+
import { useEffect as useEffect99, useState as useState121 } from "react";
|
|
29149
29207
|
function useUnlMap() {
|
|
29150
|
-
const [status, setStatus] =
|
|
29151
|
-
|
|
29208
|
+
const [status, setStatus] = useState121("loading");
|
|
29209
|
+
useEffect99(() => {
|
|
29152
29210
|
if (typeof window === "undefined") {
|
|
29153
29211
|
return;
|
|
29154
29212
|
}
|
|
@@ -29203,7 +29261,7 @@ function useUnlMap() {
|
|
|
29203
29261
|
}
|
|
29204
29262
|
|
|
29205
29263
|
// src/mantine/blocks/location/components/TileSelector.tsx
|
|
29206
|
-
import
|
|
29264
|
+
import React271, { useState as useState122, useCallback as useCallback100 } from "react";
|
|
29207
29265
|
import { ActionIcon as ActionIcon36, Group as Group100, Tooltip as Tooltip22 } from "@mantine/core";
|
|
29208
29266
|
import { IconMap, IconMoon, IconSatellite, IconMountain } from "@tabler/icons-react";
|
|
29209
29267
|
var TILE_LAYERS = {
|
|
@@ -29256,8 +29314,8 @@ function ensureLayer(map, config) {
|
|
|
29256
29314
|
);
|
|
29257
29315
|
}
|
|
29258
29316
|
var TileSelector = ({ mapRef }) => {
|
|
29259
|
-
const [active, setActive] =
|
|
29260
|
-
const switchTo =
|
|
29317
|
+
const [active, setActive] = useState122("map");
|
|
29318
|
+
const switchTo = useCallback100(
|
|
29261
29319
|
(type) => {
|
|
29262
29320
|
const map = mapRef.current;
|
|
29263
29321
|
if (!map || active === type) return;
|
|
@@ -29275,10 +29333,10 @@ var TileSelector = ({ mapRef }) => {
|
|
|
29275
29333
|
[mapRef, active]
|
|
29276
29334
|
);
|
|
29277
29335
|
const items = [
|
|
29278
|
-
{ type: "map", label: "Map", icon: /* @__PURE__ */
|
|
29336
|
+
{ type: "map", label: "Map", icon: /* @__PURE__ */ React271.createElement(IconMap, { size: 14 }) },
|
|
29279
29337
|
...OVERLAY_KEYS.map((key) => ({ type: key, label: TILE_LAYERS[key].label, icon: TILE_LAYERS[key].icon }))
|
|
29280
29338
|
];
|
|
29281
|
-
return /* @__PURE__ */
|
|
29339
|
+
return /* @__PURE__ */ React271.createElement(
|
|
29282
29340
|
Group100,
|
|
29283
29341
|
{
|
|
29284
29342
|
gap: 2,
|
|
@@ -29292,7 +29350,7 @@ var TileSelector = ({ mapRef }) => {
|
|
|
29292
29350
|
padding: 2
|
|
29293
29351
|
}
|
|
29294
29352
|
},
|
|
29295
|
-
items.map(({ type, label, icon: icon2 }) => /* @__PURE__ */
|
|
29353
|
+
items.map(({ type, label, icon: icon2 }) => /* @__PURE__ */ React271.createElement(Tooltip22, { key: type, label, withArrow: true }, /* @__PURE__ */ React271.createElement(
|
|
29296
29354
|
ActionIcon36,
|
|
29297
29355
|
{
|
|
29298
29356
|
variant: active === type ? "filled" : "subtle",
|
|
@@ -29313,22 +29371,22 @@ var DEFAULT_CENTER = [0, 20];
|
|
|
29313
29371
|
var DEFAULT_ZOOM = 2;
|
|
29314
29372
|
var PLACED_ZOOM = 14;
|
|
29315
29373
|
var GeneralTab17 = ({ title, description, latitude, longitude, onTitleChange, onDescriptionChange, onCoordinatesChange }) => {
|
|
29316
|
-
const [localTitle, setLocalTitle] =
|
|
29317
|
-
const [localDescription, setLocalDescription] =
|
|
29318
|
-
const [mapError, setMapError] =
|
|
29374
|
+
const [localTitle, setLocalTitle] = useState123(title);
|
|
29375
|
+
const [localDescription, setLocalDescription] = useState123(description);
|
|
29376
|
+
const [mapError, setMapError] = useState123(null);
|
|
29319
29377
|
const { status, UnlSdk } = useUnlMap();
|
|
29320
29378
|
const { mapConfig } = useBlocknoteContext();
|
|
29321
29379
|
const markerRef = useRef23(null);
|
|
29322
29380
|
const mapRef = useRef23(null);
|
|
29323
29381
|
const wrapperRef = useRef23(null);
|
|
29324
29382
|
const containerRef = useRef23(null);
|
|
29325
|
-
|
|
29383
|
+
useEffect100(() => {
|
|
29326
29384
|
setLocalTitle(title);
|
|
29327
29385
|
}, [title]);
|
|
29328
|
-
|
|
29386
|
+
useEffect100(() => {
|
|
29329
29387
|
setLocalDescription(description);
|
|
29330
29388
|
}, [description]);
|
|
29331
|
-
|
|
29389
|
+
useEffect100(() => {
|
|
29332
29390
|
if (status !== "ready" || !UnlSdk || mapRef.current || !mapConfig || !containerRef.current || !wrapperRef.current) return;
|
|
29333
29391
|
try {
|
|
29334
29392
|
const hasCoords = latitude && longitude;
|
|
@@ -29378,7 +29436,7 @@ var GeneralTab17 = ({ title, description, latitude, longitude, onTitleChange, on
|
|
|
29378
29436
|
markerRef.current = null;
|
|
29379
29437
|
};
|
|
29380
29438
|
}, [status, UnlSdk]);
|
|
29381
|
-
return /* @__PURE__ */
|
|
29439
|
+
return /* @__PURE__ */ React272.createElement(Stack189, { gap: "lg" }, /* @__PURE__ */ React272.createElement(Stack189, { gap: "xs" }, /* @__PURE__ */ React272.createElement(Text159, { size: "sm", fw: 600 }, "Title"), /* @__PURE__ */ React272.createElement(
|
|
29382
29440
|
BaseTextInput,
|
|
29383
29441
|
{
|
|
29384
29442
|
placeholder: "e.g. Project Location",
|
|
@@ -29389,7 +29447,7 @@ var GeneralTab17 = ({ title, description, latitude, longitude, onTitleChange, on
|
|
|
29389
29447
|
onTitleChange(v);
|
|
29390
29448
|
}
|
|
29391
29449
|
}
|
|
29392
|
-
)), /* @__PURE__ */
|
|
29450
|
+
)), /* @__PURE__ */ React272.createElement(Stack189, { gap: "xs" }, /* @__PURE__ */ React272.createElement(Text159, { size: "sm", fw: 600 }, "Description"), /* @__PURE__ */ React272.createElement(
|
|
29393
29451
|
BaseTextInput,
|
|
29394
29452
|
{
|
|
29395
29453
|
placeholder: "e.g. Main project site coordinates",
|
|
@@ -29400,7 +29458,7 @@ var GeneralTab17 = ({ title, description, latitude, longitude, onTitleChange, on
|
|
|
29400
29458
|
onDescriptionChange(v);
|
|
29401
29459
|
}
|
|
29402
29460
|
}
|
|
29403
|
-
)), /* @__PURE__ */
|
|
29461
|
+
)), /* @__PURE__ */ React272.createElement(Divider28, { variant: "dashed" }), /* @__PURE__ */ React272.createElement(Stack189, { gap: "xs" }, /* @__PURE__ */ React272.createElement(Text159, { size: "sm", fw: 600 }, "Location"), /* @__PURE__ */ React272.createElement(Text159, { size: "xs", c: "dimmed" }, "Click on the map to set the location."), mapError ? /* @__PURE__ */ React272.createElement(Text159, { size: "sm", c: "red" }, mapError) : /* @__PURE__ */ React272.createElement(Box52, { ref: wrapperRef, mx: "auto", w: "100%", miw: 280, h: 300, style: { borderRadius: 12, position: "relative", overflow: "hidden" } }, /* @__PURE__ */ React272.createElement(
|
|
29404
29462
|
Box52,
|
|
29405
29463
|
{
|
|
29406
29464
|
ref: containerRef,
|
|
@@ -29413,19 +29471,19 @@ var GeneralTab17 = ({ title, description, latitude, longitude, onTitleChange, on
|
|
|
29413
29471
|
height: "600px"
|
|
29414
29472
|
}
|
|
29415
29473
|
}
|
|
29416
|
-
), /* @__PURE__ */
|
|
29474
|
+
), /* @__PURE__ */ React272.createElement(TileSelector, { mapRef }))), /* @__PURE__ */ React272.createElement(Stack189, { gap: "xs" }, /* @__PURE__ */ React272.createElement(BaseTextInput, { label: "Latitude", value: latitude, readOnly: true, placeholder: "Not set" }), /* @__PURE__ */ React272.createElement(BaseTextInput, { label: "Longitude", value: longitude, readOnly: true, placeholder: "Not set" })));
|
|
29417
29475
|
};
|
|
29418
29476
|
|
|
29419
29477
|
// src/mantine/blocks/location/template/TemplateConfig.tsx
|
|
29420
29478
|
var TemplateConfig17 = ({ editor, block }) => {
|
|
29421
29479
|
const { closePanel } = usePanelStore();
|
|
29422
|
-
const updateProp =
|
|
29480
|
+
const updateProp = useCallback101(
|
|
29423
29481
|
(key, value) => {
|
|
29424
29482
|
editor.updateBlock(block, { props: { ...block.props, [key]: value } });
|
|
29425
29483
|
},
|
|
29426
29484
|
[editor, block]
|
|
29427
29485
|
);
|
|
29428
|
-
const updateProps =
|
|
29486
|
+
const updateProps = useCallback101(
|
|
29429
29487
|
(updates) => {
|
|
29430
29488
|
editor.updateBlock(block, { props: { ...block.props, ...updates } });
|
|
29431
29489
|
},
|
|
@@ -29436,7 +29494,7 @@ var TemplateConfig17 = ({ editor, block }) => {
|
|
|
29436
29494
|
label: "General",
|
|
29437
29495
|
value: "general",
|
|
29438
29496
|
icon: icon(IconSettings19),
|
|
29439
|
-
content: /* @__PURE__ */
|
|
29497
|
+
content: /* @__PURE__ */ React273.createElement(
|
|
29440
29498
|
GeneralTab17,
|
|
29441
29499
|
{
|
|
29442
29500
|
title: block.props.title || "",
|
|
@@ -29450,21 +29508,21 @@ var TemplateConfig17 = ({ editor, block }) => {
|
|
|
29450
29508
|
)
|
|
29451
29509
|
}
|
|
29452
29510
|
];
|
|
29453
|
-
return /* @__PURE__ */
|
|
29511
|
+
return /* @__PURE__ */ React273.createElement(BaseRightPanelLayout, { title: "Location Settings", onClose: closePanel, tabs, context: { editor, block } });
|
|
29454
29512
|
};
|
|
29455
29513
|
|
|
29456
29514
|
// src/mantine/blocks/location/components/LocationMap.tsx
|
|
29457
|
-
import
|
|
29458
|
-
import { Box as Box53, Flex as
|
|
29515
|
+
import React274, { useEffect as useEffect101, useRef as useRef24, useState as useState124 } from "react";
|
|
29516
|
+
import { Box as Box53, Flex as Flex33, Loader as Loader53, Text as Text160 } from "@mantine/core";
|
|
29459
29517
|
var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker = true, showTilesControl = false }) => {
|
|
29460
|
-
const [mapError, setMapError] =
|
|
29518
|
+
const [mapError, setMapError] = useState124(null);
|
|
29461
29519
|
const { mapConfig } = useBlocknoteContext();
|
|
29462
29520
|
const wrapperRef = useRef24(null);
|
|
29463
29521
|
const containerRef = useRef24(null);
|
|
29464
29522
|
const mapRef = useRef24(null);
|
|
29465
29523
|
const markerRef = useRef24(null);
|
|
29466
29524
|
const { status, UnlSdk } = useUnlMap();
|
|
29467
|
-
|
|
29525
|
+
useEffect101(() => {
|
|
29468
29526
|
if (status !== "ready" || !UnlSdk || mapRef.current || !containerRef.current || !wrapperRef.current) return;
|
|
29469
29527
|
let ro;
|
|
29470
29528
|
let resizeTimer;
|
|
@@ -29495,7 +29553,7 @@ var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker =
|
|
|
29495
29553
|
ro?.disconnect();
|
|
29496
29554
|
};
|
|
29497
29555
|
}, [status, UnlSdk, mapConfig]);
|
|
29498
|
-
|
|
29556
|
+
useEffect101(() => {
|
|
29499
29557
|
if (!mapRef.current || !latitude || !longitude) return;
|
|
29500
29558
|
const coords = [Number(longitude), Number(latitude)];
|
|
29501
29559
|
mapRef.current.setCenter(coords);
|
|
@@ -29504,7 +29562,7 @@ var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker =
|
|
|
29504
29562
|
}
|
|
29505
29563
|
}, [latitude, longitude, showMarker]);
|
|
29506
29564
|
if (status === "loading") {
|
|
29507
|
-
return /* @__PURE__ */
|
|
29565
|
+
return /* @__PURE__ */ React274.createElement(
|
|
29508
29566
|
Box53,
|
|
29509
29567
|
{
|
|
29510
29568
|
style: {
|
|
@@ -29516,11 +29574,11 @@ var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker =
|
|
|
29516
29574
|
w,
|
|
29517
29575
|
h
|
|
29518
29576
|
},
|
|
29519
|
-
/* @__PURE__ */
|
|
29577
|
+
/* @__PURE__ */ React274.createElement(Loader53, null)
|
|
29520
29578
|
);
|
|
29521
29579
|
}
|
|
29522
29580
|
if (status === "error" || mapError) {
|
|
29523
|
-
return /* @__PURE__ */
|
|
29581
|
+
return /* @__PURE__ */ React274.createElement(
|
|
29524
29582
|
Box53,
|
|
29525
29583
|
{
|
|
29526
29584
|
style: {
|
|
@@ -29532,10 +29590,10 @@ var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker =
|
|
|
29532
29590
|
w,
|
|
29533
29591
|
h
|
|
29534
29592
|
},
|
|
29535
|
-
/* @__PURE__ */
|
|
29593
|
+
/* @__PURE__ */ React274.createElement(Text160, { size: "sm", c: "red" }, mapError || "Failed to load map")
|
|
29536
29594
|
);
|
|
29537
29595
|
}
|
|
29538
|
-
return /* @__PURE__ */
|
|
29596
|
+
return /* @__PURE__ */ React274.createElement(Box53, { ref: wrapperRef, style: { position: "relative", borderRadius: 16, overflow: "hidden" }, w, h }, /* @__PURE__ */ React274.createElement(
|
|
29539
29597
|
Box53,
|
|
29540
29598
|
{
|
|
29541
29599
|
ref: containerRef,
|
|
@@ -29548,55 +29606,55 @@ var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker =
|
|
|
29548
29606
|
height: "600px"
|
|
29549
29607
|
}
|
|
29550
29608
|
}
|
|
29551
|
-
), showTilesControl && /* @__PURE__ */
|
|
29609
|
+
), showTilesControl && /* @__PURE__ */ React274.createElement(TileSelector, { mapRef }));
|
|
29552
29610
|
};
|
|
29553
29611
|
function LocationMap(props) {
|
|
29554
29612
|
if (props.latitude === void 0 || props.longitude === void 0)
|
|
29555
|
-
return /* @__PURE__ */
|
|
29556
|
-
return /* @__PURE__ */
|
|
29613
|
+
return /* @__PURE__ */ React274.createElement(Flex33, { w: "100%", h: 200, align: "center", justify: "center" }, /* @__PURE__ */ React274.createElement(Loader53, null));
|
|
29614
|
+
return /* @__PURE__ */ React274.createElement(UnlMap, { ...props });
|
|
29557
29615
|
}
|
|
29558
29616
|
|
|
29559
29617
|
// src/mantine/blocks/location/template/TemplateView.tsx
|
|
29560
29618
|
var LOCATION_TEMPLATE_PANEL_ID = "location-template-panel";
|
|
29561
29619
|
var LocationTemplateView = ({ editor, block }) => {
|
|
29562
29620
|
const panelId = `${LOCATION_TEMPLATE_PANEL_ID}-${block.id}`;
|
|
29563
|
-
const panelContent =
|
|
29621
|
+
const panelContent = useMemo109(() => /* @__PURE__ */ React275.createElement(TemplateConfig17, { editor, block }), [editor, block]);
|
|
29564
29622
|
const { open } = usePanel(panelId, panelContent);
|
|
29565
29623
|
console.log("block.props:", block.props);
|
|
29566
29624
|
const hasLocation = block.props.latitude && block.props.longitude;
|
|
29567
|
-
return /* @__PURE__ */
|
|
29625
|
+
return /* @__PURE__ */ React275.createElement(BaseContainer, { blockId: block.id, onClick: open, style: { minHeight: 90, justifyContent: "center" } }, /* @__PURE__ */ React275.createElement(Stack190, { gap: "xs", justify: "center" }, /* @__PURE__ */ React275.createElement(Group101, { wrap: "nowrap", align: "center" }, /* @__PURE__ */ React275.createElement(IconMapPin, { color: "white", size: 26, stroke: 1.5 }), /* @__PURE__ */ React275.createElement(Stack190, { gap: 2 }, /* @__PURE__ */ React275.createElement(Text161, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "Location"), block.props.description && /* @__PURE__ */ React275.createElement(Text161, { size: "xs", c: "dimmed", contentEditable: false }, block.props.description))), hasLocation && /* @__PURE__ */ React275.createElement(LocationMap, { latitude: block.props.latitude, longitude: block.props.longitude, mapId: `location-template-map-${block.id}`, zoom: 14, showMarker: true, showTilesControl: true })));
|
|
29568
29626
|
};
|
|
29569
29627
|
|
|
29570
29628
|
// src/mantine/blocks/location/flow/FlowView.tsx
|
|
29571
|
-
import
|
|
29572
|
-
import { Center as Center12, Group as Group102, Stack as
|
|
29629
|
+
import React277, { useMemo as useMemo110 } from "react";
|
|
29630
|
+
import { Center as Center12, Group as Group102, Stack as Stack191, Text as Text162 } from "@mantine/core";
|
|
29573
29631
|
import { IconMapPin as IconMapPin2 } from "@tabler/icons-react";
|
|
29574
29632
|
|
|
29575
29633
|
// src/mantine/blocks/location/flow/FlowConfig.tsx
|
|
29576
|
-
import
|
|
29634
|
+
import React276 from "react";
|
|
29577
29635
|
var FlowConfig3 = ({ block }) => {
|
|
29578
29636
|
const { closePanel } = usePanelStore();
|
|
29579
29637
|
const hasLocation = block.props.latitude && block.props.longitude;
|
|
29580
|
-
return /* @__PURE__ */
|
|
29638
|
+
return /* @__PURE__ */ React276.createElement(BaseRightPanelLayout, { title: block.props.title || "Location", onClose: closePanel, isTemplate: false }, hasLocation ? /* @__PURE__ */ React276.createElement(LocationMap, { latitude: block.props.latitude, longitude: block.props.longitude, h: 600, zoom: 14, showMarker: true, showTilesControl: true }) : null);
|
|
29581
29639
|
};
|
|
29582
29640
|
|
|
29583
29641
|
// src/mantine/blocks/location/flow/FlowView.tsx
|
|
29584
29642
|
var LOCATION_FLOW_PANEL_ID = "location-flow-panel";
|
|
29585
29643
|
var LocationFlowView = ({ editor, block }) => {
|
|
29586
29644
|
const panelId = `${LOCATION_FLOW_PANEL_ID}-${block.id}`;
|
|
29587
|
-
const panelContent =
|
|
29645
|
+
const panelContent = useMemo110(() => /* @__PURE__ */ React277.createElement(FlowConfig3, { editor, block }), [editor, block]);
|
|
29588
29646
|
const { open } = usePanel(panelId, panelContent);
|
|
29589
29647
|
const hasLocation = block.props.latitude && block.props.longitude;
|
|
29590
|
-
return /* @__PURE__ */
|
|
29648
|
+
return /* @__PURE__ */ React277.createElement(BaseContainer, { blockId: block.id, onClick: open, style: { minHeight: 90, justifyContent: "center" } }, /* @__PURE__ */ React277.createElement(Stack191, { gap: "xs", justify: "center" }, /* @__PURE__ */ React277.createElement(Group102, { wrap: "nowrap", align: "center" }, /* @__PURE__ */ React277.createElement(IconMapPin2, { color: "white", size: 26, stroke: 1.5 }), /* @__PURE__ */ React277.createElement(Stack191, { gap: 2 }, /* @__PURE__ */ React277.createElement(Text162, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "Location"), block.props.description && /* @__PURE__ */ React277.createElement(Text162, { size: "xs", c: "dimmed", contentEditable: false }, block.props.description))), hasLocation ? /* @__PURE__ */ React277.createElement(LocationMap, { latitude: block.props.latitude, longitude: block.props.longitude, mapId: `location-flow-map-${block.id}`, zoom: 14, showMarker: true, showTilesControl: true }) : /* @__PURE__ */ React277.createElement(Center12, { py: "md" }, /* @__PURE__ */ React277.createElement(Text162, { size: "sm", c: "dimmed" }, "Location not configured"))));
|
|
29591
29649
|
};
|
|
29592
29650
|
|
|
29593
29651
|
// src/mantine/blocks/location/LocationBlock.tsx
|
|
29594
29652
|
function LocationBlock({ editor, block }) {
|
|
29595
29653
|
const { docType } = useBlocknoteContext();
|
|
29596
29654
|
if (docType === "template" || docType === "page") {
|
|
29597
|
-
return /* @__PURE__ */
|
|
29655
|
+
return /* @__PURE__ */ React278.createElement(LocationTemplateView, { editor, block });
|
|
29598
29656
|
}
|
|
29599
|
-
return /* @__PURE__ */
|
|
29657
|
+
return /* @__PURE__ */ React278.createElement(LocationFlowView, { editor, block });
|
|
29600
29658
|
}
|
|
29601
29659
|
|
|
29602
29660
|
// src/mantine/blocks/location/LocationBlockSpec.tsx
|
|
@@ -29615,29 +29673,29 @@ var LocationBlockSpec = createReactBlockSpec21(
|
|
|
29615
29673
|
{
|
|
29616
29674
|
render: (props) => {
|
|
29617
29675
|
const ixoProps = props;
|
|
29618
|
-
return /* @__PURE__ */
|
|
29676
|
+
return /* @__PURE__ */ React279.createElement(LocationBlock, { ...ixoProps });
|
|
29619
29677
|
}
|
|
29620
29678
|
}
|
|
29621
29679
|
);
|
|
29622
29680
|
|
|
29623
29681
|
// src/mantine/blocks/embed/EmbedBlockSpec.tsx
|
|
29624
|
-
import
|
|
29682
|
+
import React286 from "react";
|
|
29625
29683
|
import { createReactBlockSpec as createReactBlockSpec22 } from "@blocknote/react";
|
|
29626
29684
|
|
|
29627
29685
|
// src/mantine/blocks/embed/EmbedBlock.tsx
|
|
29628
|
-
import
|
|
29686
|
+
import React285 from "react";
|
|
29629
29687
|
|
|
29630
29688
|
// src/mantine/blocks/embed/template/TemplateView.tsx
|
|
29631
|
-
import
|
|
29632
|
-
import { Box as Box54, Group as Group103, Stack as
|
|
29689
|
+
import React282, { useMemo as useMemo111 } from "react";
|
|
29690
|
+
import { Box as Box54, Group as Group103, Stack as Stack193, Text as Text164 } from "@mantine/core";
|
|
29633
29691
|
|
|
29634
29692
|
// src/mantine/blocks/embed/template/TemplateConfig.tsx
|
|
29635
|
-
import
|
|
29693
|
+
import React281, { useCallback as useCallback102 } from "react";
|
|
29636
29694
|
import { IconSettings as IconSettings20 } from "@tabler/icons-react";
|
|
29637
29695
|
|
|
29638
29696
|
// src/mantine/blocks/embed/template/GeneralTab.tsx
|
|
29639
|
-
import
|
|
29640
|
-
import { Stack as
|
|
29697
|
+
import React280, { useEffect as useEffect102, useState as useState125 } from "react";
|
|
29698
|
+
import { Stack as Stack192, Switch as Switch7, Text as Text163 } from "@mantine/core";
|
|
29641
29699
|
var GeneralTab18 = ({
|
|
29642
29700
|
url,
|
|
29643
29701
|
title,
|
|
@@ -29652,19 +29710,19 @@ var GeneralTab18 = ({
|
|
|
29652
29710
|
onHeightChange,
|
|
29653
29711
|
onAllowAuthChange
|
|
29654
29712
|
}) => {
|
|
29655
|
-
const [localUrl, setLocalUrl] =
|
|
29656
|
-
const [localHeight, setLocalHeight] =
|
|
29713
|
+
const [localUrl, setLocalUrl] = useState125(url);
|
|
29714
|
+
const [localHeight, setLocalHeight] = useState125(height);
|
|
29657
29715
|
const iconOptions = Object.keys(ICON_MAP).map((key) => ({
|
|
29658
29716
|
value: key,
|
|
29659
29717
|
label: key.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ")
|
|
29660
29718
|
}));
|
|
29661
|
-
|
|
29719
|
+
useEffect102(() => {
|
|
29662
29720
|
setLocalUrl(url);
|
|
29663
29721
|
}, [url]);
|
|
29664
|
-
|
|
29722
|
+
useEffect102(() => {
|
|
29665
29723
|
setLocalHeight(height);
|
|
29666
29724
|
}, [height]);
|
|
29667
|
-
return /* @__PURE__ */
|
|
29725
|
+
return /* @__PURE__ */ React280.createElement(Stack192, { gap: "md" }, /* @__PURE__ */ React280.createElement(Stack192, { gap: "xs" }, /* @__PURE__ */ React280.createElement(Text163, { size: "sm", fw: 600 }, "URL"), /* @__PURE__ */ React280.createElement(
|
|
29668
29726
|
BaseTextInput,
|
|
29669
29727
|
{
|
|
29670
29728
|
placeholder: "https://example.com",
|
|
@@ -29675,7 +29733,7 @@ var GeneralTab18 = ({
|
|
|
29675
29733
|
onUrlChange(v);
|
|
29676
29734
|
}
|
|
29677
29735
|
}
|
|
29678
|
-
), /* @__PURE__ */
|
|
29736
|
+
), /* @__PURE__ */ React280.createElement(Text163, { size: "xs", c: "dimmed" }, "Enter the URL of the page to embed.")), /* @__PURE__ */ React280.createElement(BaseTextInput, { label: "Title", placeholder: "e.g. Dashboard", value: title, onChange: (e) => onTitleChange(e.currentTarget.value) }), /* @__PURE__ */ React280.createElement(BaseTextArea, { label: "Description", placeholder: "Enter description", value: description, onChange: (e) => onDescriptionChange(e.currentTarget.value), minRows: 2 }), /* @__PURE__ */ React280.createElement(BaseSelect, { label: "Icon", placeholder: "Select an icon", value: icon2 || "code", onChange: (value) => onIconChange(value || "code"), data: iconOptions, searchable: true }), /* @__PURE__ */ React280.createElement(
|
|
29679
29737
|
BaseTextInput,
|
|
29680
29738
|
{
|
|
29681
29739
|
label: "Height (px)",
|
|
@@ -29688,13 +29746,13 @@ var GeneralTab18 = ({
|
|
|
29688
29746
|
onHeightChange(v);
|
|
29689
29747
|
}
|
|
29690
29748
|
}
|
|
29691
|
-
), /* @__PURE__ */
|
|
29749
|
+
), /* @__PURE__ */ React280.createElement(Stack192, { gap: "xs" }, /* @__PURE__ */ React280.createElement(Switch7, { label: "Allow authenticated embeds", checked: allowAuth, onChange: (event) => onAllowAuthChange(event.currentTarget.checked) }), /* @__PURE__ */ React280.createElement(Text163, { size: "xs", c: "dimmed" }, "Enable for services like Google Calendar that require cookie access. Only use with trusted URLs.")));
|
|
29692
29750
|
};
|
|
29693
29751
|
|
|
29694
29752
|
// src/mantine/blocks/embed/template/TemplateConfig.tsx
|
|
29695
29753
|
var TemplateConfig18 = ({ editor, block }) => {
|
|
29696
29754
|
const { closePanel } = usePanelStore();
|
|
29697
|
-
const updateProp =
|
|
29755
|
+
const updateProp = useCallback102(
|
|
29698
29756
|
(key, value) => {
|
|
29699
29757
|
editor.updateBlock(block, { props: { ...block.props, [key]: value } });
|
|
29700
29758
|
},
|
|
@@ -29705,7 +29763,7 @@ var TemplateConfig18 = ({ editor, block }) => {
|
|
|
29705
29763
|
label: "General",
|
|
29706
29764
|
value: "general",
|
|
29707
29765
|
icon: icon(IconSettings20),
|
|
29708
|
-
content: /* @__PURE__ */
|
|
29766
|
+
content: /* @__PURE__ */ React281.createElement(
|
|
29709
29767
|
GeneralTab18,
|
|
29710
29768
|
{
|
|
29711
29769
|
url: block.props.url || "",
|
|
@@ -29724,7 +29782,7 @@ var TemplateConfig18 = ({ editor, block }) => {
|
|
|
29724
29782
|
)
|
|
29725
29783
|
}
|
|
29726
29784
|
];
|
|
29727
|
-
return /* @__PURE__ */
|
|
29785
|
+
return /* @__PURE__ */ React281.createElement(BaseRightPanelLayout, { title: "Embed Settings", onClose: closePanel, tabs, context: { editor, block } });
|
|
29728
29786
|
};
|
|
29729
29787
|
|
|
29730
29788
|
// src/mantine/blocks/embed/sanitizeUrl.ts
|
|
@@ -29745,12 +29803,12 @@ function sanitizeEmbedUrl(raw) {
|
|
|
29745
29803
|
var EMBED_TEMPLATE_PANEL_ID = "embed-template-panel";
|
|
29746
29804
|
var EmbedTemplateView = ({ editor, block }) => {
|
|
29747
29805
|
const panelId = `${EMBED_TEMPLATE_PANEL_ID}-${block.id}`;
|
|
29748
|
-
const panelContent =
|
|
29806
|
+
const panelContent = useMemo111(() => /* @__PURE__ */ React282.createElement(TemplateConfig18, { editor, block }), [editor, block]);
|
|
29749
29807
|
const { open } = usePanel(panelId, panelContent);
|
|
29750
29808
|
const safeUrl = sanitizeEmbedUrl(block.props.url);
|
|
29751
29809
|
const height = Number(block.props.height) || 400;
|
|
29752
29810
|
const sandbox = block.props.allowAuth === "true" ? "allow-scripts allow-same-origin allow-forms allow-popups" : "allow-scripts allow-forms allow-popups";
|
|
29753
|
-
return /* @__PURE__ */
|
|
29811
|
+
return /* @__PURE__ */ React282.createElement(BaseContainer, { blockId: block.id, onClick: open, style: { minHeight: 90, justifyContent: "center" } }, /* @__PURE__ */ React282.createElement(Stack193, { gap: "xs", justify: "center" }, /* @__PURE__ */ React282.createElement(Group103, { wrap: "nowrap", align: "center" }, getIcon("code", block.props.icon), /* @__PURE__ */ React282.createElement(Stack193, { gap: 2 }, /* @__PURE__ */ React282.createElement(Text164, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "Embed"), /* @__PURE__ */ React282.createElement(Text164, { size: "xs", c: "dimmed", contentEditable: false, lineClamp: 1 }, block.props.description || safeUrl || "Click to configure"))), safeUrl && /* @__PURE__ */ React282.createElement(Box54, { style: { borderRadius: 8, overflow: "hidden" } }, /* @__PURE__ */ React282.createElement(
|
|
29754
29812
|
"iframe",
|
|
29755
29813
|
{
|
|
29756
29814
|
src: safeUrl,
|
|
@@ -29766,15 +29824,15 @@ var EmbedTemplateView = ({ editor, block }) => {
|
|
|
29766
29824
|
};
|
|
29767
29825
|
|
|
29768
29826
|
// src/mantine/blocks/embed/flow/FlowView.tsx
|
|
29769
|
-
import
|
|
29770
|
-
import { Box as Box55, Group as Group104, Stack as
|
|
29827
|
+
import React284, { useMemo as useMemo112 } from "react";
|
|
29828
|
+
import { Box as Box55, Group as Group104, Stack as Stack194, Text as Text165 } from "@mantine/core";
|
|
29771
29829
|
|
|
29772
29830
|
// src/mantine/blocks/embed/flow/FlowConfig.tsx
|
|
29773
|
-
import
|
|
29831
|
+
import React283, { useCallback as useCallback103 } from "react";
|
|
29774
29832
|
import { IconSettings as IconSettings21 } from "@tabler/icons-react";
|
|
29775
29833
|
var FlowConfig4 = ({ editor, block }) => {
|
|
29776
29834
|
const { closePanel } = usePanelStore();
|
|
29777
|
-
const updateProp =
|
|
29835
|
+
const updateProp = useCallback103(
|
|
29778
29836
|
(key, value) => {
|
|
29779
29837
|
editor.updateBlock(block, { props: { ...block.props, [key]: value } });
|
|
29780
29838
|
},
|
|
@@ -29785,7 +29843,7 @@ var FlowConfig4 = ({ editor, block }) => {
|
|
|
29785
29843
|
label: "General",
|
|
29786
29844
|
value: "general",
|
|
29787
29845
|
icon: icon(IconSettings21),
|
|
29788
|
-
content: /* @__PURE__ */
|
|
29846
|
+
content: /* @__PURE__ */ React283.createElement(
|
|
29789
29847
|
GeneralTab18,
|
|
29790
29848
|
{
|
|
29791
29849
|
url: block.props.url || "",
|
|
@@ -29804,19 +29862,19 @@ var FlowConfig4 = ({ editor, block }) => {
|
|
|
29804
29862
|
)
|
|
29805
29863
|
}
|
|
29806
29864
|
];
|
|
29807
|
-
return /* @__PURE__ */
|
|
29865
|
+
return /* @__PURE__ */ React283.createElement(BaseRightPanelLayout, { title: "Embed Settings", onClose: closePanel, tabs, context: { editor, block }, isTemplate: false });
|
|
29808
29866
|
};
|
|
29809
29867
|
|
|
29810
29868
|
// src/mantine/blocks/embed/flow/FlowView.tsx
|
|
29811
29869
|
var EMBED_FLOW_PANEL_ID = "embed-flow-panel";
|
|
29812
29870
|
var EmbedFlowView = ({ editor, block }) => {
|
|
29813
29871
|
const panelId = `${EMBED_FLOW_PANEL_ID}-${block.id}`;
|
|
29814
|
-
const panelContent =
|
|
29872
|
+
const panelContent = useMemo112(() => /* @__PURE__ */ React284.createElement(FlowConfig4, { editor, block }), [editor, block]);
|
|
29815
29873
|
const { open } = usePanel(panelId, panelContent);
|
|
29816
29874
|
const safeUrl = sanitizeEmbedUrl(block.props.url);
|
|
29817
29875
|
const height = Number(block.props.height) || 400;
|
|
29818
29876
|
const sandbox = block.props.allowAuth === "true" ? "allow-scripts allow-same-origin allow-forms allow-popups" : "allow-scripts allow-forms allow-popups";
|
|
29819
|
-
return /* @__PURE__ */
|
|
29877
|
+
return /* @__PURE__ */ React284.createElement(BaseContainer, { blockId: block.id, onClick: open, style: { minHeight: 90, justifyContent: "center" } }, /* @__PURE__ */ React284.createElement(Stack194, { gap: "xs", justify: "center" }, /* @__PURE__ */ React284.createElement(Group104, { wrap: "nowrap", align: "center" }, getIcon("code", block.props.icon), /* @__PURE__ */ React284.createElement(Stack194, { gap: 2 }, /* @__PURE__ */ React284.createElement(Text165, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "Embed"), /* @__PURE__ */ React284.createElement(Text165, { size: "xs", c: "dimmed", contentEditable: false, lineClamp: 1 }, block.props.description || safeUrl || "No URL configured"))), safeUrl && /* @__PURE__ */ React284.createElement(Box55, { style: { borderRadius: 8, overflow: "hidden" } }, /* @__PURE__ */ React284.createElement(
|
|
29820
29878
|
"iframe",
|
|
29821
29879
|
{
|
|
29822
29880
|
src: safeUrl,
|
|
@@ -29835,9 +29893,9 @@ var EmbedFlowView = ({ editor, block }) => {
|
|
|
29835
29893
|
function EmbedBlock({ editor, block }) {
|
|
29836
29894
|
const { docType } = useBlocknoteContext();
|
|
29837
29895
|
if (docType === "template" || docType === "page") {
|
|
29838
|
-
return /* @__PURE__ */
|
|
29896
|
+
return /* @__PURE__ */ React285.createElement(EmbedTemplateView, { editor, block });
|
|
29839
29897
|
}
|
|
29840
|
-
return /* @__PURE__ */
|
|
29898
|
+
return /* @__PURE__ */ React285.createElement(EmbedFlowView, { editor, block });
|
|
29841
29899
|
}
|
|
29842
29900
|
|
|
29843
29901
|
// src/mantine/blocks/embed/EmbedBlockSpec.tsx
|
|
@@ -29858,7 +29916,7 @@ var EmbedBlockSpec = createReactBlockSpec22(
|
|
|
29858
29916
|
{
|
|
29859
29917
|
render: (props) => {
|
|
29860
29918
|
const ixoProps = props;
|
|
29861
|
-
return /* @__PURE__ */
|
|
29919
|
+
return /* @__PURE__ */ React286.createElement(EmbedBlock, { ...ixoProps });
|
|
29862
29920
|
}
|
|
29863
29921
|
}
|
|
29864
29922
|
);
|
|
@@ -30078,10 +30136,10 @@ blockRegistry.register({
|
|
|
30078
30136
|
});
|
|
30079
30137
|
|
|
30080
30138
|
// src/mantine/blocks/hooks/useBlockDependencies.ts
|
|
30081
|
-
import { useMemo as
|
|
30139
|
+
import { useMemo as useMemo113, useEffect as useEffect103, useState as useState126, useCallback as useCallback104 } from "react";
|
|
30082
30140
|
|
|
30083
30141
|
// src/mantine/blocks/hooks/useDependsOn.ts
|
|
30084
|
-
import { useMemo as
|
|
30142
|
+
import { useMemo as useMemo114 } from "react";
|
|
30085
30143
|
|
|
30086
30144
|
// src/mantine/blocks/index.ts
|
|
30087
30145
|
var blockSpecs = {
|
|
@@ -30576,15 +30634,15 @@ import { useCreateBlockNote as useCreateBlockNote2 } from "@blocknote/react";
|
|
|
30576
30634
|
import { BlockNoteSchema as BlockNoteSchema2, defaultBlockSpecs as defaultBlockSpecs2, defaultInlineContentSpecs as defaultInlineContentSpecs2, defaultStyleSpecs as defaultStyleSpecs2 } from "@blocknote/core";
|
|
30577
30635
|
|
|
30578
30636
|
// src/core/hooks/useMatrixProvider.ts
|
|
30579
|
-
import { useEffect as
|
|
30637
|
+
import { useEffect as useEffect104, useState as useState127, useRef as useRef25, useCallback as useCallback105, useMemo as useMemo115 } from "react";
|
|
30580
30638
|
import { MatrixProvider } from "@ixo/matrix-crdt";
|
|
30581
30639
|
function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
30582
|
-
const [matrixProvider, setProvider] =
|
|
30583
|
-
const [status, setStatus] =
|
|
30640
|
+
const [matrixProvider, setProvider] = useState127(null);
|
|
30641
|
+
const [status, setStatus] = useState127("disconnected");
|
|
30584
30642
|
const isMountedRef = useRef25(true);
|
|
30585
30643
|
const providerRef = useRef25(null);
|
|
30586
30644
|
const retryTimeoutRef = useRef25(null);
|
|
30587
|
-
const providerOptions =
|
|
30645
|
+
const providerOptions = useMemo115(
|
|
30588
30646
|
() => ({
|
|
30589
30647
|
translator: {
|
|
30590
30648
|
updateEventType: "matrix-crdt.doc_update",
|
|
@@ -30597,22 +30655,22 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
30597
30655
|
}),
|
|
30598
30656
|
[]
|
|
30599
30657
|
);
|
|
30600
|
-
const handleDocumentAvailable =
|
|
30658
|
+
const handleDocumentAvailable = useCallback105(() => {
|
|
30601
30659
|
if (isMountedRef.current) {
|
|
30602
30660
|
setStatus("connected");
|
|
30603
30661
|
}
|
|
30604
30662
|
}, []);
|
|
30605
|
-
const handleDocumentUnavailable =
|
|
30663
|
+
const handleDocumentUnavailable = useCallback105(() => {
|
|
30606
30664
|
if (isMountedRef.current) {
|
|
30607
30665
|
setStatus("failed");
|
|
30608
30666
|
}
|
|
30609
30667
|
}, []);
|
|
30610
|
-
const handleCanWriteChanged =
|
|
30668
|
+
const handleCanWriteChanged = useCallback105(() => {
|
|
30611
30669
|
if (isMountedRef.current && providerRef.current) {
|
|
30612
30670
|
setStatus(providerRef.current.canWrite ? "connected" : "failed");
|
|
30613
30671
|
}
|
|
30614
30672
|
}, []);
|
|
30615
|
-
const initProvider =
|
|
30673
|
+
const initProvider = useCallback105(async () => {
|
|
30616
30674
|
if (!isMountedRef.current) return;
|
|
30617
30675
|
if (retryTimeoutRef.current) {
|
|
30618
30676
|
clearTimeout(retryTimeoutRef.current);
|
|
@@ -30645,7 +30703,7 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
30645
30703
|
}
|
|
30646
30704
|
}
|
|
30647
30705
|
}, [matrixClient, providerOptions, handleDocumentAvailable, handleDocumentUnavailable, handleCanWriteChanged]);
|
|
30648
|
-
|
|
30706
|
+
useEffect104(() => {
|
|
30649
30707
|
isMountedRef.current = true;
|
|
30650
30708
|
initProvider();
|
|
30651
30709
|
return () => {
|
|
@@ -30662,7 +30720,7 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
30662
30720
|
setStatus("disconnected");
|
|
30663
30721
|
};
|
|
30664
30722
|
}, [initProvider]);
|
|
30665
|
-
|
|
30723
|
+
useEffect104(() => {
|
|
30666
30724
|
return () => {
|
|
30667
30725
|
isMountedRef.current = false;
|
|
30668
30726
|
};
|
|
@@ -30671,17 +30729,17 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
30671
30729
|
}
|
|
30672
30730
|
|
|
30673
30731
|
// src/mantine/hooks/useCollaborativeYDoc.ts
|
|
30674
|
-
import { useMemo as
|
|
30732
|
+
import { useMemo as useMemo116 } from "react";
|
|
30675
30733
|
import * as Y from "yjs";
|
|
30676
30734
|
function useCollaborativeYDoc(_options) {
|
|
30677
|
-
return
|
|
30735
|
+
return useMemo116(() => {
|
|
30678
30736
|
const doc = new Y.Doc();
|
|
30679
30737
|
return doc;
|
|
30680
30738
|
}, []);
|
|
30681
30739
|
}
|
|
30682
30740
|
|
|
30683
30741
|
// src/mantine/hooks/useCollaborativeIxoEditor.ts
|
|
30684
|
-
import { useMemo as
|
|
30742
|
+
import { useMemo as useMemo117, useEffect as useEffect105, useState as useState128, useRef as useRef26 } from "react";
|
|
30685
30743
|
|
|
30686
30744
|
// src/core/lib/matrixMetadata.ts
|
|
30687
30745
|
var COVER_IMAGE_EVENT_TYPE = "ixo.page.cover_image";
|
|
@@ -30878,7 +30936,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
30878
30936
|
matrixClient,
|
|
30879
30937
|
permissions = { write: false }
|
|
30880
30938
|
} = options || {};
|
|
30881
|
-
const memoizedUser =
|
|
30939
|
+
const memoizedUser = useMemo117(
|
|
30882
30940
|
() => ({
|
|
30883
30941
|
id: user?.id || "",
|
|
30884
30942
|
name: user?.name || "",
|
|
@@ -30894,13 +30952,13 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
30894
30952
|
matrixClient,
|
|
30895
30953
|
roomId: options.roomId
|
|
30896
30954
|
});
|
|
30897
|
-
const metadataManager =
|
|
30898
|
-
|
|
30955
|
+
const metadataManager = useMemo117(() => new MatrixMetadataManager(matrixClient, options.roomId), [matrixClient, options.roomId]);
|
|
30956
|
+
useEffect105(() => {
|
|
30899
30957
|
return () => {
|
|
30900
30958
|
metadataManager.dispose();
|
|
30901
30959
|
};
|
|
30902
30960
|
}, [metadataManager]);
|
|
30903
|
-
const defaultUploadFile =
|
|
30961
|
+
const defaultUploadFile = useMemo117(
|
|
30904
30962
|
() => uploadFile || (async (file) => {
|
|
30905
30963
|
return new Promise((resolve, reject) => {
|
|
30906
30964
|
const reader = new FileReader();
|
|
@@ -30914,7 +30972,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
30914
30972
|
}),
|
|
30915
30973
|
[uploadFile]
|
|
30916
30974
|
);
|
|
30917
|
-
const schema =
|
|
30975
|
+
const schema = useMemo117(
|
|
30918
30976
|
() => BlockNoteSchema2.create({
|
|
30919
30977
|
blockSpecs: {
|
|
30920
30978
|
...defaultBlockSpecs2,
|
|
@@ -30929,16 +30987,16 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
30929
30987
|
}),
|
|
30930
30988
|
[]
|
|
30931
30989
|
);
|
|
30932
|
-
const root =
|
|
30933
|
-
const documentFragment =
|
|
30934
|
-
const flowArray =
|
|
30935
|
-
const runtimeMap =
|
|
30936
|
-
const delegationsMap =
|
|
30937
|
-
const invocationsMap =
|
|
30938
|
-
const ucanDelegationStore =
|
|
30939
|
-
const invocationStore =
|
|
30940
|
-
const userFragment =
|
|
30941
|
-
const collaborationConfig =
|
|
30990
|
+
const root = useMemo117(() => yDoc.getMap("root"), [yDoc]);
|
|
30991
|
+
const documentFragment = useMemo117(() => yDoc.getXmlFragment("document"), [yDoc]);
|
|
30992
|
+
const flowArray = useMemo117(() => yDoc.getArray("flow"), [yDoc]);
|
|
30993
|
+
const runtimeMap = useMemo117(() => yDoc.getMap("runtime"), [yDoc]);
|
|
30994
|
+
const delegationsMap = useMemo117(() => yDoc.getMap("delegations"), [yDoc]);
|
|
30995
|
+
const invocationsMap = useMemo117(() => yDoc.getMap("invocations"), [yDoc]);
|
|
30996
|
+
const ucanDelegationStore = useMemo117(() => createUcanDelegationStore(delegationsMap), [delegationsMap]);
|
|
30997
|
+
const invocationStore = useMemo117(() => createInvocationStore(invocationsMap), [invocationsMap]);
|
|
30998
|
+
const userFragment = useMemo117(() => yDoc.getMap(memoizedUser.id), [yDoc, memoizedUser.id]);
|
|
30999
|
+
const collaborationConfig = useMemo117(
|
|
30942
31000
|
() => ({
|
|
30943
31001
|
provider: matrixProvider,
|
|
30944
31002
|
fragment: documentFragment,
|
|
@@ -30950,7 +31008,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
30950
31008
|
}),
|
|
30951
31009
|
[matrixProvider, documentFragment, memoizedUser.name, memoizedUser.color]
|
|
30952
31010
|
);
|
|
30953
|
-
const ixoConfig =
|
|
31011
|
+
const ixoConfig = useMemo117(
|
|
30954
31012
|
() => ({
|
|
30955
31013
|
theme,
|
|
30956
31014
|
editable,
|
|
@@ -30970,7 +31028,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
30970
31028
|
collaboration: collaborationConfig,
|
|
30971
31029
|
pasteHandler: ixoPasteHandler
|
|
30972
31030
|
});
|
|
30973
|
-
const titleText =
|
|
31031
|
+
const titleText = useMemo117(() => yDoc.getText("title"), [yDoc]);
|
|
30974
31032
|
let ixoEditor;
|
|
30975
31033
|
if (editor) {
|
|
30976
31034
|
ixoEditor = editor;
|
|
@@ -31162,12 +31220,12 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
31162
31220
|
return void 0;
|
|
31163
31221
|
};
|
|
31164
31222
|
}
|
|
31165
|
-
|
|
31223
|
+
useEffect105(() => {
|
|
31166
31224
|
if (ixoEditor) {
|
|
31167
31225
|
ixoEditor.isEditable = editable;
|
|
31168
31226
|
}
|
|
31169
31227
|
}, [ixoEditor, editable]);
|
|
31170
|
-
|
|
31228
|
+
useEffect105(() => {
|
|
31171
31229
|
if (connectionStatus !== "connected") {
|
|
31172
31230
|
return;
|
|
31173
31231
|
}
|
|
@@ -31189,10 +31247,10 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
31189
31247
|
titleText.insert(0, options.title);
|
|
31190
31248
|
}
|
|
31191
31249
|
}, [connectionStatus, root, titleText, permissions.write, options.docId, options.title, memoizedUser.id]);
|
|
31192
|
-
const [connectedUsers, setConnectedUsers] =
|
|
31250
|
+
const [connectedUsers, setConnectedUsers] = useState128([]);
|
|
31193
31251
|
const activeBlockIdRef = useRef26(null);
|
|
31194
31252
|
const awarenessInstance = matrixProvider?.awarenessInstance ?? null;
|
|
31195
|
-
|
|
31253
|
+
useEffect105(() => {
|
|
31196
31254
|
if (!awarenessInstance || connectionStatus !== "connected") {
|
|
31197
31255
|
return;
|
|
31198
31256
|
}
|
|
@@ -31210,7 +31268,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
31210
31268
|
awarenessInstance.off("change", updateUsers);
|
|
31211
31269
|
};
|
|
31212
31270
|
}, [awarenessInstance, connectionStatus]);
|
|
31213
|
-
|
|
31271
|
+
useEffect105(() => {
|
|
31214
31272
|
if (!awarenessInstance || connectionStatus !== "connected") {
|
|
31215
31273
|
return;
|
|
31216
31274
|
}
|
|
@@ -31239,7 +31297,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
31239
31297
|
};
|
|
31240
31298
|
}, [awarenessInstance, connectionStatus, memoizedUser.id, memoizedUser.name, memoizedUser.color, memoizedUser.avatar]);
|
|
31241
31299
|
const dmSentRef = useRef26(false);
|
|
31242
|
-
|
|
31300
|
+
useEffect105(() => {
|
|
31243
31301
|
if (!ixoEditor || connectionStatus !== "connected" || dmSentRef.current) return;
|
|
31244
31302
|
if (ixoEditor.docType !== "flow") return;
|
|
31245
31303
|
const mx = ixoEditor.getMatrixClient?.();
|
|
@@ -31304,14 +31362,14 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
31304
31362
|
}
|
|
31305
31363
|
|
|
31306
31364
|
// src/mantine/IxoEditor.tsx
|
|
31307
|
-
import
|
|
31365
|
+
import React295, { useState as useState134, useEffect as useEffect111, useCallback as useCallback108 } from "react";
|
|
31308
31366
|
import { SuggestionMenuController } from "@blocknote/react";
|
|
31309
31367
|
import { BlockNoteView } from "@blocknote/mantine";
|
|
31310
31368
|
import { filterSuggestionItems } from "@blocknote/core";
|
|
31311
31369
|
import { MantineProvider } from "@mantine/core";
|
|
31312
31370
|
|
|
31313
31371
|
// src/mantine/components/PanelContent.tsx
|
|
31314
|
-
import
|
|
31372
|
+
import React287 from "react";
|
|
31315
31373
|
import { Box as Box56 } from "@mantine/core";
|
|
31316
31374
|
var panelStyles = {
|
|
31317
31375
|
light: {
|
|
@@ -31341,7 +31399,7 @@ function PanelContent({ theme }) {
|
|
|
31341
31399
|
const { activePanel, registeredPanels } = usePanelStore();
|
|
31342
31400
|
const isOpen = activePanel !== null;
|
|
31343
31401
|
const content = activePanel ? registeredPanels.get(activePanel) : null;
|
|
31344
|
-
return /* @__PURE__ */
|
|
31402
|
+
return /* @__PURE__ */ React287.createElement(
|
|
31345
31403
|
Box56,
|
|
31346
31404
|
{
|
|
31347
31405
|
pos: "sticky",
|
|
@@ -31361,7 +31419,7 @@ function PanelContent({ theme }) {
|
|
|
31361
31419
|
}
|
|
31362
31420
|
|
|
31363
31421
|
// src/mantine/components/CoverImage.tsx
|
|
31364
|
-
import
|
|
31422
|
+
import React292, { useState as useState131, useRef as useRef27, useEffect as useEffect108, useMemo as useMemo120 } from "react";
|
|
31365
31423
|
import { Box as Box60, Group as Group107 } from "@mantine/core";
|
|
31366
31424
|
|
|
31367
31425
|
// src/core/lib/imageTransform.ts
|
|
@@ -31495,9 +31553,9 @@ function transformIconImage(sourceUrl, size = "default", customOptions) {
|
|
|
31495
31553
|
}
|
|
31496
31554
|
|
|
31497
31555
|
// src/mantine/components/Base/CoverImageButton.tsx
|
|
31498
|
-
import
|
|
31556
|
+
import React288, { forwardRef } from "react";
|
|
31499
31557
|
import { Button as Button51 } from "@mantine/core";
|
|
31500
|
-
var CoverImageButton = forwardRef(({ isActive = false, onClick, children, style, ...props }, ref) => /* @__PURE__ */
|
|
31558
|
+
var CoverImageButton = forwardRef(({ isActive = false, onClick, children, style, ...props }, ref) => /* @__PURE__ */ React288.createElement(
|
|
31501
31559
|
Button51,
|
|
31502
31560
|
{
|
|
31503
31561
|
ref,
|
|
@@ -31520,8 +31578,8 @@ var CoverImageButton = forwardRef(({ isActive = false, onClick, children, style,
|
|
|
31520
31578
|
CoverImageButton.displayName = "CoverImageButton";
|
|
31521
31579
|
|
|
31522
31580
|
// src/mantine/components/Base/BaseIconPicker.tsx
|
|
31523
|
-
import
|
|
31524
|
-
import { TextInput as TextInput8, Tabs as Tabs4, Box as Box57, Stack as
|
|
31581
|
+
import React289, { useState as useState129, useMemo as useMemo118, useEffect as useEffect106 } from "react";
|
|
31582
|
+
import { TextInput as TextInput8, Tabs as Tabs4, Box as Box57, Stack as Stack195, UnstyledButton as UnstyledButton5, Text as Text166, Center as Center13, ScrollArea as ScrollArea9, Group as Group105, Popover as Popover6 } from "@mantine/core";
|
|
31525
31583
|
import * as TablerIcons from "@tabler/icons-react";
|
|
31526
31584
|
import { IconSearch as IconSearch7, IconX as IconX14, IconChevronLeft, IconChevronRight as IconChevronRight14 } from "@tabler/icons-react";
|
|
31527
31585
|
|
|
@@ -31553,28 +31611,28 @@ var localStorageService = {
|
|
|
31553
31611
|
var iconsKey = "editor_recent_icons";
|
|
31554
31612
|
var ICONS_PER_PAGE = 500;
|
|
31555
31613
|
function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children, currentIcon }) {
|
|
31556
|
-
const [searchQuery, setSearchQuery] =
|
|
31557
|
-
const [activeTab, setActiveTab] =
|
|
31558
|
-
const [currentPage, setCurrentPage] =
|
|
31559
|
-
const allIcons =
|
|
31614
|
+
const [searchQuery, setSearchQuery] = useState129("");
|
|
31615
|
+
const [activeTab, setActiveTab] = useState129("icons");
|
|
31616
|
+
const [currentPage, setCurrentPage] = useState129(1);
|
|
31617
|
+
const allIcons = useMemo118(() => {
|
|
31560
31618
|
const iconEntries = Object.entries(TablerIcons).filter(([name]) => name.startsWith("Icon") && name !== "IconProps");
|
|
31561
31619
|
return iconEntries;
|
|
31562
31620
|
}, []);
|
|
31563
|
-
const filteredIcons =
|
|
31621
|
+
const filteredIcons = useMemo118(() => {
|
|
31564
31622
|
if (!searchQuery) return allIcons;
|
|
31565
31623
|
const query = searchQuery.toLowerCase();
|
|
31566
31624
|
return allIcons.filter(([name]) => name.toLowerCase().includes(query));
|
|
31567
31625
|
}, [allIcons, searchQuery]);
|
|
31568
|
-
|
|
31626
|
+
useEffect106(() => {
|
|
31569
31627
|
setCurrentPage(1);
|
|
31570
31628
|
}, [searchQuery]);
|
|
31571
|
-
const paginatedIcons =
|
|
31629
|
+
const paginatedIcons = useMemo118(() => {
|
|
31572
31630
|
const startIndex = (currentPage - 1) * ICONS_PER_PAGE;
|
|
31573
31631
|
const endIndex = startIndex + ICONS_PER_PAGE;
|
|
31574
31632
|
return filteredIcons.slice(startIndex, endIndex);
|
|
31575
31633
|
}, [filteredIcons, currentPage]);
|
|
31576
31634
|
const totalPages = Math.ceil(filteredIcons.length / ICONS_PER_PAGE);
|
|
31577
|
-
const recentIcons =
|
|
31635
|
+
const recentIcons = useMemo118(() => {
|
|
31578
31636
|
const recentIconNames = localStorageService.get(iconsKey);
|
|
31579
31637
|
if (!recentIconNames || recentIconNames.length === 0) return [];
|
|
31580
31638
|
return recentIconNames.slice(0, 24).map((iconName) => allIcons.find(([name]) => name === iconName)).filter((entry) => entry !== void 0);
|
|
@@ -31589,9 +31647,9 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children
|
|
|
31589
31647
|
};
|
|
31590
31648
|
const renderIconGrid = (icons) => {
|
|
31591
31649
|
if (icons.length === 0) {
|
|
31592
|
-
return /* @__PURE__ */
|
|
31650
|
+
return /* @__PURE__ */ React289.createElement(Center13, { py: "xl" }, /* @__PURE__ */ React289.createElement(Text166, { c: "dimmed", size: "sm" }, "No icons found"));
|
|
31593
31651
|
}
|
|
31594
|
-
return /* @__PURE__ */
|
|
31652
|
+
return /* @__PURE__ */ React289.createElement(
|
|
31595
31653
|
Box57,
|
|
31596
31654
|
{
|
|
31597
31655
|
style: {
|
|
@@ -31603,7 +31661,7 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children
|
|
|
31603
31661
|
},
|
|
31604
31662
|
icons.map(([name, IconComponent]) => {
|
|
31605
31663
|
const isSelected = currentIcon === name.replace("Icon", "").replace(/([A-Z])/g, "-$1").toLowerCase().slice(1);
|
|
31606
|
-
return /* @__PURE__ */
|
|
31664
|
+
return /* @__PURE__ */ React289.createElement(
|
|
31607
31665
|
UnstyledButton5,
|
|
31608
31666
|
{
|
|
31609
31667
|
key: name,
|
|
@@ -31629,12 +31687,12 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children
|
|
|
31629
31687
|
}
|
|
31630
31688
|
}
|
|
31631
31689
|
},
|
|
31632
|
-
/* @__PURE__ */
|
|
31690
|
+
/* @__PURE__ */ React289.createElement(IconComponent, { color: "white", size: 24, stroke: 1.5 })
|
|
31633
31691
|
);
|
|
31634
31692
|
})
|
|
31635
31693
|
);
|
|
31636
31694
|
};
|
|
31637
|
-
return /* @__PURE__ */
|
|
31695
|
+
return /* @__PURE__ */ React289.createElement(Popover6, { opened, onClose, position: "right", width: 500, shadow: "xl" }, /* @__PURE__ */ React289.createElement(Popover6.Target, null, children), /* @__PURE__ */ React289.createElement(
|
|
31638
31696
|
Popover6.Dropdown,
|
|
31639
31697
|
{
|
|
31640
31698
|
style: {
|
|
@@ -31644,15 +31702,15 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children
|
|
|
31644
31702
|
},
|
|
31645
31703
|
p: 0
|
|
31646
31704
|
},
|
|
31647
|
-
/* @__PURE__ */
|
|
31705
|
+
/* @__PURE__ */ React289.createElement(Stack195, { gap: "md", p: "md" }, /* @__PURE__ */ React289.createElement(Tabs4, { value: activeTab, onChange: setActiveTab, variant: "pills" }, /* @__PURE__ */ React289.createElement(Tabs4.List, null, /* @__PURE__ */ React289.createElement(Tabs4.Tab, { value: "icons" }, "Icons"), /* @__PURE__ */ React289.createElement(Tabs4.Tab, { value: "upload" }, "Upload")), /* @__PURE__ */ React289.createElement(Tabs4.Panel, { value: "icons", pt: "md" }, /* @__PURE__ */ React289.createElement(
|
|
31648
31706
|
TextInput8,
|
|
31649
31707
|
{
|
|
31650
31708
|
mb: "md",
|
|
31651
31709
|
placeholder: "Filter",
|
|
31652
|
-
leftSection: /* @__PURE__ */
|
|
31710
|
+
leftSection: /* @__PURE__ */ React289.createElement(IconSearch7, { size: 18 }),
|
|
31653
31711
|
value: searchQuery,
|
|
31654
31712
|
onChange: (e) => setSearchQuery(e.currentTarget.value),
|
|
31655
|
-
rightSection: searchQuery && /* @__PURE__ */
|
|
31713
|
+
rightSection: searchQuery && /* @__PURE__ */ React289.createElement(UnstyledButton5, { onClick: () => setSearchQuery("") }, /* @__PURE__ */ React289.createElement(IconX14, { size: 18 })),
|
|
31656
31714
|
style: { flex: 1 },
|
|
31657
31715
|
styles: {
|
|
31658
31716
|
input: {
|
|
@@ -31662,26 +31720,26 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children
|
|
|
31662
31720
|
}
|
|
31663
31721
|
}
|
|
31664
31722
|
}
|
|
31665
|
-
), !searchQuery && /* @__PURE__ */
|
|
31723
|
+
), !searchQuery && /* @__PURE__ */ React289.createElement(Box57, { mb: "md" }, /* @__PURE__ */ React289.createElement(Text166, { size: "sm", fw: 500, mb: "xs", px: "xs" }, "Recent"), /* @__PURE__ */ React289.createElement(ScrollArea9.Autosize, { scrollbarSize: 0, mah: 60 }, renderIconGrid(recentIcons))), /* @__PURE__ */ React289.createElement(Box57, null, /* @__PURE__ */ React289.createElement(Group105, { justify: "space-between", mb: "xs", px: "xs" }, /* @__PURE__ */ React289.createElement(Text166, { size: "sm", fw: 500 }, searchQuery ? "Results" : "Icons"), totalPages > 1 && /* @__PURE__ */ React289.createElement(Group105, { gap: "xs" }, /* @__PURE__ */ React289.createElement(Text166, { size: "xs", c: "dimmed" }, "Page ", currentPage, " of ", totalPages, " (", filteredIcons.length, " total)"), /* @__PURE__ */ React289.createElement(BaseButton, { size: "xs", onClick: () => setCurrentPage((p) => Math.max(1, p - 1)), disabled: currentPage === 1, leftSection: /* @__PURE__ */ React289.createElement(IconChevronLeft, { size: 14 }) }, "Prev"), /* @__PURE__ */ React289.createElement(
|
|
31666
31724
|
BaseButton,
|
|
31667
31725
|
{
|
|
31668
31726
|
size: "xs",
|
|
31669
31727
|
onClick: () => setCurrentPage((p) => Math.min(totalPages, p + 1)),
|
|
31670
31728
|
disabled: currentPage === totalPages,
|
|
31671
|
-
leftSection: /* @__PURE__ */
|
|
31729
|
+
leftSection: /* @__PURE__ */ React289.createElement(IconChevronRight14, { size: 14 })
|
|
31672
31730
|
},
|
|
31673
31731
|
"Next"
|
|
31674
|
-
))), /* @__PURE__ */
|
|
31732
|
+
))), /* @__PURE__ */ React289.createElement(ScrollArea9.Autosize, { scrollbarSize: 0, mah: 200 }, renderIconGrid(paginatedIcons)))), /* @__PURE__ */ React289.createElement(Tabs4.Panel, { value: "upload", pt: "md" }, /* @__PURE__ */ React289.createElement(Center13, { py: "xl" }, /* @__PURE__ */ React289.createElement(Stack195, { align: "center", gap: "md" }, /* @__PURE__ */ React289.createElement(Text166, { size: "sm", c: "dimmed", ta: "center" }, "Upload a custom icon image", /* @__PURE__ */ React289.createElement("br", null), "(PNG, JPG, SVG)"), /* @__PURE__ */ React289.createElement(CoverImageButton, { onClick: onUploadClick }, "Choose File"))))))
|
|
31675
31733
|
));
|
|
31676
31734
|
}
|
|
31677
31735
|
|
|
31678
31736
|
// src/mantine/components/Base/PageIcon.tsx
|
|
31679
|
-
import
|
|
31737
|
+
import React290, { useMemo as useMemo119 } from "react";
|
|
31680
31738
|
import { Center as Center14, Box as Box58 } from "@mantine/core";
|
|
31681
31739
|
import * as TablerIcons2 from "@tabler/icons-react";
|
|
31682
31740
|
function PageIcon({ src, iconSize = 64, useCenter = false, style }) {
|
|
31683
31741
|
const isIconName = src && !src.startsWith("http");
|
|
31684
|
-
const IconComponent =
|
|
31742
|
+
const IconComponent = useMemo119(() => {
|
|
31685
31743
|
if (!isIconName || !src) return null;
|
|
31686
31744
|
const iconComponent = TablerIcons2[src];
|
|
31687
31745
|
if (iconComponent) {
|
|
@@ -31692,7 +31750,7 @@ function PageIcon({ src, iconSize = 64, useCenter = false, style }) {
|
|
|
31692
31750
|
const Container = useCenter ? Center14 : Box58;
|
|
31693
31751
|
if (!src) return null;
|
|
31694
31752
|
if (IconComponent) {
|
|
31695
|
-
return /* @__PURE__ */
|
|
31753
|
+
return /* @__PURE__ */ React290.createElement(
|
|
31696
31754
|
Container,
|
|
31697
31755
|
{
|
|
31698
31756
|
style: {
|
|
@@ -31704,10 +31762,10 @@ function PageIcon({ src, iconSize = 64, useCenter = false, style }) {
|
|
|
31704
31762
|
...style
|
|
31705
31763
|
}
|
|
31706
31764
|
},
|
|
31707
|
-
/* @__PURE__ */
|
|
31765
|
+
/* @__PURE__ */ React290.createElement(IconComponent, { size: iconSize, color: "white", stroke: 1.5 })
|
|
31708
31766
|
);
|
|
31709
31767
|
}
|
|
31710
|
-
return /* @__PURE__ */
|
|
31768
|
+
return /* @__PURE__ */ React290.createElement(
|
|
31711
31769
|
"img",
|
|
31712
31770
|
{
|
|
31713
31771
|
src,
|
|
@@ -31728,14 +31786,14 @@ function PageIcon({ src, iconSize = 64, useCenter = false, style }) {
|
|
|
31728
31786
|
import { useDisclosure as useDisclosure7 } from "@mantine/hooks";
|
|
31729
31787
|
|
|
31730
31788
|
// src/mantine/components/FlowSettingsPanel.tsx
|
|
31731
|
-
import
|
|
31732
|
-
import { Stack as
|
|
31789
|
+
import React291, { useState as useState130, useEffect as useEffect107, useCallback as useCallback106 } from "react";
|
|
31790
|
+
import { Stack as Stack196, Group as Group106, Button as Button52, ActionIcon as ActionIcon37, Text as Text167, Box as Box59 } from "@mantine/core";
|
|
31733
31791
|
import { IconPlus as IconPlus11, IconTrash as IconTrash10 } from "@tabler/icons-react";
|
|
31734
31792
|
var SYSTEM_KEYS = /* @__PURE__ */ new Set(["@context", "_type", "schema_version", "doc_id", "title", "createdAt", "createdBy", "flowOwnerDid"]);
|
|
31735
31793
|
var FlowSettingsPanel = ({ editor }) => {
|
|
31736
31794
|
const { closePanel } = usePanelStore();
|
|
31737
|
-
const [rows, setRows] =
|
|
31738
|
-
const loadSettings =
|
|
31795
|
+
const [rows, setRows] = useState130([]);
|
|
31796
|
+
const loadSettings = useCallback106(() => {
|
|
31739
31797
|
const metadata = editor.getFlowMetadata?.();
|
|
31740
31798
|
if (!metadata) return;
|
|
31741
31799
|
const customRows = [];
|
|
@@ -31746,10 +31804,10 @@ var FlowSettingsPanel = ({ editor }) => {
|
|
|
31746
31804
|
}
|
|
31747
31805
|
setRows(customRows);
|
|
31748
31806
|
}, [editor]);
|
|
31749
|
-
|
|
31807
|
+
useEffect107(() => {
|
|
31750
31808
|
loadSettings();
|
|
31751
31809
|
}, [loadSettings]);
|
|
31752
|
-
const handleKeyChange =
|
|
31810
|
+
const handleKeyChange = useCallback106(
|
|
31753
31811
|
(index, newKey) => {
|
|
31754
31812
|
setRows((prev) => {
|
|
31755
31813
|
const updated = [...prev];
|
|
@@ -31766,7 +31824,7 @@ var FlowSettingsPanel = ({ editor }) => {
|
|
|
31766
31824
|
},
|
|
31767
31825
|
[editor]
|
|
31768
31826
|
);
|
|
31769
|
-
const handleValueChange =
|
|
31827
|
+
const handleValueChange = useCallback106(
|
|
31770
31828
|
(index, newValue) => {
|
|
31771
31829
|
setRows((prev) => {
|
|
31772
31830
|
const updated = [...prev];
|
|
@@ -31780,10 +31838,10 @@ var FlowSettingsPanel = ({ editor }) => {
|
|
|
31780
31838
|
},
|
|
31781
31839
|
[editor]
|
|
31782
31840
|
);
|
|
31783
|
-
const handleAdd =
|
|
31841
|
+
const handleAdd = useCallback106(() => {
|
|
31784
31842
|
setRows((prev) => [...prev, { key: "", value: "" }]);
|
|
31785
31843
|
}, []);
|
|
31786
|
-
const handleDelete =
|
|
31844
|
+
const handleDelete = useCallback106(
|
|
31787
31845
|
(index) => {
|
|
31788
31846
|
setRows((prev) => {
|
|
31789
31847
|
const row = prev[index];
|
|
@@ -31795,23 +31853,23 @@ var FlowSettingsPanel = ({ editor }) => {
|
|
|
31795
31853
|
},
|
|
31796
31854
|
[editor]
|
|
31797
31855
|
);
|
|
31798
|
-
const subtitle = /* @__PURE__ */
|
|
31799
|
-
return /* @__PURE__ */
|
|
31856
|
+
const subtitle = /* @__PURE__ */ React291.createElement(Box59, { px: 40, mb: "md" }, /* @__PURE__ */ React291.createElement(Text167, { size: "sm", c: "dimmed" }, "Add key-value settings for this flow. These are available to oracles and action blocks at runtime."));
|
|
31857
|
+
return /* @__PURE__ */ React291.createElement(BaseRightPanelLayout, { title: "Flow Settings", onClose: closePanel, isTemplate: true, captionContent: subtitle }, /* @__PURE__ */ React291.createElement(Stack196, { gap: "lg" }, rows.map((row, index) => /* @__PURE__ */ React291.createElement(Stack196, { key: index, gap: "xs" }, /* @__PURE__ */ React291.createElement(Group106, { gap: "xs", align: "center", wrap: "nowrap" }, /* @__PURE__ */ React291.createElement(BaseTextInput, { placeholder: "Key (e.g. protocolDid)", value: row.key, onChange: (e) => handleKeyChange(index, e.currentTarget.value), style: { flex: 1 } }), /* @__PURE__ */ React291.createElement(ActionIcon37, { variant: "subtle", color: "red", onClick: () => handleDelete(index), size: "lg" }, /* @__PURE__ */ React291.createElement(IconTrash10, { size: 16 }))), /* @__PURE__ */ React291.createElement(BaseTextArea, { placeholder: "Value", value: row.value, onChange: (e) => handleValueChange(index, e.currentTarget.value), minRows: 1, maxRows: 8 }))), /* @__PURE__ */ React291.createElement(Button52, { variant: "subtle", leftSection: /* @__PURE__ */ React291.createElement(IconPlus11, { size: 16 }), onClick: handleAdd, size: "sm" }, "Add setting")));
|
|
31800
31858
|
};
|
|
31801
31859
|
|
|
31802
31860
|
// src/mantine/components/CoverImage.tsx
|
|
31803
31861
|
function CoverImage({ coverImageUrl, logoUrl }) {
|
|
31804
31862
|
const { editor, handlers, editable } = useBlocknoteContext();
|
|
31805
|
-
const [isHovering, setIsHovering] =
|
|
31806
|
-
const [isRepositioning, setIsRepositioning] =
|
|
31807
|
-
const [coverPosition, setCoverPosition] =
|
|
31863
|
+
const [isHovering, setIsHovering] = useState131(false);
|
|
31864
|
+
const [isRepositioning, setIsRepositioning] = useState131(false);
|
|
31865
|
+
const [coverPosition, setCoverPosition] = useState131(() => editor?.getPageMetadata?.()?.coverPosition ?? 50);
|
|
31808
31866
|
const coverFileInputRef = useRef27(null);
|
|
31809
31867
|
const logoFileInputRef = useRef27(null);
|
|
31810
31868
|
const [opened, { open, close }] = useDisclosure7(false);
|
|
31811
|
-
const [metadata, setMetadata] =
|
|
31812
|
-
const settingsPanelContent =
|
|
31869
|
+
const [metadata, setMetadata] = useState131(() => editor?.getPageMetadata?.() || null);
|
|
31870
|
+
const settingsPanelContent = useMemo120(() => editor ? /* @__PURE__ */ React292.createElement(FlowSettingsPanel, { editor }) : null, [editor]);
|
|
31813
31871
|
const { open: openSettings } = usePanel("flow-settings-panel", settingsPanelContent);
|
|
31814
|
-
|
|
31872
|
+
useEffect108(() => {
|
|
31815
31873
|
if (!editor?._metadataManager) {
|
|
31816
31874
|
return;
|
|
31817
31875
|
}
|
|
@@ -31899,7 +31957,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
31899
31957
|
return null;
|
|
31900
31958
|
}
|
|
31901
31959
|
if (!hasCover) {
|
|
31902
|
-
return /* @__PURE__ */
|
|
31960
|
+
return /* @__PURE__ */ React292.createElement(
|
|
31903
31961
|
Box60,
|
|
31904
31962
|
{
|
|
31905
31963
|
style: {
|
|
@@ -31912,7 +31970,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
31912
31970
|
onMouseEnter: () => editable && setIsHovering(true),
|
|
31913
31971
|
onMouseLeave: () => editable && setIsHovering(false)
|
|
31914
31972
|
},
|
|
31915
|
-
/* @__PURE__ */
|
|
31973
|
+
/* @__PURE__ */ React292.createElement("div", { style: { maxWidth: "900px", margin: "0 auto", position: "relative", height: "100%" } }, /* @__PURE__ */ React292.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }), /* @__PURE__ */ React292.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") }), editable && isHovering && !logoSrc && /* @__PURE__ */ React292.createElement(
|
|
31916
31974
|
Group107,
|
|
31917
31975
|
{
|
|
31918
31976
|
gap: "xs",
|
|
@@ -31923,7 +31981,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
31923
31981
|
zIndex: 10
|
|
31924
31982
|
}
|
|
31925
31983
|
},
|
|
31926
|
-
/* @__PURE__ */
|
|
31984
|
+
/* @__PURE__ */ React292.createElement(
|
|
31927
31985
|
BaseIconPicker,
|
|
31928
31986
|
{
|
|
31929
31987
|
opened,
|
|
@@ -31932,11 +31990,11 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
31932
31990
|
onSelectIcon: (name) => handleSelectLogoIcon(name),
|
|
31933
31991
|
onUploadClick: () => logoFileInputRef.current?.click()
|
|
31934
31992
|
},
|
|
31935
|
-
/* @__PURE__ */
|
|
31993
|
+
/* @__PURE__ */ React292.createElement(CoverImageButton, { onClick: open }, "Add icon")
|
|
31936
31994
|
),
|
|
31937
|
-
/* @__PURE__ */
|
|
31938
|
-
/* @__PURE__ */
|
|
31939
|
-
), logoSrc && /* @__PURE__ */
|
|
31995
|
+
/* @__PURE__ */ React292.createElement(CoverImageButton, { onClick: () => coverFileInputRef.current?.click() }, "Add cover"),
|
|
31996
|
+
/* @__PURE__ */ React292.createElement(CoverImageButton, { onClick: openSettings }, "Settings")
|
|
31997
|
+
), logoSrc && /* @__PURE__ */ React292.createElement(
|
|
31940
31998
|
Box60,
|
|
31941
31999
|
{
|
|
31942
32000
|
style: {
|
|
@@ -31950,8 +32008,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
31950
32008
|
zIndex: 11
|
|
31951
32009
|
}
|
|
31952
32010
|
},
|
|
31953
|
-
/* @__PURE__ */
|
|
31954
|
-
editable && isHovering && /* @__PURE__ */
|
|
32011
|
+
/* @__PURE__ */ React292.createElement(PageIcon, { src: logoSrc, useCenter: true, iconSize: 64 }),
|
|
32012
|
+
editable && isHovering && /* @__PURE__ */ React292.createElement(
|
|
31955
32013
|
"div",
|
|
31956
32014
|
{
|
|
31957
32015
|
style: {
|
|
@@ -31966,7 +32024,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
31966
32024
|
alignItems: "center"
|
|
31967
32025
|
}
|
|
31968
32026
|
},
|
|
31969
|
-
/* @__PURE__ */
|
|
32027
|
+
/* @__PURE__ */ React292.createElement(
|
|
31970
32028
|
BaseIconPicker,
|
|
31971
32029
|
{
|
|
31972
32030
|
opened,
|
|
@@ -31975,16 +32033,16 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
31975
32033
|
onSelectIcon: (name) => handleSelectLogoIcon(name),
|
|
31976
32034
|
onUploadClick: () => logoFileInputRef.current?.click()
|
|
31977
32035
|
},
|
|
31978
|
-
/* @__PURE__ */
|
|
32036
|
+
/* @__PURE__ */ React292.createElement(CoverImageButton, { onClick: open }, "Change")
|
|
31979
32037
|
),
|
|
31980
|
-
/* @__PURE__ */
|
|
31981
|
-
/* @__PURE__ */
|
|
31982
|
-
/* @__PURE__ */
|
|
32038
|
+
/* @__PURE__ */ React292.createElement(CoverImageButton, { onClick: handleRemoveLogo }, "Remove"),
|
|
32039
|
+
/* @__PURE__ */ React292.createElement(CoverImageButton, { onClick: () => coverFileInputRef.current?.click() }, "Add cover"),
|
|
32040
|
+
/* @__PURE__ */ React292.createElement(CoverImageButton, { onClick: openSettings }, "Settings")
|
|
31983
32041
|
)
|
|
31984
32042
|
))
|
|
31985
32043
|
);
|
|
31986
32044
|
}
|
|
31987
|
-
return /* @__PURE__ */
|
|
32045
|
+
return /* @__PURE__ */ React292.createElement(
|
|
31988
32046
|
Box60,
|
|
31989
32047
|
{
|
|
31990
32048
|
style: {
|
|
@@ -32012,7 +32070,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
32012
32070
|
}
|
|
32013
32071
|
}
|
|
32014
32072
|
},
|
|
32015
|
-
/* @__PURE__ */
|
|
32073
|
+
/* @__PURE__ */ React292.createElement(
|
|
32016
32074
|
"img",
|
|
32017
32075
|
{
|
|
32018
32076
|
src: coverUrl,
|
|
@@ -32030,7 +32088,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
32030
32088
|
}
|
|
32031
32089
|
}
|
|
32032
32090
|
),
|
|
32033
|
-
editable && isHovering && /* @__PURE__ */
|
|
32091
|
+
editable && isHovering && /* @__PURE__ */ React292.createElement(
|
|
32034
32092
|
Group107,
|
|
32035
32093
|
{
|
|
32036
32094
|
gap: "xs",
|
|
@@ -32041,8 +32099,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
32041
32099
|
zIndex: 10
|
|
32042
32100
|
}
|
|
32043
32101
|
},
|
|
32044
|
-
/* @__PURE__ */
|
|
32045
|
-
/* @__PURE__ */
|
|
32102
|
+
/* @__PURE__ */ React292.createElement(CoverImageButton, { onClick: () => coverFileInputRef.current?.click() }, "Change cover"),
|
|
32103
|
+
/* @__PURE__ */ React292.createElement(
|
|
32046
32104
|
CoverImageButton,
|
|
32047
32105
|
{
|
|
32048
32106
|
onClick: () => {
|
|
@@ -32055,10 +32113,10 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
32055
32113
|
},
|
|
32056
32114
|
isRepositioning ? "Done" : "Reposition"
|
|
32057
32115
|
),
|
|
32058
|
-
/* @__PURE__ */
|
|
32059
|
-
/* @__PURE__ */
|
|
32116
|
+
/* @__PURE__ */ React292.createElement(CoverImageButton, { onClick: handleRemoveCover }, "Remove"),
|
|
32117
|
+
/* @__PURE__ */ React292.createElement(CoverImageButton, { onClick: openSettings }, "Settings")
|
|
32060
32118
|
),
|
|
32061
|
-
/* @__PURE__ */
|
|
32119
|
+
/* @__PURE__ */ React292.createElement("div", { style: { maxWidth: "900px", margin: "0 auto", position: "absolute", bottom: 0, left: 0, right: 0, height: "70px" } }, /* @__PURE__ */ React292.createElement(
|
|
32062
32120
|
Box60,
|
|
32063
32121
|
{
|
|
32064
32122
|
style: {
|
|
@@ -32070,8 +32128,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
32070
32128
|
zIndex: 11
|
|
32071
32129
|
}
|
|
32072
32130
|
},
|
|
32073
|
-
logoSrc && /* @__PURE__ */
|
|
32074
|
-
editable && isHovering && /* @__PURE__ */
|
|
32131
|
+
logoSrc && /* @__PURE__ */ React292.createElement(PageIcon, { src: logoSrc, useCenter: true, iconSize: 64 }),
|
|
32132
|
+
editable && isHovering && /* @__PURE__ */ React292.createElement(React292.Fragment, null, logoSrc ? /* @__PURE__ */ React292.createElement(
|
|
32075
32133
|
Group107,
|
|
32076
32134
|
{
|
|
32077
32135
|
gap: "xs",
|
|
@@ -32082,7 +32140,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
32082
32140
|
zIndex: 12
|
|
32083
32141
|
}
|
|
32084
32142
|
},
|
|
32085
|
-
/* @__PURE__ */
|
|
32143
|
+
/* @__PURE__ */ React292.createElement(
|
|
32086
32144
|
BaseIconPicker,
|
|
32087
32145
|
{
|
|
32088
32146
|
opened,
|
|
@@ -32091,10 +32149,10 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
32091
32149
|
onSelectIcon: (name) => handleSelectLogoIcon(name),
|
|
32092
32150
|
onUploadClick: () => logoFileInputRef.current?.click()
|
|
32093
32151
|
},
|
|
32094
|
-
/* @__PURE__ */
|
|
32152
|
+
/* @__PURE__ */ React292.createElement(CoverImageButton, { onClick: open }, "Change")
|
|
32095
32153
|
),
|
|
32096
|
-
/* @__PURE__ */
|
|
32097
|
-
) : /* @__PURE__ */
|
|
32154
|
+
/* @__PURE__ */ React292.createElement(CoverImageButton, { onClick: handleRemoveLogo }, "Remove")
|
|
32155
|
+
) : /* @__PURE__ */ React292.createElement(
|
|
32098
32156
|
BaseIconPicker,
|
|
32099
32157
|
{
|
|
32100
32158
|
opened,
|
|
@@ -32103,7 +32161,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
32103
32161
|
onSelectIcon: (name) => handleSelectLogoIcon(name),
|
|
32104
32162
|
onUploadClick: () => logoFileInputRef.current?.click()
|
|
32105
32163
|
},
|
|
32106
|
-
/* @__PURE__ */
|
|
32164
|
+
/* @__PURE__ */ React292.createElement(
|
|
32107
32165
|
CoverImageButton,
|
|
32108
32166
|
{
|
|
32109
32167
|
onClick: open,
|
|
@@ -32119,13 +32177,13 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
32119
32177
|
)
|
|
32120
32178
|
))
|
|
32121
32179
|
)),
|
|
32122
|
-
/* @__PURE__ */
|
|
32123
|
-
/* @__PURE__ */
|
|
32180
|
+
/* @__PURE__ */ React292.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }),
|
|
32181
|
+
/* @__PURE__ */ React292.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") })
|
|
32124
32182
|
);
|
|
32125
32183
|
}
|
|
32126
32184
|
|
|
32127
32185
|
// src/mantine/components/PageHeader.tsx
|
|
32128
|
-
import
|
|
32186
|
+
import React293, { useState as useState132, useRef as useRef28, useEffect as useEffect109 } from "react";
|
|
32129
32187
|
function PageHeader({
|
|
32130
32188
|
title = "New page",
|
|
32131
32189
|
icon: icon2,
|
|
@@ -32137,11 +32195,11 @@ function PageHeader({
|
|
|
32137
32195
|
isFavorited = false,
|
|
32138
32196
|
menuItems = []
|
|
32139
32197
|
}) {
|
|
32140
|
-
const [isMenuOpen, setIsMenuOpen] =
|
|
32141
|
-
const [isPrivacyOpen, setIsPrivacyOpen] =
|
|
32198
|
+
const [isMenuOpen, setIsMenuOpen] = useState132(false);
|
|
32199
|
+
const [isPrivacyOpen, setIsPrivacyOpen] = useState132(false);
|
|
32142
32200
|
const menuRef = useRef28(null);
|
|
32143
32201
|
const privacyRef = useRef28(null);
|
|
32144
|
-
|
|
32202
|
+
useEffect109(() => {
|
|
32145
32203
|
function handleClickOutside(event) {
|
|
32146
32204
|
if (menuRef.current && !menuRef.current.contains(event.target)) {
|
|
32147
32205
|
setIsMenuOpen(false);
|
|
@@ -32163,7 +32221,7 @@ function PageHeader({
|
|
|
32163
32221
|
setIsMenuOpen(false);
|
|
32164
32222
|
}
|
|
32165
32223
|
};
|
|
32166
|
-
return /* @__PURE__ */
|
|
32224
|
+
return /* @__PURE__ */ React293.createElement("div", { style: styles.container }, /* @__PURE__ */ React293.createElement("div", { style: styles.leftSection }, /* @__PURE__ */ React293.createElement("span", { style: styles.icon }, icon2 || "\u{1F4C4}"), /* @__PURE__ */ React293.createElement("span", { style: styles.title }, title), /* @__PURE__ */ React293.createElement("div", { style: styles.privacyContainer, ref: privacyRef }, /* @__PURE__ */ React293.createElement("button", { style: styles.privacyBadge, onClick: () => onPrivacyChange && setIsPrivacyOpen(!isPrivacyOpen) }, /* @__PURE__ */ React293.createElement("span", { style: styles.lockIcon }, isPrivate ? "\u{1F512}" : "\u{1F310}"), /* @__PURE__ */ React293.createElement("span", null, isPrivate ? "Private" : "Public"), onPrivacyChange && /* @__PURE__ */ React293.createElement("span", { style: styles.chevron }, "\u25BE")), isPrivacyOpen && onPrivacyChange && /* @__PURE__ */ React293.createElement("div", { style: styles.dropdown }, /* @__PURE__ */ React293.createElement(
|
|
32167
32225
|
"button",
|
|
32168
32226
|
{
|
|
32169
32227
|
style: {
|
|
@@ -32175,9 +32233,9 @@ function PageHeader({
|
|
|
32175
32233
|
setIsPrivacyOpen(false);
|
|
32176
32234
|
}
|
|
32177
32235
|
},
|
|
32178
|
-
/* @__PURE__ */
|
|
32179
|
-
/* @__PURE__ */
|
|
32180
|
-
), /* @__PURE__ */
|
|
32236
|
+
/* @__PURE__ */ React293.createElement("span", { style: styles.menuItemIcon }, "\u{1F512}"),
|
|
32237
|
+
/* @__PURE__ */ React293.createElement("span", null, "Private")
|
|
32238
|
+
), /* @__PURE__ */ React293.createElement(
|
|
32181
32239
|
"button",
|
|
32182
32240
|
{
|
|
32183
32241
|
style: {
|
|
@@ -32189,9 +32247,9 @@ function PageHeader({
|
|
|
32189
32247
|
setIsPrivacyOpen(false);
|
|
32190
32248
|
}
|
|
32191
32249
|
},
|
|
32192
|
-
/* @__PURE__ */
|
|
32193
|
-
/* @__PURE__ */
|
|
32194
|
-
)))), /* @__PURE__ */
|
|
32250
|
+
/* @__PURE__ */ React293.createElement("span", { style: styles.menuItemIcon }, "\u{1F310}"),
|
|
32251
|
+
/* @__PURE__ */ React293.createElement("span", null, "Public")
|
|
32252
|
+
)))), /* @__PURE__ */ React293.createElement("div", { style: styles.rightSection }, lastEdited && /* @__PURE__ */ React293.createElement("span", { style: styles.editedText }, lastEdited), onShare && /* @__PURE__ */ React293.createElement("button", { style: styles.shareButton, onClick: onShare }, "Share"), onFavorite && /* @__PURE__ */ React293.createElement("button", { style: styles.iconButton, onClick: onFavorite }, isFavorited ? "\u2605" : "\u2606"), menuItems.length > 0 && /* @__PURE__ */ React293.createElement("div", { style: styles.menuContainer, ref: menuRef }, /* @__PURE__ */ React293.createElement("button", { style: styles.menuButton, onClick: () => setIsMenuOpen(!isMenuOpen), "aria-label": "Menu" }, /* @__PURE__ */ React293.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor" }, /* @__PURE__ */ React293.createElement("circle", { cx: "3", cy: "8", r: "1.5" }), /* @__PURE__ */ React293.createElement("circle", { cx: "8", cy: "8", r: "1.5" }), /* @__PURE__ */ React293.createElement("circle", { cx: "13", cy: "8", r: "1.5" }))), isMenuOpen && /* @__PURE__ */ React293.createElement("div", { style: styles.dropdown }, menuItems.map((item, index) => /* @__PURE__ */ React293.createElement(React293.Fragment, { key: index }, item.divider && index > 0 && /* @__PURE__ */ React293.createElement("div", { style: styles.divider }), /* @__PURE__ */ React293.createElement(
|
|
32195
32253
|
"button",
|
|
32196
32254
|
{
|
|
32197
32255
|
style: {
|
|
@@ -32201,8 +32259,8 @@ function PageHeader({
|
|
|
32201
32259
|
onClick: () => handleMenuItemClick(item),
|
|
32202
32260
|
disabled: item.disabled
|
|
32203
32261
|
},
|
|
32204
|
-
item.icon && /* @__PURE__ */
|
|
32205
|
-
/* @__PURE__ */
|
|
32262
|
+
item.icon && /* @__PURE__ */ React293.createElement("span", { style: styles.menuItemIcon }, item.icon),
|
|
32263
|
+
/* @__PURE__ */ React293.createElement("span", null, item.label)
|
|
32206
32264
|
)))))));
|
|
32207
32265
|
}
|
|
32208
32266
|
var styles = {
|
|
@@ -32339,7 +32397,7 @@ var styles = {
|
|
|
32339
32397
|
};
|
|
32340
32398
|
|
|
32341
32399
|
// src/mantine/components/ExternalDropZone.tsx
|
|
32342
|
-
import
|
|
32400
|
+
import React294, { useCallback as useCallback107, useEffect as useEffect110, useRef as useRef29, useState as useState133 } from "react";
|
|
32343
32401
|
import { Box as Box61 } from "@mantine/core";
|
|
32344
32402
|
var SCROLL_ZONE_SIZE = 80;
|
|
32345
32403
|
var SCROLL_SPEED = 12;
|
|
@@ -32353,19 +32411,19 @@ var ExternalDropZone = ({
|
|
|
32353
32411
|
children
|
|
32354
32412
|
}) => {
|
|
32355
32413
|
const containerRef = useRef29(null);
|
|
32356
|
-
const [isValidDrag, setIsValidDrag] =
|
|
32357
|
-
const [isHoveringInPlacementMode, setIsHoveringInPlacementMode] =
|
|
32358
|
-
const [indicatorStyle, setIndicatorStyle] =
|
|
32414
|
+
const [isValidDrag, setIsValidDrag] = useState133(false);
|
|
32415
|
+
const [isHoveringInPlacementMode, setIsHoveringInPlacementMode] = useState133(false);
|
|
32416
|
+
const [indicatorStyle, setIndicatorStyle] = useState133({});
|
|
32359
32417
|
const dropPositionRef = useRef29(null);
|
|
32360
32418
|
const scrollAnimationRef = useRef29(null);
|
|
32361
32419
|
const scrollDirectionRef = useRef29(null);
|
|
32362
32420
|
const scrollContainerRef = useRef29(null);
|
|
32363
|
-
const getBlockElements =
|
|
32421
|
+
const getBlockElements = useCallback107(() => {
|
|
32364
32422
|
if (!containerRef.current) return [];
|
|
32365
32423
|
const blocks = containerRef.current.querySelectorAll('[data-node-type="blockContainer"]');
|
|
32366
32424
|
return Array.from(blocks);
|
|
32367
32425
|
}, []);
|
|
32368
|
-
const getScrollContainer =
|
|
32426
|
+
const getScrollContainer = useCallback107(() => {
|
|
32369
32427
|
if (scrollContainerRef.current) return scrollContainerRef.current;
|
|
32370
32428
|
let element = containerRef.current;
|
|
32371
32429
|
while (element) {
|
|
@@ -32380,7 +32438,7 @@ var ExternalDropZone = ({
|
|
|
32380
32438
|
scrollContainerRef.current = window;
|
|
32381
32439
|
return window;
|
|
32382
32440
|
}, []);
|
|
32383
|
-
const performScroll =
|
|
32441
|
+
const performScroll = useCallback107(() => {
|
|
32384
32442
|
const container = getScrollContainer();
|
|
32385
32443
|
const direction = scrollDirectionRef.current;
|
|
32386
32444
|
if (!direction) {
|
|
@@ -32395,7 +32453,7 @@ var ExternalDropZone = ({
|
|
|
32395
32453
|
}
|
|
32396
32454
|
scrollAnimationRef.current = requestAnimationFrame(performScroll);
|
|
32397
32455
|
}, [getScrollContainer]);
|
|
32398
|
-
const startAutoScroll =
|
|
32456
|
+
const startAutoScroll = useCallback107(
|
|
32399
32457
|
(direction) => {
|
|
32400
32458
|
if (scrollDirectionRef.current === direction) return;
|
|
32401
32459
|
scrollDirectionRef.current = direction;
|
|
@@ -32405,14 +32463,14 @@ var ExternalDropZone = ({
|
|
|
32405
32463
|
},
|
|
32406
32464
|
[performScroll]
|
|
32407
32465
|
);
|
|
32408
|
-
const stopAutoScroll =
|
|
32466
|
+
const stopAutoScroll = useCallback107(() => {
|
|
32409
32467
|
scrollDirectionRef.current = null;
|
|
32410
32468
|
if (scrollAnimationRef.current) {
|
|
32411
32469
|
cancelAnimationFrame(scrollAnimationRef.current);
|
|
32412
32470
|
scrollAnimationRef.current = null;
|
|
32413
32471
|
}
|
|
32414
32472
|
}, []);
|
|
32415
|
-
const checkAutoScroll =
|
|
32473
|
+
const checkAutoScroll = useCallback107(
|
|
32416
32474
|
(clientY) => {
|
|
32417
32475
|
const container = getScrollContainer();
|
|
32418
32476
|
let containerTop;
|
|
@@ -32435,7 +32493,7 @@ var ExternalDropZone = ({
|
|
|
32435
32493
|
},
|
|
32436
32494
|
[getScrollContainer, startAutoScroll, stopAutoScroll]
|
|
32437
32495
|
);
|
|
32438
|
-
const findDropPosition =
|
|
32496
|
+
const findDropPosition = useCallback107(
|
|
32439
32497
|
(clientY) => {
|
|
32440
32498
|
const blocks = getBlockElements();
|
|
32441
32499
|
if (blocks.length === 0 || !editor?.document) return null;
|
|
@@ -32468,7 +32526,7 @@ var ExternalDropZone = ({
|
|
|
32468
32526
|
},
|
|
32469
32527
|
[getBlockElements, editor]
|
|
32470
32528
|
);
|
|
32471
|
-
const handleDragOver =
|
|
32529
|
+
const handleDragOver = useCallback107(
|
|
32472
32530
|
(e) => {
|
|
32473
32531
|
if (!e.dataTransfer.types.includes(acceptedType)) return;
|
|
32474
32532
|
e.preventDefault();
|
|
@@ -32491,7 +32549,7 @@ var ExternalDropZone = ({
|
|
|
32491
32549
|
},
|
|
32492
32550
|
[acceptedType, findDropPosition, checkAutoScroll]
|
|
32493
32551
|
);
|
|
32494
|
-
const handleDragLeave =
|
|
32552
|
+
const handleDragLeave = useCallback107(
|
|
32495
32553
|
(e) => {
|
|
32496
32554
|
if (containerRef.current && !containerRef.current.contains(e.relatedTarget)) {
|
|
32497
32555
|
setIsValidDrag(false);
|
|
@@ -32501,7 +32559,7 @@ var ExternalDropZone = ({
|
|
|
32501
32559
|
},
|
|
32502
32560
|
[stopAutoScroll]
|
|
32503
32561
|
);
|
|
32504
|
-
const handleDrop =
|
|
32562
|
+
const handleDrop = useCallback107(
|
|
32505
32563
|
(e) => {
|
|
32506
32564
|
e.preventDefault();
|
|
32507
32565
|
e.stopPropagation();
|
|
@@ -32515,7 +32573,7 @@ var ExternalDropZone = ({
|
|
|
32515
32573
|
},
|
|
32516
32574
|
[onDrop, stopAutoScroll]
|
|
32517
32575
|
);
|
|
32518
|
-
|
|
32576
|
+
useEffect110(() => {
|
|
32519
32577
|
const handleGlobalDragEnd = () => {
|
|
32520
32578
|
setIsValidDrag(false);
|
|
32521
32579
|
dropPositionRef.current = null;
|
|
@@ -32524,7 +32582,7 @@ var ExternalDropZone = ({
|
|
|
32524
32582
|
window.addEventListener("dragend", handleGlobalDragEnd);
|
|
32525
32583
|
return () => window.removeEventListener("dragend", handleGlobalDragEnd);
|
|
32526
32584
|
}, [stopAutoScroll]);
|
|
32527
|
-
const handleOverlayMouseMove =
|
|
32585
|
+
const handleOverlayMouseMove = useCallback107(
|
|
32528
32586
|
(e) => {
|
|
32529
32587
|
setIsHoveringInPlacementMode(true);
|
|
32530
32588
|
checkAutoScroll(e.clientY);
|
|
@@ -32543,12 +32601,12 @@ var ExternalDropZone = ({
|
|
|
32543
32601
|
},
|
|
32544
32602
|
[findDropPosition, checkAutoScroll]
|
|
32545
32603
|
);
|
|
32546
|
-
const handleOverlayMouseLeave =
|
|
32604
|
+
const handleOverlayMouseLeave = useCallback107(() => {
|
|
32547
32605
|
setIsHoveringInPlacementMode(false);
|
|
32548
32606
|
dropPositionRef.current = null;
|
|
32549
32607
|
stopAutoScroll();
|
|
32550
32608
|
}, [stopAutoScroll]);
|
|
32551
|
-
const handleOverlayClick =
|
|
32609
|
+
const handleOverlayClick = useCallback107(
|
|
32552
32610
|
(e) => {
|
|
32553
32611
|
e.preventDefault();
|
|
32554
32612
|
e.stopPropagation();
|
|
@@ -32562,7 +32620,7 @@ var ExternalDropZone = ({
|
|
|
32562
32620
|
},
|
|
32563
32621
|
[onDrop, stopAutoScroll]
|
|
32564
32622
|
);
|
|
32565
|
-
const handleOverlayWheel =
|
|
32623
|
+
const handleOverlayWheel = useCallback107(
|
|
32566
32624
|
(e) => {
|
|
32567
32625
|
const container = getScrollContainer();
|
|
32568
32626
|
if (container === window) {
|
|
@@ -32573,7 +32631,7 @@ var ExternalDropZone = ({
|
|
|
32573
32631
|
},
|
|
32574
32632
|
[getScrollContainer]
|
|
32575
32633
|
);
|
|
32576
|
-
|
|
32634
|
+
useEffect110(() => {
|
|
32577
32635
|
if (!isPlacementMode) return;
|
|
32578
32636
|
const handleKeyDown = (e) => {
|
|
32579
32637
|
if (e.key === "Escape") {
|
|
@@ -32596,13 +32654,13 @@ var ExternalDropZone = ({
|
|
|
32596
32654
|
document.removeEventListener("click", handleGlobalClick, true);
|
|
32597
32655
|
};
|
|
32598
32656
|
}, [isPlacementMode, onPlacementCancel]);
|
|
32599
|
-
|
|
32657
|
+
useEffect110(() => {
|
|
32600
32658
|
if (!isPlacementMode) {
|
|
32601
32659
|
setIsHoveringInPlacementMode(false);
|
|
32602
32660
|
dropPositionRef.current = null;
|
|
32603
32661
|
}
|
|
32604
32662
|
}, [isPlacementMode]);
|
|
32605
|
-
|
|
32663
|
+
useEffect110(() => {
|
|
32606
32664
|
const isActive = isValidDrag || isPlacementMode && isHoveringInPlacementMode;
|
|
32607
32665
|
if (isActive) {
|
|
32608
32666
|
document.body.classList.add("external-artifact-drag-active");
|
|
@@ -32613,18 +32671,18 @@ var ExternalDropZone = ({
|
|
|
32613
32671
|
document.body.classList.remove("external-artifact-drag-active");
|
|
32614
32672
|
};
|
|
32615
32673
|
}, [isValidDrag, isPlacementMode, isHoveringInPlacementMode]);
|
|
32616
|
-
|
|
32674
|
+
useEffect110(() => {
|
|
32617
32675
|
return () => {
|
|
32618
32676
|
if (scrollAnimationRef.current) {
|
|
32619
32677
|
cancelAnimationFrame(scrollAnimationRef.current);
|
|
32620
32678
|
}
|
|
32621
32679
|
};
|
|
32622
32680
|
}, []);
|
|
32623
|
-
const indicatorWithPosition = dropIndicator &&
|
|
32681
|
+
const indicatorWithPosition = dropIndicator && React294.isValidElement(dropIndicator) ? React294.cloneElement(dropIndicator, {
|
|
32624
32682
|
indicatorTop: typeof indicatorStyle.top === "number" ? indicatorStyle.top : void 0
|
|
32625
32683
|
}) : dropIndicator;
|
|
32626
32684
|
const shouldShowIndicator = isValidDrag || isPlacementMode && isHoveringInPlacementMode;
|
|
32627
|
-
return /* @__PURE__ */
|
|
32685
|
+
return /* @__PURE__ */ React294.createElement(
|
|
32628
32686
|
Box61,
|
|
32629
32687
|
{
|
|
32630
32688
|
ref: containerRef,
|
|
@@ -32640,7 +32698,7 @@ var ExternalDropZone = ({
|
|
|
32640
32698
|
"data-placement-mode": isPlacementMode ? "true" : void 0
|
|
32641
32699
|
},
|
|
32642
32700
|
children,
|
|
32643
|
-
isPlacementMode && /* @__PURE__ */
|
|
32701
|
+
isPlacementMode && /* @__PURE__ */ React294.createElement(
|
|
32644
32702
|
Box61,
|
|
32645
32703
|
{
|
|
32646
32704
|
style: {
|
|
@@ -32660,7 +32718,7 @@ var ExternalDropZone = ({
|
|
|
32660
32718
|
onWheel: handleOverlayWheel
|
|
32661
32719
|
}
|
|
32662
32720
|
),
|
|
32663
|
-
shouldShowIndicator && indicatorWithPosition && /* @__PURE__ */
|
|
32721
|
+
shouldShowIndicator && indicatorWithPosition && /* @__PURE__ */ React294.createElement(Box61, { style: { ...indicatorStyle, background: "none", border: "none", boxShadow: "none" } }, indicatorWithPosition)
|
|
32664
32722
|
);
|
|
32665
32723
|
};
|
|
32666
32724
|
|
|
@@ -32686,8 +32744,8 @@ function IxoEditorContent({
|
|
|
32686
32744
|
}) {
|
|
32687
32745
|
const { activePanel } = usePanelStore();
|
|
32688
32746
|
const isPanelOpen = activePanel !== null;
|
|
32689
|
-
const [isRoomPrivate, setIsRoomPrivate] =
|
|
32690
|
-
|
|
32747
|
+
const [isRoomPrivate, setIsRoomPrivate] = useState134(pageHeaderProps?.isPrivate ?? true);
|
|
32748
|
+
useEffect111(() => {
|
|
32691
32749
|
const matrixClient = editor.getMatrixClient?.();
|
|
32692
32750
|
const roomId = editor.getRoomId?.();
|
|
32693
32751
|
if (!matrixClient || !roomId) return;
|
|
@@ -32703,7 +32761,7 @@ function IxoEditorContent({
|
|
|
32703
32761
|
} catch {
|
|
32704
32762
|
}
|
|
32705
32763
|
}, [editor]);
|
|
32706
|
-
const handlePrivacyChange =
|
|
32764
|
+
const handlePrivacyChange = useCallback108(
|
|
32707
32765
|
async (makePrivate) => {
|
|
32708
32766
|
const matrixClient = editor.getMatrixClient?.();
|
|
32709
32767
|
const roomId = editor.getRoomId?.();
|
|
@@ -32724,7 +32782,7 @@ function IxoEditorContent({
|
|
|
32724
32782
|
},
|
|
32725
32783
|
[editor]
|
|
32726
32784
|
);
|
|
32727
|
-
const editorContent = /* @__PURE__ */
|
|
32785
|
+
const editorContent = /* @__PURE__ */ React295.createElement(
|
|
32728
32786
|
BlockNoteView,
|
|
32729
32787
|
{
|
|
32730
32788
|
editor,
|
|
@@ -32739,7 +32797,7 @@ function IxoEditorContent({
|
|
|
32739
32797
|
onChange,
|
|
32740
32798
|
onSelectionChange
|
|
32741
32799
|
},
|
|
32742
|
-
config.slashMenu && /* @__PURE__ */
|
|
32800
|
+
config.slashMenu && /* @__PURE__ */ React295.createElement(
|
|
32743
32801
|
SuggestionMenuController,
|
|
32744
32802
|
{
|
|
32745
32803
|
triggerCharacter: "/",
|
|
@@ -32757,7 +32815,7 @@ function IxoEditorContent({
|
|
|
32757
32815
|
),
|
|
32758
32816
|
children
|
|
32759
32817
|
);
|
|
32760
|
-
return /* @__PURE__ */
|
|
32818
|
+
return /* @__PURE__ */ React295.createElement("div", { style: { display: "flex", height: "100%", width: "100%", gap: 0 } }, /* @__PURE__ */ React295.createElement(
|
|
32761
32819
|
"div",
|
|
32762
32820
|
{
|
|
32763
32821
|
className: `ixo-editor ixo-editor--theme-${config.theme} ${className}`,
|
|
@@ -32766,9 +32824,9 @@ function IxoEditorContent({
|
|
|
32766
32824
|
transition: "width 0.2s ease"
|
|
32767
32825
|
}
|
|
32768
32826
|
},
|
|
32769
|
-
selfNav && /* @__PURE__ */
|
|
32770
|
-
/* @__PURE__ */
|
|
32771
|
-
(onExternalDrop || isPlacementMode) && isEditable ? /* @__PURE__ */
|
|
32827
|
+
selfNav && /* @__PURE__ */ React295.createElement(PageHeader, { ...pageHeaderProps, isPrivate: isRoomPrivate, onPrivacyChange: handlePrivacyChange }),
|
|
32828
|
+
/* @__PURE__ */ React295.createElement(CoverImage, { coverImageUrl, logoUrl }),
|
|
32829
|
+
(onExternalDrop || isPlacementMode) && isEditable ? /* @__PURE__ */ React295.createElement(
|
|
32772
32830
|
ExternalDropZone,
|
|
32773
32831
|
{
|
|
32774
32832
|
editor,
|
|
@@ -32781,7 +32839,7 @@ function IxoEditorContent({
|
|
|
32781
32839
|
},
|
|
32782
32840
|
editorContent
|
|
32783
32841
|
) : editorContent
|
|
32784
|
-
), isPanelVisible && /* @__PURE__ */
|
|
32842
|
+
), isPanelVisible && /* @__PURE__ */ React295.createElement(PanelContent, { theme: config.theme }));
|
|
32785
32843
|
}
|
|
32786
32844
|
function IxoEditor({
|
|
32787
32845
|
editor,
|
|
@@ -32824,7 +32882,7 @@ function IxoEditor({
|
|
|
32824
32882
|
tableHandles: true
|
|
32825
32883
|
};
|
|
32826
32884
|
const isEditable = editable;
|
|
32827
|
-
const editorContent = /* @__PURE__ */
|
|
32885
|
+
const editorContent = /* @__PURE__ */ React295.createElement(
|
|
32828
32886
|
BlocknoteProvider,
|
|
32829
32887
|
{
|
|
32830
32888
|
editor,
|
|
@@ -32839,7 +32897,7 @@ function IxoEditor({
|
|
|
32839
32897
|
connectedUsers,
|
|
32840
32898
|
awarenessInstance
|
|
32841
32899
|
},
|
|
32842
|
-
/* @__PURE__ */
|
|
32900
|
+
/* @__PURE__ */ React295.createElement(
|
|
32843
32901
|
IxoEditorContent,
|
|
32844
32902
|
{
|
|
32845
32903
|
isPanelVisible,
|
|
@@ -32863,13 +32921,13 @@ function IxoEditor({
|
|
|
32863
32921
|
)
|
|
32864
32922
|
);
|
|
32865
32923
|
if (mantineTheme) {
|
|
32866
|
-
return /* @__PURE__ */
|
|
32924
|
+
return /* @__PURE__ */ React295.createElement(MantineProvider, { theme: mantineTheme }, editorContent);
|
|
32867
32925
|
}
|
|
32868
32926
|
return editorContent;
|
|
32869
32927
|
}
|
|
32870
32928
|
|
|
32871
32929
|
// src/mantine/components/DebugButton.tsx
|
|
32872
|
-
import
|
|
32930
|
+
import React296 from "react";
|
|
32873
32931
|
function DebugButton({ editor }) {
|
|
32874
32932
|
const yMapToObject = (map) => {
|
|
32875
32933
|
if (!map) return null;
|
|
@@ -32896,7 +32954,7 @@ function DebugButton({ editor }) {
|
|
|
32896
32954
|
const json = JSON.stringify(dump, null, 2);
|
|
32897
32955
|
console.log("Editor Debug Dump:\n" + json);
|
|
32898
32956
|
};
|
|
32899
|
-
return /* @__PURE__ */
|
|
32957
|
+
return /* @__PURE__ */ React296.createElement(
|
|
32900
32958
|
"button",
|
|
32901
32959
|
{
|
|
32902
32960
|
onClick: handleClick,
|
|
@@ -32922,15 +32980,15 @@ function DebugButton({ editor }) {
|
|
|
32922
32980
|
}
|
|
32923
32981
|
|
|
32924
32982
|
// src/mantine/components/EntitySigningSetup.tsx
|
|
32925
|
-
import
|
|
32926
|
-
import { Modal as Modal3, Stack as
|
|
32983
|
+
import React297, { useState as useState135 } from "react";
|
|
32984
|
+
import { Modal as Modal3, Stack as Stack197, Text as Text168, TextInput as TextInput9, Button as Button53, Alert as Alert53, Group as Group108 } from "@mantine/core";
|
|
32927
32985
|
import { IconAlertCircle as IconAlertCircle20, IconCheck as IconCheck23, IconKey as IconKey2 } from "@tabler/icons-react";
|
|
32928
32986
|
var EntitySigningSetup = ({ opened, onClose, entityDid, entityName, onSetup }) => {
|
|
32929
|
-
const [pin, setPin] =
|
|
32930
|
-
const [confirmPin, setConfirmPin] =
|
|
32931
|
-
const [loading, setLoading] =
|
|
32932
|
-
const [error, setError] =
|
|
32933
|
-
const [success, setSuccess] =
|
|
32987
|
+
const [pin, setPin] = useState135("");
|
|
32988
|
+
const [confirmPin, setConfirmPin] = useState135("");
|
|
32989
|
+
const [loading, setLoading] = useState135(false);
|
|
32990
|
+
const [error, setError] = useState135(null);
|
|
32991
|
+
const [success, setSuccess] = useState135(false);
|
|
32934
32992
|
const handleSetup = async () => {
|
|
32935
32993
|
if (pin.length < 4) {
|
|
32936
32994
|
setError("PIN must be at least 4 characters");
|
|
@@ -32970,15 +33028,15 @@ var EntitySigningSetup = ({ opened, onClose, entityDid, entityName, onSetup }) =
|
|
|
32970
33028
|
setSuccess(false);
|
|
32971
33029
|
}
|
|
32972
33030
|
};
|
|
32973
|
-
return /* @__PURE__ */
|
|
33031
|
+
return /* @__PURE__ */ React297.createElement(
|
|
32974
33032
|
Modal3,
|
|
32975
33033
|
{
|
|
32976
33034
|
opened,
|
|
32977
33035
|
onClose: handleClose,
|
|
32978
|
-
title: /* @__PURE__ */
|
|
33036
|
+
title: /* @__PURE__ */ React297.createElement(Group108, { gap: "xs" }, /* @__PURE__ */ React297.createElement(IconKey2, { size: 20 }), /* @__PURE__ */ React297.createElement(Text168, { fw: 600 }, "Entity Signing Setup")),
|
|
32979
33037
|
size: "md"
|
|
32980
33038
|
},
|
|
32981
|
-
/* @__PURE__ */
|
|
33039
|
+
/* @__PURE__ */ React297.createElement(Stack197, { gap: "md" }, success ? /* @__PURE__ */ React297.createElement(Alert53, { color: "green", icon: /* @__PURE__ */ React297.createElement(IconCheck23, { size: 16 }) }, "Entity signing key set up successfully!") : /* @__PURE__ */ React297.createElement(React297.Fragment, null, /* @__PURE__ */ React297.createElement(Text168, { size: "sm", c: "dimmed" }, "Flow authorization requires a signing key for", " ", /* @__PURE__ */ React297.createElement(Text168, { span: true, fw: 500 }, entityName || entityDid), "."), /* @__PURE__ */ React297.createElement(Alert53, { color: "blue", variant: "light" }, /* @__PURE__ */ React297.createElement(Text168, { size: "sm" }, "This is a ", /* @__PURE__ */ React297.createElement("strong", null, "one-time setup"), " that allows flows to grant permissions without requiring wallet signatures for each delegation.")), /* @__PURE__ */ React297.createElement(Stack197, { gap: "xs" }, /* @__PURE__ */ React297.createElement(Text168, { size: "sm", fw: 500 }, "What happens:"), /* @__PURE__ */ React297.createElement(Text168, { size: "sm", c: "dimmed" }, "1. A new signing key is generated"), /* @__PURE__ */ React297.createElement(Text168, { size: "sm", c: "dimmed" }, "2. Key is registered on the entity's DID document (requires wallet)"), /* @__PURE__ */ React297.createElement(Text168, { size: "sm", c: "dimmed" }, "3. Key is stored encrypted in the entity's Matrix room")), /* @__PURE__ */ React297.createElement(
|
|
32982
33040
|
TextInput9,
|
|
32983
33041
|
{
|
|
32984
33042
|
label: "Enter PIN to encrypt signing key",
|
|
@@ -32989,20 +33047,20 @@ var EntitySigningSetup = ({ opened, onClose, entityDid, entityName, onSetup }) =
|
|
|
32989
33047
|
onChange: (e) => setPin(e.currentTarget.value),
|
|
32990
33048
|
disabled: loading
|
|
32991
33049
|
}
|
|
32992
|
-
), /* @__PURE__ */
|
|
33050
|
+
), /* @__PURE__ */ React297.createElement(TextInput9, { label: "Confirm PIN", type: "password", placeholder: "Confirm PIN", value: confirmPin, onChange: (e) => setConfirmPin(e.currentTarget.value), disabled: loading }), error && /* @__PURE__ */ React297.createElement(Alert53, { color: "red", icon: /* @__PURE__ */ React297.createElement(IconAlertCircle20, { size: 16 }) }, error), /* @__PURE__ */ React297.createElement(Group108, { justify: "flex-end", mt: "md" }, /* @__PURE__ */ React297.createElement(Button53, { variant: "subtle", onClick: handleClose, disabled: loading }, "Cancel"), /* @__PURE__ */ React297.createElement(Button53, { onClick: handleSetup, loading, leftSection: /* @__PURE__ */ React297.createElement(IconKey2, { size: 16 }) }, "Setup Entity Signing"))))
|
|
32993
33051
|
);
|
|
32994
33052
|
};
|
|
32995
33053
|
|
|
32996
33054
|
// src/mantine/components/FlowPermissionsPanel.tsx
|
|
32997
|
-
import
|
|
32998
|
-
import { Stack as
|
|
33055
|
+
import React298, { useState as useState136, useEffect as useEffect112, useMemo as useMemo121 } from "react";
|
|
33056
|
+
import { Stack as Stack198, Text as Text169, Paper as Paper18, Group as Group109, Badge as Badge43, Button as Button54, ActionIcon as ActionIcon38, Loader as Loader54, Alert as Alert54, Divider as Divider29 } from "@mantine/core";
|
|
32999
33057
|
import { IconPlus as IconPlus12, IconTrash as IconTrash11, IconShieldCheck as IconShieldCheck15, IconUser as IconUser14, IconRobot as IconRobot4, IconBuilding as IconBuilding2 } from "@tabler/icons-react";
|
|
33000
33058
|
var FlowPermissionsPanel = ({ editor, entityDid, entityName, onGrantPermission, onRevokePermission, getUserDisplayName }) => {
|
|
33001
|
-
const [delegations, setDelegations] =
|
|
33002
|
-
const [loading, setLoading] =
|
|
33003
|
-
const [revoking, setRevoking] =
|
|
33004
|
-
const rootCapability =
|
|
33005
|
-
|
|
33059
|
+
const [delegations, setDelegations] = useState136([]);
|
|
33060
|
+
const [loading, setLoading] = useState136(true);
|
|
33061
|
+
const [revoking, setRevoking] = useState136(null);
|
|
33062
|
+
const rootCapability = useMemo121(() => editor.getRootCapability?.(), [editor]);
|
|
33063
|
+
useEffect112(() => {
|
|
33006
33064
|
const loadDelegations = async () => {
|
|
33007
33065
|
setLoading(true);
|
|
33008
33066
|
const allDelegations = editor.getAllDelegations?.() || [];
|
|
@@ -33041,11 +33099,11 @@ var FlowPermissionsPanel = ({ editor, entityDid, entityName, onGrantPermission,
|
|
|
33041
33099
|
const getIcon2 = (type) => {
|
|
33042
33100
|
switch (type) {
|
|
33043
33101
|
case "oracle":
|
|
33044
|
-
return /* @__PURE__ */
|
|
33102
|
+
return /* @__PURE__ */ React298.createElement(IconRobot4, { size: 16 });
|
|
33045
33103
|
case "entity":
|
|
33046
|
-
return /* @__PURE__ */
|
|
33104
|
+
return /* @__PURE__ */ React298.createElement(IconBuilding2, { size: 16 });
|
|
33047
33105
|
default:
|
|
33048
|
-
return /* @__PURE__ */
|
|
33106
|
+
return /* @__PURE__ */ React298.createElement(IconUser14, { size: 16 });
|
|
33049
33107
|
}
|
|
33050
33108
|
};
|
|
33051
33109
|
const formatCapabilities = (caps) => {
|
|
@@ -33064,32 +33122,32 @@ var FlowPermissionsPanel = ({ editor, entityDid, entityName, onGrantPermission,
|
|
|
33064
33122
|
if (date < /* @__PURE__ */ new Date()) return "Expired";
|
|
33065
33123
|
return date.toLocaleDateString();
|
|
33066
33124
|
};
|
|
33067
|
-
return /* @__PURE__ */
|
|
33125
|
+
return /* @__PURE__ */ React298.createElement(Stack198, { gap: "md" }, /* @__PURE__ */ React298.createElement(Stack198, { gap: "xs" }, /* @__PURE__ */ React298.createElement(Text169, { fw: 600, size: "sm" }, "Root Authority"), /* @__PURE__ */ React298.createElement(Paper18, { p: "sm", withBorder: true }, /* @__PURE__ */ React298.createElement(Group109, { gap: "xs" }, /* @__PURE__ */ React298.createElement(IconShieldCheck15, { size: 20, color: "var(--mantine-color-green-6)" }), /* @__PURE__ */ React298.createElement(Stack198, { gap: 2, style: { flex: 1 } }, /* @__PURE__ */ React298.createElement(Text169, { size: "sm", fw: 500 }, entityName || entityDid), /* @__PURE__ */ React298.createElement(Text169, { size: "xs", c: "dimmed" }, rootCapability ? `Granted: ${new Date(rootCapability.issuedAt).toLocaleDateString()}` : "Root capability not set up")), /* @__PURE__ */ React298.createElement(Badge43, { color: "green", variant: "light" }, "Entity")))), /* @__PURE__ */ React298.createElement(Divider29, { label: "Delegated Permissions", labelPosition: "center" }), loading ? /* @__PURE__ */ React298.createElement(Group109, { justify: "center", py: "xl" }, /* @__PURE__ */ React298.createElement(Loader54, { size: "sm" })) : delegations.length === 0 ? /* @__PURE__ */ React298.createElement(Alert54, { color: "gray", variant: "light" }, /* @__PURE__ */ React298.createElement(Text169, { size: "sm" }, "No permissions have been granted yet.")) : /* @__PURE__ */ React298.createElement(Stack198, { gap: "xs" }, delegations.map(({ capability, displayName, type }) => /* @__PURE__ */ React298.createElement(Paper18, { key: capability.id, p: "sm", withBorder: true }, /* @__PURE__ */ React298.createElement(Group109, { justify: "space-between" }, /* @__PURE__ */ React298.createElement(Group109, { gap: "xs" }, getIcon2(type), /* @__PURE__ */ React298.createElement(Stack198, { gap: 2 }, /* @__PURE__ */ React298.createElement(Text169, { size: "sm", fw: 500 }, displayName), /* @__PURE__ */ React298.createElement(Text169, { size: "xs", c: "dimmed" }, formatCapabilities(capability.capabilities)), /* @__PURE__ */ React298.createElement(Group109, { gap: "xs" }, /* @__PURE__ */ React298.createElement(Text169, { size: "xs", c: "dimmed" }, "Expires: ", formatExpiration(capability.expiration)), /* @__PURE__ */ React298.createElement(Text169, { size: "xs", c: "dimmed" }, "\u2022"), /* @__PURE__ */ React298.createElement(Text169, { size: "xs", c: "dimmed" }, "Granted by: ", capability.issuer === entityDid ? "Entity" : capability.issuer.slice(-8))))), /* @__PURE__ */ React298.createElement(ActionIcon38, { color: "red", variant: "subtle", onClick: () => handleRevoke(capability.id), loading: revoking === capability.id, disabled: !!revoking }, /* @__PURE__ */ React298.createElement(IconTrash11, { size: 16 })))))), /* @__PURE__ */ React298.createElement(Button54, { leftSection: /* @__PURE__ */ React298.createElement(IconPlus12, { size: 16 }), variant: "light", onClick: onGrantPermission }, "Grant Permission"));
|
|
33068
33126
|
};
|
|
33069
33127
|
|
|
33070
33128
|
// src/mantine/components/GrantPermissionModal.tsx
|
|
33071
|
-
import
|
|
33072
|
-
import { Modal as Modal4, Stack as
|
|
33129
|
+
import React299, { useState as useState137, useCallback as useCallback109 } from "react";
|
|
33130
|
+
import { Modal as Modal4, Stack as Stack199, Text as Text170, TextInput as TextInput10, Button as Button55, Group as Group110, Radio as Radio6, Checkbox as Checkbox13, Alert as Alert55, Paper as Paper19, Loader as Loader55, Badge as Badge44, ActionIcon as ActionIcon39, Divider as Divider30, NumberInput as NumberInput3 } from "@mantine/core";
|
|
33073
33131
|
import { IconSearch as IconSearch8, IconUser as IconUser15, IconRobot as IconRobot5, IconX as IconX15, IconShieldPlus as IconShieldPlus4 } from "@tabler/icons-react";
|
|
33074
33132
|
var GrantPermissionModal = ({ opened, onClose, flowUri, blocks, targetBlockId, searchUsers, getOracles, onGrant }) => {
|
|
33075
33133
|
const singleBlockMode = !!targetBlockId || blocks.length === 1;
|
|
33076
33134
|
const fixedBlockId = targetBlockId || (blocks.length === 1 ? blocks[0].id : null);
|
|
33077
33135
|
const fixedBlock = fixedBlockId ? blocks.find((b) => b.id === fixedBlockId) || blocks[0] : null;
|
|
33078
|
-
const [recipientType, setRecipientType] =
|
|
33079
|
-
const [searchQuery, setSearchQuery] =
|
|
33080
|
-
const [searchResults, setSearchResults] =
|
|
33081
|
-
const [searching, setSearching] =
|
|
33082
|
-
const [selectedRecipient, setSelectedRecipient] =
|
|
33083
|
-
const [manualDid, setManualDid] =
|
|
33084
|
-
const [scopeType, setScopeType] =
|
|
33085
|
-
const [selectedBlocks, setSelectedBlocks] =
|
|
33086
|
-
const [expirationEnabled, setExpirationEnabled] =
|
|
33087
|
-
const [expirationDays, setExpirationDays] =
|
|
33088
|
-
const [canDelegate, setCanDelegate] =
|
|
33089
|
-
const [pin, setPin] =
|
|
33090
|
-
const [loading, setLoading] =
|
|
33091
|
-
const [error, setError] =
|
|
33092
|
-
const handleSearch =
|
|
33136
|
+
const [recipientType, setRecipientType] = useState137("user");
|
|
33137
|
+
const [searchQuery, setSearchQuery] = useState137("");
|
|
33138
|
+
const [searchResults, setSearchResults] = useState137([]);
|
|
33139
|
+
const [searching, setSearching] = useState137(false);
|
|
33140
|
+
const [selectedRecipient, setSelectedRecipient] = useState137(null);
|
|
33141
|
+
const [manualDid, setManualDid] = useState137("");
|
|
33142
|
+
const [scopeType, setScopeType] = useState137("full");
|
|
33143
|
+
const [selectedBlocks, setSelectedBlocks] = useState137([]);
|
|
33144
|
+
const [expirationEnabled, setExpirationEnabled] = useState137(false);
|
|
33145
|
+
const [expirationDays, setExpirationDays] = useState137(30);
|
|
33146
|
+
const [canDelegate, setCanDelegate] = useState137(false);
|
|
33147
|
+
const [pin, setPin] = useState137("");
|
|
33148
|
+
const [loading, setLoading] = useState137(false);
|
|
33149
|
+
const [error, setError] = useState137(null);
|
|
33150
|
+
const handleSearch = useCallback109(async () => {
|
|
33093
33151
|
if (searchQuery.length < 2) return;
|
|
33094
33152
|
setSearching(true);
|
|
33095
33153
|
try {
|
|
@@ -33176,15 +33234,15 @@ var GrantPermissionModal = ({ opened, onClose, flowUri, blocks, targetBlockId, s
|
|
|
33176
33234
|
resetForm();
|
|
33177
33235
|
}
|
|
33178
33236
|
};
|
|
33179
|
-
return /* @__PURE__ */
|
|
33237
|
+
return /* @__PURE__ */ React299.createElement(
|
|
33180
33238
|
Modal4,
|
|
33181
33239
|
{
|
|
33182
33240
|
opened,
|
|
33183
33241
|
onClose: handleClose,
|
|
33184
|
-
title: /* @__PURE__ */
|
|
33242
|
+
title: /* @__PURE__ */ React299.createElement(Group110, { gap: "xs" }, /* @__PURE__ */ React299.createElement(IconShieldPlus4, { size: 20 }), /* @__PURE__ */ React299.createElement(Text170, { fw: 600 }, "Grant Permission")),
|
|
33185
33243
|
size: "lg"
|
|
33186
33244
|
},
|
|
33187
|
-
/* @__PURE__ */
|
|
33245
|
+
/* @__PURE__ */ React299.createElement(Stack199, { gap: "md" }, /* @__PURE__ */ React299.createElement(Stack199, { gap: "xs" }, /* @__PURE__ */ React299.createElement(Text170, { size: "sm", fw: 500 }, "Recipient Type"), /* @__PURE__ */ React299.createElement(
|
|
33188
33246
|
Radio6.Group,
|
|
33189
33247
|
{
|
|
33190
33248
|
value: recipientType,
|
|
@@ -33194,23 +33252,23 @@ var GrantPermissionModal = ({ opened, onClose, flowUri, blocks, targetBlockId, s
|
|
|
33194
33252
|
setSearchResults([]);
|
|
33195
33253
|
}
|
|
33196
33254
|
},
|
|
33197
|
-
/* @__PURE__ */
|
|
33198
|
-
)), recipientType !== "manual" ? /* @__PURE__ */
|
|
33255
|
+
/* @__PURE__ */ React299.createElement(Group110, null, /* @__PURE__ */ React299.createElement(Radio6, { value: "user", label: "User" }), /* @__PURE__ */ React299.createElement(Radio6, { value: "oracle", label: "Oracle" }), /* @__PURE__ */ React299.createElement(Radio6, { value: "manual", label: "Enter DID" }))
|
|
33256
|
+
)), recipientType !== "manual" ? /* @__PURE__ */ React299.createElement(Stack199, { gap: "xs" }, /* @__PURE__ */ React299.createElement(
|
|
33199
33257
|
TextInput10,
|
|
33200
33258
|
{
|
|
33201
33259
|
placeholder: recipientType === "oracle" ? "Search oracles..." : "Search users...",
|
|
33202
|
-
leftSection: /* @__PURE__ */
|
|
33203
|
-
rightSection: searching ? /* @__PURE__ */
|
|
33260
|
+
leftSection: /* @__PURE__ */ React299.createElement(IconSearch8, { size: 16 }),
|
|
33261
|
+
rightSection: searching ? /* @__PURE__ */ React299.createElement(Loader55, { size: 14 }) : null,
|
|
33204
33262
|
value: searchQuery,
|
|
33205
33263
|
onChange: (e) => setSearchQuery(e.currentTarget.value),
|
|
33206
33264
|
onKeyDown: (e) => e.key === "Enter" && handleSearch()
|
|
33207
33265
|
}
|
|
33208
|
-
), selectedRecipient ? /* @__PURE__ */
|
|
33266
|
+
), selectedRecipient ? /* @__PURE__ */ React299.createElement(Paper19, { p: "sm", withBorder: true }, /* @__PURE__ */ React299.createElement(Group110, { justify: "space-between" }, /* @__PURE__ */ React299.createElement(Group110, { gap: "xs" }, recipientType === "oracle" ? /* @__PURE__ */ React299.createElement(IconRobot5, { size: 16 }) : /* @__PURE__ */ React299.createElement(IconUser15, { size: 16 }), /* @__PURE__ */ React299.createElement(Text170, { size: "sm" }, selectedRecipient.displayName), /* @__PURE__ */ React299.createElement(Badge44, { size: "xs", variant: "light" }, selectedRecipient.did.slice(-12))), /* @__PURE__ */ React299.createElement(ActionIcon39, { size: "sm", variant: "subtle", onClick: () => setSelectedRecipient(null) }, /* @__PURE__ */ React299.createElement(IconX15, { size: 14 })))) : searchResults.length > 0 ? /* @__PURE__ */ React299.createElement(Paper19, { p: "xs", withBorder: true, style: { maxHeight: 150, overflow: "auto" } }, /* @__PURE__ */ React299.createElement(Stack199, { gap: 4 }, searchResults.map((result) => /* @__PURE__ */ React299.createElement(Button55, { key: result.did, variant: "subtle", size: "sm", justify: "flex-start", onClick: () => setSelectedRecipient(result) }, result.displayName)))) : null) : /* @__PURE__ */ React299.createElement(TextInput10, { label: "Recipient DID", placeholder: "did:ixo:...", value: manualDid, onChange: (e) => setManualDid(e.currentTarget.value) }), /* @__PURE__ */ React299.createElement(Divider30, null), /* @__PURE__ */ React299.createElement(Stack199, { gap: "xs" }, /* @__PURE__ */ React299.createElement(Text170, { size: "sm", fw: 500 }, "Permission Scope"), singleBlockMode && fixedBlock ? (
|
|
33209
33267
|
// Single block mode: show fixed block info
|
|
33210
|
-
/* @__PURE__ */
|
|
33268
|
+
/* @__PURE__ */ React299.createElement(Paper19, { p: "sm", withBorder: true }, /* @__PURE__ */ React299.createElement(Group110, { gap: "xs" }, /* @__PURE__ */ React299.createElement(Badge44, { variant: "light", color: "blue" }, fixedBlock.type), /* @__PURE__ */ React299.createElement(Text170, { size: "sm" }, fixedBlock.name || `Block ${fixedBlock.id.slice(-8)}`)), /* @__PURE__ */ React299.createElement(Text170, { size: "xs", c: "dimmed", mt: "xs" }, "Permission will be granted to execute this specific block."))
|
|
33211
33269
|
) : (
|
|
33212
33270
|
// Multi-block mode: show scope selection
|
|
33213
|
-
/* @__PURE__ */
|
|
33271
|
+
/* @__PURE__ */ React299.createElement(React299.Fragment, null, /* @__PURE__ */ React299.createElement(Radio6.Group, { value: scopeType, onChange: (v) => setScopeType(v) }, /* @__PURE__ */ React299.createElement(Stack199, { gap: "xs" }, /* @__PURE__ */ React299.createElement(Radio6, { value: "full", label: "Full flow access (can execute any block)" }), /* @__PURE__ */ React299.createElement(Radio6, { value: "blocks", label: "Specific blocks only" }))), scopeType === "blocks" && /* @__PURE__ */ React299.createElement(Paper19, { p: "sm", withBorder: true, style: { maxHeight: 150, overflow: "auto" } }, /* @__PURE__ */ React299.createElement(Stack199, { gap: "xs" }, blocks.map((block) => /* @__PURE__ */ React299.createElement(
|
|
33214
33272
|
Checkbox13,
|
|
33215
33273
|
{
|
|
33216
33274
|
key: block.id,
|
|
@@ -33225,7 +33283,7 @@ var GrantPermissionModal = ({ opened, onClose, flowUri, blocks, targetBlockId, s
|
|
|
33225
33283
|
}
|
|
33226
33284
|
}
|
|
33227
33285
|
)))))
|
|
33228
|
-
)), /* @__PURE__ */
|
|
33286
|
+
)), /* @__PURE__ */ React299.createElement(Divider30, null), /* @__PURE__ */ React299.createElement(Stack199, { gap: "xs" }, /* @__PURE__ */ React299.createElement(Checkbox13, { label: "Set expiration", checked: expirationEnabled, onChange: (e) => setExpirationEnabled(e.currentTarget.checked) }), expirationEnabled && /* @__PURE__ */ React299.createElement(NumberInput3, { label: "Expires in (days)", placeholder: "30", value: expirationDays, onChange: setExpirationDays, min: 1, max: 365 })), /* @__PURE__ */ React299.createElement(
|
|
33229
33287
|
Checkbox13,
|
|
33230
33288
|
{
|
|
33231
33289
|
label: "Recipient can grant permissions to others",
|
|
@@ -33233,7 +33291,7 @@ var GrantPermissionModal = ({ opened, onClose, flowUri, blocks, targetBlockId, s
|
|
|
33233
33291
|
checked: canDelegate,
|
|
33234
33292
|
onChange: (e) => setCanDelegate(e.currentTarget.checked)
|
|
33235
33293
|
}
|
|
33236
|
-
), /* @__PURE__ */
|
|
33294
|
+
), /* @__PURE__ */ React299.createElement(Divider30, null), /* @__PURE__ */ React299.createElement(TextInput10, { label: "Enter your PIN to sign this delegation", type: "password", placeholder: "PIN", value: pin, onChange: (e) => setPin(e.currentTarget.value) }), error && /* @__PURE__ */ React299.createElement(Alert55, { color: "red" }, error), /* @__PURE__ */ React299.createElement(Group110, { justify: "flex-end" }, /* @__PURE__ */ React299.createElement(Button55, { variant: "subtle", onClick: handleClose, disabled: loading }, "Cancel"), /* @__PURE__ */ React299.createElement(Button55, { onClick: handleGrant, loading }, "Grant Permission")))
|
|
33237
33295
|
);
|
|
33238
33296
|
};
|
|
33239
33297
|
|
|
@@ -33306,10 +33364,6 @@ export {
|
|
|
33306
33364
|
registerBlockActions,
|
|
33307
33365
|
getBlockActions,
|
|
33308
33366
|
useHookedActions,
|
|
33309
|
-
getHomeserver,
|
|
33310
|
-
didToMatrixUserId,
|
|
33311
|
-
findOrCreateDMRoom,
|
|
33312
|
-
sendDirectMessage,
|
|
33313
33367
|
registerBuiltInActionTypes,
|
|
33314
33368
|
initializeHookedActions,
|
|
33315
33369
|
BlocknoteProvider,
|
|
@@ -33350,4 +33404,4 @@ export {
|
|
|
33350
33404
|
getExtraSlashMenuItems,
|
|
33351
33405
|
useCreateIxoEditor
|
|
33352
33406
|
};
|
|
33353
|
-
//# sourceMappingURL=chunk-
|
|
33407
|
+
//# sourceMappingURL=chunk-K75BAQDR.mjs.map
|