sveltekit-ui 1.0.11 → 1.0.12

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 (56) hide show
  1. package/dist/Components/Content/index.svelte +12 -12
  2. package/dist/Components/Content/index.svelte.js +97 -49
  3. package/dist/Components/ContentInput/AttributesInput/CustomConfig/Dropdown/index.svelte.js +1 -5
  4. package/dist/Components/ContentInput/AttributesInput/CustomConfig/Number/index.svelte.js +1 -2
  5. package/dist/Components/ContentInput/AttributesInput/CustomConfig/Qr/index.svelte.js +1 -3
  6. package/dist/Components/ContentInput/AttributesInput/CustomConfig/Slider/index.svelte.js +2 -4
  7. package/dist/Components/ContentInput/AttributesInput/CustomConfig/TableAdvanced/index.svelte.js +28 -32
  8. package/dist/Components/ContentInput/AttributesInput/CustomConfig/TextInput/index.svelte.js +1 -3
  9. package/dist/Components/ContentInput/AttributesInput/CustomConfig/TimeInput/index.svelte.js +1 -3
  10. package/dist/Components/ContentInput/AttributesInput/DefinedTypeInput/index.svelte.js +3 -13
  11. package/dist/Components/ContentInput/AttributesInput/index.svelte +1 -0
  12. package/dist/Components/ContentInput/AttributesInput/index.svelte.js +89 -120
  13. package/dist/Components/ContentInput/index.svelte.js +38 -62
  14. package/dist/Components/DataTypeInput/index.svelte.js +0 -3
  15. package/dist/Components/IconInput/index.svelte +1 -1
  16. package/dist/Components/TableAdvanced/ColumnInput/index.svelte.js +15 -62
  17. package/dist/Components/TableAdvanced/SortByInput/index.svelte.js +2 -1
  18. package/dist/Components/TableAdvanced/index.svelte.js +72 -73
  19. package/dist/Components/TextInput/index.svelte.js +12 -0
  20. package/dist/Components/VariablePathInput/index.svelte +47 -93
  21. package/dist/Components/VariablePathInput/index.svelte.js +205 -191
  22. package/dist/client/astc_formatting/index.js +15 -58
  23. package/dist/client/docs/index.js +4 -23
  24. package/dist/client/index.js +38 -90
  25. package/dist/client/types/index.js +2 -0
  26. package/dist/index.js +2 -0
  27. package/package.json +4 -4
  28. package/src/lib/Components/Content/index.svelte +12 -12
  29. package/src/lib/Components/Content/index.svelte.js +97 -49
  30. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/Dropdown/index.svelte.js +1 -5
  31. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/Number/index.svelte.js +1 -2
  32. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/Qr/index.svelte.js +1 -3
  33. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/Slider/index.svelte.js +2 -4
  34. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/TableAdvanced/index.svelte.js +28 -32
  35. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/TextInput/index.svelte.js +1 -3
  36. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/TimeInput/index.svelte.js +1 -3
  37. package/src/lib/Components/ContentInput/AttributesInput/DefinedTypeInput/index.svelte.js +3 -13
  38. package/src/lib/Components/ContentInput/AttributesInput/index.svelte +1 -0
  39. package/src/lib/Components/ContentInput/AttributesInput/index.svelte.js +89 -120
  40. package/src/lib/Components/ContentInput/index.svelte.js +38 -62
  41. package/src/lib/Components/DataTypeInput/index.svelte.js +0 -3
  42. package/src/lib/Components/IconInput/index.svelte +1 -1
  43. package/src/lib/Components/TableAdvanced/ColumnInput/index.svelte.js +15 -62
  44. package/src/lib/Components/TableAdvanced/SortByInput/index.svelte.js +2 -1
  45. package/src/lib/Components/TableAdvanced/index.svelte.js +72 -73
  46. package/src/lib/Components/TextInput/index.svelte.js +12 -0
  47. package/src/lib/Components/VariablePathInput/index.svelte +47 -93
  48. package/src/lib/Components/VariablePathInput/index.svelte.js +205 -191
  49. package/src/lib/client/astc_formatting/index.js +15 -58
  50. package/src/lib/client/docs/index.js +4 -23
  51. package/src/lib/client/index.js +38 -90
  52. package/src/lib/client/types/index.js +2 -0
  53. package/src/lib/index.js +2 -0
  54. package/src/routes/[component]/Showcase/Content/index.svelte +49 -83
  55. package/src/routes/[component]/Showcase/ContentInput/index.svelte +11 -13
  56. package/src/routes/[component]/Showcase/TableAdvanced/index.svelte +71 -252
