@ndla/article-converter 10.0.138-alpha.0 → 10.0.140-alpha.0

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 (124) hide show
  1. package/es/{extractEmbedMeta.js → extractEmbedMeta.mjs} +1 -1
  2. package/es/extractEmbedMeta.mjs.map +1 -0
  3. package/es/{index.js → index.mjs} +2 -2
  4. package/es/plugins/{anchorPlugin.js → anchorPlugin.mjs} +1 -1
  5. package/es/plugins/anchorPlugin.mjs.map +1 -0
  6. package/es/plugins/{asidePlugin.js → asidePlugin.mjs} +1 -1
  7. package/es/plugins/asidePlugin.mjs.map +1 -0
  8. package/es/plugins/{blockquotePlugin.js → blockquotePlugin.mjs} +1 -1
  9. package/es/plugins/blockquotePlugin.mjs.map +1 -0
  10. package/es/plugins/{copyParagraphPlugin.js → copyParagraphPlugin.mjs} +1 -1
  11. package/es/plugins/copyParagraphPlugin.mjs.map +1 -0
  12. package/es/plugins/{detailsPlugin.js → detailsPlugin.mjs} +1 -1
  13. package/es/plugins/detailsPlugin.mjs.map +1 -0
  14. package/es/plugins/{divPlugin.js → divPlugin.mjs} +1 -1
  15. package/es/plugins/divPlugin.mjs.map +1 -0
  16. package/es/plugins/{dlPlugin.js → dlPlugin.mjs} +1 -1
  17. package/es/plugins/dlPlugin.mjs.map +1 -0
  18. package/es/plugins/embed/{KeyFigureEmbedPlugin.js → KeyFigureEmbedPlugin.mjs} +1 -1
  19. package/es/plugins/embed/KeyFigureEmbedPlugin.mjs.map +1 -0
  20. package/es/plugins/embed/{audioEmbedPlugin.js → audioEmbedPlugin.mjs} +1 -1
  21. package/es/plugins/embed/audioEmbedPlugin.mjs.map +1 -0
  22. package/es/plugins/embed/{brightcoveEmbedPlugin.js → brightcoveEmbedPlugin.mjs} +1 -1
  23. package/es/plugins/embed/brightcoveEmbedPlugin.mjs.map +1 -0
  24. package/es/plugins/embed/{campaignBlockPlugin.js → campaignBlockPlugin.mjs} +1 -1
  25. package/es/plugins/embed/campaignBlockPlugin.mjs.map +1 -0
  26. package/es/plugins/embed/{codeEmbedPlugin.js → codeEmbedPlugin.mjs} +1 -1
  27. package/es/plugins/embed/codeEmbedPlugin.mjs.map +1 -0
  28. package/es/plugins/embed/{conceptEmbedPlugin.js → conceptEmbedPlugin.mjs} +1 -1
  29. package/es/plugins/embed/conceptEmbedPlugin.mjs.map +1 -0
  30. package/es/plugins/embed/{contactBlockEmbedPlugin.js → contactBlockEmbedPlugin.mjs} +1 -1
  31. package/es/plugins/embed/contactBlockEmbedPlugin.mjs.map +1 -0
  32. package/es/plugins/embed/{contentLinkEmbedPlugin.js → contentLinkEmbedPlugin.mjs} +1 -1
  33. package/es/plugins/embed/contentLinkEmbedPlugin.mjs.map +1 -0
  34. package/es/plugins/embed/{copyrightEmbedPlugin.js → copyrightEmbedPlugin.mjs} +1 -1
  35. package/es/plugins/embed/copyrightEmbedPlugin.mjs.map +1 -0
  36. package/es/plugins/embed/{externalEmbedPlugin.js → externalEmbedPlugin.mjs} +1 -1
  37. package/es/plugins/embed/externalEmbedPlugin.mjs.map +1 -0
  38. package/es/plugins/embed/{fileEmbedPlugin.js → fileEmbedPlugin.mjs} +1 -1
  39. package/es/plugins/embed/fileEmbedPlugin.mjs.map +1 -0
  40. package/es/plugins/embed/{footnoteEmbedPlugin.js → footnoteEmbedPlugin.mjs} +1 -1
  41. package/es/plugins/embed/footnoteEmbedPlugin.mjs.map +1 -0
  42. package/es/plugins/embed/{h5pEmbedPlugin.js → h5pEmbedPlugin.mjs} +1 -1
  43. package/es/plugins/embed/h5pEmbedPlugin.mjs.map +1 -0
  44. package/es/plugins/embed/{iframeEmbedPlugin.js → iframeEmbedPlugin.mjs} +1 -1
  45. package/es/plugins/embed/iframeEmbedPlugin.mjs.map +1 -0
  46. package/es/plugins/embed/{imageEmbedPlugin.js → imageEmbedPlugin.mjs} +1 -1
  47. package/es/plugins/embed/imageEmbedPlugin.mjs.map +1 -0
  48. package/es/plugins/embed/index.mjs +48 -0
  49. package/es/plugins/embed/index.mjs.map +1 -0
  50. package/es/plugins/embed/{linkBlockEmbedPlugin.js → linkBlockEmbedPlugin.mjs} +1 -1
  51. package/es/plugins/embed/linkBlockEmbedPlugin.mjs.map +1 -0
  52. package/es/plugins/embed/{pitchEmbedPlugin.js → pitchEmbedPlugin.mjs} +1 -1
  53. package/es/plugins/embed/pitchEmbedPlugin.mjs.map +1 -0
  54. package/es/plugins/embed/{relatedContentEmbedPlugin.js → relatedContentEmbedPlugin.mjs} +1 -1
  55. package/es/plugins/embed/relatedContentEmbedPlugin.mjs.map +1 -0
  56. package/es/plugins/embed/{symbolEmbedPlugin.js → symbolEmbedPlugin.mjs} +1 -1
  57. package/es/plugins/embed/symbolEmbedPlugin.mjs.map +1 -0
  58. package/es/plugins/embed/{uuDisclaimerEmbedPlugin.js → uuDisclaimerEmbedPlugin.mjs} +2 -2
  59. package/es/plugins/embed/uuDisclaimerEmbedPlugin.mjs.map +1 -0
  60. package/es/plugins/{h3Plugin.js → h3Plugin.mjs} +1 -1
  61. package/es/plugins/h3Plugin.mjs.map +1 -0
  62. package/es/plugins/index.mjs +43 -0
  63. package/es/plugins/index.mjs.map +1 -0
  64. package/es/plugins/{mathPlugin.js → mathPlugin.mjs} +1 -1
  65. package/es/plugins/mathPlugin.mjs.map +1 -0
  66. package/es/plugins/{navPlugin.js → navPlugin.mjs} +1 -1
  67. package/es/plugins/navPlugin.mjs.map +1 -0
  68. package/es/plugins/oembed/{anchorPlugin.js → anchorPlugin.mjs} +1 -1
  69. package/es/plugins/oembed/anchorPlugin.mjs.map +1 -0
  70. package/es/plugins/{olPlugin.js → olPlugin.mjs} +1 -1
  71. package/es/plugins/olPlugin.mjs.map +1 -0
  72. package/es/plugins/{paragraphPlugin.js → paragraphPlugin.mjs} +1 -1
  73. package/es/plugins/paragraphPlugin.mjs.map +1 -0
  74. package/es/plugins/{summaryPlugin.js → summaryPlugin.mjs} +1 -1
  75. package/es/plugins/summaryPlugin.mjs.map +1 -0
  76. package/es/plugins/{tablePlugin.js → tablePlugin.mjs} +1 -1
  77. package/es/plugins/tablePlugin.mjs.map +1 -0
  78. package/es/plugins/{ulPlugin.js → ulPlugin.mjs} +1 -1
  79. package/es/plugins/ulPlugin.mjs.map +1 -0
  80. package/es/{transform.js → transform.mjs} +3 -3
  81. package/es/transform.mjs.map +1 -0
  82. package/package.json +11 -8
  83. package/es/extractEmbedMeta.js.map +0 -1
  84. package/es/plugins/anchorPlugin.js.map +0 -1
  85. package/es/plugins/asidePlugin.js.map +0 -1
  86. package/es/plugins/blockquotePlugin.js.map +0 -1
  87. package/es/plugins/copyParagraphPlugin.js.map +0 -1
  88. package/es/plugins/detailsPlugin.js.map +0 -1
  89. package/es/plugins/divPlugin.js.map +0 -1
  90. package/es/plugins/dlPlugin.js.map +0 -1
  91. package/es/plugins/embed/KeyFigureEmbedPlugin.js.map +0 -1
  92. package/es/plugins/embed/audioEmbedPlugin.js.map +0 -1
  93. package/es/plugins/embed/brightcoveEmbedPlugin.js.map +0 -1
  94. package/es/plugins/embed/campaignBlockPlugin.js.map +0 -1
  95. package/es/plugins/embed/codeEmbedPlugin.js.map +0 -1
  96. package/es/plugins/embed/conceptEmbedPlugin.js.map +0 -1
  97. package/es/plugins/embed/contactBlockEmbedPlugin.js.map +0 -1
  98. package/es/plugins/embed/contentLinkEmbedPlugin.js.map +0 -1
  99. package/es/plugins/embed/copyrightEmbedPlugin.js.map +0 -1
  100. package/es/plugins/embed/externalEmbedPlugin.js.map +0 -1
  101. package/es/plugins/embed/fileEmbedPlugin.js.map +0 -1
  102. package/es/plugins/embed/footnoteEmbedPlugin.js.map +0 -1
  103. package/es/plugins/embed/h5pEmbedPlugin.js.map +0 -1
  104. package/es/plugins/embed/iframeEmbedPlugin.js.map +0 -1
  105. package/es/plugins/embed/imageEmbedPlugin.js.map +0 -1
  106. package/es/plugins/embed/index.js +0 -48
  107. package/es/plugins/embed/index.js.map +0 -1
  108. package/es/plugins/embed/linkBlockEmbedPlugin.js.map +0 -1
  109. package/es/plugins/embed/pitchEmbedPlugin.js.map +0 -1
  110. package/es/plugins/embed/relatedContentEmbedPlugin.js.map +0 -1
  111. package/es/plugins/embed/symbolEmbedPlugin.js.map +0 -1
  112. package/es/plugins/embed/uuDisclaimerEmbedPlugin.js.map +0 -1
  113. package/es/plugins/h3Plugin.js.map +0 -1
  114. package/es/plugins/index.js +0 -43
  115. package/es/plugins/index.js.map +0 -1
  116. package/es/plugins/mathPlugin.js.map +0 -1
  117. package/es/plugins/navPlugin.js.map +0 -1
  118. package/es/plugins/oembed/anchorPlugin.js.map +0 -1
  119. package/es/plugins/olPlugin.js.map +0 -1
  120. package/es/plugins/paragraphPlugin.js.map +0 -1
  121. package/es/plugins/summaryPlugin.js.map +0 -1
  122. package/es/plugins/tablePlugin.js.map +0 -1
  123. package/es/plugins/ulPlugin.js.map +0 -1
  124. package/es/transform.js.map +0 -1
