@codecanon/next-presets 0.0.4 → 0.0.5
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/index.d.ts +21 -13
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,23 +4,18 @@ import { PropsWithChildren, ReactNode } from "react";
|
|
|
4
4
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
5
|
import { Dialog } from "radix-ui";
|
|
6
6
|
|
|
7
|
-
//#region src/presets/index.d.ts
|
|
8
|
-
declare const PRESETS: [["nuteral", "Nuteral"], ["nuteral-accent", "Nuteral (Accent)"], ["new", "Anew"], ["red", "Red"], ["rose", "Rose"], ["orange", "Orange"], ["green", "Green"], ["blue", "Blue"], ["yellow", "Yellow"], ["violet", "Violet"], ["modern-minimal", "Modern Minimal"], ["violet-bloom", "Violet Bloom"], ["t3-chat", "T3 Chat"], ["twitter", "Twitter"], ["mocha-mousse", "Mocha Mousse"], ["bubblegum", "Bubblegum"], ["amethyst-haze", "Amethyst Haze"], ["notebook", "Notebook"], ["doom-64", "Doom 64"], ["catppuccin", "Catppuccin"], ["graphite", "Graphite"], ["perpetuity", "Perpetuity"], ["kodama-grove", "Kodama Grove"], ["cosmic-night", "Cosmic Night"], ["tangerine", "Tangerine"], ["quantum-rose", "Quantum Rose"], ["nature", "Nature"], ["bold-tech", "Bold Tech"], ["elegant-luxury", "Elegant Luxury"], ["amber-minimal", "Amber Minimal"], ["supabase", "Supabase"], ["neo-brutalism", "Neo Brutalism"], ["solar-dusk", "Solar Dusk"], ["claymorphism", "Claymorphism"], ["cyberpunk", "Cyberpunk"], ["pastel-dreams", "Pastel Dreams"], ["clean-slate", "Clean Slate"], ["caffeine", "Caffeine"], ["ocean-breeze", "Ocean Breeze"], ["retro-arcade", "Retro Arcade"], ["midnight-bloom", "Midnight Bloom"], ["candyland", "Candyland"], ["northern-lights", "Northern Lights"], ["vintage-paper", "Vintage Paper"], ["sunset-horizon", "Sunset Horizon"], ["starry-night", "Starry Night"], ["claude", "Claude"], ["vercel", "Vercel"], ["darkmatter", "Darkmatter"], ["mono", "Mono"], ["soft-pop", "Soft Pop"], ["sage-garden", "Sage Garden"]];
|
|
9
|
-
type PresetKeys = (typeof PRESETS)[number][0];
|
|
10
|
-
declare const DEFAULT_PRESET: PresetKeys;
|
|
11
|
-
//#endregion
|
|
12
7
|
//#region src/providers.d.ts
|
|
13
8
|
type ColorScheme = "dark" | "light";
|
|
14
9
|
type Theme = ColorScheme | "system";
|
|
15
10
|
type PresetProviderProps = {
|
|
16
|
-
children: ReactNode;
|
|
17
|
-
defaultPreset?:
|
|
11
|
+
children: ReactNode; /** Initial preset when no stored value exists. Accepts built-in `PresetKeys` or any custom preset ID. */
|
|
12
|
+
defaultPreset?: string;
|
|
18
13
|
presetKey?: string;
|
|
19
14
|
};
|
|
20
15
|
type PresetState = {
|
|
21
|
-
preset?:
|
|
22
|
-
resetPreset: () => void;
|
|
23
|
-
setPreset: (preset:
|
|
16
|
+
/** The currently active preset ID. */preset?: string;
|
|
17
|
+
resetPreset: () => void; /** Switch to any preset by ID — built-in or custom. */
|
|
18
|
+
setPreset: (preset: string) => void;
|
|
24
19
|
};
|
|
25
20
|
declare function PresetProvider({
|
|
26
21
|
children,
|
|
@@ -48,6 +43,13 @@ declare function useTheme(): {
|
|
|
48
43
|
systemTheme?: ColorScheme | undefined;
|
|
49
44
|
};
|
|
50
45
|
//#endregion
|
|
46
|
+
//#region src/presets/index.d.ts
|
|
47
|
+
declare const PRESETS: [["nuteral", "Nuteral"], ["nuteral-accent", "Nuteral (Accent)"], ["new", "Anew"], ["red", "Red"], ["rose", "Rose"], ["orange", "Orange"], ["green", "Green"], ["blue", "Blue"], ["yellow", "Yellow"], ["violet", "Violet"], ["modern-minimal", "Modern Minimal"], ["violet-bloom", "Violet Bloom"], ["t3-chat", "T3 Chat"], ["twitter", "Twitter"], ["mocha-mousse", "Mocha Mousse"], ["bubblegum", "Bubblegum"], ["amethyst-haze", "Amethyst Haze"], ["notebook", "Notebook"], ["doom-64", "Doom 64"], ["catppuccin", "Catppuccin"], ["graphite", "Graphite"], ["perpetuity", "Perpetuity"], ["kodama-grove", "Kodama Grove"], ["cosmic-night", "Cosmic Night"], ["tangerine", "Tangerine"], ["quantum-rose", "Quantum Rose"], ["nature", "Nature"], ["bold-tech", "Bold Tech"], ["elegant-luxury", "Elegant Luxury"], ["amber-minimal", "Amber Minimal"], ["supabase", "Supabase"], ["neo-brutalism", "Neo Brutalism"], ["solar-dusk", "Solar Dusk"], ["claymorphism", "Claymorphism"], ["cyberpunk", "Cyberpunk"], ["pastel-dreams", "Pastel Dreams"], ["clean-slate", "Clean Slate"], ["caffeine", "Caffeine"], ["ocean-breeze", "Ocean Breeze"], ["retro-arcade", "Retro Arcade"], ["midnight-bloom", "Midnight Bloom"], ["candyland", "Candyland"], ["northern-lights", "Northern Lights"], ["vintage-paper", "Vintage Paper"], ["sunset-horizon", "Sunset Horizon"], ["starry-night", "Starry Night"], ["claude", "Claude"], ["vercel", "Vercel"], ["darkmatter", "Darkmatter"], ["mono", "Mono"], ["soft-pop", "Soft Pop"], ["sage-garden", "Sage Garden"]];
|
|
48
|
+
type PresetKeys = (typeof PRESETS)[number][0];
|
|
49
|
+
/** A tuple of [id, label] describing a single preset — built-in or custom. */
|
|
50
|
+
type PresetTuple = readonly [string, string];
|
|
51
|
+
declare const DEFAULT_PRESET: PresetKeys;
|
|
52
|
+
//#endregion
|
|
51
53
|
//#region src/components/ui/sheet.d.ts
|
|
52
54
|
declare function Sheet({
|
|
53
55
|
...props
|
|
@@ -74,8 +76,8 @@ declare function DefaultAppPreviewCard({
|
|
|
74
76
|
...props
|
|
75
77
|
}: {
|
|
76
78
|
showDock?: boolean;
|
|
77
|
-
label?: string;
|
|
78
|
-
presetKey?:
|
|
79
|
+
label?: string; /** Built-in preset ID or any custom preset ID. */
|
|
80
|
+
presetKey?: string;
|
|
79
81
|
active?: boolean;
|
|
80
82
|
highlighted?: boolean;
|
|
81
83
|
ref?: React.Ref<HTMLDivElement>;
|
|
@@ -98,15 +100,21 @@ declare function PresetPickerThemeToggleGroup({
|
|
|
98
100
|
declare function PresetPickerContent({
|
|
99
101
|
showDock,
|
|
100
102
|
previewCard: AppPreviewCard,
|
|
103
|
+
presets,
|
|
101
104
|
className,
|
|
102
105
|
...props
|
|
103
106
|
}: {
|
|
104
107
|
showDock?: boolean;
|
|
105
108
|
previewCard?: typeof DefaultAppPreviewCard;
|
|
109
|
+
/**
|
|
110
|
+
* The list of presets to display. Defaults to the built-in `PRESETS`.
|
|
111
|
+
* Extend with custom presets by spreading: `[...PRESETS, ["my-brand", "My Brand"]]`
|
|
112
|
+
*/
|
|
113
|
+
presets?: readonly PresetTuple[];
|
|
106
114
|
} & React.ComponentProps<"div">): _$react_jsx_runtime0.JSX.Element;
|
|
107
115
|
declare function PresetPickerSheet({
|
|
108
116
|
children,
|
|
109
117
|
...props
|
|
110
118
|
}: React.ComponentProps<typeof Sheet>): _$react_jsx_runtime0.JSX.Element;
|
|
111
119
|
//#endregion
|
|
112
|
-
export { type ColorScheme, DEFAULT_PRESET, DefaultAppPreviewCard, PRESETS, PresetKeys, PresetPicker, PresetPickerContent, PresetPickerSheet, PresetPickerThemeToggleGroup, PresetProvider, type PresetProviderProps, type Theme, ThemeProvider, type ThemeProviderProps, usePreset, usePresetPicker, useTheme };
|
|
120
|
+
export { type ColorScheme, DEFAULT_PRESET, DefaultAppPreviewCard, PRESETS, PresetKeys, PresetPicker, PresetPickerContent, PresetPickerSheet, PresetPickerThemeToggleGroup, PresetProvider, type PresetProviderProps, PresetTuple, type Theme, ThemeProvider, type ThemeProviderProps, usePreset, usePresetPicker, useTheme };
|
package/dist/index.js
CHANGED
|
@@ -824,7 +824,7 @@ function PresetPickerThemeToggleGroup({ className, ...props }) {
|
|
|
824
824
|
]
|
|
825
825
|
});
|
|
826
826
|
}
|
|
827
|
-
function PresetPickerContent({ showDock, previewCard: AppPreviewCard = DefaultAppPreviewCard, className, ...props }) {
|
|
827
|
+
function PresetPickerContent({ showDock, previewCard: AppPreviewCard = DefaultAppPreviewCard, presets = PRESETS, className, ...props }) {
|
|
828
828
|
const { open } = usePresetPicker("PresetPickerContent");
|
|
829
829
|
const { preset, setPreset } = usePreset();
|
|
830
830
|
const [mounted, setMounted] = useBoolean(false);
|
|
@@ -833,7 +833,7 @@ function PresetPickerContent({ showDock, previewCard: AppPreviewCard = DefaultAp
|
|
|
833
833
|
const queryLower = query.trim().toLowerCase();
|
|
834
834
|
const scrollerRef = useRef(null);
|
|
835
835
|
const itemRefs = useRef(/* @__PURE__ */ new Map());
|
|
836
|
-
const filteredPresets = useMemo(() =>
|
|
836
|
+
const filteredPresets = useMemo(() => presets.filter(([, t]) => t?.toLowerCase().includes(queryLower)), [queryLower, presets]);
|
|
837
837
|
useEffect(() => {
|
|
838
838
|
if (queryLower.trim()) setHighlightedIndex(-1);
|
|
839
839
|
else setHighlightedIndex(filteredPresets.findIndex(([id]) => id === preset));
|
|
@@ -862,7 +862,7 @@ function PresetPickerContent({ showDock, previewCard: AppPreviewCard = DefaultAp
|
|
|
862
862
|
} else if (e.key === "Enter") {
|
|
863
863
|
e.preventDefault();
|
|
864
864
|
const id = filteredPresets[highlightedIndex]?.[0];
|
|
865
|
-
setPreset(id);
|
|
865
|
+
if (id) setPreset(id);
|
|
866
866
|
}
|
|
867
867
|
};
|
|
868
868
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Input, {
|
package/package.json
CHANGED