@mgdis/core-ui-helpers 1.1.0 → 1.1.2

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.
@@ -1,1898 +1,229 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
- typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.CoreUiHelpers = global.CoreUiHelpers || {}, global.CoreUiHelpers.stencil = {})));
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.CoreUiHelpers = global.CoreUiHelpers || {}, global.CoreUiHelpers.stencil = {})));
5
5
  })(this, (function (exports) { 'use strict';
6
6
 
7
- /*
8
- Stencil Client Platform v4.40.1 | MIT Licensed | https://stenciljs.com
9
- */
10
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __typeError = (msg) => {
17
- throw TypeError(msg);
18
- };
19
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
20
- var __commonJS = (cb, mod) => function __require() {
21
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
22
- };
23
- var __export = (target, all) => {
24
- for (var name in all)
25
- __defProp(target, name, { get: all[name], enumerable: true });
26
- };
27
- var __copyProps = (to, from, except, desc) => {
28
- if (from && typeof from === "object" || typeof from === "function") {
29
- for (let key of __getOwnPropNames(from))
30
- if (!__hasOwnProp.call(to, key) && key !== except)
31
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
32
- }
33
- return to;
34
- };
35
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
36
- // If the importer is in node compatibility mode or this is not an ESM
37
- // file that has been converted to a CommonJS file using a Babel-
38
- // compatible transform (i.e. "__esModule" has not been set), then set
39
- // "default" to the CommonJS "module.exports" for node compatibility.
40
- __defProp(target, "default", { value: mod, enumerable: true }) ,
41
- mod
42
- ));
43
- var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
44
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
45
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
46
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
47
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
48
- var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
49
-
50
- // node_modules/balanced-match/index.js
51
- var require_balanced_match = __commonJS({
52
- "node_modules/balanced-match/index.js"(exports$1, module) {
53
- module.exports = balanced;
54
- function balanced(a, b, str) {
55
- if (a instanceof RegExp) a = maybeMatch(a, str);
56
- if (b instanceof RegExp) b = maybeMatch(b, str);
57
- var r = range(a, b, str);
58
- return r && {
59
- start: r[0],
60
- end: r[1],
61
- pre: str.slice(0, r[0]),
62
- body: str.slice(r[0] + a.length, r[1]),
63
- post: str.slice(r[1] + b.length)
64
- };
65
- }
66
- function maybeMatch(reg, str) {
67
- var m = str.match(reg);
68
- return m ? m[0] : null;
69
- }
70
- balanced.range = range;
71
- function range(a, b, str) {
72
- var begs, beg, left, right, result;
73
- var ai = str.indexOf(a);
74
- var bi = str.indexOf(b, ai + 1);
75
- var i2 = ai;
76
- if (ai >= 0 && bi > 0) {
77
- if (a === b) {
78
- return [ai, bi];
79
- }
80
- begs = [];
81
- left = str.length;
82
- while (i2 >= 0 && !result) {
83
- if (i2 == ai) {
84
- begs.push(i2);
85
- ai = str.indexOf(a, i2 + 1);
86
- } else if (begs.length == 1) {
87
- result = [begs.pop(), bi];
88
- } else {
89
- beg = begs.pop();
90
- if (beg < left) {
91
- left = beg;
92
- right = bi;
93
- }
94
- bi = str.indexOf(b, i2 + 1);
95
- }
96
- i2 = ai < bi && ai >= 0 ? ai : bi;
97
- }
98
- if (begs.length) {
99
- result = [left, right];
100
- }
101
- }
102
- return result;
103
- }
104
- }
105
- });
106
-
107
- // node_modules/brace-expansion/index.js
108
- var require_brace_expansion = __commonJS({
109
- "node_modules/brace-expansion/index.js"(exports$1, module) {
110
- var balanced = require_balanced_match();
111
- module.exports = expandTop;
112
- var escSlash = "\0SLASH" + Math.random() + "\0";
113
- var escOpen = "\0OPEN" + Math.random() + "\0";
114
- var escClose = "\0CLOSE" + Math.random() + "\0";
115
- var escComma = "\0COMMA" + Math.random() + "\0";
116
- var escPeriod = "\0PERIOD" + Math.random() + "\0";
117
- function numeric(str) {
118
- return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
119
- }
120
- function escapeBraces(str) {
121
- return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
122
- }
123
- function unescapeBraces(str) {
124
- return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
125
- }
126
- function parseCommaParts(str) {
127
- if (!str)
128
- return [""];
129
- var parts = [];
130
- var m = balanced("{", "}", str);
131
- if (!m)
132
- return str.split(",");
133
- var pre = m.pre;
134
- var body = m.body;
135
- var post = m.post;
136
- var p = pre.split(",");
137
- p[p.length - 1] += "{" + body + "}";
138
- var postParts = parseCommaParts(post);
139
- if (post.length) {
140
- p[p.length - 1] += postParts.shift();
141
- p.push.apply(p, postParts);
142
- }
143
- parts.push.apply(parts, p);
144
- return parts;
145
- }
146
- function expandTop(str) {
147
- if (!str)
148
- return [];
149
- if (str.substr(0, 2) === "{}") {
150
- str = "\\{\\}" + str.substr(2);
151
- }
152
- return expand2(escapeBraces(str), true).map(unescapeBraces);
153
- }
154
- function embrace(str) {
155
- return "{" + str + "}";
156
- }
157
- function isPadded(el) {
158
- return /^-?0\d/.test(el);
159
- }
160
- function lte(i2, y) {
161
- return i2 <= y;
162
- }
163
- function gte(i2, y) {
164
- return i2 >= y;
165
- }
166
- function expand2(str, isTop) {
167
- var expansions = [];
168
- var m = balanced("{", "}", str);
169
- if (!m) return [str];
170
- var pre = m.pre;
171
- var post = m.post.length ? expand2(m.post, false) : [""];
172
- if (/\$$/.test(m.pre)) {
173
- for (var k = 0; k < post.length; k++) {
174
- var expansion = pre + "{" + m.body + "}" + post[k];
175
- expansions.push(expansion);
176
- }
177
- } else {
178
- var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
179
- var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
180
- var isSequence = isNumericSequence || isAlphaSequence;
181
- var isOptions = m.body.indexOf(",") >= 0;
182
- if (!isSequence && !isOptions) {
183
- if (m.post.match(/,(?!,).*\}/)) {
184
- str = m.pre + "{" + m.body + escClose + m.post;
185
- return expand2(str);
186
- }
187
- return [str];
188
- }
189
- var n;
190
- if (isSequence) {
191
- n = m.body.split(/\.\./);
192
- } else {
193
- n = parseCommaParts(m.body);
194
- if (n.length === 1) {
195
- n = expand2(n[0], false).map(embrace);
196
- if (n.length === 1) {
197
- return post.map(function(p) {
198
- return m.pre + n[0] + p;
199
- });
200
- }
201
- }
202
- }
203
- var N;
204
- if (isSequence) {
205
- var x = numeric(n[0]);
206
- var y = numeric(n[1]);
207
- var width = Math.max(n[0].length, n[1].length);
208
- var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
209
- var test = lte;
210
- var reverse = y < x;
211
- if (reverse) {
212
- incr *= -1;
213
- test = gte;
214
- }
215
- var pad = n.some(isPadded);
216
- N = [];
217
- for (var i2 = x; test(i2, y); i2 += incr) {
218
- var c;
219
- if (isAlphaSequence) {
220
- c = String.fromCharCode(i2);
221
- if (c === "\\")
222
- c = "";
223
- } else {
224
- c = String(i2);
225
- if (pad) {
226
- var need = width - c.length;
227
- if (need > 0) {
228
- var z = new Array(need + 1).join("0");
229
- if (i2 < 0)
230
- c = "-" + z + c.slice(1);
231
- else
232
- c = z + c;
233
- }
234
- }
235
- }
236
- N.push(c);
237
- }
238
- } else {
239
- N = [];
240
- for (var j = 0; j < n.length; j++) {
241
- N.push.apply(N, expand2(n[j], false));
242
- }
243
- }
244
- for (var j = 0; j < N.length; j++) {
245
- for (var k = 0; k < post.length; k++) {
246
- var expansion = pre + N[j] + post[k];
247
- if (!isTop || isSequence || expansion)
248
- expansions.push(expansion);
249
- }
250
- }
251
- }
252
- return expansions;
253
- }
254
- }
255
- });
256
-
257
- // node_modules/minimatch/dist/esm/index.js
258
- var import_brace_expansion = __toESM(require_brace_expansion());
259
-
260
- // node_modules/minimatch/dist/esm/assert-valid-pattern.js
261
- var MAX_PATTERN_LENGTH = 1024 * 64;
262
- var assertValidPattern = (pattern) => {
263
- if (typeof pattern !== "string") {
264
- throw new TypeError("invalid pattern");
265
- }
266
- if (pattern.length > MAX_PATTERN_LENGTH) {
267
- throw new TypeError("pattern is too long");
268
- }
269
- };
270
-
271
- // node_modules/minimatch/dist/esm/brace-expressions.js
272
- var posixClasses = {
273
- "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
274
- "[:alpha:]": ["\\p{L}\\p{Nl}", true],
275
- "[:ascii:]": ["\\x00-\\x7f", false],
276
- "[:blank:]": ["\\p{Zs}\\t", true],
277
- "[:cntrl:]": ["\\p{Cc}", true],
278
- "[:digit:]": ["\\p{Nd}", true],
279
- "[:graph:]": ["\\p{Z}\\p{C}", true, true],
280
- "[:lower:]": ["\\p{Ll}", true],
281
- "[:print:]": ["\\p{C}", true],
282
- "[:punct:]": ["\\p{P}", true],
283
- "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
284
- "[:upper:]": ["\\p{Lu}", true],
285
- "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
286
- "[:xdigit:]": ["A-Fa-f0-9", false]
287
- };
288
- var braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
289
- var regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
290
- var rangesToString = (ranges) => ranges.join("");
291
- var parseClass = (glob, position) => {
292
- const pos = position;
293
- if (glob.charAt(pos) !== "[") {
294
- throw new Error("not in a brace expression");
295
- }
296
- const ranges = [];
297
- const negs = [];
298
- let i2 = pos + 1;
299
- let sawStart = false;
300
- let uflag = false;
301
- let escaping = false;
302
- let negate = false;
303
- let endPos = pos;
304
- let rangeStart = "";
305
- WHILE: while (i2 < glob.length) {
306
- const c = glob.charAt(i2);
307
- if ((c === "!" || c === "^") && i2 === pos + 1) {
308
- negate = true;
309
- i2++;
310
- continue;
311
- }
312
- if (c === "]" && sawStart && !escaping) {
313
- endPos = i2 + 1;
314
- break;
315
- }
316
- sawStart = true;
317
- if (c === "\\") {
318
- if (!escaping) {
319
- escaping = true;
320
- i2++;
321
- continue;
322
- }
323
- }
324
- if (c === "[" && !escaping) {
325
- for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
326
- if (glob.startsWith(cls, i2)) {
327
- if (rangeStart) {
328
- return ["$.", false, glob.length - pos, true];
329
- }
330
- i2 += cls.length;
331
- if (neg)
332
- negs.push(unip);
333
- else
334
- ranges.push(unip);
335
- uflag = uflag || u;
336
- continue WHILE;
337
- }
338
- }
339
- }
340
- escaping = false;
341
- if (rangeStart) {
342
- if (c > rangeStart) {
343
- ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
344
- } else if (c === rangeStart) {
345
- ranges.push(braceEscape(c));
346
- }
347
- rangeStart = "";
348
- i2++;
349
- continue;
350
- }
351
- if (glob.startsWith("-]", i2 + 1)) {
352
- ranges.push(braceEscape(c + "-"));
353
- i2 += 2;
354
- continue;
355
- }
356
- if (glob.startsWith("-", i2 + 1)) {
357
- rangeStart = c;
358
- i2 += 2;
359
- continue;
360
- }
361
- ranges.push(braceEscape(c));
362
- i2++;
363
- }
364
- if (endPos < i2) {
365
- return ["", false, 0, false];
366
- }
367
- if (!ranges.length && !negs.length) {
368
- return ["$.", false, glob.length - pos, true];
369
- }
370
- if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
371
- const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
372
- return [regexpEscape(r), false, endPos - pos, false];
373
- }
374
- const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
375
- const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
376
- const comb = ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs;
377
- return [comb, uflag, endPos - pos, true];
378
- };
379
-
380
- // node_modules/minimatch/dist/esm/unescape.js
381
- var unescape = (s, { windowsPathsNoEscape = false } = {}) => {
382
- return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
383
- };
384
-
385
- // node_modules/minimatch/dist/esm/ast.js
386
- var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
387
- var isExtglobType = (c) => types.has(c);
388
- var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
389
- var startNoDot = "(?!\\.)";
390
- var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
391
- var justDots = /* @__PURE__ */ new Set(["..", "."]);
392
- var reSpecials = new Set("().*{}+?[]^$\\!");
393
- var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
394
- var qmark = "[^/]";
395
- var star = qmark + "*?";
396
- var starNoEmpty = qmark + "+?";
397
- var _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, partsToRegExp_fn, parseGlob_fn;
398
- var _AST = class _AST {
399
- constructor(type, parent, options = {}) {
400
- __privateAdd(this, _AST_instances);
401
- __publicField(this, "type");
402
- __privateAdd(this, _root);
403
- __privateAdd(this, _hasMagic);
404
- __privateAdd(this, _uflag, false);
405
- __privateAdd(this, _parts, []);
406
- __privateAdd(this, _parent);
407
- __privateAdd(this, _parentIndex);
408
- __privateAdd(this, _negs);
409
- __privateAdd(this, _filledNegs, false);
410
- __privateAdd(this, _options);
411
- __privateAdd(this, _toString);
412
- // set to true if it's an extglob with no children
413
- // (which really means one child of '')
414
- __privateAdd(this, _emptyExt, false);
415
- this.type = type;
416
- if (type)
417
- __privateSet(this, _hasMagic, true);
418
- __privateSet(this, _parent, parent);
419
- __privateSet(this, _root, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _root) : this);
420
- __privateSet(this, _options, __privateGet(this, _root) === this ? options : __privateGet(__privateGet(this, _root), _options));
421
- __privateSet(this, _negs, __privateGet(this, _root) === this ? [] : __privateGet(__privateGet(this, _root), _negs));
422
- if (type === "!" && !__privateGet(__privateGet(this, _root), _filledNegs))
423
- __privateGet(this, _negs).push(this);
424
- __privateSet(this, _parentIndex, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0);
425
- }
426
- get hasMagic() {
427
- if (__privateGet(this, _hasMagic) !== void 0)
428
- return __privateGet(this, _hasMagic);
429
- for (const p of __privateGet(this, _parts)) {
430
- if (typeof p === "string")
431
- continue;
432
- if (p.type || p.hasMagic)
433
- return __privateSet(this, _hasMagic, true);
434
- }
435
- return __privateGet(this, _hasMagic);
436
- }
437
- // reconstructs the pattern
438
- toString() {
439
- if (__privateGet(this, _toString) !== void 0)
440
- return __privateGet(this, _toString);
441
- if (!this.type) {
442
- return __privateSet(this, _toString, __privateGet(this, _parts).map((p) => String(p)).join(""));
443
- } else {
444
- return __privateSet(this, _toString, this.type + "(" + __privateGet(this, _parts).map((p) => String(p)).join("|") + ")");
445
- }
446
- }
447
- push(...parts) {
448
- for (const p of parts) {
449
- if (p === "")
450
- continue;
451
- if (typeof p !== "string" && !(p instanceof _AST && __privateGet(p, _parent) === this)) {
452
- throw new Error("invalid part: " + p);
453
- }
454
- __privateGet(this, _parts).push(p);
455
- }
456
- }
457
- toJSON() {
458
- var _a;
459
- const ret = this.type === null ? __privateGet(this, _parts).slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...__privateGet(this, _parts).map((p) => p.toJSON())];
460
- if (this.isStart() && !this.type)
461
- ret.unshift([]);
462
- if (this.isEnd() && (this === __privateGet(this, _root) || __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")) {
463
- ret.push({});
464
- }
465
- return ret;
466
- }
467
- isStart() {
468
- var _a;
469
- if (__privateGet(this, _root) === this)
470
- return true;
471
- if (!((_a = __privateGet(this, _parent)) == null ? void 0 : _a.isStart()))
472
- return false;
473
- if (__privateGet(this, _parentIndex) === 0)
474
- return true;
475
- const p = __privateGet(this, _parent);
476
- for (let i2 = 0; i2 < __privateGet(this, _parentIndex); i2++) {
477
- const pp = __privateGet(p, _parts)[i2];
478
- if (!(pp instanceof _AST && pp.type === "!")) {
479
- return false;
480
- }
481
- }
482
- return true;
483
- }
484
- isEnd() {
485
- var _a, _b, _c;
486
- if (__privateGet(this, _root) === this)
487
- return true;
488
- if (((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")
489
- return true;
490
- if (!((_b = __privateGet(this, _parent)) == null ? void 0 : _b.isEnd()))
491
- return false;
492
- if (!this.type)
493
- return (_c = __privateGet(this, _parent)) == null ? void 0 : _c.isEnd();
494
- const pl = __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0;
495
- return __privateGet(this, _parentIndex) === pl - 1;
496
- }
497
- copyIn(part) {
498
- if (typeof part === "string")
499
- this.push(part);
500
- else
501
- this.push(part.clone(this));
502
- }
503
- clone(parent) {
504
- const c = new _AST(this.type, parent);
505
- for (const p of __privateGet(this, _parts)) {
506
- c.copyIn(p);
507
- }
508
- return c;
509
- }
510
- static fromGlob(pattern, options = {}) {
511
- var _a;
512
- const ast = new _AST(null, void 0, options);
513
- __privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, pattern, ast, 0, options);
514
- return ast;
515
- }
516
- // returns the regular expression if there's magic, or the unescaped
517
- // string if not.
518
- toMMPattern() {
519
- if (this !== __privateGet(this, _root))
520
- return __privateGet(this, _root).toMMPattern();
521
- const glob = this.toString();
522
- const [re, body, hasMagic, uflag] = this.toRegExpSource();
523
- const anyMagic = hasMagic || __privateGet(this, _hasMagic) || __privateGet(this, _options).nocase && !__privateGet(this, _options).nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
524
- if (!anyMagic) {
525
- return body;
526
- }
527
- const flags = (__privateGet(this, _options).nocase ? "i" : "") + (uflag ? "u" : "");
528
- return Object.assign(new RegExp(`^${re}$`, flags), {
529
- _src: re,
530
- _glob: glob
531
- });
532
- }
533
- get options() {
534
- return __privateGet(this, _options);
535
- }
536
- // returns the string match, the regexp source, whether there's magic
537
- // in the regexp (so a regular expression is required) and whether or
538
- // not the uflag is needed for the regular expression (for posix classes)
539
- // TODO: instead of injecting the start/end at this point, just return
540
- // the BODY of the regexp, along with the start/end portions suitable
541
- // for binding the start/end in either a joined full-path makeRe context
542
- // (where we bind to (^|/), or a standalone matchPart context (where
543
- // we bind to ^, and not /). Otherwise slashes get duped!
544
- //
545
- // In part-matching mode, the start is:
546
- // - if not isStart: nothing
547
- // - if traversal possible, but not allowed: ^(?!\.\.?$)
548
- // - if dots allowed or not possible: ^
549
- // - if dots possible and not allowed: ^(?!\.)
550
- // end is:
551
- // - if not isEnd(): nothing
552
- // - else: $
553
- //
554
- // In full-path matching mode, we put the slash at the START of the
555
- // pattern, so start is:
556
- // - if first pattern: same as part-matching mode
557
- // - if not isStart(): nothing
558
- // - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
559
- // - if dots allowed or not possible: /
560
- // - if dots possible and not allowed: /(?!\.)
561
- // end is:
562
- // - if last pattern, same as part-matching mode
563
- // - else nothing
564
- //
565
- // Always put the (?:$|/) on negated tails, though, because that has to be
566
- // there to bind the end of the negated pattern portion, and it's easier to
567
- // just stick it in now rather than try to inject it later in the middle of
568
- // the pattern.
569
- //
570
- // We can just always return the same end, and leave it up to the caller
571
- // to know whether it's going to be used joined or in parts.
572
- // And, if the start is adjusted slightly, can do the same there:
573
- // - if not isStart: nothing
574
- // - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
575
- // - if dots allowed or not possible: (?:/|^)
576
- // - if dots possible and not allowed: (?:/|^)(?!\.)
577
- //
578
- // But it's better to have a simpler binding without a conditional, for
579
- // performance, so probably better to return both start options.
580
- //
581
- // Then the caller just ignores the end if it's not the first pattern,
582
- // and the start always gets applied.
583
- //
584
- // But that's always going to be $ if it's the ending pattern, or nothing,
585
- // so the caller can just attach $ at the end of the pattern when building.
586
- //
587
- // So the todo is:
588
- // - better detect what kind of start is needed
589
- // - return both flavors of starting pattern
590
- // - attach $ at the end of the pattern when creating the actual RegExp
591
- //
592
- // Ah, but wait, no, that all only applies to the root when the first pattern
593
- // is not an extglob. If the first pattern IS an extglob, then we need all
594
- // that dot prevention biz to live in the extglob portions, because eg
595
- // +(*|.x*) can match .xy but not .yx.
596
- //
597
- // So, return the two flavors if it's #root and the first child is not an
598
- // AST, otherwise leave it to the child AST to handle it, and there,
599
- // use the (?:^|/) style of start binding.
600
- //
601
- // Even simplified further:
602
- // - Since the start for a join is eg /(?!\.) and the start for a part
603
- // is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
604
- // or start or whatever) and prepend ^ or / at the Regexp construction.
605
- toRegExpSource(allowDot) {
606
- var _a;
607
- const dot = allowDot != null ? allowDot : !!__privateGet(this, _options).dot;
608
- if (__privateGet(this, _root) === this)
609
- __privateMethod(this, _AST_instances, fillNegs_fn).call(this);
610
- if (!this.type) {
611
- const noEmpty = this.isStart() && this.isEnd();
612
- const src = __privateGet(this, _parts).map((p) => {
613
- var _a2;
614
- const [re, _, hasMagic, uflag] = typeof p === "string" ? __privateMethod(_a2 = _AST, _AST_static, parseGlob_fn).call(_a2, p, __privateGet(this, _hasMagic), noEmpty) : p.toRegExpSource(allowDot);
615
- __privateSet(this, _hasMagic, __privateGet(this, _hasMagic) || hasMagic);
616
- __privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
617
- return re;
618
- }).join("");
619
- let start2 = "";
620
- if (this.isStart()) {
621
- if (typeof __privateGet(this, _parts)[0] === "string") {
622
- const dotTravAllowed = __privateGet(this, _parts).length === 1 && justDots.has(__privateGet(this, _parts)[0]);
623
- if (!dotTravAllowed) {
624
- const aps = addPatternStart;
625
- const needNoTrav = (
626
- // dots are allowed, and the pattern starts with [ or .
627
- dot && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
628
- src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
629
- src.startsWith("\\.\\.") && aps.has(src.charAt(4))
630
- );
631
- const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
632
- start2 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
633
- }
634
- }
7
+ /**
8
+ * Retrieve Component Storybook URL from file path
9
+ * @param storybookBaseUrl - Storybook Base URL
10
+ * @param filePath - Component file path
11
+ * @returns Component Storybook URL
12
+ */
13
+ const getStorybookUrl = (storybookBaseUrl, filePath) => {
14
+ if (!filePath) {
15
+ return;
635
16
  }
636
- let end = "";
637
- if (this.isEnd() && __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!") {
638
- end = "(?:$|\\/)";
17
+ const split = filePath.split('/');
18
+ return `${storybookBaseUrl}${split.slice(2, split.length - 1).join('-')}--docs`;
19
+ };
20
+
21
+ /**
22
+ * Retrieve Component source URL from file path
23
+ * @param sourcesBaseUrl - Source base URL
24
+ * @param filePath - Component file path
25
+ * @returns Component source URL
26
+ */
27
+ const getSourcesUrl = (sourcesBaseUrl, filePath) => {
28
+ if (!filePath) {
29
+ return;
639
30
  }
640
- const final2 = start2 + src + end;
31
+ return `${sourcesBaseUrl}${filePath}`;
32
+ };
33
+ /**
34
+ * Get Component element description
35
+ * @param component - Component
36
+ * @returns Component element description
37
+ */
38
+ const getElementDescription = (component) => {
39
+ // Init description
40
+ let description = component.overview ? `${component.overview}\n\n` : '';
41
+ // Attributes
42
+ const attributes = component.props.filter(({ attr }) => attr !== undefined);
43
+ if (attributes.length) {
44
+ description += `Attributes:\n`;
45
+ description += attributes.map(({ attr, docs }) => `- \`${attr}\`: ${docs}\n`).join('');
46
+ description += '\n';
47
+ }
48
+ // Properties
49
+ const properties = component.props.filter(({ attr }) => attr === undefined);
50
+ if (properties.length) {
51
+ description += `Properties:\n`;
52
+ description += properties.map(({ name, docs }) => `- \`${name}\`: ${docs}\n`).join('');
53
+ description += '\n';
54
+ }
55
+ // Methods
56
+ if (component.methods.length) {
57
+ description += `Methods:\n`;
58
+ description += component.methods.map(({ name, docs }) => `- \`${name}\`: ${docs}\n`).join('');
59
+ description += '\n';
60
+ }
61
+ // Events
62
+ if (component.events.length) {
63
+ description += `Events:\n`;
64
+ description += component.events.map(({ event, docs }) => `- \`${event}\`: ${docs}\n`).join('');
65
+ description += '\n';
66
+ }
67
+ // Listeners
68
+ if (component.listeners.length) {
69
+ description += `Listeners:\n`;
70
+ description += component.listeners.map(({ event }) => `- \`${event}\`\n`).join('');
71
+ description += '\n';
72
+ }
73
+ // Slots
74
+ if (component.slots.length) {
75
+ description += `Slots:\n`;
76
+ description += component.slots.map(({ name, docs }) => `- \`${name}\`: ${docs}\n`).join('');
77
+ description += '\n';
78
+ }
79
+ // Return
80
+ return description;
81
+ };
82
+ /**
83
+ * Get Props Description
84
+ * @param prop - Component Property
85
+ * @returns Props Description
86
+ */
87
+ const getAttributeDescription = (prop) => {
88
+ return `${prop.docs}\n\nType: \`${prop.type}\``;
89
+ };
90
+ /**
91
+ * Generate Web Types metadata for IntelliJ's IDE
92
+ * @param name - Library name
93
+ * @param version - Library version
94
+ * @param jsonDocs - Stencil JSON doc
95
+ * @param storybookBaseUrl - Storybook Base Url
96
+ * @returns Web Types metadata
97
+ * @example
98
+ * ```ts
99
+ * const webTypesJson = webTypesGenerator('@mgdis/mg-components', '1.0.0', jsonDocs, 'https://storybook.example.com');
100
+ * ```
101
+ */
102
+ const webTypesGenerator = (name, version, jsonDocs, storybookBaseUrl) => ({
103
+ '$schema': 'https://json.schemastore.org/web-types',
104
+ name,
105
+ version,
106
+ 'description-markup': 'markdown',
107
+ 'contributions': {
108
+ html: {
109
+ elements: jsonDocs.components.map(component => {
110
+ const docUrl = getStorybookUrl(storybookBaseUrl, component.filePath);
111
+ return {
112
+ 'name': component.tag,
113
+ 'description': getElementDescription(component),
114
+ 'doc-url': docUrl,
115
+ 'attributes': component.props
116
+ .filter(prop => prop.attr)
117
+ .map(prop => ({
118
+ 'name': prop.attr,
119
+ 'description': getAttributeDescription(prop),
120
+ 'doc-url': docUrl,
121
+ 'value': {
122
+ type: prop.type,
123
+ default: prop.default,
124
+ required: prop.required,
125
+ },
126
+ })),
127
+ 'js': {
128
+ properties: component.props.map(prop => ({
129
+ 'name': prop.name,
130
+ 'description': getAttributeDescription(prop),
131
+ 'doc-url': docUrl,
132
+ 'value': {
133
+ type: prop.type,
134
+ default: prop.default,
135
+ required: prop.required,
136
+ },
137
+ })),
138
+ events: component.events.map(event => ({
139
+ name: event.event,
140
+ description: event.docs,
141
+ })),
142
+ },
143
+ 'css': {
144
+ properties: component.styles.map(style => ({
145
+ name: style.name,
146
+ description: style.docs,
147
+ })),
148
+ },
149
+ };
150
+ }),
151
+ },
152
+ },
153
+ });
154
+ /**
155
+ * Create Storybook Reference
156
+ * @param storybookBaseUrl - Storybook Base Url
157
+ * @param filePath - Component file path
158
+ * @returns Storybook Reference
159
+ */
160
+ const getReferences = (storybookBaseUrl, sourceBaseUrl, filePath) => {
641
161
  return [
642
- final2,
643
- unescape(src),
644
- __privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
645
- __privateGet(this, _uflag)
162
+ { name: 'Storybook', url: getStorybookUrl(storybookBaseUrl, filePath) },
163
+ { name: 'Sources', url: getSourcesUrl(sourceBaseUrl, filePath) },
646
164
  ];
647
- }
648
- const repeated = this.type === "*" || this.type === "+";
649
- const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
650
- let body = __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, dot);
651
- if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
652
- const s = this.toString();
653
- __privateSet(this, _parts, [s]);
654
- this.type = null;
655
- __privateSet(this, _hasMagic, void 0);
656
- return [s, unescape(this.toString()), false, false];
657
- }
658
- let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, true);
659
- if (bodyDotAllowed === body) {
660
- bodyDotAllowed = "";
661
- }
662
- if (bodyDotAllowed) {
663
- body = `(?:${body})(?:${bodyDotAllowed})*?`;
664
- }
665
- let final = "";
666
- if (this.type === "!" && __privateGet(this, _emptyExt)) {
667
- final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
668
- } else {
669
- const close = this.type === "!" ? (
670
- // !() must match something,but !(x) can match ''
671
- "))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star + ")"
672
- ) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
673
- final = start + body + close;
674
- }
675
- return [
676
- final,
677
- unescape(body),
678
- __privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
679
- __privateGet(this, _uflag)
680
- ];
681
- }
682
- };
683
- _root = new WeakMap();
684
- _hasMagic = new WeakMap();
685
- _uflag = new WeakMap();
686
- _parts = new WeakMap();
687
- _parent = new WeakMap();
688
- _parentIndex = new WeakMap();
689
- _negs = new WeakMap();
690
- _filledNegs = new WeakMap();
691
- _options = new WeakMap();
692
- _toString = new WeakMap();
693
- _emptyExt = new WeakMap();
694
- _AST_instances = new WeakSet();
695
- fillNegs_fn = function() {
696
- if (this !== __privateGet(this, _root))
697
- throw new Error("should only call on root");
698
- if (__privateGet(this, _filledNegs))
699
- return this;
700
- this.toString();
701
- __privateSet(this, _filledNegs, true);
702
- let n;
703
- while (n = __privateGet(this, _negs).pop()) {
704
- if (n.type !== "!")
705
- continue;
706
- let p = n;
707
- let pp = __privateGet(p, _parent);
708
- while (pp) {
709
- for (let i2 = __privateGet(p, _parentIndex) + 1; !pp.type && i2 < __privateGet(pp, _parts).length; i2++) {
710
- for (const part of __privateGet(n, _parts)) {
711
- if (typeof part === "string") {
712
- throw new Error("string part in extglob AST??");
713
- }
714
- part.copyIn(__privateGet(pp, _parts)[i2]);
715
- }
716
- }
717
- p = pp;
718
- pp = __privateGet(p, _parent);
719
- }
720
- }
721
- return this;
722
- };
723
- _AST_static = new WeakSet();
724
- parseAST_fn = function(str, ast, pos, opt) {
725
- var _a, _b;
726
- let escaping = false;
727
- let inBrace = false;
728
- let braceStart = -1;
729
- let braceNeg = false;
730
- if (ast.type === null) {
731
- let i3 = pos;
732
- let acc2 = "";
733
- while (i3 < str.length) {
734
- const c = str.charAt(i3++);
735
- if (escaping || c === "\\") {
736
- escaping = !escaping;
737
- acc2 += c;
738
- continue;
739
- }
740
- if (inBrace) {
741
- if (i3 === braceStart + 1) {
742
- if (c === "^" || c === "!") {
743
- braceNeg = true;
744
- }
745
- } else if (c === "]" && !(i3 === braceStart + 2 && braceNeg)) {
746
- inBrace = false;
747
- }
748
- acc2 += c;
749
- continue;
750
- } else if (c === "[") {
751
- inBrace = true;
752
- braceStart = i3;
753
- braceNeg = false;
754
- acc2 += c;
755
- continue;
756
- }
757
- if (!opt.noext && isExtglobType(c) && str.charAt(i3) === "(") {
758
- ast.push(acc2);
759
- acc2 = "";
760
- const ext2 = new _AST(c, ast);
761
- i3 = __privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, str, ext2, i3, opt);
762
- ast.push(ext2);
763
- continue;
764
- }
765
- acc2 += c;
766
- }
767
- ast.push(acc2);
768
- return i3;
769
- }
770
- let i2 = pos + 1;
771
- let part = new _AST(null, ast);
772
- const parts = [];
773
- let acc = "";
774
- while (i2 < str.length) {
775
- const c = str.charAt(i2++);
776
- if (escaping || c === "\\") {
777
- escaping = !escaping;
778
- acc += c;
779
- continue;
780
- }
781
- if (inBrace) {
782
- if (i2 === braceStart + 1) {
783
- if (c === "^" || c === "!") {
784
- braceNeg = true;
785
- }
786
- } else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) {
787
- inBrace = false;
788
- }
789
- acc += c;
790
- continue;
791
- } else if (c === "[") {
792
- inBrace = true;
793
- braceStart = i2;
794
- braceNeg = false;
795
- acc += c;
796
- continue;
797
- }
798
- if (isExtglobType(c) && str.charAt(i2) === "(") {
799
- part.push(acc);
800
- acc = "";
801
- const ext2 = new _AST(c, part);
802
- part.push(ext2);
803
- i2 = __privateMethod(_b = _AST, _AST_static, parseAST_fn).call(_b, str, ext2, i2, opt);
804
- continue;
805
- }
806
- if (c === "|") {
807
- part.push(acc);
808
- acc = "";
809
- parts.push(part);
810
- part = new _AST(null, ast);
811
- continue;
812
- }
813
- if (c === ")") {
814
- if (acc === "" && __privateGet(ast, _parts).length === 0) {
815
- __privateSet(ast, _emptyExt, true);
816
- }
817
- part.push(acc);
818
- acc = "";
819
- ast.push(...parts, part);
820
- return i2;
821
- }
822
- acc += c;
823
- }
824
- ast.type = null;
825
- __privateSet(ast, _hasMagic, void 0);
826
- __privateSet(ast, _parts, [str.substring(pos - 1)]);
827
- return i2;
828
- };
829
- partsToRegExp_fn = function(dot) {
830
- return __privateGet(this, _parts).map((p) => {
831
- if (typeof p === "string") {
832
- throw new Error("string type in extglob ast??");
833
- }
834
- const [re, _, _hasMagic2, uflag] = p.toRegExpSource(dot);
835
- __privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
836
- return re;
837
- }).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
838
- };
839
- parseGlob_fn = function(glob, hasMagic, noEmpty = false) {
840
- let escaping = false;
841
- let re = "";
842
- let uflag = false;
843
- for (let i2 = 0; i2 < glob.length; i2++) {
844
- const c = glob.charAt(i2);
845
- if (escaping) {
846
- escaping = false;
847
- re += (reSpecials.has(c) ? "\\" : "") + c;
848
- continue;
849
- }
850
- if (c === "\\") {
851
- if (i2 === glob.length - 1) {
852
- re += "\\\\";
853
- } else {
854
- escaping = true;
855
- }
856
- continue;
857
- }
858
- if (c === "[") {
859
- const [src, needUflag, consumed, magic] = parseClass(glob, i2);
860
- if (consumed) {
861
- re += src;
862
- uflag = uflag || needUflag;
863
- i2 += consumed - 1;
864
- hasMagic = hasMagic || magic;
865
- continue;
866
- }
867
- }
868
- if (c === "*") {
869
- if (noEmpty && glob === "*")
870
- re += starNoEmpty;
871
- else
872
- re += star;
873
- hasMagic = true;
874
- continue;
875
- }
876
- if (c === "?") {
877
- re += qmark;
878
- hasMagic = true;
879
- continue;
880
- }
881
- re += regExpEscape(c);
882
- }
883
- return [re, unescape(glob), !!hasMagic, uflag];
884
- };
885
- __privateAdd(_AST, _AST_static);
886
- var AST = _AST;
887
-
888
- // node_modules/minimatch/dist/esm/escape.js
889
- var escape = (s, { windowsPathsNoEscape = false } = {}) => {
890
- return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
891
- };
892
-
893
- // node_modules/minimatch/dist/esm/index.js
894
- var minimatch = (p, pattern, options = {}) => {
895
- assertValidPattern(pattern);
896
- if (!options.nocomment && pattern.charAt(0) === "#") {
897
- return false;
898
- }
899
- return new Minimatch(pattern, options).match(p);
900
- };
901
- var starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
902
- var starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
903
- var starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2);
904
- var starDotExtTestNocase = (ext2) => {
905
- ext2 = ext2.toLowerCase();
906
- return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext2);
907
- };
908
- var starDotExtTestNocaseDot = (ext2) => {
909
- ext2 = ext2.toLowerCase();
910
- return (f) => f.toLowerCase().endsWith(ext2);
911
- };
912
- var starDotStarRE = /^\*+\.\*+$/;
913
- var starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
914
- var starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
915
- var dotStarRE = /^\.\*+$/;
916
- var dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
917
- var starRE = /^\*+$/;
918
- var starTest = (f) => f.length !== 0 && !f.startsWith(".");
919
- var starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
920
- var qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
921
- var qmarksTestNocase = ([$0, ext2 = ""]) => {
922
- const noext = qmarksTestNoExt([$0]);
923
- if (!ext2)
924
- return noext;
925
- ext2 = ext2.toLowerCase();
926
- return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
927
- };
928
- var qmarksTestNocaseDot = ([$0, ext2 = ""]) => {
929
- const noext = qmarksTestNoExtDot([$0]);
930
- if (!ext2)
931
- return noext;
932
- ext2 = ext2.toLowerCase();
933
- return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
934
- };
935
- var qmarksTestDot = ([$0, ext2 = ""]) => {
936
- const noext = qmarksTestNoExtDot([$0]);
937
- return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
938
- };
939
- var qmarksTest = ([$0, ext2 = ""]) => {
940
- const noext = qmarksTestNoExt([$0]);
941
- return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
942
- };
943
- var qmarksTestNoExt = ([$0]) => {
944
- const len = $0.length;
945
- return (f) => f.length === len && !f.startsWith(".");
946
- };
947
- var qmarksTestNoExtDot = ([$0]) => {
948
- const len = $0.length;
949
- return (f) => f.length === len && f !== "." && f !== "..";
950
- };
951
- var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
952
- var path = {
953
- win32: { sep: "\\" },
954
- posix: { sep: "/" }
955
- };
956
- var sep = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
957
- minimatch.sep = sep;
958
- var GLOBSTAR = Symbol("globstar **");
959
- minimatch.GLOBSTAR = GLOBSTAR;
960
- var qmark2 = "[^/]";
961
- var star2 = qmark2 + "*?";
962
- var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
963
- var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
964
- var filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
965
- minimatch.filter = filter;
966
- var ext = (a, b = {}) => Object.assign({}, a, b);
967
- var defaults = (def) => {
968
- if (!def || typeof def !== "object" || !Object.keys(def).length) {
969
- return minimatch;
970
- }
971
- const orig = minimatch;
972
- const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
973
- return Object.assign(m, {
974
- Minimatch: class Minimatch extends orig.Minimatch {
975
- constructor(pattern, options = {}) {
976
- super(pattern, ext(def, options));
977
- }
978
- static defaults(options) {
979
- return orig.defaults(ext(def, options)).Minimatch;
980
- }
981
- },
982
- AST: class AST extends orig.AST {
983
- /* c8 ignore start */
984
- constructor(type, parent, options = {}) {
985
- super(type, parent, ext(def, options));
986
- }
987
- /* c8 ignore stop */
988
- static fromGlob(pattern, options = {}) {
989
- return orig.AST.fromGlob(pattern, ext(def, options));
990
- }
991
- },
992
- unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
993
- escape: (s, options = {}) => orig.escape(s, ext(def, options)),
994
- filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
995
- defaults: (options) => orig.defaults(ext(def, options)),
996
- makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
997
- braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
998
- match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
999
- sep: orig.sep,
1000
- GLOBSTAR
1001
- });
1002
- };
1003
- minimatch.defaults = defaults;
1004
- var braceExpand = (pattern, options = {}) => {
1005
- assertValidPattern(pattern);
1006
- if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
1007
- return [pattern];
1008
- }
1009
- return (0, import_brace_expansion.default)(pattern);
1010
- };
1011
- minimatch.braceExpand = braceExpand;
1012
- var makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
1013
- minimatch.makeRe = makeRe;
1014
- var match = (list, pattern, options = {}) => {
1015
- const mm = new Minimatch(pattern, options);
1016
- list = list.filter((f) => mm.match(f));
1017
- if (mm.options.nonull && !list.length) {
1018
- list.push(pattern);
1019
- }
1020
- return list;
1021
- };
1022
- minimatch.match = match;
1023
- var globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
1024
- var regExpEscape2 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
1025
- var Minimatch = class {
1026
- options;
1027
- set;
1028
- pattern;
1029
- windowsPathsNoEscape;
1030
- nonegate;
1031
- negate;
1032
- comment;
1033
- empty;
1034
- preserveMultipleSlashes;
1035
- partial;
1036
- globSet;
1037
- globParts;
1038
- nocase;
1039
- isWindows;
1040
- platform;
1041
- windowsNoMagicRoot;
1042
- regexp;
1043
- constructor(pattern, options = {}) {
1044
- assertValidPattern(pattern);
1045
- options = options || {};
1046
- this.options = options;
1047
- this.pattern = pattern;
1048
- this.platform = options.platform || defaultPlatform;
1049
- this.isWindows = this.platform === "win32";
1050
- this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
1051
- if (this.windowsPathsNoEscape) {
1052
- this.pattern = this.pattern.replace(/\\/g, "/");
1053
- }
1054
- this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
1055
- this.regexp = null;
1056
- this.negate = false;
1057
- this.nonegate = !!options.nonegate;
1058
- this.comment = false;
1059
- this.empty = false;
1060
- this.partial = !!options.partial;
1061
- this.nocase = !!this.options.nocase;
1062
- this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
1063
- this.globSet = [];
1064
- this.globParts = [];
1065
- this.set = [];
1066
- this.make();
1067
- }
1068
- hasMagic() {
1069
- if (this.options.magicalBraces && this.set.length > 1) {
1070
- return true;
1071
- }
1072
- for (const pattern of this.set) {
1073
- for (const part of pattern) {
1074
- if (typeof part !== "string")
1075
- return true;
1076
- }
1077
- }
1078
- return false;
1079
- }
1080
- debug(..._) {
1081
- }
1082
- make() {
1083
- const pattern = this.pattern;
1084
- const options = this.options;
1085
- if (!options.nocomment && pattern.charAt(0) === "#") {
1086
- this.comment = true;
1087
- return;
1088
- }
1089
- if (!pattern) {
1090
- this.empty = true;
1091
- return;
1092
- }
1093
- this.parseNegate();
1094
- this.globSet = [...new Set(this.braceExpand())];
1095
- if (options.debug) {
1096
- this.debug = (...args) => console.error(...args);
1097
- }
1098
- this.debug(this.pattern, this.globSet);
1099
- const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
1100
- this.globParts = this.preprocess(rawGlobParts);
1101
- this.debug(this.pattern, this.globParts);
1102
- let set = this.globParts.map((s, _, __) => {
1103
- if (this.isWindows && this.windowsNoMagicRoot) {
1104
- const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
1105
- const isDrive = /^[a-z]:/i.test(s[0]);
1106
- if (isUNC) {
1107
- return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
1108
- } else if (isDrive) {
1109
- return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
1110
- }
1111
- }
1112
- return s.map((ss) => this.parse(ss));
1113
- });
1114
- this.debug(this.pattern, set);
1115
- this.set = set.filter((s) => s.indexOf(false) === -1);
1116
- if (this.isWindows) {
1117
- for (let i2 = 0; i2 < this.set.length; i2++) {
1118
- const p = this.set[i2];
1119
- if (p[0] === "" && p[1] === "" && this.globParts[i2][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) {
1120
- p[2] = "?";
1121
- }
1122
- }
1123
- }
1124
- this.debug(this.pattern, this.set);
1125
- }
1126
- // various transforms to equivalent pattern sets that are
1127
- // faster to process in a filesystem walk. The goal is to
1128
- // eliminate what we can, and push all ** patterns as far
1129
- // to the right as possible, even if it increases the number
1130
- // of patterns that we have to process.
1131
- preprocess(globParts) {
1132
- if (this.options.noglobstar) {
1133
- for (let i2 = 0; i2 < globParts.length; i2++) {
1134
- for (let j = 0; j < globParts[i2].length; j++) {
1135
- if (globParts[i2][j] === "**") {
1136
- globParts[i2][j] = "*";
1137
- }
1138
- }
1139
- }
1140
- }
1141
- const { optimizationLevel = 1 } = this.options;
1142
- if (optimizationLevel >= 2) {
1143
- globParts = this.firstPhasePreProcess(globParts);
1144
- globParts = this.secondPhasePreProcess(globParts);
1145
- } else if (optimizationLevel >= 1) {
1146
- globParts = this.levelOneOptimize(globParts);
1147
- } else {
1148
- globParts = this.adjascentGlobstarOptimize(globParts);
1149
- }
1150
- return globParts;
1151
- }
1152
- // just get rid of adjascent ** portions
1153
- adjascentGlobstarOptimize(globParts) {
1154
- return globParts.map((parts) => {
1155
- let gs = -1;
1156
- while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
1157
- let i2 = gs;
1158
- while (parts[i2 + 1] === "**") {
1159
- i2++;
1160
- }
1161
- if (i2 !== gs) {
1162
- parts.splice(gs, i2 - gs);
1163
- }
1164
- }
1165
- return parts;
1166
- });
1167
- }
1168
- // get rid of adjascent ** and resolve .. portions
1169
- levelOneOptimize(globParts) {
1170
- return globParts.map((parts) => {
1171
- parts = parts.reduce((set, part) => {
1172
- const prev = set[set.length - 1];
1173
- if (part === "**" && prev === "**") {
1174
- return set;
1175
- }
1176
- if (part === "..") {
1177
- if (prev && prev !== ".." && prev !== "." && prev !== "**") {
1178
- set.pop();
1179
- return set;
1180
- }
1181
- }
1182
- set.push(part);
1183
- return set;
1184
- }, []);
1185
- return parts.length === 0 ? [""] : parts;
1186
- });
1187
- }
1188
- levelTwoFileOptimize(parts) {
1189
- if (!Array.isArray(parts)) {
1190
- parts = this.slashSplit(parts);
1191
- }
1192
- let didSomething = false;
1193
- do {
1194
- didSomething = false;
1195
- if (!this.preserveMultipleSlashes) {
1196
- for (let i2 = 1; i2 < parts.length - 1; i2++) {
1197
- const p = parts[i2];
1198
- if (i2 === 1 && p === "" && parts[0] === "")
1199
- continue;
1200
- if (p === "." || p === "") {
1201
- didSomething = true;
1202
- parts.splice(i2, 1);
1203
- i2--;
1204
- }
1205
- }
1206
- if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
1207
- didSomething = true;
1208
- parts.pop();
1209
- }
1210
- }
1211
- let dd = 0;
1212
- while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
1213
- const p = parts[dd - 1];
1214
- if (p && p !== "." && p !== ".." && p !== "**") {
1215
- didSomething = true;
1216
- parts.splice(dd - 1, 2);
1217
- dd -= 2;
1218
- }
1219
- }
1220
- } while (didSomething);
1221
- return parts.length === 0 ? [""] : parts;
1222
- }
1223
- // First phase: single-pattern processing
1224
- // <pre> is 1 or more portions
1225
- // <rest> is 1 or more portions
1226
- // <p> is any portion other than ., .., '', or **
1227
- // <e> is . or ''
1228
- //
1229
- // **/.. is *brutal* for filesystem walking performance, because
1230
- // it effectively resets the recursive walk each time it occurs,
1231
- // and ** cannot be reduced out by a .. pattern part like a regexp
1232
- // or most strings (other than .., ., and '') can be.
1233
- //
1234
- // <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
1235
- // <pre>/<e>/<rest> -> <pre>/<rest>
1236
- // <pre>/<p>/../<rest> -> <pre>/<rest>
1237
- // **/**/<rest> -> **/<rest>
1238
- //
1239
- // **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
1240
- // this WOULD be allowed if ** did follow symlinks, or * didn't
1241
- firstPhasePreProcess(globParts) {
1242
- let didSomething = false;
1243
- do {
1244
- didSomething = false;
1245
- for (let parts of globParts) {
1246
- let gs = -1;
1247
- while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
1248
- let gss = gs;
1249
- while (parts[gss + 1] === "**") {
1250
- gss++;
1251
- }
1252
- if (gss > gs) {
1253
- parts.splice(gs + 1, gss - gs);
1254
- }
1255
- let next = parts[gs + 1];
1256
- const p = parts[gs + 2];
1257
- const p2 = parts[gs + 3];
1258
- if (next !== "..")
1259
- continue;
1260
- if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") {
1261
- continue;
1262
- }
1263
- didSomething = true;
1264
- parts.splice(gs, 1);
1265
- const other = parts.slice(0);
1266
- other[gs] = "**";
1267
- globParts.push(other);
1268
- gs--;
1269
- }
1270
- if (!this.preserveMultipleSlashes) {
1271
- for (let i2 = 1; i2 < parts.length - 1; i2++) {
1272
- const p = parts[i2];
1273
- if (i2 === 1 && p === "" && parts[0] === "")
1274
- continue;
1275
- if (p === "." || p === "") {
1276
- didSomething = true;
1277
- parts.splice(i2, 1);
1278
- i2--;
1279
- }
1280
- }
1281
- if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
1282
- didSomething = true;
1283
- parts.pop();
1284
- }
1285
- }
1286
- let dd = 0;
1287
- while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
1288
- const p = parts[dd - 1];
1289
- if (p && p !== "." && p !== ".." && p !== "**") {
1290
- didSomething = true;
1291
- const needDot = dd === 1 && parts[dd + 1] === "**";
1292
- const splin = needDot ? ["."] : [];
1293
- parts.splice(dd - 1, 2, ...splin);
1294
- if (parts.length === 0)
1295
- parts.push("");
1296
- dd -= 2;
1297
- }
1298
- }
1299
- }
1300
- } while (didSomething);
1301
- return globParts;
1302
- }
1303
- // second phase: multi-pattern dedupes
1304
- // {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
1305
- // {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
1306
- // {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
1307
- //
1308
- // {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
1309
- // ^-- not valid because ** doens't follow symlinks
1310
- secondPhasePreProcess(globParts) {
1311
- for (let i2 = 0; i2 < globParts.length - 1; i2++) {
1312
- for (let j = i2 + 1; j < globParts.length; j++) {
1313
- const matched = this.partsMatch(globParts[i2], globParts[j], !this.preserveMultipleSlashes);
1314
- if (!matched)
1315
- continue;
1316
- globParts[i2] = matched;
1317
- globParts[j] = [];
1318
- }
1319
- }
1320
- return globParts.filter((gs) => gs.length);
1321
- }
1322
- partsMatch(a, b, emptyGSMatch = false) {
1323
- let ai = 0;
1324
- let bi = 0;
1325
- let result = [];
1326
- let which = "";
1327
- while (ai < a.length && bi < b.length) {
1328
- if (a[ai] === b[bi]) {
1329
- result.push(which === "b" ? b[bi] : a[ai]);
1330
- ai++;
1331
- bi++;
1332
- } else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
1333
- result.push(a[ai]);
1334
- ai++;
1335
- } else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
1336
- result.push(b[bi]);
1337
- bi++;
1338
- } else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
1339
- if (which === "b")
1340
- return false;
1341
- which = "a";
1342
- result.push(a[ai]);
1343
- ai++;
1344
- bi++;
1345
- } else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
1346
- if (which === "a")
1347
- return false;
1348
- which = "b";
1349
- result.push(b[bi]);
1350
- ai++;
1351
- bi++;
1352
- } else {
1353
- return false;
1354
- }
1355
- }
1356
- return a.length === b.length && result;
1357
- }
1358
- parseNegate() {
1359
- if (this.nonegate)
1360
- return;
1361
- const pattern = this.pattern;
1362
- let negate = false;
1363
- let negateOffset = 0;
1364
- for (let i2 = 0; i2 < pattern.length && pattern.charAt(i2) === "!"; i2++) {
1365
- negate = !negate;
1366
- negateOffset++;
1367
- }
1368
- if (negateOffset)
1369
- this.pattern = pattern.slice(negateOffset);
1370
- this.negate = negate;
1371
- }
1372
- // set partial to true to test if, for example,
1373
- // "/a/b" matches the start of "/*/b/*/d"
1374
- // Partial means, if you run out of file before you run
1375
- // out of pattern, then that's fine, as long as all
1376
- // the parts match.
1377
- matchOne(file, pattern, partial = false) {
1378
- const options = this.options;
1379
- if (this.isWindows) {
1380
- const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
1381
- const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
1382
- const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
1383
- const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
1384
- const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
1385
- const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
1386
- if (typeof fdi === "number" && typeof pdi === "number") {
1387
- const [fd, pd] = [file[fdi], pattern[pdi]];
1388
- if (fd.toLowerCase() === pd.toLowerCase()) {
1389
- pattern[pdi] = fd;
1390
- if (pdi > fdi) {
1391
- pattern = pattern.slice(pdi);
1392
- } else if (fdi > pdi) {
1393
- file = file.slice(fdi);
1394
- }
1395
- }
1396
- }
1397
- }
1398
- const { optimizationLevel = 1 } = this.options;
1399
- if (optimizationLevel >= 2) {
1400
- file = this.levelTwoFileOptimize(file);
1401
- }
1402
- this.debug("matchOne", this, { file, pattern });
1403
- this.debug("matchOne", file.length, pattern.length);
1404
- for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
1405
- this.debug("matchOne loop");
1406
- var p = pattern[pi];
1407
- var f = file[fi];
1408
- this.debug(pattern, p, f);
1409
- if (p === false) {
1410
- return false;
1411
- }
1412
- if (p === GLOBSTAR) {
1413
- this.debug("GLOBSTAR", [pattern, p, f]);
1414
- var fr = fi;
1415
- var pr = pi + 1;
1416
- if (pr === pl) {
1417
- this.debug("** at the end");
1418
- for (; fi < fl; fi++) {
1419
- if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
1420
- return false;
1421
- }
1422
- return true;
1423
- }
1424
- while (fr < fl) {
1425
- var swallowee = file[fr];
1426
- this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
1427
- if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
1428
- this.debug("globstar found match!", fr, fl, swallowee);
1429
- return true;
1430
- } else {
1431
- if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
1432
- this.debug("dot detected!", file, fr, pattern, pr);
1433
- break;
1434
- }
1435
- this.debug("globstar swallow a segment, and continue");
1436
- fr++;
1437
- }
1438
- }
1439
- if (partial) {
1440
- this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
1441
- if (fr === fl) {
1442
- return true;
1443
- }
1444
- }
1445
- return false;
1446
- }
1447
- let hit;
1448
- if (typeof p === "string") {
1449
- hit = f === p;
1450
- this.debug("string match", p, f, hit);
1451
- } else {
1452
- hit = p.test(f);
1453
- this.debug("pattern match", p, f, hit);
1454
- }
1455
- if (!hit)
1456
- return false;
1457
- }
1458
- if (fi === fl && pi === pl) {
1459
- return true;
1460
- } else if (fi === fl) {
1461
- return partial;
1462
- } else if (pi === pl) {
1463
- return fi === fl - 1 && file[fi] === "";
1464
- } else {
1465
- throw new Error("wtf?");
1466
- }
1467
- }
1468
- braceExpand() {
1469
- return braceExpand(this.pattern, this.options);
1470
- }
1471
- parse(pattern) {
1472
- assertValidPattern(pattern);
1473
- const options = this.options;
1474
- if (pattern === "**")
1475
- return GLOBSTAR;
1476
- if (pattern === "")
1477
- return "";
1478
- let m;
1479
- let fastTest = null;
1480
- if (m = pattern.match(starRE)) {
1481
- fastTest = options.dot ? starTestDot : starTest;
1482
- } else if (m = pattern.match(starDotExtRE)) {
1483
- fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
1484
- } else if (m = pattern.match(qmarksRE)) {
1485
- fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
1486
- } else if (m = pattern.match(starDotStarRE)) {
1487
- fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
1488
- } else if (m = pattern.match(dotStarRE)) {
1489
- fastTest = dotStarTest;
1490
- }
1491
- const re = AST.fromGlob(pattern, this.options).toMMPattern();
1492
- if (fastTest && typeof re === "object") {
1493
- Reflect.defineProperty(re, "test", { value: fastTest });
1494
- }
1495
- return re;
1496
- }
1497
- makeRe() {
1498
- if (this.regexp || this.regexp === false)
1499
- return this.regexp;
1500
- const set = this.set;
1501
- if (!set.length) {
1502
- this.regexp = false;
1503
- return this.regexp;
1504
- }
1505
- const options = this.options;
1506
- const twoStar = options.noglobstar ? star2 : options.dot ? twoStarDot : twoStarNoDot;
1507
- const flags = new Set(options.nocase ? ["i"] : []);
1508
- let re = set.map((pattern) => {
1509
- const pp = pattern.map((p) => {
1510
- if (p instanceof RegExp) {
1511
- for (const f of p.flags.split(""))
1512
- flags.add(f);
1513
- }
1514
- return typeof p === "string" ? regExpEscape2(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
1515
- });
1516
- pp.forEach((p, i2) => {
1517
- const next = pp[i2 + 1];
1518
- const prev = pp[i2 - 1];
1519
- if (p !== GLOBSTAR || prev === GLOBSTAR) {
165
+ };
166
+ /**
167
+ * Get Property possible values
168
+ * @param prop - Component Property
169
+ * @returns Property possible values
170
+ */
171
+ const getValues = (prop) => {
172
+ // Only values Array where all objects have a value seems to be usefull
173
+ if (prop.values.some(({ value }) => value === undefined)) {
1520
174
  return;
1521
- }
1522
- if (prev === void 0) {
1523
- if (next !== void 0 && next !== GLOBSTAR) {
1524
- pp[i2 + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
1525
- } else {
1526
- pp[i2] = twoStar;
1527
- }
1528
- } else if (next === void 0) {
1529
- pp[i2 - 1] = prev + "(?:\\/|" + twoStar + ")?";
1530
- } else if (next !== GLOBSTAR) {
1531
- pp[i2 - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
1532
- pp[i2 + 1] = GLOBSTAR;
1533
- }
1534
- });
1535
- return pp.filter((p) => p !== GLOBSTAR).join("/");
1536
- }).join("|");
1537
- const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
1538
- re = "^" + open + re + close + "$";
1539
- if (this.negate)
1540
- re = "^(?!" + re + ").+$";
1541
- try {
1542
- this.regexp = new RegExp(re, [...flags].join(""));
1543
- } catch (ex) {
1544
- this.regexp = false;
1545
- }
1546
- return this.regexp;
1547
- }
1548
- slashSplit(p) {
1549
- if (this.preserveMultipleSlashes) {
1550
- return p.split("/");
1551
- } else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
1552
- return ["", ...p.split(/\/+/)];
1553
- } else {
1554
- return p.split(/\/+/);
1555
- }
1556
- }
1557
- match(f, partial = this.partial) {
1558
- this.debug("match", f, this.pattern);
1559
- if (this.comment) {
1560
- return false;
1561
- }
1562
- if (this.empty) {
1563
- return f === "";
1564
- }
1565
- if (f === "/" && partial) {
1566
- return true;
1567
- }
1568
- const options = this.options;
1569
- if (this.isWindows) {
1570
- f = f.split("\\").join("/");
1571
- }
1572
- const ff = this.slashSplit(f);
1573
- this.debug(this.pattern, "split", ff);
1574
- const set = this.set;
1575
- this.debug(this.pattern, "set", set);
1576
- let filename = ff[ff.length - 1];
1577
- if (!filename) {
1578
- for (let i2 = ff.length - 2; !filename && i2 >= 0; i2--) {
1579
- filename = ff[i2];
1580
- }
1581
- }
1582
- for (let i2 = 0; i2 < set.length; i2++) {
1583
- const pattern = set[i2];
1584
- let file = ff;
1585
- if (options.matchBase && pattern.length === 1) {
1586
- file = [filename];
1587
175
  }
1588
- const hit = this.matchOne(file, pattern, partial);
1589
- if (hit) {
1590
- if (options.flipNegate) {
1591
- return true;
1592
- }
1593
- return !this.negate;
1594
- }
1595
- }
1596
- if (options.flipNegate) {
1597
- return false;
1598
- }
1599
- return this.negate;
1600
- }
1601
- static defaults(def) {
1602
- return minimatch.defaults(def).Minimatch;
1603
- }
1604
- };
1605
- minimatch.AST = AST;
1606
- minimatch.Minimatch = Minimatch;
1607
- minimatch.escape = escape;
1608
- minimatch.unescape = unescape;
1609
-
1610
- // src/utils/regular-expression.ts
1611
- var escapeRegExpSpecialCharacters = (text) => {
1612
- return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1613
- };
1614
-
1615
- // src/utils/result.ts
1616
- var result_exports = {};
1617
- __export(result_exports, {
1618
- err: () => err,
1619
- map: () => map,
1620
- ok: () => ok,
1621
- unwrap: () => unwrap,
1622
- unwrapErr: () => unwrapErr
1623
- });
1624
- var ok = (value) => ({
1625
- isOk: true,
1626
- isErr: false,
1627
- value
1628
- });
1629
- var err = (value) => ({
1630
- isOk: false,
1631
- isErr: true,
1632
- value
1633
- });
1634
- function map(result, fn) {
1635
- if (result.isOk) {
1636
- const val = fn(result.value);
1637
- if (val instanceof Promise) {
1638
- return val.then((newVal) => ok(newVal));
1639
- } else {
1640
- return ok(val);
1641
- }
1642
- }
1643
- if (result.isErr) {
1644
- const value = result.value;
1645
- return err(value);
1646
- }
1647
- throw "should never get here";
1648
- }
1649
- var unwrap = (result) => {
1650
- if (result.isOk) {
1651
- return result.value;
1652
- } else {
1653
- throw result.value;
1654
- }
1655
- };
1656
- var unwrapErr = (result) => {
1657
- if (result.isErr) {
1658
- return result.value;
1659
- } else {
1660
- throw result.value;
1661
- }
1662
- };
1663
- var createSupportsRuleRe = (selector) => {
1664
- const safeSelector2 = escapeRegExpSpecialCharacters(selector);
1665
- return new RegExp(
1666
- // First capture group: match any context before the selector that's not inside @supports selector()
1667
- // Using negative lookahead to avoid matching inside @supports selector(...) condition
1668
- `(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${safeSelector2}))(${safeSelector2}\\b)`,
1669
- "g"
1670
- );
1671
- };
1672
- createSupportsRuleRe("::slotted");
1673
- createSupportsRuleRe(":host");
1674
- createSupportsRuleRe(":host-context");
1675
-
1676
- /**
1677
- * Retrieve Component Storybook URL from file path
1678
- * @param storybookBaseUrl - Storybook Base URL
1679
- * @param filePath - Component file path
1680
- * @returns Component Storybook URL
1681
- */
1682
- const getStorybookUrl = (storybookBaseUrl, filePath) => {
1683
- if (!filePath) {
1684
- return;
1685
- }
1686
- const split = filePath.split('/');
1687
- return `${storybookBaseUrl}${split.slice(2, split.length - 1).join('-')}--docs`;
1688
- };
1689
-
1690
- /**
1691
- * Retrieve Component source URL from file path
1692
- * @param sourcesBaseUrl - Source base URL
1693
- * @param filePath - Component file path
1694
- * @returns Component source URL
1695
- */
1696
- const getSourcesUrl = (sourcesBaseUrl, filePath) => {
1697
- if (!filePath) {
1698
- return;
1699
- }
1700
- return `${sourcesBaseUrl}${filePath}`;
1701
- };
1702
- /**
1703
- * Get Component element description
1704
- * @param component - Component
1705
- * @returns Component element description
1706
- */
1707
- const getElementDescription = (component) => {
1708
- // Init description
1709
- let description = component.overview ? `${component.overview}\n\n` : '';
1710
- // Attributes
1711
- const attributes = component.props.filter(({ attr }) => attr !== undefined);
1712
- if (attributes.length) {
1713
- description += `Attributes:\n`;
1714
- description += attributes.map(({ attr, docs }) => `- \`${attr}\`: ${docs}\n`).join('');
1715
- description += '\n';
1716
- }
1717
- // Properties
1718
- const properties = component.props.filter(({ attr }) => attr === undefined);
1719
- if (properties.length) {
1720
- description += `Properties:\n`;
1721
- description += properties.map(({ name, docs }) => `- \`${name}\`: ${docs}\n`).join('');
1722
- description += '\n';
1723
- }
1724
- // Methods
1725
- if (component.methods.length) {
1726
- description += `Methods:\n`;
1727
- description += component.methods.map(({ name, docs }) => `- \`${name}\`: ${docs}\n`).join('');
1728
- description += '\n';
1729
- }
1730
- // Events
1731
- if (component.events.length) {
1732
- description += `Events:\n`;
1733
- description += component.events.map(({ event, docs }) => `- \`${event}\`: ${docs}\n`).join('');
1734
- description += '\n';
1735
- }
1736
- // Listeners
1737
- if (component.listeners.length) {
1738
- description += `Listeners:\n`;
1739
- description += component.listeners.map(({ event }) => `- \`${event}\`\n`).join('');
1740
- description += '\n';
1741
- }
1742
- // Slots
1743
- if (component.slots.length) {
1744
- description += `Slots:\n`;
1745
- description += component.slots.map(({ name, docs }) => `- \`${name}\`: ${docs}\n`).join('');
1746
- description += '\n';
1747
- }
1748
- // Return
1749
- return description;
1750
- };
1751
- /**
1752
- * Get Props Description
1753
- * @param prop - Component Property
1754
- * @returns Props Description
1755
- */
1756
- const getAttributeDescription = (prop) => {
1757
- return `${prop.docs}\n\nType: \`${prop.type}\``;
1758
- };
1759
- /**
1760
- * Generate Web Types metadata for IntelliJ's IDE
1761
- * @param name - Library name
1762
- * @param version - Library version
1763
- * @param jsonDocs - Stencil JSON doc
1764
- * @param storybookBaseUrl - Storybook Base Url
1765
- * @returns Web Types metadata
1766
- * @example
1767
- * ```ts
1768
- * const webTypesJson = webTypesGenerator('@mgdis/mg-components', '1.0.0', jsonDocs, 'https://storybook.example.com');
1769
- * ```
1770
- */
1771
- const webTypesGenerator = (name, version, jsonDocs, storybookBaseUrl) => ({
1772
- '$schema': 'https://json.schemastore.org/web-types',
1773
- name,
1774
- version,
1775
- 'description-markup': 'markdown',
1776
- 'contributions': {
1777
- html: {
1778
- elements: jsonDocs.components.map(component => {
1779
- const docUrl = getStorybookUrl(storybookBaseUrl, component.filePath);
1780
- return {
1781
- 'name': component.tag,
1782
- 'description': getElementDescription(component),
1783
- 'doc-url': docUrl,
1784
- 'attributes': component.props
1785
- .filter(prop => prop.attr)
1786
- .map(prop => ({
1787
- 'name': prop.attr,
1788
- 'description': getAttributeDescription(prop),
1789
- 'doc-url': docUrl,
1790
- 'value': {
1791
- type: prop.type,
1792
- default: prop.default,
1793
- required: prop.required,
1794
- },
1795
- })),
1796
- 'js': {
1797
- properties: component.props.map(prop => ({
1798
- 'name': prop.name,
1799
- 'description': getAttributeDescription(prop),
1800
- 'doc-url': docUrl,
1801
- 'value': {
1802
- type: prop.type,
1803
- default: prop.default,
1804
- required: prop.required,
1805
- },
1806
- })),
1807
- events: component.events.map(event => ({
1808
- name: event.event,
1809
- description: event.docs,
1810
- })),
1811
- },
1812
- 'css': {
1813
- properties: component.styles.map(style => ({
1814
- name: style.name,
1815
- description: style.docs,
1816
- })),
1817
- },
1818
- };
1819
- }),
1820
- },
1821
- },
1822
- });
1823
- /**
1824
- * Create Storybook Reference
1825
- * @param storybookBaseUrl - Storybook Base Url
1826
- * @param filePath - Component file path
1827
- * @returns Storybook Reference
1828
- */
1829
- const getReferences = (storybookBaseUrl, sourceBaseUrl, filePath) => {
1830
- return [
1831
- { name: 'Storybook', url: getStorybookUrl(storybookBaseUrl, filePath) },
1832
- { name: 'Sources', url: getSourcesUrl(sourceBaseUrl, filePath) },
1833
- ];
1834
- };
1835
- /**
1836
- * Get Property possible values
1837
- * @param prop - Component Property
1838
- * @returns Property possible values
1839
- */
1840
- const getValues = (prop) => {
1841
- // Only values Array where all objects have a value seems to be usefull
1842
- if (prop.values.some(({ value }) => value === undefined)) {
1843
- return;
1844
- }
1845
- return prop.values.map(({ value }) => ({ name: value }));
1846
- };
1847
- /**
1848
- * Generate custom HTML datasets for VS Code
1849
- * @param jsonDocs - Stencil JSON doc
1850
- * @param storybookBaseUrl - Storybook Base Url
1851
- * @returns custom HTML datasets
1852
- * @example
1853
- * ```ts
1854
- * const customDataJson = vsCodeGenerator(jsonDocs, 'https://storybook.example.com', 'https://sources.example.com');
1855
- * ```
1856
- */
1857
- const vsCodeGenerator = (jsonDocs, storybookBaseUrl, sourceBaseUrl) => ({
1858
- version: 1.1,
1859
- tags: jsonDocs.components.map(component => {
1860
- const references = getReferences(storybookBaseUrl, sourceBaseUrl, component.filePath);
1861
- return {
1862
- name: component.tag,
1863
- description: getElementDescription(component),
1864
- attributes: component.props.map(prop => ({
1865
- name: prop.attr ?? prop.name,
1866
- description: getAttributeDescription(prop),
1867
- values: getValues(prop),
1868
- references,
1869
- })),
1870
- references,
1871
- };
1872
- }),
1873
- globalAttributes: [],
1874
- valueSets: [],
1875
- });
1876
- /**
1877
- * Generate custom CSS datasets for VS Code
1878
- * @param jsonDocs - Stencil JSON doc
1879
- * @returns custom CSS datasets
1880
- * @example
1881
- * ```ts
1882
- * const customDataJson = vsCodeCssGenerator(jsonDocs);
1883
- * ```
1884
- */
1885
- const vsCodeCssGenerator = (jsonDocs) => ({
1886
- version: 1.1,
1887
- properties: jsonDocs.components.flatMap(component => component.styles.map(style => ({
1888
- name: style.name,
1889
- description: style.docs,
1890
- }))),
1891
- });
176
+ return prop.values.map(({ value }) => ({ name: value }));
177
+ };
178
+ /**
179
+ * Generate custom HTML datasets for VS Code
180
+ * @param jsonDocs - Stencil JSON doc
181
+ * @param storybookBaseUrl - Storybook Base Url
182
+ * @returns custom HTML datasets
183
+ * @example
184
+ * ```ts
185
+ * const customDataJson = vsCodeGenerator(jsonDocs, 'https://storybook.example.com', 'https://sources.example.com');
186
+ * ```
187
+ */
188
+ const vsCodeGenerator = (jsonDocs, storybookBaseUrl, sourceBaseUrl) => ({
189
+ version: 1.1,
190
+ tags: jsonDocs.components.map(component => {
191
+ const references = getReferences(storybookBaseUrl, sourceBaseUrl, component.filePath);
192
+ return {
193
+ name: component.tag,
194
+ description: getElementDescription(component),
195
+ attributes: component.props.map(prop => ({
196
+ name: prop.attr ?? prop.name,
197
+ description: getAttributeDescription(prop),
198
+ values: getValues(prop),
199
+ references,
200
+ })),
201
+ references,
202
+ };
203
+ }),
204
+ globalAttributes: [],
205
+ valueSets: [],
206
+ });
207
+ /**
208
+ * Generate custom CSS datasets for VS Code
209
+ * @param jsonDocs - Stencil JSON doc
210
+ * @returns custom CSS datasets
211
+ * @example
212
+ * ```ts
213
+ * const customDataJson = vsCodeCssGenerator(jsonDocs);
214
+ * ```
215
+ */
216
+ const vsCodeCssGenerator = (jsonDocs) => ({
217
+ version: 1.1,
218
+ properties: jsonDocs.components.flatMap(component => component.styles.map(style => ({
219
+ name: style.name,
220
+ description: style.docs,
221
+ }))),
222
+ });
1892
223
 
1893
- exports.vsCodeCssGenerator = vsCodeCssGenerator;
1894
- exports.vsCodeGenerator = vsCodeGenerator;
1895
- exports.webTypesGenerator = webTypesGenerator;
224
+ exports.vsCodeCssGenerator = vsCodeCssGenerator;
225
+ exports.vsCodeGenerator = vsCodeGenerator;
226
+ exports.webTypesGenerator = webTypesGenerator;
1896
227
 
1897
228
  }));
1898
229
  //# sourceMappingURL=index.umd.js.map