@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
@@ -16,14 +16,19 @@ import { type InlineEditVariantsProps, inlineEditVariants } from "../../lib/vari
16
16
 
17
17
  type EditorInlineTrigger = "change" | "blur";
18
18
 
19
+ type InlineEditorSchema =
20
+ | z.ZodType<EditorJSONContent | null, EditorJSONContent | null>
21
+ | z.ZodType<EditorJSONContent, EditorJSONContent>;
22
+
19
23
  export type InlineEditorProps<
24
+ TSchema extends InlineEditorSchema = z.ZodType<EditorJSONContent | null, EditorJSONContent | null>,
20
25
  TData = unknown,
21
26
  TError = DefaultError,
22
27
  TVariables = unknown,
23
28
  TOnMutateResult = unknown,
24
29
  > = useInlineEditOptions<
25
30
  EditorInlineTrigger,
26
- z.ZodType<EditorJSONContent | null, EditorJSONContent | null>,
31
+ TSchema,
27
32
  TData,
28
33
  TError,
29
34
  TVariables,
@@ -33,6 +38,7 @@ export type InlineEditorProps<
33
38
  Omit<EditorProps, "value" | "onUpdate" | "onBlur" | "variant">;
34
39
 
35
40
  export function InlineEditor<
41
+ TSchema extends InlineEditorSchema = z.ZodType<EditorJSONContent | null, EditorJSONContent | null>,
36
42
  TData = unknown,
37
43
  TError = DefaultError,
38
44
  TVariables = unknown,
@@ -48,11 +54,11 @@ export function InlineEditor<
48
54
  strategy,
49
55
  className,
50
56
  children,
51
- }: InlineEditorProps<TData, TError, TVariables, TOnMutateResult>) {
57
+ }: InlineEditorProps<TSchema, TData, TError, TVariables, TOnMutateResult>) {
52
58
  const state = useInlineState<EditorJSONContent | null>(initialValue);
53
59
  const access = useInlineAccess({ permission, disabled });
54
60
  const mutations = useInlineMutation<
55
- z.ZodType<EditorJSONContent | null, EditorJSONContent | null>,
61
+ TSchema,
56
62
  EditorJSONContent | null,
57
63
  TData,
58
64
  TError,
@@ -67,7 +73,7 @@ export function InlineEditor<
67
73
 
68
74
  const { handleTrigger } = useInlineStrategy<
69
75
  EditorInlineTrigger,
70
- z.ZodType<EditorJSONContent | null, EditorJSONContent | null>,
76
+ TSchema,
71
77
  EditorJSONContent | null
72
78
  >({
73
79
  strategy,
@@ -75,7 +81,7 @@ export function InlineEditor<
75
81
  mutations,
76
82
  parser: {
77
83
  decode: (content) => content,
78
- encode: (content) => content,
84
+ encode: (content) => content as z.input<TSchema>,
79
85
  },
80
86
  });
81
87
 
@@ -16,6 +16,14 @@ import { type InlineEditVariantsProps, inlineEditVariants } from "../../lib/vari
16
16
 
17
17
  type InputInlineTrigger = "change" | "blur";
18
18
 
19
+ type InlineStringSchema =
20
+ | z.ZodType<string | null, string | null>
21
+ | z.ZodType<string, string>;
22
+
23
+ type InlineNumberSchema =
24
+ | z.ZodType<number | null, number | null>
25
+ | z.ZodType<number, number>;
26
+
19
27
  type InlineEditInputProps<
20
28
  TSchema extends z.ZodType,
21
29
  TData = unknown,
@@ -30,7 +38,7 @@ type InlineEditInputProps<
30
38
  * The inline edit string input component.
31
39
  */
32
40
  export function InlineStringInput<
33
- TSchema extends z.ZodType<string | null, string | null>,
41
+ TSchema extends InlineStringSchema = z.ZodType<string | null, string | null>,
34
42
  TData = unknown,
35
43
  TError = DefaultError,
36
44
  TVariables = unknown,
@@ -98,6 +106,7 @@ const parseValueAsNumber = (valueAsNumber: number): number | null =>
98
106
  !Number.isNaN(Number(valueAsNumber)) ? valueAsNumber : null;
99
107
 
100
108
  export function InlineNumberInput<
109
+ TSchema extends InlineNumberSchema = z.ZodType<number | null, number | null>,
101
110
  TData = unknown,
102
111
  TError = DefaultError,
103
112
  TVariables = unknown,
@@ -113,7 +122,7 @@ export function InlineNumberInput<
113
122
  disabled,
114
123
  ...props
115
124
  }: InlineEditInputProps<
