Skip to content

Commit df681b8

Browse files
Merge pull request #59 from hipstersmoothie/wc
Web Component
2 parents dcc32f4 + b5abcec commit df681b8

File tree

21 files changed

+10601
-14831
lines changed

21 files changed

+10601
-14831
lines changed

packages/interface/src/interface.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,18 @@ export function getPanelDomAttributes({
103103
collapsible: boolean | undefined;
104104
collapsed: boolean | undefined;
105105
}) {
106-
return {
106+
const attrs: Record<string, string | boolean | undefined> = {
107107
id: id,
108108
"data-splitter-group-id": groupId,
109109
"data-splitter-type": "panel",
110110
"data-splitter-id": id,
111-
"data-collapsed": collapsible ? collapsed : undefined,
112111
};
112+
113+
if (collapsible) {
114+
attrs["data-collapsed"] = collapsed;
115+
}
116+
117+
return attrs;
113118
}
114119

115120
export interface SharedPanelResizerProps

packages/interface/src/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ async function expectTemplate(
117117
}
118118
},
119119
{
120-
timeout: 2_000,
120+
timeout: 4_000,
121121
}
122122
);
123123

packages/solid/README.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,6 @@ function Example() {
3636
}
3737
```
3838

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-
5039
## Prior Art
5140

5241
This library is heavily inspired by the following libraries:

packages/state/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const COLLAPSE_THRESHOLD = 50;
1313
export type PixelUnit = `${number}px`;
1414
export type PercentUnit = `${number}%`;
1515
export type Unit = PixelUnit | PercentUnit;
16-
type Orientation = "horizontal" | "vertical";
16+
export type Orientation = "horizontal" | "vertical";
1717

1818
export interface ParsedPercentUnit {
1919
type: "percent";

packages/svelte/README.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,6 @@ npm install @window-splitter/svelte
4040
- Customizable
4141
- TypeScript support
4242

43-
## Server Side Rendering + Strict Mode
44-
45-
While not required for the simple case, for anything more complex you will
46-
need to add an `id` prop to your panels and handles.
47-
This is so that the component can tell all of the components apart during layout and rendering.
48-
49-
Features that require `id`:
50-
51-
- Conditional Panels
52-
- Server Side Rendering
53-
5443
## Prior Art
5544

5645
This library is heavily inspired by the following libraries:

packages/vue/README.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,6 @@ import { PanelGroup } from "@window-splitter/vue";
4242
- Customizable
4343
- TypeScript support
4444

45-
## Server Side Rendering + Strict Mode
46-
47-
While not required for the simple case, for anything more complex you will
48-
need to add an `id` prop to your panels and handles.
49-
This is so that the component can tell all of the components apart during layout and rendering.
50-
51-
Features that require `id`:
52-
53-
- Conditional Panels
54-
- Server Side Rendering
55-
5645
## Prior Art
5746

5847
This library is heavily inspired by the following libraries:

packages/vue/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"typescript-eslint": "^8.1.0",
5757
"vite": "^6.3.3",
5858
"vite-plugin-dts": "^4.5.3",
59-
"vitest": "^3.1.2",
59+
"vitest": "catalog:",
6060
"vue": "^3.5.13"
6161
},
6262
"dependencies": {

packages/vue/src/PanelResizer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ const combinedProps = computed(() => {
182182
</script>
183183

184184
<template>
185-
<div v-bind="combinedProps" data-panel-resizer :tabindex="disabled ? -1 : 0">
185+
<div v-bind="combinedProps" :tabindex="disabled ? -1 : 0">
186186
<slot />
187187
</div>
188188
</template>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { join, dirname } from "path";
2+
3+
/**
4+
* This function is used to resolve the absolute path of a package.
5+
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
6+
*/
7+
function getAbsolutePath(value) {
8+
return dirname(require.resolve(join(value, "package.json")));
9+
}
10+
11+
/** @type { import('@storybook/web-components-vite').StorybookConfig } */
12+
const config = {
13+
stories: ["../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
14+
addons: [
15+
{
16+
name: getAbsolutePath("@storybook/addon-essentials"),
17+
options: {
18+
docs: false,
19+
},
20+
},
21+
],
22+
framework: {
23+
name: getAbsolutePath("@storybook/web-components-vite"),
24+
options: {},
25+
},
26+
};
27+
export default config;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.panel-group {
2+
border: 1px solid rgba(0, 0, 0, 0.3);
3+
background: rgba(0, 0, 0, 0.1);
4+
border-radius: 12px;
5+
box-sizing: border-box;
6+
min-width: 500px;
7+
display: block;
8+
}
9+
10+
.panel {
11+
height: 100%;
12+
width: 100%;
13+
padding: 20px;
14+
display: flex;
15+
align-items: center;
16+
justify-content: center;
17+
overflow: hidden;
18+
box-sizing: border-box;
19+
}
20+
21+
.panel-resizer {
22+
background: red;
23+
}

0 commit comments

Comments
 (0)