clearwater 1.0.0.beta3 → 1.0.0.beta4

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
  SHA1:
3
- metadata.gz: 0f3b1ded6dac98af01bec9bdaedc42f78ddafc4e
4
- data.tar.gz: 284c6c9a0481dd5e6991709422bb879ede4f9586
3
+ metadata.gz: 252e364a39c3d73e7e056b0209411d92d55a6a48
4
+ data.tar.gz: f43ad3eac92c94faff4fdfa8c000bfc5307ad7ae
5
5
  SHA512:
6
- metadata.gz: be833a327efea9000a92d936c1e78b33843e8f0222290d77175d797a87e2646e22c362e2960f27068d7bbd111ccd13c8cee5cf25c7e40a4ae07e68c85bad0036
7
- data.tar.gz: 5ac50a1cca2683d81683dea330b613fa32841e5c1df92ddb98d6ffce400978c171189cf986a868cd870f5d8afadc4c74946da0538fdc1c4b4534c543e0d24153
6
+ metadata.gz: 4d02fb2d91600e1f61e842f36b4bc4d06da201c6049f420d7a18ef19a296887adfd2c97a90ed265d3a2cc65aea72fc5077c9ee388d2340d825d74383f3d495c9
7
+ data.tar.gz: 2237acc5c21b6786413c323e1ce7330fa94e2fff5e59061eb607549ccda94dd3329d03b718d7006dd1968843ca305a8703c8402306cf24faf555151ce118f0d9
@@ -1,3 +1,3 @@
1
1
  module Clearwater
2
- VERSION = "1.0.0.beta3"
2
+ VERSION = "1.0.0.beta4"
3
3
  end
@@ -89,6 +89,295 @@ module Clearwater
89
89
  vkern: 'vkern',
90
90
  }
91
91
 
