sveltekit-ui 1.0.49 → 1.0.50

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.
@@ -40,6 +40,7 @@
40
40
  <div style="display: flex; flex-direction: column; gap: .5rem;">
41
41
  <Button manager={manager?.copy_link_button_manager} />
42
42
  <Button manager={manager?.goto_link_button_manager} />
43
+ <Button manager={manager?.goto_link_same_tab_button_manager} />
43
44
  </div>
44
45
  {/snippet}
45
46
  </Popover>
@@ -10,6 +10,7 @@ export function create_link_manager(config) {
10
10
  let popover_manager = $state(null)
11
11
  let copy_link_button_manager = $state(null)
12
12
  let goto_link_button_manager = $state(null)
13
+ let goto_link_same_tab_button_manager = $state(null)
13
14
  let inline_goto_link_button_manager = $state(null)
14
15
  let qr_manager = $state(null)
15
16
 
@@ -32,18 +33,18 @@ export function create_link_manager(config) {
32
33
  }
33
34
  }
34
35
 
35
- function open_link() {
36
+ function open_link(is_open_same_tab = false) {
36
37
  if (is_internal_link) {
37
38
  goto(href)
38
39
  } else {
39
40
  if (typeof config?.on_goto_external_link == "function") {
40
41
  config?.on_goto_external_link(href)
41
42
  }
42
- window.open(href, "_blank", "noopener,noreferrer")
43
- // Object.assign(document.createElement("a"), {
44
- // target: "_blank",
45
- // href: href,
46
- // }).click()
43
+ if (is_open_same_tab) {
44
+ window.location.href = href
45
+ } else {
46
+ window.open(href, "_blank", "noopener,noreferrer")
47
+ }
47
48
  }
48
49
  }
49
50
 
@@ -52,7 +53,7 @@ export function create_link_manager(config) {
52
53
  type: "dropdown",
53
54
  header: "Link Preview",
54
55
  target_width: 400,
55
- target_height: 400,
56
+ target_height: 460,
56
57
  anchor_id: () => `link_${id}`,
57
58
  })
