@streamscloud/kit 0.51.0 → 0.52.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.
@@ -3,19 +3,38 @@ import { Icon } from '../icon';
3
3
  import { Tooltip } from '../tooltip';
4
4
  import IconInfo from '@fluentui/svg-icons/icons/info_20_regular.svg?raw';
5
5
  let { label, hint, required = false, children } = $props();
6
+ let rootEl = $state.raw(undefined);
7
+ let labelRowEl = $state.raw(undefined);
8
+ let swallowLabelActivation = false;
6
9
  // Unhandled, the click activates the labelled field (a checkbox would toggle); cancelling it on interactive content would kill a link's navigation.
7
10
  const swallowClick = (event) => {
8
11
  event.stopPropagation();
12
+ // This click never reaches guardLabelActivation, so the flag would outlive the gesture and swallow a later keyboard-activated click.
13
+ swallowLabelActivation = false;
9
14
  if (DomHelper.isInsideInteractive(event.target)) {
10
15
  return;
11
16
  }
12
17
  event.preventDefault();
13
18
  };
19
+ const isLabelChrome = (target) => target instanceof Node && (target === rootEl || !!labelRowEl?.contains(target));
20
+ // Read at mousedown: by click time the popup field has already dismissed itself and the forwarded activation would reopen it.
21
+ const rememberLabelActivation = (event) => {
22
+ swallowLabelActivation = isLabelChrome(event.target) && !!rootEl?.querySelector('[aria-haspopup][aria-expanded="true"]');
23
+ };
24
+ const guardLabelActivation = (event) => {
25
+ const swallow = swallowLabelActivation;
26
+ swallowLabelActivation = false;
27
+ if (swallow && isLabelChrome(event.target)) {
28
+ event.preventDefault();
29
+ }
30
+ };
14
31
  </script>
15
32
 
16
- <label class="form-field">
33
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
34
+ <!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
35
+ <label bind:this={rootEl} class="form-field" onmousedown={rememberLabelActivation} onclick={guardLabelActivation}>
17
36
  {#if label}
18
- <span class="form-field__label">
37
+ <span bind:this={labelRowEl} class="form-field__label">
19
38
  {#if typeof label === 'string'}
20
39
  {label}
21
40
  {:else}
@@ -45,6 +64,8 @@ const swallowClick = (event) => {
45
64
  @component
46
65
  FormField — pure layout shell: optional label (string or snippet) above an input slot. The root is a `<label>` element, so the first labelable form control inside is automatically associated via HTML's implicit-association rule — no id wiring required. Does NOT render errors or helper text; pair with `Validatable` for that.
47
66
 
67
+ Clicking the label opens a popup field inside it (select, date picker) but never re-opens one that is already expanded — that click dismisses it, exactly like a click on empty space.
68
+
48
69
  `hint` pins an affordance to the trailing edge of the label row — a string gives the standard info icon with a tooltip, a snippet takes over completely (button, link, badge). It rides on the label row, so it renders only when `label` is set. Clicks inside the hint are swallowed, so an interactive hint never activates the labelled field.
49
70
 
50
71
  ### CSS Custom Properties
@@ -12,6 +12,8 @@ type Props = {
12
12
  /**
13
13
  * FormField — pure layout shell: optional label (string or snippet) above an input slot. The root is a `<label>` element, so the first labelable form control inside is automatically associated via HTML's implicit-association rule — no id wiring required. Does NOT render errors or helper text; pair with `Validatable` for that.
14
14
  *
15
+ * Clicking the label opens a popup field inside it (select, date picker) but never re-opens one that is already expanded — that click dismisses it, exactly like a click on empty space.
16
+ *
15
17
  * `hint` pins an affordance to the trailing edge of the label row — a string gives the standard info icon with a tooltip, a snippet takes over completely (button, link, badge). It rides on the label row, so it renders only when `label` is set. Clicks inside the hint are swallowed, so an interactive hint never activates the labelled field.
16
18
  *
17
19
  * ### CSS Custom Properties
@@ -196,6 +196,7 @@ const onTimeUpdate = () => {
196
196
  }
197
197
  percentageCompleted = video.currentTime / video.duration || 0;
198
198
  notifyProgress();
199
+ on?.timeUpdate?.({ id, seconds: video.currentTime });
199
200
  };
200
201
  const onLoaded = () => {
201
202
  setVolume(MediaVolumeManager.volumeLevel);
@@ -238,6 +239,7 @@ const handleSeek = (percent) => {
238
239
  video.currentTime = video.duration * percent;
239
240
  percentageCompleted = percent;
240
241
  notifyProgress();
242
+ on?.timeUpdate?.({ id, seconds: video.currentTime });
241
243
  }
242
244
  };
243
245
  </script>
@@ -38,6 +38,15 @@ type Props = {
38
38
  }) => void;
39
39
  /** Fires on timeupdate with the completion ratio (0-1) */
40
40
  progress?: (value: number) => void;
41
+ /**
42
+ * Fires on timeupdate with the raw playback position in seconds. Position-change
43
+ * samples, not a heartbeat: nothing fires while paused, seeks fire once, and a
44
+ * stopped/reset player emits a trailing `seconds: 0`.
45
+ */
46
+ timeUpdate?: (data: {
47
+ id: string;
48
+ seconds: number;
49
+ }) => void;
41
50
  ended?: (data: {
42
51
  id: string;
43
52
  src: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/kit",
3
- "version": "0.51.0",
3
+ "version": "0.52.0",
4
4
  "author": "StreamsCloud",
5
5
  "repository": {
6
6
  "type": "git",