@mt-gloss/ui 0.1.44 → 0.1.46

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.
@@ -27,5 +27,10 @@ export interface SectionDotsProps {
27
27
  pulseIndex?: number;
28
28
  /** Phase 4 D-10 — monotonically-increasing nonce; bump to replay the pulse keyframe. */
29
29
  pulseNonce?: number;
30
+ /** Phase 12 D-09 — caller's currently-anchored section. Preferred over currentIndex. */
31
+ currentSection?: number;
32
+ /** Phase 12 D-09 — how many sections fit in viewport at once. Default 1 (preserves v2.0 model). */
33
+ sectionsPerView?: number;
30
34
  }
31
- export declare function SectionDots({ count, currentIndex, onSelect, 'aria-label': ariaLabel, provisionalIndex, pulseIndex, pulseNonce, }: SectionDotsProps): import("react/jsx-runtime").JSX.Element;
35
+ export declare function SectionDots({ count, currentIndex, onSelect, 'aria-label': ariaLabel, provisionalIndex, pulseIndex, pulseNonce, currentSection, // D-08 back-compat shim
36
+ sectionsPerView, }: SectionDotsProps): import("react/jsx-runtime").JSX.Element | null;
@@ -16,6 +16,10 @@ export interface DropAnchorCellProps extends React.HTMLAttributes<HTMLDivElement
16
16
  proximityOpacity?: number;
17
17
  /** Stable cell id for test selectors + future instrumentation. */
18
18
  ['data-cell-id']?: string;
19
+ /** Phase 13 D-07 — 'empty' renders dashed eligibility border via [data-state='empty'].
20
+ * Border PERSISTS during drag/resize (PKG-04 invariant); only affordance GLYPHS hide
21
+ * via useAffordanceVisibility(). The border IS the drop-target affordance. */
22
+ state?: 'empty';
19
23
  children?: React.ReactNode;
20
24
  }
21
25
  /**
@@ -34,4 +38,4 @@ export interface DropAnchorCellProps extends React.HTMLAttributes<HTMLDivElement
34
38
  *
35
39
  * Respects prefers-reduced-motion.
36
40
  */
37
- export declare function DropAnchorCell({ density, canAccept, blocked, proximityOpacity, className, children, ...rest }: DropAnchorCellProps): import("react/jsx-runtime").JSX.Element;
41
+ export declare function DropAnchorCell({ density, canAccept, blocked, proximityOpacity, state, className, children, ...rest }: DropAnchorCellProps): import("react/jsx-runtime").JSX.Element;
@@ -1,21 +1,54 @@
1
1
  import * as React from 'react';
2
2
  /**
3
- * Phase 23EMPTY-PACK-01`[×]` empty-cell pack affordance per D-19 / D-20.
3
+ * Phase 13Track G Add/Remove/Collapse (D-04, D-05, D-06, D-19).
4
4
  *
5
- * Renders a small top-right button on an empty cell that, when clicked, requests
6
- * right-neighbor left-shift via `onPack()`. When `enabled=false` (all cells to
7
- * the right are also empty), the affordance is fully hidden (returns `null`).
5
+ * Hosts BOTH the `+` (add) and `×` (collapse/pack) glyphs on every empty cell.
8
6
  *
9
- * stopPropagation() on the button prevents the click from bubbling to the parent
10
- * DropAnchorCell's onClick (which opens the MetricCatalog). Without it, clicking
11
- * "×" would pack AND open the catalog simultaneously.
7
+ * **D-04 host-primitive count vs SwingReveal-JSX count clarification**
8
+ * (recorded per Phase 13 revision iteration 1 checker WARNING):
9
+ *
10
+ * D-04 in CONTEXT.md reads "Single SwingReveal wrapper". Functionally that
11
+ * refers to the single host primitive (`EmptyCellPackAffordance`) wrapping
12
+ * both glyphs as flat siblings — i.e., one host component owns the empty-cell
13
+ * chrome. The implementation uses TWO `<SwingReveal>` JSX wrappers (one per
14
+ * glyph) because D-19 requires INDEPENDENT visibility gating: the `+` glyph
15
+ * is always visible (`visible={true}`) while the `×` glyph is D-19-gated
16
+ * (`visible={enabled}`). A single `<SwingReveal>` cannot express two
17
+ * independent `visible` props on its children, so the two-wrapper shape IS
18
+ * the correct realization of D-04's functional intent. Host-primitive count
19
+ * = 1; SwingReveal JSX count = 2 for D-19 independent gating.
20
+ *
21
+ * `stopPropagation()` on each glyph button prevents the click from bubbling
22
+ * to the parent DropAnchorCell's `onClick` (which opens the MetricCatalog).
23
+ * Without it, clicking a glyph would pack/add AND open the catalog
24
+ * simultaneously.
25
+ *
26
+ * PKG-04 hide-during-drag is NOT implemented in this primitive — it is
27
+ * deferred to Phase 12 (Track D — AFF-01) via the `useAffordanceVisibility()`
28
+ * hook seam declared in `../hooks/useAffordanceVisibility.ts`. Phase 13 ships
29
+ * the seam with a `{ affordancesVisible: true }` stub; Phase 12 fills the
30
+ * gridChannels-driven implementation. Until then, glyphs remain visible
31
+ * during drag/resize — Phase 13's UAT scenarios for hide-during-drag verify
32
+ * the seam exists but cannot exercise the gate behaviour.
33
+ *
34
+ * @see .planning/phases/13-track-g-add-remove-collapse/13-CONTEXT.md §D-04, §D-06, §D-10, §D-18
12
35
  */
