sveltekit-ui 1.0.30 → 1.0.31

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.
@@ -1313,15 +1313,8 @@ export function create_attributes_input_manager(config) {
1313
1313
  let val_input_manager = $state(
1314
1314
  create_variable_path_input_manager({
1315
1315
  val: config?.val?.val_from_variable_path,
1316
- // defined_data_type: {
1317
- // ...defined_data_type,
1318
- // properties: {
1319
- // ...defined_data_type?.properties,
1320
- // [iter_identifier_text_input_manager?.val]: { type: "int_literal" },
1321
- // },
1322
- // },
1323
1316
  get_defined_options: config?.get_defined_options,
1324
- on_finish: () => attributes_manager.close_popover(),
1317
+ on_finish: () => val_input_manager.close_popover(),
1325
1318
  })
1326
1319
  )
1327
1320
  let join_text_text_input_manager = $state(
@@ -56,7 +56,10 @@ export function create_content_input_manager(config) {
56
56
  if (input?.type_id == selector_id) {
57
57
  return { defined, is_found_selector_id: true }
58
58
  } else if (input?.type_id == "loop") {
59
- defined[input?.attributes?.iter_identifier] = { type: "text_literal" }
59
+ console.log("loop_iter_iter_identifier", input?.attributes?.iter_identifier)
60
+ if (input?.attributes?.iter_identifier) {
61
+ defined[input?.attributes?.iter_identifier] = { type: "text_literal" }
62
+ }
60
63
  }
61
64
  if (Array.isArray(input?.children)) {
62
65
  for (let child of input?.children) {
@@ -73,10 +76,13 @@ export function create_content_input_manager(config) {
73
76
  }
74
77
 
75
78
  function get_defined_options(selector_id) {
79
+ console.log("get_defined_options", deep_copy({ definition_stack, selector_id }))
76
80
  const defined_at_selector_id = get_defined_at_selector_id(selector_id)
81
+ console.log("defined_at_selector_id", deep_copy({ defined_at_selector_id }))
77
82
  const defined_data_type = json_to_data_type(
78
83
  Object.assign({}, ...[...(Array.isArray(definition_stack) ? definition_stack : [])].reverse())
79
84
  )
85
+ console.log("defined_data_type", deep_copy({ defined_data_type }))
80
86
  return Object.entries({ ...(defined_data_type?.properties || {}), ...defined_at_selector_id }).map(
81
87
  ([key, val]) => ({
82
88
  key,
@@ -13,6 +13,8 @@ import {
13
13
  variables_data_type_remaining_to_astc,
14
14
  set_definition_stack,
15
15
  astc_element,
16
+ deep_copy,
17
+ get_def_from_variable_path,
16
18
  } from "../../../client/index.js"
17
19
 
18
20
  export function create_column_input_manager(config) {
@@ -110,7 +112,7 @@ export function create_column_input_manager(config) {
110
112
  }
111
113
 
112
114
  function init(config) {
113
- console.log("column_input_init", config)
115
+ console.log("column_input_init", deep_copy(config))
114
116
  definition_stack = config?.definition_stack
115
117
  column_id_text_input_manager = create_text_input_manager({
116
118
  label: "Column ID",
@@ -121,20 +123,16 @@ export function create_column_input_manager(config) {
121
123
  storage: null,
122
124
  storage_default_folder_path: null,
123
125
  definition_stack: definition_stack,
124
- on_event: (input) => {
125
- console.log("set_definition_stack_tbd400", input)
126
- set_definition_stack(input)
127
- },
128
126
  })
127
+ const editable_row = get_def_from_variable_path([...rows_data_from_variable_path, 0], definition_stack)
128
+ const row_definition_stack = row_iter_identifier
129
+ ? [{ [row_iter_identifier]: editable_row }, ...definition_stack]
130
+ : definition_stack
129
131
  body_content_input_manager = create_content_input_manager({
130
132
  val: config?.val?.body_content ?? null,
131
133
  storage: config?.storage,
132
134
  storage_default_folder_path: null,
133
- definition_stack: definition_stack,
134
- on_event: (input) => {
135
- console.log("set_definition_stack_tbd33")
136
- set_definition_stack(input)
137
- },
135
+ definition_stack: row_definition_stack,
138
136
  })
139
137
  column_description_text_input_manager = create_text_input_manager({
140
138
  type: "text_area",
@@ -192,24 +190,28 @@ export function create_column_input_manager(config) {
192
190
  val: config?.val?.is_db_column ?? column_input_options?.is_db_column?.default_value ?? false,
193
191
  })
194
192
  column_db_data_type_input_manager = create_data_type_input_manager({
195
- // data_sample: () => variables,
196
193
  table_options: config?.table_options,
197
194
  val: config?.val?.db_data_type,
198
195
  on_finish: (input) => {
199
- let default_content_input_astc = variables_data_type_remaining_to_astc(input, "input", ["rows"])
196
+ let default_content_input_astc = variables_data_type_remaining_to_astc(input, "input", [
197
+ ...(Array.isArray(rows_data_from_variable_path) ? rows_data_from_variable_path : []),
198
+ [row_iter_identifier],
199
+ column_id_text_input_manager.val,
200
+ ])
200
201
  column_default_value_content_manager = create_content_manager({
201
202
  val: default_content_input_astc,
202
203
  table_options: config?.table_options,
203
204
  on_search_table_row_ids: config?.on_search_table_row_ids,
204
205
  definition_stack: definition_stack,
205
206
  on_event: (input) => {
206
- const res = set_definition_stack(
207
- input,
208
- definition_stack,
209
- column_default_value_content_manager?.pass_event_down
210
- )
211
- definition_stack = res?.definition_stack
212
- return res
207
+ // console.log("input3334", input)
208
+ // const res = set_definition_stack(
209
+ // input,
210
+ // definition_stack,
211
+ // column_default_value_content_manager?.pass_event_down
212
+ // )
213
+ // definition_stack = res?.definition_stack
214
+ // return res
213
215
  },
214
216
  })
215
217
  },
@@ -260,7 +262,6 @@ export function create_column_input_manager(config) {
260
262
  font_size: 1,
261
263
  border_radius: 0.5,
262
264
  on_click: () => {
263
- console.log("guess_header_content_button_manager")
264
265
  if (column_id_text_input_manager?.val) {
265
266
  const header_text = column_id_text_input_manager.val
266
267
  .split("_")
@@ -278,7 +279,6 @@ export function create_column_input_manager(config) {
278
279
  font_size: 1,
279
280
  border_radius: 0.5,
280
281
  on_click: () => {
281
- console.log("guess_body_content_button_manager")
282
282
  if (column_id_text_input_manager.val && column_db_data_type_input_manager?.val) {
283
283
  let guessed_column_display_content = variables_data_type_remaining_to_astc(
284
284
  column_db_data_type_input_manager?.val,
@@ -289,7 +289,6 @@ export function create_column_input_manager(config) {
289
289
  column_id_text_input_manager.val,
290
290
  ]
291
291
  )
292
- console.log("guessed_column_display_content", guessed_column_display_content)
293
292
  body_content_input_manager.add_version(guessed_column_display_content)
294
293
  } else {
295
294
  body_content_input_manager.add_version(null)
@@ -2,6 +2,7 @@ import { create_popover_manager } from "../Popover/index.svelte.js"
2
2
  import { create_button_manager } from "../Button/index.svelte.js"
3
3
  import { create_text_input_manager } from "../TextInput/index.svelte.js"
4
4
  import { create_dropdown_manager } from "../Dropdown/index.svelte.js"
5
+ import { deep_copy } from "../../client/index.js"
5
6
 
6
7
  export function create_variable_path_input_manager(config) {
7
8
  let popover_manager = $state(null)
@@ -14,6 +15,7 @@ export function create_variable_path_input_manager(config) {
14
15
  let path_prepped = $state(null)
15
16
  let val = $derived(get_val())
16
17
  let val_text = $derived(val_to_text(val))
18
+ let variable_data_type_at_path = $state(null)
17
19
 
18
20
  function get_val() {
19
21
  return def_dropdown_manager?.val
@@ -24,7 +26,7 @@ export function create_variable_path_input_manager(config) {
24
26
  function prep_path(input) {
25
27
  let path_prepped_loc = $state([])
26
28
  if (Array.isArray(input)) {
27
- let variable_data_type_at_path = Array.isArray(defined_options)
29
+ variable_data_type_at_path = Array.isArray(defined_options)
28
30
  ? defined_options.find((h) => h?.key === def_dropdown_manager?.val)?.data_type
29
31
  : null
30
32
  for (let i = 1; i < input.length; i++) {
@@ -104,7 +106,6 @@ export function create_variable_path_input_manager(config) {
104
106
  })
105
107
  }
106
108
  }
107
- console.log("key_options", key_options)
108
109
  let val = $derived(
109
110
  type_dropdown_manager?.val == "string"
110
111
  ? const_string_value_text_input_manager?.val
@@ -123,6 +124,7 @@ export function create_variable_path_input_manager(config) {
123
124
  ? variable_path_input_manager?.variable_data_type_at_path
124
125
  : null
125
126
  )
127
+ variable_data_type_at_path = variable_data_type_at_next_path
126
128
  path_prepped_loc.push({
127
129
  get type_dropdown_manager() {
128
130
  return type_dropdown_manager
@@ -177,6 +179,9 @@ export function create_variable_path_input_manager(config) {
177
179
 
178
180
  function init(input) {
179
181
  levels_nested = input?.levels_nested ?? 0
182
+ if (typeof config?.get_defined_options == "function") {
183
+ defined_options = config?.get_defined_options()
184
+ }
180
185
  popover_manager = create_popover_manager({
181
186
  min_width: 280,
182
187
  target_width: 450,
@@ -239,6 +244,9 @@ export function create_variable_path_input_manager(config) {
239
244
  get val_text() {
240
245
  return val_text
241
246
  },
247
+ get variable_data_type_at_path() {
248
+ return variable_data_type_at_path
249
+ },
242
250
  get levels_nested() {
243
251
  return levels_nested
244
252
  },
@@ -792,12 +792,15 @@ export function variables_data_type_remaining_to_astc(
792
792
  // }
793
793
  const child_astc = variables_data_type_remaining_to_astc(
794
794
  variables_data_type_remaining?.items,
795
- preferred_content_use
795
+ preferred_content_use,
796
+ [...leading_variable_path, ["loop_index"]]
796
797
  )
798
+ console.log("loop_child", { child_astc, variables_data_type_remaining })
797
799
  return astc_element("loop", [child_astc], {
798
800
  val_from_variable_path: leading_variable_path,
799
801
  ...(variables_data_type_remaining?.attributes ?? {}),
800
802
  font_size: 1.2,
803
+ iter_identifier: "loop_index",
801
804
  })
802
805
  // } else if (variables_data_type_remaining?.type == "list") {
803
806
  // list input tbd just content input i guess
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sveltekit-ui",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "description": "A SvelteKit UI component library for building modern web applications",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -19,7 +19,7 @@
19
19
  "dependencies": {
20
20
  "context-filter-polyfill": "^0.3.23",
21
21
  "qr-code-styling": "^1.9.2",
22
- "svelte": "^5.38.2"
22
+ "svelte": "^5.38.3"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "@sveltejs/kit": "^2.22.2"
@@ -1313,15 +1313,8 @@ export function create_attributes_input_manager(config) {
1313
1313
  let val_input_manager = $state(
1314
1314
  create_variable_path_input_manager({
1315
1315
  val: config?.val?.val_from_variable_path,
1316
- // defined_data_type: {
1317
- // ...defined_data_type,
1318
- // properties: {
1319
- // ...defined_data_type?.properties,
1320
- // [iter_identifier_text_input_manager?.val]: { type: "int_literal" },
1321
- // },
1322
- // },
1323
1316
  get_defined_options: config?.get_defined_options,
1324
- on_finish: () => attributes_manager.close_popover(),
1317
+ on_finish: () => val_input_manager.close_popover(),
1325
1318
  })
1326
1319
  )
1327
1320
  let join_text_text_input_manager = $state(
@@ -56,7 +56,10 @@ export function create_content_input_manager(config) {
56
56
  if (input?.type_id == selector_id) {
57
57
  return { defined, is_found_selector_id: true }
58
58
  } else if (input?.type_id == "loop") {
59
- defined[input?.attributes?.iter_identifier] = { type: "text_literal" }
59
+ console.log("loop_iter_iter_identifier", input?.attributes?.iter_identifier)
60
+ if (input?.attributes?.iter_identifier) {
61
+ defined[input?.attributes?.iter_identifier] = { type: "text_literal" }
62
+ }
60
63
  }
61
64
  if (Array.isArray(input?.children)) {
62
65
  for (let child of input?.children) {
@@ -73,10 +76,13 @@ export function create_content_input_manager(config) {
73
76
  }
74
77
 
75
78
  function get_defined_options(selector_id) {
79
+ console.log("get_defined_options", deep_copy({ definition_stack, selector_id }))
76
80
  const defined_at_selector_id = get_defined_at_selector_id(selector_id)
81
+ console.log("defined_at_selector_id", deep_copy({ defined_at_selector_id }))
77
82
  const defined_data_type = json_to_data_type(
78
83
  Object.assign({}, ...[...(Array.isArray(definition_stack) ? definition_stack : [])].reverse())
79
84
  )
85
+ console.log("defined_data_type", deep_copy({ defined_data_type }))
80
86
  return Object.entries({ ...(defined_data_type?.properties || {}), ...defined_at_selector_id }).map(
81
87
  ([key, val]) => ({
82
88
  key,
@@ -13,6 +13,8 @@ import {
13
13
  variables_data_type_remaining_to_astc,
14
14
  set_definition_stack,
15
15
  astc_element,
16
+ deep_copy,
17
+ get_def_from_variable_path,
16
18
  } from "$lib/client/index.js"
17
19
 
18
20
  export function create_column_input_manager(config) {
@@ -110,7 +112,7 @@ export function create_column_input_manager(config) {
110
112
  }
111
113
 
112
114
  function init(config) {
113
- console.log("column_input_init", config)
115
+ console.log("column_input_init", deep_copy(config))
114
116
  definition_stack = config?.definition_stack
115
117
  column_id_text_input_manager = create_text_input_manager({
116
118
  label: "Column ID",
@@ -121,20 +123,16 @@ export function create_column_input_manager(config) {
121
123
  storage: null,
122
124
  storage_default_folder_path: null,
123
125
  definition_stack: definition_stack,
124
- on_event: (input) => {
125
- console.log("set_definition_stack_tbd400", input)
126
- set_definition_stack(input)
127
- },
128
126
  })
127
+ const editable_row = get_def_from_variable_path([...rows_data_from_variable_path, 0], definition_stack)
128
+ const row_definition_stack = row_iter_identifier
129
+ ? [{ [row_iter_identifier]: editable_row }, ...definition_stack]
130
+ : definition_stack
129
131
  body_content_input_manager = create_content_input_manager({
130
132
  val: config?.val?.body_content ?? null,
131
133
  storage: config?.storage,
132
134
  storage_default_folder_path: null,
133
- definition_stack: definition_stack,
134
- on_event: (input) => {
135
- console.log("set_definition_stack_tbd33")
136
- set_definition_stack(input)
137
- },
135
+ definition_stack: row_definition_stack,
138
136
  })
139
137
  column_description_text_input_manager = create_text_input_manager({
140
138
  type: "text_area",
@@ -192,24 +190,28 @@ export function create_column_input_manager(config) {
192
190
  val: config?.val?.is_db_column ?? column_input_options?.is_db_column?.default_value ?? false,
193
191
  })
194
192
  column_db_data_type_input_manager = create_data_type_input_manager({
195
- // data_sample: () => variables,
196
193
  table_options: config?.table_options,
197
194
  val: config?.val?.db_data_type,
198
195
  on_finish: (input) => {
199
- let default_content_input_astc = variables_data_type_remaining_to_astc(input, "input", ["rows"])
196
+ let default_content_input_astc = variables_data_type_remaining_to_astc(input, "input", [
197
+ ...(Array.isArray(rows_data_from_variable_path) ? rows_data_from_variable_path : []),
198
+ [row_iter_identifier],
199
+ column_id_text_input_manager.val,
200
+ ])
200
201
  column_default_value_content_manager = create_content_manager({
201
202
  val: default_content_input_astc,
202
203
  table_options: config?.table_options,
203
204
  on_search_table_row_ids: config?.on_search_table_row_ids,
204
205
  definition_stack: definition_stack,
205
206
  on_event: (input) => {
206
- const res = set_definition_stack(
207
- input,
208
- definition_stack,
209
- column_default_value_content_manager?.pass_event_down
210
- )
211
- definition_stack = res?.definition_stack
212
- return res
207
+ // console.log("input3334", input)
208
+ // const res = set_definition_stack(
209
+ // input,
210
+ // definition_stack,
211
+ // column_default_value_content_manager?.pass_event_down
212
+ // )
213
+ // definition_stack = res?.definition_stack
214
+ // return res
213
215
  },
214
216
  })
215
217
  },
@@ -260,7 +262,6 @@ export function create_column_input_manager(config) {
260
262
  font_size: 1,
261
263
  border_radius: 0.5,
262
264
  on_click: () => {
263
- console.log("guess_header_content_button_manager")
264
265
  if (column_id_text_input_manager?.val) {
265
266
  const header_text = column_id_text_input_manager.val
266
267
  .split("_")
@@ -278,7 +279,6 @@ export function create_column_input_manager(config) {
278
279
  font_size: 1,
279
280
  border_radius: 0.5,
280
281
  on_click: () => {
281
- console.log("guess_body_content_button_manager")
282
282
  if (column_id_text_input_manager.val && column_db_data_type_input_manager?.val) {
283
283
  let guessed_column_display_content = variables_data_type_remaining_to_astc(
284
284
  column_db_data_type_input_manager?.val,
@@ -289,7 +289,6 @@ export function create_column_input_manager(config) {
289
289
  column_id_text_input_manager.val,
290
290
  ]
291
291
  )
292
- console.log("guessed_column_display_content", guessed_column_display_content)
293
292
  body_content_input_manager.add_version(guessed_column_display_content)
294
293
  } else {
295
294
  body_content_input_manager.add_version(null)
@@ -2,6 +2,7 @@ import { create_popover_manager } from "$lib/Components/Popover/index.svelte.js"
2
2
  import { create_button_manager } from "$lib/Components/Button/index.svelte.js"
3
3
  import { create_text_input_manager } from "$lib/Components/TextInput/index.svelte.js"
4
4
  import { create_dropdown_manager } from "$lib/Components/Dropdown/index.svelte.js"
5
+ import { deep_copy } from "$lib/client/index.js"
5
6
 
6
7
  export function create_variable_path_input_manager(config) {
7
8
  let popover_manager = $state(null)
@@ -14,6 +15,7 @@ export function create_variable_path_input_manager(config) {
14
15
  let path_prepped = $state(null)
15
16
  let val = $derived(get_val())
16
17
  let val_text = $derived(val_to_text(val))
18
+ let variable_data_type_at_path = $state(null)
17
19
 
18
20
  function get_val() {
19
21
  return def_dropdown_manager?.val
@@ -24,7 +26,7 @@ export function create_variable_path_input_manager(config) {
24
26
  function prep_path(input) {
25
27
  let path_prepped_loc = $state([])
26
28
  if (Array.isArray(input)) {
27
- let variable_data_type_at_path = Array.isArray(defined_options)
29
+ variable_data_type_at_path = Array.isArray(defined_options)
28
30
  ? defined_options.find((h) => h?.key === def_dropdown_manager?.val)?.data_type
29
31
  : null
30
32
  for (let i = 1; i < input.length; i++) {
@@ -104,7 +106,6 @@ export function create_variable_path_input_manager(config) {
104
106
  })
105
107
  }
106
108
  }
107
- console.log("key_options", key_options)
108
109
  let val = $derived(
109
110
  type_dropdown_manager?.val == "string"
110
111
  ? const_string_value_text_input_manager?.val
@@ -123,6 +124,7 @@ export function create_variable_path_input_manager(config) {
123
124
  ? variable_path_input_manager?.variable_data_type_at_path
124
125
  : null
125
126
  )
127
+ variable_data_type_at_path = variable_data_type_at_next_path
126
128
  path_prepped_loc.push({
127
129
  get type_dropdown_manager() {
128
130
  return type_dropdown_manager
@@ -177,6 +179,9 @@ export function create_variable_path_input_manager(config) {
177
179
 
178
180
  function init(input) {
179
181
  levels_nested = input?.levels_nested ?? 0
182
+ if (typeof config?.get_defined_options == "function") {
183
+ defined_options = config?.get_defined_options()
184
+ }
180
185
  popover_manager = create_popover_manager({
181
186
  min_width: 280,
182
187
  target_width: 450,
@@ -239,6 +244,9 @@ export function create_variable_path_input_manager(config) {
239
244
  get val_text() {
240
245
  return val_text
241
246
  },
247
+ get variable_data_type_at_path() {
248
+ return variable_data_type_at_path
249
+ },
242
250
  get levels_nested() {
243
251
  return levels_nested
244
252
  },
@@ -792,12 +792,15 @@ export function variables_data_type_remaining_to_astc(
792
792
  // }
793
793
  const child_astc = variables_data_type_remaining_to_astc(
794
794
  variables_data_type_remaining?.items,
795
- preferred_content_use
795
+ preferred_content_use,
796
+ [...leading_variable_path, ["loop_index"]]
796
797
  )
798
+ console.log("loop_child", { child_astc, variables_data_type_remaining })
797
799
  return astc_element("loop", [child_astc], {
798
800
  val_from_variable_path: leading_variable_path,
799
801
  ...(variables_data_type_remaining?.attributes ?? {}),
800
802
  font_size: 1.2,
803
+ iter_identifier: "loop_index",
801
804
  })
802
805
  // } else if (variables_data_type_remaining?.type == "list") {
803
806
  // list input tbd just content input i guess