@jackuait/blok 0.10.0-beta.4 → 0.10.0-beta.5

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/blok.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { tr as e } from "./chunks/constants-DxSXr7kd.mjs";
2
- import { n as t, t as n } from "./chunks/blok-D_0qAdUd.mjs";
1
+ import { tr as e } from "./chunks/constants-Ccno9NZS.mjs";
2
+ import { n as t, t as n } from "./chunks/blok-DH-WEcA8.mjs";
3
3
  export { n as Blok, e as DATA_ATTR, t as version };
@@ -1,4 +1,4 @@
1
- import { $n as e, $t as t, An as n, Bn as r, Bt as i, C as a, Cn as o, Dn as s, E as c, En as l, Fn as u, Gn as d, Gt as f, Hn as p, In as m, Jn as h, Jt as g, Kn as _, Kt as v, Ln as y, Lt as ee, Mn as te, Mt as ne, Nn as re, On as b, Pn as ie, Qn as ae, Qt as oe, Rn as se, S as ce, Sn as le, T as ue, Tn as x, Un as de, Vn as fe, Vt as pe, Wn as S, Xn as C, Xt as me, Yn as w, Yt as he, Zn as ge, Zt as _e, _ as ve, _n as ye, an as T, b as E, bn as be, bt as xe, cn as Se, dn as Ce, en as we, er as Te, fn as Ee, g as De, gn as Oe, h as ke, hn as Ae, ht as je, in as D, j as Me, jn as Ne, jt as Pe, kt as Fe, m as Ie, mn as Le, nn as Re, nr as O, on as ze, p as Be, pn as Ve, qn as He, qt as Ue, rn as We, rr as Ge, tn as Ke, tr as k, u as qe, un as Je, v as Ye, vn as Xe, vt as Ze, w as Qe, x as $e, xn as et, y as tt, yn as nt, zn as rt } from "./constants-DxSXr7kd.mjs";
1
+ import { $n as e, $t as t, An as n, Bn as r, Bt as i, C as a, Cn as o, Dn as s, E as c, En as l, Fn as u, Gn as d, Gt as f, Hn as p, In as m, Jn as h, Jt as g, Kn as _, Kt as v, Ln as y, Lt as ee, Mn as te, Mt as ne, Nn as re, On as b, Pn as ie, Qn as ae, Qt as oe, Rn as se, S as ce, Sn as le, T as ue, Tn as x, Un as de, Vn as fe, Vt as pe, Wn as S, Xn as C, Xt as me, Yn as w, Yt as he, Zn as ge, Zt as _e, _ as ve, _n as ye, an as T, b as E, bn as be, bt as xe, cn as Se, dn as Ce, en as we, er as Te, fn as Ee, g as De, gn as Oe, h as ke, hn as Ae, ht as je, in as D, j as Me, jn as Ne, jt as Pe, kt as Fe, m as Ie, mn as Le, nn as Re, nr as O, on as ze, p as Be, pn as Ve, qn as He, qt as Ue, rn as We, rr as Ge, tn as Ke, tr as k, u as qe, un as Je, v as Ye, vn as Xe, vt as Ze, w as Qe, x as $e, xn as et, y as tt, yn as nt, zn as rt } from "./constants-Ccno9NZS.mjs";
2
2
  import { n as it, t as A } from "./objectSpread2-BY4mgzrQ.mjs";
3
3
  import { n as j, t as at } from "./tw-DmW6-pCY.mjs";
4
4
  import { r as ot, t as st } from "./lightweight-i18n-DWCdzAw0.mjs";
@@ -138,7 +138,7 @@ var r = Object.create, i = Object.defineProperty, a = Object.getOwnPropertyDescr
138
138
  RIGHT: 2,
139
139
  BACKWARD: 3,
140
140
  FORWARD: 4
