clapton 0.0.24 → 0.0.26
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 +4 -4
- data/README.md +7 -113
- data/app/channels/clapton/clapton_channel.rb +4 -0
- data/lib/clapton/javascripts/dist/c-for-test.js +124 -268
- data/lib/clapton/javascripts/dist/c.js +124 -268
- data/lib/clapton/javascripts/dist/client.js +6 -31
- data/lib/clapton/javascripts/dist/components-for-test.js +73 -245
- data/lib/clapton/javascripts/dist/components.js +72 -241
- data/lib/clapton/javascripts/src/actions/handle-action.ts +3 -2
- data/lib/clapton/javascripts/src/c-base.ts +57 -30
- data/lib/clapton/javascripts/src/channel/clapton-channel.js +3 -2
- data/lib/clapton/javascripts/src/client.ts +0 -3
- data/lib/clapton/javascripts/src/components/{box.ts → base.ts} +6 -8
- data/lib/clapton/javascripts/src/components/block-quote.spec.ts +1 -1
- data/lib/clapton/javascripts/src/components/block-quote.ts +2 -14
- data/lib/clapton/javascripts/src/components/bold.ts +2 -14
- data/lib/clapton/javascripts/src/components/button.ts +2 -19
- data/lib/clapton/javascripts/src/components/code.ts +2 -14
- data/lib/clapton/javascripts/src/components/component.ts +2 -2
- data/lib/clapton/javascripts/src/components/{box.spec.ts → div.spec.ts} +8 -8
- data/lib/clapton/javascripts/src/components/div.ts +8 -0
- data/lib/clapton/javascripts/src/components/element.ts +3 -9
- data/lib/clapton/javascripts/src/components/emphasis.ts +2 -14
- data/lib/clapton/javascripts/src/components/form.ts +2 -14
- data/lib/clapton/javascripts/src/components/heading.ts +4 -10
- data/lib/clapton/javascripts/src/components/image.spec.ts +2 -2
- data/lib/clapton/javascripts/src/components/image.ts +3 -14
- data/lib/clapton/javascripts/src/components/input.spec.ts +16 -0
- data/lib/clapton/javascripts/src/components/{datetime-field.ts → input.ts} +13 -11
- data/lib/clapton/javascripts/src/components/link.spec.ts +6 -6
- data/lib/clapton/javascripts/src/components/link.ts +3 -16
- data/lib/clapton/javascripts/src/components/list-item.ts +2 -14
- data/lib/clapton/javascripts/src/components/list.ts +2 -14
- data/lib/clapton/javascripts/src/components/ordered-list.ts +2 -14
- data/lib/clapton/javascripts/src/components/paragraph.ts +2 -14
- data/lib/clapton/javascripts/src/components/quote.ts +2 -14
- data/lib/clapton/javascripts/src/components/select.ts +3 -5
- data/lib/clapton/javascripts/src/components/span.ts +2 -14
- data/lib/clapton/javascripts/src/components/text-area.ts +4 -9
- data/lib/clapton/javascripts/src/components-for-test.ts +3 -6
- data/lib/clapton/javascripts/src/components.ts +3 -6
- data/lib/clapton/test_helper/base.rb +4 -4
- data/lib/clapton/version.rb +1 -1
- metadata +7 -16
- data/lib/clapton/javascripts/dist/c +0 -559
- data/lib/clapton/javascripts/dist/c-base.js +0 -589
- data/lib/clapton/javascripts/src/components/checkbox.spec.ts +0 -16
- data/lib/clapton/javascripts/src/components/checkbox.ts +0 -23
- data/lib/clapton/javascripts/src/components/datetime-field.spec.ts +0 -16
- data/lib/clapton/javascripts/src/components/radio-button.spec.ts +0 -16
- data/lib/clapton/javascripts/src/components/radio-button.ts +0 -23
- data/lib/clapton/javascripts/src/components/text-field.spec.ts +0 -16
- data/lib/clapton/javascripts/src/components/text-field.ts +0 -23
- data/lib/clapton/javascripts/src/dom/update-component.ts +0 -11
- data/lib/clapton/javascripts/src/inputs/initialize-inputs.ts +0 -16
@@ -43,21 +43,7 @@ var c = (function () {
|
|
43
43
|
.replace(/'/g, "'");
|
44
44
|
};
|
45
45
|
|
46
|
-
class
|
47
|
-
constructor(attributes = {}) {
|
48
|
-
this.children = [];
|
49
|
-
this.attributes = attributes;
|
50
|
-
}
|
51
|
-
get renderWrapper() {
|
52
|
-
return `<blockquote ${htmlAttributes(this.attributes)}>${this.children.map(child => child.renderWrapper).join("")}</blockquote>`;
|
53
|
-
}
|
54
|
-
add(child) {
|
55
|
-
this.children.push(child);
|
56
|
-
return this;
|
57
|
-
}
|
58
|
-
}
|
59
|
-
|
60
|
-
class Box {
|
46
|
+
class Base {
|
61
47
|
constructor(attributes = {}) {
|
62
48
|
this.children = [];
|
63
49
|
this.attributes = attributes;
|
@@ -66,132 +52,54 @@ var c = (function () {
|
|
66
52
|
this.children.push(child);
|
67
53
|
return this;
|
68
54
|
}
|
69
|
-
get renderWrapper() {
|
70
|
-
return `<div ${htmlAttributes(this.attributes)}>${this.children.map(child => child.renderWrapper).join("")}</div>`;
|
71
|
-
}
|
72
55
|
add_action(eventType, stateName, fnName, options = {}) {
|
73
56
|
this.attributes["data-action"] = `${this.attributes["data-action"] || ""} ${eventType}->${stateName}#${fnName}@${options.debounce || 0}`;
|
74
57
|
return this;
|
75
58
|
}
|
59
|
+
get renderWrapper() {
|
60
|
+
return "";
|
61
|
+
}
|
76
62
|
}
|
77
63
|
|
78
|
-
class
|
79
|
-
constructor(attributes = {}) {
|
80
|
-
this.attributes = attributes;
|
81
|
-
this.children = [];
|
82
|
-
}
|
83
|
-
add(child) {
|
84
|
-
this.children.push(child);
|
85
|
-
return this;
|
86
|
-
}
|
64
|
+
class BlockQuote extends Base {
|
87
65
|
get renderWrapper() {
|
88
|
-
return `<
|
89
|
-
}
|
90
|
-
add_action(event, klass, fn, options = {}) {
|
91
|
-
this.attributes["data-action"] = `${this.attributes["data-action"] || ""} ${event}->${klass}#${fn}@${options.debounce || 0}`;
|
92
|
-
return this;
|
66
|
+
return `<blockquote ${htmlAttributes(this.attributes)}>${this.children.map(child => child.renderWrapper).join("")}</blockquote>`;
|
93
67
|
}
|
94
68
|
}
|
95
69
|
|
96
|
-
class
|
97
|
-
constructor(attributes = {}) {
|
98
|
-
this.children = [];
|
99
|
-
this.attributes = attributes;
|
100
|
-
}
|
70
|
+
class Div extends Base {
|
101
71
|
get renderWrapper() {
|
102
|
-
return `<
|
103
|
-
}
|
104
|
-
add(child) {
|
105
|
-
this.children.push(child);
|
106
|
-
return this;
|
72
|
+
return `<div ${htmlAttributes(this.attributes)}>${this.children.map(child => child.renderWrapper).join("")}</div>`;
|
107
73
|
}
|
108
74
|
}
|
109
75
|
|
110
|
-
class
|
111
|
-
constructor(state, attribute, attributes = {}) {
|
112
|
-
this.state = state;
|
113
|
-
this.attributes = attributes;
|
114
|
-
this.attribute = attribute;
|
115
|
-
this.attributes["data-attribute"] = attribute;
|
116
|
-
}
|
76
|
+
class Button extends Base {
|
117
77
|
get renderWrapper() {
|
118
|
-
return `<
|
119
|
-
}
|
120
|
-
add_action(event, klass, fn, options = {}) {
|
121
|
-
this.attributes["data-action"] = `${this.attributes["data-action"] || ""} ${event}->${klass}#${fn}@${options.debounce || 0}`;
|
122
|
-
return this;
|
78
|
+
return `<button ${htmlAttributes(this.attributes)}>${this.children.map(child => child.renderWrapper).join("")}</button>`;
|
123
79
|
}
|
124
80
|
}
|
125
81
|
|
126
|
-
class
|
127
|
-
constructor(attributes = {}) {
|
128
|
-
this.children = [];
|
129
|
-
this.attributes = attributes;
|
130
|
-
}
|
82
|
+
class Bold extends Base {
|
131
83
|
get renderWrapper() {
|
132
|
-
return `<
|
133
|
-
}
|
134
|
-
add(child) {
|
135
|
-
this.children.push(child);
|
136
|
-
return this;
|
84
|
+
return `<strong ${htmlAttributes(this.attributes)}>${this.children.map(child => child.renderWrapper).join("")}</strong>`;
|
137
85
|
}
|
138
86
|
}
|
139
87
|
|
140
|
-
class
|
141
|
-
constructor(state, attribute, attributes = {}) {
|
142
|
-
this.attributes = {};
|
143
|
-
this.state = state;
|
144
|
-
this.attribute = attribute;
|
145
|
-
this.attributes = attributes;
|
146
|
-
this.attributes["data-attribute"] = attribute;
|
147
|
-
}
|
88
|
+
class Code extends Base {
|
148
89
|
get renderWrapper() {
|
149
|
-
|
150
|
-
return `<input type='datetime-local' ${htmlAttributes(this.attributes)} value='${value}'/>`;
|
151
|
-
}
|
152
|
-
add_action(event, klass, fn, options = {}) {
|
153
|
-
this.attributes["data-action"] = `${this.attributes["data-action"] || ""} ${event}->${klass}#${fn}@${options.debounce || 0}`;
|
154
|
-
return this;
|
155
|
-
}
|
156
|
-
datetime_local_value(value) {
|
157
|
-
if (!value) {
|
158
|
-
return "";
|
159
|
-
}
|
160
|
-
const date = new Date(value);
|
161
|
-
date.setMinutes(date.getMinutes() - date.getTimezoneOffset());
|
162
|
-
let month = date.getMonth() + 1;
|
163
|
-
let day = date.getDate();
|
164
|
-
let hours = date.getHours();
|
165
|
-
let minutes = date.getMinutes();
|
166
|
-
if (month < 10) {
|
167
|
-
month = `0${month}`;
|
168
|
-
}
|
169
|
-
if (day < 10) {
|
170
|
-
day = `0${day}`;
|
171
|
-
}
|
172
|
-
if (hours < 10) {
|
173
|
-
hours = `0${hours}`;
|
174
|
-
}
|
175
|
-
if (minutes < 10) {
|
176
|
-
minutes = `0${minutes}`;
|
177
|
-
}
|
178
|
-
return `${date.getFullYear()}-${month}-${day}T${hours}:${minutes}`;
|
90
|
+
return `<code ${htmlAttributes(this.attributes)}>${this.children.map(child => child.renderWrapper).join("")}</code>`;
|
179
91
|
}
|
180
92
|
}
|
181
93
|
|
182
|
-
class Element {
|
94
|
+
class Element extends Base {
|
183
95
|
constructor(type, attributes = {}) {
|
96
|
+
super(attributes);
|
184
97
|
this.children = [];
|
185
98
|
this.type = type;
|
186
|
-
this.attributes = attributes;
|
187
99
|
}
|
188
100
|
get renderWrapper() {
|
189
101
|
return `<${this.type} ${htmlAttributes(this.attributes)}>${this.children.map(child => child.renderWrapper).join("")}</${this.type}>`;
|
190
102
|
}
|
191
|
-
add(child) {
|
192
|
-
this.children.push(child);
|
193
|
-
return this;
|
194
|
-
}
|
195
103
|
}
|
196
104
|
|
197
105
|
class Embed {
|
@@ -203,187 +111,86 @@ var c = (function () {
|
|
203
111
|
}
|
204
112
|
}
|
205
113
|
|
206
|
-
class Emphasis {
|
207
|
-
constructor(attributes = {}) {
|
208
|
-
this.children = [];
|
209
|
-
this.attributes = attributes;
|
210
|
-
}
|
114
|
+
class Emphasis extends Base {
|
211
115
|
get renderWrapper() {
|
212
116
|
return `<em ${htmlAttributes(this.attributes)}>${this.children.map(child => child.renderWrapper).join("")}</em>`;
|
213
117
|
}
|
214
|
-
add(child) {
|
215
|
-
this.children.push(child);
|
216
|
-
return this;
|
217
|
-
}
|
218
118
|
}
|
219
119
|
|
220
|
-
class Form {
|
221
|
-
constructor(attributes = {}) {
|
222
|
-
this.children = [];
|
223
|
-
this.attributes = attributes;
|
224
|
-
}
|
120
|
+
class Form extends Base {
|
225
121
|
get renderWrapper() {
|
226
122
|
return `<form ${htmlAttributes(this.attributes)}>${this.children.map(child => child.renderWrapper).join("")}</form>`;
|
227
123
|
}
|
228
|
-
add(child) {
|
229
|
-
this.children.push(child);
|
230
|
-
return this;
|
231
|
-
}
|
232
124
|
}
|
233
125
|
|
234
|
-
class Heading {
|
126
|
+
class Heading extends Base {
|
235
127
|
constructor(level, attributes = {}) {
|
236
|
-
|
128
|
+
super(attributes);
|
237
129
|
this.level = level;
|
238
|
-
this.attributes = attributes;
|
239
130
|
}
|
240
131
|
get renderWrapper() {
|
241
132
|
return `<h${this.level} ${htmlAttributes(this.attributes)}>${this.children.map(child => child.renderWrapper).join("")}</h${this.level}>`;
|
242
133
|
}
|
243
|
-
add(child) {
|
244
|
-
this.children.push(child);
|
245
|
-
return this;
|
246
|
-
}
|
247
134
|
}
|
248
135
|
|
249
|
-
class Image {
|
250
|
-
constructor(src, alt, attributes = {}) {
|
251
|
-
this.children = [];
|
252
|
-
this.attributes = attributes;
|
253
|
-
this.src = src;
|
254
|
-
this.alt = alt;
|
255
|
-
}
|
136
|
+
class Image extends Base {
|
256
137
|
get renderWrapper() {
|
257
|
-
return `<img
|
138
|
+
return `<img ${htmlAttributes(this.attributes)}/>`;
|
258
139
|
}
|
259
140
|
}
|
260
141
|
|
261
|
-
class Link {
|
262
|
-
constructor(href, attributes = {}) {
|
263
|
-
this.children = [];
|
264
|
-
this.attributes = attributes;
|
265
|
-
this.href = href;
|
266
|
-
}
|
142
|
+
class Link extends Base {
|
267
143
|
get renderWrapper() {
|
268
|
-
return `<a
|
269
|
-
}
|
270
|
-
add(child) {
|
271
|
-
this.children.push(child);
|
272
|
-
return this;
|
144
|
+
return `<a ${htmlAttributes(this.attributes)}>${this.children.map(child => child.renderWrapper).join("")}</a>`;
|
273
145
|
}
|
274
146
|
}
|
275
147
|
|
276
|
-
class ListItem {
|
277
|
-
constructor(attributes = {}) {
|
278
|
-
this.children = [];
|
279
|
-
this.attributes = attributes;
|
280
|
-
}
|
281
|
-
add(child) {
|
282
|
-
this.children.push(child);
|
283
|
-
return this;
|
284
|
-
}
|
148
|
+
class ListItem extends Base {
|
285
149
|
get renderWrapper() {
|
286
150
|
return `<li ${htmlAttributes(this.attributes)}>${this.children.map(child => child.renderWrapper).join("")}</li>`;
|
287
151
|
}
|
288
152
|
}
|
289
153
|
|
290
|
-
class List {
|
291
|
-
constructor(attributes = {}) {
|
292
|
-
this.children = [];
|
293
|
-
this.attributes = attributes;
|
294
|
-
}
|
295
|
-
add(child) {
|
296
|
-
this.children.push(child);
|
297
|
-
return this;
|
298
|
-
}
|
154
|
+
class List extends Base {
|
299
155
|
get renderWrapper() {
|
300
156
|
return `<ul ${htmlAttributes(this.attributes)}>${this.children.map(child => child.renderWrapper).join("")}</ul>`;
|
301
157
|
}
|
302
158
|
}
|
303
159
|
|
304
|
-
class OrderedList {
|
305
|
-
constructor(attributes = {}) {
|
306
|
-
this.children = [];
|
307
|
-
this.attributes = attributes;
|
308
|
-
}
|
309
|
-
add(child) {
|
310
|
-
this.children.push(child);
|
311
|
-
return this;
|
312
|
-
}
|
160
|
+
class OrderedList extends Base {
|
313
161
|
get renderWrapper() {
|
314
162
|
return `<ol ${htmlAttributes(this.attributes)}>${this.children.map(child => child.renderWrapper).join("")}</ol>`;
|
315
163
|
}
|
316
164
|
}
|
317
165
|
|
318
|
-
class Paragraph {
|
319
|
-
constructor(attributes = {}) {
|
320
|
-
this.children = [];
|
321
|
-
this.attributes = attributes;
|
322
|
-
}
|
166
|
+
class Paragraph extends Base {
|
323
167
|
get renderWrapper() {
|
324
168
|
return `<p ${htmlAttributes(this.attributes)}>${this.children.map(child => child.renderWrapper).join("")}</p>`;
|
325
169
|
}
|
326
|
-
add(child) {
|
327
|
-
this.children.push(child);
|
328
|
-
return this;
|
329
|
-
}
|
330
170
|
}
|
331
171
|
|
332
|
-
class Quote {
|
333
|
-
constructor(attributes = {}) {
|
334
|
-
this.children = [];
|
335
|
-
this.attributes = attributes;
|
336
|
-
}
|
172
|
+
class Quote extends Base {
|
337
173
|
get renderWrapper() {
|
338
174
|
return `<q ${htmlAttributes(this.attributes)}>${this.children.map(child => child.renderWrapper).join("")}</q>`;
|
339
175
|
}
|
340
|
-
add(child) {
|
341
|
-
this.children.push(child);
|
342
|
-
return this;
|
343
|
-
}
|
344
176
|
}
|
345
177
|
|
346
|
-
class
|
347
|
-
constructor(state, attribute, attributes = {}) {
|
348
|
-
this.state = state;
|
349
|
-
this.attributes = attributes;
|
350
|
-
this.attribute = attribute;
|
351
|
-
this.attributes["data-attribute"] = attribute;
|
352
|
-
}
|
353
|
-
get renderWrapper() {
|
354
|
-
return `<input type='radio' ${htmlAttributes(this.attributes)} value='${this.state[this.attribute] || ""}'/>`;
|
355
|
-
}
|
356
|
-
add_action(event, klass, fn, options = {}) {
|
357
|
-
this.attributes["data-action"] = `${this.attributes["data-action"] || ""} ${event}->${klass}#${fn}@${options.debounce || 0}`;
|
358
|
-
return this;
|
359
|
-
}
|
360
|
-
}
|
361
|
-
|
362
|
-
class Select {
|
178
|
+
class Select extends Base {
|
363
179
|
constructor(options = [], state, attribute, attributes = {}) {
|
364
|
-
|
180
|
+
super(attributes);
|
365
181
|
this.options = options;
|
366
182
|
this.state = state;
|
367
183
|
this.attribute = attribute;
|
368
|
-
this.attributes = attributes;
|
369
184
|
}
|
370
185
|
get renderWrapper() {
|
371
186
|
return `<select ${htmlAttributes(this.attributes)}>${this.options.map(option => `<option value='${option.value}'${option.value === this.state[this.attribute] ? " selected" : ""}>${option.text}</option>`).join("")}${this.children.map(child => child.renderWrapper).join("")}</select>`;
|
372
187
|
}
|
373
188
|
}
|
374
189
|
|
375
|
-
class Span {
|
376
|
-
constructor(attributes = {}) {
|
377
|
-
this.children = [];
|
378
|
-
this.attributes = attributes;
|
379
|
-
}
|
190
|
+
class Span extends Base {
|
380
191
|
get renderWrapper() {
|
381
192
|
return `<span ${htmlAttributes(this.attributes)}>${this.children.map(child => child.renderWrapper).join("")}</span>`;
|
382
193
|
}
|
383
|
-
add(child) {
|
384
|
-
this.children.push(child);
|
385
|
-
return this;
|
386
|
-
}
|
387
194
|
}
|
388
195
|
|
389
196
|
class Component {
|
@@ -393,7 +200,7 @@ var c = (function () {
|
|
393
200
|
this._errors = errors;
|
394
201
|
}
|
395
202
|
get render() {
|
396
|
-
return new
|
203
|
+
return new Div({});
|
397
204
|
}
|
398
205
|
get renderWrapper() {
|
399
206
|
const root = this.render;
|
@@ -428,19 +235,47 @@ var c = (function () {
|
|
428
235
|
}
|
429
236
|
Component._effects = [];
|
430
237
|
|
431
|
-
class
|
238
|
+
class Input extends Base {
|
432
239
|
constructor(state, attribute, attributes = {}) {
|
433
|
-
|
434
|
-
this.attributes = attributes;
|
240
|
+
super(attributes);
|
435
241
|
this.attribute = attribute;
|
242
|
+
this.state = state;
|
436
243
|
this.attributes["data-attribute"] = attribute;
|
244
|
+
this.attributes["data-id"] = Math.random().toString(36).substring(2, 10);
|
437
245
|
}
|
438
246
|
get renderWrapper() {
|
439
|
-
|
247
|
+
let value = this.state[this.attribute];
|
248
|
+
if (!this.attributes.type) {
|
249
|
+
this.attributes.type = "text";
|
250
|
+
}
|
251
|
+
if (this.attributes.type === "datetime-local" && value) {
|
252
|
+
value = this.datetime_local_value(value);
|
253
|
+
}
|
254
|
+
return `<input ${htmlAttributes(this.attributes)} value='${value || ""}'/>`;
|
440
255
|
}
|
441
|
-
|
442
|
-
|
443
|
-
|
256
|
+
datetime_local_value(value) {
|
257
|
+
if (!value) {
|
258
|
+
return "";
|
259
|
+
}
|
260
|
+
const date = new Date(value);
|
261
|
+
date.setMinutes(date.getMinutes() - date.getTimezoneOffset());
|
262
|
+
let month = date.getMonth() + 1;
|
263
|
+
let day = date.getDate();
|
264
|
+
let hours = date.getHours();
|
265
|
+
let minutes = date.getMinutes();
|
266
|
+
if (month < 10) {
|
267
|
+
month = `0${month}`;
|
268
|
+
}
|
269
|
+
if (day < 10) {
|
270
|
+
day = `0${day}`;
|
271
|
+
}
|
272
|
+
if (hours < 10) {
|
273
|
+
hours = `0${hours}`;
|
274
|
+
}
|
275
|
+
if (minutes < 10) {
|
276
|
+
minutes = `0${minutes}`;
|
277
|
+
}
|
278
|
+
return `${date.getFullYear()}-${month}-${day}T${hours}:${minutes}`;
|
444
279
|
}
|
445
280
|
}
|
446
281
|
|
@@ -453,31 +288,27 @@ var c = (function () {
|
|
453
288
|
}
|
454
289
|
}
|
455
290
|
|
456
|
-
class TextArea {
|
291
|
+
class TextArea extends Base {
|
457
292
|
constructor(state, attribute, attributes = {}) {
|
458
|
-
|
459
|
-
this.attributes = attributes;
|
293
|
+
super(attributes);
|
460
294
|
this.attribute = attribute;
|
295
|
+
this.state = state;
|
461
296
|
this.attributes["data-attribute"] = attribute;
|
462
297
|
}
|
463
298
|
get renderWrapper() {
|
464
299
|
return `<textarea ${htmlAttributes(this.attributes)}>${this.state[this.attribute] || ""}</textarea>`;
|
465
300
|
}
|
466
|
-
add_action(event, klass, fn, options = {}) {
|
467
|
-
this.attributes["data-action"] = `${this.attributes["data-action"] || ""} ${event}->${klass}#${fn}@${options.debounce || 0}`;
|
468
|
-
return this;
|
469
|
-
}
|
470
301
|
}
|
471
302
|
|
472
303
|
const Clapton = {
|
473
|
-
|
304
|
+
Div, Component, Text, Input, Button, BlockQuote, Code, Element, Emphasis, Form, Heading, Image, Link, List, ListItem, OrderedList, Paragraph, Quote, Select, Span, Embed, Bold, TextArea
|
474
305
|
};
|
475
306
|
|
476
|
-
const
|
307
|
+
const blockquote = (...props) => {
|
477
308
|
return new Clapton.BlockQuote(...props);
|
478
309
|
};
|
479
|
-
const
|
480
|
-
return new Clapton.
|
310
|
+
const div = (...props) => {
|
311
|
+
return new Clapton.Div(...props);
|
481
312
|
};
|
482
313
|
const b = (...props) => {
|
483
314
|
return new Clapton.Bold(...props);
|
@@ -485,15 +316,9 @@ var c = (function () {
|
|
485
316
|
const button = (...props) => {
|
486
317
|
return new Clapton.Button(...props);
|
487
318
|
};
|
488
|
-
const check = (...props) => {
|
489
|
-
return new Clapton.Checkbox(props[0], props[1], props[2]);
|
490
|
-
};
|
491
319
|
const code = (...props) => {
|
492
320
|
return new Clapton.Code(...props);
|
493
321
|
};
|
494
|
-
const datetime = (...props) => {
|
495
|
-
return new Clapton.DateTimeField(props[0], props[1], props[2]);
|
496
|
-
};
|
497
322
|
const el = (...props) => {
|
498
323
|
return new Clapton.Element(props[0], props[1]);
|
499
324
|
};
|
@@ -506,14 +331,29 @@ var c = (function () {
|
|
506
331
|
const form = (...props) => {
|
507
332
|
return new Clapton.Form(...props);
|
508
333
|
};
|
509
|
-
const
|
510
|
-
return new Clapton.Heading(
|
334
|
+
const h1 = (...props) => {
|
335
|
+
return new Clapton.Heading(1, props[1]);
|
336
|
+
};
|
337
|
+
const h2 = (...props) => {
|
338
|
+
return new Clapton.Heading(2, props[1]);
|
339
|
+
};
|
340
|
+
const h3 = (...props) => {
|
341
|
+
return new Clapton.Heading(3, props[1]);
|
342
|
+
};
|
343
|
+
const h4 = (...props) => {
|
344
|
+
return new Clapton.Heading(4, props[1]);
|
345
|
+
};
|
346
|
+
const h5 = (...props) => {
|
347
|
+
return new Clapton.Heading(5, props[1]);
|
348
|
+
};
|
349
|
+
const h6 = (...props) => {
|
350
|
+
return new Clapton.Heading(6, props[1]);
|
511
351
|
};
|
512
352
|
const img = (...props) => {
|
513
|
-
return new Clapton.Image(props[0]
|
353
|
+
return new Clapton.Image(props[0]);
|
514
354
|
};
|
515
355
|
const a = (...props) => {
|
516
|
-
return new Clapton.Link(props[0]
|
356
|
+
return new Clapton.Link(props[0]);
|
517
357
|
};
|
518
358
|
const li = (...props) => {
|
519
359
|
return new Clapton.ListItem(...props);
|
@@ -530,9 +370,6 @@ var c = (function () {
|
|
530
370
|
const q = (...props) => {
|
531
371
|
return new Clapton.Quote(...props);
|
532
372
|
};
|
533
|
-
const radio = (...props) => {
|
534
|
-
return new Clapton.RadioButton(props[0], props[1], props[2]);
|
535
|
-
};
|
536
373
|
const select = (...props) => {
|
537
374
|
return new Clapton.Select(props[0], props[1], props[2]);
|
538
375
|
};
|
@@ -543,7 +380,7 @@ var c = (function () {
|
|
543
380
|
return new Clapton.TextArea(props[0], props[1], props[2]);
|
544
381
|
};
|
545
382
|
const input = (...props) => {
|
546
|
-
return new Clapton.
|
383
|
+
return new Clapton.Input(props[0], props[1], props[2]);
|
547
384
|
};
|
548
385
|
const text = (...props) => {
|
549
386
|
return new Clapton.Text(props[0]);
|
@@ -551,19 +388,19 @@ var c = (function () {
|
|
551
388
|
const c = (name, ...props) => {
|
552
389
|
switch (name) {
|
553
390
|
case "bq":
|
554
|
-
return
|
391
|
+
return blockquote(...props);
|
555
392
|
case "box":
|
556
|
-
return
|
393
|
+
return div(...props);
|
394
|
+
case "blockquote":
|
395
|
+
return blockquote(...props);
|
396
|
+
case "div":
|
397
|
+
return div(...props);
|
557
398
|
case "b":
|
558
399
|
return b(...props);
|
559
400
|
case "button":
|
560
401
|
return button(...props);
|
561
|
-
case "check":
|
562
|
-
return check(...props);
|
563
402
|
case "code":
|
564
403
|
return code(...props);
|
565
|
-
case "datetime":
|
566
|
-
return datetime(...props);
|
567
404
|
case "el":
|
568
405
|
return el(...props);
|
569
406
|
case "embed":
|
@@ -573,7 +410,19 @@ var c = (function () {
|
|
573
410
|
case "form":
|
574
411
|
return form(...props);
|
575
412
|
case "h":
|
576
|
-
return
|
413
|
+
return h1(...props);
|
414
|
+
case "h1":
|
415
|
+
return h1(...props);
|
416
|
+
case "h2":
|
417
|
+
return h2(...props);
|
418
|
+
case "h3":
|
419
|
+
return h3(...props);
|
420
|
+
case "h4":
|
421
|
+
return h4(...props);
|
422
|
+
case "h5":
|
423
|
+
return h5(...props);
|
424
|
+
case "h6":
|
425
|
+
return h6(...props);
|
577
426
|
case "img":
|
578
427
|
return img(...props);
|
579
428
|
case "a":
|
@@ -588,8 +437,6 @@ var c = (function () {
|
|
588
437
|
return p(...props);
|
589
438
|
case "q":
|
590
439
|
return q(...props);
|
591
|
-
case "radio":
|
592
|
-
return radio(...props);
|
593
440
|
case "select":
|
594
441
|
return select(...props);
|
595
442
|
case "span":
|
@@ -600,8 +447,17 @@ var c = (function () {
|
|
600
447
|
return input(...props);
|
601
448
|
case "text":
|
602
449
|
return text(...props);
|
450
|
+
case "radio":
|
451
|
+
props[3].type = "radio";
|
452
|
+
return input(...props);
|
453
|
+
case "datetime":
|
454
|
+
props[3].type = "datetime-local";
|
455
|
+
return input(...props);
|
456
|
+
case "check":
|
457
|
+
props[3].type = "checkbox";
|
458
|
+
return input(...props);
|
603
459
|
default:
|
604
|
-
return new Clapton.
|
460
|
+
return new Clapton.Element(name, ...props);
|
605
461
|
}
|
606
462
|
};
|
607
463
|
|