scarpe-components 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00d6fc57f20b1e43965eac4073589eba184f4acbc180265759b67c3bbb01489e
4
- data.tar.gz: a117f69c1b5ef13bfe6de0e5c7e6d5405de9ee5de955611ea45d2ba9dc5d5b2f
3
+ metadata.gz: 104df28c1f4d78348ec014bfad0f454fa82c0c7e364c102ebc058e12bf159cff
4
+ data.tar.gz: 95840b6b2d209e0c90a0ef6228a51f869aaf484747d3f73825a5efef5b3d8b17
5
5
  SHA512:
6
- metadata.gz: 23c7430ab9415f752d0a207879d4e76dcc61968c74257b7f0f6820332465ab701e1494c10c729fd8c75300b8d91240ec028624a07957360050d49589180d104f
7
- data.tar.gz: 158604e9ee1b743f29a8c5bda888ebbba441a0bd7266d72bee01585b56d4f2a7ee53cc2ecc60023d424f8d63edcab7016153562f518232a4cfceaa5744622ff9
6
+ metadata.gz: af4c8a4a5885c8c3745af1e0012a7029a4eb5867af7fda07a5f29f416301288975f3f3a8951c8d5ca7e75fe03f4f8d8d8294f59842ad140675a84b90113066da
7
+ data.tar.gz: eaa1bdb5d61e48ba7470eab8696ae7f053c2d8684a27aff763a5e2ed27f0b4d25b07f26f71ce93113d2b191699c0317f0b5ad7ce0cb2de3285a06168a735f890
data/Gemfile CHANGED
@@ -20,6 +20,4 @@ end
20
20
 
21
21
  group :development do
22
22
  gem "debug"
23
- gem "rubocop", "~> 1.21"
24
- gem "rubocop-shopify"
25
23
  end
data/Gemfile.lock CHANGED
@@ -1,20 +1,18 @@
1
1
  PATH
2
2
  remote: ../lacci
3
3
  specs:
4
- lacci (0.3.0)
5
- scarpe-components
4
+ lacci (0.4.0)
5
+ scarpe-components (~> 0.4.0)
6
6
 
7
7
  PATH
8
8
  remote: .
9
9
  specs:
10
- scarpe-components (0.3.0)
10
+ scarpe-components (0.4.0)
11
11
 
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
15
  ansi (1.5.0)
16
- ast (2.4.2)
17
- base64 (0.1.1)
18
16
  builder (3.2.4)
19
17
  debug (1.8.0)
20
18
  irb (>= 1.5.0)
@@ -23,51 +21,25 @@ GEM
23
21
  irb (1.8.0)
24
22
  rdoc (~> 6.5)
25
23
  reline (>= 0.3.6)
26
- json (2.6.3)
27
- language_server-protocol (3.17.0.3)
28
24
  minitest (5.19.0)
29
25
  minitest-reporters (1.6.1)
30
26
  ansi
31
27
  builder
32
28
  minitest (>= 5.0)
33
29
  ruby-progressbar
34
- parallel (1.23.0)
35
- parser (3.2.2.3)
36
- ast (~> 2.4.1)
37
- racc
38
30
  psych (5.1.0)
39
31
  stringio
40
- racc (1.7.1)
41
- rainbow (3.1.1)
42
32
  rake (13.0.6)
43
33
  rdoc (6.5.0)
44
34
  psych (>= 4.0.0)
45
- regexp_parser (2.8.1)
46
35
  reline (0.3.8)
47
36
  io-console (~> 0.5)
48
- rexml (3.2.6)
49
- rubocop (1.56.2)
50
- base64 (~> 0.1.1)
51
- json (~> 2.3)
52
- language_server-protocol (>= 3.17.0)
53
- parallel (~> 1.10)
54
- parser (>= 3.2.2.3)
55
- rainbow (>= 2.2.2, < 4.0)
56
- regexp_parser (>= 1.8, < 3.0)
57
- rexml (>= 3.2.5, < 4.0)
58
- rubocop-ast (>= 1.28.1, < 2.0)
59
- ruby-progressbar (~> 1.7)
60
- unicode-display_width (>= 2.4.0, < 3.0)
61
- rubocop-ast (1.29.0)
62
- parser (>= 3.2.1.0)
63
- rubocop-shopify (2.14.0)
64
- rubocop (~> 1.51)
65
37
  ruby-progressbar (1.13.0)
66
38
  stringio (3.0.8)
67
- unicode-display_width (2.4.2)
68
39
  webrick (1.8.1)
69
40
 
70
41
  PLATFORMS
42
+ arm64-darwin-21
71
43
  x86_64-darwin-22
72
44
 
73
45
  DEPENDENCIES
@@ -76,8 +48,6 @@ DEPENDENCIES
76
48
  minitest (~> 5.0)