@@ -17,4 +17,4 @@ var extractEmbedMeta_default = extractEmbedMeta;
17
17
 
18
18
  //#endregion
19
19
  export { extractEmbedMeta_default, extractEmbedMetas };
20
- //# sourceMappingURL=extractEmbedMeta.js.map
20
+ //# sourceMappingURL=extractEmbedMeta.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractEmbedMeta.mjs","names":["embed: string"],"sources":["../src/extractEmbedMeta.ts"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport parse from \"html-react-parser\";\nimport { type EmbedMetaData } from \"@ndla/types-embed\";\n\nconst extractEmbedMeta = (embed: string): EmbedMetaData | undefined => {\n const node = parse(embed);\n if (typeof node === \"string\" || Array.isArray(node) || node.type !== \"ndlaembed\" || !node.props[\"data-json\"]) {\n return;\n }\n\n return JSON.parse(node.props[\"data-json\"]) as EmbedMetaData;\n};\n\nexport const extractEmbedMetas = (embed: string): EmbedMetaData[] => {\n const nodes = parse(embed);\n\n // There are no embeds in the string\n if (typeof nodes === \"string\") {\n return [];\n }\n // There is only one embed in the string\n else if (!Array.isArray(nodes) && nodes.type === \"ndlaembed\" && !!nodes.props[\"data-json\"]) {\n return [JSON.parse(nodes.props[\"data-json\"]) as EmbedMetaData];\n }\n // There are multiple embeds in the string\n else if (\n Array.isArray(nodes) &&\n nodes.length &&\n nodes.every((n) => n.type === \"ndlaembed\" && !!n.props[\"data-json\"])\n ) {\n return nodes.map((n) => JSON.parse(n.props[\"data-json\"]) as EmbedMetaData);\n } else {\n return [];\n }\n};\n\nexport default extractEmbedMeta;\n"],"mappings":";;;AAWA,MAAM,mBAAmB,CAACA,UAA6C;CACrE,MAAM,OAAO,MAAM,MAAM;AACzB,YAAW,SAAS,YAAY,MAAM,QAAQ,KAAK,IAAI,KAAK,SAAS,gBAAgB,KAAK,MAAM,aAC9F;AAGF,QAAO,KAAK,MAAM,KAAK,MAAM,aAAa;AAC3C;AAED,MAAa,oBAAoB,CAACA,UAAmC;CACnE,MAAM,QAAQ,MAAM,MAAM;AAG1B,YAAW,UAAU,SACnB,QAAO,CAAE;WAGD,MAAM,QAAQ,MAAM,IAAI,MAAM,SAAS,iBAAiB,MAAM,MAAM,aAC5E,QAAO,CAAC,KAAK,MAAM,MAAM,MAAM,aAAa,AAAkB;UAI9D,MAAM,QAAQ,MAAM,IACpB,MAAM,UACN,MAAM,MAAM,CAAC,MAAM,EAAE,SAAS,iBAAiB,EAAE,MAAM,aAAa,CAEpE,QAAO,MAAM,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE,MAAM,aAAa,CAAkB;KAE1E,QAAO,CAAE;AAEZ;AAED,+BAAe"}
@@ -1,4 +1,4 @@
1
- import { transform_default } from "./transform.js";
2
- import { extractEmbedMeta_default, extractEmbedMetas } from "./extractEmbedMeta.js";
1
+ import { transform_default } from "./transform.mjs";
2
+ import { extractEmbedMeta_default, extractEmbedMetas } from "./extractEmbedMeta.mjs";
3
3
 
4
4
  export { extractEmbedMeta_default as extractEmbedMeta, extractEmbedMetas, transform_default as transform };
