@sveltia/ui 0.92.1 → 0.92.2

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.
@@ -19,7 +19,7 @@
19
19
  */
20
20
  let {
21
21
  /* eslint-disable prefer-const */
22
- element = $bindable(),
22
+ element: boundElement = $bindable(),
23
23
  class: className = '',
24
24
  type = 'button',
25
25
  role = 'button',
@@ -49,6 +49,14 @@
49
49
  ...restProps
50
50
  /* eslint-enable prefer-const */
51
51
  } = $props();
52
+
53
+ /**
54
+ * A reference to the `<button>` element. It’s kept apart from the bindable `element` prop, which
55
+ * Svelte resets whenever the props spread onto this component change, unless the consumer binds
56
+ * it.
57
+ * @type {HTMLButtonElement | undefined}
58
+ */
59
+ let element = $state.raw();
52
60
  </script>
53
61
 
54
62
  {#snippet labelText()}
@@ -69,7 +77,13 @@
69
77
  wrap one, so a long list would otherwise pay for an effect per item that has nothing to do.
70
78
  -->
71
79
  <button
72
- bind:this={element}
80
+ bind:this={
81
+ () => element,
82
+ (el) => {
83
+ element = el;
84
+ boundElement = el;
85
+ }
86
+ }
73
87
  {...restProps}
74
88
  class={['sui', 'button', variant, size, className]}
75
89
  class:iconic
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * Version of this package, used to resolve the prebuilt Shiki engine chunk from a CDN.
3
3
  */
4
- export const UI_VERSION: "0.92.1";
4
+ export const UI_VERSION: "0.92.2";
@@ -3,4 +3,4 @@
3
3
  /**
4
4
  * Version of this package, used to resolve the prebuilt Shiki engine chunk from a CDN.
5
5
  */
6
- export const UI_VERSION = '0.92.1';
6
+ export const UI_VERSION = '0.92.2';
@@ -45,7 +45,7 @@
45
45
  let {
46
46
  /* eslint-disable prefer-const */
47
47
  value = $bindable(''),
48
- element = $bindable(),
48
+ element: boundElement = $bindable(),
49
49
  flex = false,
50
50
  dir = undefined,
51
51
  name = undefined,
@@ -63,6 +63,14 @@
63
63
  /* eslint-enable prefer-const */
64
64
  } = $props();
65
65
 
66
+ /**
67
+ * A reference to the `<textarea>` element. It’s kept apart from the bindable `element` prop,
68
+ * which Svelte resets whenever the props spread onto this component change, unless the consumer
69
+ * binds it.
70
+ * @type {HTMLTextAreaElement | undefined}
71
+ */
72
+ let element = $state.raw();
73
+
66
74
  /**
67
75
  * Content for the clone element used to measure the auto-resized height. A trailing line break is
68
76
  * added because browsers don’t render the last empty line, which would otherwise make the clone
@@ -117,7 +125,13 @@
117
125
  {hidden}
118
126
  >
119
127
  <textarea
120
- bind:this={element}
128
+ bind:this={
129
+ () => element,
130
+ (el) => {
131
+ element = el;
132
+ boundElement = el;
133
+ }
134
+ }
121
135
  {...restProps}
122
136
  {dir}
123
137
  {name}
@@ -26,7 +26,7 @@
26
26
  let {
27
27
  /* eslint-disable prefer-const */
28
28
  value = $bindable(),
29
- element = $bindable(),
29
+ element: boundElement = $bindable(),
30
30
  role = 'textbox',
31
31
  keyShortcuts = undefined,
32
32
  dir = undefined,
@@ -50,6 +50,14 @@
50
50
  /* eslint-enable prefer-const */
51
51
  } = $props();
52
52
 
53
+ /**
54
+ * A reference to the `<input>` element. It’s kept apart from the bindable `element` prop, which
55
+ * Svelte resets whenever the props spread onto this component change, unless the consumer binds
56
+ * it.
57
+ * @type {HTMLInputElement | undefined}
58
+ */
59
+ let element = $state.raw();
60
+
53
61
  const id = $props.id();
54
62
  const timeout = $derived(typeof debounce === 'number' ? debounce : 300);
55
63
  /**
@@ -108,7 +116,13 @@
108
116
  {hidden}
109
117
  >
110
118
  <input
111
- bind:this={element}
119
+ bind:this={
120
+ () => element,
121
+ (el) => {
122
+ element = el;
123
+ boundElement = el;
124
+ }
125
+ }
112
126
  type="text"
113
127
  {...restProps}
114
128
  {value}
@@ -40,7 +40,7 @@
40
40
  /* eslint-disable prefer-const */
41
41
  open = $bindable(false),
42
42
  hovered = $bindable(false),
43
- content = $bindable(undefined),
43
+ content: boundContent = $bindable(),
44
44
  class: className,
45
45
  showBackdrop = undefined,
46
46
  anchor,
@@ -54,6 +54,14 @@
54
54
  /* eslint-enable prefer-const */
55
55
  } = $props();
56
56
 
57
+ /**
58
+ * A reference to the content element. It’s kept apart from the bindable `content` prop, which
59
+ * Svelte resets whenever the props spread onto this component change, unless the consumer binds
60
+ * it.
61
+ * @type {HTMLElement | undefined}
62
+ */
63
+ let content = $state.raw();
64
+
57
65
  /**
58
66
  * A reference to the `<dialog>` element. This is only available while the popup is open, because
59
67
  * the element is mounted on demand.
@@ -184,7 +192,13 @@
184
192
 
185
193
  {#snippet contentWrapper()}
186
194
  <div
187
- bind:this={content}
195
+ bind:this={
196
+ () => content,
197
+ (el) => {
198
+ content = el;
199
+ boundContent = el;
200
+ }
201
+ }
188
202
  hidden={!open}
189
203
  role="none"
190
204
  class="content {className} {contentType}"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltia/ui",
3
- "version": "0.92.1",
3
+ "version": "0.92.2",
4
4
  "description": "A collection of Svelte components and utilities for building user interfaces.",
5
5
  "repository": {
6
6
  "type": "git",