Skip to content

Conversation

@betterdancing
Copy link
Contributor

@betterdancing betterdancing commented Dec 1, 2025

English | 简体中文

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Built its own designer, fully self-validated

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Background and solution

  1. 工具栏上锁定/解锁页面后面有一空白不可见区块
  2. 工具栏上预览的样式重新设计

What is the current behavior?

  1. 工具栏上锁定/解锁页面后面有一空白不可见区块点击后会弹出应用发布
  2. 工具栏上预览的样式重新设计
    Issue Number: N/A

What is the new behavior?

  1. 工具栏上锁定/解锁页面后面的空白不可见区块实际上是Logo组件图标不存在引起的,暂时注释掉这一组件
  2. 工具栏上预览的样式根据设计稿重新编排

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • New Features

    • Preview toolbar now renders as a button with a hover/manual popover offering page and app preview options; save toolbar uses a toggle icon for popover control.
  • Style

    • Reduced toolbar button min-width; refined toolbar icon styling; adjusted popover spacing and item layout.
  • Bug Fixes / Accessibility

    • Toolbar click handling now stops propagation to prevent unintended parent interactions.
  • Chores

    • Removed Logo from engine toolbars; preview/save tools updated to hide titles and declare icon peer dependency.

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions github-actions bot added the enhancement New feature or request label Dec 1, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 1, 2025

Walkthrough

Toolbar UI and behavior changes: ToolbarBaseButton rendering and styles adjusted; preview and save toolbars refactored to use TinyPopover with manual visibility and up/down icons; Logo toolbar entry removed from registry; ToolbarBase click handler now stops propagation; package.json peer/dependencies updated for preview/save.

Changes

Cohort / File(s) Summary
Toolbar Base Button
packages/common/component/toolbar-built-in/ToolbarBaseButton.vue
Conditionally render title span only when options?.showTitle !== false; reduced .toolbar-button min-width 70px → 60px; added nested .svg-icon styling (font-size: 20px, primary icon color) and .tiny-popover.no-arrow { margin-top: 12px }.
Toolbar Base (click handling)
packages/common/component/ToolbarBase.vue
Internal click handler now accepts event e and calls e.stopPropagation(); template passes $event to the handler.
Registry Configuration
packages/design-core/registry.js
Commented out Logo import and removed the Logo entry from exported toolbars, removing the Logo toolbar item.
Preview Toolbar
packages/toolbars/preview/meta.js, packages/toolbars/preview/src/Main.vue, packages/toolbars/preview/package.json
Meta: renderType changed 'icon''button'; added showTitle: false. Component: replaced static UI with TinyPopover-based "预览" trigger, added poperVisible state and openPopover toggle, registered TinyPopover and up/down icons, used OPEN_DELAY, updated styles and preview action handlers. package.json: added dependency @opentiny/tiny-engine-utils and peer dependency @opentiny/vue-icon.
Save Toolbar
packages/toolbars/save/src/Main.vue, packages/toolbars/save/package.json
Popover changed to trigger="manual" with v-model bound poperVisible and removed visible-arrow; reference area replaced with clickable span toggling poperVisible and showing up/down icons; removed public iconExpand prop; exposed poperVisible and openPopover from setup. package.json: added peer dependency @opentiny/vue-icon.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Attention points:
    • packages/toolbars/preview/src/Main.vue: TinyPopover integration, OPEN_DELAY wiring, preview action handlers and component registrations.
    • packages/toolbars/save/src/Main.vue: manual popover binding, removal of iconExpand, and icon component usage.
    • packages/common/component/toolbar-built-in/ToolbarBaseButton.vue: conditional title rendering and CSS changes.
    • packages/common/component/ToolbarBase.vue: ensure stopPropagation does not break expected parent handlers.
    • packages/design-core/registry.js: confirm removing Logo entry has no downstream assumptions.

Poem

🐰 I nudged a button, light and small,
Popovers rose when I gave a call,
The Logo hopped off, shy and fleet,
Icons flip up, then down they meet,
I munch CSS crumbs and do a little beat 🎶

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main changes in the PR: modifying the preview toolbar style to be consistent with the save toolbar, including changes to renderType, popover styling, and visual elements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 666279d and 47d0553.

📒 Files selected for processing (2)
  • packages/toolbars/preview/package.json (2 hunks)
  • packages/toolbars/save/package.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/toolbars/preview/package.json
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: gene9831
Repo: opentiny/tiny-engine PR: 1041
File: packages/plugins/datasource/src/DataSourceList.vue:138-138
Timestamp: 2025-01-14T10:06:25.508Z
Learning: PR #1041 in opentiny/tiny-engine is specifically for reverting Prettier v3 formatting to v2, without any logical code changes or syntax improvements.
📚 Learning: 2024-09-30T07:51:10.036Z
Learnt from: chilingling
Repo: opentiny/tiny-engine PR: 837
File: packages/vue-generator/src/plugins/genDependenciesPlugin.js:66-66
Timestamp: 2024-09-30T07:51:10.036Z
Learning: In the `tiny-engine` project, `opentiny/tiny-engine-dsl-vue` refers to the current package itself, and importing types from it may cause circular dependencies.

