Commit graph

121 commits

Author SHA1 Message Date
Filip Noetzel
3bf43556e9 Fix bumpversion config to generate tag names without "v" prefix 2025-09-10 07:32:24 +02:00
Filip Noetzel
3816304fb8 Bump version: 1.0.7 → 1.0.8 2025-09-09 15:51:49 +02:00
Filip Noetzel
6e28f2a726 bumpversion config 2025-09-09 15:50:18 +02:00
Filip Noetzel
3c5ef7595b fix LOGGING_ENABLED propagation 2025-09-09 15:35:45 +02:00
Filip Noetzel
6d3323601c Add logging to emoji settings parsing
- Add console.log output to dump parsed emoji array when LOGGING_ENABLED
- No changes to functionality or output, just debug visibility
- Shows exactly how ZWJ sequences and other emojis are being parsed
2025-09-09 14:31:42 +02:00
Filip Noetzel
fb5c9496f1 Fix ZWJ sequence handling in calculateRating function
Replaced [...pattern] iteration with Intl.Segmenter to properly handle ZWJ sequences like the pirate flag emoji 🏴‍☠️. This ensures that complex emojis are treated as single grapheme clusters rather than being split into component Unicode code points, fixing the issue where pirate flag emojis were getting a rating of 0 instead of the correct value.

This brings the calculateRating function in line with the rest of the codebase which already uses Intl.Segmenter for proper Unicode handling.
2025-09-09 14:29:35 +02:00
Filip Noetzel
c8b6605e7a Fix ZWJ sequence emoji support in custom emoji settings
- Add getGraphemeClusters.ts utility for proper emoji segmentation
- Update updateSymbolPatternsFromSettings.ts to handle ZWJ sequences correctly  
- Enhance Unicode utilities to use grapheme clusters instead of UTF-16 code units
- Support complex emojis like 🏴‍☠️ (Pirate Flag), 👨‍🚒 (Man Firefighter), etc.
- Uses Intl.Segmenter when available, with regex fallback for older environments
- Fully backward compatible with existing emoji configurations
- Update documentation and add changelog entry

Fixes bug where ZWJ sequence emojis were split into component parts instead of being treated as single emojis.

Simplify ZWJ sequence fix by inlining Intl.Segmenter

- Remove overengineered getGraphemeClusters.ts utility 
- Inline simple Intl.Segmenter usage directly where needed
- Assume Intl.Segmenter is available in all target environments
- Reduced bundle size and simplified codebase
- Update documentation to reflect simplified approach
2025-09-09 14:29:18 +02:00
Filip Noetzel
ae6d438929 add build-and-install command 2025-09-06 15:52:56 +02:00
Filip Noetzel
0dd7b2ec75 only add main.js to gitignore 2025-09-06 15:09:43 +02:00
Filip Noetzel
04c19b818a Restore default styling for full-only unrated symbols 2025-06-24 08:14:42 +02:00
Filip Noetzel
5cd8cd32b9 Bump version: 1.0.6 → 1.0.7 2025-06-24 08:14:42 +02:00
Filip Noetzel
ebcb212610 Replace default visual styles with sophisticated theming placeholder comments
- Replaced all default visual styling (opacity, filters) with comprehensive theming hook comments
- Updated main symbol state classes with detailed documentation for their purpose and usage
- Updated full-only symbol system styling with sophisticated placeholder comments
- Preserved accessibility styling for high contrast mode only
- Updated CSS-CUSTOMIZATION.md to reflect no default styling approach
- Added prominent warning about no default styling and provided quick start example
- Updated example numbering and added basic visual distinction example
- Enhanced accessibility section to clarify it's the only built-in styling

The plugin now provides pure theming hooks without imposing any visual choices, while maintaining comprehensive accessibility support and detailed documentation for users and developers.
2025-06-24 06:46:27 +02:00
Filip Noetzel
9b21e5e6bd Add distinct CSS class for half symbols and enhance customization
- Updated applySymbolState.ts to support 'half' state for half-filled symbols
- Modified renderRating.ts to apply 'half' state to half symbols (instead of 'rated')
- Updated previewRating.ts to use distinct states during hover preview for consistency
- Added CSS styling for .interactive-rating-symbol--half class with 80% opacity
- Added high contrast accessibility support for half symbols (60% opacity with enhanced contrast)
- Enhanced CSS-CUSTOMIZATION.md with comprehensive examples for half symbols including:
  * Basic color styling for filled/half/empty symbols
  * Gradient effects for half symbols
  * Enhanced hover effects for all three states
  * Different styling examples for various symbol types
  * Updated default styling documentation
  * Enhanced accessibility considerations
  * Updated migration guide

This completes the full CSS customization system with distinct classes for:
- .interactive-rating-symbol--rated (filled symbols)
- .interactive-rating-symbol--half (half symbols) 
- .interactive-rating-symbol--empty (empty symbols)
- .interactive-rating-symbol--unrated (full-only grayed symbols)
2025-06-24 06:36:18 +02:00
Filip Noetzel
eadace6854 Add distinct CSS classes for selected and non-selected rating symbols
- Updated applySymbolState.ts to support 'empty' state for unselected symbols
- Modified renderRating.ts to apply 'rated' state to filled symbols and 'empty' state to empty symbols
- Added CSS styling for .interactive-rating-symbol--empty class with 50% opacity
- Added high contrast accessibility support for empty symbols
- Created comprehensive CSS-CUSTOMIZATION.md guide with examples

