@ndla/ui 56.0.122-alpha.0 → 56.0.124-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.
- package/README.md +1 -1
- package/es/Article/Article.js +127 -0
- package/es/Article/Article.js.map +1 -0
- package/es/Article/ArticleByline.js +133 -0
- package/es/Article/ArticleByline.js.map +1 -0
- package/es/Article/ArticleFootNotes.js +40 -0
- package/es/Article/ArticleFootNotes.js.map +1 -0
- package/es/AudioPlayer/AudioPlayer.js +157 -0
- package/es/AudioPlayer/AudioPlayer.js.map +1 -0
- package/es/AudioPlayer/Controls.js +254 -0
- package/es/AudioPlayer/Controls.js.map +1 -0
- package/es/AudioPlayer/SpeechControl.js +40 -0
- package/es/AudioPlayer/SpeechControl.js.map +1 -0
- package/es/AudioPlayer/index.js +8 -0
- package/es/AudioPlayer/index.js.map +1 -0
- package/es/Breadcrumb/Breadcrumb.js +44 -0
- package/es/Breadcrumb/Breadcrumb.js.map +1 -0
- package/es/Breadcrumb/BreadcrumbItem.js +36 -0
- package/es/Breadcrumb/BreadcrumbItem.js.map +1 -0
- package/es/Breadcrumb/HomeBreadcrumb.js +44 -0
- package/es/Breadcrumb/HomeBreadcrumb.js.map +1 -0
- package/es/Breadcrumb/index.js +9 -0
- package/es/Breadcrumb/index.js.map +1 -0
- package/es/CampaignBlock/CampaignBlock.js +131 -0
- package/es/CampaignBlock/CampaignBlock.js.map +1 -0
- package/es/CodeBlock/CodeBlock.js +25 -0
- package/es/CodeBlock/CodeBlock.js.map +1 -0
- package/es/CodeBlock/codeLanguageOptions.js +114 -0
- package/es/CodeBlock/codeLanguageOptions.js.map +1 -0
- package/es/Concept/Concept.js +50 -0
- package/es/Concept/Concept.js.map +1 -0
- package/es/ContactBlock/ContactBlock.js +145 -0
- package/es/ContactBlock/ContactBlock.js.map +1 -0
- package/es/ContentTypeBadge/ContentTypeBadge.js +41 -0
- package/es/ContentTypeBadge/ContentTypeBadge.js.map +1 -0
- package/es/ContentTypeBlockQuote/ContentTypeBlockQuote.js +25 -0
- package/es/ContentTypeBlockQuote/ContentTypeBlockQuote.js.map +1 -0
- package/es/ContentTypeFramedContent/ContentTypeFramedContent.js +25 -0
- package/es/ContentTypeFramedContent/ContentTypeFramedContent.js.map +1 -0
- package/es/ContentTypeHero/ContentTypeHero.js +39 -0
- package/es/ContentTypeHero/ContentTypeHero.js.map +1 -0
- package/es/CopyParagraphButton/CopyParagraphButton.js +62 -0
- package/es/CopyParagraphButton/CopyParagraphButton.js.map +1 -0
- package/es/CopyParagraphButton/index.js +8 -0
- package/es/CopyParagraphButton/index.js.map +1 -0
- package/es/Embed/AudioEmbed.js +52 -0
- package/es/Embed/AudioEmbed.js.map +1 -0
- package/es/Embed/BrightcoveEmbed.js +96 -0
- package/es/Embed/BrightcoveEmbed.js.map +1 -0
- package/es/Embed/CodeEmbed.js +61 -0
- package/es/Embed/CodeEmbed.js.map +1 -0
- package/es/Embed/ConceptEmbed.js +78 -0
- package/es/Embed/ConceptEmbed.js.map +1 -0
- package/es/Embed/ConceptInlineTriggerButton.js +40 -0
- package/es/Embed/ConceptInlineTriggerButton.js.map +1 -0
- package/es/Embed/ContentLinkEmbed.js +31 -0
- package/es/Embed/ContentLinkEmbed.js.map +1 -0
- package/es/Embed/CopyrightEmbed.js +23 -0
- package/es/Embed/CopyrightEmbed.js.map +1 -0
- package/es/Embed/EmbedErrorPlaceholder.js +43 -0
- package/es/Embed/EmbedErrorPlaceholder.js.map +1 -0
- package/es/Embed/EmbedWrapper.js +26 -0
- package/es/Embed/EmbedWrapper.js.map +1 -0
- package/es/Embed/ExternalEmbed.js +54 -0
- package/es/Embed/ExternalEmbed.js.map +1 -0
- package/es/Embed/FootnoteEmbed.js +27 -0
- package/es/Embed/FootnoteEmbed.js.map +1 -0
- package/es/Embed/GlossEmbed.js +52 -0
- package/es/Embed/GlossEmbed.js.map +1 -0
- package/es/Embed/H5pEmbed.js +38 -0
- package/es/Embed/H5pEmbed.js.map +1 -0
- package/es/Embed/IframeEmbed.js +69 -0
- package/es/Embed/IframeEmbed.js.map +1 -0
- package/es/Embed/ImageEmbed.js +180 -0
- package/es/Embed/ImageEmbed.js.map +1 -0
- package/es/Embed/InlineTriggerButton.js +25 -0
- package/es/Embed/InlineTriggerButton.js.map +1 -0
- package/es/Embed/RelatedContentEmbed.js +38 -0
- package/es/Embed/RelatedContentEmbed.js.map +1 -0
- package/es/Embed/UnknownEmbed.js +20 -0
- package/es/Embed/UnknownEmbed.js.map +1 -0
- package/es/Embed/UuDisclaimerEmbed.js +54 -0
- package/es/Embed/UuDisclaimerEmbed.js.map +1 -0
- package/es/ErrorMessage/ErrorMessage.js +54 -0
- package/es/ErrorMessage/ErrorMessage.js.map +1 -0
- package/es/ErrorMessage/index.js +8 -0
- package/es/ErrorMessage/index.js.map +1 -0
- package/es/FactBox/FactBox.js +121 -0
- package/es/FactBox/FactBox.js.map +1 -0
- package/es/FactBox/index.js +8 -0
- package/es/FactBox/index.js.map +1 -0
- package/es/FileList/File.js +76 -0
- package/es/FileList/File.js.map +1 -0
- package/es/FileList/FileList.js +32 -0
- package/es/FileList/FileList.js.map +1 -0
- package/es/FileList/PdfFile.js +28 -0
- package/es/FileList/PdfFile.js.map +1 -0
- package/es/Gloss/Gloss.js +142 -0
- package/es/Gloss/Gloss.js.map +1 -0
- package/es/Gloss/GlossExample.js +46 -0
- package/es/Gloss/GlossExample.js.map +1 -0
- package/es/Grid/Grid.js +66 -0
- package/es/Grid/Grid.js.map +1 -0
- package/es/Grid/GridParallaxItem.js +21 -0
- package/es/Grid/GridParallaxItem.js.map +1 -0
- package/es/KeyFigure/KeyFigure.js +46 -0
- package/es/KeyFigure/KeyFigure.js.map +1 -0
- package/es/LicenseByline/EmbedByline.js +132 -0
- package/es/LicenseByline/EmbedByline.js.map +1 -0
- package/es/LicenseByline/LicenseLink.js +31 -0
- package/es/LicenseByline/LicenseLink.js.map +1 -0
- package/es/LinkBlock/LinkBlock.js +74 -0
- package/es/LinkBlock/LinkBlock.js.map +1 -0
- package/es/LinkBlock/LinkBlockSection.js +23 -0
- package/es/LinkBlock/LinkBlockSection.js.map +1 -0
- package/es/Pitch/Pitch.js +62 -0
- package/es/Pitch/Pitch.js.map +1 -0
- package/es/RelatedArticleList/RelatedArticleList.js +97 -0
- package/es/RelatedArticleList/RelatedArticleList.js.map +1 -0
- package/es/RelatedArticleList/index.js +8 -0
- package/es/RelatedArticleList/index.js.map +1 -0
- package/es/ResourceBox/ResourceBox.js +74 -0
- package/es/ResourceBox/ResourceBox.js.map +1 -0
- package/es/TagSelector/TagSelector.js +100 -0
- package/es/TagSelector/TagSelector.js.map +1 -0
- package/es/ZendeskButton/ZendeskButton.js +41 -0
- package/es/ZendeskButton/ZendeskButton.js.map +1 -0
- package/es/_virtual/rolldown_runtime.js +11 -0
- package/es/i18n/formatNestedMessages.js +17 -0
- package/es/i18n/formatNestedMessages.js.map +1 -0
- package/es/i18n/i18n.js +29 -0
- package/es/i18n/i18n.js.map +1 -0
- package/es/i18n/useComponentTranslations.js +155 -0
- package/es/i18n/useComponentTranslations.js.map +1 -0
- package/es/index.js +65 -0
- package/es/locale/messages-en.js +438 -0
- package/es/locale/messages-en.js.map +1 -0
- package/es/locale/messages-nb.js +438 -0
- package/es/locale/messages-nb.js.map +1 -0
- package/es/locale/messages-nn.js +438 -0
- package/es/locale/messages-nn.js.map +1 -0
- package/es/locale/messages-se.js +438 -0
- package/es/locale/messages-se.js.map +1 -0
- package/es/model/ContentType.js +72 -0
- package/es/model/ContentType.js.map +1 -0
- package/es/model/SubjectCategories.js +25 -0
- package/es/model/SubjectCategories.js.map +1 -0
- package/es/model/SubjectTypes.js +23 -0
- package/es/model/SubjectTypes.js.map +1 -0
- package/es/model/WordClass.js +53 -0
- package/es/model/WordClass.js.map +1 -0
- package/es/model/index.js +19 -0
- package/es/model/index.js.map +1 -0
- package/es/utils/licenseAttributes.js +16 -0
- package/es/utils/licenseAttributes.js.map +1 -0
- package/es/utils/relativeUrl.js +26 -0
- package/es/utils/relativeUrl.js.map +1 -0
- package/lib/Article/Article.js +134 -0
- package/lib/Article/Article.js.map +1 -0
- package/lib/Article/ArticleByline.js +135 -0
- package/lib/Article/ArticleByline.js.map +1 -0
- package/lib/Article/ArticleFootNotes.js +41 -0
- package/lib/Article/ArticleFootNotes.js.map +1 -0
- package/lib/AudioPlayer/AudioPlayer.js +158 -0
- package/lib/AudioPlayer/AudioPlayer.js.map +1 -0
- package/lib/AudioPlayer/Controls.js +255 -0
- package/lib/AudioPlayer/Controls.js.map +1 -0
- package/lib/AudioPlayer/SpeechControl.js +41 -0
- package/lib/AudioPlayer/SpeechControl.js.map +1 -0
- package/lib/AudioPlayer/index.js +8 -0
- package/lib/AudioPlayer/index.js.map +1 -0
- package/lib/Breadcrumb/Breadcrumb.js +45 -0
- package/lib/Breadcrumb/Breadcrumb.js.map +1 -0
- package/lib/Breadcrumb/BreadcrumbItem.js +37 -0
- package/lib/Breadcrumb/BreadcrumbItem.js.map +1 -0
- package/lib/Breadcrumb/HomeBreadcrumb.js +45 -0
- package/lib/Breadcrumb/HomeBreadcrumb.js.map +1 -0
- package/lib/Breadcrumb/index.js +9 -0
- package/lib/Breadcrumb/index.js.map +1 -0
- package/lib/CampaignBlock/CampaignBlock.js +132 -0
- package/lib/CampaignBlock/CampaignBlock.js.map +1 -0
- package/lib/CodeBlock/CodeBlock.js +26 -0
- package/lib/CodeBlock/CodeBlock.js.map +1 -0
- package/lib/CodeBlock/codeLanguageOptions.js +115 -0
- package/lib/CodeBlock/codeLanguageOptions.js.map +1 -0
- package/lib/Concept/Concept.js +51 -0
- package/lib/Concept/Concept.js.map +1 -0
- package/lib/ContactBlock/ContactBlock.js +147 -0
- package/lib/ContactBlock/ContactBlock.js.map +1 -0
- package/lib/ContentTypeBadge/ContentTypeBadge.js +43 -0
- package/lib/ContentTypeBadge/ContentTypeBadge.js.map +1 -0
- package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.js +26 -0
- package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.js.map +1 -0
- package/lib/ContentTypeFramedContent/ContentTypeFramedContent.js +26 -0
- package/lib/ContentTypeFramedContent/ContentTypeFramedContent.js.map +1 -0
- package/lib/ContentTypeHero/ContentTypeHero.js +40 -0
- package/lib/ContentTypeHero/ContentTypeHero.js.map +1 -0
- package/lib/CopyParagraphButton/CopyParagraphButton.js +63 -0
- package/lib/CopyParagraphButton/CopyParagraphButton.js.map +1 -0
- package/lib/CopyParagraphButton/index.js +8 -0
- package/lib/CopyParagraphButton/index.js.map +1 -0
- package/lib/Embed/AudioEmbed.js +53 -0
- package/lib/Embed/AudioEmbed.js.map +1 -0
- package/lib/Embed/BrightcoveEmbed.js +97 -0
- package/lib/Embed/BrightcoveEmbed.js.map +1 -0
- package/lib/Embed/CodeEmbed.js +62 -0
- package/lib/Embed/CodeEmbed.js.map +1 -0
- package/lib/Embed/ConceptEmbed.js +81 -0
- package/lib/Embed/ConceptEmbed.js.map +1 -0
- package/lib/Embed/ConceptInlineTriggerButton.js +41 -0
- package/lib/Embed/ConceptInlineTriggerButton.js.map +1 -0
- package/lib/Embed/ContentLinkEmbed.js +32 -0
- package/lib/Embed/ContentLinkEmbed.js.map +1 -0
- package/lib/Embed/CopyrightEmbed.js +24 -0
- package/lib/Embed/CopyrightEmbed.js.map +1 -0
- package/lib/Embed/EmbedErrorPlaceholder.js +44 -0
- package/lib/Embed/EmbedErrorPlaceholder.js.map +1 -0
- package/lib/Embed/EmbedWrapper.js +27 -0
- package/lib/Embed/EmbedWrapper.js.map +1 -0
- package/lib/Embed/ExternalEmbed.js +55 -0
- package/lib/Embed/ExternalEmbed.js.map +1 -0
- package/lib/Embed/FootnoteEmbed.js +28 -0
- package/lib/Embed/FootnoteEmbed.js.map +1 -0
- package/lib/Embed/GlossEmbed.js +53 -0
- package/lib/Embed/GlossEmbed.js.map +1 -0
- package/lib/Embed/H5pEmbed.js +39 -0
- package/lib/Embed/H5pEmbed.js.map +1 -0
- package/lib/Embed/IframeEmbed.js +70 -0
- package/lib/Embed/IframeEmbed.js.map +1 -0
- package/lib/Embed/ImageEmbed.js +183 -0
- package/lib/Embed/ImageEmbed.js.map +1 -0
- package/lib/Embed/InlineTriggerButton.js +26 -0
- package/lib/Embed/InlineTriggerButton.js.map +1 -0
- package/lib/Embed/RelatedContentEmbed.js +39 -0
- package/lib/Embed/RelatedContentEmbed.js.map +1 -0
- package/lib/Embed/UnknownEmbed.js +21 -0
- package/lib/Embed/UnknownEmbed.js.map +1 -0
- package/lib/Embed/UuDisclaimerEmbed.js +55 -0
- package/lib/Embed/UuDisclaimerEmbed.js.map +1 -0
- package/lib/ErrorMessage/ErrorMessage.js +55 -0
- package/lib/ErrorMessage/ErrorMessage.js.map +1 -0
- package/lib/ErrorMessage/index.js +8 -0
- package/lib/ErrorMessage/index.js.map +1 -0
- package/lib/FactBox/FactBox.js +122 -0
- package/lib/FactBox/FactBox.js.map +1 -0
- package/lib/FactBox/index.js +8 -0
- package/lib/FactBox/index.js.map +1 -0
- package/lib/FileList/File.js +78 -0
- package/lib/FileList/File.js.map +1 -0
- package/lib/FileList/FileList.js +35 -0
- package/lib/FileList/FileList.js.map +1 -0
- package/lib/FileList/PdfFile.js +29 -0
- package/lib/FileList/PdfFile.js.map +1 -0
- package/lib/Gloss/Gloss.js +143 -0
- package/lib/Gloss/Gloss.js.map +1 -0
- package/lib/Gloss/GlossExample.js +47 -0
- package/lib/Gloss/GlossExample.js.map +1 -0
- package/lib/Grid/Grid.js +67 -0
- package/lib/Grid/Grid.js.map +1 -0
- package/lib/Grid/GridParallaxItem.js +22 -0
- package/lib/Grid/GridParallaxItem.js.map +1 -0
- package/lib/KeyFigure/KeyFigure.js +47 -0
- package/lib/KeyFigure/KeyFigure.js.map +1 -0
- package/lib/LicenseByline/EmbedByline.js +134 -0
- package/lib/LicenseByline/EmbedByline.js.map +1 -0
- package/lib/LicenseByline/LicenseLink.js +32 -0
- package/lib/LicenseByline/LicenseLink.js.map +1 -0
- package/lib/LinkBlock/LinkBlock.js +75 -0
- package/lib/LinkBlock/LinkBlock.js.map +1 -0
- package/lib/LinkBlock/LinkBlockSection.js +24 -0
- package/lib/LinkBlock/LinkBlockSection.js.map +1 -0
- package/lib/Pitch/Pitch.js +63 -0
- package/lib/Pitch/Pitch.js.map +1 -0
- package/lib/RelatedArticleList/RelatedArticleList.js +99 -0
- package/lib/RelatedArticleList/RelatedArticleList.js.map +1 -0
- package/lib/RelatedArticleList/index.js +8 -0
- package/lib/RelatedArticleList/index.js.map +1 -0
- package/lib/ResourceBox/ResourceBox.js +75 -0
- package/lib/ResourceBox/ResourceBox.js.map +1 -0
- package/lib/TagSelector/TagSelector.js +108 -0
- package/lib/TagSelector/TagSelector.js.map +1 -0
- package/lib/ZendeskButton/ZendeskButton.js +42 -0
- package/lib/ZendeskButton/ZendeskButton.js.map +1 -0
- package/lib/_virtual/rolldown_runtime.js +42 -0
- package/lib/i18n/formatNestedMessages.js +18 -0
- package/lib/i18n/formatNestedMessages.js.map +1 -0
- package/lib/i18n/i18n.js +31 -0
- package/lib/i18n/i18n.js.map +1 -0
- package/lib/i18n/useComponentTranslations.js +163 -0
- package/lib/i18n/useComponentTranslations.js.map +1 -0
- package/lib/index.js +157 -0
- package/lib/locale/messages-en.js +439 -0
- package/lib/locale/messages-en.js.map +1 -0
- package/lib/locale/messages-nb.js +439 -0
- package/lib/locale/messages-nb.js.map +1 -0
- package/lib/locale/messages-nn.js +439 -0
- package/lib/locale/messages-nn.js.map +1 -0
- package/lib/locale/messages-se.js +439 -0
- package/lib/locale/messages-se.js.map +1 -0
- package/lib/model/ContentType.js +94 -0
- package/lib/model/ContentType.js.map +1 -0
- package/lib/model/SubjectCategories.js +30 -0
- package/lib/model/SubjectCategories.js.map +1 -0
- package/lib/model/SubjectTypes.js +28 -0
- package/lib/model/SubjectTypes.js.map +1 -0
- package/lib/model/WordClass.js +58 -0
- package/lib/model/WordClass.js.map +1 -0
- package/lib/model/index.js +19 -0
- package/lib/model/index.js.map +1 -0
- package/lib/utils/licenseAttributes.js +17 -0
- package/lib/utils/licenseAttributes.js.map +1 -0
- package/lib/utils/relativeUrl.js +26 -0
- package/lib/utils/relativeUrl.js.map +1 -0
- package/package.json +12 -11
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { __export } from "../_virtual/rolldown_runtime.js";
|
|
2
|
+
|
|
3
|
+
//#region src/model/WordClass.ts
|
|
4
|
+
var WordClass_exports = {};
|
|
5
|
+
__export(WordClass_exports, { wordClass: () => wordClass });
|
|
6
|
+
/**
|
|
7
|
+
* Copyright (c) 2023-present, NDLA.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
const wordClass = {
|
|
14
|
+
adjective: "adjective",
|
|
15
|
+
adverb: "adverb",
|
|
16
|
+
properNoun: "proper-noun",
|
|
17
|
+
auxiliary: "auxiliary",
|
|
18
|
+
complement: "complement",
|
|
19
|
+
conjunction: "conjunction",
|
|
20
|
+
coverb: "coverb",
|
|
21
|
+
determiner: "determiner",
|
|
22
|
+
interjection: "interjection",
|
|
23
|
+
quantifier: "quantifier",
|
|
24
|
+
marker: "marker",
|
|
25
|
+
modalVerb: "modal-verb",
|
|
26
|
+
measureWord: "measure-word",
|
|
27
|
+
noun: "noun",
|
|
28
|
+
"noun-zh": "noun-zh",
|
|
29
|
+
nounPhrase: "noun-phrase",
|
|
30
|
+
onomatopoeia: "onomatopoeia",
|
|
31
|
+
particle: "particle",
|
|
32
|
+
demonstrative: "demonstrative",
|
|
33
|
+
personalPronoun: "personal-pronoun",
|
|
34
|
+
preposition: "preposition",
|
|
35
|
+
pronoun: "pronoun",
|
|
36
|
+
questionWord: "question-word",
|
|
37
|
+
locationWord: "location-word",
|
|
38
|
+
suffix: "suffix",
|
|
39
|
+
numeral: "numeral",
|
|
40
|
+
timeWord: "time word",
|
|
41
|
+
timeExpression: "time-expression",
|
|
42
|
+
stativeVerb: "stative-verb",
|
|
43
|
+
subordinatingConjunction: "subordinating-conjunction",
|
|
44
|
+
exclamationWord: "exclamation-word",
|
|
45
|
+
expression: "expression",
|
|
46
|
+
verb: "verb",
|
|
47
|
+
verbComplement: "verb-complement",
|
|
48
|
+
verbObject: "verb-object"
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
export { WordClass_exports };
|
|
53
|
+
//# sourceMappingURL=WordClass.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WordClass.js","names":[],"sources":["../../src/model/WordClass.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\nexport const wordClass = {\n adjective: \"adjective\",\n adverb: \"adverb\",\n properNoun: \"proper-noun\",\n auxiliary: \"auxiliary\",\n complement: \"complement\",\n conjunction: \"conjunction\",\n coverb: \"coverb\",\n determiner: \"determiner\",\n interjection: \"interjection\",\n quantifier: \"quantifier\",\n marker: \"marker\",\n modalVerb: \"modal-verb\",\n measureWord: \"measure-word\",\n noun: \"noun\",\n \"noun-zh\": \"noun-zh\",\n nounPhrase: \"noun-phrase\",\n onomatopoeia: \"onomatopoeia\",\n particle: \"particle\",\n demonstrative: \"demonstrative\",\n personalPronoun: \"personal-pronoun\",\n preposition: \"preposition\",\n pronoun: \"pronoun\",\n questionWord: \"question-word\",\n locationWord: \"location-word\",\n suffix: \"suffix\",\n numeral: \"numeral\",\n timeWord: \"time word\",\n timeExpression: \"time-expression\",\n stativeVerb: \"stative-verb\",\n subordinatingConjunction: \"subordinating-conjunction\",\n exclamationWord: \"exclamation-word\",\n expression: \"expression\",\n verb: \"verb\",\n verbComplement: \"verb-complement\",\n verbObject: \"verb-object\",\n};\n"],"mappings":";;;;;;;;;;;;AAQA,MAAa,YAAY;CACvB,WAAW;CACX,QAAQ;CACR,YAAY;CACZ,WAAW;CACX,YAAY;CACZ,aAAa;CACb,QAAQ;CACR,YAAY;CACZ,cAAc;CACd,YAAY;CACZ,QAAQ;CACR,WAAW;CACX,aAAa;CACb,MAAM;CACN,WAAW;CACX,YAAY;CACZ,cAAc;CACd,UAAU;CACV,eAAe;CACf,iBAAiB;CACjB,aAAa;CACb,SAAS;CACT,cAAc;CACd,cAAc;CACd,QAAQ;CACR,SAAS;CACT,UAAU;CACV,gBAAgB;CAChB,aAAa;CACb,0BAA0B;CAC1B,iBAAiB;CACjB,YAAY;CACZ,MAAM;CACN,gBAAgB;CAChB,YAAY;AACb"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { contentTypeMapping, contentTypes, resourceEmbedTypeMapping } from "./ContentType.js";
|
|
2
|
+
import { SubjectCategories_exports } from "./SubjectCategories.js";
|
|
3
|
+
import { SubjectTypes_exports } from "./SubjectTypes.js";
|
|
4
|
+
import { WordClass_exports } from "./WordClass.js";
|
|
5
|
+
|
|
6
|
+
//#region src/model/index.ts
|
|
7
|
+
const model = {
|
|
8
|
+
contentTypes,
|
|
9
|
+
subjectCategories: SubjectCategories_exports,
|
|
10
|
+
subjectTypes: SubjectTypes_exports,
|
|
11
|
+
contentTypeMapping,
|
|
12
|
+
resourceEmbedTypeMapping,
|
|
13
|
+
wordClass: WordClass_exports
|
|
14
|
+
};
|
|
15
|
+
var model_default = model;
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { model_default };
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/model/index.ts"],"sourcesContent":["/**\n * Copyright (c) 2017-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 { contentTypes, contentTypeMapping, resourceEmbedTypeMapping } from \"./ContentType\";\nimport * as subjectCategories from \"./SubjectCategories\";\nimport * as subjectTypes from \"./SubjectTypes\";\nimport * as wordClass from \"./WordClass\";\n\nconst model = {\n contentTypes,\n subjectCategories,\n subjectTypes,\n contentTypeMapping,\n resourceEmbedTypeMapping,\n wordClass,\n};\n\nexport default model;\n"],"mappings":";;;;;;AAaA,MAAM,QAAQ;CACZ;CACA;CACA;CACA;CACA;CACA;AACD;AAED,oBAAe"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { getLicenseByAbbreviation, isCreativeCommonsLicense } from "@ndla/licenses";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/licenseAttributes.ts
|
|
4
|
+
const licenseAttributes = (license, lang, url) => {
|
|
5
|
+
const licenseAbbr = getLicenseByAbbreviation(license ? license : "", lang);
|
|
6
|
+
const licenseProps = isCreativeCommonsLicense(licenseAbbr.rights) ? {
|
|
7
|
+
"xmlns:cc": "https://creativecommons.org/ns#",
|
|
8
|
+
"xmlns:dct": "http://purl.org/dc/terms/",
|
|
9
|
+
about: url ?? void 0
|
|
10
|
+
} : {};
|
|
11
|
+
return licenseProps;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { licenseAttributes };
|
|
16
|
+
//# sourceMappingURL=licenseAttributes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"licenseAttributes.js","names":["license: string | undefined","lang: string | undefined","url: string | undefined"],"sources":["../../src/utils/licenseAttributes.ts"],"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 { getLicenseByAbbreviation, isCreativeCommonsLicense } from \"@ndla/licenses\";\n\nexport const licenseAttributes = (license: string | undefined, lang: string | undefined, url: string | undefined) => {\n const licenseAbbr = getLicenseByAbbreviation(license ? license : \"\", lang);\n\n const licenseProps = isCreativeCommonsLicense(licenseAbbr.rights)\n ? {\n \"xmlns:cc\": \"https://creativecommons.org/ns#\",\n \"xmlns:dct\": \"http://purl.org/dc/terms/\",\n about: url ?? undefined,\n }\n : {};\n\n return licenseProps;\n};\n"],"mappings":";;;AAUA,MAAa,oBAAoB,CAACA,SAA6BC,MAA0BC,QAA4B;CACnH,MAAM,cAAc,yBAAyB,UAAU,UAAU,IAAI,KAAK;CAE1E,MAAM,eAAe,yBAAyB,YAAY,OAAO,GAC7D;EACE,YAAY;EACZ,aAAa;EACb,OAAO;CACR,IACD,CAAE;AAEN,QAAO;AACR"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { supportedTranslationLanguages } from "../i18n/i18n.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/relativeUrl.ts
|
|
4
|
+
const ENV_REGEX = /(staging|test)\.?/;
|
|
5
|
+
const LANGUAGE_REGEX = new RegExp(`^\\/((?:${supportedTranslationLanguages.join("|")})(?:$|\\/))`, "");
|
|
6
|
+
const NDLA_URL = /(.*\.)?ndla.no.*/;
|
|
7
|
+
const REPLACE_WWW = /^www\./;
|
|
8
|
+
const getPossiblyRelativeUrl = (url, path) => {
|
|
9
|
+
if (!path) return url;
|
|
10
|
+
if (url.startsWith("mailto:")) return url;
|
|
11
|
+
if (!NDLA_URL.test(url) || !NDLA_URL.test(path)) return url;
|
|
12
|
+
const urlObj = new URL(url.replace(ENV_REGEX, ""));
|
|
13
|
+
const pathObj = new URL(path.replace(ENV_REGEX, ""));
|
|
14
|
+
if (urlObj.hostname.replace(REPLACE_WWW, "") === pathObj.hostname.replace(REPLACE_WWW, "")) {
|
|
15
|
+
const search = urlObj.search;
|
|
16
|
+
const urlMatch = urlObj.pathname.match(LANGUAGE_REGEX);
|
|
17
|
+
const pathMatch = pathObj.pathname.match(LANGUAGE_REGEX);
|
|
18
|
+
if (urlMatch?.[1] && urlMatch?.[1] !== pathMatch?.[1]) return `${urlObj.pathname.replace(urlMatch[1], pathMatch?.[1] || "")}${search}`;
|
|
19
|
+
return `${urlObj.pathname}${search}`;
|
|
20
|
+
}
|
|
21
|
+
return url;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
export { getPossiblyRelativeUrl };
|
|
26
|
+
//# sourceMappingURL=relativeUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relativeUrl.js","names":["url: string","path?: string"],"sources":["../../src/utils/relativeUrl.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 { supportedTranslationLanguages } from \"../i18n/i18n\";\n\nconst ENV_REGEX = /(staging|test)\\.?/;\nconst LANGUAGE_REGEX = new RegExp(`^\\\\/((?:${supportedTranslationLanguages.join(\"|\")})(?:$|\\\\/))`, \"\");\n\nconst NDLA_URL = /(.*\\.)?ndla.no.*/;\nconst REPLACE_WWW = /^www\\./;\n\nexport const getPossiblyRelativeUrl = (url: string, path?: string) => {\n if (!path) return url;\n // If url is a mailto link, return url as is.\n if (url.startsWith(\"mailto:\")) return url;\n // If not on NDLA, or if url is not a NDLA url, return url as is\n if (!NDLA_URL.test(url) || !NDLA_URL.test(path)) return url;\n //Remove environment info\n const urlObj = new URL(url.replace(ENV_REGEX, \"\"));\n const pathObj = new URL(path.replace(ENV_REGEX, \"\"));\n // If the host is the same, return the relative path\n if (urlObj.hostname.replace(REPLACE_WWW, \"\") === pathObj.hostname.replace(REPLACE_WWW, \"\")) {\n // Replace the language part of the url with the language part of the path\n // Keep the search params if they exist\n const search = urlObj.search;\n // If the path language part does not exist, remove it.\n const urlMatch = urlObj.pathname.match(LANGUAGE_REGEX);\n const pathMatch = pathObj.pathname.match(LANGUAGE_REGEX);\n if (urlMatch?.[1] && urlMatch?.[1] !== pathMatch?.[1]) {\n return `${urlObj.pathname.replace(urlMatch[1], pathMatch?.[1] || \"\")}${search}`;\n }\n\n return `${urlObj.pathname}${search}`;\n }\n return url;\n};\n"],"mappings":";;;AAUA,MAAM,YAAY;AAClB,MAAM,iBAAiB,IAAI,QAAQ,UAAU,8BAA8B,KAAK,IAAI,CAAC,cAAc;AAEnG,MAAM,WAAW;AACjB,MAAM,cAAc;AAEpB,MAAa,yBAAyB,CAACA,KAAaC,SAAkB;AACpE,MAAK,KAAM,QAAO;AAElB,KAAI,IAAI,WAAW,UAAU,CAAE,QAAO;AAEtC,MAAK,SAAS,KAAK,IAAI,KAAK,SAAS,KAAK,KAAK,CAAE,QAAO;CAExD,MAAM,SAAS,IAAI,IAAI,IAAI,QAAQ,WAAW,GAAG;CACjD,MAAM,UAAU,IAAI,IAAI,KAAK,QAAQ,WAAW,GAAG;AAEnD,KAAI,OAAO,SAAS,QAAQ,aAAa,GAAG,KAAK,QAAQ,SAAS,QAAQ,aAAa,GAAG,EAAE;EAG1F,MAAM,SAAS,OAAO;EAEtB,MAAM,WAAW,OAAO,SAAS,MAAM,eAAe;EACtD,MAAM,YAAY,QAAQ,SAAS,MAAM,eAAe;AACxD,MAAI,WAAW,MAAM,WAAW,OAAO,YAAY,GACjD,SAAQ,EAAE,OAAO,SAAS,QAAQ,SAAS,IAAI,YAAY,MAAM,GAAG,CAAC,EAAE,OAAO;AAGhF,UAAQ,EAAE,OAAO,SAAS,EAAE,OAAO;CACpC;AACD,QAAO;AACR"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require_ContentTypeBadge = require('../ContentTypeBadge/ContentTypeBadge.js');
|
|
3
|
+
const require_ArticleByline = require('./ArticleByline.js');
|
|
4
|
+
const react = require_rolldown_runtime.__toESM(require("react"));
|
|
5
|
+
const __ndla_primitives = require_rolldown_runtime.__toESM(require("@ndla/primitives"));
|
|
6
|
+
const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
|
|
7
|
+
const react_jsx_runtime = require_rolldown_runtime.__toESM(require("react/jsx-runtime"));
|
|
8
|
+
const __ark_ui_react = require_rolldown_runtime.__toESM(require("@ark-ui/react"));
|
|
9
|
+
const __ndla_styled_system_css = require_rolldown_runtime.__toESM(require("@ndla/styled-system/css"));
|
|
10
|
+
|
|
11
|
+
//#region src/Article/Article.tsx
|
|
12
|
+
const StyledArticleContent = (0, __ndla_styled_system_jsx.styled)(__ark_ui_react.ark.section, {}, { baseComponent: true });
|
|
13
|
+
const ArticleContent = (0, react.forwardRef)(({ className,...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledArticleContent, {
|
|
14
|
+
className: (0, __ndla_styled_system_css.cx)("ndla-article", className),
|
|
15
|
+
...props,
|
|
16
|
+
ref
|
|
17
|
+
}));
|
|
18
|
+
const StyledArticleWrapper = (0, __ndla_styled_system_jsx.styled)(__ark_ui_react.ark.article, { base: {
|
|
19
|
+
background: "background.default",
|
|
20
|
+
display: "flex",
|
|
21
|
+
flexDirection: "column",
|
|
22
|
+
color: "text.default",
|
|
23
|
+
alignItems: "center",
|
|
24
|
+
width: "100%",
|
|
25
|
+
overflowWrap: "break-word",
|
|
26
|
+
position: "relative",
|
|
27
|
+
"& mjx-stretchy-v > mjx-ext > mjx-c": { transform: "scaleY(100) translateY(0.075em)" },
|
|
28
|
+
_after: {
|
|
29
|
+
content: "",
|
|
30
|
+
display: "table",
|
|
31
|
+
clear: "both"
|
|
32
|
+
}
|
|
33
|
+
} }, { baseComponent: true });
|
|
34
|
+
const ArticleWrapper = (0, react.forwardRef)((props, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledArticleWrapper, {
|
|
35
|
+
"data-ndla-article": "",
|
|
36
|
+
ref,
|
|
37
|
+
...props
|
|
38
|
+
}));
|
|
39
|
+
const ArticleHGroup = (0, __ndla_styled_system_jsx.styled)(__ark_ui_react.ark.hgroup, { base: {
|
|
40
|
+
display: "flex",
|
|
41
|
+
width: "100%",
|
|
42
|
+
flexDirection: "column",
|
|
43
|
+
alignItems: "flex-start",
|
|
44
|
+
"& h1": { overflowWrap: "anywhere" }
|
|
45
|
+
} }, { baseComponent: true });
|
|
46
|
+
const ArticleHeader = (0, __ndla_styled_system_jsx.styled)(__ark_ui_react.ark.header, { base: {
|
|
47
|
+
display: "flex",
|
|
48
|
+
flexDirection: "column",
|
|
49
|
+
gap: "medium",
|
|
50
|
+
alignItems: "flex-start",
|
|
51
|
+
width: "100%",
|
|
52
|
+
paddingBlockStart: "xxlarge",
|
|
53
|
+
overflowWrap: "anywhere"
|
|
54
|
+
} }, { baseComponent: true });
|
|
55
|
+
const ArticleFooter = (0, __ndla_styled_system_jsx.styled)(__ark_ui_react.ark.footer, { base: {
|
|
56
|
+
display: "flex",
|
|
57
|
+
flexDirection: "column",
|
|
58
|
+
gap: "xxlarge",
|
|
59
|
+
width: "100%",
|
|
60
|
+
"& > :is(:last-child)": { paddingBlockEnd: "5xlarge" }
|
|
61
|
+
} }, { baseComponent: true });
|
|
62
|
+
const StyledStack = (0, __ndla_styled_system_jsx.styled)(__ndla_styled_system_jsx.Stack, { base: {
|
|
63
|
+
width: "100%",
|
|
64
|
+
minHeight: "xxlarge"
|
|
65
|
+
} });
|
|
66
|
+
const StyledWrapper = (0, __ndla_styled_system_jsx.styled)("div", { base: {
|
|
67
|
+
display: "flex",
|
|
68
|
+
gap: "small",
|
|
69
|
+
flexWrap: "wrap",
|
|
70
|
+
alignItems: "center"
|
|
71
|
+
} });
|
|
72
|
+
const ArticleTitle = ({ contentType, heartButton, title, lang, id, introduction, contentTypeLabel, competenceGoals, disclaimer }) => {
|
|
73
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ArticleHeader, { children: [
|
|
74
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ArticleHGroup, { children: [(!!contentType || !!heartButton) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledStack, {
|
|
75
|
+
justify: "space-between",
|
|
76
|
+
align: "center",
|
|
77
|
+
direction: "row",
|
|
78
|
+
gap: "small",
|
|
79
|
+
children: [!!contentType && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ContentTypeBadge.ContentTypeBadge, {
|
|
80
|
+
contentType,
|
|
81
|
+
children: contentTypeLabel
|
|
82
|
+
}), heartButton]
|
|
83
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Heading, {
|
|
84
|
+
textStyle: "heading.medium",
|
|
85
|
+
id,
|
|
86
|
+
lang,
|
|
87
|
+
property: "dct:title",
|
|
88
|
+
children: title
|
|
89
|
+
})] }),
|
|
90
|
+
!!introduction && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Text, {
|
|
91
|
+
lang,
|
|
92
|
+
textStyle: "body.xlarge",
|
|
93
|
+
asChild: true,
|
|
94
|
+
consumeCss: true,
|
|
95
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: introduction })
|
|
96
|
+
}),
|
|
97
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledWrapper, { children: [competenceGoals, disclaimer] })
|
|
98
|
+
] });
|
|
99
|
+
};
|
|
100
|
+
const Article = ({ article, contentType, licenseBox, children, competenceGoals, contentTypeLabel, id, heartButton, lang, disclaimer }) => {
|
|
101
|
+
const { title, introduction, published, content, footNotes, copyright } = article;
|
|
102
|
+
const authors = copyright?.creators.length || copyright?.rightsholders.length ? copyright.creators : copyright?.processors;
|
|
103
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ArticleWrapper, { children: [
|
|
104
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ArticleTitle, {
|
|
105
|
+
id,
|
|
106
|
+
contentType,
|
|
107
|
+
heartButton,
|
|
108
|
+
title,
|
|
109
|
+
introduction,
|
|
110
|
+
competenceGoals,
|
|
111
|
+
lang,
|
|
112
|
+
contentTypeLabel,
|
|
113
|
+
disclaimer
|
|
114
|
+
}),
|
|
115
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ArticleContent, { children: content }),
|
|
116
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ArticleFooter, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ArticleByline.ArticleByline, {
|
|
117
|
+
footnotes: footNotes,
|
|
118
|
+
authors,
|
|
119
|
+
suppliers: copyright?.rightsholders,
|
|
120
|
+
published,
|
|
121
|
+
licenseBox
|
|
122
|
+
}), children] })
|
|
123
|
+
] });
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
//#endregion
|
|
127
|
+
exports.Article = Article;
|
|
128
|
+
exports.ArticleContent = ArticleContent;
|
|
129
|
+
exports.ArticleFooter = ArticleFooter;
|
|
130
|
+
exports.ArticleHGroup = ArticleHGroup;
|
|
131
|
+
exports.ArticleHeader = ArticleHeader;
|
|
132
|
+
exports.ArticleTitle = ArticleTitle;
|
|
133
|
+
exports.ArticleWrapper = ArticleWrapper;
|
|
134
|
+
//# sourceMappingURL=Article.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Article.js","names":["ark","Stack","ContentTypeBadge","Heading","Text","ArticleByline"],"sources":["../../src/Article/Article.tsx"],"sourcesContent":["/**\n * Copyright (c) 2016-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 ComponentPropsWithRef, type ReactNode, forwardRef } from \"react\";\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\";\nimport { Heading, Text } from \"@ndla/primitives\";\nimport { cx } from \"@ndla/styled-system/css\";\nimport { Stack, styled } from \"@ndla/styled-system/jsx\";\nimport type { JsxStyleProps } from \"@ndla/styled-system/types\";\nimport { ArticleByline } from \"./ArticleByline\";\nimport { ContentTypeBadge, type ContentType } from \"../ContentTypeBadge/ContentTypeBadge\";\nimport type { Article as ArticleType } from \"../types\";\n\nconst StyledArticleContent = styled(ark.section, {}, { baseComponent: true });\n\nexport const ArticleContent = forwardRef<HTMLElement, HTMLArkProps<\"div\"> & JsxStyleProps>(\n ({ className, ...props }, ref) => (\n <StyledArticleContent className={cx(\"ndla-article\", className)} {...props} ref={ref} />\n ),\n);\n\nconst StyledArticleWrapper = styled(\n ark.article,\n {\n base: {\n background: \"background.default\",\n display: \"flex\",\n flexDirection: \"column\",\n color: \"text.default\",\n alignItems: \"center\",\n width: \"100%\",\n overflowWrap: \"break-word\",\n position: \"relative\",\n \"& mjx-stretchy-v > mjx-ext > mjx-c\": {\n transform: \"scaleY(100) translateY(0.075em)\",\n },\n _after: {\n content: \"\",\n display: \"table\",\n clear: \"both\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport const ArticleWrapper = forwardRef<HTMLElement, ComponentPropsWithRef<\"article\"> & JsxStyleProps>(\n (props, ref) => <StyledArticleWrapper data-ndla-article=\"\" ref={ref} {...props} />,\n);\n\nexport const ArticleHGroup = styled(\n ark.hgroup,\n {\n base: {\n display: \"flex\",\n width: \"100%\",\n flexDirection: \"column\",\n alignItems: \"flex-start\",\n \"& h1\": {\n overflowWrap: \"anywhere\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport const ArticleHeader = styled(\n ark.header,\n {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n alignItems: \"flex-start\",\n width: \"100%\",\n paddingBlockStart: \"xxlarge\",\n overflowWrap: \"anywhere\",\n },\n },\n { baseComponent: true },\n);\n\nexport const ArticleFooter = styled(\n ark.footer,\n {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xxlarge\",\n width: \"100%\",\n \"& > :is(:last-child)\": {\n paddingBlockEnd: \"5xlarge\",\n },\n },\n },\n { baseComponent: true },\n);\n\nconst StyledStack = styled(Stack, {\n base: {\n width: \"100%\",\n minHeight: \"xxlarge\",\n },\n});\n\nconst StyledWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n gap: \"small\",\n flexWrap: \"wrap\",\n alignItems: \"center\",\n },\n});\n\ninterface ArticleTitleProps {\n heartButton?: ReactNode;\n contentType?: ContentType;\n contentTypeLabel?: ReactNode;\n competenceGoals?: ReactNode;\n id: string;\n lang?: string;\n title?: ReactNode;\n introduction?: ReactNode;\n disclaimer?: ReactNode;\n}\n\nexport const ArticleTitle = ({\n contentType,\n heartButton,\n title,\n lang,\n id,\n introduction,\n contentTypeLabel,\n competenceGoals,\n disclaimer,\n}: ArticleTitleProps) => {\n return (\n <ArticleHeader>\n <ArticleHGroup>\n {(!!contentType || !!heartButton) && (\n <StyledStack justify=\"space-between\" align=\"center\" direction=\"row\" gap=\"small\">\n {!!contentType && <ContentTypeBadge contentType={contentType}>{contentTypeLabel}</ContentTypeBadge>}\n {heartButton}\n </StyledStack>\n )}\n <Heading textStyle=\"heading.medium\" id={id} lang={lang} property=\"dct:title\">\n {title}\n </Heading>\n </ArticleHGroup>\n {!!introduction && (\n <Text lang={lang} textStyle=\"body.xlarge\" asChild consumeCss>\n <div>{introduction}</div>\n </Text>\n )}\n <StyledWrapper>\n {competenceGoals}\n {disclaimer}\n </StyledWrapper>\n </ArticleHeader>\n );\n};\n\ninterface Props {\n heartButton?: ReactNode;\n article: ArticleType;\n licenseBox?: ReactNode;\n contentType?: ContentType;\n contentTypeLabel?: ReactNode;\n children?: ReactNode;\n competenceGoals?: ReactNode;\n id: string;\n lang?: string;\n disclaimer?: ReactNode;\n}\n\nexport const Article = ({\n article,\n contentType,\n licenseBox,\n children,\n competenceGoals,\n contentTypeLabel,\n id,\n heartButton,\n lang,\n disclaimer,\n}: Props) => {\n const { title, introduction, published, content, footNotes, copyright } = article;\n\n const authors =\n copyright?.creators.length || copyright?.rightsholders.length ? copyright.creators : copyright?.processors;\n\n return (\n <ArticleWrapper>\n <ArticleTitle\n id={id}\n contentType={contentType}\n heartButton={heartButton}\n title={title}\n introduction={introduction}\n competenceGoals={competenceGoals}\n lang={lang}\n contentTypeLabel={contentTypeLabel}\n disclaimer={disclaimer}\n />\n <ArticleContent>{content}</ArticleContent>\n <ArticleFooter>\n <ArticleByline\n footnotes={footNotes}\n authors={authors}\n suppliers={copyright?.rightsholders}\n published={published}\n licenseBox={licenseBox}\n />\n {children}\n </ArticleFooter>\n </ArticleWrapper>\n );\n};\n"],"mappings":";;;;;;;;;;;AAkBA,MAAM,uBAAuB,qCAAOA,mBAAI,SAAS,CAAE,GAAE,EAAE,eAAe,KAAM,EAAC;AAE7E,MAAa,iBAAiB,sBAC5B,CAAC,EAAE,UAAW,GAAG,OAAO,EAAE,wBACxB,2BAAC;CAAqB,WAAW,iCAAG,gBAAgB,UAAU;CAAE,GAAI;CAAY;EAAO,CAE1F;AAED,MAAM,uBAAuB,qCAC3BA,mBAAI,SACJ,EACE,MAAM;CACJ,YAAY;CACZ,SAAS;CACT,eAAe;CACf,OAAO;CACP,YAAY;CACZ,OAAO;CACP,cAAc;CACd,UAAU;CACV,sCAAsC,EACpC,WAAW,kCACZ;CACD,QAAQ;EACN,SAAS;EACT,SAAS;EACT,OAAO;CACR;AACF,EACF,GACD,EAAE,eAAe,KAAM,EACxB;AAED,MAAa,iBAAiB,sBAC5B,CAAC,OAAO,wBAAQ,2BAAC;CAAqB,qBAAkB;CAAQ;CAAK,GAAI;EAAS,CACnF;AAED,MAAa,gBAAgB,qCAC3BA,mBAAI,QACJ,EACE,MAAM;CACJ,SAAS;CACT,OAAO;CACP,eAAe;CACf,YAAY;CACZ,QAAQ,EACN,cAAc,WACf;AACF,EACF,GACD,EAAE,eAAe,KAAM,EACxB;AAED,MAAa,gBAAgB,qCAC3BA,mBAAI,QACJ,EACE,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACL,YAAY;CACZ,OAAO;CACP,mBAAmB;CACnB,cAAc;AACf,EACF,GACD,EAAE,eAAe,KAAM,EACxB;AAED,MAAa,gBAAgB,qCAC3BA,mBAAI,QACJ,EACE,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACL,OAAO;CACP,wBAAwB,EACtB,iBAAiB,UAClB;AACF,EACF,GACD,EAAE,eAAe,KAAM,EACxB;AAED,MAAM,cAAc,qCAAOC,gCAAO,EAChC,MAAM;CACJ,OAAO;CACP,WAAW;AACZ,EACF,EAAC;AAEF,MAAM,gBAAgB,qCAAO,OAAO,EAClC,MAAM;CACJ,SAAS;CACT,KAAK;CACL,UAAU;CACV,YAAY;AACb,EACF,EAAC;AAcF,MAAa,eAAe,CAAC,EAC3B,aACA,aACA,OACA,MACA,IACA,cACA,kBACA,iBACA,YACkB,KAAK;AACvB,wBACE,4BAAC;kBACC,4BAAC,+BACK,iBAAiB,gCACnB,4BAAC;GAAY,SAAQ;GAAgB,OAAM;GAAS,WAAU;GAAM,KAAI;gBACnE,+BAAe,2BAACC;IAA8B;cAAc;KAAoC,EAClG;IACW,kBAEhB,2BAACC;GAAQ,WAAU;GAAqB;GAAU;GAAM,UAAS;aAC9D;IACO,IACI;IACb,gCACD,2BAACC;GAAW;GAAM,WAAU;GAAc;GAAQ;6BAChD,2BAAC,mBAAK,eAAmB;IACpB;kBAET,4BAAC,4BACE,iBACA,cACa;KACF;AAEnB;AAeD,MAAa,UAAU,CAAC,EACtB,SACA,aACA,YACA,UACA,iBACA,kBACA,IACA,aACA,MACA,YACM,KAAK;CACX,MAAM,EAAE,OAAO,cAAc,WAAW,SAAS,WAAW,WAAW,GAAG;CAE1E,MAAM,UACJ,WAAW,SAAS,UAAU,WAAW,cAAc,SAAS,UAAU,WAAW,WAAW;AAElG,wBACE,4BAAC;kBACC,2BAAC;GACK;GACS;GACA;GACN;GACO;GACG;GACX;GACY;GACN;IACZ;kBACF,2BAAC,4BAAgB,UAAyB;kBAC1C,4BAAC,4CACC,2BAACC;GACC,WAAW;GACF;GACT,WAAW,WAAW;GACX;GACC;IACZ,EACD,YACa;KACD;AAEpB"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require_ArticleFootNotes = require('./ArticleFootNotes.js');
|
|
3
|
+
const react = require_rolldown_runtime.__toESM(require("react"));
|
|
4
|
+
const __ndla_primitives = require_rolldown_runtime.__toESM(require("@ndla/primitives"));
|
|
5
|
+
const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
|
|
6
|
+
const react_i18next = require_rolldown_runtime.__toESM(require("react-i18next"));
|
|
7
|
+
const __ndla_icons = require_rolldown_runtime.__toESM(require("@ndla/icons"));
|
|
8
|
+
const react_jsx_runtime = require_rolldown_runtime.__toESM(require("react/jsx-runtime"));
|
|
9
|
+
const react_router_dom = require_rolldown_runtime.__toESM(require("react-router-dom"));
|
|
10
|
+
|
|
11
|
+
//#region src/Article/ArticleByline.tsx
|
|
12
|
+
const Wrapper = (0, __ndla_styled_system_jsx.styled)("div", { base: {
|
|
13
|
+
marginBlockStart: "medium",
|
|
14
|
+
paddingBlockStart: "xsmall",
|
|
15
|
+
borderTop: "1px solid",
|
|
16
|
+
borderColor: "stroke.subtle"
|
|
17
|
+
} });
|
|
18
|
+
const TextWrapper = (0, __ndla_styled_system_jsx.styled)("div", {
|
|
19
|
+
base: {
|
|
20
|
+
display: "flex",
|
|
21
|
+
flexDirection: "column",
|
|
22
|
+
gap: "3xsmall",
|
|
23
|
+
width: "100%",
|
|
24
|
+
justifyContent: "space-between",
|
|
25
|
+
paddingBlock: "xsmall",
|
|
26
|
+
textStyle: "body.medium",
|
|
27
|
+
"& [data-contributors=\"false\"]": { marginInlineStart: "auto" }
|
|
28
|
+
},
|
|
29
|
+
variants: { learningpath: {
|
|
30
|
+
true: {},
|
|
31
|
+
false: { tabletWide: { flexDirection: "row" } }
|
|
32
|
+
} }
|
|
33
|
+
});
|
|
34
|
+
const renderContributors = (contributors, t) => {
|
|
35
|
+
const contributorsArray = contributors.map((contributor, index) => {
|
|
36
|
+
if (index < 1) return contributor.name;
|
|
37
|
+
const sep = index === contributors.length - 1 ? ` ${t("article.conjunction")} ` : ", ";
|
|
38
|
+
return `${sep}${contributor.name}`;
|
|
39
|
+
});
|
|
40
|
+
return contributorsArray.join("");
|
|
41
|
+
};
|
|
42
|
+
const getSuppliersText = (suppliers, t) => {
|
|
43
|
+
if (suppliers.length === 0) return "";
|
|
44
|
+
return suppliers.length > 1 ? t("article.multipleSuppliersLabel", {
|
|
45
|
+
names: renderContributors(suppliers, t),
|
|
46
|
+
interpolation: { escapeValue: false }
|
|
47
|
+
}) : t("article.supplierLabel", {
|
|
48
|
+
name: renderContributors(suppliers, t),
|
|
49
|
+
interpolation: { escapeValue: false }
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
const StyledAccordionRoot = (0, __ndla_styled_system_jsx.styled)(__ndla_primitives.AccordionRoot, { base: { paddingBlockStart: "xxlarge" } });
|
|
53
|
+
const refRegexp = /note\d/;
|
|
54
|
+
const footnotesAccordionId = "footnotes";
|
|
55
|
+
const ArticleByline = ({ authors = [], suppliers = [], footnotes, licenseBox, published, displayByline = true, bylineType = "article", bylineSuffix }) => {
|
|
56
|
+
const { t } = (0, react_i18next.useTranslation)();
|
|
57
|
+
const { pathname } = (0, react_router_dom.useLocation)();
|
|
58
|
+
const [openAccordions, setOpenAccordions] = (0, react.useState)([]);
|
|
59
|
+
const accordionItemValue = "rulesForUse";
|
|
60
|
+
const onHashChange = (0, react.useCallback)((e) => {
|
|
61
|
+
const hash = e.newURL.split("#")[1];
|
|
62
|
+
if (hash?.match(refRegexp) && !openAccordions.includes(footnotesAccordionId)) {
|
|
63
|
+
setOpenAccordions([...openAccordions, footnotesAccordionId]);
|
|
64
|
+
const el = document.getElementById(`#${hash}`);
|
|
65
|
+
el?.click();
|
|
66
|
+
el?.focus();
|
|
67
|
+
}
|
|
68
|
+
}, [openAccordions]);
|
|
69
|
+
(0, react.useEffect)(() => {
|
|
70
|
+
setOpenAccordions((prev) => prev.filter((state) => state !== accordionItemValue));
|
|
71
|
+
}, [pathname]);
|
|
72
|
+
(0, react.useEffect)(() => {
|
|
73
|
+
window.addEventListener("hashchange", onHashChange);
|
|
74
|
+
return () => window.removeEventListener("hashchange", onHashChange);
|
|
75
|
+
}, [onHashChange]);
|
|
76
|
+
const showPrimaryContributors = suppliers.length > 0 || authors.length > 0;
|
|
77
|
+
const authorLabel = {
|
|
78
|
+
article: "article.authorsLabel",
|
|
79
|
+
learningPath: "article.authorsLabelLearningpath",
|
|
80
|
+
external: "article.authorsLabelExternal"
|
|
81
|
+
};
|
|
82
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Wrapper, { children: [!!displayByline && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(TextWrapper, {
|
|
83
|
+
learningpath: bylineType === "learningPath",
|
|
84
|
+
children: [
|
|
85
|
+
!!showPrimaryContributors && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [authors.length > 0 && `${t(authorLabel[bylineType], {
|
|
86
|
+
names: renderContributors(authors, t),
|
|
87
|
+
interpolation: { escapeValue: false }
|
|
88
|
+
})}. `, getSuppliersText(suppliers, t)] }),
|
|
89
|
+
published ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
90
|
+
"data-contributors": showPrimaryContributors,
|
|
91
|
+
children: [
|
|
92
|
+
t(`${bylineType}.lastUpdated`),
|
|
93
|
+
" ",
|
|
94
|
+
published
|
|
95
|
+
]
|
|
96
|
+
}) : null,
|
|
97
|
+
bylineSuffix
|
|
98
|
+
]
|
|
99
|
+
}), (!!licenseBox || !!footnotes?.length) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledAccordionRoot, {
|
|
100
|
+
multiple: true,
|
|
101
|
+
value: openAccordions,
|
|
102
|
+
onValueChange: (details) => setOpenAccordions(details.value),
|
|
103
|
+
children: [!!licenseBox && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ArticleBylineAccordionItem, {
|
|
104
|
+
value: accordionItemValue,
|
|
105
|
+
accordionTitle: t("article.useContent"),
|
|
106
|
+
children: licenseBox
|
|
107
|
+
}), !!footnotes?.length && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ArticleBylineAccordionItem, {
|
|
108
|
+
value: footnotesAccordionId,
|
|
109
|
+
accordionTitle: t("article.footnotes"),
|
|
110
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ArticleFootNotes.ArticleFootNotes, { footNotes: footnotes })
|
|
111
|
+
})]
|
|
112
|
+
})] });
|
|
113
|
+
};
|
|
114
|
+
const ArticleBylineAccordionItem = (0, react.forwardRef)(({ value, accordionTitle, children,...props }, ref) => {
|
|
115
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__ndla_primitives.AccordionItem, {
|
|
116
|
+
value,
|
|
117
|
+
ref,
|
|
118
|
+
...props,
|
|
119
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Heading, {
|
|
120
|
+
asChild: true,
|
|
121
|
+
consumeCss: true,
|
|
122
|
+
textStyle: "label.medium",
|
|
123
|
+
fontWeight: "bold",
|
|
124
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__ndla_primitives.AccordionItemTrigger, { children: [accordionTitle, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.AccordionItemIndicator, {
|
|
125
|
+
asChild: true,
|
|
126
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_icons.ArrowDownShortLine, {})
|
|
127
|
+
})] }) })
|
|
128
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.AccordionItemContent, { children })]
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
//#endregion
|
|
133
|
+
exports.ArticleByline = ArticleByline;
|
|
134
|
+
exports.ArticleBylineAccordionItem = ArticleBylineAccordionItem;
|
|
135
|
+
//# sourceMappingURL=ArticleByline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArticleByline.js","names":["contributors: SupplierProps[] | AuthorProps[]","t: TFunction","suppliers: SupplierProps[]","AccordionRoot","e: HashChangeEvent","authorLabel: Record<string, string>","ArticleFootNotes","AccordionItem","Heading","AccordionItemTrigger","AccordionItemIndicator","ArrowDownShortLine","AccordionItemContent"],"sources":["../../src/Article/ArticleByline.tsx"],"sourcesContent":["/**\n * Copyright (c) 2020-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 { TFunction } from \"i18next\";\nimport { type ReactNode, forwardRef, useCallback, useEffect, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { useLocation } from \"react-router-dom\";\nimport { ArrowDownShortLine } from \"@ndla/icons\";\nimport {\n AccordionItem,\n AccordionItemContent,\n AccordionItemIndicator,\n type AccordionItemProps,\n AccordionItemTrigger,\n AccordionRoot,\n Heading,\n} from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { ArticleFootNotes } from \"./ArticleFootNotes\";\nimport type { FootNote } from \"../types\";\n\nconst Wrapper = styled(\"div\", {\n base: {\n // TODO: Figure out if we want to remove this margin. It's only here to add some gap between the article content and the byline.\n marginBlockStart: \"medium\",\n paddingBlockStart: \"xsmall\",\n borderTop: \"1px solid\",\n borderColor: \"stroke.subtle\",\n },\n});\n\nconst TextWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n width: \"100%\",\n justifyContent: \"space-between\",\n paddingBlock: \"xsmall\",\n textStyle: \"body.medium\",\n '& [data-contributors=\"false\"]': {\n marginInlineStart: \"auto\",\n },\n },\n variants: {\n learningpath: {\n true: {},\n false: {\n tabletWide: {\n flexDirection: \"row\",\n },\n },\n },\n },\n});\n\ntype AuthorProps = {\n name: string;\n};\n\ntype SupplierProps = {\n name: string;\n};\n\ntype Props = {\n authors?: AuthorProps[];\n suppliers?: SupplierProps[];\n published?: string;\n licenseBox?: ReactNode;\n footnotes?: FootNote[];\n displayByline?: boolean;\n bylineType?: \"article\" | \"learningPath\" | \"external\";\n bylineSuffix?: ReactNode;\n};\n\nconst renderContributors = (contributors: SupplierProps[] | AuthorProps[], t: TFunction) => {\n const contributorsArray = contributors.map((contributor, index) => {\n if (index < 1) return contributor.name;\n const sep = index === contributors.length - 1 ? ` ${t(\"article.conjunction\")} ` : \", \";\n return `${sep}${contributor.name}`;\n });\n return contributorsArray.join(\"\");\n};\n\nconst getSuppliersText = (suppliers: SupplierProps[], t: TFunction) => {\n if (suppliers.length === 0) {\n return \"\";\n }\n return suppliers.length > 1\n ? t(\"article.multipleSuppliersLabel\", {\n names: renderContributors(suppliers, t),\n interpolation: { escapeValue: false },\n })\n : t(\"article.supplierLabel\", {\n name: renderContributors(suppliers, t),\n interpolation: { escapeValue: false },\n });\n};\n\nconst StyledAccordionRoot = styled(AccordionRoot, {\n base: {\n paddingBlockStart: \"xxlarge\",\n },\n});\n\nconst refRegexp = /note\\d/;\nconst footnotesAccordionId = \"footnotes\";\n\nexport const ArticleByline = ({\n authors = [],\n suppliers = [],\n footnotes,\n licenseBox,\n published,\n displayByline = true,\n bylineType = \"article\",\n bylineSuffix,\n}: Props) => {\n const { t } = useTranslation();\n const { pathname } = useLocation();\n const [openAccordions, setOpenAccordions] = useState<string[]>([]);\n const accordionItemValue = \"rulesForUse\";\n\n const onHashChange = useCallback(\n (e: HashChangeEvent) => {\n const hash = e.newURL.split(\"#\")[1];\n if (hash?.match(refRegexp) && !openAccordions.includes(footnotesAccordionId)) {\n setOpenAccordions([...openAccordions, footnotesAccordionId]);\n const el = document.getElementById(`#${hash}`);\n el?.click();\n el?.focus();\n }\n },\n [openAccordions],\n );\n\n useEffect(() => {\n setOpenAccordions((prev) => prev.filter((state) => state !== accordionItemValue));\n }, [pathname]);\n\n useEffect(() => {\n window.addEventListener(\"hashchange\", onHashChange);\n return () => window.removeEventListener(\"hashchange\", onHashChange);\n }, [onHashChange]);\n\n const showPrimaryContributors = suppliers.length > 0 || authors.length > 0;\n\n const authorLabel: Record<string, string> = {\n article: \"article.authorsLabel\",\n learningPath: \"article.authorsLabelLearningpath\",\n external: \"article.authorsLabelExternal\",\n };\n\n return (\n <Wrapper>\n {!!displayByline && (\n <TextWrapper learningpath={bylineType === \"learningPath\"}>\n {!!showPrimaryContributors && (\n <span>\n {authors.length > 0 &&\n `${t(authorLabel[bylineType], {\n names: renderContributors(authors, t),\n interpolation: { escapeValue: false },\n })}. `}\n {getSuppliersText(suppliers, t)}\n </span>\n )}\n {published ? (\n <div data-contributors={showPrimaryContributors}>\n {t(`${bylineType}.lastUpdated`)} {published}\n </div>\n ) : null}\n {bylineSuffix}\n </TextWrapper>\n )}\n {(!!licenseBox || !!footnotes?.length) && (\n <StyledAccordionRoot\n multiple\n value={openAccordions}\n onValueChange={(details) => setOpenAccordions(details.value)}\n >\n {!!licenseBox && (\n <ArticleBylineAccordionItem value={accordionItemValue} accordionTitle={t(\"article.useContent\")}>\n {licenseBox}\n </ArticleBylineAccordionItem>\n )}\n {!!footnotes?.length && (\n <ArticleBylineAccordionItem value={footnotesAccordionId} accordionTitle={t(\"article.footnotes\")}>\n <ArticleFootNotes footNotes={footnotes} />\n </ArticleBylineAccordionItem>\n )}\n </StyledAccordionRoot>\n )}\n </Wrapper>\n );\n};\n\ninterface ArticleBylineAccordionprops extends AccordionItemProps {\n accordionTitle: ReactNode;\n}\n\nexport const ArticleBylineAccordionItem = forwardRef<HTMLDivElement, ArticleBylineAccordionprops>(\n ({ value, accordionTitle, children, ...props }, ref) => {\n return (\n <AccordionItem value={value} ref={ref} {...props}>\n <Heading asChild consumeCss textStyle=\"label.medium\" fontWeight=\"bold\">\n <h2>\n <AccordionItemTrigger>\n {accordionTitle}\n <AccordionItemIndicator asChild>\n <ArrowDownShortLine />\n </AccordionItemIndicator>\n </AccordionItemTrigger>\n </h2>\n </Heading>\n <AccordionItemContent>{children}</AccordionItemContent>\n </AccordionItem>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;AA0BA,MAAM,UAAU,qCAAO,OAAO,EAC5B,MAAM;CAEJ,kBAAkB;CAClB,mBAAmB;CACnB,WAAW;CACX,aAAa;AACd,EACF,EAAC;AAEF,MAAM,cAAc,qCAAO,OAAO;CAChC,MAAM;EACJ,SAAS;EACT,eAAe;EACf,KAAK;EACL,OAAO;EACP,gBAAgB;EAChB,cAAc;EACd,WAAW;EACX,mCAAiC,EAC/B,mBAAmB,OACpB;CACF;CACD,UAAU,EACR,cAAc;EACZ,MAAM,CAAE;EACR,OAAO,EACL,YAAY,EACV,eAAe,MAChB,EACF;CACF,EACF;AACF,EAAC;AAqBF,MAAM,qBAAqB,CAACA,cAA+CC,MAAiB;CAC1F,MAAM,oBAAoB,aAAa,IAAI,CAAC,aAAa,UAAU;AACjE,MAAI,QAAQ,EAAG,QAAO,YAAY;EAClC,MAAM,MAAM,UAAU,aAAa,SAAS,KAAK,GAAG,EAAE,sBAAsB,CAAC,KAAK;AAClF,UAAQ,EAAE,IAAI,EAAE,YAAY,KAAK;CAClC,EAAC;AACF,QAAO,kBAAkB,KAAK,GAAG;AAClC;AAED,MAAM,mBAAmB,CAACC,WAA4BD,MAAiB;AACrE,KAAI,UAAU,WAAW,EACvB,QAAO;AAET,QAAO,UAAU,SAAS,IACtB,EAAE,kCAAkC;EAClC,OAAO,mBAAmB,WAAW,EAAE;EACvC,eAAe,EAAE,aAAa,MAAO;CACtC,EAAC,GACF,EAAE,yBAAyB;EACzB,MAAM,mBAAmB,WAAW,EAAE;EACtC,eAAe,EAAE,aAAa,MAAO;CACtC,EAAC;AACP;AAED,MAAM,sBAAsB,qCAAOE,iCAAe,EAChD,MAAM,EACJ,mBAAmB,UACpB,EACF,EAAC;AAEF,MAAM,YAAY;AAClB,MAAM,uBAAuB;AAE7B,MAAa,gBAAgB,CAAC,EAC5B,UAAU,CAAE,GACZ,YAAY,CAAE,GACd,WACA,YACA,WACA,gBAAgB,MAChB,aAAa,WACb,cACM,KAAK;CACX,MAAM,EAAE,GAAG,GAAG,mCAAgB;CAC9B,MAAM,EAAE,UAAU,GAAG,mCAAa;CAClC,MAAM,CAAC,gBAAgB,kBAAkB,GAAG,oBAAmB,CAAE,EAAC;CAClE,MAAM,qBAAqB;CAE3B,MAAM,eAAe,uBACnB,CAACC,MAAuB;EACtB,MAAM,OAAO,EAAE,OAAO,MAAM,IAAI,CAAC;AACjC,MAAI,MAAM,MAAM,UAAU,KAAK,eAAe,SAAS,qBAAqB,EAAE;AAC5E,qBAAkB,CAAC,GAAG,gBAAgB,oBAAqB,EAAC;GAC5D,MAAM,KAAK,SAAS,gBAAgB,GAAG,KAAK,EAAE;AAC9C,OAAI,OAAO;AACX,OAAI,OAAO;EACZ;CACF,GACD,CAAC,cAAe,EACjB;AAED,sBAAU,MAAM;AACd,oBAAkB,CAAC,SAAS,KAAK,OAAO,CAAC,UAAU,UAAU,mBAAmB,CAAC;CAClF,GAAE,CAAC,QAAS,EAAC;AAEd,sBAAU,MAAM;AACd,SAAO,iBAAiB,cAAc,aAAa;AACnD,SAAO,MAAM,OAAO,oBAAoB,cAAc,aAAa;CACpE,GAAE,CAAC,YAAa,EAAC;CAElB,MAAM,0BAA0B,UAAU,SAAS,KAAK,QAAQ,SAAS;CAEzE,MAAMC,cAAsC;EAC1C,SAAS;EACT,cAAc;EACd,UAAU;CACX;AAED,wBACE,4BAAC,wBACI,iCACD,4BAAC;EAAY,cAAc,eAAe;;KACrC,2CACD,4BAAC,qBACE,QAAQ,SAAS,MACf,EAAE,EAAE,YAAY,aAAa;IAC5B,OAAO,mBAAmB,SAAS,EAAE;IACrC,eAAe,EAAE,aAAa,MAAO;GACtC,EAAC,CAAC,KACJ,iBAAiB,WAAW,EAAE,IAC1B;GAER,4BACC,4BAAC;IAAI,qBAAmB;;KACrB,GAAG,EAAE,WAAW,cAAc;KAAC;KAAE;;KAC9B,GACJ;GACH;;GACW,KAEZ,gBAAgB,WAAW,2BAC7B,4BAAC;EACC;EACA,OAAO;EACP,eAAe,CAAC,YAAY,kBAAkB,QAAQ,MAAM;eAEzD,8BACD,2BAAC;GAA2B,OAAO;GAAoB,gBAAgB,EAAE,qBAAqB;aAC3F;IAC0B,IAE5B,WAAW,0BACZ,2BAAC;GAA2B,OAAO;GAAsB,gBAAgB,EAAE,oBAAoB;6BAC7F,2BAACC,6CAAiB,WAAW,YAAa;IACf;GAEX,IAEhB;AAEb;AAMD,MAAa,6BAA6B,sBACxC,CAAC,EAAE,OAAO,gBAAgB,SAAU,GAAG,OAAO,EAAE,QAAQ;AACtD,wBACE,4BAACC;EAAqB;EAAY;EAAK,GAAI;6BACzC,2BAACC;GAAQ;GAAQ;GAAW,WAAU;GAAe,YAAW;6BAC9D,2BAAC,kCACC,4BAACC,qDACE,gCACD,2BAACC;IAAuB;8BACtB,2BAACC,oCAAqB;KACC,IACJ,GACpB;IACG,kBACV,2BAACC,0CAAsB,WAAgC;GACzC;AAEnB,EACF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
+
const __ndla_primitives = require_rolldown_runtime.__toESM(require("@ndla/primitives"));
|
|
3
|
+
const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
|
|
4
|
+
const react_jsx_runtime = require_rolldown_runtime.__toESM(require("react/jsx-runtime"));
|
|
5
|
+
|
|
6
|
+
//#region src/Article/ArticleFootNotes.tsx
|
|
7
|
+
const citeDetailString = (description) => description ? `${description}. ` : "";
|
|
8
|
+
const StyledCite = (0, __ndla_styled_system_jsx.styled)("cite", { base: {
|
|
9
|
+
display: "flex",
|
|
10
|
+
alignItems: "center",
|
|
11
|
+
gap: "xsmall"
|
|
12
|
+
} });
|
|
13
|
+
const FootNote = ({ footNote }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Text, {
|
|
14
|
+
id: `note${footNote.ref}`,
|
|
15
|
+
asChild: true,
|
|
16
|
+
consumeCss: true,
|
|
17
|
+
textStyle: "body.medium",
|
|
18
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledCite, { children: [
|
|
19
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
20
|
+
href: `#ref${footNote.ref}`,
|
|
21
|
+
target: "_self",
|
|
22
|
+
children: footNote.ref
|
|
23
|
+
}),
|
|
24
|
+
`«${footNote.title}». ${footNote.authors.join(" ")}. ${citeDetailString(footNote.edition)}${citeDetailString(footNote.publisher)}${footNote.year}. `,
|
|
25
|
+
footNote.url ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
|
|
26
|
+
href: footNote.url,
|
|
27
|
+
children: [footNote.url, "."]
|
|
28
|
+
}) : null
|
|
29
|
+
] })
|
|
30
|
+
}) });
|
|
31
|
+
const FootnoteList = (0, __ndla_styled_system_jsx.styled)("ol", { base: {
|
|
32
|
+
display: "flex",
|
|
33
|
+
flexDirection: "column",
|
|
34
|
+
gap: "medium",
|
|
35
|
+
listStyle: "none"
|
|
36
|
+
} });
|
|
37
|
+
const ArticleFootNotes = ({ footNotes }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FootnoteList, { children: footNotes.map((footNote) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FootNote, { footNote }, footNote.ref)) });
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
exports.ArticleFootNotes = ArticleFootNotes;
|
|
41
|
+
//# sourceMappingURL=ArticleFootNotes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArticleFootNotes.js","names":["description: string | undefined","Text"],"sources":["../../src/Article/ArticleFootNotes.tsx"],"sourcesContent":["/**\n * Copyright (c) 2017-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 { Text } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { FootNote as FootNoteType } from \"../types\";\n\nconst citeDetailString = (description: string | undefined) => (description ? `${description}. ` : \"\");\n\ntype FootNoteProps = {\n footNote: FootNoteType;\n};\n\nconst StyledCite = styled(\"cite\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"xsmall\",\n },\n});\n\nconst FootNote = ({ footNote }: FootNoteProps) => (\n <li>\n <Text id={`note${footNote.ref}`} asChild consumeCss textStyle=\"body.medium\">\n <StyledCite>\n <a href={`#ref${footNote.ref}`} target=\"_self\">\n {footNote.ref}\n </a>\n {`«${footNote.title}». ${footNote.authors.join(\" \")}. ${citeDetailString(footNote.edition)}${citeDetailString(\n footNote.publisher,\n )}${footNote.year}. `}\n {footNote.url ? (\n <a href={footNote.url}>\n {footNote.url}\n {\".\"}\n </a>\n ) : null}\n </StyledCite>\n </Text>\n </li>\n);\n\ntype ArticleFootNotesProps = {\n footNotes: Array<FootNoteType>;\n};\n\nconst FootnoteList = styled(\"ol\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n listStyle: \"none\",\n },\n});\n\nexport const ArticleFootNotes = ({ footNotes }: ArticleFootNotesProps) => (\n <FootnoteList>\n {footNotes.map((footNote) => (\n <FootNote key={footNote.ref} footNote={footNote} />\n ))}\n </FootnoteList>\n);\n"],"mappings":";;;;;;AAYA,MAAM,mBAAmB,CAACA,gBAAqC,eAAe,EAAE,YAAY,MAAM;AAMlG,MAAM,aAAa,qCAAO,QAAQ,EAChC,MAAM;CACJ,SAAS;CACT,YAAY;CACZ,KAAK;AACN,EACF,EAAC;AAEF,MAAM,WAAW,CAAC,EAAE,UAAyB,qBAC3C,2BAAC,kCACC,2BAACC;CAAK,KAAK,MAAM,SAAS,IAAI;CAAG;CAAQ;CAAW,WAAU;2BAC5D,4BAAC;kBACC,2BAAC;GAAE,OAAO,MAAM,SAAS,IAAI;GAAG,QAAO;aACpC,SAAS;IACR;GACF,GAAG,SAAS,MAAM,KAAK,SAAS,QAAQ,KAAK,IAAI,CAAC,IAAI,iBAAiB,SAAS,QAAQ,CAAC,EAAE,iBAC3F,SAAS,UACV,CAAC,EAAE,SAAS,KAAK;EACjB,SAAS,sBACR,4BAAC;GAAE,MAAM,SAAS;cACf,SAAS,KACT;IACC,GACF;KACO;EACR,GACJ;AAOP,MAAM,eAAe,qCAAO,MAAM,EAChC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACL,WAAW;AACZ,EACF,EAAC;AAEF,MAAa,mBAAmB,CAAC,EAAE,WAAkC,qBACnE,2BAAC,0BACE,UAAU,IAAI,CAAC,6BACd,2BAAC,YAAsC,YAAxB,SAAS,IAA2B,CACnD,GACW"}
|