@teipublisher/pb-components 2.25.5 → 2.25.7

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 (130) hide show
  1. package/.github/workflows/main.yml +3 -3
  2. package/.github/workflows/node.js.yml +3 -3
  3. package/.github/workflows/release.js.yml +3 -3
  4. package/CHANGELOG.md +15 -0
  5. package/Dockerfile +78 -70
  6. package/css/components.css +5 -5
  7. package/dist/demo/pb-drawer2.html +1 -1
  8. package/dist/demo/pb-facsimile.html +2 -2
  9. package/dist/demo/pb-leaflet-map.html +1 -1
  10. package/dist/demo/pb-repeat.html +1 -3
  11. package/dist/demo/pb-view3.html +1 -1
  12. package/dist/{paper-icon-button-0fb125c4.js → paper-icon-button-72125e67.js} +1 -1
  13. package/dist/pb-code-editor.js +25 -20
  14. package/dist/pb-component-docs.js +58 -54
  15. package/dist/pb-components-bundle.js +1827 -1520
  16. package/dist/pb-edit-app.js +167 -107
  17. package/dist/pb-elements.json +54 -54
  18. package/dist/{pb-i18n-0611135a.js → pb-i18n-4cc00bfe.js} +1 -1
  19. package/dist/pb-leaflet-map.js +23 -23
  20. package/dist/pb-mei.js +56 -41
  21. package/dist/{pb-mixin-b1caa22e.js → pb-mixin-886ece32.js} +1 -1
  22. package/dist/pb-odd-editor.js +925 -758
  23. package/dist/pb-tify.js +2 -2
  24. package/dist/{vaadin-element-mixin-859a0132.js → vaadin-element-mixin-ad07ba25.js} +88 -61
  25. package/gh-pages.js +5 -3
  26. package/lib/openseadragon.min.js +6 -6
  27. package/package.json +3 -2
  28. package/pb-elements.json +54 -54
  29. package/src/assets/components.css +5 -5
  30. package/src/authority/airtable.js +20 -21
  31. package/src/authority/anton.js +129 -129
  32. package/src/authority/custom.js +23 -21
  33. package/src/authority/geonames.js +38 -32
  34. package/src/authority/gnd.js +47 -42
  35. package/src/authority/kbga.js +137 -134
  36. package/src/authority/metagrid.js +44 -46
  37. package/src/authority/reconciliation.js +66 -67
  38. package/src/authority/registry.js +4 -4
  39. package/src/docs/pb-component-docs.js +2 -2
  40. package/src/docs/pb-component-view.js +5 -5
  41. package/src/docs/pb-components-list.js +2 -2
  42. package/src/docs/pb-demo-snippet.js +2 -2
  43. package/src/dts-client.js +299 -297
  44. package/src/dts-select-endpoint.js +90 -82
  45. package/src/parse-date-service.js +184 -135
  46. package/src/pb-ajax.js +171 -167
  47. package/src/pb-authority-lookup.js +96 -81
  48. package/src/pb-autocomplete.js +292 -280
  49. package/src/pb-blacklab-highlight.js +264 -259
  50. package/src/pb-blacklab-results.js +236 -221
  51. package/src/pb-browse-docs.js +540 -475
  52. package/src/pb-browse.js +68 -65
  53. package/src/pb-clipboard.js +79 -76
  54. package/src/pb-code-editor.js +110 -102
  55. package/src/pb-code-highlight.js +209 -204
  56. package/src/pb-codepen.js +79 -72
  57. package/src/pb-collapse.js +149 -146
  58. package/src/pb-combo-box.js +190 -190
  59. package/src/pb-components-bundle.js +1 -1
  60. package/src/pb-custom-form.js +150 -149
  61. package/src/pb-document.js +89 -90
  62. package/src/pb-download.js +208 -195
  63. package/src/pb-drawer.js +145 -148
  64. package/src/pb-edit-app.js +301 -229
  65. package/src/pb-edit-xml.js +99 -96
  66. package/src/pb-events.js +114 -107
  67. package/src/pb-facs-link.js +104 -102
  68. package/src/pb-facsimile.js +444 -410
  69. package/src/pb-formula.js +151 -153
  70. package/src/pb-geolocation.js +129 -131
  71. package/src/pb-grid-action.js +53 -56
  72. package/src/pb-grid.js +231 -228
  73. package/src/pb-highlight.js +140 -140
  74. package/src/pb-hotkeys.js +40 -42
  75. package/src/pb-i18n.js +101 -104
  76. package/src/pb-image-strip.js +84 -78
  77. package/src/pb-lang.js +83 -70
  78. package/src/pb-leaflet-map.js +488 -485
  79. package/src/pb-link.js +126 -124
  80. package/src/pb-load.js +431 -426
  81. package/src/pb-login.js +275 -254
  82. package/src/pb-manage-odds.js +364 -318
  83. package/src/pb-map-icon.js +89 -89
  84. package/src/pb-map-layer.js +85 -85
  85. package/src/pb-markdown.js +90 -99
  86. package/src/pb-media-query.js +74 -72
  87. package/src/pb-mei.js +306 -295
  88. package/src/pb-message.js +143 -130
  89. package/src/pb-mixin.js +269 -264
  90. package/src/pb-navigation.js +80 -82
  91. package/src/pb-observable.js +38 -38
  92. package/src/pb-odd-editor.js +1056 -958
  93. package/src/pb-odd-elementspec-editor.js +348 -297
  94. package/src/pb-odd-model-editor.js +1058 -898
  95. package/src/pb-odd-parameter-editor.js +200 -178
  96. package/src/pb-odd-rendition-editor.js +136 -124
  97. package/src/pb-page.js +432 -422
  98. package/src/pb-paginate.js +202 -190
  99. package/src/pb-panel.js +191 -179
  100. package/src/pb-popover-themes.js +7 -5
  101. package/src/pb-popover.js +296 -287
  102. package/src/pb-print-preview.js +127 -127
  103. package/src/pb-progress.js +49 -49
  104. package/src/pb-repeat.js +105 -104
  105. package/src/pb-restricted.js +84 -77
  106. package/src/pb-search.js +238 -221
  107. package/src/pb-select-feature.js +127 -120
  108. package/src/pb-select-odd.js +132 -124
  109. package/src/pb-select-template.js +89 -78
  110. package/src/pb-select.js +251 -227
  111. package/src/pb-split-list.js +179 -174
  112. package/src/pb-svg.js +80 -79
  113. package/src/pb-table-column.js +54 -54
  114. package/src/pb-table-grid.js +221 -203
  115. package/src/pb-tabs.js +61 -63
  116. package/src/pb-tify.js +154 -154
  117. package/src/pb-timeline.js +271 -229
  118. package/src/pb-toggle-feature.js +198 -185
  119. package/src/pb-upload.js +184 -174
  120. package/src/pb-version.js +30 -30
  121. package/src/pb-view-annotate.js +132 -98
  122. package/src/pb-view.js +1282 -1263
  123. package/src/pb-zoom.js +40 -40
  124. package/src/polymer-hack.js +1 -1
  125. package/src/search-result-service.js +256 -223
  126. package/src/seed-element.js +13 -20
  127. package/src/settings.js +4 -4
  128. package/src/theming.js +91 -91
  129. package/src/urls.js +289 -289
  130. package/src/utils.js +53 -51