141
- }, g = () => "0.10.0-beta.4", _ = /* @__PURE__ */ function(e) {
141
+ }, g = () => "0.10.0-beta.5", _ = /* @__PURE__ */ function(e) {
142
142
  return e.VERBOSE = "VERBOSE", e.INFO = "INFO", e.WARN = "WARN", e.ERROR = "ERROR", e;
143
143
  }({}), v = (e, t, n = "log", r, i = "color: inherit") => {
144
144
  let a = typeof console > "u" ? void 0 : console;
@@ -1,4 +1,4 @@
1
- import { $ as e, $t as t, A as n, At as r, B as i, Bt as a, Ct as o, D as s, Dt as c, Et as l, F as u, Ft as d, G as f, Gt as p, H as m, Ht as h, I as g, It as ee, J as te, Jt as ne, K as re, L as ie, Lt as ae, M as oe, Mt as se, N as ce, Nt as le, O as ue, Ot as de, P as fe, Pt as pe, Q as me, Qt as he, R as ge, Rt as _e, St as ve, Tt as ye, U as be, Ut as xe, V as Se, Vt as Ce, W as we, Wt as Te, X as Ee, Y as De, Yn as Oe, Z as ke, _t as Ae, a as je, an as _, at as Me, c as Ne, cn as Pe, ct as Fe, d as Ie, dt as Le, et as Re, f as ze, ft as Be, g as Ve, gt as He, h as Ue, i as We, in as v, it as Ge, k as Ke, kn as y, kt as qe, l as Je, ln as Ye, lt as Xe, mt as Ze, n as Qe, nr as b, nt as $e, o as et, ot as tt, p as nt, pt as rt, q as it, r as at, rt as ot, s as st, st as ct, t as lt, tn as ut, tr as x, tt as dt, u as S, ut as ft, v as pt, vt as mt, wn as ht, wt as gt, xt as _t, yt as vt, z as yt, zt as bt } from "./constants-DxSXr7kd.mjs";
1
+ import { $ as e, $t as t, A as n, At as r, B as i, Bt as a, Ct as o, D as s, Dt as c, Et as l, F as u, Ft as d, G as f, Gt as p, H as m, Ht as h, I as g, It as ee, J as te, Jt as ne, K as re, L as ie, Lt as ae, M as oe, Mt as se, N as ce, Nt as le, O as ue, Ot as de, P as fe, Pt as pe, Q as me, Qt as he, R as ge, Rt as _e, St as ve, Tt as ye, U as be, Ut as xe, V as Se, Vt as Ce, W as we, Wt as Te, X as Ee, Y as De, Yn as Oe, Z as ke, _t as Ae, a as je, an as _, at as Me, c as Ne, cn as Pe, ct as Fe, d as Ie, dt as Le, et as Re, f as ze, ft as Be, g as Ve, gt as He, h as Ue, i as We, in as v, it as Ge, k as Ke, kn as y, kt as qe, l as Je, ln as Ye, lt as Xe, mt as Ze, n as Qe, nr as b, nt as $e, o as et, ot as tt, p as nt, pt as rt, q as it, r as at, rt as ot, s as st, st as ct, t as lt, tn as ut, tr as x, tt as dt, u as S, ut as ft, v as pt, vt as mt, wn as ht, wt as gt, xt as _t, yt as vt, z as yt, zt as bt } from "./constants-Ccno9NZS.mjs";
2
2
  import { r as xt, t as C } from "./objectSpread2-BY4mgzrQ.mjs";
3
3
  import { n as w } from "./tw-DmW6-pCY.mjs";
4
4
  //#region src/components/utils/html.ts
package/dist/full.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { tr as e } from "./chunks/constants-DxSXr7kd.mjs";
2
- import { n as t, t as n } from "./chunks/blok-D_0qAdUd.mjs";
1
+ import { tr as e } from "./chunks/constants-Ccno9NZS.mjs";
2
+ import { n as t, t as n } from "./chunks/blok-DH-WEcA8.mjs";
3
3
  import { t as r } from "./chunks/objectSpread2-BY4mgzrQ.mjs";
4
- import { _ as i, a, c as o, g as s, h as c, i as l, n as u, o as d, p as f, r as p, s as m, t as h } from "./chunks/tools-DVZ3zU40.mjs";
4
+ import { _ as i, a, c as o, g as s, h as c, i as l, n as u, o as d, p as f, r as p, s as m, t as h } from "./chunks/tools-C2_IVsQY.mjs";
5
5
  //#region src/full.ts
6
6
  var g = {
7
7
  paragraph: {
package/dist/react.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { Mt as e } from "./chunks/constants-DxSXr7kd.mjs";
2
- import { t } from "./chunks/blok-D_0qAdUd.mjs";
1
+ import { Mt as e } from "./chunks/constants-Ccno9NZS.mjs";
2
+ import { t } from "./chunks/blok-DH-WEcA8.mjs";
3
3
  import { t as n } from "./chunks/objectSpread2-BY4mgzrQ.mjs";
4
4
  import { forwardRef as r, useEffect as i, useMemo as a, useRef as o, useState as s } from "react";
5
5
  import { jsx as c } from "react/jsx-runtime";
package/dist/tools.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { m as e } from "./chunks/constants-DxSXr7kd.mjs";
2
- import { _ as t, a as n, c as r, d as i, f as a, g as o, h as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, t as g, u as _ } from "./chunks/tools-DVZ3zU40.mjs";
1
+ import { m as e } from "./chunks/constants-Ccno9NZS.mjs";
2
+ import { _ as t, a as n, c as r, d as i, f as a, g as o, h as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, t as g, u as _ } from "./chunks/tools-C2_IVsQY.mjs";
3
3
  export { r as Bold, a as Callout, e as Convert, i as Database, _ as Divider, o as Header, h as Italic, f as Link, s as List, n as Marker, t as Paragraph, l as Quote, m as Strikethrough, u as Table, p as Toggle, c as Underline, g as defaultBlockTools, d as defaultInlineTools };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jackuait/blok",
3
- "version": "0.10.0-beta.4",
3
+ "version": "0.10.0-beta.5",
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",
package/types/index.d.ts CHANGED
@@ -88,6 +88,22 @@ export {
88
88
  export * from './utils/popover';
89
89
 
90
90
  export { OutputData, OutputBlockData} from './data-formats/output-data';
91
+ export {
92
+ PropertyType,
93
+ SelectOption,
94
+ SelectPropertyConfig,
95
+ PropertyConfig,
96
+ PropertyDefinition,
97
+ PropertyValue,
98
+ DatabaseRow,
99
+ ViewType,
100
+ SortConfig,
101
+ FilterConfig,
102
+ DatabaseViewConfig,
103
+ DatabaseData,
104
+ DatabaseAdapter,
105
+ DatabaseConfig,
106
+ } from './tools/database';
91
107
  export { BlockId } from './data-formats/block-id';
92
108
  export {
93
109
  BlockAPI,
@@ -0,0 +1,145 @@
1
+ import { BlockToolData } from './block-tool';
2
+ import { OutputData } from '../data-formats/output-data';
3
+
4
+ // ─── Property types ───
5
+
6
+ export type PropertyType = 'title' | 'text' | 'number' | 'select' | 'multiSelect' | 'date' | 'checkbox' | 'url' | 'richText';
7
+
8
+ export interface SelectOption {
9
+ id: string;
10
+ label: string;
11
+ color?: string;
12
+ position: string;
13
+ }
14
+
15
+ export interface SelectPropertyConfig {
16
+ options: SelectOption[];
17
+ }
18
+
19
+ export type PropertyConfig = SelectPropertyConfig;
20
+
21
+ export interface PropertyDefinition {
22
+ id: string;
23
+ name: string;
24
+ type: PropertyType;
25
+ position: string;
26
+ config?: PropertyConfig;
27
+ }
28
+
29
+ export type PropertyValue = string | number | boolean | string[] | OutputData | null;
30
+
31
+ // ─── Rows ───
32
+
33
+ export interface DatabaseRow {
34
+ id: string;
35
+ position: string;
36
+ properties: Record<string, PropertyValue>;
37
+ }
38
+
39
+ // ─── View config ───
40
+
41
+ export type ViewType = 'board' | 'table' | 'gallery' | 'list';
42
+
43
+ export interface SortConfig {
44
+ propertyId: string;
45
+ direction: 'asc' | 'desc';
46
+ }
47
+
48
+ export interface FilterConfig {
49
+ propertyId: string;
50
+ operator: string;
51
+ value: PropertyValue;
52
+ }
53
+
54
+ export interface DatabaseViewConfig {
55
+ id: string;
56
+ name: string;
57
+ type: ViewType;
58
+ position: string;
59
+ groupBy?: string;
60
+ sorts: SortConfig[];
61
+ filters: FilterConfig[];
62
+ visibleProperties: string[];
63
+ }
64
+
65
+ // ─── Top-level saved data ───
66
+
67
+ export interface DatabaseData extends BlockToolData {
68
+ schema: PropertyDefinition[];
69
+ rows: Record<string, DatabaseRow>;
70
+ views: DatabaseViewConfig[];
71
+ activeViewId: string;
72
+ }
73
+
74
+ // ─── Adapter ───
75
+
76
+ export interface DatabaseAdapter {
77
+ loadDatabase(): Promise<{
78
+ schema: PropertyDefinition[];
79
+ rows: Record<string, DatabaseRow>;
80
+ views: DatabaseViewConfig[];
81
+ }>;
82
+
83
+ createRow(params: {
84
+ id: string;
85
+ properties: Record<string, PropertyValue>;
86
+ position: string;
87
+ }): Promise<DatabaseRow>;
88
+
89
+ updateRow(params: {
90
+ rowId: string;
91
+ properties: Record<string, PropertyValue>;
92
+ }): Promise<DatabaseRow>;
93
+
94
+ moveRow(params: {
95
+ rowId: string;
96
+ position: string;
97
+ }): Promise<DatabaseRow>;
98
+
99
+ deleteRow(params: {
100
+ rowId: string;
101
+ }): Promise<void>;
102
+
103
+ createProperty(params: {
104
+ id: string;
105
+ name: string;
106
+ type: PropertyType;
107
+ position: string;
108
+ config?: PropertyConfig;
109
+ }): Promise<PropertyDefinition>;
110
+
111
+ updateProperty(params: {
112
+ propertyId: string;
113
+ changes: Partial<Pick<PropertyDefinition, 'name' | 'config'>>;
114
+ }): Promise<PropertyDefinition>;
115
+
116
+ deleteProperty(params: {
117
+ propertyId: string;
118
+ }): Promise<void>;
119
+
120
+ createView(params: {
121
+ id: string;
122
+ name: string;
123
+ type: ViewType;
124
+ position: string;
125
+ groupBy?: string;
126
+ sorts?: SortConfig[];
127
+ filters?: FilterConfig[];
128
+ visibleProperties?: string[];
129
+ }): Promise<DatabaseViewConfig>;
130
+
131
+ updateView(params: {
132
+ viewId: string;
133
+ changes: Partial<Pick<DatabaseViewConfig,
134
+ 'name' | 'type' | 'position' | 'groupBy' | 'sorts' | 'filters' | 'visibleProperties'
135
+ >>;
136
+ }): Promise<DatabaseViewConfig>;
137
+
138
+ deleteView(params: {
139
+ viewId: string;
140
+ }): Promise<void>;
141
+ }
142
+
143
+ export interface DatabaseConfig {
144
+ adapter?: DatabaseAdapter;
145
+ }