sveltekit-ui 1.0.34 → 1.0.36

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.
@@ -93,14 +93,12 @@ export function create_content_manager(config) {
93
93
  let cleaned_path = []
94
94
  if (Array.isArray(input) && input.length > 0) {
95
95
  let is_def = is_defined(input?.[0], definition_stack)
96
- console.log("is_def", { is_def, item: input?.[0] })
97
96
  if (!is_def) {
98
97
  return []
99
98
  }
100
99
  for (let item of input) {
101
100
  if (Array.isArray(item)) {
102
101
  const res = get_def_from_variable_path(item, definition_stack)
103
- console.log("get_def_from_variable_path", { item, res })
104
102
  cleaned_path.push(res)
105
103
  } else {
106
104
  cleaned_path.push(item)
@@ -115,7 +113,6 @@ export function create_content_manager(config) {
115
113
  return
116
114
  }
117
115
  let cleaned_path = clean_variable_path(path)
118
- console.log("set_variable_at_path88", deep_copy({ path, value, type, cleaned_path, definition_stack }))
119
116
  if (typeof config?.on_event == "function") {
120
117
  if (type == "insert") {
121
118
  return config?.on_event({
@@ -363,7 +360,6 @@ export function create_content_manager(config) {
363
360
  children: [],
364
361
  }
365
362
  } else if (val_loc?.type_id == "color_input") {
366
- console.log("color_input555", val_loc?.attributes)
367
363
  return {
368
364
  type_id: val_loc?.type_id,
369
365
  selector_id: val_loc?.selector_id,
@@ -860,7 +856,6 @@ export function create_content_manager(config) {
860
856
  },
861
857
  on_change: (input) => set_variable_at_path(val_loc?.attributes?.val_from_variable_path, input),
862
858
  })
863
- console.log("table_dropdown", { val_loc, val_from: val_loc?.attributes?.val_from_variable_path })
864
859
  return {
865
860
  type_id: val_loc?.type_id,
866
861
  selector_id: val_loc?.selector_id,
@@ -164,9 +164,7 @@
164
164
  <div>
165
165
  <FileInput manager={manager?.upload_rows_file_input_manager} />
166
166
  </div>
167
- {#if !manager?.upload_rows_file_input_manager?.val}
168
- <TextInput manager={manager?.upload_rows_text_input_manager} />
169
- {/if}
167
+ <TextInput manager={manager?.upload_rows_text_input_manager} />
170
168
  <div style="display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1rem; margin-bottom: 1rem;">
171
169
  <Button manager={manager?.upload_rows_prepare_text_button_manager} />
172
170
  {#if manager?.bulk_insert_rows_prepared_data}
@@ -408,8 +408,7 @@ export function create_table_advanced_manager(config) {
408
408
  () => {
409
409
  let columns_prepped_copy = deep_copy(columns_prepped)
410
410
  delete columns_prepped_copy[column_id]
411
- const columns_prepped_loc = set_columns_prepped(columns_prepped_copy)
412
- set_rows_prepped(columns_prepped_loc)
411
+ set_columns(columns_prepped_copy)
413
412
  if (typeof res.finish == "function") {
414
413
  res.finish()
415
414
  }
@@ -444,8 +443,7 @@ export function create_table_advanced_manager(config) {
444
443
  let cleaned_columns = deep_copy(columns_prepped ?? {})
445
444
  delete cleaned_columns[column_id]
446
445
  cleaned_columns[res?.column_id] = res?.column
447
- const columns_prepped_loc = set_columns_prepped(cleaned_columns)
448
- set_rows_prepped(columns_prepped_loc)
446
+ set_columns(cleaned_columns)
449
447
  }
450
448
  )
451
449
  } else {
@@ -473,8 +471,8 @@ export function create_table_advanced_manager(config) {
473
471
  () => {
474
472
  let cleaned_columns = deep_copy(columns_prepped ?? {})
475
473
  cleaned_columns[res?.column_id] = res?.column
476
- const columns_prepped_loc = set_columns_prepped(cleaned_columns)
477
- set_rows_prepped(columns_prepped_loc)
474
+ console.log("cleaned_columns", cleaned_columns, res)
475
+ set_columns(cleaned_columns)
478
476
  }
479
477
  )
480
478
  } else {
@@ -500,6 +498,7 @@ export function create_table_advanced_manager(config) {
500
498
  row_edit_content_manager = null
501
499
  setTimeout(() => {
502
500
  // quick fix for when update row then edit a diff row the data for other doesnt remain in place
501
+ console.log("edit_row", { row_i, row_input_content })
503
502
  row_edit_content_manager = create_content_manager({
504
503
  val: row_input_content ?? null,
505
504
  definition_stack: row_definition_stack,
@@ -739,9 +738,7 @@ export function create_table_advanced_manager(config) {
739
738
  is_more_to_load = attributes?.is_more_to_load ?? false
740
739
  table_header_max_height = attributes?.table_header_max_height ?? null
741
740
  table_row_max_height = attributes?.table_row_max_height ?? null
742
- const columns_prepped_loc = set_columns_prepped(attributes?.columns)
743
- set_rows_prepped(columns_prepped_loc)
744
- row_input_content = attributes?.row_input_content ?? guess_row_input_content(attributes?.columns)
741
+ set_columns(attributes?.columns, attributes?.row_input_content)
745
742
  }
746
743
 
747
744
  function reset_definition_stack(input) {
@@ -749,9 +746,10 @@ export function create_table_advanced_manager(config) {
749
746
  set_rows_prepped(columns_prepped)
750
747
  }
751
748
 
752
- function set_columns(input) {
749
+ function set_columns(input, row_input_content_input = null) {
753
750
  set_columns_prepped(input)
754
751
  set_rows_prepped(columns_prepped)
752
+ row_input_content = row_input_content_input ?? guess_row_input_content(input)
755
753
  }
756
754
 
757
755
  function init(config) {
@@ -1013,6 +1011,7 @@ export function create_table_advanced_manager(config) {
1013
1011
  () => {
1014
1012
  upload_rows_file_input_manager.clear_files()
1015
1013
  bulk_insert_rows_prepared_data = null
1014
+ upload_rows_text_input_manager.set_val(null)
1016
1015
  set_rows_prepped(columns_prepped)
1017
1016
  }
1018
1017
  )
@@ -841,7 +841,7 @@ export function variables_data_type_remaining_to_astc(
841
841
  })
842
842
  : null
843
843
  if (preferred_content_use == "input") {
844
- let children = label ? [label] : []
844
+ let children = variables_data_type_remaining?.attributes?.label ? [label] : []
845
845
  for (let [key, val] of Object.entries(variables_data_type_remaining?.properties || {})) {
846
846
  let property_children = []
847
847
  property_children.push(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sveltekit-ui",
3
- "version": "1.0.34",
3
+ "version": "1.0.36",
4
4
  "description": "A SvelteKit UI component library for building modern web applications",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -93,14 +93,12 @@ export function create_content_manager(config) {
93
93
  let cleaned_path = []
94
94
  if (Array.isArray(input) && input.length > 0) {
95
95
  let is_def = is_defined(input?.[0], definition_stack)
96
- console.log("is_def", { is_def, item: input?.[0] })
97
96
  if (!is_def) {
98
97
  return []
99
98
  }
100
99
  for (let item of input) {
101
100
  if (Array.isArray(item)) {
102
101
  const res = get_def_from_variable_path(item, definition_stack)
103
- console.log("get_def_from_variable_path", { item, res })
104
102
  cleaned_path.push(res)
105
103
  } else {
106
104
  cleaned_path.push(item)
@@ -115,7 +113,6 @@ export function create_content_manager(config) {
115
113
  return
116
114
  }
117
115
  let cleaned_path = clean_variable_path(path)
118
- console.log("set_variable_at_path88", deep_copy({ path, value, type, cleaned_path, definition_stack }))
119
116
  if (typeof config?.on_event == "function") {
120
117
  if (type == "insert") {
121
118
  return config?.on_event({
@@ -363,7 +360,6 @@ export function create_content_manager(config) {
363
360
  children: [],
364
361
  }
365
362
  } else if (val_loc?.type_id == "color_input") {
366
- console.log("color_input555", val_loc?.attributes)
367
363
  return {
368
364
  type_id: val_loc?.type_id,
369
365
  selector_id: val_loc?.selector_id,
@@ -860,7 +856,6 @@ export function create_content_manager(config) {
860
856
  },
861
857
  on_change: (input) => set_variable_at_path(val_loc?.attributes?.val_from_variable_path, input),
862
858
  })
863
- console.log("table_dropdown", { val_loc, val_from: val_loc?.attributes?.val_from_variable_path })
864
859
  return {
865
860
  type_id: val_loc?.type_id,
866
861
  selector_id: val_loc?.selector_id,
@@ -164,9 +164,7 @@
164
164
  <div>
165
165
  <FileInput manager={manager?.upload_rows_file_input_manager} />
166
166
  </div>
167
- {#if !manager?.upload_rows_file_input_manager?.val}
168
- <TextInput manager={manager?.upload_rows_text_input_manager} />
169
- {/if}
167
+ <TextInput manager={manager?.upload_rows_text_input_manager} />
170
168
  <div style="display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1rem; margin-bottom: 1rem;">
171
169
  <Button manager={manager?.upload_rows_prepare_text_button_manager} />
172
170
  {#if manager?.bulk_insert_rows_prepared_data}
@@ -408,8 +408,7 @@ export function create_table_advanced_manager(config) {
408
408
  () => {
409
409
  let columns_prepped_copy = deep_copy(columns_prepped)
410
410
  delete columns_prepped_copy[column_id]
411
- const columns_prepped_loc = set_columns_prepped(columns_prepped_copy)
412
- set_rows_prepped(columns_prepped_loc)
411
+ set_columns(columns_prepped_copy)
413
412
  if (typeof res.finish == "function") {
414
413
  res.finish()
415
414
  }
@@ -444,8 +443,7 @@ export function create_table_advanced_manager(config) {
444
443
  let cleaned_columns = deep_copy(columns_prepped ?? {})
445
444
  delete cleaned_columns[column_id]
446
445
  cleaned_columns[res?.column_id] = res?.column
447
- const columns_prepped_loc = set_columns_prepped(cleaned_columns)
448
- set_rows_prepped(columns_prepped_loc)
446
+ set_columns(cleaned_columns)
449
447
  }
450
448
  )
451
449
  } else {
@@ -473,8 +471,8 @@ export function create_table_advanced_manager(config) {
473
471
  () => {
474
472
  let cleaned_columns = deep_copy(columns_prepped ?? {})
475
473
  cleaned_columns[res?.column_id] = res?.column
476
- const columns_prepped_loc = set_columns_prepped(cleaned_columns)
477
- set_rows_prepped(columns_prepped_loc)
474
+ console.log("cleaned_columns", cleaned_columns, res)
475
+ set_columns(cleaned_columns)
478
476
  }
479
477
  )
480
478
  } else {
@@ -500,6 +498,7 @@ export function create_table_advanced_manager(config) {
500
498
  row_edit_content_manager = null
501
499
  setTimeout(() => {
502
500
  // quick fix for when update row then edit a diff row the data for other doesnt remain in place
501
+ console.log("edit_row", { row_i, row_input_content })
503
502
  row_edit_content_manager = create_content_manager({
504
503
  val: row_input_content ?? null,
505
504
  definition_stack: row_definition_stack,
@@ -739,9 +738,7 @@ export function create_table_advanced_manager(config) {
739
738
  is_more_to_load = attributes?.is_more_to_load ?? false
740
739
  table_header_max_height = attributes?.table_header_max_height ?? null
741
740
  table_row_max_height = attributes?.table_row_max_height ?? null
742
- const columns_prepped_loc = set_columns_prepped(attributes?.columns)
743
- set_rows_prepped(columns_prepped_loc)
744
- row_input_content = attributes?.row_input_content ?? guess_row_input_content(attributes?.columns)
741
+ set_columns(attributes?.columns, attributes?.row_input_content)
745
742
  }
746
743
 
747
744
  function reset_definition_stack(input) {
@@ -749,9 +746,10 @@ export function create_table_advanced_manager(config) {
749
746
  set_rows_prepped(columns_prepped)
750
747
  }
751
748
 
752
- function set_columns(input) {
749
+ function set_columns(input, row_input_content_input = null) {
753
750
  set_columns_prepped(input)
754
751
  set_rows_prepped(columns_prepped)
752
+ row_input_content = row_input_content_input ?? guess_row_input_content(input)
755
753
  }
756
754
 
757
755
  function init(config) {
@@ -1013,6 +1011,7 @@ export function create_table_advanced_manager(config) {
1013
1011
  () => {
1014
1012
  upload_rows_file_input_manager.clear_files()
1015
1013
  bulk_insert_rows_prepared_data = null
1014
+ upload_rows_text_input_manager.set_val(null)
1016
1015
  set_rows_prepped(columns_prepped)
1017
1016
  }
1018
1017
  )
@@ -841,7 +841,7 @@ export function variables_data_type_remaining_to_astc(
841
841
  })
842
842
  : null
843
843
  if (preferred_content_use == "input") {
844
- let children = label ? [label] : []
844
+ let children = variables_data_type_remaining?.attributes?.label ? [label] : []
845
845
  for (let [key, val] of Object.entries(variables_data_type_remaining?.properties || {})) {
846
846
  let property_children = []
847
847
  property_children.push(
@@ -1397,144 +1397,169 @@
1397
1397
  ],
1398
1398
  is_more_to_load: true,
1399
1399
  on_event: async (input) => {
1400
- console.log("table_on_event", deep_copy({ input, variables }))
1400
+ console.log("table_advanced_on_event", input)
1401
+ if (input?.type == "update_table_server_sort") {
1402
+ console.log("update_table_server_sort", input)
1403
+ return { is_success: true }
1404
+ }
1401
1405
  if (input?.type == "update_row") {
1402
- const path_to_set = input?.path
1403
- let variables_loc = deep_copy(variables)
1404
- let target = variables_loc
1405
- for (let i = 0; i < path_to_set.length - 1; i++) {
1406
- if (target[path_to_set[i]] === undefined || target[path_to_set[i]] === null) {
1407
- target[path_to_set[i]] = {}
1406
+ console.log("update_row_cb", input)
1407
+ const path = input?.path
1408
+ mutate_variables_at_path(path, (parent, last_key) => {
1409
+ parent[last_key] = input?.row
1410
+ })
1411
+ return { is_success: true, row: input?.row }
1412
+ }
1413
+ if (input?.type == "insert_row") {
1414
+ console.log("insert_row", input)
1415
+ const path = input?.path
1416
+ mutate_variables_at_path(path, (parent, last_key) => {
1417
+ if (Array.isArray(parent[last_key])) {
1418
+ if (typeof last_key === "number") {
1419
+ parent[last_key].splice(last_key, 0, input?.row)
1420
+ } else {
1421
+ parent[last_key].push(input?.row)
1422
+ }
1423
+ } else if (Array.isArray(parent)) {
1424
+ parent.splice(last_key, 0, input?.row)
1425
+ } else {
1426
+ parent[last_key] = [input?.row]
1408
1427
  }
1409
- target = target[path_to_set[i]]
1410
- }
1411
- const last_key = path_to_set[path_to_set.length - 1]
1412
- target[last_key] = input?.row
1413
- variables = variables_loc
1414
- table_manager.reset_definition_stack([{ ...variables }])
1415
- return {
1416
- is_success: true,
1417
- row: target?.[last_key],
1418
- }
1419
- } else if (input?.type == "insert_row") {
1420
- const path_to_set = input?.path
1421
- let variables_loc = deep_copy(variables)
1422
- let target = variables_loc
1423
- for (let i = 0; i < path_to_set.length - 1; i++) {
1424
- if (target[path_to_set[i]] === undefined) {
1425
- target[path_to_set[i]] = {}
1428
+ })
1429
+ console.log("variables22", deep_copy(variables))
1430
+ return { is_success: true }
1431
+ }
1432
+ if (input?.type == "bulk_insert_rows") {
1433
+ console.log("bulk_insert_rows", input)
1434
+ const path = input?.path
1435
+ let rows_new = null
1436
+ mutate_variables_at_path(path, (parent, last_key) => {
1437
+ const items = Array.isArray(input?.rows) ? input.rows : []
1438
+ if (Array.isArray(parent) && typeof last_key === "number") {
1439
+ parent.splice(last_key, 0, ...items)
1440
+ rows_new = parent
1441
+ return
1426
1442
  }
1427
- target = target[path_to_set[i]]
1428
- }
1429
- const last_key = path_to_set[path_to_set.length - 1]
1430
- if (!Array.isArray(target)) {
1431
- throw new Error("Target is not an array")
1432
- }
1433
- target.splice(last_key, 0, input?.row)
1434
- variables = variables_loc
1435
- table_manager.reset_definition_stack([{ ...variables }])
1436
- return {
1437
- is_success: true,
1438
- row: target?.[last_key],
1439
- }
1440
- } else if (input?.type == "bulk_insert_rows") {
1441
- console.log("bulk_insert_rows")
1442
- const path_to_set = input?.path
1443
- let variables_loc = deep_copy(variables)
1444
- let target = variables_loc
1445
- for (let i = 0; i < path_to_set.length - 1; i++) {
1446
- if (target[path_to_set[i]] === undefined) {
1447
- target[path_to_set[i]] = {}
1443
+ if (Array.isArray(parent[last_key])) {
1444
+ parent[last_key].push(...items)
1445
+ rows_new = parent[last_key]
1446
+ return
1448
1447
  }
1449
- target = target[path_to_set[i]]
1450
- }
1451
- const last_key = path_to_set[path_to_set.length - 1]
1452
- if (!Array.isArray(target)) {
1453
- throw new Error("Target is not an array")
1454
- }
1455
- target.splice(last_key, 0, input?.value)
1456
- variables = variables_loc
1457
- table_manager.reset_definition_stack([{ ...variables }])
1458
- return {
1459
- is_success: true,
1460
- rows: target?.[last_key],
1461
- }
1462
- } else if (input?.type == "delete_row") {
1463
- console.log("delete_row", deep_copy(input))
1464
- const path_to_delete = input?.path
1465
- let variables_loc = deep_copy(variables)
1466
- let target = variables_loc
1467
- for (let i = 0; i < path_to_delete.length - 1; i++) {
1468
- if (target[path_to_delete[i]] === undefined) {
1469
- target[path_to_delete[i]] = {}
1448
+ if (Array.isArray(parent) && last_key === undefined) {
1449
+ parent.push(...items)
1450
+ rows_new = parent
1451
+ return
1470
1452
  }
1471
- target = target[path_to_delete[i]]
1472
- }
1473
- const last_key = path_to_delete[path_to_delete.length - 1]
1474
- if (Array.isArray(target)) {
1475
- target.splice(last_key, 1)
1476
- }
1477
- variables = variables_loc
1478
- console.log("variables", deep_copy(variables))
1479
- table_manager.reset_definition_stack([{ ...variables }])
1480
- return {
1481
- is_success: true,
1482
- }
1483
- } else if (input?.type == "bulk_delete_rows") {
1484
- console.log("bulk_delete_rows", deep_copy(input))
1453
+ parent[last_key] = [...items]
1454
+ rows_new = parent[last_key]
1455
+ })
1456
+ console.log("variables22", deep_copy(variables))
1457
+ console.log("rows_new", rows_new)
1458
+ return { is_success: true, rows: rows_new }
1459
+ }
1460
+ if (input?.type == "delete_row") {
1461
+ console.log("delete_row", input)
1462
+ const path = input?.path
1463
+ mutate_variables_at_path(path, (parent, last_key) => {
1464
+ if (Array.isArray(parent)) {
1465
+ parent.splice(last_key, 1)
1466
+ } else if (Array.isArray(parent[last_key])) {
1467
+ parent[last_key].splice(last_key, 1)
1468
+ } else {
1469
+ delete parent[last_key]
1470
+ }
1471
+ })
1472
+ return { is_success: true }
1473
+ }
1474
+ if (input?.type == "bulk_delete_rows") {
1475
+ console.log("bulk_delete_rows")
1476
+ const path = input?.path
1477
+ let deleted_row_ids = []
1478
+ mutate_variables_at_path(path, (parent, last_key) => {
1479
+ let the_arr
1480
+ if (Array.isArray(parent[last_key])) {
1481
+ the_arr = parent[last_key]
1482
+ } else if (Array.isArray(parent)) {
1483
+ the_arr = parent
1484
+ } else {
1485
+ return
1486
+ }
1487
+ const sorted_indexes = (input?.row_indexes || []).slice().sort((a, b) => b - a)
1488
+ for (let idx of sorted_indexes) {
1489
+ const row = the_arr[idx]
1490
+ if (row?.id) deleted_row_ids.push(row.id)
1491
+ the_arr.splice(idx, 1)
1492
+ }
1493
+ })
1485
1494
  return {
1486
1495
  is_success: true,
1487
- row_ids_deleted: input?.row_ids,
1496
+ deleted_row_ids: deleted_row_ids,
1488
1497
  }
1489
- } else if (input?.type == "insert_column") {
1498
+ }
1499
+ if (input?.type == "insert_column") {
1490
1500
  console.log("insert_column", deep_copy(input))
1491
- table_manager.set_columns(data?.columns)
1492
- return {
1493
- is_success: true,
1494
- column: input?.column,
1495
- }
1496
- } else if (input?.type == "update_column") {
1501
+ return { is_success: true, column_id: input?.column?.id, column: input?.column }
1502
+ }
1503
+ if (input?.type == "update_column") {
1497
1504
  console.log("update_column", deep_copy(input))
1498
- return {
1499
- is_success: true,
1500
- column: input?.column,
1501
- }
1502
- } else if (input?.type == "delete_column") {
1505
+ return { is_success: true, column_id: input?.column_id, column: input?.column }
1506
+ }
1507
+ if (input?.type == "delete_column") {
1503
1508
  console.log("delete_column", deep_copy(input))
1504
- return {
1505
- is_success: true,
1506
- column_id: input?.column_id,
1507
- column: input?.column,
1508
- }
1509
- } else if (input?.type == "update_table_name") {
1509
+ return { is_success: true, column_id: input?.column_id }
1510
+ }
1511
+ if (input?.type == "update_table_name") {
1510
1512
  console.log("update_table_name", deep_copy(input))
1511
- return {
1512
- is_success: true,
1513
- table_name: input?.table_name,
1514
- }
1515
- } else if (input?.type == "update_table_description") {
1513
+ return { is_success: true, table_name: input?.table_name }
1514
+ }
1515
+ if (input?.type == "update_table_description") {
1516
1516
  console.log("update_table_description", deep_copy(input))
1517
- return {
1518
- is_success: true,
1519
- table_description: input?.table_description,
1520
- }
1521
- } else if (input?.type == "delete_table") {
1517
+ return { is_success: true, table_description: input?.table_description }
1518
+ }
1519
+ if (input?.type == "delete_table") {
1522
1520
  console.log("delete_table", deep_copy(input))
1523
1521
  return {
1524
1522
  is_success: true,
1525
- table_id: input?.table_id,
1523
+ table_id: "abcdefg",
1526
1524
  }
1527
- } else if (input?.type == "load_more") {
1525
+ }
1526
+ if (input?.type == "load_more") {
1528
1527
  console.log("load_more", deep_copy(input))
1529
- return {
1530
- is_success: true,
1531
- rows: [],
1532
- is_more_to_load: true,
1533
- }
1528
+ current_offset += 100
1529
+ const load_more_res_body = { rows: [], total_rows: current_offset + 100 }
1530
+ console.log("load_more_res_body", load_more_res_body)
1531
+ let is_more_to_load = false
1532
+ const path = input?.path
1533
+ mutate_variables_at_path(path, (parent, last_key) => {
1534
+ if (Array.isArray(parent[last_key])) {
1535
+ parent[last_key].push(...load_more_res_body?.rows)
1536
+ is_more_to_load = parent[last_key].length < load_more_res_body?.total_rows
1537
+ } else {
1538
+ parent[last_key] = [...load_more_res_body?.rows]
1539
+ is_more_to_load = parent[last_key].length < load_more_res_body?.total_rows
1540
+ }
1541
+ })
1542
+ console.log("variables_load_more", variables)
1543
+ return { is_success: true, is_more_to_load }
1534
1544
  }
1535
1545
  console.log("unaccounted event", input)
1536
1546
  },
1537
1547
  })
1548
+
1549
+ function mutate_variables_at_path(path, mutator) {
1550
+ const root = { variables: deep_copy(variables) }
1551
+ let target = root
1552
+ for (let i = 0; i < path.length - 1; i++) {
1553
+ if (target[path[i]] === undefined || target[path[i]] === null) {
1554
+ target[path[i]] = typeof path[i + 1] === "number" ? [] : {}
1555
+ }
1556
+ target = target[path[i]]
1557
+ }
1558
+ const last_key = path[path.length - 1]
1559
+ mutator(target, last_key)
1560
+ variables = root.variables
1561
+ table_manager.reset_definition_stack([{ variables }])
1562
+ }
1538
1563
  </script>
1539
1564
 
1540
1565
  <div>