admins-components 9.0.84 → 9.0.86

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 (33) hide show
  1. package/dist/admins-components103.js +121 -117
  2. package/dist/admins-components103.js.map +1 -1
  3. package/dist/admins-components105.js.map +1 -1
  4. package/dist/admins-components51.js +1 -3
  5. package/dist/admins-components51.js.map +1 -1
  6. package/dist/admins-components52.js.map +1 -1
  7. package/dist/admins-components60.js +1 -0
  8. package/dist/admins-components60.js.map +1 -1
  9. package/dist/admins-components68.js +7 -4
  10. package/dist/admins-components68.js.map +1 -1
  11. package/dist/admins-components70.js.map +1 -1
  12. package/dist/admins-components71.js +5 -2
  13. package/dist/admins-components71.js.map +1 -1
  14. package/dist/admins-components73.js.map +1 -1
  15. package/dist/admins-components75.js +103 -77
  16. package/dist/admins-components75.js.map +1 -1
  17. package/dist/admins-components77.js.map +1 -1
  18. package/dist/admins-components80.js +49 -48
  19. package/dist/admins-components80.js.map +1 -1
  20. package/dist/admins-components82.js.map +1 -1
  21. package/dist/src/components/data-table/DataCards.vue.d.ts +4 -4
  22. package/dist/src/components/data-table/DataPaginator.vue.d.ts +3 -0
  23. package/dist/src/components/data-table/DataTable.vue.d.ts +4 -4
  24. package/dist/src/types/data-list.d.ts +2 -1
  25. package/dist/styles/components/data-table/data-cards.scss_vue_type_style_index_0_src_true_lang.css +1 -1
  26. package/dist/styles/components/data-table/data-list-options.scss_vue_type_style_index_0_src_true_lang.css +1 -1
  27. package/dist/styles/components/data-table/data-list.scss_vue_type_style_index_0_src_true_lang.css +1 -1
  28. package/dist/styles/components/data-table/data-paginator.scss_vue_type_style_index_0_src_true_lang.css +1 -1
  29. package/dist/styles/components/data-table/data-table.scss_vue_type_style_index_0_src_true_lang.css +1 -1
  30. package/dist/test.html +162 -162
  31. package/dist/test81.html +160 -160
  32. package/dist/widget.css +1 -1
  33. package/package.json +1 -1