@@ -8,11 +8,11 @@ jobs:
8
8
  build:
9
9
  runs-on: ubuntu-latest
10
10
  steps:
11
- - uses: actions/checkout@v4
11
+ - uses: actions/checkout@v5
12
12
  - name: Setup Node.js environment
13
- uses: actions/setup-node@v4
13
+ uses: actions/setup-node@v5
14
14
  with:
15
- node-version: "16"
15
+ node-version: "22"
16
16
  - run: npm ci
17
17
  - run: npm run gh-pages
18
18
  - name: Deploy to gh-pages
@@ -14,11 +14,11 @@ jobs:
14
14
  build:
15
15
  runs-on: ubuntu-latest
16
16
  steps:
17
- - uses: actions/checkout@v4
17
+ - uses: actions/checkout@v5
18
18
  - name: Use Node.js
19
- uses: actions/setup-node@v4
19
+ uses: actions/setup-node@v5
20
20
  with:
21
- node-version: "16"
21
+ node-version: "22"
22
22
  - name: npm install and build
23
23
  run:
24
24
  npm ci
@@ -11,10 +11,10 @@ jobs:
11
11
  name: Release
12
12
  runs-on: ubuntu-latest
13
13
  steps:
14
- - uses: actions/checkout@v4
15
- - uses: actions/setup-node@v4
14
+ - uses: actions/checkout@v5
15
+ - uses: actions/setup-node@v5
16
16
  with:
17
- node-version: "16"
17
+ node-version: "22"
18
18
  - name: npm install and build
19
19
  run:
20
20
  npm ci
