@seed-hypermedia/client 0.0.64 → 0.0.66
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-VWCXRMDI.mjs → chunk-SQEUO7FO.mjs} +42 -5
- package/dist/editor-types.d.ts +2 -1
- package/dist/hm-types.d.ts +316 -66
- package/dist/hm-types.mjs +3 -1
- package/dist/index.mjs +13 -6
- package/package.json +1 -1
package/dist/hm-types.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
BlockRangeSchema,
|
|
5
5
|
BoldAnnotationSchema,
|
|
6
6
|
CodeAnnotationSchema,
|
|
7
|
+
DOCUMENT_ATTRIBUTE_DESCRIPTIONS,
|
|
7
8
|
HMAccountContactsRequestSchema,
|
|
8
9
|
HMAccountNotFoundSchema,
|
|
9
10
|
HMAccountPayloadSchema,
|
|
@@ -184,7 +185,7 @@ import {
|
|
|
184
185
|
toNumber,
|
|
185
186
|
unpackHmId,
|
|
186
187
|
unpackedHmIdSchema
|
|
187
|
-
} from "./chunk-
|
|
188
|
+
} from "./chunk-SQEUO7FO.mjs";
|
|
188
189
|
import "./chunk-7P6ASYW6.mjs";
|
|
189
190
|
export {
|
|
190
191
|
BUILTIN_METADATA_KEYS,
|
|
@@ -192,6 +193,7 @@ export {
|
|
|
192
193
|
BlockRangeSchema,
|
|
193
194
|
BoldAnnotationSchema,
|
|
194
195
|
CodeAnnotationSchema,
|
|
196
|
+
DOCUMENT_ATTRIBUTE_DESCRIPTIONS,
|
|
195
197
|
HMAccountContactsRequestSchema,
|
|
196
198
|
HMAccountNotFoundSchema,
|
|
197
199
|
HMAccountPayloadSchema,
|
package/dist/index.mjs
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
serializeBlockRange,
|
|
17
17
|
toNumber,
|
|
18
18
|
unpackHmId
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-SQEUO7FO.mjs";
|
|
20
20
|
import {
|
|
21
21
|
DEFAULT_PARAMS,
|
|
22
22
|
decode,
|
|
@@ -4127,6 +4127,7 @@ function toImageWidthNumber(width) {
|
|
|
4127
4127
|
const percentage = Number(width.trim().slice(0, -1));
|
|
4128
4128
|
return Number.isFinite(percentage) && percentage > 0 ? percentage : null;
|
|
4129
4129
|
}
|
|
4130
|
+
if (width == null || width === "") return null;
|
|
4130
4131
|
return toNumber(width);
|
|
4131
4132
|
}
|
|
4132
4133
|
function unknownEditorBlockToHMBlock(editorBlock) {
|
|
@@ -4256,8 +4257,10 @@ function editorBlockToHMBlock(editorBlock) {
|
|
|
4256
4257
|
} else if (editorBlock.props.mediaRef) {
|
|
4257
4258
|
blockVideo.link = "";
|
|
4258
4259
|
}
|
|
4259
|
-
|
|
4260
|
-
|
|
4260
|
+
if (editorBlock.props.width != null && editorBlock.props.width !== "") {
|
|
4261
|
+
const width = toNumber(editorBlock.props.width);
|
|
4262
|
+
if (width) blockVideo.attributes.width = width;
|
|
4263
|
+
}
|
|
4261
4264
|
if (editorBlock.props.name) {
|
|
4262
4265
|
blockVideo.attributes.name = editorBlock.props.name;
|
|
4263
4266
|
}
|
|
@@ -4279,8 +4282,10 @@ function editorBlockToHMBlock(editorBlock) {
|
|
|
4279
4282
|
blockFile.link = "";
|
|
4280
4283
|
}
|
|
4281
4284
|
if (editorBlock.props.name) blockFile.attributes.name = editorBlock.props.name;
|
|
4282
|
-
|
|
4283
|
-
|
|
4285
|
+
if (editorBlock.props.size != null && editorBlock.props.size !== "") {
|
|
4286
|
+
const size = toNumber(editorBlock.props.size);
|
|
4287
|
+
if (size) blockFile.attributes.size = size;
|
|
4288
|
+
}
|
|
4284
4289
|
}
|
|
4285
4290
|
const blockButton = block.type === "Button" ? block : void 0;
|
|
4286
4291
|
if (blockButton && editorBlock.type == "button") {
|
|
@@ -4336,6 +4341,7 @@ function editorBlockToHMBlock(editorBlock) {
|
|
|
4336
4341
|
if (editorBlock.props.queryLimit) query.limit = Number(editorBlock.props.queryLimit);
|
|
4337
4342
|
blockQuery.attributes.query = query;
|
|
4338
4343
|
blockQuery.attributes.banner = editorBlock.props.banner == "true";
|
|
4344
|
+
if (editorBlock.props.tableConfig) blockQuery.attributes.table = JSON.parse(editorBlock.props.tableConfig);
|
|
4339
4345
|
}
|
|
4340
4346
|
const blockParse = HMBlockSchema.safeParse(block);
|
|
4341
4347
|
if (blockParse.success) {
|
|
@@ -4496,7 +4502,7 @@ function hmBlocksToEditorContent(blocks, opts = { level: 1 }) {
|
|
|
4496
4502
|
}).filter((block) => block !== null);
|
|
4497
4503
|
}
|
|
4498
4504
|
function hmBlockToEditorBlock(block) {
|
|
4499
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
4505
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
4500
4506
|
const blockType = toEditorBlockType(block.type);
|
|
4501
4507
|
if (blockType === "unknown") {
|
|
4502
4508
|
return {
|
|
@@ -4593,6 +4599,7 @@ function hmBlockToEditorBlock(block) {
|
|
|
4593
4599
|
queryProps.querySort = JSON.stringify(((_j = (_i = block.attributes) == null ? void 0 : _i.query) == null ? void 0 : _j.sort) || {});
|
|
4594
4600
|
queryProps.banner = ((_k = block.attributes) == null ? void 0 : _k.banner) ? "true" : "false";
|
|
4595
4601
|
queryProps.queryLimit = String(((_m = (_l = block.attributes) == null ? void 0 : _l.query) == null ? void 0 : _m.limit) || "");
|
|
4602
|
+
if ((_n = block.attributes) == null ? void 0 : _n.table) queryProps.tableConfig = JSON.stringify(block.attributes.table);
|
|
4596
4603
|
}
|
|
4597
4604
|
const blockText = block.text || "";
|
|
4598
4605
|
const leaves = out.content;
|