diff --git a/src/components/canvas/canvas.module.css b/src/components/canvas/canvas.module.css index 53a411f..5697732 100644 --- a/src/components/canvas/canvas.module.css +++ b/src/components/canvas/canvas.module.css @@ -1,91 +1,124 @@ +/* 画布与节点的局部样式:React Flow 全局类通过 :global 组合,状态类由组件/手势控制器切换;CSS 只控制呈现和命中,不负责数据归属、提交或锁。 */ +/* 画布铺满定位父容器;随后覆盖 React Flow 背景、选中边框和 attribution 外观。 */ .editor { position: absolute; inset: 0; width: 100%; height: 100%; background: #fffefb; } .editor :global(.react-flow) { --xy-background-color-default: #fffefb; --xy-node-border-selected-default: 1px solid #a47764; } .editor :global(.react-flow__attribution) { bottom: 5px; right: 5px; font-size: 9px; background: #fffefbc9; } +/* 手形模式在 pane/节点上给 grab 光标,拖动 pane 时改为 grabbing。 */ .handMode :global(.react-flow__pane), .handMode :global(.react-flow__node) { cursor: grab; } .handMode :global(.react-flow__pane.dragging) { cursor: grabbing; } +/* 卡片基础边框/圆角/阴影,selectedNode 单独标记选择;标题绝对放在节点上方。 */ .node { position: relative; padding: 0; border: 1px solid #ded7ce; border-radius: 10px; background: white; color: #37352f; box-shadow: 0 2px 5px #40302405; } .selectedNode { border-color: #a47764; box-shadow: 0 0 0 2px #a4776425; } .nodeHeading { position: absolute; left: 0; top: -26px; display: flex; align-items: center; gap: 6px; height: 20px; max-width: 100%; font-size: 11px; color: #92877c; white-space: nowrap; cursor: grab; } +/* 文本填满 flex 容器,允许尺寸缩到零且关闭原生 resize;焦点时覆盖全局输入阴影,避免额外边框。 */ .cardText, .plainText { box-sizing: border-box; display: block; width: 100%; height: 100%; min-height: 0; min-width: 0; flex: 1; padding: 14px; resize: none; border: 0; border-radius: inherit; background: transparent; outline: none; box-shadow: none; } .cardText:focus, .plainText:focus { outline: none; box-shadow: none; border-color: transparent !important; } .cardText::placeholder, .plainText::placeholder { color: #b2a99e; } +/* 卡片图片保持原比例装入可用空间,不以图片固有尺寸撑开节点。 */ .image { display: block; flex: 1; min-height: 0; width: 100%; height: 100%; max-width: 100%; border-radius: inherit; object-fit: contain; } +/* 工具栏按 aria-pressed 高亮当前模式;disabled 光标不表示实际业务锁逻辑。 */ .toolbar button[aria-pressed="true"] { background: #f1e6df; color: #78523f; } .toolbar button:disabled { cursor: not-allowed; } +/* 右上工具条纵排;缩放值固定 48px 并使用等宽数字,避免百分比变化挤动旁边按钮。 */ .topRight { position: absolute; top: 12px; right: 12px; z-index: 10; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; } .toolbar .zoomValue { box-sizing: border-box; flex: 0 0 48px; width: 48px; height: var(--toolbar-control-height, 32px); padding: 0; border-radius: 5px; font: inherit; font-variant-numeric: tabular-nums; } .toolbar .zoomValue:hover { background: #e9e7e3; } +/* 底部主工具栏相对画布居中;帮助、错误等浮层各自定位和设层级。 */ .bottomToolbar { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 10; } +/* 帮助面板固定在视口右下方,有宽高上限和内部滚动,长内容不溢出视口。 */ .helpPopup { position: fixed; inset: auto 12px 62px auto; margin: 0; width: 330px; max-width: calc(100vw - 32px); max-height: calc(100dvh - 110px); overflow-y: auto; padding: 18px; border: 1px solid #e2dcd3; border-radius: 12px; background: white; color: #6d6054; box-shadow: 0 8px 30px #32251a14; font-size: 12px; line-height: 1.7; } .helpPopup strong { color: #49372e; font-size: 13px; } .helpPopup p { margin-top: 9px; } +/* 画布错误在上方居中显示,宽度随视口收缩,不参与节点几何计算。 */ .error { position: absolute; top: 78px; left: 50%; transform: translateX(-50%); max-width: min(500px, calc(100vw - 32px)); padding: 10px 14px; border: 1px solid #e5c7b8; border-radius: 8px; color: #a25439; background: #fff9f3; font-size: 12px; z-index: 15; } .helpToolbar { position: absolute; right: 12px; bottom: 12px; z-index: 10; } +/* 迁移控制面板处于较高层级;按钮状态、是否允许迁移由组件判断。 */ .migrationPanel { position: absolute; right: 12px; top: 64px; z-index: 220; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; max-width: 360px; padding: 8px; border: 1px solid #ded7ce; border-radius: 7px; background: #fffefb; color: #78523f; font-size: 12px; } .migrationPanel button { border: 1px solid #ded7ce; border-radius: 5px; padding: 6px 9px; background: white; cursor: pointer; } .migrationPanel button:disabled { cursor: default; opacity: .5; } +/* 旧/迁移画布表面铺满宿主,具体渲染内容由桥接组件决定。 */ .migrationSurface { position: absolute; inset: 0; } +/* 窄屏把右上工具条下移避让标题,底部工具条改左对齐并横向滚动,预留右侧帮助空间。 */ @media (max-width: 700px) { .topRight { top: 62px; right: 12px; } .bottomToolbar { left: 12px; bottom: 12px; transform: none; max-width: calc(100vw - 92px); overflow-x: auto; overscroll-behavior-x: contain; } } +/* 手形模式让文本/图片不拦截指针;右上工具条自身横向滚动以容纳窄视口。 */ .handMode .node textarea, .handMode .node img { pointer-events: none; } .topRight .toolbar { max-width: calc(100vw - 24px); overflow-x: auto; } +/* 隐藏旧 handle 且禁用命中,新的中心点交互在后续规则控制。 */ .node :global(.react-flow__handle).legacyHandle { opacity: 0; pointer-events: none; } +/* 变换容器以中心为 transform-origin,保留溢出给标题、handle 和提示;边框/阴影变化有短过渡。 */ .transformFrame { position: relative; box-sizing: border-box; display: flex; flex-direction: column; transform-origin: center; overflow: visible; transition: border-color 160ms ease, box-shadow 160ms ease; } +/* 纯内容 frame 默认透明边框,选中才显示;plainText 后置 padding 覆盖卡片文本的 14px。 */ .plainFrame { padding: 0; border: 1px solid transparent; border-radius: 2px; background: transparent; box-shadow: none; } .plainFrame.selectedFrame { border-color: #a47764; } .plainText { padding: 4px; } +/* 中心连接点默认透明且不响应指针;选中只改变可见性,connectionindicator 才开放命中。 */ .node :global(.react-flow__handle).centerHandle { width: 10px; height: 10px; display: grid; place-items: center; background: #a47764; color: #78523f; border: 0; border-radius: 50%; z-index: 7; cursor: crosshair; touch-action: none; opacity: 0; pointer-events: none; transition: opacity 160ms ease, background 160ms ease, border-color 160ms ease; } .selectedNode :global(.react-flow__handle).centerHandle { opacity: 1; } .node :global(.react-flow__handle).centerHandle:global(.connectionindicator) { pointer-events: auto; } .node :global(.react-flow__handle).centerHandle:hover { border-color: #a47764; background: #f1e6df; } +/* 右下缩放按钮单独命中、禁止触摸默认行为;旋转模式隐藏它,避免两种手势同时起动。 */ .cornerResize { position: absolute; right: 2px; bottom: 2px; display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 3px; color: #92877c; background: transparent; z-index: 8; cursor: nwse-resize; touch-action: none; opacity: 1; scale: 1; pointer-events: auto; transition: opacity 160ms ease, scale 160ms ease; } .selectedFrame .cornerResize { opacity: 1; scale: 1; pointer-events: auto; } .rotatingFrame .cornerResize { opacity: 0; pointer-events: none; } +/* 旋转时由 frame 接收手势,文本和中心连接点让出指针。 */ .rotatingFrame { cursor: grabbing; touch-action: none; } .rotatingFrame textarea, .node.rotatingFrame :global(.react-flow__handle).centerHandle { pointer-events: none; } +/* 角度提示放在 frame 下方,禁止命中以免遮住正在进行的手势。 */ .rotationHint { position: absolute; left: 50%; bottom: -30px; translate: -50% 0; display: flex; align-items: center; gap: 4px; white-space: nowrap; padding: 4px 7px; border-radius: 5px; background: #fffefbe8; color: #78523f; font-size: 10px; pointer-events: none; } +/* 节点样式工具栏采用横排可滚动表面,按钮尺寸固定;数值/选择器共用高度。 */ .styleToolbar { display: flex; align-items: center; gap: 3px; padding: 4px; border: 1px solid #ded7ce; border-radius: 8px; background: #fffefb; color: #49372e; box-shadow: 0 5px 20px #32251a12; max-width: calc(100vw - 24px); overflow-x: auto; } .styleToolbar button { display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 28px; padding: 0; border-radius: 4px; } .styleToolbar button:hover, .styleToolbar button[aria-pressed="true"] { background: #f1e6df; color: #78523f; } .styleToolbar select, .styleToolbar input[type="number"] { height: 28px; border: 0; border-radius: 3px; background: transparent; padding: 0 3px; font-size: 12px; } .styleToolbar input[type="number"] { width: 48px; } +/* 可见圆点只显示颜色,透明原生 color input 覆盖整个点击区域。 */ .colorPicker { position: relative; display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 28px; cursor: pointer; } .colorPicker span { width: 17px; height: 17px; border: 1px solid #bfb4aa; border-radius: 50%; } .colorPicker input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; } +/* 分支菜单固定定位并高于普通工具条,菜单项整行点击;定位坐标由组件计算。 */ .branchMenu { position: fixed; z-index: 60; width: 210px; padding: 7px; border: 1px solid #ded7ce; border-radius: 10px; background: #fffefb; color: #49372e; box-shadow: 0 8px 30px #32251a1a; } .branchMenu header { display: flex; align-items: center; justify-content: space-between; padding: 3px 6px 6px; color: #92877c; font-size: 11px; } .branchMenu header button { display: grid; place-items: center; width: 24px; height: 24px; } .branchMenu > button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 8px; border-radius: 5px; font-size: 13px; text-align: left; } .branchMenu button:hover { background: #f1e6df; } +/* 节点图标填满内容区域,SVG 自身不截获指针,事件交给外层节点。 */ .iconContent { width: 100%; height: 100%; padding: 6px; border-radius: inherit; } .iconContent svg { pointer-events: none; } +/* 图标选择器固定在左侧,可用高度限定并采用纵向 flex,头/搜索/分类与列表分区。 */ .iconPicker { position: fixed; top: 70px; left: 12px; bottom: 70px; z-index: 60; display: flex; flex-direction: column; width: 272px; max-width: calc(100vw - 24px); max-height: 550px; padding: 14px; border: 1px solid #ded7ce; border-radius: 12px; background: #fffefb; color: #49372e; box-shadow: 0 8px 30px #32251a14; } .iconPicker header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; font-size: 14px; } .iconPicker header button { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 4px; } .iconPicker input { width: 100%; padding: 7px 9px; border: 1px solid #ded7ce; border-radius: 6px; font-size: 12px; margin-bottom: 12px; } +/* 普通图标网格五列并内部滚动;后续 virtualIconGrid 是虚拟列表视口,窗口项目由 JS 定位。 */ .iconGrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; overflow-y: auto; } .iconGrid button { display: grid; place-items: center; aspect-ratio: 1; border-radius: 6px; color: #6d6054; } .iconGrid button:hover, .iconPicker header button:hover { background: #f1e6df; } .iconPicker footer { padding-top: 12px; color: #92877c; font-size: 10px; } +/* 来源选择器限制宽度,分类按钮可换行并按 aria-pressed 显示当前筛选。 */ .iconSource { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; font-size: 11px; } .iconSource select { min-width: 0; max-width: 175px; padding: 4px; border: 1px solid #ded7ce; border-radius: 5px; background: transparent; } .iconCategories { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; } .iconCategories button { padding: 3px 6px; border-radius: 4px; color: #92877c; font-size: 10px; } .iconCategories button[aria-pressed="true"] { background: #f1e6df; color: #78523f; } +/* flex:1 让列表吃剩余高度,overscroll contain 减少滚动传到外层;CSS 不负责裁剪数据窗口。 */ .virtualIconGrid { flex: 1; min-height: 96px; overflow-y: auto; overscroll-behavior: contain; } .virtualIconGrid button { display: grid; place-items: center; border: 3px solid transparent; border-radius: 8px; background-clip: padding-box; color: #6d6054; } .virtualIconGrid button:hover { background-color: #f1e6df; } .virtualIconGrid button:focus-visible, .iconCategories button:focus-visible { outline: 2px solid #a47764; outline-offset: -2px; } +/* 图标资源加载提示与选择器使用相近层级/起点。 */ .iconLoading { position: absolute; left: 12px; top: 70px; z-index: 60; padding: 14px; border-radius: 10px; background: #fffefb; font-size: 12px; } +/* 归属徽标放在节点下方,限制长名称且不参与命中;旋转时隐藏以减少遮挡。 */ .membershipBadge { position: absolute; bottom: -25px; left: 0; display: flex; align-items: center; gap: 4px; max-width: 280px; padding: 3px 6px; border-radius: 4px; background: #e9f1e9; color: #3e684b; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; } .rotatingFrame .membershipBadge { display: none; } .frameMemberCount { font-size: 10px; color: #92877c; white-space: nowrap; } +/* 名称模式按钮宽度随文字,菜单固定定位且限制在视口内,勾选列保持对齐。 */ .styleToolbar .frameModeTrigger { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: auto; min-width: 96px; flex: 0 0 auto; padding: 0 7px; font-size: 12px; } .frameModeMenu { position: fixed; z-index: 120; width: 220px; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow-y: auto; padding: 5px; border: 1px solid #ded7ce; border-radius: 9px; background: #fffefb; color: #49372e; box-shadow: 0 8px 28px #32251a1f; } .frameModeMenu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 7px; border-radius: 5px; text-align: left; } @@ -94,33 +127,43 @@ .frameModeCheck { display: grid; place-items: center; width: 15px; flex: 0 0 15px; } .frameModeMenu strong { display: block; font-size: 12px; font-weight: 500; } .frameModeMenu small { display: block; margin-top: 2px; color: #92877c; font-size: 10px; } +/* 加入目标用绿色边框/光晕,移出预览改虚线;提示元素本身不拦截拖放。 */ .frameNode.frameDropTarget { border-color: #538366; background: #5383660c; box-shadow: 0 0 0 3px #53836638; } .frameNode.frameDropExit { border-style: dashed; } .frameDropHint { position: absolute; top: 12px; left: 12px; transform-origin: top left; border: 1px solid #9db8a4; border-radius: 6px; padding: 6px 9px; background: #f3f8f3; color: #3e684b; font-size: 12px; white-space: nowrap; pointer-events: none; } +/* 归属变更通知居中放在底部工具栏上方;空内容隐藏,非空也不接管指针。 */ .membershipNotice { position: absolute; bottom: 70px; left: 50%; transform: translateX(-50%); z-index: 20; max-width: min(540px, calc(100vw - 32px)); padding: 8px 12px; border: 1px solid #c8d9ca; border-radius: 8px; background: #f3f8f3; color: #3e684b; font-size: 12px; pointer-events: none; } .membershipNotice:empty { display: none; } +/* 手形模式统一关闭文本、缩放、中心点和样式工具条的编辑入口。 */ .handMode .plainText { pointer-events: none; } .handMode .rotationHint, .handMode .centerHandle { visibility: hidden; } .handMode .cornerResize { pointer-events: none; opacity: 0.6; } .handMode .styleToolbar { display: none; } +/* 第一组减少动态效果规则关闭 frame、角缩放和中心点的过渡;后面还有分段滑块/连线动画的关闭规则。 */ @media (prefers-reduced-motion: reduce) { .transformFrame, .cornerResize, .node :global(.react-flow__handle).centerHandle { transition: none; } } +/* 分区主体 pointer-events:none,让内部节点/画布继续接收事件;标签和四边命中条另行启用 pointer-events。 */ .frameNode { border: 1px solid #c9b7a5; border-radius: 8px; background: transparent; pointer-events: none; } .frameNode.selectedFrame { border-color: #a47764; box-shadow: 0 0 0 2px #a477641a; } +/* 名称放在分区顶部外侧并以左下角缩放;文字截断但标签自身可拖动。 */ .frameLabel { position: absolute; bottom: calc(100% + 8px); left: 0; max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; line-height: 22px; color: #92806d; transform-origin: left bottom; pointer-events: auto; cursor: grab; } +/* 四条 10px 命中带跨在视觉边框两侧,扩大拖动区域,不给整个分区内部铺点击层。 */ .frameBorderHit { position: absolute; pointer-events: auto; cursor: grab; } .frameBorder_top { top: -5px; left: 0; right: 0; height: 10px; } .frameBorder_bottom { bottom: -5px; left: 0; right: 0; height: 10px; } .frameBorder_left { left: -5px; top: 0; bottom: 0; width: 10px; } .frameBorder_right { right: -5px; top: 0; bottom: 0; width: 10px; } +/* 分区改名输入沿用工具栏高度;手形模式下标签和命中边框也不接管事件。 */ .styleToolbar .frameNameInput { width: 150px; height: 28px; padding: 0 6px; border: 1px solid #ded7ce; border-radius: 4px; font-size: 12px; background: transparent; } .handMode .frameBorderHit, .handMode .frameLabel { pointer-events: none; } +/* 同步错误提示在顶部居中并允许按钮换行,说明文字独占一行。 */ .syncError { position: absolute; left: 50%; top: 70px; translate: -50% 0; z-index: 22; display: flex; flex-wrap: wrap; gap: 8px; max-width: min(580px, calc(100vw - 24px)); padding: 12px; border: 1px solid #e5c7b8; border-radius: 8px; background: #fff9f3; color: #a25439; font-size: 12px; } .syncError span { flex-basis: 100%; } +/* 恢复对话框限制视口宽度并居中,backdrop 给遮罩色;模态焦点行为来自 dialog 而不是 CSS。 */ .recoveryDialog { max-width: min(460px, calc(100vw - 32px)); padding: 24px; margin: auto; border: 1px solid #ded7ce; border-radius: 12px; background: #fffefb; color: #49372e; box-shadow: 0 12px 50px #32251a20; } .recoveryDialog::backdrop { background: #30251e33; } .recoveryDialog h2 { font-size: 16px; margin-bottom: 12px; } @@ -128,24 +171,32 @@ .recoveryDialog > div { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; } .recoveryDialog button { padding: 8px 12px; border: 1px solid #cbb8a8; border-radius: 5px; } +/* 文本编辑容器允许 flex 收缩;readonly textarea 让出指针,由上层选择层处理选择/拖动。 */ .textEditor { position: relative; display: flex; flex: 1; min-width: 0; min-height: 0; width: 100%; height: 100%; border-radius: inherit; } .textEditor textarea[readonly] { pointer-events: none; } +/* 透明选择层盖住内容区域,选中后给 grab 光标;手形模式取消该层命中。 */ .textSelectLayer { position: absolute; inset: 0; border-radius: inherit; cursor: default; } .handMode .textSelectLayer { pointer-events: none; } .selectedFrame .textSelectLayer { cursor: grab; } .textSelectLayer:active { cursor: grabbing; } +/* 纯图片没有卡片 padding,图片仅显示不接受选择/拖动,外层控制变换。 */ .plainImageFrame { padding: 0; } .plainImage { width: 100%; height: 100%; display: block; object-fit: contain; pointer-events: none; user-select: none; } +/* 标题省略与改名输入分开;输入固定目标宽度并继承字体。 */ .nodeTitle { min-width: 0; overflow: hidden; text-overflow: ellipsis; } .nodeTitleInput { width: 180px; min-width: 0; height: 22px; padding: 0 4px; border: 1px solid #cbb8a8; border-radius: 4px; background: #fffefb; font: inherit; color: #78523f; } +/* 三段图标选项用 isolation 建局部层叠,按钮在滑块上方,背景由滑块提供。 */ .frameLabelSegments { position: relative; display: flex; padding: 3px; border-radius: 6px; background: #f1eee8; isolation: isolate; } .frameLabelSegments button { position: relative; z-index: 1; width: 28px; height: 28px; flex: 0 0 28px; background: transparent !important; color: #92877c; } .frameLabelSegments button[aria-checked="true"] { color: #78523f; } +/* 滑块绝对定位并用 transform 做短过渡,实际位移由组件按选项设置。 */ .frameLabelSlider { position: absolute; left: 3px; top: 3px; width: 28px; height: 28px; border-radius: 4px; background: #fffefb; box-shadow: 0 1px 4px #32251a16; transition: transform 160ms ease; } +/* 八向缩放 handle 按中心锚定,pointer-events:auto 覆盖外层让出命中的行为;手形模式再禁用。 */ .resizeHandle { position: absolute; width: 10px; height: 10px; transform: translate(-50%, -50%); border: 1px solid #a47764; border-radius: 2px; padding: 0; background: #fffefb; z-index: 12; touch-action: none; pointer-events: auto; } .handMode .resizeHandle { pointer-events: none; } +/* 连线工具条可换行,数字、颜色、范围和选择器分别限宽,避免长表单撑出视口。 */ .edgeToolbar { display: flex; align-items: end; flex-wrap: wrap; gap: 7px; max-width: min(680px, calc(100vw - 24px)); padding: 10px; border: 1px solid #ded7ce; border-radius: 9px; background: #fffefb; color: #49372e; box-shadow: 0 5px 20px #32251a14; } .edgeToolbar label { display: flex; align-items: center; gap: 4px; font-size: 10px; } .edgeToolbar input[type="number"] { width: 50px; } @@ -156,17 +207,24 @@ .edgeToolbar button:hover { background: #f1e6df; } .edgeToolbar button:disabled { opacity: .4; } .edgeToolbar small { width: 100%; color: #92877c; font-size: 10px; } +/* 曲线控制点用 pointer-events:all 开放 SVG 命中,触摸默认行为关闭,拖动逻辑由事件处理器负责。 */ .curveControl { cursor: move; touch-action: none; pointer-events: all; } +/* 连线效果分别用 dashoffset 流动和 opacity 脉冲;是否附加动画类由执行状态/配置决定。 */ .edgeDashAnimation { animation: edgeDash 1.6s linear infinite; } .edgePulseAnimation { animation: edgePulse 1.6s ease-in-out infinite; } +/* 虚线一个周期移动 40 单位;脉冲从低透明到不透明再返回。 */ @keyframes edgeDash { to { stroke-dashoffset: -40; } } @keyframes edgePulse { 0%, 100% { opacity: .1; } 50% { opacity: 1; } } +/* 第二组减少动态效果规则关闭滑块过渡和两种连线动画。 */ @media (prefers-reduced-motion: reduce) { .frameLabelSlider { transition: none; } .edgeDashAnimation, .edgePulseAnimation { animation: none; } } +/* 全画布 busy 覆盖层是独立呈现态;成员局部同步使用后部 memberSync,不应从这个类推断所有任务都会锁画布。 */ .canvasBusy { position: absolute; inset: 0; display: flex; align-items: start; justify-content: center; padding-top: 80px; z-index: 200; background: #fffefb35; cursor: progress; color: #78523f; font-size: 12px; } +/* 子图显示比例输入窄排布;折叠子图的摘要占内部 inset 区域并可点击。 */ .subgraphScale { display: flex; align-items: center; gap: 2px; font-size: 11px; } .subgraphScale input { width: 45px; } .collapsedSubgraph { position: absolute; inset: 15px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; color: #92877c; pointer-events: auto; font-size: 12px; } .collapsedSubgraph small { font-size: 10px; } +/* 元素 AI 面板限制视口宽度;标题信息省略,提示词可纵向伸展,底部模型/传播/执行按钮横排。 */ .aiPanel { width: min(440px, calc(100vw - 28px)); border: 1px solid #ded7ce; border-radius: 13px; padding: 14px; background: #fffefb; box-shadow: 0 8px 30px #32251a16; color: #49372e; } .aiPanel header { display: flex; align-items: center; gap: 6px; font-size: 12px; margin-bottom: 9px; } .aiPanel header span { margin-left: auto; color: #92877c; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; } @@ -176,32 +234,40 @@ .aiPanel footer label { display: flex; align-items: center; gap: 4px; font-size: 10px; white-space: nowrap; } .aiPanel footer button { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; border-radius: 8px; background: #78523f; color: white; } .aiPanel footer button:disabled { opacity: .35; } +/* 普通提示与 role=alert 错误采用不同颜色;冲突候选区域独立滚动并保留预格式文本换行。 */ .aiPanel p { margin: 7px 0 0; color: #92877c; font-size: 10px; } .aiPanel p[role="alert"] { color: #a25439; } .aiConflict { max-height: 180px; overflow: auto; padding: 8px; border-radius: 7px; background: #f4eee7; font-size: 11px; } .aiConflict pre { white-space: pre-wrap; } .aiConflict img { max-height: 100px; } .aiConflict button { padding: 6px; color: #78523f; } +/* 对通用变换 frame 再声明中心 handle:默认不可见不可命中,选中显示、connectionindicator 开启命中。 */ .transformFrame :global(.react-flow__handle).centerHandle { width: 10px; height: 10px; border: 0; background: #a47764; opacity: 0; pointer-events: none; } .selectedFrame :global(.react-flow__handle).centerHandle { opacity: 1; } .transformFrame :global(.react-flow__handle).centerHandle:global(.connectionindicator) { pointer-events: auto; } +/* 端口先定义几何,再在下一条默认隐藏/禁用;选中只显示,是否可连仍由 connectionindicator 决定。 */ .framePort { width: 8px; height: 8px; border: 1px solid #fffefb; background: #a47764; pointer-events: auto; } .framePort { opacity: 0; pointer-events: none; } .selectedFrame .framePort { opacity: 1; } .framePort:global(.connectionindicator) { pointer-events: auto; } .rotatingFrame :global(.react-flow__handle).centerHandle { pointer-events: none; } +/* busy 状态中的恢复/重试按钮仍显示明确可点表面。 */ .canvasBusy button { margin: 8px 5px; padding: 6px 9px; border: 1px solid #ded7ce; border-radius: 5px; background: #fffefb; cursor: pointer; } +/* 图片上传状态浮在底部工具栏上方,宽度受容器限制,不作为节点持久数据。 */ .imageUploadStatus { position: absolute; bottom: 88px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; align-items: center; gap: 12px; max-width: min(600px,90%); padding: 10px 14px; background: #fffdf9; border: 1px solid #ded5cb; border-radius: 10px; color: #796e63; font-size: 12px; box-shadow: 0 4px 18px #372f2410; } +/* 成员同步只显示紧凑状态和下划线操作按钮,不使用全画布遮罩。 */ .memberSync { padding: 5px 9px; border: 1px solid #ded7ce; border-radius: 7px; background: #fffefb; color: #796e63; font-size: 11px; box-shadow: 0 2px 8px #372f2410; } .memberSync button { margin-left: 6px; border: 0; background: transparent; color: #78523f; text-decoration: underline; cursor: pointer; } +/* 导入状态面板位于右上,有宽高上限和内部滚动;summary 切换详情,任务之间用边线分隔。 */ .importPanel { position: absolute; top: 84px; right: 12px; z-index: 12; width: max-content; max-width: min(310px, calc(100vw - 28px)); max-height: 45vh; overflow: auto; border: 1px solid #ded7ce; border-radius: 10px; padding: 6px 9px; background: #fffefb; box-shadow: 0 4px 18px #32251a10; color: #49372e; font-size: 11px; } .importPanel summary { cursor: pointer; padding: 5px 0; } .importPanel ul { padding-left: 16px; overflow-wrap: anywhere; } .importPanel p { margin: 5px 0; } .importPanel small { color: #92877c; } .importJob { border-top: 1px solid #eee7de; padding-top: 5px; margin-top: 5px; } +/* 导入动作横排,其余任务按钮使用文字色与局部留白,任务状态由 runtime/组件决定。 */ .importActions { display: flex; align-items: center; gap: 8px; } .importActions > button:not(:first-child), .importJob button { color: #78523f; padding: 4px 0; } diff --git a/src/components/landing-page.module.css b/src/components/landing-page.module.css index 9ce0ff9..1a7dc3b 100644 --- a/src/components/landing-page.module.css +++ b/src/components/landing-page.module.css @@ -1,95 +1,121 @@ +/* 当前 LandingPage 的局部配色、两栏首屏、可选预览卡片、功能区和响应式布局;预览交互由组件状态驱动,不使用真实画布模型。 */ +/* 页面作用域内定义墨色/弱文字/边线变量,局部规则覆盖全局品牌类时使用 :global。 */ .page { --ink: #21221f; --muted: #797b73; --line: #e5e6df; background: #fff; color: var(--ink); font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; } +/* 移除触摸高亮并保留明确的键盘可见焦点描边。 */ .page a, .page button { -webkit-tap-highlight-color: transparent; } .page a:focus-visible, .page button:focus-visible { outline: 2px solid #6879c2; outline-offset: 4px; } +/* 导航内容限制最大宽度,品牌、导航链接和右侧操作区横排。 */ .nav { display: flex; align-items: center; gap: 40px; height: 88px; max-width: 1320px; padding: 0 48px; margin: auto; } .page :global(.brand) { color: var(--ink); gap: 8px; font-size: 19px; letter-spacing: -0.6px; } .page :global(.brand img) { width: 30px; height: 30px; } .page :global(.brand small) { color: #92958c; font-size: 11px; font-weight: 400; letter-spacing: 0; } .nav nav { display: flex; gap: 28px; font-size: 13px; color: #72766c; } .nav nav a:hover { color: var(--ink); } +/* margin-left:auto 将登录和小 CTA 推到最右侧,hover 只改变表面色。 */ .navActions { margin-left: auto; display: flex; align-items: center; gap: 24px; font-size: 13px; } .smallCta { display: inline-flex; align-items: center; gap: 12px; padding: 10px 15px; border: 1px solid #cfd2c8; border-radius: 5px; } .smallCta:hover { background: #f5f6f0; } +/* 桌面首屏文案/预览用接近等宽的两列;clamp 让标题在边界内随视口缩放。 */ .hero { max-width: 1320px; margin: auto; padding: 82px 48px 90px; display: grid; grid-template-columns: 1fr 1.04fr; align-items: center; gap: 46px; } .eyebrow { font: 10px/1.6 ui-monospace, "SFMono-Regular", monospace; letter-spacing: 1.25px; color: #90958a; } .heroCopy .eyebrow { display: flex; align-items: center; gap: 8px; white-space: nowrap; } .statusDot { width: 5px; height: 5px; background: #83966c; border-radius: 50%; } .hero h1 { font-size: clamp(38px, 4.4vw, 61px); font-weight: 600; line-height: 1.23; letter-spacing: -3px; margin: 22px 0; } .hero h1 > span { position: relative; white-space: nowrap; } +/* 标题装饰线通过伪元素绘制,不增加实际文本或影响行内宽度。 */ .hero h1 > span::after { content: ""; position: absolute; left: 0; bottom: -3px; width: 100%; height: 5px; border-bottom: 2px solid #b9c87c; border-radius: 50%; rotate: -2deg; } .heroCopy > p { color: #6f7369; font-size: 15px; line-height: 1.9; font-weight: 400; } +/* CTA 可换行,主按钮悬停上移 1px;旁边文字链接保持次级视觉权重。 */ .heroActions { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; margin-top: 30px; } .primary { display: inline-flex; align-items: center; justify-content: center; gap: 16px; padding: 14px 20px; background: var(--ink); color: #fff; border: 1px solid var(--ink); border-radius: 5px; font-size: 13px; font-weight: 500; box-shadow: 0 2px 2px #21221f08; transition: background 160ms, translate 160ms; } .primary:hover { background: #41453b; translate: 0 -1px; } .textLink { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: #6e7565; } .textLink:hover { color: #21221f; } +/* 手写风附注和星形装饰仅参与视觉排版。 */ .heroNote { margin-top: 34px; font-family: "Kaiti SC", "STKaiti", Georgia, serif; color: #969a8b; font-size: 13px; display: flex; align-items: center; gap: 8px; } .scribbleStar { font-family: Georgia, serif; color: #929a74; font-size: 24px; } +/* 预览外壳轻微旋转并设置阴影,min-width:0 防止网格项被内容撑宽。 */ .preview { min-width: 0; border: 1px solid #e0e3d9; border-radius: 9px; background: #fafafa; box-shadow: 0 12px 50px #3c442508, 0 2px 8px #3c442505; rotate: -1deg; } .previewHeading { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; font-size: 10px; color: #777d70; } .previewHeading > span:first-child { display: flex; align-items: center; gap: 7px; color: #69745e; } .previewHeading > span:last-child { font: 8px ui-monospace, monospace; letter-spacing: 1px; } .tinyLogo { font-size: 20px; color: #4c5841; } +/* 点阵预览固定宽高比,卡片和 SVG 连线在相同相对容器内绝对定位。 */ .scene { position: relative; aspect-ratio: 600 / 440; background-image: radial-gradient(#dce1d2 0.65px, transparent 0.65px); background-size: 17px 17px; } .wires { position: absolute; inset: 0; width: 100%; height: 100%; stroke: #a3ad90; stroke-width: 1; } .wires circle { fill: #a3ad90; } +/* 预览卡片作为按钮可点击,hover 上移,activeCard 通过边框/阴影反馈当前选择。 */ .scene > button { position: absolute; display: flex; flex-direction: column; text-align: left; border: 1px solid #e1e4d8; border-radius: 5px; padding: 14px; background: #fff; color: #373a35; box-shadow: 0 2px 5px #32471504; transition: box-shadow 180ms, border-color 180ms, translate 180ms; } .scene > button:hover { translate: 0 -3px; } .scene .activeCard { border-color: #9aa77d; box-shadow: 0 0 0 2px #9aa77d15, 0 4px 12px #32471508; } .cardLabel { display: flex; align-items: center; gap: 5px; font-size: 9px; color: #9aab88; } +/* 三类预览卡片各有位置、旋转和排版;纸角、艺术图与标签是局部装饰。 */ .ideaCard { left: 5%; top: 17%; width: 42%; min-height: 41%; rotate: -3deg; } .ideaCard strong { margin-top: 14px; margin-bottom: 13px; font-size: clamp(13px, 1.6vw, 22px); font-family: "Songti SC", Georgia, serif; font-weight: 400; line-height: 1.55; } .cardText { font-size: 9px; line-height: 1.8; color: #9ba48f; } .paperCorner { position: absolute; bottom: 4px; right: 4px; width: 10px; height: 10px; border-right: 1px solid #d9dece; border-bottom: 1px solid #d9dece; } +/* 艺术卡片给 SVG 可用高度,使用无填充线稿;便签另有底色与字号。 */ .scene .artCard { top: 8%; right: 7%; width: 29%; min-height: 49%; background: #edeaf7; rotate: 4deg; } .artCard svg { width: 100%; max-height: 150px; flex: 1; stroke: #53584d; stroke-width: 1.2; fill: none; } .artCaption { font: italic 8px Georgia, serif; text-align: center; color: #909e79; } .scene .noteCard { left: 38%; bottom: 9%; width: 37%; min-height: 27%; background: #f0eedf; rotate: 2deg; } .noteCard strong { margin: 9px 0 12px; font-size: clamp(11px, 1.4vw, 18px); font-family: "Songti SC", Georgia, serif; font-weight: 400; line-height: 1.5; } .noteTag { align-self: flex-start; font-size: 8px; padding: 3px 5px; border: 1px solid #d6d6ba; border-radius: 3px; color: #8f9278; } +/* 随手附注与假协作光标定位在预览中,光标不拦截鼠标事件。 */ .looseNote { position: absolute; left: 8%; bottom: 12%; color: #aab39c; rotate: -10deg; font: italic 14px Georgia, serif; } .cursor { position: absolute; right: 17%; bottom: 20%; color: #879567; rotate: -12deg; pointer-events: none; } .cursor span { position: absolute; top: 20px; left: 12px; background: #879567; color: white; border-radius: 3px; padding: 3px 7px; font-size: 9px; } +/* 预览页脚横排指示点与页码,aria-pressed 标示当前点,最后一项推到右侧。 */ .previewFooter { display: flex; align-items: center; gap: 10px; padding: 13px 18px; border-top: 1px solid var(--line); font-size: 9px; color: #a1a992; } .previewFooter > div { display: flex; gap: 5px; } .previewFooter button { width: 5px; height: 5px; border-radius: 50%; background: #d8dfcc; } .previewFooter button[aria-pressed="true"] { background: #879567; } .previewFooter > span:last-child { margin-left: auto; font: 9px ui-monospace, monospace; } +/* 宣言横条用上下边线与两侧注记分隔首屏和后续内容。 */ .manifestoStrip { display: flex; align-items: center; justify-content: space-between; gap: 20px; max-width: 1224px; margin: 0 auto; padding: 25px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); } .manifestoStrip > span { font: 8px ui-monospace, monospace; letter-spacing: 0.6px; color: #a0a494; } .manifestoStrip p { font-size: 13px; color: #646c58; letter-spacing: 0.3px; } .manifestoStrip p span { color: #9ba28e; } +/* 功能区域限制最大宽度;标题与说明左右对齐,功能卡使用三列网格。 */ .space { max-width: 1320px; margin: auto; padding: 105px 48px; } .sectionHeading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 48px; } .sectionHeading h2, .faq h2 { font-size: 34px; line-height: 1.5; letter-spacing: -1px; font-weight: 500; margin-top: 18px; } .sectionHeading > p { padding-bottom: 5px; color: #6c7166; line-height: 1.9; font-size: 13px; } .featureGrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; } .featureGrid article { min-width: 0; } +/* 每个功能插画使用固定高度裁剪容器,内部收集/连线/创作布局分别绘制。 */ .featureArt { position: relative; height: 185px; border: 1px solid #eaede4; border-radius: 6px; background: #f9faf6; overflow: hidden; margin-bottom: 25px; } +/* 收集示例用轻微旋转和水平位移错开三条素材,保持纵向居中。 */ .collectArt { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; } .collectArt span { display: flex; align-items: center; gap: 9px; padding: 8px 12px; min-width: 70%; border: 1px solid #e1e6d7; border-radius: 4px; background: #fff; font-size: 10px; color: #859471; rotate: -2deg; } .collectArt span:nth-child(2) { rotate: 2deg; translate: 8px 0; } .collectArt span:nth-child(3) { rotate: -1deg; translate: -5px 0; } .collectArt svg { width: 14px; } +/* 连线示例 SVG 铺满插画,两个端点卡片和装饰字形单独定位。 */ .connectArt svg { width: 100%; height: 100%; stroke: #b1b99e; } .connectArt span { position: absolute; top: 39px; left: 23px; padding: 10px 13px; border: 1px solid #e1e5d6; border-radius: 5px; background: #fff; color: #8a9877; font-size: 11px; } .connectArt span:nth-of-type(2) { top: 110px; left: auto; right: 35px; background: #edf0e1; } .connectArt i { position: absolute; top: 38px; right: 25px; color: #a0ad86; font: 32px Georgia, serif; } +/* 创作示例居中纸张和标题,编辑徽标独立固定在插画右下附近。 */ .createArt { display: grid; place-items: center; } .createArt > div { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px; background: #f1efe3; width: 72%; rotate: -2deg; border: 1px solid #e0dfcf; } .createArt > div > span { font: 7px ui-monospace, monospace; letter-spacing: 1px; color: #9da184; } .createArt strong { font: 25px "Songti SC", Georgia, serif; color: #6e7857; letter-spacing: 1px; } .editBadge { position: absolute; right: 14px; bottom: 24px; display: flex; align-items: center; gap: 5px; padding: 5px 8px; border: 1px solid #dce3cf; background: #fff; border-radius: 4px; font-size: 8px; color: #889874; } +/* 编号、功能标题与正文使用逐级字号,正文行高便于多行阅读。 */ .featureNumber { color: #a4ab98; font: 9px ui-monospace, monospace; letter-spacing: 0.7px; } .featureGrid h3 { font-size: 18px; font-weight: 500; margin: 12px 0; letter-spacing: -0.4px; } .featureGrid p { font-size: 12px; color: #6c7166; line-height: 1.9; } +/* 工作流区域用浅底与上下边线分隔,两列分别承载引语和步骤。 */ .workflow { background: #f7f7f4; border-top: 1px solid #e9ece1; border-bottom: 1px solid #e9ece1; display: grid; grid-template-columns: 1fr 1fr; gap: 90px; padding: 85px max(48px, calc((100vw - 1224px) / 2)); } +/* 引号绝对定位在文案旁,标题自身保持相对定位,签名字体与正文区分。 */ .quote { position: relative; } .quoteMark { font: 80px/1 Georgia, serif; position: absolute; top: -30px; left: -12px; color: #d9dfca; } .quote h2 { position: relative; font: 31px/1.7 "Songti SC", Georgia, serif; color: #586449; } .quote em { display: block; font-style: normal; } .quote p { font-size: 12px; color: #747a6d; line-height: 2; margin-top: 18px; } .signature { display: block; font: italic 13px Georgia, serif; color: #a3ad94; margin-top: 30px; } +/* 步骤纵向居中,每项含编号、文字和右侧不收缩的图标。 */ .workflowList { display: flex; flex-direction: column; justify-content: center; } .workflowList > div { display: flex; gap: 18px; padding: 24px 0; border-bottom: 1px solid #dfe5d4; } .workflowList > div:first-child { padding-top: 0; } @@ -97,11 +123,13 @@ .workflowList h3 { font-size: 15px; font-weight: 500; color: #5e6e4e; margin-bottom: 8px; } .workflowList p { font-size: 11px; line-height: 1.8; color: #747a6d; } .workflowList svg { flex-shrink: 0; color: #a5b38e; margin-left: auto; } +/* FAQ 桌面为标题/问题两列,问题按钮整行可点击;展开内容是否存在由组件决定。 */ .faq { max-width: 1320px; padding: 105px 48px; margin: auto; display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 90px; } .faqItem { border-bottom: 1px solid var(--line); } .faqItem button { display: flex; align-items: center; justify-content: space-between; gap: 20px; width: 100%; padding: 23px 0; font-size: 14px; text-align: left; } .faqItem svg { flex-shrink: 0; color: #929b84; transition: rotate 160ms; } .faqItem p { padding: 0 28px 24px 0; font-size: 12px; line-height: 1.9; color: #8b947e; } +/* 收尾 CTA 居中,星形装饰绝对定位;页脚内容横排并用 auto margin 推开链接。 */ .closing { position: relative; border-top: 1px solid var(--line); text-align: center; padding: 85px 24px 90px; } .closing h2 { font-size: 38px; letter-spacing: -1.3px; font-weight: 500; margin: 18px 0; } .closing p { font-size: 13px; color: #74796d; margin-bottom: 28px; } @@ -110,8 +138,11 @@ .footer > p { font-size: 11px; color: #a1a992; } .footer > a:not(:first-child) { margin-left: auto; display: flex; gap: 7px; align-items: center; font-size: 11px; color: #7e8b6a; } .footer > span { color: #abb39d; font: 8px ui-monospace, monospace; } +/* 断行标记默认隐藏,本文件没有另行显示它的媒体查询。 */ .mobileBreak { display: none; } +/* 大屏仅增大首屏上下留白。 */ @media (min-width: 1400px) { .hero { padding-top: 105px; padding-bottom: 110px; } } +/* 中屏压缩页面边距、标题、按钮及区块间距,仍保留主要双栏/三栏结构。 */ @media (max-width: 1050px) { .nav, .hero, .space, .faq, .footer { padding-left: 30px; padding-right: 30px; } .hero { gap: 26px; } @@ -124,6 +155,7 @@ .featureGrid { gap: 20px; } .faq { gap: 45px; } } +/* 窄屏隐藏导航链接,将首屏、功能、工作流和 FAQ 转为单列,并缩小装饰及页脚内容。 */ @media (max-width: 760px) { .nav { height: 74px; gap: 15px; padding-left: 22px; padding-right: 22px; } .nav nav { display: none; } @@ -159,6 +191,7 @@ .footer > p { display: none; } .footer > span { flex-basis: 100%; } } +/* 极窄屏进一步压缩边距和预览卡片文字,隐藏品牌副标,避免最小视口拥挤。 */ @media (max-width: 380px) { .page :global(.brand small) { display: none; } .hero { padding-left: 20px; padding-right: 20px; } @@ -170,4 +203,5 @@ .ideaCard strong { margin-top: 8px; margin-bottom: 8px; } .noteTag { font-size: 7px; padding: 2px; } } +/* 按减少动态效果偏好关闭链接、按钮和 FAQ 图标的过渡。 */ @media (prefers-reduced-motion: reduce) { .page a, .page button, .faqItem svg { transition: none; } } diff --git a/src/components/ui/icon-button.module.css b/src/components/ui/icon-button.module.css index 3df3986..ab5a221 100644 --- a/src/components/ui/icon-button.module.css +++ b/src/components/ui/icon-button.module.css @@ -1,3 +1,5 @@ +/* IconButton 的共享尺寸、交互态和 tooltip 外观;尺寸从所在 Toolbar 的自定义属性继承,缺省为 32px 控件/20px 图标。 */ +/* 固定 flex 尺寸避免拥挤时压缩;inline-flex 居中图标,透明背景显露宿主表面,文字颜色继承宿主。 */ .button { display: inline-flex; align-items: center; @@ -13,10 +15,13 @@ color: inherit; cursor: pointer; } +/* SVG 同时约束宽高与 flex-basis,防止图标在文字/布局挤压下变形。 */ .button svg { width: var(--toolbar-icon-size, 20px); height: var(--toolbar-icon-size, 20px); flex: 0 0 var(--toolbar-icon-size, 20px); } +/* 悬停填底、键盘可见焦点描边、禁用态降低透明度并提示不可操作。 */ .button:hover { background: #e9e7e3; } .button:focus-visible { outline: 2px solid #9d7d66; outline-offset: 2px; } .button:disabled { opacity: 0.45; cursor: not-allowed; } +/* tooltip 使用高层级深色面板与有限宽度;arrow 颜色与面板一致。 */ .tooltip { z-index: 1000; max-width: 240px; padding: 6px 9px; border-radius: 6px; background: #49372e; color: #fffdf9; font-size: 12px; line-height: 1.45; box-shadow: 0 3px 12px #372f2420; user-select: none; } .arrow { fill: #49372e; } diff --git a/src/components/ui/toolbar.module.css b/src/components/ui/toolbar.module.css index 01db594..a37eae6 100644 --- a/src/components/ui/toolbar.module.css +++ b/src/components/ui/toolbar.module.css @@ -1,3 +1,5 @@ +/* Toolbar 共享表面:统一控件尺寸变量、排列间距、边框和背景;不负责自身在画布中的定位。 */ +/* 提供后代按钮消费的 CSS 变量;半透明背景与 backdrop blur 处理工具栏背后的内容。 */ .surface { --toolbar-icon-size: 20px; --toolbar-control-width: 32px; @@ -18,5 +20,7 @@ } /* Text in the view controls already creates wider visual spacing. */ +/* 含缩放文字的视图工具栏增加横向留白,不改变控件本身的尺寸。 */ .relaxed { column-gap: 6px; padding-inline: 6px; } +/* 分隔线保持 1px flex 基准,避免被相邻控件挤宽或挤没。 */ .divider { flex: 0 0 1px; width: 1px; height: 16px; margin: 0 2px; background: #ece6df; } diff --git a/src/components/workspace/editable-title.module.css b/src/components/workspace/editable-title.module.css index 2e21abc..038fad9 100644 --- a/src/components/workspace/editable-title.module.css +++ b/src/components/workspace/editable-title.module.css @@ -1,9 +1,15 @@ +/* EditableTitle 的只读标题/输入框切换样式;壳体作为错误提示的定位参照,网络和提交状态由组件控制。 */ +/* 相对定位保留标题所在行,绝对定位错误框不会把工具栏向下撑开。 */ .shell { position: relative; display: flex; align-items: center; } +/* 两种状态共用高度、字体和透明边框,降低进入编辑时的尺寸跳变。 */ .title, .input { box-sizing: border-box; min-width: 0; max-width: 100%; height: 32px; padding: 0 6px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: inherit; font: inherit; line-height: 30px; } +/* 非编辑标题单行省略;悬停仅作用于可用按钮,选中态由 data-selected 控制。 */ .title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: left; } .title:hover:not(:disabled) { background: #f0ece6; } .title[data-selected="true"] { background: #ede5dc; border-color: #d3c0b2; } .title:disabled { cursor: default; } +/* 编辑态给定目标宽度但受上方 max-width 限制,readonly 时降低透明度。 */ .input { width: 220px; border-color: #a47764; background: white; outline: none; } .input[readonly] { opacity: 0.65; } +/* 错误框显示在标题下方,并以视口宽度限制最大宽度;长说明允许换行。 */ .error { position: absolute; top: calc(100% + 10px); left: 0; width: 260px; max-width: calc(100vw - 40px); padding: 8px 10px; border: 1px solid #e5c7b8; border-radius: 7px; background: #fff9f3; color: #a25439; font-size: 12px; line-height: 1.6; white-space: normal; box-shadow: 0 4px 12px #32251a0a; } diff --git a/src/components/workspace/workspace.module.css b/src/components/workspace/workspace.module.css index 4d02d58..b104254 100644 --- a/src/components/workspace/workspace.module.css +++ b/src/components/workspace/workspace.module.css @@ -1,3 +1,5 @@ +/* 工作区壳体、目录、账户菜单与画布浮动标题;CSS Module 负责显示,账号/画布生命周期和侧栏开关由组件管理。 */ +/* 侧栏宽度变量供侧栏本体和浮动标题共同消费,根容器至少占满动态视口高度。 */ .shell { --sidebar-width: 270px; display: flex; @@ -5,6 +7,7 @@ background: #fffefb; color: #37352f; } +/* 侧栏插槽 sticky 固定在滚动视口顶部;裁剪展开过渡期间的内容,层级高于画布。 */ .sidebarSlot { position: sticky; top: 0; @@ -14,6 +17,7 @@ overflow: hidden; z-index: 30; } +/* 侧栏采用纵向 flex,导航区可滚动、账户区留在底部;最大宽度给主区域保留至少 40px。 */ .sidebar { display: flex; flex-direction: column; @@ -29,30 +33,38 @@ letter-spacing: -0.15px; color: #37352f; } +/* 顶行按钮分居两端;搜索框 focus-within 让输入聚焦时整个框有反馈。 */ .topRow { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; color: #85817b; } .search { display: flex; align-items: center; gap: 7px; min-height: 32px; border: 1px solid #e6e3df; border-radius: 7px; padding: 4px 8px; color: #97938d; } .search:focus-within { border-color: #b2a292; box-shadow: 0 0 0 2px #b2a29218; } .search input { min-width: 0; width: 100%; padding: 0; background: transparent; border: 0; outline: none; font: inherit; color: #37352f; } .search input::placeholder { color: #9a9690; } +/* flex:1 配合 min-height:0 才允许长目录在侧栏内部滚动。 */ .navigation { flex: 1; min-height: 0; overflow-y: auto; padding-top: 10px; } +/* 首页与目录链接共用行高/图标间距,长标题省略;aria-current 对当前页提供选中背景。 */ .home, .pageLink { display: flex; align-items: center; gap: 8px; padding: 4px 8px; min-height: 30px; border-radius: 6px; font-weight: 450; } .home { width: fit-content; font-weight: 600; background: #ecebe8; } .pageLink { margin: 1px 0; } .pageLink svg { flex-shrink: 0; color: #87837c; } .pageLink span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .pageLink:hover, .pageLink[aria-current="page"] { background: #eae7e2; } +/* 分组名称、空态提示和错误分别排版;错误允许在任意位置折行。 */ .sectionLabel { display: flex; justify-content: space-between; padding: 18px 7px 6px; color: #9b9690; font-size: 11px; font-weight: 400; letter-spacing: 0; } .hint { padding: 4px 8px; color: #9a948c; line-height: 1.6; font-size: 12px; } .error { margin: 6px 4px; font-size: 12px; color: #b14b3c; overflow-wrap: anywhere; } +/* 账户区域向侧栏底部靠齐,按钮占满宽度以便整行点击。 */ .accountArea { margin-top: auto; padding-top: 6px; } .accountButton { display: flex; align-items: center; gap: 8px; padding: 6px 7px; min-height: 36px; width: 100%; border-radius: 6px; text-align: left; color: #37352f; } .accountButton:hover { background: #edeae5; } +/* 头像固定尺寸并裁成圆形,图片 object-fit:cover;缺图时容纳首字占位。 */ .avatar { display: grid; place-items: center; flex: 0 0 24px; width: 24px; height: 24px; overflow: hidden; border-radius: 50%; background: #e8e0d6; color: #705844; font-size: 12px; font-weight: 600; } .avatar img { display: block; width: 100%; height: 100%; object-fit: cover; } .avatarLarge { flex-basis: 36px; width: 36px; height: 36px; font-size: 16px; } +/* 账户文字允许收缩和省略,副文字在此布局隐藏。 */ .accountText { display: flex; flex: 1; flex-direction: column; min-width: 0; } .accountText strong { font-size: 13px; font-weight: 550; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } .accountText small { display: none; } +/* 原生 popover 的面板位置/宽度约束;自身可滚动且从左下角进入,不用 CSS 切换 open 状态。 */ .accountPopup { position: fixed; inset: auto auto 50px 8px; @@ -73,31 +85,40 @@ letter-spacing: -0.15px; transform-origin: bottom left; } +/* 仅 popover 打开时播放进入动画;backdrop 保持透明,但是否可交互仍由 popover 行为决定。 */ .accountPopup:popover-open { animation: account-enter 130ms ease-out; } .accountPopup::backdrop { background: transparent; } +/* 菜单头、工作区字母头像及身份行共用纵向文字布局,长名称省略。 */ .accountHeading { display: flex; align-items: center; gap: 10px; padding: 8px 7px 10px; } .workspaceAvatar { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border-radius: 7px; color: #72533e; background: #eee8df; font-size: 19px; font-weight: 600; } .accountHeading > div, .popupIdentity > div { display: flex; flex-direction: column; min-width: 0; gap: 1px; } .accountHeading strong { font-size: 14px; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } .accountHeading small { color: #8b8780; font-size: 12px; } +/* 菜单分组和身份区域提供内间距,邮箱允许断行;工作区列表限制高度后独立滚动。 */ .menuGroup { padding: 1px 0; } .popupIdentity { display: flex; align-items: center; gap: 8px; padding: 8px 7px 7px; } .popupIdentity strong { font-size: 12px; font-weight: 500; } .popupIdentity small { color: #8b8780; font-size: 11px; overflow-wrap: anywhere; letter-spacing: 0; } .workspaceList { max-height: min(220px, 30dvh); overflow-y: auto; } +/* 菜单项整行可点,文字可收缩,图标保持宽度;disabled 态显式降低透明度。 */ .menuItem { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 31px; padding: 5px 8px; border-radius: 5px; text-align: left; font-size: 13px; line-height: 20px; font-weight: 450; } .menuItem > span:not(.workspaceMini) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .menuItem > svg { flex-shrink: 0; } .menuItem:hover { background: #f1f0ed; } .menuItem:disabled { opacity: 0.45; cursor: not-allowed; } +/* 工作区小头像与新建/登出颜色区分,separator 分隔组而不引入额外布局容器。 */ .workspaceMini { display: grid; place-items: center; flex: 0 0 20px; height: 20px; border-radius: 4px; color: #82634c; background: #f1ebe3; font-size: 11px; font-weight: 600; } .newWorkspace { color: #2383e2; } .logout { color: #78746d; font-size: 12px; } .separator { height: 1px; margin: 6px 7px; background: #eeece8; } +/* 左上浮动条以 --floating-left 定位;侧栏展开时偏移到侧栏右侧,位置和宽度作 240ms 过渡。 */ .floating { --floating-left: 12px; position: fixed; left: var(--floating-left); top: 12px; max-width: calc(100vw - var(--floating-left) - 12px); z-index: 40; transition: left 240ms cubic-bezier(0.22, 1, 0.36, 1), max-width 240ms cubic-bezier(0.22, 1, 0.36, 1); } +/* 展开侧栏时使用实际受视口约束的侧栏宽度计算偏移;账户 popover 也继承同一偏移变量。 */ .floating[data-sidebar-collapsed="false"], .accountPopup[data-sidebar-collapsed="false"] { --floating-left: calc(min(var(--sidebar-width), calc(100vw - 40px)) + 12px); } +/* 浮动条错误绝对定位于条下方,账户设置面板则沿用对话框容器。 */ .floatingError { position: absolute; left: 0; top: 42px; width: 240px; padding: 10px; background: white; border: 1px solid #e7e2db; border-radius: 8px; color: #b14b3c; font-size: 12px; } .settingsPanel { color: #37352f; border-color: #e6e2dc; border-radius: 12px; } +/* 设置表单纵向排布身份、字段及操作;提交按钮区分主动作,禁用时保留位置。 */ .settingsForm { display: flex; flex-direction: column; gap: 16px; padding-top: 4px; } .settingsIdentity { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #89837b; overflow-wrap: anywhere; } .settingsForm label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; } @@ -106,35 +127,48 @@ .settingsActions button { padding: 6px 12px; border: 1px solid #e2ddd6; border-radius: 6px; font-size: 13px; } .settingsActions button[type="submit"] { background: #37352f; color: white; border-color: #37352f; } .settingsActions button:disabled { opacity: 0.5; cursor: not-allowed; } +/* 固定全视口画布置于底层;点阵背景与加载/错误状态由后续类分别承担。 */ .graph { position: fixed; inset: 0; z-index: 0; display: flex; width: 100%; height: 100dvh; background: #fffefb; } .graphSurface { width: 100%; height: 100%; background-image: radial-gradient(#b8aea245 1px, transparent 1px); background-size: 22px 22px; } .graphStatus { position: absolute; left: 50%; top: 72px; transform: translateX(-50%); max-width: calc(100vw - 48px); padding: 8px 12px; border-radius: 6px; background: #fffefbe6; color: #9a948c; text-align: center; font-size: 13px; } +/* 账户菜单从轻微下移/缩小过渡到正常位置与不透明状态。 */ @keyframes account-enter { from { opacity: 0; transform: translateY(4px) scale(0.985); } to { opacity: 1; transform: translateY(0) scale(1); } } +/* 较窄视口将侧栏目标宽度收为 240px;仍受上方 max-width 约束。 */ @media (max-width: 600px) { .shell { --sidebar-width: 240px; } } +/* 减少动态效果偏好下关闭菜单进入动画;浮动条过渡在文件后部单独关闭。 */ @media (prefers-reduced-motion: reduce) { .accountPopup:popover-open { animation: none; } } +/* 浮动条 logo 链接沿用 Toolbar 控件尺寸与键盘焦点样式,保证和旁边按钮对齐。 */ .logoLink { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; box-sizing: border-box; width: var(--toolbar-control-width, 32px); height: var(--toolbar-control-height, 32px); padding: 4px 6px; border-radius: 5px; } .logoLink img { display: block; width: var(--toolbar-icon-size, 20px); height: var(--toolbar-icon-size, 20px); } .logoLink:hover { background: #e9e7e3; } .logoLink:focus-visible { outline: 2px solid #9d7d66; outline-offset: 2px; } +/* 浮动头像按钮同样使用共享尺寸;从浮动条打开的账户面板改为顶端定位。 */ .floatingAvatarButton { display: grid; place-items: center; flex: 0 0 auto; box-sizing: border-box; width: var(--toolbar-control-width, 32px); height: var(--toolbar-control-height, 32px); border-radius: 5px; } .floatingAvatarButton:hover { background: #e9e7e3; } +/* clamp 把账户面板左边界限制在视口内;transform-origin 随顶部锚点改为左上。 */ .accountPopup[data-floating="true"] { inset: 62px auto auto clamp(8px, var(--floating-left, 12px), max(8px, calc(100vw - 308px))); max-height: calc(100dvh - 76px); transform-origin: top left; } +/* 浮动头像采用图标尺寸,标题允许 flex 收缩但保留溢出区域给编辑错误提示。 */ .floatingAvatarButton .avatar { flex-basis: var(--toolbar-icon-size, 20px); width: var(--toolbar-icon-size, 20px); height: var(--toolbar-icon-size, 20px); font-size: 14px; } .floatingTitle { flex: 1 1 auto; min-width: 0; max-width: 240px; margin: 0; color: #37352f; font-size: 14px; line-height: var(--toolbar-control-height, 32px); font-weight: 500; overflow: visible; } +/* 中等窄屏降低标题最大宽度,不改变标题内容或编辑状态。 */ @media (max-width: 700px) { .floatingTitle { max-width: 180px; } } +/* 极窄且侧栏仍展开时隐藏 logo/标题/分隔,保留浮动条其余控件。 */ @media (max-width: 420px) { .floating[data-sidebar-collapsed="false"] .logoLink, .floating[data-sidebar-collapsed="false"] .floatingTitle, .floating[data-sidebar-collapsed="false"] > span[aria-hidden="true"] { display: none; } } +/* 按用户偏好关闭浮动条位移/宽度过渡。 */ @media (prefers-reduced-motion: reduce) { .floating { transition: none; } } +/* 递归目录清除列表默认缩进,层级缩进由组件布局提供;行本身允许标题收缩。 */ .directoryList { list-style: none; padding: 0; margin: 0; } .directoryRow { display: flex; align-items: center; min-width: 0; } .directoryRow .pageLink { flex: 1; min-width: 0; padding-left: 3px; } +/* 可折叠项按钮与叶项占位共享 20px 列宽,保持各行标题对齐;焦点内描边不扩尺寸。 */ .directoryToggle, .directorySpacer { flex: 0 0 20px; width: 20px; height: 26px; } .directoryToggle { display: grid; place-items: center; border: 0; border-radius: 4px; background: transparent; color: #87837c; cursor: pointer; } .directoryToggle:hover { background: #eae7e2; }