atome 0.5.3.8.8 → 0.5.4.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +52 -17
  3. data/app_builder_helpers/Rakefile +20 -3
  4. data/exe/atome +33 -1
  5. data/lib/atome/atome.rb +43 -57
  6. data/lib/atome/extensions/atome.rb +82 -52
  7. data/lib/atome/extensions/mathematic.rb +8 -12
  8. data/lib/atome/extensions/matrix.rb +138 -210
  9. data/lib/atome/genesis/generators/atome.rb +8 -134
  10. data/lib/atome/genesis/generators/communication.rb +0 -1
  11. data/lib/atome/genesis/generators/effect.rb +0 -6
  12. data/lib/atome/genesis/generators/event.rb +64 -77
  13. data/lib/atome/genesis/generators/geometry.rb +0 -18
  14. data/lib/atome/genesis/generators/identity.rb +6 -33
  15. data/lib/atome/genesis/generators/material.rb +3 -54
  16. data/lib/atome/genesis/generators/utility.rb +63 -58
  17. data/lib/atome/genesis/genesis.rb +8 -0
  18. data/lib/atome/genesis/sparkle.rb +35 -16
  19. data/lib/atome/helpers/callbacks.rb +47 -1
  20. data/lib/atome/helpers/essentials.rb +1 -1
  21. data/lib/atome/helpers/sanitizer.rb +0 -10
  22. data/lib/atome/helpers/utilities.rb +74 -28
  23. data/lib/atome/kernel/batch.rb +13 -35
  24. data/lib/atome/kernel/universe.rb +2 -0
  25. data/lib/atome/presets/atome.rb +4 -12
  26. data/lib/atome/renderers/browser/atome.rb +1 -1
  27. data/lib/atome/renderers/browser/browser.rb +2 -0
  28. data/lib/atome/renderers/browser/event.rb +18 -0
  29. data/lib/atome/renderers/browser/helpers/drag_helper.rb +13 -0
  30. data/lib/atome/renderers/browser/helpers/drop_helper.rb +13 -0
  31. data/lib/atome/renderers/browser/helpers/event_helper.rb +16 -11
  32. data/lib/atome/renderers/browser/helpers/over_helper.rb +13 -0
  33. data/lib/atome/renderers/browser/helpers/text_helper.rb +5 -1
  34. data/lib/atome/renderers/browser/spatial.rb +3 -2
  35. data/lib/atome/renderers/browser/utility.rb +7 -7
  36. data/lib/atome/version.rb +2 -2
  37. data/lib/atome.rb +1 -0
  38. data/sig/atome.rbs +16 -0
  39. data/sig/batch.rbs +7 -0
  40. data/sig/browser_helper.rbs +14 -0
  41. data/sig/matrix.rbs +5 -0
  42. data/sig/object.rbs +3 -0
  43. data/vendor/assets/aui.rb +5 -0
  44. data/vendor/assets/src/index.html +15 -3
  45. data/vendor/assets/src/js/atome/atome.js +1 -1
  46. data/vendor/assets/src/js/atome/atome_helpers/atome_animate.js +1 -1
  47. data/vendor/assets/src/js/atome/atome_helpers/atome_communication.js +40 -0
  48. data/vendor/assets/src/js/atome/atome_helpers/atome_drag.js +40 -3
  49. data/vendor/assets/src/js/atome/atome_helpers/atome_drop.js +12 -0
  50. data/vendor/assets/src/js/atome/atome_helpers/atome_events.js +166 -0
  51. data/vendor/assets/src/js/atome/atome_helpers/atome_file.js +6 -1
  52. data/vendor/assets/src/js/atome/atome_helpers/atome_over.js +43 -0
  53. data/vendor/assets/src/medias/rubies/demos.rb +63 -0
  54. data/vendor/assets/src/medias/rubies/examples/add.rb +1 -1
  55. data/vendor/assets/src/medias/rubies/examples/animation.rb +1 -1
  56. data/vendor/assets/src/medias/rubies/examples/atome_new.rb +1 -1
  57. data/vendor/assets/src/medias/rubies/examples/attach.rb +10 -10
  58. data/vendor/assets/src/medias/rubies/examples/attached.rb +2 -3
  59. data/vendor/assets/src/medias/rubies/examples/batch.rb +17 -0
  60. data/vendor/assets/src/medias/rubies/examples/blur.rb +2 -2
  61. data/vendor/assets/src/medias/rubies/examples/box.rb +2 -2
  62. data/vendor/assets/src/medias/rubies/examples/code.rb +1 -1
  63. data/vendor/assets/src/medias/rubies/examples/color.rb +3 -3
  64. data/vendor/assets/src/medias/rubies/examples/delete.rb +17 -1
  65. data/vendor/assets/src/medias/rubies/examples/detached.rb +3 -3
  66. data/vendor/assets/src/medias/rubies/examples/drag.rb +52 -1
  67. data/vendor/assets/src/medias/rubies/examples/drop.rb +26 -0
  68. data/vendor/assets/src/medias/rubies/examples/fullscreen.rb +1 -1
  69. data/vendor/assets/src/medias/rubies/examples/markers.rb +1 -1
  70. data/vendor/assets/src/medias/rubies/examples/matrix.rb +102 -0
  71. data/vendor/assets/src/medias/rubies/examples/matrix_changes.rb +483 -0
  72. data/vendor/assets/src/medias/rubies/examples/matrix_simple.rb +32 -0
  73. data/vendor/assets/src/medias/rubies/examples/monitoring.rb +1 -1
  74. data/vendor/assets/src/medias/rubies/examples/mute.rb +1 -1
  75. data/vendor/assets/src/medias/rubies/examples/on.rb +1 -1
  76. data/vendor/assets/src/medias/rubies/examples/over.rb +6 -4
  77. data/vendor/assets/src/medias/rubies/examples/pause.rb +1 -1
  78. data/vendor/assets/src/medias/rubies/examples/physical.rb +19 -0
  79. data/vendor/assets/src/medias/rubies/examples/play.rb +1 -1
  80. data/vendor/assets/src/medias/rubies/examples/repeat.rb +3 -2
  81. data/vendor/assets/src/medias/rubies/examples/shadow.rb +1 -1
  82. data/vendor/assets/src/medias/rubies/examples/sort.rb +3 -4
  83. data/vendor/assets/src/medias/rubies/examples/tags.rb +10 -0
  84. data/vendor/assets/src/medias/rubies/examples/text.rb +4 -4
  85. data/vendor/assets/src/medias/rubies/examples/time.rb +2 -2
  86. data/vendor/assets/src/medias/rubies/examples/video.rb +2 -2
  87. data/vendor/assets/src/medias/rubies/{examples → unstable}/_2_solve.rb +1 -1
  88. data/vendor/assets/src/medias/rubies/{examples → unstable}/_audio.rb +1 -1
  89. data/vendor/assets/src/medias/rubies/{examples → unstable}/_dataset.rb +4 -4
  90. data/vendor/assets/src/medias/rubies/{examples → unstable}/_table2.rb +2 -2
  91. data/vendor/assets/src/medias/rubies/{examples → unstable}/_vie.rb +2 -2
  92. data/vendor/assets/src/utilities/mode.rb +0 -0
  93. data/vendor/assets/src-tauri/tauri.conf.json +2 -2
  94. metadata +32 -14
  95. data/vendor/assets/src/medias/rubies/examples/table.rb +0 -479
  96. /data/vendor/assets/src/medias/rubies/{examples → unstable}/!run.rb +0 -0
  97. /data/vendor/assets/src/medias/rubies/{examples → unstable}/_attach.rb +0 -0
  98. /data/vendor/assets/src/medias/rubies/{examples → unstable}/_matrix.rb +0 -0
  99. /data/vendor/assets/src/medias/rubies/{examples → unstable}/_os.rb +0 -0
  100. /data/vendor/assets/src/medias/rubies/{examples → unstable}/_test.rb +0 -0