@@ -36,38 +36,50 @@ export function create_content_input_manager(config) {
36
36
  let paste_astc_markdown_finish_button_manager = $state(null)
37
37
  let location_to_add_element = $state(null)
38
38
  let content_manager = $state(null)
39
- let content_overall_manager = $state(null)
40
39
  let attributes_input = $state(null)
41
40
  let focused_selector_id = $state(null)
41
+ let definition_stack = $state([])
42
42
 
43
- let loops = $derived(set_closurable(config?.loops, null))
44
- let variables = $derived(set_closurable(config?.variables, null))
45
- let variables_data_type = $derived(set_closurable(config?.variables_data_type, null) ?? json_to_data_type(variables))
46
43
  let mapkit_js_token = $derived(set_closurable(config?.mapkit_js_token, null))
47
44
 
48
- function increase_loops_on_path(path) {
49
- let cleaned_path = null
50
- if (Array.isArray(path)) {
51
- cleaned_path = []
52
- for (let path_item of path) {
53
- if (Array.isArray(path_item)) {
54
- if (path_item?.[0] == "loops" && typeof path_item?.[1] == "number") {
55
- cleaned_path.push(["loops", path_item?.[1] + 1])
56
- } else {
57
- cleaned_path.push(increase_loops_on_path(path_item))
45
+ function pass_event_down(input) {
46
+ if (typeof content_manager?.pass_event_down == "function") {
47
+ content_manager?.pass_event_down(input)
48
+ }
49
+ }
50
+
51
+ function get_defined_at_selector_id(selector_id) {
52
+ function traverse(input) {
53
+ let defined = {}
54
+ if (input?.type_id == selector_id) {
55
+ return { defined, is_found_selector_id: true }
56
+ } else if (input?.type_id == "loop") {
57
+ defined[input?.attributes?.iter_identifier] = { type: "text_literal" }
58
+ }
59
+ if (Array.isArray(input?.children)) {
60
+ for (let child of input?.children) {
61
+ let res = traverse(child)
62
+ defined = { ...defined, ...res?.defined }
63
+ if (res?.is_found_selector_id) {
64
+ break
58
65
  }
59
- } else {
60
- cleaned_path.push(path_item)
61
66
  }
62
67
  }
68
+ return { defined }
63
69
  }
64
- return cleaned_path
70
+ return traverse(versions?.[selected_version_index])?.defined
65
71
  }
66
72
 
67
- function pass_event_down(input) {
68
- if (typeof content_manager?.pass_event_down == "function") {
69
- content_manager?.pass_event_down(input)
70
- }
73
+ function get_defined_options(selector_id) {
74
+ const defined_at_selector_id = get_defined_at_selector_id(selector_id)
75
+ const defined_data_type = json_to_data_type(Object.assign({}, ...[...definition_stack].reverse()))
76
+ return Object.entries({ ...(defined_data_type?.properties || {}), ...defined_at_selector_id }).map(
77
+ ([key, val]) => ({
78
+ key,
79
+ name: key,
80
+ data_type: val,
81
+ })
82
+ )
71
83
  }
72
84
 
73
85
  function set_selected_version(version_index) {
@@ -79,20 +91,13 @@ export function create_content_input_manager(config) {
79
91
  on_event: config?.on_event,
80
92
  storage_path: storage_path,
81
93
  mapkit_js_token: mapkit_js_token,
82
- variables: () => variables,
83
- loops: () => loops,
84
- })
85
- content_overall_manager = create_content_overall_manager()
86
- }
87
-
88
- function create_content_overall_manager() {
89
- return {
94
+ definition_stack: definition_stack,
90
95
  get focused_selector_id() {
91
96
  return focused_selector_id
92
97
  },
93
98
  set_focused_selector_id,
94
99
  open_edit_element_attributes_popover,
95
- }
100
+ })
96
101
  }
97
102
 
98
103
  function prep_element(element) {
@@ -123,7 +128,6 @@ export function create_content_input_manager(config) {
123
128
  })
124
129
  function open_edit_attributes_popover() {
125
130
  attributes_input.init({
126
- variables_data_type: () => variables_data_type,
127
131
  storage: storage,
128
132
  storage_default_folder_path: storage_default_folder_path,
129
133
  storage_path: storage_path,
@@ -133,8 +137,8 @@ export function create_content_input_manager(config) {
133
137
  content_type: element?.type_id,
134
138
  selector_id: element?.selector_id,
135
139
  val: element?.attributes,
140
+ get_defined_options: () => get_defined_options(element?.selector_id),
136
141
  on_finish: (input) => {
137
- console.log("on_finish_attribute", input)
138
142
  attributes_input.popover_manager.close()
139
143
  set_element_attributes(element?.selector_id, input)
140
144
  },
@@ -387,7 +391,6 @@ export function create_content_input_manager(config) {
387
391
  }
388
392
 
389
393
  function add_version(version) {
390
- // let new_version = version ? version : convert_prepped_to_version(selected_version_prepped)
391
394
  versions = [deep_copy(version), ...versions.slice(selected_version_index)]
392
395
  selected_version_index = 0
393
396
  set_selected_version(0)
@@ -396,25 +399,6 @@ export function create_content_input_manager(config) {
396
399
  }
397
400
  }
398
401
 
399
- // function convert_prepped_to_version(version_prepped) {
400
- // let element = version_prepped?.element
401
- // let cleaned_children = []
402
- // if (Array.isArray(element?.children)) {
403
- // for (let child of element?.children) {
404
- // if (Array.isArray(child)) {
405
- // let sub_children = []
406
- // for (let sub_child of child) {
407
- // sub_children.push(convert_prepped_to_version(sub_child))
408
- // }
409
- // cleaned_children.push(convert_prepped_to_version(sub_children))
410
- // } else {
411
- // cleaned_children.push(convert_prepped_to_version(child))
412
- // }
413
- // }
414
- // }
415
- // return { ...element, children: cleaned_children }
416
- // }
417
-
418
402
  function copy_markdown() {
419
403
  copy_to_clipboard(astc_to_markdown(selected_version_prepped?.element))
420
404
  }
@@ -861,6 +845,7 @@ export function create_content_input_manager(config) {
861
845
  }
862
846
 
863
847
  function init(config) {
848
+ definition_stack = config?.definition_stack ?? []
864
849
  versions = [config?.val]
865
850
  storage = config?.storage
866
851
  storage_default_folder_path = config?.storage_default_folder_path
@@ -952,10 +937,10 @@ export function create_content_input_manager(config) {
952
937
  },
953
938
  })
954
939
  attributes_input = create_attributes_input_manager({
955
- variables_data_type: () => variables_data_type,
956
940
  storage: storage,
957
941
  storage_default_folder_path: storage_default_folder_path,
958
942
  storage_path: storage_path,
943
+ get_defined_options: get_defined_options,
959
944
  })
960
945
  set_selected_version(0)
961
946
  }
@@ -967,12 +952,6 @@ export function create_content_input_manager(config) {
967
952
  get val() {
968
953
  return versions?.[selected_version_index]
969
954
  },
970
- get variables_data_type() {
971
- return variables_data_type
972
- },
973
- get variables() {
974
- return variables
975
- },
976
955
  get versions_len() {
977
956
  return versions_len
978
957
  },
@@ -1021,9 +1000,6 @@ export function create_content_input_manager(config) {
1021
1000
  get content_manager() {
1022
1001
  return content_manager
1023
1002
  },
1024
- get content_overall_manager() {
1025
- return content_overall_manager
1026
- },
1027
1003
  get attributes_input() {
1028
1004
  return attributes_input
1029
1005
  },
@@ -542,9 +542,6 @@ export function create_data_type_input_manager(config) {
542
542
  get guess_from_variables_button_manager() {
543
543
  return guess_from_variables_button_manager
544
544
  },
545
- get data_sample() {
546
- return data_sample
547
- },
548
545
  get type_options() {
549
546
  return type_options
550
547
  },
@@ -9,7 +9,7 @@
9
9
  </script>
10
10
 
11
11
  {#snippet selected_icon()}
12
- <div style="display: flex; gap: 1rem; align-items: center;">
12
+ <div style="display: flex; gap: 1rem; align-items: center; color: var(--g2-t);">
13
13
  {manager?.icon_options.find((h) => h.key == (manager?.is_icon_only ? manager?.val : manager?.val?.icon))?.name ??
14
14
  (manager?.is_icon_only ? manager?.val : manager?.val?.icon) ??
15
15
  "Select Icon"}
@@ -10,9 +10,8 @@ import { create_data_type_input_manager } from "../../DataTypeInput/index.svelte
10
10
  import {
11
11
  set_closurable,
12
12
  node_types,
13
- deep_copy,
14
13
  variables_data_type_remaining_to_astc,
15
- set_content_variables,
14
+ set_definition_stack,
16
15
  astc_element,
17
16
  } from "../../../client/index.js"
18
17
 
@@ -49,13 +48,11 @@ export function create_column_input_manager(config) {
49
48
  let delete_column_cancel_button_manager = $state(null)
50
49
 
51
50
  let rows_data_from_variable_path = $derived(set_closurable(config?.rows_data_from_variable_path, null))
52
- let variables = $derived(set_closurable(config?.variables, null))
53
- let variables_data_type = $derived(set_closurable(config?.variables_data_type, null))
54
51
  let columns = $derived(set_closurable(config?.columns, null))
55
52
  let columns_length = $derived(Object.keys(columns || {}).length)
56
53
  let row_data_type = $derived(set_closurable(config?.row_data_type, null))
57
54
  let column_id = $derived(set_closurable(config?.column_id, null))
58
- let loops = $derived(set_closurable(config?.loops, null))
55
+ let definition_stack = $derived(set_closurable(config?.definition_stack, null))
59
56
  let is_column_update = $derived(set_closurable(config?.is_column_update, true))
60
57
  let column_input_options = $derived(set_closurable(config?.column_input_options, null))
61
58
 
@@ -68,46 +65,6 @@ export function create_column_input_manager(config) {
68
65
  : null
69
66
  )
70
67
 
71
- let variables_data_type_with_this_col = $derived(get_variables_data_type_with_this_col())
72
- function get_variables_data_type_with_this_col() {
73
- if (
74
- column_id_text_input_manager?.val &&
75
- !column_id_text_warning &&
76
- column_is_db_column_checkbox_manager?.val &&
77
- column_db_data_type_input_manager?.val
78
- ) {
79
- const path_to_set = [...rows_data_from_variable_path]
80
- let variables_data_type_combined_loc = $state(
81
- deep_copy({
82
- type: "object_literal",
83
- properties: {
84
- variables: variables_data_type,
85
- loops: { type: "loop" },
86
- },
87
- })
88
- )
89
- let target = variables_data_type_combined_loc
90
- for (let i = 0; i < path_to_set.length; i++) {
91
- if (target?.type === "loop") {
92
- target = target.items
93
- } else if (target?.type === "object_literal") {
94
- if (!target.properties) {
95
- target.properties = {}
96
- }
97
- target = target.properties[path_to_set[i]]
98
- }
99
- if (target === undefined) {
100
- break
101
- }
102
- }
103
- if (target?.items?.type === "object_literal" && target?.items?.properties) {
104
- target.items.properties[column_id_text_input_manager?.val] = column_db_data_type_input_manager?.val
105
- }
106
- return variables_data_type_combined_loc?.properties?.variables
107
- }
108
- return variables_data_type
109
- }
110
-
111
68
  let column_data_postgres_type = $derived(
112
69
  column_db_data_type_input_manager?.val?.type == "array_uniform_literal" &&
113
70
  column_db_data_type_input_manager?.val?.items?.type == "text_literal"
@@ -158,24 +115,20 @@ export function create_column_input_manager(config) {
158
115
  val: config?.val?.header_content ?? null,
159
116
  storage: null,
160
117
  storage_default_folder_path: null,
161
- variables_data_type: () => variables_data_type_with_this_col,
162
- variables: () => variables,
163
- loops: () => loops,
118
+ definition_stack: definition_stack,
164
119
  on_event: (input) => {
165
- console.log("set_content_variables_tbd400", input)
166
- // set_content_variables(input)
120
+ console.log("set_definition_stack_tbd400", input)
121
+ set_definition_stack(input)
167
122
  },
168
123
  })
169
124
  body_content_input_manager = create_content_input_manager({
170
125
  val: config?.val?.body_content ?? null,
171
126
  storage: config?.storage,
172
127
  storage_default_folder_path: null,
173
- variables_data_type: () => variables_data_type_with_this_col,
174
- variables: () => variables,
175
- loops: () => [0, ...(Array.isArray(loops) ? loops : [])],
128
+ definition_stack: () => definition_stack,
176
129
  on_event: (input) => {
177
- console.log("set_content_variables_tbd401")
178
- // set_content_variables(input)
130
+ console.log("set_definition_stack_tbd33")
131
+ set_definition_stack(input)
179
132
  },
180
133
  })
181
134
  column_description_text_input_manager = create_text_input_manager({
@@ -234,23 +187,23 @@ export function create_column_input_manager(config) {
234
187
  val: config?.val?.is_db_column ?? column_input_options?.is_db_column?.default_value ?? false,
235
188
  })
236
189
  column_db_data_type_input_manager = create_data_type_input_manager({
237
- data_sample: () => variables,
190
+ // data_sample: () => variables,
238
191
  table_options: config?.table_options,
239
192
  val: config?.val?.db_data_type ?? row_data_type?.properties?.[column_id_text_input_manager?.val],
240
193
  on_finish: (input) => {
241
- let default_content_input_astc = variables_data_type_remaining_to_astc(input, "input", ["variables"])
194
+ let default_content_input_astc = variables_data_type_remaining_to_astc(input, "input", ["rows"])
242
195
  column_default_value_content_manager = create_content_manager({
243
196
  val: default_content_input_astc,
244
197
  table_options: config?.table_options,
245
198
  on_search_table_row_ids: config?.on_search_table_row_ids,
246
- variables: () => default_value,
199
+ definition_stack: () => definition_stack,
247
200
  on_event: (input) => {
248
- const res = set_content_variables(
201
+ const res = set_definition_stack(
249
202
  input,
250
- { variables: default_value },
203
+ definition_stack,
251
204
  column_default_value_content_manager?.pass_event_down
252
205
  )
253
- default_value = res?.variables
206
+ definition_stack = res?.definition_stack
254
207
  return res
255
208
  },
256
209
  })
@@ -325,7 +278,7 @@ export function create_column_input_manager(config) {
325
278
  let guessed_column_display_content = variables_data_type_remaining_to_astc(
326
279
  column_db_data_type_input_manager?.val,
327
280
  "display",
328
- ["variables", "rows", ["loops", 0], column_id_text_input_manager.val]
281
+ ["rows", ["row_i"], column_id_text_input_manager.val]
329
282
  )
330
283
  console.log("guessed_column_display_content", guessed_column_display_content)
331
284
  body_content_input_manager.add_version(guessed_column_display_content)
@@ -91,7 +91,8 @@ export function create_sort_by_input_manager(config) {
91
91
  })
92
92
  let data_row_variable_path_input_manager = create_variable_path_input_manager({
93
93
  is_popover: false,
94
- variables_data_type: () => row_data_type,
94
+ defined_data_type: row_data_type,
95
+ get_defined_options: config?.get_defined_options,
95
96
  val: sorts?.[i]?.data_row_variable_path ?? null,
96
97
  })
97
98
  sorts_prepped_loc.push({
@@ -16,7 +16,7 @@ import {
16
16
  create_unique_id,
17
17
  set_closurable,
18
18
  get_data_type_at_path,
19
- set_content_variables,
19
+ set_definition_stack,
20
20
  } from "../../client/index.js"
21
21
  import { tick } from "svelte"
22
22
  import { browser } from "$app/environment"
@@ -26,12 +26,11 @@ import { browser } from "$app/environment"
26
26
  export function create_table_advanced_manager(config) {
27
27
  const id = create_unique_id(null, 20)
28
28
 
29
- let variables = $derived(set_closurable(config?.variables, null))
30
- let loops = $derived(set_closurable(config?.loops, null))
31
-
29
+ let mapkit_js_token = $state(null)
30
+ let definition_stack = $state(null)
31
+ let row_iter_identifier = $state(null)
32
32
  let rows_data_from_variable_path = $state(null)
33
33
  let row_input_content = $state(null)
34
- let variables_data_type = $state(null)
35
34
  let is_data_editable = $state(null)
36
35
  let nav_items = $state(null)
37
36
  let is_paginate = $state(null)
@@ -107,29 +106,12 @@ export function create_table_advanced_manager(config) {
107
106
  let is_loading_rows = $state(false)
108
107
  let loading_rows_progress = $state(0)
109
108
 
110
- let row_data_type = $derived(
111
- get_data_type(variables_data_type, config?.val?.rows_data_from_variable_path ?? null)?.items
112
- )
113
-
114
- let mapkit_js_token = $derived(set_closurable(config?.mapkit_js_token, null))
115
-
116
- function get_data_type(variables_data_type, data) {
117
- let full_data_type = {
118
- name: "Object",
119
- type: "object_literal",
120
- properties: {
121
- variables: variables_data_type,
122
- loops: { type: "loop" },
123
- },
124
- }
125
- return get_data_type_at_path(data, full_data_type)
126
- }
109
+ let rows_data = $derived(get_def_from_variable_path(rows_data_from_variable_path))
110
+ let row_data_type = $state(null)
127
111
 
128
112
  let row_indexes_display_order = $derived(get_available_row_indexes())
129
113
  let row_indexes_display_order_shown = $derived(get_row_indexes_shown())
130
114
 
131
- let rows_data = $derived(get_variable_from_path(set_closurable(rows_data_from_variable_path, null)))
132
-
133
115
  let cur_page_to_use = $derived(
134
116
  !Array.isArray(row_indexes_display_order) || row_indexes_display_order.length < rows_per_page_dropdown_manager?.val
135
117
  ? 1
@@ -144,25 +126,51 @@ export function create_table_advanced_manager(config) {
144
126
  : []
145
127
  )
146
128
 
147
- function get_variable_from_path(path, combined_variables_input = null) {
148
- if (Array.isArray(path)) {
149
- let combined_variables_loc = deep_copy(
150
- combined_variables_input ?? {
151
- variables: variables,
152
- loops: loops,
129
+ function get_def(input, definition_stack_loc) {
130
+ let definition_stack_to_use = definition_stack_loc ?? definition_stack
131
+ if (Array.isArray(definition_stack_to_use)) {
132
+ for (let item of definition_stack_to_use) {
133
+ if (item.hasOwnProperty(input)) {
134
+ return item?.[input]
153
135
  }
154
- )
155
- for (let path_item of path) {
156
- if (Array.isArray(path_item)) {
157
- let sub_val_from_path = get_variable_from_path(path_item)
158
- combined_variables_loc = combined_variables_loc?.[sub_val_from_path]
136
+ }
137
+ }
138
+ return null
139
+ }
140
+
141
+ function get_def_from_variable_path(input, definition_stack_loc) {
142
+ let val = null
143
+ if (Array.isArray(input) && input.length > 0) {
144
+ val = get_def(input?.[0], definition_stack_loc)
145
+ for (let i = 1; i < input.length; i++) {
146
+ if (Array.isArray(input?.[i])) {
147
+ const res = get_def_from_variable_path(input?.[i], definition_stack_loc)
148
+ val = val?.[res]
159
149
  } else {
160
- combined_variables_loc = combined_variables_loc?.[path_item]
150
+ val = val?.[input?.[i]]
161
151
  }
162
152
  }
163
- return combined_variables_loc
164
153
  }
165
- return null
154
+ return val
155
+ }
156
+
157
+ function is_defined(input) {
158
+ for (let item of definition_stack) {
159
+ if (item.hasOwnProperty(input)) {
160
+ return true
161
+ }
162
+ }
163
+ return false
164
+ }
165
+
166
+ function set_def(identifier, value) {
167
+ console.log("set_def", identifier, value)
168
+ for (let i = 0; i < definition_stack.length; i++) {
169
+ if (definition_stack[i].hasOwnProperty(identifier)) {
170
+ definition_stack[i][identifier] = value
171
+ }
172
+ }
173
+ console.log("definition_stack_after_Set", definition_stack)
166
174
  }
167
175
 
168
176
  function get_available_row_indexes() {
@@ -185,7 +193,7 @@ export function create_table_advanced_manager(config) {
185
193
  // for (let sort_by_item of sort_by_input_manager?.val) {
186
194
  // // sort_by_item?.is_ascending
187
195
  // // sort_by_item?.data_row_variable_path
188
- // // const val_at_path = get_variable_from_path(sort_by_item?.data_row_variable_path)
196
+ // // const val_at_path = get_def_from_variable_path(sort_by_item?.data_row_variable_path)
189
197
  // }
190
198
  // }
191
199
  return row_indexes
@@ -205,6 +213,7 @@ export function create_table_advanced_manager(config) {
205
213
  const raf = () => (browser ? new Promise(requestAnimationFrame) : new Promise((r) => setTimeout(r, 0)))
206
214
 
207
215
  async function set_rows_prepped(columns_prepped_input) {
216
+ console.log("set_rows_prepped", rows_data)
208
217
  is_loading_rows = true
209
218
  rows_prepped = []
210
219
  loading_rows_progress = 0
@@ -229,9 +238,9 @@ export function create_table_advanced_manager(config) {
229
238
  }
230
239
 
231
240
  function get_row_prepped(columns_prepped_input, row_data, row_i) {
241
+ console.log("get_row_prepped", { row_data, row_i, ds: [{ [row_iter_identifier]: row_i }, ...definition_stack] })
232
242
  let searchable_text = ""
233
243
  let columns_prepped_loc = {}
234
-
235
244
  if (Array.isArray(column_ids_display_order)) {
236
245
  for (let column_id of column_ids_display_order) {
237
246
  let content_manager = create_content_manager({
@@ -242,8 +251,7 @@ export function create_table_advanced_manager(config) {
242
251
  config?.on_event(input)
243
252
  }
244
253
  },
245
- variables: () => variables,
246
- loops: [row_i, ...(Array.isArray(loops) ? loops : [])],
254
+ definition_stack: [{ [row_iter_identifier]: row_i }, ...definition_stack],
247
255
  // storage_path: () => storage_path,
248
256
  // is_dark_theme: () => is_dark_theme,
249
257
  })
@@ -312,8 +320,7 @@ export function create_table_advanced_manager(config) {
312
320
  config?.on_change(input)
313
321
  }
314
322
  },
315
- variables: () => variables,
316
- loops: loops,
323
+ definition_stack: definition_stack,
317
324
  // storage_path: () => storage_path,
318
325
  // is_dark_theme: () => is_dark_theme,
319
326
  })
@@ -407,9 +414,8 @@ export function create_table_advanced_manager(config) {
407
414
  column_input_options: config?.column_input_options,
408
415
  table_options: config?.table_options,
409
416
  on_search_table_row_ids: config?.on_search_table_row_ids,
410
- variables_data_type: () => variables_data_type,
411
- variables: () => variables,
412
- loops: () => loops,
417
+ defined_data_type: () => defined_data_type,
418
+ definition_stack: () => definition_stack,
413
419
  columns: () => columns_prepped,
414
420
  rows_data_from_variable_path: () => rows_data_from_variable_path,
415
421
  row_data_type: () => row_data_type,
@@ -512,16 +518,11 @@ export function create_table_advanced_manager(config) {
512
518
 
513
519
  function edit_row(row_i) {
514
520
  row_edit_index = row_i
515
- let variables_combined_loc = $state(
516
- deep_copy({
517
- variables,
518
- loops: loops,
519
- })
520
- )
521
- const path_to_set = [...rows_data_from_variable_path, typeof row_i == "number" ? row_i : 0]
522
- if (typeof row_i != "number") {
521
+ let definition_stack_loc = $state([{ [row_iter_identifier]: row_i }, ...definition_stack])
522
+ const path_to_set = [...rows_data_from_variable_path, Number.isInteger(row_i) ? row_i : 0]
523
+ if (!Number.isInteger(row_i)) {
523
524
  let row_default_to_insert = null //tbd
524
- let target = variables_combined_loc
525
+ let target = definition_stack_loc
525
526
  for (let i = 0; i < path_to_set.length - 1; i++) {
526
527
  target = target[path_to_set[i]]
527
528
  if (target === undefined) break
@@ -536,20 +537,20 @@ export function create_table_advanced_manager(config) {
536
537
  row_edit_content_manager = null
537
538
  setTimeout(() => {
538
539
  // quick fix for when update row then edit a diff row the data for other doesnt remain in place
540
+ console.log("row_input_content2222", { row_input_content, ds: [{ row_i }, ...definition_stack] })
539
541
  row_edit_content_manager = create_content_manager({
540
542
  val: row_input_content ?? null,
541
543
  storage_items: null, // tbd
542
544
  table_options: config?.table_options,
543
545
  mapkit_js_token: mapkit_js_token,
544
546
  on_search_table_row_ids: config?.on_search_table_row_ids,
545
- variables_data_type: () => variables_data_type,
546
- variables: () => variables_combined_loc?.variables,
547
- loops: () => [row_i ?? 0, ...(Array.isArray(loops) ? loops : [])],
547
+ definition_stack: [{ row_i }, ...definition_stack],
548
548
  on_event: (input) => {
549
- console.log("on_event00", input)
550
- const res = set_content_variables(input, variables_combined_loc)
551
- variables_combined_loc.variables = res?.variables
552
- const row_data = get_variable_from_path(path_to_set, variables_combined_loc)
549
+ console.log("on_event_edit_row00", input)
550
+ const res = set_definition_stack(input, definition_stack_loc)
551
+ console.log("on_event_edit_row_res00", res)
552
+ definition_stack_loc = res?.definition_stack
553
+ const row_data = get_def_from_variable_path(path_to_set, definition_stack_loc)
553
554
  return {
554
555
  is_success: true,
555
556
  data: {
@@ -561,12 +562,13 @@ export function create_table_advanced_manager(config) {
561
562
  })
562
563
  let upsert_row_is_loading = $state(false)
563
564
  row_edit_upsert_row_button_manager = create_button_manager({
564
- text: typeof row_i == "number" ? "Update Row" : "Insert Row",
565
+ text: Number.isInteger(row_i) ? "Update Row" : "Insert Row",
565
566
  is_loading: () => upsert_row_is_loading,
566
567
  on_click: async () => {
567
568
  upsert_row_is_loading = true
568
- const row_data = get_variable_from_path(path_to_set, variables_combined_loc)
569
- if (typeof row_i == "number") {
569
+ const row_data = get_def_from_variable_path(path_to_set, definition_stack_loc)
570
+ console.log("edited_row", { definition_stack_loc, row_data })
571
+ if (Number.isInteger(row_i)) {
570
572
  if (typeof config?.on_event == "function") {
571
573
  const res = await config?.on_event({
572
574
  type: "update_row",
@@ -678,7 +680,6 @@ export function create_table_advanced_manager(config) {
678
680
  function set_attributes(attributes) {
679
681
  rows_data_from_variable_path = attributes?.rows_data_from_variable_path
680
682
  row_input_content = attributes?.row_input_content
681
- variables_data_type = attributes?.variables_data_type
682
683
  is_data_editable = attributes?.is_data_editable ?? false
683
684
  nav_items = Array.isArray(attributes?.nav_items)
684
685
  ? attributes.nav_items.filter((item) =>
@@ -707,6 +708,10 @@ export function create_table_advanced_manager(config) {
707
708
  table_id = config?.table_id
708
709
  table_name = config?.table_name
709
710
  table_description = config?.table_description
711
+ rows_data_from_variable_path = config?.rows_data_from_variable_path
712
+ row_iter_identifier = config?.row_iter_identifier
713
+ definition_stack = config?.definition_stack
714
+ mapkit_js_token = config?.mapkit_js_token
710
715
  set_attributes(config)
711
716
  table_search_text_input_manager = create_text_input_manager({
712
717
  type: "search",
@@ -1313,9 +1318,6 @@ export function create_table_advanced_manager(config) {
1313
1318
  get columns_prepped() {
1314
1319
  return columns_prepped
1315
1320
  },
1316
- get variables() {
1317
- return variables
1318
- },
1319
1321
  get bulk_select_all_rows_toggle_checkbox_manager() {
1320
1322
  return bulk_select_all_rows_toggle_checkbox_manager
1321
1323
  },
@@ -1406,9 +1408,6 @@ export function create_table_advanced_manager(config) {
1406
1408
  get settings_delete_table_button_manager() {
1407
1409
  return settings_delete_table_button_manager
1408
1410
  },
1409
- get variables_data_type() {
1410
- return variables_data_type
1411
- },
1412
1411
  init,
1413
1412
  set_table_search_text_input,
1414
1413
  set_rows_prepped,
@@ -230,6 +230,18 @@ export function create_text_input_manager(config) {
230
230
 
231
231
  function set_type(input) {
232
232
  type = input
233
+ if (typeof window === "undefined") {
234
+ return
235
+ }
236
+ is_text_hidden = !!input
237
+ let input_el = document?.querySelector(`#input_${id}`)
238
+ if (input_el) {
239
+ if (!!input) {
240
+ input_el.type = "text"
241
+ } else {
242
+ input_el.type = input
243
+ }
244
+ }
233
245
  }
234
246
 
235
247
  async function finish() {