sveltekit-ui 1.0.33 → 1.0.34

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.
@@ -28,6 +28,7 @@
28
28
  import TableAdvanced from "../TableAdvanced/index.svelte"
29
29
  import FileInput from "../FileInput/index.svelte"
30
30
  import Button from "../Button/index.svelte"
31
+ import Spacer from "../Spacer/index.svelte"
31
32
  import Self from "./index.svelte"
32
33
  import { format_date, set_closurable_color, set_closurable, cron_to_english } from "../../client/index.js"
33
34
 
@@ -451,6 +452,15 @@
451
452
  </span>
452
453
  {:else if manager?.val_prepped?.type_id === "br"}
453
454
  <br />
455
+ {:else if manager?.val_prepped?.type_id === "spacer"}
456
+ <Spacer
457
+ mt={manager?.val_prepped?.attributes?.mt}
458
+ mb={manager?.val_prepped?.attributes?.mb}
459
+ ml={manager?.val_prepped?.attributes?.ml}
460
+ mr={manager?.val_prepped?.attributes?.mr}
461
+ is_vert={manager?.val_prepped?.attributes?.is_vert}
462
+ color={manager?.val_prepped?.attributes?.color}
463
+ />
454
464
  {:else if manager?.val_prepped?.type_id === "hr"}
455
465
  <hr id={manager?.val_prepped?.selector_id} />
456
466
  {:else if manager?.val_prepped?.type_id === "slot"}
@@ -93,12 +93,14 @@ 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] })
96
97
  if (!is_def) {
97
98
  return []
98
99
  }
