@jackuait/blok 0.2.1-beta.0 → 0.3.1-beta.0

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.
@@ -1,4 +1,4 @@
1
- import { t as f, a as i } from "./blok-HV5Vwzfn.mjs";
1
+ import { t as f, a as i } from "./blok-e-cML09O.mjs";
2
2
  const a = {
3
3
  wrapper: i(
4
4
  "fixed z-[2] bottom-5 left-5",
@@ -33,8 +33,7 @@ const a = {
33
33
  errorNotification: i(
34
34
  "!bg-[#fffbfb]",
35
35
  "before:!bg-[#fb5d5d]"
36
- ),
37
- bounceIn: "animate-notify-bounce-in"
36
+ )
38
37
  }, d = (e) => {
39
38
  const t = document.createElement("DIV"), o = document.createElement("DIV"), r = e.message, n = e.style, s = () => n === "success" ? a.successNotification : n === "error" ? a.errorNotification : "";
40
39
  return t.className = f(a.notification, s()), n ? t.setAttribute("data-blok-testid", `notification-${n}`) : t.setAttribute("data-blok-testid", "notification"), t.innerHTML = r, o.className = a.crossBtn, o.setAttribute("data-blok-testid", "notification-cross"), o.addEventListener("click", () => t.remove()), t.appendChild(o), t;
@@ -72,7 +71,7 @@ const a = {
72
71
  }
73
72
  }
74
73
  })();
