Commit cfcf1c9
authored
Transform Arizona Svelte from demo app to hex/npm library packages (#1)
* Add Svelte integration with Arizona framework
- Add Svelte 5 components (App and Counter) with modern runes syntax
- Integrate esbuild-svelte plugin for component compilation
- Configure Arizona client to mount Svelte components via data attributes
- Update Tailwind to scan Svelte files with @source directive
- Add separate build scripts for JS and CSS with dev/prod modes
- Set up local Arizona dependency via _checkouts symlink
* Replace esbuild with Vite and implement dynamic component system
- Replace esbuild with Vite for better modern development experience
- Add legacy browser support with conditional building
- Create modular Arizona Svelte architecture:
- ArizonaSvelteRegistry: Component storage and retrieval
- ArizonaSvelteDiscovery: Auto-discovery using import.meta.glob
- ArizonaSvelteLifecycle: Component mounting and lifecycle management
- ArizonaSvelte: Main orchestrator class with default export
- Move components to organized `/svelte/components/` structure
- Implement dynamic component loading without hardcoded if/else chains
- Optimize build performance: skip gzip reporting and legacy bundles in dev
- Update main.js to simple 2-line usage: new ArizonaSvelte() + mountComponents()
* Organize build configuration and update to Tailwind CSS v4
- Move vite.config.js and create tailwind.config.js in assets/ directory
- Update CSS imports to use Tailwind v4 syntax (@import "tailwindcss")
- Replace build-css.js with direct tailwind CLI commands in package.json
- Add separate dev/prod build scripts with conditional minification
- Update all npm scripts to reference new config file locations
* Implement page re-design with enhanced styling and component system
- Enable arizona.css import for custom Arizona Framework styling
- Update hero background image to arizona-svelte-hero-bg.png
- Add comprehensive color palette and design system classes
- Implement HelloWorld component replacing basic App component
- Add arizona_svelte_counter.erl module for counter component handling
- Update layout and view modules for enhanced page structure
- Expose Arizona client globally for component interaction
- Improve component lifecycle management and error handling
- Add extensive Tailwind utilities for Arizona theme colors and effects
* Enhance component demo with improved UX design and architecture explanations
- Redesign button styling with subtle Arizona-themed colors using low-opacity backgrounds
- Replace bright/saturated button colors with harmonious teal, terracotta, and slate variants
- Add comprehensive component embedding explanations and visual indicators
- Implement full-height layout for balanced component display
- Create custom CSS utilities for consistent button and card styling
- Fix Vite build configuration to preserve app.css during rebuilds
- Update component titles to use consistent brand colors (red for Svelte, terracotta for Arizona)
- Add detailed descriptions of hybrid architecture where Arizona stateful components contain embedded Svelte components
- Enhance accessibility with focus rings and proper color contrast
- Improve visual hierarchy and reduce visual noise while maintaining interactivity
* Implement interactive drag & drop Kanban demo with enhanced text visibility
Enhanced HelloWorld component:
- Replace static content with interactive drag & drop Kanban board
- Showcase Svelte 5 features: $state runes, reactive updates, animations
- Add position-based reordering with real-time preview animations
- Implement proper accessibility with ARIA roles and labels
- Create engaging demo of client-side reactivity and state management
Improved component demo text visibility:
- Apply consistent styling patterns from Arizona Server Components section
- Upgrade text contrast using text-silver/90 for better readability
- Structure content with clear headers and logical sections
- Add developer tip highlighting client-side interactive features
- Maintain design consistency across both component sections
Technical improvements:
- Advanced drag & drop with mouse position-based insertion
- Smooth hover effects and visual feedback during drag operations
- Proper event handling with drag enter/leave/over/drop
- State management demonstrating Svelte's reactive capabilities
* Update Arizona framework to v0.2.0
Dependency updates:
- Upgrade @arizona-framework/client from v0.1.2 to v0.2.0
- Remove obsolete Vite alias configuration from vite.config.js
- Update package-lock.json with new dependency versions
The v0.2.0 release includes improved client-side functionality
and streamlined build configuration.
* Update minimum OTP version requirements
* Implement comprehensive automatic component lifecycle monitoring
Enhanced ArizonaSvelteLifecycle with automatic monitoring:
- DOM MutationObserver for real-time component detection
- Arizona WebSocket integration for HTML patch handling
- Automatic mount/unmount based on DOM changes
- Debounced operations to prevent excessive re-scanning
- Page visibility and unload event handling
- Configurable monitoring options with sensible defaults
Key features:
- Auto-mount: Automatically mount new components when detected
- Auto-unmount: Clean up components when DOM elements are removed
- WebSocket awareness: Re-scan after Arizona HTML patches
- Performance optimized: 100ms debounce prevents excessive operations
- Proper cleanup: All observers and timers cleaned up on page unload
Usage:
- arizonaSvelte.startMonitoring() - Enable automatic lifecycle
- arizonaSvelte.isMonitoring() - Check monitoring status
- Global debugging: window.arizonaSvelte available for inspection
This ensures Svelte components are properly managed throughout
the application lifecycle without manual intervention.
* Enhance lifecycle demo with improved UX and logging fixes
- Add LifecycleDemo Svelte component with persistent Demo Components section
- Fix object logging to show proper JSON instead of [object Object]
- Implement smooth auto-scroll to bottom for new log entries
- Remove debounce delay (0ms) for immediate component lifecycle monitoring
- Add consistent disabled states for remove buttons when no components exist
- Improve log order with newest entries at bottom
- Add helpful tip guiding users to Component Lifecycle Demo controls
- Enhance logging with proper component details and emojis
- Create persistent, styled demo container matching overall design
* Transform Arizona Svelte from demo app to hex/npm library packages
Complete restructuration from Erlang application to professional library:
### Package Distribution
- Configure rebar.config for hex package distribution
- Transform package.json to @arizona-framework/svelte NPM package
- Remove arizona-framework/client dependency per requirements
- Pin Svelte to version 5.39.6 and update all dependencies
### Library Structure
- Remove demo application modules (app, sup, counter, layout, view)
- Remove demo components (Counter, HelloWorld, LifecycleDemo)
- Remove demo assets (CSS, images, config files)
- Keep only core library modules: arizona_svelte, template, components
- Transform to library-only helper code without demo components
### Documentation Enhancement
- Add comprehensive Arizona framework style moduledoc with ~""""
- Document all functions with -doc ~""" attributes following Arizona patterns
- Emphasize critical one-time binding evaluation behavior
- Fix Arizona comment syntax from <!-- --> to {% Comment }
- Add detailed API reference and usage examples
### JavaScript Library
- Update to zero-debounce monitoring for immediate responsiveness
- Improve code formatting and arrow function consistency
- Add comprehensive build configuration with Vite
- Include ESLint, Prettier, and testing setup
- Generate minified distribution files
### Critical Behavioral Documentation
- Document that arizona_template:get_binding/2 is evaluated only once
- Emphasize state independence between Arizona and Svelte components
- Add warnings about binding tracking limitations
- Provide clear examples of one-time evaluation behavior
This transforms the project from a demo application into a production-ready
library suitable for hex and npm distribution.1 parent 3245819 commit cfcf1c9
File tree
50 files changed
+13119
-1832
lines changed- .github/workflows
- assets
- css
- js
- config
- priv/static
- assets
- js
- types
- images
- src
- test
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
50 files changed
+13119
-1832
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
0 commit comments