@takazudo/zdtp 0.4.13 → 0.4.15

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.
Files changed (113) hide show
  1. package/CHANGELOG.md +143 -0
  2. package/PORTABLE-CONTRACT.md +366 -94
  3. package/README.md +218 -96
  4. package/dist/apply/build-apply-overrides.d.ts +2 -2
  5. package/dist/apply/compute-hunks.d.ts +23 -0
  6. package/dist/apply/last-applied.d.ts +5 -0
  7. package/dist/apply/reconcile-applied.d.ts +19 -0
  8. package/dist/apply-modal.d.ts +2 -48
  9. package/dist/astro/host-adapter.js +3 -3
  10. package/dist/astro/index.js +2 -2
  11. package/dist/{autoload-state-CfL2VUe1.js → autoload-state-7BQYXI7Y.js} +1 -1
  12. package/dist/bin/server.js +52 -50
  13. package/dist/bulk/bulk-actions.d.ts +45 -0
  14. package/dist/bulk/index.d.ts +2 -0
  15. package/dist/chain/index.d.ts +2 -0
  16. package/dist/chain/token-chain-context.d.ts +19 -0
  17. package/dist/chain/token-chain-popover.d.ts +22 -0
  18. package/dist/changed/contribution.d.ts +32 -0
  19. package/dist/changed/footer-content.d.ts +16 -0
  20. package/dist/changed/index.d.ts +4 -0
  21. package/dist/changed/tab-badge.d.ts +8 -0
  22. package/dist/changed/tab-filter.d.ts +8 -0
  23. package/dist/config/panel-config.d.ts +22 -25
  24. package/dist/controls/actions-menu-popover.d.ts +2 -0
  25. package/dist/controls/role-button.d.ts +5 -2
  26. package/dist/controls/tooltip.d.ts +8 -4
  27. package/dist/element-inspect/element-inspect-context.d.ts +22 -0
  28. package/dist/element-inspect/element-inspect-orchestrator.d.ts +17 -0
  29. package/dist/element-inspect/element-inspect-overlay.d.ts +16 -0
  30. package/dist/element-inspect/element-inspect-toggle-button.d.ts +3 -0
  31. package/dist/element-inspect/element-inspect-view.d.ts +6 -0
  32. package/dist/element-inspect/find-tokens-for-element.d.ts +23 -0
  33. package/dist/element-inspect/index.d.ts +8 -0
  34. package/dist/highlight/find-elements.d.ts +14 -3
  35. package/dist/highlight/highlight-orchestrator.d.ts +7 -3
  36. package/dist/highlight/highlight-state.d.ts +3 -2
  37. package/dist/highlight/highlight-toggle-button.d.ts +3 -0
  38. package/dist/highlight/walk-css-rules.d.ts +2 -0
  39. package/dist/history/buttons.d.ts +28 -0
  40. package/dist/history/index.d.ts +3 -0
  41. package/dist/history/rail.d.ts +13 -0
  42. package/dist/history/snapshots.d.ts +57 -0
  43. package/dist/host/host-mutations.d.ts +23 -0
  44. package/dist/index-BOOmFtJh.js +12165 -0
  45. package/dist/{index-BAY1JOUl.js → index-C2DIYD0d.js} +2 -2
  46. package/dist/index.js +14 -14
  47. package/dist/load-routing-BtCE1hGI.js +547 -0
  48. package/dist/{manifest-DCReQE0k.js → manifest-DvuKi7I4.js} +11 -7
  49. package/dist/{panel-config-COHesW2B.js → panel-config-CRf-ONSV.js} +404 -308
  50. package/dist/picker/alt-click-picker.d.ts +10 -2
  51. package/dist/picker/arming-coordinator.d.ts +2 -0
  52. package/dist/picker/index.d.ts +2 -2
  53. package/dist/search/command-palette.d.ts +21 -0
  54. package/dist/search/contribution.d.ts +7 -0
  55. package/dist/search/fuzzy.d.ts +10 -0
  56. package/dist/search/index.d.ts +4 -0
  57. package/dist/search/match-bar.d.ts +14 -0
  58. package/dist/search/search-header.d.ts +7 -0
  59. package/dist/search/token-search.d.ts +36 -0
  60. package/dist/server/create-apply-handler.d.ts +33 -0
  61. package/dist/server/index.d.ts +2 -1
  62. package/dist/server/index.js +1 -1
  63. package/dist/shell/dock-mode-switch.d.ts +6 -0
  64. package/dist/shell/footer.d.ts +1 -0
  65. package/dist/shell/ghost-idle.d.ts +24 -0
  66. package/dist/shell/header.d.ts +5 -0
  67. package/dist/shell/layer-activity.d.ts +6 -0
  68. package/dist/shell/mini-pill.d.ts +21 -0
  69. package/dist/shell/regions.d.ts +26 -0
  70. package/dist/shell/shortcut-dispatcher.d.ts +17 -0
  71. package/dist/shell/tab-bar.d.ts +17 -0
  72. package/dist/shell/tab-overflow-popover.d.ts +13 -0
  73. package/dist/specimen/on-page-specimen.d.ts +19 -0
  74. package/dist/specimen/preview-glyphs.d.ts +2 -0
  75. package/dist/specimen/specimen-state.d.ts +12 -0
  76. package/dist/specimen/specimen-tab-body.d.ts +18 -0
  77. package/dist/specimen/specimen-toolbar.d.ts +10 -0
  78. package/dist/specimen/specimen-values.d.ts +9 -0
  79. package/dist/state/history.d.ts +64 -0
  80. package/dist/state/persist.d.ts +10 -14
  81. package/dist/state/transaction.d.ts +24 -0
  82. package/dist/state/tweak-state.d.ts +16 -0
  83. package/dist/styles/z-index-tokens.d.ts +2 -0
  84. package/dist/tabs/color-tab.d.ts +10 -1
  85. package/dist/tabs/flat/flat-tab.d.ts +27 -0
  86. package/dist/tabs/flat/index.d.ts +8 -0
  87. package/dist/tabs/flat/scroll-to-token-row.d.ts +3 -0
  88. package/dist/tabs/flat/tier-section.d.ts +17 -0
  89. package/dist/tabs/flat/token-controller.d.ts +23 -0
  90. package/dist/tabs/flat/token-row.d.ts +12 -0
  91. package/dist/tabs/flat/types.d.ts +25 -0
  92. package/dist/tabs/font-tab.d.ts +13 -12
  93. package/dist/tabs/generic-tab.d.ts +8 -38
  94. package/dist/tabs/palette/palette-check-view.d.ts +5 -1
  95. package/dist/tabs/palette/palette-edit-view.d.ts +9 -1
  96. package/dist/tabs/palette/palette-tab.d.ts +12 -1
  97. package/dist/tabs/size-tab.d.ts +7 -10
  98. package/dist/tabs/spacing-tab.d.ts +7 -13
  99. package/dist/testing.js +3 -3
  100. package/dist/tokens/tier-model.d.ts +6 -0
  101. package/dist/{tweak-state-BKNxtHzb.js → tweak-state-BGp_7Tfh.js} +473 -423
  102. package/dist/utils/numeric-transform.d.ts +32 -0
  103. package/dist/utils/token-diff.d.ts +25 -0
  104. package/dist/utils/token-graph.d.ts +23 -0
  105. package/dist/utils/token-index.d.ts +30 -0
  106. package/dist/zdtp.css +1 -1
  107. package/package.json +3 -1
  108. package/dist/controls/pill-slider-row.d.ts +0 -36
  109. package/dist/controls/select-row.d.ts +0 -25
  110. package/dist/controls/slider-row.d.ts +0 -29
  111. package/dist/controls/text-row.d.ts +0 -27
  112. package/dist/index-U7Ol7tgA.js +0 -7591
  113. package/dist/load-routing-D4H2VOl5.js +0 -426
