@liveblocks/react-tiptap 2.16.1-ai1 → 2.16.1-ai2

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.
@@ -96,7 +96,7 @@ const YChangeMark = core.Mark.create({
96
96
  }
97
97
  return {
98
98
  "data-ychange-type": attributes.type,
99
- class: `lb-changed-${attributes.type}`
99
+ class: `lb-root lb-tiptap-change-${attributes.type}`
100
100
  };
101
101
  }
102
102
  },
@@ -1 +1 @@
1
- {"version":3,"file":"LiveblocksExtension.js","sources":["../src/LiveblocksExtension.ts"],"sourcesContent":["import type {\n BaseUserMeta,\n IUserInfo,\n JsonObject,\n User,\n} from \"@liveblocks/core\";\nimport { kInternal, TextEditorType } from \"@liveblocks/core\";\nimport { useClient, useRoom } from \"@liveblocks/react\";\nimport {\n getUmbrellaStoreForClient,\n useCreateTextMention,\n useDeleteTextMention,\n useReportTextEditor,\n useYjsProvider,\n} from \"@liveblocks/react/_private\";\nimport { LiveblocksYjsProvider } from \"@liveblocks/yjs\";\nimport type { AnyExtension, Editor } from \"@tiptap/core\";\nimport { Extension, getMarkType, Mark } from \"@tiptap/core\";\nimport Collaboration from \"@tiptap/extension-collaboration\";\nimport CollaborationCursor from \"@tiptap/extension-collaboration-cursor\";\nimport type { Mark as PMMark } from \"@tiptap/pm/model\";\nimport { useCallback, useEffect, useState, useSyncExternalStore } from \"react\";\nimport { Doc, PermanentUserData } from \"yjs\";\n\nimport { AiExtension } from \"./ai/AiExtension\";\nimport { CommentsExtension } from \"./comments/CommentsExtension\";\nimport { MentionExtension } from \"./mentions/MentionExtension\";\nimport type {\n AiResponse,\n LiveblocksExtensionOptions,\n LiveblocksExtensionStorage,\n ResolveAiPromptArgs,\n} from \"./types\";\nimport { LIVEBLOCKS_COMMENT_MARK_TYPE } from \"./types\";\n\nconst providersMap = new Map<\n string,\n LiveblocksYjsProvider<any, any, any, any, any>\n>();\n\nconst docMap = new Map<string, Doc>();\n\ntype WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };\n\nconst pudMap = new Map<string, PermanentUserData>();\n\nconst DEFAULT_OPTIONS: WithRequired<LiveblocksExtensionOptions, \"field\"> = {\n field: \"default\",\n comments: true,\n mentions: true,\n offlineSupport_experimental: false,\n};\n\nconst LiveblocksCollab = Collaboration.extend({\n // Override the onCreate method to warn users about potential misconfigurations\n onCreate() {\n if (\n !this.editor.extensionManager.extensions.find((e) => e.name === \"doc\")\n ) {\n console.warn(\n \"[Liveblocks] The tiptap document extension is required for Liveblocks collaboration. Please add it or use Tiptap StarterKit extension.\"\n );\n }\n if (\n !this.editor.extensionManager.extensions.find(\n (e) => e.name === \"paragraph\"\n )\n ) {\n console.warn(\n \"[Liveblocks] The tiptap paragraph extension is required for Liveblocks collaboration. Please add it or use Tiptap StarterKit extension.\"\n );\n }\n\n if (\n !this.editor.extensionManager.extensions.find((e) => e.name === \"text\")\n ) {\n console.warn(\n \"[Liveblocks] The tiptap text extension is required for Liveblocks collaboration. Please add it or use Tiptap StarterKit extension.\"\n );\n }\n if (\n this.editor.extensionManager.extensions.find((e) => e.name === \"history\")\n ) {\n console.warn(\n \"[Liveblocks] The history extension is enabled, Liveblocks extension provides its own. Please remove or disable the History plugin to prevent unwanted conflicts.\"\n );\n }\n },\n});\n\n/**\n * Returns whether the editor has loaded the initial text contents from the\n * server and is ready to be used.\n *\n */\nexport function useIsEditorReady(): boolean {\n const yjsProvider = useYjsProvider();\n\n const getSnapshot = useCallback(() => {\n const status = yjsProvider?.getStatus();\n return status === \"synchronizing\" || status === \"synchronized\";\n }, [yjsProvider]);\n\n const subscribe = useCallback(\n (callback: () => void) => {\n if (yjsProvider === undefined) return () => {};\n yjsProvider.on(\"status\", callback);\n return () => {\n yjsProvider.off(\"status\", callback);\n };\n },\n [yjsProvider]\n );\n\n return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n}\n\nconst YChangeMark = Mark.create({\n name: \"ychange\",\n inclusive: false,\n parseHTML() {\n return [{ tag: \"ychange\" }];\n },\n addAttributes() {\n return {\n user: {\n default: null,\n parseHTML: (element) => element.getAttribute(\"ychange_user\") ?? null,\n renderHTML: (attributes: { user: string | null }) => {\n if (!attributes.user) {\n return {};\n }\n return { \"data-ychange-user\": attributes.user };\n },\n },\n type: {\n default: null,\n parseHTML: (element) => element.getAttribute(\"ychange_type\") ?? null,\n renderHTML: (attributes: { type: string | null }) => {\n if (!attributes.type) {\n return {};\n }\n return {\n \"data-ychange-type\": attributes.type,\n class: `lb-changed-${attributes.type}`,\n };\n },\n },\n color: {\n default: null,\n parseHTML: (element) => {\n return element.getAttribute(\"ychange_color\") ?? null;\n },\n renderHTML: () => {\n // attributes: { color: { light: string; dark: string } | null }\n return {}; // we don't need this color attribute for now\n },\n },\n };\n },\n renderHTML({ HTMLAttributes }) {\n return [\"ychange\", HTMLAttributes, 0];\n },\n});\n\nexport const useLiveblocksExtension = (\n opts?: LiveblocksExtensionOptions\n): Extension => {\n const options = {\n ...DEFAULT_OPTIONS,\n ...opts,\n };\n const [editor, setEditor] = useState<Editor | null>(null);\n const room = useRoom();\n\n // TODO: we don't need these things if comments isn't turned on...\n // TODO: we don't have a reference to the editor here, need to figure this out\n // useErrorListener((error) => {\n // // If thread creation fails, we remove the thread id from the associated nodes and unwrap the nodes if they are no longer associated with any threads\n // if (\n // error.context.type === \"CREATE_THREAD_ERROR\" &&\n // error.context.roomId === room.id\n // ) {\n // handleThreadDelete(error.context.threadId);\n // }\n // });\n\n const isEditorReady = useIsEditorReady();\n const client = useClient();\n const store = getUmbrellaStoreForClient(client);\n const roomId = room.id;\n const yjsProvider = useYjsProvider();\n\n // If the user provided initialContent, wait for ready and then set it\n useEffect(() => {\n if (!isEditorReady || !yjsProvider || !options.initialContent || !editor)\n return;\n\n // As noted in the tiptap documentation, you may not set initial content with collaboration.\n // The docs provide the following workaround:\n const ydoc = (yjsProvider as LiveblocksYjsProvider).getYDoc();\n const hasContentSet = ydoc.getMap(\"liveblocks_config\").get(\"hasContentSet\");\n if (!hasContentSet) {\n ydoc.getMap(\"liveblocks_config\").set(\"hasContentSet\", true);\n editor.commands.setContent(options.initialContent);\n }\n }, [isEditorReady, yjsProvider, options.initialContent, editor]);\n\n useReportTextEditor(\n TextEditorType.TipTap,\n options.field ?? DEFAULT_OPTIONS.field\n );\n\n const createTextMention = useCreateTextMention();\n const deleteTextMention = useDeleteTextMention();\n\n return Extension.create<never, LiveblocksExtensionStorage>({\n name: \"liveblocksExtension\",\n\n onCreate() {\n setEditor(this.editor);\n if (this.editor.options.content) {\n console.warn(\n \"[Liveblocks] Initial content must be set in the useLiveblocksExtension hook option. Remove content from your editor options.\"\n );\n }\n if (\n options.mentions &&\n this.editor.extensionManager.extensions.find(\n (e) => e.name.toLowerCase() === \"mention\"\n )\n ) {\n console.warn(\n \"[Liveblocks] Liveblocks own mention plugin is enabled, using another mention plugin may cause a conflict.\"\n );\n }\n const self = room.getSelf();\n const updateUser = ({\n info,\n id: userId,\n }: User<JsonObject, BaseUserMeta>) => {\n if (!info) {\n return;\n }\n const { user: storedUser } =\n this.storage.provider.awareness.getLocalState() as {\n user: IUserInfo;\n };\n this.storage.permanentUserData?.setUserMapping(\n this.storage.doc,\n this.storage.doc.clientID,\n userId ?? \"Unknown\" // TODO: change this to the user's ID so we can map it to the user's name\n );\n if (\n info.name !== storedUser?.name ||\n info.color !== storedUser?.color\n ) {\n this.editor.commands.updateUser({\n name: info.name,\n color: info.color,\n });\n }\n };\n // if we already have user info, we update the user\n if (self?.info) {\n updateUser(self);\n }\n // we also listen in case the user info changes\n this.storage.unsubs.push(room.events.self.subscribe(updateUser));\n if (options.comments) {\n const commentMarkType = getMarkType(\n LIVEBLOCKS_COMMENT_MARK_TYPE,\n this.editor.schema\n );\n this.storage.unsubs.push(\n // Subscribe to threads so we can update comment marks if they become resolved/deleted\n store.outputs.threads.subscribe(() => {\n const threadMap = new Map(\n store.outputs.threads\n .get()\n .findMany(roomId, { resolved: false }, \"asc\")\n .map((thread) => [thread.id, true])\n );\n function isComment(mark: PMMark): mark is PMMark & {\n attrs: { orphan: boolean; threadId: string };\n } {\n return mark.type.name === LIVEBLOCKS_COMMENT_MARK_TYPE;\n }\n // when threads change, find marks and update them if needed\n this.editor.state.doc.descendants((node, pos) => {\n node.marks.forEach((mark) => {\n if (isComment(mark)) {\n const markThreadId = mark.attrs.threadId;\n const isOrphan = !threadMap.has(markThreadId);\n if (isOrphan !== mark.attrs.orphan) {\n const { tr } = this.editor.state;\n const trimmedFrom = Math.max(pos, 0);\n const trimmedTo = Math.min(\n pos + node.nodeSize,\n this.editor.state.doc.content.size - 1\n );\n tr.removeMark(trimmedFrom, trimmedTo, commentMarkType);\n tr.addMark(\n trimmedFrom,\n trimmedTo,\n commentMarkType.create({\n ...mark.attrs,\n orphan: isOrphan,\n })\n );\n this.editor.view.dispatch(tr);\n }\n }\n });\n });\n })\n );\n }\n },\n onDestroy() {\n this.storage.unsubs.forEach((unsub) => unsub());\n },\n addGlobalAttributes() {\n return [\n {\n types: [\"paragraph\", \"heading\"],\n attributes: {\n ychange: { default: null },\n },\n },\n ];\n },\n addStorage() {\n if (!providersMap.has(room.id)) {\n const doc = new Doc();\n docMap.set(room.id, doc);\n pudMap.set(room.id, new PermanentUserData(doc));\n providersMap.set(\n room.id,\n new LiveblocksYjsProvider(room, doc, {\n offlineSupport_experimental: options.offlineSupport_experimental,\n })\n );\n }\n return {\n doc: docMap.get(room.id)!,\n provider: providersMap.get(room.id)!,\n permanentUserData: pudMap.get(room.id)!,\n unsubs: [],\n };\n },\n addExtensions() {\n const extensions: AnyExtension[] = [\n YChangeMark,\n LiveblocksCollab.configure({\n ySyncOptions: {\n permanentUserData: this.storage.permanentUserData,\n },\n document: this.storage.doc,\n field: options.field,\n }),\n CollaborationCursor.configure({\n provider: this.storage.provider,\n }),\n ];\n\n if (options.comments) {\n extensions.push(CommentsExtension);\n }\n if (options.mentions) {\n extensions.push(\n MentionExtension.configure({\n onCreateMention: createTextMention,\n onDeleteMention: deleteTextMention,\n })\n );\n }\n if (options.ai) {\n const resolveAiPrompt = async ({\n prompt,\n selectionText,\n context,\n signal,\n }: ResolveAiPromptArgs): Promise<AiResponse> => {\n const result = await room[kInternal].executeContextualPrompt({\n prompt,\n selectionText,\n context,\n signal,\n });\n\n const parsedResponse = JSON.parse(result) as JsonObject;\n const type =\n typeof parsedResponse.type === \"string\" ? parsedResponse.type : \"\";\n if (\n typeof parsedResponse.content === \"string\" &&\n [\"insert\", \"modification\", \"other\"].includes(type)\n ) {\n return parsedResponse as AiResponse;\n }\n\n throw new Error(\"Failed to resolve AI prompt\");\n };\n extensions.push(\n AiExtension.configure({\n resolveAiPrompt,\n ...(typeof options.ai === \"boolean\" ? {} : options.ai),\n doc: this.storage.doc,\n pud: this.storage.permanentUserData,\n })\n );\n }\n\n return extensions;\n },\n });\n};\n"],"names":["useYjsProvider","useCallback","useSyncExternalStore","Mark","useState","useRoom","useClient","getUmbrellaStoreForClient","useEffect","useReportTextEditor","TextEditorType","useCreateTextMention","useDeleteTextMention","Extension","getMarkType","LIVEBLOCKS_COMMENT_MARK_TYPE","Doc","PermanentUserData","LiveblocksYjsProvider","CommentsExtension","MentionExtension","kInternal","AiExtension"],"mappings":";;;;;;;;;;;;;;;;AAmCA,MAAM,YAAA,uBAAmB,GAGvB,EAAA,CAAA;AAEF,MAAM,MAAA,uBAAa,GAAiB,EAAA,CAAA;AAIpC,MAAM,MAAA,uBAAa,GAA+B,EAAA,CAAA;AAElD,MAAM,eAAqE,GAAA;AAAA,EACzE,KAAO,EAAA,SAAA;AAAA,EACP,QAAU,EAAA,IAAA;AAAA,EACV,QAAU,EAAA,IAAA;AAAA,EACV,2BAA6B,EAAA,KAAA;AAC/B,CAAA,CAAA;AAEA,MAAM,gBAAA,GAAmB,cAAc,MAAO,CAAA;AAAA,EAE5C,QAAW,GAAA;AACT,IACE,IAAA,CAAC,IAAK,CAAA,MAAA,CAAO,gBAAiB,CAAA,UAAA,CAAW,IAAK,CAAA,CAAC,CAAM,KAA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,MAAS,GAAA,MAAM,IAAK,CAAAC,gBAAA,CAAA,CAAW,uBAAwB,CAAA;AAAA,YAC3D,MAAA;AAAA,YACA,aAAA;AAAA,YACA,OAAA;AAAA,YACA,MAAA;AAAA,WACD,CAAA,CAAA;AAED,UAAM,MAAA,cAAA,GAAiB,IAAK,CAAA,KAAA,CAAM,MAAM,CAAA,CAAA;AACxC,UAAA,MAAM,OACJ,OAAO,cAAA,CAAe,IAAS,KAAA,QAAA,GAAW,eAAe,IAAO,GAAA,EAAA,CAAA;AAClE,UACE,IAAA,OAAO,cAAe,CAAA,OAAA,KAAY,QAClC,IAAA,CAAC,QAAU,EAAA,cAAA,EAAgB,OAAO,CAAA,CAAE,QAAS,CAAA,IAAI,CACjD,EAAA;AACA,YAAO,OAAA,cAAA,CAAA;AAAA,WACT;AAEA,UAAM,MAAA,IAAI,MAAM,6BAA6B,CAAA,CAAA;AAAA,SAC/C,CAAA;AACA,QAAW,UAAA,CAAA,IAAA;AAAA,UACTC,wBAAY,SAAU,CAAA;AAAA,YACpB,eAAA;AAAA,YACA,GAAI,OAAO,OAAA,CAAQ,OAAO,SAAY,GAAA,KAAK,OAAQ,CAAA,EAAA;AAAA,YACnD,GAAA,EAAK,KAAK,OAAQ,CAAA,GAAA;AAAA,YAClB,GAAA,EAAK,KAAK,OAAQ,CAAA,iBAAA;AAAA,WACnB,CAAA;AAAA,SACH,CAAA;AAAA,OACF;AAEA,MAAO,OAAA,UAAA,CAAA;AAAA,KACT;AAAA,GACD,CAAA,CAAA;AACH;;;;;"}
1
+ {"version":3,"file":"LiveblocksExtension.js","sources":["../src/LiveblocksExtension.ts"],"sourcesContent":["import type {\n BaseUserMeta,\n IUserInfo,\n JsonObject,\n User,\n} from \"@liveblocks/core\";\nimport { kInternal, TextEditorType } from \"@liveblocks/core\";\nimport { useClient, useRoom } from \"@liveblocks/react\";\nimport {\n getUmbrellaStoreForClient,\n useCreateTextMention,\n useDeleteTextMention,\n useReportTextEditor,\n useYjsProvider,\n} from \"@liveblocks/react/_private\";\nimport { LiveblocksYjsProvider } from \"@liveblocks/yjs\";\nimport type { AnyExtension, Editor } from \"@tiptap/core\";\nimport { Extension, getMarkType, Mark } from \"@tiptap/core\";\nimport Collaboration from \"@tiptap/extension-collaboration\";\nimport CollaborationCursor from \"@tiptap/extension-collaboration-cursor\";\nimport type { Mark as PMMark } from \"@tiptap/pm/model\";\nimport { useCallback, useEffect, useState, useSyncExternalStore } from \"react\";\nimport { Doc, PermanentUserData } from \"yjs\";\n\nimport { AiExtension } from \"./ai/AiExtension\";\nimport { CommentsExtension } from \"./comments/CommentsExtension\";\nimport { MentionExtension } from \"./mentions/MentionExtension\";\nimport type {\n AiResponse,\n LiveblocksExtensionOptions,\n LiveblocksExtensionStorage,\n ResolveAiPromptArgs,\n} from \"./types\";\nimport { LIVEBLOCKS_COMMENT_MARK_TYPE } from \"./types\";\n\nconst providersMap = new Map<\n string,\n LiveblocksYjsProvider<any, any, any, any, any>\n>();\n\nconst docMap = new Map<string, Doc>();\n\ntype WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };\n\nconst pudMap = new Map<string, PermanentUserData>();\n\nconst DEFAULT_OPTIONS: WithRequired<LiveblocksExtensionOptions, \"field\"> = {\n field: \"default\",\n comments: true,\n mentions: true,\n offlineSupport_experimental: false,\n};\n\nconst LiveblocksCollab = Collaboration.extend({\n // Override the onCreate method to warn users about potential misconfigurations\n onCreate() {\n if (\n !this.editor.extensionManager.extensions.find((e) => e.name === \"doc\")\n ) {\n console.warn(\n \"[Liveblocks] The tiptap document extension is required for Liveblocks collaboration. Please add it or use Tiptap StarterKit extension.\"\n );\n }\n if (\n !this.editor.extensionManager.extensions.find(\n (e) => e.name === \"paragraph\"\n )\n ) {\n console.warn(\n \"[Liveblocks] The tiptap paragraph extension is required for Liveblocks collaboration. Please add it or use Tiptap StarterKit extension.\"\n );\n }\n\n if (\n !this.editor.extensionManager.extensions.find((e) => e.name === \"text\")\n ) {\n console.warn(\n \"[Liveblocks] The tiptap text extension is required for Liveblocks collaboration. Please add it or use Tiptap StarterKit extension.\"\n );\n }\n if (\n this.editor.extensionManager.extensions.find((e) => e.name === \"history\")\n ) {\n console.warn(\n \"[Liveblocks] The history extension is enabled, Liveblocks extension provides its own. Please remove or disable the History plugin to prevent unwanted conflicts.\"\n );\n }\n },\n});\n\n/**\n * Returns whether the editor has loaded the initial text contents from the\n * server and is ready to be used.\n *\n */\nexport function useIsEditorReady(): boolean {\n const yjsProvider = useYjsProvider();\n\n const getSnapshot = useCallback(() => {\n const status = yjsProvider?.getStatus();\n return status === \"synchronizing\" || status === \"synchronized\";\n }, [yjsProvider]);\n\n const subscribe = useCallback(\n (callback: () => void) => {\n if (yjsProvider === undefined) return () => {};\n yjsProvider.on(\"status\", callback);\n return () => {\n yjsProvider.off(\"status\", callback);\n };\n },\n [yjsProvider]\n );\n\n return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n}\n\nconst YChangeMark = Mark.create({\n name: \"ychange\",\n inclusive: false,\n parseHTML() {\n return [{ tag: \"ychange\" }];\n },\n addAttributes() {\n return {\n user: {\n default: null,\n parseHTML: (element) => element.getAttribute(\"ychange_user\") ?? null,\n renderHTML: (attributes: { user: string | null }) => {\n if (!attributes.user) {\n return {};\n }\n return { \"data-ychange-user\": attributes.user };\n },\n },\n type: {\n default: null,\n parseHTML: (element) => element.getAttribute(\"ychange_type\") ?? null,\n renderHTML: (attributes: { type: string | null }) => {\n if (!attributes.type) {\n return {};\n }\n return {\n \"data-ychange-type\": attributes.type,\n class: `lb-root lb-tiptap-change-${attributes.type}`,\n };\n },\n },\n color: {\n default: null,\n parseHTML: (element) => {\n return element.getAttribute(\"ychange_color\") ?? null;\n },\n renderHTML: () => {\n // attributes: { color: { light: string; dark: string } | null }\n return {}; // we don't need this color attribute for now\n },\n },\n };\n },\n renderHTML({ HTMLAttributes }) {\n return [\"ychange\", HTMLAttributes, 0];\n },\n});\n\nexport const useLiveblocksExtension = (\n opts?: LiveblocksExtensionOptions\n): Extension => {\n const options = {\n ...DEFAULT_OPTIONS,\n ...opts,\n };\n const [editor, setEditor] = useState<Editor | null>(null);\n const room = useRoom();\n\n // TODO: we don't need these things if comments isn't turned on...\n // TODO: we don't have a reference to the editor here, need to figure this out\n // useErrorListener((error) => {\n // // If thread creation fails, we remove the thread id from the associated nodes and unwrap the nodes if they are no longer associated with any threads\n // if (\n // error.context.type === \"CREATE_THREAD_ERROR\" &&\n // error.context.roomId === room.id\n // ) {\n // handleThreadDelete(error.context.threadId);\n // }\n // });\n\n const isEditorReady = useIsEditorReady();\n const client = useClient();\n const store = getUmbrellaStoreForClient(client);\n const roomId = room.id;\n const yjsProvider = useYjsProvider();\n\n // If the user provided initialContent, wait for ready and then set it\n useEffect(() => {\n if (!isEditorReady || !yjsProvider || !options.initialContent || !editor)\n return;\n\n // As noted in the tiptap documentation, you may not set initial content with collaboration.\n // The docs provide the following workaround:\n const ydoc = (yjsProvider as LiveblocksYjsProvider).getYDoc();\n const hasContentSet = ydoc.getMap(\"liveblocks_config\").get(\"hasContentSet\");\n if (!hasContentSet) {\n ydoc.getMap(\"liveblocks_config\").set(\"hasContentSet\", true);\n editor.commands.setContent(options.initialContent);\n }\n }, [isEditorReady, yjsProvider, options.initialContent, editor]);\n\n useReportTextEditor(\n TextEditorType.TipTap,\n options.field ?? DEFAULT_OPTIONS.field\n );\n\n const createTextMention = useCreateTextMention();\n const deleteTextMention = useDeleteTextMention();\n\n return Extension.create<never, LiveblocksExtensionStorage>({\n name: \"liveblocksExtension\",\n\n onCreate() {\n setEditor(this.editor);\n if (this.editor.options.content) {\n console.warn(\n \"[Liveblocks] Initial content must be set in the useLiveblocksExtension hook option. Remove content from your editor options.\"\n );\n }\n if (\n options.mentions &&\n this.editor.extensionManager.extensions.find(\n (e) => e.name.toLowerCase() === \"mention\"\n )\n ) {\n console.warn(\n \"[Liveblocks] Liveblocks own mention plugin is enabled, using another mention plugin may cause a conflict.\"\n );\n }\n const self = room.getSelf();\n const updateUser = ({\n info,\n id: userId,\n }: User<JsonObject, BaseUserMeta>) => {\n if (!info) {\n return;\n }\n const { user: storedUser } =\n this.storage.provider.awareness.getLocalState() as {\n user: IUserInfo;\n };\n this.storage.permanentUserData?.setUserMapping(\n this.storage.doc,\n this.storage.doc.clientID,\n userId ?? \"Unknown\" // TODO: change this to the user's ID so we can map it to the user's name\n );\n if (\n info.name !== storedUser?.name ||\n info.color !== storedUser?.color\n ) {\n this.editor.commands.updateUser({\n name: info.name,\n color: info.color,\n });\n }\n };\n // if we already have user info, we update the user\n if (self?.info) {\n updateUser(self);\n }\n // we also listen in case the user info changes\n this.storage.unsubs.push(room.events.self.subscribe(updateUser));\n if (options.comments) {\n const commentMarkType = getMarkType(\n LIVEBLOCKS_COMMENT_MARK_TYPE,\n this.editor.schema\n );\n this.storage.unsubs.push(\n // Subscribe to threads so we can update comment marks if they become resolved/deleted\n store.outputs.threads.subscribe(() => {\n const threadMap = new Map(\n store.outputs.threads\n .get()\n .findMany(roomId, { resolved: false }, \"asc\")\n .map((thread) => [thread.id, true])\n );\n function isComment(mark: PMMark): mark is PMMark & {\n attrs: { orphan: boolean; threadId: string };\n } {\n return mark.type.name === LIVEBLOCKS_COMMENT_MARK_TYPE;\n }\n // when threads change, find marks and update them if needed\n this.editor.state.doc.descendants((node, pos) => {\n node.marks.forEach((mark) => {\n if (isComment(mark)) {\n const markThreadId = mark.attrs.threadId;\n const isOrphan = !threadMap.has(markThreadId);\n if (isOrphan !== mark.attrs.orphan) {\n const { tr } = this.editor.state;\n const trimmedFrom = Math.max(pos, 0);\n const trimmedTo = Math.min(\n pos + node.nodeSize,\n this.editor.state.doc.content.size - 1\n );\n tr.removeMark(trimmedFrom, trimmedTo, commentMarkType);\n tr.addMark(\n trimmedFrom,\n trimmedTo,\n commentMarkType.create({\n ...mark.attrs,\n orphan: isOrphan,\n })\n );\n this.editor.view.dispatch(tr);\n }\n }\n });\n });\n })\n );\n }\n },\n onDestroy() {\n this.storage.unsubs.forEach((unsub) => unsub());\n },\n addGlobalAttributes() {\n return [\n {\n types: [\"paragraph\", \"heading\"],\n attributes: {\n ychange: { default: null },\n },\n },\n ];\n },\n addStorage() {\n if (!providersMap.has(room.id)) {\n const doc = new Doc();\n docMap.set(room.id, doc);\n pudMap.set(room.id, new PermanentUserData(doc));\n providersMap.set(\n room.id,\n new LiveblocksYjsProvider(room, doc, {\n offlineSupport_experimental: options.offlineSupport_experimental,\n })\n );\n }\n return {\n doc: docMap.get(room.id)!,\n provider: providersMap.get(room.id)!,\n permanentUserData: pudMap.get(room.id)!,\n unsubs: [],\n };\n },\n addExtensions() {\n const extensions: AnyExtension[] = [\n YChangeMark,\n LiveblocksCollab.configure({\n ySyncOptions: {\n permanentUserData: this.storage.permanentUserData,\n },\n document: this.storage.doc,\n field: options.field,\n }),\n CollaborationCursor.configure({\n provider: this.storage.provider,\n }),\n ];\n\n if (options.comments) {\n extensions.push(CommentsExtension);\n }\n if (options.mentions) {\n extensions.push(\n MentionExtension.configure({\n onCreateMention: createTextMention,\n onDeleteMention: deleteTextMention,\n })\n );\n }\n if (options.ai) {\n const resolveAiPrompt = async ({\n prompt,\n selectionText,\n context,\n signal,\n }: ResolveAiPromptArgs): Promise<AiResponse> => {\n const result = await room[kInternal].executeContextualPrompt({\n prompt,\n selectionText,\n context,\n signal,\n });\n\n const parsedResponse = JSON.parse(result) as JsonObject;\n const type =\n typeof parsedResponse.type === \"string\" ? parsedResponse.type : \"\";\n if (\n typeof parsedResponse.content === \"string\" &&\n [\"insert\", \"modification\", \"other\"].includes(type)\n ) {\n return parsedResponse as AiResponse;\n }\n\n throw new Error(\"Failed to resolve AI prompt\");\n };\n extensions.push(\n AiExtension.configure({\n resolveAiPrompt,\n ...(typeof options.ai === \"boolean\" ? {} : options.ai),\n doc: this.storage.doc,\n pud: this.storage.permanentUserData,\n })\n );\n }\n\n return extensions;\n },\n });\n};\n"],"names":["useYjsProvider","useCallback","useSyncExternalStore","Mark","useState","useRoom","useClient","getUmbrellaStoreForClient","useEffect","useReportTextEditor","TextEditorType","useCreateTextMention","useDeleteTextMention","Extension","getMarkType","LIVEBLOCKS_COMMENT_MARK_TYPE","Doc","PermanentUserData","LiveblocksYjsProvider","CommentsExtension","MentionExtension","kInternal","AiExtension"],"mappings":";;;;;;;;;;;;;;;;AAmCA,MAAM,YAAA,uBAAmB,GAGvB,EAAA,CAAA;AAEF,MAAM,MAAA,uBAAa,GAAiB,EAAA,CAAA;AAIpC,MAAM,MAAA,uBAAa,GAA+B,EAAA,CAAA;AAElD,MAAM,eAAqE,GAAA;AAAA,EACzE,KAAO,EAAA,SAAA;AAAA,EACP,QAAU,EAAA,IAAA;AAAA,EACV,QAAU,EAAA,IAAA;AAAA,EACV,2BAA6B,EAAA,KAAA;AAC/B,CAAA,CAAA;AAEA,MAAM,gBAAA,GAAmB,cAAc,MAAO,CAAA;AAAA,EAE5C,QAAW,GAAA;AACT,IACE,IAAA,CAAC,IAAK,CAAA,MAAA,CAAO,gBAAiB,CAAA,UAAA,CAAW,IAAK,CAAA,CAAC,CAAM,KAAA,CAAA,CAAE,IAAS,KAAA,KAAK,CACrE,EAAA;AACA,MAAQ,OAAA,CAAA,IAAA;AAAA,QACN,wIAAA;AAAA,OACF,CAAA;AAAA,KACF;AACA,IAAA,IACE,CAAC,IAAA,CAAK,MAAO,CAAA,gBAAA,CAAiB,UAAW,CAAA,IAAA;AAAA,MACvC,CAAC,CAAM,KAAA,CAAA,CAAE,IAAS,KAAA,WAAA;AAAA,KAEpB,EAAA;AACA,MAAQ,OAAA,CAAA,IAAA;AAAA,QACN,yIAAA;AAAA,OACF,CAAA;AAAA,KACF;AAEA,IACE,IAAA,CAAC,IAAK,CAAA,MAAA,CAAO,gBAAiB,CAAA,UAAA,CAAW,IAAK,CAAA,CAAC,CAAM,KAAA,CAAA,CAAE,IAAS,KAAA,MAAM,CACtE,EAAA;AACA,MAAQ,OAAA,CAAA,IAAA;AAAA,QACN,oIAAA;AAAA,OACF,CAAA;AAAA,KACF;A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;AACA,QAAW,UAAA,CAAA,IAAA;AAAA,UACTC,wBAAY,SAAU,CAAA;AAAA,YACpB,eAAA;AAAA,YACA,GAAI,OAAO,OAAA,CAAQ,OAAO,SAAY,GAAA,KAAK,OAAQ,CAAA,EAAA;AAAA,YACnD,GAAA,EAAK,KAAK,OAAQ,CAAA,GAAA;AAAA,YAClB,GAAA,EAAK,KAAK,OAAQ,CAAA,iBAAA;AAAA,WACnB,CAAA;AAAA,SACH,CAAA;AAAA,OACF;AAEA,MAAO,OAAA,UAAA,CAAA;AAAA,KACT;AAAA,GACD,CAAA,CAAA;AACH;;;;;"}
@@ -94,7 +94,7 @@ const YChangeMark = Mark.create({
94
94
  }
95
95
  return {
96
96
  "data-ychange-type": attributes.type,
97
- class: `lb-changed-${attributes.type}`
97
+ class: `lb-root lb-tiptap-change-${attributes.type}`
98
98
  };
99
99
  }
