react-intlayer 8.0.4 → 8.0.5

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 (154) hide show
  1. package/dist/cjs/IntlayerNode.cjs +2 -1
  2. package/dist/cjs/IntlayerNode.cjs.map +1 -1
  3. package/dist/cjs/UI/ContentSelector.cjs +2 -1
  4. package/dist/cjs/UI/ContentSelector.cjs.map +1 -1
  5. package/dist/cjs/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +1 -1
  6. package/dist/cjs/client/IntlayerProvider.cjs +3 -2
  7. package/dist/cjs/client/IntlayerProvider.cjs.map +1 -1
  8. package/dist/cjs/client/format/index.cjs +1 -0
  9. package/dist/cjs/client/format/useCompact.cjs +2 -1
  10. package/dist/cjs/client/format/useCompact.cjs.map +1 -1
  11. package/dist/cjs/client/format/useCurrency.cjs +2 -1
  12. package/dist/cjs/client/format/useCurrency.cjs.map +1 -1
  13. package/dist/cjs/client/format/useDate.cjs +2 -1
  14. package/dist/cjs/client/format/useDate.cjs.map +1 -1
  15. package/dist/cjs/client/format/useIntl.cjs +2 -1
  16. package/dist/cjs/client/format/useIntl.cjs.map +1 -1
  17. package/dist/cjs/client/format/useList.cjs +2 -1
  18. package/dist/cjs/client/format/useList.cjs.map +1 -1
  19. package/dist/cjs/client/format/useNumber.cjs +2 -1
  20. package/dist/cjs/client/format/useNumber.cjs.map +1 -1
  21. package/dist/cjs/client/format/usePercentage.cjs +2 -1
  22. package/dist/cjs/client/format/usePercentage.cjs.map +1 -1
  23. package/dist/cjs/client/format/useRelativeTime.cjs +2 -1
  24. package/dist/cjs/client/format/useRelativeTime.cjs.map +1 -1
  25. package/dist/cjs/client/format/useUnit.cjs +2 -1
  26. package/dist/cjs/client/format/useUnit.cjs.map +1 -1
  27. package/dist/cjs/client/index.cjs +1 -0
  28. package/dist/cjs/client/t.cjs +2 -1
  29. package/dist/cjs/client/t.cjs.map +1 -1
  30. package/dist/cjs/client/useDictionary.cjs +2 -1
  31. package/dist/cjs/client/useDictionary.cjs.map +1 -1
  32. package/dist/cjs/client/useDictionaryAsync.cjs +3 -2
  33. package/dist/cjs/client/useDictionaryAsync.cjs.map +1 -1
  34. package/dist/cjs/client/useDictionaryDynamic.cjs +3 -2
  35. package/dist/cjs/client/useDictionaryDynamic.cjs.map +1 -1
  36. package/dist/cjs/client/useI18n.cjs +2 -1
  37. package/dist/cjs/client/useI18n.cjs.map +1 -1
  38. package/dist/cjs/client/useIntlayer.cjs +2 -1
  39. package/dist/cjs/client/useIntlayer.cjs.map +1 -1
  40. package/dist/cjs/client/useLoadDynamic.cjs +1 -0
  41. package/dist/cjs/client/useLoadDynamic.cjs.map +1 -1
  42. package/dist/cjs/client/useLocale.cjs +3 -2
  43. package/dist/cjs/client/useLocale.cjs.map +1 -1
  44. package/dist/cjs/client/useLocaleBase.cjs +3 -2
  45. package/dist/cjs/client/useLocaleBase.cjs.map +1 -1
  46. package/dist/cjs/client/useLocaleStorage.cjs +2 -1
  47. package/dist/cjs/client/useLocaleStorage.cjs.map +1 -1
  48. package/dist/cjs/client/useRewriteURL.cjs +3 -2
  49. package/dist/cjs/client/useRewriteURL.cjs.map +1 -1
  50. package/dist/cjs/client/useTraduction.cjs +2 -1
  51. package/dist/cjs/client/useTraduction.cjs.map +1 -1
  52. package/dist/cjs/editor/ContentSelectorWrapper.cjs +2 -1
  53. package/dist/cjs/editor/ContentSelectorWrapper.cjs.map +1 -1
  54. package/dist/cjs/editor/IntlayerEditorProvider.cjs +3 -2
  55. package/dist/cjs/editor/IntlayerEditorProvider.cjs.map +1 -1
  56. package/dist/cjs/editor/index.cjs +1 -0
  57. package/dist/cjs/editor/useEditedContentRenderer.cjs +2 -1
  58. package/dist/cjs/editor/useEditedContentRenderer.cjs.map +1 -1
  59. package/dist/cjs/getDictionary.cjs +2 -1
  60. package/dist/cjs/getDictionary.cjs.map +1 -1
  61. package/dist/cjs/getIntlayer.cjs +2 -1
  62. package/dist/cjs/getIntlayer.cjs.map +1 -1
  63. package/dist/cjs/html/HTMLProvider.cjs +2 -1
  64. package/dist/cjs/html/HTMLProvider.cjs.map +1 -1
  65. package/dist/cjs/html/HTMLRenderer.cjs +2 -1
  66. package/dist/cjs/html/HTMLRenderer.cjs.map +1 -1
  67. package/dist/cjs/html/HTMLRendererPlugin.cjs +2 -1
  68. package/dist/cjs/html/HTMLRendererPlugin.cjs.map +1 -1
  69. package/dist/cjs/html/index.cjs +1 -0
  70. package/dist/cjs/index.cjs +1 -0
  71. package/dist/cjs/markdown/MarkdownProvider.cjs +2 -1
  72. package/dist/cjs/markdown/MarkdownProvider.cjs.map +1 -1
  73. package/dist/cjs/markdown/MarkdownRenderer.cjs +2 -1
  74. package/dist/cjs/markdown/MarkdownRenderer.cjs.map +1 -1
  75. package/dist/cjs/markdown/MarkdownRendererPlugin.cjs +2 -1
  76. package/dist/cjs/markdown/MarkdownRendererPlugin.cjs.map +1 -1
  77. package/dist/cjs/markdown/index.cjs +3 -2
  78. package/dist/cjs/markdown/processor.cjs +2 -1
  79. package/dist/cjs/markdown/processor.cjs.map +1 -1
  80. package/dist/cjs/markdown/runtime.cjs +3 -4
  81. package/dist/cjs/markdown/runtime.cjs.map +1 -1
  82. package/dist/cjs/plugins.cjs +2 -1
  83. package/dist/cjs/plugins.cjs.map +1 -1
  84. package/dist/cjs/reactElement/renderReactElement.cjs +2 -1
  85. package/dist/cjs/reactElement/renderReactElement.cjs.map +1 -1
  86. package/dist/cjs/server/IntlayerServerProvider.cjs +3 -2
  87. package/dist/cjs/server/IntlayerServerProvider.cjs.map +1 -1
  88. package/dist/cjs/server/format/index.cjs +1 -0
  89. package/dist/cjs/server/format/useCompact.cjs +2 -1
  90. package/dist/cjs/server/format/useCompact.cjs.map +1 -1
  91. package/dist/cjs/server/format/useCurrency.cjs +2 -1
  92. package/dist/cjs/server/format/useCurrency.cjs.map +1 -1
  93. package/dist/cjs/server/format/useDate.cjs +2 -1
  94. package/dist/cjs/server/format/useDate.cjs.map +1 -1
  95. package/dist/cjs/server/format/useIntl.cjs +3 -2
  96. package/dist/cjs/server/format/useIntl.cjs.map +1 -1
  97. package/dist/cjs/server/format/useList.cjs +2 -1
  98. package/dist/cjs/server/format/useList.cjs.map +1 -1
  99. package/dist/cjs/server/format/useNumber.cjs +2 -1
  100. package/dist/cjs/server/format/useNumber.cjs.map +1 -1
  101. package/dist/cjs/server/format/usePercentage.cjs +2 -1
  102. package/dist/cjs/server/format/usePercentage.cjs.map +1 -1
  103. package/dist/cjs/server/format/useRelativeTime.cjs +2 -1
  104. package/dist/cjs/server/format/useRelativeTime.cjs.map +1 -1
  105. package/dist/cjs/server/format/useUnit.cjs +2 -1
  106. package/dist/cjs/server/format/useUnit.cjs.map +1 -1
  107. package/dist/cjs/server/index.cjs +1 -0
  108. package/dist/cjs/server/serverContext.cjs +3 -2
  109. package/dist/cjs/server/serverContext.cjs.map +1 -1
  110. package/dist/cjs/server/t.cjs +2 -1
  111. package/dist/cjs/server/t.cjs.map +1 -1
  112. package/dist/cjs/server/useDictionary.cjs +1 -0
  113. package/dist/cjs/server/useDictionary.cjs.map +1 -1
  114. package/dist/cjs/server/useDictionaryAsync.cjs +3 -2
  115. package/dist/cjs/server/useDictionaryAsync.cjs.map +1 -1
  116. package/dist/cjs/server/useDictionaryDynamic.cjs +3 -2
  117. package/dist/cjs/server/useDictionaryDynamic.cjs.map +1 -1
  118. package/dist/cjs/server/useI18n.cjs +1 -0
  119. package/dist/cjs/server/useI18n.cjs.map +1 -1
  120. package/dist/cjs/server/useIntlayer.cjs +1 -0
  121. package/dist/cjs/server/useIntlayer.cjs.map +1 -1
  122. package/dist/cjs/server/useLoadDynamic.cjs +3 -2
  123. package/dist/cjs/server/useLoadDynamic.cjs.map +1 -1
  124. package/dist/cjs/server/useLocale.cjs +3 -2
  125. package/dist/cjs/server/useLocale.cjs.map +1 -1
  126. package/dist/esm/markdown/index.mjs +1 -1
  127. package/dist/esm/markdown/runtime.mjs +1 -2
  128. package/dist/esm/markdown/runtime.mjs.map +1 -1
  129. package/dist/types/client/IntlayerProvider.d.ts +2 -2
  130. package/dist/types/client/IntlayerProvider.d.ts.map +1 -1
  131. package/dist/types/client/format/useCompact.d.ts +2 -2
  132. package/dist/types/client/format/useCurrency.d.ts +2 -2
  133. package/dist/types/client/format/useCurrency.d.ts.map +1 -1
  134. package/dist/types/client/format/useList.d.ts +2 -2
  135. package/dist/types/client/format/useList.d.ts.map +1 -1
  136. package/dist/types/client/format/useNumber.d.ts +2 -2
  137. package/dist/types/client/format/useNumber.d.ts.map +1 -1
  138. package/dist/types/client/format/usePercentage.d.ts +2 -2
  139. package/dist/types/client/format/usePercentage.d.ts.map +1 -1
  140. package/dist/types/client/format/useRelativeTime.d.ts +2 -2
  141. package/dist/types/client/format/useRelativeTime.d.ts.map +1 -1
  142. package/dist/types/client/format/useUnit.d.ts +2 -2
  143. package/dist/types/client/format/useUnit.d.ts.map +1 -1
  144. package/dist/types/client/useIntlayer.d.ts +3 -3
  145. package/dist/types/client/useLocaleStorage.d.ts +5 -5
  146. package/dist/types/html/HTMLRenderer.d.ts +101 -101
  147. package/dist/types/markdown/MarkdownRenderer.d.ts +2 -2
  148. package/dist/types/markdown/MarkdownRenderer.d.ts.map +1 -1
  149. package/dist/types/server/IntlayerServerProvider.d.ts +2 -2
  150. package/dist/types/server/useDictionary.d.ts +2 -2
  151. package/dist/types/server/useDictionaryAsync.d.ts +2 -2
  152. package/dist/types/server/useDictionaryDynamic.d.ts +2 -2
  153. package/dist/types/server/useIntlayer.d.ts +3 -3
  154. package/package.json +11 -11
@@ -1,11 +1,12 @@
1
1
  'use client';
2
2
 
3
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
4
5
  const require_client_useLocale = require('./useLocale.cjs');
5
6
  let react = require("react");
6
7
  let _intlayer_core = require("@intlayer/core");
7
8
  let _intlayer_config_built = require("@intlayer/config/built");
8
- _intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
9
+ _intlayer_config_built = require_runtime.__toESM(_intlayer_config_built);
9
10
 
10
11
  //#region src/client/useRewriteURL.ts