@@ -13,6 +13,8 @@ import type { ComponentChildren, JSX } from 'preact';
13
13
  export interface ActionsMenuAction {
14
14
  label: string;
15
15
  onSelect: () => void;
16
+ disabled?: boolean;
17
+ disabledReason?: string;
16
18
  }
17
19
  interface ActionsMenuPopoverProps {
18
20
  /** The kebab trigger element — excluded from the outside-click close so its
@@ -1,4 +1,4 @@
1
- import type { JSX } from 'preact';
1
+ import type { JSX, Ref } from 'preact';
2
2
  export interface RoleButtonProps {
3
3
  children: JSX.Element | JSX.Element[] | string;
4
4
  onClick: (e: MouseEvent | KeyboardEvent) => void;
@@ -10,8 +10,11 @@ export interface RoleButtonProps {
10
10
  /** Arbitrary extra aria-* props (e.g. aria-haspopup, aria-expanded). */
11
11
  ariaProps?: Record<string, string | boolean | undefined>;
12
12
  tabIndex?: number;
13
+ /** Explicit DOM ref for callers that need to anchor a popover. */
14
+ elementRef?: Ref<HTMLDivElement>;
13
15
  id?: string;
14
16
  title?: string;
15
17
  'aria-label'?: string;
18
+ 'data-testid'?: string;
16
19
  }
