@sveltia/ui 0.92.0 → 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.0";
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.0';
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}
@@ -36,7 +36,7 @@
36
36
  let {
37
37
  /* eslint-disable prefer-const */
38
38
  open = $bindable(false),
39
- dialog = $bindable(),
39
+ dialog: boundDialog = $bindable(),
40
40
  class: className,
41
41
  role = 'dialog',
42
42
  modal = true,
@@ -57,6 +57,15 @@
57
57
  /* eslint-enable prefer-const */
58
58
  } = $props();
59
59
 
60
+ /**
61
+ * A reference to the `<dialog>` element. This is kept apart from the bindable `dialog` prop: when
62
+ * the consumer doesn’t bind that prop, Svelte discards the value assigned to it locally as soon
63
+ * as any of the props spread onto this component changes, such as the labelling attributes of a
64
+ * `<Dialog>` whose title has been updated, which would leave the modal unable to open or close.
65
+ * @type {HTMLDialogElement | undefined}
66
+ */
67
+ let dialog = $state.raw();
68
+
60
69
  /**
61
70
  * Focus the `<dialog>` element. It has `tabindex="-1"`, so it can receive focus programmatically,
62
71
  * allowing assistive technology to announce the modal’s label and description.
@@ -417,7 +426,13 @@
417
426
  {#snippet dialogSnippet()}
418
427
  {#if mounted}
419
428
  <dialog
420
- bind:this={dialog}
429
+ bind:this={
430
+ () => dialog,
431
+ (element) => {
432
+ dialog = element;
433
+ boundDialog = element;
434
+ }
435
+ }
421
436
  tabindex="-1"
422
437
  {...restProps}
423
438
  inert={!setOpenClass}
@@ -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}"
@@ -56,7 +56,7 @@ calendar:
56
56
  # Split button component
57
57
  split_button:
58
58
  # Wrapper aria-label, e.g. “Save Options” when primary button is “Save”
59
- x_options: '{$name} – beállítások'
59
+ x_options: 'Beállítások: {$name}'
60
60
  # Dropdown toggle aria-label
61
61
  more_options: További lehetőségek
62
62
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltia/ui",
3
- "version": "0.92.0",
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",
@@ -81,7 +81,7 @@
81
81
  "eslint-config-airbnb-extended": "^3.3.0",
82
82
  "eslint-config-prettier": "^10.1.8",
83
83
  "eslint-plugin-import": "^2.32.0",
84
- "eslint-plugin-jsdoc": "^65.4.7",
84
+ "eslint-plugin-jsdoc": "^65.4.8",
85
85
  "eslint-plugin-package-json": "^1.14.0",
86
86
  "eslint-plugin-svelte": "^3.24.1",
87
87
  "globals": "^17.14.0",