@skeletonlabs/skeleton 2.6.1-dev.21f83326 → 2.6.1-dev.a2e14d03

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.
@@ -7,8 +7,8 @@ import { dynamicTransition } from "../../internal/transitions.js";
7
7
  const dispatch = createEventDispatcher();
8
8
  import { focusTrap } from "../../actions/FocusTrap/focusTrap.js";
9
9
  import { getModalStore } from "./stores.js";
10
- export let components = {};
11
10
  export let position = "items-center";
11
+ export let components = {};
12
12
  export let background = "bg-surface-100-800-token";
13
13
  export let width = "w-modal";
14
14
  export let height = "h-auto";
@@ -22,7 +22,7 @@ export let buttonPositive = "variant-filled";
22
22
  export let buttonTextCancel = "Cancel";
23
23
  export let buttonTextConfirm = "Confirm";
24
24
  export let buttonTextSubmit = "Submit";
25
- export let regionBackdrop = "";
25
+ export let regionBackdrop = "bg-surface-backdrop-token";
26
26
  export let regionHeader = "text-2xl font-bold";
27
27
  export let regionBody = "max-h-[200px] overflow-hidden";
28
28
  export let regionFooter = "flex justify-end space-x-2";
@@ -31,8 +31,8 @@ export let transitionIn = fly;
31
31
  export let transitionInParams = { duration: 150, opacity: 0, x: 0, y: 100 };
32
32
  export let transitionOut = fly;
33
33
  export let transitionOutParams = { duration: 150, opacity: 0, x: 0, y: 100 };
34
- const cBackdrop = "fixed top-0 left-0 right-0 bottom-0 bg-surface-backdrop-token p-4";
35
- const cTransitionLayer = "w-full h-fit min-h-full overflow-y-auto flex justify-center";
34
+ const cBackdrop = "fixed top-0 left-0 right-0 bottom-0";
35
+ const cTransitionLayer = "w-full h-fit min-h-full p-4 overflow-y-auto flex justify-center";
36
36
  const cModal = "block overflow-y-auto";
37
37
  const cModalImage = "w-full h-auto";
38
38
  let promptValue;
@@ -47,17 +47,16 @@ let modalElement;
47
47
  let windowHeight;
48
48
  let backdropOverflow = "overflow-y-hidden";
49
49
  const modalStore = getModalStore();
50
- $:
51
- if ($modalStore.length)
52
- handleModals($modalStore);
53
- function handleModals(modals) {
50
+ modalStore.subscribe((modals) => {
51
+ if (!modals.length)
52
+ return;
54
53
  if (modals[0].type === "prompt")
55
54
  promptValue = modals[0].value;
56
55
  buttonTextCancel = modals[0].buttonTextCancel || buttonTextDefaults.buttonTextCancel;
57
56
  buttonTextConfirm = modals[0].buttonTextConfirm || buttonTextDefaults.buttonTextConfirm;
58
57
  buttonTextSubmit = modals[0].buttonTextSubmit || buttonTextDefaults.buttonTextSubmit;
59
58
  currentComponent = typeof modals[0].component === "string" ? components[modals[0].component] : modals[0].component;
60
- }
59
+ });
61
60
  function onModalHeightChange(modal) {
62
61
  let modalHeight = modal?.clientHeight;
63
62
  if (!modalHeight)
@@ -104,12 +103,8 @@ function onConfirm() {
104
103
  }
105
104
  function onPromptSubmit(event) {
106
105
  event.preventDefault();
107
- if ($modalStore[0].response) {
108
- if ($modalStore[0].valueAttr !== void 0 && "type" in $modalStore[0].valueAttr && $modalStore[0].valueAttr.type === "number")
109
- $modalStore[0].response(parseInt(promptValue));
110
- else
111
- $modalStore[0].response(promptValue);
112
- }
106
+ if ($modalStore[0].response)
107
+ $modalStore[0].response(promptValue);
113
108
  modalStore.close();
114
109
  }
115
110
  function onKeyDown(event) {
@@ -6,10 +6,10 @@ import type { ModalComponent } from './types.js';
6
6
  declare class __sveltets_Render<TransitionIn extends Transition = FlyTransition, TransitionOut extends Transition = FlyTransition> {
7
7
  props(): {
8
8
  [x: string]: any;
9
- /** Register a list of reusable component modals.*/
10
- components?: Record<string, ModalComponent> | undefined;
11
9
  /** Set the modal position within the backdrop container*/
12
10
  position?: string | undefined;
11
+ /** Register a list of reusable component modals.*/
12
+ components?: Record<string, ModalComponent> | undefined;
13
13
  /** Provide classes to style the modal background.*/
14
14
  background?: string | undefined;
15
15
  /** Provide classes to style the modal width.*/
@@ -36,7 +36,7 @@ declare class __sveltets_Render<TransitionIn extends Transition = FlyTransition,
36
36
  buttonTextConfirm?: string | undefined;
37
37
  /** Override the text for the Submit button.*/
38
38
  buttonTextSubmit?: string | undefined;
39
- /** Provide arbitrary classes to the backdrop region.*/
39
+ /** Provide classes to style the backdrop.*/
40
40
  regionBackdrop?: string | undefined;
41
41
  /** Provide arbitrary classes to modal header region.*/
42
42
  regionHeader?: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skeletonlabs/skeleton",
3
- "version": "2.6.1-dev.21f83326",
3
+ "version": "2.6.1-dev.a2e14d03",
4
4
  "description": "A SvelteKit component library.",
5
5
  "author": "endigo9740 <chris@skeletonlabs.dev>",
6
6
  "repository": {