@teipublisher/pb-components 2.26.0-next-3.12 → 2.26.0-next-3.13

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 (132) 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 +30 -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-leaflet-map.html +1 -1
  9. package/dist/demo/pb-progress.html +2 -2
  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 +1937 -1782
  16. package/dist/pb-edit-app.js +167 -107
  17. package/dist/pb-elements.json +45 -45
  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 +923 -756
  23. package/dist/pb-tify.js +2 -2
  24. package/dist/{vaadin-element-mixin-49ab4037.js → vaadin-element-mixin-84fb7d82.js} +178 -163
  25. package/gh-pages.js +5 -3
  26. package/i18n/common/pl.json +2 -2
  27. package/lib/openseadragon.min.js +1 -1
  28. package/package.json +2 -2
  29. package/pb-elements.json +45 -45
  30. package/src/assets/components.css +5 -5
  31. package/src/authority/airtable.js +20 -21
  32. package/src/authority/anton.js +129 -129
  33. package/src/authority/custom.js +23 -21
  34. package/src/authority/geonames.js +38 -32
  35. package/src/authority/gnd.js +47 -42
  36. package/src/authority/kbga.js +137 -134
  37. package/src/authority/metagrid.js +44 -46
  38. package/src/authority/reconciliation.js +66 -67
  39. package/src/authority/registry.js +4 -4
  40. package/src/docs/pb-component-docs.js +2 -2
  41. package/src/docs/pb-component-view.js +5 -5
  42. package/src/docs/pb-components-list.js +2 -2
  43. package/src/docs/pb-demo-snippet.js +2 -2
  44. package/src/dts-client.js +299 -297
  45. package/src/dts-select-endpoint.js +90 -82
  46. package/src/parse-date-service.js +184 -135
  47. package/src/pb-ajax.js +150 -146
  48. package/src/pb-authority-lookup.js +183 -146
  49. package/src/pb-autocomplete.js +292 -280
  50. package/src/pb-blacklab-highlight.js +264 -259
  51. package/src/pb-blacklab-results.js +236 -221
  52. package/src/pb-browse-docs.js +540 -475
  53. package/src/pb-browse.js +68 -65
  54. package/src/pb-clipboard.js +79 -76
  55. package/src/pb-code-editor.js +110 -102
  56. package/src/pb-code-highlight.js +209 -204
  57. package/src/pb-codepen.js +79 -72
  58. package/src/pb-collapse.js +212 -207
  59. package/src/pb-combo-box.js +190 -190
  60. package/src/pb-components-bundle.js +1 -1
  61. package/src/pb-custom-form.js +151 -149
  62. package/src/pb-dialog.js +94 -85
  63. package/src/pb-document.js +89 -90
  64. package/src/pb-download.js +210 -198
  65. package/src/pb-drawer.js +145 -148
  66. package/src/pb-edit-app.js +301 -229
  67. package/src/pb-edit-xml.js +98 -96
  68. package/src/pb-events.js +114 -107
  69. package/src/pb-facs-link.js +104 -102
  70. package/src/pb-facsimile.js +411 -413
  71. package/src/pb-formula.js +151 -153
  72. package/src/pb-geolocation.js +129 -131
  73. package/src/pb-grid-action.js +53 -56
  74. package/src/pb-grid.js +231 -228
  75. package/src/pb-highlight.js +140 -140
  76. package/src/pb-hotkeys.js +40 -42
  77. package/src/pb-i18n.js +101 -104
  78. package/src/pb-image-strip.js +84 -78
  79. package/src/pb-lang.js +132 -128
  80. package/src/pb-leaflet-map.js +488 -485
  81. package/src/pb-link.js +126 -124
  82. package/src/pb-load.js +431 -426
  83. package/src/pb-login.js +291 -248
  84. package/src/pb-manage-odds.js +364 -318
  85. package/src/pb-map-icon.js +89 -89
  86. package/src/pb-map-layer.js +85 -85
  87. package/src/pb-markdown.js +90 -99
  88. package/src/pb-media-query.js +74 -72
  89. package/src/pb-mei.js +306 -295
  90. package/src/pb-message.js +144 -144
  91. package/src/pb-mixin.js +269 -264
  92. package/src/pb-navigation.js +80 -82
  93. package/src/pb-observable.js +38 -38
  94. package/src/pb-odd-editor.js +1053 -955
  95. package/src/pb-odd-elementspec-editor.js +348 -297
  96. package/src/pb-odd-model-editor.js +1061 -901
  97. package/src/pb-odd-parameter-editor.js +200 -178
  98. package/src/pb-odd-rendition-editor.js +136 -124
  99. package/src/pb-page.js +431 -421
  100. package/src/pb-paginate.js +202 -190
  101. package/src/pb-panel.js +191 -179
  102. package/src/pb-popover-themes.js +7 -5
  103. package/src/pb-popover.js +296 -287
  104. package/src/pb-print-preview.js +127 -127
  105. package/src/pb-progress.js +51 -51
  106. package/src/pb-repeat.js +105 -104
  107. package/src/pb-restricted.js +84 -77
  108. package/src/pb-search.js +252 -241
  109. package/src/pb-select-feature.js +127 -120
  110. package/src/pb-select-odd.js +132 -124
  111. package/src/pb-select-template.js +89 -78
  112. package/src/pb-select.js +251 -227
  113. package/src/pb-split-list.js +179 -174
  114. package/src/pb-svg.js +80 -79
  115. package/src/pb-table-column.js +54 -54
  116. package/src/pb-table-grid.js +221 -203
  117. package/src/pb-tabs.js +61 -63
  118. package/src/pb-tify.js +154 -154
  119. package/src/pb-timeline.js +271 -229
  120. package/src/pb-toggle-feature.js +182 -175
  121. package/src/pb-upload.js +184 -174
  122. package/src/pb-version.js +30 -30
  123. package/src/pb-view-annotate.js +132 -98
  124. package/src/pb-view.js +1289 -1270
  125. package/src/pb-zoom.js +75 -59
  126. package/src/polymer-hack.js +1 -1
  127. package/src/search-result-service.js +256 -223
  128. package/src/seed-element.js +13 -20
  129. package/src/settings.js +4 -4
  130. package/src/theming.js +96 -96
  131. package/src/urls.js +289 -289
  132. 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.26.0-next-3.13](https://github.com/eeditiones/tei-publisher-components/compare/v2.26.0-next-3.12...v2.26.0-next-3.13) (2025-09-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **docker:** allign image ([45fcfe6](https://github.com/eeditiones/tei-publisher-components/commit/45fcfe682d4413baaf6413e3801201f46d7b0f0a)), closes [#244](https://github.com/eeditiones/tei-publisher-components/issues/244)
7
+ * **docker:** minor fixes ([34ad702](https://github.com/eeditiones/tei-publisher-components/commit/34ad702e6e72455096421cfa6f77a9a921cf2b31))
8
+ * **i18n:** correct pl labels ([f861af7](https://github.com/eeditiones/tei-publisher-components/commit/f861af774050accc0a5479ae40a5be94c8f87f2f))
9
+ * **pb-dialog:** any button with [rel="prev"] should close the dialog ([9c8c7f0](https://github.com/eeditiones/tei-publisher-components/commit/9c8c7f0ac24ffb139fd71dcc5e58922a1488e165))
10
+
11
+
12
+ ### Features
13
+
14
+ * **pb-progress:** replace paper-progress with native progres ([5ce49f1](https://github.com/eeditiones/tei-publisher-components/commit/5ce49f19abda1f37f884d977a0cc5204d690f290))
15
+
1
16
  # [2.26.0-next-3.12](https://github.com/eeditiones/tei-publisher-components/compare/v2.26.0-next-3.11...v2.26.0-next-3.12) (2025-08-31)
2
17
 
3
18
 
@@ -109,6 +124,21 @@
109
124
  * **pb-login:** drop polymer, use pb-dialog ([ffee19f](https://github.com/eeditiones/tei-publisher-components/commit/ffee19fa27f1e8520c8c3e9a877100b981e38ddf))
110
125
  * **pb-message:** replace paper-dialog with pb-dialog ([e60c401](https://github.com/eeditiones/tei-publisher-components/commit/e60c401153bd2756c0d081a09e70f2be31ab2526))
111
126
 
127
+ ## [2.25.6](https://github.com/eeditiones/tei-publisher-components/compare/v2.25.5...v2.25.6) (2025-09-09)
128
+
129
+
130
+ ### Bug Fixes
131
+
132
+ * **docker:** allign image ([45fcfe6](https://github.com/eeditiones/tei-publisher-components/commit/45fcfe682d4413baaf6413e3801201f46d7b0f0a)), closes [#244](https://github.com/eeditiones/tei-publisher-components/issues/244)
133
+ * **docker:** minor fixes ([34ad702](https://github.com/eeditiones/tei-publisher-components/commit/34ad702e6e72455096421cfa6f77a9a921cf2b31))
134
+
135
+ ## [2.25.5](https://github.com/eeditiones/tei-publisher-components/compare/v2.25.4...v2.25.5) (2025-08-16)
136
+
137
+
138
+ ### Bug Fixes
139
+
140
+ * **i18n:** correct pl labels ([f861af7](https://github.com/eeditiones/tei-publisher-components/commit/f861af774050accc0a5479ae40a5be94c8f87f2f))
141
+
112
142
  ## [2.25.4](https://github.com/eeditiones/tei-publisher-components/compare/v2.25.3...v2.25.4) (2025-06-04)
113
143
 
114
144
 
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);
@@ -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')
@@ -32,11 +32,11 @@
32
32
  if (started) {
33
33
  started = false;
34
34
  btn.innerHTML = 'Click to start';
35
- document.dispatchEvent(new CustomEvent('pb-end-update'));
35
+ pbEvents.emit('pb-end-update');
36
36
  } else {
37
37
  started = true;
38
38
  btn.innerHTML = 'Click to stop';
39
- document.dispatchEvent(new CustomEvent('pb-start-update'));
39
+ pbEvents.emit('pb-start-update');
40
40
  }
41
41
  });
42
42
  </script>
@@ -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};