@creaditor/web-starterkit 1.0.11 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/1142.creaditor.bundle.js +1 -1
  2. package/dist/1142.creaditor.bundle.js.gz +0 -0
  3. package/dist/1260.creaditor.bundle.js +63 -26
  4. package/dist/1260.creaditor.bundle.js.gz +0 -0
  5. package/dist/1271.creaditor.bundle.js +1 -1
  6. package/dist/1271.creaditor.bundle.js.gz +0 -0
  7. package/dist/1334.creaditor.bundle.js +2 -2
  8. package/dist/1334.creaditor.bundle.js.gz +0 -0
  9. package/dist/170.creaditor.bundle.js +144 -17
  10. package/dist/170.creaditor.bundle.js.gz +0 -0
  11. package/dist/211.creaditor.bundle.js +1 -1
  12. package/dist/211.creaditor.bundle.js.gz +0 -0
  13. package/dist/2234.creaditor.bundle.js +121 -1
  14. package/dist/2234.creaditor.bundle.js.gz +0 -0
  15. package/dist/2590.creaditor.bundle.js +1 -1
  16. package/dist/2590.creaditor.bundle.js.gz +0 -0
  17. package/dist/2765.creaditor.bundle.js +1 -1
  18. package/dist/2765.creaditor.bundle.js.gz +0 -0
  19. package/dist/2956.creaditor.bundle.js +1 -1
  20. package/dist/2956.creaditor.bundle.js.gz +0 -0
  21. package/dist/3418.creaditor.bundle.js +1 -1
  22. package/dist/3418.creaditor.bundle.js.gz +0 -0
  23. package/dist/353.creaditor.bundle.js +3 -3
  24. package/dist/353.creaditor.bundle.js.gz +0 -0
  25. package/dist/3778.creaditor.bundle.js +1 -0
  26. package/dist/3778.creaditor.bundle.js.gz +0 -0
  27. package/dist/3792.creaditor.bundle.js +1 -0
  28. package/dist/3792.creaditor.bundle.js.gz +0 -0
  29. package/dist/4061.creaditor.bundle.js +1 -1
  30. package/dist/4061.creaditor.bundle.js.gz +0 -0
  31. package/dist/4288.creaditor.bundle.js +10 -10
  32. package/dist/4288.creaditor.bundle.js.gz +0 -0
  33. package/dist/4475.creaditor.bundle.js +1 -1
  34. package/dist/4475.creaditor.bundle.js.gz +0 -0
  35. package/dist/4639.creaditor.bundle.js +1 -1
  36. package/dist/4639.creaditor.bundle.js.gz +0 -0
  37. package/dist/4739.creaditor.bundle.js +1 -1
  38. package/dist/4739.creaditor.bundle.js.gz +0 -0
  39. package/dist/4762.creaditor.bundle.js +3 -3
  40. package/dist/4762.creaditor.bundle.js.gz +0 -0
  41. package/dist/4770.creaditor.bundle.js +3 -3
  42. package/dist/4770.creaditor.bundle.js.gz +0 -0
  43. package/dist/4970.creaditor.bundle.js +7 -7
  44. package/dist/4970.creaditor.bundle.js.gz +0 -0
  45. package/dist/5119.creaditor.bundle.js +5 -5
  46. package/dist/5119.creaditor.bundle.js.gz +0 -0
  47. package/dist/5340.creaditor.bundle.js +19 -18
  48. package/dist/5340.creaditor.bundle.js.gz +0 -0
  49. package/dist/5379.creaditor.bundle.js +70 -0
  50. package/dist/5379.creaditor.bundle.js.gz +0 -0
  51. package/dist/5391.creaditor.bundle.js +1 -1
  52. package/dist/5391.creaditor.bundle.js.gz +0 -0
  53. package/dist/5884.creaditor.bundle.js +91 -0
  54. package/dist/5884.creaditor.bundle.js.gz +0 -0
  55. package/dist/5909.creaditor.bundle.js +644 -0
  56. package/dist/5909.creaditor.bundle.js.gz +0 -0
  57. package/dist/5926.creaditor.bundle.js +26 -28
  58. package/dist/5926.creaditor.bundle.js.gz +0 -0
  59. package/dist/6151.creaditor.bundle.js +1 -1
  60. package/dist/6151.creaditor.bundle.js.gz +0 -0
  61. package/dist/638.creaditor.bundle.js +49 -20
  62. package/dist/638.creaditor.bundle.js.gz +0 -0
  63. package/dist/6713.creaditor.bundle.js +1 -1
  64. package/dist/6713.creaditor.bundle.js.gz +0 -0
  65. package/dist/6814.creaditor.bundle.js +1 -1
  66. package/dist/6814.creaditor.bundle.js.gz +0 -0
  67. package/dist/7209.creaditor.bundle.js +98 -56
  68. package/dist/7209.creaditor.bundle.js.gz +0 -0
  69. package/dist/7564.creaditor.bundle.js +1 -1
  70. package/dist/7564.creaditor.bundle.js.gz +0 -0
  71. package/dist/7937.creaditor.bundle.js +18 -42
  72. package/dist/7937.creaditor.bundle.js.gz +0 -0
  73. package/dist/8141.creaditor.bundle.js +2 -2
  74. package/dist/8141.creaditor.bundle.js.gz +0 -0
  75. package/dist/8250.creaditor.bundle.js +1 -1
  76. package/dist/8250.creaditor.bundle.js.gz +0 -0
  77. package/dist/8646.creaditor.bundle.js +20 -24
  78. package/dist/8646.creaditor.bundle.js.gz +0 -0
  79. package/dist/8654.creaditor.bundle.js +7 -7
  80. package/dist/8654.creaditor.bundle.js.gz +0 -0
  81. package/dist/9041.creaditor.bundle.js +13 -15
  82. package/dist/9041.creaditor.bundle.js.gz +0 -0
  83. package/dist/9431.creaditor.bundle.js +1 -1
  84. package/dist/9431.creaditor.bundle.js.gz +0 -0
  85. package/dist/9694.creaditor.bundle.js +1 -1
  86. package/dist/9694.creaditor.bundle.js.gz +0 -0
  87. package/dist/creaditor.bundle.js +2102 -1589
  88. package/dist/creaditor.bundle.js.gz +0 -0
  89. package/dist/service-worker.js +1 -1
  90. package/dist/service-worker.js.gz +0 -0
  91. package/package.json +1 -1
