@focus-reactive/payload-plugin-comments 1.2.0 → 1.4.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.
@@ -5,11 +5,12 @@ export interface CollapsibleGroupHandle {
5
5
  }
6
6
  interface CollapsibleGroupProps {
7
7
  groupKey: string;
8
+ fieldPath?: string;
8
9
  label: string;
9
10
  children: ReactNode;
10
11
  level: "collection" | "document" | "field";
11
12
  ref?: RefObject<CollapsibleGroupHandle | null>;
12
13
  }
13
- export declare function CollapsibleGroup({ groupKey, label, children, level, ref }: CollapsibleGroupProps): import("react/jsx-runtime").JSX.Element;
14
+ export declare function CollapsibleGroup({ groupKey, fieldPath, label, children, level, ref }: CollapsibleGroupProps): import("react/jsx-runtime").JSX.Element;
14
15
  export {};
15
16
  //# sourceMappingURL=CollapsibleGroup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CollapsibleGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/CommentsPanel/components/CollapsibleGroup.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAuB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAM5E,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,YAAY,GAAG,UAAU,GAAG,OAAO,CAAC;IAC3C,GAAG,CAAC,EAAE,SAAS,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAAC;CAChD;AAgCD,wBAAgB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,qBAAqB,2CA8BhG"}
1
+ {"version":3,"file":"CollapsibleGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/CommentsPanel/components/CollapsibleGroup.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAuB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAM5E,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,YAAY,GAAG,UAAU,GAAG,OAAO,CAAC;IAC3C,GAAG,CAAC,EAAE,SAAS,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAAC;CAChD;AAgCD,wBAAgB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,qBAAqB,2CA8B3G"}
@@ -34,13 +34,13 @@ const collapsibleGroupVariants = {
34
34
  }
35
35
  })
36
36
  };
