@streamscloud/kit 0.95.3 → 0.96.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.
@@ -6,9 +6,9 @@ export declare class HtmlHelper {
6
6
  */
7
7
  static escapeSpecialChars(s: string): string;
8
8
  /**
9
- * Strips leading / trailing whitespace from a field's current value in place, returning whether it
10
- * changed. Dispatches nothing — the caller emits. Call at commit points only: on `input` it would
11
- * swallow the space in "hello world" as it is typed.
9
+ * Strips leading / trailing whitespace from a field's current value in place, keeping the selection on
10
+ * the same characters, and returns whether it changed. Dispatches nothing — the caller emits. Call at
11
+ * commit points only: on `input` it would swallow the space in "hello world" as it is typed.
12
12
  */
13
13
  static trimElementValue(element: HTMLInputElement | HTMLTextAreaElement): boolean;
14
14
  /**
@@ -81,16 +81,24 @@ export class HtmlHelper {
81
81
  return s.replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;').replaceAll('"', '&quot;').replaceAll("'", '&#039;');
82
82
  }
83
83
  /**
84
- * Strips leading / trailing whitespace from a field's current value in place, returning whether it
85
- * changed. Dispatches nothing — the caller emits. Call at commit points only: on `input` it would
86
- * swallow the space in "hello world" as it is typed.
84
+ * Strips leading / trailing whitespace from a field's current value in place, keeping the selection on
85
+ * the same characters, and returns whether it changed. Dispatches nothing — the caller emits. Call at
86
+ * commit points only: on `input` it would swallow the space in "hello world" as it is typed.
87
87
  */
88
88
  static trimElementValue(element) {
89
- const trimmed = element.value.trim();
90
- if (trimmed === element.value) {
89
+ const value = element.value;
90
+ const trimmed = value.trim();
91
+ if (trimmed === value) {
91
92
  return false;
92
93
  }
94
+ const { selectionStart, selectionEnd, selectionDirection } = element;
93
95
  element.value = trimmed;
96
+ if (selectionStart !== null && selectionEnd !== null) {
97
+ const removedFromStart = value.length - value.trimStart().length;
98
+ const toTrimmedPosition = (position) => Math.min(Math.max(position - removedFromStart, 0), trimmed.length);
99
+ // Not limited to the focused field: trimming runs on blur, and a caller inserting at the caret afterwards reads this selection.
100
+ element.setSelectionRange(toTrimmedPosition(selectionStart), toTrimmedPosition(selectionEnd), selectionDirection ?? undefined);
101
+ }
94
102
  return true;
95
103
  }
96
104
  /**
package/dist/fonts.d.ts CHANGED
@@ -1,11 +1,5 @@
1
- import '@fontsource/inter/400.css';
2
- import '@fontsource/inter/500.css';
3
- import '@fontsource/inter/600.css';
4
- import '@fontsource/inter/700.css';
5
- import '@fontsource/inter/900.css';
6
- import '@fontsource/jetbrains-mono/400.css';
7
- import '@fontsource/jetbrains-mono/500.css';
8
- import '@fontsource/source-sans-pro/900.css';
1
+ import '@fontsource-variable/geist/wght.css';
2
+ import '@fontsource-variable/geist-mono/wght.css';
9
3
  export type KitFontFamily = 'sans' | 'mono' | 'display';
10
4
  /** Maps a `KitFontFamily` value to its kit CSS-var reference. */
11
5
  export declare const KIT_FONT_VARS: Record<KitFontFamily, string>;
package/dist/fonts.js CHANGED
@@ -3,14 +3,8 @@
3
3
  // the .css side-effect imports during dev and bundle.
4
4
  //
5
5
  // Consumers: `import '@streamscloud/kit/fonts';` at app entry. Once.
6
- import '@fontsource/inter/400.css';
7
- import '@fontsource/inter/500.css';
8
- import '@fontsource/inter/600.css';
9
- import '@fontsource/inter/700.css';
10
- import '@fontsource/inter/900.css';
11
- import '@fontsource/jetbrains-mono/400.css';
12
- import '@fontsource/jetbrains-mono/500.css';
13
- import '@fontsource/source-sans-pro/900.css';
6
+ import '@fontsource-variable/geist/wght.css';
7
+ import '@fontsource-variable/geist-mono/wght.css';
14
8
  /** Maps a `KitFontFamily` value to its kit CSS-var reference. */
15
9
  export const KIT_FONT_VARS = {
16
10
  sans: 'var(--sc-kit--font--sans)',
@@ -36,6 +36,7 @@ html {
36
36
  body {
37
37
  line-height: 1.5;
38
38
  -webkit-font-smoothing: antialiased;
39
+ font-variant-numeric: tabular-nums;
39
40
  }
40
41
 
41
42
  /* 5. Improve media defaults */
@@ -31,7 +31,7 @@
31
31
  // ============================================================
32
32
  // COLOR — BORDERS
33
33
  // ============================================================
34
- --sc-kit--color--border: light-dark(#{$color-neutral-200}, #{$color-dark-600});
34
+ --sc-kit--color--border: light-dark(#{$color-neutral-100}, #{$color-dark-600});
35
35
  --sc-kit--color--border--strong: light-dark(#{$color-neutral-400}, #{$color-neutral-600});
36
36
  --sc-kit--color--border--field: light-dark(#{$color-neutral-200}, #{$color-dark-600});
37
37
  --sc-kit--color--border--focus: light-dark(#{$color-blue-500}, #{$color-blue-400});
@@ -62,6 +62,8 @@
62
62
  --sc-kit--color--info--hover: light-dark(#{$color-blue-700}, #{$color-blue-300});
63
63
  --sc-kit--color--info--soft: light-dark(#{$color-blue-50}, #{$color-blue-900});
64
64
 
65
+ --sc-kit--color--intelligence: light-dark(#4ca53f, #a6ef9b);
66
+
65
67
  // ============================================================
66
68
  // COLOR — TONES (categorical palette; fg + soft bg, component-neutral)
67
69
  // ============================================================
@@ -149,12 +151,12 @@
149
151
  // ============================================================
150
152
  // TYPOGRAPHY
151
153
  // ============================================================
152
- --sc-kit--font-size--xs: 11px;
153
- --sc-kit--font-size--sm: 12px;
154
+ --sc-kit--font-size--xs: 12px;
155
+ --sc-kit--font-size--sm: 13px;
154
156
  --sc-kit--font-size--md: 14px;
155
157
  --sc-kit--font-size--lg: 16px;
156
158
  --sc-kit--font-size--xl: 20px;
157
- --sc-kit--font-size--2xl: 26px;
159
+ --sc-kit--font-size--2xl: 24px;
158
160
  --sc-kit--font-size--3xl: 32px;
159
161
  --sc-kit--font-size--4xl: 40px;
160
162
 
@@ -187,9 +189,9 @@
187
189
  --sc-kit--leading--normal: 1.5;
188
190
  --sc-kit--leading--relaxed: 1.65;
189
191
 
190
- --sc-kit--font--sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
191
- --sc-kit--font--display: 'Source Sans Pro', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
192
- --sc-kit--font--mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
192
+ --sc-kit--font--sans: 'Geist Variable', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
193
+ --sc-kit--font--display: var(--sc-kit--font--sans);
194
+ --sc-kit--font--mono: 'Geist Mono Variable', ui-monospace, 'SF Mono', Menlo, monospace;
193
195
 
194
196
  // ============================================================
195
197
  // SHADOWS
@@ -30,6 +30,7 @@ html {
30
30
  body {
31
31
  line-height: 1.5;
32
32
  -webkit-font-smoothing: antialiased;
33
+ font-variant-numeric: tabular-nums;
33
34
  }
34
35
 
35
36
  /* 5. Improve media defaults */
@@ -139,6 +139,9 @@ Purely presentational: the consumer owns active state, routing and feature gatin
139
139
  | `--sc-kit--nav-rail--item-gap` | Vertical gap between tiles | `26px`; `--sc-kit--space--4` with `showLabels={false}` |
140
140
  | `--sc-kit--nav-rail--background` | Rail background | `--sc-kit--color--bg--panel` |
141
141
  | `--sc-kit--nav-rail--divider-color` | Divider before `trailingItems` | `--sc-kit--color--border` |
142
+ | `--sc-kit--nav-rail--brand--padding-block-start` | Space above the `brand` block | `24px` |
143
+ | `--sc-kit--nav-rail--brand--padding-block-end` | Space below the `brand` block | `24px` |
144
+ | `--sc-kit--nav-rail--scroll-area--padding-block-start` | Space above the first tile | `8px` |
142
145
  | `--sc-kit--nav-rail--item-width` | Tile width | `58px` |
143
146
  | `--sc-kit--nav-rail--item-icon-size` | Tile icon size (box + glyph) | `24px` |
144
147
  | `--sc-kit--nav-rail--item-label-size` | Tile label font size | `10px` |
@@ -158,6 +161,9 @@ Purely presentational: the consumer owns active state, routing and feature gatin
158
161
  --_nav-rail--item-gap: var(--sc-kit--nav-rail--item-gap, var(--_nav-rail--item-gap-default));
159
162
  --_nav-rail--background: var(--sc-kit--nav-rail--background, var(--sc-kit--color--bg--panel));
160
163
  --_nav-rail--divider-color: var(--sc-kit--nav-rail--divider-color, var(--sc-kit--color--border));
164
+ --_nav-rail--brand-padding-block-start: var(--sc-kit--nav-rail--brand--padding-block-start, 1.5rem);
165
+ --_nav-rail--brand-padding-block-end: var(--sc-kit--nav-rail--brand--padding-block-end, 1.5rem);
166
+ --_nav-rail--scroll-area-padding-block-start: var(--sc-kit--nav-rail--scroll-area--padding-block-start, 0.5rem);
161
167
  display: flex;
162
168
  flex-direction: column;
163
169
  align-items: stretch;
@@ -176,14 +182,14 @@ Purely presentational: the consumer owns active state, routing and feature gatin
176
182
  align-items: center;
177
183
  justify-content: center;
178
184
  flex-shrink: 0;
179
- padding: 1.5rem 0;
185
+ padding-block: var(--_nav-rail--brand-padding-block-start) var(--_nav-rail--brand-padding-block-end);
180
186
  }
181
187
 
182
188
  .nav-rail__scroll-area {
183
189
  position: relative;
184
190
  flex: 1;
185
191
  min-height: 0;
186
- padding-top: 0.5rem;
192
+ padding-block-start: var(--_nav-rail--scroll-area-padding-block-start);
187
193
  }
188
194
  .nav-rail__scroll-area:hover {
189
195
  --_scroll-btn-opacity: 1;
@@ -27,6 +27,9 @@ type Props = {
27
27
  * | `--sc-kit--nav-rail--item-gap` | Vertical gap between tiles | `26px`; `--sc-kit--space--4` with `showLabels={false}` |
28
28
  * | `--sc-kit--nav-rail--background` | Rail background | `--sc-kit--color--bg--panel` |
29
29
  * | `--sc-kit--nav-rail--divider-color` | Divider before `trailingItems` | `--sc-kit--color--border` |
30
+ * | `--sc-kit--nav-rail--brand--padding-block-start` | Space above the `brand` block | `24px` |
31
+ * | `--sc-kit--nav-rail--brand--padding-block-end` | Space below the `brand` block | `24px` |
32
+ * | `--sc-kit--nav-rail--scroll-area--padding-block-start` | Space above the first tile | `8px` |
30
33
  * | `--sc-kit--nav-rail--item-width` | Tile width | `58px` |
31
34
  * | `--sc-kit--nav-rail--item-icon-size` | Tile icon size (box + glyph) | `24px` |
32
35
  * | `--sc-kit--nav-rail--item-label-size` | Tile label font size | `10px` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/kit",
3
- "version": "0.95.3",
3
+ "version": "0.96.0",
4
4
  "author": "StreamsCloud",
5
5
  "repository": {
6
6
  "type": "git",
@@ -485,9 +485,8 @@
485
485
  "peerDependencies": {
486
486
  "@floating-ui/dom": "^1.7.6",
487
487
  "@fluentui/svg-icons": "^1.1.341",
488
- "@fontsource/inter": "^5.2.8",
489
- "@fontsource/jetbrains-mono": "^5.2.8",
490
- "@fontsource/source-sans-pro": "^5.2.5",
488
+ "@fontsource-variable/geist": "^5.3.0",
489
+ "@fontsource-variable/geist-mono": "^5.3.0",
491
490
  "@urql/core": "^6.0.1",
492
491
  "any-ascii": "^0.3.3",
493
492
  "cleave-zen": "^0.0.17",
@@ -512,9 +511,8 @@
512
511
  "@eslint/js": "^10.0.1",
513
512
  "@floating-ui/dom": "^1.7.6",
514
513
  "@fluentui/svg-icons": "^1.1.341",
515
- "@fontsource/inter": "^5.2.8",
516
- "@fontsource/jetbrains-mono": "^5.2.8",
517
- "@fontsource/source-sans-pro": "^5.2.5",
514
+ "@fontsource-variable/geist": "^5.3.0",
515
+ "@fontsource-variable/geist-mono": "^5.3.0",
518
516
  "@sveltejs/package": "^2.5.8",
519
517
  "@sveltejs/vite-plugin-svelte": "^7.3.0",
520
518
  "@tsconfig/svelte": "^5.0.8",