@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.
Files changed (101) hide show
  1. package/dist/commands.d.mts +3 -2
  2. package/dist/commands.mjs +2 -1
  3. package/dist/components/ui/badge.d.mts +1 -1
  4. package/dist/components/ui/button-group.d.mts +1 -1
  5. package/dist/components/ui/button.d.mts +2 -2
  6. package/dist/components/ui/field.client.d.mts +1 -1
  7. package/dist/data-tables/client.d.mts +2 -1
  8. package/dist/data-tables/client.mjs +2 -1
  9. package/dist/modules/commands/components/menus/context-menu.client.d.mts +6 -7
  10. package/dist/modules/commands/components/menus/dropdown-menu.client.d.mts +6 -7
  11. package/dist/modules/commands/components/menus/floating-menu.client.d.mts +6 -7
  12. package/dist/modules/commands/components/menus/inline-menu.client.d.mts +6 -7
  13. package/dist/modules/commands/components/menus/responsive-menu.client.d.mts +5 -6
  14. package/dist/modules/commands/components/render-command.mjs +3 -5
  15. package/dist/modules/commands/lib/builder.d.mts +114 -18
  16. package/dist/modules/commands/lib/builder.mjs +42 -7
  17. package/dist/modules/commands/lib/registery.d.mts +47 -14
  18. package/dist/modules/commands/lib/registery.mjs +76 -16
  19. package/dist/modules/commands/lib/utils.d.mts +11 -0
  20. package/dist/modules/commands/lib/utils.mjs +14 -0
  21. package/dist/modules/data-tables/components/footer.mjs +3 -0
  22. package/dist/modules/data-tables/hooks/use-context.client.d.mts +2 -2
  23. package/dist/modules/data-tables/lib/types.d.mts +3 -3
  24. package/dist/modules/data-tables/strategies/local/components.mjs +25 -0
  25. package/dist/modules/data-tables/strategies/local/strategy.d.mts +12 -0
  26. package/dist/modules/data-tables/strategies/local/strategy.mjs +31 -0
  27. package/dist/modules/inline/components/inputs/combobox-dropdown.client.d.mts +4 -3
  28. package/dist/modules/inline/components/inputs/combobox.client.d.mts +4 -3
  29. package/dist/modules/inline/components/inputs/date-time.client.d.mts +4 -3
  30. package/dist/modules/inline/components/inputs/editor.client.d.mts +4 -3
  31. package/dist/modules/inline/components/inputs/input.client.d.mts +7 -5
  32. package/dist/modules/inline/components/inputs/select.client.d.mts +4 -3
  33. package/dist/modules/inline/components/inputs/switch.client.d.mts +4 -3
  34. package/dist/modules/inline/lib/variants.d.mts +1 -1
  35. package/dist/modules/router/lib/query-client.d.mts +2 -1
  36. package/dist/modules/router/lib/query-client.mjs +2 -2
  37. package/dist/modules/storage/lib/service.server.d.mts +9 -9
  38. package/dist/router.d.mts +2 -1
  39. package/dist/router.mjs +2 -1
  40. package/dist/src/components/ui/badge.d.mts +1 -1
  41. package/dist/src/components/ui/button-group.d.mts +1 -1
  42. package/dist/src/components/ui/button.d.mts +2 -2
  43. package/dist/src/components/ui/field.client.d.mts +1 -1
  44. package/dist/src/components/ui/item.d.mts +1 -1
  45. package/dist/src/modules/auth/handler/create-client.client.d.mts +2 -2
  46. package/dist/src/modules/commands/components/menus/context-menu.client.d.mts +6 -7
  47. package/dist/src/modules/commands/components/menus/dropdown-menu.client.d.mts +6 -7
  48. package/dist/src/modules/commands/components/menus/floating-menu.client.d.mts +6 -7
  49. package/dist/src/modules/commands/components/menus/inline-menu.client.d.mts +6 -7
  50. package/dist/src/modules/commands/components/menus/responsive-menu.client.d.mts +5 -6
  51. package/dist/src/modules/commands/components/render-command.mjs +3 -5
  52. package/dist/src/modules/commands/lib/builder.d.mts +114 -18
  53. package/dist/src/modules/commands/lib/builder.mjs +42 -7
  54. package/dist/src/modules/commands/lib/registery.d.mts +47 -14
  55. package/dist/src/modules/commands/lib/registery.mjs +76 -16
  56. package/dist/src/modules/commands/lib/utils.d.mts +11 -0
  57. package/dist/src/modules/commands/lib/utils.mjs +14 -0
  58. package/dist/src/modules/data-tables/components/footer.mjs +3 -0
  59. package/dist/src/modules/data-tables/hooks/use-context.client.d.mts +2 -2
  60. package/dist/src/modules/data-tables/lib/types.d.mts +3 -3
  61. package/dist/src/modules/data-tables/strategies/local/components.mjs +25 -0
  62. package/dist/src/modules/data-tables/strategies/local/strategy.d.mts +12 -0
  63. package/dist/src/modules/data-tables/strategies/local/strategy.mjs +31 -0
  64. package/dist/src/modules/inline/components/inputs/combobox-dropdown.client.d.mts +4 -3
  65. package/dist/src/modules/inline/components/inputs/combobox.client.d.mts +4 -3
  66. package/dist/src/modules/inline/components/inputs/date-time.client.d.mts +4 -3
  67. package/dist/src/modules/inline/components/inputs/editor.client.d.mts +4 -3
  68. package/dist/src/modules/inline/components/inputs/input.client.d.mts +7 -5
  69. package/dist/src/modules/inline/components/inputs/select.client.d.mts +4 -3
  70. package/dist/src/modules/inline/components/inputs/switch.client.d.mts +4 -3
  71. package/dist/src/modules/inline/lib/variants.d.mts +1 -1
  72. package/dist/src/modules/router/lib/query-client.d.mts +2 -1
  73. package/dist/src/modules/router/lib/query-client.mjs +2 -2
  74. package/dist/src/modules/storage/lib/service.server.d.mts +21 -21
  75. package/package.json +1 -1
  76. package/src/modules/commands/components/menus/context-menu.client.tsx +11 -11
  77. package/src/modules/commands/components/menus/dropdown-menu.client.tsx +9 -10
  78. package/src/modules/commands/components/menus/floating-menu.client.tsx +9 -10
  79. package/src/modules/commands/components/menus/inline-menu.client.tsx +9 -10
  80. package/src/modules/commands/components/menus/responsive-menu.client.tsx +7 -8
  81. package/src/modules/commands/components/render-command.tsx +17 -13
  82. package/src/modules/commands/entry.ts +1 -0
  83. package/src/modules/commands/lib/builder.ts +216 -36
  84. package/src/modules/commands/lib/registery.ts +210 -47
  85. package/src/modules/commands/lib/utils.ts +10 -0
  86. package/src/modules/data-tables/components/footer.tsx +9 -0
  87. package/src/modules/data-tables/entry.client.ts +1 -0
  88. package/src/modules/data-tables/hooks/use-context.client.tsx +2 -2
  89. package/src/modules/data-tables/lib/types.ts +3 -3
  90. package/src/modules/data-tables/strategies/local/components.tsx +17 -0
  91. package/src/modules/data-tables/strategies/local/strategy.ts +33 -0
  92. package/src/modules/inline/components/inputs/combobox-dropdown.client.tsx +11 -5
  93. package/src/modules/inline/components/inputs/combobox.client.tsx +11 -5
  94. package/src/modules/inline/components/inputs/date-time.client.tsx +11 -5
  95. package/src/modules/inline/components/inputs/editor.client.tsx +11 -5
  96. package/src/modules/inline/components/inputs/input.client.tsx +21 -9
  97. package/src/modules/inline/components/inputs/select.client.tsx +11 -5
  98. package/src/modules/inline/components/inputs/switch.client.tsx +11 -5
  99. package/src/modules/router/entry.ts +1 -0
  100. package/src/modules/router/lib/query-client.ts +2 -2
  101. package/src/styles.css +91 -0
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  import { InfinteTableBottombar, InfinteTableFooter } from "../strategies/infinite/components.mjs";
4
+ import { LocalTableFooter } from "../strategies/local/components.mjs";
4
5
  import { PaginationTableFooter } from "../strategies/pagination/components.mjs";
