atome 0.5.7.4.2 → 0.5.7.4.3
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/lib/atome/extensions/atome.rb +13 -0
- data/lib/atome/version.rb +1 -1
- data/lib/molecules/intuition/utilities.rb +50 -10
- data/lib/renderers/html/atome_html.rb +16 -0
- data/vendor/assets/application/examples/applications.rb +8 -3
- data/vendor/assets/application/examples/to_px.rb +9 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9b3bf5cffbab20505060476da1e5f3938270c7a612d6961828860c3fd2682797
|
|
4
|
+
data.tar.gz: 6b143b8651c8db90424383494ed5b5ce1d3a211381b42404eb97bfd846a872b9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9e9d0eebf35dfde29462e19885d4bcb1eccb285eeb0e808381171028e94967d17e9f21c130053b34d31fdc59143c80808a28cf102520cc5cfb14e7c569961d33
|
|
7
|
+
data.tar.gz: bf0e01e0a8f0ea7ae821b896fb78e807f4d00848b452f827ebd3d0fb1a07b08b9542b02a87b0c498569f002edc4fca1cdab297c91fd57f974bdb1a4daa4cc119
|
|
@@ -69,6 +69,17 @@ end
|
|
|
69
69
|
class Object
|
|
70
70
|
include ObjectExtension
|
|
71
71
|
|
|
72
|
+
|
|
73
|
+
def remove_key_pair_but(hash, keys_to_keep)
|
|
74
|
+
hash.dup.delete_if do |key, value|
|
|
75
|
+
key.is_a?(Integer) && key.even? && !keys_to_keep.include?(key)
|
|
76
|
+
end.reject { |key, value| keys_to_keep.include?(key) }
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def filter_keys_to_keep(hash, keys_to_keep)
|
|
80
|
+
hash.select { |key, value| keys_to_keep.include?(key) }
|
|
81
|
+
end
|
|
82
|
+
|
|
72
83
|
def deep_copy(obj)
|
|
73
84
|
# utility for buttons
|
|
74
85
|
case obj
|
|
@@ -768,4 +779,6 @@ class CssProxy
|
|
|
768
779
|
parsed = JSON.parse(msg)
|
|
769
780
|
bloc.call(parsed)
|
|
770
781
|
end
|
|
782
|
+
|
|
783
|
+
|
|
771
784
|
end
|
data/lib/atome/version.rb
CHANGED
|
@@ -20,6 +20,18 @@ class Atome
|
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
+
def reorder_blocs
|
|
24
|
+
@prev_bloc_height = 0
|
|
25
|
+
fasten.each do |bloc_f|
|
|
26
|
+
potential_bloc = grab(bloc_f)
|
|
27
|
+
spacing = potential_bloc.spacing
|
|
28
|
+
if potential_bloc.role && potential_bloc.role.include?(:block)
|
|
29
|
+
potential_bloc.top(spacing + @prev_bloc_height)
|
|
30
|
+
@prev_bloc_height = @prev_bloc_height + potential_bloc.height + spacing
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
23
35
|
def remove_menu_item(item_to_remove)
|
|
24
36
|
grab(item_to_remove).delete(recursive: true)
|
|
25
37
|
reorder_menu
|
|
@@ -493,6 +505,8 @@ new(molecule: :application) do |params, &bloc|
|
|
|
493
505
|
|
|
494
506
|
menu = buttons({
|
|
495
507
|
id: "#{id_f}_menu",
|
|
508
|
+
# left: 66,
|
|
509
|
+
depth: 9999,
|
|
496
510
|
attach: id_f,
|
|
497
511
|
inactive: { text: { color: :gray }, width: 66, height: 12, spacing: 3, disposition: :horizontal,
|
|
498
512
|
color: :orange, margin: { left: 33, top: 12 } },
|
|
@@ -507,6 +521,7 @@ new(molecule: :application) do |params, &bloc|
|
|
|
507
521
|
|
|
508
522
|
main_app.define_singleton_method(:insert) do |bloc_to_add|
|
|
509
523
|
bloc_to_add.each do |page_id, params_f|
|
|
524
|
+
|
|
510
525
|
params_f.each do |block_id, block_content|
|
|
511
526
|
@pages[page_id][:blocks] ||= {}
|
|
512
527
|
@pages[page_id][:blocks][block_id.to_sym] = block_content
|
|
@@ -517,8 +532,11 @@ new(molecule: :application) do |params, &bloc|
|
|
|
517
532
|
|
|
518
533
|
end
|
|
519
534
|
main_app.define_singleton_method(:extract) do |bloc_to_extract|
|
|
520
|
-
|
|
521
|
-
|
|
535
|
+
|
|
536
|
+
bloc_to_extract.each do |page_id, block_id|
|
|
537
|
+
grab(block_id).delete({ recursive: true })
|
|
538
|
+
@blocks[page_id].delete(block_id)
|
|
539
|
+
grab(page_id).reorder_blocs
|
|
522
540
|
end
|
|
523
541
|
|
|
524
542
|
end
|
|
@@ -583,10 +601,23 @@ new(molecule: :show) do |page_id, &bloc|
|
|
|
583
601
|
# now looking for associated blocks
|
|
584
602
|
blocks_found = params[:blocks]
|
|
585
603
|
@prev_bloc_height = 0
|
|
586
|
-
blocks_found&.
|
|
604
|
+
blocks_found&.each do |bloc_id, bloc_content|
|
|
605
|
+
|
|
606
|
+
new_bloc = new_page.box({ id: bloc_id, role: :block, width: '100%', height: 99, top: spacing + @prev_bloc_height, bottom: 0, left: 0, right: 0, spacing: spacing })
|
|
607
|
+
|
|
608
|
+
new_bloc.define_singleton_method(:subs) do |sub_params|
|
|
609
|
+
@prev_sub_width = 0
|
|
610
|
+
sub_params.each do |sub_id, sub_content|
|
|
611
|
+
sub_created = new_bloc.box({ id: sub_id, height: '100%', left: @prev_sub_width })
|
|
612
|
+
sub_created.set(sub_content)
|
|
613
|
+
@prev_sub_width = @prev_sub_width + sub_created.to_px(:width) + spacing
|
|
614
|
+
sub_created.width(sub_created.to_percent(:width))
|
|
615
|
+
sub_created.left(sub_created.to_percent(:left))
|
|
616
|
+
end
|
|
587
617
|
|
|
588
|
-
|
|
618
|
+
end
|
|
589
619
|
new_bloc.set(bloc_content)
|
|
620
|
+
|
|
590
621
|
@prev_bloc_height = @prev_bloc_height + new_bloc.height + spacing
|
|
591
622
|
end
|
|
592
623
|
|
|
@@ -595,25 +626,25 @@ new(molecule: :show) do |page_id, &bloc|
|
|
|
595
626
|
|
|
596
627
|
new_page.set(particles_to_apply)
|
|
597
628
|
if footer
|
|
598
|
-
new_footer = box({ left: 0, depth:
|
|
629
|
+
new_footer = box({ left: 0, depth: 999, right: 0, width: :auto, top: :auto, bottom: 0, height: basic_size, category: :footer, id: "#{id_f}_footer" })
|
|
599
630
|
new_footer.remove(:box_color)
|
|
600
631
|
new_footer.set(footer)
|
|
601
632
|
end
|
|
602
633
|
|
|
603
634
|
if header
|
|
604
|
-
new_header = box({ left: 0, right: 0, depth:
|
|
635
|
+
new_header = box({ left: 0, right: 0, depth: 999, width: :auto, top: 0, height: basic_size, category: :header, id: "#{id_f}_header" })
|
|
605
636
|
new_header.remove(:box_color)
|
|
606
637
|
new_header.set(header)
|
|
607
638
|
end
|
|
608
639
|
|
|
609
640
|
if right_side_bar
|
|
610
|
-
new_right_side_bar = box({ left: :auto, depth:
|
|
641
|
+
new_right_side_bar = box({ left: :auto, depth: 999, right: 0, width: basic_size, top: 0, bottom: 0, height: :auto, category: :right_side_bar, id: "#{id_f}_right_side_bar" })
|
|
611
642
|
new_right_side_bar.remove(:box_color)
|
|
612
643
|
new_right_side_bar.set(right_side_bar)
|
|
613
644
|
end
|
|
614
645
|
|
|
615
646
|
if left_side_bar
|
|
616
|
-
new_left_side_bar = box({ left: 0, right: :auto, depth:
|
|
647
|
+
new_left_side_bar = box({ left: 0, right: :auto, depth: 999, width: basic_size, top: 0, bottom: 0, height: :auto, category: :left_side_bar, id: "#{id_f}_left_side_bar" })
|
|
617
648
|
new_left_side_bar.remove(:box_color)
|
|
618
649
|
new_left_side_bar.set(left_side_bar)
|
|
619
650
|
end
|
|
@@ -646,13 +677,22 @@ new(molecule: :show) do |page_id, &bloc|
|
|
|
646
677
|
main_page
|
|
647
678
|
end
|
|
648
679
|
|
|
680
|
+
|
|
681
|
+
|
|
649
682
|
new(molecule: :buttons) do |params, &bloc|
|
|
683
|
+
|
|
684
|
+
keys_to_keep = [:inactive, :active]
|
|
685
|
+
remaining_params = remove_key_pair_but(params, keys_to_keep)
|
|
686
|
+
params = filter_keys_to_keep(params, keys_to_keep)
|
|
687
|
+
|
|
650
688
|
role_f = params.delete(:role)
|
|
651
689
|
actor_f = params.delete(:actor)
|
|
652
690
|
params_saf = deep_copy(params)
|
|
653
|
-
context =
|
|
654
|
-
id_f =
|
|
691
|
+
context = remaining_params.delete(:attach) || :view
|
|
692
|
+
id_f = remaining_params.delete(:id) || identity_generator
|
|
655
693
|
main = grab(context).box({ id: id_f })
|
|
694
|
+
main.set(remaining_params)
|
|
695
|
+
|
|
656
696
|
main.role(role_f) || main.role(:buttons)
|
|
657
697
|
main.actor(actor_f) if actor_f
|
|
658
698
|
main.color({ blue: 0.5, red: 1, green: 1, alpha: 0 })
|
|
@@ -19,4 +19,20 @@ class Atome
|
|
|
19
19
|
JS
|
|
20
20
|
JS.eval(ruby_wasm_code).to_f
|
|
21
21
|
end
|
|
22
|
+
|
|
23
|
+
def to_percent(property)
|
|
24
|
+
parent = grab(attach)
|
|
25
|
+
parent_width = parent.to_px(:width)
|
|
26
|
+
parent_height = parent.to_px(:height)
|
|
27
|
+
property_needed_px = to_px(property)
|
|
28
|
+
case property
|
|
29
|
+
when :width, :left
|
|
30
|
+
"#{(property_needed_px / parent_width.to_f) * 100}%"
|
|
31
|
+
when :height, :top
|
|
32
|
+
"#{(property_needed_px / parent_height.to_f) * 100}%"
|
|
33
|
+
else
|
|
34
|
+
raise ArgumentError # unsupported property use left , top, width an height
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
22
38
|
end
|
|
@@ -56,14 +56,19 @@ puts " menus_found => #{menus_found}"
|
|
|
56
56
|
|
|
57
57
|
bloc_to_add= {height: 156, color: :green}
|
|
58
58
|
bloc_to_add2= {height: 99, color: :blue}
|
|
59
|
-
bloc_to_add3= {height: 333, color: :orange}
|
|
59
|
+
bloc_to_add3= {height: 333, color: :orange, subs:{contact: {width: '33%'}, project: {width: '33%'}, calendar: {width: '33%'}}}
|
|
60
60
|
a.insert({page3: {block1: bloc_to_add , block2: bloc_to_add2, block3: bloc_to_add3}})
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
wait 1 do
|
|
63
64
|
# how to remove blocks
|
|
64
65
|
a.extract({page3: :block1})
|
|
65
66
|
end
|
|
66
67
|
|
|
67
68
|
a.show(:page3)
|
|
69
|
+
# how access blocks
|
|
70
|
+
# wait 3 do
|
|
71
|
+
# grab(:block2).color(:black)
|
|
72
|
+
# end
|
|
68
73
|
|
|
69
74
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: atome
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.7.4.
|
|
4
|
+
version: 0.5.7.4.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jean-Eric Godard
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-06-
|
|
11
|
+
date: 2024-06-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: eventmachine
|
|
@@ -656,6 +656,7 @@ files:
|
|
|
656
656
|
- vendor/assets/application/examples/text.rb
|
|
657
657
|
- vendor/assets/application/examples/text_align.rb
|
|
658
658
|
- vendor/assets/application/examples/tick.rb
|
|
659
|
+
- vendor/assets/application/examples/to_px.rb
|
|
659
660
|
- vendor/assets/application/examples/tools.rb
|
|
660
661
|
- vendor/assets/application/examples/touch.rb
|
|
661
662
|
- vendor/assets/application/examples/type_mutation.rb
|