@window-splitter/solid 0.8.0

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.
Files changed (48) hide show
  1. package/.storybook/main.ts +24 -0
  2. package/.storybook/preview.ts +14 -0
  3. package/.tshy/build.json +8 -0
  4. package/.tshy/esm.json +18 -0
  5. package/.turbo/turbo-build.log +5 -0
  6. package/.turbo/turbo-lint.log +5 -0
  7. package/CHANGELOG.md +66 -0
  8. package/README.md +54 -0
  9. package/dist/esm/SolidWIndowSplitter.d.ts +19 -0
  10. package/dist/esm/SolidWIndowSplitter.d.ts.map +1 -0
  11. package/dist/esm/SolidWIndowSplitter.jsx +506 -0
  12. package/dist/esm/SolidWIndowSplitter.jsx.map +1 -0
  13. package/dist/esm/SolidWindowSplitter.stories.d.ts +52 -0
  14. package/dist/esm/SolidWindowSplitter.stories.d.ts.map +1 -0
  15. package/dist/esm/SolidWindowSplitter.stories.jsx +470 -0
  16. package/dist/esm/SolidWindowSplitter.stories.jsx.map +1 -0
  17. package/dist/esm/SolidWindowSplitter.test.d.ts +2 -0
  18. package/dist/esm/SolidWindowSplitter.test.d.ts.map +1 -0
  19. package/dist/esm/SolidWindowSplitter.test.jsx +197 -0
  20. package/dist/esm/SolidWindowSplitter.test.jsx.map +1 -0
  21. package/dist/esm/context.d.ts +18 -0
  22. package/dist/esm/context.d.ts.map +1 -0
  23. package/dist/esm/context.jsx +38 -0
  24. package/dist/esm/context.jsx.map +1 -0
  25. package/dist/esm/index.d.ts +2 -0
  26. package/dist/esm/index.d.ts.map +1 -0
  27. package/dist/esm/index.js +2 -0
  28. package/dist/esm/index.js.map +1 -0
  29. package/dist/esm/mergeSolidAttributes.d.ts +6 -0
  30. package/dist/esm/mergeSolidAttributes.d.ts.map +1 -0
  31. package/dist/esm/mergeSolidAttributes.js +45 -0
  32. package/dist/esm/mergeSolidAttributes.js.map +1 -0
  33. package/dist/esm/package.json +3 -0
  34. package/doctor-storybook.log +29 -0
  35. package/eslint.config.js +10 -0
  36. package/index.html +11 -0
  37. package/package.json +104 -0
  38. package/rsbuild.config.js +25 -0
  39. package/src/SolidWIndowSplitter.tsx +683 -0
  40. package/src/SolidWindowSplitter.stories.tsx +689 -0
  41. package/src/SolidWindowSplitter.test.tsx +333 -0
  42. package/src/__snapshots__/SolidWindowSplitter.test.tsx.snap +56 -0
  43. package/src/context.tsx +58 -0
  44. package/src/index.ts +1 -0
  45. package/src/mergeSolidAttributes.ts +61 -0
  46. package/tsconfig.json +8 -0
  47. package/vite.config.js +6 -0
  48. package/vitest.config.ts +22 -0
