@dosgato/dialog 0.0.35 → 0.0.37

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.
@@ -37,8 +37,7 @@ const treeStore = new TreeStore(fetchChildren);
37
37
  const selected = derivedStore(treeStore, 'selectedItems.0');
38
38
  $: store.setSource($currentName);
39
39
  $: selectPreview($preview, $source);
40
- $: if (['asset', 'page'].includes($selected?.type))
41
- store.setPreview($selected);
40
+ $: store.setPreview($selected);
42
41
  function onChoose() {
43
42
  dispatch('change', $store.preview);
44
43
  }
@@ -101,7 +100,7 @@ onMount(async () => {
101
100
  </section>
102
101
  <section class="dialog-chooser-preview" tabindex="-1">
103
102
  {#if $preview}
104
- <Thumbnail item={$preview} />
103
+ <Thumbnail item={$preview} larger />
105
104
  <Details item={$preview}>
106
105
  {#if $preview.type === 'folder'}
107
106
  <li>{$selected?.children?.length ?? 0} sub-items</li>
@@ -75,6 +75,7 @@ export interface Asset extends Item {
75
75
  width: number;
76
76
  height: number;
77
77
  thumbnailUrl?: string;
78
+ previewUrl?: string;
78
79
  };
79
80
  }
80
81
  export {};
@@ -3,12 +3,13 @@ import fileLinkOutline from '@iconify-icons/mdi/file-link-outline.js';
3
3
  import FileIcon from '../FileIcon.svelte';
4
4
  import Icon from '../Icon.svelte';
5
5
  export let item;
6
+ export let larger = false;
6
7
  </script>
7
8
 
8
9
  <div class="dialog-chooser-thumbnail">
9
10
  {#if item.type === 'asset'}
10
11
  {#if item.image}
11
- <img src={item.image.thumbnailUrl} alt="" />
12
+ <img src={(larger ? item.image.thumbnailUrl : item.image.previewUrl) ?? item.image.thumbnailUrl ?? item.url} alt="" />
12
13
  {:else}
13
14
  <FileIcon mime={item.mime} width='5em' />
14
15
  {/if}
@@ -4,6 +4,7 @@ import type { RawURL } from './ChooserStore';
4
4
  declare const __propDef: {
5
5
  props: {
6
6
  item: AnyItem | RawURL;
7
+ larger?: boolean | undefined;
7
8
  };
8
9
  events: {
9
10
  [evt: string]: CustomEvent<any>;
@@ -43,7 +43,7 @@ const groupid = randomid();
43
43
  .color-container {
44
44
  display: grid;
45
45
  grid-gap: 10px;
46
- grid-template-columns: 1fr 1fr 1fr;
46
+ grid-template-columns: 1fr 1fr 1fr 1fr;
47
47
  }
48
48
 
49
49
  label.colorsel :global(input[type="radio"]) {
@@ -39,7 +39,7 @@ let container;
39
39
  function onMouseDown(e) {
40
40
  if (!updateRect())
41
41
  return;
42
- if (e instanceof TouchEvent && e.touches.length > 1)
42
+ if (window.TouchEvent && TouchEvent && e instanceof TouchEvent && e.touches.length > 1)
43
43
  return;
44
44
  const clientX = e instanceof MouseEvent ? e.clientX : e.touches[0].clientX;
45
45
  const clientY = e instanceof MouseEvent ? e.clientY : e.touches[0].clientY;
@@ -51,7 +51,7 @@ function onMouseDown(e) {
51
51
  function onMouseMove(e) {
52
52
  if (!updateRect())
53
53
  return;
54
- if (e instanceof TouchEvent && e.touches.length > 1)
54
+ if (window.TouchEvent && e instanceof TouchEvent && e.touches.length > 1)
55
55
  return;
56
56
  const clientX = e instanceof MouseEvent ? e.clientX : e.touches[0].clientX;
57
57
  const clientY = e instanceof MouseEvent ? e.clientY : e.touches[0].clientY;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dosgato/dialog",
3
3
  "description": "A component library for building forms that edit a JSON document.",
4
- "version": "0.0.35",
4
+ "version": "0.0.37",
5
5
  "dependencies": {
6
6
  "@txstate-mws/svelte-components": "^1.3.7",
7
7
  "@txstate-mws/svelte-forms": "^1.3.4",