Skip to content

refactor(components): [watermark] use type-based definitions#23408

Merged
btea merged 2 commits into
element-plus:devfrom
wjp980108:refactor/watermark-type
Jan 18, 2026
Merged

refactor(components): [watermark] use type-based definitions#23408
btea merged 2 commits into
element-plus:devfrom
wjp980108:refactor/watermark-type

Conversation

@wjp980108
Copy link
Copy Markdown
Contributor

@wjp980108 wjp980108 commented Jan 17, 2026

Please make sure these boxes are checked before submitting your PR, thank you!
rel #23399

  • Make sure you follow contributing guide English | (中文 | Español | Français).
  • Make sure you are merging your commits to dev branch.
  • Add some descriptions and refer to relative issues for your PR.

Summary by CodeRabbit

  • Improvements

    • Watermark component now uses a streamlined, explicit prop typing with built-in default values and clearer public prop surface.
    • No behavioral changes to watermark rendering or defaults beyond the clarified prop handling.
  • Deprecations

    • The previous watermark props type is deprecated — please prepare to migrate before v3.0.0.

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 17, 2026

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 17, 2026

📝 Walkthrough

Walkthrough

Introduces an explicit exported WatermarkProps interface, removes the ExtractPropTypes-based exported alias, and updates the Vue component to use withDefaults(defineProps<WatermarkProps>(), ...) with inline defaults; runtime prop object import removed.

Changes

Cohort / File(s) Summary
Watermark Type Definitions
packages/components/watermark/src/watermark.ts
Adds exported WatermarkProps interface (zIndex, rotate, width, height, image, content, font, gap, offset) with docs; removes ExtractPropTypes import and old exported alias; keeps WatermarkPropsPublic = ExtractPublicPropTypes<typeof watermarkProps>.
Watermark Component Props
packages/components/watermark/src/watermark.vue
Removes watermarkProps import; switches to withDefaults(defineProps<WatermarkProps>(), {...}) and sets defaults (zIndex: 9, rotate: -22, content: 'Element Plus', gap: () => [100, 100]).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • keeplearning66
  • rzzf

Poem

🐰 A watermark hops into the light,
Types now tidy, defaults set right,
Interfaces sprout, old aliases rest,
Vue props snug in their new nest,
Hooray — our code is feeling light! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'refactor(components): [watermark] use type-based definitions' clearly describes the main change: refactoring the watermark component to use type-based prop definitions instead of runtime definitions.
Description check ✅ Passed The PR description includes the required checklist items all marked as completed and references issue #23399, but lacks substantive details about the changes made beyond the checklist.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jan 17, 2026

Open in StackBlitz

pnpm add https://pkg.pr.new/element-plus/element-plus@23408
npm i https://pkg.pr.new/element-plus/element-plus@23408
yarn add https://pkg.pr.new/element-plus/[email protected]

commit: 634c34d

@github-actions
Copy link
Copy Markdown
Contributor

🧪 Playground Preview: https://element-plus.run/?pr=23408
Please comment the example via this playground if needed.

Copy link
Copy Markdown
Member

@rzzf rzzf left a comment

Choose a reason for hiding this comment

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

Nice, Thank you!

Comment thread packages/components/watermark/src/watermark.ts
@btea btea merged commit 3638db5 into element-plus:dev Jan 18, 2026
16 of 17 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

@wjp980108 Thanks for your contribution! ❤️

@wjp980108 wjp980108 deleted the refactor/watermark-type branch January 18, 2026 10:31
@element-bot element-bot mentioned this pull request Jan 30, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants