scarpe 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/.yardopts +12 -0
- data/CHANGELOG.md +16 -2
- data/Gemfile +3 -0
- data/Gemfile.lock +116 -0
- data/README.md +53 -30
- data/Rakefile +13 -1
- data/docs/yard/catscradle.md +44 -0
- data/docs/yard/template/default/fulldoc/html/setup.rb +13 -0
- data/docs/yard/template/default/layout/html/setup.rb +9 -0
- data/examples/animate.rb +20 -0
- data/examples/arrow.rb +10 -0
- data/examples/background_with_image.rb +16 -0
- data/examples/bloopsaphone/working/bronx_army_knife.rb +66 -0
- data/examples/bloopsaphone/working/morning_serenity.rb +21 -0
- data/examples/bloopsaphone/working/simpsons_theme_song_by_why.rb +6 -4
- data/examples/btn_tooltip.rb +7 -0
- data/examples/button_go_away.rb +1 -1
- data/examples/button_style_changed.rb +7 -0
- data/examples/button_styles_default.rb +6 -0
- data/examples/check.rb +18 -0
- data/examples/clear_and_append.rb +24 -0
- data/examples/download_and_show_image.rb +28 -0
- data/examples/edit_box.rb +3 -5
- data/examples/fonts.rb +2 -2
- data/examples/gen.rb +8 -8
- data/examples/get_headers.rb +10 -0
- data/examples/highlander.rb +4 -2
- data/examples/legacy/README.md +6 -0
- data/examples/legacy/not_checked/shoes-contrib/basic/shoes-notes.rb +1 -1
- data/examples/legacy/not_checked/simple/anim-shapes.rb +1 -1
- data/examples/legacy/not_checked/speedometer_app.rb +55 -0
- data/examples/legacy/working/simple/image-icon.rb +3 -0
- data/examples/legacy/{not_checked → working}/simple/image.rb +1 -1
- data/examples/link.rb +2 -2
- data/examples/list_box_choose.rb +17 -0
- data/examples/local_assets/local_file_server.rb +82 -0
- data/examples/local_assets/sample.gif +0 -0
- data/examples/local_assets/sample.mp4 +0 -0
- data/examples/local_fonts.rb +4 -0
- data/examples/local_images.rb +3 -0
- data/examples/motion_events.rb +20 -0
- data/examples/para/para_text.rb +14 -0
- data/examples/parse_xl_funnies.rb +58 -0
- data/examples/progress.rb +31 -0
- data/examples/radio/radio.rb +16 -0
- data/examples/radio/radio_groups.rb +18 -0
- data/examples/radio/radio_same_slot.rb +6 -0
- data/examples/rect.rb +4 -0
- data/examples/rotate_shapes.rb +17 -0
- data/examples/ruby_racer.rb +13 -15
- data/examples/selfitude.rb +18 -0
- data/examples/shapes/shapes_fill.rb +4 -3
- data/examples/shoes_school.rb +2 -4
- data/examples/show_hide.rb +6 -0
- data/examples/simpler-menu.rb +21 -0
- data/examples/skip_ci/change_my_audio_source.rb +21 -0
- data/examples/skip_ci/guitar_fretboard.rb +137 -0
- data/examples/video.rb +10 -0
- data/exe/scarpe +43 -66
- data/fonts/Pacifico.ttf +0 -0
- data/lacci/Gemfile +24 -0
- data/lacci/Gemfile.lock +79 -0
- data/lacci/Rakefile +12 -0
- data/lacci/lacci.gemspec +37 -0
- data/lacci/lib/lacci/scarpe_cli.rb +71 -0
- data/lacci/lib/lacci/scarpe_core.rb +22 -0
- data/lacci/lib/lacci/version.rb +13 -0
- data/lacci/lib/scarpe/niente/app.rb +23 -0
- data/lacci/lib/scarpe/niente/display_service.rb +62 -0
- data/lacci/lib/scarpe/niente/drawable.rb +57 -0
- data/lacci/lib/scarpe/niente/logger.rb +29 -0
- data/lacci/lib/scarpe/niente/shoes_spec.rb +87 -0
- data/lacci/lib/scarpe/niente.rb +20 -0
- data/lacci/lib/shoes/app.rb +309 -0
- data/{lib/scarpe → lacci/lib/shoes}/background.rb +2 -2
- data/{lib/scarpe → lacci/lib/shoes}/border.rb +2 -2
- data/lacci/lib/shoes/builtins.rb +63 -0
- data/lacci/lib/shoes/changelog.rb +52 -0
- data/{lib/scarpe → lacci/lib/shoes}/colors.rb +3 -1
- data/lacci/lib/shoes/constants.rb +47 -0
- data/{lib/scarpe → lacci/lib/shoes}/display_service.rb +71 -53
- data/lacci/lib/shoes/download.rb +123 -0
- data/lacci/lib/shoes/drawable.rb +380 -0
- data/lacci/lib/shoes/drawables/arc.rb +49 -0
- data/lacci/lib/shoes/drawables/arrow.rb +41 -0
- data/lacci/lib/shoes/drawables/button.rb +73 -0
- data/lacci/lib/shoes/drawables/check.rb +29 -0
- data/lacci/lib/shoes/drawables/document_root.rb +20 -0
- data/lacci/lib/shoes/drawables/edit_box.rb +29 -0
- data/{lib/scarpe → lacci/lib/shoes/drawables}/edit_line.rb +6 -6
- data/lacci/lib/shoes/drawables/flow.rb +22 -0
- data/{lib/scarpe → lacci/lib/shoes/drawables}/image.rb +7 -11
- data/lacci/lib/shoes/drawables/line.rb +20 -0
- data/lacci/lib/shoes/drawables/link.rb +34 -0
- data/lacci/lib/shoes/drawables/list_box.rb +56 -0
- data/lacci/lib/shoes/drawables/para.rb +118 -0
- data/lacci/lib/shoes/drawables/progress.rb +14 -0
- data/lacci/lib/shoes/drawables/radio.rb +33 -0
- data/lacci/lib/shoes/drawables/rect.rb +17 -0
- data/lacci/lib/shoes/drawables/shape.rb +36 -0
- data/lacci/lib/shoes/drawables/slot.rb +87 -0
- data/{lib/scarpe → lacci/lib/shoes/drawables}/span.rb +8 -7
- data/lacci/lib/shoes/drawables/stack.rb +26 -0
- data/lacci/lib/shoes/drawables/star.rb +50 -0
- data/lacci/lib/shoes/drawables/subscription_item.rb +93 -0
- data/lacci/lib/shoes/drawables/text_drawable.rb +63 -0
- data/lacci/lib/shoes/drawables/video.rb +16 -0
- data/lacci/lib/shoes/drawables/widget.rb +69 -0
- data/lacci/lib/shoes/drawables.rb +31 -0
- data/lacci/lib/shoes/errors.rb +28 -0
- data/lacci/lib/shoes/log.rb +71 -0
- data/lacci/lib/shoes/ruby_extensions.rb +15 -0
- data/lacci/lib/shoes/spacing.rb +9 -0
- data/lacci/lib/shoes-spec.rb +93 -0
- data/lacci/lib/shoes.rb +147 -0
- data/lacci/test/test_colors.rb +39 -0
- data/lacci/test/test_helper.rb +63 -0
- data/lacci/test/test_lacci.rb +18 -0
- data/lacci/test/test_shoes_errors.rb +49 -0
- data/lib/scarpe/cats_cradle.rb +271 -0
- data/lib/scarpe/errors.rb +77 -0
- data/lib/scarpe/evented_assertions.rb +121 -0
- data/lib/scarpe/shoes_spec.rb +181 -0
- data/lib/scarpe/version.rb +2 -2
- data/lib/scarpe/wv/app.rb +45 -23
- data/lib/scarpe/wv/arc.rb +4 -48
- data/lib/scarpe/wv/arrow.rb +9 -0
- data/lib/scarpe/wv/button.rb +7 -33
- data/lib/scarpe/wv/check.rb +27 -0
- data/lib/scarpe/wv/control_interface.rb +32 -40
- data/lib/scarpe/wv/document_root.rb +66 -31
- data/lib/scarpe/wv/drawable.rb +273 -0
- data/lib/scarpe/wv/edit_box.rb +4 -19
- data/lib/scarpe/wv/edit_line.rb +4 -18
- data/lib/scarpe/wv/flow.rb +2 -28
- data/lib/scarpe/wv/image.rb +10 -25
- data/lib/scarpe/wv/line.rb +3 -28
- data/lib/scarpe/wv/link.rb +3 -15
- data/lib/scarpe/wv/list_box.rb +6 -29
- data/lib/scarpe/wv/para.rb +11 -28
- data/lib/scarpe/wv/progress.rb +19 -0
- data/lib/scarpe/wv/radio.rb +33 -0
- data/lib/scarpe/wv/rect.rb +13 -0
- data/lib/scarpe/wv/shape.rb +41 -10
- data/lib/scarpe/wv/slot.rb +64 -0
- data/lib/scarpe/wv/span.rb +3 -25
- data/lib/scarpe/wv/stack.rb +2 -38
- data/lib/scarpe/wv/star.rb +3 -54
- data/lib/scarpe/wv/subscription_item.rb +84 -0
- data/lib/scarpe/wv/text_drawable.rb +32 -0
- data/lib/scarpe/wv/video.rb +34 -0
- data/lib/scarpe/wv/web_wrangler.rb +449 -299
- data/lib/scarpe/wv/webview_local_display.rb +63 -26
- data/lib/scarpe/wv/webview_relay_display.rb +24 -125
- data/lib/scarpe/wv/webview_relay_util.rb +140 -0
- data/lib/scarpe/wv/wv_display_worker.rb +19 -6
- data/lib/scarpe/wv.rb +76 -14
- data/lib/scarpe/wv_local.rb +1 -1
- data/lib/scarpe/wv_relay.rb +1 -1
- data/lib/scarpe.rb +4 -32
- data/logger/debug_web_wrangler.json +1 -1
- data/logger/scarpe_wv_test.json +1 -1
- data/scarpe-components/.gitignore +1 -0
- data/scarpe-components/Gemfile +22 -0
- data/scarpe-components/Gemfile.lock +86 -0
- data/scarpe-components/README.md +35 -0
- data/scarpe-components/Rakefile +12 -0
- data/scarpe-components/lib/scarpe/components/base64.rb +25 -0
- data/scarpe-components/lib/scarpe/components/calzini/alert.rb +49 -0
- data/scarpe-components/lib/scarpe/components/calzini/art_widgets.rb +203 -0
- data/scarpe-components/lib/scarpe/components/calzini/button.rb +39 -0
- data/scarpe-components/lib/scarpe/components/calzini/misc.rb +146 -0
- data/scarpe-components/lib/scarpe/components/calzini/para.rb +35 -0
- data/scarpe-components/lib/scarpe/components/calzini/slots.rb +155 -0
- data/scarpe-components/lib/scarpe/components/calzini/text_widgets.rb +65 -0
- data/scarpe-components/lib/scarpe/components/calzini.rb +149 -0
- data/scarpe-components/lib/scarpe/components/errors.rb +20 -0
- data/scarpe-components/lib/scarpe/components/file_helpers.rb +66 -0
- data/scarpe-components/lib/scarpe/components/html.rb +131 -0
- data/scarpe-components/lib/scarpe/components/minitest_export_reporter.rb +75 -0
- data/scarpe-components/lib/scarpe/components/minitest_import_runnable.rb +98 -0
- data/scarpe-components/lib/scarpe/components/minitest_result.rb +86 -0
- data/scarpe-components/lib/scarpe/components/modular_logger.rb +113 -0
- data/scarpe-components/lib/scarpe/components/print_logger.rb +47 -0
- data/{lib/scarpe → scarpe-components/lib/scarpe/components}/promises.rb +115 -48
- data/scarpe-components/lib/scarpe/components/segmented_file_loader.rb +189 -0
- data/scarpe-components/lib/scarpe/components/string_helpers.rb +10 -0
- data/scarpe-components/lib/scarpe/components/tiranti.rb +225 -0
- data/scarpe-components/lib/scarpe/components/unit_test_helpers.rb +257 -0
- data/scarpe-components/lib/scarpe/components/version.rb +7 -0
- data/scarpe-components/scarpe-components.gemspec +38 -0
- data/scarpe-components/test/calzini/test_calzini_alert.rb +30 -0
- data/scarpe-components/test/calzini/test_calzini_art_drawables.rb +105 -0
- data/scarpe-components/test/calzini/test_calzini_button.rb +52 -0
- data/scarpe-components/test/calzini/test_calzini_misc.rb +115 -0
- data/scarpe-components/test/calzini/test_calzini_para.rb +37 -0
- data/scarpe-components/test/calzini/test_calzini_slots.rb +130 -0
- data/scarpe-components/test/calzini/test_calzini_text_drawables.rb +41 -0
- data/scarpe-components/test/mtr_data/exception.json +1 -0
- data/scarpe-components/test/mtr_data/fail_with_message.json +1 -0
- data/scarpe-components/test/mtr_data/skipped_no_message.json +1 -0
- data/scarpe-components/test/mtr_data/skipped_w_msg.json +1 -0
- data/scarpe-components/test/mtr_data/succeed_2_asserts.json +1 -0
- data/scarpe-components/test/test_components.rb +9 -0
- data/scarpe-components/test/test_dimensions.rb +26 -0
- data/scarpe-components/test/test_helper.rb +43 -0
- data/scarpe-components/test/test_html.rb +65 -0
- data/scarpe-components/test/test_minitest_result.rb +61 -0
- data/scarpe-components/test/test_promises.rb +261 -0
- data/scarpe-components/test/test_segmented_app_files.rb +184 -0
- data/scarpegen.rb +14 -14
- data/sig/scarpe.rbs +1 -1
- data/{lib/scarpe → spikes}/glibui/widget.rb +2 -2
- data/{lib/scarpe → spikes}/glibui.rb +1 -1
- data/templates/basic_class_template.erb +13 -14
- data/templates/class_template_with_event_bind.erb +4 -4
- data/templates/class_template_with_shapes.erb +8 -17
- data/templates/example_template.erb +1 -1
- data/templates/module_template.erb +4 -4
- data/templates/webview_template.erb +3 -5
- metadata +236 -145
- data/examples/fill.rb +0 -25
- data/examples/legacy/not_checked/shoes-contrib/basic/class-book.yaml +0 -387
- data/examples/legacy/not_checked/shoes-contrib/elements/image-icon.rb +0 -3
- data/examples/legacy/not_checked/shoes-contrib/good/good-clock.rb +0 -51
- data/examples/legacy/not_checked/shoes-contrib/good/good-follow.rb +0 -26
- data/examples/legacy/not_checked/shoes-contrib/good/good-reminder.rb +0 -174
- data/examples/legacy/not_checked/shoes-contrib/good/good-vjot.rb +0 -56
- data/examples/legacy/not_checked/shoes-contrib/simple/simple-timer.rb +0 -13
- data/examples/legacy/not_checked/shoes-dep-samples/good-clock.rb +0 -51
- data/examples/legacy/not_checked/shoes-dep-samples/good-follow.rb +0 -26
- data/examples/legacy/not_checked/shoes-dep-samples/good-reminder.rb +0 -174
- data/examples/legacy/not_checked/shoes-dep-samples/good-vjot.rb +0 -56
- data/examples/legacy/not_checked/shoes-dep-samples/simple-accordion.rb +0 -75
- data/examples/legacy/not_checked/shoes-dep-samples/simple-anim-shapes.rb +0 -17
- data/examples/legacy/not_checked/shoes-dep-samples/simple-anim-text.rb +0 -13
- data/examples/legacy/not_checked/shoes-dep-samples/simple-arc.rb +0 -23
- data/examples/legacy/not_checked/shoes-dep-samples/simple-bounce.rb +0 -24
- data/examples/legacy/not_checked/shoes-dep-samples/simple-calc.rb +0 -70
- data/examples/legacy/not_checked/shoes-dep-samples/simple-chipmunk.rb +0 -26
- data/examples/legacy/not_checked/shoes-dep-samples/simple-control-sizes.rb +0 -24
- data/examples/legacy/not_checked/shoes-dep-samples/simple-curve.rb +0 -26
- data/examples/legacy/not_checked/shoes-dep-samples/simple-dialogs.rb +0 -29
- data/examples/legacy/not_checked/shoes-dep-samples/simple-draw.rb +0 -13
- data/examples/legacy/not_checked/shoes-dep-samples/simple-editor.rb +0 -28
- data/examples/legacy/not_checked/shoes-dep-samples/simple-form.rb +0 -28
- data/examples/legacy/not_checked/shoes-dep-samples/simple-form.shy +0 -0
- data/examples/legacy/not_checked/shoes-dep-samples/simple-mask.rb +0 -21
- data/examples/legacy/not_checked/shoes-dep-samples/simple-menu.rb +0 -31
- data/examples/legacy/not_checked/shoes-dep-samples/simple-menu1.rb +0 -35
- data/examples/legacy/not_checked/shoes-dep-samples/simple-rubygems.rb +0 -29
- data/examples/legacy/not_checked/shoes-dep-samples/simple-slide.rb +0 -45
- data/examples/legacy/not_checked/shoes-dep-samples/simple-sphere.rb +0 -28
- data/examples/legacy/not_checked/shoes-dep-samples/simple-sqlite3.rb +0 -13
- data/examples/legacy/not_checked/shoes-dep-samples/simple-timer.rb +0 -13
- data/examples/legacy/not_checked/shoes-dep-samples/simple-video.rb +0 -13
- data/examples/legacy/not_checked/simple/anim-text.rb +0 -13
- data/examples/legacy/not_checked/simple/arc.rb +0 -23
- data/examples/legacy/not_checked/simple/bounce.rb +0 -24
- data/examples/legacy/not_checked/simple/chipmunk.rb +0 -26
- data/examples/legacy/not_checked/simple/curve.rb +0 -26
- data/examples/legacy/not_checked/simple/dialogs.rb +0 -29
- data/examples/legacy/not_checked/simple/downloader.rb +0 -40
- data/examples/legacy/not_checked/simple/draw.rb +0 -13
- data/examples/legacy/not_checked/simple/mask.rb +0 -21
- data/examples/legacy/not_checked/simple/slide.rb +0 -45
- data/examples/legacy/not_checked/simple/sphere.rb +0 -28
- data/lib/constants.rb +0 -5
- data/lib/scarpe/alert.rb +0 -19
- data/lib/scarpe/app.rb +0 -78
- data/lib/scarpe/arc.rb +0 -49
- data/lib/scarpe/button.rb +0 -35
- data/lib/scarpe/document_root.rb +0 -20
- data/lib/scarpe/edit_box.rb +0 -24
- data/lib/scarpe/fill.rb +0 -23
- data/lib/scarpe/flow.rb +0 -19
- data/lib/scarpe/line.rb +0 -25
- data/lib/scarpe/link.rb +0 -25
- data/lib/scarpe/list_box.rb +0 -25
- data/lib/scarpe/logger.rb +0 -155
- data/lib/scarpe/para.rb +0 -90
- data/lib/scarpe/shape.rb +0 -19
- data/lib/scarpe/spacing.rb +0 -9
- data/lib/scarpe/stack.rb +0 -70
- data/lib/scarpe/star.rb +0 -47
- data/lib/scarpe/text_widget.rb +0 -42
- data/lib/scarpe/unit_test_helpers.rb +0 -163
- data/lib/scarpe/widget.rb +0 -198
- data/lib/scarpe/widgets.rb +0 -30
- data/lib/scarpe/wv/alert.rb +0 -65
- data/lib/scarpe/wv/background.rb +0 -18
- data/lib/scarpe/wv/border.rb +0 -22
- data/lib/scarpe/wv/control_interface_test.rb +0 -253
- data/lib/scarpe/wv/dimensions.rb +0 -22
- data/lib/scarpe/wv/fill.rb +0 -30
- data/lib/scarpe/wv/html.rb +0 -107
- data/lib/scarpe/wv/shape_helper.rb +0 -44
- data/lib/scarpe/wv/spacing.rb +0 -41
- data/lib/scarpe/wv/text_widget.rb +0 -30
- data/lib/scarpe/wv/widget.rb +0 -181
- data/scarpe-0.2.0.gem +0 -0
- /data/examples/legacy/not_checked/{expert → shoes-contrib/basic}/definr.rb +0 -0
- /data/examples/legacy/not_checked/{expert → shoes-contrib/basic}/funnies.rb +0 -0
- /data/examples/legacy/not_checked/shoes-contrib/{elements → basic}/list_box-select-class.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/basic → working/simple}/basic-edit-box.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/basic-fps.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/border-cat.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/check-mate.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/manipulation → working/simple}/clear-slot.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/basic → working/simple}/clock.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/basic → working/simple}/gradient-shoes.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/basic → working/simple}/list_box-shape-report.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/list_box.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/phat-button.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib → working}/simple/simple-calc.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/position → working/simple}/stack-width.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/width-introspec.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/README.md +0 -0
- /data/{lib/scarpe → spikes}/glibui/alert.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/app.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/background.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/border.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/button.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/dimensions.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/document_root.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/edit_box.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/edit_line.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/flow.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/html.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/image.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/link.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/local_display.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/para.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/spacing.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/stack.rb +0 -0
- /data/{lib/scarpe → spikes}/glibui/text_widget.rb +0 -0
- /data/{lib/scarpe → spikes}/libui/alert.rb +0 -0
- /data/{lib/scarpe → spikes}/libui/button.rb +0 -0
- /data/{lib/scarpe → spikes}/libui/colors.rb +0 -0
- /data/{lib/scarpe → spikes}/libui/core.rb +0 -0
- /data/{lib/scarpe → spikes}/libui/flow.rb +0 -0
- /data/{lib/scarpe → spikes}/libui/libui.rb +0 -0
- /data/{lib/scarpe → spikes}/libui/notepad.md +0 -0
- /data/{lib/scarpe → spikes}/libui/para.rb +0 -0
- /data/{lib/scarpe → spikes}/libui/stack.rb +0 -0
data/lib/scarpe/wv/widget.rb
DELETED
@@ -1,181 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class Scarpe
|
4
|
-
class WebviewWidget < DisplayService::Linkable
|
5
|
-
include Scarpe::Log
|
6
|
-
|
7
|
-
class << self
|
8
|
-
def display_class_for(scarpe_class_name)
|
9
|
-
scarpe_class = Scarpe.const_get(scarpe_class_name)
|
10
|
-
unless scarpe_class.ancestors.include?(Scarpe::DisplayService::Linkable)
|
11
|
-
raise "Scarpe Webview can only get display classes for Scarpe " +
|
12
|
-
"linkable widgets, not #{scarpe_class_name.inspect}!"
|
13
|
-
end
|
14
|
-
|
15
|
-
klass = Scarpe.const_get("Webview" + scarpe_class_name.split("::")[-1])
|
16
|
-
if klass.nil?
|
17
|
-
raise "Couldn't find corresponding Scarpe Webview class for #{scarpe_class_name.inspect}!"
|
18
|
-
end
|
19
|
-
|
20
|
-
klass
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
attr_reader :shoes_linkable_id
|
25
|
-
attr_reader :parent
|
26
|
-
attr_reader :children
|
27
|
-
|
28
|
-
def initialize(properties)
|
29
|
-
log_init("WV::Widget")
|
30
|
-
|
31
|
-
# Call method, which looks up the parent
|
32
|
-
@shoes_linkable_id = properties["shoes_linkable_id"] || properties[:shoes_linkable_id]
|
33
|
-
unless @shoes_linkable_id
|
34
|
-
raise "Could not find property shoes_linkable_id in #{properties.inspect}!"
|
35
|
-
end
|
36
|
-
|
37
|
-
# Set the display properties
|
38
|
-
properties.each do |k, v|
|
39
|
-
next if k == "shoes_linkable_id"
|
40
|
-
|
41
|
-
instance_variable_set("@" + k.to_s, v)
|
42
|
-
end
|
43
|
-
|
44
|
-
# The parent field is *almost* simple enough that a typed display property would handle it.
|
45
|
-
bind_shoes_event(event_name: "parent", target: shoes_linkable_id) do |new_parent_id|
|
46
|
-
display_parent = WebviewDisplayService.instance.query_display_widget_for(new_parent_id)
|
47
|
-
if @parent != display_parent
|
48
|
-
set_parent(display_parent)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
# When Shoes widgets change properties, we get a change notification here
|
53
|
-
bind_shoes_event(event_name: "prop_change", target: shoes_linkable_id) do |prop_changes|
|
54
|
-
prop_changes.each do |k, v|
|
55
|
-
instance_variable_set("@" + k, v)
|
56
|
-
end
|
57
|
-
properties_changed(prop_changes)
|
58
|
-
end
|
59
|
-
|
60
|
-
bind_shoes_event(event_name: "destroy", target: shoes_linkable_id) do
|
61
|
-
destroy_self
|
62
|
-
end
|
63
|
-
|
64
|
-
super(linkable_id: @shoes_linkable_id)
|
65
|
-
end
|
66
|
-
|
67
|
-
# This exists to be overridden by children watching for changes
|
68
|
-
def properties_changed(changes)
|
69
|
-
needs_update! unless changes.empty?
|
70
|
-
end
|
71
|
-
|
72
|
-
def set_parent(new_parent)
|
73
|
-
@parent&.remove_child(self)
|
74
|
-
new_parent&.add_child(self)
|
75
|
-
@parent = new_parent
|
76
|
-
end
|
77
|
-
|
78
|
-
protected
|
79
|
-
|
80
|
-
# Do not call directly, use set_parent
|
81
|
-
def remove_child(child)
|
82
|
-
@children ||= []
|
83
|
-
unless @children.include?(child)
|
84
|
-
@log.error("remove_child: no such child(#{child.inspect}) for"\
|
85
|
-
" parent(#{parent.inspect})!")
|
86
|
-
end
|
87
|
-
@children.delete(child)
|
88
|
-
end
|
89
|
-
|
90
|
-
# Do not call directly, use set_parent
|
91
|
-
def add_child(child)
|
92
|
-
@children ||= []
|
93
|
-
@children << child
|
94
|
-
|
95
|
-
# If we add a child, we should redraw ourselves
|
96
|
-
needs_update!
|
97
|
-
end
|
98
|
-
|
99
|
-
# Convert an [r, g, b, a] array to an HTML hex color code
|
100
|
-
# Arrays support alpha. HTML hex does not. So premultiply.
|
101
|
-
def rgb_to_hex(color)
|
102
|
-
return color if color.nil?
|
103
|
-
|
104
|
-
r, g, b, a = *color
|
105
|
-
if r.is_a?(Float)
|
106
|
-
a ||= 1.0
|
107
|
-
r_float = r * a
|
108
|
-
g_float = g * a
|
109
|
-
b_float = b * a
|
110
|
-
else
|
111
|
-
a ||= 255
|
112
|
-
a_float = (a / 255.0)
|
113
|
-
r_float = (r.to_f / 255.0) * a_float
|
114
|
-
g_float = (g.to_f / 255.0) * a_float
|
115
|
-
b_float = (b.to_f / 255.0) * a_float
|
116
|
-
end
|
117
|
-
|
118
|
-
r_int = (r_float * 255.0).to_i.clamp(0, 255)
|
119
|
-
g_int = (g_float * 255.0).to_i.clamp(0, 255)
|
120
|
-
b_int = (b_float * 255.0).to_i.clamp(0, 255)
|
121
|
-
|
122
|
-
"#%0.2X%0.2X%0.2X" % [r_int, g_int, b_int]
|
123
|
-
end
|
124
|
-
|
125
|
-
public
|
126
|
-
|
127
|
-
# This gets a mini-webview for just this element and its children, if any
|
128
|
-
def html_element
|
129
|
-
@elt_wrangler ||= WebviewDisplayService.instance.doc_root.get_element_wrangler(html_id)
|
130
|
-
end
|
131
|
-
|
132
|
-
# Return a promise that guarantees all currently-requested changes have completed
|
133
|
-
def promise_update
|
134
|
-
html_element.promise_update
|
135
|
-
end
|
136
|
-
|
137
|
-
def html_id
|
138
|
-
object_id.to_s
|
139
|
-
end
|
140
|
-
|
141
|
-
# to_html is intended to get the HTML DOM rendering of this object and its children.
|
142
|
-
# Calling it should be side-effect-free and NOT update the webview.
|
143
|
-
def to_html
|
144
|
-
@children ||= []
|
145
|
-
child_markup = @children.map(&:to_html).join
|
146
|
-
if respond_to?(:element)
|
147
|
-
element { child_markup }
|
148
|
-
else
|
149
|
-
child_markup
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
# This binds a Scarpe JS callback, handled via a single dispatch point in the document root
|
154
|
-
def bind(event, &block)
|
155
|
-
raise("Widget has no linkable_id! #{inspect}") unless linkable_id
|
156
|
-
|
157
|
-
WebviewDisplayService.instance.doc_root.bind("#{linkable_id}-#{event}", &block)
|
158
|
-
end
|
159
|
-
|
160
|
-
# Removes the element from both the Ruby Widget tree and the HTML DOM.
|
161
|
-
# Return a promise for when that HTML change will be visible.
|
162
|
-
def destroy_self
|
163
|
-
@parent&.remove_child(self)
|
164
|
-
html_element.remove
|
165
|
-
end
|
166
|
-
|
167
|
-
# It's really hard to do dirty-tracking here because the redraws are fully asynchronous.
|
168
|
-
# And so we can't easily cancel one "in flight," and we can't easily pick up the latest
|
169
|
-
# changes... And we probably don't want to, because we may be halfway through a batch.
|
170
|
-
def needs_update!
|
171
|
-
WebviewDisplayService.instance.doc_root.request_redraw!
|
172
|
-
end
|
173
|
-
|
174
|
-
def handler_js_code(handler_function_name, *args)
|
175
|
-
raise("Widget has no linkable_id! #{inspect}") unless linkable_id
|
176
|
-
|
177
|
-
js_args = ["'#{linkable_id}-#{handler_function_name}'", *args].join(", ")
|
178
|
-
"scarpeHandler(#{js_args})"
|
179
|
-
end
|
180
|
-
end
|
181
|
-
end
|
data/scarpe-0.2.0.gem
DELETED
Binary file
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
/data/examples/legacy/{not_checked/shoes-contrib/manipulation → working/simple}/clear-slot.rb
RENAMED
File without changes
|
File without changes
|
File without changes
|
/data/examples/legacy/{not_checked/shoes-contrib/basic → working/simple}/list_box-shape-report.rb
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
/data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/width-introspec.rb
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|