@isopodlabs/vscode_utils 0.2.6 → 0.3.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.
@@ -1,52 +1,18 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.CSP = exports.Hash = exports.codicons = exports.JSX = void 0;
3
+ exports.CSP = exports.Hash = exports.JSX = void 0;
37
4
  exports.jsx = jsx;
38
5
  exports.jsxs = jsxs;
39
6
  exports.jsxFrag = jsxFrag;
40
7
  exports.id_selector = id_selector;
41
- exports.iconAttribute = iconAttribute;
42
- exports.iconAttributes = iconAttributes;
43
8
  exports.Label = Label;
44
9
  exports.Nonce = Nonce;
45
10
  exports.CSPdefault = CSPdefault;
46
11
  exports.ImportMap = ImportMap;
47
12
  const jsx_runtime_1 = require("./jsx-runtime");
48
13
  /** @jsxImportSource . */
49
- const vscode = __importStar(require("vscode"));
14
+ //import * as vscode from 'vscode';
15
+ const vscode_1 = require("vscode");
50
16
  function jsx(type, props) {
51
17
  return typeof type === 'function'
52
18
  ? type(props)
@@ -100,7 +66,6 @@ var JSX;
100
66
  }
101
67
  JSX.render = render;
102
68
  })(JSX || (exports.JSX = JSX = {}));
103
- //globalThis.JSX = {render};
104
69
  //-----------------------------------------------------------------------------
105
70
  // helpers
106
71
  //-----------------------------------------------------------------------------
@@ -110,491 +75,12 @@ function id_selector(id) {
110
75
  id = id.replace(/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g, "\\$&");
111
76
  return id[0] >= '0' && id[0] <= '9' ? `[id="${id}"]` : `#${id}`;
112
77
  }
