@pega/cosmos-react-core 8.29.0 → 8.31.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/lib/components/HTML/HTML.d.ts.map +1 -1
- package/lib/components/HTML/HTML.js +11 -5
- package/lib/components/HTML/HTML.js.map +1 -1
- package/lib/hooks/useAnimatedText.d.ts.map +1 -1
- package/lib/hooks/useAnimatedText.js +59 -45
- package/lib/hooks/useAnimatedText.js.map +1 -1
- package/lib/hooks/useI18n.d.ts +24 -0
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/i18n/default.d.ts +24 -0
- package/lib/i18n/default.d.ts.map +1 -1
- package/lib/i18n/default.js +28 -0
- package/lib/i18n/default.js.map +1 -1
- package/lib/i18n/i18n.d.ts +24 -0
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/utils/markdownTokenizer.d.ts +4 -1
- package/lib/utils/markdownTokenizer.d.ts.map +1 -1
- package/lib/utils/markdownTokenizer.js +46 -13
- package/lib/utils/markdownTokenizer.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HTML.d.ts","sourceRoot":"","sources":["../../../src/components/HTML/HTML.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAOtD,OAAO,KAAK,EACV,SAAS,EACT,+BAA+B,EAC/B,cAAc,EACd,UAAU,EACX,MAAM,aAAa,CAAC;AAQrB,MAAM,WAAW,SAAU,SAAQ,SAAS,EAAE,cAAc,EAAE,UAAU;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,UAAU,wDA2CtB,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,OAAO,YAAY,
|
|
1
|
+
{"version":3,"file":"HTML.d.ts","sourceRoot":"","sources":["../../../src/components/HTML/HTML.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAOtD,OAAO,KAAK,EACV,SAAS,EACT,+BAA+B,EAC/B,cAAc,EACd,UAAU,EACX,MAAM,aAAa,CAAC;AAQrB,MAAM,WAAW,SAAU,SAAQ,SAAS,EAAE,cAAc,EAAE,UAAU;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,UAAU,wDA2CtB,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,OAAO,YAAY,2DAiCjD,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,OAAO,YAAY,WAwDhD,CAAC;AAEF,eAAO,MAAM,UAAU,6EAqBrB,CAAC;;;;AA6EH,wBAAiD"}
|
|
@@ -56,27 +56,33 @@ export const listStyles = css `
|
|
|
56
56
|
export const getTableStyles = (theme) => css `
|
|
57
57
|
border-collapse: collapse;
|
|
58
58
|
|
|
59
|
-
td
|
|
59
|
+
td,
|
|
60
|
+
th {
|
|
60
61
|
border: 0.0625rem solid ${theme.base.palette['border-line']};
|
|
61
62
|
min-width: 6.25rem;
|
|
63
|
+
padding: ${theme.base.spacing};
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
tr:first-child {
|
|
65
|
-
td:first-child
|
|
67
|
+
td:first-child,
|
|
68
|
+
th:first-child {
|
|
66
69
|
border-top-left-radius: 0.125rem;
|
|
67
70
|
}
|
|
68
71
|
|
|
69
|
-
td:last-child
|
|
72
|
+
td:last-child,
|
|
73
|
+
th:last-child {
|
|
70
74
|
border-top-right-radius: 0.125rem;
|
|
71
75
|
}
|
|
72
76
|
}
|
|
73
77
|
|
|
74
78
|
tr:last-child {
|
|
75
|
-
td:first-child
|
|
79
|
+
td:first-child,
|
|
80
|
+
th:first-child {
|
|
76
81
|
border-bottom-left-radius: 0.125rem;
|
|
77
82
|
}
|
|
78
83
|
|
|
79
|
-
td:last-child
|
|
84
|
+
td:last-child,
|
|
85
|
+
th:last-child {
|
|
80
86
|
border-bottom-right-radius: 0.125rem;
|
|
81
87
|
}
|
|
82
88
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HTML.js","sourceRoot":"","sources":["../../../src/components/HTML/HTML.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,eAAe,MAAM,WAAW,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAQjD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,SAAS,GAAG,eAAe,EAAE,CAAC;AAQpC,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2C5B,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAmB,EAAE,EAAE,CAAC,GAAG,CAAA;;;;8BAI5B,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;;;;;;;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U,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS;iBAC/E;gBACD,kBAAkB,EAAE,UAAU;aAC/B,CAAC;YACJ,CAAC,CAAC,EAAE,CAAC;IACT,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAEnD,SAAS,CAAC,GAAG,EAAE;QACb,UAAU,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,KAAC,UAAU,mBACI,OAAO,CAAC,IAAI,KACrB,SAAS,EACb,uBAAuB,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,EAClD,GAAG,EAAE,GAAG,GACR,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import { forwardRef, useState, useEffect, useMemo } from 'react';\nimport type { PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\nimport type { DefaultTheme } from 'styled-components';\nimport createDOMPurify from 'dompurify';\n\nimport { StyledPopover } from '../Popover';\nimport { defaultThemeProp } from '../../theme';\nimport { calculateFontSize } from '../../styles';\nimport type { FontSize } from '../../styles';\nimport type {\n BaseProps,\n ForwardRefForwardPropsComponent,\n NoChildrenProp,\n TestIdProp\n} from '../../types';\nimport { allowedURI, withTestIds } from '../../utils';\nimport { useTestIds } from '../../hooks';\n\nimport { getHTMLTestIds } from './HTML.test-ids';\n\nconst DOMPurify = createDOMPurify();\n\nexport interface HTMLProps extends BaseProps, NoChildrenProp, TestIdProp {\n content: string;\n customTags?: string[];\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const listStyles = css`\n ul,\n ol {\n padding-inline-start: 2.5rem;\n }\n\n li {\n margin: 0.5rem 0;\n }\n\n ul li {\n ul {\n margin-inline-start: 1rem;\n list-style-type: circle;\n }\n\n ul ul {\n margin-inline-start: 2rem;\n list-style-type: square;\n }\n\n ul ul ul {\n margin-inline-start: 3rem;\n list-style-type: disc;\n }\n }\n\n ol li {\n ol {\n margin-inline-start: 1rem;\n list-style-type: lower-alpha;\n }\n\n ol ol {\n margin-inline-start: 2rem;\n list-style-type: lower-roman;\n }\n\n ol ol ol {\n margin-inline-start: 3rem;\n list-style-type: decimal;\n }\n }\n`;\n\nexport const getTableStyles = (theme: DefaultTheme) => css`\n border-collapse: collapse;\n\n td {\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n min-width: 6.25rem;\n }\n\n tr:first-child {\n td:first-child {\n border-top-left-radius: 0.125rem;\n }\n\n td:last-child {\n border-top-right-radius: 0.125rem;\n }\n }\n\n tr:last-child {\n td:first-child {\n border-bottom-left-radius: 0.125rem;\n }\n\n td:last-child {\n border-bottom-right-radius: 0.125rem;\n }\n }\n`;\n\nexport const getHtmlStyles = (theme: DefaultTheme) => {\n const {\n base: { 'font-size': baseFontSize, 'font-scale': baseFontScale, palette },\n components: { text }\n } = theme;\n const fontSize = calculateFontSize(baseFontSize, baseFontScale);\n return `\n ${listStyles}\n table {\n ${getTableStyles(theme)}\n }\n img {\n max-width: 100%;\n height: auto;\n border-radius: 0.25rem;\n }\n a {\n color: ${palette.interactive};\n }\n pre {\n white-space: break-spaces;\n }\n p {\n min-height: ${fontSize[text.primary['font-size'] as FontSize]};\n }\n h1 {\n font-size: ${fontSize[text.h1['font-size'] as FontSize]};\n font-weight: ${text.h1['font-weight']};\n min-height: ${fontSize[text.h1['font-size'] as FontSize]};\n }\n h2 {\n font-size: ${fontSize[text.h2['font-size'] as FontSize]};\n font-weight: ${text.h2['font-weight']};\n min-height: ${fontSize[text.h2['font-size'] as FontSize]};\n }\n h3 {\n font-size: ${fontSize[text.h3['font-size'] as FontSize]};\n font-weight: ${text.h3['font-weight']};\n min-height: ${fontSize[text.h3['font-size'] as FontSize]};\n }\n h4 {\n font-size: ${fontSize[text.h4['font-size'] as FontSize]};\n font-weight: ${text.h4['font-weight']};\n min-height: ${fontSize[text.h4['font-size'] as FontSize]};\n }\n h5 {\n font-size: ${fontSize[text.h5['font-size'] as FontSize]};\n font-weight: ${text.h5['font-weight']};\n min-height: ${fontSize[text.h5['font-size'] as FontSize]};\n }\n h6 {\n font-size: ${fontSize[text.h6['font-size'] as FontSize]};\n font-weight: ${text.h6['font-weight']};\n min-height: ${fontSize[text.h6['font-size'] as FontSize]};\n }\n `;\n};\n\nexport const StyledHTML = styled.div(({ theme }) => {\n return css`\n width: 100%;\n overflow-x: auto;\n overflow-wrap: break-word;\n contain: paint;\n ${getHtmlStyles(theme)}\n\n ${StyledPopover} ul {\n ul {\n padding-inline-start: 0;\n }\n ol {\n padding-inline-start: 0;\n }\n }\n\n ${StyledPopover} li {\n margin: 0;\n }\n `;\n});\n\nStyledHTML.defaultProps = defaultThemeProp;\n\nif (DOMPurify.isSupported) {\n const targetBlankSet = new WeakSet<HTMLAnchorElement>();\n\n DOMPurify.addHook('beforeSanitizeAttributes', node => {\n // Can be passed text nodes\n if (!(node instanceof HTMLElement || node instanceof SVGElement)) return;\n\n node.removeAttribute('class');\n\n if (\n node.tagName === 'A' &&\n node.hasAttribute('href') &&\n node.getAttribute('target') === '_blank'\n ) {\n targetBlankSet.add(node as HTMLAnchorElement);\n }\n });\n\n DOMPurify.addHook('afterSanitizeAttributes', node => {\n if (node.tagName === 'A' && node.hasAttribute('href')) {\n const href = node.getAttribute('href')!;\n\n let fullURL: URL;\n try {\n fullURL = new URL(href, window.location.href);\n } catch (e) {\n return;\n }\n\n if (window.location.origin !== fullURL.origin) {\n node.setAttribute('target', '_blank');\n node.setAttribute('rel', 'noopener');\n } else if (targetBlankSet.has(node as HTMLAnchorElement)) {\n node.setAttribute('target', '_blank');\n targetBlankSet.delete(node as HTMLAnchorElement);\n }\n }\n });\n}\n\nconst HTML: ForwardRefForwardPropsComponent<HTMLProps> = forwardRef(function HTML(\n { testId, content, customTags, ...restProps }: PropsWithoutRef<HTMLProps>,\n ref: HTMLProps['ref']\n) {\n const [mounted, setMounted] = useState(false);\n const sanitizedHtml = useMemo(() => {\n // Don't render content on the server at all.\n return mounted && DOMPurify.isSupported\n ? DOMPurify.sanitize(content, {\n FORBID_TAGS: ['style', 'font'],\n CUSTOM_ELEMENT_HANDLING: {\n tagNameCheck: customTags ? tagName => customTags.includes(tagName) : undefined\n },\n ALLOWED_URI_REGEXP: allowedURI\n })\n : '';\n }, [content, customTags, mounted]);\n const testIds = useTestIds(testId, getHTMLTestIds);\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n return (\n <StyledHTML\n data-testid={testIds.root}\n {...restProps}\n dangerouslySetInnerHTML={{ __html: sanitizedHtml }}\n ref={ref}\n />\n );\n});\n\nexport default withTestIds(HTML, getHTMLTestIds);\n"]}
|
|
1
|
+
{"version":3,"file":"HTML.js","sourceRoot":"","sources":["../../../src/components/HTML/HTML.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,eAAe,MAAM,WAAW,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAQjD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,SAAS,GAAG,eAAe,EAAE,CAAC;AAQpC,MAAM,CAAC,MAAM,UAAU,GAA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AAC,CAAC;IAC9C,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,EAAE;QACjC,6CAA6C;QAC7C,OAAO,OAAO,IAAI,SAAS,CAAC,WAAW;YACrC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE;gBAC1B,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC;gBAC9B,uBAAuB,EAAE;oBACvB,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS;iBAC/E;gBACD,kBAAkB,EAAE,UAAU;aAC/B,CAAC;YACJ,CAAC,CAAC,EAAE,CAAC;IACT,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAEnD,SAAS,CAAC,GAAG,EAAE;QACb,UAAU,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,KAAC,UAAU,mBACI,OAAO,CAAC,IAAI,KACrB,SAAS,EACb,uBAAuB,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,EAClD,GAAG,EAAE,GAAG,GACR,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import { forwardRef, useState, useEffect, useMemo } from 'react';\nimport type { PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\nimport type { DefaultTheme } from 'styled-components';\nimport createDOMPurify from 'dompurify';\n\nimport { StyledPopover } from '../Popover';\nimport { defaultThemeProp } from '../../theme';\nimport { calculateFontSize } from '../../styles';\nimport type { FontSize } from '../../styles';\nimport type {\n BaseProps,\n ForwardRefForwardPropsComponent,\n NoChildrenProp,\n TestIdProp\n} from '../../types';\nimport { allowedURI, withTestIds } from '../../utils';\nimport { useTestIds } from '../../hooks';\n\nimport { getHTMLTestIds } from './HTML.test-ids';\n\nconst DOMPurify = createDOMPurify();\n\nexport interface HTMLProps extends BaseProps, NoChildrenProp, TestIdProp {\n content: string;\n customTags?: string[];\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const listStyles = css`\n ul,\n ol {\n padding-inline-start: 2.5rem;\n }\n\n li {\n margin: 0.5rem 0;\n }\n\n ul li {\n ul {\n margin-inline-start: 1rem;\n list-style-type: circle;\n }\n\n ul ul {\n margin-inline-start: 2rem;\n list-style-type: square;\n }\n\n ul ul ul {\n margin-inline-start: 3rem;\n list-style-type: disc;\n }\n }\n\n ol li {\n ol {\n margin-inline-start: 1rem;\n list-style-type: lower-alpha;\n }\n\n ol ol {\n margin-inline-start: 2rem;\n list-style-type: lower-roman;\n }\n\n ol ol ol {\n margin-inline-start: 3rem;\n list-style-type: decimal;\n }\n }\n`;\n\nexport const getTableStyles = (theme: DefaultTheme) => css`\n border-collapse: collapse;\n\n td,\n th {\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n min-width: 6.25rem;\n padding: ${theme.base.spacing};\n }\n\n tr:first-child {\n td:first-child,\n th:first-child {\n border-top-left-radius: 0.125rem;\n }\n\n td:last-child,\n th:last-child {\n border-top-right-radius: 0.125rem;\n }\n }\n\n tr:last-child {\n td:first-child,\n th:first-child {\n border-bottom-left-radius: 0.125rem;\n }\n\n td:last-child,\n th:last-child {\n border-bottom-right-radius: 0.125rem;\n }\n }\n`;\n\nexport const getHtmlStyles = (theme: DefaultTheme) => {\n const {\n base: { 'font-size': baseFontSize, 'font-scale': baseFontScale, palette },\n components: { text }\n } = theme;\n const fontSize = calculateFontSize(baseFontSize, baseFontScale);\n return `\n ${listStyles}\n table {\n ${getTableStyles(theme)}\n }\n img {\n max-width: 100%;\n height: auto;\n border-radius: 0.25rem;\n }\n a {\n color: ${palette.interactive};\n }\n pre {\n white-space: break-spaces;\n }\n p {\n min-height: ${fontSize[text.primary['font-size'] as FontSize]};\n }\n h1 {\n font-size: ${fontSize[text.h1['font-size'] as FontSize]};\n font-weight: ${text.h1['font-weight']};\n min-height: ${fontSize[text.h1['font-size'] as FontSize]};\n }\n h2 {\n font-size: ${fontSize[text.h2['font-size'] as FontSize]};\n font-weight: ${text.h2['font-weight']};\n min-height: ${fontSize[text.h2['font-size'] as FontSize]};\n }\n h3 {\n font-size: ${fontSize[text.h3['font-size'] as FontSize]};\n font-weight: ${text.h3['font-weight']};\n min-height: ${fontSize[text.h3['font-size'] as FontSize]};\n }\n h4 {\n font-size: ${fontSize[text.h4['font-size'] as FontSize]};\n font-weight: ${text.h4['font-weight']};\n min-height: ${fontSize[text.h4['font-size'] as FontSize]};\n }\n h5 {\n font-size: ${fontSize[text.h5['font-size'] as FontSize]};\n font-weight: ${text.h5['font-weight']};\n min-height: ${fontSize[text.h5['font-size'] as FontSize]};\n }\n h6 {\n font-size: ${fontSize[text.h6['font-size'] as FontSize]};\n font-weight: ${text.h6['font-weight']};\n min-height: ${fontSize[text.h6['font-size'] as FontSize]};\n }\n `;\n};\n\nexport const StyledHTML = styled.div(({ theme }) => {\n return css`\n width: 100%;\n overflow-x: auto;\n overflow-wrap: break-word;\n contain: paint;\n ${getHtmlStyles(theme)}\n\n ${StyledPopover} ul {\n ul {\n padding-inline-start: 0;\n }\n ol {\n padding-inline-start: 0;\n }\n }\n\n ${StyledPopover} li {\n margin: 0;\n }\n `;\n});\n\nStyledHTML.defaultProps = defaultThemeProp;\n\nif (DOMPurify.isSupported) {\n const targetBlankSet = new WeakSet<HTMLAnchorElement>();\n\n DOMPurify.addHook('beforeSanitizeAttributes', node => {\n // Can be passed text nodes\n if (!(node instanceof HTMLElement || node instanceof SVGElement)) return;\n\n node.removeAttribute('class');\n\n if (\n node.tagName === 'A' &&\n node.hasAttribute('href') &&\n node.getAttribute('target') === '_blank'\n ) {\n targetBlankSet.add(node as HTMLAnchorElement);\n }\n });\n\n DOMPurify.addHook('afterSanitizeAttributes', node => {\n if (node.tagName === 'A' && node.hasAttribute('href')) {\n const href = node.getAttribute('href')!;\n\n let fullURL: URL;\n try {\n fullURL = new URL(href, window.location.href);\n } catch (e) {\n return;\n }\n\n if (window.location.origin !== fullURL.origin) {\n node.setAttribute('target', '_blank');\n node.setAttribute('rel', 'noopener');\n } else if (targetBlankSet.has(node as HTMLAnchorElement)) {\n node.setAttribute('target', '_blank');\n targetBlankSet.delete(node as HTMLAnchorElement);\n }\n }\n });\n}\n\nconst HTML: ForwardRefForwardPropsComponent<HTMLProps> = forwardRef(function HTML(\n { testId, content, customTags, ...restProps }: PropsWithoutRef<HTMLProps>,\n ref: HTMLProps['ref']\n) {\n const [mounted, setMounted] = useState(false);\n const sanitizedHtml = useMemo(() => {\n // Don't render content on the server at all.\n return mounted && DOMPurify.isSupported\n ? DOMPurify.sanitize(content, {\n FORBID_TAGS: ['style', 'font'],\n CUSTOM_ELEMENT_HANDLING: {\n tagNameCheck: customTags ? tagName => customTags.includes(tagName) : undefined\n },\n ALLOWED_URI_REGEXP: allowedURI\n })\n : '';\n }, [content, customTags, mounted]);\n const testIds = useTestIds(testId, getHTMLTestIds);\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n return (\n <StyledHTML\n data-testid={testIds.root}\n {...restProps}\n dangerouslySetInnerHTML={{ __html: sanitizedHtml }}\n ref={ref}\n />\n );\n});\n\nexport default withTestIds(HTML, getHTMLTestIds);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAnimatedText.d.ts","sourceRoot":"","sources":["../../src/hooks/useAnimatedText.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useAnimatedText.d.ts","sourceRoot":"","sources":["../../src/hooks/useAnimatedText.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,eAAe,GAAI,2EAMtB;IACD,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,EAAE,OAAO,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;;;;CAoJA,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,38 +1,42 @@
|
|
|
1
|
-
import { useEffect, useState, useRef } from 'react';
|
|
1
|
+
import { useEffect, useState, useRef, useMemo } from 'react';
|
|
2
2
|
import tokenizeWithMarkdown from '../utils/markdownTokenizer';
|
|
3
|
+
import usePrevious from './usePrevious';
|
|
3
4
|
const useAnimatedText = ({ text, allContentReceived = false, enabled = true, tokenizeMarkdown = false, cursorStartIndex }) => {
|
|
5
|
+
const initialTokens = 3;
|
|
6
|
+
const maxTokens = 20;
|
|
7
|
+
const phraseSize = 3;
|
|
4
8
|
const [cursor, setCursor] = useState(0); // End pointer
|
|
5
9
|
const [startingCursor, setStartingCursor] = useState(0); // animation starting point
|
|
6
|
-
const [prevText, setPrevText] = useState(text);
|
|
7
10
|
const [isAnimationDone, setIsAnimationDone] = useState(false);
|
|
11
|
+
const currentSpeedRef = useRef(initialTokens);
|
|
8
12
|
const allContentReceivedRef = useRef(allContentReceived);
|
|
9
13
|
allContentReceivedRef.current = allContentReceived;
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return
|
|
16
|
-
};
|
|
17
|
-
// A new chunk has arrived
|
|
18
|
-
if (prevText !== text) {
|
|
19
|
-
setPrevText(text);
|
|
20
|
-
setStartingCursor(text.startsWith(prevText) ? cursor : 0);
|
|
21
|
-
setIsAnimationDone(false);
|
|
22
|
-
}
|
|
14
|
+
const prevText = usePrevious(text);
|
|
15
|
+
const tokens = useMemo(() => {
|
|
16
|
+
return tokenizeWithMarkdown(text, { tokenizeMarkdown, phraseSize });
|
|
17
|
+
}, [text, tokenizeMarkdown]);
|
|
18
|
+
const visibleText = useMemo(() => {
|
|
19
|
+
return tokens.slice(0, cursor).join('');
|
|
20
|
+
}, [tokens, cursor]);
|
|
23
21
|
useEffect(() => {
|
|
24
22
|
if (cursorStartIndex) {
|
|
25
23
|
setStartingCursor(cursorStartIndex);
|
|
26
24
|
}
|
|
27
25
|
}, []);
|
|
28
26
|
useEffect(() => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
if (prevText !== undefined && prevText !== text) {
|
|
28
|
+
setIsAnimationDone(false);
|
|
29
|
+
setStartingCursor(text.startsWith(prevText) ? cursor : 0);
|
|
30
|
+
}
|
|
31
|
+
}, [text, cursor, prevText]);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
// If streaming is disabled or all chunks received - return the whole content
|
|
34
|
+
if (!enabled || allContentReceivedRef.current) {
|
|
35
|
+
setCursor(tokens.length);
|
|
32
36
|
setIsAnimationDone(true);
|
|
37
|
+
currentSpeedRef.current = Math.max(currentSpeedRef.current, maxTokens);
|
|
33
38
|
return;
|
|
34
39
|
}
|
|
35
|
-
const tokens = getTokens(text);
|
|
36
40
|
const targetLength = tokens.length;
|
|
37
41
|
const charactersToAnimate = targetLength - startingCursor;
|
|
38
42
|
// If there are no more characters to animate
|
|
@@ -55,56 +59,66 @@ const useAnimatedText = ({ text, allContentReceived = false, enabled = true, tok
|
|
|
55
59
|
pollId = setTimeout(checkForCompletion, 50);
|
|
56
60
|
return () => clearTimeout(pollId);
|
|
57
61
|
}
|
|
58
|
-
let
|
|
59
|
-
let startTime;
|
|
62
|
+
let rafId = null;
|
|
63
|
+
let startTime = null;
|
|
60
64
|
let isStopped = false;
|
|
61
|
-
let currentSpeed = 100; // Start with normal speed
|
|
62
65
|
let lastCursor = startingCursor;
|
|
63
|
-
const processTextAnimation = () => {
|
|
66
|
+
const processTextAnimation = (currentTime) => {
|
|
64
67
|
if (isStopped)
|
|
65
68
|
return;
|
|
66
|
-
|
|
67
|
-
if (
|
|
69
|
+
// Stop animation immediately when all content is received
|
|
70
|
+
if (allContentReceivedRef.current) {
|
|
71
|
+
setCursor(tokens.length);
|
|
72
|
+
setIsAnimationDone(true);
|
|
73
|
+
currentSpeedRef.current = Math.max(currentSpeedRef.current, maxTokens);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
// Initialize start time on first frame
|
|
77
|
+
if (startTime === null) {
|
|
68
78
|
startTime = currentTime;
|
|
69
79
|
}
|
|
70
|
-
// When we have all content with us, speed up streaming animation
|
|
71
|
-
const targetSpeed = allContentReceivedRef.current ? 150 : 100;
|
|
72
80
|
// Smoothly transition to target speed
|
|
73
|
-
const speedDiff =
|
|
74
|
-
|
|
81
|
+
const speedDiff = maxTokens - currentSpeedRef.current;
|
|
82
|
+
currentSpeedRef.current += speedDiff * 0.1; // Smooth transition
|
|
75
83
|
const elapsed = currentTime - startTime;
|
|
76
84
|
const timeStep = elapsed / 1000;
|
|
77
|
-
// Calculate how many
|
|
78
|
-
const expectedCursor = Math.min(startingCursor + timeStep *
|
|
85
|
+
// Calculate how many tokens we should have shown by now
|
|
86
|
+
const expectedCursor = Math.min(startingCursor + timeStep * currentSpeedRef.current, targetLength);
|
|
79
87
|
const newCursor = Math.min(Math.floor(expectedCursor), targetLength);
|
|
88
|
+
const safeCursor = Math.max(newCursor, lastCursor);
|
|
80
89
|
// Skip update if the cursor is at the same token
|
|
81
|
-
if (
|
|
82
|
-
setCursor(
|
|
83
|
-
lastCursor =
|
|
90
|
+
if (safeCursor !== lastCursor) {
|
|
91
|
+
setCursor(safeCursor);
|
|
92
|
+
lastCursor = safeCursor;
|
|
84
93
|
}
|
|
85
94
|
// End condition - stop when we reach the target
|
|
86
|
-
if (
|
|
95
|
+
if (safeCursor >= targetLength && allContentReceivedRef.current) {
|
|
87
96
|
setIsAnimationDone(true);
|
|
88
97
|
return;
|
|
89
98
|
}
|
|
90
99
|
// Continue animation if not done
|
|
91
|
-
if (
|
|
92
|
-
|
|
93
|
-
const interval = allContentReceivedRef.current ? 20 : 50; // Faster when complete
|
|
94
|
-
intervalId = setTimeout(processTextAnimation, interval);
|
|
100
|
+
if (safeCursor < targetLength || !allContentReceivedRef.current) {
|
|
101
|
+
rafId = requestAnimationFrame(processTextAnimation); // Schedule next frame
|
|
95
102
|
}
|
|
96
103
|
};
|
|
97
|
-
// Start the animation
|
|
98
|
-
|
|
104
|
+
// Start the animation
|
|
105
|
+
rafId = requestAnimationFrame(processTextAnimation);
|
|
99
106
|
return () => {
|
|
100
107
|
isStopped = true;
|
|
101
|
-
if (
|
|
102
|
-
|
|
108
|
+
if (rafId) {
|
|
109
|
+
cancelAnimationFrame(rafId);
|
|
103
110
|
}
|
|
104
111
|
};
|
|
105
|
-
}, [startingCursor,
|
|
112
|
+
}, [startingCursor, tokens]);
|
|
113
|
+
if (allContentReceived) {
|
|
114
|
+
return {
|
|
115
|
+
text,
|
|
116
|
+
isAnimationDone: true,
|
|
117
|
+
animatedTillCursor: tokens.length
|
|
118
|
+
};
|
|
119
|
+
}
|
|
106
120
|
return {
|
|
107
|
-
text:
|
|
121
|
+
text: visibleText,
|
|
108
122
|
isAnimationDone,
|
|
109
123
|
animatedTillCursor: cursor
|
|
110
124
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAnimatedText.js","sourceRoot":"","sources":["../../src/hooks/useAnimatedText.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useAnimatedText.js","sourceRoot":"","sources":["../../src/hooks/useAnimatedText.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE7D,OAAO,oBAAoB,MAAM,4BAA4B,CAAC;AAE9D,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,MAAM,eAAe,GAAG,CAAC,EACvB,IAAI,EACJ,kBAAkB,GAAG,KAAK,EAC1B,OAAO,GAAG,IAAI,EACd,gBAAgB,GAAG,KAAK,EACxB,gB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,UAAU,CAAC,CAAC;YAEnD,iDAAiD;YACjD,IAAI,UAAU,KAAK,UAAU,EAAE,CAAC;gBAC9B,SAAS,CAAC,UAAU,CAAC,CAAC;gBACtB,UAAU,GAAG,UAAU,CAAC;YAC1B,CAAC;YAED,gDAAgD;YAChD,IAAI,UAAU,IAAI,YAAY,IAAI,qBAAqB,CAAC,OAAO,EAAE,CAAC;gBAChE,kBAAkB,CAAC,IAAI,CAAC,CAAC;gBACzB,OAAO;YACT,CAAC;YAED,iCAAiC;YACjC,IAAI,UAAU,GAAG,YAAY,IAAI,CAAC,qBAAqB,CAAC,OAAO,EAAE,CAAC;gBAChE,KAAK,GAAG,qBAAqB,CAAC,oBAAoB,CAAC,CAAC,CAAC,sBAAsB;YAC7E,CAAC;QACH,CAAC,CAAC;QAEF,sBAAsB;QACtB,KAAK,GAAG,qBAAqB,CAAC,oBAAoB,CAAC,CAAC;QAEpD,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,IAAI,CAAC;YAEjB,IAAI,KAAK,EAAE,CAAC;gBACV,oBAAoB,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;IAE7B,IAAI,kBAAkB,EAAE,CAAC;QACvB,OAAO;YACL,IAAI;YACJ,eAAe,EAAE,IAAI;YACrB,kBAAkB,EAAE,MAAM,CAAC,MAAM;SAClC,CAAC;IACJ,CAAC;IAED,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,eAAe;QACf,kBAAkB,EAAE,MAAM;KAC3B,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { useEffect, useState, useRef, useMemo } from 'react';\n\nimport tokenizeWithMarkdown from '../utils/markdownTokenizer';\n\nimport usePrevious from './usePrevious';\n\nconst useAnimatedText = ({\n text,\n allContentReceived = false,\n enabled = true,\n tokenizeMarkdown = false,\n cursorStartIndex\n}: {\n text: string;\n allContentReceived: boolean;\n enabled?: boolean;\n tokenizeMarkdown?: boolean;\n cursorStartIndex?: number;\n}) => {\n const initialTokens = 3;\n const maxTokens = 20;\n const phraseSize = 3;\n\n const [cursor, setCursor] = useState(0); // End pointer\n const [startingCursor, setStartingCursor] = useState(0); // animation starting point\n const [isAnimationDone, setIsAnimationDone] = useState(false);\n\n const currentSpeedRef = useRef(initialTokens);\n const allContentReceivedRef = useRef(allContentReceived);\n allContentReceivedRef.current = allContentReceived;\n\n const prevText = usePrevious(text);\n\n const tokens = useMemo(() => {\n return tokenizeWithMarkdown(text, { tokenizeMarkdown, phraseSize });\n }, [text, tokenizeMarkdown]);\n\n const visibleText = useMemo(() => {\n return tokens.slice(0, cursor).join('');\n }, [tokens, cursor]);\n\n useEffect(() => {\n if (cursorStartIndex) {\n setStartingCursor(cursorStartIndex);\n }\n }, []);\n\n useEffect(() => {\n if (prevText !== undefined && prevText !== text) {\n setIsAnimationDone(false);\n setStartingCursor(text.startsWith(prevText) ? cursor : 0);\n }\n }, [text, cursor, prevText]);\n\n useEffect(() => {\n // If streaming is disabled or all chunks received - return the whole content\n if (!enabled || allContentReceivedRef.current) {\n setCursor(tokens.length);\n setIsAnimationDone(true);\n currentSpeedRef.current = Math.max(currentSpeedRef.current, maxTokens);\n\n return;\n }\n\n const targetLength = tokens.length;\n const charactersToAnimate = targetLength - startingCursor;\n\n // If there are no more characters to animate\n if (charactersToAnimate <= 0) {\n setCursor(targetLength);\n // Only set animation done if we have all content AND no more characters to animate\n if (allContentReceivedRef.current) {\n setIsAnimationDone(true);\n return;\n }\n let pollId: ReturnType<typeof setTimeout>;\n const checkForCompletion = () => {\n if (allContentReceivedRef.current) {\n setIsAnimationDone(true);\n } else {\n pollId = setTimeout(checkForCompletion, 50);\n }\n };\n pollId = setTimeout(checkForCompletion, 50);\n return () => clearTimeout(pollId);\n }\n\n let rafId: number | null = null;\n let startTime: number | null = null;\n let isStopped = false;\n let lastCursor = startingCursor;\n\n const processTextAnimation = (currentTime: number) => {\n if (isStopped) return;\n\n // Stop animation immediately when all content is received\n if (allContentReceivedRef.current) {\n setCursor(tokens.length);\n setIsAnimationDone(true);\n currentSpeedRef.current = Math.max(currentSpeedRef.current, maxTokens);\n return;\n }\n\n // Initialize start time on first frame\n if (startTime === null) {\n startTime = currentTime;\n }\n\n // Smoothly transition to target speed\n const speedDiff = maxTokens - currentSpeedRef.current;\n currentSpeedRef.current += speedDiff * 0.1; // Smooth transition\n\n const elapsed = currentTime - startTime;\n const timeStep = elapsed / 1000;\n\n // Calculate how many tokens we should have shown by now\n const expectedCursor = Math.min(\n startingCursor + timeStep * currentSpeedRef.current,\n targetLength\n );\n const newCursor = Math.min(Math.floor(expectedCursor), targetLength);\n const safeCursor = Math.max(newCursor, lastCursor);\n\n // Skip update if the cursor is at the same token\n if (safeCursor !== lastCursor) {\n setCursor(safeCursor);\n lastCursor = safeCursor;\n }\n\n // End condition - stop when we reach the target\n if (safeCursor >= targetLength && allContentReceivedRef.current) {\n setIsAnimationDone(true);\n return;\n }\n\n // Continue animation if not done\n if (safeCursor < targetLength || !allContentReceivedRef.current) {\n rafId = requestAnimationFrame(processTextAnimation); // Schedule next frame\n }\n };\n\n // Start the animation\n rafId = requestAnimationFrame(processTextAnimation);\n\n return () => {\n isStopped = true;\n\n if (rafId) {\n cancelAnimationFrame(rafId);\n }\n };\n }, [startingCursor, tokens]);\n\n if (allContentReceived) {\n return {\n text,\n isAnimationDone: true,\n animatedTillCursor: tokens.length\n };\n }\n\n return {\n text: visibleText,\n isAnimationDone,\n animatedTillCursor: cursor\n };\n};\n\nexport default useAnimatedText;\n"]}
|
package/lib/hooks/useI18n.d.ts
CHANGED
|
@@ -62,6 +62,7 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
62
62
|
duration: string;
|
|
63
63
|
tokens: string;
|
|
64
64
|
keyboard_instructions: string;
|
|
65
|
+
today: string;
|
|
65
66
|
remove: string;
|
|
66
67
|
follow: string;
|
|
67
68
|
unfollow: string;
|
|
@@ -1477,6 +1478,29 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
1477
1478
|
hide_icons_additional_info_first_sentence: string;
|
|
1478
1479
|
hide_icons_additional_info_second_sentence: string;
|
|
1479
1480
|
wcag: string;
|
|
1481
|
+
this_year: string;
|
|
1482
|
+
this_quarter: string;
|
|
1483
|
+
this_month: string;
|
|
1484
|
+
this_week: string;
|
|
1485
|
+
this_day: string;
|
|
1486
|
+
this_hour: string;
|
|
1487
|
+
this_minute: string;
|
|
1488
|
+
this_second: string;
|
|
1489
|
+
over_time_period: string;
|
|
1490
|
+
since_time_period: string;
|
|
1491
|
+
in_current_time_period: string;
|
|
1492
|
+
increased_by_value_over_time_period: string;
|
|
1493
|
+
increased_by_value_since_time_period: string;
|
|
1494
|
+
increased_by_value_in_current_time_period: string;
|
|
1495
|
+
increased_by_value_today: string;
|
|
1496
|
+
decreased_by_value_over_time_period: string;
|
|
1497
|
+
decreased_by_value_since_time_period: string;
|
|
1498
|
+
decreased_by_value_in_current_time_period: string;
|
|
1499
|
+
decreased_by_value_today: string;
|
|
1500
|
+
no_change_over_time_period: string;
|
|
1501
|
+
no_change_since_time_period: string;
|
|
1502
|
+
no_change_in_current_time_period: string;
|
|
1503
|
+
no_change_today: string;
|
|
1480
1504
|
add_to: string;
|
|
1481
1505
|
namespace: string;
|
|
1482
1506
|
decision_rule: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useI18n.d.ts","sourceRoot":"","sources":["../../src/hooks/useI18n.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,QAAA,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"useI18n.d.ts","sourceRoot":"","sources":["../../src/hooks/useI18n.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAGZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
package/lib/i18n/default.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ declare const _default: {
|
|
|
58
58
|
duration: string;
|
|
59
59
|
tokens: string;
|
|
60
60
|
keyboard_instructions: string;
|
|
61
|
+
today: string;
|
|
61
62
|
remove: string;
|
|
62
63
|
follow: string;
|
|
63
64
|
unfollow: string;
|
|
@@ -1474,6 +1475,29 @@ declare const _default: {
|
|
|
1474
1475
|
hide_icons_additional_info_first_sentence: string;
|
|
1475
1476
|
hide_icons_additional_info_second_sentence: string;
|
|
1476
1477
|
wcag: string;
|
|
1478
|
+
this_year: string;
|
|
1479
|
+
this_quarter: string;
|
|
1480
|
+
this_month: string;
|
|
1481
|
+
this_week: string;
|
|
1482
|
+
this_day: string;
|
|
1483
|
+
this_hour: string;
|
|
1484
|
+
this_minute: string;
|
|
1485
|
+
this_second: string;
|
|
1486
|
+
over_time_period: string;
|
|
1487
|
+
since_time_period: string;
|
|
1488
|
+
in_current_time_period: string;
|
|
1489
|
+
increased_by_value_over_time_period: string;
|
|
1490
|
+
increased_by_value_since_time_period: string;
|
|
1491
|
+
increased_by_value_in_current_time_period: string;
|
|
1492
|
+
increased_by_value_today: string;
|
|
1493
|
+
decreased_by_value_over_time_period: string;
|
|
1494
|
+
decreased_by_value_since_time_period: string;
|
|
1495
|
+
decreased_by_value_in_current_time_period: string;
|
|
1496
|
+
decreased_by_value_today: string;
|
|
1497
|
+
no_change_over_time_period: string;
|
|
1498
|
+
no_change_since_time_period: string;
|
|
1499
|
+
no_change_in_current_time_period: string;
|
|
1500
|
+
no_change_today: string;
|
|
1477
1501
|
add_to: string;
|
|
1478
1502
|
namespace: string;
|
|
1479
1503
|
decision_rule: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../src/i18n/default.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../src/i18n/default.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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7vD3C,wBAyxDE"}
|
package/lib/i18n/default.js
CHANGED
|
@@ -62,6 +62,7 @@ export default {
|
|
|
62
62
|
duration: 'Duration',
|
|
63
63
|
tokens: 'Tokens',
|
|
64
64
|
keyboard_instructions: 'Keyboard instructions',
|
|
65
|
+
today: 'Today',
|
|
65
66
|
/* Verbs */
|
|
66
67
|
remove: 'Remove',
|
|
67
68
|
follow: 'Follow',
|
|
@@ -1589,6 +1590,33 @@ export default {
|
|
|
1589
1590
|
hide_icons_additional_info_first_sentence: 'To ensure accessibility standards are met, color cannot be the only way of distinguishing information.',
|
|
1590
1591
|
hide_icons_additional_info_second_sentence: 'Visit {0} to learn more about the related accessibility guidelines.',
|
|
1591
1592
|
wcag: 'WCAG',
|
|
1593
|
+
/* business-intelligence: Trend indicators - current time period */
|
|
1594
|
+
this_year: 'This year',
|
|
1595
|
+
this_quarter: 'This quarter',
|
|
1596
|
+
this_month: 'This month',
|
|
1597
|
+
this_week: 'This week',
|
|
1598
|
+
this_day: 'This day',
|
|
1599
|
+
this_hour: 'This hour',
|
|
1600
|
+
this_minute: 'This minute',
|
|
1601
|
+
this_second: 'This second',
|
|
1602
|
+
over_time_period: 'over {0}',
|
|
1603
|
+
since_time_period: 'since {0}',
|
|
1604
|
+
in_current_time_period: 'in {0}',
|
|
1605
|
+
/* business-intelligence: Trend indicators - Increase cases */
|
|
1606
|
+
increased_by_value_over_time_period: 'Increased by {0} over {1}',
|
|
1607
|
+
increased_by_value_since_time_period: 'Increased by {0} since {1}',
|
|
1608
|
+
increased_by_value_in_current_time_period: 'Increased by {0} in {1}',
|
|
1609
|
+
increased_by_value_today: 'Increased by {0} today',
|
|
1610
|
+
/* business-intelligence: Trend indicators - Decrease cases */
|
|
1611
|
+
decreased_by_value_over_time_period: 'Decreased by {0} over {1}',
|
|
1612
|
+
decreased_by_value_since_time_period: 'Decreased by {0} since {1}',
|
|
1613
|
+
decreased_by_value_in_current_time_period: 'Decreased by {0} in {1}',
|
|
1614
|
+
decreased_by_value_today: 'Decreased by {0} today',
|
|
1615
|
+
/* business-intelligence: Trend indicators - No change cases */
|
|
1616
|
+
no_change_over_time_period: 'No change over {0}',
|
|
1617
|
+
no_change_since_time_period: 'No change since {0}',
|
|
1618
|
+
no_change_in_current_time_period: 'No change in {0}',
|
|
1619
|
+
no_change_today: 'No change today',
|
|
1592
1620
|
/* authoring-ui-views: AddButton */
|
|
1593
1621
|
add_to: 'Add to {0}',
|
|
1594
1622
|
/* authoring-ui-views: ViewPicker */
|