react-intlayer 8.0.0-canary.3 → 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 +0 -1
- package/dist/cjs/plugins.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 +0 -1
- package/dist/esm/plugins.mjs.map +1 -1
- package/dist/types/client/IntlayerProvider.d.ts +2 -2
- package/dist/types/client/format/useCurrency.d.ts +2 -2
- package/dist/types/client/format/useNumber.d.ts +2 -2
- package/dist/types/client/format/useNumber.d.ts.map +1 -1
- package/dist/types/client/format/usePercentage.d.ts +2 -2
- package/dist/types/client/useDictionaryDynamic.d.ts +2 -2
- package/dist/types/client/useIntlayer.d.ts +3 -3
- package/dist/types/client/useIntlayer.d.ts.map +1 -1
- 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 +29 -14
- package/dist/types/plugins.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
package/dist/types/plugins.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IntlayerNode } from "./IntlayerNode.js";
|
|
2
|
-
import {
|
|
3
|
-
import { DeepTransformContent as DeepTransformContent$1,
|
|
2
|
+
import { HTMLComponents } from "./utils/HTMLComponentTypes.js";
|
|
3
|
+
import { DeepTransformContent as DeepTransformContent$1, IInterpreterPluginState as IInterpreterPluginState$1, Plugins } from "@intlayer/core";
|
|
4
4
|
import { ReactNode } from "react";
|
|
5
5
|
import { DeclaredLocales, LocalesValues, NodeType } from "@intlayer/types";
|
|
6
6
|
|
|
@@ -23,7 +23,7 @@ declare const reactNodePlugins: Plugins;
|
|
|
23
23
|
/** ---------------------------------------------
|
|
24
24
|
* INSERTION PLUGIN
|
|
25
25
|
* --------------------------------------------- */
|
|
26
|
-
type InsertionCond<T
|
|
26
|
+
type InsertionCond<T> = T extends {
|
|
27
27
|
nodeType: NodeType | string;
|
|
28
28
|
[NodeType.Insertion]: string;
|
|
29
29
|
fields: readonly string[];
|
|
@@ -35,35 +35,50 @@ declare const insertionPlugin: Plugins;
|
|
|
35
35
|
*/
|
|
36
36
|
type MarkdownStringCond<T> = T extends string ? IntlayerNode<string, {
|
|
37
37
|
metadata: DeepTransformContent<string>;
|
|
38
|
-
use: (components:
|
|
38
|
+
use: (components: HTMLComponents<'permissive', {}>) => ReactNode;
|
|
39
39
|
}> : never;
|
|
40
40
|
/** Markdown string plugin. Replaces string node with a component that render the markdown. */
|
|
41
41
|
declare const markdownStringPlugin: Plugins;
|
|
42
|
-
type MarkdownCond<T
|
|
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,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,5 +1,5 @@
|
|
|
1
1
|
import { IInterpreterPluginState as IInterpreterPluginState$1 } from "../plugins.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _intlayer_core5 from "@intlayer/core";
|
|
3
3
|
import * as _intlayer_types8 from "@intlayer/types";
|
|
4
4
|
import { DictionaryKeys, LocalesValues } from "@intlayer/types";
|
|
5
5
|
|
|
@@ -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) =>
|
|
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
|