113
- exports.codicons = {
114
- add: '\uea60',
115
- lightbulb: '\uea61',
116
- repo: '\uea62',
117
- fork: '\uea63',
118
- pullRequest: '\uea64',
119
- keyboard: '\uea65',
120
- tag: '\uea66',
121
- person: '\uea67',
122
- branch: '\uea68',
123
- mirror: '\uea69',
124
- star: '\uea6a',
125
- comment: '\uea6b',
126
- alert: '\uea6c',
127
- search: '\uea6d',
128
- logOut: '\uea6e',
129
- logIn: '\uea6f',
130
- eye: '\uea70',
131
- circleFilled: '\uea71',
132
- primitiveSquare: '\uea72',
133
- pencil: '\uea73',
134
- info: '\uea74',
135
- private: '\uea75',
136
- close: '\uea76',
137
- sync: '\uea77',
138
- clone: '\uea78',
139
- beaker: '\uea79',
140
- desktop: '\uea7a',
141
- file: '\uea7b',
142
- ellipsis: '\uea7c',
143
- reply: '\uea7d',
144
- organization: '\uea7e',
145
- newFile: '\uea7f',
146
- newFolder: '\uea80',
147
- trash: '\uea81',
148
- clock: '\uea82',
149
- folder: '\uea83',
150
- github: '\uea84',
151
- terminal: '\uea85',
152
- symbolEvent: '\uea86',
153
- error: '\uea87',
154
- variable: '\uea88',
155
- array: '\uea8a',
156
- symbolModule: '\uea8b',
157
- symbolFunction: '\uea8c',
158
- symbolBoolean: '\uea8f',
159
- symbolNumber: '\uea90',
160
- symbolStruct: '\uea91',
161
- symbolParameter: '\uea92',
162
- symbolKey: '\uea93',
163
- symbolReference: '\uea94',
164
- symbolValue: '\uea95',
165
- symbolUnit: '\uea96',
166
- activateBreakpoints: '\uea97',
167
- archive: '\uea98',
168
- arrowBoth: '\uea99',
169
- arrowDown: '\uea9a',
170
- arrowLeft: '\uea9b',
171
- arrowRight: '\uea9c',
172
- arrowSmallDown: '\uea9d',
173
- arrowSmallLeft: '\uea9e',
174
- arrowSmallRight: '\uea9f',
175
- arrowSmallUp: '\ueaa0',
176
- arrowUp: '\ueaa1',
177
- bell: '\ueaa2',
178
- bold: '\ueaa3',
179
- book: '\ueaa4',
180
- bookmark: '\ueaa5',
181
- debugBreakpointConditionalUnverified: '\ueaa6',
182
- debugBreakpointConditional: '\ueaa7',
183
- debugBreakpointDataUnverified: '\ueaa8',
184
- debugBreakpointData: '\ueaa9',
185
- debugBreakpointLogUnverified: '\ueaaa',
186
- debugBreakpointLog: '\ueaab',
187
- briefcase: '\ueaac',
188
- broadcast: '\ueaad',
189
- browser: '\ueaae',
190
- bug: '\ueaaf',
191
- calendar: '\ueab0',
192
- caseSensitive: '\ueab1',
193
- check: '\ueab2',
194
- checklist: '\ueab3',
195
- chevronDown: '\ueab4',
196
- chevronLeft: '\ueab5',
197
- chevronRight: '\ueab6',
198
- chevronUp: '\ueab7',
199
- chromeClose: '\ueab8',
200
- chromeMaximize: '\ueab9',
201
- chromeMinimize: '\ueaba',
202
- chromeRestore: '\ueabb',
203
- circle: '\ueabc',
204
- circleSlash: '\ueabd',
205
- circuitBoard: '\ueabe',
206
- clearAll: '\ueabf',
207
- clippy: '\ueac0',
208
- closeAll: '\ueac1',
209
- cloudDownload: '\ueac2',
210
- cloudUpload: '\ueac3',
211
- code: '\ueac4',
212
- collapseAll: '\ueac5',
213
- colorMode: '\ueac6',
214
- commentDiscussion: '\ueac7',
215
- creditCard: '\ueac9',
216
- dash: '\ueacc',
217
- dashboard: '\ueacd',
218
- database: '\ueace',
219
- debugContinue: '\ueacf',
220
- debugDisconnect: '\uead0',
221
- debugPause: '\uead1',
222
- debugRestart: '\uead2',
223
- debugStart: '\uead3',
224
- debugStepInto: '\uead4',
225
- debugStepOut: '\uead5',
226
- debugStepOver: '\uead6',
227
- debugStop: '\uead7',
228
- debug: '\uead8',
229
- deviceCameraVideo: '\uead9',
230
- deviceCamera: '\ueada',
231
- deviceMobile: '\ueadb',
232
- diffAdded: '\ueadc',
233
- diffIgnored: '\ueadd',
234
- diffModified: '\ueade',
235
- diffRemoved: '\ueadf',
236
- diffRenamed: '\ueae0',
237
- diff: '\ueae1',
238
- discard: '\ueae2',
239
- editorLayout: '\ueae3',
240
- emptyWindow: '\ueae4',
241
- exclude: '\ueae5',
242
- extensions: '\ueae6',
243
- eyeClosed: '\ueae7',
244
- fileBinary: '\ueae8',
245
- fileCode: '\ueae9',
246
- fileMedia: '\ueaea',
247
- filePdf: '\ueaeb',
248
- fileSubmodule: '\ueaec',
249
- fileSymlinkDirectory: '\ueaed',
250
- fileSymlinkFile: '\ueaee',
251
- fileZip: '\ueaef',
252
- files: '\ueaf0',
253
- filter: '\ueaf1',
254
- flame: '\ueaf2',
255
- foldDown: '\ueaf3',
256
- foldUp: '\ueaf4',
257
- fold: '\ueaf5',
258
- folderActive: '\ueaf6',
259
- folderOpened: '\ueaf7',
260
- gear: '\ueaf8',
261
- gift: '\ueaf9',
262
- gistSecret: '\ueafa',
263
- gist: '\ueafb',
264
- gitCommit: '\ueafc',
265
- compareChanges: '\ueafd',
266
- gitMerge: '\ueafe',
267
- githubAction: '\ueaff',
268
- githubAlt: '\ueb00',
269
- globe: '\ueb01',
270
- grabber: '\ueb02',
271
- graph: '\ueb03',
272
- gripper: '\ueb04',
273
- heart: '\ueb05',
274
- home: '\ueb06',
275
- horizontalRule: '\ueb07',
276
- hubot: '\ueb08',
277
- inbox: '\ueb09',
278
- issueReopened: '\ueb0b',
279
- issues: '\ueb0c',
280
- italic: '\ueb0d',
281
- jersey: '\ueb0e',
282
- bracket: '\ueb0f',
283
- kebabVertical: '\ueb10',
284
- key: '\ueb11',
285
- law: '\ueb12',
286
- lightbulbAutofix: '\ueb13',
287
- linkExternal: '\ueb14',
288
- link: '\ueb15',
289
- listOrdered: '\ueb16',
290
- listUnordered: '\ueb17',
291
- liveShare: '\ueb18',
292
- loading: '\ueb19',
293
- location: '\ueb1a',
294
- mailRead: '\ueb1b',
295
- mail: '\ueb1c',
296
- markdown: '\ueb1d',
297
- megaphone: '\ueb1e',
298
- mention: '\ueb1f',
299
- milestone: '\ueb20',
300
- mortarBoard: '\ueb21',
301
- move: '\ueb22',
302
- multipleWindows: '\ueb23',
303
- mute: '\ueb24',
304
- noNewline: '\ueb25',
305
- note: '\ueb26',
306
- octoface: '\ueb27',
307
- openPreview: '\ueb28',
308
- package: '\ueb29',
309
- paintcan: '\ueb2a',
310
- pin: '\ueb2b',
311
- play: '\ueb2c',
312
- plug: '\ueb2d',
313
- preserveCase: '\ueb2e',
314
- preview: '\ueb2f',
315
- project: '\ueb30',
316
- pulse: '\ueb31',
317
- question: '\ueb32',
318
- quote: '\ueb33',
319
- radioTower: '\ueb34',
320
- reactions: '\ueb35',
321
- references: '\ueb36',
322
- refresh: '\ueb37',
323
- regex: '\ueb38',
324
- remoteExplorer: '\ueb39',
325
- remote: '\ueb3a',
326
- remove: '\ueb3b',
327
- replaceAll: '\ueb3c',
328
- replace: '\ueb3d',
329
- repoClone: '\ueb3e',
330
- repoForcePush: '\ueb3f',
331
- repoPull: '\ueb40',
332
- repoPush: '\ueb41',
333
- report: '\ueb42',
334
- requestChanges: '\ueb43',
335
- rocket: '\ueb44',
336
- rootFolderOpened: '\ueb45',
337
- rootFolder: '\ueb46',
338
- rss: '\ueb47',
339
- ruby: '\ueb48',
340
- saveAll: '\ueb49',
341
- saveAs: '\ueb4a',
342
- save: '\ueb4b',
343
- screenFull: '\ueb4c',
344
- screenNormal: '\ueb4d',
345
- searchStop: '\ueb4e',
346
- server: '\ueb50',
347
- settingsGear: '\ueb51',
348
- settings: '\ueb52',
349
- shield: '\ueb53',
350
- smiley: '\ueb54',
351
- sortPrecedence: '\ueb55',
352
- splitHorizontal: '\ueb56',
353
- splitVertical: '\ueb57',
354
- squirrel: '\ueb58',
355
- starFull: '\ueb59',
356
- starHalf: '\ueb5a',
357
- symbolClass: '\ueb5b',
358
- symbolColor: '\ueb5c',
359
- symbolConstant: '\ueb5d',
360
- symbolEnumMember: '\ueb5e',
361
- symbolField: '\ueb5f',
362
- symbolFile: '\ueb60',
363
- symbolInterface: '\ueb61',
364
- symbolKeyword: '\ueb62',
365
- symbolMisc: '\ueb63',
366
- symbolOperator: '\ueb64',
367
- symbolProperty: '\ueb65',
368
- symbolSnippet: '\ueb66',
369
- tasklist: '\ueb67',
370
- telescope: '\ueb68',
371
- textSize: '\ueb69',
372
- threeBars: '\ueb6a',
373
- thumbsdown: '\ueb6b',
374
- thumbsup: '\ueb6c',
375
- tools: '\ueb6d',
376
- triangleDown: '\ueb6e',
377
- triangleLeft: '\ueb6f',
378
- triangleRight: '\ueb70',
379
- triangleUp: '\ueb71',
380
- twitter: '\ueb72',
381
- unfold: '\ueb73',
382
- unlock: '\ueb74',
383
- unmute: '\ueb75',
384
- unverified: '\ueb76',
385
- verified: '\ueb77',
386
- versions: '\ueb78',
387
- vmActive: '\ueb79',
388
- vmOutline: '\ueb7a',
389
- vmRunning: '\ueb7b',
390
- watch: '\ueb7c',
391
- whitespace: '\ueb7d',
392
- wholeWord: '\ueb7e',
393
- window: '\ueb7f',
394
- wordWrap: '\ueb80',
395
- zoomIn: '\ueb81',
396
- zoomOut: '\ueb82',
397
- listFilter: '\ueb83',
398
- listFlat: '\ueb84',
399
- listSelection: '\ueb85',
400
- listTree: '\ueb86',
401
- debugBreakpointFunctionUnverified: '\ueb87',
402
- debugBreakpointFunction: '\ueb88',
403
- debugStackframeActive: '\ueb89',
404
- circleSmallFilled: '\ueb8a',
405
- debugStackframe: '\ueb8b',
406
- debugBreakpointUnsupported: '\ueb8c',
407
- symbolString: '\ueb8d',
408
- debugReverseContinue: '\ueb8e',
409
- debugStepBack: '\ueb8f',
410
- debugRestartFrame: '\ueb90',
411
- debugAlt: '\ueb91',
412
- callIncoming: '\ueb92',
413
- callOutgoing: '\ueb93',
414
- menu: '\ueb94',
415
- expandAll: '\ueb95',
416
- feedback: '\ueb96',
417
- groupByRefType: '\ueb97',
418
- ungroupByRefType: '\ueb98',
419
- account: '\ueb99',
420
- bellDot: '\ueb9a',
421
- debugConsole: '\ueb9b',
422
- library: '\ueb9c',
423
- output: '\ueb9d',
424
- runAll: '\ueb9e',
425
- syncIgnored: '\ueb9f',
426
- pinned: '\ueba0',
427
- githubInverted: '\ueba1',
428
- serverProcess: '\ueba2',
429
- serverEnvironment: '\ueba3',
430
- pass: '\ueba4',
431
- stopCircle: '\ueba5',
432
- playCircle: '\ueba6',
433
- record: '\ueba7',
434
- debugAltSmall: '\ueba8',
435
- vmConnect: '\ueba9',
436
- cloud: '\uebaa',
437
- merge: '\uebab',
438
- export: '\uebac',
439
- graphLeft: '\uebad',
440
- magnet: '\uebae',
441
- notebook: '\uebaf',
442
- redo: '\uebb0',
443
- checkAll: '\uebb1',
444
- pinnedDirty: '\uebb2',
445
- passFilled: '\uebb3',
446
- circleLargeFilled: '\uebb4',
447
- circleLarge: '\uebb5',
448
- combine: '\uebb6',
449
- table: '\uebb7',
450
- variableGroup: '\uebb8',
451
- typeHierarchy: '\uebb9',
452
- typeHierarchySub: '\uebba',
453
- typeHierarchySuper: '\uebbb',
454
- gitPullRequestCreate: '\uebbc',
455
- runAbove: '\uebbd',
456
- runBelow: '\uebbe',
457
- notebookTemplate: '\uebbf',
458
- debugRerun: '\uebc0',
459
- workspaceTrusted: '\uebc1',
460
- workspaceUntrusted: '\uebc2',
461
- workspaceUnknown: '\uebc3',
462
- terminalCmd: '\uebc4',
463
- terminalDebian: '\uebc5',
464
- terminalLinux: '\uebc6',
465
- terminalPowershell: '\uebc7',
466
- terminalTmux: '\uebc8',
467
- terminalUbuntu: '\uebc9',
468
- terminalBash: '\uebca',
469
- arrowSwap: '\uebcb',
470
- copy: '\uebcc',
471
- personAdd: '\uebcd',
472
- filterFilled: '\uebce',
473
- wand: '\uebcf',
474
- debugLineByLine: '\uebd0',
475
- inspect: '\uebd1',
476
- layers: '\uebd2',
477
- layersDot: '\uebd3',
478
- layersActive: '\uebd4',
479
- compass: '\uebd5',
480
- compassDot: '\uebd6',
481
- compassActive: '\uebd7',
482
- azure: '\uebd8',
483
- issueDraft: '\uebd9',
484
- gitPullRequestClosed: '\uebda',
485
- gitPullRequestDraft: '\uebdb',
486
- debugAll: '\uebdc',
487
- debugCoverage: '\uebdd',
488
- runErrors: '\uebde',
489
- folderLibrary: '\uebdf',
490
- debugContinueSmall: '\uebe0',
491
- beakerStop: '\uebe1',
492
- graphLine: '\uebe2',
493
- graphScatter: '\uebe3',
494
- pieChart: '\uebe4',
495
- bracketDot: '\uebe5',
496
- bracketError: '\uebe6',
497
- lockSmall: '\uebe7',
498
- azureDevops: '\uebe8',
499
- verifiedFilled: '\uebe9',
500
- newline: '\uebea',
501
- layout: '\uebeb',
502
- layoutActivitybarLeft: '\uebec',
503
- layoutActivitybarRight: '\uebed',
504
- layoutPanelLeft: '\uebee',
505
- layoutPanelCenter: '\uebef',
506
- layoutPanelJustify: '\uebf0',
507
- layoutPanelRight: '\uebf1',
508
- layoutPanel: '\uebf2',
509
- layoutSidebarLeft: '\uebf3',
510
- layoutSidebarRight: '\uebf4',
511
- layoutStatusbar: '\uebf5',
512
- layoutMenubar: '\uebf6',
513
- layoutCentered: '\uebf7',
514
- target: '\uebf8',
515
- indent: '\uebf9',
516
- recordSmall: '\uebfa',
517
- errorSmall: '\uebfb',
518
- arrowCircleDown: '\uebfc',
519
- arrowCircleLeft: '\uebfd',
520
- arrowCircleRight: '\uebfe',
521
- arrowCircleUp: '\uebff',
522
- layoutSidebarRightOff: '\uec00',
523
- layoutPanelOff: '\uec01',
524
- layoutSidebarLeftOff: '\uec02',
525
- blank: '\uec03',
526
- heartFilled: '\uec04',
527
- foldHorizontal: '\uec05',
528
- foldHorizontalFilled: '\uec06',
529
- circleSmall: '\uec07',
530
- bellSlash: '\uec08',
531
- bellSlashDot: '\uec09',
532
- commentUnresolved: '\uec0a',
533
- gitPullRequestGoToChanges: '\uec0b',
534
- gitPullRequestNewChanges: '\uec0c',
535
- searchFuzzy: '\uec0d',
536
- commentDraft: '\uec0e',
537
- send: '\uec0f',
538
- sparkle: '\uec10',
539
- insert: '\uec11',
540
- mic: '\uec12',
541
- thumbsdownFilled: '\uec13',
542
- thumbsupFilled: '\uec14',
543
- coffee: '\uec15',
544
- snake: '\uec16',
545
- game: '\uec17',
546
- vr: '\uec18',
547
- chip: '\uec19',
548
- piano: '\uec1a',
549
- music: '\uec1b',
550
- micFilled: '\uec1c',
551
- repoFetch: '\uec1d',
552
- copilot: '\uec1e',
553
- lightbulbSparkle: '\uec1f',
554
- robot: '\uec20',
555
- sparkleFilled: '\uec21',
556
- diffSingle: '\uec22',
557
- diffMultiple: '\uec23',
558
- surroundWith: '\uec24',
559
- share: '\uec25',
560
- gitStash: '\uec26',
561
- gitStashApply: '\uec27',
562
- gitStashPop: '\uec28',
563
- vscode: '\uec29',
564
- vscodeInsiders: '\uec2a',
565
- codeOss: '\uec2b',
566
- runCoverage: '\uec2c',
567
- runAllCoverage: '\uec2d',
568
- coverage: '\uec2e',
569
- githubProject: '\uec2f',
570
- foldVertical: '\uec30',
571
- foldVerticalFilled: '\uec31',
572
- goToSearch: '\uec32',
573
- percentage: '\uec33',
574
- attach: '\uec34',
575
- };
576
- function currentlyLight() {
577
- return vscode.window.activeColorTheme.kind === vscode.ColorThemeKind.Light || vscode.window.activeColorTheme.kind === vscode.ColorThemeKind.HighContrastLight;
578
- }
579
- function iconAttribute(icon) {
580
- return typeof icon === 'string' ? exports.codicons[icon] : icon.toString();
581
- }
582
- function getColor(col) {
583
- const id = col instanceof vscode.ThemeColor ? col.id : col;
584
- return `var(--vscode-${id.replace('.', '-')})`;
585
- }
586
- function iconAttributes(icon) {
587
- if (icon) {
588
- if (typeof icon === 'string' || icon instanceof vscode.Uri)
589
- return { icon: iconAttribute(icon) };
590
- if (icon instanceof vscode.ThemeIcon)
591
- return icon.color ? { icon: exports.codicons[icon.id], color: getColor(icon.color) } : { icon: exports.codicons[icon.id] };
592
- return { icon: iconAttribute(currentlyLight() ? icon.light : icon.dark) };
593
- }
594
- }
595
78
  function Label({ id, display }) {
596
79
  return (0, jsx_runtime_1.jsx)("label", { for: id, children: display });
597
80
  }
