@anvilkit/puck-studio 0.0.1

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.
@@ -0,0 +1,151 @@
1
+ import { Overrides, Config, Data } from '@puckeditor/core';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import * as React from 'react';
4
+ import * as zustand_middleware from 'zustand/middleware';
5
+ import * as zustand from 'zustand';
6
+
7
+ declare const puckOverrides: Partial<Overrides>;
8
+
9
+ interface ImageItem {
10
+ id: string;
11
+ src: string;
12
+ alt: string;
13
+ }
14
+ interface ImagesProps {
15
+ /** Override the default picsum seed list */
16
+ seeds?: string[];
17
+ /** Provide a fully custom image list (bypasses seeds entirely) */
18
+ items?: ImageItem[];
19
+ }
20
+
21
+ interface CopywritingItem {
22
+ label: string;
23
+ text: string;
24
+ category: string;
25
+ }
26
+ interface CopywritingProps {
27
+ items?: CopywritingItem[];
28
+ }
29
+
30
+ type Locale = string;
31
+ type Messages = Record<string, string>;
32
+ interface I18nState {
33
+ locale: Locale;
34
+ messages: Messages;
35
+ setLocale: (locale: Locale, messages: Messages) => void;
36
+ }
37
+ type EditorI18nStoreApi = ReturnType<typeof createEditorI18nStore>;
38
+ declare function createEditorI18nStore(initial: {
39
+ locale: Locale;
40
+ messages: Messages;
41
+ }): Omit<zustand.StoreApi<I18nState>, "setState" | "persist"> & {
42
+ setState(partial: I18nState | Partial<I18nState> | ((state: I18nState) => I18nState | Partial<I18nState>), replace?: false | undefined): unknown;
43
+ setState(state: I18nState | ((state: I18nState) => I18nState), replace: true): unknown;
44
+ persist: {
45
+ setOptions: (options: Partial<zustand_middleware.PersistOptions<I18nState, {
46
+ locale: string;
47
+ }, unknown>>) => void;
48
+ clearStorage: () => void;
49
+ rehydrate: () => Promise<void> | void;
50
+ hasHydrated: () => boolean;
51
+ onHydrate: (fn: (state: I18nState) => void) => () => void;
52
+ onFinishHydration: (fn: (state: I18nState) => void) => () => void;
53
+ getOptions: () => Partial<zustand_middleware.PersistOptions<I18nState, {
54
+ locale: string;
55
+ }, unknown>>;
56
+ };
57
+ };
58
+
59
+ interface StudioProps {
60
+ config: Config;
61
+ data: Data;
62
+ onPublish: (data: Data) => void;
63
+ onChange?: (data: Data) => void;
64
+ ui?: Record<string, unknown>;
65
+ onAction?: (action: unknown, appState: unknown) => void;
66
+ overrideExtensions?: Partial<Overrides>;
67
+ aiHost?: string;
68
+ headerSlot?: React.ReactNode;
69
+ drawerHeaderSlot?: React.ReactNode;
70
+ className?: string;
71
+ images?: ImagesProps;
72
+ copywritings?: CopywritingProps;
73
+ storeId?: string;
74
+ locale?: Locale;
75
+ messages?: Messages;
76
+ }
77
+ declare function Studio({ config, data, onPublish, onChange, overrideExtensions, aiHost, className, images, copywritings, storeId, locale, messages, }: StudioProps): react_jsx_runtime.JSX.Element;
78
+
79
+ interface DrawerSlice {
80
+ drawerSearch: string;
81
+ setDrawerSearch: (q: string) => void;
82
+ drawerCollapsed: Record<string, boolean>;
83
+ toggleDrawerGroup: (group: string) => void;
84
+ }
85
+ interface AsideSlice {
86
+ activeTab: string;
87
+ setActiveTab: (tab: string) => void;
88
+ }
89
+ interface OutlineSlice {
90
+ outlineExpanded: Record<string, boolean>;
91
+ toggleOutlineItem: (id: string) => void;
92
+ }
93
+ interface ThemeSlice {
94
+ theme: "light" | "dark";
95
+ toggleTheme: () => void;
96
+ }
97
+ type EditorUiStore = DrawerSlice & AsideSlice & OutlineSlice & ThemeSlice;
98
+ type EditorUiStoreApi = ReturnType<typeof createEditorUiStore>;
99
+ declare function createEditorUiStore(storeId: string): Omit<zustand.StoreApi<EditorUiStore>, "setState" | "persist"> & {
100
+ setState(partial: EditorUiStore | Partial<EditorUiStore> | ((state: EditorUiStore) => EditorUiStore | Partial<EditorUiStore>), replace?: false | undefined): unknown;
101
+ setState(state: EditorUiStore | ((state: EditorUiStore) => EditorUiStore), replace: true): unknown;
102
+ persist: {
103
+ setOptions: (options: Partial<zustand_middleware.PersistOptions<EditorUiStore, {
104
+ activeTab: string;
105
+ drawerCollapsed: Record<string, boolean>;
106
+ outlineExpanded: Record<string, boolean>;
107
+ theme: "light" | "dark";
108
+ }, unknown>>) => void;
109
+ clearStorage: () => void;
110
+ rehydrate: () => Promise<void> | void;
111
+ hasHydrated: () => boolean;
112
+ onHydrate: (fn: (state: EditorUiStore) => void) => () => void;
113
+ onFinishHydration: (fn: (state: EditorUiStore) => void) => () => void;
114
+ getOptions: () => Partial<zustand_middleware.PersistOptions<EditorUiStore, {
115
+ activeTab: string;
116
+ drawerCollapsed: Record<string, boolean>;
117
+ outlineExpanded: Record<string, boolean>;
118
+ theme: "light" | "dark";
119
+ }, unknown>>;
120
+ };
121
+ };
122
+
123
+ /**
124
+ * @deprecated Use createEditorUiStore() via EditorUiStoreProvider instead.
125
+ * This singleton will be removed in the next minor version.
126
+ */
127
+ declare const uiStore: Omit<zustand.StoreApi<EditorUiStore>, "setState" | "persist"> & {
128
+ setState(partial: EditorUiStore | Partial<EditorUiStore> | ((state: EditorUiStore) => EditorUiStore | Partial<EditorUiStore>), replace?: false | undefined): unknown;
129
+ setState(state: EditorUiStore | ((state: EditorUiStore) => EditorUiStore), replace: true): unknown;
130
+ persist: {
131
+ setOptions: (options: Partial<zustand_middleware.PersistOptions<EditorUiStore, {
132
+ activeTab: string;
133
+ drawerCollapsed: Record<string, boolean>;
134
+ outlineExpanded: Record<string, boolean>;
135
+ theme: "light" | "dark";
136
+ }, unknown>>) => void;
137
+ clearStorage: () => void;
138
+ rehydrate: () => Promise<void> | void;
139
+ hasHydrated: () => boolean;
140
+ onHydrate: (fn: (state: EditorUiStore) => void) => () => void;
141
+ onFinishHydration: (fn: (state: EditorUiStore) => void) => () => void;
142
+ getOptions: () => Partial<zustand_middleware.PersistOptions<EditorUiStore, {
143
+ activeTab: string;
144
+ drawerCollapsed: Record<string, boolean>;
145
+ outlineExpanded: Record<string, boolean>;
146
+ theme: "light" | "dark";
147
+ }, unknown>>;
148
+ };
149
+ };
150
+
151
+ export { type CopywritingItem, type CopywritingProps, type EditorI18nStoreApi, type EditorUiStore, type EditorUiStoreApi, type ImageItem, type ImagesProps, type Locale, type Messages, Studio, type StudioProps, type EditorUiStore as UIStore, createEditorI18nStore, createEditorUiStore, puckOverrides, uiStore };
@@ -0,0 +1,151 @@
1
+ import { Overrides, Config, Data } from '@puckeditor/core';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import * as React from 'react';
4
+ import * as zustand_middleware from 'zustand/middleware';
5
+ import * as zustand from 'zustand';
6
+
7
+ declare const puckOverrides: Partial<Overrides>;
8
+
9
+ interface ImageItem {
10
+ id: string;
11
+ src: string;
12
+ alt: string;
13
+ }
14
+ interface ImagesProps {
15
+ /** Override the default picsum seed list */
16
+ seeds?: string[];
17
+ /** Provide a fully custom image list (bypasses seeds entirely) */
18
+ items?: ImageItem[];
19
+ }
20
+
21
+ interface CopywritingItem {
22
+ label: string;
23
+ text: string;
24
+ category: string;
25
+ }
26
+ interface CopywritingProps {
27
+ items?: CopywritingItem[];
28
+ }
29
+
30
+ type Locale = string;
31
+ type Messages = Record<string, string>;
32
+ interface I18nState {
33
+ locale: Locale;
34
+ messages: Messages;
35
+ setLocale: (locale: Locale, messages: Messages) => void;
36
+ }
37
+ type EditorI18nStoreApi = ReturnType<typeof createEditorI18nStore>;
38
+ declare function createEditorI18nStore(initial: {
39
+ locale: Locale;
40
+ messages: Messages;
41
+ }): Omit<zustand.StoreApi<I18nState>, "setState" | "persist"> & {
42
+ setState(partial: I18nState | Partial<I18nState> | ((state: I18nState) => I18nState | Partial<I18nState>), replace?: false | undefined): unknown;
43
+ setState(state: I18nState | ((state: I18nState) => I18nState), replace: true): unknown;
44
+ persist: {
45
+ setOptions: (options: Partial<zustand_middleware.PersistOptions<I18nState, {
46
+ locale: string;
47
+ }, unknown>>) => void;
48
+ clearStorage: () => void;
49
+ rehydrate: () => Promise<void> | void;
50
+ hasHydrated: () => boolean;
51
+ onHydrate: (fn: (state: I18nState) => void) => () => void;
52
+ onFinishHydration: (fn: (state: I18nState) => void) => () => void;
53
+ getOptions: () => Partial<zustand_middleware.PersistOptions<I18nState, {
54
+ locale: string;
55
+ }, unknown>>;
56
+ };
57
+ };
58
+
59
+ interface StudioProps {
60
+ config: Config;
61
+ data: Data;
62
+ onPublish: (data: Data) => void;
63
+ onChange?: (data: Data) => void;
64
+ ui?: Record<string, unknown>;
65
+ onAction?: (action: unknown, appState: unknown) => void;
66
+ overrideExtensions?: Partial<Overrides>;
67
+ aiHost?: string;
68
+ headerSlot?: React.ReactNode;
69
+ drawerHeaderSlot?: React.ReactNode;
70
+ className?: string;
71
+ images?: ImagesProps;
72
+ copywritings?: CopywritingProps;
73
+ storeId?: string;
74
+ locale?: Locale;
75
+ messages?: Messages;
76
+ }
77
+ declare function Studio({ config, data, onPublish, onChange, overrideExtensions, aiHost, className, images, copywritings, storeId, locale, messages, }: StudioProps): react_jsx_runtime.JSX.Element;
78
+
79
+ interface DrawerSlice {
80
+ drawerSearch: string;
81
+ setDrawerSearch: (q: string) => void;
82
+ drawerCollapsed: Record<string, boolean>;
83
+ toggleDrawerGroup: (group: string) => void;
84
+ }
85
+ interface AsideSlice {
86
+ activeTab: string;
87
+ setActiveTab: (tab: string) => void;
88
+ }
89
+ interface OutlineSlice {
90
+ outlineExpanded: Record<string, boolean>;
91
+ toggleOutlineItem: (id: string) => void;
92
+ }
93
+ interface ThemeSlice {
94
+ theme: "light" | "dark";
95
+ toggleTheme: () => void;
96
+ }
97
+ type EditorUiStore = DrawerSlice & AsideSlice & OutlineSlice & ThemeSlice;
98
+ type EditorUiStoreApi = ReturnType<typeof createEditorUiStore>;
99
+ declare function createEditorUiStore(storeId: string): Omit<zustand.StoreApi<EditorUiStore>, "setState" | "persist"> & {
100
+ setState(partial: EditorUiStore | Partial<EditorUiStore> | ((state: EditorUiStore) => EditorUiStore | Partial<EditorUiStore>), replace?: false | undefined): unknown;
101
+ setState(state: EditorUiStore | ((state: EditorUiStore) => EditorUiStore), replace: true): unknown;
102
+ persist: {
103
+ setOptions: (options: Partial<zustand_middleware.PersistOptions<EditorUiStore, {
104
+ activeTab: string;
105
+ drawerCollapsed: Record<string, boolean>;
106
+ outlineExpanded: Record<string, boolean>;
107
+ theme: "light" | "dark";
108
+ }, unknown>>) => void;
109
+ clearStorage: () => void;
110
+ rehydrate: () => Promise<void> | void;
111
+ hasHydrated: () => boolean;
112
+ onHydrate: (fn: (state: EditorUiStore) => void) => () => void;
113
+ onFinishHydration: (fn: (state: EditorUiStore) => void) => () => void;
114
+ getOptions: () => Partial<zustand_middleware.PersistOptions<EditorUiStore, {
115
+ activeTab: string;
116
+ drawerCollapsed: Record<string, boolean>;
117
+ outlineExpanded: Record<string, boolean>;
118
+ theme: "light" | "dark";
119
+ }, unknown>>;
120
+ };
121
+ };
122
+
123
+ /**
124
+ * @deprecated Use createEditorUiStore() via EditorUiStoreProvider instead.
125
+ * This singleton will be removed in the next minor version.
126
+ */
127
+ declare const uiStore: Omit<zustand.StoreApi<EditorUiStore>, "setState" | "persist"> & {
128
+ setState(partial: EditorUiStore | Partial<EditorUiStore> | ((state: EditorUiStore) => EditorUiStore | Partial<EditorUiStore>), replace?: false | undefined): unknown;
129
+ setState(state: EditorUiStore | ((state: EditorUiStore) => EditorUiStore), replace: true): unknown;
130
+ persist: {
131
+ setOptions: (options: Partial<zustand_middleware.PersistOptions<EditorUiStore, {
132
+ activeTab: string;
133
+ drawerCollapsed: Record<string, boolean>;
134
+ outlineExpanded: Record<string, boolean>;
135
+ theme: "light" | "dark";
136
+ }, unknown>>) => void;
137
+ clearStorage: () => void;
138
+ rehydrate: () => Promise<void> | void;
139
+ hasHydrated: () => boolean;
140
+ onHydrate: (fn: (state: EditorUiStore) => void) => () => void;
141
+ onFinishHydration: (fn: (state: EditorUiStore) => void) => () => void;
142
+ getOptions: () => Partial<zustand_middleware.PersistOptions<EditorUiStore, {
143
+ activeTab: string;
144
+ drawerCollapsed: Record<string, boolean>;
145
+ outlineExpanded: Record<string, boolean>;
146
+ theme: "light" | "dark";
147
+ }, unknown>>;
148
+ };
149
+ };
150
+
151
+ export { type CopywritingItem, type CopywritingProps, type EditorI18nStoreApi, type EditorUiStore, type EditorUiStoreApi, type ImageItem, type ImagesProps, type Locale, type Messages, Studio, type StudioProps, type EditorUiStore as UIStore, createEditorI18nStore, createEditorUiStore, puckOverrides, uiStore };