@teipublisher/pb-components 2.26.1-next.3 → 3.0.0-next-4.1

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 (262) hide show
  1. package/.github/workflows/docker-cypress.yml +54 -0
  2. package/.github/workflows/main.yml +6 -4
  3. package/.github/workflows/node.js.yml +56 -21
  4. package/.github/workflows/release.js.yml +19 -17
  5. package/.releaserc.json +1 -1
  6. package/CHANGELOG.md +346 -11
  7. package/Dockerfile +78 -70
  8. package/README.md +112 -4
  9. package/css/components.css +5 -5
  10. package/css/gridjs/mermaid.min.css +1 -1
  11. package/css/leaflet/Control.Geocoder.css +1 -126
  12. package/css/leaflet/images/layers.png +0 -0
  13. package/css/tify/tify.css +6 -5
  14. package/css/tom-select/tom-select.bootstrap4.min.css +1 -1
  15. package/css/tom-select/tom-select.bootstrap5.min.css +1 -1
  16. package/css/tom-select/tom-select.default.min.css +1 -1
  17. package/css/tom-select/tom-select.default.min.css.map +1 -0
  18. package/css/tom-select/tom-select.min.css +1 -1
  19. package/cypress.config.js +84 -0
  20. package/dist/api.html +1 -1
  21. package/dist/css/design-system.css +607 -0
  22. package/dist/demo/bundle-test.html +4 -3
  23. package/dist/demo/components.css +46 -1
  24. package/dist/demo/design-system.html +710 -0
  25. package/dist/demo/dts-client.html +2 -2
  26. package/dist/demo/pb-autocomplete.html +23 -11
  27. package/dist/demo/pb-autocomplete2.html +66 -55
  28. package/dist/demo/pb-autocomplete3.html +17 -8
  29. package/dist/demo/pb-blacklab-highlight.html +28 -11
  30. package/dist/demo/pb-blacklab-results.html +3 -2
  31. package/dist/demo/pb-browse-docs.html +24 -24
  32. package/dist/demo/pb-browse-docs2.html +3 -3
  33. package/dist/demo/pb-clipboard.html +32 -28
  34. package/dist/demo/pb-code-editor.html +6 -6
  35. package/dist/demo/pb-code-highlight.html +63 -63
  36. package/dist/demo/pb-codepen.html +1 -1
  37. package/dist/demo/pb-collapse.html +1 -1
  38. package/dist/demo/pb-collapse2.html +2 -2
  39. package/dist/demo/pb-combo-box.html +135 -130
  40. package/dist/demo/pb-custom-form.html +64 -55
  41. package/dist/demo/pb-dialog.html +12 -6
  42. package/dist/demo/pb-document.html +1 -1
  43. package/dist/demo/pb-download.html +68 -59
  44. package/dist/demo/pb-drawer.html +67 -46
  45. package/dist/demo/pb-drawer2.html +65 -58
  46. package/dist/demo/pb-edit-app.html +2 -2
  47. package/dist/demo/pb-edit-xml.html +1 -1
  48. package/dist/demo/pb-facsimile-2.html +26 -11
  49. package/dist/demo/pb-facsimile-3.html +25 -10
  50. package/dist/demo/pb-facsimile-dedup-test-2.html +48 -0
  51. package/dist/demo/pb-facsimile-dedup-test.html +48 -0
  52. package/dist/demo/pb-facsimile.html +4 -4
  53. package/dist/demo/pb-formula.html +1 -1
  54. package/dist/demo/pb-grid.html +22 -8
  55. package/dist/demo/pb-highlight.html +2 -2
  56. package/dist/demo/pb-i18n-simple.html +1 -0
  57. package/dist/demo/pb-i18n.html +15 -5
  58. package/dist/demo/pb-image-strip-standalone.html +2 -2
  59. package/dist/demo/pb-image-strip-view.html +2 -2
  60. package/dist/demo/pb-leaflet-map.html +3 -3
  61. package/dist/demo/pb-leaflet-map2.html +2 -2
  62. package/dist/demo/pb-leaflet-map3.html +3 -3
  63. package/dist/demo/pb-link.html +1 -1
  64. package/dist/demo/pb-load.html +2 -6
  65. package/dist/demo/pb-login.html +1 -3
  66. package/dist/demo/pb-manage-odds.html +9 -4
  67. package/dist/demo/pb-markdown.html +1 -1
  68. package/dist/demo/pb-media-query.html +2 -2
  69. package/dist/demo/pb-mei.html +2 -2
  70. package/dist/demo/pb-mei2.html +2 -2
  71. package/dist/demo/pb-message.html +2 -3
  72. package/dist/demo/pb-odd-editor.html +54 -52
  73. package/dist/demo/pb-page-header.html +27 -0
  74. package/dist/demo/pb-popover.html +1 -1
  75. package/dist/demo/pb-print-preview.html +2 -2
  76. package/dist/demo/pb-progress.html +4 -4
  77. package/dist/demo/pb-repeat.html +32 -36
  78. package/dist/demo/pb-search.html +16 -5
  79. package/dist/demo/pb-search2.html +4 -4
  80. package/dist/demo/pb-search3.html +3 -3
  81. package/dist/demo/pb-search4.html +3 -3
  82. package/dist/demo/pb-select-feature.html +4 -4
  83. package/dist/demo/pb-select-feature2.html +4 -4
  84. package/dist/demo/pb-select-feature3.html +2 -2
  85. package/dist/demo/pb-select-i18n.html +58 -53
  86. package/dist/demo/pb-select-odd.html +1 -1
  87. package/dist/demo/pb-select.html +190 -75
  88. package/dist/demo/pb-select2.html +91 -37
  89. package/dist/demo/pb-select3.html +109 -41
  90. package/dist/demo/pb-svg.html +1 -1
  91. package/dist/demo/pb-table-grid.html +26 -15
  92. package/dist/demo/pb-tabs.html +15 -7
  93. package/dist/demo/pb-tify.html +7 -7
  94. package/dist/demo/pb-timeline.html +1 -1
  95. package/dist/demo/pb-timeline2.html +1 -1
  96. package/dist/demo/pb-toggle-feature.html +26 -23
  97. package/dist/demo/pb-toggle-feature2.html +4 -4
  98. package/dist/demo/pb-toggle-feature3.html +2 -2
  99. package/dist/demo/pb-toggle-feature4.html +56 -54
  100. package/dist/demo/pb-version.html +2 -2
  101. package/dist/demo/pb-view.html +78 -40
  102. package/dist/demo/pb-view2.html +69 -46
  103. package/dist/demo/pb-view3.html +53 -48
  104. package/dist/demo/pb-view4.html +70 -49
  105. package/dist/demo/pb-zoom.html +2 -2
  106. package/dist/{es-global-bridge-d8ce175d.js → es-global-bridge-D8ZcUcx_.js} +0 -4
  107. package/dist/focus-mixin-VCsFap6b.js +768 -0
  108. package/dist/images/icons.svg +217 -0
  109. package/dist/jinn-codemirror-DETLdm08.js +1 -0
  110. package/dist/lib/openseadragon.min.js +80 -0
  111. package/dist/lib/openseadragon.min.js.map +1 -0
  112. package/dist/pb-code-editor.js +25 -20
  113. package/dist/pb-component-docs.js +414 -3225
  114. package/dist/pb-components-bundle.js +3046 -4402
  115. package/dist/pb-dialog-tklYGWfc.js +121 -0
  116. package/dist/pb-edit-app.js +208 -107
  117. package/dist/pb-elements.json +716 -249
  118. package/dist/pb-facsimile.js +46 -0
  119. package/dist/pb-i18n-C0NDma4h.js +1 -0
  120. package/dist/pb-leaflet-map.js +23 -23
  121. package/dist/pb-mei.js +152 -134
  122. package/dist/pb-mixin-DHoWQheB.js +1 -0
  123. package/dist/pb-odd-editor.js +1671 -1231
  124. package/dist/pb-tify.js +1 -27
  125. package/dist/unsafe-html-D5VGo9Oq.js +1 -0
  126. package/dist/urls-BEONu_g4.js +1 -0
  127. package/eslint.config.mjs +92 -0
  128. package/gh-pages.js +5 -3
  129. package/i18n/common/en.json +6 -0
  130. package/i18n/common/pl.json +2 -2
  131. package/images/icons.svg +217 -0
  132. package/index.html +0 -5
  133. package/lib/leaflet-src.js.map +1 -0
  134. package/lib/leaflet.markercluster-src.js.map +1 -0
  135. package/lib/openseadragon.min.js +6 -6
  136. package/package.json +56 -81
  137. package/pb-elements.json +716 -249
  138. package/rollup.config.mjs +312 -0
  139. package/src/assets/components.css +5 -5
  140. package/src/assets/design-system.css +607 -0
  141. package/src/authority/airtable.js +20 -21
  142. package/src/authority/anton.js +129 -129
  143. package/src/authority/custom.js +70 -27
  144. package/src/authority/geonames.js +38 -32
  145. package/src/authority/gnd.js +50 -42
  146. package/src/authority/kbga.js +136 -134
  147. package/src/authority/metagrid.js +44 -46
  148. package/src/authority/reconciliation.js +66 -68
  149. package/src/authority/registry.js +4 -4
  150. package/src/docs/demo-utils.js +91 -0
  151. package/src/docs/pb-component-docs.js +287 -147
  152. package/src/docs/pb-component-view.js +380 -273
  153. package/src/docs/pb-components-list.js +115 -51
  154. package/src/docs/pb-demo-snippet.js +199 -174
  155. package/src/dts-client.js +306 -303
  156. package/src/dts-select-endpoint.js +125 -85
  157. package/src/parse-date-service.js +184 -135
  158. package/src/pb-ajax.js +175 -173
  159. package/src/pb-authority-lookup.js +198 -158
  160. package/src/pb-autocomplete.js +731 -313
  161. package/src/pb-blacklab-highlight.js +266 -260
  162. package/src/pb-blacklab-results.js +230 -225
  163. package/src/pb-browse-docs.js +601 -484
  164. package/src/pb-browse.js +68 -65
  165. package/src/pb-clipboard.js +97 -76
  166. package/src/pb-code-editor.js +111 -103
  167. package/src/pb-code-highlight.js +234 -204
  168. package/src/pb-codepen.js +81 -73
  169. package/src/pb-collapse.js +265 -152
  170. package/src/pb-combo-box.js +191 -191
  171. package/src/pb-components-bundle.js +1 -7
  172. package/src/pb-components.js +2 -6
  173. package/src/pb-custom-form.js +230 -141
  174. package/src/pb-dialog.js +99 -63
  175. package/src/pb-document.js +118 -91
  176. package/src/pb-download.js +214 -198
  177. package/src/pb-drawer.js +146 -149
  178. package/src/pb-edit-app.js +471 -240
  179. package/src/pb-edit-xml.js +101 -98
  180. package/src/pb-events.js +126 -107
  181. package/src/pb-facs-link.js +130 -101
  182. package/src/pb-facsimile.js +494 -410
  183. package/src/pb-fetch.js +389 -0
  184. package/src/pb-formula.js +152 -154
  185. package/src/pb-geolocation.js +130 -132
  186. package/src/pb-grid-action.js +59 -56
  187. package/src/pb-grid.js +388 -228
  188. package/src/pb-highlight.js +142 -142
  189. package/src/pb-hotkeys.js +40 -42
  190. package/src/pb-i18n.js +115 -127
  191. package/src/pb-icon-button.js +108 -0
  192. package/src/pb-icon.js +283 -0
  193. package/src/pb-image-strip.js +85 -79
  194. package/src/pb-lang.js +142 -57
  195. package/src/pb-leaflet-map.js +551 -483
  196. package/src/pb-link.js +132 -126
  197. package/src/pb-load.js +495 -428
  198. package/src/pb-login.js +303 -248
  199. package/src/pb-manage-odds.js +384 -338
  200. package/src/pb-map-icon.js +90 -90
  201. package/src/pb-map-layer.js +86 -86
  202. package/src/pb-markdown.js +107 -110
  203. package/src/pb-media-query.js +75 -73
  204. package/src/pb-mei.js +523 -303
  205. package/src/pb-message.js +144 -98
  206. package/src/pb-mixin.js +268 -265
  207. package/src/pb-navigation.js +83 -96
  208. package/src/pb-observable.js +39 -39
  209. package/src/pb-odd-editor.js +1209 -948
  210. package/src/pb-odd-elementspec-editor.js +375 -310
  211. package/src/pb-odd-model-editor.js +1189 -941
  212. package/src/pb-odd-parameter-editor.js +269 -170
  213. package/src/pb-odd-rendition-editor.js +184 -131
  214. package/src/pb-page.js +451 -422
  215. package/src/pb-paginate.js +260 -178
  216. package/src/pb-panel.js +217 -183
  217. package/src/pb-popover-themes.js +16 -9
  218. package/src/pb-popover.js +297 -288
  219. package/src/pb-print-preview.js +128 -128
  220. package/src/pb-progress.js +52 -52
  221. package/src/pb-repeat.js +141 -108
  222. package/src/pb-restricted.js +85 -78
  223. package/src/pb-search.js +258 -230
  224. package/src/pb-select-feature.js +210 -126
  225. package/src/pb-select-odd.js +184 -118
  226. package/src/pb-select-template.js +113 -78
  227. package/src/pb-select.js +330 -229
  228. package/src/pb-split-list.js +181 -176
  229. package/src/pb-svg.js +81 -80
  230. package/src/pb-table-column.js +55 -55
  231. package/src/pb-table-grid.js +334 -205
  232. package/src/pb-tabs.js +238 -61
  233. package/src/pb-tify.js +3331 -126
  234. package/src/pb-timeline.js +394 -255
  235. package/src/pb-toggle-feature.js +196 -188
  236. package/src/pb-upload.js +201 -176
  237. package/src/pb-version.js +22 -34
  238. package/src/pb-view-annotate.js +138 -102
  239. package/src/pb-view.js +1722 -1272
  240. package/src/pb-zoom.js +144 -46
  241. package/src/search-result-service.js +256 -223
  242. package/src/seed-element.js +14 -22
  243. package/src/settings.js +4 -4
  244. package/src/theming.js +98 -91
  245. package/src/urls.js +403 -289
  246. package/src/utils.js +53 -51
  247. package/vite.config.js +86 -0
  248. package/css/pb-styles.css +0 -51
  249. package/dist/iron-form-3b8dcaa7.js +0 -210
  250. package/dist/jinn-codemirror-da0e2d1f.js +0 -1
  251. package/dist/paper-checkbox-515a5284.js +0 -1597
  252. package/dist/paper-icon-button-b1d31571.js +0 -398
  253. package/dist/paper-listbox-a3b7175c.js +0 -1265
  254. package/dist/pb-i18n-0611135a.js +0 -1
  255. package/dist/pb-mixin-b1caa22e.js +0 -158
  256. package/dist/polymer-hack.js +0 -1
  257. package/dist/vaadin-element-mixin-fe4a4883.js +0 -527
  258. package/lib/Control.Geocoder.min.js +0 -2
  259. package/lib/Control.Geocoder.min.js.map +0 -1
  260. package/src/assets/pb-styles.css +0 -51
  261. package/src/pb-light-dom.js +0 -41
  262. package/src/polymer-hack.js +0 -6
