@aivex/ui 1.2.0-dev.41 → 1.2.0-dev.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/comment.cjs +3 -2
- package/dist/comment.cjs.map +1 -1
- package/dist/comment.js +61 -30
- package/dist/comment.js.map +1 -1
- package/dist/components/Comment/mentionContent.d.ts +5 -0
- package/dist/components/Comment/mentionContent.test.d.ts +1 -0
- package/dist/components/DataGrid/DataGrid.d.ts +8 -3
- package/dist/components/DataGrid/DataGridPrimitives.d.ts +10 -2
- package/dist/components/DataGrid/index.d.ts +1 -1
- package/dist/components/ShapeEditor/_components/SelectionInfo.d.ts +7 -2
- package/dist/components/ShapeEditor/_state/useMinimapSync.d.ts +3 -1
- package/dist/components/Table/Table.d.ts +10 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1056 -1052
- package/dist/index.js.map +1 -1
- package/dist/shape-editor.cjs +1 -1
- package/dist/shape-editor.cjs.map +1 -1
- package/dist/shape-editor.js +680 -652
- package/dist/shape-editor.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/comment.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
"use client";require(`./styles.css`),Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./Button-EEErevS-.cjs`),t=require(`./IconButton-DBlsEy3m.cjs`);let n=require(`react/jsx-runtime`),r=require(`react`),i=require(`@tiptap/extension-mention`);i=e.ha(i,1);let a=require(`@tiptap/extension-placeholder`);a=e.ha(a,1);let o=require(`@tiptap/react`),s=require(`@tiptap/starter-kit`);s=e.ha(s,1);let c=require(`tippy.js`);c=e.ha(c,1);var l
|
|
1
|
+
"use client";require(`./styles.css`),Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./Button-EEErevS-.cjs`),t=require(`./IconButton-DBlsEy3m.cjs`);let n=require(`react/jsx-runtime`),r=require(`react`),i=require(`@tiptap/extension-mention`);i=e.ha(i,1);let a=require(`@tiptap/extension-placeholder`);a=e.ha(a,1);let o=require(`@tiptap/react`),s=require(`@tiptap/starter-kit`);s=e.ha(s,1);let c=require(`tippy.js`);c=e.ha(c,1);var l=/@\[([^\]]*)\]\(([^)]*)\)/g;function u(e){return{type:`doc`,content:e.split(`
|
|
2
|
+
`).map(e=>{let t=[],n=0;for(let r of e.matchAll(l)){let[i,a,o]=r,s=r.index??0;s>n&&t.push({type:`text`,text:e.slice(n,s)}),t.push({type:`mention`,attrs:{id:o,label:a}}),n=s+i.length}return n<e.length&&t.push({type:`text`,text:e.slice(n)}),t.length>0?{type:`paragraph`,content:t}:{type:`paragraph`}})}}function d(e){if(!e?.content)return``;let t=e=>e.type===`mention`&&e.attrs?`@[${e.attrs.label}](${e.attrs.id})`:e.type===`text`?e.text||``:e.type===`hardBreak`?`
|
|
2
3
|
`:e.content?e.content.map(t).join(``):``;return e.content.map(t).join(`
|
|
3
|
-
`)}function p({user:r,value:i,onChange:a,onSubmit:o,onClose:s,title:c=`Comment`,placeholder:l,submitLabel:u=`Send`,showSubmit:
|
|
4
|
+
`)}var f=(0,r.memo)(function({items:e,command:i,emptyText:a=`No results found.`,ref:o}){let[s,c]=(0,r.useState)(0),l=(0,r.useRef)([]),u=(0,r.useCallback)(t=>{let n=e[t];n&&i(n)},[e,i]),d=(0,r.useCallback)(t=>{c(n=>{let r=e.length;return t===`up`?(n+r-1)%r:(n+1)%r})},[e.length]),f=(0,r.useCallback)(e=>{switch(e.key){case`ArrowUp`:return d(`up`),!0;case`ArrowDown`:return d(`down`),!0;case`Enter`:return u(s),!0;default:return!1}},[d,u,s]);return(0,r.useEffect)(()=>{c(0),l.current=e.map(()=>null)},[e]),(0,r.useEffect)(()=>{l.current[s]?.scrollIntoView({behavior:`smooth`,block:`nearest`})},[s]),(0,r.useImperativeHandle)(o,()=>({onKeyDown:f}),[f]),e.length?(0,n.jsx)(`div`,{className:`aivex:h-full aivex:max-h-[248px] aivex:min-w-[298px] aivex:max-w-[328px] aivex:overflow-y-auto aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:py-2 aivex:shadow-xl`,children:e.map((e,r)=>(0,n.jsxs)(`div`,{ref:e=>{l.current[r]=e},className:`aivex:flex aivex:h-[52px] aivex:cursor-pointer aivex:items-center aivex:gap-2 aivex:px-4 aivex:py-2 ${s===r?`aivex:bg-bg-brand-subtle`:``}`,onClick:()=>u(r),children:[(0,n.jsx)(t.r,{size:`sm`,src:e.avatarUrl,bgColor:e.color,name:e.name}),(0,n.jsxs)(`div`,{className:`aivex:flex aivex:max-w-[260px] aivex:flex-col`,children:[(0,n.jsx)(`div`,{className:`aivex:truncate aivex:text-label-md aivex:text-text-primary`,children:e.name}),e.email?(0,n.jsx)(`div`,{className:`aivex:truncate aivex:text-body-sm-regular aivex:text-text-secondary`,children:e.email}):null]})]},e.id))}):(0,n.jsx)(`div`,{className:`aivex:min-w-[298px] aivex:max-w-[328px] aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:py-2 aivex:shadow-xl`,children:(0,n.jsx)(`div`,{className:`aivex:p-2 aivex:text-body-md-regular aivex:text-text-secondary`,children:a})})}),p=(e,t,n)=>(0,r.useMemo)(()=>{let r=t=>{if(!t)return e;let n=t.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(n)||(e.email??``).toLowerCase().includes(n))},i=e=>t=>{e({id:t.id,label:t.name})};return{items:({query:e})=>r(e),render:()=>{let e=null,r=null;return{onStart:a=>{e=new o.ReactRenderer(f,{props:{...a,emptyText:n,command:i(a.command)},editor:a.editor}),a.clientRect&&(r=(0,c.default)(`body`,{getReferenceClientRect:a.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!0,interactive:!0,trigger:`manual`,placement:`bottom-start`}),t?.(!0))},onUpdate(t){e?.updateProps({...t,emptyText:n,command:i(t.command)}),t.clientRect&&r?.[0]?.setProps({getReferenceClientRect:t.clientRect})},onKeyDown(n){return n.event.key===`Escape`?(r?.[0]&&!r[0].state.isDestroyed&&r[0].hide(),t?.(!1),!0):e?.ref?.onKeyDown(n.event)||!1},onExit(){r?.[0]&&!r[0].state.isDestroyed&&r[0].destroy(),e?.destroy(),r=null,e=null,t?.(!1)}}}}},[e,t,n]);function m({value:e,onChange:t,placeholder:c,onSubmit:l,onEscape:f,userList:m=[],initialContent:h,mentionEmptyText:g,autoFocus:_=!0,handleRef:v}){let y=(0,r.useRef)(null),[b,x]=(0,r.useState)(!1),S=p(m,x,g),C=(0,o.useEditor)({extensions:[s.default,a.default.configure({placeholder:c,emptyEditorClass:`aivex:before:content-[attr(data-placeholder)] aivex:before:text-text-tertiary aivex:before:absolute aivex:before:left-3`}),i.default.configure({HTMLAttributes:{class:`aivex:text-text-brand aivex:px-1`},renderHTML({options:e,node:t}){return[`span`,(0,o.mergeAttributes)(e.HTMLAttributes),`${t.attrs.label}`]},renderText({node:e}){return`@[${e.attrs.label}](${e.attrs.id})`},deleteTriggerWithBackspace:!0,suggestion:S})],content:h||u(e),immediatelyRender:!1,editorProps:{attributes:{class:`aivex:px-3 aivex:py-1 aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-secondary aivex:focus:border-border-brand aivex:outline-none aivex:text-body-md-regular aivex:text-text-primary aivex:cursor-text aivex:[&_p]:leading-[22px]`},handleKeyDown:(t,n)=>n.key===`Enter`?b||n.shiftKey||n.metaKey||n.ctrlKey||n.altKey?!1:(n.preventDefault(),e.trim()&&l&&l(),!0):n.key===`Escape`?b||!f?!1:(n.preventDefault(),f(),!0):!1},onUpdate:({editor:e})=>{t(d(e.getJSON()))}});return(0,r.useEffect)(()=>{if(!C||!b&&!f)return;let e=C.view,t=e.dom.ownerDocument.defaultView,n=t=>{t.key!==`Escape`||t.defaultPrevented||!(t.target instanceof Node)||!e.dom.contains(t.target)||e.someProp(`handleKeyDown`,n=>n(e,t))&&(t.preventDefault(),t.stopPropagation())};return t?.addEventListener(`keydown`,n,!0),()=>t?.removeEventListener(`keydown`,n,!0)},[C,b,f]),(0,r.useEffect)(()=>{C&&!h&&e!==d(C.getJSON())&&C.commands.setContent(u(e))},[e,C,h]),(0,r.useEffect)(()=>{C&&_&&requestAnimationFrame(()=>{C.commands.focus()})},[C,_]),(0,r.useImperativeHandle)(v,()=>({focus:()=>{C?.commands.focus()}}),[C]),(0,n.jsx)(o.EditorContent,{ref:y,editor:C,className:`aivex:relative aivex:h-full aivex:w-full`,onKeyDown:e=>e.stopPropagation()})}function h({user:r,value:i,onChange:a,onSubmit:o,onClose:s,title:c=`Comment`,placeholder:l,submitLabel:u=`Send`,showSubmit:d=!0,pending:f=!1,userList:p,mentionEmptyText:h,initialContent:g,className:_}){let v=()=>{!i.trim()||f||o()};return(0,n.jsx)(`div`,{className:`aivex:rounded-2xl aivex:bg-bg-primary aivex:shadow-xl ${_??``}`,children:(0,n.jsxs)(`div`,{className:`aivex:flex aivex:w-[360px] aivex:flex-col`,children:[(0,n.jsxs)(`div`,{className:`aivex:flex aivex:h-12 aivex:items-center aivex:justify-between aivex:border-border-subtle aivex:border-b aivex:px-5 aivex:py-2`,children:[(0,n.jsx)(`span`,{className:`aivex:text-body-lg-medium aivex:text-text-primary`,children:c}),(0,n.jsx)(t.t,{size:`sm`,className:`aivex:text-text-secondary`,onClick:s,children:(0,n.jsx)(e.xt,{size:20})})]}),(0,n.jsxs)(`div`,{className:`aivex:flex aivex:flex-col aivex:px-4 aivex:py-3`,children:[(0,n.jsxs)(`div`,{className:`aivex:flex aivex:gap-1.5`,children:[(0,n.jsx)(`div`,{className:`aivex:h-6 aivex:w-6 aivex:py-1`,children:r?(0,n.jsx)(t.r,{size:`sm`,src:r.avatarUrl,bgColor:r.color,name:r.name}):null}),(0,n.jsx)(`div`,{className:`aivex:min-w-0 aivex:flex-1`,children:(0,n.jsx)(m,{value:i,onChange:a,placeholder:l,onSubmit:v,onEscape:s,userList:p,mentionEmptyText:h,initialContent:g})})]}),d?(0,n.jsx)(`div`,{className:`aivex:grid aivex:transition-[grid-template-rows,opacity] aivex:duration-200 aivex:ease-out ${i.trim()?`aivex:grid-rows-[1fr] aivex:opacity-100`:`aivex:pointer-events-none aivex:grid-rows-[0fr] aivex:opacity-0`}`,children:(0,n.jsx)(`div`,{className:`aivex:flex aivex:justify-end aivex:overflow-hidden aivex:pt-1.5`,children:(0,n.jsx)(e.t,{size:`md`,disabled:!i.trim()||f,onClick:v,tabIndex:i.trim()?void 0:-1,children:u})})}):null]})]})})}function g({users:e,selected:r=!1,resolved:i=!1,onClick:a,maxAvatars:o=3,className:s}){let c=e.slice(0,o);return(0,n.jsxs)(`button`,{type:`button`,onClick:a,className:`aivex:flex aivex:h-fit aivex:cursor-pointer aivex:items-center aivex:rounded-t-full aivex:rounded-br-full aivex:border aivex:p-1 aivex:transition-colors ${r?`aivex:border-border-brand aivex:bg-bg-brand`:`aivex:border-border-subtle aivex:bg-bg-primary aivex:hover:border-border-brand`} ${i?`aivex:opacity-40`:``} ${s??``}`,children:[c.map((e,r)=>(0,n.jsx)(`span`,{className:`aivex:flex`,style:r>0?{marginLeft:`-4px`}:void 0,children:(0,n.jsx)(t.r,{size:`xs`,src:e.avatarUrl,bgColor:e.color,name:e.name})},e.id)),e.length>o?(0,n.jsxs)(`span`,{className:`aivex:px-1 aivex:text-label-sm aivex:text-text-secondary`,children:[`+`,e.length-o]}):null]})}exports.CommentInput=h,exports.CommentPin=g,exports.MentionInput=m;
|
|
4
5
|
//# sourceMappingURL=comment.cjs.map
|
package/dist/comment.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comment.cjs","names":[],"sources":["../src/components/Comment/MentionList.tsx","../src/components/Comment/useMentionSuggestion.ts","../src/components/Comment/MentionInput.tsx","../src/components/Comment/CommentInput.tsx","../src/components/Comment/CommentPin.tsx"],"sourcesContent":["\"use client\";\n\nimport { memo, useCallback, useEffect, useImperativeHandle, useRef, useState } from \"react\";\nimport { Avatar } from \"../Avatar\";\nimport type { CommentUser } from \"./types\";\n\nexport interface MentionListHandle {\n onKeyDown: (event: KeyboardEvent) => boolean;\n}\n\ninterface MentionListProps {\n items: CommentUser[];\n command: (item: CommentUser) => void;\n /** 후보 없음 문구(호스트 i18n). 기본 \"No results found.\" */\n emptyText?: string;\n ref?: React.Ref<MentionListHandle>;\n}\n\n/** 멘션(@) 자동완성 목록 — 옵스 에디터 MentionList 이식(도메인 결합 제거). */\nconst MentionList = memo(function MentionList({\n items,\n command,\n emptyText = \"No results found.\",\n ref,\n}: MentionListProps) {\n const [selectedIndex, setSelectedIndex] = useState(0);\n const itemRefs = useRef<(HTMLDivElement | null)[]>([]);\n\n const selectItem = useCallback(\n (index: number) => {\n const item = items[index];\n if (item) command(item);\n },\n [items, command],\n );\n\n const moveSelection = useCallback(\n (direction: \"up\" | \"down\") => {\n setSelectedIndex((prev) => {\n const itemCount = items.length;\n if (direction === \"up\") return (prev + itemCount - 1) % itemCount;\n return (prev + 1) % itemCount;\n });\n },\n [items.length],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent): boolean => {\n switch (event.key) {\n case \"ArrowUp\":\n moveSelection(\"up\");\n return true;\n case \"ArrowDown\":\n moveSelection(\"down\");\n return true;\n case \"Enter\":\n selectItem(selectedIndex);\n return true;\n default:\n return false;\n }\n },\n [moveSelection, selectItem, selectedIndex],\n );\n\n useEffect(() => {\n setSelectedIndex(0);\n itemRefs.current = items.map(() => null);\n }, [items]);\n\n useEffect(() => {\n itemRefs.current[selectedIndex]?.scrollIntoView({ behavior: \"smooth\", block: \"nearest\" });\n }, [selectedIndex]);\n\n useImperativeHandle(ref, () => ({ onKeyDown: handleKeyDown }), [handleKeyDown]);\n\n if (!items.length) {\n return (\n <div className=\"aivex:min-w-[298px] aivex:max-w-[328px] aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:py-2 aivex:shadow-xl\">\n <div className=\"aivex:p-2 aivex:text-body-md-regular aivex:text-text-secondary\">\n {emptyText}\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"aivex:h-full aivex:max-h-[248px] aivex:min-w-[298px] aivex:max-w-[328px] aivex:overflow-y-auto aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:py-2 aivex:shadow-xl\">\n {items.map((item, index) => (\n // 키보드 상호작용은 tiptap 에디터가 MentionListHandle로 위임 처리한다.\n <div\n key={item.id}\n ref={(el) => {\n itemRefs.current[index] = el;\n }}\n className={`aivex:flex aivex:h-[52px] aivex:cursor-pointer aivex:items-center aivex:gap-2 aivex:px-4 aivex:py-2 ${\n selectedIndex === index ? \"aivex:bg-bg-brand-subtle\" : \"\"\n }`}\n onClick={() => selectItem(index)}\n >\n <Avatar size=\"sm\" src={item.avatarUrl} bgColor={item.color} name={item.name} />\n <div className=\"aivex:flex aivex:max-w-[260px] aivex:flex-col\">\n <div className=\"aivex:truncate aivex:text-label-md aivex:text-text-primary\">\n {item.name}\n </div>\n {item.email ? (\n <div className=\"aivex:truncate aivex:text-body-sm-regular aivex:text-text-secondary\">\n {item.email}\n </div>\n ) : null}\n </div>\n </div>\n ))}\n </div>\n );\n});\n\nexport default MentionList;\n","\"use client\";\n\nimport { ReactRenderer } from \"@tiptap/react\";\nimport { useMemo } from \"react\";\nimport tippy, { type Instance as TippyInstance } from \"tippy.js\";\nimport MentionList, { type MentionListHandle } from \"./MentionList\";\nimport type { CommentUser } from \"./types\";\n\n/** tiptap Mention 확장에 꽂는 자동완성 설정 — 옵스 에디터 이식(CommentUser 기반). */\nexport const useMentionSuggestion = (\n userList: CommentUser[],\n onOpenChange?: (isOpen: boolean) => void,\n emptyText?: string,\n) => {\n return useMemo(() => {\n const filterUsers = (query: string) => {\n if (!query) return userList;\n const q = query.toLowerCase();\n return userList.filter(\n (user) =>\n user.name.toLowerCase().includes(q) || (user.email ?? \"\").toLowerCase().includes(q),\n );\n };\n\n const createCommandHandler =\n (originalCommand: (item: { id: string; label: string }) => void) => (item: CommentUser) => {\n originalCommand({ id: item.id, label: item.name });\n };\n\n const createRenderer = () => {\n let component: ReactRenderer<MentionListHandle> | null = null;\n let popup: TippyInstance[] | null = null;\n\n return {\n // biome-ignore lint/suspicious/noExplicitAny: tiptap suggestion props는 확장별 동적 형태라 상위 타입이 없다\n onStart: (props: Record<string, any>) => {\n component = new ReactRenderer(MentionList, {\n props: {\n ...props,\n emptyText,\n command: createCommandHandler(props.command),\n },\n editor: props.editor,\n });\n\n if (!props.clientRect) return;\n\n popup = tippy(\"body\", {\n getReferenceClientRect: props.clientRect,\n appendTo: () => document.body,\n content: component.element,\n showOnCreate: true,\n interactive: true,\n trigger: \"manual\",\n placement: \"bottom-start\",\n });\n\n onOpenChange?.(true);\n },\n\n // biome-ignore lint/suspicious/noExplicitAny: tiptap suggestion props는 확장별 동적 형태라 상위 타입이 없다\n onUpdate(props: Record<string, any>) {\n component?.updateProps({\n ...props,\n emptyText,\n command: createCommandHandler(props.command),\n });\n\n if (!props.clientRect) return;\n\n popup?.[0]?.setProps({ getReferenceClientRect: props.clientRect });\n },\n\n onKeyDown(props: { event: KeyboardEvent }) {\n if (props.event.key === \"Escape\") {\n if (popup?.[0] && !popup[0].state.isDestroyed) popup[0].hide();\n onOpenChange?.(false);\n return true;\n }\n return component?.ref?.onKeyDown(props.event) || false;\n },\n\n onExit() {\n if (popup?.[0] && !popup[0].state.isDestroyed) popup[0].destroy();\n component?.destroy();\n popup = null;\n component = null;\n onOpenChange?.(false);\n },\n };\n };\n\n return {\n items: ({ query }: { query: string }) => filterUsers(query),\n render: createRenderer,\n };\n }, [userList, onOpenChange, emptyText]);\n};\n","\"use client\";\n\nimport Mention from \"@tiptap/extension-mention\";\nimport Placeholder from \"@tiptap/extension-placeholder\";\nimport { EditorContent, type JSONContent, mergeAttributes, useEditor } from \"@tiptap/react\";\nimport StarterKit from \"@tiptap/starter-kit\";\nimport { type Ref, useEffect, useImperativeHandle, useRef, useState } from \"react\";\nimport type { CommentUser } from \"./types\";\nimport { useMentionSuggestion } from \"./useMentionSuggestion\";\n\nexport interface MentionInputHandle {\n /** 입력기에 포커스를 준다(예: 전송 버튼 클릭 후 포커스 유지). */\n focus: () => void;\n}\n\nexport interface MentionInputProps {\n value: string;\n onChange: (value: string) => void;\n placeholder?: string;\n /** Enter(멘션 목록 닫힌 상태) 제출. */\n onSubmit?: () => void;\n /** Esc(멘션 목록 닫힌 상태) 취소. */\n onEscape?: () => void;\n /** 멘션(@) 후보. 빈 배열이면 멘션 없이 플레인 입력처럼 동작한다. */\n userList?: CommentUser[];\n initialContent?: JSONContent;\n /** 멘션 후보 없음 문구(호스트 i18n). */\n mentionEmptyText?: string;\n /** 마운트 시 자동 포커스(기본 true). */\n autoFocus?: boolean;\n /** 명령형 핸들(포커스 제어). */\n handleRef?: Ref<MentionInputHandle>;\n}\n\n/**\n * 멘션(@) 지원 코멘트 입력기 — 옵스 에디터 MentionInput 이식.\n * value는 평문 직렬화(`@[이름](id)`)로 주고받는다.\n */\nexport default function MentionInput({\n value,\n onChange,\n placeholder,\n onSubmit,\n onEscape,\n userList = [],\n initialContent,\n mentionEmptyText,\n autoFocus = true,\n handleRef,\n}: MentionInputProps) {\n const editorRef = useRef<HTMLDivElement>(null);\n const [isMentionListOpen, setIsMentionListOpen] = useState(false);\n const suggestion = useMentionSuggestion(userList, setIsMentionListOpen, mentionEmptyText);\n\n const editor = useEditor({\n extensions: [\n StarterKit,\n Placeholder.configure({\n placeholder,\n emptyEditorClass:\n \"aivex:before:content-[attr(data-placeholder)] aivex:before:text-text-tertiary aivex:before:absolute aivex:before:left-3\",\n }),\n Mention.configure({\n HTMLAttributes: { class: \"aivex:text-text-brand aivex:px-1\" },\n // 멘션이 확정되면 골뱅이는 사라지고 이름만 남는다(시안) — 확정 전\n // 타이핑 중인 \"@검색어\"는 그대로다. 직렬화 형식은 바뀌지 않는다.\n renderHTML({ options, node }) {\n return [\"span\", mergeAttributes(options.HTMLAttributes), `${node.attrs.label}`];\n },\n renderText({ node }) {\n return `@[${node.attrs.label}](${node.attrs.id})`;\n },\n deleteTriggerWithBackspace: true,\n suggestion,\n }),\n ],\n content: initialContent || value,\n // SSR 환경(next 등)에서 hydration 불일치 방지.\n immediatelyRender: false,\n editorProps: {\n attributes: {\n // 줄높이 22(내부 p에 강제) + py 8 + 보더 2 = 32px — 옆의 Send 버튼(h-8)과 높이 일치.\n class:\n \"aivex:px-3 aivex:py-1 aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-secondary aivex:focus:border-border-brand aivex:outline-none aivex:text-body-md-regular aivex:text-text-primary aivex:cursor-text aivex:[&_p]:leading-[22px]\",\n },\n handleKeyDown: (_view, event) => {\n if (event.key === \"Enter\") {\n if (isMentionListOpen) return false;\n // 보조키를 짚은 Enter는 전송이 아니라 개행 — tiptap 기본 동작에 맡긴다.\n if (event.shiftKey || event.metaKey || event.ctrlKey || event.altKey) {\n return false;\n }\n event.preventDefault();\n if (value.trim() && onSubmit) onSubmit();\n return true;\n }\n if (event.key === \"Escape\") {\n if (isMentionListOpen || !onEscape) return false;\n event.preventDefault();\n onEscape();\n return true;\n }\n return false;\n },\n },\n onUpdate: ({ editor }) => {\n onChange(extractContentFromJSON(editor.getJSON()));\n },\n });\n\n // Radix는 document capture에서 Esc를 받는다. 입력기 내부의 Esc는 그보다\n // 먼저 공개 ProseMirror 키 핸들러로 처리해 멘션/편집 취소가 부모를 닫지 않게 한다.\n useEffect(() => {\n if (!editor || (!isMentionListOpen && !onEscape)) return;\n const view = editor.view;\n const ownerWindow = view.dom.ownerDocument.defaultView;\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\" || event.defaultPrevented) return;\n if (!(event.target instanceof Node) || !view.dom.contains(event.target)) return;\n if (view.someProp(\"handleKeyDown\", (handler) => handler(view, event))) {\n event.preventDefault();\n event.stopPropagation();\n }\n };\n ownerWindow?.addEventListener(\"keydown\", onKeyDown, true);\n return () => ownerWindow?.removeEventListener(\"keydown\", onKeyDown, true);\n }, [editor, isMentionListOpen, onEscape]);\n\n useEffect(() => {\n if (editor && !initialContent && value !== editor.getText()) {\n editor.commands.setContent(value);\n }\n }, [value, editor, initialContent]);\n\n useEffect(() => {\n if (editor && autoFocus) {\n requestAnimationFrame(() => {\n editor.commands.focus();\n });\n }\n }, [editor, autoFocus]);\n\n useImperativeHandle(\n handleRef,\n () => ({\n focus: () => {\n editor?.commands.focus();\n },\n }),\n [editor],\n );\n\n return (\n <EditorContent\n ref={editorRef}\n editor={editor}\n className=\"aivex:relative aivex:h-full aivex:w-full\"\n onKeyDown={(e) => e.stopPropagation()}\n />\n );\n}\n\n/** tiptap 문서 → 평문(멘션은 `@[이름](id)`, 줄바꿈은 \\n) 직렬화. */\nfunction extractContentFromJSON(json: JSONContent): string {\n if (!json?.content) return \"\";\n\n const processNode = (node: JSONContent): string => {\n if (node.type === \"mention\" && node.attrs) {\n return `@[${node.attrs.label}](${node.attrs.id})`;\n }\n if (node.type === \"text\") return node.text || \"\";\n // Shift+Enter가 넣는 줄바꿈 — 문단 분리(아래 join)와 같은 값으로 편다.\n if (node.type === \"hardBreak\") return \"\\n\";\n if (node.content) return node.content.map(processNode).join(\"\");\n return \"\";\n };\n // 문단마다 한 줄 — 보조키+Enter로 문단이 갈리면 그대로 줄이 나뉜다.\n return json.content.map(processNode).join(\"\\n\");\n}\n","\"use client\";\n\nimport type { JSONContent } from \"@tiptap/react\";\nimport { Avatar } from \"../Avatar\";\nimport { Button } from \"../Button\";\nimport { CloseIcon } from \"../Icon\";\nimport { IconButton } from \"../IconButton\";\nimport MentionInput from \"./MentionInput\";\nimport type { CommentUser } from \"./types\";\n\nexport interface CommentInputProps {\n /** 작성자(입력행 아바타). */\n user?: CommentUser;\n value: string;\n onChange: (value: string) => void;\n /** 전송(Enter 또는 Send 버튼). 값이 비어 있으면 호출되지 않는다. */\n onSubmit: () => void;\n /** 헤더 닫기 버튼·Esc. */\n onClose?: () => void;\n /** 헤더 타이틀(호스트 i18n). 기본 \"Comment\". */\n title?: string;\n placeholder?: string;\n /** 전송 버튼 라벨(호스트 i18n). 기본 \"Send\". */\n submitLabel?: string;\n /**\n * 전송 버튼 사용 — 켜면 내용이 있을 때만 입력 아래 오른쪽에 나타난다(시안).\n * 끄면 어느 상태에서도 없이 Enter로만 보낸다.\n */\n showSubmit?: boolean;\n /** 전송 중 여부 — 버튼 비활성(스피너 등은 호스트가 submitLabel 자리로). */\n pending?: boolean;\n /** 멘션(@) 후보. 생략하면 멘션 없이 동작. */\n userList?: CommentUser[];\n mentionEmptyText?: string;\n initialContent?: JSONContent;\n className?: string;\n}\n\n/**\n * 새 코멘트 입력 패널 — 옵스 new-editor의 NewCommentPanel 이식(도메인/위치 결합 제거).\n * 코멘트 스레드와 동일한 크롬: 헤더(타이틀+닫기) + 입력행(아바타 · 멘션 입력 · 오른쪽\n * Send 버튼). 화면 배치(핀 오른쪽 등)는 호스트가 감싸는 컨테이너에서 담당한다.\n */\nexport function CommentInput({\n user,\n value,\n onChange,\n onSubmit,\n onClose,\n title = \"Comment\",\n placeholder,\n submitLabel = \"Send\",\n showSubmit = true,\n pending = false,\n userList,\n mentionEmptyText,\n initialContent,\n className,\n}: CommentInputProps) {\n const handleSubmit = () => {\n if (!value.trim() || pending) return;\n onSubmit();\n };\n\n return (\n <div className={`aivex:rounded-2xl aivex:bg-bg-primary aivex:shadow-xl ${className ?? \"\"}`}>\n <div className=\"aivex:flex aivex:w-[360px] aivex:flex-col\">\n <div className=\"aivex:flex aivex:h-12 aivex:items-center aivex:justify-between aivex:border-border-subtle aivex:border-b aivex:px-5 aivex:py-2\">\n <span className=\"aivex:text-body-lg-medium aivex:text-text-primary\">{title}</span>\n <IconButton size=\"sm\" className=\"aivex:text-text-secondary\" onClick={onClose}>\n <CloseIcon size={20} />\n </IconButton>\n </div>\n <div className=\"aivex:flex aivex:flex-col aivex:px-4 aivex:py-3\">\n <div className=\"aivex:flex aivex:gap-1.5\">\n <div className=\"aivex:h-6 aivex:w-6 aivex:py-1\">\n {user ? (\n <Avatar size=\"sm\" src={user.avatarUrl} bgColor={user.color} name={user.name} />\n ) : null}\n </div>\n <div className=\"aivex:min-w-0 aivex:flex-1\">\n <MentionInput\n value={value}\n onChange={onChange}\n placeholder={placeholder}\n onSubmit={handleSubmit}\n onEscape={onClose}\n userList={userList}\n mentionEmptyText={mentionEmptyText}\n initialContent={initialContent}\n />\n </div>\n </div>\n {/* 전송 버튼은 빈 입력에서는 없다 — 내용이 생기면 아래로 밀려 나온다(시안).\n grid-rows 0fr↔1fr은 높이를 모르는 내용도 부드럽게 여닫는다. */}\n {showSubmit ? (\n <div\n className={`aivex:grid aivex:transition-[grid-template-rows,opacity] aivex:duration-200 aivex:ease-out ${\n value.trim()\n ? \"aivex:grid-rows-[1fr] aivex:opacity-100\"\n : \"aivex:pointer-events-none aivex:grid-rows-[0fr] aivex:opacity-0\"\n }`}\n >\n {/* 입력과 버튼 사이 6px(시안) — 접히는 안쪽에 둬야 함께 사라진다. */}\n <div className=\"aivex:flex aivex:justify-end aivex:overflow-hidden aivex:pt-1.5\">\n <Button\n size=\"md\"\n disabled={!value.trim() || pending}\n onClick={handleSubmit}\n tabIndex={value.trim() ? undefined : -1}\n >\n {submitLabel}\n </Button>\n </div>\n </div>\n ) : null}\n </div>\n </div>\n </div>\n );\n}\n","\"use client\";\n\nimport { Avatar } from \"../Avatar\";\nimport type { CommentUser } from \"./types\";\n\nexport interface CommentPinProps {\n /** 스레드 참여자(작성자 우선). 최대 maxAvatars명까지 아바타를 겹쳐 그린다. */\n users: CommentUser[];\n selected?: boolean;\n /** 해결(resolve)된 코멘트 — 반투명 표시. */\n resolved?: boolean;\n onClick?: () => void;\n maxAvatars?: number;\n className?: string;\n}\n\n/**\n * 코멘트 핀(다트) — 옵스 에디터 CommentDart의 말풍선 부분 이식.\n * 좌하단이 뾰족한 말풍선(팁이 코멘트 지점을 가리킴). 위치·스케일 고정은 호스트가\n * ShapeEditor overlayMarkers(anchor \"topLeft\") 등으로 담당한다.\n */\nexport function CommentPin({\n users,\n selected = false,\n resolved = false,\n onClick,\n maxAvatars = 3,\n className,\n}: CommentPinProps) {\n const shown = users.slice(0, maxAvatars);\n return (\n <button\n type=\"button\"\n onClick={onClick}\n className={`aivex:flex aivex:h-fit aivex:cursor-pointer aivex:items-center aivex:rounded-t-full aivex:rounded-br-full aivex:border aivex:p-1 aivex:transition-colors ${\n selected\n ? \"aivex:border-border-brand aivex:bg-bg-brand\"\n : \"aivex:border-border-subtle aivex:bg-bg-primary aivex:hover:border-border-brand\"\n } ${resolved ? \"aivex:opacity-40\" : \"\"} ${className ?? \"\"}`}\n >\n {shown.map((user, i) => (\n <span\n key={user.id}\n className=\"aivex:flex\"\n style={i > 0 ? { marginLeft: \"-4px\" } : undefined}\n >\n <Avatar size=\"xs\" src={user.avatarUrl} bgColor={user.color} name={user.name} />\n </span>\n ))}\n {users.length > maxAvatars ? (\n <span className=\"aivex:px-1 aivex:text-label-sm aivex:text-text-secondary\">\n +{users.length - maxAvatars}\n </span>\n ) : null}\n </button>\n );\n}\n"],"mappings":"kdA0BE,GAAM,EAAA,EAAA,MAAA,SAAgD,CAAA,QAAA,UAAA,YAAA,oBAAA,OAAA,CAEtD,GAAM,CAAA,EAAA,IACH,EAAA,EAAA,UAAkB,EAAA,CACjB,GAAa,EAAM,EAAA,QAAA,EAAA,CAAA,CACf,GAAc,EAAA,EAAK,aAAA,GAAA,KAExB,EAAO,EACT,GAED,GAAM,EAAA,EAAA,EAEF,CAAA,EAAA,EAAkB,CAAA,CAChB,GAAkB,EAAM,EAAA,aAAA,GAAA,CACxB,EAAI,GAAoB,CACxB,IAAA,EAAe,EAAK,cACpB,IAAA,MAAA,EAAA,EAAA,GAAA,GAEG,EAAO,GACf,GAED,EAEI,CAAA,EAAQ,OAAM,CAAA,CACZ,GAAK,EAAA,EAAA,aAAA,GAAA,CACH,OAAA,EAAA,IAAA,CACA,IAAA,UAEA,OADF,EAAK,KAAA,CACH,GACA,IAAA,YAEA,OADF,EAAK,OAAA,CACH,GACA,IAAA,eACF,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CAAA,8EACb,EAAA,EAAA,KAAA,MAAC,WACM,4EACkB,EAAI,EAAA,KAAA,EAAA,EAAA,CAC3B,KAAA,KACA,SAAU,CAAA,EAAM,MAAM,EAAG,YAGlB,SAAA,EAAA,MAAA,CAAA,IAAA,GAAA,GACL,SAAA,EACF,CAAA,CAGN,CAAA,SACF,CAAA,CAAA,KCxFR,SACE,EAAA,CAAA,QAAA,WAAA,GAAA,WAAC,GAAD,UAAA,aAAA,EAAA,aAAA,KACE,EAAK,EAAA,MAAA,EAAA,EAAA,QACI,EAAA,EAAA,MAAA,SAAA,CACT,KAAA,6BASI,4JAAU,EAAA,8CAAA,iFAAA,GAAA,EAAA,mBAAA,GAAA,GAAA,GAAA,cACH,CAAA,EAAQ,KAAE,EAAA,KAAuB,EAAA,EAAA,KAAA,OAAA,WAExC,mBAAa,EAAA,EAAA,CAAA,WAAA,OAAA,CAAA,IAAA,aAAe,EAAA,EAAA,KAAA,EAAA,EAAA,CAAW,KAAA,KAAqB,IAAA,EAAM,UAAa,QAAA,EAAA,MAC1E,KALK,EAMZ,KAEM,CAAA,OAAN,CAA2E,CAAA,EACvE,OAAM,GACH,EAAA,EAAA,MAAA,OAAA,WAEF"}
|
|
1
|
+
{"version":3,"file":"comment.cjs","names":[],"sources":["../src/components/Comment/mentionContent.ts","../src/components/Comment/MentionList.tsx","../src/components/Comment/useMentionSuggestion.ts","../src/components/Comment/MentionInput.tsx","../src/components/Comment/CommentInput.tsx","../src/components/Comment/CommentPin.tsx"],"sourcesContent":["import type { JSONContent } from \"@tiptap/react\";\n\n// MentionInput의 value 직렬화(멘션은 `@[이름](id)`, 줄바꿈은 \\n)와 tiptap 문서 사이 변환.\n\nconst MENTION_MARKUP = /@\\[([^\\]]*)\\]\\(([^)]*)\\)/g;\n\n/** 평문 직렬화 → tiptap 문서. extractContentFromJSON의 역 — 줄마다 문단, 멘션 마크업은 멘션 노드. */\nexport function parseContentToJSON(value: string): JSONContent {\n return {\n type: \"doc\",\n content: value.split(\"\\n\").map((line) => {\n const content: JSONContent[] = [];\n let last = 0;\n for (const match of line.matchAll(MENTION_MARKUP)) {\n const [whole, label, id] = match;\n const start = match.index ?? 0;\n if (start > last) content.push({ type: \"text\", text: line.slice(last, start) });\n content.push({ type: \"mention\", attrs: { id, label } });\n last = start + whole.length;\n }\n if (last < line.length) content.push({ type: \"text\", text: line.slice(last) });\n return content.length > 0 ? { type: \"paragraph\", content } : { type: \"paragraph\" };\n }),\n };\n}\n\n/** tiptap 문서 → 평문(멘션은 `@[이름](id)`, 줄바꿈은 \\n) 직렬화. */\nexport function extractContentFromJSON(json: JSONContent): string {\n if (!json?.content) return \"\";\n\n const processNode = (node: JSONContent): string => {\n if (node.type === \"mention\" && node.attrs) {\n return `@[${node.attrs.label}](${node.attrs.id})`;\n }\n if (node.type === \"text\") return node.text || \"\";\n // Shift+Enter가 넣는 줄바꿈 — 문단 분리(아래 join)와 같은 값으로 편다.\n if (node.type === \"hardBreak\") return \"\\n\";\n if (node.content) return node.content.map(processNode).join(\"\");\n return \"\";\n };\n // 문단마다 한 줄 — 보조키+Enter로 문단이 갈리면 그대로 줄이 나뉜다.\n return json.content.map(processNode).join(\"\\n\");\n}\n","\"use client\";\n\nimport { memo, useCallback, useEffect, useImperativeHandle, useRef, useState } from \"react\";\nimport { Avatar } from \"../Avatar\";\nimport type { CommentUser } from \"./types\";\n\nexport interface MentionListHandle {\n onKeyDown: (event: KeyboardEvent) => boolean;\n}\n\ninterface MentionListProps {\n items: CommentUser[];\n command: (item: CommentUser) => void;\n /** 후보 없음 문구(호스트 i18n). 기본 \"No results found.\" */\n emptyText?: string;\n ref?: React.Ref<MentionListHandle>;\n}\n\n/** 멘션(@) 자동완성 목록 — 옵스 에디터 MentionList 이식(도메인 결합 제거). */\nconst MentionList = memo(function MentionList({\n items,\n command,\n emptyText = \"No results found.\",\n ref,\n}: MentionListProps) {\n const [selectedIndex, setSelectedIndex] = useState(0);\n const itemRefs = useRef<(HTMLDivElement | null)[]>([]);\n\n const selectItem = useCallback(\n (index: number) => {\n const item = items[index];\n if (item) command(item);\n },\n [items, command],\n );\n\n const moveSelection = useCallback(\n (direction: \"up\" | \"down\") => {\n setSelectedIndex((prev) => {\n const itemCount = items.length;\n if (direction === \"up\") return (prev + itemCount - 1) % itemCount;\n return (prev + 1) % itemCount;\n });\n },\n [items.length],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent): boolean => {\n switch (event.key) {\n case \"ArrowUp\":\n moveSelection(\"up\");\n return true;\n case \"ArrowDown\":\n moveSelection(\"down\");\n return true;\n case \"Enter\":\n selectItem(selectedIndex);\n return true;\n default:\n return false;\n }\n },\n [moveSelection, selectItem, selectedIndex],\n );\n\n useEffect(() => {\n setSelectedIndex(0);\n itemRefs.current = items.map(() => null);\n }, [items]);\n\n useEffect(() => {\n itemRefs.current[selectedIndex]?.scrollIntoView({ behavior: \"smooth\", block: \"nearest\" });\n }, [selectedIndex]);\n\n useImperativeHandle(ref, () => ({ onKeyDown: handleKeyDown }), [handleKeyDown]);\n\n if (!items.length) {\n return (\n <div className=\"aivex:min-w-[298px] aivex:max-w-[328px] aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:py-2 aivex:shadow-xl\">\n <div className=\"aivex:p-2 aivex:text-body-md-regular aivex:text-text-secondary\">\n {emptyText}\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"aivex:h-full aivex:max-h-[248px] aivex:min-w-[298px] aivex:max-w-[328px] aivex:overflow-y-auto aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:py-2 aivex:shadow-xl\">\n {items.map((item, index) => (\n // 키보드 상호작용은 tiptap 에디터가 MentionListHandle로 위임 처리한다.\n <div\n key={item.id}\n ref={(el) => {\n itemRefs.current[index] = el;\n }}\n className={`aivex:flex aivex:h-[52px] aivex:cursor-pointer aivex:items-center aivex:gap-2 aivex:px-4 aivex:py-2 ${\n selectedIndex === index ? \"aivex:bg-bg-brand-subtle\" : \"\"\n }`}\n onClick={() => selectItem(index)}\n >\n <Avatar size=\"sm\" src={item.avatarUrl} bgColor={item.color} name={item.name} />\n <div className=\"aivex:flex aivex:max-w-[260px] aivex:flex-col\">\n <div className=\"aivex:truncate aivex:text-label-md aivex:text-text-primary\">\n {item.name}\n </div>\n {item.email ? (\n <div className=\"aivex:truncate aivex:text-body-sm-regular aivex:text-text-secondary\">\n {item.email}\n </div>\n ) : null}\n </div>\n </div>\n ))}\n </div>\n );\n});\n\nexport default MentionList;\n","\"use client\";\n\nimport { ReactRenderer } from \"@tiptap/react\";\nimport { useMemo } from \"react\";\nimport tippy, { type Instance as TippyInstance } from \"tippy.js\";\nimport MentionList, { type MentionListHandle } from \"./MentionList\";\nimport type { CommentUser } from \"./types\";\n\n/** tiptap Mention 확장에 꽂는 자동완성 설정 — 옵스 에디터 이식(CommentUser 기반). */\nexport const useMentionSuggestion = (\n userList: CommentUser[],\n onOpenChange?: (isOpen: boolean) => void,\n emptyText?: string,\n) => {\n return useMemo(() => {\n const filterUsers = (query: string) => {\n if (!query) return userList;\n const q = query.toLowerCase();\n return userList.filter(\n (user) =>\n user.name.toLowerCase().includes(q) || (user.email ?? \"\").toLowerCase().includes(q),\n );\n };\n\n const createCommandHandler =\n (originalCommand: (item: { id: string; label: string }) => void) => (item: CommentUser) => {\n originalCommand({ id: item.id, label: item.name });\n };\n\n const createRenderer = () => {\n let component: ReactRenderer<MentionListHandle> | null = null;\n let popup: TippyInstance[] | null = null;\n\n return {\n // biome-ignore lint/suspicious/noExplicitAny: tiptap suggestion props는 확장별 동적 형태라 상위 타입이 없다\n onStart: (props: Record<string, any>) => {\n component = new ReactRenderer(MentionList, {\n props: {\n ...props,\n emptyText,\n command: createCommandHandler(props.command),\n },\n editor: props.editor,\n });\n\n if (!props.clientRect) return;\n\n popup = tippy(\"body\", {\n getReferenceClientRect: props.clientRect,\n appendTo: () => document.body,\n content: component.element,\n showOnCreate: true,\n interactive: true,\n trigger: \"manual\",\n placement: \"bottom-start\",\n });\n\n onOpenChange?.(true);\n },\n\n // biome-ignore lint/suspicious/noExplicitAny: tiptap suggestion props는 확장별 동적 형태라 상위 타입이 없다\n onUpdate(props: Record<string, any>) {\n component?.updateProps({\n ...props,\n emptyText,\n command: createCommandHandler(props.command),\n });\n\n if (!props.clientRect) return;\n\n popup?.[0]?.setProps({ getReferenceClientRect: props.clientRect });\n },\n\n onKeyDown(props: { event: KeyboardEvent }) {\n if (props.event.key === \"Escape\") {\n if (popup?.[0] && !popup[0].state.isDestroyed) popup[0].hide();\n onOpenChange?.(false);\n return true;\n }\n return component?.ref?.onKeyDown(props.event) || false;\n },\n\n onExit() {\n if (popup?.[0] && !popup[0].state.isDestroyed) popup[0].destroy();\n component?.destroy();\n popup = null;\n component = null;\n onOpenChange?.(false);\n },\n };\n };\n\n return {\n items: ({ query }: { query: string }) => filterUsers(query),\n render: createRenderer,\n };\n }, [userList, onOpenChange, emptyText]);\n};\n","\"use client\";\n\nimport Mention from \"@tiptap/extension-mention\";\nimport Placeholder from \"@tiptap/extension-placeholder\";\nimport { EditorContent, type JSONContent, mergeAttributes, useEditor } from \"@tiptap/react\";\nimport StarterKit from \"@tiptap/starter-kit\";\nimport { type Ref, useEffect, useImperativeHandle, useRef, useState } from \"react\";\nimport { extractContentFromJSON, parseContentToJSON } from \"./mentionContent\";\nimport type { CommentUser } from \"./types\";\nimport { useMentionSuggestion } from \"./useMentionSuggestion\";\n\nexport interface MentionInputHandle {\n /** 입력기에 포커스를 준다(예: 전송 버튼 클릭 후 포커스 유지). */\n focus: () => void;\n}\n\nexport interface MentionInputProps {\n value: string;\n onChange: (value: string) => void;\n placeholder?: string;\n /** Enter(멘션 목록 닫힌 상태) 제출. */\n onSubmit?: () => void;\n /** Esc(멘션 목록 닫힌 상태) 취소. */\n onEscape?: () => void;\n /** 멘션(@) 후보. 빈 배열이면 멘션 없이 플레인 입력처럼 동작한다. */\n userList?: CommentUser[];\n initialContent?: JSONContent;\n /** 멘션 후보 없음 문구(호스트 i18n). */\n mentionEmptyText?: string;\n /** 마운트 시 자동 포커스(기본 true). */\n autoFocus?: boolean;\n /** 명령형 핸들(포커스 제어). */\n handleRef?: Ref<MentionInputHandle>;\n}\n\n/**\n * 멘션(@) 지원 코멘트 입력기 — 옵스 에디터 MentionInput 이식.\n * value는 평문 직렬화(`@[이름](id)`)로 주고받는다.\n */\nexport default function MentionInput({\n value,\n onChange,\n placeholder,\n onSubmit,\n onEscape,\n userList = [],\n initialContent,\n mentionEmptyText,\n autoFocus = true,\n handleRef,\n}: MentionInputProps) {\n const editorRef = useRef<HTMLDivElement>(null);\n const [isMentionListOpen, setIsMentionListOpen] = useState(false);\n const suggestion = useMentionSuggestion(userList, setIsMentionListOpen, mentionEmptyText);\n\n const editor = useEditor({\n extensions: [\n StarterKit,\n Placeholder.configure({\n placeholder,\n emptyEditorClass:\n \"aivex:before:content-[attr(data-placeholder)] aivex:before:text-text-tertiary aivex:before:absolute aivex:before:left-3\",\n }),\n Mention.configure({\n HTMLAttributes: { class: \"aivex:text-text-brand aivex:px-1\" },\n // 멘션이 확정되면 골뱅이는 사라지고 이름만 남는다(시안) — 확정 전\n // 타이핑 중인 \"@검색어\"는 그대로다. 직렬화 형식은 바뀌지 않는다.\n renderHTML({ options, node }) {\n return [\"span\", mergeAttributes(options.HTMLAttributes), `${node.attrs.label}`];\n },\n renderText({ node }) {\n return `@[${node.attrs.label}](${node.attrs.id})`;\n },\n deleteTriggerWithBackspace: true,\n suggestion,\n }),\n ],\n // value는 직렬화 문자열이라 그대로 넣으면 `@[이름](id)`가 글자로 보인다 — 멘션 노드 문서로 되돌려 넣는다.\n content: initialContent || parseContentToJSON(value),\n // SSR 환경(next 등)에서 hydration 불일치 방지.\n immediatelyRender: false,\n editorProps: {\n attributes: {\n // 줄높이 22(내부 p에 강제) + py 8 + 보더 2 = 32px — 옆의 Send 버튼(h-8)과 높이 일치.\n class:\n \"aivex:px-3 aivex:py-1 aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-secondary aivex:focus:border-border-brand aivex:outline-none aivex:text-body-md-regular aivex:text-text-primary aivex:cursor-text aivex:[&_p]:leading-[22px]\",\n },\n handleKeyDown: (_view, event) => {\n if (event.key === \"Enter\") {\n if (isMentionListOpen) return false;\n // 보조키를 짚은 Enter는 전송이 아니라 개행 — tiptap 기본 동작에 맡긴다.\n if (event.shiftKey || event.metaKey || event.ctrlKey || event.altKey) {\n return false;\n }\n event.preventDefault();\n if (value.trim() && onSubmit) onSubmit();\n return true;\n }\n if (event.key === \"Escape\") {\n if (isMentionListOpen || !onEscape) return false;\n event.preventDefault();\n onEscape();\n return true;\n }\n return false;\n },\n },\n onUpdate: ({ editor }) => {\n onChange(extractContentFromJSON(editor.getJSON()));\n },\n });\n\n // Radix는 document capture에서 Esc를 받는다. 입력기 내부의 Esc는 그보다\n // 먼저 공개 ProseMirror 키 핸들러로 처리해 멘션/편집 취소가 부모를 닫지 않게 한다.\n useEffect(() => {\n if (!editor || (!isMentionListOpen && !onEscape)) return;\n const view = editor.view;\n const ownerWindow = view.dom.ownerDocument.defaultView;\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\" || event.defaultPrevented) return;\n if (!(event.target instanceof Node) || !view.dom.contains(event.target)) return;\n if (view.someProp(\"handleKeyDown\", (handler) => handler(view, event))) {\n event.preventDefault();\n event.stopPropagation();\n }\n };\n ownerWindow?.addEventListener(\"keydown\", onKeyDown, true);\n return () => ownerWindow?.removeEventListener(\"keydown\", onKeyDown, true);\n }, [editor, isMentionListOpen, onEscape]);\n\n useEffect(() => {\n // 비교도 같은 직렬화로 한다 — getText()는 문단을 빈 줄로 이어 값이 늘 달라 보인다.\n if (editor && !initialContent && value !== extractContentFromJSON(editor.getJSON())) {\n editor.commands.setContent(parseContentToJSON(value));\n }\n }, [value, editor, initialContent]);\n\n useEffect(() => {\n if (editor && autoFocus) {\n requestAnimationFrame(() => {\n editor.commands.focus();\n });\n }\n }, [editor, autoFocus]);\n\n useImperativeHandle(\n handleRef,\n () => ({\n focus: () => {\n editor?.commands.focus();\n },\n }),\n [editor],\n );\n\n return (\n <EditorContent\n ref={editorRef}\n editor={editor}\n className=\"aivex:relative aivex:h-full aivex:w-full\"\n onKeyDown={(e) => e.stopPropagation()}\n />\n );\n}\n","\"use client\";\n\nimport type { JSONContent } from \"@tiptap/react\";\nimport { Avatar } from \"../Avatar\";\nimport { Button } from \"../Button\";\nimport { CloseIcon } from \"../Icon\";\nimport { IconButton } from \"../IconButton\";\nimport MentionInput from \"./MentionInput\";\nimport type { CommentUser } from \"./types\";\n\nexport interface CommentInputProps {\n /** 작성자(입력행 아바타). */\n user?: CommentUser;\n value: string;\n onChange: (value: string) => void;\n /** 전송(Enter 또는 Send 버튼). 값이 비어 있으면 호출되지 않는다. */\n onSubmit: () => void;\n /** 헤더 닫기 버튼·Esc. */\n onClose?: () => void;\n /** 헤더 타이틀(호스트 i18n). 기본 \"Comment\". */\n title?: string;\n placeholder?: string;\n /** 전송 버튼 라벨(호스트 i18n). 기본 \"Send\". */\n submitLabel?: string;\n /**\n * 전송 버튼 사용 — 켜면 내용이 있을 때만 입력 아래 오른쪽에 나타난다(시안).\n * 끄면 어느 상태에서도 없이 Enter로만 보낸다.\n */\n showSubmit?: boolean;\n /** 전송 중 여부 — 버튼 비활성(스피너 등은 호스트가 submitLabel 자리로). */\n pending?: boolean;\n /** 멘션(@) 후보. 생략하면 멘션 없이 동작. */\n userList?: CommentUser[];\n mentionEmptyText?: string;\n initialContent?: JSONContent;\n className?: string;\n}\n\n/**\n * 새 코멘트 입력 패널 — 옵스 new-editor의 NewCommentPanel 이식(도메인/위치 결합 제거).\n * 코멘트 스레드와 동일한 크롬: 헤더(타이틀+닫기) + 입력행(아바타 · 멘션 입력 · 오른쪽\n * Send 버튼). 화면 배치(핀 오른쪽 등)는 호스트가 감싸는 컨테이너에서 담당한다.\n */\nexport function CommentInput({\n user,\n value,\n onChange,\n onSubmit,\n onClose,\n title = \"Comment\",\n placeholder,\n submitLabel = \"Send\",\n showSubmit = true,\n pending = false,\n userList,\n mentionEmptyText,\n initialContent,\n className,\n}: CommentInputProps) {\n const handleSubmit = () => {\n if (!value.trim() || pending) return;\n onSubmit();\n };\n\n return (\n <div className={`aivex:rounded-2xl aivex:bg-bg-primary aivex:shadow-xl ${className ?? \"\"}`}>\n <div className=\"aivex:flex aivex:w-[360px] aivex:flex-col\">\n <div className=\"aivex:flex aivex:h-12 aivex:items-center aivex:justify-between aivex:border-border-subtle aivex:border-b aivex:px-5 aivex:py-2\">\n <span className=\"aivex:text-body-lg-medium aivex:text-text-primary\">{title}</span>\n <IconButton size=\"sm\" className=\"aivex:text-text-secondary\" onClick={onClose}>\n <CloseIcon size={20} />\n </IconButton>\n </div>\n <div className=\"aivex:flex aivex:flex-col aivex:px-4 aivex:py-3\">\n <div className=\"aivex:flex aivex:gap-1.5\">\n <div className=\"aivex:h-6 aivex:w-6 aivex:py-1\">\n {user ? (\n <Avatar size=\"sm\" src={user.avatarUrl} bgColor={user.color} name={user.name} />\n ) : null}\n </div>\n <div className=\"aivex:min-w-0 aivex:flex-1\">\n <MentionInput\n value={value}\n onChange={onChange}\n placeholder={placeholder}\n onSubmit={handleSubmit}\n onEscape={onClose}\n userList={userList}\n mentionEmptyText={mentionEmptyText}\n initialContent={initialContent}\n />\n </div>\n </div>\n {/* 전송 버튼은 빈 입력에서는 없다 — 내용이 생기면 아래로 밀려 나온다(시안).\n grid-rows 0fr↔1fr은 높이를 모르는 내용도 부드럽게 여닫는다. */}\n {showSubmit ? (\n <div\n className={`aivex:grid aivex:transition-[grid-template-rows,opacity] aivex:duration-200 aivex:ease-out ${\n value.trim()\n ? \"aivex:grid-rows-[1fr] aivex:opacity-100\"\n : \"aivex:pointer-events-none aivex:grid-rows-[0fr] aivex:opacity-0\"\n }`}\n >\n {/* 입력과 버튼 사이 6px(시안) — 접히는 안쪽에 둬야 함께 사라진다. */}\n <div className=\"aivex:flex aivex:justify-end aivex:overflow-hidden aivex:pt-1.5\">\n <Button\n size=\"md\"\n disabled={!value.trim() || pending}\n onClick={handleSubmit}\n tabIndex={value.trim() ? undefined : -1}\n >\n {submitLabel}\n </Button>\n </div>\n </div>\n ) : null}\n </div>\n </div>\n </div>\n );\n}\n","\"use client\";\n\nimport { Avatar } from \"../Avatar\";\nimport type { CommentUser } from \"./types\";\n\nexport interface CommentPinProps {\n /** 스레드 참여자(작성자 우선). 최대 maxAvatars명까지 아바타를 겹쳐 그린다. */\n users: CommentUser[];\n selected?: boolean;\n /** 해결(resolve)된 코멘트 — 반투명 표시. */\n resolved?: boolean;\n onClick?: () => void;\n maxAvatars?: number;\n className?: string;\n}\n\n/**\n * 코멘트 핀(다트) — 옵스 에디터 CommentDart의 말풍선 부분 이식.\n * 좌하단이 뾰족한 말풍선(팁이 코멘트 지점을 가리킴). 위치·스케일 고정은 호스트가\n * ShapeEditor overlayMarkers(anchor \"topLeft\") 등으로 담당한다.\n */\nexport function CommentPin({\n users,\n selected = false,\n resolved = false,\n onClick,\n maxAvatars = 3,\n className,\n}: CommentPinProps) {\n const shown = users.slice(0, maxAvatars);\n return (\n <button\n type=\"button\"\n onClick={onClick}\n className={`aivex:flex aivex:h-fit aivex:cursor-pointer aivex:items-center aivex:rounded-t-full aivex:rounded-br-full aivex:border aivex:p-1 aivex:transition-colors ${\n selected\n ? \"aivex:border-border-brand aivex:bg-bg-brand\"\n : \"aivex:border-border-subtle aivex:bg-bg-primary aivex:hover:border-border-brand\"\n } ${resolved ? \"aivex:opacity-40\" : \"\"} ${className ?? \"\"}`}\n >\n {shown.map((user, i) => (\n <span\n key={user.id}\n className=\"aivex:flex\"\n style={i > 0 ? { marginLeft: \"-4px\" } : undefined}\n >\n <Avatar size=\"xs\" src={user.avatarUrl} bgColor={user.color} name={user.name} />\n </span>\n ))}\n {users.length > maxAvatars ? (\n <span className=\"aivex:px-1 aivex:text-label-sm aivex:text-text-secondary\">\n +{users.length - maxAvatars}\n </span>\n ) : null}\n </button>\n );\n}\n"],"mappings":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ACkB,EAAI,EAAA,KAAA,EAAA,EAAA,CAC3B,KAAA,KACA,SAAU,CAAA,EAAM,MAAM,EAAG,YAGlB,SAAA,EAAA,MAAA,CAAA,IAAA,GAAA,GACL,SAAA,EACF,CAAA,CAGN,CAAA,SACF,CAAA,CAAA,KCxFR,SACE,EAAA,CAAA,QAAA,WAAA,GAAA,WAAC,GAAD,UAAA,aAAA,EAAA,aAAA,KACE,EAAK,EAAA,MAAA,EAAA,EAAA,QACI,EAAA,EAAA,MAAA,SAAA,CACT,KAAA,6BASI,4JAAU,EAAA,8CAAA,iFAAA,GAAA,EAAA,mBAAA,GAAA,GAAA,GAAA,cACH,CAAA,EAAQ,KAAE,EAAA,KAAuB,EAAA,EAAA,KAAA,OAAA,WAExC,mBAAa,EAAA,EAAA,CAAA,WAAA,OAAA,CAAA,IAAA,aAAe,EAAA,EAAA,KAAA,EAAA,EAAA,CAAW,KAAA,KAAqB,IAAA,EAAM,UAAa,QAAA,EAAA,MAC1E,KALK,EAMZ,KAEM,CAAA,OAAN,CAA2E,CAAA,EACvE,OAAM,GACH,EAAA,EAAA,MAAA,OAAA,WAEF"}
|
package/dist/comment.js
CHANGED
|
@@ -9,8 +9,44 @@ import m from "@tiptap/extension-placeholder";
|
|
|
9
9
|
import { EditorContent as h, ReactRenderer as g, mergeAttributes as _, useEditor as v } from "@tiptap/react";
|
|
10
10
|
import y from "@tiptap/starter-kit";
|
|
11
11
|
import b from "tippy.js";
|
|
12
|
+
//#region src/components/Comment/mentionContent.ts
|
|
13
|
+
var x = /@\[([^\]]*)\]\(([^)]*)\)/g;
|
|
14
|
+
function S(e) {
|
|
15
|
+
return {
|
|
16
|
+
type: "doc",
|
|
17
|
+
content: e.split("\n").map((e) => {
|
|
18
|
+
let t = [], n = 0;
|
|
19
|
+
for (let r of e.matchAll(x)) {
|
|
20
|
+
let [i, a, o] = r, s = r.index ?? 0;
|
|
21
|
+
s > n && t.push({
|
|
22
|
+
type: "text",
|
|
23
|
+
text: e.slice(n, s)
|
|
24
|
+
}), t.push({
|
|
25
|
+
type: "mention",
|
|
26
|
+
attrs: {
|
|
27
|
+
id: o,
|
|
28
|
+
label: a
|
|
29
|
+
}
|
|
30
|
+
}), n = s + i.length;
|
|
31
|
+
}
|
|
32
|
+
return n < e.length && t.push({
|
|
33
|
+
type: "text",
|
|
34
|
+
text: e.slice(n)
|
|
35
|
+
}), t.length > 0 ? {
|
|
36
|
+
type: "paragraph",
|
|
37
|
+
content: t
|
|
38
|
+
} : { type: "paragraph" };
|
|
39
|
+
})
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function C(e) {
|
|
43
|
+
if (!e?.content) return "";
|
|
44
|
+
let t = (e) => e.type === "mention" && e.attrs ? `@[${e.attrs.label}](${e.attrs.id})` : e.type === "text" ? e.text || "" : e.type === "hardBreak" ? "\n" : e.content ? e.content.map(t).join("") : "";
|
|
45
|
+
return e.content.map(t).join("\n");
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
12
48
|
//#region src/components/Comment/MentionList.tsx
|
|
13
|
-
var
|
|
49
|
+
var w = o(function({ items: t, command: n, emptyText: r = "No results found.", ref: o }) {
|
|
14
50
|
let [u, p] = f(0), m = d([]), h = s((e) => {
|
|
15
51
|
let r = t[e];
|
|
16
52
|
r && n(r);
|
|
@@ -69,7 +105,7 @@ var x = o(function({ items: t, command: n, emptyText: r = "No results found.", r
|
|
|
69
105
|
children: r
|
|
70
106
|
})
|
|
71
107
|
});
|
|
72
|
-
}),
|
|
108
|
+
}), T = (e, t, n) => u(() => {
|
|
73
109
|
let r = (t) => {
|
|
74
110
|
if (!t) return e;
|
|
75
111
|
let n = t.toLowerCase();
|
|
@@ -86,7 +122,7 @@ var x = o(function({ items: t, command: n, emptyText: r = "No results found.", r
|
|
|
86
122
|
let e = null, r = null;
|
|
87
123
|
return {
|
|
88
124
|
onStart: (a) => {
|
|
89
|
-
e = new g(
|
|
125
|
+
e = new g(w, {
|
|
90
126
|
props: {
|
|
91
127
|
...a,
|
|
92
128
|
emptyText: n,
|
|
@@ -126,8 +162,8 @@ var x = o(function({ items: t, command: n, emptyText: r = "No results found.", r
|
|
|
126
162
|
]);
|
|
127
163
|
//#endregion
|
|
128
164
|
//#region src/components/Comment/MentionInput.tsx
|
|
129
|
-
function
|
|
130
|
-
let x = d(null), [
|
|
165
|
+
function E({ value: e, onChange: t, placeholder: n, onSubmit: r, onEscape: a, userList: o = [], initialContent: s, mentionEmptyText: u, autoFocus: g = !0, handleRef: b }) {
|
|
166
|
+
let x = d(null), [w, E] = f(!1), D = T(o, E, u), O = v({
|
|
131
167
|
extensions: [
|
|
132
168
|
y,
|
|
133
169
|
m.configure({
|
|
@@ -147,56 +183,51 @@ function C({ value: e, onChange: t, placeholder: n, onSubmit: r, onEscape: a, us
|
|
|
147
183
|
return `@[${e.attrs.label}](${e.attrs.id})`;
|
|
148
184
|
},
|
|
149
185
|
deleteTriggerWithBackspace: !0,
|
|
150
|
-
suggestion:
|
|
186
|
+
suggestion: D
|
|
151
187
|
})
|
|
152
188
|
],
|
|
153
|
-
content: s || e,
|
|
189
|
+
content: s || S(e),
|
|
154
190
|
immediatelyRender: !1,
|
|
155
191
|
editorProps: {
|
|
156
192
|
attributes: { class: "aivex:px-3 aivex:py-1 aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-secondary aivex:focus:border-border-brand aivex:outline-none aivex:text-body-md-regular aivex:text-text-primary aivex:cursor-text aivex:[&_p]:leading-[22px]" },
|
|
157
|
-
handleKeyDown: (t, n) => n.key === "Enter" ?
|
|
193
|
+
handleKeyDown: (t, n) => n.key === "Enter" ? w || n.shiftKey || n.metaKey || n.ctrlKey || n.altKey ? !1 : (n.preventDefault(), e.trim() && r && r(), !0) : n.key === "Escape" ? w || !a ? !1 : (n.preventDefault(), a(), !0) : !1
|
|
158
194
|
},
|
|
159
195
|
onUpdate: ({ editor: e }) => {
|
|
160
|
-
t(
|
|
196
|
+
t(C(e.getJSON()));
|
|
161
197
|
}
|
|
162
198
|
});
|
|
163
199
|
return c(() => {
|
|
164
|
-
if (!
|
|
165
|
-
let e =
|
|
200
|
+
if (!O || !w && !a) return;
|
|
201
|
+
let e = O.view, t = e.dom.ownerDocument.defaultView, n = (t) => {
|
|
166
202
|
t.key !== "Escape" || t.defaultPrevented || !(t.target instanceof Node) || !e.dom.contains(t.target) || e.someProp("handleKeyDown", (n) => n(e, t)) && (t.preventDefault(), t.stopPropagation());
|
|
167
203
|
};
|
|
168
204
|
return t?.addEventListener("keydown", n, !0), () => t?.removeEventListener("keydown", n, !0);
|
|
169
205
|
}, [
|
|
170
|
-
|
|
171
|
-
|
|
206
|
+
O,
|
|
207
|
+
w,
|
|
172
208
|
a
|
|
173
209
|
]), c(() => {
|
|
174
|
-
|
|
210
|
+
O && !s && e !== C(O.getJSON()) && O.commands.setContent(S(e));
|
|
175
211
|
}, [
|
|
176
212
|
e,
|
|
177
|
-
|
|
213
|
+
O,
|
|
178
214
|
s
|
|
179
215
|
]), c(() => {
|
|
180
|
-
|
|
181
|
-
|
|
216
|
+
O && g && requestAnimationFrame(() => {
|
|
217
|
+
O.commands.focus();
|
|
182
218
|
});
|
|
183
|
-
}, [
|
|
184
|
-
|
|
185
|
-
} }), [
|
|
219
|
+
}, [O, g]), l(b, () => ({ focus: () => {
|
|
220
|
+
O?.commands.focus();
|
|
221
|
+
} }), [O]), /* @__PURE__ */ i(h, {
|
|
186
222
|
ref: x,
|
|
187
|
-
editor:
|
|
223
|
+
editor: O,
|
|
188
224
|
className: "aivex:relative aivex:h-full aivex:w-full",
|
|
189
225
|
onKeyDown: (e) => e.stopPropagation()
|
|
190
226
|
});
|
|
191
227
|
}
|
|
192
|
-
function w(e) {
|
|
193
|
-
if (!e?.content) return "";
|
|
194
|
-
let t = (e) => e.type === "mention" && e.attrs ? `@[${e.attrs.label}](${e.attrs.id})` : e.type === "text" ? e.text || "" : e.type === "hardBreak" ? "\n" : e.content ? e.content.map(t).join("") : "";
|
|
195
|
-
return e.content.map(t).join("\n");
|
|
196
|
-
}
|
|
197
228
|
//#endregion
|
|
198
229
|
//#region src/components/Comment/CommentInput.tsx
|
|
199
|
-
function
|
|
230
|
+
function D({ user: o, value: s, onChange: c, onSubmit: l, onClose: u, title: d = "Comment", placeholder: f, submitLabel: p = "Send", showSubmit: m = !0, pending: h = !1, userList: g, mentionEmptyText: _, initialContent: v, className: y }) {
|
|
200
231
|
let b = () => {
|
|
201
232
|
!s.trim() || h || l();
|
|
202
233
|
};
|
|
@@ -229,7 +260,7 @@ function T({ user: o, value: s, onChange: c, onSubmit: l, onClose: u, title: d =
|
|
|
229
260
|
}) : null
|
|
230
261
|
}), /* @__PURE__ */ i("div", {
|
|
231
262
|
className: "aivex:min-w-0 aivex:flex-1",
|
|
232
|
-
children: /* @__PURE__ */ i(
|
|
263
|
+
children: /* @__PURE__ */ i(E, {
|
|
233
264
|
value: s,
|
|
234
265
|
onChange: c,
|
|
235
266
|
placeholder: f,
|
|
@@ -259,7 +290,7 @@ function T({ user: o, value: s, onChange: c, onSubmit: l, onClose: u, title: d =
|
|
|
259
290
|
}
|
|
260
291
|
//#endregion
|
|
261
292
|
//#region src/components/Comment/CommentPin.tsx
|
|
262
|
-
function
|
|
293
|
+
function O({ users: t, selected: n = !1, resolved: r = !1, onClick: o, maxAvatars: s = 3, className: c }) {
|
|
263
294
|
let l = t.slice(0, s);
|
|
264
295
|
return /* @__PURE__ */ a("button", {
|
|
265
296
|
type: "button",
|
|
@@ -281,6 +312,6 @@ function E({ users: t, selected: n = !1, resolved: r = !1, onClick: o, maxAvatar
|
|
|
281
312
|
});
|
|
282
313
|
}
|
|
283
314
|
//#endregion
|
|
284
|
-
export {
|
|
315
|
+
export { D as CommentInput, O as CommentPin, E as MentionInput };
|
|
285
316
|
|
|
286
317
|
//# sourceMappingURL=comment.js.map
|
package/dist/comment.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comment.js","names":[],"sources":["../src/components/Comment/MentionList.tsx","../src/components/Comment/useMentionSuggestion.ts","../src/components/Comment/MentionInput.tsx","../src/components/Comment/CommentInput.tsx","../src/components/Comment/CommentPin.tsx"],"sourcesContent":["\"use client\";\n\nimport { memo, useCallback, useEffect, useImperativeHandle, useRef, useState } from \"react\";\nimport { Avatar } from \"../Avatar\";\nimport type { CommentUser } from \"./types\";\n\nexport interface MentionListHandle {\n onKeyDown: (event: KeyboardEvent) => boolean;\n}\n\ninterface MentionListProps {\n items: CommentUser[];\n command: (item: CommentUser) => void;\n /** 후보 없음 문구(호스트 i18n). 기본 \"No results found.\" */\n emptyText?: string;\n ref?: React.Ref<MentionListHandle>;\n}\n\n/** 멘션(@) 자동완성 목록 — 옵스 에디터 MentionList 이식(도메인 결합 제거). */\nconst MentionList = memo(function MentionList({\n items,\n command,\n emptyText = \"No results found.\",\n ref,\n}: MentionListProps) {\n const [selectedIndex, setSelectedIndex] = useState(0);\n const itemRefs = useRef<(HTMLDivElement | null)[]>([]);\n\n const selectItem = useCallback(\n (index: number) => {\n const item = items[index];\n if (item) command(item);\n },\n [items, command],\n );\n\n const moveSelection = useCallback(\n (direction: \"up\" | \"down\") => {\n setSelectedIndex((prev) => {\n const itemCount = items.length;\n if (direction === \"up\") return (prev + itemCount - 1) % itemCount;\n return (prev + 1) % itemCount;\n });\n },\n [items.length],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent): boolean => {\n switch (event.key) {\n case \"ArrowUp\":\n moveSelection(\"up\");\n return true;\n case \"ArrowDown\":\n moveSelection(\"down\");\n return true;\n case \"Enter\":\n selectItem(selectedIndex);\n return true;\n default:\n return false;\n }\n },\n [moveSelection, selectItem, selectedIndex],\n );\n\n useEffect(() => {\n setSelectedIndex(0);\n itemRefs.current = items.map(() => null);\n }, [items]);\n\n useEffect(() => {\n itemRefs.current[selectedIndex]?.scrollIntoView({ behavior: \"smooth\", block: \"nearest\" });\n }, [selectedIndex]);\n\n useImperativeHandle(ref, () => ({ onKeyDown: handleKeyDown }), [handleKeyDown]);\n\n if (!items.length) {\n return (\n <div className=\"aivex:min-w-[298px] aivex:max-w-[328px] aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:py-2 aivex:shadow-xl\">\n <div className=\"aivex:p-2 aivex:text-body-md-regular aivex:text-text-secondary\">\n {emptyText}\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"aivex:h-full aivex:max-h-[248px] aivex:min-w-[298px] aivex:max-w-[328px] aivex:overflow-y-auto aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:py-2 aivex:shadow-xl\">\n {items.map((item, index) => (\n // 키보드 상호작용은 tiptap 에디터가 MentionListHandle로 위임 처리한다.\n <div\n key={item.id}\n ref={(el) => {\n itemRefs.current[index] = el;\n }}\n className={`aivex:flex aivex:h-[52px] aivex:cursor-pointer aivex:items-center aivex:gap-2 aivex:px-4 aivex:py-2 ${\n selectedIndex === index ? \"aivex:bg-bg-brand-subtle\" : \"\"\n }`}\n onClick={() => selectItem(index)}\n >\n <Avatar size=\"sm\" src={item.avatarUrl} bgColor={item.color} name={item.name} />\n <div className=\"aivex:flex aivex:max-w-[260px] aivex:flex-col\">\n <div className=\"aivex:truncate aivex:text-label-md aivex:text-text-primary\">\n {item.name}\n </div>\n {item.email ? (\n <div className=\"aivex:truncate aivex:text-body-sm-regular aivex:text-text-secondary\">\n {item.email}\n </div>\n ) : null}\n </div>\n </div>\n ))}\n </div>\n );\n});\n\nexport default MentionList;\n","\"use client\";\n\nimport { ReactRenderer } from \"@tiptap/react\";\nimport { useMemo } from \"react\";\nimport tippy, { type Instance as TippyInstance } from \"tippy.js\";\nimport MentionList, { type MentionListHandle } from \"./MentionList\";\nimport type { CommentUser } from \"./types\";\n\n/** tiptap Mention 확장에 꽂는 자동완성 설정 — 옵스 에디터 이식(CommentUser 기반). */\nexport const useMentionSuggestion = (\n userList: CommentUser[],\n onOpenChange?: (isOpen: boolean) => void,\n emptyText?: string,\n) => {\n return useMemo(() => {\n const filterUsers = (query: string) => {\n if (!query) return userList;\n const q = query.toLowerCase();\n return userList.filter(\n (user) =>\n user.name.toLowerCase().includes(q) || (user.email ?? \"\").toLowerCase().includes(q),\n );\n };\n\n const createCommandHandler =\n (originalCommand: (item: { id: string; label: string }) => void) => (item: CommentUser) => {\n originalCommand({ id: item.id, label: item.name });\n };\n\n const createRenderer = () => {\n let component: ReactRenderer<MentionListHandle> | null = null;\n let popup: TippyInstance[] | null = null;\n\n return {\n // biome-ignore lint/suspicious/noExplicitAny: tiptap suggestion props는 확장별 동적 형태라 상위 타입이 없다\n onStart: (props: Record<string, any>) => {\n component = new ReactRenderer(MentionList, {\n props: {\n ...props,\n emptyText,\n command: createCommandHandler(props.command),\n },\n editor: props.editor,\n });\n\n if (!props.clientRect) return;\n\n popup = tippy(\"body\", {\n getReferenceClientRect: props.clientRect,\n appendTo: () => document.body,\n content: component.element,\n showOnCreate: true,\n interactive: true,\n trigger: \"manual\",\n placement: \"bottom-start\",\n });\n\n onOpenChange?.(true);\n },\n\n // biome-ignore lint/suspicious/noExplicitAny: tiptap suggestion props는 확장별 동적 형태라 상위 타입이 없다\n onUpdate(props: Record<string, any>) {\n component?.updateProps({\n ...props,\n emptyText,\n command: createCommandHandler(props.command),\n });\n\n if (!props.clientRect) return;\n\n popup?.[0]?.setProps({ getReferenceClientRect: props.clientRect });\n },\n\n onKeyDown(props: { event: KeyboardEvent }) {\n if (props.event.key === \"Escape\") {\n if (popup?.[0] && !popup[0].state.isDestroyed) popup[0].hide();\n onOpenChange?.(false);\n return true;\n }\n return component?.ref?.onKeyDown(props.event) || false;\n },\n\n onExit() {\n if (popup?.[0] && !popup[0].state.isDestroyed) popup[0].destroy();\n component?.destroy();\n popup = null;\n component = null;\n onOpenChange?.(false);\n },\n };\n };\n\n return {\n items: ({ query }: { query: string }) => filterUsers(query),\n render: createRenderer,\n };\n }, [userList, onOpenChange, emptyText]);\n};\n","\"use client\";\n\nimport Mention from \"@tiptap/extension-mention\";\nimport Placeholder from \"@tiptap/extension-placeholder\";\nimport { EditorContent, type JSONContent, mergeAttributes, useEditor } from \"@tiptap/react\";\nimport StarterKit from \"@tiptap/starter-kit\";\nimport { type Ref, useEffect, useImperativeHandle, useRef, useState } from \"react\";\nimport type { CommentUser } from \"./types\";\nimport { useMentionSuggestion } from \"./useMentionSuggestion\";\n\nexport interface MentionInputHandle {\n /** 입력기에 포커스를 준다(예: 전송 버튼 클릭 후 포커스 유지). */\n focus: () => void;\n}\n\nexport interface MentionInputProps {\n value: string;\n onChange: (value: string) => void;\n placeholder?: string;\n /** Enter(멘션 목록 닫힌 상태) 제출. */\n onSubmit?: () => void;\n /** Esc(멘션 목록 닫힌 상태) 취소. */\n onEscape?: () => void;\n /** 멘션(@) 후보. 빈 배열이면 멘션 없이 플레인 입력처럼 동작한다. */\n userList?: CommentUser[];\n initialContent?: JSONContent;\n /** 멘션 후보 없음 문구(호스트 i18n). */\n mentionEmptyText?: string;\n /** 마운트 시 자동 포커스(기본 true). */\n autoFocus?: boolean;\n /** 명령형 핸들(포커스 제어). */\n handleRef?: Ref<MentionInputHandle>;\n}\n\n/**\n * 멘션(@) 지원 코멘트 입력기 — 옵스 에디터 MentionInput 이식.\n * value는 평문 직렬화(`@[이름](id)`)로 주고받는다.\n */\nexport default function MentionInput({\n value,\n onChange,\n placeholder,\n onSubmit,\n onEscape,\n userList = [],\n initialContent,\n mentionEmptyText,\n autoFocus = true,\n handleRef,\n}: MentionInputProps) {\n const editorRef = useRef<HTMLDivElement>(null);\n const [isMentionListOpen, setIsMentionListOpen] = useState(false);\n const suggestion = useMentionSuggestion(userList, setIsMentionListOpen, mentionEmptyText);\n\n const editor = useEditor({\n extensions: [\n StarterKit,\n Placeholder.configure({\n placeholder,\n emptyEditorClass:\n \"aivex:before:content-[attr(data-placeholder)] aivex:before:text-text-tertiary aivex:before:absolute aivex:before:left-3\",\n }),\n Mention.configure({\n HTMLAttributes: { class: \"aivex:text-text-brand aivex:px-1\" },\n // 멘션이 확정되면 골뱅이는 사라지고 이름만 남는다(시안) — 확정 전\n // 타이핑 중인 \"@검색어\"는 그대로다. 직렬화 형식은 바뀌지 않는다.\n renderHTML({ options, node }) {\n return [\"span\", mergeAttributes(options.HTMLAttributes), `${node.attrs.label}`];\n },\n renderText({ node }) {\n return `@[${node.attrs.label}](${node.attrs.id})`;\n },\n deleteTriggerWithBackspace: true,\n suggestion,\n }),\n ],\n content: initialContent || value,\n // SSR 환경(next 등)에서 hydration 불일치 방지.\n immediatelyRender: false,\n editorProps: {\n attributes: {\n // 줄높이 22(내부 p에 강제) + py 8 + 보더 2 = 32px — 옆의 Send 버튼(h-8)과 높이 일치.\n class:\n \"aivex:px-3 aivex:py-1 aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-secondary aivex:focus:border-border-brand aivex:outline-none aivex:text-body-md-regular aivex:text-text-primary aivex:cursor-text aivex:[&_p]:leading-[22px]\",\n },\n handleKeyDown: (_view, event) => {\n if (event.key === \"Enter\") {\n if (isMentionListOpen) return false;\n // 보조키를 짚은 Enter는 전송이 아니라 개행 — tiptap 기본 동작에 맡긴다.\n if (event.shiftKey || event.metaKey || event.ctrlKey || event.altKey) {\n return false;\n }\n event.preventDefault();\n if (value.trim() && onSubmit) onSubmit();\n return true;\n }\n if (event.key === \"Escape\") {\n if (isMentionListOpen || !onEscape) return false;\n event.preventDefault();\n onEscape();\n return true;\n }\n return false;\n },\n },\n onUpdate: ({ editor }) => {\n onChange(extractContentFromJSON(editor.getJSON()));\n },\n });\n\n // Radix는 document capture에서 Esc를 받는다. 입력기 내부의 Esc는 그보다\n // 먼저 공개 ProseMirror 키 핸들러로 처리해 멘션/편집 취소가 부모를 닫지 않게 한다.\n useEffect(() => {\n if (!editor || (!isMentionListOpen && !onEscape)) return;\n const view = editor.view;\n const ownerWindow = view.dom.ownerDocument.defaultView;\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\" || event.defaultPrevented) return;\n if (!(event.target instanceof Node) || !view.dom.contains(event.target)) return;\n if (view.someProp(\"handleKeyDown\", (handler) => handler(view, event))) {\n event.preventDefault();\n event.stopPropagation();\n }\n };\n ownerWindow?.addEventListener(\"keydown\", onKeyDown, true);\n return () => ownerWindow?.removeEventListener(\"keydown\", onKeyDown, true);\n }, [editor, isMentionListOpen, onEscape]);\n\n useEffect(() => {\n if (editor && !initialContent && value !== editor.getText()) {\n editor.commands.setContent(value);\n }\n }, [value, editor, initialContent]);\n\n useEffect(() => {\n if (editor && autoFocus) {\n requestAnimationFrame(() => {\n editor.commands.focus();\n });\n }\n }, [editor, autoFocus]);\n\n useImperativeHandle(\n handleRef,\n () => ({\n focus: () => {\n editor?.commands.focus();\n },\n }),\n [editor],\n );\n\n return (\n <EditorContent\n ref={editorRef}\n editor={editor}\n className=\"aivex:relative aivex:h-full aivex:w-full\"\n onKeyDown={(e) => e.stopPropagation()}\n />\n );\n}\n\n/** tiptap 문서 → 평문(멘션은 `@[이름](id)`, 줄바꿈은 \\n) 직렬화. */\nfunction extractContentFromJSON(json: JSONContent): string {\n if (!json?.content) return \"\";\n\n const processNode = (node: JSONContent): string => {\n if (node.type === \"mention\" && node.attrs) {\n return `@[${node.attrs.label}](${node.attrs.id})`;\n }\n if (node.type === \"text\") return node.text || \"\";\n // Shift+Enter가 넣는 줄바꿈 — 문단 분리(아래 join)와 같은 값으로 편다.\n if (node.type === \"hardBreak\") return \"\\n\";\n if (node.content) return node.content.map(processNode).join(\"\");\n return \"\";\n };\n // 문단마다 한 줄 — 보조키+Enter로 문단이 갈리면 그대로 줄이 나뉜다.\n return json.content.map(processNode).join(\"\\n\");\n}\n","\"use client\";\n\nimport type { JSONContent } from \"@tiptap/react\";\nimport { Avatar } from \"../Avatar\";\nimport { Button } from \"../Button\";\nimport { CloseIcon } from \"../Icon\";\nimport { IconButton } from \"../IconButton\";\nimport MentionInput from \"./MentionInput\";\nimport type { CommentUser } from \"./types\";\n\nexport interface CommentInputProps {\n /** 작성자(입력행 아바타). */\n user?: CommentUser;\n value: string;\n onChange: (value: string) => void;\n /** 전송(Enter 또는 Send 버튼). 값이 비어 있으면 호출되지 않는다. */\n onSubmit: () => void;\n /** 헤더 닫기 버튼·Esc. */\n onClose?: () => void;\n /** 헤더 타이틀(호스트 i18n). 기본 \"Comment\". */\n title?: string;\n placeholder?: string;\n /** 전송 버튼 라벨(호스트 i18n). 기본 \"Send\". */\n submitLabel?: string;\n /**\n * 전송 버튼 사용 — 켜면 내용이 있을 때만 입력 아래 오른쪽에 나타난다(시안).\n * 끄면 어느 상태에서도 없이 Enter로만 보낸다.\n */\n showSubmit?: boolean;\n /** 전송 중 여부 — 버튼 비활성(스피너 등은 호스트가 submitLabel 자리로). */\n pending?: boolean;\n /** 멘션(@) 후보. 생략하면 멘션 없이 동작. */\n userList?: CommentUser[];\n mentionEmptyText?: string;\n initialContent?: JSONContent;\n className?: string;\n}\n\n/**\n * 새 코멘트 입력 패널 — 옵스 new-editor의 NewCommentPanel 이식(도메인/위치 결합 제거).\n * 코멘트 스레드와 동일한 크롬: 헤더(타이틀+닫기) + 입력행(아바타 · 멘션 입력 · 오른쪽\n * Send 버튼). 화면 배치(핀 오른쪽 등)는 호스트가 감싸는 컨테이너에서 담당한다.\n */\nexport function CommentInput({\n user,\n value,\n onChange,\n onSubmit,\n onClose,\n title = \"Comment\",\n placeholder,\n submitLabel = \"Send\",\n showSubmit = true,\n pending = false,\n userList,\n mentionEmptyText,\n initialContent,\n className,\n}: CommentInputProps) {\n const handleSubmit = () => {\n if (!value.trim() || pending) return;\n onSubmit();\n };\n\n return (\n <div className={`aivex:rounded-2xl aivex:bg-bg-primary aivex:shadow-xl ${className ?? \"\"}`}>\n <div className=\"aivex:flex aivex:w-[360px] aivex:flex-col\">\n <div className=\"aivex:flex aivex:h-12 aivex:items-center aivex:justify-between aivex:border-border-subtle aivex:border-b aivex:px-5 aivex:py-2\">\n <span className=\"aivex:text-body-lg-medium aivex:text-text-primary\">{title}</span>\n <IconButton size=\"sm\" className=\"aivex:text-text-secondary\" onClick={onClose}>\n <CloseIcon size={20} />\n </IconButton>\n </div>\n <div className=\"aivex:flex aivex:flex-col aivex:px-4 aivex:py-3\">\n <div className=\"aivex:flex aivex:gap-1.5\">\n <div className=\"aivex:h-6 aivex:w-6 aivex:py-1\">\n {user ? (\n <Avatar size=\"sm\" src={user.avatarUrl} bgColor={user.color} name={user.name} />\n ) : null}\n </div>\n <div className=\"aivex:min-w-0 aivex:flex-1\">\n <MentionInput\n value={value}\n onChange={onChange}\n placeholder={placeholder}\n onSubmit={handleSubmit}\n onEscape={onClose}\n userList={userList}\n mentionEmptyText={mentionEmptyText}\n initialContent={initialContent}\n />\n </div>\n </div>\n {/* 전송 버튼은 빈 입력에서는 없다 — 내용이 생기면 아래로 밀려 나온다(시안).\n grid-rows 0fr↔1fr은 높이를 모르는 내용도 부드럽게 여닫는다. */}\n {showSubmit ? (\n <div\n className={`aivex:grid aivex:transition-[grid-template-rows,opacity] aivex:duration-200 aivex:ease-out ${\n value.trim()\n ? \"aivex:grid-rows-[1fr] aivex:opacity-100\"\n : \"aivex:pointer-events-none aivex:grid-rows-[0fr] aivex:opacity-0\"\n }`}\n >\n {/* 입력과 버튼 사이 6px(시안) — 접히는 안쪽에 둬야 함께 사라진다. */}\n <div className=\"aivex:flex aivex:justify-end aivex:overflow-hidden aivex:pt-1.5\">\n <Button\n size=\"md\"\n disabled={!value.trim() || pending}\n onClick={handleSubmit}\n tabIndex={value.trim() ? undefined : -1}\n >\n {submitLabel}\n </Button>\n </div>\n </div>\n ) : null}\n </div>\n </div>\n </div>\n );\n}\n","\"use client\";\n\nimport { Avatar } from \"../Avatar\";\nimport type { CommentUser } from \"./types\";\n\nexport interface CommentPinProps {\n /** 스레드 참여자(작성자 우선). 최대 maxAvatars명까지 아바타를 겹쳐 그린다. */\n users: CommentUser[];\n selected?: boolean;\n /** 해결(resolve)된 코멘트 — 반투명 표시. */\n resolved?: boolean;\n onClick?: () => void;\n maxAvatars?: number;\n className?: string;\n}\n\n/**\n * 코멘트 핀(다트) — 옵스 에디터 CommentDart의 말풍선 부분 이식.\n * 좌하단이 뾰족한 말풍선(팁이 코멘트 지점을 가리킴). 위치·스케일 고정은 호스트가\n * ShapeEditor overlayMarkers(anchor \"topLeft\") 등으로 담당한다.\n */\nexport function CommentPin({\n users,\n selected = false,\n resolved = false,\n onClick,\n maxAvatars = 3,\n className,\n}: CommentPinProps) {\n const shown = users.slice(0, maxAvatars);\n return (\n <button\n type=\"button\"\n onClick={onClick}\n className={`aivex:flex aivex:h-fit aivex:cursor-pointer aivex:items-center aivex:rounded-t-full aivex:rounded-br-full aivex:border aivex:p-1 aivex:transition-colors ${\n selected\n ? \"aivex:border-border-brand aivex:bg-bg-brand\"\n : \"aivex:border-border-subtle aivex:bg-bg-primary aivex:hover:border-border-brand\"\n } ${resolved ? \"aivex:opacity-40\" : \"\"} ${className ?? \"\"}`}\n >\n {shown.map((user, i) => (\n <span\n key={user.id}\n className=\"aivex:flex\"\n style={i > 0 ? { marginLeft: \"-4px\" } : undefined}\n >\n <Avatar size=\"xs\" src={user.avatarUrl} bgColor={user.color} name={user.name} />\n </span>\n ))}\n {users.length > maxAvatars ? (\n <span className=\"aivex:px-1 aivex:text-label-sm aivex:text-text-secondary\">\n +{users.length - maxAvatars}\n </span>\n ) : null}\n </button>\n );\n}\n"],"mappings":";;;;;;;;;;;;IA0BE,IAAiB,EAAA,SAAqC,EAAA,UAAA,YAAA,eAAA,qBAAA,UAAA;CAEtD,IAAM,CAAA,GAAa,KACE,EAAA,EAAA,EACjB,IAAa,EAAM,EAAA,CAAA,EACf,IAAc,GAAK,MAAA;MAExB,IAAO,EACT;AAED,EAAA,KAAM,EAAA,EAAgB;IAElB,CAAA,GAAA,EAAkB,CAAA,EAChB,IAAkB,GAAM,MAAA;AACxB,KAAI,MAAoB;GACxB,IAAA,IAAe,EAAK;UACpB,MAAA,QAAA,IAAA,IAAA,KAAA,KAEG,IAAO,KACf;IAED;IAEI,CAAA,EAAQ,OAAM,CAAA,EACZ,IA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;KACE,IAAK,EAAA,MAAA,GAAA,EAAA;QACI,kBAAA,UAAA;EACT,MAAA;;aASI,4JAAU,IAAA,gDAAA,iFAAA,GAAA,IAAA,qBAAA,GAAA,GAAA,KAAA;YACH,CAAA,EAAQ,KAAE,GAAA,MAAuB,kBAAA,QAAA;cAExC;UAAa,IAAA,IAAA,EAAA,YAAA,QAAA,GAAA,KAAA;aAAe,kBAAA,GAAA;IAAW,MAAA;IAAqB,KAAA,EAAM;IAAa,SAAA,EAAA;IAC1E,MALK,EAMZ;IAEM,CAAA;UAAN,CAA2E,EAAA,EACvE,SAAM,IACH,kBAAA,QAAA;cAEF"}
|
|
1
|
+
{"version":3,"file":"comment.js","names":[],"sources":["../src/components/Comment/mentionContent.ts","../src/components/Comment/MentionList.tsx","../src/components/Comment/useMentionSuggestion.ts","../src/components/Comment/MentionInput.tsx","../src/components/Comment/CommentInput.tsx","../src/components/Comment/CommentPin.tsx"],"sourcesContent":["import type { JSONContent } from \"@tiptap/react\";\n\n// MentionInput의 value 직렬화(멘션은 `@[이름](id)`, 줄바꿈은 \\n)와 tiptap 문서 사이 변환.\n\nconst MENTION_MARKUP = /@\\[([^\\]]*)\\]\\(([^)]*)\\)/g;\n\n/** 평문 직렬화 → tiptap 문서. extractContentFromJSON의 역 — 줄마다 문단, 멘션 마크업은 멘션 노드. */\nexport function parseContentToJSON(value: string): JSONContent {\n return {\n type: \"doc\",\n content: value.split(\"\\n\").map((line) => {\n const content: JSONContent[] = [];\n let last = 0;\n for (const match of line.matchAll(MENTION_MARKUP)) {\n const [whole, label, id] = match;\n const start = match.index ?? 0;\n if (start > last) content.push({ type: \"text\", text: line.slice(last, start) });\n content.push({ type: \"mention\", attrs: { id, label } });\n last = start + whole.length;\n }\n if (last < line.length) content.push({ type: \"text\", text: line.slice(last) });\n return content.length > 0 ? { type: \"paragraph\", content } : { type: \"paragraph\" };\n }),\n };\n}\n\n/** tiptap 문서 → 평문(멘션은 `@[이름](id)`, 줄바꿈은 \\n) 직렬화. */\nexport function extractContentFromJSON(json: JSONContent): string {\n if (!json?.content) return \"\";\n\n const processNode = (node: JSONContent): string => {\n if (node.type === \"mention\" && node.attrs) {\n return `@[${node.attrs.label}](${node.attrs.id})`;\n }\n if (node.type === \"text\") return node.text || \"\";\n // Shift+Enter가 넣는 줄바꿈 — 문단 분리(아래 join)와 같은 값으로 편다.\n if (node.type === \"hardBreak\") return \"\\n\";\n if (node.content) return node.content.map(processNode).join(\"\");\n return \"\";\n };\n // 문단마다 한 줄 — 보조키+Enter로 문단이 갈리면 그대로 줄이 나뉜다.\n return json.content.map(processNode).join(\"\\n\");\n}\n","\"use client\";\n\nimport { memo, useCallback, useEffect, useImperativeHandle, useRef, useState } from \"react\";\nimport { Avatar } from \"../Avatar\";\nimport type { CommentUser } from \"./types\";\n\nexport interface MentionListHandle {\n onKeyDown: (event: KeyboardEvent) => boolean;\n}\n\ninterface MentionListProps {\n items: CommentUser[];\n command: (item: CommentUser) => void;\n /** 후보 없음 문구(호스트 i18n). 기본 \"No results found.\" */\n emptyText?: string;\n ref?: React.Ref<MentionListHandle>;\n}\n\n/** 멘션(@) 자동완성 목록 — 옵스 에디터 MentionList 이식(도메인 결합 제거). */\nconst MentionList = memo(function MentionList({\n items,\n command,\n emptyText = \"No results found.\",\n ref,\n}: MentionListProps) {\n const [selectedIndex, setSelectedIndex] = useState(0);\n const itemRefs = useRef<(HTMLDivElement | null)[]>([]);\n\n const selectItem = useCallback(\n (index: number) => {\n const item = items[index];\n if (item) command(item);\n },\n [items, command],\n );\n\n const moveSelection = useCallback(\n (direction: \"up\" | \"down\") => {\n setSelectedIndex((prev) => {\n const itemCount = items.length;\n if (direction === \"up\") return (prev + itemCount - 1) % itemCount;\n return (prev + 1) % itemCount;\n });\n },\n [items.length],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent): boolean => {\n switch (event.key) {\n case \"ArrowUp\":\n moveSelection(\"up\");\n return true;\n case \"ArrowDown\":\n moveSelection(\"down\");\n return true;\n case \"Enter\":\n selectItem(selectedIndex);\n return true;\n default:\n return false;\n }\n },\n [moveSelection, selectItem, selectedIndex],\n );\n\n useEffect(() => {\n setSelectedIndex(0);\n itemRefs.current = items.map(() => null);\n }, [items]);\n\n useEffect(() => {\n itemRefs.current[selectedIndex]?.scrollIntoView({ behavior: \"smooth\", block: \"nearest\" });\n }, [selectedIndex]);\n\n useImperativeHandle(ref, () => ({ onKeyDown: handleKeyDown }), [handleKeyDown]);\n\n if (!items.length) {\n return (\n <div className=\"aivex:min-w-[298px] aivex:max-w-[328px] aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:py-2 aivex:shadow-xl\">\n <div className=\"aivex:p-2 aivex:text-body-md-regular aivex:text-text-secondary\">\n {emptyText}\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"aivex:h-full aivex:max-h-[248px] aivex:min-w-[298px] aivex:max-w-[328px] aivex:overflow-y-auto aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:py-2 aivex:shadow-xl\">\n {items.map((item, index) => (\n // 키보드 상호작용은 tiptap 에디터가 MentionListHandle로 위임 처리한다.\n <div\n key={item.id}\n ref={(el) => {\n itemRefs.current[index] = el;\n }}\n className={`aivex:flex aivex:h-[52px] aivex:cursor-pointer aivex:items-center aivex:gap-2 aivex:px-4 aivex:py-2 ${\n selectedIndex === index ? \"aivex:bg-bg-brand-subtle\" : \"\"\n }`}\n onClick={() => selectItem(index)}\n >\n <Avatar size=\"sm\" src={item.avatarUrl} bgColor={item.color} name={item.name} />\n <div className=\"aivex:flex aivex:max-w-[260px] aivex:flex-col\">\n <div className=\"aivex:truncate aivex:text-label-md aivex:text-text-primary\">\n {item.name}\n </div>\n {item.email ? (\n <div className=\"aivex:truncate aivex:text-body-sm-regular aivex:text-text-secondary\">\n {item.email}\n </div>\n ) : null}\n </div>\n </div>\n ))}\n </div>\n );\n});\n\nexport default MentionList;\n","\"use client\";\n\nimport { ReactRenderer } from \"@tiptap/react\";\nimport { useMemo } from \"react\";\nimport tippy, { type Instance as TippyInstance } from \"tippy.js\";\nimport MentionList, { type MentionListHandle } from \"./MentionList\";\nimport type { CommentUser } from \"./types\";\n\n/** tiptap Mention 확장에 꽂는 자동완성 설정 — 옵스 에디터 이식(CommentUser 기반). */\nexport const useMentionSuggestion = (\n userList: CommentUser[],\n onOpenChange?: (isOpen: boolean) => void,\n emptyText?: string,\n) => {\n return useMemo(() => {\n const filterUsers = (query: string) => {\n if (!query) return userList;\n const q = query.toLowerCase();\n return userList.filter(\n (user) =>\n user.name.toLowerCase().includes(q) || (user.email ?? \"\").toLowerCase().includes(q),\n );\n };\n\n const createCommandHandler =\n (originalCommand: (item: { id: string; label: string }) => void) => (item: CommentUser) => {\n originalCommand({ id: item.id, label: item.name });\n };\n\n const createRenderer = () => {\n let component: ReactRenderer<MentionListHandle> | null = null;\n let popup: TippyInstance[] | null = null;\n\n return {\n // biome-ignore lint/suspicious/noExplicitAny: tiptap suggestion props는 확장별 동적 형태라 상위 타입이 없다\n onStart: (props: Record<string, any>) => {\n component = new ReactRenderer(MentionList, {\n props: {\n ...props,\n emptyText,\n command: createCommandHandler(props.command),\n },\n editor: props.editor,\n });\n\n if (!props.clientRect) return;\n\n popup = tippy(\"body\", {\n getReferenceClientRect: props.clientRect,\n appendTo: () => document.body,\n content: component.element,\n showOnCreate: true,\n interactive: true,\n trigger: \"manual\",\n placement: \"bottom-start\",\n });\n\n onOpenChange?.(true);\n },\n\n // biome-ignore lint/suspicious/noExplicitAny: tiptap suggestion props는 확장별 동적 형태라 상위 타입이 없다\n onUpdate(props: Record<string, any>) {\n component?.updateProps({\n ...props,\n emptyText,\n command: createCommandHandler(props.command),\n });\n\n if (!props.clientRect) return;\n\n popup?.[0]?.setProps({ getReferenceClientRect: props.clientRect });\n },\n\n onKeyDown(props: { event: KeyboardEvent }) {\n if (props.event.key === \"Escape\") {\n if (popup?.[0] && !popup[0].state.isDestroyed) popup[0].hide();\n onOpenChange?.(false);\n return true;\n }\n return component?.ref?.onKeyDown(props.event) || false;\n },\n\n onExit() {\n if (popup?.[0] && !popup[0].state.isDestroyed) popup[0].destroy();\n component?.destroy();\n popup = null;\n component = null;\n onOpenChange?.(false);\n },\n };\n };\n\n return {\n items: ({ query }: { query: string }) => filterUsers(query),\n render: createRenderer,\n };\n }, [userList, onOpenChange, emptyText]);\n};\n","\"use client\";\n\nimport Mention from \"@tiptap/extension-mention\";\nimport Placeholder from \"@tiptap/extension-placeholder\";\nimport { EditorContent, type JSONContent, mergeAttributes, useEditor } from \"@tiptap/react\";\nimport StarterKit from \"@tiptap/starter-kit\";\nimport { type Ref, useEffect, useImperativeHandle, useRef, useState } from \"react\";\nimport { extractContentFromJSON, parseContentToJSON } from \"./mentionContent\";\nimport type { CommentUser } from \"./types\";\nimport { useMentionSuggestion } from \"./useMentionSuggestion\";\n\nexport interface MentionInputHandle {\n /** 입력기에 포커스를 준다(예: 전송 버튼 클릭 후 포커스 유지). */\n focus: () => void;\n}\n\nexport interface MentionInputProps {\n value: string;\n onChange: (value: string) => void;\n placeholder?: string;\n /** Enter(멘션 목록 닫힌 상태) 제출. */\n onSubmit?: () => void;\n /** Esc(멘션 목록 닫힌 상태) 취소. */\n onEscape?: () => void;\n /** 멘션(@) 후보. 빈 배열이면 멘션 없이 플레인 입력처럼 동작한다. */\n userList?: CommentUser[];\n initialContent?: JSONContent;\n /** 멘션 후보 없음 문구(호스트 i18n). */\n mentionEmptyText?: string;\n /** 마운트 시 자동 포커스(기본 true). */\n autoFocus?: boolean;\n /** 명령형 핸들(포커스 제어). */\n handleRef?: Ref<MentionInputHandle>;\n}\n\n/**\n * 멘션(@) 지원 코멘트 입력기 — 옵스 에디터 MentionInput 이식.\n * value는 평문 직렬화(`@[이름](id)`)로 주고받는다.\n */\nexport default function MentionInput({\n value,\n onChange,\n placeholder,\n onSubmit,\n onEscape,\n userList = [],\n initialContent,\n mentionEmptyText,\n autoFocus = true,\n handleRef,\n}: MentionInputProps) {\n const editorRef = useRef<HTMLDivElement>(null);\n const [isMentionListOpen, setIsMentionListOpen] = useState(false);\n const suggestion = useMentionSuggestion(userList, setIsMentionListOpen, mentionEmptyText);\n\n const editor = useEditor({\n extensions: [\n StarterKit,\n Placeholder.configure({\n placeholder,\n emptyEditorClass:\n \"aivex:before:content-[attr(data-placeholder)] aivex:before:text-text-tertiary aivex:before:absolute aivex:before:left-3\",\n }),\n Mention.configure({\n HTMLAttributes: { class: \"aivex:text-text-brand aivex:px-1\" },\n // 멘션이 확정되면 골뱅이는 사라지고 이름만 남는다(시안) — 확정 전\n // 타이핑 중인 \"@검색어\"는 그대로다. 직렬화 형식은 바뀌지 않는다.\n renderHTML({ options, node }) {\n return [\"span\", mergeAttributes(options.HTMLAttributes), `${node.attrs.label}`];\n },\n renderText({ node }) {\n return `@[${node.attrs.label}](${node.attrs.id})`;\n },\n deleteTriggerWithBackspace: true,\n suggestion,\n }),\n ],\n // value는 직렬화 문자열이라 그대로 넣으면 `@[이름](id)`가 글자로 보인다 — 멘션 노드 문서로 되돌려 넣는다.\n content: initialContent || parseContentToJSON(value),\n // SSR 환경(next 등)에서 hydration 불일치 방지.\n immediatelyRender: false,\n editorProps: {\n attributes: {\n // 줄높이 22(내부 p에 강제) + py 8 + 보더 2 = 32px — 옆의 Send 버튼(h-8)과 높이 일치.\n class:\n \"aivex:px-3 aivex:py-1 aivex:rounded-lg aivex:border aivex:border-border-subtle aivex:bg-bg-secondary aivex:focus:border-border-brand aivex:outline-none aivex:text-body-md-regular aivex:text-text-primary aivex:cursor-text aivex:[&_p]:leading-[22px]\",\n },\n handleKeyDown: (_view, event) => {\n if (event.key === \"Enter\") {\n if (isMentionListOpen) return false;\n // 보조키를 짚은 Enter는 전송이 아니라 개행 — tiptap 기본 동작에 맡긴다.\n if (event.shiftKey || event.metaKey || event.ctrlKey || event.altKey) {\n return false;\n }\n event.preventDefault();\n if (value.trim() && onSubmit) onSubmit();\n return true;\n }\n if (event.key === \"Escape\") {\n if (isMentionListOpen || !onEscape) return false;\n event.preventDefault();\n onEscape();\n return true;\n }\n return false;\n },\n },\n onUpdate: ({ editor }) => {\n onChange(extractContentFromJSON(editor.getJSON()));\n },\n });\n\n // Radix는 document capture에서 Esc를 받는다. 입력기 내부의 Esc는 그보다\n // 먼저 공개 ProseMirror 키 핸들러로 처리해 멘션/편집 취소가 부모를 닫지 않게 한다.\n useEffect(() => {\n if (!editor || (!isMentionListOpen && !onEscape)) return;\n const view = editor.view;\n const ownerWindow = view.dom.ownerDocument.defaultView;\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\" || event.defaultPrevented) return;\n if (!(event.target instanceof Node) || !view.dom.contains(event.target)) return;\n if (view.someProp(\"handleKeyDown\", (handler) => handler(view, event))) {\n event.preventDefault();\n event.stopPropagation();\n }\n };\n ownerWindow?.addEventListener(\"keydown\", onKeyDown, true);\n return () => ownerWindow?.removeEventListener(\"keydown\", onKeyDown, true);\n }, [editor, isMentionListOpen, onEscape]);\n\n useEffect(() => {\n // 비교도 같은 직렬화로 한다 — getText()는 문단을 빈 줄로 이어 값이 늘 달라 보인다.\n if (editor && !initialContent && value !== extractContentFromJSON(editor.getJSON())) {\n editor.commands.setContent(parseContentToJSON(value));\n }\n }, [value, editor, initialContent]);\n\n useEffect(() => {\n if (editor && autoFocus) {\n requestAnimationFrame(() => {\n editor.commands.focus();\n });\n }\n }, [editor, autoFocus]);\n\n useImperativeHandle(\n handleRef,\n () => ({\n focus: () => {\n editor?.commands.focus();\n },\n }),\n [editor],\n );\n\n return (\n <EditorContent\n ref={editorRef}\n editor={editor}\n className=\"aivex:relative aivex:h-full aivex:w-full\"\n onKeyDown={(e) => e.stopPropagation()}\n />\n );\n}\n","\"use client\";\n\nimport type { JSONContent } from \"@tiptap/react\";\nimport { Avatar } from \"../Avatar\";\nimport { Button } from \"../Button\";\nimport { CloseIcon } from \"../Icon\";\nimport { IconButton } from \"../IconButton\";\nimport MentionInput from \"./MentionInput\";\nimport type { CommentUser } from \"./types\";\n\nexport interface CommentInputProps {\n /** 작성자(입력행 아바타). */\n user?: CommentUser;\n value: string;\n onChange: (value: string) => void;\n /** 전송(Enter 또는 Send 버튼). 값이 비어 있으면 호출되지 않는다. */\n onSubmit: () => void;\n /** 헤더 닫기 버튼·Esc. */\n onClose?: () => void;\n /** 헤더 타이틀(호스트 i18n). 기본 \"Comment\". */\n title?: string;\n placeholder?: string;\n /** 전송 버튼 라벨(호스트 i18n). 기본 \"Send\". */\n submitLabel?: string;\n /**\n * 전송 버튼 사용 — 켜면 내용이 있을 때만 입력 아래 오른쪽에 나타난다(시안).\n * 끄면 어느 상태에서도 없이 Enter로만 보낸다.\n */\n showSubmit?: boolean;\n /** 전송 중 여부 — 버튼 비활성(스피너 등은 호스트가 submitLabel 자리로). */\n pending?: boolean;\n /** 멘션(@) 후보. 생략하면 멘션 없이 동작. */\n userList?: CommentUser[];\n mentionEmptyText?: string;\n initialContent?: JSONContent;\n className?: string;\n}\n\n/**\n * 새 코멘트 입력 패널 — 옵스 new-editor의 NewCommentPanel 이식(도메인/위치 결합 제거).\n * 코멘트 스레드와 동일한 크롬: 헤더(타이틀+닫기) + 입력행(아바타 · 멘션 입력 · 오른쪽\n * Send 버튼). 화면 배치(핀 오른쪽 등)는 호스트가 감싸는 컨테이너에서 담당한다.\n */\nexport function CommentInput({\n user,\n value,\n onChange,\n onSubmit,\n onClose,\n title = \"Comment\",\n placeholder,\n submitLabel = \"Send\",\n showSubmit = true,\n pending = false,\n userList,\n mentionEmptyText,\n initialContent,\n className,\n}: CommentInputProps) {\n const handleSubmit = () => {\n if (!value.trim() || pending) return;\n onSubmit();\n };\n\n return (\n <div className={`aivex:rounded-2xl aivex:bg-bg-primary aivex:shadow-xl ${className ?? \"\"}`}>\n <div className=\"aivex:flex aivex:w-[360px] aivex:flex-col\">\n <div className=\"aivex:flex aivex:h-12 aivex:items-center aivex:justify-between aivex:border-border-subtle aivex:border-b aivex:px-5 aivex:py-2\">\n <span className=\"aivex:text-body-lg-medium aivex:text-text-primary\">{title}</span>\n <IconButton size=\"sm\" className=\"aivex:text-text-secondary\" onClick={onClose}>\n <CloseIcon size={20} />\n </IconButton>\n </div>\n <div className=\"aivex:flex aivex:flex-col aivex:px-4 aivex:py-3\">\n <div className=\"aivex:flex aivex:gap-1.5\">\n <div className=\"aivex:h-6 aivex:w-6 aivex:py-1\">\n {user ? (\n <Avatar size=\"sm\" src={user.avatarUrl} bgColor={user.color} name={user.name} />\n ) : null}\n </div>\n <div className=\"aivex:min-w-0 aivex:flex-1\">\n <MentionInput\n value={value}\n onChange={onChange}\n placeholder={placeholder}\n onSubmit={handleSubmit}\n onEscape={onClose}\n userList={userList}\n mentionEmptyText={mentionEmptyText}\n initialContent={initialContent}\n />\n </div>\n </div>\n {/* 전송 버튼은 빈 입력에서는 없다 — 내용이 생기면 아래로 밀려 나온다(시안).\n grid-rows 0fr↔1fr은 높이를 모르는 내용도 부드럽게 여닫는다. */}\n {showSubmit ? (\n <div\n className={`aivex:grid aivex:transition-[grid-template-rows,opacity] aivex:duration-200 aivex:ease-out ${\n value.trim()\n ? \"aivex:grid-rows-[1fr] aivex:opacity-100\"\n : \"aivex:pointer-events-none aivex:grid-rows-[0fr] aivex:opacity-0\"\n }`}\n >\n {/* 입력과 버튼 사이 6px(시안) — 접히는 안쪽에 둬야 함께 사라진다. */}\n <div className=\"aivex:flex aivex:justify-end aivex:overflow-hidden aivex:pt-1.5\">\n <Button\n size=\"md\"\n disabled={!value.trim() || pending}\n onClick={handleSubmit}\n tabIndex={value.trim() ? undefined : -1}\n >\n {submitLabel}\n </Button>\n </div>\n </div>\n ) : null}\n </div>\n </div>\n </div>\n );\n}\n","\"use client\";\n\nimport { Avatar } from \"../Avatar\";\nimport type { CommentUser } from \"./types\";\n\nexport interface CommentPinProps {\n /** 스레드 참여자(작성자 우선). 최대 maxAvatars명까지 아바타를 겹쳐 그린다. */\n users: CommentUser[];\n selected?: boolean;\n /** 해결(resolve)된 코멘트 — 반투명 표시. */\n resolved?: boolean;\n onClick?: () => void;\n maxAvatars?: number;\n className?: string;\n}\n\n/**\n * 코멘트 핀(다트) — 옵스 에디터 CommentDart의 말풍선 부분 이식.\n * 좌하단이 뾰족한 말풍선(팁이 코멘트 지점을 가리킴). 위치·스케일 고정은 호스트가\n * ShapeEditor overlayMarkers(anchor \"topLeft\") 등으로 담당한다.\n */\nexport function CommentPin({\n users,\n selected = false,\n resolved = false,\n onClick,\n maxAvatars = 3,\n className,\n}: CommentPinProps) {\n const shown = users.slice(0, maxAvatars);\n return (\n <button\n type=\"button\"\n onClick={onClick}\n className={`aivex:flex aivex:h-fit aivex:cursor-pointer aivex:items-center aivex:rounded-t-full aivex:rounded-br-full aivex:border aivex:p-1 aivex:transition-colors ${\n selected\n ? \"aivex:border-border-brand aivex:bg-bg-brand\"\n : \"aivex:border-border-subtle aivex:bg-bg-primary aivex:hover:border-border-brand\"\n } ${resolved ? \"aivex:opacity-40\" : \"\"} ${className ?? \"\"}`}\n >\n {shown.map((user, i) => (\n <span\n key={user.id}\n className=\"aivex:flex\"\n style={i > 0 ? { marginLeft: \"-4px\" } : undefined}\n >\n <Avatar size=\"xs\" src={user.avatarUrl} bgColor={user.color} name={user.name} />\n </span>\n ))}\n {users.length > maxAvatars ? (\n <span className=\"aivex:px-1 aivex:text-label-sm aivex:text-text-secondary\">\n +{users.length - maxAvatars}\n </span>\n ) : null}\n </button>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAQE,IAAA,IAAO;SACC,EAAA,GAAA;QACN;QACE;WACI,EAAO,MAAA,KAAA,CAAA,KAAA,MAAA;GACX,IAAK,IAAM,EAAA,EACT,IAAO;QACP,IAAM,KAAQ,EAAM,SAAS,EAAA,EAAA;IAC7B,IAAI,CAAA,GAAQ,GAAM,KAAQ,GAAO,IAAM,EAAA,SAAA;AAIzC,IAJiD,IAAW,KAAM,EAAM,KAAM;KAAE,MAAC;KAC/E,MAAA,EAAQ,MAAK,GAAA,EAAA;KAAE,CAAA,IAAwB,KA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,CAAA;KAAK,CAAA,CAAA;OACH,kBAAA,OAAA;eAAK;eACH,kBAAC,OAAD;gBAAK;gBAED,kBAAA,OAAC;iBAAY;gBAAU,IAAK,kBAAA,GAAA;OAAW,MAAA;OAAqB,KAAA,EAAM;OAAa,SAC7E,EAAA;OACA,MACN,EAAA;OAAK,CAAA,GAAA;SACH,kBAAA,OAAC;iBACQ;gBACG,kBAAA,GAAA;OACG;OACb;OACA;OACU,UAAA;OACQ,UAAA;OACF;OAChB;OACE;QAIP;MAEG,CAAA,CAAA;YAOC,kBAAA,OAAD;gBAAK,8FAAU,EAAA,MAAA,GAAA,4CAAA;eACb,kBAAA,OAAC;iBACM;gBACkB,kBAAI,GAAA;OAC3B,MAAA;OACA,UAAU,CAAA,EAAM,MAAM,IAAG;;OAGlB,UAAA,EAAA,MAAA,GAAA,KAAA,IAAA;OACL,UAAA;OACF,CAAA;MAGN,CAAA;;IACF,CAAA,CAAA;;;;;;ACxFR,SACE,EAAA,EAAA,UAAC,cAAD,IAAA,cAAA,IAAA,YAAA,gBAAA,GAAA,gBAAA;KACE,IAAK,EAAA,MAAA,GAAA,EAAA;QACI,kBAAA,UAAA;EACT,MAAA;;aASI,4JAAU,IAAA,gDAAA,iFAAA,GAAA,IAAA,qBAAA,GAAA,GAAA,KAAA;YACH,CAAA,EAAQ,KAAE,GAAA,MAAuB,kBAAA,QAAA;cAExC;UAAa,IAAA,IAAA,EAAA,YAAA,QAAA,GAAA,KAAA;aAAe,kBAAA,GAAA;IAAW,MAAA;IAAqB,KAAA,EAAM;IAAa,SAAA,EAAA;IAC1E,MALK,EAMZ;IAEM,CAAA;UAAN,CAA2E,EAAA,EACvE,SAAM,IACH,kBAAA,QAAA;cAEF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { JSONContent } from "@tiptap/react";
|
|
2
|
+
/** 평문 직렬화 → tiptap 문서. extractContentFromJSON의 역 — 줄마다 문단, 멘션 마크업은 멘션 노드. */
|
|
3
|
+
export declare function parseContentToJSON(value: string): JSONContent;
|
|
4
|
+
/** tiptap 문서 → 평문(멘션은 `@[이름](id)`, 줄바꿈은 \n) 직렬화. */
|
|
5
|
+
export declare function extractContentFromJSON(json: JSONContent): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { type Row, type TableOptions } from "@tanstack/react-table";
|
|
2
2
|
import type { MouseEvent, ReactNode, Ref } from "react";
|
|
3
3
|
import { type DataGridColumnSettingsOptions } from "./DataGridColumnSettings";
|
|
4
|
-
import { type DataGridValue } from "./DataGridPrimitives";
|
|
4
|
+
import { type DataGridValue, type DataGridVariant } from "./DataGridPrimitives";
|
|
5
5
|
export interface DataGridProps<TData> extends Omit<TableOptions<TData>, "getCoreRowModel"> {
|
|
6
6
|
getCoreRowModel?: TableOptions<TData>["getCoreRowModel"];
|
|
7
7
|
className?: string;
|
|
8
8
|
ref?: Ref<HTMLDivElement>;
|
|
9
|
+
/**
|
|
10
|
+
* 밀도 (Figma Table Variants : Type). 기본 basic.
|
|
11
|
+
* compact는 헤더 32px·행 36px에 헤더 박스·행 구분선이 없다.
|
|
12
|
+
*/
|
|
13
|
+
variant?: DataGridVariant;
|
|
9
14
|
loading?: boolean;
|
|
10
15
|
loadingRowCount?: number;
|
|
11
16
|
empty?: ReactNode;
|
|
@@ -50,10 +55,10 @@ export interface DataGridProps<TData> extends Omit<TableOptions<TData>, "getCore
|
|
|
50
55
|
* SSR에서는 초기 행이 비어 있고 마운트 후 렌더된다.
|
|
51
56
|
*/
|
|
52
57
|
virtualized?: boolean;
|
|
53
|
-
/** 가상화 시 행 높이 추정값(px). 실제 높이는 렌더 후 실측로 보정된다. 기본 48 */
|
|
58
|
+
/** 가상화 시 행 높이 추정값(px). 실제 높이는 렌더 후 실측로 보정된다. 기본 basic 48 / compact 36 */
|
|
54
59
|
estimateRowHeight?: number;
|
|
55
60
|
/** 가상화 시 화면 밖에 미리 렌더할 행 수. 기본 6 */
|
|
56
61
|
overscan?: number;
|
|
57
62
|
}
|
|
58
|
-
declare function DataGrid<TData>({ className, loading, loadingRowCount, empty, headerSticky, viewportClassName, contentClassName, headerClassName, bodyClassName, rowClassName, rowInteractive, isRowSelected, isRowDisabled, onRowClick, renderExpandedRow, loadingMore, loadingMoreContent, loadingMoreRowCount, skeletonRowClassName, endContent, infiniteTriggerRef, infiniteTriggerClassName, columnSettings, virtualized, estimateRowHeight, overscan, ref, getCoreRowModel, ...tableOptions }: DataGridProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
63
|
+
declare function DataGrid<TData>({ className, variant, loading, loadingRowCount, empty, headerSticky, viewportClassName, contentClassName, headerClassName, bodyClassName, rowClassName, rowInteractive, isRowSelected, isRowDisabled, onRowClick, renderExpandedRow, loadingMore, loadingMoreContent, loadingMoreRowCount, skeletonRowClassName, endContent, infiniteTriggerRef, infiniteTriggerClassName, columnSettings, virtualized, estimateRowHeight, overscan, ref, getCoreRowModel, ...tableOptions }: DataGridProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
59
64
|
export { DataGrid };
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import type { RowData } from "@tanstack/react-table";
|
|
2
|
-
import type
|
|
2
|
+
import { type HTMLAttributes, type ReactNode, type Ref } from "react";
|
|
3
3
|
import { type ScrollAreaProps } from "@/components/ScrollArea";
|
|
4
4
|
export type DataGridAlign = "start" | "center" | "end";
|
|
5
|
+
/**
|
|
6
|
+
* 그리드 밀도 (Figma Table Variants : Type).
|
|
7
|
+
* - basic: 헤더 48px(배경·테두리 박스) + 행 48px + 행 구분선
|
|
8
|
+
* - compact: 헤더 32px(박스 없음) + 행 36px, 구분선·바깥 인셋 없음 — 대시보드 카드 등 좁은 영역용
|
|
9
|
+
*/
|
|
10
|
+
export type DataGridVariant = "basic" | "compact";
|
|
5
11
|
export type DataGridValue<TData, TValue> = TValue | ((row: TData, index: number) => TValue);
|
|
6
12
|
declare module "@tanstack/react-table" {
|
|
7
13
|
interface ColumnMeta<TData extends RowData, TValue> {
|
|
@@ -23,9 +29,11 @@ declare module "@tanstack/react-table" {
|
|
|
23
29
|
}
|
|
24
30
|
export declare function resolveDataGridValue<TData, TValue>(value: DataGridValue<TData, TValue> | undefined, row: TData, index: number): TValue | undefined;
|
|
25
31
|
export interface DataGridRootProps extends HTMLAttributes<HTMLDivElement> {
|
|
32
|
+
/** 하위 헤더·행·셀에 전달되는 밀도. 기본 basic */
|
|
33
|
+
variant?: DataGridVariant;
|
|
26
34
|
ref?: Ref<HTMLDivElement>;
|
|
27
35
|
}
|
|
28
|
-
declare function DataGridRoot({ className, children, ref, ...props }: DataGridRootProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
declare function DataGridRoot({ className, children, variant, ref, ...props }: DataGridRootProps): import("react/jsx-runtime").JSX.Element;
|
|
29
37
|
export interface DataGridViewportProps extends ScrollAreaProps {
|
|
30
38
|
/** 세로 스크롤바에 덧붙일 클래스 — 고정 헤더 아래에서 시작시킬 때 */
|
|
31
39
|
verticalScrollbarClassName?: string;
|
|
@@ -4,5 +4,5 @@ export type { DataGridProps } from "./DataGrid";
|
|
|
4
4
|
export { DataGrid } from "./DataGrid";
|
|
5
5
|
export type { DataGridColumnSettingsOptions } from "./DataGridColumnSettings";
|
|
6
6
|
export { DataGridColumnSettings } from "./DataGridColumnSettings";
|
|
7
|
-
export type { DataGridAlign, DataGridBodyProps, DataGridCellProps, DataGridEmptyProps, DataGridHeaderCellProps, DataGridHeaderProps, DataGridInfiniteTriggerProps, DataGridLoadingProps, DataGridRootProps, DataGridRowProps, DataGridViewportProps, } from "./DataGridPrimitives";
|
|
7
|
+
export type { DataGridAlign, DataGridBodyProps, DataGridCellProps, DataGridEmptyProps, DataGridHeaderCellProps, DataGridHeaderProps, DataGridInfiniteTriggerProps, DataGridLoadingProps, DataGridRootProps, DataGridRowProps, DataGridVariant, DataGridViewportProps, } from "./DataGridPrimitives";
|
|
8
8
|
export { DataGridBody, DataGridCell, DataGridEmpty, DataGridHeader, DataGridHeaderCell, DataGridInfiniteTrigger, DataGridLoading, DataGridRoot, DataGridRow, DataGridViewport, } from "./DataGridPrimitives";
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { type EditorShape, type Point } from "../_model/geometry";
|
|
2
2
|
import type { EditorSelectionInfo } from "../_model/props";
|
|
3
|
+
import type { Viewport } from "../_renderers/types";
|
|
3
4
|
/** 드래그 프리뷰 중 레이아웃 변경 없이 라벨과 크기 텍스트를 bbox 모서리로 이동한다. */
|
|
4
|
-
export declare function updateSelectionInfoBounds(el: HTMLDivElement, points: Point[]): HTMLElement | null;
|
|
5
|
+
export declare function updateSelectionInfoBounds(el: HTMLDivElement, points: Point[], viewport: Viewport): HTMLElement | null;
|
|
6
|
+
/** 줌·이동으로 뷰포트가 바뀌면 기억해 둔 bbox로 화면 위치만 다시 맞춘다. */
|
|
7
|
+
export declare function repositionSelectionInfo(el: HTMLDivElement, viewport: Viewport): void;
|
|
5
8
|
/** shape + 실제 좌표(points)로 selection info 데이터를 만든다(에디터 계산분). */
|
|
6
9
|
export declare function buildSelectionInfo<TMeta>(shape: EditorShape<TMeta>, points: Point[]): EditorSelectionInfo<TMeta>;
|
|
7
10
|
/** formatSelectionInfo 미지정 시 기본 텍스트. */
|
|
8
11
|
export declare function defaultSelectionInfoText<TMeta>(info: EditorSelectionInfo<TMeta>): string;
|
|
9
|
-
export declare function SelectionInfo<TMeta>({ shapes, getLabel, hideDot, formatInfo, register, }: {
|
|
12
|
+
export declare function SelectionInfo<TMeta>({ shapes, getLabel, hideDot, formatInfo, register, viewport, }: {
|
|
10
13
|
shapes: EditorShape<TMeta>[];
|
|
11
14
|
getLabel?: (shape: EditorShape<TMeta>) => string | undefined;
|
|
12
15
|
hideDot?: boolean;
|
|
13
16
|
formatInfo?: (info: EditorSelectionInfo<TMeta>) => string;
|
|
14
17
|
register: (id: string, el: HTMLDivElement | null) => void;
|
|
18
|
+
/** 렌더 시점 뷰포트 — 이후 줌·이동은 repositionSelectionInfo가 맞춘다. */
|
|
19
|
+
viewport: Viewport;
|
|
15
20
|
}): import("react/jsx-runtime").JSX.Element;
|