@mdsvex/render 1.0.0-next.2 → 1.0.0-next.4

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.
@@ -17,13 +17,13 @@ import { MapSink } from './mappings.js';
17
17
  import type { Mapping, MappingData } from './mappings.js';
18
18
  import type { MapTrace, SourceMapV3 } from './sourcemap.js';
19
19
  import { ComponentScope } from './scope.js';
20
- import type { ReplaceWarning } from './scope.js';
20
+ import type { ReplaceWarning, ShellTable } from './scope.js';
21
21
  export type { Mapping, CodeInformation, MappingData } from './mappings.js';
22
22
  export { MapSink } from './mappings.js';
23
- export { ComponentScope, component_imports } from './scope.js';
23
+ export { ComponentScope, component_imports, shell_key } from './scope.js';
24
24
  /** @internal a pass over the tree reads references as the renderer does */
25
25
  export { is_entity_name } from './entities.js';
26
- export type { ComponentImport, ComponentSource, DefaultImport, ReplaceWarning, } from './scope.js';
26
+ export type { ComponentImport, ComponentSource, DefaultImport, ReplaceWarning, Shell, ShellTable, } from './scope.js';
27
27
  /**
28
28
  * a fence the highlighter rendered, every string is markup svelte reads as
29
29
  * static text, braces in it are entities
@@ -87,10 +87,18 @@ export interface PreMeta {
87
87
  */
88
88
  pre_props(meta: string, start: number): string;
89
89
  }
90
- /** a string is escaped as a url of the source is, '' leaves the attribute out, an expression goes in braces */
90
+ /**
91
+ * a string is escaped as a url of the source is, '' leaves the attribute out,
92
+ * an expression goes in braces, a picture names an imagetools Picture, a
93
+ * markdown image renders it as a picture element and a replacement gets it
94
+ * as its src
95
+ */
91
96
  export type UrlSource = string | {
92
97
  type: 'expression';
93
98
  value: string;
99
+ } | {
100
+ type: 'picture';
101
+ value: string;
94
102
  };
95
103
  /** what replaces the src of an image or the href of a link, url is never empty, null or undefined keeps it */
96
104
  export type UrlLookup = (url: string, image: boolean) => UrlSource | null | undefined;
@@ -228,6 +236,25 @@ export declare class DirectiveError extends Error {
228
236
  readonly column: number;
229
237
  constructor(c: Cursor, message: string);
230
238
  }
239
+ /** one use of a static directive with no shell yet */
240
+ export interface ShellRequest {
241
+ key: string;
242
+ /** the module of the component, emitted verbatim as an import specifier */
243
+ specifier: string;
244
+ /** its export name, the directive name */
245
+ name: string;
246
+ args: Record<string, string>;
247
+ label: boolean;
248
+ children: boolean;
249
+ /** the offset of the directive in the source */
250
+ start: number;
251
+ }
252
+ /**
253
+ * every static directive of the document in directives that shells has no
254
+ * shell for, one request per key in document order, empty when every use
255
+ * has one
256
+ */
257
+ export declare function shell_requests(buf: NodeBuffer, source: string, directives: ComponentScope, shells: ShellTable | undefined): ShellRequest[];
231
258
  /** generated offset of each out chunk, plus the end offset */
232
259
  declare function out_offsets(out: string[], scratch?: Uint32Array): Uint32Array;
233
260
  export declare const escape: typeof escape_html;
@@ -335,6 +362,16 @@ export declare class CursorHTMLRenderer {
335
362
  * references of a document as its labels are first met
336
363
  */
337
364
  footnotes?: FootnoteRender;
365
+ /**
366
+ * true wraps each run of two or more static root blocks in a display
367
+ * contents div, the cached render of update ignores it
368
+ */
369
+ wrap_static?: boolean;
370
+ /**
371
+ * the shells of the static directives of the next renders, a static
372
+ * directive with none renders live, the cached render of update ignores it
373
+ */
374
+ shells?: ShellTable;
338
375
  /** the cached render met a footnote, so each update numbers them again */
339
376
  private noted;
340
377
  constructor(opts?: {