@streamscloud/kit 0.93.1 → 0.93.3

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.
@@ -35,7 +35,7 @@ const changeItemPosition = (target, positionChange) => {
35
35
  <div class="actions">
36
36
  {#each visibleActions as action (action)}
37
37
  <PopoverItem on={{ click: () => action.action(item) }}>
38
- <IconText icon={action.icon} size="md">
38
+ <IconText icon={action.icon} size="sm">
39
39
  {action.title}
40
40
  </IconText>
41
41
  </PopoverItem>
@@ -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
  };
@@ -308,6 +308,7 @@ const handleActionsClosed = () => {
308
308
  --_tree-node--padding-inline: var(--sc-kit--tree-node--padding-inline, 0.5rem);
309
309
  --_tree-node--padding-block: var(--sc-kit--tree-node--padding-block, 0.375rem);
310
310
  --_tree-node--indent: var(--sc-kit--tree-node--indent, 1rem);
311
+ --_tree-node--trailing-size: 1.5rem;
311
312
  position: relative;
312
313
  width: 100%;
313
314
  color: var(--sc-kit--color--text--primary);
@@ -432,6 +433,8 @@ const handleActionsClosed = () => {
432
433
  }
433
434
  .tree-node__count {
434
435
  flex-shrink: 0;
436
+ padding-inline-end: calc((var(--_tree-node--trailing-size) - 1ch) / 2);
437
+ font-variant-numeric: tabular-nums;
435
438
  font-size: var(--sc-kit--font-size--xs);
436
439
  color: var(--sc-kit--color--accent);
437
440
  }
@@ -447,8 +450,8 @@ const handleActionsClosed = () => {
447
450
  display: inline-flex;
448
451
  align-items: center;
449
452
  justify-content: center;
450
- width: 1.5rem;
451
- height: 1.5rem;
453
+ width: var(--_tree-node--trailing-size);
454
+ height: var(--_tree-node--trailing-size);
452
455
  border-radius: var(--sc-kit--radius--sm);
453
456
  color: var(--sc-kit--color--text--secondary);
454
457
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/kit",
3
- "version": "0.93.1",
3
+ "version": "0.93.3",
4
4
  "author": "StreamsCloud",
5
5
  "repository": {
6
6
  "type": "git",