teacup 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +32 -9
- data/lib/teacup/layout.rb +5 -1
- data/lib/teacup/stylesheet_extensions/transform.rb +21 -1
- data/lib/teacup/teacup_view.rb +0 -4
- data/lib/teacup/version.rb +1 -1
- data/lib/teacup-ios/core_extensions/teacup_handlers.rb +7 -0
- data/lib/teacup-ios/dummy.rb +1 -0
- data/lib/teacup-osx/core_extensions/teacup_handlers.rb +7 -0
- data/lib/teacup-osx/core_extensions/z_core_extensions.rb +1 -1
- data/samples/README.md +11 -0
- data/samples/ios/AutoLayout/Gemfile +1 -0
- data/samples/{Hai → ios/AutoLayout}/Gemfile.lock +1 -2
- data/samples/{AutoLayout → ios/AutoLayout}/Rakefile +0 -0
- data/samples/{AutoLayout → ios/AutoLayout}/app/app_delegate.rb +0 -0
- data/samples/{AutoLayout → ios/AutoLayout}/app/root_controller.rb +0 -0
- data/samples/{AutoLayout → ios/AutoLayout}/app/styles/root.rb +0 -0
- data/samples/{AutoLayout → ios/AutoLayout}/lib/dummy.rb +0 -0
- data/samples/{AutoLayout → ios/AutoLayout}/lib/handlers.rb +0 -0
- data/samples/{AutoLayout → ios/AutoLayout}/lib/styles/base.rb +0 -0
- data/samples/{Hai → ios/Hai}/.gitignore +0 -0
- data/samples/ios/Hai/Gemfile +1 -0
- data/samples/{Tweets → ios/Hai}/Gemfile.lock +1 -4
- data/samples/{Hai → ios/Hai}/Rakefile +1 -1
- data/samples/{Hai → ios/Hai}/app/app_delegate.rb +0 -0
- data/samples/{Hai → ios/Hai}/app/hai_controller.rb +0 -0
- data/samples/{Hai → ios/Hai}/app/styles/iphone.rb +17 -10
- data/samples/{OnePage → ios/Hai}/resources/Default-568h@2x.png +0 -0
- data/samples/{OnePage → ios/sweettea-example}/Gemfile +1 -3
- data/samples/{OnePage → ios/sweettea-example}/Gemfile.lock +6 -4
- data/samples/{OnePage → ios/sweettea-example}/Rakefile +2 -2
- data/samples/{OnePage → ios/sweettea-example}/app/app_delegate.rb +1 -1
- data/samples/ios/sweettea-example/resources/Default-568h@2x.png +0 -0
- data/samples/osx/Tweets/Gemfile +1 -0
- data/samples/osx/Tweets/Gemfile.lock +13 -0
- data/samples/{Tweets → osx/Tweets}/README +0 -0
- data/samples/{Tweets → osx/Tweets}/Rakefile +2 -1
- data/samples/{Tweets → osx/Tweets}/app/app_delegate.rb +0 -0
- data/samples/{Tweets → osx/Tweets}/app/data_parser.rb +0 -0
- data/samples/{Tweets → osx/Tweets}/app/json_parser.rb +0 -0
- data/samples/{Tweets → osx/Tweets}/app/main_window.rb +0 -0
- data/samples/{Tweets → osx/Tweets}/app/menu.rb +0 -0
- data/samples/{Tweets → osx/Tweets}/app/stylesheet.rb +0 -0
- data/samples/{Tweets → osx/Tweets}/app/tweet.rb +0 -0
- data/samples/{Tweets → osx/Tweets}/resources/Credits.rtf +0 -0
- data/samples/{teacup-osx → osx/simple}/.gitignore +0 -0
- data/samples/osx/simple/Gemfile +1 -0
- data/samples/{teacup-osx → osx/simple}/Gemfile.lock +1 -1
- data/samples/{teacup-osx → osx/simple}/Rakefile +0 -0
- data/samples/{teacup-osx → osx/simple}/app/app_delegate.rb +0 -2
- data/samples/{teacup-osx → osx/simple}/app/controller.rb +0 -0
- data/samples/{teacup-osx → osx/simple}/app/menu.rb +0 -0
- data/samples/{teacup-osx → osx/simple}/app/window.rb +0 -0
- data/samples/{teacup-osx → osx/simple}/resources/Credits.rtf +0 -0
- data/samples/{teacup-osx → osx/simple}/resources/teacup.png +0 -0
- metadata +46 -49
- data/samples/AutoLayout/Gemfile +0 -4
- data/samples/AutoLayout/Gemfile.lock +0 -12
- data/samples/Hai/Gemfile +0 -3
- data/samples/Hai/spec/main_spec.rb +0 -9
- data/samples/OnePage/spec/main_spec.rb +0 -9
- data/samples/Tweets/Gemfile +0 -4
- data/samples/Tweets/spec/main_spec.rb +0 -9
- data/samples/teacup-osx/Gemfile +0 -4
- data/samples/teacup-osx/spec/main_spec.rb +0 -9
data/README.md
CHANGED
@@ -14,16 +14,18 @@ interfaces programmatically.
|
|
14
14
|
* iOS
|
15
15
|
* “[Hai][Hai]”
|
16
16
|
* “[AutoLayout][AutoLayout]”
|
17
|
-
* “[
|
17
|
+
* “[Sweettea Example][sweettea-example]”
|
18
18
|
* OS X
|
19
19
|
* “[Tweets][Tweets]” - ported from [RubyMotionSamples][]
|
20
|
-
* “[
|
20
|
+
* “[simple][]”
|
21
|
+
|
22
|
+
[Hai]: https://github.com/rubymotion/teacup/tree/master/samples/ios/Hai
|
23
|
+
[AutoLayout]: https://github.com/rubymotion/teacup/tree/master/samples/ios/AutoLayout
|
24
|
+
[sweettea-example]: https://github.com/rubymotion/teacup/tree/master/samples/ios/sweettea-example
|
25
|
+
|
26
|
+
[Tweets]: https://github.com/rubymotion/teacup/tree/master/samples/osx/Tweets
|
27
|
+
[simple]: https://github.com/rubymotion/teacup/tree/master/samples/osx/simple
|
21
28
|
|
22
|
-
[Hai]: https://github.com/rubymotion/teacup/tree/master/samples/Hai
|
23
|
-
[AutoLayout]: https://github.com/rubymotion/teacup/tree/master/samples/AutoLayout
|
24
|
-
[OnePage]: https://github.com/rubymotion/teacup/tree/master/samples/OnePage
|
25
|
-
[Tweets]: https://github.com/rubymotion/teacup/tree/master/samples/Tweets
|
26
|
-
[teacup-osx]: https://github.com/rubymotion/teacup/tree/master/samples/teacup-osx
|
27
29
|
[RubyMotionSamples]: https://github.com/HipByte/RubyMotionSamples/tree/master/osx/Tweets
|
28
30
|
|
29
31
|
**Quick Install**
|
@@ -532,8 +534,7 @@ end
|
|
532
534
|
And lastly, the `UIAppearance protocol` is supported by creating an instance of
|
533
535
|
`Teacup::Appearance`. There is debatable benefit to using [UIAppearance][],
|
534
536
|
because it will apply styles to views that are outside your control, like the
|
535
|
-
camera/image pickers and email/message controllers.
|
536
|
-
not apply styles to those views.
|
537
|
+
camera/image pickers and email/message controllers.
|
537
538
|
|
538
539
|
But, it does come in handy sometimes... so here it is!
|
539
540
|
|
@@ -555,6 +556,28 @@ Teacup::Appearance.new do
|
|
555
556
|
end
|
556
557
|
```
|
557
558
|
|
559
|
+
In your AppDelegate you need to call `Teacup::Appearance.apply`. It will get
|
560
|
+
called automatically using the `UIApplicationDidFinishLaunchingNotification`,
|
561
|
+
but that notification is triggered *after* the method
|
562
|
+
`AppDelegate#didFinishLaunching(withOptions:)` is called.
|
563
|
+
|
564
|
+
###### app_delegate.rb
|
565
|
+
```ruby
|
566
|
+
class AppDelegate
|
567
|
+
def didFinishLaunching(application, withOptions:options)
|
568
|
+
Teacup::Appearance.apply
|
569
|
+
|
570
|
+
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
|
571
|
+
ctlr = MainController.new
|
572
|
+
@window.rootViewController = UINavigationController.alloc.initWithRootController(ctlr)
|
573
|
+
@window.makeKeyAndVisible
|
574
|
+
|
575
|
+
true
|
576
|
+
end
|
577
|
+
|
578
|
+
end
|
579
|
+
```
|
580
|
+
|
558
581
|
That block is called using the `UIApplicationDidFinishLaunchingNotification`,
|
559
582
|
but that notification is not called until the *end* of the
|
560
583
|
`application(application,didFinishLaunchingWithOptions:launchOptions)` method.
|
data/lib/teacup/layout.rb
CHANGED
@@ -155,7 +155,11 @@ module Teacup
|
|
155
155
|
end
|
156
156
|
end
|
157
157
|
|
158
|
-
|
158
|
+
if view.is_a? Teacup::View
|
159
|
+
view.style(teacup_style.build(view))
|
160
|
+
else
|
161
|
+
Teacup.apply_hash view, teacup_style.build(view)
|
162
|
+
end
|
159
163
|
|
160
164
|
# assign the 'teacup_next_responder', which is queried for a stylesheet if
|
161
165
|
# one is not explicitly assigned to the view
|
@@ -16,7 +16,27 @@ module Teacup
|
|
16
16
|
|
17
17
|
def identity
|
18
18
|
NSLog("The Stylesheet method `identity` is deprecated, use `transform_layer.identity` instead")
|
19
|
-
|
19
|
+
transform_layer.identity
|
20
|
+
end
|
21
|
+
|
22
|
+
def flip(matrix, angle)
|
23
|
+
NSLog("The Stylesheet method `flip` is deprecated, use `transform_layer.flip` instead")
|
24
|
+
transform_layer.flip(angle)
|
25
|
+
end
|
26
|
+
|
27
|
+
def twist(matrix, angle)
|
28
|
+
NSLog("The Stylesheet method `twist` is deprecated, use `transform_layer.twist` instead")
|
29
|
+
transform_layer.twist(angle)
|
30
|
+
end
|
31
|
+
|
32
|
+
def spin(matrix, angle)
|
33
|
+
NSLog("The Stylesheet method `spin` is deprecated, use `transform_layer.spin` instead")
|
34
|
+
transform_layer.spin(angle)
|
35
|
+
end
|
36
|
+
|
37
|
+
def rotate(matrix, angle, x, y, z)
|
38
|
+
NSLog("The Stylesheet method `rotate` is deprecated, use `transform_layer.rotate` instead")
|
39
|
+
transform_layer.rotate(angle, x, y, z)
|
20
40
|
end
|
21
41
|
|
22
42
|
end
|
data/lib/teacup/teacup_view.rb
CHANGED
data/lib/teacup/version.rb
CHANGED
data/lib/teacup-ios/dummy.rb
CHANGED
@@ -100,7 +100,7 @@ Teacup.handler NSView, :frame do |target, frame|
|
|
100
100
|
[Teacup::calculate(target, :width, frame[0]), Teacup::calculate(target, :height, frame[1])],
|
101
101
|
[Teacup::calculate(target, :width, frame[2]), Teacup::calculate(target, :height, frame[3])]
|
102
102
|
]
|
103
|
-
elsif (Array === frame && frame.length == 2) ||
|
103
|
+
elsif (Array === frame && frame.length == 2) || NSRect === frame
|
104
104
|
frame = [
|
105
105
|
[Teacup::calculate(target, :width, frame[0][0]), Teacup::calculate(target, :height, frame[0][1])],
|
106
106
|
[Teacup::calculate(target, :width, frame[1][0]), Teacup::calculate(target, :height, frame[1][1])]
|
data/samples/README.md
CHANGED
@@ -2,3 +2,14 @@ Samples
|
|
2
2
|
=======
|
3
3
|
|
4
4
|
Welcome to the Teacup samples directory. Place sample apps using Teacup here.
|
5
|
+
|
6
|
+
# iOS
|
7
|
+
|
8
|
+
* Hai - a very simple teacup demo
|
9
|
+
* AutoLayout - demonstrates the constraints DSL
|
10
|
+
* Sweettea Example - uses SugarCube, Sweettea, and the constraints DSL
|
11
|
+
|
12
|
+
# OS X
|
13
|
+
|
14
|
+
* Teacup OSX - the original "hey, it works!" project
|
15
|
+
* Tweets - a port of the RubyMotionSample app
|
@@ -0,0 +1 @@
|
|
1
|
+
gem 'teacup', :path => '../../..'
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
gem 'teacup', :path => '../../..'
|
File without changes
|
File without changes
|
@@ -11,30 +11,37 @@ Teacup::Stylesheet.new(:iphone) do
|
|
11
11
|
style :label,
|
12
12
|
text: 'Hai!',
|
13
13
|
backgroundColor: UIColor.whiteColor,
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
portrait: {
|
15
|
+
layer: {
|
16
|
+
transform: transform_layer.identity,
|
17
|
+
},
|
18
|
+
top: 10,
|
19
|
+
left: 100,
|
20
|
+
height: 20,
|
21
|
+
width: 50
|
20
22
|
},
|
21
23
|
landscape_left: {
|
22
24
|
layer: {
|
23
|
-
transform: rotate(
|
25
|
+
transform: transform_layer.rotate(pi/6, 0.3, 0.3, 0.3)
|
24
26
|
},
|
27
|
+
top: 40,
|
28
|
+
left: 100,
|
29
|
+
height: 20,
|
25
30
|
width: 75
|
26
31
|
}
|
27
32
|
|
28
33
|
style :footer,
|
29
34
|
text: 'brought to you by teacup',
|
30
35
|
backgroundColor: UIColor.lightGrayColor,
|
31
|
-
top: 440,
|
32
|
-
left: 120,
|
33
36
|
width: 200,
|
34
37
|
height: 20,
|
38
|
+
portrait: {
|
39
|
+
top: 440,
|
40
|
+
left: 120,
|
41
|
+
},
|
35
42
|
landscape: {
|
43
|
+
top: 280,
|
36
44
|
left: 280,
|
37
|
-
top: 280
|
38
45
|
}
|
39
46
|
|
40
47
|
end
|
File without changes
|
@@ -1,21 +1,23 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ../..
|
3
|
+
specs:
|
4
|
+
teacup (2.0.2)
|
5
|
+
|
1
6
|
GEM
|
2
7
|
remote: https://rubygems.org/
|
3
8
|
specs:
|
4
|
-
geomotion (0.12.1)
|
5
9
|
rake (10.0.4)
|
6
10
|
sugarcube (0.20.18)
|
7
11
|
sweettea (0.5.6)
|
8
12
|
rake
|
9
13
|
sugarcube
|
10
14
|
teacup
|
11
|
-
teacup (1.3.3)
|
12
15
|
|
13
16
|
PLATFORMS
|
14
17
|
ruby
|
15
18
|
|
16
19
|
DEPENDENCIES
|
17
|
-
geomotion
|
18
20
|
rake
|
19
21
|
sugarcube
|
20
22
|
sweettea
|
21
|
-
teacup
|
23
|
+
teacup!
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
$:.unshift("/Library/RubyMotion/lib")
|
3
|
-
require 'motion/project'
|
3
|
+
require 'motion/project/template/ios'
|
4
4
|
require 'bundler'
|
5
5
|
Bundler.require
|
6
6
|
|
7
7
|
|
8
8
|
Motion::Project::App.setup do |app|
|
9
9
|
# Use `rake config' to see complete project settings.
|
10
|
-
app.name = '
|
10
|
+
app.name = 'Sweettea Example'
|
11
11
|
end
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
gem 'teacup', :path => '../../..'
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
gem 'teacup', :path => '../../..'
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teacup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-06-10 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: ! 'Teacup is a community-driven DSL for making CSS-like styling, and
|
15
15
|
layouts for
|
@@ -84,54 +84,51 @@ files:
|
|
84
84
|
- lib/teacup/teacup_view.rb
|
85
85
|
- lib/teacup/version.rb
|
86
86
|
- resources/Default-568h@2x.png
|
87
|
-
- samples/AutoLayout/Gemfile
|
88
|
-
- samples/AutoLayout/Gemfile.lock
|
89
|
-
- samples/AutoLayout/Rakefile
|
90
|
-
- samples/AutoLayout/app/app_delegate.rb
|
91
|
-
- samples/AutoLayout/app/root_controller.rb
|
92
|
-
- samples/AutoLayout/app/styles/root.rb
|
93
|
-
- samples/AutoLayout/lib/dummy.rb
|
94
|
-
- samples/AutoLayout/lib/handlers.rb
|
95
|
-
- samples/AutoLayout/lib/styles/base.rb
|
96
|
-
- samples/Hai/.gitignore
|
97
|
-
- samples/Hai/Gemfile
|
98
|
-
- samples/Hai/Gemfile.lock
|
99
|
-
- samples/Hai/Rakefile
|
100
|
-
- samples/Hai/app/app_delegate.rb
|
101
|
-
- samples/Hai/app/hai_controller.rb
|
102
|
-
- samples/Hai/app/styles/iphone.rb
|
103
|
-
- samples/Hai/spec/main_spec.rb
|
104
|
-
- samples/OnePage/Gemfile
|
105
|
-
- samples/OnePage/Gemfile.lock
|
106
|
-
- samples/OnePage/Rakefile
|
107
|
-
- samples/OnePage/app/app_delegate.rb
|
108
|
-
- samples/OnePage/resources/Default-568h@2x.png
|
109
|
-
- samples/OnePage/spec/main_spec.rb
|
110
87
|
- samples/README.md
|
111
|
-
- samples/
|
112
|
-
- samples/
|
113
|
-
- samples/
|
114
|
-
- samples/
|
115
|
-
- samples/
|
116
|
-
- samples/
|
117
|
-
- samples/
|
118
|
-
- samples/
|
119
|
-
- samples/
|
120
|
-
- samples/
|
121
|
-
- samples/
|
122
|
-
- samples/
|
123
|
-
- samples/
|
124
|
-
- samples/
|
125
|
-
- samples/
|
126
|
-
- samples/
|
127
|
-
- samples/
|
128
|
-
- samples/
|
129
|
-
- samples/
|
130
|
-
- samples/
|
131
|
-
- samples/
|
132
|
-
- samples/
|
133
|
-
- samples/
|
134
|
-
- samples/
|
88
|
+
- samples/ios/AutoLayout/Gemfile
|
89
|
+
- samples/ios/AutoLayout/Gemfile.lock
|
90
|
+
- samples/ios/AutoLayout/Rakefile
|
91
|
+
- samples/ios/AutoLayout/app/app_delegate.rb
|
92
|
+
- samples/ios/AutoLayout/app/root_controller.rb
|
93
|
+
- samples/ios/AutoLayout/app/styles/root.rb
|
94
|
+
- samples/ios/AutoLayout/lib/dummy.rb
|
95
|
+
- samples/ios/AutoLayout/lib/handlers.rb
|
96
|
+
- samples/ios/AutoLayout/lib/styles/base.rb
|
97
|
+
- samples/ios/Hai/.gitignore
|
98
|
+
- samples/ios/Hai/Gemfile
|
99
|
+
- samples/ios/Hai/Gemfile.lock
|
100
|
+
- samples/ios/Hai/Rakefile
|
101
|
+
- samples/ios/Hai/app/app_delegate.rb
|
102
|
+
- samples/ios/Hai/app/hai_controller.rb
|
103
|
+
- samples/ios/Hai/app/styles/iphone.rb
|
104
|
+
- samples/ios/Hai/resources/Default-568h@2x.png
|
105
|
+
- samples/ios/sweettea-example/Gemfile
|
106
|
+
- samples/ios/sweettea-example/Gemfile.lock
|
107
|
+
- samples/ios/sweettea-example/Rakefile
|
108
|
+
- samples/ios/sweettea-example/app/app_delegate.rb
|
109
|
+
- samples/ios/sweettea-example/resources/Default-568h@2x.png
|
110
|
+
- samples/osx/Tweets/Gemfile
|
111
|
+
- samples/osx/Tweets/Gemfile.lock
|
112
|
+
- samples/osx/Tweets/README
|
113
|
+
- samples/osx/Tweets/Rakefile
|
114
|
+
- samples/osx/Tweets/app/app_delegate.rb
|
115
|
+
- samples/osx/Tweets/app/data_parser.rb
|
116
|
+
- samples/osx/Tweets/app/json_parser.rb
|
117
|
+
- samples/osx/Tweets/app/main_window.rb
|
118
|
+
- samples/osx/Tweets/app/menu.rb
|
119
|
+
- samples/osx/Tweets/app/stylesheet.rb
|
120
|
+
- samples/osx/Tweets/app/tweet.rb
|
121
|
+
- samples/osx/Tweets/resources/Credits.rtf
|
122
|
+
- samples/osx/simple/.gitignore
|
123
|
+
- samples/osx/simple/Gemfile
|
124
|
+
- samples/osx/simple/Gemfile.lock
|
125
|
+
- samples/osx/simple/Rakefile
|
126
|
+
- samples/osx/simple/app/app_delegate.rb
|
127
|
+
- samples/osx/simple/app/controller.rb
|
128
|
+
- samples/osx/simple/app/menu.rb
|
129
|
+
- samples/osx/simple/app/window.rb
|
130
|
+
- samples/osx/simple/resources/Credits.rtf
|
131
|
+
- samples/osx/simple/resources/teacup.png
|
135
132
|
- spec/ios/appearance_spec.rb
|
136
133
|
- spec/ios/calculations_spec.rb
|
137
134
|
- spec/ios/constraints_spec.rb
|
data/samples/AutoLayout/Gemfile
DELETED
data/samples/Hai/Gemfile
DELETED
data/samples/Tweets/Gemfile
DELETED
data/samples/teacup-osx/Gemfile
DELETED