@seed-hypermedia/client 0.0.54 → 0.0.55
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/{chunk-AQLH2QY4.mjs → chunk-64F47WK6.mjs} +34 -1
- package/dist/editor-types.d.ts +21 -1
- package/dist/editorblock-to-hmblock.d.ts +5 -1
- package/dist/hm-types.d.ts +417 -0
- package/dist/hm-types.mjs +7 -1
- package/dist/hmblock-to-editorblock.d.ts +6 -2
- package/dist/index.mjs +128 -20
- package/package.json +1 -1
|
@@ -137,7 +137,12 @@ var HMBlockParagraphSchema = z.object({
|
|
|
137
137
|
type: z.literal("Paragraph"),
|
|
138
138
|
...blockBaseProperties,
|
|
139
139
|
...textBlockProperties,
|
|
140
|
-
attributes: z.object(
|
|
140
|
+
attributes: z.object({
|
|
141
|
+
...parentBlockAttributes,
|
|
142
|
+
// Present if this Paragraph is a cell inside a TableRow. References a TableColumn
|
|
143
|
+
// block by id.
|
|
144
|
+
columnId: z.string().optional()
|
|
145
|
+
}).optional().default({})
|
|
141
146
|
}).strict();
|
|
142
147
|
var HMBlockHeadingSchema = z.object({
|
|
143
148
|
type: z.literal("Heading"),
|
|
@@ -417,6 +422,28 @@ var HMQuerySchema = z.object({
|
|
|
417
422
|
z.coerce.number().optional()
|
|
418
423
|
)
|
|
419
424
|
});
|
|
425
|
+
var HMBlockTableSchema = z.object({
|
|
426
|
+
type: z.literal("Table"),
|
|
427
|
+
...blockBaseProperties,
|
|
428
|
+
attributes: z.object(parentBlockAttributes).optional().default({})
|
|
429
|
+
}).strict();
|
|
430
|
+
var HMBlockTableRowSchema = z.object({
|
|
431
|
+
type: z.literal("TableRow"),
|
|
432
|
+
...blockBaseProperties,
|
|
433
|
+
attributes: z.object({
|
|
434
|
+
...parentBlockAttributes,
|
|
435
|
+
isHeader: z.boolean().optional()
|
|
436
|
+
}).optional().default({})
|
|
437
|
+
}).strict();
|
|
438
|
+
var HMBlockTableColumnSchema = z.object({
|
|
439
|
+
type: z.literal("TableColumn"),
|
|
440
|
+
...blockBaseProperties,
|
|
441
|
+
attributes: z.object({
|
|
442
|
+
...parentBlockAttributes,
|
|
443
|
+
width: z.number().optional(),
|
|
444
|
+
isHeader: z.boolean().optional()
|
|
445
|
+
}).optional().default({})
|
|
446
|
+
}).strict();
|
|
420
447
|
var HMBlockQuerySchema = z.object({
|
|
421
448
|
type: z.literal("Query"),
|
|
422
449
|
...blockBaseProperties,
|
|
@@ -450,6 +477,9 @@ var HMBlockKnownSchema = z.discriminatedUnion("type", [
|
|
|
450
477
|
HMBlockEmbedSchema,
|
|
451
478
|
HMBlockWebEmbedSchema,
|
|
452
479
|
HMBlockNostrSchema,
|
|
480
|
+
HMBlockTableSchema,
|
|
481
|
+
HMBlockTableRowSchema,
|
|
482
|
+
HMBlockTableColumnSchema,
|
|
453
483
|
HMBlockQuerySchema,
|
|
454
484
|
HMBlockGroupSchema,
|
|
455
485
|
HMBlockLinkSchema
|
|
@@ -1339,6 +1369,9 @@ export {
|
|
|
1339
1369
|
HMQueryInclusionSchema,
|
|
1340
1370
|
HMQuerySortSchema,
|
|
1341
1371
|
HMQuerySchema,
|
|
1372
|
+
HMBlockTableSchema,
|
|
1373
|
+
HMBlockTableRowSchema,
|
|
1374
|
+
HMBlockTableColumnSchema,
|
|
1342
1375
|
HMBlockQuerySchema,
|
|
1343
1376
|
HMBlockGroupSchema,
|
|
1344
1377
|
HMBlockLinkSchema,
|
package/dist/editor-types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HMBlockChildrenType } from './hm-types';
|
|
2
|
-
export type EditorBlock = EditorParagraphBlock | EditorHeadingBlock | EditorCodeBlock | EditorImageBlock | EditorVideoBlock | EditorFileBlock | EditorButtonBlock | EditorEmbedBlock | EditorWebEmbedBlock | EditorMathBlock | EditorNostrBlock | EditorQueryBlock | EditorUnknownBlock;
|
|
2
|
+
export type EditorBlock = EditorParagraphBlock | EditorHeadingBlock | EditorCodeBlock | EditorImageBlock | EditorVideoBlock | EditorFileBlock | EditorButtonBlock | EditorEmbedBlock | EditorWebEmbedBlock | EditorMathBlock | EditorNostrBlock | EditorQueryBlock | EditorTableBlock | EditorTableRowBlock | EditorTableColumnBlock | EditorUnknownBlock;
|
|
3
3
|
export type HMInlineContent = EditorText | EditorInlineEmbed | EditorLink;
|
|
4
4
|
export interface EditorBaseBlock {
|
|
5
5
|
id: string;
|
|
@@ -13,6 +13,7 @@ export interface EditorBlockProps {
|
|
|
13
13
|
level?: number | string;
|
|
14
14
|
ref?: string;
|
|
15
15
|
revision?: string;
|
|
16
|
+
columnId?: string;
|
|
16
17
|
}
|
|
17
18
|
export interface EditorParagraphBlock extends EditorBaseBlock {
|
|
18
19
|
type: 'paragraph';
|
|
@@ -114,6 +115,25 @@ export type EditorQueryBlock = EditorBaseBlock & {
|
|
|
114
115
|
};
|
|
115
116
|
content: Array<HMInlineContent>;
|
|
116
117
|
};
|
|
118
|
+
export interface EditorTableBlock extends EditorBaseBlock {
|
|
119
|
+
type: 'table';
|
|
120
|
+
content: Array<HMInlineContent>;
|
|
121
|
+
}
|
|
122
|
+
export interface EditorTableRowBlock extends EditorBaseBlock {
|
|
123
|
+
type: 'tableRow';
|
|
124
|
+
props: EditorBlockProps & {
|
|
125
|
+
isHeader?: boolean;
|
|
126
|
+
};
|
|
127
|
+
content: Array<HMInlineContent>;
|
|
128
|
+
}
|
|
129
|
+
export interface EditorTableColumnBlock extends EditorBaseBlock {
|
|
130
|
+
type: 'tableColumn';
|
|
131
|
+
props: EditorBlockProps & {
|
|
132
|
+
width?: string;
|
|
133
|
+
isHeader?: boolean;
|
|
134
|
+
};
|
|
135
|
+
content: Array<HMInlineContent>;
|
|
136
|
+
}
|
|
117
137
|
export type EditorUnknownBlock = EditorBaseBlock & {
|
|
118
138
|
type: 'unknown';
|
|
119
139
|
props: EditorBlockProps & {
|
|
@@ -8,5 +8,9 @@ export declare function editorBlockToHMBlock(editorBlock: EditorBlock): HMBlock;
|
|
|
8
8
|
* This is the tree-level wrapper around `editorBlockToHMBlock` that recursively
|
|
9
9
|
* converts children. Useful when serializing editor content to the HM block format
|
|
10
10
|
* (e.g. for saving drafts as markdown or publishing documents).
|
|
11
|
+
*
|
|
12
|
+
* parentEditorType is the editor type of the surrounding block. Used
|
|
13
|
+
* to drop orphan table row and column blocks that ended up outside a
|
|
14
|
+
* table parent.
|
|
11
15
|
*/
|
|
12
|
-
export declare function editorBlocksToHMBlockNodes(editorBlocks: EditorBlock[]): HMBlockNode[];
|
|
16
|
+
export declare function editorBlocksToHMBlockNodes(editorBlocks: EditorBlock[], parentEditorType?: string): HMBlockNode[];
|
package/dist/hm-types.d.ts
CHANGED
|
@@ -878,12 +878,15 @@ export declare const HMAnnotationsSchema: z.ZodOptional<z.ZodArray<z.ZodDiscrimi
|
|
|
878
878
|
export type HMAnnotations = z.infer<typeof HMAnnotationsSchema>;
|
|
879
879
|
export declare const HMBlockParagraphSchema: z.ZodObject<{
|
|
880
880
|
attributes: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
881
|
+
columnId: z.ZodOptional<z.ZodString>;
|
|
881
882
|
childrenType: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodLiteral<"Group">, z.ZodLiteral<"Ordered">, z.ZodLiteral<"Unordered">, z.ZodLiteral<"Blockquote">, z.ZodLiteral<"Grid">]>>>;
|
|
882
883
|
columnCount: z.ZodOptional<z.ZodNumber>;
|
|
883
884
|
}, "strip", z.ZodTypeAny, {
|
|
885
|
+
columnId?: string | undefined;
|
|
884
886
|
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
885
887
|
columnCount?: number | undefined;
|
|
886
888
|
}, {
|
|
889
|
+
columnId?: string | undefined;
|
|
887
890
|
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
888
891
|
columnCount?: number | undefined;
|
|
889
892
|
}>>>;
|
|
@@ -1153,6 +1156,7 @@ export declare const HMBlockParagraphSchema: z.ZodObject<{
|
|
|
1153
1156
|
type: "Paragraph";
|
|
1154
1157
|
id: string;
|
|
1155
1158
|
attributes: {
|
|
1159
|
+
columnId?: string | undefined;
|
|
1156
1160
|
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
1157
1161
|
columnCount?: number | undefined;
|
|
1158
1162
|
};
|
|
@@ -1245,6 +1249,7 @@ export declare const HMBlockParagraphSchema: z.ZodObject<{
|
|
|
1245
1249
|
id: string;
|
|
1246
1250
|
link?: "" | undefined;
|
|
1247
1251
|
attributes?: {
|
|
1252
|
+
columnId?: string | undefined;
|
|
1248
1253
|
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
1249
1254
|
columnCount?: number | undefined;
|
|
1250
1255
|
} | undefined;
|
|
@@ -5665,6 +5670,141 @@ export declare const HMQuerySchema: z.ZodObject<{
|
|
|
5665
5670
|
}>;
|
|
5666
5671
|
export type HMQuery = z.infer<typeof HMQuerySchema>;
|
|
5667
5672
|
export type HMTimestamp = z.infer<typeof HMTimestampSchema>;
|
|
5673
|
+
export declare const HMBlockTableSchema: z.ZodObject<{
|
|
5674
|
+
attributes: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
5675
|
+
childrenType: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodLiteral<"Group">, z.ZodLiteral<"Ordered">, z.ZodLiteral<"Unordered">, z.ZodLiteral<"Blockquote">, z.ZodLiteral<"Grid">]>>>;
|
|
5676
|
+
columnCount: z.ZodOptional<z.ZodNumber>;
|
|
5677
|
+
}, "strip", z.ZodTypeAny, {
|
|
5678
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
5679
|
+
columnCount?: number | undefined;
|
|
5680
|
+
}, {
|
|
5681
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
5682
|
+
columnCount?: number | undefined;
|
|
5683
|
+
}>>>;
|
|
5684
|
+
id: z.ZodString;
|
|
5685
|
+
revision: z.ZodOptional<z.ZodString>;
|
|
5686
|
+
annotations: z.ZodOptional<z.ZodArray<z.ZodNever, "many">>;
|
|
5687
|
+
text: z.ZodOptional<z.ZodLiteral<"">>;
|
|
5688
|
+
link: z.ZodOptional<z.ZodLiteral<"">>;
|
|
5689
|
+
type: z.ZodLiteral<"Table">;
|
|
5690
|
+
}, "strict", z.ZodTypeAny, {
|
|
5691
|
+
type: "Table";
|
|
5692
|
+
id: string;
|
|
5693
|
+
attributes: {
|
|
5694
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
5695
|
+
columnCount?: number | undefined;
|
|
5696
|
+
};
|
|
5697
|
+
link?: "" | undefined;
|
|
5698
|
+
text?: "" | undefined;
|
|
5699
|
+
annotations?: never[] | undefined;
|
|
5700
|
+
revision?: string | undefined;
|
|
5701
|
+
}, {
|
|
5702
|
+
type: "Table";
|
|
5703
|
+
id: string;
|
|
5704
|
+
link?: "" | undefined;
|
|
5705
|
+
attributes?: {
|
|
5706
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
5707
|
+
columnCount?: number | undefined;
|
|
5708
|
+
} | undefined;
|
|
5709
|
+
text?: "" | undefined;
|
|
5710
|
+
annotations?: never[] | undefined;
|
|
5711
|
+
revision?: string | undefined;
|
|
5712
|
+
}>;
|
|
5713
|
+
export declare const HMBlockTableRowSchema: z.ZodObject<{
|
|
5714
|
+
attributes: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
5715
|
+
isHeader: z.ZodOptional<z.ZodBoolean>;
|
|
5716
|
+
childrenType: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodLiteral<"Group">, z.ZodLiteral<"Ordered">, z.ZodLiteral<"Unordered">, z.ZodLiteral<"Blockquote">, z.ZodLiteral<"Grid">]>>>;
|
|
5717
|
+
columnCount: z.ZodOptional<z.ZodNumber>;
|
|
5718
|
+
}, "strip", z.ZodTypeAny, {
|
|
5719
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
5720
|
+
columnCount?: number | undefined;
|
|
5721
|
+
isHeader?: boolean | undefined;
|
|
5722
|
+
}, {
|
|
5723
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
5724
|
+
columnCount?: number | undefined;
|
|
5725
|
+
isHeader?: boolean | undefined;
|
|
5726
|
+
}>>>;
|
|
5727
|
+
id: z.ZodString;
|
|
5728
|
+
revision: z.ZodOptional<z.ZodString>;
|
|
5729
|
+
annotations: z.ZodOptional<z.ZodArray<z.ZodNever, "many">>;
|
|
5730
|
+
text: z.ZodOptional<z.ZodLiteral<"">>;
|
|
5731
|
+
link: z.ZodOptional<z.ZodLiteral<"">>;
|
|
5732
|
+
type: z.ZodLiteral<"TableRow">;
|
|
5733
|
+
}, "strict", z.ZodTypeAny, {
|
|
5734
|
+
type: "TableRow";
|
|
5735
|
+
id: string;
|
|
5736
|
+
attributes: {
|
|
5737
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
5738
|
+
columnCount?: number | undefined;
|
|
5739
|
+
isHeader?: boolean | undefined;
|
|
5740
|
+
};
|
|
5741
|
+
link?: "" | undefined;
|
|
5742
|
+
text?: "" | undefined;
|
|
5743
|
+
annotations?: never[] | undefined;
|
|
5744
|
+
revision?: string | undefined;
|
|
5745
|
+
}, {
|
|
5746
|
+
type: "TableRow";
|
|
5747
|
+
id: string;
|
|
5748
|
+
link?: "" | undefined;
|
|
5749
|
+
attributes?: {
|
|
5750
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
5751
|
+
columnCount?: number | undefined;
|
|
5752
|
+
isHeader?: boolean | undefined;
|
|
5753
|
+
} | undefined;
|
|
5754
|
+
text?: "" | undefined;
|
|
5755
|
+
annotations?: never[] | undefined;
|
|
5756
|
+
revision?: string | undefined;
|
|
5757
|
+
}>;
|
|
5758
|
+
export declare const HMBlockTableColumnSchema: z.ZodObject<{
|
|
5759
|
+
attributes: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
5760
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
5761
|
+
isHeader: z.ZodOptional<z.ZodBoolean>;
|
|
5762
|
+
childrenType: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodLiteral<"Group">, z.ZodLiteral<"Ordered">, z.ZodLiteral<"Unordered">, z.ZodLiteral<"Blockquote">, z.ZodLiteral<"Grid">]>>>;
|
|
5763
|
+
columnCount: z.ZodOptional<z.ZodNumber>;
|
|
5764
|
+
}, "strip", z.ZodTypeAny, {
|
|
5765
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
5766
|
+
columnCount?: number | undefined;
|
|
5767
|
+
width?: number | undefined;
|
|
5768
|
+
isHeader?: boolean | undefined;
|
|
5769
|
+
}, {
|
|
5770
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
5771
|
+
columnCount?: number | undefined;
|
|
5772
|
+
width?: number | undefined;
|
|
5773
|
+
isHeader?: boolean | undefined;
|
|
5774
|
+
}>>>;
|
|
5775
|
+
id: z.ZodString;
|
|
5776
|
+
revision: z.ZodOptional<z.ZodString>;
|
|
5777
|
+
annotations: z.ZodOptional<z.ZodArray<z.ZodNever, "many">>;
|
|
5778
|
+
text: z.ZodOptional<z.ZodLiteral<"">>;
|
|
5779
|
+
link: z.ZodOptional<z.ZodLiteral<"">>;
|
|
5780
|
+
type: z.ZodLiteral<"TableColumn">;
|
|
5781
|
+
}, "strict", z.ZodTypeAny, {
|
|
5782
|
+
type: "TableColumn";
|
|
5783
|
+
id: string;
|
|
5784
|
+
attributes: {
|
|
5785
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
5786
|
+
columnCount?: number | undefined;
|
|
5787
|
+
width?: number | undefined;
|
|
5788
|
+
isHeader?: boolean | undefined;
|
|
5789
|
+
};
|
|
5790
|
+
link?: "" | undefined;
|
|
5791
|
+
text?: "" | undefined;
|
|
5792
|
+
annotations?: never[] | undefined;
|
|
5793
|
+
revision?: string | undefined;
|
|
5794
|
+
}, {
|
|
5795
|
+
type: "TableColumn";
|
|
5796
|
+
id: string;
|
|
5797
|
+
link?: "" | undefined;
|
|
5798
|
+
attributes?: {
|
|
5799
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
5800
|
+
columnCount?: number | undefined;
|
|
5801
|
+
width?: number | undefined;
|
|
5802
|
+
isHeader?: boolean | undefined;
|
|
5803
|
+
} | undefined;
|
|
5804
|
+
text?: "" | undefined;
|
|
5805
|
+
annotations?: never[] | undefined;
|
|
5806
|
+
revision?: string | undefined;
|
|
5807
|
+
}>;
|
|
5668
5808
|
export declare const HMBlockQuerySchema: z.ZodObject<{
|
|
5669
5809
|
attributes: z.ZodObject<{
|
|
5670
5810
|
style: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"Card">, z.ZodLiteral<"List">]>>>;
|
|
@@ -5839,12 +5979,15 @@ export declare const HMBlockLinkSchema: z.ZodObject<{
|
|
|
5839
5979
|
}>;
|
|
5840
5980
|
export declare const HMBlockKnownSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
5841
5981
|
attributes: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
5982
|
+
columnId: z.ZodOptional<z.ZodString>;
|
|
5842
5983
|
childrenType: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodLiteral<"Group">, z.ZodLiteral<"Ordered">, z.ZodLiteral<"Unordered">, z.ZodLiteral<"Blockquote">, z.ZodLiteral<"Grid">]>>>;
|
|
5843
5984
|
columnCount: z.ZodOptional<z.ZodNumber>;
|
|
5844
5985
|
}, "strip", z.ZodTypeAny, {
|
|
5986
|
+
columnId?: string | undefined;
|
|
5845
5987
|
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
5846
5988
|
columnCount?: number | undefined;
|
|
5847
5989
|
}, {
|
|
5990
|
+
columnId?: string | undefined;
|
|
5848
5991
|
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
5849
5992
|
columnCount?: number | undefined;
|
|
5850
5993
|
}>>>;
|
|
@@ -6114,6 +6257,7 @@ export declare const HMBlockKnownSchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
|
|
|
6114
6257
|
type: "Paragraph";
|
|
6115
6258
|
id: string;
|
|
6116
6259
|
attributes: {
|
|
6260
|
+
columnId?: string | undefined;
|
|
6117
6261
|
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
6118
6262
|
columnCount?: number | undefined;
|
|
6119
6263
|
};
|
|
@@ -6206,6 +6350,7 @@ export declare const HMBlockKnownSchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
|
|
|
6206
6350
|
id: string;
|
|
6207
6351
|
link?: "" | undefined;
|
|
6208
6352
|
attributes?: {
|
|
6353
|
+
columnId?: string | undefined;
|
|
6209
6354
|
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
6210
6355
|
columnCount?: number | undefined;
|
|
6211
6356
|
} | undefined;
|
|
@@ -7549,6 +7694,138 @@ export declare const HMBlockKnownSchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
|
|
|
7549
7694
|
text?: "" | undefined;
|
|
7550
7695
|
annotations?: never[] | undefined;
|
|
7551
7696
|
revision?: string | undefined;
|
|
7697
|
+
}>, z.ZodObject<{
|
|
7698
|
+
attributes: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
7699
|
+
childrenType: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodLiteral<"Group">, z.ZodLiteral<"Ordered">, z.ZodLiteral<"Unordered">, z.ZodLiteral<"Blockquote">, z.ZodLiteral<"Grid">]>>>;
|
|
7700
|
+
columnCount: z.ZodOptional<z.ZodNumber>;
|
|
7701
|
+
}, "strip", z.ZodTypeAny, {
|
|
7702
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
7703
|
+
columnCount?: number | undefined;
|
|
7704
|
+
}, {
|
|
7705
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
7706
|
+
columnCount?: number | undefined;
|
|
7707
|
+
}>>>;
|
|
7708
|
+
id: z.ZodString;
|
|
7709
|
+
revision: z.ZodOptional<z.ZodString>;
|
|
7710
|
+
annotations: z.ZodOptional<z.ZodArray<z.ZodNever, "many">>;
|
|
7711
|
+
text: z.ZodOptional<z.ZodLiteral<"">>;
|
|
7712
|
+
link: z.ZodOptional<z.ZodLiteral<"">>;
|
|
7713
|
+
type: z.ZodLiteral<"Table">;
|
|
7714
|
+
}, "strict", z.ZodTypeAny, {
|
|
7715
|
+
type: "Table";
|
|
7716
|
+
id: string;
|
|
7717
|
+
attributes: {
|
|
7718
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
7719
|
+
columnCount?: number | undefined;
|
|
7720
|
+
};
|
|
7721
|
+
link?: "" | undefined;
|
|
7722
|
+
text?: "" | undefined;
|
|
7723
|
+
annotations?: never[] | undefined;
|
|
7724
|
+
revision?: string | undefined;
|
|
7725
|
+
}, {
|
|
7726
|
+
type: "Table";
|
|
7727
|
+
id: string;
|
|
7728
|
+
link?: "" | undefined;
|
|
7729
|
+
attributes?: {
|
|
7730
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
7731
|
+
columnCount?: number | undefined;
|
|
7732
|
+
} | undefined;
|
|
7733
|
+
text?: "" | undefined;
|
|
7734
|
+
annotations?: never[] | undefined;
|
|
7735
|
+
revision?: string | undefined;
|
|
7736
|
+
}>, z.ZodObject<{
|
|
7737
|
+
attributes: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
7738
|
+
isHeader: z.ZodOptional<z.ZodBoolean>;
|
|
7739
|
+
childrenType: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodLiteral<"Group">, z.ZodLiteral<"Ordered">, z.ZodLiteral<"Unordered">, z.ZodLiteral<"Blockquote">, z.ZodLiteral<"Grid">]>>>;
|
|
7740
|
+
columnCount: z.ZodOptional<z.ZodNumber>;
|
|
7741
|
+
}, "strip", z.ZodTypeAny, {
|
|
7742
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
7743
|
+
columnCount?: number | undefined;
|
|
7744
|
+
isHeader?: boolean | undefined;
|
|
7745
|
+
}, {
|
|
7746
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
7747
|
+
columnCount?: number | undefined;
|
|
7748
|
+
isHeader?: boolean | undefined;
|
|
7749
|
+
}>>>;
|
|
7750
|
+
id: z.ZodString;
|
|
7751
|
+
revision: z.ZodOptional<z.ZodString>;
|
|
7752
|
+
annotations: z.ZodOptional<z.ZodArray<z.ZodNever, "many">>;
|
|
7753
|
+
text: z.ZodOptional<z.ZodLiteral<"">>;
|
|
7754
|
+
link: z.ZodOptional<z.ZodLiteral<"">>;
|
|
7755
|
+
type: z.ZodLiteral<"TableRow">;
|
|
7756
|
+
}, "strict", z.ZodTypeAny, {
|
|
7757
|
+
type: "TableRow";
|
|
7758
|
+
id: string;
|
|
7759
|
+
attributes: {
|
|
7760
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
7761
|
+
columnCount?: number | undefined;
|
|
7762
|
+
isHeader?: boolean | undefined;
|
|
7763
|
+
};
|
|
7764
|
+
link?: "" | undefined;
|
|
7765
|
+
text?: "" | undefined;
|
|
7766
|
+
annotations?: never[] | undefined;
|
|
7767
|
+
revision?: string | undefined;
|
|
7768
|
+
}, {
|
|
7769
|
+
type: "TableRow";
|
|
7770
|
+
id: string;
|
|
7771
|
+
link?: "" | undefined;
|
|
7772
|
+
attributes?: {
|
|
7773
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
7774
|
+
columnCount?: number | undefined;
|
|
7775
|
+
isHeader?: boolean | undefined;
|
|
7776
|
+
} | undefined;
|
|
7777
|
+
text?: "" | undefined;
|
|
7778
|
+
annotations?: never[] | undefined;
|
|
7779
|
+
revision?: string | undefined;
|
|
7780
|
+
}>, z.ZodObject<{
|
|
7781
|
+
attributes: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
7782
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
7783
|
+
isHeader: z.ZodOptional<z.ZodBoolean>;
|
|
7784
|
+
childrenType: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodLiteral<"Group">, z.ZodLiteral<"Ordered">, z.ZodLiteral<"Unordered">, z.ZodLiteral<"Blockquote">, z.ZodLiteral<"Grid">]>>>;
|
|
7785
|
+
columnCount: z.ZodOptional<z.ZodNumber>;
|
|
7786
|
+
}, "strip", z.ZodTypeAny, {
|
|
7787
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
7788
|
+
columnCount?: number | undefined;
|
|
7789
|
+
width?: number | undefined;
|
|
7790
|
+
isHeader?: boolean | undefined;
|
|
7791
|
+
}, {
|
|
7792
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
7793
|
+
columnCount?: number | undefined;
|
|
7794
|
+
width?: number | undefined;
|
|
7795
|
+
isHeader?: boolean | undefined;
|
|
7796
|
+
}>>>;
|
|
7797
|
+
id: z.ZodString;
|
|
7798
|
+
revision: z.ZodOptional<z.ZodString>;
|
|
7799
|
+
annotations: z.ZodOptional<z.ZodArray<z.ZodNever, "many">>;
|
|
7800
|
+
text: z.ZodOptional<z.ZodLiteral<"">>;
|
|
7801
|
+
link: z.ZodOptional<z.ZodLiteral<"">>;
|
|
7802
|
+
type: z.ZodLiteral<"TableColumn">;
|
|
7803
|
+
}, "strict", z.ZodTypeAny, {
|
|
7804
|
+
type: "TableColumn";
|
|
7805
|
+
id: string;
|
|
7806
|
+
attributes: {
|
|
7807
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
7808
|
+
columnCount?: number | undefined;
|
|
7809
|
+
width?: number | undefined;
|
|
7810
|
+
isHeader?: boolean | undefined;
|
|
7811
|
+
};
|
|
7812
|
+
link?: "" | undefined;
|
|
7813
|
+
text?: "" | undefined;
|
|
7814
|
+
annotations?: never[] | undefined;
|
|
7815
|
+
revision?: string | undefined;
|
|
7816
|
+
}, {
|
|
7817
|
+
type: "TableColumn";
|
|
7818
|
+
id: string;
|
|
7819
|
+
link?: "" | undefined;
|
|
7820
|
+
attributes?: {
|
|
7821
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
7822
|
+
columnCount?: number | undefined;
|
|
7823
|
+
width?: number | undefined;
|
|
7824
|
+
isHeader?: boolean | undefined;
|
|
7825
|
+
} | undefined;
|
|
7826
|
+
text?: "" | undefined;
|
|
7827
|
+
annotations?: never[] | undefined;
|
|
7828
|
+
revision?: string | undefined;
|
|
7552
7829
|
}>, z.ZodObject<{
|
|
7553
7830
|
attributes: z.ZodObject<{
|
|
7554
7831
|
style: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"Card">, z.ZodLiteral<"List">]>>>;
|
|
@@ -7746,12 +8023,15 @@ export declare const HMBlockUnknownSchema: z.ZodObject<{
|
|
|
7746
8023
|
}, z.ZodTypeAny, "passthrough">>;
|
|
7747
8024
|
export declare const HMBlockSchema: z.ZodUnion<[z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
7748
8025
|
attributes: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
8026
|
+
columnId: z.ZodOptional<z.ZodString>;
|
|
7749
8027
|
childrenType: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodLiteral<"Group">, z.ZodLiteral<"Ordered">, z.ZodLiteral<"Unordered">, z.ZodLiteral<"Blockquote">, z.ZodLiteral<"Grid">]>>>;
|
|
7750
8028
|
columnCount: z.ZodOptional<z.ZodNumber>;
|
|
7751
8029
|
}, "strip", z.ZodTypeAny, {
|
|
8030
|
+
columnId?: string | undefined;
|
|
7752
8031
|
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
7753
8032
|
columnCount?: number | undefined;
|
|
7754
8033
|
}, {
|
|
8034
|
+
columnId?: string | undefined;
|
|
7755
8035
|
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
7756
8036
|
columnCount?: number | undefined;
|
|
7757
8037
|
}>>>;
|
|
@@ -8021,6 +8301,7 @@ export declare const HMBlockSchema: z.ZodUnion<[z.ZodDiscriminatedUnion<"type",
|
|
|
8021
8301
|
type: "Paragraph";
|
|
8022
8302
|
id: string;
|
|
8023
8303
|
attributes: {
|
|
8304
|
+
columnId?: string | undefined;
|
|
8024
8305
|
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
8025
8306
|
columnCount?: number | undefined;
|
|
8026
8307
|
};
|
|
@@ -8113,6 +8394,7 @@ export declare const HMBlockSchema: z.ZodUnion<[z.ZodDiscriminatedUnion<"type",
|
|
|
8113
8394
|
id: string;
|
|
8114
8395
|
link?: "" | undefined;
|
|
8115
8396
|
attributes?: {
|
|
8397
|
+
columnId?: string | undefined;
|
|
8116
8398
|
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
8117
8399
|
columnCount?: number | undefined;
|
|
8118
8400
|
} | undefined;
|
|
@@ -9456,6 +9738,138 @@ export declare const HMBlockSchema: z.ZodUnion<[z.ZodDiscriminatedUnion<"type",
|
|
|
9456
9738
|
text?: "" | undefined;
|
|
9457
9739
|
annotations?: never[] | undefined;
|
|
9458
9740
|
revision?: string | undefined;
|
|
9741
|
+
}>, z.ZodObject<{
|
|
9742
|
+
attributes: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
9743
|
+
childrenType: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodLiteral<"Group">, z.ZodLiteral<"Ordered">, z.ZodLiteral<"Unordered">, z.ZodLiteral<"Blockquote">, z.ZodLiteral<"Grid">]>>>;
|
|
9744
|
+
columnCount: z.ZodOptional<z.ZodNumber>;
|
|
9745
|
+
}, "strip", z.ZodTypeAny, {
|
|
9746
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
9747
|
+
columnCount?: number | undefined;
|
|
9748
|
+
}, {
|
|
9749
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
9750
|
+
columnCount?: number | undefined;
|
|
9751
|
+
}>>>;
|
|
9752
|
+
id: z.ZodString;
|
|
9753
|
+
revision: z.ZodOptional<z.ZodString>;
|
|
9754
|
+
annotations: z.ZodOptional<z.ZodArray<z.ZodNever, "many">>;
|
|
9755
|
+
text: z.ZodOptional<z.ZodLiteral<"">>;
|
|
9756
|
+
link: z.ZodOptional<z.ZodLiteral<"">>;
|
|
9757
|
+
type: z.ZodLiteral<"Table">;
|
|
9758
|
+
}, "strict", z.ZodTypeAny, {
|
|
9759
|
+
type: "Table";
|
|
9760
|
+
id: string;
|
|
9761
|
+
attributes: {
|
|
9762
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
9763
|
+
columnCount?: number | undefined;
|
|
9764
|
+
};
|
|
9765
|
+
link?: "" | undefined;
|
|
9766
|
+
text?: "" | undefined;
|
|
9767
|
+
annotations?: never[] | undefined;
|
|
9768
|
+
revision?: string | undefined;
|
|
9769
|
+
}, {
|
|
9770
|
+
type: "Table";
|
|
9771
|
+
id: string;
|
|
9772
|
+
link?: "" | undefined;
|
|
9773
|
+
attributes?: {
|
|
9774
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
9775
|
+
columnCount?: number | undefined;
|
|
9776
|
+
} | undefined;
|
|
9777
|
+
text?: "" | undefined;
|
|
9778
|
+
annotations?: never[] | undefined;
|
|
9779
|
+
revision?: string | undefined;
|
|
9780
|
+
}>, z.ZodObject<{
|
|
9781
|
+
attributes: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
9782
|
+
isHeader: z.ZodOptional<z.ZodBoolean>;
|
|
9783
|
+
childrenType: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodLiteral<"Group">, z.ZodLiteral<"Ordered">, z.ZodLiteral<"Unordered">, z.ZodLiteral<"Blockquote">, z.ZodLiteral<"Grid">]>>>;
|
|
9784
|
+
columnCount: z.ZodOptional<z.ZodNumber>;
|
|
9785
|
+
}, "strip", z.ZodTypeAny, {
|
|
9786
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
9787
|
+
columnCount?: number | undefined;
|
|
9788
|
+
isHeader?: boolean | undefined;
|
|
9789
|
+
}, {
|
|
9790
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
9791
|
+
columnCount?: number | undefined;
|
|
9792
|
+
isHeader?: boolean | undefined;
|
|
9793
|
+
}>>>;
|
|
9794
|
+
id: z.ZodString;
|
|
9795
|
+
revision: z.ZodOptional<z.ZodString>;
|
|
9796
|
+
annotations: z.ZodOptional<z.ZodArray<z.ZodNever, "many">>;
|
|
9797
|
+
text: z.ZodOptional<z.ZodLiteral<"">>;
|
|
9798
|
+
link: z.ZodOptional<z.ZodLiteral<"">>;
|
|
9799
|
+
type: z.ZodLiteral<"TableRow">;
|
|
9800
|
+
}, "strict", z.ZodTypeAny, {
|
|
9801
|
+
type: "TableRow";
|
|
9802
|
+
id: string;
|
|
9803
|
+
attributes: {
|
|
9804
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
9805
|
+
columnCount?: number | undefined;
|
|
9806
|
+
isHeader?: boolean | undefined;
|
|
9807
|
+
};
|
|
9808
|
+
link?: "" | undefined;
|
|
9809
|
+
text?: "" | undefined;
|
|
9810
|
+
annotations?: never[] | undefined;
|
|
9811
|
+
revision?: string | undefined;
|
|
9812
|
+
}, {
|
|
9813
|
+
type: "TableRow";
|
|
9814
|
+
id: string;
|
|
9815
|
+
link?: "" | undefined;
|
|
9816
|
+
attributes?: {
|
|
9817
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
9818
|
+
columnCount?: number | undefined;
|
|
9819
|
+
isHeader?: boolean | undefined;
|
|
9820
|
+
} | undefined;
|
|
9821
|
+
text?: "" | undefined;
|
|
9822
|
+
annotations?: never[] | undefined;
|
|
9823
|
+
revision?: string | undefined;
|
|
9824
|
+
}>, z.ZodObject<{
|
|
9825
|
+
attributes: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
9826
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
9827
|
+
isHeader: z.ZodOptional<z.ZodBoolean>;
|
|
9828
|
+
childrenType: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodLiteral<"Group">, z.ZodLiteral<"Ordered">, z.ZodLiteral<"Unordered">, z.ZodLiteral<"Blockquote">, z.ZodLiteral<"Grid">]>>>;
|
|
9829
|
+
columnCount: z.ZodOptional<z.ZodNumber>;
|
|
9830
|
+
}, "strip", z.ZodTypeAny, {
|
|
9831
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
9832
|
+
columnCount?: number | undefined;
|
|
9833
|
+
width?: number | undefined;
|
|
9834
|
+
isHeader?: boolean | undefined;
|
|
9835
|
+
}, {
|
|
9836
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
9837
|
+
columnCount?: number | undefined;
|
|
9838
|
+
width?: number | undefined;
|
|
9839
|
+
isHeader?: boolean | undefined;
|
|
9840
|
+
}>>>;
|
|
9841
|
+
id: z.ZodString;
|
|
9842
|
+
revision: z.ZodOptional<z.ZodString>;
|
|
9843
|
+
annotations: z.ZodOptional<z.ZodArray<z.ZodNever, "many">>;
|
|
9844
|
+
text: z.ZodOptional<z.ZodLiteral<"">>;
|
|
9845
|
+
link: z.ZodOptional<z.ZodLiteral<"">>;
|
|
9846
|
+
type: z.ZodLiteral<"TableColumn">;
|
|
9847
|
+
}, "strict", z.ZodTypeAny, {
|
|
9848
|
+
type: "TableColumn";
|
|
9849
|
+
id: string;
|
|
9850
|
+
attributes: {
|
|
9851
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
9852
|
+
columnCount?: number | undefined;
|
|
9853
|
+
width?: number | undefined;
|
|
9854
|
+
isHeader?: boolean | undefined;
|
|
9855
|
+
};
|
|
9856
|
+
link?: "" | undefined;
|
|
9857
|
+
text?: "" | undefined;
|
|
9858
|
+
annotations?: never[] | undefined;
|
|
9859
|
+
revision?: string | undefined;
|
|
9860
|
+
}, {
|
|
9861
|
+
type: "TableColumn";
|
|
9862
|
+
id: string;
|
|
9863
|
+
link?: "" | undefined;
|
|
9864
|
+
attributes?: {
|
|
9865
|
+
childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
|
|
9866
|
+
columnCount?: number | undefined;
|
|
9867
|
+
width?: number | undefined;
|
|
9868
|
+
isHeader?: boolean | undefined;
|
|
9869
|
+
} | undefined;
|
|
9870
|
+
text?: "" | undefined;
|
|
9871
|
+
annotations?: never[] | undefined;
|
|
9872
|
+
revision?: string | undefined;
|
|
9459
9873
|
}>, z.ZodObject<{
|
|
9460
9874
|
attributes: z.ZodObject<{
|
|
9461
9875
|
style: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"Card">, z.ZodLiteral<"List">]>>>;
|
|
@@ -9665,6 +10079,9 @@ export type HMBlockWebEmbed = z.infer<typeof HMBlockWebEmbedSchema>;
|
|
|
9665
10079
|
export type HMBlockQuery = z.infer<typeof HMBlockQuerySchema>;
|
|
9666
10080
|
export type HMBlock = z.infer<typeof HMBlockKnownSchema>;
|
|
9667
10081
|
export type HMBlockNostr = z.infer<typeof HMBlockNostrSchema>;
|
|
10082
|
+
export type HMBlockTable = z.infer<typeof HMBlockTableSchema>;
|
|
10083
|
+
export type HMBlockTableRow = z.infer<typeof HMBlockTableRowSchema>;
|
|
10084
|
+
export type HMBlockTableColumn = z.infer<typeof HMBlockTableColumnSchema>;
|
|
9668
10085
|
export declare const HMDocumentSchema: z.ZodObject<{
|
|
9669
10086
|
content: z.ZodDefault<z.ZodArray<z.ZodType<HMBlockNode, z.ZodTypeDef, HMBlockNode>, "many">>;
|
|
9670
10087
|
version: z.ZodDefault<z.ZodString>;
|
package/dist/hm-types.mjs
CHANGED
|
@@ -30,6 +30,9 @@ import {
|
|
|
30
30
|
HMBlockParagraphSchema,
|
|
31
31
|
HMBlockQuerySchema,
|
|
32
32
|
HMBlockSchema,
|
|
33
|
+
HMBlockTableColumnSchema,
|
|
34
|
+
HMBlockTableRowSchema,
|
|
35
|
+
HMBlockTableSchema,
|
|
33
36
|
HMBlockUnknownSchema,
|
|
34
37
|
HMBlockVideoSchema,
|
|
35
38
|
HMBlockWebEmbedSchema,
|
|
@@ -176,7 +179,7 @@ import {
|
|
|
176
179
|
toNumber,
|
|
177
180
|
unpackHmId,
|
|
178
181
|
unpackedHmIdSchema
|
|
179
|
-
} from "./chunk-
|
|
182
|
+
} from "./chunk-64F47WK6.mjs";
|
|
180
183
|
export {
|
|
181
184
|
BackgroundColorAnnotationSchema,
|
|
182
185
|
BlockRangeSchema,
|
|
@@ -209,6 +212,9 @@ export {
|
|
|
209
212
|
HMBlockParagraphSchema,
|
|
210
213
|
HMBlockQuerySchema,
|
|
211
214
|
HMBlockSchema,
|
|
215
|
+
HMBlockTableColumnSchema,
|
|
216
|
+
HMBlockTableRowSchema,
|
|
217
|
+
HMBlockTableSchema,
|
|
212
218
|
HMBlockUnknownSchema,
|
|
213
219
|
HMBlockVideoSchema,
|
|
214
220
|
HMBlockWebEmbedSchema,
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import type { EditorBlock } from './editor-types';
|
|
2
|
-
import { type HMBlock, type HMBlockChildrenType, type HMBlockNode } from './hm-types';
|
|
2
|
+
import { type HMBlock, type HMBlockChildrenType, type HMBlockNode, type HMBlockType } from './hm-types';
|
|
3
3
|
import type { SpanAnnotation } from './unicode';
|
|
4
4
|
type ServerToEditorRecursiveOpts = {
|
|
5
5
|
level?: number;
|
|
6
6
|
};
|
|
7
|
-
/** Convert an array of HMBlockNode trees into BlockNote EditorBlock arrays.
|
|
7
|
+
/** Convert an array of HMBlockNode trees into BlockNote EditorBlock arrays.
|
|
8
|
+
*
|
|
9
|
+
* parentType is the BlockNode type of the surrounding block. Used to drop
|
|
10
|
+
* orphan table row and column blocks that ended up outside a table parent. */
|
|
8
11
|
export declare function hmBlocksToEditorContent(blocks: HMBlockNode[], opts?: ServerToEditorRecursiveOpts & {
|
|
9
12
|
childrenType?: HMBlockChildrenType;
|
|
10
13
|
listLevel?: string;
|
|
11
14
|
start?: string;
|
|
15
|
+
parentType?: HMBlockType;
|
|
12
16
|
}): Array<EditorBlock>;
|
|
13
17
|
/** Convert a single HMBlock into a BlockNote EditorBlock. */
|
|
14
18
|
export declare function hmBlockToEditorBlock(block: HMBlock): EditorBlock;
|
package/dist/index.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
serializeBlockRange,
|
|
18
18
|
toNumber,
|
|
19
19
|
unpackHmId
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-64F47WK6.mjs";
|
|
21
21
|
|
|
22
22
|
// src/capability.ts
|
|
23
23
|
import { encode as cborEncode2 } from "@ipld/dag-cbor";
|
|
@@ -4098,6 +4098,9 @@ function toHMBlockType(editorBlockType) {
|
|
|
4098
4098
|
if (editorBlockType === "embed") return "Embed";
|
|
4099
4099
|
if (editorBlockType === "web-embed") return "WebEmbed";
|
|
4100
4100
|
if (editorBlockType === "query") return "Query";
|
|
4101
|
+
if (editorBlockType === "table") return "Table";
|
|
4102
|
+
if (editorBlockType === "tableRow") return "TableRow";
|
|
4103
|
+
if (editorBlockType === "tableColumn") return "TableColumn";
|
|
4101
4104
|
return void 0;
|
|
4102
4105
|
}
|
|
4103
4106
|
function toImageWidthNumber(width) {
|
|
@@ -4277,6 +4280,30 @@ function editorBlockToHMBlock(editorBlock) {
|
|
|
4277
4280
|
if (editorBlock.props.url) blockEmbed.link = editorBlock.props.url;
|
|
4278
4281
|
if (editorBlock.props.view) blockEmbed.attributes.view = editorBlock.props.view;
|
|
4279
4282
|
}
|
|
4283
|
+
const blockParagraph = block.type === "Paragraph" ? block : void 0;
|
|
4284
|
+
if (blockParagraph && editorBlock.type == "paragraph") {
|
|
4285
|
+
if (editorBlock.props.columnId) {
|
|
4286
|
+
blockParagraph.attributes.columnId = editorBlock.props.columnId;
|
|
4287
|
+
}
|
|
4288
|
+
}
|
|
4289
|
+
const blockTable = block.type === "Table" ? block : void 0;
|
|
4290
|
+
if (blockTable && editorBlock.type == "table") {
|
|
4291
|
+
blockTable.text = "";
|
|
4292
|
+
}
|
|
4293
|
+
const blockTableRow = block.type === "TableRow" ? block : void 0;
|
|
4294
|
+
if (blockTableRow && editorBlock.type == "tableRow") {
|
|
4295
|
+
blockTableRow.text = "";
|
|
4296
|
+
if (editorBlock.props.isHeader) blockTableRow.attributes.isHeader = true;
|
|
4297
|
+
}
|
|
4298
|
+
const blockTableColumn = block.type === "TableColumn" ? block : void 0;
|
|
4299
|
+
if (blockTableColumn && editorBlock.type == "tableColumn") {
|
|
4300
|
+
blockTableColumn.text = "";
|
|
4301
|
+
if (editorBlock.props.width != null && editorBlock.props.width !== "") {
|
|
4302
|
+
const width = toNumber(editorBlock.props.width);
|
|
4303
|
+
if (width) blockTableColumn.attributes.width = width;
|
|
4304
|
+
}
|
|
4305
|
+
if (editorBlock.props.isHeader) blockTableColumn.attributes.isHeader = true;
|
|
4306
|
+
}
|
|
4280
4307
|
const blockQuery = block.type === "Query" ? block : void 0;
|
|
4281
4308
|
if (blockQuery && editorBlock.type == "query") {
|
|
4282
4309
|
blockQuery.attributes.style = editorBlock.props.style;
|
|
@@ -4299,16 +4326,34 @@ function editorBlockToHMBlock(editorBlock) {
|
|
|
4299
4326
|
console.error("Failed to validate block for writing", block, failedParse.error);
|
|
4300
4327
|
throw new Error("Failed to validate block for writing " + JSON.stringify(failedParse.error));
|
|
4301
4328
|
}
|
|
4302
|
-
function editorBlocksToHMBlockNodes(editorBlocks) {
|
|
4303
|
-
|
|
4304
|
-
|
|
4329
|
+
function editorBlocksToHMBlockNodes(editorBlocks, parentEditorType) {
|
|
4330
|
+
const parentIsTable = parentEditorType === "table";
|
|
4331
|
+
let rowIdx = 0;
|
|
4332
|
+
let colIdx = 0;
|
|
4333
|
+
return editorBlocks.filter((block) => {
|
|
4334
|
+
if ((block.type === "tableRow" || block.type === "tableColumn") && !parentIsTable) {
|
|
4335
|
+
console.warn(
|
|
4336
|
+
`[editorBlocksToHMBlockNodes] dropping orphan ${block.type} block (parent type: ${parentEditorType ?? "root"})`,
|
|
4337
|
+
block.id
|
|
4338
|
+
);
|
|
4339
|
+
return false;
|
|
4340
|
+
}
|
|
4341
|
+
return true;
|
|
4342
|
+
}).map((block) => {
|
|
4343
|
+
var _a, _b, _c;
|
|
4344
|
+
let positionIdx;
|
|
4345
|
+
if (parentIsTable) {
|
|
4346
|
+
if (block.type === "tableRow") positionIdx = rowIdx++;
|
|
4347
|
+
else if (block.type === "tableColumn") positionIdx = colIdx++;
|
|
4348
|
+
}
|
|
4349
|
+
let hmNode;
|
|
4305
4350
|
try {
|
|
4306
|
-
|
|
4351
|
+
hmNode = {
|
|
4307
4352
|
block: editorBlockToHMBlock(block),
|
|
4308
|
-
children: ((_a = block.children) == null ? void 0 : _a.length) ? editorBlocksToHMBlockNodes(block.children) : void 0
|
|
4353
|
+
children: ((_a = block.children) == null ? void 0 : _a.length) ? editorBlocksToHMBlockNodes(block.children, block.type) : void 0
|
|
4309
4354
|
};
|
|
4310
4355
|
} catch {
|
|
4311
|
-
|
|
4356
|
+
hmNode = {
|
|
4312
4357
|
block: {
|
|
4313
4358
|
id: block.id || "unknown",
|
|
4314
4359
|
type: "Paragraph",
|
|
@@ -4316,9 +4361,16 @@ function editorBlocksToHMBlockNodes(editorBlocks) {
|
|
|
4316
4361
|
annotations: [],
|
|
4317
4362
|
attributes: {}
|
|
4318
4363
|
},
|
|
4319
|
-
children: ((_b = block.children) == null ? void 0 : _b.length) ? editorBlocksToHMBlockNodes(block.children) : void 0
|
|
4364
|
+
children: ((_b = block.children) == null ? void 0 : _b.length) ? editorBlocksToHMBlockNodes(block.children, block.type) : void 0
|
|
4320
4365
|
};
|
|
4321
4366
|
}
|
|
4367
|
+
if (positionIdx !== void 0 && positionIdx > 0) {
|
|
4368
|
+
const attrs = (_c = hmNode.block) == null ? void 0 : _c.attributes;
|
|
4369
|
+
if (attrs && "isHeader" in attrs) {
|
|
4370
|
+
delete attrs.isHeader;
|
|
4371
|
+
}
|
|
4372
|
+
}
|
|
4373
|
+
return hmNode;
|
|
4322
4374
|
}).filter(Boolean);
|
|
4323
4375
|
}
|
|
4324
4376
|
function flattenLeaves(content) {
|
|
@@ -4374,28 +4426,58 @@ function toEditorBlockType(hmBlockType) {
|
|
|
4374
4426
|
if (hmBlockType === "Embed") return "embed";
|
|
4375
4427
|
if (hmBlockType === "WebEmbed") return "web-embed";
|
|
4376
4428
|
if (hmBlockType === "Query") return "query";
|
|
4429
|
+
if (hmBlockType === "Table") return "table";
|
|
4430
|
+
if (hmBlockType === "TableRow") return "tableRow";
|
|
4431
|
+
if (hmBlockType === "TableColumn") return "tableColumn";
|
|
4377
4432
|
return "unknown";
|
|
4378
4433
|
}
|
|
4379
4434
|
function hmBlocksToEditorContent(blocks, opts = { level: 1 }) {
|
|
4380
4435
|
const childRecursiveOpts = {
|
|
4381
4436
|
level: opts.level || 0
|
|
4382
4437
|
};
|
|
4383
|
-
|
|
4384
|
-
|
|
4438
|
+
const parentIsTable = opts.parentType === "Table";
|
|
4439
|
+
let rowIdx = 0;
|
|
4440
|
+
let colIdx = 0;
|
|
4441
|
+
return blocks.filter((hmBlock) => {
|
|
4442
|
+
var _a, _b;
|
|
4443
|
+
const t = (_a = hmBlock.block) == null ? void 0 : _a.type;
|
|
4444
|
+
if ((t === "TableRow" || t === "TableColumn") && !parentIsTable) {
|
|
4445
|
+
console.warn(
|
|
4446
|
+
`[hmBlocksToEditorContent] dropping orphan ${t} block (parent type: ${opts.parentType ?? "root"})`,
|
|
4447
|
+
(_b = hmBlock.block) == null ? void 0 : _b.id
|
|
4448
|
+
);
|
|
4449
|
+
return false;
|
|
4450
|
+
}
|
|
4451
|
+
return true;
|
|
4452
|
+
}).map((hmBlock) => {
|
|
4453
|
+
var _a, _b, _c, _d, _e;
|
|
4454
|
+
let positionIdx;
|
|
4455
|
+
if (parentIsTable) {
|
|
4456
|
+
const t = (_a = hmBlock.block) == null ? void 0 : _a.type;
|
|
4457
|
+
if (t === "TableRow") positionIdx = rowIdx++;
|
|
4458
|
+
else if (t === "TableColumn") positionIdx = colIdx++;
|
|
4459
|
+
}
|
|
4385
4460
|
let res = hmBlock.block ? hmBlockToEditorBlock(hmBlock.block) : null;
|
|
4386
|
-
if (res &&
|
|
4387
|
-
const
|
|
4461
|
+
if (res && positionIdx !== void 0 && positionIdx > 0) {
|
|
4462
|
+
const props = res.props;
|
|
4463
|
+
if (props && "isHeader" in props) {
|
|
4464
|
+
delete props.isHeader;
|
|
4465
|
+
}
|
|
4466
|
+
}
|
|
4467
|
+
if (res && ((_b = hmBlock.children) == null ? void 0 : _b.length)) {
|
|
4468
|
+
const childrenType = (_d = ((_c = hmBlock.block) == null ? void 0 : _c.attributes) || {}) == null ? void 0 : _d.childrenType;
|
|
4388
4469
|
const validChildrenType = childrenType === "Group" || childrenType === "Ordered" || childrenType === "Unordered" || childrenType === "Blockquote" || childrenType === "Grid" ? childrenType : "Group";
|
|
4389
4470
|
res.children = hmBlocksToEditorContent(hmBlock.children, {
|
|
4390
4471
|
level: childRecursiveOpts.level ? childRecursiveOpts.level + 1 : 1,
|
|
4391
|
-
childrenType: validChildrenType
|
|
4472
|
+
childrenType: validChildrenType,
|
|
4473
|
+
parentType: (_e = hmBlock.block) == null ? void 0 : _e.type
|
|
4392
4474
|
});
|
|
4393
4475
|
}
|
|
4394
4476
|
return res;
|
|
4395
4477
|
}).filter((block) => block !== null);
|
|
4396
4478
|
}
|
|
4397
4479
|
function hmBlockToEditorBlock(block) {
|
|
4398
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
4480
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
4399
4481
|
const blockType = toEditorBlockType(block.type);
|
|
4400
4482
|
if (blockType === "unknown") {
|
|
4401
4483
|
return {
|
|
@@ -4458,14 +4540,40 @@ function hmBlockToEditorBlock(block) {
|
|
|
4458
4540
|
});
|
|
4459
4541
|
}
|
|
4460
4542
|
}
|
|
4543
|
+
if (block.type === "Paragraph") {
|
|
4544
|
+
const columnId = (_a = block.attributes) == null ? void 0 : _a.columnId;
|
|
4545
|
+
if (typeof columnId === "string" && columnId) {
|
|
4546
|
+
;
|
|
4547
|
+
out.props.columnId = columnId;
|
|
4548
|
+
}
|
|
4549
|
+
}
|
|
4550
|
+
if (block.type === "TableColumn") {
|
|
4551
|
+
const width = (_b = block.attributes) == null ? void 0 : _b.width;
|
|
4552
|
+
if (typeof width === "number") {
|
|
4553
|
+
;
|
|
4554
|
+
out.props.width = String(width);
|
|
4555
|
+
}
|
|
4556
|
+
const isHeader = (_c = block.attributes) == null ? void 0 : _c.isHeader;
|
|
4557
|
+
if (isHeader === true) {
|
|
4558
|
+
;
|
|
4559
|
+
out.props.isHeader = true;
|
|
4560
|
+
}
|
|
4561
|
+
}
|
|
4562
|
+
if (block.type === "TableRow") {
|
|
4563
|
+
const isHeader = (_d = block.attributes) == null ? void 0 : _d.isHeader;
|
|
4564
|
+
if (isHeader === true) {
|
|
4565
|
+
;
|
|
4566
|
+
out.props.isHeader = true;
|
|
4567
|
+
}
|
|
4568
|
+
}
|
|
4461
4569
|
if (block.type === "Query") {
|
|
4462
4570
|
const queryProps = out.props;
|
|
4463
|
-
queryProps.style = (
|
|
4464
|
-
queryProps.columnCount = String(((
|
|
4465
|
-
queryProps.queryIncludes = JSON.stringify(((
|
|
4466
|
-
queryProps.querySort = JSON.stringify(((
|
|
4467
|
-
queryProps.banner = ((
|
|
4468
|
-
queryProps.queryLimit = String(((
|
|
4571
|
+
queryProps.style = (_e = block.attributes) == null ? void 0 : _e.style;
|
|
4572
|
+
queryProps.columnCount = String(((_f = block.attributes) == null ? void 0 : _f.columnCount) || "");
|
|
4573
|
+
queryProps.queryIncludes = JSON.stringify(((_h = (_g = block.attributes) == null ? void 0 : _g.query) == null ? void 0 : _h.includes) || []);
|
|
4574
|
+
queryProps.querySort = JSON.stringify(((_j = (_i = block.attributes) == null ? void 0 : _i.query) == null ? void 0 : _j.sort) || {});
|
|
4575
|
+
queryProps.banner = ((_k = block.attributes) == null ? void 0 : _k.banner) ? "true" : "false";
|
|
4576
|
+
queryProps.queryLimit = String(((_m = (_l = block.attributes) == null ? void 0 : _l.query) == null ? void 0 : _m.limit) || "");
|
|
4469
4577
|
}
|
|
4470
4578
|
const blockText = block.text || "";
|
|
4471
4579
|
const leaves = out.content;
|