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