100
100
  },
@@ -1 +1 @@
1
- {"version":3,"file":"LiveblocksExtension.mjs","sources":["../src/LiveblocksExtension.ts"],"sourcesContent":["import type {\n BaseUserMeta,\n IUserInfo,\n JsonObject,\n User,\n} from \"@liveblocks/core\";\nimport { kInternal, TextEditorType } from \"@liveblocks/core\";\nimport { useClient, useRoom } from \"@liveblocks/react\";\nimport {\n getUmbrellaStoreForClient,\n useCreateTextMention,\n useDeleteTextMention,\n useReportTextEditor,\n useYjsProvider,\n} from \"@liveblocks/react/_private\";\nimport { LiveblocksYjsProvider } from \"@liveblocks/yjs\";\nimport type { AnyExtension, Editor } from \"@tiptap/core\";\nimport { Extension, getMarkType, Mark } from \"@tiptap/core\";\nimport Collaboration from \"@tiptap/extension-collaboration\";\nimport CollaborationCursor from \"@tiptap/extension-collaboration-cursor\";\nimport type { Mark as PMMark } from \"@tiptap/pm/model\";\nimport { useCallback, useEffect, useState, useSyncExternalStore } from \"react\";\nimport { Doc, PermanentUserData } from \"yjs\";\n\nimport { AiExtension } from \"./ai/AiExtension\";\nimport { CommentsExtension } from \"./comments/CommentsExtension\";\nimport { MentionExtension } from \"./mentions/MentionExtension\";\nimport type {\n AiResponse,\n LiveblocksExtensionOptions,\n LiveblocksExtensionStorage,\n ResolveAiPromptArgs,\n} from \"./types\";\nimport { LIVEBLOCKS_COMMENT_MARK_TYPE } from \"./types\";\n\nconst providersMap = new Map<\n string,\n LiveblocksYjsProvider<any, any, any, any, any>\n>();\n\nconst docMap = new Map<string, Doc>();\n\ntype WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };\n\nconst pudMap = new Map<string, PermanentUserData>();\n\nconst DEFAULT_OPTIONS: WithRequired<LiveblocksExtensionOptions, \"field\"> = {\n field: \"default\",\n comments: true,\n mentions: true,\n offlineSupport_experimental: false,\n};\n\nconst LiveblocksCollab = Collaboration.extend({\n // Override the onCreate method to warn users about potential misconfigurations\n onCreate() {\n if (\n !this.editor.extensionManager.extensions.find((e) => e.name === \"doc\")\n ) {\n console.warn(\n \"[Liveblocks] The tiptap document extension is required for Liveblocks collaboration. Please add it or use Tiptap StarterKit extension.\"\n );\n }\n if (\n !this.editor.extensionManager.extensions.find(\n (e) => e.name === \"paragraph\"\n )\n ) {\n console.warn(\n \"[Liveblocks] The tiptap paragraph extension is required for Liveblocks collaboration. Please add it or use Tiptap StarterKit extension.\"\n );\n }\n\n if (\n !this.editor.extensionManager.extensions.find((e) => e.name === \"text\")\n ) {\n console.warn(\n \"[Liveblocks] The tiptap text extension is required for Liveblocks collaboration. Please add it or use Tiptap StarterKit extension.\"\n );\n }\n if (\n this.editor.extensionManager.extensions.find((e) => e.name === \"history\")\n ) {\n console.warn(\n \"[Liveblocks] The history extension is enabled, Liveblocks extension provides its own. Please remove or disable the History plugin to prevent unwanted conflicts.\"\n );\n }\n },\n});\n\n/**\n * Returns whether the editor has loaded the initial text contents from the\n * server and is ready to be used.\n *\n */\nexport function useIsEditorReady(): boolean {\n const yjsProvider = useYjsProvider();\n\n const getSnapshot = useCallback(() => {\n const status = yjsProvider?.getStatus();\n return status === \"synchronizing\" || status === \"synchronized\";\n }, [yjsProvider]);\n\n const subscribe = useCallback(\n (callback: () => void) => {\n if (yjsProvider === undefined) return () => {};\n yjsProvider.on(\"status\", callback);\n return () => {\n yjsProvider.off(\"status\", callback);\n };\n },\n [yjsProvider]\n );\n\n return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n}\n\nconst YChangeMark = Mark.create({\n name: \"ychange\",\n inclusive: false,\n parseHTML() {\n return [{ tag: \"ychange\" }];\n },\n addAttributes() {\n return {\n user: {\n default: null,\n parseHTML: (element) => element.getAttribute(\"ychange_user\") ?? null,\n renderHTML: (attributes: { user: string | null }) => {\n if (!attributes.user) {\n return {};\n }\n return { \"data-ychange-user\": attributes.user };\n },\n },\n type: {\n default: null,\n parseHTML: (element) => element.getAttribute(\"ychange_type\") ?? null,\n renderHTML: (attributes: { type: string | null }) => {\n if (!attributes.type) {\n return {};\n }\n return {\n \"data-ychange-type\": attributes.type,\n class: `lb-changed-${attributes.type}`,\n };\n },\n },\n color: {\n default: null,\n parseHTML: (element) => {\n return element.getAttribute(\"ychange_color\") ?? null;\n },\n renderHTML: () => {\n // attributes: { color: { light: string; dark: string } | null }\n return {}; // we don't need this color attribute for now\n },\n },\n };\n },\n renderHTML({ HTMLAttributes }) {\n return [\"ychange\", HTMLAttributes, 0];\n },\n});\n\nexport const useLiveblocksExtension = (\n opts?: LiveblocksExtensionOptions\n): Extension => {\n const options = {\n ...DEFAULT_OPTIONS,\n ...opts,\n };\n const [editor, setEditor] = useState<Editor | null>(null);\n const room = useRoom();\n\n // TODO: we don't need these things if comments isn't turned on...\n // TODO: we don't have a reference to the editor here, need to figure this out\n // useErrorListener((error) => {\n // // If thread creation fails, we remove the thread id from the associated nodes and unwrap the nodes if they are no longer associated with any threads\n // if (\n // error.context.type === \"CREATE_THREAD_ERROR\" &&\n // error.context.roomId === room.id\n // ) {\n // handleThreadDelete(error.context.threadId);\n // }\n // });\n\n const isEditorReady = useIsEditorReady();\n const client = useClient();\n const store = getUmbrellaStoreForClient(client);\n const roomId = room.id;\n const yjsProvider = useYjsProvider();\n\n // If the user provided initialContent, wait for ready and then set it\n useEffect(() => {\n if (!isEditorReady || !yjsProvider || !options.initialContent || !editor)\n return;\n\n // As noted in the tiptap documentation, you may not set initial content with collaboration.\n // The docs provide the following workaround:\n const ydoc = (yjsProvider as LiveblocksYjsProvider).getYDoc();\n const hasContentSet = ydoc.getMap(\"liveblocks_config\").get(\"hasContentSet\");\n if (!hasContentSet) {\n ydoc.getMap(\"liveblocks_config\").set(\"hasContentSet\", true);\n editor.commands.setContent(options.initialContent);\n }\n }, [isEditorReady, yjsProvider, options.initialContent, editor]);\n\n useReportTextEditor(\n TextEditorType.TipTap,\n options.field ?? DEFAULT_OPTIONS.field\n );\n\n const createTextMention = useCreateTextMention();\n const deleteTextMention = useDeleteTextMention();\n\n return Extension.create<never, LiveblocksExtensionStorage>({\n name: \"liveblocksExtension\",\n\n onCreate() {\n setEditor(this.editor);\n if (this.editor.options.content) {\n console.warn(\n \"[Liveblocks] Initial content must be set in the useLiveblocksExtension hook option. Remove content from your editor options.\"\n );\n }\n if (\n options.mentions &&\n this.editor.extensionManager.extensions.find(\n (e) => e.name.toLowerCase() === \"mention\"\n )\n ) {\n console.warn(\n \"[Liveblocks] Liveblocks own mention plugin is enabled, using another mention plugin may cause a conflict.\"\n );\n }\n const self = room.getSelf();\n const updateUser = ({\n info,\n id: userId,\n }: User<JsonObject, BaseUserMeta>) => {\n if (!info) {\n return;\n }\n const { user: storedUser } =\n this.storage.provider.awareness.getLocalState() as {\n user: IUserInfo;\n };\n this.storage.permanentUserData?.setUserMapping(\n this.storage.doc,\n this.storage.doc.clientID,\n userId ?? \"Unknown\" // TODO: change this to the user's ID so we can map it to the user's name\n );\n if (\n info.name !== storedUser?.name ||\n info.color !== storedUser?.color\n ) {\n this.editor.commands.updateUser({\n name: info.name,\n color: info.color,\n });\n }\n };\n // if we already have user info, we update the user\n if (self?.info) {\n updateUser(self);\n }\n // we also listen in case the user info changes\n this.storage.unsubs.push(room.events.self.subscribe(updateUser));\n if (options.comments) {\n const commentMarkType = getMarkType(\n LIVEBLOCKS_COMMENT_MARK_TYPE,\n this.editor.schema\n );\n this.storage.unsubs.push(\n // Subscribe to threads so we can update comment marks if they become resolved/deleted\n store.outputs.threads.subscribe(() => {\n const threadMap = new Map(\n store.outputs.threads\n .get()\n .findMany(roomId, { resolved: false }, \"asc\")\n .map((thread) => [thread.id, true])\n );\n function isComment(mark: PMMark): mark is PMMark & {\n attrs: { orphan: boolean; threadId: string };\n } {\n return mark.type.name === LIVEBLOCKS_COMMENT_MARK_TYPE;\n }\n // when threads change, find marks and update them if needed\n this.editor.state.doc.descendants((node, pos) => {\n node.marks.forEach((mark) => {\n if (isComment(mark)) {\n const markThreadId = mark.attrs.threadId;\n const isOrphan = !threadMap.has(markThreadId);\n if (isOrphan !== mark.attrs.orphan) {\n const { tr } = this.editor.state;\n const trimmedFrom = Math.max(pos, 0);\n const trimmedTo = Math.min(\n pos + node.nodeSize,\n this.editor.state.doc.content.size - 1\n );\n tr.removeMark(trimmedFrom, trimmedTo, commentMarkType);\n tr.addMark(\n trimmedFrom,\n trimmedTo,\n commentMarkType.create({\n ...mark.attrs,\n orphan: isOrphan,\n })\n );\n this.editor.view.dispatch(tr);\n }\n }\n });\n });\n })\n );\n }\n },\n onDestroy() {\n this.storage.unsubs.forEach((unsub) => unsub());\n },\n addGlobalAttributes() {\n return [\n {\n types: [\"paragraph\", \"heading\"],\n attributes: {\n ychange: { default: null },\n },\n },\n ];\n },\n addStorage() {\n if (!providersMap.has(room.id)) {\n const doc = new Doc();\n docMap.set(room.id, doc);\n pudMap.set(room.id, new PermanentUserData(doc));\n providersMap.set(\n room.id,\n new LiveblocksYjsProvider(room, doc, {\n offlineSupport_experimental: options.offlineSupport_experimental,\n })\n );\n }\n return {\n doc: docMap.get(room.id)!,\n provider: providersMap.get(room.id)!,\n permanentUserData: pudMap.get(room.id)!,\n unsubs: [],\n };\n },\n addExtensions() {\n const extensions: AnyExtension[] = [\n YChangeMark,\n LiveblocksCollab.configure({\n ySyncOptions: {\n permanentUserData: this.storage.permanentUserData,\n },\n document: this.storage.doc,\n field: options.field,\n }),\n CollaborationCursor.configure({\n provider: this.storage.provider,\n }),\n ];\n\n if (options.comments) {\n extensions.push(CommentsExtension);\n }\n if (options.mentions) {\n extensions.push(\n MentionExtension.configure({\n onCreateMention: createTextMention,\n onDeleteMention: deleteTextMention,\n })\n );\n }\n if (options.ai) {\n const resolveAiPrompt = async ({\n prompt,\n selectionText,\n context,\n signal,\n }: ResolveAiPromptArgs): Promise<AiResponse> => {\n const result = await room[kInternal].executeContextualPrompt({\n prompt,\n selectionText,\n context,\n signal,\n });\n\n const parsedResponse = JSON.parse(result) as JsonObject;\n const type =\n typeof parsedResponse.type === \"string\" ? parsedResponse.type : \"\";\n if (\n typeof parsedResponse.content === \"string\" &&\n [\"insert\", \"modification\", \"other\"].includes(type)\n ) {\n return parsedResponse as AiResponse;\n }\n\n throw new Error(\"Failed to resolve AI prompt\");\n };\n extensions.push(\n AiExtension.configure({\n resolveAiPrompt,\n ...(typeof options.ai === \"boolean\" ? {} : options.ai),\n doc: this.storage.doc,\n pud: this.storage.permanentUserData,\n })\n );\n }\n\n return extensions;\n },\n });\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAmCA,MAAM,YAAA,uBAAmB,GAGvB,EAAA,CAAA;AAEF,MAAM,MAAA,uBAAa,GAAiB,EAAA,CAAA;AAIpC,MAAM,MAAA,uBAAa,GAA+B,EAAA,CAAA;AAElD,MAAM,eAAqE,GAAA;AAAA,EACzE,KAAO,EAAA,SAAA;AAAA,EACP,QAAU,EAAA,IAAA;AAAA,EACV,QAAU,EAAA,IAAA;AAAA,EACV,2BAA6B,EAAA,KAAA;AAC/B,CAAA,CAAA;AAEA,MAAM,gBAAA,GAAmB,cAAc,MAAO,CAAA;AAAA,EAE5C,QAAW,GAAA;AACT,IACE,IAAA,CAAC,IAAK,CAAA,MAAA,CAAO,gBAAiB,CAAA,UAA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,MAAS,GAAA,MAAM,IAAK,CAAA,SAAA,CAAA,CAAW,uBAAwB,CAAA;AAAA,YAC3D,MAAA;AAAA,YACA,aAAA;AAAA,YACA,OAAA;AAAA,YACA,MAAA;AAAA,WACD,CAAA,CAAA;AAED,UAAM,MAAA,cAAA,GAAiB,IAAK,CAAA,KAAA,CAAM,MAAM,CAAA,CAAA;AACxC,UAAA,MAAM,OACJ,OAAO,cAAA,CAAe,IAAS,KAAA,QAAA,GAAW,eAAe,IAAO,GAAA,EAAA,CAAA;AAClE,UACE,IAAA,OAAO,cAAe,CAAA,OAAA,KAAY,QAClC,IAAA,CAAC,QAAU,EAAA,cAAA,EAAgB,OAAO,CAAA,CAAE,QAAS,CAAA,IAAI,CACjD,EAAA;AACA,YAAO,OAAA,cAAA,CAAA;AAAA,WACT;AAEA,UAAM,MAAA,IAAI,MAAM,6BAA6B,CAAA,CAAA;AAAA,SAC/C,CAAA;AACA,QAAW,UAAA,CAAA,IAAA;AAAA,UACT,YAAY,SAAU,CAAA;AAAA,YACpB,eAAA;AAAA,YACA,GAAI,OAAO,OAAA,CAAQ,OAAO,SAAY,GAAA,KAAK,OAAQ,CAAA,EAAA;AAAA,YACnD,GAAA,EAAK,KAAK,OAAQ,CAAA,GAAA;AAAA,YAClB,GAAA,EAAK,KAAK,OAAQ,CAAA,iBAAA;AAAA,WACnB,CAAA;AAAA,SACH,CAAA;AAAA,OACF;AAEA,MAAO,OAAA,UAAA,CAAA;AAAA,KACT;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"LiveblocksExtension.mjs","sources":["../src/LiveblocksExtension.ts"],"sourcesContent":["import type {\n BaseUserMeta,\n IUserInfo,\n JsonObject,\n User,\n} from \"@liveblocks/core\";\nimport { kInternal, TextEditorType } from \"@liveblocks/core\";\nimport { useClient, useRoom } from \"@liveblocks/react\";\nimport {\n getUmbrellaStoreForClient,\n useCreateTextMention,\n useDeleteTextMention,\n useReportTextEditor,\n useYjsProvider,\n} from \"@liveblocks/react/_private\";\nimport { LiveblocksYjsProvider } from \"@liveblocks/yjs\";\nimport type { AnyExtension, Editor } from \"@tiptap/core\";\nimport { Extension, getMarkType, Mark } from \"@tiptap/core\";\nimport Collaboration from \"@tiptap/extension-collaboration\";\nimport CollaborationCursor from \"@tiptap/extension-collaboration-cursor\";\nimport type { Mark as PMMark } from \"@tiptap/pm/model\";\nimport { useCallback, useEffect, useState, useSyncExternalStore } from \"react\";\nimport { Doc, PermanentUserData } from \"yjs\";\n\nimport { AiExtension } from \"./ai/AiExtension\";\nimport { CommentsExtension } from \"./comments/CommentsExtension\";\nimport { MentionExtension } from \"./mentions/MentionExtension\";\nimport type {\n AiResponse,\n LiveblocksExtensionOptions,\n LiveblocksExtensionStorage,\n ResolveAiPromptArgs,\n} from \"./types\";\nimport { LIVEBLOCKS_COMMENT_MARK_TYPE } from \"./types\";\n\nconst providersMap = new Map<\n string,\n LiveblocksYjsProvider<any, any, any, any, any>\n>();\n\nconst docMap = new Map<string, Doc>();\n\ntype WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };\n\nconst pudMap = new Map<string, PermanentUserData>();\n\nconst DEFAULT_OPTIONS: WithRequired<LiveblocksExtensionOptions, \"field\"> = {\n field: \"default\",\n comments: true,\n mentions: true,\n offlineSupport_experimental: false,\n};\n\nconst LiveblocksCollab = Collaboration.extend({\n // Override the onCreate method to warn users about potential misconfigurations\n onCreate() {\n if (\n !this.editor.extensionManager.extensions.find((e) => e.name === \"doc\")\n ) {\n console.warn(\n \"[Liveblocks] The tiptap document extension is required for Liveblocks collaboration. Please add it or use Tiptap StarterKit extension.\"\n );\n }\n if (\n !this.editor.extensionManager.extensions.find(\n (e) => e.name === \"paragraph\"\n )\n ) {\n console.warn(\n \"[Liveblocks] The tiptap paragraph extension is required for Liveblocks collaboration. Please add it or use Tiptap StarterKit extension.\"\n );\n }\n\n if (\n !this.editor.extensionManager.extensions.find((e) => e.name === \"text\")\n ) {\n console.warn(\n \"[Liveblocks] The tiptap text extension is required for Liveblocks collaboration. Please add it or use Tiptap StarterKit extension.\"\n );\n }\n if (\n this.editor.extensionManager.extensions.find((e) => e.name === \"history\")\n ) {\n console.warn(\n \"[Liveblocks] The history extension is enabled, Liveblocks extension provides its own. Please remove or disable the History plugin to prevent unwanted conflicts.\"\n );\n }\n },\n});\n\n/**\n * Returns whether the editor has loaded the initial text contents from the\n * server and is ready to be used.\n *\n */\nexport function useIsEditorReady(): boolean {\n const yjsProvider = useYjsProvider();\n\n const getSnapshot = useCallback(() => {\n const status = yjsProvider?.getStatus();\n return status === \"synchronizing\" || status === \"synchronized\";\n }, [yjsProvider]);\n\n const subscribe = useCallback(\n (callback: () => void) => {\n if (yjsProvider === undefined) return () => {};\n yjsProvider.on(\"status\", callback);\n return () => {\n yjsProvider.off(\"status\", callback);\n };\n },\n [yjsProvider]\n );\n\n return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n}\n\nconst YChangeMark = Mark.create({\n name: \"ychange\",\n inclusive: false,\n parseHTML() {\n return [{ tag: \"ychange\" }];\n },\n addAttributes() {\n return {\n user: {\n default: null,\n parseHTML: (element) => element.getAttribute(\"ychange_user\") ?? null,\n renderHTML: (attributes: { user: string | null }) => {\n if (!attributes.user) {\n return {};\n }\n return { \"data-ychange-user\": attributes.user };\n },\n },\n type: {\n default: null,\n parseHTML: (element) => element.getAttribute(\"ychange_type\") ?? null,\n renderHTML: (attributes: { type: string | null }) => {\n if (!attributes.type) {\n return {};\n }\n return {\n \"data-ychange-type\": attributes.type,\n class: `lb-root lb-tiptap-change-${attributes.type}`,\n };\n },\n },\n color: {\n default: null,\n parseHTML: (element) => {\n return element.getAttribute(\"ychange_color\") ?? null;\n },\n renderHTML: () => {\n // attributes: { color: { light: string; dark: string } | null }\n return {}; // we don't need this color attribute for now\n },\n },\n };\n },\n renderHTML({ HTMLAttributes }) {\n return [\"ychange\", HTMLAttributes, 0];\n },\n});\n\nexport const useLiveblocksExtension = (\n opts?: LiveblocksExtensionOptions\n): Extension => {\n const options = {\n ...DEFAULT_OPTIONS,\n ...opts,\n };\n const [editor, setEditor] = useState<Editor | null>(null);\n const room = useRoom();\n\n // TODO: we don't need these things if comments isn't turned on...\n // TODO: we don't have a reference to the editor here, need to figure this out\n // useErrorListener((error) => {\n // // If thread creation fails, we remove the thread id from the associated nodes and unwrap the nodes if they are no longer associated with any threads\n // if (\n // error.context.type === \"CREATE_THREAD_ERROR\" &&\n // error.context.roomId === room.id\n // ) {\n // handleThreadDelete(error.context.threadId);\n // }\n // });\n\n const isEditorReady = useIsEditorReady();\n const client = useClient();\n const store = getUmbrellaStoreForClient(client);\n const roomId = room.id;\n const yjsProvider = useYjsProvider();\n\n // If the user provided initialContent, wait for ready and then set it\n useEffect(() => {\n if (!isEditorReady || !yjsProvider || !options.initialContent || !editor)\n return;\n\n // As noted in the tiptap documentation, you may not set initial content with collaboration.\n // The docs provide the following workaround:\n const ydoc = (yjsProvider as LiveblocksYjsProvider).getYDoc();\n const hasContentSet = ydoc.getMap(\"liveblocks_config\").get(\"hasContentSet\");\n if (!hasContentSet) {\n ydoc.getMap(\"liveblocks_config\").set(\"hasContentSet\", true);\n editor.commands.setContent(options.initialContent);\n }\n }, [isEditorReady, yjsProvider, options.initialContent, editor]);\n\n useReportTextEditor(\n TextEditorType.TipTap,\n options.field ?? DEFAULT_OPTIONS.field\n );\n\n const createTextMention = useCreateTextMention();\n const deleteTextMention = useDeleteTextMention();\n\n return Extension.create<never, LiveblocksExtensionStorage>({\n name: \"liveblocksExtension\",\n\n onCreate() {\n setEditor(this.editor);\n if (this.editor.options.content) {\n console.warn(\n \"[Liveblocks] Initial content must be set in the useLiveblocksExtension hook option. Remove content from your editor options.\"\n );\n }\n if (\n options.mentions &&\n this.editor.extensionManager.extensions.find(\n (e) => e.name.toLowerCase() === \"mention\"\n )\n ) {\n console.warn(\n \"[Liveblocks] Liveblocks own mention plugin is enabled, using another mention plugin may cause a conflict.\"\n );\n }\n const self = room.getSelf();\n const updateUser = ({\n info,\n id: userId,\n }: User<JsonObject, BaseUserMeta>) => {\n if (!info) {\n return;\n }\n const { user: storedUser } =\n this.storage.provider.awareness.getLocalState() as {\n user: IUserInfo;\n };\n this.storage.permanentUserData?.setUserMapping(\n this.storage.doc,\n this.storage.doc.clientID,\n userId ?? \"Unknown\" // TODO: change this to the user's ID so we can map it to the user's name\n );\n if (\n info.name !== storedUser?.name ||\n info.color !== storedUser?.color\n ) {\n this.editor.commands.updateUser({\n name: info.name,\n color: info.color,\n });\n }\n };\n // if we already have user info, we update the user\n if (self?.info) {\n updateUser(self);\n }\n // we also listen in case the user info changes\n this.storage.unsubs.push(room.events.self.subscribe(updateUser));\n if (options.comments) {\n const commentMarkType = getMarkType(\n LIVEBLOCKS_COMMENT_MARK_TYPE,\n this.editor.schema\n );\n this.storage.unsubs.push(\n // Subscribe to threads so we can update comment marks if they become resolved/deleted\n store.outputs.threads.subscribe(() => {\n const threadMap = new Map(\n store.outputs.threads\n .get()\n .findMany(roomId, { resolved: false }, \"asc\")\n .map((thread) => [thread.id, true])\n );\n function isComment(mark: PMMark): mark is PMMark & {\n attrs: { orphan: boolean; threadId: string };\n } {\n return mark.type.name === LIVEBLOCKS_COMMENT_MARK_TYPE;\n }\n // when threads change, find marks and update them if needed\n this.editor.state.doc.descendants((node, pos) => {\n node.marks.forEach((mark) => {\n if (isComment(mark)) {\n const markThreadId = mark.attrs.threadId;\n const isOrphan = !threadMap.has(markThreadId);\n if (isOrphan !== mark.attrs.orphan) {\n const { tr } = this.editor.state;\n const trimmedFrom = Math.max(pos, 0);\n const trimmedTo = Math.min(\n pos + node.nodeSize,\n this.editor.state.doc.content.size - 1\n );\n tr.removeMark(trimmedFrom, trimmedTo, commentMarkType);\n tr.addMark(\n trimmedFrom,\n trimmedTo,\n commentMarkType.create({\n ...mark.attrs,\n orphan: isOrphan,\n })\n );\n this.editor.view.dispatch(tr);\n }\n }\n });\n });\n })\n );\n }\n },\n onDestroy() {\n this.storage.unsubs.forEach((unsub) => unsub());\n },\n addGlobalAttributes() {\n return [\n {\n types: [\"paragraph\", \"heading\"],\n attributes: {\n ychange: { default: null },\n },\n },\n ];\n },\n addStorage() {\n if (!providersMap.has(room.id)) {\n const doc = new Doc();\n docMap.set(room.id, doc);\n pudMap.set(room.id, new PermanentUserData(doc));\n providersMap.set(\n room.id,\n new LiveblocksYjsProvider(room, doc, {\n offlineSupport_experimental: options.offlineSupport_experimental,\n })\n );\n }\n return {\n doc: docMap.get(room.id)!,\n provider: providersMap.get(room.id)!,\n permanentUserData: pudMap.get(room.id)!,\n unsubs: [],\n };\n },\n addExtensions() {\n const extensions: AnyExtension[] = [\n YChangeMark,\n LiveblocksCollab.configure({\n ySyncOptions: {\n permanentUserData: this.storage.permanentUserData,\n },\n document: this.storage.doc,\n field: options.field,\n }),\n CollaborationCursor.configure({\n provider: this.storage.provider,\n }),\n ];\n\n if (options.comments) {\n extensions.push(CommentsExtension);\n }\n if (options.mentions) {\n extensions.push(\n MentionExtension.configure({\n onCreateMention: createTextMention,\n onDeleteMention: deleteTextMention,\n })\n );\n }\n if (options.ai) {\n const resolveAiPrompt = async ({\n prompt,\n selectionText,\n context,\n signal,\n }: ResolveAiPromptArgs): Promise<AiResponse> => {\n const result = await room[kInternal].executeContextualPrompt({\n prompt,\n selectionText,\n context,\n signal,\n });\n\n const parsedResponse = JSON.parse(result) as JsonObject;\n const type =\n typeof parsedResponse.type === \"string\" ? parsedResponse.type : \"\";\n if (\n typeof parsedResponse.content === \"string\" &&\n [\"insert\", \"modification\", \"other\"].includes(type)\n ) {\n return parsedResponse as AiResponse;\n }\n\n throw new Error(\"Failed to resolve AI prompt\");\n };\n extensions.push(\n AiExtension.configure({\n resolveAiPrompt,\n ...(typeof options.ai === \"boolean\" ? {} : options.ai),\n doc: this.storage.doc,\n pud: this.storage.permanentUserData,\n })\n );\n }\n\n return extensions;\n },\n });\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAmCA,MAAM,YAAA,uBAAmB,GAGvB,EA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,WACnB,CAAA;AAAA,SACH,CAAA;AAAA,OACF;AAEA,MAAO,OAAA,UAAA,CAAA;AAAA,KACT;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
package/dist/version.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const PKG_NAME = "@liveblocks/react-tiptap";
4
- const PKG_VERSION = typeof "2.16.1-ai1" === "string" && "2.16.1-ai1";
4
+ const PKG_VERSION = typeof "2.16.1-ai2" === "string" && "2.16.1-ai2";
5
5
  const PKG_FORMAT = typeof "cjs" === "string" && "cjs";
6
6
 
7
7
  exports.PKG_FORMAT = PKG_FORMAT;
package/dist/version.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  const PKG_NAME = "@liveblocks/react-tiptap";
2
- const PKG_VERSION = typeof "2.16.1-ai1" === "string" && "2.16.1-ai1";
2
+ const PKG_VERSION = typeof "2.16.1-ai2" === "string" && "2.16.1-ai2";
3
3
  const PKG_FORMAT = typeof "esm" === "string" && "esm";
4
4
 
5
5
  export { PKG_FORMAT, PKG_NAME, PKG_VERSION };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liveblocks/react-tiptap",
3
- "version": "2.16.1-ai1",
3
+ "version": "2.16.1-ai2",
4
4
  "description": "A tiptap react plugin to enable collaboration, comments, live cursors, and more.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "commonjs",
@@ -42,11 +42,11 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@floating-ui/react-dom": "^2.1.2",
45
- "@liveblocks/client": "2.16.1-ai1",
46
- "@liveblocks/core": "2.16.1-ai1",
47
- "@liveblocks/react": "2.16.1-ai1",
48
- "@liveblocks/react-ui": "2.16.1-ai1",
49
- "@liveblocks/yjs": "2.16.1-ai1",
45
+ "@liveblocks/client": "2.16.1-ai2",
46
+ "@liveblocks/core": "2.16.1-ai2",
47
+ "@liveblocks/react": "2.16.1-ai2",
48
+ "@liveblocks/react-ui": "2.16.1-ai2",
49
+ "@liveblocks/yjs": "2.16.1-ai2",
50
50
  "@radix-ui/react-select": "^2.1.2",
51
51
  "@radix-ui/react-toggle": "^1.1.0",
52
52
  "@tiptap/core": "^2.7.2",
@@ -542,6 +542,25 @@
542
542
  margin-block-start: 8px;
543
543
  }
544
544
 
545
+ /*************************************
546
+ * Diff Changes *
547
+ *************************************/
548
+
549
+ .lb-tiptap-change-removed {
550
+ color: color-mix(in srgb, currentcolor 40%, transparent);
551
+ text-decoration: line-through;
552
+ text-decoration-thickness: 1px;
553
+ }
554
+
555
+ .lb-tiptap-change-added {
556
+ background: color-mix(
557
+ in srgb,
558
+ var(--lb-accent) calc(var(--lb-accent-contrast) * 1.5),
559
+ transparent
560
+ );
561
+ color: var(--lb-accent);
562
+ }
563
+
545
564
  /*************************************
546
565
  * Collab Cursors *
547
566
  *************************************/
@@ -600,19 +619,3 @@
600
619
  transform: translateY(-50%);
601
620
  }