package/dist/test.html CHANGED
@@ -1,163 +1,163 @@
1
- <!DOCTYPE html>
2
- <html lang="hu">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <title>search-posts-widget standalone test</title>
6
- <style>
7
- body { font-family: system-ui, sans-serif; margin: 2rem; }
8
- #log {
9
- margin-top: 1rem;
10
- padding: 1rem;
11
- background: #f4f4f4;
12
- border: 1px solid #ddd;
13
- font-family: monospace;
14
- white-space: pre-wrap;
15
- font-size: 12px;
16
- max-height: 300px;
17
- overflow-y: auto;
18
- }
19
- dialog {
20
- padding: 0;
21
- border: 1px solid #999;
22
- border-radius: 8px;
23
- width: 90vw;
24
- height: 80vh;
25
- }
26
- dialog::backdrop { background: rgba(0,0,0,0.4); }
27
- </style>
28
- </head>
29
- <body>
30
- <h1>search-posts-widget standalone test</h1>
31
-
32
- <p>
33
- Bundle:
34
- <select id="bundle-version">
35
- <option value="1.0.181">1.0.181</option>
36
- <option value="1.0.188" selected>1.0.188</option>
37
- </select>
38
- <button id="reload">Reload bundle</button>
39
- </p>
40
-
41
- <p>
42
- <strong>apiurl:</strong>
43
- <input id="apiurl" style="width: 360px" value="http://172.22.0.15:8080" />
44
- <br />
45
- <strong>environment:</strong>
46
- <input id="environment" value="dev" />
47
- <br />
48
- <strong>id (causationid):</strong>
49
- <input id="causationid" value="test-1" />
50
- <br />
51
- <strong>searchurl:</strong>
52
- <input id="searchurl" style="width: 360px" value="" />
53
- </p>
54
-
55
- <button id="open-selector">Open selector</button>
56
- <button id="open-non-selector">Open non-selector</button>
57
-
58
- <dialog id="dialog">
59
- <search-posts-widget
60
- id="widget"
61
- selector="true"
62
- environment="dev"
63
- id="causationid"
64
- apiurl="http://172.22.0.15:8080"
65
- searchurl=""
66
- ></search-posts-widget>
67
- </dialog>
68
-
69
- <h3>Console log</h3>
70
- <div id="log"></div>
71
-
72
- <script>
73
- const log = (msg, data) => {
74
- const el = document.getElementById('log')
75
- const line = document.createElement('div')
76
- line.textContent = `[${new Date().toISOString()}] ${msg}` +
77
- (data !== undefined ? ' ' + JSON.stringify(data) : '')
78
- el.appendChild(line)
79
- console.log(msg, data ?? '')
80
- }
81
-
82
- window.addEventListener('error', (e) => log('ERROR', { msg: e.message, file: e.filename, line: e.lineno }))
83
- window.addEventListener('unhandledrejection', (e) => log('UNHANDLED REJECTION', { reason: String(e.reason) }))
84
-
85
- const widgetScriptId = 'search-posts-widget-script'
86
- const CDN_BASE = 'https://cdn.hvg.hu/search-posts-widget'
87
-
88
- function loadBundle(version) {
89
- return new Promise((resolve, reject) => {
90
- const existing = document.getElementById(widgetScriptId)
91
- if (existing) existing.remove()
92
- if (customElements.get('search-posts-widget')) {
93
- // Force re-registration by re-defining on a new class
94
- // (customElements.define cannot be called twice for the same name,
95
- // but since the script reassigns via const, we just reload.)
96
- }
97
- const s = document.createElement('script')
98
- s.id = widgetScriptId
99
- //s.src = `${CDN_BASE}/${version}/search-posts-widget.umd.js`
100
- s.src = '/widget/dist/search-posts-widget.umd.js'
101
- s.onload = () => resolve(version)
102
- s.onerror = () => reject(new Error(`Failed to load ${version}`))
103
- document.head.appendChild(s)
104
- })
105
- }
106
-
107
- function applyAttrs() {
108
- const w = document.getElementById('widget')
109
- w.setAttribute('apiurl', document.getElementById('apiurl').value)
110
- w.setAttribute('environment', document.getElementById('environment').value)
111
- w.setAttribute('id', document.getElementById('causationid').value)
112
- w.setAttribute('searchurl', document.getElementById('searchurl').value)
113
- log('widget attrs', {
114
- apiurl: w.getAttribute('apiurl'),
115
- environment: w.getAttribute('environment'),
116
- id: w.getAttribute('id'),
117
- searchurl: w.getAttribute('searchurl'),
118
- selector: w.getAttribute('selector'),
119
- })
120
- }
121
-
122
- function openWidget(selector) {
123
- const w = document.getElementById('widget')
124
- w.setAttribute('selector', selector ? 'true' : 'false')
125
- applyAttrs()
126
- // Re-create the element so the new selector prop takes effect
127
- const fresh = w.cloneNode(true)
128
- w.replaceWith(fresh)
129
- document.getElementById('dialog').showModal()
130
- // v1.0.188 needs open() to display selector content
131
- try {
132
- console.log('fresh element before open:', fresh)
133
- fresh.open?.()
134
- log('called open()', { hasOpen: typeof fresh.open === 'function' })
135
- } catch (e) {
136
- log('open() threw', { error: String(e) })
137
- }
138
- }
139
-
140
- document.getElementById('reload').addEventListener('click', async () => {
141
- const v = document.getElementById('bundle-version').value
142
- try {
143
- await loadBundle(v)
144
- log('bundle loaded', { version: v, defined: !!customElements.get('search-posts-widget') })
145
- } catch (e) {
146
- log('bundle load failed', { error: String(e) })
147
- }
148
- })
149
-
150
- document.getElementById('open-selector').addEventListener('click', () => openWidget(true))
151
- document.getElementById('open-non-selector').addEventListener('click', () => openWidget(false))
152
-
153
- window.addEventListener('search_posts_selected', (e) => {
154
- log('search_posts_selected', e.detail)
155
- })
156
-
157
- // Initial load of selected version
158
- loadBundle(document.getElementById('bundle-version').value)
159
- .then((v) => log('initial bundle loaded', { version: v, defined: !!customElements.get('search-posts-widget') }))
160
- .catch((e) => log('initial bundle failed', { error: String(e) }))
161
- </script>
162
- </body>
1
+ <!DOCTYPE html>
2
+ <html lang="hu">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <title>search-posts-widget standalone test</title>
6
+ <style>
7
+ body { font-family: system-ui, sans-serif; margin: 2rem; }
8
+ #log {
9
+ margin-top: 1rem;
10
+ padding: 1rem;
11
+ background: #f4f4f4;
12
+ border: 1px solid #ddd;
13
+ font-family: monospace;
14
+ white-space: pre-wrap;
15
+ font-size: 12px;
16
+ max-height: 300px;
17
+ overflow-y: auto;
18
+ }
19
+ dialog {
20
+ padding: 0;
21
+ border: 1px solid #999;
22
+ border-radius: 8px;
23
+ width: 90vw;
24
+ height: 80vh;
25
+ }
26
+ dialog::backdrop { background: rgba(0,0,0,0.4); }
27
+ </style>
28
+ </head>
29
+ <body>
30
+ <h1>search-posts-widget standalone test</h1>
31
+
32
+ <p>
33
+ Bundle:
34
+ <select id="bundle-version">
35
+ <option value="1.0.181">1.0.181</option>
36
+ <option value="1.0.188" selected>1.0.188</option>
37
+ </select>
38
+ <button id="reload">Reload bundle</button>
39
+ </p>
40
+
41
+ <p>
42
+ <strong>apiurl:</strong>
43
+ <input id="apiurl" style="width: 360px" value="http://172.22.0.15:8080" />
44
+ <br />
45
+ <strong>environment:</strong>
46
+ <input id="environment" value="dev" />
47
+ <br />
48
+ <strong>id (causationid):</strong>
49
+ <input id="causationid" value="test-1" />
50
+ <br />
51
+ <strong>searchurl:</strong>
52
+ <input id="searchurl" style="width: 360px" value="" />
53
+ </p>
54
+
55
+ <button id="open-selector">Open selector</button>
56
+ <button id="open-non-selector">Open non-selector</button>
57
+
58
+ <dialog id="dialog">
59
+ <search-posts-widget
60
+ id="widget"
61
+ selector="true"
62
+ environment="dev"
63
+ id="causationid"
64
+ apiurl="http://172.22.0.15:8080"
65
+ searchurl=""
66
+ ></search-posts-widget>
67
+ </dialog>
68
+
69
+ <h3>Console log</h3>
70
+ <div id="log"></div>
71
+
72
+ <script>
73
+ const log = (msg, data) => {
74
+ const el = document.getElementById('log')
75
+ const line = document.createElement('div')
76
+ line.textContent = `[${new Date().toISOString()}] ${msg}` +
77
+ (data !== undefined ? ' ' + JSON.stringify(data) : '')
78
+ el.appendChild(line)
79
+ console.log(msg, data ?? '')
80
+ }
81
+
82
+ window.addEventListener('error', (e) => log('ERROR', { msg: e.message, file: e.filename, line: e.lineno }))
83
+ window.addEventListener('unhandledrejection', (e) => log('UNHANDLED REJECTION', { reason: String(e.reason) }))
84
+
85
+ const widgetScriptId = 'search-posts-widget-script'
86
+ const CDN_BASE = 'https://cdn.hvg.hu/search-posts-widget'
87
+
88
+ function loadBundle(version) {
89
+ return new Promise((resolve, reject) => {
90
+ const existing = document.getElementById(widgetScriptId)
91
+ if (existing) existing.remove()
92
+ if (customElements.get('search-posts-widget')) {
93
+ // Force re-registration by re-defining on a new class
94
+ // (customElements.define cannot be called twice for the same name,
95
+ // but since the script reassigns via const, we just reload.)
96
+ }
97
+ const s = document.createElement('script')
98
+ s.id = widgetScriptId
99
+ //s.src = `${CDN_BASE}/${version}/search-posts-widget.umd.js`
100
+ s.src = '/widget/dist/search-posts-widget.umd.js'
101
+ s.onload = () => resolve(version)
102
+ s.onerror = () => reject(new Error(`Failed to load ${version}`))
103
+ document.head.appendChild(s)
104
+ })
105
+ }
106
+
107
+ function applyAttrs() {
108
+ const w = document.getElementById('widget')
109
+ w.setAttribute('apiurl', document.getElementById('apiurl').value)
110
+ w.setAttribute('environment', document.getElementById('environment').value)
111
+ w.setAttribute('id', document.getElementById('causationid').value)
112
+ w.setAttribute('searchurl', document.getElementById('searchurl').value)
113
+ log('widget attrs', {
114
+ apiurl: w.getAttribute('apiurl'),
115
+ environment: w.getAttribute('environment'),
116
+ id: w.getAttribute('id'),
117
+ searchurl: w.getAttribute('searchurl'),
118
+ selector: w.getAttribute('selector'),
119
+ })
120
+ }
121
+
122
+ function openWidget(selector) {
123
+ const w = document.getElementById('widget')
124
+ w.setAttribute('selector', selector ? 'true' : 'false')
125
+ applyAttrs()
126
+ // Re-create the element so the new selector prop takes effect
127
+ const fresh = w.cloneNode(true)
128
+ w.replaceWith(fresh)
129
+ document.getElementById('dialog').showModal()
130
+ // v1.0.188 needs open() to display selector content
131
+ try {
132
+ console.log('fresh element before open:', fresh)
133
+ fresh.open?.()
134
+ log('called open()', { hasOpen: typeof fresh.open === 'function' })
135
+ } catch (e) {
136
+ log('open() threw', { error: String(e) })
137
+ }
138
+ }
139
+
140
+ document.getElementById('reload').addEventListener('click', async () => {
141
+ const v = document.getElementById('bundle-version').value
142
+ try {
143
+ await loadBundle(v)
144
+ log('bundle loaded', { version: v, defined: !!customElements.get('search-posts-widget') })
145
+ } catch (e) {
146
+ log('bundle load failed', { error: String(e) })
147
+ }
148
+ })
149
+
150
+ document.getElementById('open-selector').addEventListener('click', () => openWidget(true))
151
+ document.getElementById('open-non-selector').addEventListener('click', () => openWidget(false))
152
+
153
+ window.addEventListener('search_posts_selected', (e) => {
154
+ log('search_posts_selected', e.detail)
155
+ })
156
+
157
+ // Initial load of selected version
158
+ loadBundle(document.getElementById('bundle-version').value)
159
+ .then((v) => log('initial bundle loaded', { version: v, defined: !!customElements.get('search-posts-widget') }))
160
+ .catch((e) => log('initial bundle failed', { error: String(e) }))
161
+ </script>
162
+ </body>
163
163
  </html>
