@creaditor/newsletter-starterkit 1.0.57 → 1.0.59

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 (43) 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 +1 -1
  4. package/dist/1260.creaditor.bundle.js.gz +0 -0
  5. package/dist/1271.creaditor.bundle.js +1 -544
  6. package/dist/1271.creaditor.bundle.js.gz +0 -0
  7. package/dist/1529.creaditor.bundle.js +1 -1
  8. package/dist/1529.creaditor.bundle.js.gz +0 -0
  9. package/dist/170.creaditor.bundle.js +1 -1
  10. package/dist/170.creaditor.bundle.js.gz +0 -0
  11. package/dist/2765.creaditor.bundle.js +1 -1
  12. package/dist/2765.creaditor.bundle.js.gz +0 -0
  13. package/dist/3521.creaditor.bundle.js +1 -1
  14. package/dist/3521.creaditor.bundle.js.gz +0 -0
  15. package/dist/3553.creaditor.bundle.js +1 -1
  16. package/dist/3553.creaditor.bundle.js.gz +0 -0
  17. package/dist/380.creaditor.bundle.js +7 -5
  18. package/dist/380.creaditor.bundle.js.gz +0 -0
  19. package/dist/3847.creaditor.bundle.js +951 -21
  20. package/dist/3847.creaditor.bundle.js.gz +0 -0
  21. package/dist/5909.creaditor.bundle.js +6 -6
  22. package/dist/5909.creaditor.bundle.js.gz +0 -0
  23. package/dist/5926.creaditor.bundle.js +1 -1
  24. package/dist/5926.creaditor.bundle.js.gz +0 -0
  25. package/dist/7238.creaditor.bundle.js +1 -1
  26. package/dist/7238.creaditor.bundle.js.gz +0 -0
  27. package/dist/763.creaditor.bundle.js +15 -1
  28. package/dist/763.creaditor.bundle.js.gz +0 -0
  29. package/dist/7654.creaditor.bundle.js +1 -1
  30. package/dist/7654.creaditor.bundle.js.gz +0 -0
  31. package/dist/8516.creaditor.bundle.js +1 -1
  32. package/dist/8516.creaditor.bundle.js.gz +0 -0
  33. package/dist/8547.creaditor.bundle.js +3 -3
  34. package/dist/8547.creaditor.bundle.js.gz +0 -0
  35. package/dist/9041.creaditor.bundle.js +1 -1
  36. package/dist/9041.creaditor.bundle.js.gz +0 -0
  37. package/dist/9994.creaditor.bundle.js +1 -1
  38. package/dist/9994.creaditor.bundle.js.gz +0 -0
  39. package/dist/creaditor.bundle.js +511 -220
  40. package/dist/creaditor.bundle.js.gz +0 -0
  41. package/dist/service-worker.js +1 -1
  42. package/dist/service-worker.js.gz +0 -0
  43. package/package.json +1 -1