602
621
  }
603
-
604
- /*************************************
605
- * Ai Changes *
606
- *************************************/
607
-
608
- .lb-changed-removed {
609
- color: rgb(255 255 255 / 13%);
610
- text-decoration: line-through;
611
- text-decoration-thickness: 1px;
612
- }
613
-
614
- .lb-changed-added {
615
- border-block-end: 2px solid rgb(35 131 226 / 15%);
616
- background: rgb(35 131 226 / 5.4%);
617
- color: rgb(79 167 255);
618
- }
package/styles.css CHANGED
@@ -1 +1 @@
1
- .lb-tiptap-suggestions-list{margin:0;padding:0;list-style:none}.lb-tiptap-mention-suggestions{--lb-tiptap-mention-suggestion-avatar-size:1.25rem}.lb-tiptap-mention-suggestion{padding:calc(.375*var(--lb-spacing))calc(.625*var(--lb-spacing))}.lb-tiptap-mention-suggestion-avatar{inline-size:var(--lb-tiptap-mention-suggestion-avatar-size);margin-inline-start:calc(-.125*var(--lb-spacing));margin-inline-end:calc(.5*var(--lb-spacing));margin-block:calc(.125*var(--lb-spacing));background:var(--lb-foreground-subtle);color:var(--lb-foreground-moderate)}.lb-tiptap-suggestions{animation-duration:var(--lb-transition-duration);animation-timing-function:var(--lb-transition-easing);will-change:transform,opacity;padding:4px}.lb-tiptap-suggestions-list-item{padding:calc(.25*var(--lb-spacing))calc(.5*var(--lb-spacing));border-radius:calc(var(--lb-radius) - .75*4px);color:var(--lb-foreground-secondary);cursor:pointer;-webkit-user-select:none;user-select:none;outline:none;align-items:center;scroll-margin-block:4px;font-size:.875rem;transition-property:background,color,opacity;display:flex}.lb-tiptap-suggestions-list-item:where([data-highlighted]:not([data-highlighted=false]),[data-selected]:not([data-selected=false])){background:var(--lb-foreground-subtle);transition-duration:calc(var(--lb-transition-duration)/2)}.lb-tiptap-suggestions-list-item:where(:disabled,[data-disabled]:not([data-disabled=false])){opacity:.5;cursor:not-allowed}.lb-tiptap-suggestions:where([data-side=top]){animation-name:lb-animation-slide-up}.lb-tiptap-suggestions:where([data-side=bottom]){animation-name:lb-animation-slide-down}.lb-tiptap-suggestions:where([data-state=closed]){animation-name:lb-animation-disappear}.lb-tiptap-mention{border-radius:calc(.675*var(--lb-radius));background:var(--lb-accent-subtle);color:var(--lb-accent);-webkit-box-decoration-break:clone;box-decoration-break:clone;padding:.1em .3em;font-weight:500}.lb-tiptap-mention::selection{background:0 0}.lb-tiptap-mention ::selection{background:0 0}.lb-mention-selected{background:var(--lb-accent);color:var(--lb-accent-foreground)}:where(.lb-tiptap-thread-mark:not([data-orphan=true])){background:var(--lb-accent-subtle);color:var(--lb-foreground);text-decoration-line:underline;-webkit-text-decoration-color:var(--lb-foreground-moderate);text-decoration-color:var(--lb-foreground-moderate);text-underline-offset:2px;outline:none;font-weight:500;transition-property:color,text-decoration-color}:where(.lb-tiptap-thread-mark:not([data-orphan=true]) .lb-tiptap-thread-mark-selected){color:var(--lb-accent);text-decoration-line:underline;-webkit-text-decoration-color:var(--lb-accent-moderate);text-decoration-color:var(--lb-accent-moderate);text-underline-offset:2px}.lb-tiptap-anchored-threads{--lb-tiptap-anchored-threads-gap:1.25rem;--lb-tiptap-anchored-threads-active-thread-offset:-.75rem}.lb-tiptap-anchored-threads-thread-container{transition-duration:calc(var(--lb-transition-duration)*2);transition-property:transform}.lb-tiptap-anchored-threads-thread{border-radius:var(--lb-radius);background:var(--lb-dynamic-background);transition-property:background,box-shadow;position:relative;overflow:hidden;box-shadow:0 0 0 1px #0000000a,0 2px 6px #0000000a,0 6px 20px #0000000f}.lb-tiptap-anchored-threads-thread:after{content:"";z-index:1;border-radius:inherit;box-shadow:var(--lb-inset-shadow);pointer-events:none;position:absolute;inset:0}.lb-tiptap-anchored-threads-thread:where([data-state=active]){box-shadow:0 0 0 1px #0000000a,0 2px 6px #00000014,0 8px 26px #0000001f}.lb-tiptap-floating{--lb-tiptap-floating-size:350px}.lb-tiptap-floating-threads-thread{inline-size:var(--lb-tiptap-floating-size)}.lb-tiptap-floating-threads-thread:where(:not(:last-of-type)){border-block-end:1px solid var(--lb-foreground-subtle)}.lb-tiptap-floating-composer{inline-size:var(--lb-tiptap-floating-size)}.lb-tiptap-active-selection{background:var(--lb-selection,#00f3);pointer-events:none}.lb-tiptap-toolbar{--lb-tiptap-toolbar-spacing:calc(.25*var(--lb-spacing));gap:var(--lb-tiptap-toolbar-spacing);padding:var(--lb-tiptap-toolbar-spacing);background:var(--lb-background);-ms-overflow-style:none;scrollbar-width:none;flex-direction:row;align-items:center;display:flex;position:relative;overflow-x:auto}.lb-tiptap-toolbar::-webkit-scrollbar{display:none}.lb-tiptap-toolbar>*{flex:none}.lb-tiptap-floating-toolbar{--lb-tiptap-toolbar-spacing:4px}.lb-tiptap-toolbar-separator{pointer-events:none;align-self:stretch;inline-size:1px;margin-inline:1px;position:relative}.lb-tiptap-toolbar-separator:before{content:"";background:var(--lb-foreground-subtle);position:absolute;inset:10% 0}.lb-tiptap-ai-selection{background:var(--lb-selection,#00f3);pointer-events:none}.lb-tiptap-ai-toolbar-portal{inline-size:var(--lb-tiptap-editor-width);outline:none}.lb-tiptap-ai-toolbar-container{--lb-tiptap-ai-toolbar-padding:calc(.5*var(--lb-spacing));--lb-tiptap-ai-toolbar-height:calc(calc(2*.25*var(--lb-spacing) + var(--lb-icon-size)) + 2*var(--lb-tiptap-ai-toolbar-padding));min-block-size:var(--lb-tiptap-ai-toolbar-height);position:relative}.lb-tiptap-ai-toolbar{color:var(--lb-foreground);flex-direction:column;display:flex}.lb-tiptap-ai-toolbar-output-container{border-block-end:1px solid var(--lb-foreground-subtle);flex-direction:column;display:flex}.lb-tiptap-ai-toolbar-output:before{content:"";vertical-align:middle;-webkit-user-select:none;user-select:none;display:inline-block}.lb-tiptap-ai-toolbar-output :where(.collaboration-cursor__label){align-items:center;gap:.1875em;display:flex}.lb-tiptap-ai-toolbar-output :where(.collaboration-cursor__label) :where(.lb-icon-container){margin-inline-start:-.125em}.lb-tiptap-ai-toolbar-output :where(.collaboration-cursor__label) :where(.lb-icon-container),.lb-tiptap-ai-toolbar-output :where(.collaboration-cursor__label) :where(.lb-icon-container) svg{block-size:1em;inline-size:1em}.lb-tiptap-ai-toolbar-content{outline:none;grid-template-columns:auto 1fr auto;inline-size:100%;min-inline-size:0;display:grid}.lb-tiptap-ai-toolbar-output-container,.lb-tiptap-ai-toolbar-content{max-block-size:calc(6lh + 2*var(--lb-tiptap-ai-toolbar-padding));padding:var(--lb-tiptap-ai-toolbar-padding);overflow-y:auto}.lb-tiptap-ai-toolbar-custom-prompt-container{z-index:auto;margin-block:calc(-1*var(--lb-tiptap-ai-toolbar-padding));line-height:calc(2*.25*var(--lb-spacing) + var(--lb-icon-size));display:grid;position:relative}.lb-tiptap-ai-toolbar-custom-prompt-container:before{content:attr(data-value)" ";visibility:hidden}.lb-tiptap-ai-toolbar-icon-container,.lb-tiptap-ai-toolbar-actions{block-size:calc(2*.25*var(--lb-spacing) + var(--lb-icon-size));flex:none;display:flex}.lb-tiptap-ai-toolbar-icon-container{color:var(--lb-foreground-moderate);align-self:start;align-items:center;position:sticky;inset-block-start:0}.lb-tiptap-ai-toolbar-actions{gap:var(--lb-tiptap-ai-toolbar-padding);align-self:end;position:sticky;inset-block-end:0}.lb-tiptap-ai-toolbar-custom-prompt{all:unset;color:var(--lb-foreground);resize:none;background:0 0;outline:none}.lb-tiptap-ai-toolbar-custom-prompt::placeholder{color:var(--lb-foreground-moderate)}.lb-tiptap-ai-toolbar-custom-prompt,.lb-tiptap-ai-toolbar-custom-prompt-container:before{box-sizing:inherit;padding:var(--lb-tiptap-ai-toolbar-padding);font:inherit;letter-spacing:inherit;white-space:pre-wrap;grid-area:1/1/2/2;inline-size:100%;min-inline-size:0}.lb-tiptap-ai-toolbar-halo{--lb-tiptap-ai-toolbar-halo-blur:16px;--lb-tiptap-ai-toolbar-halo-outset:8px;inset:calc(-1*var(--lb-tiptap-ai-toolbar-halo-outset));z-index:-1;border-radius:calc(var(--lb-radius) + var(--lb-tiptap-ai-toolbar-halo-outset));filter:blur(var(--lb-tiptap-ai-toolbar-halo-blur));pointer-events:none;transition-property:opacity;transition-duration:1s;position:absolute;overflow:hidden}.lb-tiptap-ai-toolbar-halo:where(:not([data-active])){opacity:.5}:is(.lb-tiptap-ai-toolbar-halo-horizontal,.lb-tiptap-ai-toolbar-halo-vertical){position:absolute;inset:0}:is(.lb-tiptap-ai-toolbar-halo-horizontal,.lb-tiptap-ai-toolbar-halo-vertical):before,:is(.lb-tiptap-ai-toolbar-halo-horizontal,.lb-tiptap-ai-toolbar-halo-vertical):after{content:"";opacity:.25;animation-timing-function:cubic-bezier(.455,.03,.515,.955);animation-iteration-count:infinite;position:absolute;inset:0}.lb-tiptap-ai-toolbar-halo-horizontal:before{background:linear-gradient(30deg,transparent 20%,var(--lb-accent)50%,transparent 80%);background-position:0 0;background-size:50% 100%;block-size:100%;inline-size:200%;animation-name:lb-animation-ai-toolbar-halo-horizontal;animation-duration:8s;animation-direction:alternate}.lb-tiptap-ai-toolbar-halo-horizontal:after{background:linear-gradient(90deg,transparent 20%,var(--lb-accent)50%,transparent 80%);background-position:0 0;background-repeat:space;background-size:800px 100%;block-size:100%;inline-size:400%;animation-name:lb-animation-ai-toolbar-halo-horizontal;animation-duration:6s;animation-direction:alternate-reverse;animation-delay:-2s;inset-inline-start:-50%}.lb-tiptap-ai-toolbar-halo-vertical{opacity:0}.lb-tiptap-ai-toolbar-halo-vertical:before{background:linear-gradient(1deg,transparent 40%,var(--lb-accent)50%,transparent 60%);background-position:0 0;background-repeat:round;background-size:100% 600px;block-size:400%;inline-size:100%;animation-name:lb-animation-ai-toolbar-halo-vertical;animation-duration:4s;animation-direction:alternate-reverse;animation-delay:-2s;inset-block-start:-50%}.lb-tiptap-ai-toolbar-halo-vertical:after{background:linear-gradient(-2deg,transparent 40%,var(--lb-accent)50%,transparent 60%);background-position:0 0;background-repeat:round;background-size:100% 400px;block-size:400%;inline-size:100%;animation-name:lb-animation-ai-toolbar-halo-vertical;animation-duration:3s;animation-direction:alternate;animation-delay:-1s;inset-block-start:-50%}.lb-tiptap-ai-toolbar-thinking{padding-inline:var(--lb-tiptap-ai-toolbar-padding);color:var(--lb-foreground-moderate);cursor:wait;-webkit-user-select:none;user-select:none;flex:1 0 auto;align-items:center;min-inline-size:0;animation:8s linear infinite lb-animation-shimmer;display:flex}.lb-tiptap-ai-toolbar-dropdown{inline-size:min(250px,100%);margin-block-start:8px}.collaboration-cursor__caret{word-break:normal;pointer-events:none;border-inline:1px solid #0d0d0d;margin-inline:-1px;position:relative}.collaboration-cursor__label{border-radius:6px;color:#fff;white-space:nowrap;pointer-events:none;-webkit-user-select:none;user-select:none;border-end-start-radius:0;padding:2px 6px;font-size:14px;font-style:normal;font-weight:600;line-height:normal;position:absolute;inset-block-start:-1.4em;inset-inline-start:-1px}@keyframes lb-animation-ai-toolbar-halo-horizontal{0%{transform:translate(-50%)}to{transform:translate(0)}}@keyframes lb-animation-ai-toolbar-halo-vertical{0%{transform:translateY(0)}to{transform:translateY(-50%)}}.lb-changed-removed{color:#ffffff21;text-decoration:line-through;text-decoration-thickness:1px}.lb-changed-added{color:#4fa7ff;background:#2383e20e;border-block-end:2px solid #2383e226}@media (prefers-reduced-motion){.lb-tiptap-suggestions:where(:not([data-state=closed])){animation-name:lb-animation-appear}.lb-tiptap-anchored-threads-thread-container{transition-duration:0s}}
1
+ .lb-tiptap-suggestions-list{margin:0;padding:0;list-style:none}.lb-tiptap-mention-suggestions{--lb-tiptap-mention-suggestion-avatar-size:1.25rem}.lb-tiptap-mention-suggestion{padding:calc(.375*var(--lb-spacing))calc(.625*var(--lb-spacing))}.lb-tiptap-mention-suggestion-avatar{inline-size:var(--lb-tiptap-mention-suggestion-avatar-size);margin-inline-start:calc(-.125*var(--lb-spacing));margin-inline-end:calc(.5*var(--lb-spacing));margin-block:calc(.125*var(--lb-spacing));background:var(--lb-foreground-subtle);color:var(--lb-foreground-moderate)}.lb-tiptap-suggestions{animation-duration:var(--lb-transition-duration);animation-timing-function:var(--lb-transition-easing);will-change:transform,opacity;padding:4px}.lb-tiptap-suggestions-list-item{padding:calc(.25*var(--lb-spacing))calc(.5*var(--lb-spacing));border-radius:calc(var(--lb-radius) - .75*4px);color:var(--lb-foreground-secondary);cursor:pointer;-webkit-user-select:none;user-select:none;outline:none;align-items:center;scroll-margin-block:4px;font-size:.875rem;transition-property:background,color,opacity;display:flex}.lb-tiptap-suggestions-list-item:where([data-highlighted]:not([data-highlighted=false]),[data-selected]:not([data-selected=false])){background:var(--lb-foreground-subtle);transition-duration:calc(var(--lb-transition-duration)/2)}.lb-tiptap-suggestions-list-item:where(:disabled,[data-disabled]:not([data-disabled=false])){opacity:.5;cursor:not-allowed}.lb-tiptap-suggestions:where([data-side=top]){animation-name:lb-animation-slide-up}.lb-tiptap-suggestions:where([data-side=bottom]){animation-name:lb-animation-slide-down}.lb-tiptap-suggestions:where([data-state=closed]){animation-name:lb-animation-disappear}.lb-tiptap-mention{border-radius:calc(.675*var(--lb-radius));background:var(--lb-accent-subtle);color:var(--lb-accent);-webkit-box-decoration-break:clone;box-decoration-break:clone;padding:.1em .3em;font-weight:500}.lb-tiptap-mention::selection{background:0 0}.lb-tiptap-mention ::selection{background:0 0}.lb-mention-selected{background:var(--lb-accent);color:var(--lb-accent-foreground)}:where(.lb-tiptap-thread-mark:not([data-orphan=true])){background:var(--lb-accent-subtle);color:var(--lb-foreground);text-decoration-line:underline;-webkit-text-decoration-color:var(--lb-foreground-moderate);text-decoration-color:var(--lb-foreground-moderate);text-underline-offset:2px;outline:none;font-weight:500;transition-property:color,text-decoration-color}:where(.lb-tiptap-thread-mark:not([data-orphan=true]) .lb-tiptap-thread-mark-selected){color:var(--lb-accent);text-decoration-line:underline;-webkit-text-decoration-color:var(--lb-accent-moderate);text-decoration-color:var(--lb-accent-moderate);text-underline-offset:2px}.lb-tiptap-anchored-threads{--lb-tiptap-anchored-threads-gap:1.25rem;--lb-tiptap-anchored-threads-active-thread-offset:-.75rem}.lb-tiptap-anchored-threads-thread-container{transition-duration:calc(var(--lb-transition-duration)*2);transition-property:transform}.lb-tiptap-anchored-threads-thread{border-radius:var(--lb-radius);background:var(--lb-dynamic-background);transition-property:background,box-shadow;position:relative;overflow:hidden;box-shadow:0 0 0 1px #0000000a,0 2px 6px #0000000a,0 6px 20px #0000000f}.lb-tiptap-anchored-threads-thread:after{content:"";z-index:1;border-radius:inherit;box-shadow:var(--lb-inset-shadow);pointer-events:none;position:absolute;inset:0}.lb-tiptap-anchored-threads-thread:where([data-state=active]){box-shadow:0 0 0 1px #0000000a,0 2px 6px #00000014,0 8px 26px #0000001f}.lb-tiptap-floating{--lb-tiptap-floating-size:350px}.lb-tiptap-floating-threads-thread{inline-size:var(--lb-tiptap-floating-size)}.lb-tiptap-floating-threads-thread:where(:not(:last-of-type)){border-block-end:1px solid var(--lb-foreground-subtle)}.lb-tiptap-floating-composer{inline-size:var(--lb-tiptap-floating-size)}.lb-tiptap-active-selection{background:var(--lb-selection,#00f3);pointer-events:none}.lb-tiptap-toolbar{--lb-tiptap-toolbar-spacing:calc(.25*var(--lb-spacing));gap:var(--lb-tiptap-toolbar-spacing);padding:var(--lb-tiptap-toolbar-spacing);background:var(--lb-background);-ms-overflow-style:none;scrollbar-width:none;flex-direction:row;align-items:center;display:flex;position:relative;overflow-x:auto}.lb-tiptap-toolbar::-webkit-scrollbar{display:none}.lb-tiptap-toolbar>*{flex:none}.lb-tiptap-floating-toolbar{--lb-tiptap-toolbar-spacing:4px}.lb-tiptap-toolbar-separator{pointer-events:none;align-self:stretch;inline-size:1px;margin-inline:1px;position:relative}.lb-tiptap-toolbar-separator:before{content:"";background:var(--lb-foreground-subtle);position:absolute;inset:10% 0}.lb-tiptap-ai-selection{background:var(--lb-selection,#00f3);pointer-events:none}.lb-tiptap-ai-toolbar-portal{inline-size:var(--lb-tiptap-editor-width);outline:none}.lb-tiptap-ai-toolbar-container{--lb-tiptap-ai-toolbar-padding:calc(.5*var(--lb-spacing));--lb-tiptap-ai-toolbar-height:calc(calc(2*.25*var(--lb-spacing) + var(--lb-icon-size)) + 2*var(--lb-tiptap-ai-toolbar-padding));min-block-size:var(--lb-tiptap-ai-toolbar-height);position:relative}.lb-tiptap-ai-toolbar{color:var(--lb-foreground);flex-direction:column;display:flex}.lb-tiptap-ai-toolbar-output-container{border-block-end:1px solid var(--lb-foreground-subtle);flex-direction:column;display:flex}.lb-tiptap-ai-toolbar-output:before{content:"";vertical-align:middle;-webkit-user-select:none;user-select:none;display:inline-block}.lb-tiptap-ai-toolbar-output :where(.collaboration-cursor__label){align-items:center;gap:.1875em;display:flex}.lb-tiptap-ai-toolbar-output :where(.collaboration-cursor__label) :where(.lb-icon-container){margin-inline-start:-.125em}.lb-tiptap-ai-toolbar-output :where(.collaboration-cursor__label) :where(.lb-icon-container),.lb-tiptap-ai-toolbar-output :where(.collaboration-cursor__label) :where(.lb-icon-container) svg{block-size:1em;inline-size:1em}.lb-tiptap-ai-toolbar-content{outline:none;grid-template-columns:auto 1fr auto;inline-size:100%;min-inline-size:0;display:grid}.lb-tiptap-ai-toolbar-output-container,.lb-tiptap-ai-toolbar-content{max-block-size:calc(6lh + 2*var(--lb-tiptap-ai-toolbar-padding));padding:var(--lb-tiptap-ai-toolbar-padding);overflow-y:auto}.lb-tiptap-ai-toolbar-custom-prompt-container{z-index:auto;margin-block:calc(-1*var(--lb-tiptap-ai-toolbar-padding));line-height:calc(2*.25*var(--lb-spacing) + var(--lb-icon-size));display:grid;position:relative}.lb-tiptap-ai-toolbar-custom-prompt-container:before{content:attr(data-value)" ";visibility:hidden}.lb-tiptap-ai-toolbar-icon-container,.lb-tiptap-ai-toolbar-actions{block-size:calc(2*.25*var(--lb-spacing) + var(--lb-icon-size));flex:none;display:flex}.lb-tiptap-ai-toolbar-icon-container{color:var(--lb-foreground-moderate);align-self:start;align-items:center;position:sticky;inset-block-start:0}.lb-tiptap-ai-toolbar-actions{gap:var(--lb-tiptap-ai-toolbar-padding);align-self:end;position:sticky;inset-block-end:0}.lb-tiptap-ai-toolbar-custom-prompt{all:unset;color:var(--lb-foreground);resize:none;background:0 0;outline:none}.lb-tiptap-ai-toolbar-custom-prompt::placeholder{color:var(--lb-foreground-moderate)}.lb-tiptap-ai-toolbar-custom-prompt,.lb-tiptap-ai-toolbar-custom-prompt-container:before{box-sizing:inherit;padding:var(--lb-tiptap-ai-toolbar-padding);font:inherit;letter-spacing:inherit;white-space:pre-wrap;grid-area:1/1/2/2;inline-size:100%;min-inline-size:0}.lb-tiptap-ai-toolbar-halo{--lb-tiptap-ai-toolbar-halo-blur:16px;--lb-tiptap-ai-toolbar-halo-outset:8px;inset:calc(-1*var(--lb-tiptap-ai-toolbar-halo-outset));z-index:-1;border-radius:calc(var(--lb-radius) + var(--lb-tiptap-ai-toolbar-halo-outset));filter:blur(var(--lb-tiptap-ai-toolbar-halo-blur));pointer-events:none;transition-property:opacity;transition-duration:1s;position:absolute;overflow:hidden}.lb-tiptap-ai-toolbar-halo:where(:not([data-active])){opacity:.5}:is(.lb-tiptap-ai-toolbar-halo-horizontal,.lb-tiptap-ai-toolbar-halo-vertical){position:absolute;inset:0}:is(.lb-tiptap-ai-toolbar-halo-horizontal,.lb-tiptap-ai-toolbar-halo-vertical):before,:is(.lb-tiptap-ai-toolbar-halo-horizontal,.lb-tiptap-ai-toolbar-halo-vertical):after{content:"";opacity:.25;animation-timing-function:cubic-bezier(.455,.03,.515,.955);animation-iteration-count:infinite;position:absolute;inset:0}.lb-tiptap-ai-toolbar-halo-horizontal:before{background:linear-gradient(30deg,transparent 20%,var(--lb-accent)50%,transparent 80%);background-position:0 0;background-size:50% 100%;block-size:100%;inline-size:200%;animation-name:lb-animation-ai-toolbar-halo-horizontal;animation-duration:8s;animation-direction:alternate}.lb-tiptap-ai-toolbar-halo-horizontal:after{background:linear-gradient(90deg,transparent 20%,var(--lb-accent)50%,transparent 80%);background-position:0 0;background-repeat:space;background-size:800px 100%;block-size:100%;inline-size:400%;animation-name:lb-animation-ai-toolbar-halo-horizontal;animation-duration:6s;animation-direction:alternate-reverse;animation-delay:-2s;inset-inline-start:-50%}.lb-tiptap-ai-toolbar-halo-vertical{opacity:0}.lb-tiptap-ai-toolbar-halo-vertical:before{background:linear-gradient(1deg,transparent 40%,var(--lb-accent)50%,transparent 60%);background-position:0 0;background-repeat:round;background-size:100% 600px;block-size:400%;inline-size:100%;animation-name:lb-animation-ai-toolbar-halo-vertical;animation-duration:4s;animation-direction:alternate-reverse;animation-delay:-2s;inset-block-start:-50%}.lb-tiptap-ai-toolbar-halo-vertical:after{background:linear-gradient(-2deg,transparent 40%,var(--lb-accent)50%,transparent 60%);background-position:0 0;background-repeat:round;background-size:100% 400px;block-size:400%;inline-size:100%;animation-name:lb-animation-ai-toolbar-halo-vertical;animation-duration:3s;animation-direction:alternate;animation-delay:-1s;inset-block-start:-50%}.lb-tiptap-ai-toolbar-thinking{padding-inline:var(--lb-tiptap-ai-toolbar-padding);color:var(--lb-foreground-moderate);cursor:wait;-webkit-user-select:none;user-select:none;flex:1 0 auto;align-items:center;min-inline-size:0;animation:8s linear infinite lb-animation-shimmer;display:flex}.lb-tiptap-ai-toolbar-dropdown{inline-size:min(250px,100%);margin-block-start:8px}.lb-tiptap-change-removed{color:color-mix(in srgb,currentcolor 40%,transparent);text-decoration:line-through;text-decoration-thickness:1px}.lb-tiptap-change-added{background:color-mix(in srgb,var(--lb-accent)calc(var(--lb-accent-contrast)*1.5),transparent);color:var(--lb-accent)}.collaboration-cursor__caret{word-break:normal;pointer-events:none;border-inline:1px solid #0d0d0d;margin-inline:-1px;position:relative}.collaboration-cursor__label{border-radius:6px;color:#fff;white-space:nowrap;pointer-events:none;-webkit-user-select:none;user-select:none;border-end-start-radius:0;padding:2px 6px;font-size:14px;font-style:normal;font-weight:600;line-height:normal;position:absolute;inset-block-start:-1.4em;inset-inline-start:-1px}@keyframes lb-animation-ai-toolbar-halo-horizontal{0%{transform:translate(-50%)}to{transform:translate(0)}}@keyframes lb-animation-ai-toolbar-halo-vertical{0%{transform:translateY(0)}to{transform:translateY(-50%)}}@media (prefers-reduced-motion){.lb-tiptap-suggestions:where(:not([data-state=closed])){animation-name:lb-animation-appear}.lb-tiptap-anchored-threads-thread-container{transition-duration:0s}}
package/styles.css.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["src/styles/src/styles/index.css","src/styles/src/styles/utils.css"],"names":[],"mappings":"AAOA,4BAAA,QAAA,CAAA,SAAA,CAAA,eAAA,CAUA,+BAAA,kDAAA,CAIA,8BAAA,gEAAA,CAIA,qCAAA,2DAAA,CAAA,iDAAA,CAAA,4CAAA,CAAA,yCAAA,CAAA,sCAAA,CAAA,mCAAA,CAaA,uBAAA,gDAAA,CAAA,qDAAA,CAAA,6BAAA,CAAA,WAAA,CAOA,iCAAA,6DAAA,CAAA,8CAAA,CAAA,oCAAA,CAAA,cAAA,CAAA,wBAAA,CAAA,gBAAA,CAAA,YAAA,CAAA,kBAAA,CAAA,uBAAA,CAAA,iBAAA,CAAA,4CAAA,CAAA,YAAA,CAeE,oIAAA,sCAAA,CAAA,yDAAA,CAQA,6FAAA,UAAA,CAAA,kBAAA,CAWA,8CAAA,oCAAA,CAIA,iDAAA,sCAAA,CAIA,kDAAA,qCAAA,CAeF,mBA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Suggestions *\n *************************************/\n\n.lb-tiptap-suggestions-list {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n\n/*************************************\n * Mention suggestions *\n *************************************/\n\n.lb-tiptap-mention-suggestions {\n --lb-tiptap-mention-suggestion-avatar-size: 1.25rem;\n}\n\n.lb-tiptap-mention-suggestion {\n padding: calc(0.375 * var(--lb-spacing)) calc(0.625 * var(--lb-spacing));\n}\n\n.lb-tiptap-mention-suggestion-avatar {\n inline-size: var(--lb-tiptap-mention-suggestion-avatar-size);\n margin-inline-start: calc(-0.125 * var(--lb-spacing));\n margin-inline-end: calc(0.5 * var(--lb-spacing));\n margin-block: calc(0.125 * var(--lb-spacing));\n background: var(--lb-foreground-subtle);\n color: var(--lb-foreground-moderate);\n}\n\n/*************************************\n * Elevation lists *\n *************************************/\n\n.lb-tiptap-suggestions {\n padding: $lb-elevation-padding;\n animation-duration: var(--lb-transition-duration);\n animation-timing-function: var(--lb-transition-easing);\n will-change: transform, opacity;\n}\n\n.lb-tiptap-suggestions-list-item {\n display: flex;\n align-items: center;\n padding: calc(0.25 * var(--lb-spacing)) calc(0.5 * var(--lb-spacing));\n border-radius: calc(var(--lb-radius) - 0.75 * $lb-elevation-padding);\n color: var(--lb-foreground-secondary);\n outline: none;\n font-size: 0.875rem;\n cursor: pointer;\n user-select: none;\n transition-property: background, color, opacity;\n scroll-margin-block: $lb-elevation-padding;\n}\n\n:is(.lb-tiptap-suggestions-list-item) {\n &:where(\n [data-highlighted]:not([data-highlighted=\"false\"]),\n [data-selected]:not([data-selected=\"false\"])\n ) {\n background: var(--lb-foreground-subtle);\n transition-duration: calc(var(--lb-transition-duration) / 2);\n }\n\n &:where(:disabled, [data-disabled]:not([data-disabled=\"false\"])) {\n opacity: 0.5;\n cursor: not-allowed;\n }\n}\n\n/*************************************\n * Floating animations *\n *************************************/\n\n:is(.lb-tiptap-suggestions) {\n &:where([data-side=\"top\"]) {\n animation-name: lb-animation-slide-up;\n }\n\n &:where([data-side=\"bottom\"]) {\n animation-name: lb-animation-slide-down;\n }\n\n &:where([data-state=\"closed\"]) {\n animation-name: lb-animation-disappear;\n }\n}\n\n@media (prefers-reduced-motion) {\n .lb-tiptap-suggestions:where(:not([data-state=\"closed\"])) {\n animation-name: lb-animation-appear;\n }\n}\n\n/*************************************\n * Mention *\n *************************************/\n\n.lb-tiptap-mention {\n padding: 0.1em 0.3em;\n border-radius: calc(0.675 * var(--lb-radius));\n background: var(--lb-accent-subtle);\n color: var(--lb-accent);\n box-decoration-break: clone;\n font-weight: 500;\n\n @include invisible-selection;\n}\n\n.lb-mention-selected {\n background: var(--lb-accent);\n color: var(--lb-accent-foreground);\n}\n\n/*************************************\n * Thread mark *\n *************************************/\n\n:where(.lb-tiptap-thread-mark:not([data-orphan=\"true\"])) {\n background: var(--lb-accent-subtle);\n color: var(--lb-foreground);\n outline: none;\n font-weight: 500;\n transition-property: color, text-decoration-color;\n text-decoration-line: underline;\n text-decoration-color: var(--lb-foreground-moderate);\n text-underline-offset: 2px;\n}\n\n:where(\n .lb-tiptap-thread-mark:not([data-orphan=\"true\"])\n .lb-tiptap-thread-mark-selected\n) {\n color: var(--lb-accent);\n text-decoration-line: underline;\n text-decoration-color: var(--lb-accent-moderate);\n text-underline-offset: 2px;\n}\n\n/*************************************\n * Anchored threads *\n *************************************/\n\n.lb-tiptap-anchored-threads {\n --lb-tiptap-anchored-threads-gap: 1.25rem;\n --lb-tiptap-anchored-threads-active-thread-offset: -0.75rem;\n}\n\n.lb-tiptap-anchored-threads-thread-container {\n transition-duration: calc(var(--lb-transition-duration) * 2);\n transition-property: transform;\n}\n\n@media (prefers-reduced-motion) {\n .lb-tiptap-anchored-threads-thread-container {\n transition-duration: 0s;\n }\n}\n\n.lb-tiptap-anchored-threads-thread {\n position: relative;\n overflow: hidden;\n border-radius: var(--lb-radius);\n background: var(--lb-dynamic-background);\n box-shadow: $lb-tiptap-anchored-threads-shadow;\n transition-property: background, box-shadow;\n\n &::after {\n content: \"\";\n position: absolute;\n inset: 0;\n z-index: 1;\n border-radius: inherit;\n box-shadow: var(--lb-inset-shadow);\n pointer-events: none;\n }\n\n &:where([data-state=\"active\"]) {\n box-shadow: $lb-tiptap-anchored-threads-active-shadow;\n }\n}\n\n/*************************************\n * Floating components *\n *************************************/\n\n.lb-tiptap-floating {\n --lb-tiptap-floating-size: 350px;\n}\n\n/*************************************\n * Floating threads *\n *************************************/\n\n.lb-tiptap-floating-threads-thread {\n inline-size: var(--lb-tiptap-floating-size);\n\n &:where(:not(:last-of-type)) {\n border-block-end: 1px solid var(--lb-foreground-subtle);\n }\n}\n\n/*************************************\n * Floating composer *\n *************************************/\n\n.lb-tiptap-floating-composer {\n inline-size: var(--lb-tiptap-floating-size);\n}\n\n/*************************************\n * Active selection *\n *************************************/\n\n.lb-tiptap-active-selection {\n background: var(--lb-selection, rgb(0 0 255 / 20%));\n pointer-events: none;\n}\n\n/*************************************\n * Toolbar *\n *************************************/\n\n.lb-tiptap-toolbar {\n --lb-tiptap-toolbar-spacing: calc(0.25 * var(--lb-spacing));\n\n position: relative;\n display: flex;\n flex-direction: row;\n gap: var(--lb-tiptap-toolbar-spacing);\n align-items: center;\n padding: var(--lb-tiptap-toolbar-spacing);\n background: var(--lb-background);\n\n /* overflow-inline: auto; doesn't work as expected */\n /* stylelint-disable-next-line plugin/use-logical-properties-and-values */\n overflow-x: auto;\n\n @include invisible-scrollbar;\n\n > * {\n flex: none;\n }\n}\n\n.lb-tiptap-floating-toolbar {\n --lb-tiptap-toolbar-spacing: $lb-elevation-padding;\n}\n\n.lb-tiptap-toolbar-separator {\n position: relative;\n align-self: stretch;\n inline-size: 1px;\n margin-inline: 1px;\n pointer-events: none;\n\n &::before {\n content: \"\";\n position: absolute;\n inset: 10% 0;\n background: var(--lb-foreground-subtle);\n }\n}\n\n/*************************************\n * AI Toolbar *\n *************************************/\n\n.lb-tiptap-ai-selection {\n background: var(--lb-selection, rgb(0 0 255 / 20%));\n pointer-events: none;\n}\n\n.lb-tiptap-ai-toolbar-portal {\n inline-size: var(--lb-tiptap-editor-width);\n outline: none;\n}\n\n.lb-tiptap-ai-toolbar-container {\n --lb-tiptap-ai-toolbar-padding: calc(0.5 * var(--lb-spacing));\n --lb-tiptap-ai-toolbar-height: calc(\n $lb-button-size + 2 * var(--lb-tiptap-ai-toolbar-padding)\n );\n\n position: relative;\n min-block-size: var(--lb-tiptap-ai-toolbar-height);\n}\n\n.lb-tiptap-ai-toolbar {\n display: flex;\n flex-direction: column;\n color: var(--lb-foreground);\n}\n\n.lb-tiptap-ai-toolbar-output-container {\n display: flex;\n flex-direction: column;\n border-block-end: 1px solid var(--lb-foreground-subtle);\n}\n\n.lb-tiptap-ai-toolbar-output {\n &::before {\n content: \"\\FEFF\";\n display: inline-block;\n vertical-align: middle;\n user-select: none;\n }\n\n /* stylelint-disable-next-line selector-class-pattern */\n :where(.collaboration-cursor__label) {\n display: flex;\n gap: 0.1875em;\n align-items: center;\n\n :where(.lb-icon-container) {\n margin-inline-start: -0.125em;\n\n &,\n & svg {\n inline-size: 1em;\n block-size: 1em;\n }\n }\n }\n}\n\n.lb-tiptap-ai-toolbar-content {\n display: grid;\n grid-template-columns: auto 1fr auto;\n inline-size: 100%;\n min-inline-size: 0;\n outline: none;\n}\n\n.lb-tiptap-ai-toolbar-output-container,\n.lb-tiptap-ai-toolbar-content {\n max-block-size: calc(6lh + 2 * var(--lb-tiptap-ai-toolbar-padding));\n padding: var(--lb-tiptap-ai-toolbar-padding);\n\n /* overflow-block: auto; doesn't work as expected */\n /* stylelint-disable-next-line plugin/use-logical-properties-and-values */\n overflow-y: auto;\n}\n\n.lb-tiptap-ai-toolbar-custom-prompt-container {\n position: relative;\n z-index: auto;\n display: grid;\n margin-block: calc(-1 * var(--lb-tiptap-ai-toolbar-padding));\n line-height: $lb-button-size;\n\n &::before {\n /* The space is important when handling new lines */\n content: attr(data-value) \" \";\n visibility: hidden;\n }\n}\n\n.lb-tiptap-ai-toolbar-icon-container,\n.lb-tiptap-ai-toolbar-actions {\n display: flex;\n flex: none;\n block-size: $lb-button-size;\n}\n\n.lb-tiptap-ai-toolbar-icon-container {\n position: sticky;\n inset-block-start: 0;\n align-items: center;\n align-self: start;\n color: var(--lb-foreground-moderate);\n}\n\n.lb-tiptap-ai-toolbar-actions {\n position: sticky;\n inset-block-end: 0;\n gap: var(--lb-tiptap-ai-toolbar-padding);\n align-self: end;\n}\n\n.lb-tiptap-ai-toolbar-custom-prompt {\n all: unset;\n background: transparent;\n color: var(--lb-foreground);\n outline: none;\n resize: none;\n\n &::placeholder {\n color: var(--lb-foreground-moderate);\n }\n}\n\n.lb-tiptap-ai-toolbar-custom-prompt,\n.lb-tiptap-ai-toolbar-custom-prompt-container::before {\n /* Overlap the textarea and its value to auto-size it */\n grid-area: 1 / 1 / 2 / 2;\n box-sizing: inherit;\n inline-size: 100%;\n min-inline-size: 0;\n padding: var(--lb-tiptap-ai-toolbar-padding);\n font: inherit;\n letter-spacing: inherit;\n white-space: pre-wrap;\n}\n\n.lb-tiptap-ai-toolbar-halo {\n --lb-tiptap-ai-toolbar-halo-blur: 16px;\n --lb-tiptap-ai-toolbar-halo-outset: 8px;\n\n position: absolute;\n inset: calc(-1 * var(--lb-tiptap-ai-toolbar-halo-outset));\n z-index: -1;\n overflow: hidden;\n border-radius: calc(\n var(--lb-radius) + var(--lb-tiptap-ai-toolbar-halo-outset)\n );\n filter: blur(var(--lb-tiptap-ai-toolbar-halo-blur));\n pointer-events: none;\n transition-duration: 1s;\n transition-property: opacity;\n\n &:where(:not([data-active])) {\n opacity: 0.5;\n }\n}\n\n:is(\n .lb-tiptap-ai-toolbar-halo-horizontal,\n .lb-tiptap-ai-toolbar-halo-vertical\n) {\n position: absolute;\n inset: 0;\n\n &::before,\n &::after {\n content: \"\";\n position: absolute;\n inset: 0;\n opacity: 0.25;\n animation-timing-function: cubic-bezier(0.455, 0.03, 0.515, 0.955);\n animation-iteration-count: infinite;\n }\n}\n\n.lb-tiptap-ai-toolbar-halo-horizontal {\n &::before {\n inline-size: 200%;\n block-size: 100%;\n background: linear-gradient(\n 30deg,\n transparent 20%,\n var(--lb-accent) 50%,\n transparent 80%\n );\n background-position: top left;\n background-size: 50% 100%;\n animation-name: lb-animation-ai-toolbar-halo-horizontal;\n animation-duration: 8s;\n animation-direction: alternate;\n }\n\n &::after {\n inset-inline-start: -50%;\n inline-size: 400%;\n block-size: 100%;\n background: linear-gradient(\n 90deg,\n transparent 20%,\n var(--lb-accent) 50%,\n transparent 80%\n );\n background-position: top left;\n background-size: 800px 100%;\n background-repeat: space;\n animation-name: lb-animation-ai-toolbar-halo-horizontal;\n animation-duration: 6s;\n animation-delay: -2s;\n animation-direction: alternate-reverse;\n }\n}\n\n.lb-tiptap-ai-toolbar-halo-vertical {\n opacity: 0;\n\n &::before {\n inset-block-start: -50%;\n inline-size: 100%;\n block-size: 400%;\n background: linear-gradient(\n 1deg,\n transparent 40%,\n var(--lb-accent) 50%,\n transparent 60%\n );\n background-position: top left;\n background-size: 100% 600px;\n background-repeat: round;\n animation-name: lb-animation-ai-toolbar-halo-vertical;\n animation-duration: 4s;\n animation-delay: -2s;\n animation-direction: alternate-reverse;\n }\n\n &::after {\n inset-block-start: -50%;\n inline-size: 100%;\n block-size: 400%;\n background: linear-gradient(\n -2deg,\n transparent 40%,\n var(--lb-accent) 50%,\n transparent 60%\n );\n background-position: top left;\n background-size: 100% 400px;\n background-repeat: round;\n animation-name: lb-animation-ai-toolbar-halo-vertical;\n animation-duration: 3s;\n animation-delay: -1s;\n animation-direction: alternate;\n }\n}\n\n.lb-tiptap-ai-toolbar-thinking {\n display: flex;\n flex: 1 0 auto;\n align-items: center;\n min-inline-size: 0;\n padding-inline: var(--lb-tiptap-ai-toolbar-padding);\n color: var(--lb-foreground-moderate);\n cursor: wait;\n user-select: none;\n animation: lb-animation-shimmer 8s linear infinite;\n}\n\n.lb-tiptap-ai-toolbar-dropdown {\n inline-size: min(250px, 100%);\n margin-block-start: 8px;\n}\n\n/*************************************\n * Collab Cursors *\n *************************************/\n\n/* Give a remote user a caret */\n/* stylelint-disable-next-line selector-class-pattern */\n.collaboration-cursor__caret {\n position: relative;\n margin-inline-start: -1px;\n margin-inline-end: -1px;\n border-inline-start: 1px solid #0d0d0d;\n border-inline-end: 1px solid #0d0d0d;\n word-break: normal;\n pointer-events: none;\n}\n\n/* Render the username above the caret */\n/* stylelint-disable-next-line selector-class-pattern */\n.collaboration-cursor__label {\n position: absolute;\n inset-inline-start: -1px;\n inset-block-start: -1.4em;\n padding: 2px 6px;\n border-radius: 6px;\n border-end-start-radius: 0;\n color: #fff;\n font-weight: 600;\n font-style: normal;\n font-size: 14px;\n line-height: normal;\n white-space: nowrap;\n pointer-events: none;\n user-select: none;\n}\n\n/*************************************\n * Animations *\n *************************************/\n\n@keyframes lb-animation-ai-toolbar-halo-horizontal {\n from {\n transform: translateX(-50%);\n }\n\n to {\n transform: translateX(0);\n }\n}\n\n@keyframes lb-animation-ai-toolbar-halo-vertical {\n from {\n transform: translateY(0);\n }\n\n to {\n transform: translateY(-50%);\n }\n}\n\n/*************************************\n * Ai Changes *\n *************************************/\n\n.lb-changed-removed {\n color: rgb(255 255 255 / 13%);\n text-decoration: line-through;\n text-decoration-thickness: 1px;\n}\n\n.lb-changed-added {\n border-block-end: 2px solid rgb(35 131 226 / 15%);\n background: rgb(35 131 226 / 5.4%);\n color: rgb(79 167 255);\n}\n","@mixin invisible-selection {\n &::selection,\n *::selection {\n background: transparent;\n }\n}\n\n@mixin invisible-scrollbar {\n & {\n -ms-overflow-style: none;\n scrollbar-width: none;\n }\n\n &::-webkit-scrollbar {\n display: none;\n }\n}\n"]}
1
+ {"version":3,"sources":["src/styles/src/styles/index.css","src/styles/src/styles/utils.css"],"names":[],"mappings":"AAOA,4BAAA,QAAA,CAAA,SAAA,CAAA,eAAA,CAUA,+BAAA,kDAAA,CAIA,8BAAA,gEAAA,CAIA,qCAAA,2DAAA,CAAA,iDAAA,CAAA,4CAAA,CAAA,yCAAA,CAAA,sCAAA,CAAA,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BAAA,CAAA,gBAAA,CAAA,yBAAA,CAAA,eAAA,CAAA,cAAA,CAAA,iBAAA,CAAA,eAAA,CAAA,kBAAA,CAAA,iBAAA,CAAA,wBAAA,CAAA,uBAAA,CAAA,mDAqBA,GAAA,yBAAA,CAAA,GAAA,sBAAA,CAAA,CAAA,iDAUA,GAAA,uBAAA,CAAA,GAAA,0BAAA,CAAA,CAAA,gCAxgBA,wDACE,kCAAA,CAAA,6CAiEA,sBAAA,CAAA","file":"styles.css","sourcesContent":["@import \"./utils\";\n@import \"./constants\";\n\n/*************************************\n * Suggestions *\n *************************************/\n\n.lb-tiptap-suggestions-list {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n\n/*************************************\n * Mention suggestions *\n *************************************/\n\n.lb-tiptap-mention-suggestions {\n --lb-tiptap-mention-suggestion-avatar-size: 1.25rem;\n}\n\n.lb-tiptap-mention-suggestion {\n padding: calc(0.375 * var(--lb-spacing)) calc(0.625 * var(--lb-spacing));\n}\n\n.lb-tiptap-mention-suggestion-avatar {\n inline-size: var(--lb-tiptap-mention-suggestion-avatar-size);\n margin-inline-start: calc(-0.125 * var(--lb-spacing));\n margin-inline-end: calc(0.5 * var(--lb-spacing));\n margin-block: calc(0.125 * var(--lb-spacing));\n background: var(--lb-foreground-subtle);\n color: var(--lb-foreground-moderate);\n}\n\n/*************************************\n * Elevation lists *\n *************************************/\n\n.lb-tiptap-suggestions {\n padding: $lb-elevation-padding;\n animation-duration: var(--lb-transition-duration);\n animation-timing-function: var(--lb-transition-easing);\n will-change: transform, opacity;\n}\n\n.lb-tiptap-suggestions-list-item {\n display: flex;\n align-items: center;\n padding: calc(0.25 * var(--lb-spacing)) calc(0.5 * var(--lb-spacing));\n border-radius: calc(var(--lb-radius) - 0.75 * $lb-elevation-padding);\n color: var(--lb-foreground-secondary);\n outline: none;\n font-size: 0.875rem;\n cursor: pointer;\n user-select: none;\n transition-property: background, color, opacity;\n scroll-margin-block: $lb-elevation-padding;\n}\n\n:is(.lb-tiptap-suggestions-list-item) {\n &:where(\n [data-highlighted]:not([data-highlighted=\"false\"]),\n [data-selected]:not([data-selected=\"false\"])\n ) {\n background: var(--lb-foreground-subtle);\n transition-duration: calc(var(--lb-transition-duration) / 2);\n }\n\n &:where(:disabled, [data-disabled]:not([data-disabled=\"false\"])) {\n opacity: 0.5;\n cursor: not-allowed;\n }\n}\n\n/*************************************\n * Floating animations *\n *************************************/\n\n:is(.lb-tiptap-suggestions) {\n &:where([data-side=\"top\"]) {\n animation-name: lb-animation-slide-up;\n }\n\n &:where([data-side=\"bottom\"]) {\n animation-name: lb-animation-slide-down;\n }\n\n &:where([data-state=\"closed\"]) {\n animation-name: lb-animation-disappear;\n }\n}\n\n@media (prefers-reduced-motion) {\n .lb-tiptap-suggestions:where(:not([data-state=\"closed\"])) {\n animation-name: lb-animation-appear;\n }\n}\n\n/*************************************\n * Mention *\n *************************************/\n\n.lb-tiptap-mention {\n padding: 0.1em 0.3em;\n border-radius: calc(0.675 * var(--lb-radius));\n background: var(--lb-accent-subtle);\n color: var(--lb-accent);\n box-decoration-break: clone;\n font-weight: 500;\n\n @include invisible-selection;\n}\n\n.lb-mention-selected {\n background: var(--lb-accent);\n color: var(--lb-accent-foreground);\n}\n\n/*************************************\n * Thread mark *\n *************************************/\n\n:where(.lb-tiptap-thread-mark:not([data-orphan=\"true\"])) {\n background: var(--lb-accent-subtle);\n color: var(--lb-foreground);\n outline: none;\n font-weight: 500;\n transition-property: color, text-decoration-color;\n text-decoration-line: underline;\n text-decoration-color: var(--lb-foreground-moderate);\n text-underline-offset: 2px;\n}\n\n:where(\n .lb-tiptap-thread-mark:not([data-orphan=\"true\"])\n .lb-tiptap-thread-mark-selected\n) {\n color: var(--lb-accent);\n text-decoration-line: underline;\n text-decoration-color: var(--lb-accent-moderate);\n text-underline-offset: 2px;\n}\n\n/*************************************\n * Anchored threads *\n *************************************/\n\n.lb-tiptap-anchored-threads {\n --lb-tiptap-anchored-threads-gap: 1.25rem;\n --lb-tiptap-anchored-threads-active-thread-offset: -0.75rem;\n}\n\n.lb-tiptap-anchored-threads-thread-container {\n transition-duration: calc(var(--lb-transition-duration) * 2);\n transition-property: transform;\n}\n\n@media (prefers-reduced-motion) {\n .lb-tiptap-anchored-threads-thread-container {\n transition-duration: 0s;\n }\n}\n\n.lb-tiptap-anchored-threads-thread {\n position: relative;\n overflow: hidden;\n border-radius: var(--lb-radius);\n background: var(--lb-dynamic-background);\n box-shadow: $lb-tiptap-anchored-threads-shadow;\n transition-property: background, box-shadow;\n\n &::after {\n content: \"\";\n position: absolute;\n inset: 0;\n z-index: 1;\n border-radius: inherit;\n box-shadow: var(--lb-inset-shadow);\n pointer-events: none;\n }\n\n &:where([data-state=\"active\"]) {\n box-shadow: $lb-tiptap-anchored-threads-active-shadow;\n }\n}\n\n/*************************************\n * Floating components *\n *************************************/\n\n.lb-tiptap-floating {\n --lb-tiptap-floating-size: 350px;\n}\n\n/*************************************\n * Floating threads *\n *************************************/\n\n.lb-tiptap-floating-threads-thread {\n inline-size: var(--lb-tiptap-floating-size);\n\n &:where(:not(:last-of-type)) {\n border-block-end: 1px solid var(--lb-foreground-subtle);\n }\n}\n\n/*************************************\n * Floating composer *\n *************************************/\n\n.lb-tiptap-floating-composer {\n inline-size: var(--lb-tiptap-floating-size);\n}\n\n/*************************************\n * Active selection *\n *************************************/\n\n.lb-tiptap-active-selection {\n background: var(--lb-selection, rgb(0 0 255 / 20%));\n pointer-events: none;\n}\n\n/*************************************\n * Toolbar *\n *************************************/\n\n.lb-tiptap-toolbar {\n --lb-tiptap-toolbar-spacing: calc(0.25 * var(--lb-spacing));\n\n position: relative;\n display: flex;\n flex-direction: row;\n gap: var(--lb-tiptap-toolbar-spacing);\n align-items: center;\n padding: var(--lb-tiptap-toolbar-spacing);\n background: var(--lb-background);\n\n /* overflow-inline: auto; doesn't work as expected */\n /* stylelint-disable-next-line plugin/use-logical-properties-and-values */\n overflow-x: auto;\n\n @include invisible-scrollbar;\n\n > * {\n flex: none;\n }\n}\n\n.lb-tiptap-floating-toolbar {\n --lb-tiptap-toolbar-spacing: $lb-elevation-padding;\n}\n\n.lb-tiptap-toolbar-separator {\n position: relative;\n align-self: stretch;\n inline-size: 1px;\n margin-inline: 1px;\n pointer-events: none;\n\n &::before {\n content: \"\";\n position: absolute;\n inset: 10% 0;\n background: var(--lb-foreground-subtle);\n }\n}\n\n/*************************************\n * AI Toolbar *\n *************************************/\n\n.lb-tiptap-ai-selection {\n background: var(--lb-selection, rgb(0 0 255 / 20%));\n pointer-events: none;\n}\n\n.lb-tiptap-ai-toolbar-portal {\n inline-size: var(--lb-tiptap-editor-width);\n outline: none;\n}\n\n.lb-tiptap-ai-toolbar-container {\n --lb-tiptap-ai-toolbar-padding: calc(0.5 * var(--lb-spacing));\n --lb-tiptap-ai-toolbar-height: calc(\n $lb-button-size + 2 * var(--lb-tiptap-ai-toolbar-padding)\n );\n\n position: relative;\n min-block-size: var(--lb-tiptap-ai-toolbar-height);\n}\n\n.lb-tiptap-ai-toolbar {\n display: flex;\n flex-direction: column;\n color: var(--lb-foreground);\n}\n\n.lb-tiptap-ai-toolbar-output-container {\n display: flex;\n flex-direction: column;\n border-block-end: 1px solid var(--lb-foreground-subtle);\n}\n\n.lb-tiptap-ai-toolbar-output {\n &::before {\n content: \"\\FEFF\";\n display: inline-block;\n vertical-align: middle;\n user-select: none;\n }\n\n /* stylelint-disable-next-line selector-class-pattern */\n :where(.collaboration-cursor__label) {\n display: flex;\n gap: 0.1875em;\n align-items: center;\n\n :where(.lb-icon-container) {\n margin-inline-start: -0.125em;\n\n &,\n & svg {\n inline-size: 1em;\n block-size: 1em;\n }\n }\n }\n}\n\n.lb-tiptap-ai-toolbar-content {\n display: grid;\n grid-template-columns: auto 1fr auto;\n inline-size: 100%;\n min-inline-size: 0;\n outline: none;\n}\n\n.lb-tiptap-ai-toolbar-output-container,\n.lb-tiptap-ai-toolbar-content {\n max-block-size: calc(6lh + 2 * var(--lb-tiptap-ai-toolbar-padding));\n padding: var(--lb-tiptap-ai-toolbar-padding);\n\n /* overflow-block: auto; doesn't work as expected */\n /* stylelint-disable-next-line plugin/use-logical-properties-and-values */\n overflow-y: auto;\n}\n\n.lb-tiptap-ai-toolbar-custom-prompt-container {\n position: relative;\n z-index: auto;\n display: grid;\n margin-block: calc(-1 * var(--lb-tiptap-ai-toolbar-padding));\n line-height: $lb-button-size;\n\n &::before {\n /* The space is important when handling new lines */\n content: attr(data-value) \" \";\n visibility: hidden;\n }\n}\n\n.lb-tiptap-ai-toolbar-icon-container,\n.lb-tiptap-ai-toolbar-actions {\n display: flex;\n flex: none;\n block-size: $lb-button-size;\n}\n\n.lb-tiptap-ai-toolbar-icon-container {\n position: sticky;\n inset-block-start: 0;\n align-items: center;\n align-self: start;\n color: var(--lb-foreground-moderate);\n}\n\n.lb-tiptap-ai-toolbar-actions {\n position: sticky;\n inset-block-end: 0;\n gap: var(--lb-tiptap-ai-toolbar-padding);\n align-self: end;\n}\n\n.lb-tiptap-ai-toolbar-custom-prompt {\n all: unset;\n background: transparent;\n color: var(--lb-foreground);\n outline: none;\n resize: none;\n\n &::placeholder {\n color: var(--lb-foreground-moderate);\n }\n}\n\n.lb-tiptap-ai-toolbar-custom-prompt,\n.lb-tiptap-ai-toolbar-custom-prompt-container::before {\n /* Overlap the textarea and its value to auto-size it */\n grid-area: 1 / 1 / 2 / 2;\n box-sizing: inherit;\n inline-size: 100%;\n min-inline-size: 0;\n padding: var(--lb-tiptap-ai-toolbar-padding);\n font: inherit;\n letter-spacing: inherit;\n white-space: pre-wrap;\n}\n\n.lb-tiptap-ai-toolbar-halo {\n --lb-tiptap-ai-toolbar-halo-blur: 16px;\n --lb-tiptap-ai-toolbar-halo-outset: 8px;\n\n position: absolute;\n inset: calc(-1 * var(--lb-tiptap-ai-toolbar-halo-outset));\n z-index: -1;\n overflow: hidden;\n border-radius: calc(\n var(--lb-radius) + var(--lb-tiptap-ai-toolbar-halo-outset)\n );\n filter: blur(var(--lb-tiptap-ai-toolbar-halo-blur));\n pointer-events: none;\n transition-duration: 1s;\n transition-property: opacity;\n\n &:where(:not([data-active])) {\n opacity: 0.5;\n }\n}\n\n:is(\n .lb-tiptap-ai-toolbar-halo-horizontal,\n .lb-tiptap-ai-toolbar-halo-vertical\n) {\n position: absolute;\n inset: 0;\n\n &::before,\n &::after {\n content: \"\";\n position: absolute;\n inset: 0;\n opacity: 0.25;\n animation-timing-function: cubic-bezier(0.455, 0.03, 0.515, 0.955);\n animation-iteration-count: infinite;\n }\n}\n\n.lb-tiptap-ai-toolbar-halo-horizontal {\n &::before {\n inline-size: 200%;\n block-size: 100%;\n background: linear-gradient(\n 30deg,\n transparent 20%,\n var(--lb-accent) 50%,\n transparent 80%\n );\n background-position: top left;\n background-size: 50% 100%;\n animation-name: lb-animation-ai-toolbar-halo-horizontal;\n animation-duration: 8s;\n animation-direction: alternate;\n }\n\n &::after {\n inset-inline-start: -50%;\n inline-size: 400%;\n block-size: 100%;\n background: linear-gradient(\n 90deg,\n transparent 20%,\n var(--lb-accent) 50%,\n transparent 80%\n );\n background-position: top left;\n background-size: 800px 100%;\n background-repeat: space;\n animation-name: lb-animation-ai-toolbar-halo-horizontal;\n animation-duration: 6s;\n animation-delay: -2s;\n animation-direction: alternate-reverse;\n }\n}\n\n.lb-tiptap-ai-toolbar-halo-vertical {\n opacity: 0;\n\n &::before {\n inset-block-start: -50%;\n inline-size: 100%;\n block-size: 400%;\n background: linear-gradient(\n 1deg,\n transparent 40%,\n var(--lb-accent) 50%,\n transparent 60%\n );\n background-position: top left;\n background-size: 100% 600px;\n background-repeat: round;\n animation-name: lb-animation-ai-toolbar-halo-vertical;\n animation-duration: 4s;\n animation-delay: -2s;\n animation-direction: alternate-reverse;\n }\n\n &::after {\n inset-block-start: -50%;\n inline-size: 100%;\n block-size: 400%;\n background: linear-gradient(\n -2deg,\n transparent 40%,\n var(--lb-accent) 50%,\n transparent 60%\n );\n background-position: top left;\n background-size: 100% 400px;\n background-repeat: round;\n animation-name: lb-animation-ai-toolbar-halo-vertical;\n animation-duration: 3s;\n animation-delay: -1s;\n animation-direction: alternate;\n }\n}\n\n.lb-tiptap-ai-toolbar-thinking {\n display: flex;\n flex: 1 0 auto;\n align-items: center;\n min-inline-size: 0;\n padding-inline: var(--lb-tiptap-ai-toolbar-padding);\n color: var(--lb-foreground-moderate);\n cursor: wait;\n user-select: none;\n animation: lb-animation-shimmer 8s linear infinite;\n}\n\n.lb-tiptap-ai-toolbar-dropdown {\n inline-size: min(250px, 100%);\n margin-block-start: 8px;\n}\n\n/*************************************\n * Diff Changes *\n *************************************/\n\n.lb-tiptap-change-removed {\n color: color-mix(in srgb, currentcolor 40%, transparent);\n text-decoration: line-through;\n text-decoration-thickness: 1px;\n}\n\n.lb-tiptap-change-added {\n background: color-mix(\n in srgb,\n var(--lb-accent) calc(var(--lb-accent-contrast) * 1.5),\n transparent\n );\n color: var(--lb-accent);\n}\n\n/*************************************\n * Collab Cursors *\n *************************************/\n\n/* Give a remote user a caret */\n/* stylelint-disable-next-line selector-class-pattern */\n.collaboration-cursor__caret {\n position: relative;\n margin-inline-start: -1px;\n margin-inline-end: -1px;\n border-inline-start: 1px solid #0d0d0d;\n border-inline-end: 1px solid #0d0d0d;\n word-break: normal;\n pointer-events: none;\n}\n\n/* Render the username above the caret */\n/* stylelint-disable-next-line selector-class-pattern */\n.collaboration-cursor__label {\n position: absolute;\n inset-inline-start: -1px;\n inset-block-start: -1.4em;\n padding: 2px 6px;\n border-radius: 6px;\n border-end-start-radius: 0;\n color: #fff;\n font-weight: 600;\n font-style: normal;\n font-size: 14px;\n line-height: normal;\n white-space: nowrap;\n pointer-events: none;\n user-select: none;\n}\n\n/*************************************\n * Animations *\n *************************************/\n\n@keyframes lb-animation-ai-toolbar-halo-horizontal {\n from {\n transform: translateX(-50%);\n }\n\n to {\n transform: translateX(0);\n }\n}\n\n@keyframes lb-animation-ai-toolbar-halo-vertical {\n from {\n transform: translateY(0);\n }\n\n to {\n transform: translateY(-50%);\n }\n}\n","@mixin invisible-selection {\n &::selection,\n *::selection {\n background: transparent;\n }\n}\n\n@mixin invisible-scrollbar {\n & {\n -ms-overflow-style: none;\n scrollbar-width: none;\n }\n\n &::-webkit-scrollbar {\n display: none;\n }\n}\n"]}