clapton 0.0.24 → 0.0.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -113
  3. data/lib/clapton/javascripts/dist/c-for-test.js +108 -271
  4. data/lib/clapton/javascripts/dist/c.js +108 -271
  5. data/lib/clapton/javascripts/dist/components-for-test.js +69 -245
  6. data/lib/clapton/javascripts/dist/components.js +68 -241
  7. data/lib/clapton/javascripts/src/c-base.ts +45 -33
  8. data/lib/clapton/javascripts/src/components/{box.ts → base.ts} +6 -8
  9. data/lib/clapton/javascripts/src/components/block-quote.spec.ts +1 -1
  10. data/lib/clapton/javascripts/src/components/block-quote.ts +2 -14
  11. data/lib/clapton/javascripts/src/components/bold.ts +2 -14
  12. data/lib/clapton/javascripts/src/components/button.ts +2 -19
  13. data/lib/clapton/javascripts/src/components/code.ts +2 -14
  14. data/lib/clapton/javascripts/src/components/component.ts +2 -2
  15. data/lib/clapton/javascripts/src/components/{box.spec.ts → div.spec.ts} +8 -8
  16. data/lib/clapton/javascripts/src/components/div.ts +8 -0
  17. data/lib/clapton/javascripts/src/components/element.ts +3 -9
  18. data/lib/clapton/javascripts/src/components/emphasis.ts +2 -14
  19. data/lib/clapton/javascripts/src/components/form.ts +2 -14
  20. data/lib/clapton/javascripts/src/components/heading.ts +4 -10
  21. data/lib/clapton/javascripts/src/components/image.spec.ts +2 -2
  22. data/lib/clapton/javascripts/src/components/image.ts +3 -14
  23. data/lib/clapton/javascripts/src/components/input.spec.ts +16 -0
  24. data/lib/clapton/javascripts/src/components/{datetime-field.ts → input.ts} +9 -11
  25. data/lib/clapton/javascripts/src/components/link.spec.ts +6 -6
  26. data/lib/clapton/javascripts/src/components/link.ts +3 -16
  27. data/lib/clapton/javascripts/src/components/list-item.ts +2 -14
  28. data/lib/clapton/javascripts/src/components/list.ts +2 -14
  29. data/lib/clapton/javascripts/src/components/ordered-list.ts +2 -14
  30. data/lib/clapton/javascripts/src/components/paragraph.ts +2 -14
  31. data/lib/clapton/javascripts/src/components/quote.ts +2 -14
  32. data/lib/clapton/javascripts/src/components/select.ts +3 -5
  33. data/lib/clapton/javascripts/src/components/span.ts +2 -14
  34. data/lib/clapton/javascripts/src/components/text-area.ts +4 -9
  35. data/lib/clapton/javascripts/src/components-for-test.ts +3 -6
  36. data/lib/clapton/javascripts/src/components.ts +3 -6
  37. data/lib/clapton/test_helper/base.rb +4 -4
  38. data/lib/clapton/version.rb +1 -1
  39. metadata +7 -14
  40. data/lib/clapton/javascripts/dist/c +0 -559
  41. data/lib/clapton/javascripts/dist/c-base.js +0 -589
  42. data/lib/clapton/javascripts/src/components/checkbox.spec.ts +0 -16
  43. data/lib/clapton/javascripts/src/components/checkbox.ts +0 -23
  44. data/lib/clapton/javascripts/src/components/datetime-field.spec.ts +0 -16
  45. data/lib/clapton/javascripts/src/components/radio-button.spec.ts +0 -16
  46. data/lib/clapton/javascripts/src/components/radio-button.ts +0 -23
  47. data/lib/clapton/javascripts/src/components/text-field.spec.ts +0 -16
  48. data/lib/clapton/javascripts/src/components/text-field.ts +0 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f15ceb3c247b4a620ea3508dc66511a2d7beb4f2e1bc32a24dd8e69bd0d70332