58
59
  copy_link_button_manager = create_button_manager({
@@ -69,6 +70,12 @@ export function create_link_manager(config) {
69
70
  text_align: "left",
70
71
  on_click: () => open_link(),
71
72
  })
73
+ goto_link_same_tab_button_manager = create_button_manager({
74
+ support_icon: "link_internal",
75
+ text: "Open Link In Same Tab",
76
+ text_align: "left",
77
+ on_click: () => open_link(true),
78
+ })
72
79
  inline_goto_link_button_manager = create_button_manager({
73
80
  type: "soft",
74
81
  min_height: 2,
@@ -105,6 +112,9 @@ export function create_link_manager(config) {
105
112
  get goto_link_button_manager() {
106
113
  return goto_link_button_manager
107
114
  },
115
+ get goto_link_same_tab_button_manager() {
116
+ return goto_link_same_tab_button_manager
117
+ },
108
118
  get inline_goto_link_button_manager() {
109
119
  return inline_goto_link_button_manager
110
120
  },
@@ -118,6 +118,10 @@
118
118
  padding: 0;
119
119
  }
120
120
  .slider_box {
121
+ overscroll-behavior: contain;
122
+ -webkit-user-select: none;
123
+ user-select: none;
124
+ -webkit-tap-highlight-color: transparent;
121
125
  margin: 0.1rem;
122
126
  width: 100%;
123
127
  height: var(--h);
@@ -146,6 +150,7 @@
146
150
  background: var(--g12-t);
147
151
  }
148
152
  .slider {
153
+ appearance: none;
149
154
  -webkit-appearance: none;
150
155
  position: absolute;
151
156
  display: flex;
@@ -189,6 +194,9 @@
189
194
  background: linear-gradient(-45deg, var(--g24), var(--g20));
190
195
  box-shadow: 0 0 0.4rem 0.1rem var(--shadow8);
191
196
  transition: box-shadow 0.3s;
197
+ touch-action: none;
198
+ -webkit-user-select: none;
199
+ user-select: none;
192
200
  }
193
201
  .thumb_hovered {
194
202
  box-shadow:
@@ -5358,6 +5358,10 @@ export const definitions = {
5358
5358
  type: "object",
5359
5359
  description: "Button manager for the 'Open Link In New Tab' button in the popover.",
5360
5360
  },
5361
+ goto_link_same_tab_button_manager: {
5362
+ type: "object",
5363
+ description: "Button manager for the 'Open Link In Same Tab' button in the popover.",
5364
+ },
5361
5365
  inline_goto_link_button_manager: {
5362
5366
  type: "object",
5363
5367
  description: "Button manager displayed inline for direct navigation if `is_show_preview` is false.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sveltekit-ui",
3
- "version": "1.0.49",
3
+ "version": "1.0.50",
4
4
  "description": "A SvelteKit UI component library for building modern web applications",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "devDependencies": {
28
28
  "@sveltejs/adapter-vercel": "^5.10.2",
29
- "@sveltejs/kit": "^2.37.0",
29
+ "@sveltejs/kit": "^2.37.1",
30
30
  "@sveltejs/package": "^2.5.0",
31
31
  "@sveltejs/vite-plugin-svelte": "^6.1.4",
32
32
  "@vercel/analytics": "^1.5.0",
@@ -40,6 +40,7 @@
40
40
  <div style="display: flex; flex-direction: column; gap: .5rem;">
41
41
  <Button manager={manager?.copy_link_button_manager} />
42
42
  <Button manager={manager?.goto_link_button_manager} />
43
+ <Button manager={manager?.goto_link_same_tab_button_manager} />
43
44
  </div>
44
45
  {/snippet}
45
46
  </Popover>
@@ -10,6 +10,7 @@ export function create_link_manager(config) {
10
10
  let popover_manager = $state(null)
11
11
  let copy_link_button_manager = $state(null)
12
12
  let goto_link_button_manager = $state(null)
13
+ let goto_link_same_tab_button_manager = $state(null)
13
14
  let inline_goto_link_button_manager = $state(null)
14
15
  let qr_manager = $state(null)
15
16
 
@@ -32,18 +33,18 @@ export function create_link_manager(config) {
32
33
  }
33
34
  }
34
35
 
35
- function open_link() {
36
+ function open_link(is_open_same_tab = false) {
36
37
  if (is_internal_link) {
37
38
  goto(href)
38
39
  } else {
39
40
  if (typeof config?.on_goto_external_link == "function") {
40
41
  config?.on_goto_external_link(href)
41
42
  }
42
- window.open(href, "_blank", "noopener,noreferrer")
43
- // Object.assign(document.createElement("a"), {
44
- // target: "_blank",
45
- // href: href,
46
- // }).click()
43
+ if (is_open_same_tab) {
44
+ window.location.href = href
45
+ } else {
46
+ window.open(href, "_blank", "noopener,noreferrer")
47
+ }
47
48
  }
48
49
  }
49
50
 
@@ -52,7 +53,7 @@ export function create_link_manager(config) {
52
53
  type: "dropdown",
53
54
  header: "Link Preview",
54
55
  target_width: 400,
55
- target_height: 400,
56
+ target_height: 460,
56
57
  anchor_id: () => `link_${id}`,
57
58
  })
58
59
  copy_link_button_manager = create_button_manager({
@@ -69,6 +70,12 @@ export function create_link_manager(config) {
69
70
  text_align: "left",
70
71
  on_click: () => open_link(),
71
72
  })
73
+ goto_link_same_tab_button_manager = create_button_manager({
74
+ support_icon: "link_internal",
75
+ text: "Open Link In Same Tab",
76
+ text_align: "left",
77
+ on_click: () => open_link(true),
78
+ })
72
79
  inline_goto_link_button_manager = create_button_manager({
73
80
  type: "soft",
74
81
  min_height: 2,
@@ -105,6 +112,9 @@ export function create_link_manager(config) {
105
112
  get goto_link_button_manager() {
106
113
  return goto_link_button_manager
107
114
  },
115
+ get goto_link_same_tab_button_manager() {
116
+ return goto_link_same_tab_button_manager
117
+ },
108
118
  get inline_goto_link_button_manager() {
109
119
  return inline_goto_link_button_manager
110
120
  },
@@ -118,6 +118,10 @@
118
118
  padding: 0;
119
119
  }
120
120
  .slider_box {
121
+ overscroll-behavior: contain;
122
+ -webkit-user-select: none;
123
+ user-select: none;
124
+ -webkit-tap-highlight-color: transparent;
121
125
  margin: 0.1rem;
122
126
  width: 100%;
123
127
  height: var(--h);
@@ -146,6 +150,7 @@
146
150
  background: var(--g12-t);
147
151
  }
148
152
  .slider {
153
+ appearance: none;
149
154
  -webkit-appearance: none;
150
155
  position: absolute;
151
156
  display: flex;
@@ -189,6 +194,9 @@
189
194
  background: linear-gradient(-45deg, var(--g24), var(--g20));
190
195
  box-shadow: 0 0 0.4rem 0.1rem var(--shadow8);
191
196
  transition: box-shadow 0.3s;
197
+ touch-action: none;
198
+ -webkit-user-select: none;
199
+ user-select: none;
192
200
  }
193
201
  .thumb_hovered {
194
202
  box-shadow:
@@ -5358,6 +5358,10 @@ export const definitions = {
5358
5358
  type: "object",
5359
5359
  description: "Button manager for the 'Open Link In New Tab' button in the popover.",
5360
5360
  },
5361
+ goto_link_same_tab_button_manager: {
5362
+ type: "object",
5363
+ description: "Button manager for the 'Open Link In Same Tab' button in the popover.",
5364
+ },
5361
5365
  inline_goto_link_button_manager: {
5362
5366
  type: "object",
5363
5367
  description: "Button manager displayed inline for direct navigation if `is_show_preview` is false.",