77
49
  minitest-reporters
78
50
  rake (~> 13.0)
79
- rubocop (~> 1.21)
80
- rubocop-shopify
81
51
  scarpe-components!
82
52
  webrick
83
53
 
@@ -22,9 +22,17 @@ module Scarpe::Components::Calzini
22
22
 
23
23
  def edit_line_element(props)
24
24
  oninput = handler_js_code("change", "this.value")
25
-
25
+
26
26
  HTML.render do |h|
27
- h.input(id: html_id, oninput: oninput, onmouseover: handler_js_code("hover"), value: props["text"], style: edit_line_style(props),title: props["tooltip"])
27
+ h.input(
28
+ id: html_id,
29
+ type: props["secret"] ? :password : :text,
30
+ oninput: oninput,
31
+ onmouseover: handler_js_code("hover"),
32
+ value: props["text"],
33
+ style: edit_line_style(props),
34
+ title: props["tooltip"]
35
+ )
28
36
  end
29
37
  end
30
38
 
@@ -220,9 +220,14 @@ module Scarpe::Components::Calzini
220
220
  private
221
221
 
222
222
  def text_drawable_attrs(props)
223
+ click_value = props["click"]
224
+ # Internal routes (starting with /) should use onclick, not href
225
+ # External URLs use href for normal browser navigation
226
+ is_internal_route = click_value.is_a?(String) && click_value.start_with?("/")
227
+
223
228
  {
224
229
  # These properties will normally only be set by link()
225
- href: props["click"],
230
+ href: is_internal_route ? nil : click_value,
226
231
  onclick: props["has_block"] ? handler_js_code("click") : nil,
227
232
  }.compact
228
233
  end
@@ -100,6 +100,8 @@ module Scarpe::Components::Calzini
100
100
  "linear-gradient(45deg, #{bc.first}, #{bc.last})"
101
101
  when ->(value) { File.exist?(value) }
102
102
  "url(data:image/png;base64,#{encode_file_to_base64(bc)})"
103
+ when ->(value) { valid_url?(value) }
104
+ "url(#{bc})"
103
105
  else
104
106
  bc
105
107
  end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "socket"
4
+
5
+ module Scarpe::Components
6
+ module PortHelpers
7
+ MAX_SERVER_STARTUP_WAIT = 5.0
8
+
9
+ def port_working?(ip, port_num)
10
+ begin
11
+ TCPSocket.new(ip, port_num)
12
+ rescue Errno::ECONNREFUSED
13
+ return false
14
+ end
15
+ return true
16
+ end
17
+
18
+ def wait_until_port_working(ip, port_num, max_wait: MAX_SERVER_STARTUP_WAIT)
19
+ t_start = Time.now
20
+ loop do
21
+ if Time.now - t_start > max_wait
22
+ raise "Server on port #{port_num} didn't start up in time!"
23
+ end
24
+
25
+ sleep 0.1
26
+ return if port_working?(ip, port_num)
27
+ end
28
+ end
29
+ end
30
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Scarpe
4
4
  module Components
5
- VERSION = "0.4.0"
5
+ VERSION = "0.5.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,17 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scarpe-components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Concetto Rudilosso
8
8
  - Noah Gibbs
9
- autorequire:
10
9
  bindir: exe
11
10
  cert_chain: []
12
- date: 2024-05-06 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
13
12
  dependencies: []
14
- description:
15
13
  email:
16
14
  - marcoc.r@outlook.com
17
15
  - the.codefolio.guy@gmail.com
@@ -67,6 +65,7 @@ files:
67
65
  - lib/scarpe/components/minitest_import_runnable.rb
68
66
  - lib/scarpe/components/minitest_result.rb
69
67
  - lib/scarpe/components/modular_logger.rb
68
+ - lib/scarpe/components/port_helpers.rb
70
69
  - lib/scarpe/components/print_logger.rb
71
70
  - lib/scarpe/components/process_helpers.rb
72
71
  - lib/scarpe/components/promises.rb
@@ -81,7 +80,6 @@ licenses:
81
80
  metadata:
82
81
  homepage_uri: https://github.com/scarpe-team/scarpe
83
82
  changelog_uri: https://github.com/scarpe-team/scarpe/blob/main/CHANGELOG.md
84
- post_install_message:
85
83
  rdoc_options: []
86
84
  require_paths:
87
85
  - lib
@@ -96,8 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
94
  - !ruby/object:Gem::Version
97
95
  version: '0'
98
96
  requirements: []
99
- rubygems_version: 3.5.3
100
- signing_key:
97
+ rubygems_version: 3.6.9
101
98
  specification_version: 4
102
99
  summary: Reusable components for Scarpe display libraries
103
100
  test_files: []