@rcarls/rc-splitter 0.0.0-next-20260921045401

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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,105 @@
1
+ # @rcarls/rc-splitter
2
+
3
+ ## 0.0.0-next-20260921045401
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [50d5610]
8
+ - Updated dependencies [4341311]
9
+ - @rcarls/rc-common@0.0.0-next-20260921045401
10
+
11
+ ## 0.6.0
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [6683eb9]
16
+ - Updated dependencies [ee7ba6c]
17
+ - Updated dependencies [30eb232]
18
+ - @rcarls/rc-common@0.6.0
19
+
20
+ ## 0.5.0
21
+
22
+ ### Patch Changes
23
+
24
+ - Updated dependencies [4ae2ef0]
25
+ - Updated dependencies [689340c]
26
+ - @rcarls/rc-common@0.5.0
27
+
28
+ ## 0.4.2
29
+
30
+ ### Patch Changes
31
+
32
+ - @rcarls/rc-common@0.4.2
33
+
34
+ ## 0.4.1
35
+
36
+ ### Patch Changes
37
+
38
+ - @rcarls/rc-common@0.4.1
39
+
40
+ ## 0.4.0
41
+
42
+ ### Minor Changes
43
+
44
+ - e57277f: Add Material 3 search-view, fixed-pane splitter, dialog scrim, and resize enhancements.
45
+
46
+ `rc-search-bar` now supports `variant="view"`, controlled/default open state, search-view methods, a rich `suggestions` slot, and datalist-derived text suggestions. `rc-splitter` adds `mode="fixed"` for clampable pixel primary panes. `rc-common` now honors CSS max-size constraints during resize gestures, and `rc-dialog` exposes a scrim token plus resize handle/origin hooks used by themed surfaces.
47
+
48
+ - 037b1b3: Add shared drag gesture measurement and numeric snap helpers, migrate bottom
49
+ sheet settling to the shared velocity lifecycle, and add anchored settling and
50
+ swipe-to-collapse behavior to splitters.
51
+
52
+ ### Patch Changes
53
+
54
+ - 94c7807: Document the `label`, `orientation`, `mode`, `step`, `min`, `max`, `value`,
55
+ `default-value`, `fixed`, `collapsible`, `snap-points`, and `swipe-velocity`
56
+ attributes and the `rc-splitter-change` fired event in the generated API
57
+ reference.
58
+ - be4dc7e: Bind pointer drag gestures to the rendered separator handle instead of caching
59
+ the pre-render query result.
60
+ - Updated dependencies [e57277f]
61
+ - Updated dependencies [ccca8e2]
62
+ - Updated dependencies [037b1b3]
63
+ - @rcarls/rc-common@0.4.0
64
+
65
+ ## 0.3.2
66
+
67
+ ### Patch Changes
68
+
69
+ - Updated dependencies [88b4086]
70
+ - @rcarls/rc-common@0.3.2
71
+
72
+ ## 0.3.1
73
+
74
+ ### Patch Changes
75
+
76
+ - @rcarls/rc-common@0.3.1
77
+
78
+ ## 0.3.0
79
+
80
+ ### Added
81
+
82
+ - Add collapsible separator controls.
83
+ - Add `min` and `max` pane size clamps.
84
+ - Add Ctrl+Arrow and Shift+Arrow keyboard resizing shortcuts.
85
+ - Add splitter handle and collapse-button styling surfaces.
86
+
87
+ ### Changed
88
+
89
+ - Correct `aria-orientation` to describe the separator bar.
90
+ - Increase pointer target affordance for the drag handle.
91
+ - Update package metadata, README intro, and docs links.
92
+
93
+ ### Fixed
94
+
95
+ - Prevent a spurious change event on first interaction.
96
+
97
+ ### Dependencies
98
+
99
+ - Sync internal dependencies to 0.3.0.
100
+
101
+ ## 0.2.0
102
+
103
+ ### Patch Changes
104
+
105
+ - @rcarls/rc-common@0.2.0
package/README.md ADDED
@@ -0,0 +1,203 @@
1
+ # `@rcarls/rc-splitter`
2
+
3
+ Resizable pane splitter with pointer, keyboard, and collapse/restore controls that follows the
4
+ [WAI-ARIA Window Splitter pattern](https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/).
5
+
6
+ Docs: [https://richardcarls.github.io/rc-webcomponents/components/rc-splitter](https://richardcarls.github.io/rc-webcomponents/components/rc-splitter).
7
+
8
+ ---
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ npm install @rcarls/rc-splitter
14
+ ```
15
+
16
+ ## Import
17
+
18
+ ```js
19
+ import '@rcarls/rc-splitter'; // side-effect: registers <rc-splitter>
20
+ import { RCSplitter } from '@rcarls/rc-splitter'; // named class export
21
+ ```
22
+
23
+ ---
24
+
25
+ ## Basic usage
26
+
27
+ Place the primary pane in the default slot and the secondary pane in the `secondary` slot. The
28
+ splitter takes up all available space in its container.
29
+
30
+ ```html
31
+ <rc-splitter style="width: 100%; height: 400px;">
32
+ <div>Primary pane; resizes when you drag the separator</div>
33
+ <div slot="secondary">Secondary pane; fills remaining space</div>
34
+ </rc-splitter>
35
+ ```
36
+
37
+ Vertical orientation:
38
+
39
+ ```html
40
+ <rc-splitter orientation="vertical" style="width: 100%; height: 600px;">
41
+ <div>Top pane</div>
42
+ <div slot="secondary">Bottom pane</div>
43
+ </rc-splitter>
44
+ ```
45
+
46
+ ---
47
+
48
+ ## API
49
+
50
+ ### Properties / attributes
51
+
52
+ | Property | Attribute | Type | Default | Description |
53
+ | --------------- | ---------------- | ---------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
54
+ | `label` | `label` | `string` | `'Splitter'` | Accessible label applied to the primary pane and used by the separator handle via `aria-labelledby`. |
55
+ | `orientation` | `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` | Layout direction. `horizontal` = left/right panes; `vertical` = top/bottom panes. Reflects to attribute. |
56
+ | `mode` | `mode` | `'length' \| 'percent' \| 'fixed'` | `'length'` | Unit and sizing behavior for `value`. `length` = pixels of the primary pane; `percent` = percentage of total container size; `fixed` = clampable px primary pane while the secondary pane flexes. |
57
+ | `step` | `step` | `number` | `1` | Keyboard step size in the current unit (px or %). Shift multiplies by 10×. |
58
+ | `min` | `min` | `number` | `0` | Minimum primary pane size in the current mode's units. |
59
+ | `max` | `max` | `number \| undefined` | `undefined` | Maximum primary pane size in the current mode's units. Defaults to the full container size. |
60
+ | `value` | `value` | `number` | `0` | Current primary pane size. Host writes update the separator position silently (no `rc-splitter-change`). |
61
+ | `defaultValue` | `default-value` | `number \| undefined` | `undefined` | Initial uncontrolled primary pane size, applied once the splitter has measured its container. |
62
+ | `fixed` | `fixed` | `boolean` | `false` | Disable resizing. This legacy boolean locks interaction and is distinct from `mode="fixed"`. |
63
+ | `collapsible` | `collapsible` | `boolean` | `false` | Render the separator's collapse/restore button and enable swipe collapse/restore. |
64
+ | `snapPoints` | `snap-points` | `string` | `''` | Ascending whitespace-separated anchors in the current mode's units. |
65
+ | `swipeVelocity` | `swipe-velocity` | `number` | `500` | Release velocity in px/s that selects the next anchor or collapse action. |
66
+
67
+ ### Anchored settling
68
+
69
+ With `snap-points`, a slow release settles to the nearest anchor and a qualified
70
+ swipe settles to the next anchor in its direction. Without snap points, pointer
71
+ resizing remains continuous. A collapsible splitter can still swipe toward the
72
+ primary minimum to collapse and swipe back to restore its pre-collapse value.
73
+
74
+ ```html
75
+ <rc-splitter mode="percent" snap-points="25 50 75" value="50">
76
+ <section>Primary</section>
77
+ <section slot="secondary">Secondary</section>
78
+ </rc-splitter>
79
+ ```
80
+
81
+ Call `snapTo(index, behavior?)` to select an anchor programmatically. `behavior`
82
+ is `'animated'` by default and also accepts `'instant'`.
83
+
84
+ ### CSS custom properties
85
+
86
+ | Property | Default | Description |
87
+ | --------------------------------------------- | -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
88
+ | `--rc-splitter-separator-size` | `6px` | Thickness of the separator bar |
89
+ | `--rc-splitter-separator-handle-size` | `100%` | Length of the drag handle within the separator (set to a smaller value to create a centered grab handle) |
90
+ | `--rc-splitter-separator-color` | `color-mix(in srgb, ButtonBorder 35%, Canvas 65%)` | Background color of the separator bar |
91
+ | `--rc-splitter-keyline` | `1px solid ButtonBorder` | Shared fallback for the four separator border custom properties below |
92
+ | `--rc-splitter-handle-color` | `ButtonBorder` | Color of the dot grip indicators (default visual) |
93
+ | `--rc-splitter-handle-thickness` | `4px` | Cross-axis size of the visual indicator (dot column width or pill/line thickness) |
94
+ | `--rc-splitter-handle-border-radius` | `0` | Border-radius of the visual indicator; set to a large value (999px, for example) for a pill shape |
95
+ | `--rc-splitter-handle-pattern` | 3-dot radial-gradient | `background-image` for the visual indicator; set to `none` to use a solid fill via `--rc-splitter-handle-fill` instead |
96
+ | `--rc-splitter-handle-fill` | `transparent` | `background-color` of the visual indicator; effective when `--rc-splitter-handle-pattern` is `none` |
97
+ | `--rc-splitter-handle-hover-fill` | `transparent` | `background-color` of the visual indicator on hover; scoped to the indicator only, not the full strip |
98
+ | `--rc-splitter-handle-transition` | `0ms` | CSS transition duration/easing for the visual indicator's background-color changes |
99
+ | `--rc-splitter-snap-duration` | `200ms` | Duration of anchored settling; reduced motion makes it immediate |
100
+ | `--rc-splitter-collapse-button-size` | `20px` | Diameter of the collapse/expand toggle button |
101
+ | `--rc-splitter-collapse-button-offset` | `8px` | Distance from the start edge of the separator to the collapse button center |
102
+ | `--rc-splitter-collapse-button-bg` | `Canvas` | Collapse button background color |
103
+ | `--rc-splitter-collapse-button-hover-bg` | `ButtonFace` | Collapse button background color on hover |
104
+ | `--rc-splitter-collapse-button-border` | `ButtonBorder` | Collapse button border color |
105
+ | `--rc-splitter-collapse-button-color` | `ButtonText` | Collapse button icon color |
106
+ | `--rc-splitter-separator-border-inline-start` | `var(--rc-splitter-keyline)` | Inline-start (left in LTR) border of the separator |
107
+ | `--rc-splitter-separator-border-inline-end` | `var(--rc-splitter-keyline)` | Inline-end (right in LTR) border of the separator |
108
+ | `--rc-splitter-separator-border-block-start` | `var(--rc-splitter-keyline)` | Block-start (top) border when `orientation="vertical"` |
109
+ | `--rc-splitter-separator-border-block-end` | `var(--rc-splitter-keyline)` | Block-end (bottom) border when `orientation="vertical"` |
110
+
111
+ All color defaults use CSS system color keywords, adapting automatically to the user's color
112
+ scheme and forced-color modes.
113
+
114
+ ### CSS parts
115
+
116
+ | Part | Element | Description |
117
+ | ------------------ | ---------------------------------------- | ------------------------------------------------------------------------------------------------- |
118
+ | `primary` | `div#primary` | Primary pane container |
119
+ | `secondary` | `aside#secondary` | Secondary pane container |
120
+ | `separator` | `div#separator` | The separator bar |
121
+ | `separator-handle` | `div[role="separator"]` inside separator | The focusable drag handle (narrower than the bar if `--rc-splitter-separator-handle-size` is set) |
122
+ | `collapse-button` | `button` | The collapse/expand toggle button (only rendered when `collapsible` is set) |
123
+
124
+ ### Slots
125
+
126
+ | Slot | Description |
127
+ | ----------- | ----------------------------------------------------------------------------------- |
128
+ | _(default)_ | Primary pane. Its inline-size (or block-size when vertical) is set by the splitter. |
129
+ | `secondary` | Secondary pane. Fills remaining space via `flex: 1`. |
130
+
131
+ ### Events
132
+
133
+ | Event | Bubbles | Cancelable | Detail | When |
134
+ | -------------------- | -------------- | ---------- | -------------------------------------- | --------------------------------------------------------------- |
135
+ | `rc-splitter-change` | Yes (composed) | No | `{ value: number, valueText: string }` | Separator position changes (on every pointer move or key press) |
136
+
137
+ ### Read-only getters
138
+
139
+ ```ts
140
+ valueText: string; // Human-readable value string, for example "240px" or "40%"
141
+ ```
142
+
143
+ ---
144
+
145
+ ## Keyboard behavior
146
+
147
+ Focus the separator handle (click or Tab), then:
148
+
149
+ | Key | Action |
150
+ | -------------------------- | ---------------------------------------------------------------------- |
151
+ | `ArrowRight` / `ArrowDown` | Increase primary pane by `step` (horizontal: right; vertical: down) |
152
+ | `ArrowLeft` / `ArrowUp` | Decrease primary pane by `step` |
153
+ | `Shift` + Arrow | Multiply step by 10× |
154
+ | `Home` | Jump to the effective minimum (`min`, default `0`) |
155
+ | `End` | Jump to the effective maximum (`max`, default the full container size) |
156
+ | `Enter` | Toggle between the effective minimum and the last non-collapsed size |
157
+
158
+ ---
159
+
160
+ ## ARIA
161
+
162
+ The separator handle implements the WAI-ARIA slider role pattern:
163
+
164
+ | Attribute | Where | Value |
165
+ | ------------------ | ---------------------- | ---------------------------------------------------- |
166
+ | `role="separator"` | Separator handle `div` | None |
167
+ | `aria-label` | Primary pane | Value of `label` property |
168
+ | `aria-orientation` | Separator handle | `"horizontal"` or `"vertical"` |
169
+ | `aria-valuenow` | Separator handle | Current numeric value |
170
+ | `aria-valuemin` | Separator handle | `0` |
171
+ | `aria-valuemax` | Separator handle | Container width or height in current mode units |
172
+ | `aria-valuetext` | Separator handle | Human-readable string, for example `"240px"` |
173
+ | `aria-controls` | Separator handle | `"primary"`, the ID of the primary pane |
174
+ | `aria-labelledby` | Separator handle | `"primary"`, using the primary pane as label context |
175
+ | `tabindex="0"` | Separator handle | Always focusable |
176
+
177
+ ---
178
+
179
+ ## Example: percentage mode with a styled separator
180
+
181
+ ```html
182
+ <rc-splitter
183
+ mode="percent"
184
+ style="
185
+ width: 100%;
186
+ height: 500px;
187
+ --rc-splitter-separator-size: 4px;
188
+ --rc-splitter-separator-color: ButtonFace;
189
+ --rc-splitter-separator-border-inline-start: none;
190
+ --rc-splitter-separator-border-inline-end: none;
191
+ "
192
+ >
193
+ <nav>Sidebar</nav>
194
+ <div slot="secondary">Main content</div>
195
+ </rc-splitter>
196
+ ```
197
+
198
+ ---
199
+
200
+ ## Browser support
201
+
202
+ All modern browsers. It requires Web Components support (Chrome 67+, Firefox 63+, Safari 12.1+)
203
+ and `ResizeObserver` (Chrome 64+, Firefox 69+, Safari 13.1+).