@streamscloud/kit 0.93.2 → 0.93.4

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,7 +1,7 @@
1
1
  <script lang="ts">import { slideHorizontally, transitionDuration } from '../../core/transitions';
2
2
  import PagePanel from './cmp.page-panel.svelte';
3
3
  import { untrack } from 'svelte';
4
- const { panelState, children, sidebarLeft, sidebarRight, sidebarLeftIsValid = true, sidebarRightIsValid = true, title, actionsLeft, actionsCenter, actionsRight, balanceHeaderCenter = false, alignActionsLeftToContent = false, toggle } = $props();
4
+ const { panelState, children, sidebarLeft, sidebarRight, sidebarLeftFooter, sidebarRightFooter, sidebarLeftIsValid = true, sidebarRightIsValid = true, title, actionsLeft, actionsCenter, actionsRight, balanceHeaderCenter = false, alignActionsLeftToContent = false, toggle } = $props();
5
5
  let leftPanel = $state(null);
6
6
  let rightPanel = $state(null);
7
7
  let sidebarLeftWidth = $state(0);
@@ -93,7 +93,14 @@ $effect(() => {
93
93
  class="page-panel-sidebars__sidebar page-panel-sidebars__sidebar--left"
94
94
  use:sidebarLeftMounted
95
95
  transition:slideHorizontally|local={{ duration: transitionDuration.slow }}>
96
- {@render sidebarLeft()}
96
+ <div class="page-panel-sidebars__sidebar-body">
97
+ {@render sidebarLeft()}
98
+ </div>
99
+ {#if sidebarLeftFooter}
100
+ <div class="page-panel-sidebars__sidebar-footer">
101
+ {@render sidebarLeftFooter()}
102
+ </div>
103
+ {/if}
97
104
  </div>
98
105
  {/if}
99
106
  <div class="page-panel-sidebars__main">
@@ -101,7 +108,14 @@ $effect(() => {
101
108
  </div>
102
109
  {#if sidebarRight && !rightCollapsed}
103
110
  <div class="page-panel-sidebars__sidebar page-panel-sidebars__sidebar--right" transition:slideHorizontally|local={{ duration: transitionDuration.slow }}>
104
- {@render sidebarRight()}
111
+ <div class="page-panel-sidebars__sidebar-body">
112
+ {@render sidebarRight()}
113
+ </div>
114
+ {#if sidebarRightFooter}
115
+ <div class="page-panel-sidebars__sidebar-footer">
116
+ {@render sidebarRightFooter()}
117
+ </div>
118
+ {/if}
105
119
  </div>
106
120
  {/if}
107
121
  </div>
@@ -123,6 +137,10 @@ content pane begins, and follows that edge as the sidebar resizes, collapses, or
123
137
  The track starts on the sidebar's divider rather than after it, so a bordered child lands on that
124
138
  line instead of doubling it. The collapse button stays put outside that track.
125
139
 
140
+ `sidebarLeftFooter` / `sidebarRightFooter` stay pinned at the bottom of their sidebar while its body
141
+ scrolls. A footer never widens the sidebar: the width still comes from the sidebar body. The
142
+ footer is bare — padding, dividers and alignment belong to the snippet.
143
+
126
144
  ### CSS Custom Properties
127
145
  | Property | Description | Default |
128
146
  |---|---|---|
@@ -135,48 +153,59 @@ line instead of doubling it. The collapse button stays put outside that track.
135
153
  overflow: hidden;
136
154
  }
137
155
  .page-panel-sidebars__sidebar {
156
+ display: flex;
157
+ flex-direction: column;
158
+ flex-shrink: 0;
159
+ overflow: hidden;
160
+ }
161
+ .page-panel-sidebars__sidebar--left {
162
+ border-right: 1px solid var(--_page-panel-sidebars--border-color);
163
+ }
164
+ .page-panel-sidebars__sidebar--right {
165
+ border-left: 1px solid var(--_page-panel-sidebars--border-color);
166
+ }
167
+ .page-panel-sidebars__sidebar-body {
168
+ flex: 1;
169
+ min-height: 0;
138
170
  overflow-y: auto;
139
171
  overflow-x: clip;
140
- flex-shrink: 0;
141
172
  --_cross-browser-scrollbar--thumb-color: transparent;
142
173
  --_cross-browser-scrollbar--track-color: transparent;
143
174
  }
144
- .page-panel-sidebars__sidebar:hover {
175
+ .page-panel-sidebars__sidebar-body:hover {
145
176
  --_cross-browser-scrollbar--thumb-color: var(--sc-kit--color--border--strong);
146
177
  --_cross-browser-scrollbar--track-color: var(--scrollbar--track-color, transparent);
147
178
  }
148
- .page-panel-sidebars__sidebar {
179
+ .page-panel-sidebars__sidebar-body {
149
180
  --_cross-browser-scrollbar--gutter: 0px;
150
181
  }
151
182
  @supports selector(::-webkit-scrollbar) {
152
- .page-panel-sidebars__sidebar {
183
+ .page-panel-sidebars__sidebar-body {
153
184
  scrollbar-color: auto;
154
185
  scrollbar-width: auto;
155
186
  }
156
- .page-panel-sidebars__sidebar::-webkit-scrollbar {
187
+ .page-panel-sidebars__sidebar-body::-webkit-scrollbar {
157
188
  width: 6px;
158
189
  height: 6px;
159
190
  }
160
- .page-panel-sidebars__sidebar::-webkit-scrollbar-track {
191
+ .page-panel-sidebars__sidebar-body::-webkit-scrollbar-track {
161
192
  background: var(--_cross-browser-scrollbar--track-color);
162
193
  border-radius: 100vw;
163
194
  }
164
- .page-panel-sidebars__sidebar::-webkit-scrollbar-thumb {
195
+ .page-panel-sidebars__sidebar-body::-webkit-scrollbar-thumb {
165
196
  background: var(--_cross-browser-scrollbar--thumb-color);
166
197
  border-radius: 100vw;
167
198
  }
168
199
  }
169
200
  @supports not selector(::-webkit-scrollbar) {
170
- .page-panel-sidebars__sidebar {
201
+ .page-panel-sidebars__sidebar-body {
171
202
  scrollbar-color: var(--_cross-browser-scrollbar--thumb-color) var(--_cross-browser-scrollbar--track-color);
172
203
  scrollbar-width: thin;
173
204
  }
174
205
  }
175
- .page-panel-sidebars__sidebar--left {
176
- border-right: 1px solid var(--_page-panel-sidebars--border-color);
177
- }
178
- .page-panel-sidebars__sidebar--right {
179
- border-left: 1px solid var(--_page-panel-sidebars--border-color);
206
+ .page-panel-sidebars__sidebar-footer {
207
+ flex-shrink: 0;
208
+ contain: inline-size;
180
209
  }
181
210
  .page-panel-sidebars__main {
182
211
  flex: 1;
@@ -7,6 +7,10 @@ type Props = {
7
7
  title?: string | Snippet;
8
8
  sidebarLeft?: Snippet;
9
9
  sidebarRight?: Snippet;
10
+ /** Pinned under the left sidebar's scrolling body; slides and collapses with the sidebar. */
11
+ sidebarLeftFooter?: Snippet;
12
+ /** Pinned under the right sidebar's scrolling body; slides and collapses with the sidebar. */
13
+ sidebarRightFooter?: Snippet;
10
14
  sidebarLeftIsValid?: boolean;
11
15
  sidebarRightIsValid?: boolean;
12
16
  actionsLeft?: Snippet;
@@ -34,6 +38,10 @@ type Props = {
34
38
  * The track starts on the sidebar's divider rather than after it, so a bordered child lands on that
35
39
  * line instead of doubling it. The collapse button stays put outside that track.
36
40
  *
41
+ * `sidebarLeftFooter` / `sidebarRightFooter` stay pinned at the bottom of their sidebar while its body
42
+ * scrolls. A footer never widens the sidebar: the width still comes from the sidebar body. The
43
+ * footer is bare — padding, dividers and alignment belong to the snippet.
44
+ *
37
45
  * ### CSS Custom Properties
38
46
  * | Property | Description | Default |
39
47
  * |---|---|---|
@@ -13,8 +13,15 @@ const trimOnCommit = $derived(trim && !disabled && !readonly && !inert);
13
13
  /** Imperative API exposed via `bind:this` on `<Textarea>`. */
14
14
  export const focus = () => textareaEl?.focus();
15
15
  export const select = () => textareaEl?.select();
16
+ let measuredValue = null;
17
+ let heightCapped = false;
16
18
  const resize = () => {
17
- if (!textareaEl || !autoresize) {
19
+ if (!textareaEl || !autoresize || textareaEl.value === measuredValue) {
20
+ return;
21
+ }
22
+ measuredValue = textareaEl.value;
23
+ // Without this skip, every keystroke in a 100k-character note re-lays out the whole text through `height: auto` (~20 ms).
24
+ if (heightCapped && textareaEl.scrollHeight > textareaEl.clientHeight) {
18
25
  return;
19
26
  }
20
27
  textareaEl.style.overflowY = 'hidden';
@@ -23,6 +30,7 @@ const resize = () => {
23
30
  const lineHeight = parseFloat(styles.lineHeight) || parseFloat(styles.fontSize) * 1.4;
24
31
  const paddingY = parseFloat(styles.paddingTop) + parseFloat(styles.paddingBottom);
25
32
  const max = lineHeight * maxRows + paddingY;
33
+ heightCapped = textareaEl.scrollHeight > max;
26
34
  textareaEl.style.height = Math.min(textareaEl.scrollHeight, max) + 'px';
27
35
  textareaEl.style.overflowY = '';
28
36
  };
@@ -34,6 +42,12 @@ const initTextarea = (node) => {
34
42
  on?.mounted?.({ textarea: node });
35
43
  resize();
36
44
  };
45
+ $effect(() => {
46
+ void [size, effectiveRows, maxRows, autoresize];
47
+ measuredValue = null;
48
+ heightCapped = false;
49
+ resize();
50
+ });
37
51
  $effect(() => {
38
52
  void valueParsed;
39
53
  resize();
@@ -83,8 +97,9 @@ const handleKeydown = (e) => {
83
97
  const handleBlur = () => {
84
98
  // Before the re-sync: trimming after it re-emits a lagging prop as fresh input, losing the last edit.
85
99
  commitTrim();
86
- if (textareaEl) {
100
+ if (textareaEl && textareaEl.value !== valueParsed) {
87
101
  textareaEl.value = valueParsed;
102
+ resize();
88
103
  }
89
104
  on?.blur?.();
90
105
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/kit",
3
- "version": "0.93.2",
3
+ "version": "0.93.4",
4
4
  "author": "StreamsCloud",
5
5
  "repository": {
6
6
  "type": "git",