@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.
- package/CHANGELOG.md +143 -0
- package/PORTABLE-CONTRACT.md +366 -94
- package/README.md +218 -96
- package/dist/apply/build-apply-overrides.d.ts +2 -2
- package/dist/apply/compute-hunks.d.ts +23 -0
- package/dist/apply/last-applied.d.ts +5 -0
- package/dist/apply/reconcile-applied.d.ts +19 -0
- package/dist/apply-modal.d.ts +2 -48
- package/dist/astro/host-adapter.js +3 -3
- package/dist/astro/index.js +2 -2
- package/dist/{autoload-state-CfL2VUe1.js → autoload-state-7BQYXI7Y.js} +1 -1
- package/dist/bin/server.js +52 -50
- package/dist/bulk/bulk-actions.d.ts +45 -0
- package/dist/bulk/index.d.ts +2 -0
- package/dist/chain/index.d.ts +2 -0
- package/dist/chain/token-chain-context.d.ts +19 -0
- package/dist/chain/token-chain-popover.d.ts +22 -0
- package/dist/changed/contribution.d.ts +32 -0
- package/dist/changed/footer-content.d.ts +16 -0
- package/dist/changed/index.d.ts +4 -0
- package/dist/changed/tab-badge.d.ts +8 -0
- package/dist/changed/tab-filter.d.ts +8 -0
- package/dist/config/panel-config.d.ts +22 -25
- package/dist/controls/actions-menu-popover.d.ts +2 -0
- package/dist/controls/role-button.d.ts +5 -2
- package/dist/controls/tooltip.d.ts +8 -4
- package/dist/element-inspect/element-inspect-context.d.ts +22 -0
- package/dist/element-inspect/element-inspect-orchestrator.d.ts +17 -0
- package/dist/element-inspect/element-inspect-overlay.d.ts +16 -0
- package/dist/element-inspect/element-inspect-toggle-button.d.ts +3 -0
- package/dist/element-inspect/element-inspect-view.d.ts +6 -0
- package/dist/element-inspect/find-tokens-for-element.d.ts +23 -0
- package/dist/element-inspect/index.d.ts +8 -0
- package/dist/highlight/find-elements.d.ts +14 -3
- package/dist/highlight/highlight-orchestrator.d.ts +7 -3
- package/dist/highlight/highlight-state.d.ts +3 -2
- package/dist/highlight/highlight-toggle-button.d.ts +3 -0
- package/dist/highlight/walk-css-rules.d.ts +2 -0
- package/dist/history/buttons.d.ts +28 -0
- package/dist/history/index.d.ts +3 -0
- package/dist/history/rail.d.ts +13 -0
- package/dist/history/snapshots.d.ts +57 -0
- package/dist/host/host-mutations.d.ts +23 -0
- package/dist/index-BOOmFtJh.js +12165 -0
- package/dist/{index-BAY1JOUl.js → index-C2DIYD0d.js} +2 -2
- package/dist/index.js +14 -14
- package/dist/load-routing-BtCE1hGI.js +547 -0
- package/dist/{manifest-DCReQE0k.js → manifest-DvuKi7I4.js} +11 -7
- package/dist/{panel-config-COHesW2B.js → panel-config-CRf-ONSV.js} +404 -308
- package/dist/picker/alt-click-picker.d.ts +10 -2
- package/dist/picker/arming-coordinator.d.ts +2 -0
- package/dist/picker/index.d.ts +2 -2
- package/dist/search/command-palette.d.ts +21 -0
- package/dist/search/contribution.d.ts +7 -0
- package/dist/search/fuzzy.d.ts +10 -0
- package/dist/search/index.d.ts +4 -0
- package/dist/search/match-bar.d.ts +14 -0
- package/dist/search/search-header.d.ts +7 -0
- package/dist/search/token-search.d.ts +36 -0
- package/dist/server/create-apply-handler.d.ts +33 -0
- package/dist/server/index.d.ts +2 -1
- package/dist/server/index.js +1 -1
- package/dist/shell/dock-mode-switch.d.ts +6 -0
- package/dist/shell/footer.d.ts +1 -0
- package/dist/shell/ghost-idle.d.ts +24 -0
- package/dist/shell/header.d.ts +5 -0
- package/dist/shell/layer-activity.d.ts +6 -0
- package/dist/shell/mini-pill.d.ts +21 -0
- package/dist/shell/regions.d.ts +26 -0
- package/dist/shell/shortcut-dispatcher.d.ts +17 -0
- package/dist/shell/tab-bar.d.ts +17 -0
- package/dist/shell/tab-overflow-popover.d.ts +13 -0
- package/dist/specimen/on-page-specimen.d.ts +19 -0
- package/dist/specimen/preview-glyphs.d.ts +2 -0
- package/dist/specimen/specimen-state.d.ts +12 -0
- package/dist/specimen/specimen-tab-body.d.ts +18 -0
- package/dist/specimen/specimen-toolbar.d.ts +10 -0
- package/dist/specimen/specimen-values.d.ts +9 -0
- package/dist/state/history.d.ts +64 -0
- package/dist/state/persist.d.ts +10 -14
- package/dist/state/transaction.d.ts +24 -0
- package/dist/state/tweak-state.d.ts +16 -0
- package/dist/styles/z-index-tokens.d.ts +2 -0
- package/dist/tabs/color-tab.d.ts +10 -1
- package/dist/tabs/flat/flat-tab.d.ts +27 -0
- package/dist/tabs/flat/index.d.ts +8 -0
- package/dist/tabs/flat/scroll-to-token-row.d.ts +3 -0
- package/dist/tabs/flat/tier-section.d.ts +17 -0
- package/dist/tabs/flat/token-controller.d.ts +23 -0
- package/dist/tabs/flat/token-row.d.ts +12 -0
- package/dist/tabs/flat/types.d.ts +25 -0
- package/dist/tabs/font-tab.d.ts +13 -12
- package/dist/tabs/generic-tab.d.ts +8 -38
- package/dist/tabs/palette/palette-check-view.d.ts +5 -1
- package/dist/tabs/palette/palette-edit-view.d.ts +9 -1
- package/dist/tabs/palette/palette-tab.d.ts +12 -1
- package/dist/tabs/size-tab.d.ts +7 -10
- package/dist/tabs/spacing-tab.d.ts +7 -13
- package/dist/testing.js +3 -3
- package/dist/tokens/tier-model.d.ts +6 -0
- package/dist/{tweak-state-BKNxtHzb.js → tweak-state-BGp_7Tfh.js} +473 -423
- package/dist/utils/numeric-transform.d.ts +32 -0
- package/dist/utils/token-diff.d.ts +25 -0
- package/dist/utils/token-graph.d.ts +23 -0
- package/dist/utils/token-index.d.ts +30 -0
- package/dist/zdtp.css +1 -1
- package/package.json +3 -1
- package/dist/controls/pill-slider-row.d.ts +0 -36
- package/dist/controls/select-row.d.ts +0 -25
- package/dist/controls/slider-row.d.ts +0 -29
- package/dist/controls/text-row.d.ts +0 -27
- package/dist/index-U7Ol7tgA.js +0 -7591
- package/dist/load-routing-D4H2VOl5.js +0 -426
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* - keyup/window-blur disarm the picker.
|
|
12
12
|
* - a fixed-position box + label track the hovered element with RAF.
|
|
13
13
|
*/
|
|
14
|
-
import type {
|
|
14
|
+
import type { Ref } from 'preact';
|
|
15
15
|
export interface AltClickPickerClassNames {
|
|
16
16
|
/** Highlight box class. */
|
|
17
17
|
box: string;
|
|
@@ -48,4 +48,12 @@ export interface AltClickPickerProps {
|
|
|
48
48
|
/** Gap between the element box and its label tag. */
|
|
49
49
|
labelGap?: number;
|
|
50
50
|
}
|
|
51
|
-
export
|
|
51
|
+
export interface AltClickPickerHandle {
|
|
52
|
+
/** Arm this picker without synthesizing an Alt keyboard gesture. */
|
|
53
|
+
arm(): void;
|
|
54
|
+
/** Disarm this picker and release coordinator ownership. */
|
|
55
|
+
disarm(): void;
|
|
56
|
+
}
|
|
57
|
+
export declare const AltClickPicker: import("preact").FunctionalComponent<import("react-dom/src").PropsWithoutRef<AltClickPickerProps> & {
|
|
58
|
+
ref?: Ref<AltClickPickerHandle> | undefined;
|
|
59
|
+
}>;
|
|
@@ -9,6 +9,8 @@ export interface ArmingOwner {
|
|
|
9
9
|
/** Called when another feature takes over the Alt gesture. */
|
|
10
10
|
onArmingRevoked: () => void;
|
|
11
11
|
}
|
|
12
|
+
/** Stable coordinator id reserved for the element-inspect picker. */
|
|
13
|
+
export declare const ELEMENT_INSPECT_PICKER_FEATURE_ID = "element-inspect";
|
|
12
14
|
export declare function registerArmingOwner(featureId: string, owner: ArmingOwner): () => void;
|
|
13
15
|
export declare function requestArming(featureId: string): void;
|
|
14
16
|
export declare function releaseArming(featureId: string): void;
|
package/dist/picker/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { AltClickPicker } from './alt-click-picker';
|
|
2
|
-
export type { AltClickPickerClassNames, AltClickPickerProps, } from './alt-click-picker';
|
|
3
|
-
export { registerArmingOwner, requestArming, releaseArming, } from './arming-coordinator';
|
|
2
|
+
export type { AltClickPickerClassNames, AltClickPickerHandle, AltClickPickerProps, } from './alt-click-picker';
|
|
3
|
+
export { ELEMENT_INSPECT_PICKER_FEATURE_ID, registerArmingOwner, requestArming, releaseArming, } from './arming-coordinator';
|
|
4
4
|
export type { ArmingOwner } from './arming-coordinator';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PanelConfig } from '../config/panel-config';
|
|
2
|
+
import type { TweakState } from '../state/tweak-state';
|
|
3
|
+
import type { TokenAddress } from '../utils/token-index';
|
|
4
|
+
export interface CommandPaletteAction {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
onSelect: () => void;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
disabledReason?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface CommandPaletteProps {
|
|
12
|
+
open: boolean;
|
|
13
|
+
onOpen: () => void;
|
|
14
|
+
onClose: () => void;
|
|
15
|
+
config: PanelConfig;
|
|
16
|
+
state?: TweakState | null;
|
|
17
|
+
actions: readonly CommandPaletteAction[];
|
|
18
|
+
onSelectToken: (address: TokenAddress) => void;
|
|
19
|
+
}
|
|
20
|
+
/** In-shell command palette with dismiss-layer Escape arbitration. */
|
|
21
|
+
export declare function CommandPalette({ open, onOpen, onClose, config, state, actions, onSelectToken, }: CommandPaletteProps): import("preact").JSX.Element | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RowContribution } from '../tabs/flat/types';
|
|
2
|
+
/**
|
|
3
|
+
* S3 contribution used by every flat token tab. FlatTab still owns rendering
|
|
4
|
+
* and section omission; this contribution only supplies the query predicate.
|
|
5
|
+
*/
|
|
6
|
+
export declare function tokenSearchContribution(query: string): RowContribution;
|
|
7
|
+
export declare const createTokenSearchContribution: typeof tokenSearchContribution;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Small dependency-free fuzzy matcher used by the command palette. */
|
|
2
|
+
/**
|
|
3
|
+
* Return true when every character in `query` occurs in `value` in order.
|
|
4
|
+
* Matching is case-insensitive and intentionally does not score or reorder
|
|
5
|
+
* results; the manifest's declaration order remains the stable ordering.
|
|
6
|
+
*/
|
|
7
|
+
export declare function fuzzySubsequence(query: string, value: string): boolean;
|
|
8
|
+
/** Friendly aliases for callers that describe this operation as a match. */
|
|
9
|
+
export declare const fuzzyMatch: typeof fuzzySubsequence;
|
|
10
|
+
export declare const isSubsequence: typeof fuzzySubsequence;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { fuzzyMatch, fuzzySubsequence, isSubsequence } from './fuzzy';
|
|
2
|
+
export { createTokenSearchContribution, tokenSearchContribution } from './contribution';
|
|
3
|
+
export { buildSearchTokens, filterTokenEntries, filterTokenIndex, fuzzyFilterTokens, matchesSearchFields, matchesTokenEntry, searchFieldsForEntry, stringifySearchValue, } from './token-search';
|
|
4
|
+
export type { SearchToken, TokenSearchFields } from './token-search';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TabConfig } from '../tokens/tier-model';
|
|
2
|
+
export interface SearchTabCount {
|
|
3
|
+
tab: TabConfig;
|
|
4
|
+
matches: number;
|
|
5
|
+
total: number;
|
|
6
|
+
}
|
|
7
|
+
export interface SearchMatchBarProps {
|
|
8
|
+
query: string;
|
|
9
|
+
activeTabId: string;
|
|
10
|
+
counts: readonly SearchTabCount[];
|
|
11
|
+
onSelectTab: (tabId: string) => void;
|
|
12
|
+
}
|
|
13
|
+
/** The compact cross-tab result summary below the tab strip. */
|
|
14
|
+
export declare function SearchMatchBar({ query, activeTabId, counts, onSelectTab, }: SearchMatchBarProps): import("preact").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface SearchHeaderProps {
|
|
2
|
+
query: string;
|
|
3
|
+
onQueryChange: (query: string) => void;
|
|
4
|
+
onOpenPalette: () => void;
|
|
5
|
+
}
|
|
6
|
+
/** Header-region search control. The compact affordance opens the palette. */
|
|
7
|
+
export declare function SearchHeader({ query, onQueryChange, onOpenPalette }: SearchHeaderProps): import("preact").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { TweakState } from '../state/tweak-state';
|
|
2
|
+
import { type TokenAddress, type TokenIndex, type TokenIndexEntry } from '../utils/token-index';
|
|
3
|
+
import type { PanelConfig } from '../config/panel-config';
|
|
4
|
+
/** The fields intentionally mirror the header-filter contract. */
|
|
5
|
+
export interface TokenSearchFields {
|
|
6
|
+
cssVar: string;
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
value: string;
|
|
10
|
+
tierLabel: string;
|
|
11
|
+
}
|
|
12
|
+
/** A command-palette token carries its stable S2 address and display fields. */
|
|
13
|
+
export interface SearchToken {
|
|
14
|
+
kind: 'token';
|
|
15
|
+
address: TokenAddress;
|
|
16
|
+
tabLabel: string;
|
|
17
|
+
tierLabel: string;
|
|
18
|
+
cssVar: string;
|
|
19
|
+
label: string;
|
|
20
|
+
value: string;
|
|
21
|
+
source: TokenIndexEntry['source'];
|
|
22
|
+
}
|
|
23
|
+
/** Normalize values from the S2 SemanticValue union for matching/display. */
|
|
24
|
+
export declare function stringifySearchValue(value: unknown): string;
|
|
25
|
+
/** Build the five searchable fields for one indexed token. */
|
|
26
|
+
export declare function searchFieldsForEntry(entry: TokenIndexEntry, state?: TweakState, cfg?: PanelConfig): TokenSearchFields;
|
|
27
|
+
/** Case-insensitive substring search used by the header filter. */
|
|
28
|
+
export declare function matchesSearchFields(fields: TokenSearchFields, query: string): boolean;
|
|
29
|
+
export declare function matchesTokenEntry(entry: TokenIndexEntry, query: string, state?: TweakState, cfg?: PanelConfig): boolean;
|
|
30
|
+
/** Filter an S2 index while preserving manifest order. */
|
|
31
|
+
export declare function filterTokenIndex(index: TokenIndex, query: string, state?: TweakState, cfg?: PanelConfig): TokenIndexEntry[];
|
|
32
|
+
export declare const filterTokenEntries: typeof filterTokenIndex;
|
|
33
|
+
/** Build command-palette token rows from the current registered manifest. */
|
|
34
|
+
export declare function buildSearchTokens(cfg: PanelConfig, state?: TweakState): SearchToken[];
|
|
35
|
+
/** Fuzzy-filter command-palette token rows over address + labels + value. */
|
|
36
|
+
export declare function fuzzyFilterTokens(tokens: readonly SearchToken[], query: string): SearchToken[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ApplyHunk } from '../apply/compute-hunks';
|
|
1
2
|
import type { ApplyRoutingMap } from '../config/panel-config';
|
|
2
3
|
export interface ApplyHandlerOptions {
|
|
3
4
|
/**
|
|
@@ -29,6 +30,38 @@ export interface PerFileResult {
|
|
|
29
30
|
*/
|
|
30
31
|
unknownOutsideBlock: string[];
|
|
31
32
|
}
|
|
33
|
+
export interface ApplyRequestBody {
|
|
34
|
+
tokens: Record<string, string>;
|
|
35
|
+
dryRun?: true;
|
|
36
|
+
/** Digests returned by a preceding dry run, keyed by response `file`. */
|
|
37
|
+
expectDigests?: Record<string, string>;
|
|
38
|
+
}
|
|
39
|
+
export interface ApplyDryRunFileResult extends PerFileResult {
|
|
40
|
+
blockKind: 'root' | 'theme';
|
|
41
|
+
/** SHA-256 of the exact on-disk bytes used to compute this preview. */
|
|
42
|
+
digest: string;
|
|
43
|
+
hunks: ApplyHunk[];
|
|
44
|
+
}
|
|
45
|
+
export interface ApplyDryRunResponse {
|
|
46
|
+
ok: true;
|
|
47
|
+
dryRun: true;
|
|
48
|
+
files: ApplyDryRunFileResult[];
|
|
49
|
+
rejected: string[];
|
|
50
|
+
rejectedReasons: string[];
|
|
51
|
+
}
|
|
52
|
+
export interface ApplyWriteResponse {
|
|
53
|
+
ok: true;
|
|
54
|
+
updated: PerFileResult[];
|
|
55
|
+
unknownCssVars: string[];
|
|
56
|
+
unchangedCssVars: string[];
|
|
57
|
+
unknownOutsideBlockCssVars: string[];
|
|
58
|
+
}
|
|
59
|
+
export interface ApplyStaleFileResponse {
|
|
60
|
+
ok: false;
|
|
61
|
+
reason: 'stale-file';
|
|
62
|
+
files: string[];
|
|
63
|
+
}
|
|
64
|
+
export type ApplySuccessResponse = ApplyDryRunResponse | ApplyWriteResponse;
|
|
32
65
|
/**
|
|
33
66
|
* Create a framework-agnostic Fetch API handler for the design-token apply
|
|
34
67
|
* endpoint.
|
package/dist/server/index.d.ts
CHANGED
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
19
|
export { createApplyHandler } from './create-apply-handler';
|
|
20
|
-
export type { ApplyHandlerOptions, PerFileResult } from './create-apply-handler';
|
|
20
|
+
export type { ApplyDryRunFileResult, ApplyDryRunResponse, ApplyHandlerOptions, ApplyRequestBody, ApplyStaleFileResponse, ApplySuccessResponse, ApplyWriteResponse, PerFileResult, } from './create-apply-handler';
|
|
21
21
|
export { serializeFileWrite } from './serialize-write';
|
|
22
|
+
export type { ApplyHunk } from '../apply/compute-hunks';
|
|
22
23
|
export { CSS_VAR_NAME_RE, isPathSafe, isValidCssVarName, validateAndSanitizeTokens, } from './path-safety';
|
|
23
24
|
export { loadRoutingFromFile, type ApplyRoutingMap } from './load-routing';
|
package/dist/server/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ShellFooter(): import("preact").JSX.Element | null;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { RefObject } from 'preact';
|
|
2
|
+
/** Time the pointer must stay outside the shell before it becomes translucent. */
|
|
3
|
+
export declare const GHOST_IDLE_DELAY_MS = 700;
|
|
4
|
+
/** Class applied to a shell that is currently ghosted. */
|
|
5
|
+
export declare const GHOST_IDLE_CLASS = "is-ghosted";
|
|
6
|
+
/** The opacity used by the panel CSS while the shell is ghosted. */
|
|
7
|
+
export declare const GHOST_IDLE_OPACITY = 0.35;
|
|
8
|
+
/** Per-panel persisted preference key. */
|
|
9
|
+
export declare function storageKey_ghostIdle(storagePrefix: string): string;
|
|
10
|
+
/** Read the persisted ghost-when-idle preference, defaulting to off. */
|
|
11
|
+
export declare function loadGhostIdle(storagePrefix: string): boolean;
|
|
12
|
+
/** Persist the ghost-when-idle preference without making storage mandatory. */
|
|
13
|
+
export declare function saveGhostIdle(storagePrefix: string, enabled: boolean): void;
|
|
14
|
+
/**
|
|
15
|
+
* Install ghost-when-idle behavior on a shell element.
|
|
16
|
+
*
|
|
17
|
+
* The shell is deliberately observed from the document as well as with
|
|
18
|
+
* pointerenter/leave listeners. A pointer can enter the host page before it
|
|
19
|
+
* ever enters the fixed panel, so a document-level pointermove is needed to
|
|
20
|
+
* start the idle timer reliably. Focus-within and layer activity always win:
|
|
21
|
+
* an open popover/modal must never become translucent underneath the user's
|
|
22
|
+
* keyboard focus.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useGhostIdle<T extends HTMLElement>(targetRef: RefObject<T>, enabled: boolean, layerActive: boolean, delayMs?: number): void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ComponentChildren } from 'preact';
|
|
2
|
+
export declare function LayerActivityProvider({ children }: {
|
|
3
|
+
children: ComponentChildren;
|
|
4
|
+
}): import("preact").JSX.Element;
|
|
5
|
+
export declare function useLayerActivity(): boolean;
|
|
6
|
+
export declare function useLayerRegistration(id: string, active: boolean): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ComponentChildren, JSX, RefObject } from 'preact';
|
|
2
|
+
/** Slots intentionally stay small so changed-state and history features can
|
|
3
|
+
* add their own controls without making the dock-mode shell depend on them. */
|
|
4
|
+
export interface MiniPillProps {
|
|
5
|
+
rootRef?: RefObject<HTMLDivElement>;
|
|
6
|
+
onApply: () => void;
|
|
7
|
+
applyDisabled?: boolean;
|
|
8
|
+
applyDisabledReason?: string;
|
|
9
|
+
onExpand: () => void;
|
|
10
|
+
changedCount?: number | undefined;
|
|
11
|
+
undo?: ComponentChildren;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Compact replacement for the full panel shell in `dockMode === 'mini'`.
|
|
15
|
+
*
|
|
16
|
+
* The changed-count and undo regions are extension slots for later panel
|
|
17
|
+
* features. Keeping the wrappers in this component gives those features a
|
|
18
|
+
* stable place to contribute while the mini dock mode itself remains usable
|
|
19
|
+
* on the foundation branch.
|
|
20
|
+
*/
|
|
21
|
+
export declare function MiniPill({ rootRef, onApply, applyDisabled, applyDisabledReason, onExpand, changedCount, undo, }: MiniPillProps): JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ComponentChildren } from 'preact';
|
|
2
|
+
import type { ActionsMenuAction } from '../controls/actions-menu-popover';
|
|
3
|
+
export type ShellRegion = 'header-actions' | 'header-right' | 'tabbar-extras' | 'footer';
|
|
4
|
+
export interface ShellRegionRenderContext {
|
|
5
|
+
compact: boolean;
|
|
6
|
+
closeCompactMenu: () => void;
|
|
7
|
+
}
|
|
8
|
+
export interface ShellRegionItem {
|
|
9
|
+
id: string;
|
|
10
|
+
order?: number;
|
|
11
|
+
render: (context: ShellRegionRenderContext) => ComponentChildren;
|
|
12
|
+
compactAction?: ActionsMenuAction;
|
|
13
|
+
renderInCompactMenu?: boolean;
|
|
14
|
+
}
|
|
15
|
+
type RegionItems = Record<ShellRegion, readonly ShellRegionItem[]>;
|
|
16
|
+
interface ShellRegionsValue {
|
|
17
|
+
items: RegionItems;
|
|
18
|
+
registerRegionItem: (region: ShellRegion, item: ShellRegionItem) => () => void;
|
|
19
|
+
}
|
|
20
|
+
export declare function ShellRegionsProvider({ initialItems, children, }: {
|
|
21
|
+
initialItems?: Partial<RegionItems>;
|
|
22
|
+
children: ComponentChildren;
|
|
23
|
+
}): import("preact").JSX.Element;
|
|
24
|
+
export declare function useShellRegions(): ShellRegionsValue;
|
|
25
|
+
export declare function useRegisterRegionItem(region: ShellRegion, item: ShellRegionItem): void;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ComponentChildren, RefObject } from 'preact';
|
|
2
|
+
export interface ShortcutBinding {
|
|
3
|
+
key: string | readonly string[];
|
|
4
|
+
metaKey?: boolean;
|
|
5
|
+
ctrlKey?: boolean;
|
|
6
|
+
altKey?: boolean;
|
|
7
|
+
shiftKey?: boolean;
|
|
8
|
+
when?: (event: KeyboardEvent) => boolean;
|
|
9
|
+
}
|
|
10
|
+
type ShortcutHandler = (event: KeyboardEvent) => void;
|
|
11
|
+
export declare function ShortcutProvider({ shellRef, enabled, children, }: {
|
|
12
|
+
shellRef: RefObject<HTMLDivElement>;
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
children: ComponentChildren;
|
|
15
|
+
}): import("preact").JSX.Element;
|
|
16
|
+
export declare function useShortcut(binding: ShortcutBinding, handler: ShortcutHandler, enabled?: boolean): void;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type RefObject } from 'preact';
|
|
2
|
+
import type { PanelDensity } from '../state/tweak-state';
|
|
3
|
+
export interface ShellTab {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function ShellTabBar({ tabs, activeTab, onActiveTabChange, ariaIdScope, tabRefs, density, onDensityChange, open, changedCounts, }: {
|
|
8
|
+
tabs: readonly ShellTab[];
|
|
9
|
+
activeTab: string;
|
|
10
|
+
onActiveTabChange: (id: string) => void;
|
|
11
|
+
ariaIdScope: string;
|
|
12
|
+
tabRefs: RefObject<Record<string, HTMLDivElement | null>>;
|
|
13
|
+
density: PanelDensity;
|
|
14
|
+
onDensityChange: (density: PanelDensity) => void;
|
|
15
|
+
open: boolean;
|
|
16
|
+
changedCounts?: Readonly<Record<string, number>>;
|
|
17
|
+
}): import("preact").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { JSX } from 'preact';
|
|
2
|
+
import type { ShellTab } from './tab-bar';
|
|
3
|
+
interface TabOverflowPopoverProps {
|
|
4
|
+
tabs: readonly ShellTab[];
|
|
5
|
+
activeTab: string;
|
|
6
|
+
anchorRef: React.RefObject<HTMLDivElement>;
|
|
7
|
+
open: boolean;
|
|
8
|
+
onOpenChange: (open: boolean) => void;
|
|
9
|
+
onSelect: (id: string) => void;
|
|
10
|
+
ariaIdScope: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function TabOverflowPopover(props: TabOverflowPopoverProps): JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PanelConfig } from '../config/panel-config';
|
|
2
|
+
import type { TabConfig, TierItem } from '../tokens/tier-model';
|
|
3
|
+
import type { SpecimenState } from './specimen-state';
|
|
4
|
+
/** The host-mutation owner suffix for a panel's page-level specimen node. */
|
|
5
|
+
export declare function onPageSpecimenMutationOwner(cfg: PanelConfig): string;
|
|
6
|
+
interface OnPageSpecimenProps {
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
tab: TabConfig;
|
|
9
|
+
state: SpecimenState;
|
|
10
|
+
valueFor: (item: TierItem) => string;
|
|
11
|
+
instanceConfig: PanelConfig;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Render the read-only font specimen into the host document while enabled.
|
|
15
|
+
* The mount itself is registry-owned, so destroy/Astro cleanup can remove it
|
|
16
|
+
* even when the Preact tree no longer has a live root to run effect cleanup.
|
|
17
|
+
*/
|
|
18
|
+
export default function OnPageSpecimen(props: OnPageSpecimenProps): import("preact").VNode<any> | null;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PanelConfig } from '../config/panel-config';
|
|
2
|
+
export type SpecimenPreset = 'latin' | 'ja' | 'mixed';
|
|
3
|
+
export interface SpecimenState {
|
|
4
|
+
text: string;
|
|
5
|
+
preset: SpecimenPreset;
|
|
6
|
+
overridden: boolean;
|
|
7
|
+
width: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const SPECIMEN_PRESETS: Readonly<Record<SpecimenPreset, string>>;
|
|
10
|
+
export declare const DEFAULT_SPECIMEN_STATE: SpecimenState;
|
|
11
|
+
export declare function loadSpecimenState(cfg: PanelConfig): SpecimenState;
|
|
12
|
+
export declare function saveSpecimenState(cfg: PanelConfig, state: SpecimenState): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ComponentChildren } from 'preact';
|
|
2
|
+
import type { CSSProperties } from 'preact/compat';
|
|
3
|
+
import type { TabConfig, TierConfig, TierItem } from '../tokens/tier-model';
|
|
4
|
+
import type { SharedRowRenderer } from '../tabs/flat/tier-section';
|
|
5
|
+
import type { RowContribution } from '../tabs/flat/types';
|
|
6
|
+
import type { SpecimenState } from './specimen-state';
|
|
7
|
+
interface SpecimenRendererOptions {
|
|
8
|
+
tab: TabConfig;
|
|
9
|
+
state: SpecimenState;
|
|
10
|
+
valueFor: (item: TierItem) => string;
|
|
11
|
+
/** Hide the rendered sample while keeping the editable row controls. */
|
|
12
|
+
onPage?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** Resolve the font family/weight applied to every type specimen sample. */
|
|
15
|
+
export declare function specimenFontStyle(tab: TabConfig, valueFor: (item: TierItem) => string): CSSProperties;
|
|
16
|
+
export declare function createSpecimenContribution({ tab, state, valueFor, onPage }: SpecimenRendererOptions): RowContribution;
|
|
17
|
+
export declare function renderSpecimenTierBody(tier: TierConfig, renderRow: SharedRowRenderer, options: SpecimenRendererOptions): ComponentChildren;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SpecimenState } from './specimen-state';
|
|
2
|
+
interface SpecimenToolbarProps {
|
|
3
|
+
state: SpecimenState;
|
|
4
|
+
showWidth: boolean;
|
|
5
|
+
onChange: (next: SpecimenState) => void;
|
|
6
|
+
renderOnPage?: boolean;
|
|
7
|
+
onRenderOnPageChange?: (enabled: boolean) => void;
|
|
8
|
+
}
|
|
9
|
+
export default function SpecimenToolbar({ state, showWidth, onChange, renderOnPage, onRenderOnPageChange, }: SpecimenToolbarProps): import("preact").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TabConfig, TierConfig, TierItem } from '../tokens/tier-model';
|
|
2
|
+
export interface ResolvedPreviewLength {
|
|
3
|
+
value: string;
|
|
4
|
+
px: number | null;
|
|
5
|
+
}
|
|
6
|
+
export declare function lengthToPx(value: string): number | null;
|
|
7
|
+
export declare function resolvePreviewValue(tab: TabConfig, tier: TierConfig, item: TierItem, valueFor: (item: TierItem) => string): string;
|
|
8
|
+
export declare function resolvePreviewLength(tab: TabConfig, tier: TierConfig, item: TierItem, valueFor: (item: TierItem) => string): ResolvedPreviewLength;
|
|
9
|
+
export declare function findLineHeightBasePx(tab: TabConfig, tier: TierConfig, valueFor: (item: TierItem) => string): number;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { TweakState } from './tweak-state';
|
|
2
|
+
export declare const HISTORY_LIMIT = 100;
|
|
3
|
+
export declare const HISTORY_COALESCE_MS = 500;
|
|
4
|
+
export interface TweakHistoryEntry {
|
|
5
|
+
reason: string;
|
|
6
|
+
address?: string;
|
|
7
|
+
identity: string;
|
|
8
|
+
before: TweakState;
|
|
9
|
+
after: TweakState;
|
|
10
|
+
timestamp: number;
|
|
11
|
+
}
|
|
12
|
+
export interface HistoryRestoreResult {
|
|
13
|
+
entry: TweakHistoryEntry | null;
|
|
14
|
+
skippedReason?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface TweakHistorySnapshot {
|
|
17
|
+
entries: readonly TweakHistoryEntry[];
|
|
18
|
+
cursor: number;
|
|
19
|
+
canUndo: boolean;
|
|
20
|
+
canRedo: boolean;
|
|
21
|
+
lastSkippedReason: string | null;
|
|
22
|
+
}
|
|
23
|
+
type Restore = (state: TweakState) => void;
|
|
24
|
+
/** In-memory, identity-aware history for one mounted panel instance. */
|
|
25
|
+
export declare class TweakHistory {
|
|
26
|
+
private items;
|
|
27
|
+
private cursor;
|
|
28
|
+
private restore;
|
|
29
|
+
private getCurrentState;
|
|
30
|
+
private getIdentity;
|
|
31
|
+
private listeners;
|
|
32
|
+
private lastSkippedReason;
|
|
33
|
+
configure(options: {
|
|
34
|
+
restore: Restore;
|
|
35
|
+
getCurrentState: () => TweakState | null;
|
|
36
|
+
getIdentity: () => string;
|
|
37
|
+
}): void;
|
|
38
|
+
getSnapshot(): TweakHistorySnapshot;
|
|
39
|
+
subscribe(listener: () => void): () => void;
|
|
40
|
+
clear(): void;
|
|
41
|
+
record(entry: TweakHistoryEntry, options?: {
|
|
42
|
+
reset?: boolean;
|
|
43
|
+
force?: boolean;
|
|
44
|
+
}): void;
|
|
45
|
+
undo(): HistoryRestoreResult;
|
|
46
|
+
redo(): HistoryRestoreResult;
|
|
47
|
+
/** Restore the state after entry `index`; `-1` means the pre-history state. */
|
|
48
|
+
jumpTo(index: number): HistoryRestoreResult;
|
|
49
|
+
private restoreEntry;
|
|
50
|
+
private emit;
|
|
51
|
+
}
|
|
52
|
+
export declare function createTweakHistory(): TweakHistory;
|
|
53
|
+
/** Reactive facade consumed by the later history UI. */
|
|
54
|
+
export declare function useHistory(history: TweakHistory): {
|
|
55
|
+
undo: () => HistoryRestoreResult;
|
|
56
|
+
redo: () => HistoryRestoreResult;
|
|
57
|
+
jumpTo: (index: number) => HistoryRestoreResult;
|
|
58
|
+
entries: readonly TweakHistoryEntry[];
|
|
59
|
+
cursor: number;
|
|
60
|
+
canUndo: boolean;
|
|
61
|
+
canRedo: boolean;
|
|
62
|
+
lastSkippedReason: string | null;
|
|
63
|
+
};
|
|
64
|
+
export {};
|
package/dist/state/persist.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `usePersist` hook —
|
|
3
|
-
*
|
|
2
|
+
* `usePersist` hook — adapts slice updaters to the panel's single state
|
|
3
|
+
* transaction path. Each callback is a persist pipeline:
|
|
4
4
|
*
|
|
5
|
-
* updater →
|
|
5
|
+
* updater → commitTweakState('persist', updater)
|
|
6
6
|
*
|
|
7
7
|
* The slice-specific helpers (`persistColor`, `persistSpacing`, etc.) wrap a
|
|
8
8
|
* slice updater into a full-state updater so callers don't have to thread the
|
|
9
9
|
* whole envelope themselves.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* In practice the panel passes Preact's `setState` from `useState`.
|
|
11
|
+
* The transaction owns apply/save/setState ordering and history recording;
|
|
12
|
+
* this hook only lifts legacy slice callbacks into whole-state updaters.
|
|
14
13
|
*
|
|
15
14
|
* `persistColor`'s updater is `(prev: ColorTweakState) => ColorTweakState`, so
|
|
16
15
|
* the widened `ColorTweakState.semanticMappings: Record<string, SemanticValue>`
|
|
@@ -21,18 +20,15 @@
|
|
|
21
20
|
*/
|
|
22
21
|
import { type ColorTweakState, type TabOverrides, type TokenOverrides, type TweakState } from './tweak-state';
|
|
23
22
|
import type { PanelConfig } from '../config/panel-config';
|
|
24
|
-
type
|
|
23
|
+
import type { CommitTweakStateOptions, TweakStateUpdater } from './transaction';
|
|
24
|
+
type CommitTweakState = (reason: string, updater: TweakStateUpdater, options?: CommitTweakStateOptions) => void;
|
|
25
25
|
/**
|
|
26
26
|
* `usePersist` hook.
|
|
27
27
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* of `document.documentElement`, AND its `storagePrefix` scopes the persisted
|
|
31
|
-
* envelope to THIS instance's storage key (multi-instance, #357). Omitting
|
|
32
|
-
* `cfg` resolves the default instance via `getPanelConfig()` inside both
|
|
33
|
-
* `applyFullState` and `savePersistedState`, preserving the single-panel path.
|
|
28
|
+
* `cfg` remains accepted for API compatibility; instance scoping is owned by
|
|
29
|
+
* the supplied transaction.
|
|
34
30
|
*/
|
|
35
|
-
export declare function usePersist(
|
|
31
|
+
export declare function usePersist(commitTweakState: CommitTweakState, cfg?: PanelConfig): {
|
|
36
32
|
persist: (updater: (prev: TweakState) => TweakState) => void;
|
|
37
33
|
persistTab: (tabId: string, updater: (prev: TabOverrides) => TabOverrides) => void;
|
|
38
34
|
persistColor: (updater: (prev: ColorTweakState) => ColorTweakState) => void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { PanelConfig } from '../config/panel-config';
|
|
2
|
+
import { type TweakHistory } from './history';
|
|
3
|
+
import { type TweakState } from './tweak-state';
|
|
4
|
+
export type TweakStateUpdater = TweakState | ((previous: TweakState) => TweakState);
|
|
5
|
+
type SetState = (updater: (previous: TweakState | null) => TweakState | null) => void;
|
|
6
|
+
export interface CommitTweakStateOptions {
|
|
7
|
+
address?: string;
|
|
8
|
+
record?: boolean;
|
|
9
|
+
forceRecord?: boolean;
|
|
10
|
+
resetHistory?: boolean;
|
|
11
|
+
timestamp?: number;
|
|
12
|
+
beforeApply?: () => void;
|
|
13
|
+
apply?: false | ((next: TweakState) => void);
|
|
14
|
+
save?: false | ((next: TweakState) => void);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The sole state-mutation pipeline for a mounted panel. Side effects retain
|
|
18
|
+
* the established order: apply, persist, then publish component state.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useTweakStateTransaction(state: TweakState | null, setState: SetState, cfg: PanelConfig): {
|
|
21
|
+
commitTweakState: (reason: string, next: TweakStateUpdater, opts?: CommitTweakStateOptions) => void;
|
|
22
|
+
history: TweakHistory;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -90,6 +90,22 @@ export declare function getOpenKey(cfg?: PanelConfig): string;
|
|
|
90
90
|
export declare function getPositionKey(cfg?: PanelConfig): string;
|
|
91
91
|
export declare function getSizeKey(cfg?: PanelConfig): string;
|
|
92
92
|
export declare function getDensityKey(cfg?: PanelConfig): string;
|
|
93
|
+
export declare function getSnapshotKey(slot: 'a' | 'b', cfg?: PanelConfig): string;
|
|
94
|
+
export declare function getSnapshotAKey(cfg?: PanelConfig): string;
|
|
95
|
+
export declare function getSnapshotBKey(cfg?: PanelConfig): string;
|
|
96
|
+
export type DockMode = 'float' | 'right' | 'bottom' | 'mini';
|
|
97
|
+
export interface DockSize {
|
|
98
|
+
right: number;
|
|
99
|
+
bottom: number;
|
|
100
|
+
}
|
|
101
|
+
export declare const DEFAULT_DOCK_MODE: DockMode;
|
|
102
|
+
export declare const DEFAULT_DOCK_SIZE: DockSize;
|
|
103
|
+
export declare function getDockKey(cfg?: PanelConfig): string;
|
|
104
|
+
export declare function getDockSizeKey(cfg?: PanelConfig): string;
|
|
105
|
+
export declare function loadDockMode(cfg?: PanelConfig, storage?: StorageLike): DockMode;
|
|
106
|
+
export declare function saveDockMode(mode: DockMode, cfg?: PanelConfig, storage?: StorageLike): void;
|
|
107
|
+
export declare function loadDockSize(cfg?: PanelConfig, storage?: StorageLike): DockSize;
|
|
108
|
+
export declare function saveDockSize(size: DockSize, cfg?: PanelConfig, storage?: StorageLike): void;
|
|
93
109
|
export interface PanelPosition {
|
|
94
110
|
top: number;
|
|
95
111
|
left: number;
|
|
@@ -28,6 +28,8 @@ export declare const Z: {
|
|
|
28
28
|
readonly colorPicker: 2147482993;
|
|
29
29
|
/** DOM tooltip portaled to document.body. */
|
|
30
30
|
readonly tooltip: 2147482994;
|
|
31
|
+
/** Command palette overlay rendered inside the shell. */
|
|
32
|
+
readonly commandPalette: 2147482995;
|
|
31
33
|
/** Element-path inspector box (body-mounted). */
|
|
32
34
|
readonly inspectorBox: 2147483000;
|
|
33
35
|
/** Element-path toast (body-mounted). */
|