@communitiesuk/svelte-component-library 0.1.17

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 (217) hide show
  1. package/README.md +188 -0
  2. package/dist/assets/css/govuk-frontend.min.css +2 -0
  3. package/dist/assets/css/govuk-frontend.min.css.map +1 -0
  4. package/dist/assets/fonts/bold-affa96571d-v2.woff +0 -0
  5. package/dist/assets/fonts/bold-b542beb274-v2.woff2 +0 -0
  6. package/dist/assets/fonts/light-94a07e06a1-v2.woff2 +0 -0
  7. package/dist/assets/fonts/light-f591b13f7d-v2.woff +0 -0
  8. package/dist/assets/govuk_publishing_components/images/icon-autocomplete-search-suggestion.svg +4 -0
  9. package/dist/assets/govuk_publishing_components/images/icon-close.svg +1 -0
  10. package/dist/assets/images/favicon.ico +0 -0
  11. package/dist/assets/images/favicon.svg +1 -0
  12. package/dist/assets/images/govuk-crest-2x.png +0 -0
  13. package/dist/assets/images/govuk-crest.png +0 -0
  14. package/dist/assets/images/govuk-crest.svg +1 -0
  15. package/dist/assets/images/govuk-icon-180.png +0 -0
  16. package/dist/assets/images/govuk-icon-192.png +0 -0
  17. package/dist/assets/images/govuk-icon-512.png +0 -0
  18. package/dist/assets/images/govuk-icon-mask.svg +1 -0
  19. package/dist/assets/images/govuk-opengraph-image.png +0 -0
  20. package/dist/assets/images/homepage-illustration.svg +1 -0
  21. package/dist/assets/images/homepage.svg +44 -0
  22. package/dist/assets/images/masthead-illustration.svg +123 -0
  23. package/dist/assets/images/oflog_crest_black.png +0 -0
  24. package/dist/assets/images/oflog_crest_white.png +0 -0
  25. package/dist/assets/images/undraw_approved-wireframe_odf4.svg +1 -0
  26. package/dist/assets/images/undraw_collaborators_rgw4.svg +1 -0
  27. package/dist/assets/images/undraw_content-creator_vuqg.svg +1 -0
  28. package/dist/assets/images/undraw_online-media_opxh.svg +1 -0
  29. package/dist/assets/images/undraw_pull-request_zlsu.svg +1 -0
  30. package/dist/assets/images/undraw_reviewed-docs_g0cg.svg +1 -0
  31. package/dist/components/FilterPanel/codeBlocks.d.ts +3 -0
  32. package/dist/components/FilterPanel/codeBlocks.js +418 -0
  33. package/dist/components/content/InsetText.svelte +21 -0
  34. package/dist/components/content/InsetText.svelte.d.ts +7 -0
  35. package/dist/components/content/WarningText.svelte +27 -0
  36. package/dist/components/content/WarningText.svelte.d.ts +8 -0
  37. package/dist/components/data-vis/axis/Axis.svelte +51 -0
  38. package/dist/components/data-vis/axis/Axis.svelte.d.ts +33 -0
  39. package/dist/components/data-vis/axis/Ticks.svelte +113 -0
  40. package/dist/components/data-vis/axis/Ticks.svelte.d.ts +33 -0
  41. package/dist/components/data-vis/line-chart/Line.svelte +150 -0
  42. package/dist/components/data-vis/line-chart/Line.svelte.d.ts +85 -0
  43. package/dist/components/data-vis/line-chart/LineChart.svelte +249 -0
  44. package/dist/components/data-vis/line-chart/LineChart.svelte.d.ts +73 -0
  45. package/dist/components/data-vis/line-chart/Lines.svelte +138 -0
  46. package/dist/components/data-vis/line-chart/Lines.svelte.d.ts +57 -0
  47. package/dist/components/data-vis/line-chart/Marker.svelte +61 -0
  48. package/dist/components/data-vis/line-chart/Marker.svelte.d.ts +37 -0
  49. package/dist/components/data-vis/line-chart/SeriesLabel.svelte +67 -0
  50. package/dist/components/data-vis/line-chart/SeriesLabel.svelte.d.ts +43 -0
  51. package/dist/components/data-vis/line-chart/ValueLabel.svelte +50 -0
  52. package/dist/components/data-vis/line-chart/ValueLabel.svelte.d.ts +25 -0
  53. package/dist/components/data-vis/map/Map.svelte +392 -0
  54. package/dist/components/data-vis/map/Map.svelte.d.ts +47 -0
  55. package/dist/components/data-vis/map/MapLegend.svelte +41 -0
  56. package/dist/components/data-vis/map/MapLegend.svelte.d.ts +15 -0
  57. package/dist/components/data-vis/map/NonStandardControls.svelte +42 -0
  58. package/dist/components/data-vis/map/NonStandardControls.svelte.d.ts +13 -0
  59. package/dist/components/data-vis/map/Tooltip.svelte +41 -0
  60. package/dist/components/data-vis/map/Tooltip.svelte.d.ts +19 -0
  61. package/dist/components/data-vis/map/colorbrewer.d.ts +337 -0
  62. package/dist/components/data-vis/map/colorbrewer.js +1523 -0
  63. package/dist/components/data-vis/map/colors.d.ts +13 -0
  64. package/dist/components/data-vis/map/colors.js +65 -0
  65. package/dist/components/data-vis/map/dataJoin.d.ts +2 -0
  66. package/dist/components/data-vis/map/dataJoin.js +27 -0
  67. package/dist/components/data-vis/map/fullTopo.json +1 -0
  68. package/dist/components/data-vis/map/jenks.d.ts +1 -0
  69. package/dist/components/data-vis/map/jenks.js +51 -0
  70. package/dist/components/data-vis/map/lad2023.json +1 -0
  71. package/dist/components/data-vis/map/mapUtils.d.ts +5 -0
  72. package/dist/components/data-vis/map/mapUtils.js +86 -0
  73. package/dist/components/data-vis/map/topo.json +1 -0
  74. package/dist/components/data-vis/table/Table.svelte +247 -0
  75. package/dist/components/data-vis/table/Table.svelte.d.ts +19 -0
  76. package/dist/components/layout/Breadcrumbs.svelte +191 -0
  77. package/dist/components/layout/Breadcrumbs.svelte.d.ts +24 -0
  78. package/dist/components/layout/Footer.svelte +171 -0
  79. package/dist/components/layout/Footer.svelte.d.ts +30 -0
  80. package/dist/components/layout/Header.svelte +43 -0
  81. package/dist/components/layout/Header.svelte.d.ts +7 -0
  82. package/dist/components/layout/InternalHeader.svelte +628 -0
  83. package/dist/components/layout/InternalHeader.svelte.d.ts +15 -0
  84. package/dist/components/layout/PhaseBanner.svelte +28 -0
  85. package/dist/components/layout/PhaseBanner.svelte.d.ts +9 -0
  86. package/dist/components/layout/ServiceNavigation.svelte +143 -0
  87. package/dist/components/layout/ServiceNavigation.svelte.d.ts +13 -0
  88. package/dist/components/layout/SideNavigation.svelte +345 -0
  89. package/dist/components/layout/SideNavigation.svelte.d.ts +25 -0
  90. package/dist/components/layout/service-navigation-nested-mobile/HeaderNav.svelte +91 -0
  91. package/dist/components/layout/service-navigation-nested-mobile/HeaderNav.svelte.d.ts +15 -0
  92. package/dist/components/layout/service-navigation-nested-mobile/MobileNav.svelte +233 -0
  93. package/dist/components/layout/service-navigation-nested-mobile/MobileNav.svelte.d.ts +27 -0
  94. package/dist/components/layout/service-navigation-nested-mobile/ServiceNavigationNestedMobile.svelte +70 -0
  95. package/dist/components/layout/service-navigation-nested-mobile/ServiceNavigationNestedMobile.svelte.d.ts +11 -0
  96. package/dist/components/layout/service-navigation-nested-mobile/SideNav.svelte +276 -0
  97. package/dist/components/layout/service-navigation-nested-mobile/SideNav.svelte.d.ts +22 -0
  98. package/dist/components/ui/Accordion.svelte +244 -0
  99. package/dist/components/ui/Accordion.svelte.d.ts +23 -0
  100. package/dist/components/ui/Breadcrumbs.svelte +198 -0
  101. package/dist/components/ui/Breadcrumbs.svelte.d.ts +24 -0
  102. package/dist/components/ui/Button.svelte +96 -0
  103. package/dist/components/ui/Button.svelte.d.ts +17 -0
  104. package/dist/components/ui/CheckBox.svelte +198 -0
  105. package/dist/components/ui/CheckBox.svelte.d.ts +27 -0
  106. package/dist/components/ui/ContentsList.svelte +1117 -0
  107. package/dist/components/ui/ContentsList.svelte.d.ts +25 -0
  108. package/dist/components/ui/DateInput.svelte +255 -0
  109. package/dist/components/ui/DateInput.svelte.d.ts +59 -0
  110. package/dist/components/ui/Details.svelte +12 -0
  111. package/dist/components/ui/Details.svelte.d.ts +13 -0
  112. package/dist/components/ui/FilterPanel.svelte +588 -0
  113. package/dist/components/ui/FilterPanel.svelte.d.ts +74 -0
  114. package/dist/components/ui/Footer.svelte +171 -0
  115. package/dist/components/ui/Footer.svelte.d.ts +30 -0
  116. package/dist/components/ui/Header.svelte +43 -0
  117. package/dist/components/ui/Header.svelte.d.ts +7 -0
  118. package/dist/components/ui/Masthead.svelte +267 -0
  119. package/dist/components/ui/Masthead.svelte.d.ts +12 -0
  120. package/dist/components/ui/NavigationExample.svelte +117 -0
  121. package/dist/components/ui/NavigationExample.svelte.d.ts +3 -0
  122. package/dist/components/ui/NotificationBanner.svelte +93 -0
  123. package/dist/components/ui/NotificationBanner.svelte.d.ts +15 -0
  124. package/dist/components/ui/Radios.svelte +176 -0
  125. package/dist/components/ui/Radios.svelte.d.ts +28 -0
  126. package/dist/components/ui/RelatedContent.svelte +596 -0
  127. package/dist/components/ui/RelatedContent.svelte.d.ts +29 -0
  128. package/dist/components/ui/Search.svelte +499 -0
  129. package/dist/components/ui/Search.svelte.d.ts +32 -0
  130. package/dist/components/ui/SearchAutocomplete.svelte +655 -0
  131. package/dist/components/ui/SearchAutocomplete.svelte.d.ts +37 -0
  132. package/dist/components/ui/Select.svelte +116 -0
  133. package/dist/components/ui/Select.svelte.d.ts +22 -0
  134. package/dist/components/ui/ServiceNavigation.svelte +143 -0
  135. package/dist/components/ui/ServiceNavigation.svelte.d.ts +13 -0
  136. package/dist/components/ui/SideNavigation.svelte +346 -0
  137. package/dist/components/ui/SideNavigation.svelte.d.ts +25 -0
  138. package/dist/components/ui/Tabs.svelte +306 -0
  139. package/dist/components/ui/Tabs.svelte.d.ts +18 -0
  140. package/dist/components/ui/WhatsNew.svelte +155 -0
  141. package/dist/components/ui/WhatsNew.svelte.d.ts +29 -0
  142. package/dist/config.d.ts +51 -0
  143. package/dist/config.js +44 -0
  144. package/dist/icons/DoubleChevronButton.svelte +62 -0
  145. package/dist/icons/DoubleChevronButton.svelte.d.ts +13 -0
  146. package/dist/icons/IconSearch.svelte +42 -0
  147. package/dist/icons/IconSearch.svelte.d.ts +6 -0
  148. package/dist/icons/SingleChevronButtonWithLabel.svelte +132 -0
  149. package/dist/icons/SingleChevronButtonWithLabel.svelte.d.ts +19 -0
  150. package/dist/index.d.ts +44 -0
  151. package/dist/index.js +45 -0
  152. package/dist/main.css +1 -0
  153. package/dist/package-wrapping/BaseInformation.svelte +82 -0
  154. package/dist/package-wrapping/BaseInformation.svelte.d.ts +15 -0
  155. package/dist/package-wrapping/BaseNameAndStatus.svelte +108 -0
  156. package/dist/package-wrapping/BaseNameAndStatus.svelte.d.ts +10 -0
  157. package/dist/package-wrapping/CodeBlock.svelte +62 -0
  158. package/dist/package-wrapping/CodeBlock.svelte.d.ts +12 -0
  159. package/dist/package-wrapping/ComponentDemo.svelte +114 -0
  160. package/dist/package-wrapping/ComponentDemo.svelte.d.ts +25 -0
  161. package/dist/package-wrapping/ComponentDemoTEMP.svelte +305 -0
  162. package/dist/package-wrapping/ComponentDemoTEMP.svelte.d.ts +21 -0
  163. package/dist/package-wrapping/ComponentDetails.svelte +123 -0
  164. package/dist/package-wrapping/ComponentDetails.svelte.d.ts +13 -0
  165. package/dist/package-wrapping/DividerLine.svelte +21 -0
  166. package/dist/package-wrapping/DividerLine.svelte.d.ts +17 -0
  167. package/dist/package-wrapping/InputForParameter.svelte +205 -0
  168. package/dist/package-wrapping/InputForParameter.svelte.d.ts +13 -0
  169. package/dist/package-wrapping/InputForParameterUpdated.svelte +222 -0
  170. package/dist/package-wrapping/InputForParameterUpdated.svelte.d.ts +17 -0
  171. package/dist/package-wrapping/InputForParameterUpdatedTEMP.svelte +203 -0
  172. package/dist/package-wrapping/InputForParameterUpdatedTEMP.svelte.d.ts +17 -0
  173. package/dist/package-wrapping/ListOfComponentStatuses.svelte +19 -0
  174. package/dist/package-wrapping/ListOfComponentStatuses.svelte.d.ts +11 -0
  175. package/dist/package-wrapping/OverlayAndComponentContainer.svelte +426 -0
  176. package/dist/package-wrapping/OverlayAndComponentContainer.svelte.d.ts +33 -0
  177. package/dist/package-wrapping/ParametersSection.svelte +235 -0
  178. package/dist/package-wrapping/ParametersSection.svelte.d.ts +19 -0
  179. package/dist/package-wrapping/ParsingErrorToastsContainer.svelte +50 -0
  180. package/dist/package-wrapping/ParsingErrorToastsContainer.svelte.d.ts +15 -0
  181. package/dist/package-wrapping/Pill.svelte +54 -0
  182. package/dist/package-wrapping/Pill.svelte.d.ts +25 -0
  183. package/dist/package-wrapping/PlaygroundDetails.svelte +106 -0
  184. package/dist/package-wrapping/PlaygroundDetails.svelte.d.ts +13 -0
  185. package/dist/package-wrapping/ScreenSizeRadio.svelte +24 -0
  186. package/dist/package-wrapping/ScreenSizeRadio.svelte.d.ts +11 -0
  187. package/dist/package-wrapping/ScreenSizeRadioUpdated.svelte +23 -0
  188. package/dist/package-wrapping/ScreenSizeRadioUpdated.svelte.d.ts +11 -0
  189. package/dist/package-wrapping/SidebarContainer.svelte +103 -0
  190. package/dist/package-wrapping/SidebarContainer.svelte.d.ts +23 -0
  191. package/dist/package-wrapping/WrapperDetailsUpdate.svelte +40 -0
  192. package/dist/package-wrapping/WrapperDetailsUpdate.svelte.d.ts +15 -0
  193. package/dist/package-wrapping/templates/Template.svelte +100 -0
  194. package/dist/package-wrapping/templates/Template.svelte.d.ts +25 -0
  195. package/dist/templates/ComponentPageTemplate.svelte +1 -0
  196. package/dist/templates/ComponentPageTemplate.svelte.d.ts +26 -0
  197. package/dist/utils/data-transformations/convertCSV.d.ts +2 -0
  198. package/dist/utils/data-transformations/convertCSV.js +22 -0
  199. package/dist/utils/data-transformations/getValueFromParametersArray.d.ts +1 -0
  200. package/dist/utils/data-transformations/getValueFromParametersArray.js +9 -0
  201. package/dist/utils/layoutNavHelpers.d.ts +70 -0
  202. package/dist/utils/layoutNavHelpers.js +129 -0
  203. package/dist/utils/package-wrapping-specific/addIndexAndInitialValue.d.ts +1 -0
  204. package/dist/utils/package-wrapping-specific/addIndexAndInitialValue.js +21 -0
  205. package/dist/utils/package-wrapping-specific/createBindableParametersValuesArray.d.ts +1 -0
  206. package/dist/utils/package-wrapping-specific/createBindableParametersValuesArray.js +12 -0
  207. package/dist/utils/package-wrapping-specific/createParametersObject.d.ts +1 -0
  208. package/dist/utils/package-wrapping-specific/createParametersObject.js +29 -0
  209. package/dist/utils/package-wrapping-specific/defineDefaultEventHandler.d.ts +1 -0
  210. package/dist/utils/package-wrapping-specific/defineDefaultEventHandler.js +14 -0
  211. package/dist/utils/package-wrapping-specific/trackVisibleParameters.d.ts +1 -0
  212. package/dist/utils/package-wrapping-specific/trackVisibleParameters.js +29 -0
  213. package/dist/utils/syntax-highlighting/shikiHighlight.d.ts +7 -0
  214. package/dist/utils/syntax-highlighting/shikiHighlight.js +76 -0
  215. package/dist/utils/text-string-conversion/textStringConversion.d.ts +9 -0
  216. package/dist/utils/text-string-conversion/textStringConversion.js +86 -0
  217. package/package.json +113 -0