This enables users to customize the appearance of filled vs empty symbols using CSS snippets, addressing the original request for better visual distinction between selected and non-selected symbols.
2025-06-24 06:29:55 +02:00
Filip Noetzel
5fe87e5c50 Fix hardcoded logging: use esbuild's sophisticated mechanism with guarding comments
- Replace hardcoded LOGGING_ENABLED=false with process.env.LOGGING_ENABLED
- Add extensive guarding comments to prevent manual changes
- Ensure runtime logging is controlled via npm scripts (build vs build-debug)
- Maintain zero runtime overhead for production builds via esbuild's define feature
2025-06-20 05:43:46 +02:00
Filip Noetzel
3e32fc1d97 Fix mobile keyboard appearing when clicking ratings by blurring editor after updates 2025-06-10 12:56:07 +02:00
Filip Noetzel
97263123b3 WORKS 2025-06-10 12:44:23 +02:00
Filip Noetzel
b48938ae01 Successfully tested types and build after refactoring - all tests pass 2025-06-10 12:01:12 +02:00
Filip Noetzel
f5f2ab6537 Fix all import paths after refactoring large files 2025-06-10 11:56:50 +02:00
Filip Noetzel
aa45cf217f Refactor parseRatingText.ts into modular functions and delete original file 2025-06-10 11:55:30 +02:00
Filip Noetzel
607913f700 Extract buildRatingTextResult function from parseRatingText.ts 2025-06-10 11:55:09 +02:00
Filip Noetzel
1349c7ac41 Extract findRatingPatterns function from parseRatingText.ts 2025-06-10 11:54:42 +02:00
Filip Noetzel
cd9806b428 Extract convertPositions function from parseRatingText.ts 2025-06-10 11:54:22 +02:00
Filip Noetzel
fea9a30577 Refactor ratingViewPlugin.ts into modular functions and delete original file 2025-06-10 11:53:20 +02:00
Filip Noetzel
6b4275da08 Extract buildDecorationsFromMatches function from ratingViewPlugin.ts 2025-06-10 11:52:58 +02:00
Filip Noetzel
785efc88ed Extract filterOverlappingMatches function from ratingViewPlugin.ts 2025-06-10 11:52:35 +02:00
Filip Noetzel
7c9ac9d5cd Extract collectMatches function from ratingViewPlugin.ts 2025-06-10 11:52:21 +02:00
Filip Noetzel
d42786db60 Refactor RatingWidget.ts into modular functions and delete original file 2025-06-10 11:51:41 +02:00
Filip Noetzel
c73557fee9 Extract updateRating function from RatingWidget.ts 2025-06-10 11:51:07 +02:00
Filip Noetzel
b0590c959a Extract renderRating function from RatingWidget.ts 2025-06-10 11:50:36 +02:00
Filip Noetzel
c43886f062 Extract previewRating function from RatingWidget.ts 2025-06-10 11:50:15 +02:00
Filip Noetzel
784e2f905e Extract applySymbolState function from RatingWidget.ts 2025-06-10 11:49:48 +02:00
Filip Noetzel
2e53c1e164 Extract calculateRatingFromHover function from RatingWidget.ts 2025-06-10 11:49:06 +02:00
Filip Noetzel
ca5cd0fd46 Extract calculateRatingFromClick function from RatingWidget.ts 2025-06-10 11:48:50 +02:00
Filip Noetzel
0a7997187a Bump version: 1.0.5 → 1.0.6 2025-06-10 09:25:20 +02:00
Filip Noetzel
cc7ea8ead9 Refactor inline styles to semantic CSS classes
- Removed all inline style assignments from RatingWidget.ts
- Added semantic CSS classes for symbol states (rated, unrated, normal)
- Implemented clean CSS class management with applySymbolState() method
- Updated styles.css with proper semantic class definitions
2025-06-10 09:19:58 +02:00
Filip Noetzel
f163bf7e60 Correct percentage calculation for rating text
Fixed formatRatingText to use actual pattern length instead of parsed denominator for percentage calculations. This fixes ◼◼◼▭ showing 3% instead of 75%. The issue was that percentage parsing sets denominator=100, but calculations need actual symbol count (4), so (3/4)*100=75%.
2025-06-10 09:16:32 +02:00
Filip Noetzel
f0b00e11e3 Removed index.ts files and updated all imports to reference specific files directly. Updated imports in InteractiveRatingsPlugin.ts, ratingViewPlugin.ts, RatingWidget.ts, parseRatingText.ts, and main.ts. All type checks and builds pass successfully. 2025-06-10 09:02:11 +02:00
Filip Noetzel
b60874efdc Refactored large TypeScript files (utils.ts, ratings-parser.ts, editor-extension.ts) by splitting them into smaller, organized files within directories. Each function now has its own file with proper imports/exports through index files.
Fixed import issue in editor-extension/index.ts - added missing import for ratingViewPlugin before using it in the export array. All type checks and builds now pass successfully.
2025-06-10 08:56:19 +02:00
Filip Noetzel
40b05f606a Re-arrange README 2025-06-10 08:36:37 +02:00
Filip Noetzel
c17ec8be7a Bump version: 1.0.4 → 1.0.5 2025-06-10 08:23:36 +02:00
Filip Noetzel
6ad882397a Add Configuration section to README explaining custom emoji settings and usage 2025-06-10 08:22:36 +02:00
Filip Noetzel
2ea7af7bbd Add setting for customizable emoji support in ratings
Added InteractiveRatingsSettings interface, settings tab, and dynamic symbol pattern updates. Users can now customize supported emojis through plugin settings.

