sveltekit-ui 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Components/Chart/index.svelte.js +54 -48
- package/dist/Components/FunctionInput/Node/helpers/Field/index.svelte.js +0 -1
- package/dist/Components/FunctionInput/Node/index.svelte.js +49 -45
- package/dist/Components/FunctionInput/index.svelte +3 -3
- package/dist/Components/FunctionInput/index.svelte.js +50 -50
- package/dist/Components/Location/index.svelte.js +1 -1
- package/dist/Components/LocationInput/index.svelte +5 -3
- package/dist/Components/LocationInput/index.svelte.js +5 -0
- package/dist/client/types/index.js +2019 -1897
- package/dist/index.js +2 -2
- package/package.json +4 -4
- package/src/lib/Components/Chart/index.svelte.js +54 -48
- package/src/lib/Components/FunctionInput/Node/helpers/Field/index.svelte.js +0 -1
- package/src/lib/Components/FunctionInput/Node/index.svelte.js +49 -45
- package/src/lib/Components/FunctionInput/index.svelte +3 -3
- package/src/lib/Components/FunctionInput/index.svelte.js +50 -50
- package/src/lib/Components/Location/index.svelte.js +1 -1
- package/src/lib/Components/LocationInput/index.svelte +5 -3
- package/src/lib/Components/LocationInput/index.svelte.js +5 -0
- package/src/lib/client/types/index.js +2019 -1897
- package/src/lib/index.js +2 -2
- package/src/routes/[component]/+page.svelte +2 -0
- package/src/routes/[component]/Showcase/FunctionInput/index.svelte +6 -6
|
@@ -169,7 +169,7 @@ export function create_chart_manager(config) {
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
function time_tic_size(seconds) {
|
|
172
|
-
const
|
|
172
|
+
const tic_options = [
|
|
173
173
|
300, //5m
|
|
174
174
|
600, //10m
|
|
175
175
|
900, //15m
|
|
@@ -194,9 +194,9 @@ export function create_chart_manager(config) {
|
|
|
194
194
|
15768000, //6m
|
|
195
195
|
31536000, //1y
|
|
196
196
|
]
|
|
197
|
-
for (let i = 0; i <
|
|
198
|
-
if (
|
|
199
|
-
return
|
|
197
|
+
for (let i = 0; i < tic_options.length - 1; i++) {
|
|
198
|
+
if (tic_options[i] < seconds && tic_options[i + 1] > seconds) {
|
|
199
|
+
return tic_options[i + 1]
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
return "-"
|
|
@@ -321,25 +321,25 @@ export function create_chart_manager(config) {
|
|
|
321
321
|
const day = dateObject.getDate()
|
|
322
322
|
const hour = dateObject.getHours()
|
|
323
323
|
const minute = dateObject.getMinutes()
|
|
324
|
-
const
|
|
325
|
-
const
|
|
326
|
-
let
|
|
327
|
-
// if(
|
|
328
|
-
let
|
|
329
|
-
// if(
|
|
330
|
-
let
|
|
331
|
-
if (
|
|
332
|
-
|
|
324
|
+
const year_st = JSON.stringify(year)
|
|
325
|
+
const month_st = months[month]
|
|
326
|
+
let day_st = JSON.stringify(day)
|
|
327
|
+
// if(day_st.length < 2){ day_st = '0' + day_st }
|
|
328
|
+
let hour_st = JSON.stringify(hour)
|
|
329
|
+
// if(hour_st.length < 2){ hour_st = '0' + hour_st }
|
|
330
|
+
let minute_st = JSON.stringify(minute)
|
|
331
|
+
if (minute_st.length < 2) {
|
|
332
|
+
minute_st = "0" + minute_st
|
|
333
333
|
}
|
|
334
|
-
const
|
|
334
|
+
const hour_minute_st = hour_st + ":" + minute_st
|
|
335
335
|
if (minute > 0 || hour > 0) {
|
|
336
|
-
return
|
|
336
|
+
return hour_minute_st
|
|
337
337
|
} else if (day > 1) {
|
|
338
|
-
return
|
|
338
|
+
return day_st
|
|
339
339
|
} else if (month > 0) {
|
|
340
|
-
return
|
|
340
|
+
return month_st
|
|
341
341
|
}
|
|
342
|
-
return
|
|
342
|
+
return year_st
|
|
343
343
|
}
|
|
344
344
|
|
|
345
345
|
function prep_x_axis(
|
|
@@ -459,7 +459,7 @@ export function create_chart_manager(config) {
|
|
|
459
459
|
}
|
|
460
460
|
|
|
461
461
|
function next_big_num_under_target(target) {
|
|
462
|
-
const
|
|
462
|
+
const num_bases = [
|
|
463
463
|
100000000000000, 10000000000000, 1000000000000, 100000000000, 10000000000, 1000000000, 100000000, 50000000,
|
|
464
464
|
20000000, 10000000, 5000000, 2000000, 1000000, 750000, 500000, 400000, 250000, 200000, 150000, 100000, 75000,
|
|
465
465
|
50000, 40000, 25000, 20000, 15000, 10000, 7500, 5000, 4000, 3000, 2500, 2000, 1500, 1250, 1000, 750, 500, 400,
|
|
@@ -468,7 +468,7 @@ export function create_chart_manager(config) {
|
|
|
468
468
|
0.0001, 0.00008, 0.00005, 0.00004, 0.00003, 0.00002, 0.00001, 0.000008, 0.000005, 0.000004, 0.000003, 0.000002,
|
|
469
469
|
0.000001, 0.0000008, 0.0000005, 0.0000004, 0.0000003, 0.0000002, 0.0000001,
|
|
470
470
|
]
|
|
471
|
-
for (let num of
|
|
471
|
+
for (let num of num_bases) {
|
|
472
472
|
if (num < target) {
|
|
473
473
|
return num
|
|
474
474
|
}
|
|
@@ -477,7 +477,7 @@ export function create_chart_manager(config) {
|
|
|
477
477
|
}
|
|
478
478
|
|
|
479
479
|
function tic_size(num) {
|
|
480
|
-
const
|
|
480
|
+
const tic_options = [
|
|
481
481
|
0.0000001, 0.0000002, 0.0000003, 0.0000004, 0.0000005, 0.0000008, 0.000001, 0.000002, 0.000003, 0.000004,
|
|
482
482
|
0.000005, 0.000008, 0.00001, 0.00002, 0.00003, 0.00004, 0.00005, 0.00008, 0.0001, 0.0002, 0.0003, 0.0004, 0.0005,
|
|
483
483
|
0.0008, 0.001, 0.002, 0.003, 0.004, 0.005, 0.008, 0.01, 0.02, 0.03, 0.04, 0.05, 0.08, 0.1, 0.2, 0.3, 0.4, 0.5,
|
|
@@ -486,9 +486,9 @@ export function create_chart_manager(config) {
|
|
|
486
486
|
250000, 400000, 500000, 750000, 1000000, 2000000, 5000000, 10000000, 20000000, 50000000, 100000000, 1000000000,
|
|
487
487
|
10000000000, 100000000000, 1000000000000, 10000000000000, 100000000000000,
|
|
488
488
|
]
|
|
489
|
-
for (let i = 0; i <
|
|
490
|
-
if (
|
|
491
|
-
return
|
|
489
|
+
for (let i = 0; i < tic_options.length - 1; i++) {
|
|
490
|
+
if (tic_options[i] < num && tic_options[i + 1] > num) {
|
|
491
|
+
return tic_options[i + 1]
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
494
|
return "-"
|
|
@@ -587,67 +587,68 @@ export function create_chart_manager(config) {
|
|
|
587
587
|
}
|
|
588
588
|
|
|
589
589
|
function short_lab(num) {
|
|
590
|
-
var
|
|
590
|
+
var if_neg = 1
|
|
591
591
|
if ((typeof num === typeof null) | (typeof num === typeof undefined)) {
|
|
592
592
|
return "-"
|
|
593
593
|
}
|
|
594
594
|
if (num < 0) {
|
|
595
|
-
|
|
595
|
+
if_neg = -1
|
|
596
596
|
}
|
|
597
597
|
var amount
|
|
598
598
|
amount = Math.abs(num)
|
|
599
599
|
if (amount === 0) {
|
|
600
600
|
return 0
|
|
601
601
|
} else if (amount >= 0 && amount < 0.0001) {
|
|
602
|
-
return Math.round((
|
|
602
|
+
return Math.round((if_neg * amount).toFixed(8) * 10000000 + Number.EPSILON) / 10000000
|
|
603
603
|
} else if (amount >= 0.0001 && amount < 0.001) {
|
|
604
|
-
return Math.round((
|
|
604
|
+
return Math.round((if_neg * amount).toFixed(7) * 1000000 + Number.EPSILON) / 1000000
|
|
605
605
|
} else if (amount >= 0.001 && amount < 0.01) {
|
|
606
|
-
return Math.round((
|
|
606
|
+
return Math.round((if_neg * amount).toFixed(6) * 100000 + Number.EPSILON) / 100000
|
|
607
607
|
} else if (amount >= 0.01 && amount < 0.1) {
|
|
608
|
-
return Math.round((
|
|
608
|
+
return Math.round((if_neg * amount).toFixed(5) * 10000 + Number.EPSILON) / 10000
|
|
609
609
|
} else if (amount >= 0.1 && amount < 10) {
|
|
610
|
-
return Math.round((
|
|
610
|
+
return Math.round((if_neg * amount).toFixed(4) * 1000 + Number.EPSILON) / 1000
|
|
611
611
|
} else if (amount >= 10 && amount < 1000) {
|
|
612
|
-
return (
|
|
612
|
+
return (if_neg * amount).toFixed(2)
|
|
613
613
|
} else if (amount >= 1000 && amount < 1000000) {
|
|
614
|
-
return (
|
|
614
|
+
return (if_neg * amount).toFixed().replace(/\B(?=(\d{3})+(?!\d))/g, ",")
|
|
615
615
|
} else if (amount >= 1000000 && amount < 10000000) {
|
|
616
|
-
return (
|
|
616
|
+
return (if_neg * (amount / 1000000)).toFixed(2) + " M"
|
|
617
617
|
} else if (amount >= 10000000 && amount < 100000000) {
|
|
618
|
-
return (
|
|
618
|
+
return (if_neg * (amount / 1000000)).toFixed(1) + " M"
|
|
619
619
|
} else if (amount >= 100000000 && amount < 1000000000) {
|
|
620
|
-
return (
|
|
620
|
+
return (if_neg * (amount / 1000000)).toFixed() + " M"
|
|
621
621
|
} else if (amount >= 1000000000 && amount < 10000000000) {
|
|
622
|
-
return (
|
|
622
|
+
return (if_neg * (amount / 1000000000)).toFixed(2) + " B"
|
|
623
623
|
} else if (amount >= 10000000000 && amount < 100000000000) {
|
|
624
|
-
return (
|
|
624
|
+
return (if_neg * (amount / 1000000000)).toFixed(1) + " B"
|
|
625
625
|
} else if (amount >= 100000000000 && amount < 1000000000000) {
|
|
626
|
-
return (
|
|
626
|
+
return (if_neg * (amount / 1000000000)).toFixed() + " B"
|
|
627
627
|
} else if (amount >= 1000000000000 && amount < 10000000000000) {
|
|
628
|
-
return (
|
|
628
|
+
return (if_neg * (amount / 1000000000000)).toFixed(2) + " T"
|
|
629
629
|
} else if (amount >= 10000000000000 && amount < 100000000000000) {
|
|
630
|
-
return (
|
|
630
|
+
return (if_neg * (amount / 1000000000000)).toFixed(1) + " T"
|
|
631
631
|
} else if (amount >= 100000000000000 && amount < 1000000000000000) {
|
|
632
|
-
return (
|
|
632
|
+
return (if_neg * (amount / 1000000000000)).toFixed() + " T"
|
|
633
633
|
} else if (amount >= 1000000000000000 && amount < 10000000000000000n) {
|
|
634
|
-
return (
|
|
634
|
+
return (if_neg * (amount / 1000000000000000)).toFixed(2) + " Q"
|
|
635
635
|
} else if (amount >= 10000000000000000n && amount < 100000000000000000n) {
|
|
636
|
-
return (
|
|
636
|
+
return (if_neg * (amount / 1000000000000000)).toFixed(1) + " Q"
|
|
637
637
|
} else if (amount >= 100000000000000000n && amount < 1000000000000000000n) {
|
|
638
|
-
return (
|
|
638
|
+
return (if_neg * (amount / 1000000000000000)).toFixed() + " Q"
|
|
639
639
|
} else if (amount >= 1000000000000000000n && amount < 10000000000000000000n) {
|
|
640
|
-
return (
|
|
640
|
+
return (if_neg * (amount / 1000000000000000000n)).toFixed(2) + " QN"
|
|
641
641
|
} else if (amount >= 10000000000000000000n && amount < 100000000000000000000n) {
|
|
642
|
-
return (
|
|
642
|
+
return (if_neg * (amount / 1000000000000000000n)).toFixed(1) + " QN"
|
|
643
643
|
} else if (amount >= 100000000000000000000n && amount < 1000000000000000000000n) {
|
|
644
|
-
return (
|
|
644
|
+
return (if_neg * (amount / 1000000000000000000n)).toFixed() + " QN"
|
|
645
645
|
} else {
|
|
646
646
|
return "Big"
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
649
|
|
|
650
650
|
function handle_scroll_frame(e) {
|
|
651
|
+
e.preventDefault()
|
|
651
652
|
const res = scroll_frame(
|
|
652
653
|
e,
|
|
653
654
|
chart_prepped.shown_start_x,
|
|
@@ -1047,6 +1048,10 @@ export function create_chart_manager(config) {
|
|
|
1047
1048
|
}
|
|
1048
1049
|
}
|
|
1049
1050
|
|
|
1051
|
+
function set_datasets(input) {
|
|
1052
|
+
datasets = input
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1050
1055
|
function init(config) {
|
|
1051
1056
|
console.log("init_chart", config)
|
|
1052
1057
|
datasets = config?.datasets
|
|
@@ -1080,5 +1085,6 @@ export function create_chart_manager(config) {
|
|
|
1080
1085
|
handle_chart_hover_leave,
|
|
1081
1086
|
set_grid_width,
|
|
1082
1087
|
gen_color,
|
|
1088
|
+
set_datasets,
|
|
1083
1089
|
}
|
|
1084
1090
|
}
|
|
@@ -7,31 +7,56 @@ import { create_field_manager } from "./helpers/Field/index.svelte.js"
|
|
|
7
7
|
export function create_node_manager(config) {
|
|
8
8
|
console.log("create_node_man", config)
|
|
9
9
|
let node_structure = $state(null)
|
|
10
|
+
let is_clickable_only = $state(false)
|
|
11
|
+
let node_path = $state(null)
|
|
12
|
+
let node_types = $state(null)
|
|
13
|
+
let node_type = $state(null)
|
|
14
|
+
let node_value = $state(null)
|
|
15
|
+
let node_categories = $state(null)
|
|
10
16
|
|
|
11
17
|
let preview_text = $derived(
|
|
12
|
-
`${
|
|
13
|
-
config?.node_types?.[config?.node_type]?.output?.type ?? "void"
|
|
14
|
-
})`
|
|
18
|
+
`${node_type}(${node_types?.[node_type]?.input?.type})→(${node_types?.[node_type]?.output?.type ?? "void"})`
|
|
15
19
|
)
|
|
16
20
|
|
|
17
|
-
let full_node_type = $derived(
|
|
18
|
-
let h = $derived(
|
|
21
|
+
let full_node_type = $derived(node_types?.[node_type])
|
|
22
|
+
let h = $derived(node_categories?.[node_types?.[node_type]?.category]?.h || 4)
|
|
19
23
|
|
|
20
|
-
function
|
|
21
|
-
|
|
24
|
+
function handle_drag_start(e) {
|
|
25
|
+
if (is_clickable_only || node_path == "main") {
|
|
26
|
+
e.preventDefault()
|
|
27
|
+
} else if (typeof config?.handle_node_drag_start == "function") {
|
|
28
|
+
config?.handle_node_drag_start()
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function handle_drag_end(e) {
|
|
33
|
+
if (is_clickable_only) {
|
|
34
|
+
e.preventDefault()
|
|
35
|
+
} else if (typeof config?.handle_node_drag_start == "function") {
|
|
36
|
+
config?.handle_node_drag_end()
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function init(config) {
|
|
41
|
+
node_categories = config?.node_categories
|
|
42
|
+
node_path = config?.node_path
|
|
43
|
+
node_types = config?.node_types
|
|
44
|
+
node_type = config?.node_type
|
|
45
|
+
node_value = config?.node_value
|
|
46
|
+
is_clickable_only = !!config?.is_clickable_only
|
|
22
47
|
let node_structure_loc = []
|
|
23
48
|
if (Array.isArray(full_node_type?.node_structure)) {
|
|
24
49
|
for (let i = 0; i < full_node_type?.node_structure.length; i++) {
|
|
25
50
|
let node_item = deep_copy(full_node_type.node_structure?.[i])
|
|
26
51
|
if (node_item?.ui_type == "stack") {
|
|
27
52
|
node_item.stack_area_manager = create_stack_area_manager({
|
|
28
|
-
parent_node_type:
|
|
29
|
-
node_path: [...(Array.isArray(
|
|
53
|
+
parent_node_type: node_type,
|
|
54
|
+
node_path: [...(Array.isArray(node_path) ? node_path : []), node_item?.field].filter(
|
|
30
55
|
(item) => item !== null && item !== undefined
|
|
31
56
|
),
|
|
32
|
-
node_type:
|
|
33
|
-
node_value:
|
|
34
|
-
node_types:
|
|
57
|
+
node_type: node_value?.[node_item?.field]?.type,
|
|
58
|
+
node_value: node_value?.[node_item?.field]?.value,
|
|
59
|
+
node_types: node_types,
|
|
35
60
|
is_preview: false,
|
|
36
61
|
drag_or_select_node: config?.drag_or_select_node,
|
|
37
62
|
handle_node_drag_start: config?.handle_node_drag_start,
|
|
@@ -43,9 +68,9 @@ export function create_node_manager(config) {
|
|
|
43
68
|
if (node_item[j]?.ui_type == "input") {
|
|
44
69
|
node_item[j].field_manager = create_field_manager({
|
|
45
70
|
bar_item: node_item[j],
|
|
46
|
-
node_path:
|
|
47
|
-
node_type:
|
|
48
|
-
node_value:
|
|
71
|
+
node_path: node_path,
|
|
72
|
+
node_type: node_type,
|
|
73
|
+
node_value: node_value,
|
|
49
74
|
is_preview: !!config?.is_preview,
|
|
50
75
|
on_set_node_value: (input) => config?.on_set_node_value(input),
|
|
51
76
|
get_selected_version_node_at_path: (input) => config?.get_selected_version_node_at_path(input),
|
|
@@ -53,13 +78,12 @@ export function create_node_manager(config) {
|
|
|
53
78
|
} else {
|
|
54
79
|
node_item[j].field_manager = create_field_manager({
|
|
55
80
|
bar_item: node_item?.[j],
|
|
56
|
-
parent_node_type:
|
|
57
|
-
node_path: [
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
]
|
|
61
|
-
|
|
62
|
-
node_value: config?.node_value?.[node_item[j]?.field]?.value,
|
|
81
|
+
parent_node_type: node_type,
|
|
82
|
+
node_path: [...(Array.isArray(node_path) ? node_path : []), node_item[j]?.field].filter(
|
|
83
|
+
(item) => item !== null && item !== undefined
|
|
84
|
+
),
|
|
85
|
+
node_type: node_value?.[node_item[j]?.field]?.type,
|
|
86
|
+
node_value: node_value?.[node_item[j]?.field]?.value,
|
|
63
87
|
is_preview: !!config?.is_preview,
|
|
64
88
|
on_set_node_value: (input) => config?.on_set_node_value(input),
|
|
65
89
|
get_selected_version_node_at_path: (input) => config?.get_selected_version_node_at_path(input),
|
|
@@ -71,37 +95,17 @@ export function create_node_manager(config) {
|
|
|
71
95
|
node_structure_loc.push(node_item)
|
|
72
96
|
}
|
|
73
97
|
}
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function handle_drag_start(e) {
|
|
78
|
-
if (config?.is_clickable_only || config?.node_path == "main") {
|
|
79
|
-
e.preventDefault()
|
|
80
|
-
} else if (config?.handle_node_drag_start) {
|
|
81
|
-
config?.handle_node_drag_start()
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function handle_drag_end(e) {
|
|
86
|
-
if (config?.is_clickable_only) {
|
|
87
|
-
e.preventDefault()
|
|
88
|
-
} else if (config?.handle_node_drag_start) {
|
|
89
|
-
config?.handle_node_drag_end()
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function init(config) {
|
|
94
|
-
node_structure = get_node_structure()
|
|
98
|
+
node_structure = node_structure_loc
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
init(config)
|
|
98
102
|
|
|
99
103
|
return {
|
|
100
104
|
get node_path() {
|
|
101
|
-
return
|
|
105
|
+
return node_path
|
|
102
106
|
},
|
|
103
107
|
get node_type() {
|
|
104
|
-
return
|
|
108
|
+
return node_type
|
|
105
109
|
},
|
|
106
110
|
get is_preview() {
|
|
107
111
|
return !!config?.is_preview
|
|
@@ -101,11 +101,11 @@
|
|
|
101
101
|
{/if}
|
|
102
102
|
</div>
|
|
103
103
|
<div class="node_types_container">
|
|
104
|
-
{#if Array.isArray(manager?.
|
|
105
|
-
{#each manager?.
|
|
104
|
+
{#if Array.isArray(manager?.node_toolbox_items_prepped)}
|
|
105
|
+
{#each manager?.node_toolbox_items_prepped as node_toolbox_item_prepped}
|
|
106
106
|
<!-- aaa|{node_toolbox_item} -->
|
|
107
107
|
<!-- <pre>{JSON.stringify(node_toolbox_item, null, 2)}</pre> -->
|
|
108
|
-
<Node manager={
|
|
108
|
+
<Node manager={node_toolbox_item_prepped?.node_manager} />
|
|
109
109
|
{/each}
|
|
110
110
|
{/if}
|
|
111
111
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { create_unique_id, deep_copy, node_types, node_categories } from "../../client/index.js"
|
|
1
|
+
import { create_unique_id, deep_copy, node_types, function_types, node_categories } from "../../client/index.js"
|
|
2
2
|
import { create_button_manager } from "../Button/index.svelte.js"
|
|
3
3
|
import { create_icon_manager } from "../Icon/index.svelte.js"
|
|
4
4
|
import { create_node_manager } from "./Node/index.svelte.js"
|
|
@@ -20,46 +20,49 @@ export function create_function_manager(config) {
|
|
|
20
20
|
let selected_category = $state("main")
|
|
21
21
|
let undo_version_button_manager = $state(null)
|
|
22
22
|
let redo_version_button_manager = $state(null)
|
|
23
|
-
let node_toolbox_items = $state(null)
|
|
24
23
|
let node_category_buttons = $state(null)
|
|
25
24
|
let dragging_node = $state(null)
|
|
26
25
|
let root_node_manager = $state(null)
|
|
27
26
|
let trashcan_icon_manager = $state(null)
|
|
28
27
|
|
|
28
|
+
let node_toolbox_items_prepped = $state(null)
|
|
29
|
+
|
|
29
30
|
let selected_version = $derived(versions?.[selected_version_index])
|
|
30
31
|
|
|
31
|
-
function
|
|
32
|
+
function set_node_toolbox_items_prepped() {
|
|
32
33
|
let node_toolbox_items_loc = []
|
|
33
|
-
if (Object.keys(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
34
|
+
if (Object.keys(function_types || {}).length > 0) {
|
|
35
|
+
console.log("function_types", function_types)
|
|
36
|
+
for (let node_type of Object.keys(function_types || {})) {
|
|
37
|
+
console.log("node_typeddd", node_type, function_types?.[node_type])
|
|
38
|
+
node_toolbox_items_loc.push({
|
|
39
|
+
category: function_types?.[node_type]?.category,
|
|
40
|
+
node_manager: create_node_manager({
|
|
41
|
+
is_clickable_only: false,
|
|
42
|
+
is_preview: true,
|
|
43
|
+
node_type: node_type,
|
|
44
|
+
node_types: function_types,
|
|
45
|
+
node_path,
|
|
46
|
+
node_categories,
|
|
47
|
+
c: 12,
|
|
48
|
+
drag_or_select_node: drag_or_select_node,
|
|
49
|
+
handle_node_drag_start: () =>
|
|
50
|
+
handle_node_drag_start({
|
|
51
|
+
node_path: node_path,
|
|
52
|
+
node_type: node_type,
|
|
53
|
+
}),
|
|
54
|
+
handle_node_drag_end: () =>
|
|
55
|
+
handle_node_drag_end({
|
|
56
|
+
node_path: node_path,
|
|
57
|
+
node_type: node_type,
|
|
58
|
+
}),
|
|
59
|
+
on_set_node_value: (input) => set_node_value(input),
|
|
60
|
+
}),
|
|
61
|
+
})
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
|
-
|
|
64
|
+
console.log("node_toolbox_items_loc", node_toolbox_items_loc)
|
|
65
|
+
node_toolbox_items_prepped = node_toolbox_items_loc
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
function get_node_category_buttons() {
|
|
@@ -83,10 +86,7 @@ export function create_function_manager(config) {
|
|
|
83
86
|
c: 10,
|
|
84
87
|
l: 16,
|
|
85
88
|
selected_type: () => (is_selected ? "selected" : null),
|
|
86
|
-
on_click: () =>
|
|
87
|
-
node_toolbox_items = get_node_toolbox_items() // prob instead do once for all then filter by category
|
|
88
|
-
selected_category = node_category?.id
|
|
89
|
-
},
|
|
89
|
+
on_click: () => (selected_category = node_category?.id),
|
|
90
90
|
}),
|
|
91
91
|
})
|
|
92
92
|
}
|
|
@@ -151,7 +151,7 @@ export function create_function_manager(config) {
|
|
|
151
151
|
if (!node || !Array.isArray(seek_until_node_path) || seek_until_node_path.length == 0) {
|
|
152
152
|
return { defined, is_path_found }
|
|
153
153
|
}
|
|
154
|
-
let full_node_type =
|
|
154
|
+
let full_node_type = function_types?.[node?.type]
|
|
155
155
|
// should add the other define things like in loop or sort or use node kind to find definitions
|
|
156
156
|
// maybe also if im showing type in ui then assignments should update type but prob too difficult to predit with if else stuff
|
|
157
157
|
if (node?.type == "define") {
|
|
@@ -214,21 +214,21 @@ export function create_function_manager(config) {
|
|
|
214
214
|
|
|
215
215
|
function get_default_node_value(node_type) {
|
|
216
216
|
let default_node = null
|
|
217
|
-
if (node_type && Object.keys(
|
|
217
|
+
if (node_type && Object.keys(function_types?.[node_type]?.fields || {}).length > 0) {
|
|
218
218
|
default_node = {
|
|
219
219
|
type: node_type,
|
|
220
220
|
value: {},
|
|
221
221
|
}
|
|
222
|
-
for (let [key, value] of Object.entries(
|
|
222
|
+
for (let [key, value] of Object.entries(function_types?.[node_type]?.fields)) {
|
|
223
223
|
default_node.value[key] = null
|
|
224
224
|
if (value?.forced_node) {
|
|
225
225
|
default_node.value[key] = get_default_node_value(value?.forced_node) // careful about triggering infinate recursion here
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
|
-
} else if (
|
|
228
|
+
} else if (function_types?.[node_type]?.kind == "literal") {
|
|
229
229
|
default_node = {
|
|
230
230
|
type: node_type,
|
|
231
|
-
value:
|
|
231
|
+
value: function_types?.[node_type]?.value ?? null,
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
234
|
return default_node
|
|
@@ -305,7 +305,7 @@ export function create_function_manager(config) {
|
|
|
305
305
|
node_value: node_value,
|
|
306
306
|
is_clickable_only: false,
|
|
307
307
|
is_preview: true,
|
|
308
|
-
node_types,
|
|
308
|
+
node_types: function_types,
|
|
309
309
|
node_categories,
|
|
310
310
|
c: 12,
|
|
311
311
|
handle_node_drag_start: () =>
|
|
@@ -349,10 +349,10 @@ export function create_function_manager(config) {
|
|
|
349
349
|
}
|
|
350
350
|
let drop_area_node_options = []
|
|
351
351
|
if (drop_area_node_type == "stack_literal") {
|
|
352
|
-
drop_area_node_options =
|
|
352
|
+
drop_area_node_options = function_types?.stack_literal?.child_node_options
|
|
353
353
|
} else {
|
|
354
354
|
drop_area_node_options =
|
|
355
|
-
|
|
355
|
+
function_types?.[drop_area_node_type]?.fields?.[
|
|
356
356
|
Array.isArray(drop_area_node_path) ? drop_area_node_path[drop_area_node_path.length - 1] : -1
|
|
357
357
|
]?.node_options
|
|
358
358
|
}
|
|
@@ -466,7 +466,7 @@ export function create_function_manager(config) {
|
|
|
466
466
|
defined[node_path] = { defined_in_node_path: parent_node_path }
|
|
467
467
|
return { logs, output, defined, is_return }
|
|
468
468
|
}
|
|
469
|
-
let found_node_type =
|
|
469
|
+
let found_node_type = function_types?.[structure?.[node_path]?.node_type]?.input
|
|
470
470
|
let crunch_literal_res = crunch_literal(
|
|
471
471
|
deep_copy(structure),
|
|
472
472
|
deep_copy(structure?.[node_path]?.input),
|
|
@@ -500,7 +500,7 @@ export function create_function_manager(config) {
|
|
|
500
500
|
]
|
|
501
501
|
break
|
|
502
502
|
}
|
|
503
|
-
// let found_node_type =
|
|
503
|
+
// let found_node_type = function_types?.[structure?.[input?.defined_function_node_path]?.node_type]?.input
|
|
504
504
|
// let crunch_literal_res = crunch_literal(
|
|
505
505
|
// deep_copy(structure),
|
|
506
506
|
// structure?.[input?.defined_function_node_path]?.input,
|
|
@@ -1122,7 +1122,7 @@ export function create_function_manager(config) {
|
|
|
1122
1122
|
})
|
|
1123
1123
|
node_category_buttons = get_node_category_buttons()
|
|
1124
1124
|
set_root_node_prepped()
|
|
1125
|
-
|
|
1125
|
+
set_node_toolbox_items_prepped()
|
|
1126
1126
|
}
|
|
1127
1127
|
init(config)
|
|
1128
1128
|
|
|
@@ -1149,7 +1149,7 @@ export function create_function_manager(config) {
|
|
|
1149
1149
|
return console_result
|
|
1150
1150
|
},
|
|
1151
1151
|
get node_types() {
|
|
1152
|
-
return
|
|
1152
|
+
return function_types
|
|
1153
1153
|
},
|
|
1154
1154
|
get dragging_node() {
|
|
1155
1155
|
return dragging_node
|
|
@@ -1193,15 +1193,15 @@ export function create_function_manager(config) {
|
|
|
1193
1193
|
get node_category_buttons() {
|
|
1194
1194
|
return node_category_buttons
|
|
1195
1195
|
},
|
|
1196
|
-
get node_toolbox_items() {
|
|
1197
|
-
return node_toolbox_items
|
|
1198
|
-
},
|
|
1199
1196
|
get root_node_manager() {
|
|
1200
1197
|
return root_node_manager
|
|
1201
1198
|
},
|
|
1202
1199
|
get trashcan_icon_manager() {
|
|
1203
1200
|
return trashcan_icon_manager
|
|
1204
1201
|
},
|
|
1202
|
+
get node_toolbox_items_prepped() {
|
|
1203
|
+
return node_toolbox_items_prepped
|
|
1204
|
+
},
|
|
1205
1205
|
update_function,
|
|
1206
1206
|
undo,
|
|
1207
1207
|
redo,
|
|
@@ -214,7 +214,7 @@ export function create_location_manager(config) {
|
|
|
214
214
|
strokeColor: leg.stroke_color || "oklch(70% 0.3 210)",
|
|
215
215
|
lineWidth: leg.line_width || 3,
|
|
216
216
|
})
|
|
217
|
-
const poly_line = new mapkit.
|
|
217
|
+
const poly_line = new mapkit.PolylineOverlay(coords, { style: overlay_style })
|
|
218
218
|
map.addOverlay(poly_line)
|
|
219
219
|
}
|
|
220
220
|
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
|
|
13
13
|
onMount(() => {
|
|
14
14
|
if (!manager?.is_popover) {
|
|
15
|
+
// setTimeout(() => {
|
|
15
16
|
manager?.initialize_map()
|
|
17
|
+
// }, 100)
|
|
16
18
|
}
|
|
17
19
|
})
|
|
18
20
|
</script>
|
|
@@ -60,9 +62,9 @@
|
|
|
60
62
|
{#each manager?.suggestions_prepped as suggestion_prepped}
|
|
61
63
|
<div class="search_item_container">
|
|
62
64
|
<div class="search_item">
|
|
63
|
-
<h3>{suggestion_prepped?.
|
|
64
|
-
{#if suggestion_prepped?.
|
|
65
|
-
<p>{suggestion_prepped?.
|
|
65
|
+
<h3>{suggestion_prepped?.displayLines?.[0]}</h3>
|
|
66
|
+
{#if suggestion_prepped?.displayLines?.[1]}
|
|
67
|
+
<p>{suggestion_prepped?.displayLines?.[1]}</p>
|
|
66
68
|
{/if}
|
|
67
69
|
<!-- {#if Array.isArray(suggestion_prepped?.poi_category) && suggestion_prepped.poi_category.length > 0}
|
|
68
70
|
<div style="display: flex; flex-wrap: wrap; gap: .5rem;">
|
|
@@ -586,6 +586,7 @@ export function create_location_input_manager(config) {
|
|
|
586
586
|
}
|
|
587
587
|
|
|
588
588
|
function prepare_search_options(is_autocomplete = false) {
|
|
589
|
+
console.log("prepare_search_options")
|
|
589
590
|
const result_type = Array.isArray(search_filter_result_type_dropdown_manager?.val)
|
|
590
591
|
? search_filter_result_type_dropdown_manager?.val
|
|
591
592
|
: []
|
|
@@ -637,6 +638,7 @@ export function create_location_input_manager(config) {
|
|
|
637
638
|
)
|
|
638
639
|
)
|
|
639
640
|
}
|
|
641
|
+
console.log("zzz", options)
|
|
640
642
|
return options
|
|
641
643
|
}
|
|
642
644
|
|
|
@@ -646,6 +648,7 @@ export function create_location_input_manager(config) {
|
|
|
646
648
|
return
|
|
647
649
|
}
|
|
648
650
|
const autocomplete_search_options = prepare_search_options(true)
|
|
651
|
+
console.log("autocomplete_search_options", autocomplete_search_options)
|
|
649
652
|
const place_search = new mapkit.Search()
|
|
650
653
|
place_search.autocomplete(
|
|
651
654
|
input,
|
|
@@ -657,6 +660,7 @@ export function create_location_input_manager(config) {
|
|
|
657
660
|
if (result.results.length > 0) {
|
|
658
661
|
let suggestions_prepped_loc = []
|
|
659
662
|
if (Array.isArray(result.results)) {
|
|
663
|
+
console.log("suggestions_results", result.results)
|
|
660
664
|
for (let suggestion of result.results) {
|
|
661
665
|
let choose_selection_button_manager = $state(null)
|
|
662
666
|
if (suggestion?.id) {
|
|
@@ -687,6 +691,7 @@ export function create_location_input_manager(config) {
|
|
|
687
691
|
|
|
688
692
|
function search_for(input) {
|
|
689
693
|
const search_options = prepare_search_options()
|
|
694
|
+
console.log("search_options", search_options)
|
|
690
695
|
map.removeAnnotations(map.annotations)
|
|
691
696
|
const place_search = new mapkit.Search()
|
|
692
697
|
place_search.search(
|