sveltekit-ui 1.0.6 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sveltekit-ui",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "A SvelteKit UI component library for building modern web applications",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -19,19 +19,19 @@
19
19
  "dependencies": {
20
20
  "context-filter-polyfill": "^0.3.23",
21
21
  "qr-code-styling": "^1.9.2",
22
- "svelte": "^5.35.3"
22
+ "svelte": "^5.35.5"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "@sveltejs/kit": "^2.22.2"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@sveltejs/adapter-vercel": "^5.7.2",
29
- "@sveltejs/kit": "^2.22.2",
29
+ "@sveltejs/kit": "^2.22.3",
30
30
  "@sveltejs/package": "^2.3.12",
31
31
  "@sveltejs/vite-plugin-svelte": "^5.1.0",
32
32
  "@vercel/analytics": "^1.5.0",
33
33
  "typescript": "^5.8.3",
34
- "vite": "^7.0.2"
34
+ "vite": "^7.0.3"
35
35
  },
36
36
  "homepage": "https://www.sveltekit-ui.com",
37
37
  "keywords": [
@@ -160,7 +160,6 @@ export function create_field_manager(config) {
160
160
  )
161
161
 
162
162
  function init(config) {
163
- console.log("jj", config?.bar_item, typeof config?.bar_item)
164
163
  bar_item = config?.bar_item ? deep_copy(config?.bar_item) : null
165
164
  manager = get_manager()
166
165
  }
@@ -7,31 +7,56 @@ import { create_field_manager } from "$lib/Components/FunctionInput/Node/helpers
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
- `${config?.node_type}(${config?.node_types?.[config?.node_type]?.input?.type})→(${
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(config?.node_types?.[config?.node_type])
18
- let h = $derived(config?.node_categories?.[config?.node_types?.[config?.node_type]?.category]?.h || 4)
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 get_node_structure() {
21
- console.log("get_node_structure", deep_copy({ config, full_node_type }))
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: config?.node_type,
29
- node_path: [...(Array.isArray(config?.node_path) ? config?.node_path : []), node_item?.field].filter(
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: config?.node_value?.[node_item?.field]?.type,
33
- node_value: config?.node_value?.[node_item?.field]?.value,
34
- node_types: config?.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: config?.node_path,
47
- node_type: config?.node_type,
48
- node_value: config?.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: config?.node_type,
57
- node_path: [
58
- ...(Array.isArray(config?.node_path) ? config?.node_path : []),
59
- node_item[j]?.field,
60
- ].filter((item) => item !== null && item !== undefined),
61
- node_type: config?.node_value?.[node_item[j]?.field]?.type,
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
- return node_structure_loc
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 config?.node_path
105
+ return node_path
102
106
  },
103
107
  get node_type() {
104
- return config?.node_type
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?.node_toolbox_items)}
105
- {#each manager?.node_toolbox_items as node_toolbox_item}
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={node_toolbox_item} />
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 "$lib/client/index.js"
1
+ import { create_unique_id, deep_copy, node_types, function_types, node_categories } from "$lib/client/index.js"
2
2
  import { create_button_manager } from "$lib/Components/Button/index.svelte.js"
3
3
  import { create_icon_manager } from "$lib/Components/Icon/index.svelte.js"
4
4
  import { create_node_manager } from "$lib/Components/FunctionInput/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 get_node_toolbox_items() {
32
+ function set_node_toolbox_items_prepped() {
32
33
  let node_toolbox_items_loc = []
33
- if (Object.keys(node_types || {}).length > 0) {
34
- for (let node_type of Object.keys(node_types || {})) {
35
- if (node_types?.[node_type]?.category == selected_category) {
36
- node_toolbox_items_loc.push(
37
- create_node_manager({
38
- is_clickable_only: false,
39
- is_preview: true,
40
- node_type: node_type,
41
- node_types,
42
- node_path,
43
- node_categories,
44
- c: 12,
45
- drag_or_select_node: drag_or_select_node,
46
- handle_node_drag_start: () =>
47
- handle_node_drag_start({
48
- node_path: node_path,
49
- node_type: node_type,
50
- }),
51
- handle_node_drag_end: () =>
52
- handle_node_drag_end({
53
- node_path: node_path,
54
- node_type: node_type,
55
- }),
56
- on_set_node_value: (input) => set_node_value(input),
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
- return node_toolbox_items_loc
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 = node_types?.[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(node_types?.[node_type]?.fields || {}).length > 0) {
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(node_types?.[node_type]?.fields)) {
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 (node_types?.[node_type]?.kind == "literal") {
228
+ } else if (function_types?.[node_type]?.kind == "literal") {
229
229
  default_node = {
230
230
  type: node_type,
231
- value: node_types?.[node_type]?.value ?? null,
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 = node_types?.stack_literal?.child_node_options
352
+ drop_area_node_options = function_types?.stack_literal?.child_node_options
353
353
  } else {
354
354
  drop_area_node_options =
355
- node_types?.[drop_area_node_type]?.fields?.[
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 = node_types?.[structure?.[node_path]?.node_type]?.input
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 = node_types?.[structure?.[input?.defined_function_node_path]?.node_type]?.input
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
- node_toolbox_items = get_node_toolbox_items()
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 node_types
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.Poly_lineOverlay(coords, { style: overlay_style })
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?.display_lines?.[0]}</h3>
64
- {#if suggestion_prepped?.display_lines?.[1]}
65
- <p>{suggestion_prepped?.display_lines?.[1]}</p>
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(