@vizel/react 0.0.1-alpha.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/index8.js ADDED
@@ -0,0 +1,63 @@
1
+ import { jsxs as V, jsx as l } from "react/jsx-runtime";
2
+ import { getVizelRecentColors as H, addVizelRecentColor as u, VIZEL_TEXT_COLORS as L, VIZEL_HIGHLIGHT_COLORS as O } from "@vizel/core";
3
+ import { useState as h, useRef as E, useEffect as g, useCallback as I } from "react";
4
+ import { VizelColorPicker as T } from "./index11.js";
5
+ import { VizelIcon as C } from "./index14.js";
6
+ function A({
7
+ editor: o,
8
+ type: e,
9
+ colors: f,
10
+ className: m,
11
+ allowCustomColor: d = !0,
12
+ showRecentColors: s = !0
13
+ }) {
14
+ const [r, c] = h(!1), [b, x] = h([]), a = E(null), v = f ?? (e === "textColor" ? L : O), i = e === "textColor" ? o.getAttributes("textStyle").color : o.getAttributes("highlight").color;
15
+ g(() => {
16
+ r && s && x(H(e));
17
+ }, [r, s, e]);
18
+ const p = I(
19
+ (t) => {
20
+ e === "textColor" ? t === "inherit" ? o.chain().focus().unsetColor().run() : (o.chain().focus().setColor(t).run(), u(e, t)) : t === "transparent" ? o.chain().focus().unsetHighlight().run() : (o.chain().focus().toggleHighlight({ color: t }).run(), u(e, t)), c(!1);
21
+ },
22
+ [o, e]
23
+ );
24
+ g(() => {
25
+ const t = (k) => {
26
+ a.current && !a.current.contains(k.target) && c(!1);
27
+ };
28
+ return r && document.addEventListener("mousedown", t), () => {
29
+ document.removeEventListener("mousedown", t);
30
+ };
31
+ }, [r]);
32
+ const n = e === "textColor", z = n ? /* @__PURE__ */ l(C, { name: "textColor" }) : /* @__PURE__ */ l(C, { name: "highlighter" });
33
+ return /* @__PURE__ */ V("div", { ref: a, className: `vizel-color-picker ${m ?? ""}`, "data-type": e, children: [
34
+ /* @__PURE__ */ l(
35
+ "button",
36
+ {
37
+ type: "button",
38
+ className: `vizel-bubble-menu-button vizel-color-picker-trigger ${i ? "has-color" : ""}`,
39
+ onClick: () => c(!r),
40
+ title: n ? "Text Color" : "Highlight",
41
+ "data-action": e,
42
+ style: n ? { color: i || "inherit" } : { "--highlight-color": i || "transparent" },
43
+ children: z
44
+ }
45
+ ),
46
+ r && /* @__PURE__ */ l("div", { className: "vizel-color-picker-dropdown", children: /* @__PURE__ */ l(
47
+ T,
48
+ {
49
+ colors: v,
50
+ value: i,
51
+ onChange: p,
52
+ label: n ? "Text color palette" : "Highlight color palette",
53
+ allowCustomColor: d,
54
+ recentColors: b,
55
+ showRecentColors: s,
56
+ noneValues: n ? ["inherit"] : ["transparent"]
57
+ }
58
+ ) })
59
+ ] });
60
+ }
61
+ export {
62
+ A as VizelBubbleMenuColorPicker
63
+ };
package/dist/index9.js ADDED
@@ -0,0 +1,91 @@
1
+ import { jsx as e, jsxs as u } from "react/jsx-runtime";
2
+ import { useState as a } from "react";
3
+ import { useVizelState as m } from "./index28.js";
4
+ import { VizelBubbleMenuButton as t } from "./index7.js";
5
+ import { VizelBubbleMenuColorPicker as o } from "./index8.js";
6
+ import { VizelIcon as l } from "./index14.js";
7
+ import { VizelLinkEditor as h } from "./index15.js";
8
+ import { VizelNodeSelector as k } from "./index16.js";
9
+ function z({
10
+ editor: i,
11
+ className: r,
12
+ enableEmbed: n
13
+ }) {
14
+ m(() => i);
15
+ const [s, c] = a(!1);
16
+ return s ? /* @__PURE__ */ e(
17
+ h,
18
+ {
19
+ editor: i,
20
+ onClose: () => c(!1),
21
+ ...n ? { enableEmbed: n } : {}
22
+ }
23
+ ) : /* @__PURE__ */ u("div", { className: `vizel-bubble-menu-toolbar ${r ?? ""}`, children: [
24
+ /* @__PURE__ */ e(k, { editor: i }),
25
+ /* @__PURE__ */ e(
26
+ t,
27
+ {
28
+ action: "bold",
29
+ onClick: () => i.chain().focus().toggleBold().run(),
30
+ isActive: i.isActive("bold"),
31
+ title: "Bold (Cmd+B)",
32
+ children: /* @__PURE__ */ e(l, { name: "bold" })
33
+ }
34
+ ),
35
+ /* @__PURE__ */ e(
36
+ t,
37
+ {
38
+ action: "italic",
39
+ onClick: () => i.chain().focus().toggleItalic().run(),
40
+ isActive: i.isActive("italic"),
41
+ title: "Italic (Cmd+I)",
42
+ children: /* @__PURE__ */ e(l, { name: "italic" })
43
+ }
44
+ ),
45
+ /* @__PURE__ */ e(
46
+ t,
47
+ {
48
+ action: "strike",
49
+ onClick: () => i.chain().focus().toggleStrike().run(),
50
+ isActive: i.isActive("strike"),
51
+ title: "Strikethrough",
52
+ children: /* @__PURE__ */ e(l, { name: "strikethrough" })
53
+ }
54
+ ),
55
+ /* @__PURE__ */ e(
56
+ t,
57
+ {
58
+ action: "underline",
59
+ onClick: () => i.chain().focus().toggleUnderline().run(),
60
+ isActive: i.isActive("underline"),
61
+ title: "Underline (Cmd+U)",
62
+ children: /* @__PURE__ */ e(l, { name: "underline" })
63
+ }
64
+ ),
65
+ /* @__PURE__ */ e(
66
+ t,
67
+ {
68
+ action: "code",
69
+ onClick: () => i.chain().focus().toggleCode().run(),
70
+ isActive: i.isActive("code"),
71
+ title: "Code (Cmd+E)",
72
+ children: /* @__PURE__ */ e(l, { name: "code" })
73
+ }
74
+ ),
75
+ /* @__PURE__ */ e(
76
+ t,
77
+ {
78
+ action: "link",
79
+ onClick: () => c(!0),
80
+ isActive: i.isActive("link"),
81
+ title: "Link (Cmd+K)",
82
+ children: /* @__PURE__ */ e(l, { name: "link" })
83
+ }
84
+ ),
85
+ /* @__PURE__ */ e(o, { editor: i, type: "textColor" }),
86
+ /* @__PURE__ */ e(o, { editor: i, type: "highlight" })
87
+ ] });
88
+ }
89
+ export {
90
+ z as VizelBubbleMenuDefault
91
+ };
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@vizel/react",
3
+ "version": "0.0.1-alpha.1",
4
+ "description": "React components for Vizel block-based Markdown editor",
5
+ "keywords": [
6
+ "react",
7
+ "tiptap",
8
+ "editor",
9
+ "markdown",
10
+ "wysiwyg",
11
+ "rich-text",
12
+ "block-editor"
13
+ ],
14
+ "license": "MIT",
15
+ "author": "Seiji Kohara",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/seijikohara/vizel.git",
19
+ "directory": "packages/react"
20
+ },
21
+ "homepage": "https://github.com/seijikohara/vizel",
22
+ "bugs": "https://github.com/seijikohara/vizel/issues",
23
+ "type": "module",
24
+ "sideEffects": false,
25
+ "engines": {
26
+ "node": ">=18"
27
+ },
28
+ "main": "./dist/index.js",
29
+ "module": "./dist/index.js",
30
+ "types": "./dist/index.d.ts",
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/index.d.ts",
34
+ "import": "./dist/index.js",
35
+ "default": "./dist/index.js"
36
+ },
37
+ "./package.json": "./package.json"
38
+ },
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "files": [
43
+ "dist"
44
+ ],
45
+ "scripts": {
46
+ "build": "vite build",
47
+ "typecheck": "tsc --noEmit"
48
+ },
49
+ "dependencies": {
50
+ "@iconify/react": "^6",
51
+ "@vizel/core": "^0.0.1-alpha.1"
52
+ },
53
+ "peerDependencies": {
54
+ "react": "^19",
55
+ "react-dom": "^19"
56
+ },
57
+ "devDependencies": {
58
+ "@types/react": "^19",
59
+ "@types/react-dom": "^19",
60
+ "@vitejs/plugin-react": "^5",
61
+ "vite": "^7",
62
+ "vite-plugin-dts": "^4"
63
+ }
64
+ }