@difizen/libro-rendermime 0.0.2-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +0 -0
  3. package/es/components/html-render.d.ts +6 -0
  4. package/es/components/html-render.d.ts.map +1 -0
  5. package/es/components/html-render.js +39 -0
  6. package/es/components/image-render.d.ts +6 -0
  7. package/es/components/image-render.d.ts.map +1 -0
  8. package/es/components/image-render.js +36 -0
  9. package/es/components/index.d.ts +7 -0
  10. package/es/components/index.d.ts.map +1 -0
  11. package/es/components/index.js +6 -0
  12. package/es/components/latex-render.d.ts +6 -0
  13. package/es/components/latex-render.d.ts.map +1 -0
  14. package/es/components/latex-render.js +23 -0
  15. package/es/components/markdown-render.d.ts +6 -0
  16. package/es/components/markdown-render.d.ts.map +1 -0
  17. package/es/components/markdown-render.js +38 -0
  18. package/es/components/svg-render.d.ts +6 -0
  19. package/es/components/svg-render.d.ts.map +1 -0
  20. package/es/components/svg-render.js +33 -0
  21. package/es/components/text-render.d.ts +9 -0
  22. package/es/components/text-render.d.ts.map +1 -0
  23. package/es/components/text-render.js +44 -0
  24. package/es/index.d.ts +7 -0
  25. package/es/index.d.ts.map +1 -0
  26. package/es/index.js +6 -0
  27. package/es/renderers.d.ts +42 -0
  28. package/es/renderers.d.ts.map +1 -0
  29. package/es/renderers.js +327 -0
  30. package/es/rendermime-factory.d.ts +30 -0
  31. package/es/rendermime-factory.d.ts.map +1 -0
  32. package/es/rendermime-factory.js +73 -0
  33. package/es/rendermime-module.d.ts +3 -0
  34. package/es/rendermime-module.d.ts.map +1 -0
  35. package/es/rendermime-module.js +11 -0
  36. package/es/rendermime-protocol.d.ts +405 -0
  37. package/es/rendermime-protocol.d.ts.map +1 -0
  38. package/es/rendermime-protocol.js +60 -0
  39. package/es/rendermime-registry.d.ts +135 -0
  40. package/es/rendermime-registry.d.ts.map +1 -0
  41. package/es/rendermime-registry.js +392 -0
  42. package/es/rendermime-utils.d.ts +87 -0
  43. package/es/rendermime-utils.d.ts.map +1 -0
  44. package/es/rendermime-utils.js +603 -0
  45. package/package.json +61 -0
  46. package/src/components/html-render.tsx +42 -0
  47. package/src/components/image-render.tsx +46 -0
  48. package/src/components/index.ts +6 -0
  49. package/src/components/latex-render.tsx +30 -0
  50. package/src/components/markdown-render.tsx +42 -0
  51. package/src/components/svg-render.tsx +38 -0
  52. package/src/components/text-render.tsx +51 -0
  53. package/src/index.ts +6 -0
  54. package/src/renderers.ts +325 -0
  55. package/src/rendermime-factory.ts +92 -0
  56. package/src/rendermime-module.ts +19 -0
  57. package/src/rendermime-protocol.ts +516 -0
  58. package/src/rendermime-registry.ts +301 -0
  59. package/src/rendermime-utils.ts +665 -0
