@fileverse-dev/ddoc 2.2.8-reminder-5 → 2.2.8-reminder-6

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.
@@ -1,4 +1,4 @@
1
- import { B as p, g as m, s as w, d as k, i as b, l as L, a as O, c as E, b as x, e as R, H as y, f as M } from "./index-DCvyRbL3.mjs";
1
+ import { B as p, g as m, s as w, d as k, i as b, l as L, a as O, c as E, b as x, e as R, H as y, f as M } from "./index-DiPDT92D.mjs";
2
2
  class S extends p {
3
3
  constructor({ callbackSelector: r, cause: a, data: n, extraData: i, sender: f, urls: t }) {
4
4
  var o;
@@ -88786,7 +88786,7 @@ async function V6(e, t) {
88786
88786
  });
88787
88787
  return Y === "0x" ? { data: void 0 } : { data: Y };
88788
88788
  } catch (G) {
88789
- const P = Wkt(G), { offchainLookup: R, offchainLookupSignature: H } = await import("./ccip-C9tJRmag.mjs");
88789
+ const P = Wkt(G), { offchainLookup: R, offchainLookupSignature: H } = await import("./ccip-DsFdlx93.mjs");
88790
88790
  if (e.ccipRead !== !1 && (P == null ? void 0 : P.slice(0, 10)) === H && k)
88791
88791
  return { data: await R(e, { data: P, to: k }) };
88792
88792
  throw D && (P == null ? void 0 : P.slice(0, 10)) === "0x101bb98d" ? new J9t({ factory: c }) : ZJ(G, {
@@ -103234,65 +103234,66 @@ const CDt = /* @__PURE__ */ I1(MDt), Rg = () => {
103234
103234
  onClose: t,
103235
103235
  onCreateReminder: n,
103236
103236
  initialReminderTitle: r,
103237
- setInitialReminderTitle: o
103238
- }, i) => {
103239
- const [a, s] = Ne(r || ""), [l, u] = Ne(
103237
+ setInitialReminderTitle: o,
103238
+ type: i
103239
+ }, a) => {
103240
+ const [s, l] = Ne(r || ""), [u, c] = Ne(
103240
103241
  new Date(Date.now() + 6 * 60 * 1e3)
103241
- ), [c, d] = Ne(""), f = Ho("(max-width: 768px)"), [h, p] = Ne(!0);
103242
+ ), [d, f] = Ne(""), h = Ho("(max-width: 768px)"), [p, m] = Ne(!0);
103242
103243
  Pe(() => {
103243
- r && s(r);
103244
+ r && l(r);
103244
103245
  }, [r]);
103245
- const m = (k) => {
103246
- if (!a) {
103247
- d("Please enter a reminder title");
103246
+ const g = (v) => {
103247
+ if (!s) {
103248
+ f("Please enter a reminder title");
103248
103249
  return;
103249
103250
  }
103250
- const v = {
103251
+ const x = {
103251
103252
  id: Eu(),
103252
- title: a,
103253
- timestamp: new Date(Date.now() + k).toISOString(),
103253
+ title: s,
103254
+ timestamp: new Date(Date.now() + v).toISOString(),
103254
103255
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
103255
103256
  status: "pending"
103256
103257
  };
103257
- n(v);
103258
- }, g = () => {
103259
- if (!a) {
103260
- d("Please enter a reminder title");
103258
+ n(x, i);
103259
+ }, b = () => {
103260
+ if (!s) {
103261
+ f("Please enter a reminder title");
103261
103262
  return;
103262
103263
  }
103263
- if (!l) {
103264
- d("Please enter both date and time");
103264
+ if (!u) {
103265
+ f("Please enter both date and time");
103265
103266
  return;
103266
103267
  }
103267
- const k = l.getTime();
103268
- if (!k) {
103269
- d("Invalid date or time format");
103268
+ const v = u.getTime();
103269
+ if (!v) {
103270
+ f("Invalid date or time format");
103270
103271
  return;
103271
103272
  }
103272
- if (k < Date.now()) {
103273
- d("Please select a future date and time");
103273
+ if (v < Date.now()) {
103274
+ f("Please select a future date and time");
103274
103275
  return;
103275
103276
  }
103276
- if (k - Date.now() < 5 * 60 * 1e3) {
103277
- d(
103277
+ if (v - Date.now() < 5 * 60 * 1e3) {
103278
+ f(
103278
103279
  "Please select a date and time that is at least 5 minutes from now"
103279
103280
  );
103280
103281
  return;
103281
103282
  }
103282
- l.setSeconds(0, 0);
103283
- const x = {
103283
+ u.setSeconds(0, 0);
103284
+ const w = {
103284
103285
  id: Eu(),
103285
- title: a,
103286
- timestamp: l.toISOString(),
103286
+ title: s,
103287
+ timestamp: u.toISOString(),
103287
103288
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
103288
103289
  status: "pending"
103289
103290
  };
103290
- n(x);
103291
+ n(w, i);
103291
103292
  };
103292
103293
  GX(() => {
103293
103294
  t(), o("");
103294
103295
  });
103295
- const b = /* @__PURE__ */ F.jsxs("div", { className: "px-4 py-2 min-w-[300px] color-bg-default rounded-lg shadow-elevation-3 space-y-3 border color-border-default", children: [
103296
+ const k = /* @__PURE__ */ F.jsxs("div", { className: "px-4 py-2 min-w-[300px] color-bg-default rounded-lg shadow-elevation-3 space-y-3 border color-border-default", children: [
103296
103297
  /* @__PURE__ */ F.jsxs("div", { className: "flex justify-between items-center", children: [
103297
103298
  /* @__PURE__ */ F.jsx("h3", { className: "text-heading-xsm", children: "Create reminder" }),
103298
103299
  /* @__PURE__ */ F.jsx(cn, { icon: "X", variant: "ghost", size: "sm", onClick: t })
@@ -103301,26 +103302,26 @@ const CDt = /* @__PURE__ */ I1(MDt), Rg = () => {
103301
103302
  pi,
103302
103303
  {
103303
103304
  placeholder: "Reminder title",
103304
- value: a,
103305
- onChange: (k) => s(k.target.value),
103305
+ value: s,
103306
+ onChange: (v) => l(v.target.value),
103306
103307
  className: "",
103307
103308
  autoFocus: !0
103308
103309
  }
103309
103310
  ),
103310
103311
  /* @__PURE__ */ F.jsxs("div", { className: "flex flex-col gap-2", children: [
103311
- /* @__PURE__ */ F.jsx("div", { className: "grid grid-cols-2 gap-2", children: bc.slice(0, -1).map((k) => /* @__PURE__ */ F.jsxs(
103312
+ /* @__PURE__ */ F.jsx("div", { className: "grid grid-cols-2 gap-2", children: bc.slice(0, -1).map((v) => /* @__PURE__ */ F.jsxs(
103312
103313
  Vt,
103313
103314
  {
103314
103315
  variant: "ghost",
103315
103316
  size: "md",
103316
103317
  className: "gap-2 w-full color-bg-secondary hover:color-bg-secondary-hover text-helper-text-sm font-normal",
103317
- onClick: () => m(k.value),
103318
+ onClick: () => g(v.value),
103318
103319
  children: [
103319
- /* @__PURE__ */ F.jsx(He, { name: k.icon, size: "sm" }),
103320
- /* @__PURE__ */ F.jsx("span", { children: k.label })
103320
+ /* @__PURE__ */ F.jsx(He, { name: v.icon, size: "sm" }),
103321
+ /* @__PURE__ */ F.jsx("span", { children: v.label })
103321
103322
  ]
103322
103323
  },
103323
- k.label
103324
+ v.label
103324
103325
  )) }),
103325
103326
  /* @__PURE__ */ F.jsxs(
103326
103327
  Vt,
@@ -103328,7 +103329,7 @@ const CDt = /* @__PURE__ */ I1(MDt), Rg = () => {
103328
103329
  variant: "ghost",
103329
103330
  size: "md",
103330
103331
  className: "gap-2 w-full color-bg-secondary hover:color-bg-secondary-hover text-helper-text-sm font-normal",
103331
- onClick: () => m(bc[bc.length - 1].value),
103332
+ onClick: () => g(bc[bc.length - 1].value),
103332
103333
  children: [
103333
103334
  /* @__PURE__ */ F.jsx(
103334
103335
  He,
@@ -103352,12 +103353,12 @@ const CDt = /* @__PURE__ */ I1(MDt), Rg = () => {
103352
103353
  pi,
103353
103354
  {
103354
103355
  placeholder: "MM/DD/YYYY",
103355
- value: l ? Rv(l, "P") : "MM/DD/YYYY",
103356
+ value: u ? Rv(u, "P") : "MM/DD/YYYY",
103356
103357
  readOnly: !0,
103357
103358
  className: "cursor-pointer"
103358
103359
  }
103359
103360
  ),
103360
- content: /* @__PURE__ */ F.jsx("div", { className: "p-2 color-bg-default shadow-elevation-3 rounded-md", children: /* @__PURE__ */ F.jsx(u$, { mode: "single", selected: l, onSelect: u }) })
103361
+ content: /* @__PURE__ */ F.jsx("div", { className: "p-2 color-bg-default shadow-elevation-3 rounded-md", children: /* @__PURE__ */ F.jsx(u$, { mode: "single", selected: u, onSelect: c }) })
103361
103362
  }
103362
103363
  ),
103363
103364
  /* @__PURE__ */ F.jsxs("div", { className: "flex items-center", children: [
@@ -103368,7 +103369,7 @@ const CDt = /* @__PURE__ */ I1(MDt), Rg = () => {
103368
103369
  pi,
103369
103370
  {
103370
103371
  placeholder: "HH:mm",
103371
- value: l ? h ? Rv(l, "p") : Rv(l, "HH:mm") : "HH:mm",
103372
+ value: u ? p ? Rv(u, "p") : Rv(u, "HH:mm") : "HH:mm",
103372
103373
  readOnly: !0,
103373
103374
  className: "cursor-pointer rounded-r-none !w-24"
103374
103375
  }
@@ -103376,9 +103377,9 @@ const CDt = /* @__PURE__ */ I1(MDt), Rg = () => {
103376
103377
  content: /* @__PURE__ */ F.jsx("div", { className: "p-2 color-bg-default shadow-elevation-3 rounded-md", children: /* @__PURE__ */ F.jsx(
103377
103378
  p$,
103378
103379
  {
103379
- date: l,
103380
- setDate: u,
103381
- use12Hours: h
103380
+ date: u,
103381
+ setDate: c,
103382
+ use12Hours: p
103382
103383
  }
103383
103384
  ) })
103384
103385
  }
@@ -103389,27 +103390,27 @@ const CDt = /* @__PURE__ */ I1(MDt), Rg = () => {
103389
103390
  variant: "ghost",
103390
103391
  size: "md",
103391
103392
  className: "!min-w-fit rounded-l-none rounded-r-md color-bg-tertiary",
103392
- onClick: () => p(!h),
103393
- children: h ? "12h" : "24h"
103393
+ onClick: () => m(!p),
103394
+ children: p ? "12h" : "24h"
103394
103395
  }
103395
103396
  )
103396
103397
  ] })
103397
103398
  ] }),
103398
- c && /* @__PURE__ */ F.jsx("div", { className: "text-helper-text-sm color-text-danger", children: c }),
103399
+ d && /* @__PURE__ */ F.jsx("div", { className: "text-helper-text-sm color-text-danger", children: d }),
103399
103400
  /* @__PURE__ */ F.jsx(
103400
103401
  Vt,
103401
103402
  {
103402
103403
  variant: "default",
103403
103404
  size: "md",
103404
103405
  className: "w-full",
103405
- onClick: g,
103406
+ onClick: b,
103406
103407
  children: /* @__PURE__ */ F.jsx("span", { children: "Create" })
103407
103408
  }
103408
103409
  ),
103409
103410
  /* @__PURE__ */ F.jsx(Pu, { className: "my-2 w-full" }),
103410
103411
  /* @__PURE__ */ F.jsx("div", { className: "flex justify-between items-center pb-1", children: /* @__PURE__ */ F.jsx("span", { className: "text-helper-text-sm font-normal color-text-secondary", children: "To receive an reminders please allow us to send push notification in your browser." }) })
103411
103412
  ] });
103412
- return f ? /* @__PURE__ */ F.jsx(
103413
+ return h ? /* @__PURE__ */ F.jsx(
103413
103414
  DK,
103414
103415
  {
103415
103416
  open: e,
@@ -103417,10 +103418,10 @@ const CDt = /* @__PURE__ */ I1(MDt), Rg = () => {
103417
103418
  className: "w-full shadow-elevation-4",
103418
103419
  contentClassName: "w-full h-full !border-none !shadow-elevation-4 !gap-2",
103419
103420
  footerClassName: "hidden",
103420
- content: b
103421
+ content: k
103421
103422
  },
103422
103423
  "reminder-menu"
103423
- ) : /* @__PURE__ */ F.jsx("div", { className: "-translate-y-1", ref: i, children: b });
103424
+ ) : /* @__PURE__ */ F.jsx("div", { className: "-translate-y-1", ref: a, children: k });
103424
103425
  }
103425
103426
  ), SDt = ({
103426
103427
  editor: e,
@@ -103438,14 +103439,14 @@ const CDt = /* @__PURE__ */ I1(MDt), Rg = () => {
103438
103439
  }
103439
103440
  o && o("");
103440
103441
  },
103441
- handleReminderCreate: async (l) => {
103442
+ handleReminderCreate: async (l, u) => {
103442
103443
  try {
103443
103444
  e.chain().focus().setReminderBlock({
103444
103445
  id: l.id,
103445
103446
  reminder: l
103446
- }).run(), t && await t(l);
103447
- } catch (u) {
103448
- console.error("Error creating reminder:", u), n && n("Failed to create reminder");
103447
+ }).run(), t && await t(l, u);
103448
+ } catch (c) {
103449
+ console.error("Error creating reminder:", c), n && n("Failed to create reminder");
103449
103450
  }
103450
103451
  },
103451
103452
  initialReminderTitle: r,
@@ -103621,6 +103622,7 @@ const CDt = /* @__PURE__ */ I1(MDt), Rg = () => {
103621
103622
  ZX,
103622
103623
  {
103623
103624
  ref: k,
103625
+ type: "inline",
103624
103626
  isOpen: !0,
103625
103627
  onClose: v,
103626
103628
  onCreateReminder: x,
@@ -222226,42 +222228,43 @@ const aXt = 200, sXt = new un("emoji"), lXt = _t.create({
222226
222228
  const a = document.createElement("img");
222227
222229
  return a.src = XE, a.classList.add("custom-cursor__badge"), o.appendChild(i), n.appendChild(r), n.appendChild(o), n.appendChild(a), t.appendChild(n), t;
222228
222230
  }, hXt = (e) => e.isEns ? fXt(e) : dXt(e);
222229
- function pXt(e, t) {
222230
- let n = [], r;
222231
+ function pXt(e, t, n) {
222232
+ let r = [], o;
222231
222233
  e.chain().focus().deleteRange(t).run();
222232
- const o = () => {
222233
- const s = e.view.domAtPos(t.from);
222234
- let l = s.node;
222235
- if (l.nodeType === Node.TEXT_NODE && (l = l.parentElement), l != null && l.getBoundingClientRect)
222236
- return l.getBoundingClientRect();
222237
- const u = document.createRange();
222238
- return u.setStart(s.node, s.offset), u.setEnd(s.node, s.offset), u.getBoundingClientRect();
222239
- }, i = () => {
222240
- var s;
222241
- clearTimeout(r), (s = n[0]) == null || s.destroy(), a.destroy();
222242
- }, a = new Tb(ZX, {
222234
+ const i = () => {
222235
+ const l = e.view.domAtPos(t.from);
222236
+ let u = l.node;
222237
+ if (u.nodeType === Node.TEXT_NODE && (u = u.parentElement), u != null && u.getBoundingClientRect)
222238
+ return u.getBoundingClientRect();
222239
+ const c = document.createRange();
222240
+ return c.setStart(l.node, l.offset), c.setEnd(l.node, l.offset), c.getBoundingClientRect();
222241
+ }, a = () => {
222242
+ var l;
222243
+ clearTimeout(o), (l = r[0]) == null || l.destroy(), s.destroy();
222244
+ }, s = new Tb(ZX, {
222243
222245
  props: {
222244
222246
  editor: e,
222245
222247
  isOpen: !0,
222246
- onClose: i,
222247
- onCreateReminder: (s) => {
222248
- var u;
222248
+ onClose: a,
222249
+ onCreateReminder: (l) => {
222250
+ var c;
222249
222251
  e.chain().focus().setReminderBlock({
222250
- id: s.id,
222251
- reminder: s
222252
+ id: l.id,
222253
+ reminder: l
222252
222254
  }).run();
222253
- const l = (u = e.extensionManager.extensions.find(
222254
- (c) => c.name === "reminderBlock"
222255
- )) == null ? void 0 : u.options;
222256
- l != null && l.onReminderCreate && l.onReminderCreate(s), i();
222257
- }
222255
+ const u = (c = e.extensionManager.extensions.find(
222256
+ (d) => d.name === "reminderBlock"
222257
+ )) == null ? void 0 : c.options;
222258
+ u != null && u.onReminderCreate && u.onReminderCreate(l, n), a();
222259
+ },
222260
+ type: n
222258
222261
  },
222259
222262
  editor: e
222260
222263
  });
222261
- return n = Ll("body", {
222262
- getReferenceClientRect: o,
222264
+ return r = Ll("body", {
222265
+ getReferenceClientRect: i,
222263
222266
  appendTo: () => document.body,
222264
- content: a.element,
222267
+ content: s.element,
222265
222268
  zIndex: 50,
222266
222269
  showOnCreate: !0,
222267
222270
  hideOnClick: !1,
@@ -222270,13 +222273,13 @@ function pXt(e, t) {
222270
222273
  placement: "bottom-start",
222271
222274
  animation: "shift-toward-subtle",
222272
222275
  onMount: () => {
222273
- r = setTimeout(() => {
222274
- const s = a.element.querySelector("input");
222275
- s && s.focus();
222276
+ o = setTimeout(() => {
222277
+ const l = s.element.querySelector("input");
222278
+ l && l.focus();
222276
222279
  }, 0);
222277
222280
  },
222278
222281
  onDestroy: () => {
222279
- clearTimeout(r);
222282
+ clearTimeout(o);
222280
222283
  },
222281
222284
  popperOptions: {
222282
222285
  strategy: "fixed",
@@ -222296,7 +222299,7 @@ function pXt(e, t) {
222296
222299
  }
222297
222300
  ]
222298
222301
  }
222299
- }), a;
222302
+ }), s;
222300
222303
  }
222301
222304
  const mXt = ({
222302
222305
  query: e,
@@ -222390,7 +222393,7 @@ const mXt = ({
222390
222393
  isDisabled: !r,
222391
222394
  command: ({ editor: o, range: i }) => {
222392
222395
  if (r)
222393
- return pXt(o, i), !0;
222396
+ return pXt(o, i, "slash"), !0;
222394
222397
  }
222395
222398
  },
222396
222399
  {
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { D as d, E as r, P as s, R as a, h as t, u as i } from "./index-DCvyRbL3.mjs";
1
+ import { D as d, E as r, P as s, R as a, h as t, u as i } from "./index-DiPDT92D.mjs";
2
2
  export {
3
3
  d as DdocEditor,
4
4
  r as Editor,
@@ -54,7 +54,7 @@ export declare const bubbleMenuProps: (props: EditorBubbleMenuProps) => {
54
54
  commentDrawerOpen?: boolean;
55
55
  setCommentDrawerOpen?: React.Dispatch<import('react').SetStateAction<boolean>>;
56
56
  isCollabDocumentPublished?: boolean | undefined;
57
- onReminderCreate?: (reminder: import('../../..').Reminder) => void;
57
+ onReminderCreate?: (reminder: import('../../..').Reminder, type: string) => void;
58
58
  isConnected?: boolean;
59
59
  };
60
60
  export declare const shouldShow: ({ editor }: {
@@ -24,7 +24,7 @@ export type EditorBubbleMenuProps = Omit<BubbleMenuProps, 'children'> & {
24
24
  commentDrawerOpen?: boolean;
25
25
  setCommentDrawerOpen?: React.Dispatch<SetStateAction<boolean>>;
26
26
  isCollabDocumentPublished?: boolean | undefined;
27
- onReminderCreate?: (reminder: Reminder) => void;
27
+ onReminderCreate?: (reminder: Reminder, type: string) => void;
28
28
  isConnected?: boolean;
29
29
  };
30
30
  export interface NodeSelectorProps {
@@ -1,4 +1,5 @@
1
1
  import { Editor, Range } from '@tiptap/core';
2
2
  import { ReactRenderer } from '@tiptap/react';
3
+ import { ReminderMenuProps } from './types';
3
4
 
4
- export declare function showReminderMenu(editor: Editor, range: Range): ReactRenderer<HTMLDivElement, import('./types').ReminderMenuProps & import('react').RefAttributes<HTMLDivElement>>;
5
+ export declare function showReminderMenu(editor: Editor, range: Range, type: ReminderMenuProps['type']): ReactRenderer<HTMLDivElement, ReminderMenuProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -9,7 +9,7 @@ export interface Reminder {
9
9
  walletAddress?: string;
10
10
  }
11
11
  export interface ReminderBlockOptions {
12
- onReminderCreate?: (reminder: Reminder) => Promise<void>;
12
+ onReminderCreate?: (reminder: Reminder, type: string) => Promise<void>;
13
13
  onReminderDelete?: (reminderId: string) => Promise<void>;
14
14
  onReminderUpdate?: (reminder: Reminder) => Promise<void>;
15
15
  reminders?: Reminder[];
@@ -17,7 +17,8 @@ export interface ReminderBlockOptions {
17
17
  export interface ReminderMenuProps {
18
18
  isOpen: boolean;
19
19
  onClose: () => void;
20
- onCreateReminder: (reminder: Reminder) => void;
20
+ onCreateReminder: (reminder: Reminder, type: string) => void;
21
21
  initialReminderTitle?: string;
22
+ type: 'inline' | 'slash';
22
23
  setInitialReminderTitle: React.Dispatch<React.SetStateAction<string>>;
23
24
  }
@@ -3,13 +3,13 @@ import { Reminder } from '../extensions/reminder-block/types';
3
3
 
4
4
  interface UseReminderProps {
5
5
  editor: Editor;
6
- onReminderCreate?: (reminder: Reminder) => Promise<void>;
6
+ onReminderCreate?: (reminder: Reminder, type: string) => Promise<void>;
7
7
  onError?: (errorString: string) => void;
8
8
  }
9
9
  export declare const useReminder: ({ editor, onReminderCreate, onError, }: UseReminderProps) => {
10
10
  reminderRef: import('react').RefObject<HTMLDivElement>;
11
11
  handleReminderOnClose: () => void;
12
- handleReminderCreate: (reminder: Reminder) => Promise<void>;
12
+ handleReminderCreate: (reminder: Reminder, type: string) => Promise<void>;
13
13
  initialReminderTitle: string;
14
14
  setInitialReminderTitle: import('react').Dispatch<import('react').SetStateAction<string>>;
15
15
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fileverse-dev/ddoc",
3
3
  "private": false,
4
4
  "description": "DDoc",
5
- "version": "2.2.8-reminder-5",
5
+ "version": "2.2.8-reminder-6",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",
8
8
  "exports": {