@viglet/shio-editor-cors 2026.3.2 → 2026.3.3

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.
package/LICENSE CHANGED
@@ -1,201 +1,201 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright [yyyy] [name of copyright owner]
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -2,10 +2,10 @@
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/@viglet/shio-editor-cors?logo=npm)](https://www.npmjs.com/package/@viglet/shio-editor-cors)
4
4
  [![License](https://img.shields.io/npm/l/@viglet/shio-editor-cors)](https://github.com/openviglet/shio/blob/HEAD/LICENSE)
5
- [![Website](https://img.shields.io/badge/shio.viglet.org-0ea5e9?logo=googlechrome&logoColor=white)](https://shio.viglet.org/)
5
+ [![Website](https://img.shields.io/badge/website-0ea5e9?logo=googlechrome&logoColor=white)](https://openviglet.github.io/shio/)
6
6
 
7
- The **Universal Editor bridge** for **[Viglet Shio](https://shio.viglet.org/)**,
8
- the open source **headless CMS built for coding agents**. Drop it into *any*
7
+ The **Universal Editor bridge** for **[Viglet Shio](https://openviglet.github.io/shio/)**,
8
+ the open source, **agent-ready CMS**. Drop it into *any*
9
9
  front end — Next.js, Astro, Nuxt, Remix, plain HTML — and the page becomes
10
10
  **inline-editable** inside the Shio console, across origins.
11
11
 
@@ -111,7 +111,7 @@ npm run build # vite lib build (es + umd + iife) and .d.ts
111
111
 
112
112
  ## License
113
113
 
114
- Apache-2.0 — [Viglet Shio](https://shio.viglet.org/) ·
114
+ Apache-2.0 — [Viglet Shio](https://openviglet.github.io/shio/) ·
115
115
  [github.com/openviglet/shio](https://github.com/openviglet/shio) ·
116
116
  [docs.viglet.org/shio](https://docs.viglet.org/shio/) ·
117
117
  part of the [Viglet](https://www.viglet.org) open source family.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @viglet/shio-editor-cors v2026.2.0
3
- * Shio CMS Universal Editor Bridge
3
+ * Viglet Shio Universal Editor Bridge
4
4
  *
5
5
  * Include this script in any page to enable Shio Universal Editor support.
6
6
  * Requires: <meta name="urn:shio:system:connection" content="shio:http://your-shio-server">
@@ -1,4 +1,4 @@
1
- (function(){var e=`preview`,t=`edit`,n={mode:e,selectedElement:null,activeEditor:null,changedContent:{},connectionUrl:null,siteName:null,folderPath:null,parentOrigin:null};function r(){let e=document.querySelector(`meta[name="urn:shio:system:connection"]`);if(!e)return null;let t=e.getAttribute(`content`);return t?t.replace(/^shio:/,``):null}function i(e){let t=document.querySelector(`meta[name="${e}"]`);return t&&t.getAttribute(`content`)||null}function a(e){return e&&e.replace(`urn:shio:`,``)||null}function o(e){let t=e;for(;t&&t!==document.body;){if(t.hasAttribute(`data-sh-resource`))return t;t=t.parentElement}return null}function s(e){let t=e.getAttribute(`data-sh-resource`),n=e.getAttribute(`data-sh-type`)||`text`,r=e.getAttribute(`data-sh-prop`),i=e.getAttribute(`data-sh-label`)||r||``,s=e.getAttribute(`data-sh-model`)||``;if(!t||!s){let n=o(e);n&&(t||=n.getAttribute(`data-sh-resource`),s||=n.getAttribute(`data-sh-model`)||``)}return{resource:t,postId:a(t),type:n,prop:r,label:i,model:s,selector:c(e)}}function c(e){if(e.id)return`#`+e.id;let t=[],n=e;for(;n&&n!==document.body;){let e=n.tagName.toLowerCase();if(n.id){t.unshift(`#`+n.id);break}let r=n.parentElement?Array.from(n.parentElement.children).filter(e=>e.tagName===n.tagName):[];if(r.length>1){let t=r.indexOf(n)+1;e+=`:nth-of-type(`+t+`)`}t.unshift(e),n=n.parentElement}return t.join(` > `)}function l(e){let t=[];return e.querySelectorAll(`[data-sh-prop]`).forEach(e=>{let n=e,r=n.getAttribute(`data-sh-type`)||`text`,i;i=r===`media`&&n.tagName===`IMG`?n.src:r===`richtext`?n.innerHTML:n.textContent||``,t.push({prop:n.getAttribute(`data-sh-prop`)||``,type:r,label:n.getAttribute(`data-sh-label`)||n.getAttribute(`data-sh-prop`)||``,value:i,selector:c(n)})}),t}function u(e,t){if(window.parent&&window.parent!==window){if(!n.parentOrigin)return;window.parent.postMessage({type:e,data:t},n.parentOrigin)}}function d(t){if(!n.parentOrigin||t.origin!==n.parentOrigin||!t.data||!t.data.type)return;let r=t.data;switch(r.type){case`sh:mode-change`:f(r.data&&r.data.mode?r.data.mode:e);break;case`sh:content-patch`:C(r.data);break;case`sh:request-content`:w();break;case`sh:highlight-element`:T(r.data)}}function f(r){n.mode=r;let i=document.documentElement;i.classList.remove(`sh-edit-mode`,`sh-preview-mode`),i.classList.add(r===t?`sh-edit-mode`:`sh-preview-mode`),r===e&&(S(),h()),u(`sh:mode-changed`,{mode:r})}function p(e){if(n.mode!==t)return;let r=e.target,i=o(r);if(r.hasAttribute(`data-sh-type`)&&r.hasAttribute(`data-sh-prop`)&&(i=r),!i)return;e.preventDefault(),e.stopPropagation(),m(i);let a=s(i),c=i.hasAttribute(`data-sh-resource`)?i:o(i),d=c?l(c):[];u(`sh:element-selected`,{...a,fields:d,siteName:n.siteName,folderPath:n.folderPath}),a.type===`text`||a.type===`richtext`?g(i,a):a.type===`media`&&u(`sh:media-edit-request`,a)}function m(e){h(),n.selectedElement=e,e.classList.add(`sh-selected`)}function h(){n.selectedElement&&=(n.selectedElement.classList.remove(`sh-selected`),null),document.querySelectorAll(`.sh-selected`).forEach(e=>{e.classList.remove(`sh-selected`)})}function g(e,t){S(),t.type===`text`?_(e,t):t.type===`richtext`&&v(e,t)}function _(e,t){let r=e.textContent||``;e.setAttribute(`contenteditable`,`true`),e.classList.add(`sh-editing`),e.focus();let i=document.createRange();i.selectNodeContents(e);let a=window.getSelection();a&&(a.removeAllRanges(),a.addRange(i)),n.activeEditor={element:e,info:t,originalContent:r,type:`text`};function o(){x(e,t,e.textContent||``,r),e.removeEventListener(`blur`,o),e.removeEventListener(`keydown`,s)}function s(t){t.key===`Enter`&&!t.shiftKey?(t.preventDefault(),e.blur()):t.key===`Escape`&&(e.textContent=r,e.blur())}e.addEventListener(`blur`,o),e.addEventListener(`keydown`,s)}function v(e,t){let r=e.innerHTML;e.setAttribute(`contenteditable`,`true`),e.classList.add(`sh-editing`,`sh-richtext-editing`),e.focus(),n.activeEditor={element:e,info:t,originalContent:r,type:`richtext`};let i=y(e);document.body.appendChild(i),b(i,e),n.activeEditor.toolbar=i;function a(){setTimeout(()=>{i.contains(document.activeElement)||e.contains(document.activeElement)||(x(e,t,e.innerHTML,r),i.parentNode&&i.parentNode.removeChild(i),e.removeEventListener(`blur`,a))},200)}e.addEventListener(`blur`,a)}function y(e){let t=document.createElement(`div`);return t.className=`sh-rte-toolbar`,t.setAttribute(`role`,`toolbar`),[{cmd:`bold`,icon:`B`,title:`Bold`},{cmd:`italic`,icon:`I`,title:`Italic`},{cmd:`underline`,icon:`U`,title:`Underline`},{cmd:`insertUnorderedList`,icon:`•`,title:`Bullet List`},{cmd:`insertOrderedList`,icon:`1.`,title:`Numbered List`},{cmd:`createLink`,icon:`🔗`,title:`Insert Link`},{cmd:`removeFormat`,icon:`✘`,title:`Clear Formatting`}].forEach(n=>{let r=document.createElement(`button`);r.type=`button`,r.title=n.title,r.textContent=n.icon,r.className=`sh-rte-btn`,r.addEventListener(`mousedown`,t=>{if(t.preventDefault(),n.cmd===`createLink`){let e=prompt(`Enter URL:`);e&&document.execCommand(n.cmd,!1,e)}else document.execCommand(n.cmd,!1,void 0);e.focus()}),t.appendChild(r)}),t}function b(e,t){let n=t.getBoundingClientRect();e.style.position=`fixed`,e.style.top=Math.max(0,n.top-44)+`px`,e.style.left=n.left+`px`,e.style.zIndex=`999999`}function x(e,t,r,i){if(e.removeAttribute(`contenteditable`),e.classList.remove(`sh-editing`,`sh-richtext-editing`),r!==i){let e=t.postId+`:`+t.prop;n.changedContent[e]={postId:t.postId,prop:t.prop,type:t.type,value:r,label:t.label},u(`sh:content-changed`,{postId:t.postId,prop:t.prop,type:t.type,value:r,label:t.label,selector:t.selector})}n.activeEditor=null}function S(){if(n.activeEditor){let e=n.activeEditor;e.element.removeAttribute(`contenteditable`),e.element.classList.remove(`sh-editing`,`sh-richtext-editing`),e.toolbar&&e.toolbar.parentNode&&e.toolbar.parentNode.removeChild(e.toolbar),n.activeEditor=null}}function C(e){if(!e||!e.selector)return;let t=document.querySelector(e.selector);t&&(e.type===`media`&&t.tagName===`IMG`?t.src=e.value:e.type===`richtext`?t.innerHTML=e.value:t.textContent=e.value)}function w(){let e=document.querySelectorAll(`[data-sh-resource]`),t=[];e.forEach(e=>{t.push(s(e))}),u(`sh:content-map`,{elements:t})}function T(e){if(!e||!e.selector)return;h();let t=document.querySelector(e.selector);t&&(m(t),t.scrollIntoView({behavior:`smooth`,block:`center`}))}function E(){if(document.getElementById(`sh-universal-editor-styles`))return;let e=document.createElement(`style`);e.id=`sh-universal-editor-styles`,e.textContent=`
1
+ (function(){var e=`preview`,t=`edit`,n=`urn:shio:system:editor-origin`,r={mode:e,selectedElement:null,activeEditor:null,changedContent:{},connectionUrl:null,siteName:null,folderPath:null,parentOrigin:null};function i(){let e=document.querySelector(`meta[name="urn:shio:system:connection"]`);if(!e)return null;let t=e.getAttribute(`content`);return t?t.replace(/^shio:/,``):null}function a(e){let t=document.querySelector(`meta[name="${e}"]`);return t&&t.getAttribute(`content`)||null}function o(e){return e&&e.replace(`urn:shio:`,``)||null}function s(e){let t=e;for(;t&&t!==document.body;){if(t.hasAttribute(`data-sh-resource`))return t;t=t.parentElement}return null}function c(e){let t=e.getAttribute(`data-sh-resource`),n=e.getAttribute(`data-sh-type`)||`text`,r=e.getAttribute(`data-sh-prop`),i=e.getAttribute(`data-sh-label`)||r||``,a=e.getAttribute(`data-sh-model`)||``;if(!t||!a){let n=s(e);n&&(t||=n.getAttribute(`data-sh-resource`),a||=n.getAttribute(`data-sh-model`)||``)}return{resource:t,postId:o(t),type:n,prop:r,label:i,model:a,selector:l(e)}}function l(e){if(e.id)return`#`+e.id;let t=[],n=e;for(;n&&n!==document.body;){let e=n.tagName.toLowerCase();if(n.id){t.unshift(`#`+n.id);break}let r=n.parentElement?Array.from(n.parentElement.children).filter(e=>e.tagName===n.tagName):[];if(r.length>1){let t=r.indexOf(n)+1;e+=`:nth-of-type(`+t+`)`}t.unshift(e),n=n.parentElement}return t.join(` > `)}function u(e){let t=[];return e.querySelectorAll(`[data-sh-prop]`).forEach(e=>{let n=e,r=n.getAttribute(`data-sh-type`)||`text`,i;i=r===`media`&&n.tagName===`IMG`?n.src:r===`richtext`?n.innerHTML:n.textContent||``,t.push({prop:n.getAttribute(`data-sh-prop`)||``,type:r,label:n.getAttribute(`data-sh-label`)||n.getAttribute(`data-sh-prop`)||``,value:i,selector:l(n)})}),t}function d(e,t){if(window.parent&&window.parent!==window){if(!r.parentOrigin)return;window.parent.postMessage({type:e,data:t},r.parentOrigin)}}function f(t){if(!r.parentOrigin||t.origin!==r.parentOrigin||!t.data||!t.data.type)return;let n=t.data;switch(n.type){case`sh:mode-change`:p(n.data&&n.data.mode?n.data.mode:e);break;case`sh:content-patch`:w(n.data);break;case`sh:request-content`:T();break;case`sh:highlight-element`:E(n.data)}}function p(n){r.mode=n;let i=document.documentElement;i.classList.remove(`sh-edit-mode`,`sh-preview-mode`),i.classList.add(n===t?`sh-edit-mode`:`sh-preview-mode`),n===e&&(C(),g()),d(`sh:mode-changed`,{mode:n})}function m(e){if(r.mode!==t)return;let n=e.target,i=s(n);if(n.hasAttribute(`data-sh-type`)&&n.hasAttribute(`data-sh-prop`)&&(i=n),!i)return;e.preventDefault(),e.stopPropagation(),h(i);let a=c(i),o=i.hasAttribute(`data-sh-resource`)?i:s(i),l=o?u(o):[];d(`sh:element-selected`,{...a,fields:l,siteName:r.siteName,folderPath:r.folderPath}),a.type===`text`||a.type===`richtext`?_(i,a):a.type===`media`&&d(`sh:media-edit-request`,a)}function h(e){g(),r.selectedElement=e,e.classList.add(`sh-selected`)}function g(){r.selectedElement&&=(r.selectedElement.classList.remove(`sh-selected`),null),document.querySelectorAll(`.sh-selected`).forEach(e=>{e.classList.remove(`sh-selected`)})}function _(e,t){C(),t.type===`text`?v(e,t):t.type===`richtext`&&y(e,t)}function v(e,t){let n=e.textContent||``;e.setAttribute(`contenteditable`,`true`),e.classList.add(`sh-editing`),e.focus();let i=document.createRange();i.selectNodeContents(e);let a=window.getSelection();a&&(a.removeAllRanges(),a.addRange(i)),r.activeEditor={element:e,info:t,originalContent:n,type:`text`};function o(){S(e,t,e.textContent||``,n),e.removeEventListener(`blur`,o),e.removeEventListener(`keydown`,s)}function s(t){t.key===`Enter`&&!t.shiftKey?(t.preventDefault(),e.blur()):t.key===`Escape`&&(e.textContent=n,e.blur())}e.addEventListener(`blur`,o),e.addEventListener(`keydown`,s)}function y(e,t){let n=e.innerHTML;e.setAttribute(`contenteditable`,`true`),e.classList.add(`sh-editing`,`sh-richtext-editing`),e.focus(),r.activeEditor={element:e,info:t,originalContent:n,type:`richtext`};let i=b(e);document.body.appendChild(i),x(i,e),r.activeEditor.toolbar=i;function a(){setTimeout(()=>{i.contains(document.activeElement)||e.contains(document.activeElement)||(S(e,t,e.innerHTML,n),i.parentNode&&i.parentNode.removeChild(i),e.removeEventListener(`blur`,a))},200)}e.addEventListener(`blur`,a)}function b(e){let t=document.createElement(`div`);return t.className=`sh-rte-toolbar`,t.setAttribute(`role`,`toolbar`),[{cmd:`bold`,icon:`B`,title:`Bold`},{cmd:`italic`,icon:`I`,title:`Italic`},{cmd:`underline`,icon:`U`,title:`Underline`},{cmd:`insertUnorderedList`,icon:`•`,title:`Bullet List`},{cmd:`insertOrderedList`,icon:`1.`,title:`Numbered List`},{cmd:`createLink`,icon:`🔗`,title:`Insert Link`},{cmd:`removeFormat`,icon:`✘`,title:`Clear Formatting`}].forEach(n=>{let r=document.createElement(`button`);r.type=`button`,r.title=n.title,r.textContent=n.icon,r.className=`sh-rte-btn`,r.addEventListener(`mousedown`,t=>{if(t.preventDefault(),n.cmd===`createLink`){let e=prompt(`Enter URL:`);e&&document.execCommand(n.cmd,!1,e)}else document.execCommand(n.cmd,!1,void 0);e.focus()}),t.appendChild(r)}),t}function x(e,t){let n=t.getBoundingClientRect();e.style.position=`fixed`,e.style.top=Math.max(0,n.top-44)+`px`,e.style.left=n.left+`px`,e.style.zIndex=`999999`}function S(e,t,n,i){if(e.removeAttribute(`contenteditable`),e.classList.remove(`sh-editing`,`sh-richtext-editing`),n!==i){let e=t.postId+`:`+t.prop;r.changedContent[e]={postId:t.postId,prop:t.prop,type:t.type,value:n,label:t.label},d(`sh:content-changed`,{postId:t.postId,prop:t.prop,type:t.type,value:n,label:t.label,selector:t.selector})}r.activeEditor=null}function C(){if(r.activeEditor){let e=r.activeEditor;e.element.removeAttribute(`contenteditable`),e.element.classList.remove(`sh-editing`,`sh-richtext-editing`),e.toolbar&&e.toolbar.parentNode&&e.toolbar.parentNode.removeChild(e.toolbar),r.activeEditor=null}}function w(e){if(!e||!e.selector)return;let t=document.querySelector(e.selector);t&&(e.type===`media`&&t.tagName===`IMG`?t.src=e.value:e.type===`richtext`?t.innerHTML=e.value:t.textContent=e.value)}function T(){let e=document.querySelectorAll(`[data-sh-resource]`),t=[];e.forEach(e=>{t.push(c(e))}),d(`sh:content-map`,{elements:t})}function E(e){if(!e||!e.selector)return;g();let t=document.querySelector(e.selector);t&&(h(t),t.scrollIntoView({behavior:`smooth`,block:`center`}))}function D(){if(document.getElementById(`sh-universal-editor-styles`))return;let e=document.createElement(`style`);e.id=`sh-universal-editor-styles`,e.textContent=`
2
2
  /* Edit mode: show outlines on all editable elements */
3
3
  html.sh-edit-mode [data-sh-resource] {
4
4
  outline: 2px dashed rgba(249, 115, 22, 0.4);
@@ -101,4 +101,4 @@
101
101
  outline: none !important;
102
102
  cursor: default;
103
103
  }
104
- `,document.head.appendChild(e)}function D(){if(window!==window.parent){if(n.parentOrigin=i(`urn:shio:system:editor-origin`),!n.parentOrigin){console.warn(`[shio-editor] inert: add <meta name="urn:shio:system:editor-origin" content="https://your-console-origin"> so this page knows which origin may edit it.`);return}n.connectionUrl=r(),n.siteName=i(`urn:shio:system:site`),n.folderPath=i(`urn:shio:system:path`),E(),window.addEventListener(`message`,d),document.addEventListener(`click`,p,!0),u(`sh:ready`,{url:window.location.href,title:document.title,editableCount:document.querySelectorAll(`[data-sh-resource]`).length,connectionUrl:n.connectionUrl,siteName:n.siteName,folderPath:n.folderPath})}}document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,D):D()})();
104
+ `,document.head.appendChild(e)}function O(){window!==window.parent&&(r.parentOrigin=a(n),r.parentOrigin?(r.connectionUrl=i(),r.siteName=a(`urn:shio:system:site`),r.folderPath=a(`urn:shio:system:path`),D(),window.addEventListener(`message`,f),document.addEventListener(`click`,m,!0),d(`sh:ready`,{url:window.location.href,title:document.title,editableCount:document.querySelectorAll(`[data-sh-resource]`).length,connectionUrl:r.connectionUrl,siteName:r.siteName,folderPath:r.folderPath})):console.warn(`[shio-editor] inert: add <meta name="`+n+`" content="https://your-console-origin"> so this page knows which origin may edit it.`))}document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,O):O()})();
@@ -1,5 +1,5 @@
1
- //#region src/shio-editor-cors.ts
2
- var e = "preview", t = "edit", n = {
1
+ // src/shio-editor-cors.ts
2
+ var e = "preview", t = "edit", n = "urn:shio:system:editor-origin", r = {
3
3
  mode: e,
4
4
  selectedElement: null,
5
5
  activeEditor: null,
@@ -9,20 +9,20 @@ var e = "preview", t = "edit", n = {
9
9
  folderPath: null,
10
10
  parentOrigin: null
11
11
  };
12
- function r() {
12
+ function i() {
13
13
  let e = document.querySelector("meta[name=\"urn:shio:system:connection\"]");
14
14
  if (!e) return null;
15
15
  let t = e.getAttribute("content");
16
16
  return t ? t.replace(/^shio:/, "") : null;
17
17
  }
18
- function i(e) {
18
+ function a(e) {
19
19
  let t = document.querySelector(`meta[name="${e}"]`);
20
20
  return t && t.getAttribute("content") || null;
21
21
  }
22
- function a(e) {
22
+ function o(e) {
23
23
  return e && e.replace("urn:shio:", "") || null;
24
24
  }
25
- function o(e) {
25
+ function s(e) {
26
26
  let t = e;
27
27
  for (; t && t !== document.body;) {
28
28
  if (t.hasAttribute("data-sh-resource")) return t;
@@ -30,23 +30,23 @@ function o(e) {
30
30
  }
31
31
  return null;
32
32
  }
33
- function s(e) {
34
- let t = e.getAttribute("data-sh-resource"), n = e.getAttribute("data-sh-type") || "text", r = e.getAttribute("data-sh-prop"), i = e.getAttribute("data-sh-label") || r || "", s = e.getAttribute("data-sh-model") || "";
35
- if (!t || !s) {
36
- let n = o(e);
37
- n && (t ||= n.getAttribute("data-sh-resource"), s ||= n.getAttribute("data-sh-model") || "");
33
+ function c(e) {
34
+ let t = e.getAttribute("data-sh-resource"), n = e.getAttribute("data-sh-type") || "text", r = e.getAttribute("data-sh-prop"), i = e.getAttribute("data-sh-label") || r || "", a = e.getAttribute("data-sh-model") || "";
35
+ if (!t || !a) {
36
+ let n = s(e);
37
+ n && (t ||= n.getAttribute("data-sh-resource"), a ||= n.getAttribute("data-sh-model") || "");
38
38
  }
39
39
  return {
40
40
  resource: t,
41
- postId: a(t),
41
+ postId: o(t),
42
42
  type: n,
43
43
  prop: r,
44
44
  label: i,
45
- model: s,
46
- selector: c(e)
45
+ model: a,
46
+ selector: l(e)
47
47
  };
48
48
  }
49
- function c(e) {
49
+ function l(e) {
50
50
  if (e.id) return "#" + e.id;
51
51
  let t = [], n = e;
52
52
  for (; n && n !== document.body;) {
@@ -64,7 +64,7 @@ function c(e) {
64
64
  }
65
65
  return t.join(" > ");
66
66
  }
67
- function l(e) {
67
+ function u(e) {
68
68
  let t = [];
69
69
  return e.querySelectorAll("[data-sh-prop]").forEach((e) => {
70
70
  let n = e, r = n.getAttribute("data-sh-type") || "text", i;
@@ -73,102 +73,102 @@ function l(e) {
73
73
  type: r,
74
74
  label: n.getAttribute("data-sh-label") || n.getAttribute("data-sh-prop") || "",
75
75
  value: i,
76
- selector: c(n)
76
+ selector: l(n)
77
77
  });
78
78
  }), t;
79
79
  }
80
- function u(e, t) {
80
+ function d(e, t) {
81
81
  if (window.parent && window.parent !== window) {
82
- if (!n.parentOrigin) return;
82
+ if (!r.parentOrigin) return;
83
83
  window.parent.postMessage({
84
84
  type: e,
85
85
  data: t
86
- }, n.parentOrigin);
86
+ }, r.parentOrigin);
87
87
  }
88
88
  }
89
- function d(t) {
90
- if (!n.parentOrigin || t.origin !== n.parentOrigin || !t.data || !t.data.type) return;
91
- let r = t.data;
92
- switch (r.type) {
89
+ function f(t) {
90
+ if (!r.parentOrigin || t.origin !== r.parentOrigin || !t.data || !t.data.type) return;
91
+ let n = t.data;
92
+ switch (n.type) {
93
93
  case "sh:mode-change":
94
- f(r.data && r.data.mode ? r.data.mode : e);
94
+ p(n.data && n.data.mode ? n.data.mode : e);
95
95
  break;
96
96
  case "sh:content-patch":
97
- C(r.data);
97
+ w(n.data);
98
98
  break;
99
99
  case "sh:request-content":
100
- w();
100
+ T();
101
101
  break;
102
- case "sh:highlight-element": T(r.data);
102
+ case "sh:highlight-element": E(n.data);
103
103
  }
104
104
  }
105
- function f(r) {
106
- n.mode = r;
105
+ function p(n) {
106
+ r.mode = n;
107
107
  let i = document.documentElement;
108
- i.classList.remove("sh-edit-mode", "sh-preview-mode"), i.classList.add(r === t ? "sh-edit-mode" : "sh-preview-mode"), r === e && (S(), h()), u("sh:mode-changed", { mode: r });
108
+ i.classList.remove("sh-edit-mode", "sh-preview-mode"), i.classList.add(n === t ? "sh-edit-mode" : "sh-preview-mode"), n === e && (C(), g()), d("sh:mode-changed", { mode: n });
109
109
  }
110
- function p(e) {
111
- if (n.mode !== t) return;
112
- let r = e.target, i = o(r);
113
- if (r.hasAttribute("data-sh-type") && r.hasAttribute("data-sh-prop") && (i = r), !i) return;
114
- e.preventDefault(), e.stopPropagation(), m(i);
115
- let a = s(i), c = i.hasAttribute("data-sh-resource") ? i : o(i), d = c ? l(c) : [];
116
- u("sh:element-selected", {
110
+ function m(e) {
111
+ if (r.mode !== t) return;
112
+ let n = e.target, i = s(n);
113
+ if (n.hasAttribute("data-sh-type") && n.hasAttribute("data-sh-prop") && (i = n), !i) return;
114
+ e.preventDefault(), e.stopPropagation(), h(i);
115
+ let a = c(i), o = i.hasAttribute("data-sh-resource") ? i : s(i), l = o ? u(o) : [];
116
+ d("sh:element-selected", {
117
117
  ...a,
118
- fields: d,
119
- siteName: n.siteName,
120
- folderPath: n.folderPath
121
- }), a.type === "text" || a.type === "richtext" ? g(i, a) : a.type === "media" && u("sh:media-edit-request", a);
118
+ fields: l,
119
+ siteName: r.siteName,
120
+ folderPath: r.folderPath
121
+ }), a.type === "text" || a.type === "richtext" ? _(i, a) : a.type === "media" && d("sh:media-edit-request", a);
122
122
  }
123
- function m(e) {
124
- h(), n.selectedElement = e, e.classList.add("sh-selected");
123
+ function h(e) {
124
+ g(), r.selectedElement = e, e.classList.add("sh-selected");
125
125
  }
126
- function h() {
127
- n.selectedElement &&= (n.selectedElement.classList.remove("sh-selected"), null), document.querySelectorAll(".sh-selected").forEach((e) => {
126
+ function g() {
127
+ r.selectedElement &&= (r.selectedElement.classList.remove("sh-selected"), null), document.querySelectorAll(".sh-selected").forEach((e) => {
128
128
  e.classList.remove("sh-selected");
129
129
  });
130
130
  }
131
- function g(e, t) {
132
- S(), t.type === "text" ? _(e, t) : t.type === "richtext" && v(e, t);
133
- }
134
131
  function _(e, t) {
135
- let r = e.textContent || "";
132
+ C(), t.type === "text" ? v(e, t) : t.type === "richtext" && y(e, t);
133
+ }
134
+ function v(e, t) {
135
+ let n = e.textContent || "";
136
136
  e.setAttribute("contenteditable", "true"), e.classList.add("sh-editing"), e.focus();
137
137
  let i = document.createRange();
138
138
  i.selectNodeContents(e);
139
139
  let a = window.getSelection();
140
- a && (a.removeAllRanges(), a.addRange(i)), n.activeEditor = {
140
+ a && (a.removeAllRanges(), a.addRange(i)), r.activeEditor = {
141
141
  element: e,
142
142
  info: t,
143
- originalContent: r,
143
+ originalContent: n,
144
144
  type: "text"
145
145
  };
146
146
  function o() {
147
- x(e, t, e.textContent || "", r), e.removeEventListener("blur", o), e.removeEventListener("keydown", s);
147
+ S(e, t, e.textContent || "", n), e.removeEventListener("blur", o), e.removeEventListener("keydown", s);
148
148
  }
149
149
  function s(t) {
150
- t.key === "Enter" && !t.shiftKey ? (t.preventDefault(), e.blur()) : t.key === "Escape" && (e.textContent = r, e.blur());
150
+ t.key === "Enter" && !t.shiftKey ? (t.preventDefault(), e.blur()) : t.key === "Escape" && (e.textContent = n, e.blur());
151
151
  }
152
152
  e.addEventListener("blur", o), e.addEventListener("keydown", s);
153
153
  }
154
- function v(e, t) {
155
- let r = e.innerHTML;
156
- e.setAttribute("contenteditable", "true"), e.classList.add("sh-editing", "sh-richtext-editing"), e.focus(), n.activeEditor = {
154
+ function y(e, t) {
155
+ let n = e.innerHTML;
156
+ e.setAttribute("contenteditable", "true"), e.classList.add("sh-editing", "sh-richtext-editing"), e.focus(), r.activeEditor = {
157
157
  element: e,
158
158
  info: t,
159
- originalContent: r,
159
+ originalContent: n,
160
160
  type: "richtext"
161
161
  };
162
- let i = y(e);
163
- document.body.appendChild(i), b(i, e), n.activeEditor.toolbar = i;
162
+ let i = b(e);
163
+ document.body.appendChild(i), x(i, e), r.activeEditor.toolbar = i;
164
164
  function a() {
165
165
  setTimeout(() => {
166
- i.contains(document.activeElement) || e.contains(document.activeElement) || (x(e, t, e.innerHTML, r), i.parentNode && i.parentNode.removeChild(i), e.removeEventListener("blur", a));
166
+ i.contains(document.activeElement) || e.contains(document.activeElement) || (S(e, t, e.innerHTML, n), i.parentNode && i.parentNode.removeChild(i), e.removeEventListener("blur", a));
167
167
  }, 200);
168
168
  }
169
169
  e.addEventListener("blur", a);
170
170
  }
171
- function y(e) {
171
+ function b(e) {
172
172
  let t = document.createElement("div");
173
173
  return t.className = "sh-rte-toolbar", t.setAttribute("role", "toolbar"), [
174
174
  {
@@ -217,76 +217,69 @@ function y(e) {
217
217
  }), t.appendChild(r);
218
218
  }), t;
219
219
  }
220
- function b(e, t) {
220
+ function x(e, t) {
221
221
  let n = t.getBoundingClientRect();
222
222
  e.style.position = "fixed", e.style.top = Math.max(0, n.top - 44) + "px", e.style.left = n.left + "px", e.style.zIndex = "999999";
223
223
  }
224
- function x(e, t, r, i) {
225
- if (e.removeAttribute("contenteditable"), e.classList.remove("sh-editing", "sh-richtext-editing"), r !== i) {
224
+ function S(e, t, n, i) {
225
+ if (e.removeAttribute("contenteditable"), e.classList.remove("sh-editing", "sh-richtext-editing"), n !== i) {
226
226
  let e = t.postId + ":" + t.prop;
227
- n.changedContent[e] = {
227
+ r.changedContent[e] = {
228
228
  postId: t.postId,
229
229
  prop: t.prop,
230
230
  type: t.type,
231
- value: r,
231
+ value: n,
232
232
  label: t.label
233
- }, u("sh:content-changed", {
233
+ }, d("sh:content-changed", {
234
234
  postId: t.postId,
235
235
  prop: t.prop,
236
236
  type: t.type,
237
- value: r,
237
+ value: n,
238
238
  label: t.label,
239
239
  selector: t.selector
240
240
  });
241
241
  }
242
- n.activeEditor = null;
242
+ r.activeEditor = null;
243
243
  }
244
- function S() {
245
- if (n.activeEditor) {
246
- let e = n.activeEditor;
247
- e.element.removeAttribute("contenteditable"), e.element.classList.remove("sh-editing", "sh-richtext-editing"), e.toolbar && e.toolbar.parentNode && e.toolbar.parentNode.removeChild(e.toolbar), n.activeEditor = null;
244
+ function C() {
245
+ if (r.activeEditor) {
246
+ let e = r.activeEditor;
247
+ e.element.removeAttribute("contenteditable"), e.element.classList.remove("sh-editing", "sh-richtext-editing"), e.toolbar && e.toolbar.parentNode && e.toolbar.parentNode.removeChild(e.toolbar), r.activeEditor = null;
248
248
  }
249
249
  }
250
- function C(e) {
250
+ function w(e) {
251
251
  if (!e || !e.selector) return;
252
252
  let t = document.querySelector(e.selector);
253
253
  t && (e.type === "media" && t.tagName === "IMG" ? t.src = e.value : e.type === "richtext" ? t.innerHTML = e.value : t.textContent = e.value);
254
254
  }
255
- function w() {
255
+ function T() {
256
256
  let e = document.querySelectorAll("[data-sh-resource]"), t = [];
257
257
  e.forEach((e) => {
258
- t.push(s(e));
259
- }), u("sh:content-map", { elements: t });
258
+ t.push(c(e));
259
+ }), d("sh:content-map", { elements: t });
260
260
  }
261
- function T(e) {
261
+ function E(e) {
262
262
  if (!e || !e.selector) return;
263
- h();
263
+ g();
264
264
  let t = document.querySelector(e.selector);
265
- t && (m(t), t.scrollIntoView({
265
+ t && (h(t), t.scrollIntoView({
266
266
  behavior: "smooth",
267
267
  block: "center"
268
268
  }));
269
269
  }
270
- function E() {
270
+ function D() {
271
271
  if (document.getElementById("sh-universal-editor-styles")) return;
272
272
  let e = document.createElement("style");
273
273
  e.id = "sh-universal-editor-styles", e.textContent = "\n /* Edit mode: show outlines on all editable elements */\n html.sh-edit-mode [data-sh-resource] {\n outline: 2px dashed rgba(249, 115, 22, 0.4);\n outline-offset: 4px;\n cursor: pointer;\n position: relative;\n transition: outline 0.2s ease, outline-offset 0.2s ease;\n }\n html.sh-edit-mode [data-sh-resource]:hover {\n outline: 2px solid #f97316;\n outline-offset: 4px;\n }\n /* Label tooltip on hover — uses ::after to avoid conflicts with page ::before */\n html.sh-edit-mode [data-sh-label]:hover::after {\n content: attr(data-sh-label);\n position: absolute;\n top: -28px;\n left: 0;\n right: auto;\n bottom: auto;\n width: auto;\n height: auto;\n background: #f97316;\n color: white;\n padding: 3px 8px;\n font-size: 11px;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n border-radius: 4px;\n white-space: nowrap;\n z-index: 100000;\n pointer-events: none;\n line-height: 1.4;\n font-weight: 500;\n transform: none;\n opacity: 1;\n display: block;\n border: none;\n box-shadow: none;\n margin: 0;\n }\n /* Selected element */\n html.sh-edit-mode .sh-selected {\n outline: 2px solid #f97316 !important;\n outline-offset: 4px;\n box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.15);\n }\n /* Editing state */\n .sh-editing {\n outline: 2px solid #2563eb !important;\n outline-offset: 2px;\n box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15) !important;\n min-height: 1em;\n }\n /* Rich text toolbar */\n .sh-rte-toolbar {\n display: flex;\n gap: 2px;\n background: #1e293b;\n border-radius: 8px;\n padding: 4px;\n box-shadow: 0 4px 16px rgba(0,0,0,0.2);\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n }\n .sh-rte-btn {\n background: transparent;\n border: none;\n color: #e2e8f0;\n width: 32px;\n height: 32px;\n border-radius: 4px;\n cursor: pointer;\n font-size: 14px;\n font-weight: 600;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: background 0.15s;\n }\n .sh-rte-btn:hover {\n background: rgba(255,255,255,0.15);\n }\n /* Container type elements */\n html.sh-edit-mode [data-sh-type='container'] {\n outline-style: dashed;\n outline-color: rgba(139, 92, 246, 0.4);\n }\n html.sh-edit-mode [data-sh-type='container']:hover {\n outline-color: #8b5cf6;\n }\n /* Component type elements */\n html.sh-edit-mode [data-sh-type='component'] {\n outline-style: dashed;\n outline-color: rgba(16, 185, 129, 0.4);\n }\n html.sh-edit-mode [data-sh-type='component']:hover {\n outline-color: #10b981;\n }\n /* Preview mode: remove all outlines */\n html.sh-preview-mode [data-sh-resource] {\n outline: none !important;\n cursor: default;\n }\n ", document.head.appendChild(e);
274
274
  }
275
- function D() {
276
- if (window !== window.parent) {
277
- if (n.parentOrigin = i("urn:shio:system:editor-origin"), !n.parentOrigin) {
278
- console.warn("[shio-editor] inert: add <meta name=\"urn:shio:system:editor-origin\" content=\"https://your-console-origin\"> so this page knows which origin may edit it.");
279
- return;
280
- }
281
- n.connectionUrl = r(), n.siteName = i("urn:shio:system:site"), n.folderPath = i("urn:shio:system:path"), E(), window.addEventListener("message", d), document.addEventListener("click", p, !0), u("sh:ready", {
282
- url: window.location.href,
283
- title: document.title,
284
- editableCount: document.querySelectorAll("[data-sh-resource]").length,
285
- connectionUrl: n.connectionUrl,
286
- siteName: n.siteName,
287
- folderPath: n.folderPath
288
- });
289
- }
275
+ function O() {
276
+ window !== window.parent && (r.parentOrigin = a(n), r.parentOrigin ? (r.connectionUrl = i(), r.siteName = a("urn:shio:system:site"), r.folderPath = a("urn:shio:system:path"), D(), window.addEventListener("message", f), document.addEventListener("click", m, !0), d("sh:ready", {
277
+ url: window.location.href,
278
+ title: document.title,
279
+ editableCount: document.querySelectorAll("[data-sh-resource]").length,
280
+ connectionUrl: r.connectionUrl,
281
+ siteName: r.siteName,
282
+ folderPath: r.folderPath
283
+ })) : console.warn("[shio-editor] inert: add <meta name=\"" + n + "\" content=\"https://your-console-origin\"> so this page knows which origin may edit it."));
290
284
  }
291
- document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", D) : D();
292
- //#endregion
285
+ document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", O) : O();
@@ -1,4 +1,4 @@
1
- (function(e){typeof define==`function`&&define.amd?define([],e):e()})(function(){var e=`preview`,t=`edit`,n={mode:e,selectedElement:null,activeEditor:null,changedContent:{},connectionUrl:null,siteName:null,folderPath:null,parentOrigin:null};function r(){let e=document.querySelector(`meta[name="urn:shio:system:connection"]`);if(!e)return null;let t=e.getAttribute(`content`);return t?t.replace(/^shio:/,``):null}function i(e){let t=document.querySelector(`meta[name="${e}"]`);return t&&t.getAttribute(`content`)||null}function a(e){return e&&e.replace(`urn:shio:`,``)||null}function o(e){let t=e;for(;t&&t!==document.body;){if(t.hasAttribute(`data-sh-resource`))return t;t=t.parentElement}return null}function s(e){let t=e.getAttribute(`data-sh-resource`),n=e.getAttribute(`data-sh-type`)||`text`,r=e.getAttribute(`data-sh-prop`),i=e.getAttribute(`data-sh-label`)||r||``,s=e.getAttribute(`data-sh-model`)||``;if(!t||!s){let n=o(e);n&&(t||=n.getAttribute(`data-sh-resource`),s||=n.getAttribute(`data-sh-model`)||``)}return{resource:t,postId:a(t),type:n,prop:r,label:i,model:s,selector:c(e)}}function c(e){if(e.id)return`#`+e.id;let t=[],n=e;for(;n&&n!==document.body;){let e=n.tagName.toLowerCase();if(n.id){t.unshift(`#`+n.id);break}let r=n.parentElement?Array.from(n.parentElement.children).filter(e=>e.tagName===n.tagName):[];if(r.length>1){let t=r.indexOf(n)+1;e+=`:nth-of-type(`+t+`)`}t.unshift(e),n=n.parentElement}return t.join(` > `)}function l(e){let t=[];return e.querySelectorAll(`[data-sh-prop]`).forEach(e=>{let n=e,r=n.getAttribute(`data-sh-type`)||`text`,i;i=r===`media`&&n.tagName===`IMG`?n.src:r===`richtext`?n.innerHTML:n.textContent||``,t.push({prop:n.getAttribute(`data-sh-prop`)||``,type:r,label:n.getAttribute(`data-sh-label`)||n.getAttribute(`data-sh-prop`)||``,value:i,selector:c(n)})}),t}function u(e,t){if(window.parent&&window.parent!==window){if(!n.parentOrigin)return;window.parent.postMessage({type:e,data:t},n.parentOrigin)}}function d(t){if(!n.parentOrigin||t.origin!==n.parentOrigin||!t.data||!t.data.type)return;let r=t.data;switch(r.type){case`sh:mode-change`:f(r.data&&r.data.mode?r.data.mode:e);break;case`sh:content-patch`:C(r.data);break;case`sh:request-content`:w();break;case`sh:highlight-element`:T(r.data)}}function f(r){n.mode=r;let i=document.documentElement;i.classList.remove(`sh-edit-mode`,`sh-preview-mode`),i.classList.add(r===t?`sh-edit-mode`:`sh-preview-mode`),r===e&&(S(),h()),u(`sh:mode-changed`,{mode:r})}function p(e){if(n.mode!==t)return;let r=e.target,i=o(r);if(r.hasAttribute(`data-sh-type`)&&r.hasAttribute(`data-sh-prop`)&&(i=r),!i)return;e.preventDefault(),e.stopPropagation(),m(i);let a=s(i),c=i.hasAttribute(`data-sh-resource`)?i:o(i),d=c?l(c):[];u(`sh:element-selected`,{...a,fields:d,siteName:n.siteName,folderPath:n.folderPath}),a.type===`text`||a.type===`richtext`?g(i,a):a.type===`media`&&u(`sh:media-edit-request`,a)}function m(e){h(),n.selectedElement=e,e.classList.add(`sh-selected`)}function h(){n.selectedElement&&=(n.selectedElement.classList.remove(`sh-selected`),null),document.querySelectorAll(`.sh-selected`).forEach(e=>{e.classList.remove(`sh-selected`)})}function g(e,t){S(),t.type===`text`?_(e,t):t.type===`richtext`&&v(e,t)}function _(e,t){let r=e.textContent||``;e.setAttribute(`contenteditable`,`true`),e.classList.add(`sh-editing`),e.focus();let i=document.createRange();i.selectNodeContents(e);let a=window.getSelection();a&&(a.removeAllRanges(),a.addRange(i)),n.activeEditor={element:e,info:t,originalContent:r,type:`text`};function o(){x(e,t,e.textContent||``,r),e.removeEventListener(`blur`,o),e.removeEventListener(`keydown`,s)}function s(t){t.key===`Enter`&&!t.shiftKey?(t.preventDefault(),e.blur()):t.key===`Escape`&&(e.textContent=r,e.blur())}e.addEventListener(`blur`,o),e.addEventListener(`keydown`,s)}function v(e,t){let r=e.innerHTML;e.setAttribute(`contenteditable`,`true`),e.classList.add(`sh-editing`,`sh-richtext-editing`),e.focus(),n.activeEditor={element:e,info:t,originalContent:r,type:`richtext`};let i=y(e);document.body.appendChild(i),b(i,e),n.activeEditor.toolbar=i;function a(){setTimeout(()=>{i.contains(document.activeElement)||e.contains(document.activeElement)||(x(e,t,e.innerHTML,r),i.parentNode&&i.parentNode.removeChild(i),e.removeEventListener(`blur`,a))},200)}e.addEventListener(`blur`,a)}function y(e){let t=document.createElement(`div`);return t.className=`sh-rte-toolbar`,t.setAttribute(`role`,`toolbar`),[{cmd:`bold`,icon:`B`,title:`Bold`},{cmd:`italic`,icon:`I`,title:`Italic`},{cmd:`underline`,icon:`U`,title:`Underline`},{cmd:`insertUnorderedList`,icon:`•`,title:`Bullet List`},{cmd:`insertOrderedList`,icon:`1.`,title:`Numbered List`},{cmd:`createLink`,icon:`🔗`,title:`Insert Link`},{cmd:`removeFormat`,icon:`✘`,title:`Clear Formatting`}].forEach(n=>{let r=document.createElement(`button`);r.type=`button`,r.title=n.title,r.textContent=n.icon,r.className=`sh-rte-btn`,r.addEventListener(`mousedown`,t=>{if(t.preventDefault(),n.cmd===`createLink`){let e=prompt(`Enter URL:`);e&&document.execCommand(n.cmd,!1,e)}else document.execCommand(n.cmd,!1,void 0);e.focus()}),t.appendChild(r)}),t}function b(e,t){let n=t.getBoundingClientRect();e.style.position=`fixed`,e.style.top=Math.max(0,n.top-44)+`px`,e.style.left=n.left+`px`,e.style.zIndex=`999999`}function x(e,t,r,i){if(e.removeAttribute(`contenteditable`),e.classList.remove(`sh-editing`,`sh-richtext-editing`),r!==i){let e=t.postId+`:`+t.prop;n.changedContent[e]={postId:t.postId,prop:t.prop,type:t.type,value:r,label:t.label},u(`sh:content-changed`,{postId:t.postId,prop:t.prop,type:t.type,value:r,label:t.label,selector:t.selector})}n.activeEditor=null}function S(){if(n.activeEditor){let e=n.activeEditor;e.element.removeAttribute(`contenteditable`),e.element.classList.remove(`sh-editing`,`sh-richtext-editing`),e.toolbar&&e.toolbar.parentNode&&e.toolbar.parentNode.removeChild(e.toolbar),n.activeEditor=null}}function C(e){if(!e||!e.selector)return;let t=document.querySelector(e.selector);t&&(e.type===`media`&&t.tagName===`IMG`?t.src=e.value:e.type===`richtext`?t.innerHTML=e.value:t.textContent=e.value)}function w(){let e=document.querySelectorAll(`[data-sh-resource]`),t=[];e.forEach(e=>{t.push(s(e))}),u(`sh:content-map`,{elements:t})}function T(e){if(!e||!e.selector)return;h();let t=document.querySelector(e.selector);t&&(m(t),t.scrollIntoView({behavior:`smooth`,block:`center`}))}function E(){if(document.getElementById(`sh-universal-editor-styles`))return;let e=document.createElement(`style`);e.id=`sh-universal-editor-styles`,e.textContent=`
1
+ (function(e){typeof define==`function`&&define.amd?define([],e):e()})(function(){var e=`preview`,t=`edit`,n=`urn:shio:system:editor-origin`,r={mode:e,selectedElement:null,activeEditor:null,changedContent:{},connectionUrl:null,siteName:null,folderPath:null,parentOrigin:null};function i(){let e=document.querySelector(`meta[name="urn:shio:system:connection"]`);if(!e)return null;let t=e.getAttribute(`content`);return t?t.replace(/^shio:/,``):null}function a(e){let t=document.querySelector(`meta[name="${e}"]`);return t&&t.getAttribute(`content`)||null}function o(e){return e&&e.replace(`urn:shio:`,``)||null}function s(e){let t=e;for(;t&&t!==document.body;){if(t.hasAttribute(`data-sh-resource`))return t;t=t.parentElement}return null}function c(e){let t=e.getAttribute(`data-sh-resource`),n=e.getAttribute(`data-sh-type`)||`text`,r=e.getAttribute(`data-sh-prop`),i=e.getAttribute(`data-sh-label`)||r||``,a=e.getAttribute(`data-sh-model`)||``;if(!t||!a){let n=s(e);n&&(t||=n.getAttribute(`data-sh-resource`),a||=n.getAttribute(`data-sh-model`)||``)}return{resource:t,postId:o(t),type:n,prop:r,label:i,model:a,selector:l(e)}}function l(e){if(e.id)return`#`+e.id;let t=[],n=e;for(;n&&n!==document.body;){let e=n.tagName.toLowerCase();if(n.id){t.unshift(`#`+n.id);break}let r=n.parentElement?Array.from(n.parentElement.children).filter(e=>e.tagName===n.tagName):[];if(r.length>1){let t=r.indexOf(n)+1;e+=`:nth-of-type(`+t+`)`}t.unshift(e),n=n.parentElement}return t.join(` > `)}function u(e){let t=[];return e.querySelectorAll(`[data-sh-prop]`).forEach(e=>{let n=e,r=n.getAttribute(`data-sh-type`)||`text`,i;i=r===`media`&&n.tagName===`IMG`?n.src:r===`richtext`?n.innerHTML:n.textContent||``,t.push({prop:n.getAttribute(`data-sh-prop`)||``,type:r,label:n.getAttribute(`data-sh-label`)||n.getAttribute(`data-sh-prop`)||``,value:i,selector:l(n)})}),t}function d(e,t){if(window.parent&&window.parent!==window){if(!r.parentOrigin)return;window.parent.postMessage({type:e,data:t},r.parentOrigin)}}function f(t){if(!r.parentOrigin||t.origin!==r.parentOrigin||!t.data||!t.data.type)return;let n=t.data;switch(n.type){case`sh:mode-change`:p(n.data&&n.data.mode?n.data.mode:e);break;case`sh:content-patch`:w(n.data);break;case`sh:request-content`:T();break;case`sh:highlight-element`:E(n.data)}}function p(n){r.mode=n;let i=document.documentElement;i.classList.remove(`sh-edit-mode`,`sh-preview-mode`),i.classList.add(n===t?`sh-edit-mode`:`sh-preview-mode`),n===e&&(C(),g()),d(`sh:mode-changed`,{mode:n})}function m(e){if(r.mode!==t)return;let n=e.target,i=s(n);if(n.hasAttribute(`data-sh-type`)&&n.hasAttribute(`data-sh-prop`)&&(i=n),!i)return;e.preventDefault(),e.stopPropagation(),h(i);let a=c(i),o=i.hasAttribute(`data-sh-resource`)?i:s(i),l=o?u(o):[];d(`sh:element-selected`,{...a,fields:l,siteName:r.siteName,folderPath:r.folderPath}),a.type===`text`||a.type===`richtext`?_(i,a):a.type===`media`&&d(`sh:media-edit-request`,a)}function h(e){g(),r.selectedElement=e,e.classList.add(`sh-selected`)}function g(){r.selectedElement&&=(r.selectedElement.classList.remove(`sh-selected`),null),document.querySelectorAll(`.sh-selected`).forEach(e=>{e.classList.remove(`sh-selected`)})}function _(e,t){C(),t.type===`text`?v(e,t):t.type===`richtext`&&y(e,t)}function v(e,t){let n=e.textContent||``;e.setAttribute(`contenteditable`,`true`),e.classList.add(`sh-editing`),e.focus();let i=document.createRange();i.selectNodeContents(e);let a=window.getSelection();a&&(a.removeAllRanges(),a.addRange(i)),r.activeEditor={element:e,info:t,originalContent:n,type:`text`};function o(){S(e,t,e.textContent||``,n),e.removeEventListener(`blur`,o),e.removeEventListener(`keydown`,s)}function s(t){t.key===`Enter`&&!t.shiftKey?(t.preventDefault(),e.blur()):t.key===`Escape`&&(e.textContent=n,e.blur())}e.addEventListener(`blur`,o),e.addEventListener(`keydown`,s)}function y(e,t){let n=e.innerHTML;e.setAttribute(`contenteditable`,`true`),e.classList.add(`sh-editing`,`sh-richtext-editing`),e.focus(),r.activeEditor={element:e,info:t,originalContent:n,type:`richtext`};let i=b(e);document.body.appendChild(i),x(i,e),r.activeEditor.toolbar=i;function a(){setTimeout(()=>{i.contains(document.activeElement)||e.contains(document.activeElement)||(S(e,t,e.innerHTML,n),i.parentNode&&i.parentNode.removeChild(i),e.removeEventListener(`blur`,a))},200)}e.addEventListener(`blur`,a)}function b(e){let t=document.createElement(`div`);return t.className=`sh-rte-toolbar`,t.setAttribute(`role`,`toolbar`),[{cmd:`bold`,icon:`B`,title:`Bold`},{cmd:`italic`,icon:`I`,title:`Italic`},{cmd:`underline`,icon:`U`,title:`Underline`},{cmd:`insertUnorderedList`,icon:`•`,title:`Bullet List`},{cmd:`insertOrderedList`,icon:`1.`,title:`Numbered List`},{cmd:`createLink`,icon:`🔗`,title:`Insert Link`},{cmd:`removeFormat`,icon:`✘`,title:`Clear Formatting`}].forEach(n=>{let r=document.createElement(`button`);r.type=`button`,r.title=n.title,r.textContent=n.icon,r.className=`sh-rte-btn`,r.addEventListener(`mousedown`,t=>{if(t.preventDefault(),n.cmd===`createLink`){let e=prompt(`Enter URL:`);e&&document.execCommand(n.cmd,!1,e)}else document.execCommand(n.cmd,!1,void 0);e.focus()}),t.appendChild(r)}),t}function x(e,t){let n=t.getBoundingClientRect();e.style.position=`fixed`,e.style.top=Math.max(0,n.top-44)+`px`,e.style.left=n.left+`px`,e.style.zIndex=`999999`}function S(e,t,n,i){if(e.removeAttribute(`contenteditable`),e.classList.remove(`sh-editing`,`sh-richtext-editing`),n!==i){let e=t.postId+`:`+t.prop;r.changedContent[e]={postId:t.postId,prop:t.prop,type:t.type,value:n,label:t.label},d(`sh:content-changed`,{postId:t.postId,prop:t.prop,type:t.type,value:n,label:t.label,selector:t.selector})}r.activeEditor=null}function C(){if(r.activeEditor){let e=r.activeEditor;e.element.removeAttribute(`contenteditable`),e.element.classList.remove(`sh-editing`,`sh-richtext-editing`),e.toolbar&&e.toolbar.parentNode&&e.toolbar.parentNode.removeChild(e.toolbar),r.activeEditor=null}}function w(e){if(!e||!e.selector)return;let t=document.querySelector(e.selector);t&&(e.type===`media`&&t.tagName===`IMG`?t.src=e.value:e.type===`richtext`?t.innerHTML=e.value:t.textContent=e.value)}function T(){let e=document.querySelectorAll(`[data-sh-resource]`),t=[];e.forEach(e=>{t.push(c(e))}),d(`sh:content-map`,{elements:t})}function E(e){if(!e||!e.selector)return;g();let t=document.querySelector(e.selector);t&&(h(t),t.scrollIntoView({behavior:`smooth`,block:`center`}))}function D(){if(document.getElementById(`sh-universal-editor-styles`))return;let e=document.createElement(`style`);e.id=`sh-universal-editor-styles`,e.textContent=`
2
2
  /* Edit mode: show outlines on all editable elements */
3
3
  html.sh-edit-mode [data-sh-resource] {
4
4
  outline: 2px dashed rgba(249, 115, 22, 0.4);
@@ -101,4 +101,4 @@
101
101
  outline: none !important;
102
102
  cursor: default;
103
103
  }
104
- `,document.head.appendChild(e)}function D(){if(window!==window.parent){if(n.parentOrigin=i(`urn:shio:system:editor-origin`),!n.parentOrigin){console.warn(`[shio-editor] inert: add <meta name="urn:shio:system:editor-origin" content="https://your-console-origin"> so this page knows which origin may edit it.`);return}n.connectionUrl=r(),n.siteName=i(`urn:shio:system:site`),n.folderPath=i(`urn:shio:system:path`),E(),window.addEventListener(`message`,d),document.addEventListener(`click`,p,!0),u(`sh:ready`,{url:window.location.href,title:document.title,editableCount:document.querySelectorAll(`[data-sh-resource]`).length,connectionUrl:n.connectionUrl,siteName:n.siteName,folderPath:n.folderPath})}}document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,D):D()});
104
+ `,document.head.appendChild(e)}function O(){window!==window.parent&&(r.parentOrigin=a(n),r.parentOrigin?(r.connectionUrl=i(),r.siteName=a(`urn:shio:system:site`),r.folderPath=a(`urn:shio:system:path`),D(),window.addEventListener(`message`,f),document.addEventListener(`click`,m,!0),d(`sh:ready`,{url:window.location.href,title:document.title,editableCount:document.querySelectorAll(`[data-sh-resource]`).length,connectionUrl:r.connectionUrl,siteName:r.siteName,folderPath:r.folderPath})):console.warn(`[shio-editor] inert: add <meta name="`+n+`" content="https://your-console-origin"> so this page knows which origin may edit it.`))}document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,O):O()});
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@viglet/shio-editor-cors",
3
- "version": "2026.3.2",
4
- "description": "Shio CMS Universal Editor bridge - enables inline visual editing for any page",
5
- "homepage": "https://shio.viglet.org/",
3
+ "version": "2026.3.3",
4
+ "description": "Viglet Shio Universal Editor bridge - enables inline visual editing for any page",
5
+ "homepage": "https://openviglet.github.io/shio/",
6
6
  "type": "module",
7
7
  "main": "dist/shio-editor-cors.umd.cjs",
8
8
  "module": "dist/shio-editor-cors.js",
@@ -50,7 +50,7 @@
50
50
  "url": "https://github.com/openviglet/shio/issues"
51
51
  },
52
52
  "devDependencies": {
53
- "vite": "^8.2.0",
53
+ "vite": "^8.3.5",
54
54
  "typescript": "^5.8.3"
55
55
  },
56
56
  "scripts": {