5
6
  import { jsx } from "react/jsx-runtime";
6
7
 
@@ -12,6 +13,7 @@ function TableFooter({ table }) {
12
13
  const meta = table.options.meta;
13
14
  if (meta.strategy.name === "pagination") return null;
14
15
  if (meta.strategy.name === "infinite") return /* @__PURE__ */ jsx(InfinteTableFooter, { table });
16
+ if (meta.strategy.name === "local") return null;
15
17
  throw new Error(`Unknown strategy: ${meta.strategy.name}`);
16
18
  }
17
19
  /**
@@ -21,6 +23,7 @@ function TableBottombar({ table }) {
21
23
  const meta = table.options.meta;
22
24
  if (meta.strategy.name === "pagination") return /* @__PURE__ */ jsx(PaginationTableFooter, { table });
23
25
  if (meta.strategy.name === "infinite") return /* @__PURE__ */ jsx(InfinteTableBottombar, { table });
26
+ if (meta.strategy.name === "local") return /* @__PURE__ */ jsx(LocalTableFooter, { table });
24
27
  throw new Error(`Unknown strategy: ${meta.strategy.name}`);
25
28
  }
26
29
 
@@ -1,4 +1,4 @@
1
- import { CommandDef } from "../../commands/lib/builder.mjs";
1
+ import { CommandFor } from "../../commands/lib/builder.mjs";
2
2
  import { TableFiltersResult } from "../lib/filters/config.mjs";
3
3
  import { Selection, TableColumnDef, TableMetaInput, TableStrategy } from "../lib/types.mjs";
4
4
  import * as react_jsx_runtime0 from "react/jsx-runtime";
@@ -21,7 +21,7 @@ type TableConfigContextValue<TData, TFilters extends TableFiltersResult = TableF
21
21
  strategy: TableStrategy;
22
22
  selection?: Selection;
23
23
  columnVisibility?: VisibilityState;
24
- commands?: CommandDef[];
24
+ commands?: CommandFor<TData[], TMeta>[];
25
25
  meta?: TMeta;
26
26
  where?: TFilters;
27
27
  };
@@ -1,5 +1,5 @@
1
1
  import { Permission } from "../../auth/lib/permissions.mjs";
2
- import { CommandDef } from "../../commands/lib/builder.mjs";
2
+ import { CommandFor } from "../../commands/lib/builder.mjs";
3
3
  import { UseQueryStatesKeysMap } from "nuqs";