@@ -16,4 +16,4 @@ const anchorPlugin = (node, opts, { path }) => {
16
16
 
17
17
  //#endregion
18
18
  export { anchorPlugin };
19
- //# sourceMappingURL=anchorPlugin.js.map
19
+ //# sourceMappingURL=anchorPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anchorPlugin.mjs","names":["anchorPlugin: PluginType"],"sources":["../../src/plugins/anchorPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { getPossiblyRelativeUrl } from \"@ndla/ui\";\nimport { type PluginType } from \"./types\";\n\nexport const anchorPlugin: PluginType = (node, opts, { path }) => {\n const props = attributesToProps(node.attribs);\n const href = getPossiblyRelativeUrl(props.href as string, path);\n\n return (\n <SafeLink {...props} to={href}>\n {domToReact(node.children as DOMNode[], opts)}\n </SafeLink>\n );\n};\n"],"mappings":";;;;;;AAaA,MAAaA,eAA2B,CAAC,MAAM,MAAM,EAAE,MAAM,KAAK;CAChE,MAAM,QAAQ,kBAAkB,KAAK,QAAQ;CAC7C,MAAM,OAAO,uBAAuB,MAAM,MAAgB,KAAK;AAE/D,wBACE,IAAC;EAAS,GAAI;EAAO,IAAI;YACtB,WAAW,KAAK,UAAuB,KAAK;GACpC;AAEd"}
@@ -10,4 +10,4 @@ const asidePlugin = (node, opts) => {
10
10
 
11
11
  //#endregion
12
12
  export { asidePlugin };
13
- //# sourceMappingURL=asidePlugin.js.map
13
+ //# sourceMappingURL=asidePlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asidePlugin.mjs","names":["asidePlugin: PluginType"],"sources":["../../src/plugins/asidePlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, domToReact } from \"html-react-parser\";\nimport { FactBox } from \"@ndla/ui\";\nimport { type PluginType } from \"./types\";\nexport const asidePlugin: PluginType = (node, opts) => {\n if (node.attribs[\"data-type\"] === \"factAside\") {\n return <FactBox>{domToReact(node.children as DOMNode[], opts)}</FactBox>;\n }\n return null;\n};\n"],"mappings":";;;;;AAWA,MAAaA,cAA0B,CAAC,MAAM,SAAS;AACrD,KAAI,KAAK,QAAQ,iBAAiB,YAChC,wBAAO,IAAC,qBAAS,WAAW,KAAK,UAAuB,KAAK,GAAW;AAE1E,QAAO;AACR"}
@@ -15,4 +15,4 @@ const blockquotePlugin = (node, opts, { contentType }) => {
15
15
 
16
16
  //#endregion
17
17
  export { blockquotePlugin };
18
- //# sourceMappingURL=blockquotePlugin.js.map
18
+ //# sourceMappingURL=blockquotePlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blockquotePlugin.mjs","names":["blockquotePlugin: PluginType"],"sources":["../../src/plugins/blockquotePlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport { ContentTypeBlockQuote, type ContentTypeBlockQuoteVariant } from \"@ndla/ui\";\nimport { type PluginType } from \"./types\";\n\nexport const blockquotePlugin: PluginType = (node, opts, { contentType }) => {\n const { \"data-variant\": variant, ...props } = attributesToProps(node.attribs);\n return (\n <ContentTypeBlockQuote\n {...props}\n variant={variant as ContentTypeBlockQuoteVariant | undefined}\n contentType={contentType}\n >\n {domToReact(node.children as DOMNode[], opts)}\n </ContentTypeBlockQuote>\n );\n};\n"],"mappings":";;;;;AAYA,MAAaA,mBAA+B,CAAC,MAAM,MAAM,EAAE,aAAa,KAAK;CAC3E,MAAM,EAAE,gBAAgB,QAAS,GAAG,OAAO,GAAG,kBAAkB,KAAK,QAAQ;AAC7E,wBACE,IAAC;EACC,GAAI;EACK;EACI;YAEZ,WAAW,KAAK,UAAuB,KAAK;GACvB;AAE3B"}
@@ -15,4 +15,4 @@ const copyParagraphPlugin = (node, converterOpts, opts) => {
15
15
 
16
16
  //#endregion
17
17
  export { copyParagraphPlugin };
18
- //# sourceMappingURL=copyParagraphPlugin.js.map
18
+ //# sourceMappingURL=copyParagraphPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copyParagraphPlugin.mjs","names":["copyParagraphPlugin: PluginType"],"sources":["../../src/plugins/copyParagraphPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, Element, domToReact } from \"html-react-parser\";\nimport { CopyParagraphButton } from \"@ndla/ui\";\nimport { type PluginType } from \"./types\";\nexport const copyParagraphPlugin: PluginType = (node, converterOpts, opts) => {\n const parent = node.parent as Element | undefined;\n if (\n parent?.name === \"section\" ||\n (parent?.name === \"div\" && Object.keys(parent.attribs ?? {}).length === 0) ||\n (parent?.name === \"ndlaembed\" && parent.attribs[\"data-resource\"] === \"uu-disclaimer\")\n ) {\n return (\n <CopyParagraphButton copyText={node.attribs[\"data-text\"]} lang={opts.articleLanguage}>\n {domToReact(node.children as DOMNode[], converterOpts)}\n </CopyParagraphButton>\n );\n }\n return null;\n};\n"],"mappings":";;;;;AAWA,MAAaA,sBAAkC,CAAC,MAAM,eAAe,SAAS;CAC5E,MAAM,SAAS,KAAK;AACpB,KACE,QAAQ,SAAS,aAChB,QAAQ,SAAS,SAAS,OAAO,KAAK,OAAO,WAAW,CAAE,EAAC,CAAC,WAAW,KACvE,QAAQ,SAAS,eAAe,OAAO,QAAQ,qBAAqB,gBAErE,wBACE,IAAC;EAAoB,UAAU,KAAK,QAAQ;EAAc,MAAM,KAAK;YAClE,WAAW,KAAK,UAAuB,cAAc;GAClC;AAG1B,QAAO;AACR"}
@@ -13,4 +13,4 @@ const detailsPlugin = (node, converterOpts) => {
13
13
 
14
14
  //#endregion
15
15
  export { detailsPlugin };
16
- //# sourceMappingURL=detailsPlugin.js.map
16
+ //# sourceMappingURL=detailsPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detailsPlugin.mjs","names":["detailsPlugin: PluginType"],"sources":["../../src/plugins/detailsPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport { ExpandableBox } from \"@ndla/primitives\";\nimport { type PluginType } from \"./types\";\n\nexport const detailsPlugin: PluginType = (node, converterOpts) => {\n const props = attributesToProps(node.attribs);\n\n return <ExpandableBox {...props}>{domToReact(node.children as DOMNode[], converterOpts)}</ExpandableBox>;\n};\n"],"mappings":";;;;;AAYA,MAAaA,gBAA4B,CAAC,MAAM,kBAAkB;CAChE,MAAM,QAAQ,kBAAkB,KAAK,QAAQ;AAE7C,wBAAO,IAAC;EAAc,GAAI;YAAQ,WAAW,KAAK,UAAuB,cAAc;GAAiB;AACzG"}
@@ -48,4 +48,4 @@ const divPlugin = (node, opts, { contentType }) => {
48
48
 
49
49
  //#endregion
50
50
  export { divPlugin };
51
- //# sourceMappingURL=divPlugin.js.map
51
+ //# sourceMappingURL=divPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"divPlugin.mjs","names":["divPlugin: PluginType"],"sources":["../../src/plugins/divPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { domToReact, attributesToProps, Element, type DOMNode } from \"html-react-parser\";\nimport {\n FileListEmbed,\n RelatedArticleList,\n Grid,\n type GridType,\n GridParallaxItem,\n ContentTypeFramedContent,\n type ContentTypeFramedContentVariant,\n} from \"@ndla/ui\";\nimport { type PluginType } from \"./types\";\n\nexport const divPlugin: PluginType = (node, opts, { contentType }) => {\n if (node.attribs[\"data-type\"] === \"framed-content\" || node.attribs.class === \"c-bodybox\") {\n const { \"data-variant\": variant, ...props } = attributesToProps(node.attribs);\n return (\n <ContentTypeFramedContent\n contentType={contentType}\n variant={variant as ContentTypeFramedContentVariant | undefined}\n {...props}\n >\n {domToReact(node.children as DOMNode[], opts)}\n </ContentTypeFramedContent>\n );\n }\n if (node.attribs[\"data-type\"] === \"related-content\" && node.children.length) {\n const props = attributesToProps(node.attribs);\n\n return (\n <RelatedArticleList {...props}>\n {/* @ts-expect-error - This works, the types just won't match entirely */}\n {domToReact(node.children, opts)}\n </RelatedArticleList>\n );\n }\n if (node.attribs[\"data-type\"] === \"file\" && node.childNodes.length) {\n const elements = node.childNodes.filter(\n (c): c is Element => c.type === \"tag\" && c.name === \"ndlaembed\" && c.attribs[\"data-resource\"] === \"file\",\n );\n const [pdfs, files] = elements.reduce<[Element[], Element[]]>(\n (acc, el) => {\n const arr = el.attribs[\"data-type\"] === \"pdf\" && el.attribs[\"data-display\"] === \"block\" ? acc[0] : acc[1];\n arr.push(el);\n return acc;\n },\n [[], []],\n );\n\n return (\n <>\n {files.length ? <FileListEmbed>{domToReact(files, opts)}</FileListEmbed> : undefined}\n {domToReact(pdfs, opts)}\n </>\n );\n }\n if (node.attribs[\"data-type\"] === \"grid\" && node.children.length > 0) {\n const props = attributesToProps(node.attribs);\n const columns = props[\"data-columns\"] as GridType[\"columns\"];\n const border = props[\"data-border\"] as GridType[\"border\"];\n const background = props[\"data-background\"] as GridType[\"background\"];\n return (\n <Grid border={border} columns={columns} background={background} {...props}>\n {/* @ts-expect-error - This works, the types just won't match entirely */}\n {domToReact(node.children, opts)}\n </Grid>\n );\n }\n if (node.attribs[\"data-parallax-cell\"] === \"true\" && node.children.length) {\n return <GridParallaxItem>{domToReact(node.children as DOMNode[], opts)}</GridParallaxItem>;\n }\n return null;\n};\n"],"mappings":";;;;;AAoBA,MAAaA,YAAwB,CAAC,MAAM,MAAM,EAAE,aAAa,KAAK;AACpE,KAAI,KAAK,QAAQ,iBAAiB,oBAAoB,KAAK,QAAQ,UAAU,aAAa;EACxF,MAAM,EAAE,gBAAgB,QAAS,GAAG,OAAO,GAAG,kBAAkB,KAAK,QAAQ;AAC7E,yBACE,IAAC;GACc;GACJ;GACT,GAAI;aAEH,WAAW,KAAK,UAAuB,KAAK;IACpB;CAE9B;AACD,KAAI,KAAK,QAAQ,iBAAiB,qBAAqB,KAAK,SAAS,QAAQ;EAC3E,MAAM,QAAQ,kBAAkB,KAAK,QAAQ;AAE7C,yBACE,IAAC;GAAmB,GAAI;aAErB,WAAW,KAAK,UAAU,KAAK;IACb;CAExB;AACD,KAAI,KAAK,QAAQ,iBAAiB,UAAU,KAAK,WAAW,QAAQ;EAClE,MAAM,WAAW,KAAK,WAAW,OAC/B,CAAC,MAAoB,EAAE,SAAS,SAAS,EAAE,SAAS,eAAe,EAAE,QAAQ,qBAAqB,OACnG;EACD,MAAM,CAAC,MAAM,MAAM,GAAG,SAAS,OAC7B,CAAC,KAAK,OAAO;GACX,MAAM,MAAM,GAAG,QAAQ,iBAAiB,SAAS,GAAG,QAAQ,oBAAoB,UAAU,IAAI,KAAK,IAAI;AACvG,OAAI,KAAK,GAAG;AACZ,UAAO;EACR,GACD,CAAC,CAAE,GAAE,CAAE,CAAC,EACT;AAED,yBACE,4BACG,MAAM,yBAAS,IAAC,2BAAe,WAAW,OAAO,KAAK,GAAiB,WACvE,WAAW,MAAM,KAAK,IACtB;CAEN;AACD,KAAI,KAAK,QAAQ,iBAAiB,UAAU,KAAK,SAAS,SAAS,GAAG;EACpE,MAAM,QAAQ,kBAAkB,KAAK,QAAQ;EAC7C,MAAM,UAAU,MAAM;EACtB,MAAM,SAAS,MAAM;EACrB,MAAM,aAAa,MAAM;AACzB,yBACE,IAAC;GAAa;GAAiB;GAAqB;GAAY,GAAI;aAEjE,WAAW,KAAK,UAAU,KAAK;IAC3B;CAEV;AACD,KAAI,KAAK,QAAQ,0BAA0B,UAAU,KAAK,SAAS,OACjE,wBAAO,IAAC,8BAAkB,WAAW,KAAK,UAAuB,KAAK,GAAoB;AAE5F,QAAO;AACR"}
@@ -14,4 +14,4 @@ const dlPlugin = (node, converterOpts, opts) => {
14
14
 
15
15
  //#endregion
16
16
  export { dlPlugin };
17
- //# sourceMappingURL=dlPlugin.js.map
17
+ //# sourceMappingURL=dlPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dlPlugin.mjs","names":["dlPlugin: PluginType"],"sources":["../../src/plugins/dlPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport { DefinitionList } from \"@ndla/primitives\";\nimport { type PluginType } from \"./types\";\n\nexport const dlPlugin: PluginType = (node, converterOpts, opts) => {\n const props = attributesToProps(node.attribs);\n\n return (\n <DefinitionList {...props} lang={opts.articleLanguage}>\n {domToReact(node.children as DOMNode[], converterOpts)}\n </DefinitionList>\n );\n};\n"],"mappings":";;;;;AAYA,MAAaA,WAAuB,CAAC,MAAM,eAAe,SAAS;CACjE,MAAM,QAAQ,kBAAkB,KAAK,QAAQ;AAE7C,wBACE,IAAC;EAAe,GAAI;EAAO,MAAM,KAAK;YACnC,WAAW,KAAK,UAAuB,cAAc;GACvC;AAEpB"}
@@ -19,4 +19,4 @@ const keyFigureEmbedPlugin = (element) => {
19
19
 
20
20
  //#endregion
21
21
  export { keyFigureEmbedPlugin };
22
- //# sourceMappingURL=KeyFigureEmbedPlugin.js.map
22
+ //# sourceMappingURL=KeyFigureEmbedPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyFigureEmbedPlugin.mjs","names":["keyFigureEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/KeyFigureEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type KeyFigureMetaData } from \"@ndla/types-embed\";\nimport { KeyFigure } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const keyFigureEmbedPlugin: PluginType = (element) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as KeyFigureMetaData;\n const { title, subtitle, alt } = data.embedData;\n return (\n <KeyFigure\n title={title}\n subtitle={subtitle}\n image={\n data.status === \"success\" && data.data.metaImage\n ? {\n src: data.data.metaImage.image.imageUrl,\n alt: alt === undefined ? \"\" : alt,\n }\n : undefined\n }\n />\n );\n};\n"],"mappings":";;;;;AAaA,MAAaA,uBAAmC,CAAC,YAAY;CAC3D,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;CAChD,MAAM,OAAO,KAAK,MAAM,MAAM,aAAuB;CACrD,MAAM,EAAE,OAAO,UAAU,KAAK,GAAG,KAAK;AACtC,wBACE,IAAC;EACQ;EACG;EACV,OACE,KAAK,WAAW,aAAa,KAAK,KAAK,YACnC;GACE,KAAK,KAAK,KAAK,UAAU,MAAM;GAC/B,KAAK,iBAAoB,KAAK;EAC/B;GAGP;AAEL"}
@@ -14,4 +14,4 @@ const audioEmbedPlugin = (element, _, opts) => {
14
14
 
15
15
  //#endregion
16
16
  export { audioEmbedPlugin };
17
- //# sourceMappingURL=audioEmbedPlugin.js.map
17
+ //# sourceMappingURL=audioEmbedPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audioEmbedPlugin.mjs","names":["audioEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/audioEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type AudioMetaData } from \"@ndla/types-embed\";\nimport { AudioEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const audioEmbedPlugin: PluginType = (element, _, opts) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as AudioMetaData;\n return <AudioEmbed embed={data} lang={opts.articleLanguage} />;\n};\n"],"mappings":";;;;;AAaA,MAAaA,mBAA+B,CAAC,SAAS,GAAG,SAAS;CAChE,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;CAChD,MAAM,OAAO,KAAK,MAAM,MAAM,aAAuB;AACrD,wBAAO,IAAC;EAAW,OAAO;EAAM,MAAM,KAAK;GAAmB;AAC/D"}
@@ -15,4 +15,4 @@ const brightcoveEmbedPlugin = (element, _, opts) => {
15
15
 
16
16
  //#endregion
17
17
  export { brightcoveEmbedPlugin };
18
- //# sourceMappingURL=brightcoveEmbedPlugin.js.map
18
+ //# sourceMappingURL=brightcoveEmbedPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brightcoveEmbedPlugin.mjs","names":["brightcoveEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/brightcoveEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type BrightcoveMetaData } from \"@ndla/types-embed\";\nimport { BrightcoveEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const brightcoveEmbedPlugin: PluginType = (element, _, opts) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as BrightcoveMetaData;\n return <BrightcoveEmbed embed={data} renderContext={opts.renderContext} lang={opts.articleLanguage} />;\n};\n"],"mappings":";;;;;AAaA,MAAaA,wBAAoC,CAAC,SAAS,GAAG,SAAS;CACrE,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;CAChD,MAAM,OAAO,KAAK,MAAM,MAAM,aAAuB;AACrD,wBAAO,IAAC;EAAgB,OAAO;EAAM,eAAe,KAAK;EAAe,MAAM,KAAK;GAAmB;AACvG"}
@@ -25,4 +25,4 @@ const campaignBlockPlugin = (element, _, opts) => {
25
25
 
26
26
  //#endregion
27
27
  export { campaignBlockPlugin };
28
- //# sourceMappingURL=campaignBlockPlugin.js.map
28
+ //# sourceMappingURL=campaignBlockPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"campaignBlockPlugin.mjs","names":["campaignBlockPlugin: PluginType"],"sources":["../../../src/plugins/embed/campaignBlockPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type CampaignBlockMetaData } from \"@ndla/types-embed\";\nimport { CampaignBlock } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const campaignBlockPlugin: PluginType = (element, _, opts) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as CampaignBlockMetaData;\n const embed = data.embedData;\n\n return (\n <CampaignBlock\n title={embed.title}\n description={embed.description}\n url={{ url: embed.url, text: embed.urlText }}\n path={opts.path}\n imageSide={embed.imageSide}\n image={\n data.status === \"success\" && data.data.image\n ? {\n src: data.data.image.image.imageUrl,\n alt: embed.alt === undefined ? \"\" : embed.alt,\n }\n : undefined\n }\n />\n );\n};\n"],"mappings":";;;;;AAaA,MAAaA,sBAAkC,CAAC,SAAS,GAAG,SAAS;CACnE,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;CAChD,MAAM,OAAO,KAAK,MAAM,MAAM,aAAuB;CACrD,MAAM,QAAQ,KAAK;AAEnB,wBACE,IAAC;EACC,OAAO,MAAM;EACb,aAAa,MAAM;EACnB,KAAK;GAAE,KAAK,MAAM;GAAK,MAAM,MAAM;EAAS;EAC5C,MAAM,KAAK;EACX,WAAW,MAAM;EACjB,OACE,KAAK,WAAW,aAAa,KAAK,KAAK,QACnC;GACE,KAAK,KAAK,KAAK,MAAM,MAAM;GAC3B,KAAK,MAAM,iBAAoB,KAAK,MAAM;EAC3C;GAGP;AAEL"}
@@ -11,4 +11,4 @@ const codeEmbedPlugin = (element) => {
11
11
 
12
12
  //#endregion
13
13
  export { codeEmbedPlugin };
14
- //# sourceMappingURL=codeEmbedPlugin.js.map
14
+ //# sourceMappingURL=codeEmbedPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codeEmbedPlugin.mjs","names":["codeEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/codeEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type CodeMetaData } from \"@ndla/types-embed\";\nimport { CodeEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const codeEmbedPlugin: PluginType = (element) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as CodeMetaData;\n return <CodeEmbed embed={data} />;\n};\n"],"mappings":";;;;;AAaA,MAAaA,kBAA8B,CAAC,YAAY;CACtD,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;CAChD,MAAM,OAAO,KAAK,MAAM,MAAM,aAAuB;AACrD,wBAAO,IAAC,aAAU,OAAO,OAAQ;AAClC"}
@@ -17,4 +17,4 @@ const conceptEmbedPlugin = (element, parserOpts, transformOpts) => {
17
17
 
18
18
  //#endregion
19
19
  export { conceptEmbedPlugin };
20
- //# sourceMappingURL=conceptEmbedPlugin.js.map
20
+ //# sourceMappingURL=conceptEmbedPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conceptEmbedPlugin.mjs","names":["conceptEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/conceptEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps, domToReact, type DOMNode } from \"html-react-parser\";\nimport { type ConceptMetaData } from \"@ndla/types-embed\";\nimport { ConceptEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const conceptEmbedPlugin: PluginType = (element, parserOpts, transformOpts) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as ConceptMetaData;\n return (\n <ConceptEmbed\n embed={data}\n lang={transformOpts.articleLanguage}\n renderContext={transformOpts.renderContext}\n previewAlt={transformOpts.previewAlt}\n >\n {domToReact(element.children as DOMNode[], parserOpts)}\n </ConceptEmbed>\n );\n};\n"],"mappings":";;;;;AAaA,MAAaA,qBAAiC,CAAC,SAAS,YAAY,kBAAkB;CACpF,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;CAChD,MAAM,OAAO,KAAK,MAAM,MAAM,aAAuB;AACrD,wBACE,IAAC;EACC,OAAO;EACP,MAAM,cAAc;EACpB,eAAe,cAAc;EAC7B,YAAY,cAAc;YAEzB,WAAW,QAAQ,UAAuB,WAAW;GACzC;AAElB"}
@@ -28,4 +28,4 @@ const contactBlockEmbedPlugin = (element, _, opts) => {
28
28
 
29
29
  //#endregion
30
30
  export { contactBlockEmbedPlugin };
31
- //# sourceMappingURL=contactBlockEmbedPlugin.js.map
31
+ //# sourceMappingURL=contactBlockEmbedPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contactBlockEmbedPlugin.mjs","names":["background?: string","background: string | undefined","contactBlockEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/contactBlockEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type ContactBlockMetaData } from \"@ndla/types-embed\";\nimport { ContactBlock, contactBlockBackgrounds, type ContactBlockBackground } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport function isBackground(background?: string): background is ContactBlockBackground {\n return (contactBlockBackgrounds as readonly string[]).includes(background ?? \"\");\n}\nconst parseBackground = (background: string | undefined): ContactBlockBackground | undefined => {\n if (isBackground(background)) return background;\n};\n\nexport const contactBlockEmbedPlugin: PluginType = (element, _, opts) => {\n const props = attributesToProps(element.attribs);\n const embedData = JSON.parse(props[\"data-json\"] as string) as ContactBlockMetaData;\n const { name, email, description, background, jobTitle, alt } = embedData.embedData;\n const parsedBackground = parseBackground(background);\n\n return (\n <ContactBlock\n image={embedData.status === \"success\" ? embedData.data.image : undefined}\n embedAlt={alt}\n description={description}\n email={email}\n jobTitle={jobTitle}\n name={name}\n lang={opts.articleLanguage}\n backgroundColor={parsedBackground}\n />\n );\n};\n"],"mappings":";;;;;AAaA,SAAgB,aAAaA,YAA2D;AACtF,QAAO,AAAC,wBAA8C,SAAS,cAAc,GAAG;AACjF;AACD,MAAM,kBAAkB,CAACC,eAAuE;AAC9F,KAAI,aAAa,WAAW,CAAE,QAAO;AACtC;AAED,MAAaC,0BAAsC,CAAC,SAAS,GAAG,SAAS;CACvE,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;CAChD,MAAM,YAAY,KAAK,MAAM,MAAM,aAAuB;CAC1D,MAAM,EAAE,MAAM,OAAO,aAAa,YAAY,UAAU,KAAK,GAAG,UAAU;CAC1E,MAAM,mBAAmB,gBAAgB,WAAW;AAEpD,wBACE,IAAC;EACC,OAAO,UAAU,WAAW,YAAY,UAAU,KAAK;EACvD,UAAU;EACG;EACN;EACG;EACJ;EACN,MAAM,KAAK;EACX,iBAAiB;GACjB;AAEL"}
@@ -15,4 +15,4 @@ const contentLinkEmbedPlugin = (element, opts, { isOembed }) => {
15
15
 
16
16
  //#endregion
17
17
  export { contentLinkEmbedPlugin };
18
- //# sourceMappingURL=contentLinkEmbedPlugin.js.map
18
+ //# sourceMappingURL=contentLinkEmbedPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contentLinkEmbedPlugin.mjs","names":["contentLinkEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/contentLinkEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport { type ContentLinkMetaData } from \"@ndla/types-embed\";\nimport { ContentLinkEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const contentLinkEmbedPlugin: PluginType = (element, opts, { isOembed }) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as ContentLinkMetaData;\n return (\n <ContentLinkEmbed embed={data} isOembed={isOembed}>\n {domToReact(element.children as DOMNode[], opts)}\n </ContentLinkEmbed>\n );\n};\n"],"mappings":";;;;;AAaA,MAAaA,yBAAqC,CAAC,SAAS,MAAM,EAAE,UAAU,KAAK;CACjF,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;CAChD,MAAM,OAAO,KAAK,MAAM,MAAM,aAAuB;AACrD,wBACE,IAAC;EAAiB,OAAO;EAAgB;YACtC,WAAW,QAAQ,UAAuB,KAAK;GAC/B;AAEtB"}
@@ -14,4 +14,4 @@ const copyrightEmbedPlugin = (element, opts) => {
14
14
 
15
15
  //#endregion
16
16
  export { copyrightEmbedPlugin };
17
- //# sourceMappingURL=copyrightEmbedPlugin.js.map
17
+ //# sourceMappingURL=copyrightEmbedPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copyrightEmbedPlugin.mjs","names":["copyrightEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/copyrightEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport { type CopyrightMetaData } from \"@ndla/types-embed\";\nimport { CopyrightEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const copyrightEmbedPlugin: PluginType = (element, opts) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as CopyrightMetaData;\n return <CopyrightEmbed embed={data}>{domToReact(element.children as DOMNode[], opts)}</CopyrightEmbed>;\n};\n"],"mappings":";;;;;AAaA,MAAaA,uBAAmC,CAAC,SAAS,SAAS;CACjE,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;CAChD,MAAM,OAAO,KAAK,MAAM,MAAM,aAAuB;AACrD,wBAAO,IAAC;EAAe,OAAO;YAAO,WAAW,QAAQ,UAAuB,KAAK;GAAkB;AACvG"}
@@ -11,4 +11,4 @@ const externalEmbedPlugin = (element) => {
11
11
 
12
12
  //#endregion
13
13
  export { externalEmbedPlugin };
14
- //# sourceMappingURL=externalEmbedPlugin.js.map
14
+ //# sourceMappingURL=externalEmbedPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"externalEmbedPlugin.mjs","names":["externalEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/externalEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type OembedMetaData } from \"@ndla/types-embed\";\nimport { ExternalEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const externalEmbedPlugin: PluginType = (element) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as OembedMetaData;\n return <ExternalEmbed embed={data} />;\n};\n"],"mappings":";;;;;AAaA,MAAaA,sBAAkC,CAAC,YAAY;CAC1D,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;CAChD,MAAM,OAAO,KAAK,MAAM,MAAM,aAAuB;AACrD,wBAAO,IAAC,iBAAc,OAAO,OAAQ;AACtC"}
@@ -21,4 +21,4 @@ const fileEmbedPlugin = (element) => {
21
21
 
22
22
  //#endregion
23
23
  export { fileEmbedPlugin };
24
- //# sourceMappingURL=fileEmbedPlugin.js.map
24
+ //# sourceMappingURL=fileEmbedPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileEmbedPlugin.mjs","names":["fileEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/fileEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type FileMetaData } from \"@ndla/types-embed\";\nimport { PdfFile, FileListElement } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const fileEmbedPlugin: PluginType = (element) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as FileMetaData;\n const { type, title, url, display } = data.embedData;\n if (type === \"pdf\" && display === \"block\") {\n return <PdfFile title={title} url={url} />;\n }\n return (\n <FileListElement\n url={url}\n title={title}\n fileExists={data.status === \"success\" ? !!data.data.exists : false}\n fileType={type}\n />\n );\n};\n"],"mappings":";;;;;AAaA,MAAaA,kBAA8B,CAAC,YAAY;CACtD,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;CAChD,MAAM,OAAO,KAAK,MAAM,MAAM,aAAuB;CACrD,MAAM,EAAE,MAAM,OAAO,KAAK,SAAS,GAAG,KAAK;AAC3C,KAAI,SAAS,SAAS,YAAY,QAChC,wBAAO,IAAC;EAAe;EAAY;GAAO;AAE5C,wBACE,IAAC;EACM;EACE;EACP,YAAY,KAAK,WAAW,cAAc,KAAK,KAAK,SAAS;EAC7D,UAAU;GACV;AAEL"}
@@ -11,4 +11,4 @@ const footnoteEmbedPlugin = (element) => {
11
11
 
12
12
  //#endregion
13
13
  export { footnoteEmbedPlugin };
14
- //# sourceMappingURL=footnoteEmbedPlugin.js.map
14
+ //# sourceMappingURL=footnoteEmbedPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"footnoteEmbedPlugin.mjs","names":["footnoteEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/footnoteEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type FootnoteMetaData } from \"@ndla/types-embed\";\nimport { FootnoteEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const footnoteEmbedPlugin: PluginType = (element) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as FootnoteMetaData;\n return <FootnoteEmbed embed={data} />;\n};\n"],"mappings":";;;;;AAaA,MAAaA,sBAAkC,CAAC,YAAY;CAC1D,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;CAChD,MAAM,OAAO,KAAK,MAAM,MAAM,aAAuB;AACrD,wBAAO,IAAC,iBAAc,OAAO,OAAQ;AACtC"}
@@ -11,4 +11,4 @@ const h5pEmbedPlugin = (element) => {
11
11
 
12
12
  //#endregion
13
13
  export { h5pEmbedPlugin };
14
- //# sourceMappingURL=h5pEmbedPlugin.js.map
14
+ //# sourceMappingURL=h5pEmbedPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"h5pEmbedPlugin.mjs","names":["h5pEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/h5pEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type H5pMetaData } from \"@ndla/types-embed\";\nimport { H5pEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const h5pEmbedPlugin: PluginType = (element) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as H5pMetaData;\n return <H5pEmbed embed={data} />;\n};\n"],"mappings":";;;;;AAaA,MAAaA,iBAA6B,CAAC,YAAY;CACrD,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;CAChD,MAAM,OAAO,KAAK,MAAM,MAAM,aAAuB;AACrD,wBAAO,IAAC,YAAS,OAAO,OAAQ;AACjC"}
@@ -11,4 +11,4 @@ const iframeEmbedPlugin = (element) => {
11
11
 
12
12
  //#endregion
13
13
  export { iframeEmbedPlugin };
14
- //# sourceMappingURL=iframeEmbedPlugin.js.map
14
+ //# sourceMappingURL=iframeEmbedPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iframeEmbedPlugin.mjs","names":["iframeEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/iframeEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type IframeMetaData } from \"@ndla/types-embed\";\nimport { IframeEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const iframeEmbedPlugin: PluginType = (element) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as IframeMetaData;\n return <IframeEmbed embed={data} />;\n};\n"],"mappings":";;;;;AAaA,MAAaA,oBAAgC,CAAC,YAAY;CACxD,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;CAChD,MAAM,OAAO,KAAK,MAAM,MAAM,aAAuB;AACrD,wBAAO,IAAC,eAAY,OAAO,OAAQ;AACpC"}
@@ -16,4 +16,4 @@ const imageEmbedPlugin = (element, _, opts) => {
16
16
 
17
17
  //#endregion
18
18
  export { imageEmbedPlugin };
19
- //# sourceMappingURL=imageEmbedPlugin.js.map
19
+ //# sourceMappingURL=imageEmbedPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imageEmbedPlugin.mjs","names":["imageEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/imageEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type ImageMetaData } from \"@ndla/types-embed\";\nimport { ImageEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const imageEmbedPlugin: PluginType = (element, _, opts) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as ImageMetaData;\n\n return (\n <ImageEmbed\n embed={data}\n previewAlt={opts.previewAlt}\n lang={opts.articleLanguage}\n renderContext={opts.renderContext}\n />\n );\n};\n"],"mappings":";;;;;AAaA,MAAaA,mBAA+B,CAAC,SAAS,GAAG,SAAS;CAChE,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;CAChD,MAAM,OAAO,KAAK,MAAM,MAAM,aAAuB;AAErD,wBACE,IAAC;EACC,OAAO;EACP,YAAY,KAAK;EACjB,MAAM,KAAK;EACX,eAAe,KAAK;GACpB;AAEL"}
@@ -0,0 +1,48 @@
1
+ import { audioEmbedPlugin } from "./audioEmbedPlugin.mjs";
2
+ import { brightcoveEmbedPlugin } from "./brightcoveEmbedPlugin.mjs";
3
+ import { campaignBlockPlugin } from "./campaignBlockPlugin.mjs";
4
+ import { codeEmbedPlugin } from "./codeEmbedPlugin.mjs";
5
+ import { conceptEmbedPlugin } from "./conceptEmbedPlugin.mjs";
6
+ import { contactBlockEmbedPlugin } from "./contactBlockEmbedPlugin.mjs";
7
+ import { contentLinkEmbedPlugin } from "./contentLinkEmbedPlugin.mjs";
8
+ import { copyrightEmbedPlugin } from "./copyrightEmbedPlugin.mjs";
9
+ import { externalEmbedPlugin } from "./externalEmbedPlugin.mjs";
10
+ import { fileEmbedPlugin } from "./fileEmbedPlugin.mjs";
11
+ import { footnoteEmbedPlugin } from "./footnoteEmbedPlugin.mjs";
12
+ import { h5pEmbedPlugin } from "./h5pEmbedPlugin.mjs";
13
+ import { iframeEmbedPlugin } from "./iframeEmbedPlugin.mjs";
14
+ import { imageEmbedPlugin } from "./imageEmbedPlugin.mjs";
15
+ import { keyFigureEmbedPlugin } from "./KeyFigureEmbedPlugin.mjs";
16
+ import { linkBlockPlugin } from "./linkBlockEmbedPlugin.mjs";
17
+ import { pitchEmbedPlugin } from "./pitchEmbedPlugin.mjs";
18
+ import { relatedContentEmbedPlugin } from "./relatedContentEmbedPlugin.mjs";
19
+ import { symbolEmbedPlugin } from "./symbolEmbedPlugin.mjs";
20
+ import { uuDisclaimerEmbedPlugin } from "./uuDisclaimerEmbedPlugin.mjs";
21
+
22
+ //#region src/plugins/embed/index.ts
23
+ const embedPlugins = {
24
+ image: imageEmbedPlugin,
25
+ audio: audioEmbedPlugin,
26
+ h5p: h5pEmbedPlugin,
27
+ "code-block": codeEmbedPlugin,
28
+ external: externalEmbedPlugin,
29
+ iframe: iframeEmbedPlugin,
30
+ footnote: footnoteEmbedPlugin,
31
+ brightcove: brightcoveEmbedPlugin,
32
+ "related-content": relatedContentEmbedPlugin,
33
+ "content-link": contentLinkEmbedPlugin,
34
+ concept: conceptEmbedPlugin,
35
+ pitch: pitchEmbedPlugin,
36
+ file: fileEmbedPlugin,
37
+ "key-figure": keyFigureEmbedPlugin,
38
+ "contact-block": contactBlockEmbedPlugin,
39
+ "campaign-block": campaignBlockPlugin,
40
+ "link-block": linkBlockPlugin,
41
+ "uu-disclaimer": uuDisclaimerEmbedPlugin,
42
+ copyright: copyrightEmbedPlugin,
43
+ symbol: symbolEmbedPlugin
44
+ };
45
+
46
+ //#endregion
47
+ export { embedPlugins };
48
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["embedPlugins: Record<string, PluginType>"],"sources":["../../../src/plugins/embed/index.ts"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { audioEmbedPlugin } from \"./audioEmbedPlugin\";\nimport { brightcoveEmbedPlugin } from \"./brightcoveEmbedPlugin\";\nimport { campaignBlockPlugin } from \"./campaignBlockPlugin\";\nimport { codeEmbedPlugin } from \"./codeEmbedPlugin\";\nimport { conceptEmbedPlugin } from \"./conceptEmbedPlugin\";\nimport { contactBlockEmbedPlugin } from \"./contactBlockEmbedPlugin\";\nimport { contentLinkEmbedPlugin } from \"./contentLinkEmbedPlugin\";\nimport { copyrightEmbedPlugin } from \"./copyrightEmbedPlugin\";\nimport { externalEmbedPlugin } from \"./externalEmbedPlugin\";\nimport { fileEmbedPlugin } from \"./fileEmbedPlugin\";\nimport { footnoteEmbedPlugin } from \"./footnoteEmbedPlugin\";\nimport { h5pEmbedPlugin } from \"./h5pEmbedPlugin\";\nimport { iframeEmbedPlugin } from \"./iframeEmbedPlugin\";\nimport { imageEmbedPlugin } from \"./imageEmbedPlugin\";\nimport { keyFigureEmbedPlugin } from \"./KeyFigureEmbedPlugin\";\nimport { linkBlockPlugin } from \"./linkBlockEmbedPlugin\";\nimport { pitchEmbedPlugin } from \"./pitchEmbedPlugin\";\nimport { relatedContentEmbedPlugin } from \"./relatedContentEmbedPlugin\";\nimport { symbolEmbedPlugin } from \"./symbolEmbedPlugin\";\nimport { uuDisclaimerEmbedPlugin } from \"./uuDisclaimerEmbedPlugin\";\nimport { type PluginType } from \"../types\";\n\nexport const embedPlugins: Record<string, PluginType> = {\n image: imageEmbedPlugin,\n audio: audioEmbedPlugin,\n h5p: h5pEmbedPlugin,\n \"code-block\": codeEmbedPlugin,\n external: externalEmbedPlugin,\n iframe: iframeEmbedPlugin,\n footnote: footnoteEmbedPlugin,\n brightcove: brightcoveEmbedPlugin,\n \"related-content\": relatedContentEmbedPlugin,\n \"content-link\": contentLinkEmbedPlugin,\n concept: conceptEmbedPlugin,\n pitch: pitchEmbedPlugin,\n file: fileEmbedPlugin,\n \"key-figure\": keyFigureEmbedPlugin,\n \"contact-block\": contactBlockEmbedPlugin,\n \"campaign-block\": campaignBlockPlugin,\n \"link-block\": linkBlockPlugin,\n \"uu-disclaimer\": uuDisclaimerEmbedPlugin,\n copyright: copyrightEmbedPlugin,\n symbol: symbolEmbedPlugin,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAaA,eAA2C;CACtD,OAAO;CACP,OAAO;CACP,KAAK;CACL,cAAc;CACd,UAAU;CACV,QAAQ;CACR,UAAU;CACV,YAAY;CACZ,mBAAmB;CACnB,gBAAgB;CAChB,SAAS;CACT,OAAO;CACP,MAAM;CACN,cAAc;CACd,iBAAiB;CACjB,kBAAkB;CAClB,cAAc;CACd,iBAAiB;CACjB,WAAW;CACX,QAAQ;AACT"}
@@ -15,4 +15,4 @@ const linkBlockPlugin = (element, _, opts) => {
15
15
 
16
16
  //#endregion
17
17
  export { linkBlockPlugin };
18
- //# sourceMappingURL=linkBlockEmbedPlugin.js.map
18
+ //# sourceMappingURL=linkBlockEmbedPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linkBlockEmbedPlugin.mjs","names":["linkBlockPlugin: PluginType"],"sources":["../../../src/plugins/embed/linkBlockEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type LinkBlockMetaData } from \"@ndla/types-embed\";\nimport { LinkBlock } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const linkBlockPlugin: PluginType = (element, _, opts) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as LinkBlockMetaData;\n\n return <LinkBlock {...data.embedData} path={opts.path} articleLanguage={opts.articleLanguage} />;\n};\n"],"mappings":";;;;;AAaA,MAAaA,kBAA8B,CAAC,SAAS,GAAG,SAAS;CAC/D,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;CAChD,MAAM,OAAO,KAAK,MAAM,MAAM,aAAuB;AAErD,wBAAO,IAAC;EAAU,GAAI,KAAK;EAAW,MAAM,KAAK;EAAM,iBAAiB,KAAK;GAAmB;AACjG"}
@@ -22,4 +22,4 @@ const pitchEmbedPlugin = (element, _, opts) => {
22
22
 
23
23
  //#endregion
24
24
  export { pitchEmbedPlugin };
25
- //# sourceMappingURL=pitchEmbedPlugin.js.map
25
+ //# sourceMappingURL=pitchEmbedPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pitchEmbedPlugin.mjs","names":["pitchEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/pitchEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type PitchMetaData } from \"@ndla/types-embed\";\nimport { Pitch } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const errorSvgSrc = `data:image/svg+xml;charset=UTF-8,%3Csvg fill='%238A8888' height='400' viewBox='0 0 24 12' width='100%25' xmlns='http://www.w3.org/2000/svg' style='background-color: %23EFF0F2'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath transform='scale(0.3) translate(28, 8.5)' d='M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z'/%3E%3C/svg%3E`;\n\nexport const pitchEmbedPlugin: PluginType = (element, _, opts) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as PitchMetaData;\n const { title, description, url, alt } = data.embedData;\n return (\n <Pitch\n title={title}\n description={description}\n url={url}\n path={opts.path}\n metaImage={{\n alt: alt ? alt : \"\",\n url: data.status === \"success\" ? (data.data.metaImage?.image.imageUrl ?? errorSvgSrc) : errorSvgSrc,\n }}\n />\n );\n};\n"],"mappings":";;;;;AAaA,MAAa,eAAe;AAE5B,MAAaA,mBAA+B,CAAC,SAAS,GAAG,SAAS;CAChE,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;CAChD,MAAM,OAAO,KAAK,MAAM,MAAM,aAAuB;CACrD,MAAM,EAAE,OAAO,aAAa,KAAK,KAAK,GAAG,KAAK;AAC9C,wBACE,IAAC;EACQ;EACM;EACR;EACL,MAAM,KAAK;EACX,WAAW;GACT,KAAK,MAAM,MAAM;GACjB,KAAK,KAAK,WAAW,YAAa,KAAK,KAAK,WAAW,MAAM,YAAY,cAAe;EACzF;GACD;AAEL"}
@@ -15,4 +15,4 @@ const relatedContentEmbedPlugin = (element, _, opts) => {
15
15
 
16
16
  //#endregion
17
17
  export { relatedContentEmbedPlugin };
18
- //# sourceMappingURL=relatedContentEmbedPlugin.js.map
18
+ //# sourceMappingURL=relatedContentEmbedPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relatedContentEmbedPlugin.mjs","names":["relatedContentEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/relatedContentEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type RelatedContentMetaData } from \"@ndla/types-embed\";\nimport { RelatedContentEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const relatedContentEmbedPlugin: PluginType = (element, _, opts) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as RelatedContentMetaData;\n return <RelatedContentEmbed embed={data} subject={opts.subject} ndlaFrontendDomain={opts.frontendDomain} />;\n};\n"],"mappings":";;;;;AAaA,MAAaA,4BAAwC,CAAC,SAAS,GAAG,SAAS;CACzE,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;CAChD,MAAM,OAAO,KAAK,MAAM,MAAM,aAAuB;AACrD,wBAAO,IAAC;EAAoB,OAAO;EAAM,SAAS,KAAK;EAAS,oBAAoB,KAAK;GAAkB;AAC5G"}
@@ -8,4 +8,4 @@ const symbolEmbedPlugin = (element, _, __) => {
8
8
 
9
9
  //#endregion
10
10
  export { symbolEmbedPlugin };
11
- //# sourceMappingURL=symbolEmbedPlugin.js.map
11
+ //# sourceMappingURL=symbolEmbedPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"symbolEmbedPlugin.mjs","names":["symbolEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/symbolEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2025-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, domToReact } from \"html-react-parser\";\nimport { type PluginType } from \"../types\";\n\nexport const symbolEmbedPlugin: PluginType = (element, _, __) => {\n return <>{domToReact(element.children as DOMNode[])}</>;\n};\n"],"mappings":";;;;AAWA,MAAaA,oBAAgC,CAAC,SAAS,GAAG,OAAO;AAC/D,wBAAO,0BAAG,WAAW,QAAQ,SAAsB,GAAI;AACxD"}
@@ -1,4 +1,4 @@
1
- import { transform_default } from "../../transform.js";
1
+ import { transform_default } from "../../transform.mjs";
2
2
  import { attributesToProps, domToReact } from "html-react-parser";
3
3
  import { UuDisclaimerEmbed } from "@ndla/ui";
4
4
  import { Fragment, jsx } from "react/jsx-runtime";
@@ -18,4 +18,4 @@ const uuDisclaimerEmbedPlugin = (element, opts, transformOpts) => {
18
18
 
19
19
  //#endregion
20
20
  export { uuDisclaimerEmbedPlugin };
21
- //# sourceMappingURL=uuDisclaimerEmbedPlugin.js.map
21
+ //# sourceMappingURL=uuDisclaimerEmbedPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uuDisclaimerEmbedPlugin.mjs","names":["uuDisclaimerEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/uuDisclaimerEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport { type UuDisclaimerMetaData } from \"@ndla/types-embed\";\nimport { UuDisclaimerEmbed } from \"@ndla/ui\";\nimport transform from \"../../transform\";\nimport { type PluginType } from \"../types\";\n\nexport const uuDisclaimerEmbedPlugin: PluginType = (element, opts, transformOpts) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as UuDisclaimerMetaData;\n if (data.status === \"error\") {\n return <>{domToReact(element.children as DOMNode[], opts)}</>;\n }\n const transformedDisclaimer = transform(data.data.transformedContent, transformOpts);\n return (\n <UuDisclaimerEmbed embed={data} transformedDisclaimer={transformedDisclaimer}>\n {domToReact(element.children as DOMNode[], opts)}\n </UuDisclaimerEmbed>\n );\n};\n"],"mappings":";;;;;;AAcA,MAAaA,0BAAsC,CAAC,SAAS,MAAM,kBAAkB;CACnF,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;CAChD,MAAM,OAAO,KAAK,MAAM,MAAM,aAAuB;AACrD,KAAI,KAAK,WAAW,QAClB,wBAAO,0BAAG,WAAW,QAAQ,UAAuB,KAAK,GAAI;CAE/D,MAAM,wBAAwB,kBAAU,KAAK,KAAK,oBAAoB,cAAc;AACpF,wBACE,IAAC;EAAkB,OAAO;EAA6B;YACpD,WAAW,QAAQ,UAAuB,KAAK;GAC9B;AAEvB"}
@@ -13,4 +13,4 @@ const h3Plugin = (node, converterOpts, opts) => {
13
13
 
14
14
  //#endregion
15
15
  export { h3Plugin };
16
- //# sourceMappingURL=h3Plugin.js.map
16
+ //# sourceMappingURL=h3Plugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"h3Plugin.mjs","names":["h3Plugin: PluginType"],"sources":["../../src/plugins/h3Plugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport { type PluginType } from \"./types\";\nexport const h3Plugin: PluginType = (node, converterOpts, opts) => {\n const props = attributesToProps(node.attribs);\n return (\n <h3 {...props} lang={opts.articleLanguage}>\n {domToReact(node.children as DOMNode[], converterOpts)}\n </h3>\n );\n};\n"],"mappings":";;;;AAUA,MAAaA,WAAuB,CAAC,MAAM,eAAe,SAAS;CACjE,MAAM,QAAQ,kBAAkB,KAAK,QAAQ;AAC7C,wBACE,IAAC;EAAG,GAAI;EAAO,MAAM,KAAK;YACvB,WAAW,KAAK,UAAuB,cAAc;GACnD;AAER"}
@@ -0,0 +1,43 @@
1
+ import { anchorPlugin } from "./anchorPlugin.mjs";
2
+ import { asidePlugin } from "./asidePlugin.mjs";
3
+ import { blockquotePlugin } from "./blockquotePlugin.mjs";
4
+ import { copyParagraphPlugin } from "./copyParagraphPlugin.mjs";
5
+ import { detailsPlugin } from "./detailsPlugin.mjs";
6
+ import { divPlugin } from "./divPlugin.mjs";
7
+ import { dlPlugin } from "./dlPlugin.mjs";
8
+ import { h3Plugin } from "./h3Plugin.mjs";
9
+ import { mathPlugin } from "./mathPlugin.mjs";
10
+ import { navPlugin } from "./navPlugin.mjs";
11
+ import { anchorPlugin$1 } from "./oembed/anchorPlugin.mjs";
12
+ import { olPlugin } from "./olPlugin.mjs";
13
+ import { paragraphPlugin } from "./paragraphPlugin.mjs";
14
+ import { summaryPlugin } from "./summaryPlugin.mjs";
15
+ import { tablePlugin } from "./tablePlugin.mjs";
16
+ import { ulPlugin } from "./ulPlugin.mjs";
17
+
18
+ //#region src/plugins/index.ts
19
+ const basePlugins = {
20
+ h2: copyParagraphPlugin,
21
+ h3: h3Plugin,
22
+ ol: olPlugin,
23
+ p: paragraphPlugin,
24
+ math: mathPlugin,
25
+ div: divPlugin,
26
+ table: tablePlugin,
27
+ aside: asidePlugin,
28
+ ul: ulPlugin,
29
+ nav: navPlugin,
30
+ a: anchorPlugin,
31
+ summary: summaryPlugin,
32
+ details: detailsPlugin,
33
+ dl: dlPlugin,
34
+ blockquote: blockquotePlugin
35
+ };
36
+ const oembedPlugins = {
37
+ ...basePlugins,
38
+ a: anchorPlugin$1
39
+ };
40
+
41
+ //#endregion
42
+ export { basePlugins, oembedPlugins };
43
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["basePlugins: Record<string, PluginType>","oembedPlugins: Record<string, PluginType>","oembedAnchorPlugin"],"sources":["../../src/plugins/index.ts"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { anchorPlugin } from \"./anchorPlugin\";\nimport { asidePlugin } from \"./asidePlugin\";\nimport { blockquotePlugin } from \"./blockquotePlugin\";\nimport { copyParagraphPlugin } from \"./copyParagraphPlugin\";\nimport { detailsPlugin } from \"./detailsPlugin\";\nimport { divPlugin } from \"./divPlugin\";\nimport { dlPlugin } from \"./dlPlugin\";\nimport { h3Plugin } from \"./h3Plugin\";\nimport { mathPlugin } from \"./mathPlugin\";\nimport { navPlugin } from \"./navPlugin\";\nimport { anchorPlugin as oembedAnchorPlugin } from \"./oembed/anchorPlugin\";\nimport { olPlugin } from \"./olPlugin\";\nimport { paragraphPlugin } from \"./paragraphPlugin\";\nimport { summaryPlugin } from \"./summaryPlugin\";\nimport { tablePlugin } from \"./tablePlugin\";\nimport { type PluginType } from \"./types\";\nimport { ulPlugin } from \"./ulPlugin\";\n\nexport const basePlugins: Record<string, PluginType> = {\n h2: copyParagraphPlugin,\n h3: h3Plugin,\n ol: olPlugin,\n p: paragraphPlugin,\n math: mathPlugin,\n div: divPlugin,\n table: tablePlugin,\n aside: asidePlugin,\n ul: ulPlugin,\n nav: navPlugin,\n a: anchorPlugin,\n summary: summaryPlugin,\n details: detailsPlugin,\n dl: dlPlugin,\n blockquote: blockquotePlugin,\n};\n\nexport const oembedPlugins: Record<string, PluginType> = {\n ...basePlugins,\n a: oembedAnchorPlugin,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AA0BA,MAAaA,cAA0C;CACrD,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,MAAM;CACN,KAAK;CACL,OAAO;CACP,OAAO;CACP,IAAI;CACJ,KAAK;CACL,GAAG;CACH,SAAS;CACT,SAAS;CACT,IAAI;CACJ,YAAY;AACb;AAED,MAAaC,gBAA4C;CACvD,GAAG;CACH,GAAGC;AACJ"}
@@ -13,4 +13,4 @@ const mathPlugin = (node) => {
13
13
 
14
14
  //#endregion
15
15
  export { mathPlugin };
16
- //# sourceMappingURL=mathPlugin.js.map
16
+ //# sourceMappingURL=mathPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mathPlugin.mjs","names":["mathPlugin: PluginType"],"sources":["../../src/plugins/mathPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type PluginType } from \"./types\";\nexport const mathPlugin: PluginType = (node) => {\n const { \"data-math\": mathContent, ...props } = attributesToProps(node.attribs);\n return (\n // @ts-expect-error - math is a valid tag\n <math xmlns=\"http://www.w3.org/1998/Math/MathML\" {...props} dangerouslySetInnerHTML={{ __html: mathContent }} />\n );\n};\n"],"mappings":";;;;AAUA,MAAaA,aAAyB,CAAC,SAAS;CAC9C,MAAM,EAAE,aAAa,YAAa,GAAG,OAAO,GAAG,kBAAkB,KAAK,QAAQ;AAC9E,wBAEE,IAAC;EAAK,OAAM;EAAqC,GAAI;EAAO,yBAAyB,EAAE,QAAQ,YAAa;GAAI;AAEnH"}
@@ -16,4 +16,4 @@ const navPlugin = (node, opts) => {
16
16
 
17
17
  //#endregion
18
18
  export { navPlugin };
19
- //# sourceMappingURL=navPlugin.js.map
19
+ //# sourceMappingURL=navPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navPlugin.mjs","names":["navPlugin: PluginType"],"sources":["../../src/plugins/navPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport { LinkBlockSection } from \"@ndla/ui\";\nimport { type PluginType } from \"./types\";\n\nexport const navPlugin: PluginType = (node, opts) => {\n if (node.attribs[\"data-type\"] === \"link-block-list\") {\n const props = attributesToProps(node.attribs);\n return <LinkBlockSection {...props}>{domToReact(node.children as DOMNode[], opts)}</LinkBlockSection>;\n }\n return null;\n};\n"],"mappings":";;;;;AAYA,MAAaA,YAAwB,CAAC,MAAM,SAAS;AACnD,KAAI,KAAK,QAAQ,iBAAiB,mBAAmB;EACnD,MAAM,QAAQ,kBAAkB,KAAK,QAAQ;AAC7C,yBAAO,IAAC;GAAiB,GAAI;aAAQ,WAAW,KAAK,UAAuB,KAAK;IAAoB;CACtG;AACD,QAAO;AACR"}
@@ -18,4 +18,4 @@ const anchorPlugin = (node, options, { path }) => {
18
18
 
19
19
  //#endregion
20
20
  export { anchorPlugin as anchorPlugin$1 };
21
- //# sourceMappingURL=anchorPlugin.js.map
21
+ //# sourceMappingURL=anchorPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anchorPlugin.mjs","names":["anchorPlugin: PluginType"],"sources":["../../../src/plugins/oembed/anchorPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { getPossiblyRelativeUrl } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const anchorPlugin: PluginType = (node, options, { path }) => {\n const props = attributesToProps(node.attribs);\n const href = getPossiblyRelativeUrl(props.href as string, path);\n return (\n <SafeLink {...props} target=\"_blank\" to={href} rel=\"noreferrer\">\n {domToReact(node.children as DOMNode[], options)}\n </SafeLink>\n );\n};\n"],"mappings":";;;;;;AAaA,MAAaA,eAA2B,CAAC,MAAM,SAAS,EAAE,MAAM,KAAK;CACnE,MAAM,QAAQ,kBAAkB,KAAK,QAAQ;CAC7C,MAAM,OAAO,uBAAuB,MAAM,MAAgB,KAAK;AAC/D,wBACE,IAAC;EAAS,GAAI;EAAO,QAAO;EAAS,IAAI;EAAM,KAAI;YAChD,WAAW,KAAK,UAAuB,QAAQ;GACvC;AAEd"}
@@ -16,4 +16,4 @@ const olPlugin = (node, converterOpts, opts) => {
16
16
 
17
17
  //#endregion
18
18
  export { olPlugin };
19
- //# sourceMappingURL=olPlugin.js.map
19
+ //# sourceMappingURL=olPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"olPlugin.mjs","names":["olPlugin: PluginType"],"sources":["../../src/plugins/olPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport { OrderedList } from \"@ndla/primitives\";\nimport { type PluginType } from \"./types\";\nexport const olPlugin: PluginType = (node, converterOpts, opts) => {\n const props = attributesToProps(node.attribs);\n const variantProp = node.attribs[\"data-type\"] === \"letters\" ? ({ variant: \"letters\" } as const) : {};\n\n return (\n <OrderedList {...props} {...variantProp} lang={opts.articleLanguage}>\n {domToReact(node.children as DOMNode[], converterOpts)}\n </OrderedList>\n );\n};\n"],"mappings":";;;;;AAWA,MAAaA,WAAuB,CAAC,MAAM,eAAe,SAAS;CACjE,MAAM,QAAQ,kBAAkB,KAAK,QAAQ;CAC7C,MAAM,cAAc,KAAK,QAAQ,iBAAiB,YAAa,EAAE,SAAS,UAAW,IAAa,CAAE;AAEpG,wBACE,IAAC;EAAY,GAAI;EAAO,GAAI;EAAa,MAAM,KAAK;YACjD,WAAW,KAAK,UAAuB,cAAc;GAC1C;AAEjB"}
@@ -13,4 +13,4 @@ const paragraphPlugin = (node, converterOpts, opts) => {
13
13
 
14
14
  //#endregion
15
15
  export { paragraphPlugin };
16
- //# sourceMappingURL=paragraphPlugin.js.map
16
+ //# sourceMappingURL=paragraphPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paragraphPlugin.mjs","names":["paragraphPlugin: PluginType"],"sources":["../../src/plugins/paragraphPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport { type PluginType } from \"./types\";\n\nexport const paragraphPlugin: PluginType = (node, converterOpts, opts) => {\n const props = attributesToProps(node.attribs);\n return (\n <p {...props} lang={opts.articleLanguage}>\n {domToReact(node.children as DOMNode[], converterOpts)}\n </p>\n );\n};\n"],"mappings":";;;;AAWA,MAAaA,kBAA8B,CAAC,MAAM,eAAe,SAAS;CACxE,MAAM,QAAQ,kBAAkB,KAAK,QAAQ;AAC7C,wBACE,IAAC;EAAE,GAAI;EAAO,MAAM,KAAK;YACtB,WAAW,KAAK,UAAuB,cAAc;GACpD;AAEP"}