|
1 |
| -# create-svelte |
| 1 | +# Paneforge |
2 | 2 |
|
3 |
| -Everything you need to build a Svelte library, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte). |
| 3 | +PaneForge provides components that make it easy to create resizable panes in your Svelte apps. It's designed to be simple to use, and to work well with other Svelte components and libraries. This project has taken a lot of inspiration and code from the work done by [Bryan Vaughn](https://github.com/bvaughn) and [react-resizable-panels](https://github.com/bvaughn/react-resizable-panels) and seeks to provide a similar experience for Svelte developers. |
4 | 4 |
|
5 |
| -Read more about creating a library [in the docs](https://kit.svelte.dev/docs/packaging). |
| 5 | +## Features |
6 | 6 |
|
7 |
| -## Creating a project |
| 7 | +- **Simple API**: PaneForge is designed to be easy to use. It provides a small set of components that can be combined to create complex layouts. |
| 8 | +- **Resizable Panes**: Panes can be resized by dragging the resizer between them. |
| 9 | +- **Nested Groups**: Groups of panes can be nested inside other groups to create complex layouts. |
| 10 | +- **Customizable**: The appearance and behavior of the panes can be customized using CSS and Svelte props. |
| 11 | +- **Persistent Layouts**: PaneForge can be used with LocalStorage or cookies to persist the layout of the panes between page loads. |
| 12 | +- **Accessible**: PaneForge is designed to be accessible to all users, including those who use assistive technologies. |
| 13 | +- **Community-driven**: PaneForge is an open-source project that welcomes contributions from the community. If you have an idea for a new feature or an improvement, we'd love to hear from you! |
8 | 14 |
|
9 |
| -If you're seeing this, you've probably already done this step. Congrats! |
| 15 | +## Installation |
10 | 16 |
|
11 | 17 | ```bash
|
12 |
| -# create a new project in the current directory |
13 |
| -npm create svelte@latest |
14 |
| - |
15 |
| -# create a new project in my-app |
16 |
| -npm create svelte@latest my-app |
| 18 | +npm install paneforge |
17 | 19 | ```
|
18 | 20 |
|
19 |
| -## Developing |
| 21 | +## Basic Usage |
20 | 22 |
|
21 |
| -Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: |
| 23 | +Here's a simple example of how to use Paneforge to create a horizontal pane group with two panes: |
22 | 24 |
|
23 |
| -```bash |
24 |
| -npm run dev |
| 25 | +```svelte |
| 26 | +<script lang="ts"> |
| 27 | + import { PaneGroup, Pane, PaneResizer } from "paneforge"; |
| 28 | +</script> |
25 | 29 |
|
26 |
| -# or start the server and open the app in a new browser tab |
27 |
| -npm run dev -- --open |
| 30 | +<PaneGroup direction="horizontal"> |
| 31 | + <Pane defaultSize={50}>Pane 1</Pane> |
| 32 | + <PaneResizer /> |
| 33 | + <Pane defaultSize={50}>Pane 2</Pane> |
| 34 | +</PaneGroup> |
28 | 35 | ```
|
29 | 36 |
|
30 |
| -Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app. |
31 |
| - |
32 |
| -## Building |
| 37 | +The `PaneGroup` component is used to initialize a pane group, and the `Pane` component is used to create a pane. The `PaneResizer` component is used to create a resizer that can be dragged to resize the panes. |
33 | 38 |
|
34 |
| -To build your library: |
| 39 | +The components ship only with the styles necessary to position the panes in the appropriate layout. The rest of the styling is up to you. |
35 | 40 |
|
36 |
| -```bash |
37 |
| -npm run package |
38 |
| -``` |
39 |
| - |
40 |
| -To create a production version of your showcase app: |
41 |
| - |
42 |
| -```bash |
43 |
| -npm run build |
44 |
| -``` |
45 |
| - |
46 |
| -You can preview the production build with `npm run preview`. |
47 |
| - |
48 |
| -> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. |
49 |
| -
|
50 |
| -## Publishing |
51 |
| - |
52 |
| -Go into the `package.json` and give your package the desired name through the `"name"` option. Also consider adding a `"license"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)). |
53 |
| - |
54 |
| -To publish your library to [npm](https://www.npmjs.com): |
55 |
| - |
56 |
| -```bash |
57 |
| -npm publish |
58 |
| -``` |
| 41 | +For more information, see the [Documentation](https://paneforge.com). |
0 commit comments