@automerge/automerge
Advanced tools
Comparing version 2.1.11-richtext-alpha.1 to 2.1.11
@@ -209,82 +209,2 @@ /** | ||
} | ||
export function spans(doc, path) { | ||
const state = _state(doc, false); | ||
const objPath = absoluteObjPath(doc, path, "spans"); | ||
try { | ||
return state.handle.spans(objPath, state.heads); | ||
} | ||
catch (e) { | ||
throw new RangeError(`Cannot splice: ${e}`); | ||
} | ||
} | ||
export function block(doc, path, index) { | ||
const objPath = absoluteObjPath(doc, path, "splitBlock"); | ||
const state = _state(doc, false); | ||
index = cursorToIndex(state, objPath, index); | ||
try { | ||
return state.handle.getBlock(objPath, index); | ||
} | ||
catch (e) { | ||
throw new RangeError(`Cannot get block: ${e}`); | ||
} | ||
} | ||
export function splitBlock(doc, path, index, block) { | ||
if (!_is_proxy(doc)) { | ||
throw new RangeError("object cannot be modified outside of a change block"); | ||
} | ||
const objPath = absoluteObjPath(doc, path, "splitBlock"); | ||
const state = _state(doc, false); | ||
_clear_cache(doc); | ||
index = cursorToIndex(state, objPath, index); | ||
try { | ||
state.handle.splitBlock(objPath, index, block); | ||
} | ||
catch (e) { | ||
throw new RangeError(`Cannot splice: ${e}`); | ||
} | ||
} | ||
export function joinBlock(doc, path, index) { | ||
if (!_is_proxy(doc)) { | ||
throw new RangeError("object cannot be modified outside of a change block"); | ||
} | ||
const objPath = absoluteObjPath(doc, path, "joinBlock"); | ||
const state = _state(doc, false); | ||
_clear_cache(doc); | ||
index = cursorToIndex(state, objPath, index); | ||
try { | ||
state.handle.joinBlock(objPath, index); | ||
} | ||
catch (e) { | ||
throw new RangeError(`Cannot joinBlock: ${e}`); | ||
} | ||
} | ||
export function updateBlock(doc, path, index, block) { | ||
if (!_is_proxy(doc)) { | ||
throw new RangeError("object cannot be modified outside of a change block"); | ||
} | ||
const objPath = absoluteObjPath(doc, path, "updateBlock"); | ||
const state = _state(doc, false); | ||
_clear_cache(doc); | ||
index = cursorToIndex(state, objPath, index); | ||
try { | ||
state.handle.updateBlock(objPath, index, block); | ||
} | ||
catch (e) { | ||
throw new RangeError(`Cannot updateBlock: ${e}`); | ||
} | ||
} | ||
export function updateBlocks(doc, path, blocks) { | ||
if (!_is_proxy(doc)) { | ||
throw new RangeError("object cannot be modified outside of a change block"); | ||
} | ||
const objPath = absoluteObjPath(doc, path, "updateBlock"); | ||
const state = _state(doc, false); | ||
_clear_cache(doc); | ||
try { | ||
state.handle.updateBlocks(objPath, blocks); | ||
} | ||
catch (e) { | ||
throw new RangeError(`Cannot updateBlock: ${e}`); | ||
} | ||
} | ||
/** | ||
@@ -291,0 +211,0 @@ * Returns a cursor for the given position in a string. |
@@ -166,3 +166,3 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
if (key === STATE) | ||
return { handle: context, textV2: target.textV2 }; | ||
return { handle: context }; | ||
if (!cache[key]) { | ||
@@ -169,0 +169,0 @@ cache[key] = valueAt(target, key); |
@@ -89,12 +89,6 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
if (textV2) { | ||
handle.registerDatatype("str", (n, { context }) => { | ||
if (context === "blockAttr") { | ||
return n; | ||
} | ||
else { | ||
return new RawString(n); | ||
} | ||
}); | ||
handle.registerDatatype("str", (n) => new RawString(n)); | ||
} | ||
else { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
handle.registerDatatype("text", (n) => new Text(n)); | ||
@@ -101,0 +95,0 @@ } |
import { Counter } from "./types.js"; | ||
export { Counter, type Doc, Int, Uint, Float64, type Patch, type MapObjType, type PatchCallback, type Mark, type MarkSet, type MarkRange, type MarkValue, type Cursor, type PatchInfo, type PatchSource, } from "./types.js"; | ||
export { Counter, type Doc, Int, Uint, Float64, type Patch, type PatchCallback, type Mark, type MarkSet, type MarkRange, type MarkValue, type Cursor, type PatchInfo, type PatchSource, } from "./types.js"; | ||
import { RawString } from "./raw_string.js"; | ||
@@ -13,2 +13,1 @@ export { RawString } from "./raw_string.js"; | ||
export type ScalarValue = string | number | null | boolean | Date | Counter | Uint8Array | RawString; | ||
export type BlockAttrValue = string | number | boolean | null | Date | Uint8Array; |
@@ -37,8 +37,7 @@ /** | ||
*/ | ||
export { Counter, type Doc, Int, Uint, Float64, type Patch, type PatchCallback, type Mark, type MarkSet, type MarkRange, type MarkValue, type AutomergeValue, type BlockAttrValue, type ScalarValue, type PatchSource, type PatchInfo, } from "./next_types.js"; | ||
import type { BlockAttrValue, Cursor, Mark, MarkSet, MarkRange, MarkValue } from "./next_types.js"; | ||
export { Counter, type Doc, Int, Uint, Float64, type Patch, type PatchCallback, type Mark, type MarkSet, type MarkRange, type MarkValue, type AutomergeValue, type ScalarValue, type PatchSource, type PatchInfo, } from "./next_types.js"; | ||
import type { Cursor, Mark, MarkSet, MarkRange, MarkValue } from "./next_types.js"; | ||
import { type PatchCallback } from "./stable.js"; | ||
import { type UnstableConflicts as Conflicts } from "./conflicts.js"; | ||
export type { PutPatch, DelPatch, SpliceTextPatch, InsertPatch, IncPatch, SyncMessage, Heads, Cursor, Span, SplitBlockPatch, JoinBlockPatch, UpdateBlockPatch, } from "@automerge/automerge-wasm"; | ||
import { type Span } from "@automerge/automerge-wasm"; | ||
export type { PutPatch, DelPatch, SpliceTextPatch, InsertPatch, IncPatch, SyncMessage, Heads, Cursor, } from "@automerge/automerge-wasm"; | ||
export type { ActorId, Change, ChangeOptions, Prop, DecodedChange, DecodedSyncMessage, ApplyOptions, ChangeFn, ChangeAtResult, MaterializeValue, SyncState, } from "./stable.js"; | ||
@@ -167,32 +166,2 @@ export { view, free, getHeads, change, changeAt, emptyChange, loadIncremental, saveIncremental, save, merge, getActorId, getLastLocalChange, getChanges, getAllChanges, applyChanges, getHistory, equals, encodeSyncState, decodeSyncState, generateSyncMessage, receiveSyncMessage, initSyncState, encodeChange, decodeChange, encodeSyncMessage, decodeSyncMessage, getMissingDeps, dump, toJS, isAutomerge, getObjectId, diff, insertAt, deleteAt, saveSince, } from "./stable.js"; | ||
export declare function updateText(doc: Doc<unknown>, path: stable.Prop[], newText: string): void; | ||
export declare function spans<T>(doc: Doc<T>, path: stable.Prop[]): Span[]; | ||
export declare function block<T>(doc: Doc<T>, path: stable.Prop[], index: number | Cursor): { | ||
type: string; | ||
parents: string[]; | ||
attrs: { | ||
[key: string]: import("@automerge/automerge-wasm").Value; | ||
}; | ||
} | null; | ||
export declare function splitBlock<T>(doc: Doc<T>, path: stable.Prop[], index: number | Cursor, block: { | ||
type: string; | ||
parents: string[]; | ||
attrs: { | ||
[key: string]: BlockAttrValue; | ||
}; | ||
}): void; | ||
export declare function joinBlock<T>(doc: Doc<T>, path: stable.Prop[], index: number | Cursor): void; | ||
export declare function updateBlock<T>(doc: Doc<T>, path: stable.Prop[], index: number | Cursor, block: { | ||
type: string; | ||
parents: string[]; | ||
attrs: { | ||
[key: string]: BlockAttrValue; | ||
}; | ||
}): void; | ||
export declare function updateBlocks<T>(doc: Doc<T>, path: stable.Prop[], blocks: ({ | ||
type: string; | ||
parents: string[]; | ||
attrs: { | ||
[key: string]: BlockAttrValue; | ||
}; | ||
} | string)[]): void; | ||
/** | ||
@@ -199,0 +168,0 @@ * Returns a cursor for the given position in a string. |
@@ -7,3 +7,3 @@ export { Text } from "./text.js"; | ||
import type { Patch } from "@automerge/automerge-wasm"; | ||
export type { Cursor, MapObjType, MarkSet, Mark, MarkRange, Patch, } from "@automerge/automerge-wasm"; | ||
export type { Cursor, Patch, MarkSet, Mark, MarkRange, } from "@automerge/automerge-wasm"; | ||
export type AutomergeValue = ScalarValue | { | ||
@@ -10,0 +10,0 @@ [key: string]: AutomergeValue; |
@@ -7,3 +7,3 @@ { | ||
], | ||
"version": "2.1.11-richtext-alpha.1", | ||
"version": "2.1.11", | ||
"description": "Javascript implementation of automerge, backed by @automerge/automerge-wasm", | ||
@@ -74,5 +74,5 @@ "homepage": "https://github.com/automerge/automerge/tree/main/javascript", | ||
"dependencies": { | ||
"@automerge/automerge-wasm": "0.10.0-richtext-alpha.1", | ||
"@automerge/automerge-wasm": "0.10.0", | ||
"uuid": "^9.0.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
419096
13299
+ Added@automerge/automerge-wasm@0.10.0(transitive)
- Removed@automerge/automerge-wasm@0.10.0-richtext-alpha.1(transitive)