@the_dissidents/libemmm 0.0.9 → 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 +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +54 -52
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -153,13 +153,14 @@ type KernelConfiguration = {
|
|
|
153
153
|
};
|
|
154
154
|
interface ReadonlyConfiguration {
|
|
155
155
|
readonly initializers: readonly ((cxt: ParseContext) => void)[];
|
|
156
|
+
readonly modules: ReadonlyMap<string, ModuleDefinition>;
|
|
156
157
|
readonly blockModifiers: ReadonlyNameManager<BlockModifierDefinition<any>>;
|
|
157
158
|
readonly inlineModifiers: ReadonlyNameManager<InlineModifierDefinition<any>>;
|
|
158
159
|
readonly systemModifiers: ReadonlyNameManager<SystemModifierDefinition<any>>;
|
|
159
160
|
readonly argumentInterpolators: ReadonlyNameManager<ArgumentInterpolatorDefinition>;
|
|
160
161
|
readonly blockShorthands: ReadonlyNameManager<BlockShorthand<any>>;
|
|
161
162
|
readonly inlineShorthands: ReadonlyNameManager<InlineShorthand<any>>;
|
|
162
|
-
readonly kernel: KernelConfiguration
|
|
163
|
+
readonly kernel: Readonly<KernelConfiguration>;
|
|
163
164
|
}
|
|
164
165
|
declare class Configuration implements ReadonlyConfiguration {
|
|
165
166
|
initializers: ((cxt: ParseContext) => void)[];
|
|
@@ -677,7 +678,7 @@ declare const DefaultConfiguration: ReadonlyConfiguration;
|
|
|
677
678
|
//#endregion
|
|
678
679
|
//#region src/default/html-renderer.d.ts
|
|
679
680
|
type HTMLRendererOptions = {
|
|
680
|
-
|
|
681
|
+
window: Window;
|
|
681
682
|
headPlugins: HTMLComponentPlugin[];
|
|
682
683
|
headerPlugins: HTMLComponentPlugin[];
|
|
683
684
|
footerPlugins: HTMLComponentPlugin[];
|
|
@@ -701,7 +702,7 @@ declare class HTMLRenderState {
|
|
|
701
702
|
invalidInline(node: InlineEntity, msg: string): minimal_jsx_runtime_jsx_runtime0.JSX.Element;
|
|
702
703
|
render(elems: (BlockEntity | InlineEntity)[], cxt: RenderContext<HTMLRenderType>): DocumentFragment;
|
|
703
704
|
}
|
|
704
|
-
declare
|
|
705
|
+
declare function createHTMLRenderConfiguration(window: Window): RenderConfiguration<HTMLRenderType>;
|
|
705
706
|
//#endregion
|
|
706
707
|
//#region src/debug-print.d.ts
|
|
707
708
|
declare const debugPrint: {
|
|
@@ -723,5 +724,5 @@ declare function debugDumpDocument(doc: Document$1): string;
|
|
|
723
724
|
declare const emmmVersion = "0.0.6";
|
|
724
725
|
declare function setDebugLevel(level: DebugLevel): void;
|
|
725
726
|
//#endregion
|
|
726
|
-
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 };
|
|
727
728
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -152,13 +152,14 @@ type KernelConfiguration = {
|
|
|
152
152
|
};
|
|
153
153
|
interface ReadonlyConfiguration {
|
|
154
154
|
readonly initializers: readonly ((cxt: ParseContext) => void)[];
|
|
155
|
+
readonly modules: ReadonlyMap<string, ModuleDefinition>;
|
|
155
156
|
readonly blockModifiers: ReadonlyNameManager<BlockModifierDefinition<any>>;
|
|
156
157
|
readonly inlineModifiers: ReadonlyNameManager<InlineModifierDefinition<any>>;
|
|
157
158
|
readonly systemModifiers: ReadonlyNameManager<SystemModifierDefinition<any>>;
|
|
158
159
|
readonly argumentInterpolators: ReadonlyNameManager<ArgumentInterpolatorDefinition>;
|
|
159
160
|
readonly blockShorthands: ReadonlyNameManager<BlockShorthand<any>>;
|
|
160
161
|
readonly inlineShorthands: ReadonlyNameManager<InlineShorthand<any>>;
|
|
161
|
-
readonly kernel: KernelConfiguration
|
|
162
|
+
readonly kernel: Readonly<KernelConfiguration>;
|
|
162
163
|
}
|
|
163
164
|
declare class Configuration implements ReadonlyConfiguration {
|
|
164
165
|
initializers: ((cxt: ParseContext) => void)[];
|
|
@@ -676,7 +677,7 @@ declare const DefaultConfiguration: ReadonlyConfiguration;
|
|
|
676
677
|
//#endregion
|
|
677
678
|
//#region src/default/html-renderer.d.ts
|
|
678
679
|
type HTMLRendererOptions = {
|
|
679
|
-
|
|
680
|
+
window: Window;
|
|
680
681
|
headPlugins: HTMLComponentPlugin[];
|
|
681
682
|
headerPlugins: HTMLComponentPlugin[];
|
|
682
683
|
footerPlugins: HTMLComponentPlugin[];
|
|
@@ -700,7 +701,7 @@ declare class HTMLRenderState {
|
|
|
700
701
|
invalidInline(node: InlineEntity, msg: string): minimal_jsx_runtime_jsx_runtime0.JSX.Element;
|
|
701
702
|
render(elems: (BlockEntity | InlineEntity)[], cxt: RenderContext<HTMLRenderType>): DocumentFragment;
|
|
702
703
|
}
|
|
703
|
-
declare
|
|
704
|
+
declare function createHTMLRenderConfiguration(window: Window): RenderConfiguration<HTMLRenderType>;
|
|
704
705
|
//#endregion
|
|
705
706
|
//#region src/debug-print.d.ts
|
|
706
707
|
declare const debugPrint: {
|
|
@@ -722,5 +723,5 @@ declare function debugDumpDocument(doc: Document$1): string;
|
|
|
722
723
|
declare const emmmVersion = "0.0.6";
|
|
723
724
|
declare function setDebugLevel(level: DebugLevel): void;
|
|
724
725
|
//#endregion
|
|
725
|
-
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 };
|
|
726
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
|