@@ -0,0 +1,138 @@
1
+ <script>
2
+ import Line from "./Line.svelte";
3
+ import Marker from "./Marker.svelte";
4
+ import ValueLabel from "./ValueLabel.svelte";
5
+ import SeriesLabel from "./SeriesLabel.svelte";
6
+ import labelplacer from "labelplacer";
7
+ import { onMount } from "svelte";
8
+ import { derived } from "svelte/store";
9
+ import { linear } from "svelte/easing";
10
+
11
+ let {
12
+ tieredDataObject,
13
+ dataArray,
14
+ lineFunction,
15
+ chartWidth,
16
+ xFunction,
17
+ yFunction,
18
+ clickedSeries,
19
+ hoveredSeries,
20
+ chartHeight,
21
+ globalTierRules,
22
+ chartBackgroundColor = "#fafafa",
23
+ nothingSelected,
24
+ onMouseEnterSeries,
25
+ onMouseLeaveSeries,
26
+ onClickSeries,
27
+ onMouseEnterMarker,
28
+ onMouseLeaveMarker,
29
+ onClickMarker,
30
+ activeMarkerId,
31
+ labelText,
32
+ series,
33
+ y,
34
+ x,
35
+ tooltipContent,
36
+ } = $props();
37
+
38
+ let bounds = $state([0, chartHeight]);
39
+
40
+ let transformed = $derived(
41
+ Object.values(tieredDataObject)
42
+ .filter(Array.isArray)
43
+ .flatMap((tier) => tier.filter((item) => item.placeLabel === true))
44
+
45
+ .filter(
46
+ (item, index, self) =>
47
+ self.findIndex((other) => other[series] === item[series]) === index,
48
+ )
49
+ .map((item) => ({
50
+ [series]: item[series],
51
+ lastY: yFunction(item.data[0][y]),
52
+ })),
53
+ );
54
+
55
+ let labelsPlaced = $derived(
56
+ labelplacer(
57
+ transformed,
58
+ bounds,
59
+ (d) => d.lastY,
60
+ (d) => 20 * Math.ceil(d[series].length / 15),
61
+ ),
62
+ );
63
+ </script>
64
+
65
+ {#each Object.keys(tieredDataObject) as tier}
66
+ <g id={tier}>
67
+ <g {...globalTierRules[tier]}>
68
+ {#each tieredDataObject[tier] as line, i}
69
+ <Line
70
+ {...line}
71
+ id={`line-${line[series]}`}
72
+ {tier}
73
+ {chartBackgroundColor}
74
+ {lineFunction}
75
+ {xFunction}
76
+ {yFunction}
77
+ {onMouseEnterSeries}
78
+ {onMouseLeaveSeries}
79
+ {onClickSeries}
80
+ {clickedSeries}
81
+ {hoveredSeries}
82
+ {series}
83
+ {y}
84
+ {x}
85
+ {onMouseEnterMarker}
86
+ {onMouseLeaveMarker}
87
+ {onClickMarker}
88
+ {activeMarkerId}
89
+ />
90
+ {/each}
91
+ </g>
92
+
93
+ <g>
94
+ {#each tieredDataObject[tier] as line, i}
95
+ {#if line.showLabel}
96
+ {@const newY = labelsPlaced.find(
97
+ (el) => el.datum[series] === line[series],
98
+ )?.[y]}
99
+ <SeriesLabel
100
+ interactive={line.interactive}
101
+ id={`label-${line[series]}`}
102
+ {clickedSeries}
103
+ {hoveredSeries}
104
+ {chartWidth}
105
+ {lineFunction}
106
+ dataArray={line}
107
+ {xFunction}
108
+ {yFunction}
109
+ {newY}
110
+ {onClickSeries}
111
+ {onMouseEnterSeries}
112
+ {onMouseLeaveSeries}
113
+ {labelText}
114
+ {series}
115
+ {y}
116
+ {tier}
117
+ ></SeriesLabel>
118
+ {/if}
119
+ {/each}
120
+ </g>
121
+ </g>
122
+ {/each}
123
+
124
+ {#if activeMarkerId}
125
+ <ValueLabel
126
+ {activeMarkerId}
127
+ labelColor="grey"
128
+ labelTextColor="black"
129
+ {tooltipContent}
130
+ {xFunction}
131
+ {yFunction}
132
+ {x}
133
+ {y}
134
+ ></ValueLabel>
135
+ {/if}
136
+
137
+ <!-- if markerhovered get the id render the tooltip find in the tieredDataObject gets
138
+ the data for that line -->
@@ -0,0 +1,57 @@
1
+ export default Lines;
2
+ type Lines = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<$$ComponentProps>): void;
5
+ };
6
+ declare const Lines: import("svelte").Component<{
7
+ tieredDataObject: any;
8
+ dataArray: any;
9
+ lineFunction: any;
10
+ chartWidth: any;
11
+ xFunction: any;
12
+ yFunction: any;
13
+ clickedSeries: any;
14
+ hoveredSeries: any;
15
+ chartHeight: any;
16
+ globalTierRules: any;
17
+ chartBackgroundColor?: string;
18
+ nothingSelected: any;
19
+ onMouseEnterSeries: any;
20
+ onMouseLeaveSeries: any;
21
+ onClickSeries: any;
22
+ onMouseEnterMarker: any;
23
+ onMouseLeaveMarker: any;
24
+ onClickMarker: any;
25
+ activeMarkerId: any;
26
+ labelText: any;
27
+ series: any;
28
+ y: any;
29
+ x: any;
30
+ tooltipContent: any;
31
+ }, {}, "">;
32
+ type $$ComponentProps = {
33
+ tieredDataObject: any;
34
+ dataArray: any;
35
+ lineFunction: any;
36
+ chartWidth: any;
37
+ xFunction: any;
38
+ yFunction: any;
39
+ clickedSeries: any;
40
+ hoveredSeries: any;
41
+ chartHeight: any;
42
+ globalTierRules: any;
43
+ chartBackgroundColor?: string;
44
+ nothingSelected: any;
45
+ onMouseEnterSeries: any;
46
+ onMouseLeaveSeries: any;
47
+ onClickSeries: any;
48
+ onMouseEnterMarker: any;
49
+ onMouseLeaveMarker: any;
50
+ onClickMarker: any;
51
+ activeMarkerId: any;
52
+ labelText: any;
53
+ series: any;
54
+ y: any;
55
+ x: any;
56
+ tooltipContent: any;
57
+ };
@@ -0,0 +1,61 @@
1
+ <script>
2
+ import ValueLabel from "./ValueLabel.svelte";
3
+ let {
4
+ dataArray,
5
+ series,
6
+ onClickMarker,
7
+ onMouseEnterMarker,
8
+ onMouseLeaveMarker,
9
+ xFunction,
10
+ yFunction,
11
+ x,
12
+ y,
13
+ markerShape = "circle",
14
+ markerRadius = 5,
15
+ markerFill = "grey",
16
+ markerStroke = "white",
17
+ markerStrokeWidth = 1,
18
+ } = $props();
19
+ </script>
20
+
21
+ {#each dataArray as marker, i}
22
+ {@const markerId = "marker-" + marker[series] + marker[x]}
23
+ <g
24
+ data-id={markerId}
25
+ onclick={(event) => onClickMarker(event, marker, markerId)}
26
+ onmouseenter={(event) => onMouseEnterMarker(event, marker, markerId)}
27
+ onmouseleave={(event) => onMouseLeaveMarker(event, marker, markerId)}
28
+ transform="translate({xFunction(marker[x])},{yFunction(marker[y])})"
29
+ role="button"
30
+ tabindex="0"
31
+ onkeydown={(e) => e.key === "Enter" && onClickMarker(e, marker)}
32
+ >
33
+ {#if markerShape === "circle"}
34
+ <circle
35
+ r={markerRadius}
36
+ stroke={markerStroke}
37
+ fill={markerFill}
38
+ stroke-width={markerStrokeWidth}
39
+ ></circle>
40
+ {:else if ["square", "diamond"].includes(markerShape)}
41
+ <rect
42
+ transform="rotate({markerShape === 'diamond' ? 45 : 0})"
43
+ x={-markerRadius}
44
+ y={-markerRadius}
45
+ width={markerRadius * 2}
46
+ height={markerRadius * 2}
47
+ stroke={markerStroke}
48
+ fill={markerFill}
49
+ stroke-width={markerStrokeWidth}
50
+ ></rect>
51
+ {:else if markerShape === "triangle"}
52
+ <polygon
53
+ points="0,{-markerRadius * 2} {markerRadius *
54
+ 1.733},{markerRadius} {-markerRadius * 1.733},{markerRadius}"
55
+ stroke={markerStroke}
56
+ fill={markerFill}
57
+ stroke-width={markerStrokeWidth}
58
+ ></polygon>
59
+ {/if}
60
+ </g>
61
+ {/each}
@@ -0,0 +1,37 @@
1
+ export default Marker;
2
+ type Marker = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<$$ComponentProps>): void;
5
+ };
6
+ declare const Marker: import("svelte").Component<{
7
+ dataArray: any;
8
+ series: any;
9
+ onClickMarker: any;
10
+ onMouseEnterMarker: any;
11
+ onMouseLeaveMarker: any;
12
+ xFunction: any;
13
+ yFunction: any;
14
+ x: any;
15
+ y: any;
16
+ markerShape?: string;
17
+ markerRadius?: number;
18
+ markerFill?: string;
19
+ markerStroke?: string;
20
+ markerStrokeWidth?: number;
21
+ }, {}, "">;
22
+ type $$ComponentProps = {
23
+ dataArray: any;
24
+ series: any;
25
+ onClickMarker: any;
26
+ onMouseEnterMarker: any;
27
+ onMouseLeaveMarker: any;
28
+ xFunction: any;
29
+ yFunction: any;
30
+ x: any;
31
+ y: any;
32
+ markerShape?: string;
33
+ markerRadius?: number;
34
+ markerFill?: string;
35
+ markerStroke?: string;
36
+ markerStrokeWidth?: number;
37
+ };
@@ -0,0 +1,67 @@
1
+ <script>
2
+ let {
3
+ id,
4
+ clickedSeries,
5
+ hoveredSeries,
6
+ chartWidth,
7
+ lineFunction,
8
+ dataArray,
9
+ xFunction,
10
+ yFunction,
11
+ newY,
12
+ onClickSeries,
13
+ onMouseEnterSeries,
14
+ onMouseLeaveSeries,
15
+ labelText,
16
+ series,
17
+ y,
18
+ tier,
19
+ interactive,
20
+ } = $props();
21
+
22
+ let oldY = $derived(yFunction(dataArray.data[0][y]));
23
+
24
+ let opacity = $derived(
25
+ (!hoveredSeries && !clickedSeries) ||
26
+ [hoveredSeries, clickedSeries].includes(dataArray[series])
27
+ ? 1
28
+ : 0.3,
29
+ );
30
+ </script>
31
+
32
+ <g
33
+ {id}
34
+ transform="translate({chartWidth + 8},{0})"
35
+ onclick={interactive
36
+ ? () => onClickSeries(dataArray[series], tier)
37
+ : undefined}
38
+ onmouseenter={interactive
39
+ ? () => onMouseEnterSeries(dataArray[series], tier)
40
+ : undefined}
41
+ onmouseleave={interactive
42
+ ? () => onMouseLeaveSeries(dataArray[series], tier)
43
+ : undefined}
44
+ role="button"
45
+ tabindex="0"
46
+ onkeydown={(e) => e.key === "Enter" && onClickSeries(dataArray[series])}
47
+ pointer-events={interactive ? null : "none"}
48
+ {opacity}
49
+ >
50
+ <path
51
+ d="M 0, {oldY} H 10 V {newY} H 20"
52
+ fill="none"
53
+ stroke="black"
54
+ stroke-width="1"
55
+ ></path>
56
+ <text
57
+ {id}
58
+ dominant-baseline="central"
59
+ text-anchor="start"
60
+ x={20}
61
+ y={newY}
62
+ stroke-width={clickedSeries ? 0.7 : 0}
63
+ stroke="black"
64
+ >
65
+ {labelText(dataArray)}
66
+ </text>
67
+ </g>
@@ -0,0 +1,43 @@
1
+ export default SeriesLabel;
2
+ type SeriesLabel = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<$$ComponentProps>): void;
5
+ };
6
+ declare const SeriesLabel: import("svelte").Component<{
7
+ id: any;
8
+ clickedSeries: any;
9
+ hoveredSeries: any;
10
+ chartWidth: any;
11
+ lineFunction: any;
12
+ dataArray: any;
13
+ xFunction: any;
14
+ yFunction: any;
15
+ newY: any;
16
+ onClickSeries: any;
17
+ onMouseEnterSeries: any;
18
+ onMouseLeaveSeries: any;
19
+ labelText: any;
20
+ series: any;
21
+ y: any;
22
+ tier: any;
23
+ interactive: any;
24
+ }, {}, "">;
25
+ type $$ComponentProps = {
26
+ id: any;
27
+ clickedSeries: any;
28
+ hoveredSeries: any;
29
+ chartWidth: any;
30
+ lineFunction: any;
31
+ dataArray: any;
32
+ xFunction: any;
33
+ yFunction: any;
34
+ newY: any;
35
+ onClickSeries: any;
36
+ onMouseEnterSeries: any;
37
+ onMouseLeaveSeries: any;
38
+ labelText: any;
39
+ series: any;
40
+ y: any;
41
+ tier: any;
42
+ interactive: any;
43
+ };
@@ -0,0 +1,50 @@
1
+ <script>
2
+ let {
3
+ activeMarkerId,
4
+ labelColor,
5
+ labelTextColor,
6
+ tooltipContent,
7
+ xFunction,
8
+ yFunction,
9
+ x,
10
+ y,
11
+ } = $props();
12
+
13
+ let textDimensions = $state();
14
+ let lineSpacing = $state(20);
15
+ let verticalPadding = $state(8);
16
+ let horizontalPadding = $derived(verticalPadding * 2);
17
+ </script>
18
+
19
+ <svg>
20
+ <g
21
+ transform="translate({xFunction(activeMarkerId[x])},{yFunction(
22
+ activeMarkerId[y],
23
+ )})"
24
+ pointer-events="none"
25
+ >
26
+ {#if textDimensions}
27
+ <rect
28
+ height={textDimensions.height + verticalPadding}
29
+ rx="5"
30
+ ry="5"
31
+ fill={labelColor}
32
+ width={textDimensions.width + horizontalPadding}
33
+ ></rect>
34
+ {/if}
35
+ <text
36
+ x={horizontalPadding / 2}
37
+ y={(textDimensions?.height + verticalPadding) / 2}
38
+ dominant-baseline="middle"
39
+ font-size="16"
40
+ fill={labelTextColor}
41
+ bind:contentRect={textDimensions}
42
+ >
43
+ {#if typeof tooltipContent === "string"}
44
+ {tooltipContent}
45
+ {:else}
46
+ {@render tooltipContent()}
47
+ {/if}
48
+ </text>
49
+ </g>
50
+ </svg>
@@ -0,0 +1,25 @@
1
+ export default ValueLabel;
2
+ type ValueLabel = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<$$ComponentProps>): void;
5
+ };
6
+ declare const ValueLabel: import("svelte").Component<{
7
+ activeMarkerId: any;
8
+ labelColor: any;
9
+ labelTextColor: any;
10
+ tooltipContent: any;
11
+ xFunction: any;
12
+ yFunction: any;
13
+ x: any;
14
+ y: any;
15
+ }, {}, "">;
16
+ type $$ComponentProps = {
17
+ activeMarkerId: any;
18
+ labelColor: any;
19
+ labelTextColor: any;
20
+ tooltipContent: any;
21
+ xFunction: any;
22
+ yFunction: any;
23
+ x: any;
24
+ y: any;
25
+ };