Skip to content

Commit 90aaa02

Browse files
authored
fix: props not being passed to Bits Dialog (#42)
1 parent 591e9fe commit 90aaa02

30 files changed

+108
-102
lines changed

.changeset/mean-cherries-dance.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"vaul-svelte": patch
3+
---
4+
5+
fix: forward `$$restProps` to Bits UI dialog

.eslintrc.cjs

+18-18
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ module.exports = {
55
"eslint:recommended",
66
"plugin:@typescript-eslint/recommended",
77
"plugin:svelte/recommended",
8-
"prettier"
8+
"prettier",
99
],
1010
parser: "@typescript-eslint/parser",
1111
plugins: ["@typescript-eslint"],
1212
parserOptions: {
1313
sourceType: "module",
1414
ecmaVersion: "latest",
15-
extraFileExtensions: [".svelte"]
15+
extraFileExtensions: [".svelte"],
1616
},
1717
env: {
1818
browser: true,
1919
es2024: true,
20-
node: true
20+
node: true,
2121
},
2222
globals: { $$Generic: "readable", NodeJS: true },
2323
rules: {
@@ -26,8 +26,8 @@ module.exports = {
2626
"warn",
2727
{
2828
argsIgnorePattern: "^_",
29-
varsIgnorePattern: "^_"
30-
}
29+
varsIgnorePattern: "^_",
30+
},
3131
],
3232
"svelte/no-target-blank": "off",
3333
"svelte/no-immutable-reactive-statements": "error",
@@ -39,24 +39,24 @@ module.exports = {
3939
"svelte/no-at-html-tags": "off",
4040
"svelte/no-unused-svelte-ignore": "off",
4141
"svelte/require-stores-init": "off",
42-
"svelte/css-unused-selector": "off"
42+
"svelte/css-unused-selector": "off",
4343
},
4444
overrides: [
4545
{
4646
files: ["*.svelte"],
4747
parser: "svelte-eslint-parser",
4848
parserOptions: {
49-
parser: "@typescript-eslint/parser"
49+
parser: "@typescript-eslint/parser",
5050
},
5151
rules: {
5252
"@typescript-eslint/no-unused-vars": [
5353
"warn",
5454
{
5555
argsIgnorePattern: "^_",
56-
varsIgnorePattern: "^(\\$\\$(Props|Events|Slots|Generic)|_*)$"
57-
}
58-
]
59-
}
56+
varsIgnorePattern: "^(\\$\\$(Props|Events|Slots|Generic)|_*)$",
57+
},
58+
],
59+
},
6060
},
6161
{
6262
files: ["*.ts"],
@@ -67,11 +67,11 @@ module.exports = {
6767
{
6868
extendDefaults: true,
6969
types: {
70-
"{}": false
71-
}
72-
}
73-
]
74-
}
75-
}
76-
]
70+
"{}": false,
71+
},
72+
},
73+
],
74+
},
75+
},
76+
],
7777
};

.prettierrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"useTabs": true,
33
"singleQuote": false,
4-
"trailingComma": "none",
4+
"trailingComma": "es5",
55
"printWidth": 100,
66
"plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
77
"overrides": [

playwright.config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import type { PlaywrightTestConfig } from "@playwright/test";
33
const config: PlaywrightTestConfig = {
44
webServer: {
55
command: "npm run build && npm run preview",
6-
port: 4173
6+
port: 4173,
77
},
88
testDir: "tests",
9-
testMatch: /(.+\.)?(test|spec)\.[jt]s/
9+
testMatch: /(.+\.)?(test|spec)\.[jt]s/,
1010
};
1111

1212
export default config;

postcss.config.cjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const config = {
66
//Some plugins, like tailwindcss/nesting, need to run before Tailwind,
77
tailwindcss(),
88
//But others, like autoprefixer, need to run after,
9-
autoprefixer
10-
]
9+
autoprefixer,
10+
],
1111
};
1212

1313
module.exports = config;

src/config/site.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ export const siteConfig = {
55
ogImage: "https://www.vaul-svelte.com/og.jpg",
66
links: {
77
twitter: "https://twitter.com/huntabyte",
8-
github: "https://github.com/huntabyte/vaul-svelte"
8+
github: "https://github.com/huntabyte/vaul-svelte",
99
},
10-
keywords: `Svelte,SvelteKit,Svelte Components,Headless Svelte Components,Headless UI Svelte,Drawer for Svelte,SvelteKit Drawer,Svelte Drawer,Vaul Svelte`
10+
keywords: `Svelte,SvelteKit,Svelte Components,Headless Svelte Components,Headless UI Svelte,Drawer for Svelte,SvelteKit Drawer,Svelte Drawer,Vaul Svelte`,
1111
};
1212

1313
export type SiteConfig = typeof siteConfig;

src/lib/internal/constants.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export const TRANSITIONS = {
22
DURATION: 0.5,
3-
EASE: [0.32, 0.72, 0, 1]
3+
EASE: [0.32, 0.72, 0, 1],
44
};
55

66
export const VELOCITY_THRESHOLD = 0.4;

