draftify-react 0.1.5 → 0.1.8

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/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import type { JSX } from "react";
2
2
 
3
+ import * as React from "react";
4
+
3
5
  import type { DraftifyBlock } from "draftify";
4
6
 
5
7
  /* ─────────────────────────────
@@ -172,21 +174,132 @@ export function useDraftifyReact(
172
174
  ): UseDraftifyReactReturn;
173
175
 
174
176
  /* ─────────────────────────────
175
- Component export
177
+ Components
176
178
  ───────────────────────────── */
177
- interface DraftifyReactProps {
179
+
180
+ export interface DraftifyReactProps {
178
181
  blocksData: DraftifyBlock[];
179
182
  modifyBlocks: React.Dispatch<React.SetStateAction<DraftifyBlock[]>>;
180
183
  }
181
184
 
182
185
  declare function DraftifyReact(props: DraftifyReactProps): JSX.Element;
183
186
 
184
- interface ReaderProps {
187
+ export interface ReaderProps {
188
+ blocksData: DraftifyBlock[];
189
+ }
190
+
191
+ declare function DraftifyBlocksReader(props: ReaderProps): JSX.Element;
192
+
193
+ /* ─────────────────────────────
194
+ Hooks
195
+ ───────────────────────────── */
196
+
197
+ export interface UseDraftifyReactProps {
185
198
  blocksData: DraftifyBlock[];
199
+ modifyBlocks: React.Dispatch<React.SetStateAction<DraftifyBlock[]>>;
186
200
  }
187
201
 
188
- declare function Reader(props: ReaderProps): JSX.Element;
202
+ export declare function useDraftifyReact(props: UseDraftifyReactProps): {
203
+ /* view */
204
+ view: string;
205
+ setView: React.Dispatch<React.SetStateAction<string>>;
206
+
207
+ /* background grid */
208
+ gridDots: any[];
209
+ setGridDots: React.Dispatch<React.SetStateAction<any[]>>;
210
+
211
+ /* document metadata */
212
+ docTitle: string;
213
+ setDocTitle: React.Dispatch<React.SetStateAction<string>>;
214
+ description: string;
215
+ setDescription: React.Dispatch<React.SetStateAction<string>>;
216
+ author: string;
217
+ setAuthor: React.Dispatch<React.SetStateAction<string>>;
218
+
219
+ /* prompt */
220
+ promptAction: string;
221
+ setPromptAction: React.Dispatch<React.SetStateAction<string>>;
222
+ promptVisibility: boolean;
223
+ setPromptVisiblility: React.Dispatch<React.SetStateAction<boolean>>;
224
+ handlePromptAction: (action: string, option?: string) => void;
225
+
226
+ /* blocks */
227
+ blocksData: DraftifyBlock[];
228
+ handleClick: (type: string, cells?: number) => void;
229
+
230
+ /* block modifiers */
231
+ modifyHeading: (args: any) => void;
232
+ modifySubheading: (args: any) => void;
233
+ modifyParagraph: (args: any) => void;
234
+ modifyQuote: (args: any) => void;
235
+ modifyList: (args: any) => void;
236
+ modifyTable: (args: any) => void;
237
+ modifyImage: (args: any) => void;
238
+ modifyVideo: (args: any) => void;
239
+ modifyLink: (args: any) => void;
240
+ modifyCode: (args: any) => void;
241
+
242
+ /* delete */
243
+ handleDelete: (id: string) => void;
244
+
245
+ /* drag & drop */
246
+ onDropHandler: (e: React.DragEvent, index: number) => void;
247
+ onDragStart: (e: React.DragEvent, index: number) => void;
248
+ onDragEnd: (e: React.DragEvent) => void;
249
+ onDragEnter: (e: React.DragEvent) => void;
250
+ onDragLeave: (e: React.DragEvent) => void;
251
+
252
+ /* animations */
253
+ containerVariants: Record<string, any>;
254
+ itemVariants: Record<string, any>;
255
+ transitions: Record<string, any>;
256
+ whileHover: Record<string, any>;
257
+
258
+ /* utils */
259
+ handleCopy: (content: any) => void;
260
+ };
261
+
262
+ /* ─────────────────────────────
263
+ Media utilities
264
+ ───────────────────────────── */
265
+
266
+ declare function dropHandler(
267
+ e: React.DragEvent,
268
+ setFile: React.Dispatch<React.SetStateAction<string | null>>,
269
+ setFileName: React.Dispatch<React.SetStateAction<string>>,
270
+ setCompressing: React.Dispatch<React.SetStateAction<boolean>>,
271
+ setCompressionProgress: React.Dispatch<React.SetStateAction<number>>
272
+ ): Promise<void>;
273
+
274
+ declare function onFileChange(
275
+ e: React.ChangeEvent<HTMLInputElement>,
276
+ setFile: React.Dispatch<React.SetStateAction<string | null>>,
277
+ setFileName: React.Dispatch<React.SetStateAction<string>>,
278
+ setCompressing: React.Dispatch<React.SetStateAction<boolean>>,
279
+ setCompressionProgress: React.Dispatch<React.SetStateAction<number>>
280
+ ): Promise<void>;
281
+
282
+ declare function dragHandler(
283
+ e: React.DragEvent,
284
+ output: React.RefObject<HTMLElement>
285
+ ): void;
286
+
287
+ declare function dragLeaveHandler(
288
+ e: React.DragEvent,
289
+ output: React.RefObject<HTMLElement>
290
+ ): void;
291
+
292
+ /* ─────────────────────────────
293
+ Exports
294
+ ───────────────────────────── */
189
295
 
190
296
  export default DraftifyReact;
191
297
 
192
- export { DraftifyReact, Reader };
298
+ export {
299
+ DraftifyReact,
300
+ DraftifyBlocksReader,
301
+ dropHandler,
302
+ onFileChange,
303
+ dragHandler,
304
+ dragLeaveHandler,
305
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "draftify-react",
3
- "version": "0.1.5",
3
+ "version": "0.1.8",
4
4
  "type": "module",
5
5
  "main": "dist/draftify-react.umd.js",
6
6
  "module": "dist/draftify-react.es.js",
@@ -45,5 +45,9 @@
45
45
  "framer-motion": "^12.23.24",
46
46
  "react": ">=18",
47
47
  "react-dom": ">=18"
48
+ },
49
+ "repository": "https://github.com/Bernard-Kuria/draftify-react.git",
50
+ "publishConfig": {
51
+ "registry": "https://registry.npmjs.org/"
48
52
  }
49
53
  }