17
- export declare function RoleButton({ children, onClick, className, 'aria-disabled': ariaDisabled, ariaProps, tabIndex, id, title, 'aria-label': ariaLabel, }: RoleButtonProps): JSX.Element;
20
+ export declare function RoleButton({ children, onClick, className, 'aria-disabled': ariaDisabled, ariaProps, tabIndex, elementRef, id, title, 'aria-label': ariaLabel, 'data-testid': testId, }: RoleButtonProps): JSX.Element;
@@ -19,10 +19,12 @@ import type { ComponentChildren, JSX } from 'preact';
19
19
  /**
20
20
  * Opt-in tooltip presentation variant. `'help'` applies the wrapped,
21
21
  * bounded-width `.tokenpanel-tooltip--help` class (see panel.css) instead of
22
- * the default single-line `nowrap` tooltip — used by `controls/help-icon.tsx`
22
+ * the default token tooltip — used by `controls/help-icon.tsx`
23
23
  * for the multi-sentence Literal / Per-mode explainer tips.
24
24
  */
25
25
  export type TooltipVariant = 'help';
26
+ /** Opt-in horizontal anchor for triggers whose box is wider than its text. */
27
+ export type TooltipAnchor = 'text';
26
28
  interface TooltipProviderProps {
27
29
  children: ComponentChildren;
28
30
  }
