UNPKG

9.27 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, '__esModule', { value: true });
4
5function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
7var _mergeJSXProps = _interopDefault(require('babel-helper-vue-jsx-merge-props'));
8
9var uid = (function () {
10 return Math.random().toString(36).substring(2);
11});
12
13var ContentLoader = {
14 name: 'ContentLoader',
15 functional: true,
16 props: {
17 width: {
18 type: [Number, String],
19 "default": 400
20 },
21 height: {
22 type: [Number, String],
23 "default": 130
24 },
25 speed: {
26 type: Number,
27 "default": 2
28 },
29 preserveAspectRatio: {
30 type: String,
31 "default": 'xMidYMid meet'
32 },
33 baseUrl: {
34 type: String,
35 "default": ''
36 },
37 primaryColor: {
38 type: String,
39 "default": '#f9f9f9'
40 },
41 secondaryColor: {
42 type: String,
43 "default": '#ecebeb'
44 },
45 primaryOpacity: {
46 type: Number,
47 "default": 1
48 },
49 secondaryOpacity: {
50 type: Number,
51 "default": 1
52 },
53 uniqueKey: {
54 type: String
55 },
56 animate: {
57 type: Boolean,
58 "default": true
59 }
60 },
61 render: function render(h, _ref) {
62 var props = _ref.props,
63 data = _ref.data,
64 children = _ref.children;
65 var idClip = props.uniqueKey ? props.uniqueKey + "-idClip" : uid();
66 var idGradient = props.uniqueKey ? props.uniqueKey + "-idGradient" : uid();
67 return h("svg", _mergeJSXProps([data, {
68 attrs: {
69 viewBox: "0 0 " + props.width + " " + props.height,
70 version: "1.1",
71 preserveAspectRatio: props.preserveAspectRatio
72 }
73 }]), [h("rect", {
74 style: {
75 fill: "url(" + props.baseUrl + "#" + idGradient + ")"
76 },
77 attrs: {
78 "clip-path": "url(" + props.baseUrl + "#" + idClip + ")",
79 x: "0",
80 y: "0",
81 width: props.width,
82 height: props.height
83 }
84 }), h("defs", [h("clipPath", {
85 attrs: {
86 id: idClip
87 }
88 }, [children || h("rect", {
89 attrs: {
90 x: "0",
91 y: "0",
92 rx: "5",
93 ry: "5",
94 width: props.width,
95 height: props.height
96 }
97 })]), h("linearGradient", {
98 attrs: {
99 id: idGradient
100 }
101 }, [h("stop", {
102 attrs: {
103 offset: "0%",
104 "stop-color": props.primaryColor,
105 "stop-opacity": props.primaryOpacity
106 }
107 }, [props.animate ? h("animate", {
108 attrs: {
109 attributeName: "offset",
110 values: "-2; 1",
111 dur: props.speed + "s",
112 repeatCount: "indefinite"
113 }
114 }) : null]), h("stop", {
115 attrs: {
116 offset: "50%",
117 "stop-color": props.secondaryColor,
118 "stop-opacity": props.secondaryOpacity
119 }
120 }, [props.animate ? h("animate", {
121 attrs: {
122 attributeName: "offset",
123 values: "-1.5; 1.5",
124 dur: props.speed + "s",
125 repeatCount: "indefinite"
126 }
127 }) : null]), h("stop", {
128 attrs: {
129 offset: "100%",
130 "stop-color": props.primaryColor,
131 "stop-opacity": props.primaryOpacity
132 }
133 }, [props.animate ? h("animate", {
134 attrs: {
135 attributeName: "offset",
136 values: "-1; 2",
137 dur: props.speed + "s",
138 repeatCount: "indefinite"
139 }
140 }) : null])])])]);
141 }
142};
143
144var BulletListLoader = {
145 name: 'BulletListLoader',
146 functional: true,
147 render: function render(h, _ref) {
148 var data = _ref.data;
149 return h(ContentLoader, data, [h("circle", {
150 attrs: {
151 cx: "10",
152 cy: "20",
153 r: "8"
154 }
155 }), h("rect", {
156 attrs: {
157 x: "25",
158 y: "15",
159 rx: "5",
160 ry: "5",
161 width: "220",
162 height: "10"
163 }
164 }), h("circle", {
165 attrs: {
166 cx: "10",
167 cy: "50",
168 r: "8"
169 }
170 }), h("rect", {
171 attrs: {
172 x: "25",
173 y: "45",
174 rx: "5",
175 ry: "5",
176 width: "220",
177 height: "10"
178 }
179 }), h("circle", {
180 attrs: {
181 cx: "10",
182 cy: "80",
183 r: "8"
184 }
185 }), h("rect", {
186 attrs: {
187 x: "25",
188 y: "75",
189 rx: "5",
190 ry: "5",
191 width: "220",
192 height: "10"
193 }
194 }), h("circle", {
195 attrs: {
196 cx: "10",
197 cy: "110",
198 r: "8"
199 }
200 }), h("rect", {
201 attrs: {
202 x: "25",
203 y: "105",
204 rx: "5",
205 ry: "5",
206 width: "220",
207 height: "10"
208 }
209 })]);
210 }
211};
212
213var CodeLoader = {
214 name: 'CodeLoader',
215 functional: true,
216 render: function render(h, _ref) {
217 var data = _ref.data;
218 return h(ContentLoader, data, [h("rect", {
219 attrs: {
220 x: "0",
221 y: "0",
222 rx: "3",
223 ry: "3",
224 width: "70",
225 height: "10"
226 }
227 }), h("rect", {
228 attrs: {
229 x: "80",
230 y: "0",
231 rx: "3",
232 ry: "3",
233 width: "100",
234 height: "10"
235 }
236 }), h("rect", {
237 attrs: {
238 x: "190",
239 y: "0",
240 rx: "3",
241 ry: "3",
242 width: "10",
243 height: "10"
244 }
245 }), h("rect", {
246 attrs: {
247 x: "15",
248 y: "20",
249 rx: "3",
250 ry: "3",
251 width: "130",
252 height: "10"
253 }
254 }), h("rect", {
255 attrs: {
256 x: "155",
257 y: "20",
258 rx: "3",
259 ry: "3",
260 width: "130",
261 height: "10"
262 }
263 }), h("rect", {
264 attrs: {
265 x: "15",
266 y: "40",
267 rx: "3",
268 ry: "3",
269 width: "90",
270 height: "10"
271 }
272 }), h("rect", {
273 attrs: {
274 x: "115",
275 y: "40",
276 rx: "3",
277 ry: "3",
278 width: "60",
279 height: "10"
280 }
281 }), h("rect", {
282 attrs: {
283 x: "185",
284 y: "40",
285 rx: "3",
286 ry: "3",
287 width: "60",
288 height: "10"
289 }
290 }), h("rect", {
291 attrs: {
292 x: "0",
293 y: "60",
294 rx: "3",
295 ry: "3",
296 width: "30",
297 height: "10"
298 }
299 })]);
300 }
301};
302
303var FacebookLoader = {
304 name: 'FacebookLoader',
305 functional: true,
306 render: function render(h, _ref) {
307 var data = _ref.data;
308 return h(ContentLoader, data, [h("rect", {
309 attrs: {
310 x: "70",
311 y: "15",
312 rx: "4",
313 ry: "4",
314 width: "117",
315 height: "6.4"
316 }
317 }), h("rect", {
318 attrs: {
319 x: "70",
320 y: "35",
321 rx: "3",
322 ry: "3",
323 width: "85",
324 height: "6.4"
325 }
326 }), h("rect", {
327 attrs: {
328 x: "0",
329 y: "80",
330 rx: "3",
331 ry: "3",
332 width: "350",
333 height: "6.4"
334 }
335 }), h("rect", {
336 attrs: {
337 x: "0",
338 y: "100",
339 rx: "3",
340 ry: "3",
341 width: "380",
342 height: "6.4"
343 }
344 }), h("rect", {
345 attrs: {
346 x: "0",
347 y: "120",
348 rx: "3",
349 ry: "3",
350 width: "201",
351 height: "6.4"
352 }
353 }), h("circle", {
354 attrs: {
355 cx: "30",
356 cy: "30",
357 r: "30"
358 }
359 })]);
360 }
361};
362
363var ListLoader = {
364 name: 'ListLoader',
365 functional: true,
366 render: function render(h, _ref) {
367 var data = _ref.data;
368 return h(ContentLoader, data, [h("rect", {
369 attrs: {
370 x: "0",
371 y: "0",
372 rx: "3",
373 ry: "3",
374 width: "250",
375 height: "10"
376 }
377 }), h("rect", {
378 attrs: {
379 x: "20",
380 y: "20",
381 rx: "3",
382 ry: "3",
383 width: "220",
384 height: "10"
385 }
386 }), h("rect", {
387 attrs: {
388 x: "20",
389 y: "40",
390 rx: "3",
391 ry: "3",
392 width: "170",
393 height: "10"
394 }
395 }), h("rect", {
396 attrs: {
397 x: "0",
398 y: "60",
399 rx: "3",
400 ry: "3",
401 width: "250",
402 height: "10"
403 }
404 }), h("rect", {
405 attrs: {
406 x: "20",
407 y: "80",
408 rx: "3",
409 ry: "3",
410 width: "200",
411 height: "10"
412 }
413 }), h("rect", {
414 attrs: {
415 x: "20",
416 y: "100",
417 rx: "3",
418 ry: "3",
419 width: "80",
420 height: "10"
421 }
422 })]);
423 }
424};
425
426var InstagramLoader = {
427 name: 'InstagramLoader',
428 functional: true,
429 render: function render(h, _ref) {
430 var data = _ref.data;
431 return h(ContentLoader, _mergeJSXProps([data, {
432 attrs: {
433 height: 480
434 }
435 }]), [h("circle", {
436 attrs: {
437 cx: "30",
438 cy: "30",
439 r: "30"
440 }
441 }), h("rect", {
442 attrs: {
443 x: "75",
444 y: "13",
445 rx: "4",
446 ry: "4",
447 width: "100",
448 height: "13"
449 }
450 }), h("rect", {
451 attrs: {
452 x: "75",
453 y: "37",
454 rx: "4",
455 ry: "4",
456 width: "50",
457 height: "8"
458 }
459 }), h("rect", {
460 attrs: {
461 x: "0",
462 y: "70",
463 rx: "5",
464 ry: "5",
465 width: "400",
466 height: "400"
467 }
468 })]);
469 }
470};
471
472exports.ContentLoader = ContentLoader;
473exports.BulletListLoader = BulletListLoader;
474exports.CodeLoader = CodeLoader;
475exports.FacebookLoader = FacebookLoader;
476exports.ListLoader = ListLoader;
477exports.InstagramLoader = InstagramLoader;