116
- z.ZodNumber | z.ZodNullable<z.ZodNumber>,
125
+ TSchema,
117
126
  TData,
118
127
  TError,
119
128
  TVariables,
@@ -122,7 +131,7 @@ export function InlineNumberInput<
122
131
  const state = useInlineState<number | null>(initialValue);
123
132
  const access = useInlineAccess({ permission, disabled });
124
133
  const mutations = useInlineMutation<
125
- z.ZodNumber | z.ZodNullable<z.ZodNumber>,
134
+ TSchema,
126
135
  number | null,
127
136
  TData,
128
137
  TError,
@@ -137,7 +146,7 @@ export function InlineNumberInput<
137
146
 
138
147
  const { handleTrigger } = useInlineStrategy<
139
148
  InputInlineTrigger,
140
- z.ZodNumber | z.ZodNullable<z.ZodNumber>,
149
+ TSchema,
141
150
  number | null
142
151
  >({
143
152
  strategy,
@@ -145,7 +154,7 @@ export function InlineNumberInput<
145
154
  mutations,
146
155
  parser: {
147
156
  decode: (value) => value,
148
- encode: (value) => value,
157
+ encode: (value) => value as z.input<TSchema>,
149
158
  },
150
159
  });
151
160
 
@@ -172,6 +181,9 @@ export function InlineNumberInput<
172
181
  * The inline edit decimal input component.
173
182
  */
174
183
  export function InlineDecimalInput<
184
+ TSchema extends
185
+ | z.ZodType<string | null, string | null>
186
+ | z.ZodType<string, string> = z.ZodType<string | null, string | null>,
175
187
  TData = unknown,
176
188
  TError = DefaultError,
177
189
  TVariables = unknown,
@@ -187,7 +199,7 @@ export function InlineDecimalInput<
187
199
  disabled,
188
200
  ...props
189
201
  }: InlineEditInputProps<
190
- z.ZodString | z.ZodNullable<z.ZodString>,
202
+ TSchema,
191
203
  TData,
192
204
  TError,
193
205
  TVariables,
@@ -196,7 +208,7 @@ export function InlineDecimalInput<
196
208
  const state = useInlineState<string | null>(initialValue);
197
209
  const access = useInlineAccess({ permission, disabled });
198
210
  const mutations = useInlineMutation<
199
- z.ZodString | z.ZodNullable<z.ZodString>,
211
+ TSchema,
200
212
  string | null,
201
213
  TData,
202
214
  TError,
@@ -211,7 +223,7 @@ export function InlineDecimalInput<
211
223
 
212
224
  const { handleTrigger } = useInlineStrategy<
213
225
  InputInlineTrigger,
214
- z.ZodString | z.ZodNullable<z.ZodString>,
226
+ TSchema,
215
227
  string | null
216
228
  >({
217
229
  strategy,
@@ -219,7 +231,7 @@ export function InlineDecimalInput<
219
231
  mutations,
220
232
  parser: {
221
233
  decode: (value) => value,
222
- encode: (value) => value,
234
+ encode: (value) => value as z.input<TSchema>,
223
235
  },
224
236
  });
225
237
 
@@ -23,7 +23,12 @@ import { type InlineEditVariantsProps, inlineEditVariants } from "../../lib/vari
23
23
 
24
24
  type SelectInlineTrigger = "commit";
25
25
 
26
+ type InlineStringSchema =
27
+ | z.ZodType<string | null, string | null>
28
+ | z.ZodType<string, string>;
29
+
26
30
  type InlineSelectProps<
31
+ TSchema extends InlineStringSchema = z.ZodType<string | null, string | null>,
27
32
  TData = unknown,
28
33
  TError = DefaultError,
29
34
  TVariables = unknown,
