feat(code-diff): add interactive playground example#4134
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
📝 WalkthroughWalkthroughExtracts ChangesCodeDiffLayout type and interactive playground
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
Documentation has been published to https://lundalogik.github.io/lime-elements/versions/PR-4134/ |
5389918 to
33b6f9b
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new interactive playground example for limel-code-diff and improves type-safety by extracting the layout prop’s literal union into a named public type (CodeDiffLayout) that’s exported for consumers.
Changes:
- Added
limel-example-code-diff-interactive(two editablelimel-code-editors + livelimel-code-diff+ layout/lineWrapping controls) and registered it as the first example on the docs page via@exampleComponent. - Introduced and exported a public
CodeDiffLayouttype and updated usages (component prop typing + examples). - Updated the API report to reflect the new public type and updated prop typing.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/interface.ts | Exports CodeDiffLayout publicly from the package entrypoint. |
| src/components/code-diff/examples/code-diff-line-wrap.tsx | Reuses the new CodeDiffLayout type for stronger typing in the example controls. |
| src/components/code-diff/examples/code-diff-interactive.tsx | New interactive playground example wiring two editors to a live diff + controls. |
| src/components/code-diff/examples/code-diff-interactive.scss | Styling for the interactive playground layout (responsive editor layout + sizing). |
| src/components/code-diff/code-diff.types.ts | Adds the new public CodeDiffLayout type. |
| src/components/code-diff/code-diff.tsx | Uses CodeDiffLayout for the layout prop and registers the new interactive example first. |
| etc/lime-elements.api.md | Updates the public API surface to include CodeDiffLayout and the updated prop type. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2059449 to
cc8be04
Compare
Extract the inline `'unified' | 'split'` union into a named, public `CodeDiffLayout` type and re-export it from the package entry point, so consumers can reference the layout type directly instead of repeating the literal union. Update the `layout` prop and the line-wrap example to use the new type, and regenerate the API report.
Add a playground example, registered as the first example so it appears at the top of the docs page. It pairs two editable `limel-code-editor` boxes with a live `limel-code-diff`, plus controls to switch between unified and split layouts and toggle line wrapping.
cc8be04 to
f359b96
Compare
adrianschmidt
left a comment
There was a problem hiding this comment.
6-Agent Review — READY TO MERGE ✅
Purely additive: a new interactive playground example for limel-code-diff, plus a non-breaking extraction of the layout union into a named, public CodeDiffLayout type. Strictly better than main — no regressions in any of the seven dimensions, no [High]/[Critical] findings. Only a couple of optional [Low] notes.
Verdicts
| Dimension | Verdict |
|---|---|
| Backward Compatibility | SAFE |
| Code Quality | GOOD |
| Architecture | SAFE |
| Security | SAFE |
| Observability | SAFE |
| Performance | GOOD |
| Lime Platform Issues | SAFE |
| Merge Readiness | READY TO MERGE |
What was checked
- Backward compatibility —
CodeDiffLayoutresolves to the byte-identical union, solayout: 'unified' | 'split'andlayout: CodeDiffLayoutare interchangeable for consumers. No duplicate-export collision, additive-only.api.mddelta, unique example tag. - Code quality — Prop/event APIs verified against the real components (
oldValue/newValueare real props;limel-code-editoremitschange: EventEmitter<string>). Extraction is complete — no inline unions remain anywhere. - Architecture —
code-diff.types.tsmatches the established*.types.tspattern and correctly stays distinct from the pre-existing internalcode-diff/types.ts. Idiomatic one-way data flow, composition-only coupling. - Security — Traced the only user-input path (typed values →
limel-code-diff): no HTML-injection sinks, user text renders as escaped JSX text nodes, search term is regex-escaped, no secrets in the sample data. - Observability — The handlers'
event.stopPropagation()is the correct Stencil pattern (mirrors the sibling example); nothing is swallowed. - Performance — Live re-diff per keystroke is the pre-existing, intended reactive contract of
limel-code-diffon tiny payloads; the PR adds no new code paths into the core component. Handlers are class-field-bound, constants are module-level. - Lime platform (lime-issue-detector catalog) — No LPID findings; state handling is correct, no I/O / timers / XSS sinks.
Optional [Low] notes (non-blocking)
- Stability tag —
CodeDiffLayoutis@publicwhilelimel-code-diffitself is@beta(siblingchart.typesuses@beta). This is the PR's stated intent — just flagging that it commits the type to the stable contract ahead of the component. - Example duplication —
LAYOUT_OPTIONS+ handlers are duplicated across the two code-diff examples, which is consistent with the repo's "self-contained example" convention. Leave as-is, or optionally name the default layout instead ofLAYOUT_OPTIONS[1].
Approving. 🚢
Generated with a 6-agent review (backward compatibility, code quality, architecture, security, observability, performance, Lime platform).
|
🎉 This PR is included in version 39.37.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Closes #4133
Summary by CodeRabbit
New Features
Refactor
CodeDiffLayouttype and updating component/example props and selections to use it.Style
Documentation
Adds an interactive playground to the top of the
limel-code-diffexamples page: two editablelimel-code-editorboxes feeding a livelimel-code-diff, with controls forunified/splitlayout andlineWrapping. Also extracts thelayoutprop's inline union into a named, publicCodeDiffLayouttype.Review:
Browsers tested:
(Check any that applies, it's ok to leave boxes unchecked if testing something didn't seem relevant.)
Windows:
Linux:
macOS:
Mobile: