Skip to content

Commit ffa5da6

Browse files
authored
chore: replace useId with $props.id() (#80)
1 parent ca3e86e commit ffa5da6

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

.changeset/unlucky-horses-wait.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"paneforge": patch
3+
---
4+
5+
replace `useId` with `$props.id()`

packages/paneforge/src/lib/components/pane-group.svelte

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
import { box, mergeProps } from "svelte-toolbelt";
33
import type { PaneGroupProps } from "./types.js";
44
import { noop } from "$lib/internal/helpers.js";
5-
import { useId } from "$lib/internal/utils/useId.js";
65
import { defaultStorage, PaneGroupState } from "$lib/paneforge.svelte.js";
76
7+
const uid = $props.id();
8+
89
let {
910
autoSaveId = null,
1011
direction,
11-
id = useId(),
12+
id = uid,
1213
keyboardResizeBy = null,
1314
onLayoutChange = noop,
1415
storage = defaultStorage,
@@ -19,7 +20,7 @@
1920
}: PaneGroupProps = $props();
2021
2122
const paneGroupState = PaneGroupState.create({
22-
id: box.with(() => id ?? useId()),
23+
id: box.with(() => id ?? uid),
2324
ref: box.with(
2425
() => ref,
2526
(v) => (ref = v)

packages/paneforge/src/lib/components/pane-resizer.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
import { box, mergeProps } from "svelte-toolbelt";
33
import type { PaneResizerProps } from "./types.js";
44
import { noop } from "$lib/internal/helpers.js";
5-
import { useId } from "$lib/internal/utils/useId.js";
65
import { PaneResizerState } from "$lib/paneforge.svelte.js";
76
7+
const uid = $props.id();
8+
89
let {
9-
id = useId(),
10+
id = uid,
1011
ref = $bindable(null),
1112
disabled = false,
1213
onDraggingChange = noop,

packages/paneforge/src/lib/components/pane.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
import { box, mergeProps } from "svelte-toolbelt";
33
import type { PaneProps } from "./types.js";
44
import { noop } from "$lib/internal/helpers.js";
5-
import { useId } from "$lib/internal/utils/useId.js";
65
import { PaneState } from "$lib/paneforge.svelte.js";
76
7+
const uid = $props.id();
8+
89
let {
9-
id = useId(),
10+
id = uid,
1011
ref = $bindable(null),
1112
collapsedSize,
1213
collapsible,

packages/paneforge/src/lib/internal/utils/useId.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)