atome 0.5.7.0.2 → 0.5.7.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0969d3c09cad0d5f55a4945f77f58615952416ee927c25260c8f02cba5012681'
4
- data.tar.gz: 4bf07124488234a077250506c0bf76698f3b0648e557243112489d4787b39141
3
+ metadata.gz: ee4cbfd38de06ba3640f664d4de45324115580ecd7b9dd03d174cd9b008418ec
4
+ data.tar.gz: 0bc8aef35a336616ddfb183608fc364d363abd03cc211eeb1127a0343b1cc1db
5
5
  SHA512:
6
- metadata.gz: b6f62fe357b0e0fcde26fca7fe3842f4ac6d66a96dc4ae78f6c129adb402bb37d361f9384d61db635ec8ace5177e97dadc1094f4d875873910863412b6ace81c
7
- data.tar.gz: 3e0d1bf658d8567f465616675806743e41704035d861ae3f7e39fb4edca4fb9a53023ffd0d249719d65f9d7a8ff6857773ed2666bc3f54aedbdb6a256d3a26a0
6
+ metadata.gz: 1340cb70b0212e385a616828f68c9e1684581874ef18c603f04dd40a800499352e603d404c6e91958f5b6a5933ba0583919ba2bde21d83b7bad68c1110c74a9e
7
+ data.tar.gz: 210a6c03ce4d95f613e2d5af338b71dee8037cb6525b483afb2fc9b6080cf76f994dfa6ac6f8ce82ea20bdacbad982e994ea6c6a6a05707fdd22270947b19ce7
@@ -113,6 +113,8 @@ class Atome
113
113
  target_vector.data(atome_content)
114
114
  end
115
115
 
116
+
117
+
116
118
  end
117
119
 
118
120
  @initialized = {}
@@ -163,7 +165,9 @@ class Atome
163
165
  end
164
166
 
165
167
  end
166
-
168
+ def add_text_visual(params)
169
+ html.add_font_to_css(params)
170
+ end
167
171
  def particle_main(element, params, &user_proc)
168
172
  # TODO : optimise below removing all conditions if possible
169
173
  if Atome.instance_variable_get("@main_#{element}").is_a?(Proc) # post is before rendering and broadcasting
data/lib/atome/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  # return atome version
4
4
  class Atome
5
- VERSION = '0.5.7.0.2'
5
+ VERSION = '0.5.7.0.3'
6
6
  end
@@ -37,6 +37,20 @@ class HTML
37
37
  current_div[:innerHTML] = params
38
38
  end
39
39
 
40
+ def add_font_to_css(params)
41
+ font_path = params[:path]
42
+ font_name = params[:name]
43
+ str_to_eval = <<STRDELIM
44
+ var styleSheet = document.styleSheets[0];
45
+ styleSheet.insertRule(`
46
+ @font-face {
47
+ font-family: '#{font_name}';
48
+ src: url('../medias/fonts/#{font_path}/#{font_name}.ttf') format('truetype');
49
+ }`, styleSheet.cssRules.length);
50
+ STRDELIM
51
+ JS.eval(str_to_eval)
52
+ end
53
+
40
54
  def add_css_to_atomic_style(css)
41
55
  style_element = JS.global[:document].getElementById('atomic_style')
42
56
  text_node = JS.global[:document].createTextNode(css)
@@ -1631,9 +1645,11 @@ class HTML
1631
1645
  name = params[:name]
1632
1646
  JS.eval("recordVideo(#{duration},'#{@id}', '#{name}')")
1633
1647
  end
1648
+
1634
1649
  def stop_video_preview(id)
1635
1650
  JS.eval("stopPreview('#{id}')")
1636
1651
  end
1652
+
1637
1653
  def video_preview(id, video, audio)
1638
1654
  JS.eval("create_preview('#{id}','#{video}','#{audio}')")
1639
1655
  end
@@ -81,4 +81,8 @@ end
81
81
  new({ method: :opacity, type: :integer, renderer: :html}) do |value|
82
82
  # html.opacity(value)
83
83
  html.style('opacity',value)
84
+ end
85
+
86
+ new({ method: :visual, type: :string, renderer: :html, specific: :text }) do |value, _user_proc|
87
+ html.style('fontFamily', value)
84
88
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ # add new font face
4
+ A.add_text_visual({ path: 'Roboto', name: 'Roboto-Thin' })
5
+ A.add_text_visual({ path: 'Roboto', name: 'Roboto-Thin' })
6
+ A.add_text_visual({ path: 'Roboto', name: 'Roboto-LightItalic' })
7
+
8
+ # now applying it
9
+ first_text=text({ data: :hello, component: { size: 55, visual: 'Roboto-Thin' } })
10
+ wait 1 do
11
+ text({ data: :hello, component: { size: 55, visual: 'Roboto-Black' } })
12
+ wait 1 do
13
+ first_text.component({visual: 'Roboto-LightItalic'})
14
+ end
15
+ end
@@ -16,6 +16,10 @@ html, body {
16
16
  z-index: 0;
17
17
  color: lightgray;
18
18
  }
19
+ /*@font-face {*/
20
+ /* font-family: 'MaPolicePersonnelle';*/
21
+ /* src: url('../medias/fonts/Roboto/Roboto-Black.ttf') format('truetype');*/
22
+ /*}*/
19
23
  pre {
20
24
  min-width: 100px;
21
25
  margin: 0;
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.0.2
4
+ version: 0.5.7.0.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-04-23 00:00:00.000000000 Z
11
+ date: 2024-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: artoo
@@ -578,6 +578,7 @@ files:
578
578
  - vendor/assets/application/examples/fill.rb
579
579
  - vendor/assets/application/examples/find.rb
580
580
  - vendor/assets/application/examples/fit.rb
581
+ - vendor/assets/application/examples/fonts.rb
581
582
  - vendor/assets/application/examples/generator_and_build.rb
582
583
  - vendor/assets/application/examples/getter.rb
583
584
  - vendor/assets/application/examples/grab.rb