@@ -0,0 +1,644 @@
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[5909],{65909(e,t,i){i.r(t),i.d(t,{NextButton:()=>f});var s=i(59929),o=i(86319),r=i(93432),n=i(90090),a=i(86959),l=i(36565);const c=`${(0,a.Ay)()?"http://127.0.0.1:8000":"https://studio.creaditor.ai"}/api/seo-generate`;const d=s.qy`
2
+ <svg viewBox="0 0 24 24" fill="currentColor" width="16" height="16" aria-hidden="true">
3
+ <path
4
+ d="M19 9l1.25-2.75L23 5l-2.75-1.25L19 1l-1.25 2.75L15 5l2.75 1.25L19 9zm-7.5.5L9 4 6.5 9.5 1 12l5.5 2.5L9 20l2.5-5.5L17 12l-5.5-2.5zM19 15l-1.25 2.75L15 19l2.75 1.25L19 23l1.25-2.75L23 19l-2.75-1.25L19 15z"
5
+ />
6
+ </svg>
7
+ `;class p extends s.WF{constructor(){super(),this.resolver=null,this.onCancel=()=>{this.loading||this.close(null)},this.onKeywordKeydown=e=>{"Enter"===e.key||","===e.key?(e.preventDefault(),this.commitDraftKeyword()):"Backspace"===e.key&&""===this.keywordDraft&&this.keywordList.length&&(this.keywordList=this.keywordList.slice(0,-1))},this.generateField=async e=>{if(this.loading||this.generatingField)return;const t=function(){const e=document.getElementById("main-page-wrapper");return(e?.innerText||"").trim()}();if(t){this.generatingField=e;try{const i="rtl"===this.direction?"he":"en",s=await this.requestSeo(e,t,i);if("keywords"===e){const e=(Array.isArray(s)?s:String(s).split(",")).map(e=>e.trim()).filter(Boolean),t=[...this.keywordList];for(const i of e)t.includes(i)||t.push(i);this.keywordList=t}else"title"===e?this.title=String(s).slice(0,100):this.description=String(s).slice(0,255)}catch(e){console.error("[seo-generate] failed:",e),this.snackbar(this.t("seo_generate_failed","Couldn't generate. Please try again."))}finally{this.generatingField=""}}else this.snackbar(this.t("seo_generate_empty","Add some content to the page first."))},this.onPublish=()=>{this.loading||(this.commitDraftKeyword(),this.loading=!0,this.close({title:this.title.trim(),description:this.description.trim(),keywords:this.keywordList.join(",")}))},this.loading=!1,this.title="",this.description="",this.keywordList=[],this.keywordDraft="",this.keywordsFocused=!1,this.generatingField=""}static open(){const e=document.createElement("cdtr-publish-seo"),t=o.M.get("app","seo")||{};return e.title=t.title||"",e.description=t.description||"",e.keywordList=(t.keywords||"").split(",").map(e=>e.trim()).filter(Boolean),document.body.appendChild(e),e.waitForChoice()}waitForChoice(){return new Promise(e=>{this.resolver=e})}t(e,t){return o.M.get("lang",e)||t}get direction(){const e=o.M.get("theme");return e?.direction||"rtl"}close(e){this.resolver&&(this.resolver(e),this.resolver=null),this.isConnected&&this.remove()}commitDraftKeyword(){const e=this.keywordDraft.split(",").map(e=>e.trim()).filter(Boolean);if(!e.length)return;const t=[...this.keywordList];for(const i of e)t.includes(i)||t.push(i);this.keywordList=t,this.keywordDraft=""}removeKeyword(e){this.keywordList=this.keywordList.filter((t,i)=>i!==e)}snackbar(e){const t=o.M.get("commands");t?.snackbar?.(e)}async requestSeo(e,t,i){const s=async s=>{const o=await async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=l.Ay;if("function"==typeof t.studioTokenProvider)try{const i=await t.studioTokenProvider({forceRefresh:e});if("string"==typeof i&&i.length>0)return i}catch{}return"string"==typeof t.studioToken&&t.studioToken.length>0?t.studioToken:null}(s),r={"Content-Type":"application/json",Accept:"application/json"};return o&&(r.Authorization=`Bearer ${o}`),fetch(c,{method:"POST",headers:r,body:JSON.stringify({content:t,field:e,language:i})})};let o=await s(!1);if(401===o.status&&(o=await s(!0)),!o.ok)throw new Error(`HTTP ${o.status}`);const r=await o.json();if(!r.ok||void 0===r.value)throw new Error("bad response");return r.value}magicButton(e){const t=this.generatingField===e;return s.qy`
8
+ <button
9
+ class="magic"
10
+ type="button"
11
+ title=${this.t("seo_generate_tooltip","Generate with AI")}
12
+ aria-label=${this.t("seo_generate_tooltip","Generate with AI")}
13
+ ?disabled=${this.loading||!!this.generatingField}
14
+ @click=${()=>this.generateField(e)}
15
+ >
16
+ ${t?s.qy`<span class="mini-spinner"></span>`:d}
17
+ </button>
18
+ `}render(){const e=this.direction;return s.qy`
19
+ <div class="backdrop" @click=${this.onCancel}></div>
20
+ <div class="card" dir=${e}>
21
+ <h2 class="heading">${this.t("ready_to_publish","Ready to publish")}</h2>
22
+ <p class="subheading">${this.t("lets_set_some_seo","Let's set some SEO")}</p>
23
+
24
+ <div class="field">
25
+ <div class="label-row">
26
+ <label>${this.t("seo_title_label","Page name for search engines and social networks (SEO)")}</label>
27
+ ${this.magicButton("title")}
28
+ </div>
29
+ <input
30
+ type="text"
31
+ maxlength=${100}
32
+ .value=${this.title}
33
+ placeholder=${this.t("seo_title_placeholder","Page name as it will appear in search engines")}
34
+ @input=${e=>this.title=e.target.value}
35
+ />
36
+ <div class="counter">${this.title.length}/${100}</div>
37
+ </div>
38
+
39
+ <div class="field">
40
+ <div class="label-row">
41
+ <label>${this.t("seo_description_label","Page description for search engine and social network promotion (SEO)")}</label>
42
+ ${this.magicButton("description")}
43
+ </div>
44
+ <textarea
45
+ maxlength=${255}
46
+ .value=${this.description}
47
+ placeholder=${this.t("seo_description_placeholder","This description will appear below the site title in search engines")}
48
+ @input=${e=>this.description=e.target.value}
49
+ ></textarea>
50
+ <div class="counter">${this.description.length}/${255}</div>
51
+ </div>
52
+
53
+ <div class="field">
54
+ <div class="label-row">
55
+ <label>${this.t("seo_keywords_label","Keywords")}</label>
56
+ ${this.magicButton("keywords")}
57
+ </div>
58
+ <div
59
+ class="chips ${this.keywordsFocused?"focused":""}"
60
+ @click=${e=>{const t=e.currentTarget.querySelector("input");t?.focus()}}
61
+ >
62
+ ${this.keywordList.map((e,t)=>s.qy`
63
+ <span class="chip">
64
+ ${e}
65
+ <button
66
+ type="button"
67
+ aria-label="remove"
68
+ @click=${e=>{e.stopPropagation(),this.removeKeyword(t)}}
69
+ >
70
+ ✕
71
+ </button>
72
+ </span>
73
+ `)}
74
+ <input
75
+ type="text"
76
+ .value=${this.keywordDraft}
77
+ placeholder=${this.keywordList.length?"":this.t("seo_keywords_placeholder","For example: gift,woman,gift for woman")}
78
+ @input=${e=>this.keywordDraft=e.target.value}
79
+ @keydown=${this.onKeywordKeydown}
80
+ @focus=${()=>this.keywordsFocused=!0}
81
+ @blur=${()=>{this.keywordsFocused=!1,this.commitDraftKeyword()}}
82
+ />
83
+ </div>
84
+ </div>
85
+
86
+ <div class="actions">
87
+ <button class="publish" ?disabled=${this.loading} @click=${this.onPublish}>
88
+ ${this.loading?s.qy`<span class="spinner"></span>`:this.t("publish","Publish")}
89
+ </button>
90
+ <button class="cancel" ?disabled=${this.loading} @click=${this.onCancel}>
91
+ ${this.t("cancel","Cancel")}
92
+ </button>
93
+ </div>
94
+ </div>
95
+ `}}p.styles=s.AH`
96
+ :host {
97
+ position: fixed;
98
+ inset: 0;
99
+ z-index: var(--z-blocking, 2147483646);
100
+ display: flex;
101
+ align-items: center;
102
+ justify-content: center;
103
+ font-family: var(--font-family, Arial, Helvetica, sans-serif);
104
+ }
105
+ .backdrop {
106
+ position: absolute;
107
+ inset: 0;
108
+ background: rgba(26, 26, 46, 0.45);
109
+ animation: fade 0.2s ease forwards;
110
+ }
111
+ @keyframes fade {
112
+ from { opacity: 0; }
113
+ to { opacity: 1; }
114
+ }
115
+ .card {
116
+ position: relative;
117
+ background: #fff;
118
+ border-radius: 14px;
119
+ box-shadow: 0 24px 60px rgba(26, 26, 46, 0.28);
120
+ width: 560px;
121
+ max-width: 92vw;
122
+ max-height: 90vh;
123
+ overflow-y: auto;
124
+ padding: 34px 40px 30px;
125
+ box-sizing: border-box;
126
+ opacity: 0;
127
+ transform: scale(0.96);
128
+ animation: pop 0.28s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
129
+ }
130
+ @keyframes pop {
131
+ to { opacity: 1; transform: scale(1); }
132
+ }
133
+ .heading {
134
+ font-size: 26px;
135
+ font-weight: 700;
136
+ color: #1a1a2e;
137
+ margin: 0;
138
+ }
139
+ .subheading {
140
+ font-size: 17px;
141
+ font-weight: 600;
142
+ color: #8a8f9c;
143
+ margin: 10px 0 0;
144
+ }
145
+ .field {
146
+ margin-top: 26px;
147
+ }
148
+ label {
149
+ display: block;
150
+ font-size: 14px;
151
+ color: #3a3a4a;
152
+ margin-bottom: 8px;
153
+ }
154
+ .label-row {
155
+ display: flex;
156
+ align-items: center;
157
+ justify-content: space-between;
158
+ gap: 8px;
159
+ margin-bottom: 8px;
160
+ }
161
+ .label-row label {
162
+ margin-bottom: 0;
163
+ }
164
+ .magic {
165
+ flex: none;
166
+ display: inline-flex;
167
+ align-items: center;
168
+ justify-content: center;
169
+ width: 30px;
170
+ height: 30px;
171
+ border: 1px solid #d5d7de;
172
+ border-radius: 8px;
173
+ background: #fff;
174
+ color: var(--primary, #6c5ce7);
175
+ cursor: pointer;
176
+ line-height: 1;
177
+ transition: border-color 0.15s ease, background 0.15s ease;
178
+ }
179
+ .magic svg {
180
+ display: block;
181
+ }
182
+ .magic:hover:not(:disabled) {
183
+ border-color: var(--primary, #6c5ce7);
184
+ background: color-mix(in srgb, var(--primary, #6c5ce7) 10%, #fff);
185
+ }
186
+ .magic:disabled {
187
+ opacity: 0.5;
188
+ cursor: not-allowed;
189
+ }
190
+ .mini-spinner {
191
+ width: 14px;
192
+ height: 14px;
193
+ border: 2px solid color-mix(in srgb, var(--primary, #6c5ce7) 35%, transparent);
194
+ border-top-color: var(--primary, #6c5ce7);
195
+ border-radius: 50%;
196
+ animation: spin 0.8s linear infinite;
197
+ }
198
+ input,
199
+ textarea {
200
+ width: 100%;
201
+ box-sizing: border-box;
202
+ border: 1px solid #d5d7de;
203
+ border-radius: 8px;
204
+ padding: 12px 14px;
205
+ font-size: 15px;
206
+ font-family: inherit;
207
+ color: #1a1a2e;
208
+ outline: none;
209
+ transition: border-color 0.15s ease, box-shadow 0.15s ease;
210
+ }
211
+ input:focus,
212
+ textarea:focus {
213
+ border-color: var(--primary, #6c5ce7);
214
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary, #6c5ce7) 25%, transparent);
215
+ }
216
+ textarea {
217
+ resize: vertical;
218
+ min-height: 84px;
219
+ }
220
+ input::placeholder,
221
+ textarea::placeholder {
222
+ color: #a7abb5;
223
+ }
224
+ .counter {
225
+ margin-top: 6px;
226
+ font-size: 12px;
227
+ color: #a7abb5;
228
+ }
229
+ .chips {
230
+ display: flex;
231
+ flex-wrap: wrap;
232
+ align-items: center;
233
+ gap: 8px;
234
+ border: 1px solid #d5d7de;
235
+ border-radius: 8px;
236
+ padding: 8px 10px;
237
+ transition: border-color 0.15s ease, box-shadow 0.15s ease;
238
+ }
239
+ .chips.focused {
240
+ border-color: var(--primary, #6c5ce7);
241
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary, #6c5ce7) 25%, transparent);
242
+ }
243
+ .chip {
244
+ display: inline-flex;
245
+ align-items: center;
246
+ gap: 6px;
247
+ background: color-mix(in srgb, var(--primary, #6c5ce7) 12%, #fff);
248
+ color: var(--primary, #6c5ce7);
249
+ border-radius: 6px;
250
+ padding: 5px 8px 5px 10px;
251
+ font-size: 14px;
252
+ line-height: 1;
253
+ white-space: nowrap;
254
+ }
255
+ .chip button {
256
+ display: inline-flex;
257
+ align-items: center;
258
+ justify-content: center;
259
+ width: 16px;
260
+ height: 16px;
261
+ border: none;
262
+ background: transparent;
263
+ color: inherit;
264
+ font-size: 15px;
265
+ line-height: 1;
266
+ cursor: pointer;
267
+ padding: 0;
268
+ opacity: 0.7;
269
+ }
270
+ .chip button:hover {
271
+ opacity: 1;
272
+ }
273
+ .chips input {
274
+ flex: 1;
275
+ min-width: 120px;
276
+ border: none;
277
+ padding: 4px;
278
+ box-shadow: none;
279
+ }
280
+ .chips input:focus {
281
+ border: none;
282
+ box-shadow: none;
283
+ }
284
+ .actions {
285
+ display: flex;
286
+ align-items: center;
287
+ justify-content: space-between;
288
+ margin-top: 34px;
289
+ }
290
+ .publish {
291
+ background: var(--primary, #6c5ce7);
292
+ color: #fff;
293
+ border: none;
294
+ border-radius: 8px;
295
+ padding: 14px 34px;
296
+ font-size: 16px;
297
+ font-weight: 600;
298
+ font-family: inherit;
299
+ cursor: pointer;
300
+ transition: filter 0.15s ease, opacity 0.15s ease;
301
+ }
302
+ .publish:hover {
303
+ filter: brightness(1.05);
304
+ }
305
+ .publish:disabled {
306
+ opacity: 0.6;
307
+ cursor: not-allowed;
308
+ }
309
+ .cancel {
310
+ background: none;
311
+ border: none;
312
+ color: #4a4a5a;
313
+ font-size: 16px;
314
+ font-family: inherit;
315
+ cursor: pointer;
316
+ padding: 8px;
317
+ }
318
+ .cancel:hover {
319
+ color: #1a1a2e;
320
+ }
321
+ .spinner {
322
+ display: inline-block;
323
+ width: 18px;
324
+ height: 18px;
325
+ border: 2px solid rgba(255, 255, 255, 0.5);
326
+ border-top-color: #fff;
327
+ border-radius: 50%;
328
+ animation: spin 0.8s linear infinite;
329
+ vertical-align: middle;
330
+ }
331
+ @keyframes spin {
332
+ to { transform: rotate(360deg); }
333
+ }
334
+ `,p.properties={loading:{type:Boolean},title:{type:String},description:{type:String},keywordList:{type:Array},keywordDraft:{type:String},keywordsFocused:{type:Boolean},generatingField:{type:String}},customElements.define("cdtr-publish-seo",p);var h=i(65550);class u extends s.WF{constructor(){super(),this.raf=0,this.dismissTimer=null,this.dismiss=()=>{this.isConnected&&this.remove()},this.copyLink=async()=>{if(this.url)try{await navigator.clipboard.writeText(this.url),this.copied=!0,setTimeout(()=>this.copied=!1,2e3)}catch{}},this.message="",this.sub="",this.url="",this.seoTitle="",this.seoDescription="",this.copied=!1}firstUpdated(){this.launchConfetti(),this.dismissTimer=setTimeout(()=>this.dismiss(),6500)}disconnectedCallback(){super.disconnectedCallback(),cancelAnimationFrame(this.raf),this.dismissTimer&&clearTimeout(this.dismissTimer)}t(e,t){return o.M.get("lang",e)||t}get direction(){const e=o.M.get("theme");return e?.direction||"rtl"}get host(){return this.url?this.url.replace(/^https?:\/\//,"").replace(/\/+$/,""):""}launchConfetti(){const e=this.renderRoot.querySelector("canvas");if(!e)return;const t=e.getContext("2d");if(!t)return;const i=window.devicePixelRatio||1,s=window.innerWidth,o=window.innerHeight;e.width=s*i,e.height=o*i,t.scale(i,i);const r=["#e94560","#1a1a2e","#f6c945","#2ec7a9","#4d7cfe","#ffffff"],n=s/2,a=.42*o,l=Math.min(220,Math.round(s/6)),c=Array.from({length:l},(e,t)=>{const i=2*Math.PI*t/l+t%3*.4,s=4+t%9;return{x:n,y:a,vx:Math.cos(i)*s,vy:Math.sin(i)*s-3,size:5+t%5,color:r[t%r.length],rot:t,vrot:(t%2?1:-1)*(.1+t%5*.03),life:1}}),d=performance.now(),p=e=>{const i=e-d;t.clearRect(0,0,s,o);let r=!1;for(const e of c)e.vy+=.16,e.x+=e.vx,e.y+=e.vy,e.rot+=e.vrot,i>2600*.55&&(e.life=Math.max(0,e.life-.02)),e.life>0&&e.y<o+40&&(r=!0),t.save(),t.globalAlpha=e.life,t.translate(e.x,e.y),t.rotate(e.rot),t.fillStyle=e.color,t.fillRect(-e.size/2,-e.size/2,e.size,.6*e.size),t.restore();r&&i<3e3?this.raf=requestAnimationFrame(p):t.clearRect(0,0,s,o)};this.raf=requestAnimationFrame(p)}renderPreview(){const e=this.host;if(!e)return s.s6;const t=(this.seoTitle||"").trim()||(this.seoDescription?"":e),i=(this.seoDescription||"").trim(),o=(t||e).charAt(0);return s.qy`
335
+ <div class="preview">
336
+ <p class="preview-caption">${this.t("search_preview_label","How your page will look on Google")}</p>
337
+ <div class="result-head">
338
+ <span class="favicon">${o}</span>
339
+ <div class="result-url">
340
+ <div class="result-host">${e.split("/")[0]}</div>
341
+ <div class="result-crumb">${e}</div>
342
+ </div>
343
+ </div>
344
+ ${t?s.qy`<p class="result-title">${t}</p>`:s.s6}
345
+ ${i?s.qy`<p class="result-desc">${i}</p>`:s.s6}
346
+ </div>
347
+ `}render(){const e=this.direction,t=this.copied?s.qy`<svg viewBox="0 0 24 24" fill="none"><path d="M5 13l4 4L19 7" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" /></svg>`:s.qy`<svg viewBox="0 0 24 24" fill="none"><rect x="9" y="9" width="11" height="11" rx="2" stroke="currentColor" stroke-width="2" /><path d="M5 15V5a2 2 0 0 1 2-2h10" stroke="currentColor" stroke-width="2" stroke-linecap="round" /></svg>`;return s.qy`
348
+ <canvas @click=${this.dismiss}></canvas>
349
+ <div class="card" dir=${e}>
350
+ <div class="check">
351
+ <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
352
+ <path d="M5 13l4 4L19 7" stroke="#fff" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" />
353
+ </svg>
354
+ </div>
355
+ <p class="title">${this.message||this.t("published","Published!")}</p>
356
+ <p class="sub">${this.sub||this.t("publishedSub","Your site is live.")}</p>
357
+
358
+ ${this.renderPreview()}
359
+
360
+ ${this.url?s.qy`
361
+ <div class="actions">
362
+ <a class="view" href=${this.url} target="_blank" rel="noopener">
363
+ <svg viewBox="0 0 24 24" fill="none"><path d="M14 4h6v6M20 4l-9 9M18 13v5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /></svg>
364
+ ${this.t("view_site","View site")}
365
+ </a>
366
+ <button class="copy" type="button" @click=${this.copyLink}>
367
+ ${t}
368
+ ${this.copied?this.t("link_copied","Link copied"):this.t("copy_link","Copy link")}
369
+ </button>
370
+ </div>
371
+ `:s.s6}
372
+ </div>
373
+ `}}u.styles=s.AH`
374
+ :host {
375
+ position: fixed;
376
+ inset: 0;
377
+ z-index: var(--z-blocking, 2147483646);
378
+ pointer-events: none;
379
+ display: block;
380
+ font-family: var(--font-family, Arial, Helvetica, sans-serif);
381
+ }
382
+ canvas {
383
+ position: absolute;
384
+ inset: 0;
385
+ width: 100%;
386
+ height: 100%;
387
+ }
388
+ .card {
389
+ position: absolute;
390
+ top: 50%;
391
+ left: 50%;
392
+ transform: translate(-50%, -50%) scale(0.9);
393
+ background: #ffffff;
394
+ border-radius: 20px;
395
+ box-shadow: 0 30px 80px rgba(26, 26, 46, 0.32);
396
+ padding: 36px 40px 32px;
397
+ text-align: center;
398
+ pointer-events: auto;
399
+ opacity: 0;
400
+ animation: pop 0.44s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
401
+ width: 460px;
402
+ max-width: 90vw;
403
+ box-sizing: border-box;
404
+ }
405
+ @keyframes pop {
406
+ to {
407
+ opacity: 1;
408
+ transform: translate(-50%, -50%) scale(1);
409
+ }
410
+ }
411
+ .check {
412
+ width: 68px;
413
+ height: 68px;
414
+ border-radius: 50%;
415
+ background: #2ec7a9;
416
+ margin: 0 auto 18px;
417
+ display: flex;
418
+ align-items: center;
419
+ justify-content: center;
420
+ box-shadow: 0 0 0 0 rgba(46, 199, 169, 0.45);
421
+ animation: ring 1.6s ease-out 0.2s;
422
+ }
423
+ @keyframes ring {
424
+ 0% { box-shadow: 0 0 0 0 rgba(46, 199, 169, 0.45); }
425
+ 70% { box-shadow: 0 0 0 18px rgba(46, 199, 169, 0); }
426
+ 100% { box-shadow: 0 0 0 0 rgba(46, 199, 169, 0); }
427
+ }
428
+ .check svg {
429
+ width: 34px;
430
+ height: 34px;
431
+ }
432
+ .title {
433
+ font-size: 24px;
434
+ font-weight: 700;
435
+ color: #1a1a2e;
436
+ margin: 0;
437
+ }
438
+ .sub {
439
+ font-size: 14px;
440
+ color: #8a8f9c;
441
+ margin: 8px 0 0;
442
+ }
443
+
444
+ /* Google-style search-result preview — the payoff for the SEO step. */
445
+ .preview {
446
+ margin-top: 22px;
447
+ border: 1px solid #e6e8ee;
448
+ border-radius: 12px;
449
+ padding: 14px 16px;
450
+ text-align: start;
451
+ background: #fbfbfd;
452
+ }
453
+ .preview-caption {
454
+ font-size: 11px;
455
+ font-weight: 600;
456
+ letter-spacing: 0.02em;
457
+ text-transform: uppercase;
458
+ color: #a7abb5;
459
+ margin: 0 0 10px;
460
+ }
461
+ .result-head {
462
+ display: flex;
463
+ align-items: center;
464
+ gap: 8px;
465
+ }
466
+ .favicon {
467
+ flex: none;
468
+ width: 26px;
469
+ height: 26px;
470
+ border-radius: 50%;
471
+ background: var(--primary, #6c5ce7);
472
+ color: #fff;
473
+ display: flex;
474
+ align-items: center;
475
+ justify-content: center;
476
+ font-size: 13px;
477
+ font-weight: 700;
478
+ text-transform: uppercase;
479
+ }
480
+ .result-url {
481
+ min-width: 0;
482
+ }
483
+ .result-host {
484
+ font-size: 13px;
485
+ color: #1a1a2e;
486
+ line-height: 1.2;
487
+ white-space: nowrap;
488
+ overflow: hidden;
489
+ text-overflow: ellipsis;
490
+ /* URLs read left-to-right even in an RTL card. */
491
+ direction: ltr;
492
+ text-align: start;
493
+ }
494
+ .result-crumb {
495
+ font-size: 12px;
496
+ color: #6a7280;
497
+ line-height: 1.2;
498
+ white-space: nowrap;
499
+ overflow: hidden;
500
+ text-overflow: ellipsis;
501
+ direction: ltr;
502
+ text-align: start;
503
+ }
504
+ .result-title {
505
+ margin: 8px 0 0;
506
+ font-size: 18px;
507
+ line-height: 1.3;
508
+ color: #1a56db;
509
+ font-weight: 500;
510
+ overflow: hidden;
511
+ text-overflow: ellipsis;
512
+ display: -webkit-box;
513
+ -webkit-line-clamp: 1;
514
+ -webkit-box-orient: vertical;
515
+ }
516
+ .result-desc {
517
+ margin: 4px 0 0;
518
+ font-size: 13px;
519
+ line-height: 1.5;
520
+ color: #4d5562;
521
+ overflow: hidden;
522
+ text-overflow: ellipsis;
523
+ display: -webkit-box;
524
+ -webkit-line-clamp: 2;
525
+ -webkit-box-orient: vertical;
526
+ }
527
+
528
+ .actions {
529
+ display: flex;
530
+ align-items: center;
531
+ justify-content: center;
532
+ gap: 10px;
533
+ margin-top: 24px;
534
+ }
535
+ .view {
536
+ display: inline-flex;
537
+ align-items: center;
538
+ gap: 8px;
539
+ background: var(--primary, #6c5ce7);
540
+ color: #fff;
541
+ text-decoration: none;
542
+ font-size: 15px;
543
+ font-weight: 600;
544
+ padding: 12px 26px;
545
+ border-radius: 10px;
546
+ transition: filter 0.15s ease;
547
+ }
548
+ .view:hover {
549
+ filter: brightness(1.06);
550
+ }
551
+ .view svg {
552
+ width: 16px;
553
+ height: 16px;
554
+ }
555
+ .copy {
556
+ display: inline-flex;
557
+ align-items: center;
558
+ gap: 6px;
559
+ background: #fff;
560
+ color: #4a4a5a;
561
+ border: 1px solid #d5d7de;
562
+ font-size: 15px;
563
+ font-family: inherit;
564
+ font-weight: 500;
565
+ padding: 12px 18px;
566
+ border-radius: 10px;
567
+ cursor: pointer;
568
+ transition: border-color 0.15s ease, color 0.15s ease;
569
+ }
570
+ .copy:hover {
571
+ border-color: var(--primary, #6c5ce7);
572
+ color: #1a1a2e;
573
+ }
574
+ .copy svg {
575
+ width: 15px;
576
+ height: 15px;
577
+ }
578
+ `,u.properties={message:{type:String},sub:{type:String},url:{type:String},seoTitle:{type:String},seoDescription:{type:String},copied:{type:Boolean}},customElements.define("cdtr-publish-success",u);class f extends s.WF{constructor(){super(),this.channel="",this.isLoading=!1,this.isLocked=!1,this.lockTimer=null}connectedCallback(){super.connectedCallback(),this.onNextStep||(this.onNextStep=o.M.get("config","onNextStep")),this.channel||(this.channel=o.M.get("config","channel")||"")}disconnectedCallback(){super.disconnectedCallback(),this.clearTimers()}clearTimers(){this.lockTimer&&(clearTimeout(this.lockTimer),this.lockTimer=null)}async handleClick(){if(this.isLocked||this.isLoading)return;const e=!!o.M.get("config","access"),t="web"===this.channel,i=e&&t;let s=null;if(!t||(s=await p.open(),s)){this.isLoading=!0,this.isLocked=!0,this.lockTimer=setTimeout(()=>{this.clearTimers(),this.isLoading=!1,this.isLocked=!1},1e4);try{if(t){const e=this.showBuildingLoader();try{i&&s&&(await(0,n.YE)({seo:s}),await(0,n.bK)({})),"function"==typeof this.onNextStep&&await this.onNextStep({toHTML:r.FE,toJSON:r.U2,seo:s??void 0})}finally{e()}return void this.celebratePublish(s)}"function"==typeof this.onNextStep&&await this.onNextStep({toHTML:r.FE,toJSON:r.U2})}catch(e){console.error("Error in publish/onNextStep:",e),this.snackbar(o.M.get("lang","publishError")||"Publish failed")}finally{this.clearTimers(),this.isLoading=!1,this.isLocked=!1}}}snackbar(e){const t=o.M.get("commands");t?.snackbar?.(e)}showBuildingLoader(){const e=(0,h.A)();document.body.appendChild(e);let t=!1;return()=>{t||(t=!0,e.style.transition="opacity 300ms ease",e.style.opacity="0",e.style.pointerEvents="none",setTimeout(()=>e.remove(),320))}}celebratePublish(e){const t=document.createElement("cdtr-publish-success");e&&(t.seoTitle=e.title,t.seoDescription=e.description);const i=o.M.get("app","domains"),s=i?.[0]?.name;s&&(t.url=/^https?:\/\//.test(s)?s:`https://${s}`),document.body.appendChild(t)}render(){const e=!!o.M.get("config","access");if(!(this.onNextStep||"web"===this.channel&&e))return null;const t="web"===this.channel?"publish":"next";return s.qy`
579
+ <paper-button
580
+ @click=${this.handleClick}
581
+ class="next-button"
582
+ ?disabled=${this.isLocked}
583
+ >
584
+ ${this.isLoading?s.qy`
585
+ <div class="loading-spinner"></div>
586
+ `:s.qy`
587
+ <div class="button-content ${this.isLoading?"loading":""}">
588
+ <lang-text text=${t}></lang-text>
589
+ </div>
590
+ `}
591
+ </paper-button>
592
+ `}}f.styles=s.AH`
593
+ :host {
594
+ display: block;
595
+ }
596
+
597
+ .next-button {
598
+ background: var(--primary);
599
+ color: var(--primary-text);
600
+ fill: var(--primary-text);
601
+ text-transform: none;
602
+ color: #fff;
603
+ height: 52px;
604
+ border-radius: 0;
605
+ width: 90px;
606
+ transform: translateX(-4px);
607
+ position: relative;
608
+ overflow: hidden;
609
+ }
610
+
611
+ .next-button:disabled {
612
+ opacity: 0.6;
613
+ cursor: not-allowed;
614
+ }
615
+
616
+ .loading-spinner {
617
+ position: absolute;
618
+ top: 50%;
619
+ left: 50%;
620
+ transform: translate(-50%, -50%);
621
+ width: 20px;
622
+ height: 20px;
623
+ border: 2px solid transparent;
624
+ border-top: 2px solid #fff;
625
+ border-radius: 50%;
626
+ animation: spin 1s linear infinite;
627
+ }
628
+
629
+ @keyframes spin {
630
+ 0% { transform: translate(-50%, -50%) rotate(0deg); }
631
+ 100% { transform: translate(-50%, -50%) rotate(360deg); }
632
+ }
633
+
634
+ .button-content {
635
+ opacity: 1;
636
+ transition: opacity 0.3s ease;
637
+ }
638
+
639
+ .button-content.loading {
640
+ opacity: 0;
641
+ }
642
+
643
+
644
+ `,f.properties={onNextStep:{type:Function},channel:{type:String},isLoading:{type:Boolean},isLocked:{type:Boolean},lockTimer:{type:Number}},customElements.define("cdtr-next-button",f)}}]);
Binary file