@liveblocks/emails 2.14.0 → 2.15.0
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/index.d.mts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.js +63 -51
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +60 -48
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { detectDupes } from "@liveblocks/core";
|
|
|
3
3
|
|
|
4
4
|
// src/version.ts
|
|
5
5
|
var PKG_NAME = "@liveblocks/emails";
|
|
6
|
-
var PKG_VERSION = "2.
|
|
6
|
+
var PKG_VERSION = "2.15.0";
|
|
7
7
|
var PKG_FORMAT = "esm";
|
|
8
8
|
|
|
9
9
|
// ../../node_modules/lib0/map.js
|
|
@@ -7623,18 +7623,13 @@ var createDevelopmentWarning = (condition, ...args2) => {
|
|
|
7623
7623
|
|
|
7624
7624
|
// src/lib/batch-users-resolver.ts
|
|
7625
7625
|
var BatchUsersResolver = class {
|
|
7626
|
+
isResolved;
|
|
7627
|
+
markAsResolved;
|
|
7628
|
+
resolvePromise;
|
|
7629
|
+
primeResolveUsersFn;
|
|
7630
|
+
usersById;
|
|
7631
|
+
warnAsAlreadyResolved;
|
|
7626
7632
|
constructor(resolveUsers) {
|
|
7627
|
-
this.resolveUsers = async (args2) => {
|
|
7628
|
-
if (this.isResolved) {
|
|
7629
|
-
this.warnAsAlreadyResolved();
|
|
7630
|
-
return void 0;
|
|
7631
|
-
}
|
|
7632
|
-
for (const userId of args2.userIds) {
|
|
7633
|
-
this.usersById.set(userId, void 0);
|
|
7634
|
-
}
|
|
7635
|
-
await this.resolvePromise;
|
|
7636
|
-
return args2.userIds.map((userId) => this.usersById.get(userId));
|
|
7637
|
-
};
|
|
7638
7633
|
const { promise, resolve } = Promise_withResolvers();
|
|
7639
7634
|
this.isResolved = false;
|
|
7640
7635
|
this.markAsResolved = resolve;
|
|
@@ -7646,6 +7641,17 @@ var BatchUsersResolver = class {
|
|
|
7646
7641
|
"Batch users resolver promise already resolved. It can only resolve once."
|
|
7647
7642
|
);
|
|
7648
7643
|
}
|
|
7644
|
+
resolveUsers = async (args2) => {
|
|
7645
|
+
if (this.isResolved) {
|
|
7646
|
+
this.warnAsAlreadyResolved();
|
|
7647
|
+
return void 0;
|
|
7648
|
+
}
|
|
7649
|
+
for (const userId of args2.userIds) {
|
|
7650
|
+
this.usersById.set(userId, void 0);
|
|
7651
|
+
}
|
|
7652
|
+
await this.resolvePromise;
|
|
7653
|
+
return args2.userIds.map((userId) => this.usersById.get(userId));
|
|
7654
|
+
};
|
|
7649
7655
|
async resolve() {
|
|
7650
7656
|
if (this.isResolved) {
|
|
7651
7657
|
this.warnAsAlreadyResolved();
|
|
@@ -7685,7 +7691,6 @@ import {
|
|
|
7685
7691
|
html,
|
|
7686
7692
|
htmlSafe
|
|
7687
7693
|
} from "@liveblocks/core";
|
|
7688
|
-
import React from "react";
|
|
7689
7694
|
|
|
7690
7695
|
// src/lib/constants.ts
|
|
7691
7696
|
var MENTION_CHARACTER = "@";
|
|
@@ -7919,6 +7924,7 @@ function findTiptapMentionNodeWithContext({
|
|
|
7919
7924
|
}
|
|
7920
7925
|
|
|
7921
7926
|
// src/liveblocks-text-editor.tsx
|
|
7927
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7922
7928
|
var baseLiveblocksTextEditorTextFormat = {
|
|
7923
7929
|
bold: false,
|
|
7924
7930
|
italic: false,
|
|
@@ -8049,23 +8055,26 @@ var resolveUsersInLiveblocksTextEditorNodes = async (nodes, resolveUsers) => {
|
|
|
8049
8055
|
return resolvedUsers;
|
|
8050
8056
|
};
|
|
8051
8057
|
var baseComponents = {
|
|
8052
|
-
Container: ({ children }) => /* @__PURE__ */
|
|
8053
|
-
Mention: ({ element, user }) => /* @__PURE__ */
|
|
8058
|
+
Container: ({ children }) => /* @__PURE__ */ jsx("div", { children }),
|
|
8059
|
+
Mention: ({ element, user }) => /* @__PURE__ */ jsxs("span", { "data-mention": true, children: [
|
|
8060
|
+
MENTION_CHARACTER,
|
|
8061
|
+
user?.name ?? element.userId
|
|
8062
|
+
] }),
|
|
8054
8063
|
Text: ({ element }) => {
|
|
8055
8064
|
let children = element.text;
|
|
8056
8065
|
if (element.bold) {
|
|
8057
|
-
children = /* @__PURE__ */
|
|
8066
|
+
children = /* @__PURE__ */ jsx("strong", { children });
|
|
8058
8067
|
}
|
|
8059
8068
|
if (element.italic) {
|
|
8060
|
-
children = /* @__PURE__ */
|
|
8069
|
+
children = /* @__PURE__ */ jsx("em", { children });
|
|
8061
8070
|
}
|
|
8062
8071
|
if (element.strikethrough) {
|
|
8063
|
-
children = /* @__PURE__ */
|
|
8072
|
+
children = /* @__PURE__ */ jsx("s", { children });
|
|
8064
8073
|
}
|
|
8065
8074
|
if (element.code) {
|
|
8066
|
-
children = /* @__PURE__ */
|
|
8075
|
+
children = /* @__PURE__ */ jsx("code", { children });
|
|
8067
8076
|
}
|
|
8068
|
-
return /* @__PURE__ */
|
|
8077
|
+
return /* @__PURE__ */ jsx("span", { children });
|
|
8069
8078
|
}
|
|
8070
8079
|
};
|
|
8071
8080
|
async function convertTextEditorNodesAsReact(nodes, options) {
|
|
@@ -8080,25 +8089,25 @@ async function convertTextEditorNodesAsReact(nodes, options) {
|
|
|
8080
8089
|
const children = nodes.map((node, index) => {
|
|
8081
8090
|
switch (node.type) {
|
|
8082
8091
|
case "mention":
|
|
8083
|
-
return /* @__PURE__ */
|
|
8092
|
+
return /* @__PURE__ */ jsx(
|
|
8084
8093
|
Components.Mention,
|
|
8085
8094
|
{
|
|
8086
|
-
key: `lb-text-editor-mention-${index}-${node.userId}`,
|
|
8087
8095
|
element: node,
|
|
8088
8096
|
user: resolvedUsers.get(node.userId)
|
|
8089
|
-
}
|
|
8097
|
+
},
|
|
8098
|
+
`lb-text-editor-mention-${index}-${node.userId}`
|
|
8090
8099
|
);
|
|
8091
8100
|
case "text":
|
|
8092
|
-
return /* @__PURE__ */
|
|
8101
|
+
return /* @__PURE__ */ jsx(
|
|
8093
8102
|
Components.Text,
|
|
8094
8103
|
{
|
|
8095
|
-
key: `lb-text-editor-text-${index}`,
|
|
8096
8104
|
element: node
|
|
8097
|
-
}
|
|
8105
|
+
},
|
|
8106
|
+
`lb-text-editor-text-${index}`
|
|
8098
8107
|
);
|
|
8099
8108
|
}
|
|
8100
8109
|
});
|
|
8101
|
-
return /* @__PURE__ */
|
|
8110
|
+
return /* @__PURE__ */ jsx(Components.Container, { children }, "lb-text-editor-container");
|
|
8102
8111
|
}
|
|
8103
8112
|
var baseStyles = {
|
|
8104
8113
|
container: {
|
|
@@ -8374,28 +8383,31 @@ import {
|
|
|
8374
8383
|
stringifyCommentBody,
|
|
8375
8384
|
toAbsoluteUrl
|
|
8376
8385
|
} from "@liveblocks/core";
|
|
8377
|
-
import
|
|
8386
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
8378
8387
|
var baseComponents2 = {
|
|
8379
|
-
Container: ({ children }) => /* @__PURE__ */
|
|
8380
|
-
Paragraph: ({ children }) => /* @__PURE__ */
|
|
8388
|
+
Container: ({ children }) => /* @__PURE__ */ jsx2("div", { children }),
|
|
8389
|
+
Paragraph: ({ children }) => /* @__PURE__ */ jsx2("p", { children }),
|
|
8381
8390
|
Text: ({ element }) => {
|
|
8382
8391
|
let children = element.text;
|
|
8383
8392
|
if (element.bold) {
|
|
8384
|
-
children = /* @__PURE__ */
|
|
8393
|
+
children = /* @__PURE__ */ jsx2("strong", { children });
|
|
8385
8394
|
}
|
|
8386
8395
|
if (element.italic) {
|
|
8387
|
-
children = /* @__PURE__ */
|
|
8396
|
+
children = /* @__PURE__ */ jsx2("em", { children });
|
|
8388
8397
|
}
|
|
8389
8398
|
if (element.strikethrough) {
|
|
8390
|
-
children = /* @__PURE__ */
|
|
8399
|
+
children = /* @__PURE__ */ jsx2("s", { children });
|
|
8391
8400
|
}
|
|
8392
8401
|
if (element.code) {
|
|
8393
|
-
children = /* @__PURE__ */
|
|
8402
|
+
children = /* @__PURE__ */ jsx2("code", { children });
|
|
8394
8403
|
}
|
|
8395
|
-
return /* @__PURE__ */
|
|
8404
|
+
return /* @__PURE__ */ jsx2("span", { children });
|
|
8396
8405
|
},
|
|
8397
|
-
Link: ({ element, href }) => /* @__PURE__ */
|
|
8398
|
-
Mention: ({ element, user }) => /* @__PURE__ */
|
|
8406
|
+
Link: ({ element, href }) => /* @__PURE__ */ jsx2("a", { href, target: "_blank", rel: "noopener noreferrer", children: element.text ?? element.url }),
|
|
8407
|
+
Mention: ({ element, user }) => /* @__PURE__ */ jsxs2("span", { "data-mention": true, children: [
|
|
8408
|
+
MENTION_CHARACTER,
|
|
8409
|
+
user?.name ?? element.id
|
|
8410
|
+
] })
|
|
8399
8411
|
};
|
|
8400
8412
|
async function convertCommentBodyAsReact(body, options) {
|
|
8401
8413
|
const Components = {
|
|
@@ -8411,38 +8423,38 @@ async function convertCommentBodyAsReact(body, options) {
|
|
|
8411
8423
|
case "paragraph": {
|
|
8412
8424
|
const children = block.children.map((inline, inlineIndex) => {
|
|
8413
8425
|
if (isCommentBodyMention(inline)) {
|
|
8414
|
-
return inline.id ? /* @__PURE__ */
|
|
8426
|
+
return inline.id ? /* @__PURE__ */ jsx2(
|
|
8415
8427
|
Components.Mention,
|
|
8416
8428
|
{
|
|
8417
|
-
key: `lb-comment-body-mention-${inlineIndex}`,
|
|
8418
8429
|
element: inline,
|
|
8419
8430
|
user: resolvedUsers.get(inline.id)
|
|
8420
|
-
}
|
|
8431
|
+
},
|
|
8432
|
+
`lb-comment-body-mention-${inlineIndex}`
|
|
8421
8433
|
) : null;
|
|
8422
8434
|
}
|
|
8423
8435
|
if (isCommentBodyLink(inline)) {
|
|
8424
8436
|
const href = toAbsoluteUrl(inline.url) ?? inline.url;
|
|
8425
|
-
return /* @__PURE__ */
|
|
8437
|
+
return /* @__PURE__ */ jsx2(
|
|
8426
8438
|
Components.Link,
|
|
8427
8439
|
{
|
|
8428
|
-
key: `lb-comment-body-link-${inlineIndex}`,
|
|
8429
8440
|
element: inline,
|
|
8430
8441
|
href
|
|
8431
|
-
}
|
|
8442
|
+
},
|
|
8443
|
+
`lb-comment-body-link-${inlineIndex}`
|
|
8432
8444
|
);
|
|
8433
8445
|
}
|
|
8434
8446
|
if (isCommentBodyText(inline)) {
|
|
8435
|
-
return /* @__PURE__ */
|
|
8447
|
+
return /* @__PURE__ */ jsx2(
|
|
8436
8448
|
Components.Text,
|
|
8437
8449
|
{
|
|
8438
|
-
key: `lb-comment-body-text-${inlineIndex}`,
|
|
8439
8450
|
element: inline
|
|
8440
|
-
}
|
|
8451
|
+
},
|
|
8452
|
+
`lb-comment-body-text-${inlineIndex}`
|
|
8441
8453
|
);
|
|
8442
8454
|
}
|
|
8443
8455
|
return null;
|
|
8444
8456
|
});
|
|
8445
|
-
return /* @__PURE__ */
|
|
8457
|
+
return /* @__PURE__ */ jsx2(Components.Paragraph, { children }, `lb-comment-body-paragraph-${index}`);
|
|
8446
8458
|
}
|
|
8447
8459
|
default:
|
|
8448
8460
|
console.warn(
|
|
@@ -8451,7 +8463,7 @@ async function convertCommentBodyAsReact(body, options) {
|
|
|
8451
8463
|
return null;
|
|
8452
8464
|
}
|
|
8453
8465
|
});
|
|
8454
|
-
return /* @__PURE__ */
|
|
8466
|
+
return /* @__PURE__ */ jsx2(Components.Container, { children: blocks }, "lb-comment-body-container");
|
|
8455
8467
|
}
|
|
8456
8468
|
var baseStyles2 = {
|
|
8457
8469
|
paragraph: {
|