@tulip-systems/core 0.9.0 → 0.10.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/commands.d.mts +3 -2
- package/dist/commands.mjs +2 -1
- package/dist/components/ui/badge.d.mts +1 -1
- package/dist/components/ui/button-group.d.mts +1 -1
- package/dist/components/ui/button.d.mts +2 -2
- package/dist/components/ui/field.client.d.mts +1 -1
- package/dist/data-tables/client.d.mts +2 -1
- package/dist/data-tables/client.mjs +2 -1
- package/dist/modules/commands/components/menus/context-menu.client.d.mts +6 -7
- package/dist/modules/commands/components/menus/dropdown-menu.client.d.mts +6 -7
- package/dist/modules/commands/components/menus/floating-menu.client.d.mts +6 -7
- package/dist/modules/commands/components/menus/inline-menu.client.d.mts +6 -7
- package/dist/modules/commands/components/menus/responsive-menu.client.d.mts +5 -6
- package/dist/modules/commands/components/render-command.mjs +3 -5
- package/dist/modules/commands/lib/builder.d.mts +114 -18
- package/dist/modules/commands/lib/builder.mjs +42 -7
- package/dist/modules/commands/lib/registery.d.mts +47 -14
- package/dist/modules/commands/lib/registery.mjs +76 -16
- package/dist/modules/commands/lib/utils.d.mts +11 -0
- package/dist/modules/commands/lib/utils.mjs +14 -0
- package/dist/modules/data-tables/components/footer.mjs +3 -0
- package/dist/modules/data-tables/hooks/use-context.client.d.mts +2 -2
- package/dist/modules/data-tables/lib/types.d.mts +3 -3
- package/dist/modules/data-tables/strategies/local/components.mjs +25 -0
- package/dist/modules/data-tables/strategies/local/strategy.d.mts +12 -0
- package/dist/modules/data-tables/strategies/local/strategy.mjs +31 -0
- package/dist/modules/inline/components/inputs/combobox-dropdown.client.d.mts +4 -3
- package/dist/modules/inline/components/inputs/combobox.client.d.mts +4 -3
- package/dist/modules/inline/components/inputs/date-time.client.d.mts +4 -3
- package/dist/modules/inline/components/inputs/editor.client.d.mts +4 -3
- package/dist/modules/inline/components/inputs/input.client.d.mts +7 -5
- package/dist/modules/inline/components/inputs/select.client.d.mts +4 -3
- package/dist/modules/inline/components/inputs/switch.client.d.mts +4 -3
- package/dist/modules/inline/lib/variants.d.mts +1 -1
- package/dist/modules/router/lib/query-client.d.mts +2 -1
- package/dist/modules/router/lib/query-client.mjs +2 -2
- package/dist/modules/storage/lib/service.server.d.mts +9 -9
- package/dist/router.d.mts +2 -1
- package/dist/router.mjs +2 -1
- package/dist/src/components/ui/badge.d.mts +1 -1
- package/dist/src/components/ui/button-group.d.mts +1 -1
- package/dist/src/components/ui/button.d.mts +2 -2
- package/dist/src/components/ui/field.client.d.mts +1 -1
- package/dist/src/components/ui/item.d.mts +1 -1
- package/dist/src/modules/auth/handler/create-client.client.d.mts +2 -2
- package/dist/src/modules/commands/components/menus/context-menu.client.d.mts +6 -7
- package/dist/src/modules/commands/components/menus/dropdown-menu.client.d.mts +6 -7
- package/dist/src/modules/commands/components/menus/floating-menu.client.d.mts +6 -7
- package/dist/src/modules/commands/components/menus/inline-menu.client.d.mts +6 -7
- package/dist/src/modules/commands/components/menus/responsive-menu.client.d.mts +5 -6
- package/dist/src/modules/commands/components/render-command.mjs +3 -5
- package/dist/src/modules/commands/lib/builder.d.mts +114 -18
- package/dist/src/modules/commands/lib/builder.mjs +42 -7
- package/dist/src/modules/commands/lib/registery.d.mts +47 -14
- package/dist/src/modules/commands/lib/registery.mjs +76 -16
- package/dist/src/modules/commands/lib/utils.d.mts +11 -0
- package/dist/src/modules/commands/lib/utils.mjs +14 -0
- package/dist/src/modules/data-tables/components/footer.mjs +3 -0
- package/dist/src/modules/data-tables/hooks/use-context.client.d.mts +2 -2
- package/dist/src/modules/data-tables/lib/types.d.mts +3 -3
- package/dist/src/modules/data-tables/strategies/local/components.mjs +25 -0
- package/dist/src/modules/data-tables/strategies/local/strategy.d.mts +12 -0
- package/dist/src/modules/data-tables/strategies/local/strategy.mjs +31 -0
- package/dist/src/modules/inline/components/inputs/combobox-dropdown.client.d.mts +4 -3
- package/dist/src/modules/inline/components/inputs/combobox.client.d.mts +4 -3
- package/dist/src/modules/inline/components/inputs/date-time.client.d.mts +4 -3
- package/dist/src/modules/inline/components/inputs/editor.client.d.mts +4 -3
- package/dist/src/modules/inline/components/inputs/input.client.d.mts +7 -5
- package/dist/src/modules/inline/components/inputs/select.client.d.mts +4 -3
- package/dist/src/modules/inline/components/inputs/switch.client.d.mts +4 -3
- package/dist/src/modules/inline/lib/variants.d.mts +1 -1
- package/dist/src/modules/router/lib/query-client.d.mts +2 -1
- package/dist/src/modules/router/lib/query-client.mjs +2 -2
- package/dist/src/modules/storage/lib/service.server.d.mts +21 -21
- package/package.json +1 -1
- package/src/modules/commands/components/menus/context-menu.client.tsx +11 -11
- package/src/modules/commands/components/menus/dropdown-menu.client.tsx +9 -10
- package/src/modules/commands/components/menus/floating-menu.client.tsx +9 -10
- package/src/modules/commands/components/menus/inline-menu.client.tsx +9 -10
- package/src/modules/commands/components/menus/responsive-menu.client.tsx +7 -8
- package/src/modules/commands/components/render-command.tsx +17 -13
- package/src/modules/commands/entry.ts +1 -0
- package/src/modules/commands/lib/builder.ts +216 -36
- package/src/modules/commands/lib/registery.ts +210 -47
- package/src/modules/commands/lib/utils.ts +10 -0
- package/src/modules/data-tables/components/footer.tsx +9 -0
- package/src/modules/data-tables/entry.client.ts +1 -0
- package/src/modules/data-tables/hooks/use-context.client.tsx +2 -2
- package/src/modules/data-tables/lib/types.ts +3 -3
- package/src/modules/data-tables/strategies/local/components.tsx +17 -0
- package/src/modules/data-tables/strategies/local/strategy.ts +33 -0
- package/src/modules/inline/components/inputs/combobox-dropdown.client.tsx +11 -5
- package/src/modules/inline/components/inputs/combobox.client.tsx +11 -5
- package/src/modules/inline/components/inputs/date-time.client.tsx +11 -5
- package/src/modules/inline/components/inputs/editor.client.tsx +11 -5
- package/src/modules/inline/components/inputs/input.client.tsx +21 -9
- package/src/modules/inline/components/inputs/select.client.tsx +11 -5
- package/src/modules/inline/components/inputs/switch.client.tsx +11 -5
- package/src/modules/router/entry.ts +1 -0
- package/src/modules/router/lib/query-client.ts +2 -2
- package/src/styles.css +91 -0
package/dist/commands.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { CommandCondition, CommandDef, CommandRender, CommandStatus, CommandUI, commandBuilder, createCommandBuilder } from "./src/modules/commands/lib/builder.mjs";
|
|
1
|
+
import { AnyCommandDef, CommandCondition, CommandDef, CommandFor, CommandRender, CommandStatus, CommandTag, CommandUI, ExtractCommandData, commandBuilder, createCommandBuilder } from "./src/modules/commands/lib/builder.mjs";
|
|
2
2
|
import { CommandMap, defineCommands } from "./src/modules/commands/lib/registery.mjs";
|
|
3
|
-
|
|
3
|
+
import { ensureArray } from "./src/modules/commands/lib/utils.mjs";
|
|
4
|
+
export { AnyCommandDef, CommandCondition, CommandDef, CommandFor, CommandMap, CommandRender, CommandStatus, CommandTag, CommandUI, ExtractCommandData, commandBuilder, createCommandBuilder, defineCommands, ensureArray };
|
package/dist/commands.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { commandBuilder, createCommandBuilder } from "./src/modules/commands/lib/builder.mjs";
|
|
2
2
|
import { defineCommands } from "./src/modules/commands/lib/registery.mjs";
|
|
3
|
+
import { ensureArray } from "./src/modules/commands/lib/utils.mjs";
|
|
3
4
|
|
|
4
|
-
export { commandBuilder, createCommandBuilder, defineCommands };
|
|
5
|
+
export { commandBuilder, createCommandBuilder, defineCommands, ensureArray };
|
|
@@ -5,7 +5,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
5
5
|
|
|
6
6
|
//#region src/components/ui/badge.d.ts
|
|
7
7
|
declare const badgeVariants: (props?: ({
|
|
8
|
-
variant?: "link" | "default" | "
|
|
8
|
+
variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
|
|
9
9
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
10
10
|
declare function Badge({
|
|
11
11
|
className,
|
|
@@ -5,7 +5,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
5
5
|
|
|
6
6
|
//#region src/components/ui/button-group.d.ts
|
|
7
7
|
declare const buttonGroupVariants: (props?: ({
|
|
8
|
-
orientation?: "
|
|
8
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
9
9
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
10
10
|
declare function ButtonGroup({
|
|
11
11
|
className,
|
|
@@ -5,8 +5,8 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
5
5
|
|
|
6
6
|
//#region src/components/ui/button.d.ts
|
|
7
7
|
declare const buttonVariants: (props?: ({
|
|
8
|
-
variant?: "link" | "default" | "
|
|
9
|
-
size?: "default" | "xs" | "sm" | "
|
|
8
|
+
variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
|
|
9
|
+
size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
10
10
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
11
11
|
declare function Button({
|
|
12
12
|
className,
|
|
@@ -20,7 +20,7 @@ declare function FieldGroup({
|
|
|
20
20
|
...props
|
|
21
21
|
}: React.ComponentProps<"div">): react_jsx_runtime0.JSX.Element;
|
|
22
22
|
declare const fieldVariants: (props?: ({
|
|
23
|
-
orientation?: "
|
|
23
|
+
orientation?: "horizontal" | "vertical" | "responsive" | null | undefined;
|
|
24
24
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
25
25
|
declare function Field({
|
|
26
26
|
className,
|
|
@@ -10,6 +10,7 @@ import { TableSearchInput } from "../src/modules/data-tables/components/search-i
|
|
|
10
10
|
import { TableConfigContextValue, TableConfigProvider, createTableConfig, useTableConfigContext } from "../src/modules/data-tables/hooks/use-context.client.mjs";
|
|
11
11
|
import { useTable } from "../src/modules/data-tables/hooks/use-table.client.mjs";
|
|
12
12
|
import { InfiniteStrategyMeta, UseInfiniteStrategyInput, useInfiniteStrategy } from "../src/modules/data-tables/strategies/infinite/strategy.mjs";
|
|
13
|
+
import { LocalStrategy, UseLocalStrategyInput, useLocalStrategy } from "../src/modules/data-tables/strategies/local/strategy.mjs";
|
|
13
14
|
import { PaginationStrategy, UsePaginationStrategyInput, usePaginationStrategy } from "../src/modules/data-tables/strategies/pagination/strategy.mjs";
|
|
14
15
|
import { DataTable } from "../src/modules/data-tables/tables/data-table/components/table.mjs";
|
|
15
16
|
import { TableInlineCell } from "../src/modules/data-tables/tables/inline-table/components/cells/common.mjs";
|
|
@@ -18,4 +19,4 @@ import { InlineDataTableReadOnly } from "../src/modules/data-tables/tables/inlin
|
|
|
18
19
|
import { INLINE_INPUT_ATTR, InlineDataTableHotkeysConfig, useInlineDataTableHotkeys } from "../src/modules/data-tables/tables/inline-table/hooks/use-hotkeys.client.mjs";
|
|
19
20
|
import { InlineTableContextValue, InlineTableProvider, useInlineTableContext } from "../src/modules/data-tables/tables/inline-table/hooks/context.client.mjs";
|
|
20
21
|
import { InlineTable } from "../src/modules/data-tables/tables/inline-table/components/table.mjs";
|
|
21
|
-
export { DataTable, INLINE_INPUT_ATTR, InfiniteStrategyMeta, InlineDataTableHotkeysConfig, InlineDataTableReadOnly, InlineTable, InlineTableContextValue, InlineTableProvider, PaginationStrategy, TableConfigContextValue, TableConfigProvider, TableDateCell, TableDragHandle, TableDragHandleProps, TableFilterCombobox, TableFilterComboboxOption, TableFilterComboboxProps, TableFilterDateRange, TableFilterDateRangePreset, TableFilterDateRangeProps, TableFilterDateRangeValue, TableFilterSearch, TableFilterSearchProps, TableFilterSlider, TableFilterSliderProps, TableFilterToggle, TableFilterToggleProps, TableInlineCell, TableNumberCell, TableSearchInput, TableStatusCell, TableTextCell, UseInfiniteStrategyInput, UsePaginationStrategyInput, createTableConfig, createTableDragHandleCell, createTableIndexCell, createTableSelectCell, useInfiniteStrategy, useInlineDataTableHotkeys, useInlineTableContext, usePaginationStrategy, useTable, useTableConfigContext };
|
|
22
|
+
export { DataTable, INLINE_INPUT_ATTR, InfiniteStrategyMeta, InlineDataTableHotkeysConfig, InlineDataTableReadOnly, InlineTable, InlineTableContextValue, InlineTableProvider, LocalStrategy, PaginationStrategy, TableConfigContextValue, TableConfigProvider, TableDateCell, TableDragHandle, TableDragHandleProps, TableFilterCombobox, TableFilterComboboxOption, TableFilterComboboxProps, TableFilterDateRange, TableFilterDateRangePreset, TableFilterDateRangeProps, TableFilterDateRangeValue, TableFilterSearch, TableFilterSearchProps, TableFilterSlider, TableFilterSliderProps, TableFilterToggle, TableFilterToggleProps, TableInlineCell, TableNumberCell, TableSearchInput, TableStatusCell, TableTextCell, UseInfiniteStrategyInput, UseLocalStrategyInput, UsePaginationStrategyInput, createTableConfig, createTableDragHandleCell, createTableIndexCell, createTableSelectCell, useInfiniteStrategy, useInlineDataTableHotkeys, useInlineTableContext, useLocalStrategy, usePaginationStrategy, useTable, useTableConfigContext };
|
|
@@ -10,6 +10,7 @@ import { TableConfigProvider, createTableConfig, useTableConfigContext } from ".
|
|
|
10
10
|
import { TableSearchInput } from "../src/modules/data-tables/components/search-input.client.mjs";
|
|
11
11
|
import { useTable } from "../src/modules/data-tables/hooks/use-table.client.mjs";
|
|
12
12
|
import { useInfiniteStrategy } from "../src/modules/data-tables/strategies/infinite/strategy.mjs";
|
|
13
|
+
import { useLocalStrategy } from "../src/modules/data-tables/strategies/local/strategy.mjs";
|
|
13
14
|
import { usePaginationStrategy } from "../src/modules/data-tables/strategies/pagination/strategy.mjs";
|
|
14
15
|
import { DataTable } from "../src/modules/data-tables/tables/data-table/components/table.mjs";
|
|
15
16
|
import { TableInlineCell } from "../src/modules/data-tables/tables/inline-table/components/cells/common.mjs";
|
|
@@ -19,4 +20,4 @@ import { InlineTableProvider, useInlineTableContext } from "../src/modules/data-
|
|
|
19
20
|
import { INLINE_INPUT_ATTR, useInlineDataTableHotkeys } from "../src/modules/data-tables/tables/inline-table/hooks/use-hotkeys.client.mjs";
|
|
20
21
|
import { InlineTable } from "../src/modules/data-tables/tables/inline-table/components/table.mjs";
|
|
21
22
|
|
|
22
|
-
export { DataTable, INLINE_INPUT_ATTR, InlineDataTableReadOnly, InlineTable, InlineTableProvider, TableConfigProvider, TableDateCell, TableDragHandle, TableFilterCombobox, TableFilterDateRange, TableFilterSearch, TableFilterSlider, TableFilterToggle, TableInlineCell, TableNumberCell, TableSearchInput, TableStatusCell, TableTextCell, createTableConfig, createTableDragHandleCell, createTableIndexCell, createTableSelectCell, useInfiniteStrategy, useInlineDataTableHotkeys, useInlineTableContext, usePaginationStrategy, useTable, useTableConfigContext };
|
|
23
|
+
export { DataTable, INLINE_INPUT_ATTR, InlineDataTableReadOnly, InlineTable, InlineTableProvider, TableConfigProvider, TableDateCell, TableDragHandle, TableFilterCombobox, TableFilterDateRange, TableFilterSearch, TableFilterSlider, TableFilterToggle, TableInlineCell, TableNumberCell, TableSearchInput, TableStatusCell, TableTextCell, createTableConfig, createTableDragHandleCell, createTableIndexCell, createTableSelectCell, useInfiniteStrategy, useInlineDataTableHotkeys, useInlineTableContext, useLocalStrategy, usePaginationStrategy, useTable, useTableConfigContext };
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { ContextMenu, ContextMenuContent, ContextMenuTrigger } from "../../../../components/ui/context-menu.client.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { AnyCommandDef, ExtractCommandData } from "../../lib/builder.mjs";
|
|
3
3
|
import { CommandContextLifecycle } from "../../hooks/use-command.client.mjs";
|
|
4
4
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
5
|
import { ComponentProps, ReactNode } from "react";
|
|
6
|
-
import z from "zod";
|
|
7
6
|
|
|
8
7
|
//#region src/modules/commands/components/menus/context-menu.client.d.ts
|
|
9
|
-
type ContextCommandMenuContentProps<
|
|
10
|
-
data:
|
|
11
|
-
commands:
|
|
8
|
+
type ContextCommandMenuContentProps<TCommand extends AnyCommandDef, TMeta = object> = ComponentProps<typeof ContextMenuContent> & CommandContextLifecycle & {
|
|
9
|
+
data: NoInfer<ExtractCommandData<TCommand>>;
|
|
10
|
+
commands: TCommand[];
|
|
12
11
|
meta?: TMeta;
|
|
13
12
|
fallback?: ReactNode;
|
|
14
13
|
emptyLabel?: string;
|
|
@@ -24,7 +23,7 @@ declare const ContextCommandMenuTrigger: typeof ContextMenuTrigger;
|
|
|
24
23
|
/**
|
|
25
24
|
* ContextCommandMenuContent
|
|
26
25
|
*/
|
|
27
|
-
declare function ContextCommandMenuContent<
|
|
26
|
+
declare function ContextCommandMenuContent<TCommand extends AnyCommandDef, TMeta = object>({
|
|
28
27
|
data,
|
|
29
28
|
commands,
|
|
30
29
|
meta,
|
|
@@ -35,6 +34,6 @@ declare function ContextCommandMenuContent<TSchema extends z.ZodTypeAny, TMeta>(
|
|
|
35
34
|
className,
|
|
36
35
|
emptyLabel,
|
|
37
36
|
...props
|
|
38
|
-
}: ContextCommandMenuContentProps<
|
|
37
|
+
}: ContextCommandMenuContentProps<TCommand, TMeta>): react_jsx_runtime0.JSX.Element;
|
|
39
38
|
//#endregion
|
|
40
39
|
export { ContextCommandMenu, ContextCommandMenuContent, ContextCommandMenuContentProps, ContextCommandMenuTrigger };
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnyCommandDef, ExtractCommandData } from "../../lib/builder.mjs";
|
|
2
2
|
import { CommandContextLifecycle } from "../../hooks/use-command.client.mjs";
|
|
3
3
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
import { ComponentProps, HTMLAttributes, ReactNode } from "react";
|
|
5
|
-
import z from "zod";
|
|
6
5
|
|
|
7
6
|
//#region src/modules/commands/components/menus/dropdown-menu.client.d.ts
|
|
8
|
-
type DropdownCommandMenuProps<
|
|
9
|
-
data:
|
|
10
|
-
commands:
|
|
7
|
+
type DropdownCommandMenuProps<TCommand extends AnyCommandDef, TMeta = object> = HTMLAttributes<HTMLElement> & CommandContextLifecycle & {
|
|
8
|
+
data: NoInfer<ExtractCommandData<TCommand>>;
|
|
9
|
+
commands: TCommand[];
|
|
11
10
|
meta?: TMeta;
|
|
12
11
|
fallback?: ReactNode;
|
|
13
12
|
};
|
|
14
|
-
declare function DropdownCommandMenu<
|
|
13
|
+
declare function DropdownCommandMenu<TCommand extends AnyCommandDef, TMeta = object>({
|
|
15
14
|
data,
|
|
16
15
|
commands,
|
|
17
16
|
meta,
|
|
@@ -21,7 +20,7 @@ declare function DropdownCommandMenu<TSchema extends z.ZodTypeAny, TMeta>({
|
|
|
21
20
|
onSettled,
|
|
22
21
|
className,
|
|
23
22
|
...props
|
|
24
|
-
}: DropdownCommandMenuProps<
|
|
23
|
+
}: DropdownCommandMenuProps<TCommand, TMeta>): react_jsx_runtime0.JSX.Element | null;
|
|
25
24
|
declare function DropdownCommandMenuLoading({
|
|
26
25
|
className,
|
|
27
26
|
...props
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnyCommandDef, ExtractCommandData } from "../../lib/builder.mjs";
|
|
2
2
|
import { CommandContextLifecycle } from "../../hooks/use-command.client.mjs";
|
|
3
3
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
import { HTMLAttributes, ReactNode } from "react";
|
|
5
|
-
import z from "zod";
|
|
6
5
|
|
|
7
6
|
//#region src/modules/commands/components/menus/floating-menu.client.d.ts
|
|
8
|
-
type FloatingCommandMenuProps<
|
|
9
|
-
data:
|
|
10
|
-
commands:
|
|
7
|
+
type FloatingCommandMenuProps<TCommand extends AnyCommandDef, TMeta = object> = HTMLAttributes<HTMLElement> & CommandContextLifecycle & {
|
|
8
|
+
data: NoInfer<ExtractCommandData<TCommand>>;
|
|
9
|
+
commands: TCommand[];
|
|
11
10
|
meta?: TMeta;
|
|
12
11
|
fallback?: ReactNode;
|
|
13
12
|
state: "open" | "closed";
|
|
14
13
|
emptyLabel?: string;
|
|
15
14
|
};
|
|
16
|
-
declare function FloatingCommandMenu<
|
|
15
|
+
declare function FloatingCommandMenu<TCommand extends AnyCommandDef, TMeta = object>({
|
|
17
16
|
data,
|
|
18
17
|
commands,
|
|
19
18
|
meta,
|
|
@@ -25,6 +24,6 @@ declare function FloatingCommandMenu<TSchema extends z.ZodTypeAny, TMeta>({
|
|
|
25
24
|
className,
|
|
26
25
|
emptyLabel,
|
|
27
26
|
...props
|
|
28
|
-
}: FloatingCommandMenuProps<
|
|
27
|
+
}: FloatingCommandMenuProps<TCommand, TMeta>): react_jsx_runtime0.JSX.Element;
|
|
29
28
|
//#endregion
|
|
30
29
|
export { FloatingCommandMenu, FloatingCommandMenuProps };
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnyCommandDef, ExtractCommandData } from "../../lib/builder.mjs";
|
|
2
2
|
import { CommandContextLifecycle } from "../../hooks/use-command.client.mjs";
|
|
3
3
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
import { ComponentProps, HTMLAttributes, ReactNode } from "react";
|
|
5
|
-
import z from "zod";
|
|
6
5
|
|
|
7
6
|
//#region src/modules/commands/components/menus/inline-menu.client.d.ts
|
|
8
|
-
type InlineCommandMenuProps<
|
|
9
|
-
data:
|
|
10
|
-
commands:
|
|
7
|
+
type InlineCommandMenuProps<TCommand extends AnyCommandDef, TMeta = object> = HTMLAttributes<HTMLElement> & CommandContextLifecycle & {
|
|
8
|
+
data: NoInfer<ExtractCommandData<TCommand>>;
|
|
9
|
+
commands: TCommand[];
|
|
11
10
|
meta?: TMeta;
|
|
12
11
|
fallback?: ReactNode;
|
|
13
12
|
};
|
|
14
|
-
declare function InlineCommandMenu<
|
|
13
|
+
declare function InlineCommandMenu<TCommand extends AnyCommandDef, TMeta = object>({
|
|
15
14
|
data,
|
|
16
15
|
meta,
|
|
17
16
|
commands,
|
|
@@ -21,7 +20,7 @@ declare function InlineCommandMenu<TSchema extends z.ZodTypeAny, TMeta>({
|
|
|
21
20
|
onSettled,
|
|
22
21
|
className,
|
|
23
22
|
...props
|
|
24
|
-
}: InlineCommandMenuProps<
|
|
23
|
+
}: InlineCommandMenuProps<TCommand, TMeta>): react_jsx_runtime0.JSX.Element | null;
|
|
25
24
|
declare function InlineCommandMenuLoading({
|
|
26
25
|
className,
|
|
27
26
|
...props
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnyCommandDef, ExtractCommandData } from "../../lib/builder.mjs";
|
|
2
2
|
import { CommandContextLifecycle } from "../../hooks/use-command.client.mjs";
|
|
3
3
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
import { ReactNode } from "react";
|
|
5
|
-
import z from "zod";
|
|
6
5
|
|
|
7
6
|
//#region src/modules/commands/components/menus/responsive-menu.client.d.ts
|
|
8
|
-
type ResponsiveCommandMenuProps<
|
|
9
|
-
data:
|
|
10
|
-
commands:
|
|
7
|
+
type ResponsiveCommandMenuProps<TCommand extends AnyCommandDef, TMeta = object> = CommandContextLifecycle & {
|
|
8
|
+
data: NoInfer<ExtractCommandData<TCommand>>;
|
|
9
|
+
commands: TCommand[];
|
|
11
10
|
meta?: TMeta;
|
|
12
11
|
fallback?: ReactNode;
|
|
13
12
|
};
|
|
14
|
-
declare function ResponsiveCommandMenu<
|
|
13
|
+
declare function ResponsiveCommandMenu<TCommand extends AnyCommandDef, TMeta = object>(props: ResponsiveCommandMenuProps<TCommand, TMeta>): react_jsx_runtime0.JSX.Element;
|
|
15
14
|
declare function ResponsiveCommandMenuLoading(): react_jsx_runtime0.JSX.Element;
|
|
16
15
|
//#endregion
|
|
17
16
|
export { ResponsiveCommandMenu, ResponsiveCommandMenuLoading, ResponsiveCommandMenuProps };
|
|
@@ -8,13 +8,11 @@ import { Fragment, jsx } from "react/jsx-runtime";
|
|
|
8
8
|
/**
|
|
9
9
|
* Command renderer.
|
|
10
10
|
*
|
|
11
|
-
* It
|
|
12
|
-
*
|
|
11
|
+
* It applies cheap visibility/disabled rules, exposes command status via context,
|
|
12
|
+
* and then renders the command content. Validation belongs at execution boundaries.
|
|
13
13
|
*/
|
|
14
14
|
function RenderCommand(props) {
|
|
15
|
-
const
|
|
16
|
-
if (!parsedData.success) return /* @__PURE__ */ jsx(Fragment, { children: props.fallback });
|
|
17
|
-
const data = parsedData.data;
|
|
15
|
+
const data = props.command.transform ? props.command.transform(props.data) : props.data;
|
|
18
16
|
const meta = props.meta ?? {};
|
|
19
17
|
const visibleResult = props.command.visibleWhen?.({
|
|
20
18
|
data,
|
|
@@ -1,39 +1,135 @@
|
|
|
1
1
|
import { Permission } from "../../auth/lib/permissions.mjs";
|
|
2
|
-
import { z as z$1 } from "zod";
|
|
3
2
|
|
|
4
3
|
//#region src/modules/commands/lib/builder.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* The different UI contexts in which a command can be rendered.
|
|
6
|
+
*/
|
|
5
7
|
type CommandUI = "dropdown" | "context" | "table" | "inline" | "custom";
|
|
8
|
+
/**
|
|
9
|
+
* The status of a command, which can be used to style the command's UI appropriately.
|
|
10
|
+
*/
|
|
6
11
|
type CommandStatus = "idle" | "pending" | "success" | "error";
|
|
7
|
-
|
|
8
|
-
|
|
12
|
+
/**
|
|
13
|
+
* A string tag that can be added to a command for organizational and filtering purposes.
|
|
14
|
+
*/
|
|
15
|
+
type CommandTag = string;
|
|
16
|
+
/**
|
|
17
|
+
* Represents a command definition with its associated types and properties.
|
|
18
|
+
*/
|
|
19
|
+
type AnyCommandDef = CommandDef<any, any, any, any>;
|
|
20
|
+
/**
|
|
21
|
+
* Condition function that determines whether a command is visible or disabled based on the provided data and meta.
|
|
22
|
+
*/
|
|
23
|
+
type CommandCondition<TData, TMeta> = (params: {
|
|
24
|
+
data: TData;
|
|
9
25
|
meta: TMeta;
|
|
10
26
|
}) => boolean | boolean[];
|
|
11
|
-
|
|
12
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Render function that defines how a command should be rendered based on the provided data, meta, and UI context.
|
|
29
|
+
*/
|
|
30
|
+
type CommandRender<TData, TMeta> = (params: {
|
|
31
|
+
data: TData;
|
|
13
32
|
meta: TMeta;
|
|
14
33
|
ui: CommandUI;
|
|
15
34
|
}) => React.ReactNode;
|
|
16
35
|
/**
|
|
17
36
|
* Final command definition (without name).
|
|
18
37
|
* Name is derived from the object key in `defineCommands`.
|
|
38
|
+
*
|
|
39
|
+
* @typeParam TData - The type `visibleWhen`, `disabledWhen`, and `render` receive.
|
|
40
|
+
* When `.transform()` is used this is the post-transform type.
|
|
41
|
+
* @typeParam TMeta - Shared contextual metadata passed alongside data.
|
|
42
|
+
* @typeParam TTags - Literal tuple of tag strings preserved from the builder's
|
|
43
|
+
* `.tags()` call. Enables compile-time tag filtering in the
|
|
44
|
+
* registry. Defaults to `string[]` when not provided.
|
|
45
|
+
* @typeParam TInput - The type that menus must pass as `data`. Equals `TData`
|
|
46
|
+
* when no `.transform()` is used. When `.transform(fn)` is
|
|
47
|
+
* called, `TInput` captures the pre-transform type so menus
|
|
48
|
+
* remain correctly typed while `render` sees the transformed type.
|
|
49
|
+
* Structurally expressed as the parameter of `transform`.
|
|
19
50
|
*/
|
|
20
|
-
type CommandDef<
|
|
51
|
+
type CommandDef<TData = unknown, TMeta = object, TTags extends readonly string[] = string[], TInput = TData> = {
|
|
52
|
+
id?: string;
|
|
53
|
+
tags: TTags;
|
|
54
|
+
transform?: (data: TInput) => TData;
|
|
21
55
|
permission?: Permission;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
render: CommandRender<TSchema, TMeta>;
|
|
56
|
+
visibleWhen?: CommandCondition<TData, TMeta>;
|
|
57
|
+
disabledWhen?: CommandCondition<TData, TMeta>;
|
|
58
|
+
render: CommandRender<TData, TMeta>;
|
|
26
59
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Command typed by accepted input data.
|
|
62
|
+
*
|
|
63
|
+
* Useful for APIs that only care about what can be passed in (e.g. table
|
|
64
|
+
* providers that always pass selected rows), not the command's normalized
|
|
65
|
+
* render-time shape.
|
|
66
|
+
*/
|
|
67
|
+
type CommandFor<TInput, TMeta = object> = CommandDef<any, TMeta, any, TInput>;
|
|
68
|
+
/**
|
|
69
|
+
* Extracts the **input** data type of a command — what menus must pass as `data`.
|
|
70
|
+
*
|
|
71
|
+
* - When `.transform()` is used, this is the pre-transform type (e.g. `Template | Template[]`).
|
|
72
|
+
* - Otherwise it equals the render-time type.
|
|
73
|
+
*
|
|
74
|
+
* The type is read from the `transform` field's parameter when present, and
|
|
75
|
+
* falls back to the `render` parameter when there is no transformer.
|
|
76
|
+
*/
|
|
77
|
+
type ExtractCommandData<TCommand extends AnyCommandDef> = [NonNullable<TCommand["transform"]>] extends [never] ? TCommand extends {
|
|
78
|
+
render: (params: {
|
|
79
|
+
data: infer TData;
|
|
80
|
+
meta: any;
|
|
81
|
+
ui: any;
|
|
82
|
+
}) => any;
|
|
83
|
+
} ? TData : never : NonNullable<TCommand["transform"]> extends ((data: infer TInput) => any) ? TInput : never;
|
|
84
|
+
/**
|
|
85
|
+
* Builder state after `.$type<TData>()` has been called (or at initial state
|
|
86
|
+
* with `TData = unknown`).
|
|
87
|
+
*
|
|
88
|
+
* @typeParam TData - Current render-time data type (post-transform if used).
|
|
89
|
+
* @typeParam TTags - Literal tag tuple, carried through every method so that
|
|
90
|
+
* the final `CommandDef` retains the literal type.
|
|
91
|
+
* @typeParam TInput - Input data type for menus. Starts equal to `TData`.
|
|
92
|
+
* Freezes to the value of `TData` at the moment `.transform()`
|
|
93
|
+
* is called, while `TData` changes to the transformer's output.
|
|
94
|
+
*/
|
|
95
|
+
type ReadyCommandBuilder<TData, TMeta, TTags extends readonly string[] = string[], TInput = TData> = {
|
|
96
|
+
/** Override the data (and optionally meta) type. Resets `TInput` to the new `TData`. */$type<TNewData, TNewMeta = TMeta>(): ReadyCommandBuilder<TNewData, TNewMeta, TTags, TNewData>;
|
|
97
|
+
/**
|
|
98
|
+
* Set the command's tags as a literal tuple. The `const` modifier infers
|
|
99
|
+
* string arguments as literals, enabling compile-time tag narrowing in the registry.
|
|
100
|
+
*/
|
|
101
|
+
tags<const TNewTags extends string[]>(...tags: TNewTags): ReadyCommandBuilder<TData, TMeta, TNewTags, TInput>;
|
|
102
|
+
permission(permission: Permission): ReadyCommandBuilder<TData, TMeta, TTags, TInput>;
|
|
103
|
+
/**
|
|
104
|
+
* Declares a lightweight transformer that runs once per render — before `visibleWhen`,
|
|
105
|
+
* `disabledWhen`, and `render` — collapsing the input type into a single usable shape.
|
|
106
|
+
*
|
|
107
|
+
* Freezes `TInput` to the current `TData` (the pre-transform type) and advances
|
|
108
|
+
* `TData` to `TNewData` (the transformer's return type). This ensures:
|
|
109
|
+
* - Menus are typed against the union input (e.g. `Template | Template[]`)
|
|
110
|
+
* - `visibleWhen` and `render` work with the clean transformed type (e.g. `Template[]`)
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* commandBuilder
|
|
114
|
+
* .$type<Template | Template[]>()
|
|
115
|
+
* .transform((data) => (Array.isArray(data) ? data : [data]))
|
|
116
|
+
* .visibleWhen(({ data }) => data.length > 0) // data: Template[]
|
|
117
|
+
* .render(({ data }) => <ArchiveCommand ids={data.map(i => i.id)} />)
|
|
118
|
+
*/
|
|
119
|
+
transform<TNewData>(fn: (data: TData) => TNewData): ReadyCommandBuilder<TNewData, TMeta, TTags, TData>;
|
|
120
|
+
visibleWhen(condition: CommandCondition<TData, TMeta>): ReadyCommandBuilder<TData, TMeta, TTags, TInput>;
|
|
121
|
+
disabledWhen(condition: CommandCondition<TData, TMeta>): ReadyCommandBuilder<TData, TMeta, TTags, TInput>; /** Terminal — produces the final `CommandDef`. */
|
|
122
|
+
render(render: CommandRender<TData, TMeta>): CommandDef<TData, TMeta, TTags, TInput>;
|
|
32
123
|
};
|
|
33
|
-
|
|
34
|
-
|
|
124
|
+
/**
|
|
125
|
+
* The initial builder returned by `commandBuilder` / `createCommandBuilder()`.
|
|
126
|
+
* Before `.$type<>()` is called, `TData` is `unknown`.
|
|
127
|
+
*/
|
|
128
|
+
type InitialCommandBuilder<TMeta> = ReadyCommandBuilder<unknown, TMeta, string[], unknown> & {
|
|
129
|
+
$type<TNewData, TNewMeta = TMeta>(): ReadyCommandBuilder<TNewData, TNewMeta, string[], TNewData>;
|
|
130
|
+
tags<const TNewTags extends string[]>(...tags: TNewTags): ReadyCommandBuilder<unknown, TMeta, TNewTags, unknown>;
|
|
35
131
|
};
|
|
36
132
|
declare function createCommandBuilder<TMeta = object>(): InitialCommandBuilder<TMeta>;
|
|
37
133
|
declare const commandBuilder: InitialCommandBuilder<object>;
|
|
38
134
|
//#endregion
|
|
39
|
-
export { CommandCondition, CommandDef, CommandRender, CommandStatus, CommandUI, commandBuilder, createCommandBuilder };
|
|
135
|
+
export { AnyCommandDef, CommandCondition, CommandDef, CommandFor, CommandRender, CommandStatus, CommandTag, CommandUI, ExtractCommandData, commandBuilder, createCommandBuilder };
|
|
@@ -1,20 +1,54 @@
|
|
|
1
1
|
//#region src/modules/commands/lib/builder.ts
|
|
2
2
|
function createInitialBuilder(state) {
|
|
3
|
-
return {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
})
|
|
8
|
-
|
|
3
|
+
return {
|
|
4
|
+
...createReadyBuilder({
|
|
5
|
+
tags: state.tags ?? [],
|
|
6
|
+
permission: state.permission
|
|
7
|
+
}),
|
|
8
|
+
tags(...tags) {
|
|
9
|
+
return createReadyBuilder({
|
|
10
|
+
tags,
|
|
11
|
+
permission: state.permission
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
$type() {
|
|
15
|
+
return createReadyBuilder({
|
|
16
|
+
tags: state.tags ?? [],
|
|
17
|
+
permission: state.permission
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
};
|
|
9
21
|
}
|
|
10
22
|
function createReadyBuilder(state) {
|
|
11
23
|
return {
|
|
24
|
+
$type() {
|
|
25
|
+
return createReadyBuilder({
|
|
26
|
+
tags: state.tags,
|
|
27
|
+
permission: state.permission
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
tags(...tags) {
|
|
31
|
+
return createReadyBuilder({
|
|
32
|
+
tags,
|
|
33
|
+
permission: state.permission,
|
|
34
|
+
transform: state.transform,
|
|
35
|
+
visibleWhen: state.visibleWhen,
|
|
36
|
+
disabledWhen: state.disabledWhen
|
|
37
|
+
});
|
|
38
|
+
},
|
|
12
39
|
permission(permission) {
|
|
13
40
|
return createReadyBuilder({
|
|
14
41
|
...state,
|
|
15
42
|
permission
|
|
16
43
|
});
|
|
17
44
|
},
|
|
45
|
+
transform(fn) {
|
|
46
|
+
return createReadyBuilder({
|
|
47
|
+
tags: state.tags,
|
|
48
|
+
permission: state.permission,
|
|
49
|
+
transform: fn
|
|
50
|
+
});
|
|
51
|
+
},
|
|
18
52
|
visibleWhen(condition) {
|
|
19
53
|
return createReadyBuilder({
|
|
20
54
|
...state,
|
|
@@ -29,8 +63,9 @@ function createReadyBuilder(state) {
|
|
|
29
63
|
},
|
|
30
64
|
render(render) {
|
|
31
65
|
return {
|
|
66
|
+
tags: state.tags,
|
|
67
|
+
transform: state.transform,
|
|
32
68
|
permission: state.permission,
|
|
33
|
-
schema: state.schema,
|
|
34
69
|
visibleWhen: state.visibleWhen,
|
|
35
70
|
disabledWhen: state.disabledWhen,
|
|
36
71
|
render
|
|
@@ -1,11 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import z from "zod";
|
|
1
|
+
import { AnyCommandDef } from "./builder.mjs";
|
|
3
2
|
|
|
4
3
|
//#region src/modules/commands/lib/registery.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Command map type defining the shape of command definitions.
|
|
7
6
|
*/
|
|
8
|
-
type CommandMap = Record<string,
|
|
7
|
+
type CommandMap = Record<string, AnyCommandDef>;
|
|
8
|
+
/** Union of all values in a command map. */
|
|
9
|
+
type ValueOf<TCommands extends CommandMap> = TCommands[keyof TCommands];
|
|
10
|
+
/** Keep commands that have **every** of `TFilterTags`. */
|
|
11
|
+
type FilterAllTags<TCommand extends AnyCommandDef, TFilterTags extends readonly string[]> = TCommand extends {
|
|
12
|
+
tags: infer CmdTags extends readonly string[];
|
|
13
|
+
} ? TFilterTags[number] extends CmdTags[number] ? TCommand : never : TCommand;
|
|
14
|
+
/** Keep commands that have **some** of `TFilterTags`. */
|
|
15
|
+
type FilterAnyTags<TCommand extends AnyCommandDef, TFilterTags extends readonly string[]> = TCommand extends {
|
|
16
|
+
tags: infer CmdTags extends readonly string[];
|
|
17
|
+
} ? string[] extends CmdTags ? TCommand : Extract<CmdTags[number], TFilterTags[number]> extends never ? never : TCommand : TCommand;
|
|
18
|
+
/** Keep commands whose tag set equals `TFilterTags` (order-insensitive). */
|
|
19
|
+
type FilterExactTags<TCommand extends AnyCommandDef, TFilterTags extends readonly string[]> = TCommand extends {
|
|
20
|
+
tags: infer CmdTags extends readonly string[];
|
|
21
|
+
} ? string[] extends CmdTags ? TCommand : [CmdTags[number]] extends [TFilterTags[number]] ? [TFilterTags[number]] extends [CmdTags[number]] ? TCommand : never : never : TCommand;
|
|
22
|
+
/** Keep commands that have **without** of `TFilterTags`. */
|
|
23
|
+
type FilterWithoutTags<TCommand extends AnyCommandDef, TFilterTags extends readonly string[]> = TCommand extends {
|
|
24
|
+
tags: infer CmdTags extends readonly string[];
|
|
25
|
+
} ? string[] extends CmdTags ? TCommand : Extract<CmdTags[number], TFilterTags[number]> extends never ? TCommand : never : TCommand;
|
|
9
26
|
type CommandKey<TCommands extends CommandMap> = Extract<keyof TCommands, string>;
|
|
10
27
|
type CommandFlags<TCommands extends CommandMap> = Partial<Record<CommandKey<TCommands>, boolean>>;
|
|
11
28
|
type CommandInput<TCommands extends CommandMap> = readonly CommandKey<TCommands>[] | CommandFlags<TCommands>;
|
|
@@ -13,22 +30,38 @@ type TruthyKeys<T> = { [K in keyof T]-?: T[K] extends true ? K : never }[keyof T
|
|
|
13
30
|
type PickedCommands<TCommands extends CommandMap, TInput extends CommandInput<TCommands>> = TInput extends readonly CommandKey<TCommands>[] ? Pick<TCommands, TInput[number]> : TInput extends CommandFlags<TCommands> ? Pick<TCommands, Extract<TruthyKeys<TInput>, keyof TCommands>> : never;
|
|
14
31
|
type OmittedCommands<TCommands extends CommandMap, TInput extends CommandInput<TCommands>> = TInput extends readonly CommandKey<TCommands>[] ? Omit<TCommands, TInput[number]> : TInput extends CommandFlags<TCommands> ? Omit<TCommands, Extract<TruthyKeys<TInput>, keyof TCommands>> : never;
|
|
15
32
|
type ExtendedCommands<TBase extends CommandMap, TExtension extends CommandMap> = Omit<TBase, keyof TExtension> & TExtension;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
33
|
+
type CommandTagFilterRegistry<TCommand extends AnyCommandDef> = {
|
|
34
|
+
every<const TTags extends string[]>(...tags: TTags): CommandTagFilterRegistry<FilterAllTags<TCommand, TTags>>;
|
|
35
|
+
some<const TTags extends string[]>(...tags: TTags): CommandTagFilterRegistry<FilterAnyTags<TCommand, TTags>>;
|
|
36
|
+
exact<const TTags extends string[]>(...tags: TTags): CommandTagFilterRegistry<FilterExactTags<TCommand, TTags>>;
|
|
37
|
+
without<const TTags extends string[]>(...tags: TTags): CommandTagFilterRegistry<FilterWithoutTags<TCommand, TTags>>;
|
|
38
|
+
toArray(): TCommand[];
|
|
39
|
+
};
|
|
40
|
+
type CommandKeyFilterRegistry<TCommands extends CommandMap> = {
|
|
41
|
+
pick<const TInput extends CommandInput<TCommands>>(input: TInput): CommandKeyFilterRegistry<PickedCommands<TCommands, TInput>>;
|
|
42
|
+
omit<const TInput extends CommandInput<TCommands>>(input: TInput): CommandKeyFilterRegistry<OmittedCommands<TCommands, TInput>>;
|
|
43
|
+
toArray(): ValueOf<TCommands>[];
|
|
44
|
+
};
|
|
20
45
|
type CommandRegistry<TCommands extends CommandMap> = {
|
|
21
46
|
commands: TCommands;
|
|
22
|
-
|
|
23
|
-
|
|
47
|
+
keys: CommandKeyFilterRegistry<TCommands>;
|
|
48
|
+
tags: CommandTagFilterRegistry<ValueOf<TCommands>>;
|
|
49
|
+
extend<const TExtension extends CommandMap>(extension: TExtension): CommandRegistry<ExtendedCommands<TCommands, TExtension>>; /** @deprecated Use `commands.keys.pick(...)` instead. */
|
|
50
|
+
pick<const TInput extends CommandInput<TCommands>>(input: TInput): CommandRegistry<PickedCommands<TCommands, TInput>>; /** @deprecated Use `commands.keys.omit(...)` instead. */
|
|
24
51
|
omit<const TInput extends CommandInput<TCommands>>(input: TInput): CommandRegistry<OmittedCommands<TCommands, TInput>>;
|
|
25
|
-
toArray():
|
|
52
|
+
toArray(): ValueOf<TCommands>[];
|
|
26
53
|
};
|
|
27
54
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
55
|
+
* Define commands from a map of name → `CommandDef`.
|
|
56
|
+
*
|
|
57
|
+
* Returns a `CommandRegistry` with key-based and tag-based filtering, plus
|
|
58
|
+
* `extend` for composition. Filter chains are immutable — each call produces
|
|
59
|
+
* a new registry.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* const registry = defineCommands({ edit, delete, archive });
|
|
63
|
+
* registry.tags.every("danger", "table").toArray();
|
|
64
|
+
* registry.keys.omit({ delete: true }).toArray();
|
|
32
65
|
*/
|
|
33
66
|
declare function defineCommands<TCommands extends CommandMap>(commands: TCommands): CommandRegistry<TCommands>;
|
|
34
67
|
//#endregion
|