@tooee/choose 0.8.0 → 0.9.0
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/choose-filter.d.ts +2 -11
- package/dist/choose-filter.d.ts.map +1 -1
- package/dist/choose-filter.js +1 -19
- package/dist/choose-filter.js.map +1 -1
- package/dist/choose-highlighted-text.d.ts +2 -8
- package/dist/choose-highlighted-text.d.ts.map +1 -1
- package/dist/choose-highlighted-text.js +1 -31
- package/dist/choose-highlighted-text.js.map +1 -1
- package/dist/choose-list.d.ts +2 -27
- package/dist/choose-list.d.ts.map +1 -1
- package/dist/choose-list.js +1 -65
- package/dist/choose-list.js.map +1 -1
- package/dist/choose-store.d.ts +2 -56
- package/dist/choose-store.d.ts.map +1 -1
- package/dist/choose-store.js +1 -101
- package/dist/choose-store.js.map +1 -1
- package/dist/choose.d.ts +1 -5
- package/dist/choose.d.ts.map +1 -1
- package/dist/choose.js +3 -19
- package/dist/choose.js.map +1 -1
- package/dist/choose.public-contract.typecheck.d.ts +11 -0
- package/dist/choose.public-contract.typecheck.d.ts.map +1 -0
- package/dist/choose.public-contract.typecheck.js +2 -0
- package/dist/choose.public-contract.typecheck.js.map +1 -0
- package/dist/fuzzy.d.ts +2 -8
- package/dist/fuzzy.d.ts.map +1 -1
- package/dist/fuzzy.js +1 -4
- package/dist/fuzzy.js.map +1 -1
- package/dist/launch.d.ts.map +1 -1
- package/dist/launch.js +1 -0
- package/dist/launch.js.map +1 -1
- package/dist/source.d.ts +1 -4
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +1 -25
- package/dist/source.js.map +1 -1
- package/dist/types.d.ts +1 -21
- package/dist/types.d.ts.map +1 -1
- package/dist/use-choose.d.ts +2 -79
- package/dist/use-choose.d.ts.map +1 -1
- package/dist/use-choose.js +1 -374
- package/dist/use-choose.js.map +1 -1
- package/package.json +7 -9
- package/src/choose-filter.tsx +2 -55
- package/src/choose-highlighted-text.tsx +2 -49
- package/src/choose-list.tsx +2 -156
- package/src/choose-store.ts +12 -146
- package/src/choose.public-contract.typecheck.ts +12 -0
- package/src/choose.tsx +15 -35
- package/src/fuzzy.ts +2 -13
- package/src/launch.tsx +1 -0
- package/src/source.ts +1 -36
- package/src/types.ts +7 -28
- package/src/use-choose.ts +9 -521
package/dist/choose-filter.d.ts
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface ChooseFilterProps {
|
|
4
|
-
choose: UseChooseResult;
|
|
5
|
-
prompt?: ReactNode;
|
|
6
|
-
placeholder?: string;
|
|
7
|
-
right?: ReactNode;
|
|
8
|
-
onClose?: () => void;
|
|
9
|
-
}
|
|
10
|
-
/** Controlled filter row shared by fullscreen and overlay chooser assemblies. */
|
|
11
|
-
export declare const ChooseFilter: ({ choose, prompt, placeholder, right, onClose, }: ChooseFilterProps) => ReactNode;
|
|
1
|
+
export { ChooseFilter } from "@tooee/renderers";
|
|
2
|
+
export type { ChooseFilterProps } from "@tooee/renderers";
|
|
12
3
|
//# sourceMappingURL=choose-filter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choose-filter.d.ts","sourceRoot":"","sources":["../src/choose-filter.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"choose-filter.d.ts","sourceRoot":"","sources":["../src/choose-filter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/choose-filter.js
CHANGED
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { CloseButton, decodeReactContent } from "@tooee/layout";
|
|
3
|
-
import { useTheme } from "@tooee/themes";
|
|
4
|
-
/** Controlled filter row shared by fullscreen and overlay chooser assemblies. */
|
|
5
|
-
export const ChooseFilter = function ChooseFilter({ choose, prompt = "> ", placeholder = "Filter...", right, onClose, }) {
|
|
6
|
-
const { theme } = useTheme();
|
|
7
|
-
const { state, view } = choose;
|
|
8
|
-
const handleFilterInput = view.onFilterInput;
|
|
9
|
-
const handleFilterKeyDown = view.onFilterKeyDown;
|
|
10
|
-
const promptContent = decodeReactContent(prompt);
|
|
11
|
-
let renderedPrompt = null;
|
|
12
|
-
if (promptContent.kind === "string") {
|
|
13
|
-
renderedPrompt = _jsx("text", { content: promptContent.value, fg: theme.accent });
|
|
14
|
-
}
|
|
15
|
-
else if (promptContent.kind === "node") {
|
|
16
|
-
renderedPrompt = promptContent.value;
|
|
17
|
-
}
|
|
18
|
-
return (_jsxs("box", { flexDirection: "row", height: 1, style: { paddingLeft: 1, paddingRight: 1 }, children: [renderedPrompt, _jsx("input", { ref: view.filterRef, focused: view.filterFocused, value: state.filterQuery, placeholder: placeholder, onInput: handleFilterInput, onKeyDown: handleFilterKeyDown, backgroundColor: "transparent", textColor: theme.text, placeholderColor: theme.textMuted, cursorColor: theme.primary, style: { flexGrow: 1 } }), _jsx("text", { content: ` ${state.matches.length}/${state.items.length}`, fg: theme.textMuted }), right, onClose && _jsx(CloseButton, { onClose: onClose })] }));
|
|
19
|
-
};
|
|
1
|
+
export { ChooseFilter } from "@tooee/renderers";
|
|
20
2
|
//# sourceMappingURL=choose-filter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choose-filter.js","sourceRoot":"","sources":["../src/choose-filter.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"choose-filter.js","sourceRoot":"","sources":["../src/choose-filter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
text: string;
|
|
4
|
-
positions: number[];
|
|
5
|
-
highlightColor: string;
|
|
6
|
-
}
|
|
7
|
-
/** Render fuzzy-match characters with one shared segmentation implementation. */
|
|
8
|
-
export declare const ChooseHighlightedText: ({ text, positions, highlightColor, }: ChooseHighlightedTextProps) => ReactNode;
|
|
1
|
+
export { ChooseHighlightedText } from "@tooee/renderers";
|
|
2
|
+
export type { ChooseHighlightedTextProps } from "@tooee/renderers";
|
|
9
3
|
//# sourceMappingURL=choose-highlighted-text.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choose-highlighted-text.d.ts","sourceRoot":"","sources":["../src/choose-highlighted-text.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"choose-highlighted-text.d.ts","sourceRoot":"","sources":["../src/choose-highlighted-text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,YAAY,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,32 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { Fragment } from "react";
|
|
3
|
-
/** Render fuzzy-match characters with one shared segmentation implementation. */
|
|
4
|
-
export const ChooseHighlightedText = function ChooseHighlightedText({ text, positions, highlightColor, }) {
|
|
5
|
-
if (positions.length === 0) {
|
|
6
|
-
return text;
|
|
7
|
-
}
|
|
8
|
-
const positionSet = new Set(positions);
|
|
9
|
-
const parts = [];
|
|
10
|
-
let current = "";
|
|
11
|
-
let currentHighlighted = false;
|
|
12
|
-
for (let index = 0; index < text.length; index += 1) {
|
|
13
|
-
const highlighted = positionSet.has(index);
|
|
14
|
-
if (index === 0) {
|
|
15
|
-
current = text[index];
|
|
16
|
-
currentHighlighted = highlighted;
|
|
17
|
-
}
|
|
18
|
-
else if (highlighted === currentHighlighted) {
|
|
19
|
-
current += text[index];
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
parts.push({ highlighted: currentHighlighted, text: current });
|
|
23
|
-
current = text[index];
|
|
24
|
-
currentHighlighted = highlighted;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
if (current) {
|
|
28
|
-
parts.push({ highlighted: currentHighlighted, text: current });
|
|
29
|
-
}
|
|
30
|
-
return parts.map((part, index) => (_jsx(Fragment, { children: part.highlighted ? _jsx("span", { fg: highlightColor, children: part.text }) : part.text }, index)));
|
|
31
|
-
};
|
|
1
|
+
export { ChooseHighlightedText } from "@tooee/renderers";
|
|
32
2
|
//# sourceMappingURL=choose-highlighted-text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choose-highlighted-text.js","sourceRoot":"","sources":["../src/choose-highlighted-text.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"choose-highlighted-text.js","sourceRoot":"","sources":["../src/choose-highlighted-text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/choose-list.d.ts
CHANGED
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import type { ChooseItem } from "./types.js";
|
|
4
|
-
import type { UseChooseResult } from "./use-choose.js";
|
|
5
|
-
export interface ChooseItemRenderContext {
|
|
6
|
-
item: ChooseItem;
|
|
7
|
-
match: FuzzyMatch;
|
|
8
|
-
index: number;
|
|
9
|
-
originalIndex: number;
|
|
10
|
-
positions: number[];
|
|
11
|
-
isActive: boolean;
|
|
12
|
-
isSelected: boolean;
|
|
13
|
-
defaultContent: ReactNode;
|
|
14
|
-
}
|
|
15
|
-
export interface ChooseListProps {
|
|
16
|
-
choose: UseChooseResult;
|
|
17
|
-
/** Fullscreen defaults to activate; picker overlays default to submit. */
|
|
18
|
-
rowClick?: "activate" | "submit" | "none";
|
|
19
|
-
renderItem?: (context: ChooseItemRenderContext) => ReactNode;
|
|
20
|
-
loadingContent?: ReactNode;
|
|
21
|
-
errorContent?: (error: string) => ReactNode;
|
|
22
|
-
emptyContent?: ReactNode;
|
|
23
|
-
/** Mouse guard for visible rows covered by another surface. */
|
|
24
|
-
suspended?: boolean;
|
|
25
|
-
}
|
|
26
|
-
/** Scrollable chooser rows plus loading/error/empty presentation. */
|
|
27
|
-
export declare const ChooseList: ({ choose, rowClick, renderItem, loadingContent, errorContent, emptyContent, suspended, }: ChooseListProps) => ReactNode;
|
|
1
|
+
export { ChooseList } from "@tooee/renderers";
|
|
2
|
+
export type { ChooseItemRenderContext, ChooseListProps } from "@tooee/renderers";
|
|
28
3
|
//# sourceMappingURL=choose-list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choose-list.d.ts","sourceRoot":"","sources":["../src/choose-list.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"choose-list.d.ts","sourceRoot":"","sources":["../src/choose-list.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,YAAY,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/choose-list.js
CHANGED
|
@@ -1,66 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { useEffect, useRef } from "react";
|
|
3
|
-
import { decodeReactContent } from "@tooee/layout";
|
|
4
|
-
import { useTheme } from "@tooee/themes";
|
|
5
|
-
import { ChooseHighlightedText } from "./choose-highlighted-text.js";
|
|
6
|
-
const ThemedLine = function ThemedLine({ content, color, }) {
|
|
7
|
-
const decoded = decodeReactContent(content);
|
|
8
|
-
let rendered = null;
|
|
9
|
-
if (decoded.kind === "string") {
|
|
10
|
-
rendered = _jsx("text", { content: decoded.value, fg: color });
|
|
11
|
-
}
|
|
12
|
-
else if (decoded.kind === "node") {
|
|
13
|
-
rendered = decoded.value;
|
|
14
|
-
}
|
|
15
|
-
return (_jsx("box", { height: 1, style: { paddingLeft: 2 }, children: rendered }));
|
|
16
|
-
};
|
|
17
|
-
const defaultErrorContent = function defaultErrorContent(error) {
|
|
18
|
-
return `Error: ${error}`;
|
|
19
|
-
};
|
|
20
|
-
/** Scrollable chooser rows plus loading/error/empty presentation. */
|
|
21
|
-
export const ChooseList = function ChooseList({ choose, rowClick = "activate", renderItem, loadingContent = "Loading...", errorContent = defaultErrorContent, emptyContent, suspended, }) {
|
|
22
|
-
const { theme } = useTheme();
|
|
23
|
-
const scrollRef = useRef(null);
|
|
24
|
-
const { state, controller } = choose;
|
|
25
|
-
const interactionSuspended = choose.view.suspended || (suspended ?? false);
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
const activeMatch = state.matches[state.activeIndex];
|
|
28
|
-
if (scrollRef.current && activeMatch !== undefined) {
|
|
29
|
-
scrollRef.current.scrollChildIntoView(`choose-item-${activeMatch.originalIndex}`);
|
|
30
|
-
}
|
|
31
|
-
}, [state.activeIndex, state.matches]);
|
|
32
|
-
return (_jsxs("scrollbox", { ref: scrollRef, style: { flexGrow: 1 }, focused: false, children: [state.loading && _jsx(ThemedLine, { content: loadingContent, color: theme.textMuted }), !state.loading && state.error !== null && state.error !== "" && (_jsx(ThemedLine, { content: errorContent(state.error), color: theme.error })), !state.loading &&
|
|
33
|
-
(state.error?.length ?? 0) === 0 &&
|
|
34
|
-
state.matches.length === 0 &&
|
|
35
|
-
emptyContent !== null &&
|
|
36
|
-
emptyContent !== undefined && _jsx(ThemedLine, { content: emptyContent, color: theme.textMuted }), state.matches.map((match, index) => {
|
|
37
|
-
const isActive = index === state.activeIndex;
|
|
38
|
-
const isSelected = state.selectedOriginalIndices.has(match.originalIndex);
|
|
39
|
-
const defaultContent = (_jsxs("text", { fg: isActive ? theme.primary : theme.text, style: { flexGrow: 1 }, children: [state.multi && (_jsx("span", { fg: isSelected ? theme.accent : theme.textMuted, children: isSelected ? "✓ " : " " })), (match.item.icon?.length ?? 0) > 0 && (_jsx("span", { fg: theme.textMuted, children: `${match.item.icon} ` })), _jsx(ChooseHighlightedText, { text: match.item.text, positions: match.positions, highlightColor: theme.warning }), (match.item.description?.length ?? 0) > 0 && (_jsx("span", { fg: theme.textMuted, children: ` ${match.item.description}` }))] }));
|
|
40
|
-
const context = {
|
|
41
|
-
defaultContent,
|
|
42
|
-
index,
|
|
43
|
-
isActive,
|
|
44
|
-
isSelected,
|
|
45
|
-
item: match.item,
|
|
46
|
-
match,
|
|
47
|
-
originalIndex: match.originalIndex,
|
|
48
|
-
positions: match.positions,
|
|
49
|
-
};
|
|
50
|
-
return (_jsx("box", { id: `choose-item-${match.originalIndex}`, flexDirection: "row", backgroundColor: isActive ? theme.backgroundElement : undefined, style: { paddingLeft: 1, paddingRight: 1 }, onMouseDown: (event) => {
|
|
51
|
-
if (interactionSuspended || event.button !== 0 || rowClick === "none") {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
if (rowClick === "submit") {
|
|
55
|
-
event.preventDefault();
|
|
56
|
-
event.stopPropagation();
|
|
57
|
-
controller.setActiveIndex(index);
|
|
58
|
-
controller.submit();
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
controller.setActiveIndex(index);
|
|
62
|
-
}
|
|
63
|
-
}, children: renderItem ? renderItem(context) : defaultContent }, match.originalIndex));
|
|
64
|
-
})] }));
|
|
65
|
-
};
|
|
1
|
+
export { ChooseList } from "@tooee/renderers";
|
|
66
2
|
//# sourceMappingURL=choose-list.js.map
|
package/dist/choose-list.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choose-list.js","sourceRoot":"","sources":["../src/choose-list.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"choose-list.js","sourceRoot":"","sources":["../src/choose-list.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/choose-store.d.ts
CHANGED
|
@@ -1,57 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface ChooseStoreContext {
|
|
4
|
-
items: ChooseItem[];
|
|
5
|
-
matches: FuzzyMatch[];
|
|
6
|
-
filterQuery: string;
|
|
7
|
-
activeIndex: number;
|
|
8
|
-
selectedOriginalIndices: ReadonlySet<number>;
|
|
9
|
-
loading: boolean;
|
|
10
|
-
error: string | null;
|
|
11
|
-
requestId: number;
|
|
12
|
-
reloadRevision: number;
|
|
13
|
-
}
|
|
14
|
-
interface ChooseStoreEventDefinitions {
|
|
15
|
-
filterChanged: {
|
|
16
|
-
query: string;
|
|
17
|
-
};
|
|
18
|
-
activeIndexSet: {
|
|
19
|
-
index: number;
|
|
20
|
-
};
|
|
21
|
-
moved: {
|
|
22
|
-
delta: number;
|
|
23
|
-
};
|
|
24
|
-
activeToggled: Record<never, never>;
|
|
25
|
-
requestStarted: Record<never, never>;
|
|
26
|
-
loadingStarted: {
|
|
27
|
-
requestId: number;
|
|
28
|
-
};
|
|
29
|
-
loadSucceeded: {
|
|
30
|
-
requestId: number;
|
|
31
|
-
items: ChooseItem[];
|
|
32
|
-
};
|
|
33
|
-
loadFailed: {
|
|
34
|
-
requestId: number;
|
|
35
|
-
error: string;
|
|
36
|
-
};
|
|
37
|
-
reloadRequested: Record<never, never>;
|
|
38
|
-
}
|
|
39
|
-
export type ChooseStoreEvents = {
|
|
40
|
-
[EventName in keyof ChooseStoreEventDefinitions]: ChooseStoreEventDefinitions[EventName];
|
|
41
|
-
};
|
|
42
|
-
export declare const createChooseStore: (options: {
|
|
43
|
-
items?: ChooseItem[];
|
|
44
|
-
initialFilter?: string;
|
|
45
|
-
loading?: boolean;
|
|
46
|
-
}) => import("@xstate/store").Store<ChooseStoreContext, ChooseStoreEvents, never>;
|
|
47
|
-
export type ChooseStore = ReturnType<typeof createChooseStore>;
|
|
48
|
-
export declare const selectItems: (ctx: ChooseStoreContext) => ChooseItem[];
|
|
49
|
-
export declare const selectMatches: (ctx: ChooseStoreContext) => FuzzyMatch[];
|
|
50
|
-
export declare const selectFilterQuery: (ctx: ChooseStoreContext) => string;
|
|
51
|
-
export declare const selectActiveIndex: (ctx: ChooseStoreContext) => number;
|
|
52
|
-
export declare const selectSelectedOriginalIndices: (ctx: ChooseStoreContext) => ReadonlySet<number>;
|
|
53
|
-
export declare const selectLoading: (ctx: ChooseStoreContext) => boolean;
|
|
54
|
-
export declare const selectError: (ctx: ChooseStoreContext) => string | null;
|
|
55
|
-
export declare const selectReloadRevision: (ctx: ChooseStoreContext) => number;
|
|
56
|
-
export {};
|
|
1
|
+
export { createChooseStore, selectActiveIndex, selectError, selectFilterQuery, selectItems, selectLoading, selectMatches, selectReloadRevision, selectSelectedOriginalIndices, } from "@tooee/renderers";
|
|
2
|
+
export type { ChooseStore, ChooseStoreContext, ChooseStoreEvents } from "@tooee/renderers";
|
|
57
3
|
//# sourceMappingURL=choose-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choose-store.d.ts","sourceRoot":"","sources":["../src/choose-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"choose-store.d.ts","sourceRoot":"","sources":["../src/choose-store.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,6BAA6B,GAC9B,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/choose-store.js
CHANGED
|
@@ -1,102 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { fuzzyFilter } from "./fuzzy.js";
|
|
3
|
-
const replaceItems = function replaceItems(ctx, items) {
|
|
4
|
-
return {
|
|
5
|
-
...ctx,
|
|
6
|
-
activeIndex: 0,
|
|
7
|
-
items,
|
|
8
|
-
matches: fuzzyFilter(items, ctx.filterQuery),
|
|
9
|
-
selectedOriginalIndices: new Set(),
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
const clampActiveIndex = function clampActiveIndex(index, matchCount) {
|
|
13
|
-
return Math.min(Math.max(0, matchCount - 1), Math.max(0, index));
|
|
14
|
-
};
|
|
15
|
-
export const createChooseStore = function createChooseStore(options) {
|
|
16
|
-
const items = options.items ?? [];
|
|
17
|
-
const filterQuery = options.initialFilter ?? "";
|
|
18
|
-
return createStore({
|
|
19
|
-
context: {
|
|
20
|
-
activeIndex: 0,
|
|
21
|
-
error: null,
|
|
22
|
-
filterQuery,
|
|
23
|
-
items,
|
|
24
|
-
loading: options.loading ?? false,
|
|
25
|
-
matches: fuzzyFilter(items, filterQuery),
|
|
26
|
-
reloadRevision: 0,
|
|
27
|
-
requestId: 0,
|
|
28
|
-
selectedOriginalIndices: new Set(),
|
|
29
|
-
},
|
|
30
|
-
on: {
|
|
31
|
-
activeIndexSet: (ctx, event) => {
|
|
32
|
-
const activeIndex = clampActiveIndex(event.index, ctx.matches.length);
|
|
33
|
-
return activeIndex === ctx.activeIndex ? ctx : { ...ctx, activeIndex };
|
|
34
|
-
},
|
|
35
|
-
activeToggled: (ctx) => {
|
|
36
|
-
const originalIndex = ctx.matches[ctx.activeIndex]?.originalIndex;
|
|
37
|
-
if (originalIndex === undefined) {
|
|
38
|
-
return ctx;
|
|
39
|
-
}
|
|
40
|
-
const selectedOriginalIndices = new Set(ctx.selectedOriginalIndices);
|
|
41
|
-
if (selectedOriginalIndices.has(originalIndex)) {
|
|
42
|
-
selectedOriginalIndices.delete(originalIndex);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
selectedOriginalIndices.add(originalIndex);
|
|
46
|
-
}
|
|
47
|
-
return { ...ctx, selectedOriginalIndices };
|
|
48
|
-
},
|
|
49
|
-
filterChanged: (ctx, event) => {
|
|
50
|
-
if (event.query === ctx.filterQuery) {
|
|
51
|
-
return ctx;
|
|
52
|
-
}
|
|
53
|
-
return {
|
|
54
|
-
...ctx,
|
|
55
|
-
activeIndex: 0,
|
|
56
|
-
filterQuery: event.query,
|
|
57
|
-
matches: fuzzyFilter(ctx.items, event.query),
|
|
58
|
-
};
|
|
59
|
-
},
|
|
60
|
-
loadFailed: (ctx, event) => {
|
|
61
|
-
if (event.requestId !== ctx.requestId) {
|
|
62
|
-
return ctx;
|
|
63
|
-
}
|
|
64
|
-
return {
|
|
65
|
-
...replaceItems(ctx, []),
|
|
66
|
-
error: event.error,
|
|
67
|
-
loading: false,
|
|
68
|
-
};
|
|
69
|
-
},
|
|
70
|
-
loadSucceeded: (ctx, event) => {
|
|
71
|
-
if (event.requestId !== ctx.requestId) {
|
|
72
|
-
return ctx;
|
|
73
|
-
}
|
|
74
|
-
return {
|
|
75
|
-
...replaceItems(ctx, event.items),
|
|
76
|
-
error: null,
|
|
77
|
-
loading: false,
|
|
78
|
-
};
|
|
79
|
-
},
|
|
80
|
-
loadingStarted: (ctx, event) => event.requestId === ctx.requestId && !ctx.loading ? { ...ctx, loading: true } : ctx,
|
|
81
|
-
moved: (ctx, event) => {
|
|
82
|
-
const activeIndex = clampActiveIndex(ctx.activeIndex + event.delta, ctx.matches.length);
|
|
83
|
-
return activeIndex === ctx.activeIndex ? ctx : { ...ctx, activeIndex };
|
|
84
|
-
},
|
|
85
|
-
reloadRequested: (ctx) => ({ ...ctx, reloadRevision: ctx.reloadRevision + 1 }),
|
|
86
|
-
requestStarted: (ctx) => ({
|
|
87
|
-
...ctx,
|
|
88
|
-
error: null,
|
|
89
|
-
requestId: ctx.requestId + 1,
|
|
90
|
-
}),
|
|
91
|
-
},
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
export const selectItems = (ctx) => ctx.items;
|
|
95
|
-
export const selectMatches = (ctx) => ctx.matches;
|
|
96
|
-
export const selectFilterQuery = (ctx) => ctx.filterQuery;
|
|
97
|
-
export const selectActiveIndex = (ctx) => ctx.activeIndex;
|
|
98
|
-
export const selectSelectedOriginalIndices = (ctx) => ctx.selectedOriginalIndices;
|
|
99
|
-
export const selectLoading = (ctx) => ctx.loading;
|
|
100
|
-
export const selectError = (ctx) => ctx.error;
|
|
101
|
-
export const selectReloadRevision = (ctx) => ctx.reloadRevision;
|
|
1
|
+
export { createChooseStore, selectActiveIndex, selectError, selectFilterQuery, selectItems, selectLoading, selectMatches, selectReloadRevision, selectSelectedOriginalIndices, } from "@tooee/renderers";
|
|
102
2
|
//# sourceMappingURL=choose-store.js.map
|
package/dist/choose-store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choose-store.js","sourceRoot":"","sources":["../src/choose-store.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"choose-store.js","sourceRoot":"","sources":["../src/choose-store.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,6BAA6B,GAC9B,MAAM,kBAAkB,CAAC"}
|
package/dist/choose.d.ts
CHANGED
|
@@ -5,11 +5,7 @@ import type { ChooseContentProvider, ChooseOptions, ChooseResult } from "./types
|
|
|
5
5
|
import type { ChooseController } from "./use-choose.js";
|
|
6
6
|
export interface ChooseProps extends ChooseOptions {
|
|
7
7
|
contentProvider: ChooseContentProvider;
|
|
8
|
-
/** @deprecated Pass chooser options as top-level props. This alias will be removed in 0.9.0. */
|
|
9
|
-
options?: ChooseOptions;
|
|
10
8
|
actions?: ActionDefinition[];
|
|
11
|
-
/** @deprecated Use `actions`. This alias will be removed in 0.9.0. */
|
|
12
|
-
commands?: ActionDefinition[];
|
|
13
9
|
controllerRef?: Ref<ChooseController>;
|
|
14
10
|
renderItem?: ChooseListProps["renderItem"];
|
|
15
11
|
/**
|
|
@@ -24,5 +20,5 @@ export interface ChooseProps extends ChooseOptions {
|
|
|
24
20
|
/** Called when the chooser is cancelled (quit, or submit with no selection). */
|
|
25
21
|
onCancel?: () => void;
|
|
26
22
|
}
|
|
27
|
-
export declare const Choose: (
|
|
23
|
+
export declare const Choose: ({ contentProvider, actions, controllerRef, emptyMessage, multi, onCancel, onConfirm, placeholder, prompt, renderItem, title, }: ChooseProps) => ReactNode;
|
|
28
24
|
//# sourceMappingURL=choose.d.ts.map
|
package/dist/choose.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choose.d.ts","sourceRoot":"","sources":["../src/choose.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAM5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,KAAK,EAAE,qBAAqB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAErF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,MAAM,WAAW,WAAY,SAAQ,aAAa;IAChD,eAAe,EAAE,qBAAqB,CAAC;IACvC,
|
|
1
|
+
{"version":3,"file":"choose.d.ts","sourceRoot":"","sources":["../src/choose.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAM5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,KAAK,EAAE,qBAAqB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAErF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,MAAM,WAAW,WAAY,SAAQ,aAAa;IAChD,eAAe,EAAE,qBAAqB,CAAC;IACvC,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC7B,aAAa,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;IACtC,UAAU,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;IAC3C;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IAC3C,gFAAgF;IAChF,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,eAAO,MAAM,MAAM,mIAYhB,WAAW,KAAG,SA2FhB,CAAC"}
|
package/dist/choose.js
CHANGED
|
@@ -9,23 +9,7 @@ import { ChooseFilter } from "./choose-filter.js";
|
|
|
9
9
|
import { ChooseList } from "./choose-list.js";
|
|
10
10
|
import { buildChooseHints } from "./choose-panel.js";
|
|
11
11
|
import { useChoose } from "./use-choose.js";
|
|
12
|
-
const
|
|
13
|
-
// oxlint-disable-next-line typescript/no-deprecated -- compatibility alias remains supported until 0.9.0
|
|
14
|
-
const { options } = props;
|
|
15
|
-
// oxlint-disable-next-line typescript/no-deprecated -- compatibility alias remains supported until 0.9.0
|
|
16
|
-
const { commands } = props;
|
|
17
|
-
return {
|
|
18
|
-
actions: props.actions ?? commands,
|
|
19
|
-
emptyMessage: props.emptyMessage ?? options?.emptyMessage,
|
|
20
|
-
multi: props.multi ?? options?.multi,
|
|
21
|
-
placeholder: props.placeholder ?? options?.placeholder,
|
|
22
|
-
prompt: props.prompt ?? options?.prompt,
|
|
23
|
-
title: props.title ?? options?.title,
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
export const Choose = function Choose(props) {
|
|
27
|
-
const { contentProvider, controllerRef, renderItem, onConfirm, onCancel } = props;
|
|
28
|
-
const { actions: effectiveActions, emptyMessage, multi = false, placeholder, prompt, title, } = resolveChooseProps(props);
|
|
12
|
+
export const Choose = function Choose({ contentProvider, actions, controllerRef, emptyMessage, multi = false, onCancel, onConfirm, placeholder, prompt, renderItem, title, }) {
|
|
29
13
|
const { theme } = useTheme();
|
|
30
14
|
const { invoke } = useSurfaceInvoke();
|
|
31
15
|
const { name: themeName } = useThemeCommands();
|
|
@@ -33,13 +17,13 @@ export const Choose = function Choose(props) {
|
|
|
33
17
|
const hasOverlay = useHasOverlay();
|
|
34
18
|
const hasModalOverlay = useHasModalOverlay();
|
|
35
19
|
const choose = useChoose({
|
|
36
|
-
commands:
|
|
20
|
+
commands: actions,
|
|
37
21
|
multi,
|
|
38
22
|
onCancel,
|
|
39
23
|
onSubmit: (result) => {
|
|
40
24
|
// Standalone behaviour: a command named `submit` wins over `onConfirm`, so
|
|
41
25
|
// action-driven CLIs keep their own submit semantics.
|
|
42
|
-
if (
|
|
26
|
+
if (actions?.some((action) => action.id === "submit") === true) {
|
|
43
27
|
invoke("submit");
|
|
44
28
|
return;
|
|
45
29
|
}
|
package/dist/choose.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choose.js","sourceRoot":"","sources":["../src/choose.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"choose.js","sourceRoot":"","sources":["../src/choose.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,O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EAAE,QAAQ,EAClB,SAAS,EAAE;YACT,KAAK,EAAE;gBACL;oBACE,KAAK,EAAE,UAAU;oBACjB,KAAK,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE;iBACrE;gBACD,GAAG,CAAC,KAAK;oBACP,CAAC,CAAC;wBACE;4BACE,KAAK,EAAE,WAAW;4BAClB,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,IAAI,CAAC;yBACzD;qBACF;oBACH,CAAC,CAAC,EAAE,CAAC;gBACP,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE;gBACrC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;aACvC;SACF,YAED,eAAK,aAAa,EAAC,QAAQ,EAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,aAChD,KAAC,YAAY,IAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,GAAI,EAC1D,KAAC,UAAU,IACT,MAAM,EAAE,MAAM,EACd,QAAQ,EAAC,UAAU,EACnB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,eAAe,GAC1B,IACE,GACI,CACb,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Compile-time checks for the Choose component's 0.9 public props. */
|
|
2
|
+
import type { ChooseProps } from "./choose.js";
|
|
3
|
+
type Assert<T extends true> = T;
|
|
4
|
+
type IsNever<T> = [T] extends [never] ? true : false;
|
|
5
|
+
type Has<TKeys, TName> = [Extract<TKeys, TName>] extends [never] ? false : true;
|
|
6
|
+
type Props = keyof ChooseProps;
|
|
7
|
+
type RetainedProps = Assert<Has<Props, "actions" | "multi" | "prompt" | "title">>;
|
|
8
|
+
type RemovedProps = Assert<IsNever<Extract<Props, "commands" | "options">>>;
|
|
9
|
+
export type ChoosePublicContractChecks = [RetainedProps, RemovedProps];
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=choose.public-contract.typecheck.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"choose.public-contract.typecheck.d.ts","sourceRoot":"","sources":["../src/choose.public-contract.typecheck.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,KAAK,MAAM,CAAC,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC;AAChC,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC;AACrD,KAAK,GAAG,CAAC,KAAK,EAAE,KAAK,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC;AAEhF,KAAK,KAAK,GAAG,MAAM,WAAW,CAAC;AAC/B,KAAK,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC;AAClF,KAAK,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAE5E,MAAM,MAAM,0BAA0B,GAAG,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"choose.public-contract.typecheck.js","sourceRoot":"","sources":["../src/choose.public-contract.typecheck.ts"],"names":[],"mappings":""}
|
package/dist/fuzzy.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
item: ChooseItem;
|
|
4
|
-
originalIndex: number;
|
|
5
|
-
score: number;
|
|
6
|
-
positions: number[];
|
|
7
|
-
}
|
|
8
|
-
export declare const fuzzyFilter: (items: ChooseItem[], query: string) => FuzzyMatch[];
|
|
1
|
+
export { fuzzyFilter } from "@tooee/renderers";
|
|
2
|
+
export type { FuzzyMatch } from "@tooee/renderers";
|
|
9
3
|
//# sourceMappingURL=fuzzy.d.ts.map
|
package/dist/fuzzy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fuzzy.d.ts","sourceRoot":"","sources":["../src/fuzzy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fuzzy.d.ts","sourceRoot":"","sources":["../src/fuzzy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/fuzzy.js
CHANGED
package/dist/fuzzy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fuzzy.js","sourceRoot":"","sources":["../src/fuzzy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"fuzzy.js","sourceRoot":"","sources":["../src/fuzzy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/launch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launch.d.ts","sourceRoot":"","sources":["../src/launch.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,KAAK,EAAE,qBAAqB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAGrF,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,qBAAqB,CAAC;IACvC,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC9B;AAED,eAAO,MAAM,MAAM,SACX,mBAAmB,KACxB,OAAO,CAAC,YAAY,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"launch.d.ts","sourceRoot":"","sources":["../src/launch.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,KAAK,EAAE,qBAAqB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAGrF,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,qBAAqB,CAAC;IACvC,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC9B;AAED,eAAO,MAAM,MAAM,SACX,mBAAmB,KACxB,OAAO,CAAC,YAAY,GAAG,IAAI,CAsB7B,CAAC"}
|
package/dist/launch.js
CHANGED
|
@@ -5,6 +5,7 @@ export const launch = async function launch(opts) {
|
|
|
5
5
|
const result = await runCliSession(({ resolve, cancel }) => (_jsx(Choose, { contentProvider: opts.contentProvider, title: opts.options?.title, prompt: opts.options?.prompt, placeholder: opts.options?.placeholder, multi: opts.options?.multi, emptyMessage: opts.options?.emptyMessage, actions: opts.actions, onConfirm: resolve, onCancel: cancel })), {
|
|
6
6
|
provider: { initialMode: "insert" },
|
|
7
7
|
stdinPolicy: "tty-if-piped",
|
|
8
|
+
stdoutPolicy: "tty-if-redirected",
|
|
8
9
|
});
|
|
9
10
|
return result;
|
|
10
11
|
};
|
package/dist/launch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launch.js","sourceRoot":"","sources":["../src/launch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAUrC,MAAM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AI,CAAC,OAAO,EAAE,YAAY,EACxC,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,SAAS,EAAE,OAAO,EAClB,QAAQ,EAAE,MAAM,GAChB,CACH,EACD;QACE,QAAQ,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE;QACnC,WAAW,EAAE,cAAc;QAC3B,YAAY,EAAE,mBAAmB;KAClC,CACF,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
package/dist/source.d.ts
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
/** Resolve every public Choose source shape through one compatibility boundary. */
|
|
3
|
-
export declare const loadChooseSource: (source: ChooseSource) => ChooseItem[] | Promise<ChooseItem[]>;
|
|
4
|
-
export declare const chooseSourceError: (error: unknown) => string;
|
|
1
|
+
export { loadChooseSource } from "@tooee/renderers";
|
|
5
2
|
//# sourceMappingURL=source.d.ts.map
|
package/dist/source.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC"}
|