37
- function CollapsibleGroup({ groupKey, label, children, level, ref }) {
37
+ function CollapsibleGroup({ groupKey, fieldPath, label, children, level, ref }) {
38
38
  const [isCollapsed, toggle, open] = useCollapseState(groupKey);
39
39
  useImperativeHandle(ref, () => ({
40
40
  open,
41
41
  toggle
42
42
  }));
43
- return /* @__PURE__ */ jsxs("div", { children: [
43
+ return /* @__PURE__ */ jsxs("div", { "data-field-path": fieldPath ?? null, children: [
44
44
  /* @__PURE__ */ jsxs(
45
45
  "div",
46
46
  {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/CommentsPanel/components/CollapsibleGroup.tsx"],"sourcesContent":["\"use client\";\n\nimport { useImperativeHandle, type ReactNode, type RefObject } from \"react\";\nimport { ChevronDown } from \"lucide-react\";\nimport { cva } from \"class-variance-authority\";\nimport { useCollapseState } from \"../hooks/useCollapseState\";\nimport { cn } from \"../../../utils/general/cn\";\n\nexport interface CollapsibleGroupHandle {\n open: () => void;\n toggle: () => void;\n}\n\ninterface CollapsibleGroupProps {\n groupKey: string;\n label: string;\n children: ReactNode;\n level: \"collection\" | \"document\" | \"field\";\n ref?: RefObject<CollapsibleGroupHandle | null>;\n}\n\nconst collapsibleGroupVariants = {\n wrapper: cva(\"flex w-full items-center gap-2 cursor-pointer select-none\", {\n variants: {\n level: {\n collection: \"py-2\",\n document: \"py-2\",\n field: \"py-1.5\",\n },\n },\n }),\n label: cva(\"flex-1 truncate\", {\n variants: {\n level: {\n collection: \"text-[14px] font-semibold text-(--theme-text)\",\n document: \"text-[13px] font-semibold text-(--theme-text)\",\n field: \"text-[12px] font-medium text-(--theme-elevation-600)\",\n },\n },\n }),\n childWrapper: cva(\"\", {\n variants: {\n level: {\n collection: \"border-l-2 border-(--theme-elevation-100) pl-3\",\n document: \"border-l-2 border-(--theme-elevation-100) pl-3\",\n field: \"\",\n },\n },\n }),\n};\n\nexport function CollapsibleGroup({ groupKey, label, children, level, ref }: CollapsibleGroupProps) {\n const [isCollapsed, toggle, open] = useCollapseState(groupKey);\n\n useImperativeHandle(ref, () => ({\n open,\n toggle,\n }));\n\n return (\n <div>\n <div\n role=\"button\"\n tabIndex={0}\n onClick={toggle}\n onKeyDown={(e) => (e.key === \"Enter\" || e.key === \" \") && toggle()}\n aria-expanded={!isCollapsed}\n className={collapsibleGroupVariants.wrapper({ level })}>\n <span className={collapsibleGroupVariants.label({ level })}>{label}</span>\n\n <ChevronDown\n className={cn(\n \"shrink-0 w-4 h-4 text-(--theme-elevation-450) transition-transform duration-150\",\n isCollapsed && \"-rotate-90\",\n )}\n />\n </div>\n\n {!isCollapsed && <div className={collapsibleGroupVariants.childWrapper({ level })}>{children}</div>}\n </div>\n );\n}\n"],"mappings":";AA6DM,SAOE,KAPF;AA3DN,SAAS,2BAA2D;AACpE,SAAS,mBAAmB;AAC5B,SAAS,WAAW;AACpB,SAAS,wBAAwB;AACjC,SAAS,UAAU;AAenB,MAAM,2BAA2B;AAAA,EAC/B,SAAS,IAAI,6DAA6D;AAAA,IACxE,UAAU;AAAA,MACR,OAAO;AAAA,QACL,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,OAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF,CAAC;AAAA,EACD,OAAO,IAAI,mBAAmB;AAAA,IAC5B,UAAU;AAAA,MACR,OAAO;AAAA,QACL,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,OAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF,CAAC;AAAA,EACD,cAAc,IAAI,IAAI;AAAA,IACpB,UAAU;AAAA,MACR,OAAO;AAAA,QACL,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,OAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAEO,SAAS,iBAAiB,EAAE,UAAU,OAAO,UAAU,OAAO,IAAI,GAA0B;AACjG,QAAM,CAAC,aAAa,QAAQ,IAAI,IAAI,iBAAiB,QAAQ;AAE7D,sBAAoB,KAAK,OAAO;AAAA,IAC9B;AAAA,IACA;AAAA,EACF,EAAE;AAEF,SACE,qBAAC,SACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,UAAU;AAAA,QACV,SAAS;AAAA,QACT,WAAW,CAAC,OAAO,EAAE,QAAQ,WAAW,EAAE,QAAQ,QAAQ,OAAO;AAAA,QACjE,iBAAe,CAAC;AAAA,QAChB,WAAW,yBAAyB,QAAQ,EAAE,MAAM,CAAC;AAAA,QACrD;AAAA,8BAAC,UAAK,WAAW,yBAAyB,MAAM,EAAE,MAAM,CAAC,GAAI,iBAAM;AAAA,UAEnE;AAAA,YAAC;AAAA;AAAA,cACC,WAAW;AAAA,gBACT;AAAA,gBACA,eAAe;AAAA,cACjB;AAAA;AAAA,UACF;AAAA;AAAA;AAAA,IACF;AAAA,IAEC,CAAC,eAAe,oBAAC,SAAI,WAAW,yBAAyB,aAAa,EAAE,MAAM,CAAC,GAAI,UAAS;AAAA,KAC/F;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/CommentsPanel/components/CollapsibleGroup.tsx"],"sourcesContent":["\"use client\";\n\nimport { useImperativeHandle, type ReactNode, type RefObject } from \"react\";\nimport { ChevronDown } from \"lucide-react\";\nimport { cva } from \"class-variance-authority\";\nimport { useCollapseState } from \"../hooks/useCollapseState\";\nimport { cn } from \"../../../utils/general/cn\";\n\nexport interface CollapsibleGroupHandle {\n open: () => void;\n toggle: () => void;\n}\n\ninterface CollapsibleGroupProps {\n groupKey: string;\n fieldPath?: string;\n label: string;\n children: ReactNode;\n level: \"collection\" | \"document\" | \"field\";\n ref?: RefObject<CollapsibleGroupHandle | null>;\n}\n\nconst collapsibleGroupVariants = {\n wrapper: cva(\"flex w-full items-center gap-2 cursor-pointer select-none\", {\n variants: {\n level: {\n collection: \"py-2\",\n document: \"py-2\",\n field: \"py-1.5\",\n },\n },\n }),\n label: cva(\"flex-1 truncate\", {\n variants: {\n level: {\n collection: \"text-[14px] font-semibold text-(--theme-text)\",\n document: \"text-[13px] font-semibold text-(--theme-text)\",\n field: \"text-[12px] font-medium text-(--theme-elevation-600)\",\n },\n },\n }),\n childWrapper: cva(\"\", {\n variants: {\n level: {\n collection: \"border-l-2 border-(--theme-elevation-100) pl-3\",\n document: \"border-l-2 border-(--theme-elevation-100) pl-3\",\n field: \"\",\n },\n },\n }),\n};\n\nexport function CollapsibleGroup({ groupKey, fieldPath, label, children, level, ref }: CollapsibleGroupProps) {\n const [isCollapsed, toggle, open] = useCollapseState(groupKey);\n\n useImperativeHandle(ref, () => ({\n open,\n toggle,\n }));\n\n return (\n <div data-field-path={fieldPath ?? null}>\n <div\n role=\"button\"\n tabIndex={0}\n onClick={toggle}\n onKeyDown={(e) => (e.key === \"Enter\" || e.key === \" \") && toggle()}\n aria-expanded={!isCollapsed}\n className={collapsibleGroupVariants.wrapper({ level })}>\n <span className={collapsibleGroupVariants.label({ level })}>{label}</span>\n\n <ChevronDown\n className={cn(\n \"shrink-0 w-4 h-4 text-(--theme-elevation-450) transition-transform duration-150\",\n isCollapsed && \"-rotate-90\",\n )}\n />\n </div>\n\n {!isCollapsed && <div className={collapsibleGroupVariants.childWrapper({ level })}>{children}</div>}\n </div>\n );\n}\n"],"mappings":";AA8DM,SAOE,KAPF;AA5DN,SAAS,2BAA2D;AACpE,SAAS,mBAAmB;AAC5B,SAAS,WAAW;AACpB,SAAS,wBAAwB;AACjC,SAAS,UAAU;AAgBnB,MAAM,2BAA2B;AAAA,EAC/B,SAAS,IAAI,6DAA6D;AAAA,IACxE,UAAU;AAAA,MACR,OAAO;AAAA,QACL,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,OAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF,CAAC;AAAA,EACD,OAAO,IAAI,mBAAmB;AAAA,IAC5B,UAAU;AAAA,MACR,OAAO;AAAA,QACL,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,OAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF,CAAC;AAAA,EACD,cAAc,IAAI,IAAI;AAAA,IACpB,UAAU;AAAA,MACR,OAAO;AAAA,QACL,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,OAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAEO,SAAS,iBAAiB,EAAE,UAAU,WAAW,OAAO,UAAU,OAAO,IAAI,GAA0B;AAC5G,QAAM,CAAC,aAAa,QAAQ,IAAI,IAAI,iBAAiB,QAAQ;AAE7D,sBAAoB,KAAK,OAAO;AAAA,IAC9B;AAAA,IACA;AAAA,EACF,EAAE;AAEF,SACE,qBAAC,SAAI,mBAAiB,aAAa,MACjC;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,UAAU;AAAA,QACV,SAAS;AAAA,QACT,WAAW,CAAC,OAAO,EAAE,QAAQ,WAAW,EAAE,QAAQ,QAAQ,OAAO;AAAA,QACjE,iBAAe,CAAC;AAAA,QAChB,WAAW,yBAAyB,QAAQ,EAAE,MAAM,CAAC;AAAA,QACrD;AAAA,8BAAC,UAAK,WAAW,yBAAyB,MAAM,EAAE,MAAM,CAAC,GAAI,iBAAM;AAAA,UAEnE;AAAA,YAAC;AAAA;AAAA,cACC,WAAW;AAAA,gBACT;AAAA,gBACA,eAAe;AAAA,cACjB;AAAA;AAAA,UACF;AAAA;AAAA;AAAA,IACF;AAAA,IAEC,CAAC,eAAe,oBAAC,SAAI,WAAW,yBAAyB,aAAa,EAAE,MAAM,CAAC,GAAI,UAAS;AAAA,KAC/F;AAEJ;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"FieldGroupSection.d.ts","sourceRoot":"","sources":["../../../../src/components/CommentsPanel/components/FieldGroupSection.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAWtD,UAAU,KAAK;IACb,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IACtC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,iBAAiB,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,KAAK,2CA8ElG"}
1
+ {"version":3,"file":"FieldGroupSection.d.ts","sourceRoot":"","sources":["../../../../src/components/CommentsPanel/components/FieldGroupSection.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAYtD,UAAU,KAAK;IACb,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IACtC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,iBAAiB,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,KAAK,2CA+ElG"}
@@ -10,6 +10,7 @@ import { useComments } from "../../../providers/CommentsProvider";
10
10
  import { CommentEditor } from "../../CommentEditor";
11
11
  import { useCommentsDrawer } from "../../../providers/CommentsDrawerProvider";
12
12
  import { useFieldLabelsQuery } from "../../../api/queries/useFieldLabelsQuery";
13
+ import { DRAWER_OPENING_TIME } from "../../../constants";
13
14
  function FieldGroupSection({ fields, userId, collectionSlug, documentId, globalSlug }) {
14
15
  const { t } = useTranslation();
15
16
  const { queryContext } = useComments();
@@ -26,7 +27,7 @@ function FieldGroupSection({ fields, userId, collectionSlug, documentId, globalS
26
27
  useEffect(() => {
27
28
  if (!pendingField) return;
28
29
  pendingFieldCollapsibleGroup.current?.open();
29
- const id = setTimeout(() => editorRef.current?.focus(), 300);
30
+ const id = setTimeout(() => editorRef.current?.focus(), DRAWER_OPENING_TIME);
30
31
  return () => clearTimeout(id);
31
32
  }, [pendingField]);
32
33
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -55,11 +56,12 @@ function FieldGroupSection({ fields, userId, collectionSlug, documentId, globalS
55
56
  return /* @__PURE__ */ jsx(
56
57
  CollapsibleGroup,
57
58
  {
59
+ fieldPath,
58
60
  ref: isPending ? pendingFieldCollapsibleGroup : void 0,
59
61
  groupKey: createCollapsibleGroupKey({ collectionSlug, documentId, globalSlug, fieldPath }),
60
62
  label: isPending ? pendingField.label : resolveFieldLabel({ registry: fieldLabelRegistry, collectionSlug, documentId, globalSlug, fieldPath }),
61
63
  level: "field",
62
- children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", "data-field-path": fieldPath, children: [
64
+ children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
63
65
  fieldComments.map((comment) => /* @__PURE__ */ jsx(CommentItem, { comment, currentUserId: userId }, comment.id)),
64
66
  /* @__PURE__ */ jsx(
65
67
  CommentEditor,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/CommentsPanel/components/FieldGroupSection.tsx"],"sourcesContent":["\"use client\";\n\nimport { useRef, useEffect } from \"react\";\nimport { useTranslation } from \"@payloadcms/ui\";\nimport type { Comment } from \"../../../types/comment\";\nimport { CollapsibleGroup, type CollapsibleGroupHandle } from \"./CollapsibleGroup\";\nimport { CommentItem } from \"../../CommentItem\";\nimport { createCollapsibleGroupKey } from \"../utils/createCollapsibleGroupKey\";\nimport { resolveFieldLabel } from \"../utils/resolveFieldLabel\";\nimport { useComments } from \"../../../providers/CommentsProvider\";\nimport { CommentEditor } from \"../../CommentEditor\";\nimport type { CommentEditorHandle } from \"../../CommentEditor\";\nimport { useCommentsDrawer } from \"../../../providers/CommentsDrawerProvider\";\nimport { useFieldLabelsQuery } from \"../../../api/queries/useFieldLabelsQuery\";\n\ninterface Props {\n fields: Map<string | null, Comment[]>;\n userId: number | null;\n collectionSlug?: string;\n documentId?: number;\n globalSlug?: string;\n}\n\nexport function FieldGroupSection({ fields, userId, collectionSlug, documentId, globalSlug }: Props) {\n const { t } = useTranslation();\n const { queryContext } = useComments();\n const { data: fieldLabelRegistry = {} } = useFieldLabelsQuery(queryContext);\n const { pendingField } = useCommentsDrawer();\n const editorRef = useRef<CommentEditorHandle | null>(null);\n const pendingFieldCollapsibleGroup = useRef<CollapsibleGroupHandle | null>(null);\n\n const generalComments = fields.get(null) ?? [];\n const fieldEntries = [...fields.entries()].filter((entry): entry is [string, Comment[]] => entry[0] !== null);\n\n const allEntries: [string, Comment[]][] = [\n ...fieldEntries,\n ...(pendingField && !fields.has(pendingField.path) ? [[pendingField.path, []] as [string, Comment[]]] : []),\n ];\n\n useEffect(() => {\n if (!pendingField) return;\n\n pendingFieldCollapsibleGroup.current?.open();\n\n const id = setTimeout(() => editorRef.current?.focus(), 300);\n\n return () => clearTimeout(id);\n }, [pendingField]);\n\n return (\n <>\n <CollapsibleGroup\n groupKey={createCollapsibleGroupKey({ collectionSlug, documentId, globalSlug, fieldPath: null })}\n label={t(\"comments:general\" as never)}\n level=\"field\">\n <div className=\"flex flex-col gap-3\">\n {generalComments.map((comment) => (\n <CommentItem key={comment.id} comment={comment} currentUserId={userId} />\n ))}\n\n <CommentEditor\n fieldPath={null}\n collectionSlug={collectionSlug}\n documentId={documentId}\n globalSlug={globalSlug}\n />\n </div>\n </CollapsibleGroup>\n\n {allEntries.map(([fieldPath, fieldComments]) => {\n const isPending = pendingField?.path === fieldPath;\n\n return (\n <CollapsibleGroup\n key={fieldPath}\n ref={isPending ? pendingFieldCollapsibleGroup : undefined}\n groupKey={createCollapsibleGroupKey({ collectionSlug, documentId, globalSlug, fieldPath })}\n label={\n isPending ?\n pendingField.label\n : resolveFieldLabel({ registry: fieldLabelRegistry, collectionSlug, documentId, globalSlug, fieldPath })\n }\n level=\"field\">\n <div className=\"flex flex-col gap-3\" data-field-path={fieldPath}>\n {fieldComments.map((comment) => (\n <CommentItem key={comment.id} comment={comment} currentUserId={userId} />\n ))}\n\n <CommentEditor\n ref={isPending ? editorRef : undefined}\n fieldPath={fieldPath}\n collectionSlug={collectionSlug}\n documentId={documentId}\n globalSlug={globalSlug}\n />\n </div>\n </CollapsibleGroup>\n );\n })}\n </>\n );\n}\n"],"mappings":";AAkDI,mBAOQ,KAFJ,YALJ;AAhDJ,SAAS,QAAQ,iBAAiB;AAClC,SAAS,sBAAsB;AAE/B,SAAS,wBAAqD;AAC9D,SAAS,mBAAmB;AAC5B,SAAS,iCAAiC;AAC1C,SAAS,yBAAyB;AAClC,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAE9B,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AAU7B,SAAS,kBAAkB,EAAE,QAAQ,QAAQ,gBAAgB,YAAY,WAAW,GAAU;AACnG,QAAM,EAAE,EAAE,IAAI,eAAe;AAC7B,QAAM,EAAE,aAAa,IAAI,YAAY;AACrC,QAAM,EAAE,MAAM,qBAAqB,CAAC,EAAE,IAAI,oBAAoB,YAAY;AAC1E,QAAM,EAAE,aAAa,IAAI,kBAAkB;AAC3C,QAAM,YAAY,OAAmC,IAAI;AACzD,QAAM,+BAA+B,OAAsC,IAAI;AAE/E,QAAM,kBAAkB,OAAO,IAAI,IAAI,KAAK,CAAC;AAC7C,QAAM,eAAe,CAAC,GAAG,OAAO,QAAQ,CAAC,EAAE,OAAO,CAAC,UAAwC,MAAM,CAAC,MAAM,IAAI;AAE5G,QAAM,aAAoC;AAAA,IACxC,GAAG;AAAA,IACH,GAAI,gBAAgB,CAAC,OAAO,IAAI,aAAa,IAAI,IAAI,CAAC,CAAC,aAAa,MAAM,CAAC,CAAC,CAAwB,IAAI,CAAC;AAAA,EAC3G;AAEA,YAAU,MAAM;AACd,QAAI,CAAC,aAAc;AAEnB,iCAA6B,SAAS,KAAK;AAE3C,UAAM,KAAK,WAAW,MAAM,UAAU,SAAS,MAAM,GAAG,GAAG;AAE3D,WAAO,MAAM,aAAa,EAAE;AAAA,EAC9B,GAAG,CAAC,YAAY,CAAC;AAEjB,SACE,iCACE;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,UAAU,0BAA0B,EAAE,gBAAgB,YAAY,YAAY,WAAW,KAAK,CAAC;AAAA,QAC/F,OAAO,EAAE,kBAA2B;AAAA,QACpC,OAAM;AAAA,QACN,+BAAC,SAAI,WAAU,uBACZ;AAAA,0BAAgB,IAAI,CAAC,YACpB,oBAAC,eAA6B,SAAkB,eAAe,UAA7C,QAAQ,EAA6C,CACxE;AAAA,UAED;AAAA,YAAC;AAAA;AAAA,cACC,WAAW;AAAA,cACX;AAAA,cACA;AAAA,cACA;AAAA;AAAA,UACF;AAAA,WACF;AAAA;AAAA,IACF;AAAA,IAEC,WAAW,IAAI,CAAC,CAAC,WAAW,aAAa,MAAM;AAC9C,YAAM,YAAY,cAAc,SAAS;AAEzC,aACE;AAAA,QAAC;AAAA;AAAA,UAEC,KAAK,YAAY,+BAA+B;AAAA,UAChD,UAAU,0BAA0B,EAAE,gBAAgB,YAAY,YAAY,UAAU,CAAC;AAAA,UACzF,OACE,YACE,aAAa,QACb,kBAAkB,EAAE,UAAU,oBAAoB,gBAAgB,YAAY,YAAY,UAAU,CAAC;AAAA,UAEzG,OAAM;AAAA,UACN,+BAAC,SAAI,WAAU,uBAAsB,mBAAiB,WACnD;AAAA,0BAAc,IAAI,CAAC,YAClB,oBAAC,eAA6B,SAAkB,eAAe,UAA7C,QAAQ,EAA6C,CACxE;AAAA,YAED;AAAA,cAAC;AAAA;AAAA,gBACC,KAAK,YAAY,YAAY;AAAA,gBAC7B;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA;AAAA,YACF;AAAA,aACF;AAAA;AAAA,QArBK;AAAA,MAsBP;AAAA,IAEJ,CAAC;AAAA,KACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/CommentsPanel/components/FieldGroupSection.tsx"],"sourcesContent":["\"use client\";\n\nimport { useRef, useEffect } from \"react\";\nimport { useTranslation } from \"@payloadcms/ui\";\nimport type { Comment } from \"../../../types/comment\";\nimport { CollapsibleGroup, type CollapsibleGroupHandle } from \"./CollapsibleGroup\";\nimport { CommentItem } from \"../../CommentItem\";\nimport { createCollapsibleGroupKey } from \"../utils/createCollapsibleGroupKey\";\nimport { resolveFieldLabel } from \"../utils/resolveFieldLabel\";\nimport { useComments } from \"../../../providers/CommentsProvider\";\nimport { CommentEditor } from \"../../CommentEditor\";\nimport type { CommentEditorHandle } from \"../../CommentEditor\";\nimport { useCommentsDrawer } from \"../../../providers/CommentsDrawerProvider\";\nimport { useFieldLabelsQuery } from \"../../../api/queries/useFieldLabelsQuery\";\nimport { DRAWER_OPENING_TIME } from \"../../../constants\";\n\ninterface Props {\n fields: Map<string | null, Comment[]>;\n userId: number | null;\n collectionSlug?: string;\n documentId?: number;\n globalSlug?: string;\n}\n\nexport function FieldGroupSection({ fields, userId, collectionSlug, documentId, globalSlug }: Props) {\n const { t } = useTranslation();\n const { queryContext } = useComments();\n const { data: fieldLabelRegistry = {} } = useFieldLabelsQuery(queryContext);\n const { pendingField } = useCommentsDrawer();\n const editorRef = useRef<CommentEditorHandle | null>(null);\n const pendingFieldCollapsibleGroup = useRef<CollapsibleGroupHandle | null>(null);\n\n const generalComments = fields.get(null) ?? [];\n const fieldEntries = [...fields.entries()].filter((entry): entry is [string, Comment[]] => entry[0] !== null);\n\n const allEntries: [string, Comment[]][] = [\n ...fieldEntries,\n ...(pendingField && !fields.has(pendingField.path) ? [[pendingField.path, []] as [string, Comment[]]] : []),\n ];\n\n useEffect(() => {\n if (!pendingField) return;\n\n pendingFieldCollapsibleGroup.current?.open();\n\n const id = setTimeout(() => editorRef.current?.focus(), DRAWER_OPENING_TIME);\n\n return () => clearTimeout(id);\n }, [pendingField]);\n\n return (\n <>\n <CollapsibleGroup\n groupKey={createCollapsibleGroupKey({ collectionSlug, documentId, globalSlug, fieldPath: null })}\n label={t(\"comments:general\" as never)}\n level=\"field\">\n <div className=\"flex flex-col gap-3\">\n {generalComments.map((comment) => (\n <CommentItem key={comment.id} comment={comment} currentUserId={userId} />\n ))}\n\n <CommentEditor\n fieldPath={null}\n collectionSlug={collectionSlug}\n documentId={documentId}\n globalSlug={globalSlug}\n />\n </div>\n </CollapsibleGroup>\n\n {allEntries.map(([fieldPath, fieldComments]) => {\n const isPending = pendingField?.path === fieldPath;\n\n return (\n <CollapsibleGroup\n key={fieldPath}\n fieldPath={fieldPath}\n ref={isPending ? pendingFieldCollapsibleGroup : undefined}\n groupKey={createCollapsibleGroupKey({ collectionSlug, documentId, globalSlug, fieldPath })}\n label={\n isPending ?\n pendingField.label\n : resolveFieldLabel({ registry: fieldLabelRegistry, collectionSlug, documentId, globalSlug, fieldPath })\n }\n level=\"field\">\n <div className=\"flex flex-col gap-3\">\n {fieldComments.map((comment) => (\n <CommentItem key={comment.id} comment={comment} currentUserId={userId} />\n ))}\n\n <CommentEditor\n ref={isPending ? editorRef : undefined}\n fieldPath={fieldPath}\n collectionSlug={collectionSlug}\n documentId={documentId}\n globalSlug={globalSlug}\n />\n </div>\n </CollapsibleGroup>\n );\n })}\n </>\n );\n}\n"],"mappings":";AAmDI,mBAOQ,KAFJ,YALJ;AAjDJ,SAAS,QAAQ,iBAAiB;AAClC,SAAS,sBAAsB;AAE/B,SAAS,wBAAqD;AAC9D,SAAS,mBAAmB;AAC5B,SAAS,iCAAiC;AAC1C,SAAS,yBAAyB;AAClC,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAE9B,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AACpC,SAAS,2BAA2B;AAU7B,SAAS,kBAAkB,EAAE,QAAQ,QAAQ,gBAAgB,YAAY,WAAW,GAAU;AACnG,QAAM,EAAE,EAAE,IAAI,eAAe;AAC7B,QAAM,EAAE,aAAa,IAAI,YAAY;AACrC,QAAM,EAAE,MAAM,qBAAqB,CAAC,EAAE,IAAI,oBAAoB,YAAY;AAC1E,QAAM,EAAE,aAAa,IAAI,kBAAkB;AAC3C,QAAM,YAAY,OAAmC,IAAI;AACzD,QAAM,+BAA+B,OAAsC,IAAI;AAE/E,QAAM,kBAAkB,OAAO,IAAI,IAAI,KAAK,CAAC;AAC7C,QAAM,eAAe,CAAC,GAAG,OAAO,QAAQ,CAAC,EAAE,OAAO,CAAC,UAAwC,MAAM,CAAC,MAAM,IAAI;AAE5G,QAAM,aAAoC;AAAA,IACxC,GAAG;AAAA,IACH,GAAI,gBAAgB,CAAC,OAAO,IAAI,aAAa,IAAI,IAAI,CAAC,CAAC,aAAa,MAAM,CAAC,CAAC,CAAwB,IAAI,CAAC;AAAA,EAC3G;AAEA,YAAU,MAAM;AACd,QAAI,CAAC,aAAc;AAEnB,iCAA6B,SAAS,KAAK;AAE3C,UAAM,KAAK,WAAW,MAAM,UAAU,SAAS,MAAM,GAAG,mBAAmB;AAE3E,WAAO,MAAM,aAAa,EAAE;AAAA,EAC9B,GAAG,CAAC,YAAY,CAAC;AAEjB,SACE,iCACE;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,UAAU,0BAA0B,EAAE,gBAAgB,YAAY,YAAY,WAAW,KAAK,CAAC;AAAA,QAC/F,OAAO,EAAE,kBAA2B;AAAA,QACpC,OAAM;AAAA,QACN,+BAAC,SAAI,WAAU,uBACZ;AAAA,0BAAgB,IAAI,CAAC,YACpB,oBAAC,eAA6B,SAAkB,eAAe,UAA7C,QAAQ,EAA6C,CACxE;AAAA,UAED;AAAA,YAAC;AAAA;AAAA,cACC,WAAW;AAAA,cACX;AAAA,cACA;AAAA,cACA;AAAA;AAAA,UACF;AAAA,WACF;AAAA;AAAA,IACF;AAAA,IAEC,WAAW,IAAI,CAAC,CAAC,WAAW,aAAa,MAAM;AAC9C,YAAM,YAAY,cAAc,SAAS;AAEzC,aACE;AAAA,QAAC;AAAA;AAAA,UAEC;AAAA,UACA,KAAK,YAAY,+BAA+B;AAAA,UAChD,UAAU,0BAA0B,EAAE,gBAAgB,YAAY,YAAY,UAAU,CAAC;AAAA,UACzF,OACE,YACE,aAAa,QACb,kBAAkB,EAAE,UAAU,oBAAoB,gBAAgB,YAAY,YAAY,UAAU,CAAC;AAAA,UAEzG,OAAM;AAAA,UACN,+BAAC,SAAI,WAAU,uBACZ;AAAA,0BAAc,IAAI,CAAC,YAClB,oBAAC,eAA6B,SAAkB,eAAe,UAA7C,QAAQ,EAA6C,CACxE;AAAA,YAED;AAAA,cAAC;AAAA;AAAA,gBACC,KAAK,YAAY,YAAY;AAAA,gBAC7B;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA;AAAA,YACF;AAAA,aACF;AAAA;AAAA,QAtBK;AAAA,MAuBP;AAAA,IAEJ,CAAC;AAAA,KACH;AAEJ;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"useScrollToTargetFieldGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/CommentsPanel/hooks/useScrollToTargetFieldGroup.ts"],"names":[],"mappings":"AAGA,wBAAgB,2BAA2B,SAqC1C"}
1
+ {"version":3,"file":"useScrollToTargetFieldGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/CommentsPanel/hooks/useScrollToTargetFieldGroup.ts"],"names":[],"mappings":"AAIA,wBAAgB,2BAA2B,SAkC1C"}
@@ -1,3 +1,4 @@
1
+ import { DRAWER_OPENING_TIME } from "../../../constants";
1
2
  import { useCommentsDrawer } from "../../../providers/CommentsDrawerProvider";
2
3
  import { useLayoutEffect } from "react";
3
4
  function useScrollToTargetFieldGroup() {
@@ -14,18 +15,16 @@ function useScrollToTargetFieldGroup() {
14
15
  scrollContainer = scrollContainer.parentElement;
15
16
  }
16
17
  if (!scrollContainer || scrollContainer === document.documentElement) {
17
- section.scrollIntoView({ behavior: "smooth", block: "start" });
18
+ section.scrollIntoView({ behavior: "smooth", block: "end" });
18
19
  setScrollTargetPath(null);
19
20
  return;
20
21
  }
21
- const header = scrollContainer.querySelector("header");
22
- const headerHeight = header?.getBoundingClientRect().height ?? 0;
23
- const sectionTop = section.getBoundingClientRect().top;
24
- const containerTop = scrollContainer.getBoundingClientRect().top;
25
- const scrollOffset = sectionTop - containerTop - headerHeight + scrollContainer.scrollTop;
22
+ const sectionBottom = section.getBoundingClientRect().bottom;
23
+ const containerBottom = scrollContainer.getBoundingClientRect().bottom;
24
+ const scrollOffset = scrollContainer.scrollTop + (sectionBottom - containerBottom) + 10;
26
25
  scrollContainer.scrollTo({ top: scrollOffset, behavior: "smooth" });
27
26
  setScrollTargetPath(null);
28
- }, 300);
27
+ }, DRAWER_OPENING_TIME + 10);
29
28
  return () => clearTimeout(id);
30
29
  }, [scrollTargetPath, setScrollTargetPath]);
31
30
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/CommentsPanel/hooks/useScrollToTargetFieldGroup.ts"],"sourcesContent":["import { useCommentsDrawer } from \"../../../providers/CommentsDrawerProvider\";\nimport { useLayoutEffect } from \"react\";\n\nexport function useScrollToTargetFieldGroup() {\n const { scrollTargetPath, setScrollTargetPath } = useCommentsDrawer();\n\n useLayoutEffect(() => {\n if (!scrollTargetPath) return;\n\n const id = setTimeout(() => {\n const section = document.querySelector(`[data-field-path=\"${CSS.escape(scrollTargetPath)}\"]`);\n if (!section) return;\n\n let scrollContainer: Element | null = section.parentElement;\n\n while (scrollContainer && scrollContainer !== document.documentElement) {\n const { overflow, overflowY } = getComputedStyle(scrollContainer);\n if (/auto|scroll/.test(overflow + overflowY)) break;\n scrollContainer = scrollContainer.parentElement;\n }\n\n if (!scrollContainer || scrollContainer === document.documentElement) {\n section.scrollIntoView({ behavior: \"smooth\", block: \"start\" });\n setScrollTargetPath(null);\n return;\n }\n\n const header = scrollContainer.querySelector(\"header\");\n const headerHeight = header?.getBoundingClientRect().height ?? 0;\n\n const sectionTop = section.getBoundingClientRect().top;\n const containerTop = scrollContainer.getBoundingClientRect().top;\n const scrollOffset = sectionTop - containerTop - headerHeight + scrollContainer.scrollTop;\n\n scrollContainer.scrollTo({ top: scrollOffset, behavior: \"smooth\" });\n setScrollTargetPath(null);\n }, 300);\n\n return () => clearTimeout(id);\n }, [scrollTargetPath, setScrollTargetPath]);\n}\n"],"mappings":"AAAA,SAAS,yBAAyB;AAClC,SAAS,uBAAuB;AAEzB,SAAS,8BAA8B;AAC5C,QAAM,EAAE,kBAAkB,oBAAoB,IAAI,kBAAkB;AAEpE,kBAAgB,MAAM;AACpB,QAAI,CAAC,iBAAkB;AAEvB,UAAM,KAAK,WAAW,MAAM;AAC1B,YAAM,UAAU,SAAS,cAAc,qBAAqB,IAAI,OAAO,gBAAgB,CAAC,IAAI;AAC5F,UAAI,CAAC,QAAS;AAEd,UAAI,kBAAkC,QAAQ;AAE9C,aAAO,mBAAmB,oBAAoB,SAAS,iBAAiB;AACtE,cAAM,EAAE,UAAU,UAAU,IAAI,iBAAiB,eAAe;AAChE,YAAI,cAAc,KAAK,WAAW,SAAS,EAAG;AAC9C,0BAAkB,gBAAgB;AAAA,MACpC;AAEA,UAAI,CAAC,mBAAmB,oBAAoB,SAAS,iBAAiB;AACpE,gBAAQ,eAAe,EAAE,UAAU,UAAU,OAAO,QAAQ,CAAC;AAC7D,4BAAoB,IAAI;AACxB;AAAA,MACF;AAEA,YAAM,SAAS,gBAAgB,cAAc,QAAQ;AACrD,YAAM,eAAe,QAAQ,sBAAsB,EAAE,UAAU;AAE/D,YAAM,aAAa,QAAQ,sBAAsB,EAAE;AACnD,YAAM,eAAe,gBAAgB,sBAAsB,EAAE;AAC7D,YAAM,eAAe,aAAa,eAAe,eAAe,gBAAgB;AAEhF,sBAAgB,SAAS,EAAE,KAAK,cAAc,UAAU,SAAS,CAAC;AAClE,0BAAoB,IAAI;AAAA,IAC1B,GAAG,GAAG;AAEN,WAAO,MAAM,aAAa,EAAE;AAAA,EAC9B,GAAG,CAAC,kBAAkB,mBAAmB,CAAC;AAC5C;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/CommentsPanel/hooks/useScrollToTargetFieldGroup.ts"],"sourcesContent":["import { DRAWER_OPENING_TIME } from \"../../../constants\";\nimport { useCommentsDrawer } from \"../../../providers/CommentsDrawerProvider\";\nimport { useLayoutEffect } from \"react\";\n\nexport function useScrollToTargetFieldGroup() {\n const { scrollTargetPath, setScrollTargetPath } = useCommentsDrawer();\n\n useLayoutEffect(() => {\n if (!scrollTargetPath) return;\n\n const id = setTimeout(() => {\n const section = document.querySelector(`[data-field-path=\"${CSS.escape(scrollTargetPath)}\"]`);\n if (!section) return;\n\n let scrollContainer: Element | null = section.parentElement;\n\n while (scrollContainer && scrollContainer !== document.documentElement) {\n const { overflow, overflowY } = getComputedStyle(scrollContainer);\n if (/auto|scroll/.test(overflow + overflowY)) break;\n scrollContainer = scrollContainer.parentElement;\n }\n\n if (!scrollContainer || scrollContainer === document.documentElement) {\n section.scrollIntoView({ behavior: \"smooth\", block: \"end\" });\n setScrollTargetPath(null);\n return;\n }\n\n const sectionBottom = section.getBoundingClientRect().bottom;\n const containerBottom = scrollContainer.getBoundingClientRect().bottom;\n const scrollOffset = scrollContainer.scrollTop + (sectionBottom - containerBottom) + 10;\n\n scrollContainer.scrollTo({ top: scrollOffset, behavior: \"smooth\" });\n setScrollTargetPath(null);\n }, DRAWER_OPENING_TIME + 10);\n\n return () => clearTimeout(id);\n }, [scrollTargetPath, setScrollTargetPath]);\n}\n"],"mappings":"AAAA,SAAS,2BAA2B;AACpC,SAAS,yBAAyB;AAClC,SAAS,uBAAuB;AAEzB,SAAS,8BAA8B;AAC5C,QAAM,EAAE,kBAAkB,oBAAoB,IAAI,kBAAkB;AAEpE,kBAAgB,MAAM;AACpB,QAAI,CAAC,iBAAkB;AAEvB,UAAM,KAAK,WAAW,MAAM;AAC1B,YAAM,UAAU,SAAS,cAAc,qBAAqB,IAAI,OAAO,gBAAgB,CAAC,IAAI;AAC5F,UAAI,CAAC,QAAS;AAEd,UAAI,kBAAkC,QAAQ;AAE9C,aAAO,mBAAmB,oBAAoB,SAAS,iBAAiB;AACtE,cAAM,EAAE,UAAU,UAAU,IAAI,iBAAiB,eAAe;AAChE,YAAI,cAAc,KAAK,WAAW,SAAS,EAAG;AAC9C,0BAAkB,gBAAgB;AAAA,MACpC;AAEA,UAAI,CAAC,mBAAmB,oBAAoB,SAAS,iBAAiB;AACpE,gBAAQ,eAAe,EAAE,UAAU,UAAU,OAAO,MAAM,CAAC;AAC3D,4BAAoB,IAAI;AACxB;AAAA,MACF;AAEA,YAAM,gBAAgB,QAAQ,sBAAsB,EAAE;AACtD,YAAM,kBAAkB,gBAAgB,sBAAsB,EAAE;AAChE,YAAM,eAAe,gBAAgB,aAAa,gBAAgB,mBAAmB;AAErF,sBAAgB,SAAS,EAAE,KAAK,cAAc,UAAU,SAAS,CAAC;AAClE,0BAAoB,IAAI;AAAA,IAC1B,GAAG,sBAAsB,EAAE;AAE3B,WAAO,MAAM,aAAa,EAAE;AAAA,EAC9B,GAAG,CAAC,kBAAkB,mBAAmB,CAAC;AAC5C;","names":[]}
@@ -7,4 +7,5 @@ export declare const FALLBACK_USERNAME = "Unknown user";
7
7
  export declare const FALLBACK_DELETED_USERNAME = "Deleted user";
8
8
  export declare const EXCLUDED_ADMIN_ROUTES: string[];
9
9
  export declare const REFETCH_INTERVAL = 15000;
10
+ export declare const DRAWER_OPENING_TIME = 350;
10
11
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,aAAa,CAAC;AAClD,eAAO,MAAM,yBAAyB,mBAAmB,CAAC;AAE1D,eAAO,MAAM,WAAW,4BAA4B,CAAC;AACrD,eAAO,MAAM,YAAY,4CAA4C,CAAC;AAEtE,eAAO,MAAM,2BAA2B,SAAS,CAAC;AAClD,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAChD,eAAO,MAAM,yBAAyB,iBAAiB,CAAC;AAExD,eAAO,MAAM,qBAAqB,UAAiD,CAAC;AAEpF,eAAO,MAAM,gBAAgB,QAAQ,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,aAAa,CAAC;AAClD,eAAO,MAAM,yBAAyB,mBAAmB,CAAC;AAE1D,eAAO,MAAM,WAAW,4BAA4B,CAAC;AACrD,eAAO,MAAM,YAAY,4CAA4C,CAAC;AAEtE,eAAO,MAAM,2BAA2B,SAAS,CAAC;AAClD,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAChD,eAAO,MAAM,yBAAyB,iBAAiB,CAAC;AAExD,eAAO,MAAM,qBAAqB,UAAiD,CAAC;AAEpF,eAAO,MAAM,gBAAgB,QAAQ,CAAC;AAEtC,eAAO,MAAM,mBAAmB,MAAM,CAAC"}
package/dist/constants.js CHANGED
@@ -7,9 +7,11 @@ const FALLBACK_USERNAME = "Unknown user";
7
7
  const FALLBACK_DELETED_USERNAME = "Deleted user";
8
8
  const EXCLUDED_ADMIN_ROUTES = ["/admin/account", "/admin/create-first-user"];
9
9
  const REFETCH_INTERVAL = 15e3;
10
+ const DRAWER_OPENING_TIME = 350;
10
11
  export {
11
12
  COMMENTS_DRAWER_BASE_SLUG,
12
13
  DEFAULT_COLLECTION_SLUG,
14
+ DRAWER_OPENING_TIME,
13
15
  EXCLUDED_ADMIN_ROUTES,
14
16
  FALLBACK_DELETED_USERNAME,
15
17
  FALLBACK_USERNAME,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/constants.ts"],"sourcesContent":["export const DEFAULT_COLLECTION_SLUG = \"comments\";\nexport const COMMENTS_DRAWER_BASE_SLUG = \"comments-panel\";\n\nexport const PLUGIN_NAME = \"payload-plugin-comments\";\nexport const PACKAGE_NAME = \"@focus-reactive/payload-plugin-comments\";\n\nexport const USERNAME_DEFAULT_FIELD_PATH = \"name\";\nexport const FALLBACK_USERNAME = \"Unknown user\";\nexport const FALLBACK_DELETED_USERNAME = \"Deleted user\";\n\nexport const EXCLUDED_ADMIN_ROUTES = [\"/admin/account\", \"/admin/create-first-user\"];\n\nexport const REFETCH_INTERVAL = 15000;\n"],"mappings":"AAAO,MAAM,0BAA0B;AAChC,MAAM,4BAA4B;AAElC,MAAM,cAAc;AACpB,MAAM,eAAe;AAErB,MAAM,8BAA8B;AACpC,MAAM,oBAAoB;AAC1B,MAAM,4BAA4B;AAElC,MAAM,wBAAwB,CAAC,kBAAkB,0BAA0B;AAE3E,MAAM,mBAAmB;","names":[]}
1
+ {"version":3,"sources":["../src/constants.ts"],"sourcesContent":["export const DEFAULT_COLLECTION_SLUG = \"comments\";\nexport const COMMENTS_DRAWER_BASE_SLUG = \"comments-panel\";\n\nexport const PLUGIN_NAME = \"payload-plugin-comments\";\nexport const PACKAGE_NAME = \"@focus-reactive/payload-plugin-comments\";\n\nexport const USERNAME_DEFAULT_FIELD_PATH = \"name\";\nexport const FALLBACK_USERNAME = \"Unknown user\";\nexport const FALLBACK_DELETED_USERNAME = \"Deleted user\";\n\nexport const EXCLUDED_ADMIN_ROUTES = [\"/admin/account\", \"/admin/create-first-user\"];\n\nexport const REFETCH_INTERVAL = 15000;\n\nexport const DRAWER_OPENING_TIME = 350;\n"],"mappings":"AAAO,MAAM,0BAA0B;AAChC,MAAM,4BAA4B;AAElC,MAAM,cAAc;AACpB,MAAM,eAAe;AAErB,MAAM,8BAA8B;AACpC,MAAM,oBAAoB;AAC1B,MAAM,4BAA4B;AAElC,MAAM,wBAAwB,CAAC,kBAAkB,0BAA0B;AAE3E,MAAM,mBAAmB;AAEzB,MAAM,sBAAsB;","names":[]}
@@ -1,4 +1,5 @@
1
1
  import { type ReactNode } from "react";
2
+ import "../../styles.css";
2
3
  interface Props {
3
4
  children: ReactNode;
4
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/CommentsProviderWrapper/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAOjD,UAAU,KAAK;IACb,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,uBAAuB,CAAC,EAAE,QAAQ,EAAE,EAAE,KAAK,2CAuB1D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/CommentsProviderWrapper/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAOjD,OAAO,kBAAkB,CAAC;AAE1B,UAAU,KAAK;IACb,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,uBAAuB,CAAC,EAAE,QAAQ,EAAE,EAAE,KAAK,2CAuB1D"}
@@ -5,6 +5,7 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
5
5
  import { useConfig } from "@payloadcms/ui";
6
6
  import { CommentsDrawerProvider } from "../CommentsDrawerProvider";
7
7
  import { CommentsProvider } from "../CommentsProvider";
8
+ import "../../styles.css";
8
9
  function CommentsProviderWrapper({ children }) {
9
10
  const { config } = useConfig();
10
11
  const [queryClient] = useState(
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/providers/CommentsProviderWrapper/index.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState, type ReactNode } from \"react\";\nimport { QueryClient, QueryClientProvider } from \"@tanstack/react-query\";\nimport { useConfig } from \"@payloadcms/ui\";\nimport { CommentsDrawerProvider } from \"../CommentsDrawerProvider\";\nimport { CommentsProvider } from \"../CommentsProvider\";\nimport type { CommentsPluginConfigStorage } from \"../../types\";\n\ninterface Props {\n children: ReactNode;\n}\n\nexport function CommentsProviderWrapper({ children }: Props) {\n const { config } = useConfig();\n const [queryClient] = useState(\n () =>\n new QueryClient({\n defaultOptions: {\n queries: { retry: 1 },\n mutations: { retry: 0 },\n },\n }),\n );\n\n const pluginConfig = config.admin?.custom?.commentsPlugin as CommentsPluginConfigStorage | undefined;\n const usernameFieldRawPath = pluginConfig?.usernameFieldPath;\n const usernameFieldPath = usernameFieldRawPath === \"\" ? undefined : usernameFieldRawPath;\n\n return (\n <QueryClientProvider client={queryClient}>\n <CommentsProvider usernameFieldPath={usernameFieldPath}>\n <CommentsDrawerProvider>{children}</CommentsDrawerProvider>\n </CommentsProvider>\n </QueryClientProvider>\n );\n}\n"],"mappings":";AAgCQ;AA9BR,SAAS,gBAAgC;AACzC,SAAS,aAAa,2BAA2B;AACjD,SAAS,iBAAiB;AAC1B,SAAS,8BAA8B;AACvC,SAAS,wBAAwB;AAO1B,SAAS,wBAAwB,EAAE,SAAS,GAAU;AAC3D,QAAM,EAAE,OAAO,IAAI,UAAU;AAC7B,QAAM,CAAC,WAAW,IAAI;AAAA,IACpB,MACE,IAAI,YAAY;AAAA,MACd,gBAAgB;AAAA,QACd,SAAS,EAAE,OAAO,EAAE;AAAA,QACpB,WAAW,EAAE,OAAO,EAAE;AAAA,MACxB;AAAA,IACF,CAAC;AAAA,EACL;AAEA,QAAM,eAAe,OAAO,OAAO,QAAQ;AAC3C,QAAM,uBAAuB,cAAc;AAC3C,QAAM,oBAAoB,yBAAyB,KAAK,SAAY;AAEpE,SACE,oBAAC,uBAAoB,QAAQ,aAC3B,8BAAC,oBAAiB,mBAChB,8BAAC,0BAAwB,UAAS,GACpC,GACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/providers/CommentsProviderWrapper/index.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState, type ReactNode } from \"react\";\nimport { QueryClient, QueryClientProvider } from \"@tanstack/react-query\";\nimport { useConfig } from \"@payloadcms/ui\";\nimport { CommentsDrawerProvider } from \"../CommentsDrawerProvider\";\nimport { CommentsProvider } from \"../CommentsProvider\";\nimport type { CommentsPluginConfigStorage } from \"../../types\";\n\nimport \"../../styles.css\";\n\ninterface Props {\n children: ReactNode;\n}\n\nexport function CommentsProviderWrapper({ children }: Props) {\n const { config } = useConfig();\n const [queryClient] = useState(\n () =>\n new QueryClient({\n defaultOptions: {\n queries: { retry: 1 },\n mutations: { retry: 0 },\n },\n }),\n );\n\n const pluginConfig = config.admin?.custom?.commentsPlugin as CommentsPluginConfigStorage | undefined;\n const usernameFieldRawPath = pluginConfig?.usernameFieldPath;\n const usernameFieldPath = usernameFieldRawPath === \"\" ? undefined : usernameFieldRawPath;\n\n return (\n <QueryClientProvider client={queryClient}>\n <CommentsProvider usernameFieldPath={usernameFieldPath}>\n <CommentsDrawerProvider>{children}</CommentsDrawerProvider>\n </CommentsProvider>\n </QueryClientProvider>\n );\n}\n"],"mappings":";AAkCQ;AAhCR,SAAS,gBAAgC;AACzC,SAAS,aAAa,2BAA2B;AACjD,SAAS,iBAAiB;AAC1B,SAAS,8BAA8B;AACvC,SAAS,wBAAwB;AAGjC,OAAO;AAMA,SAAS,wBAAwB,EAAE,SAAS,GAAU;AAC3D,QAAM,EAAE,OAAO,IAAI,UAAU;AAC7B,QAAM,CAAC,WAAW,IAAI;AAAA,IACpB,MACE,IAAI,YAAY;AAAA,MACd,gBAAgB;AAAA,QACd,SAAS,EAAE,OAAO,EAAE;AAAA,QACpB,WAAW,EAAE,OAAO,EAAE;AAAA,MACxB;AAAA,IACF,CAAC;AAAA,EACL;AAEA,QAAM,eAAe,OAAO,OAAO,QAAQ;AAC3C,QAAM,uBAAuB,cAAc;AAC3C,QAAM,oBAAoB,yBAAyB,KAAK,SAAY;AAEpE,SACE,oBAAC,uBAAoB,QAAQ,aAC3B,8BAAC,oBAAiB,mBAChB,8BAAC,0BAAwB,UAAS,GACpC,GACF;AAEJ;","names":[]}
package/dist/styles.css CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! tailwindcss v4.2.1 | MIT License | https://tailwindcss.com */
2
- @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-content:""}}}:root,:host{--color-green-500:oklch(72.3% .219 149.579);--color-black:#000;--spacing:.25rem;--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--leading-normal:1.5;--radius-sm:.25rem;--radius-md:.375rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1)}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.top-0{top:calc(var(--spacing) * 0)}.top-3{top:calc(var(--spacing) * 3)}.right-3{right:calc(var(--spacing) * 3)}.z-10{z-index:10}.z-29{z-index:29}.m-0{margin:calc(var(--spacing) * 0)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.ml-auto{margin-left:auto}.box-border{box-sizing:border-box}.block{display:block}.flex{display:flex}.hidden{display:none}.h-4{height:calc(var(--spacing) * 4)}.h-9{height:calc(var(--spacing) * 9)}.h-\[20px\]{height:20px}.h-\[24px\]{height:24px}.h-px{height:1px}.max-h-32{max-height:calc(var(--spacing) * 32)}.min-h-5{min-height:calc(var(--spacing) * 5)}.w-4{width:calc(var(--spacing) * 4)}.w-9{width:calc(var(--spacing) * 9)}.w-\[20px\]{width:20px}.w-\[24px\]{width:24px}.w-auto{width:auto}.w-full{width:100%}.w-px{width:1px}.max-w-150{max-width:calc(var(--spacing) * 150)}.min-w-0{min-width:calc(var(--spacing) * 0)}.flex-1{flex:1}.shrink-0{flex-shrink:0}.-rotate-90{rotate:-90deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-none{--tw-border-style:none;border-style:none}.border-\(--theme-elevation-100\){border-color:var(--theme-elevation-100)}.border-transparent{border-color:#0000}.bg-\(--theme-bg\){background-color:var(--theme-bg)}.bg-\(--theme-elevation-0\){background-color:var(--theme-elevation-0)}.bg-\(--theme-elevation-100\){background-color:var(--theme-elevation-100)}.bg-\(--theme-elevation-150\){background-color:var(--theme-elevation-150)}.bg-\(--theme-elevation-1000\){background-color:var(--theme-elevation-1000)}.bg-\[\#36c5f021\]{background-color:#36c5f021}.bg-\[\#f0be3621\]{background-color:#f0be3621}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\/50{background-color:color-mix(in oklab, var(--color-black) 50%, transparent)}}.bg-current{background-color:currentColor}.bg-transparent{background-color:#0000}.p-0{padding:calc(var(--spacing) * 0)}.p-1{padding:calc(var(--spacing) * 1)}.px-0\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-6{padding-block:calc(var(--spacing) * 6)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pb-1\.25{padding-bottom:calc(var(--spacing) * 1.25)}.pb-5{padding-bottom:calc(var(--spacing) * 5)}.pl-3{padding-left:calc(var(--spacing) * 3)}.text-center{text-align:center}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[14px\]{font-size:14px}.leading-none{--tw-leading:1;line-height:1}.leading-normal{--tw-leading:var(--leading-normal);line-height:var(--leading-normal)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.wrap-break-word{overflow-wrap:break-word}.whitespace-pre-wrap{white-space:pre-wrap}.text-\(--theme-elevation-0\){color:var(--theme-elevation-0)}.text-\(--theme-elevation-450\){color:var(--theme-elevation-450)}.text-\(--theme-elevation-500\){color:var(--theme-elevation-500)}.text-\(--theme-elevation-600\){color:var(--theme-elevation-600)}.text-\(--theme-text\){color:var(--theme-text)}.text-\[\#1264a3\]{color:#1264a3}.text-\[\#a36e12\]{color:#a36e12}.text-green-500{color:var(--color-green-500)}.opacity-0{opacity:0}.opacity-60{opacity:.6}.shadow-\[0_-2px_16px_-2px_rgba\(0\,0\,0\,0\.2\)\]{--tw-shadow:0 -2px 16px -2px var(--tw-shadow-color,#0003);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.group-focus-within\:flex:is(:where(.group):focus-within *){display:flex}@media (hover:hover){.group-hover\:pointer-events-auto:is(:where(.group):hover *){pointer-events:auto}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.focus-within\:border-\(--theme-elevation-150\):focus-within{border-color:var(--theme-elevation-150)}@media (hover:hover){.hover\:bg-\(--theme-elevation-50\):hover{background-color:var(--theme-elevation-50)}.hover\:bg-\(--theme-elevation-150\):hover{background-color:var(--theme-elevation-150)}.hover\:bg-\(--theme-elevation-800\):hover{background-color:var(--theme-elevation-800)}.hover\:text-\(--theme-text\):hover{color:var(--theme-text)}}@media (prefers-reduced-motion:reduce){.motion-reduce\:transition-none{transition-property:none}}.\[\&\.is-empty\]\:before\:pointer-events-none.is-empty:before{content:var(--tw-content);pointer-events:none}.\[\&\.is-empty\]\:before\:absolute.is-empty:before{content:var(--tw-content);position:absolute}.\[\&\.is-empty\]\:before\:text-\(--theme-elevation-450\).is-empty:before{content:var(--tw-content);color:var(--theme-elevation-450)}.\[\&\.is-empty\]\:before\:content-\[attr\(data-placeholder\)\].is-empty:before{--tw-content:attr(data-placeholder);content:var(--tw-content)}@media (hover:none){.\[\@media\(hover\:none\)\]\:opacity-100{opacity:1}}.comments-drawer .gutter{padding:0 20px!important}.comments-drawer .drawer__content{--gutter-h:1px}.comments-drawer .drawer__blur-bg{display:none}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}
2
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-content:""}}}:root,:host{--color-green-500:oklch(72.3% .219 149.579);--color-black:#000;--spacing:.25rem;--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--leading-normal:1.5;--radius-sm:.25rem;--radius-md:.375rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1)}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.top-0{top:calc(var(--spacing) * 0)}.top-3{top:calc(var(--spacing) * 3)}.right-3{right:calc(var(--spacing) * 3)}.z-10{z-index:10}.z-29{z-index:29}.m-0{margin:calc(var(--spacing) * 0)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.ml-auto{margin-left:auto}.box-border{box-sizing:border-box}.block{display:block}.flex{display:flex}.hidden{display:none}.h-4{height:calc(var(--spacing) * 4)}.h-9{height:calc(var(--spacing) * 9)}.h-\[20px\]{height:20px}.h-\[24px\]{height:24px}.h-px{height:1px}.max-h-32{max-height:calc(var(--spacing) * 32)}.min-h-5{min-height:calc(var(--spacing) * 5)}.w-4{width:calc(var(--spacing) * 4)}.w-9{width:calc(var(--spacing) * 9)}.w-\[20px\]{width:20px}.w-\[24px\]{width:24px}.w-auto{width:auto}.w-full{width:100%}.w-px{width:1px}.max-w-150{max-width:calc(var(--spacing) * 150)}.min-w-0{min-width:calc(var(--spacing) * 0)}.flex-1{flex:1}.shrink-0{flex-shrink:0}.-rotate-90{rotate:-90deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-none{--tw-border-style:none;border-style:none}.border-\(--theme-elevation-100\){border-color:var(--theme-elevation-100)}.border-transparent{border-color:#0000}.bg-\(--theme-bg\){background-color:var(--theme-bg)}.bg-\(--theme-elevation-0\){background-color:var(--theme-elevation-0)}.bg-\(--theme-elevation-100\){background-color:var(--theme-elevation-100)}.bg-\(--theme-elevation-150\){background-color:var(--theme-elevation-150)}.bg-\(--theme-elevation-1000\){background-color:var(--theme-elevation-1000)}.bg-\[\#36c5f021\]{background-color:#36c5f021}.bg-\[\#f0be3621\]{background-color:#f0be3621}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\/50{background-color:color-mix(in oklab, var(--color-black) 50%, transparent)}}.bg-current{background-color:currentColor}.bg-transparent{background-color:#0000}.p-0{padding:calc(var(--spacing) * 0)}.p-1{padding:calc(var(--spacing) * 1)}.px-0\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-6{padding-block:calc(var(--spacing) * 6)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pb-1\.25{padding-bottom:calc(var(--spacing) * 1.25)}.pb-5{padding-bottom:calc(var(--spacing) * 5)}.pl-3{padding-left:calc(var(--spacing) * 3)}.text-center{text-align:center}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[14px\]{font-size:14px}.leading-none{--tw-leading:1;line-height:1}.leading-normal{--tw-leading:var(--leading-normal);line-height:var(--leading-normal)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.wrap-break-word{overflow-wrap:break-word}.whitespace-pre-wrap{white-space:pre-wrap}.text-\(--theme-elevation-0\){color:var(--theme-elevation-0)}.text-\(--theme-elevation-450\){color:var(--theme-elevation-450)}.text-\(--theme-elevation-500\){color:var(--theme-elevation-500)}.text-\(--theme-elevation-600\){color:var(--theme-elevation-600)}.text-\(--theme-text\){color:var(--theme-text)}.text-\[\#1264a3\]{color:#1264a3}.text-\[\#a36e12\]{color:#a36e12}.text-green-500{color:var(--color-green-500)}.opacity-0{opacity:0}.opacity-60{opacity:.6}.shadow-\[0_-2px_16px_-2px_rgba\(0\,0\,0\,0\.2\)\]{--tw-shadow:0 -2px 16px -2px var(--tw-shadow-color,#0003);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.group-focus-within\:flex:is(:where(.group):focus-within *){display:flex}@media (hover:hover){.group-hover\:pointer-events-auto:is(:where(.group):hover *){pointer-events:auto}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.focus-within\:border-\(--theme-elevation-150\):focus-within{border-color:var(--theme-elevation-150)}@media (hover:hover){.hover\:bg-\(--theme-elevation-50\):hover{background-color:var(--theme-elevation-50)}.hover\:bg-\(--theme-elevation-150\):hover{background-color:var(--theme-elevation-150)}.hover\:bg-\(--theme-elevation-800\):hover{background-color:var(--theme-elevation-800)}.hover\:text-\(--theme-text\):hover{color:var(--theme-text)}}@media (prefers-reduced-motion:reduce){.motion-reduce\:transition-none{transition-property:none}}.\[\&\.is-empty\]\:before\:pointer-events-none.is-empty:before{content:var(--tw-content);pointer-events:none}.\[\&\.is-empty\]\:before\:absolute.is-empty:before{content:var(--tw-content);position:absolute}.\[\&\.is-empty\]\:before\:text-\(--theme-elevation-450\).is-empty:before{content:var(--tw-content);color:var(--theme-elevation-450)}.\[\&\.is-empty\]\:before\:content-\[attr\(data-placeholder\)\].is-empty:before{--tw-content:attr(data-placeholder);content:var(--tw-content)}@media (hover:none){.\[\@media\(hover\:none\)\]\:opacity-100{opacity:1}}.comments-drawer .gutter{padding:0 20px!important}.comments-drawer .drawer__content{--gutter-h:1px}.comments-drawer .drawer__blur-bg{display:none}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}
@@ -1 +1 @@
1
- {"version":3,"file":"filterCommentsByLocale.d.ts","sourceRoot":"","sources":["../../../src/utils/comment/filterCommentsByLocale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAU3C,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,aAExF"}
1
+ {"version":3,"file":"filterCommentsByLocale.d.ts","sourceRoot":"","sources":["../../../src/utils/comment/filterCommentsByLocale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAQ3C,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,aAExF"}
@@ -1,5 +1,4 @@
1
1
  function matchesLocale(comment, currentLocale) {
2
- if (!comment.fieldPath) return true;
3
2
  if (!comment.locale) return true;
4
3
  return comment.locale === currentLocale;
5
4
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/comment/filterCommentsByLocale.ts"],"sourcesContent":["import type { Comment } from \"../../types\";\n\nfunction matchesLocale(comment: Comment, currentLocale?: string | null) {\n if (!comment.fieldPath) return true;\n\n if (!comment.locale) return true;\n\n return comment.locale === currentLocale;\n}\n\nexport function filterCommentsByLocale(comments: Comment[], currentLocale?: string | null) {\n return comments.filter((c) => matchesLocale(c, currentLocale));\n}\n"],"mappings":"AAEA,SAAS,cAAc,SAAkB,eAA+B;AACtE,MAAI,CAAC,QAAQ,UAAW,QAAO;AAE/B,MAAI,CAAC,QAAQ,OAAQ,QAAO;AAE5B,SAAO,QAAQ,WAAW;AAC5B;AAEO,SAAS,uBAAuB,UAAqB,eAA+B;AACzF,SAAO,SAAS,OAAO,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC;AAC/D;","names":[]}
1
+ {"version":3,"sources":["../../../src/utils/comment/filterCommentsByLocale.ts"],"sourcesContent":["import type { Comment } from \"../../types\";\n\nfunction matchesLocale(comment: Comment, currentLocale?: string | null) {\n if (!comment.locale) return true;\n\n return comment.locale === currentLocale;\n}\n\nexport function filterCommentsByLocale(comments: Comment[], currentLocale?: string | null) {\n return comments.filter((c) => matchesLocale(c, currentLocale));\n}\n"],"mappings":"AAEA,SAAS,cAAc,SAAkB,eAA+B;AACtE,MAAI,CAAC,QAAQ,OAAQ,QAAO;AAE5B,SAAO,QAAQ,WAAW;AAC5B;AAEO,SAAS,uBAAuB,UAAqB,eAA+B;AACzF,SAAO,SAAS,OAAO,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC;AAC/D;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@focus-reactive/payload-plugin-comments",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "license": "MIT",
5
5
  "author": "FocusReactive <ship@focusreactive.com>",
6
6
  "keywords": [
@@ -47,8 +47,7 @@
47
47
  "./providers/CommentsProviderWrapper": {
48
48
  "import": "./dist/providers/CommentsProviderWrapper/index.js",
49
49
  "types": "./dist/providers/CommentsProviderWrapper/index.d.ts"
50
- },
51
- "./styles.css": "./dist/styles.css"
50
+ }
52
51
  },
53
52
  "scripts": {
54
53
  "build": "node node_modules/tsup/dist/cli-default.js && tsc --emitDeclarationOnly --declarationMap",