@semcore/d3-chart 3.0.0-beta.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/lib/cjs/Area.js +9 -9
  3. package/lib/cjs/Axis.js +14 -14
  4. package/lib/cjs/Bar.js +8 -8
  5. package/lib/cjs/Bubble.js +33 -25
  6. package/lib/cjs/Bubble.js.map +1 -1
  7. package/lib/cjs/Donut.js +105 -89
  8. package/lib/cjs/Donut.js.map +1 -1
  9. package/lib/cjs/Dots.js +9 -9
  10. package/lib/cjs/HorizontalBar.js +8 -8
  11. package/lib/cjs/Hover.js +9 -7
  12. package/lib/cjs/Hover.js.map +1 -1
  13. package/lib/cjs/Line.js +8 -8
  14. package/lib/cjs/Plot.js +3 -3
  15. package/lib/cjs/Radar.js +22 -21
  16. package/lib/cjs/Radar.js.map +1 -1
  17. package/lib/cjs/RadialTree.js +75 -74
  18. package/lib/cjs/RadialTree.js.map +1 -1
  19. package/lib/cjs/ReferenceLine.js +9 -9
  20. package/lib/cjs/ResponsiveContainer.js +1 -2
  21. package/lib/cjs/ResponsiveContainer.js.map +1 -1
  22. package/lib/cjs/ScatterPlot.js +29 -21
  23. package/lib/cjs/ScatterPlot.js.map +1 -1
  24. package/lib/cjs/Tooltip.js +24 -13
  25. package/lib/cjs/Tooltip.js.map +1 -1
  26. package/lib/cjs/Venn.js +56 -35
  27. package/lib/cjs/Venn.js.map +1 -1
  28. package/lib/cjs/a11y/PlotA11yModule.js +2 -2
  29. package/lib/cjs/a11y/PlotA11yModule.js.map +1 -1
  30. package/lib/cjs/a11y/PlotA11yView.js +3 -3
  31. package/lib/cjs/a11y/hints.js.map +1 -1
  32. package/lib/cjs/a11y/serialize.js.map +1 -1
  33. package/lib/cjs/createElement.d.js +2 -0
  34. package/lib/cjs/createElement.d.js.map +1 -0
  35. package/lib/cjs/types/Bubble.d.js.map +1 -1
  36. package/lib/cjs/types/Hover.d.js.map +1 -1
  37. package/lib/cjs/types/Plot.d.js.map +1 -1
  38. package/lib/cjs/types/Tooltip.d.js.map +1 -1
  39. package/lib/cjs/types/index.d.js.map +1 -1
  40. package/lib/cjs/utils.js.map +1 -1
  41. package/lib/es6/Area.js +9 -9
  42. package/lib/es6/Axis.js +14 -14
  43. package/lib/es6/Bar.js +8 -8
  44. package/lib/es6/Bubble.js +35 -26
  45. package/lib/es6/Bubble.js.map +1 -1
  46. package/lib/es6/Donut.js +107 -90
  47. package/lib/es6/Donut.js.map +1 -1
  48. package/lib/es6/Dots.js +9 -9
  49. package/lib/es6/HorizontalBar.js +8 -8
  50. package/lib/es6/Hover.js +9 -7
  51. package/lib/es6/Hover.js.map +1 -1
  52. package/lib/es6/Line.js +8 -8
  53. package/lib/es6/Plot.js +3 -3
  54. package/lib/es6/Radar.js +22 -21
  55. package/lib/es6/Radar.js.map +1 -1
  56. package/lib/es6/RadialTree.js +73 -72
  57. package/lib/es6/RadialTree.js.map +1 -1
  58. package/lib/es6/ReferenceLine.js +9 -9
  59. package/lib/es6/ResponsiveContainer.js +0 -1
  60. package/lib/es6/ResponsiveContainer.js.map +1 -1
  61. package/lib/es6/ScatterPlot.js +31 -22
  62. package/lib/es6/ScatterPlot.js.map +1 -1
  63. package/lib/es6/Tooltip.js +24 -13
  64. package/lib/es6/Tooltip.js.map +1 -1
  65. package/lib/es6/Venn.js +58 -36
  66. package/lib/es6/Venn.js.map +1 -1
  67. package/lib/es6/a11y/PlotA11yModule.js +2 -2
  68. package/lib/es6/a11y/PlotA11yModule.js.map +1 -1
  69. package/lib/es6/a11y/PlotA11yView.js +3 -3
  70. package/lib/es6/a11y/hints.js.map +1 -1
  71. package/lib/es6/a11y/serialize.js.map +1 -1
  72. package/lib/es6/createElement.d.js +2 -0
  73. package/lib/es6/createElement.d.js.map +1 -0
  74. package/lib/es6/types/Bubble.d.js.map +1 -1
  75. package/lib/es6/types/Hover.d.js.map +1 -1
  76. package/lib/es6/types/Plot.d.js.map +1 -1
  77. package/lib/es6/types/Tooltip.d.js.map +1 -1
  78. package/lib/es6/types/index.d.js +3 -0
  79. package/lib/es6/types/index.d.js.map +1 -1
  80. package/lib/es6/utils.js.map +1 -1
  81. package/lib/types/Bubble.d.ts +1 -5
  82. package/lib/types/Hover.d.ts +1 -1
  83. package/lib/types/Plot.d.ts +3 -5
  84. package/lib/types/RadialTree.d.ts +14 -14
  85. package/lib/types/Tooltip.d.ts +2 -2
  86. package/lib/types/a11y/PlotA11yModule.d.ts +1 -1
  87. package/lib/types/a11y/focus.d.ts +1 -1
  88. package/lib/types/a11y/hints.d.ts +5 -5
  89. package/lib/types/a11y/insights.d.ts +8 -8
  90. package/lib/types/a11y/intl.d.ts +1 -1
  91. package/lib/types/a11y/locale.d.ts +1 -1
  92. package/lib/types/a11y/serialize.d.ts +4 -4
  93. package/lib/types/a11y/summarize.d.ts +1 -1
  94. package/lib/types/createElement.d.ts +2 -0
  95. package/lib/types/index.d.ts +2 -0
  96. package/lib/types/utils.d.ts +7 -6
  97. package/package.json +10 -10