@@ -1,544 +1 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[567,1271],{70567(e,t,n){n.r(t),n.d(t,{TextPromptEditor:()=>b});var s,i,o=n(86959),a=n(86319),r=n(59929),l=n(49410);const c="/api/text-color",p=()=>{try{const e=a.M.get("app","_id");return"string"==typeof e&&e.length>0?e:null}catch(e){return null}},d="#111827",h="#ffffff",g=e=>{const t=/^#?([0-9a-f]{6})$/i.exec((e||"").trim());if(!t)return null;const n=parseInt(t[1],16);return{r:n>>16&255,g:n>>8&255,b:255&n}},m=e=>{const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)},u=e=>{let{r:t,g:n,b:s}=e;return.2126*m(t)+.7152*m(n)+.0722*m(s)},f=(e,t)=>{const n=g(e),s=g(t);if(!n||!s)return 1;const i=u(n),o=u(s);return(Math.max(i,o)+.05)/(Math.min(i,o)+.05)},x=(e,t,n)=>e&&f(e,t)>=n?e:f(d,t)>=f(h,t)?d:h,y={en:{title:"Edit with AI",placeholder:"Tell me how to change this text…",send:"Send",thinking:"Working…",keepLength:"Keep length",editingSelection:"Selection",editingElement:"Whole text",error:"Something went wrong. Please try again.",empty:"Ask me to improve, shorten, or rewrite this text.",roleHeading:"Headings",roleBody:"Body",colorize:"Colorize",colorizing:"Picking colors…",colorizeDone:"Applied on-brand colors.",actions:{improve:"Improve",shorten:"Shorten",lengthen:"Lengthen",grammar:"Fix grammar",tone:"Warmer tone"},prompts:{improve:"Improve this text — make it clearer and more compelling. Keep the meaning.",shorten:"Make this shorter and more concise, without losing the key point.",lengthen:"Expand this with a little more detail and flow.",grammar:"Fix any spelling and grammar mistakes. Keep the wording and meaning.",tone:"Make the tone warmer and friendlier."}},he:{title:"עריכה עם AI",placeholder:"כתבו לי איך לשנות את הטקסט…",send:"שליחה",thinking:"עובד…",keepLength:"שמור על האורך",editingSelection:"קטע מסומן",editingElement:"כל הטקסט",error:"משהו השתבש. נסו שוב.",empty:"בקשו ממני לשפר, לקצר או לנסח מחדש את הטקסט.",roleHeading:"כותרות",roleBody:"טקסט",colorize:"צביעה חכמה",colorizing:"בוחר צבעים…",colorizeDone:"הוחלו צבעים בהתאמה למותג.",actions:{improve:"שיפור",shorten:"קיצור",lengthen:"הרחבה",grammar:"תיקון שגיאות",tone:"טון חם יותר"},prompts:{improve:"שפר את הטקסט הזה — שיהיה ברור ומשכנע יותר, בלי לשנות את המשמעות.",shorten:"קצר את הטקסט הזה ותהפוך אותו לתמציתי יותר, בלי לאבד את העיקר.",lengthen:"הרחב את הטקסט הזה עם עוד קצת פירוט וזרימה.",grammar:"תקן שגיאות כתיב ודקדוק. שמור על הניסוח והמשמעות.",tone:"הפוך את הטון לחם וידידותי יותר."}}};let b=(0,l.EM)("cdtr-text-prompt-editor")(((i=class extends r.WF{constructor(){super(),this.commands=null,this.elementId=null,this._messages=[],this._input="",this._busy=!1,this._colorizing=!1,this._scope="element",this._error="",this._keepLength=!1,this._lang="he",this._selPreview="",this._streamingIdx=null}connectedCallback(){super.connectedCallback();const e=a.M.get("config","language"),t=this.commands&&this.commands.getText&&this.commands.getText()||"";this._lang="he"===e||"en"===e?e:t?/[\u0590-\u05FF]/.test(t||"")?"he":"en":"rtl"===document?.documentElement?.dir?"he":"en",this._scope=this._currentScope(),this._selPreview=this._readSelPreview(),this._onSelChange=()=>{const e=this._currentScope();e!==this._scope&&(this._scope=e);const t=this._readSelPreview();t!==this._selPreview&&(this._selPreview=t)},this.commands?.onSelectionChange&&(this._unsubSel=this.commands.onSelectionChange(this._onSelChange)),document.addEventListener("selectionchange",this._onSelChange),setTimeout(()=>{const e=this.renderRoot?.querySelector(".composer-input");e&&e.focus()},50),this._hydrate()}async _hydrate(){const e=p();if(!e||!this.elementId)return;const t=await this._resolveToken(!1);if(!t)return;const n=`${o.XW.studio_url}/api/datastore/sessions/by-doc?doc_id=${encodeURIComponent(e)}&surface=text-element&element_id=${encodeURIComponent(this.elementId)}`;try{const e=await fetch(n,{method:"GET",headers:{Accept:"application/json",Authorization:`Bearer ${t}`}});if(!e.ok)return;const s=await e.json(),i=Array.isArray(s?.messages)?s.messages:[];if(0===i.length)return;if(this._messages.length>0||this._busy)return;this._messages=i.filter(e=>e&&("user"===e.role||"assistant"===e.role)).map(e=>({role:e.role,content:e.content})).filter(e=>"string"==typeof e.content&&e.content.length>0)}catch(e){}}disconnectedCallback(){super.disconnectedCallback(),this._unsubSel&&(this._unsubSel(),this._unsubSel=null),this._onSelChange&&(document.removeEventListener("selectionchange",this._onSelChange),this._onSelChange=null)}get t(){const e=y[this._lang]||y.en,t=e=>{const t=a.M.get("lang",e);return"string"==typeof t&&t?t:void 0};return{title:t("text_ai_title")??e.title,placeholder:t("text_ai_placeholder")??e.placeholder,send:t("text_ai_send")??e.send,thinking:t("text_ai_thinking")??e.thinking,keepLength:t("text_ai_keep_length")??e.keepLength,editingSelection:t("text_ai_scope_selection")??e.editingSelection,editingElement:t("text_ai_scope_element")??e.editingElement,error:t("text_ai_error")??e.error,empty:t("text_ai_empty")??e.empty,roleHeading:t("text_ai_role_heading")??e.roleHeading,roleBody:t("text_ai_role_body")??e.roleBody,colorize:t("text_ai_action_colorize")??e.colorize,colorizing:t("text_ai_colorizing")??e.colorizing,colorizeDone:t("text_ai_colorize_done")??e.colorizeDone,actions:{improve:t("text_ai_action_improve")??e.actions.improve,shorten:t("text_ai_action_shorten")??e.actions.shorten,lengthen:t("text_ai_action_lengthen")??e.actions.lengthen,grammar:t("text_ai_action_grammar")??e.actions.grammar,tone:t("text_ai_action_tone")??e.actions.tone},prompts:{improve:t("text_ai_prompt_improve")??e.prompts.improve,shorten:t("text_ai_prompt_shorten")??e.prompts.shorten,lengthen:t("text_ai_prompt_lengthen")??e.prompts.lengthen,grammar:t("text_ai_prompt_grammar")??e.prompts.grammar,tone:t("text_ai_prompt_tone")??e.prompts.tone}}}_currentScope(){const e=this.commands;return e&&e.hasSelection&&e.hasSelection()?"selection":"element"}_readSelPreview(){const e=this.commands;if(!e||!e.hasSelection||!e.hasSelection())return"";const t=e.getSelectionText&&e.getSelectionText()||"";return this._truncateMiddle(t.replace(/\s+/g," ").trim(),96)}_truncateMiddle(e,t){if(e.length<=t)return e;const n=Math.ceil(.6*(t-1)),s=t-1-n;return`${e.slice(0,n)}…${e.slice(e.length-s)}`}_dismissSelection(){const e=this.commands,t=e&&e.getSelectionRange&&e.getSelectionRange();t&&e.setSelectionRange&&e.setSelectionRange(t.to,t.to),this._scope="element",this._selPreview=""}_onInput(e){this._input=e.target.value}_onKeydown(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),this._send(this._input))}_quickAction(e){this._send(this.t.prompts[e])}_toggleKeepLength(e){this._keepLength=!!e.target.checked}async _send(e){const t=(e||"").trim();if(!t||this._busy||!this.commands)return;const n=this._currentScope();this._scope=n;const s="selection"===n?this.commands.getSelectionHTML?.()??this.commands.getSelectionText():this.commands.getHTML?.()??this.commands.getText(),i="heading"===(this.commands.getBlockType?.()||{}).type?"title":"paragraph";this._messages=[...this._messages,{role:"user",content:t}],this._input="",this._error="",this._busy=!0;const o=this._messages.filter(e=>"user"===e.role||"assistant"===e.role).map(e=>({role:e.role,content:(e.content||"").slice(0,8e3)})).filter(e=>e.content.length>0),a=p(),r={messages:o,text:(s||"").slice(0,4e4),scope:n,format:"html",contentType:i,keepLength:this._keepLength,language:this._lang,...a?{doc_id:a}:{},...a&&this.elementId?{element_id:this.elementId}:{}};try{await this._runStream(r,n)}catch(e){console.error("[text-chat] turn failed:",e),this._error=this.t.error,this._messages=[...this._messages,{role:"error",content:this.t.error}]}finally{this._busy=!1,this._streamingIdx=null,this._scope=this._currentScope(),this._selPreview=this._readSelPreview()}}async _resolveToken(e){const t=a.M.get("resolveStudioToken");if("function"!=typeof t)return console.warn("[text-chat] no resolveStudioToken on store; request will likely 401."),null;try{return await t({forceRefresh:!!e})}catch(e){return console.warn("[text-chat] token resolution failed:",e),null}}async _postTo(e,t,n,s){const i=await this._resolveToken(n),a={"Content-Type":"application/json",Accept:s||"application/json"};return i&&(a.Authorization=`Bearer ${i}`),fetch(o.XW.studio_url+e,{method:"POST",headers:a,body:JSON.stringify(t)})}async _post(e,t){return this._postTo("/api/text-chat",e,t,"text/event-stream, application/json")}_gatherPalette(){const e=new Set,t=(n,s)=>{if(!(s>5||null==n))return"string"==typeof n?(t=>{const n=/^#?([0-9a-f]{6})$/i.exec((t||"").trim());n&&e.add(`#${n[1].toLowerCase()}`)})(n):Array.isArray(n)?n.forEach(e=>t(e,s+1)):"object"==typeof n?Object.values(n).forEach(e=>t(e,s+1)):void 0};try{t(a.M.get("colorPalletes"),0)}catch(e){}return Array.from(e).slice(0,48)}async _postColor(e){let t=await this._postTo(c,e,!1);401===t.status&&(t=await this._postTo(c,e,!0));let n=null;try{n=await t.json()}catch(e){}if(!t.ok||!n||!1===n.ok)throw new Error(n&&n.reason||`HTTP ${t.status}`);return n}async _colorize(){if(this._busy||this._colorizing||!this.commands)return;const e=this.commands,t=e.getBlocks&&e.getBlocks()||[];if(!t.length)return;const n=e=>"heading"===e.type?"heading":"body",s=Array.from(new Set(t.map(n))),i=e.getBackgroundColor&&e.getBackgroundColor()||h,o=this._gatherPalette(),a=t.filter(e=>"heading"===n(e)).map(e=>e.text).join(" ").slice(0,500),r=t.filter(e=>"body"===n(e)).map(e=>e.text).join(" ").slice(0,500);this._messages=[...this._messages,{role:"user",content:`🎨 ${this.t.colorize}`}],this._error="",this._colorizing=!0,this._busy=!0;try{const l=await this._postColor({roles:s,background:i,palette:o,...a?{headingText:a}:{},...r?{bodyText:r}:{},language:this._lang}),c=l.heading?x(l.heading,i,3):null,p=l.body?x(l.body,i,4.5):null;t.forEach(t=>{const s="heading"===n(t)?c:p;s&&e.setColorRange&&e.setColorRange(t.from,t.to,s)});const d=[];c&&d.push({label:this.t.roleHeading,color:c}),p&&d.push({label:this.t.roleBody,color:p}),this._messages=[...this._messages,{role:"assistant",content:l.rationale||this.t.colorizeDone,swatches:d}]}catch(e){console.error("[text-color] colorize failed:",e),this._error=this.t.error,this._messages=[...this._messages,{role:"error",content:this.t.error}]}finally{this._colorizing=!1,this._busy=!1}}async _runStream(e,t){let n=await this._post(e,!1);if(401===n.status&&(n=await this._post(e,!0)),!n.ok){let e=`HTTP ${n.status}`;try{const t=await n.json();t&&t.reason&&(e=t.reason)}catch{}throw new Error(e)}const s=this._messages.length;this._messages=[...this._messages,{role:"assistant",content:""}],this._streamingIdx=s;let i="";await this._consumeSse(n.body,(e,t)=>{if("text"===e&&t&&"string"==typeof t.delta)i+=t.delta,this._updateAssistant(s,(e=>{const t=document.createElement("div");return t.innerHTML=e||"",(t.textContent||"").replace(/^[#>\-\s]+/gm,"").replace(/\*\*?|__?|`|~~/g,"").replace(/\|/g," ").replace(/\n{2,}/g,"\n").trim()})(i));else if("error"===e)throw new Error(t&&t.reason||"stream error")}),i.trim()&&("element"===t?(this.commands.selectAll(),this.commands.insertContentHtml(i)):this.commands.insertInlineMarkdown?this.commands.insertInlineMarkdown(i):this.commands.insertContent(i))}_updateAssistant(e,t){const n=this._messages.slice();n[e]&&(n[e]={role:"assistant",content:t}),this._messages=n}async _consumeSse(e,t){const n=e.getReader(),s=new TextDecoder;let i="";try{for(;;){const{done:e,value:o}=await n.read();if(e)break;let a;for(i+=s.decode(o,{stream:!0});-1!==(a=i.indexOf("\n\n"));){const e=i.slice(0,a);i=i.slice(a+2);let n,s="message",o="";for(const t of e.split("\n"))t.startsWith("event:")?s=t.slice(6).trim():t.startsWith("data:")&&(o+=(o?"\n":"")+t.slice(5).replace(/^ /,""));if(o){try{n=JSON.parse(o)}catch{continue}t(s,n)}}}}finally{try{n.releaseLock()}catch{}}}render(){const e=this.t,t="he"===this._lang,n=this._messages.length>0||this._busy,s=!this._busy&&this._input.trim().length>0;return r.qy`
2
- <cdtr-editor-container>
3
- <div class="ai" dir=${t?"rtl":"ltr"}>
4
- <header class="ai-head">
5
- <span class="brand">
6
- <span class="spark">✨</span>
7
- <span class="brand-title">${e.title}</span>
8
- </span>
9
- <span class="scope" data-scope=${this._scope}>
10
- ${"selection"===this._scope?e.editingSelection:e.editingElement}
11
- </span>
12
- </header>
13
-
14
- <div class="quick">
15
- ${["improve","shorten","lengthen","grammar","tone"].map(t=>r.qy`
16
- <button
17
- class="chip"
18
- ?disabled=${this._busy}
19
- @click=${()=>this._quickAction(t)}
20
- >
21
- ${e.actions[t]}
22
- </button>
23
- `)}
24
- <button
25
- class="chip chip--color"
26
- ?disabled=${this._busy}
27
- @click=${()=>this._colorize()}
28
- title=${e.colorize}
29
- >
30
- <span class="chip-swatch"></span>
31
- ${this._colorizing?e.colorizing:e.colorize}
32
- </button>
33
- </div>
34
-
35
- <label class="keeplen">
36
- <input
37
- type="checkbox"
38
- .checked=${this._keepLength}
39
- ?disabled=${this._busy}
40
- @change=${this._toggleKeepLength}
41
- />
42
- <span>${e.keepLength}</span>
43
- </label>
44
-
45
- ${n?r.qy`<div class="log">
46
- ${this._messages.map((e,t)=>{const n="assistant"===e.role&&t===this._streamingIdx,s=n&&!e.content;return r.qy`
47
- <div class="msg ${e.role}">
48
- <div
49
- class="bubble ${n?"streaming":""} ${s?"thinking":""}"
50
- >
51
- ${s?r.qy`<span class="dot"></span><span class="dot"></span
52
- ><span class="dot"></span>`:r.qy`${e.content}${e.swatches&&e.swatches.length?r.qy`<span class="swatches">
53
- ${e.swatches.map(e=>r.qy`<span
54
- class="swatch"
55
- title=${e.label}
56
- >
57
- <span
58
- class="swatch-dot"
59
- style="background:${e.color}"
60
- ></span>
61
- <span class="swatch-label"
62
- >${e.label}</span
63
- >
64
- </span>`)}
65
- </span>`:""}`}
66
- </div>
67
- </div>
68
- `})}
69
- ${this._busy&&null===this._streamingIdx?r.qy`<div class="msg assistant">
70
- <div class="bubble thinking">
71
- <span class="dot"></span><span class="dot"></span
72
- ><span class="dot"></span>
73
- </div>
74
- </div>`:""}
75
- </div>`:r.qy`<p class="hint">${e.empty}</p>`}
76
-
77
- ${"selection"===this._scope&&this._selPreview?r.qy`<div class="selpill" title=${this._selPreview}>
78
- <span class="selpill-label">${e.editingSelection}</span>
79
- <span class="selpill-text">"${this._selPreview}"</span>
80
- <button
81
- class="selpill-x"
82
- title=${e.editingElement}
83
- aria-label=${e.editingElement}
84
- ?disabled=${this._busy}
85
- @click=${this._dismissSelection}
86
- >
87
- ✕
88
- </button>
89
- </div>`:""}
90
-
91
- <div class="composer">
92
- <textarea
93
- class="composer-input"
94
- rows="1"
95
- .value=${this._input}
96
- placeholder=${e.placeholder}
97
- ?disabled=${this._busy}
98
- @input=${this._onInput}
99
- @keydown=${this._onKeydown}
100
- ></textarea>
101
- <button
102
- class="send"
103
- title=${e.send}
104
- aria-label=${e.send}
105
- ?disabled=${!s}
106
- @click=${()=>this._send(this._input)}
107
- >
108
- <svg
109
- class=${t?"flip":""}
110
- viewBox="0 0 24 24"
111
- width="18"
112
- height="18"
113
- fill="none"
114
- stroke="currentColor"
115
- stroke-width="2"
116
- stroke-linecap="round"
117
- stroke-linejoin="round"
118
- >
119
- <path d="M22 2 11 13" />
120
- <path d="M22 2 15 22 11 13 2 9z" />
121
- </svg>
122
- </button>
123
- </div>
124
- </div>
125
- </cdtr-editor-container>
126
- `}}).properties={commands:{attribute:!1},elementId:{attribute:!1},_messages:{state:!0},_input:{state:!0},_busy:{state:!0},_colorizing:{state:!0},_scope:{state:!0},_error:{state:!0},_keepLength:{state:!0},_selPreview:{state:!0},_streamingIdx:{state:!0},_lang:{state:!0}},i.styles=r.AH`
127
- *,
128
- *::before,
129
- *::after {
130
- box-sizing: border-box;
131
- }
132
- :host {
133
- display: block;
134
- font-family: inherit;
135
- --accent: #7c3aed;
136
- --accent-2: #a855f7;
137
- --ink: #1f2937;
138
- --muted: #6b7280;
139
- --line: #ececf1;
140
- --surface: #f6f6f9;
141
- }
142
- .ai {
143
- display: flex;
144
- flex-direction: column;
145
- gap: 12px;
146
- width: 100%;
147
- min-width: 0;
148
- padding: 2px;
149
- color: var(--ink);
150
- }
151
-
152
- /* Header */
153
- .ai-head {
154
- display: flex;
155
- align-items: center;
156
- justify-content: space-between;
157
- gap: 8px;
158
- min-width: 0;
159
- }
160
- .brand {
161
- display: inline-flex;
162
- align-items: center;
163
- gap: 7px;
164
- min-width: 0;
165
- }
166
- .spark {
167
- font-size: 15px;
168
- line-height: 1;
169
- }
170
- .brand-title {
171
- font-weight: 700;
172
- font-size: 14px;
173
- letter-spacing: -0.01em;
174
- white-space: nowrap;
175
- overflow: hidden;
176
- text-overflow: ellipsis;
177
- }
178
- .scope {
179
- flex: none;
180
- font-size: 11px;
181
- font-weight: 600;
182
- color: var(--accent);
183
- background: #f3ecff;
184
- border-radius: 999px;
185
- padding: 3px 9px;
186
- white-space: nowrap;
187
- }
188
- .scope[data-scope="selection"] {
189
- color: #b45309;
190
- background: #fdf1dc;
191
- }
192
-
193
- /* Quick actions */
194
- .quick {
195
- display: flex;
196
- flex-wrap: wrap;
197
- gap: 6px;
198
- }
199
- .chip {
200
- border: 1px solid var(--line);
201
- background: #fff;
202
- color: #374151;
203
- border-radius: 8px;
204
- padding: 6px 11px;
205
- font: inherit;
206
- font-size: 12px;
207
- font-weight: 500;
208
- cursor: pointer;
209
- transition: border-color 0.12s ease, color 0.12s ease,
210
- background 0.12s ease;
211
- }
212
- .chip:hover:not(:disabled) {
213
- border-color: var(--accent-2);
214
- color: var(--accent);
215
- background: #faf6ff;
216
- }
217
- .chip:active:not(:disabled) {
218
- transform: translateY(0.5px);
219
- }
220
- .chip:disabled {
221
- opacity: 0.45;
222
- cursor: default;
223
- }
224
-
225
- /* Colorize chip — accented so it reads as a distinct "smart color" action */
226
- .chip--color {
227
- display: inline-flex;
228
- align-items: center;
229
- gap: 6px;
230
- border-color: transparent;
231
- color: #fff;
232
- background: linear-gradient(135deg, var(--accent), var(--accent-2));
233
- }
234
- .chip--color:hover:not(:disabled) {
235
- color: #fff;
236
- background: linear-gradient(135deg, var(--accent-2), var(--accent));
237
- filter: brightness(1.03);
238
- }
239
- .chip-swatch {
240
- width: 11px;
241
- height: 11px;
242
- border-radius: 3px;
243
- background: conic-gradient(
244
- from 0deg,
245
- #f87171,
246
- #fbbf24,
247
- #34d399,
248
- #60a5fa,
249
- #a855f7,
250
- #f87171
251
- );
252
- box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
253
- }
254
-
255
- /* Applied-color swatches shown under a colorize result bubble */
256
- .swatches {
257
- display: flex;
258
- flex-wrap: wrap;
259
- gap: 6px 12px;
260
- margin-top: 7px;
261
- }
262
- .swatch {
263
- display: inline-flex;
264
- align-items: center;
265
- gap: 5px;
266
- font-size: 11px;
267
- color: var(--muted);
268
- }
269
- .swatch-dot {
270
- width: 13px;
271
- height: 13px;
272
- border-radius: 4px;
273
- box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14);
274
- }
275
-
276
- /* Keep-length toggle */
277
- .keeplen {
278
- display: inline-flex;
279
- align-items: center;
280
- gap: 7px;
281
- font-size: 12px;
282
- color: var(--muted);
283
- cursor: pointer;
284
- user-select: none;
285
- align-self: flex-start;
286
- }
287
- .keeplen input {
288
- width: 15px;
289
- height: 15px;
290
- accent-color: var(--accent);
291
- cursor: pointer;
292
- margin: 0;
293
- }
294
-
295
- /* Hint (empty state) */
296
- .hint {
297
- margin: 0;
298
- font-size: 12.5px;
299
- line-height: 1.5;
300
- color: #9aa1ad;
301
- }
302
-
303
- /* Message log */
304
- .log {
305
- display: flex;
306
- flex-direction: column;
307
- gap: 8px;
308
- max-height: 240px;
309
- overflow-y: auto;
310
- padding: 2px 1px;
311
- scrollbar-width: thin;
312
- }
313
- .msg {
314
- display: flex;
315
- }
316
- .msg.user {
317
- justify-content: flex-end;
318
- }
319
- .msg.assistant,
320
- .msg.error {
321
- justify-content: flex-start;
322
- }
323
- .bubble {
324
- max-width: 88%;
325
- padding: 8px 11px;
326
- border-radius: 13px;
327
- font-size: 13px;
328
- line-height: 1.45;
329
- white-space: pre-wrap;
330
- overflow-wrap: anywhere;
331
- }
332
- .msg.user .bubble {
333
- background: linear-gradient(135deg, var(--accent), var(--accent-2));
334
- color: #fff;
335
- border-end-end-radius: 4px;
336
- }
337
- .msg.assistant .bubble {
338
- background: var(--surface);
339
- color: var(--ink);
340
- border-end-start-radius: 4px;
341
- }
342
- .msg.error .bubble {
343
- background: #fef2f2;
344
- color: #b91c1c;
345
- border: 1px solid #fecaca;
346
- }
347
- .bubble.thinking {
348
- display: inline-flex;
349
- align-items: center;
350
- gap: 4px;
351
- padding: 11px;
352
- }
353
- .dot {
354
- width: 6px;
355
- height: 6px;
356
- border-radius: 50%;
357
- background: var(--accent-2);
358
- display: inline-block;
359
- animation: blink 1.2s infinite both;
360
- }
361
- .dot:nth-child(2) {
362
- animation-delay: 0.15s;
363
- }
364
- .dot:nth-child(3) {
365
- animation-delay: 0.3s;
366
- }
367
- @keyframes blink {
368
- 0%,
369
- 80%,
370
- 100% {
371
- opacity: 0.25;
372
- transform: translateY(0);
373
- }
374
- 40% {
375
- opacity: 1;
376
- transform: translateY(-1px);
377
- }
378
- }
379
-
380
- /* Streaming shimmer FX — a soft light sweeps across the bubble while the
381
- model types, plus a gentle purple glow. Text stays fully readable. */
382
- .msg.assistant .bubble.streaming {
383
- position: relative;
384
- overflow: hidden;
385
- box-shadow: 0 0 0 1px #ece0ff, 0 4px 16px -6px rgba(124, 58, 237, 0.4);
386
- animation: bubbleGlow 1.8s ease-in-out infinite;
387
- }
388
- .msg.assistant .bubble.streaming::after {
389
- content: "";
390
- position: absolute;
391
- inset: 0;
392
- background: linear-gradient(
393
- 105deg,
394
- transparent 20%,
395
- rgba(168, 85, 247, 0.22) 50%,
396
- transparent 80%
397
- );
398
- transform: translateX(-120%);
399
- animation: sweep 1.5s ease-in-out infinite;
400
- pointer-events: none;
401
- }
402
- @keyframes sweep {
403
- to {
404
- transform: translateX(120%);
405
- }
406
- }
407
- @keyframes bubbleGlow {
408
- 0%,
409
- 100% {
410
- box-shadow: 0 0 0 1px #ece0ff, 0 3px 12px -6px rgba(124, 58, 237, 0.3);
411
- }
412
- 50% {
413
- box-shadow: 0 0 0 1px #e3d0ff, 0 6px 20px -6px rgba(168, 85, 247, 0.55);
414
- }
415
- }
416
-
417
- /* Selection context pill (what a "Selection" edit will target) */
418
- .selpill {
419
- display: flex;
420
- align-items: center;
421
- gap: 7px;
422
- min-width: 0;
423
- padding: 6px 8px 6px 11px;
424
- border: 1px solid #f0e4d3;
425
- background: linear-gradient(90deg, #fdf6ea, #fef1dc);
426
- border-radius: 10px;
427
- font-size: 12px;
428
- animation: pillIn 0.18s ease;
429
- }
430
- .selpill-label {
431
- flex: none;
432
- font-weight: 700;
433
- color: #b45309;
434
- white-space: nowrap;
435
- }
436
- .selpill-text {
437
- flex: 1 1 auto;
438
- min-width: 0;
439
- color: #7c5a2a;
440
- white-space: nowrap;
441
- overflow: hidden;
442
- text-overflow: ellipsis;
443
- font-style: italic;
444
- }
445
- .selpill-x {
446
- flex: none;
447
- width: 20px;
448
- height: 20px;
449
- display: inline-flex;
450
- align-items: center;
451
- justify-content: center;
452
- border: none;
453
- border-radius: 6px;
454
- background: transparent;
455
- color: #b08a55;
456
- font-size: 12px;
457
- line-height: 1;
458
- cursor: pointer;
459
- transition: background 0.12s ease, color 0.12s ease;
460
- }
461
- .selpill-x:hover:not(:disabled) {
462
- background: #f6e6cd;
463
- color: #92400e;
464
- }
465
- .selpill-x:disabled {
466
- opacity: 0.4;
467
- cursor: default;
468
- }
469
- @keyframes pillIn {
470
- from {
471
- opacity: 0;
472
- transform: translateY(3px);
473
- }
474
- }
475
-
476
- /* Composer */
477
- .composer {
478
- display: flex;
479
- align-items: flex-end;
480
- gap: 8px;
481
- border: 1px solid var(--line);
482
- border-radius: 14px;
483
- padding: 6px 6px 6px 10px;
484
- background: #fff;
485
- transition: border-color 0.12s ease, box-shadow 0.12s ease;
486
- }
487
- .composer:focus-within {
488
- border-color: var(--accent-2);
489
- box-shadow: 0 0 0 3px #f1e9ff;
490
- }
491
- .composer-input {
492
- flex: 1 1 auto;
493
- min-width: 0;
494
- resize: none;
495
- border: none;
496
- outline: none;
497
- background: transparent;
498
- padding: 6px 2px;
499
- font: inherit;
500
- font-size: 13px;
501
- line-height: 1.4;
502
- color: var(--ink);
503
- max-height: 96px;
504
- }
505
- .composer-input::placeholder {
506
- color: #aab0bb;
507
- }
508
- .send {
509
- flex: none;
510
- width: 34px;
511
- height: 34px;
512
- display: inline-flex;
513
- align-items: center;
514
- justify-content: center;
515
- border: none;
516
- border-radius: 10px;
517
- background: linear-gradient(135deg, var(--accent), var(--accent-2));
518
- color: #fff;
519
- cursor: pointer;
520
- transition: opacity 0.12s ease, transform 0.12s ease;
521
- }
522
- .send:hover:not(:disabled) {
523
- transform: translateY(-1px);
524
- }
525
- .send:disabled {
526
- opacity: 0.4;
527
- cursor: default;
528
- }
529
- .send svg.flip {
530
- transform: scaleX(-1);
531
- }
532
-
533
- @media (prefers-reduced-motion: reduce) {
534
- .dot,
535
- .send,
536
- .chip,
537
- .selpill,
538
- .msg.assistant .bubble.streaming,
539
- .msg.assistant .bubble.streaming::after {
540
- animation: none;
541
- transition: none;
542
- }
543
- }
544
- `,s=i))||s},71271(e,t,n){n.d(t,{default:()=>u});var s=n(53577),i=n(74265),o=n(86319);const a=[100,300,400,500,600,700,900].map(e=>({value:String(e),label:String(e)})),r=e=>{{const{component:t,commands:n,helpers:r}=e,l=t.tiptap,c=l.state.selection.$anchor.node().attrs,p=l.isActive("heading",{level:1})?"h1":l.isActive("heading",{level:2})?"h2":l.isActive("heading",{level:3})?"h3":l.isActive("heading",{level:4})?"h4":l.isActive("heading",{level:5})?"h5":l.isActive("heading",{level:6})?"h6":"paragraph";let d=e.languageJson;const h=e.language||"he";return d||(d="he"===h?s:i),{select:e=>{let{changeTab:t,tab:n}=e},tabs:e=>{const t=l.isActive("customBulletItem"),n=[{text:"style",selected:!t},...t?[{text:"icons",selected:!0}]:[],{text:"settings"}];return n.forEach(t=>t.selected=t.text===e),n},layout:e=>{let{tab:s,changeTab:i,tabs:r}=e;return[{type:"info",text:"text_micro_copy",active:()=>"style"===s.text},{type:"heading",level:6,text:"typography",active:()=>"style"===s.text},{type:"dropdown",active:()=>"style"===s.text,title:"type",value:p,items:[{value:"H1"},{value:"H2"},{value:"H3"},{value:"H4"},{value:"H5"},{value:"H6"},{value:"paragraph"}],onChange:e=>{const t=e.target.value;switch(t){case"H1":case"H2":case"H3":case"H4":case"H5":case"H6":l.chain().setHeading({level:parseInt(t.slice(1))}).run();break;case"paragraph":l.chain().setParagraph().run()}}},{type:"slider",title:"fontSize",min:8,step:2,max:74,value:parseInt(l.getAttributes("textStyle").fontSize||"16px"),active:()=>"style"===s.text,onInput:e=>{const n=e.target.value,s=t.tiptap,i=s.view.state.selection;i.from===i.to?s.chain().selectAll().setFontSize(n).run():s.chain().setFontSize(n).run()}},{type:"dropdown",title:"fontWeight",active:()=>"style"===s.text&&"web"===o.M.get("config","channel"),value:String(l.getAttributes("textStyle").fontWeight||400),selected:String(l.getAttributes("textStyle").fontWeight||400),items:a,onChange:e=>{const n=e.target.value,s=t.tiptap,i=s.view.state.selection;i.from===i.to?s.chain().selectAll().setFontWeight(n).run():s.chain().setFontWeight(n).run()}},{type:"heading",level:6,text:"spacing",active:()=>"style"===s.text},{type:"slider",title:"lineHeight",min:1,max:3,step:.1,value:parseFloat(c.lineHeight||1),active:()=>"style"===s.text,onInput:e=>{const n=e.target.value,s=t.tiptap,i=s.view.state.selection;i.from===i.to?s.chain().selectAll().setLineHeight(n).run():s.chain().setLineHeight(n).run()}},{type:"slider",title:"letterSpacing",min:1,max:10,step:1,value:parseFloat(c.letterSpacing)||1,active:()=>"style"===s.text,onInput:e=>{const n=e.target.value,s=t.tiptap,i=s.view.state.selection;n<=1?i.from===i.to?s.chain().selectAll().setLetterSpacing("normal").run():s.chain().setLetterSpacing("normal").run():i.from===i.to?s.chain().selectAll().setLetterSpacing(n+"px").run():s.chain().setLetterSpacing(n+"px").run()}},{type:"heading",level:6,text:"colors",active:()=>"style"===s.text},{type:"colorSwatchGroup",active:()=>"style"===s.text,columns:2,items:[{title:"font_color",value:l.getAttributes("textStyle").color||"#000000",onChange:e=>{const n=e.target.value,s=t.tiptap,i=s.view.state.selection;if(i.from===i.to){const{state:e,view:t}=s,i=e.tr,{from:o,to:a}={from:0,to:e.doc.content.size};e.doc.nodesBetween(o,a,(t,s)=>{if(t.isText){t.marks.some(e=>"link"===e.type.name)||i.addMark(s,s+t.nodeSize,e.schema.marks.textStyle.create({color:n}))}}),t.dispatch(i)}else s.chain().setColor(n).focus().run()}},{title:"backgroundColor",allowGradient:!0,value:t.props.style.background||t.props.style.backgroundColor||"#ffffff",onChange:e=>{const t=e.target.value;n.execCommand("style",{background:t,backgroundColor:null})}}]},{type:"heading",level:6,text:"layout",active:()=>"style"===s.text},{type:"slider",active:()=>"style"===s.text,title:"maxWidth",value:parseFloat(t.props.style.width),min:20,max:1e3,onInput:e=>{const t=e.target.value;n.execCommand("style",{width:t+"px"})}},{type:"divider"},{type:"colorpicker",active:()=>"icons"===s.text,title:d.iconColor||"Icon color",alpha:!1,value:l.getAttributes(" textStyle").color||"#0000",onChange:e=>{const t=e.target.value;l.chain().setCustomBulletStyles({fill:t}).run()}},{type:"divider",active:()=>"icons"===s.text},{type:"slider",active:()=>"icons"===s.text,title:d.iconSize||"Icon size",value:parseInt(l.getAttributes("customBulletItem").width)||24,min:10,max:40,onInput:e=>{const t=e.target.value;l.chain().setCustomBulletStyles({width:t+"px",height:t+"px"}).run()}},{type:"icons",active:()=>"icons"===s.text,selectedIcon:t.props.src,useIconsApi:!0,iconColor:t.props.iconColor||"000000",iconSize:parseInt(t.props.style?.width,10)||24,onChange:e=>{const n=e.detail;t.tiptap.chain().focus().setCustomBulletIcon({svgIcon:n.urlPng}).run()}}]}}}};var l=n(52144);const c=e=>{let{helpers:t,tiptap:n,composeId:s,template:i}=e;return{set:(e,o,a)=>{switch(o){case"style":return"object"==typeof a&&(e[o]=(0,l.A)(e[o],a),t.mergeDiff(i,{style:e[o]})),!0;case"text":e[o]=a;const r=n.getJSON();return a&&"object"==typeof a&&JSON.stringify(r)!==JSON.stringify(a.childNodes)&&(a&&a.focusedElement&&a.focusedElement===s?(n.chain().focus().setContent(a.childNodes).run(),a.to&&a.from&&n.commands.setTextSelection({from:a.from,to:a.to})):n.chain().setContent(a.childNodes).run()),delete e?.text?.markdown,!0}}}};var p=n(84488),d=n.n(p);n(70567);const h=[];let g=!1,m=null;const u=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t="text";return{name:t,create:n=>{const{createElement:s,compose:i,helpers:a}=n,{mergeDiff:l}=a,p=document.createElement("div");l(p,{style:i.props.style});const u=o.M.get("config","editor","configure","editorProps","fonts");let f=o.M.get("config","target");"string"==typeof f&&(f=document.querySelector(f)),f||(f=document.body);const x=d()({element:p,container:f||document.body,editable:!0,offsetTop:40,onClickMagic:e=>{const t=o.M.get("injectEditor"),n=document.createElement("cdtr-text-prompt-editor");n.commands=e,n.elementId=i.id,t(n)},content:"string"==typeof i.props.text.markdown?i.props.text.markdown:i.props.text.childNodes,defaultDirection:"rtl",onBlur:()=>{m===x&&(m=null),setTimeout(()=>{m!==x&&(g=!1)},150)},onFocus:()=>{if(!g||m===x||null===m){if(g=!0,m=x,h.length>0)for(h.forEach(e=>{e!==x&&e.hideEditor()});h.length>0;)h.pop();h.push(x),setTimeout(()=>{m===x&&g&&x.showEditor()},100)}},onUpdate:e=>{let{editor:t,transaction:n}=e;if(0===n.steps.length)return;const s=n.curSelection.from,o=n.curSelection.to,a={childNodes:t.getJSON(),from:s,to:o,focusedElement:i.id};y.commands.execCommand("text",a)},ignoresBlurByQuerySelectors:[".ignore-events"],builder:[{type:"fontFamily",fonts:u||[],useCloud:!0},{type:"fontSize",sizes:e.fontSize||[8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74]},{type:"horizonRule"},{type:"clearFormat"},{type:"bold"},{type:"strike"},{type:"italic"},{type:"underline"},{type:"table"},{type:"emoji"},{type:"unLink"},{type:"link"},{type:"customList"},{type:"numbered"},{type:"bullet"},{type:"backcolor"},{type:"fontColor"},{type:"direction"},{type:"justify"},{type:"right"},{type:"center"},{type:"left"},{type:"image"},{type:"mergeTags"},{type:"magic"}]}),y=s({name:t,id:i.id,template:p,defaultProps:{text:{},style:{}},draggable:{group:"element"},droppable:{group:"element"},resizeable:()=>p,handleBar:!0,validator:c({template:p,helpers:a,tiptap:x,composeId:i.id}),schema:i.schema,onSelect:e=>{p.classList.add(e)},onDeselect:e=>{p.classList.remove(e)},elementProps:i,remove:()=>{p.remove()},createEditor:r});return i.props.text.markdown&&x.chain().insertContent(" ").run(),y.addProp("tiptap",x),y}}}}}]);
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[1271],{71271(e,t,n){n.d(t,{default:()=>h});var o=n(53577),i=n(74265),l=n(86319);const s=[100,300,400,500,600,700,900].map(e=>({value:String(e),label:String(e)})),a=e=>{{const{component:t,commands:n,helpers:a}=e,r=t.tiptap,c=r.state.selection.$anchor.node().attrs,p=r.isActive("heading",{level:1})?"h1":r.isActive("heading",{level:2})?"h2":r.isActive("heading",{level:3})?"h3":r.isActive("heading",{level:4})?"h4":r.isActive("heading",{level:5})?"h5":r.isActive("heading",{level:6})?"h6":"paragraph";let u=e.languageJson;const d=e.language||"he";return u||(u="he"===d?o:i),{select:e=>{let{changeTab:t,tab:n}=e},tabs:e=>{const t=r.isActive("customBulletItem"),n=[{text:"style",selected:!t},...t?[{text:"icons",selected:!0}]:[],{text:"settings"}];return n.forEach(t=>t.selected=t.text===e),n},layout:e=>{let{tab:o,changeTab:i,tabs:a}=e;return[{type:"info",text:"text_micro_copy",active:()=>"style"===o.text},{type:"heading",level:6,text:"typography",active:()=>"style"===o.text},{type:"dropdown",active:()=>"style"===o.text,title:"type",value:p,items:[{value:"H1"},{value:"H2"},{value:"H3"},{value:"H4"},{value:"H5"},{value:"H6"},{value:"paragraph"}],onChange:e=>{const t=e.target.value;switch(t){case"H1":case"H2":case"H3":case"H4":case"H5":case"H6":r.chain().setHeading({level:parseInt(t.slice(1))}).run();break;case"paragraph":r.chain().setParagraph().run()}}},{type:"slider",title:"fontSize",min:8,step:2,max:74,value:parseInt(r.getAttributes("textStyle").fontSize||"16px"),active:()=>"style"===o.text,onInput:e=>{const n=e.target.value,o=t.tiptap,i=o.view.state.selection;i.from===i.to?o.chain().selectAll().setFontSize(n).run():o.chain().setFontSize(n).run()}},{type:"dropdown",title:"fontWeight",active:()=>"style"===o.text&&"web"===l.M.get("config","channel"),value:String(r.getAttributes("textStyle").fontWeight||400),selected:String(r.getAttributes("textStyle").fontWeight||400),items:s,onChange:e=>{const n=e.target.value,o=t.tiptap,i=o.view.state.selection;i.from===i.to?o.chain().selectAll().setFontWeight(n).run():o.chain().setFontWeight(n).run()}},{type:"heading",level:6,text:"spacing",active:()=>"style"===o.text},{type:"slider",title:"lineHeight",min:1,max:3,step:.1,value:parseFloat(c.lineHeight||1),active:()=>"style"===o.text,onInput:e=>{const n=e.target.value,o=t.tiptap,i=o.view.state.selection;i.from===i.to?o.chain().selectAll().setLineHeight(n).run():o.chain().setLineHeight(n).run()}},{type:"slider",title:"letterSpacing",min:1,max:10,step:1,value:parseFloat(c.letterSpacing)||1,active:()=>"style"===o.text,onInput:e=>{const n=e.target.value,o=t.tiptap,i=o.view.state.selection;n<=1?i.from===i.to?o.chain().selectAll().setLetterSpacing("normal").run():o.chain().setLetterSpacing("normal").run():i.from===i.to?o.chain().selectAll().setLetterSpacing(n+"px").run():o.chain().setLetterSpacing(n+"px").run()}},{type:"heading",level:6,text:"colors",active:()=>"style"===o.text},{type:"colorSwatchGroup",active:()=>"style"===o.text,columns:2,items:[{title:"font_color",value:r.getAttributes("textStyle").color||"#000000",onChange:e=>{const n=e.target.value,o=t.tiptap,i=o.view.state.selection;if(i.from===i.to){const{state:e,view:t}=o,i=e.tr,{from:l,to:s}={from:0,to:e.doc.content.size};e.doc.nodesBetween(l,s,(t,o)=>{if(t.isText){t.marks.some(e=>"link"===e.type.name)||i.addMark(o,o+t.nodeSize,e.schema.marks.textStyle.create({color:n}))}}),t.dispatch(i)}else o.chain().setColor(n).focus().run()}},{title:"backgroundColor",allowGradient:!0,value:t.props.style.background||t.props.style.backgroundColor||"#ffffff",onChange:e=>{const t=e.target.value;n.execCommand("style",{background:t,backgroundColor:null})}}]},{type:"heading",level:6,text:"layout",active:()=>"style"===o.text},{type:"slider",active:()=>"style"===o.text,title:"maxWidth",value:parseFloat(t.props.style.width),min:20,max:1e3,onInput:e=>{const t=e.target.value;n.execCommand("style",{width:t+"px"})}},{type:"divider",active:()=>"style"===o.text},{type:"button",text:"reset_styling",icon:"formatClear",color:"currentColor",fontSize:"var(--text-sm, 13px)",active:()=>"style"===o.text,onClick:()=>(e=>{const{from:t,to:n}=e.view.state.selection,o=e.chain().focus();t===n&&o.selectAll(),o.unsetFontSize().unsetFontWeight().unsetFontFamily().unsetLetterSpacing().unsetLineHeight().unsetColor().unsetBackgroundColor().unsetBold().unsetItalic().unsetUnderline().run()})(t.tiptap)},{type:"divider"},{type:"colorpicker",active:()=>"icons"===o.text,title:u.iconColor||"Icon color",alpha:!1,value:r.getAttributes(" textStyle").color||"#0000",onChange:e=>{const t=e.target.value;r.chain().setCustomBulletStyles({fill:t}).run()}},{type:"divider",active:()=>"icons"===o.text},{type:"slider",active:()=>"icons"===o.text,title:u.iconSize||"Icon size",value:parseInt(r.getAttributes("customBulletItem").width)||24,min:10,max:40,onInput:e=>{const t=e.target.value;r.chain().setCustomBulletStyles({width:t+"px",height:t+"px"}).run()}},{type:"icons",active:()=>"icons"===o.text,selectedIcon:t.props.src,useIconsApi:!0,iconColor:t.props.iconColor||"000000",iconSize:parseInt(t.props.style?.width,10)||24,onChange:e=>{const n=e.detail;t.tiptap.chain().focus().setCustomBulletIcon({svgIcon:n.urlPng}).run()}}]}}}};var r=n(52144);const c=e=>{let{helpers:t,tiptap:n,composeId:o,template:i}=e;return{set:(e,l,s)=>{switch(l){case"style":return"object"==typeof s&&(e[l]=(0,r.A)(e[l],s),t.mergeDiff(i,{style:e[l]})),!0;case"text":e[l]=s;const a=n.getJSON();return s&&"object"==typeof s&&JSON.stringify(a)!==JSON.stringify(s.childNodes)&&(s&&s.focusedElement&&s.focusedElement===o?(n.chain().focus().setContent(s.childNodes).run(),s.to&&s.from&&n.commands.setTextSelection({from:s.from,to:s.to})):n.chain().setContent(s.childNodes).run()),delete e?.text?.markdown,!0}}}};var p=n(84488),u=n.n(p);n(70567);const d=[];let g=!1,m=null;const h=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t="text";return{name:t,create:n=>{const{createElement:o,compose:i,helpers:s}=n,{mergeDiff:r}=s,p=document.createElement("div");r(p,{style:i.props.style});const h=l.M.get("config","editor","configure","editorProps","fonts");let y=l.M.get("config","target");"string"==typeof y&&(y=document.querySelector(y)),y||(y=document.body);const v=u()({element:p,container:y||document.body,editable:!0,offsetTop:40,onClickMagic:e=>{const t=l.M.get("injectEditor"),n=document.createElement("cdtr-text-prompt-editor");n.commands=e,n.elementId=i.id,t(n)},content:"string"==typeof i.props.text.markdown?i.props.text.markdown:i.props.text.childNodes,defaultDirection:"rtl",onBlur:()=>{m===v&&(m=null),setTimeout(()=>{m!==v&&(g=!1)},150)},onFocus:()=>{if(!g||m===v||null===m){if(g=!0,m=v,d.length>0)for(d.forEach(e=>{e!==v&&e.hideEditor()});d.length>0;)d.pop();d.push(v),setTimeout(()=>{m===v&&g&&v.showEditor()},100)}},onUpdate:e=>{let{editor:t,transaction:n}=e;if(0===n.steps.length)return;const o=n.curSelection.from,l=n.curSelection.to,s={childNodes:t.getJSON(),from:o,to:l,focusedElement:i.id};f.commands.execCommand("text",s)},ignoresBlurByQuerySelectors:[".ignore-events"],builder:[{type:"fontFamily",fonts:h||[],useCloud:!0},{type:"fontSize",sizes:e.fontSize||[8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74]},{type:"horizonRule"},{type:"clearFormat"},{type:"bold"},{type:"strike"},{type:"italic"},{type:"underline"},{type:"table"},{type:"emoji"},{type:"unLink"},{type:"link"},{type:"customList"},{type:"numbered"},{type:"bullet"},{type:"backcolor"},{type:"fontColor"},{type:"direction"},{type:"justify"},{type:"right"},{type:"center"},{type:"left"},{type:"image"},{type:"mergeTags"},{type:"magic"}]}),f=o({name:t,id:i.id,template:p,defaultProps:{text:{},style:{}},draggable:{group:"element"},droppable:{group:"element"},resizeable:()=>p,handleBar:!0,validator:c({template:p,helpers:s,tiptap:v,composeId:i.id}),schema:i.schema,onSelect:e=>{p.classList.add(e)},onDeselect:e=>{p.classList.remove(e)},elementProps:i,remove:()=>{p.remove()},createEditor:a});return i.props.text.markdown&&v.chain().insertContent(" ").run(),f.addProp("tiptap",v),f}}}}}]);
Binary file
@@ -1,4 +1,4 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[1529],{81529(e,t,s){s.r(t),s.d(t,{EditorBar:()=>l});var i=s(59929),n=s(49937),o=s(36565),r=s(69600);const d=o.Ay;class l extends i.WF{constructor(){super(),this.opened=!1,this.offsetY=50,this.offsetX=0,this.reRender=this.reRender.bind(this)}reRender(){if(this.opened&&this.componentId){const e=d.getComponent(this.componentId);if(e&&e.element){const t=e.element.getBoundingClientRect();let s=t.top-this.offsetY;-1!==this.direction.indexOf("left")?this.left=t.left+this.offsetX+"px":this.left=t.left+t.width+"px",this.top=s+"px",-1!==this.direction.indexOf("bottom")&&(this.top=t.top-this.offsetY+t.height+20+"px")}}}render(){return this.opened?(this.style.display="",this.style.left=this.left,this.style.top=this.top,this.style.zIndex=(0,r.A)(),this.style.transform=`translate(${-1!==this.direction.indexOf("left")?"0":"100%"},${-1!==this.direction.indexOf("bottom")?"100%":"0"})`,i.qy` <slot></slot>`):(this.style.display="none",null)}disconnectedCallback(){super.disconnectedCallback(),n.A.unSubscribe("onScroll",this.reRender),d.off("update",this.reRender)}connectedCallback(){super.connectedCallback(),n.A.subscribe("onScroll",this.reRender),d.on("update",this.reRender),setTimeout(()=>{this.reRender()},0)}}l.styles=i.AH`
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[1529],{81529(e,t,s){s.r(t),s.d(t,{EditorBar:()=>l});var i=s(59929),n=s(49937),o=s(15604),r=s(69600);const d=o.Ay;class l extends i.WF{constructor(){super(),this.opened=!1,this.offsetY=50,this.offsetX=0,this.reRender=this.reRender.bind(this)}reRender(){if(this.opened&&this.componentId){const e=d.getComponent(this.componentId);if(e&&e.element){const t=e.element.getBoundingClientRect();let s=t.top-this.offsetY;-1!==this.direction.indexOf("left")?this.left=t.left+this.offsetX+"px":this.left=t.left+t.width+"px",this.top=s+"px",-1!==this.direction.indexOf("bottom")&&(this.top=t.top-this.offsetY+t.height+20+"px")}}}render(){return this.opened?(this.style.display="",this.style.left=this.left,this.style.top=this.top,this.style.zIndex=(0,r.A)(),this.style.transform=`translate(${-1!==this.direction.indexOf("left")?"0":"100%"},${-1!==this.direction.indexOf("bottom")?"100%":"0"})`,i.qy` <slot></slot>`):(this.style.display="none",null)}disconnectedCallback(){super.disconnectedCallback(),n.A.unSubscribe("onScroll",this.reRender),d.off("update",this.reRender)}connectedCallback(){super.connectedCallback(),n.A.subscribe("onScroll",this.reRender),d.on("update",this.reRender),setTimeout(()=>{this.reRender()},0)}}l.styles=i.AH`
2
2
  :host {
3
3
  position: fixed;
4
4
  border-radius: 2px;
Binary file
@@ -1,4 +1,4 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[170],{60170(e,t,o){o.r(t),o.d(t,{BreadCrumbs:()=>i});var s=o(59929),r=o(86319),n=o(36565);class i extends s.WF{constructor(){super(),this.crumbs=[],this._menuOpen=!1,this._menuPos={left:0,top:0},this._collapsed=!1,this._fitScheduled=!1,this.cover=function(){const e=document.createElement("div");return e.style.position="fixed",e.style.background="var(--primary)",e.style.zIndex=2,e.style.border="1px dashed black",e.style.opacity=.2,e}(),this.currectCrumb={},this._onDocMouseDown=e=>{this._menuOpen&&(e.composedPath().includes(this)||this._closeMenu())},this._onDocKeyDown=e=>{this._menuOpen&&"Escape"===e.key&&this._closeMenu()},this.onSubscribe=()=>{let e;this.crumbs=[],this._menuOpen=!1,this._collapsed=!1;const t=n.Ay.components[n.Ay.components.length-1];if(!t)return;if(e=t.element,!e)return void console.error("selectElement not found","#1ppqmvss6");let o=t.type.getElementType(),s="";t.props.as&&(s=` (${r.M.get("lang",t.props.as)||t.props.as})`),this.currectCrumb={type:o,as:s,name:t.props.name,id:t.id};if(e){let t=e;for(;t&&t.parentElement;)if(t=t.parentElement.closest("[data-type]"),t){const e=r.M.get("components",t.dataset.id);let o=!0;e&&"row"!==e.type&&("col"===e.type&&"block"!==e.parent().type&&(o=!1),o&&this.crumbs.unshift({type:e.type,name:e.props.name,id:e.id,element:e.element,compose:e}))}this.dispatchEvent(new CustomEvent("change",[...this.crumbs]))}},this.onSubscribe=this.onSubscribe.bind(this)}updated(){if(this.toggleAttribute("hidden-crumbs",0===this.crumbs.length),!this._collapsed&&this.crumbs.length>1&&!this._fitScheduled&&(this._fitScheduled=!0,requestAnimationFrame(()=>{this._fitScheduled=!1;const e=this.shadowRoot.querySelector(".row");e&&!this._collapsed&&e.scrollWidth>e.clientWidth+1&&(this._collapsed=!0)})),this._menuOpen){const e=this.shadowRoot.querySelector(".crumb-menu");if(e){const t=e.offsetWidth,o=window.innerWidth-t-8,s=Math.max(8,Math.min(this._menuPos.left,o));s!==this._menuPos.left&&(e.style.left=s+"px")}}}_openMenu(){if(this._menuOpen)return void this._closeMenu();const e=this.getBoundingClientRect();this._menuPos={left:e.left,top:e.top},this._menuOpen=!0}_closeMenu(){this._menuOpen=!1}onHover(e){if(e){const t=e.getBoundingClientRect();this.cover.style.left=t.left+"px",this.cover.style.top=t.top+"px",this.cover.style.width=t.width+"px",this.cover.style.height=t.height+"px",document.body.appendChild(this.cover)}}render(){if(0===this.crumbs.length)return"";const e=(e,t,o)=>e||`${r.M.get("lang",t)||t||""}${o||""}`,t=()=>s.qy`<span class="sepc">›</span>`,o=t=>s.qy`<span
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[170],{60170(e,t,o){o.r(t),o.d(t,{BreadCrumbs:()=>i});var s=o(59929),r=o(86319),n=o(15604);class i extends s.WF{constructor(){super(),this.crumbs=[],this._menuOpen=!1,this._menuPos={left:0,top:0},this._collapsed=!1,this._fitScheduled=!1,this.cover=function(){const e=document.createElement("div");return e.style.position="fixed",e.style.background="var(--primary)",e.style.zIndex=2,e.style.border="1px dashed black",e.style.opacity=.2,e}(),this.currectCrumb={},this._onDocMouseDown=e=>{this._menuOpen&&(e.composedPath().includes(this)||this._closeMenu())},this._onDocKeyDown=e=>{this._menuOpen&&"Escape"===e.key&&this._closeMenu()},this.onSubscribe=()=>{let e;this.crumbs=[],this._menuOpen=!1,this._collapsed=!1;const t=n.Ay.components[n.Ay.components.length-1];if(!t)return;if(e=t.element,!e)return void console.error("selectElement not found","#1ppqmvss6");let o=t.type.getElementType(),s="";t.props.as&&(s=` (${r.M.get("lang",t.props.as)||t.props.as})`),this.currectCrumb={type:o,as:s,name:t.props.name,id:t.id};if(e){let t=e;for(;t&&t.parentElement;)if(t=t.parentElement.closest("[data-type]"),t){const e=r.M.get("components",t.dataset.id);let o=!0;e&&"row"!==e.type&&("col"===e.type&&"block"!==e.parent().type&&(o=!1),o&&this.crumbs.unshift({type:e.type,name:e.props.name,id:e.id,element:e.element,compose:e}))}this.dispatchEvent(new CustomEvent("change",[...this.crumbs]))}},this.onSubscribe=this.onSubscribe.bind(this)}updated(){if(this.toggleAttribute("hidden-crumbs",0===this.crumbs.length),!this._collapsed&&this.crumbs.length>1&&!this._fitScheduled&&(this._fitScheduled=!0,requestAnimationFrame(()=>{this._fitScheduled=!1;const e=this.shadowRoot.querySelector(".row");e&&!this._collapsed&&e.scrollWidth>e.clientWidth+1&&(this._collapsed=!0)})),this._menuOpen){const e=this.shadowRoot.querySelector(".crumb-menu");if(e){const t=e.offsetWidth,o=window.innerWidth-t-8,s=Math.max(8,Math.min(this._menuPos.left,o));s!==this._menuPos.left&&(e.style.left=s+"px")}}}_openMenu(){if(this._menuOpen)return void this._closeMenu();const e=this.getBoundingClientRect();this._menuPos={left:e.left,top:e.top},this._menuOpen=!0}_closeMenu(){this._menuOpen=!1}onHover(e){if(e){const t=e.getBoundingClientRect();this.cover.style.left=t.left+"px",this.cover.style.top=t.top+"px",this.cover.style.width=t.width+"px",this.cover.style.height=t.height+"px",document.body.appendChild(this.cover)}}render(){if(0===this.crumbs.length)return"";const e=(e,t,o)=>e||`${r.M.get("lang",t)||t||""}${o||""}`,t=()=>s.qy`<span class="sepc">›</span>`,o=t=>s.qy`<span
2
2
  @mouseout=${()=>this.cover.remove()}
3
3
  @mouseover=${()=>this.onHover(t.element)}
4
4
  @mousedown=${()=>this.clickBread(t)}
Binary file
@@ -1 +1 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[2765],{12765(e,t,o){o.d(t,{default:()=>s});var n=o(61919);const r=e=>{{const{component:t,commands:o}=e;return{select:e=>{let{changeTab:t,tab:o}=e;o.text||t("style")},tabs:e=>{const t=[{text:"style",selected:!0},{text:"interactions"},{text:"settings"}];return e?(t.forEach(t=>t.selected=t.text===e),t):t},layout:e=>{let{tab:r}=e;const i=t.props.src.includes("img.creaditor.ai"),s=()=>"style"===r.text;return[{type:"heading",level:6,text:"icon",active:s},{type:"icons",active:s,selectedIcon:t.props.src,useIconsApi:!0,iconColor:t.props.iconColor||"000000",iconSize:parseInt(t.props.style?.width,10)||24,onChange:e=>{const n=e.detail;if(n){const e=n.urlPng||n.src;e&&o.execCommand("src",e),t.props.alt&&"icon"!==t.props.alt||o.execCommand("alt",n.name),n.size?.width&&n.size?.height&&o.execCommand("style",{width:n.size.width+"px",height:n.size.height+"px"}),null!=n.category&&null!=n.name&&(o.execCommand("iconCategory",n.category),o.execCommand("iconName",n.name));const r=(n.color??t.props.iconColor??"000000").toString().replace(/^#/,"");o.execCommand("iconColor",r)}}},{type:"input",title:"altText",active:s,value:t.props.alt||"",onChange:e=>{const t=e.target.value;o.execCommand("alt",t)}},{type:"heading",level:6,text:"size",active:s},{type:"slider",title:"size",min:8,max:256,active:s,value:parseInt(t.props.style?.width,10)||24,onInput:e=>{const t=e.target.value;o.execCommand("style",{width:t+"px",height:t+"px"})}},{type:"heading",level:6,text:"colors",active:()=>s()&&i},{type:"colorpicker",title:"icon_color",alpha:!1,active:()=>s()&&i,value:t.props.iconColor?t.props.iconColor.startsWith("#")?t.props.iconColor:"#"+t.props.iconColor:"#000000",onChange:e=>{let t=e.target.value;t=(0,n.A)(t).toHex(),t.startsWith("#")&&(t=t.slice(1)),o.execCommand("iconColor",t)}},{type:"heading",level:6,text:"link",active:()=>"interactions"===r.text},{type:"linkpicker",href:t.props.onClick?.link,protocol:t.props.onClick?.link?.protocol,target:t.props.onClick?.link?.target,autofocus:!0,active:()=>"interactions"===r.text,onChange:e=>{const t={link:e.target.value};o.execCommand("onClick",t)}}]}}}},i=e=>{let{helpers:t}=e;return{set:(e,o,n)=>{switch(o){case"style":return e[o]=t.deepMerge(e[o],n),!0;case"src":case"alt":case"iconColor":case"iconCategory":case"iconName":return e[o]=n,!0;case"onClick":if(n&&n.link)return e[o]=n,!0}}}};const s=()=>{const e="icon";return{name:e,create:t=>{const{createElement:o,compose:n,helpers:s}=t,{mergeDiff:a}=s,c=document.createElement("div"),l=document.createElement("img");c.appendChild(l);return o({name:e,id:n.id,template:c,defaultProps:{style:{height:"24px",width:"24px",display:"inline-block"},src:"",alt:"",iconColor:"000000"},draggable:{group:"element"},droppable:{group:"element"},render:()=>{a(l,{style:n.props.style});const e=function(e){const t=e.props.iconCategory,o=e.props.iconName;if(!t||!o)return null;let n=parseInt(e.props.style?.width,10)||24,r=parseInt(e.props.style?.height,10)||24;n=Math.min(512,Math.max(1,n)),r=Math.min(512,Math.max(1,r));const i=function(e){let t=(e||"000000").toString().trim();return t.startsWith("#")&&(t=t.slice(1)),3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6!==t.length?"000000":t}(e.props.iconColor);return`https://img.creaditor.ai/icons/serve/${encodeURIComponent(t)}/${encodeURIComponent(o)}.png?${new URLSearchParams({width:String(n),height:String(r),color:i}).toString()}`}(n)||n.props.src;a(l,{src:e,alt:n.props.alt||""})},resizeable:null,handleBar:!0,validator:i({helpers:s}),schema:n.schema,onSelect:e=>{c.classList.add(e)},onDeselect:e=>{c.classList.remove(e)},elementProps:n,remove:()=>{c.remove()},createEditor:r})}}}}}]);
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[2765],{12765(e,t,o){o.d(t,{default:()=>s});var n=o(61919);const r=e=>{{const{component:t,commands:o}=e;return{select:e=>{let{changeTab:t,tab:o}=e;o.text||t("style")},tabs:e=>{const t=[{text:"style",selected:!0},{text:"interactions"},{text:"settings"}];return e?(t.forEach(t=>t.selected=t.text===e),t):t},layout:e=>{let{tab:r}=e;const i=t.props.src.includes("img.creaditor.ai"),s=()=>"style"===r.text;return[{type:"heading",level:6,text:"icon",active:s},{type:"icons",active:s,selectedIcon:t.props.src,useIconsApi:!0,iconColor:t.props.iconColor||"000000",iconSize:parseInt(t.props.style?.width,10)||24,onChange:e=>{const n=e.detail;if(n){const e=n.urlPng||n.src;e&&o.execCommand("src",e),t.props.alt&&"icon"!==t.props.alt||o.execCommand("alt",n.name),n.size?.width&&n.size?.height&&o.execCommand("style",{width:n.size.width+"px",height:n.size.height+"px"}),null!=n.category&&null!=n.name&&(o.execCommand("iconCategory",n.category),o.execCommand("iconName",n.name));const r=(n.color??t.props.iconColor??"000000").toString().replace(/^#/,"");o.execCommand("iconColor",r)}}},{type:"input",title:"altText",active:s,value:t.props.alt||"",onChange:e=>{const t=e.target.value;o.execCommand("alt",t)}},{type:"heading",level:6,text:"size",active:s},{type:"slider",title:"size",min:8,max:256,active:s,value:parseInt(t.props.style?.width,10)||24,onInput:e=>{const t=e.target.value;o.execCommand("style",{width:t+"px",height:t+"px"})}},{type:"heading",level:6,text:"colors",active:()=>s()&&i},{type:"colorpicker",title:"icon_color",alpha:!1,active:()=>s()&&i,value:t.props.iconColor?t.props.iconColor.startsWith("#")?t.props.iconColor:"#"+t.props.iconColor:"#000000",onChange:e=>{let t=e.target.value;t=(0,n.A)(t).toHex(),t.startsWith("#")&&(t=t.slice(1)),o.execCommand("iconColor",t)}},{type:"heading",level:6,text:"link",active:()=>"interactions"===r.text},{type:"linkpicker",href:t.props.onClick?.link,protocol:t.props.onClick?.link?.protocol,target:t.props.onClick?.link?.target,autofocus:!0,active:()=>"interactions"===r.text,onChange:e=>{const t={link:e.target.value};o.execCommand("onClick",t)}}]}}}},i=e=>{let{helpers:t}=e;return{set:(e,o,n)=>{switch(o){case"style":return e[o]=t.deepMerge(e[o],n),!0;case"src":case"alt":case"iconColor":case"iconCategory":case"iconName":return e[o]=n,!0;case"onClick":if(n&&n.link)return e[o]=n,!0}}}};const s=()=>{const e="icon";return{name:e,create:t=>{const{createElement:o,compose:n,helpers:s}=t,{mergeDiff:a}=s,c=document.createElement("div"),l=document.createElement("img");c.appendChild(l);return o({name:e,id:n.id,template:c,defaultProps:{style:{height:"24px",width:"24px",display:"inline-block"},src:"",alt:"",iconColor:"000000"},draggable:{group:"element"},droppable:{group:"element"},render:()=>{a(l,{style:n.props.style});const e=function(e){const t=e.props.iconCategory,o=e.props.iconName;if(!t||!o)return null;let n=parseInt(e.props.style?.width,10)||24,r=parseInt(e.props.style?.height,10)||24;n=Math.min(512,Math.max(1,n)),r=Math.min(512,Math.max(1,r));const i=function(e){let t=(e||"000000").toString().trim();return t.startsWith("#")&&(t=t.slice(1)),3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6!==t.length?"000000":t}(e.props.iconColor);return`https://img.creaditor.ai/icons/serve/${encodeURIComponent(t)}/${encodeURIComponent(o)}.png?${new URLSearchParams({width:String(n),height:String(r),color:i}).toString()}`}(n)||n.props.src;a(l,{src:e,alt:n.props.alt||""})},resizeable:()=>c,handleBar:!0,validator:i({helpers:s}),schema:n.schema,onSelect:e=>{c.classList.add(e)},onDeselect:e=>{c.classList.remove(e)},elementProps:n,remove:()=>{c.remove()},createEditor:r})}}}}}]);
Binary file