13
36
  export interface EmptyCellPackAffordanceProps {
14
- /** D-19 hide when all cells to the right are also empty. Consumer decides. */
37
+ /** D-19 gate for × glyph only. + is always visible regardless. */
15
38
  enabled: boolean;
16
- onPack: () => void;
17
- ariaLabel?: string;
39
+ /** D-04 — × click handler. Renamed from onPack for D-04 / UI-SPEC alignment. */
40
+ onCollapse?: () => void;
41
+ /** D-04 — + click handler. Always-visible glyph; clicking opens catalog. */
42
+ onAdd?: () => void;
43
+ /** Default: 'Add card to this cell' */
44
+ addGlyphLabel?: string;
45
+ /** Default: 'Pack row — shift cards left' */
46
+ collapseGlyphLabel?: string;
18
47
  className?: string;
19
48
  style?: React.CSSProperties;
49
+ /** @deprecated Use onCollapse. Maintained for one minor cycle. */
50
+ onPack?: () => void;
51
+ /** @deprecated Use collapseGlyphLabel. Maintained for one minor cycle. */
52
+ ariaLabel?: string;
20
53
  }
21
- export declare function EmptyCellPackAffordance({ enabled, onPack, ariaLabel, className, style, }: EmptyCellPackAffordanceProps): import("react/jsx-runtime").JSX.Element;
54
+ export declare function EmptyCellPackAffordance({ enabled, onCollapse, onAdd, addGlyphLabel, collapseGlyphLabel, className, style, onPack, ariaLabel, }: EmptyCellPackAffordanceProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,49 @@
1
+ import { LifecycleState } from '../gridChannels';
2
+ import * as React from 'react';
3
+ /**
4
+ * Discriminator for the in-flight gesture (D-03).
5
+ * `null` when no gesture is active.
6
+ */
7
+ export type GestureType = 'drag' | 'resize' | null;
8
+ /**
9
+ * Read-only snapshot of the grid's gesture lifecycle, exposed to primitives that
10
+ * must short-circuit BEHAVIOR (not just visuals) during drag or resize (D-03).
11
+ *
12
+ * Per D-02, `isActive` is true iff `lifecycle ∈ ['active', 'settling']`.
13
+ * `arming` does NOT count as active — keeping affordances visible during arming
14
+ * avoids flicker on cancelled gestures.
15
+ */
16
+ export interface GestureState {
17
+ /** True when a gesture is in `active` or `settling` lifecycle (D-02). */
18
+ isActive: boolean;
19
+ /** Which gesture is in flight, or `null` when idle. */
20
+ type: GestureType;
21
+ /** Discrete lifecycle state from Phase 9 `gridChannels.LifecycleState`. */
22
+ lifecycle: LifecycleState;
23
+ }
24
+ export interface GestureStateProviderProps {
25
+ value: GestureState;
26
+ children: React.ReactNode;
27
+ }
28
+ /**
29
+ * Context provider for grid gesture lifecycle (D-03 hybrid pattern, gloss half).
30
+ *
31
+ * Mounted once in the grid root (reptime `MetricCardGrid.tsx` for v3.1).
32
+ * Wraps children with no DOM element of its own — preserves the
33
+ * `display: contents` chain at MetricCardGrid.tsx:2740.
34
+ */
35
+ export declare function GestureStateProvider({ value, children }: GestureStateProviderProps): import("react/jsx-runtime").JSX.Element;
36
+ /**
37
+ * Read the active gesture lifecycle from the grid root.
38
+ *
39
+ * Returns `{ isActive: false, type: null, lifecycle: 'idle' }` when no provider
40
+ * is mounted (graceful default — primitives outside a grid still render normally).
41
+ *
42
+ * **Cross-phase contract (Phase 12 D-03 — DO NOT collapse to a single boolean):**
43
+ * - Phase 13 PKG-04 consumes `type === 'drag'` to no-op `+`/`×` click handlers.
44
+ * - The richer shape `{ isActive, type, lifecycle }` future-proofs downstream
45
+ * consumers that need lifecycle granularity (e.g., distinguishing 'settling').
46
+ *
47
+ * @see .planning/phases/12-track-de-affordance-section-nav/12-CONTEXT.md D-03
48
+ */
49
+ export declare function useGestureState(): GestureState;
@@ -0,0 +1 @@
1
+ export * from './GestureStateProvider';
@@ -0,0 +1,28 @@
1
+ /**
2
+ * useAffordanceVisibility — Phase 13 D-10 / D-18 contract section 3.
3
+ *
4
+ * Returns the visibility flag for empty-cell affordance glyphs (+ and ×) during
5
+ * drag/resize gestures (PKG-04 hide-on-active rule).
6
+ *
7
+ * **Phase 13 ships a stub** that returns `{ affordancesVisible: true }` unconditionally.
8
+ * **Phase 12 fills the real implementation** when its affordance state machine ships
9
+ * (Track D — AFF-01). The contract Phase 12 must honor:
10
+ *
11
+ * - Read gridChannels lifecycle state for the `chrome` channel.
12
+ * - Return `{ affordancesVisible: true }` when LifecycleState ∈ ['idle', 'arming']
13
+ * (matches `gridChannels.chrome.applicableStates`).
14
+ * - Return `{ affordancesVisible: false }` when LifecycleState === 'active' or 'settling'
15
+ * (matches `gridChannels.hideOnActive.applicableStates`).
16
+ *
17
+ * The DropAnchorCell `state='empty'` dashed border is NOT gated by this hook —
18
+ * the border persists during drag/resize because it IS the drop-target affordance
19
+ * (D-07 critical invariant).
20
+ *
21
+ * @see .planning/phases/13-track-g-add-remove-collapse/13-CONTEXT.md §D-10, §D-18
22
+ * @see .planning/phases/09-track-a-gev-foundation/HANDOFF.json#contracts.channels (chrome, hideOnActive)
23
+ */
24
+ export interface UseAffordanceVisibilityReturn {
25
+ /** true when affordance glyphs (+ and ×) should render; false during drag/resize. */
26
+ affordancesVisible: boolean;
27
+ }
28
+ export declare function useAffordanceVisibility(): UseAffordanceVisibilityReturn;
@@ -13,10 +13,12 @@ export * from './TabbedDataView';
13
13
  export * from './MetricGroupContainer';
14
14
  export * from './DevTuningPanel';
15
15
  export * from './ResizeEnvelope';
16
+ export * from './GestureState';
16
17
  export * from './DropAnchorCell';
17
18
  export * from './SpilloverArc';
18
19
  export * from './SectionDivider';
19
20
  export * from './EmptyCellPackAffordance';
21
+ export * from './hooks/useAffordanceVisibility';
20
22
  export * from './DragGhost';
21
23
  export * from './SnapOutline';
22
24
  export * from './CascadePreview';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mt-gloss/ui",
3
- "version": "0.1.44",
3
+ "version": "0.1.46",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "restricted"