@@ -0,0 +1,392 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ var _dec, _dec2, _class, _class2, _descriptor;
3
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
6
+ function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
7
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
9
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
10
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
11
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
12
+ function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
13
+ function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
14
+ import { defaultSanitizer } from '@difizen/libro-common';
15
+ import { MarkdownParser } from '@difizen/libro-markdown';
16
+ import { contrib, inject, singleton, Priority } from '@difizen/mana-app';
17
+ import { Emitter } from '@difizen/mana-app';
18
+ import { RenderMimeContribution, IRenderMimeRegistryOptions } from "./rendermime-protocol.js";
19
+ import { sortedTypes } from "./rendermime-utils.js";
20
+
21
+ /**
22
+ * An object which manages mime renderer factories.
23
+ *
24
+ * This object is used to render mime models using registered mime
25
+ * renderers, selecting the preferred mime renderer to render the
26
+ * model into a widget.
27
+ *
28
+ * #### Notes
29
+ * This class is not intended to be subclassed.
30
+ */
31
+ export var RenderMimeRegistry = (_dec = singleton(), _dec2 = contrib(RenderMimeContribution), _dec(_class = (_class2 = /*#__PURE__*/function () {
32
+ /**
33
+ * Construct a new rendermime.
34
+ *
35
+ * @param options - The options for initializing the instance.
36
+ */
37
+ function RenderMimeRegistry(options, markdownParser) {
38
+ var _options$resolver, _options$linkHandler, _options$markdownPars, _options$sanitizer;
39
+ _classCallCheck(this, RenderMimeRegistry);
40
+ this.renderMimeEmitter = new Emitter();
41
+ _initializerDefineProperty(this, "renderMimeProvider", _descriptor, this);
42
+ /**
43
+ * The sanitizer used by the rendermime instance.
44
+ */
45
+ this.sanitizer = defaultSanitizer;
46
+ this._id = 0;
47
+ this._ranks = {};
48
+ this._types = null;
49
+ this._factories = {};
50
+ // Parse the options.
51
+ // this.translator = options.translator ?? nullTranslator;
52
+ this.resolver = (_options$resolver = options.resolver) !== null && _options$resolver !== void 0 ? _options$resolver : null;
53
+ this.linkHandler = (_options$linkHandler = options.linkHandler) !== null && _options$linkHandler !== void 0 ? _options$linkHandler : null;
54
+ this.markdownParser = (_options$markdownPars = options.markdownParser) !== null && _options$markdownPars !== void 0 ? _options$markdownPars : markdownParser;
55
+ this.sanitizer = (_options$sanitizer = options.sanitizer) !== null && _options$sanitizer !== void 0 ? _options$sanitizer : defaultSanitizer;
56
+
57
+ // Add the initial factories.
58
+ if (options.initialFactories) {
59
+ var _iterator = _createForOfIteratorHelper(options.initialFactories),
60
+ _step;
61
+ try {
62
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
63
+ var factory = _step.value;
64
+ this.addFactory(factory);
65
+ }
66
+ } catch (err) {
67
+ _iterator.e(err);
68
+ } finally {
69
+ _iterator.f();
70
+ }
71
+ }
72
+ }
73
+ RenderMimeRegistry = inject(MarkdownParser)(RenderMimeRegistry, undefined, 1) || RenderMimeRegistry;
74
+ RenderMimeRegistry = inject(IRenderMimeRegistryOptions)(RenderMimeRegistry, undefined, 0) || RenderMimeRegistry;
75
+ _createClass(RenderMimeRegistry, [{
76
+ key: "onMimeRender",
77
+ get: function get() {
78
+ return this.renderMimeEmitter.event;
79
+ }
80
+ }, {
81
+ key: "mimeTypes",
82
+ get:
83
+ /**
84
+ * The object used to resolve relative urls for the rendermime instance.
85
+ */
86
+
87
+ /**
88
+ * The object used to handle path opening links.
89
+ */
90
+
91
+ /**
92
+ * The Markdown parser for the rendermime.
93
+ */
94
+
95
+ // /**
96
+ // * The application language translator.
97
+ // */
98
+ // readonly translator: ITranslator;
99
+ /**
100
+ * The ordered list of mimeTypes.
101
+ */
102
+ function get() {
103
+ return this._types || (this._types = sortedTypes(this._ranks));
104
+ }
105
+ }, {
106
+ key: "getSortedRenderMimes",
107
+ value: function getSortedRenderMimes(model) {
108
+ var prioritized = Priority.sortSync(this.renderMimeProvider.getContributions(), function (contribution) {
109
+ return contribution.canHandle(model);
110
+ });
111
+ var sortedRenderMimes = prioritized.map(function (c) {
112
+ return c.value;
113
+ });
114
+ return sortedRenderMimes;
115
+ }
116
+ }, {
117
+ key: "defaultPreferredMimeType",
118
+ value: function defaultPreferredMimeType(model
119
+ // safe: 'ensure' | 'prefer' | 'any' = 'ensure',
120
+ ) {
121
+ var _iterator2 = _createForOfIteratorHelper(this.mimeTypes),
122
+ _step2;
123
+ try {
124
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
125
+ var mt = _step2.value;
126
+ if (mt in model.data) {
127
+ return mt;
128
+ }
129
+ }
130
+
131
+ // Otherwise, no matching mime type exists.
132
+ } catch (err) {
133
+ _iterator2.e(err);
134
+ } finally {
135
+ _iterator2.f();
136
+ }
137
+ return undefined;
138
+ }
139
+
140
+ /**
141
+ * Find the preferred mime type for a mime bundle.
142
+ *
143
+ * @param bundle - The bundle of mime data.
144
+ *
145
+ * @param safe - How to consider safe/unsafe factories. If 'ensure',
146
+ * it will only consider safe factories. If 'any', any factory will be
147
+ * considered. If 'prefer', unsafe factories will be considered, but
148
+ * only after the safe options have been exhausted.
149
+ *
150
+ * @returns The preferred mime type from the available factories,
151
+ * or `undefined` if the mime type cannot be rendered.
152
+ */
153
+ }, {
154
+ key: "preferredMimeType",
155
+ value: function preferredMimeType(model
156
+ // safe: 'ensure' | 'prefer' | 'any' = 'ensure',
157
+ ) {
158
+ // // Try to find a safe factory first, if preferred.
159
+ // if (safe === 'ensure' || safe === 'prefer') {
160
+ // for (const mt of this.mimeTypes) {
161
+ // if (mt in bundle && this._factories[mt].safe) {
162
+ // return mt;
163
+ // }
164
+ // }
165
+ // }
166
+
167
+ // if (safe !== 'ensure') {
168
+ // // Otherwise, search for the best factory among all factories.
169
+ // for (const mt of this.mimeTypes) {
170
+ // if (mt in bundle) {
171
+ // return mt;
172
+ // }
173
+ // }
174
+ // }
175
+ var sortedRenderMimes = this.getSortedRenderMimes(model);
176
+ var _iterator3 = _createForOfIteratorHelper(sortedRenderMimes),
177
+ _step3;
178
+ try {
179
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
180
+ var renderMime = _step3.value;
181
+ var _iterator5 = _createForOfIteratorHelper(renderMime.mimeTypes),
182
+ _step5;
183
+ try {
184
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
185
+ var mt = _step5.value;
186
+ if (mt in model.data) {
187
+ return mt;
188
+ }
189
+ }
190
+ } catch (err) {
191
+ _iterator5.e(err);
192
+ } finally {
193
+ _iterator5.f();
194
+ }
195
+ }
196
+ } catch (err) {
197
+ _iterator3.e(err);
198
+ } finally {
199
+ _iterator3.f();
200
+ }
201
+ var _iterator4 = _createForOfIteratorHelper(this.mimeTypes),
202
+ _step4;
203
+ try {
204
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
205
+ var _mt = _step4.value;
206
+ if (_mt in model.data) {
207
+ return _mt;
208
+ }
209
+ }
210
+
211
+ // Otherwise, no matching mime type exists.
212
+ } catch (err) {
213
+ _iterator4.e(err);
214
+ } finally {
215
+ _iterator4.f();
216
+ }
217
+ return undefined;
218
+ }
219
+
220
+ /**
221
+ * Create a renderer for a mime type.
222
+ *
223
+ * @param mimeType - The mime type of interest.
224
+ *
225
+ * @returns A new renderer for the given mime type.
226
+ *
227
+ * @throws An error if no factory exists for the mime type.
228
+ */
229
+ }, {
230
+ key: "createRenderer",
231
+ value: function createRenderer(mimeType, model // model: BaseOutputModel,
232
+ // host: HTMLElement,
233
+ ) {
234
+ var renderMimes = this.getSortedRenderMimes(model);
235
+ var _iterator6 = _createForOfIteratorHelper(renderMimes),
236
+ _step6;
237
+ try {
238
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
239
+ var renderMime = _step6.value;
240
+ var _iterator7 = _createForOfIteratorHelper(renderMime.mimeTypes),
241
+ _step7;
242
+ try {
243
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
244
+ var mt = _step7.value;
245
+ if (mimeType === mt) {
246
+ var _OutputRender = renderMime.render;
247
+ this.renderMimeEmitter.fire({
248
+ renderType: renderMime.renderType,
249
+ mimeType: mimeType
250
+ });
251
+ return _OutputRender;
252
+ }
253
+ }
254
+ } catch (err) {
255
+ _iterator7.e(err);
256
+ } finally {
257
+ _iterator7.f();
258
+ }
259
+ }
260
+
261
+ // Throw an error if no factory exists for the mime type.
262
+ } catch (err) {
263
+ _iterator6.e(err);
264
+ } finally {
265
+ _iterator6.f();
266
+ }
267
+ if (!(mimeType in this._factories)) {
268
+ throw new Error("No factory for mime type: '".concat(mimeType, "'"));
269
+ }
270
+ var OutputRender = this._factories[mimeType].render;
271
+ this.renderMimeEmitter.fire({
272
+ renderType: this._factories[mimeType].renderType,
273
+ mimeType: mimeType
274
+ });
275
+ // Invoke the best factory for the given mime type.
276
+ return OutputRender;
277
+ }
278
+
279
+ /**
280
+ * Get the renderer factory registered for a mime type.
281
+ *
282
+ * @param mimeType - The mime type of interest.
283
+ *
284
+ * @returns The factory for the mime type, or `undefined`.
285
+ */
286
+ }, {
287
+ key: "getFactory",
288
+ value: function getFactory(mimeType) {
289
+ return this._factories[mimeType];
290
+ }
291
+
292
+ /**
293
+ * Add a renderer factory to the rendermime.
294
+ *
295
+ * @param factory - The renderer factory of interest.
296
+ *
297
+ * @param _rank - The rank of the renderer. A lower rank indicates
298
+ * a higher priority for rendering. If not given, the rank will
299
+ * defer to the `defaultRank` of the factory. If no `defaultRank`
300
+ * is given, it will default to 100.
301
+ *
302
+ * #### Notes
303
+ * The renderer will replace an existing renderer for the given
304
+ * mimeType.
305
+ */
306
+ }, {
307
+ key: "addFactory",
308
+ value: function addFactory(factory, _rank) {
309
+ var rank = _rank;
310
+ if (rank === undefined) {
311
+ rank = factory.defaultRank;
312
+ if (rank === undefined) {
313
+ rank = 100;
314
+ }
315
+ }
316
+ var _iterator8 = _createForOfIteratorHelper(factory.mimeTypes),
317
+ _step8;
318
+ try {
319
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
320
+ var mt = _step8.value;
321
+ this._factories[mt] = factory;
322
+ this._ranks[mt] = {
323
+ rank: rank,
324
+ id: this._id++
325
+ };
326
+ }
327
+ } catch (err) {
328
+ _iterator8.e(err);
329
+ } finally {
330
+ _iterator8.f();
331
+ }
332
+ this._types = null;
333
+ }
334
+
335
+ /**
336
+ * Remove a mime type.
337
+ *
338
+ * @param mimeType - The mime type of interest.
339
+ */
340
+ }, {
341
+ key: "removeMimeType",
342
+ value: function removeMimeType(mimeType) {
343
+ delete this._factories[mimeType];
344
+ delete this._ranks[mimeType];
345
+ this._types = null;
346
+ }
347
+
348
+ /**
349
+ * Get the rank for a given mime type.
350
+ *
351
+ * @param mimeType - The mime type of interest.
352
+ *
353
+ * @returns The rank of the mime type or undefined.
354
+ */
355
+ }, {
356
+ key: "getRank",
357
+ value: function getRank(mimeType) {
358
+ var rank = this._ranks[mimeType];
359
+ return rank && rank.rank;
360
+ }
361
+
362
+ /**
363
+ * Set the rank of a given mime type.
364
+ *
365
+ * @param mimeType - The mime type of interest.
366
+ *
367
+ * @param rank - The new rank to assign.
368
+ *
369
+ * #### Notes
370
+ * This is a no-op if the mime type is not registered.
371
+ */
372
+ }, {
373
+ key: "setRank",
374
+ value: function setRank(mimeType, rank) {
375
+ if (!this._ranks[mimeType]) {
376
+ return;
377
+ }
378
+ var id = this._id++;
379
+ this._ranks[mimeType] = {
380
+ rank: rank,
381
+ id: id
382
+ };
383
+ this._types = null;
384
+ }
385
+ }]);
386
+ return RenderMimeRegistry;
387
+ }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "renderMimeProvider", [_dec2], {
388
+ configurable: true,
389
+ enumerable: true,
390
+ writable: true,
391
+ initializer: null
392
+ })), _class2)) || _class);
@@ -0,0 +1,87 @@
1
+ import type { IOutput, ISanitizer, PartialJSONObject, PartialJSONValue, ReadonlyPartialJSONObject } from '@difizen/libro-common';
2
+ import type { ILinkHandler, IResolver, RankMap } from './rendermime-protocol.js';
3
+ /**
4
+ * Get the data from a notebook output.
5
+ */
6
+ export declare function getData(output: IOutput): PartialJSONObject;
7
+ /**
8
+ * Extract a value from a JSONObject.
9
+ */
10
+ export declare function extract(value: ReadonlyPartialJSONObject, key: string): PartialJSONValue | undefined;
11
+ /**
12
+ * Transform ANSI color escape codes into HTML <span> tags with CSS
13
+ * classes such as "ansi-green-intense-fg".
14
+ * The actual colors used are set in the CSS file.
15
+ * This also removes non-color escape sequences.
16
+ * This is supposed to have the same behavior as nbconvert.filters.ansi2html()
17
+ */
18
+ export declare function ansiSpan(str: string): string;
19
+ /**
20
+ * Replace URLs with links.
21
+ *
22
+ * @param content - The text content of a node.
23
+ *
24
+ * @returns A list of text nodes and anchor elements.
25
+ */
26
+ export declare function autolink(content: string): (HTMLAnchorElement | Text)[];
27
+ export interface IRenderOptions {
28
+ /**
29
+ * The host node for the text content.
30
+ */
31
+ host: HTMLElement;
32
+ /**
33
+ * The html sanitizer for untrusted source.
34
+ */
35
+ sanitizer: ISanitizer;
36
+ /**
37
+ * The source text to render.
38
+ */
39
+ source: string;
40
+ }
41
+ /**
42
+ * Split a shallow node (node without nested nodes inside) at a given text content position.
43
+ *
44
+ * @param node the shallow node to be split
45
+ * @param at the position in textContent at which the split should occur
46
+ */
47
+ export declare function splitShallowNode<T extends Node>(node: T, at: number): {
48
+ pre: T;
49
+ post: T;
50
+ };
51
+ export declare function sortedTypes(map: RankMap): string[];
52
+ /**
53
+ * Eval the script tags contained in a host populated by `innerHTML`.
54
+ *
55
+ * When script tags are created via `innerHTML`, the browser does not
56
+ * evaluate them when they are added to the page. This function works
57
+ * around that by creating new equivalent script nodes manually, and
58
+ * replacing the originals.
59
+ */
60
+ export declare function evalInnerHTMLScriptTags(host: HTMLElement): void;
61
+ /**
62
+ * Handle the default behavior of nodes.
63
+ */
64
+ export declare function handleDefaults(node: HTMLElement, resolver?: IResolver | null): void;
65
+ /**
66
+ * Resolve the relative urls in element `src` and `href` attributes.
67
+ *
68
+ * @param node - The head html element.
69
+ *
70
+ * @param resolver - A url resolver.
71
+ *
72
+ * @param linkHandler - An optional link handler for nodes.
73
+ *
74
+ * @returns a promise fulfilled when the relative urls have been resolved.
75
+ */
76
+ export declare function handleUrls(node: HTMLElement, resolver: IResolver, linkHandler: ILinkHandler | null): Promise<void>;
77
+ /**
78
+ * Create a normalized id for a header element.
79
+ *
80
+ * @param header Header element
81
+ * @returns Normalized id
82
+ */
83
+ export declare function createHeaderId(header: Element): string;
84
+ /**
85
+ * Apply ids to headers.
86
+ */
87
+ //# sourceMappingURL=rendermime-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rendermime-utils.d.ts","sourceRoot":"","sources":["../src/rendermime-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,OAAO,EACP,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,yBAAyB,EAC1B,MAAM,uBAAuB,CAAC;AAa/B,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAEjF;;GAEG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,iBAAiB,CAiB1D;AAED;;GAEG;AACH,wBAAgB,OAAO,CACrB,KAAK,EAAE,yBAAyB,EAChC,GAAG,EAAE,MAAM,GACV,gBAAgB,GAAG,SAAS,CAM9B;AA8ID;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAqI5C;AACD;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC,iBAAiB,GAAG,IAAI,CAAC,EAAE,CAuCtE;AACD,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,IAAI,EAAE,WAAW,CAAC;IAElB;;OAEG;IACH,SAAS,EAAE,UAAU,CAAC;IAEtB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB;AACD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,IAAI,EAC7C,IAAI,EAAE,CAAC,EACP,EAAE,EAAE,MAAM,GACT;IAAE,GAAG,EAAE,CAAC,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,CASrB;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,EAAE,CASlD;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CA2B/D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI,CA8BnF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,SAAS,EACnB,WAAW,EAAE,YAAY,GAAG,IAAI,GAC/B,OAAO,CAAC,IAAI,CAAC,CAwBf;AAoFD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAEtD;AAED;;GAEG"}