75
- t && r && (t.appendChild(r), r.className = `${r.className} ${a.bounceIn}`, r.setAttribute("data-blok-bounce-in", "true"));
74
+ t && r && (t.appendChild(r), r.className = `${r.className} animate-notify-bounce-in`, r.setAttribute("data-blok-bounce-in", "true"));
76
75
  }, h = {
77
76
  show: k
78
77
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jackuait/blok",
3
- "version": "0.2.1-beta.0",
3
+ "version": "0.3.1-beta.0",
4
4
  "description": "Blok — headless, highly extensible rich text editor built for developers who need to implement a block-based editing experience (similar to Notion) without building it from scratch",
5
5
  "main": "dist/blok.umd.js",
6
6
  "module": "dist/blok.mjs",
@@ -43,6 +43,12 @@
43
43
  "jscpd": "jscpd src/ test/",
44
44
  "jscpd:report": "jscpd . --reporters html,json --output .jscpd-report",
45
45
  "prepublishOnly": "yarn build",
46
+ "prepare": "husky",
47
+ "release": "./scripts/release.sh release",
48
+ "release:beta": "./scripts/release.sh prerelease beta",
49
+ "release:alpha": "./scripts/release.sh prerelease alpha",
50
+ "release:rc": "./scripts/release.sh prerelease rc",
51
+ "release:dry": "./scripts/release.sh release beta true",
46
52
  "storybook": "storybook dev -p 6006 --no-open",
47
53
  "storybook:build": "storybook build",
48
54
  "storybook:test": "vitest --project=storybook --run",
@@ -61,6 +67,8 @@
61
67
  "@axe-core/playwright": "4.11.0",
62
68
  "@babel/register": "7.28.3",
63
69
  "@chromatic-com/storybook": "4.1.3",
70
+ "@commitlint/cli": "20.1.0",
71
+ "@commitlint/config-conventional": "20.0.0",
64
72
  "@playwright/test": "1.57.0",
65
73
  "@storybook/addon-a11y": "10.1.1",
66
74
  "@storybook/addon-vitest": "10.1.1",
@@ -85,6 +93,7 @@
85
93
  "eslint-plugin-storybook": "10.1.1",
86
94
  "eslint-plugin-tailwindcss": "3.18.2",
87
95
  "html-janitor": "2.0.4",
96
+ "husky": "^9.1.7",
88
97
  "jscpd": "4.0.5",
89
98
  "jsdom": "27.2.0",
90
99
  "nanoid": "5.1.6",
@@ -1,19 +1,3 @@
1
- /**
2
- * Describes styles API - provides Tailwind CSS utility classes for tool styling.
3
- *
4
- * All values are Tailwind utility class strings that can be extended using tailwind-merge.
5
- *
6
- * @example
7
- * // Basic usage
8
- * element.className = api.styles.block;
9
- *
10
- * @example
11
- * // Extending with custom styles using tailwind-merge
12
- * import { twMerge } from 'tailwind-merge';
13
- * const customBlock = twMerge(api.styles.block, 'my-4 bg-gray-100');
14
- *
15
- * @since 2.0.0 - Changed from BEM class names to Tailwind utility strings
16
- */
17
1
  export interface Styles {
18
2
  /**
19
3
  * Base block styles - applied to block tool wrappers.
@@ -16,7 +16,6 @@ export interface NotifierOptions {
16
16
  type?: string;
17
17
 
18
18
  /**
19
- * Add class `blok-notify--${style}` to popup
20
19
  * We have some default styles: 'success' and 'error'
21
20
  */
22
21
  style?: string;
package/types/index.d.ts CHANGED
@@ -122,12 +122,19 @@ export interface API {
122
122
  ui: Ui;
123
123
  }
124
124
 
125
+ import { HeaderConstructable } from './tools/header';
126
+
125
127
  /**
126
128
  * Main Blok class
127
129
  */
128
130
  declare class Blok {
129
131
  public static version: string;
130
132
 
133
+ /**
134
+ * Header tool bundled with Blok
135
+ */
136
+ public static Header: HeaderConstructable;
137
+
131
138
  public isReady: Promise<void>;
132
139
 
133
140
  public blocks: Blocks;
@@ -0,0 +1,68 @@
1
+ import { BlockTool, BlockToolConstructable, BlockToolConstructorOptions, BlockToolData } from './block-tool';
2
+ import { MenuConfig } from './menu-config';
3
+
4
+ /**
5
+ * Header Tool's input and output data format
6
+ */
7
+ export interface HeaderData extends BlockToolData {
8
+ /** Header's content */
9
+ text: string;
10
+ /** Header's level from 1 to 6 */
11
+ level: number;
12
+ }
13
+
14
+ /**
15
+ * Header Tool's configuration
16
+ */
17
+ export interface HeaderConfig {
18
+ /** Block's placeholder */
19
+ placeholder?: string;
20
+ /** Heading levels available (1-6) */
21
+ levels?: number[];
22
+ /** Default level */
23
+ defaultLevel?: number;
24
+ }
25
+
26
+ /**
27
+ * Header Tool for the Blok Editor
28
+ * Provides Headings Blocks (H1-H6)
29
+ */
30
+ export interface Header extends BlockTool {
31
+ /**
32
+ * Return Tool's view
33
+ */
34
+ render(): HTMLHeadingElement;
35
+
36
+ /**
37
+ * Returns header block tunes config
38
+ */
39
+ renderSettings(): MenuConfig;
40
+
41
+ /**
42
+ * Method that specified how to merge two Header blocks.
43
+ * Called by Editor by backspace at the beginning of the Block
44
+ */
45
+ merge(data: HeaderData): void;
46
+
47
+ /**
48
+ * Validate Header block data
49
+ */
50
+ validate(blockData: HeaderData): boolean;
51
+
52
+ /**
53
+ * Extract Tool's data from the view
54
+ */
55
+ save(toolsContent: HTMLHeadingElement): HeaderData;
56
+
57
+ /**
58
+ * Get current Tool's data
59
+ */
60
+ data: HeaderData;
61
+ }
62
+
63
+ /**
64
+ * Header Tool constructor
65
+ */
66
+ export interface HeaderConstructable extends BlockToolConstructable {
67
+ new(config: BlockToolConstructorOptions<HeaderData, HeaderConfig>): Header;
68
+ }
@@ -11,6 +11,7 @@ export * from './tool-settings';
11
11
  export * from './paste-events';
12
12
  export * from './hook-events';
13
13
  export * from './menu-config';
14
+ export * from './header';
14
15
 
15
16
  export type Tool = BlockTool | InlineTool | BlockTune;
16
17
  export type ToolConstructable = BlockToolConstructable | InlineToolConstructable | BlockTuneConstructable;