@note3/utils 0.0.20 → 0.0.21
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-K5PSO7Y4.min.js +78 -0
- package/dist/chunk-K5PSO7Y4.min.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/tree-builder.d.ts +114 -0
- package/dist/tree-builder.d.ts.map +1 -0
- package/dist/tree-builder.min.js +2 -0
- package/dist/tree-builder.min.js.map +1 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from './map';
|
|
|
3
3
|
export * from './note3-regex-constants';
|
|
4
4
|
export * from './note3-utils-nodeps';
|
|
5
5
|
export * from './queries';
|
|
6
|
+
export * from './tree-builder';
|
|
6
7
|
export * from './types';
|
|
7
8
|
export * from './relation-ordering';
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,OAAO,CAAA;AACrB,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,qBAAqB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,OAAO,CAAA;AACrB,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA;AACvB,cAAc,qBAAqB,CAAA"}
|
package/dist/index.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./chunk-KHOUPFOL.min.js";import{a as o,b as r,c as e,d as f,e as m}from"./chunk-PA6WBVCJ.min.js";import{a as p}from"./chunk-IFY2JCCQ.min.js";import{a as H,b as I,c as J,d as K,e as L,f as M,g as N}from"./chunk-44UQ54GR.min.js";import{a as u,b as v,c as w,d as y,e as z,f as A,g as B,h as C,i as D,j as E,k as F}from"./chunk-LDNVHZO7.min.js";import{a as t,b as x,c as a,d as b,e as c,f as d,g,h,i,j,k,l,m as n,n as q,o as s}from"./chunk-POX3PUJK.min.js";import{a as G}from"./chunk-KY36PVHK.min.js";import"./chunk-MXMMU6NF.min.js";export{i as RE_ANY_TAG_ONLY,s as RE_ANY_TAG_WITHCONTEXT,h as RE_AT_TAG_ONLY,q as RE_AT_TAG_WITHCONTEXT,d as RE_HASH_TAG_ONLY,l as RE_HASH_TAG_WITHCONTEXT,g as RE_PLUS_TAG_ONLY,n as RE_PLUS_TAG_WITHCONTEXT,c as RE_TAG_BODY,a as RE_TAG_BODY_CHAR,b as RE_TAG_BODY_REQUIRED_CHAR,k as RE_TAG_CONTEXT_POST,j as RE_TAG_CONTEXT_PRE,p as SetMap,x as TAG_MIN_LENGTH,t as TIPTAP_EMPTY,e as asyncIterableToArray,f as blobToAsyncIterable,F as contentVlToPlaintext,E as getAllTagsInText,H as getChildIDs,J as getChildRelations,L as getContent,M as getContentText,I as getParentIDs,K as getParentRelations,N as getRootIDs,o as lazyVal,G as orderRelations,v as parseBlockContentValue,B as plainContentMatchAnyTag,A as plainContentMatchAtTag,y as plainContentMatchHashTag,z as plainContentMatchPlusTag,C as plainContentMatchTagGeneric,u as plaintextStringToTiptap,r as racePromises,D as rawContentMatchTag,m as recurseWithLoopProtection,w as tiptapToPlaintext};
|
|
1
|
+
import{a as O,b as P,c as Q,d as R,e as S}from"./chunk-K5PSO7Y4.min.js";import"./chunk-KHOUPFOL.min.js";import{a as o,b as r,c as e,d as f,e as m}from"./chunk-PA6WBVCJ.min.js";import{a as p}from"./chunk-IFY2JCCQ.min.js";import{a as H,b as I,c as J,d as K,e as L,f as M,g as N}from"./chunk-44UQ54GR.min.js";import{a as u,b as v,c as w,d as y,e as z,f as A,g as B,h as C,i as D,j as E,k as F}from"./chunk-LDNVHZO7.min.js";import{a as t,b as x,c as a,d as b,e as c,f as d,g,h,i,j,k,l,m as n,n as q,o as s}from"./chunk-POX3PUJK.min.js";import{a as G}from"./chunk-KY36PVHK.min.js";import"./chunk-MXMMU6NF.min.js";export{i as RE_ANY_TAG_ONLY,s as RE_ANY_TAG_WITHCONTEXT,h as RE_AT_TAG_ONLY,q as RE_AT_TAG_WITHCONTEXT,d as RE_HASH_TAG_ONLY,l as RE_HASH_TAG_WITHCONTEXT,g as RE_PLUS_TAG_ONLY,n as RE_PLUS_TAG_WITHCONTEXT,c as RE_TAG_BODY,a as RE_TAG_BODY_CHAR,b as RE_TAG_BODY_REQUIRED_CHAR,k as RE_TAG_CONTEXT_POST,j as RE_TAG_CONTEXT_PRE,p as SetMap,x as TAG_MIN_LENGTH,t as TIPTAP_EMPTY,e as asyncIterableToArray,f as blobToAsyncIterable,F as contentVlToPlaintext,O as createBlockApplogs,P as createRelationApplogs,Q as createSingleNodeApplogs,S as createSingleTree,R as createTreeApplogs,E as getAllTagsInText,H as getChildIDs,J as getChildRelations,L as getContent,M as getContentText,I as getParentIDs,K as getParentRelations,N as getRootIDs,o as lazyVal,G as orderRelations,v as parseBlockContentValue,B as plainContentMatchAnyTag,A as plainContentMatchAtTag,y as plainContentMatchHashTag,z as plainContentMatchPlusTag,C as plainContentMatchTagGeneric,u as plaintextStringToTiptap,r as racePromises,D as rawContentMatchTag,m as recurseWithLoopProtection,w as tiptapToPlaintext};
|
|
2
2
|
//# sourceMappingURL=index.min.js.map
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { ApplogForInsertOptionalAgent, EntityID } from '@wovin/core/applog';
|
|
2
|
+
import type { TiptapContent } from './note3-utils-nodeps';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a single node in a tree structure.
|
|
5
|
+
* Content can be a string or a Tiptap JSON object.
|
|
6
|
+
* Children are optional and can be recursively nested.
|
|
7
|
+
*/
|
|
8
|
+
export interface TreeNode {
|
|
9
|
+
/** Content as string or Tiptap object (auto-serialized) */
|
|
10
|
+
content: string | TiptapContent;
|
|
11
|
+
/** Optional child nodes */
|
|
12
|
+
children?: TreeNode[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Result of creating a single node with its applogs
|
|
16
|
+
*/
|
|
17
|
+
export interface NodeCreationResult {
|
|
18
|
+
blockID: EntityID;
|
|
19
|
+
applogs: ApplogForInsertOptionalAgent[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Result of creating a tree with applogs
|
|
23
|
+
*/
|
|
24
|
+
export interface TreeCreationResult {
|
|
25
|
+
rootIDs: EntityID[];
|
|
26
|
+
applogs: ApplogForInsertOptionalAgent[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Creates block applogs for a single piece of content.
|
|
30
|
+
* Generates an entity ID using getHashID.
|
|
31
|
+
*
|
|
32
|
+
* @param content - String or TiptapContent object
|
|
33
|
+
* @param entityID - Optional pre-computed entity ID
|
|
34
|
+
* @returns Object with generated entityID and applogs array
|
|
35
|
+
*/
|
|
36
|
+
export declare function createBlockApplogs(content: string | TiptapContent, entityID?: EntityID): {
|
|
37
|
+
en: EntityID;
|
|
38
|
+
applogs: ApplogForInsertOptionalAgent[];
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Creates relation applogs that connect a block as a child of a parent.
|
|
42
|
+
* Generates three applogs: one for the block reference, one for the parent reference,
|
|
43
|
+
* and one for the sibling ordering (after).
|
|
44
|
+
*
|
|
45
|
+
* @param blockID - The ID of the child block
|
|
46
|
+
* @param childOf - The ID of the parent block
|
|
47
|
+
* @param after - The ID of the previous sibling (or null if first child)
|
|
48
|
+
* @param relationID - Optional pre-computed relation entity ID
|
|
49
|
+
* @returns Object with relation entity ID and applogs array
|
|
50
|
+
*/
|
|
51
|
+
export declare function createRelationApplogs(blockID: EntityID, childOf: EntityID, after: EntityID | null, relationID?: EntityID): {
|
|
52
|
+
en: EntityID;
|
|
53
|
+
applogs: ApplogForInsertOptionalAgent[];
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Recursively creates applogs for a single node and its children.
|
|
57
|
+
* Maintains proper sibling ordering using the 'after' field.
|
|
58
|
+
*
|
|
59
|
+
* @param node - The node to create
|
|
60
|
+
* @param parentID - Optional parent block ID. If provided, creates a relation to parent.
|
|
61
|
+
* @param after - Optional previous sibling ID for proper ordering
|
|
62
|
+
* @returns Object with block ID and flattened applogs array
|
|
63
|
+
*/
|
|
64
|
+
export declare function createSingleNodeApplogs(node: TreeNode, parentID?: EntityID, after?: EntityID | null): NodeCreationResult;
|
|
65
|
+
/**
|
|
66
|
+
* Creates applogs for multiple root nodes (nodes without a parent).
|
|
67
|
+
* All nodes are created as standalone roots.
|
|
68
|
+
*
|
|
69
|
+
* @param nodes - Array of root nodes
|
|
70
|
+
* @returns Object with array of root IDs and flattened applogs
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* const nodes: TreeNode[] = [
|
|
74
|
+
* { content: 'Root 1', children: [{ content: 'Child 1' }] },
|
|
75
|
+
* { content: 'Root 2' }
|
|
76
|
+
* ]
|
|
77
|
+
* const { rootIDs, applogs } = createTreeApplogs(nodes)
|
|
78
|
+
*/
|
|
79
|
+
export declare function createTreeApplogs(nodes: TreeNode[]): TreeCreationResult;
|
|
80
|
+
/**
|
|
81
|
+
* Creates applogs for multiple nodes as children of a parent.
|
|
82
|
+
* All nodes are created as children of the specified parent.
|
|
83
|
+
*
|
|
84
|
+
* @param nodes - Array of nodes
|
|
85
|
+
* @param parentID - Parent block ID. Nodes will be created as children of this parent.
|
|
86
|
+
* @returns Object with array of created block IDs and flattened applogs
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* const subtree: TreeNode[] = [
|
|
90
|
+
* { content: 'Child 1' },
|
|
91
|
+
* { content: 'Child 2' }
|
|
92
|
+
* ]
|
|
93
|
+
* const { rootIDs, applogs } = createTreeApplogs(subtree, 'existingParentID')
|
|
94
|
+
*/
|
|
95
|
+
export declare function createTreeApplogs(nodes: TreeNode[], parentID: EntityID): TreeCreationResult;
|
|
96
|
+
/**
|
|
97
|
+
* Creates applogs for a single root node with its descendants.
|
|
98
|
+
* Convenience function that returns just the root block ID instead of an array.
|
|
99
|
+
*
|
|
100
|
+
* @param root - The root node
|
|
101
|
+
* @returns Object with root block ID and applogs
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* const node: TreeNode = {
|
|
105
|
+
* content: 'Parent',
|
|
106
|
+
* children: [
|
|
107
|
+
* { content: 'Child 1' },
|
|
108
|
+
* { content: 'Child 2' }
|
|
109
|
+
* ]
|
|
110
|
+
* }
|
|
111
|
+
* const { blockID, applogs } = createSingleTree(node)
|
|
112
|
+
*/
|
|
113
|
+
export declare function createSingleTree(root: TreeNode): NodeCreationResult;
|
|
114
|
+
//# sourceMappingURL=tree-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-builder.d.ts","sourceRoot":"","sources":["../src/tree-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAEhF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEzD;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACxB,2DAA2D;IAC3D,OAAO,EAAE,MAAM,GAAG,aAAa,CAAA;IAC/B,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAA;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,OAAO,EAAE,QAAQ,CAAA;IACjB,OAAO,EAAE,4BAA4B,EAAE,CAAA;CACvC;AAED;;GAE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0.0.
|
|
3
|
+
"version": "0.0.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "./dist/index.min.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"bundle": false
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@wovin/core": "0.0.
|
|
30
|
+
"@wovin/core": "0.0.21",
|
|
31
31
|
"besonders-logger": "1.0.2",
|
|
32
32
|
"comlink": "^4.4.2",
|
|
33
33
|
"core-js": "^3.45.1",
|