uki 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. data/VERSION +1 -1
  2. data/frameworks/uki/README.rdoc +6 -15
  3. data/frameworks/uki/examples/core-examples/aristo/aristo.js +59 -0
  4. data/frameworks/uki/examples/core-examples/attachment/attachment.js +18 -0
  5. data/frameworks/uki/examples/core-examples/controls/controls.js +59 -0
  6. data/frameworks/uki/examples/core-examples/dnd/dnd.js +70 -0
  7. data/frameworks/uki/examples/core-examples/flow/flow.js +41 -0
  8. data/frameworks/uki/examples/core-examples/list/list.js +78 -0
  9. data/frameworks/uki/examples/core-examples/popup/popup.js +41 -0
  10. data/frameworks/uki/examples/core-examples/resizeToContents/resizeToContents.js +34 -0
  11. data/frameworks/uki/examples/core-examples/scrollPane/scrollPane.js +28 -0
  12. data/frameworks/uki/examples/core-examples/slider/slider.js +23 -0
  13. data/frameworks/uki/examples/core-examples/splitPane/splitPane.js +35 -0
  14. data/frameworks/uki/examples/core-examples/splitPaneExtended/splitPaneExtended.js +39 -0
  15. data/frameworks/uki/examples/core-examples/stress/stress.js +33 -0
  16. data/frameworks/uki/examples/core-examples/table/library.js +1 -0
  17. data/frameworks/uki/examples/core-examples/table/searchable.js +71 -0
  18. data/frameworks/uki/examples/core-examples/table/table.js +92 -0
  19. data/frameworks/uki/examples/core-examples/toolbar/icon.png +0 -0
  20. data/frameworks/uki/examples/core-examples/toolbar/toolbar.js +44 -0
  21. data/frameworks/uki/examples/core-examples/twitter/bubble.png +0 -0
  22. data/frameworks/uki/examples/core-examples/twitter/i/bubble-c.png +0 -0
  23. data/frameworks/uki/examples/core-examples/twitter/i/bubble-h.png +0 -0
  24. data/frameworks/uki/examples/core-examples/twitter/i/bubble-m.png +0 -0
  25. data/frameworks/uki/examples/core-examples/twitter/i/bubble-v.png +0 -0
  26. data/frameworks/uki/examples/core-examples/twitter/i/loading.gif +0 -0
  27. data/frameworks/uki/examples/core-examples/twitter/tweets.json +1 -0
  28. data/frameworks/uki/examples/core-examples/twitter/twitter.js +175 -0
  29. data/frameworks/uki/examples/core-examples/wave/contacts.json +1 -0
  30. data/frameworks/uki/examples/core-examples/wave/i/body/normal-m.png +0 -0
  31. data/frameworks/uki/examples/core-examples/wave/i/body/normal.png +0 -0
  32. data/frameworks/uki/examples/core-examples/wave/i/button/a-down-m.png +0 -0
  33. data/frameworks/uki/examples/core-examples/wave/i/button/a-down-v.gif +0 -0
  34. data/frameworks/uki/examples/core-examples/wave/i/button/a-down-v.png +0 -0
  35. data/frameworks/uki/examples/core-examples/wave/i/button/a-down.png +0 -0
  36. data/frameworks/uki/examples/core-examples/wave/i/button/a-normal-m.png +0 -0
  37. data/frameworks/uki/examples/core-examples/wave/i/button/a-normal-v.gif +0 -0
  38. data/frameworks/uki/examples/core-examples/wave/i/button/a-normal-v.png +0 -0
  39. data/frameworks/uki/examples/core-examples/wave/i/button/a-normal.png +0 -0
  40. data/frameworks/uki/examples/core-examples/wave/i/button/down-m.png +0 -0
  41. data/frameworks/uki/examples/core-examples/wave/i/button/down-v.gif +0 -0
  42. data/frameworks/uki/examples/core-examples/wave/i/button/down-v.png +0 -0
  43. data/frameworks/uki/examples/core-examples/wave/i/button/down.png +0 -0
  44. data/frameworks/uki/examples/core-examples/wave/i/button/normal-m.png +0 -0
  45. data/frameworks/uki/examples/core-examples/wave/i/button/normal-v.gif +0 -0
  46. data/frameworks/uki/examples/core-examples/wave/i/button/normal-v.png +0 -0
  47. data/frameworks/uki/examples/core-examples/wave/i/button/normal.png +0 -0
  48. data/frameworks/uki/examples/core-examples/wave/i/button/plus-big-down-m.gif +0 -0
  49. data/frameworks/uki/examples/core-examples/wave/i/button/plus-big-down-m.png +0 -0
  50. data/frameworks/uki/examples/core-examples/wave/i/button/plus-big-down.png +0 -0
  51. data/frameworks/uki/examples/core-examples/wave/i/button/plus-big-normal-m.gif +0 -0
  52. data/frameworks/uki/examples/core-examples/wave/i/button/plus-big-normal-m.png +0 -0
  53. data/frameworks/uki/examples/core-examples/wave/i/button/plus-big-normal.png +0 -0
  54. data/frameworks/uki/examples/core-examples/wave/i/button/plus-down-m.gif +0 -0
  55. data/frameworks/uki/examples/core-examples/wave/i/button/plus-down-m.png +0 -0
  56. data/frameworks/uki/examples/core-examples/wave/i/button/plus-down.png +0 -0
  57. data/frameworks/uki/examples/core-examples/wave/i/button/plus-normal-m.gif +0 -0
  58. data/frameworks/uki/examples/core-examples/wave/i/button/plus-normal-m.png +0 -0
  59. data/frameworks/uki/examples/core-examples/wave/i/button/plus-normal.png +0 -0
  60. data/frameworks/uki/examples/core-examples/wave/i/button/search-button-normal-m.png +0 -0
  61. data/frameworks/uki/examples/core-examples/wave/i/button/search-button-normal.png +0 -0
  62. data/frameworks/uki/examples/core-examples/wave/i/button/toolbar-button-down-m.png +0 -0
  63. data/frameworks/uki/examples/core-examples/wave/i/button/toolbar-button-down.png +0 -0
  64. data/frameworks/uki/examples/core-examples/wave/i/button/toolbar-button-normal-v.gif +0 -0
  65. data/frameworks/uki/examples/core-examples/wave/i/button/toolbar-button-normal-v.png +0 -0
  66. data/frameworks/uki/examples/core-examples/wave/i/button/toolbar-button-normal.png +0 -0
  67. data/frameworks/uki/examples/core-examples/wave/i/icons-c/drawer.png +0 -0
  68. data/frameworks/uki/examples/core-examples/wave/i/icons-c/inbox.png +0 -0
  69. data/frameworks/uki/examples/core-examples/wave/i/icons-c/pencil.png +0 -0
  70. data/frameworks/uki/examples/core-examples/wave/i/icons-c/skeleton.png +0 -0
  71. data/frameworks/uki/examples/core-examples/wave/i/icons-c/trash.png +0 -0
  72. data/frameworks/uki/examples/core-examples/wave/i/icons-c/who.png +0 -0
  73. data/frameworks/uki/examples/core-examples/wave/i/icons/blue.png +0 -0
  74. data/frameworks/uki/examples/core-examples/wave/i/icons/dots.png +0 -0
  75. data/frameworks/uki/examples/core-examples/wave/i/icons/download.png +0 -0
  76. data/frameworks/uki/examples/core-examples/wave/i/icons/drawer.png +0 -0
  77. data/frameworks/uki/examples/core-examples/wave/i/icons/eye-closed.png +0 -0
  78. data/frameworks/uki/examples/core-examples/wave/i/icons/eye.png +0 -0
  79. data/frameworks/uki/examples/core-examples/wave/i/icons/folder.png +0 -0
  80. data/frameworks/uki/examples/core-examples/wave/i/icons/nosound.png +0 -0
  81. data/frameworks/uki/examples/core-examples/wave/i/icons/play.png +0 -0
  82. data/frameworks/uki/examples/core-examples/wave/i/icons/reply.png +0 -0
  83. data/frameworks/uki/examples/core-examples/wave/i/icons/skeleton.png +0 -0
  84. data/frameworks/uki/examples/core-examples/wave/i/icons/sprite-m.gif +0 -0
  85. data/frameworks/uki/examples/core-examples/wave/i/icons/sprite-m.png +0 -0
  86. data/frameworks/uki/examples/core-examples/wave/i/icons/sprite.png +0 -0
  87. data/frameworks/uki/examples/core-examples/wave/i/icons/trash.png +0 -0
  88. data/frameworks/uki/examples/core-examples/wave/i/icons/unknown.png +0 -0
  89. data/frameworks/uki/examples/core-examples/wave/i/panel/blue-c.gif +0 -0
  90. data/frameworks/uki/examples/core-examples/wave/i/panel/blue-c.png +0 -0
  91. data/frameworks/uki/examples/core-examples/wave/i/panel/blue-h.gif +0 -0
  92. data/frameworks/uki/examples/core-examples/wave/i/panel/blue-h.png +0 -0
  93. data/frameworks/uki/examples/core-examples/wave/i/panel/blue-m.png +0 -0
  94. data/frameworks/uki/examples/core-examples/wave/i/panel/blue-v.gif +0 -0
  95. data/frameworks/uki/examples/core-examples/wave/i/panel/blue-v.png +0 -0
  96. data/frameworks/uki/examples/core-examples/wave/i/panel/blue.png +0 -0
  97. data/frameworks/uki/examples/core-examples/wave/i/panel/white-c.gif +0 -0
  98. data/frameworks/uki/examples/core-examples/wave/i/panel/white-c.png +0 -0
  99. data/frameworks/uki/examples/core-examples/wave/i/panel/white-h.gif +0 -0
  100. data/frameworks/uki/examples/core-examples/wave/i/panel/white-h.png +0 -0
  101. data/frameworks/uki/examples/core-examples/wave/i/panel/white-m.png +0 -0
  102. data/frameworks/uki/examples/core-examples/wave/i/panel/white-v.gif +0 -0
  103. data/frameworks/uki/examples/core-examples/wave/i/panel/white-v.png +0 -0
  104. data/frameworks/uki/examples/core-examples/wave/i/panel/white.png +0 -0
  105. data/frameworks/uki/examples/core-examples/wave/i/popup/normal-c.gif +0 -0
  106. data/frameworks/uki/examples/core-examples/wave/i/popup/normal-c.png +0 -0
  107. data/frameworks/uki/examples/core-examples/wave/i/popup/normal-h.gif +0 -0
  108. data/frameworks/uki/examples/core-examples/wave/i/popup/normal-h.png +0 -0
  109. data/frameworks/uki/examples/core-examples/wave/i/popup/normal-m.png +0 -0
  110. data/frameworks/uki/examples/core-examples/wave/i/popup/normal-v.gif +0 -0
  111. data/frameworks/uki/examples/core-examples/wave/i/popup/normal-v.png +0 -0
  112. data/frameworks/uki/examples/core-examples/wave/i/popup/normal.png +0 -0
  113. data/frameworks/uki/examples/core-examples/wave/i/searchField/focus-m.png +0 -0
  114. data/frameworks/uki/examples/core-examples/wave/i/searchField/focus-v.gif +0 -0
  115. data/frameworks/uki/examples/core-examples/wave/i/searchField/focus-v.png +0 -0
  116. data/frameworks/uki/examples/core-examples/wave/i/searchField/focus.png +0 -0
  117. data/frameworks/uki/examples/core-examples/wave/i/searchField/normal-m.png +0 -0
  118. data/frameworks/uki/examples/core-examples/wave/i/searchField/normal-v.gif +0 -0
  119. data/frameworks/uki/examples/core-examples/wave/i/searchField/normal-v.png +0 -0
  120. data/frameworks/uki/examples/core-examples/wave/i/searchField/normal.png +0 -0
  121. data/frameworks/uki/examples/core-examples/wave/i/toolbar/normal-m.png +0 -0
  122. data/frameworks/uki/examples/core-examples/wave/i/toolbar/normal.png +0 -0
  123. data/frameworks/uki/examples/core-examples/wave/voloko.jpg +0 -0
  124. data/frameworks/uki/examples/core-examples/wave/wave-theme.js +269 -0
  125. data/frameworks/uki/examples/core-examples/wave/wave.html +29 -0
  126. data/frameworks/uki/examples/core-examples/wave/wave.js +102 -0
  127. data/frameworks/uki/examples/core-examples/wave/waves.json +1 -0
  128. data/frameworks/uki/examples/css/examples.css +23 -0
  129. data/frameworks/uki/examples/css/index.css +0 -0
  130. data/frameworks/uki/examples/css/reset.css +43 -0
  131. data/frameworks/uki/examples/more-examples/radioButton/radioButton.js +17 -0
  132. data/frameworks/uki/examples/more-examples/splitTable/library.js +1 -0
  133. data/frameworks/uki/examples/more-examples/splitTable/searchable.js +71 -0
  134. data/frameworks/uki/examples/more-examples/splitTable/splitTable.js +98 -0
  135. data/frameworks/uki/examples/more-examples/toggleButton/toggleButton.js +14 -0
  136. data/frameworks/uki/examples/more-examples/treeList/i/arrows.png +0 -0
  137. data/frameworks/uki/examples/more-examples/treeList/treeList.js +35 -0
  138. data/frameworks/uki/examples/views/example.haml +8 -0
  139. data/frameworks/uki/examples/views/exampleList.haml +24 -0
  140. data/frameworks/uki/server.rb +84 -0
  141. data/frameworks/uki/spec/support/spec.helper.js +37 -1
  142. data/frameworks/uki/src/uki-core/background/cssBox.js +1 -1
  143. data/frameworks/uki/src/uki-core/builder.js +15 -10
  144. data/frameworks/uki/src/uki-core/dom/dnd.js +2 -1
  145. data/frameworks/uki/src/uki-core/uki.js +1 -1
  146. data/frameworks/uki/src/uki-core/utils.js +10 -3
  147. data/frameworks/uki/src/uki-core/view/base.js +2 -2
  148. data/frameworks/uki/src/uki-theme/airport.js +14 -0
  149. data/frameworks/uki/src/uki-view/view/button.js +4 -6
  150. data/frameworks/uki/src/uki-view/view/label.js +3 -3
  151. data/frameworks/uki/src/uki-view/view/list.js +26 -16
  152. data/frameworks/uki/src/uki-view/view/slider.js +3 -3
  153. data/frameworks/uki/src/uki-view/view/splitPane.js +1 -1
  154. data/frameworks/uki/src/uki-view/view/table.js +3 -3
  155. data/frameworks/uki/src/uki-view/view/table/column.js +1 -1
  156. data/frameworks/uki/src/uki-view/view/textField.js +18 -7
  157. data/uki.gemspec +139 -6
  158. metadata +140 -7
  159. data/frameworks/uki/compiler.jar +0 -0
  160. data/frameworks/uki/run.rb +0 -2
  161. data/frameworks/uki/thin.yaml +0 -11
  162. data/frameworks/uki/uki.rb +0 -38
  163. data/frameworks/uki/uki.ru +0 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.1.1