99
100
  for (let item of input) {
100
101
  if (Array.isArray(item)) {
101
- const res = get_def_from_variable_path(item)
102
+ const res = get_def_from_variable_path(item, definition_stack)
103
+ console.log("get_def_from_variable_path", { item, res })
102
104
  cleaned_path.push(res)
103
105
  } else {
104
106
  cleaned_path.push(item)
@@ -109,11 +111,11 @@ export function create_content_manager(config) {
109
111
  }
110
112
 
111
113
  async function set_variable_at_path(path, value, type) {
112
- console.log("set_variable_at_path88", path, value, type)
113
114
  if (!Array.isArray(path)) {
114
115
  return
115
116
  }
116
117
  let cleaned_path = clean_variable_path(path)
118
+ console.log("set_variable_at_path88", deep_copy({ path, value, type, cleaned_path, definition_stack }))
117
119
  if (typeof config?.on_event == "function") {
118
120
  if (type == "insert") {
119
121
  return config?.on_event({
@@ -608,7 +610,6 @@ export function create_content_manager(config) {
608
610
  const static_val = set_closurable(val_loc?.attributes?.val)
609
611
  if (Array.isArray(static_val)) {
610
612
  for (let i = 0; i < static_val.length; i++) {
611
- // console.log("loop_test", val_loc?.attributes)
612
613
  let children = []
613
614
  if (Array.isArray(val_loc?.children) && val_loc?.children.length > 0) {
614
615
  is_children = true
@@ -56,7 +56,6 @@ 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
- console.log("loop_iter_iter_identifier", input?.attributes?.iter_identifier)
60
59
  if (input?.attributes?.iter_identifier) {
61
60
  defined[input?.attributes?.iter_identifier] = { type: "text_literal" }
62
61
  }
@@ -76,13 +75,10 @@ export function create_content_input_manager(config) {
76
75
  }
77
76
 
78
77
  function get_defined_options(selector_id) {
79
- console.log("get_defined_options", deep_copy({ definition_stack, selector_id }))
80
78
  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 }))
82
79
  const defined_data_type = json_to_data_type(
83
80
  Object.assign({}, ...[...(Array.isArray(definition_stack) ? definition_stack : [])].reverse())
84
81
  )
85
- console.log("defined_data_type", deep_copy({ defined_data_type }))
86
82
  return Object.entries({ ...(defined_data_type?.properties || {}), ...defined_at_selector_id }).map(
87
83
  ([key, val]) => ({
88
84
  key,
@@ -438,7 +434,6 @@ export function create_content_input_manager(config) {
438
434
 
439
435
  function handle_element_child_drag_drop(e, selector_id, is_children = false) {
440
436
  e.stopPropagation()
441
- console.log("handle_element_child_drag_drop", { selector_id, dragging_selector_id, is_children })
442
437
  if (selector_id == dragging_selector_id) {
443
438
  dragging_selector_id = null
444
439
  return
@@ -507,6 +507,7 @@ export function create_table_advanced_manager(config) {
507
507
  storage_items: null, // tbd
508
508
  on_search_table_row_ids: config?.on_search_table_row_ids,
509
509
  on_event: (input) => {
510
+ console.log("on_e", deep_copy({ input, row_definition_stack }))
510
511
  const res = set_definition_stack(input, row_definition_stack)
511
512
  row_definition_stack = res?.definition_stack
512
513
  const row_data = get_def_from_variable_path([row_edit_def_identifier], row_definition_stack)
@@ -688,16 +689,27 @@ export function create_table_advanced_manager(config) {
688
689
  row_edit_def_identifier,
689
690
  column_id,
690
691
  ])
691
- if (guessed_column_input_content?.hasOwnProperty("attributes")) {
692
- if (!guessed_column_input_content.attributes) {
693
- guessed_column_input_content.attributes = {}
694
- }
695
- guessed_column_input_content.attributes.label = column_id
696
- }
697
692
  return {
698
693
  type_id: "div",
699
694
  selector_id: create_unique_id(null, 8),
700
- children: [guessed_column_input_content],
695
+ children: [
696
+ {
697
+ type_id: "strong",
698
+ selector_id: create_unique_id(null, 8),
699
+ children: [],
700
+ attributes: { content: column_id },
701
+ },
702
+ guessed_column_input_content,
703
+ {
704
+ type_id: "spacer",
705
+ selector_id: create_unique_id(null, 8),
706
+ children: [],
707
+ attributes: {
708
+ mt: 1,
709
+ mb: 1,
710
+ },
711
+ },
712
+ ],
701
713
  attributes: {},
702
714
  }
703
715
  }
@@ -7,7 +7,6 @@ export function create_time_manager(config) {
7
7
  let text_color = $derived(set_closurable_color(config?.text_color, null))
8
8
 
9
9
  function init(config) {
10
- console.log("create_time_manager", config)
11
10
  const time_full = get_time_object_from_val(
12
11
  set_closurable(config?.val),
13
12
  set_closurable(config?.format),
@@ -16,12 +15,10 @@ export function create_time_manager(config) {
16
15
  )
17
16
  datetime = time_full?.datetime ?? time_full?.iso_8601 ?? null
18
17
  content = time_full?.content ?? set_closurable(config?.val)
19
- console.log("time_full", { time_full, datetime, content })
20
18
  if (config?.display_format == "calendar_date" && time_full?.year) {
21
19
  content = `${time_full?.year}-${String(time_full?.month).padStart(2, "0")}-${String(
22
20
  time_full?.day_of_month
23
21
  ).padStart(2, "0")}`
24
- console.log("content_cal_da", { content })
25
22
  }
26
23
  }
27
24
 
@@ -780,11 +780,13 @@ export function variables_data_type_remaining_to_astc(
780
780
  if (preferred_content_use == "input") {
781
781
  const child_astc = variables_data_type_remaining_to_astc(
782
782
  variables_data_type_remaining?.items,
783
- preferred_content_use
783
+ preferred_content_use,
784
+ [...leading_variable_path, ["loop_index"]]
784
785
  )
785
786
  return astc_element("array_uniform_input", [child_astc], {
786
787
  val_from_variable_path: leading_variable_path,
787
788
  ...(variables_data_type_remaining?.attributes ?? {}),
789
+ iter_identifier: "loop_index",
788
790
  })
789
791
  }
790
792
  // if (preferred_content_type == "object") {
@@ -795,7 +797,6 @@ export function variables_data_type_remaining_to_astc(
795
797
  preferred_content_use,
796
798
  [...leading_variable_path, ["loop_index"]]
797
799
  )
798
- console.log("loop_child", { child_astc, variables_data_type_remaining })
799
800
  return astc_element("loop", [child_astc], {
800
801
  val_from_variable_path: leading_variable_path,
801
802
  ...(variables_data_type_remaining?.attributes ?? {}),
@@ -1088,10 +1089,8 @@ export function json_to_data_type(data, type = null, is_list_child = false) {
1088
1089
  structure = json_to_data_type(data, "time_literal")
1089
1090
  } else if (keys.includes("cron")) {
1090
1091
  structure = json_to_data_type(data, "cron_literal")
1091
- console.log("cronnnnn", structure)
1092
1092
  } else if (keys.includes("main_number") && keys.includes("country_code")) {
1093
1093
  structure = json_to_data_type(data, "phone_literal")
1094
- console.log("phonnnnn", structure)
1095
1094
  } else {
1096
1095
  let properties = {}
1097
1096
  for (let key of Object.keys(data || {})) {
@@ -336,7 +336,6 @@ function add_keys_to_set(obj, set, prefix) {
336
336
  }
337
337
 
338
338
  function get_value_by_path(obj, path) {
339
- console.log("get_value_by_path000", { obj, path })
340
339
  if (Array.isArray(path)) {
341
340
  for (let i = 0; i < path.length; i++) {
342
341
  if (obj && typeof obj == "object" && obj.hasOwnProperty(path?.[i])) {
@@ -1436,6 +1436,21 @@ export const content_types = {
1436
1436
  attributes: {},
1437
1437
  child_elements: {},
1438
1438
  },
1439
+ spacer: {
1440
+ kind: "content",
1441
+ category: "content",
1442
+ name: "Spacer",
1443
+ display_order: 40,
1444
+ attributes: {
1445
+ mt: { type: "float_literal" },
1446
+ mb: { type: "float_literal" },
1447
+ ml: { type: "float_literal" },
1448
+ mr: { type: "float_literal" },
1449
+ is_vert: { type: "boolean_literal" },
1450
+ color: { type: "color_literal" },
1451
+ },
1452
+ child_elements: {},
1453
+ },
1439
1454
  hr: {
1440
1455
  kind: "content",
1441
1456
  category: "content",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sveltekit-ui",
3
- "version": "1.0.33",
3
+ "version": "1.0.34",
4
4
  "description": "A SvelteKit UI component library for building modern web applications",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -19,14 +19,14 @@
19
19
  "dependencies": {
20
20
  "context-filter-polyfill": "^0.3.23",
21
21
  "qr-code-styling": "^1.9.2",
22
- "svelte": "^5.38.5"
22
+ "svelte": "^5.38.6"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "@sveltejs/kit": "^2.22.2"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@sveltejs/adapter-vercel": "^5.10.2",
29
- "@sveltejs/kit": "^2.36.2",
29
+ "@sveltejs/kit": "^2.36.3",
30
30
  "@sveltejs/package": "^2.5.0",
31
31
  "@sveltejs/vite-plugin-svelte": "^6.1.3",
32
32
  "@vercel/analytics": "^1.5.0",
@@ -28,6 +28,7 @@
28
28
  import TableAdvanced from "$lib/Components/TableAdvanced/index.svelte"
29
29
  import FileInput from "$lib/Components/FileInput/index.svelte"
30
30
  import Button from "$lib/Components/Button/index.svelte"
31
+ import Spacer from "$lib/Components/Spacer/index.svelte"
31
32
  import Self from "./index.svelte"
32
33
  import { format_date, set_closurable_color, set_closurable, cron_to_english } from "$lib/client/index.js"
33
34
 
@@ -451,6 +452,15 @@
451
452
  </span>
452
453
  {:else if manager?.val_prepped?.type_id === "br"}
453
454
  <br />
455
+ {:else if manager?.val_prepped?.type_id === "spacer"}
456
+ <Spacer
457
+ mt={manager?.val_prepped?.attributes?.mt}
458
+ mb={manager?.val_prepped?.attributes?.mb}
459
+ ml={manager?.val_prepped?.attributes?.ml}
460
+ mr={manager?.val_prepped?.attributes?.mr}
461
+ is_vert={manager?.val_prepped?.attributes?.is_vert}
462
+ color={manager?.val_prepped?.attributes?.color}
463
+ />
454
464
  {:else if manager?.val_prepped?.type_id === "hr"}
455
465
  <hr id={manager?.val_prepped?.selector_id} />
456
466
  {:else if manager?.val_prepped?.type_id === "slot"}
@@ -93,12 +93,14 @@ 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] })
96
97
  if (!is_def) {
97
98
  return []
98
99
  }
99
100
  for (let item of input) {
100
101
  if (Array.isArray(item)) {
101
- const res = get_def_from_variable_path(item)
102
+ const res = get_def_from_variable_path(item, definition_stack)
103
+ console.log("get_def_from_variable_path", { item, res })
102
104
  cleaned_path.push(res)
103
105
  } else {
104
106
  cleaned_path.push(item)
@@ -109,11 +111,11 @@ export function create_content_manager(config) {
109
111
  }
110
112
 
111
113
  async function set_variable_at_path(path, value, type) {
112
- console.log("set_variable_at_path88", path, value, type)
113
114
  if (!Array.isArray(path)) {
114
115
  return
115
116
  }
116
117
  let cleaned_path = clean_variable_path(path)
118
+ console.log("set_variable_at_path88", deep_copy({ path, value, type, cleaned_path, definition_stack }))
117
119
  if (typeof config?.on_event == "function") {
118
120
  if (type == "insert") {
119
121
  return config?.on_event({
@@ -608,7 +610,6 @@ export function create_content_manager(config) {
608
610
  const static_val = set_closurable(val_loc?.attributes?.val)
609
611
  if (Array.isArray(static_val)) {
610
612
  for (let i = 0; i < static_val.length; i++) {
611
- // console.log("loop_test", val_loc?.attributes)
612
613
  let children = []
613
614
  if (Array.isArray(val_loc?.children) && val_loc?.children.length > 0) {
614
615
  is_children = true
@@ -56,7 +56,6 @@ 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
- console.log("loop_iter_iter_identifier", input?.attributes?.iter_identifier)
60
59
  if (input?.attributes?.iter_identifier) {
61
60
  defined[input?.attributes?.iter_identifier] = { type: "text_literal" }
62
61
  }
@@ -76,13 +75,10 @@ export function create_content_input_manager(config) {
76
75
  }
77
76
 
78
77
  function get_defined_options(selector_id) {
79
- console.log("get_defined_options", deep_copy({ definition_stack, selector_id }))
80
78
  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 }))
82
79
  const defined_data_type = json_to_data_type(
83
80
  Object.assign({}, ...[...(Array.isArray(definition_stack) ? definition_stack : [])].reverse())
84
81
  )
85
- console.log("defined_data_type", deep_copy({ defined_data_type }))
86
82
  return Object.entries({ ...(defined_data_type?.properties || {}), ...defined_at_selector_id }).map(
87
83
  ([key, val]) => ({
88
84
  key,
@@ -438,7 +434,6 @@ export function create_content_input_manager(config) {
438
434
 
439
435
  function handle_element_child_drag_drop(e, selector_id, is_children = false) {
440
436
  e.stopPropagation()
441
- console.log("handle_element_child_drag_drop", { selector_id, dragging_selector_id, is_children })
442
437
  if (selector_id == dragging_selector_id) {
443
438
  dragging_selector_id = null
444
439
  return
@@ -507,6 +507,7 @@ export function create_table_advanced_manager(config) {
507
507
  storage_items: null, // tbd
508
508
  on_search_table_row_ids: config?.on_search_table_row_ids,
509
509
  on_event: (input) => {
510
+ console.log("on_e", deep_copy({ input, row_definition_stack }))
510
511
  const res = set_definition_stack(input, row_definition_stack)
511
512
  row_definition_stack = res?.definition_stack
512
513
  const row_data = get_def_from_variable_path([row_edit_def_identifier], row_definition_stack)
@@ -688,16 +689,27 @@ export function create_table_advanced_manager(config) {
688
689
  row_edit_def_identifier,
689
690
  column_id,
690
691
  ])
691
- if (guessed_column_input_content?.hasOwnProperty("attributes")) {
692
- if (!guessed_column_input_content.attributes) {
693
- guessed_column_input_content.attributes = {}
694
- }
695
- guessed_column_input_content.attributes.label = column_id
696
- }
697
692
  return {
698
693
  type_id: "div",
699
694
  selector_id: create_unique_id(null, 8),
700
- children: [guessed_column_input_content],
695
+ children: [
696
+ {
697
+ type_id: "strong",
698
+ selector_id: create_unique_id(null, 8),
699
+ children: [],
700
+ attributes: { content: column_id },
701
+ },
702
+ guessed_column_input_content,
703
+ {
704
+ type_id: "spacer",
705
+ selector_id: create_unique_id(null, 8),
706
+ children: [],
707
+ attributes: {
708
+ mt: 1,
709
+ mb: 1,
710
+ },
711
+ },
712
+ ],
701
713
  attributes: {},
702
714
  }
703
715
  }
@@ -7,7 +7,6 @@ export function create_time_manager(config) {
7
7
  let text_color = $derived(set_closurable_color(config?.text_color, null))
8
8
 
9
9
  function init(config) {
10
- console.log("create_time_manager", config)
11
10
  const time_full = get_time_object_from_val(
12
11
  set_closurable(config?.val),
13
12
  set_closurable(config?.format),
@@ -16,12 +15,10 @@ export function create_time_manager(config) {
16
15
  )
17
16
  datetime = time_full?.datetime ?? time_full?.iso_8601 ?? null
18
17
  content = time_full?.content ?? set_closurable(config?.val)
19
- console.log("time_full", { time_full, datetime, content })
20
18
  if (config?.display_format == "calendar_date" && time_full?.year) {
21
19
  content = `${time_full?.year}-${String(time_full?.month).padStart(2, "0")}-${String(
22
20
  time_full?.day_of_month
23
21
  ).padStart(2, "0")}`
24
- console.log("content_cal_da", { content })
25
22
  }
26
23
  }
27
24
 
@@ -780,11 +780,13 @@ export function variables_data_type_remaining_to_astc(
780
780
  if (preferred_content_use == "input") {
781
781
  const child_astc = variables_data_type_remaining_to_astc(
782
782
  variables_data_type_remaining?.items,
783
- preferred_content_use
783
+ preferred_content_use,
784
+ [...leading_variable_path, ["loop_index"]]
784
785
  )
785
786
  return astc_element("array_uniform_input", [child_astc], {
786
787
  val_from_variable_path: leading_variable_path,
787
788
  ...(variables_data_type_remaining?.attributes ?? {}),
789
+ iter_identifier: "loop_index",
788
790
  })
789
791
  }
790
792
  // if (preferred_content_type == "object") {
@@ -795,7 +797,6 @@ export function variables_data_type_remaining_to_astc(
795
797
  preferred_content_use,
796
798
  [...leading_variable_path, ["loop_index"]]
797
799
  )
798
- console.log("loop_child", { child_astc, variables_data_type_remaining })
799
800
  return astc_element("loop", [child_astc], {
800
801
  val_from_variable_path: leading_variable_path,
801
802
  ...(variables_data_type_remaining?.attributes ?? {}),
@@ -1088,10 +1089,8 @@ export function json_to_data_type(data, type = null, is_list_child = false) {
1088
1089
  structure = json_to_data_type(data, "time_literal")
1089
1090
  } else if (keys.includes("cron")) {
1090
1091
  structure = json_to_data_type(data, "cron_literal")
1091
- console.log("cronnnnn", structure)
1092
1092
  } else if (keys.includes("main_number") && keys.includes("country_code")) {
1093
1093
  structure = json_to_data_type(data, "phone_literal")
1094
- console.log("phonnnnn", structure)
1095
1094
  } else {
1096
1095
  let properties = {}
1097
1096
  for (let key of Object.keys(data || {})) {
@@ -336,7 +336,6 @@ function add_keys_to_set(obj, set, prefix) {
336
336
  }
337
337
 
338
338
  function get_value_by_path(obj, path) {
339
- console.log("get_value_by_path000", { obj, path })
340
339
  if (Array.isArray(path)) {
341
340
  for (let i = 0; i < path.length; i++) {
342
341
  if (obj && typeof obj == "object" && obj.hasOwnProperty(path?.[i])) {
@@ -1436,6 +1436,21 @@ export const content_types = {
1436
1436
  attributes: {},
1437
1437
  child_elements: {},
1438
1438
  },
1439
+ spacer: {
1440
+ kind: "content",
1441
+ category: "content",
1442
+ name: "Spacer",
1443
+ display_order: 40,
1444
+ attributes: {
1445
+ mt: { type: "float_literal" },
1446
+ mb: { type: "float_literal" },
1447
+ ml: { type: "float_literal" },
1448
+ mr: { type: "float_literal" },
1449
+ is_vert: { type: "boolean_literal" },
1450
+ color: { type: "color_literal" },
1451
+ },
1452
+ child_elements: {},
1453
+ },
1439
1454
  hr: {
1440
1455
  kind: "content",
1441
1456
  category: "content",