Default: 🎥🏆💎🔥🎯🚀💰🎖️

Fix regex detection bug for low ratings (1-2 stars)

Modified regex to detect 1+ symbols instead of 3+, and updated editor logic to intelligently handle short patterns with rating text or full-only symbols. Fixes issue where reducing ratings to 1-2 stars made them uneditable.

Simplify pattern detection logic - remove complex special cases

Replaced complex logic with simple rule: if no rating text, require 3+ symbols to avoid false positives. If rating text exists, any symbol count is valid. This generic approach handles all cases without special full-only symbol logic.

Remove hardcoded configurable emojis from constants.ts since they're now managed through settings
2025-06-10 08:22:36 +02:00
Filip Noetzel
3c0cf4029a Add HTML comment rating text support for clean display
- Parse HTML comment patterns: <!-- 3/5 -->
- New comment formats: comment-fraction, comment-percent, etc.
- Hide comment text in visual display while preserving functionality
- Full-only symbols work with comments for clean reading experience

- Auto-add HTML comments when clicking full-only symbols without rating text
- Auto-remove HTML comments when numerator equals denominator (perfect ratings)
- Simplified to basic <!-- 3/5 --> format only (no parentheses/percentages)
- HTML comments restricted to full-only symbols only
- Visible rating text takes precedence over HTML comments

Remove HTML comment when both visible and comment rating text present

- Enhanced parseRatingText to detect both visible and HTML comment formats
- Visible rating text takes precedence for calculation
- Mixed format like "💎💎💎 (3/5)<!-- 4/5 -->" becomes "💎💎💎💎 (4/5)" on change
- Clean, predictable precedence behavior with automatic cleanup
2025-06-09 22:55:01 +02:00
Filip Noetzel
1218efd3aa Add support for full-only rating symbols like 🎥
- Added fullOnly flag to SymbolSet interface
- Added 10 new full-only symbols (🎥, 🏆, , 💎, 🔥, , 🎯, 🚀, 💰, 🎖️)
- Visual: rated symbols full color, unrated grey 50% opacity
- Disk: only rated symbols saved (e.g., 🎥🎥🎥 (3/5))
- No 0 ratings, no half ratings for full-only symbols
- Updated CSS, tests, and documentation

Refactor full-only symbols: auto-detect, show denominator count, require rating text

- Remove fullOnly flag, auto-detect with isFullOnlySymbol()
- Visual: show denominator count (numerator color, rest grey)  
- Require rating text for denominator info
- Disk: save only rated symbols
- Updated docs and tests

Clarify and verify full-only symbol visual behavior

- Added debug test files to verify expected behavior
- Confirmed visual display always shows denominator count symbols
- Rated symbols in full color, unrated in grey 50% opacity
- Implementation already correct: displaySymbolCount uses denominator
- Added debug logging capability for troubleshooting
2025-06-09 22:54:41 +02:00
Filip Noetzel
014446d672 Add support for colored hearts
- Add red hearts (❤️/🤍)
- Add orange, yellow, green, blue, purple, black, and brown hearts
- All heart patterns use white heart (🤍) as empty symbol
- No half-heart support (half: null) for all heart patterns

Add heart rating examples to README
2025-06-09 21:28:59 +02:00
Filip Noetzel
a792713e3c Add moon phase emoji symbol set (🌕🌑🌗) with Unicode-aware parsing support
Fix multibyte emoji handling: replace pattern.length with Unicode-aware length calculation and fix regex generation for emojis

Fix emoji rating text parsing by converting UTF-16 positions to Unicode positions
2025-06-09 21:04:54 +02:00
Filip Noetzel
22b4fbd9d4 Add missing Star Symbols (✦/✧) to README documentation table 2025-06-09 14:03:45 +02:00
Filip Noetzel
b86ba20f2d Bump version: 1.0.3 → 1.0.4 2025-06-09 09:41:24 +02:00
Filip Noetzel
c3abe0f9ee Update rating widget to use symbol count as denominator
- Modified previewRating() to show updated denominator during hover
- Modified updateRating() to save the symbol count as the new denominator
- When clicking on ●●●●●●●◐ (7.5/23), it now updates to (7.5/8) instead of keeping 23
- Enhanced logging to track old vs new denominators
2025-06-09 09:38:06 +02:00