81
+ //-----------------------------------------------------------------------------
82
+ // CSP
83
+ //-----------------------------------------------------------------------------
598
84
  class Hash {
599
85
  algorithm;
600
86
  value;
@@ -619,21 +105,37 @@ const CSPkeywords = {
619
105
  inline_speculation_rules: "'inline-speculation-rules'",
620
106
  strict_dynamic: "'strict-dynamic'",
621
107
  };
108
+ ;
109
+ function plus(source) { return { source, plus: true }; }
110
+ ;
622
111
  function CSPdefault(extension) {
623
- const result = [exports.CSP.self, vscode.Uri.parse('https://*.vscode-cdn.net')];
112
+ const result = [exports.CSP.self, vscode_1.Uri.parse('https://*.vscode-cdn.net')];
624
113
  if (extension.scheme === 'https' || extension.scheme === 'http')
625
114
  result.push(extension); // if the extension is being served up from a CDN also include the CDN in the default csp
626
115
  return result;
627
116
  }
628
117
  function CSPFunction({ csp, ...others }) {
629
- const key = (k) => k.indexOf('_') >= 0
630
- ? k.replaceAll('_', '-src-')
631
- : k + "-src";
632
118
  const val = (v) => v instanceof Array ? v.map(v => val(v)).join(' ')
633
- : v instanceof vscode.Uri ? v.toString(true)
119
+ : v instanceof vscode_1.Uri ? v.toString(true)
634
120
  : v instanceof Hash ? v.toValue()
635
121
  : /*typeof v === 'string' ? `'${v}` :*/ v.toString();
636
- return (0, jsx_runtime_1.jsx)("meta", { "http-equiv": "Content-Security-Policy", content: `default-src ${csp}; ${Object.entries(others).map(([k, v]) => `${key(k)} ${val(v)};`).join('')}` });
122
+ const resolve = (v, parent) => {
123
+ if (typeof v === 'object' && ('plus' in v))
124
+ return parent instanceof Array ? [...parent, v.source] : [parent, v.source];
125
+ return v;
126
+ };
127
+ const sources = (k, v, parent) => {
128
+ if (typeof v === 'object' && 'main' in v) {
129
+ parent = resolve(v.main, parent);
130
+ return `${k}-src ${val(parent)};`
131
+ + (v.attr ? `${k}-src-attr ${val(resolve(v.attr, parent))};` : '')
132
+ + (v.elem ? `${k}-src-elem ${val(resolve(v.elem, parent))};` : '');
133
+ }
134
+ else {
135
+ return `${k}-src ${val(resolve(v, parent))};`;
136
+ }
137
+ };
138
+ return (0, jsx_runtime_1.jsx)("meta", { "http-equiv": "Content-Security-Policy", content: `default-src ${val(csp)}; ${Object.entries(others).map(([k, v]) => sources(k, v, csp)).join('')}` });
637
139
  }
638
140
  exports.CSP = Object.assign(CSPFunction, CSPkeywords);
639
141
  function ImportMap(props) {