@skeletonizer/vue 0.0.17-alpha.0 → 0.0.18-alpha.0
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.
- package/dist/skeletonizer-vue.mjs +24 -696
- package/dist/skeletonizer-vue.umd.js +2 -3
- package/package.json +2 -2
|
@@ -1,678 +1,6 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
throw TypeError("Cannot " + t);
|
|
5
|
-
}, q = (i, e, t) => (M(i, e, "read from private field"), t ? t.call(i) : e.get(i)), E = (i, e, t) => {
|
|
6
|
-
if (e.has(i))
|
|
7
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
8
|
-
e instanceof WeakSet ? e.add(i) : e.set(i, t);
|
|
9
|
-
}, n = (i, e, t, s) => (M(i, e, "write to private field"), s ? s.call(i, t) : e.set(i, t), t);
|
|
10
|
-
const k = [
|
|
11
|
-
"Lorem",
|
|
12
|
-
"ipsum",
|
|
13
|
-
"dolor",
|
|
14
|
-
"sit",
|
|
15
|
-
"amet,",
|
|
16
|
-
"consectetur",
|
|
17
|
-
"adipiscing",
|
|
18
|
-
"elit.",
|
|
19
|
-
"Mauris",
|
|
20
|
-
"posuere",
|
|
21
|
-
"tincidunt",
|
|
22
|
-
"purus,",
|
|
23
|
-
"id",
|
|
24
|
-
"laoreet",
|
|
25
|
-
"mauris",
|
|
26
|
-
"cursus",
|
|
27
|
-
"nec.",
|
|
28
|
-
"Quisque",
|
|
29
|
-
"id",
|
|
30
|
-
"ante",
|
|
31
|
-
"id",
|
|
32
|
-
"tellus",
|
|
33
|
-
"aliquam",
|
|
34
|
-
"pulvinar",
|
|
35
|
-
"eget",
|
|
36
|
-
"eu",
|
|
37
|
-
"dolor.",
|
|
38
|
-
"Donec",
|
|
39
|
-
"egestas",
|
|
40
|
-
"dapibus",
|
|
41
|
-
"massa,",
|
|
42
|
-
"vel",
|
|
43
|
-
"finibus",
|
|
44
|
-
"lectus",
|
|
45
|
-
"congue",
|
|
46
|
-
"eu.",
|
|
47
|
-
"Morbi",
|
|
48
|
-
"quis",
|
|
49
|
-
"erat",
|
|
50
|
-
"condimentum,",
|
|
51
|
-
"molestie",
|
|
52
|
-
"ex",
|
|
53
|
-
"a,",
|
|
54
|
-
"sollicitudin",
|
|
55
|
-
"metus.",
|
|
56
|
-
"Vestibulum",
|
|
57
|
-
"orci",
|
|
58
|
-
"metus,",
|
|
59
|
-
"sagittis",
|
|
60
|
-
"a",
|
|
61
|
-
"sagittis",
|
|
62
|
-
"a,",
|
|
63
|
-
"varius",
|
|
64
|
-
"id",
|
|
65
|
-
"diam.",
|
|
66
|
-
"Cras",
|
|
67
|
-
"egestas",
|
|
68
|
-
"eros",
|
|
69
|
-
"vestibulum,",
|
|
70
|
-
"tempus",
|
|
71
|
-
"ipsum",
|
|
72
|
-
"pellentesque,",
|
|
73
|
-
"dictum",
|
|
74
|
-
"justo.",
|
|
75
|
-
"Quisque",
|
|
76
|
-
"sed",
|
|
77
|
-
"justo",
|
|
78
|
-
"metus.",
|
|
79
|
-
"Suspendisse",
|
|
80
|
-
"id",
|
|
81
|
-
"felis",
|
|
82
|
-
"vitae",
|
|
83
|
-
"nunc",
|
|
84
|
-
"auctor",
|
|
85
|
-
"tristique",
|
|
86
|
-
"eu",
|
|
87
|
-
"sit",
|
|
88
|
-
"amet",
|
|
89
|
-
"mi.",
|
|
90
|
-
"Ut",
|
|
91
|
-
"luctus",
|
|
92
|
-
"posuere",
|
|
93
|
-
"viverra.",
|
|
94
|
-
"Nunc",
|
|
95
|
-
"sed",
|
|
96
|
-
"augue",
|
|
97
|
-
"a",
|
|
98
|
-
"velit",
|
|
99
|
-
"sodales",
|
|
100
|
-
"iaculis.",
|
|
101
|
-
"Sed",
|
|
102
|
-
"at",
|
|
103
|
-
"arcu",
|
|
104
|
-
"non",
|
|
105
|
-
"massa",
|
|
106
|
-
"hendrerit",
|
|
107
|
-
"scelerisque.",
|
|
108
|
-
"Nunc",
|
|
109
|
-
"commodo",
|
|
110
|
-
"vulputate",
|
|
111
|
-
"vestibulum.",
|
|
112
|
-
"Duis",
|
|
113
|
-
"ut",
|
|
114
|
-
"leo",
|
|
115
|
-
"nisi.",
|
|
116
|
-
"Mauris",
|
|
117
|
-
"dignissim",
|
|
118
|
-
"quis",
|
|
119
|
-
"sem",
|
|
120
|
-
"non",
|
|
121
|
-
"blandit.",
|
|
122
|
-
"Suspendisse",
|
|
123
|
-
"id",
|
|
124
|
-
"elit",
|
|
125
|
-
"eget",
|
|
126
|
-
"leo",
|
|
127
|
-
"efficitur",
|
|
128
|
-
"maximus.",
|
|
129
|
-
"Ut",
|
|
130
|
-
"eu",
|
|
131
|
-
"auctor",
|
|
132
|
-
"ligula.",
|
|
133
|
-
"Nulla",
|
|
134
|
-
"in",
|
|
135
|
-
"leo",
|
|
136
|
-
"luctus,",
|
|
137
|
-
"tempor",
|
|
138
|
-
"justo",
|
|
139
|
-
"vitae,",
|
|
140
|
-
"condimentum",
|
|
141
|
-
"massa.",
|
|
142
|
-
"Quisque",
|
|
143
|
-
"venenatis",
|
|
144
|
-
"elementum",
|
|
145
|
-
"posuere.",
|
|
146
|
-
"Sed",
|
|
147
|
-
"bibendum",
|
|
148
|
-
"bibendum",
|
|
149
|
-
"enim,",
|
|
150
|
-
"in",
|
|
151
|
-
"faucibus",
|
|
152
|
-
"ante.",
|
|
153
|
-
"Aliquam",
|
|
154
|
-
"pretium",
|
|
155
|
-
"sapien",
|
|
156
|
-
"ac",
|
|
157
|
-
"eleifend",
|
|
158
|
-
"suscipit.",
|
|
159
|
-
"Duis",
|
|
160
|
-
"lacinia",
|
|
161
|
-
"justo",
|
|
162
|
-
"quis",
|
|
163
|
-
"diam",
|
|
164
|
-
"elementum,",
|
|
165
|
-
"vitae",
|
|
166
|
-
"fringilla",
|
|
167
|
-
"lectus",
|
|
168
|
-
"faucibus.",
|
|
169
|
-
"Integer",
|
|
170
|
-
"dictum",
|
|
171
|
-
"commodo",
|
|
172
|
-
"diam",
|
|
173
|
-
"a",
|
|
174
|
-
"tempus.",
|
|
175
|
-
"Aenean",
|
|
176
|
-
"elementum",
|
|
177
|
-
"egestas",
|
|
178
|
-
"quam,",
|
|
179
|
-
"eget",
|
|
180
|
-
"feugiat",
|
|
181
|
-
"ligula",
|
|
182
|
-
"imperdiet",
|
|
183
|
-
"vitae.",
|
|
184
|
-
"Morbi",
|
|
185
|
-
"mattis",
|
|
186
|
-
"dui",
|
|
187
|
-
"sed",
|
|
188
|
-
"elementum",
|
|
189
|
-
"mollis.",
|
|
190
|
-
"In",
|
|
191
|
-
"interdum",
|
|
192
|
-
"viverra",
|
|
193
|
-
"urna,",
|
|
194
|
-
"at",
|
|
195
|
-
"scelerisque",
|
|
196
|
-
"sapien.",
|
|
197
|
-
"Sed",
|
|
198
|
-
"molestie",
|
|
199
|
-
"blandit",
|
|
200
|
-
"risus",
|
|
201
|
-
"nec",
|
|
202
|
-
"ornare.",
|
|
203
|
-
"Integer",
|
|
204
|
-
"pharetra",
|
|
205
|
-
"massa",
|
|
206
|
-
"purus,",
|
|
207
|
-
"ut",
|
|
208
|
-
"fringilla",
|
|
209
|
-
"augue",
|
|
210
|
-
"sollicitudin",
|
|
211
|
-
"in.",
|
|
212
|
-
"Pellentesque",
|
|
213
|
-
"eu",
|
|
214
|
-
"leo",
|
|
215
|
-
"pharetra,",
|
|
216
|
-
"hendrerit",
|
|
217
|
-
"lectus",
|
|
218
|
-
"id,",
|
|
219
|
-
"dapibus",
|
|
220
|
-
"ipsum.",
|
|
221
|
-
"Quisque",
|
|
222
|
-
"tincidunt",
|
|
223
|
-
"euismod",
|
|
224
|
-
"venenatis.",
|
|
225
|
-
"Sed",
|
|
226
|
-
"lacus",
|
|
227
|
-
"ex,",
|
|
228
|
-
"pulvinar",
|
|
229
|
-
"at",
|
|
230
|
-
"dui",
|
|
231
|
-
"vitae,",
|
|
232
|
-
"condimentum",
|
|
233
|
-
"rutrum",
|
|
234
|
-
"eros.",
|
|
235
|
-
"Nunc",
|
|
236
|
-
"viverra",
|
|
237
|
-
"cursus",
|
|
238
|
-
"ante,",
|
|
239
|
-
"ac",
|
|
240
|
-
"dapibus",
|
|
241
|
-
"ligula",
|
|
242
|
-
"volutpat",
|
|
243
|
-
"nec.",
|
|
244
|
-
"Integer",
|
|
245
|
-
"commodo",
|
|
246
|
-
"in",
|
|
247
|
-
"tortor",
|
|
248
|
-
"eget",
|
|
249
|
-
"aliquet.",
|
|
250
|
-
"Nam",
|
|
251
|
-
"bibendum",
|
|
252
|
-
"lectus",
|
|
253
|
-
"vitae",
|
|
254
|
-
"ligula",
|
|
255
|
-
"interdum",
|
|
256
|
-
"scelerisque.",
|
|
257
|
-
"Morbi",
|
|
258
|
-
"sit",
|
|
259
|
-
"amet",
|
|
260
|
-
"augue",
|
|
261
|
-
"diam.",
|
|
262
|
-
"Etiam",
|
|
263
|
-
"purus",
|
|
264
|
-
"lorem,",
|
|
265
|
-
"sodales",
|
|
266
|
-
"sed",
|
|
267
|
-
"sodales",
|
|
268
|
-
"ac,",
|
|
269
|
-
"dignissim",
|
|
270
|
-
"a",
|
|
271
|
-
"tellus.",
|
|
272
|
-
"Nunc",
|
|
273
|
-
"vehicula",
|
|
274
|
-
"nibh",
|
|
275
|
-
"in",
|
|
276
|
-
"erat",
|
|
277
|
-
"rhoncus",
|
|
278
|
-
"ullamcorper.",
|
|
279
|
-
"Orci",
|
|
280
|
-
"varius",
|
|
281
|
-
"natoque",
|
|
282
|
-
"penatibus",
|
|
283
|
-
"et",
|
|
284
|
-
"magnis",
|
|
285
|
-
"dis",
|
|
286
|
-
"parturient",
|
|
287
|
-
"montes,",
|
|
288
|
-
"nascetur",
|
|
289
|
-
"ridiculus",
|
|
290
|
-
"mus.",
|
|
291
|
-
"Aliquam",
|
|
292
|
-
"augue",
|
|
293
|
-
"nunc,",
|
|
294
|
-
"fringilla",
|
|
295
|
-
"at",
|
|
296
|
-
"dictum",
|
|
297
|
-
"quis,",
|
|
298
|
-
"luctus",
|
|
299
|
-
"sit",
|
|
300
|
-
"amet",
|
|
301
|
-
"nisl.",
|
|
302
|
-
"Nam",
|
|
303
|
-
"lectus",
|
|
304
|
-
"felis,",
|
|
305
|
-
"egestas",
|
|
306
|
-
"nec",
|
|
307
|
-
"lacinia",
|
|
308
|
-
"non,",
|
|
309
|
-
"auctor",
|
|
310
|
-
"eget",
|
|
311
|
-
"lorem.",
|
|
312
|
-
"Nunc",
|
|
313
|
-
"vel",
|
|
314
|
-
"velit",
|
|
315
|
-
"quis",
|
|
316
|
-
"magna",
|
|
317
|
-
"hendrerit",
|
|
318
|
-
"volutpat",
|
|
319
|
-
"in",
|
|
320
|
-
"nec",
|
|
321
|
-
"leo.",
|
|
322
|
-
"Aenean",
|
|
323
|
-
"tempor",
|
|
324
|
-
"lectus",
|
|
325
|
-
"tortor,",
|
|
326
|
-
"nec",
|
|
327
|
-
"bibendum",
|
|
328
|
-
"elit",
|
|
329
|
-
"aliquam",
|
|
330
|
-
"at.",
|
|
331
|
-
"In",
|
|
332
|
-
"id",
|
|
333
|
-
"libero",
|
|
334
|
-
"tincidunt,",
|
|
335
|
-
"interdum",
|
|
336
|
-
"libero",
|
|
337
|
-
"sit",
|
|
338
|
-
"amet,",
|
|
339
|
-
"gravida",
|
|
340
|
-
"est.",
|
|
341
|
-
"Morbi",
|
|
342
|
-
"ut",
|
|
343
|
-
"ipsum",
|
|
344
|
-
"enim.",
|
|
345
|
-
"Duis",
|
|
346
|
-
"vel",
|
|
347
|
-
"posuere",
|
|
348
|
-
"ante.",
|
|
349
|
-
"Praesent",
|
|
350
|
-
"sollicitudin",
|
|
351
|
-
"lacus",
|
|
352
|
-
"sit",
|
|
353
|
-
"amet",
|
|
354
|
-
"luctus",
|
|
355
|
-
"euismod.",
|
|
356
|
-
"Phasellus",
|
|
357
|
-
"lorem",
|
|
358
|
-
"elit,",
|
|
359
|
-
"auctor",
|
|
360
|
-
"sed",
|
|
361
|
-
"risus",
|
|
362
|
-
"a,",
|
|
363
|
-
"faucibus",
|
|
364
|
-
"tempor",
|
|
365
|
-
"lacus.",
|
|
366
|
-
"Integer",
|
|
367
|
-
"id",
|
|
368
|
-
"tellus",
|
|
369
|
-
"ut",
|
|
370
|
-
"eros",
|
|
371
|
-
"congue",
|
|
372
|
-
"ornare.",
|
|
373
|
-
"Cras",
|
|
374
|
-
"vitae",
|
|
375
|
-
"ornare",
|
|
376
|
-
"sem.",
|
|
377
|
-
"Cras",
|
|
378
|
-
"tincidunt",
|
|
379
|
-
"arcu",
|
|
380
|
-
"efficitur",
|
|
381
|
-
"mauris",
|
|
382
|
-
"molestie,",
|
|
383
|
-
"eu",
|
|
384
|
-
"eleifend",
|
|
385
|
-
"eros",
|
|
386
|
-
"mattis.",
|
|
387
|
-
"Integer",
|
|
388
|
-
"id",
|
|
389
|
-
"diam",
|
|
390
|
-
"mauris.",
|
|
391
|
-
"Duis",
|
|
392
|
-
"suscipit",
|
|
393
|
-
"enim",
|
|
394
|
-
"risus,",
|
|
395
|
-
"non",
|
|
396
|
-
"dignissim",
|
|
397
|
-
"nulla",
|
|
398
|
-
"imperdiet",
|
|
399
|
-
"hendrerit.",
|
|
400
|
-
"Vestibulum",
|
|
401
|
-
"sed",
|
|
402
|
-
"dignissim",
|
|
403
|
-
"erat.",
|
|
404
|
-
"Aliquam",
|
|
405
|
-
"erat",
|
|
406
|
-
"volutpat.",
|
|
407
|
-
"Nunc",
|
|
408
|
-
"mattis",
|
|
409
|
-
"auctor",
|
|
410
|
-
"justo,",
|
|
411
|
-
"non",
|
|
412
|
-
"fringilla",
|
|
413
|
-
"dolor",
|
|
414
|
-
"blandit",
|
|
415
|
-
"a.",
|
|
416
|
-
"Donec",
|
|
417
|
-
"et",
|
|
418
|
-
"velit",
|
|
419
|
-
"tristique",
|
|
420
|
-
"lacus",
|
|
421
|
-
"varius",
|
|
422
|
-
"aliquam.",
|
|
423
|
-
"Praesent",
|
|
424
|
-
"ac",
|
|
425
|
-
"molestie",
|
|
426
|
-
"quam,",
|
|
427
|
-
"vitae",
|
|
428
|
-
"scelerisque",
|
|
429
|
-
"tellus.",
|
|
430
|
-
"Praesent",
|
|
431
|
-
"eleifend",
|
|
432
|
-
"sed",
|
|
433
|
-
"diam",
|
|
434
|
-
"in",
|
|
435
|
-
"gravida.",
|
|
436
|
-
"Donec",
|
|
437
|
-
"tristique",
|
|
438
|
-
"sapien",
|
|
439
|
-
"ante,",
|
|
440
|
-
"in",
|
|
441
|
-
"egestas",
|
|
442
|
-
"diam",
|
|
443
|
-
"porta",
|
|
444
|
-
"ac.",
|
|
445
|
-
"Proin",
|
|
446
|
-
"ac",
|
|
447
|
-
"justo",
|
|
448
|
-
"eleifend,",
|
|
449
|
-
"consequat",
|
|
450
|
-
"ante",
|
|
451
|
-
"vitae,",
|
|
452
|
-
"laoreet",
|
|
453
|
-
"augue.",
|
|
454
|
-
"Mauris",
|
|
455
|
-
"scelerisque",
|
|
456
|
-
"arcu",
|
|
457
|
-
"dolor,",
|
|
458
|
-
"quis",
|
|
459
|
-
"lobortis",
|
|
460
|
-
"risus",
|
|
461
|
-
"pellentesque",
|
|
462
|
-
"eu.",
|
|
463
|
-
"Praesent",
|
|
464
|
-
"in",
|
|
465
|
-
"enim",
|
|
466
|
-
"a",
|
|
467
|
-
"elit",
|
|
468
|
-
"feugiat",
|
|
469
|
-
"dapibus.",
|
|
470
|
-
"Duis",
|
|
471
|
-
"quis",
|
|
472
|
-
"bibendum",
|
|
473
|
-
"mi.",
|
|
474
|
-
"Vestibulum",
|
|
475
|
-
"lacinia,",
|
|
476
|
-
"sem",
|
|
477
|
-
"at",
|
|
478
|
-
"efficitur",
|
|
479
|
-
"volutpat,",
|
|
480
|
-
"velit",
|
|
481
|
-
"ligula",
|
|
482
|
-
"vulputate",
|
|
483
|
-
"nisi,",
|
|
484
|
-
"sit",
|
|
485
|
-
"amet",
|
|
486
|
-
"dapibus",
|
|
487
|
-
"risus",
|
|
488
|
-
"metus",
|
|
489
|
-
"sed",
|
|
490
|
-
"est.",
|
|
491
|
-
"Sed",
|
|
492
|
-
"in",
|
|
493
|
-
"venenatis",
|
|
494
|
-
"ante.",
|
|
495
|
-
"Pellentesque",
|
|
496
|
-
"vel",
|
|
497
|
-
"ipsum",
|
|
498
|
-
"pharetra,",
|
|
499
|
-
"efficitur",
|
|
500
|
-
"quam",
|
|
501
|
-
"ut,",
|
|
502
|
-
"hendrerit",
|
|
503
|
-
"dolor."
|
|
504
|
-
];
|
|
505
|
-
var l = /* @__PURE__ */ ((i) => (i.Text = "text", i.Input = "input", i.Image = "image", i.Video = "video", i.WrapperElement = "wrapper-element", i))(l || {}), v = /* @__PURE__ */ ((i) => (i.PrimaryColor = "rgba(100, 100, 100, .6)", i.SecondaryColor = "rgba(100, 100, 100, .3)", i))(v || {});
|
|
506
|
-
class g {
|
|
507
|
-
static daysInMs(e) {
|
|
508
|
-
return e * 24 * 60 * 60 * 1e3;
|
|
509
|
-
}
|
|
510
|
-
static dateBetween(e, t) {
|
|
511
|
-
return new Date(e.getTime() + Math.random() * (t.getTime() - e.getTime()));
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
let w = 0;
|
|
515
|
-
var r;
|
|
516
|
-
class L {
|
|
517
|
-
constructor() {
|
|
518
|
-
E(this, r, void 0);
|
|
519
|
-
}
|
|
520
|
-
get value() {
|
|
521
|
-
return q(this, r);
|
|
522
|
-
}
|
|
523
|
-
words(e) {
|
|
524
|
-
this.assertType();
|
|
525
|
-
let t = "", s = 0;
|
|
526
|
-
for (; s < e; )
|
|
527
|
-
t += this.randomLoremWord() + " ", s++;
|
|
528
|
-
return n(this, r, t.trim()), this;
|
|
529
|
-
}
|
|
530
|
-
paragraphs(e) {
|
|
531
|
-
this.assertType();
|
|
532
|
-
let t = "", s = 0;
|
|
533
|
-
const c = 50;
|
|
534
|
-
for (; s < e; ) {
|
|
535
|
-
const u = c - Math.round(c * Math.random() * 0.2) * (Math.random() < 0.5 ? -1 : 1);
|
|
536
|
-
t += this.words(u).value, s !== e - 1 && (t += `
|
|
537
|
-
`), s++;
|
|
538
|
-
}
|
|
539
|
-
return n(this, r, t), this;
|
|
540
|
-
}
|
|
541
|
-
number(e = 0, t = 1e3) {
|
|
542
|
-
return this.assertType(), n(this, r, Math.ceil(Math.random() * (t - e)) + e), this;
|
|
543
|
-
}
|
|
544
|
-
multiply(e) {
|
|
545
|
-
return this.assertType(), n(this, r, q(this, r) * e), this;
|
|
546
|
-
}
|
|
547
|
-
date(e = {}) {
|
|
548
|
-
this.assertType();
|
|
549
|
-
let t = e.max ?? /* @__PURE__ */ new Date("2100-01-01"), s = e.min ?? /* @__PURE__ */ new Date("1970-01-01");
|
|
550
|
-
return e.isFuture ? s = new Date(Date.now() + g.daysInMs(1)) : e.isPast && (t = new Date(Date.now() - g.daysInMs(1))), n(this, r, g.dateBetween(s, t)), this;
|
|
551
|
-
}
|
|
552
|
-
uuid() {
|
|
553
|
-
return w++, this.assertType(), n(this, r, w), this;
|
|
554
|
-
}
|
|
555
|
-
boolean() {
|
|
556
|
-
return this.assertType(), n(this, r, Math.random() <= 0.5), this;
|
|
557
|
-
}
|
|
558
|
-
symbol(e = 0) {
|
|
559
|
-
return this.assertType(), n(this, r, Symbol(e)), this;
|
|
560
|
-
}
|
|
561
|
-
identical(e) {
|
|
562
|
-
return this.assertType(), n(this, r, e), this;
|
|
563
|
-
}
|
|
564
|
-
assertType() {
|
|
565
|
-
}
|
|
566
|
-
randomLoremWord() {
|
|
567
|
-
const e = Math.floor(Math.random() * k.length);
|
|
568
|
-
return k[e] ?? "lorem";
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
r = /* @__PURE__ */ new WeakMap();
|
|
572
|
-
class p {
|
|
573
|
-
constructor(e) {
|
|
574
|
-
this.generator = e, this.viewModel = this.generator(), this.val = p.modelToValue(this.viewModel);
|
|
575
|
-
}
|
|
576
|
-
get value() {
|
|
577
|
-
return this.val;
|
|
578
|
-
}
|
|
579
|
-
static modelToValue(e) {
|
|
580
|
-
if (e instanceof L)
|
|
581
|
-
return e.value;
|
|
582
|
-
if (Array.isArray(e))
|
|
583
|
-
return e.map(this.modelToValue);
|
|
584
|
-
{
|
|
585
|
-
const t = {};
|
|
586
|
-
return Object.keys(e).forEach((s) => {
|
|
587
|
-
t[s] = p.modelToValue(
|
|
588
|
-
e[s]
|
|
589
|
-
);
|
|
590
|
-
}), t;
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
class j {
|
|
595
|
-
// when accessing skeletonized component properties / methods from within the view, they should be accessed via proxy method
|
|
596
|
-
// this is necessary to ensure:
|
|
597
|
-
// - that all properties / methods accessed from within skeletonized part of the view are a part of skeletonSchema
|
|
598
|
-
// - that typescript understands correct type of each property / method accessed from within the skeletonized part of the view
|
|
599
|
-
proxy(e) {
|
|
600
|
-
return e instanceof p ? e.value : e;
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
class V {
|
|
604
|
-
constructor() {
|
|
605
|
-
this.config = null, this.viewModels = [];
|
|
606
|
-
}
|
|
607
|
-
// the method should be called from within specific packages whenever the adapter component's config changes
|
|
608
|
-
setupModels() {
|
|
609
|
-
if (this.config) {
|
|
610
|
-
const e = this.config.schemaGenerator;
|
|
611
|
-
this.viewModels = Array.from({ length: this.config.repeat }, () => new p(e));
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
const S = class o {
|
|
616
|
-
static skeletonizeProjectedTemplate(e, t) {
|
|
617
|
-
const s = (t == null ? void 0 : t.primaryColor) ?? v.PrimaryColor, c = (t == null ? void 0 : t.secondaryColor) ?? v.SecondaryColor;
|
|
618
|
-
e.setAttribute(
|
|
619
|
-
"style",
|
|
620
|
-
`--skeletonizer-primary-color: ${s}; --skeletonizer-secondary-color: ${c};`
|
|
621
|
-
), Array.from(e.querySelectorAll("*:not(svg, [data-skeletonizer])")).forEach((u) => {
|
|
622
|
-
const h = [
|
|
623
|
-
"br",
|
|
624
|
-
"b",
|
|
625
|
-
"strong",
|
|
626
|
-
"i",
|
|
627
|
-
"em",
|
|
628
|
-
"mark",
|
|
629
|
-
"small",
|
|
630
|
-
"del",
|
|
631
|
-
"ins",
|
|
632
|
-
"sub",
|
|
633
|
-
"sup"
|
|
634
|
-
], m = Array.from(u.childNodes).map((a) => a.nodeName.toLowerCase()).filter((a) => !h.includes(a)), D = m.length > 0 && m.some((a) => a !== m[0]);
|
|
635
|
-
u.childNodes.forEach((a) => {
|
|
636
|
-
switch (a.nodeName.toLowerCase()) {
|
|
637
|
-
case "#text": {
|
|
638
|
-
if (this.assertAs(a), a.wholeText.trim())
|
|
639
|
-
if (D) {
|
|
640
|
-
const d = document.createElement("span");
|
|
641
|
-
d.innerText = a.cloneNode().wholeText, d.innerText.length && a.replaceWith(
|
|
642
|
-
o.skeletonizedSpanGenerator(d.innerText, l.Text)
|
|
643
|
-
);
|
|
644
|
-
} else {
|
|
645
|
-
const d = o.skeletonizedSpanGenerator(u.innerHTML, l.Text);
|
|
646
|
-
u.innerHTML = d.outerHTML;
|
|
647
|
-
}
|
|
648
|
-
break;
|
|
649
|
-
}
|
|
650
|
-
case "input": {
|
|
651
|
-
a.setAttribute(o.dataAttr, l.Input);
|
|
652
|
-
break;
|
|
653
|
-
}
|
|
654
|
-
case "img": {
|
|
655
|
-
a.setAttribute(o.dataAttr, l.Image);
|
|
656
|
-
break;
|
|
657
|
-
}
|
|
658
|
-
case "video": {
|
|
659
|
-
a.setAttribute(o.dataAttr, l.Video);
|
|
660
|
-
break;
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
});
|
|
664
|
-
}), e.setAttribute(o.dataAttr, l.WrapperElement);
|
|
665
|
-
}
|
|
666
|
-
static skeletonizedSpanGenerator(e, t) {
|
|
667
|
-
const s = document.createElement("span");
|
|
668
|
-
return s.innerHTML = e, s.setAttribute(o.dataAttr, t), s;
|
|
669
|
-
}
|
|
670
|
-
static assertAs(e) {
|
|
671
|
-
}
|
|
672
|
-
};
|
|
673
|
-
S.dataAttr = "data-skeletonizer";
|
|
674
|
-
let W = S;
|
|
675
|
-
const B = /* @__PURE__ */ z({
|
|
1
|
+
import { defineComponent as m, reactive as l, watch as S, resolveDirective as u, openBlock as r, createElementBlock as s, Fragment as d, renderList as v, withDirectives as f, renderSlot as i } from "vue";
|
|
2
|
+
import { SkeletonAdapterComponent as h, SkeletonAbstractComponent as w, SkeletonDirective as z } from "@skeletonizer/utils";
|
|
3
|
+
const g = /* @__PURE__ */ m({
|
|
676
4
|
__name: "SkeletonizerSkeleton",
|
|
677
5
|
props: {
|
|
678
6
|
config: {},
|
|
@@ -680,46 +8,46 @@ const B = /* @__PURE__ */ z({
|
|
|
680
8
|
scope: {},
|
|
681
9
|
colorSchema: {}
|
|
682
10
|
},
|
|
683
|
-
setup(
|
|
684
|
-
const e =
|
|
685
|
-
return
|
|
11
|
+
setup(n) {
|
|
12
|
+
const e = n, t = l(new h());
|
|
13
|
+
return S(
|
|
686
14
|
e.config,
|
|
687
|
-
(
|
|
688
|
-
t.config =
|
|
15
|
+
(o) => {
|
|
16
|
+
t.config = o, t.setupModels();
|
|
689
17
|
},
|
|
690
18
|
{ immediate: !0 }
|
|
691
|
-
), (
|
|
692
|
-
const
|
|
693
|
-
return
|
|
694
|
-
|
|
695
|
-
scope:
|
|
19
|
+
), (o, y) => {
|
|
20
|
+
const a = u("skeletonize");
|
|
21
|
+
return o.showSkeleton ? (r(!0), s(d, { key: 0 }, v(t.viewModels, (k, p) => f((r(), s("div", { key: p }, [
|
|
22
|
+
i(o.$slots, "default", {
|
|
23
|
+
scope: k.value
|
|
696
24
|
})
|
|
697
25
|
])), [
|
|
698
|
-
[
|
|
699
|
-
])), 128)) :
|
|
26
|
+
[a, e.colorSchema]
|
|
27
|
+
])), 128)) : i(o.$slots, "default", {
|
|
700
28
|
key: 1,
|
|
701
29
|
scope: e.scope
|
|
702
30
|
});
|
|
703
31
|
};
|
|
704
32
|
}
|
|
705
33
|
});
|
|
706
|
-
class
|
|
34
|
+
class c extends w {
|
|
707
35
|
constructor(e, t) {
|
|
708
36
|
super(), this.skeletonConfig = e, this.showSkeleton = t;
|
|
709
37
|
}
|
|
710
38
|
static generate(e, t) {
|
|
711
|
-
return
|
|
39
|
+
return l(new c(e, t));
|
|
712
40
|
}
|
|
713
41
|
}
|
|
714
|
-
const
|
|
715
|
-
install: (
|
|
716
|
-
|
|
717
|
-
|
|
42
|
+
const B = {
|
|
43
|
+
install: (n) => {
|
|
44
|
+
n.component("SkeletonizerSkeleton", g), n.directive("skeletonize", (e, t) => {
|
|
45
|
+
z.skeletonizeProjectedTemplate(e, t.value);
|
|
718
46
|
});
|
|
719
47
|
}
|
|
720
48
|
};
|
|
721
49
|
export {
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
50
|
+
c as SkeletonizerComponentComposable,
|
|
51
|
+
B as SkeletonizerPlugin,
|
|
52
|
+
g as SkeletonizerSkeleton
|
|
725
53
|
};
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
`,document.head.appendChild(
|
|
3
|
-
`),s++}return u(this,n,t),this}number(e=0,t=1e3){return this.assertType(),u(this,n,Math.ceil(Math.random()*(t-e))+e),this}multiply(e){return this.assertType(),u(this,n,w(this,n)*e),this}date(e={}){this.assertType();let t=e.max??new Date("2100-01-01"),s=e.min??new Date("1970-01-01");return e.isFuture?s=new Date(Date.now()+f.daysInMs(1)):e.isPast&&(t=new Date(Date.now()-f.daysInMs(1))),u(this,n,f.dateBetween(s,t)),this}uuid(){return M++,this.assertType(),u(this,n,M),this}boolean(){return this.assertType(),u(this,n,Math.random()<=.5),this}symbol(e=0){return this.assertType(),u(this,n,Symbol(e)),this}identical(e){return this.assertType(),u(this,n,e),this}assertType(){}randomLoremWord(){const e=Math.floor(Math.random()*T.length);return T[e]??"lorem"}}n=new WeakMap;class d{constructor(e){this.generator=e,this.viewModel=this.generator(),this.val=d.modelToValue(this.viewModel)}get value(){return this.val}static modelToValue(e){if(e instanceof x)return e.value;if(Array.isArray(e))return e.map(this.modelToValue);{const t={};return Object.keys(e).forEach(s=>{t[s]=d.modelToValue(e[s])}),t}}}class C{proxy(e){return e instanceof d?e.value:e}}class D{constructor(){this.config=null,this.viewModels=[]}setupModels(){if(this.config){const e=this.config.schemaGenerator;this.viewModels=Array.from({length:this.config.repeat},()=>new d(e))}}}const S=class c{static skeletonizeProjectedTemplate(e,t){const s=(t==null?void 0:t.primaryColor)??v.PrimaryColor,p=(t==null?void 0:t.secondaryColor)??v.SecondaryColor;e.setAttribute("style",`--skeletonizer-primary-color: ${s}; --skeletonizer-secondary-color: ${p};`),Array.from(e.querySelectorAll("*:not(svg, [data-skeletonizer])")).forEach(l=>{const k=["br","b","strong","i","em","mark","small","del","ins","sub","sup"],h=Array.from(l.childNodes).map(a=>a.nodeName.toLowerCase()).filter(a=>!k.includes(a)),N=h.length>0&&h.some(a=>a!==h[0]);l.childNodes.forEach(a=>{switch(a.nodeName.toLowerCase()){case"#text":{if(this.assertAs(a),a.wholeText.trim())if(N){const g=document.createElement("span");g.innerText=a.cloneNode().wholeText,g.innerText.length&&a.replaceWith(c.skeletonizedSpanGenerator(g.innerText,m.Text))}else{const g=c.skeletonizedSpanGenerator(l.innerHTML,m.Text);l.innerHTML=g.outerHTML}break}case"input":{a.setAttribute(c.dataAttr,m.Input);break}case"img":{a.setAttribute(c.dataAttr,m.Image);break}case"video":{a.setAttribute(c.dataAttr,m.Video);break}}})}),e.setAttribute(c.dataAttr,m.WrapperElement)}static skeletonizedSpanGenerator(e,t){const s=document.createElement("span");return s.innerHTML=e,s.setAttribute(c.dataAttr,t),s}static assertAs(e){}};S.dataAttr="data-skeletonizer";let I=S;const z=r.defineComponent({__name:"SkeletonizerSkeleton",props:{config:{},showSkeleton:{type:Boolean},scope:{},colorSchema:{}},setup(i){const e=i,t=r.reactive(new D);return r.watch(e.config,s=>{t.config=s,t.setupModels()},{immediate:!0}),(s,p)=>{const l=r.resolveDirective("skeletonize");return s.showSkeleton?(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:0},r.renderList(t.viewModels,(k,h)=>r.withDirectives((r.openBlock(),r.createElementBlock("div",{key:h},[r.renderSlot(s.$slots,"default",{scope:k.value})])),[[l,e.colorSchema]])),128)):r.renderSlot(s.$slots,"default",{key:1,scope:e.scope})}}});class b extends C{constructor(e,t){super(),this.skeletonConfig=e,this.showSkeleton=t}static generate(e,t){return r.reactive(new b(e,t))}}const P={install:i=>{i.component("SkeletonizerSkeleton",z),i.directive("skeletonize",(e,t)=>{I.skeletonizeProjectedTemplate(e,t.value)})}};o.SkeletonizerComponentComposable=b,o.SkeletonizerPlugin=P,o.SkeletonizerSkeleton=z,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(t,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@skeletonizer/utils")):typeof define=="function"&&define.amd?define(["exports","vue","@skeletonizer/utils"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.SkeletonizerVue={},t.Vue,t.SkeletonizerUtils))})(this,function(t,e,l){"use strict";var a=document.createElement("style");a.textContent=`[data-skeletonizer=wrapper-element]{--skeletonizer-text-background: rgba(0, 0, 0, .2);display:contents;filter:grayscale(100%);pointer-events:none}[data-skeletonizer=wrapper-element] *{pointer-events:none}[data-skeletonizer=wrapper-element] [data-skeletonizer=text]{animation:text-animation 2s infinite ease-in-out;background:var(--skeletonizer-primary-color);border-radius:50px;color:#0000!important}@keyframes text-animation{0%{background:var(--skeletonizer-primary-color)}50%{background:var(--skeletonizer-secondary-color)}to{background:var(--skeletonizer-primary-color)}}
|
|
2
|
+
`,document.head.appendChild(a);const c=e.defineComponent({__name:"SkeletonizerSkeleton",props:{config:{},showSkeleton:{type:Boolean},scope:{},colorSchema:{}},setup(i){const n=i,o=e.reactive(new l.SkeletonAdapterComponent);return e.watch(n.config,r=>{o.config=r,o.setupModels()},{immediate:!0}),(r,u)=>{const d=e.resolveDirective("skeletonize");return r.showSkeleton?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(o.viewModels,(p,m)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",{key:m},[e.renderSlot(r.$slots,"default",{scope:p.value})])),[[d,n.colorSchema]])),128)):e.renderSlot(r.$slots,"default",{key:1,scope:n.scope})}}});class s extends l.SkeletonAbstractComponent{constructor(n,o){super(),this.skeletonConfig=n,this.showSkeleton=o}static generate(n,o){return e.reactive(new s(n,o))}}const k={install:i=>{i.component("SkeletonizerSkeleton",c),i.directive("skeletonize",(n,o)=>{l.SkeletonDirective.skeletonizeProjectedTemplate(n,o.value)})}};t.SkeletonizerComponentComposable=s,t.SkeletonizerPlugin=k,t.SkeletonizerSkeleton=c,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skeletonizer/vue",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18-alpha.0",
|
|
4
4
|
"description": "The way to skeletonize your Vue.js components",
|
|
5
5
|
"author": "Luka Varga",
|
|
6
6
|
"license": "MIT",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"**/*.{scss,css}": "stylelint --fix",
|
|
79
79
|
"**/*.{ts,js,.vue}": "eslint --fix"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "df7b44bcab02f415fbae5d3676de5df2b5011d05"
|
|
82
82
|
}
|