11
12
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"useRewriteURL.cjs","names":["useLocale","configuration"],"sources":["../../../src/client/useRewriteURL.ts"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport { getRewritePath } from '@intlayer/core';\nimport { useEffect } from 'react';\nimport { useLocale } from './useLocale';\n\n/**\n * Client-side hook to manage URL rewrites without triggering a router navigation.\n * It uses `window.history.replaceState` to update the URL in the address bar.\n *\n * This hook is useful to \"prettify\" the URL when the user lands on a canonical path\n * that has a localized alias defined in `intlayer.config.ts`.\n *\n * @example\n * ```tsx\n * import { useRewriteURL } from 'react-intlayer';\n *\n * const MyComponent = () => {\n * useRewriteURL();\n *\n * return <div>My Component</div>;\n * };\n * ```\n */\nexport const useRewriteURL = (): void => {\n const { locale } = useLocale();\n const rewrite = configuration?.routing?.rewrite;\n\n useEffect(() => {\n if (typeof window === 'undefined' || !rewrite) return;\n\n const pathname = window.location.pathname;\n const targetPath = getRewritePath(pathname, locale, rewrite);\n\n if (targetPath && targetPath !== pathname) {\n window.history.replaceState(\n window.history.state,\n '',\n targetPath + window.location.search + window.location.hash\n );\n }\n }, [locale, rewrite]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAa,sBAA4B;CACvC,MAAM,EAAE,WAAWA,oCAAW;CAC9B,MAAM,UAAUC,gCAAe,SAAS;AAExC,4BAAgB;AACd,MAAI,OAAO,WAAW,eAAe,CAAC,QAAS;EAE/C,MAAM,WAAW,OAAO,SAAS;EACjC,MAAM,gDAA4B,UAAU,QAAQ,QAAQ;AAE5D,MAAI,cAAc,eAAe,SAC/B,QAAO,QAAQ,aACb,OAAO,QAAQ,OACf,IACA,aAAa,OAAO,SAAS,SAAS,OAAO,SAAS,KACvD;IAEF,CAAC,QAAQ,QAAQ,CAAC"}
1
+ {"version":3,"file":"useRewriteURL.cjs","names":["useLocale","configuration"],"sources":["../../../src/client/useRewriteURL.ts"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport { getRewritePath } from '@intlayer/core';\nimport { useEffect } from 'react';\nimport { useLocale } from './useLocale';\n\n/**\n * Client-side hook to manage URL rewrites without triggering a router navigation.\n * It uses `window.history.replaceState` to update the URL in the address bar.\n *\n * This hook is useful to \"prettify\" the URL when the user lands on a canonical path\n * that has a localized alias defined in `intlayer.config.ts`.\n *\n * @example\n * ```tsx\n * import { useRewriteURL } from 'react-intlayer';\n *\n * const MyComponent = () => {\n * useRewriteURL();\n *\n * return <div>My Component</div>;\n * };\n * ```\n */\nexport const useRewriteURL = (): void => {\n const { locale } = useLocale();\n const rewrite = configuration?.routing?.rewrite;\n\n useEffect(() => {\n if (typeof window === 'undefined' || !rewrite) return;\n\n const pathname = window.location.pathname;\n const targetPath = getRewritePath(pathname, locale, rewrite);\n\n if (targetPath && targetPath !== pathname) {\n window.history.replaceState(\n window.history.state,\n '',\n targetPath + window.location.search + window.location.hash\n );\n }\n }, [locale, rewrite]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAa,sBAA4B;CACvC,MAAM,EAAE,WAAWA,oCAAW;CAC9B,MAAM,UAAUC,gCAAe,SAAS;AAExC,4BAAgB;AACd,MAAI,OAAO,WAAW,eAAe,CAAC,QAAS;EAE/C,MAAM,WAAW,OAAO,SAAS;EACjC,MAAM,gDAA4B,UAAU,QAAQ,QAAQ;AAE5D,MAAI,cAAc,eAAe,SAC/B,QAAO,QAAQ,aACb,OAAO,QAAQ,OACf,IACA,aAAa,OAAO,SAAS,SAAS,OAAO,SAAS,KACvD;IAEF,CAAC,QAAQ,QAAQ,CAAC"}
@@ -1,4 +1,5 @@
1
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
3
  const require_client_IntlayerProvider = require('./IntlayerProvider.cjs');
3
4
  let react = require("react");
4
5
  let _intlayer_core = require("@intlayer/core");
@@ -1 +1 @@
1
- {"version":3,"file":"useTraduction.cjs","names":["IntlayerClientContext"],"sources":["../../../src/client/useTraduction.ts"],"sourcesContent":["import { getTranslation } from '@intlayer/core';\nimport type { StrictModeLocaleMap } from '@intlayer/types';\nimport { useContext, useMemo } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\n/**\n * On the client side, Hook that picking one dictionary by its id and return the content.\n *\n * If not locale found, it will return the content related to the default locale.\n *\n * Return either the content editor, or the content itself depending on the configuration.\n *\n * Usage:\n *\n * ```tsx\n * const content = useTranslation<string>({\n * en: 'Hello',\n * fr: 'Bonjour',\n * }, 'fr');\n * // 'Bonjour'\n * ```\n *\n * Using TypeScript:\n * - this function will require each locale to be defined if defined in the project configuration.\n * - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.\n */\nexport const useTranslation = <Content = string>(\n languageContent: StrictModeLocaleMap<Content>\n): Content => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useMemo(\n () => getTranslation(languageContent, locale),\n [languageContent, locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,kBACX,oBACY;CACZ,MAAM,EAAE,iCAAsBA,sDAAsB;AAEpD,oEACuB,iBAAiB,OAAO,EAC7C,CAAC,iBAAiB,OAAO,CAC1B"}
1
+ {"version":3,"file":"useTraduction.cjs","names":["IntlayerClientContext"],"sources":["../../../src/client/useTraduction.ts"],"sourcesContent":["import { getTranslation } from '@intlayer/core';\nimport type { StrictModeLocaleMap } from '@intlayer/types';\nimport { useContext, useMemo } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\n/**\n * On the client side, Hook that picking one dictionary by its id and return the content.\n *\n * If not locale found, it will return the content related to the default locale.\n *\n * Return either the content editor, or the content itself depending on the configuration.\n *\n * Usage:\n *\n * ```tsx\n * const content = useTranslation<string>({\n * en: 'Hello',\n * fr: 'Bonjour',\n * }, 'fr');\n * // 'Bonjour'\n * ```\n *\n * Using TypeScript:\n * - this function will require each locale to be defined if defined in the project configuration.\n * - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.\n */\nexport const useTranslation = <Content = string>(\n languageContent: StrictModeLocaleMap<Content>\n): Content => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useMemo(\n () => getTranslation(languageContent, locale),\n [languageContent, locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,kBACX,oBACY;CACZ,MAAM,EAAE,iCAAsBA,sDAAsB;AAEpD,oEACuB,iBAAiB,OAAO,EAC7C,CAAC,iBAAiB,OAAO,CAC1B"}
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
 
3
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
4
5
  const require_client_IntlayerProvider = require('../client/IntlayerProvider.cjs');
5
6
  const require_UI_ContentSelector = require('../UI/ContentSelector.cjs');
6
7
  let react = require("react");
@@ -1 +1 @@
1
- {"version":3,"file":"ContentSelectorWrapper.cjs","names":["NodeType","ContentSelector","MessageKey","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,MAAM,iCAAkE,EACtE,UACA,eACA,cACI;CACJ,MAAM,EAAE,gBAAgB,sEAA0C;CAClE,MAAM,EAAE,aAAa,0DAA8B;CAGnD,MAAM,2CACE,QAAQ,QAAQ,QAAQ,IAAI,SAASA,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,MAAa,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"}
1
+ {"version":3,"file":"ContentSelectorWrapper.cjs","names":["NodeType","ContentSelector","MessageKey","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,MAAM,iCAAkE,EACtE,UACA,eACA,cACI;CACJ,MAAM,EAAE,gBAAgB,sEAA0C;CAClE,MAAM,EAAE,aAAa,0DAA8B;CAGnD,MAAM,2CACE,QAAQ,QAAQ,QAAQ,IAAI,SAASA,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,MAAa,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"}
@@ -1,11 +1,12 @@
1
1
  'use client';
2
2
 
3
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
4
5
  let react = require("react");
5
6
  let react_jsx_runtime = require("react/jsx-runtime");
6
7
  let _intlayer_editor_react = require("@intlayer/editor-react");
7
8
  let _intlayer_config_built = require("@intlayer/config/built");
8
- _intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
9
+ _intlayer_config_built = require_runtime.__toESM(_intlayer_config_built);
9
10
 
10
11
  //#region src/editor/IntlayerEditorProvider.tsx
11
12
  const IntlayerEditorHooksEnabled = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"IntlayerEditorProvider.cjs","names":["configuration","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,MAAM,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,WAAWA,kCAAiB,EAAE;AAEtC,MAAM,2BAA+B;CACnC,MAAM,EAAE,0DAA8B;AAEtC,QAAO,UAAU,2CAAC,+BAA6B,GAAG,0EAAK;;AAGzD,MAAa,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,eAAeD;aAEf,2CAAC,uBAAqB,EACrB;GACc"}
1
+ {"version":3,"file":"IntlayerEditorProvider.cjs","names":["configuration","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,MAAM,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,WAAWA,kCAAiB,EAAE;AAEtC,MAAM,2BAA+B;CACnC,MAAM,EAAE,0DAA8B;AAEtC,QAAO,UAAU,2CAAC,+BAA6B,GAAG,0EAAK;;AAGzD,MAAa,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,eAAeD;aAEf,2CAAC,uBAAqB,EACrB;GACc"}
@@ -1,3 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1
2
  const require_editor_ContentSelectorWrapper = require('./ContentSelectorWrapper.cjs');
2
3
 
3
4
  exports.ContentSelectorRenderer = require_editor_ContentSelectorWrapper.ContentSelectorRenderer;
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
 
3
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
4
5
  const require_editor_ContentSelectorWrapper = require('./ContentSelectorWrapper.cjs');
5
6
  let react = require("react");
6
7
  let _intlayer_core = require("@intlayer/core");
@@ -1 +1 @@
1
- {"version":3,"file":"useEditedContentRenderer.cjs","names":["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,MAAa,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,yCAACA;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":["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,MAAa,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,yCAACA;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,4 +1,5 @@
1
- const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
3
  const require_plugins = require('./plugins.cjs');
3
4
  let _intlayer_core = require("@intlayer/core");
4
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"getDictionary.cjs","names":["intlayerNodePlugins","reactNodePlugins","insertionPlugin","markdownPlugin","htmlPlugin"],"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 htmlPlugin,\n insertionPlugin,\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 insertionPlugin,\n markdownPlugin,\n htmlPlugin,\n ...(additionalPlugins ?? []),\n ];\n\n return getDictionaryCore(dictionary, locale, plugins) as any;\n};\n"],"mappings":";;;;;AAkBA,MAAa,iBAIX,YACA,QACA,sBAC0C;AAU1C,0CAAyB,YAAY,QATV;EACzBA;EACAC;EACAC;EACAC;EACAC;EACA,GAAI,qBAAqB,EAAE;EAC5B,CAEoD"}
1
+ {"version":3,"file":"getDictionary.cjs","names":["intlayerNodePlugins","reactNodePlugins","insertionPlugin","markdownPlugin","htmlPlugin"],"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 htmlPlugin,\n insertionPlugin,\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 insertionPlugin,\n markdownPlugin,\n htmlPlugin,\n ...(additionalPlugins ?? []),\n ];\n\n return getDictionaryCore(dictionary, locale, plugins) as any;\n};\n"],"mappings":";;;;;;AAkBA,MAAa,iBAIX,YACA,QACA,sBAC0C;AAU1C,0CAAyB,YAAY,QATV;EACzBA;EACAC;EACAC;EACAC;EACAC;EACA,GAAI,qBAAqB,EAAE;EAC5B,CAEoD"}
@@ -1,4 +1,5 @@
1
- const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
3
  const require_plugins = require('./plugins.cjs');
3
4
  let _intlayer_core = require("@intlayer/core");
4
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"getIntlayer.cjs","names":["intlayerNodePlugins","reactNodePlugins","insertionPlugin","markdownPlugin","htmlPlugin"],"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 htmlPlugin,\n insertionPlugin,\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 insertionPlugin,\n markdownPlugin,\n htmlPlugin,\n ...(additionalPlugins ?? []),\n ];\n\n return getIntlayerCore(key, locale, plugins) as any;\n};\n"],"mappings":";;;;;AAgBA,MAAa,eAIX,KACA,QACA,sBAC0D;AAU1D,wCAAuB,KAAK,QATD;EACzBA;EACAC;EACAC;EACAC;EACAC;EACA,GAAI,qBAAqB,EAAE;EAC5B,CAE2C"}
1
+ {"version":3,"file":"getIntlayer.cjs","names":["intlayerNodePlugins","reactNodePlugins","insertionPlugin","markdownPlugin","htmlPlugin"],"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 htmlPlugin,\n insertionPlugin,\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 insertionPlugin,\n markdownPlugin,\n htmlPlugin,\n ...(additionalPlugins ?? []),\n ];\n\n return getIntlayerCore(key, locale, plugins) as any;\n};\n"],"mappings":";;;;;;AAgBA,MAAa,eAIX,KACA,QACA,sBAC0D;AAU1D,wCAAuB,KAAK,QATD;EACzBA;EACAC;EACAC;EACAC;EACAC;EACA,GAAI,qBAAqB,EAAE;EAC5B,CAE2C"}
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
 
3
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
4
5
  let react = require("react");
5
6
  let react_jsx_runtime = require("react/jsx-runtime");
6
7
 
@@ -1 +1 @@
1
- {"version":3,"file":"HTMLProvider.cjs","names":[],"sources":["../../../src/html/HTMLProvider.tsx"],"sourcesContent":["'use client';\n\nimport {\n createContext,\n type FC,\n type PropsWithChildren,\n useContext,\n} from 'react';\nimport type { HTMLComponents } from './HTMLComponentTypes';\n\ntype HTMLContextValue = {\n components?: HTMLComponents<'permissive', {}>;\n};\n\ntype HTMLProviderProps = PropsWithChildren<{\n /**\n * Component overrides for HTML tags.\n */\n components?: HTMLComponents<'permissive', {}>;\n}>;\n\nconst HTMLContext = createContext<HTMLContextValue | undefined>(undefined);\n\nexport const useHTMLContext = () => useContext(HTMLContext);\n\nexport const HTMLProvider: FC<HTMLProviderProps> = ({\n children,\n components,\n}) => (\n <HTMLContext.Provider value={{ components }}>{children}</HTMLContext.Provider>\n);\n"],"mappings":";;;;;;;AAqBA,MAAM,uCAA0D,OAAU;AAE1E,MAAa,6CAAkC,YAAY;AAE3D,MAAa,gBAAuC,EAClD,UACA,iBAEA,2CAAC,YAAY;CAAS,OAAO,EAAE,YAAY;CAAG;EAAgC"}
1
+ {"version":3,"file":"HTMLProvider.cjs","names":[],"sources":["../../../src/html/HTMLProvider.tsx"],"sourcesContent":["'use client';\n\nimport {\n createContext,\n type FC,\n type PropsWithChildren,\n useContext,\n} from 'react';\nimport type { HTMLComponents } from './HTMLComponentTypes';\n\ntype HTMLContextValue = {\n components?: HTMLComponents<'permissive', {}>;\n};\n\ntype HTMLProviderProps = PropsWithChildren<{\n /**\n * Component overrides for HTML tags.\n */\n components?: HTMLComponents<'permissive', {}>;\n}>;\n\nconst HTMLContext = createContext<HTMLContextValue | undefined>(undefined);\n\nexport const useHTMLContext = () => useContext(HTMLContext);\n\nexport const HTMLProvider: FC<HTMLProviderProps> = ({\n children,\n components,\n}) => (\n <HTMLContext.Provider value={{ components }}>{children}</HTMLContext.Provider>\n);\n"],"mappings":";;;;;;;;AAqBA,MAAM,uCAA0D,OAAU;AAE1E,MAAa,6CAAkC,YAAY;AAE3D,MAAa,gBAAuC,EAClD,UACA,iBAEA,2CAAC,YAAY;CAAS,OAAO,EAAE,YAAY;CAAG;EAAgC"}
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
 
3
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
4
5
  const require_html_HTMLProvider = require('./HTMLProvider.cjs');
5
6
  let react = require("react");
6
7
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -1 +1 @@
1
- {"version":3,"file":"HTMLRenderer.cjs","names":["HTML_TAGS","Fragment","useHTMLContext"],"sources":["../../../src/html/HTMLRenderer.tsx"],"sourcesContent":["'use client';\n\nimport { getHTML, HTML_TAGS } from '@intlayer/core';\nimport { createElement, type FC, Fragment, type JSX } from 'react';\nimport type { HTMLComponents } from './HTMLComponentTypes';\nimport { useHTMLContext } from './HTMLProvider';\n\nconst createDefaultHTMLComponents = (): HTMLComponents<'permissive', {}> => {\n const components: HTMLComponents = {};\n\n for (const tag of HTML_TAGS) {\n components[tag] = ({ children, ...props }) =>\n createElement(tag, props as any, children);\n }\n\n return components as HTMLComponents<'permissive', {}>;\n};\n\nexport const defaultHTMLComponents = createDefaultHTMLComponents();\n\nexport type RenderHTMLProps = {\n /**\n * Component overrides for HTML tags.\n * Allows you to customize how specific HTML elements are rendered.\n */\n components?: HTMLComponents<'permissive', {}>;\n};\n\n/**\n * Renders HTML-like content to JSX with the provided components.\n *\n * This function does not use context from HTMLProvider. Use `useHTMLRenderer`\n * hook if you want to leverage provider context.\n */\nexport const renderHTML = (\n content: string,\n { components }: RenderHTMLProps = {}\n): JSX.Element => {\n const mergedComponents = {\n ...defaultHTMLComponents,\n ...components,\n };\n\n // Wrap all components to ensure they are rendered via React.createElement\n const wrappedComponents = Object.fromEntries(\n Object.entries(mergedComponents)\n .filter(([, Component]) => Component)\n .map(([key, Component]) => [\n key,\n (props: any) => createElement(Component as any, props),\n ])\n );\n\n return <Fragment>{getHTML(content, wrappedComponents)}</Fragment>;\n};\n\n/**\n * Hook that returns a function to render HTML content.\n *\n * This hook considers the configuration from the `HTMLProvider` context if available,\n * falling back to the provided components.\n */\nexport const useHTMLRenderer = ({ components }: RenderHTMLProps = {}) => {\n const context = useHTMLContext();\n\n return (content: string) => {\n return renderHTML(content, {\n components: {\n ...context?.components,\n ...components,\n },\n });\n };\n};\n\nexport type HTMLRendererProps = RenderHTMLProps & {\n /**\n * The HTML content to render as a string.\n */\n children: string;\n};\n\n/**\n * React component that renders HTML-like content to JSX.\n *\n * This component uses the components from the `HTMLProvider` context\n * if available.\n */\nexport const HTMLRenderer: FC<HTMLRendererProps> = ({\n children = '',\n components,\n}) => {\n const render = useHTMLRenderer({ components });\n\n return render(children);\n};\n"],"mappings":";;;;;;;;;AAOA,MAAM,oCAAsE;CAC1E,MAAM,aAA6B,EAAE;AAErC,MAAK,MAAM,OAAOA,yBAChB,YAAW,QAAQ,EAAE,UAAU,GAAG,qCAClB,KAAK,OAAc,SAAS;AAG9C,QAAO;;AAGT,MAAa,wBAAwB,6BAA6B;;;;;;;AAgBlE,MAAa,cACX,SACA,EAAE,eAAgC,EAAE,KACpB;CAChB,MAAM,mBAAmB;EACvB,GAAG;EACH,GAAG;EACJ;AAYD,QAAO,2CAACC,wDAAkB,SATA,OAAO,YAC/B,OAAO,QAAQ,iBAAiB,CAC7B,QAAQ,GAAG,eAAe,UAAU,CACpC,KAAK,CAAC,KAAK,eAAe,CACzB,MACC,mCAA6B,WAAkB,MAAM,CACvD,CAAC,CACL,CAEoD,GAAY;;;;;;;;AASnE,MAAa,mBAAmB,EAAE,eAAgC,EAAE,KAAK;CACvE,MAAM,UAAUC,0CAAgB;AAEhC,SAAQ,YAAoB;AAC1B,SAAO,WAAW,SAAS,EACzB,YAAY;GACV,GAAG,SAAS;GACZ,GAAG;GACJ,EACF,CAAC;;;;;;;;;AAiBN,MAAa,gBAAuC,EAClD,WAAW,IACX,iBACI;AAGJ,QAFe,gBAAgB,EAAE,YAAY,CAAC,CAEhC,SAAS"}
1
+ {"version":3,"file":"HTMLRenderer.cjs","names":["HTML_TAGS","Fragment","useHTMLContext"],"sources":["../../../src/html/HTMLRenderer.tsx"],"sourcesContent":["'use client';\n\nimport { getHTML, HTML_TAGS } from '@intlayer/core';\nimport { createElement, type FC, Fragment, type JSX } from 'react';\nimport type { HTMLComponents } from './HTMLComponentTypes';\nimport { useHTMLContext } from './HTMLProvider';\n\nconst createDefaultHTMLComponents = (): HTMLComponents<'permissive', {}> => {\n const components: HTMLComponents = {};\n\n for (const tag of HTML_TAGS) {\n components[tag] = ({ children, ...props }) =>\n createElement(tag, props as any, children);\n }\n\n return components as HTMLComponents<'permissive', {}>;\n};\n\nexport const defaultHTMLComponents = createDefaultHTMLComponents();\n\nexport type RenderHTMLProps = {\n /**\n * Component overrides for HTML tags.\n * Allows you to customize how specific HTML elements are rendered.\n */\n components?: HTMLComponents<'permissive', {}>;\n};\n\n/**\n * Renders HTML-like content to JSX with the provided components.\n *\n * This function does not use context from HTMLProvider. Use `useHTMLRenderer`\n * hook if you want to leverage provider context.\n */\nexport const renderHTML = (\n content: string,\n { components }: RenderHTMLProps = {}\n): JSX.Element => {\n const mergedComponents = {\n ...defaultHTMLComponents,\n ...components,\n };\n\n // Wrap all components to ensure they are rendered via React.createElement\n const wrappedComponents = Object.fromEntries(\n Object.entries(mergedComponents)\n .filter(([, Component]) => Component)\n .map(([key, Component]) => [\n key,\n (props: any) => createElement(Component as any, props),\n ])\n );\n\n return <Fragment>{getHTML(content, wrappedComponents)}</Fragment>;\n};\n\n/**\n * Hook that returns a function to render HTML content.\n *\n * This hook considers the configuration from the `HTMLProvider` context if available,\n * falling back to the provided components.\n */\nexport const useHTMLRenderer = ({ components }: RenderHTMLProps = {}) => {\n const context = useHTMLContext();\n\n return (content: string) => {\n return renderHTML(content, {\n components: {\n ...context?.components,\n ...components,\n },\n });\n };\n};\n\nexport type HTMLRendererProps = RenderHTMLProps & {\n /**\n * The HTML content to render as a string.\n */\n children: string;\n};\n\n/**\n * React component that renders HTML-like content to JSX.\n *\n * This component uses the components from the `HTMLProvider` context\n * if available.\n */\nexport const HTMLRenderer: FC<HTMLRendererProps> = ({\n children = '',\n components,\n}) => {\n const render = useHTMLRenderer({ components });\n\n return render(children);\n};\n"],"mappings":";;;;;;;;;;AAOA,MAAM,oCAAsE;CAC1E,MAAM,aAA6B,EAAE;AAErC,MAAK,MAAM,OAAOA,yBAChB,YAAW,QAAQ,EAAE,UAAU,GAAG,qCAClB,KAAK,OAAc,SAAS;AAG9C,QAAO;;AAGT,MAAa,wBAAwB,6BAA6B;;;;;;;AAgBlE,MAAa,cACX,SACA,EAAE,eAAgC,EAAE,KACpB;CAChB,MAAM,mBAAmB;EACvB,GAAG;EACH,GAAG;EACJ;AAYD,QAAO,2CAACC,wDAAkB,SATA,OAAO,YAC/B,OAAO,QAAQ,iBAAiB,CAC7B,QAAQ,GAAG,eAAe,UAAU,CACpC,KAAK,CAAC,KAAK,eAAe,CACzB,MACC,mCAA6B,WAAkB,MAAM,CACvD,CAAC,CACL,CAEoD,GAAY;;;;;;;;AASnE,MAAa,mBAAmB,EAAE,eAAgC,EAAE,KAAK;CACvE,MAAM,UAAUC,0CAAgB;AAEhC,SAAQ,YAAoB;AAC1B,SAAO,WAAW,SAAS,EACzB,YAAY;GACV,GAAG,SAAS;GACZ,GAAG;GACJ,EACF,CAAC;;;;;;;;;AAiBN,MAAa,gBAAuC,EAClD,WAAW,IACX,iBACI;AAGJ,QAFe,gBAAgB,EAAE,YAAY,CAAC,CAEhC,SAAS"}
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
 
3
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
4
5
  const require_editor_ContentSelectorWrapper = require('../editor/ContentSelectorWrapper.cjs');
5
6
  const require_editor_useEditedContentRenderer = require('../editor/useEditedContentRenderer.cjs');
6
7
  const require_html_HTMLProvider = require('./HTMLProvider.cjs');
@@ -1 +1 @@
1
- {"version":3,"file":"HTMLRendererPlugin.cjs","names":["useHTMLContext","useEditedContentRenderer","defaultHTMLComponents","ContentSelectorRenderer"],"sources":["../../../src/html/HTMLRendererPlugin.tsx"],"sourcesContent":["'use client';\n\nimport { getHTML } from '@intlayer/core';\nimport type { KeyPath, Locale } from '@intlayer/types';\nimport { createElement, type FC, type ReactNode } from 'react';\nimport { ContentSelectorRenderer } from '../editor';\nimport { useEditedContentRenderer } from '../editor/useEditedContentRenderer';\nimport { useHTMLContext } from './HTMLProvider';\nimport { defaultHTMLComponents } from './HTMLRenderer';\nimport type { ReactComponentProps } from './types';\n\ntype HTMLRendererPluginProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n html: string;\n locale?: Locale;\n userComponents?: Record<string, any>;\n};\n\nexport const HTMLRendererPlugin: FC<HTMLRendererPluginProps> = (\n props\n): ReactNode => {\n const { dictionaryKey, keyPath, html, userComponents } = props;\n const context = useHTMLContext();\n const globalComponents = context?.components || {};\n\n const editedContentContext = useEditedContentRenderer({\n dictionaryKey: dictionaryKey ?? '',\n keyPath: keyPath ?? [],\n children: html,\n });\n\n const contentToRender =\n typeof editedContentContext === 'string' ? editedContentContext : html;\n\n const mergedComponents = {\n ...defaultHTMLComponents,\n ...globalComponents,\n ...userComponents,\n };\n\n // Wrap all components to ensure they are rendered via React.createElement\n // This is important because it allows React to handle the component's lifecycle,\n // hooks, and Babel-injected variables correctly.\n const wrappedComponents = Object.fromEntries(\n Object.entries(mergedComponents)\n .filter(([, Component]) => Component)\n .map(([key, Component]) => [\n key,\n (props: ReactComponentProps) => createElement(Component, props),\n ])\n );\n\n return (\n <ContentSelectorRenderer {...props}>\n {getHTML(contentToRender, wrappedComponents)}\n </ContentSelectorRenderer>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAmBA,MAAa,sBACX,UACc;CACd,MAAM,EAAE,eAAe,SAAS,MAAM,mBAAmB;CAEzD,MAAM,mBADUA,0CAAgB,EACE,cAAc,EAAE;CAElD,MAAM,uBAAuBC,iEAAyB;EACpD,eAAe,iBAAiB;EAChC,SAAS,WAAW,EAAE;EACtB,UAAU;EACX,CAAC;CAEF,MAAM,kBACJ,OAAO,yBAAyB,WAAW,uBAAuB;CAEpE,MAAM,mBAAmB;EACvB,GAAGC;EACH,GAAG;EACH,GAAG;EACJ;CAKD,MAAM,oBAAoB,OAAO,YAC/B,OAAO,QAAQ,iBAAiB,CAC7B,QAAQ,GAAG,eAAe,UAAU,CACpC,KAAK,CAAC,KAAK,eAAe,CACzB,MACC,mCAA6C,WAAW,MAAM,CAChE,CAAC,CACL;AAED,QACE,2CAACC;EAAwB,GAAI;wCAClB,iBAAiB,kBAAkB;GACpB"}
1
+ {"version":3,"file":"HTMLRendererPlugin.cjs","names":["useHTMLContext","useEditedContentRenderer","defaultHTMLComponents","ContentSelectorRenderer"],"sources":["../../../src/html/HTMLRendererPlugin.tsx"],"sourcesContent":["'use client';\n\nimport { getHTML } from '@intlayer/core';\nimport type { KeyPath, Locale } from '@intlayer/types';\nimport { createElement, type FC, type ReactNode } from 'react';\nimport { ContentSelectorRenderer } from '../editor';\nimport { useEditedContentRenderer } from '../editor/useEditedContentRenderer';\nimport { useHTMLContext } from './HTMLProvider';\nimport { defaultHTMLComponents } from './HTMLRenderer';\nimport type { ReactComponentProps } from './types';\n\ntype HTMLRendererPluginProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n html: string;\n locale?: Locale;\n userComponents?: Record<string, any>;\n};\n\nexport const HTMLRendererPlugin: FC<HTMLRendererPluginProps> = (\n props\n): ReactNode => {\n const { dictionaryKey, keyPath, html, userComponents } = props;\n const context = useHTMLContext();\n const globalComponents = context?.components || {};\n\n const editedContentContext = useEditedContentRenderer({\n dictionaryKey: dictionaryKey ?? '',\n keyPath: keyPath ?? [],\n children: html,\n });\n\n const contentToRender =\n typeof editedContentContext === 'string' ? editedContentContext : html;\n\n const mergedComponents = {\n ...defaultHTMLComponents,\n ...globalComponents,\n ...userComponents,\n };\n\n // Wrap all components to ensure they are rendered via React.createElement\n // This is important because it allows React to handle the component's lifecycle,\n // hooks, and Babel-injected variables correctly.\n const wrappedComponents = Object.fromEntries(\n Object.entries(mergedComponents)\n .filter(([, Component]) => Component)\n .map(([key, Component]) => [\n key,\n (props: ReactComponentProps) => createElement(Component, props),\n ])\n );\n\n return (\n <ContentSelectorRenderer {...props}>\n {getHTML(contentToRender, wrappedComponents)}\n </ContentSelectorRenderer>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAmBA,MAAa,sBACX,UACc;CACd,MAAM,EAAE,eAAe,SAAS,MAAM,mBAAmB;CAEzD,MAAM,mBADUA,0CAAgB,EACE,cAAc,EAAE;CAElD,MAAM,uBAAuBC,iEAAyB;EACpD,eAAe,iBAAiB;EAChC,SAAS,WAAW,EAAE;EACtB,UAAU;EACX,CAAC;CAEF,MAAM,kBACJ,OAAO,yBAAyB,WAAW,uBAAuB;CAEpE,MAAM,mBAAmB;EACvB,GAAGC;EACH,GAAG;EACH,GAAG;EACJ;CAKD,MAAM,oBAAoB,OAAO,YAC/B,OAAO,QAAQ,iBAAiB,CAC7B,QAAQ,GAAG,eAAe,UAAU,CACpC,KAAK,CAAC,KAAK,eAAe,CACzB,MACC,mCAA6C,WAAW,MAAM,CAChE,CAAC,CACL;AAED,QACE,2CAACC;EAAwB,GAAI;wCAClB,iBAAiB,kBAAkB;GACpB"}
@@ -1,3 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1
2
  const require_html_HTMLProvider = require('./HTMLProvider.cjs');
2
3
  const require_html_HTMLRenderer = require('./HTMLRenderer.cjs');
3
4
  const require_html_HTMLRendererPlugin = require('./HTMLRendererPlugin.cjs');
@@ -1,3 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1
2
  const require_client_useLocaleStorage = require('./client/useLocaleStorage.cjs');
2
3
  const require_client_IntlayerProvider = require('./client/IntlayerProvider.cjs');
3
4
  const require_client_t = require('./client/t.cjs');
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
 
3
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
4
5
  const require_markdown_processor = require('./processor.cjs');
5
6
  let react = require("react");
6
7
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownProvider.cjs","names":["compiler"],"sources":["../../../src/markdown/MarkdownProvider.tsx"],"sourcesContent":["'use client';\n\nimport {\n createContext,\n type FC,\n type HTMLAttributes,\n type PropsWithChildren,\n type ReactNode,\n useContext,\n} from 'react';\nimport type { HTMLComponents } from '../html/HTMLComponentTypes';\nimport { compiler, type MarkdownRendererOptions } from './processor';\n\nexport type MarkdownProviderOptions = {\n /** Forces the compiler to always output content with a block-level wrapper. */\n forceBlock?: boolean;\n /** Forces the compiler to always output content with an inline wrapper. */\n forceInline?: boolean;\n /** Whether to preserve frontmatter in the markdown content. */\n preserveFrontmatter?: boolean;\n /** Whether to use the GitHub Tag Filter for security. */\n tagfilter?: boolean;\n};\n\ntype MarkdownContextValue = {\n renderMarkdown: (\n markdown: string,\n options?: MarkdownProviderOptions,\n components?: HTMLComponents<'permissive', {}>,\n wrapper?: FC<HTMLAttributes<HTMLElement>>\n ) => ReactNode;\n};\n\ntype MarkdownProviderProps = PropsWithChildren<\n MarkdownProviderOptions & {\n components?: HTMLComponents<'permissive', {}>;\n wrapper?: FC<HTMLAttributes<HTMLElement>>;\n renderMarkdown?: (\n markdown: string,\n options?: MarkdownProviderOptions,\n components?: HTMLComponents<'permissive', {}>,\n wrapper?: FC<HTMLAttributes<HTMLElement>>\n ) => ReactNode;\n }\n>;\n\nconst MarkdownContext = createContext<MarkdownContextValue | undefined>(\n undefined\n);\n\nexport const useMarkdownContext = () => useContext(MarkdownContext);\n\nconst mergeOptions = (\n baseOptions: MarkdownRendererOptions,\n options: MarkdownProviderOptions = {},\n components: HTMLComponents<'permissive', {}> = {},\n wrapper?: FC<HTMLAttributes<HTMLElement>>\n): MarkdownRendererOptions => {\n return {\n ...baseOptions,\n ...options,\n forceBlock: options.forceBlock ?? baseOptions.forceBlock,\n forceInline: options.forceInline ?? baseOptions.forceInline,\n preserveFrontmatter:\n options.preserveFrontmatter ?? baseOptions.preserveFrontmatter,\n tagfilter: options.tagfilter ?? baseOptions.tagfilter,\n wrapper: wrapper || baseOptions.wrapper,\n\n forceWrapper: !!(wrapper || baseOptions.wrapper),\n components: { ...baseOptions.components, ...components },\n };\n};\n\n/**\n * Provider for the MarkdownRenderer component.\n *\n * It will provide the `renderMarkdown` function to the context, which can be used to render markdown.\n *\n * ```tsx\n * const content = useIntlayer('app');\n *\n * return (\n * <div>\n * {content.markdown} // Will be rendered with the components and options provided to the MarkdownProvider\n * </div>\n * );\n * ```\n *\n * @example\n * ```tsx\n * <MarkdownProvider components={{ h1: CustomHeading }}>\n * <MarkdownRenderer>\n * {markdownContent}\n * </MarkdownRenderer>\n * </MarkdownProvider>\n * ```\n */\nexport const MarkdownProvider: FC<MarkdownProviderProps> = ({\n children,\n components,\n wrapper,\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n renderMarkdown: customRenderFn,\n}) => {\n const baseOptions: MarkdownRendererOptions = {\n components,\n forceBlock,\n forceInline,\n wrapper,\n forceWrapper: !!wrapper,\n preserveFrontmatter,\n tagfilter,\n };\n\n // Standard internal renderer\n const defaultRenderMarkdown = (\n markdown: string,\n options?: MarkdownProviderOptions,\n components?: HTMLComponents<'permissive', {}>,\n wrapper?: FC<HTMLAttributes<HTMLElement>>\n ) => {\n const mergedOptions = mergeOptions(\n baseOptions,\n options,\n components,\n wrapper\n );\n\n return compiler(markdown, mergedOptions);\n };\n\n // Wrapper for user-provided custom renderer\n // Note: We wrap in a clean Provider to prevent infinite recursion\n const customRenderMarkdownWrapper = (\n markdown: string,\n options?: MarkdownProviderOptions,\n components?: HTMLComponents<'permissive', {}>,\n wrapper?: FC<HTMLAttributes<HTMLElement>>\n ) => (\n <MarkdownContext.Provider value={undefined}>\n {customRenderFn?.(markdown, options, components, wrapper)}\n </MarkdownContext.Provider>\n );\n\n return (\n <MarkdownContext.Provider\n value={{\n renderMarkdown: customRenderFn\n ? customRenderMarkdownWrapper\n : defaultRenderMarkdown,\n }}\n >\n {children}\n </MarkdownContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;AA8CA,MAAM,2CACJ,OACD;AAED,MAAa,iDAAsC,gBAAgB;AAEnE,MAAM,gBACJ,aACA,UAAmC,EAAE,EACrC,aAA+C,EAAE,EACjD,YAC4B;AAC5B,QAAO;EACL,GAAG;EACH,GAAG;EACH,YAAY,QAAQ,cAAc,YAAY;EAC9C,aAAa,QAAQ,eAAe,YAAY;EAChD,qBACE,QAAQ,uBAAuB,YAAY;EAC7C,WAAW,QAAQ,aAAa,YAAY;EAC5C,SAAS,WAAW,YAAY;EAEhC,cAAc,CAAC,EAAE,WAAW,YAAY;EACxC,YAAY;GAAE,GAAG,YAAY;GAAY,GAAG;GAAY;EACzD;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BH,MAAa,oBAA+C,EAC1D,UACA,YACA,SACA,YACA,aACA,qBACA,WACA,gBAAgB,qBACZ;CACJ,MAAM,cAAuC;EAC3C;EACA;EACA;EACA;EACA,cAAc,CAAC,CAAC;EAChB;EACA;EACD;CAGD,MAAM,yBACJ,UACA,SACA,YACA,YACG;AAQH,SAAOA,oCAAS,UAPM,aACpB,aACA,SACA,YACA,QACD,CAEuC;;CAK1C,MAAM,+BACJ,UACA,SACA,YACA,YAEA,2CAAC,gBAAgB;EAAS,OAAO;YAC9B,iBAAiB,UAAU,SAAS,YAAY,QAAQ;GAChC;AAG7B,QACE,2CAAC,gBAAgB;EACf,OAAO,EACL,gBAAgB,iBACZ,8BACA,uBACL;EAEA;GACwB"}
1
+ {"version":3,"file":"MarkdownProvider.cjs","names":["compiler"],"sources":["../../../src/markdown/MarkdownProvider.tsx"],"sourcesContent":["'use client';\n\nimport {\n createContext,\n type FC,\n type HTMLAttributes,\n type PropsWithChildren,\n type ReactNode,\n useContext,\n} from 'react';\nimport type { HTMLComponents } from '../html/HTMLComponentTypes';\nimport { compiler, type MarkdownRendererOptions } from './processor';\n\nexport type MarkdownProviderOptions = {\n /** Forces the compiler to always output content with a block-level wrapper. */\n forceBlock?: boolean;\n /** Forces the compiler to always output content with an inline wrapper. */\n forceInline?: boolean;\n /** Whether to preserve frontmatter in the markdown content. */\n preserveFrontmatter?: boolean;\n /** Whether to use the GitHub Tag Filter for security. */\n tagfilter?: boolean;\n};\n\ntype MarkdownContextValue = {\n renderMarkdown: (\n markdown: string,\n options?: MarkdownProviderOptions,\n components?: HTMLComponents<'permissive', {}>,\n wrapper?: FC<HTMLAttributes<HTMLElement>>\n ) => ReactNode;\n};\n\ntype MarkdownProviderProps = PropsWithChildren<\n MarkdownProviderOptions & {\n components?: HTMLComponents<'permissive', {}>;\n wrapper?: FC<HTMLAttributes<HTMLElement>>;\n renderMarkdown?: (\n markdown: string,\n options?: MarkdownProviderOptions,\n components?: HTMLComponents<'permissive', {}>,\n wrapper?: FC<HTMLAttributes<HTMLElement>>\n ) => ReactNode;\n }\n>;\n\nconst MarkdownContext = createContext<MarkdownContextValue | undefined>(\n undefined\n);\n\nexport const useMarkdownContext = () => useContext(MarkdownContext);\n\nconst mergeOptions = (\n baseOptions: MarkdownRendererOptions,\n options: MarkdownProviderOptions = {},\n components: HTMLComponents<'permissive', {}> = {},\n wrapper?: FC<HTMLAttributes<HTMLElement>>\n): MarkdownRendererOptions => {\n return {\n ...baseOptions,\n ...options,\n forceBlock: options.forceBlock ?? baseOptions.forceBlock,\n forceInline: options.forceInline ?? baseOptions.forceInline,\n preserveFrontmatter:\n options.preserveFrontmatter ?? baseOptions.preserveFrontmatter,\n tagfilter: options.tagfilter ?? baseOptions.tagfilter,\n wrapper: wrapper || baseOptions.wrapper,\n\n forceWrapper: !!(wrapper || baseOptions.wrapper),\n components: { ...baseOptions.components, ...components },\n };\n};\n\n/**\n * Provider for the MarkdownRenderer component.\n *\n * It will provide the `renderMarkdown` function to the context, which can be used to render markdown.\n *\n * ```tsx\n * const content = useIntlayer('app');\n *\n * return (\n * <div>\n * {content.markdown} // Will be rendered with the components and options provided to the MarkdownProvider\n * </div>\n * );\n * ```\n *\n * @example\n * ```tsx\n * <MarkdownProvider components={{ h1: CustomHeading }}>\n * <MarkdownRenderer>\n * {markdownContent}\n * </MarkdownRenderer>\n * </MarkdownProvider>\n * ```\n */\nexport const MarkdownProvider: FC<MarkdownProviderProps> = ({\n children,\n components,\n wrapper,\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n renderMarkdown: customRenderFn,\n}) => {\n const baseOptions: MarkdownRendererOptions = {\n components,\n forceBlock,\n forceInline,\n wrapper,\n forceWrapper: !!wrapper,\n preserveFrontmatter,\n tagfilter,\n };\n\n // Standard internal renderer\n const defaultRenderMarkdown = (\n markdown: string,\n options?: MarkdownProviderOptions,\n components?: HTMLComponents<'permissive', {}>,\n wrapper?: FC<HTMLAttributes<HTMLElement>>\n ) => {\n const mergedOptions = mergeOptions(\n baseOptions,\n options,\n components,\n wrapper\n );\n\n return compiler(markdown, mergedOptions);\n };\n\n // Wrapper for user-provided custom renderer\n // Note: We wrap in a clean Provider to prevent infinite recursion\n const customRenderMarkdownWrapper = (\n markdown: string,\n options?: MarkdownProviderOptions,\n components?: HTMLComponents<'permissive', {}>,\n wrapper?: FC<HTMLAttributes<HTMLElement>>\n ) => (\n <MarkdownContext.Provider value={undefined}>\n {customRenderFn?.(markdown, options, components, wrapper)}\n </MarkdownContext.Provider>\n );\n\n return (\n <MarkdownContext.Provider\n value={{\n renderMarkdown: customRenderFn\n ? customRenderMarkdownWrapper\n : defaultRenderMarkdown,\n }}\n >\n {children}\n </MarkdownContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;;AA8CA,MAAM,2CACJ,OACD;AAED,MAAa,iDAAsC,gBAAgB;AAEnE,MAAM,gBACJ,aACA,UAAmC,EAAE,EACrC,aAA+C,EAAE,EACjD,YAC4B;AAC5B,QAAO;EACL,GAAG;EACH,GAAG;EACH,YAAY,QAAQ,cAAc,YAAY;EAC9C,aAAa,QAAQ,eAAe,YAAY;EAChD,qBACE,QAAQ,uBAAuB,YAAY;EAC7C,WAAW,QAAQ,aAAa,YAAY;EAC5C,SAAS,WAAW,YAAY;EAEhC,cAAc,CAAC,EAAE,WAAW,YAAY;EACxC,YAAY;GAAE,GAAG,YAAY;GAAY,GAAG;GAAY;EACzD;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BH,MAAa,oBAA+C,EAC1D,UACA,YACA,SACA,YACA,aACA,qBACA,WACA,gBAAgB,qBACZ;CACJ,MAAM,cAAuC;EAC3C;EACA;EACA;EACA;EACA,cAAc,CAAC,CAAC;EAChB;EACA;EACD;CAGD,MAAM,yBACJ,UACA,SACA,YACA,YACG;AAQH,SAAOA,oCAAS,UAPM,aACpB,aACA,SACA,YACA,QACD,CAEuC;;CAK1C,MAAM,+BACJ,UACA,SACA,YACA,YAEA,2CAAC,gBAAgB;EAAS,OAAO;YAC9B,iBAAiB,UAAU,SAAS,YAAY,QAAQ;GAChC;AAG7B,QACE,2CAAC,gBAAgB;EACf,OAAO,EACL,gBAAgB,iBACZ,8BACA,uBACL;EAEA;GACwB"}
@@ -1,4 +1,5 @@
1
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
3
  const require_markdown_processor = require('./processor.cjs');
3
4
  const require_markdown_MarkdownProvider = require('./MarkdownProvider.cjs');
4
5
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownRenderer.cjs","names":["compiler","useMarkdownContext"],"sources":["../../../src/markdown/MarkdownRenderer.tsx"],"sourcesContent":["import type { FC, HTMLAttributes, JSX, ReactNode } from 'react';\nimport type { HTMLComponents } from '../html/HTMLComponentTypes';\nimport {\n type MarkdownProviderOptions,\n useMarkdownContext,\n} from './MarkdownProvider';\nimport { compiler, type MarkdownRendererOptions } from './processor';\n\n/**\n * Props for rendering markdown content.\n *\n * @example\n * ```tsx\n * const props: RenderMarkdownProps = {\n * components: {\n * h1: ({ children }) => <h1 className=\"text-3xl\">{children}</h1>,\n * p: ({ children }) => <p className=\"text-gray-700\">{children}</p>,\n * },\n * wrapper: ({ children }) => <article>{children}</article>,\n * options: {\n * forceBlock: true,\n * preserveFrontmatter: false,\n * tagfilter: true,\n * },\n * };\n * ```\n */\nexport type RenderMarkdownProps = MarkdownProviderOptions & {\n /**\n * Component overrides for HTML tags.\n * Allows you to customize how specific HTML elements are rendered.\n * Only used if not wrapped in a MarkdownProvider.\n *\n * @example\n * ```tsx\n * components={{\n * h1: ({ children }) => <h1 className=\"title\">{children}</h1>,\n * a: ({ href, children }) => <Link to={href}>{children}</Link>,\n * }}\n * ```\n */\n components?: HTMLComponents<'permissive', {}>;\n /**\n * Wrapper element or component to be used when there are multiple children.\n * Only used if not wrapped in a MarkdownProvider.\n *\n * @example\n * ```tsx\n * wrapper={({ children }) => <div className=\"markdown-content\">{children}</div>}\n * ```\n */\n wrapper?: FC<HTMLAttributes<HTMLElement>>;\n};\n\n/**\n * Renders markdown content to JSX with the provided components and options.\n *\n * This function does not use context from MarkdownProvider. Use `useMarkdownRenderer`\n * hook if you want to leverage provider context.\n *\n * @param content - The markdown string to render\n * @param props - Configuration options for rendering\n * @param props.components - Component overrides for HTML tags\n * @param props.wrapper - Wrapper component for multiple children\n * @returns JSX element representing the rendered markdown\n *\n * @example\n * ```tsx\n * import { renderMarkdown } from '@intlayer/react-intlayer/markdown';\n *\n * const markdown = '# Hello World\\n\\nThis is **bold** text.';\n * const jsx = renderMarkdown(markdown, {\n * components: {\n * h1: ({ children }) => <h1 className=\"title\">{children}</h1>,\n * },\n * forceBlock: true,\n * });\n * ```\n */\nexport const renderMarkdown = (\n content: string,\n {\n components,\n wrapper,\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n }: RenderMarkdownProps = {}\n): JSX.Element => {\n // Map public options to internal processor options\n const internalOptions: MarkdownRendererOptions = {\n components,\n forceBlock,\n forceInline,\n wrapper,\n forceWrapper: !!wrapper,\n preserveFrontmatter,\n tagfilter,\n };\n\n return compiler(content, internalOptions);\n};\n\n/**\n * Hook that returns a function to render markdown content.\n *\n * This hook considers the configuration from the `MarkdownProvider` context if available,\n * falling back to the provided props or default behavior.\n *\n * @param props - Optional configuration that will override context values\n * @param props.components - Component overrides for HTML tags (overrides context)\n * @param props.wrapper - Wrapper component (overrides context)\n * @returns A function that takes markdown content and returns JSX\n *\n * @example\n * ```tsx\n * import { useMarkdownRenderer } from '@intlayer/react-intlayer/markdown';\n *\n * function MyComponent() {\n * const renderMarkdown = useMarkdownRenderer({\n * components: {\n * h1: ({ children }) => <h1 className=\"custom\">{children}</h1>,\n * },\n * });\n *\n * return (\n * <div>\n * {renderMarkdown('# Hello\\n\\nThis is **markdown**')}\n * </div>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * // With MarkdownProvider context\n * function App() {\n * return (\n * <MarkdownProvider\n * components={{ h1: CustomHeading }}\n * forceBlock={true}\n * >\n * <MyComponent />\n * </MarkdownProvider>\n * );\n * }\n * ```\n */\nexport const useMarkdownRenderer = ({\n components,\n wrapper,\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n}: RenderMarkdownProps = {}) => {\n const context = useMarkdownContext();\n\n return (content: string) => {\n if (context) {\n return context.renderMarkdown(\n content,\n {\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n },\n components,\n wrapper\n );\n }\n\n return renderMarkdown(content, {\n components,\n wrapper,\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n });\n };\n};\n\n/**\n * Props for the MarkdownRenderer component.\n *\n * @example\n * ```tsx\n * const props: MarkdownRendererProps = {\n * children: '# Hello World\\n\\nThis is **bold** text.',\n * components: {\n * h1: ({ children }) => <h1 className=\"title\">{children}</h1>,\n * },\n * wrapper: ({ children }) => <article>{children}</article>,\n * forceBlock: true,\n * };\n * ```\n */\nexport type MarkdownRendererProps = RenderMarkdownProps & {\n /**\n * The markdown content to render as a string.\n *\n * @example\n * ```tsx\n * <MarkdownRenderer>\n * {`# Title\\n\\nParagraph with **bold** text.`}\n * </MarkdownRenderer>\n * ```\n */\n children: string;\n /**\n * Custom render function for markdown.\n * If provided, it will overwrite context and default rendering.\n *\n * @param markdown - The markdown string to render\n * @param options - Optional rendering options\n * @returns React node representing the rendered markdown\n *\n * @example\n * ```tsx\n * <MarkdownRenderer\n * renderMarkdown={(md, opts) => {\n * // Custom rendering logic\n * return <div dangerouslySetInnerHTML={{ __html: customParser(md) }} />;\n * }}\n * >\n * {markdownContent}\n * </MarkdownRenderer>\n * ```\n */\n renderMarkdown?: (\n markdown: string,\n options?: {\n components?: HTMLComponents<'permissive', {}>;\n wrapper?: FC;\n forceBlock?: boolean;\n forceInline?: boolean;\n preserveFrontmatter?: boolean;\n tagfilter?: boolean;\n }\n ) => ReactNode;\n};\n\n/**\n * React component that renders markdown content to JSX.\n *\n * This component uses the `renderMarkdown` function from the `MarkdownProvider` context\n * if available. Otherwise, it falls back to the default compiler with provided components\n * and options. You can also provide a custom `renderMarkdown` function prop to override\n * all rendering behavior.\n *\n * @example\n * ```tsx\n * import { MarkdownRenderer } from '@intlayer/react-intlayer/markdown';\n *\n * function MyComponent() {\n * return (\n * <MarkdownRenderer>\n * {`# Hello World\n *\n * This is a paragraph with **bold** and *italic* text.\n *\n * - List item 1\n * - List item 2`}\n * </MarkdownRenderer>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * // With custom components\n * <MarkdownRenderer\n * components={{\n * h1: ({ children }) => <h1 className=\"text-4xl font-bold\">{children}</h1>,\n * a: ({ href, children }) => (\n * <a href={href} className=\"text-blue-500 hover:underline\">\n * {children}\n * </a>\n * ),\n * }}\n * forceBlock={true}\n * >\n * {markdownContent}\n * </MarkdownRenderer>\n * ```\n *\n * @example\n * ```tsx\n * // With MarkdownProvider context\n * function App() {\n * return (\n * <MarkdownProvider\n * components={{ h1: CustomHeading }}\n * forceBlock={true}\n * >\n * <MarkdownRenderer>\n * {markdownContent}\n * </MarkdownRenderer>\n * </MarkdownProvider>\n * );\n * }\n * ```\n */\nexport const MarkdownRenderer: FC<MarkdownRendererProps> = ({\n children = '',\n components,\n wrapper,\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n renderMarkdown,\n}) => {\n const context = useMarkdownContext();\n\n if (renderMarkdown) {\n return (\n <>\n {renderMarkdown(children, {\n components,\n wrapper,\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n })}\n </>\n );\n }\n\n if (context) {\n return (\n <>\n {context.renderMarkdown(\n children,\n {\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n },\n components,\n wrapper\n )}\n </>\n );\n }\n\n // Map public options to internal processor options\n const internalOptions: MarkdownRendererOptions = {\n components,\n forceBlock,\n forceInline,\n wrapper,\n forceWrapper: !!wrapper,\n preserveFrontmatter,\n tagfilter,\n };\n\n return <>{compiler(children, internalOptions)}</>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EA,MAAa,kBACX,SACA,EACE,YACA,SACA,YACA,aACA,qBACA,cACuB,EAAE,KACX;AAYhB,QAAOA,oCAAS,SAViC;EAC/C;EACA;EACA;EACA;EACA,cAAc,CAAC,CAAC;EAChB;EACA;EACD,CAEwC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgD3C,MAAa,uBAAuB,EAClC,YACA,SACA,YACA,aACA,qBACA,cACuB,EAAE,KAAK;CAC9B,MAAM,UAAUC,sDAAoB;AAEpC,SAAQ,YAAoB;AAC1B,MAAI,QACF,QAAO,QAAQ,eACb,SACA;GACE;GACA;GACA;GACA;GACD,EACD,YACA,QACD;AAGH,SAAO,eAAe,SAAS;GAC7B;GACA;GACA;GACA;GACA;GACA;GACD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6HN,MAAa,oBAA+C,EAC1D,WAAW,IACX,YACA,SACA,YACA,aACA,qBACA,WACA,qBACI;CACJ,MAAM,UAAUA,sDAAoB;AAEpC,KAAI,eACF,QACE,mFACG,eAAe,UAAU;EACxB;EACA;EACA;EACA;EACA;EACA;EACD,CAAC,GACD;AAIP,KAAI,QACF,QACE,mFACG,QAAQ,eACP,UACA;EACE;EACA;EACA;EACA;EACD,EACD,YACA,QACD,GACA;AAeP,QAAO,mFAAGD,oCAAS,UAV8B;EAC/C;EACA;EACA;EACA;EACA,cAAc,CAAC,CAAC;EAChB;EACA;EACD,CAE4C,GAAI"}
1
+ {"version":3,"file":"MarkdownRenderer.cjs","names":["compiler","useMarkdownContext"],"sources":["../../../src/markdown/MarkdownRenderer.tsx"],"sourcesContent":["import type { FC, HTMLAttributes, JSX, ReactNode } from 'react';\nimport type { HTMLComponents } from '../html/HTMLComponentTypes';\nimport {\n type MarkdownProviderOptions,\n useMarkdownContext,\n} from './MarkdownProvider';\nimport { compiler, type MarkdownRendererOptions } from './processor';\n\n/**\n * Props for rendering markdown content.\n *\n * @example\n * ```tsx\n * const props: RenderMarkdownProps = {\n * components: {\n * h1: ({ children }) => <h1 className=\"text-3xl\">{children}</h1>,\n * p: ({ children }) => <p className=\"text-gray-700\">{children}</p>,\n * },\n * wrapper: ({ children }) => <article>{children}</article>,\n * options: {\n * forceBlock: true,\n * preserveFrontmatter: false,\n * tagfilter: true,\n * },\n * };\n * ```\n */\nexport type RenderMarkdownProps = MarkdownProviderOptions & {\n /**\n * Component overrides for HTML tags.\n * Allows you to customize how specific HTML elements are rendered.\n * Only used if not wrapped in a MarkdownProvider.\n *\n * @example\n * ```tsx\n * components={{\n * h1: ({ children }) => <h1 className=\"title\">{children}</h1>,\n * a: ({ href, children }) => <Link to={href}>{children}</Link>,\n * }}\n * ```\n */\n components?: HTMLComponents<'permissive', {}>;\n /**\n * Wrapper element or component to be used when there are multiple children.\n * Only used if not wrapped in a MarkdownProvider.\n *\n * @example\n * ```tsx\n * wrapper={({ children }) => <div className=\"markdown-content\">{children}</div>}\n * ```\n */\n wrapper?: FC<HTMLAttributes<HTMLElement>>;\n};\n\n/**\n * Renders markdown content to JSX with the provided components and options.\n *\n * This function does not use context from MarkdownProvider. Use `useMarkdownRenderer`\n * hook if you want to leverage provider context.\n *\n * @param content - The markdown string to render\n * @param props - Configuration options for rendering\n * @param props.components - Component overrides for HTML tags\n * @param props.wrapper - Wrapper component for multiple children\n * @returns JSX element representing the rendered markdown\n *\n * @example\n * ```tsx\n * import { renderMarkdown } from '@intlayer/react-intlayer/markdown';\n *\n * const markdown = '# Hello World\\n\\nThis is **bold** text.';\n * const jsx = renderMarkdown(markdown, {\n * components: {\n * h1: ({ children }) => <h1 className=\"title\">{children}</h1>,\n * },\n * forceBlock: true,\n * });\n * ```\n */\nexport const renderMarkdown = (\n content: string,\n {\n components,\n wrapper,\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n }: RenderMarkdownProps = {}\n): JSX.Element => {\n // Map public options to internal processor options\n const internalOptions: MarkdownRendererOptions = {\n components,\n forceBlock,\n forceInline,\n wrapper,\n forceWrapper: !!wrapper,\n preserveFrontmatter,\n tagfilter,\n };\n\n return compiler(content, internalOptions);\n};\n\n/**\n * Hook that returns a function to render markdown content.\n *\n * This hook considers the configuration from the `MarkdownProvider` context if available,\n * falling back to the provided props or default behavior.\n *\n * @param props - Optional configuration that will override context values\n * @param props.components - Component overrides for HTML tags (overrides context)\n * @param props.wrapper - Wrapper component (overrides context)\n * @returns A function that takes markdown content and returns JSX\n *\n * @example\n * ```tsx\n * import { useMarkdownRenderer } from '@intlayer/react-intlayer/markdown';\n *\n * function MyComponent() {\n * const renderMarkdown = useMarkdownRenderer({\n * components: {\n * h1: ({ children }) => <h1 className=\"custom\">{children}</h1>,\n * },\n * });\n *\n * return (\n * <div>\n * {renderMarkdown('# Hello\\n\\nThis is **markdown**')}\n * </div>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * // With MarkdownProvider context\n * function App() {\n * return (\n * <MarkdownProvider\n * components={{ h1: CustomHeading }}\n * forceBlock={true}\n * >\n * <MyComponent />\n * </MarkdownProvider>\n * );\n * }\n * ```\n */\nexport const useMarkdownRenderer = ({\n components,\n wrapper,\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n}: RenderMarkdownProps = {}) => {\n const context = useMarkdownContext();\n\n return (content: string) => {\n if (context) {\n return context.renderMarkdown(\n content,\n {\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n },\n components,\n wrapper\n );\n }\n\n return renderMarkdown(content, {\n components,\n wrapper,\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n });\n };\n};\n\n/**\n * Props for the MarkdownRenderer component.\n *\n * @example\n * ```tsx\n * const props: MarkdownRendererProps = {\n * children: '# Hello World\\n\\nThis is **bold** text.',\n * components: {\n * h1: ({ children }) => <h1 className=\"title\">{children}</h1>,\n * },\n * wrapper: ({ children }) => <article>{children}</article>,\n * forceBlock: true,\n * };\n * ```\n */\nexport type MarkdownRendererProps = RenderMarkdownProps & {\n /**\n * The markdown content to render as a string.\n *\n * @example\n * ```tsx\n * <MarkdownRenderer>\n * {`# Title\\n\\nParagraph with **bold** text.`}\n * </MarkdownRenderer>\n * ```\n */\n children: string;\n /**\n * Custom render function for markdown.\n * If provided, it will overwrite context and default rendering.\n *\n * @param markdown - The markdown string to render\n * @param options - Optional rendering options\n * @returns React node representing the rendered markdown\n *\n * @example\n * ```tsx\n * <MarkdownRenderer\n * renderMarkdown={(md, opts) => {\n * // Custom rendering logic\n * return <div dangerouslySetInnerHTML={{ __html: customParser(md) }} />;\n * }}\n * >\n * {markdownContent}\n * </MarkdownRenderer>\n * ```\n */\n renderMarkdown?: (\n markdown: string,\n options?: {\n components?: HTMLComponents<'permissive', {}>;\n wrapper?: FC;\n forceBlock?: boolean;\n forceInline?: boolean;\n preserveFrontmatter?: boolean;\n tagfilter?: boolean;\n }\n ) => ReactNode;\n};\n\n/**\n * React component that renders markdown content to JSX.\n *\n * This component uses the `renderMarkdown` function from the `MarkdownProvider` context\n * if available. Otherwise, it falls back to the default compiler with provided components\n * and options. You can also provide a custom `renderMarkdown` function prop to override\n * all rendering behavior.\n *\n * @example\n * ```tsx\n * import { MarkdownRenderer } from '@intlayer/react-intlayer/markdown';\n *\n * function MyComponent() {\n * return (\n * <MarkdownRenderer>\n * {`# Hello World\n *\n * This is a paragraph with **bold** and *italic* text.\n *\n * - List item 1\n * - List item 2`}\n * </MarkdownRenderer>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * // With custom components\n * <MarkdownRenderer\n * components={{\n * h1: ({ children }) => <h1 className=\"text-4xl font-bold\">{children}</h1>,\n * a: ({ href, children }) => (\n * <a href={href} className=\"text-blue-500 hover:underline\">\n * {children}\n * </a>\n * ),\n * }}\n * forceBlock={true}\n * >\n * {markdownContent}\n * </MarkdownRenderer>\n * ```\n *\n * @example\n * ```tsx\n * // With MarkdownProvider context\n * function App() {\n * return (\n * <MarkdownProvider\n * components={{ h1: CustomHeading }}\n * forceBlock={true}\n * >\n * <MarkdownRenderer>\n * {markdownContent}\n * </MarkdownRenderer>\n * </MarkdownProvider>\n * );\n * }\n * ```\n */\nexport const MarkdownRenderer: FC<MarkdownRendererProps> = ({\n children = '',\n components,\n wrapper,\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n renderMarkdown,\n}) => {\n const context = useMarkdownContext();\n\n if (renderMarkdown) {\n return (\n <>\n {renderMarkdown(children, {\n components,\n wrapper,\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n })}\n </>\n );\n }\n\n if (context) {\n return (\n <>\n {context.renderMarkdown(\n children,\n {\n forceBlock,\n forceInline,\n preserveFrontmatter,\n tagfilter,\n },\n components,\n wrapper\n )}\n </>\n );\n }\n\n // Map public options to internal processor options\n const internalOptions: MarkdownRendererOptions = {\n components,\n forceBlock,\n forceInline,\n wrapper,\n forceWrapper: !!wrapper,\n preserveFrontmatter,\n tagfilter,\n };\n\n return <>{compiler(children, internalOptions)}</>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EA,MAAa,kBACX,SACA,EACE,YACA,SACA,YACA,aACA,qBACA,cACuB,EAAE,KACX;AAYhB,QAAOA,oCAAS,SAViC;EAC/C;EACA;EACA;EACA;EACA,cAAc,CAAC,CAAC;EAChB;EACA;EACD,CAEwC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgD3C,MAAa,uBAAuB,EAClC,YACA,SACA,YACA,aACA,qBACA,cACuB,EAAE,KAAK;CAC9B,MAAM,UAAUC,sDAAoB;AAEpC,SAAQ,YAAoB;AAC1B,MAAI,QACF,QAAO,QAAQ,eACb,SACA;GACE;GACA;GACA;GACA;GACD,EACD,YACA,QACD;AAGH,SAAO,eAAe,SAAS;GAC7B;GACA;GACA;GACA;GACA;GACA;GACD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6HN,MAAa,oBAA+C,EAC1D,WAAW,IACX,YACA,SACA,YACA,aACA,qBACA,WACA,qBACI;CACJ,MAAM,UAAUA,sDAAoB;AAEpC,KAAI,eACF,QACE,mFACG,eAAe,UAAU;EACxB;EACA;EACA;EACA;EACA;EACA;EACD,CAAC,GACD;AAIP,KAAI,QACF,QACE,mFACG,QAAQ,eACP,UACA;EACE;EACA;EACA;EACA;EACD,EACD,YACA,QACD,GACA;AAeP,QAAO,mFAAGD,oCAAS,UAV8B;EAC/C;EACA;EACA;EACA;EACA,cAAc,CAAC,CAAC;EAChB;EACA;EACD,CAE4C,GAAI"}
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
 
3
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
4
5
  const require_editor_useEditedContentRenderer = require('../editor/useEditedContentRenderer.cjs');
5
6
  const require_markdown_MarkdownProvider = require('./MarkdownProvider.cjs');
6
7
  let _intlayer_core = require("@intlayer/core");
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownRendererPlugin.cjs","names":["useMarkdownContext","useEditedContentRenderer"],"sources":["../../../src/markdown/MarkdownRendererPlugin.tsx"],"sourcesContent":["'use client';\n\nimport { getContentNodeByKeyPath, getMarkdownMetadata } 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 MarkdownRendererPluginProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n locale?: LocalesValues;\n children: string;\n [key: string]: any;\n};\n\nexport const MarkdownRendererPlugin: FC<MarkdownRendererPluginProps> = (\n props\n): ReactNode => {\n const { dictionaryKey, keyPath, children, locale, ...components } = props;\n const context = useMarkdownContext();\n const renderMarkdown = context?.renderMarkdown ?? ((md) => md);\n const editedContentContext = useEditedContentRenderer({\n dictionaryKey,\n keyPath,\n children,\n });\n\n const contentToRender =\n typeof editedContentContext === 'string' ? editedContentContext : children;\n\n return renderMarkdown(contentToRender, components);\n};\n\ntype MarkdownMetadataRendererProps = MarkdownRendererPluginProps & {\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":";;;;;;;;;AAiBA,MAAa,0BACX,UACc;CACd,MAAM,EAAE,eAAe,SAAS,UAAU,QAAQ,GAAG,eAAe;CAEpE,MAAM,iBADUA,sDAAoB,EACJ,oBAAoB,OAAO;CAC3D,MAAM,uBAAuBC,iEAAyB;EACpD;EACA;EACA;EACD,CAAC;AAKF,QAAO,eAFL,OAAO,yBAAyB,WAAW,uBAAuB,UAE7B,WAAW;;AAOpD,MAAa,4BAA+D,EAC1E,eACA,SACA,UACA,sBACe;CACf,MAAM,uBAAuBA,iEAAyB;EACpD;EACA;EACA;EACD,CAAC;CACF,MAAM,6DAAiC;AAUvC,4FARqC,qBAAqB,EAIxD,iBACA,cACD"}
1
+ {"version":3,"file":"MarkdownRendererPlugin.cjs","names":["useMarkdownContext","useEditedContentRenderer"],"sources":["../../../src/markdown/MarkdownRendererPlugin.tsx"],"sourcesContent":["'use client';\n\nimport { getContentNodeByKeyPath, getMarkdownMetadata } 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 MarkdownRendererPluginProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n locale?: LocalesValues;\n children: string;\n [key: string]: any;\n};\n\nexport const MarkdownRendererPlugin: FC<MarkdownRendererPluginProps> = (\n props\n): ReactNode => {\n const { dictionaryKey, keyPath, children, locale, ...components } = props;\n const context = useMarkdownContext();\n const renderMarkdown = context?.renderMarkdown ?? ((md) => md);\n const editedContentContext = useEditedContentRenderer({\n dictionaryKey,\n keyPath,\n children,\n });\n\n const contentToRender =\n typeof editedContentContext === 'string' ? editedContentContext : children;\n\n return renderMarkdown(contentToRender, components);\n};\n\ntype MarkdownMetadataRendererProps = MarkdownRendererPluginProps & {\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":";;;;;;;;;;AAiBA,MAAa,0BACX,UACc;CACd,MAAM,EAAE,eAAe,SAAS,UAAU,QAAQ,GAAG,eAAe;CAEpE,MAAM,iBADUA,sDAAoB,EACJ,oBAAoB,OAAO;CAC3D,MAAM,uBAAuBC,iEAAyB;EACpD;EACA;EACA;EACD,CAAC;AAKF,QAAO,eAFL,OAAO,yBAAyB,WAAW,uBAAuB,UAE7B,WAAW;;AAOpD,MAAa,4BAA+D,EAC1E,eACA,SACA,UACA,sBACe;CACf,MAAM,uBAAuBA,iEAAyB;EACpD;EACA;EACA;EACD,CAAC;CACF,MAAM,6DAAiC;AAUvC,4FARqC,qBAAqB,EAIxD,iBACA,cACD"}
@@ -1,4 +1,5 @@
1
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
3
  const require_markdown_processor = require('./processor.cjs');
3
4
  const require_markdown_MarkdownProvider = require('./MarkdownProvider.cjs');
4
5
  const require_markdown_MarkdownRenderer = require('./MarkdownRenderer.cjs');
@@ -16,7 +17,7 @@ exports.compile = require_markdown_processor.compile;
16
17
  exports.compileMarkdown = require_markdown_processor.compileMarkdown;
17
18
  exports.compiler = require_markdown_processor.compiler;
18
19
  exports.createReactRuntime = require_markdown_runtime.createReactRuntime;
19
- exports.reactRuntime = require_markdown_runtime.reactRuntime;
20
+ exports.reactRuntime = require_markdown_runtime;
20
21
  exports.renderMarkdown = require_markdown_MarkdownRenderer.renderMarkdown;
21
22
  exports.sanitizer = _intlayer_core.sanitizer;
22
23
  exports.slugify = _intlayer_core.slugify;
@@ -1,4 +1,5 @@
1
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
3
  let react = require("react");
3
4
  let _intlayer_core = require("@intlayer/core");
4
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"processor.cjs","names":["createElement"],"sources":["../../../src/markdown/processor.tsx"],"sourcesContent":["/**\n * it's a fork\n * [markdown-to-jsx v7.7.14](https://github.com/quantizor/markdown-to-jsx) from quantizor\n * [simple-markdown v0.2.2](https://github.com/Khan/simple-markdown) from Khan Academy.\n */\n\nimport {\n compile as coreCompile,\n sanitizer as defaultSanitizer,\n slugify as defaultSlugify,\n type MarkdownContext,\n type MarkdownOptions,\n type MarkdownRuntime,\n type RenderRuleHook,\n RuleType,\n} from '@intlayer/core';\nimport {\n cloneElement,\n createElement,\n type FC,\n Fragment,\n type HTMLAttributes,\n type JSX,\n type ReactNode,\n} from 'react';\nimport type { HTMLComponents } from '../html/HTMLComponentTypes';\n\n// Re-export RuleType for compatibility\nexport { RuleType };\n\n// Re-export utilities for compatibility\nexport { defaultSlugify as slugify, defaultSanitizer as sanitizer };\n\ntype HTMLTags = keyof JSX.IntrinsicElements;\n\n/**\n * Refined MarkdownRendererOptions type.\n */\nexport type MarkdownRendererOptions = Partial<{\n /**\n * Ultimate control over the output of all rendered JSX.\n */\n createElement: (\n tag: Parameters<typeof createElement>[0],\n props: JSX.IntrinsicAttributes,\n ...children: ReactNode[]\n ) => ReactNode;\n\n /**\n * The library automatically generates an anchor tag for bare URLs included in the markdown\n * document, but this behavior can be disabled if desired.\n */\n disableAutoLink: boolean;\n\n /**\n * Disable the compiler's best-effort transcription of provided raw HTML\n * into JSX-equivalent.\n */\n disableParsingRawHTML: boolean;\n\n /**\n * Forces the compiler to have space between hash sign and the header text.\n */\n enforceAtxHeadings: boolean;\n\n /**\n * Forces the compiler to always output content with a block-level wrapper.\n */\n forceBlock: boolean;\n\n /**\n * Forces the compiler to always output content with an inline wrapper.\n */\n forceInline: boolean;\n\n /**\n * Forces the compiler to wrap results, even if there is only a single child.\n */\n forceWrapper: boolean;\n\n /**\n * Supply additional HTML entity: unicode replacement mappings.\n */\n namedCodesToUnicode: {\n [key: string]: string;\n };\n\n /**\n * Selectively control the output of particular HTML tags.\n */\n components: HTMLComponents;\n\n /**\n * Allows for full control over rendering of particular rules.\n */\n renderRule: RenderRuleHook;\n\n /**\n * Override the built-in sanitizer function for URLs.\n */\n sanitizer: (value: string, tag: HTMLTags, attribute: string) => string | null;\n\n /**\n * Override normalization of non-URI-safe characters for anchor linking.\n */\n slugify: (input: string) => string;\n\n /**\n * Declare the type of the wrapper to be used when there are multiple children.\n */\n wrapper: any | null;\n\n /**\n * Whether to preserve frontmatter in the markdown content.\n */\n preserveFrontmatter: boolean;\n\n /**\n * Whether to use the GitHub Tag Filter.\n */\n tagfilter: boolean;\n}>;\n\n/**\n * Default React runtime for markdown rendering.\n */\nconst DEFAULT_RUNTIME: MarkdownRuntime = {\n createElement: createElement as any,\n cloneElement,\n Fragment,\n normalizeProps: (_tag, props) => props,\n};\n\n/**\n * Compile markdown to React elements.\n * This is the primary export - use this for new code.\n */\nexport const compileMarkdown = (\n markdown: string = '',\n options: MarkdownRendererOptions = {}\n): JSX.Element => {\n const {\n createElement: customCreateElement,\n disableAutoLink,\n disableParsingRawHTML,\n enforceAtxHeadings,\n forceBlock,\n forceInline,\n forceWrapper,\n namedCodesToUnicode,\n components,\n renderRule,\n sanitizer,\n slugify,\n wrapper,\n preserveFrontmatter,\n tagfilter,\n } = options;\n\n const runtime = customCreateElement\n ? { ...DEFAULT_RUNTIME, createElement: customCreateElement as any }\n : DEFAULT_RUNTIME;\n\n const ctx: MarkdownContext<HTMLComponents> = {\n runtime,\n components,\n namedCodesToUnicode,\n sanitizer: sanitizer as any,\n slugify,\n };\n\n const compilerOptions: MarkdownOptions = {\n disableAutoLink,\n disableParsingRawHTML,\n enforceAtxHeadings,\n forceBlock,\n forceInline,\n forceWrapper,\n renderRule,\n wrapper,\n preserveFrontmatter,\n tagfilter,\n };\n\n return coreCompile(markdown, ctx, compilerOptions) as JSX.Element;\n};\n\n// Backward compatibility aliases\nexport const compiler = compileMarkdown;\nexport const compile = compileMarkdown;\n\n/**\n * React component that renders markdown to JSX (legacy).\n */\nexport const LegacyMarkdownRenderer: FC<\n Omit<HTMLAttributes<Element>, 'children'> & {\n children: string;\n options?: MarkdownRendererOptions;\n }\n> = ({ children = '', options, ...props }) => {\n if (process.env.NODE_ENV !== 'production' && typeof children !== 'string') {\n console.error(\n 'intlayer: <Markdown> component only accepts a single string as a child, received:',\n children\n );\n }\n\n return cloneElement(\n compiler(children, options),\n props as JSX.IntrinsicAttributes\n );\n};\n"],"mappings":";;;;;;;;;;;;;AA8HA,MAAM,kBAAmC;CACvC,eAAeA;CACf;CACA;CACA,iBAAiB,MAAM,UAAU;CAClC;;;;;AAMD,MAAa,mBACX,WAAmB,IACnB,UAAmC,EAAE,KACrB;CAChB,MAAM,EACJ,eAAe,qBACf,iBACA,uBACA,oBACA,YACA,aACA,cACA,qBACA,YACA,YACA,WACA,SACA,SACA,qBACA,cACE;AA2BJ,oCAAmB,UArB0B;EAC3C,SALc,sBACZ;GAAE,GAAG;GAAiB,eAAe;GAA4B,GACjE;EAIF;EACA;EACW;EACX;EACD,EAEwC;EACvC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAEiD;;AAIpD,MAAa,WAAW;AACxB,MAAa,UAAU;;;;AAKvB,MAAa,0BAKR,EAAE,WAAW,IAAI,SAAS,GAAG,YAAY;AAC5C,KAAI,QAAQ,IAAI,aAAa,gBAAgB,OAAO,aAAa,SAC/D,SAAQ,MACN,qFACA,SACD;AAGH,gCACE,SAAS,UAAU,QAAQ,EAC3B,MACD"}
1
+ {"version":3,"file":"processor.cjs","names":["createElement"],"sources":["../../../src/markdown/processor.tsx"],"sourcesContent":["/**\n * it's a fork\n * [markdown-to-jsx v7.7.14](https://github.com/quantizor/markdown-to-jsx) from quantizor\n * [simple-markdown v0.2.2](https://github.com/Khan/simple-markdown) from Khan Academy.\n */\n\nimport {\n compile as coreCompile,\n sanitizer as defaultSanitizer,\n slugify as defaultSlugify,\n type MarkdownContext,\n type MarkdownOptions,\n type MarkdownRuntime,\n type RenderRuleHook,\n RuleType,\n} from '@intlayer/core';\nimport {\n cloneElement,\n createElement,\n type FC,\n Fragment,\n type HTMLAttributes,\n type JSX,\n type ReactNode,\n} from 'react';\nimport type { HTMLComponents } from '../html/HTMLComponentTypes';\n\n// Re-export RuleType for compatibility\nexport { RuleType };\n\n// Re-export utilities for compatibility\nexport { defaultSlugify as slugify, defaultSanitizer as sanitizer };\n\ntype HTMLTags = keyof JSX.IntrinsicElements;\n\n/**\n * Refined MarkdownRendererOptions type.\n */\nexport type MarkdownRendererOptions = Partial<{\n /**\n * Ultimate control over the output of all rendered JSX.\n */\n createElement: (\n tag: Parameters<typeof createElement>[0],\n props: JSX.IntrinsicAttributes,\n ...children: ReactNode[]\n ) => ReactNode;\n\n /**\n * The library automatically generates an anchor tag for bare URLs included in the markdown\n * document, but this behavior can be disabled if desired.\n */\n disableAutoLink: boolean;\n\n /**\n * Disable the compiler's best-effort transcription of provided raw HTML\n * into JSX-equivalent.\n */\n disableParsingRawHTML: boolean;\n\n /**\n * Forces the compiler to have space between hash sign and the header text.\n */\n enforceAtxHeadings: boolean;\n\n /**\n * Forces the compiler to always output content with a block-level wrapper.\n */\n forceBlock: boolean;\n\n /**\n * Forces the compiler to always output content with an inline wrapper.\n */\n forceInline: boolean;\n\n /**\n * Forces the compiler to wrap results, even if there is only a single child.\n */\n forceWrapper: boolean;\n\n /**\n * Supply additional HTML entity: unicode replacement mappings.\n */\n namedCodesToUnicode: {\n [key: string]: string;\n };\n\n /**\n * Selectively control the output of particular HTML tags.\n */\n components: HTMLComponents;\n\n /**\n * Allows for full control over rendering of particular rules.\n */\n renderRule: RenderRuleHook;\n\n /**\n * Override the built-in sanitizer function for URLs.\n */\n sanitizer: (value: string, tag: HTMLTags, attribute: string) => string | null;\n\n /**\n * Override normalization of non-URI-safe characters for anchor linking.\n */\n slugify: (input: string) => string;\n\n /**\n * Declare the type of the wrapper to be used when there are multiple children.\n */\n wrapper: any | null;\n\n /**\n * Whether to preserve frontmatter in the markdown content.\n */\n preserveFrontmatter: boolean;\n\n /**\n * Whether to use the GitHub Tag Filter.\n */\n tagfilter: boolean;\n}>;\n\n/**\n * Default React runtime for markdown rendering.\n */\nconst DEFAULT_RUNTIME: MarkdownRuntime = {\n createElement: createElement as any,\n cloneElement,\n Fragment,\n normalizeProps: (_tag, props) => props,\n};\n\n/**\n * Compile markdown to React elements.\n * This is the primary export - use this for new code.\n */\nexport const compileMarkdown = (\n markdown: string = '',\n options: MarkdownRendererOptions = {}\n): JSX.Element => {\n const {\n createElement: customCreateElement,\n disableAutoLink,\n disableParsingRawHTML,\n enforceAtxHeadings,\n forceBlock,\n forceInline,\n forceWrapper,\n namedCodesToUnicode,\n components,\n renderRule,\n sanitizer,\n slugify,\n wrapper,\n preserveFrontmatter,\n tagfilter,\n } = options;\n\n const runtime = customCreateElement\n ? { ...DEFAULT_RUNTIME, createElement: customCreateElement as any }\n : DEFAULT_RUNTIME;\n\n const ctx: MarkdownContext<HTMLComponents> = {\n runtime,\n components,\n namedCodesToUnicode,\n sanitizer: sanitizer as any,\n slugify,\n };\n\n const compilerOptions: MarkdownOptions = {\n disableAutoLink,\n disableParsingRawHTML,\n enforceAtxHeadings,\n forceBlock,\n forceInline,\n forceWrapper,\n renderRule,\n wrapper,\n preserveFrontmatter,\n tagfilter,\n };\n\n return coreCompile(markdown, ctx, compilerOptions) as JSX.Element;\n};\n\n// Backward compatibility aliases\nexport const compiler = compileMarkdown;\nexport const compile = compileMarkdown;\n\n/**\n * React component that renders markdown to JSX (legacy).\n */\nexport const LegacyMarkdownRenderer: FC<\n Omit<HTMLAttributes<Element>, 'children'> & {\n children: string;\n options?: MarkdownRendererOptions;\n }\n> = ({ children = '', options, ...props }) => {\n if (process.env.NODE_ENV !== 'production' && typeof children !== 'string') {\n console.error(\n 'intlayer: <Markdown> component only accepts a single string as a child, received:',\n children\n );\n }\n\n return cloneElement(\n compiler(children, options),\n props as JSX.IntrinsicAttributes\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AA8HA,MAAM,kBAAmC;CACvC,eAAeA;CACf;CACA;CACA,iBAAiB,MAAM,UAAU;CAClC;;;;;AAMD,MAAa,mBACX,WAAmB,IACnB,UAAmC,EAAE,KACrB;CAChB,MAAM,EACJ,eAAe,qBACf,iBACA,uBACA,oBACA,YACA,aACA,cACA,qBACA,YACA,YACA,WACA,SACA,SACA,qBACA,cACE;AA2BJ,oCAAmB,UArB0B;EAC3C,SALc,sBACZ;GAAE,GAAG;GAAiB,eAAe;GAA4B,GACjE;EAIF;EACA;EACW;EACX;EACD,EAEwC;EACvC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAEiD;;AAIpD,MAAa,WAAW;AACxB,MAAa,UAAU;;;;AAKvB,MAAa,0BAKR,EAAE,WAAW,IAAI,SAAS,GAAG,YAAY;AAC5C,KAAI,QAAQ,IAAI,aAAa,gBAAgB,OAAO,aAAa,SAC/D,SAAQ,MACN,qFACA,SACD;AAGH,gCACE,SAAS,UAAU,QAAQ,EAC3B,MACD"}
@@ -1,5 +1,5 @@
1
- Object.defineProperty(exports, '__esModule', { value: true });
2
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
3
  let react = require("react");
4
4
 
5
5
  //#region src/markdown/runtime.ts
@@ -36,10 +36,9 @@ const createReactRuntime = (options = {}) => {
36
36
  };
37
37
  return reactRuntime;
38
38
  };
39
- var runtime_default = reactRuntime;
40
39
 
41
40
  //#endregion
42
41
  exports.createReactRuntime = createReactRuntime;
43
- exports.default = runtime_default;
42
+ exports.default = reactRuntime;
44
43
  exports.reactRuntime = reactRuntime;
45
44
  //# sourceMappingURL=runtime.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.cjs","names":[],"sources":["../../../src/markdown/runtime.ts"],"sourcesContent":["import type { HTMLTag, MarkdownRuntime } from '@intlayer/core';\nimport {\n cloneElement,\n createElement,\n Fragment,\n type ReactElement,\n type ReactNode,\n} from 'react';\n\n/**\n * React-specific runtime for the markdown processor.\n * Implements the MarkdownRuntime interface using React's primitives.\n */\nexport const reactRuntime: MarkdownRuntime = {\n /**\n * Creates a React element.\n * Handles the conversion of props and children to React format.\n */\n createElement: (\n type: string | any,\n props: Record<string, any> | null,\n ...children: any[]\n ): ReactNode => {\n // React accepts children as rest args or as a single array\n // If there's only one child, pass it directly to avoid unnecessary array\n if (children.length === 0) {\n return createElement(type, props);\n }\n if (children.length === 1) {\n return createElement(type, props, children[0]);\n }\n return createElement(type, props, ...children);\n },\n\n /**\n * Clones a React element with new props.\n */\n cloneElement: (\n element: unknown,\n props: Record<string, any>,\n ...children: any[]\n ): ReactNode => {\n if (children.length === 0) {\n return cloneElement(element as ReactElement, props);\n }\n return cloneElement(element as ReactElement, props, ...children);\n },\n\n /**\n * React Fragment component.\n */\n Fragment,\n\n /**\n * React-specific prop normalization.\n * React uses className instead of class, htmlFor instead of for, etc.\n * The core processor already handles ATTRIBUTE_TO_NODE_PROP_MAP,\n * so this is mostly a no-op but can be used for additional React-specific transforms.\n */\n normalizeProps: (\n _tag: HTMLTag,\n props: Record<string, any>\n ): Record<string, any> => {\n // The core already handles class -> className and for -> htmlFor\n // via ATTRIBUTE_TO_NODE_PROP_MAP in the attrStringToMap function.\n // This hook is available for any additional React-specific transforms.\n return props;\n },\n};\n\n/**\n * Creates a React runtime with custom createElement for advanced use cases.\n * Useful for wrapping elements or adding middleware.\n */\nexport const createReactRuntime = (\n options: {\n onCreateElement?: (\n type: string | any,\n props: Record<string, any> | null,\n children: any[]\n ) => ReactNode;\n } = {}\n): MarkdownRuntime => {\n const { onCreateElement } = options;\n\n if (onCreateElement) {\n return {\n ...reactRuntime,\n createElement: (\n type: string | any,\n props: Record<string, any> | null,\n ...children: any[]\n ): ReactNode => {\n return onCreateElement(type, props, children);\n },\n };\n }\n\n return reactRuntime;\n};\n\nexport default reactRuntime;\n"],"mappings":";;;;;;;;;AAaA,MAAa,eAAgC;CAK3C,gBACE,MACA,OACA,GAAG,aACW;AAGd,MAAI,SAAS,WAAW,EACtB,iCAAqB,MAAM,MAAM;AAEnC,MAAI,SAAS,WAAW,EACtB,iCAAqB,MAAM,OAAO,SAAS,GAAG;AAEhD,kCAAqB,MAAM,OAAO,GAAG,SAAS;;CAMhD,eACE,SACA,OACA,GAAG,aACW;AACd,MAAI,SAAS,WAAW,EACtB,gCAAoB,SAAyB,MAAM;AAErD,iCAAoB,SAAyB,OAAO,GAAG,SAAS;;CAMlE;CAQA,iBACE,MACA,UACwB;AAIxB,SAAO;;CAEV;;;;;AAMD,MAAa,sBACX,UAMI,EAAE,KACc;CACpB,MAAM,EAAE,oBAAoB;AAE5B,KAAI,gBACF,QAAO;EACL,GAAG;EACH,gBACE,MACA,OACA,GAAG,aACW;AACd,UAAO,gBAAgB,MAAM,OAAO,SAAS;;EAEhD;AAGH,QAAO;;AAGT,sBAAe"}
1
+ {"version":3,"file":"runtime.cjs","names":[],"sources":["../../../src/markdown/runtime.ts"],"sourcesContent":["import type { HTMLTag, MarkdownRuntime } from '@intlayer/core';\nimport {\n cloneElement,\n createElement,\n Fragment,\n type ReactElement,\n type ReactNode,\n} from 'react';\n\n/**\n * React-specific runtime for the markdown processor.\n * Implements the MarkdownRuntime interface using React's primitives.\n */\nexport const reactRuntime: MarkdownRuntime = {\n /**\n * Creates a React element.\n * Handles the conversion of props and children to React format.\n */\n createElement: (\n type: string | any,\n props: Record<string, any> | null,\n ...children: any[]\n ): ReactNode => {\n // React accepts children as rest args or as a single array\n // If there's only one child, pass it directly to avoid unnecessary array\n if (children.length === 0) {\n return createElement(type, props);\n }\n if (children.length === 1) {\n return createElement(type, props, children[0]);\n }\n return createElement(type, props, ...children);\n },\n\n /**\n * Clones a React element with new props.\n */\n cloneElement: (\n element: unknown,\n props: Record<string, any>,\n ...children: any[]\n ): ReactNode => {\n if (children.length === 0) {\n return cloneElement(element as ReactElement, props);\n }\n return cloneElement(element as ReactElement, props, ...children);\n },\n\n /**\n * React Fragment component.\n */\n Fragment,\n\n /**\n * React-specific prop normalization.\n * React uses className instead of class, htmlFor instead of for, etc.\n * The core processor already handles ATTRIBUTE_TO_NODE_PROP_MAP,\n * so this is mostly a no-op but can be used for additional React-specific transforms.\n */\n normalizeProps: (\n _tag: HTMLTag,\n props: Record<string, any>\n ): Record<string, any> => {\n // The core already handles class -> className and for -> htmlFor\n // via ATTRIBUTE_TO_NODE_PROP_MAP in the attrStringToMap function.\n // This hook is available for any additional React-specific transforms.\n return props;\n },\n};\n\n/**\n * Creates a React runtime with custom createElement for advanced use cases.\n * Useful for wrapping elements or adding middleware.\n */\nexport const createReactRuntime = (\n options: {\n onCreateElement?: (\n type: string | any,\n props: Record<string, any> | null,\n children: any[]\n ) => ReactNode;\n } = {}\n): MarkdownRuntime => {\n const { onCreateElement } = options;\n\n if (onCreateElement) {\n return {\n ...reactRuntime,\n createElement: (\n type: string | any,\n props: Record<string, any> | null,\n ...children: any[]\n ): ReactNode => {\n return onCreateElement(type, props, children);\n },\n };\n }\n\n return reactRuntime;\n};\n\nexport default reactRuntime;\n"],"mappings":";;;;;;;;;AAaA,MAAa,eAAgC;CAK3C,gBACE,MACA,OACA,GAAG,aACW;AAGd,MAAI,SAAS,WAAW,EACtB,iCAAqB,MAAM,MAAM;AAEnC,MAAI,SAAS,WAAW,EACtB,iCAAqB,MAAM,OAAO,SAAS,GAAG;AAEhD,kCAAqB,MAAM,OAAO,GAAG,SAAS;;CAMhD,eACE,SACA,OACA,GAAG,aACW;AACd,MAAI,SAAS,WAAW,EACtB,gCAAoB,SAAyB,MAAM;AAErD,iCAAoB,SAAyB,OAAO,GAAG,SAAS;;CAMlE;CAQA,iBACE,MACA,UACwB;AAIxB,SAAO;;CAEV;;;;;AAMD,MAAa,sBACX,UAMI,EAAE,KACc;CACpB,MAAM,EAAE,oBAAoB;AAE5B,KAAI,gBACF,QAAO;EACL,GAAG;EACH,gBACE,MACA,OACA,GAAG,aACW;AACd,UAAO,gBAAgB,MAAM,OAAO,SAAS;;EAEhD;AAGH,QAAO"}
@@ -1,4 +1,5 @@
1
- const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
3
  const require_IntlayerNode = require('./IntlayerNode.cjs');
3
4
  const require_editor_ContentSelectorWrapper = require('./editor/ContentSelectorWrapper.cjs');
4
5
  const require_editor_useEditedContentRenderer = require('./editor/useEditedContentRenderer.cjs');