package/src/utils.js CHANGED
@@ -1,51 +1,53 @@
1
- export function resolveURL(relPath) {
2
- const src = document.querySelector('script[src*=pb-components]');
3
- if (src) {
4
- return new URL(relPath, src.src).href;
5
- }
6
- return new URL(relPath, window.location.href).href;
7
- }
8
-
9
- export function cmpVersion(a, b) {
10
- var i, cmp, len;
11
- a = (a + '').split('.');
12
- b = (b + '').split('.');
13
- len = Math.max(a.length, b.length);
14
- for (i = 0; i < len; i++) {
15
- if (a[i] === undefined) {
16
- a[i] = '0';
17
- }
18
- if (b[i] === undefined) {
19
- b[i] = '0';
20
- }
21
- cmp = parseInt(a[i], 10) - parseInt(b[i], 10);
22
- if (cmp !== 0) {
23
- return (cmp < 0 ? -1 : 1);
24
- }
25
- }
26
- return 0;
27
- }
28
-
29
- export function minVersion(given, required) {
30
- return cmpVersion(given, required) >= 0;
31
- }
32
-
33
- /**
34
- * Retrieve value of a CSS property.
35
- *
36
- * @param {Element} elem the component
37
- * @param {string} name name of the property
38
- * @param {any} defaultValue default value
39
- * @returns the value or defaultValue if it does not exist
40
- */
41
- export function getCSSProperty(elem, name, defaultValue) {
42
- const property = getComputedStyle(elem).getPropertyValue(name);
43
- if (property) {
44
- try {
45
- return JSON.parse(property);
46
- } catch (e) {
47
- return defaultValue;
48
- }
49
- }
50
- return defaultValue;
51
- }
1
+ export function resolveURL(relPath) {
2
+ const src = document.querySelector('script[src*=pb-components]');
3
+ if (src) {
4
+ return new URL(relPath, src.src).href;
5
+ }
6
+ return new URL(relPath, window.location.href).href;
7
+ }
8
+
9
+ export function cmpVersion(a, b) {
10
+ let i;
11
+ let cmp;
12
+ let len;
13
+ a = `${a}`.split('.');
14
+ b = `${b}`.split('.');
15
+ len = Math.max(a.length, b.length);
16
+ for (i = 0; i < len; i++) {
17
+ if (a[i] === undefined) {
18
+ a[i] = '0';
19
+ }
20
+ if (b[i] === undefined) {
21
+ b[i] = '0';
22
+ }
23
+ cmp = parseInt(a[i], 10) - parseInt(b[i], 10);
24
+ if (cmp !== 0) {
25
+ return cmp < 0 ? -1 : 1;
26
+ }
27
+ }
28
+ return 0;
29
+ }
30
+
31
+ export function minVersion(given, required) {
32
+ return cmpVersion(given, required) >= 0;
33
+ }
34
+
35
+ /**
36
+ * Retrieve value of a CSS property.
37
+ *
38
+ * @param {Element} elem the component
39
+ * @param {string} name name of the property
40
+ * @param {any} defaultValue default value
41
+ * @returns the value or defaultValue if it does not exist
42
+ */
43
+ export function getCSSProperty(elem, name, defaultValue) {
44
+ const property = getComputedStyle(elem).getPropertyValue(name);
45
+ if (property) {
46
+ try {
47
+ return JSON.parse(property);
48
+ } catch (e) {
49
+ return defaultValue;
50
+ }
51
+ }
52
+ return defaultValue;
53
+ }
package/vite.config.js ADDED
@@ -0,0 +1,86 @@
1
+ const MOCK_VERSION = {
2
+ api: '1.0.0',
3
+ app: { name: 'mock-app', version: '0.0.0' },
4
+ engine: { name: 'mock-engine', version: '0.0.0' }
5
+ }
6
+ import { defineConfig } from 'vite';
7
+ import { fileURLToPath } from 'node:url';
8
+
9
+ const isCypress = !!process.env.CYPRESS;
10
+
11
+ // Vite dev server for pb-components demos and local development
12
+ // - Serves from repo root so existing demo and api pages work
13
+ // - Opens api.html by default
14
+ // - Replaces process.env.NODE_ENV usages for legacy code paths
15
+ export default defineConfig({
16
+ root: '.',
17
+ server: {
18
+ port: 5173,
19
+ // Don't auto-open a path when Cypress runs CT; it uses a special base
20
+ open: isCypress ? false : '/api.html',
21
+ cors: true,
22
+ headers: {
23
+ // Keep CORS relaxed for local eXist/dev interactions
24
+ 'Access-Control-Allow-Origin': '*',
25
+ },
26
+ proxy: isCypress ? undefined : {
27
+ '/exist': {
28
+ target: 'http://localhost:8080',
29
+ changeOrigin: true,
30
+ secure: false,
31
+ rewrite: (path) => path.replace(/^\/demo/, ''),
32
+ },
33
+ },
34
+ // Ensure lib/ directory is served as static files
35
+ fs: {
36
+ allow: ['..', '.', 'lib']
37
+ }
38
+ },
39
+ plugins: [
40
+ {
41
+ name: 'mock-teipublisher-handshake',
42
+ configureServer(server) {
43
+ server.middlewares.use((req, res, next) => {
44
+ const url = req.url || ''
45
+ // Normalize both rooted and app-rooted paths
46
+ const isLogin = url.startsWith('/login') || url.startsWith('/exist/apps/tei-publisher/login')
47
+ const isVersion = url.startsWith('/api/version') || url.startsWith('/exist/apps/tei-publisher/api/version')
48
+
49
+ if (isLogin) {
50
+ res.statusCode = 404
51
+ res.setHeader('content-type', 'text/plain')
52
+ res.end('Not Found')
53
+ return
54
+ }
55
+ if (isVersion) {
56
+ res.statusCode = 200
57
+ res.setHeader('content-type', 'application/json')
58
+ res.end(JSON.stringify(MOCK_VERSION))
59
+ return
60
+ }
61
+ next()
62
+ })
63
+ }
64
+ },
65
+ ],
66
+ resolve: {
67
+ alias: [
68
+ // Normalize any accidental /node_modules path imports to bare package names
69
+ ]
70
+ },
71
+ define: {
72
+ 'process.env.NODE_ENV': JSON.stringify('production'),
73
+ },
74
+ optimizeDeps: {
75
+ // Prebundle common deps once so they aren't evaluated from multiple URLs
76
+ include: [
77
+ // Add commonly used packages here if needed
78
+ ],
79
+ exclude: [
80
+ // keep heavy/legacy libs out of prebundle
81
+ 'gridjs',
82
+ 'hotkeys-js',
83
+ 'construct-style-sheets-polyfill'
84
+ ]
85
+ },
86
+ });
package/css/pb-styles.css DELETED
@@ -1,51 +0,0 @@
1
- :root {
2
- --pb-dialog-box-shadow: 0 2px 16px rgba(0, 0, 0, 0.3);
3
- --pb-dialog-backdrop-color: rgba(0, 0, 0, 0.4);
4
- --pb-dialog-padding-horizontal: 1em;
5
- --pb-dialog-padding-vertical: 1em;
6
- --pb-dialog-border-color: #eee;
7
- --pb-dialog-min-width: 300px;
8
- }
9
-
10
- pb-dialog dialog {
11
- min-width: var(--pb-dialog-min-width);
12
- max-width: 100vw;
13
- max-height: 90vh;
14
- border-radius: 6px;
15
- box-shadow: var(--pb-dialog-box-shadow);
16
- border: none;
17
- padding: 0;
18
- }
19
-
20
- pb-dialog dialog::backdrop {
21
- background: var(--pb-dialog-backdrop-color);
22
- }
23
-
24
- pb-dialog>dialog>article>* {
25
- padding-left: var(--pb-dialog-padding-horizontal);
26
- padding-right: var(--pb-dialog-padding-horizontal);
27
- }
28
-
29
- pb-dialog>dialog>article>header {
30
- border-bottom: 1px solid var(--pb-dialog-border-color);
31
- display: flex;
32
- margin-bottom: var(--pb-dialog-padding-vertical);
33
- justify-content: space-between;
34
- align-items: center;
35
- }
36
-
37
- pb-dialog>dialog>article>footer {
38
- display: flex;
39
- justify-content: flex-end;
40
- gap: 0.5rem;
41
- padding-top: var(--pb-dialog-padding-vertical);
42
- padding-bottom: var(--pb-dialog-padding-vertical);
43
- border-top: 1px solid var(--pb-dialog-border-color);
44
- }
45
-
46
- pb-dialog [rel="prev"] {
47
- background: none;
48
- border: none;
49
- font-size: 1.2em;
50
- cursor: pointer;
51
- }
@@ -1,210 +0,0 @@
1
- import{x as e,a as t,I as i,b as s,d as o,P as a,h as n}from"./paper-checkbox-515a5284.js";import{f as r,N as l}from"./paper-listbox-a3b7175c.js";
2
- /**
3
- @license
4
- Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
5
- This code may only be used under the BSD style license found at
6
- http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
7
- http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
8
- found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
9
- part of the polymer project is also subject to an additional IP rights grant
10
- found at http://polymer.github.io/PATENTS.txt
11
- */const h={properties:{elevation:{type:Number,reflectToAttribute:!0,readOnly:!0}},observers:["_calculateElevation(focused, disabled, active, pressed, receivedFocusFromKeyboard)","_computeKeyboardClass(receivedFocusFromKeyboard)"],hostAttributes:{role:"button",tabindex:"0",animated:!0},_calculateElevation:function(){var e=1;this.disabled?e=0:this.active||this.pressed?e=4:this.receivedFocusFromKeyboard&&(e=3),this._setElevation(e)},_computeKeyboardClass:function(e){this.toggleClass("keyboard-focus",e)},_spaceKeyDownHandler:function(t){e._spaceKeyDownHandler.call(this,t),this.hasRipple()&&this.getRipple().ripples.length<1&&this._ripple.uiDownAction()},_spaceKeyUpHandler:function(t){e._spaceKeyUpHandler.call(this,t),this.hasRipple()&&this._ripple.uiUpAction()}},d=[t,i,s,h],p=document.createElement("template");p.setAttribute("style","display: none;"),p.innerHTML='<dom-module id="paper-dialog-shared-styles">\n <template>\n <style>\n :host {\n display: block;\n margin: 24px 40px;\n\n background: var(--paper-dialog-background-color, var(--primary-background-color));\n color: var(--paper-dialog-color, var(--primary-text-color));\n\n @apply --paper-font-body1;\n @apply --shadow-elevation-16dp;\n @apply --paper-dialog;\n }\n\n :host > ::slotted(*) {\n margin-top: 20px;\n padding: 0 24px;\n }\n\n :host > ::slotted(.no-padding) {\n padding: 0;\n }\n\n \n :host > ::slotted(*:first-child) {\n margin-top: 24px;\n }\n\n :host > ::slotted(*:last-child) {\n margin-bottom: 24px;\n }\n\n /* In 1.x, this selector was `:host > ::content h2`. In 2.x <slot> allows\n to select direct children only, which increases the weight of this\n selector, so we have to re-define first-child/last-child margins below. */\n :host > ::slotted(h2) {\n position: relative;\n margin: 0;\n\n @apply --paper-font-title;\n @apply --paper-dialog-title;\n }\n\n /* Apply mixin again, in case it sets margin-top. */\n :host > ::slotted(h2:first-child) {\n margin-top: 24px;\n @apply --paper-dialog-title;\n }\n\n /* Apply mixin again, in case it sets margin-bottom. */\n :host > ::slotted(h2:last-child) {\n margin-bottom: 24px;\n @apply --paper-dialog-title;\n }\n\n :host > ::slotted(.paper-dialog-buttons),\n :host > ::slotted(.buttons) {\n position: relative;\n padding: 8px 8px 8px 24px;\n margin: 0;\n\n color: var(--paper-dialog-button-color, var(--primary-color));\n\n @apply --layout-horizontal;\n @apply --layout-end-justified;\n }\n </style>\n </template>\n</dom-module>',document.head.appendChild(p.content);
12
- /**
13
- @license
14
- Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
15
- This code may only be used under the BSD style license found at
16
- http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
17
- http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
18
- found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
19
- part of the polymer project is also subject to an additional IP rights grant
20
- found at http://polymer.github.io/PATENTS.txt
21
- */
22
- const c={hostAttributes:{role:"dialog",tabindex:"-1"},properties:{modal:{type:Boolean,value:!1},__readied:{type:Boolean,value:!1}},observers:["_modalChanged(modal, __readied)"],listeners:{tap:"_onDialogClick"},ready:function(){this.__prevNoCancelOnOutsideClick=this.noCancelOnOutsideClick,this.__prevNoCancelOnEscKey=this.noCancelOnEscKey,this.__prevWithBackdrop=this.withBackdrop,this.__readied=!0},_modalChanged:function(e,t){t&&(e?(this.__prevNoCancelOnOutsideClick=this.noCancelOnOutsideClick,this.__prevNoCancelOnEscKey=this.noCancelOnEscKey,this.__prevWithBackdrop=this.withBackdrop,this.noCancelOnOutsideClick=!0,this.noCancelOnEscKey=!0,this.withBackdrop=!0):(this.noCancelOnOutsideClick=this.noCancelOnOutsideClick&&this.__prevNoCancelOnOutsideClick,this.noCancelOnEscKey=this.noCancelOnEscKey&&this.__prevNoCancelOnEscKey,this.withBackdrop=this.withBackdrop&&this.__prevWithBackdrop))},_updateClosingReasonConfirmed:function(e){this.closingReason=this.closingReason||{},this.closingReason.confirmed=e},_onDialogClick:function(e){for(var t=o(e).path,i=0,s=t.indexOf(this);i<s;i++){var a=t[i];if(a.hasAttribute&&(a.hasAttribute("dialog-dismiss")||a.hasAttribute("dialog-confirm"))){this._updateClosingReasonConfirmed(a.hasAttribute("dialog-confirm")),this.close(),e.stopPropagation();break}}}};
23
- /**
24
- @license
25
- Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
26
- This code may only be used under the BSD style license found at
27
- http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
28
- http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
29
- found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
30
- part of the polymer project is also subject to an additional IP rights grant
31
- found at http://polymer.github.io/PATENTS.txt
32
- */
33
- a({_template:n`
34
- <style include="paper-dialog-shared-styles"></style>
35
- <slot></slot>
36
- `,is:"paper-dialog",behaviors:[[r,c],l],listeners:{"neon-animation-finish":"_onNeonAnimationFinish"},_renderOpened:function(){this.cancelAnimation(),this.playAnimation("entry")},_renderClosed:function(){this.cancelAnimation(),this.playAnimation("exit")},_onNeonAnimationFinish:function(){this.opened?this._finishRenderOpened():this._finishRenderClosed()}}),
37
- /**
38
- @license
39
- Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
40
- This code may only be used under the BSD style license found at
41
- http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
42
- http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
43
- found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
44
- part of the polymer project is also subject to an additional IP rights grant
45
- found at http://polymer.github.io/PATENTS.txt
46
- */
47
- a({_template:n`
48
- <style>
49
-
50
- :host {
51
- display: block;
52
- @apply --layout-relative;
53
- }
54
-
55
- :host(.is-scrolled:not(:first-child))::before {
56
- content: '';
57
- position: absolute;
58
- top: 0;
59
- left: 0;
60
- right: 0;
61
- height: 1px;
62
- background: var(--divider-color);
63
- }
64
-
65
- :host(.can-scroll:not(.scrolled-to-bottom):not(:last-child))::after {
66
- content: '';
67
- position: absolute;
68
- bottom: 0;
69
- left: 0;
70
- right: 0;
71
- height: 1px;
72
- background: var(--divider-color);
73
- }
74
-
75
- .scrollable {
76
- padding: 0 24px;
77
-
78
- @apply --layout-scroll;
79
- @apply --paper-dialog-scrollable;
80
- }
81
-
82
- .fit {
83
- @apply --layout-fit;
84
- }
85
- </style>
86
-
87
- <div id="scrollable" class="scrollable" on-scroll="updateScrollState">
88
- <slot></slot>
89
- </div>
90
- `,is:"paper-dialog-scrollable",properties:{dialogElement:{type:Object}},get scrollTarget(){return this.$.scrollable},ready:function(){this._ensureTarget(),this.classList.add("no-padding")},attached:function(){this._ensureTarget(),requestAnimationFrame(this.updateScrollState.bind(this))},updateScrollState:function(){this.toggleClass("is-scrolled",this.scrollTarget.scrollTop>0),this.toggleClass("can-scroll",this.scrollTarget.offsetHeight<this.scrollTarget.scrollHeight),this.toggleClass("scrolled-to-bottom",this.scrollTarget.scrollTop+this.scrollTarget.offsetHeight>=this.scrollTarget.scrollHeight)},_ensureTarget:function(){this.dialogElement=this.dialogElement||this.parentElement,this.dialogElement&&this.dialogElement.behaviors&&this.dialogElement.behaviors.indexOf(c)>=0?(this.dialogElement.sizingTarget=this.scrollTarget,this.scrollTarget.classList.remove("fit")):this.dialogElement&&this.scrollTarget.classList.add("fit")}});
91
- /**
92
- @license
93
- Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
94
- This code may only be used under the BSD style license found at
95
- http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
96
- http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
97
- found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
98
- part of the polymer project is also subject to an additional IP rights grant
99
- found at http://polymer.github.io/PATENTS.txt
100
- */
101
- const u=n`
102
- <style include="paper-material-styles">
103
- /* Need to specify the same specificity as the styles imported from paper-material. */
104
- :host {
105
- @apply --layout-inline;
106
- @apply --layout-center-center;
107
- position: relative;
108
- box-sizing: border-box;
109
- min-width: 5.14em;
110
- margin: 0 0.29em;
111
- background: transparent;
112
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
113
- -webkit-tap-highlight-color: transparent;
114
- font: inherit;
115
- text-transform: uppercase;
116
- outline-width: 0;
117
- border-radius: 3px;
118
- -moz-user-select: none;
119
- -ms-user-select: none;
120
- -webkit-user-select: none;
121
- user-select: none;
122
- cursor: pointer;
123
- z-index: 0;
124
- padding: 0.7em 0.57em;
125
-
126
- @apply --paper-font-common-base;
127
- @apply --paper-button;
128
- }
129
-
130
- :host([elevation="1"]) {
131
- @apply --paper-material-elevation-1;
132
- }
133
-
134
- :host([elevation="2"]) {
135
- @apply --paper-material-elevation-2;
136
- }
137
-
138
- :host([elevation="3"]) {
139
- @apply --paper-material-elevation-3;
140
- }
141
-
142
- :host([elevation="4"]) {
143
- @apply --paper-material-elevation-4;
144
- }
145
-
146
- :host([elevation="5"]) {
147
- @apply --paper-material-elevation-5;
148
- }
149
-
150
- :host([hidden]) {
151
- display: none !important;
152
- }
153
-
154
- :host([raised].keyboard-focus) {
155
- font-weight: bold;
156
- @apply --paper-button-raised-keyboard-focus;
157
- }
158
-
159
- :host(:not([raised]).keyboard-focus) {
160
- font-weight: bold;
161
- @apply --paper-button-flat-keyboard-focus;
162
- }
163
-
164
- :host([disabled]) {
165
- background: none;
166
- color: #a8a8a8;
167
- cursor: auto;
168
- pointer-events: none;
169
-
170
- @apply --paper-button-disabled;
171
- }
172
-
173
- :host([disabled][raised]) {
174
- background: #eaeaea;
175
- }
176
-
177
-
178
- :host([animated]) {
179
- @apply --shadow-transition;
180
- }
181
-
182
- paper-ripple {
183
- color: var(--paper-button-ink-color);
184
- }
185
- </style>
186
-
187
- <slot></slot>`;u.setAttribute("strip-whitespace",""),a({_template:u,is:"paper-button",behaviors:[d],properties:{raised:{type:Boolean,reflectToAttribute:!0,value:!1,observer:"_calculateElevation"}},_calculateElevation:function(){this.raised?h._calculateElevation.apply(this):this._setElevation(0)}}),
188
- /**
189
- @license
190
- Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
191
- This code may only be used under the BSD style license found at
192
- http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
193
- http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
194
- found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
195
- part of the polymer project is also subject to an additional IP rights grant
196
- found at http://polymer.github.io/PATENTS.txt
197
- */
198
- a({_template:n`
199
- <style>
200
- :host {
201
- display: block;
202
- }
203
- </style>
204
-
205
- <!-- This form is used to collect the elements that should be submitted -->
206
- <slot></slot>
207
-
208
- <!-- This form is used for submission -->
209
- <form id="helper" action\$="[[action]]" method\$="[[method]]" enctype\$="[[enctype]]"></form>
210
- `,is:"iron-form",properties:{allowRedirect:{type:Boolean,value:!1},headers:{type:Object,value:function(){return{}}},withCredentials:{type:Boolean,value:!1}},attached:function(){this._form||(this._form=o(this).querySelector("form"),this._form?(this._init(),this.async(this._saveInitialValues.bind(this),1)):this._nodeObserver=o(this).observeNodes(function(e){for(var t=0;t<e.addedNodes.length;t++)"FORM"===e.addedNodes[t].tagName&&(this._form=e.addedNodes[t],this._init(),o(this).unobserveNodes(this._nodeObserver),this._nodeObserver=null)}.bind(this)))},detached:function(){this._nodeObserver&&(o(this).unobserveNodes(this._nodeObserver),this._nodeObserver=null)},_init:function(){this._form.addEventListener("submit",this.submit.bind(this)),this._form.addEventListener("reset",this.reset.bind(this)),this._defaults=this._defaults||new WeakMap,this._saveInitialValues()},saveResetValues:function(){this._saveInitialValues(!0)},_saveInitialValues:function(e){for(var t=this._getValidatableElements(),i=0;i<t.length;i++){var s=t[i];if(!this._defaults.has(s)||e){var o={value:s.value};"checked"in s&&(o.checked=s.checked),"invalid"in s&&(o.invalid=s.invalid),this._defaults.set(s,o)}}},validate:function(){if(!this._form)return!1;if(""===this._form.getAttribute("novalidate"))return!0;for(var e,t=this._form.checkValidity(),i=this._getValidatableElements(),s=0;e=i[s],s<i.length;s++){var o=e;o.validate&&(t=!!o.validate()&&t)}return t},submit:function(e){if(e&&e.preventDefault(),this._form)if(this.validate()){this.$.helper.textContent="";var t=this.serializeForm();if(this.allowRedirect){for(var i in t)this.$.helper.appendChild(this._createHiddenElement(i,t[i]));this.$.helper.action=this._form.getAttribute("action"),this.$.helper.method=this._form.getAttribute("method")||"GET",this.$.helper.contentType=this._form.getAttribute("enctype")||"application/x-www-form-urlencoded",this.$.helper.submit(),this.fire("iron-form-submit")}else this._makeAjaxRequest(t)}else this.fire("iron-form-invalid")},reset:function(e){if(e&&e.preventDefault(),this._form)if(e&&"reset"===e.type&&e.target===this._form){for(var t=this._getValidatableElements(),i=0;i<t.length;i++){var s=t[i];if(this._defaults.has(s)){var o=this._defaults.get(s);for(var a in o)s[a]=o[a]}}this.fire("iron-form-reset")}else this._form.reset()},serializeForm:function(){for(var e=this._getSubmittableElements(),t={},i=0;i<e.length;i++)for(var s=this._serializeElementValues(e[i]),o=0;o<s.length;o++)this._addSerializedElement(t,e[i].name,s[o]);return t},_handleFormResponse:function(e){this.fire("iron-form-response",e.detail)},_handleFormError:function(e){this.fire("iron-form-error",e.detail)},_makeAjaxRequest:function(e){this.request||(this.request=document.createElement("iron-ajax"),this.request.addEventListener("response",this._handleFormResponse.bind(this)),this.request.addEventListener("error",this._handleFormError.bind(this))),this.request.url=this._form.getAttribute("action"),this.request.method=this._form.getAttribute("method")||"GET",this.request.contentType=this._form.getAttribute("enctype")||"application/x-www-form-urlencoded",this.request.withCredentials=this.withCredentials,this.request.headers=this.headers,"POST"===this._form.method.toUpperCase()?this.request.body=e:this.request.params=e,this.fire("iron-form-presubmit",{},{cancelable:!0}).defaultPrevented||(this.request.generateRequest(),this.fire("iron-form-submit",e))},_getValidatableElements:function(){return this._findElements(this._form,!0,!1)},_getSubmittableElements:function(){return this._findElements(this._form,!1,!1)},_findElements:function(e,t,i,s){s=s||[];for(var a=o(e).querySelectorAll("*"),n=0;n<a.length;n++)i||"slot"!==a[n].localName&&"content"!==a[n].localName?this._searchSubmittable(s,a[n],t):this._searchSubmittableInSlot(s,a[n],t);return s},_searchSubmittableInSlot:function(e,t,i){for(var s=o(t).getDistributedNodes(),a=0;a<s.length;a++)if(s[a].nodeType!==Node.TEXT_NODE){this._searchSubmittable(e,s[a],i);for(var n=o(s[a]).querySelectorAll("*"),r=0;r<n.length;r++)this._searchSubmittable(e,n[r],i)}},_searchSubmittable:function(e,t,i){this._isSubmittable(t,i)?e.push(t):t.root&&this._findElements(t.root,i,!0,e)},_isSubmittable:function(e,t){return!e.disabled&&(t?e.name||"function"==typeof e.validate:e.name)},_serializeElementValues:function(e){var t=e.tagName.toLowerCase();return"button"===t||"input"===t&&("submit"===e.type||"reset"===e.type)?[]:"select"===t?this._serializeSelectValues(e):"input"===t?this._serializeInputValues(e):e._hasIronCheckedElementBehavior&&!e.checked?[]:[e.value]},_serializeSelectValues:function(e){for(var t=[],i=0;i<e.options.length;i++)e.options[i].selected&&t.push(e.options[i].value);return t},_serializeInputValues:function(e){var t=e.type.toLowerCase();return("checkbox"!==t&&"radio"!==t||e.checked)&&"file"!==t?[e.value]:[]},_createHiddenElement:function(e,t){var i=document.createElement("input");return i.setAttribute("type","hidden"),i.setAttribute("name",e),i.setAttribute("value",t),i},_addSerializedElement:function(e,t,i){void 0===e[t]?e[t]=i:(Array.isArray(e[t])||(e[t]=[e[t]]),e[t].push(i))}});export{d as P};