@@ -9,9 +9,9 @@ It comes with a rich view-component library ranging from Sliders to Grids and Sp
9
9
 
10
10
  == All you have to know in 5 minutes
11
11
  1. Uki interfaces are created from Views the same way web pages are created from DOM nodes.
12
- Views even behave similar to DOM nodes. You can appendView, insertBefore, access parentView etc.
13
- panel.appendView(button)
14
- Examples of views: Slider, SplitPane or Table
12
+ Views even behave similar to DOM nodes. You can appendChild, insertBefore, access parent etc.
13
+ panel.appendChild(button)
14
+ Examples of views: Slider, SplitPane or Table (http://ukijs.org/examples/)
15
15
  2. View have attributes. You can read them by calling attrname() without params and write with
16
16
  attrname(newValue).
17
17
  label.text('Lorem') // set text to a label
@@ -43,7 +43,7 @@ It comes with a rich view-component library ranging from Sliders to Grids and Sp
43
43
  resources like images, styled dom nodes and backgrounds. You can find an example of one
44
44
  at http://github.com/voloko/uki/blob/master/src/uki-theme/airport.js
45
45
  9. If your adding uki to existing project then it is better to simply add
46
- <script src='http://static.ukijs.org/pkg/0.1.3/uki.gz.js'></script>
46
+ <script src='http://static.ukijs.org/pkg/0.2.0/uki.js'></script>
47
47
  to your pages and it will work. If you start a new one you might try
48
48
  uki-tools (http://github.com/voloko/uki-tools)
49
49
  10. See the available resources in Links section and have fun
@@ -63,13 +63,9 @@ It comes with a rich view-component library ranging from Sliders to Grids and Sp
63
63
  To install development server
64
64
  1. Install ruby http://ruby-lang.org
65
65
  2. Open terminal and run
66
- gem install rake sinatra
66
+ gem install uki
67
67
  cd PATH_TO_UKI
68
- 3. On windows run
69
- ruby run.rb
70
- On *nix
71
- rake start
72
- 4. http://127.0.0.1:21119/src/uki.cjs – should be a merged version of uki
68
+ uki run
73
69
 
74
70
  == Image path
75
71
  For older browsers uki loads images from server.
@@ -132,11 +128,6 @@ such as CSS selectors, events and attributes.
132
128
  If you've ever used
133
129
  jQuery, learning uki won't take long.
134
130
 
135
- == Specific
136
- Uki doesn't want to be a Jack-of-all-trades.
137
- It only does layout, but it does it well.
138
- You won't find any AJAX or data-storage-layer code here.
139
-
140
131
  == Programmable Layout
141
132
  HTML and CSS are great technologies,
142
133
  though you can't lay everything out with them.
@@ -0,0 +1,59 @@
1
+ /**
2
+ @example_title Controls (aristo)
3
+ @example_order 3100
4
+ @example_html
5
+ <style>body, html { overflow: hidden; margin: 0; padding: 0; }</style>
6
+ <div id="test" style="width: 90%; height: 300px;"></div>
7
+ <script src="/src/uki-theamless.cjs"></script>
8
+ <script src="/src/uki-theme/aristo.cjs"></script>
9
+ <script src="aristo.js"></script>
10
+ */
11
+
12
+
13
+ // controlls description
14
+ function views() {
15
+ return [
16
+ { view: 'Button', rect: '10 10 200 24', anchors: 'left top', text: 'focusable button!' },
17
+ { view: 'MultilineTextField', rect: '10 35 200 40', anchors: 'left top', value: 'textarea' },
18
+
19
+ { view: 'Checkbox', rect: '250 10 24 24', anchors: 'left top', name: 'probe' },
20
+ { view: 'Label', rect: '275 10 100 24', anchors: 'left top', html: 'Checkbox 1', selectable: false },
21
+ { view: 'Checkbox', rect: '250 35 24 24', anchors: 'left top', checked: true },
22
+ { view: 'Label', rect: '275 35 100 24', anchors: 'left top', text: 'Checkbox 2', selectable: false },
23
+
24
+ { view: 'Radio', rect: '720 10 24 24', anchors: 'left top', name: 'probe', group: 'radio_1' },
25
+ { view: 'Label', rect: '745 10 100 24', anchors: 'left top', html: 'Radio 1', selectable: false },
26
+ { view: 'Radio', rect: '720 35 24 24', anchors: 'left top', checked: true, group: 'radio_1' },
27
+ { view: 'Label', rect: '745 35 100 24', anchors: 'left top', text: 'Radio 2', selectable: false },
28
+
29
+ { view: 'TextField',rect: '400 10 100 24', anchors: 'left top', value: "Small input", placeholder: 'text' },
30
+ { view: 'Button', rect: '510 10 200 24', anchors: 'left top', text: 'button without focus!', focusable: false },
31
+ { view: 'TextField',rect: '820 10 100 33', anchors: 'right top', value: "Big input" },
32
+ { view: 'Slider', rect: '400 65 150 24', anchors: 'right top left width' }
33
+ ];
34
+ }
35
+
36
+ // page layout
37
+ uki(
38
+ { view: 'Box', rect: '0 0 1000 300', minSize: '980 0', anchors: 'top left right width', childViews: [
39
+ { view: 'Box', background: 'theme(panel)', rect: '0 0 1000 100', // controlls on panel background
40
+ anchors: 'top left right width', childViews: views() },
41
+ { view: 'Box', rect: '0 150 1000 100', anchors: 'top left right width', // controlls on page background
42
+ childViews: views() }
43
+ ]}
44
+ ).attachTo( document.getElementById('test'), '1000 300' );
45
+
46
+ // Bind alert to all buttons
47
+ uki('Button').bind('click', function() {
48
+ alert(uki('TextField').attr('value'));
49
+ });
50
+
51
+ // On slider move update last TextField
52
+ uki('Slider').bind('change', function() {
53
+ uki(this.parent()).find('> TextField:last').value(this.value())
54
+ });
55
+
56
+ // Make label work as labels in browser
57
+ uki('Label').click(function() {
58
+ if (this.prevView().checked) this.prevView().checked(!this.prevView().checked()).focus();
59
+ });
@@ -0,0 +1,18 @@
1
+ /**
2
+ @example_title Hello world
3
+ @example_order 1
4
+ @example_html
5
+ <div id='test' style='width: 50%; height: 100px; background: #EEE'>#test</div>
6
+ <script src="/src/uki.cjs"></script>
7
+ <script src="attachment.js"></script>
8
+ */
9
+
10
+ uki({
11
+ view: 'Button',
12
+ rect: '200 40 200 24',
13
+ text: 'uki is awesome!'
14
+ }).attachTo( document.getElementById('test'), '600 100' );
15
+
16
+ uki('Button[text^=uki]').bind('click', function() {
17
+ alert('Hello world!');
18
+ });
@@ -0,0 +1,59 @@
1
+ /**
2
+ @example_title Controls
3
+ @example_order 20
4
+ @example_html
5
+ <style>body, html { overflow: hidden; margin: 0; padding: 0; }</style>
6
+ <div id="test" style="width: 90%; height: 300px;"></div>
7
+ <script src="/src/uki.cjs"></script>
8
+ <script src="controls.js"></script>
9
+ */
10
+
11
+
12
+ // controlls description
13
+ function views() {
14
+ return [
15
+ { view: 'Button', rect: '10 10 200 24', anchors: 'left top', text: 'focusable button!' },
16
+ { view: 'MultilineTextField', rect: '10 35 200 40', anchors: 'left top', value: 'textarea' },
17
+
18
+ { view: 'Checkbox', rect: '250 10 24 24', anchors: 'left top', name: 'probe' },
19
+ { view: 'Label', rect: '275 10 100 24', anchors: 'left top', html: 'Checkbox 1' },
20
+ { view: 'Checkbox', rect: '250 35 24 24', anchors: 'left top', checked: true },
21
+ { view: 'Label', rect: '275 35 100 24', anchors: 'left top', text: 'Checkbox 2' },
22
+
23
+ { view: 'Radio', rect: '720 10 24 24', anchors: 'left top', name: 'probe', group: 'radio_1' },
24
+ { view: 'Label', rect: '745 10 100 24', anchors: 'left top', html: 'Radio 1' },
25
+ { view: 'Radio', rect: '720 35 24 24', anchors: 'left top', checked: true, group: 'radio_1' },
26
+ { view: 'Label', rect: '745 35 100 24', anchors: 'left top', text: 'Radio 2' },
27
+
28
+ { view: 'TextField',rect: '400 10 100 24', anchors: 'left top', value: "Small input", placeholder: 'text' },
29
+ { view: 'PasswordTextField',rect: '400 36 100 24', anchors: 'left top', value: "Small input", placeholder: 'text' },
30
+ { view: 'Button', rect: '510 10 200 24', anchors: 'left top', text: 'button without focus!', focusable: false },
31
+ { view: 'TextField',rect: '820 10 100 34', anchors: 'right top', value: "Big input" },
32
+ { view: 'Slider', rect: '400 65 150 24', anchors: 'right top left width' }
33
+ ];
34
+ }
35
+
36
+ // page layout
37
+ uki(
38
+ { view: 'Box', rect: '0 0 1000 300', minSize: '980 0', anchors: 'top left right width', childViews: [
39
+ { view: 'Box', background: 'theme(panel)', rect: '0 0 1000 100', // controlls on panel background
40
+ anchors: 'top left right width', childViews: views() },
41
+ { view: 'Box', rect: '0 150 1000 100', anchors: 'top left right width', // controlls on page background
42
+ childViews: views() }
43
+ ]}
44
+ ).attachTo( document.getElementById('test'), '1000 300' );
45
+
46
+ // Bind alert to all buttons
47
+ uki('Button').bind('click', function() {
48
+ alert(uki('TextField').attr('value'));
49
+ });
50
+
51
+ // On slider move update last TextField
52
+ uki('Slider').bind('change', function() {
53
+ uki(this.parent()).find('> TextField:last').value(this.value())
54
+ });
55
+
56
+ // Make label work as labels in browser
57
+ uki('Label').click(function() {
58
+ if (this.prevView().checked) this.prevView().checked(!this.prevView().checked()).focus();
59
+ });
@@ -0,0 +1,70 @@
1
+ /**
2
+ @example_title Drag and Drop
3
+ @example_order 400
4
+ @example_html
5
+ <style>body, html { margin: 0; padding: 0; overflow: hidden };</style>
6
+ <div id="draggable" draggable="true" unselectable="unselectable"
7
+ style="position:absolute;left:600px;top:50px;width:100px;height:100px;
8
+ line-height:100px;font-size:18px;background:#CCF;font-family:sans-serif;text-align:center;
9
+ -webkit-user-drag:element;-webkit-user-select:none;-moz-user-select:none">
10
+ draggable
11
+ </div>
12
+ <script src="/src/uki.cjs"></script>
13
+ <script src="dnd.js"></script>
14
+ */
15
+
16
+ uki([
17
+ { view: 'Label', rect: '350 10 100 20', anchors: 'left top', style: { fontSize: '14px' },
18
+ html: '&larr; Drag items from the list on the left or from &darr; the draggable div. <a href="http://github.com/voloko/ukijs.org/blob/master/examples/core-examples/dnd/dnd.js">Source</a>, <a href="http://blog.ukijs.org/2010/03/16/drag-and-drop-in-uki/">about</a> ' },
19
+ { view: 'ScrollableList', rect: '0 0 300 600', anchors: 'left top bottom', id: 'source',
20
+ draggable: true, textSelectable: false, multiselect: true },
21
+ { view: 'Label', rect: '350 50 150 150', anchors: 'left top', text: 'drop target',
22
+ style: { fontSize: '25px', textAlign: 'center' },
23
+ background: 'cssBox(border:2px dashed #CCC; background:#EEE)', name: 'target' },
24
+ { view: 'Label', rect: '350 250 150 150', anchors: 'left top', text: 'drop target',
25
+ style: { fontSize: '25px', textAlign: 'center' },
26
+ background: 'cssBox(border:2px dashed #CCC; background:#EEE)', name: 'target' }
27
+ ]).attachTo(window, '1000 600');
28
+
29
+ var data = [];
30
+ for (var i=0; i < 8000; i++) {
31
+ data[i] = 'Row ' + Math.random();
32
+ };
33
+ uki('#source List')
34
+ .data(data)
35
+ .dragstart(function(e) {
36
+ e.dataTransfer.setDragImage(uki({ view: 'Label', rect: '100 20', anchors: 'left top',
37
+ inset: '0 5', background: 'cssBox(border: 1px solid #CCC;background:#EEF)',
38
+ text: this.selectedIndexes().length + ' rows' })
39
+ , 10, 10);
40
+ e.dataTransfer.effectAllowed = 'copy';
41
+ e.dataTransfer.setData('text/plain', this.selectedRows().join('\n'));
42
+ }).parent().layout();
43
+
44
+
45
+ uki.dom.bind(document.getElementById('draggable'), 'dragstart', function(e) {
46
+ e.dataTransfer.setDragImage(uki.createElement('div', 'background:blue;width:20px;height:20px'), 5, 5);
47
+ e.dataTransfer.effectAllowed = 'copy';
48
+ e.dataTransfer.setData('text/plain', 'test');
49
+ });
50
+
51
+
52
+ uki('[name=target]')
53
+ .dragover(function(e) {
54
+ e.preventDefault();
55
+ e.dataTransfer.dropEffect = 'copy';
56
+ })
57
+ .dragenter(function(e) {
58
+ this.text('over');
59
+ })
60
+ .dragleave(function(e) {
61
+ this.text('drop target');
62
+ })
63
+ .drop(function(e) {
64
+ e.preventDefault();
65
+ this.text('droped');
66
+ alert(e.dataTransfer.getData('text/plain'))
67
+ setTimeout(uki.proxy(function() {
68
+ this.text('drop target');
69
+ }, this), 100)
70
+ });
@@ -0,0 +1,41 @@
1
+ /**
2
+ @example_title Vertical and Horizontal flows
3
+ @example_order 3062
4
+ @example_html
5
+ <script src="/src/uki.cjs"></script>
6
+ <script src="flow.js"></script>
7
+ */
8
+
9
+
10
+ // vertical flow with a single label on the left of the page
11
+ uki({ view: 'VFlow', rect: '10 10 100 0', anchors: 'left top', background: '#CCC', className: 'flow', childViews: [
12
+ { view: 'Label', rect: '0 0 100 100', anchors: 'left top', inset: '1 5', html: '<a href="#">Link 1</a>' }
13
+ ]}).attachTo(window, '100 100');
14
+
15
+ // horizontal flow with 2 labels at the top of the page
16
+ uki({ view: 'HFlow', rect: '120 10 0 100', anchors: 'left top', background: '#CCC', className: 'flow', childViews: [
17
+ { view: 'Label', rect: '0 0 100 20', anchors: 'left top', inset: '1 5', html: '<a href="#">Link 1</a>' },
18
+ { view: 'Label', rect: '0 0 100 20', anchors: 'left top', inset: '1 5', html: '<a href="#">Link 2</a>' }
19
+ ]}).attachTo(window, '100 100');
20
+
21
+ // append 10 labels with links to each flow
22
+ for (var i=1; i < 11; i++) {
23
+ var l = uki({ view: 'Label', rect: '0 0 100 20', anchors: 'left top', inset: '1 5', html: '<a href="#">Link ' + (i+1) + '</a>' });
24
+ uki('VFlow').append(l);
25
+ l = uki({ view: 'Label', rect: '0 0 100 20', anchors: 'left top', inset: '1 5', html: '<a href="#">Link ' + (i+1) + '</a>' });
26
+ uki('HFlow').append(l);
27
+ };
28
+
29
+ // resize to the number of labels appended and layout
30
+ uki('VFlow').resizeToContents('height').layout();
31
+ uki('HFlow').resizeToContents('width').layout();
32
+
33
+ // create button to remove items from vertical flow
34
+ uki({ view: 'Button', rect: '0 0 100 22', text: 'Remove' }).attachTo(window, '100 100').click(function() {
35
+ uki('VFlow').removeChild(uki('VFlow').childViews()[1]).resizeToContents('height').layout();
36
+ });
37
+
38
+ // create button to remove items from horizontal flow
39
+ uki({ view: 'Button', rect: '0 30 100 22', text: 'Remove from list 2'}).attachTo(window, '100 100').resizeToContents('width').layout().click(function() {
40
+ uki('HFlow').removeChild(uki('HFlow').childViews()[1]).resizeToContents('width').layout();
41
+ })
@@ -0,0 +1,78 @@
1
+ /**
2
+ @example_title List
3
+ @example_order 42
4
+ @example_html
5
+ <div id='test' style='width: 80%; height: 400px;'></div>
6
+ <script src="/src/uki.cjs"></script>
7
+ <script src="list.js"></script>
8
+ */
9
+
10
+ // pregenerate list data (30000k items)
11
+ var data = ['this is', '30000k long', 'list'];
12
+ for (var i=3; i < 30000; i++) {
13
+ data[i] = 'item #' + (i+1);
14
+ };
15
+
16
+ var p = uki(
17
+ { view: 'HSplitPane', rect: '1000 600', anchors: 'top left right bottom', handleWidth: 1,
18
+ leftMin: 200, rightMin: 400, handlePosition: 200,
19
+ leftChildViews: [ // scrollable list on the left
20
+ { view: 'ScrollPane', rect: '200 600', anchors: 'top left right bottom',
21
+ // with a wrapping box (test background and border)
22
+ childViews: { view: 'Box', rect: '10 10 180 900002', anchors: 'top left right', background: '#CCC',
23
+ // with indierect child list
24
+ childViews: { view: 'List', rect: '1 1 178 900000', anchors: 'top left right',
25
+ data: data, rowHeight: 30, id: 'list', throttle: 0, multiselect: true, textSelectable: false }
26
+ }
27
+ }
28
+ ],
29
+ rightChildViews: [ // other controlls on the right
30
+
31
+ // main list controlls
32
+ { view: 'Box', rect: '0 0 400 100', anchors: 'left top', childViews: [
33
+ { view: 'Button', rect: '10 10 100 24', anchors: 'left top', text: 'Add +', id: "add", focusable: false },
34
+ { view: 'TextField', rect: '125 10 50 24', anchors: 'left top', placeholder: 'where', value: '7', id: 'add-n' },
35
+ { view: 'TextField', rect: '180 10 100 24', anchors: 'left top', placeholder: 'what', value: 'some text', id: 'add-text' },
36
+
37
+ { view: 'Button', rect: '10 40 100 24', anchors: 'left top', text: 'Remove -', id: "remove", focusable: false },
38
+ { view: 'TextField', rect: '125 40 50 24', anchors: 'left top', placeholder: 'which', value: '7', id: 'remove-n' },
39
+
40
+ { view: 'Button', rect: '10 70 100 24', anchors: 'left top', text: 'Selected Index', id: 'selectedIndex', focusable: false },
41
+ { view: 'TextField', rect: '125 70 50 24', anchors: 'left top', placeholder: 'index', value: '7', id: 'selectedIndex-value' }
42
+ ]},
43
+
44
+ // additional list to check list + scrollPane integration
45
+ { view: 'Box', rect: '350 0 300 400', anchors: 'left top', childViews: [
46
+ { view: 'Button', rect: '0 0 100 24', anchors: 'left top', id: 'add-s', text: 'add to list 2' },
47
+ { view: 'Button', rect: '200 0 100 24', anchors: 'right top', id: 'remove-s', text: 'remove from list 2' },
48
+ { view: 'ScrollPane', rect: '0 30 300 270', anchors: 'left top', childViews: [
49
+ { view: 'List', rect: '0 0 300 270', anchors: 'left top rigth', minSize: '0 270', data: ['sample #1', 'sample #2', 'sample #3', 'sample #4'], id: 'list2' }
50
+ ]}
51
+ ] }
52
+
53
+
54
+ ]
55
+ }
56
+ ).attachTo( document.getElementById('test'), '1000 600' )
57
+
58
+ // first list controlls
59
+ uki('#add', p).click(function() {
60
+ uki('#list')[0].addRow(uki('#add-n').value() || 0, uki('#add-text').value() || 'sample')
61
+ });
62
+
63
+ uki('#remove', p).click(function() {
64
+ uki('#list')[0].removeRow(uki('#remove-n').value());
65
+ });
66
+
67
+ uki('#selectedIndex').click(function() {
68
+ uki('#list').selectedIndex(uki('#selectedIndex-value').value())
69
+ });
70
+
71
+ // second list controlls
72
+ uki('#add-s').click(function() {
73
+ uki('#list2').addRow(0, 'text');
74
+ });
75
+
76
+ uki('#remove-s').resizeToContents('width').layout().click(function() {
77
+ uki('#list2').removeRow(0);
78
+ });
@@ -0,0 +1,41 @@
1
+ /**
2
+ @example_title Popup
3
+ @example_order 52
4
+ @example_html
5
+ <style>body, html { overflow: hidden; margin: 0; padding: 0; }</style>
6
+ <div id="test" style="width: 90%; height: 300px;"></div>
7
+ <script src="/src/uki.cjs"></script>
8
+ <script src="popup.js"></script>
9
+ */
10
+
11
+ // create 8 buttons
12
+ uki({ view: 'Box', rect: '1000 400', anchors: 'left top', childViews: [
13
+ { view: 'Button', rect: '10 370 100 24', anchors: 'left top', text: 'Left Bottom', id: 'left_bottom' },
14
+ { view: 'Button', rect: '200 370 100 24', anchors: 'left top', text: 'Right Bottom', id: 'right_bottom' },
15
+ { view: 'Button', rect: '10 10 100 24', anchors: 'left top', text: 'Left Top', id: 'left_top' },
16
+ { view: 'Button', rect: '200 10 100 24', anchors: 'left top', text: 'Rigth Top', id: 'right_top' },
17
+ { view: 'Box', rect: '400 0 400 400', anchors: 'left top', childViews: [
18
+ { view: 'Button', rect: '70 310 100 24', anchors: 'left top', text: 'Left Bottom', id: 'h_left_bottom' },
19
+ { view: 'Button', rect: '200 310 100 24', anchors: 'left top', text: 'Right Bottom', id: 'h_right_bottom' },
20
+ { view: 'Button', rect: '70 70 100 24', anchors: 'left top', text: 'Left Top', id: 'h_left_top' },
21
+ { view: 'Button', rect: '200 70 100 24', anchors: 'left top', text: 'Rigth Top', id: 'h_right_top' }
22
+ ] }
23
+ ] }).attachTo( window, '1000 400' );
24
+
25
+ // on button click
26
+ uki('Button').click(function() {
27
+ var button = this;
28
+ // find relative popup and toggle it
29
+ uki('Popup').grep(function(e) { return e.relativeTo() == button; }).toggle();
30
+ });
31
+
32
+ // attach on popup per button
33
+ uki({ view: 'Popup', rect: '120 120', anchors: 'left bottom', shadow: 'theme(shadow-big)', relativeTo: uki('#left_bottom')[0] })[0].show();
34
+ uki({ view: 'Popup', rect: '120 120', anchors: 'left top', visible: true, relativeTo: uki('#left_top')[0] }).attachTo( window );
35
+ uki({ view: 'Popup', rect: '120 120', anchors: 'right bottom', relativeTo: uki('#right_bottom')[0] }).show();
36
+ uki({ view: 'Popup', rect: '120 120', anchors: 'right top', relativeTo: uki('#right_top')[0] }).show();
37
+
38
+ uki({ view: 'Popup', rect: '120 120', anchors: 'left bottom', horizontal: true, relativeTo: uki('#h_left_bottom')[0] }).show();
39
+ uki({ view: 'Popup', rect: '120 120', anchors: 'left top', horizontal: true, relativeTo: uki('#h_left_top')[0] }).show();
40
+ uki({ view: 'Popup', rect: '120 120', anchors: 'right bottom', horizontal: true, relativeTo: uki('#h_right_bottom')[0] }).show();
41
+ uki({ view: 'Popup', rect: '120 120', anchors: 'right top', horizontal: true, relativeTo: uki('#h_right_top')[0] }).show();
@@ -0,0 +1,34 @@
1
+ /**
2
+ @example_title Resize to contents
3
+ @example_order 3071
4
+ @example_html
5
+ <div id='test' style='width: 90%; height: 350px;'></div>
6
+ <script src="/src/uki.cjs"></script>
7
+ <script src='resizeToContents.js'></script>
8
+ */
9
+
10
+
11
+ uki({
12
+ view: 'Box', rect: '1000 600', anchors: 'left right bottom top', background: '#CCF',
13
+ childViews: [
14
+ {view: 'Box', rect: '790 390 200 200', // container box
15
+ anchors: 'right bottom', // anchored to the bottom (grow up)
16
+ background: '#CCC', childViews:
17
+ { view: 'Label', rect: '200 200', // label with long text
18
+ anchors: 'top left rigth', // anchored to the top right (grow down)
19
+ multiline: 'true',
20
+ text: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
21
+ inset: '3 3', id: 'target'}
22
+ },
23
+ {view: 'Button', rect: '10 10 100 24', anchors: 'left top', text: 'resize', id: 'doIt' }
24
+ ]
25
+ }).attachTo( document.getElementById('test'), '1000 600' )
26
+
27
+ // on click
28
+ uki('#doIt').click(function () {
29
+ uki('#target')
30
+ .html(uki('#target').html() + ' Lorem ipsum dolor sit amet, consectetur adipisicing elit ') // add more text
31
+ .resizeToContents('height').parent().resizeToContents('height').layout(); // resize to contents and relayout
32
+ });
33
+
34
+ uki('#doIt').resizeToContents('width').layout(); // fix button size