sveltekit-ui 1.0.51 → 1.0.52

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.
@@ -885,7 +885,7 @@ export function create_content_manager(config) {
885
885
  }
886
886
  function set_focused_selector_id(input) {
887
887
  if (typeof config?.set_focused_selector_id == "function") {
888
- config?.set_focused_selector_id(input)
888
+ config?.set_focused_selector_id(input, !!input)
889
889
  }
890
890
  }
891
891
 
@@ -27,6 +27,14 @@
27
27
 
28
28
  <Popover manager={manager?.popover_manager}>
29
29
  {#snippet content()}
30
+ <div
31
+ onpointerenter={() => manager?.set_focused_selector_id(manager?.selector_id, true)}
32
+ onpointercancel={() => manager?.set_focused_selector_id(null)}
33
+ onpointerleave={() => manager?.set_focused_selector_id(null)}
34
+ >
35
+ <p class="label">Element ID</p>
36
+ <p>{manager?.selector_id}</p>
37
+ </div>
30
38
  {#if manager?.content_type == "number"}
31
39
  <NumberConfig manager={manager?.attributes_manager} />
32
40
  {:else if manager?.content_type == "dropdown"}
@@ -48,6 +48,12 @@ export function create_attributes_input_manager(config) {
48
48
  { key: "space-evenly", name: "Space Evenly" },
49
49
  ]
50
50
 
51
+ function set_focused_selector_id(input) {
52
+ if (typeof config?.set_focused_selector_id == "function") {
53
+ config?.set_focused_selector_id(input)
54
+ }
55
+ }
56
+
51
57
  function init(config) {
52
58
  val_original = set_closurable(config?.val, null)
53
59
  content_type = config?.content_type
@@ -1423,5 +1429,6 @@ export function create_attributes_input_manager(config) {
1423
1429
  return finish_button_manager
1424
1430
  },
1425
1431
  init,
1432
+ set_focused_selector_id,
1426
1433
  }
1427
1434
  }
@@ -28,7 +28,7 @@
28
28
  onpointercancel={() => manager?.set_focused_selector_id(null)}
29
29
  onpointerleave={() => manager?.set_focused_selector_id(null)}
30
30
  >
31
- <div class="el_row">
31
+ <div class="el_row" id={`selector_id_${element_manager?.element?.selector_id}`}>
32
32
  {#if element_manager?.element}
33
33
  {#if manager?.dragged_over_element_child?.selector_id == element_manager?.element?.selector_id && element_manager?.element?.selector_id != manager?.dragging_selector_id && !manager?.dragged_over_element_child?.is_children}
34
34
  <div class="drop_area" style="left: 0; top: 0;">Move Before Element</div>
@@ -10,13 +10,29 @@
10
10
  let { manager, panel_header } = $props()
11
11
  </script>
12
12
 
13
- <div class="container">
13
+ <!-- <div class="container">
14
14
  <div class="panel_builder">
15
15
  {#if panel_header}
16
16
  {@render panel_header()}
17
17
  {/if}
18
18
  <ContentPanelBuilder {manager} />
19
19
  </div>
20
+ <div class="rich_editor">
21
+ <Content manager={manager?.content_manager} overall_manager={manager?.content_overall_manager} />
22
+ </div>
23
+ </div> -->
24
+ <div class="container">
25
+ <div class="panel_builder">
26
+ {#if panel_header}
27
+ <div class="panel_header">
28
+ {@render panel_header()}
29
+ </div>
30
+ {/if}
31
+ <div class="panel_scroll" id={`panel_scroll_${manager?.id}`}>
32
+ <ContentPanelBuilder {manager} />
33
+ </div>
34
+ </div>
35
+
20
36
  <div class="rich_editor">
21
37
  <Content manager={manager?.content_manager} overall_manager={manager?.content_overall_manager} />
22
38
  </div>
@@ -42,14 +58,44 @@
42
58
  </Popover>
43
59
 
44
60
  <style>
61
+ /* .container {
62
+ display: flex;
63
+ }
64
+ .panel_builder {
65
+ width: 35rem;
66
+ }
67
+ .rich_editor {
68
+ flex: 1;
69
+ padding: 0 0.5rem;
70
+ } */
45
71
  .container {
46
72
  display: flex;
73
+ height: 100dvh;
74
+ min-height: 0;
47
75
  }
48
76
  .panel_builder {
49
77
  width: 35rem;
78
+ display: flex;
79
+ flex-direction: column;
80
+ min-height: 0;
81
+ border-right: 1px solid var(--shadow7-t);
82
+ }
83
+ .panel_header {
84
+ position: sticky;
85
+ top: 0;
86
+ z-index: 1;
87
+ background: var(--bg1, #fff);
88
+ }
89
+ .panel_scroll {
90
+ overflow: auto;
91
+ min-height: 0;
92
+ -webkit-overflow-scrolling: touch;
50
93
  }
51
94
  .rich_editor {
52
95
  flex: 1;
53
96
  padding: 0 0.5rem;
97
+ overflow: auto;
98
+ min-height: 0;
99
+ -webkit-overflow-scrolling: touch;
54
100
  }
55
101
  </style>
@@ -550,8 +550,37 @@ export function create_content_input_manager(config) {
550
550
  paste_astc_markdown_popover_manager.close()
551
551
  }
552
552
 
553
- function set_focused_selector_id(selector_id) {
553
+ function scroll_to_selector_id(selector_id) {
554
+ const container = document.getElementById(`panel_scroll_${id}`)
555
+ if (!container || !selector_id) return
556
+ const el = container.querySelector(`#selector_id_${selector_id}`)
557
+ if (!el) return
558
+ const el_rect = el.getBoundingClientRect()
559
+ const c_rect = container.getBoundingClientRect()
560
+ const is_visible = el_rect.top >= c_rect.top && el_rect.bottom <= c_rect.bottom
561
+ if (!is_visible) {
562
+ el.scrollIntoView({
563
+ behavior: "smooth",
564
+ block: "center",
565
+ inline: "nearest",
566
+ })
567
+ }
568
+ }
569
+
570
+ function pulse_focus(selector_id) {
571
+ const container = document.getElementById(`panel_scroll_${id}`)
572
+ const el = container?.querySelector(`#selector_id_${selector_id}`)
573
+ if (!el) return
574
+ el.classList.add("focus_pulse")
575
+ setTimeout(() => el.classList.remove("focus_pulse"), 1000)
576
+ }
577
+
578
+ function set_focused_selector_id(selector_id, is_scroll_to = false) {
554
579
  focused_selector_id = selector_id
580
+ if (selector_id && is_scroll_to) {
581
+ scroll_to_selector_id(selector_id)
582
+ pulse_focus(selector_id)
583
+ }
555
584
  }
556
585
 
557
586
  function add_sibling_el(selector_id, el_type_id, element_to_add = null) {
@@ -1053,6 +1082,7 @@ export function create_content_input_manager(config) {
1053
1082
  storage_default_folder_path: storage_default_folder_path,
1054
1083
  storage_path: storage_path,
1055
1084
  get_defined_options: get_defined_options,
1085
+ set_focused_selector_id: set_focused_selector_id,
1056
1086
  })
1057
1087
  set_selected_version(0)
1058
1088
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sveltekit-ui",
3
- "version": "1.0.51",
3
+ "version": "1.0.52",
4
4
  "description": "A SvelteKit UI component library for building modern web applications",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -31,7 +31,7 @@
31
31
  "@sveltejs/vite-plugin-svelte": "^6.1.4",
32
32
  "@vercel/analytics": "^1.5.0",
33
33
  "typescript": "^5.9.2",
34
- "vite": "^7.1.4"
34
+ "vite": "^7.1.5"
35
35
  },
36
36
  "homepage": "https://www.sveltekit-ui.com",
37
37
  "keywords": [
@@ -885,7 +885,7 @@ export function create_content_manager(config) {
885
885
  }
886
886
  function set_focused_selector_id(input) {
887
887
  if (typeof config?.set_focused_selector_id == "function") {
888
- config?.set_focused_selector_id(input)
888
+ config?.set_focused_selector_id(input, !!input)
889
889
  }
890
890
  }
891
891
 
@@ -27,6 +27,14 @@
27
27
 
28
28
  <Popover manager={manager?.popover_manager}>
29
29
  {#snippet content()}
30
+ <div
31
+ onpointerenter={() => manager?.set_focused_selector_id(manager?.selector_id, true)}
32
+ onpointercancel={() => manager?.set_focused_selector_id(null)}
33
+ onpointerleave={() => manager?.set_focused_selector_id(null)}
34
+ >
35
+ <p class="label">Element ID</p>
36
+ <p>{manager?.selector_id}</p>
37
+ </div>
30
38
  {#if manager?.content_type == "number"}
31
39
  <NumberConfig manager={manager?.attributes_manager} />
32
40
  {:else if manager?.content_type == "dropdown"}
@@ -48,6 +48,12 @@ export function create_attributes_input_manager(config) {
48
48
  { key: "space-evenly", name: "Space Evenly" },
49
49
  ]
50
50
 
51
+ function set_focused_selector_id(input) {
52
+ if (typeof config?.set_focused_selector_id == "function") {
53
+ config?.set_focused_selector_id(input)
54
+ }
55
+ }
56
+
51
57
  function init(config) {
52
58
  val_original = set_closurable(config?.val, null)
53
59
  content_type = config?.content_type
@@ -1423,5 +1429,6 @@ export function create_attributes_input_manager(config) {
1423
1429
  return finish_button_manager
1424
1430
  },
1425
1431
  init,
1432
+ set_focused_selector_id,
1426
1433
  }
1427
1434
  }
@@ -28,7 +28,7 @@
28
28
  onpointercancel={() => manager?.set_focused_selector_id(null)}
29
29
  onpointerleave={() => manager?.set_focused_selector_id(null)}
30
30
  >
31
- <div class="el_row">
31
+ <div class="el_row" id={`selector_id_${element_manager?.element?.selector_id}`}>
32
32
  {#if element_manager?.element}
33
33
  {#if manager?.dragged_over_element_child?.selector_id == element_manager?.element?.selector_id && element_manager?.element?.selector_id != manager?.dragging_selector_id && !manager?.dragged_over_element_child?.is_children}
34
34
  <div class="drop_area" style="left: 0; top: 0;">Move Before Element</div>
@@ -10,13 +10,29 @@
10
10
  let { manager, panel_header } = $props()
11
11
  </script>
12
12
 
13
- <div class="container">
13
+ <!-- <div class="container">
14
14
  <div class="panel_builder">
15
15
  {#if panel_header}
16
16
  {@render panel_header()}
17
17
  {/if}
18
18
  <ContentPanelBuilder {manager} />
19
19
  </div>
20
+ <div class="rich_editor">
21
+ <Content manager={manager?.content_manager} overall_manager={manager?.content_overall_manager} />
22
+ </div>
23
+ </div> -->
24
+ <div class="container">
25
+ <div class="panel_builder">
26
+ {#if panel_header}
27
+ <div class="panel_header">
28
+ {@render panel_header()}
29
+ </div>
30
+ {/if}
31
+ <div class="panel_scroll" id={`panel_scroll_${manager?.id}`}>
32
+ <ContentPanelBuilder {manager} />
33
+ </div>
34
+ </div>
35
+
20
36
  <div class="rich_editor">
21
37
  <Content manager={manager?.content_manager} overall_manager={manager?.content_overall_manager} />
22
38
  </div>
@@ -42,14 +58,44 @@
42
58
  </Popover>
43
59
 
44
60
  <style>
61
+ /* .container {
62
+ display: flex;
63
+ }
64
+ .panel_builder {
65
+ width: 35rem;
66
+ }
67
+ .rich_editor {
68
+ flex: 1;
69
+ padding: 0 0.5rem;
70
+ } */
45
71
  .container {
46
72
  display: flex;
73
+ height: 100dvh;
74
+ min-height: 0;
47
75
  }
48
76
  .panel_builder {
49
77
  width: 35rem;
78
+ display: flex;
79
+ flex-direction: column;
80
+ min-height: 0;
81
+ border-right: 1px solid var(--shadow7-t);
82
+ }
83
+ .panel_header {
84
+ position: sticky;
85
+ top: 0;
86
+ z-index: 1;
87
+ background: var(--bg1, #fff);
88
+ }
89
+ .panel_scroll {
90
+ overflow: auto;
91
+ min-height: 0;
92
+ -webkit-overflow-scrolling: touch;
50
93
  }
51
94
  .rich_editor {
52
95
  flex: 1;
53
96
  padding: 0 0.5rem;
97
+ overflow: auto;
98
+ min-height: 0;
99
+ -webkit-overflow-scrolling: touch;
54
100
  }
55
101
  </style>
@@ -550,8 +550,37 @@ export function create_content_input_manager(config) {
550
550
  paste_astc_markdown_popover_manager.close()
551
551
  }
552
552
 
553
- function set_focused_selector_id(selector_id) {
553
+ function scroll_to_selector_id(selector_id) {
554
+ const container = document.getElementById(`panel_scroll_${id}`)
555
+ if (!container || !selector_id) return
556
+ const el = container.querySelector(`#selector_id_${selector_id}`)
557
+ if (!el) return
558
+ const el_rect = el.getBoundingClientRect()
559
+ const c_rect = container.getBoundingClientRect()
560
+ const is_visible = el_rect.top >= c_rect.top && el_rect.bottom <= c_rect.bottom
561
+ if (!is_visible) {
562
+ el.scrollIntoView({
563
+ behavior: "smooth",
564
+ block: "center",
565
+ inline: "nearest",
566
+ })
567
+ }
568
+ }
569
+
570
+ function pulse_focus(selector_id) {
571
+ const container = document.getElementById(`panel_scroll_${id}`)
572
+ const el = container?.querySelector(`#selector_id_${selector_id}`)
573
+ if (!el) return
574
+ el.classList.add("focus_pulse")
575
+ setTimeout(() => el.classList.remove("focus_pulse"), 1000)
576
+ }
577
+
578
+ function set_focused_selector_id(selector_id, is_scroll_to = false) {
554
579
  focused_selector_id = selector_id
580
+ if (selector_id && is_scroll_to) {
581
+ scroll_to_selector_id(selector_id)
582
+ pulse_focus(selector_id)
583
+ }
555
584
  }
556
585
 
557
586
  function add_sibling_el(selector_id, el_type_id, element_to_add = null) {
@@ -1053,6 +1082,7 @@ export function create_content_input_manager(config) {
1053
1082
  storage_default_folder_path: storage_default_folder_path,
1054
1083
  storage_path: storage_path,
1055
1084
  get_defined_options: get_defined_options,
1085
+ set_focused_selector_id: set_focused_selector_id,
1056
1086
  })
1057
1087
  set_selected_version(0)
1058
1088
  }