From 89e8476b3fa7dfd0893f86e8c458471f59276efb Mon Sep 17 00:00:00 2001 From: Victor Bejar Date: Sat, 6 Dec 2025 07:50:30 -0500 Subject: [PATCH 1/5] chore: update gitignore for CLAUDE.md patterns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add **/CLAUDE.md to ignore CLAUDE.md in all subdirectories - Add CLAUDE.md.backup to ignore backup files šŸ¤– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 5b96e5f..debef44 100644 --- a/.gitignore +++ b/.gitignore @@ -65,5 +65,7 @@ docs/ specs/ .claude/ CLAUDE.md +**/CLAUDE.md +CLAUDE.md.backup .specify/ .vite/ From bca4e50a0a0ef1e642b2564d81d6389b9577bb33 Mon Sep 17 00:00:00 2001 From: Victor Bejar Date: Sun, 7 Dec 2025 16:03:13 -0500 Subject: [PATCH 2/5] feat(core): add SVG-based border rendering (Feature 006) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add comprehensive border support for squircle elements: - Solid, dashed, and dotted border styles - Gradient borders with configurable color stops - Anti-aliasing fix for dark backgrounds (SC-001) - Data attribute support (data-squircle-border-*) - Background/box-shadow capture and restoration - Dynamic border updates via ck.update() - Border width clamping (1-8px range) New files: - border.ts: SVG border renderer with clip-path approach - border.test.ts: Comprehensive unit tests (50 tests) - border-visual.test.ts: Playwright visual regression tests API additions: - SquircleConfig.border: { width, color, style, gradient, dashArray } - BorderConfig, GradientStop types exported Bumped version to 1.2.0 šŸ¤– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- README.md | 113 ++- packages/core/README.md | 313 +++++--- packages/core/package.json | 2 +- packages/core/src/core/types.ts | 129 ++++ packages/core/src/index.ts | 43 +- packages/core/src/math/figma-squircle.ts | 75 ++ packages/core/src/math/path-generator.ts | 11 +- packages/core/src/renderers/border.ts | 287 +++++++ packages/core/src/renderers/clippath.ts | 307 +++++--- packages/core/src/utils/data-attributes.ts | 133 +++- .../tests/integration/border-visual.test.ts | 720 ++++++++++++++++++ .../tests/integration/fixtures/test-page.html | 69 ++ packages/core/tests/unit/border.test.ts | 641 ++++++++++++++++ packages/core/tests/unit/clippath.test.ts | 529 +++++++++++++ .../core/tests/unit/data-attributes.test.ts | 234 ++++++ .../core/tests/unit/path-generator.test.ts | 77 ++ website/app.js | 280 +++++-- website/cornerkit.js | 2 +- website/index.html | 169 +++- website/styles.css | 25 + 20 files changed, 3769 insertions(+), 390 deletions(-) create mode 100644 packages/core/src/renderers/border.ts create mode 100644 packages/core/tests/integration/border-visual.test.ts create mode 100644 packages/core/tests/unit/border.test.ts diff --git a/README.md b/README.md index 4ff2df1..2bf7608 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ > Bring iOS-style squircle corners to your web applications [![npm version](https://img.shields.io/npm/v/@cornerkit/core)](https://www.npmjs.com/package/@cornerkit/core) -[![Bundle Size](https://img.shields.io/badge/bundle%20size-4.58%20KB-success)](https://bundlephobia.com/package/@cornerkit/core) +[![Bundle Size](https://img.shields.io/badge/bundle%20size-5.50%20KB-success)](https://bundlephobia.com/package/@cornerkit/core) [![Zero Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)](package.json) [![TypeScript](https://img.shields.io/badge/TypeScript-5.3%2B-blue)](https://www.typescriptlang.org/) [![Security: A+](https://img.shields.io/badge/security-A%2B-success)](SECURITY.md) @@ -12,7 +12,7 @@ **[Live Demo](https://bejarcode.github.io/cornerKit/)** - Interactive playground with 36+ UI examples -CornerKit is a lightweight JavaScript library that brings the smooth, continuous curve corners (squircles) from iOS design to the web. At just **4.58 KB gzipped** with **zero runtime dependencies**, it delivers pixel-perfect rounded corners that look better than standard CSS `border-radius`. +CornerKit is a lightweight JavaScript library that brings the smooth, continuous curve corners (squircles) from iOS design to the web. At just **5.50 KB gzipped** with **zero runtime dependencies**, it delivers pixel-perfect rounded corners that look better than standard CSS `border-radius`. ## Live Demo @@ -45,8 +45,10 @@ const ck = new CornerKit(); ck.apply('.card', { radius: 24, // Corner size in pixels smoothing: 0.6, // iOS standard smoothness (0-1) - borderWidth: 2, // Optional: border width in pixels - borderColor: '#000' // Optional: border color + border: { // Optional: SVG-based border (v1.2.0+) + width: 2, + color: '#000' + } }); ``` @@ -71,7 +73,7 @@ ck.apply('.card', { ## Why CornerKit? ### Exceptionally Tiny -- **4.58 KB gzipped** (ESM) - 8% under 5KB budget +- **5.50 KB gzipped** (ESM) - includes SVG border rendering - **Zero runtime dependencies** - Tree-shakeable ES modules - Smaller than most icon libraries @@ -89,9 +91,9 @@ ck.apply('.card', { - Automatic capability detection ### Production Ready -- **313/313 unit tests passing** (100%) -- **46/47 integration tests passing** (97.9%) -- **97.9% code coverage** +- **412/412 unit tests passing** (100%) +- **66/67 integration tests passing** (98.5%) +- **84.9% code coverage** - Memory leak prevention with WeakMap registry - A+ security rating (zero vulnerabilities) @@ -241,21 +243,44 @@ const info = ck.inspect('#button'); console.log(info.config); // { radius: 32, smoothing: 0.6 } ``` -## Border Support +## Border Support (v1.2.0+) -CornerKit supports squircle borders using a dual pseudo-element rendering technique that creates smooth borders matching the corner curves. +CornerKit v1.2.0 introduces SVG-based border rendering that eliminates anti-aliasing fringe on dark backgrounds and supports **solid**, **dashed**, **dotted**, and **gradient** styles. ### Basic Border Usage ```javascript const ck = new CornerKit(); -// Apply squircle with border +// Solid border ck.apply('.card', { radius: 24, smoothing: 0.6, - borderWidth: 2, // Border width in pixels - borderColor: '#e5e7eb' // Border color (any CSS color) + border: { width: 2, color: '#e5e7eb' } +}); + +// Dashed border +ck.apply('.upload-zone', { + radius: 20, + border: { width: 2, color: '#6b7280', style: 'dashed' } +}); + +// Dotted border +ck.apply('.badge', { + radius: 12, + border: { width: 3, color: '#10b981', style: 'dotted' } +}); + +// Gradient border +ck.apply('.featured', { + radius: 24, + border: { + width: 3, + gradient: [ + { offset: '0%', color: '#3b82f6' }, + { offset: '100%', color: '#8b5cf6' } + ] + } }); ``` @@ -265,70 +290,44 @@ ck.apply('.card', {
- Card with squircle border + Card with dashed squircle border
``` -### Compatible Elements - -Borders work seamlessly on elements with `overflow: visible` (the default for most elements): +### Migration from v1.1 -āœ… **Fully compatible:** -- `
` containers -- `