92
+ SVG_ATTRIBUTES = {
93
+ accent_height: 'accent-height',
94
+ accumulate: 'accumulate',
95
+ additive: 'additive',
96
+ alignment_baseline: 'alignment-baseline',
97
+ alphabetic: 'alphabetic',
98
+ amplitude: 'amplitude',
99
+ arabic_form: 'arabic-form',
100
+ ascent: 'ascent',
101
+ attribute_name: 'attributeName',
102
+ attribute_type: 'attributeType',
103
+ azimuth: 'azimuth',
104
+ base_frequency: 'baseFrequency',
105
+ base_profile: 'baseProfile',
106
+ baseline_shift: 'baseline-shift',
107
+ bbox: 'bbox',
108
+ begin: 'begin',
109
+ bias: 'bias',
110
+ by: 'by',
111
+ calc_mode: 'calcMode',
112
+ cap_height: 'cap-height',
113
+ class: 'class',
114
+ clip: 'clip',
115
+ clip_path: 'clip-path',
116
+ clip_rule: 'clip-rule',
117
+ clip_path_units: 'clipPathUnits',
118
+ color: 'color',
119
+ color_interpolation: 'color-interpolation',
120
+ color_interpolation_filters: 'color-interpolation-filters',
121
+ color_profile: 'color-profile',
122
+ color_rendering: 'color-rendering',
123
+ content_script_type: 'contentScriptType',
124
+ content_style_type: 'contentStyleType',
125
+ cursor: 'cursor',
126
+ cx: 'cx',
127
+ cy: 'cy',
128
+ d: 'd',
129
+ descent: 'descent',
130
+ diffuse_constant: 'diffuseConstant',
131
+ direction: 'direction',
132
+ display: 'display',
133
+ divisor: 'divisor',
134
+ dominant_baseline: 'dominant-baseline',
135
+ dur: 'dur',
136
+ dx: 'dx',
137
+ dy: 'dy',
138
+ edge_mode: 'edgeMode',
139
+ elevation: 'elevation',
140
+ enable_background: 'enable-background',
141
+ end: 'end',
142
+ exponent: 'exponent',
143
+ external_resources_required: 'externalResourcesRequired',
144
+ fill: 'fill',
145
+ fill_opacity: 'fill-opacity',
146
+ fill_rule: 'fill-rule',
147
+ filter: 'filter',
148
+ filter_res: 'filterRes',
149
+ filter_units: 'filterUnits',
150
+ flood_color: 'flood-color',
151
+ flood_opacity: 'flood-opacity',
152
+ font_family: 'font-family',
153
+ font_size: 'font-size',
154
+ font_size_adjust: 'font-size-adjust',
155
+ font_stretch: 'font-stretch',
156
+ font_style: 'font-style',
157
+ font_variant: 'font-variant',
158
+ font_weight: 'font-weight',
159
+ format: 'format',
160
+ from: 'from',
161
+ fx: 'fx',
162
+ fy: 'fy',
163
+ g1: 'g1',
164
+ g2: 'g2',
165
+ glyph_name: 'glyph-name',
166
+ glyph_orientation_horizontal: 'glyph-orientation-horizontal',
167
+ glyph_orientation_vertical: 'glyph-orientation-vertical',
168
+ glyph_ref: 'glyphRef',
169
+ gradient_transform: 'gradientTransform',
170
+ gradient_units: 'gradientUnits',
171
+ hanging: 'hanging',
172
+ height: 'height',
173
+ horiz_adv_x: 'horiz-adv-x',
174
+ horiz_origin_x: 'horiz-origin-x',
175
+ horiz_origin_y: 'horiz-origin-y',
176
+ id: 'id',
177
+ ideographic: 'ideographic',
178
+ image_rendering: 'image-rendering',
179
+ in: 'in',
180
+ in2: 'in2',
181
+ intercept: 'intercept',
182
+ k: 'k',
183
+ k1: 'k1',
184
+ k2: 'k2',
185
+ k3: 'k3',
186
+ k4: 'k4',
187
+ kernel_matrix: 'kernelMatrix',
188
+ kernel_unit_length: 'kernelUnitLength',
189
+ kerning: 'kerning',
190
+ key_points: 'keyPoints',
191
+ key_splines: 'keySplines',
192
+ key_times: 'keyTimes',
193
+ lang: 'lang',
194
+ length_adjust: 'lengthAdjust',
195
+ letter_spacing: 'letter-spacing',
196
+ lighting_color: 'lighting-color',
197
+ limiting_cone_angle: 'limitingConeAngle',
198
+ local: 'local',
199
+ marker_end: 'marker-end',
200
+ marker_mid: 'marker-mid',
201
+ marker_start: 'marker-start',
202
+ marker_height: 'markerHeight',
203
+ marker_units: 'markerUnits',
204
+ marker_width: 'markerWidth',
205
+ mask: 'mask',
206
+ mask_content_units: 'maskContentUnits',
207
+ mask_units: 'maskUnits',
208
+ mathematical: 'mathematical',
209
+ max: 'max',
210
+ media: 'media',
211
+ method: 'method',
212
+ min: 'min',
213
+ mode: 'mode',
214
+ name: 'name',
215
+ num_octaves: 'numOctaves',
216
+ offset: 'offset',
217
+ onabort: 'onabort',
218
+ onactivate: 'onactivate',
219
+ onbegin: 'onbegin',
220
+ onclick: 'onclick',
221
+ onend: 'onend',
222
+ onerror: 'onerror',
223
+ onfocusin: 'onfocusin',
224
+ onfocusout: 'onfocusout',
225
+ onload: 'onload',
226
+ onmousedown: 'onmousedown',
227
+ onmousemove: 'onmousemove',
228
+ onmouseout: 'onmouseout',
229
+ onmouseover: 'onmouseover',
230
+ onmouseup: 'onmouseup',
231
+ onrepeat: 'onrepeat',
232
+ onresize: 'onresize',
233
+ onscroll: 'onscroll',
234
+ onunload: 'onunload',
235
+ onzoom: 'onzoom',
236
+ opacity: 'opacity',
237
+ operator: 'operator',
238
+ order: 'order',
239
+ orient: 'orient',
240
+ orientation: 'orientation',
241
+ origin: 'origin',
242
+ overflow: 'overflow',
243
+ overline_position: 'overline-position',
244
+ overline_thickness: 'overline-thickness',
245
+ panose_1: 'panose-1',
246
+ path: 'path',
247
+ path_length: 'pathLength',
248
+ pattern_content_units: 'patternContentUnits',
249
+ pattern_transform: 'patternTransform',
250
+ pattern_units: 'patternUnits',
251
+ pointer_events: 'pointer-events',
252
+ points: 'points',
253
+ points_at_x: 'pointsAtX',
254
+ points_at_y: 'pointsAtY',
255
+ points_at_z: 'pointsAtZ',
256
+ preserve_alpha: 'preserveAlpha',
257
+ preserve_aspect_ratio: 'preserveAspectRatio',
258
+ primitive_units: 'primitiveUnits',
259
+ r: 'r',
260
+ radius: 'radius',
261
+ ref_x: 'refX',
262
+ ref_y: 'refY',
263
+ rendering_intent: 'rendering-intent',
264
+ repeat_count: 'repeatCount',
265
+ repeat_dur: 'repeatDur',
266
+ required_extensions: 'requiredExtensions',
267
+ required_features: 'requiredFeatures',
268
+ restart: 'restart',
269
+ result: 'result',
270
+ rotate: 'rotate',
271
+ rx: 'rx',
272
+ ry: 'ry',
273
+ scale: 'scale',
274
+ seed: 'seed',
275
+ shape_rendering: 'shape-rendering',
276
+ slope: 'slope',
277
+ spacing: 'spacing',
278
+ specular_constant: 'specularConstant',
279
+ specular_exponent: 'specularExponent',
280
+ spread_method: 'spreadMethod',
281
+ start_offset: 'startOffset',
282
+ std_deviation: 'stdDeviation',
283
+ stemh: 'stemh',
284
+ stemv: 'stemv',
285
+ stitch_tiles: 'stitchTiles',
286
+ stop_color: 'stop-color',
287
+ stop_opacity: 'stop-opacity',
288
+ strikethrough_position: 'strikethrough-position',
289
+ strikethrough_thickness: 'strikethrough-thickness',
290
+ string: 'string',
291
+ stroke: 'stroke',
292
+ stroke_dasharray: 'stroke-dasharray',
293
+ stroke_dashoffset: 'stroke-dashoffset',
294
+ stroke_linecap: 'stroke-linecap',
295
+ stroke_linejoin: 'stroke-linejoin',
296
+ stroke_miterlimit: 'stroke-miterlimit',
297
+ stroke_opacity: 'stroke-opacity',
298
+ stroke_width: 'stroke-width',
299
+ style: 'style',
300
+ surface_scale: 'surfaceScale',
301
+ system_language: 'systemLanguage',
302
+ table_values: 'tableValues',
303
+ target: 'target',
304
+ target_x: 'targetX',
305
+ target_y: 'targetY',
306
+ text_anchor: 'text-anchor',
307
+ text_decoration: 'text-decoration',
308
+ text_rendering: 'text-rendering',
309
+ text_length: 'textLength',
310
+ title: 'title',
311
+ to: 'to',
312
+ transform: 'transform',
313
+ type: 'type',
314
+ u1: 'u1',
315
+ u2: 'u2',
316
+ underline_position: 'underline-position',
317
+ underline_thickness: 'underline-thickness',
318
+ unicode: 'unicode',
319
+ unicode_bidi: 'unicode-bidi',
320
+ unicode_range: 'unicode-range',
321
+ units_per_em: 'units-per-em',
322
+ v_alphabetic: 'v-alphabetic',
323
+ v_hanging: 'v-hanging',
324
+ v_ideographic: 'v-ideographic',
325
+ v_mathematical: 'v-mathematical',
326
+ values: 'values',
327
+ version: 'version',
328
+ vert_adv_y: 'vert-adv-y',
329
+ vert_origin_x: 'vert-origin-x',
330
+ vert_origin_y: 'vert-origin-y',
331
+ view_box: 'viewBox',
332
+ view_target: 'viewTarget',
333
+ visibility: 'visibility',
334
+ width: 'width',
335
+ widths: 'widths',
336
+ word_spacing: 'word-spacing',
337
+ writing_mode: 'writing-mode',
338
+ x: 'x',
339
+ x_height: 'x-height',
340
+ x1: 'x1',
341
+ x2: 'x2',
342
+ x_channel_selector: 'xChannelSelector',
343
+ xlinkactuate: 'xlinkactuate',
344
+ xlinkarcrole: 'xlinkarcrole',
345
+ xlinkhref: 'xlinkhref',
346
+ xlinkrole: 'xlinkrole',
347
+ xlinkshow: 'xlinkshow',
348
+ xlinktitle: 'xlinktitle',
349
+ xlinktype: 'xlinktype',
350
+ xmlbase: 'xmlbase',
351
+ xmllang: 'xmllang',
352
+ xmlspace: 'xmlspace',
353
+ y: 'y',
354
+ y1: 'y1',
355
+ y2: 'y2',
356
+ y_channel_selector: 'yChannelSelector',
357
+ z: 'z',
358
+ zoom_and_pan: 'zoomAndPan',
359
+ }
360
+
361
+ def self.sanitize_attributes attributes
362
+ return attributes unless `attributes.$$is_hash`
363
+
364
+ sanitized = attributes.each_with_object({}) do |(key, value), hash|
365
+ if svg_attr = SVG_ATTRIBUTES[key]
366
+ hash[svg_attr] = value
367
+ elsif key[0, 2] == 'on'
368
+ hash[key] = proc do |event|
369
+ value.call(Bowser::Event.new(event))
370
+ end
371
+ else
372
+ hash[key] = value
373
+ end
374
+ end
375
+
376
+ sanitized
377
+ end
378
+
379
+ module_function
380
+
92
381
  SVG_TAGS.each do |method_name, tag_name|
