@aparte/core 0.13.0 → 0.13.1

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.
package/dist/index.css CHANGED
@@ -2389,6 +2389,7 @@ aparte-icon {
2389
2389
  */
2390
2390
 
2391
2391
  .aparte-tag {
2392
+ box-sizing: border-box;
2392
2393
  display: inline-flex;
2393
2394
  align-items: center;
2394
2395
  gap: var(--aparte-tag-gap);
@@ -3167,6 +3168,7 @@ aparte-icon {
3167
3168
  reset a button does: no native chrome, full width, cursor and text alignment
3168
3169
  fixed for a header that reads left-to-right of its own toggle icon. */
3169
3170
  .aparte-accordion__header {
3171
+ box-sizing: border-box;
3170
3172
  display: flex;
3171
3173
  align-items: center;
3172
3174
  justify-content: space-between;
@@ -3296,6 +3298,16 @@ details[open] > .aparte-accordion__header .aparte-accordion__icon {
3296
3298
  }
3297
3299
 
3298
3300
  .aparte-menu__item {
3301
+ /* Its own width plus its own padding, because core is light DOM: a host that
3302
+ never wrote `* { box-sizing: border-box }` is not a broken host, and this rule
3303
+ said `width: 100%` next to a padding. Measured in a frame without a reset: the
3304
+ row came out its parent width PLUS both paddings — 328px inside 308 at one window
3305
+ size — and clipped its last button by the right one. The absolute numbers depend on
3306
+ the window; the 20px of overflow is the padding, whatever the width.
3307
+ Per element, never a `*` selector — the same reason every other box-sizing in
3308
+ these sheets is written on the thing it belongs to. */
3309
+
3310
+ box-sizing: border-box;
3299
3311
  appearance: none;
3300
3312
  -webkit-appearance: none;
3301
3313
  display: flex;
@@ -3592,6 +3604,7 @@ aparte-select[open] .aparte-select-chevron {
3592
3604
 
3593
3605
  /* Search */
3594
3606
  .aparte-select-search {
3607
+ box-sizing: border-box;
3595
3608
  display: block;
3596
3609
  width: 100%;
3597
3610
  padding: var(--aparte-space-4) var(--aparte-space-6);
@@ -4106,6 +4119,7 @@ aparte-chat-bubble {
4106
4119
  }
4107
4120
 
4108
4121
  .aparte-message {
4122
+ box-sizing: border-box;
4109
4123
  display: flex;
4110
4124
  gap: var(--aparte-message-gap);
4111
4125
  padding: var(--aparte-message-padding);
@@ -4542,6 +4556,7 @@ aparte-chat-viewport.aparte-viewport--framework::-webkit-scrollbar-thumb {
4542
4556
  }
4543
4557
 
4544
4558
  .aparte-editor {
4559
+ box-sizing: border-box;
4545
4560
  width: 100%;
4546
4561
  max-height: var(--aparte-input-editor-max-height);
4547
4562
  /* Matches _maxHeight default */
@@ -5948,10 +5963,18 @@ textarea.aparte-elic-text {
5948
5963
  width: var(--aparte-conv-action-btn-size);
5949
5964
  height: var(--aparte-conv-action-btn-size);
5950
5965
  color: var(--aparte-conv-delete-color);
5966
+ /* DECLARED, not out-specified. `.aparte-btn:hover:not(:disabled)` weighs 0,3,0 and
5967
+ `.aparte-conv-item__delete:hover` only 0,2,0, so the recipe won the background and
5968
+ this button's red never applied — while the `color` below DID, because the recipe's
5969
+ hover rule sets no colour. The result was the ink for a solid red fill painted on a
5970
+ neutral surface: 1.17:1 in the light theme, 1.20 in the dark, measured in a browser.
5971
+ The cross was invisible in both. Feeding the recipe its own token is the rule this
5972
+ file's neighbours already follow, and it makes the pair agree again — 3.70 and 4.84,
5973
+ both clear of the 3:1 a graphical object needs. */
5974
+ --aparte-btn-bg-hover: var(--aparte-conv-delete-bg-hover);
5951
5975
  }
5952
5976
 
5953
5977
  .aparte-conv-item__delete:hover {
5954
- background: var(--aparte-conv-delete-bg-hover);
5955
5978
  color: var(--aparte-conv-delete-color-hover);
5956
5979
  }
5957
5980
 
@@ -5961,10 +5984,12 @@ textarea.aparte-elic-text {
5961
5984
  width: var(--aparte-conv-action-btn-size);
5962
5985
  height: var(--aparte-conv-action-btn-size);
5963
5986
  color: var(--aparte-conv-archive-color, var(--aparte-text-muted));
5987
+ /* Same reason as the delete button above: the recipe out-weighs a plain `:hover` here,
5988
+ so this surface has to be declared as its token or it never applies. */
5989
+ --aparte-btn-bg-hover: var(--aparte-conv-archive-bg-hover, var(--aparte-surface-4, var(--aparte-surface-3)));
5964
5990
  }
5965
5991
 
5966
5992
  .aparte-conv-item__archive:hover {
5967
- background: var(--aparte-conv-archive-bg-hover, var(--aparte-surface-4, var(--aparte-surface-3)));
5968
5993
  color: var(--aparte-conv-archive-color-hover, var(--aparte-text));
5969
5994
  }
5970
5995
 
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { $ as resolveConfig, a4 as subscribeConfigChange, a1 as runWithConfig, p as AparteElicitationAbortError, x as buildApprovalPanel, y as buildElicitationPanel, K as escapeAttr, F as cssEscape, a7 as mergeSegmentUpdate, L as escapeHtml, a8 as writeStreamedMarkdown, O as getSegmentRenderer, P as installDefaultRenderersOnce, s as AparteMessageRepository, a9 as stampSegmentActivity, aa as stampSegmentOnInsert, ab as stampSegmentOnUpdate, ac as renumberSegments, ad as openSegmentIds, ae as isTerminalStatus, af as adoptMessageSegments, Q as isAwaitingReply, W as populateBubbleFromMessage, a6 as uuid, a0 as revokeAttachmentUrls } from "./is-awaiting-reply-DrO_oR32.js";
2
- import { A, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, q, r, t, u, v, w, z, B, C, D, E, G, H, I, J, M, N, R, S, T, U, V, X, Y, Z, _, a2, a3, a5 } from "./is-awaiting-reply-DrO_oR32.js";
1
+ import { $ as resolveConfig, a4 as subscribeConfigChange, a1 as runWithConfig, p as AparteElicitationAbortError, x as buildApprovalPanel, y as buildElicitationPanel, K as escapeAttr, F as cssEscape, a7 as mergeSegmentUpdate, L as escapeHtml, a8 as writeStreamedMarkdown, O as getSegmentRenderer, P as installDefaultRenderersOnce, s as AparteMessageRepository, a9 as stampSegmentActivity, aa as stampSegmentOnInsert, ab as stampSegmentOnUpdate, ac as renumberSegments, ad as openSegmentIds, ae as isTerminalStatus, af as adoptMessageSegments, Q as isAwaitingReply, W as populateBubbleFromMessage, a6 as uuid, a0 as revokeAttachmentUrls } from "./is-awaiting-reply-CWp1ffHh.js";
2
+ import { A, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, q, r, t, u, v, w, z, B, C, D, E, G, H, I, J, M, N, R, S, T, U, V, X, Y, Z, _, a2, a3, a5 } from "./is-awaiting-reply-CWp1ffHh.js";
3
3
  class AparteOption extends HTMLElement {
4
4
  static get observedAttributes() {
5
5
  return ["value", "disabled", "selected", "data-status"];
@@ -731,11 +731,17 @@ class AparteElicitation extends HTMLElement {
731
731
  return new Promise((resolve, reject) => {
732
732
  let done = false;
733
733
  const slot = {};
734
+ const focusedBefore = document.activeElement;
734
735
  const close = () => {
735
736
  if (done) return false;
736
737
  done = true;
737
738
  this._pending = null;
739
+ const active = document.activeElement;
740
+ const focusWasInPanel = active instanceof Node && composer.contains(active);
738
741
  composer.hidePanel(slot.token);
742
+ if (focusWasInPanel && focusedBefore instanceof HTMLElement && focusedBefore.isConnected) {
743
+ focusedBefore.focus();
744
+ }
739
745
  return true;
740
746
  };
741
747
  const settle = (result) => {
@@ -2152,6 +2158,8 @@ class AparteChatViewport extends HTMLElement {
2152
2158
  _layoutTransitionMs = 0;
2153
2159
  _repo = new AparteMessageRepository();
2154
2160
  _isAutoScrollEnabled = true;
2161
+ /** The last scroll position we saw, so growth can be told from a gesture. */
2162
+ _lastScrollTop = 0;
2155
2163
  _scrollThreshold = 50;
2156
2164
  /** When true, the next _autoScroll() call uses smooth instead of instant, then resets. */
2157
2165
  _smoothScrollOnce = false;
@@ -2989,6 +2997,7 @@ class AparteChatViewport extends HTMLElement {
2989
2997
  this._scrollToBottom();
2990
2998
  }
2991
2999
  this._recalculateSpacer();
3000
+ this._updateScrollButton();
2992
3001
  });
2993
3002
  const wrapper = this.querySelector(".aparte-messages-wrapper");
2994
3003
  if (this._container) {
@@ -3021,7 +3030,14 @@ class AparteChatViewport extends HTMLElement {
3021
3030
  }
3022
3031
  _handleScroll() {
3023
3032
  if (!this._container) return;
3024
- this._isAutoScrollEnabled = this._isAtBottom();
3033
+ const top = this._container.scrollTop;
3034
+ const readerWentUp = top < this._lastScrollTop - 1;
3035
+ this._lastScrollTop = top;
3036
+ if (this._isAtBottom()) {
3037
+ this._isAutoScrollEnabled = true;
3038
+ } else if (readerWentUp) {
3039
+ this._isAutoScrollEnabled = false;
3040
+ }
3025
3041
  this._updateScrollButton();
3026
3042
  }
3027
3043
  _scrollToBottom() {