react-intlayer 8.0.0-canary.2 → 8.0.0-canary.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.
- package/dist/cjs/html/HTMLProvider.cjs.map +1 -1
- package/dist/cjs/html/HTMLRenderer.cjs.map +1 -1
- package/dist/cjs/markdown/MarkdownProvider.cjs +10 -22
- package/dist/cjs/markdown/MarkdownProvider.cjs.map +1 -1
- package/dist/cjs/markdown/MarkdownRenderer.cjs +2 -6
- package/dist/cjs/markdown/MarkdownRenderer.cjs.map +1 -1
- package/dist/cjs/markdown/processor.cjs.map +1 -1
- package/dist/cjs/plugins.cjs +1 -2
- package/dist/cjs/plugins.cjs.map +1 -1
- package/dist/cjs/reactElement/renderReactElement.cjs +23 -12
- package/dist/cjs/reactElement/renderReactElement.cjs.map +1 -1
- package/dist/esm/html/HTMLProvider.mjs.map +1 -1
- package/dist/esm/html/HTMLRenderer.mjs.map +1 -1
- package/dist/esm/markdown/MarkdownProvider.mjs +10 -22
- package/dist/esm/markdown/MarkdownProvider.mjs.map +1 -1
- package/dist/esm/markdown/MarkdownRenderer.mjs +2 -6
- package/dist/esm/markdown/MarkdownRenderer.mjs.map +1 -1
- package/dist/esm/markdown/processor.mjs.map +1 -1
- package/dist/esm/plugins.mjs +1 -2
- package/dist/esm/plugins.mjs.map +1 -1
- package/dist/esm/reactElement/renderReactElement.mjs +23 -12
- package/dist/esm/reactElement/renderReactElement.mjs.map +1 -1
- package/dist/types/client/format/useCompact.d.ts +2 -2
- package/dist/types/client/format/useCurrency.d.ts +2 -2
- package/dist/types/client/format/useList.d.ts +2 -2
- package/dist/types/client/format/useList.d.ts.map +1 -1
- package/dist/types/client/format/useNumber.d.ts +2 -2
- package/dist/types/client/format/useRelativeTime.d.ts +2 -2
- package/dist/types/client/format/useUnit.d.ts +2 -2
- package/dist/types/client/format/useUnit.d.ts.map +1 -1
- package/dist/types/client/useDictionaryDynamic.d.ts +2 -2
- package/dist/types/client/useIntlayer.d.ts +2 -2
- package/dist/types/client/useLocaleBase.d.ts +5 -5
- package/dist/types/client/useLocaleStorage.d.ts +5 -5
- package/dist/types/html/HTMLProvider.d.ts +3 -2
- package/dist/types/html/HTMLProvider.d.ts.map +1 -1
- package/dist/types/html/HTMLRenderer.d.ts +107 -3
- package/dist/types/html/HTMLRenderer.d.ts.map +1 -1
- package/dist/types/html/index.d.ts +1 -2
- package/dist/types/markdown/MarkdownProvider.d.ts +6 -10
- package/dist/types/markdown/MarkdownProvider.d.ts.map +1 -1
- package/dist/types/markdown/MarkdownRenderer.d.ts +7 -7
- package/dist/types/markdown/MarkdownRenderer.d.ts.map +1 -1
- package/dist/types/markdown/index.d.ts +2 -2
- package/dist/types/markdown/processor.d.ts +4 -4
- package/dist/types/markdown/processor.d.ts.map +1 -1
- package/dist/types/plugins.d.ts +30 -15
- package/dist/types/plugins.d.ts.map +1 -1
- package/dist/types/reactElement/renderReactElement.d.ts +1 -2
- package/dist/types/reactElement/renderReactElement.d.ts.map +1 -1
- package/dist/types/server/IntlayerServerProvider.d.ts +2 -2
- package/dist/types/server/useDictionary.d.ts +2 -2
- package/dist/types/server/useDictionaryAsync.d.ts +2 -2
- package/dist/types/server/useIntlayer.d.ts +2 -2
- package/dist/types/utils/HTMLComponentTypes.d.ts +38 -0
- package/dist/types/utils/HTMLComponentTypes.d.ts.map +1 -0
- package/package.json +9 -9
- package/dist/types/html/types.d.ts +0 -26
- package/dist/types/html/types.d.ts.map +0 -1
- /package/dist/cjs/{html/types.cjs → utils/HTMLComponentTypes.cjs} +0 -0
- /package/dist/esm/{html/types.mjs → utils/HTMLComponentTypes.mjs} +0 -0
|
@@ -1,14 +1,118 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HTMLComponents } from "../utils/HTMLComponentTypes.js";
|
|
2
|
+
import * as react0 from "react";
|
|
2
3
|
import { FC, JSX } from "react";
|
|
3
4
|
|
|
4
5
|
//#region src/html/HTMLRenderer.d.ts
|
|
5
|
-
declare const defaultHTMLComponents:
|
|
6
|
+
declare const defaultHTMLComponents: {} & {
|
|
7
|
+
object?: FC<react0.DetailedHTMLProps<react0.ObjectHTMLAttributes<HTMLObjectElement>, HTMLObjectElement>>;
|
|
8
|
+
hr?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLHRElement>, HTMLHRElement>>;
|
|
9
|
+
th?: FC<react0.DetailedHTMLProps<react0.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>>;
|
|
10
|
+
tr?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>>;
|
|
11
|
+
html?: FC<react0.DetailedHTMLProps<react0.HtmlHTMLAttributes<HTMLHtmlElement>, HTMLHtmlElement>>;
|
|
12
|
+
small?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
13
|
+
sub?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
14
|
+
sup?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
15
|
+
slot?: FC<react0.DetailedHTMLProps<react0.SlotHTMLAttributes<HTMLSlotElement>, HTMLSlotElement>>;
|
|
16
|
+
head?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLHeadElement>, HTMLHeadElement>>;
|
|
17
|
+
body?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>>;
|
|
18
|
+
main?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
19
|
+
header?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
20
|
+
footer?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
21
|
+
nav?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
22
|
+
aside?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
23
|
+
article?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
24
|
+
section?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
25
|
+
div?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
26
|
+
span?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>>;
|
|
27
|
+
h1?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>>;
|
|
28
|
+
h2?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>>;
|
|
29
|
+
h3?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>>;
|
|
30
|
+
h4?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>>;
|
|
31
|
+
h5?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>>;
|
|
32
|
+
h6?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>>;
|
|
33
|
+
p?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>>;
|
|
34
|
+
a?: FC<react0.DetailedHTMLProps<react0.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>>;
|
|
35
|
+
strong?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
36
|
+
b?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
37
|
+
em?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
38
|
+
i?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
39
|
+
u?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
40
|
+
s?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
41
|
+
del?: FC<react0.DetailedHTMLProps<react0.DelHTMLAttributes<HTMLModElement>, HTMLModElement>>;
|
|
42
|
+
ins?: FC<react0.DetailedHTMLProps<react0.InsHTMLAttributes<HTMLModElement>, HTMLModElement>>;
|
|
43
|
+
mark?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
44
|
+
code?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
45
|
+
pre?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLPreElement>, HTMLPreElement>>;
|
|
46
|
+
blockquote?: FC<react0.DetailedHTMLProps<react0.BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>>;
|
|
47
|
+
q?: FC<react0.DetailedHTMLProps<react0.QuoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>>;
|
|
48
|
+
cite?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
49
|
+
abbr?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
50
|
+
address?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
51
|
+
time?: FC<react0.DetailedHTMLProps<react0.TimeHTMLAttributes<HTMLTimeElement>, HTMLTimeElement>>;
|
|
52
|
+
kbd?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
53
|
+
samp?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
54
|
+
var?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
55
|
+
ul?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLUListElement>, HTMLUListElement>>;
|
|
56
|
+
ol?: FC<react0.DetailedHTMLProps<react0.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>>;
|
|
57
|
+
li?: FC<react0.DetailedHTMLProps<react0.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>>;
|
|
58
|
+
dl?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLDListElement>, HTMLDListElement>>;
|
|
59
|
+
dt?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
60
|
+
dd?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
61
|
+
table?: FC<react0.DetailedHTMLProps<react0.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>>;
|
|
62
|
+
thead?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
|
|
63
|
+
tbody?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
|
|
64
|
+
tfoot?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
|
|
65
|
+
td?: FC<react0.DetailedHTMLProps<react0.TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>>;
|
|
66
|
+
caption?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
67
|
+
colgroup?: FC<react0.DetailedHTMLProps<react0.ColgroupHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>>;
|
|
68
|
+
col?: FC<react0.DetailedHTMLProps<react0.ColHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>>;
|
|
69
|
+
form?: FC<react0.DetailedHTMLProps<react0.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>>;
|
|
70
|
+
input?: FC<react0.DetailedHTMLProps<react0.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>>;
|
|
71
|
+
textarea?: FC<react0.DetailedHTMLProps<react0.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>>;
|
|
72
|
+
button?: FC<react0.DetailedHTMLProps<react0.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>>;
|
|
73
|
+
select?: FC<react0.DetailedHTMLProps<react0.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>>;
|
|
74
|
+
option?: FC<react0.DetailedHTMLProps<react0.OptionHTMLAttributes<HTMLOptionElement>, HTMLOptionElement>>;
|
|
75
|
+
optgroup?: FC<react0.DetailedHTMLProps<react0.OptgroupHTMLAttributes<HTMLOptGroupElement>, HTMLOptGroupElement>>;
|
|
76
|
+
label?: FC<react0.DetailedHTMLProps<react0.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>>;
|
|
77
|
+
fieldset?: FC<react0.DetailedHTMLProps<react0.FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>>;
|
|
78
|
+
legend?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>>;
|
|
79
|
+
datalist?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLDataListElement>, HTMLDataListElement>>;
|
|
80
|
+
output?: FC<react0.DetailedHTMLProps<react0.OutputHTMLAttributes<HTMLOutputElement>, HTMLOutputElement>>;
|
|
81
|
+
progress?: FC<react0.DetailedHTMLProps<react0.ProgressHTMLAttributes<HTMLProgressElement>, HTMLProgressElement>>;
|
|
82
|
+
meter?: FC<react0.DetailedHTMLProps<react0.MeterHTMLAttributes<HTMLMeterElement>, HTMLMeterElement>>;
|
|
83
|
+
img?: FC<react0.DetailedHTMLProps<react0.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>>;
|
|
84
|
+
video?: FC<react0.DetailedHTMLProps<react0.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>>;
|
|
85
|
+
audio?: FC<react0.DetailedHTMLProps<react0.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>>;
|
|
86
|
+
source?: FC<react0.DetailedHTMLProps<react0.SourceHTMLAttributes<HTMLSourceElement>, HTMLSourceElement>>;
|
|
87
|
+
track?: FC<react0.DetailedHTMLProps<react0.TrackHTMLAttributes<HTMLTrackElement>, HTMLTrackElement>>;
|
|
88
|
+
picture?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
89
|
+
figure?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
90
|
+
figcaption?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
91
|
+
iframe?: FC<react0.DetailedHTMLProps<react0.IframeHTMLAttributes<HTMLIFrameElement>, HTMLIFrameElement>>;
|
|
92
|
+
embed?: FC<react0.DetailedHTMLProps<react0.EmbedHTMLAttributes<HTMLEmbedElement>, HTMLEmbedElement>>;
|
|
93
|
+
canvas?: FC<react0.DetailedHTMLProps<react0.CanvasHTMLAttributes<HTMLCanvasElement>, HTMLCanvasElement>>;
|
|
94
|
+
svg?: FC<react0.SVGProps<SVGSVGElement>>;
|
|
95
|
+
details?: FC<react0.DetailedHTMLProps<react0.DetailsHTMLAttributes<HTMLDetailsElement>, HTMLDetailsElement>>;
|
|
96
|
+
summary?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
97
|
+
dialog?: FC<react0.DetailedHTMLProps<react0.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>>;
|
|
98
|
+
br?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLBRElement>, HTMLBRElement>>;
|
|
99
|
+
wbr?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
100
|
+
ruby?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
101
|
+
rt?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
102
|
+
rp?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
103
|
+
bdi?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
104
|
+
bdo?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
105
|
+
data?: FC<react0.DetailedHTMLProps<react0.DataHTMLAttributes<HTMLDataElement>, HTMLDataElement>>;
|
|
106
|
+
template?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLTemplateElement>, HTMLTemplateElement>>;
|
|
107
|
+
} & {
|
|
108
|
+
[key: string]: FC<react0.HTMLAttributes<HTMLElement>>;
|
|
109
|
+
};
|
|
6
110
|
type RenderHTMLProps = {
|
|
7
111
|
/**
|
|
8
112
|
* Component overrides for HTML tags.
|
|
9
113
|
* Allows you to customize how specific HTML elements are rendered.
|
|
10
114
|
*/
|
|
11
|
-
components?:
|
|
115
|
+
components?: HTMLComponents<'permissive', {}>;
|
|
12
116
|
};
|
|
13
117
|
/**
|
|
14
118
|
* Renders HTML-like content to JSX with the provided components.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HTMLRenderer.d.ts","names":[],"sources":["../../../src/html/HTMLRenderer.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"HTMLRenderer.d.ts","names":[],"sources":["../../../src/html/HTMLRenderer.tsx"],"mappings":";;;;;cAkBa,qBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAED,eAAA;;;;;EAKV,UAAA,GAAa,cAAA;AAAA;;;;;;;cASF,UAAA,GACX,OAAA;EACA;AAAA,IAAgB,eAAA,KACf,GAAA,CAAI,OAAA;;;;;;;cAyBM,eAAA;EAAmB;AAAA,IAAgB,eAAA,MAGtC,OAAA,aAAe,GAAA,CAAA,OAAA;AAAA,KAUb,iBAAA,GAAoB,eAAA;;;;EAI9B,QAAA;AAAA;;;;;;;cASW,YAAA,EAAc,EAAA,CAAG,iBAAA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { HTMLProvider, useHTMLContext } from "./HTMLProvider.js";
|
|
2
|
-
import { ExtractTags, ReactComponentProps, ReactHTMLComponent, ReactHTMLComponentMap } from "./types.js";
|
|
3
2
|
import { HTMLRenderer, HTMLRendererProps, RenderHTMLProps, defaultHTMLComponents, renderHTML, useHTMLRenderer } from "./HTMLRenderer.js";
|
|
4
3
|
import { HTMLRendererPlugin } from "./HTMLRendererPlugin.js";
|
|
5
|
-
export {
|
|
4
|
+
export { HTMLProvider, HTMLRenderer, HTMLRendererPlugin, HTMLRendererProps, RenderHTMLProps, defaultHTMLComponents, renderHTML, useHTMLContext, useHTMLRenderer };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FC, PropsWithChildren, ReactNode } from "react";
|
|
1
|
+
import { HTMLComponents } from "../utils/HTMLComponentTypes.js";
|
|
2
|
+
import { FC, HTMLAttributes, PropsWithChildren, ReactNode } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/markdown/MarkdownProvider.d.ts
|
|
5
5
|
type MarkdownProviderOptions = {
|
|
@@ -8,17 +8,13 @@ type MarkdownProviderOptions = {
|
|
|
8
8
|
preserveFrontmatter?: boolean; /** Whether to use the GitHub Tag Filter for security. */
|
|
9
9
|
tagfilter?: boolean;
|
|
10
10
|
};
|
|
11
|
-
type RenderMarkdownOptions = MarkdownProviderOptions & {
|
|
12
|
-
components?: Overrides;
|
|
13
|
-
wrapper?: FC<any>;
|
|
14
|
-
};
|
|
15
11
|
type MarkdownContextValue = {
|
|
16
|
-
renderMarkdown: (markdown: string, components?:
|
|
12
|
+
renderMarkdown: (markdown: string, options?: MarkdownProviderOptions, components?: HTMLComponents<'permissive', {}>, wrapper?: FC<HTMLAttributes<HTMLElement>>) => ReactNode;
|
|
17
13
|
};
|
|
18
14
|
type MarkdownProviderProps = PropsWithChildren<MarkdownProviderOptions & {
|
|
19
|
-
components?:
|
|
20
|
-
wrapper?:
|
|
21
|
-
renderMarkdown?: (markdown: string,
|
|
15
|
+
components?: HTMLComponents<'permissive', {}>;
|
|
16
|
+
wrapper?: FC<HTMLAttributes<HTMLElement>>;
|
|
17
|
+
renderMarkdown?: (markdown: string, options?: MarkdownProviderOptions, components?: HTMLComponents<'permissive', {}>, wrapper?: FC<HTMLAttributes<HTMLElement>>) => ReactNode;
|
|
22
18
|
}>;
|
|
23
19
|
declare const useMarkdownContext: () => MarkdownContextValue;
|
|
24
20
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownProvider.d.ts","names":[],"sources":["../../../src/markdown/MarkdownProvider.tsx"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"MarkdownProvider.d.ts","names":[],"sources":["../../../src/markdown/MarkdownProvider.tsx"],"mappings":";;;;KAaY,uBAAA;iFAEV,UAAA,YAFiC;EAIjC,WAAA,YAJiC;EAMjC,mBAAA,YAFA;EAIA,SAAA;AAAA;AAAA,KAGG,oBAAA;EACH,cAAA,GACE,QAAA,UACA,OAAA,GAAU,uBAAA,EACV,UAAA,GAAa,cAAA,oBACb,OAAA,GAAU,EAAA,CAAG,cAAA,CAAe,WAAA,OACzB,SAAA;AAAA;AAAA,KAGF,qBAAA,GAAwB,iBAAA,CAC3B,uBAAA;EACE,UAAA,GAAa,cAAA;EACb,OAAA,GAAU,EAAA,CAAG,cAAA,CAAe,WAAA;EAC5B,cAAA,IACE,QAAA,UACA,OAAA,GAAU,uBAAA,EACV,UAAA,GAAa,cAAA,oBACb,OAAA,GAAU,EAAA,CAAG,cAAA,CAAe,WAAA,OACzB,SAAA;AAAA;AAAA,cAQI,kBAAA,QAAkB,oBAAA;;;;;;;;;;;;;;;;;;AApBf;;;;;;;cAmEH,gBAAA,EAAkB,EAAA,CAAG,qBAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { HTMLComponents } from "../utils/HTMLComponentTypes.js";
|
|
1
2
|
import { MarkdownProviderOptions } from "./MarkdownProvider.js";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { FC, JSX, ReactNode } from "react";
|
|
3
|
+
import * as react201 from "react";
|
|
4
|
+
import { FC, HTMLAttributes, JSX, ReactNode } from "react";
|
|
5
5
|
|
|
6
6
|
//#region src/markdown/MarkdownRenderer.d.ts
|
|
7
7
|
/**
|
|
@@ -37,7 +37,7 @@ type RenderMarkdownProps = MarkdownProviderOptions & {
|
|
|
37
37
|
* }}
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
|
-
components?:
|
|
40
|
+
components?: HTMLComponents<'permissive', {}>;
|
|
41
41
|
/**
|
|
42
42
|
* Wrapper element or component to be used when there are multiple children.
|
|
43
43
|
* Only used if not wrapped in a MarkdownProvider.
|
|
@@ -47,7 +47,7 @@ type RenderMarkdownProps = MarkdownProviderOptions & {
|
|
|
47
47
|
* wrapper={({ children }) => <div className="markdown-content">{children}</div>}
|
|
48
48
|
* ```
|
|
49
49
|
*/
|
|
50
|
-
wrapper?: FC
|
|
50
|
+
wrapper?: FC<HTMLAttributes<HTMLElement>>;
|
|
51
51
|
};
|
|
52
52
|
/**
|
|
53
53
|
* Renders markdown content to JSX with the provided components and options.
|
|
@@ -134,7 +134,7 @@ declare const useMarkdownRenderer: ({
|
|
|
134
134
|
forceInline,
|
|
135
135
|
preserveFrontmatter,
|
|
136
136
|
tagfilter
|
|
137
|
-
}?: RenderMarkdownProps) => (content: string) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean |
|
|
137
|
+
}?: RenderMarkdownProps) => (content: string) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react201.ReactPortal | react201.ReactElement<unknown, string | react201.JSXElementConstructor<any>> | Iterable<ReactNode>> | JSX.Element;
|
|
138
138
|
/**
|
|
139
139
|
* Props for the MarkdownRenderer component.
|
|
140
140
|
*
|
|
@@ -183,7 +183,7 @@ type MarkdownRendererProps = RenderMarkdownProps & {
|
|
|
183
183
|
* ```
|
|
184
184
|
*/
|
|
185
185
|
renderMarkdown?: (markdown: string, options?: {
|
|
186
|
-
components?:
|
|
186
|
+
components?: HTMLComponents<'permissive', {}>;
|
|
187
187
|
wrapper?: FC;
|
|
188
188
|
forceBlock?: boolean;
|
|
189
189
|
forceInline?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownRenderer.d.ts","names":[],"sources":["../../../src/markdown/MarkdownRenderer.tsx"],"mappings":";;;;;;;;;AA2BA
|
|
1
|
+
{"version":3,"file":"MarkdownRenderer.d.ts","names":[],"sources":["../../../src/markdown/MarkdownRenderer.tsx"],"mappings":";;;;;;;;;AA2BA;;;;;;;;;;;;;;;;KAAY,mBAAA,GAAsB,uBAAA;EAwBO;;AA4BzC;;;;;;;;;;;EAtCE,UAAA,GAAa,cAAA;EA6Dd;;;;;;;;;EAnDC,OAAA,GAAU,EAAA,CAAG,cAAA,CAAe,WAAA;AAAA;;;;;;;;;AAkG9B;;;;;;;;;;;;;;;;;cAtEa,cAAA,GACX,OAAA;EACA,UAAA;EAAA,OAAA;EAAA,UAAA;EAAA,WAAA;EAAA,mBAAA;EAAA;AAAA,IAOG,mBAAA,KACF,GAAA,CAAI,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+GP;;;;;;;;;;;;;;;;cAnDa,mBAAA;EAAuB,UAAA;EAAA,OAAA;EAAA,UAAA;EAAA,WAAA;EAAA,mBAAA;EAAA;AAAA,IAOjC,mBAAA,MAGO,OAAA,kDAAe,QAAA,CAAA,SAAA,IAAA,OAAA,sCAAA,QAAA,CAAA,WAAA,GAAA,QAAA,CAAA,YAAA,mBAAA,QAAA,CAAA,qBAAA,SAAA,QAAA,CAAA,SAAA,KAAA,GAAA,CAAA,OAAA;;;;;;;;;AAmJzB;;;;;;;KA1GY,qBAAA,GAAwB,mBAAA;;;;;;;;;;;EAWlC,QAAA;;;;;;;;;;;;;;;;;;;;;EAqBA,cAAA,IACE,QAAA,UACA,OAAA;IACE,UAAA,GAAa,cAAA;IACb,OAAA,GAAU,EAAA;IACV,UAAA;IACA,WAAA;IACA,mBAAA;IACA,SAAA;EAAA,MAEC,SAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAgEM,gBAAA,EAAkB,EAAA,CAAG,qBAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MarkdownProvider, MarkdownProviderOptions, useMarkdownContext } from "./MarkdownProvider.js";
|
|
2
2
|
import { MarkdownRenderer, MarkdownRendererProps, RenderMarkdownProps, renderMarkdown, useMarkdownRenderer } from "./MarkdownRenderer.js";
|
|
3
3
|
import { MarkdownMetadataRenderer, MarkdownRendererPlugin } from "./MarkdownRendererPlugin.js";
|
|
4
|
-
import { LegacyMarkdownRenderer, MarkdownRendererOptions,
|
|
4
|
+
import { LegacyMarkdownRenderer, MarkdownRendererOptions, RuleType, compile, compileMarkdown, compiler, sanitizer as defaultSanitizer, slugify as defaultSlugify } from "./processor.js";
|
|
5
5
|
import reactRuntime, { createReactRuntime } from "./runtime.js";
|
|
6
|
-
export { LegacyMarkdownRenderer, MarkdownMetadataRenderer, MarkdownProvider, MarkdownProviderOptions, MarkdownRenderer, MarkdownRendererOptions, MarkdownRendererPlugin, MarkdownRendererProps,
|
|
6
|
+
export { LegacyMarkdownRenderer, MarkdownMetadataRenderer, MarkdownProvider, MarkdownProviderOptions, MarkdownRenderer, MarkdownRendererOptions, MarkdownRendererPlugin, MarkdownRendererProps, RenderMarkdownProps, RuleType, compile, compileMarkdown, compiler, createReactRuntime, reactRuntime, renderMarkdown, defaultSanitizer as sanitizer, defaultSlugify as slugify, useMarkdownContext, useMarkdownRenderer };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HTMLComponents } from "../utils/HTMLComponentTypes.js";
|
|
2
|
+
import { RenderRuleHook, RuleType, sanitizer as defaultSanitizer, slugify as defaultSlugify } from "@intlayer/core";
|
|
2
3
|
import { FC, HTMLAttributes, JSX, ReactNode, createElement } from "react";
|
|
3
4
|
|
|
4
5
|
//#region src/markdown/processor.d.ts
|
|
5
6
|
type HTMLTags = keyof JSX.IntrinsicElements;
|
|
6
|
-
type State = ParseState;
|
|
7
7
|
/**
|
|
8
8
|
* Refined MarkdownRendererOptions type.
|
|
9
9
|
*/
|
|
@@ -47,7 +47,7 @@ type MarkdownRendererOptions = Partial<{
|
|
|
47
47
|
/**
|
|
48
48
|
* Selectively control the output of particular HTML tags.
|
|
49
49
|
*/
|
|
50
|
-
components:
|
|
50
|
+
components: HTMLComponents;
|
|
51
51
|
/**
|
|
52
52
|
* Allows for full control over rendering of particular rules.
|
|
53
53
|
*/
|
|
@@ -88,5 +88,5 @@ declare const LegacyMarkdownRenderer: FC<Omit<HTMLAttributes<Element>, 'children
|
|
|
88
88
|
options?: MarkdownRendererOptions;
|
|
89
89
|
}>;
|
|
90
90
|
//#endregion
|
|
91
|
-
export { LegacyMarkdownRenderer, MarkdownRendererOptions,
|
|
91
|
+
export { LegacyMarkdownRenderer, MarkdownRendererOptions, RuleType, compile, compileMarkdown, compiler, defaultSanitizer as sanitizer, defaultSlugify as slugify };
|
|
92
92
|
//# sourceMappingURL=processor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processor.d.ts","names":[],"sources":["../../../src/markdown/processor.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"processor.d.ts","names":[],"sources":["../../../src/markdown/processor.tsx"],"mappings":";;;;;KA4BK,QAAA,SAAiB,GAAA,CAAI,iBAAA;;;;KAKd,uBAAA,GAA0B,OAAA;EAA1B;;;EAIV,aAAA,GACE,GAAA,EAAK,UAAA,QAAkB,aAAA,MACvB,KAAA,EAAO,GAAA,CAAI,mBAAA,KACR,QAAA,EAAU,SAAA,OACV,SAAA;EAHE;;;;EASP,eAAA;EA2CY;;;;EArCZ,qBAAA;EApBoC;;;EAyBpC,kBAAA;EApBE;;;EAyBF,UAAA;EAvBK;;;EA4BL,WAAA;EAfA;;;EAoBA,YAAA;EAAA;;;EAKA,mBAAA;IAAA,CACG,GAAA;EAAA;EAWS;;;EALZ,UAAA,EAAY,cAAA;EAUe;;;EAL3B,UAAA,EAAY,cAAA;EAeZ;;;EAVA,SAAA,GAAY,KAAA,UAAe,GAAA,EAAK,QAAA,EAAU,SAAA;EAoBjC;AAiBX;;EAhCE,OAAA,GAAU,KAAA;EAgFX;;;EA3EC,OAAA;EA8BC;;;EAzBD,mBAAA;EAyEW;;;EApEX,SAAA;AAAA;;;;;cAiBW,eAAA,GACX,QAAA,WACA,OAAA,GAAS,uBAAA,KACR,GAAA,CAAI,OAAA;AAAA,cAgDM,QAAA,GAAQ,QAAA,WAlDH,OAAA,GACP,uBAAA,KACR,GAAA,CAAI,OAAA;AAAA,cAiDM,OAAA,GAAO,QAAA,WAnDF,OAAA,GACP,uBAAA,KACR,GAAA,CAAI,OAAA;;;;cAsDM,sBAAA,EAAwB,EAAA,CACnC,IAAA,CAAK,cAAA,CAAe,OAAA;EAClB,QAAA;EACA,OAAA,GAAU,uBAAA;AAAA"}
|
package/dist/types/plugins.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IntlayerNode } from "./IntlayerNode.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { HTMLComponents } from "./utils/HTMLComponentTypes.js";
|
|
3
|
+
import { DeepTransformContent as DeepTransformContent$1, IInterpreterPluginState as IInterpreterPluginState$1, Plugins } from "@intlayer/core";
|
|
4
|
+
import { ReactNode } from "react";
|
|
4
5
|
import { DeclaredLocales, LocalesValues, NodeType } from "@intlayer/types";
|
|
5
6
|
|
|
6
7
|
//#region src/plugins.d.ts
|
|
@@ -22,7 +23,7 @@ declare const reactNodePlugins: Plugins;
|
|
|
22
23
|
/** ---------------------------------------------
|
|
23
24
|
* INSERTION PLUGIN
|
|
24
25
|
* --------------------------------------------- */
|
|
25
|
-
type InsertionCond<T
|
|
26
|
+
type InsertionCond<T> = T extends {
|
|
26
27
|
nodeType: NodeType | string;
|
|
27
28
|
[NodeType.Insertion]: string;
|
|
28
29
|
fields: readonly string[];
|
|
@@ -34,36 +35,50 @@ declare const insertionPlugin: Plugins;
|
|
|
34
35
|
*/
|
|
35
36
|
type MarkdownStringCond<T> = T extends string ? IntlayerNode<string, {
|
|
36
37
|
metadata: DeepTransformContent<string>;
|
|
37
|
-
use: (components:
|
|
38
|
+
use: (components: HTMLComponents<'permissive', {}>) => ReactNode;
|
|
38
39
|
}> : never;
|
|
39
40
|
/** Markdown string plugin. Replaces string node with a component that render the markdown. */
|
|
40
41
|
declare const markdownStringPlugin: Plugins;
|
|
41
|
-
type
|
|
42
|
-
type MarkdownCond<T, S, L extends LocalesValues> = T extends {
|
|
42
|
+
type MarkdownCond<T> = T extends {
|
|
43
43
|
nodeType: NodeType | string;
|
|
44
44
|
[NodeType.Markdown]: infer M;
|
|
45
45
|
metadata?: infer U;
|
|
46
|
+
tags?: infer U;
|
|
46
47
|
} ? {
|
|
47
|
-
use: (components?:
|
|
48
|
-
metadata: DeepTransformContent<U
|
|
49
|
-
}
|
|
48
|
+
use: (components?: HTMLComponents<'permissive', U>) => IntlayerNode<M>;
|
|
49
|
+
metadata: DeepTransformContent<U>;
|
|
50
|
+
} : never;
|
|
50
51
|
declare const markdownPlugin: Plugins;
|
|
51
52
|
/** ---------------------------------------------
|
|
52
53
|
* HTML PLUGIN
|
|
53
54
|
* --------------------------------------------- */
|
|
54
|
-
|
|
55
|
+
/**
|
|
56
|
+
* HTML conditional type that enforces:
|
|
57
|
+
* - All components (Standard or Custom) are OPTIONAL in the `use()` method.
|
|
58
|
+
* - Custom components props are strictly inferred from the dictionary definition.
|
|
59
|
+
*
|
|
60
|
+
* This ensures type safety:
|
|
61
|
+
* - `html('<div>Hello <CustomComponent /></div>').use({ CustomComponent: ... })` - optional but typed
|
|
62
|
+
*/
|
|
63
|
+
type HTMLPluginCond<T> = T extends {
|
|
64
|
+
nodeType: NodeType | string;
|
|
65
|
+
[NodeType.HTML]: infer I;
|
|
66
|
+
tags?: infer U;
|
|
67
|
+
} ? {
|
|
68
|
+
use: (components?: HTMLComponents<'permissive', U>) => IntlayerNode<I>;
|
|
69
|
+
} : never;
|
|
55
70
|
/** HTML plugin. Replaces node with a function that takes components => ReactNode. */
|
|
56
71
|
declare const htmlPlugin: Plugins;
|
|
57
72
|
/** ---------------------------------------------
|
|
58
73
|
* PLUGINS RESULT
|
|
59
74
|
* --------------------------------------------- */
|
|
60
|
-
|
|
75
|
+
type IInterpreterPluginReact<T, _S, _L extends LocalesValues> = {
|
|
61
76
|
reactNode: ReactNodeCond<T>;
|
|
62
77
|
reactIntlayerNode: IntlayerNodeCond<T>;
|
|
63
|
-
reactInsertion: InsertionCond<T
|
|
64
|
-
reactMarkdown: MarkdownCond<T
|
|
65
|
-
reactHtml: HTMLPluginCond<T
|
|
66
|
-
}
|
|
78
|
+
reactInsertion: InsertionCond<T>;
|
|
79
|
+
reactMarkdown: MarkdownCond<T>;
|
|
80
|
+
reactHtml: HTMLPluginCond<T>;
|
|
81
|
+
};
|
|
67
82
|
/**
|
|
68
83
|
* Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.
|
|
69
84
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","names":[],"sources":["../../src/plugins.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","names":[],"sources":["../../src/plugins.tsx"],"mappings":";;;;;;;;;AAkCA;KAAY,gBAAA,MAAsB,CAAA,2BAC9B,YAAA,CAAa,CAAA;;cAIJ,mBAAA,EAAqB,OAAA;;;;KA0BtB,aAAA,MAAmB,CAAA;EAC7B,KAAA;EACA,GAAA;AAAA,IAEE,SAAA;;cAIS,gBAAA,EAAkB,OAAA;;AAlC/B;;KA+DY,aAAA,MAAmB,CAAA;EAC7B,QAAA,EAAU,QAAA;EAAA,CACT,QAAA,CAAS,SAAA;EACV,MAAA;AAAA,KAGI,MAAA,UACQ,CAAA,qBAAsB,SAAA,OAE3B,SAAA;;cA4BI,eAAA,EAAiB,OAAA;;;;KA6DlB,kBAAA,MAAwB,CAAA,kBAChC,YAAA;EAGI,QAAA,EAAU,oBAAA;EACV,GAAA,GAAM,UAAA,EAAY,cAAA,uBAAqC,SAAA;AAAA;;cAMlD,oBAAA,EAAsB,OAAA;AAAA,KA+EvB,YAAA,MAAkB,CAAA;EAC5B,QAAA,EAAU,QAAA;EAAA,CACT,QAAA,CAAS,QAAA;EACV,QAAA;EACA,IAAA;AAAA;EAGI,GAAA,GAAM,UAAA,GAAa,cAAA,eAA6B,CAAA,MAAO,YAAA,CAAa,CAAA;EACpE,QAAA,EAAU,oBAAA,CAAqB,CAAA;AAAA;AAAA,cAIxB,cAAA,EAAgB,OAAA;;;;;;;;;;;;KAmCjB,cAAA,MAAoB,CAAA;EAC9B,QAAA,EAAU,QAAA;EAAA,CACT,QAAA,CAAS,IAAA;EACV,IAAA;AAAA;EAGI,GAAA,GAAM,UAAA,GAAa,cAAA,eAA6B,CAAA,MAAO,YAAA,CAAa,CAAA;AAAA;;cAK7D,UAAA,EAAY,OAAA;;;AApJzB;KAwLY,uBAAA,mBAA0C,aAAA;EACpD,SAAA,EAAW,aAAA,CAAc,CAAA;EACzB,iBAAA,EAAmB,gBAAA,CAAiB,CAAA;EACpC,cAAA,EAAgB,aAAA,CAAc,CAAA;EAC9B,aAAA,EAAe,YAAA,CAAa,CAAA;EAC5B,SAAA,EAAW,cAAA,CAAe,CAAA;AAAA;;;;;;KAQhB,uBAAA,GAA0B,yBAAA;EACpC,SAAA;EACA,iBAAA;EACA,cAAA;EACA,aAAA;EACA,SAAA;AAAA;AAAA,KAGU,oBAAA,cAEA,aAAA,GAAgB,eAAA,IACxB,sBAAA,CAAyB,CAAA,EAAG,uBAAA,EAAyB,CAAA"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import * as react4 from "react";
|
|
2
1
|
import { ReactElement } from "react";
|
|
3
2
|
|
|
4
3
|
//#region src/reactElement/renderReactElement.d.ts
|
|
5
|
-
declare const renderReactElement: (element: ReactElement<any>) =>
|
|
4
|
+
declare const renderReactElement: (element: ReactElement<any>) => any;
|
|
6
5
|
//#endregion
|
|
7
6
|
export { renderReactElement };
|
|
8
7
|
//# sourceMappingURL=renderReactElement.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderReactElement.d.ts","names":[],"sources":["../../../src/reactElement/renderReactElement.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"renderReactElement.d.ts","names":[],"sources":["../../../src/reactElement/renderReactElement.ts"],"mappings":";;;cAGa,kBAAA,GAAsB,OAAA,EAAS,YAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react200 from "react";
|
|
2
2
|
import { FC, PropsWithChildren } from "react";
|
|
3
3
|
import { LocalesValues } from "@intlayer/types";
|
|
4
4
|
|
|
@@ -13,7 +13,7 @@ declare const IntlayerServerContext: FC<PropsWithChildren<{
|
|
|
13
13
|
value?: LocalesValues;
|
|
14
14
|
}>>;
|
|
15
15
|
Consumer: FC<PropsWithChildren<{
|
|
16
|
-
children: (context: LocalesValues) =>
|
|
16
|
+
children: (context: LocalesValues) => react200.ReactNode;
|
|
17
17
|
}>>;
|
|
18
18
|
_storage: () => {
|
|
19
19
|
value: LocalesValues;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IInterpreterPluginState as IInterpreterPluginState$1 } from "../plugins.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _intlayer_core4 from "@intlayer/core";
|
|
3
3
|
import { DeclaredLocales, Dictionary, LocalesValues } from "@intlayer/types";
|
|
4
4
|
|
|
5
5
|
//#region src/server/useDictionary.d.ts
|
|
@@ -8,7 +8,7 @@ import { DeclaredLocales, Dictionary, LocalesValues } from "@intlayer/types";
|
|
|
8
8
|
*
|
|
9
9
|
* If the locale is not provided, it will use the locale from the server context
|
|
10
10
|
*/
|
|
11
|
-
declare const useDictionary: <T extends Dictionary, L extends LocalesValues = DeclaredLocales>(dictionary: T, locale?: L) =>
|
|
11
|
+
declare const useDictionary: <T extends Dictionary, L extends LocalesValues = DeclaredLocales>(dictionary: T, locale?: L) => _intlayer_core4.DeepTransformContent<T["content"], IInterpreterPluginState$1, L>;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { useDictionary };
|
|
14
14
|
//# sourceMappingURL=useDictionary.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IInterpreterPluginState as IInterpreterPluginState$1 } from "../plugins.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _intlayer_core2 from "@intlayer/core";
|
|
3
3
|
import { DeclaredLocales, Dictionary, LocalesValues, StrictModeLocaleMap } from "@intlayer/types";
|
|
4
4
|
|
|
5
5
|
//#region src/server/useDictionaryAsync.d.ts
|
|
@@ -8,7 +8,7 @@ import { DeclaredLocales, Dictionary, LocalesValues, StrictModeLocaleMap } from
|
|
|
8
8
|
*
|
|
9
9
|
* If the locale is not provided, it will use the locale from the server context
|
|
10
10
|
*/
|
|
11
|
-
declare const useDictionaryAsync: <T extends Dictionary, L extends LocalesValues = DeclaredLocales>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, locale?: L) => Promise<
|
|
11
|
+
declare const useDictionaryAsync: <T extends Dictionary, L extends LocalesValues = DeclaredLocales>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, locale?: L) => Promise<_intlayer_core2.DeepTransformContent<T["content"], IInterpreterPluginState$1, L>>;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { useDictionaryAsync };
|
|
14
14
|
//# sourceMappingURL=useDictionaryAsync.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IInterpreterPluginState as IInterpreterPluginState$1 } from "../plugins.js";
|
|
2
2
|
import * as _intlayer_core5 from "@intlayer/core";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _intlayer_types8 from "@intlayer/types";
|
|
4
4
|
import { DictionaryKeys, LocalesValues } from "@intlayer/types";
|
|
5
5
|
|
|
6
6
|
//#region src/server/useIntlayer.d.ts
|
|
@@ -9,7 +9,7 @@ import { DictionaryKeys, LocalesValues } from "@intlayer/types";
|
|
|
9
9
|
*
|
|
10
10
|
* If the locale is not provided, it will use the locale from the server context
|
|
11
11
|
*/
|
|
12
|
-
declare const useIntlayer: <T extends DictionaryKeys, L extends LocalesValues>(key: T, locale?: L) => _intlayer_core5.DeepTransformContent<
|
|
12
|
+
declare const useIntlayer: <T extends DictionaryKeys, L extends LocalesValues>(key: T, locale?: L) => _intlayer_core5.DeepTransformContent<_intlayer_types8.DictionaryRegistryContent<T>, IInterpreterPluginState$1, L>;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { useIntlayer };
|
|
15
15
|
//# sourceMappingURL=useIntlayer.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { HTMLTagsType } from "@intlayer/core";
|
|
2
|
+
import { ComponentProps, FC, HTMLAttributes, JSX } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/HTMLComponentTypes.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Helper to extract specific props from the configuration value.
|
|
7
|
+
*/
|
|
8
|
+
type PropsFromConfig<Value> = Value extends true ? {} : Value extends object ? Value : {};
|
|
9
|
+
/**
|
|
10
|
+
* Smart Type to resolve props based on the key K.
|
|
11
|
+
*/
|
|
12
|
+
type ElementProps<K> = K extends keyof JSX.IntrinsicElements ? ComponentProps<K> : HTMLAttributes<HTMLElement>;
|
|
13
|
+
/**
|
|
14
|
+
* Helper: Defines the mapping for the explicitly listed keys in T.
|
|
15
|
+
* Handles whether they are Required or Optional.
|
|
16
|
+
*/
|
|
17
|
+
type DefinedComponents<T, IsRequired extends boolean> = IsRequired extends true ? { [K in keyof T]: FC<ElementProps<K> & PropsFromConfig<T[K]>> } : { [K in keyof T]?: FC<ElementProps<K> & PropsFromConfig<T[K]>> };
|
|
18
|
+
/**
|
|
19
|
+
* Helper: Defines the standard HTML tags NOT listed in T.
|
|
20
|
+
* These are always optional when included.
|
|
21
|
+
*/
|
|
22
|
+
type RestHTMLComponents<T> = { [K in Exclude<keyof HTMLTagsType, keyof T>]?: FC<K extends keyof JSX.IntrinsicElements ? ComponentProps<K> : HTMLAttributes<HTMLElement>> };
|
|
23
|
+
/**
|
|
24
|
+
* The supported modes for the HTMLComponents type.
|
|
25
|
+
*/
|
|
26
|
+
type HTMLComponentMode = 'permissive' | 'optional' | 'inclusive' | 'strict';
|
|
27
|
+
/**
|
|
28
|
+
* The main component definition with Mode support.
|
|
29
|
+
*/
|
|
30
|
+
type HTMLComponents<Mode extends HTMLComponentMode = 'optional', T = {}> = Mode extends 'strict' ? DefinedComponents<T, true> : Mode extends 'inclusive' ? // Inclusive: Keys in T are required. Rest of HTML is optional.
|
|
31
|
+
DefinedComponents<T, true> & RestHTMLComponents<T> : Mode extends 'permissive' ? // Permissive: Keys in T optional. Rest of HTML optional. Any other string allowed.
|
|
32
|
+
DefinedComponents<T, false> & RestHTMLComponents<T> & {
|
|
33
|
+
[key: string]: FC<HTMLAttributes<HTMLElement>>;
|
|
34
|
+
} : // Optional (Default): Keys in T optional. Rest of HTML optional.
|
|
35
|
+
DefinedComponents<T, false> & RestHTMLComponents<T>;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { HTMLComponentMode, HTMLComponents };
|
|
38
|
+
//# sourceMappingURL=HTMLComponentTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HTMLComponentTypes.d.ts","names":[],"sources":["../../../src/utils/HTMLComponentTypes.tsx"],"mappings":";;;;;;AACqE;KAKhE,eAAA,UAAyB,KAAA,qBAE1B,KAAA,kBACE,KAAA;;;;KAMD,YAAA,MAAkB,CAAA,eAAgB,GAAA,CAAI,iBAAA,GACvC,cAAA,CAAe,CAAA,IACf,cAAA,CAAe,WAAA;;;;;KAMd,iBAAA,kCAAmD,UAAA,8BAGtC,CAAA,GAAI,EAAA,CAAG,YAAA,CAAa,CAAA,IAAK,eAAA,CAAgB,CAAA,CAAE,CAAA,sBAI3C,CAAA,IAAK,EAAA,CAAG,YAAA,CAAa,CAAA,IAAK,eAAA,CAAgB,CAAA,CAAE,CAAA;;;;;KAOzD,kBAAA,cACG,OAAA,OAAc,YAAA,QAAoB,CAAA,KAAM,EAAA,CAC5C,CAAA,eAAgB,GAAA,CAAI,iBAAA,GAChB,cAAA,CAAe,CAAA,IACf,cAAA,CAAe,WAAA;;;;KAOX,iBAAA;;;;KASA,cAAA,cACG,iBAAA,yBAEX,IAAA,oBAEA,iBAAA,CAAkB,CAAA,UAClB,IAAA;AAEE,iBAAA,CAAkB,CAAA,UAAW,kBAAA,CAAmB,CAAA,IAChD,IAAA;AAEE,iBAAA,CAAkB,CAAA,WAChB,kBAAA,CAAmB,CAAA;EAAA,CAEhB,GAAA,WAAc,EAAA,CAAG,cAAA,CAAe,WAAA;AAAA;AAGrC,iBAAA,CAAkB,CAAA,WAAY,kBAAA,CAAmB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-intlayer",
|
|
3
|
-
"version": "8.0.0-canary.
|
|
3
|
+
"version": "8.0.0-canary.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your React applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -116,14 +116,14 @@
|
|
|
116
116
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
117
117
|
},
|
|
118
118
|
"dependencies": {
|
|
119
|
-
"@intlayer/api": "8.0.0-canary.
|
|
120
|
-
"@intlayer/config": "8.0.0-canary.
|
|
121
|
-
"@intlayer/core": "8.0.0-canary.
|
|
122
|
-
"@intlayer/dictionaries-entry": "8.0.0-canary.
|
|
123
|
-
"@intlayer/editor-react": "8.0.0-canary.
|
|
124
|
-
"@intlayer/types": "8.0.0-canary.
|
|
125
|
-
"@intlayer/unmerged-dictionaries-entry": "8.0.0-canary.
|
|
126
|
-
"intlayer": "8.0.0-canary.
|
|
119
|
+
"@intlayer/api": "8.0.0-canary.4",
|
|
120
|
+
"@intlayer/config": "8.0.0-canary.4",
|
|
121
|
+
"@intlayer/core": "8.0.0-canary.4",
|
|
122
|
+
"@intlayer/dictionaries-entry": "8.0.0-canary.4",
|
|
123
|
+
"@intlayer/editor-react": "8.0.0-canary.4",
|
|
124
|
+
"@intlayer/types": "8.0.0-canary.4",
|
|
125
|
+
"@intlayer/unmerged-dictionaries-entry": "8.0.0-canary.4",
|
|
126
|
+
"intlayer": "8.0.0-canary.4"
|
|
127
127
|
},
|
|
128
128
|
"devDependencies": {
|
|
129
129
|
"@craco/types": "7.1.0",
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { BaseHTMLProps, ExtractTags } from "@intlayer/core";
|
|
2
|
-
import { ReactNode } from "react";
|
|
3
|
-
|
|
4
|
-
//#region src/html/types.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Props for React HTML components
|
|
7
|
-
* Extends base HTML props with ReactNode children
|
|
8
|
-
*/
|
|
9
|
-
interface ReactComponentProps extends BaseHTMLProps {
|
|
10
|
-
children?: ReactNode;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* React HTML component function type
|
|
14
|
-
*/
|
|
15
|
-
type ReactHTMLComponent = (props: ReactComponentProps) => ReactNode;
|
|
16
|
-
/**
|
|
17
|
-
* Component map type for React
|
|
18
|
-
* - Standard HTML tags are optional (Partial)
|
|
19
|
-
* - Custom components are required
|
|
20
|
-
*/
|
|
21
|
-
type ReactHTMLComponentMap<T = never> = (T extends Record<string, any> ? { [K in keyof T]: (props: T[K] & {
|
|
22
|
-
children?: ReactNode;
|
|
23
|
-
}) => ReactNode } : T extends string ? { [K in T]: ReactHTMLComponent } : {}) & Partial<Record<string, ReactHTMLComponent>>;
|
|
24
|
-
//#endregion
|
|
25
|
-
export { type ExtractTags, ReactComponentProps, ReactHTMLComponent, ReactHTMLComponentMap };
|
|
26
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/html/types.ts"],"mappings":";;;;;;AAOA;;UAAiB,mBAAA,SAA4B,aAAA;EAC3C,QAAA,GAAW,SAAA;AAAA;;;;KAMD,kBAAA,IAAsB,KAAA,EAAO,mBAAA,KAAwB,SAAA;AAAjE;;;;;AAAA,KAOY,qBAAA,eAAoC,CAAA,SAAU,MAAA,8BACxC,CAAA,IAAK,KAAA,EAAO,CAAA,CAAE,CAAA;EAAO,QAAA,GAAW,SAAA;AAAA,MAAgB,SAAA,KAC9D,CAAA,0BACU,CAAA,GAAI,kBAAA,WAEhB,OAAA,CAAQ,MAAA,SAAe,kBAAA"}
|
|
File without changes
|
|
File without changes
|