4
- data.tar.gz: 329b1b8107968efdcce936a4f71deb904e5a609d846ca245d8c90cc7040ba144
3
+ metadata.gz: 99a804644eba855e4437d0fda777f485e772d6a9d6330509806f1569d5ad09fc
4
+ data.tar.gz: c2b96b526a162c67a948bc95b2dc3f0fcf06a39e0a0330f8433d75da16df6cf8
5
5
  SHA512:
6
- metadata.gz: 24846c65443543d58f3e8f6f6018b5ace3af64166be9b9e2bde2bd0aa5056c7bd2f148ba43b7171a7e43756d0eb485bebaad9fca5ad57a913b038bead70baf8e
7
- data.tar.gz: 60aaeaae14b6277cd5323f5cf1e36201e94f2887e4c1655838ce37a13a58282de3b05c729e2a8212b2e1705f7e4e538f0b2f2b78e57b872f089d9956acc58b57
6
+ metadata.gz: c4bb2828252d78c4983053cc35820879f27a54192eb5bbb8c87f3a7c1948a0205a8298b40f665987473cfc8e8ac1e9f8f5bd083743b8f6fa643d2b4d9b11b91c
7
+ data.tar.gz: 396ff4ac17f4d18451f6f165fc00c5f9808c743cb31fd6ab57d8f75bff6a432c2853b3bc093174923bbd5ee514d10332bcb77df9847e575fff8d014570c2e0d8
data/README.md CHANGED
@@ -34,14 +34,14 @@ To use a Clapton component in your view:
34
34
  # app/components/task_list_component.rb
35
35
  class TaskListComponent < Clapton::Component
36
36
  def render
37
- box = c(:box)
37
+ div = c(:div)
38
38
  @state.tasks.each do |task|
39
- box.add(TaskItemComponent.new(id: task[:id], title: task[:title], due: task[:due], done: task[:done]))
39
+ div.add(TaskItemComponent.new(id: task[:id], title: task[:title], due: task[:due], done: task[:done]))
40
40
  end
41
41
  btn = c(:button)
42
42
  btn.add(c(:text, "Add Task"))
43
43
  btn.add_action(:click, :TaskListState, :add_task)
44
- box.add(btn)
44
+ div.add(btn)
45
45
  end
46
46
  end
47
47
 
@@ -51,7 +51,7 @@ end
51
51
  # app/components/task_item_component.rb
52
52
  class TaskItemComponent < Clapton::Component
53
53
  def render
54
- box = c(:box)
54
+ div = c(:div)
55
55
  btn = c(:button)
56
56
  btn.add(c(:text, @state.done ? "✅" : "🟩"))
57
57
  btn.add_action(:click, :TaskListState, :toggle_done)
@@ -62,7 +62,7 @@ class TaskItemComponent < Clapton::Component
62
62
  dt = c(:datetime, @state, :due)
63
63
  dt.add_action(:input, :TaskListState, :update_due)
64
64
 
65
- box.add(btn).add(tf).add(dt)
65
+ div.add(btn).add(tf).add(dt)
66
66
  end
67
67
  end
68
68
 
@@ -171,8 +171,8 @@ The `render` event is a special event that is triggered when the component is re
171
171
  class TaskListComponent < Clapton::Component
172
172
  def render
173
173
  # ...
174
- box = c(:box)
175
- box.add_action(:render, :TaskListState, :add_empty_task, debounce: 500)
174
+ div = c(:div)
175
+ div.add_action(:render, :TaskListState, :add_empty_task, debounce: 500)
176
176
  end
177
177
  end
178
178
  ```
@@ -201,112 +201,6 @@ class VideoPlayerComponent < Clapton::Component
201
201
  end
202
202
  ```
203
203
 