@@ -31,7 +36,7 @@ type InlineSelectProps<
31
36
  > = Omit<ComponentProps<typeof Select>, "value" | "defaultValue"> &
32
37
  useInlineEditOptions<
33
38
  SelectInlineTrigger,
34
- z.ZodString | z.ZodNullable<z.ZodString>,
39
+ TSchema,
35
40
  TData,
36
41
  TError,
37
42
  TVariables,
@@ -39,6 +44,7 @@ type InlineSelectProps<
39
44
  >;
40
45
 
41
46
  export function InlineSelect<
47
+ TSchema extends InlineStringSchema = z.ZodType<string | null, string | null>,
42
48
  TData = unknown,
43
49
  TError = DefaultError,
44
50
  TVariables = unknown,
@@ -52,11 +58,11 @@ export function InlineSelect<
52
58
  disabled,
53
59
  onValueChange,
54
60
  ...props
55
- }: InlineSelectProps<TData, TError, TVariables, TOnMutateResult>) {
61
+ }: InlineSelectProps<TSchema, TData, TError, TVariables, TOnMutateResult>) {
56
62
  const state = useInlineState<string | null>(initialValue);
57
63
  const access = useInlineAccess({ permission, disabled });
58
64
  const mutations = useInlineMutation<
59
- z.ZodString | z.ZodNullable<z.ZodString>,
65
+ TSchema,
60
66
  string | null,
61
67
  TData,
62
68
  TError,
@@ -71,7 +77,7 @@ export function InlineSelect<
71
77
 
72
78
  const { handleTrigger } = useInlineStrategy<
73
79
  SelectInlineTrigger,
74
- z.ZodString | z.ZodNullable<z.ZodString>,
80
+ TSchema,
75
81
  string | null
76
82
  >({
77
83
  strategy,
@@ -79,7 +85,7 @@ export function InlineSelect<
79
85
  mutations,
80
86
  parser: {
81
87
  decode: (value) => value,
82
- encode: (value) => value,
88
+ encode: (value) => value as z.input<TSchema>,
83
89
  },
84
90
  });
85
91
 
@@ -14,7 +14,12 @@ import {
14
14
 
15
15
  type SwitchInlineTrigger = "commit";
16
16
 
17
+ type InlineBooleanSchema =
18
+ | z.ZodType<boolean | null, boolean | null>
19
+ | z.ZodType<boolean, boolean>;
20
+
17
21
  type InlineSwitchProps<
22
+ TSchema extends InlineBooleanSchema = z.ZodType<boolean | null, boolean | null>,
18
23
  TData = unknown,
19
24
  TError = DefaultError,
20
25
  TVariables = unknown,
@@ -22,7 +27,7 @@ type InlineSwitchProps<
22
27
  > = ComponentProps<typeof Switch> &
23
28
  useInlineEditOptions<
24
29
  SwitchInlineTrigger,
25
- z.ZodBoolean | z.ZodNullable<z.ZodBoolean>,
30
+ TSchema,
26
31
  TData,
27
32
  TError,
28
33
  TVariables,
@@ -30,6 +35,7 @@ type InlineSwitchProps<
30
35
  >;
31
36
 
32
37
  export function InlineSwitch<
38
+ TSchema extends InlineBooleanSchema = z.ZodType<boolean | null, boolean | null>,
33
39
  TData = unknown,
34
40
  TError = DefaultError,
35
41
  TVariables = unknown,
@@ -42,11 +48,11 @@ export function InlineSwitch<
42
48
  strategy,
43
49
  disabled,
44
50
  ...props
45
- }: InlineSwitchProps<TData, TError, TVariables, TOnMutateResult>) {
51
+ }: InlineSwitchProps<TSchema, TData, TError, TVariables, TOnMutateResult>) {
46
52
  const state = useInlineState<boolean | null>(initialValue);
47
53
  const access = useInlineAccess({ permission, disabled });
48
54
  const mutations = useInlineMutation<
49
- z.ZodBoolean | z.ZodNullable<z.ZodBoolean>,
55
+ TSchema,
50
56
  boolean | null,
51
57
  TData,
52
58
  TError,
@@ -61,7 +67,7 @@ export function InlineSwitch<
61
67
 
62
68
  const { handleTrigger } = useInlineStrategy<
63
69
  SwitchInlineTrigger,
64
- z.ZodBoolean | z.ZodNullable<z.ZodBoolean>,
70
+ TSchema,
65
71
  boolean | null
66
72
  >({
67
73
  strategy,
@@ -69,7 +75,7 @@ export function InlineSwitch<
69
75
  mutations,
70
76
  parser: {
71
77
  decode: (value) => value,
72
- encode: (value) => value,
78
+ encode: (value) => value as z.input<TSchema>,
73
79
  },
74
80
  });
75
81
 
@@ -1,4 +1,5 @@
1
1
  /**
2
2
  * Lib
3
3
  */
4
+ export * from "./lib/query-client";
4
5
  export * from "./lib/validators";
@@ -1,4 +1,4 @@
1
- import { isServer, MutationCache, QueryClient } from "@tanstack/react-query";
1
+ import { environmentManager, MutationCache, QueryClient } from "@tanstack/react-query";
2
2
  import { serializer } from "./helpers";
3
3
 
4
4
  /**
@@ -47,7 +47,7 @@ export function createQueryClient() {
47
47
  let browserQueryClient: QueryClient;
48
48
 
49
49
  export function getQueryClient() {
50
- if (isServer) {
50
+ if (environmentManager.isServer()) {
51
51
  // Server: always make a new query client
52
52
  return createQueryClient();
53
53
  }
package/src/styles.css CHANGED
@@ -190,3 +190,94 @@
190
190
  @apply bg-background text-foreground;
191
191
  }
192
192
  }
193
+
194
+ /* ejected from shadcn */
195
+ @theme inline {
196
+ @keyframes accordion-down {
197
+ from {
198
+ height: 0;
199
+ }
200
+ to {
201
+ height: var(--radix-accordion-content-height, var(--accordion-panel-height, auto));
202
+ }
203
+ }
204
+
205
+ @keyframes accordion-up {
206
+ from {
207
+ height: var(--radix-accordion-content-height, var(--accordion-panel-height, auto));
208
+ }
209
+ to {
210
+ height: 0;
211
+ }
212
+ }
213
+ }
214
+
215
+ /* Custom variants */
216
+ @custom-variant data-open {
217
+ &:where([data-state="open"]),
218
+ &:where([data-open]:not([data-open="false"])) {
219
+ @slot;
220
+ }
221
+ }
222
+
223
+ @custom-variant data-closed {
224
+ &:where([data-state="closed"]),
225
+ &:where([data-closed]:not([data-closed="false"])) {
226
+ @slot;
227
+ }
228
+ }
229
+
230
+ @custom-variant data-checked {
231
+ &:where([data-state="checked"]),
232
+ &:where([data-checked]:not([data-checked="false"])) {
233
+ @slot;
234
+ }
235
+ }
236
+
237
+ @custom-variant data-unchecked {
238
+ &:where([data-state="unchecked"]),
239
+ &:where([data-unchecked]:not([data-unchecked="false"])) {
240
+ @slot;
241
+ }
242
+ }
243
+
244
+ @custom-variant data-selected {
245
+ &:where([data-selected="true"]) {
246
+ @slot;
247
+ }
248
+ }
249
+
250
+ @custom-variant data-disabled {
251
+ &:where([data-disabled="true"]),
252
+ &:where([data-disabled]:not([data-disabled="false"])) {
253
+ @slot;
254
+ }
255
+ }
256
+
257
+ @custom-variant data-active {
258
+ &:where([data-state="active"]),
259
+ &:where([data-active]:not([data-active="false"])) {
260
+ @slot;
261
+ }
262
+ }
263
+
264
+ @custom-variant data-horizontal {
265
+ &:where([data-orientation="horizontal"]) {
266
+ @slot;
267
+ }
268
+ }
269
+
270
+ @custom-variant data-vertical {
271
+ &:where([data-orientation="vertical"]) {
272
+ @slot;
273
+ }
274
+ }
275
+
276
+ @utility no-scrollbar {
277
+ -ms-overflow-style: none;
278
+ scrollbar-width: none;
279
+
280
+ &::-webkit-scrollbar {
281
+ display: none;
282
+ }
283
+ }