Skip to content

Commit ec73e7a

Browse files
committed
Made it possible to add classes to the window section element and hoping that i fixed a mobile jitter error when window is being dragged
1 parent 78661b4 commit ec73e7a

4 files changed

Lines changed: 13 additions & 5 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "svelte-windows",
3-
"version": "0.1.4",
3+
"version": "0.1.5",
44
"description": "A draggable and resizable window manager that works seamlessly in you projects. Works in scroll areas, overflow situations. Includes window stacking based on how recently it was active.",
55
"license": "MIT",
66
"author": {

src/lib/Window.svelte

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
children,
2424
context,
2525
style,
26+
className,
2627
id
2728
}: ActualWindowProps = $props();
2829
@@ -58,7 +59,7 @@
5859
</script>
5960

6061
<section
61-
class="{active?"active":"inactive"}"
62+
class="{active?"active":"inactive"} {className}"
6263
style="--stackOrder:{stackOrder};width:max({width},min({Math.max(FORCEMINWIDTH, minWidth)}px, 100%));height:max({height},min({Math.max(FORCEMINHEIGHT, minHeight)}px, 100%));top:{top};left:{left};{style}"
6364
{id}
6465
bind:this={window}
@@ -129,8 +130,6 @@
129130

130131
<style>
131132
section {
132-
border-radius: var(--borderRadius, 0);
133-
box-shadow: var(--boxShadow);
134133
z-index: var(--stackOrder);
135134
position: absolute;
136135
isolation: isolate;

src/lib/homepage/Demo.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@
3535
left="{window.x}px"
3636
minHeight={200}
3737
minWidth={200}
38+
className="shadow-2xl transition-shadow duration-250 hover:shadow-accent/20"
3839
>
3940
<div
40-
class="absolute flex flex-col rounded-lg border border-border bg-card shadow-2xl transition-shadow"
41+
class="absolute flex flex-col rounded-lg border border-border bg-card shadow-2xl transition-shadow overflow-hidden"
4142
style="width:100%;height:100%;"
4243
>
4344
<!-- Window header -->

src/lib/utils.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export class MouseContext {
6363
const x = touch.clientX;
6464
const y = touch.clientY;
6565
if (this.#activeMouseTarget && this.#activeMouseTarget.length > 0) {
66+
event.preventDefault();
6667
document.documentElement.style.overflow = 'hidden'; // firefox, chrome
6768
//@ts-ignore
6869
document.body.scroll = "no"; // ie only
@@ -335,4 +336,11 @@ export type ActualWindowProps = {
335336
* ```
336337
*/
337338
style?: string
339+
/**
340+
* Any basic classes you want to add to the window box. Perfect for tailwind classes.
341+
* ```ts
342+
* className = "bg-primary hover:shadow-2xl"
343+
* ```
344+
*/
345+
className?: string
338346
}

0 commit comments

Comments
 (0)