@streamscloud/kit 0.19.7 → 0.20.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.
@@ -174,6 +174,11 @@
174
174
  --sc-kit--shadow--card: 0 1px 1px rgba(0, 0, 0, 0.1);
175
175
  --sc-kit--shadow--focus: var(--sc-kit--focus-ring);
176
176
 
177
+ // ============================================================
178
+ // FILTERS
179
+ // ============================================================
180
+ --sc-kit--filter--icon-overlay: drop-shadow(1px 1px #000);
181
+
177
182
  // ============================================================
178
183
  // MOTION
179
184
  // ============================================================
@@ -1,4 +1,5 @@
1
- <script lang="ts">import { Duration } from '../duration';
1
+ <script lang="ts">import { Utils } from '../../core/utils';
2
+ import { Duration } from '../duration';
2
3
  import { Icon } from '../icon';
3
4
  import { Image } from '../image';
4
5
  import { PlaybackManager } from '../media-playback';
@@ -18,6 +19,9 @@ const onPlayerTimeUpdate = (t) => (currentTime = t);
18
19
  const onPlayerDurationChange = (d) => (mediaDuration = d);
19
20
  const onPlayerActivate = (id) => (activePlayerId = id);
20
21
  const normalizedRatio = $derived.by(() => {
22
+ if (typeof aspectRatio === 'number') {
23
+ return aspectRatio;
24
+ }
21
25
  switch (aspectRatio) {
22
26
  case 'vertical':
23
27
  return 9 / 16;
@@ -25,6 +29,8 @@ const normalizedRatio = $derived.by(() => {
25
29
  return 1;
26
30
  case 'horizontal':
27
31
  return 16 / 9;
32
+ default:
33
+ return Utils.assertUnreachable(aspectRatio);
28
34
  }
29
35
  });
30
36
  const onSeek = (value) => {
@@ -1,4 +1,4 @@
1
- /** Aspect ratio preset for `GridCardMedia`. */
2
- export type AspectRatio = 'vertical' | 'square' | 'horizontal';
1
+ /** Aspect ratio for `GridCardMedia` — a named preset or a custom width/height number (e.g. `4 / 3`). */
2
+ export type AspectRatio = 'vertical' | 'square' | 'horizontal' | number;
3
3
  /** Object-fit mode for media inside the card's media slot. */
4
4
  export type ObjectFit = 'contain' | 'cover';
@@ -171,7 +171,7 @@ via `bind:this` for parent seek-bar sync. Not exported standalone — use `GridC
171
171
  border: none;
172
172
  background: none;
173
173
  cursor: pointer;
174
- --sc-kit--icon--filter: drop-shadow(1px 1px black);
174
+ --sc-kit--icon--filter: var(--sc-kit--filter--icon-overlay);
175
175
  transition: opacity var(--sc-kit--duration--base) var(--sc-kit--ease--default);
176
176
  }
177
177
  .video-player__control-button.is-playing {
@@ -0,0 +1,28 @@
1
+ <script lang="ts">import { Icon } from '../icon';
2
+ import IconPlay from '@fluentui/svg-icons/icons/play_20_regular.svg?raw';
3
+ </script>
4
+
5
+ <div class="play-indicator">
6
+ <Icon src={IconPlay} color="on-accent" />
7
+ </div>
8
+
9
+ <!--
10
+ @component
11
+ Decorative play glyph overlaid on a static cover/thumbnail to mark it as video. Not a player: it plays
12
+ nothing and is `pointer-events: none`. Matches the built-in play button of kit's `Video`. The parent
13
+ positions it (typically absolute-centered) and must be `container-type: inline-size` for the default
14
+ container-query size to scale.
15
+
16
+ ### CSS Custom Properties
17
+ | Property | Description | Default |
18
+ |---|---|---|
19
+ | `--sc-kit--play-indicator--size` | Glyph size; container-query clamp scales it to parent width | `clamp(1.75rem, 12cqi, 3.5rem)` |
20
+ -->
21
+
22
+ <style>.play-indicator {
23
+ --_play-indicator--size: var(--sc-kit--play-indicator--size, clamp(1.75rem, 12cqi, 3.5rem));
24
+ display: inline-flex;
25
+ pointer-events: none;
26
+ --sc-kit--icon--size: var(--_play-indicator--size);
27
+ --sc-kit--icon--filter: var(--sc-kit--filter--icon-overlay);
28
+ }</style>
@@ -0,0 +1,29 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ /**
15
+ * Decorative play glyph overlaid on a static cover/thumbnail to mark it as video. Not a player: it plays
16
+ * nothing and is `pointer-events: none`. Matches the built-in play button of kit's `Video`. The parent
17
+ * positions it (typically absolute-centered) and must be `container-type: inline-size` for the default
18
+ * container-query size to scale.
19
+ *
20
+ * ### CSS Custom Properties
21
+ * | Property | Description | Default |
22
+ * |---|---|---|
23
+ * | `--sc-kit--play-indicator--size` | Glyph size; container-query clamp scales it to parent width | `clamp(1.75rem, 12cqi, 3.5rem)` |
24
+ */
25
+ declare const Cmp: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
26
+ [evt: string]: CustomEvent<any>;
27
+ }, {}, {}, string>;
28
+ type Cmp = InstanceType<typeof Cmp>;
29
+ export default Cmp;
@@ -0,0 +1 @@
1
+ export { default as PlayIndicator } from './cmp.play-indicator.svelte';
@@ -0,0 +1 @@
1
+ export { default as PlayIndicator } from './cmp.play-indicator.svelte';
@@ -1,15 +1,20 @@
1
1
  <script lang="ts" generics="T extends {id: string}">import { Badge } from '../../badge';
2
- let { item, column } = $props();
2
+ let { item, column, centered } = $props();
3
3
  const getValueForColumn = (column, item) => (column.valueFactory ? column.valueFactory(item) : String(item[column.id]));
4
4
  const variant = $derived(column.variantFactory ? column.variantFactory(item) : 'neutral');
5
5
  </script>
6
6
 
7
7
  {#if getValueForColumn(column, item) !== null}
8
- <div class="table-badge-cell">
8
+ <div class="table-badge-cell" class:table-badge-cell--centered={centered}>
9
9
  <Badge variant={variant} fullWidth={column.fullWidth}>{getValueForColumn(column, item)}</Badge>
10
10
  </div>
11
11
  {/if}
12
12
 
13
13
  <style>.table-badge-cell {
14
- width: 100%;
14
+ display: flex;
15
+ inline-size: 100%;
16
+ }
17
+
18
+ .table-badge-cell--centered {
19
+ justify-content: center;
15
20
  }</style>
@@ -5,6 +5,7 @@ declare function $$render<T extends {
5
5
  props: {
6
6
  item: T;
7
7
  column: ITableBadgeColumn<T>;
8
+ centered: boolean;
8
9
  };
9
10
  exports: {};
10
11
  bindings: "";
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" generics="T extends {id: string}">import { Button } from '../../button';
2
- let { item, column } = $props();
2
+ let { item, column, centered } = $props();
3
3
  const getValueForColumn = (column, item) => (column.valueFactory ? column.valueFactory(item) : String(item[column.id]));
4
4
  const variant = $derived(column.styleFactory ? column.styleFactory(item) : undefined);
5
5
  const size = $derived(column.sizeFactory ? column.sizeFactory(item) : undefined);
@@ -10,11 +10,16 @@ const handleClick = (e) => {
10
10
  </script>
11
11
 
12
12
  {#if getValueForColumn(column, item) !== null}
13
- <div class="table-button-cell">
13
+ <div class="table-button-cell" class:table-button-cell--centered={centered}>
14
14
  <Button type="button" variant={variant} size={size} on={{ click: handleClick }}>{getValueForColumn(column, item)}</Button>
15
15
  </div>
16
16
  {/if}
17
17
 
18
18
  <style>.table-button-cell {
19
- width: 100%;
19
+ display: flex;
20
+ inline-size: 100%;
21
+ }
22
+
23
+ .table-button-cell--centered {
24
+ justify-content: center;
20
25
  }</style>
@@ -5,6 +5,7 @@ declare function $$render<T extends {
5
5
  props: {
6
6
  item: T;
7
7
  column: ITableButtonColumn<T>;
8
+ centered: boolean;
8
9
  };
9
10
  exports: {};
10
11
  bindings: "";
@@ -45,9 +45,9 @@ const changeItemPosition = (target, positionChange) => {
45
45
  </TableActionsCell>
46
46
  {/if}
47
47
  {:else if def.type === 'badge'}
48
- <TableBadgeCell column={def} item={item} />
48
+ <TableBadgeCell column={def} item={item} centered={column.centered} />
49
49
  {:else if def.type === 'button'}
50
- <TableButtonCell column={def} item={item} />
50
+ <TableButtonCell column={def} item={item} centered={column.centered} />
51
51
  {:else if def.type === 'by'}
52
52
  <TableByCell column={def} item={item} />
53
53
  {:else if def.type === 'checkbox'}
@@ -55,7 +55,7 @@ const changeItemPosition = (target, positionChange) => {
55
55
  {:else if def.type === 'custom'}
56
56
  <TableCustomCell column={def} item={item} />
57
57
  {:else if def.type === 'icon'}
58
- <TableIconCell column={def} item={item} />
58
+ <TableIconCell column={def} item={item} centered={column.centered} />
59
59
  {:else if def.type === 'image'}
60
60
  <TableImageCell column={def} item={item} centered={column.centered} />
61
61
  {:else if def.type === 'move-row'}
@@ -1,16 +1,10 @@
1
1
  <script lang="ts" generics="T extends {id: string}">import { IconSlot } from '../../icon';
2
2
  import { Tooltip } from '../../tooltip';
3
- let { item, column } = $props();
3
+ let { item, column, centered } = $props();
4
4
  const iconProp = $derived(column.iconFactory ? column.iconFactory(item) : String(item[column.id]));
5
- const cssWidth = (column) => {
6
- if (column?.fixedCssWidth) {
7
- return `width: ${column.fixedCssWidth};`;
8
- }
9
- return 'width: auto;';
10
- };
11
5
  </script>
12
6
 
13
- <div class="table-icon-cell" style={cssWidth(column)}>
7
+ <div class="table-icon-cell" class:table-icon-cell--centered={centered}>
14
8
  {#if column.tooltipTextFactory && column.tooltipTextFactory(item)}
15
9
  <Tooltip text={column.tooltipTextFactory(item)}>
16
10
  <IconSlot icon={iconProp} />
@@ -26,5 +20,10 @@ Icon cell for table rows. Displays an icon with optional tooltip.
26
20
  -->
27
21
 
28
22
  <style>.table-icon-cell {
29
- display: inline-flex;
23
+ display: flex;
24
+ inline-size: 100%;
25
+ }
26
+
27
+ .table-icon-cell--centered {
28
+ justify-content: center;
30
29
  }</style>
@@ -5,6 +5,7 @@ declare function $$render<T extends {
5
5
  props: {
6
6
  item: T;
7
7
  column: ITableIconColumn<T>;
8
+ centered: boolean;
8
9
  };
9
10
  exports: {};
10
11
  bindings: "";
@@ -353,7 +353,7 @@ A full-featured video player with custom overlay controls, play/pause, mute, see
353
353
  }
354
354
  .video__playback-button {
355
355
  --sc-kit--icon--size: var(--_video--playback-button--size);
356
- --sc-kit--icon--filter: drop-shadow(1px 1px #000);
356
+ --sc-kit--icon--filter: var(--sc-kit--filter--icon-overlay);
357
357
  position: absolute;
358
358
  top: 50%;
359
359
  left: 50%;
@@ -369,7 +369,7 @@ A full-featured video player with custom overlay controls, play/pause, mute, see
369
369
  }
370
370
  .video__mute-button {
371
371
  --sc-kit--icon--size: 1.25rem;
372
- --sc-kit--icon--filter: drop-shadow(1px 1px #000);
372
+ --sc-kit--icon--filter: var(--sc-kit--filter--icon-overlay);
373
373
  position: absolute;
374
374
  top: 0.625em;
375
375
  right: 0.625em;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/kit",
3
- "version": "0.19.7",
3
+ "version": "0.20.0",
4
4
  "author": "StreamsCloud",
5
5
  "repository": {
6
6
  "type": "git",
@@ -303,6 +303,10 @@
303
303
  "types": "./dist/ui/pin-input/index.d.ts",
304
304
  "svelte": "./dist/ui/pin-input/index.js"
305
305
  },
306
+ "./ui/play-indicator": {
307
+ "types": "./dist/ui/play-indicator/index.d.ts",
308
+ "svelte": "./dist/ui/play-indicator/index.js"
309
+ },
306
310
  "./ui/player/buttons": {
307
311
  "types": "./dist/ui/player/buttons/index.d.ts",
308
312
  "svelte": "./dist/ui/player/buttons/index.js"