Applied to files:

  • packages/toolbars/save/package.json
📚 Learning: 2025-01-14T06:49:00.797Z
Learnt from: gene9831
Repo: opentiny/tiny-engine PR: 1011
File: packages/configurator/src/router-select-configurator/RouterSelectConfigurator.vue:63-73
Timestamp: 2025-01-14T06:49:00.797Z
Learning: In the tiny-engine project, the SvgIcon component is globally registered and available throughout Vue components without requiring explicit imports.

Applied to files:

  • packages/toolbars/save/package.json
📚 Learning: 2025-01-14T06:49:00.797Z
Learnt from: gene9831
Repo: opentiny/tiny-engine PR: 1011
File: packages/configurator/src/router-select-configurator/RouterSelectConfigurator.vue:63-73
Timestamp: 2025-01-14T06:49:00.797Z
Learning: In the tiny-engine project, the SvgIcon component is globally registered using `app.component('SvgIcon', SvgIcon)` in `packages/svgs/index.js`, making it available throughout Vue components without requiring explicit imports.

Applied to files:

  • packages/toolbars/save/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: push-check
🔇 Additional comments (1)
packages/toolbars/save/package.json (1)

40-40: Verify the peer dependency version contains required icon components.

The new peer dependency addition aligns with the coordinated toolbar updates. However, I could not confirm that @opentiny/vue-icon@3.20.0 exports TinyIconUpWard and TinyIconDownWard components—these specific icon names do not appear in available package documentation. Check the @opentiny/vue-icon exports and confirm the icon component names used in the save toolbar implementation match what is available in this version.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/design-core/registry.js (1)

20-21: Logo toolbar removal matches described workaround

Commenting out the Logo import and its engine.toolbars.logo entry cleanly removes the Logo item from the toolbar, which should eliminate the blank clickable block caused by the missing icon. As this is a temporary removal, consider adding a small TODO near one of these comments to track re‑enabling once the Logo component is fixed, but functionally this change is fine.

Also applies to: 141-142

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bea520c and 47618e3.