package/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## [2.25.7](https://github.com/eeditiones/tei-publisher-components/compare/v2.25.6...v2.25.7) (2025-11-04)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **pb-facsimile:** update OSD and override fullscreen differently ([ddb9e18](https://github.com/eeditiones/tei-publisher-components/commit/ddb9e188a84739f3a4b128c816ebb1ba55a08bd7))
7
+
8
+ ## [2.25.6](https://github.com/eeditiones/tei-publisher-components/compare/v2.25.5...v2.25.6) (2025-09-09)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **docker:** allign image ([45fcfe6](https://github.com/eeditiones/tei-publisher-components/commit/45fcfe682d4413baaf6413e3801201f46d7b0f0a)), closes [#244](https://github.com/eeditiones/tei-publisher-components/issues/244)
14
+ * **docker:** minor fixes ([34ad702](https://github.com/eeditiones/tei-publisher-components/commit/34ad702e6e72455096421cfa6f77a9a921cf2b31))
15
+
1
16
  ## [2.25.5](https://github.com/eeditiones/tei-publisher-components/compare/v2.25.4...v2.25.5) (2025-08-16)
2
17
 
3
18
 
package/Dockerfile CHANGED
@@ -1,41 +1,12 @@
1
- ARG EXIST_VERSION=6.2.0
1
+ ARG EXIST_VERSION=release
2
+ ARG BUILD=local
3
+ ARG PUBLISHER_VERSION=master
2
4
 
3
5
  # START STAGE 1
4
- FROM openjdk:8-jdk-slim as builder
5
-
6
- USER root
7
-
8
- ENV ANT_VERSION 1.10.15
9
- ENV ANT_HOME /etc/ant-${ANT_VERSION}
10
-
11
- WORKDIR /tmp
12
-
13
- RUN apt-get update && apt-get install -y \
14
- git \
15
- curl
16
-
17
- RUN curl -L -o apache-ant-${ANT_VERSION}-bin.tar.gz https://downloads.apache.org/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz \
18
- && mkdir ant-${ANT_VERSION} \
19
- && tar -zxvf apache-ant-${ANT_VERSION}-bin.tar.gz \
20
- && mv apache-ant-${ANT_VERSION} ${ANT_HOME} \
21
- && rm apache-ant-${ANT_VERSION}-bin.tar.gz \
22
- && rm -rf ant-${ANT_VERSION} \
23
- && rm -rf ${ANT_HOME}/manual \
24
- && unset ANT_VERSION
25
-
26
- ENV PATH ${PATH}:${ANT_HOME}/bin
6
+ FROM ghcr.io/eeditiones/builder:latest AS builder
27
7
 
28
- RUN apt-get update && apt-get install -y nodejs npm
29
-
30
- FROM builder as tei
31
-
32
- ARG TEMPLATING_VERSION=1.1.0
33
- ARG PUBLISHER_LIB_VERSION=3.0.0
34
- ARG ROUTER_VERSION=1.8.0
35
- ARG PUBLISHER_VERSION=master
36
-
37
- # add key
38
- RUN mkdir -p ~/.ssh && ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
8
+ ARG ROUTER_VERSION=1.10.0
9
+ ARG PUBLISHER_VERSION
39
10
 
40
11
  # Build tei-publisher-app
41
12
  RUN git clone https://github.com/eeditiones/tei-publisher-app.git \
@@ -53,38 +24,75 @@ COPY i18n/common/* resources/i18n/common/
53
24
 
54
25
  RUN ant
55
26
 
56
- RUN curl -L -o /tmp/roaster-${ROUTER_VERSION}.xar http://exist-db.org/exist/apps/public-repo/public/roaster-${ROUTER_VERSION}.xar
57
- RUN curl -L -o /tmp/tei-publisher-lib-${PUBLISHER_LIB_VERSION}.xar http://exist-db.org/exist/apps/public-repo/public/tei-publisher-lib-${PUBLISHER_LIB_VERSION}.xar
58
- RUN curl -L -o /tmp/templating-${TEMPLATING_VERSION}.xar http://exist-db.org/exist/apps/public-repo/public/templating-${TEMPLATING_VERSION}.xar
59
-
60
- FROM existdb/existdb:${EXIST_VERSION}
61
-
62
- COPY --from=tei /tmp/tei-publisher-app/build/*.xar /exist/autodeploy/
63
- COPY --from=tei /tmp/*.xar /exist/autodeploy/
64
-
65
- ENV DATA_DIR /exist-data
66
-
67
- ENV JAVA_TOOL_OPTIONS \
68
- -Dfile.encoding=UTF8 \
69
- -Dsun.jnu.encoding=UTF-8 \
70
- -Djava.awt.headless=true \
71
- -Dorg.exist.db-connection.cacheSize=${CACHE_MEM:-256}M \
72
- -Dorg.exist.db-connection.pool.max=${MAX_BROKER:-20} \
73
- -Dlog4j.configurationFile=/exist/etc/log4j2.xml \
74
- -Dexist.home=/exist \
75
- -Dexist.configurationFile=/exist/etc/conf.xml \
76
- -Djetty.home=/exist \
77
- -Dexist.jetty.config=/exist/etc/jetty/standard.enabled-jetty-configs \
78
- -XX:+UnlockExperimentalVMOptions \
79
- -XX:+UseCGroupMemoryLimitForHeap \
80
- -XX:+UseG1GC \
81
- -XX:+UseStringDeduplication \
82
- -XX:MaxRAMFraction=1 \
83
- -XX:+ExitOnOutOfMemoryError \
84
- -Dorg.exist.db-connection.files=${DATA_DIR} \
85
- -Dorg.exist.db-connection.recovery.journal-dir=${DATA_DIR}
86
-
87
- # pre-populate the database by launching it once
88
- RUN [ "java", \
89
- "org.exist.start.Main", "client", "-l", \
90
- "--no-gui", "--xpath", "system:get-version()" ]
27
+ WORKDIR /tmp
28
+
29
+ ADD http://exist-db.org/exist/apps/public-repo/public/roaster-${ROUTER_VERSION}.xar 001.xar
30
+ ADD https://github.com/eeditiones/tei-publisher-lib/releases/latest/download/tei-publisher-lib.xar 002.xar
31
+
32
+ FROM duncdrum/existdb:${EXIST_VERSION} AS build_local
33
+
34
+ ARG USR=root
35
+ USER ${USR}
36
+
37
+ ONBUILD COPY --from=builder /tmp/tei-publisher-app/build/*.xar /exist/autodeploy/
38
+ ONBUILD COPY --from=builder /tmp/*.xar /exist/autodeploy/
39
+
40
+ # TODO(DP): Tagging scheme add EXIST_VERSION to the tag
41
+ FROM ghcr.io/jinntec/base:main AS build_prod
42
+
43
+ ARG USR=nonroot
44
+ USER ${USR}
45
+
46
+ # Copy EXPATH dependencies
47
+ ONBUILD COPY --from=builder --chown=${USR} /tmp/tei-publisher-app/build/*.xar /exist/autodeploy/
48
+ ONBUILD COPY --from=builder --chown=${USR} /tmp/*.xar /exist/autodeploy/
49
+
50
+
51
+ FROM build_${BUILD}
52
+
53
+ ARG USR
54
+ USER ${USR}
55
+
56
+ WORKDIR /exist
57
+
58
+ # ARG ADMIN_PASS=none
59
+
60
+ ARG CACHE_MEM
61
+ ARG MAX_BROKER
62
+ ARG JVM_MAX_RAM_PERCENTAGE
63
+ ARG HTTP_PORT=8080
64
+ ARG HTTPS_PORT=8443
65
+
66
+ ARG NER_ENDPOINT=http://localhost:8001
67
+ ARG CONTEXT_PATH=auto
68
+ ARG PROXY_CACHING=false
69
+
70
+ ENV JDK_JAVA_OPTIONS="\
71
+ -Dteipublisher.ner-endpoint=${NER_ENDPOINT} \
72
+ -Dteipublisher.context-path=${CONTEXT_PATH} \
73
+ -Dteipublisher.proxy-caching=${PROXY_CACHING}"
74
+
75
+ # ENV JAVA_TOOL_OPTIONS="\
76
+ # -Dfile.encoding=UTF8 \
77
+ # -Dsun.jnu.encoding=UTF-8 \
78
+ # -Djava.awt.headless=true \
79
+ # -Dorg.exist.db-connection.cacheSize=${CACHE_MEM:-256}M \
80
+ # -Dorg.exist.db-connection.pool.max=${MAX_BROKER:-20} \
81
+ # -Dlog4j.configurationFile=/exist/etc/log4j2.xml \
82
+ # -Dexist.home=/exist \
83
+ # -Dexist.configurationFile=/exist/etc/conf.xml \
84
+ # -Djetty.home=/exist \
85
+ # -Dexist.jetty.config=/exist/etc/jetty/standard.enabled-jetty-configs \
86
+ # -Dteipublisher.ner-endpoint=${NER_ENDPOINT} \
87
+ # -Dteipublisher.context-path=${CONTEXT_PATH} \
88
+ # -Dteipublisher.proxy-caching=${PROXY_CACHING} \
89
+ # -XX:+UseG1GC \
90
+ # -XX:+UseStringDeduplication \
91
+ # -XX:+UseContainerSupport \
92
+ # -XX:MaxRAMPercentage=${JVM_MAX_RAM_PERCENTAGE:-75.0} \
93
+ # -XX:+ExitOnOutOfMemoryError"
94
+
95
+ # pre-populate the database by launching it once and change default pw
96
+ RUN [ "java", "org.exist.start.Main", "client", "--no-gui", "-l", "-u", "admin", "-P", "" ]
97
+
98
+ EXPOSE ${HTTP_PORT} ${HTTPS_PORT}
@@ -1,5 +1,5 @@
1
- /*
2
- * Global component theme stylesheet
3
- *
4
- * Styles defined here are injected into a components' shadow DOM.
5
- */
1
+ /*
2
+ * Global component theme stylesheet
3
+ *
4
+ * Styles defined here are injected into a components' shadow DOM.
5
+ */
@@ -69,7 +69,7 @@
69
69
  // names
70
70
  pbEvents.subscribe('pb-update', 'transcription', (ev) => {
71
71
  // the HTML content to be displayed is passed in ev.detail.root
72
- const root = ev.detail.root;
72
+ const {root} = ev.detail;
73
73
  root.querySelectorAll('.tei-persName5, .tei-placeName5').forEach((name) => {
74
74
  // disable the popover behaviour
75
75
  name.command('disable', true);
@@ -44,7 +44,7 @@
44
44
  facsimiles='["15929_000_IDL5772_BOss12034_IIIp79.jpg", "15929_000_IDL5772_BOss12034_IIIp80.jpg", "15929_000_IDL5772_BOss12034_IIIp81.jpg", "15929_000_IDL5772_BOss12034_IIIp82.jpg",
45
45
  "does-not-exist.jpg"]'
46
46
  default-zoom-level="0" show-navigator show-sequence-control reference-strip
47
- show-navigation-control show-home-control show-rotation-control>
47
+ show-navigation-control show-home-control show-rotation-control show-full-page-control>
48
48
  <h3 slot="before">Facsimile Viewer Test</h3>
49
49
  <div slot="after">Status: <span id="status"></span></div>
50
50
  </pb-facsimile>
@@ -90,4 +90,4 @@
90
90
  </pb-demo-snippet>
91
91
  </body>
92
92
 
93
- </html>
93
+ </html>
@@ -57,7 +57,7 @@
57
57
  * which does itself send the `pb-update` event, e.g. `pb-view`.
58
58
  */
59
59
  document.addEventListener('WebComponentsReady', () => {
60
- pbEvents.subscribe('pb-ready', null, function() {
60
+ pbEvents.subscribe('pb-ready', null, () => {
61
61
  document.dispatchEvent(new CustomEvent('pb-update', {
62
62
  detail: {
63
63
  root: document.getElementById('locations')
@@ -49,9 +49,7 @@
49
49
  form.addEventListener('iron-form-presubmit', (ev) => {
50
50
  ev.preventDefault();
51
51
  const data = form.serializeForm();
52
- const queryString = Object.keys(data).map((key) => {
53
- return key + '=' + data[key]
54
- }).join('&');
52
+ const queryString = Object.keys(data).map((key) => `${key }=${ data[key]}`).join('&');
55
53
  document.getElementById('output').innerText = queryString;
56
54
  });
57
55
  });
@@ -65,7 +65,7 @@
65
65
  <script>
66
66
  window.addEventListener('DOMContentLoaded', () => {
67
67
  pbEvents.subscribe('before-transcription-update', 'transcription', (ev) => {
68
- const root = ev.detail.root;
68
+ const {root} = ev.detail;
69
69
  // walk through all .tei-name elements and insert a node before each
70
70
  root.querySelectorAll('.tei-name').forEach((name) => {
71
71
  // create a span with text 'Name' and orange color
@@ -1,4 +1,4 @@
1
- import{f as h,N as c,i as v}from"./pb-mixin-b1caa22e.js";import{h as t,P as z,y as a}from"./paper-checkbox-4f410b1f.js";
1
+ import{f as h,N as c,i as v}from"./pb-mixin-886ece32.js";import{h as t,P as z,y as a}from"./paper-checkbox-4f410b1f.js";
2
2
  /**
3
3
  * @license
4
4
  * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -1,22 +1,27 @@
1
- import{p as e,h as t,c as i,L as o}from"./pb-mixin-b1caa22e.js";import{J as n,X as s}from"./jinn-codemirror-da0e2d1f.js";import{t as r}from"./pb-i18n-0611135a.js";class l extends n{constructor(){super(),this.unwrap=!1,this.schema=null,this.schemaRoot=null}connectedCallback(){this.schema=this.getAttribute("schema"),this.schemaRoot=this.getAttribute("schema-root"),this.unwrap=this.hasAttribute("unwrap"),super.connectedCallback();const e=this.getAttribute("wrapper");if(e){const t=new DOMParser;let i=t.parseFromString(e,"application/xml"),o=i.getElementsByTagName("parsererror"),n=null;if(o.length)console.error("<jinn-xml-editor> Invalid XML for wrapper attribute: %s",(new XMLSerializer).serializeToString(i));else{if(n=i.firstElementChild,n&&this.hasAttribute("code")){const e=this.getAttribute("code")||"";i=t.parseFromString(e,"application/xml"),o=i.getElementsByTagName("parsererror"),o.length?console.error("<jinn-xml-editor> Invalid XML for code attribute: %s",(new XMLSerializer).serializeToString(i)):i.firstElementChild&&n.appendChild(i.firstElementChild)}this.setValue(n)}}}configure(){var e;const t=this.getToolbarControls(null==(e=this.shadowRoot)?void 0:e.querySelector("[name=toolbar]")),i=this.hasAttribute("check-namespace");this._config=new s(this,t,this.namespace,i,this.unwrap)}emitUpdateEvent(e){if(!this.unwrap)return super.emitUpdateEvent(e);this.updateValue(),super.emitUpdateEvent(this._wrapper)}updateValue(){var e,t;if(!this._wrapper)return console.log("no wrapper !!!"),null;if(this._wrapper.replaceChildren(),this._value)if(this._value instanceof NodeList)for(let t=0;t<this._value.length;t++){const i=this._wrapper.ownerDocument.importNode(this._value[t],!0);null==(e=this._wrapper)||e.appendChild(i)}else{if(!(this._value instanceof Node))throw console.error("<xml-editor> Value is not a node"),new Error("value is not a node");null==(t=this._wrapper)||t.appendChild(this._value)}else console.log("xml editor value is empty")}setValue(e){var t,i;if(!this.unwrap)return super.setValue(e);if((null==(t=this._config)?void 0:t.setFromValue(this._wrapper))===(null==(i=this._config)?void 0:i.setFromValue(e)))return!1;if(e||(this._wrapper=null),"string"==typeof e){const t=(new DOMParser).parseFromString(e,"application/xml");if(!t.firstElementChild)return!1;e=t.firstElementChild}return this._wrapper=e,this._value=null==e?void 0:e.childNodes,!0}getValue(){if(!this.unwrap)return super.getValue();if(!this._wrapper)return null;if(!(this._wrapper instanceof Element))throw new Error("Value is not a node");return this.updateValue(),this._wrapper}}customElements.get("jinn-xml-editor")||window.customElements.define("jinn-xml-editor",l);const a='\n :host {\n display: block;\n width: 100%;\n }\n jinn-codemirror {\n font-size: 1rem;\n display:block;\n width:100%;\n }\n jinn-codemirror[valid="true"] {\n outline: thin solid green;\n }\n jinn-codemirror[valid="false"] {\n outline: thin solid red;\n }\n #leiden-editor {\n margin-bottom:0.5rem;\n }\n [slot=toolbar] {\n display: flex;\n }\n .hidden {\n display: none;\n }\n #close-leiden {\n margin-left: .75rem;\n font-weight: bold;\n }',d=["Shift","Alt","Meta","Control","ArrowLeft","ArrowRight","ArrowDown","ArrowUp","PageDown","PageUp","Home","End"],h={leiden_plus:"Leiden+",edcs:"EDCS/EDH",default:"Petrae"};function c(e){const t=[];return Object.entries(h).forEach(([i,o])=>{t.push(`<option value="${i}" ${i===e?"selected":""}>${o}</option>`)}),`<select name="modes">${t.join("\n")}</select>`}class u extends HTMLElement{constructor(){super(),this.mode="leiden_plus",this.placeholder="",this.showLeiden=!1,this.xmlEditor=null,this.valid=!0,this.unwrap=!1,this.schema=null,this.schemaRoot=null,this.modeSelect=!1,this.attachShadow({mode:"open"})}set value(e){this.xmlEditor.value=e}get value(){return this.xmlEditor.value}connectedCallback(){var e,t,i,o;this.unwrap=this.hasAttribute("unwrap"),this.schema=this.getAttribute("schema"),this.schemaRoot=this.getAttribute("schema-root"),this.modeSelect=this.hasAttribute("mode-select"),this.mode=this.getAttribute("mode")||"leiden_plus",this.placeholder=this.getAttribute("placeholder")||"",this.showLeiden=this.hasAttribute("show-leiden"),this.shadowRoot.innerHTML=`\n <style>\n ${a}\n </style>\n <jinn-codemirror id="leiden-editor" class="${this.showLeiden?"":"hidden"}" mode="${this.mode}">\n <div slot="toolbar">\n ${this.modeSelect?c(this.mode):""}\n <slot name="leiden-toolbar"></slot>\n <button part="button" id="close-leiden">Close</button>\n </div>\n </jinn-codemirror>\n <jinn-xml-editor id="xml-editor" ${this.unwrap?"unwrap":""} schema="${this.schema}"\n schema-root="${this.schemaRoot}" placeholder="${this.placeholder}">\n <div slot="toolbar">\n <button part="button" id="import" title="Import from Leiden markup">Leiden Editor</button>\n <slot name="xml-toolbar"></slot>\n </div>\n </jinn-xml-editor>\n `,this.xmlEditor=null==(e=this.shadowRoot)?void 0:e.querySelector("#xml-editor");const n=null==(t=this.shadowRoot)?void 0:t.querySelector("#leiden-editor"),s=null==(i=this.shadowRoot)?void 0:i.querySelector("#import"),r=null==(o=this.shadowRoot)?void 0:o.querySelector("#close-leiden");if(!(this.xmlEditor&&n&&s&&r))throw new Error("One or more components were not initialized");let l=!0,h=this.showLeiden;n.addEventListener("update",e=>{e.stopPropagation(),this.showLeiden=!1,l&&(this.xmlEditor.content=e.detail.content),l=!0}),this.xmlEditor.addEventListener("keyup",e=>{if(h){if(d.indexOf(e.key)>-1)return;p()}});const u=()=>{s.classList.add("hidden"),n.classList.remove("hidden"),h=!0,n.focus()},p=()=>{var e;n.classList.add("hidden"),s.classList.remove("hidden"),h=!1,null==(e=this.xmlEditor)||e.focus(),l=!1,null==n||n.clear()},m=()=>{var e;if(n.classList.contains("hidden")||this.showLeiden)if(this.xmlEditor.content.length>0){if(!this.valid)return void alert("The XML contains errors. Cannot convert to Leiden+");const t=null==(e=this.xmlEditor)?void 0:e.value;l=!1,n.setMode("leiden_plus",!1),u(),this.unwrap&&t instanceof Element?n.value=t.childNodes:n.value=t}else u(),n.value="";else p()};s.addEventListener("click",()=>{m()}),r.addEventListener("click",()=>{p()}),this.xmlEditor.addEventListener("invalid",e=>{e.stopPropagation(),this.valid=!1,this.setAttribute("valid",this.valid.toString()),this.dispatchEvent(new CustomEvent("invalid",{detail:e.detail,composed:!0,bubbles:!0}))}),this.xmlEditor.addEventListener("valid",e=>{e.stopPropagation(),this.valid=!0,this.setAttribute("valid",this.valid.toString()),this.dispatchEvent(new CustomEvent("valid",{detail:e.detail,composed:!0,bubbles:!0}))}),this.xmlEditor.addEventListener("update",()=>{this.showLeiden&&m(),this.showLeiden=!1},{once:!0})}}customElements.get("jinn-epidoc-editor")||window.customElements.define("jinn-epidoc-editor",u);class p extends(e(o)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{code:{type:String,reflect:!0},mode:{type:String},label:{type:String},placeholder:{type:String},tabSize:{type:Number},linter:{attribute:!0}})}constructor(){super(),this.code="",this.mode="xml",this.placeholder="odd.editor.model.empty",this.tabSize=2,this.label="",this.linter="",this._editor=null}connectedCallback(){super.connectedCallback()}firstUpdated(){super.firstUpdated(),this._editor=this.shadowRoot.getElementById("editor")}render(){return t`
2
- <div class="label">${this.label}</div>
3
- <jinn-codemirror id="editor" mode="${this.mode}" code="${this.code}" placeholder="${r(this.placeholder)}"></jinn-codemirror>
4
- `}getSource(){return this._editor?this._editor.value:""}_setCode(){this.dispatchEvent(new CustomEvent("code-changed",{composed:!0,bubbles:!0,detail:{code:this.getSource()}}))}refresh(){}static get styles(){return i`
5
- :host {
6
- display: block;
7
- width: 100%;
8
- margin: 0;
9
- position: relative;
10
- color:inherit;
11
- }
1
+ import{p as e,h as t,c as i,L as o}from"./pb-mixin-886ece32.js";import{J as n,X as s}from"./jinn-codemirror-da0e2d1f.js";import{t as r}from"./pb-i18n-4cc00bfe.js";class l extends n{constructor(){super(),this.unwrap=!1,this.schema=null,this.schemaRoot=null}connectedCallback(){this.schema=this.getAttribute("schema"),this.schemaRoot=this.getAttribute("schema-root"),this.unwrap=this.hasAttribute("unwrap"),super.connectedCallback();const e=this.getAttribute("wrapper");if(e){const t=new DOMParser;let i=t.parseFromString(e,"application/xml"),o=i.getElementsByTagName("parsererror"),n=null;if(o.length)console.error("<jinn-xml-editor> Invalid XML for wrapper attribute: %s",(new XMLSerializer).serializeToString(i));else{if(n=i.firstElementChild,n&&this.hasAttribute("code")){const e=this.getAttribute("code")||"";i=t.parseFromString(e,"application/xml"),o=i.getElementsByTagName("parsererror"),o.length?console.error("<jinn-xml-editor> Invalid XML for code attribute: %s",(new XMLSerializer).serializeToString(i)):i.firstElementChild&&n.appendChild(i.firstElementChild)}this.setValue(n)}}}configure(){var e;const t=this.getToolbarControls(null==(e=this.shadowRoot)?void 0:e.querySelector("[name=toolbar]")),i=this.hasAttribute("check-namespace");this._config=new s(this,t,this.namespace,i,this.unwrap)}emitUpdateEvent(e){if(!this.unwrap)return super.emitUpdateEvent(e);this.updateValue(),super.emitUpdateEvent(this._wrapper)}updateValue(){var e,t;if(!this._wrapper)return console.log("no wrapper !!!"),null;if(this._wrapper.replaceChildren(),this._value)if(this._value instanceof NodeList)for(let t=0;t<this._value.length;t++){const i=this._wrapper.ownerDocument.importNode(this._value[t],!0);null==(e=this._wrapper)||e.appendChild(i)}else{if(!(this._value instanceof Node))throw console.error("<xml-editor> Value is not a node"),new Error("value is not a node");null==(t=this._wrapper)||t.appendChild(this._value)}else console.log("xml editor value is empty")}setValue(e){var t,i;if(!this.unwrap)return super.setValue(e);if((null==(t=this._config)?void 0:t.setFromValue(this._wrapper))===(null==(i=this._config)?void 0:i.setFromValue(e)))return!1;if(e||(this._wrapper=null),"string"==typeof e){const t=(new DOMParser).parseFromString(e,"application/xml");if(!t.firstElementChild)return!1;e=t.firstElementChild}return this._wrapper=e,this._value=null==e?void 0:e.childNodes,!0}getValue(){if(!this.unwrap)return super.getValue();if(!this._wrapper)return null;if(!(this._wrapper instanceof Element))throw new Error("Value is not a node");return this.updateValue(),this._wrapper}}customElements.get("jinn-xml-editor")||window.customElements.define("jinn-xml-editor",l);const a='\n :host {\n display: block;\n width: 100%;\n }\n jinn-codemirror {\n font-size: 1rem;\n display:block;\n width:100%;\n }\n jinn-codemirror[valid="true"] {\n outline: thin solid green;\n }\n jinn-codemirror[valid="false"] {\n outline: thin solid red;\n }\n #leiden-editor {\n margin-bottom:0.5rem;\n }\n [slot=toolbar] {\n display: flex;\n }\n .hidden {\n display: none;\n }\n #close-leiden {\n margin-left: .75rem;\n font-weight: bold;\n }',d=["Shift","Alt","Meta","Control","ArrowLeft","ArrowRight","ArrowDown","ArrowUp","PageDown","PageUp","Home","End"],h={leiden_plus:"Leiden+",edcs:"EDCS/EDH",default:"Petrae"};function c(e){const t=[];return Object.entries(h).forEach(([i,o])=>{t.push(`<option value="${i}" ${i===e?"selected":""}>${o}</option>`)}),`<select name="modes">${t.join("\n")}</select>`}class u extends HTMLElement{constructor(){super(),this.mode="leiden_plus",this.placeholder="",this.showLeiden=!1,this.xmlEditor=null,this.valid=!0,this.unwrap=!1,this.schema=null,this.schemaRoot=null,this.modeSelect=!1,this.attachShadow({mode:"open"})}set value(e){this.xmlEditor.value=e}get value(){return this.xmlEditor.value}connectedCallback(){var e,t,i,o;this.unwrap=this.hasAttribute("unwrap"),this.schema=this.getAttribute("schema"),this.schemaRoot=this.getAttribute("schema-root"),this.modeSelect=this.hasAttribute("mode-select"),this.mode=this.getAttribute("mode")||"leiden_plus",this.placeholder=this.getAttribute("placeholder")||"",this.showLeiden=this.hasAttribute("show-leiden"),this.shadowRoot.innerHTML=`\n <style>\n ${a}\n </style>\n <jinn-codemirror id="leiden-editor" class="${this.showLeiden?"":"hidden"}" mode="${this.mode}">\n <div slot="toolbar">\n ${this.modeSelect?c(this.mode):""}\n <slot name="leiden-toolbar"></slot>\n <button part="button" id="close-leiden">Close</button>\n </div>\n </jinn-codemirror>\n <jinn-xml-editor id="xml-editor" ${this.unwrap?"unwrap":""} schema="${this.schema}"\n schema-root="${this.schemaRoot}" placeholder="${this.placeholder}">\n <div slot="toolbar">\n <button part="button" id="import" title="Import from Leiden markup">Leiden Editor</button>\n <slot name="xml-toolbar"></slot>\n </div>\n </jinn-xml-editor>\n `,this.xmlEditor=null==(e=this.shadowRoot)?void 0:e.querySelector("#xml-editor");const n=null==(t=this.shadowRoot)?void 0:t.querySelector("#leiden-editor"),s=null==(i=this.shadowRoot)?void 0:i.querySelector("#import"),r=null==(o=this.shadowRoot)?void 0:o.querySelector("#close-leiden");if(!(this.xmlEditor&&n&&s&&r))throw new Error("One or more components were not initialized");let l=!0,h=this.showLeiden;n.addEventListener("update",e=>{e.stopPropagation(),this.showLeiden=!1,l&&(this.xmlEditor.content=e.detail.content),l=!0}),this.xmlEditor.addEventListener("keyup",e=>{if(h){if(d.indexOf(e.key)>-1)return;p()}});const u=()=>{s.classList.add("hidden"),n.classList.remove("hidden"),h=!0,n.focus()},p=()=>{var e;n.classList.add("hidden"),s.classList.remove("hidden"),h=!1,null==(e=this.xmlEditor)||e.focus(),l=!1,null==n||n.clear()},m=()=>{var e;if(n.classList.contains("hidden")||this.showLeiden)if(this.xmlEditor.content.length>0){if(!this.valid)return void alert("The XML contains errors. Cannot convert to Leiden+");const t=null==(e=this.xmlEditor)?void 0:e.value;l=!1,n.setMode("leiden_plus",!1),u(),this.unwrap&&t instanceof Element?n.value=t.childNodes:n.value=t}else u(),n.value="";else p()};s.addEventListener("click",()=>{m()}),r.addEventListener("click",()=>{p()}),this.xmlEditor.addEventListener("invalid",e=>{e.stopPropagation(),this.valid=!1,this.setAttribute("valid",this.valid.toString()),this.dispatchEvent(new CustomEvent("invalid",{detail:e.detail,composed:!0,bubbles:!0}))}),this.xmlEditor.addEventListener("valid",e=>{e.stopPropagation(),this.valid=!0,this.setAttribute("valid",this.valid.toString()),this.dispatchEvent(new CustomEvent("valid",{detail:e.detail,composed:!0,bubbles:!0}))}),this.xmlEditor.addEventListener("update",()=>{this.showLeiden&&m(),this.showLeiden=!1},{once:!0})}}customElements.get("jinn-epidoc-editor")||window.customElements.define("jinn-epidoc-editor",u);class p extends(e(o)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{code:{type:String,reflect:!0},mode:{type:String},label:{type:String},placeholder:{type:String},tabSize:{type:Number},linter:{attribute:!0}})}constructor(){super(),this.code="",this.mode="xml",this.placeholder="odd.editor.model.empty",this.tabSize=2,this.label="",this.linter="",this._editor=null}connectedCallback(){super.connectedCallback()}firstUpdated(){super.firstUpdated(),this._editor=this.shadowRoot.getElementById("editor")}render(){return t`
2
+ <div class="label">${this.label}</div>
3
+ <jinn-codemirror
4
+ id="editor"
5
+ mode="${this.mode}"
6
+ code="${this.code}"
7
+ placeholder="${r(this.placeholder)}"
8
+ ></jinn-codemirror>
9
+ `}getSource(){return this._editor?this._editor.value:""}_setCode(){this.dispatchEvent(new CustomEvent("code-changed",{composed:!0,bubbles:!0,detail:{code:this.getSource()}}))}refresh(){}static get styles(){return i`
10
+ :host {
11
+ display: block;
12
+ width: 100%;
13
+ margin: 0;
14
+ position: relative;
15
+ color: inherit;
16
+ }
12
17
 
13
- #editor {
14
- width: 100%;
15
- height: auto;
16
- }
18
+ #editor {
19
+ width: 100%;
20
+ height: auto;
21
+ }
17
22
 
18
- .label {
19
- color: var(--paper-grey-500);
20
- margin-bottom:5px;
21
- }
22
- `}}customElements.define("pb-code-editor",p);export{p as PbCodeEditor};
23
+ .label {
24
+ color: var(--paper-grey-500);
25
+ margin-bottom: 5px;
26
+ }
27
+ `}}customElements.define("pb-code-editor",p);export{p as PbCodeEditor};