93
382
  define_method(method_name) do |attributes, content|
94
383
  tag(tag_name, attributes, content)
@@ -103,7 +392,7 @@ module Clearwater
103
392
 
104
393
  VirtualDOM.svg(
105
394
  tag_name,
106
- Component.sanitize_attributes(attributes),
395
+ SVGComponent.sanitize_attributes(attributes),
107
396
  Component.sanitize_content(content)
108
397
  )
109
398
  end
@@ -28,7 +28,7 @@ module Clearwater
28
28
  include Clearwater::SVGComponent
29
29
 
30
30
  def render
31
- svg({ view_box: '0 0 120 120' }, [
31
+ svg({ class: 'mysvg', marker_height: 10, marker_end: "url(#arrow)" }, [
32
32
  circle(cx: 50, cy: 50, r: 30),
33
33
  ])
34
34
  end
@@ -39,7 +39,7 @@ module Clearwater
39
39
  it 'renders to the specified element' do
40
40
  app.perform_render
41
41
 
42
- expect(element.inner_html).to eq '<div><p class="foo">Hello world</p><svg viewBox="0 0 120 120"><circle cx="50" cy="50" r="30"></circle></svg></div>'
42
+ expect(element.inner_html).to eq '<div><p class="foo">Hello world</p><svg class="mysvg" markerHeight="10" marker-end="url(#arrow)"><circle cx="50" cy="50" r="30"></circle></svg></div>'
43
43
  end
44
44
 
45
45
  it 'calls queued blocks after rendering' do
metadata CHANGED
@@ -1,94 +1,94 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clearwater
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta3
4
+ version: 1.0.0.beta4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Gaskins
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-28 00:00:00.000000000 Z
11
+ date: 2016-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: opal
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
18
  version: '0.7'
20
- type: :runtime
19
+ name: opal
21
20
  prerelease: false
21
+ type: :runtime
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.7'
27
27
  - !ruby/object:Gem::Dependency
28
- name: bowser
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - "~>"
32
31
  - !ruby/object:Gem::Version
33
32
  version: 0.1.2
34
- type: :runtime
33
+ name: bowser
35
34
  prerelease: false
35
+ type: :runtime
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.1.2
41
41
  - !ruby/object:Gem::Dependency
42
- name: bundler
43
42
  requirement: !ruby/object:Gem::Requirement
44
43
  requirements:
45
44
  - - "~>"
46
45
  - !ruby/object:Gem::Version
47
46
  version: '1.3'
48
- type: :development
47
+ name: bundler
49
48
  prerelease: false
49
+ type: :development
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.3'
55
55
  - !ruby/object:Gem::Dependency
56
- name: opal-rspec
57
56
  requirement: !ruby/object:Gem::Requirement
58
57
  requirements:
59
58
  - - "~>"
60
59
  - !ruby/object:Gem::Version
61
60
  version: 0.5.0.beta2
62
- type: :development
61
+ name: opal-rspec
63
62
  prerelease: false
63
+ type: :development
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.5.0.beta2
69
69
  - !ruby/object:Gem::Dependency
70
- name: rake
71
70
  requirement: !ruby/object:Gem::Requirement
72
71
  requirements:
73
72
  - - "~>"
74
73
  - !ruby/object:Gem::Version
75
74
  version: '10.1'
76
- type: :development
75
+ name: rake
77
76
  prerelease: false
77
+ type: :development
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '10.1'
83
83
  - !ruby/object:Gem::Dependency
84
- name: pry
85
84
  requirement: !ruby/object:Gem::Requirement
86
85
  requirements:
87
86
  - - "~>"
88
87
  - !ruby/object:Gem::Version
89
88
  version: '0.9'
90
- type: :development
89
+ name: pry
91
90
  prerelease: false
91
+ type: :development
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
@@ -127,7 +127,7 @@ homepage: https://clearwater-rb.github.io/
127
127
  licenses:
128
128
  - MIT
129
129
  metadata: {}
130
- post_install_message:
130
+ post_install_message:
131
131
  rdoc_options: []
132
132
  require_paths:
133
133
  - lib
@@ -142,15 +142,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  - !ruby/object:Gem::Version
143
143
  version: 1.3.1
144
144
  requirements: []
145
- rubyforge_project:
146
- rubygems_version: 2.4.5.1
147
- signing_key:
145
+ rubyforge_project:
146
+ rubygems_version: 2.4.8
147
+ signing_key:
148
148
  specification_version: 4
149
149
  summary: Front-end Ruby web framework for fast, reasonable, and composable applications
150
150
  test_files:
151
+ - spec/component_spec.rb
151
152
  - spec/clearwater/application_spec.rb
152
153
  - spec/clearwater/black_box_node_spec.rb
153
154
  - spec/clearwater/cached_render_spec.rb
154
155
  - spec/clearwater/dom_reference_spec.rb
155
156
  - spec/clearwater/router_spec.rb
156
- - spec/component_spec.rb