@skeletonlabs/skeleton 1.6.2-dev.30c83e2a → 1.6.2-dev.5fcd16e9

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.
@@ -74,7 +74,7 @@ $:
74
74
  {#if optionsFiltered.length > 0}
75
75
  <nav class="autocomplete-nav {classesNav}">
76
76
  <ul class="autocomplete-list {classesList}">
77
- {#each optionsFiltered.slice(0, sliceLimit) as option, i (option)}
77
+ {#each optionsFiltered.slice(0, sliceLimit) as option (option)}
78
78
  <li class="autocomplete-item {classesItem}">
79
79
  <button class="autocomplete-button {classesButton}" type="button" on:click={() => onSelection(option)} on:click on:keypress>
80
80
  {@html option.label}
@@ -5,6 +5,7 @@ export let legend = false;
5
5
  export let spin = false;
6
6
  export let width = "w-24";
7
7
  export let hover = "bg-primary-hover-token";
8
+ export let digits = 0;
8
9
  export let regionCaption = "";
9
10
  export let regionCone = "";
10
11
  export let regionLegend = "";
@@ -32,7 +33,7 @@ function genLegend() {
32
33
  return {
33
34
  label: v.label,
34
35
  color: setColorValue(v.color),
35
- value: v.end - v.start
36
+ value: (v.end - v.start).toFixed(digits)
36
37
  };
37
38
  });
38
39
  }
@@ -13,6 +13,8 @@ declare const __propDef: {
13
13
  width?: string | undefined;
14
14
  /** Style the legend hover effect.*/
15
15
  hover?: string | undefined;
16
+ /** Set the number of digits on the legend values.*/
17
+ digits?: number | undefined;
16
18
  /** Style the caption region above the gradient.*/
17
19
  regionCaption?: string | undefined;
18
20
  /** Style the conic gradient region.*/
@@ -11,6 +11,23 @@ const cBase = "cursor-pointer -outline-offset-[3px]";
11
11
  const cLabel = "flex items-center space-x-4";
12
12
  let checked;
13
13
  let elemInput;
14
+ function areDeeplyEqual(param1, param2) {
15
+ if (param1 === param2)
16
+ return true;
17
+ if (!(param1 instanceof Object) || !(param2 instanceof Object))
18
+ return false;
19
+ const keys1 = Object.keys(param1);
20
+ const keys2 = Object.keys(param2);
21
+ if (keys1.length !== keys2.length)
22
+ return false;
23
+ for (const key of keys1) {
24
+ const value1 = param1[key];
25
+ const value2 = param2[key];
26
+ if (!areDeeplyEqual(value1, value2))
27
+ return false;
28
+ }
29
+ return true;
30
+ }
14
31
  $:
15
32
  if (multiple)
16
33
  updateCheckbox(group);
@@ -41,7 +58,7 @@ function onKeyDown(event) {
41
58
  }
42
59
  }
43
60
  $:
44
- selected = multiple ? group.includes(value) : group === value;
61
+ selected = multiple ? group.some((groupVal) => areDeeplyEqual(value, groupVal)) : areDeeplyEqual(group, value);
45
62
  $:
46
63
  classesActive = selected ? active : hover;
47
64
  $:
@@ -1,4 +1,5 @@
1
1
  <script>import { createEventDispatcher } from "svelte";
2
+ import { leftAngles, leftArrow, rightAngles, rightArrow } from "./icons.js";
2
3
  const dispatch = createEventDispatcher();
3
4
  export let settings = { offset: 0, limit: 5, size: 0, amounts: [1, 2, 5, 10] };
4
5
  export let disabled = false;
@@ -13,11 +14,11 @@ export let regionControl = "btn-group";
13
14
  export let controlVariant = "variant-filled";
14
15
  export let controlSeparator = "";
15
16
  export let active = "variant-filled-primary";
16
- export let buttonClasses = "!px-3 !py-1.5";
17
- export let buttonTextPrevious = "&larr;";
18
- export let buttonTextNext = "&rarr;";
19
- export let buttonTextFirst = "&laquo;";
20
- export let buttonTextLast = "&raquo;";
17
+ export let buttonClasses = "!px-3 !py-1.5 fill-current";
18
+ export let buttonTextPrevious = leftArrow;
19
+ export let buttonTextNext = rightArrow;
20
+ export let buttonTextFirst = leftAngles;
21
+ export let buttonTextLast = rightAngles;
21
22
  const cBase = "flex flex-col md:flex-row items-center space-y-4 md:space-y-0 md:space-x-4";
22
23
  const cLabel = "w-full md:w-auto";
23
24
  let lastPage = Math.ceil(settings.size / settings.limit - 1);
@@ -0,0 +1,4 @@
1
+ export declare const leftArrow = "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"1em\" viewBox=\"0 0 448 512\"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d=\"M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.2 288 416 288c17.7 0 32-14.3 32-32s-14.3-32-32-32l-306.7 0L214.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z\"/></svg>";
2
+ export declare const rightArrow = "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"1em\" viewBox=\"0 0 448 512\"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d=\"M438.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L338.8 224 32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l306.7 0L233.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160z\"/></svg>";
3
+ export declare const leftAngles = "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"1em\" viewBox=\"0 0 512 512\"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d=\"M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 246.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160zm352-160l-160 160c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L301.3 256 438.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0z\"/></svg>";
4
+ export declare const rightAngles = "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"1em\" viewBox=\"0 0 512 512\"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d=\"M470.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L402.7 256 265.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160zm-352 160l160-160c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L210.7 256 73.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0z\"/></svg>";
@@ -0,0 +1,4 @@
1
+ export const leftArrow = `<svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 448 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.2 288 416 288c17.7 0 32-14.3 32-32s-14.3-32-32-32l-306.7 0L214.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z"/></svg>`;
2
+ export const rightArrow = `<svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 448 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M438.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L338.8 224 32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l306.7 0L233.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160z"/></svg>`;
3
+ export const leftAngles = `<svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 246.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160zm352-160l-160 160c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L301.3 256 438.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0z"/></svg>`;
4
+ export const rightAngles = `<svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M470.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L402.7 256 265.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160zm-352 160l160-160c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L210.7 256 73.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0z"/></svg>`;
@@ -3,6 +3,7 @@ const dispatch = createEventDispatcher();
3
3
  export let name;
4
4
  export let checked = false;
5
5
  export let size = "md";
6
+ export let background = "bg-surface-400 dark:bg-surface-700";
6
7
  export let active = "bg-surface-900 dark:bg-surface-300";
7
8
  export let border = "";
8
9
  export let rounded = "rounded-full";
@@ -30,7 +31,7 @@ function onKeyDown(event) {
30
31
  }
31
32
  }
