@streamscloud/kit 0.9.12 → 0.9.13

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.
@@ -0,0 +1,49 @@
1
+ <script lang="ts">const { seconds, variant = 'raw', showZero = false } = $props();
2
+ const format = (secs) => {
3
+ const total = Math.max(0, Math.round(secs));
4
+ const hours = Math.floor(total / 3600);
5
+ const minutes = Math.floor((total % 3600) / 60);
6
+ const ss = (total % 60).toString().padStart(2, '0');
7
+ return hours > 0 ? `${hours}:${minutes.toString().padStart(2, '0')}:${ss}` : `${minutes}:${ss}`;
8
+ };
9
+ const value = $derived(seconds !== null && seconds > 0 ? format(seconds) : showZero ? format(0) : null);
10
+ </script>
11
+
12
+ {#if value !== null}
13
+ <span class="duration" class:duration--badge={variant === 'badge'}>{value}</span>
14
+ {/if}
15
+
16
+ <!--
17
+ @component
18
+ Renders a media/time duration given in seconds as a human-readable clock string — `m:ss` under an
19
+ hour, `h:mm:ss` at or above (seconds are rounded, so a 60-second carry rolls up). `null` or ≤ 0
20
+ renders nothing; pass `showZero` to force `0:00`. `variant='raw'` (default) is bare text that
21
+ inherits the parent's typography; `variant='badge'` is a dark overlay pill for the bottom corner of
22
+ a video thumbnail. Placement (e.g. absolute over media) is the consumer's job via the cascade.
23
+
24
+ ### CSS Custom Properties
25
+ | Property | Description | Default |
26
+ |---|---|---|
27
+ | `--sc-kit--duration--badge--background` | Badge background (badge variant) | `rgb(0 0 0 / 55%)` (dark translucent) |
28
+ | `--sc-kit--duration--badge--color` | Badge text color (badge variant) | `var(--sc-kit--color--text--on-accent)` |
29
+ | `--sc-kit--duration--badge--padding` | Badge padding (badge variant) | `var(--sc-kit--space--1) var(--sc-kit--space--2)` |
30
+ | `--sc-kit--duration--badge--border-radius` | Badge corner radius (badge variant) | `var(--sc-kit--radius--sm)` |
31
+ | `--sc-kit--duration--badge--font-size` | Badge font size (badge variant) | `var(--sc-kit--font-size--xs)` |
32
+ -->
33
+ <style>.duration {
34
+ font-variant-numeric: tabular-nums;
35
+ }
36
+ .duration--badge {
37
+ --_duration--badge-background: var(--sc-kit--duration--badge--background, rgb(0 0 0 / 55%));
38
+ --_duration--badge-color: var(--sc-kit--duration--badge--color, var(--sc-kit--color--text--on-accent));
39
+ --_duration--badge-padding: var(--sc-kit--duration--badge--padding, var(--sc-kit--space--1) var(--sc-kit--space--2));
40
+ --_duration--badge-border-radius: var(--sc-kit--duration--badge--border-radius, var(--sc-kit--radius--sm));
41
+ --_duration--badge-font-size: var(--sc-kit--duration--badge--font-size, var(--sc-kit--font-size--xs));
42
+ display: inline-block;
43
+ padding: var(--_duration--badge-padding);
44
+ background: var(--_duration--badge-background);
45
+ border-radius: var(--_duration--badge-border-radius);
46
+ color: var(--_duration--badge-color);
47
+ font-size: var(--_duration--badge-font-size);
48
+ line-height: var(--sc-kit--leading--normal);
49
+ }</style>
@@ -0,0 +1,27 @@
1
+ type Props = {
2
+ /** Duration in seconds. Zero, negative, or `null` renders nothing unless `showZero`. */
3
+ seconds: number | null;
4
+ /** Visual style — `raw` is bare text; `badge` is a dark overlay pill for media thumbnails. @default 'raw' */
5
+ variant?: 'raw' | 'badge';
6
+ /** Render `0:00` for a null / zero / negative duration instead of nothing. @default false */
7
+ showZero?: boolean;
8
+ };
9
+ /**
10
+ * Renders a media/time duration given in seconds as a human-readable clock string — `m:ss` under an
11
+ * hour, `h:mm:ss` at or above (seconds are rounded, so a 60-second carry rolls up). `null` or ≤ 0
12
+ * renders nothing; pass `showZero` to force `0:00`. `variant='raw'` (default) is bare text that
13
+ * inherits the parent's typography; `variant='badge'` is a dark overlay pill for the bottom corner of
14
+ * a video thumbnail. Placement (e.g. absolute over media) is the consumer's job via the cascade.
15
+ *
16
+ * ### CSS Custom Properties
17
+ * | Property | Description | Default |
18
+ * |---|---|---|
19
+ * | `--sc-kit--duration--badge--background` | Badge background (badge variant) | `rgb(0 0 0 / 55%)` (dark translucent) |
20
+ * | `--sc-kit--duration--badge--color` | Badge text color (badge variant) | `var(--sc-kit--color--text--on-accent)` |
21
+ * | `--sc-kit--duration--badge--padding` | Badge padding (badge variant) | `var(--sc-kit--space--1) var(--sc-kit--space--2)` |
22
+ * | `--sc-kit--duration--badge--border-radius` | Badge corner radius (badge variant) | `var(--sc-kit--radius--sm)` |
23
+ * | `--sc-kit--duration--badge--font-size` | Badge font size (badge variant) | `var(--sc-kit--font-size--xs)` |
24
+ */
25
+ declare const Cmp: import("svelte").Component<Props, {}, "">;
26
+ type Cmp = ReturnType<typeof Cmp>;
27
+ export default Cmp;
@@ -0,0 +1 @@
1
+ export { default as Duration } from './cmp.duration.svelte';
@@ -0,0 +1 @@
1
+ export { default as Duration } from './cmp.duration.svelte';
@@ -113,7 +113,7 @@ Completed sidebar steps are clickable to go back; `canAdvance(step)` gates Next
113
113
  -->
114
114
 
115
115
  <style>.stepper-dialog-layout {
116
- --_sdl--sidebar-width: var(--sc-kit--stepper-dialog-layout--sidebar--width, functions.to-rem(320));
116
+ --_sdl--sidebar-width: var(--sc-kit--stepper-dialog-layout--sidebar--width, 20rem);
117
117
  --_sdl--sidebar-background: var(--sc-kit--stepper-dialog-layout--sidebar--background, var(--sc-kit--color--bg--field-alt));
118
118
  --sc-kit--dialog--height: var(--sc-kit--stepper-dialog-layout--height, auto);
119
119
  --sc-kit--dialog--body--overflow-y: auto;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/kit",
3
- "version": "0.9.12",
3
+ "version": "0.9.13",
4
4
  "author": "StreamsCloud",
5
5
  "repository": {
6
6
  "type": "git",
@@ -163,6 +163,10 @@
163
163
  "types": "./dist/ui/drawer/index.d.ts",
164
164
  "svelte": "./dist/ui/drawer/index.js"
165
165
  },
166
+ "./ui/duration": {
167
+ "types": "./dist/ui/duration/index.d.ts",
168
+ "svelte": "./dist/ui/duration/index.js"
169
+ },
166
170
  "./ui/dynamic-component": {
167
171
  "types": "./dist/ui/dynamic-component/index.d.ts",
168
172
  "svelte": "./dist/ui/dynamic-component/index.js"