Commit Graph

1910 Commits

Author SHA1 Message Date
Younes ENNAJI e0766c1198 Add v2.5.0 release preparation tests and update CHANGELOG 2026-03-07 18:31:05 +00:00
Younes ENNAJI e4337b0b63 Fix SweetAlertBuilder::question() bug and improve code quality 2026-03-07 17:50:43 +00:00
Younes ENNAJI bd8169619e Refactor code and update tests for improved DX 2026-03-02 05:19:34 +00:00
Younes ENNAJI 0d25c72743 Add IDE autocompletion support and Type helper methods 2026-03-02 05:13:28 +00:00
Younes ENNAJI d4abef58eb Standardize exception message format and add exception tests 2026-03-02 04:06:51 +00:00
Younes ENNAJI e126813835 Fix FlasherPlugin::normalizeAlias() return type and add tests 2026-03-02 04:02:08 +00:00
Younes ENNAJI 5612d4d705 Fix ResponseManager filter criteria handling and update tests 2026-03-02 03:49:35 +00:00
Younes ENNAJI 9454b2d155 Fix return type and parameter name inconsistencies in Notification classes 2026-03-02 03:46:43 +00:00
Younes ENNAJI d39159cf90 Fix FilterEvent type consistency and remove redundant callable check 2026-03-02 03:42:27 +00:00
Younes ENNAJI 76d63c03ce Reset CSP handler in worker listeners and add related tests 2026-03-02 03:33:16 +00:00
Younes ENNAJI 286fe5143e Update ContentSecurityPolicy handling and ResponseExtension 2026-03-02 03:27:04 +00:00
Younes ENNAJI f399bc912d Update NotificationFactoryLocator and CHANGELOG 2026-03-02 03:23:45 +00:00
Younes ENNAJI 98336b98bf Update filter criteria and CHANGELOG 2026-03-02 03:20:33 +00:00
Younes ENNAJI 50ffa722a5 Add tests for OctaneListener and WorkerListener 2026-03-02 03:04:35 +00:00
Younes ENNAJI 93fc3c00e8 Add worker listeners for Octane and Symfony, update FallbackSession 2026-03-02 02:55:50 +00:00
Younes ENNAJI e783943933 Fix notification cleanup for Turbo and Livewire navigation 2026-03-02 02:42:38 +00:00
Younes ENNAJI f3d72c88c9 Fix array_merge error and update exception handling 2026-03-02 02:35:27 +00:00
Younes ENNAJI 63b9083782 Update README and documentation pages 2026-03-02 02:34:48 +00:00
Younes ENNAJI 1f7d884c4d Update README and JavaScript documentation 2026-03-02 02:01:00 +00:00
Younes ENNAJI 88f7546b50 Update documentation for installation and libraries 2026-03-02 01:29:04 +00:00
Younes ENNAJI cbd753371b Upgrade Symfony demo to v8.0, update dependencies 2026-03-02 00:40:18 +00:00
Younes ENNAJI 04d1e42fa3 Refine code block rendering and features 2026-03-01 23:27:02 +00:00
Younes ENNAJI 67b24f24bb Refactor demo notification display and asset loading 2026-03-01 23:21:50 +00:00
Younes ENNAJI b136cfcf6e Revamp Flasher demo application 2026-03-01 22:47:28 +00:00
Younes ENNAJI fd65254d63 docs: move Try All Themes section to top of themes page 2026-03-01 22:17:40 +00:00
Younes ENNAJI 33ac9013d5 build assets 2026-03-01 22:16:54 +00:00
Younes ENNAJI 1cc6a7c537 docs: remove hero sections from playground and themes pages 2026-03-01 22:15:18 +00:00
Younes ENNAJI dfe9a12fe1 docs: remove old themes.md (replaced by themes/index.html) 2026-03-01 22:11:08 +00:00
Younes ENNAJI 8074bb1f90 docs: add themes gallery page at /themes/
Features:
- Hero section with animated gradient background
- Themes organized by category (Brand-Inspired, Gemstone, Minimal)
- Visual cards with gradient previews for each theme
- Interactive "Try All Themes" section with demo buttons
- Usage code examples for setting default or per-notification themes
- CTA linking to playground
- Added "All Themes" link to navigation menu
2026-03-01 22:11:00 +00:00
Younes ENNAJI 03942aa634 build assets 2026-03-01 22:04:32 +00:00
Younes ENNAJI 6abae0bdde docs: add interactive playground page
Features:
- Hero section with animated background elements
- Embedded flasher-studio interactive component
- Quick theme preview buttons (12 popular themes)
- Pro tips section for better user experience
- CTA section linking to Laravel/Symfony guides
- Added playground to navigation menu
2026-03-01 22:02:13 +00:00
Younes ENNAJI 05c15399ac docs: restore Palestine support banner 2026-03-01 21:57:14 +00:00
Younes ENNAJI 1bd85021d9 docs: redesign root README for better first impression
Key improvements:
- Strong tagline: "One line of PHP. Beautiful notifications. Zero JavaScript"
- Quick Start at the top (installation in 1 command)
- "Why PHPFlasher?" comparison table showing advantages
- Livewire integration section (previously missing)
- Collapsible themes list for better scannability
- Cleaner visual hierarchy with horizontal rules
- Prominent links to docs, playground, and bug reports
- Simplified contributors section using contrib.rocks
- Clear calls to action for starring and sharing
2026-03-01 21:54:51 +00:00
Younes ENNAJI 359e6de361 docs: expand adapter READMEs with comprehensive examples
Each adapter README now includes:
- Features section highlighting key capabilities
- Installation instructions for Laravel and Symfony
- Multiple Quick Start code examples
- Configuration options table
- Livewire integration with events
- Global configuration examples
2026-03-01 21:50:11 +00:00
Younes ENNAJI e417105f7a refactor(themes): create shared utilities and design tokens
This refactoring improves code quality and reduces duplication:

