wails/v3/examples
Lea Anthony 4bfc52f0b5
Add native Liquid Glass effect support for macOS (#4534)
* feat: Implement native Liquid Glass effect for macOS

feat: Add platform check for Liquid Glass demo

Show informative dialog on Windows/Linux explaining that the Liquid Glass
effect is a macOS-specific feature. The demo will exit gracefully on
non-macOS platforms.

docs: Add Liquid Glass feature to unreleased changelog

feat: Enhanced Liquid Glass effect with NSVisualEffectMaterial support

Major improvements to the Liquid Glass implementation for macOS:

- Added comprehensive NSVisualEffectMaterial support with 15+ material options
- Removed debug NSLog statements for cleaner production code
- Created multi-window demo showcasing 7 different glass effects:
  * Light Style - Clean light appearance
  * Dark Style - Dark themed glass
  * Vibrant Style - Enhanced transparency
  * Blue Tint - Custom RGBA tint color example
  * Sheet Material - NSVisualEffectMaterialSheet
  * HUD Window - Ultra-light HUD material
  * Content Background - With warm tint color
- Added Material field to MacLiquidGlass struct for fine-grained control
- Improved demo design with proper Title Case and cleaner layout
- Fixed logo sizing to prevent blur
- All windows fully draggable with InvisibleTitleBarHeight
- Added comprehensive README documentation

The implementation now provides developers with complete control over the
glass effect appearance, supporting both native NSGlassEffectView (macOS 15.0+)
and NSVisualEffectView fallback for older systems.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

feat: Implement native Liquid Glass effect for macOS

- Add support for NSGlassEffectView on macOS 15.0+
- Implement runtime detection of native glass APIs
- Add fallback to enhanced NSVisualEffectView for older systems
- Update liquid glass demo with frameless windows for better visibility
- Support all NSGlassEffectView properties (cornerRadius, tintColor, style)
- Properly handle webview layering with glass effect
- Remove binary from version control

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: Address CodeRabbit review feedback

- Comment out unimplemented ReduceMotion and StaticMode fields
- Remove overly broad draggable CSS properties
- Add corner radius validation
- Improve CSS with proper pointer-events and user-select
- Add clarifying comments about future features

* fix: Remove unimplemented ReduceMotion and StaticMode fields

Completely remove the commented-out performance optimization fields
as they are not implemented and have no timeline for implementation.

* fix: Update windowRemoveVisualEffects to also remove NSGlassEffectView instances

The cleanup function now properly removes both NSVisualEffectView and
NSGlassEffectView instances to prevent orphaned effect layers. Uses
NSClassFromString to avoid hard references to NSGlassEffectView which
is only available on macOS 15.0+.

* fix changelog

* Update v3/pkg/application/webview_window_darwin.m

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update v3/pkg/application/webview_window_darwin.m

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix: Fix compilation errors in windowSetLiquidGlass

- Add missing NSGlassEffectViewStyle enum definition
- Fix undefined tintColor variable by creating NSColor before use
- Add autorelease to prevent memory leaks for allocated views

These issues were causing CI build failures while working locally due to different compiler settings.

* Update Taskfile.yaml

* feat: Implement groupID and groupSpacing for NSGlassEffectView

- Add runtime detection for groupIdentifier/groupName selectors
- Apply groupID via performSelector if supported
- Apply groupSpacing via KVC if supported
- Parameters are now functional when NSGlassEffectView supports them
- Maintains backward compatibility by checking selector availability

* test: Add liquid-glass example to test suite

- Add liquid-glass to EXAMPLEDIRS in Taskfile.yaml
- Ensures the example is tested during CI builds
- Validates compilation on different platforms

Addresses review comment about missing test coverage

* fix: Correct NSGlassEffectView availability to macOS 26.0

- Update @available checks from macOS 15.0 to 26.0 for NSGlassEffectView
- NSGlassEffectView is a private API introduced in macOS 26.0
- Update README to reflect correct version requirement
- Keep NSVisualEffectMaterial checks at 15.0 as those are different APIs

* fix: Prevent exceptions from unsafe WebView reparenting

- Remove early WebView addition to glassView.contentView
- Consolidate all WebView reparenting in one safe location
- Always call removeFromSuperview before adding to new parent
- Set frame and autoresizing mask after safe reparenting
- Prevents NSInternalInconsistencyException from multiple parents

* fix: Make WebView reparenting more robust and thread-safe

- Always call removeFromSuperview before adding to new parent
- Remove brittle superview check, always detach and reattach
- Check both webView and glassContentView are non-nil before operations
- Ensure all UI operations run on main thread with dispatch_sync
- Set frame and autoresizing mask after safe reparenting

* Tidy up

* Update changelog

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-24 07:16:19 +10:00
..
badge [v3] improve service names for js/ts bindings (#4405) 2025-07-25 09:23:22 +10:00
badge-custom [v3] improve service names for js/ts bindings (#4405) 2025-07-25 09:23:22 +10:00
binding Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
build Refactor to using Window interface (#4471) 2025-08-09 15:28:08 +10:00
cancel-async Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
cancel-chaining Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
clipboard Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
contextmenus Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
custom-protocol-example fix custom protocol example to new api 2025-07-12 19:13:13 -06:00
dev Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
dialogs Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
dialogs-basic Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
drag-n-drop [V3] Drag-n-Drop Zones and improvements (#4318) 2025-08-04 20:40:19 +10:00
environment Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
events Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
events-bug Refactor to using Window interface (#4471) 2025-08-09 15:28:08 +10:00
file-association Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
frameless window.ToggleFrameless() api (#4317) 2025-07-15 22:53:21 +10:00
gin-example Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
gin-routing Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
gin-service Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
hide-window Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
html-dnd-api Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
ignore-mouse Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
keybindings Refactor to using Window interface (#4471) 2025-08-09 15:28:08 +10:00
liquid-glass Add native Liquid Glass effect support for macOS (#4534) 2025-08-24 07:16:19 +10:00
menu Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
notifications [v3] improve service names for js/ts bindings (#4405) 2025-07-25 09:23:22 +10:00
panic-handling Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
plain Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
raw-message Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
screen Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
services Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
show-macos-toolbar Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
single-instance Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
systray-basic Refactor to using Window interface (#4471) 2025-08-09 15:28:08 +10:00
systray-custom Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
systray-menu Refactor to using Window interface (#4471) 2025-08-09 15:28:08 +10:00
video Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
window feat: Add Content Protection for Windows and macOS (#4485) 2025-08-09 17:12:39 +10:00
window-api Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
window-call Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
window-menu Refactor to using Window interface (#4471) 2025-08-09 15:28:08 +10:00
wml Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
linux_status.org add linux status for examples 2023-11-06 10:49:14 -06:00
README.md Improve documentation 2023-12-13 22:40:35 +11:00

v3

NOTE: The examples in this directory may or may not compile / run at any given time during alpha development.

Running the examples

cd v3/examples/<example>
go mod tidy
go run .

Compiling the examples

cd v3/examples/<example>
go mod tidy
go build
./<example>