@smartdoca/doca-easy-pomodoro-plugin 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/server.js +2 -2
- package/manifest.json +2 -2
- package/package.json +1 -1
- package/web/index.js +4 -4
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
npm 包:`@smartdoca/doca-easy-pomodoro-plugin`。入口使用番茄红色时钟 SVG 图标。
|
|
4
4
|
|
|
5
|
-
插件 ID:`doca.
|
|
5
|
+
插件 ID:`doca.easy.pomodoro`。主页只显示点击入口,全局更多菜单和文档工具栏直接打开同一个非模态悬浮卡片。默认专注/短休息/长休息为 25/5/15 分钟,可在空闲时调整到 1–120 分钟。
|
|
6
6
|
|
|
7
7
|
卡片有缩小、关闭按钮,顶部与缩小后的拖动手柄支持鼠标/触摸拖拽,也可聚焦手柄后用方向键移动。移动、展开和视口变化时限制在可见范围。缩小后只保留倒计时、状态图标和关闭按钮:专注为橙色,休息为绿色,暂停为灰色。开始、暂停与继续保持当前展示大小,只有手动点击缩小按钮才折叠;关闭只隐藏卡片,计时继续。单页内切换页面保留悬浮卡片;倒计时结束后,即使已缩小或关闭也自动显示完整卡片,提示完成并提供下一阶段入口,不自动启动下一阶段。
|
|
8
8
|
|
|
@@ -10,6 +10,6 @@ npm 包:`@smartdoca/doca-easy-pomodoro-plugin`。入口使用番茄红色时
|
|
|
10
10
|
|
|
11
11
|
没有外部 API 或系统通知。悬浮层使用浏览器原生手动 Popover,只挂载插件自身 DOM,不阻止操作页面;浏览器需支持 Popover API。服务端通过 SDK 托管关系库保存截止时间与设置,不创建独立数据库。关闭页面释放前端计时器、同步通道与 DOM;插件或登录权限被撤销时,下一次校准清理悬浮层。卸载数据清理由宿主负责。
|
|
12
12
|
|
|
13
|
-
版本 0.1.
|
|
13
|
+
版本 0.1.1,`sdkRange: "^0.1.9"`、`doca.storage: "host"`、`dataVersion: "2"`。随包提供服务端和 Web 入口的 `.d.ts`。
|
|
14
14
|
|
|
15
15
|
在仓库根目录安装依赖后执行 `npm run build --workspace pomodoro`;`npm run release` 生成独立 ZIP。开发、安装和验证流程见上一级 README。
|
package/dist/server.js
CHANGED
|
@@ -553,8 +553,8 @@ function isTimer(v) {
|
|
|
553
553
|
// pomodoro/manifest.json
|
|
554
554
|
var manifest_default = {
|
|
555
555
|
schemaVersion: 1,
|
|
556
|
-
id: "doca.
|
|
557
|
-
version: "0.1.
|
|
556
|
+
id: "doca.easy.pomodoro",
|
|
557
|
+
version: "0.1.1",
|
|
558
558
|
displayName: "Pomodoro / \u756A\u8304\u949F",
|
|
559
559
|
sdkRange: "^0.1.9"
|
|
560
560
|
};
|
package/manifest.json
CHANGED
package/package.json
CHANGED
package/web/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var O=`.ep-root{--ep-bg:#fff;--ep-ink:#172c39;--ep-muted:#6c7e89;--ep-line:#e4e9
|
|
|
5
5
|
@container (max-width:420px){.ep-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.ep-head{align-items:flex-start}.ep-root h1{font-size:24px}}
|
|
6
6
|
@media(max-width:600px){.ep-root{padding:18px;border-radius:15px}.ep-page{margin:12px;padding:20px}.ep-search{flex-wrap:wrap}.ep-search input{min-width:160px}}
|
|
7
7
|
@media(prefers-reduced-motion:reduce){.ep-root *{animation:none!important;transition:none!important}}
|
|
8
|
-
`;var q=(n,o,l)=>n==="zh"?o:l;function G(n,o){let l=n.React;function t({children:y,className:T=""}){let b=n.useEnvironment();return l.createElement("section",{className:`ep-root ${T}`,"data-theme":b.theme,lang:b.locale==="zh"?"zh-CN":"en"},l.createElement("style",null,O),y)}function h(y,T,b){let g=n.useEnvironment().locale,[u,E]=l.useState(T),[m,z]=l.useState(!1),[B,x]=l.useState(""),r=l.useRef({value:T,revision:0}),s=l.useRef(!1),e=l.useRef(!1),w=l.useRef(async()=>{})
|
|
8
|
+
`;var q=(n,o,l)=>n==="zh"?o:l;function G(n,o){let l=n.React;function t({children:y,className:T=""}){let b=n.useEnvironment();return l.createElement("section",{className:`ep-root ${T}`,"data-theme":b.theme,lang:b.locale==="zh"?"zh-CN":"en"},l.createElement("style",null,O),y)}function h(y,T,b){let g=n.useEnvironment().locale,[u,E]=l.useState(T),[m,z]=l.useState(!1),[B,x]=l.useState(""),r=l.useRef({value:T,revision:0}),s=l.useRef(!1),e=l.useRef(!1),w=l.useRef(async()=>{}),$=l.useRef(null),f=l.useRef(""),M=l.useRef(null),d=v=>{if(!Number.isInteger(v.revision)||v.revision<0||(v.revision===0?v.value!==null:!b(v.value)))throw Error(q(g,"\u4FDD\u5B58\u7684\u8BBE\u7F6E\u65E0\u6CD5\u8BFB\u53D6\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u3002","Saved settings could not be read. Contact your administrator."));let k=v.revision===0?T:v.value;JSON.stringify(r.current.value)!==JSON.stringify(k)&&E(k),r.current={value:k,revision:v.revision}};return l.useEffect(()=>{e.current=!0;let v,k=null,C=async(a=!1)=>{if(s.current||!e.current)return;M.current?.abort();let p=new AbortController;M.current=p;try{let c=await n.request(`/preferences?name=${encodeURIComponent(y)}`,{signal:p.signal});!p.signal.aborted&&e.current&&(d(c),z(!0),a||x(""))}catch(c){!p.signal.aborted&&e.current&&(z(!1),x(c.message))}};w.current=C;let H=a=>{a.detail===f.current&&C()},N=()=>{document.visibilityState==="visible"&&C()};return window.addEventListener("doca.everyday.preference",H),document.addEventListener("visibilitychange",N),n.platform.users.me().then(async a=>{e.current&&(f.current=`${o}:${a.id}:${y}`,typeof BroadcastChannel<"u"&&(k=new BroadcastChannel(`doca.everyday.${f.current}`),$.current=k,k.onmessage=()=>{C()}),await C(),e.current&&(v=window.setInterval(N,15e3)))}).catch(()=>{e.current&&x(q(g,"\u65E0\u6CD5\u8F7D\u5165\u5F53\u524D\u7528\u6237\u8BBE\u7F6E\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55\u540E\u91CD\u8BD5\u3002","Could not load your settings. Sign in again."))}),()=>{e.current=!1,M.current?.abort(),clearInterval(v),k?.close(),$.current=null,window.removeEventListener("doca.everyday.preference",H),document.removeEventListener("visibilitychange",N)}},[y]),[u,async v=>{if(!m||s.current||!e.current)return!1;let k=typeof v=="function"?v(r.current.value):v;if(!b(k))throw Error("Invalid preference");if(JSON.stringify(k)===JSON.stringify(r.current.value))return!0;s.current=!0,z(!1),M.current?.abort();let C=new AbortController;M.current=C;let H=!1;try{let N=await n.request("/preferences",{method:"POST",signal:C.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify({name:y,value:k,revision:r.current.revision})});e.current&&!C.signal.aborted&&(d(N),x(""),H=!0)}catch(N){e.current&&!C.signal.aborted&&x(N.message)}finally{s.current=!1,e.current&&(H?(z(!0),window.dispatchEvent(new CustomEvent("doca.everyday.preference",{detail:f.current})),$.current?.postMessage("reload")):await w.current(!0))}return H},m,B]}return{Frame:t,usePreference:h}}function D(n){let o=new Date(n);return`${o.getFullYear()}-${String(o.getMonth()+1).padStart(2,"0")}-${String(o.getDate()).padStart(2,"0")}`}function j(n=Date.now()){return{phase:"focus",status:"idle",deadline:null,remaining:25*6e4,durations:{focus:25,short:5,long:15},completed:0,day:D(n)}}function W(n){if(!n||typeof n!="object")return!1;let o=n;return["focus","short","long"].includes(o.phase)&&["idle","running","paused"].includes(o.status)&&(o.deadline===null||Number.isFinite(o.deadline)&&o.deadline>0)&&o.status==="running"==(o.deadline!==null)&&Number.isFinite(o.remaining)&&o.remaining>=0&&o.remaining<=120*6e4&&!!o.durations&&[o.durations.focus,o.durations.short,o.durations.long].every(l=>Number.isInteger(l)&&l>=1&&l<=120)&&Number.isInteger(o.completed)&&o.completed>=0&&/^\d{4}-\d{2}-\d{2}$/.test(o.day)}function F(n,o){return n.status==="running"?Math.max(0,n.deadline-o):n.remaining}function X(n,o){return n.status==="running"?n:{...n,status:"running",deadline:o+n.remaining}}function Z(n,o){return n.status!=="running"?n:{...n,status:"paused",deadline:null,remaining:F(n,o)}}function R(n,o=n.phase){return{...n,phase:o,status:"idle",deadline:null,remaining:n.durations[o]*6e4}}function V(n,o){if(n.status!=="running"||n.deadline>o)return n;let l=n.phase==="focus",t=D(o),h=(n.day===t?n.completed:0)+(l?1:0),y=l?h%4===0?"long":"short":"focus";return{...n,phase:y,status:"idle",deadline:null,remaining:n.durations[y]*6e4,completed:h,day:t}}function J(n){let o=Math.ceil(n/1e3);return`${String(Math.floor(o/60)).padStart(2,"0")}:${String(o%60).padStart(2,"0")}`}var L={schemaVersion:1,id:"doca.easy.pomodoro",version:"0.1.1",displayName:"Pomodoro / \u756A\u8304\u949F",sdkRange:"^0.1.9"};var te={focus:'<circle cx="12" cy="12" r="8"/><circle cx="12" cy="12" r="3"/><path d="M12 2v2m0 16v2M2 12h2m16 0h2"/>',break:'<path d="M5 7h12v7a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5V7Zm12 1h1a3 3 0 0 1 0 6h-1M8 2v2m4-2v2M4 22h15"/>',paused:'<path d="M8 5v14M16 5v14"/>',complete:'<circle cx="12" cy="12" r="9"/><path d="m8 12 3 3 5-6"/>',clock:'<circle cx="12" cy="13" r="8"/><path d="M12 9v4l3 2M9 2h6M12 2v3"/>',settings:'<path d="M10 3h4l.5 2.2 2 1.2 2.2-.7 2 3.6-1.6 1.5v2.4l1.6 1.5-2 3.6-2.2-.7-2 1.2L14 21h-4l-.5-2.2-2-1.2-2.2.7-2-3.6 1.6-1.5v-2.4L3.3 9.3l2-3.6 2.2.7 2-1.2L10 3Z"/><circle cx="12" cy="12" r="3"/>'};function U(n){return`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${te[n]}</svg>`}function K(n,o){let l=document.activeElement instanceof HTMLElement?document.activeElement:null,t=document.createElement("div");t.className="pomodoro-float",t.popover="manual",t.setAttribute("data-plugin",L.id),t.innerHTML=`<style></style>
|
|
9
9
|
<section class="ep-root pomodoro-card" role="dialog" aria-modal="false" aria-labelledby="pomodoro-title" hidden>
|
|
10
10
|
<header class="pomodoro-drag" tabindex="0" data-drag>
|
|
11
11
|
<span class="pomodoro-symbol" data-icon></span>
|
|
@@ -25,7 +25,7 @@ var O=`.ep-root{--ep-bg:#fff;--ep-ink:#172c39;--ep-muted:#6c7e89;--ep-line:#e4e9
|
|
|
25
25
|
<span class="pomodoro-mini-grip" tabindex="0" data-drag>\u283F</span>
|
|
26
26
|
<button type="button" class="pomodoro-mini-expand" data-action="expand"><span class="pomodoro-symbol" data-icon></span><strong data-countdown></strong><span class="ep-visually-hidden" data-text="status"></span></button>
|
|
27
27
|
<button type="button" class="pomodoro-mini-close" data-action="close">\xD7</button>
|
|
28
|
-
</section>`,t.querySelector("style").textContent=n,document.body.append(t);let h=t.querySelector(".pomodoro-card"),y=t.querySelector(".pomodoro-mini"),T=null,b=null,g=null,u=null,E=12;function m(){if(!t.matches(":popover-open"))return;let r=t.getBoundingClientRect(),s=window.visualViewport,e=s?.width??window.innerWidth,w=s?.height??window.innerHeight,L=s?.offsetLeft??0,f=s?.offsetTop??0;b=Math.max(L+E,Math.min(b??L+e-r.width-24,L+e-r.width-E)),g=Math.max(f+E,Math.min(g??f+w-r.height-24,f+w-r.height-E)),t.style.left=`${b}px`,t.style.top=`${g}px`,t.style.setProperty("--pomodoro-max-height",`${Math.max(100,w-E*2)}px`)}function z(){let r=u;u=null,t.classList.remove("is-dragging"),r?.target.hasPointerCapture(r.id)&&r.target.releasePointerCapture(r.id)}t.addEventListener("pointerdown",r=>{let s=r.target,e=s.closest("[data-drag]");if(!e||s.closest("button, input")||r.button!==0)return;let w=t.getBoundingClientRect();u={id:r.pointerId,x:r.clientX,y:r.clientY,left:w.left,top:w.top,target:e},e.setPointerCapture(r.pointerId),t.classList.add("is-dragging"),r.preventDefault()}),t.addEventListener("pointermove",r=>{!u||u.id!==r.pointerId||(b=u.left+r.clientX-u.x,g=u.top+r.clientY-u.y,m())}),t.addEventListener("pointerup",z),t.addEventListener("pointercancel",z),t.addEventListener("lostpointercapture",z),t.addEventListener("keydown",r=>{let s=r.target;if(r.key==="Escape"){r.preventDefault(),o.close();return}if(!s.matches("[data-drag]"))return;let e={ArrowLeft:[-16,0],ArrowRight:[16,0],ArrowUp:[0,-16],ArrowDown:[0,16]};e[r.key]&&(r.preventDefault(),b=(b??0)+e[r.key][0],g=(g??0)+e[r.key][1],m())}),t.addEventListener("click",r=>{let s=r.target.closest("button");if(!(!s||s.disabled))if(s.dataset.phase)o.phase(s.dataset.phase);else{let e=s.dataset.action;o[e]?.()}}),t.addEventListener("change",r=>{let s=r.target;if(!s.dataset.duration||!T)return;let e=s.valueAsNumber,w=s.dataset.duration;Number.isInteger(e)&&e>=1&&e<=120?o.duration(w,e):s.value=String(T.state.durations[w])});let B=new ResizeObserver(m);B.observe(t),window.addEventListener("resize",m),window.visualViewport?.addEventListener("resize",m),window.visualViewport?.addEventListener("scroll",m);function x(r,s){t.querySelectorAll(`[data-text="${r}"]`).forEach(e=>{e.textContent!==s&&(e.textContent=s)})}return{update(r){let s=T;T=r;let{state:e,locale:w,display:L,notice:f,ready:$}=r,d=(i,A)=>q(w,i,A),C={focus:d("\u4E13\u6CE8","Focus"),short:d("\u77ED\u4F11\u606F","Short break"),long:d("\u957F\u4F11\u606F","Long break")},v=e.status==="paused"?d("\u5DF2\u6682\u505C","Paused"):e.status==="running"?e.phase==="focus"?d("\u4E13\u6CE8\u4E2D","Focusing"):d("\u4F11\u606F\u4E2D","On a break"):d("\u51C6\u5907\u5F00\u59CB","Ready to start"),k=f?"complete":e.status==="paused"?"paused":e.phase==="focus"?"focus":"break";t.dataset.tone=k,t.dataset.status=e.status,t.dataset.phase=e.phase,[h,y].forEach(i=>{i.dataset.theme=r.theme,i.lang=w==="zh"?"zh-CN":"en"}),h.hidden=L!=="full",y.hidden=L!=="mini",x("title",d("\u756A\u8304\u949F","Pomodoro")),x("status",`${C[e.phase]} \xB7 ${v}`),x("hint",e.status==="running"?e.phase==="focus"?d("\u53EA\u505A\u4E00\u4EF6\u4E8B\uFF0C\u6162\u6162\u6765","One thing at a time."):d("\u653E\u677E\u4E00\u4E0B\uFF0C\u6062\u590D\u7CBE\u529B","Take a breath. Recharge."):e.status==="paused"?d("\u51C6\u5907\u597D\u540E\u7EE7\u7EED","Resume when you\u2019re ready."):d("\u51C6\u5907\u597D\u4E86\u5C31\u5F00\u59CB","Start when you\u2019re ready.")),x("reset",d("\u91CD\u7F6E","Reset")),x("today",d("\u4ECA\u65E5\u5B8C\u6210","Completed today")),x("sessions",d("\u6B21\u4E13\u6CE8","sessions")),x("cycle",d("\u6BCF 4 \u6B21\u540E\u957F\u4F11\u606F","Long break every 4 sessions")),x("tip",d("\u62D6\u52A8\u9876\u90E8\u79FB\u52A8\u5361\u7247 \xB7 \u5173\u95ED\u540E\u8BA1\u65F6\u7EE7\u7EED","Drag the header to move \xB7 Closing keeps the timer running"));let M=F(e,r.now),H=J(M);t.querySelectorAll("[data-countdown]").forEach(i=>{i.textContent!==H&&(i.textContent=H),i.setAttribute("aria-label",d("\u5269\u4F59\u65F6\u95F4","Time remaining"))}),h.querySelector(".pomodoro-ring").style.setProperty("--progress",`${Math.max(0,Math.min(1,1-M/(e.durations[e.phase]*6e4)))*360}deg`);let N=U(k==="break"?"break":k==="paused"?"paused":k==="complete"?"complete":e.status==="idle"?"clock":"focus");(!s||s.state.status!==e.status||s.state.phase!==e.phase||s.notice!==f)&&t.querySelectorAll("[data-icon]").forEach(i=>{i.innerHTML=N}),t.querySelector("[data-completed]").textContent=String(e.day===D(r.now)?e.completed:0);let a=h.querySelector(".pomodoro-notice");a.hidden=!f,x("noticeTitle",f==="focus"?d("\u4E13\u6CE8\u5B8C\u6210\uFF01","Focus complete!"):d("\u4F11\u606F\u7ED3\u675F\uFF01","Break complete!")),x("noticeBody",f==="focus"?d(`\u505A\u5F97\u4E0D\u9519\uFF0C\u63A5\u4E0B\u6765${C[e.phase]} ${e.durations[e.phase]} \u5206\u949F\u3002`,`Nice work. Take a ${e.durations[e.phase]} minute ${C[e.phase].toLowerCase()}.`):d("\u6062\u590D\u597D\u7CBE\u529B\uFF0C\u51C6\u5907\u5F00\u59CB\u4E0B\u4E00\u6B21\u4E13\u6CE8\u3002","Feeling refreshed? Start your next focus session."));let p=h.querySelector("[data-action=toggle]");p.disabled=!$,p.textContent=e.status==="running"?d("\u6682\u505C","Pause"):e.status==="paused"?d("\u7EE7\u7EED","Resume"):f?d(`\u5F00\u59CB${C[e.phase]}`,`Start ${C[e.phase].toLowerCase()}`):d("\u5F00\u59CB","Start"),h.querySelector("[data-action=reset]").disabled=!$,h.querySelectorAll("[data-phase]").forEach(i=>{let A=i.dataset.phase;i.textContent=C[A],i.classList.toggle("active",e.phase===A),i.disabled=!$||e.status==="running",i.setAttribute("aria-pressed",String(e.phase===A))});let c=h.querySelector(".pomodoro-settings-panel");c.hidden=!r.settings,h.querySelectorAll("[data-duration]").forEach(i=>{let A=i.dataset.duration;i.disabled=!$||e.status!=="idle",i.setAttribute("aria-label",`${C[A]}${d("\u5206\u949F"," minutes")}`),document.activeElement!==i&&(i.value=String(e.durations[A]))}),h.querySelectorAll("[data-duration-label]").forEach(i=>{i.textContent=`${C[i.dataset.durationLabel]} (${d("\u5206\u949F","min")})`});let S=h.querySelector(".ep-error");S.hidden=!r.error,S.textContent=r.error;let I={minimize:d("\u7F29\u5C0F\u756A\u8304\u949F","Minimize Pomodoro"),close:d("\u5173\u95ED\u756A\u8304\u949F","Close Pomodoro"),expand:d(`\u5C55\u5F00\u756A\u8304\u949F\uFF0C${C[e.phase]}\uFF0C${v}\uFF0C${H}`,`Expand Pomodoro, ${C[e.phase]}, ${v}, ${H}`),settings:d("\u8BBE\u7F6E","Settings")};if(t.querySelectorAll("[data-action]").forEach(i=>{let A=I[i.dataset.action];A&&(i.setAttribute("aria-label",A),i.title=A)}),h.querySelector("[data-action=settings]").setAttribute("aria-expanded",String(r.settings)),t.querySelectorAll("[data-drag]").forEach(i=>{i.setAttribute("aria-label",d("\u62D6\u52A8\u756A\u8304\u949F\uFF0C\u6216\u7528\u65B9\u5411\u952E\u79FB\u52A8","Drag Pomodoro, or move with arrow keys")),i.title=d("\u62D6\u52A8\u79FB\u52A8","Drag to move")}),L==="closed"){let i=t.contains(document.activeElement);t.matches(":popover-open")&&t.hidePopover(),i&&l?.isConnected&&l.focus()}else s?.display==="closed"&&!f&&document.activeElement instanceof HTMLElement&&!t.contains(document.activeElement)&&(l=document.activeElement),t.matches(":popover-open")||t.showPopover(),m(),s?.display!==L&&!f&&t.querySelector(L==="full"?"[data-drag]":"[data-action=expand]")?.focus({preventScroll:!0})},destroy(){z(),B.disconnect(),window.removeEventListener("resize",m),window.visualViewport?.removeEventListener("resize",m),window.visualViewport?.removeEventListener("scroll",m),t.remove()}}}function Q(n,o,l){let t={state:j(),now:Date.now(),ready:!1,error:"",display:"closed",notice:null,settings:!1,locale:"zh",theme:"light"},h=0,y="",T=!1,b=!1,g=!1,u=null,E=null,m=null,z,B,x=null,r=new Set,s=(a,p)=>q(t.locale,a,p);function e(a={}){t={...t,...a},m?.update(t),r.forEach(p=>p())}function w(a){g||(!m&&a!=="closed"&&(m=K(l,{expand:()=>w("full"),minimize:()=>{e({settings:!1}),w("mini")},close:()=>w("closed"),settings:()=>e({settings:!t.settings}),toggle:()=>{d()},reset:()=>{$(p=>R(p),{notice:null})},phase:p=>{$(c=>R(c,p),{notice:null})},duration:(p,c)=>{$(S=>R({...S,durations:{...S.durations,[p]:c}}))}})),e({display:a}))}function L(a){if(!Number.isInteger(a.revision)||a.revision<0||(a.revision===0?a.value!==null:!W(a.value)))throw Error(s("\u4FDD\u5B58\u7684\u8BBE\u7F6E\u65E0\u6CD5\u8BFB\u53D6\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u3002","Saved settings could not be read. Contact your administrator."));let p=a.revision===0?j():a.value,c=t.state,S=Date.now(),I=V(c,Math.max(S,c.deadline??S)),i=I!==c&&JSON.stringify(p)===JSON.stringify(I);h=a.revision,e({state:p,now:S}),i&&(e({notice:c.phase,settings:!1}),t.display!=="full"&&w("full"),n.toast(c.phase==="focus"?s("\u4E13\u6CE8\u5B8C\u6210\uFF0C\u4F11\u606F\u4E00\u4E0B\u5427\u3002","Focus complete. Time for a break."):s("\u4F11\u606F\u7ED3\u675F\uFF0C\u51C6\u5907\u5F00\u59CB\u4E0B\u4E00\u6B21\u4E13\u6CE8\u3002","Break complete. Ready to focus?"),"success"))}async function f(a=!1){if(T||g)return;u?.abort();let p=new AbortController;u=p;try{let c=await n.platform.users.me();if(p.signal.aborted||g)return;let S=`${o}:${c.id}:timer`;y!==S&&(E?.close(),y=S,h=0,m?.destroy(),m=null,e({state:j(),notice:null,ready:!1,display:"closed",settings:!1}),E=new BroadcastChannel(`doca.everyday.${y}`),E.onmessage=()=>{f()});let I=await n.request("/preferences?name=timer",{signal:p.signal});!p.signal.aborted&&!g&&(L(I),e({ready:!0,...!a&&{error:""}}))}catch(c){!p.signal.aborted&&!g&&(e({ready:!1,error:c.message}),[401,403,404].includes(c.status??0)&&H())}}async function $(a,p={}){if(!t.ready||T||g)return!1;let c=a(t.state);if(!W(c))throw Error("Invalid timer preference");if(JSON.stringify(c)===JSON.stringify(t.state))return e(p),!0;T=!0,e({ready:!1}),u?.abort();let S=new AbortController;u=S;let I=!1;try{let i=await n.request("/preferences",{method:"POST",signal:S.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"timer",value:c,revision:h})});!S.signal.aborted&&!g&&(L(i),e({error:"",...p}),I=!0)}catch(i){!S.signal.aborted&&!g&&e({error:i.message})}finally{T=!1,g||(I?(e({ready:!0}),window.dispatchEvent(new CustomEvent("doca.everyday.preference",{detail:y})),E?.postMessage("reload")):await f(!0))}return I}async function d(){let a=t.state.status==="running",p=Date.now();await $(c=>a?Z(c,p):X(c,p),{notice:null,settings:!1})}function C(){let a=Date.now();e({now:a}),t.ready&&!t.error&&t.state.status==="running"&&t.state.deadline<=a&&$(p=>V(p,a))}function v(){document.visibilityState==="visible"&&(C(),f())}function k(a){a.detail===y&&f()}function M(a){a.persisted||H()}function H(){g=!0,u?.abort(),E?.close(),m?.destroy(),m=null,clearInterval(z),clearInterval(B),window.removeEventListener("doca.everyday.preference",k),window.removeEventListener("pagehide",M),document.removeEventListener("visibilitychange",v)}async function N(){if(b)return x;b=!0,window.addEventListener("doca.everyday.preference",k),window.addEventListener("pagehide",M),document.addEventListener("visibilitychange",v),z=window.setInterval(C,250),B=window.setInterval(()=>{document.visibilityState==="visible"&&f()},15e3),x=f(),await x,C()}return{snapshot:()=>t,subscribe(a){return r.add(a),()=>{r.delete(a)}},ensure:N,environment(a,p){(t.locale!==a||t.theme!==p)&&e({locale:a,theme:p})},async open(a=t.locale){e({locale:a}),await N(),w("full")}}}var P={schemaVersion:1,id:"doca.everyday.pomodoro",version:"0.1.0",displayName:"Pomodoro / \u756A\u8304\u949F",sdkRange:"^0.1.9"};var Y=`.pomodoro-entry-symbol{width:54px;height:54px;flex-shrink:0;display:grid;place-items:center;border-radius:17px;background:#fff0eb;color:#cf5038}.pomodoro-entry-symbol svg{display:block;width:30px;height:30px}.pomodoro-entry .ep-head{margin-bottom:20px}
|
|
28
|
+
</section>`,t.querySelector("style").textContent=n,document.body.append(t);let h=t.querySelector(".pomodoro-card"),y=t.querySelector(".pomodoro-mini"),T=null,b=null,g=null,u=null,E=12;function m(){if(!t.matches(":popover-open"))return;let r=t.getBoundingClientRect(),s=window.visualViewport,e=s?.width??window.innerWidth,w=s?.height??window.innerHeight,$=s?.offsetLeft??0,f=s?.offsetTop??0;b=Math.max($+E,Math.min(b??$+e-r.width-24,$+e-r.width-E)),g=Math.max(f+E,Math.min(g??f+w-r.height-24,f+w-r.height-E)),t.style.left=`${b}px`,t.style.top=`${g}px`,t.style.setProperty("--pomodoro-max-height",`${Math.max(100,w-E*2)}px`)}function z(){let r=u;u=null,t.classList.remove("is-dragging"),r?.target.hasPointerCapture(r.id)&&r.target.releasePointerCapture(r.id)}t.addEventListener("pointerdown",r=>{let s=r.target,e=s.closest("[data-drag]");if(!e||s.closest("button, input")||r.button!==0)return;let w=t.getBoundingClientRect();u={id:r.pointerId,x:r.clientX,y:r.clientY,left:w.left,top:w.top,target:e},e.setPointerCapture(r.pointerId),t.classList.add("is-dragging"),r.preventDefault()}),t.addEventListener("pointermove",r=>{!u||u.id!==r.pointerId||(b=u.left+r.clientX-u.x,g=u.top+r.clientY-u.y,m())}),t.addEventListener("pointerup",z),t.addEventListener("pointercancel",z),t.addEventListener("lostpointercapture",z),t.addEventListener("keydown",r=>{let s=r.target;if(r.key==="Escape"){r.preventDefault(),o.close();return}if(!s.matches("[data-drag]"))return;let e={ArrowLeft:[-16,0],ArrowRight:[16,0],ArrowUp:[0,-16],ArrowDown:[0,16]};e[r.key]&&(r.preventDefault(),b=(b??0)+e[r.key][0],g=(g??0)+e[r.key][1],m())}),t.addEventListener("click",r=>{let s=r.target.closest("button");if(!(!s||s.disabled))if(s.dataset.phase)o.phase(s.dataset.phase);else{let e=s.dataset.action;o[e]?.()}}),t.addEventListener("change",r=>{let s=r.target;if(!s.dataset.duration||!T)return;let e=s.valueAsNumber,w=s.dataset.duration;Number.isInteger(e)&&e>=1&&e<=120?o.duration(w,e):s.value=String(T.state.durations[w])});let B=new ResizeObserver(m);B.observe(t),window.addEventListener("resize",m),window.visualViewport?.addEventListener("resize",m),window.visualViewport?.addEventListener("scroll",m);function x(r,s){t.querySelectorAll(`[data-text="${r}"]`).forEach(e=>{e.textContent!==s&&(e.textContent=s)})}return{update(r){let s=T;T=r;let{state:e,locale:w,display:$,notice:f,ready:M}=r,d=(i,A)=>q(w,i,A),P={focus:d("\u4E13\u6CE8","Focus"),short:d("\u77ED\u4F11\u606F","Short break"),long:d("\u957F\u4F11\u606F","Long break")},v=e.status==="paused"?d("\u5DF2\u6682\u505C","Paused"):e.status==="running"?e.phase==="focus"?d("\u4E13\u6CE8\u4E2D","Focusing"):d("\u4F11\u606F\u4E2D","On a break"):d("\u51C6\u5907\u5F00\u59CB","Ready to start"),k=f?"complete":e.status==="paused"?"paused":e.phase==="focus"?"focus":"break";t.dataset.tone=k,t.dataset.status=e.status,t.dataset.phase=e.phase,[h,y].forEach(i=>{i.dataset.theme=r.theme,i.lang=w==="zh"?"zh-CN":"en"}),h.hidden=$!=="full",y.hidden=$!=="mini",x("title",d("\u756A\u8304\u949F","Pomodoro")),x("status",`${P[e.phase]} \xB7 ${v}`),x("hint",e.status==="running"?e.phase==="focus"?d("\u53EA\u505A\u4E00\u4EF6\u4E8B\uFF0C\u6162\u6162\u6765","One thing at a time."):d("\u653E\u677E\u4E00\u4E0B\uFF0C\u6062\u590D\u7CBE\u529B","Take a breath. Recharge."):e.status==="paused"?d("\u51C6\u5907\u597D\u540E\u7EE7\u7EED","Resume when you\u2019re ready."):d("\u51C6\u5907\u597D\u4E86\u5C31\u5F00\u59CB","Start when you\u2019re ready.")),x("reset",d("\u91CD\u7F6E","Reset")),x("today",d("\u4ECA\u65E5\u5B8C\u6210","Completed today")),x("sessions",d("\u6B21\u4E13\u6CE8","sessions")),x("cycle",d("\u6BCF 4 \u6B21\u540E\u957F\u4F11\u606F","Long break every 4 sessions")),x("tip",d("\u62D6\u52A8\u9876\u90E8\u79FB\u52A8\u5361\u7247 \xB7 \u5173\u95ED\u540E\u8BA1\u65F6\u7EE7\u7EED","Drag the header to move \xB7 Closing keeps the timer running"));let C=F(e,r.now),H=J(C);t.querySelectorAll("[data-countdown]").forEach(i=>{i.textContent!==H&&(i.textContent=H),i.setAttribute("aria-label",d("\u5269\u4F59\u65F6\u95F4","Time remaining"))}),h.querySelector(".pomodoro-ring").style.setProperty("--progress",`${Math.max(0,Math.min(1,1-C/(e.durations[e.phase]*6e4)))*360}deg`);let N=U(k==="break"?"break":k==="paused"?"paused":k==="complete"?"complete":e.status==="idle"?"clock":"focus");(!s||s.state.status!==e.status||s.state.phase!==e.phase||s.notice!==f)&&t.querySelectorAll("[data-icon]").forEach(i=>{i.innerHTML=N}),t.querySelector("[data-completed]").textContent=String(e.day===D(r.now)?e.completed:0);let a=h.querySelector(".pomodoro-notice");a.hidden=!f,x("noticeTitle",f==="focus"?d("\u4E13\u6CE8\u5B8C\u6210\uFF01","Focus complete!"):d("\u4F11\u606F\u7ED3\u675F\uFF01","Break complete!")),x("noticeBody",f==="focus"?d(`\u505A\u5F97\u4E0D\u9519\uFF0C\u63A5\u4E0B\u6765${P[e.phase]} ${e.durations[e.phase]} \u5206\u949F\u3002`,`Nice work. Take a ${e.durations[e.phase]} minute ${P[e.phase].toLowerCase()}.`):d("\u6062\u590D\u597D\u7CBE\u529B\uFF0C\u51C6\u5907\u5F00\u59CB\u4E0B\u4E00\u6B21\u4E13\u6CE8\u3002","Feeling refreshed? Start your next focus session."));let p=h.querySelector("[data-action=toggle]");p.disabled=!M,p.textContent=e.status==="running"?d("\u6682\u505C","Pause"):e.status==="paused"?d("\u7EE7\u7EED","Resume"):f?d(`\u5F00\u59CB${P[e.phase]}`,`Start ${P[e.phase].toLowerCase()}`):d("\u5F00\u59CB","Start"),h.querySelector("[data-action=reset]").disabled=!M,h.querySelectorAll("[data-phase]").forEach(i=>{let A=i.dataset.phase;i.textContent=P[A],i.classList.toggle("active",e.phase===A),i.disabled=!M||e.status==="running",i.setAttribute("aria-pressed",String(e.phase===A))});let c=h.querySelector(".pomodoro-settings-panel");c.hidden=!r.settings,h.querySelectorAll("[data-duration]").forEach(i=>{let A=i.dataset.duration;i.disabled=!M||e.status!=="idle",i.setAttribute("aria-label",`${P[A]}${d("\u5206\u949F"," minutes")}`),document.activeElement!==i&&(i.value=String(e.durations[A]))}),h.querySelectorAll("[data-duration-label]").forEach(i=>{i.textContent=`${P[i.dataset.durationLabel]} (${d("\u5206\u949F","min")})`});let S=h.querySelector(".ep-error");S.hidden=!r.error,S.textContent=r.error;let I={minimize:d("\u7F29\u5C0F\u756A\u8304\u949F","Minimize Pomodoro"),close:d("\u5173\u95ED\u756A\u8304\u949F","Close Pomodoro"),expand:d(`\u5C55\u5F00\u756A\u8304\u949F\uFF0C${P[e.phase]}\uFF0C${v}\uFF0C${H}`,`Expand Pomodoro, ${P[e.phase]}, ${v}, ${H}`),settings:d("\u8BBE\u7F6E","Settings")};if(t.querySelectorAll("[data-action]").forEach(i=>{let A=I[i.dataset.action];A&&(i.setAttribute("aria-label",A),i.title=A)}),h.querySelector("[data-action=settings]").setAttribute("aria-expanded",String(r.settings)),t.querySelectorAll("[data-drag]").forEach(i=>{i.setAttribute("aria-label",d("\u62D6\u52A8\u756A\u8304\u949F\uFF0C\u6216\u7528\u65B9\u5411\u952E\u79FB\u52A8","Drag Pomodoro, or move with arrow keys")),i.title=d("\u62D6\u52A8\u79FB\u52A8","Drag to move")}),$==="closed"){let i=t.contains(document.activeElement);t.matches(":popover-open")&&t.hidePopover(),i&&l?.isConnected&&l.focus()}else s?.display==="closed"&&!f&&document.activeElement instanceof HTMLElement&&!t.contains(document.activeElement)&&(l=document.activeElement),t.matches(":popover-open")||t.showPopover(),m(),s?.display!==$&&!f&&t.querySelector($==="full"?"[data-drag]":"[data-action=expand]")?.focus({preventScroll:!0})},destroy(){z(),B.disconnect(),window.removeEventListener("resize",m),window.visualViewport?.removeEventListener("resize",m),window.visualViewport?.removeEventListener("scroll",m),t.remove()}}}function Q(n,o,l){let t={state:j(),now:Date.now(),ready:!1,error:"",display:"closed",notice:null,settings:!1,locale:"zh",theme:"light"},h=0,y="",T=!1,b=!1,g=!1,u=null,E=null,m=null,z,B,x=null,r=new Set,s=(a,p)=>q(t.locale,a,p);function e(a={}){t={...t,...a},m?.update(t),r.forEach(p=>p())}function w(a){g||(!m&&a!=="closed"&&(m=K(l,{expand:()=>w("full"),minimize:()=>{e({settings:!1}),w("mini")},close:()=>w("closed"),settings:()=>e({settings:!t.settings}),toggle:()=>{d()},reset:()=>{M(p=>R(p),{notice:null})},phase:p=>{M(c=>R(c,p),{notice:null})},duration:(p,c)=>{M(S=>R({...S,durations:{...S.durations,[p]:c}}))}})),e({display:a}))}function $(a){if(!Number.isInteger(a.revision)||a.revision<0||(a.revision===0?a.value!==null:!W(a.value)))throw Error(s("\u4FDD\u5B58\u7684\u8BBE\u7F6E\u65E0\u6CD5\u8BFB\u53D6\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u3002","Saved settings could not be read. Contact your administrator."));let p=a.revision===0?j():a.value,c=t.state,S=Date.now(),I=V(c,Math.max(S,c.deadline??S)),i=I!==c&&JSON.stringify(p)===JSON.stringify(I);h=a.revision,e({state:p,now:S}),i&&(e({notice:c.phase,settings:!1}),t.display!=="full"&&w("full"),n.toast(c.phase==="focus"?s("\u4E13\u6CE8\u5B8C\u6210\uFF0C\u4F11\u606F\u4E00\u4E0B\u5427\u3002","Focus complete. Time for a break."):s("\u4F11\u606F\u7ED3\u675F\uFF0C\u51C6\u5907\u5F00\u59CB\u4E0B\u4E00\u6B21\u4E13\u6CE8\u3002","Break complete. Ready to focus?"),"success"))}async function f(a=!1){if(T||g)return;u?.abort();let p=new AbortController;u=p;try{let c=await n.platform.users.me();if(p.signal.aborted||g)return;let S=`${o}:${c.id}:timer`;y!==S&&(E?.close(),y=S,h=0,m?.destroy(),m=null,e({state:j(),notice:null,ready:!1,display:"closed",settings:!1}),E=new BroadcastChannel(`doca.everyday.${y}`),E.onmessage=()=>{f()});let I=await n.request("/preferences?name=timer",{signal:p.signal});!p.signal.aborted&&!g&&($(I),e({ready:!0,...!a&&{error:""}}))}catch(c){!p.signal.aborted&&!g&&(e({ready:!1,error:c.message}),[401,403,404].includes(c.status??0)&&H())}}async function M(a,p={}){if(!t.ready||T||g)return!1;let c=a(t.state);if(!W(c))throw Error("Invalid timer preference");if(JSON.stringify(c)===JSON.stringify(t.state))return e(p),!0;T=!0,e({ready:!1}),u?.abort();let S=new AbortController;u=S;let I=!1;try{let i=await n.request("/preferences",{method:"POST",signal:S.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"timer",value:c,revision:h})});!S.signal.aborted&&!g&&($(i),e({error:"",...p}),I=!0)}catch(i){!S.signal.aborted&&!g&&e({error:i.message})}finally{T=!1,g||(I?(e({ready:!0}),window.dispatchEvent(new CustomEvent("doca.everyday.preference",{detail:y})),E?.postMessage("reload")):await f(!0))}return I}async function d(){let a=t.state.status==="running",p=Date.now();await M(c=>a?Z(c,p):X(c,p),{notice:null,settings:!1})}function P(){let a=Date.now();e({now:a}),t.ready&&!t.error&&t.state.status==="running"&&t.state.deadline<=a&&M(p=>V(p,a))}function v(){document.visibilityState==="visible"&&(P(),f())}function k(a){a.detail===y&&f()}function C(a){a.persisted||H()}function H(){g=!0,u?.abort(),E?.close(),m?.destroy(),m=null,clearInterval(z),clearInterval(B),window.removeEventListener("doca.everyday.preference",k),window.removeEventListener("pagehide",C),document.removeEventListener("visibilitychange",v)}async function N(){if(b)return x;b=!0,window.addEventListener("doca.everyday.preference",k),window.addEventListener("pagehide",C),document.addEventListener("visibilitychange",v),z=window.setInterval(P,250),B=window.setInterval(()=>{document.visibilityState==="visible"&&f()},15e3),x=f(),await x,P()}return{snapshot:()=>t,subscribe(a){return r.add(a),()=>{r.delete(a)}},ensure:N,environment(a,p){(t.locale!==a||t.theme!==p)&&e({locale:a,theme:p})},async open(a=t.locale){e({locale:a}),await N(),w("full")}}}var Y=`.pomodoro-entry-symbol{width:54px;height:54px;flex-shrink:0;display:grid;place-items:center;border-radius:17px;background:#fff0eb;color:#cf5038}.pomodoro-entry-symbol svg{display:block;width:30px;height:30px}.pomodoro-entry .ep-head{margin-bottom:20px}
|
|
29
29
|
.pomodoro-float{position:fixed;inset:auto;margin:0;padding:0;border:0;background:transparent;overflow:visible;width:max-content;max-width:calc(100vw - 24px);z-index:1000;--pomodoro-color:#cf5038;--pomodoro-tint:#fff0eb;--pomodoro-border:#f2cabb;color:var(--pomodoro-color)}
|
|
30
30
|
.pomodoro-float[data-tone=break]{--pomodoro-color:#157a70;--pomodoro-tint:#e7f4ef;--pomodoro-border:#bfe1d6}.pomodoro-float[data-tone=paused]{--pomodoro-color:#77818a;--pomodoro-tint:#eef1f3;--pomodoro-border:#d7dfe4}.pomodoro-float[data-tone=complete]{--pomodoro-color:#36856a;--pomodoro-tint:#e7f5ed;--pomodoro-border:#bfdfcb}
|
|
31
31
|
.pomodoro-float [hidden]{display:none!important}.pomodoro-float .ep-root{--ep-accent:var(--pomodoro-color);--ep-tint:var(--pomodoro-tint);border-color:var(--pomodoro-border);box-shadow:0 20px 64px #172c3926,0 3px 12px #172c3910}
|
|
@@ -37,5 +37,5 @@ var O=`.ep-root{--ep-bg:#fff;--ep-ink:#172c39;--ep-muted:#6c7e89;--ep-line:#e4e9
|
|
|
37
37
|
@keyframes pomodoro-appear{from{opacity:0;transform:translateY(6px) scale(.97)}to{opacity:1;transform:translateY(0) scale(1)}}
|
|
38
38
|
@media(max-width:600px){.pomodoro-float .pomodoro-card{padding:18px;border-radius:18px}.pomodoro-heading .ep-kicker{font-size:7px}.pomodoro-card .ep-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.pomodoro-ring{width:190px;height:190px;margin:18px auto}}
|
|
39
39
|
@media(prefers-reduced-motion:reduce){.pomodoro-float,.pomodoro-float *{animation:none!important;transition:none!important}}
|
|
40
|
-
`;var
|
|
41
|
-
${Y}`);function h(){let b=n.useEnvironment(),g=b.locale,u=(x,r)=>q(g,x,r),E=o.useSyncExternalStore(t.subscribe,t.snapshot),{state:m}=E;o.useEffect(()=>{t.environment(g,b.theme),t.ensure()},[g,b.theme]);let z=m.status!=="idle",B={focus:u("\u4E13\u6CE8","Focus"),short:u("\u77ED\u4F11\u606F","Short break"),long:u("\u957F\u4F11\u606F","Long break")};return o.createElement(l,{className:"pomodoro-entry"},o.createElement("style",null,Y),o.createElement("header",{className:"ep-head"},o.createElement("div",null,o.createElement("div",{className:"ep-kicker"},"FOCUS / ONE THING AT A TIME"),o.createElement("h2",null,u("\u756A\u8304\u949F","Pomodoro")),o.createElement("p",{className:"ep-muted"},u("\u7ED9\u4E00\u4EF6\u4E8B\uFF0C\u4E00\u6BB5\u4E13\u6CE8\u7684\u65F6\u95F4","Make a little room for one thing."))),o.createElement("span",{className:"pomodoro-entry-symbol","aria-hidden":"true"},o.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"},o.createElement("circle",{cx:"12",cy:"12",r:"9"}),o.createElement("path",{d:"M12 7v5l3 2"})))),o.createElement("div",{className:"ep-row ep-between"},o.createElement("button",{className:"ep-button",onClick:()=>{t.open(g)}},u("\u6253\u5F00\u756A\u8304\u949F","Open Pomodoro")),o.createElement("span",{className:"ep-muted"},z?`${B[m.phase]} \xB7 ${J(F(m,E.now))}${m.status==="paused"?u(" \xB7 \u5DF2\u6682\u505C"," \xB7 Paused"):""}`:u("\u60AC\u6D6E\u5361\u7247 \xB7 \u53EF\u62D6\u62FD","Floating card \xB7 Draggable"))),E.error&&o.createElement("p",{className:"ep-error",role:"alert"},E.error))}let y=`${
|
|
40
|
+
`;var Te=async n=>{let o=n.React,{Frame:l}=G(n,L.id),t=Q(n,L.id,`${O}
|
|
41
|
+
${Y}`);function h(){let b=n.useEnvironment(),g=b.locale,u=(x,r)=>q(g,x,r),E=o.useSyncExternalStore(t.subscribe,t.snapshot),{state:m}=E;o.useEffect(()=>{t.environment(g,b.theme),t.ensure()},[g,b.theme]);let z=m.status!=="idle",B={focus:u("\u4E13\u6CE8","Focus"),short:u("\u77ED\u4F11\u606F","Short break"),long:u("\u957F\u4F11\u606F","Long break")};return o.createElement(l,{className:"pomodoro-entry"},o.createElement("style",null,Y),o.createElement("header",{className:"ep-head"},o.createElement("div",null,o.createElement("div",{className:"ep-kicker"},"FOCUS / ONE THING AT A TIME"),o.createElement("h2",null,u("\u756A\u8304\u949F","Pomodoro")),o.createElement("p",{className:"ep-muted"},u("\u7ED9\u4E00\u4EF6\u4E8B\uFF0C\u4E00\u6BB5\u4E13\u6CE8\u7684\u65F6\u95F4","Make a little room for one thing."))),o.createElement("span",{className:"pomodoro-entry-symbol","aria-hidden":"true"},o.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"},o.createElement("circle",{cx:"12",cy:"12",r:"9"}),o.createElement("path",{d:"M12 7v5l3 2"})))),o.createElement("div",{className:"ep-row ep-between"},o.createElement("button",{className:"ep-button",onClick:()=>{t.open(g)}},u("\u6253\u5F00\u756A\u8304\u949F","Open Pomodoro")),o.createElement("span",{className:"ep-muted"},z?`${B[m.phase]} \xB7 ${J(F(m,E.now))}${m.status==="paused"?u(" \xB7 \u5DF2\u6682\u505C"," \xB7 Paused"):""}`:u("\u60AC\u6D6E\u5361\u7247 \xB7 \u53EF\u62D6\u62FD","Floating card \xB7 Draggable"))),E.error&&o.createElement("p",{className:"ep-error",role:"alert"},E.error))}let y=`${L.id}.entry`,T=`${L.id}.open`;return{manifest:{pluginId:L.id,version:L.version,targets:["web"]},views:[{id:y,pluginId:L.id,title:{zh:"\u756A\u8304\u949F",en:"Pomodoro"},supportedContexts:["home"],render:()=>o.createElement(h,null)}],commands:[{id:T,pluginId:L.id,title:{zh:"\u756A\u8304\u949F",en:"Pomodoro"},supportedContexts:["home","global","document"],execute:b=>(b.signal.throwIfAborted(),t.open(b.locale))}],placements:[{id:`${L.id}.home-entry`,pluginId:L.id,slot:"home.cards",viewId:y},{id:`${L.id}.global-tool`,pluginId:L.id,slot:"global.more",commandId:T},{id:`${L.id}.document-tool`,pluginId:L.id,slot:"document.toolbar",commandId:T}]}};export{Te as default};
|