@abduljebar/text-editor 1.0.0 → 1.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.
- package/dist/App.d.ts +3 -0
- package/dist/App.d.ts.map +1 -0
- package/dist/components/StatusBar.d.ts +9 -0
- package/dist/components/StatusBar.d.ts.map +1 -0
- package/dist/components/TextEditor.d.ts +4 -0
- package/dist/components/TextEditor.d.ts.map +1 -0
- package/dist/components/Toolbar.d.ts +11 -0
- package/dist/components/Toolbar.d.ts.map +1 -0
- package/dist/hooks/useTextEditor.d.ts +25 -0
- package/dist/hooks/useTextEditor.d.ts.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/schemas/editor.schema.d.ts +26 -0
- package/dist/schemas/editor.schema.d.ts.map +1 -0
- package/dist/types/editor.d.ts +21 -0
- package/dist/types/editor.d.ts.map +1 -0
- package/package.json +7 -4
package/dist/App.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":"AAGA,iBAAS,GAAG,4CAqCX;AAED,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusBar.d.ts","sourceRoot":"","sources":["../../src/components/StatusBar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,UAAU,cAAc;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAsB9C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextEditor.d.ts","sourceRoot":"","sources":["../../src/components/TextEditor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGvD,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA6FhD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ToolbarProps {
|
|
3
|
+
onCommand: (command: string, value?: string) => void;
|
|
4
|
+
onSave: () => void;
|
|
5
|
+
onExport: () => void;
|
|
6
|
+
onClear: () => void;
|
|
7
|
+
hasUnsavedChanges: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const Toolbar: React.FC<ToolbarProps>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=Toolbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../src/components/Toolbar.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAoBnD,UAAU,YAAY;IACpB,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAoH1C,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type EditorContent } from '../schemas/editor.schema';
|
|
2
|
+
export declare const useTextEditor: (initialContent?: string) => {
|
|
3
|
+
editorState: {
|
|
4
|
+
content: string;
|
|
5
|
+
title: string;
|
|
6
|
+
wordCount: number;
|
|
7
|
+
characterCount: number;
|
|
8
|
+
hasUnsavedChanges: boolean;
|
|
9
|
+
};
|
|
10
|
+
editorRef: import("react").RefObject<HTMLDivElement | null>;
|
|
11
|
+
updateContent: (content: string) => void;
|
|
12
|
+
updateTitle: (title: string) => void;
|
|
13
|
+
executeCommand: (command: string, value?: string) => void;
|
|
14
|
+
getValidationResult: () => {
|
|
15
|
+
success: boolean;
|
|
16
|
+
data?: EditorContent;
|
|
17
|
+
error?: string;
|
|
18
|
+
};
|
|
19
|
+
exportToHTML: (options?: {
|
|
20
|
+
includeStyles: boolean;
|
|
21
|
+
includeMeta: boolean;
|
|
22
|
+
}) => string;
|
|
23
|
+
clearEditor: () => void;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=useTextEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTextEditor.d.ts","sourceRoot":"","sources":["../../src/hooks/useTextEditor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGnF,eAAO,MAAM,aAAa,GAAI,iBAAgB,MAAW;;;;;;;;;6BAwBX,MAAM;yBAaV,MAAM;8BAQD,MAAM,UAAU,MAAM;+BAKvB;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,aAAa,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;;CAoGvG,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,YAAY,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const EditorContentSchema: z.ZodObject<{
|
|
3
|
+
title: z.ZodString;
|
|
4
|
+
content: z.ZodString;
|
|
5
|
+
format: z.ZodDefault<z.ZodEnum<{
|
|
6
|
+
html: "html";
|
|
7
|
+
markdown: "markdown";
|
|
8
|
+
}>>;
|
|
9
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
10
|
+
createdAt: z.ZodString;
|
|
11
|
+
updatedAt: z.ZodString;
|
|
12
|
+
wordCount: z.ZodNumber;
|
|
13
|
+
characterCount: z.ZodNumber;
|
|
14
|
+
}, z.core.$strip>>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export declare const ExportOptionsSchema: z.ZodObject<{
|
|
17
|
+
includeStyles: z.ZodDefault<z.ZodBoolean>;
|
|
18
|
+
includeMeta: z.ZodDefault<z.ZodBoolean>;
|
|
19
|
+
format: z.ZodDefault<z.ZodEnum<{
|
|
20
|
+
html: "html";
|
|
21
|
+
txt: "txt";
|
|
22
|
+
}>>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export type EditorContent = z.infer<typeof EditorContentSchema>;
|
|
25
|
+
export type ExportOptions = z.infer<typeof ExportOptionsSchema>;
|
|
26
|
+
//# sourceMappingURL=editor.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/editor.schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;iBAU9B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;iBAI9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface TextEditorProps {
|
|
2
|
+
initialContent?: string;
|
|
3
|
+
onSave?: (content: string, html: string) => void;
|
|
4
|
+
onExport?: (html: string) => void;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ToolbarButton {
|
|
8
|
+
command: string;
|
|
9
|
+
value?: string;
|
|
10
|
+
icon: string;
|
|
11
|
+
title: string;
|
|
12
|
+
isActive?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface EditorState {
|
|
15
|
+
content: string;
|
|
16
|
+
title: string;
|
|
17
|
+
wordCount: number;
|
|
18
|
+
characterCount: number;
|
|
19
|
+
hasUnsavedChanges: boolean;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../src/types/editor.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,eAAe;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,OAAO,CAAC;CAC5B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abduljebar/text-editor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "A professional React text editor with export, save, and validation features",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -13,16 +13,19 @@
|
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|
|
15
15
|
"import": "./dist/index.js",
|
|
16
|
-
"types": "./dist/index.d.ts"
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"require": "./dist/index.js"
|
|
17
18
|
}
|
|
18
19
|
},
|
|
19
20
|
"scripts": {
|
|
20
21
|
"dev": "vite",
|
|
21
|
-
"build": "
|
|
22
|
+
"build": "vite build",
|
|
22
23
|
"build:lib": "vite build --config vite.lib.config.ts",
|
|
24
|
+
"build:types": "tsc -p tsconfig.build.json",
|
|
23
25
|
"lint": "eslint .",
|
|
24
26
|
"preview": "vite preview",
|
|
25
|
-
"prepublishOnly": "npm run build:lib"
|
|
27
|
+
"prepublishOnly": "npm run build:lib && npm run build:types",
|
|
28
|
+
"type-check": "tsc --noEmit"
|
|
26
29
|
},
|
|
27
30
|
"keywords": [
|
|
28
31
|
"react",
|