@rcarls/rc-splitter 0.6.0 → 0.7.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.
@@ -1,5 +1,5 @@
1
1
  import { LitElement } from 'lit';
2
- import { DragGestureController, DragGestureDetail, KeyboardNavigationAction } from '@rcarls/rc-common';
2
+ import { DragGestureController, FlowController, DragGestureDetail, KeyboardNavigationAction, LogicalAxis } from '@rcarls/rc-common';
3
3
  type SplitterOrientation = 'horizontal' | 'vertical';
4
4
  type SplitterMode = 'length' | 'percent' | 'fixed';
5
5
  declare global {
@@ -7,12 +7,29 @@ declare global {
7
7
  'rc-splitter': RCSplitter;
8
8
  }
9
9
  }
10
+ /** Built-in text of `rc-splitter`. */
11
+ export interface RCSplitterMessages {
12
+ /** Default name of the primary pane, when `label` is unset. */
13
+ label: string;
14
+ expand: (label: string) => string;
15
+ collapse: (label: string) => string;
16
+ }
17
+ export declare const DEFAULT_SPLITTER_MESSAGES: Readonly<RCSplitterMessages>;
18
+ declare module '@rcarls/rc-common' {
19
+ interface RcMessageCatalog {
20
+ 'rc-splitter': RCSplitterMessages;
21
+ }
22
+ }
10
23
  /**
11
24
  * Resizable pane splitter with pointer, keyboard, anchored settling, and
12
25
  * collapse/restore controls, following the WAI-ARIA Window Splitter pattern.
13
26
  *
14
27
  * Set `orientation="vertical"` for a vertical splitter
15
28
  *
29
+ * Built-in text (the collapse button name and default pane name; the separator value text is formatted for the same locale) follows the element's own `lang`, else
30
+ * `<html lang>`: per element through `messages`, or for every instance
31
+ * through `registerMessages()` from `@rcarls/rc-common` under `rc-splitter`.
32
+ *
16
33
  * @see {@link https://richardcarls.github.io/rc-webcomponents/components/rc-splitter rc-splitter docs}
17
34
  * @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/ WAI-ARIA Window Splitter pattern}
18
35
  *
@@ -22,8 +39,11 @@ declare global {
22
39
  * @fires rc-splitter-change - Fired when the separator position changes; `detail: { value, valueText }`
23
40
  *
24
41
  * @attr label - Accessible label applied to the primary pane and referenced by the separator
25
- * handle's `aria-labelledby`.
26
- * @attr orientation - Layout direction: `horizontal` (left/right panes) or `vertical` (top/bottom panes).
42
+ * handle's `aria-labelledby`. Defaults to the `label` message.
43
+ * @attr orientation - Layout: `horizontal` places the panes side by side along the inline axis
44
+ * (left/right in LTR, right/left in RTL), `vertical` stacks them along the block axis. Both turn
45
+ * over in vertical writing modes; the separator's `aria-orientation`, arrow keys, and dragging
46
+ * follow the layout actually rendered.
27
47
  * @attr mode - Value units and pane sizing behavior: `length`, `percent`, or `fixed`.
28
48
  * @attr step - Keyboard resize step size, in the current mode's units.
29
49
  * @attr min - Minimum primary pane size, in the current mode's units.
@@ -66,8 +86,11 @@ declare global {
66
86
  */
67
87
  export declare class RCSplitter extends LitElement {
68
88
  static styles: import('lit').CSSResult[];
69
- /** Accessible label for this splitter. Default label is 'Splitter'. */
70
- label: string;
89
+ /** Built-in text overrides; unset keys fall back to registered text, then English. */
90
+ messages: Partial<RCSplitterMessages> | undefined;
91
+ private readonly _messages;
92
+ /** Accessible label for this splitter. Defaults to the `label` message. */
93
+ label: string | undefined;
71
94
  /** Splitter orientation, for keyboard navigation and initial sizing. */
72
95
  orientation: SplitterOrientation;
73
96
  /**
@@ -102,7 +125,7 @@ export declare class RCSplitter extends LitElement {
102
125
  protected _toggleCollapse(): void;
103
126
  protected _onCollapseButtonClick(): void;
104
127
  protected _onCollapseKeydown(e: KeyboardEvent): void;
105
- protected get _collapseButtonIcon(): import('lit').TemplateResult<1>;
128
+ protected get _collapseButtonIcon(): import('lit-html').TemplateResult<1>;
106
129
  protected _setValue(val: number, dispatch: boolean): void;
107
130
  protected _setUserValue(val: number): void;
108
131
  private _value;
@@ -117,8 +140,10 @@ export declare class RCSplitter extends LitElement {
117
140
  snapPoints: string;
118
141
  /** Minimum release velocity, in px/s, that qualifies as a swipe. */
119
142
  swipeVelocity: number;
120
- /** A human-readable string representation of the value. */
143
+ /** The value as a CSS length, such as `40%` or `240px`. */
121
144
  get valueText(): string;
145
+ /** The value for `aria-valuetext`, with digits in the splitter's locale. */
146
+ protected get _accessibleValueText(): string;
122
147
  protected _minValue: number;
123
148
  protected _maxValue: number;
124
149
  /** Last valid value, for collapse functionality. */
@@ -134,6 +159,13 @@ export declare class RCSplitter extends LitElement {
134
159
  protected readonly _reducedMotion: MediaQueryList | null;
135
160
  protected readonly _gesture: DragGestureController;
136
161
  protected _resizeObserver: ResizeObserver;
162
+ /** Keeps the separator's aria-orientation and drag axis on the rendered layout. */
163
+ protected readonly _flow: FlowController;
164
+ /**
165
+ * The logical axis the panes sit along: `horizontal` places them side by
166
+ * side along the inline axis, `vertical` stacks them along the block axis.
167
+ */
168
+ protected get _paneAxis(): LogicalAxis;
137
169
  protected _onKeyboardResize(action: KeyboardNavigationAction): void;
138
170
  protected _onPointerResize(e: Pick<PointerEvent, 'clientX' | 'clientY'>): void;
139
171
  /**
@@ -155,12 +187,17 @@ export declare class RCSplitter extends LitElement {
155
187
  protected _snapDuration(): number;
156
188
  protected _onPrimaryChange(_e: Event): void;
157
189
  protected _onSecondaryChange(_e: Event): void;
190
+ /**
191
+ * The extent of `rect` along a logical axis. The pane axis is vertical on
192
+ * screen in vertical text, so a physical width would measure the wrong one.
193
+ */
194
+ protected _sizeAlong(rect: DOMRect, axis: LogicalAxis): number;
158
195
  protected _measureHostSize(axis: 'inline' | 'block'): number;
159
196
  protected _onResize(): void;
160
197
  connectedCallback(): void;
161
198
  disconnectedCallback(): void;
162
199
  firstUpdated(): void;
163
200
  protected updated(): void;
164
- render(): import('lit').TemplateResult<1>;
201
+ render(): import('lit-html').TemplateResult<1>;
165
202
  }
166
203
  export default RCSplitter;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.6.0",
6
+ "version": "0.7.0",
7
7
  "description": "Resizable pane splitter with pointer, keyboard, and collapse/restore controls.",
8
8
  "repository": {
9
9
  "type": "git",
@@ -45,7 +45,7 @@
45
45
  "test:browser:firefox": "vitest --run --project=firefox"
46
46
  },
47
47
  "dependencies": {
48
- "@rcarls/rc-common": "0.6.0"
48
+ "@rcarls/rc-common": "0.7.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@custom-elements-manifest/analyzer": "0.11.0",