@jinntec/jinntap 1.21.3 → 1.21.4

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 (2) hide show
  1. package/dist/jinn-tap.es.js +37 -25
  2. package/package.json +1 -1
@@ -31114,9 +31114,9 @@ const Zf = Ve.evaluateXPath;
31114
31114
  Ve.evaluateXPathToArray;
31115
31115
  Ve.evaluateXPathToAsyncIterator;
31116
31116
  Ve.evaluateXPathToBoolean;
31117
- const pA = Ve.evaluateXPathToFirstNode;
31117
+ const k4 = Ve.evaluateXPathToFirstNode;
31118
31118
  Ve.evaluateXPathToMap;
31119
- const k4 = Ve.evaluateXPathToNodes;
31119
+ const pA = Ve.evaluateXPathToNodes;
31120
31120
  Ve.evaluateXPathToNumber;
31121
31121
  Ve.evaluateXPathToNumbers;
31122
31122
  Ve.evaluateXPathToString;
@@ -31145,7 +31145,7 @@ x4(`
31145
31145
  <teiHeader>
31146
31146
  <fileDesc>
31147
31147
  <titleStmt>
31148
- <title>JinnTap Documentation</title>
31148
+ <title>Untitled Document</title>
31149
31149
  </titleStmt>
31150
31150
  <publicationStmt>
31151
31151
  <p>Information about publication or distribution</p>
@@ -31171,9 +31171,9 @@ x4(`
31171
31171
  declare function jt:import($doc as node()) {
31172
31172
  let $xml :=
31173
31173
  if (not($doc//tei:body)) then
31174
- $doc//tei:text/tei:div
31174
+ $doc//tei:text/node()
31175
31175
  else
31176
- $doc//tei:body
31176
+ $doc//tei:body/node()
31177
31177
  return (
31178
31178
  jt:import($xml, false()),
31179
31179
  <tei-listAnnotation>
@@ -31211,22 +31211,22 @@ x4(`
31211
31211
  $node
31212
31212
  };
31213
31213
 
31214
- declare function jt:export($nodes as node()*, $input as document-node()) {
31214
+ declare function jt:export($nodes as node()*, $input as document-node(), $meta as map(*)) {
31215
31215
  for $node in $nodes
31216
31216
  return
31217
31217
  typeswitch($node)
31218
31218
  case document-node() return
31219
- jt:export($node/node(), $input)
31219
+ jt:export($node/node(), $input, $meta)
31220
31220
  case element(tei:TEI) return
31221
31221
  element { node-name($node) } {
31222
31222
  $node/@*,
31223
- $node/tei:teiHeader,
31224
- jt:export($node/tei:text, $input),
31223
+ jt:export($node/tei:teiHeader, $input, $meta),
31224
+ jt:export($node/tei:text, $input, $meta),
31225
31225
  if (not($node/tei:standOff)) then
31226
31226
  <standOff xmlns="http://www.tei-c.org/ns/1.0">{ $input//tei:listAnnotation }</standOff>
31227
31227
  else
31228
31228
  (),
31229
- jt:export($node/tei:standOff, $input)
31229
+ jt:export($node/tei:standOff, $input, $meta)
31230
31230
  }
31231
31231
  case element(tei:standOff) return
31232
31232
  element { node-name($node) } {
@@ -31239,10 +31239,18 @@ x4(`
31239
31239
  $node/@*,
31240
31240
  $input/tei:body/node() except $input/tei:body/tei:listAnnotation
31241
31241
  }
31242
+ case element(tei:title) return
31243
+ element { node-name($node) } {
31244
+ $node/@*,
31245
+ if ($node/ancestor::tei:titleStmt) then
31246
+ <title xmlns="http://www.tei-c.org/ns/1.0">{$meta?title}</title>
31247
+ else
31248
+ jt:export($node/node(), $input, $meta)
31249
+ }
31242
31250
  case element() return
31243
31251
  element { node-name($node) } {
31244
31252
  $node/@*,
31245
- jt:export($node/node(), $input)
31253
+ jt:export($node/node(), $input, $meta)
31246
31254
  }
31247
31255
  default return
31248
31256
  $node
@@ -31251,7 +31259,7 @@ x4(`
31251
31259
  function qh(n) {
31252
31260
  const e = typeof n == "string" ? Y1(n) : n;
31253
31261
  if (!e) return "";
31254
- const t = k4(
31262
+ const t = pA(
31255
31263
  `
31256
31264
  import module namespace jt="http://jinntec.de/jinntap";
31257
31265
 
@@ -31273,27 +31281,28 @@ function qh(n) {
31273
31281
  doc: e
31274
31282
  };
31275
31283
  }
31276
- function Dv(n, e) {
31284
+ function Dv(n, e, t = {}) {
31277
31285
  if (!e) return n;
31278
- const t = Y1(`<body xmlns="http://www.tei-c.org/ns/1.0">${n}</body>`), i = pA(
31286
+ const i = Y1(`<body xmlns="http://www.tei-c.org/ns/1.0">${n}</body>`), s = pA(
31279
31287
  `
31280
31288
  import module namespace jt="http://jinntec.de/jinntap";
31281
31289
 
31282
- jt:export($document, .)
31290
+ jt:export($document, ., $meta)
31283
31291
  `,
31284
- t,
31292
+ i,
31285
31293
  null,
31286
31294
  {
31287
- document: e
31295
+ document: e,
31296
+ meta: t
31288
31297
  },
31289
31298
  {
31290
31299
  language: Zf.XQUERY_3_1_LANGUAGE
31291
31300
  }
31292
- );
31293
- return new XMLSerializer().serializeToString(i);
31301
+ ), a = new XMLSerializer();
31302
+ return s.map((c) => a.serializeToString(c)).join("");
31294
31303
  }
31295
31304
  function Rv() {
31296
- const n = new DOMParser().parseFromString('<TEI xmlns="http://www.tei-c.org/ns/1.0"></TEI>', "application/xml"), e = pA(
31305
+ const n = new DOMParser().parseFromString('<TEI xmlns="http://www.tei-c.org/ns/1.0"></TEI>', "application/xml"), e = k4(
31297
31306
  `
31298
31307
  import module namespace jt="http://jinntec.de/jinntap";
31299
31308
 
@@ -48296,7 +48305,10 @@ class R4 extends HTMLElement {
48296
48305
  return ["debug", "url", "schema"];
48297
48306
  }
48298
48307
  constructor() {
48299
- super(), this.editor = null, this.toolbar = null, this.attributePanel = null, this.notesWrapper = "listAnnotation", this.collaboration = null, this.provider = null, this.notes = "disconnected", this.metadata = {}, this._schema = D4, this._initialized = !1;
48308
+ super(), this.editor = null, this.toolbar = null, this.attributePanel = null, this.notesWrapper = "listAnnotation", this.collaboration = null, this.provider = null, this.notes = "disconnected", this.metadata = {
48309
+ title: "Untitled Document",
48310
+ name: "untitled.xml"
48311
+ }, this._schema = D4, this._initialized = !1;
48300
48312
  }
48301
48313
  attributeChangedCallback(e, t, i) {
48302
48314
  e === "debug" ? i !== null ? this.classList.add("debug") : this.classList.remove("debug") : e === "url" && i && this._initialized ? this.loadFromUrl(i) : e === "schema" && i && this.loadSchema(i);
@@ -48430,7 +48442,7 @@ class R4 extends HTMLElement {
48430
48442
  ],
48431
48443
  autofocus: !1,
48432
48444
  onCreate: () => {
48433
- this.dispatchEvent(new CustomEvent("ready"));
48445
+ this.dispatchEvent(new CustomEvent("ready")), this.dispatchContentChange();
48434
48446
  },
48435
48447
  onTransaction: ({ editor: c, transaction: d }) => {
48436
48448
  d.docChanged && this.dispatchContentChange();
@@ -48445,14 +48457,14 @@ class R4 extends HTMLElement {
48445
48457
  name: this.collaboration.user,
48446
48458
  color: this.collaboration.color
48447
48459
  }
48448
- }))) : a.extensions.push(HP), this.editor = new IP(a), this.attributePanel = new AG(this, this._schema), this.navigationPanel = new CG(this, this.attributePanel), this.toolbar = new EG(this, this._schema), this.collaboration || (this.content = t);
48460
+ }))) : (a.extensions.push(HP), a.content = t), this.editor = new IP(a), this.attributePanel = new AG(this, this._schema), this.navigationPanel = new CG(this, this.attributePanel), this.toolbar = new EG(this, this._schema);
48449
48461
  }
48450
48462
  dispatchContentChange() {
48451
48463
  const e = fv(this.editor, this._schema);
48452
48464
  this.dispatchEvent(new CustomEvent("content-change", {
48453
48465
  detail: {
48454
48466
  body: e,
48455
- xml: Dv(e, this.document)
48467
+ xml: Dv(e, this.document, this.metadata)
48456
48468
  }
48457
48469
  }));
48458
48470
  }
@@ -48468,7 +48480,7 @@ class R4 extends HTMLElement {
48468
48480
  }
48469
48481
  // Getter for the full XML content
48470
48482
  get xml() {
48471
- return Dv(fv(this.editor, this._schema), this.document);
48483
+ return Dv(fv(this.editor, this._schema), this.document, this.metadata);
48472
48484
  }
48473
48485
  // Setter for the full XML content
48474
48486
  set xml(e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jinntec/jinntap",
3
- "version": "1.21.3",
3
+ "version": "1.21.4",
4
4
  "type": "module",
5
5
  "main": "./dist/index.es.js",
6
6
  "module": "./dist/index.es.js",