@axium/contacts 0.2.5 → 0.2.7

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.
@@ -1,9 +1,9 @@
1
1
  <script lang="ts">
2
+ import { origin, userInfo } from '@axium/client';
3
+ import UserPFP from '@axium/client/components/UserPFP';
2
4
  import type { InitNoExternal } from '@axium/contacts';
3
- import { colorHashRGB } from '@axium/core/color';
4
5
  import { name as formatName } from '@axium/contacts/client/format';
5
- import UserPFP from '@axium/client/components/UserPFP';
6
- import { userInfo } from '@axium/client';
6
+ import { colorHashRGB } from '@axium/core/color';
7
7
 
8
8
  let { contact, isDefault = $bindable() }: { contact: InitNoExternal & { id: string }; isDefault?: boolean } = $props();
9
9
 
@@ -15,7 +15,7 @@
15
15
  </svg>`.replaceAll(/[\t\n]/g, '')
16
16
  );
17
17
 
18
- let src = $state(`/raw/contacts/pfp/${contact.id}`);
18
+ let src = $state(`${origin}/raw/contacts/pfp/${contact.id}`);
19
19
  </script>
20
20
 
21
21
  {#if contact.linkedUserId}
package/lib/Field.svelte CHANGED
@@ -18,7 +18,11 @@
18
18
 
19
19
  <span>
20
20
  {#if link}
21
- <a href={link} target="_blank" rel="noopener noreferrer">{@render content()}</a>
21
+ {#if link[0] == '/' && link[1] != '/'}
22
+ <a href={link}>{@render content()}</a>
23
+ {:else}
24
+ <a href={link} target="_blank" rel="noopener noreferrer">{@render content()}</a>
25
+ {/if}
22
26
  {:else}
23
27
  {@render content()}
24
28
  {/if}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axium/contacts",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "author": "James Prevett <axium@jamespre.dev>",
5
5
  "description": "Contacts for Axium",
6
6
  "funding": {
@@ -38,7 +38,7 @@
38
38
  "build": "tsc"
39
39
  },
40
40
  "peerDependencies": {
41
- "@axium/client": ">=0.23.1",
41
+ "@axium/client": ">=0.25.0",
42
42
  "@axium/core": ">=0.26.0",
43
43
  "@axium/server": ">=0.43.0",
44
44
  "@sveltejs/kit": "^2.27.3",
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { fetchAPI, text } from '@axium/client';
2
+ import { fetchAPI, origin, text } from '@axium/client';
3
3
  import { FormDialog, Icon, Popover } from '@axium/client/components';
4
4
  import { toast, toastStatus } from '@axium/client/toast';
5
5
  import { toVCard } from '@axium/contacts';
@@ -15,7 +15,7 @@
15
15
  async function updatePicture() {
16
16
  try {
17
17
  const file = await upload('image/*');
18
- const response = await fetch('/raw/contacts/pfp/' + contact.id, {
18
+ const response = await fetch(`${origin}/raw/contacts/pfp/${contact.id}`, {
19
19
  method: 'POST',
20
20
  headers: { 'content-type': file.type, 'content-length': file.size.toString() },
21
21
  body: file,
@@ -95,7 +95,10 @@
95
95
  <div
96
96
  class="menu-item"
97
97
  onclick={() =>
98
- toastStatus(fetch('/raw/contacts/pfp/' + contact.id, { method: 'DELETE' }), text('contacts.image.toast_removed'))}
98
+ toastStatus(
99
+ fetch(`${origin}/raw/contacts/pfp/${contact.id}`, { method: 'DELETE' }),
100
+ text('contacts.image.toast_removed')
101
+ )}
99
102
  >
100
103
  <Icon i="trash" />
101
104
  <span>{text('contacts.image.remove')}</span>