@tanstack/cta-ui-base 0.35.0 → 0.36.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/components/sidebar-items/add-ons.js +5 -5
- package/dist/store/add-ons.js +2 -2
- package/dist/store/project.d.ts +1 -1
- package/dist/store/project.js +1 -1
- package/package.json +2 -2
- package/src/components/sidebar-items/add-ons.tsx +7 -5
- package/src/store/add-ons.ts +2 -2
- package/src/store/project.ts +2 -2
- package/src/types.d.ts +2 -2
|
@@ -4,21 +4,21 @@ import { InfoIcon, SettingsIcon } from 'lucide-react';
|
|
|
4
4
|
import { Switch } from '../ui/switch';
|
|
5
5
|
import { Label } from '../ui/label';
|
|
6
6
|
import { Button } from '../ui/button';
|
|
7
|
-
import { useAddOns, useProjectOptions,
|
|
7
|
+
import { useAddOns, useProjectOptions, useShowDeploymentOptions, } from '../../store/project';
|
|
8
8
|
import ImportCustomAddOn from '../custom-add-on-dialog';
|
|
9
9
|
import AddOnInfoDialog from '../add-on-info-dialog';
|
|
10
10
|
import AddOnConfigDialog from '../add-on-config-dialog';
|
|
11
11
|
const addOnTypeLabels = {
|
|
12
12
|
toolchain: 'Toolchain',
|
|
13
13
|
'add-on': 'Add-on',
|
|
14
|
-
|
|
14
|
+
deployment: 'Deployment Adapter',
|
|
15
15
|
example: 'Example',
|
|
16
16
|
};
|
|
17
17
|
export default function SelectedAddOns() {
|
|
18
|
-
const
|
|
18
|
+
const showDeploymentOptions = useShowDeploymentOptions();
|
|
19
19
|
const { availableAddOns, addOnState, toggleAddOn, setAddOnOption } = useAddOns();
|
|
20
20
|
const addOnOptions = useProjectOptions((state) => state.addOnOptions);
|
|
21
|
-
console.log('
|
|
21
|
+
console.log('showDeploymentOptions', showDeploymentOptions);
|
|
22
22
|
const sortedAddOns = useMemo(() => {
|
|
23
23
|
return availableAddOns.sort((a, b) => {
|
|
24
24
|
const aPriority = a.priority ?? 0;
|
|
@@ -36,7 +36,7 @@ export default function SelectedAddOns() {
|
|
|
36
36
|
setAddOnOption(configAddOn.id, optionName, value);
|
|
37
37
|
}
|
|
38
38
|
}, onClose: () => setConfigAddOn(undefined), disabled: configAddOn ? !addOnState[configAddOn.id]?.enabled : false }), _jsx("div", { className: "max-h-[60vh] overflow-y-auto space-y-2", children: Object.keys(addOnTypeLabels)
|
|
39
|
-
.filter((type) =>
|
|
39
|
+
.filter((type) => showDeploymentOptions ? true : type !== 'deployment')
|
|
40
40
|
.map((type) => (_jsx(Fragment, { children: sortedAddOns.filter((addOn) => addOn.type === type).length >
|
|
41
41
|
0 && (_jsxs("div", { className: "block p-4 bg-gray-500/10 hover:bg-gray-500/20 rounded-lg transition-colors space-y-4 active", children: [_jsx("h3", { className: "font-medium", children: addOnTypeLabels[type] }), _jsx("div", { className: "space-y-3", children: _jsx("div", { className: "flex flex-row flex-wrap", children: sortedAddOns
|
|
42
42
|
.filter((addOn) => addOn.type === type)
|
package/dist/store/add-ons.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export function getAddOnStatus(availableAddOns, chosenAddOns, originalAddOns) {
|
|
2
2
|
const addOnMap = new Map();
|
|
3
3
|
const getAddOnType = (addOn) => availableAddOns.find((a) => a.id === addOn).type;
|
|
4
|
-
const isMultiSelect = (addOn) => getAddOnType(addOn) === '
|
|
4
|
+
const isMultiSelect = (addOn) => getAddOnType(addOn) === 'deployment';
|
|
5
5
|
const areAddonsOfThisTypeCurrentlyChosen = (addOn) => chosenAddOns.some((a) => getAddOnType(a) === getAddOnType(addOn));
|
|
6
6
|
for (const addOn of availableAddOns) {
|
|
7
7
|
addOnMap.set(addOn.id, {
|
|
8
8
|
selected: false,
|
|
9
9
|
enabled: true,
|
|
10
10
|
dependedUpon: false,
|
|
11
|
-
isSingleSelect: addOn.type === '
|
|
11
|
+
isSingleSelect: addOn.type === 'deployment' ? addOn.type : undefined,
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
14
|
// Guard against cycles in the dependency graph. The results won't be great. But it won't crash.
|
package/dist/store/project.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare const useOriginalOutput: () => any;
|
|
|
13
13
|
export declare const useOriginalOptions: () => any;
|
|
14
14
|
export declare const useOriginalSelectedAddOns: () => any;
|
|
15
15
|
export declare const useApplicationMode: () => import("../types").ApplicationMode | undefined;
|
|
16
|
-
export declare const
|
|
16
|
+
export declare const useShowDeploymentOptions: () => boolean | undefined;
|
|
17
17
|
export declare const useAddOnsByMode: () => Record<string, AddOnInfo[]> | undefined;
|
|
18
18
|
export declare const useSupportedModes: () => Record<string, {
|
|
19
19
|
displayName: string;
|
package/dist/store/project.js
CHANGED
|
@@ -33,7 +33,7 @@ export const useOriginalOutput = () => useInitialData().data?.output;
|
|
|
33
33
|
export const useOriginalOptions = () => useInitialData().data?.options;
|
|
34
34
|
export const useOriginalSelectedAddOns = () => useOriginalOptions()?.chosenAddOns;
|
|
35
35
|
export const useApplicationMode = () => useInitialData().data?.applicationMode;
|
|
36
|
-
export const
|
|
36
|
+
export const useShowDeploymentOptions = () => useInitialData().data?.showDeploymentOptions;
|
|
37
37
|
export const useAddOnsByMode = () => useInitialData().data?.addOns;
|
|
38
38
|
export const useSupportedModes = () => useInitialData().data?.supportedModes;
|
|
39
39
|
const useApplicationSettings = create(() => ({
|
package/package.json
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"sonner": "^2.0.3",
|
|
38
38
|
"tailwind-merge": "^3.0.2",
|
|
39
39
|
"zustand": "^5.0.3",
|
|
40
|
-
"@tanstack/cta-engine": "0.
|
|
40
|
+
"@tanstack/cta-engine": "0.36.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/react": "^19.0.8",
|
|
@@ -46,6 +46,6 @@
|
|
|
46
46
|
"vite-tsconfig-paths": "^5.1.4",
|
|
47
47
|
"vitest": "^3.1.4"
|
|
48
48
|
},
|
|
49
|
-
"version": "0.
|
|
49
|
+
"version": "0.36.0",
|
|
50
50
|
"scripts": {}
|
|
51
51
|
}
|
|
@@ -8,7 +8,7 @@ import { Button } from '../ui/button'
|
|
|
8
8
|
import {
|
|
9
9
|
useAddOns,
|
|
10
10
|
useProjectOptions,
|
|
11
|
-
|
|
11
|
+
useShowDeploymentOptions,
|
|
12
12
|
} from '../../store/project'
|
|
13
13
|
|
|
14
14
|
import ImportCustomAddOn from '../custom-add-on-dialog'
|
|
@@ -20,17 +20,17 @@ import type { AddOnInfo } from '../../types'
|
|
|
20
20
|
const addOnTypeLabels: Record<string, string> = {
|
|
21
21
|
toolchain: 'Toolchain',
|
|
22
22
|
'add-on': 'Add-on',
|
|
23
|
-
|
|
23
|
+
deployment: 'Deployment Adapter',
|
|
24
24
|
example: 'Example',
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export default function SelectedAddOns() {
|
|
28
|
-
const
|
|
28
|
+
const showDeploymentOptions = useShowDeploymentOptions()
|
|
29
29
|
const { availableAddOns, addOnState, toggleAddOn, setAddOnOption } =
|
|
30
30
|
useAddOns()
|
|
31
31
|
const addOnOptions = useProjectOptions((state) => state.addOnOptions)
|
|
32
32
|
|
|
33
|
-
console.log('
|
|
33
|
+
console.log('showDeploymentOptions', showDeploymentOptions)
|
|
34
34
|
|
|
35
35
|
const sortedAddOns = useMemo(() => {
|
|
36
36
|
return availableAddOns.sort((a, b) => {
|
|
@@ -65,7 +65,9 @@ export default function SelectedAddOns() {
|
|
|
65
65
|
/>
|
|
66
66
|
<div className="max-h-[60vh] overflow-y-auto space-y-2">
|
|
67
67
|
{Object.keys(addOnTypeLabels)
|
|
68
|
-
.filter((type) =>
|
|
68
|
+
.filter((type) =>
|
|
69
|
+
showDeploymentOptions ? true : type !== 'deployment',
|
|
70
|
+
)
|
|
69
71
|
.map((type) => (
|
|
70
72
|
<Fragment key={type}>
|
|
71
73
|
{sortedAddOns.filter((addOn) => addOn.type === type).length >
|
package/src/store/add-ons.ts
CHANGED
|
@@ -18,7 +18,7 @@ export function getAddOnStatus(
|
|
|
18
18
|
const getAddOnType = (addOn: string) =>
|
|
19
19
|
availableAddOns.find((a) => a.id === addOn)!.type
|
|
20
20
|
|
|
21
|
-
const isMultiSelect = (addOn: string) => getAddOnType(addOn) === '
|
|
21
|
+
const isMultiSelect = (addOn: string) => getAddOnType(addOn) === 'deployment'
|
|
22
22
|
|
|
23
23
|
const areAddonsOfThisTypeCurrentlyChosen = (addOn: string) =>
|
|
24
24
|
chosenAddOns.some((a) => getAddOnType(a) === getAddOnType(addOn))
|
|
@@ -28,7 +28,7 @@ export function getAddOnStatus(
|
|
|
28
28
|
selected: false,
|
|
29
29
|
enabled: true,
|
|
30
30
|
dependedUpon: false,
|
|
31
|
-
isSingleSelect: addOn.type === '
|
|
31
|
+
isSingleSelect: addOn.type === 'deployment' ? addOn.type : undefined,
|
|
32
32
|
})
|
|
33
33
|
}
|
|
34
34
|
|
package/src/store/project.ts
CHANGED
|
@@ -48,8 +48,8 @@ export const useOriginalOptions = () => useInitialData().data?.options
|
|
|
48
48
|
export const useOriginalSelectedAddOns = () =>
|
|
49
49
|
useOriginalOptions()?.chosenAddOns
|
|
50
50
|
export const useApplicationMode = () => useInitialData().data?.applicationMode
|
|
51
|
-
export const
|
|
52
|
-
useInitialData().data?.
|
|
51
|
+
export const useShowDeploymentOptions = () =>
|
|
52
|
+
useInitialData().data?.showDeploymentOptions
|
|
53
53
|
export const useAddOnsByMode = () => useInitialData().data?.addOns
|
|
54
54
|
export const useSupportedModes = () => useInitialData().data?.supportedModes
|
|
55
55
|
|
package/src/types.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export type AddOnInfo = {
|
|
|
36
36
|
id: string
|
|
37
37
|
name: string
|
|
38
38
|
description: string
|
|
39
|
-
type: 'add-on' | 'example' | 'starter' | 'toolchain' | '
|
|
39
|
+
type: 'add-on' | 'example' | 'starter' | 'toolchain' | 'deployment'
|
|
40
40
|
modes: Array<string>
|
|
41
41
|
smallLogo?: string
|
|
42
42
|
priority?: number
|
|
@@ -89,7 +89,7 @@ export type InitialData = {
|
|
|
89
89
|
localFiles: Record<string, string>
|
|
90
90
|
addOns: Record<string, Array<AddOnInfo>>
|
|
91
91
|
applicationMode: ApplicationMode
|
|
92
|
-
|
|
92
|
+
showDeploymentOptions?: boolean
|
|
93
93
|
forcedRouterMode?: string
|
|
94
94
|
forcedAddOns?: Array<string>
|
|
95
95
|
registry?: Registry | undefined
|