📒 Files selected for processing (5)
  • packages/common/component/toolbar-built-in/ToolbarBaseButton.vue (3 hunks)
  • packages/design-core/registry.js (2 hunks)
  • packages/toolbars/preview/meta.js (1 hunks)
  • packages/toolbars/preview/src/Main.vue (3 hunks)
  • packages/toolbars/save/src/Main.vue (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: gene9831
Repo: opentiny/tiny-engine PR: 1041
File: packages/plugins/datasource/src/DataSourceList.vue:138-138
Timestamp: 2025-01-14T10:06:25.508Z
Learning: PR #1041 in opentiny/tiny-engine is specifically for reverting Prettier v3 formatting to v2, without any logical code changes or syntax improvements.
📚 Learning: 2024-10-10T02:47:46.239Z
Learnt from: yy-wow
Repo: opentiny/tiny-engine PR: 850
File: packages/toolbars/preview/src/Main.vue:16-16
Timestamp: 2024-10-10T02:47:46.239Z
Learning: In `packages/toolbars/preview/src/Main.vue`, within the `preview` function, the `getMergeMeta` method is used at lines 64 and 65 to retrieve `engine.config` configurations.

Applied to files:

  • packages/toolbars/preview/meta.js
  • packages/toolbars/preview/src/Main.vue
📚 Learning: 2024-10-10T02:48:10.881Z
Learnt from: yy-wow
Repo: opentiny/tiny-engine PR: 850
File: packages/toolbars/preview/src/Main.vue:0-0
Timestamp: 2024-10-10T02:48:10.881Z
Learning: 在 `packages/toolbars/preview/src/Main.vue` 文件中,使用 `useNotify` 而不是 `console` 来记录错误日志。

Applied to files:

  • packages/toolbars/preview/src/Main.vue
  • packages/common/component/toolbar-built-in/ToolbarBaseButton.vue
📚 Learning: 2025-01-14T06:49:00.797Z
Learnt from: gene9831
Repo: opentiny/tiny-engine PR: 1011
File: packages/configurator/src/router-select-configurator/RouterSelectConfigurator.vue:63-73
Timestamp: 2025-01-14T06:49:00.797Z
Learning: In the tiny-engine project, the SvgIcon component is globally registered and available throughout Vue components without requiring explicit imports.

Applied to files:

  • packages/toolbars/preview/src/Main.vue
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: push-check
🔇 Additional comments (5)
packages/toolbars/save/src/Main.vue (1)

10-10: Confirm arrow visibility change on save popover

The tiny-popover here no longer passes visible-arrow, so its arrow behavior has changed compared to the previous implementation. Please confirm this is intentional and aligned with the updated toolbar preview design; otherwise, we may need to restore explicit arrow control or add the appropriate class to match the new .no-arrow styling.

packages/common/component/toolbar-built-in/ToolbarBaseButton.vue (1)

6-6: Title visibility controlled via options.showTitle looks good

Conditionally rendering the title span when options?.showTitle !== false cleanly supports hiding titles (e.g., for preview) while keeping existing buttons unchanged.

packages/toolbars/preview/meta.js (1)

9-10: Preview meta now correctly drives button + icon-only rendering

Switching renderType to 'button' and adding showTitle: false aligns preview with the new ToolbarBaseButton behavior, giving an icon-only button while reusing the common base styling.

packages/toolbars/preview/src/Main.vue (2)

2-9: Preview toolbar popover UX: verify combined hover/click behavior

The new structure—button-style toolbar-base with trigger="hover" and a nested hover-triggered tiny-popover offering “页面预览/应用预览”—matches the desired preview dropdown pattern, with a default click still doing preview('page').

Please sanity‑check the UX in the browser to ensure:

  • Hover on the preview control reliably opens the popover and keeps it open long enough to click “页面预览/应用预览”.
  • The trigger="hover" on toolbar-base and on tiny-popover don’t conflict (e.g., no flicker or unexpected close when moving from the button to the popover content).

If everything feels smooth, the structure looks good.

Also applies to: 11-19


29-35: Popover wiring and props integration look consistent

  • Importing constants and exposing OPEN_DELAY for :open-delay="OPEN_DELAY.Default" keeps preview aligned with the save toolbar’s timing.
  • Registering TinyPopover: Popover as Component and adding the iconExpand prop (default 'down-arrow') are correctly reflected in the template.
  • The preview function continues to use useNotify for error reporting instead of console, which matches prior project guidance. Based on learnings, this is the preferred pattern here.

No issues from a logic or wiring perspective.

Also applies to: 38-39, 42-45, 96-99

background-color: var(--te-component-toolbar-base-button-bg-color) !important;
border: none !important;
min-width: 70px;
min-width: 60px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

❓ Verification inconclusive

🏁 Script executed:

find . -name "ToolbarBaseButton.vue" -type f

Repository: opentiny/tiny-engine

Length of output: 184


🌐 Web query:

Vue.js scoped CSS slotted content does not apply scope attribute

💡 Result:

Cause — scoped styles are only applied to elements owned by the component (Vue adds a data-v-xxx attribute to those elements). Content passed into a is owned by the parent, so Vue does not add the component’s scope attribute to slotted nodes and scoped rules don’t match them by default. [1][2]

Fixes

  • Use the :slotted() pseudo-class inside the child component’s <style scoped> to target slotted nodes: <style scoped> :slotted(.my-item) { color: red; } </style>
  • Or move the rule to the parent (where the slotted content lives) or use a non-scoped/global style.
  • For styling elements inside child components or deep descendants, use :deep(...) (not for slotted content owned by the parent). [1][2]

References
[1] Vue SFC CSS features (scoped, :slotted, :deep).
[2] vue-loader — Scoped CSS behavior and caveats.


Scoped .tiny-popover.no-arrow rule won't apply to slotted popovers

Since popovers are provided via slots, they're owned by parent components and won't carry this component's scope attribute. The scoped .tiny-popover.no-arrow rule won't target them.

Consider using the :slotted() pseudo-class if styling direct slot children, moving this rule to the parent component where the popover is rendered, or using a global/non-scoped style file instead. Avoid :deep() for slotted content, as it's for styling child components and descendants, not slot-provided elements.

🤖 Prompt for AI Agents
In packages/common/component/toolbar-built-in/ToolbarBaseButton.vue around line
39, the scoped CSS rule targeting .tiny-popover.no-arrow won't apply to popovers
rendered via slots because slotted content is owned by the parent and doesn't
get this component's scope attribute; update the styling by either (a) moving
the .tiny-popover.no-arrow rule into the parent component that renders the
popover, (b) place the rule in a global/non-scoped stylesheet so it applies to
slotted elements, or (c) if you only need to style direct slot children, use the
:slotted(.tiny-popover.no-arrow) selector in this component's <style scoped>
block; avoid using :deep() for slot-provided elements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant