lit-intlayer 8.12.1 → 8.12.3
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/cjs/markdown/compiler.cjs +1 -1
- package/dist/cjs/markdown/index.cjs +1 -1
- package/dist/esm/markdown/compiler.mjs +10 -10
- package/dist/esm/markdown/index.mjs +4 -4
- package/dist/src/markdown/compiler.d.ts +53 -0
- package/dist/{markdown → src/markdown}/index.d.ts +2 -2
- package/package.json +10 -10
- package/dist/markdown/compiler.d.ts +0 -27
- /package/dist/{client → src/client}/IntlayerBinding.d.ts +0 -0
- /package/dist/{client → src/client}/index.d.ts +0 -0
- /package/dist/{client → src/client}/installIntlayer.d.ts +0 -0
- /package/dist/{client → src/client}/useDictionary.d.ts +0 -0
- /package/dist/{client → src/client}/useDictionaryDynamic.d.ts +0 -0
- /package/dist/{client → src/client}/useIntlayer.d.ts +0 -0
- /package/dist/{client → src/client}/useLocale.d.ts +0 -0
- /package/dist/{client → src/client}/useLocaleStorage.d.ts +0 -0
- /package/dist/{client → src/client}/useRewriteURL.d.ts +0 -0
- /package/dist/{editor → src/editor}/useEditor.d.ts +0 -0
- /package/dist/{format → src/format}/index.d.ts +0 -0
- /package/dist/{format → src/format}/useCompact.d.ts +0 -0
- /package/dist/{format → src/format}/useCurrency.d.ts +0 -0
- /package/dist/{format → src/format}/useDate.d.ts +0 -0
- /package/dist/{format → src/format}/useIntl.d.ts +0 -0
- /package/dist/{format → src/format}/useList.d.ts +0 -0
- /package/dist/{format → src/format}/useNumber.d.ts +0 -0
- /package/dist/{format → src/format}/usePercentage.d.ts +0 -0
- /package/dist/{format → src/format}/useRelativeTime.d.ts +0 -0
- /package/dist/{format → src/format}/useUnit.d.ts +0 -0
- /package/dist/{getDictionary.d.ts → src/getDictionary.d.ts} +0 -0
- /package/dist/{getIntlayer.d.ts → src/getIntlayer.d.ts} +0 -0
- /package/dist/{html → src/html}/HTMLRenderer.d.ts +0 -0
- /package/dist/{html → src/html}/index.d.ts +0 -0
- /package/dist/{html → src/html}/installIntlayerHTML.d.ts +0 -0
- /package/dist/{html → src/html}/types.d.ts +0 -0
- /package/dist/{index.d.ts → src/index.d.ts} +0 -0
- /package/dist/{markdown → src/markdown}/MarkdownRenderer.d.ts +0 -0
- /package/dist/{markdown → src/markdown}/installIntlayerMarkdown.d.ts +0 -0
- /package/dist/{markdown → src/markdown}/runtime.d.ts +0 -0
- /package/dist/{plugins.d.ts → src/plugins.d.ts} +0 -0
- /package/dist/{renderIntlayerNode.d.ts → src/renderIntlayerNode.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./runtime.cjs");let t=require("@intlayer/core/markdown");var n=(n=``,r={})=>{let{components:i,namedCodesToUnicode:a,sanitizer:o,slugify:s,...c}=r;return(0,t.parseMarkdown)(n,{runtime:e.default,components:i,namedCodesToUnicode:a,sanitizer:o,slugify:s},c)},r=(n=``,r={})=>{if(typeof n==`string`)return(0,t.compileWithOptions)(n,e.default,r);let{components:i,namedCodesToUnicode:a,sanitizer:o,slugify:s,...c}=r;return(0,t.renderMarkdownAst)(n,{runtime:e.default,components:i,namedCodesToUnicode:a,sanitizer:o,slugify:s},c)}
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./runtime.cjs");let t=require("@intlayer/core/markdown");var n=(n=``,r={})=>{let{components:i,namedCodesToUnicode:a,sanitizer:o,slugify:s,...c}=r;return(0,t.parseMarkdown)(n,{runtime:e.default,components:i,namedCodesToUnicode:a,sanitizer:o,slugify:s},c)},r=(n=``,r={})=>{if(typeof n==`string`)return(0,t.compileWithOptions)(n,e.default,r);let{components:i,namedCodesToUnicode:a,sanitizer:o,slugify:s,...c}=r;return(0,t.renderMarkdownAst)(n,{runtime:e.default,components:i,namedCodesToUnicode:a,sanitizer:o,slugify:s},c)};exports.compileMarkdown=r,exports.parseMarkdown=n;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./compiler.cjs"),t=require("./installIntlayerMarkdown.cjs"),n=require("./MarkdownRenderer.cjs");
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./compiler.cjs"),t=require("./installIntlayerMarkdown.cjs"),n=require("./MarkdownRenderer.cjs");exports.MarkdownRenderer=n.MarkdownRenderer,exports.compileMarkdown=e.compileMarkdown,exports.installIntlayerMarkdown=t.installIntlayerMarkdown,exports.installIntlayerMarkdownDynamic=t.installIntlayerMarkdownDynamic,exports.parseMarkdown=e.parseMarkdown,exports.renderMarkdown=n.renderMarkdown,exports.useMarkdown=t.useMarkdown,exports.useMarkdownRenderer=n.useMarkdownRenderer;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import e from "./runtime.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { compileWithOptions as t, parseMarkdown as n, renderMarkdownAst as r } from "@intlayer/core/markdown";
|
|
3
3
|
//#region src/markdown/compiler.ts
|
|
4
|
-
var
|
|
5
|
-
let { components: i, namedCodesToUnicode: a, sanitizer: o, slugify: s, ...c } =
|
|
6
|
-
return
|
|
4
|
+
var i = (t = "", r = {}) => {
|
|
5
|
+
let { components: i, namedCodesToUnicode: a, sanitizer: o, slugify: s, ...c } = r;
|
|
6
|
+
return n(t, {
|
|
7
7
|
runtime: e,
|
|
8
8
|
components: i,
|
|
9
9
|
namedCodesToUnicode: a,
|
|
10
10
|
sanitizer: o,
|
|
11
11
|
slugify: s
|
|
12
12
|
}, c);
|
|
13
|
-
},
|
|
14
|
-
if (typeof
|
|
15
|
-
let { components: a, namedCodesToUnicode: o, sanitizer: s, slugify: c, ...l } =
|
|
16
|
-
return
|
|
13
|
+
}, a = (n = "", i = {}) => {
|
|
14
|
+
if (typeof n == "string") return t(n, e, i);
|
|
15
|
+
let { components: a, namedCodesToUnicode: o, sanitizer: s, slugify: c, ...l } = i;
|
|
16
|
+
return r(n, {
|
|
17
17
|
runtime: e,
|
|
18
18
|
components: a,
|
|
19
19
|
namedCodesToUnicode: o,
|
|
20
20
|
sanitizer: s,
|
|
21
21
|
slugify: c
|
|
22
22
|
}, l);
|
|
23
|
-
}
|
|
23
|
+
};
|
|
24
24
|
//#endregion
|
|
25
|
-
export {
|
|
25
|
+
export { a as compileMarkdown, i as parseMarkdown };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { installIntlayerMarkdown as
|
|
3
|
-
import { renderMarkdown as
|
|
4
|
-
export {
|
|
1
|
+
import { compileMarkdown as e, parseMarkdown as t } from "./compiler.mjs";
|
|
2
|
+
import { installIntlayerMarkdown as n, installIntlayerMarkdownDynamic as r, useMarkdown as i } from "./installIntlayerMarkdown.mjs";
|
|
3
|
+
import { MarkdownRenderer as a, renderMarkdown as o, useMarkdownRenderer as s } from "./MarkdownRenderer.mjs";
|
|
4
|
+
export { a as MarkdownRenderer, e as compileMarkdown, n as installIntlayerMarkdown, r as installIntlayerMarkdownDynamic, t as parseMarkdown, o as renderMarkdown, i as useMarkdown, s as useMarkdownRenderer };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { CompileOptions, ParsedMarkdown } from '@intlayer/core/markdown';
|
|
2
|
+
/**
|
|
3
|
+
* Options accepted by `compileMarkdown` and `parseMarkdown` to customise
|
|
4
|
+
* rendering behaviour (custom components, sanitizer, slugify, rule hooks, …).
|
|
5
|
+
*/
|
|
6
|
+
export type MarkdownCompilerOptions = CompileOptions;
|
|
7
|
+
/**
|
|
8
|
+
* Intermediate AST produced by `parseMarkdown`.
|
|
9
|
+
* Pass this to `compileMarkdown` to skip re-parsing when the same content is
|
|
10
|
+
* rendered multiple times.
|
|
11
|
+
*/
|
|
12
|
+
export type { ParsedMarkdown };
|
|
13
|
+
/**
|
|
14
|
+
* **Step 1 of 2 — parse only.**
|
|
15
|
+
* Converts a raw markdown string into a `ParsedMarkdown` AST without rendering
|
|
16
|
+
* any HTML. Use this when you need to:
|
|
17
|
+
* - Cache the parsed result and render it several times with different options.
|
|
18
|
+
* - Inspect or transform the AST before rendering.
|
|
19
|
+
* - Defer the render step to a later point.
|
|
20
|
+
*
|
|
21
|
+
* @param markdown - The markdown source string.
|
|
22
|
+
* @param options - Options that affect parsing (sanitizer, slugify, …).
|
|
23
|
+
* @returns A `ParsedMarkdown` AST ready to be passed to `compileMarkdown`.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const ast = parseMarkdown('# Hello **World**');
|
|
28
|
+
* const html = compileMarkdown(ast);
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare const parseMarkdown: (markdown?: string, options?: MarkdownCompilerOptions) => ParsedMarkdown;
|
|
32
|
+
/**
|
|
33
|
+
* **Steps 1 + 2 — parse and render in one shot.**
|
|
34
|
+
* Accepts a raw markdown string or a pre-parsed `ParsedMarkdown` AST and
|
|
35
|
+
* returns an HTML string. Use with Lit's `unsafeHTML` directive or the
|
|
36
|
+
* `<intlayer-markdown-renderer>` custom element.
|
|
37
|
+
*
|
|
38
|
+
* @param input - Markdown string or pre-parsed AST.
|
|
39
|
+
* @param options - Rendering options (custom components, sanitizer, slugify, …).
|
|
40
|
+
* @returns An HTML string representing the rendered markdown.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
45
|
+
*
|
|
46
|
+
* class MyElement extends LitElement {
|
|
47
|
+
* render() {
|
|
48
|
+
* return html`${unsafeHTML(compileMarkdown('# Hello **World**'))}`;
|
|
49
|
+
* }
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare const compileMarkdown: (input?: string | ParsedMarkdown, options?: MarkdownCompilerOptions) => string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { compileMarkdown, type MarkdownCompilerOptions, type ParsedMarkdown, parseMarkdown, } from './compiler';
|
|
2
2
|
export { type IntlayerMarkdownPluginOptions, type IntlayerMarkdownProvider, installIntlayerMarkdown, installIntlayerMarkdownDynamic, type MarkdownProviderOptions, type RenderMarkdownFunction, useMarkdown, } from './installIntlayerMarkdown';
|
|
3
|
-
export { type RenderMarkdownProps, renderMarkdown, useMarkdownRenderer, } from './MarkdownRenderer';
|
|
3
|
+
export { MarkdownRenderer, type RenderMarkdownProps, renderMarkdown, useMarkdownRenderer, } from './MarkdownRenderer';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lit-intlayer",
|
|
3
|
-
"version": "8.12.
|
|
3
|
+
"version": "8.12.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Lit applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -103,27 +103,27 @@
|
|
|
103
103
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
104
104
|
},
|
|
105
105
|
"dependencies": {
|
|
106
|
-
"@intlayer/api": "8.12.
|
|
107
|
-
"@intlayer/config": "8.12.
|
|
108
|
-
"@intlayer/core": "8.12.
|
|
109
|
-
"@intlayer/editor": "8.12.
|
|
110
|
-
"@intlayer/types": "8.12.
|
|
106
|
+
"@intlayer/api": "8.12.3",
|
|
107
|
+
"@intlayer/config": "8.12.3",
|
|
108
|
+
"@intlayer/core": "8.12.3",
|
|
109
|
+
"@intlayer/editor": "8.12.3",
|
|
110
|
+
"@intlayer/types": "8.12.3"
|
|
111
111
|
},
|
|
112
112
|
"devDependencies": {
|
|
113
|
-
"@types/node": "25.9.
|
|
113
|
+
"@types/node": "25.9.2",
|
|
114
114
|
"@utils/ts-config": "1.0.4",
|
|
115
115
|
"@utils/ts-config-types": "1.0.4",
|
|
116
116
|
"@utils/tsdown-config": "1.0.4",
|
|
117
117
|
"fast-glob": "3.3.3",
|
|
118
118
|
"rimraf": "6.1.3",
|
|
119
|
-
"tsdown": "0.
|
|
119
|
+
"tsdown": "0.21.10",
|
|
120
120
|
"typescript": "6.0.3",
|
|
121
121
|
"vite": "8.0.16",
|
|
122
|
-
"vite-plugin-dts": "5.0.
|
|
122
|
+
"vite-plugin-dts": "5.0.2",
|
|
123
123
|
"vitest": "4.1.8"
|
|
124
124
|
},
|
|
125
125
|
"peerDependencies": {
|
|
126
|
-
"intlayer": "8.12.
|
|
126
|
+
"intlayer": "8.12.3",
|
|
127
127
|
"lit": ">=3.0.0"
|
|
128
128
|
},
|
|
129
129
|
"peerDependenciesMeta": {
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { CompileOptions, sanitizer as defaultSanitizer, slugify as defaultSlugify, ParsedMarkdown, RuleType } from '@intlayer/core/markdown';
|
|
2
|
-
export { defaultSanitizer as sanitizer, defaultSlugify as slugify, RuleType };
|
|
3
|
-
export type MarkdownCompilerOptions = CompileOptions;
|
|
4
|
-
/**
|
|
5
|
-
* Compile markdown to an HTML string.
|
|
6
|
-
*
|
|
7
|
-
* The resulting string can be rendered in a Lit template using the
|
|
8
|
-
* `unsafeHTML` directive or the `<intlayer-markdown-renderer>` element.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```ts
|
|
12
|
-
* import { compileMarkdown } from 'lit-intlayer/markdown';
|
|
13
|
-
* import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
14
|
-
*
|
|
15
|
-
* class MyElement extends LitElement {
|
|
16
|
-
* render() {
|
|
17
|
-
* const html = compileMarkdown('# Hello **World**');
|
|
18
|
-
* return html`${unsafeHTML(html)}`;
|
|
19
|
-
* }
|
|
20
|
-
* }
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export type { ParsedMarkdown };
|
|
24
|
-
export declare const parseMarkdown: (markdown?: string, options?: MarkdownCompilerOptions) => ParsedMarkdown;
|
|
25
|
-
export declare const compileMarkdown: (input?: string | ParsedMarkdown, options?: MarkdownCompilerOptions) => string;
|
|
26
|
-
export declare const compiler: (input?: string | ParsedMarkdown, options?: MarkdownCompilerOptions) => string;
|
|
27
|
-
export declare const compile: (input?: string | ParsedMarkdown, options?: MarkdownCompilerOptions) => string;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|