@showlotus/open-scriptable 0.1.8 → 0.1.10
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 +8 -1
- package/dist/count-down.js +1 -1
- package/package.json +1 -1
- package/scriptable.d.ts +3 -1
package/README.md
CHANGED
|
@@ -39,11 +39,18 @@ const code = await new Request(url).loadString();
|
|
|
39
39
|
eval(code);
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
<div>
|
|
42
|
+
<!-- <div>
|
|
43
43
|
<img src="./res/count-down/light.jpeg" alt="light" width="300">
|
|
44
44
|
<img src="./res/count-down/dark.jpeg" alt="dark" width="300">
|
|
45
|
+
</div> -->
|
|
46
|
+
|
|
47
|
+
<div>
|
|
48
|
+
<img src="./res/count-down/light-v2.jpeg" alt="light" width="300">
|
|
49
|
+
<img src="./res/count-down/dark-v2.jpeg" alt="dark" width="300">
|
|
45
50
|
</div>
|
|
46
51
|
|
|
52
|
+
### 月度消费组件
|
|
53
|
+
|
|
47
54
|
## 开发
|
|
48
55
|
|
|
49
56
|
```bash
|
package/dist/count-down.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
let t;t=config.runsInWidget
|
|
1
|
+
let t;t=config.runsInWidget&&config.widgetFamily||"small";const o={small:3,medium:3,large:7}[t];const e=new ListWidget;e.useDefaultPadding(),e.backgroundColor=Color.dynamic(new Color("#FFFFFF"),new Color("#1c1c1c")),e.spacing=8;const n=Object.entries(__GLOBAL_CONFIG__.days||{}).map(([t,o])=>({name:t,date:o})).sort((t,o)=>t.date>o.date?1:-1).filter(t=>{const[o,e,n]=t.date.split("-").map(Number),a=new Date;return o>a.getFullYear()||o===a.getFullYear()&&(e>a.getMonth()+1||e===a.getMonth()+1&&n>=a.getDate())}).slice(0,o);if(n.length<o)for(let a=n.length;a<o;a++)n.push({name:"",date:"",isEmpty:!0});n.forEach((o,a)=>{const l=e.addStack();l.layoutHorizontally();const r=l.addStack();r.layoutVertically(),r.spacing=1;const d=r.addStack();d.layoutHorizontally(),d.spacing=2;const i=d.addText(o.name);i.font=Font.mediumRoundedSystemFont(14),i.textColor=Color.dynamic(new Color("#000000"),new Color("#FFFFFF"));const s=r.addStack();s.layoutHorizontally(),s.spacing=2;const c=o.isEmpty?null:function(t){try{const[o,e,n]=t.split("-").map(Number);return new Date(o,e-1,n)}catch(o){return null}}(o.date),g=s.addText(o.isEmpty?" ":function(o){const e=["周日","周一","周二","周三","周四","周五","周六"][o.getDay()],n=(o.getMonth()+1).toString().padStart(2,"0"),a=o.getDate().toString().padStart(2,"0");return`${o.getFullYear()}/${n}/${a}${"small"===t?"":`, ${e}`}`}(c));g.font=Font.regularRoundedSystemFont(10),g.textColor=Color.dynamic(new Color("#979797"),new Color("#8e8e8e")),l.addSpacer();const m=l.addStack();m.layoutHorizontally(),m.bottomAlignContent(),m.spacing=2;const u=o.isEmpty?" ":function(t){const o=new Date;o.setHours(0,0,0,0);const e=t.getTime()-o.getTime();return Math.floor(e/864e5)}(c),F=m.addStack();F.spacing=2,F.topAlignContent();const y=F.addText(u.toString());y.font=Font.mediumRoundedSystemFont(24),y.textColor=Color.dynamic(new Color("#000000"),new Color("#FFFFFF")),y.rightAlignText();const p=m.addStack();if(p.setPadding(0,0,4,0),!o.isEmpty){const t=p.addText("天");t.font=Font.boldRoundedSystemFont(10),t.textColor=Color.dynamic(new Color("#979797"),new Color("#8e8e8e")),t.rightAlignText()}if(a<n.length-1){const n=e.addStack();n.layoutHorizontally(),n.setPadding(0,0,0,0),n.size=new Size("small"===t?126:306,1),n.borderWidth=1,n.borderColor=o.isEmpty?new Color("#FFFFFF",0):Color.dynamic(new Color("#E5E5E5"),new Color("#333333")),n.cornerRadius=1}}),config.runsInWidget?Script.setWidget(e):config.runsInApp&&("small"===t?e.presentSmall():"medium"===t?e.presentMedium():"large"===t&&e.presentLarge()),Script.complete();
|
package/package.json
CHANGED
package/scriptable.d.ts
CHANGED
|
@@ -837,7 +837,7 @@ declare global {
|
|
|
837
837
|
/** 缩放因子 */
|
|
838
838
|
respectScreenScale: boolean;
|
|
839
839
|
|
|
840
|
-
constructor(
|
|
840
|
+
constructor();
|
|
841
841
|
|
|
842
842
|
/** 获取图像 */
|
|
843
843
|
getImage(): Image;
|
|
@@ -853,6 +853,8 @@ declare global {
|
|
|
853
853
|
setLineWidth(width: number): void;
|
|
854
854
|
/** 填充矩形 */
|
|
855
855
|
fill(rect: Rect): void;
|
|
856
|
+
/** 填充矩形 */
|
|
857
|
+
fillRect(rect: Rect): void;
|
|
856
858
|
/** 填充椭圆 */
|
|
857
859
|
fillEllipse(rect: Rect): void;
|
|
858
860
|
/** 描边矩形 */
|