data/sig/batch.rbs ADDED
@@ -0,0 +1,7 @@
1
+ class Batch
2
+ @data: untyped
3
+
4
+ def dispatch: -> untyped
5
+
6
+ def each: -> untyped
7
+ end
@@ -0,0 +1,14 @@
1
+ module BrowserHelper
2
+ @enter_action_proc: untyped
3
+ @leave_action_proc: untyped
4
+
5
+ def self.anim_convertor: -> untyped
6
+
7
+ def self.anim_value_analysis: -> untyped
8
+
9
+ def self.browser_over_enter: -> untyped
10
+
11
+ def self.browser_over_leave: -> untyped
12
+
13
+ def self.send_anim_to_js: -> untyped
14
+ end
data/sig/matrix.rbs ADDED
@@ -0,0 +1,5 @@
1
+ module Matrix
2
+ def cell: -> untyped
3
+
4
+ def content: -> untyped
5
+ end
data/sig/object.rbs ADDED
@@ -0,0 +1,3 @@
1
+ class Object
2
+ def create_method_at_object_level: -> untyped
3
+ end
data/vendor/assets/aui.rb CHANGED
@@ -0,0 +1,5 @@
1
+ class Atome
2
+ def self.aui
3
+ SecureRandom.uuid
4
+ end
5
+ end
@@ -1,6 +1,10 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="En">
3
3
  <head>
