@jackuait/blok 0.4.1-beta.15 → 0.4.1-beta.17

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 { e as i } from "./blok-CeuuGrRq.mjs";
1
+ import { e as i } from "./blok-BmQiBq7w.mjs";
2
2
  const l = async (e, r) => {
3
3
  const n = (await import("./i18next-CugVlwWp.mjs")).default.createInstance(), s = {
4
4
  lng: e,
@@ -1,4 +1,4 @@
1
- import { t as f, q as i } from "./inline-tool-convert-D8zvXApV.mjs";
1
+ import { t as f, q as i } from "./inline-tool-convert-f0-Y0Vcm.mjs";
2
2
  const a = {
3
3
  wrapper: i(
4
4
  "fixed z-[2] bottom-5 left-5",
@@ -18,7 +18,7 @@ let nt = (o = 21) => {
18
18
  return t;
19
19
  };
20
20
  var ot = /* @__PURE__ */ ((o) => (o.VERBOSE = "VERBOSE", o.INFO = "INFO", o.WARN = "WARN", o.ERROR = "ERROR", o))(ot || {});
21
- const rt = () => "0.4.1-beta.15", Ct = {
21
+ const rt = () => "0.4.1-beta.17", Ct = {
22
22
  BACKSPACE: 8,
23
23
  TAB: 9,
24
24
  ENTER: 13,
package/dist/full.mjs CHANGED
@@ -10,10 +10,10 @@ var e = (a, l, o) => l in a ? n(a, l, { enumerable: !0, configurable: !0, writab
10
10
  d.call(l, o) && e(a, o, l[o]);
11
11
  return a;
12
12
  }, r = (a, l) => t(a, c(l));
13
- import { B as v, v as A } from "./chunks/blok-CeuuGrRq.mjs";
13
+ import { B as v, v as A } from "./chunks/blok-BmQiBq7w.mjs";
14
14
  import { List as p, Header as f, Paragraph as I, Link as k, Italic as u, Bold as B } from "./tools.mjs";
15
15
  import { defaultBlockTools as H, defaultInlineTools as P } from "./tools.mjs";
16
- import { D as _ } from "./chunks/inline-tool-convert-D8zvXApV.mjs";
16
+ import { D as _ } from "./chunks/inline-tool-convert-f0-Y0Vcm.mjs";
17
17
  const m = {
18
18
  paragraph: {
19
19
  class: I,
package/dist/tools.mjs CHANGED
@@ -10,8 +10,8 @@ var U = (f, t, e) => t in f ? nt(f, t, { enumerable: !0, configurable: !0, writa
10
10
  it.call(t, e) && U(f, e, t[e]);
11
11
  return f;
12
12
  }, P = (f, t) => rt(f, st(t));
13
- import { t as x, D as m, a9 as et, aa as at, ab as lt, A as ct, ac as dt, ad as ut, ae as ht, af as ft, ag as pt, ah as mt, ai as G, aj as j, ak as $, f as A, al as gt, am as Et, S as H, P as Tt, an as Ct, l as At, J as yt } from "./chunks/inline-tool-convert-D8zvXApV.mjs";
14
- import { a0 as Dt } from "./chunks/inline-tool-convert-D8zvXApV.mjs";
13
+ import { t as x, D as m, a9 as et, aa as at, ab as lt, A as ct, ac as dt, ad as ut, ae as ht, af as ft, ag as pt, ah as mt, ai as G, aj as j, ak as $, f as A, al as gt, am as Et, S as H, P as Tt, an as Ct, l as At, J as yt } from "./chunks/inline-tool-convert-f0-Y0Vcm.mjs";
14
+ import { a0 as Dt } from "./chunks/inline-tool-convert-f0-Y0Vcm.mjs";
15
15
  const W = [
16
16
  "empty:before:pointer-events-none",
17
17
  "empty:before:text-gray-text",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jackuait/blok",
3
- "version": "0.4.1-beta.15",
3
+ "version": "0.4.1-beta.17",
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
  "module": "dist/blok.mjs",
6
6
  "types": "./types/index.d.ts",
@@ -8,18 +8,30 @@ import type { OutputBlockData, BlockId } from '../../../types';
8
8
  import { generateBlockId } from '../utils';
9
9
 
10
10
  /**
11
- * Legacy list item structure for data model transformation.
12
- * Used internally for transforming legacy nested list data to the hierarchical model.
11
+ * Legacy list item as object with content property
13
12
  */
14
- interface LegacyListItem {
13
+ interface LegacyListItemObject {
15
14
  content: string;
16
15
  checked?: boolean;
17
16
  items?: LegacyListItem[];
18
17
  }
19
18
 
19
+ /**
20
+ * Old checklist item format (uses 'text' instead of 'content')
21
+ */
22
+ interface OldChecklistItem {
23
+ text: string;
24
+ checked?: boolean;
25
+ }
26
+
27
+ /**
28
+ * Legacy list item structure for data model transformation.
29
+ * Can be: object with content, object with text (old checklist), or plain string.
30
+ */
31
+ type LegacyListItem = LegacyListItemObject | OldChecklistItem | string;
32
+
20
33
  /**
21
34
  * Legacy list data structure for data model transformation.
22
- * Used internally for transforming legacy nested list data to the hierarchical model.
23
35
  */
24
36
  interface LegacyListData {
25
37
  style: 'unordered' | 'ordered' | 'checklist';
@@ -41,11 +53,37 @@ export interface DataFormatAnalysis {
41
53
  hasHierarchy: boolean;
42
54
  }
43
55
 
56
+ /**
57
+ * Check if item is old checklist format (has 'text' instead of 'content')
58
+ */
59
+ const isOldChecklistItem = (item: LegacyListItem): item is OldChecklistItem => {
60
+ return typeof item === 'object' && 'text' in item && !('content' in item);
61
+ };
62
+
63
+ /**
64
+ * Normalize a legacy list item to object format
65
+ */
66
+ const normalizeListItem = (item: LegacyListItem): LegacyListItemObject => {
67
+ if (typeof item === 'string') {
68
+ return { content: item };
69
+ }
70
+
71
+ if (isOldChecklistItem(item)) {
72
+ return { content: item.text, checked: item.checked };
73
+ }
74
+
75
+ return item;
76
+ };
77
+
44
78
  /**
45
79
  * Recursively check if any list item has nested items (for hasHierarchy flag)
46
80
  */
47
81
  const hasNestedListItems = (items: LegacyListItem[]): boolean => {
48
- return items.some(item => item.items !== undefined && item.items.length > 0);
82
+ return items.some(item => {
83
+ const normalized = normalizeListItem(item);
84
+
85
+ return normalized.items !== undefined && normalized.items.length > 0;
86
+ });
49
87
  };
50
88
 
51
89
  /**
@@ -114,7 +152,9 @@ const expandListItems = (
114
152
  ): BlockId[] => {
115
153
  const childIds: BlockId[] = [];
116
154
 
117
- items.forEach((item, index) => {
155
+ items.forEach((rawItem, index) => {
156
+ // Normalize item to handle both string and object formats
157
+ const item = normalizeListItem(rawItem);
118
158
  const itemId = generateBlockId();
119
159
 
120
160
  childIds.push(itemId);