@@ -35,15 +37,17 @@ interface TooltipProviderProps {
35
37
  */
36
38
  export declare function TooltipProvider({ children }: TooltipProviderProps): JSX.Element;
37
39
  export interface UseTooltipOptions {
38
- /** Opt into a presentation variant — see `TooltipVariant` above. Omit for
39
- * the default single-line `nowrap` tooltip. */
40
+ /** Opt into a presentation variant — see `TooltipVariant` above. */
40
41
  variant?: TooltipVariant;
42
+ /** Opt into horizontal centering over the trigger's displayed text area. */
43
+ anchor?: TooltipAnchor;
41
44
  }
42
45
  /**
43
46
  * Returns event handler props to spread onto the tooltip trigger element.
44
47
  *
45
48
  * @param text - The full text to show in the tooltip.
46
- * @param opts - Optional presentation variant (see `UseTooltipOptions`).
49
+ * @param opts - Optional presentation variant and horizontal anchor (see
50
+ * `UseTooltipOptions`).
47
51
  * @returns An object of `onMouseEnter`, `onMouseLeave`, `onFocusIn`, `onFocusOut`
48
52
  * handlers to spread onto the trigger element, plus imperative
49
53
  * `show`/`hide` escape hatches for callers that need to
@@ -0,0 +1,22 @@
1
+ import type { FindTokensForElementResult } from './find-tokens-for-element';
2
+ /** The synthetic tab id used by the transient element-inspect view. */
3
+ export declare const ELEMENT_INSPECT_TAB_ID = "inspect";
4
+ export interface ElementInspectContextValue {
5
+ /** Whether the picker is armed by the header toggle or the `I` shortcut. */
6
+ armed: boolean;
7
+ /** The page element currently pinned for inspection. */
8
+ pinned: Element | null;
9
+ /** Scanner output for the pinned element. */
10
+ result: FindTokensForElementResult | null;
11
+ /** Arm the picker programmatically. */
12
+ arm: () => void;
13
+ /** Disarm the picker without clearing the pinned element. */
14
+ disarm: () => void;
15
+ /** Toggle picker arming. */
16
+ toggle: () => void;
17
+ /** Pin a host element and refresh its token scan. */
18
+ pin: (element: Element) => void;
19
+ /** Clear the pinned element and return to the tab that preceded Inspect. */
20
+ clear: () => void;
21
+ }
22
+ export declare const ElementInspectContext: import("preact").Context<ElementInspectContextValue | null>;
@@ -0,0 +1,17 @@
1
+ import type { ComponentChildren } from 'preact';
2
+ import type { PanelConfig } from '../config/panel-config';
3
+ import type { TweakState } from '../state/tweak-state';
4
+ import type { CommitTweakStateOptions, TweakStateUpdater } from '../state/transaction';
5
+ type CommitTweakState = (reason: string, next: TweakStateUpdater, options?: CommitTweakStateOptions) => void;
6
+ export interface ElementInspectOrchestratorProps {
7
+ children: ComponentChildren;
8
+ instanceConfig: PanelConfig;
9
+ state: TweakState | null;
10
+ commitTweakState: CommitTweakState;
11
+ onInspectTabOpen: () => void;
12
+ onInspectTabClear: () => void;
13
+ onJumpToColorTab?: () => void;
14
+ panelOpen?: boolean;
15
+ }
16
+ export declare function ElementInspectOrchestrator({ children, instanceConfig, state, commitTweakState, onInspectTabOpen, onInspectTabClear, onJumpToColorTab, panelOpen, }: ElementInspectOrchestratorProps): import("preact").JSX.Element;
17
+ export {};
@@ -0,0 +1,16 @@
1
+ import type { JSX } from 'preact';
2
+ /** Body-level mount used by the picker and the pinned inspect marker. */
3
+ export { ELEMENT_INSPECT_PORTAL_MOUNT_ID } from '../highlight/find-elements';
4
+ /** Class hooks shared by the hover picker and the pinned overlay. */
5
+ export declare const ELEMENT_INSPECT_PICKER_CLASS_NAMES: {
6
+ readonly box: "tokenpanel-element-inspect-box";
7
+ readonly label: "tokenpanel-element-inspect-label";
8
+ readonly labelName: "tokenpanel-element-inspect-label-name";
9
+ readonly labelSize: "tokenpanel-element-inspect-label-size";
10
+ readonly inspectingRoot: "tokenpanel-element-inspect-inspecting";
11
+ };
12
+ export interface ElementInspectOverlayProps {
13
+ pinned: Element | null;
14
+ onPinnedDetached?: () => void;
15
+ }
16
+ export declare function ElementInspectOverlay({ pinned, onPinnedDetached, }: ElementInspectOverlayProps): JSX.Element | null;
@@ -0,0 +1,3 @@
1
+ import type { JSX } from 'preact';
2
+ /** Header control for the element → tokens picker. */
3
+ export declare function ElementInspectToggleButton(): JSX.Element | null;
@@ -0,0 +1,6 @@
1
+ import type { JSX } from 'preact';
2
+ export interface ElementInspectViewProps {
3
+ /** Invoked when the Color-tab jump link is selected. */
4
+ onJumpToColorTab: () => void;
5
+ }
6
+ export declare function ElementInspectView({ onJumpToColorTab }: ElementInspectViewProps): JSX.Element;
@@ -0,0 +1,23 @@
1
+ import type { TokenAddress, TokenIndex, TokenIndexEntry } from '../utils/token-index';
2
+ export interface ElementTokenMatch {
3
+ property: string;
4
+ cssVar: string;
5
+ expression: string;
6
+ selector: string;
7
+ addresses: readonly TokenAddress[];
8
+ kind: TokenIndexEntry['kind'];
9
+ changedProperties: readonly string[];
10
+ confirmed: boolean;
11
+ inheritedFrom?: Element;
12
+ }
13
+ export interface ElementTokenPropertyGroup {
14
+ property: string;
15
+ matches: readonly ElementTokenMatch[];
16
+ }
17
+ export interface FindTokensForElementResult {
18
+ own: readonly ElementTokenPropertyGroup[];
19
+ inherited: readonly ElementTokenPropertyGroup[];
20
+ warnings: readonly string[];
21
+ }
22
+ /** Find manifest-backed token declarations applying to one element. */
23
+ export declare function findTokensForElement(el: Element, index: TokenIndex): FindTokensForElementResult;
@@ -0,0 +1,8 @@
1
+ export { findTokensForElement } from './find-tokens-for-element';
2
+ export type { ElementTokenMatch, ElementTokenPropertyGroup, FindTokensForElementResult, } from './find-tokens-for-element';
3
+ export { ElementInspectOrchestrator, type ElementInspectOrchestratorProps, } from './element-inspect-orchestrator';
4
+ export { ElementInspectOverlay, ELEMENT_INSPECT_PORTAL_MOUNT_ID } from './element-inspect-overlay';
5
+ export { ElementInspectToggleButton } from './element-inspect-toggle-button';
6
+ export { ElementInspectView, type ElementInspectViewProps } from './element-inspect-view';
7
+ export { ElementInspectContext, ELEMENT_INSPECT_TAB_ID, } from './element-inspect-context';
8
+ export type { ElementInspectContextValue } from './element-inspect-context';
@@ -66,6 +66,7 @@ export interface FindElementsOptions {
66
66
  */
67
67
  mode?: 'equality' | 'differential';
68
68
  }
69
+ export type ProbeTokenKind = NonNullable<FindElementsOptions['kind']> | 'select';
69
70
  /**
70
71
  * Ids of the singleton portal-mount `<div>`s each overlay appends to
71
72
  * document.body. Single source of truth: the orchestrators pass these to
@@ -76,13 +77,23 @@ export interface FindElementsOptions {
76
77
  export declare const HIGHLIGHT_PORTAL_MOUNT_ID = "tokenpanel-highlight-mount";
77
78
  export declare const ELPATH_PORTAL_MOUNT_ID = "tokenpanel-elpath-mount";
78
79
  export declare const DOM_TWEAKER_PORTAL_MOUNT_ID = "tokenpanel-domtweaker-mount";
80
+ export declare const ELEMENT_INSPECT_PORTAL_MOUNT_ID = "tokenpanel-element-inspect-mount";
81
+ /** Attribute on the host-document font specimen portal mount. */
82
+ export declare const ON_PAGE_SPECIMEN_SELECTOR = "[data-zdtp-specimen]";
79
83
  /**
80
84
  * Selector matching every panel-owned surface that must NEVER be treated as a
81
- * host element (the shell, modals, and the highlight/element-path/dom-tweaker
82
- * portal mounts). Exported so picker features can skip the same surfaces when
85
+ * host element (the shell, modals, and the highlight/chain/element-path/
86
+ * dom-tweaker portal mounts, including element inspect and the on-page
87
+ * specimen). Exported so picker features can skip the same surfaces when
83
88
  * resolving the element under the cursor.
84
89
  */
85
- export declare const PANEL_EXCLUSION_SELECTOR = ".tokenpanel-shell, [data-design-token-panel-modal], #tokenpanel-highlight-mount, #tokenpanel-elpath-mount, #tokenpanel-domtweaker-mount";
90
+ export declare const PANEL_EXCLUSION_SELECTOR = ".tokenpanel-shell, [data-design-token-panel-modal], .tokenpanel-chain-popover, #tokenpanel-highlight-mount, #tokenpanel-elpath-mount, #tokenpanel-domtweaker-mount, #tokenpanel-element-inspect-mount, [data-zdtp-specimen]";
91
+ /**
92
+ * Differentially probe one element and report the computed properties that
93
+ * actually respond to a token. Unlike the whole-document finder, this keeps
94
+ * property identity so callers can reject losing declarations independently.
95
+ */
96
+ export declare function probeElementForToken(el: Element, cssVar: string, kind: ProbeTokenKind): string[];
86
97
  /**
87
98
  * Find all DOM elements whose computed style reflects the given CSS custom
88
99
  * property.
@@ -14,10 +14,14 @@
14
14
  * overlay persists even when the panel is closed.
15
15
  */
16
16
  import type { ComponentChildren } from 'preact';
17
+ import { type PanelConfig } from '../config/panel-config';
17
18
  import type { TierValueKind } from '../tokens/tier-model';
18
19
  type ProbeKind = 'color' | 'length' | 'number' | 'text' | 'easing' | 'cursor' | 'content' | 'mask-image';
19
20
  export declare function tierKindToProbeKind(t: TierValueKind | undefined): ProbeKind | undefined;
20
- export declare function HighlightOrchestrator({ children }: {
21
- children: ComponentChildren;
22
- }): import("preact").JSX.Element;
21
+ export interface HighlightOrchestratorProps {
22
+ children?: ComponentChildren;
23
+ /** Config for the mounted panel instance; omitted for the default path. */
24
+ instanceConfig?: PanelConfig;
25
+ }
26
+ export declare function HighlightOrchestrator({ children, instanceConfig: instanceConfigProp, }: HighlightOrchestratorProps): import("preact").JSX.Element;
23
27
  export {};
@@ -14,6 +14,7 @@
14
14
  * outlineWidth → localStorage (survives full page reload — user width setting kept)
15
15
  * active → sessionStorage (cleared on reload — inspection set is ephemeral)
16
16
  */
17
+ import { type PanelConfig } from '../config/panel-config';
17
18
  export interface HighlightSlotSpec {
18
19
  color: string;
19
20
  }
@@ -73,7 +74,7 @@ export declare function setOutlineWidth(state: HighlightState, width: number): H
73
74
  * Migration: existing localStorage `slots` arrays may carry a per-slot
74
75
  * `outlineWidth` field — the extra field is simply ignored on load.
75
76
  */
76
- export declare function loadHighlightState(): HighlightState;
77
+ export declare function loadHighlightState(cfg?: PanelConfig): HighlightState;
77
78
  /**
78
79
  * Persist highlight state to the split storage backends.
79
80
  *
@@ -83,4 +84,4 @@ export declare function loadHighlightState(): HighlightState;
83
84
  *
84
85
  * Gracefully handles environments where storage is unavailable.
85
86
  */
86
- export declare function saveHighlightState(state: HighlightState): void;
87
+ export declare function saveHighlightState(state: HighlightState, cfg?: PanelConfig): void;
@@ -12,11 +12,14 @@
12
12
  */
13
13
  import type { JSX } from 'preact';
14
14
  import type { HighlightState, HighlightSlotSpec } from './highlight-state';
15
+ import type { TokenAddress } from '../utils/token-index';
15
16
  export interface HighlightContextValue {
16
17
  state: HighlightState;
17
18
  toggle: (cssVar: string) => void;
18
19
  /** Optional — when the orchestrator computes match counts it injects them here for title attributes. */
19
20
  matchCounts?: Record<string, number>;
21
+ /** Lazily probe and cache the number of page elements using one token address. */
22
+ requestMatchCount?: (address: TokenAddress) => number | undefined;
20
23
  /** Optional — orchestrator may expose setSlot for slot colour editing. */
21
24
  setSlot?: (index: number, partial: Partial<HighlightSlotSpec>) => void;
22
25
  /** Optional — orchestrator may expose setOutlineWidth for global outline width editing. */
@@ -0,0 +1,2 @@
1
+ /** Walk style rules recursively through grouping rules and CSS nesting. */
2
+ export declare function walkCssRules(rules: CSSRuleList | Iterable<CSSRule>, visit: (rule: CSSStyleRule) => void): void;
@@ -0,0 +1,28 @@
1
+ import type { TweakHistorySnapshot } from '../state/history';
2
+ export interface HistoryButtonProps {
3
+ canUndo: boolean;
4
+ onUndo: () => void;
5
+ }
6
+ /** Undo control shared by the header cluster and the mini pill slot. */
7
+ export declare function HistoryUndoButton({ canUndo, onUndo }: HistoryButtonProps): import("preact").JSX.Element;
8
+ export declare function HistoryRedoButton({ canRedo, onRedo }: {
9
+ canRedo: boolean;
10
+ onRedo: () => void;
11
+ }): import("preact").JSX.Element;
12
+ export interface HistoryButtonsProps {
13
+ history: TweakHistorySnapshot;
14
+ railOpen: boolean;
15
+ onUndo: () => void;
16
+ onRedo: () => void;
17
+ onToggleRail: () => void;
18
+ }
19
+ /** Register the header right-cluster undo/redo/count/rail controls through S18. */
20
+ export declare function HistoryButtons({ history, railOpen, onUndo, onRedo, onToggleRail, }: HistoryButtonsProps): null;
21
+ export interface HistoryShortcutsProps {
22
+ enabled: boolean;
23
+ onUndo: () => void;
24
+ onRedo: () => void;
25
+ onFlipSnapshots: () => void;
26
+ }
27
+ /** Register keyboard commands with S18's active-shell dispatcher. */
28
+ export declare function HistoryShortcuts({ enabled, onUndo, onRedo, onFlipSnapshots, }: HistoryShortcutsProps): null;
@@ -0,0 +1,3 @@
1
+ export { HistoryButtons, HistoryRedoButton, HistoryShortcuts, HistoryUndoButton, type HistoryButtonProps, type HistoryButtonsProps, type HistoryShortcutsProps, } from './buttons';
2
+ export { HistoryRail, type HistoryRailProps } from './rail';
3
+ export { clearSnapshots, getSnapshotKey, isSnapshotState, loadSnapshot, loadSnapshots, removeSnapshot, restoreSnapshotState, saveSnapshot, storageKey_snapshotA, storageKey_snapshotB, useSnapshots, type SnapshotRestoreResult, type SnapshotSlot, type SnapshotSlots, type TweakSnapshot, } from './snapshots';
@@ -0,0 +1,13 @@
1
+ import type { TweakHistorySnapshot } from '../state/history';
2
+ import type { SnapshotSlot, SnapshotSlots } from './snapshots';
3
+ export interface HistoryRailProps {
4
+ history: TweakHistorySnapshot;
5
+ snapshots: SnapshotSlots;
6
+ selectedSnapshot: SnapshotSlot | null;
7
+ notice?: string | null;
8
+ activeIdentity: string;
9
+ onSaveSnapshot: (slot: SnapshotSlot) => void;
10
+ onSelectSnapshot: (slot: SnapshotSlot) => void;
11
+ onJumpTo: (index: number) => void;
12
+ }
13
+ export declare function HistoryRail({ history, snapshots, selectedSnapshot, notice, activeIdentity, onSaveSnapshot, onSelectSnapshot, onJumpTo, }: HistoryRailProps): import("preact").JSX.Element;
@@ -0,0 +1,57 @@
1
+ import { storageKey_snapshotA, storageKey_snapshotB, type PanelConfig } from '../config/panel-config';
2
+ import type { TweakState } from '../state/tweak-state';
3
+ export type SnapshotSlot = 'A' | 'B';
4
+ export interface TweakSnapshot {
5
+ state: TweakState;
6
+ identity: string;
7
+ savedAt: number;
8
+ edits: number;
9
+ }
10
+ export interface SnapshotSlots {
11
+ A: TweakSnapshot | null;
12
+ B: TweakSnapshot | null;
13
+ }
14
+ export interface SnapshotRestoreResult {
15
+ state: TweakState;
16
+ skippedReason?: string;
17
+ }
18
+ export interface StorageLike {
19
+ getItem(key: string): string | null;
20
+ setItem(key: string, value: string): void;
21
+ removeItem(key: string): void;
22
+ }
23
+ /**
24
+ * Snapshot payloads are user-editable localStorage data. Keep malformed blobs
25
+ * from reaching the apply pipeline while allowing additive state slices to
26
+ * round-trip as the runtime model evolves.
27
+ */
28
+ export declare function isSnapshotState(value: unknown): value is TweakState;
29
+ /** Return the exact per-instance storage key for a snapshot slot. */
30
+ export declare function getSnapshotKey(slot: SnapshotSlot, cfg: PanelConfig): string;
31
+ /** Read one validated snapshot. Invalid or unavailable storage is treated as empty. */
32
+ export declare function loadSnapshot(slot: SnapshotSlot, cfg: PanelConfig, storage?: StorageLike): TweakSnapshot | null;
33
+ /** Read both A/B slots for one panel instance. */
34
+ export declare function loadSnapshots(cfg: PanelConfig, storage?: StorageLike): SnapshotSlots;
35
+ /** Persist one snapshot slot under `${storagePrefix}-snapshot-a|b`. */
36
+ export declare function saveSnapshot(slot: SnapshotSlot, snapshot: TweakSnapshot, cfg: PanelConfig, storage?: StorageLike): void;
37
+ /** Remove one snapshot slot. */
38
+ export declare function removeSnapshot(slot: SnapshotSlot, cfg: PanelConfig, storage?: StorageLike): void;
39
+ /** Remove both persisted snapshot slots for one panel instance. */
40
+ export declare function clearSnapshots(cfg: PanelConfig, storage?: StorageLike): void;
41
+ /**
42
+ * Keep color slices tied to the active scheme/mode identity when restoring an
43
+ * A/B snapshot captured under another identity. Non-color slices remain fully
44
+ * restorable, including host-coined tab overrides.
45
+ */
46
+ export declare function restoreSnapshotState(snapshot: TweakSnapshot, current: TweakState, activeIdentity: string, slot?: SnapshotSlot): SnapshotRestoreResult;
47
+ /**
48
+ * Reactive per-instance snapshot store used by the panel. Selection itself is
49
+ * intentionally kept by the caller as transient UI state; only A/B payloads
50
+ * are persisted.
51
+ */
52
+ export declare function useSnapshots(cfg: PanelConfig): {
53
+ snapshots: SnapshotSlots;
54
+ save: (slot: SnapshotSlot, state: TweakState, identity: string, edits: number) => TweakSnapshot;
55
+ remove: (slot: SnapshotSlot) => void;
56
+ };
57
+ export { storageKey_snapshotA, storageKey_snapshotB };
@@ -0,0 +1,23 @@
1
+ export type DockEdge = 'right' | 'bottom';
2
+ export type DockReflow = 'body-margin' | 'none';
3
+ /**
4
+ * Claim one host-document dock edge. Returns false when another panel owns it.
5
+ * Re-claiming the same edge by the same owner updates its size without losing
6
+ * the declaration snapshot captured by the first claim.
7
+ */
8
+ export declare function claimHostDock(owner: string, edge: DockEdge, size: number, reflow?: DockReflow, doc?: Document): boolean;
9
+ /**
10
+ * Claim a host-owned DOM node for one panel owner.
11
+ *
12
+ * The node is removed when `releaseHostMutations(owner)` runs. Keeping this
13
+ * ownership in the same window-level registry as dock declarations makes the
14
+ * cleanup path robust when a panel is destroyed or an Astro swap removes the
15
+ * Preact root before effect cleanups get a chance to run. Claims are keyed by
16
+ * owner, rather than by node identity, so a single owner can safely recreate
17
+ * its portal during a navigation.
18
+ */
19
+ export declare function claimHostNode(owner: string, node: Element, doc?: Document): void;
20
+ /** Release every edge and host node owned by one panel and restore exact values. */
21
+ export declare function releaseHostMutations(owner: string, targetWindow?: Window): void;
22
+ /** Test-only reset that also restores outstanding declarations. */
23
+ export declare function __resetHostMutationsForTests(targetWindow?: Window): void;