loro-crdt 1.4.3 → 1.4.5
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/CHANGELOG.md +16 -0
- package/base64/index.js +39 -3
- package/base64/loro_wasm.d.ts +13 -0
- package/base64/loro_wasm_bg-2fc402da.js +64 -0
- package/bundler/index.js +10 -2
- package/bundler/index.js.map +1 -1
- package/bundler/loro_wasm.d.ts +13 -0
- package/bundler/loro_wasm_bg.js +28 -0
- package/bundler/loro_wasm_bg.wasm +0 -0
- package/bundler/loro_wasm_bg.wasm.d.ts +2 -0
- package/nodejs/index.js +10 -2
- package/nodejs/index.js.map +1 -1
- package/nodejs/loro_wasm.d.ts +13 -0
- package/nodejs/loro_wasm.js +28 -0
- package/nodejs/loro_wasm_bg.wasm +0 -0
- package/nodejs/loro_wasm_bg.wasm.d.ts +2 -0
- package/package.json +1 -1
- package/web/index.js +10 -2
- package/web/index.js.map +1 -1
- package/web/loro_wasm.d.ts +15 -0
- package/web/loro_wasm.js +28 -0
- package/web/loro_wasm_bg.wasm +0 -0
- package/web/loro_wasm_bg.wasm.d.ts +2 -0
- package/base64/loro_wasm_bg-231c2a2e.js +0 -64
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.4.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- aab07c6: feat: set default config for text style #669
|
|
8
|
+
- 6cf06e5: fix: detached loro text issues #665
|
|
9
|
+
|
|
10
|
+
## 1.4.4
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 28d1264: feat(wasm): enhance toJsonWithReplacer to handle nested containers in replacer returned value
|
|
15
|
+
- 28d1264: fix(wasm): add toJSON to LoroText
|
|
16
|
+
|
|
17
|
+
Now all containers have toJSON method.
|
|
18
|
+
|
|
3
19
|
## 1.4.3
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/base64/index.js
CHANGED
|
@@ -1077,6 +1077,26 @@ class LoroDoc {
|
|
|
1077
1077
|
}
|
|
1078
1078
|
}
|
|
1079
1079
|
/**
|
|
1080
|
+
* Configures the default text style for the document.
|
|
1081
|
+
*
|
|
1082
|
+
* This method sets the default text style configuration for the document when using LoroText.
|
|
1083
|
+
* If `None` is provided, the default style is reset.
|
|
1084
|
+
* @param {{ expand: 'before'|'after'|'none'|'both' } | undefined} style
|
|
1085
|
+
*/
|
|
1086
|
+
configDefaultTextStyle(style) {
|
|
1087
|
+
try {
|
|
1088
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1089
|
+
wasm.lorodoc_configDefaultTextStyle(retptr, this.__wbg_ptr, addHeapObject(style));
|
|
1090
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
1091
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
1092
|
+
if (r1) {
|
|
1093
|
+
throw takeObject(r0);
|
|
1094
|
+
}
|
|
1095
|
+
} finally {
|
|
1096
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
/**
|
|
1080
1100
|
* Create a loro document from the snapshot.
|
|
1081
1101
|
*
|
|
1082
1102
|
* @see You can learn more [here](https://loro.dev/docs/tutorial/encoding).
|
|
@@ -4910,6 +4930,14 @@ class LoroText {
|
|
|
4910
4930
|
wasm.__wbindgen_export_5(deferred1_0, deferred1_1, 1);
|
|
4911
4931
|
}
|
|
4912
4932
|
}
|
|
4933
|
+
/**
|
|
4934
|
+
* Get the JSON representation of the text.
|
|
4935
|
+
* @returns {any}
|
|
4936
|
+
*/
|
|
4937
|
+
toJSON() {
|
|
4938
|
+
const ret = wasm.lorotext_toJSON(this.__wbg_ptr);
|
|
4939
|
+
return takeObject(ret);
|
|
4940
|
+
}
|
|
4913
4941
|
}
|
|
4914
4942
|
|
|
4915
4943
|
const LoroTreeFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -6750,7 +6778,7 @@ var imports = /*#__PURE__*/Object.freeze({
|
|
|
6750
6778
|
// Without this patch, Cloudflare Worker would raise issue like: "Uncaught TypeError: wasm2.__wbindgen_start is not a function"
|
|
6751
6779
|
|
|
6752
6780
|
|
|
6753
|
-
import loro_wasm_bg_js from './loro_wasm_bg-
|
|
6781
|
+
import loro_wasm_bg_js from './loro_wasm_bg-2fc402da.js';
|
|
6754
6782
|
const instance = new WebAssembly.Instance(loro_wasm_bg_js(), {
|
|
6755
6783
|
"./loro_wasm_bg.js": imports,
|
|
6756
6784
|
});
|
|
@@ -6908,10 +6936,12 @@ class Awareness {
|
|
|
6908
6936
|
}
|
|
6909
6937
|
}
|
|
6910
6938
|
LoroDoc.prototype.toJsonWithReplacer = function (replacer) {
|
|
6939
|
+
const processed = new Set();
|
|
6911
6940
|
const doc = this;
|
|
6912
6941
|
const m = (key, value) => {
|
|
6913
6942
|
if (typeof value === "string") {
|
|
6914
|
-
if (isContainerId(value)) {
|
|
6943
|
+
if (isContainerId(value) && !processed.has(value)) {
|
|
6944
|
+
processed.add(value);
|
|
6915
6945
|
const container = doc.getContainerById(value);
|
|
6916
6946
|
if (container == null) {
|
|
6917
6947
|
throw new Error(`ContainerID not found: ${value}`);
|
|
@@ -6927,9 +6957,15 @@ LoroDoc.prototype.toJsonWithReplacer = function (replacer) {
|
|
|
6927
6957
|
if (isContainer(ans)) {
|
|
6928
6958
|
throw new Error("Using new container is not allowed in toJsonWithReplacer");
|
|
6929
6959
|
}
|
|
6960
|
+
if (typeof ans === "object" && ans != null) {
|
|
6961
|
+
return run(ans);
|
|
6962
|
+
}
|
|
6930
6963
|
return ans;
|
|
6931
6964
|
}
|
|
6932
6965
|
}
|
|
6966
|
+
if (typeof value === "object" && value != null) {
|
|
6967
|
+
return run(value);
|
|
6968
|
+
}
|
|
6933
6969
|
const ans = replacer(key, value);
|
|
6934
6970
|
if (isContainer(ans)) {
|
|
6935
6971
|
throw new Error("Using new container is not allowed in toJsonWithReplacer");
|
|
@@ -6951,7 +6987,7 @@ LoroDoc.prototype.toJsonWithReplacer = function (replacer) {
|
|
|
6951
6987
|
}
|
|
6952
6988
|
return result;
|
|
6953
6989
|
};
|
|
6954
|
-
const layer =
|
|
6990
|
+
const layer = doc.getShallowValue();
|
|
6955
6991
|
return run(layer);
|
|
6956
6992
|
};
|
|
6957
6993
|
|
package/base64/loro_wasm.d.ts
CHANGED
|
@@ -1606,6 +1606,14 @@ export class LoroDoc {
|
|
|
1606
1606
|
*/
|
|
1607
1607
|
configTextStyle(styles: {[key: string]: { expand: 'before'|'after'|'none'|'both' }}): void;
|
|
1608
1608
|
/**
|
|
1609
|
+
* Configures the default text style for the document.
|
|
1610
|
+
*
|
|
1611
|
+
* This method sets the default text style configuration for the document when using LoroText.
|
|
1612
|
+
* If `None` is provided, the default style is reset.
|
|
1613
|
+
* @param {{ expand: 'before'|'after'|'none'|'both' } | undefined} style
|
|
1614
|
+
*/
|
|
1615
|
+
configDefaultTextStyle(style: { expand: 'before'|'after'|'none'|'both' } | undefined): void;
|
|
1616
|
+
/**
|
|
1609
1617
|
* Create a loro document from the snapshot.
|
|
1610
1618
|
*
|
|
1611
1619
|
* @see You can learn more [here](https://loro.dev/docs/tutorial/encoding).
|
|
@@ -3232,6 +3240,11 @@ export class LoroText {
|
|
|
3232
3240
|
*/
|
|
3233
3241
|
getShallowValue(): string;
|
|
3234
3242
|
/**
|
|
3243
|
+
* Get the JSON representation of the text.
|
|
3244
|
+
* @returns {any}
|
|
3245
|
+
*/
|
|
3246
|
+
toJSON(): any;
|
|
3247
|
+
/**
|
|
3235
3248
|
* Get the container id of the text.
|
|
3236
3249
|
*/
|
|
3237
3250
|
readonly id: ContainerID;
|