document-model 2.11.0 → 2.13.0
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/browser/cjs/document-model.js +3 -2
- package/dist/browser/cjs/document-model.js.map +1 -1
- package/dist/browser/cjs/document.js +11 -10
- package/dist/browser/cjs/document.js.map +1 -1
- package/dist/browser/cjs/index.js +2 -2
- package/dist/browser/cjs/internal/{object-BdIbCX0K.js → creators-c2maywyy.js} +48 -213
- package/dist/browser/cjs/internal/creators-c2maywyy.js.map +1 -0
- package/dist/browser/cjs/internal/index-CTDPLYkV.js +47 -0
- package/dist/browser/cjs/internal/index-CTDPLYkV.js.map +1 -0
- package/dist/browser/cjs/internal/index-DDUYrJUg.js +19 -0
- package/dist/browser/cjs/internal/index-DDUYrJUg.js.map +1 -0
- package/dist/browser/cjs/internal/{index-hPntrUvN.js → index-DeM7OezK.js} +56 -55
- package/dist/{node/cjs/internal/index-Bsyn7lZ0.js.map → browser/cjs/internal/index-DeM7OezK.js.map} +1 -1
- package/dist/browser/cjs/internal/object-WukT1Feq.js +183 -0
- package/dist/browser/cjs/internal/object-WukT1Feq.js.map +1 -0
- package/dist/browser/cjs/utils.js +44 -0
- package/dist/browser/cjs/utils.js.map +1 -0
- package/dist/browser/es/document-model.js +3 -2
- package/dist/browser/es/document-model.js.map +1 -1
- package/dist/browser/es/document.js +12 -11
- package/dist/browser/es/document.js.map +1 -1
- package/dist/browser/es/index.js +2 -2
- package/dist/browser/es/internal/{object-oB7gkKNr.js → creators-CkhiX4CP.js} +83 -248
- package/dist/browser/es/internal/creators-CkhiX4CP.js.map +1 -0
- package/dist/browser/es/internal/{index-D_fwH6L3.js → index-BRVlDkPn.js} +4 -3
- package/dist/{node/es/internal/index-D4oqm7Ua.js.map → browser/es/internal/index-BRVlDkPn.js.map} +1 -1
- package/dist/browser/es/internal/index-CHpkSkeZ.js +48 -0
- package/dist/browser/es/internal/index-CHpkSkeZ.js.map +1 -0
- package/dist/browser/es/internal/index-uWY5kwkt.js +20 -0
- package/dist/browser/es/internal/index-uWY5kwkt.js.map +1 -0
- package/dist/browser/es/internal/object-CJHsId9H.js +184 -0
- package/dist/browser/es/internal/object-CJHsId9H.js.map +1 -0
- package/dist/browser/es/utils.js +44 -0
- package/dist/browser/es/utils.js.map +1 -0
- package/dist/browser/src/document/reducer.d.ts.map +1 -1
- package/dist/browser/src/document/utils/base.d.ts.map +1 -1
- package/dist/browser/src/document/utils/browser.d.ts +1 -0
- package/dist/browser/src/document/utils/browser.d.ts.map +1 -1
- package/dist/browser/src/document/utils/crypto.d.ts +1 -0
- package/dist/browser/src/document/utils/crypto.d.ts.map +1 -1
- package/dist/browser/src/document/utils/errors.d.ts +10 -0
- package/dist/browser/src/document/utils/errors.d.ts.map +1 -0
- package/dist/browser/src/document/utils/index.d.ts +1 -0
- package/dist/browser/src/document/utils/index.d.ts.map +1 -1
- package/dist/browser/src/document/utils/node.d.ts +2 -1
- package/dist/browser/src/document/utils/node.d.ts.map +1 -1
- package/dist/browser/utils.d.ts +2 -0
- package/dist/browser/vite.config.d.ts.map +1 -1
- package/dist/node/cjs/document-model.js +7 -6
- package/dist/node/cjs/document-model.js.map +1 -1
- package/dist/node/cjs/document.js +11 -10
- package/dist/node/cjs/document.js.map +1 -1
- package/dist/node/cjs/index.js +2 -2
- package/dist/node/cjs/internal/{object-DqFXYK4g.js → creators-B5g3rJKI.js} +66 -234
- package/dist/node/cjs/internal/creators-B5g3rJKI.js.map +1 -0
- package/dist/node/cjs/internal/{index-Bsyn7lZ0.js → index-CYhNqyfA.js} +60 -59
- package/dist/{browser/cjs/internal/index-hPntrUvN.js.map → node/cjs/internal/index-CYhNqyfA.js.map} +1 -1
- package/dist/node/cjs/internal/index-Cdxqd-qQ.js +47 -0
- package/dist/node/cjs/internal/index-Cdxqd-qQ.js.map +1 -0
- package/dist/node/cjs/internal/index-DHkzUhZg.js +19 -0
- package/dist/node/cjs/internal/index-DHkzUhZg.js.map +1 -0
- package/dist/node/cjs/internal/object-CpAsa3Oe.js +183 -0
- package/dist/node/cjs/internal/object-CpAsa3Oe.js.map +1 -0
- package/dist/node/cjs/utils.js +44 -0
- package/dist/node/cjs/utils.js.map +1 -0
- package/dist/node/es/document-model.js +7 -6
- package/dist/node/es/document-model.js.map +1 -1
- package/dist/node/es/document.js +12 -11
- package/dist/node/es/document.js.map +1 -1
- package/dist/node/es/index.js +2 -2
- package/dist/node/es/internal/{object-2XgKQb4s.js → creators-B6tCK8Ir.js} +84 -252
- package/dist/node/es/internal/creators-B6tCK8Ir.js.map +1 -0
- package/dist/node/es/internal/index-CJxdcyKO.js +48 -0
- package/dist/node/es/internal/index-CJxdcyKO.js.map +1 -0
- package/dist/node/es/internal/{index-D4oqm7Ua.js → index-dVqoH-Pd.js} +8 -7
- package/dist/{browser/es/internal/index-D_fwH6L3.js.map → node/es/internal/index-dVqoH-Pd.js.map} +1 -1
- package/dist/node/es/internal/index-mUxH6TbI.js +20 -0
- package/dist/node/es/internal/index-mUxH6TbI.js.map +1 -0
- package/dist/node/es/internal/object-Bj_Xyrvk.js +184 -0
- package/dist/node/es/internal/object-Bj_Xyrvk.js.map +1 -0
- package/dist/node/es/utils.js +44 -0
- package/dist/node/es/utils.js.map +1 -0
- package/dist/node/src/document/reducer.d.ts.map +1 -1
- package/dist/node/src/document/utils/base.d.ts.map +1 -1
- package/dist/node/src/document/utils/browser.d.ts +1 -0
- package/dist/node/src/document/utils/browser.d.ts.map +1 -1
- package/dist/node/src/document/utils/crypto.d.ts +1 -0
- package/dist/node/src/document/utils/crypto.d.ts.map +1 -1
- package/dist/node/src/document/utils/errors.d.ts +10 -0
- package/dist/node/src/document/utils/errors.d.ts.map +1 -0
- package/dist/node/src/document/utils/index.d.ts +1 -0
- package/dist/node/src/document/utils/index.d.ts.map +1 -1
- package/dist/node/src/document/utils/node.d.ts +2 -1
- package/dist/node/src/document/utils/node.d.ts.map +1 -1
- package/dist/node/utils.d.ts +2 -0
- package/dist/node/vite.config.d.ts.map +1 -1
- package/package.json +11 -2
- package/dist/browser/cjs/internal/index-B62DRxDu.js +0 -58
- package/dist/browser/cjs/internal/index-B62DRxDu.js.map +0 -1
- package/dist/browser/cjs/internal/object-BdIbCX0K.js.map +0 -1
- package/dist/browser/es/internal/index-CPWf201E.js +0 -59
- package/dist/browser/es/internal/index-CPWf201E.js.map +0 -1
- package/dist/browser/es/internal/object-oB7gkKNr.js.map +0 -1
- package/dist/node/cjs/internal/index-DozfRrse.js +0 -58
- package/dist/node/cjs/internal/index-DozfRrse.js.map +0 -1
- package/dist/node/cjs/internal/object-DqFXYK4g.js.map +0 -1
- package/dist/node/es/internal/index-Bf87b5UD.js +0 -59
- package/dist/node/es/internal/index-Bf87b5UD.js.map +0 -1
- package/dist/node/es/internal/object-2XgKQb4s.js.map +0 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
require("./internal/
|
|
3
|
+
require("./internal/creators-c2maywyy.js");
|
|
4
4
|
require("mutative");
|
|
5
|
+
require("zod");
|
|
5
6
|
require("jszip");
|
|
6
|
-
const documentModel = require("./internal/index-
|
|
7
|
+
const documentModel = require("./internal/index-DeM7OezK.js");
|
|
7
8
|
exports.Document = documentModel.Document;
|
|
8
9
|
exports.DocumentModel = documentModel.DocumentModel$1;
|
|
9
10
|
exports.actions = documentModel.actions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-model.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"document-model.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
const
|
|
3
|
+
const creators = require("./internal/creators-c2maywyy.js");
|
|
4
|
+
const object = require("./internal/object-WukT1Feq.js");
|
|
5
|
+
const utils = require("./internal/index-CTDPLYkV.js");
|
|
6
|
+
exports.actions = creators.BaseActions;
|
|
7
|
+
exports.baseReducer = creators.baseReducer;
|
|
8
|
+
exports.mutableBaseReducer = creators.mutableBaseReducer;
|
|
9
|
+
exports.processUndoRedo = creators.processUndoRedo;
|
|
10
|
+
exports.updateDocument = creators.updateDocument;
|
|
11
|
+
exports.updateHeader = creators.updateHeader;
|
|
12
|
+
exports.z = creators.zod;
|
|
5
13
|
exports.BaseDocument = object.BaseDocument;
|
|
6
|
-
exports.actions = object.BaseActions;
|
|
7
14
|
exports.applyMixins = object.applyMixins;
|
|
8
|
-
exports.
|
|
9
|
-
exports.mutableBaseReducer = object.mutableBaseReducer;
|
|
10
|
-
exports.processUndoRedo = object.processUndoRedo;
|
|
11
|
-
exports.updateDocument = object.updateDocument;
|
|
12
|
-
exports.updateHeader = object.updateHeader;
|
|
13
|
-
exports.z = object.zod;
|
|
14
|
-
exports.utils = document.index;
|
|
15
|
+
exports.utils = utils.index;
|
|
15
16
|
//# sourceMappingURL=document.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"document.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const document = require("./internal/index-
|
|
4
|
-
const documentModel = require("./internal/index-
|
|
3
|
+
const document = require("./internal/index-DDUYrJUg.js");
|
|
4
|
+
const documentModel = require("./internal/index-DeM7OezK.js");
|
|
5
5
|
const DocumentModels = {
|
|
6
6
|
"powerhouse/document": document.Document,
|
|
7
7
|
"powerhouse/document-model": documentModel.DocumentModel
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
const mutative = require("mutative");
|
|
6
|
-
const zod$1 = require("zod");
|
|
7
5
|
const JSZip = require("jszip");
|
|
6
|
+
const zod$1 = require("zod");
|
|
7
|
+
const mutative = require("mutative");
|
|
8
8
|
const isDefinedNonNullAny = (v) => v !== void 0 && v !== null;
|
|
9
9
|
const definedNonNullAnySchema = zod$1.z.any().refine((v) => isDefinedNonNullAny(v));
|
|
10
10
|
const Load_StateSchema = zod$1.z.enum(["LOAD_STATE"]);
|
|
@@ -745,38 +745,6 @@ ${originalIndentation}`;
|
|
|
745
745
|
var safeStableStringifyExports = requireSafeStableStringify();
|
|
746
746
|
const cjsModule = /* @__PURE__ */ getDefaultExportFromCjs(safeStableStringifyExports);
|
|
747
747
|
cjsModule.configure;
|
|
748
|
-
let getRandomValues;
|
|
749
|
-
const rnds8 = new Uint8Array(16);
|
|
750
|
-
function rng() {
|
|
751
|
-
if (!getRandomValues) {
|
|
752
|
-
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
753
|
-
if (!getRandomValues) {
|
|
754
|
-
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
return getRandomValues(rnds8);
|
|
758
|
-
}
|
|
759
|
-
const byteToHex = [];
|
|
760
|
-
for (let i = 0; i < 256; ++i) {
|
|
761
|
-
byteToHex.push((i + 256).toString(16).slice(1));
|
|
762
|
-
}
|
|
763
|
-
function unsafeStringify(arr, offset = 0) {
|
|
764
|
-
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
765
|
-
}
|
|
766
|
-
const randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
767
|
-
const native = {
|
|
768
|
-
randomUUID
|
|
769
|
-
};
|
|
770
|
-
function v4(options, buf, offset) {
|
|
771
|
-
if (native.randomUUID && !buf && !options) {
|
|
772
|
-
return native.randomUUID();
|
|
773
|
-
}
|
|
774
|
-
options = options || {};
|
|
775
|
-
const rnds = options.random || (options.rng || rng)();
|
|
776
|
-
rnds[6] = rnds[6] & 15 | 64;
|
|
777
|
-
rnds[8] = rnds[8] & 63 | 128;
|
|
778
|
-
return unsafeStringify(rnds);
|
|
779
|
-
}
|
|
780
748
|
const K = [
|
|
781
749
|
1518500249 | 0,
|
|
782
750
|
1859775393 | 0,
|
|
@@ -1005,6 +973,12 @@ function isBE() {
|
|
|
1005
973
|
return buf[0] === 254;
|
|
1006
974
|
}
|
|
1007
975
|
const FileSystemError = new Error("File system not available.");
|
|
976
|
+
function generateUUID() {
|
|
977
|
+
if (!crypto.randomUUID) {
|
|
978
|
+
throw new Error("generateUUID is not available in unsecure contexts.");
|
|
979
|
+
}
|
|
980
|
+
return crypto.randomUUID();
|
|
981
|
+
}
|
|
1008
982
|
function writeFile(path, name, stream) {
|
|
1009
983
|
throw FileSystemError;
|
|
1010
984
|
}
|
|
@@ -1038,6 +1012,14 @@ function hashUIntArray(data, algorithm = "sha1") {
|
|
|
1038
1012
|
}
|
|
1039
1013
|
return createHash().update(data).digest();
|
|
1040
1014
|
}
|
|
1015
|
+
function generateId(method) {
|
|
1016
|
+
if (method && method.toString() !== "UUIDv4") {
|
|
1017
|
+
throw new Error(
|
|
1018
|
+
`Id generation method not supported: "${method.toString()}"`
|
|
1019
|
+
);
|
|
1020
|
+
}
|
|
1021
|
+
return generateUUID();
|
|
1022
|
+
}
|
|
1041
1023
|
function getUnixTimestamp(date) {
|
|
1042
1024
|
return (new Date(date).getTime() / 1e3).toFixed(0);
|
|
1043
1025
|
}
|
|
@@ -1123,6 +1105,23 @@ async function verifyOperationSignature(signature, signer, verifyHandler) {
|
|
|
1123
1105
|
const expectedMessage = buildOperationSignatureMessage(params);
|
|
1124
1106
|
return verifyHandler(publicKey, signatureBytes, expectedMessage);
|
|
1125
1107
|
}
|
|
1108
|
+
class InvalidActionInputError extends Error {
|
|
1109
|
+
constructor(data) {
|
|
1110
|
+
super();
|
|
1111
|
+
__publicField(this, "data");
|
|
1112
|
+
this.name = "InvalidActionInputError";
|
|
1113
|
+
this.data = data;
|
|
1114
|
+
this.message = this.message || `Invalid action input: ${JSON.stringify(data, null, 2)}`;
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
class InvalidActionInputZodError extends InvalidActionInputError {
|
|
1118
|
+
constructor(issues) {
|
|
1119
|
+
super(issues);
|
|
1120
|
+
__publicField(this, "issues");
|
|
1121
|
+
this.issues = issues;
|
|
1122
|
+
this.name = "InvalidActionInputZodError";
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1126
1125
|
const types = { "application/andrew-inset": ["ez"], "application/appinstaller": ["appinstaller"], "application/applixware": ["aw"], "application/appx": ["appx"], "application/appxbundle": ["appxbundle"], "application/atom+xml": ["atom"], "application/atomcat+xml": ["atomcat"], "application/atomdeleted+xml": ["atomdeleted"], "application/atomsvc+xml": ["atomsvc"], "application/atsc-dwd+xml": ["dwd"], "application/atsc-held+xml": ["held"], "application/atsc-rsat+xml": ["rsat"], "application/automationml-aml+xml": ["aml"], "application/automationml-amlx+zip": ["amlx"], "application/bdoc": ["bdoc"], "application/calendar+xml": ["xcs"], "application/ccxml+xml": ["ccxml"], "application/cdfx+xml": ["cdfx"], "application/cdmi-capability": ["cdmia"], "application/cdmi-container": ["cdmic"], "application/cdmi-domain": ["cdmid"], "application/cdmi-object": ["cdmio"], "application/cdmi-queue": ["cdmiq"], "application/cpl+xml": ["cpl"], "application/cu-seeme": ["cu"], "application/cwl": ["cwl"], "application/dash+xml": ["mpd"], "application/dash-patch+xml": ["mpp"], "application/davmount+xml": ["davmount"], "application/docbook+xml": ["dbk"], "application/dssc+der": ["dssc"], "application/dssc+xml": ["xdssc"], "application/ecmascript": ["ecma"], "application/emma+xml": ["emma"], "application/emotionml+xml": ["emotionml"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/express": ["exp"], "application/fdf": ["fdf"], "application/fdt+xml": ["fdt"], "application/font-tdpfr": ["pfr"], "application/geo+json": ["geojson"], "application/gml+xml": ["gml"], "application/gpx+xml": ["gpx"], "application/gxf": ["gxf"], "application/gzip": ["gz"], "application/hjson": ["hjson"], "application/hyperstudio": ["stk"], "application/inkml+xml": ["ink", "inkml"], "application/ipfix": ["ipfix"], "application/its+xml": ["its"], "application/java-archive": ["jar", "war", "ear"], "application/java-serialized-object": ["ser"], "application/java-vm": ["class"], "application/javascript": ["*js"], "application/json": ["json", "map"], "application/json5": ["json5"], "application/jsonml+json": ["jsonml"], "application/ld+json": ["jsonld"], "application/lgr+xml": ["lgr"], "application/lost+xml": ["lostxml"], "application/mac-binhex40": ["hqx"], "application/mac-compactpro": ["cpt"], "application/mads+xml": ["mads"], "application/manifest+json": ["webmanifest"], "application/marc": ["mrc"], "application/marcxml+xml": ["mrcx"], "application/mathematica": ["ma", "nb", "mb"], "application/mathml+xml": ["mathml"], "application/mbox": ["mbox"], "application/media-policy-dataset+xml": ["mpf"], "application/mediaservercontrol+xml": ["mscml"], "application/metalink+xml": ["metalink"], "application/metalink4+xml": ["meta4"], "application/mets+xml": ["mets"], "application/mmt-aei+xml": ["maei"], "application/mmt-usd+xml": ["musd"], "application/mods+xml": ["mods"], "application/mp21": ["m21", "mp21"], "application/mp4": ["*mp4", "*mpg4", "mp4s", "m4p"], "application/msix": ["msix"], "application/msixbundle": ["msixbundle"], "application/msword": ["doc", "dot"], "application/mxf": ["mxf"], "application/n-quads": ["nq"], "application/n-triples": ["nt"], "application/node": ["cjs"], "application/octet-stream": ["bin", "dms", "lrf", "mar", "so", "dist", "distz", "pkg", "bpk", "dump", "elc", "deploy", "exe", "dll", "deb", "dmg", "iso", "img", "msi", "msp", "msm", "buffer"], "application/oda": ["oda"], "application/oebps-package+xml": ["opf"], "application/ogg": ["ogx"], "application/omdoc+xml": ["omdoc"], "application/onenote": ["onetoc", "onetoc2", "onetmp", "onepkg"], "application/oxps": ["oxps"], "application/p2p-overlay+xml": ["relo"], "application/patch-ops-error+xml": ["xer"], "application/pdf": ["pdf"], "application/pgp-encrypted": ["pgp"], "application/pgp-keys": ["asc"], "application/pgp-signature": ["sig", "*asc"], "application/pics-rules": ["prf"], "application/pkcs10": ["p10"], "application/pkcs7-mime": ["p7m", "p7c"], "application/pkcs7-signature": ["p7s"], "application/pkcs8": ["p8"], "application/pkix-attr-cert": ["ac"], "application/pkix-cert": ["cer"], "application/pkix-crl": ["crl"], "application/pkix-pkipath": ["pkipath"], "application/pkixcmp": ["pki"], "application/pls+xml": ["pls"], "application/postscript": ["ai", "eps", "ps"], "application/provenance+xml": ["provx"], "application/pskc+xml": ["pskcxml"], "application/raml+yaml": ["raml"], "application/rdf+xml": ["rdf", "owl"], "application/reginfo+xml": ["rif"], "application/relax-ng-compact-syntax": ["rnc"], "application/resource-lists+xml": ["rl"], "application/resource-lists-diff+xml": ["rld"], "application/rls-services+xml": ["rs"], "application/route-apd+xml": ["rapd"], "application/route-s-tsid+xml": ["sls"], "application/route-usd+xml": ["rusd"], "application/rpki-ghostbusters": ["gbr"], "application/rpki-manifest": ["mft"], "application/rpki-roa": ["roa"], "application/rsd+xml": ["rsd"], "application/rss+xml": ["rss"], "application/rtf": ["rtf"], "application/sbml+xml": ["sbml"], "application/scvp-cv-request": ["scq"], "application/scvp-cv-response": ["scs"], "application/scvp-vp-request": ["spq"], "application/scvp-vp-response": ["spp"], "application/sdp": ["sdp"], "application/senml+xml": ["senmlx"], "application/sensml+xml": ["sensmlx"], "application/set-payment-initiation": ["setpay"], "application/set-registration-initiation": ["setreg"], "application/shf+xml": ["shf"], "application/sieve": ["siv", "sieve"], "application/smil+xml": ["smi", "smil"], "application/sparql-query": ["rq"], "application/sparql-results+xml": ["srx"], "application/sql": ["sql"], "application/srgs": ["gram"], "application/srgs+xml": ["grxml"], "application/sru+xml": ["sru"], "application/ssdl+xml": ["ssdl"], "application/ssml+xml": ["ssml"], "application/swid+xml": ["swidtag"], "application/tei+xml": ["tei", "teicorpus"], "application/thraud+xml": ["tfi"], "application/timestamped-data": ["tsd"], "application/toml": ["toml"], "application/trig": ["trig"], "application/ttml+xml": ["ttml"], "application/ubjson": ["ubj"], "application/urc-ressheet+xml": ["rsheet"], "application/urc-targetdesc+xml": ["td"], "application/voicexml+xml": ["vxml"], "application/wasm": ["wasm"], "application/watcherinfo+xml": ["wif"], "application/widget": ["wgt"], "application/winhlp": ["hlp"], "application/wsdl+xml": ["wsdl"], "application/wspolicy+xml": ["wspolicy"], "application/xaml+xml": ["xaml"], "application/xcap-att+xml": ["xav"], "application/xcap-caps+xml": ["xca"], "application/xcap-diff+xml": ["xdf"], "application/xcap-el+xml": ["xel"], "application/xcap-ns+xml": ["xns"], "application/xenc+xml": ["xenc"], "application/xfdf": ["xfdf"], "application/xhtml+xml": ["xhtml", "xht"], "application/xliff+xml": ["xlf"], "application/xml": ["xml", "xsl", "xsd", "rng"], "application/xml-dtd": ["dtd"], "application/xop+xml": ["xop"], "application/xproc+xml": ["xpl"], "application/xslt+xml": ["*xsl", "xslt"], "application/xspf+xml": ["xspf"], "application/xv+xml": ["mxml", "xhvml", "xvml", "xvm"], "application/yang": ["yang"], "application/yin+xml": ["yin"], "application/zip": ["zip"], "audio/3gpp": ["*3gpp"], "audio/aac": ["adts", "aac"], "audio/adpcm": ["adp"], "audio/amr": ["amr"], "audio/basic": ["au", "snd"], "audio/midi": ["mid", "midi", "kar", "rmi"], "audio/mobile-xmf": ["mxmf"], "audio/mp3": ["*mp3"], "audio/mp4": ["m4a", "mp4a"], "audio/mpeg": ["mpga", "mp2", "mp2a", "mp3", "m2a", "m3a"], "audio/ogg": ["oga", "ogg", "spx", "opus"], "audio/s3m": ["s3m"], "audio/silk": ["sil"], "audio/wav": ["wav"], "audio/wave": ["*wav"], "audio/webm": ["weba"], "audio/xm": ["xm"], "font/collection": ["ttc"], "font/otf": ["otf"], "font/ttf": ["ttf"], "font/woff": ["woff"], "font/woff2": ["woff2"], "image/aces": ["exr"], "image/apng": ["apng"], "image/avci": ["avci"], "image/avcs": ["avcs"], "image/avif": ["avif"], "image/bmp": ["bmp", "dib"], "image/cgm": ["cgm"], "image/dicom-rle": ["drle"], "image/dpx": ["dpx"], "image/emf": ["emf"], "image/fits": ["fits"], "image/g3fax": ["g3"], "image/gif": ["gif"], "image/heic": ["heic"], "image/heic-sequence": ["heics"], "image/heif": ["heif"], "image/heif-sequence": ["heifs"], "image/hej2k": ["hej2"], "image/hsj2": ["hsj2"], "image/ief": ["ief"], "image/jls": ["jls"], "image/jp2": ["jp2", "jpg2"], "image/jpeg": ["jpeg", "jpg", "jpe"], "image/jph": ["jph"], "image/jphc": ["jhc"], "image/jpm": ["jpm", "jpgm"], "image/jpx": ["jpx", "jpf"], "image/jxr": ["jxr"], "image/jxra": ["jxra"], "image/jxrs": ["jxrs"], "image/jxs": ["jxs"], "image/jxsc": ["jxsc"], "image/jxsi": ["jxsi"], "image/jxss": ["jxss"], "image/ktx": ["ktx"], "image/ktx2": ["ktx2"], "image/png": ["png"], "image/sgi": ["sgi"], "image/svg+xml": ["svg", "svgz"], "image/t38": ["t38"], "image/tiff": ["tif", "tiff"], "image/tiff-fx": ["tfx"], "image/webp": ["webp"], "image/wmf": ["wmf"], "message/disposition-notification": ["disposition-notification"], "message/global": ["u8msg"], "message/global-delivery-status": ["u8dsn"], "message/global-disposition-notification": ["u8mdn"], "message/global-headers": ["u8hdr"], "message/rfc822": ["eml", "mime"], "model/3mf": ["3mf"], "model/gltf+json": ["gltf"], "model/gltf-binary": ["glb"], "model/iges": ["igs", "iges"], "model/jt": ["jt"], "model/mesh": ["msh", "mesh", "silo"], "model/mtl": ["mtl"], "model/obj": ["obj"], "model/prc": ["prc"], "model/step+xml": ["stpx"], "model/step+zip": ["stpz"], "model/step-xml+zip": ["stpxz"], "model/stl": ["stl"], "model/u3d": ["u3d"], "model/vrml": ["wrl", "vrml"], "model/x3d+binary": ["*x3db", "x3dbz"], "model/x3d+fastinfoset": ["x3db"], "model/x3d+vrml": ["*x3dv", "x3dvz"], "model/x3d+xml": ["x3d", "x3dz"], "model/x3d-vrml": ["x3dv"], "text/cache-manifest": ["appcache", "manifest"], "text/calendar": ["ics", "ifb"], "text/coffeescript": ["coffee", "litcoffee"], "text/css": ["css"], "text/csv": ["csv"], "text/html": ["html", "htm", "shtml"], "text/jade": ["jade"], "text/javascript": ["js", "mjs"], "text/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["md", "markdown"], "text/mathml": ["mml"], "text/mdx": ["mdx"], "text/n3": ["n3"], "text/plain": ["txt", "text", "conf", "def", "list", "log", "in", "ini"], "text/richtext": ["rtx"], "text/rtf": ["*rtf"], "text/sgml": ["sgml", "sgm"], "text/shex": ["shex"], "text/slim": ["slim", "slm"], "text/spdx": ["spdx"], "text/stylus": ["stylus", "styl"], "text/tab-separated-values": ["tsv"], "text/troff": ["t", "tr", "roff", "man", "me", "ms"], "text/turtle": ["ttl"], "text/uri-list": ["uri", "uris", "urls"], "text/vcard": ["vcard"], "text/vtt": ["vtt"], "text/wgsl": ["wgsl"], "text/xml": ["*xml"], "text/yaml": ["yaml", "yml"], "video/3gpp": ["3gp", "3gpp"], "video/3gpp2": ["3g2"], "video/h261": ["h261"], "video/h263": ["h263"], "video/h264": ["h264"], "video/iso.segment": ["m4s"], "video/jpeg": ["jpgv"], "video/jpm": ["*jpm", "*jpgm"], "video/mj2": ["mj2", "mjp2"], "video/mp2t": ["ts"], "video/mp4": ["mp4", "mp4v", "mpg4"], "video/mpeg": ["mpeg", "mpg", "mpe", "m1v", "m2v"], "video/ogg": ["ogv"], "video/quicktime": ["qt", "mov"], "video/webm": ["webm"] };
|
|
1127
1126
|
Object.freeze(types);
|
|
1128
1127
|
var __classPrivateFieldGet = function(receiver, state, kind, f) {
|
|
@@ -1889,7 +1888,7 @@ function updateOperations(document, action, skip = 0, reuseLastOperationIndex =
|
|
|
1889
1888
|
operationId = action.id;
|
|
1890
1889
|
timestamp = action.timestamp;
|
|
1891
1890
|
} else {
|
|
1892
|
-
operationId = "id" in action ? action.id :
|
|
1891
|
+
operationId = "id" in action ? action.id : generateId();
|
|
1893
1892
|
}
|
|
1894
1893
|
operations.push({
|
|
1895
1894
|
...action,
|
|
@@ -2220,7 +2219,11 @@ function createAction(type, input, attachments, validator, scope = "global") {
|
|
|
2220
2219
|
try {
|
|
2221
2220
|
validator == null ? void 0 : validator().parse(action.input);
|
|
2222
2221
|
} catch (error) {
|
|
2223
|
-
|
|
2222
|
+
if (error instanceof zod$1.ZodError) {
|
|
2223
|
+
throw new InvalidActionInputZodError(error.issues);
|
|
2224
|
+
} else {
|
|
2225
|
+
throw new InvalidActionInputError(error);
|
|
2226
|
+
}
|
|
2224
2227
|
}
|
|
2225
2228
|
return action;
|
|
2226
2229
|
}
|
|
@@ -2492,184 +2495,10 @@ const BaseActions = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
2492
2495
|
setName,
|
|
2493
2496
|
undo
|
|
2494
2497
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2495
|
-
class BaseDocument {
|
|
2496
|
-
/**
|
|
2497
|
-
* Constructs a BaseDocument instance with an initial state.
|
|
2498
|
-
* @param reducer - The reducer function that updates the state.
|
|
2499
|
-
* @param document - The initial state of the document.
|
|
2500
|
-
*/
|
|
2501
|
-
constructor(reducer, document, signalDispatch) {
|
|
2502
|
-
__publicField(this, "_document");
|
|
2503
|
-
__publicField(this, "_reducer");
|
|
2504
|
-
__publicField(this, "_signalDispatch");
|
|
2505
|
-
this._reducer = reducer;
|
|
2506
|
-
this._document = document;
|
|
2507
|
-
this._signalDispatch = signalDispatch;
|
|
2508
|
-
}
|
|
2509
|
-
/**
|
|
2510
|
-
* Dispatches an action to update the state of the document.
|
|
2511
|
-
* @param action - The action to dispatch.
|
|
2512
|
-
* @returns The Document instance.
|
|
2513
|
-
*/
|
|
2514
|
-
dispatch(action, options) {
|
|
2515
|
-
this._document = this._reducer(
|
|
2516
|
-
this._document,
|
|
2517
|
-
action,
|
|
2518
|
-
this._signalDispatch,
|
|
2519
|
-
options
|
|
2520
|
-
);
|
|
2521
|
-
return this;
|
|
2522
|
-
}
|
|
2523
|
-
/**
|
|
2524
|
-
* Saves the state of the document to a file.
|
|
2525
|
-
* @param path - The file path where the state should be saved.
|
|
2526
|
-
* @param extension - The file extension to use when saving the state.
|
|
2527
|
-
* @returns The file path where the state was saved.
|
|
2528
|
-
*/
|
|
2529
|
-
saveToFile(path, extension, name) {
|
|
2530
|
-
return saveToFile(this._document, path, extension, name);
|
|
2531
|
-
}
|
|
2532
|
-
/**
|
|
2533
|
-
* Loads the state of the document from a file.
|
|
2534
|
-
* @param path - The file path where the state is stored.
|
|
2535
|
-
*/
|
|
2536
|
-
async loadFromFile(path) {
|
|
2537
|
-
this._document = await loadFromFile(path, this._reducer);
|
|
2538
|
-
}
|
|
2539
|
-
/**
|
|
2540
|
-
* Loads the state of the document from a file and returns it.
|
|
2541
|
-
* @param path - The file path where the state is stored.
|
|
2542
|
-
* @param reducer - The reducer function that updates the state.
|
|
2543
|
-
* @returns The state of the document.
|
|
2544
|
-
*/
|
|
2545
|
-
static async stateFromFile(path, reducer) {
|
|
2546
|
-
const state = await loadFromFile(path, reducer);
|
|
2547
|
-
return state;
|
|
2548
|
-
}
|
|
2549
|
-
/**
|
|
2550
|
-
* Gets the current state of the document.
|
|
2551
|
-
*/
|
|
2552
|
-
get state() {
|
|
2553
|
-
return readOnly(this._document.state);
|
|
2554
|
-
}
|
|
2555
|
-
/**
|
|
2556
|
-
* Gets the list of operations performed on the document.
|
|
2557
|
-
*/
|
|
2558
|
-
get operations() {
|
|
2559
|
-
return readOnly(this._document.operations);
|
|
2560
|
-
}
|
|
2561
|
-
/**
|
|
2562
|
-
* Gets the name of the document.
|
|
2563
|
-
*/
|
|
2564
|
-
get name() {
|
|
2565
|
-
return this._document.name;
|
|
2566
|
-
}
|
|
2567
|
-
/**
|
|
2568
|
-
* Gets the type of document.
|
|
2569
|
-
*/
|
|
2570
|
-
get documentType() {
|
|
2571
|
-
return this._document.documentType;
|
|
2572
|
-
}
|
|
2573
|
-
/**
|
|
2574
|
-
* Gets the timestamp of the date the document was created.
|
|
2575
|
-
*/
|
|
2576
|
-
get created() {
|
|
2577
|
-
return this._document.created;
|
|
2578
|
-
}
|
|
2579
|
-
/**
|
|
2580
|
-
* Gets the timestamp of the date the document was last modified.
|
|
2581
|
-
*/
|
|
2582
|
-
get lastModified() {
|
|
2583
|
-
return this._document.lastModified;
|
|
2584
|
-
}
|
|
2585
|
-
/**
|
|
2586
|
-
* Gets the global revision number of the document.
|
|
2587
|
-
*/
|
|
2588
|
-
get revision() {
|
|
2589
|
-
return this._document.revision.global;
|
|
2590
|
-
}
|
|
2591
|
-
getRevision(scope) {
|
|
2592
|
-
return this._document.revision[scope];
|
|
2593
|
-
}
|
|
2594
|
-
/**
|
|
2595
|
-
* Gets the initial state of the document.
|
|
2596
|
-
*/
|
|
2597
|
-
get initialState() {
|
|
2598
|
-
return readOnly(this._document.initialState);
|
|
2599
|
-
}
|
|
2600
|
-
/**
|
|
2601
|
-
* Returns the current document as an object
|
|
2602
|
-
*/
|
|
2603
|
-
toDocument() {
|
|
2604
|
-
return readOnly(this._document);
|
|
2605
|
-
}
|
|
2606
|
-
/**
|
|
2607
|
-
* Gets the attachment associated with the given key.
|
|
2608
|
-
* @param attachment - The key of the attachment to retrieve.
|
|
2609
|
-
*/
|
|
2610
|
-
getAttachment(attachment) {
|
|
2611
|
-
return this._document.attachments[attachment];
|
|
2612
|
-
}
|
|
2613
|
-
/**
|
|
2614
|
-
* Sets the name of the document.
|
|
2615
|
-
* @param name - The new name of the document.
|
|
2616
|
-
*/
|
|
2617
|
-
setName(name) {
|
|
2618
|
-
this.dispatch(setName(name));
|
|
2619
|
-
return this;
|
|
2620
|
-
}
|
|
2621
|
-
/**
|
|
2622
|
-
* Reverts a number of actions from the document.
|
|
2623
|
-
* @param count - The number of actions to revert.
|
|
2624
|
-
*/
|
|
2625
|
-
undo(count) {
|
|
2626
|
-
this.dispatch(undo(count));
|
|
2627
|
-
return this;
|
|
2628
|
-
}
|
|
2629
|
-
/**
|
|
2630
|
-
* Reapplies a number of actions to the document.
|
|
2631
|
-
* @param count - The number of actions to reapply.
|
|
2632
|
-
*/
|
|
2633
|
-
redo(count) {
|
|
2634
|
-
this.dispatch(redo(count));
|
|
2635
|
-
return this;
|
|
2636
|
-
}
|
|
2637
|
-
/**
|
|
2638
|
-
* Removes a range of operations from the document.
|
|
2639
|
-
* @param start - The starting index of the range to remove.
|
|
2640
|
-
* @param end - The ending index of the range to remove.
|
|
2641
|
-
*/
|
|
2642
|
-
prune(start, end) {
|
|
2643
|
-
this.dispatch(prune(start, end));
|
|
2644
|
-
return this;
|
|
2645
|
-
}
|
|
2646
|
-
/**
|
|
2647
|
-
* Loads a document state and a set of operations.
|
|
2648
|
-
* @param state - The state to load.
|
|
2649
|
-
* @param operations - The operations to apply to the document.
|
|
2650
|
-
*/
|
|
2651
|
-
loadState(state, operations) {
|
|
2652
|
-
this.dispatch(loadState(state, operations));
|
|
2653
|
-
return this;
|
|
2654
|
-
}
|
|
2655
|
-
}
|
|
2656
|
-
function applyMixins(derivedCtor, constructors) {
|
|
2657
|
-
constructors.forEach((baseCtor) => {
|
|
2658
|
-
Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {
|
|
2659
|
-
Object.defineProperty(
|
|
2660
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
2661
|
-
derivedCtor.prototype,
|
|
2662
|
-
name,
|
|
2663
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
|
2664
|
-
Object.getOwnPropertyDescriptor(baseCtor.prototype, name) || /* @__PURE__ */ Object.create(null)
|
|
2665
|
-
);
|
|
2666
|
-
});
|
|
2667
|
-
});
|
|
2668
|
-
}
|
|
2669
2498
|
exports.BaseActions = BaseActions;
|
|
2670
|
-
exports.
|
|
2499
|
+
exports.InvalidActionInputError = InvalidActionInputError;
|
|
2500
|
+
exports.InvalidActionInputZodError = InvalidActionInputZodError;
|
|
2671
2501
|
exports.ab2hex = ab2hex;
|
|
2672
|
-
exports.applyMixins = applyMixins;
|
|
2673
2502
|
exports.baseReducer = baseReducer;
|
|
2674
2503
|
exports.buildOperationSignature = buildOperationSignature;
|
|
2675
2504
|
exports.buildOperationSignatureMessage = buildOperationSignatureMessage;
|
|
@@ -2682,6 +2511,7 @@ exports.createReducer = createReducer;
|
|
|
2682
2511
|
exports.createUnsafeReducer = createUnsafeReducer;
|
|
2683
2512
|
exports.createZip = createZip;
|
|
2684
2513
|
exports.documentHelpers = documentHelpers;
|
|
2514
|
+
exports.generateId = generateId;
|
|
2685
2515
|
exports.getDocumentLastModified = getDocumentLastModified;
|
|
2686
2516
|
exports.getLocalFile = getLocalFile;
|
|
2687
2517
|
exports.getRemoteFile = getRemoteFile;
|
|
@@ -2696,20 +2526,25 @@ exports.isUndo = isUndo;
|
|
|
2696
2526
|
exports.isUndoRedo = isUndoRedo;
|
|
2697
2527
|
exports.loadFromFile = loadFromFile;
|
|
2698
2528
|
exports.loadFromInput = loadFromInput;
|
|
2529
|
+
exports.loadState = loadState;
|
|
2699
2530
|
exports.mapSkippedOperations = mapSkippedOperations;
|
|
2700
2531
|
exports.mutableBaseReducer = mutableBaseReducer;
|
|
2701
2532
|
exports.parseResultingState = parseResultingState;
|
|
2702
2533
|
exports.processUndoRedo = processUndoRedo;
|
|
2534
|
+
exports.prune = prune;
|
|
2703
2535
|
exports.readOnly = readOnly;
|
|
2536
|
+
exports.redo = redo;
|
|
2704
2537
|
exports.replayDocument = replayDocument;
|
|
2705
2538
|
exports.replayOperations = replayOperations;
|
|
2706
2539
|
exports.saveToFile = saveToFile;
|
|
2707
2540
|
exports.saveToFileHandle = saveToFileHandle;
|
|
2541
|
+
exports.setName = setName;
|
|
2708
2542
|
exports.sortMappedOperations = sortMappedOperations;
|
|
2709
2543
|
exports.sortOperations = sortOperations;
|
|
2544
|
+
exports.undo = undo;
|
|
2710
2545
|
exports.updateDocument = updateDocument;
|
|
2711
2546
|
exports.updateHeader = updateHeader;
|
|
2712
2547
|
exports.validateOperations = validateOperations;
|
|
2713
2548
|
exports.verifyOperationSignature = verifyOperationSignature;
|
|
2714
2549
|
exports.zod = zod;
|
|
2715
|
-
//# sourceMappingURL=
|
|
2550
|
+
//# sourceMappingURL=creators-c2maywyy.js.map
|