@seed-hypermedia/client 0.0.26 → 0.0.28

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.
@@ -20,6 +20,11 @@ export declare function documentContainsLinkToChild(document: HMDocument, childI
20
20
  /**
21
21
  * Check if a document has a self-referential Query block
22
22
  * (a query to itself that would automatically include children).
23
+ *
24
+ * A query block is self-referential when one of its `query.includes` entries
25
+ * has `space === documentId.uid` AND a path that, after normalization, equals
26
+ * the document's path. Empty `space` or `path` does not count as self — that
27
+ * represents an unconfigured query block, which the editor renders empty.
23
28
  */
24
29
  export declare function documentHasSelfQuery(document: HMDocument, documentId: UnpackedHypermediaId): boolean;
25
30
  /**
@@ -606,7 +606,18 @@ var HMDraftContentSchema = z.object({
606
606
  // EditorBlock validation is handled elsewhere
607
607
  deps: z.array(z.string().min(1)).default([]),
608
608
  navigation: z.array(HMNavigationItemSchema).optional(),
609
- cursorPosition: z.number().optional()
609
+ cursorPosition: z.number().optional(),
610
+ /**
611
+ * Block IDs the local user touched since starting this draft. Used by the
612
+ * auto-rebase classifier to distinguish locally-edited blocks from incoming
613
+ * remote edits. Persisted so reload-after-rebase keeps the touch history.
614
+ */
615
+ mineTouchedIds: z.array(z.string()).optional(),
616
+ /**
617
+ * Snapshot of the published HMBlockNode[] tree at the time the draft was
618
+ * started (or last rebased). Acts as the merge base for three-way diff.
619
+ */
620
+ baseBlocks: z.array(z.any()).optional()
610
621
  });
611
622
  var HMDraftMetaBaseSchema = z.object({
612
623
  id: z.string(),
@@ -12297,6 +12297,17 @@ export declare const HMDraftContentSchema: z.ZodObject<{
12297
12297
  text: string;
12298
12298
  }>, "many">>;
12299
12299
  cursorPosition: z.ZodOptional<z.ZodNumber>;
12300
+ /**
12301
+ * Block IDs the local user touched since starting this draft. Used by the
12302
+ * auto-rebase classifier to distinguish locally-edited blocks from incoming
12303
+ * remote edits. Persisted so reload-after-rebase keeps the touch history.
12304
+ */
12305
+ mineTouchedIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
12306
+ /**
12307
+ * Snapshot of the published HMBlockNode[] tree at the time the draft was
12308
+ * started (or last rebased). Acts as the merge base for three-way diff.
12309
+ */
12310
+ baseBlocks: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
12300
12311
  }, "strip", z.ZodTypeAny, {
12301
12312
  content: any[];
12302
12313
  deps: string[];
@@ -12307,6 +12318,8 @@ export declare const HMDraftContentSchema: z.ZodObject<{
12307
12318
  text: string;
12308
12319
  }[] | undefined;
12309
12320
  cursorPosition?: number | undefined;
12321
+ mineTouchedIds?: string[] | undefined;
12322
+ baseBlocks?: any[] | undefined;
12310
12323
  }, {
12311
12324
  content: any[];
12312
12325
  deps?: string[] | undefined;
@@ -12317,6 +12330,8 @@ export declare const HMDraftContentSchema: z.ZodObject<{
12317
12330
  text: string;
12318
12331
  }[] | undefined;
12319
12332
  cursorPosition?: number | undefined;
12333
+ mineTouchedIds?: string[] | undefined;
12334
+ baseBlocks?: any[] | undefined;
12320
12335
  }>;
12321
12336
  export type HMDraftContent = z.infer<typeof HMDraftContentSchema>;
12322
12337
  export declare const HMDraftMetaSchema: z.ZodEffects<z.ZodObject<{
package/dist/hm-types.mjs CHANGED
@@ -165,7 +165,7 @@ import {
165
165
  toNumber,
166
166
  unpackHmId,
167
167
  unpackedHmIdSchema
168
- } from "./chunk-GBZ545NB.mjs";
168
+ } from "./chunk-F2YINBVV.mjs";
169
169
  export {
170
170
  BlockRangeSchema,
171
171
  BoldAnnotationSchema,
package/dist/index.mjs CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  serializeBlockRange,
18
18
  toNumber,
19
19
  unpackHmId
20
- } from "./chunk-GBZ545NB.mjs";
20
+ } from "./chunk-F2YINBVV.mjs";
21
21
 
22
22
  // src/capability.ts
23
23
  import { encode as cborEncode2 } from "@ipld/dag-cbor";
@@ -3279,21 +3279,19 @@ function documentContainsLinkToChild(document, childId) {
3279
3279
  return searchBlocks(document.content || []);
3280
3280
  }
3281
3281
  function documentHasSelfQuery(document, documentId) {
3282
- var _a;
3283
- const documentPathWithSlash = hmIdPathToEntityQueryPath(documentId.path);
3284
- const documentPathWithoutSlash = ((_a = documentId.path) == null ? void 0 : _a.join("/")) || "";
3282
+ const parentPathStr = (documentId.path || []).join("/");
3283
+ function isSelfMatch(include) {
3284
+ if (!include) return false;
3285
+ if (include.space !== documentId.uid) return false;
3286
+ const includePath = entityQueryPathToHmIdPath(include.path);
3287
+ return (includePath || []).join("/") === parentPathStr;
3288
+ }
3285
3289
  function searchBlocks(nodes) {
3286
- var _a2;
3290
+ var _a, _b;
3287
3291
  for (const node of nodes) {
3288
3292
  if (node.block.type === "Query") {
3289
- const query = (_a2 = node.block.attributes) == null ? void 0 : _a2.query;
3290
- if (query == null ? void 0 : query.includes) {
3291
- for (const inc of query.includes) {
3292
- const isSpaceMatch = !inc.space || inc.space === documentId.uid;
3293
- const isPathMatch = !inc.path || inc.path === documentPathWithSlash || inc.path === documentPathWithoutSlash;
3294
- if (isSpaceMatch && isPathMatch) return true;
3295
- }
3296
- }
3293
+ const includes = (_b = (_a = node.block.attributes) == null ? void 0 : _a.query) == null ? void 0 : _b.includes;
3294
+ if (includes == null ? void 0 : includes.some(isSelfMatch)) return true;
3297
3295
  }
3298
3296
  if (node.children && searchBlocks(node.children)) return true;
3299
3297
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seed-hypermedia/client",
3
- "version": "0.0.26",
3
+ "version": "0.0.28",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/seed-hypermedia/seed",