4
4
  import { ColumnDef, PaginationState, RowSelectionState, SortingState, TableMeta, Updater } from "@tanstack/react-table";
5
5
 
@@ -11,7 +11,7 @@ type TableMetaInput<TData> = TableMeta<TData>;
11
11
  type TableMeta$1<TData, TMeta = TableMetaInput<TData>> = {
12
12
  strategy: TableStrategy;
13
13
  selectedData: TData[];
14
- commands?: CommandDef[];
14
+ commands?: CommandFor<TData[], TMeta>[];
15
15
  };
16
16
  /**
17
17
  * Table column definition
@@ -24,7 +24,7 @@ type TableColumnDef<TData> = ColumnDef<TData> & {
24
24
  * Data table strategy
25
25
  */
26
26
  type TableStrategy = {
27
- name: "pagination" | "infinite";
27
+ name: "pagination" | "infinite" | "local";
28
28
  rowCount?: number;
29
29
  paginationState?: PaginationState;
30
30
  manualPagination?: boolean;
@@ -0,0 +1,25 @@
1
+ "use client";
2
+
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+
5
+ //#region src/modules/data-tables/strategies/local/components.tsx
6
+ function LocalTableFooter({ table }) {
7
+ const selected = Object.keys(table.getState().rowSelection).length;
8
+ const total = table.getRowCount();
9
+ return /* @__PURE__ */ jsx("div", {
10
+ className: "flex flex-col gap-y-2 px-2 md:flex-row md:items-center md:justify-between",
11
+ children: /* @__PURE__ */ jsxs("div", {
12
+ className: "text-muted-foreground text-sm",
13
+ children: [
14
+ selected ?? table.getFilteredSelectedRowModel().rows.length,
15
+ " of",
16
+ " ",
17
+ total ?? table.getRowModel().rows.length,
18
+ " row(s) selected."
19
+ ]
20
+ })
21
+ });
22
+ }
23
+
24
+ //#endregion
25
+ export { LocalTableFooter };
@@ -0,0 +1,12 @@
1
+ import { TableStrategy } from "../../lib/types.mjs";
2
+
3
+ //#region src/modules/data-tables/strategies/local/strategy.d.ts
4
+ type UseLocalStrategyInput = {
5
+ total?: number;
6
+ };
7
+ type LocalStrategy = typeof useLocalStrategy;
8
+ declare function useLocalStrategy({
9
+ total
10
+ }?: UseLocalStrategyInput): TableStrategy;
11
+ //#endregion
12
+ export { LocalStrategy, UseLocalStrategyInput, useLocalStrategy };
@@ -0,0 +1,31 @@
1
+ "use client";
2
+
3
+ import { tableSearchParams } from "../../lib/search-params.mjs";
4
+ import { handleSortingChange } from "../helpers/sorting.mjs";
5
+ import { useQueryStates } from "nuqs";
6
+
7
+ //#region src/modules/data-tables/strategies/local/strategy.ts
8
+ function useLocalStrategy({ total } = {}) {
9
+ const [query, setQuery] = useQueryStates(tableSearchParams);
10
+ const sortingState = query.sort ? [{
11
+ id: query.sort,
12
+ desc: query.order === "desc"
13
+ }] : [];
14
+ const resetCursor = () => null;
15
+ return {
16
+ name: "local",
17
+ rowCount: total,
18
+ resetCursor,
19
+ tableSearchParams,
20
+ sortingState,
21
+ manualSorting: true,
22
+ onSortingChange: handleSortingChange({
23
+ sortingState,
24
+ setQuery,
25
+ resetCursor
26
+ })
27
+ };
28
+ }
29
+
30
+ //#endregion
31
+ export { useLocalStrategy };
@@ -7,10 +7,11 @@ import { DefaultError } from "@tanstack/react-query";
7
7
 
8
8
  //#region src/modules/inline/components/inputs/combobox-dropdown.client.d.ts
9
9
  type ComboboxDropdownInlineTrigger = "commit";
10
- type InlineEditComboboxDropdownProps<TValue extends ComboboxDropdownItem, TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = useInlineEditOptions<ComboboxDropdownInlineTrigger, z$1.ZodString | z$1.ZodNullable<z$1.ZodString>, TData, TError, TVariables, TOnMutateResult> & InlineEditVariantsProps & Omit<ComboboxDropdownProps<TValue>, "onSelect"> & {
10
+ type InlineStringSchema = z$1.ZodType<string | null, string | null> | z$1.ZodType<string, string>;
11
+ type InlineEditComboboxDropdownProps<TValue extends ComboboxDropdownItem, TSchema extends InlineStringSchema = z$1.ZodType<string | null, string | null>, TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = useInlineEditOptions<ComboboxDropdownInlineTrigger, TSchema, TData, TError, TVariables, TOnMutateResult> & InlineEditVariantsProps & Omit<ComboboxDropdownProps<TValue>, "onSelect"> & {
11
12
  onSelect?: ComboboxDropdownProps<TValue>["onSelect"];
12
13
  };
13
- declare function InlineComboboxDropdown<TValue extends ComboboxDropdownItem, TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown>({
14
+ declare function InlineComboboxDropdown<TValue extends ComboboxDropdownItem, TSchema extends InlineStringSchema = z$1.ZodType<string | null, string | null>, TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown>({
14
15
  selectedItem,
15
16
  variant,
16
17
  className,
@@ -22,6 +23,6 @@ declare function InlineComboboxDropdown<TValue extends ComboboxDropdownItem, TDa
22
23
  strategy,
23
24
  disabled,
24
25
  ...props
25
- }: InlineEditComboboxDropdownProps<TValue, TData, TError, TVariables, TOnMutateResult>): react_jsx_runtime0.JSX.Element;
26
+ }: InlineEditComboboxDropdownProps<TValue, TSchema, TData, TError, TVariables, TOnMutateResult>): react_jsx_runtime0.JSX.Element;
26
27
  //#endregion
27
28
  export { InlineComboboxDropdown, InlineEditComboboxDropdownProps };
@@ -6,8 +6,9 @@ import { DefaultError } from "@tanstack/react-query";
6
6
 
7
7
  //#region src/modules/inline/components/inputs/combobox.client.d.ts
8
8
  type ComboboxInlineTrigger = "commit";
9
- type InlineComboboxProps<TValue, TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = useInlineEditOptions<ComboboxInlineTrigger, z$1.ZodString | z$1.ZodNullable<z$1.ZodString>, TData, TError, TVariables, TOnMutateResult> & Omit<ComboboxProps<TValue>, "value">;
10
- declare function InlineCombobox<TValue, TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown>({
9
+ type InlineStringSchema = z$1.ZodType<string | null, string | null> | z$1.ZodType<string, string>;
10
+ type InlineComboboxProps<TValue, TSchema extends InlineStringSchema = z$1.ZodType<string | null, string | null>, TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = useInlineEditOptions<ComboboxInlineTrigger, TSchema, TData, TError, TVariables, TOnMutateResult> & Omit<ComboboxProps<TValue>, "value">;
11
+ declare function InlineCombobox<TValue, TSchema extends InlineStringSchema = z$1.ZodType<string | null, string | null>, TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown>({
11
12
  initialValue,
12
13
  variables,
13
14
  mutation,
@@ -17,6 +18,6 @@ declare function InlineCombobox<TValue, TData = unknown, TError = DefaultError,
17
18
  disabled,
18
19
  strategy,
19
20
  ...props
20
- }: InlineComboboxProps<TValue, TData, TError, TVariables, TOnMutateResult>): react_jsx_runtime0.JSX.Element;
21
+ }: InlineComboboxProps<TValue, TSchema, TData, TError, TVariables, TOnMutateResult>): react_jsx_runtime0.JSX.Element;
21
22
  //#endregion
22
23
  export { InlineCombobox, InlineComboboxProps };
@@ -8,8 +8,9 @@ import { DefaultError } from "@tanstack/react-query";
8
8
 
9
9
  //#region src/modules/inline/components/inputs/date-time.client.d.ts
10
10
  type DateTimeInlineTrigger = "change" | "blur";
11
- type InlineDateTimeInputProps<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = ComponentProps<typeof DateTimeInput> & useInlineEditOptions<DateTimeInlineTrigger, z$1.ZodDate | z$1.ZodNullable<z$1.ZodDate>, TData, TError, TVariables, TOnMutateResult> & InlineEditVariantsProps;
12
- declare function InlineDateTimeInput<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown>({
11
+ type InlineDateTimeSchema = z$1.ZodType<Date | null, Date | null> | z$1.ZodType<Date, Date>;
12
+ type InlineDateTimeInputProps<TSchema extends InlineDateTimeSchema = z$1.ZodType<Date | null, Date | null>, TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = ComponentProps<typeof DateTimeInput> & useInlineEditOptions<DateTimeInlineTrigger, TSchema, TData, TError, TVariables, TOnMutateResult> & InlineEditVariantsProps;
13
+ declare function InlineDateTimeInput<TSchema extends InlineDateTimeSchema = z$1.ZodType<Date | null, Date | null>, TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown>({
13
14
  initialValue,
14
15
  variables,
15
16
  mutation,
@@ -19,6 +20,6 @@ declare function InlineDateTimeInput<TData = unknown, TError = DefaultError, TVa
19
20
  strategy,
20
21
  disabled,
21
22
  ...props
22
- }: InlineDateTimeInputProps<TData, TError, TVariables, TOnMutateResult>): react_jsx_runtime0.JSX.Element;
23
+ }: InlineDateTimeInputProps<TSchema, TData, TError, TVariables, TOnMutateResult>): react_jsx_runtime0.JSX.Element;
23
24
  //#endregion
24
25
  export { InlineDateTimeInput };
@@ -8,8 +8,9 @@ import { DefaultError } from "@tanstack/react-query";
8
8
 
9
9
  //#region src/modules/inline/components/inputs/editor.client.d.ts
10
10
  type EditorInlineTrigger = "change" | "blur";
11
- type InlineEditorProps<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = useInlineEditOptions<EditorInlineTrigger, z$1.ZodType<EditorJSONContent | null, EditorJSONContent | null>, TData, TError, TVariables, TOnMutateResult> & InlineEditVariantsProps & Omit<EditorProps, "value" | "onUpdate" | "onBlur" | "variant">;
12
- declare function InlineEditor<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown>({
11
+ type InlineEditorSchema = z$1.ZodType<EditorJSONContent | null, EditorJSONContent | null> | z$1.ZodType<EditorJSONContent, EditorJSONContent>;
12
+ type InlineEditorProps<TSchema extends InlineEditorSchema = z$1.ZodType<EditorJSONContent | null, EditorJSONContent | null>, TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = useInlineEditOptions<EditorInlineTrigger, TSchema, TData, TError, TVariables, TOnMutateResult> & InlineEditVariantsProps & Omit<EditorProps, "value" | "onUpdate" | "onBlur" | "variant">;
13
+ declare function InlineEditor<TSchema extends InlineEditorSchema = z$1.ZodType<EditorJSONContent | null, EditorJSONContent | null>, TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown>({
13
14
  initialValue,
14
15
  variables,
15
16
  mutation,
@@ -20,6 +21,6 @@ declare function InlineEditor<TData = unknown, TError = DefaultError, TVariables
20
21
  strategy,
21
22
  className,
22
23
  children
23
- }: InlineEditorProps<TData, TError, TVariables, TOnMutateResult>): react_jsx_runtime0.JSX.Element;
24
+ }: InlineEditorProps<TSchema, TData, TError, TVariables, TOnMutateResult>): react_jsx_runtime0.JSX.Element;
24
25
  //#endregion
25
26
  export { InlineEditor, InlineEditorProps };
@@ -8,11 +8,13 @@ import { DefaultError } from "@tanstack/react-query";
8
8
 
9
9
  //#region src/modules/inline/components/inputs/input.client.d.ts
10
10
  type InputInlineTrigger = "change" | "blur";
11
+ type InlineStringSchema = z$1.ZodType<string | null, string | null> | z$1.ZodType<string, string>;
12
+ type InlineNumberSchema = z$1.ZodType<number | null, number | null> | z$1.ZodType<number, number>;
11
13
  type InlineEditInputProps<TSchema extends z$1.ZodType, TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = Omit<ComponentProps<typeof Input>, "type"> & useInlineEditOptions<InputInlineTrigger, TSchema, TData, TError, TVariables, TOnMutateResult> & InlineEditVariantsProps;
12
14
  /**
13
15
  * The inline edit string input component.
14
16
  */
15
- declare function InlineStringInput<TSchema extends z$1.ZodType<string | null, string | null>, TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown>({
17
+ declare function InlineStringInput<TSchema extends InlineStringSchema = z$1.ZodType<string | null, string | null>, TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown>({
16
18
  initialValue,
17
19
  variables,
18
20
  mutation,
@@ -23,7 +25,7 @@ declare function InlineStringInput<TSchema extends z$1.ZodType<string | null, st
23
25
  disabled,
24
26
  ...props
25
27
  }: InlineEditInputProps<TSchema, TData, TError, TVariables, TOnMutateResult>): react_jsx_runtime0.JSX.Element;
26
- declare function InlineNumberInput<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown>({
28
+ declare function InlineNumberInput<TSchema extends InlineNumberSchema = z$1.ZodType<number | null, number | null>, TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown>({
27
29
  initialValue,
28
30
  variables,
29
31
  mutation,
@@ -33,11 +35,11 @@ declare function InlineNumberInput<TData = unknown, TError = DefaultError, TVari
33
35
  strategy,
34
36
  disabled,
35
37
  ...props
36
- }: InlineEditInputProps<z$1.ZodNumber | z$1.ZodNullable<z$1.ZodNumber>, TData, TError, TVariables, TOnMutateResult>): react_jsx_runtime0.JSX.Element;
38
+ }: InlineEditInputProps<TSchema, TData, TError, TVariables, TOnMutateResult>): react_jsx_runtime0.JSX.Element;
37
39
  /**
38
40
  * The inline edit decimal input component.
39
41
  */
40
- declare function InlineDecimalInput<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown>({
42
+ declare function InlineDecimalInput<TSchema extends z$1.ZodType<string | null, string | null> | z$1.ZodType<string, string> = z$1.ZodType<string | null, string | null>, TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown>({
41
43
  initialValue,
42
44
  variables,
43
45
  mutation,
@@ -47,6 +49,6 @@ declare function InlineDecimalInput<TData = unknown, TError = DefaultError, TVar
47
49
  strategy,
48
50
  disabled,
49
51
  ...props
50
- }: InlineEditInputProps<z$1.ZodString | z$1.ZodNullable<z$1.ZodString>, TData, TError, TVariables, TOnMutateResult>): react_jsx_runtime0.JSX.Element;
52
+ }: InlineEditInputProps<TSchema, TData, TError, TVariables, TOnMutateResult>): react_jsx_runtime0.JSX.Element;
51
53
  //#endregion
52
54
  export { InlineDecimalInput, InlineNumberInput, InlineStringInput };
@@ -8,8 +8,9 @@ import { DefaultError } from "@tanstack/react-query";
8
8
 
9
9
  //#region src/modules/inline/components/inputs/select.client.d.ts
10
10
  type SelectInlineTrigger = "commit";
11
- type InlineSelectProps<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = Omit<ComponentProps<typeof Select>, "value" | "defaultValue"> & useInlineEditOptions<SelectInlineTrigger, z$1.ZodString | z$1.ZodNullable<z$1.ZodString>, TData, TError, TVariables, TOnMutateResult>;
12
- declare function InlineSelect<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown>({
11
+ type InlineStringSchema = z$1.ZodType<string | null, string | null> | z$1.ZodType<string, string>;
12
+ type InlineSelectProps<TSchema extends InlineStringSchema = z$1.ZodType<string | null, string | null>, TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = Omit<ComponentProps<typeof Select>, "value" | "defaultValue"> & useInlineEditOptions<SelectInlineTrigger, TSchema, TData, TError, TVariables, TOnMutateResult>;
13
+ declare function InlineSelect<TSchema extends InlineStringSchema = z$1.ZodType<string | null, string | null>, TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown>({
13
14
  initialValue,
14
15
  variables,
15
16
  mutation,
@@ -18,7 +19,7 @@ declare function InlineSelect<TData = unknown, TError = DefaultError, TVariables
18
19
  disabled,
19
20
  onValueChange,
20
21
  ...props
21
- }: InlineSelectProps<TData, TError, TVariables, TOnMutateResult>): react_jsx_runtime0.JSX.Element;
22
+ }: InlineSelectProps<TSchema, TData, TError, TVariables, TOnMutateResult>): react_jsx_runtime0.JSX.Element;
22
23
  declare function InlineSelectTrigger({
23
24
  variant,
24
25
  className,
@@ -7,8 +7,9 @@ import { DefaultError } from "@tanstack/react-query";
7
7
 
8
8
  //#region src/modules/inline/components/inputs/switch.client.d.ts
9
9
  type SwitchInlineTrigger = "commit";
10
- type InlineSwitchProps<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = ComponentProps<typeof Switch> & useInlineEditOptions<SwitchInlineTrigger, z$1.ZodBoolean | z$1.ZodNullable<z$1.ZodBoolean>, TData, TError, TVariables, TOnMutateResult>;
11
- declare function InlineSwitch<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown>({
10
+ type InlineBooleanSchema = z$1.ZodType<boolean | null, boolean | null> | z$1.ZodType<boolean, boolean>;
11
+ type InlineSwitchProps<TSchema extends InlineBooleanSchema = z$1.ZodType<boolean | null, boolean | null>, TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = ComponentProps<typeof Switch> & useInlineEditOptions<SwitchInlineTrigger, TSchema, TData, TError, TVariables, TOnMutateResult>;
12
+ declare function InlineSwitch<TSchema extends InlineBooleanSchema = z$1.ZodType<boolean | null, boolean | null>, TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown>({
12
13
  initialValue,
13
14
  variables,
14
15
  mutation,
@@ -16,6 +17,6 @@ declare function InlineSwitch<TData = unknown, TError = DefaultError, TVariables
16
17
  strategy,
17
18
  disabled,
18
19
  ...props
19
- }: InlineSwitchProps<TData, TError, TVariables, TOnMutateResult>): react_jsx_runtime0.JSX.Element;
20
+ }: InlineSwitchProps<TSchema, TData, TError, TVariables, TOnMutateResult>): react_jsx_runtime0.JSX.Element;
20
21
  //#endregion
21
22
  export { InlineSwitch };
@@ -4,7 +4,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
4
4
  //#region src/modules/inline/lib/variants.d.ts
5
5
  declare const inlineEditVariants: (props?: ({
6
6
  variant?: "default" | "table" | null | undefined;
7
- status?: "error" | "success" | "pending" | "idle" | null | undefined;
7
+ status?: "success" | "error" | "pending" | "idle" | null | undefined;
8
8
  } & class_variance_authority_types0.ClassProp) | undefined) => string;
9
9
  type InlineEditVariantsProps = VariantProps<typeof inlineEditVariants>;
10
10
  //#endregion
@@ -5,5 +5,6 @@ import { QueryClient } from "@tanstack/react-query";
5
5
  * Create a new query client
6
6
  */
7
7
  declare function createQueryClient(): QueryClient;
8
+ declare function getQueryClient(): QueryClient;
8
9
  //#endregion
9
- export { createQueryClient };
10
+ export { createQueryClient, getQueryClient };
@@ -1,5 +1,5 @@
1
1
  import { serializer } from "./helpers.mjs";
2
- import { MutationCache, QueryClient, isServer } from "@tanstack/react-query";
2
+ import { MutationCache, QueryClient, environmentManager } from "@tanstack/react-query";
3
3
 
4
4
  //#region src/modules/router/lib/query-client.ts
5
5
  /**
@@ -41,7 +41,7 @@ function createQueryClient() {
41
41
  */
42
42
  let browserQueryClient;
43
43
  function getQueryClient() {
44
- if (isServer) return createQueryClient();
44
+ if (environmentManager.isServer()) return createQueryClient();
45
45
  if (!browserQueryClient) browserQueryClient = createQueryClient();
46
46
  return browserQueryClient;
47
47
  }
@@ -1915,19 +1915,19 @@ declare class Storage<TSchema extends TDatabaseSchema> {
1915
1915
  */
1916
1916
  presignUpload(props: PresignUploadInput): Promise<{
1917
1917
  presignedUrl: string;
1918
+ contentType: string | null;
1919
+ size: number | null;
1920
+ metadata: unknown;
1921
+ key: string;
1922
+ status: "error" | "pending" | "ready";
1918
1923
  id: string;
1919
1924
  createdAt: Date;
1920
1925
  updatedAt: Date;
1921
1926
  name: string | null;
1922
- key: string;
1923
- metadata: unknown;
1924
1927
  provider: "s3";
1925
- uploadId: string;
1926
- visibility: "private" | "public";
1927
- size: number | null;
1928
- contentType: string | null;
1929
1928
  bucket: string;
1930
- status: "error" | "pending" | "ready";
1929
+ visibility: "private" | "public";
1930
+ uploadId: string;
1931
1931
  etag: string | null;
1932
1932
  uploadedAt: Date;
1933
1933
  deletedAt: Date | null;
@@ -2164,19 +2164,19 @@ declare class Storage<TSchema extends TDatabaseSchema> {
2164
2164
  * @returns The purged asset record, or null if not found
2165
2165
  */
2166
2166
  purgeAsset(input: string): Promise<{
2167
+ contentType: string | null;
2168
+ size: number | null;
2169
+ metadata: unknown;
2170
+ key: string;
2171
+ status: "error" | "pending" | "ready";
2167
2172
  id: string;
2168
2173
  createdAt: Date;
2169
2174
  updatedAt: Date;
2170
2175
  name: string | null;
2171
- key: string;
2172
- metadata: unknown;
2173
2176
  provider: "s3";
2174
- uploadId: string;
2175
- visibility: "private" | "public";
2176
- size: number | null;
2177
- contentType: string | null;
2178
2177
  bucket: string;
2179
- status: "error" | "pending" | "ready";
2178
+ visibility: "private" | "public";
2179
+ uploadId: string;
2180
2180
  etag: string | null;
2181
2181
  uploadedAt: Date;
2182
2182
  deletedAt: Date | null;
@@ -2195,19 +2195,19 @@ declare class Storage<TSchema extends TDatabaseSchema> {
2195
2195
  * @throws {ServerError} If provider deletion fails
2196
2196
  */
2197
2197
  purgeAssets(input: string[]): Promise<{
2198
+ contentType: string | null;
2199
+ size: number | null;
2200
+ metadata: unknown;
2201
+ key: string;
2202
+ status: "error" | "pending" | "ready";
2198
2203
  id: string;
2199
2204
  createdAt: Date;
2200
2205
  updatedAt: Date;
2201
2206
  name: string | null;
2202
- key: string;
2203
- metadata: unknown;
2204
2207
  provider: "s3";
2205
- uploadId: string;
2206
- visibility: "private" | "public";
2207
- size: number | null;
2208
- contentType: string | null;
2209
2208
  bucket: string;
2210
- status: "error" | "pending" | "ready";
2209
+ visibility: "private" | "public";
2210
+ uploadId: string;
2211
2211
  etag: string | null;
2212
2212
  uploadedAt: Date;
2213
2213
  deletedAt: Date | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tulip-systems/core",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "license": "AGPL-3.0",
@@ -1,7 +1,6 @@
1
1
  "use client";
2
2
 
3
3
  import type { ComponentProps, ReactNode } from "react";
4
- import type z from "zod";
5
4
  import {
6
5
  ContextMenu,
7
6
  ContextMenuContent,
@@ -10,15 +9,16 @@ import {
10
9
  } from "@/components/ui/context-menu.client";
11
10
  import { cn } from "@/lib/entry";
12
11
  import type { CommandContextLifecycle } from "../../hooks/use-command.client";
13
- import type { CommandDef } from "../../lib/builder";
12
+ import type { AnyCommandDef, CommandDef, ExtractCommandData } from "../../lib/builder";
14
13
  import { RenderCommand } from "../render-command";
15
14
 
16
- export type ContextCommandMenuContentProps<TSchema extends z.ZodTypeAny, TMeta> = ComponentProps<
17
- typeof ContextMenuContent
18
- > &
15
+ export type ContextCommandMenuContentProps<
16
+ TCommand extends AnyCommandDef,
17
+ TMeta = object,
18
+ > = ComponentProps<typeof ContextMenuContent> &
19
19
  CommandContextLifecycle & {
20
- data: unknown;
21
- commands: Array<CommandDef<z.ZodTypeAny, TMeta>>;
20
+ data: NoInfer<ExtractCommandData<TCommand>>;
21
+ commands: TCommand[];
22
22
  meta?: TMeta;
23
23
  fallback?: ReactNode;
24
24
  emptyLabel?: string;
@@ -37,7 +37,7 @@ export const ContextCommandMenuTrigger = ContextMenuTrigger;
37
37
  /**
38
38
  * ContextCommandMenuContent
39
39
  */
40
- export function ContextCommandMenuContent<TSchema extends z.ZodTypeAny, TMeta>({
40
+ export function ContextCommandMenuContent<TCommand extends AnyCommandDef, TMeta = object>({
41
41
  data,
42
42
  commands,
43
43
  meta,
@@ -48,7 +48,7 @@ export function ContextCommandMenuContent<TSchema extends z.ZodTypeAny, TMeta>({
48
48
  className,
49
49
  emptyLabel = "Geen acties beschikbaar",
50
50
  ...props
51
- }: ContextCommandMenuContentProps<TSchema, TMeta>) {
51
+ }: ContextCommandMenuContentProps<TCommand, TMeta>) {
52
52
  if (!commands.length) {
53
53
  return (
54
54
  <ContextMenuContent {...props} className={cn("min-w-40", className)}>
@@ -64,8 +64,8 @@ export function ContextCommandMenuContent<TSchema extends z.ZodTypeAny, TMeta>({
64
64
  {commands.map((command, index) => (
65
65
  <RenderCommand
66
66
  key={index}
67
- command={command}
68
- data={data}
67
+ command={command as CommandDef<unknown, TMeta>}
68
+ data={data as unknown}
69
69
  meta={meta}
70
70
  fallback={fallback}
71
71
  ui="context"
@@ -2,7 +2,6 @@
2
2
 
3
3
  import { MoreHorizontal } from "lucide-react";
4
4
  import React, { type ComponentProps, type HTMLAttributes, type ReactNode } from "react";
5
- import type z from "zod";
6
5
  import { Skeleton } from "@/components/entry";
7
6
  import { Button } from "@/components/ui/button";
8
7
  import {
@@ -12,21 +11,21 @@ import {
12
11
  } from "@/components/ui/dropdown-menu.client";
13
12
  import { cn } from "@/lib/utils/cn";
14
13
  import type { CommandContextLifecycle } from "../../hooks/use-command.client";
15
- import type { CommandDef } from "../../lib/builder";
14
+ import type { AnyCommandDef, CommandDef, ExtractCommandData } from "../../lib/builder";
16
15
  import { RenderCommand } from "../render-command";
17
16
 
18
17
  export type DropdownCommandMenuProps<
19
- TSchema extends z.ZodTypeAny,
20
- TMeta,
18
+ TCommand extends AnyCommandDef,
19
+ TMeta = object,
21
20
  > = HTMLAttributes<HTMLElement> &
22
21
  CommandContextLifecycle & {
23
- data: unknown;
24
- commands: Array<CommandDef<z.ZodTypeAny, TMeta>>;
22
+ data: NoInfer<ExtractCommandData<TCommand>>;
23
+ commands: TCommand[];
25
24
  meta?: TMeta;
26
25
  fallback?: ReactNode;
27
26
  };
28
27
 
29
- export function DropdownCommandMenu<TSchema extends z.ZodTypeAny, TMeta>({
28
+ export function DropdownCommandMenu<TCommand extends AnyCommandDef, TMeta = object>({
30
29
  data,
31
30
  commands,
32
31
  meta,
@@ -36,7 +35,7 @@ export function DropdownCommandMenu<TSchema extends z.ZodTypeAny, TMeta>({
36
35
  onSettled,
37
36
  className,
38
37
  ...props
39
- }: DropdownCommandMenuProps<TSchema, TMeta>) {
38
+ }: DropdownCommandMenuProps<TCommand, TMeta>) {
40
39
  const [open, setOpen] = React.useState(false);
41
40
 
42
41
  if (!commands.length) return null;
@@ -58,8 +57,8 @@ export function DropdownCommandMenu<TSchema extends z.ZodTypeAny, TMeta>({
58
57
  {commands.map((command, index) => (
59
58
  <RenderCommand
60
59
  key={index}
61
- command={command}
62
- data={data}
60
+ command={command as CommandDef<unknown, TMeta>}
61
+ data={data as unknown}
63
62
  meta={meta}
64
63
  fallback={fallback}
65
64
  ui="dropdown"
@@ -1,26 +1,25 @@
1
1
  "use client";
2
2
 
3
3
  import type { HTMLAttributes, ReactNode } from "react";
4
- import type z from "zod";
5
4
  import { cn } from "@/lib/utils/cn";
6
5
  import type { CommandContextLifecycle } from "../../hooks/use-command.client";
7
- import type { CommandDef } from "../../lib/builder";
6
+ import type { AnyCommandDef, CommandDef, ExtractCommandData } from "../../lib/builder";
8
7
  import { RenderCommand } from "../render-command";
9
8
 
10
9
  export type FloatingCommandMenuProps<
11
- TSchema extends z.ZodTypeAny,
12
- TMeta,
10
+ TCommand extends AnyCommandDef,
11
+ TMeta = object,
13
12
  > = HTMLAttributes<HTMLElement> &
14
13
  CommandContextLifecycle & {
15
- data: unknown;
16
- commands: Array<CommandDef<z.ZodTypeAny, TMeta>>;
14
+ data: NoInfer<ExtractCommandData<TCommand>>;
15
+ commands: TCommand[];
17
16
  meta?: TMeta;
18
17
  fallback?: ReactNode;
19
18
  state: "open" | "closed";
20
19
  emptyLabel?: string;
21
20
  };
22
21
 
23
- export function FloatingCommandMenu<TSchema extends z.ZodTypeAny, TMeta>({
22
+ export function FloatingCommandMenu<TCommand extends AnyCommandDef, TMeta = object>({
24
23
  data,
25
24
  commands,
26
25
  meta,
@@ -32,7 +31,7 @@ export function FloatingCommandMenu<TSchema extends z.ZodTypeAny, TMeta>({
32
31
  className,
33
32
  emptyLabel = "Geen acties beschikbaar",
34
33
  ...props
35
- }: FloatingCommandMenuProps<TSchema, TMeta>) {
34
+ }: FloatingCommandMenuProps<TCommand, TMeta>) {
36
35
  return (
37
36
  <div
38
37
  {...props}
@@ -46,8 +45,8 @@ export function FloatingCommandMenu<TSchema extends z.ZodTypeAny, TMeta>({
46
45
  {commands.map((command, index) => (
47
46
  <RenderCommand
48
47
  key={index}
49
- command={command}
50
- data={data}
48
+ command={command as CommandDef<unknown, TMeta>}
49
+ data={data as unknown}
51
50
  meta={meta}
52
51
  fallback={fallback}
53
52
  ui="table"