fluid-ui-svelte 0.1.8 → 0.2.0

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.
@@ -23,8 +23,8 @@
23
23
  shouldCloseOnClickOutside: boolean;
24
24
  dropdownTrigger: Snippet<[options: { isOpen: boolean; toggleDropdown: Function }]>;
25
25
  dropdownContent: Snippet<[options: { isOpen: boolean; toggleDropdown: Function }]>;
26
- triggerRawElement: HTMLElement;
27
- contentRawElement: HTMLElement;
26
+ triggerRawElement?: HTMLElement;
27
+ contentRawElement?: HTMLElement;
28
28
  } = $props();
29
29
 
30
30
  const componentOptions: DropdownOptions = {
@@ -38,7 +38,7 @@
38
38
  if (shouldCloseOnClickOutside) {
39
39
  document.addEventListener("click", (e) => {
40
40
  if (isOpen && e.target) {
41
- if (!triggerRawElement.contains(e.target as HTMLElement) && !contentRawElement.contains(e.target as HTMLElement)) {
41
+ if (!triggerRawElement!.contains(e.target as HTMLElement) && !contentRawElement!.contains(e.target as HTMLElement)) {
42
42
  isOpen = false;
43
43
  }
44
44
  }
@@ -14,7 +14,7 @@ declare const Dropdown: import("svelte").Component<{
14
14
  isOpen: boolean;
15
15
  toggleDropdown: Function;
16
16
  }]>;
17
- triggerRawElement: HTMLElement;
18
- contentRawElement: HTMLElement;
17
+ triggerRawElement?: HTMLElement;
18
+ contentRawElement?: HTMLElement;
19
19
  }, {}, "isOpen">;
20
20
  export default Dropdown;
@@ -20,7 +20,7 @@
20
20
  let status: "loading" | "done" | "failed" = $state("loading");
21
21
  </script>
22
22
 
23
- {#if status == "failed"}
23
+ {#if status == "failed" || !restProps.src}
24
24
  {#if placeholderSnippet}
25
25
  <div class="fluid-image-error">
26
26
  {@render placeholderSnippet()}
@@ -28,14 +28,16 @@
28
28
  {:else}
29
29
  <p>Image not loaded, provide placeholder.</p>
30
30
  {/if}
31
- {:else if status == "loading" || "done"}
32
- <div class={"fluid-image-loading" + status !== "loading" ? " hidden" : ""}>
33
- {#if loadingSnippet}
34
- {@render loadingSnippet()}
35
- {:else}
36
- <p>Image loading, provide placeholder.</p>
37
- {/if}
38
- </div>
31
+ {:else}
32
+ {#if status == "loading"}
33
+ <div class={"fluid-image-loading" + (status !== "loading" ? " hidden" : "")}>
34
+ {#if loadingSnippet}
35
+ {@render loadingSnippet()}
36
+ {:else}
37
+ <p>Image loading, provide placeholder.</p>
38
+ {/if}
39
+ </div>
40
+ {/if}
39
41
  <img
40
42
  bind:this={rawElement}
41
43
  {...restProps}
@@ -47,6 +49,6 @@
47
49
  status = "done";
48
50
  console.log(status);
49
51
  }}
50
- class={(overrideDefaultStyling ? "" : "fluid-image") + (className ? (overrideDefaultStyling ? `${className}` : ` ${className}`) : "") + (status == "loading" ? " invisible" : "")}
52
+ class={(overrideDefaultStyling ? "" : "fluid-image") + (className ? (overrideDefaultStyling ? `${className}` : ` ${className}`) : "") + (status == "done" ? "" : " hidden")}
51
53
  />
52
54
  {/if}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluid-ui-svelte",
3
- "version": "0.1.8",
3
+ "version": "0.2.0",
4
4
  "author": {
5
5
  "name": "Emre Ayaz",
6
6
  "email": "emreayaz@frostium.io",