src/lib/internal/escape-keydown.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const documentEscapeKeyStore = readable<KeyboardEvent | undefined>(
2626

2727
// Adds a keydown event listener to the document, calling the keydown function when triggered.
2828
const unsubscribe = addEventListener(document, "keydown", keydown, {
29-
passive: false
29+
passive: false,
3030
});
3131

3232
// Returns a function to unsubscribe from the event listener and stop tracking keydown events.

src/lib/internal/helpers/is.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const nonTextInputTypes = new Set([
1010
"image",
1111
"button",
1212
"submit",
13-
"reset"
13+
"reset",
1414
]);
1515

1616
export const isBrowser = typeof document !== "undefined";

src/lib/internal/helpers/options.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ type Options = Record<string, Writable<unknown>>;
55
export function getOptionUpdater(options: Options) {
66
return function <
77
K extends keyof typeof options,
8-
V extends StoresValues<(typeof options)[keyof typeof options]>
8+
V extends StoresValues<(typeof options)[keyof typeof options]>,
99
>(key: K, value: V | undefined) {
1010
if (value === undefined) return;
1111
const store = options[key];

src/lib/internal/helpers/store.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export function effect<S extends Stores>(
2222
const unsub = derivedWithUnsubscribe(stores, (stores, onUnsubscribe) => {
2323
return {
2424
stores,
25-
onUnsubscribe
25+
onUnsubscribe,
2626
};
2727
}).subscribe(({ stores, onUnsubscribe }) => {
2828
const returned = fn(stores);
@@ -80,7 +80,7 @@ export function derivedWithUnsubscribe<S extends Stores, T>(
8080

8181
return {
8282
...derivedStore,
83-
subscribe
83+
subscribe,
8484
};
8585
}
8686

@@ -123,7 +123,7 @@ export const overridable = <T>(store: Writable<T>, onChange?: ChangeFn<T>) => {
123123
return {
124124
...store,
125125
update,
126-
set
126+
set,
127127
};
128128
};
129129

src/lib/internal/position-fixed.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export function handlePositionFixed({
88
isOpen,
99
modal,
1010
nested,
11-
hasBeenOpened
11+
hasBeenOpened,
1212
}: {
1313
isOpen: Writable<boolean>;
1414
modal: Writable<boolean>;
@@ -26,7 +26,7 @@ export function handlePositionFixed({
2626
position: document.body.style.position,
2727
top: document.body.style.top,
2828
left: document.body.style.left,
29-
height: document.body.style.height
29+
height: document.body.style.height,
3030
};
3131

3232
// Update the dom inside an animation frame

src/lib/internal/snap-points.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function handleSnapPoints({
1111
overlayRef,
1212
fadeFromIndex,
1313
openTime,
14-
direction
14+
direction,
1515
}: {
1616
activeSnapPoint: Writable<number | string | null>;
1717
snapPoints: Writable<(number | string)[] | undefined>;
@@ -118,7 +118,7 @@ export function handleSnapPoints({
118118
)})`,
119119
transform: isVertical($direction)
120120
? `translate3d(0, ${dimension}px, 0)`
121-
: `translate3d(${dimension}px, 0, 0)`
121+
: `translate3d(${dimension}px, 0, 0)`,
122122
});
123123

124124
const $fadeFromIndex = get(fadeFromIndex);
@@ -133,14 +133,14 @@ export function handleSnapPoints({
133133
transition: `opacity ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(
134134
","
135135
)})`,
136-
opacity: "0"
136+
opacity: "0",
137137
});
138138
} else {
139139
set($overlayRef, {
140140
transition: `opacity ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(
141141
","
142142
)})`,
143-
opacity: "1"
143+
opacity: "1",
144144
});
145145
}
146146
activeSnapPoint.update(() => {
@@ -155,7 +155,7 @@ export function handleSnapPoints({
155155
draggedDistance,
156156
closeDrawer,
157157
velocity,
158-
dismissible
158+
dismissible,
159159
}: {
160160
draggedDistance: number;
161161
closeDrawer: () => void;
@@ -182,7 +182,7 @@ export function handleSnapPoints({
182182

183183
if (isOverlaySnapPoint) {
184184
set($overlayRef, {
185-
transition: `opacity ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(",")})`
185+
transition: `opacity ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(",")})`,
186186
});
187187
}
188188

@@ -254,7 +254,7 @@ export function handleSnapPoints({
254254
set($drawerRef, {
255255
transform: isVertical($direction)
256256
? `translate3d(0, ${newValue}px, 0)`
257-
: `translate3d(${newValue}px, 0, 0)`
257+
: `translate3d(${newValue}px, 0, 0)`,
258258
});
259259
}
260260

@@ -318,6 +318,6 @@ export function handleSnapPoints({
318318
activeSnapPointIndex,
319319
onRelease,
320320
onDrag,
321-
snapPointsOffset
321+
snapPointsOffset,
322322
};
323323
}

src/lib/internal/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export type Builder<
2020
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2121
Param = any,
2222
// eslint-disable-next-line @typescript-eslint/no-explicit-any
23-
Attributes extends Record<string, any> = Record<string, any>
23+
Attributes extends Record<string, any> = Record<string, any>,
2424
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2525
> = Record<string, any> & {
2626
action: Action<Element, Param, Attributes>;

0 commit comments

Comments
 (0)