@@ -0,0 +1,24 @@
1
+ import type { StorybookConfig } from "storybook-solidjs-vite";
2
+
3
+ import { join, dirname } from "path";
4
+
5
+ /**
6
+ * This function is used to resolve the absolute path of a package.
7
+ * It is needed in projects that use Yarn PnP or are set up within a monorepo.
8
+ */
9
+ function getAbsolutePath<T extends string>(value: T): T {
10
+ return dirname(require.resolve(join(value, "package.json"))) as T;
11
+ }
12
+
13
+ const config: StorybookConfig = {
14
+ stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
15
+ addons: [],
16
+ framework: {
17
+ name: getAbsolutePath("storybook-solidjs-vite"),
18
+ options: {},
19
+ },
20
+ core: {
21
+ builder: "@storybook/builder-vite",
22
+ },
23
+ };
24
+ export default config;
@@ -0,0 +1,14 @@
1
+ import type { Preview } from "storybook-solidjs";
2
+
3
+ const preview: Preview = {
4
+ parameters: {
5
+ controls: {
6
+ matchers: {
7
+ color: /(background|color)$/i,
8
+ date: /Date$/i,
9
+ },
10
+ },
11
+ },
12
+ };
13
+
14
+ export default preview;
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "../tsconfig.json",
3
+ "compilerOptions": {
4
+ "rootDir": "../src",
5
+ "module": "nodenext",
6
+ "moduleResolution": "nodenext"
7
+ }
8
+ }
package/.tshy/esm.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "extends": "./build.json",
3
+ "include": [
4
+ "../src/**/*.ts",
5
+ "../src/**/*.mts",
6
+ "../src/**/*.tsx",
7
+ "../src/**/*.json"
8
+ ],
9
+ "exclude": [
10
+ "../node_modules",
11
+ "../src/**/*.test.ts",
12
+ "../**/*stories.*",
13
+ "../src/package.json"
14
+ ],
15
+ "compilerOptions": {
16
+ "outDir": "../.tshy-build/esm"
17
+ }
18
+ }
@@ -0,0 +1,5 @@
1
+
2
+ 
3
+ > @window-splitter/solid@0.6.5 build /Users/andrew/Documents/react-window-splitter/packages/solid
4
+ > tshy
5
+
@@ -0,0 +1,5 @@
1
+
2
+ 
3
+ > @window-splitter/solid@0.6.5 lint /Users/andrew/Documents/react-window-splitter/packages/solid
4
+ > eslint .
5
+
package/CHANGELOG.md ADDED
@@ -0,0 +1,66 @@
1
+ # v0.7.0 (Mon Apr 28 2025)
2
+
3
+ ### Release Notes
4
+
5
+ #### `@window-splitter/solid` ([#54](https://github.com/hipstersmoothie/window-splitter/pull/54))
6
+
7
+ The second framework adapter for `window-splitter` is live!
8
+
9
+ Things of note:
10
+
11
+ - `react-window-splitter` is deprecated in favor of `@window-splitter/react`
12
+ - `@window-splitter/solid` is feature complete and passes the test full test suite
13
+ - `@window-splitter/interface` was created to house the shared component types and some help functions
14
+
15
+ In creating the solid adapter we had to make vanilla JS versions of some functions we previously got from a dependency. This resulted in a 7.4% bundle size reduction for the react package 🎉
16
+
17
+ ### Breaking Change
18
+
19
+ The API for registering panel handles changed a little bit. If you're using the `@window-splitter/state` package directly you will have to update your code (if you exist send me a message!)
20
+
21
+ ---
22
+
23
+ #### 🚀 Enhancement
24
+
25
+ - `@window-splitter/solid` [#54](https://github.com/hipstersmoothie/window-splitter/pull/54) ([@hipstersmoothie](https://github.com/hipstersmoothie))
26
+
27
+ #### 🐛 Bug Fix
28
+
29
+ - fix ci tests ([@hipstersmoothie](https://github.com/hipstersmoothie))
30
+ - dynamic constraints ([@hipstersmoothie](https://github.com/hipstersmoothie))
31
+ - lint ([@hipstersmoothie](https://github.com/hipstersmoothie))
32
+ - first pass ([@hipstersmoothie](https://github.com/hipstersmoothie))
33
+ - fix props spread ([@hipstersmoothie](https://github.com/hipstersmoothie))
34
+ - fix attr merging ([@hipstersmoothie](https://github.com/hipstersmoothie))
35
+ - fix style ([@hipstersmoothie](https://github.com/hipstersmoothie))
36
+ - fix conditional test ([@hipstersmoothie](https://github.com/hipstersmoothie))
37
+ - fixing tests ([@hipstersmoothie](https://github.com/hipstersmoothie))
38
+ - make id automatic by rendering once ([@hipstersmoothie](https://github.com/hipstersmoothie))
39
+ - fix unmount ([@hipstersmoothie](https://github.com/hipstersmoothie))
40
+ - more ([@hipstersmoothie](https://github.com/hipstersmoothie))
41
+ - ugh ([@hipstersmoothie](https://github.com/hipstersmoothie))
42
+ - update names ([@hipstersmoothie](https://github.com/hipstersmoothie))
43
+ - fix double conditional render layout ([@hipstersmoothie](https://github.com/hipstersmoothie))
44
+ - move ([@hipstersmoothie](https://github.com/hipstersmoothie))
45
+ - fix lint ([@hipstersmoothie](https://github.com/hipstersmoothie))
46
+ - fix build ([@hipstersmoothie](https://github.com/hipstersmoothie))
47
+ - FIX BUILD ([@hipstersmoothie](https://github.com/hipstersmoothie))
48
+ - move move ([@hipstersmoothie](https://github.com/hipstersmoothie))
49
+ - move shared stuff ([@hipstersmoothie](https://github.com/hipstersmoothie))
50
+ - move shared types out ([@hipstersmoothie](https://github.com/hipstersmoothie))
51
+ - conditional panels ([@hipstersmoothie](https://github.com/hipstersmoothie))
52
+ - imperative handles ([@hipstersmoothie](https://github.com/hipstersmoothie))
53
+ - controlled collapse ([@hipstersmoothie](https://github.com/hipstersmoothie))
54
+ - more stories ([@hipstersmoothie](https://github.com/hipstersmoothie))
55
+ - fix nested ([@hipstersmoothie](https://github.com/hipstersmoothie))
56
+ - ai ([@hipstersmoothie](https://github.com/hipstersmoothie))
57
+ - cleanup ([@hipstersmoothie](https://github.com/hipstersmoothie))
58
+ - starting to wrk ([@hipstersmoothie](https://github.com/hipstersmoothie))
59
+
60
+ #### ⚠️ Pushed to `main`
61
+
62
+ - add missing publish configs ([@hipstersmoothie](https://github.com/hipstersmoothie))
63
+
64
+ #### Authors: 1
65
+
66
+ - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
package/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # `@window-splitter/solid`
2
+
3
+ A full featured window splitter for SolidJS.
4
+
5
+ - Support for the full [window splitter](https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/) ARIA spec
6
+ - Support for percentage and pixel based constraints
7
+ - Collapsible panels
8
+ - Controlled panels
9
+ - Layout Persistance - LocalStorage and Cookie
10
+
11
+ [Read the full docs](https://react-window-splitter-six.vercel.app)
12
+
13
+ > NOTE: Docs are currently on react but it's the same API. Refer the the stories for usage examples.
14
+
15
+ ## Install
16
+
17
+ ```bash
18
+ npm install @window-splitter/solid
19
+ yarn add @window-splitter/solid
20
+ pnpm add @window-splitter/solid
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ ```tsx
26
+ import { PanelGroup, Panel, PanelResizer } from "@window-splitter/solid";
27
+
28
+ function Example() {
29
+ return (
30
+ <PanelGroup>
31
+ <Panel min="130px" max="400px" />
32
+ <PanelResizer />
33
+ <Panel min="130px" />
34
+ </PanelGroup>
35
+ );
36
+ }
37
+ ```
38
+
39
+ ## Server Side Rendering + Strict Mode
40
+
41
+ While not required for the simple case, for anything more complex you will
42
+ need to add an `id` prop to your panels and handles.
43
+ This is so that the component can tell all of the components apart during layout and rendering.
44
+
45
+ Features that require `id`:
46
+
47
+ - Conditional Panels
48
+ - Server Side Rendering
49
+
50
+ ## Prior Art
51
+
52
+ This library is heavily inspired by the following libraries:
53
+
54
+ - [react-resizable-panels](https://github.com/bvaughn/react-resizable-panels)
@@ -0,0 +1,19 @@
1
+ import { Accessor, JSX, Ref } from "solid-js";
2
+ import { PanelGroupHandle, SharedPanelGroupProps, PanelHandle, SharedPanelProps, SharedPanelResizerProps } from "@window-splitter/interface";
3
+ export interface PanelGroupProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, "style">, SharedPanelGroupProps {
4
+ /** Imperative handle to control the group */
5
+ handle?: Ref<PanelGroupHandle>;
6
+ style?: JSX.CSSProperties;
7
+ }
8
+ export declare function PanelGroup(props: PanelGroupProps): JSX.Element;
9
+ export interface PanelProps extends SharedPanelProps<Accessor<boolean | undefined>>, Omit<JSX.HTMLAttributes<HTMLDivElement>, "onResize" | "style"> {
10
+ /** Imperative handle to control the panel */
11
+ handle?: Ref<PanelHandle>;
12
+ style?: JSX.CSSProperties;
13
+ }
14
+ export declare function Panel(props: PanelProps): JSX.Element;
15
+ export interface PanelResizerProps extends SharedPanelResizerProps, Omit<JSX.HTMLAttributes<HTMLDivElement>, "onDragStart" | "onDrag" | "onDragEnd" | "style"> {
16
+ style?: JSX.CSSProperties;
17
+ }
18
+ export declare function PanelResizer(props: PanelResizerProps): JSX.Element;
19
+ //# sourceMappingURL=SolidWIndowSplitter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SolidWIndowSplitter.d.ts","sourceRoot":"","sources":["../../src/SolidWIndowSplitter.tsx"],"names":[],"mappings":"AAsBA,OAAO,EACL,QAAQ,EAQR,GAAG,EAIH,GAAG,EAEJ,MAAM,UAAU,CAAC;AAQlB,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,EACX,gBAAgB,EAChB,uBAAuB,EAKxB,MAAM,4BAA4B,CAAC;AAGpC,MAAM,WAAW,eACf,SAAQ,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,EACvD,qBAAqB;IACvB,6CAA6C;IAC7C,MAAM,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,GAAG,CAAC,aAAa,CAAC;CAC3B;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eA+KhD;AAgBD,MAAM,WAAW,UACf,SAAQ,gBAAgB,CAAC,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC,EACrD,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IAChE,6CAA6C;IAC7C,MAAM,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;IAC1B,KAAK,CAAC,EAAE,GAAG,CAAC,aAAa,CAAC;CAC3B;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,eA8MtC;AAED,MAAM,WAAW,iBACf,SAAQ,uBAAuB,EAC7B,IAAI,CACF,GAAG,CAAC,cAAc,CAAC,cAAc,CAAC,EAClC,aAAa,GAAG,QAAQ,GAAG,WAAW,GAAG,OAAO,CACjD;IACH,KAAK,CAAC,EAAE,GAAG,CAAC,aAAa,CAAC;CAC3B;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,eAwMpD"}