react-intlayer 7.5.0-canary.1 → 7.5.1

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.
Files changed (92) hide show
  1. package/dist/cjs/client/IntlayerProvider.cjs +8 -8
  2. package/dist/cjs/client/IntlayerProvider.cjs.map +1 -1
  3. package/dist/cjs/client/format/useCompact.cjs +2 -2
  4. package/dist/cjs/client/format/useCompact.cjs.map +1 -1
  5. package/dist/cjs/client/format/useCurrency.cjs +2 -2
  6. package/dist/cjs/client/format/useCurrency.cjs.map +1 -1
  7. package/dist/cjs/client/format/useDate.cjs +2 -2
  8. package/dist/cjs/client/format/useDate.cjs.map +1 -1
  9. package/dist/cjs/client/format/useList.cjs +2 -2
  10. package/dist/cjs/client/format/useList.cjs.map +1 -1
  11. package/dist/cjs/client/format/useNumber.cjs +2 -2
  12. package/dist/cjs/client/format/useNumber.cjs.map +1 -1
  13. package/dist/cjs/client/format/usePercentage.cjs +2 -2
  14. package/dist/cjs/client/format/usePercentage.cjs.map +1 -1
  15. package/dist/cjs/client/format/useRelativeTime.cjs +2 -2
  16. package/dist/cjs/client/format/useRelativeTime.cjs.map +1 -1
  17. package/dist/cjs/client/format/useUnit.cjs +2 -2
  18. package/dist/cjs/client/format/useUnit.cjs.map +1 -1
  19. package/dist/cjs/client/t.cjs +2 -2
  20. package/dist/cjs/client/t.cjs.map +1 -1
  21. package/dist/cjs/client/useDictionaryAsync.cjs +3 -3
  22. package/dist/cjs/client/useDictionaryAsync.cjs.map +1 -1
  23. package/dist/cjs/client/useDictionaryDynamic.cjs +3 -3
  24. package/dist/cjs/client/useDictionaryDynamic.cjs.map +1 -1
  25. package/dist/cjs/client/useI18n.cjs +2 -2
  26. package/dist/cjs/client/useI18n.cjs.map +1 -1
  27. package/dist/cjs/client/useLocale.cjs +3 -3
  28. package/dist/cjs/client/useLocale.cjs.map +1 -1
  29. package/dist/cjs/client/useLocaleBase.cjs +3 -3
  30. package/dist/cjs/client/useLocaleBase.cjs.map +1 -1
  31. package/dist/cjs/client/useLocaleStorage.cjs +6 -6
  32. package/dist/cjs/client/useLocaleStorage.cjs.map +1 -1
  33. package/dist/cjs/client/useTraduction.cjs +2 -2
  34. package/dist/cjs/client/useTraduction.cjs.map +1 -1
  35. package/dist/cjs/editor/ContentSelectorWrapper.cjs +10 -10
  36. package/dist/cjs/editor/ContentSelectorWrapper.cjs.map +1 -1
  37. package/dist/cjs/editor/IntlayerEditorProvider.cjs +10 -10
  38. package/dist/cjs/editor/IntlayerEditorProvider.cjs.map +1 -1
  39. package/dist/cjs/editor/useEditedContentRenderer.cjs +4 -4
  40. package/dist/cjs/editor/useEditedContentRenderer.cjs.map +1 -1
  41. package/dist/cjs/getDictionary.cjs +2 -2
  42. package/dist/cjs/getDictionary.cjs.map +1 -1
  43. package/dist/cjs/getIntlayer.cjs +2 -2
  44. package/dist/cjs/getIntlayer.cjs.map +1 -1
  45. package/dist/cjs/markdown/MarkdownRenderer.cjs +5 -5
  46. package/dist/cjs/markdown/MarkdownRenderer.cjs.map +1 -1
  47. package/dist/cjs/plugins.cjs +6 -6
  48. package/dist/cjs/plugins.cjs.map +1 -1
  49. package/dist/cjs/server/IntlayerServerProvider.cjs +3 -3
  50. package/dist/cjs/server/IntlayerServerProvider.cjs.map +1 -1
  51. package/dist/cjs/server/format/useCompact.cjs +2 -2
  52. package/dist/cjs/server/format/useCompact.cjs.map +1 -1
  53. package/dist/cjs/server/format/useCurrency.cjs +2 -2
  54. package/dist/cjs/server/format/useCurrency.cjs.map +1 -1
  55. package/dist/cjs/server/format/useDate.cjs +2 -2
  56. package/dist/cjs/server/format/useDate.cjs.map +1 -1
  57. package/dist/cjs/server/format/useList.cjs +2 -2
  58. package/dist/cjs/server/format/useList.cjs.map +1 -1
  59. package/dist/cjs/server/format/useNumber.cjs +2 -2
  60. package/dist/cjs/server/format/useNumber.cjs.map +1 -1
  61. package/dist/cjs/server/format/usePercentage.cjs +2 -2
  62. package/dist/cjs/server/format/usePercentage.cjs.map +1 -1
  63. package/dist/cjs/server/format/useRelativeTime.cjs +2 -2
  64. package/dist/cjs/server/format/useRelativeTime.cjs.map +1 -1
  65. package/dist/cjs/server/format/useUnit.cjs +2 -2
  66. package/dist/cjs/server/format/useUnit.cjs.map +1 -1
  67. package/dist/cjs/server/t.cjs +2 -2
  68. package/dist/cjs/server/t.cjs.map +1 -1
  69. package/dist/cjs/server/useDictionaryAsync.cjs +3 -3
  70. package/dist/cjs/server/useDictionaryAsync.cjs.map +1 -1
  71. package/dist/cjs/server/useDictionaryDynamic.cjs +3 -3
  72. package/dist/cjs/server/useDictionaryDynamic.cjs.map +1 -1
  73. package/dist/cjs/server/useLocale.cjs +3 -3
  74. package/dist/cjs/server/useLocale.cjs.map +1 -1
  75. package/dist/types/client/format/useCurrency.d.ts +2 -2
  76. package/dist/types/client/format/useList.d.ts +2 -2
  77. package/dist/types/client/format/useList.d.ts.map +1 -1
  78. package/dist/types/client/format/useNumber.d.ts +2 -2
  79. package/dist/types/client/format/usePercentage.d.ts +2 -2
  80. package/dist/types/client/format/useRelativeTime.d.ts +2 -2
  81. package/dist/types/client/format/useUnit.d.ts +2 -2
  82. package/dist/types/client/useDictionaryDynamic.d.ts +2 -2
  83. package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -1
  84. package/dist/types/client/useIntlayer.d.ts +2 -2
  85. package/dist/types/client/useLocaleBase.d.ts +5 -5
  86. package/dist/types/client/useLocaleStorage.d.ts +5 -5
  87. package/dist/types/server/useDictionary.d.ts +2 -2
  88. package/dist/types/server/useDictionaryAsync.d.ts +2 -2
  89. package/dist/types/server/useDictionaryDynamic.d.ts +2 -2
  90. package/dist/types/server/useIntlayer.d.ts +3 -3
  91. package/dist/types/server/useIntlayer.d.ts.map +1 -1
  92. package/package.json +11 -11