## New Files
- `themes/shared/icons.ts` - Centralized SVG icons (getIcon, getCloseIcon)
- `themes/shared/accessibility.ts` - A11y helpers (getA11yString, getCloseButtonA11y)
- `themes/shared/constants.ts` - Standard class names and default titles

## Design Tokens Added (index.scss)
- Spacing scale: --fl-spacing-xs through --fl-spacing-2xl
- Typography scale: --fl-font-size-xs through --fl-font-size-xl
- Close button sizes: --fl-close-sm, --fl-close-md, --fl-close-lg
- Border radius: --fl-radius-sm through --fl-radius-full
- Shadow tokens: --fl-shadow-sm through --fl-shadow-lg
- Animation: --fl-duration-*, --fl-easing-*, --fl-slide-*

## Mixins Updated
- Added `close-button-sized($size)` with sm/md/lg support
- Added `close-button-circular($size)` variant
- Added `close-button-text` for text-style buttons
- Updated existing mixins to use design tokens

## All 17 Themes Refactored
Each theme now uses shared utilities instead of duplicating code:
- Icon code: 20+ lines → 1 function call
- Accessibility: 3 lines → 1 function call
- Class names: via CLASS_NAMES constants

Backwards compatible - no breaking changes.
2026-03-01 21:34:50 +00:00
Younes ENNAJI abd70c1d4b Update main JavaScript bundle 2026-03-01 21:13:14 +00:00
Younes ENNAJI 9acddbda52 docs: update CHANGELOG and Livewire docs with event system
Add documentation for the event dispatching system:
- Update CHANGELOG.md with unreleased features
- Add Toastr events section (click, close, show, hidden)
- Add Noty events section (click, close, show, hover)
- Add Notyf events section (click, dismiss)
- Add Theme events section (generic and theme-specific click)
- Include code examples for Livewire event listeners
2026-03-01 21:11:13 +00:00
Younes ENNAJI 7d6e9b46b8 add event dispatching system for Livewire integration
Implement consistent event dispatching across Noty, Notyf, Toastr adapters and
themes, following the existing SweetAlert pattern. This enables Livewire
integration for all notification types.

JavaScript Events:
- Noty: flasher:noty:show, flasher:noty:click, flasher:noty:close, flasher:noty:hover
- Notyf: flasher:notyf:click, flasher:notyf:dismiss
- Toastr: flasher:toastr:show, flasher:toastr:click, flasher:toastr:close, flasher:toastr:hidden
- Themes: flasher:theme:click (generic), flasher:theme:{name}:click (specific)