@@ -1 +1 @@
1
- {"version":3,"file":"PlotA11yModule.js","names":["React","normalizeLocale","localizedMessages","Root","sstyled","styles","_sstyled","insert","Context","I18nContext","useI18n","Box","globalWasFocused","globalNavWithKeyboard","PlotA11yModule","props","_ref","arguments[0]","_ref5","SPlotA11yModule","_React$useState","useState","_React$useState2","_slicedToArray","wasFocused","setWasFocused","_React$useState3","_React$useState4","navWithKeyboard","setNavWithKeyboard","_React$useState5","_React$useState6","plotA11yView","setPlotA11yView","hadnleHiddenElementsFocus","useCallback","_React$useState7","_React$useState8","loading","setLoading","_React$useState9","_React$useState10","error","setError","contextLocale","useContext","locale","useMemo","_props$locale","t","useEffect","_props$plotRef$curren","focusListener","plotRef","current","addEventListener","_props$plotRef$curren2","removeEventListener","_document$body","keyboardListener","event","navigationKeys","includes","key","document","body","_document$body2","shouldDisplayView","then","_ref6","PlotA11yView","Component","console","_ref2","createElement","_extends","_ref3","cn","_objectSpread","_assignProps","_ref4","_assignProps2","_assignProps3"],"sources":["../../../src/a11y/PlotA11yModule.tsx"],"sourcesContent":["import React from 'react';\nimport { DataStructureHints, PartialDataSummarizationConfig } from './hints';\nimport { normalizeLocale } from './locale';\nimport { localizedMessages } from './translations/module/__intergalactic-dynamic-locales';\nimport { Root, sstyled } from '@semcore/core';\nimport styles from '../style/plotA11yModule.shadow.css';\nimport { Context as I18nContext, useI18n } from '@semcore/utils/lib/enhances/WithI18n';\nimport { Box } from '@semcore/flex-box';\n\nlet globalWasFocused = false;\nlet globalNavWithKeyboard = false;\n\nexport type A11yViewProps = {\n id: string;\n data: Record<string, unknown>[];\n hints: DataStructureHints;\n plotLabel: string;\n locale: NavigatorLanguage['language'];\n config: PartialDataSummarizationConfig;\n\n plotRef: React.RefObject<Element>;\n};\n\nexport const PlotA11yModule: React.FC<A11yViewProps> = (props) => {\n const SPlotA11yModule = Root;\n const [wasFocused, setWasFocused] = React.useState(globalWasFocused);\n const [navWithKeyboard, setNavWithKeyboard] = React.useState(globalNavWithKeyboard);\n const [plotA11yView, setPlotA11yView] = React.useState<{\n Component: React.FC<A11yViewProps>;\n } | null>(null);\n\n const hadnleHiddenElementsFocus = React.useCallback(() => {\n setWasFocused(true);\n setNavWithKeyboard(true);\n }, []);\n\n const [loading, setLoading] = React.useState(false);\n const [error, setError] = React.useState<Error | null>(null);\n\n const contextLocale = React.useContext(I18nContext);\n const locale = React.useMemo(\n () => normalizeLocale(props.locale ?? contextLocale, localizedMessages),\n [props.locale],\n );\n const t = useI18n(localizedMessages, locale);\n\n React.useEffect(() => {\n if (wasFocused) return;\n const focusListener = () => {\n globalWasFocused = true;\n setWasFocused(true);\n };\n\n props.plotRef.current?.addEventListener('focus', focusListener);\n return () => props.plotRef.current?.removeEventListener('focus', focusListener);\n }, [wasFocused, props.plotRef]);\n React.useEffect(() => {\n if (navWithKeyboard) return;\n const keyboardListener = (event: Event) => {\n const navigationKeys = [\n 'Tab',\n 'ArrowUp',\n 'ArrowLeft',\n 'ArrowDown',\n 'ArrowRight',\n 'ArrowUp',\n 'ArrowLeft',\n ];\n if ('key' in event && navigationKeys.includes((event as KeyboardEvent).key)) {\n setNavWithKeyboard(true);\n globalNavWithKeyboard = true;\n }\n };\n document.body?.addEventListener('keydown', keyboardListener);\n return () => document.body?.removeEventListener('keydown', keyboardListener);\n }, [navWithKeyboard]);\n\n const shouldDisplayView = wasFocused && navWithKeyboard;\n\n React.useEffect(() => {\n if (!shouldDisplayView) return;\n if (plotA11yView) return;\n if (loading) return;\n\n setLoading(true);\n\n import('./PlotA11yView')\n .then(({ PlotA11yView }) => {\n setPlotA11yView({ Component: PlotA11yView });\n setLoading(false);\n setError(null);\n })\n .catch((error) => {\n console.error(error);\n setError(error);\n });\n }, [plotA11yView, shouldDisplayView, loading, setLoading]);\n\n if (plotA11yView) {\n return sstyled(styles)(\n <plotA11yView.Component {...props} locale={locale!} />,\n ) as React.ReactElement;\n }\n\n if (error) {\n return sstyled(styles)(\n <SPlotA11yModule render={Box} tabIndex={0} aria-live='assertive'>\n {t('failed')}\n </SPlotA11yModule>,\n ) as React.ReactElement;\n }\n if (loading) {\n return sstyled(styles)(\n <SPlotA11yModule render={Box} tabIndex={0} aria-live='polite'>\n {t('loading')}\n </SPlotA11yModule>,\n ) as React.ReactElement;\n }\n\n return sstyled(styles)(\n <SPlotA11yModule render={Box} tabIndex={0} onFocus={hadnleHiddenElementsFocus}>\n {t('disabled')}\n </SPlotA11yModule>,\n ) as React.ReactElement;\n};\n"],"mappings":";;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,eAAe,QAAQ,UAAU;AAC1C,SAASC,iBAAiB,QAAQ,uDAAuD;AACzF,SAASC,IAAI,EAAEC,OAAO,QAAQ,eAAe;AAAC;AAAA,IAAAC,MAAA,+BAAAC,QAAA,CAAAC,MAAA;EAAA;AAAA;AAE9C,SAASC,OAAO,IAAIC,WAAW,EAAEC,OAAO,QAAQ,sC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,CAAC,CAAC;EAE1D,IAAIP,YAAY,EAAE;IAAA,IAAAyC,KAAA;IAChB,OAAAA,KAAA,GAAOrE,OAAO,CAACC,MAAM,CAAC,eACpBL,KAAA,CAAA0E,aAAA,CAAC1C,YAAY,CAACuC,SAAS,EAAAI,QAAA,KAAK5D,KAAK;MAAE+B,MAAM,EAAEA;IAAQ,GAAG;EAE1D;EAEA,IAAIJ,KAAK,EAAE;IAAA,IAAAkC,KAAA;IACT,OAAAA,KAAA,GAAOxE,OAAO,CAACC,MAAM,CAAC,eACpBL,KAAA,CAAA0E,aAAA,CAACvD,eAAe,EAAAyD,KAAA,CAAAC,EAAA,oBAAAC,aAAA,KAAAC,YAAA;MAAA,YAAwB,CAAC;MAAA,aAAY;IAAW,GAAA/D,IAAA,KAC7DiC,CAAC,CAAC,QAAQ,CAAC,CACI;EAEtB;EACA,IAAIX,OAAO,EAAE;IAAA,IAAA0C,KAAA;IACX,OAAAA,KAAA,GAAO5E,OAAO,CAACC,MAAM,CAAC,eACpBL,KAAA,CAAA0E,aAAA,CAACvD,eAAe,EAAA6D,KAAA,CAAAH,EAAA,oBAAAC,aAAA,KAAAG,aAAA;MAAA,YAAwB,CAAC;MAAA,aAAY;IAAQ,GAAAjE,IAAA,KAC1DiC,CAAC,CAAC,SAAS,CAAC,CACG;EAEtB;EAEA,OAAA/B,KAAA,GAAOd,OAAO,CAACC,MAAM,CAAC,eACpBL,KAAA,CAAA0E,aAAA,CAACvD,eAAe,EAAAD,KAAA,CAAA2D,EAAA,oBAAAC,aAAA,KAAAI,aAAA;IAAA,YAAwB,CAAC;IAAA,WAAWhD;EAAyB,GAAAlB,IAAA,KAC1EiC,CAAC,CAAC,UAAU,CAAC,CACE;AAEtB,CAAC"}
1
+ {"version":3,"file":"PlotA11yModule.js","names":["React","normalizeLocale","localizedMessages","Root","sstyled","styles","_sstyled","insert","Context","I18nContext","useI18n","Box","globalWasFocused","globalNavWithKeyboard","PlotA11yModule","props","_ref","arguments[0]","_ref5","SPlotA11yModule","_React$useState","useState","_React$useState2","_slicedToArray","wasFocused","setWasFocused","_React$useState3","_React$useState4","navWithKeyboard","setNavWithKeyboard","_React$useState5","_React$useState6","plotA11yView","setPlotA11yView","hadnleHiddenElementsFocus","useCallback","_React$useState7","_React$useState8","loading","setLoading","_React$useState9","_React$useState10","error","setError","contextLocale","useContext","locale","useMemo","_props$locale","t","useEffect","_props$plotRef$curren","focusListener","plotRef","current","addEventListener","_props$plotRef$curren2","removeEventListener","_document$body","keyboardListener","event","navigationKeys","includes","key","document","body","_document$body2","shouldDisplayView","then","_ref6","PlotA11yView","Component","console","_ref2","createElement","_extends","_ref3","cn","_objectSpread","_assignProps","_ref4","_assignProps2","_assignProps3"],"sources":["../../../src/a11y/PlotA11yModule.tsx"],"sourcesContent":["import React from 'react';\nimport { DataStructureHints, PartialDataSummarizationConfig } from './hints';\nimport { normalizeLocale } from './locale';\nimport { localizedMessages } from './translations/module/__intergalactic-dynamic-locales';\nimport { Root, sstyled } from '@semcore/core';\nimport styles from '../style/plotA11yModule.shadow.css';\nimport { Context as I18nContext, useI18n } from '@semcore/utils/lib/enhances/WithI18n';\nimport { Box } from '@semcore/flex-box';\n\nlet globalWasFocused = false;\nlet globalNavWithKeyboard = false;\n\nexport type A11yViewProps = {\n id: string;\n data: Record<string, unknown>[];\n hints: DataStructureHints;\n plotLabel: string;\n locale: NavigatorLanguage['language'];\n config: PartialDataSummarizationConfig;\n\n plotRef: React.RefObject<Element>;\n};\n\nexport const PlotA11yModule: React.FC<A11yViewProps> = (props) => {\n const SPlotA11yModule = Root;\n const [wasFocused, setWasFocused] = React.useState(globalWasFocused);\n const [navWithKeyboard, setNavWithKeyboard] = React.useState(globalNavWithKeyboard);\n const [plotA11yView, setPlotA11yView] = React.useState<{\n Component: React.FC<A11yViewProps>;\n } | null>(null);\n\n const hadnleHiddenElementsFocus = React.useCallback(() => {\n setWasFocused(true);\n setNavWithKeyboard(true);\n }, []);\n\n const [loading, setLoading] = React.useState(false);\n const [error, setError] = React.useState<Error | null>(null);\n\n const contextLocale = React.useContext(I18nContext);\n const locale = React.useMemo(\n () => normalizeLocale(props.locale ?? contextLocale, localizedMessages),\n [props.locale],\n );\n const t = useI18n(localizedMessages, locale!);\n\n React.useEffect(() => {\n if (wasFocused) return;\n const focusListener = () => {\n globalWasFocused = true;\n setWasFocused(true);\n };\n\n props.plotRef.current?.addEventListener('focus', focusListener);\n return () => props.plotRef.current?.removeEventListener('focus', focusListener);\n }, [wasFocused, props.plotRef]);\n React.useEffect(() => {\n if (navWithKeyboard) return;\n const keyboardListener = (event: Event) => {\n const navigationKeys = [\n 'Tab',\n 'ArrowUp',\n 'ArrowLeft',\n 'ArrowDown',\n 'ArrowRight',\n 'ArrowUp',\n 'ArrowLeft',\n ];\n if ('key' in event && navigationKeys.includes((event as KeyboardEvent).key)) {\n setNavWithKeyboard(true);\n globalNavWithKeyboard = true;\n }\n };\n document.body?.addEventListener('keydown', keyboardListener);\n return () => document.body?.removeEventListener('keydown', keyboardListener);\n }, [navWithKeyboard]);\n\n const shouldDisplayView = wasFocused && navWithKeyboard;\n\n React.useEffect(() => {\n if (!shouldDisplayView) return;\n if (plotA11yView) return;\n if (loading) return;\n\n setLoading(true);\n\n import('./PlotA11yView')\n .then(({ PlotA11yView }) => {\n setPlotA11yView({ Component: PlotA11yView });\n setLoading(false);\n setError(null);\n })\n .catch((error) => {\n console.error(error);\n setError(error);\n });\n }, [plotA11yView, shouldDisplayView, loading, setLoading]);\n\n if (plotA11yView) {\n return sstyled(styles)(\n <plotA11yView.Component {...props} locale={locale!} />,\n ) as React.ReactElement;\n }\n\n if (error) {\n return sstyled(styles)(\n <SPlotA11yModule render={Box} tabIndex={0} aria-live='assertive'>\n {t('failed')}\n </SPlotA11yModule>,\n ) as React.ReactElement;\n }\n if (loading) {\n return sstyled(styles)(\n <SPlotA11yModule render={Box} tabIndex={0} aria-live='polite'>\n {t('loading')}\n </SPlotA11yModule>,\n ) as React.ReactElement;\n }\n\n return sst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AAA,GAAOd,OAAO,CAACC,MAAM,CAAC,eACpBL,KAAA,CAAA0E,aAAA,CAACvD,eAAe,EAAAD,KAAA,CAAA2D,EAAA,oBAAAC,aAAA,KAAAI,aAAA;IAAA,YAAwB,CAAC;IAAA,WAAWhD;EAAyB,GAAAlB,IAAA,KAC1EiC,CAAC,CAAC,UAAU,CAAC,CACE;AAEtB,CAAC"}
@@ -12,9 +12,9 @@ import { getIntl } from './intl';
12
12
  import { summarize } from './summarize';
13
13
  import { Root, sstyled } from '@semcore/core';
14
14
  /*__reshadow-styles__:"../style/plotA11yView.shadow.css"*/
15
- var styles = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SPlotA11yView_1txhx_gg_{-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none;opacity:0;background-color:var(--intergalactic-bg-primary-neutral, #ffffff);color:var(--intergalactic-text-primary, #191b23);border:3px solid var(--intergalactic-border-primary, #c4c7cf);font-size:var(--intergalactic-fs-50, 10px);padding:2px;width:200px;height:200px;max-width:80%;max-height:80%;overflow:auto}.___SPlotA11yView_1txhx_gg_.__focus-within_1txhx_gg_,.___SPlotA11yView_1txhx_gg_:focus{-webkit-user-select:all;-moz-user-select:all;user-select:all;pointer-events:all;opacity:1;z-index:var(--intergalactic-z-index-overlay, 500);position:relative;display:block}.___SPlotA11yView_1txhx_gg_:focus,.___SPlotA11yView_1txhx_gg_:focus-within{-webkit-user-select:all;-moz-user-select:all;user-select:all;pointer-events:all;opacity:1;z-index:var(--intergalactic-z-index-overlay, 500);position:relative;display:block}.___SPlotA11yView_1txhx_gg_ a{cursor:pointer;text-decoration:underline;margin-bottom:var(--intergalactic-spacing-2x, 8px);display:block}.___SPlotA11yView_1txhx_gg_ table,.___SPlotA11yView_1txhx_gg_ td,.___SPlotA11yView_1txhx_gg_ th{border:1px solid var(--intergalactic-border-primary, #c4c7cf)}" /*__inner_css_end__*/, "1txhx_gg_") /*__reshadow_css_end__*/, {
16
- "__SPlotA11yView": "___SPlotA11yView_1txhx_gg_",
17
- "_focus-within": "__focus-within_1txhx_gg_"
15
+ var styles = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SPlotA11yView_r2v00_gg_{-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none;opacity:0;background-color:var(--intergalactic-bg-primary-neutral, #ffffff);color:var(--intergalactic-text-primary, #191b23);border:3px solid var(--intergalactic-border-primary, #c4c7cf);font-size:var(--intergalactic-fs-50, 10px);padding:2px;width:200px;height:200px;max-width:80%;max-height:80%;overflow:auto}.___SPlotA11yView_r2v00_gg_.__focus-within_r2v00_gg_,.___SPlotA11yView_r2v00_gg_:focus{-webkit-user-select:all;-moz-user-select:all;user-select:all;pointer-events:all;opacity:1;z-index:var(--intergalactic-z-index-overlay, 500);position:relative;display:block}.___SPlotA11yView_r2v00_gg_:focus,.___SPlotA11yView_r2v00_gg_:focus-within{-webkit-user-select:all;-moz-user-select:all;user-select:all;pointer-events:all;opacity:1;z-index:var(--intergalactic-z-index-overlay, 500);position:relative;display:block}.___SPlotA11yView_r2v00_gg_ a{cursor:pointer;text-decoration:underline;margin-bottom:var(--intergalactic-spacing-2x, 8px);display:block}.___SPlotA11yView_r2v00_gg_ table,.___SPlotA11yView_r2v00_gg_ td,.___SPlotA11yView_r2v00_gg_ th{border:1px solid var(--intergalactic-border-primary, #c4c7cf)}" /*__inner_css_end__*/, "r2v00_gg_") /*__reshadow_css_end__*/, {
16
+ "__SPlotA11yView": "___SPlotA11yView_r2v00_gg_",
17
+ "_focus-within": "__focus-within_r2v00_gg_"
18
18
  });
19
19
  import { Box } from '@semcore/flex-box';
20
20
  import { useAsyncI18nMessages } from '@semcore/utils/lib/enhances/i18nEnhance';
@@ -1 +1 @@
1
- {"version":3,"file":"hints.js","names":["reactToText","makeDataHintsContainer","fields","verticalAxes","Set","horizontalAxes","valueAxes","values","groups","axesTitle","vertical","horizontal","titles","getVerticalAxesTitle","getHorizontalAxesTitle","valuesAxes","getValueAxesTitle","grid","dataType","pointsDensity","makeDataHintsHandlers","mutableContainer","handler","specifyDataRowFields","x","y","value","add","setupGrid","direction","size","establishDataType","describeValueEntity","dataKey","readableName","labelKey","describeGroupedValues","groupKey","axes","label","addKeyLabelGetter","getter","setTitle","describedDataAxes","title","_typeof","Date","String","setPointsDensity","makeDataSummarizationConfig","config","_config$trendTangens","_config$movingAverage","_config$additionalFie","_objectSpread","clustersGridSize","undefined","maxListSymbols","datesWithTime","clustersLimit","valuesLimit","groupsLimit","disable","override","trendTangens","weak","medium","strong","Infinity","movingAverage","longSize","shortSize","notableDiff","additionalFields","_toConsumableArray"],"sources":["../../../src/a11y/hints.ts"],"sourcesContent":["import { SerializableDataType } from './insights';\nimport reactToText from '@semcore/utils/lib/reactToText';\n\ntype DeepPartial<T> = T extends object\n ? {\n [P in keyof T]?: DeepPartial<T[P]>;\n }\n : T;\n\nexport type DataStructureHints = {\n fields: {\n verticalAxes: Set<string | number>;\n horizontalAxes: Set<string | number>;\n valueAxes: Set<string | number>;\n values: Set<string | number>;\n };\n groups: Set<string | number>;\n axesTitle: {\n vertical: string | null;\n horizontal: string | null;\n };\n titles: {\n verticalAxes: {\n [dataKey: string | number]: string;\n };\n getVerticalAxesTitle: null | ((dataKey: string | number) => string);\n horizontalAxes: {\n [dataKey: string | number]: string;\n };\n getHorizontalAxesTitle: null | ((dataKey: string | number) => string);\n valuesAxes: {\n [dataKey: string | number]: string;\n };\n getValueAxesTitle: null | ((dataKey: string | number) => string);\n };\n grid: {\n verticalAxes: number | null;\n horizontalAxes: number | null;\n };\n pointsDensity: {\n verticalAxes: number;\n horizontalAxes: number;\n } | null;\n dataType: SerializableDataType | null;\n};\nexport type DataSummarizationConfig = {\n trendTangens: {\n static: number;\n weak: number;\n medium: number;\n strong: number;\n };\n movingAverage: {\n longSize: number | undefined;\n shortSize: number | undefined;\n notableDiff: number | undefined;\n };\n dataType: SerializableDataType | undefined;\n clustersGridSize: number | undefined;\n maxListSymbols: number;\n datesWithTime: boolean | undefined;\n clustersLimit: number;\n valuesLimit: number;\n groupsLimit: number;\n disable: boolean;\n override: string | undefined;\n additionalFields: string[];\n};\nexport type PartialDataSummarizationConfig = DeepPartial<DataSummarizationConfig>;\n\nexport const makeDataHintsContainer = (): DataStructureHints => ({\n fields: {\n verticalAxes: new Set(),\n horizontalAxes: new Set(),\n valueAxes: new Set(),\n values: new Set(),\n },\n groups: new Set(),\n axesTitle: {\n vertical: null,\n horizontal: null,\n },\n titles: {\n verticalAxes: {},\n getVerticalAxesTitle: null,\n horizontalAxes: {},\n getHorizontalAxesTitle: null,\n valuesAxes: {},\n getValueAxesTitle: null,\n },\n grid: {\n verticalAxes: null,\n horizontalAxes: null,\n },\n dataType: null,\n pointsDensity: null,\n});\n\nexport const makeDataHintsHandlers = (mutableContainer: DataStructureHints) => {\n const handler = {\n specifyDataRowFields: (x?: string, y?: string, value?: string) => {\n if (y) mutableContainer.fields.verticalAxes.add(y);\n if (x) mutableContainer.fields.horizontalAxes.add(x);\n if (value) mutableContainer.fields.valueAxes.add(value);\n },\n setupGrid: (direction: 'vertical' | 'horizontal', size: number) => {\n if (direction === 'horizontal') {\n mutableContainer.grid.horizontalAxes = size;\n } else if (direction === 'vertical') {\n mutableContainer.grid.verticalAxes = size;\n }\n },\n establishDataType: (dataType: SerializableDataType) => {\n mutableContainer.dataType = dataType;\n },\n describeValueEntity: (dataKey: string | number, readableName: string) => {\n mutableContainer.fields.values.add(dataKey);\n handler.labelKey('value', dataKey, readableName);\n },\n describeGroupedValues: (groupKey: string | number, dataKey: string | number) => {\n mutableContainer.groups.add(groupKey);\n mutableContainer.fields.values.add(dataKey);\n },\n labelKey: (\n axes: 'vertical' | 'horizontal' | 'value',\n dataKey: string | number,\n label: string,\n ) => {\n if (axes === 'vertical') mutableContainer.titles.verticalAxes[dataKey] = label;\n if (axes === 'horizontal') mutableContainer.titles.horizontalAxes[dataKey] = label;\n if (axes === 'value') mutableContainer.titles.valuesAxes[dataKey] = label;\n },\n addKeyLabelGetter: (\n axes: 'vertical' | 'horizontal' | 'value',\n getter: (dataKey: string | number) => string,\n ) => {\n if (axes === 'vertical') mutableContainer.titles.getVerticalAxesTitle = getter;\n if (axes === 'horizontal') mutableContainer.titles.getHorizontalAxesTitle = getter;\n if (axes === 'value') mutableContainer.titles.getValueAxesTitle = getter;\n },\n setTitle: (describedDataAxes: 'vertical' | 'horizontal', title: string) => {\n if (\n typeof title === 'number' ||\n typeof title === 'bigint' ||\n (typeof title === 'object' && (title as any) instanceof Date)\n ) {\n title = String(title);\n }\n if (typeof title !== 'string') {\n title = reactToText(title);\n }\n if (describedDataAxes === 'horizontal') {\n mutableContainer.axesTitle.horizontal = title;\n } else if (describedDataAxes === 'vertical') {\n mutableContainer.axesTitle.vertical = title;\n }\n },\n setPointsDensity: (horizontalAxes: number, verticalAxes: number) => {\n mutableContainer.pointsDensity = { verticalAxes, horizontalAxes };\n },\n };\n return handler;\n};\n\nexport type DataHintsHandler = ReturnType<typeof makeDataHintsHandlers>;\n\nexport const makeDataSummarizationConfig = (\n config?: PartialDataSummarizationConfig,\n): DataSummarizationConfig => ({\n clustersGridSize: undefined,\n maxListSymbols: 100,\n datesWithTime: undefined,\n clustersLimit: 5,\n valuesLimit: 5,\n groupsLimit: 5,\n dataType: undefined,\n disable: false,\n override: undefined,\n ...(config ?? {}),\n trendTangens: {\n static: 1 / 15,\n weak: 1 / 10,\n medium: 1 / 5,\n strong: Infinity,\n ...(config?.trendTangens ?? {}),\n },\n movingAverage: {\n longSize: undefined,\n shortSize: undefined,\n notableDiff: undefined,\n ...(config?.movingAverage ?? {}),\n },\n additionalFields: [...(config?.additionalFields ?? [])],\n});\n"],"mappings":";;;AACA,OAAOA,WAAW,MAAM,gCAAgC;AAqExD,OAAO,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAAA;EAAA,OAA8B;IAC/DC,MAAM,EAAE;MACNC,YAAY,EAAE,IAAIC,GAAG,EAAE;MACvBC,cAAc,EAAE,IAA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E,KAAK;IACdC,QAAQ,EAAEP;EAAS,GACfN,MAAM,aAANA,MAAM,cAANA,MAAM,GAAI,CAAC,CAAC;IAChBc,YAAY,EAAAV,aAAA;MACV,UAAQ,CAAC,GAAG,EAAE;MACdW,IAAI,EAAE,CAAC,GAAG,EAAE;MACZC,MAAM,EAAE,CAAC,GAAG,CAAC;MACbC,MAAM,EAAEC;IAAQ,IAAAjB,oBAAA,GACZD,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEc,YAAY,cAAAb,oBAAA,cAAAA,oBAAA,GAAI,CAAC,CAAC,CAC/B;IACDkB,aAAa,EAAAf,aAAA;MACXgB,QAAQ,EAAEd,SAAS;MACnBe,SAAS,EAAEf,SAAS;MACpBgB,WAAW,EAAEhB;IAAS,IAAAJ,qBAAA,GAClBF,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEmB,aAAa,cAAAjB,qBAAA,cAAAA,qBAAA,GAAI,CAAC,CAAC,CAChC;IACDqB,gBAAgB,EAAAC,kBAAA,EAAArB,qBAAA,GAAOH,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEuB,gBAAgB,cAAApB,qBAAA,cAAAA,qBAAA,GAAI,EAAE;EAAE;AAAA,CACvD"}
1
+ {"version":3,"file":"hints.js","names":["reactToText","makeDataHintsContainer","fields","verticalAxes","Set","horizontalAxes","valueAxes","values","groups","axesTitle","vertical","horizontal","titles","getVerticalAxesTitle","getHorizontalAxesTitle","valuesAxes","getValueAxesTitle","grid","dataType","pointsDensity","makeDataHintsHandlers","mutableContainer","handler","specifyDataRowFields","x","y","value","add","setupGrid","direction","size","establishDataType","describeValueEntity","dataKey","readableName","labelKey","describeGroupedValues","groupKey","axes","label","addKeyLabelGetter","getter","setTitle","describedDataAxes","title","_typeof","Date","String","setPointsDensity","makeDataSummarizationConfig","config","_config$trendTangens","_config$movingAverage","_config$additionalFie","_objectSpread","clustersGridSize","undefined","maxListSymbols","datesWithTime","clustersLimit","valuesLimit","groupsLimit","disable","override","trendTangens","weak","medium","strong","Infinity","movingAverage","longSize","shortSize","notableDiff","additionalFields","_toConsumableArray"],"sources":["../../../src/a11y/hints.ts"],"sourcesContent":["import { SerializableDataType } from './insights';\nimport reactToText from '@semcore/utils/lib/reactToText';\n\ntype DeepPartial<T> = T extends object\n ? {\n [P in keyof T]?: DeepPartial<T[P]>;\n }\n : T;\n\nexport type DataStructureHints = {\n fields: {\n verticalAxes: Set<string | number>;\n horizontalAxes: Set<string | number>;\n valueAxes: Set<string | number>;\n values: Set<string | number>;\n };\n groups: Set<string | number>;\n axesTitle: {\n vertical: string | null;\n horizontal: string | null;\n };\n titles: {\n verticalAxes: {\n [dataKey: string | number]: string;\n };\n getVerticalAxesTitle: null | ((dataKey: string | number) => string);\n horizontalAxes: {\n [dataKey: string | number]: string;\n };\n getHorizontalAxesTitle: null | ((dataKey: string | number) => string);\n valuesAxes: {\n [dataKey: string | number]: string;\n };\n getValueAxesTitle: null | ((dataKey: string | number) => string);\n };\n grid: {\n verticalAxes: number | null;\n horizontalAxes: number | null;\n };\n pointsDensity: {\n verticalAxes: number;\n horizontalAxes: number;\n } | null;\n dataType: SerializableDataType | null;\n};\nexport type DataSummarizationConfig = {\n trendTangens: {\n static: number;\n weak: number;\n medium: number;\n strong: number;\n };\n movingAverage: {\n longSize: number | undefined;\n shortSize: number | undefined;\n notableDiff: number | undefined;\n };\n dataType: SerializableDataType | undefined;\n clustersGridSize: number | undefined;\n maxListSymbols: number;\n datesWithTime: boolean | undefined;\n clustersLimit: number;\n valuesLimit: number;\n groupsLimit: number;\n disable: boolean;\n override: string | undefined;\n additionalFields: string[];\n};\nexport type PartialDataSummarizationConfig = DeepPartial<DataSummarizationConfig>;\n\nexport const makeDataHintsContainer = (): DataStructureHints => ({\n fields: {\n verticalAxes: new Set(),\n horizontalAxes: new Set(),\n valueAxes: new Set(),\n values: new Set(),\n },\n groups: new Set(),\n axesTitle: {\n vertical: null,\n horizontal: null,\n },\n titles: {\n verticalAxes: {},\n getVerticalAxesTitle: null,\n horizontalAxes: {},\n getHorizontalAxesTitle: null,\n valuesAxes: {},\n getValueAxesTitle: null,\n },\n grid: {\n verticalAxes: null,\n horizontalAxes: null,\n },\n dataType: null,\n pointsDensity: null,\n});\n\nexport const makeDataHintsHandlers = (mutableContainer: DataStructureHints) => {\n const handler = {\n specifyDataRowFields: (x?: string, y?: string, value?: string) => {\n if (y) mutableContainer.fields.verticalAxes.add(y);\n if (x) mutableContainer.fields.horizontalAxes.add(x);\n if (value) mutableContainer.fields.valueAxes.add(value);\n },\n setupGrid: (direction: 'vertical' | 'horizontal', size: number) => {\n if (direction === 'horizontal') {\n mutableContainer.grid.horizontalAxes = size;\n } else if (direction === 'vertical') {\n mutableContainer.grid.verticalAxes = size;\n }\n },\n establishDataType: (dataType: SerializableDataType) => {\n mutableContainer.dataType = dataType;\n },\n describeValueEntity: (dataKey: string | number, readableName: string) => {\n mutableContainer.fields.values.add(dataKey);\n handler.labelKey('value', dataKey, readableName);\n },\n describeGroupedValues: (groupKey: string | number, dataKey: string | number) => {\n mutableContainer.groups.add(groupKey);\n mutableContainer.fields.values.add(dataKey);\n },\n labelKey: (\n axes: 'vertical' | 'horizontal' | 'value',\n dataKey: string | number,\n label: string,\n ) => {\n if (axes === 'vertical') mutableContainer.titles.verticalAxes[dataKey] = label;\n if (axes === 'horizontal') mutableContainer.titles.horizontalAxes[dataKey] = label;\n if (axes === 'value') mutableContainer.titles.valuesAxes[dataKey] = label;\n },\n addKeyLabelGetter: (\n axes: 'vertical' | 'horizontal' | 'value',\n getter: (dataKey: string | number) => string,\n ) => {\n if (axes === 'vertical') mutableContainer.titles.getVerticalAxesTitle = getter;\n if (axes === 'horizontal') mutableContainer.titles.getHorizontalAxesTitle = getter;\n if (axes === 'value') mutableContainer.titles.getValueAxesTitle = getter;\n },\n setTitle: (describedDataAxes: 'vertical' | 'horizontal', title: string) => {\n if (\n typeof title === 'number' ||\n typeof title === 'bigint' ||\n (typeof title === 'object' && (title as any) instanceof Date)\n ) {\n title = String(title);\n }\n if (typeof title !== 'string') {\n title = reactToText(title);\n }\n if (describedDataAxes === 'horizontal') {\n mutableContainer.axesTitle.horizontal = title;\n } else if (describedDataAxes === 'vertical') {\n mutableContainer.axesTitle.vertical = title;\n }\n },\n setPointsDensity: (horizontalAxes: number, verticalAxes: number) => {\n mutableContainer.pointsDensity = { verticalAxes, horizontalAxes };\n },\n };\n return handler;\n};\n\nexport type DataHintsHandler = ReturnType<typeof makeDataHintsHandlers>;\n\nexport const makeDataSummarizationConfig = (\n config?: PartialDataSummarizationConfig,\n): DataSummarizationConfig => ({\n clustersGridSize: undefined,\n maxListSymbols: 100,\n datesWithTime: undefined,\n clustersLimit: 5,\n valuesLimit: 5,\n groupsLimit: 5,\n dataType: undefined,\n disable: false,\n override: undefined,\n ...(config ?? {}),\n trendTangens: {\n static: 1 / 15,\n weak: 1 / 10,\n medium: 1 / 5,\n strong: Infinity,\n ...(config?.trendTangens ?? {}),\n },\n movingAverage: {\n longSize: undefined,\n shortSize: undefined,\n notableDiff: undefined,\n ...(config?.movingAverage ?? {}),\n },\n additionalFields: [...(config?.additionalFields ?? [])] as string[],\n});\n"],"mappings":";;;AACA,OAAOA,WAAW,MAAM,gCAAgC;AAqExD,OAAO,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAAA;EAAA,OAA8B;IAC/DC,MAAM,EAAE;MACNC,YAAY,EAAE,IAAIC,GAAG,EAAE;MACvBC,cAAc,EAAE,IAAID,GAAG,EAAE;MACzBE,SAAS,EAAE,IAAIF,GAAG,EAAE;MACpBG,MAAM,EAAE,IAAIH,GAAG;IACjB,CAAC;IACDI,MAAM,EAAE,IAAIJ,GAAG,EAAE;IACjBK,SAAS,EAAE;MACTC,QAAQ,EAAE,IAAI;MACdC,UAAU,EAAE;IACd,CAAC;IACDC,MAAM,EAAE;MACNT,YAAY,EAAE,CAAC,CAAC;MAChBU,oBAAoB,EAAE,IAAI;MAC1BR,cAAc,EAAE,CAAC,CAAC;MAClBS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,cAAAA,oBAAA,GAAI,CAAC,CAAC,CAC/B;IACDkB,aAAa,EAAAf,aAAA;MACXgB,QAAQ,EAAEd,SAAS;MACnBe,SAAS,EAAEf,SAAS;MACpBgB,WAAW,EAAEhB;IAAS,IAAAJ,qBAAA,GAClBF,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEmB,aAAa,cAAAjB,qBAAA,cAAAA,qBAAA,GAAI,CAAC,CAAC,CAChC;IACDqB,gBAAgB,EAAAC,kBAAA,EAAArB,qBAAA,GAAOH,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEuB,gBAAgB,cAAApB,qBAAA,cAAAA,qBAAA,GAAI,EAAE;EAAc;AAAA,CACnE"}
@@ -1 +1 @@
1
- {"version":3,"file":"serialize.js","names":["getIntl","formatLimitedSizeList","items","intl","maxFinalStringLength","arguments","length","undefined","includeEllipsis","limit","stringifyList","cutItems","slice","push","formatMessage","id","leftCount","formatList","formattedList","overflowRatio","Math","floor","maxIncreaseAttempts","i","newLimitFormattedList","isReactComponent","obj","_typeof","displayName","guessNumberAsTimestampMinDate","Date","getTime","formatValue","value","_ref","siblingsTimeMark","maxListSymbols","datesWithTime","formatNumber","abs","formatDate","dateStyle","timeStyle","Array","isArray","formattedValues","map","subValue","String","formatValuesList","values","_ref2","result","_ref3","rawValue","label","serialize","_ref4","_ref5","_ref6","insights","dataType","dataRange","dataTitle","entitiesCount","clustersLimit","valuesLimit","groupsLimit","locale","translations","availableLocales","dataRangeSummary","range","from","to","trendsInsights","trendsByDataKey","_iterator","_createForOfIteratorHelper","_step","s","n","done","_trendsByDataKey$insi","insight","dataKey","err","e","f","entities","count","entitiesList","Object","entries","_ref7","_ref8","_slicedToArray","generalTrend","find","type","localTrends","filter","primaryTrend","secondaryTrends","mainSummary","trend","concat","change","strength","secondarylSummaries","general","locals","summary","clustersInsights","biggestClusters","maxSize","size","minSize","clusterInsight","labels","anonymous","relativeSize","x","center","xLabel","y","yLabel","_ref9","_ref10","valuesInsight","groupInsights","valueCounts","group","minValuesCount","min","apply","_toConsumableArray","maxValuesCount","max","groupsCount","valuesCount","_ref11","sumamry"],"sources":["../../../src/a11y/serialize.ts"],"sourcesContent":["import { AnalyzedData, ClusterNode, ComparisonNode, GeneralTrendNode, TrendNode } from './insights';\n\nimport React from 'react';\nimport { DataSummarizationConfig } from './hints';\nimport { getIntl, Intl } from './intl';\n\nconst formatLimitedSizeList = (\n items: unknown[],\n intl: Intl,\n maxFinalStringLength = 100,\n includeEllipsis = true,\n) => {\n let limit = items.length;\n const stringifyList = () => {\n const cutItems = items.slice(0, limit);\n if (items.length > limit && includeEllipsis) {\n cutItems.push(intl.formatMessage({ id: 'ellipsis' }, { leftCount: limit - items.length }));\n }\n\n return intl.formatList(cutItems);\n };\n\n let formattedList = stringifyList();\n if (formattedList.length <= maxFinalStringLength) {\n return formattedList;\n }\n\n const overflowRatio = formattedList.length / maxFinalStringLength;\n limit = Math.floor(limit / overflowRatio);\n if (limit === 0) {\n limit = 1;\n return stringifyList();\n }\n\n formattedList = stringifyList();\n\n const maxIncreaseAttempts = 4;\n for (let i = 0; i < maxIncreaseAttempts; i++) {\n limit++;\n const newLimitFormattedList = stringifyList();\n\n if (newLimitFormattedList.length > maxFinalStringLength) {\n return formattedList;\n }\n\n formattedList = newLimitFormattedList;\n }\n\n return formattedList;\n};\n\nconst isReactComponent = (obj: any) =>\n typeof obj === 'object' && obj && 'displayName' in obj && typeof obj.displayName === 'string';\n\nconst guessNumberAsTimestampMinDate = new Date('1975').getTime();\n\nexport const formatValue = (\n intl: Intl,\n value: unknown,\n {\n siblingsTimeMark,\n maxListSymbols,\n datesWithTime,\n }: {\n siblingsTimeMark?: unknown;\n maxListSymbols?: number;\n datesWithTime?: boolean;\n } = {},\n): string => {\n if (typeof value === 'number') {\n if (value >= guessNumberAsTimestampMinDate) {\n return formatValue(intl, new Date(value), {\n siblingsTimeMark,\n maxListSymbols,\n datesWithTime,\n });\n }\n return intl.formatNumber(value);\n }\n if (value instanceof Date) {\n if (\n datesWithTime ||\n (siblingsTimeMark &&\n siblingsTimeMark instanceof Date &&\n Math.abs(value.getTime() - siblingsTimeMark.getTime()) < 1000 * 60 * 60 * 24 * 5)\n ) {\n return intl.formatDate(value, { dateStyle: 'medium', timeStyle: 'medium' });\n }\n return intl.formatDate(value, { dateStyle: 'medium' });\n }\n\n if (Array.isArray(value)) {\n const formattedValues = value.map((subValue) =>\n formatValue(intl, subValue, { siblingsTimeMark, maxListSymbols, datesWithTime }),\n );\n\n return formatLimitedSizeList(formattedValues, intl, maxListSymbols);\n }\n\n if (isReactComponent(value)) {\n return String((value as React.FC).displayName);\n }\n\n if (value === undefined || value === null) {\n return intl.formatMessage({ id: 'data-not-available' });\n }\n\n return String(value);\n};\n\nconst formatValuesList = (\n values: { label: string; value: unknown }[],\n {\n intl,\n limit,\n datesWithTime,\n maxListSymbols,\n }: { intl: Intl; limit: number; datesWithTime?: boolean; maxListSymbols: number },\n) => {\n const result = values.slice(0, limit).map(({ value: rawValue, label }) => {\n if (rawValue === undefined) return label;\n\n const value = formatValue(intl, rawValue, { datesWithTime, maxListSymbols });\n\n if (String(value) === String(label)) return value;\n\n return intl.formatMessage({ id: 'value-labeled' }, { label, value });\n });\n if (values.length > limit) {\n result.push(\n intl.formatMessage({ id: 'ellipsis' }, { leftCount: limit - values.values.length }),\n );\n }\n\n return intl.formatList(result);\n};\n\nexport const serialize = (\n { insights, dataType, dataRange, dataTitle, entitiesCount }: AnalyzedData,\n {\n datesWithTime,\n maxListSymbols,\n clustersLimit,\n valuesLimit,\n groupsLimit,\n }: DataSummarizationConfig,\n {\n locale,\n translations,\n availableLocales,\n }: {\n locale: string;\n translations?: { [messageId: string]: string };\n availableLocales?: { [localeId: string]: any };\n },\n): string | null => {\n if (insights.length === 0) return null;\n\n const intl = getIntl(locale, translations, availableLocales);\n\n const dataRangeSummary = intl.formatList(\n dataRange.map((range) => {\n const from = formatValue(intl, range.from, {\n siblingsTimeMark: range.to,\n datesWithTime,\n maxListSymbols,\n });\n const to = formatValue(intl, range.to, {\n siblingsTimeMark: range.from,\n datesWithTime,\n maxListSymbols,\n });\n\n return intl.formatMessage(\n { id: range.label ? 'additional-axe' : 'additional-axe-no-label' },\n { from, to, label: range.label },\n );\n }),\n );\n\n if (dataType === 'time-series') {\n const trendsInsights = insights as (GeneralTrendNode | TrendNode)[];\n const trendsByDataKey: { [label: string]: (GeneralTrendNode | TrendNode)[] } = {};\n for (const insight of trendsInsights) {\n trendsByDataKey[insight.dataKey] = trendsByDataKey[insight.dataKey] ?? [];\n trendsByDataKey[insight.dataKey].push(insight);\n }\n\n const entities = intl.formatMessage(\n { id: 'entity-type-time-series' },\n { count: entitiesCount },\n );\n const entitiesList = Object.entries(trendsByDataKey).map(([dataKey, insights]) => {\n const generalTrend = insights.find((insight) => insight.type === 'general-trend');\n const localTrends = insights.filter((insight) => insight !== generalTrend);\n const primaryTrend = generalTrend ?? localTrends[0];\n const secondaryTrends: (TrendNode | GeneralTrendNode)[] = insights.filter(\n (insight) => insight !== primaryTrend,\n );\n const mainSummary: string = intl.formatMessage(\n { id: 'time-series-general-trend' },\n {\n dataKey: entitiesCount !== 1 ? dataKey : '',\n trend: intl.formatMessage({ id: `trend-${primaryTrend.change.strength}` }),\n from: intl.formatNumber(primaryTrend.change.from),\n to: intl.formatNumber(primaryTrend.change.to),\n },\n );\n const secondarylSummaries = secondaryTrends.map((trend) =>\n intl.formatMessage(\n { id: 'time-series-local-trend' },\n {\n trend: intl.formatMessage({ id: `trend-${trend.change.strength}` }),\n from: formatValue(intl, trend.from, {\n siblingsTimeMark: trend.to,\n datesWithTime,\n maxListSymbols,\n }),\n to: formatValue(intl, trend.to, {\n siblingsTimeMark: trend.from,\n datesWithTime,\n maxListSymbols,\n }),\n },\n ),\n );\n\n if (secondarylSummaries.length === 0) {\n return mainSummary;\n }\n\n return intl.formatMessage(\n {\n id: 'time-series-detailed-trend',\n },\n {\n general: mainSummary,\n locals: formatLimitedSizeList(secondarylSummaries, intl, 400, false),\n },\n );\n });\n\n const summary = intl.formatMessage(\n { id: dataTitle ? 'chart-summary' : 'chart-summary-no-label' },\n { entities, entitiesList: intl.formatList(entitiesList), label: dataTitle },\n );\n\n if (dataRangeSummary.length > 0) {\n return `${summary}\\n${dataRangeSummary}`;\n }\n\n return summary;\n } else if (dataType === 'points-cloud') {\n const clustersInsights = insights as ClusterNode[];\n const biggestClusters = clustersInsights.slice(0, clustersLimit);\n\n const maxSize = clustersInsights[0].size;\n const minSize = clustersInsights[clustersInsights.length - 1].size;\n const entities =\n maxSize === minSize\n ? intl.formatMessage(\n { id: 'entity-type-clusters-single-size' },\n { count: entitiesCount, size: maxSize },\n )\n : intl.formatMessage(\n { id: 'entity-type-clusters-multiple-size' },\n { count: entitiesCount, maxSize, minSize },\n );\n const entitiesList = biggestClusters.map((clusterInsight) => {\n const labels = formatLimitedSizeList(clusterInsight.labels, intl, maxListSymbols);\n const anonymous =\n clusterInsight.labels.length === 0 || labels === String(clusterInsight.size);\n\n return intl.formatMessage(\n {\n id: anonymous ? 'entity-type-clusters-label-anonymous' : 'entity-type-clusters-label',\n },\n {\n relativeSize: intl.formatMessage({ id: `relative-size-${clusterInsight.relativeSize}` }),\n labels,\n size: clusterInsight.size,\n x: intl.formatNumber(clusterInsight.center.x),\n xLabel: clusterInsight.center.xLabel,\n y: intl.formatNumber(clusterInsight.center.y),\n yLabel: clusterInsight.center.yLabel,\n },\n );\n });\n if (insights.length > clustersLimit) {\n entitiesList.push(\n intl.formatMessage({ id: 'ellipsis' }, { leftCount: insights.length - clustersLimit }),\n );\n }\n\n const summary = intl.formatMessage(\n { id: dataTitle ? 'chart-summary' : 'chart-summary-no-label' },\n { entities, entitiesList: intl.formatList(entitiesList), label: dataTitle },\n );\n\n if (dataRangeSummary.length > 0) {\n return `${summary}\\n${dataRangeSummary}`;\n }\n\n return summary;\n } else if (dataType === 'values-set') {\n const [valuesInsight] = insights as [ComparisonNode];\n const entities = intl.formatMessage({ id: 'entity-type-values' }, { count: entitiesCount });\n const entitiesList = formatValuesList(valuesInsight.values, {\n intl,\n limit: valuesLimit,\n datesWithTime,\n maxListSymbols,\n });\n\n return intl.formatMessage(\n { id: dataTitle ? 'chart-summary' : 'chart-summary-no-label' },\n { entities, entitiesList: entitiesList, label: dataTitle },\n );\n } else if (dataType === 'grouped-values' || dataType === 'indexed-groups') {\n const groupInsights = insights as ComparisonNode[];\n const valueCounts = groupInsights.map((group) => group.values.length);\n const minValuesCount = Math.min(...valueCounts);\n const maxValuesCount = Math.max(...valueCounts);\n\n const entities =\n minValuesCount === maxValuesCount\n ? intl.formatMessage(\n { id: 'entity-type-grouped-values-single-size' },\n { groupsCount: groupInsights.length, valuesCount: valueCounts[0] },\n )\n : intl.formatMessage(\n { id: 'entity-type-grouped-values-multiple-size' },\n { groupsCount: groupInsights.length, minValuesCount, maxValuesCount },\n );\n const entitiesList = groupInsights.slice(0, groupsLimit).map(({ label, values }) => {\n const formattedValues = formatValuesList(values, {\n intl,\n limit: valuesLimit,\n datesWithTime,\n maxListSymbols,\n });\n return intl.formatMessage({ id: 'values-group' }, { label, values: formattedValues });\n });\n if (groupInsights.values.length > groupsLimit) {\n entitiesList.push(\n intl.formatMessage(\n { id: 'ellipsis' },\n { leftCount: groupInsights.values.length - groupsLimit },\n ),\n );\n }\n\n const sumamry = intl.formatMessage(\n { id: dataTitle ? 'chart-summary' : 'chart-summary-no-label' },\n { entities, entitiesList: intl.formatList(entitiesList), label: dataTitle },\n );\n\n return sumamry;\n }\n\n return null;\n};\n"],"mappings":";;;;AAIA,SAASA,OAAO,QAAc,QAAQ;AAEtC,IAAMC,qBAAqB,GAAG,SAAxBA,qBAAqBA,CACzBC,KAAgB,EAChBC,IAAU,EAGP;EAAA,IAFHC,oBAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,GAAG;EAAA,IAC1BG,eAAe,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA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qF,aAAa,CAAChF,MAAM,CAAC5C,MAAM,GAAG6D,WAAW,EAAE;MAC7CwB,cAAY,CAAC9E,IAAI,CACfV,IAAI,CAACW,aAAa,CAChB;QAAEC,EAAE,EAAE;MAAW,CAAC,EAClB;QAAEC,SAAS,EAAEkH,aAAa,CAAChF,MAAM,CAAC5C,MAAM,GAAG6D;MAAY,CAAC,CACzD,CACF;IACH;IAEA,IAAM2E,OAAO,GAAG3I,IAAI,CAACW,aAAa,CAChC;MAAEC,EAAE,EAAEgD,SAAS,GAAG,eAAe,GAAG;IAAyB,CAAC,EAC9D;MAAE0B,QAAQ,EAARA,UAAQ;MAAEE,YAAY,EAAExF,IAAI,CAACc,UAAU,CAAC0E,cAAY,CAAC;MAAEpC,KAAK,EAAEQ;IAAU,CAAC,CAC5E;IAED,OAAO+E,OAAO;EAChB;EAEA,OAAO,IAAI;AACb,CAAC"}
1
+ {"version":3,"file":"serialize.js","names":["getIntl","formatLimitedSizeList","items","intl","maxFinalStringLength","arguments","length","undefined","includeEllipsis","limit","stringifyList","cutItems","slice","push","formatMessage","id","leftCount","formatList","formattedList","overflowRatio","Math","floor","maxIncreaseAttempts","i","newLimitFormattedList","isReactComponent","obj","_typeof","displayName","guessNumberAsTimestampMinDate","Date","getTime","formatValue","value","_ref","siblingsTimeMark","maxListSymbols","datesWithTime","formatNumber","abs","formatDate","dateStyle","timeStyle","Array","isArray","formattedValues","map","subValue","String","formatValuesList","values","_ref2","result","_ref3","rawValue","label","serialize","_ref4","_ref5","_ref6","insights","dataType","dataRange","dataTitle","entitiesCount","clustersLimit","valuesLimit","groupsLimit","locale","translations","availableLocales","dataRangeSummary","range","from","to","trendsInsights","trendsByDataKey","_iterator","_createForOfIteratorHelper","_step","s","n","done","_trendsByDataKey$insi","insight","dataKey","err","e","f","entities","count","entitiesList","Object","entries","_ref7","_ref8","_slicedToArray","generalTrend","find","type","localTrends","filter","primaryTrend","secondaryTrends","mainSummary","trend","concat","change","strength","secondarylSummaries","general","locals","summary","clustersInsights","biggestClusters","maxSize","size","minSize","clusterInsight","labels","anonymous","relativeSize","x","center","xLabel","y","yLabel","_ref9","_ref10","valuesInsight","groupInsights","valueCounts","group","minValuesCount","min","apply","_toConsumableArray","maxValuesCount","max","groupsCount","valuesCount","_ref11","sumamry"],"sources":["../../../src/a11y/serialize.ts"],"sourcesContent":["import { AnalyzedData, ClusterNode, ComparisonNode, GeneralTrendNode, TrendNode } from './insights';\n\nimport React from 'react';\nimport { DataSummarizationConfig } from './hints';\nimport { getIntl, Intl } from './intl';\n\nconst formatLimitedSizeList = (\n items: unknown[],\n intl: Intl,\n maxFinalStringLength = 100,\n includeEllipsis = true,\n) => {\n let limit = items.length;\n const stringifyList = () => {\n const cutItems = items.slice(0, limit);\n if (items.length > limit && includeEllipsis) {\n cutItems.push(intl.formatMessage({ id: 'ellipsis' }, { leftCount: limit - items.length }));\n }\n\n return intl.formatList(cutItems);\n };\n\n let formattedList = stringifyList();\n if (formattedList.length <= maxFinalStringLength) {\n return formattedList;\n }\n\n const overflowRatio = formattedList.length / maxFinalStringLength;\n limit = Math.floor(limit / overflowRatio);\n if (limit === 0) {\n limit = 1;\n return stringifyList();\n }\n\n formattedList = stringifyList();\n\n const maxIncreaseAttempts = 4;\n for (let i = 0; i < maxIncreaseAttempts; i++) {\n limit++;\n const newLimitFormattedList = stringifyList();\n\n if (newLimitFormattedList.length > maxFinalStringLength) {\n return formattedList;\n }\n\n formattedList = newLimitFormattedList;\n }\n\n return formattedList;\n};\n\nconst isReactComponent = (obj: any) =>\n typeof obj === 'object' && obj && 'displayName' in obj && typeof obj.displayName === 'string';\n\nconst guessNumberAsTimestampMinDate = new Date('1975').getTime();\n\nexport const formatValue = (\n intl: Intl,\n value: unknown,\n {\n siblingsTimeMark,\n maxListSymbols,\n datesWithTime,\n }: {\n siblingsTimeMark?: unknown;\n maxListSymbols?: number;\n datesWithTime?: boolean;\n } = {},\n): string => {\n if (typeof value === 'number') {\n if (value >= guessNumberAsTimestampMinDate) {\n return formatValue(intl, new Date(value), {\n siblingsTimeMark,\n maxListSymbols,\n datesWithTime,\n });\n }\n return intl.formatNumber(value);\n }\n if (value instanceof Date) {\n if (\n datesWithTime ||\n (siblingsTimeMark &&\n siblingsTimeMark instanceof Date &&\n Math.abs(value.getTime() - siblingsTimeMark.getTime()) < 1000 * 60 * 60 * 24 * 5)\n ) {\n return intl.formatDate(value, { dateStyle: 'medium', timeStyle: 'medium' });\n }\n return intl.formatDate(value, { dateStyle: 'medium' });\n }\n\n if (Array.isArray(value)) {\n const formattedValues = value.map((subValue) =>\n formatValue(intl, subValue, { siblingsTimeMark, maxListSymbols, datesWithTime }),\n );\n\n return formatLimitedSizeList(formattedValues, intl, maxListSymbols);\n }\n\n if (isReactComponent(value)) {\n return String((value as React.FC).displayName);\n }\n\n if (value === undefined || value === null) {\n return intl.formatMessage({ id: 'data-not-available' });\n }\n\n return String(value);\n};\n\nconst formatValuesList = (\n values: { label: string; value: unknown }[],\n {\n intl,\n limit,\n datesWithTime,\n maxListSymbols,\n }: { intl: Intl; limit: number; datesWithTime?: boolean; maxListSymbols: number },\n) => {\n const result = values.slice(0, limit).map(({ value: rawValue, label }) => {\n if (rawValue === undefined) return label;\n\n const value = formatValue(intl, rawValue, { datesWithTime, maxListSymbols });\n\n if (String(value) === String(label)) return value;\n\n return intl.formatMessage({ id: 'value-labeled' }, { label, value });\n });\n if (values.length > limit) {\n result.push(\n intl.formatMessage({ id: 'ellipsis' }, { leftCount: limit - values.values.length }),\n );\n }\n\n return intl.formatList(result);\n};\n\nexport const serialize = (\n { insights, dataType, dataRange, dataTitle, entitiesCount }: AnalyzedData,\n {\n datesWithTime,\n maxListSymbols,\n clustersLimit,\n valuesLimit,\n groupsLimit,\n }: DataSummarizationConfig,\n {\n locale,\n translations,\n availableLocales,\n }: {\n locale: string;\n translations?: { [messageId: string]: string };\n availableLocales?: { [localeId: string]: any };\n },\n): string | null => {\n if (insights.length === 0) return null;\n\n const intl = getIntl(locale, translations!, availableLocales!);\n\n const dataRangeSummary = intl.formatList(\n dataRange.map((range) => {\n const from = formatValue(intl, range.from, {\n siblingsTimeMark: range.to,\n datesWithTime,\n maxListSymbols,\n });\n const to = formatValue(intl, range.to, {\n siblingsTimeMark: range.from,\n datesWithTime,\n maxListSymbols,\n });\n\n return intl.formatMessage(\n { id: range.label ? 'additional-axe' : 'additional-axe-no-label' },\n { from, to, label: range.label },\n );\n }),\n );\n\n if (dataType === 'time-series') {\n const trendsInsights = insights as (GeneralTrendNode | TrendNode)[];\n const trendsByDataKey: { [label: string]: (GeneralTrendNode | TrendNode)[] } = {};\n for (const insight of trendsInsights) {\n trendsByDataKey[insight.dataKey] = trendsByDataKey[insight.dataKey] ?? [];\n trendsByDataKey[insight.dataKey].push(insight);\n }\n\n const entities = intl.formatMessage(\n { id: 'entity-type-time-series' },\n { count: entitiesCount },\n );\n const entitiesList = Object.entries(trendsByDataKey).map(([dataKey, insights]) => {\n const generalTrend = insights.find((insight) => insight.type === 'general-trend');\n const localTrends = insights.filter((insight) => insight !== generalTrend);\n const primaryTrend = generalTrend ?? localTrends[0];\n const secondaryTrends: (TrendNode | GeneralTrendNode)[] = insights.filter(\n (insight) => insight !== primaryTrend,\n );\n const mainSummary: string = intl.formatMessage(\n { id: 'time-series-general-trend' },\n {\n dataKey: entitiesCount !== 1 ? dataKey : '',\n trend: intl.formatMessage({ id: `trend-${primaryTrend.change.strength}` }),\n from: intl.formatNumber(primaryTrend.change.from),\n to: intl.formatNumber(primaryTrend.change.to),\n },\n );\n const secondarylSummaries = secondaryTrends.map((trend) =>\n intl.formatMessage(\n { id: 'time-series-local-trend' },\n {\n trend: intl.formatMessage({ id: `trend-${trend.change.strength}` }),\n from: formatValue(intl, trend.from, {\n siblingsTimeMark: trend.to,\n datesWithTime,\n maxListSymbols,\n }),\n to: formatValue(intl, trend.to, {\n siblingsTimeMark: trend.from,\n datesWithTime,\n maxListSymbols,\n }),\n },\n ),\n );\n\n if (secondarylSummaries.length === 0) {\n return mainSummary;\n }\n\n return intl.formatMessage(\n {\n id: 'time-series-detailed-trend',\n },\n {\n general: mainSummary,\n locals: formatLimitedSizeList(secondarylSummaries, intl, 400, false),\n },\n );\n });\n\n const summary = intl.formatMessage(\n { id: dataTitle ? 'chart-summary' : 'chart-summary-no-label' },\n { entities, entitiesList: intl.formatList(entitiesList), label: dataTitle },\n );\n\n if (dataRangeSummary.length > 0) {\n return `${summary}\\n${dataRangeSummary}`;\n }\n\n return summary;\n } else if (dataType === 'points-cloud') {\n const clustersInsights = insights as ClusterNode[];\n const biggestClusters = clustersInsights.slice(0, clustersLimit);\n\n const maxSize = clustersInsights[0].size;\n const minSize = clustersInsights[clustersInsights.length - 1].size;\n const entities =\n maxSize === minSize\n ? intl.formatMessage(\n { id: 'entity-type-clusters-single-size' },\n { count: entitiesCount, size: maxSize },\n )\n : intl.formatMessage(\n { id: 'entity-type-clusters-multiple-size' },\n { count: entitiesCount, maxSize, minSize },\n );\n const entitiesList = biggestClusters.map((clusterInsight) => {\n const labels = formatLimitedSizeList(clusterInsight.labels, intl, maxListSymbols);\n const anonymous =\n clusterInsight.labels.length === 0 || labels === String(clusterInsight.size);\n\n return intl.formatMessage(\n {\n id: anonymous ? 'entity-type-clusters-label-anonymous' : 'entity-type-clusters-label',\n },\n {\n relativeSize: intl.formatMessage({ id: `relative-size-${clusterInsight.relativeSize}` }),\n labels,\n size: clusterInsight.size,\n x: intl.formatNumber(clusterInsight.center.x),\n xLabel: clusterInsight.center.xLabel,\n y: intl.formatNumber(clusterInsight.center.y),\n yLabel: clusterInsight.center.yLabel,\n },\n );\n });\n if (insights.length > clustersLimit) {\n entitiesList.push(\n intl.formatMessage({ id: 'ellipsis' }, { leftCount: insights.length - clustersLimit }),\n );\n }\n\n const summary = intl.formatMessage(\n { id: dataTitle ? 'chart-summary' : 'chart-summary-no-label' },\n { entities, entitiesList: intl.formatList(entitiesList), label: dataTitle },\n );\n\n if (dataRangeSummary.length > 0) {\n return `${summary}\\n${dataRangeSummary}`;\n }\n\n return summary;\n } else if (dataType === 'values-set') {\n const [valuesInsight] = insights as [ComparisonNode];\n const entities = intl.formatMessage({ id: 'entity-type-values' }, { count: entitiesCount });\n const entitiesList = formatValuesList(valuesInsight.values, {\n intl,\n limit: valuesLimit,\n datesWithTime,\n maxListSymbols,\n });\n\n return intl.formatMessage(\n { id: dataTitle ? 'chart-summary' : 'chart-summary-no-label' },\n { entities, entitiesList: entitiesList, label: dataTitle },\n );\n } else if (dataType === 'grouped-values' || dataType === 'indexed-groups') {\n const groupInsights = insights as ComparisonNode[];\n const valueCounts = groupInsights.map((group) => group.values.length);\n const minValuesCount = Math.min(...valueCounts);\n const maxValuesCount = Math.max(...valueCounts);\n\n const entities =\n minValuesCount === maxValuesCount\n ? intl.formatMessage(\n { id: 'entity-type-grouped-values-single-size' },\n { groupsCount: groupInsights.length, valuesCount: valueCounts[0] },\n )\n : intl.formatMessage(\n { id: 'entity-type-grouped-values-multiple-size' },\n { groupsCount: groupInsights.length, minValuesCount, maxValuesCount },\n );\n const entitiesList = groupInsights.slice(0, groupsLimit).map(({ label, values }) => {\n const formattedValues = formatValuesList(values, {\n intl,\n limit: valuesLimit,\n datesWithTime,\n maxListSymbols,\n });\n return intl.formatMessage({ id: 'values-group' }, { label, values: formattedValues });\n });\n if (groupInsights.values.length > groupsLimit) {\n entitiesList.push(\n intl.formatMessage(\n { id: 'ellipsis' },\n { leftCount: groupInsights.values.length - groupsLimit },\n ),\n );\n }\n\n const sumamry = intl.formatMessage(\n { id: dataTitle ? 'chart-summary' : 'chart-summary-no-label' },\n { entities, entitiesList: intl.formatList(entitiesList), label: dataTitle },\n );\n\n return sumamry;\n }\n\n return null;\n};\n"],"mappings":";;;;AAIA,SAASA,OAAO,QAAc,QAAQ;AAEtC,IAAMC,qBAAqB,GAAG,SAAxBA,qBAAqBA,CACzBC,KAAgB,EAChBC,IAAU,EAGP;EAAA,IAFHC,oBAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAA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,CAAC,EAAE;QAAEwC,KAAK,EAALA,KAAK;QAAEL,MAAM,EAAEL;MAAgB,CAAC,CAAC;IACvF,CAAC,CAAC;IACF,IAAIqF,aAAa,CAAChF,MAAM,CAAC5C,MAAM,GAAG6D,WAAW,EAAE;MAC7CwB,cAAY,CAAC9E,IAAI,CACfV,IAAI,CAACW,aAAa,CAChB;QAAEC,EAAE,EAAE;MAAW,CAAC,EAClB;QAAEC,SAAS,EAAEkH,aAAa,CAAChF,MAAM,CAAC5C,MAAM,GAAG6D;MAAY,CAAC,CACzD,CACF;IACH;IAEA,IAAM2E,OAAO,GAAG3I,IAAI,CAACW,aAAa,CAChC;MAAEC,EAAE,EAAEgD,SAAS,GAAG,eAAe,GAAG;IAAyB,CAAC,EAC9D;MAAE0B,QAAQ,EAARA,UAAQ;MAAEE,YAAY,EAAExF,IAAI,CAACc,UAAU,CAAC0E,cAAY,CAAC;MAAEpC,KAAK,EAAEQ;IAAU,CAAC,CAC5E;IAED,OAAO+E,OAAO;EAChB;EAEA,OAAO,IAAI;AACb,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=createElement.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createElement.d.js","names":[],"sources":["../../src/createElement.d.ts"],"sourcesContent":["declare const createElement: any;\nexport default createElement;\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"Bubble.d.js","names":[],"sources":["../../../src/types/Bubble.d.ts"],"sourcesContent":["import { Intergalactic, UnknownProperties } from '@semcore/core';\nimport { Context } from './context';\nimport { TooltipType } from './Tooltip';\nimport { IntergalacticD3Component } from './Plot';\n\n/** @deprecated */\nexport interface IBubbleProps extends BubbleProps, UnknownProperties {}\nexport type BubbleProps = Context & {\n /** Field name from `data` array item for the XAxis */\n x: string;\n /** Field name from `data` array item for the YAxis */\n y: string;\n /** Field name from `data` array item for the circle radius */\n value: string;\n /** Field name from `data` array item for the circle label */\n label?: string;\n /** Circle color */\n color?: string;\n /** Cross in the center of the bubble\n * @default true\n */\n markedCross?: boolean;\n /** Animation duration in ms\n * @default 500\n */\n duration?: number;\n /** Enables element transparency */\n transparent?: boolean;\n};\n\n/** @deprecated */\nexport interface IBubbleContext extends BubbleContext, UnknownProperties {}\nexport type BubbleContext = {\n /** Index element of data */\n index: number;\n};\n\ndeclare const Bubble: IntergalacticD3Component<\n Intergalactic.InternalTypings.ComponentTag,\n BubbleProps,\n BubbleContext\n> & {\n Tooltip: TooltipType<\n BubbleProps & {\n /**\n * @deprecated Use `index` instead.\n */\n xIndex: number;\n /**\n * Index of item in the `data` array used to render related bubble.\n */\n index: number;\n }\n >;\n};\n\nexport default Bubble;\n"],"mappings":""}
1
+ {"version":3,"file":"Bubble.d.js","names":[],"sources":["../../../src/types/Bubble.d.ts"],"sourcesContent":["import { Intergalactic, UnknownProperties } from '@semcore/core';\nimport { Context } from './context';\nimport { TooltipType } from './Tooltip';\nimport { IntergalacticD3Component } from './Plot';\n\n/** @deprecated */\nexport interface IBubbleProps extends BubbleProps, UnknownProperties {}\nexport type BubbleProps = Context & {\n /** Field name from `data` array item for the XAxis */\n x: string;\n /** Field name from `data` array item for the YAxis */\n y: string;\n /** Field name from `data` array item for the circle radius */\n value: string;\n /** Field name from `data` array item for the circle label */\n label?: string;\n /** Circle color */\n color?: string;\n /** Cross in the center of the bubble\n * @default true\n */\n markedCross?: boolean;\n /** Animation duration in ms\n * @default 500\n */\n duration?: number;\n /** Enables element transparency */\n transparent?: boolean;\n};\n\n/** @deprecated */\nexport interface IBubbleContext extends BubbleContext, UnknownProperties {}\nexport type BubbleContext = {\n /** Index element of data */\n index: number;\n};\n\ndeclare const Bubble: IntergalacticD3Component<Intergalactic.Tag, BubbleProps, BubbleContext> & {\n Tooltip: TooltipType<\n BubbleProps & {\n /**\n * @deprecated Use `index` instead.\n */\n xIndex: number;\n /**\n * Index of item in the `data` array used to render related bubble.\n */\n index: number;\n }\n >;\n};\n\nexport default Bubble;\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"Hover.d.js","names":[],"sources":["../../../src/types/Hover.d.ts"],"sourcesContent":["import { UnknownProperties } from '@semcore/core';\nimport { Context } from './context';\nimport { ReturnEl } from '@semcore/core';\nimport { TooltipTypeBase } from './Tooltip';\nimport { IBoxProps } from '@semcore/flex-box';\nimport { IntergalacticD3Component } from './Plot';\n\n/** @deprecated */\nexport interface IHoverProps extends HoverProps, UnknownProperties {}\nexport type HoverProps = Context & {\n /** Field name from `data` array item for the XAxis */\n x?: string;\n /** Field name from `data` array item for the YAxis */\n y?: string;\n};\n\ntype HoverTooltip = (<X, Y>(\n props: {\n /** Field name from `data` array item for the XAxis */\n x?: X;\n /** Field name from `data` array item for the YAxis */\n y?: Y;\n children: (props: {\n /** Index in `data` array of the current item */\n xIndex: X extends string ? string : never;\n /** Index in `data` array of the current item */\n yIndex: Y extends string ? string : never;\n }) => { children: ReturnEl };\n } & IBoxProps,\n) => ReturnEl) &\n TooltipTypeBase;\n\ndeclare const HoverLine: IntergalacticD3Component<'g', HoverProps> & {\n Tooltip: HoverTooltip;\n};\n\ndeclare const HoverRect: IntergalacticD3Component<'g', HoverProps> & {\n Tooltip: HoverTooltip;\n};\nexport { HoverLine, HoverRect };\n"],"mappings":""}
1
+ {"version":3,"file":"Hover.d.js","names":[],"sources":["../../../src/types/Hover.d.ts"],"sourcesContent":["import { UnknownProperties } from '@semcore/core';\nimport { Context } from './context';\nimport { ReturnEl } from '@semcore/core';\nimport { TooltipTypeBase } from './Tooltip';\nimport { IBoxProps } from '@semcore/flex-box';\nimport { IntergalacticD3Component } from './Plot';\n\n/** @deprecated */\nexport interface IHoverProps extends HoverProps, UnknownProperties {}\nexport type HoverProps = Context & {\n /** Field name from `data` array item for the XAxis */\n x?: string;\n /** Field name from `data` array item for the YAxis */\n y?: string;\n};\n\ntype HoverTooltip = (<X, Y>(\n props: {\n /** Field name from `data` array item for the XAxis */\n x?: X;\n /** Field name from `data` array item for the YAxis */\n y?: Y;\n children: (props: {\n /** Index in `data` array of the current item */\n xIndex: X extends string ? string : never;\n /** Index in `data` array of the current item */\n yIndex: Y extends string ? string : never;\n }) => { children: ReturnEl };\n } & Omit<IBoxProps, 'children'>,\n) => ReturnEl) &\n TooltipTypeBase;\n\ndeclare const HoverLine: IntergalacticD3Component<'g', HoverProps> & {\n Tooltip: HoverTooltip;\n};\n\ndeclare const HoverRect: IntergalacticD3Component<'g', HoverProps> & {\n Tooltip: HoverTooltip;\n};\nexport { HoverLine, HoverRect };\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"Plot.d.js","names":[],"sources":["../../../src/types/Plot.d.ts"],"sourcesContent":["import { BoxProps } from '@semcore/flex-box';\nimport { UnknownProperties, Intergalactic } from '@semcore/core';\nimport { Context } from './context';\n\n/** @deprecated */\nexport interface IPlotProps extends PlotProps, UnknownProperties {}\nexport type PlotProps = Context &\n BoxProps & {\n /** Width of the svg element\n * @default 0*/\n width?: number;\n /** Height of the svg element\n * @default 0*/\n height?: number;\n /** Human readable chart name (e.g \"Last market trends\") */\n label?: string;\n /**\n * Locale for displaying the days of a week and months, to be transferred to `Intl`\n * @default en\n * */\n locale?: NavigatorLanguage['language'];\n /** Optional prop to tune up alt text generating for charts */\n a11yAltTextConfig?: PlotSummarizerConfig;\n\n /** @deprecated */\n eventEmitter?: unknown;\n };\n\nexport type PlotSummarizerConfig = {\n /** Totally disable automatic data summarization */\n disable?: boolean;\n /** Disable automatic data summarization and use provided text */\n override?: string;\n /** Tuning up time series trends analyzing. Represents angle tangens of time series change of different strength */\n trendTangens?: {\n /** Angle tangens of time series that have meaningful trending change\n * @default 1/15\n */\n static?: number;\n /** Angle tangens of time series that have weak trending change\n * @default 1/10\n */\n weak?: number;\n /** Angle tangens of time series that have medium trending change\n * @default 1/5\n */\n medium?: number;\n /** Angle tangens of time series that have strong trending change\n * @default Infinity\n */\n strong?: number;\n };\n /** Tuning up time series local trends detection based on moving averages */\n movingAverage?: {\n /** Frame size of long moving average\n * @default Math.sqrt(data.length)\n */\n longSize?: number;\n /** Frame size of short moving average\n * @default Math.sqrt(data.length)/2\n */\n shortSize?: number;\n /** Absolute difference between values on moving averages crossing to\n * be handled as local trend change.\n * @default StandardDeviation/10\n */\n notableDiff?: number;\n };\n /** The way data to be interpreted as. By default is based on used used Plot elements and data structure.\n */\n dataType?: 'time-series' | 'points-cloud' | 'values-set';\n /** Grid size to split data of point clouds into clusters.\n */\n clustersGridSize?: number;\n /** Limits some output lists in chart alt text\n * @default 100\n * **/\n maxListSymbols?: number;\n /** Always add time to dates in chart alt text **/\n datesWithTime?: boolean;\n /** Described clusters count before text \"and X more\"\n * @default false\n * **/\n clustersLimit?: number;\n /** Described values count before text \"and X more\"\n * @default false\n * **/\n valuesLimit?: number;\n /** Described grouped value groups count before text \"and X more\"\n * @default false\n * **/\n groupsLimit?: number;\n /** Additional field for extra text description to the data\n * **/\n additionalFields?: string[];\n};\n\n/** @deprecated */\nexport type MapProps<Props, Ctx = {}, UCProps = {}> = Props & {\n children?:\n | ((props: Props & Ctx, handlers: UCProps) => Props | React.PropsWithChildren)\n | React.ReactNode;\n};\n\nexport type IntergalacticD3Component<\n BaseTag extends Intergalactic.InternalTypings.ComponentTag,\n Props,\n Context = {},\n> = (<Tag extends Intergalactic.InternalTypings.ComponentTag = BaseTag>(\n props: Intergalactic.InternalTypings.PropsRenderingResultComponentProps<Tag, Props, Context>,\n) => Intergalactic.InternalTypings.ComponentRenderingResults) &\n Intergalactic.InternalTypings.ComponentAdditive<BaseTag>;\n\ndeclare const Plot: IntergalacticD3Component<'svg', PlotProps, Context>;\nexport default Plot;\n"],"mappings":""}
1
+ {"version":3,"file":"Plot.d.js","names":[],"sources":["../../../src/types/Plot.d.ts"],"sourcesContent":["import { BoxProps } from '@semcore/flex-box';\nimport { UnknownProperties, Intergalactic } from '@semcore/core';\nimport { Context } from './context';\n\n/** @deprecated */\nexport interface IPlotProps extends PlotProps, UnknownProperties {}\nexport type PlotProps = Context &\n BoxProps & {\n /** Width of the svg element\n * @default 0*/\n width?: number;\n /** Height of the svg element\n * @default 0*/\n height?: number;\n /** Human readable chart name (e.g \"Last market trends\") */\n label?: string;\n /**\n * Locale for displaying the days of a week and months, to be transferred to `Intl`\n * @default en\n * */\n locale?: NavigatorLanguage['language'];\n /** Optional prop to tune up alt text generating for charts */\n a11yAltTextConfig?: PlotSummarizerConfig;\n\n /** @deprecated */\n eventEmitter?: unknown;\n };\n\nexport type PlotSummarizerConfig = {\n /** Totally disable automatic data summarization */\n disable?: boolean;\n /** Disable automatic data summarization and use provided text */\n override?: string;\n /** Tuning up time series trends analyzing. Represents angle tangens of time series change of different strength */\n trendTangens?: {\n /** Angle tangens of time series that have meaningful trending change\n * @default 1/15\n */\n static?: number;\n /** Angle tangens of time series that have weak trending change\n * @default 1/10\n */\n weak?: number;\n /** Angle tangens of time series that have medium trending change\n * @default 1/5\n */\n medium?: number;\n /** Angle tangens of time series that have strong trending change\n * @default Infinity\n */\n strong?: number;\n };\n /** Tuning up time series local trends detection based on moving averages */\n movingAverage?: {\n /** Frame size of long moving average\n * @default Math.sqrt(data.length)\n */\n longSize?: number;\n /** Frame size of short moving average\n * @default Math.sqrt(data.length)/2\n */\n shortSize?: number;\n /** Absolute difference between values on moving averages crossing to\n * be handled as local trend change.\n * @default StandardDeviation/10\n */\n notableDiff?: number;\n };\n /** The way data to be interpreted as. By default is based on used used Plot elements and data structure.\n */\n dataType?: 'time-series' | 'points-cloud' | 'values-set';\n /** Grid size to split data of point clouds into clusters.\n */\n clustersGridSize?: number;\n /** Limits some output lists in chart alt text\n * @default 100\n * **/\n maxListSymbols?: number;\n /** Always add time to dates in chart alt text **/\n datesWithTime?: boolean;\n /** Described clusters count before text \"and X more\"\n * @default false\n * **/\n clustersLimit?: number;\n /** Described values count before text \"and X more\"\n * @default false\n * **/\n valuesLimit?: number;\n /** Described grouped value groups count before text \"and X more\"\n * @default false\n * **/\n groupsLimit?: number;\n /** Additional field for extra text description to the data\n * **/\n additionalFields?: string[];\n};\n\n/** @deprecated */\nexport type MapProps<Props, Ctx = {}, UCProps = {}> = Props & {\n children?:\n | ((props: Props & Ctx, handlers: UCProps) => Props | React.PropsWithChildren)\n | React.ReactNode;\n};\n\nexport type IntergalacticD3Component<BaseTag extends Intergalactic.Tag, Props, Context = {}> = (<\n Tag extends Intergalactic.Tag = BaseTag,\n>(\n props: Intergalactic.InternalTypings.PropsRenderingResultComponentProps<Tag, Props, Context>,\n) => Intergalactic.InternalTypings.ComponentRenderingResults) &\n Intergalactic.InternalTypings.ComponentAdditive<BaseTag>;\n\ndeclare const Plot: IntergalacticD3Component<'svg', PlotProps, Context>;\nexport default Plot;\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.d.js","names":[],"sources":["../../../src/types/Tooltip.d.ts"],"sourcesContent":["import Popper, { PopperProps, PopperTriggerProps } from '@semcore/popper';\nimport { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';\nimport { Box, BoxProps } from '@semcore/flex-box';\nimport { Context } from './context';\nimport { IntergalacticD3Component } from './Plot';\n\n/** @deprecated */\nexport interface ITooltipChartProps extends TooltipChartProps, UnknownProperties {}\nexport type TooltipChartProps = PopperProps &\n PopperTriggerProps &\n Context & {\n /** Field name from `data` array item for the XAxis */\n x?: string;\n /** Field name from `data` array item for the YAxis */\n y?: string;\n };\n\n/** @deprecated */\nexport interface ITooltipChartContext extends TooltipChartContext, UnknownProperties {\n /** Index active value for Axis x */\n xIndex: number | null;\n /** Index active value for Axis y */\n yIndex: number | null;\n}\nexport type TooltipChartContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n};\n\nexport type TooltipTypeBase = {\n Trigger: typeof Popper.Trigger;\n Popper: typeof Popper.Popper;\n Title: typeof Box;\n Dot: IntergalacticD3Component<'div', BoxProps & { color?: string }, TooltipChartContext>;\n Footer: typeof Box;\n};\n\nexport type TooltipType<ChildrenRenderProps = {}, TooltipProps = {}> = (<\n Tag extends Intergalactic.InternalTypings.ComponentTag = typeof Box,\n>(\n props: Intergalactic.InternalTypings.PropsRenderingResultComponentProps<\n Tag,\n TooltipProps,\n ChildrenRenderProps & TooltipChartContext\n >,\n) => Intergalactic.InternalTypings.ComponentRenderingResults) &\n Intergalactic.InternalTypings.ComponentAdditive<Intergalactic.InternalTypings.ComponentTag> &\n TooltipTypeBase;\n\n/**\n * @deprecated Consider migration to better typed Bubble.Tooltip, HoverLine.Tooltip,\n * HoverRect.Tooltip, Donut.Tooltip, Radar.Tooltip,\n * ScatterPlot.Tooltip or Venn.Tooltip.\n *\n * Migration examples:\n * 1. `<Tooltip tag={HoverLine}>...</Tooltip>` => `<HoverLine.Tooltip>...</HoverLine.Tooltip>`\n * 2. `<Tooltip tag={HoverRect}>...</Tooltip>` => `<HoverRect.Tooltip>...</HoverRect.Tooltip>`\n * 3. `<Tooltip tag={Radar.Hover}>...</Tooltip>` => `<Radar.Tooltip>...</Radar.Tooltip>`\n * 4. `<Tooltip>...</Tooltip>` => `<Bubble.Tooltip>...</Bubble.Tooltip>`\n * 5. `<Tooltip>...</Tooltip>` => `<Donut.Tooltip>...</Donut.Tooltip>`\n * 6. `<Tooltip>...</Tooltip>` => `<ScatterPlot.Tooltip>...</ScatterPlot.Tooltip>`\n * 7. `<Tooltip>...</Tooltip>` => `<Venn.Tooltip>...</Venn.Tooltip>`\n */\ndeclare const Tooltip: TooltipType;\n\nexport default Tooltip;\n"],"mappings":""}
1
+ {"version":3,"file":"Tooltip.d.js","names":[],"sources":["../../../src/types/Tooltip.d.ts"],"sourcesContent":["import Popper, { PopperProps, PopperTriggerProps } from '@semcore/popper';\nimport { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';\nimport { Box, BoxProps } from '@semcore/flex-box';\nimport { Context } from './context';\nimport { IntergalacticD3Component } from './Plot';\n\n/** @deprecated */\nexport interface ITooltipChartProps extends TooltipChartProps, UnknownProperties {}\nexport type TooltipChartProps = PopperProps &\n PopperTriggerProps &\n Context & {\n /** Field name from `data` array item for the XAxis */\n x?: string;\n /** Field name from `data` array item for the YAxis */\n y?: string;\n };\n\n/** @deprecated */\nexport interface ITooltipChartContext extends TooltipChartContext, UnknownProperties {\n /** Index active value for Axis x */\n xIndex: number | null;\n /** Index active value for Axis y */\n yIndex: number | null;\n}\nexport type TooltipChartContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n};\n\nexport type TooltipTypeBase = {\n Trigger: typeof Popper.Trigger;\n Popper: typeof Popper.Popper;\n Title: typeof Box;\n Dot: IntergalacticD3Component<'div', BoxProps & { color?: string }, TooltipChartContext>;\n Footer: typeof Box;\n};\n\nexport type TooltipType<ChildrenRenderProps = {}, TooltipProps = {}> = (<\n Tag extends Intergalactic.Tag = typeof Box,\n>(\n props: Intergalactic.InternalTypings.PropsRenderingResultComponentProps<\n Tag,\n TooltipProps,\n ChildrenRenderProps & TooltipChartContext\n >,\n) => Intergalactic.InternalTypings.ComponentRenderingResults) &\n Intergalactic.InternalTypings.ComponentAdditive<Intergalactic.Tag> &\n TooltipTypeBase;\n\n/**\n * @deprecated Consider migration to better typed Bubble.Tooltip, HoverLine.Tooltip,\n * HoverRect.Tooltip, Donut.Tooltip, Radar.Tooltip,\n * ScatterPlot.Tooltip or Venn.Tooltip.\n *\n * Migration examples:\n * 1. `<Tooltip tag={HoverLine}>...</Tooltip>` => `<HoverLine.Tooltip>...</HoverLine.Tooltip>`\n * 2. `<Tooltip tag={HoverRect}>...</Tooltip>` => `<HoverRect.Tooltip>...</HoverRect.Tooltip>`\n * 3. `<Tooltip tag={Radar.Hover}>...</Tooltip>` => `<Radar.Tooltip>...</Radar.Tooltip>`\n * 4. `<Tooltip>...</Tooltip>` => `<Bubble.Tooltip>...</Bubble.Tooltip>`\n * 5. `<Tooltip>...</Tooltip>` => `<Donut.Tooltip>...</Donut.Tooltip>`\n * 6. `<Tooltip>...</Tooltip>` => `<ScatterPlot.Tooltip>...</ScatterPlot.Tooltip>`\n * 7. `<Tooltip>...</Tooltip>` => `<Venn.Tooltip>...</Venn.Tooltip>`\n */\ndeclare const Tooltip: TooltipType;\n\nexport default Tooltip;\n"],"mappings":""}
@@ -25,7 +25,10 @@ export * from './StackedArea';
25
25
 
26
26
  /** It becomes resolvable after building and moving file to lib dir */
27
27
 
28
+ // @ts-ignore
28
29
  export { default as RadialTree } from './RadialTree';
30
+
31
+ // @ts-ignore
29
32
  export * from './RadialTree';
30
33
  export { default as Radar } from './Radar';
31
34
  export * from './Radar';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.js","names":["default","Plot","ResponsiveContainer","Line","Bar","HorizontalBar","GroupBar","StackBar","Area","StackedArea","RadialTree","Radar","Donut","Tooltip","ScatterPlot","Bubble","ReferenceLine","Venn"],"sources":["../../../src/types/index.d.ts"],"sourcesContent":["// Utils\nexport declare function minMax(data: any, key: string | number): any;\n\n// Color\nexport declare const colors: { [key: string]: string };\n\nexport { default as Plot } from './Plot';\nexport * from './Plot';\n\nexport * from './Axis';\nexport * from './Hover';\n\nexport { default as ResponsiveContainer } from './ResponsiveContainer';\nexport * from './ResponsiveContainer';\n\nexport { default as Line } from './Line';\nexport * from './Line';\n\nexport { default as Bar } from './Bar';\nexport * from './Bar';\n\nexport { default as HorizontalBar } from './HorizontalBar';\nexport * from './HorizontalBar';\n\nexport { default as GroupBar } from './GroupBar';\nexport * from './GroupBar';\n\nexport { default as StackBar } from './StackBar';\nexport * from './StackBar';\n\nexport { default as Area } from './Area';\nexport * from './Area';\n\nexport { default as StackedArea } from './StackedArea';\nexport * from './StackedArea';\n\n/** It becomes resolvable after building and moving file to lib dir */\n\nexport { default as RadialTree } from './RadialTree';\n\nexport * from './RadialTree';\n\nexport { default as Radar } from './Radar';\nexport * from './Radar';\n\nexport { default as Donut } from './Donut';\nexport * from './Donut';\n\nexport { default as Tooltip } from './Tooltip';\nexport * from './Tooltip';\n\nexport { default as ScatterPlot } from './ScatterPlot';\nexport * from './ScatterPlot';\n\nexport { default as Bubble } from './Bubble';\nexport * from './Bubble';\n\nexport { default as ReferenceLine } from './ReferenceLine';\nexport * from './ReferenceLine';\n\nexport { default as Venn } from './Venn';\nexport * from './Venn';\n"],"mappings":"AAAA;;AAGA;;AAGA,SAASA,OAAO,IAAIC,IAAI,QAAQ,QAAQ;AACxC,cAAc,QAAQ;AAEtB,cAAc,QAAQ;AACtB,cAAc,SAAS;AAEvB,SAASD,OAAO,IAAIE,mBAAmB,QAAQ,uBAAuB;AACtE,cAAc,uBAAuB;AAErC,SAASF,OAAO,IAAIG,IAAI,QAAQ,QAAQ;AACxC,cAAc,QAAQ;AAEtB,SAASH,OAAO,IAAII,GAAG,QAAQ,OAAO;AACtC,cAAc,OAAO;AAErB,SAASJ,OAAO,IAAIK,aAAa,QAAQ,iBAAiB;AAC1D,cAAc,iBAAiB;AAE/B,SAASL,OAAO,IAAIM,QAAQ,QAAQ,YAAY;AAChD,cAAc,YAAY;AAE1B,SAASN,OAAO,IAAIO,QAAQ,QAAQ,YAAY;AAChD,cAAc,YAAY;AAE1B,SAASP,OAAO,IAAIQ,IAAI,QAAQ,QAAQ;AACxC,cAAc,QAAQ;AAEtB,SAASR,OAAO,IAAIS,WAAW,QAAQ,eAAe;AACtD,cAAc,eAAe;;AAE7B;;AAEA,SAAST,OAAO,IAAIU,UAAU,QAAQ,cAAc;AAEpD,cAAc,cAAc;AAE5B,SAASV,OAAO,IAAIW,KAAK,QAAQ,SAAS;AAC1C,cAAc,SAAS;AAEvB,SAASX,OAAO,IAAIY,KAAK,QAAQ,SAAS;AAC1C,cAAc,SAAS;AAEvB,SAASZ,OAAO,IAAIa,OAAO,QAAQ,WAAW;AAC9C,cAAc,WAAW;AAEzB,SAASb,OAAO,IAAIc,WAAW,QAAQ,eAAe;AACtD,cAAc,eAAe;AAE7B,SAASd,OAAO,IAAIe,MAAM,QAAQ,UAAU;AAC5C,cAAc,UAAU;AAExB,SAASf,OAAO,IAAIgB,aAAa,QAAQ,iBAAiB;AAC1D,cAAc,iBAAiB;AAE/B,SAAShB,OAAO,IAAIiB,IAAI,QAAQ,QAAQ;AACxC,cAAc,QAAQ"}
1
+ {"version":3,"file":"index.d.js","names":["default","Plot","ResponsiveContainer","Line","Bar","HorizontalBar","GroupBar","StackBar","Area","StackedArea","RadialTree","Radar","Donut","Tooltip","ScatterPlot","Bubble","ReferenceLine","Venn"],"sources":["../../../src/types/index.d.ts"],"sourcesContent":["// Utils\nexport declare function minMax(data: any, key: string | number): any;\n\n// Color\nexport declare const colors: { [key: string]: string };\n\nexport { default as Plot } from './Plot';\nexport * from './Plot';\n\nexport * from './Axis';\nexport * from './Hover';\n\nexport { default as ResponsiveContainer } from './ResponsiveContainer';\nexport * from './ResponsiveContainer';\n\nexport { default as Line } from './Line';\nexport * from './Line';\n\nexport { default as Bar } from './Bar';\nexport * from './Bar';\n\nexport { default as HorizontalBar } from './HorizontalBar';\nexport * from './HorizontalBar';\n\nexport { default as GroupBar } from './GroupBar';\nexport * from './GroupBar';\n\nexport { default as StackBar } from './StackBar';\nexport * from './StackBar';\n\nexport { default as Area } from './Area';\nexport * from './Area';\n\nexport { default as StackedArea } from './StackedArea';\nexport * from './StackedArea';\n\n/** It becomes resolvable after building and moving file to lib dir */\n\n// @ts-ignore\nexport { default as RadialTree } from './RadialTree';\n\n// @ts-ignore\nexport * from './RadialTree';\n\nexport { default as Radar } from './Radar';\nexport * from './Radar';\n\nexport { default as Donut } from './Donut';\nexport * from './Donut';\n\nexport { default as Tooltip } from './Tooltip';\nexport * from './Tooltip';\n\nexport { default as ScatterPlot } from './ScatterPlot';\nexport * from './ScatterPlot';\n\nexport { default as Bubble } from './Bubble';\nexport * from './Bubble';\n\nexport { default as ReferenceLine } from './ReferenceLine';\nexport * from './ReferenceLine';\n\nexport { default as Venn } from './Venn';\nexport * from './Venn';\n"],"mappings":"AAAA;;AAGA;;AAGA,SAASA,OAAO,IAAIC,IAAI,QAAQ,QAAQ;AACxC,cAAc,QAAQ;AAEtB,cAAc,QAAQ;AACtB,cAAc,SAAS;AAEvB,SAASD,OAAO,IAAIE,mBAAmB,QAAQ,uBAAuB;AACtE,cAAc,uBAAuB;AAErC,SAASF,OAAO,IAAIG,IAAI,QAAQ,QAAQ;AACxC,cAAc,QAAQ;AAEtB,SAASH,OAAO,IAAII,GAAG,QAAQ,OAAO;AACtC,cAAc,OAAO;AAErB,SAASJ,OAAO,IAAIK,aAAa,QAAQ,iBAAiB;AAC1D,cAAc,iBAAiB;AAE/B,SAASL,OAAO,IAAIM,QAAQ,QAAQ,YAAY;AAChD,cAAc,YAAY;AAE1B,SAASN,OAAO,IAAIO,QAAQ,QAAQ,YAAY;AAChD,cAAc,YAAY;AAE1B,SAASP,OAAO,IAAIQ,IAAI,QAAQ,QAAQ;AACxC,cAAc,QAAQ;AAEtB,SAASR,OAAO,IAAIS,WAAW,QAAQ,eAAe;AACtD,cAAc,eAAe;;AAE7B;;AAEA;AACA,SAAST,OAAO,IAAIU,UAAU,QAAQ,cAAc;;AAEpD;AACA,cAAc,cAAc;AAE5B,SAASV,OAAO,IAAIW,KAAK,QAAQ,SAAS;AAC1C,cAAc,SAAS;AAEvB,SAASX,OAAO,IAAIY,KAAK,QAAQ,SAAS;AAC1C,cAAc,SAAS;AAEvB,SAASZ,OAAO,IAAIa,OAAO,QAAQ,WAAW;AAC9C,cAAc,WAAW;AAEzB,SAASb,OAAO,IAAIc,WAAW,QAAQ,eAAe;AACtD,cAAc,eAAe;AAE7B,SAASd,OAAO,IAAIe,MAAM,QAAQ,UAAU;AAC5C,cAAc,UAAU;AAExB,SAASf,OAAO,IAAIgB,aAAa,QAAQ,iBAAiB;AAC1D,cAAc,iBAAiB;AAE/B,SAAShB,OAAO,IAAIiB,IAAI,QAAQ,QAAQ;AACxC,cAAc,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["extent","bisector","scaleQuantize","CONSTANT","VIRTUAL_ELEMENT","Symbol","eventToPoint","event","svgRoot","node","currentTarget","target","rect","getBoundingClientRect","clientX","left","clientLeft","clientY","top","clientTop","invert","scale","value","range","domain","paddingOuter","step","slice","reverse","definedNullData","x","y","plot","definedData","undefined","scaleOfBandwidth","bandwidth","minMax","data","key","d","getNullData","defined","name","reduce","acc","i","push","_defineProperty","prev","next","defNext","find","_objectSpread","length","defPrev","getIndexFromData","bisect","center","index","findIndex","console","warn","roundedPath","w","h","r","tl","arguments","tr","bl","br","result","concat","getBandwidth","Math","abs","memoize","func","results","_len","args","Array","_key","argsKey","join","apply","measureText","text","fontSize","span","document","createElement","style","_iterator","_createForOfIteratorHelper","split","_step","s","n","done","line","append","createTextNode","err","e","f","display","body","textWidth","offsetWidth","textHeight","offsetHeight","remove","max","idCounter","uniqueId","prefix"],"sources":["../../src/utils.ts"],"sourcesContent":["import { extent, bisector, Numeric } from 'd3-array';\nimport {\n scaleQuantize,\n ScaleIdentity,\n ScaleTime,\n ScaleContinuousNumeric,\n ScaleBand,\n ScalePoint,\n NumberValue,\n} from 'd3-scale';\nimport React from 'react';\n\nconst CONSTANT = {\n VIRTUAL_ELEMENT: Symbol('VIRTUAL_ELEMENT'),\n} as const;\n\nexport { CONSTANT };\n\nexport const eventToPoint = (event: React.MouseEvent<HTMLElement>, svgRoot: SVGElement) => {\n const node = (event.currentTarget || event.target) as HTMLElement;\n const rect = svgRoot.getBoundingClientRect();\n return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];\n};\n\ntype InvertableScale =\n | ScaleIdentity\n | ScaleBand<unknown>\n | ScaleTime<unknown, unknown>\n | ScaleContinuousNumeric<unknown, unknown>;\nexport const invert = <Scale extends InvertableScale = InvertableScale>(\n scale: Scale,\n value: number,\n) => {\n if ('invert' in scale && scale.invert) return scale.invert(value);\n\n const range = scale.range() as [number, number];\n const domain = scale.domain();\n if ('paddingOuter' in scale) {\n range[0] += scale.paddingOuter() * scale.step();\n range[1] -= scale.paddingOuter() * scale.step();\n }\n\n return scaleQuantize()\n .domain((range[0] <= range[1] ? range : range.slice().reverse()) as NumberValue[])\n .range((range[0] <= range[1] ? domain : domain.slice().reverse()) as number[])(value);\n};\n\nexport const definedNullData = (x: number, y: number) => (plot: { [xOrY: number]: unknown }) =>\n plot[x] !== null && plot[y] !== null;\n\nexport const definedData = (x: number, y: number) => (plot: { [xOrY: number]: unknown }) =>\n plot[x] !== null && plot[x] !== undefined && plot[y] !== null && plot[y] !== undefined;\n\nexport const scaleOfBandwidth = <Scale extends ScaleBand<{}>>(scale: Scale, value: number) =>\n scale.bandwidth ? scale(value)! + scale.bandwidth() / 2 : scale(value);\n\nexport const minMax = <\n Key extends string = string,\n Data extends { [key: string]: Numeric | null | undefined }[] = {\n [key: string]: Numeric | null | undefined;\n }[],\n>(\n data: Data,\n key: Key,\n): [min: Data[0][Key], max: Data[0][Key]] => {\n if (typeof key === 'string') {\n return extent(data, (d) => d[key]) as any;\n }\n return extent(data, key) as any;\n};\n\nexport const getNullData = <\n Name extends string = string,\n Data extends { [name in Name]?: unknown | null } = {},\n>(\n data: Data[],\n defined: (data: Data) => boolean,\n name: Name,\n) =>\n data.reduce((acc, d, i, data) => {\n if (defined(d)) {\n acc.push({\n [name]: null,\n } as Data);\n } else {\n const prev = data[i - 1];\n const next = data[i + 1];\n\n if (i === 0) {\n const defNext = data.find(defined);\n acc.push({\n ...d,\n [name]: defNext ? defNext[name] : null,\n });\n }\n\n // prev\n if (prev && defined(prev)) {\n acc.push(prev);\n }\n\n // next\n if (next && defined(next)) {\n acc.push(next);\n }\n\n if (data.length - 1 === i) {\n const defPrev = data.slice().reverse().find(defined);\n acc.push({\n ...d,\n [name]: defPrev ? defPrev[name] : null,\n });\n }\n }\n return acc;\n }, [] as Data[]);\n\ntype IndexFromDataScale =\n | ScaleIdentity\n | ScaleTime<unknown, unknown>\n | ScaleContinuousNumeric<unknown, unknown>\n | ScaleBand<{}>\n | ScalePoint<{}>;\nexport const getIndexFromData = <\n Key extends string,\n Data extends {\n [key in Key]: number;\n } = { [key in Key]: number },\n Scale extends IndexFromDataScale = IndexFromDataScale,\n>(\n data: Data[],\n scale: Scale,\n key: Key,\n value: number,\n) => {\n // detect line chart\n if ('invert' in scale && typeof scale.invert === 'function') {\n const bisect = bisector((d: { [key: string]: number }) => d[key]).center;\n return bisect(data, value);\n }\n // detect bar chart\n else if ('step' in scale && typeof scale.step !== 'undefined') {\n // console.log({ key, scale, value });\n const index = data.findIndex((d) => d[key] === value);\n return index >= 0 ? index : null;\n } else {\n console.warn('[d3-chart/utils/getIndexFromData] encountered incompatible scale type');\n return null;\n }\n};\n\nexport const roundedPath = (\n x: number,\n y: number,\n w: number,\n h: number,\n r: number,\n tl = false,\n tr = false,\n bl = false,\n br = false,\n) => {\n let result = `M${x + r},${y}`;\n result += `h${w - 2 * r}`;\n if (tr) {\n result += `a${r},${r} 0 0 1 ${r},${r}`;\n } else {\n result += `h${r}`;\n result += `v${r}`;\n }\n result += `v${h - 2 * r}`;\n if (br) {\n result += `a${r},${r} 0 0 1 ${-r},${r}`;\n } else {\n result += `v${r}`;\n result += `h${-r}`;\n }\n result += `h${2 * r - w}`;\n if (bl) {\n result += `a${r},${r} 0 0 1 ${-r},${-r}`;\n } else {\n result += `h${-r}`;\n result += `v${-r}`;\n }\n result += `v${2 * r - h}`;\n if (tl) {\n result += `a${r},${r} 0 0 1 ${r},${-r}`;\n } else {\n result += `v${-r}`;\n result += `h${r}`;\n }\n result += 'z';\n return result;\n};\n\nexport const getBandwidth = <Scale extends ScaleBand<{}>>(scale: Scale) => {\n if ('bandwidth' in scale) {\n return scale.bandwidth();\n }\n\n const range = scale.range();\n const domain = scale.domain();\n return Math.abs(range[range.length - 1] - range[0]) / domain.length;\n};\n\nexport const memoize = <Func extends (...args: any[]) => any>(func: Func): Func => {\n const results: { [cacheKey: string]: any } = {};\n return ((...args: any[]) => {\n const argsKey = args.join(',');\n if (!results[argsKey]) {\n results[argsKey] = func(...args);\n }\n return results[argsKey];\n }) as Func;\n};\n\nexport const measureText = memoize((text: string, fontSize?: number) => {\n if (!text) return 0;\n\n const span = document.createElement('span');\n if (fontSize) {\n span.style.fontSize = `${fontSize}px`;\n }\n for (const line of text.split('\\n')) {\n span.append(document.createTextNode(line));\n span.append(document.createElement('br'));\n }\n span.style.display = 'inline-block';\n document.body.append(span);\n const textWidth = span.offsetWidth;\n const textHeight = span.offsetHeight;\n span.remove();\n return Math.max(textWidth, textHeight);\n});\n\nlet idCounter = 0;\nexport const uniqueId = (prefix = 'id-') => `${prefix}${idCounter++}`;\n"],"mappings":";;;AAAA,SAASA,MAAM,EAAEC,QAAQ,QAAiB,UAAU;AACpD,SACEC,aAAa,QAOR,UAAU;AAGjB,IAAMC,QAAQ,GAAG;EACfC,eAAe,EAAEC,MAAM,CAAC,iBAAiB;AAC3C,CAAU;AAEV,SAASF,QAAQ;AAEjB,OAAO,IAAMG,YAAY,GAAG,SAAfA,YAAYA,CAAIC,KAAoC,EAAEC,OAAmB,EAAK;EACzF,IAAMC,IAAI,GAAIF,KAAK,CAACG,aAAa,IAAIH,KAAK,CAACI,MAAsB;EACjE,IAAMC,IAAI,GAAGJ,OAAO,CAACK,qBAAqB,EAAE;EAC5C,OAAO,CAACN,KAAK,CAACO,OAAO,GAAGF,IAAI,CAACG,IAAI,GAAGN,IAAI,CAACO,UAAU,EAAET,KAAK,CAACU,OAAO,GAAGL,IAAI,CAACM,GAAG,GAAGT,IAAI,CAACU,SAAS,CAAC;AACjG,CAAC;AAOD,OAAO,IAAMC,MAAM,GAAG,SAATA,MAAMA,CACjBC,KAAY,EACZC,KAAa,EACV;EACH,IAAI,QAAQ,IAAID,KAAK,IAAIA,KAAK,CAACD,MAAM,EAAE,OAAOC,KAAK,CAACD,MAAM,CAACE,KAAK,CAAC;EAEjE,IAAMC,KAAK,GAAGF,KAAK,CAACE,KAAK,EAAsB;EAC/C,IAAMC,MAAM,GAAGH,KAAK,CAACG,MAAM,EAAE;EAC7B,IAAI,cAAc,IAAIH,KAAK,EAAE;IAC3BE,KAAK,CAAC,CAAC,CAAC,IAAIF,KAAK,CAACI,YAAY,EAAE,GAAGJ,K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AK,CAACc,OAAO,GAAG,cAAc;EACnChB,QAAQ,CAACiB,IAAI,CAACN,MAAM,CAACZ,IAAI,CAAC;EAC1B,IAAMmB,SAAS,GAAGnB,IAAI,CAACoB,WAAW;EAClC,IAAMC,UAAU,GAAGrB,IAAI,CAACsB,YAAY;EACpCtB,IAAI,CAACuB,MAAM,EAAE;EACb,OAAOtC,IAAI,CAACuC,GAAG,CAACL,SAAS,EAAEE,UAAU,CAAC;AACxC,CAAC,CAAC;AAEF,IAAII,SAAS,GAAG,CAAC;AACjB,OAAO,IAAMC,QAAQ,GAAG,SAAXA,QAAQA,CAAA;EAAA,IAAIC,MAAM,GAAAjD,SAAA,CAAAd,MAAA,QAAAc,SAAA,QAAAlC,SAAA,GAAAkC,SAAA,MAAG,KAAK;EAAA,UAAAK,MAAA,CAAQ4C,MAAM,EAAA5C,MAAA,CAAG0C,SAAS,EAAE;AAAA,CAAE"}
1
+ {"version":3,"file":"utils.js","names":["extent","bisector","scaleQuantize","CONSTANT","VIRTUAL_ELEMENT","Symbol","eventToPoint","event","svgRoot","node","currentTarget","target","rect","getBoundingClientRect","clientX","left","clientLeft","clientY","top","clientTop","invert","scale","value","range","domain","paddingOuter","step","slice","reverse","definedNullData","x","y","plot","definedData","undefined","scaleOfBandwidth","bandwidth","minMax","data","key","d","getNullData","defined","name","reduce","acc","i","push","_defineProperty","prev","next","defNext","find","_objectSpread","length","defPrev","getIndexFromData","bisect","center","index","findIndex","console","warn","roundedPath","w","h","r","tl","arguments","tr","bl","br","result","concat","getBandwidth","Math","abs","memoize","func","results","_len","args","Array","_key","argsKey","join","apply","measureText","text","fontSize","span","document","createElement","style","_iterator","_createForOfIteratorHelper","split","_step","s","n","done","line","append","createTextNode","err","e","f","display","body","textWidth","offsetWidth","textHeight","offsetHeight","remove","max","idCounter","uniqueId","prefix"],"sources":["../../src/utils.ts"],"sourcesContent":["import { extent, bisector, Numeric } from 'd3-array';\nimport {\n scaleQuantize,\n ScaleIdentity,\n ScaleTime,\n ScaleContinuousNumeric,\n ScaleBand,\n ScalePoint,\n NumberValue,\n} from 'd3-scale';\nimport React from 'react';\n\nconst CONSTANT = {\n VIRTUAL_ELEMENT: Symbol('VIRTUAL_ELEMENT'),\n} as const;\n\nexport { CONSTANT };\n\nexport const eventToPoint = (event: React.MouseEvent<HTMLElement>, svgRoot: SVGElement) => {\n const node = (event.currentTarget || event.target) as HTMLElement;\n const rect = svgRoot.getBoundingClientRect();\n return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];\n};\n\ntype InvertableScale =\n | ScaleIdentity\n | ScaleBand<{}>\n | ScaleTime<unknown, unknown>\n | ScaleContinuousNumeric<unknown, unknown>;\nexport const invert = <Scale extends InvertableScale = InvertableScale>(\n scale: Scale,\n value: number,\n) => {\n if ('invert' in scale && scale.invert) return scale.invert(value);\n\n const range = scale.range() as [number, number];\n const domain = scale.domain();\n if ('paddingOuter' in scale) {\n range[0] += scale.paddingOuter() * scale.step();\n range[1] -= scale.paddingOuter() * scale.step();\n }\n\n return scaleQuantize()\n .domain((range[0] <= range[1] ? range : range.slice().reverse()) as NumberValue[])\n .range((range[0] <= range[1] ? domain : domain.slice().reverse()) as number[])(value);\n};\n\nexport const definedNullData = (x: number, y: number) => (plot: { [xOrY: number]: unknown }) =>\n plot[x] !== null && plot[y] !== null;\n\nexport const definedData = (x: number, y: number) => (plot: { [xOrY: number]: unknown }) =>\n plot[x] !== null && plot[x] !== undefined && plot[y] !== null && plot[y] !== undefined;\n\nexport const scaleOfBandwidth = <Scale extends ScaleBand<{}>>(scale: Scale, value: number) =>\n scale.bandwidth ? scale(value)! + scale.bandwidth() / 2 : scale(value);\n\nexport const minMax = <\n Key extends string = string,\n Data extends { [key: string]: Numeric | null | undefined }[] = {\n [key: string]: Numeric | null | undefined;\n }[],\n>(\n data: Data,\n key: Key,\n): [min: Data[0][Key], max: Data[0][Key]] => {\n if (typeof key === 'string') {\n return extent(data, (d) => d[key]) as any;\n }\n return extent(data, key) as any;\n};\n\nexport const getNullData = <\n Name extends string = string,\n Data extends { [name in Name]?: unknown | null } = {},\n>(\n data: Data[],\n defined: (data: Data) => boolean,\n name: Name,\n) =>\n data.reduce((acc, d, i, data) => {\n if (defined(d)) {\n acc.push({\n [name]: null,\n } as Data);\n } else {\n const prev = data[i - 1];\n const next = data[i + 1];\n\n if (i === 0) {\n const defNext = data.find(defined);\n acc.push({\n ...d,\n [name]: defNext ? defNext[name] : null,\n });\n }\n\n // prev\n if (prev && defined(prev)) {\n acc.push(prev);\n }\n\n // next\n if (next && defined(next)) {\n acc.push(next);\n }\n\n if (data.length - 1 === i) {\n const defPrev = data.slice().reverse().find(defined);\n acc.push({\n ...d,\n [name]: defPrev ? defPrev[name] : null,\n });\n }\n }\n return acc;\n }, [] as Data[]);\n\ntype IndexFromDataScale =\n | ScaleIdentity\n | ScaleTime<unknown, unknown>\n | ScaleContinuousNumeric<unknown, unknown>\n | ScaleBand<{}>\n | ScalePoint<{}>;\nexport const getIndexFromData = <\n Key extends string,\n Data extends {\n [key in Key]: number;\n } = { [key in Key]: number },\n Scale extends IndexFromDataScale = IndexFromDataScale,\n>(\n data: Data[],\n scale: Scale,\n key: Key,\n value: number,\n) => {\n // detect line chart\n if ('invert' in scale && typeof scale.invert === 'function') {\n const bisect = bisector((d: { [key: string]: number }) => d[key]).center;\n return bisect(data, value);\n }\n // detect bar chart\n else if ('step' in scale && typeof scale.step !== 'undefined') {\n // console.log({ key, scale, value });\n const index = data.findIndex((d) => d[key] === value);\n return index >= 0 ? index : null;\n } else {\n console.warn('[d3-chart/utils/getIndexFromData] encountered incompatible scale type');\n return null;\n }\n};\n\nexport const roundedPath = (\n x: number,\n y: number,\n w: number,\n h: number,\n r: number,\n tl = false,\n tr = false,\n bl = false,\n br = false,\n) => {\n let result = `M${x + r},${y}`;\n result += `h${w - 2 * r}`;\n if (tr) {\n result += `a${r},${r} 0 0 1 ${r},${r}`;\n } else {\n result += `h${r}`;\n result += `v${r}`;\n }\n result += `v${h - 2 * r}`;\n if (br) {\n result += `a${r},${r} 0 0 1 ${-r},${r}`;\n } else {\n result += `v${r}`;\n result += `h${-r}`;\n }\n result += `h${2 * r - w}`;\n if (bl) {\n result += `a${r},${r} 0 0 1 ${-r},${-r}`;\n } else {\n result += `h${-r}`;\n result += `v${-r}`;\n }\n result += `v${2 * r - h}`;\n if (tl) {\n result += `a${r},${r} 0 0 1 ${r},${-r}`;\n } else {\n result += `v${-r}`;\n result += `h${r}`;\n }\n result += 'z';\n return result;\n};\n\nexport const getBandwidth = <Scale extends ScaleBand<{}>>(scale: Scale) => {\n if ('bandwidth' in scale) {\n return scale.bandwidth();\n }\n\n const range = (scale as any).range();\n const domain = (scale as any).domain();\n return Math.abs(range[range.length - 1] - range[0]) / domain.length;\n};\n\nexport const memoize = <Func extends (...args: any[]) => any>(func: Func): Func => {\n const results: { [cacheKey: string]: any } = {};\n return ((...args: any[]) => {\n const argsKey = args.join(',');\n if (!results[argsKey]) {\n results[argsKey] = func(...args);\n }\n return results[argsKey];\n }) as Func;\n};\n\nexport const measureText = memoize((text: string, fontSize?: number) => {\n if (!text) return 0;\n\n const span = document.createElement('span');\n if (fontSize) {\n span.style.fontSize = `${fontSize}px`;\n }\n for (const line of text.split('\\n')) {\n span.append(document.createTextNode(line));\n span.append(document.createElement('br'));\n }\n span.style.display = 'inline-block';\n document.body.append(span);\n const textWidth = span.offsetWidth;\n const textHeight = span.offsetHeight;\n span.remove();\n return Math.max(textWidth, textHeight);\n});\n\nlet idCounter = 0;\nexport const uniqueId = (prefix = 'id-') => `${prefix}${idCounter++}`;\n"],"mappings":";;;AAAA,SAASA,MAAM,EAAEC,QAAQ,QAAiB,UAAU;AACpD,SACEC,aAAa,QAOR,UAAU;AAGjB,IAAMC,QAAQ,GAAG;EACfC,eAAe,EAAEC,MAAM,CAAC,iBAAiB;AAC3C,CAAU;AAEV,SAASF,QAAQ;AAEjB,OAAO,IAAMG,YAAY,GAAG,SAAfA,YAAYA,CAAIC,KAAoC,EA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M,EAAA5C,MAAA,CAAG0C,SAAS,EAAE;AAAA,CAAE"}
@@ -35,11 +35,7 @@ export type BubbleContext = {
35
35
  index: number;
36
36
  };
37
37
 
38
- declare const Bubble: IntergalacticD3Component<
39
- Intergalactic.InternalTypings.ComponentTag,
40
- BubbleProps,
41
- BubbleContext
42
- > & {
38
+ declare const Bubble: IntergalacticD3Component<Intergalactic.Tag, BubbleProps, BubbleContext> & {
43
39
  Tooltip: TooltipType<
44
40
  BubbleProps & {
45
41
  /**
@@ -26,7 +26,7 @@ type HoverTooltip = (<X, Y>(
26
26
  /** Index in `data` array of the current item */
27
27
  yIndex: Y extends string ? string : never;
28
28
  }) => { children: ReturnEl };
29
- } & IBoxProps,
29
+ } & Omit<IBoxProps, 'children'>,
30
30
  ) => ReturnEl) &
31
31
  TooltipTypeBase;
32
32
 
@@ -102,11 +102,9 @@ export type MapProps<Props, Ctx = {}, UCProps = {}> = Props & {
102
102
  | React.ReactNode;
103
103
  };
104
104
 
105
- export type IntergalacticD3Component<
106
- BaseTag extends Intergalactic.InternalTypings.ComponentTag,
107
- Props,
108
- Context = {},
109
- > = (<Tag extends Intergalactic.InternalTypings.ComponentTag = BaseTag>(
105
+ export type IntergalacticD3Component<BaseTag extends Intergalactic.Tag, Props, Context = {}> = (<
106
+ Tag extends Intergalactic.Tag = BaseTag,
107
+ >(
110
108
  props: Intergalactic.InternalTypings.PropsRenderingResultComponentProps<Tag, Props, Context>,
111
109
  ) => Intergalactic.InternalTypings.ComponentRenderingResults) &
112
110
  Intergalactic.InternalTypings.ComponentAdditive<BaseTag>;