@creaditor/web-starterkit 1.0.20 → 1.0.21

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.
@@ -1 +1,439 @@
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:()=>y});var o=n(53577),i=n(74265),a=n(86319),l=n(20252);const s=[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,c=t.tiptap,p=c.state.selection.$anchor.node().attrs,u=c.isActive("heading",{level:1})?"h1":c.isActive("heading",{level:2})?"h2":c.isActive("heading",{level:3})?"h3":c.isActive("heading",{level:4})?"h4":c.isActive("heading",{level:5})?"h5":c.isActive("heading",{level:6})?"h6":"paragraph";let d=e.languageJson;const g=e.language||"he";return d||(d="he"===g?o:i),{select:e=>{let{changeTab:t,tab:n}=e},tabs:e=>{const t=c.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:r}=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:u,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":c.chain().setHeading({level:parseInt(t.slice(1))}).run();break;case"paragraph":c.chain().setParagraph().run()}}},{type:"slider",title:"fontSize",min:8,step:2,max:74,value:parseInt(c.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"===a.M.get("config","channel"),value:String(c.getAttributes("textStyle").fontWeight||400),selected:String(c.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:"checkbox",title:"smart_change",active:()=>"style"===o.text,checked:(0,l.z)(),onChange:e=>{(0,l.R)(!!e.target.checked)}},{type:"heading",level:6,text:"spacing",active:()=>"style"===o.text},{type:"slider",title:"lineHeight",min:1,max:3,step:.1,value:parseFloat(p.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(p.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:c.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:a,to:l}={from:0,to:e.doc.content.size};e.doc.nodesBetween(a,l,(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"},{type:"colorpicker",active:()=>"icons"===o.text,title:d.iconColor||"Icon color",alpha:!1,value:c.getAttributes(" textStyle").color||"#0000",onChange:e=>{const t=e.target.value;c.chain().setCustomBulletStyles({fill:t}).run()}},{type:"divider",active:()=>"icons"===o.text},{type:"slider",active:()=>"icons"===o.text,title:d.iconSize||"Icon size",value:parseInt(c.getAttributes("customBulletItem").width)||24,min:10,max:40,onInput:e=>{const t=e.target.value;c.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 c=n(52144);const p=e=>{let{helpers:t,tiptap:n,composeId:o,template:i}=e;return{set:(e,a,l)=>{switch(a){case"style":return"object"==typeof l&&(e[a]=(0,c.A)(e[a],l),t.mergeDiff(i,{style:e[a]})),!0;case"text":e[a]=l;const s=n.getJSON();return l&&"object"==typeof l&&JSON.stringify(s)!==JSON.stringify(l.childNodes)&&(l&&l.focusedElement&&l.focusedElement===o?(n.chain().focus().setContent(l.childNodes).run(),l.to&&l.from&&n.commands.setTextSelection({from:l.from,to:l.to})):n.chain().setContent(l.childNodes).run()),delete e?.text?.markdown,!0}}}};var u=n(84488),d=n.n(u);n(70567);const g=[];let h=!1,m=null;const y=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:l}=n,{mergeDiff:s}=l,c=document.createElement("div");s(c,{style:i.props.style});const u=a.M.get("config","editor","configure","editorProps","fonts");let y=a.M.get("config","target");"string"==typeof y&&(y=document.querySelector(y)),y||(y=document.body);const v=d()({element:c,container:y||document.body,editable:!0,offsetTop:40,onClickMagic:e=>{let{insertContent:t,getJSON:n,getHTML:o,getText:i,selectAll:l,insertContentHtml:s}=e;const r=a.M.get("injectEditor"),c=document.createElement("cdtr-text-prompt-editor");r(c),c.context=i(),c.addEventListener("text-generation-start",e=>{l()}),c.addEventListener("text-generation-chunk",e=>{t(e.detail.chunk)}),c.addEventListener("text-generation-complete",e=>{l(),s(e.detail.text)}),c.addEventListener("text-generation-error",e=>{console.error("Text generation error:",e.detail.error)})},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&&(h=!1)},150)},onFocus:()=>{if(!h||m===v||null===m){if(h=!0,m=v,g.length>0)for(g.forEach(e=>{e!==v&&e.hideEditor()});g.length>0;)g.pop();g.push(v),setTimeout(()=>{m===v&&h&&v.showEditor()},100)}},onUpdate:e=>{let{editor:t,transaction:n}=e;if(0===n.steps.length)return;const o=n.curSelection.from,a=n.curSelection.to,l={childNodes:t.getJSON(),from:o,to:a,focusedElement:i.id};f.commands.execCommand("text",l)},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"}]}),f=o({name:t,id:i.id,template:c,defaultProps:{text:{},style:{}},draggable:{group:"element"},droppable:{group:"element"},resizeable:()=>c,handleBar:!0,validator:p({template:c,helpers:l,tiptap:v,composeId:i.id}),schema:i.schema,onSelect:e=>{c.classList.add(e)},onDeselect:e=>{c.classList.remove(e)},elementProps:i,remove:()=>{c.remove()},createEditor:r});return i.props.text.markdown&&v.chain().insertContent(" ").run(),f.addProp("tiptap",v),f}}}}}]);
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[567,1271],{70567(t,e,n){n.r(e),n.d(e,{TextPromptEditor:()=>s});var r,o,a=n(86959),i=n(59929);let s=(0,n(49410).EM)("cdtr-text-prompt-editor")(((o=class extends i.WF{constructor(){super(),this.prompt=localStorage.getItem("textPromptEditor_prompt")||"",this.generatedText="",this.isLoading=!1,this.context="",this.businessType=localStorage.getItem("textPromptEditor_businessType")||"",this.businessName=localStorage.getItem("textPromptEditor_businessName")||"",this.includeContext="true"===localStorage.getItem("textPromptEditor_includeContext")||!1,this.url=localStorage.getItem("textPromptEditor_url")||"",this.detectCurrentElementType()}connectedCallback(){super.connectedCallback(),setTimeout(()=>{this.detectCurrentElementType()},100)}detectCurrentElementType(){try{const t=window.getSelection();if(t&&t.rangeCount>0){const e=t.getRangeAt(0).commonAncestorContainer;let n=e.nodeType===Node.TEXT_NODE?e.parentElement:e;for(;n&&n!==document.body;){if(n.tagName&&/^h[1-6]$/i.test(n.tagName)){const t=n.parentElement,e=Array.from(t?.children||[]),r=e.some(t=>t!==n&&/^h[1-6]$/i.test(t.tagName)),o=e.some(t=>t!==n&&/^p$|^div$/i.test(t.tagName));return!o||r&&!o?(this.contentType="title",void console.log("TextPromptEditor: Detected standalone heading from DOM")):(this.contentType="paragraph",void console.log("TextPromptEditor: Detected heading within paragraph structure"))}this.contentType="paragraph",n=n.parentElement}}this.contentType||(this.contentType="paragraph",console.log("TextPromptEditor: Defaulting to paragraph"))}catch(t){console.warn("Error detecting current element type:",t),this.contentType||(this.contentType="paragraph")}}handleIncludeContextChange(t){this.includeContext=!t.target.checked,localStorage.setItem("textPromptEditor_includeContext",this.includeContext)}handleContentTypeChange(t){this.contentType=t,this.dispatchEvent(new CustomEvent("content-type-changed",{detail:{contentType:this.contentType},bubbles:!0,composed:!0}))}handlePromptChange(t){this.prompt=t.target.value,localStorage.setItem("textPromptEditor_prompt",this.prompt);["כתוב כותרת","כתוב תמונה","כתבי כותרת","write heading"].some(t=>this.prompt.startsWith(t))&&this.handleContentTypeChange("title")}handleBusinessTypeChange(t){this.businessType=t.target.value,localStorage.setItem("textPromptEditor_businessType",this.businessType)}handleBusinessNameChange(t){this.businessName=t.target.value,localStorage.setItem("textPromptEditor_businessName",this.businessName)}handleUrlChange(t){this.url=t.target.value,localStorage.setItem("textPromptEditor_url",this.url)}async handleGenerate(){this.isLoading=!0,this.generatedText="";try{if("title"===this.contentType){Array.from(document.querySelectorAll(".text-component")).map(t=>t.textContent).join("\n")}this.context.length>1500&&(this.context=this.context.slice(0,1500));const t=a.XW.agent_url,e=await fetch(t+"prompt/text",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:this.prompt,context:this.includeContext?this.context:"",businessType:this.businessType,businessName:this.businessName,contentType:this.contentType,url:this.url,options:{maxTokens:1e3,temperature:0,model:"gpt-3.5-turbo"}})});if(!e.ok)throw new Error("Failed to generate text");const n=e.body.getReader(),r=new TextDecoder;let o="";for(;;){const{done:t,value:e}=await n.read();if(t){this.dispatchEvent(new CustomEvent("text-generation-complete",{detail:{text:this.generatedText},bubbles:!0,composed:!0}));break}o+=r.decode(e,{stream:!0});const a=o.split("\n\n");for(let t=0;t<a.length-1;t++){const e=a[t];if(e.startsWith("data: "))try{const t=e.slice(6),n=JSON.parse(t);if("start"===n.metadata?.type){this.generatedText="",this.dispatchEvent(new CustomEvent("text-generation-start",{detail:{model:n.metadata.model},bubbles:!0,composed:!0}));continue}n.text&&(this.generatedText+=n.text,this.dispatchEvent(new CustomEvent("text-generation-chunk",{detail:{chunk:n.text,fullText:this.generatedText},bubbles:!0,composed:!0}))),"complete"===n.status&&(this.generatedText=this.generatedText.replace(/^"|"$/g,""),this.dispatchEvent(new CustomEvent("text-generation-complete",{detail:{text:this.generatedText},bubbles:!0,composed:!0})))}catch(t){console.error("Error parsing JSON:",t)}}o=a[a.length-1]}}catch(t){console.error("Error generating text:",t),this.dispatchEvent(new CustomEvent("text-generation-error",{detail:{error:t.message},bubbles:!0,composed:!0}))}finally{this.isLoading=!1}}render(){const t=this.contentType;return i.qy`
2
+ <cdtr-editor-container>
3
+ <div class="editor-container">
4
+ <div class="prompt-section">
5
+ <div class="prompt-header">
6
+ <div class="prompt-icon">✍️</div>
7
+ <label class="prompt-label" for="prompt-input">
8
+ <lang-text text="prompt_editor_title"></lang-text>
9
+ </label>
10
+ </div>
11
+
12
+ <cdtr-input
13
+ id="business-name-input"
14
+ label="Business Name"
15
+ .value=${this.businessName}
16
+ @input=${this.handleBusinessNameChange}
17
+ placeholder="Enter_your_business_name"
18
+ ></cdtr-input>
19
+
20
+ <cdtr-input
21
+ id="business-type-input"
22
+ label="Business Type"
23
+ .value=${this.businessType}
24
+ @input=${this.handleBusinessTypeChange}
25
+ placeholder="Enter_your_business_type"
26
+ ></cdtr-input>
27
+
28
+ <cdtr-input
29
+ id="url-input"
30
+ label="URL"
31
+ .value=${this.url}
32
+ @input=${this.handleUrlChange}
33
+ placeholder="Enter_the_URL_of_the_page"
34
+ ></cdtr-input>
35
+
36
+ <cdtr-textarea
37
+ autofocus=${!0}
38
+ id="prompt-input"
39
+ class="prompt-input"
40
+ placeholder=""
41
+ .value=${this.prompt}
42
+ @input=${this.handlePromptChange}
43
+ ></cdtr-textarea>
44
+
45
+ <cdtr-dropdown .value=${t}>
46
+ <cdtr-dropdown-button slot="trigger">
47
+ <lang-text text="${t||"paragraph"}"></lang-text>
48
+ </cdtr-dropdown-button>
49
+ <div slot="content">
50
+ <cdtr-dropdown-item
51
+ @click=${()=>this.handleContentTypeChange("title")}
52
+ >
53
+ <lang-text text="title"></lang-text>
54
+ </cdtr-dropdown-item>
55
+ <cdtr-dropdown-item
56
+ @click=${()=>this.handleContentTypeChange("paragraph")}
57
+ >
58
+ <lang-text text="paragraph"></lang-text>
59
+ </cdtr-dropdown-item>
60
+ </div>
61
+ </cdtr-dropdown>
62
+ <cdtr-row justify="space-between">
63
+ <cdtr-col>
64
+ <span class="prompt-context">
65
+ <lang-text text="prompt_editor_context"></lang-text>
66
+ </span>
67
+ </cdtr-col>
68
+ <cdtr-col sm="2">
69
+ <cdtr-checkbox
70
+ .checked=${this.includeContext}
71
+ @change=${this.handleIncludeContextChange}
72
+ ></cdtr-checkbox>
73
+ </cdtr-col>
74
+ </cdtr-row>
75
+ <paper-button
76
+ fullWidth
77
+ class="generate-button"
78
+ ?disabled=${this.isLoading||!this.prompt}
79
+ @click=${this.handleGenerate}
80
+ >
81
+ ${this.isLoading?i.qy`
82
+ <div class="loading-spinner"></div>
83
+ <lang-text text="creating_magic"></lang-text>
84
+ `:i.qy` <lang-text text="generate_content"></lang-text> `}
85
+ </paper-button>
86
+ </div>
87
+
88
+ ${this.generatedText?i.qy`
89
+ <div class="result-section">
90
+ <div class="result-content">${this.generatedText}</div>
91
+ </div>
92
+ `:""}
93
+ </div>
94
+ </cdtr-editor-container>
95
+ `}}).properties={prompt:{type:String},generatedText:{type:String},isLoading:{type:Boolean},context:{type:String},includeContext:{type:Boolean},businessType:{type:String},businessName:{type:String},contentType:{type:String},url:{type:String}},o.styles=i.AH`
96
+ :host {
97
+ --primary: #7c3aed;
98
+ --primary-light: #a78bfa;
99
+ --primary-dark: #5b21b6;
100
+ --accent: #f472b6;
101
+ --accent-light: #f9a8d4;
102
+ --accent-dark: #db2777;
103
+ --surface: #f8fafc;
104
+ --surface-dark: #f1f5f9;
105
+ --text-primary: #0f172a;
106
+ --text-secondary: #334155;
107
+ --gradient-primary: linear-gradient(
108
+ 135deg,
109
+ var(--primary) 0%,
110
+ var(--accent) 100%
111
+ );
112
+ --gradient-accent: linear-gradient(
113
+ 135deg,
114
+ var(--accent) 0%,
115
+ var(--primary) 100%
116
+ );
117
+ --gradient-surface: linear-gradient(
118
+ 135deg,
119
+ var(--surface) 0%,
120
+ var(--surface-dark) 100%
121
+ );
122
+ --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
123
+ --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
124
+ 0 2px 4px -1px rgba(0, 0, 0, 0.06);
125
+ --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
126
+ 0 4px 6px -2px rgba(0, 0, 0, 0.05);
127
+ --shadow-glow: 0 0 20px rgba(124, 58, 237, 0.3),
128
+ 0 0 40px rgba(244, 114, 182, 0.2);
129
+ }
130
+
131
+ * {
132
+ box-sizing: border-box;
133
+ margin: 0;
134
+ padding: 0;
135
+ }
136
+
137
+ :host {
138
+ display: block;
139
+ width: 100%;
140
+ margin: 0;
141
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
142
+ Ubuntu, Cantarell, sans-serif;
143
+ background: var(--gradient-surface);
144
+ min-height: 100vh;
145
+ position: relative;
146
+ overflow: hidden;
147
+ }
148
+
149
+ :host::before {
150
+ content: "";
151
+ position: absolute;
152
+ top: 0;
153
+ left: 0;
154
+ right: 0;
155
+ bottom: 0;
156
+ background: radial-gradient(
157
+ circle at 0% 0%,
158
+ rgba(124, 58, 237, 0.1) 0%,
159
+ transparent 50%
160
+ ),
161
+ radial-gradient(
162
+ circle at 100% 100%,
163
+ rgba(244, 114, 182, 0.1) 0%,
164
+ transparent 50%
165
+ );
166
+ pointer-events: none;
167
+ animation: gradientShift 15s ease infinite;
168
+ }
169
+
170
+ @keyframes gradientShift {
171
+ 0% {
172
+ background-position: 0% 0%;
173
+ }
174
+ 50% {
175
+ background-position: 100% 100%;
176
+ }
177
+ 100% {
178
+ background-position: 0% 0%;
179
+ }
180
+ }
181
+
182
+ .editor-container {
183
+ display: flex;
184
+ flex-direction: column;
185
+ gap: 1.5rem;
186
+ padding: 1.5rem;
187
+ position: relative;
188
+ overflow: hidden;
189
+ }
190
+
191
+ .prompt-section {
192
+ display: flex;
193
+ flex-direction: column;
194
+ gap: 1rem;
195
+ position: relative;
196
+ }
197
+
198
+ .prompt-header {
199
+ display: flex;
200
+ align-items: center;
201
+ justify-content: space-between;
202
+ gap: 0.75rem;
203
+ margin-bottom: 0.5rem;
204
+ }
205
+
206
+ .prompt-icon {
207
+ width: 40px;
208
+ height: 40px;
209
+ background: var(--gradient-primary);
210
+ border-radius: 12px;
211
+ display: flex;
212
+ align-items: center;
213
+ justify-content: center;
214
+ color: white;
215
+ font-weight: bold;
216
+ position: relative;
217
+ transform-origin: center;
218
+ animation: iconFloat 3s ease-in-out infinite;
219
+ }
220
+
221
+ @keyframes iconFloat {
222
+ 0%,
223
+ 100% {
224
+ transform: translateY(0) rotate(0deg);
225
+ }
226
+ 50% {
227
+ transform: translateY(-5px) rotate(5deg);
228
+ }
229
+ }
230
+
231
+ .prompt-icon::after {
232
+ content: "";
233
+ position: absolute;
234
+ inset: -2px;
235
+ background: var(--gradient-primary);
236
+ border-radius: 14px;
237
+ z-index: -1;
238
+ opacity: 0.5;
239
+ filter: blur(8px);
240
+ animation: iconGlow 3s ease-in-out infinite;
241
+ }
242
+
243
+ @keyframes iconGlow {
244
+ 0%,
245
+ 100% {
246
+ opacity: 0.5;
247
+ filter: blur(8px);
248
+ }
249
+ 50% {
250
+ opacity: 0.8;
251
+ filter: blur(12px);
252
+ }
253
+ }
254
+
255
+ .prompt-label {
256
+ font-size: 1.25rem;
257
+ font-weight: 600;
258
+ color: var(--text-primary);
259
+ letter-spacing: -0.02em;
260
+ display: flex;
261
+ align-items: center;
262
+ gap: 0.75rem;
263
+ }
264
+
265
+ .prompt-label::after {
266
+ content: "AI";
267
+ font-size: 0.875rem;
268
+ background: var(--gradient-primary);
269
+ color: white;
270
+ padding: 0.25rem 0.75rem;
271
+ border-radius: 6px;
272
+ font-weight: 500;
273
+ animation: badgeFloat 3s ease-in-out infinite;
274
+ }
275
+
276
+ @keyframes badgeFloat {
277
+ 0%,
278
+ 100% {
279
+ transform: translateY(0);
280
+ }
281
+ 50% {
282
+ transform: translateY(-2px);
283
+ }
284
+ }
285
+
286
+ .generate-button {
287
+ width: 100%;
288
+ align-self: flex-end;
289
+ padding: 0.875rem 1.75rem;
290
+ background: var(--gradient-primary);
291
+ color: white;
292
+ border: none;
293
+ border-radius: 10px;
294
+ font-size: 1rem;
295
+ font-weight: 600;
296
+ cursor: pointer;
297
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
298
+ display: flex;
299
+ align-items: center;
300
+ gap: 0.75rem;
301
+ position: relative;
302
+ overflow: hidden;
303
+ box-shadow: var(--shadow-md);
304
+ }
305
+
306
+ .generate-button::before {
307
+ content: "";
308
+ position: absolute;
309
+ top: 0;
310
+ left: 0;
311
+ right: 0;
312
+ bottom: 0;
313
+ background: linear-gradient(
314
+ 135deg,
315
+ rgba(255, 255, 255, 0.2) 0%,
316
+ rgba(255, 255, 255, 0) 100%
317
+ );
318
+ opacity: 0;
319
+ transition: opacity 0.3s ease;
320
+ }
321
+
322
+ .generate-button:hover::before {
323
+ opacity: 1;
324
+ }
325
+
326
+ .generate-button:hover {
327
+ transform: translateY(-2px);
328
+ box-shadow: var(--shadow-glow);
329
+ background: var(--gradient-accent);
330
+ }
331
+
332
+ .generate-button:active {
333
+ transform: translateY(0);
334
+ }
335
+
336
+ .generate-button:disabled {
337
+ background: var(--gradient-surface);
338
+ cursor: not-allowed;
339
+ transform: none;
340
+ box-shadow: none;
341
+ }
342
+
343
+ .result-section {
344
+ margin-top: 0.5rem;
345
+ padding: 1.5rem;
346
+ background: rgba(255, 255, 255, 0.8);
347
+ border-radius: 12px;
348
+ min-height: 160px;
349
+ opacity: 0;
350
+ transform: translateY(10px);
351
+ animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
352
+ position: relative;
353
+ overflow: hidden;
354
+ backdrop-filter: blur(8px);
355
+ box-shadow: var(--shadow-md);
356
+ }
357
+
358
+ .result-section::before {
359
+ content: "";
360
+ position: absolute;
361
+ top: 0;
362
+ left: 0;
363
+ right: 0;
364
+ height: 3px;
365
+ background: var(--gradient-primary);
366
+ opacity: 0.8;
367
+ }
368
+
369
+ .result-content {
370
+ white-space: pre-wrap;
371
+ line-height: 1.7;
372
+ color: var(--text-primary);
373
+ font-size: 1rem;
374
+ }
375
+
376
+ .loading-spinner {
377
+ width: 20px;
378
+ height: 20px;
379
+ border: 2px solid rgba(255, 255, 255, 0.3);
380
+ border-top: 2px solid white;
381
+ border-radius: 50%;
382
+ animation: spin 1s linear infinite;
383
+ }
384
+
385
+ @keyframes spin {
386
+ 0% {
387
+ transform: rotate(0deg);
388
+ }
389
+ 100% {
390
+ transform: rotate(360deg);
391
+ }
392
+ }
393
+
394
+ @keyframes fadeIn {
395
+ from {
396
+ opacity: 0;
397
+ transform: translateY(10px);
398
+ }
399
+ to {
400
+ opacity: 1;
401
+ transform: translateY(0);
402
+ }
403
+ }
404
+
405
+ /* Decorative elements */
406
+ .editor-container::after {
407
+ content: "";
408
+ position: absolute;
409
+ top: 50%;
410
+ left: 50%;
411
+ width: 200%;
412
+ height: 200%;
413
+ background: radial-gradient(
414
+ circle at center,
415
+ rgba(124, 58, 237, 0.1) 0%,
416
+ transparent 50%
417
+ );
418
+ transform: translate(-50%, -50%);
419
+ pointer-events: none;
420
+ animation: pulse 4s ease-in-out infinite;
421
+ }
422
+
423
+ .prompt-context {
424
+ font-size: 13px;
425
+ color: var(--text-secondary);
426
+ }
427
+
428
+ @keyframes pulse {
429
+ 0%,
430
+ 100% {
431
+ transform: translate(-50%, -50%) scale(1);
432
+ opacity: 0.5;
433
+ }
434
+ 50% {
435
+ transform: translate(-50%, -50%) scale(1.1);
436
+ opacity: 0.3;
437
+ }
438
+ }
439
+ `,r=o))||r},71271(t,e,n){n.d(e,{default:()=>m});var r=n(53577),o=n(74265),a=n(86319);const i=[100,300,400,500,600,700,900].map(t=>({value:String(t),label:String(t)})),s=t=>{{const{component:e,commands:n,helpers:s}=t,l=e.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=t.languageJson;const g=t.language||"he";return d||(d="he"===g?r:o),{select:t=>{let{changeTab:e,tab:n}=t},tabs:t=>{const e=l.isActive("customBulletItem"),n=[{text:"style",selected:!e},...e?[{text:"icons",selected:!0}]:[],{text:"settings"}];return n.forEach(e=>e.selected=e.text===t),n},layout:t=>{let{tab:r,changeTab:o,tabs:s}=t;return[{type:"info",text:"text_micro_copy",active:()=>"style"===r.text},{type:"heading",level:6,text:"typography",active:()=>"style"===r.text},{type:"dropdown",active:()=>"style"===r.text,title:"type",value:p,items:[{value:"H1"},{value:"H2"},{value:"H3"},{value:"H4"},{value:"H5"},{value:"H6"},{value:"paragraph"}],onChange:t=>{const e=t.target.value;switch(e){case"H1":case"H2":case"H3":case"H4":case"H5":case"H6":l.chain().setHeading({level:parseInt(e.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"===r.text,onInput:t=>{const n=t.target.value,r=e.tiptap,o=r.view.state.selection;o.from===o.to?r.chain().selectAll().setFontSize(n).run():r.chain().setFontSize(n).run()}},{type:"dropdown",title:"fontWeight",active:()=>"style"===r.text&&"web"===a.M.get("config","channel"),value:String(l.getAttributes("textStyle").fontWeight||400),selected:String(l.getAttributes("textStyle").fontWeight||400),items:i,onChange:t=>{const n=t.target.value,r=e.tiptap,o=r.view.state.selection;o.from===o.to?r.chain().selectAll().setFontWeight(n).run():r.chain().setFontWeight(n).run()}},{type:"heading",level:6,text:"spacing",active:()=>"style"===r.text},{type:"slider",title:"lineHeight",min:1,max:3,step:.1,value:parseFloat(c.lineHeight||1),active:()=>"style"===r.text,onInput:t=>{const n=t.target.value,r=e.tiptap,o=r.view.state.selection;o.from===o.to?r.chain().selectAll().setLineHeight(n).run():r.chain().setLineHeight(n).run()}},{type:"slider",title:"letterSpacing",min:1,max:10,step:1,value:parseFloat(c.letterSpacing)||1,active:()=>"style"===r.text,onInput:t=>{const n=t.target.value,r=e.tiptap,o=r.view.state.selection;n<=1?o.from===o.to?r.chain().selectAll().setLetterSpacing("normal").run():r.chain().setLetterSpacing("normal").run():o.from===o.to?r.chain().selectAll().setLetterSpacing(n+"px").run():r.chain().setLetterSpacing(n+"px").run()}},{type:"heading",level:6,text:"colors",active:()=>"style"===r.text},{type:"colorSwatchGroup",active:()=>"style"===r.text,columns:2,items:[{title:"font_color",value:l.getAttributes("textStyle").color||"#000000",onChange:t=>{const n=t.target.value,r=e.tiptap,o=r.view.state.selection;if(o.from===o.to){const{state:t,view:e}=r,o=t.tr,{from:a,to:i}={from:0,to:t.doc.content.size};t.doc.nodesBetween(a,i,(e,r)=>{if(e.isText){e.marks.some(t=>"link"===t.type.name)||o.addMark(r,r+e.nodeSize,t.schema.marks.textStyle.create({color:n}))}}),e.dispatch(o)}else r.chain().setColor(n).focus().run()}},{title:"backgroundColor",allowGradient:!0,value:e.props.style.background||e.props.style.backgroundColor||"#ffffff",onChange:t=>{const e=t.target.value;n.execCommand("style",{background:e,backgroundColor:null})}}]},{type:"heading",level:6,text:"layout",active:()=>"style"===r.text},{type:"slider",active:()=>"style"===r.text,title:"maxWidth",value:parseFloat(e.props.style.width),min:20,max:1e3,onInput:t=>{const e=t.target.value;n.execCommand("style",{width:e+"px"})}},{type:"divider"},{type:"colorpicker",active:()=>"icons"===r.text,title:d.iconColor||"Icon color",alpha:!1,value:l.getAttributes(" textStyle").color||"#0000",onChange:t=>{const e=t.target.value;l.chain().setCustomBulletStyles({fill:e}).run()}},{type:"divider",active:()=>"icons"===r.text},{type:"slider",active:()=>"icons"===r.text,title:d.iconSize||"Icon size",value:parseInt(l.getAttributes("customBulletItem").width)||24,min:10,max:40,onInput:t=>{const e=t.target.value;l.chain().setCustomBulletStyles({width:e+"px",height:e+"px"}).run()}},{type:"icons",active:()=>"icons"===r.text,selectedIcon:e.props.src,useIconsApi:!0,iconColor:e.props.iconColor||"000000",iconSize:parseInt(e.props.style?.width,10)||24,onChange:t=>{const n=t.detail;e.tiptap.chain().focus().setCustomBulletIcon({svgIcon:n.urlPng}).run()}}]}}}};var l=n(52144);const c=t=>{let{helpers:e,tiptap:n,composeId:r,template:o}=t;return{set:(t,a,i)=>{switch(a){case"style":return"object"==typeof i&&(t[a]=(0,l.A)(t[a],i),e.mergeDiff(o,{style:t[a]})),!0;case"text":t[a]=i;const s=n.getJSON();return i&&"object"==typeof i&&JSON.stringify(s)!==JSON.stringify(i.childNodes)&&(i&&i.focusedElement&&i.focusedElement===r?(n.chain().focus().setContent(i.childNodes).run(),i.to&&i.from&&n.commands.setTextSelection({from:i.from,to:i.to})):n.chain().setContent(i.childNodes).run()),delete t?.text?.markdown,!0}}}};var p=n(84488),d=n.n(p);n(70567);const g=[];let u=!1,h=null;const m=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e="text";return{name:e,create:n=>{const{createElement:r,compose:o,helpers:i}=n,{mergeDiff:l}=i,p=document.createElement("div");l(p,{style:o.props.style});const m=a.M.get("config","editor","configure","editorProps","fonts");let x=a.M.get("config","target");"string"==typeof x&&(x=document.querySelector(x)),x||(x=document.body);const y=d()({element:p,container:x||document.body,editable:!0,offsetTop:40,onClickMagic:t=>{let{insertContent:e,getJSON:n,getHTML:r,getText:o,selectAll:i,insertContentHtml:s}=t;const l=a.M.get("injectEditor"),c=document.createElement("cdtr-text-prompt-editor");l(c),c.context=o(),c.addEventListener("text-generation-start",t=>{i()}),c.addEventListener("text-generation-chunk",t=>{e(t.detail.chunk)}),c.addEventListener("text-generation-complete",t=>{i(),s(t.detail.text)}),c.addEventListener("text-generation-error",t=>{console.error("Text generation error:",t.detail.error)})},content:"string"==typeof o.props.text.markdown?o.props.text.markdown:o.props.text.childNodes,defaultDirection:"rtl",onBlur:()=>{h===y&&(h=null),setTimeout(()=>{h!==y&&(u=!1)},150)},onFocus:()=>{if(!u||h===y||null===h){if(u=!0,h=y,g.length>0)for(g.forEach(t=>{t!==y&&t.hideEditor()});g.length>0;)g.pop();g.push(y),setTimeout(()=>{h===y&&u&&y.showEditor()},100)}},onUpdate:t=>{let{editor:e,transaction:n}=t;if(0===n.steps.length)return;const r=n.curSelection.from,a=n.curSelection.to,i={childNodes:e.getJSON(),from:r,to:a,focusedElement:o.id};f.commands.execCommand("text",i)},ignoresBlurByQuerySelectors:[".ignore-events"],builder:[{type:"fontFamily",fonts:m||[],useCloud:!0},{type:"fontSize",sizes:t.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=r({name:e,id:o.id,template:p,defaultProps:{text:{},style:{}},draggable:{group:"element"},droppable:{group:"element"},resizeable:()=>p,handleBar:!0,validator:c({template:p,helpers:i,tiptap:y,composeId:o.id}),schema:o.schema,onSelect:t=>{p.classList.add(t)},onDeselect:t=>{p.classList.remove(t)},elementProps:o,remove:()=>{p.remove()},createEditor:s});return o.props.text.markdown&&y.chain().insertContent(" ").run(),f.addProp("tiptap",y),f}}}}}]);
Binary file
@@ -1,5 +1,4 @@
1
- /*! For license information please see 453.creaditor.bundle.js.LICENSE.txt */
2
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[453],{70453(t,e,s){s.r(e),s.d(e,{TitleEditor:()=>o});var n=s(59929),r=s(70980);class o extends n.WF{constructor(){super(),this.pb="6px"}render(){const t={fontWeight:this.bold?700:400,paddingBottom:this.pb};return n.qy`<span style=${(0,r.W)(t)}><slot></slot></span>`}}o.styles=n.AH`
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[453],{70453(t,e,o){o.r(e),o.d(e,{TitleEditor:()=>n});var s=o(59929),i=o(70980);class n extends s.WF{constructor(){super(),this.pb="6px"}render(){const t={fontWeight:this.bold?700:400,paddingBottom:this.pb};return s.qy`<span style=${(0,i.W)(t)}><slot></slot></span>`}}n.styles=s.AH`
3
2
  :host {
4
3
  display: block;
5
4
  font-size: 13px;
@@ -11,4 +10,4 @@
11
10
  direction: var(--direction-locale);
12
11
  user-select: none;
13
12
  }
14
- `,o.properties={bold:{type:Boolean},pb:{type:String}},customElements.define("cdtr-title",o)},70980(t,e,s){s.d(e,{W:()=>l});var n=s(80181),r=s(16655);const o="important",i=" !"+o,l=(0,r.u$)(class extends r.WL{constructor(t){if(super(t),t.type!==r.OA.ATTRIBUTE||"style"!==t.name||t.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce((e,s)=>{const n=t[s];return null==n?e:e+`${s=s.includes("-")?s:s.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}update(t,[e]){const{style:s}=t.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(e)),this.render(e);for(const t of this.ft)null==e[t]&&(this.ft.delete(t),t.includes("-")?s.removeProperty(t):s[t]=null);for(const t in e){const n=e[t];if(null!=n){this.ft.add(t);const e="string"==typeof n&&n.endsWith(i);t.includes("-")||e?s.setProperty(t,e?n.slice(0,-11):n,e?o:""):s[t]=n}}return n.c0}})}}]);
13
+ `,n.properties={bold:{type:Boolean},pb:{type:String}},customElements.define("cdtr-title",n)}}]);
Binary file