@skeletonlabs/skeleton 1.8.0-dev.cbef3c34 → 1.8.0-dev.f48b8ca0

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,5 +1,5 @@
1
1
  declare namespace svelteHTML {
2
- interface HTMLAttributes<T> {
3
- 'on:copyComplete'?: (event: any) => any;
2
+ interface HTMLAttributes {
3
+ 'on:copyComplete'?: () => void;
4
4
  }
5
5
  }
@@ -1,4 +1,10 @@
1
- export declare function clipboard(node: HTMLElement, args: any): {
2
- update(newArgs: any): void;
1
+ type ClipboardArgs = string | {
2
+ element: string;
3
+ } | {
4
+ input: string;
5
+ };
6
+ export declare function clipboard(node: HTMLElement, args: ClipboardArgs): {
7
+ update(newArgs: ClipboardArgs): void;
3
8
  destroy(): void;
4
9
  };
10
+ export {};
@@ -1,4 +1,3 @@
1
- // Action: Clipboard
2
1
  export function clipboard(node, args) {
3
2
  const fireCopyCompleteEvent = () => {
4
3
  node.dispatchEvent(new CustomEvent('copyComplete'));
@@ -7,15 +6,19 @@ export function clipboard(node, args) {
7
6
  // Handle `data-clipboard` target based on object key
8
7
  if (typeof args === 'object') {
9
8
  // Element Inner HTML
10
- if (Object.prototype.hasOwnProperty.call(args, 'element')) {
9
+ if ('element' in args) {
11
10
  const element = document.querySelector(`[data-clipboard="${args.element}"]`);
12
- copyToClipboard(element?.innerHTML, 'text/html').then(fireCopyCompleteEvent);
11
+ if (!element)
12
+ throw new Error(`Missing HTMLElement with an attribute of [data-clipboard="${args.element}"]`);
13
+ copyToClipboard(element.innerHTML, 'text/html').then(fireCopyCompleteEvent);
13
14
  return;
14
15
  }
15
16
  // Form Input Value
16
- if (Object.prototype.hasOwnProperty.call(args, 'input')) {
17
+ if ('input' in args) {
17
18
  const input = document.querySelector(`[data-clipboard="${args.input}"]`);
18
- copyToClipboard(input?.value).then(fireCopyCompleteEvent);
19
+ if (!input)
20
+ throw new Error(`Missing HTMLInputElement with an attribute of [data-clipboard="${args.input}"]`);
21
+ copyToClipboard(input.value).then(fireCopyCompleteEvent);
19
22
  return;
20
23
  }
21
24
  }
@@ -1,3 +1,6 @@
1
- export declare function filter(node: HTMLElement, filterName: string): {
2
- update(newArgs: any): void;
1
+ type Filters = ['Apollo', 'BlueNight', 'Emerald', 'GreenFall', 'Noir', 'NoirLight', 'Rustic', 'Summer84', 'XPro'];
2
+ type FilterName = `#${Filters[number]}` | (string & {});
3
+ export declare function filter(node: HTMLElement, filterName: FilterName): {
4
+ update(newArgs: FilterName): void;
3
5
  } | undefined;
6
+ export {};
@@ -2,7 +2,7 @@
2
2
  export let display = "inline-flex";
3
3
  export let background = "bg-surface-200-700-token";
4
4
  export let border = "border-token border-surface-400-500-token";
5
- export let spacing = "space-x-1";
5
+ export let spacing = "";
6
6
  export let rounded = "rounded-token";
7
7
  export let padding = "px-4 py-1";
8
8
  export let active = "variant-filled";
@@ -17,6 +17,8 @@ setContext("hover", hover);
17
17
  setContext("color", color);
18
18
  setContext("fill", fill);
19
19
  const cBase = "p-1";
20
+ $:
21
+ spacing = `${display.includes("flex-col") ? "" : "space-x-1"}`;
20
22
  $:
21
23
  classesBase = `${cBase} ${display} ${background} ${border} ${spacing} ${rounded} ${$$props.class ?? ""}`;
22
24
  </script>
@@ -1,6 +1,7 @@
1
1
  <script>import { createEventDispatcher } from "svelte/internal";
2
2
  export let value = 0;
3
3
  export let max = 5;
4
+ export let interactive = false;
4
5
  export let text = "text-token";
5
6
  export let fill = "fill-token";
6
7
  export let justify = "justify-center";
@@ -13,6 +14,10 @@ function iconClick(index) {
13
14
  });
14
15
  }
15
16
  const cBase = "w-full flex";
17
+ $:
18
+ elemInteractive = interactive ? "button" : "span";
19
+ $:
20
+ attrInteractive = interactive ? { type: "button" } : {};
16
21
  $:
17
22
  classesBase = `${cBase} ${text} ${fill} ${justify} ${spacing} ${$$props.class ?? ""}`;
18
23
  </script>
@@ -21,11 +26,17 @@ $:
21
26
  <!-- eslint-disable-next-line @typescript-eslint/no-unused-vars -->
22
27
  {#each Array(max) as _, i}
23
28
  {#if Math.floor(value) >= i + 1}
24
- <button type="button" class="rating-icon {regionIcon}" on:click={() => iconClick(i)}><slot name="full" /></button>
29
+ <svelte:element this={elemInteractive} {...attrInteractive} class="rating-icon {regionIcon}" on:click={() => iconClick(i)}>
30
+ <slot name="full" />
31
+ </svelte:element>
25
32
  {:else if value === i + 0.5}
26
- <button type="button" class="rating-icon {regionIcon}" on:click={() => iconClick(i)}><slot name="half" /></button>
33
+ <svelte:element this={elemInteractive} {...attrInteractive} class="rating-icon {regionIcon}" on:click={() => iconClick(i)}>
34
+ <slot name="half" />
35
+ </svelte:element>
27
36
  {:else}
28
- <button type="button" class="rating-icon {regionIcon}" on:click={() => iconClick(i)}><slot name="empty" /></button>
37
+ <svelte:element this={elemInteractive} {...attrInteractive} class="rating-icon {regionIcon}" on:click={() => iconClick(i)}>
38
+ <slot name="empty" />
39
+ </svelte:element>
29
40
  {/if}
30
41
  {/each}
31
42
  </div>
@@ -6,6 +6,8 @@ declare const __propDef: {
6
6
  value?: number | undefined;
7
7
  /** Maximum rating value.*/
8
8
  max?: number | undefined;
9
+ /** Enables interactive mode for each rating icon.*/
10
+ interactive?: boolean | undefined;
9
11
  /** Provide classes to set the text color.*/
10
12
  text?: string | undefined;
11
13
  /** Provide classes to set the SVG fill color.*/
@@ -136,6 +136,7 @@ $:
136
136
  use:focusTrap={true}
137
137
  >
138
138
  <!-- Drawer -->
139
+ <!-- separate In/Out so anim values update -->
139
140
  <div
140
141
  bind:this={elemDrawer}
141
142
  class="drawer {classesDrawer}"
@@ -144,7 +145,8 @@ $:
144
145
  aria-modal="true"
145
146
  aria-labelledby={labelledby}
146
147
  aria-describedby={describedby}
147
- transition:fly|local={{ x: anim.x, y: anim.y, duration }}
148
+ in:fly|local={{ x: anim.x, y: anim.y, duration }}
149
+ out:fly|local={{ x: anim.x, y: anim.y, duration }}
148
150
  >
149
151
  <!-- Slot: Default -->
150
152
  <slot />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skeletonlabs/skeleton",
3
- "version": "1.8.0-dev.cbef3c34",
3
+ "version": "1.8.0-dev.f48b8ca0",
4
4
  "description": "A SvelteKit component library.",
5
5
  "author": "endigo9740 <chris@skeletonlabs.dev>",
6
6
  "repository": {