@nectary/components 5.34.0 → 5.36.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.
@@ -22,7 +22,14 @@ class AccordionItem extends NectaryElement {
22
22
  disconnectedCallback() {
23
23
  }
24
24
  static get observedAttributes() {
25
- return ["label", "disabled", "data-checked", "optionaltext", "ellipsis"];
25
+ return [
26
+ "label",
27
+ "disabled",
28
+ "data-checked",
29
+ "optionaltext",
30
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: ellipsis missing set/get pair, fixed by MR !597
31
+ "ellipsis"
32
+ ];
26
33
  }
27
34
  attributeChangedCallback(name, oldVal, newVal) {
28
35
  if (isAttrEqual(oldVal, newVal)) {
package/bundle.js CHANGED
@@ -389,7 +389,12 @@ class Title extends NectaryElement {
389
389
  this.setAttribute("role", "heading");
390
390
  }
391
391
  static get observedAttributes() {
392
- return ["text", "level", "ellipsis"];
392
+ return [
393
+ "text",
394
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: level missing set/get pair
395
+ "level",
396
+ "ellipsis"
397
+ ];
393
398
  }
394
399
  attributeChangedCallback(name, oldVal, newVal) {
395
400
  switch (name) {
@@ -449,7 +454,14 @@ class AccordionItem extends NectaryElement {
449
454
  disconnectedCallback() {
450
455
  }
451
456
  static get observedAttributes() {
452
- return ["label", "disabled", "data-checked", "optionaltext", "ellipsis"];
457
+ return [
458
+ "label",
459
+ "disabled",
460
+ "data-checked",
461
+ "optionaltext",
462
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: ellipsis missing set/get pair, fixed by MR !597
463
+ "ellipsis"
464
+ ];
453
465
  }
454
466
  attributeChangedCallback(name, oldVal, newVal) {
455
467
  if (isAttrEqual(oldVal, newVal)) {
@@ -2206,7 +2218,15 @@ class ButtonGroupItem extends NectaryElement {
2206
2218
  this.#$sinchButton = shadowRoot.querySelector("#sinch-button-element");
2207
2219
  }
2208
2220
  static get observedAttributes() {
2209
- return ["type", "size", "text", "disabled", "toggled"];
2221
+ return [
2222
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set type
2223
+ "type",
2224
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set size
2225
+ "size",
2226
+ "text",
2227
+ "disabled",
2228
+ "toggled"
2229
+ ];
2210
2230
  }
2211
2231
  attributeChangedCallback(name, oldVal, newVal) {
2212
2232
  updateAttribute(this.#$sinchButton, name, newVal);
@@ -2749,7 +2769,12 @@ class CardV2 extends NectaryElement {
2749
2769
  }
2750
2770
  }
2751
2771
  static get observedAttributes() {
2752
- return ["clickable", "disabled", "selected"];
2772
+ return [
2773
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: clickable missing set/get pair
2774
+ "clickable",
2775
+ "disabled",
2776
+ "selected"
2777
+ ];
2753
2778
  }
2754
2779
  attributeChangedCallback(name, _oldVal, newVal) {
2755
2780
  switch (name) {
@@ -4113,14 +4138,18 @@ class Tooltip extends NectaryElement {
4113
4138
  }
4114
4139
  static get observedAttributes() {
4115
4140
  return [
4141
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set isOpened
4116
4142
  "is-opened",
4117
4143
  "text",
4118
4144
  "orientation",
4145
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set textAlign
4119
4146
  "text-align",
4120
4147
  "type",
4121
4148
  "aria-label",
4122
4149
  "aria-description",
4150
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: getter exists but missing set showOutsideViewport
4123
4151
  "show-outside-viewport",
4152
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set allowScroll
4124
4153
  "allow-scroll"
4125
4154
  ];
4126
4155
  }
@@ -5408,7 +5437,9 @@ class DatePicker extends NectaryElement {
5408
5437
  "max",
5409
5438
  "locale",
5410
5439
  "range",
5440
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set prevYearAriaLabel
5411
5441
  "prev-year-aria-label",
5442
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set nextYearAriaLabel
5412
5443
  "next-year-aria-label",
5413
5444
  "prev-month-aria-label",
5414
5445
  "next-month-aria-label"
@@ -5830,6 +5861,7 @@ class Dialog extends NectaryElement {
5830
5861
  return [
5831
5862
  "caption",
5832
5863
  "open",
5864
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set closeAriaLabel
5833
5865
  "close-aria-label",
5834
5866
  "hide-close-button",
5835
5867
  "prevent-close"
@@ -6448,18 +6480,24 @@ class Input extends NectaryElement {
6448
6480
  "value",
6449
6481
  "placeholder",
6450
6482
  "mask",
6483
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set max
6451
6484
  "max",
6485
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set min
6452
6486
  "min",
6453
6487
  "invalid",
6454
6488
  "disabled",
6455
6489
  "size",
6490
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set step
6456
6491
  "step",
6457
6492
  "autocomplete",
6493
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set readonly
6458
6494
  "readonly",
6459
6495
  "autofocus",
6460
6496
  "data-size",
6461
6497
  "aria-label",
6498
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set maxlength
6462
6499
  "maxlength",
6500
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set required
6463
6501
  "required"
6464
6502
  ];
6465
6503
  }
@@ -13669,8 +13707,11 @@ class SelectMenu extends NectaryElement {
13669
13707
  "rows",
13670
13708
  "multiple",
13671
13709
  "searchable",
13710
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set searchValue
13672
13711
  "search-value",
13712
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set searchPlaceholder
13673
13713
  "search-placeholder",
13714
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set searchAutocomplete
13674
13715
  "search-autocomplete"
13675
13716
  ];
13676
13717
  }
@@ -14292,7 +14333,12 @@ class SheetTitle extends NectaryElement {
14292
14333
  this.#controller = null;
14293
14334
  }
14294
14335
  static get observedAttributes() {
14295
- return ["title", "description", "close-aria-label"];
14336
+ return [
14337
+ "title",
14338
+ "description",
14339
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: close-aria-label missing set/get pair
14340
+ "close-aria-label"
14341
+ ];
14296
14342
  }
14297
14343
  attributeChangedCallback(name, oldVal, newVal) {
14298
14344
  if (isAttrEqual(oldVal, newVal)) {
@@ -14415,7 +14461,10 @@ class Skeleton extends NectaryElement {
14415
14461
  this.#observer = null;
14416
14462
  }
14417
14463
  static get observedAttributes() {
14418
- return ["card"];
14464
+ return [
14465
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: card missing set/get pair
14466
+ "card"
14467
+ ];
14419
14468
  }
14420
14469
  attributeChangedCallback(name, _oldVal, newVal) {
14421
14470
  if (name === "card") {
@@ -14795,10 +14844,11 @@ class Textarea extends NectaryElement {
14795
14844
  #$bottomWrapper;
14796
14845
  #$resizeHandle;
14797
14846
  #cursorPos = null;
14798
- #isPendingDk = false;
14847
+ #pendingPostInputCaret = null;
14799
14848
  #controller = null;
14800
14849
  #sizeContext;
14801
14850
  #prevContentHeight = 0;
14851
+ #lastValueForAutoResize;
14802
14852
  #dragStartY = 0;
14803
14853
  #intersectionObserver = null;
14804
14854
  #internals;
@@ -14825,7 +14875,6 @@ class Textarea extends NectaryElement {
14825
14875
  this.ariaMultiLine = "true";
14826
14876
  this.#internals.ariaMultiLine = "true";
14827
14877
  this.#$input.addEventListener("input", this.#onInput, options);
14828
- this.#$input.addEventListener("compositionstart", this.#onCompositionStart, options);
14829
14878
  this.#$input.addEventListener("mousedown", this.#onSelectionChange, options);
14830
14879
  this.#$input.addEventListener("keydown", this.#onSelectionChange, options);
14831
14880
  this.#$input.addEventListener("focus", this.#onInputFocus, options);
@@ -14839,6 +14888,7 @@ class Textarea extends NectaryElement {
14839
14888
  this.#onBottomSlotChange();
14840
14889
  this.#updateMinRows();
14841
14890
  this.#updateMaxRows();
14891
+ this.#lastValueForAutoResize = this.#$input.value;
14842
14892
  this.#onSizeUpdate();
14843
14893
  }
14844
14894
  disconnectedCallback() {
@@ -14856,6 +14906,10 @@ class Textarea extends NectaryElement {
14856
14906
  formResetCallback() {
14857
14907
  this.#$input.value = "";
14858
14908
  setFormValue(this.#internals, "");
14909
+ this.#lastValueForAutoResize = "";
14910
+ if (!this.resizable) {
14911
+ this.#applyAutoResize(true);
14912
+ }
14859
14913
  }
14860
14914
  formStateRestoreCallback(state) {
14861
14915
  if (this.#internals.form === null || getBooleanAttribute(this.#internals.form, "data-form-state-restore") === false) {
@@ -14863,8 +14917,14 @@ class Textarea extends NectaryElement {
14863
14917
  }
14864
14918
  if (state !== null) {
14865
14919
  const value = typeof state === "string" ? state : state.get(this.name);
14866
- this.#$input.value = value?.toString() ?? "";
14867
- setFormValue(this.#internals, value?.toString() ?? "");
14920
+ const next = value?.toString() ?? "";
14921
+ const prevLen = this.#$input.value.length;
14922
+ this.#$input.value = next;
14923
+ setFormValue(this.#internals, next);
14924
+ this.#lastValueForAutoResize = next;
14925
+ if (!this.resizable) {
14926
+ this.#applyAutoResize(next.length < prevLen);
14927
+ }
14868
14928
  }
14869
14929
  }
14870
14930
  static get observedAttributes() {
@@ -14889,20 +14949,18 @@ class Textarea extends NectaryElement {
14889
14949
  const isShrinkingContent = nextVal.length < prevVal.length;
14890
14950
  this.#$input.value = nextVal;
14891
14951
  setFormValue(this.#internals, nextVal);
14952
+ this.#lastValueForAutoResize = nextVal;
14892
14953
  if (!this.resizable) {
14893
- if (isShrinkingContent) {
14894
- this.#$input.style.removeProperty("height");
14895
- }
14896
- const nextContentHeight = this.#$input.scrollHeight;
14897
- if (isShrinkingContent || nextContentHeight !== this.#prevContentHeight) {
14898
- this.#prevContentHeight = nextContentHeight;
14899
- this.#$input.style.setProperty("height", `${this.#prevContentHeight}px`);
14900
- }
14954
+ this.#applyAutoResize(isShrinkingContent);
14901
14955
  }
14902
14956
  if (!isPrevCursorEnd) {
14903
- this.#$input.setSelectionRange(this.#cursorPos, this.#cursorPos);
14957
+ const growing = nextVal.length >= prevVal.length;
14958
+ const rawCaret = growing ? this.#pendingPostInputCaret ?? prevCursorPos ?? this.#cursorPos ?? 0 : this.#cursorPos ?? prevCursorPos ?? 0;
14959
+ const caret = Math.min(Math.max(rawCaret, 0), nextVal.length);
14960
+ this.#$input.setSelectionRange(caret, caret);
14904
14961
  }
14905
14962
  }
14963
+ this.#pendingPostInputCaret = null;
14906
14964
  break;
14907
14965
  }
14908
14966
  case "placeholder": {
@@ -15081,34 +15139,49 @@ class Textarea extends NectaryElement {
15081
15139
  this.#$input.style.setProperty("min-height", `${getRect(this.#$input).height}px`);
15082
15140
  this.#$input.rows = this.rows;
15083
15141
  }
15084
- #onCompositionStart = () => {
15085
- this.#isPendingDk = true;
15086
- };
15087
15142
  #onSelectionChange = () => {
15088
15143
  this.#cursorPos = this.#$input.selectionEnd;
15089
15144
  };
15145
+ #applyAutoResize(isShrinkingContent) {
15146
+ if (isShrinkingContent) {
15147
+ this.#$input.style.removeProperty("height");
15148
+ }
15149
+ const nextContentHeight = this.#$input.scrollHeight;
15150
+ if (isShrinkingContent || nextContentHeight !== this.#prevContentHeight) {
15151
+ this.#prevContentHeight = nextContentHeight;
15152
+ this.#$input.style.setProperty("height", `${this.#prevContentHeight}px`);
15153
+ }
15154
+ }
15090
15155
  #onInput = (e) => {
15091
15156
  e.stopPropagation();
15092
15157
  const nextValue = this.#$input.value;
15093
15158
  const prevValue = this.value;
15159
+ const priorForResize = this.#lastValueForAutoResize;
15160
+ const isShrinkingContent = priorForResize !== void 0 && nextValue.length < priorForResize.length;
15094
15161
  setFormValue(this.#internals, nextValue);
15162
+ if (!this.resizable) {
15163
+ this.#applyAutoResize(isShrinkingContent);
15164
+ }
15165
+ this.#lastValueForAutoResize = nextValue;
15095
15166
  if (prevValue !== nextValue) {
15096
- const nextCursorPos = this.#$input.selectionEnd;
15097
- if (!this.#isPendingDk) {
15098
- this.#$input.value = prevValue;
15099
- const prevCursorPos = this.#cursorPos;
15100
- const isPrevCursorEnd = prevCursorPos === null || prevCursorPos === prevValue.length;
15101
- if (!isPrevCursorEnd) {
15102
- this.#$input.setSelectionRange(prevCursorPos, prevCursorPos);
15103
- }
15167
+ const postInputCaret = this.#$input.selectionEnd;
15168
+ if (postInputCaret !== null) {
15169
+ this.#pendingPostInputCaret = postInputCaret;
15104
15170
  }
15105
- this.#isPendingDk = false;
15106
- this.#cursorPos = nextCursorPos;
15107
15171
  this.dispatchEvent(
15108
15172
  new CustomEvent("-change", {
15109
15173
  detail: nextValue
15110
15174
  })
15111
15175
  );
15176
+ queueMicrotask(() => {
15177
+ if (!this.isConnected) {
15178
+ return;
15179
+ }
15180
+ const end = this.#$input.selectionEnd;
15181
+ if (end !== null) {
15182
+ this.#cursorPos = end;
15183
+ }
15184
+ });
15112
15185
  }
15113
15186
  };
15114
15187
  #onDragStart = (e) => {
@@ -14,7 +14,15 @@ class ButtonGroupItem extends NectaryElement {
14
14
  this.#$sinchButton = shadowRoot.querySelector("#sinch-button-element");
15
15
  }
16
16
  static get observedAttributes() {
17
- return ["type", "size", "text", "disabled", "toggled"];
17
+ return [
18
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set type
19
+ "type",
20
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set size
21
+ "size",
22
+ "text",
23
+ "disabled",
24
+ "toggled"
25
+ ];
18
26
  }
19
27
  attributeChangedCallback(name, oldVal, newVal) {
20
28
  updateAttribute(this.#$sinchButton, name, newVal);
package/card-v2/index.js CHANGED
@@ -92,7 +92,12 @@ class CardV2 extends NectaryElement {
92
92
  }
93
93
  }
94
94
  static get observedAttributes() {
95
- return ["clickable", "disabled", "selected"];
95
+ return [
96
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: clickable missing set/get pair
97
+ "clickable",
98
+ "disabled",
99
+ "selected"
100
+ ];
96
101
  }
97
102
  attributeChangedCallback(name, _oldVal, newVal) {
98
103
  switch (name) {
@@ -95,7 +95,9 @@ class DatePicker extends NectaryElement {
95
95
  "max",
96
96
  "locale",
97
97
  "range",
98
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set prevYearAriaLabel
98
99
  "prev-year-aria-label",
100
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set nextYearAriaLabel
99
101
  "next-year-aria-label",
100
102
  "prev-month-aria-label",
101
103
  "next-month-aria-label"
package/dialog/index.js CHANGED
@@ -68,6 +68,7 @@ class Dialog extends NectaryElement {
68
68
  return [
69
69
  "caption",
70
70
  "open",
71
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set closeAriaLabel
71
72
  "close-aria-label",
72
73
  "hide-close-button",
73
74
  "prevent-close"
package/input/index.js CHANGED
@@ -173,18 +173,24 @@ class Input extends NectaryElement {
173
173
  "value",
174
174
  "placeholder",
175
175
  "mask",
176
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set max
176
177
  "max",
178
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set min
177
179
  "min",
178
180
  "invalid",
179
181
  "disabled",
180
182
  "size",
183
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set step
181
184
  "step",
182
185
  "autocomplete",
186
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set readonly
183
187
  "readonly",
184
188
  "autofocus",
185
189
  "data-size",
186
190
  "aria-label",
191
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set maxlength
187
192
  "maxlength",
193
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set required
188
194
  "required"
189
195
  ];
190
196
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nectary/components",
3
- "version": "5.34.0",
3
+ "version": "5.36.0",
4
4
  "files": [
5
5
  "**/*/*.css",
6
6
  "**/*/*.json",
@@ -113,8 +113,11 @@ class SelectMenu extends NectaryElement {
113
113
  "rows",
114
114
  "multiple",
115
115
  "searchable",
116
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set searchValue
116
117
  "search-value",
118
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set searchPlaceholder
117
119
  "search-placeholder",
120
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set searchAutocomplete
118
121
  "search-autocomplete"
119
122
  ];
120
123
  }
@@ -33,7 +33,12 @@ class SheetTitle extends NectaryElement {
33
33
  this.#controller = null;
34
34
  }
35
35
  static get observedAttributes() {
36
- return ["title", "description", "close-aria-label"];
36
+ return [
37
+ "title",
38
+ "description",
39
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: close-aria-label missing set/get pair
40
+ "close-aria-label"
41
+ ];
37
42
  }
38
43
  attributeChangedCallback(name, oldVal, newVal) {
39
44
  if (isAttrEqual(oldVal, newVal)) {
package/skeleton/index.js CHANGED
@@ -59,7 +59,10 @@ class Skeleton extends NectaryElement {
59
59
  this.#observer = null;
60
60
  }
61
61
  static get observedAttributes() {
62
- return ["card"];
62
+ return [
63
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: card missing set/get pair
64
+ "card"
65
+ ];
63
66
  }
64
67
  attributeChangedCallback(name, _oldVal, newVal) {
65
68
  if (name === "card") {
package/textarea/index.js CHANGED
@@ -14,10 +14,11 @@ class Textarea extends NectaryElement {
14
14
  #$bottomWrapper;
15
15
  #$resizeHandle;
16
16
  #cursorPos = null;
17
- #isPendingDk = false;
17
+ #pendingPostInputCaret = null;
18
18
  #controller = null;
19
19
  #sizeContext;
20
20
  #prevContentHeight = 0;
21
+ #lastValueForAutoResize;
21
22
  #dragStartY = 0;
22
23
  #intersectionObserver = null;
23
24
  #internals;
@@ -44,7 +45,6 @@ class Textarea extends NectaryElement {
44
45
  this.ariaMultiLine = "true";
45
46
  this.#internals.ariaMultiLine = "true";
46
47
  this.#$input.addEventListener("input", this.#onInput, options);
47
- this.#$input.addEventListener("compositionstart", this.#onCompositionStart, options);
48
48
  this.#$input.addEventListener("mousedown", this.#onSelectionChange, options);
49
49
  this.#$input.addEventListener("keydown", this.#onSelectionChange, options);
50
50
  this.#$input.addEventListener("focus", this.#onInputFocus, options);
@@ -58,6 +58,7 @@ class Textarea extends NectaryElement {
58
58
  this.#onBottomSlotChange();
59
59
  this.#updateMinRows();
60
60
  this.#updateMaxRows();
61
+ this.#lastValueForAutoResize = this.#$input.value;
61
62
  this.#onSizeUpdate();
62
63
  }
63
64
  disconnectedCallback() {
@@ -75,6 +76,10 @@ class Textarea extends NectaryElement {
75
76
  formResetCallback() {
76
77
  this.#$input.value = "";
77
78
  setFormValue(this.#internals, "");
79
+ this.#lastValueForAutoResize = "";
80
+ if (!this.resizable) {
81
+ this.#applyAutoResize(true);
82
+ }
78
83
  }
79
84
  formStateRestoreCallback(state) {
80
85
  if (this.#internals.form === null || getBooleanAttribute(this.#internals.form, "data-form-state-restore") === false) {
@@ -82,8 +87,14 @@ class Textarea extends NectaryElement {
82
87
  }
83
88
  if (state !== null) {
84
89
  const value = typeof state === "string" ? state : state.get(this.name);
85
- this.#$input.value = value?.toString() ?? "";
86
- setFormValue(this.#internals, value?.toString() ?? "");
90
+ const next = value?.toString() ?? "";
91
+ const prevLen = this.#$input.value.length;
92
+ this.#$input.value = next;
93
+ setFormValue(this.#internals, next);
94
+ this.#lastValueForAutoResize = next;
95
+ if (!this.resizable) {
96
+ this.#applyAutoResize(next.length < prevLen);
97
+ }
87
98
  }
88
99
  }
89
100
  static get observedAttributes() {
@@ -108,20 +119,18 @@ class Textarea extends NectaryElement {
108
119
  const isShrinkingContent = nextVal.length < prevVal.length;
109
120
  this.#$input.value = nextVal;
110
121
  setFormValue(this.#internals, nextVal);
122
+ this.#lastValueForAutoResize = nextVal;
111
123
  if (!this.resizable) {
112
- if (isShrinkingContent) {
113
- this.#$input.style.removeProperty("height");
114
- }
115
- const nextContentHeight = this.#$input.scrollHeight;
116
- if (isShrinkingContent || nextContentHeight !== this.#prevContentHeight) {
117
- this.#prevContentHeight = nextContentHeight;
118
- this.#$input.style.setProperty("height", `${this.#prevContentHeight}px`);
119
- }
124
+ this.#applyAutoResize(isShrinkingContent);
120
125
  }
121
126
  if (!isPrevCursorEnd) {
122
- this.#$input.setSelectionRange(this.#cursorPos, this.#cursorPos);
127
+ const growing = nextVal.length >= prevVal.length;
128
+ const rawCaret = growing ? this.#pendingPostInputCaret ?? prevCursorPos ?? this.#cursorPos ?? 0 : this.#cursorPos ?? prevCursorPos ?? 0;
129
+ const caret = Math.min(Math.max(rawCaret, 0), nextVal.length);
130
+ this.#$input.setSelectionRange(caret, caret);
123
131
  }
124
132
  }
133
+ this.#pendingPostInputCaret = null;
125
134
  break;
126
135
  }
127
136
  case "placeholder": {
@@ -300,34 +309,49 @@ class Textarea extends NectaryElement {
300
309
  this.#$input.style.setProperty("min-height", `${getRect(this.#$input).height}px`);
301
310
  this.#$input.rows = this.rows;
302
311
  }
303
- #onCompositionStart = () => {
304
- this.#isPendingDk = true;
305
- };
306
312
  #onSelectionChange = () => {
307
313
  this.#cursorPos = this.#$input.selectionEnd;
308
314
  };
315
+ #applyAutoResize(isShrinkingContent) {
316
+ if (isShrinkingContent) {
317
+ this.#$input.style.removeProperty("height");
318
+ }
319
+ const nextContentHeight = this.#$input.scrollHeight;
320
+ if (isShrinkingContent || nextContentHeight !== this.#prevContentHeight) {
321
+ this.#prevContentHeight = nextContentHeight;
322
+ this.#$input.style.setProperty("height", `${this.#prevContentHeight}px`);
323
+ }
324
+ }
309
325
  #onInput = (e) => {
310
326
  e.stopPropagation();
311
327
  const nextValue = this.#$input.value;
312
328
  const prevValue = this.value;
329
+ const priorForResize = this.#lastValueForAutoResize;
330
+ const isShrinkingContent = priorForResize !== void 0 && nextValue.length < priorForResize.length;
313
331
  setFormValue(this.#internals, nextValue);
332
+ if (!this.resizable) {
333
+ this.#applyAutoResize(isShrinkingContent);
334
+ }
335
+ this.#lastValueForAutoResize = nextValue;
314
336
  if (prevValue !== nextValue) {
315
- const nextCursorPos = this.#$input.selectionEnd;
316
- if (!this.#isPendingDk) {
317
- this.#$input.value = prevValue;
318
- const prevCursorPos = this.#cursorPos;
319
- const isPrevCursorEnd = prevCursorPos === null || prevCursorPos === prevValue.length;
320
- if (!isPrevCursorEnd) {
321
- this.#$input.setSelectionRange(prevCursorPos, prevCursorPos);
322
- }
337
+ const postInputCaret = this.#$input.selectionEnd;
338
+ if (postInputCaret !== null) {
339
+ this.#pendingPostInputCaret = postInputCaret;
323
340
  }
324
- this.#isPendingDk = false;
325
- this.#cursorPos = nextCursorPos;
326
341
  this.dispatchEvent(
327
342
  new CustomEvent("-change", {
328
343
  detail: nextValue
329
344
  })
330
345
  );
346
+ queueMicrotask(() => {
347
+ if (!this.isConnected) {
348
+ return;
349
+ }
350
+ const end = this.#$input.selectionEnd;
351
+ if (end !== null) {
352
+ this.#cursorPos = end;
353
+ }
354
+ });
331
355
  }
332
356
  };
333
357
  #onDragStart = (e) => {
package/title/index.js CHANGED
@@ -16,7 +16,12 @@ class Title extends NectaryElement {
16
16
  this.setAttribute("role", "heading");
17
17
  }
18
18
  static get observedAttributes() {
19
- return ["text", "level", "ellipsis"];
19
+ return [
20
+ "text",
21
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: level missing set/get pair
22
+ "level",
23
+ "ellipsis"
24
+ ];
20
25
  }
21
26
  attributeChangedCallback(name, oldVal, newVal) {
22
27
  switch (name) {
package/tooltip/index.js CHANGED
@@ -111,14 +111,18 @@ class Tooltip extends NectaryElement {
111
111
  }
112
112
  static get observedAttributes() {
113
113
  return [
114
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set isOpened
114
115
  "is-opened",
115
116
  "text",
116
117
  "orientation",
118
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set textAlign
117
119
  "text-align",
118
120
  "type",
119
121
  "aria-label",
120
122
  "aria-description",
123
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: getter exists but missing set showOutsideViewport
121
124
  "show-outside-viewport",
125
+ // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set allowScroll
122
126
  "allow-scroll"
123
127
  ];
124
128
  }