@qualcomm-ui/mdx-common 1.0.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/index.js ADDED
@@ -0,0 +1,749 @@
1
+ // src/id-service/unique-id-service.ts
2
+ var UniqueIdService = class {
3
+ pathname = "";
4
+ idMap = {};
5
+ reset() {
6
+ this.idMap = {};
7
+ }
8
+ add(idParam) {
9
+ let id = idParam;
10
+ let count = 1;
11
+ while (this.idMap[id]) {
12
+ id = `${idParam}-${count++}`;
13
+ }
14
+ this.idMap[id] = id;
15
+ return id;
16
+ }
17
+ };
18
+
19
+ // src/search/search-utils.ts
20
+ function formatSectionContent(text, indices, characterLimit = 95) {
21
+ const startIndex = indices[0];
22
+ const endIndex = indices[indices.length - 1];
23
+ const matchedIndices = new Set(indices);
24
+ const matched = [];
25
+ const halfLimit = Math.floor(characterLimit / 2);
26
+ let windowStart = Math.max(startIndex - halfLimit, 0);
27
+ let windowEnd = Math.min(endIndex + halfLimit, text.length);
28
+ if (windowEnd - windowStart > characterLimit) {
29
+ if (windowStart === 0) {
30
+ windowEnd = characterLimit;
31
+ } else {
32
+ windowStart = windowEnd - characterLimit;
33
+ }
34
+ }
35
+ for (let i = windowStart; i < windowEnd; i++) {
36
+ const char = text.charAt(i);
37
+ matched.push({ content: char, highlight: matchedIndices.has(i) });
38
+ }
39
+ const content = [];
40
+ let chars = [matched[0].content];
41
+ for (let i = 1; i < matched.length; i++) {
42
+ const prev = matched[i - 1];
43
+ const current = matched[i];
44
+ if (current.highlight === prev?.highlight) {
45
+ chars.push(current.content);
46
+ } else {
47
+ content.push({ content: chars.join(""), highlight: prev?.highlight });
48
+ chars = [current.content];
49
+ }
50
+ }
51
+ if (chars.length) {
52
+ content.push({
53
+ content: chars.join(""),
54
+ highlight: matched[matched.length - 1].highlight
55
+ });
56
+ }
57
+ const totalContentLength = content.reduce((acc, content2) => {
58
+ return acc + content2.content.length;
59
+ }, 0);
60
+ if (text.length !== totalContentLength && windowStart > 0) {
61
+ return [{ content: "...", highlight: false }, ...content];
62
+ }
63
+ return content;
64
+ }
65
+ function formatKeyResult(result, type) {
66
+ return {
67
+ indexes: result.indexes,
68
+ score: result.score,
69
+ target: result.target,
70
+ type
71
+ };
72
+ }
73
+ function getFields(obj) {
74
+ return {
75
+ categories: obj.categories,
76
+ heading: obj.heading,
77
+ headingLevel: obj.headingLevel,
78
+ href: obj.href ? obj.href : obj.pathname,
79
+ id: obj.id,
80
+ isDocProp: obj.isDocProp,
81
+ title: obj.title
82
+ };
83
+ }
84
+ function formatSearchResults(results) {
85
+ return results.map((res) => {
86
+ const heading = formatKeyResult(res[1], "heading");
87
+ const content = formatKeyResult(res[2], "content");
88
+ const obj = res.obj;
89
+ const resultType = content.score > 0.2 ? "content" : heading.score ? "heading" : "title";
90
+ const result = {
91
+ ...getFields(obj),
92
+ index: -1,
93
+ score: res.score,
94
+ type: resultType
95
+ };
96
+ if (resultType === "content" && obj.content) {
97
+ return {
98
+ ...result,
99
+ content: formatSectionContent(obj.content, content.indexes)
100
+ };
101
+ }
102
+ return result;
103
+ });
104
+ }
105
+
106
+ // src/shiki-themes/qui-custom-dark.ts
107
+ var quiCustomDarkTheme = {
108
+ colors: {
109
+ "activityBar.background": "#0F1013",
110
+ "activityBarBadge.background": "#1D978D",
111
+ "button.background": "#0077B5",
112
+ "button.foreground": "#FFF",
113
+ "button.hoverBackground": "#005076",
114
+ "debugExceptionWidget.background": "#141414",
115
+ "debugExceptionWidget.border": "#FFF",
116
+ "debugToolBar.background": "#141414",
117
+ "editor.background": "#0F1013",
118
+ "editor.foreground": "#d2d2d2",
119
+ "editor.inactiveSelectionBackground": "#3a3d41",
120
+ "editor.lineHighlightBackground": "#141414",
121
+ "editor.lineHighlightBorder": "#141414",
122
+ "editor.selectionHighlightBackground": "#add6ff26",
123
+ "editorIndentGuide.activeBackground": "#707070",
124
+ "editorIndentGuide.background": "#404040",
125
+ "editorLink.activeForeground": "#0077B5",
126
+ "editorSuggestWidget.selectedBackground": "#0077B5",
127
+ "extensionButton.prominentBackground": "#0077B5",
128
+ "extensionButton.prominentForeground": "#FFF",
129
+ "extensionButton.prominentHoverBackground": "#005076",
130
+ focusBorder: "#0077B5",
131
+ "gitDecoration.addedResourceForeground": "#ECB22E",
132
+ "gitDecoration.conflictingResourceForeground": "#FFF",
133
+ "gitDecoration.deletedResourceForeground": "#FFF",
134
+ "gitDecoration.ignoredResourceForeground": "#877583",
135
+ "gitDecoration.modifiedResourceForeground": "#ECB22E",
136
+ "gitDecoration.untrackedResourceForeground": "#ECB22E",
137
+ "input.placeholderForeground": "#7A7A7A",
138
+ "list.activeSelectionBackground": "#0F1013",
139
+ "list.dropBackground": "#383b3d",
140
+ "list.focusBackground": "#0077B5",
141
+ "list.hoverBackground": "#0F1013",
142
+ "menu.background": "#252526",
143
+ "menu.foreground": "#E6E6E6",
144
+ "notificationLink.foreground": "#0077B5",
145
+ "settings.numberInputBackground": "#292929",
146
+ "settings.textInputBackground": "#292929",
147
+ "sideBarSectionHeader.background": "#0F1013",
148
+ "sideBarTitle.foreground": "#E6E6E6",
149
+ "statusBar.background": "#0F1013",
150
+ "statusBar.debuggingBackground": "#1D978D",
151
+ "statusBar.noFolderBackground": "#141414",
152
+ "textLink.activeForeground": "#0077B5",
153
+ "textLink.foreground": "#0077B5",
154
+ "titleBar.activeBackground": "#0F1013",
155
+ "titleBar.activeForeground": "#E6E6E6",
156
+ "titleBar.inactiveBackground": "#0F1013",
157
+ "titleBar.inactiveForeground": "#7A7A7A"
158
+ },
159
+ displayName: "Qualcomm Dark",
160
+ name: "qualcomm-dark",
161
+ tokenColors: [
162
+ {
163
+ scope: ["meta.embedded", "source.groovy.embedded"],
164
+ settings: {
165
+ foreground: "#D4D4D4"
166
+ }
167
+ },
168
+ {
169
+ scope: "emphasis",
170
+ settings: {
171
+ fontStyle: "italic"
172
+ }
173
+ },
174
+ {
175
+ scope: "strong",
176
+ settings: {
177
+ fontStyle: "bold"
178
+ }
179
+ },
180
+ {
181
+ scope: "header",
182
+ settings: {
183
+ foreground: "#000080"
184
+ }
185
+ },
186
+ {
187
+ scope: "comment",
188
+ settings: {
189
+ foreground: "#6A9955"
190
+ }
191
+ },
192
+ {
193
+ scope: "constant.language",
194
+ settings: {
195
+ foreground: "#739ed6"
196
+ }
197
+ },
198
+ {
199
+ scope: ["constant.numeric"],
200
+ settings: {
201
+ foreground: "#b5cea8"
202
+ }
203
+ },
204
+ {
205
+ scope: "constant.regexp",
206
+ settings: {
207
+ foreground: "#646695"
208
+ }
209
+ },
210
+ {
211
+ scope: "entity.name.tag",
212
+ settings: {
213
+ foreground: "#e0d4a0"
214
+ }
215
+ },
216
+ {
217
+ scope: "entity.name.tag.css",
218
+ settings: {
219
+ foreground: "#d7ba7d"
220
+ }
221
+ },
222
+ {
223
+ scope: "entity.other.attribute-name",
224
+ settings: {
225
+ foreground: "#a9b9d4"
226
+ }
227
+ },
228
+ {
229
+ scope: [
230
+ "entity.other.attribute-name.class.css",
231
+ "entity.other.attribute-name.class.mixin.css",
232
+ "entity.other.attribute-name.id.css",
233
+ "entity.other.attribute-name.parent-selector.css",
234
+ "entity.other.attribute-name.pseudo-class.css",
235
+ "entity.other.attribute-name.pseudo-element.css",
236
+ "source.css.less entity.other.attribute-name.id",
237
+ "entity.other.attribute-name.attribute.scss",
238
+ "entity.other.attribute-name.scss"
239
+ ],
240
+ settings: {
241
+ foreground: "#d7ba7d"
242
+ }
243
+ },
244
+ {
245
+ scope: "invalid",
246
+ settings: {
247
+ foreground: "#f44747"
248
+ }
249
+ },
250
+ {
251
+ scope: "markup.underline",
252
+ settings: {
253
+ fontStyle: "underline"
254
+ }
255
+ },
256
+ {
257
+ scope: "markup.bold",
258
+ settings: {
259
+ fontStyle: "bold",
260
+ foreground: "#739ed6"
261
+ }
262
+ },
263
+ {
264
+ scope: "markup.heading",
265
+ settings: {
266
+ fontStyle: "bold",
267
+ foreground: "#739ed6"
268
+ }
269
+ },
270
+ {
271
+ scope: "markup.italic",
272
+ settings: {
273
+ fontStyle: "italic"
274
+ }
275
+ },
276
+ {
277
+ scope: "markup.inserted",
278
+ settings: {
279
+ foreground: "#b5cea8"
280
+ }
281
+ },
282
+ {
283
+ scope: "markup.deleted",
284
+ settings: {
285
+ foreground: "#d09d71"
286
+ }
287
+ },
288
+ {
289
+ scope: "markup.changed",
290
+ settings: {
291
+ foreground: "#739ed6"
292
+ }
293
+ },
294
+ {
295
+ scope: "punctuation.definition.quote.begin.markdown",
296
+ settings: {
297
+ foreground: "#6A9955"
298
+ }
299
+ },
300
+ {
301
+ scope: "punctuation.definition.list.begin.markdown",
302
+ settings: {
303
+ foreground: "#6796e6"
304
+ }
305
+ },
306
+ {
307
+ scope: "markup.inline.raw",
308
+ settings: {
309
+ foreground: "#d09d71"
310
+ }
311
+ },
312
+ {
313
+ scope: [
314
+ "punctuation.definition.tag",
315
+ "punctuation.definition.bracket.curly.begin.jsdoc",
316
+ "punctuation.definition.bracket.curly.end.jsdoc",
317
+ "storage.type.function.arrow"
318
+ ],
319
+ settings: {
320
+ foreground: "#babbb8"
321
+ }
322
+ },
323
+ {
324
+ scope: "meta.preprocessor",
325
+ settings: {
326
+ foreground: "#739ed6"
327
+ }
328
+ },
329
+ {
330
+ scope: "meta.preprocessor.string",
331
+ settings: {
332
+ foreground: "#d09d71"
333
+ }
334
+ },
335
+ {
336
+ scope: "meta.preprocessor.numeric",
337
+ settings: {
338
+ foreground: "#b5cea8"
339
+ }
340
+ },
341
+ {
342
+ scope: "meta.structure.dictionary.key.python",
343
+ settings: {
344
+ foreground: "#a9b9d4"
345
+ }
346
+ },
347
+ {
348
+ scope: "meta.diff.header",
349
+ settings: {
350
+ foreground: "#739ed6"
351
+ }
352
+ },
353
+ {
354
+ scope: "storage",
355
+ settings: {
356
+ foreground: "#739ed6"
357
+ }
358
+ },
359
+ {
360
+ scope: "storage.type",
361
+ settings: {
362
+ foreground: "#739ed6"
363
+ }
364
+ },
365
+ {
366
+ scope: "storage.modifier",
367
+ settings: {
368
+ foreground: "#739ed6"
369
+ }
370
+ },
371
+ {
372
+ scope: "string",
373
+ settings: {
374
+ foreground: "#d9b770"
375
+ }
376
+ },
377
+ {
378
+ scope: "string.tag",
379
+ settings: {
380
+ foreground: "#d09d71"
381
+ }
382
+ },
383
+ {
384
+ scope: "string.value",
385
+ settings: {
386
+ foreground: "#d09d71"
387
+ }
388
+ },
389
+ {
390
+ scope: "string.regexp",
391
+ settings: {
392
+ foreground: "#d16969"
393
+ }
394
+ },
395
+ {
396
+ scope: [
397
+ "punctuation.definition.template-expression.begin",
398
+ "punctuation.definition.template-expression.end",
399
+ "punctuation.section.embedded"
400
+ ],
401
+ settings: {
402
+ foreground: "#739ed6"
403
+ }
404
+ },
405
+ {
406
+ scope: ["meta.template.expression"],
407
+ settings: {
408
+ foreground: "#d4d4d4"
409
+ }
410
+ },
411
+ {
412
+ scope: [
413
+ "support.type.vendored.property-name",
414
+ "support.type.property-name",
415
+ "variable.css",
416
+ "variable.scss",
417
+ "variable.other.less",
418
+ "source.coffee.embedded"
419
+ ],
420
+ settings: {
421
+ foreground: "#a9b9d4"
422
+ }
423
+ },
424
+ {
425
+ scope: "keyword",
426
+ settings: {
427
+ foreground: "#739ed6"
428
+ }
429
+ },
430
+ {
431
+ scope: "keyword.control",
432
+ settings: {
433
+ foreground: "#739ed6"
434
+ }
435
+ },
436
+ {
437
+ scope: "keyword.operator",
438
+ settings: {
439
+ foreground: "#d4d4d4"
440
+ }
441
+ },
442
+ {
443
+ scope: [
444
+ "keyword.operator.new",
445
+ "keyword.operator.expression",
446
+ "keyword.operator.cast",
447
+ "keyword.operator.sizeof",
448
+ "keyword.operator.instanceof",
449
+ "keyword.operator.logical.python"
450
+ ],
451
+ settings: {
452
+ foreground: "#739ed6"
453
+ }
454
+ },
455
+ {
456
+ scope: "keyword.other.unit",
457
+ settings: {
458
+ foreground: "#b5cea8"
459
+ }
460
+ },
461
+ {
462
+ scope: [
463
+ "punctuation.section.embedded.begin.php",
464
+ "punctuation.section.embedded.end.php"
465
+ ],
466
+ settings: {
467
+ foreground: "#739ed6"
468
+ }
469
+ },
470
+ {
471
+ scope: "support.function.git-rebase",
472
+ settings: {
473
+ foreground: "#a9b9d4"
474
+ }
475
+ },
476
+ {
477
+ scope: "constant.sha.git-rebase",
478
+ settings: {
479
+ foreground: "#b5cea8"
480
+ }
481
+ },
482
+ {
483
+ scope: [
484
+ "storage.modifier.import.java",
485
+ "variable.language.wildcard.java",
486
+ "storage.modifier.package.java"
487
+ ],
488
+ settings: {
489
+ foreground: "#d4d4d4"
490
+ }
491
+ },
492
+ {
493
+ scope: "variable.language",
494
+ settings: {
495
+ foreground: "#739ed6"
496
+ }
497
+ },
498
+ {
499
+ scope: ["meta.return-type", "support.type", "entity.name.type"],
500
+ settings: {
501
+ foreground: "#739ed6"
502
+ }
503
+ },
504
+ {
505
+ scope: [
506
+ "entity.name.function",
507
+ "support.function",
508
+ "support.constant.handlebars",
509
+ "entity.name.type.class"
510
+ ],
511
+ settings: {
512
+ foreground: "#DCDCAA"
513
+ }
514
+ },
515
+ {
516
+ scope: [
517
+ "storage.type.numeric.go",
518
+ "storage.type.byte.go",
519
+ "storage.type.boolean.go",
520
+ "storage.type.string.go",
521
+ "storage.type.uintptr.go",
522
+ "storage.type.error.go",
523
+ "storage.type.rune.go",
524
+ "storage.type.cs",
525
+ "storage.type.generic.cs",
526
+ "storage.type.modifier.cs",
527
+ "storage.type.variable.cs",
528
+ "storage.type.annotation.java",
529
+ "storage.type.generic.java",
530
+ "storage.type.java",
531
+ "storage.type.object.array.java",
532
+ "storage.type.primitive.array.java",
533
+ "storage.type.primitive.java",
534
+ "storage.type.token.java",
535
+ "storage.type.groovy",
536
+ "storage.type.annotation.groovy",
537
+ "storage.type.parameters.groovy",
538
+ "storage.type.generic.groovy",
539
+ "storage.type.object.array.groovy",
540
+ "storage.type.primitive.array.groovy",
541
+ "storage.type.primitive.groovy"
542
+ ],
543
+ settings: {
544
+ foreground: "#4EC9B0"
545
+ }
546
+ },
547
+ {
548
+ scope: [
549
+ "meta.type.cast.expr",
550
+ "meta.type.new.expr",
551
+ "support.constant.math",
552
+ "support.constant.dom",
553
+ "support.constant.json",
554
+ "entity.other.inherited-class"
555
+ ],
556
+ settings: {
557
+ foreground: "#4EC9B0"
558
+ }
559
+ },
560
+ {
561
+ scope: "keyword.control",
562
+ settings: {
563
+ foreground: "#C586C0"
564
+ }
565
+ },
566
+ {
567
+ scope: [
568
+ "variable.language.this.ts",
569
+ "keyword.control",
570
+ "storage.modifier",
571
+ "storage.type",
572
+ "constant.language",
573
+ "support.type.primitive.ts",
574
+ "support.type.primitive.tsx",
575
+ "keyword.operator.typeof.js",
576
+ "keyword.operator.logical.js",
577
+ "keyword.operator.in.js",
578
+ "keyword.operator.expression",
579
+ "variable.language.super"
580
+ ],
581
+ settings: {
582
+ foreground: "#739ed6"
583
+ }
584
+ },
585
+ {
586
+ scope: [
587
+ "punctuation.definition.block.ts",
588
+ "punctuation.definition.binding-pattern.object.ts",
589
+ "meta.parameter.object-binding-pattern.ts",
590
+ "meta.block.ts",
591
+ "punctuation.section.embedded.begin.tsx",
592
+ "punctuation.section.embedded.end.tsx"
593
+ ],
594
+ settings: {
595
+ foreground: "#d4d4d4"
596
+ }
597
+ },
598
+ {
599
+ scope: ["entity.name.variable"],
600
+ settings: {
601
+ foreground: "#B6A9D4"
602
+ }
603
+ },
604
+ {
605
+ scope: [
606
+ "variable.other.object",
607
+ "variable.other.constant",
608
+ "variable.object.property"
609
+ ],
610
+ settings: {
611
+ foreground: "#c2c2c2"
612
+ }
613
+ },
614
+ {
615
+ scope: [
616
+ "entity.name.type",
617
+ "entity.name.type.interface",
618
+ "meta.var.expr.ts"
619
+ ],
620
+ settings: {
621
+ foreground: "#d4c4a9"
622
+ }
623
+ },
624
+ {
625
+ scope: ["variable"],
626
+ settings: {
627
+ foreground: "#c2c2c2"
628
+ }
629
+ },
630
+ {
631
+ scope: [
632
+ "variable.other.property.ts",
633
+ "variable.other.property.tsx",
634
+ "variable.other.object.property.ts",
635
+ "variable.other.object.property.tsx"
636
+ ],
637
+ settings: {
638
+ foreground: "#B6A9D4"
639
+ }
640
+ },
641
+ {
642
+ scope: ["variable.parameter"],
643
+ settings: {
644
+ foreground: "#a9b9d4"
645
+ }
646
+ },
647
+ {
648
+ scope: ["meta.object-literal.key"],
649
+ settings: {
650
+ foreground: "#a9b9d4"
651
+ }
652
+ },
653
+ {
654
+ scope: [
655
+ "support.constant.property-value",
656
+ "support.constant.font-name",
657
+ "support.constant.media-type",
658
+ "support.constant.media",
659
+ "constant.other.color.rgb-value",
660
+ "constant.other.rgb-value",
661
+ "support.constant.color"
662
+ ],
663
+ settings: {
664
+ foreground: "#ccac67"
665
+ }
666
+ },
667
+ {
668
+ scope: [
669
+ "punctuation.definition.group.regexp",
670
+ "punctuation.definition.group.assertion.regexp",
671
+ "punctuation.definition.character-class.regexp",
672
+ "punctuation.character.set.begin.regexp",
673
+ "punctuation.character.set.end.regexp",
674
+ "keyword.operator.negation.regexp",
675
+ "support.other.parenthesis.regexp"
676
+ ],
677
+ settings: {
678
+ foreground: "#ccac67"
679
+ }
680
+ },
681
+ {
682
+ scope: [
683
+ "constant.character.character-class.regexp",
684
+ "constant.other.character-class.set.regexp",
685
+ "constant.other.character-class.regexp",
686
+ "constant.character.set.regexp"
687
+ ],
688
+ settings: {
689
+ foreground: "#d16969"
690
+ }
691
+ },
692
+ {
693
+ scope: ["keyword.operator.or.regexp", "keyword.control.anchor.regexp"],
694
+ settings: {
695
+ foreground: "#DCDCAA"
696
+ }
697
+ },
698
+ {
699
+ scope: "keyword.operator.quantifier.regexp",
700
+ settings: {
701
+ foreground: "#d7ba7d"
702
+ }
703
+ },
704
+ {
705
+ scope: "constant.character",
706
+ settings: {
707
+ foreground: "#739ed6"
708
+ }
709
+ },
710
+ {
711
+ scope: "constant.character.escape",
712
+ settings: {
713
+ foreground: "#d7ba7d"
714
+ }
715
+ },
716
+ {
717
+ scope: "token.info-token",
718
+ settings: {
719
+ foreground: "#6796e6"
720
+ }
721
+ },
722
+ {
723
+ scope: "token.warn-token",
724
+ settings: {
725
+ foreground: "#cd9731"
726
+ }
727
+ },
728
+ {
729
+ scope: "token.error-token",
730
+ settings: {
731
+ foreground: "#f44747"
732
+ }
733
+ },
734
+ {
735
+ scope: "token.debug-token",
736
+ settings: {
737
+ foreground: "#b267e6"
738
+ }
739
+ }
740
+ ],
741
+ type: "dark"
742
+ };
743
+ export {
744
+ UniqueIdService,
745
+ formatSearchResults,
746
+ formatSectionContent,
747
+ quiCustomDarkTheme
748
+ };
749
+ //# sourceMappingURL=index.js.map