package/dist/test81.html CHANGED
@@ -1,161 +1,161 @@
1
- <!DOCTYPE html>
2
- <html lang="hu">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <title>search-posts-widget standalone test</title>
6
- <style>
7
- body { font-family: system-ui, sans-serif; margin: 2rem; }
8
- #log {
9
- margin-top: 1rem;
10
- padding: 1rem;
11
- background: #f4f4f4;
12
- border: 1px solid #ddd;
13
- font-family: monospace;
14
- white-space: pre-wrap;
15
- font-size: 12px;
16
- max-height: 300px;
17
- overflow-y: auto;
18
- }
19
- dialog {
20
- padding: 0;
21
- border: 1px solid #999;
22
- border-radius: 8px;
23
- width: 90vw;
24
- height: 80vh;
25
- }
26
- dialog::backdrop { background: rgba(0,0,0,0.4); }
27
- </style>
28
- </head>
29
- <body>
30
- <h1>search-posts-widget standalone test</h1>
31
-
32
- <p>
33
- Bundle:
34
- <select id="bundle-version">
35
- <option value="1.0.181" selected>1.0.181</option>
36
- <option value="1.0.188" >1.0.188</option>
37
- </select>
38
- <button id="reload">Reload bundle</button>
39
- </p>
40
-
41
- <p>
42
- <strong>apiurl:</strong>
43
- <input id="apiurl" style="width: 360px" value="http://172.22.0.15:8080" />
44
- <br />
45
- <strong>environment:</strong>
46
- <input id="environment" value="dev" />
47
- <br />
48
- <strong>id (causationid):</strong>
49
- <input id="causationid" value="test-causation-1" />
50
- <br />
51
- <strong>searchurl:</strong>
52
- <input id="searchurl" style="width: 360px" value="" />
53
- </p>
54
-
55
- <button id="open-selector">Open selector</button>
56
- <button id="open-non-selector">Open non-selector</button>
57
-
58
- <dialog id="dialog">
59
- <search-posts-widget
60
- id="widget"
61
- selector="true"
62
- environment="dev"
63
- id="causationid"
64
- apiurl="http://172.22.0.15:8080"
65
- searchurl=""
66
- ></search-posts-widget>
67
- </dialog>
68
-
69
- <h3>Console log</h3>
70
- <div id="log"></div>
71
-
72
- <script>
73
- const log = (msg, data) => {
74
- const el = document.getElementById('log')
75
- const line = document.createElement('div')
76
- line.textContent = `[${new Date().toISOString()}] ${msg}` +
77
- (data !== undefined ? ' ' + JSON.stringify(data) : '')
78
- el.appendChild(line)
79
- console.log(msg, data ?? '')
80
- }
81
-
82
- window.addEventListener('error', (e) => log('ERROR', { msg: e.message, file: e.filename, line: e.lineno }))
83
- window.addEventListener('unhandledrejection', (e) => log('UNHANDLED REJECTION', { reason: String(e.reason) }))
84
-
85
- const widgetScriptId = 'search-posts-widget-script'
86
- const CDN_BASE = 'https://cdn.hvg.hu/search-posts-widget'
87
-
88
- function loadBundle(version) {
89
- return new Promise((resolve, reject) => {
90
- const existing = document.getElementById(widgetScriptId)
91
- if (existing) existing.remove()
92
- if (customElements.get('search-posts-widget')) {
93
- // Force re-registration by re-defining on a new class
94
- // (customElements.define cannot be called twice for the same name,
95
- // but since the script reassigns via const, we just reload.)
96
- }
97
- const s = document.createElement('script')
98
- s.id = widgetScriptId
99
- s.src = `${CDN_BASE}/${version}/search-posts-widget.umd.js`
100
- s.onload = () => resolve(version)
101
- s.onerror = () => reject(new Error(`Failed to load ${version}`))
102
- document.head.appendChild(s)
103
- })
104
- }
105
-
106
- function applyAttrs() {
107
- const w = document.getElementById('widget')
108
- w.setAttribute('apiurl', document.getElementById('apiurl').value)
109
- w.setAttribute('environment', document.getElementById('environment').value)
110
- w.setAttribute('id', document.getElementById('causationid').value)
111
- w.setAttribute('searchurl', document.getElementById('searchurl').value)
112
- log('widget attrs', {
113
- apiurl: w.getAttribute('apiurl'),
114
- environment: w.getAttribute('environment'),
115
- id: w.getAttribute('id'),
116
- searchurl: w.getAttribute('searchurl'),
117
- selector: w.getAttribute('selector'),
118
- })
119
- }
120
-
121
- function openWidget(selector) {
122
- const w = document.getElementById('widget')
123
- w.setAttribute('selector', selector ? 'true' : 'false')
124
- applyAttrs()
125
- // Re-create the element so the new selector prop takes effect
126
- const fresh = w.cloneNode(true)
127
- w.replaceWith(fresh)
128
- document.getElementById('dialog').showModal()
129
- // v1.0.188 needs open() to display selector content
130
- try {
131
- fresh.open?.()
132
- log('called open()', { hasOpen: typeof fresh.open === 'function' })
133
- } catch (e) {
134
- log('open() threw', { error: String(e) })
135
- }
136
- }
137
-
138
- document.getElementById('reload').addEventListener('click', async () => {
139
- const v = document.getElementById('bundle-version').value
140
- try {
141
- await loadBundle(v)
142
- log('bundle loaded', { version: v, defined: !!customElements.get('search-posts-widget') })
143
- } catch (e) {
144
- log('bundle load failed', { error: String(e) })
145
- }
146
- })
147
-
148
- document.getElementById('open-selector').addEventListener('click', () => openWidget(true))
149
- document.getElementById('open-non-selector').addEventListener('click', () => openWidget(false))
150
-
151
- window.addEventListener('search_posts_selected', (e) => {
152
- log('search_posts_selected', e.detail)
153
- })
154
-
155
- // Initial load of selected version
156
- loadBundle(document.getElementById('bundle-version').value)
157
- .then((v) => log('initial bundle loaded', { version: v, defined: !!customElements.get('search-posts-widget') }))
158
- .catch((e) => log('initial bundle failed', { error: String(e) }))
159
- </script>
160
- </body>
1
+ <!DOCTYPE html>
2
+ <html lang="hu">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <title>search-posts-widget standalone test</title>
6
+ <style>
7
+ body { font-family: system-ui, sans-serif; margin: 2rem; }
8
+ #log {
9
+ margin-top: 1rem;
10
+ padding: 1rem;
11
+ background: #f4f4f4;
12
+ border: 1px solid #ddd;
13
+ font-family: monospace;
14
+ white-space: pre-wrap;
15
+ font-size: 12px;
16
+ max-height: 300px;
17
+ overflow-y: auto;
18
+ }
19
+ dialog {
20
+ padding: 0;
21
+ border: 1px solid #999;
22
+ border-radius: 8px;
23
+ width: 90vw;
24
+ height: 80vh;
25
+ }
26
+ dialog::backdrop { background: rgba(0,0,0,0.4); }
27
+ </style>
28
+ </head>
29
+ <body>
30
+ <h1>search-posts-widget standalone test</h1>
31
+
32
+ <p>
33
+ Bundle:
34
+ <select id="bundle-version">
35
+ <option value="1.0.181" selected>1.0.181</option>
36
+ <option value="1.0.188" >1.0.188</option>
37
+ </select>
38
+ <button id="reload">Reload bundle</button>
39
+ </p>
40
+
41
+ <p>
42
+ <strong>apiurl:</strong>
43
+ <input id="apiurl" style="width: 360px" value="http://172.22.0.15:8080" />
44
+ <br />
45
+ <strong>environment:</strong>
46
+ <input id="environment" value="dev" />
47
+ <br />
48
+ <strong>id (causationid):</strong>
49
+ <input id="causationid" value="test-causation-1" />
50
+ <br />
51
+ <strong>searchurl:</strong>
52
+ <input id="searchurl" style="width: 360px" value="" />
53
+ </p>
54
+
55
+ <button id="open-selector">Open selector</button>
56
+ <button id="open-non-selector">Open non-selector</button>
57
+
58
+ <dialog id="dialog">
59
+ <search-posts-widget
60
+ id="widget"
61
+ selector="true"
62
+ environment="dev"
63
+ id="causationid"
64
+ apiurl="http://172.22.0.15:8080"
65
+ searchurl=""
66
+ ></search-posts-widget>
67
+ </dialog>
68
+
69
+ <h3>Console log</h3>
70
+ <div id="log"></div>
71
+
72
+ <script>
73
+ const log = (msg, data) => {
74
+ const el = document.getElementById('log')
75
+ const line = document.createElement('div')
76
+ line.textContent = `[${new Date().toISOString()}] ${msg}` +
77
+ (data !== undefined ? ' ' + JSON.stringify(data) : '')
78
+ el.appendChild(line)
79
+ console.log(msg, data ?? '')
80
+ }
81
+
82
+ window.addEventListener('error', (e) => log('ERROR', { msg: e.message, file: e.filename, line: e.lineno }))
83
+ window.addEventListener('unhandledrejection', (e) => log('UNHANDLED REJECTION', { reason: String(e.reason) }))
84
+
85
+ const widgetScriptId = 'search-posts-widget-script'
86
+ const CDN_BASE = 'https://cdn.hvg.hu/search-posts-widget'
87
+
88
+ function loadBundle(version) {
89
+ return new Promise((resolve, reject) => {
90
+ const existing = document.getElementById(widgetScriptId)
91
+ if (existing) existing.remove()
92
+ if (customElements.get('search-posts-widget')) {
93
+ // Force re-registration by re-defining on a new class
94
+ // (customElements.define cannot be called twice for the same name,
95
+ // but since the script reassigns via const, we just reload.)
96
+ }
97
+ const s = document.createElement('script')
98
+ s.id = widgetScriptId
99
+ s.src = `${CDN_BASE}/${version}/search-posts-widget.umd.js`
100
+ s.onload = () => resolve(version)
101
+ s.onerror = () => reject(new Error(`Failed to load ${version}`))
102
+ document.head.appendChild(s)
103
+ })
104
+ }
105
+
106
+ function applyAttrs() {
107
+ const w = document.getElementById('widget')
108
+ w.setAttribute('apiurl', document.getElementById('apiurl').value)
109
+ w.setAttribute('environment', document.getElementById('environment').value)
110
+ w.setAttribute('id', document.getElementById('causationid').value)
111
+ w.setAttribute('searchurl', document.getElementById('searchurl').value)
112
+ log('widget attrs', {
113
+ apiurl: w.getAttribute('apiurl'),
114
+ environment: w.getAttribute('environment'),
115
+ id: w.getAttribute('id'),
116
+ searchurl: w.getAttribute('searchurl'),
117
+ selector: w.getAttribute('selector'),
118
+ })
119
+ }
120
+
121
+ function openWidget(selector) {
122
+ const w = document.getElementById('widget')
123
+ w.setAttribute('selector', selector ? 'true' : 'false')
124
+ applyAttrs()
125
+ // Re-create the element so the new selector prop takes effect
126
+ const fresh = w.cloneNode(true)
127
+ w.replaceWith(fresh)
128
+ document.getElementById('dialog').showModal()
129
+ // v1.0.188 needs open() to display selector content
130
+ try {
131
+ fresh.open?.()
132
+ log('called open()', { hasOpen: typeof fresh.open === 'function' })
133
+ } catch (e) {
134
+ log('open() threw', { error: String(e) })
135
+ }
136
+ }
137
+
138
+ document.getElementById('reload').addEventListener('click', async () => {
139
+ const v = document.getElementById('bundle-version').value
140
+ try {
141
+ await loadBundle(v)
142
+ log('bundle loaded', { version: v, defined: !!customElements.get('search-posts-widget') })
143
+ } catch (e) {
144
+ log('bundle load failed', { error: String(e) })
145
+ }
146
+ })
147
+
148
+ document.getElementById('open-selector').addEventListener('click', () => openWidget(true))
149
+ document.getElementById('open-non-selector').addEventListener('click', () => openWidget(false))
150
+
151
+ window.addEventListener('search_posts_selected', (e) => {
152
+ log('search_posts_selected', e.detail)
153
+ })
154
+
155
+ // Initial load of selected version
156
+ loadBundle(document.getElementById('bundle-version').value)
157
+ .then((v) => log('initial bundle loaded', { version: v, defined: !!customElements.get('search-posts-widget') }))
158
+ .catch((e) => log('initial bundle failed', { error: String(e) }))
159
+ </script>
160
+ </body>
161
161
  </html>