document-model 1.0.10 → 1.0.11

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.
Files changed (37) hide show
  1. package/dist/browser/document/index.d.ts +1 -0
  2. package/dist/browser/document/object.d.ts +10 -4
  3. package/dist/browser/document/reducer.d.ts +2 -1
  4. package/dist/browser/document/signal.d.ts +15 -0
  5. package/dist/browser/document/types.d.ts +4 -3
  6. package/dist/browser/document-model/gen/object.d.ts +2 -2
  7. package/dist/browser/document-model.cjs +1 -1
  8. package/dist/browser/document-model.js +2 -2
  9. package/dist/browser/document.cjs +1 -1
  10. package/dist/browser/document.js +2 -2
  11. package/dist/browser/index.cjs +1 -1
  12. package/dist/browser/index.js +3 -3
  13. package/dist/browser/internal/{index-05592a17.js → index-ac329925.js} +2 -2
  14. package/dist/{node/internal/index-7056a501.js → browser/internal/index-c9e4dc9e.js} +1 -1
  15. package/dist/{node/internal/index-14934709.js → browser/internal/index-cf51e575.js} +1 -1
  16. package/dist/browser/internal/{index-ea1557d4.js → index-df1f6a1b.js} +3 -3
  17. package/dist/browser/internal/{object-70e4dae8.js → object-113c73e2.js} +2 -2
  18. package/dist/browser/internal/{object-35506f2f.js → object-13eaec2b.js} +218 -217
  19. package/dist/node/document/index.d.ts +1 -0
  20. package/dist/node/document/object.d.ts +10 -4
  21. package/dist/node/document/reducer.d.ts +2 -1
  22. package/dist/node/document/signal.d.ts +15 -0
  23. package/dist/node/document/types.d.ts +4 -3
  24. package/dist/node/document-model/gen/object.d.ts +2 -2
  25. package/dist/node/document-model.cjs +1 -1
  26. package/dist/node/document-model.js +2 -2
  27. package/dist/node/document.cjs +1 -1
  28. package/dist/node/document.js +2 -2
  29. package/dist/node/index.cjs +1 -1
  30. package/dist/node/index.js +3 -3
  31. package/dist/node/internal/{index-0b946b7d.js → index-0abc9251.js} +3 -3
  32. package/dist/{browser/internal/index-5dee4170.js → node/internal/index-150bbba4.js} +1 -1
  33. package/dist/node/internal/{index-fbe65e32.js → index-2cd26a65.js} +2 -2
  34. package/dist/{browser/internal/index-a61bcd7c.js → node/internal/index-a74d15aa.js} +1 -1
  35. package/dist/node/internal/{object-8ed23327.js → object-073dccc4.js} +1 -1
  36. package/dist/node/internal/{object-e24dafec.js → object-baf4e3d5.js} +86 -85
  37. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  var Y = Object.defineProperty;