4
+ <!-- <link rel="icon" type="image/x-icon" href="./favicon.ico">-->
5
+ <link rel="icon" type="image/x-icon" href="https://github.com/atomecorp/atome/blob/master/vendor/assets/src/favicon.ico">
6
+
7
+
4
8
  <meta name='viewport' content='initial-scale=1, width=device-width, viewport-fit=cover'>
5
9
  <meta charset='UTF-8'/>
6
10
  <meta name="format-detection" content="telephone=no">
@@ -20,20 +24,28 @@
20
24
  <!-- TODO: we line below is commented when using stand alone mode and loaded on demand when using server mode-->
21
25
  <script type="text/javascript" src="js/third_parties/fabric.min.js"></script>
22
26
  <!-- <script type="text/javascript" src="js/third_parties/three.min.js"></script>-->
23
- <!-- <script src='js/opal/opal_parser.js'></script>-->
27
+ <script src='js/opal/opal_parser.js'></script>
24
28
  <script src='js/aui.js'></script>
29
+
25
30
  <script src='js/atome/atome_helpers/atome_animate.js' defer></script>
31
+ <script src='js/atome/atome_helpers/atome_communication.js' defer></script>
26
32
  <script src='js/atome/atome_helpers/atome_drag.js' defer></script>
33
+ <script src='js/atome/atome_helpers/atome_drop.js' defer></script>
34
+ <script src='js/atome/atome_helpers/atome_over.js' defer></script>
35
+ <script src='js/atome/atome_helpers/atome_events.js' defer></script>
27
36
  <script src='js/atome/atome_helpers/atome_file.js' defer></script>
28
37
  <script src='js/atome/atome_helpers/atome_sort.js' defer></script>
29
38
  <script src='js/atome/atome_helpers/atome_time.js' defer></script>
30
39
  <script src='js/atome/atome_helpers/atome_video.js' defer></script>
31
40
  <script src='js/atome/atome.js' defer></script>
32
41
  <script src='js/atome/kernel.js' defer></script>
42
+ <script src='js/infos.js'></script>
33
43
  <script src='js/opal/atome_opal_extensions.js'></script>
34
44
  <title>atome</title>
35
- <link rel="icon" type="image/x-icon" href="./favicon.ico">
45
+
36
46
  </head>
37
- <body id='user_view' class='atome' oncontextmenu="return false;"></body>
47
+ <body id='user_view' class='atome' oncontextmenu="return false;">
48
+ </body>
38
49
  <script src='js/application.js' defer></script>
50
+
39
51
  </html>
@@ -1,4 +1,4 @@
1
- const atomeJS = Object.assign(atomeAnimate,atomeDrag,atomeFile,atomeSort, atomeTime, atomeVideo);
1
+ const atomeJS = Object.assign(atomeAnimate,atomeCommunication,atomeDrag,atomeDrop,atomeFile,atomeSort, atomeTime, atomeVideo);
2
2
  // This const is used to store and get all atome created canvas by id
3
3
  const Atome_canvas={}
4
4
  // // class AtomeDrag {