204
- ### Preset Components Classes
205
-
206
- ```ruby
207
- block_quote = Clapton::BlockQuote.new
208
- block_quote.add(Clapton::Text.new("Hello"))
209
-
210
- box = Clapton::Box.new
211
- box.add(Clapton::Text.new("Hello"))
212
-
213
- button = Clapton::Button.new
214
- button.add(Clapton::Text.new("Click me"))
215
- button.add_action(:click, :TaskListState, :add_task)
216
-
217
- checkbox = Clapton::Checkbox.new(:ExampleState, :example_attribute, { id: "example-checkbox" })
218
- checkbox.add_action(:change, :ExampleState, :update_example_attribute)
219
-
220
- code = Clapton::Code.new
221
- code.add(Clapton::Text.new("Hello"))
222
-
223
- datetime_field = Clapton::DateTimeField.new(:ExampleState, :example_attribute, { id: "example-datetime-field" })
224
-
225
- element = Clapton::Element.new("div", { id: "example-element" })
226
- element.add(Clapton::Text.new("Hello"))
227
-
228
- embed = Clapton::Embed.new("<blockquote>This is a test</blockquote>")
229
-
230
- emphasis = Clapton::Emphasis.new
231
- emphasis.add(Clapton::Text.new("Hello"))
232
-
233
- form = Clapton::Form.new
234
- form.add(Clapton::Text.new("Hello"))
235
-
236
- heading = Clapton::Heading.new(1)
237
- heading.add(Clapton::Text.new("Hello"))
238
-
239
- image = Clapton::Image.new("https://example.com/image.png", "Example Image")
240
-
241
- link = Clapton::Link.new("https://example.com")
242
- link.add(Clapton::Text.new("Example Link"))
243
-
244
- list = Clapton::List.new
245
- (1..3).each do
246
- item = Clapton::ListItem.new
247
- item.add(Clapton::Text.new("Item #{i}"))
248
- list.add(item)
249
- end
250
-
251
- ordered_list = Clapton::OrderedList.new
252
- (1..3).each do
253
- item = Clapton::ListItem.new
254
- item.add(Clapton::Text.new("Item #{i}"))
255
- ordered_list.add(item)
256
- end
257
-
258
- paragraph = Clapton::Paragraph.new
259
- paragraph.add(Clapton::Text.new("Hello"))
260
-
261
- quote = Clapton::Quote.new
262
- quote.add(Clapton::Text.new("Hello"))
263
-
264
- radio_button = Clapton::RadioButton.new(:ExampleState, :example_attribute, { id: "example-radio-button" })
265
- radio_button.add_action(:change, :ExampleState, :update_example_attribute)
266
-
267
- select = Clapton::Select.new([{ value: "1", text: "One" }, { value: "2", text: "Two" }], :ExampleState, :example_attribute, { id: "example-select" })
268
- select.add_action(:change, :ExampleState, :update_example_attribute)
269
-
270
- span = Clapton::Span.new
271
- span.add(Clapton::Text.new("Hello"))
272
-
273
- text_area = Clapton::TextArea.new(:ExampleState, :example_attribute, { id: "example-text-area" })
274
-
275
- text_field = Clapton::TextField.new(:ExampleState, :example_attribute, { id: "example-text-field" })
276
-
277
- text = Clapton::Text.new("Hello")`
278
- ```
279
-
280
- ### Preset Component Methods
281
-
282
- ```javascript
283
- c(:bq, ...props)
284
- c(:box, ...props)
285
- c(:b, ...props)
286
- c(:button, ...props)
287
- c(:check, ...props)
288
- c(:code, ...props)
289
- c(:datetime, ...props)
290
- c(:el, ...props)
291
- c(:embed, ...props)
292
- c(:em, ...props)
293
- c(:form, ...props)
294
- c(:h, ...props)
295
- c(:img, ...props)
296
- c(:a, ...props)
297
- c(:li, ...props)
298
- c(:ul, ...props)
299
- c(:ol, ...props)
300
- c(:p, ...props)
301
- c(:q, ...props)
302
- c(:radio, ...props)
303
- c(:select, ...props)
304
- c(:span, ...props)
305
- c(:textarea, ...props)
306
- c(:input, ...props)
307
- c(:text, ...props)
308
- ```
309
-
310
204
  ### Streaming
311
205
 
312
206
  Clapton supports streaming.