@liveblocks/emails 3.9.2 → 3.10.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.js 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 = "3.9.2";
6
+ var PKG_VERSION = "3.10.0";
7
7
  var PKG_FORMAT = "esm";
8
8
 
9
9
  // src/text-mention-notification.tsx
@@ -1091,9 +1091,12 @@ var iterateDeletedStructs = (transaction, ds, f) => ds.clients.forEach((deletes,
1091
1091
  /** @type {Array<GC|Item>} */
1092
1092
  transaction.doc.store.clients.get(clientid)
1093
1093
  );
1094
- for (let i = 0; i < deletes.length; i++) {
1095
- const del = deletes[i];
1096
- iterateStructs(transaction, structs, del.clock, del.len, f);
1094
+ if (structs != null) {
1095
+ const lastStruct = structs[structs.length - 1];
1096
+ const clockState = lastStruct.id.clock + lastStruct.length;
1097
+ for (let i = 0, del = deletes[i]; i < deletes.length && del.clock < clockState; del = deletes[++i]) {
1098
+ iterateStructs(transaction, structs, del.clock, del.len, f);
1099
+ }
1097
1100
  }
1098
1101
  });
1099
1102
  var findIndexDS = (dis, clock) => {
@@ -2132,13 +2135,13 @@ var integrateStructs = (transaction, store, clientsStructRefs) => {
2132
2135
  const addStackToRestSS = () => {
2133
2136
  for (const item of stack) {
2134
2137
  const client = item.id.client;
2135
- const unapplicableItems = clientsStructRefs.get(client);
2136
- if (unapplicableItems) {
2137
- unapplicableItems.i--;
2138
- restStructs.clients.set(client, unapplicableItems.refs.slice(unapplicableItems.i));
2138
+ const inapplicableItems = clientsStructRefs.get(client);
2139
+ if (inapplicableItems) {
2140
+ inapplicableItems.i--;
2141
+ restStructs.clients.set(client, inapplicableItems.refs.slice(inapplicableItems.i));
2139
2142
  clientsStructRefs.delete(client);
2140
- unapplicableItems.i = 0;
2141
- unapplicableItems.refs = [];
2143
+ inapplicableItems.i = 0;
2144
+ inapplicableItems.refs = [];
2142
2145
  } else {
2143
2146
  restStructs.clients.set(client, [item]);
2144
2147
  }
@@ -3647,6 +3650,8 @@ var typeMapSet = (transaction, parent, key, value) => {
3647
3650
  case Boolean:
3648
3651
  case Array:
3649
3652
  case String:
3653
+ case Date:
3654
+ case BigInt:
3650
3655
  content = new ContentAny([value]);
3651
3656
  break;
3652
3657
  case Uint8Array:
@@ -4912,7 +4917,7 @@ var YText = class _YText extends AbstractType {
4912
4917
  /**
4913
4918
  * Apply a {@link Delta} on this shared YText type.
4914
4919
  *
4915
- * @param {any} delta The changes to apply on this element.
4920
+ * @param {Array<any>} delta The changes to apply on this element.
4916
4921
  * @param {object} opts
4917
4922
  * @param {boolean} [opts.sanitize] Sanitize input delta. Removes ending newlines if set to true.
4918
4923
  *
@@ -5259,8 +5264,9 @@ var YXmlTreeWalker = class {
5259
5264
  n = type._start;
5260
5265
  } else {
5261
5266
  while (n !== null) {
5262
- if (n.right !== null) {
5263
- n = n.right;
5267
+ const nxt = n.next;
5268
+ if (nxt !== null) {
5269
+ n = nxt;
5264
5270
  break;
5265
5271
  } else if (n.parent === this._root) {
5266
5272
  n = null;
@@ -5800,7 +5806,7 @@ var YXmlEvent = class extends YEvent {
5800
5806
  * @param {YXmlElement|YXmlText|YXmlFragment} target The target on which the event is created.
5801
5807
  * @param {Set<string|null>} subs The set of changed attributes. `null` is included if the
5802
5808
  * child list changed.
5803
- * @param {Transaction} transaction The transaction instance with wich the
5809
+ * @param {Transaction} transaction The transaction instance with which the
5804
5810
  * change was created.
5805
5811
  */
5806
5812
  constructor(target, subs, transaction) {
@@ -6010,7 +6016,7 @@ var AbstractStruct = class {
6010
6016
  * This method is already assuming that `this.id.clock + this.length === this.id.clock`.
6011
6017
  * Also this method does *not* remove right from StructStore!
6012
6018
  * @param {AbstractStruct} right
6013
- * @return {boolean} wether this merged with right
6019
+ * @return {boolean} whether this merged with right
6014
6020
  */
6015
6021
  mergeWith(right) {
6016
6022
  return false;
@@ -7024,8 +7030,7 @@ var Item = class _Item extends AbstractStruct {
7024
7030
  if (this.left && this.left.constructor === _Item) {
7025
7031
  this.parent = this.left.parent;
7026
7032
  this.parentSub = this.left.parentSub;
7027
- }
7028
- if (this.right && this.right.constructor === _Item) {
7033
+ } else if (this.right && this.right.constructor === _Item) {
7029
7034
  this.parent = this.right.parent;
7030
7035
  this.parentSub = this.right.parentSub;
7031
7036
  }
@@ -7805,33 +7810,41 @@ function toInlineCSSString(styles) {
7805
7810
  // src/tiptap-editor.ts
7806
7811
  import { assertNever as assertNever2 } from "@liveblocks/core";
7807
7812
 
7813
+ // ../../node_modules/y-prosemirror/src/plugins/sync-plugin.js
7814
+ var hashedMarkNameRegex = /(.*)(--[a-zA-Z0-9+/=]{8})$/;
7815
+ var yattr2markname = (attrName) => hashedMarkNameRegex.exec(attrName)?.[1] ?? attrName;
7816
+
7808
7817
  // ../../node_modules/y-prosemirror/src/lib.js
7809
7818
  function yXmlFragmentToProsemirrorJSON(xmlFragment) {
7810
7819
  const items = xmlFragment.toArray();
7811
- function serialize(item) {
7820
+ const serialize = (item) => {
7812
7821
  let response;
7813
- if (!item.nodeName) {
7822
+ if (item instanceof YXmlText) {
7814
7823
  const delta = item.toDelta();
7815
- response = delta.map((d) => {
7816
- const text = {
7817
- type: "text",
7818
- text: d.insert
7819
- };
7820
- if (d.attributes) {
7821
- text.marks = Object.keys(d.attributes).map((type) => {
7822
- const attrs = d.attributes[type];
7823
- const mark = {
7824
- type
7825
- };
7826
- if (Object.keys(attrs)) {
7827
- mark.attrs = attrs;
7828
- }
7829
- return mark;
7830
- });
7824
+ response = delta.map(
7825
+ /** @param {any} d */
7826
+ (d) => {
7827
+ const text = {
7828
+ type: "text",
7829
+ text: d.insert
7830
+ };
7831
+ if (d.attributes) {
7832
+ text.marks = Object.keys(d.attributes).map((type_) => {
7833
+ const attrs = d.attributes[type_];
7834
+ const type = yattr2markname(type_);
7835
+ const mark = {
7836
+ type
7837
+ };
7838
+ if (Object.keys(attrs)) {
7839
+ mark.attrs = attrs;
7840
+ }
7841
+ return mark;
7842
+ });
7843
+ }
7844
+ return text;
7831
7845
  }
7832
- return text;
7833
- });
7834
- } else {
7846
+ );
7847
+ } else if (item instanceof YXmlElement) {
7835
7848
  response = {
7836
7849
  type: item.nodeName
7837
7850
  };
@@ -7843,9 +7856,11 @@ function yXmlFragmentToProsemirrorJSON(xmlFragment) {
7843
7856
  if (children.length) {
7844
7857
  response.content = children.map(serialize).flat();
7845
7858
  }
7859
+ } else {
7860
+ unexpectedCase();
7846
7861
  }
7847
7862
  return response;
7848
- }
7863
+ };
7849
7864
  return {
7850
7865
  type: "doc",
7851
7866
  content: items.map(serialize)