@@ -1,6 +1,6 @@
1
1
  const atomeAnimate = {
2
2
 
3
- animate: function(particle_found, duration,damping_ratio,ease, mass, repeat,stiffness, velocity,
3
+ animate: function(particle_found, duration,damping_ratio,ease, mass, repeat,stiffness, velocity,
4
4
  start_value, end_value, atome_id, atome_found,atome_hash,original_particle,animation_atome) {
5
5
  // console.log(start_value)
6
6
 
@@ -0,0 +1,40 @@
1
+ const atomeCommunication = {
2
+ controller_sender: function (msg) {
3
+ var json_msg = JSON.parse(msg);
4
+
5
+ if (window.webkit) {
6
+ try {
7
+ window.webkit.messageHandlers.toggleMessageHandler.postMessage(json_msg);
8
+ } catch (error) {
9
+ console.log('no server, unable to post message')
10
+ }
11
+
12
+ } else {
13
+ try {
14
+ window.chrome.webview.postMessage(json_msg);
15
+ } catch (error) {
16
+ console.log('no server, unable to post message')
17
+ }
18
+ }
19
+ },
20
+ controller_listener: function () {
21
+ if (window.webkit) {
22
+ try {
23
+ ///
24
+ } catch (error) {
25
+ console.log('no server, unable to receive message')
26
+ }
27
+ } else {
28
+
29
+ try {
30
+ window.chrome.webview.addEventListener('message', arg => {
31
+ Opal.Object.$response_listener(arg.data)
32
+ });
33
+ } catch (error) {
34
+ console.log('no server, unable to receive message')
35
+ }
36
+
37
+
38
+ }
39
+ },
40
+ }
@@ -1,6 +1,7 @@
1
1
  const atomeDrag = {
2
2
 
3
3
  drag: function (options, atome_id, atome) {
4
+
4
5
  let element = document.getElementById(atome_id)
5
6
  const position = {x: 0, y: 0}
6
7
  interact(element).draggable({
@@ -15,14 +16,41 @@ const atomeDrag = {
15
16
  atome.$drag_move_callback(event.pageX, event.pageY, event.rect.left, event.rect.top);
16
17
 
17
18
  if (options === true) {
18
- event.target.style.transform =
19
- event.target.style.transform = 'translate(' + position.x + 'px, ' + position.y + 'px)'
19
+ target = event.target
20
+ var x = (parseFloat(target.getAttribute('data-x')) || 0) + event.dx
21
+ var y = (parseFloat(target.getAttribute('data-y')) || 0) + event.dy
22
+
23
+ // translate the element
24
+ target.style.transform = 'translate(' + x + 'px, ' + y + 'px)'
25
+
26
+ // update the position attributes
27
+ target.setAttribute('data-x', x)
28
+ target.setAttribute('data-y', y)
29
+
30
+
20
31
  }
21
32
 
22
33
  },
23
34
  end(event) {
24
- atome.$drag_end_callback(event.pageX, event.pageY, event.rect.left, event.rect.top);
25
35
 
36
+ // We remove the translate and update the position of the atome
37
+
38
+ const transformValue = window.getComputedStyle(element).getPropertyValue('transform');
39
+ const matrix = transformValue.match(/^matrix\(([^\(]*)\)$/);
40
+ const transformData = matrix ? matrix[1].split(', ') : null;
41
+ const translateX = transformData ? parseFloat(transformData[4]) : 0;
42
+ const translateY = transformData ? parseFloat(transformData[5]) : 0;
43
+ const positionLeft = element.offsetLeft + translateX;
44
+ const positionTop = element.offsetTop + translateY;
45
+
46
+ element.style.left = positionLeft+ 'px';
47
+ element.style.top = positionTop + 'px';
48
+ // we remove the transform tag
49
+ element.style.transform = '';
50
+ // now we reset the interactJS
51
+ element.setAttribute('data-x', 0)
52
+ element.setAttribute('data-y', 0)
53
+ atome.$drag_end_callback(event.pageX, event.pageY, positionLeft, positionTop);
26
54
 
27
55
  },
28
56
  }
@@ -47,6 +75,15 @@ const atomeDrag = {
47
75
 
48
76
  remove: function (options, atome_id, _atome) {
49
77
  let element = document.getElementById(atome_id)
78
+ // now we reset the position
79
+ var position = element.getBoundingClientRect();
80
+ var transform = element.style.transform;
81
+ var newTransform = transform.replace(/translate\([^\)]*\)/g, "");
82
+ element.style.transform = newTransform;
83
+ element.style.left = position.left + "px";
84
+ element.style.top = position.top + "px";
85
+
86
+
50
87
  interact(element).draggable(options);
51
88
  },
52
89
 
@@ -0,0 +1,12 @@
1
+ const atomeDrop = {
2
+ drop: function (options, atome_id, atome) {
3
+
4
+ // internal drop cf a div dropped on a div
5
+ let element = document.getElementById(atome_id)
6
+ mouse_interaction(element,atome)
7
+
8
+ file_drop(atome_id,atome);
9
+ }
10
+
11
+ }
12
+
@@ -0,0 +1,166 @@
1
+
2
+ function mouse_interaction(element, atome){
3
+ interact(element).dropzone({
4
+ listeners: {
5
+ dragenter(event) {
6
+
7
+ atome.$enter_action_callback(Opal.hash({id: event.relatedTarget.id}));
8
+ // console.log(event)
9
+ // event.relatedTarget.textContent = 'Dropped'
10
+ },
11
+ dragleave(event) {
12
+ atome.$leave_action_callback(Opal.hash({id: event.relatedTarget.id}));
13
+ // event.relatedTarget.textContent = 'Dropped'
14
+ },
15
+ dropactivate: function (event) {
16
+ // add active dropzone feedback
17
+ // event.target.classList.add('drop-active')
18
+ },
19
+ drop(event) {
20
+ // console.log(event)
21
+ atome.$drop_action_callback(Opal.hash({id: event.relatedTarget.id}));
22
+ // event.relatedTarget.textContent = 'Dropped'
23
+ },
24
+ dropdeactivate: function (event) {
25
+ // remove active dropzone feedback
26
+ // event.target.classList.remove('drop-active')
27
+ // event.target.classList.remove('drop-target')
28
+ }
29
+ // dropdeactivate: function (event) {
30
+ // // remove active dropzone feedback
31
+ // // event.target.classList.remove('drop-active')
32
+ // // event.target.classList.remove('drop-target')
33
+ // }
34
+ // start(event) {
35
+ // console.log("satring")
36
+ // atome.$drag_action_callback(event.pageX, event.pageY, event.rect.left, event.rect.top);
37
+ // },
38
+ // move(event) {
39
+ // console.log("0000")
40
+ // position.x += event.dx
41
+ // position.y += event.dy
42
+ // // we feed the callback method below
43
+ // atome.$drag_action_callback(event.pageX, event.pageY, event.rect.left, event.rect.top);
44
+ //
45
+ // if (options === true) {
46
+ // event.target.style.transform =
47
+ // event.target.style.transform = 'translate(' + position.x + 'px, ' + position.y + 'px)'
48
+ // }
49
+ //
50
+ // },
51
+ // end(event) {
52
+ // console.log("endinfring")
53
+ //
54
+ // atome.$drag_action_callback(event.pageX, event.pageY, event.rect.left, event.rect.top);
55
+ //
56
+ //
57
+ // },
58
+ }
59
+ })
60
+ }
61
+
62
+
63
+ function file_drop(atome_id, atome){
64
+ const dropzone = document.querySelector('#'+atome_id)
65
+ dropzone.addEventListener('dragover', evt => evt.preventDefault())
66
+ dropzone.addEventListener('drop', async evt => {
67
+ evt.preventDefault()
68
+ const files = await window.getFilesFromDataTransferItems(evt.dataTransfer.items)
69
+ for (const file of files) {
70
+ const reader = new FileReader();
71
+ reader.readAsDataURL(file);
72
+ reader.onloadend = function () {
73
+ const base64data = reader.result;
74
+ let type_found = file.type.split('/')[0]
75
+ atome.$drop_action_callback(Opal.hash({path: file.filepath,type: type_found,size: file.size,data: base64data}));
76
+ }
77
+ }
78
+ })
79
+
80
+
81
+ async function getFilesFromDataTransferItems (dataTransferItems, options = { raw: false }) {
82
+ const checkErr = (err) => {
83
+ if (getFilesFromDataTransferItems.didShowInfo) return
84
+ if (err.name !== 'EncodingError') return
85
+ getFilesFromDataTransferItems.didShowInfo = true
86
+ const infoMsg = `${err.name} occured within datatransfer-files-promise module\n`
87
+ + `Error message: "${err.message}"\n`
88
+ + 'Try serving html over http if currently you are running it from the filesystem.'
89
+ console.warn(infoMsg)
90
+ }
91
+
92
+ const readFile = (entry, path = '') => {
93
+ return new Promise((resolve, reject) => {
94
+ entry.file(file => {
95
+ if (!options.raw) file.filepath = path + file.name // save full path
96
+
97
+ resolve(file)
98
+ }, (err) => {
99
+ checkErr(err)
100
+ reject(err)
101
+ })
102
+ })
103
+ }
104
+
105
+ const dirReadEntries = (dirReader, path) => {
106
+ return new Promise((resolve, reject) => {
107
+ dirReader.readEntries(async entries => {
108
+ let files = []
109
+ for (let entry of entries) {
110
+ const itemFiles = await getFilesFromEntry(entry, path)
111
+ // console.log(itemFiles)
112
+ files = files.concat(itemFiles)
113
+ }
114
+ resolve(files)
115
+ }, (err) => {
116
+ checkErr(err)
117
+ reject(err)
118
+ })
119
+ })
120
+ }
121
+
122
+ const readDir = async (entry, path) => {
123
+ const dirReader = entry.createReader()
124
+ const newPath = path + entry.name + '/'
125
+ let files = []
126
+ let newFiles
127
+ do {
128
+ newFiles = await dirReadEntries(dirReader, newPath)
129
+ files = files.concat(newFiles)
130
+ } while (newFiles.length > 0)
131
+ return files
132
+ }
133
+
134
+ const getFilesFromEntry = async (entry, path = '') => {
135
+ if (entry.isFile) {
136
+ const file = await readFile(entry, path)
137
+ return [file]
138
+ }
139
+ if (entry.isDirectory) {
140
+ const files = await readDir(entry, path)
141
+ return files
142
+ }
143
+ // throw new Error('Entry not isFile and not isDirectory - unable to get files')
144
+ }
145
+
146
+ let files = []
147
+ let entries = []
148
+
149
+ // Pull out all entries before reading them
150
+ for (let i = 0, ii = dataTransferItems.length; i < ii; i++) {
151
+ entries.push(dataTransferItems[i].webkitGetAsEntry())
152
+ }
153
+
154
+ // Recursively read through all entries
155
+ for (let entry of entries) {
156
+ const newFiles = await getFilesFromEntry(entry)
157
+ files = files.concat(newFiles)
158
+ }
159
+
160
+ return files
161
+ }
162
+
163
+ if (this.window && this === this.window) this.getFilesFromDataTransferItems = getFilesFromDataTransferItems
164
+ else module.exports.getFilesFromDataTransferItems = getFilesFromDataTransferItems
165
+
166
+ }
@@ -1,7 +1,12 @@
1
1
  const atomeFile = {
2
- reader: function (file, atome, proc) {
2
+
3
+
4
+ reader: function(file, atome, proc) {
3
5
  fetch('medias/' + file)
4
6
  .then(response => response.text())
5
7
  .then(text => atome.$read_callback(text, proc))
6
8
  }
9
+
7
10
  }
11
+
12
+
@@ -0,0 +1,43 @@
1
+ // const atomeOver = {
2
+ //
3
+ // over_enter: function (atome_id, atome, proc_passed, state) {
4
+ // let element = document.getElementById(atome_id)
5
+ // // let dropzone = document.getElementById('dropzone');
6
+ // element.addEventListener('dragover', handleDragOver);
7
+ //
8
+ // function handleDragOver(evt) {
9
+ // evt.preventDefault();
10
+ // if (state == 'enter') {
11
+ // atome.$enter_action_callback(proc_passed);
12
+ // state = false
13
+ // }
14
+ //
15
+ // }
16
+ //
17
+ // // mouse_interaction(element, atome)
18
+ //
19
+ //
20
+ // }
21
+ // // ,
22
+ // // over_leave: function (atome_id, atome, proc_passed, state) {
23
+ // // let element = document.getElementById(atome_id)
24
+ // // // let dropzone = document.getElementById('dropzone');
25
+ // // element.addEventListener('dragover', handleDragOver);
26
+ // //
27
+ // // function handleDragOver(evt) {
28
+ // // evt.preventDefault();
29
+ // // if (state == 'leave') {
30
+ // // atome.$leave_action_callback(proc_passed);
31
+ // // state = false
32
+ // // }
33
+ // //
34
+ // // }
35
+ // //
36
+ // // // mouse_interaction(element, atome)
37
+ // //
38
+ // //
39
+ // // },
40
+ //
41
+ //
42
+ // }
43
+ //
@@ -0,0 +1,63 @@
1
+ ######### demos
2
+ # we create a code container
3
+ element({id: :code_container, data: :empty})
4
+ puts "Attention this method only work with a server due to security restriction "
5
+ demo_container = grab('intuition').box({id: :demo_container,left: 0, overflow: :scroll, height: 567})
6
+ clearer = grab('intuition').circle({top: 3, left: 3, width: 39, height: 39, color: :orange, id: :debugger})
7
+ view_code = grab('intuition').circle({top: 3, left: 99, width: 39, height: 39, color: :red, id: :clearer})
8
+ # view=grab(:view)
9
+ view_code.touch(true) do
10
+ code=grab(:code_container).data
11
+ grab(:view).text({ data: code, width: :auto, height: 333, left: :auto, depth: 33, right: 0, overflow: :scroll })
12
+ end
13
+
14
+ clearer.touch(true) do
15
+ grab(:view).clear(true)
16
+ # atomes_found=[]
17
+ # Universe.atomes.each do |atome_id_found, _atome_content_found|
18
+ # atomes_found << atome_id_found
19
+ # end
20
+ end
21
+
22
+
23
+
24
+ context=grab(:view)
25
+ demo_container.read('rubies/demos_list.rb') do |demos_found|
26
+ # we eval the demo list
27
+ eval demos_found
28
+ demos_list.each_with_index do |demo, index|
29
+ current_demo=demo_container.text ({ data: demo, top: 16*index, left: 12, visual: {size: 12} })
30
+ current_demo.touch(true) do
31
+ #TODO : create a ruby method for console clear
32
+ `console.clear()`
33
+ puts atome_infos
34
+ puts "current demo: #{demo}"
35
+ context.clear(true)
36
+ # atomes_attached=context.attached
37
+ users_atomes=[]
38
+ Universe.atomes.each do |k, _v|
39
+ users_atomes << k
40
+ end
41
+
42
+ # puts "=> before > atomes attached : #{atomes_attached}"
43
+ # puts "==-> before > users_atomes : #{users_atomes}"
44
+
45
+ # we delete/clear the prev scene
46
+ # atomes_attached.each do |atome_id_found|
47
+ # unless atome_id_found == :view_color
48
+ # atome_found=grab(atome_id_found)
49
+ # atome_found.delete(true) if atome_found
50
+ # end
51
+ # end
52
+ # we eval the demo content
53
+ demo_container.read('rubies/examples/'+demo) do |demo_requested|
54
+ grab(:view).eval demo_requested
55
+ grab(:code_container).data(demo_requested)
56
+ end
57
+ # puts "=> after >atomes attached : #{atomes_attached}"
58
+ # puts "==-> after > users_atomes : #{users_atomes}"
59
+
60
+
61
+ end
62
+ end
63
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  my_video = Atome.new(
4
- video: { renderers: [:browser], id: :video1, type: :video, parents: [:view],
4
+ video: { renderers: [:browser], id: :video1, type: :video, attach: [:view],
5
5
  path: './medias/videos/avengers.mp4', left: 33, top: 33, width: 777
6
6
  }
7
7
  )
@@ -5,7 +5,7 @@ bb.color(:orange)
5
5
  box({ id: :my_box, drag: true })
6
6
  c = circle({ id: :the_circle, left: 222, drag: { move: true, inertia: true, lock: :start } })
7
7
  c.shadow({ renderers: [:browser], id: :shadow2, type: :shadow,
8
- parents: [:the_circle],
8
+ attach: [:the_circle],
9
9
  left: 3, top: 9, blur: 19,
10
10
  red: 0, green: 0, blue: 0, alpha: 1
11
11
  })
@@ -9,7 +9,7 @@ Atome.new(
9
9
  )
10
10
 
11
11
  Atome.new(
12
- shape: { type: :color, renderers: [:browser], id: :c315, type: :color, attach: [:the_shape],
12
+ shape: { type: :color, renderers: [:browser], id: :c315, attach: [:the_shape],
13
13
  red: 0.3, green: 1, blue: 0.6, alpha: 1 }
14
14
 
15
15
  )
@@ -1,15 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  b=box({id: :c315})
4
- circle({id: :circle_12, top: 0,drag: true})
4
+ circle({id: :c_12, top: 0,drag: true})
5
5
 
6
- b.attach([:circle_12])
6
+ b.attach([:c_12])
7
7
 
8
- circle({ id: :circle_123, color: :cyan, left: 233, drag: true })
9
- box({ id: :box_1, left: 333 })
10
- bb=box({top: 99})
11
- grab(:box_1).attach([:circle_123])
12
- circle_123_color= grab(:circle_123).color[0]
13
- grab(circle_123_color).attach([:box_1])
14
- bb.attach([:box_1])
15
- grab(:c315).attach([:circle_12])
8
+ circle({ id: :c_123, color: :cyan, left: 233, drag: true })
9
+ box({ id: :b_1, left: 333, drag: true })
10
+ bb=box({top: 99, drag: true})
11
+ grab(:b_1).attach([:c_123])
12
+ circle_123_color= grab(:c_123).color[0]
13
+ grab(circle_123_color).attach([:b_1])
14
+ bb.attach([:b_1])
15
+ grab(:c315).attach([:c_12])
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
-
3
- color({ red: 1, green: 0.6, blue: 0.6, id: :active_color })
4
- color( { red: 0.3, green: 0.3, blue: 0.3, id: :inactive_color } )
2
+ grab(:user_view).color({ red: 1, green: 0.6, blue: 0.6, id: :active_color })
3
+ grab(:user_view).color( { red: 0.3, green: 0.3, blue: 0.3, id: :inactive_color } )
5
4
 
6
5
  b=box({left: 99})
7
6
  wait 1 do
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+ # batch
3
+ b=box({ id: :b1 })
4
+ b.box({ id: :b2, left: 220 })
5
+ b.box({ id: :b3, left: 340 })
6
+ b.batch([:b2, :b3])
7
+ # puts "----- batch ------"
8
+ # puts "=> the batch found is #{a}"
9
+ # p a.batch.value
10
+ b.batch.color(:red).rotate(33)
11
+ b.batch.each do |el|
12
+ el.height(77).blur(9)
13
+ end
14
+ wait 1 do
15
+ puts b.batch.top(0)
16
+ end
17
+
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- b = box({ id: :the_box, left: 99, top: 99 })
4
- b.blur(2)
3
+ b = box({ id: :the_box, left: 199, top: 99 })
4
+ b.blur(7)
@@ -8,9 +8,9 @@ a = box({ id: :my_box, left: 333 }) do |p|
8
8
  end
9
9
 
10
10
  b = Atome.new(
11
- { shape: { renderers: [:browser], id: :view_test, type: :shape, parents: [:view],
11
+ { shape: { renderers: [:browser], id: :view_test, type: :shape, attach: [:view],
12
12
  left: 0, width: 90, top: 0, height: 90, overflow: :auto,
13
- color: { renderers: [:browser], id: :view_test_color, type: :color, parents: [:view_test],
13
+ color: { renderers: [:browser], id: :view_test_color, type: :color, attach: [:view_test],
14
14
  red: 1, green: 0.15, blue: 0.15, alpha: 1 } } }
15
15
  ) do |p|
16
16
  puts "the param pass to the atome is: #{p}"
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- a=Atome.new(code: { type: :code, renderers: [:headless], parents: [] }) do |params_found|
3
+ a=Atome.new(code: { type: :code, renderers: [:headless], attach: [] }) do |params_found|
4
4
  puts "the param is #{params_found}"
5
5
  end
6
6
  a.run(:super)
@@ -52,15 +52,15 @@ end
52
52
 
53
53
 
54
54
  wait 10 do
55
- d=Atome.new({ color: { renderers: [:browser], id: :col1, type: :color, parents: [],
55
+ d=Atome.new({ color: { renderers: [:browser], id: :col1, type: :color, attach: [],
56
56
  left: 33, top: 66, red: 1, green: 0.15, blue: 0.7, alpha: 1 } })
57
57
 
58
- col_2 = Atome.new({ color: { renderers: [:browser], id: :col2, type: :color, parents: [],
58
+ col_2 = Atome.new({ color: { renderers: [:browser], id: :col2, type: :color, attach: [],
59
59
  left: 33, top: 66, red: 0, green: 0.15, blue: 0.7, alpha: 1 } })
60
60
 
61
61
  puts d
62
62
  e=Atome.new(
63
- shape: { type: :shape, renderers: [:browser], id: :shaped, parents: [:view], attached: [:col1],
63
+ shape: { type: :shape, renderers: [:browser], id: :shaped, attach: [:view], attached: [:col1],
64
64
  left: 199, top: 99,
65
65
  width: 66, height: 66
66
66
  }