@the_dissidents/libemmm 0.0.10 → 0.0.11
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.cjs +54 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +54 -52
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -678,7 +678,7 @@ declare const DefaultConfiguration: ReadonlyConfiguration;
|
|
|
678
678
|
//#endregion
|
|
679
679
|
//#region src/default/html-renderer.d.ts
|
|
680
680
|
type HTMLRendererOptions = {
|
|
681
|
-
|
|
681
|
+
window: Window;
|
|
682
682
|
headPlugins: HTMLComponentPlugin[];
|
|
683
683
|
headerPlugins: HTMLComponentPlugin[];
|
|
684
684
|
footerPlugins: HTMLComponentPlugin[];
|
|
@@ -702,7 +702,7 @@ declare class HTMLRenderState {
|
|
|
702
702
|
invalidInline(node: InlineEntity, msg: string): minimal_jsx_runtime_jsx_runtime0.JSX.Element;
|
|
703
703
|
render(elems: (BlockEntity | InlineEntity)[], cxt: RenderContext<HTMLRenderType>): DocumentFragment;
|
|
704
704
|
}
|
|
705
|
-
declare
|
|
705
|
+
declare function createHTMLRenderConfiguration(window: Window): RenderConfiguration<HTMLRenderType>;
|
|
706
706
|
//#endregion
|
|
707
707
|
//#region src/debug-print.d.ts
|
|
708
708
|
declare const debugPrint: {
|
|
@@ -724,5 +724,5 @@ declare function debugDumpDocument(doc: Document$1): string;
|
|
|
724
724
|
declare const emmmVersion = "0.0.6";
|
|
725
725
|
declare function setDebugLevel(level: DebugLevel): void;
|
|
726
726
|
//#endregion
|
|
727
|
-
export { ArgumentEntity, ArgumentInterpolatorDefinition, BlockEntity, BlockModifierDefinition, BlockModifierNode, BlockRendererDefiniton, BlockShorthand, BuiltinConfiguration, CloneNodeOptions, Configuration, DebugLevel, DefaultConfiguration, Document$1 as Document, DocumentNode, EscapedNode, GroupNode, HTMLComponentPlugin, HTMLPostprocessPlugin,
|
|
727
|
+
export { ArgumentEntity, ArgumentInterpolatorDefinition, BlockEntity, BlockModifierDefinition, BlockModifierNode, BlockRendererDefiniton, BlockShorthand, BuiltinConfiguration, CloneNodeOptions, Configuration, DebugLevel, DefaultConfiguration, Document$1 as Document, DocumentNode, EscapedNode, GroupNode, HTMLComponentPlugin, HTMLPostprocessPlugin, HTMLRenderPlugin, HTMLRenderState, HTMLRenderType, HTMLRendererOptions, InlineEntity, InlineModifierDefinition, InlineModifierNode, InlineRendererDefiniton, InlineShorthand, Inspector, InterpolationNode, KernelConfiguration, LocationRange, Message, MessageSeverity, ModifierArgument, ModifierArguments, ModifierMetadata, ModifierNode, ModifierSlotType, NodeRenderer, NodeRendererDefinition, NodeType, ParagraphNode, ParseContext, ParseContextStoreDefinitions, ParseContextStoreKey, Parser, PreNode, ReadonlyConfiguration, ReadonlyRenderConfiguration, RenderConfiguration, RenderContext, RendererType, RootNode, Scanner, SimpleScanner, Source, SourceDescriptor, StringSource, SystemModifierDefinition, SystemModifierNode, TextNode, cloneNode, cloneNodes, createHTMLRenderConfiguration, debugPrint, emmmVersion, modifier_helper_d_exports as helper, messages_d_exports as messages, setDebugLevel, stripNode };
|
|
728
728
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -677,7 +677,7 @@ declare const DefaultConfiguration: ReadonlyConfiguration;
|
|
|
677
677
|
//#endregion
|
|
678
678
|
//#region src/default/html-renderer.d.ts
|
|
679
679
|
type HTMLRendererOptions = {
|
|
680
|
-
|
|
680
|
+
window: Window;
|
|
681
681
|
headPlugins: HTMLComponentPlugin[];
|
|
682
682
|
headerPlugins: HTMLComponentPlugin[];
|
|
683
683
|
footerPlugins: HTMLComponentPlugin[];
|
|
@@ -701,7 +701,7 @@ declare class HTMLRenderState {
|
|
|
701
701
|
invalidInline(node: InlineEntity, msg: string): minimal_jsx_runtime_jsx_runtime0.JSX.Element;
|
|
702
702
|
render(elems: (BlockEntity | InlineEntity)[], cxt: RenderContext<HTMLRenderType>): DocumentFragment;
|
|
703
703
|
}
|
|
704
|
-
declare
|
|
704
|
+
declare function createHTMLRenderConfiguration(window: Window): RenderConfiguration<HTMLRenderType>;
|
|
705
705
|
//#endregion
|
|
706
706
|
//#region src/debug-print.d.ts
|
|
707
707
|
declare const debugPrint: {
|
|
@@ -723,5 +723,5 @@ declare function debugDumpDocument(doc: Document$1): string;
|
|
|
723
723
|
declare const emmmVersion = "0.0.6";
|
|
724
724
|
declare function setDebugLevel(level: DebugLevel): void;
|
|
725
725
|
//#endregion
|
|
726
|
-
export { ArgumentEntity, ArgumentInterpolatorDefinition, BlockEntity, BlockModifierDefinition, BlockModifierNode, BlockRendererDefiniton, BlockShorthand, BuiltinConfiguration, CloneNodeOptions, Configuration, DebugLevel, DefaultConfiguration, Document$1 as Document, DocumentNode, EscapedNode, GroupNode, HTMLComponentPlugin, HTMLPostprocessPlugin,
|
|
726
|
+
export { ArgumentEntity, ArgumentInterpolatorDefinition, BlockEntity, BlockModifierDefinition, BlockModifierNode, BlockRendererDefiniton, BlockShorthand, BuiltinConfiguration, CloneNodeOptions, Configuration, DebugLevel, DefaultConfiguration, Document$1 as Document, DocumentNode, EscapedNode, GroupNode, HTMLComponentPlugin, HTMLPostprocessPlugin, HTMLRenderPlugin, HTMLRenderState, HTMLRenderType, HTMLRendererOptions, InlineEntity, InlineModifierDefinition, InlineModifierNode, InlineRendererDefiniton, InlineShorthand, Inspector, InterpolationNode, KernelConfiguration, LocationRange, Message, MessageSeverity, ModifierArgument, ModifierArguments, ModifierMetadata, ModifierNode, ModifierSlotType, NodeRenderer, NodeRendererDefinition, NodeType, ParagraphNode, ParseContext, ParseContextStoreDefinitions, ParseContextStoreKey, Parser, PreNode, ReadonlyConfiguration, ReadonlyRenderConfiguration, RenderConfiguration, RenderContext, RendererType, RootNode, Scanner, SimpleScanner, Source, SourceDescriptor, StringSource, SystemModifierDefinition, SystemModifierNode, TextNode, cloneNode, cloneNodes, createHTMLRenderConfiguration, debugPrint, emmmVersion, modifier_helper_d_exports as helper, messages_d_exports as messages, setDebugLevel, stripNode };
|
|
727
727
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -3173,63 +3173,65 @@ var HTMLRenderState = class {
|
|
|
3173
3173
|
});
|
|
3174
3174
|
}
|
|
3175
3175
|
render(elems, cxt) {
|
|
3176
|
-
const document$1 = cxt.config.options.document;
|
|
3176
|
+
const document$1 = cxt.config.options.window.document;
|
|
3177
3177
|
useDocument(document$1);
|
|
3178
3178
|
let fragment = document$1.createDocumentFragment();
|
|
3179
3179
|
elems.flatMap((x) => cxt.renderEntity(x)).flat().forEach((x) => fragment.appendChild(x));
|
|
3180
3180
|
return fragment;
|
|
3181
3181
|
}
|
|
3182
3182
|
};
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
htmlConfig.
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
}
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
};
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
};
|
|
3230
|
-
|
|
3231
|
-
htmlConfig.
|
|
3232
|
-
|
|
3183
|
+
function createHTMLRenderConfiguration(window) {
|
|
3184
|
+
const htmlConfig = new RenderConfiguration({
|
|
3185
|
+
window,
|
|
3186
|
+
headPlugins: [],
|
|
3187
|
+
headerPlugins: [],
|
|
3188
|
+
footerPlugins: [NotesFooterPlugin],
|
|
3189
|
+
postprocessPlugins: [],
|
|
3190
|
+
transformAsset: () => void 0
|
|
3191
|
+
}, (results, cxt) => {
|
|
3192
|
+
let styles = cxt.state.stylesheet.replaceAll(/var\(--(.*?)\)/g, (m, c) => cxt.state.cssVariables.get(c) ?? m);
|
|
3193
|
+
let doc = document.implementation.createHTMLDocument(cxt.state.title);
|
|
3194
|
+
doc.head.append(/* @__PURE__ */ jsx("meta", { charset: "UTF-8" }), /* @__PURE__ */ jsx("style", { children: styles }), ...cxt.config.options.headPlugins.map((x) => x(cxt)).filter((x) => x !== void 0).flat());
|
|
3195
|
+
doc.body.append(/* @__PURE__ */ jsx("section", {
|
|
3196
|
+
class: "article-container",
|
|
3197
|
+
children: /* @__PURE__ */ jsxs("section", {
|
|
3198
|
+
class: "article-body",
|
|
3199
|
+
children: [
|
|
3200
|
+
cxt.config.options.headerPlugins.map((x) => x(cxt)).filter((x) => x !== void 0),
|
|
3201
|
+
results,
|
|
3202
|
+
cxt.config.options.footerPlugins.map((x) => x(cxt)).filter((x) => x !== void 0)
|
|
3203
|
+
]
|
|
3204
|
+
})
|
|
3205
|
+
}));
|
|
3206
|
+
for (const p of cxt.config.options.postprocessPlugins) p(cxt, doc);
|
|
3207
|
+
return doc;
|
|
3208
|
+
});
|
|
3209
|
+
htmlConfig.paragraphRenderer = (node, cxt) => /* @__PURE__ */ jsx("p", { children: node.content.flatMap((x) => cxt.renderEntity(x)) });
|
|
3210
|
+
htmlConfig.textRenderer = (node, cxt) => {
|
|
3211
|
+
switch (node.type) {
|
|
3212
|
+
case NodeType.Preformatted: return new Text(node.content.text);
|
|
3213
|
+
case NodeType.Text:
|
|
3214
|
+
case NodeType.Escaped:
|
|
3215
|
+
const split = node.content.split("\n");
|
|
3216
|
+
const result = [];
|
|
3217
|
+
for (let i = 0; i < split.length; i++) {
|
|
3218
|
+
result.push(new Text(split[i]));
|
|
3219
|
+
if (i < split.length - 1) result.push(/* @__PURE__ */ jsx("br", {}));
|
|
3220
|
+
}
|
|
3221
|
+
return result;
|
|
3222
|
+
default: return debug.never(node);
|
|
3223
|
+
}
|
|
3224
|
+
};
|
|
3225
|
+
htmlConfig.undefinedBlockRenderer = (node, cxt) => {
|
|
3226
|
+
return cxt.state.invalidBlock(node, `No renderer defined! for ${node.mod.name}`);
|
|
3227
|
+
};
|
|
3228
|
+
htmlConfig.undefinedInlineRenderer = (node, cxt) => {
|
|
3229
|
+
return cxt.state.invalidInline(node, `No renderer defined! for ${node.mod.name}`);
|
|
3230
|
+
};
|
|
3231
|
+
htmlConfig.addBlockRenderer(...HeadingBlockRenderersHTML, ...BulletBlockRenderersHTML, CodeBlockRendererHTML, ...QuoteBlockRenderersHTML, ...MiscBlockRenderersHTML, ...NoteBlockRenderersHTML, ...TableBlockRenderers, GalleryBlockRendererHTML);
|
|
3232
|
+
htmlConfig.addInlineRenderer(CodeInlineRendererHTML, ...InlineStyleRenderersHTML, ...MiscInlineRenderersHTML, ...NoteInlineRenderersHTML, ...TableInlineRenderers);
|
|
3233
|
+
return htmlConfig;
|
|
3234
|
+
}
|
|
3233
3235
|
|
|
3234
3236
|
//#endregion
|
|
3235
3237
|
//#region src/index.ts
|
|
@@ -3239,5 +3241,5 @@ function setDebugLevel(level) {
|
|
|
3239
3241
|
}
|
|
3240
3242
|
|
|
3241
3243
|
//#endregion
|
|
3242
|
-
export { ArgumentInterpolatorDefinition, BlockModifierDefinition, BuiltinConfiguration, Configuration, DebugLevel, DefaultConfiguration, Document,
|
|
3244
|
+
export { ArgumentInterpolatorDefinition, BlockModifierDefinition, BuiltinConfiguration, Configuration, DebugLevel, DefaultConfiguration, Document, HTMLRenderState, InlineModifierDefinition, MessageSeverity, ModifierSlotType, NodeType, ParseContext, Parser, RenderConfiguration, RenderContext, SimpleScanner, StringSource, SystemModifierDefinition, cloneNode, cloneNodes, createHTMLRenderConfiguration, debugPrint, emmmVersion, modifier_helper_exports as helper, messages_exports as messages, setDebugLevel, stripNode };
|
|
3243
3245
|
//# sourceMappingURL=index.js.map
|