32
33
  $:
33
- cTrackActive = checked ? active : "bg-surface-400 dark:bg-surface-700 cursor-pointer";
34
+ cTrackActive = checked ? active : `${background} cursor-pointer`;
34
35
  $:
35
36
  cThumbBackground = checked ? "bg-white/75" : "bg-white";
36
37
  $:
@@ -8,7 +8,9 @@ declare const __propDef: {
8
8
  checked?: boolean | undefined;
9
9
  /** Sets the size of the component.*/
10
10
  size?: string | undefined;
11
- /** Provide classes to set the checked state color.*/
11
+ /** Provide classe to set the inactive state background color.*/
12
+ background?: string | undefined;
13
+ /** Provide classes to set the active state background color.*/
12
14
  active?: string | undefined;
13
15
  /** Provide classes to set the border styles.*/
14
16
  border?: string | undefined;
@@ -67,10 +67,19 @@ onDestroy(() => {
67
67
  <!-- Navigation -->
68
68
  {#if $state.total > 1}
69
69
  <div class="step-navigation {classesNavigation}" transition:fade|local={{ duration: 100 }}>
70
- <button type={buttonBackType} class="btn {buttonBack}" on:click={onBack} disabled={$state.current === 0}
71
- >{@html buttonBackLabel}</button
72
- >
70
+ {#if stepIndex === 0 && $$slots.navigation}
71
+ <!-- Slot: Navigation -->
72
+ <div class="step-navigation-slot">
73
+ <slot name="navigation" />
74
+ </div>
75
+ {:else}
76
+ <!-- Button: Back -->
77
+ <button type={buttonBackType} class="btn {buttonBack}" on:click={onBack} disabled={$state.current === 0}>
78
+ {@html buttonBackLabel}
79
+ </button>
80
+ {/if}
73
81
  {#if stepIndex < $state.total - 1}
82
+ <!-- Button: Next -->
74
83
  <button type={buttonNextType} class="btn {buttonNext}" on:click={onNext} disabled={locked}>
75
84
  {#if locked}
76
85
  <svg class="w-3 aspect-square" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
@@ -82,6 +91,7 @@ onDestroy(() => {
82
91
  <span>{@html buttonNextLabel}</span>
83
92
  </button>
84
93
  {:else}
94
+ <!-- Button: Complete -->
85
95
  <button type={buttonCompleteType} class="btn {buttonComplete}" on:click={onComplete} disabled={locked}>
86
96
  {@html buttonCompleteLabel}
87
97
  </button>
@@ -32,6 +32,7 @@ declare const __propDef: {
32
32
  slots: {
33
33
  header: {};
34
34
  default: {};
35
+ navigation: {};
35
36
  };
36
37
  };
37
38
  export type StepProps = typeof __propDef.props;
@@ -92,7 +92,7 @@ $:
92
92
  <div class="toc {classesBase}" transition:fade|local={{ duration: 100 }}>
93
93
  <nav class="toc-list {classesList}">
94
94
  <div class="toc-label {classesLabel}">{label}</div>
95
- {#each filteredHeadingsList as headingElem, i}
95
+ {#each filteredHeadingsList as headingElem}
96
96
  <!-- prettier-ignore -->
97
97
  <li
98
98
  class="toc-list-item {classesListItem} {setHeadingClasses(headingElem)} {headingElem.id === activeHeaderId ? active : ''}"
@@ -19,7 +19,7 @@
19
19
 
20
20
  /* Typography Settings */
21
21
  @import 'partials/typography.css';
22
- @import 'partials/typography-prose.css';
22
+ /* DEPRECATED: 'partials/typography-prose.css' must now be imported directly */
23
23
 
24
24
  /* === REQUIRED STYLESHEETS === */
25
25
 
@@ -19,7 +19,7 @@
19
19
 
20
20
  /* Typography Settings */
21
21
  @import 'partials/typography-next.css';
22
- @import 'partials/typography-prose.css';
22
+ /* DEPRECATED: 'partials/typography-prose.css' must now be imported directly */
23
23
 
24
24
  /* === REQUIRED STYLESHEETS === */
25
25
 
@@ -86,10 +86,13 @@ function applyAnimationSettings() {
86
86
  break;
87
87
  }
88
88
  }
89
- function onBackdropInteraction(event) {
90
- if (event.target === elemBackdrop)
89
+ function onDrawerInteraction(event) {
90
+ if (event.target === elemBackdrop) {
91
91
  drawerStore.close();
92
- dispatch("backdrop", event);
92
+ dispatch("backdrop", event);
93
+ } else {
94
+ dispatch("drawer", event);
95
+ }
93
96
  }
94
97
  function onKeydownWindow(event) {
95
98
  if (!$drawerStore)
@@ -125,8 +128,9 @@ $:
125
128
  bind:this={elemBackdrop}
126
129
  class="drawer-backdrop {classesBackdrop}"
127
130
  data-testid="drawer-backdrop"
128
- on:mousedown={onBackdropInteraction}
129
- on:touchstart={onBackdropInteraction}
131
+ on:mousedown={onDrawerInteraction}
132
+ on:touchstart
133
+ on:touchend
130
134
  on:keypress
131
135
  transition:fade|local={{ duration }}
132
136
  use:focusTrap={true}
@@ -36,9 +36,13 @@ declare const __propDef: {
36
36
  describedby?: string | undefined;
37
37
  };
38
38
  events: {
39
+ touchstart: TouchEvent;
40
+ touchend: TouchEvent;
39
41
  keypress: KeyboardEvent;
40
42
  /** {{ event }} backdrop - Fires on backdrop interaction.*/
41
43
  backdrop: CustomEvent<any>;
44
+ /** {{ event }} drawer - Fires on drawer interaction.*/
45
+ drawer: CustomEvent<any>;
42
46
  } & {
43
47
  [evt: string]: CustomEvent<any>;
44
48
  };
@@ -49,7 +49,8 @@ $:
49
49
  </script>
50
50
 
51
51
  <svelte:head>
52
- {@html `<script nonce="%sveltekit.nonce%">(${setInitialClassState.toString()})();</script>`}
52
+ <!-- Workaround for a svelte parsing error: https://github.com/sveltejs/eslint-plugin-svelte/issues/492 -->
53
+ {@html `<\u{73}cript nonce="%sveltekit.nonce%">(${setInitialClassState.toString()})();</script>`}
53
54
  </svelte:head>
54
55
 
55
56
  <div
@@ -37,6 +37,7 @@ const buttonTextDefaults = {
37
37
  buttonTextSubmit
38
38
  };
39
39
  let currentComponent;
40
+ let registeredInteractionWithBackdrop = false;
40
41
  modalStore.subscribe((modals) => {
41
42
  if (!modals.length)
42
43
  return;
@@ -47,16 +48,25 @@ modalStore.subscribe((modals) => {
47
48
  buttonTextSubmit = modals[0].buttonTextSubmit || buttonTextDefaults.buttonTextSubmit;
48
49
  currentComponent = typeof modals[0].component === "string" ? components[modals[0].component] : modals[0].component;
49
50
  });
50
- function onBackdropInteraction(event) {
51
+ function onBackdropInteractionBegin(event) {
51
52
  if (!(event.target instanceof Element))
52
53
  return;
53
54
  const classList = event.target.classList;
54
55
  if (classList.contains("modal-backdrop") || classList.contains("modal-transition")) {
56
+ registeredInteractionWithBackdrop = true;
57
+ }
58
+ }
59
+ function onBackdropInteractionEnd(event) {
60
+ if (!(event.target instanceof Element))
61
+ return;
62
+ const classList = event.target.classList;
63
+ if ((classList.contains("modal-backdrop") || classList.contains("modal-transition")) && registeredInteractionWithBackdrop) {
55
64
  if ($modalStore[0].response)
56
65
  $modalStore[0].response(void 0);
57
66
  modalStore.close();
58
67
  dispatch("backdrop", event);
59
68
  }
69
+ registeredInteractionWithBackdrop = false;
60
70
  }
61
71
  function onClose() {
62
72
  if ($modalStore[0].response)
@@ -128,8 +138,10 @@ $:
128
138
  <div
129
139
  class="modal-backdrop {classesBackdrop}"
130
140
  data-testid="modal-backdrop"
131
- on:mousedown={onBackdropInteraction}
132
- on:touchstart={onBackdropInteraction}
141
+ on:mousedown={onBackdropInteractionBegin}
142
+ on:mouseup={onBackdropInteractionEnd}
143
+ on:touchstart
144
+ on:touchend
133
145
  transition:fade={{ duration }}
134
146
  use:focusTrap={true}
135
147
  >
@@ -51,6 +51,8 @@ declare const __propDef: {
51
51
  regionFooter?: string | undefined;
52
52
  };
53
53
  events: {
54
+ touchstart: TouchEvent;
55
+ touchend: TouchEvent;
54
56
  /** {{ event }} backdrop - Fires on backdrop interaction.*/
55
57
  backdrop: CustomEvent<any>;
56
58
  } & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skeletonlabs/skeleton",
3
- "version": "1.6.2-dev.30c83e2a",
3
+ "version": "1.6.2-dev.5fcd16e9",
4
4
  "description": "A SvelteKit component library.",
5
5
  "author": "endigo9740 <chris@skeletonlabs.dev>",
6
6
  "repository": {
@@ -41,7 +41,7 @@
41
41
  "autoprefixer": "10.4.14",
42
42
  "eslint": "8.37.0",
43
43
  "eslint-config-prettier": "8.8.0",
44
- "eslint-plugin-svelte3": "4.0.0",
44
+ "eslint-plugin-svelte": "^2.29.0",
45
45
  "jsdom": "21.1.1",
46
46
  "postcss": "8.4.21",
47
47
  "postcss-import": "15.1.0",