scarpe 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.cursor/rules/commit-style-preferences.mdc +72 -0
- data/.cursor/rules/component_context.mdc +82 -0
- data/.cursor/rules/debug-failed-tests.mdc +100 -0
- data/.cursor/rules/display_service_context.mdc +80 -0
- data/.cursor/rules/event_handling_context.mdc +100 -0
- data/.cursor/rules/git-pager-handling.mdc +64 -0
- data/.cursor/rules/lacci-context.mdc +52 -0
- data/.cursor/rules/scarpe_design_context.mdc +46 -0
- data/.cursor/rules/shoes_compatibility_context.mdc +75 -0
- data/.cursor/rules/timeout_context.mdc +78 -0
- data/.cursor/rules/update_lacci_and_wv.mdc +8 -0
- data/.cursor/rules/what_is_scarpe.mdc +22 -0
- data/.cursor/rules/writing-new-rules.mdc +73 -0
- data/CHANGELOG.md +10 -1
- data/CLAUDE.md +223 -0
- data/Gemfile +0 -1
- data/Gemfile.lock +78 -58
- data/README.md +4 -7
- data/Rakefile +17 -25
- data/docs/SCARPE_FEATURES.md +38 -0
- data/docs/_config.yml +13 -0
- data/docs/calzini_components_and_updates.md +78 -0
- data/docs/display_service_separation.md +39 -0
- data/docs/documentation.md +43 -0
- data/docs/event_loops.md +66 -0
- data/docs/image.png +0 -0
- data/docs/index.md +118 -0
- data/docs/lacci.md +121 -0
- data/docs/scarpe_shoes_incompatibilities.md +71 -0
- data/docs/shoes_and_display_events.md +55 -0
- data/docs/shoes_implementations.md +79 -0
- data/docs/static/manual.md +5 -0
- data/docs/static/scarpe-logo.png +0 -0
- data/docs/timeouts_and_handlers.md +66 -0
- data/docs/web_archaeology.md +76 -0
- data/examples/background_with_image.rb +14 -5
- data/examples/bloopsaphone/working/feepogram.rb +1 -1
- data/examples/bloopsaphone/working/le_dance_des_rubis.rb +135 -0
- data/examples/bloopsaphone/working/pixel_dreams_in_ruby.rb +131 -0
- data/examples/bloopsaphone/working/type_rebellion.rb +157 -0
- data/examples/border.rb +1 -1
- data/examples/internal_link_navigation.rb +19 -0
- data/examples/page_navigation_single_app.rb +42 -0
- data/examples/shoes_subclass_app.rb +25 -0
- data/examples/url_routing_example.rb +67 -0
- data/lacci/Gemfile +0 -2
- data/lacci/Gemfile.lock +4 -32
- data/lacci/lacci.gemspec +1 -1
- data/lacci/lib/lacci/version.rb +1 -1
- data/lacci/lib/scarpe/niente/app.rb +12 -1
- data/lacci/lib/scarpe/niente/shoes_spec.rb +4 -5
- data/lacci/lib/scarpe/niente.rb +1 -0
- data/lacci/lib/shoes/app.rb +166 -61
- data/lacci/lib/shoes/constants.rb +1 -0
- data/lacci/lib/shoes/drawable.rb +35 -19
- data/lacci/lib/shoes/drawables/arc.rb +2 -2
- data/lacci/lib/shoes/drawables/arrow.rb +2 -2
- data/lacci/lib/shoes/drawables/border.rb +1 -1
- data/lacci/lib/shoes/drawables/button.rb +1 -1
- data/lacci/lib/shoes/drawables/edit_line.rb +1 -1
- data/lacci/lib/shoes/drawables/flow.rb +1 -1
- data/lacci/lib/shoes/drawables/line.rb +2 -2
- data/lacci/lib/shoes/drawables/link.rb +11 -1
- data/lacci/lib/shoes/drawables/oval.rb +2 -2
- data/lacci/lib/shoes/drawables/rect.rb +2 -2
- data/lacci/lib/shoes/drawables/shape.rb +2 -2
- data/lacci/lib/shoes/drawables/slot.rb +5 -3
- data/lacci/lib/shoes/drawables/stack.rb +1 -1
- data/lacci/lib/shoes/drawables/star.rb +1 -1
- data/lacci/lib/shoes/drawables/widget.rb +1 -1
- data/lacci/lib/shoes.rb +94 -17
- data/lacci/test/test_margin_helper.rb +1 -1
- data/lacci/test/test_niente_test_infra.rb +14 -0
- data/lacci/test/test_shoes_errors.rb +15 -13
- data/lib/scarpe/assets.rb +2 -1
- data/lib/scarpe/shoes_spec.rb +2 -1
- data/lib/scarpe/version.rb +1 -1
- data/lib/scarpe/wv/edit_line.rb +2 -2
- data/lib/scarpe/wv.rb +8 -1
- data/scarpe-components/Gemfile +0 -2
- data/scarpe-components/Gemfile.lock +4 -34
- data/scarpe-components/lib/scarpe/components/calzini/misc.rb +10 -2
- data/scarpe-components/lib/scarpe/components/calzini/para.rb +6 -1
- data/scarpe-components/lib/scarpe/components/calzini/slots.rb +2 -0
- data/scarpe-components/lib/scarpe/components/port_helpers.rb +30 -0
- data/scarpe-components/lib/scarpe/components/version.rb +1 -1
- data/scarpe-components/scarpe-components.gemspec +1 -1
- data/scarpe-components/test/test_port_helpers.rb +12 -0
- metadata +60 -22
- data/.rubocop.yml +0 -94
data/Rakefile
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require
|
|
4
|
-
require
|
|
5
|
-
require "rubocop/rake_task"
|
|
3
|
+
require 'bundler/gem_tasks'
|
|
4
|
+
require 'rake/testtask'
|
|
6
5
|
|
|
7
6
|
# Rakefile
|
|
8
7
|
|
|
@@ -13,20 +12,18 @@ task :ci_test do
|
|
|
13
12
|
|
|
14
13
|
system('brew install pkg-config portaudio')
|
|
15
14
|
|
|
16
|
-
|
|
17
15
|
puts "
|
|
18
16
|
\033[1;32;4;47mCheckout Code\033[0m
|
|
19
17
|
"
|
|
20
18
|
system('git checkout main')
|
|
21
19
|
|
|
22
|
-
|
|
23
20
|
puts "
|
|
24
21
|
\033[1;32;4;47mSetup Ruby and install Gems\033[0m
|
|
25
22
|
"
|
|
26
23
|
system('bundle install')
|
|
27
24
|
|
|
28
25
|
# Run tests
|
|
29
|
-
|
|
26
|
+
|
|
30
27
|
puts "
|
|
31
28
|
\033[1;32;4;47mRun Lacci Tests\033[0m
|
|
32
29
|
"
|
|
@@ -38,19 +35,16 @@ task :ci_test do
|
|
|
38
35
|
|
|
39
36
|
system('CI_RUN=true bundle exec rake component_test')
|
|
40
37
|
|
|
41
|
-
|
|
42
38
|
puts "
|
|
43
39
|
\033[1;32;4;47mRun Scarpe Tests\033[0m
|
|
44
40
|
"
|
|
45
41
|
system('CI_RUN=true bundle exec rake test')
|
|
46
42
|
|
|
47
|
-
|
|
48
43
|
puts "
|
|
49
44
|
\033[1;32;4;47mCheck HTML Output\033[0m
|
|
50
45
|
"
|
|
51
46
|
system('bundle exec rake test:check_html_fixtures')
|
|
52
47
|
|
|
53
|
-
|
|
54
48
|
puts "
|
|
55
49
|
\033[1;32;4;47mUpload Fail logs\033[0m
|
|
56
50
|
"
|
|
@@ -58,37 +52,35 @@ task :ci_test do
|
|
|
58
52
|
end
|
|
59
53
|
|
|
60
54
|
Rake::TestTask.new(:test) do |t|
|
|
61
|
-
t.libs <<
|
|
62
|
-
t.libs <<
|
|
63
|
-
t.test_files = FileList[
|
|
55
|
+
t.libs << 'test'
|
|
56
|
+
t.libs << 'lib'
|
|
57
|
+
t.test_files = FileList['test/**/test_*.rb']
|
|
64
58
|
end
|
|
65
59
|
|
|
66
60
|
Rake::TestTask.new(:lacci_test) do |t|
|
|
67
|
-
t.libs <<
|
|
68
|
-
t.libs <<
|
|
69
|
-
t.test_files = FileList[
|
|
61
|
+
t.libs << 'lacci/test'
|
|
62
|
+
t.libs << 'lacci/lib'
|
|
63
|
+
t.test_files = FileList['lacci/test/**/test_*.rb']
|
|
70
64
|
end
|
|
71
65
|
|
|
72
66
|
Rake::TestTask.new(:component_test) do |t|
|
|
73
|
-
t.libs <<
|
|
74
|
-
t.libs <<
|
|
75
|
-
t.test_files = FileList[
|
|
67
|
+
t.libs << 'scarpe-components/test'
|
|
68
|
+
t.libs << 'scarpe-components/lib'
|
|
69
|
+
t.test_files = FileList['scarpe-components/test/**/test_*.rb']
|
|
76
70
|
end
|
|
77
71
|
|
|
78
72
|
namespace :test do
|
|
79
73
|
desc 'Regenerate HTML fixtures'
|
|
80
|
-
task :regenerate_html_fixtures do |
|
|
81
|
-
ENV['SELECTED_FILE'] = ARGV[-1] if ARGV[-1].include?(
|
|
74
|
+
task :regenerate_html_fixtures do |_t|
|
|
75
|
+
ENV['SELECTED_FILE'] = ARGV[-1] if ARGV[-1].include?('.rb')
|
|
82
76
|
load 'tasks/regenerate_html_fixtures.rb'
|
|
83
77
|
end
|
|
84
78
|
|
|
85
79
|
desc 'Check HTML fixtures against latest output'
|
|
86
|
-
task :check_html_fixtures do |
|
|
87
|
-
ENV['SELECTED_FILE'] = ARGV[-1] if ARGV[-1].include?(
|
|
80
|
+
task :check_html_fixtures do |_t|
|
|
81
|
+
ENV['SELECTED_FILE'] = ARGV[-1] if ARGV[-1].include?('.rb')
|
|
88
82
|
load 'tasks/check_html_fixtures.rb'
|
|
89
83
|
end
|
|
90
84
|
end
|
|
91
85
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
task default: [:test, :lacci_test, :component_test]
|
|
86
|
+
task default: %i[test lacci_test component_test]
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
title: Scarpe Features
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Extending _why's Legacy
|
|
7
|
+
|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
The leading mission for Scarpe has been to implement as much backwards compatibility as possible for _why's original
|
|
11
|
+
Shoes library. This remains true. _why's taste and DSL are celebrated and preserved. However, at the discretion of
|
|
12
|
+
core maintainers, new features may be added. They must be approved by Noah Gibbs or Nick Schwaderer, and described
|
|
13
|
+
in this file. They cannot conflict or damage backwards compatibility with the original Shoes library.
|
|
14
|
+
|
|
15
|
+
## Page Navigation
|
|
16
|
+
|
|
17
|
+
Similar to URL navigation. see `url_navigation_single_app.rb` for an example. Unlike URLs, they do not accept parameters,
|
|
18
|
+
only the name of the page. They are simply declared and named in blocks.
|
|
19
|
+
|
|
20
|
+
```ruby
|
|
21
|
+
Shoes.app do
|
|
22
|
+
page(:home) do
|
|
23
|
+
title "Home Page"
|
|
24
|
+
para "Welcome to the home page"
|
|
25
|
+
button "Go to another page" do
|
|
26
|
+
visit(:another_page)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
page(:another_page) do
|
|
31
|
+
title "Another Page"
|
|
32
|
+
para "Welcome to another page"
|
|
33
|
+
button "Go to home page" do
|
|
34
|
+
visit(:home)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
```
|
data/docs/_config.yml
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
title: calzini components and updates
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Calzini Components and Updates
|
|
7
|
+
|
|
8
|
+
Calzini is Scarpe's component system, providing a modern approach to UI components while maintaining Shoes compatibility.
|
|
9
|
+
|
|
10
|
+
## Component Structure
|
|
11
|
+
|
|
12
|
+
Components in Calzini follow this structure:
|
|
13
|
+
|
|
14
|
+
1. **Base Components**
|
|
15
|
+
- Built-in widgets (Button, EditLine, etc.)
|
|
16
|
+
- Layout components (Stack, Flow)
|
|
17
|
+
- Custom components
|
|
18
|
+
|
|
19
|
+
2. **Component Lifecycle**
|
|
20
|
+
```ruby
|
|
21
|
+
class CalziniComponent
|
|
22
|
+
def initialize
|
|
23
|
+
setup_state
|
|
24
|
+
register_handlers
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def update
|
|
28
|
+
calculate_layout
|
|
29
|
+
trigger_display_update
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## State Management
|
|
35
|
+
|
|
36
|
+
Components manage state through:
|
|
37
|
+
|
|
38
|
+
1. **Internal State**
|
|
39
|
+
- Local component state
|
|
40
|
+
- Cached calculations
|
|
41
|
+
- Temporary values
|
|
42
|
+
|
|
43
|
+
2. **External State**
|
|
44
|
+
- Props from parent components
|
|
45
|
+
- Global application state
|
|
46
|
+
- Shared resources
|
|
47
|
+
|
|
48
|
+
## Update Mechanism
|
|
49
|
+
|
|
50
|
+
Updates in Calzini happen through:
|
|
51
|
+
|
|
52
|
+
1. **Change Detection**
|
|
53
|
+
- State changes trigger updates
|
|
54
|
+
- Props changes propagate
|
|
55
|
+
- Layout changes cascade
|
|
56
|
+
|
|
57
|
+
2. **Update Process**
|
|
58
|
+
- Changes are batched
|
|
59
|
+
- Updates are scheduled
|
|
60
|
+
- Display is refreshed efficiently
|
|
61
|
+
|
|
62
|
+
## Best Practices
|
|
63
|
+
|
|
64
|
+
When working with Calzini components:
|
|
65
|
+
|
|
66
|
+
1. Keep components focused and small
|
|
67
|
+
2. Use proper state management
|
|
68
|
+
3. Optimize update triggers
|
|
69
|
+
4. Handle errors gracefully
|
|
70
|
+
|
|
71
|
+
## Shoes Compatibility
|
|
72
|
+
|
|
73
|
+
Calzini maintains compatibility with Shoes:
|
|
74
|
+
|
|
75
|
+
- Similar API structure
|
|
76
|
+
- Familiar component names
|
|
77
|
+
- Compatible event handling
|
|
78
|
+
- Consistent behavior
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
title: Display Service Separation
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Display Service Separation
|
|
7
|
+
|
|
8
|
+
The display service in Scarpe is separated from the main application to provide better isolation and flexibility. This design choice allows for:
|
|
9
|
+
|
|
10
|
+
1. Clear separation between the application logic and display logic
|
|
11
|
+
2. Ability to swap out display implementations
|
|
12
|
+
3. Better testing capabilities through isolation
|
|
13
|
+
4. Reduced coupling between components
|
|
14
|
+
|
|
15
|
+
## Architecture
|
|
16
|
+
|
|
17
|
+
The display service runs as a separate process from the main Scarpe application. Communication happens through a well-defined protocol that includes:
|
|
18
|
+
|
|
19
|
+
- Event messages for user interactions
|
|
20
|
+
- Display update commands
|
|
21
|
+
- State synchronization messages
|
|
22
|
+
|
|
23
|
+
## Benefits
|
|
24
|
+
|
|
25
|
+
This separation provides several key benefits:
|
|
26
|
+
|
|
27
|
+
1. **Security**: The display service can run with different permissions
|
|
28
|
+
2. **Stability**: Issues in the display layer won't crash the main application
|
|
29
|
+
3. **Flexibility**: Different display implementations can be used without changing the core application
|
|
30
|
+
4. **Testing**: Components can be tested in isolation
|
|
31
|
+
|
|
32
|
+
## Implementation Details
|
|
33
|
+
|
|
34
|
+
The display service communicates with the main application through a message-passing interface. This allows for:
|
|
35
|
+
|
|
36
|
+
- Asynchronous updates
|
|
37
|
+
- Clean separation of concerns
|
|
38
|
+
- Easy testing and mocking
|
|
39
|
+
- Future extensibility
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
title: Documentation
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Documentation
|
|
7
|
+
|
|
8
|
+
## The Shoes Manual
|
|
9
|
+
|
|
10
|
+
The comprehensive guide to Shoes — everything you need to know.
|
|
11
|
+
|
|
12
|
+
**[Read the Manual →](static/manual)**
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Architecture & Internals
|
|
17
|
+
|
|
18
|
+
For contributors and the curious.
|
|
19
|
+
|
|
20
|
+
| Document | Description |
|
|
21
|
+
|----------|-------------|
|
|
22
|
+
| [Lacci](lacci) | The Shoes compatibility layer |
|
|
23
|
+
| [Display Service](display_service_separation) | How Scarpe separates app logic from rendering |
|
|
24
|
+
| [Events](shoes_and_display_events) | Event handling in Scarpe |
|
|
25
|
+
| [Event Loops](event_loops) | Understanding the event loop architecture |
|
|
26
|
+
| [Timeouts & Handlers](timeouts_and_handlers) | Timing and callback patterns |
|
|
27
|
+
| [Calzini Components](calzini_components_and_updates) | The HTML rendering component system |
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Reference
|
|
32
|
+
|
|
33
|
+
| Document | Description |
|
|
34
|
+
|----------|-------------|
|
|
35
|
+
| [Scarpe Features](SCARPE_FEATURES) | New features beyond original Shoes |
|
|
36
|
+
| [Incompatibilities](scarpe_shoes_incompatibilities) | Known differences from Shoes 3 |
|
|
37
|
+
| [Shoes Implementations](shoes_implementations) | History of Shoes reimplementations |
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
<p style="text-align: center; margin-top: 2rem;">
|
|
42
|
+
<a href="./">← Back to Home</a>
|
|
43
|
+
</p>
|
data/docs/event_loops.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
title: event loops
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Event Loops
|
|
7
|
+
|
|
8
|
+
Scarpe's event loop system is a core part of its architecture, handling both UI events and application logic.
|
|
9
|
+
|
|
10
|
+
## Main Event Loop
|
|
11
|
+
|
|
12
|
+
The main event loop is responsible for:
|
|
13
|
+
|
|
14
|
+
1. Processing user input
|
|
15
|
+
2. Handling timer events
|
|
16
|
+
3. Managing display updates
|
|
17
|
+
4. Coordinating between components
|
|
18
|
+
|
|
19
|
+
## Implementation Details
|
|
20
|
+
|
|
21
|
+
The event loop is implemented with these key features:
|
|
22
|
+
|
|
23
|
+
### Event Queue
|
|
24
|
+
- Events are queued in order of arrival
|
|
25
|
+
- Priority system for critical events
|
|
26
|
+
- Efficient processing of batched events
|
|
27
|
+
|
|
28
|
+
### Handler Registration
|
|
29
|
+
```ruby
|
|
30
|
+
class EventLoop
|
|
31
|
+
def register_handler(event_type, &block)
|
|
32
|
+
handlers[event_type] << block
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Event Processing
|
|
38
|
+
- Events are processed in a single thread
|
|
39
|
+
- Non-blocking operations where possible
|
|
40
|
+
- Careful handling of long-running tasks
|
|
41
|
+
|
|
42
|
+
## Cooperative Multitasking
|
|
43
|
+
|
|
44
|
+
Scarpe uses cooperative multitasking where:
|
|
45
|
+
|
|
46
|
+
1. Tasks yield control voluntarily
|
|
47
|
+
2. Long operations are broken into smaller chunks
|
|
48
|
+
3. The event loop maintains responsiveness
|
|
49
|
+
|
|
50
|
+
## Best Practices
|
|
51
|
+
|
|
52
|
+
When working with the event loop:
|
|
53
|
+
|
|
54
|
+
1. Keep handlers fast and focused
|
|
55
|
+
2. Avoid blocking operations
|
|
56
|
+
3. Use async operations for long-running tasks
|
|
57
|
+
4. Handle errors appropriately
|
|
58
|
+
|
|
59
|
+
## Integration with Display Service
|
|
60
|
+
|
|
61
|
+
The event loop coordinates closely with the display service:
|
|
62
|
+
|
|
63
|
+
- Synchronizes state updates
|
|
64
|
+
- Manages display refresh timing
|
|
65
|
+
- Handles animation frames
|
|
66
|
+
- Coordinates user input
|
data/docs/image.png
ADDED
|
Binary file
|
data/docs/index.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
title: Scarpe - Shoes in Modern Ruby
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<div style="text-align: center; margin-bottom: 2rem;">
|
|
7
|
+
<img src="static/scarpe-logo.png" alt="Scarpe Logo" style="max-width: 400px; width: 100%;">
|
|
8
|
+
<p style="font-size: 1.4rem; color: #666; font-style: italic; margin-top: 1rem;">Scarpe Diem: Seize the Shoes</p>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
**Scarpe** (Italian for "shoes") is a modern reimplementation of [Why The Lucky Stiff's Shoes](https://github.com/shoes/shoes-deprecated) — the beloved Ruby GUI toolkit that made desktop app creation accessible to everyone.
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
Shoes.app do
|
|
17
|
+
button "Click me!" do
|
|
18
|
+
alert "Hello, Shoes!"
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
That's it. That's a desktop app.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Why Scarpe?
|
|
28
|
+
|
|
29
|
+
Shoes was magic. Write a few lines of Ruby, get a real desktop application. No frameworks, no build tools, no complexity. Just pure, joyful programming.
|
|
30
|
+
|
|
31
|
+
But old Shoes stopped working. Scarpe brings it back — built on modern Ruby and [Webview](https://github.com/niclas-pehrsson/webview_ruby), running on macOS, Linux, and Windows.
|
|
32
|
+
|
|
33
|
+
<div style="display: flex; flex-wrap: wrap; gap: 1rem; margin: 2rem 0;">
|
|
34
|
+
<div style="flex: 1; min-width: 200px; padding: 1rem; background: #f8f8f8; border-radius: 8px;">
|
|
35
|
+
<h3>Simple</h3>
|
|
36
|
+
<p>Write desktop apps in pure Ruby. No ceremony, no boilerplate.</p>
|
|
37
|
+
</div>
|
|
38
|
+
<div style="flex: 1; min-width: 200px; padding: 1rem; background: #f8f8f8; border-radius: 8px;">
|
|
39
|
+
<h3>Beautiful</h3>
|
|
40
|
+
<p>Elegant DSL for layouts, text, images, shapes, and animations.</p>
|
|
41
|
+
</div>
|
|
42
|
+
<div style="flex: 1; min-width: 200px; padding: 1rem; background: #f8f8f8; border-radius: 8px;">
|
|
43
|
+
<h3>Fun</h3>
|
|
44
|
+
<p>Programming should be joyful. Scarpe keeps the whimsy alive.</p>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Quick Start
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
gem install scarpe
|
|
54
|
+
|
|
55
|
+
# Create hello.rb
|
|
56
|
+
echo 'Shoes.app { para "Hello, World!" }' > hello.rb
|
|
57
|
+
|
|
58
|
+
# Run it!
|
|
59
|
+
scarpe hello.rb
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## A Taste of Scarpe
|
|
65
|
+
|
|
66
|
+
```ruby
|
|
67
|
+
Shoes.app(title: "My App", width: 400, height: 300) do
|
|
68
|
+
background "#f5f5f5"
|
|
69
|
+
|
|
70
|
+
stack margin: 20 do
|
|
71
|
+
title "Welcome!"
|
|
72
|
+
para "Scarpe makes GUI programming simple."
|
|
73
|
+
|
|
74
|
+
flow do
|
|
75
|
+
button("Say Hello") { alert("Hello!") }
|
|
76
|
+
button("Goodbye") { exit }
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Stacks and flows for layout. Buttons and text with one line each. Blocks for callbacks. Ruby as it should be.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Documentation
|
|
87
|
+
|
|
88
|
+
<div style="display: flex; flex-wrap: wrap; gap: 1rem; margin: 1rem 0;">
|
|
89
|
+
<a href="static/manual" style="flex: 1; min-width: 150px; padding: 1rem; background: #CC342D; color: white; text-align: center; border-radius: 8px; text-decoration: none;">
|
|
90
|
+
<strong>The Manual</strong><br>
|
|
91
|
+
<small>Complete reference</small>
|
|
92
|
+
</a>
|
|
93
|
+
<a href="documentation" style="flex: 1; min-width: 150px; padding: 1rem; background: #666; color: white; text-align: center; border-radius: 8px; text-decoration: none;">
|
|
94
|
+
<strong>All Docs</strong><br>
|
|
95
|
+
<small>Architecture & internals</small>
|
|
96
|
+
</a>
|
|
97
|
+
<a href="https://github.com/scarpe-team/scarpe" style="flex: 1; min-width: 150px; padding: 1rem; background: #333; color: white; text-align: center; border-radius: 8px; text-decoration: none;">
|
|
98
|
+
<strong>GitHub</strong><br>
|
|
99
|
+
<small>Source & issues</small>
|
|
100
|
+
</a>
|
|
101
|
+
<a href="https://discord.gg/Ca5EHSsGYp" style="flex: 1; min-width: 150px; padding: 1rem; background: #5865F2; color: white; text-align: center; border-radius: 8px; text-decoration: none;">
|
|
102
|
+
<strong>Discord</strong><br>
|
|
103
|
+
<small>Community chat</small>
|
|
104
|
+
</a>
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## In Memory
|
|
110
|
+
|
|
111
|
+
*Scarpe is developed in loving memory of [Noah Gibbs](https://codefol.io/), who believed in this project and whose thoughtful documentation lives on in every design decision.*
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
<div style="text-align: center; margin-top: 3rem; color: #999;">
|
|
116
|
+
<p>Made with Ruby and whimsy.</p>
|
|
117
|
+
<p><small>Scarpe is open source under the MIT license.</small></p>
|
|
118
|
+
</div>
|
data/docs/lacci.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
title: Lacci
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Lacci: The Shoes4 Compatibility Layer
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Lacci (Italian for "laces") serves as the compatibility layer between Shoes4 applications and Scarpe's display services. Think of it as the translator that allows your classic Shoes4 code to work seamlessly with modern display backends.
|
|
11
|
+
|
|
12
|
+
## Core Concepts
|
|
13
|
+
|
|
14
|
+
### 1. Event Handling and Drawing Model
|
|
15
|
+
|
|
16
|
+
Lacci implements the Shoes4 drawing model, which includes:
|
|
17
|
+
- Slot-based layout system (stacks, flows)
|
|
18
|
+
- Event propagation
|
|
19
|
+
- Drawing context inheritance
|
|
20
|
+
- Margin and positioning calculations
|
|
21
|
+
|
|
22
|
+
### 2. Display Service Abstraction
|
|
23
|
+
|
|
24
|
+
Lacci abstracts away the details of different display services (like Webview or Qt) by:
|
|
25
|
+
- Translating Shoes4 drawing commands into display-agnostic operations
|
|
26
|
+
- Managing widget lifecycles
|
|
27
|
+
- Handling parent-child relationships between elements
|
|
28
|
+
- Coordinating style inheritance
|
|
29
|
+
|
|
30
|
+
### 3. Test Infrastructure
|
|
31
|
+
|
|
32
|
+
The test infrastructure in Lacci uses Niente (Italian for "nothing"), a null display service that:
|
|
33
|
+
- Allows testing without a real display backend
|
|
34
|
+
- Verifies drawing operations and event handling
|
|
35
|
+
- Supports multiple simultaneous Shoes apps in test environments
|
|
36
|
+
- Provides fast, reliable test execution
|
|
37
|
+
|
|
38
|
+
## Key Components
|
|
39
|
+
|
|
40
|
+
### MarginHelper
|
|
41
|
+
Handles margin calculations with support for:
|
|
42
|
+
- Numeric values
|
|
43
|
+
- Array-based margins
|
|
44
|
+
- Hash-based margins
|
|
45
|
+
- String-based margin definitions
|
|
46
|
+
|
|
47
|
+
### FontHelper
|
|
48
|
+
Manages font parsing and styling with support for:
|
|
49
|
+
- Font families
|
|
50
|
+
- Font sizes
|
|
51
|
+
- Font weights
|
|
52
|
+
- Font variants
|
|
53
|
+
- Font styles
|
|
54
|
+
|
|
55
|
+
### DrawContext
|
|
56
|
+
Manages the drawing context inheritance system:
|
|
57
|
+
- Style propagation (fill, stroke, etc.)
|
|
58
|
+
- Context stacking
|
|
59
|
+
- Property overrides
|
|
60
|
+
|
|
61
|
+
## Usage Examples
|
|
62
|
+
|
|
63
|
+
```ruby
|
|
64
|
+
# Basic Shoes4 App
|
|
65
|
+
Shoes.app do
|
|
66
|
+
stack do
|
|
67
|
+
para "Hello from Lacci!"
|
|
68
|
+
button "Click me" do
|
|
69
|
+
alert "Button clicked!"
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Error Handling
|
|
76
|
+
|
|
77
|
+
Lacci provides rich error handling through the `Shoes::Errors` module:
|
|
78
|
+
- `InvalidAttributeValueError`
|
|
79
|
+
- `BadArgumentListError`
|
|
80
|
+
- `UnsupportedFeatureError`
|
|
81
|
+
- `MultipleDrawablesFoundError`
|
|
82
|
+
- `NoDrawablesFoundError`
|
|
83
|
+
|
|
84
|
+
## Display Service Requirements
|
|
85
|
+
|
|
86
|
+
For a display service to be compatible with Lacci, it must:
|
|
87
|
+
1. Implement the basic drawing primitives
|
|
88
|
+
2. Support parent-child relationships
|
|
89
|
+
3. Handle event propagation
|
|
90
|
+
4. Manage drawing contexts
|
|
91
|
+
5. Support style inheritance
|
|
92
|
+
|
|
93
|
+
## Testing
|
|
94
|
+
|
|
95
|
+
Lacci uses a comprehensive test suite with:
|
|
96
|
+
- Unit tests for helpers and utilities
|
|
97
|
+
- Integration tests for drawing operations
|
|
98
|
+
- Feature tests for end-to-end functionality
|
|
99
|
+
- Niente-based tests for display service compatibility
|
|
100
|
+
|
|
101
|
+
## Future Development
|
|
102
|
+
|
|
103
|
+
Areas for future enhancement include:
|
|
104
|
+
- Additional drawing primitives
|
|
105
|
+
- Enhanced animation support
|
|
106
|
+
- Improved error reporting
|
|
107
|
+
- Extended display service capabilities
|
|
108
|
+
|
|
109
|
+
## Contributing
|
|
110
|
+
|
|
111
|
+
When contributing to Lacci:
|
|
112
|
+
1. Ensure tests pass with Niente
|
|
113
|
+
2. Maintain backward compatibility
|
|
114
|
+
3. Follow the existing error handling patterns
|
|
115
|
+
4. Document new features and changes
|
|
116
|
+
|
|
117
|
+
## Related Components
|
|
118
|
+
|
|
119
|
+
- Scarpe: The main project
|
|
120
|
+
- Niente: The null display service for testing
|
|
121
|
+
- Display Services: Various backend implementations
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
title: scarpe shoes incompatibilities
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Scarpe/Shoes Incompatibilities
|
|
7
|
+
|
|
8
|
+
This document outlines the known incompatibilities between Scarpe and the original Shoes implementation.
|
|
9
|
+
|
|
10
|
+
## API Differences
|
|
11
|
+
|
|
12
|
+
1. **Method Names**
|
|
13
|
+
- Some methods have been renamed for clarity
|
|
14
|
+
- Deprecated Shoes methods are not supported
|
|
15
|
+
- New methods added for modern features
|
|
16
|
+
|
|
17
|
+
2. **Parameters**
|
|
18
|
+
- Some parameter orders have changed
|
|
19
|
+
- Additional options are available
|
|
20
|
+
- Some legacy options are not supported
|
|
21
|
+
|
|
22
|
+
## Behavioral Changes
|
|
23
|
+
|
|
24
|
+
Key behavioral differences include:
|
|
25
|
+
|
|
26
|
+
1. **Event Handling**
|
|
27
|
+
- More consistent event model
|
|
28
|
+
- Better async support
|
|
29
|
+
- Different timing guarantees
|
|
30
|
+
|
|
31
|
+
2. **Layout System**
|
|
32
|
+
- More predictable layout behavior
|
|
33
|
+
- Enhanced flexibility
|
|
34
|
+
- Some legacy layouts may render differently
|
|
35
|
+
|
|
36
|
+
## Unsupported Features
|
|
37
|
+
|
|
38
|
+
Some Shoes features are not supported in Scarpe:
|
|
39
|
+
|
|
40
|
+
1. **Legacy Components**
|
|
41
|
+
- Certain deprecated widgets
|
|
42
|
+
- Old animation system
|
|
43
|
+
- Legacy drawing methods
|
|
44
|
+
|
|
45
|
+
2. **Platform-Specific Features**
|
|
46
|
+
- Some OS-specific capabilities
|
|
47
|
+
- Direct hardware access
|
|
48
|
+
- Legacy system integration
|
|
49
|
+
|
|
50
|
+
## Modernization Changes
|
|
51
|
+
|
|
52
|
+
Intentional changes for modern development:
|
|
53
|
+
|
|
54
|
+
1. **Architecture**
|
|
55
|
+
- Separate display service
|
|
56
|
+
- Modern component model
|
|
57
|
+
- Enhanced state management
|
|
58
|
+
|
|
59
|
+
2. **Development Experience**
|
|
60
|
+
- Better debugging tools
|
|
61
|
+
- Modern testing support
|
|
62
|
+
- Improved error messages
|
|
63
|
+
|
|
64
|
+
## Migration Guide
|
|
65
|
+
|
|
66
|
+
When moving from Shoes to Scarpe:
|
|
67
|
+
|
|
68
|
+
1. Review API changes
|
|
69
|
+
2. Update event handlers
|
|
70
|
+
3. Test layouts thoroughly
|
|
71
|
+
4. Use modern alternatives for legacy features
|