sveltekit-ui 1.1.64 → 1.1.65

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.
@@ -1449,6 +1449,20 @@ export function create_chart_manager(config) {
1449
1449
  return `${y}-${m}-${day} ${h}:${min}`
1450
1450
  }
1451
1451
 
1452
+ function get_path_d(data) {
1453
+ if (!Array.isArray(data) || data.length === 0) return null
1454
+ let path_d = null
1455
+ for (let datapoint of data) {
1456
+ const x = Number(datapoint?.x)
1457
+ const y = Number(datapoint?.y)
1458
+ if (!Number.isFinite(x) || !Number.isFinite(y)) continue
1459
+
1460
+ const point = `${(x * 100).toPrecision(4)} ${(100 - y * 100).toPrecision(4)}`
1461
+ path_d = path_d == null ? `M${point}` : `${path_d} L${point}`
1462
+ }
1463
+ return path_d
1464
+ }
1465
+
1452
1466
  function prep_chart(input) {
1453
1467
  if (!input || !datasets || !grid_width) {
1454
1468
  chart_prepped = null
@@ -1599,18 +1613,6 @@ export function create_chart_manager(config) {
1599
1613
  register_y_value(item_to_add.y, affects_y_scale)
1600
1614
  }
1601
1615
  }
1602
- if (dataset?.type == "path") {
1603
- if (Array.isArray(dataset?.data) && dataset?.data.length > 0) {
1604
- d_loc = `M${(dataset?.data[0]?.x * 100).toPrecision(4)} ${(100 - dataset?.data[0]?.y * 100).toPrecision(
1605
- 4,
1606
- )}`
1607
- for (let i = 1; i < dataset?.data.length; i++) {
1608
- d_loc =
1609
- d_loc +
1610
- ` L${(dataset?.data[i].x * 100).toPrecision(4)} ${(100 - dataset?.data[i].y * 100).toPrecision(4)}`
1611
- }
1612
- }
1613
- }
1614
1616
  } else if (dataset.type == "lines" && dataset?.keys?.length > 1 && datasets[dataset?.dataset_id]?.data) {
1615
1617
  for (let datapoint of datasets[dataset?.dataset_id]?.data) {
1616
1618
  if (!isNaN(datapoint[dataset?.keys[0]]) && !isNaN(datapoint[dataset?.keys[1]])) {
@@ -1754,7 +1756,10 @@ export function create_chart_manager(config) {
1754
1756
  })
1755
1757
  }
1756
1758
  }
1759
+ const d_loc_normalized =
1760
+ pre_prepped_dataset.type === "path" ? get_path_d(normalized_datapoints_in_range_loc) : pre_prepped_dataset.d
1757
1761
  pre_prepped_dataset.data = normalized_datapoints_in_range_loc
1762
+ pre_prepped_dataset.d = d_loc_normalized
1758
1763
  prepped_datasets.push({
1759
1764
  ...pre_prepped_dataset,
1760
1765
  kline_width_pd: parseFloat(kline_width_pd.toPrecision(8)),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sveltekit-ui",
3
- "version": "1.1.64",
3
+ "version": "1.1.65",
4
4
  "description": "A SvelteKit UI component library for building modern web applications",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -28,10 +28,10 @@
28
28
  "@sveltejs/adapter-vercel": "^6.3.3",
29
29
  "@sveltejs/kit": "^2.59.1",
30
30
  "@sveltejs/package": "^2.5.7",
31
- "@sveltejs/vite-plugin-svelte": "^7.1.1",
31
+ "@sveltejs/vite-plugin-svelte": "^7.1.2",
32
32
  "@vercel/analytics": "^2.0.1",
33
33
  "typescript": "^6.0.3",
34
- "vite": "^8.0.10"
34
+ "vite": "^8.0.11"
35
35
  },
36
36
  "homepage": "https://www.sveltekit-ui.com",
37
37
  "keywords": [
@@ -1449,6 +1449,20 @@ export function create_chart_manager(config) {
1449
1449
  return `${y}-${m}-${day} ${h}:${min}`
1450
1450
  }
1451
1451
 
1452
+ function get_path_d(data) {
1453
+ if (!Array.isArray(data) || data.length === 0) return null
1454
+ let path_d = null
1455
+ for (let datapoint of data) {
1456
+ const x = Number(datapoint?.x)
1457
+ const y = Number(datapoint?.y)
1458
+ if (!Number.isFinite(x) || !Number.isFinite(y)) continue
1459
+
1460
+ const point = `${(x * 100).toPrecision(4)} ${(100 - y * 100).toPrecision(4)}`
1461
+ path_d = path_d == null ? `M${point}` : `${path_d} L${point}`
1462
+ }
1463
+ return path_d
1464
+ }
1465
+
1452
1466
  function prep_chart(input) {
1453
1467
  if (!input || !datasets || !grid_width) {
1454
1468
  chart_prepped = null
@@ -1599,18 +1613,6 @@ export function create_chart_manager(config) {
1599
1613
  register_y_value(item_to_add.y, affects_y_scale)
1600
1614
  }
1601
1615
  }
1602
- if (dataset?.type == "path") {
1603
- if (Array.isArray(dataset?.data) && dataset?.data.length > 0) {
1604
- d_loc = `M${(dataset?.data[0]?.x * 100).toPrecision(4)} ${(100 - dataset?.data[0]?.y * 100).toPrecision(
1605
- 4,
1606
- )}`
1607
- for (let i = 1; i < dataset?.data.length; i++) {
1608
- d_loc =
1609
- d_loc +
1610
- ` L${(dataset?.data[i].x * 100).toPrecision(4)} ${(100 - dataset?.data[i].y * 100).toPrecision(4)}`
1611
- }
1612
- }
1613
- }
1614
1616
  } else if (dataset.type == "lines" && dataset?.keys?.length > 1 && datasets[dataset?.dataset_id]?.data) {
1615
1617
  for (let datapoint of datasets[dataset?.dataset_id]?.data) {
1616
1618
  if (!isNaN(datapoint[dataset?.keys[0]]) && !isNaN(datapoint[dataset?.keys[1]])) {
@@ -1754,7 +1756,10 @@ export function create_chart_manager(config) {
1754
1756
  })
1755
1757
  }
1756
1758
  }
1759
+ const d_loc_normalized =
1760
+ pre_prepped_dataset.type === "path" ? get_path_d(normalized_datapoints_in_range_loc) : pre_prepped_dataset.d
1757
1761
  pre_prepped_dataset.data = normalized_datapoints_in_range_loc
1762
+ pre_prepped_dataset.d = d_loc_normalized
1758
1763
  prepped_datasets.push({
1759
1764
  ...pre_prepped_dataset,
1760
1765
  kline_width_pd: parseFloat(kline_width_pd.toPrecision(8)),