@creaditor/web-starterkit 1.0.4 → 1.0.6
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.
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[6713],{46713(t,e,i){i.r(e),i.d(e,{NextButton:()=>l});var s=i(59929),n=i(86319),o=i(93432),a=i(90090);class r extends s.WF{constructor(){super(),this.raf=0,this.dismissTimer=null,this.dismiss=()=>{this.isConnected&&this.remove()},this.message="Published!",this.sub="Your site is live.",this.url=""}firstUpdated(){this.launchConfetti(),this.dismissTimer=setTimeout(()=>this.dismiss(),4200)}disconnectedCallback(){super.disconnectedCallback(),cancelAnimationFrame(this.raf),this.dismissTimer&&clearTimeout(this.dismissTimer)}launchConfetti(){const t=this.renderRoot.querySelector("canvas");if(!t)return;const e=t.getContext("2d");if(!e)return;const i=window.devicePixelRatio||1,s=window.innerWidth,n=window.innerHeight;t.width=s*i,t.height=n*i,e.scale(i,i);const o=["#e94560","#1a1a2e","#f6c945","#2ec7a9","#4d7cfe","#ffffff"],a=s/2,r=.34*n,l=Math.min(220,Math.round(s/6)),c=Array.from({length:l},(t,e)=>{const i=2*Math.PI*e/l+e%3*.4,s=4+e%9;return{x:a,y:r,vx:Math.cos(i)*s,vy:Math.sin(i)*s-3,size:5+e%5,color:o[e%o.length],rot:e,vrot:(e%2?1:-1)*(.1+e%5*.03),life:1}}),d=performance.now(),h=t=>{const i=t-d;e.clearRect(0,0,s,n);let o=!1;for(const t of c)t.vy+=.16,t.x+=t.vx,t.y+=t.vy,t.rot+=t.vrot,i>2600*.55&&(t.life=Math.max(0,t.life-.02)),t.life>0&&t.y<n+40&&(o=!0),e.save(),e.globalAlpha=t.life,e.translate(t.x,t.y),e.rotate(t.rot),e.fillStyle=t.color,e.fillRect(-t.size/2,-t.size/2,t.size,.6*t.size),e.restore();o&&i<3e3?this.raf=requestAnimationFrame(h):e.clearRect(0,0,s,n)};this.raf=requestAnimationFrame(h)}render(){return s.qy`
|
|
2
|
+
<canvas @click=${this.dismiss}></canvas>
|
|
3
|
+
<div class="card">
|
|
4
|
+
<div class="check">
|
|
5
|
+
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
6
|
+
<path d="M5 13l4 4L19 7" stroke="#fff" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" />
|
|
7
|
+
</svg>
|
|
8
|
+
</div>
|
|
9
|
+
<p class="title">${this.message}</p>
|
|
10
|
+
${this.sub?s.qy`<p class="sub">${this.sub}</p>`:null}
|
|
11
|
+
${this.url?s.qy`<a class="view" href=${this.url} target="_blank" rel="noopener">View site</a>`:null}
|
|
12
|
+
</div>
|
|
13
|
+
`}}r.styles=s.AH`
|
|
14
|
+
:host {
|
|
15
|
+
position: fixed;
|
|
16
|
+
inset: 0;
|
|
17
|
+
z-index: 2147483000;
|
|
18
|
+
pointer-events: none;
|
|
19
|
+
display: block;
|
|
20
|
+
}
|
|
21
|
+
canvas {
|
|
22
|
+
position: absolute;
|
|
23
|
+
inset: 0;
|
|
24
|
+
width: 100%;
|
|
25
|
+
height: 100%;
|
|
26
|
+
}
|
|
27
|
+
.card {
|
|
28
|
+
position: absolute;
|
|
29
|
+
top: 34%;
|
|
30
|
+
left: 50%;
|
|
31
|
+
transform: translate(-50%, -50%) scale(0.9);
|
|
32
|
+
background: #ffffff;
|
|
33
|
+
border-radius: 16px;
|
|
34
|
+
box-shadow: 0 24px 60px rgba(26, 26, 46, 0.28);
|
|
35
|
+
padding: 26px 34px;
|
|
36
|
+
text-align: center;
|
|
37
|
+
font-family: Arial, Helvetica, sans-serif;
|
|
38
|
+
pointer-events: auto;
|
|
39
|
+
opacity: 0;
|
|
40
|
+
animation: pop 0.42s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
|
|
41
|
+
max-width: 88vw;
|
|
42
|
+
}
|
|
43
|
+
@keyframes pop {
|
|
44
|
+
to {
|
|
45
|
+
opacity: 1;
|
|
46
|
+
transform: translate(-50%, -50%) scale(1);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
.check {
|
|
50
|
+
width: 56px;
|
|
51
|
+
height: 56px;
|
|
52
|
+
border-radius: 50%;
|
|
53
|
+
background: #2ec7a9;
|
|
54
|
+
margin: 0 auto 14px;
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
}
|
|
59
|
+
.check svg {
|
|
60
|
+
width: 30px;
|
|
61
|
+
height: 30px;
|
|
62
|
+
}
|
|
63
|
+
.title {
|
|
64
|
+
font-size: 20px;
|
|
65
|
+
font-weight: bold;
|
|
66
|
+
color: #1a1a2e;
|
|
67
|
+
margin: 0;
|
|
68
|
+
}
|
|
69
|
+
.sub {
|
|
70
|
+
font-size: 13px;
|
|
71
|
+
color: #8a8f9c;
|
|
72
|
+
margin: 6px 0 0;
|
|
73
|
+
}
|
|
74
|
+
.view {
|
|
75
|
+
display: inline-block;
|
|
76
|
+
margin-top: 16px;
|
|
77
|
+
background: #e94560;
|
|
78
|
+
color: #fff;
|
|
79
|
+
text-decoration: none;
|
|
80
|
+
font-size: 14px;
|
|
81
|
+
font-weight: bold;
|
|
82
|
+
padding: 10px 22px;
|
|
83
|
+
border-radius: 9px;
|
|
84
|
+
}
|
|
85
|
+
`,r.properties={message:{type:String},sub:{type:String},url:{type:String}},customElements.define("cdtr-publish-success",r);class l extends s.WF{constructor(){super(),this.channel="",this.isLoading=!1,this.isLocked=!1,this.lockTimer=null}connectedCallback(){super.connectedCallback(),this.onNextStep||(this.onNextStep=n.M.get("config","onNextStep")),this.channel||(this.channel=n.M.get("config","channel")||"")}disconnectedCallback(){super.disconnectedCallback(),this.clearTimers()}clearTimers(){this.lockTimer&&(clearTimeout(this.lockTimer),this.lockTimer=null)}async handleClick(){if(!this.isLocked&&!this.isLoading){this.isLoading=!0,this.isLocked=!0,this.lockTimer=setTimeout(()=>{this.clearTimers(),this.isLoading=!1,this.isLocked=!1},1e4);try{!!n.M.get("config","access")&&"web"===this.channel&&(await(0,a.bK)({}),this.celebratePublish()),"function"==typeof this.onNextStep&&await this.onNextStep({toHTML:o.FE,toJSON:o.U2})}catch(t){console.error("Error in publish/onNextStep:",t),this.snackbar(n.M.get("lang","publishError")||"Publish failed")}finally{this.clearTimers(),this.isLoading=!1,this.isLocked=!1}}}snackbar(t){const e=n.M.get("commands");e?.snackbar?.(t)}celebratePublish(){const t=document.createElement("cdtr-publish-success");t.message=n.M.get("lang","published")||"Published!",t.sub=n.M.get("lang","publishedSub")||"Your site is live.";const e=n.M.get("app","domains"),i=e?.[0]?.name;i&&(t.url=/^https?:\/\//.test(i)?i:`https://${i}`),document.body.appendChild(t)}render(){const t=!!n.M.get("config","access");if(!(this.onNextStep||"web"===this.channel&&t))return null;const e="web"===this.channel?"publish":"next";return s.qy`
|
|
86
|
+
<paper-button
|
|
87
|
+
@click=${this.handleClick}
|
|
88
|
+
class="next-button"
|
|
89
|
+
?disabled=${this.isLocked}
|
|
90
|
+
>
|
|
91
|
+
${this.isLoading?s.qy`
|
|
92
|
+
<div class="loading-spinner"></div>
|
|
93
|
+
`:s.qy`
|
|
94
|
+
<div class="button-content ${this.isLoading?"loading":""}">
|
|
95
|
+
<lang-text text=${e}></lang-text>
|
|
96
|
+
</div>
|
|
97
|
+
`}
|
|
98
|
+
</paper-button>
|
|
99
|
+
`}}l.styles=s.AH`
|
|
100
|
+
:host {
|
|
101
|
+
display: block;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.next-button {
|
|
105
|
+
background: var(--primary);
|
|
106
|
+
color: var(--primary-text);
|
|
107
|
+
fill: var(--primary-text);
|
|
108
|
+
text-transform: none;
|
|
109
|
+
color: #fff;
|
|
110
|
+
height: 52px;
|
|
111
|
+
border-radius: 0;
|
|
112
|
+
width: 90px;
|
|
113
|
+
transform: translateX(-4px);
|
|
114
|
+
position: relative;
|
|
115
|
+
overflow: hidden;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.next-button:disabled {
|
|
119
|
+
opacity: 0.6;
|
|
120
|
+
cursor: not-allowed;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.loading-spinner {
|
|
124
|
+
position: absolute;
|
|
125
|
+
top: 50%;
|
|
126
|
+
left: 50%;
|
|
127
|
+
transform: translate(-50%, -50%);
|
|
128
|
+
width: 20px;
|
|
129
|
+
height: 20px;
|
|
130
|
+
border: 2px solid transparent;
|
|
131
|
+
border-top: 2px solid #fff;
|
|
132
|
+
border-radius: 50%;
|
|
133
|
+
animation: spin 1s linear infinite;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
@keyframes spin {
|
|
137
|
+
0% { transform: translate(-50%, -50%) rotate(0deg); }
|
|
138
|
+
100% { transform: translate(-50%, -50%) rotate(360deg); }
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.button-content {
|
|
142
|
+
opacity: 1;
|
|
143
|
+
transition: opacity 0.3s ease;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.button-content.loading {
|
|
147
|
+
opacity: 0;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
`,l.properties={onNextStep:{type:Function},channel:{type:String},isLoading:{type:Boolean},isLocked:{type:Boolean},lockTimer:{type:Number}},customElements.define("cdtr-next-button",l)}}]);
|
|
Binary file
|