PHP Livewire Listeners:
- LivewireListener for each adapter (Noty, Notyf, Toastr)
- ThemeLivewireListener for theme click events
- Registered in service providers when Livewire is bound

This allows Livewire users to listen for notification events and react
accordingly (e.g., noty:click, theme:flasher:click).
2026-03-01 21:05:10 +00:00
Younes ENNAJI f1051e1d7f fix: resolve PHPStan errors and add Vitest to lint script
- Remove unnecessary null coalescing in HtmlPresenter (mainScript is never null)
- Add comprehensive ignore rules for test-related PHPStan warnings
- Add Vitest test runner to bin/lint script

All quality checks now pass:
- Rector
- PHP-CS-Fixer
- PHPStan (level max)
- Composer validation
- PHPLint
- PHPUnit (1281 tests)
- Vitest (219 tests)
2026-03-01 20:24:33 +00:00
Younes ENNAJI 87da42fdea Refine code style and tests 2026-03-01 20:16:44 +00:00
Younes ENNAJI 4d9cda22cf build assets 2026-03-01 20:16:00 +00:00
Younes ENNAJI c58f3c7b40 upgrade dependencies 2026-03-01 20:15:46 +00:00
Younes ENNAJI 47eb66e874 fix: update tests for new validation requirements
Update tests that were using invalid values for HopsStamp (0 is now
invalid, must be >= 1) and update expected output format for
mainScript (now uses json_encode which produces double quotes).
2026-03-01 20:13:57 +00:00
Younes ENNAJI 30de24f054 fix: add null checks and error handling to docs JS controllers
clipboard_controller.js:
- Check if clipboard API is available before using
- Handle clipboard write promise rejection
- Show error icon on failure

prev-next_controller.js:
- Guard against missing navigation element
- Guard against missing span element in links

anchor_controller.js:
- Guard against missing ul element
2026-03-01 20:11:07 +00:00
Younes ENNAJI 162ea87330 fix: prevent memory leaks and handle errors in FlasherPlugin
- Remove DOMContentLoaded listener after it fires to prevent memory leak
- Clean up timer interval and event listeners when notification is removed
- Add null check in stringToHTML to throw clear error for invalid templates
- Store cleanup function on notification element for proper disposal

Added tests for memory leak prevention and error handling.
2026-03-01 20:10:06 +00:00
Younes ENNAJI 8cda9d1eb1 fix: rename shadowed variable in Request::getType()
The parameter \$type was being reassigned to the session value, which
shadows the original parameter and causes confusion for static analysis
tools and maintainers.

Renamed the session value variable to \$value for clarity.
2026-03-01 20:08:28 +00:00
Younes ENNAJI 6d314dbc07 fix: add validation to HopsStamp and DelayStamp
HopsStamp:
- Validate hops amount must be >= 1 (positive integer)
- Negative or zero hops don't make logical sense

DelayStamp:
- Validate delay must be >= 0 (non-negative integer)
- Negative delays don't make logical sense

Both now throw InvalidArgumentException for invalid values, making
configuration errors fail fast with clear messages.
2026-03-01 20:07:54 +00:00
Younes ENNAJI ad5c0f56dd fix: validate limit criteria must be positive integer
Previously, negative limits caused array_slice() to return unexpected
results (all except last N elements) and zero returned an empty array
without clear intent.

Now throws InvalidArgumentException for values < 1, making invalid
configurations fail fast with a clear error message.
2026-03-01 20:06:53 +00:00
Younes ENNAJI fd36c2ec0c fix: validate alias attribute in PresenterCompilerPass
Add validation to ensure services tagged with 'flasher.presenter' have
the required 'alias' attribute. Previously, accessing $attributes['alias']
without checking would throw an "Undefined array key" error.

Now throws a clear InvalidArgumentException with a helpful message.
2026-03-01 20:01:12 +00:00
Younes ENNAJI 5202c86107 fix: handle invalid JSON gracefully in FlasherComponent
The json_decode() with JSON_THROW_ON_ERROR throws an exception before
the ?: operator can provide a fallback value. This caused page crashes
when invalid JSON was passed to the Blade component attributes.

Now using a helper method with try-catch to safely decode JSON and
return an empty array on failure, preventing page crashes.
2026-03-01 20:00:16 +00:00