2
2
  var tt = (t, i, e) => i in t ? Y(t, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[i] = e;
3
- var j = (t, i, e) => (tt(t, typeof i != "symbol" ? i + "" : i, e), e);
3
+ var x = (t, i, e) => (tt(t, typeof i != "symbol" ? i + "" : i, e), e);
4
4
  import it from "json-stringify-deterministic";
5
5
  import { produce as N, castDraft as et, castImmutable as at, freeze as nt } from "immer";
6
6
  import z from "jszip";
@@ -9,8 +9,8 @@ import w from "fs";
9
9
  import st from "https";
10
10
  import { join as pt } from "path";
11
11
  import { z as o } from "zod";
12
- const F = (t) => t != null, lt = o.any().refine((t) => F(t)), P = o.enum(["LOAD_STATE"]), q = o.enum(["PRUNE"]), M = o.enum(["REDO"]), L = o.enum(["SET_NAME"]), R = o.enum(["UNDO"]);
13
- function ct() {
12
+ const F = (t) => t != null, ct = o.any().refine((t) => F(t)), P = o.enum(["LOAD_STATE"]), q = o.enum(["PRUNE"]), M = o.enum(["REDO"]), L = o.enum(["SET_NAME"]), R = o.enum(["UNDO"]);
13
+ function lt() {
14
14
  return o.object({
15
15
  __typename: o.literal("Action").optional(),
16
16
  type: o.string()
@@ -85,7 +85,7 @@ function k() {
85
85
  type: L
86
86
  });
87
87
  }
88
- function ut() {
88
+ function dt() {
89
89
  return o.object({
90
90
  __typename: o.literal("SetNameOperation").optional(),
91
91
  hash: o.string(),
@@ -103,7 +103,7 @@ function D() {
103
103
  }
104
104
  const Gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
105
105
  __proto__: null,
106
- ActionSchema: ct,
106
+ ActionSchema: lt,
107
107
  BaseActionSchema: I,
108
108
  DocumentFileSchema: rt,
109
109
  LoadStateActionInputSchema: U,
@@ -117,23 +117,23 @@ const Gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
117
117
  RedoActionSchema: O,
118
118
  RedoSchema: M,
119
119
  SetNameActionSchema: k,
120
- SetNameOperationSchema: ut,
120
+ SetNameOperationSchema: dt,
121
121
  Set_NameSchema: L,
122
122
  UndoActionSchema: D,
123
123
  UndoSchema: R,
124
- definedNonNullAnySchema: lt,
124
+ definedNonNullAnySchema: ct,
125
125
  isDefinedNonNullAny: F
126
126
  }, Symbol.toStringTag, { value: "Module" }));
127
- function dt(t) {
127
+ function ut(t) {
128
128
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
129
129
  }
130
- function g() {
130
+ function h() {
131
131
  this._types = /* @__PURE__ */ Object.create(null), this._extensions = /* @__PURE__ */ Object.create(null);
132
132
  for (let t = 0; t < arguments.length; t++)
133
133
  this.define(arguments[t]);
134
134
  this.define = this.define.bind(this), this.getType = this.getType.bind(this), this.getExtension = this.getExtension.bind(this);
135
135
  }
136
- g.prototype.define = function(t, i) {
136
+ h.prototype.define = function(t, i) {
137
137
  for (let e in t) {
138
138
  let a = t[e].map(function(n) {
139
139
  return n.toLowerCase();
@@ -155,18 +155,18 @@ g.prototype.define = function(t, i) {
155
155
  }
156
156
  }
157
157
  };
158
- g.prototype.getType = function(t) {
158
+ h.prototype.getType = function(t) {
159
159
  t = String(t);
160
160
  let i = t.replace(/^.*[/\\]/, "").toLowerCase(), e = i.replace(/^.*\./, "").toLowerCase(), a = i.length < t.length;
161
161
  return (e.length < i.length - 1 || !a) && this._types[e] || null;
162
162
  };
163
- g.prototype.getExtension = function(t) {
163
+ h.prototype.getExtension = function(t) {
164
164
  return t = /^\s*([^;\s]*)/.test(t) && RegExp.$1, t && this._extensions[t.toLowerCase()] || null;
165
165
  };
166
- var xt = g, ft = { "application/andrew-inset": ["ez"], "application/applixware": ["aw"], "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/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/cu-seeme": ["cu"], "application/dash+xml": ["mpd"], "application/davmount+xml": ["davmount"], "application/docbook+xml": ["dbk"], "application/dssc+der": ["dssc"], "application/dssc+xml": ["xdssc"], "application/ecmascript": ["es", "ecma"], "application/emma+xml": ["emma"], "application/emotionml+xml": ["emotionml"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/express": ["exp"], "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", "mjs"], "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/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": ["mp4s", "m4p"], "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-signature": ["asc", "sig"], "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/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/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/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/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/avif": ["avif"], "image/bmp": ["bmp"], "image/cgm": ["cgm"], "image/dicom-rle": ["drle"], "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"], "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/mesh": ["msh", "mesh", "silo"], "model/mtl": ["mtl"], "model/obj": ["obj"], "model/step+xml": ["stpx"], "model/step+zip": ["stpz"], "model/step-xml+zip": ["stpxz"], "model/stl": ["stl"], "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/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["markdown", "md"], "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/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"] };
166
+ var xt = h, ft = { "application/andrew-inset": ["ez"], "application/applixware": ["aw"], "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/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/cu-seeme": ["cu"], "application/dash+xml": ["mpd"], "application/davmount+xml": ["davmount"], "application/docbook+xml": ["dbk"], "application/dssc+der": ["dssc"], "application/dssc+xml": ["xdssc"], "application/ecmascript": ["es", "ecma"], "application/emma+xml": ["emma"], "application/emotionml+xml": ["emotionml"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/express": ["exp"], "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", "mjs"], "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/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": ["mp4s", "m4p"], "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-signature": ["asc", "sig"], "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/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/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/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/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/avif": ["avif"], "image/bmp": ["bmp"], "image/cgm": ["cgm"], "image/dicom-rle": ["drle"], "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"], "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/mesh": ["msh", "mesh", "silo"], "model/mtl": ["mtl"], "model/obj": ["obj"], "model/step+xml": ["stpx"], "model/step+zip": ["stpz"], "model/step-xml+zip": ["stpxz"], "model/stl": ["stl"], "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/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["markdown", "md"], "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/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"] };
167
167
  let gt = xt;
168
168
  var ht = new gt(ft);
169
- const vt = /* @__PURE__ */ dt(ht);
169
+ const vt = /* @__PURE__ */ ut(ht);
170
170
  function yt(t, i, e) {
171
171
  const a = pt(t, i);
172
172
  return w.mkdirSync(t, { recursive: !0 }), new Promise((n, s) => {
@@ -196,33 +196,33 @@ function bt(t) {
196
196
  });
197
197
  });
198
198
  }
199
- const jt = async (t) => $(t), h = (t, i = "sha1") => ot.createHash(i).update(t).digest("base64"), B = async (t) => {
200
- const i = new z(), { name: e, revision: a, documentType: n, created: s, lastModified: p } = t, l = {
199
+ const jt = async (t) => $(t), v = (t, i = "sha1") => ot.createHash(i).update(t).digest("base64"), B = async (t) => {
200
+ const i = new z(), { name: e, revision: a, documentType: n, created: s, lastModified: p } = t, c = {
201
201
  name: e,
202
202
  revision: a,
203
203
  documentType: n,
204
204
  created: s,
205
205
  lastModified: p
206
206
  };
207
- return i.file("header.json", JSON.stringify(l, null, 2)), i.file(
207
+ return i.file("header.json", JSON.stringify(c, null, 2)), i.file(
208
208
  "state.json",
209
209
  JSON.stringify(t.initialState || {}, null, 2)
210
- ), i.file("operations.json", JSON.stringify(t.operations, null, 2)), Object.keys(t.attachments).forEach((c) => {
211
- const { data: r, ...b } = t.attachments[c];
212
- i.file(c, r, {
210
+ ), i.file("operations.json", JSON.stringify(t.operations, null, 2)), Object.keys(t.attachments).forEach((r) => {
211
+ const { data: m, ...j } = t.attachments[r];
212
+ i.file(r, m, {
213
213
  base64: !0,
214
214
  createFolders: !0,
215
- comment: JSON.stringify(b)
215
+ comment: JSON.stringify(j)
216
216
  });
217
217
  }), i;
218
218
  }, wt = async (t, i, e, a) => {
219
219
  const s = await (await B(t)).generateAsync({
220
220
  type: "uint8array",
221
221
  streamFiles: !0
222
- }), p = a ?? t.name, l = `.${e}.zip`;
222
+ }), p = a ?? t.name, c = `.${e}.zip`;
223
223
  return yt(
224
224
  i,
225
- p.endsWith(l) ? p : `${p}${l}`,
225
+ p.endsWith(c) ? p : `${p}${c}`,
226
226
  s
227
227
  );
228
228
  }, Qt = async (t, i) => {
@@ -242,30 +242,30 @@ async function _t(t, i) {
242
242
  const a = await e.async("string"), n = JSON.parse(a), s = t.file("header.json");
243
243
  let p = null;
244
244
  s && (p = JSON.parse(await s.async("string")));
245
- const l = t.file("operations.json");
246
- if (!l)
245
+ const c = t.file("operations.json");
246
+ if (!c)
247
247
  throw new Error("Operations history not found");
248
- const m = JSON.parse(
249
- await l.async("string")
250
- ), c = {
248
+ const l = JSON.parse(
249
+ await c.async("string")
250
+ ), r = {
251
251
  ...n,
252
252
  ...p,
253
253
  initialState: n,
254
254
  operations: [],
255
255
  attachments: { ...n.attachments }
256
256
  };
257
- let r = m.slice(0, p == null ? void 0 : p.revision).reduce(
258
- (b, X) => i(b, X),
259
- c
257
+ let m = l.slice(0, p == null ? void 0 : p.revision).reduce(
258
+ (j, X) => i(j, X),
259
+ r
260
260
  );
261
- return p && (r = {
262
- ...r,
261
+ return p && (m = {
262
+ ...m,
263
263
  ...p,
264
264
  operations: [
265
- ...r.operations,
266
- ...m.slice(p.revision)
265
+ ...m.operations,
266
+ ...l.slice(p.revision)
267
267
  ]
268
- }), r;
268
+ }), m;
269
269
  }
270
270
  function Z(t) {
271
271
  const i = t.replace(/^.*\./, "") || void 0, e = t.replace(/^.*[/\\]/, "") || void 0;
@@ -277,20 +277,20 @@ async function Vt(t) {
277
277
  ), a = Z(t), n = i.toString("base64");
278
278
  return {
279
279
  data: n,
280
- hash: h(n),
280
+ hash: v(n),
281
281
  mimeType: e,
282
282
  ...a
283
283
  };
284
284
  }
285
285
  async function Xt(t) {
286
286
  const i = await jt(t), e = vt.getType(t) || "application/octet-stream", a = Z(t), n = i.toString("base64");
287
- return { data: n, hash: h(n), mimeType: e, ...a };
287
+ return { data: n, hash: v(n), mimeType: e, ...a };
288
288
  }
289
- function f(t, i, e) {
290
- const a = Rt(t), n = Mt(e);
289
+ function g(t, i, e, a) {
290
+ const n = Rt(t), s = Mt(e);
291
291
  return i.reduce(
292
- (s, p) => n(s, p),
293
- a
292
+ (p, c) => s(p, c, a),
293
+ n
294
294
  );
295
295
  }
296
296
  function Ot(t, i) {
@@ -302,7 +302,7 @@ function kt(t, i, e) {
302
302
  t.revision - a
303
303
  );
304
304
  return {
305
- ...f(
305
+ ...g(
306
306
  t.initialState,
307
307
  n,
308
308
  e
@@ -320,7 +320,7 @@ function Dt(t, i, e) {
320
320
  t.revision + n
321
321
  );
322
322
  return {
323
- ...f(
323
+ ...g(
324
324
  t.initialState,
325
325
  s,
326
326
  e
@@ -331,16 +331,16 @@ function Dt(t, i, e) {
331
331
  }
332
332
  function Et(t, i, e, a) {
333
333
  i = i || 0, e = e || t.operations.length;
334
- const n = t.operations.slice(i, e), s = t.operations.slice(0, i), p = t.operations.slice(e), l = f(
334
+ const n = t.operations.slice(i, e), s = t.operations.slice(0, i), p = t.operations.slice(e), c = g(
335
335
  t.initialState,
336
336
  s.concat(n),
337
337
  a
338
- ), { name: m, state: c } = l;
339
- return f(
338
+ ), { name: l, state: r } = c;
339
+ return g(
340
340
  t.initialState,
341
341
  [
342
342
  ...s,
343
- E({ name: m, state: c }, n.length),
343
+ E({ name: l, state: r }, n.length),
344
344
  ...p
345
345
  ],
346
346
  a
@@ -353,9 +353,9 @@ function Nt(t, i) {
353
353
  state: i.state ?? {}
354
354
  };
355
355
  }
356
- const H = "SET_NAME", v = "UNDO", y = "REDO", u = "PRUNE", K = "LOAD_STATE";
356
+ const H = "SET_NAME", y = "UNDO", b = "REDO", d = "PRUNE", K = "LOAD_STATE";
357
357
  function At(t, i) {
358
- return [v, y, u].includes(i.type) ? t.revision : t.revision + 1;
358
+ return [y, b, d].includes(i.type) ? t.revision : t.revision + 1;
359
359
  }
360
360
  function Tt(t, i) {
361
361
  return {
@@ -365,7 +365,7 @@ function Tt(t, i) {
365
365
  };
366
366
  }
367
367
  function zt(t, i) {
368
- if ([v, y, u, u].includes(i.type))
368
+ if ([y, b, d, d].includes(i.type))
369
369
  return t;
370
370
  const e = t.operations.slice(0, t.revision);
371
371
  return {
@@ -389,11 +389,11 @@ function Pt(t, i, e) {
389
389
  switch (I().parse(i), i.type) {
390
390
  case H:
391
391
  return Ot(t, i.input);
392
- case v:
393
- return kt(t, i.input, e);
394
392
  case y:
393
+ return kt(t, i.input, e);
394
+ case b:
395
395
  return Dt(t, i.input, e);
396
- case u:
396
+ case d:
397
397
  return Et(
398
398
  t,
399
399
  i.input.start,
@@ -406,28 +406,28 @@ function Pt(t, i, e) {
406
406
  return t;
407
407
  }
408
408
  }
409
- function qt(t, i, e) {
410
- let a = t;
411
- return T(i) && (a = Pt(a, i, e)), a = Ft(a, i), a = N(a, (n) => {
412
- const s = e(n.state, i);
413
- if (s)
409
+ function qt(t, i, e, a) {
410
+ let n = t;
411
+ return T(i) && (n = Pt(n, i, e)), n = Ft(n, i), n = N(n, (s) => {
412
+ const p = e(s.state, i, a);
413
+ if (p)
414
414
  return et({
415
- ...a,
416
- state: s
415
+ ...n,
416
+ state: p
417
417
  });
418
- }), N(a, (n) => {
419
- n.operations[n.operations.length - 1].hash = It(n), !T(i) && i.attachments && i.attachments.forEach((s) => {
420
- const { hash: p, ...l } = s;
421
- n.attachments[p] = {
418
+ }), N(n, (s) => {
419
+ s.operations[s.operations.length - 1].hash = It(s), !T(i) && i.attachments && i.attachments.forEach((p) => {
420
+ const { hash: c, ...l } = p;
421
+ s.attachments[c] = {
422
422
  ...l
423
423
  };
424
424
  });
425
425
  });
426
426
  }
427
427
  function T(t) {
428
- return [H, v, y, u, K].includes(t.type);
428
+ return [H, y, b, d, K].includes(t.type);
429
429
  }
430
- function d(t, i, e, a, n = "global") {
430
+ function u(t, i, e, a, n = "global") {
431
431
  if (!t)
432
432
  throw new Error("Empty action type");
433
433
  if (typeof t != "string")
@@ -436,7 +436,7 @@ function d(t, i, e, a, n = "global") {
436
436
  return e && (s.attachments = e), a == null || a().parse(s), s;
437
437
  }
438
438
  function Mt(t, i = qt) {
439
- return (e, a) => i(e, a, t);
439
+ return (e, a, n) => i(e, a, t, n);
440
440
  }
441
441
  const Lt = (t, i) => ({
442
442
  name: "",
@@ -457,24 +457,24 @@ const Lt = (t, i) => ({
457
457
  initialState: e,
458
458
  operations: []
459
459
  };
460
- }, It = (t) => h(it(t.state)), Yt = (t, i = 1e3) => {
460
+ }, It = (t) => v(it(t.state)), Yt = (t, i = 1e3) => {
461
461
  const e = Math.random() * i;
462
- return h(`${(t ?? /* @__PURE__ */ new Date()).toISOString()}${e}`);
462
+ return v(`${(t ?? /* @__PURE__ */ new Date()).toISOString()}${e}`);
463
463
  };
464
- function x(t) {
464
+ function f(t) {
465
465
  return at(nt(t, !0));
466
466
  }
467
- const W = (t) => d(
467
+ const W = (t) => u(
468
468
  "SET_NAME",
469
469
  t,
470
470
  void 0,
471
471
  k
472
- ), G = (t = 1) => d("UNDO", t, void 0, D), Q = (t = 1) => d("REDO", t, void 0, O), V = (t, i) => d(
472
+ ), G = (t = 1) => u("UNDO", t, void 0, D), Q = (t = 1) => u("REDO", t, void 0, O), V = (t, i) => u(
473
473
  "PRUNE",
474
474
  { start: t, end: i },
475
475
  void 0,
476
476
  _
477
- ), E = (t, i) => d(
477
+ ), E = (t, i) => u(
478
478
  "LOAD_STATE",
479
479
  { state: t, operations: i },
480
480
  void 0,
@@ -493,10 +493,11 @@ class ii {
493
493
  * @param reducer - The reducer function that updates the state.
494
494
  * @param document - The initial state of the document.
495
495
  */
496
- constructor(i, e) {
497
- j(this, "_document");
498
- j(this, "_reducer");
499
- this._reducer = i, this._document = e;
496
+ constructor(i, e, a) {
497
+ x(this, "_document");
498
+ x(this, "_reducer");
499
+ x(this, "_dispatch");
500
+ this._reducer = i, this._document = e, this._dispatch = a;
500
501
  }
501
502
  /**
502
503
  * Dispatches an action to update the state of the document.
@@ -504,7 +505,7 @@ class ii {
504
505
  * @returns The Document instance.
505
506
  */
506
507
  dispatch(i) {
507
- return this._document = this._reducer(this._document, i), this;
508
+ return this._document = this._reducer(this._document, i, this._dispatch), this;
508
509
  }
509
510
  /**
510
511
  * Saves the state of the document to a file.
@@ -535,13 +536,13 @@ class ii {
535
536
  * Gets the current state of the document.
536
537
  */
537
538
  get state() {
538
- return x(this._document.state);
539
+ return f(this._document.state);
539
540
  }
540
541
  /**
541
542
  * Gets the list of operations performed on the document.
542
543
  */
543
544
  get operations() {
544
- return x(this._document.operations);
545
+ return f(this._document.operations);
545
546
  }
546
547
  /**
547
548
  * Gets the name of the document.
@@ -577,13 +578,13 @@ class ii {
577
578
  * Gets the initial state of the document.
578
579
  */
579
580
  get initialState() {
580
- return x(this._document.initialState);
581
+ return f(this._document.initialState);
581
582
  }
582
583
  /**
583
584
  * Returns the current document as an object
584
585
  */
585
586
  toDocument() {
586
- return x(this._document);
587
+ return f(this._document);
587
588
  }
588
589
  /**
589
590
  * Gets the attachment associated with the given key.
@@ -648,7 +649,7 @@ export {
648
649
  Mt as c,
649
650
  Qt as d,
650
651
  St as e,
651
- d as f,
652
+ u as f,
652
653
  ei as g,
653
654
  ti as h,
654
655
  T as i,
@@ -659,7 +660,7 @@ export {
659
660
  It as n,
660
661
  Yt as o,
661
662
  qt as p,
662
- x as r,
663
+ f as r,
663
664
  wt as s,
664
665
  Gt as z
665
666
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document-model",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "license": "AGPL-3.0-only",
5
5
  "private": false,
6
6
  "files": [