@@ -5,22 +5,22 @@ const require_client_IntlayerProvider = require('../client/IntlayerProvider.cjs'
5
5
  const require_UI_ContentSelector = require('../UI/ContentSelector.cjs');
6
6
  let react = require("react");
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
- let __intlayer_core = require("@intlayer/core");
9
- let __intlayer_types = require("@intlayer/types");
10
- let __intlayer_editor_react = require("@intlayer/editor-react");
8
+ let _intlayer_core = require("@intlayer/core");
9
+ let _intlayer_types = require("@intlayer/types");
10
+ let _intlayer_editor_react = require("@intlayer/editor-react");
11
11
 
12
12
  //#region src/editor/ContentSelectorWrapper.tsx
13
13
  const ContentSelectorWrapperContent = ({ children, dictionaryKey, keyPath }) => {
14
- const { focusedContent, setFocusedContent } = (0, __intlayer_editor_react.useFocusDictionary)();
15
- const { postMessage, senderId } = (0, __intlayer_editor_react.useCommunicator)();
16
- const filteredKeyPath = (0, react.useMemo)(() => keyPath.filter((key) => key.type !== __intlayer_types.NodeType.Translation), [keyPath]);
14
+ const { focusedContent, setFocusedContent } = (0, _intlayer_editor_react.useFocusDictionary)();
15
+ const { postMessage, senderId } = (0, _intlayer_editor_react.useCommunicator)();
16
+ const filteredKeyPath = (0, react.useMemo)(() => keyPath.filter((key) => key.type !== _intlayer_types.NodeType.Translation), [keyPath]);
17
17
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_UI_ContentSelector.ContentSelector, {
18
18
  onPress: (0, react.useCallback)(() => setFocusedContent({
19
19
  dictionaryKey,
20
20
  keyPath: filteredKeyPath
21
21
  }), [dictionaryKey, filteredKeyPath]),
22
22
  onHover: (0, react.useCallback)(() => postMessage({
23
- type: `${__intlayer_editor_react.MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,
23
+ type: `${_intlayer_editor_react.MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,
24
24
  data: {
25
25
  dictionaryKey,
26
26
  keyPath: filteredKeyPath
@@ -28,11 +28,11 @@ const ContentSelectorWrapperContent = ({ children, dictionaryKey, keyPath }) =>
28
28
  senderId
29
29
  }), [dictionaryKey, filteredKeyPath]),
30
30
  onUnhover: (0, react.useCallback)(() => postMessage({
31
- type: `${__intlayer_editor_react.MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,
31
+ type: `${_intlayer_editor_react.MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,
32
32
  data: null,
33
33
  senderId
34
34
  }), [senderId]),
35
- isSelecting: (0, react.useMemo)(() => (focusedContent?.dictionaryKey === dictionaryKey && (focusedContent?.keyPath?.length ?? 0) > 0 && (0, __intlayer_core.isSameKeyPath)(focusedContent?.keyPath ?? [], filteredKeyPath)) ?? false, [
35
+ isSelecting: (0, react.useMemo)(() => (focusedContent?.dictionaryKey === dictionaryKey && (focusedContent?.keyPath?.length ?? 0) > 0 && (0, _intlayer_core.isSameKeyPath)(focusedContent?.keyPath ?? [], filteredKeyPath)) ?? false, [
36
36
  focusedContent,
37
37
  filteredKeyPath,
38
38
  dictionaryKey
@@ -41,7 +41,7 @@ const ContentSelectorWrapperContent = ({ children, dictionaryKey, keyPath }) =>
41
41
  });
42
42
  };
43
43
  const ContentSelectorRenderer = ({ children, ...props }) => {
44
- const { enabled } = (0, __intlayer_editor_react.useEditorEnabled)();
44
+ const { enabled } = (0, _intlayer_editor_react.useEditorEnabled)();
45
45
  const { disableEditor } = require_client_IntlayerProvider.useIntlayerContext();
46
46
  if (enabled && !disableEditor) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContentSelectorWrapperContent, {
47
47
  ...props,
@@ -1 +1 @@
1
- {"version":3,"file":"ContentSelectorWrapper.cjs","names":["ContentSelectorWrapperContent: FC<ContentSelectorWrapperProps>","NodeType","ContentSelector","MessageKey","ContentSelectorRenderer: FC<ContentSelectorWrapperProps>","useIntlayerContext"],"sources":["../../../src/editor/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { isSameKeyPath, type NodeProps } from '@intlayer/core';\nimport {\n MessageKey,\n useCommunicator,\n useEditorEnabled,\n useFocusDictionary,\n} from '@intlayer/editor-react';\nimport { NodeType } from '@intlayer/types';\nimport { type FC, type HTMLAttributes, useCallback, useMemo } from 'react';\nimport { useIntlayerContext } from '../client';\nimport { ContentSelector } from '../UI/ContentSelector';\n\nexport type ContentSelectorWrapperProps = NodeProps &\n Omit<HTMLAttributes<HTMLDivElement>, 'children'>;\n\nconst ContentSelectorWrapperContent: FC<ContentSelectorWrapperProps> = ({\n children,\n dictionaryKey,\n keyPath,\n}) => {\n const { focusedContent, setFocusedContent } = useFocusDictionary();\n const { postMessage, senderId } = useCommunicator();\n\n // Filter out translation nodes for more flexibility with the editor that can have different format\n const filteredKeyPath = useMemo(\n () => keyPath.filter((key) => key.type !== NodeType.Translation),\n [keyPath]\n );\n\n const handleSelect = useCallback(\n () =>\n setFocusedContent({\n dictionaryKey,\n keyPath: filteredKeyPath,\n }),\n [dictionaryKey, filteredKeyPath]\n );\n\n const handleHover = useCallback(\n () =>\n postMessage({\n type: `${MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,\n data: {\n dictionaryKey,\n keyPath: filteredKeyPath,\n },\n senderId,\n }),\n [dictionaryKey, filteredKeyPath]\n );\n\n const handleUnhover = useCallback(\n () =>\n postMessage({\n type: `${MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,\n data: null,\n senderId,\n }),\n [senderId]\n );\n\n const isSelected = useMemo(\n () =>\n (focusedContent?.dictionaryKey === dictionaryKey &&\n (focusedContent?.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(focusedContent?.keyPath ?? [], filteredKeyPath)) ??\n false,\n [focusedContent, filteredKeyPath, dictionaryKey]\n );\n\n return (\n <ContentSelector\n onPress={handleSelect}\n onHover={handleHover}\n onUnhover={handleUnhover}\n isSelecting={isSelected}\n >\n {children}\n </ContentSelector>\n );\n};\n\nexport const ContentSelectorRenderer: FC<ContentSelectorWrapperProps> = ({\n children,\n ...props\n}) => {\n const { enabled } = useEditorEnabled();\n const { disableEditor } = useIntlayerContext();\n\n if (enabled && !disableEditor) {\n return (\n <ContentSelectorWrapperContent {...props}>\n {children}\n </ContentSelectorWrapperContent>\n );\n }\n\n return children;\n};\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAMA,iCAAkE,EACtE,UACA,eACA,cACI;CACJ,MAAM,EAAE,gBAAgB,uEAA0C;CAClE,MAAM,EAAE,aAAa,2DAA8B;CAGnD,MAAM,2CACE,QAAQ,QAAQ,QAAQ,IAAI,SAASC,0BAAS,YAAY,EAChE,CAAC,QAAQ,CACV;AA2CD,QACE,2CAACC;EACC,sCAzCA,kBAAkB;GAChB;GACA,SAAS;GACV,CAAC,EACJ,CAAC,eAAe,gBAAgB,CACjC;EAqCG,sCAjCA,YAAY;GACV,MAAM,GAAGC,mCAAW,iCAAiC;GACrD,MAAM;IACJ;IACA,SAAS;IACV;GACD;GACD,CAAC,EACJ,CAAC,eAAe,gBAAgB,CACjC;EAyBG,wCArBA,YAAY;GACV,MAAM,GAAGA,mCAAW,iCAAiC;GACrD,MAAM;GACN;GACD,CAAC,EACJ,CAAC,SAAS,CACX;EAgBG,uCAZC,gBAAgB,kBAAkB,kBAChC,gBAAgB,SAAS,UAAU,KAAK,wCAC3B,gBAAgB,WAAW,EAAE,EAAE,gBAAgB,KAC/D,OACF;GAAC;GAAgB;GAAiB;GAAc,CACjD;EASI;GACe;;AAItB,MAAaC,2BAA4D,EACvE,UACA,GAAG,YACC;CACJ,MAAM,EAAE,2DAA8B;CACtC,MAAM,EAAE,kBAAkBC,oDAAoB;AAE9C,KAAI,WAAW,CAAC,cACd,QACE,2CAAC;EAA8B,GAAI;EAChC;GAC6B;AAIpC,QAAO"}
1
+ {"version":3,"file":"ContentSelectorWrapper.cjs","names":["ContentSelectorWrapperContent: FC<ContentSelectorWrapperProps>","NodeType","ContentSelector","MessageKey","ContentSelectorRenderer: FC<ContentSelectorWrapperProps>","useIntlayerContext"],"sources":["../../../src/editor/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { isSameKeyPath, type NodeProps } from '@intlayer/core';\nimport {\n MessageKey,\n useCommunicator,\n useEditorEnabled,\n useFocusDictionary,\n} from '@intlayer/editor-react';\nimport { NodeType } from '@intlayer/types';\nimport { type FC, type HTMLAttributes, useCallback, useMemo } from 'react';\nimport { useIntlayerContext } from '../client';\nimport { ContentSelector } from '../UI/ContentSelector';\n\nexport type ContentSelectorWrapperProps = NodeProps &\n Omit<HTMLAttributes<HTMLDivElement>, 'children'>;\n\nconst ContentSelectorWrapperContent: FC<ContentSelectorWrapperProps> = ({\n children,\n dictionaryKey,\n keyPath,\n}) => {\n const { focusedContent, setFocusedContent } = useFocusDictionary();\n const { postMessage, senderId } = useCommunicator();\n\n // Filter out translation nodes for more flexibility with the editor that can have different format\n const filteredKeyPath = useMemo(\n () => keyPath.filter((key) => key.type !== NodeType.Translation),\n [keyPath]\n );\n\n const handleSelect = useCallback(\n () =>\n setFocusedContent({\n dictionaryKey,\n keyPath: filteredKeyPath,\n }),\n [dictionaryKey, filteredKeyPath]\n );\n\n const handleHover = useCallback(\n () =>\n postMessage({\n type: `${MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,\n data: {\n dictionaryKey,\n keyPath: filteredKeyPath,\n },\n senderId,\n }),\n [dictionaryKey, filteredKeyPath]\n );\n\n const handleUnhover = useCallback(\n () =>\n postMessage({\n type: `${MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,\n data: null,\n senderId,\n }),\n [senderId]\n );\n\n const isSelected = useMemo(\n () =>\n (focusedContent?.dictionaryKey === dictionaryKey &&\n (focusedContent?.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(focusedContent?.keyPath ?? [], filteredKeyPath)) ??\n false,\n [focusedContent, filteredKeyPath, dictionaryKey]\n );\n\n return (\n <ContentSelector\n onPress={handleSelect}\n onHover={handleHover}\n onUnhover={handleUnhover}\n isSelecting={isSelected}\n >\n {children}\n </ContentSelector>\n );\n};\n\nexport const ContentSelectorRenderer: FC<ContentSelectorWrapperProps> = ({\n children,\n ...props\n}) => {\n const { enabled } = useEditorEnabled();\n const { disableEditor } = useIntlayerContext();\n\n if (enabled && !disableEditor) {\n return (\n <ContentSelectorWrapperContent {...props}>\n {children}\n </ContentSelectorWrapperContent>\n );\n }\n\n return children;\n};\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAMA,iCAAkE,EACtE,UACA,eACA,cACI;CACJ,MAAM,EAAE,gBAAgB,sEAA0C;CAClE,MAAM,EAAE,aAAa,0DAA8B;CAGnD,MAAM,2CACE,QAAQ,QAAQ,QAAQ,IAAI,SAASC,yBAAS,YAAY,EAChE,CAAC,QAAQ,CACV;AA2CD,QACE,2CAACC;EACC,sCAzCA,kBAAkB;GAChB;GACA,SAAS;GACV,CAAC,EACJ,CAAC,eAAe,gBAAgB,CACjC;EAqCG,sCAjCA,YAAY;GACV,MAAM,GAAGC,kCAAW,iCAAiC;GACrD,MAAM;IACJ;IACA,SAAS;IACV;GACD;GACD,CAAC,EACJ,CAAC,eAAe,gBAAgB,CACjC;EAyBG,wCArBA,YAAY;GACV,MAAM,GAAGA,kCAAW,iCAAiC;GACrD,MAAM;GACN;GACD,CAAC,EACJ,CAAC,SAAS,CACX;EAgBG,uCAZC,gBAAgB,kBAAkB,kBAChC,gBAAgB,SAAS,UAAU,KAAK,uCAC3B,gBAAgB,WAAW,EAAE,EAAE,gBAAgB,KAC/D,OACF;GAAC;GAAgB;GAAiB;GAAc,CACjD;EASI;GACe;;AAItB,MAAaC,2BAA4D,EACvE,UACA,GAAG,YACC;CACJ,MAAM,EAAE,0DAA8B;CACtC,MAAM,EAAE,kBAAkBC,oDAAoB;AAE9C,KAAI,WAAW,CAAC,cACd,QACE,2CAAC;EAA8B,GAAI;EAChC;GAC6B;AAIpC,QAAO"}
@@ -3,24 +3,24 @@
3
3
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
4
4
  let react = require("react");
5
5
  let react_jsx_runtime = require("react/jsx-runtime");
6
- let __intlayer_editor_react = require("@intlayer/editor-react");
7
- let __intlayer_config_built = require("@intlayer/config/built");
8
- __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_built);
6
+ let _intlayer_editor_react = require("@intlayer/editor-react");
7
+ let _intlayer_config_built = require("@intlayer/config/built");
8
+ _intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
9
9
 
10
10
  //#region src/editor/IntlayerEditorProvider.tsx
11
11
  const IntlayerEditorHooksEnabled = () => {
12
12
  /**
13
13
  * URL Messages
14
14
  */
15
- (0, __intlayer_editor_react.useCrossURLPathSetter)();
15
+ (0, _intlayer_editor_react.useCrossURLPathSetter)();
16
16
  /**
17
17
  * Click Messages
18
18
  */
19
- (0, __intlayer_editor_react.useIframeClickInterceptor)();
19
+ (0, _intlayer_editor_react.useIframeClickInterceptor)();
20
20
  /**
21
21
  * Sent local dictionaries to editor
22
22
  */
23
- const { setLocaleDictionaries } = (0, __intlayer_editor_react.useDictionariesRecordActions)();
23
+ const { setLocaleDictionaries } = (0, _intlayer_editor_react.useDictionariesRecordActions)();
24
24
  (0, react.useEffect)(() => {
25
25
  import("@intlayer/unmerged-dictionaries-entry").then((mod) => {
26
26
  const unmergedDictionaries = mod.getUnmergedDictionaries();
@@ -30,13 +30,13 @@ const IntlayerEditorHooksEnabled = () => {
30
30
  }, []);
31
31
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {});
32
32
  };
33
- const { editor } = __intlayer_config_built.default ?? {};
33
+ const { editor } = _intlayer_config_built.default ?? {};
34
34
  const IntlayerEditorHook = () => {
35
- const { enabled } = (0, __intlayer_editor_react.useEditorEnabled)();
35
+ const { enabled } = (0, _intlayer_editor_react.useEditorEnabled)();
36
36
  return enabled ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IntlayerEditorHooksEnabled, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {});
37
37
  };
38
38
  const IntlayerEditorProvider = ({ children }) => {
39
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__intlayer_editor_react.EditorProvider, {
39
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_intlayer_editor_react.EditorProvider, {
40
40
  postMessage: (data) => {
41
41
  if (typeof window === "undefined") return;
42
42
  if (!editor) return;
@@ -51,7 +51,7 @@ const IntlayerEditorProvider = ({ children }) => {
51
51
  editor?.applicationURL
52
52
  ].filter(Boolean),
53
53
  mode: "client",
54
- configuration: __intlayer_config_built.default,
54
+ configuration: _intlayer_config_built.default,
55
55
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(IntlayerEditorHook, {}), children]
56
56
  });
57
57
  };
@@ -1 +1 @@
1
- {"version":3,"file":"IntlayerEditorProvider.cjs","names":["IntlayerEditorHooksEnabled: FC","configuration","IntlayerEditorHook: FC","IntlayerEditorProvider: FC<PropsWithChildren>","EditorProvider"],"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport {\n EditorProvider,\n useCrossURLPathSetter,\n useDictionariesRecordActions,\n useEditorEnabled,\n useIframeClickInterceptor,\n} from '@intlayer/editor-react';\nimport type { FC, PropsWithChildren } from 'react';\nimport { useEffect } from 'react';\n\nconst IntlayerEditorHooksEnabled: FC = () => {\n /**\n * URL Messages\n */\n useCrossURLPathSetter();\n\n /**\n * Click Messages\n */\n useIframeClickInterceptor();\n\n /**\n * Sent local dictionaries to editor\n */\n const { setLocaleDictionaries } = useDictionariesRecordActions();\n useEffect(() => {\n // Load dictionaries dynamically to do not impact the bundle, and send them to the editor\n import('@intlayer/unmerged-dictionaries-entry').then((mod) => {\n const unmergedDictionaries = mod.getUnmergedDictionaries();\n const dictionariesList = Object.fromEntries(\n Object.values(unmergedDictionaries)\n .flat()\n .map((dictionary) => [dictionary.localId, dictionary])\n );\n\n setLocaleDictionaries?.(dictionariesList);\n });\n }, []);\n\n return <></>;\n};\n\nconst { editor } = configuration ?? {};\n\nconst IntlayerEditorHook: FC = () => {\n const { enabled } = useEditorEnabled();\n\n return enabled ? <IntlayerEditorHooksEnabled /> : <></>;\n};\n\nexport const IntlayerEditorProvider: FC<PropsWithChildren> = ({ children }) => {\n return (\n <EditorProvider\n postMessage={(data: any) => {\n if (typeof window === 'undefined') return;\n if (!editor) return;\n\n const isInIframe = window.self !== window.top;\n if (!isInIframe) return;\n\n if (editor.applicationURL.length > 0) {\n window?.postMessage(\n data,\n // Use to restrict the origin of the editor for security reasons.\n // Correspond to the current application URL to synchronize the locales states.\n editor.applicationURL\n );\n }\n\n if (editor.editorURL.length > 0) {\n window.parent?.postMessage(\n data,\n // Use to restrict the origin of the editor for security reasons.\n // Correspond to the editor URL to synchronize the locales states.\n editor.editorURL\n );\n }\n\n if (editor.cmsURL.length > 0) {\n window.parent?.postMessage(\n data,\n // Use to restrict the origin of the CMS for security reasons.\n // Correspond to the CMS URL.\n editor.cmsURL\n );\n }\n }}\n allowedOrigins={\n [editor?.editorURL, editor?.cmsURL, editor?.applicationURL].filter(\n Boolean\n ) as string[]\n }\n mode=\"client\"\n configuration={configuration}\n >\n <IntlayerEditorHook />\n {children}\n </EditorProvider>\n );\n};\n"],"mappings":";;;;;;;;;;AAaA,MAAMA,mCAAuC;;;;AAI3C,qDAAuB;;;;AAKvB,yDAA2B;;;;CAK3B,MAAM,EAAE,qFAAwD;AAChE,4BAAgB;AAEd,SAAO,yCAAyC,MAAM,QAAQ;GAC5D,MAAM,uBAAuB,IAAI,yBAAyB;GAC1D,MAAM,mBAAmB,OAAO,YAC9B,OAAO,OAAO,qBAAqB,CAChC,MAAM,CACN,KAAK,eAAe,CAAC,WAAW,SAAS,WAAW,CAAC,CACzD;AAED,2BAAwB,iBAAiB;IACzC;IACD,EAAE,CAAC;AAEN,QAAO,0EAAK;;AAGd,MAAM,EAAE,WAAWC,mCAAiB,EAAE;AAEtC,MAAMC,2BAA+B;CACnC,MAAM,EAAE,2DAA8B;AAEtC,QAAO,UAAU,2CAAC,+BAA6B,GAAG,0EAAK;;AAGzD,MAAaC,0BAAiD,EAAE,eAAe;AAC7E,QACE,4CAACC;EACC,cAAc,SAAc;AAC1B,OAAI,OAAO,WAAW,YAAa;AACnC,OAAI,CAAC,OAAQ;AAGb,OAAI,EADe,OAAO,SAAS,OAAO,KACzB;AAEjB,OAAI,OAAO,eAAe,SAAS,EACjC,SAAQ,YACN,MAGA,OAAO,eACR;AAGH,OAAI,OAAO,UAAU,SAAS,EAC5B,QAAO,QAAQ,YACb,MAGA,OAAO,UACR;AAGH,OAAI,OAAO,OAAO,SAAS,EACzB,QAAO,QAAQ,YACb,MAGA,OAAO,OACR;;EAGL,gBACE;GAAC,QAAQ;GAAW,QAAQ;GAAQ,QAAQ;GAAe,CAAC,OAC1D,QACD;EAEH,MAAK;EACL,eAAeH;aAEf,2CAAC,uBAAqB,EACrB;GACc"}
1
+ {"version":3,"file":"IntlayerEditorProvider.cjs","names":["IntlayerEditorHooksEnabled: FC","configuration","IntlayerEditorHook: FC","IntlayerEditorProvider: FC<PropsWithChildren>","EditorProvider"],"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport {\n EditorProvider,\n useCrossURLPathSetter,\n useDictionariesRecordActions,\n useEditorEnabled,\n useIframeClickInterceptor,\n} from '@intlayer/editor-react';\nimport type { FC, PropsWithChildren } from 'react';\nimport { useEffect } from 'react';\n\nconst IntlayerEditorHooksEnabled: FC = () => {\n /**\n * URL Messages\n */\n useCrossURLPathSetter();\n\n /**\n * Click Messages\n */\n useIframeClickInterceptor();\n\n /**\n * Sent local dictionaries to editor\n */\n const { setLocaleDictionaries } = useDictionariesRecordActions();\n useEffect(() => {\n // Load dictionaries dynamically to do not impact the bundle, and send them to the editor\n import('@intlayer/unmerged-dictionaries-entry').then((mod) => {\n const unmergedDictionaries = mod.getUnmergedDictionaries();\n const dictionariesList = Object.fromEntries(\n Object.values(unmergedDictionaries)\n .flat()\n .map((dictionary) => [dictionary.localId, dictionary])\n );\n\n setLocaleDictionaries?.(dictionariesList);\n });\n }, []);\n\n return <></>;\n};\n\nconst { editor } = configuration ?? {};\n\nconst IntlayerEditorHook: FC = () => {\n const { enabled } = useEditorEnabled();\n\n return enabled ? <IntlayerEditorHooksEnabled /> : <></>;\n};\n\nexport const IntlayerEditorProvider: FC<PropsWithChildren> = ({ children }) => {\n return (\n <EditorProvider\n postMessage={(data: any) => {\n if (typeof window === 'undefined') return;\n if (!editor) return;\n\n const isInIframe = window.self !== window.top;\n if (!isInIframe) return;\n\n if (editor.applicationURL.length > 0) {\n window?.postMessage(\n data,\n // Use to restrict the origin of the editor for security reasons.\n // Correspond to the current application URL to synchronize the locales states.\n editor.applicationURL\n );\n }\n\n if (editor.editorURL.length > 0) {\n window.parent?.postMessage(\n data,\n // Use to restrict the origin of the editor for security reasons.\n // Correspond to the editor URL to synchronize the locales states.\n editor.editorURL\n );\n }\n\n if (editor.cmsURL.length > 0) {\n window.parent?.postMessage(\n data,\n // Use to restrict the origin of the CMS for security reasons.\n // Correspond to the CMS URL.\n editor.cmsURL\n );\n }\n }}\n allowedOrigins={\n [editor?.editorURL, editor?.cmsURL, editor?.applicationURL].filter(\n Boolean\n ) as string[]\n }\n mode=\"client\"\n configuration={configuration}\n >\n <IntlayerEditorHook />\n {children}\n </EditorProvider>\n );\n};\n"],"mappings":";;;;;;;;;;AAaA,MAAMA,mCAAuC;;;;AAI3C,oDAAuB;;;;AAKvB,wDAA2B;;;;CAK3B,MAAM,EAAE,oFAAwD;AAChE,4BAAgB;AAEd,SAAO,yCAAyC,MAAM,QAAQ;GAC5D,MAAM,uBAAuB,IAAI,yBAAyB;GAC1D,MAAM,mBAAmB,OAAO,YAC9B,OAAO,OAAO,qBAAqB,CAChC,MAAM,CACN,KAAK,eAAe,CAAC,WAAW,SAAS,WAAW,CAAC,CACzD;AAED,2BAAwB,iBAAiB;IACzC;IACD,EAAE,CAAC;AAEN,QAAO,0EAAK;;AAGd,MAAM,EAAE,WAAWC,kCAAiB,EAAE;AAEtC,MAAMC,2BAA+B;CACnC,MAAM,EAAE,0DAA8B;AAEtC,QAAO,UAAU,2CAAC,+BAA6B,GAAG,0EAAK;;AAGzD,MAAaC,0BAAiD,EAAE,eAAe;AAC7E,QACE,4CAACC;EACC,cAAc,SAAc;AAC1B,OAAI,OAAO,WAAW,YAAa;AACnC,OAAI,CAAC,OAAQ;AAGb,OAAI,EADe,OAAO,SAAS,OAAO,KACzB;AAEjB,OAAI,OAAO,eAAe,SAAS,EACjC,SAAQ,YACN,MAGA,OAAO,eACR;AAGH,OAAI,OAAO,UAAU,SAAS,EAC5B,QAAO,QAAQ,YACb,MAGA,OAAO,UACR;AAGH,OAAI,OAAO,OAAO,SAAS,EACzB,QAAO,QAAQ,YACb,MAGA,OAAO,OACR;;EAGL,gBACE;GAAC,QAAQ;GAAW,QAAQ;GAAQ,QAAQ;GAAe,CAAC,OAC1D,QACD;EAEH,MAAK;EACL,eAAeH;aAEf,2CAAC,uBAAqB,EACrB;GACc"}
@@ -3,19 +3,19 @@
3
3
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
4
4
  const require_editor_ContentSelectorWrapper = require('./ContentSelectorWrapper.cjs');
5
5
  let react = require("react");
6
- let __intlayer_core = require("@intlayer/core");
7
- let __intlayer_editor_react = require("@intlayer/editor-react");
6
+ let _intlayer_core = require("@intlayer/core");
7
+ let _intlayer_editor_react = require("@intlayer/editor-react");
8
8
 
9
9
  //#region src/editor/useEditedContentRenderer.tsx
10
10
  const useEditedContentRenderer = ({ dictionaryKey, keyPath, children }) => {
11
- const editedContentContext = (0, __intlayer_editor_react.useEditedContentActions)();
11
+ const editedContentContext = (0, _intlayer_editor_react.useEditedContentActions)();
12
12
  if (editedContentContext) return editedContentContext.getEditedContentValue(dictionaryKey, keyPath) ?? children;
13
13
  return children;
14
14
  };
15
15
  const EditedContentRenderer = (props) => {
16
16
  const content = useEditedContentRenderer(props);
17
17
  if (typeof content === "object") {
18
- const transformedEditedContent = (0, __intlayer_core.getContent)(content, props, props.locale);
18
+ const transformedEditedContent = (0, _intlayer_core.getContent)(content, props, props.locale);
19
19
  if (typeof transformedEditedContent !== "string") {
20
20
  console.error(`Incorrect edited content format. Content type: ${typeof transformedEditedContent}. Expected string. Value ${JSON.stringify(transformedEditedContent)}`);
21
21
  return /* @__PURE__ */ (0, react.createElement)(require_editor_ContentSelectorWrapper.ContentSelectorRenderer, {
@@ -1 +1 @@
1
- {"version":3,"file":"useEditedContentRenderer.cjs","names":["EditedContentRenderer: FC<EditedContentRendererProps>","ContentSelectorRenderer"],"sources":["../../../src/editor/useEditedContentRenderer.tsx"],"sourcesContent":["'use client';\n\nimport { getContent } from '@intlayer/core';\nimport { useEditedContentActions } from '@intlayer/editor-react';\nimport type { KeyPath, Locale } from '@intlayer/types';\nimport type { FC } from 'react';\nimport { ContentSelectorRenderer } from './ContentSelectorWrapper';\n\ntype EditedContentRendererProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n children: string;\n locale?: Locale;\n};\n\nexport const useEditedContentRenderer = ({\n dictionaryKey,\n keyPath,\n children,\n}: EditedContentRendererProps) => {\n const editedContentContext = useEditedContentActions();\n\n if (editedContentContext) {\n const editedValue = editedContentContext.getEditedContentValue(\n dictionaryKey,\n keyPath\n ) as string;\n\n const value = editedValue ?? children;\n\n return value;\n }\n\n return children;\n};\n\nexport const EditedContentRenderer: FC<EditedContentRendererProps> = (\n props\n) => {\n const content = useEditedContentRenderer(props);\n\n if (typeof content === 'object') {\n const transformedEditedContent = getContent(content, props, props.locale);\n\n if (typeof transformedEditedContent !== 'string') {\n console.error(\n `Incorrect edited content format. Content type: ${typeof transformedEditedContent}. Expected string. Value ${JSON.stringify(transformedEditedContent)}`\n );\n\n return (\n <ContentSelectorRenderer {...props} key={props.children}>\n {props.children}\n </ContentSelectorRenderer>\n );\n }\n\n return (\n <ContentSelectorRenderer {...props} key={props.children}>\n {transformedEditedContent}\n </ContentSelectorRenderer>\n );\n }\n\n return (\n <ContentSelectorRenderer {...props} key={props.children}>\n {content}\n </ContentSelectorRenderer>\n );\n};\n"],"mappings":";;;;;;;;;AAeA,MAAa,4BAA4B,EACvC,eACA,SACA,eACgC;CAChC,MAAM,6EAAgD;AAEtD,KAAI,qBAQF,QAPoB,qBAAqB,sBACvC,eACA,QACD,IAE4B;AAK/B,QAAO;;AAGT,MAAaA,yBACX,UACG;CACH,MAAM,UAAU,yBAAyB,MAAM;AAE/C,KAAI,OAAO,YAAY,UAAU;EAC/B,MAAM,2DAAsC,SAAS,OAAO,MAAM,OAAO;AAEzE,MAAI,OAAO,6BAA6B,UAAU;AAChD,WAAQ,MACN,kDAAkD,OAAO,yBAAyB,2BAA2B,KAAK,UAAU,yBAAyB,GACtJ;AAED,UACE,yCAACC;IAAwB,GAAI;IAAO,KAAK,MAAM;MAC5C,MAAM,SACiB;;AAI9B,SACE,yCAACA;GAAwB,GAAI;GAAO,KAAK,MAAM;KAC5C,yBACuB;;AAI9B,QACE,yCAACA;EAAwB,GAAI;EAAO,KAAK,MAAM;IAC5C,QACuB"}
1
+ {"version":3,"file":"useEditedContentRenderer.cjs","names":["EditedContentRenderer: FC<EditedContentRendererProps>","ContentSelectorRenderer"],"sources":["../../../src/editor/useEditedContentRenderer.tsx"],"sourcesContent":["'use client';\n\nimport { getContent } from '@intlayer/core';\nimport { useEditedContentActions } from '@intlayer/editor-react';\nimport type { KeyPath, Locale } from '@intlayer/types';\nimport type { FC } from 'react';\nimport { ContentSelectorRenderer } from './ContentSelectorWrapper';\n\ntype EditedContentRendererProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n children: string;\n locale?: Locale;\n};\n\nexport const useEditedContentRenderer = ({\n dictionaryKey,\n keyPath,\n children,\n}: EditedContentRendererProps) => {\n const editedContentContext = useEditedContentActions();\n\n if (editedContentContext) {\n const editedValue = editedContentContext.getEditedContentValue(\n dictionaryKey,\n keyPath\n ) as string;\n\n const value = editedValue ?? children;\n\n return value;\n }\n\n return children;\n};\n\nexport const EditedContentRenderer: FC<EditedContentRendererProps> = (\n props\n) => {\n const content = useEditedContentRenderer(props);\n\n if (typeof content === 'object') {\n const transformedEditedContent = getContent(content, props, props.locale);\n\n if (typeof transformedEditedContent !== 'string') {\n console.error(\n `Incorrect edited content format. Content type: ${typeof transformedEditedContent}. Expected string. Value ${JSON.stringify(transformedEditedContent)}`\n );\n\n return (\n <ContentSelectorRenderer {...props} key={props.children}>\n {props.children}\n </ContentSelectorRenderer>\n );\n }\n\n return (\n <ContentSelectorRenderer {...props} key={props.children}>\n {transformedEditedContent}\n </ContentSelectorRenderer>\n );\n }\n\n return (\n <ContentSelectorRenderer {...props} key={props.children}>\n {content}\n </ContentSelectorRenderer>\n );\n};\n"],"mappings":";;;;;;;;;AAeA,MAAa,4BAA4B,EACvC,eACA,SACA,eACgC;CAChC,MAAM,4EAAgD;AAEtD,KAAI,qBAQF,QAPoB,qBAAqB,sBACvC,eACA,QACD,IAE4B;AAK/B,QAAO;;AAGT,MAAaA,yBACX,UACG;CACH,MAAM,UAAU,yBAAyB,MAAM;AAE/C,KAAI,OAAO,YAAY,UAAU;EAC/B,MAAM,0DAAsC,SAAS,OAAO,MAAM,OAAO;AAEzE,MAAI,OAAO,6BAA6B,UAAU;AAChD,WAAQ,MACN,kDAAkD,OAAO,yBAAyB,2BAA2B,KAAK,UAAU,yBAAyB,GACtJ;AAED,UACE,yCAACC;IAAwB,GAAI;IAAO,KAAK,MAAM;MAC5C,MAAM,SACiB;;AAI9B,SACE,yCAACA;GAAwB,GAAI;GAAO,KAAK,MAAM;KAC5C,yBACuB;;AAI9B,QACE,yCAACA;EAAwB,GAAI;EAAO,KAAK,MAAM;IAC5C,QACuB"}
@@ -1,10 +1,10 @@
1
1
  const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
2
  const require_plugins = require('./plugins.cjs');
3
- let __intlayer_core = require("@intlayer/core");
3
+ let _intlayer_core = require("@intlayer/core");
4
4
 
5
5
  //#region src/getDictionary.ts
6
6
  const getDictionary = (dictionary, locale, additionalPlugins) => {
7
- return (0, __intlayer_core.getDictionary)(dictionary, locale, [
7
+ return (0, _intlayer_core.getDictionary)(dictionary, locale, [
8
8
  require_plugins.intlayerNodePlugins,
9
9
  require_plugins.reactNodePlugins,
10
10
  require_plugins.markdownPlugin,
@@ -1 +1 @@
1
- {"version":3,"file":"getDictionary.cjs","names":["intlayerNodePlugins","reactNodePlugins","markdownPlugin"],"sources":["../../src/getDictionary.ts"],"sourcesContent":["import {\n getDictionary as getDictionaryCore,\n type Plugins,\n} from '@intlayer/core';\nimport type {\n DeclaredLocales,\n Dictionary,\n LocalesValues,\n} from '@intlayer/types';\nimport {\n type DeepTransformContent,\n intlayerNodePlugins,\n markdownPlugin,\n reactNodePlugins,\n} from './plugins';\n\nexport const getDictionary = <\n T extends Dictionary,\n L extends LocalesValues = DeclaredLocales,\n>(\n dictionary: T,\n locale?: L,\n additionalPlugins?: Plugins[]\n): DeepTransformContent<T['content'], L> => {\n const plugins: Plugins[] = [\n intlayerNodePlugins,\n reactNodePlugins,\n markdownPlugin,\n ...(additionalPlugins ?? []),\n ];\n\n return getDictionaryCore(dictionary, locale, plugins) as any;\n};\n"],"mappings":";;;;;AAgBA,MAAa,iBAIX,YACA,QACA,sBAC0C;AAQ1C,2CAAyB,YAAY,QAPV;EACzBA;EACAC;EACAC;EACA,GAAI,qBAAqB,EAAE;EAC5B,CAEoD"}
1
+ {"version":3,"file":"getDictionary.cjs","names":["intlayerNodePlugins","reactNodePlugins","markdownPlugin"],"sources":["../../src/getDictionary.ts"],"sourcesContent":["import {\n getDictionary as getDictionaryCore,\n type Plugins,\n} from '@intlayer/core';\nimport type {\n DeclaredLocales,\n Dictionary,\n LocalesValues,\n} from '@intlayer/types';\nimport {\n type DeepTransformContent,\n intlayerNodePlugins,\n markdownPlugin,\n reactNodePlugins,\n} from './plugins';\n\nexport const getDictionary = <\n T extends Dictionary,\n L extends LocalesValues = DeclaredLocales,\n>(\n dictionary: T,\n locale?: L,\n additionalPlugins?: Plugins[]\n): DeepTransformContent<T['content'], L> => {\n const plugins: Plugins[] = [\n intlayerNodePlugins,\n reactNodePlugins,\n markdownPlugin,\n ...(additionalPlugins ?? []),\n ];\n\n return getDictionaryCore(dictionary, locale, plugins) as any;\n};\n"],"mappings":";;;;;AAgBA,MAAa,iBAIX,YACA,QACA,sBAC0C;AAQ1C,0CAAyB,YAAY,QAPV;EACzBA;EACAC;EACAC;EACA,GAAI,qBAAqB,EAAE;EAC5B,CAEoD"}
@@ -1,10 +1,10 @@
1
1
  const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
2
  const require_plugins = require('./plugins.cjs');
3
- let __intlayer_core = require("@intlayer/core");
3
+ let _intlayer_core = require("@intlayer/core");
4
4
 
5
5
  //#region src/getIntlayer.ts
6
6
  const getIntlayer = (key, locale, additionalPlugins) => {
7
- return (0, __intlayer_core.getIntlayer)(key, locale, [
7
+ return (0, _intlayer_core.getIntlayer)(key, locale, [
8
8
  require_plugins.intlayerNodePlugins,
9
9
  require_plugins.reactNodePlugins,
10
10
  require_plugins.markdownPlugin,
@@ -1 +1 @@
1
- {"version":3,"file":"getIntlayer.cjs","names":["intlayerNodePlugins","reactNodePlugins","markdownPlugin"],"sources":["../../src/getIntlayer.ts"],"sourcesContent":["import { getIntlayer as getIntlayerCore, type Plugins } from '@intlayer/core';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionaryRegistryContent,\n LocalesValues,\n} from '@intlayer/types';\nimport {\n type DeepTransformContent,\n intlayerNodePlugins,\n markdownPlugin,\n reactNodePlugins,\n} from './plugins';\n\nexport const getIntlayer = <\n T extends DictionaryKeys,\n L extends LocalesValues = DeclaredLocales,\n>(\n key: T,\n locale?: L,\n additionalPlugins?: Plugins[]\n): DeepTransformContent<DictionaryRegistryContent<T>, L> => {\n const plugins: Plugins[] = [\n intlayerNodePlugins,\n reactNodePlugins,\n markdownPlugin,\n ...(additionalPlugins ?? []),\n ];\n\n return getIntlayerCore(key, locale, plugins) as any;\n};\n"],"mappings":";;;;;AAcA,MAAa,eAIX,KACA,QACA,sBAC0D;AAQ1D,yCAAuB,KAAK,QAPD;EACzBA;EACAC;EACAC;EACA,GAAI,qBAAqB,EAAE;EAC5B,CAE2C"}
1
+ {"version":3,"file":"getIntlayer.cjs","names":["intlayerNodePlugins","reactNodePlugins","markdownPlugin"],"sources":["../../src/getIntlayer.ts"],"sourcesContent":["import { getIntlayer as getIntlayerCore, type Plugins } from '@intlayer/core';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionaryRegistryContent,\n LocalesValues,\n} from '@intlayer/types';\nimport {\n type DeepTransformContent,\n intlayerNodePlugins,\n markdownPlugin,\n reactNodePlugins,\n} from './plugins';\n\nexport const getIntlayer = <\n T extends DictionaryKeys,\n L extends LocalesValues = DeclaredLocales,\n>(\n key: T,\n locale?: L,\n additionalPlugins?: Plugins[]\n): DeepTransformContent<DictionaryRegistryContent<T>, L> => {\n const plugins: Plugins[] = [\n intlayerNodePlugins,\n reactNodePlugins,\n markdownPlugin,\n ...(additionalPlugins ?? []),\n ];\n\n return getIntlayerCore(key, locale, plugins) as any;\n};\n"],"mappings":";;;;;AAcA,MAAa,eAIX,KACA,QACA,sBAC0D;AAQ1D,wCAAuB,KAAK,QAPD;EACzBA;EACAC;EACAC;EACA,GAAI,qBAAqB,EAAE;EAC5B,CAE2C"}
@@ -3,8 +3,8 @@
3
3
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
4
4
  const require_editor_useEditedContentRenderer = require('../editor/useEditedContentRenderer.cjs');
5
5
  const require_markdown_MarkdownProvider = require('./MarkdownProvider.cjs');
6
- let __intlayer_core = require("@intlayer/core");
7
- let __intlayer_editor_react = require("@intlayer/editor-react");
6
+ let _intlayer_core = require("@intlayer/core");
7
+ let _intlayer_editor_react = require("@intlayer/editor-react");
8
8
 
9
9
  //#region src/markdown/MarkdownRenderer.tsx
10
10
  const MarkdownRenderer = ({ dictionaryKey, keyPath, children, locale }) => {
@@ -15,7 +15,7 @@ const MarkdownRenderer = ({ dictionaryKey, keyPath, children, locale }) => {
15
15
  children
16
16
  });
17
17
  if (typeof editedContentContext !== "string") {
18
- const transformedEditedContent = (0, __intlayer_core.getContent)(editedContentContext, {
18
+ const transformedEditedContent = (0, _intlayer_core.getContent)(editedContentContext, {
19
19
  dictionaryKey,
20
20
  keyPath
21
21
  }, locale);
@@ -33,8 +33,8 @@ const MarkdownMetadataRenderer = ({ dictionaryKey, keyPath, children, metadataKe
33
33
  keyPath,
34
34
  children
35
35
  });
36
- const currentLocale = (0, __intlayer_editor_react.useEditorLocale)();
37
- return (0, __intlayer_core.getContentNodeByKeyPath)((0, __intlayer_core.getMarkdownMetadata)(editedContentContext), metadataKeyPath, currentLocale);
36
+ const currentLocale = (0, _intlayer_editor_react.useEditorLocale)();
37
+ return (0, _intlayer_core.getContentNodeByKeyPath)((0, _intlayer_core.getMarkdownMetadata)(editedContentContext), metadataKeyPath, currentLocale);
38
38
  };
39
39
 
40
40
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownRenderer.cjs","names":["MarkdownRenderer: FC<MarkdownRendererProps>","useMarkdownContext","useEditedContentRenderer","MarkdownMetadataRenderer: FC<MarkdownMetadataRendererProps>"],"sources":["../../../src/markdown/MarkdownRenderer.tsx"],"sourcesContent":["'use client';\n\nimport {\n getContent,\n getContentNodeByKeyPath,\n getMarkdownMetadata,\n} from '@intlayer/core';\nimport { useEditorLocale } from '@intlayer/editor-react';\nimport type { ContentNode, KeyPath, LocalesValues } from '@intlayer/types';\nimport type { FC, ReactNode } from 'react';\nimport { useEditedContentRenderer } from '../editor/useEditedContentRenderer';\nimport { useMarkdownContext } from './MarkdownProvider';\n\ntype MarkdownRendererProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n locale?: LocalesValues;\n children: string;\n};\n\nexport const MarkdownRenderer: FC<MarkdownRendererProps> = ({\n dictionaryKey,\n keyPath,\n children,\n locale,\n}): ReactNode => {\n const { renderMarkdown } = useMarkdownContext();\n const editedContentContext = useEditedContentRenderer({\n dictionaryKey,\n keyPath,\n children,\n });\n\n if (typeof editedContentContext !== 'string') {\n const transformedEditedContent = getContent(\n editedContentContext,\n {\n dictionaryKey,\n keyPath,\n },\n locale\n );\n\n if (typeof transformedEditedContent !== 'string') {\n console.error(\n `Incorrect Markdown content. Edited Markdown content type: ${typeof transformedEditedContent}. Expected string. Value ${JSON.stringify(transformedEditedContent)}`\n );\n\n return renderMarkdown(children);\n }\n\n return renderMarkdown(transformedEditedContent);\n }\n\n return renderMarkdown(editedContentContext);\n};\n\ntype MarkdownMetadataRendererProps = MarkdownRendererProps & {\n metadataKeyPath: KeyPath[];\n};\n\nexport const MarkdownMetadataRenderer: FC<MarkdownMetadataRendererProps> = ({\n dictionaryKey,\n keyPath,\n children,\n metadataKeyPath,\n}): ReactNode => {\n const editedContentContext = useEditedContentRenderer({\n dictionaryKey,\n keyPath,\n children,\n });\n const currentLocale = useEditorLocale();\n\n const metadata = getMarkdownMetadata(editedContentContext);\n\n const metadataEl = getContentNodeByKeyPath(\n metadata as ContentNode,\n metadataKeyPath,\n currentLocale\n );\n\n return metadataEl as ReactNode;\n};\n"],"mappings":";;;;;;;;;AAoBA,MAAaA,oBAA+C,EAC1D,eACA,SACA,UACA,aACe;CACf,MAAM,EAAE,mBAAmBC,sDAAoB;CAC/C,MAAM,uBAAuBC,iEAAyB;EACpD;EACA;EACA;EACD,CAAC;AAEF,KAAI,OAAO,yBAAyB,UAAU;EAC5C,MAAM,2DACJ,sBACA;GACE;GACA;GACD,EACD,OACD;AAED,MAAI,OAAO,6BAA6B,UAAU;AAChD,WAAQ,MACN,6DAA6D,OAAO,yBAAyB,2BAA2B,KAAK,UAAU,yBAAyB,GACjK;AAED,UAAO,eAAe,SAAS;;AAGjC,SAAO,eAAe,yBAAyB;;AAGjD,QAAO,eAAe,qBAAqB;;AAO7C,MAAaC,4BAA+D,EAC1E,eACA,SACA,UACA,sBACe;CACf,MAAM,uBAAuBD,iEAAyB;EACpD;EACA;EACA;EACD,CAAC;CACF,MAAM,8DAAiC;AAUvC,8FARqC,qBAAqB,EAIxD,iBACA,cACD"}
1
+ {"version":3,"file":"MarkdownRenderer.cjs","names":["MarkdownRenderer: FC<MarkdownRendererProps>","useMarkdownContext","useEditedContentRenderer","MarkdownMetadataRenderer: FC<MarkdownMetadataRendererProps>"],"sources":["../../../src/markdown/MarkdownRenderer.tsx"],"sourcesContent":["'use client';\n\nimport {\n getContent,\n getContentNodeByKeyPath,\n getMarkdownMetadata,\n} from '@intlayer/core';\nimport { useEditorLocale } from '@intlayer/editor-react';\nimport type { ContentNode, KeyPath, LocalesValues } from '@intlayer/types';\nimport type { FC, ReactNode } from 'react';\nimport { useEditedContentRenderer } from '../editor/useEditedContentRenderer';\nimport { useMarkdownContext } from './MarkdownProvider';\n\ntype MarkdownRendererProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n locale?: LocalesValues;\n children: string;\n};\n\nexport const MarkdownRenderer: FC<MarkdownRendererProps> = ({\n dictionaryKey,\n keyPath,\n children,\n locale,\n}): ReactNode => {\n const { renderMarkdown } = useMarkdownContext();\n const editedContentContext = useEditedContentRenderer({\n dictionaryKey,\n keyPath,\n children,\n });\n\n if (typeof editedContentContext !== 'string') {\n const transformedEditedContent = getContent(\n editedContentContext,\n {\n dictionaryKey,\n keyPath,\n },\n locale\n );\n\n if (typeof transformedEditedContent !== 'string') {\n console.error(\n `Incorrect Markdown content. Edited Markdown content type: ${typeof transformedEditedContent}. Expected string. Value ${JSON.stringify(transformedEditedContent)}`\n );\n\n return renderMarkdown(children);\n }\n\n return renderMarkdown(transformedEditedContent);\n }\n\n return renderMarkdown(editedContentContext);\n};\n\ntype MarkdownMetadataRendererProps = MarkdownRendererProps & {\n metadataKeyPath: KeyPath[];\n};\n\nexport const MarkdownMetadataRenderer: FC<MarkdownMetadataRendererProps> = ({\n dictionaryKey,\n keyPath,\n children,\n metadataKeyPath,\n}): ReactNode => {\n const editedContentContext = useEditedContentRenderer({\n dictionaryKey,\n keyPath,\n children,\n });\n const currentLocale = useEditorLocale();\n\n const metadata = getMarkdownMetadata(editedContentContext);\n\n const metadataEl = getContentNodeByKeyPath(\n metadata as ContentNode,\n metadataKeyPath,\n currentLocale\n );\n\n return metadataEl as ReactNode;\n};\n"],"mappings":";;;;;;;;;AAoBA,MAAaA,oBAA+C,EAC1D,eACA,SACA,UACA,aACe;CACf,MAAM,EAAE,mBAAmBC,sDAAoB;CAC/C,MAAM,uBAAuBC,iEAAyB;EACpD;EACA;EACA;EACD,CAAC;AAEF,KAAI,OAAO,yBAAyB,UAAU;EAC5C,MAAM,0DACJ,sBACA;GACE;GACA;GACD,EACD,OACD;AAED,MAAI,OAAO,6BAA6B,UAAU;AAChD,WAAQ,MACN,6DAA6D,OAAO,yBAAyB,2BAA2B,KAAK,UAAU,yBAAyB,GACjK;AAED,UAAO,eAAe,SAAS;;AAGjC,SAAO,eAAe,yBAAyB;;AAGjD,QAAO,eAAe,qBAAqB;;AAO7C,MAAaC,4BAA+D,EAC1E,eACA,SACA,UACA,sBACe;CACf,MAAM,uBAAuBD,iEAAyB;EACpD;EACA;EACA;EACD,CAAC;CACF,MAAM,6DAAiC;AAUvC,4FARqC,qBAAqB,EAIxD,iBACA,cACD"}
@@ -5,8 +5,8 @@ const require_editor_useEditedContentRenderer = require('./editor/useEditedConte
5
5
  const require_markdown_MarkdownRenderer = require('./markdown/MarkdownRenderer.cjs');
6
6
  const require_reactElement_renderReactElement = require('./reactElement/renderReactElement.cjs');
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
- let __intlayer_core = require("@intlayer/core");
9
- let __intlayer_types = require("@intlayer/types");
8
+ let _intlayer_core = require("@intlayer/core");
9
+ let _intlayer_types = require("@intlayer/types");
10
10
 
11
11
  //#region src/plugins.tsx
12
12
  /** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
@@ -41,7 +41,7 @@ const markdownStringPlugin = {
41
41
  canHandle: (node) => typeof node === "string",
42
42
  transform: (node, props, deepTransformNode) => {
43
43
  const { plugins, ...rest } = props;
44
- const metadataNodes = deepTransformNode((0, __intlayer_core.getMarkdownMetadata)(node), {
44
+ const metadataNodes = deepTransformNode((0, _intlayer_core.getMarkdownMetadata)(node), {
45
45
  plugins: [{
46
46
  id: "markdown-metadata-plugin",
47
47
  canHandle: (metadataNode) => typeof metadataNode === "string" || typeof metadataNode === "number" || typeof metadataNode === "boolean" || !metadataNode,
@@ -77,10 +77,10 @@ const markdownStringPlugin = {
77
77
  };
78
78
  const markdownPlugin = {
79
79
  id: "markdown-plugin",
80
- canHandle: (node) => typeof node === "object" && node?.nodeType === __intlayer_types.NodeType.Markdown,
80
+ canHandle: (node) => typeof node === "object" && node?.nodeType === _intlayer_types.NodeType.Markdown,
81
81
  transform: (node, props, deepTransformNode) => {
82
- const newKeyPath = [...props.keyPath, { type: __intlayer_types.NodeType.Markdown }];
83
- const children = node[__intlayer_types.NodeType.Markdown];
82
+ const newKeyPath = [...props.keyPath, { type: _intlayer_types.NodeType.Markdown }];
83
+ const children = node[_intlayer_types.NodeType.Markdown];
84
84
  return deepTransformNode(children, {
85
85
  ...props,
86
86
  children,
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.cjs","names":["intlayerNodePlugins: Plugins","renderIntlayerNode","EditedContentRenderer","reactNodePlugins: Plugins","ContentSelectorRenderer","renderReactElement","markdownStringPlugin: Plugins","props","MarkdownMetadataRenderer","MarkdownRenderer","markdownPlugin: Plugins","NodeType","newKeyPath: KeyPath[]"],"sources":["../../src/plugins.tsx"],"sourcesContent":["import {\n type DeepTransformContent as DeepTransformContentCore,\n getMarkdownMetadata,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n type MarkdownContent,\n type Plugins,\n} from '@intlayer/core';\nimport type { DeclaredLocales, KeyPath, LocalesValues } from '@intlayer/types';\nimport { NodeType } from '@intlayer/types';\nimport type { ReactNode } from 'react';\nimport { ContentSelectorRenderer } from './editor';\nimport { EditedContentRenderer } from './editor/useEditedContentRenderer';\nimport { type IntlayerNode, renderIntlayerNode } from './IntlayerNode';\nimport { MarkdownMetadataRenderer, MarkdownRenderer } from './markdown';\nimport { renderReactElement } from './reactElement/renderReactElement';\n\n/** ---------------------------------------------\n * INTLAYER NODE PLUGIN\n * --------------------------------------------- */\n\nexport type IntlayerNodeCond<T> = T extends number | string\n ? IntlayerNode<T>\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const intlayerNodePlugins: Plugins = {\n id: 'intlayer-node-plugin',\n canHandle: (node) =>\n typeof node === 'bigint' ||\n typeof node === 'string' ||\n typeof node === 'number',\n transform: (\n _node,\n {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n }\n ) =>\n renderIntlayerNode({\n ...rest,\n value: rest.children,\n children: (\n <EditedContentRenderer {...rest}>{rest.children}</EditedContentRenderer>\n ),\n }),\n};\n\n/** ---------------------------------------------\n * REACT NODE PLUGIN\n * --------------------------------------------- */\n\nexport type ReactNodeCond<T> = T extends {\n props: any;\n key: any;\n}\n ? ReactNode\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const reactNodePlugins: Plugins = {\n id: 'react-node-plugin',\n canHandle: (node) =>\n typeof node === 'object' &&\n typeof node?.props !== 'undefined' &&\n typeof node.key !== 'undefined',\n\n transform: (\n node,\n {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n }\n ) =>\n renderIntlayerNode({\n ...rest,\n value: '[[react-element]]',\n children: (\n <ContentSelectorRenderer {...rest}>\n {renderReactElement(node)}\n </ContentSelectorRenderer>\n ),\n }),\n};\n\n/**\n * MARKDOWN PLUGIN\n */\n\nexport type MarkdownStringCond<T> = T extends string\n ? IntlayerNode<string, { metadata: DeepTransformContent<string> }>\n : never;\n\n/** Markdown string plugin. Replaces string node with a component that render the markdown. */\nexport const markdownStringPlugin: Plugins = {\n id: 'markdown-string-plugin',\n canHandle: (node) => typeof node === 'string',\n transform: (node: string, props, deepTransformNode) => {\n const {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n } = props;\n\n const metadata = getMarkdownMetadata(node);\n\n const metadataPlugins: Plugins = {\n id: 'markdown-metadata-plugin',\n canHandle: (metadataNode) =>\n typeof metadataNode === 'string' ||\n typeof metadataNode === 'number' ||\n typeof metadataNode === 'boolean' ||\n !metadataNode,\n transform: (metadataNode, props) =>\n renderIntlayerNode({\n ...props,\n value: metadataNode,\n children: (\n <ContentSelectorRenderer {...rest}>\n <MarkdownMetadataRenderer\n {...rest}\n metadataKeyPath={props.keyPath}\n >\n {node}\n </MarkdownMetadataRenderer>\n </ContentSelectorRenderer>\n ),\n }),\n };\n\n // Transform metadata while keeping the same structure\n const metadataNodes = deepTransformNode(metadata, {\n plugins: [metadataPlugins],\n dictionaryKey: rest.dictionaryKey,\n keyPath: [],\n });\n\n return renderIntlayerNode({\n ...props,\n value: node,\n children: (\n <ContentSelectorRenderer {...rest}>\n <MarkdownRenderer {...rest}>{node}</MarkdownRenderer>\n </ContentSelectorRenderer>\n ),\n additionalProps: {\n metadata: metadataNodes,\n },\n });\n },\n};\n\nexport type MarkdownCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeType.Markdown]: infer M;\n metadata?: infer U;\n}\n ? IntlayerNode<DeepTransformContent<M>, { metadata: DeepTransformContent<U> }>\n : never;\n\nexport const markdownPlugin: Plugins = {\n id: 'markdown-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Markdown,\n transform: (node: MarkdownContent, props, deepTransformNode) => {\n const newKeyPath: KeyPath[] = [\n ...props.keyPath,\n {\n type: NodeType.Markdown,\n },\n ];\n\n const children = node[NodeType.Markdown];\n\n return deepTransformNode(children, {\n ...props,\n children,\n keyPath: newKeyPath,\n plugins: [markdownStringPlugin, ...(props.plugins ?? [])],\n });\n },\n};\n/** ---------------------------------------------\n * PLUGINS RESULT\n * --------------------------------------------- */\n\nexport interface IInterpreterPluginReact<T> {\n reactNode: ReactNodeCond<T>;\n intlayerNode: IntlayerNodeCond<T>;\n markdown: MarkdownCond<T>;\n}\n\n/**\n * Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.\n *\n * Otherwise the the `react-intlayer` plugins will override the types of `intlayer` functions.\n */\nexport type IInterpreterPluginState = IInterpreterPluginStateCore & {\n reactNode: true;\n intlayerNode: true;\n markdown: true;\n};\n\nexport type DeepTransformContent<\n T,\n L extends LocalesValues = DeclaredLocales,\n> = DeepTransformContentCore<T, IInterpreterPluginState, L>;\n"],"mappings":";;;;;;;;;;;;AAyBA,MAAaA,sBAA+B;CAC1C,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;CAClB,YACE,OACA,EACE,SACA,GAAG,WAGLC,wCAAmB;EACjB,GAAG;EACH,OAAO,KAAK;EACZ,UACE,2CAACC;GAAsB,GAAI;aAAO,KAAK;IAAiC;EAE3E,CAAC;CACL;;AAcD,MAAaC,mBAA4B;CACvC,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,MAAM,UAAU,eACvB,OAAO,KAAK,QAAQ;CAEtB,YACE,MACA,EACE,SACA,GAAG,WAGLF,wCAAmB;EACjB,GAAG;EACH,OAAO;EACP,UACE,2CAACG;GAAwB,GAAI;aAC1BC,2DAAmB,KAAK;IACD;EAE7B,CAAC;CACL;;AAWD,MAAaC,uBAAgC;CAC3C,IAAI;CACJ,YAAY,SAAS,OAAO,SAAS;CACrC,YAAY,MAAc,OAAO,sBAAsB;EACrD,MAAM,EACJ,SACA,GAAG,SACD;EA6BJ,MAAM,gBAAgB,2DA3Be,KAAK,EA2BQ;GAChD,SAAS,CA1BsB;IAC/B,IAAI;IACJ,YAAY,iBACV,OAAO,iBAAiB,YACxB,OAAO,iBAAiB,YACxB,OAAO,iBAAiB,aACxB,CAAC;IACH,YAAY,cAAc,YACxBL,wCAAmB;KACjB,GAAGM;KACH,OAAO;KACP,UACE,2CAACH;MAAwB,GAAI;gBAC3B,2CAACI;OACC,GAAI;OACJ,iBAAiBD,QAAM;iBAEtB;QACwB;OACH;KAE7B,CAAC;IACL,CAI2B;GAC1B,eAAe,KAAK;GACpB,SAAS,EAAE;GACZ,CAAC;AAEF,SAAON,wCAAmB;GACxB,GAAG;GACH,OAAO;GACP,UACE,2CAACG;IAAwB,GAAI;cAC3B,2CAACK;KAAiB,GAAI;eAAO;MAAwB;KAC7B;GAE5B,iBAAiB,EACf,UAAU,eACX;GACF,CAAC;;CAEL;AAUD,MAAaC,iBAA0B;CACrC,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAAY,MAAM,aAAaC,0BAAS;CAC1D,YAAY,MAAuB,OAAO,sBAAsB;EAC9D,MAAMC,aAAwB,CAC5B,GAAG,MAAM,SACT,EACE,MAAMD,0BAAS,UAChB,CACF;EAED,MAAM,WAAW,KAAKA,0BAAS;AAE/B,SAAO,kBAAkB,UAAU;GACjC,GAAG;GACH;GACA,SAAS;GACT,SAAS,CAAC,sBAAsB,GAAI,MAAM,WAAW,EAAE,CAAE;GAC1D,CAAC;;CAEL"}
1
+ {"version":3,"file":"plugins.cjs","names":["intlayerNodePlugins: Plugins","renderIntlayerNode","EditedContentRenderer","reactNodePlugins: Plugins","ContentSelectorRenderer","renderReactElement","markdownStringPlugin: Plugins","props","MarkdownMetadataRenderer","MarkdownRenderer","markdownPlugin: Plugins","NodeType","newKeyPath: KeyPath[]"],"sources":["../../src/plugins.tsx"],"sourcesContent":["import {\n type DeepTransformContent as DeepTransformContentCore,\n getMarkdownMetadata,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n type MarkdownContent,\n type Plugins,\n} from '@intlayer/core';\nimport type { DeclaredLocales, KeyPath, LocalesValues } from '@intlayer/types';\nimport { NodeType } from '@intlayer/types';\nimport type { ReactNode } from 'react';\nimport { ContentSelectorRenderer } from './editor';\nimport { EditedContentRenderer } from './editor/useEditedContentRenderer';\nimport { type IntlayerNode, renderIntlayerNode } from './IntlayerNode';\nimport { MarkdownMetadataRenderer, MarkdownRenderer } from './markdown';\nimport { renderReactElement } from './reactElement/renderReactElement';\n\n/** ---------------------------------------------\n * INTLAYER NODE PLUGIN\n * --------------------------------------------- */\n\nexport type IntlayerNodeCond<T> = T extends number | string\n ? IntlayerNode<T>\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const intlayerNodePlugins: Plugins = {\n id: 'intlayer-node-plugin',\n canHandle: (node) =>\n typeof node === 'bigint' ||\n typeof node === 'string' ||\n typeof node === 'number',\n transform: (\n _node,\n {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n }\n ) =>\n renderIntlayerNode({\n ...rest,\n value: rest.children,\n children: (\n <EditedContentRenderer {...rest}>{rest.children}</EditedContentRenderer>\n ),\n }),\n};\n\n/** ---------------------------------------------\n * REACT NODE PLUGIN\n * --------------------------------------------- */\n\nexport type ReactNodeCond<T> = T extends {\n props: any;\n key: any;\n}\n ? ReactNode\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const reactNodePlugins: Plugins = {\n id: 'react-node-plugin',\n canHandle: (node) =>\n typeof node === 'object' &&\n typeof node?.props !== 'undefined' &&\n typeof node.key !== 'undefined',\n\n transform: (\n node,\n {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n }\n ) =>\n renderIntlayerNode({\n ...rest,\n value: '[[react-element]]',\n children: (\n <ContentSelectorRenderer {...rest}>\n {renderReactElement(node)}\n </ContentSelectorRenderer>\n ),\n }),\n};\n\n/**\n * MARKDOWN PLUGIN\n */\n\nexport type MarkdownStringCond<T> = T extends string\n ? IntlayerNode<string, { metadata: DeepTransformContent<string> }>\n : never;\n\n/** Markdown string plugin. Replaces string node with a component that render the markdown. */\nexport const markdownStringPlugin: Plugins = {\n id: 'markdown-string-plugin',\n canHandle: (node) => typeof node === 'string',\n transform: (node: string, props, deepTransformNode) => {\n const {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n } = props;\n\n const metadata = getMarkdownMetadata(node);\n\n const metadataPlugins: Plugins = {\n id: 'markdown-metadata-plugin',\n canHandle: (metadataNode) =>\n typeof metadataNode === 'string' ||\n typeof metadataNode === 'number' ||\n typeof metadataNode === 'boolean' ||\n !metadataNode,\n transform: (metadataNode, props) =>\n renderIntlayerNode({\n ...props,\n value: metadataNode,\n children: (\n <ContentSelectorRenderer {...rest}>\n <MarkdownMetadataRenderer\n {...rest}\n metadataKeyPath={props.keyPath}\n >\n {node}\n </MarkdownMetadataRenderer>\n </ContentSelectorRenderer>\n ),\n }),\n };\n\n // Transform metadata while keeping the same structure\n const metadataNodes = deepTransformNode(metadata, {\n plugins: [metadataPlugins],\n dictionaryKey: rest.dictionaryKey,\n keyPath: [],\n });\n\n return renderIntlayerNode({\n ...props,\n value: node,\n children: (\n <ContentSelectorRenderer {...rest}>\n <MarkdownRenderer {...rest}>{node}</MarkdownRenderer>\n </ContentSelectorRenderer>\n ),\n additionalProps: {\n metadata: metadataNodes,\n },\n });\n },\n};\n\nexport type MarkdownCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeType.Markdown]: infer M;\n metadata?: infer U;\n}\n ? IntlayerNode<DeepTransformContent<M>, { metadata: DeepTransformContent<U> }>\n : never;\n\nexport const markdownPlugin: Plugins = {\n id: 'markdown-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Markdown,\n transform: (node: MarkdownContent, props, deepTransformNode) => {\n const newKeyPath: KeyPath[] = [\n ...props.keyPath,\n {\n type: NodeType.Markdown,\n },\n ];\n\n const children = node[NodeType.Markdown];\n\n return deepTransformNode(children, {\n ...props,\n children,\n keyPath: newKeyPath,\n plugins: [markdownStringPlugin, ...(props.plugins ?? [])],\n });\n },\n};\n/** ---------------------------------------------\n * PLUGINS RESULT\n * --------------------------------------------- */\n\nexport interface IInterpreterPluginReact<T> {\n reactNode: ReactNodeCond<T>;\n intlayerNode: IntlayerNodeCond<T>;\n markdown: MarkdownCond<T>;\n}\n\n/**\n * Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.\n *\n * Otherwise the the `react-intlayer` plugins will override the types of `intlayer` functions.\n */\nexport type IInterpreterPluginState = IInterpreterPluginStateCore & {\n reactNode: true;\n intlayerNode: true;\n markdown: true;\n};\n\nexport type DeepTransformContent<\n T,\n L extends LocalesValues = DeclaredLocales,\n> = DeepTransformContentCore<T, IInterpreterPluginState, L>;\n"],"mappings":";;;;;;;;;;;;AAyBA,MAAaA,sBAA+B;CAC1C,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;CAClB,YACE,OACA,EACE,SACA,GAAG,WAGLC,wCAAmB;EACjB,GAAG;EACH,OAAO,KAAK;EACZ,UACE,2CAACC;GAAsB,GAAI;aAAO,KAAK;IAAiC;EAE3E,CAAC;CACL;;AAcD,MAAaC,mBAA4B;CACvC,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,MAAM,UAAU,eACvB,OAAO,KAAK,QAAQ;CAEtB,YACE,MACA,EACE,SACA,GAAG,WAGLF,wCAAmB;EACjB,GAAG;EACH,OAAO;EACP,UACE,2CAACG;GAAwB,GAAI;aAC1BC,2DAAmB,KAAK;IACD;EAE7B,CAAC;CACL;;AAWD,MAAaC,uBAAgC;CAC3C,IAAI;CACJ,YAAY,SAAS,OAAO,SAAS;CACrC,YAAY,MAAc,OAAO,sBAAsB;EACrD,MAAM,EACJ,SACA,GAAG,SACD;EA6BJ,MAAM,gBAAgB,0DA3Be,KAAK,EA2BQ;GAChD,SAAS,CA1BsB;IAC/B,IAAI;IACJ,YAAY,iBACV,OAAO,iBAAiB,YACxB,OAAO,iBAAiB,YACxB,OAAO,iBAAiB,aACxB,CAAC;IACH,YAAY,cAAc,YACxBL,wCAAmB;KACjB,GAAGM;KACH,OAAO;KACP,UACE,2CAACH;MAAwB,GAAI;gBAC3B,2CAACI;OACC,GAAI;OACJ,iBAAiBD,QAAM;iBAEtB;QACwB;OACH;KAE7B,CAAC;IACL,CAI2B;GAC1B,eAAe,KAAK;GACpB,SAAS,EAAE;GACZ,CAAC;AAEF,SAAON,wCAAmB;GACxB,GAAG;GACH,OAAO;GACP,UACE,2CAACG;IAAwB,GAAI;cAC3B,2CAACK;KAAiB,GAAI;eAAO;MAAwB;KAC7B;GAE5B,iBAAiB,EACf,UAAU,eACX;GACF,CAAC;;CAEL;AAUD,MAAaC,iBAA0B;CACrC,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAAY,MAAM,aAAaC,yBAAS;CAC1D,YAAY,MAAuB,OAAO,sBAAsB;EAC9D,MAAMC,aAAwB,CAC5B,GAAG,MAAM,SACT,EACE,MAAMD,yBAAS,UAChB,CACF;EAED,MAAM,WAAW,KAAKA,yBAAS;AAE/B,SAAO,kBAAkB,UAAU;GACjC,GAAG;GACH;GACA,SAAS;GACT,SAAS,CAAC,sBAAsB,GAAI,MAAM,WAAW,EAAE,CAAE;GAC1D,CAAC;;CAEL"}
@@ -1,11 +1,11 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
2
  const require_server_serverContext = require('./serverContext.cjs');
3
3
  let react_jsx_runtime = require("react/jsx-runtime");
4
- let __intlayer_config_built = require("@intlayer/config/built");
5
- __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_built);
4
+ let _intlayer_config_built = require("@intlayer/config/built");
5
+ _intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
6
6
 
7
7
  //#region src/server/IntlayerServerProvider.tsx
8
- const { defaultLocale } = __intlayer_config_built.default?.internationalization ?? {};
8
+ const { defaultLocale } = _intlayer_config_built.default?.internationalization ?? {};
9
9
  /**
10
10
  * Context that store the current locale on the server side
11
11
  */
@@ -1 +1 @@
1
- {"version":3,"file":"IntlayerServerProvider.cjs","names":["configuration","createServerContext","getServerContext","IntlayerServerProvider: FC<IntlayerServerProviderProps>","locale"],"sources":["../../../src/server/IntlayerServerProvider.tsx"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\n\nimport type { FC, PropsWithChildren } from 'react';\nimport { createServerContext, getServerContext } from './serverContext';\n\nconst { defaultLocale } = configuration?.internationalization ?? {};\n\n/**\n * Context that store the current locale on the server side\n */\nexport const IntlayerServerContext =\n createServerContext<LocalesValues>(defaultLocale);\n\n/**\n * Hook that provides the current locale\n */\nexport const useIntlayer = () => getServerContext(IntlayerServerContext);\n\n/**\n * Get the current locale\n */\nexport const locale = getServerContext(IntlayerServerContext);\n\nexport type IntlayerServerProviderProps = PropsWithChildren & {\n locale?: LocalesValues;\n};\n\n/**\n * Provider that store the current locale on the server side\n */\nexport const IntlayerServerProvider: FC<IntlayerServerProviderProps> = ({\n children,\n locale = defaultLocale,\n}) => (\n <IntlayerServerContext.Provider value={locale}>\n {children}\n </IntlayerServerContext.Provider>\n);\n"],"mappings":";;;;;;;AAMA,MAAM,EAAE,kBAAkBA,iCAAe,wBAAwB,EAAE;;;;AAKnE,MAAa,wBACXC,iDAAmC,cAAc;;;;AAKnD,MAAa,oBAAoBC,8CAAiB,sBAAsB;;;;AAKxE,MAAa,SAASA,8CAAiB,sBAAsB;;;;AAS7D,MAAaC,0BAA2D,EACtE,UACA,mBAAS,oBAET,2CAAC,sBAAsB;CAAS,OAAOC;CACpC;EAC8B"}
1
+ {"version":3,"file":"IntlayerServerProvider.cjs","names":["configuration","createServerContext","getServerContext","IntlayerServerProvider: FC<IntlayerServerProviderProps>","locale"],"sources":["../../../src/server/IntlayerServerProvider.tsx"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\n\nimport type { FC, PropsWithChildren } from 'react';\nimport { createServerContext, getServerContext } from './serverContext';\n\nconst { defaultLocale } = configuration?.internationalization ?? {};\n\n/**\n * Context that store the current locale on the server side\n */\nexport const IntlayerServerContext =\n createServerContext<LocalesValues>(defaultLocale);\n\n/**\n * Hook that provides the current locale\n */\nexport const useIntlayer = () => getServerContext(IntlayerServerContext);\n\n/**\n * Get the current locale\n */\nexport const locale = getServerContext(IntlayerServerContext);\n\nexport type IntlayerServerProviderProps = PropsWithChildren & {\n locale?: LocalesValues;\n};\n\n/**\n * Provider that store the current locale on the server side\n */\nexport const IntlayerServerProvider: FC<IntlayerServerProviderProps> = ({\n children,\n locale = defaultLocale,\n}) => (\n <IntlayerServerContext.Provider value={locale}>\n {children}\n </IntlayerServerContext.Provider>\n);\n"],"mappings":";;;;;;;AAMA,MAAM,EAAE,kBAAkBA,gCAAe,wBAAwB,EAAE;;;;AAKnE,MAAa,wBACXC,iDAAmC,cAAc;;;;AAKnD,MAAa,oBAAoBC,8CAAiB,sBAAsB;;;;AAKxE,MAAa,SAASA,8CAAiB,sBAAsB;;;;AAS7D,MAAaC,0BAA2D,EACtE,UACA,mBAAS,oBAET,2CAAC,sBAAsB;CAAS,OAAOC;CACpC;EAC8B"}
@@ -1,7 +1,7 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_server_serverContext = require('../serverContext.cjs');
3
3
  const require_server_IntlayerServerProvider = require('../IntlayerServerProvider.cjs');
4
- let __intlayer_core = require("@intlayer/core");
4
+ let _intlayer_core = require("@intlayer/core");
5
5
 
6
6
  //#region src/server/format/useCompact.ts
7
7
  /**
@@ -16,7 +16,7 @@ let __intlayer_core = require("@intlayer/core");
16
16
  */
17
17
  const useCompact = () => {
18
18
  const locale = require_server_serverContext.getServerContext(require_server_IntlayerServerProvider.IntlayerServerContext);
19
- return (...args) => (0, __intlayer_core.compact)(args[0], {
19
+ return (...args) => (0, _intlayer_core.compact)(args[0], {
20
20
  ...args[1],
21
21
  locale: args[1]?.locale ?? locale
22
22
  });
@@ -1 +1 @@
1
- {"version":3,"file":"useCompact.cjs","names":["getServerContext","IntlayerServerContext"],"sources":["../../../../src/server/format/useCompact.ts"],"sourcesContent":["import { compact } from '@intlayer/core';\nimport type { LocalesValues } from '@intlayer/types';\nimport { IntlayerServerContext } from '../IntlayerServerProvider';\nimport { getServerContext } from '../serverContext';\n\n/**\n * React client hook that provides a compact number formatter\n * bound to the current application locale.\n *\n * @example\n * ```tsx\n * const formatCompact = useCompact();\n * formatCompact(1500); // \"1.5K\"\n * ```\n */\nexport const useCompact = () => {\n const locale = getServerContext<LocalesValues>(IntlayerServerContext);\n\n return (...args: Parameters<typeof compact>) =>\n compact(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAa,mBAAmB;CAC9B,MAAM,SAASA,8CAAgCC,4DAAsB;AAErE,SAAQ,GAAG,sCACD,KAAK,IAAI;EACf,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC"}
1
+ {"version":3,"file":"useCompact.cjs","names":["getServerContext","IntlayerServerContext"],"sources":["../../../../src/server/format/useCompact.ts"],"sourcesContent":["import { compact } from '@intlayer/core';\nimport type { LocalesValues } from '@intlayer/types';\nimport { IntlayerServerContext } from '../IntlayerServerProvider';\nimport { getServerContext } from '../serverContext';\n\n/**\n * React client hook that provides a compact number formatter\n * bound to the current application locale.\n *\n * @example\n * ```tsx\n * const formatCompact = useCompact();\n * formatCompact(1500); // \"1.5K\"\n * ```\n */\nexport const useCompact = () => {\n const locale = getServerContext<LocalesValues>(IntlayerServerContext);\n\n return (...args: Parameters<typeof compact>) =>\n compact(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAa,mBAAmB;CAC9B,MAAM,SAASA,8CAAgCC,4DAAsB;AAErE,SAAQ,GAAG,qCACD,KAAK,IAAI;EACf,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC"}
@@ -1,7 +1,7 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_server_serverContext = require('../serverContext.cjs');
3
3
  const require_server_IntlayerServerProvider = require('../IntlayerServerProvider.cjs');
4
- let __intlayer_core = require("@intlayer/core");
4
+ let _intlayer_core = require("@intlayer/core");
5
5
 
6
6
  //#region src/server/format/useCurrency.ts
7
7
  /**
@@ -27,7 +27,7 @@ let __intlayer_core = require("@intlayer/core");
27
27
  */
28
28
  const useCurrency = () => {
29
29
  const locale = require_server_serverContext.getServerContext(require_server_IntlayerServerProvider.IntlayerServerContext);
30
- return (...args) => (0, __intlayer_core.currency)(args[0], {
30
+ return (...args) => (0, _intlayer_core.currency)(args[0], {
31
31
  ...args[1],
32
32
  locale: args[1]?.locale ?? locale
33
33
  });
@@ -1 +1 @@
1
- {"version":3,"file":"useCurrency.cjs","names":["getServerContext","IntlayerServerContext"],"sources":["../../../../src/server/format/useCurrency.ts"],"sourcesContent":["import { currency } from '@intlayer/core';\nimport type { LocalesValues } from '@intlayer/types';\nimport { IntlayerServerContext } from '../IntlayerServerProvider';\nimport { getServerContext } from '../serverContext';\n\n/**\n * React client hook that provides a currency formatter\n * bound to the current application locale.\n *\n * @example\n * ```tsx\n * const formatCurrency = useCurrency();\n *\n * formatCurrency(1500, { currency: \"USD\" });\n * // \"$1,500.00\"\n *\n * formatCurrency(1500, { currency: \"EUR\", locale: \"de-DE\" });\n * // \"1.500,00 €\"\n *\n * formatCurrency(9876543.21, {\n * currency: \"JPY\",\n * fractionDigits: 0,\n * });\n * // \"¥9,876,543\"\n * ```\n */\nexport const useCurrency = () => {\n const locale = getServerContext<LocalesValues>(IntlayerServerContext);\n\n return (...args: Parameters<typeof currency>) =>\n currency(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,oBAAoB;CAC/B,MAAM,SAASA,8CAAgCC,4DAAsB;AAErE,SAAQ,GAAG,uCACA,KAAK,IAAI;EAChB,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC"}
1
+ {"version":3,"file":"useCurrency.cjs","names":["getServerContext","IntlayerServerContext"],"sources":["../../../../src/server/format/useCurrency.ts"],"sourcesContent":["import { currency } from '@intlayer/core';\nimport type { LocalesValues } from '@intlayer/types';\nimport { IntlayerServerContext } from '../IntlayerServerProvider';\nimport { getServerContext } from '../serverContext';\n\n/**\n * React client hook that provides a currency formatter\n * bound to the current application locale.\n *\n * @example\n * ```tsx\n * const formatCurrency = useCurrency();\n *\n * formatCurrency(1500, { currency: \"USD\" });\n * // \"$1,500.00\"\n *\n * formatCurrency(1500, { currency: \"EUR\", locale: \"de-DE\" });\n * // \"1.500,00 €\"\n *\n * formatCurrency(9876543.21, {\n * currency: \"JPY\",\n * fractionDigits: 0,\n * });\n * // \"¥9,876,543\"\n * ```\n */\nexport const useCurrency = () => {\n const locale = getServerContext<LocalesValues>(IntlayerServerContext);\n\n return (...args: Parameters<typeof currency>) =>\n currency(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,oBAAoB;CAC/B,MAAM,SAASA,8CAAgCC,4DAAsB;AAErE,SAAQ,GAAG,sCACA,KAAK,IAAI;EAChB,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC"}
@@ -1,7 +1,7 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_server_serverContext = require('../serverContext.cjs');
3
3
  const require_server_IntlayerServerProvider = require('../IntlayerServerProvider.cjs');
4
- let __intlayer_core = require("@intlayer/core");
4
+ let _intlayer_core = require("@intlayer/core");
5
5
 
6
6
  //#region src/server/format/useDate.ts
7
7
  /**
@@ -32,7 +32,7 @@ let __intlayer_core = require("@intlayer/core");
32
32
  */
33
33
  const useDate = () => {
34
34
  const locale = require_server_serverContext.getServerContext(require_server_IntlayerServerProvider.IntlayerServerContext);
35
- return (...args) => (0, __intlayer_core.date)(args[0], {
35
+ return (...args) => (0, _intlayer_core.date)(args[0], {
36
36
  ...args[1],
37
37
  locale: args[1]?.locale ?? locale
38
38
  });
@@ -1 +1 @@
1
- {"version":3,"file":"useDate.cjs","names":["getServerContext","IntlayerServerContext"],"sources":["../../../../src/server/format/useDate.ts"],"sourcesContent":["import { date } from '@intlayer/core';\nimport type { LocalesValues } from '@intlayer/types';\nimport { IntlayerServerContext } from '../IntlayerServerProvider';\nimport { getServerContext } from '../serverContext';\n\n/**\n * React client hook that provides a localized date/time formatter\n * bound to the current application locale.\n *\n * @returns {(date: Date | string | number, options?: DateProps) => string}\n * A function to format dates or timestamps into localized date/time strings.\n *\n * @example\n * ```tsx\n * const formatDate = useDate();\n *\n * formatDate(new Date(\"2025-01-01\"));\n * // \"Jan 1, 2025\"\n *\n * formatDate(\"2025-01-01T15:30:00Z\", {\n * dateStyle: \"full\",\n * timeStyle: \"short\",\n * });\n * // \"Wednesday, January 1, 2025 at 3:30 PM\"\n *\n * formatDate(1735689600000, { locale: \"fr-FR\", dateStyle: \"long\" });\n * // \"1 janvier 2025\"\n * ```\n *\n * @see createDate\n */\nexport const useDate = () => {\n const locale = getServerContext<LocalesValues>(IntlayerServerContext);\n\n return (...args: Parameters<typeof date>) =>\n date(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAa,gBAAgB;CAC3B,MAAM,SAASA,8CAAgCC,4DAAsB;AAErE,SAAQ,GAAG,mCACJ,KAAK,IAAI;EACZ,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC"}
1
+ {"version":3,"file":"useDate.cjs","names":["getServerContext","IntlayerServerContext"],"sources":["../../../../src/server/format/useDate.ts"],"sourcesContent":["import { date } from '@intlayer/core';\nimport type { LocalesValues } from '@intlayer/types';\nimport { IntlayerServerContext } from '../IntlayerServerProvider';\nimport { getServerContext } from '../serverContext';\n\n/**\n * React client hook that provides a localized date/time formatter\n * bound to the current application locale.\n *\n * @returns {(date: Date | string | number, options?: DateProps) => string}\n * A function to format dates or timestamps into localized date/time strings.\n *\n * @example\n * ```tsx\n * const formatDate = useDate();\n *\n * formatDate(new Date(\"2025-01-01\"));\n * // \"Jan 1, 2025\"\n *\n * formatDate(\"2025-01-01T15:30:00Z\", {\n * dateStyle: \"full\",\n * timeStyle: \"short\",\n * });\n * // \"Wednesday, January 1, 2025 at 3:30 PM\"\n *\n * formatDate(1735689600000, { locale: \"fr-FR\", dateStyle: \"long\" });\n * // \"1 janvier 2025\"\n * ```\n *\n * @see createDate\n */\nexport const useDate = () => {\n const locale = getServerContext<LocalesValues>(IntlayerServerContext);\n\n return (...args: Parameters<typeof date>) =>\n date(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAa,gBAAgB;CAC3B,MAAM,SAASA,8CAAgCC,4DAAsB;AAErE,SAAQ,GAAG,kCACJ,KAAK,IAAI;EACZ,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC"}
@@ -1,7 +1,7 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_server_serverContext = require('../serverContext.cjs');
3
3
  const require_server_IntlayerServerProvider = require('../IntlayerServerProvider.cjs');
4
- let __intlayer_core = require("@intlayer/core");
4
+ let _intlayer_core = require("@intlayer/core");
5
5
 
6
6
  //#region src/server/format/useList.ts
7
7
  /**
@@ -24,7 +24,7 @@ let __intlayer_core = require("@intlayer/core");
24
24
  */
25
25
  const useList = () => {
26
26
  const locale = require_server_serverContext.getServerContext(require_server_IntlayerServerProvider.IntlayerServerContext);
27
- return (...args) => (0, __intlayer_core.list)(args[0], {
27
+ return (...args) => (0, _intlayer_core.list)(args[0], {
28
28
  ...args[1],
29
29
  locale: args[1]?.locale ?? locale
30
30
  });
@@ -1 +1 @@
1
- {"version":3,"file":"useList.cjs","names":["getServerContext","IntlayerServerContext"],"sources":["../../../../src/server/format/useList.ts"],"sourcesContent":["import { list } from '@intlayer/core';\nimport type { LocalesValues } from '@intlayer/types';\nimport { IntlayerServerContext } from '../IntlayerServerProvider';\nimport { getServerContext } from '../serverContext';\n\n/**\n * React server hook that provides a list formatter\n * bound to the current application locale.\n *\n * @example\n * ```tsx\n * const formatList = useList();\n *\n * formatList(['apple', 'banana', 'orange']);\n * // \"apple, banana, and orange\"\n *\n * formatList(['red', 'green', 'blue'], { type: 'disjunction' });\n * // \"red, green, or blue\"\n *\n * formatList([1, 2, 3], { type: 'unit', locale: 'de-DE' });\n * // \"1, 2 und 3\"\n * ```\n */\nexport const useList = () => {\n const locale = getServerContext<LocalesValues>(IntlayerServerContext);\n\n return (...args: Parameters<typeof list>) =>\n list(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAa,gBAAgB;CAC3B,MAAM,SAASA,8CAAgCC,4DAAsB;AAErE,SAAQ,GAAG,mCACJ,KAAK,IAAI;EACZ,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC"}
1
+ {"version":3,"file":"useList.cjs","names":["getServerContext","IntlayerServerContext"],"sources":["../../../../src/server/format/useList.ts"],"sourcesContent":["import { list } from '@intlayer/core';\nimport type { LocalesValues } from '@intlayer/types';\nimport { IntlayerServerContext } from '../IntlayerServerProvider';\nimport { getServerContext } from '../serverContext';\n\n/**\n * React server hook that provides a list formatter\n * bound to the current application locale.\n *\n * @example\n * ```tsx\n * const formatList = useList();\n *\n * formatList(['apple', 'banana', 'orange']);\n * // \"apple, banana, and orange\"\n *\n * formatList(['red', 'green', 'blue'], { type: 'disjunction' });\n * // \"red, green, or blue\"\n *\n * formatList([1, 2, 3], { type: 'unit', locale: 'de-DE' });\n * // \"1, 2 und 3\"\n * ```\n */\nexport const useList = () => {\n const locale = getServerContext<LocalesValues>(IntlayerServerContext);\n\n return (...args: Parameters<typeof list>) =>\n list(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAa,gBAAgB;CAC3B,MAAM,SAASA,8CAAgCC,4DAAsB;AAErE,SAAQ,GAAG,kCACJ,KAAK,IAAI;EACZ,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC"}
@@ -1,7 +1,7 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_server_serverContext = require('../serverContext.cjs');
3
3
  const require_server_IntlayerServerProvider = require('../IntlayerServerProvider.cjs');
4
- let __intlayer_core = require("@intlayer/core");
4
+ let _intlayer_core = require("@intlayer/core");
5
5
 
6
6
  //#region src/server/format/useNumber.ts
7
7
  /**
@@ -28,7 +28,7 @@ let __intlayer_core = require("@intlayer/core");
28
28
  */
29
29
  const useNumber = () => {
30
30
  const locale = require_server_serverContext.getServerContext(require_server_IntlayerServerProvider.IntlayerServerContext);
31
- return (...args) => (0, __intlayer_core.number)(args[0], {
31
+ return (...args) => (0, _intlayer_core.number)(args[0], {
32
32
  ...args[1],
33
33
  locale: args[1]?.locale ?? locale
34
34
  });
@@ -1 +1 @@
1
- {"version":3,"file":"useNumber.cjs","names":["getServerContext","IntlayerServerContext"],"sources":["../../../../src/server/format/useNumber.ts"],"sourcesContent":["import { number } from '@intlayer/core';\nimport type { LocalesValues } from '@intlayer/types';\nimport { IntlayerServerContext } from '../IntlayerServerProvider';\nimport { getServerContext } from '../serverContext';\n\n/**\n * React client hook that provides a localized number formatter.\n *\n * Uses the current locale from {@link useLocaleBase} and returns\n * a function that can be used to format numbers consistently\n * according to the user's locale.\n *\n * @example\n * ```tsx\n * const formatNumber = useNumber();\n *\n * formatNumber(12345);\n * // e.g. \"12,345\" (en-US)\n * // e.g. \"12 345\" (fr-FR)\n *\n * formatNumber(0.75, { style: \"percent\" });\n * // e.g. \"75%\"\n * ```\n *\n * @returns {(value: string | number, options?: import(\"../createNumber\").NumberProps) => string}\n * A number formatting function bound to the active locale.\n */\nexport const useNumber = () => {\n const locale = getServerContext<LocalesValues>(IntlayerServerContext);\n\n return (...args: Parameters<typeof number>) =>\n number(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAa,kBAAkB;CAC7B,MAAM,SAASA,8CAAgCC,4DAAsB;AAErE,SAAQ,GAAG,qCACF,KAAK,IAAI;EACd,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC"}
1
+ {"version":3,"file":"useNumber.cjs","names":["getServerContext","IntlayerServerContext"],"sources":["../../../../src/server/format/useNumber.ts"],"sourcesContent":["import { number } from '@intlayer/core';\nimport type { LocalesValues } from '@intlayer/types';\nimport { IntlayerServerContext } from '../IntlayerServerProvider';\nimport { getServerContext } from '../serverContext';\n\n/**\n * React client hook that provides a localized number formatter.\n *\n * Uses the current locale from {@link useLocaleBase} and returns\n * a function that can be used to format numbers consistently\n * according to the user's locale.\n *\n * @example\n * ```tsx\n * const formatNumber = useNumber();\n *\n * formatNumber(12345);\n * // e.g. \"12,345\" (en-US)\n * // e.g. \"12 345\" (fr-FR)\n *\n * formatNumber(0.75, { style: \"percent\" });\n * // e.g. \"75%\"\n * ```\n *\n * @returns {(value: string | number, options?: import(\"../createNumber\").NumberProps) => string}\n * A number formatting function bound to the active locale.\n */\nexport const useNumber = () => {\n const locale = getServerContext<LocalesValues>(IntlayerServerContext);\n\n return (...args: Parameters<typeof number>) =>\n number(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAa,kBAAkB;CAC7B,MAAM,SAASA,8CAAgCC,4DAAsB;AAErE,SAAQ,GAAG,oCACF,KAAK,IAAI;EACd,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC"}
@@ -1,7 +1,7 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_server_serverContext = require('../serverContext.cjs');
3
3
  const require_server_IntlayerServerProvider = require('../IntlayerServerProvider.cjs');
4
- let __intlayer_core = require("@intlayer/core");
4
+ let _intlayer_core = require("@intlayer/core");
5
5
 
6
6
  //#region src/server/format/usePercentage.ts
7
7
  /**
@@ -24,7 +24,7 @@ let __intlayer_core = require("@intlayer/core");
24
24
  */
25
25
  const usePercentage = () => {
26
26
  const locale = require_server_serverContext.getServerContext(require_server_IntlayerServerProvider.IntlayerServerContext);
27
- return (...args) => (0, __intlayer_core.percentage)(args[0], {
27
+ return (...args) => (0, _intlayer_core.percentage)(args[0], {
28
28
  ...args[1],
29
29
  locale: args[1]?.locale ?? locale
30
30
  });
@@ -1 +1 @@
1
- {"version":3,"file":"usePercentage.cjs","names":["getServerContext","IntlayerServerContext"],"sources":["../../../../src/server/format/usePercentage.ts"],"sourcesContent":["import { percentage } from '@intlayer/core';\nimport type { LocalesValues } from '@intlayer/types';\nimport { IntlayerServerContext } from '../IntlayerServerProvider';\nimport { getServerContext } from '../serverContext';\n\n/**\n * React hook to provide a percentage formatter function\n * based on the current application locale.\n *\n * This hook retrieves the active locale using {@link useLocaleBase}\n * and memoizes a `createPercentage` instance for that locale.\n *\n * @example\n * ```tsx\n * const formatPercentage = usePercentage();\n *\n * const result = formatPercentage(0.875, { maximumFractionDigits: 1 });\n * // \"87.5%\" (depending on locale)\n * ```\n *\n * @returns {(value: string | number, options?: Omit<PercentageOptions, \"value\">) => string}\n * A function that formats numbers or numeric strings into localized percentages.\n */\nexport const usePercentage = () => {\n const locale = getServerContext<LocalesValues>(IntlayerServerContext);\n\n return (...args: Parameters<typeof percentage>) =>\n percentage(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAa,sBAAsB;CACjC,MAAM,SAASA,8CAAgCC,4DAAsB;AAErE,SAAQ,GAAG,yCACE,KAAK,IAAI;EAClB,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC"}
1
+ {"version":3,"file":"usePercentage.cjs","names":["getServerContext","IntlayerServerContext"],"sources":["../../../../src/server/format/usePercentage.ts"],"sourcesContent":["import { percentage } from '@intlayer/core';\nimport type { LocalesValues } from '@intlayer/types';\nimport { IntlayerServerContext } from '../IntlayerServerProvider';\nimport { getServerContext } from '../serverContext';\n\n/**\n * React hook to provide a percentage formatter function\n * based on the current application locale.\n *\n * This hook retrieves the active locale using {@link useLocaleBase}\n * and memoizes a `createPercentage` instance for that locale.\n *\n * @example\n * ```tsx\n * const formatPercentage = usePercentage();\n *\n * const result = formatPercentage(0.875, { maximumFractionDigits: 1 });\n * // \"87.5%\" (depending on locale)\n * ```\n *\n * @returns {(value: string | number, options?: Omit<PercentageOptions, \"value\">) => string}\n * A function that formats numbers or numeric strings into localized percentages.\n */\nexport const usePercentage = () => {\n const locale = getServerContext<LocalesValues>(IntlayerServerContext);\n\n return (...args: Parameters<typeof percentage>) =>\n percentage(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAa,sBAAsB;CACjC,MAAM,SAASA,8CAAgCC,4DAAsB;AAErE,SAAQ,GAAG,wCACE,KAAK,IAAI;EAClB,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC"}
@@ -1,7 +1,7 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_server_serverContext = require('../serverContext.cjs');
3
3
  const require_server_IntlayerServerProvider = require('../IntlayerServerProvider.cjs');
4
- let __intlayer_core = require("@intlayer/core");
4
+ let _intlayer_core = require("@intlayer/core");
5
5
 
6
6
  //#region src/server/format/useRelativeTime.ts
7
7
  /**
@@ -24,7 +24,7 @@ let __intlayer_core = require("@intlayer/core");
24
24
  */
25
25
  const useRelativeTime = () => {
26
26
  const locale = require_server_serverContext.getServerContext(require_server_IntlayerServerProvider.IntlayerServerContext);
27
- return (...args) => (0, __intlayer_core.relativeTime)(args[0], args[1] ?? /* @__PURE__ */ new Date(), {
27
+ return (...args) => (0, _intlayer_core.relativeTime)(args[0], args[1] ?? /* @__PURE__ */ new Date(), {
28
28
  ...args[2],
29
29
  locale: args[2]?.locale ?? locale
30
30
  });