lissio 0.1.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,332 @@
1
+ require 'base64'
2
+
3
+ module Lissio; class Component
4
+
5
+ class Markdown < Component
6
+ def self.render(string, options = {}, &block)
7
+ `marked(#{@string.to_n}, #{@options.to_n}, #{@block.to_n})`
8
+ end
9
+
10
+ def initialize(string, options = {}, &block)
11
+ @string = string
12
+ @options = options
13
+ @block = block
14
+ end
15
+
16
+ def render
17
+ element.inner_html = Markdown.render(@string, @options, @block)
18
+
19
+ super
20
+ end
21
+ end
22
+
23
+ end; end
24
+
25
+ # load https://github.com/chjj/marked
26
+ `eval(#{Base64.decode64(DATA.read)})`
27
+
28
+ __END__
29
+
30
+ KGZ1bmN0aW9uKCl7dmFyIGJsb2NrPXtuZXdsaW5lOi9eXG4rLyxjb2RlOi9eKCB7NH1bXlxuXStc
31
+ biopKy8sZmVuY2VzOm5vb3AsaHI6L14oICpbLSpfXSl7Myx9ICooPzpcbit8JCkvLGhlYWRpbmc6
32
+ L14gKigjezEsNn0pICooW15cbl0rPykgKiMqICooPzpcbit8JCkvLG5wdGFibGU6bm9vcCxsaGVh
33
+ ZGluZzovXihbXlxuXSspXG4gKig9fC0pezIsfSAqKD86XG4rfCQpLyxibG9ja3F1b3RlOi9eKCAq
34
+ PlteXG5dKyhcblteXG5dKykqXG4qKSsvLGxpc3Q6L14oICopKGJ1bGwpIFtcc1xTXSs/KD86aHJ8
35
+ XG57Mix9KD8hICkoPyFcMWJ1bGwgKVxuKnxccyokKS8saHRtbDovXiAqKD86Y29tbWVudHxjbG9z
36
+ ZWR8Y2xvc2luZykgKig/OlxuezIsfXxccyokKS8sZGVmOi9eICpcWyhbXlxdXSspXF06ICo8Pyhb
37
+ XlxzPl0rKT4/KD86ICtbIihdKFteXG5dKylbIildKT8gKig/OlxuK3wkKS8sdGFibGU6bm9vcCxw
38
+ YXJhZ3JhcGg6L14oKD86W15cbl0rXG4/KD8haHJ8aGVhZGluZ3xsaGVhZGluZ3xib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W14nIj5dKSo/
144
+ Pi8sbGluazovXiE/XFsoaW5zaWRlKVxdXChocmVmXCkvLHJlZmxpbms6L14hP1xbKGluc2lkZSlc
145
+ XVxzKlxbKFteXF1dKilcXS8sbm9saW5rOi9eIT9cWygoPzpcW1teXF1dKlxdfFteXFtcXV0pKilc
146
+ XS8sc3Ryb25nOi9eX18oW1xzXFNdKz8pX18oPyFfKXxeXCpcKihbXHNcU10rPylcKlwqKD8hXCop
147
+ LyxlbTovXlxiXygoPzpfX3xbXHNcU10pKz8pX1xifF5cKigoPzpcKlwqfFtcc1xTXSkrPylcKig/
148
+ IVwqKS8sY29kZTovXihgKylccyooW1xzXFNdKj9bXmBdKVxzKlwxKD8hYCkvLGJyOi9eIHsyLH1c
149
+ big/IVxzKiQpLyxkZWw6bm9vcCx0ZXh0Oi9eW1xzXFNdKz8oPz1bXFw8IVxbXypgXXwgezIsfVxu
150
+ fCQpL307aW5saW5lLl9pbnNpZGU9Lyg/OlxbW15cXV0qXF18W15cW1xdXXxcXSg/PVteXFtdKlxd
151
+ KSkqLztpbmxpbmUuX2hyZWY9L1xzKjw/KFtcc1xTXSo/KT4/KD86XHMrWyciXShbXHNcU10qPylb
152
+ JyJdKT9ccyovO2lubGluZS5saW5rPXJlcGxhY2UoaW5saW5lLmxpbmspKCJpbnNpZGUiLGlubGlu
153
+ ZS5faW5zaWRlKSgiaHJlZiIsaW5saW5lLl9ocmVmKSgpO2lubGluZS5yZWZsaW5rPXJlcGxhY2Uo
154
+ aW5saW5lLnJlZmxpbmspKCJpbnNpZGUiLGlubGluZS5faW5zaWRlKSgpO2lubGluZS5ub3JtYWw9
155
+ bWVyZ2Uoe30saW5saW5lKTtpbmxpbmUucGVkYW50aWM9bWVyZ2Uoe30saW5saW5lLm5vcm1hbCx7
156
+ c3Ryb25nOi9eX18oPz1cUykoW1xzXFNdKj9cUylfXyg/IV8pfF5cKlwqKD89XFMpKFtcc1xTXSo/
157
+ XFMpXCpcKig/IVwqKS8sZW06L15fK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JrZWQ7aWYodHlwZW9mIGV4cG9ydHM9PT0ib2JqZWN0
329
+ Iil7bW9kdWxlLmV4cG9ydHM9bWFya2VkfWVsc2UgaWYodHlwZW9mIGRlZmluZT09PSJmdW5jdGlv
330
+ biImJmRlZmluZS5hbWQpe2RlZmluZShmdW5jdGlvbigpe3JldHVybiBtYXJrZWR9KX1lbHNle3Ro
331
+ aXMubWFya2VkPW1hcmtlZH19KS5jYWxsKGZ1bmN0aW9uKCl7cmV0dXJuIHRoaXN8fCh0eXBlb2Yg
332
+ d2luZG93IT09InVuZGVmaW5lZCI/d2luZG93Omdsb2JhbCl9KCkpOw==
@@ -0,0 +1,373 @@
1
+ module Lissio; class Component
2
+
3
+ class Tooltip < Lissio::Component
4
+ DEFAULTS = {
5
+ placement: :top,
6
+ animate: true,
7
+ container: false,
8
+ delay: 0,
9
+ escape: true
10
+ }
11
+
12
+ def initialize(*args, &block)
13
+ if Lissio::Component === args.first
14
+ super(args.shift)
15
+ end
16
+
17
+ @options = DEFAULTS.merge(args.first)
18
+ @block = block
19
+ @enabled = true
20
+
21
+ render
22
+ end
23
+
24
+ def enabled?
25
+ @enabled
26
+ end
27
+
28
+ def enable
29
+ @enabled = true
30
+ end
31
+
32
+ def disable
33
+ @enabled = false
34
+ end
35
+
36
+ def shown?
37
+ element.has_class? :in
38
+ end
39
+
40
+ def register(element, trigger)
41
+ case trigger
42
+ when :click
43
+ element.on :click do
44
+ toggle
45
+ end
46
+
47
+ when :hover
48
+ element.on 'mouse:over' do
49
+ show
50
+ end
51
+
52
+ element.on 'mouse:out' do
53
+ hide
54
+ end
55
+
56
+ when :focus
57
+ element.on :focus do
58
+ show
59
+ end
60
+
61
+ element.on :blur do
62
+ hide
63
+ end
64
+ end
65
+
66
+ self
67
+ end
68
+
69
+ def show(content = @options[:content])
70
+ return unless enabled?
71
+
72
+ placement = @block ? block.call(self) : @options[:placement] || place
73
+
74
+ element.detach
75
+ element.style(top: 0, left: 0, display: 0)
76
+ element.add_class placement, :in
77
+ element.append_to container
78
+
79
+ element.at('.tooltip-inner').content = content
80
+ element.show()
81
+
82
+ apply(placement)
83
+ end
84
+
85
+ def hide
86
+ element.remove_class :in
87
+ end
88
+
89
+ def toggle
90
+ if shown?
91
+ hide
92
+ else
93
+ show
94
+ end
95
+ end
96
+
97
+ def destroy
98
+
99
+ end
100
+
101
+ private
102
+ def container
103
+ if container = @options[:container]
104
+ if String === container
105
+ container = (parent ? parent.element : $document).at(container)
106
+ end
107
+
108
+ container
109
+ else
110
+ parent ? parent.element : $document.body
111
+ end
112
+ end
113
+
114
+ def along
115
+ if along = @options[:along]
116
+ if String === along
117
+ along = (parent ? parent.element : $document).at(along)
118
+ end
119
+
120
+ along
121
+ else
122
+ raise ArgumentError, "no parent or along"
123
+
124
+ parent.element
125
+ end
126
+ end
127
+
128
+ def offset(placement)
129
+ along_position = along.position
130
+ along_size = along.size
131
+ size = element.size
132
+
133
+ case placement
134
+ when :bottom
135
+ Browser::Position.new(along_position.x + (along_size.width / 2) - (size.width / 2),
136
+ along_position.y + along_size.height)
137
+
138
+ when :top
139
+ Browser::Position.new(along_position.x + (along_size.width / 2) - (size.width / 2),
140
+ along_position.y - size.height)
141
+
142
+ when :left
143
+ Browser::Position.new(along_position.x - size.width,
144
+ along_position.y + (along_size.height / 2) - (size.height / 2))
145
+
146
+ when :right
147
+ Browser::Position.new(along_position.x + along_size.width,
148
+ along_position.y + (along_size.height / 2) - (size.height / 2))
149
+ end
150
+ end
151
+
152
+ def apply(placement)
153
+ position = offset(placement)
154
+ size = element.size
155
+
156
+ margin_top = element.style['margin-top'].to_u
157
+ margin_left = element.style['margin-left'].to_u
158
+
159
+ element.offset = position.x + margin_top, position.y + margin_left
160
+ end
161
+
162
+ def place
163
+ :top
164
+ end
165
+
166
+ tag class: :tooltip
167
+
168
+ html do
169
+ div.tooltip[:arrow]
170
+ div.tooltip[:inner]
171
+ end
172
+
173
+ css do
174
+ rule '.tooltip' do
175
+ position :absolute
176
+ z index: 9001
177
+
178
+ display :block
179
+ visibility :visible
180
+
181
+ font size: 12.px
182
+ line height: 1.4
183
+
184
+ opacity 0
185
+
186
+ rule '&.in' do
187
+ opacity 0.9
188
+ end
189
+
190
+ rule '&.top' do
191
+ margin top: -3.px
192
+ padding 5.px, 0
193
+ end
194
+
195
+ rule '&.right' do
196
+ margin left: 3.px
197
+ padding 0, 5.px
198
+ end
199
+
200
+ rule '&.bottom' do
201
+ margin top: 3.px
202
+ padding 5.px, 0
203
+ end
204
+
205
+ rule '&.left' do
206
+ margin left: -3.px
207
+ padding 0, 5.px
208
+ end
209
+
210
+ rule '.tooltip-inner' do
211
+ max width: 200.px
212
+ padding 3.px, 8.px
213
+ color '#fff'
214
+
215
+ text align: :center,
216
+ decoration: :none
217
+
218
+ background color: '#000'
219
+ border radius: 4.px
220
+ end
221
+
222
+ rule '.tooltip-arrow' do
223
+ position :absolute
224
+ width 0
225
+ height 0
226
+
227
+ border color: :transparent,
228
+ style: :solid
229
+ end
230
+
231
+ rule '&.top .tooltip-arrow' do
232
+ bottom 0
233
+ left 50.%
234
+
235
+ margin left: -5.px
236
+ border width: [5.px, 5.px, 0],
237
+ color: { top: '#000' }
238
+ end
239
+
240
+ rule '&.top-left .tooltip-arrow' do
241
+ bottom 0
242
+ left 5.px
243
+
244
+ border width: [5.px, 5.px, 0],
245
+ color: { top: '#000' }
246
+ end
247
+
248
+ rule '&.top-right .tooltip-arrow' do
249
+ bottom 0
250
+ right 5.px
251
+
252
+ border width: [5.px, 5.px, 0],
253
+ color: { top: '#000' }
254
+ end
255
+
256
+ rule '&.right .tooltip-arrow' do
257
+ top 50.%
258
+ left 0
259
+
260
+ margin top: -5.px
261
+ border width: [5.px, 5.px, 5.px, 0],
262
+ color: { right: '#000' }
263
+ end
264
+
265
+ rule '&.left .tooltip-arrow' do
266
+ top 50.%
267
+ right 0
268
+
269
+ margin top: -5.px
270
+ border width: [5.px, 0, 5.px, 5.px],
271
+ color: { left: '#000' }
272
+ end
273
+
274
+ rule '&.bottom .tooltip-arrow' do
275
+ top 0
276
+ left 50.%
277
+
278
+ margin left: -5.px
279
+ border width: [0, 5.px, 5.px],
280
+ color: { bottom: '#000' }
281
+ end
282
+
283
+ rule '&.bottom-left .tooltip-arrow' do
284
+ top 0
285
+ left 5.px
286
+
287
+ border width: [0, 5.px, 5.px],
288
+ color: { bottom: '#000' }
289
+ end
290
+
291
+ rule '&.bottom-right .tooltip-arrow' do
292
+ top 0
293
+ right 5.px
294
+
295
+ border width: [0, 5.px, 5.px],
296
+ color: { bottom: '#000' }
297
+ end
298
+ end
299
+ end
300
+
301
+ def self.customize(*args, &block)
302
+ if args.length == 1
303
+ options = args.first
304
+ else
305
+ name, options = args
306
+ end
307
+
308
+ name ||= "tooltip-custom-#{rand(10000)}"
309
+ options ||= {}
310
+
311
+ Class.new(self) {
312
+ tag class: [:tooltip, name]
313
+
314
+ css do
315
+ rule ".tooltip.#{name}" do
316
+ instance_exec(&block) if block
317
+
318
+ if value = options[:opacity]
319
+ rule '&.in' do
320
+ opacity value
321
+ end
322
+ end
323
+
324
+ if value = options[:foreground] || options[:fg]
325
+ rule '.tooltip-inner' do
326
+ color value
327
+ end
328
+ end
329
+
330
+ if value = options[:background] || options[:bg]
331
+ rule '.tooltip-inner' do
332
+ background color: value
333
+ end
334
+
335
+ rule '&.top .tooltip-arrow' do
336
+ border color: { top: value }
337
+ end
338
+
339
+ rule '&.top-right .tooltip-arrow' do
340
+ border color: { top: value }
341
+ end
342
+
343
+ rule '&.top-left .tooltip-arrow' do
344
+ border color: { top: value }
345
+ end
346
+
347
+ rule '&.right .tooltip-arrow' do
348
+ border color: { right: value }
349
+ end
350
+
351
+ rule '&.left .tooltip-arrow' do
352
+ border color: { right: value }
353
+ end
354
+
355
+ rule '&.bottom .tooltip-arrow' do
356
+ border color: { bottom: value }
357
+ end
358
+
359
+ rule '&.bottom-right .tooltip-arrow' do
360
+ border color: { bottom: value }
361
+ end
362
+
363
+ rule '&.bottom-left .tooltip-arrow' do
364
+ border color: { bottom: value }
365
+ end
366
+ end
367
+ end
368
+ end
369
+ }
370
+ end
371
+ end
372
+
373
+ end; end