@carbonid1/design-system 5.10.0 → 5.10.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.
@@ -19,6 +19,7 @@ const EMPTY_VISIBLE_MESSAGE_IDS = [];
19
19
  const DEFAULT_STATUS = {
20
20
  canScrollToBottom: false,
21
21
  canScrollToTop: false,
22
+ hasScrollSpacer: false,
22
23
  isAtBottom: true,
23
24
  isAtTop: true,
24
25
  };
@@ -48,6 +49,7 @@ function createStore(initialSnapshot, isEqual) {
48
49
  function areStatusSnapshotsEqual(currentSnapshot, nextSnapshot) {
49
50
  return (currentSnapshot.canScrollToBottom === nextSnapshot.canScrollToBottom &&
50
51
  currentSnapshot.canScrollToTop === nextSnapshot.canScrollToTop &&
52
+ currentSnapshot.hasScrollSpacer === nextSnapshot.hasScrollSpacer &&
51
53
  currentSnapshot.isAtBottom === nextSnapshot.isAtBottom &&
52
54
  currentSnapshot.isAtTop === nextSnapshot.isAtTop);
53
55
  }
@@ -150,6 +152,15 @@ function getGap(element) {
150
152
  const parsedGap = Number.parseFloat(gap);
151
153
  return Number.isFinite(parsedGap) ? parsedGap : 0;
152
154
  }
155
+ function getContentChangeSignature(contentElement, spacerElement) {
156
+ if (!contentElement) {
157
+ return '';
158
+ }
159
+ return Array.from(contentElement.children)
160
+ .filter((child) => child instanceof HTMLElement && child !== spacerElement)
161
+ .map(element => `${element.dataset.messageId ?? ''}:${element.dataset.scrollAnchor ?? ''}`)
162
+ .join('\n');
163
+ }
153
164
  function useMessageScrollerContext(callerName) {
154
165
  const context = useContext(MessageScrollerContext);
155
166
  if (!context) {
@@ -231,6 +242,7 @@ function useMessageScrollerEngine({ autoFollow, defaultScrollPosition, scrollEdg
231
242
  return {
232
243
  canScrollToBottom,
233
244
  canScrollToTop,
245
+ hasScrollSpacer: spacerHeightRef.current > 0,
234
246
  isAtBottom: !canScrollToBottom,
235
247
  isAtTop: !canScrollToTop,
236
248
  };
@@ -817,15 +829,24 @@ function MessageScrollerViewport({ 'aria-label': ariaLabel, children, className,
817
829
  function MessageScrollerContent({ 'aria-relevant': ariaRelevant, children, className, ref, role, spacerClassName, ...props }) {
818
830
  const { handleContentChange, handleResize, setContentElement, setSpacerElement } = useMessageScrollerContext('MessageScroller.Content');
819
831
  const contentElementRef = useRef(null);
832
+ const contentSignatureRef = useRef('');
833
+ const spacerElementRef = useRef(null);
820
834
  const handleContentRef = useCallback((element) => {
821
835
  contentElementRef.current = element;
836
+ contentSignatureRef.current = '';
822
837
  setContentElement(element);
823
838
  assignRef(ref, element);
824
839
  }, [ref, setContentElement]);
825
840
  const handleSpacerRef = useCallback((element) => {
841
+ spacerElementRef.current = element;
826
842
  setSpacerElement(element);
827
843
  }, [setSpacerElement]);
828
844
  useLayoutEffect(() => {
845
+ const contentSignature = getContentChangeSignature(contentElementRef.current, spacerElementRef.current);
846
+ if (contentSignature === contentSignatureRef.current) {
847
+ return;
848
+ }
849
+ contentSignatureRef.current = contentSignature;
829
850
  handleContentChange();
830
851
  });
831
852
  useLayoutEffect(() => {
@@ -837,7 +858,12 @@ function MessageScrollerContent({ 'aria-relevant': ariaRelevant, children, class
837
858
  return;
838
859
  }
839
860
  const observer = new MutationObserver(handleContentChange);
840
- observer.observe(contentElement, { childList: true });
861
+ observer.observe(contentElement, {
862
+ attributeFilter: ['data-message-id', 'data-scroll-anchor'],
863
+ attributes: true,
864
+ childList: true,
865
+ subtree: true,
866
+ });
841
867
  return () => observer.disconnect();
842
868
  }, [handleContentChange]);
843
869
  useEffect(() => {
@@ -14,6 +14,7 @@ export type MessageScrollerController = {
14
14
  export type MessageScrollerStatus = {
15
15
  canScrollToBottom: boolean;
16
16
  canScrollToTop: boolean;
17
+ hasScrollSpacer: boolean;
17
18
  isAtBottom: boolean;
18
19
  isAtTop: boolean;
19
20
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carbonid1/design-system",
3
- "version": "5.10.0",
3
+ "version": "5.10.1",
4
4
  "description": "Shared React UI primitives + design tokens (themes, postcss config)",
5
5
  "repository": {
6
6
  "type": "git",
@@ -48,8 +48,12 @@ Use enough sub-variants for depth — don't squeeze a semantic color into just `
48
48
 
49
49
  - **Stories for everything visual** — `Component.stories.tsx`, one story per visual state, each rendering under both palettes × both modes (the `.storybook/preview.ts` toolbar switchers prove it in isolation before shipping). Story-level `.test()` methods for interaction behavior. **Vitest** for non-visual helpers in `src/helpers/`.
50
50
  - **Run the story tests** through the Storybook MCP (`run-story-tests`) in a self-healing loop until interaction + a11y pass.
51
- - **Prove it in a consuming app.** The real proof a change works is a consumer — usually komora — rendering it; a primitive that typechecks can still look wrong under a palette you never opened.
51
+ - **Prove it downstream.** The real proof a change works is at least one app or fixture outside the package rendering it; a primitive that typechecks can still look wrong under a palette you never opened.
52
52
 
53
53
  ## Releasing — how a change reaches consumers
54
54
 
55
- A change is invisible to consumers until it's published. **Write a changeset** (`pnpm changeset`) for the agent who'll adopt the release: lead with what's new and worth using, flag breaking changes, show old → new. `pnpm release` (version → publish to npm → push tags) is a **human laptop step — don't run it.** A consumer then bumps `@carbonid1/design-system`, and its postinstall re-links the shipped skills. So a DS change won't appear in komora until it's both released _and_ komora bumps the dep.
55
+ A package change is invisible outside this repo until it's published. For release-intended package work, the agent owns the complete local release flow: implement, verify, review, write a changeset, run `pnpm release`, and leave the published version available for downstream dependency bumps. Do not stop for a separate publish approval unless the user explicitly asks to pause before release.
56
+
57
+ `pnpm release` is a local agent-run release step, not CI/GitHub automation. It versions packages, publishes to npm, pushes tags, and expects a clean `main`. Run it only for release-ready package work; don't run it for exploratory or unfinished changes.
58
+
59
+ Stop only for real blockers: failing checks, an unexpected major or breaking release, npm auth/2FA prompts, unrelated dirty work, merge conflicts, an unexpected release prompt, or a release script failure. Otherwise publish and continue.