@showlotus/open-scriptable 0.1.2 → 0.1.4
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 -3
- package/dist/count-down.js +1 -1
- package/package.json +1 -1
- package/scriptable.d.ts +64 -30
package/README.md
CHANGED
|
@@ -45,9 +45,8 @@ eval(code);
|
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
<div>
|
|
48
|
-
<img src="./res/count-down/
|
|
49
|
-
<img src="./res/count-down/
|
|
50
|
-
<img src="./res/count-down/large.png" alt="large" width="300">
|
|
48
|
+
<img src="./res/count-down/light.png" alt="light" width="300">
|
|
49
|
+
<img src="./res/count-down/dark.png" alt="dark" width="300">
|
|
51
50
|
</div>
|
|
52
51
|
|
|
53
52
|
## 开发
|
package/dist/count-down.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const t=config.widgetFamily||"small",
|
|
1
|
+
const t=config.widgetFamily||"small",o={small:3,medium:3,large:7}[t]||3;const e=new ListWidget;e.backgroundColor=Color.dynamic(new Color("#FFFFFF"),new Color("#1c1c1c")),e.spacing=8;const n=(globalConfig.days||[]).sort((t,o)=>t.date>o.date?1:-1).slice(0,o);if(n.length<o)for(let a=n.length;a<o;a++)n.push({name:" ",date:""});if(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.systemFont(16),i.textColor=Color.dynamic(new Color("#000000"),new Color("#FFFFFF"));const c=r.addStack();c.layoutHorizontally(),c.spacing=2;const s=function(t){const[o,e,n]=t.split("-");return o&&e&&n?new Date(parseInt(o),parseInt(e)-1,parseInt(n)):null}(o.date),g=c.addText(s?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}`}`}(s):" ");g.font=Font.regularRoundedSystemFont(9),g.textColor=Color.dynamic(new Color("#979797"),new Color("#8e8e8e")),l.addSpacer();const m=l.addStack();m.layoutHorizontally(),m.bottomAlignContent(),m.spacing=2;const F=s?function(t){const o=new Date;if(t<o){const e=o.getTime()-t.getTime();return-Math.ceil(e/864e5)}const e=t.getTime()-o.getTime();return Math.ceil(e/864e5)}(s):" ",u=m.addStack();u.spacing=2,u.topAlignContent();const C=u.addText(F.toString());C.font=Font.boldRoundedSystemFont(22),C.textColor=Color.dynamic(new Color("#000000"),new Color("#FFFFFF")),C.rightAlignText();const y=m.addStack();y.setPadding(0,0,4,0);const p=y.addText("天");if(p.font=Font.boldRoundedSystemFont(10),p.textColor=Color.dynamic(new Color("#979797"),new Color("#8e8e8e")),p.rightAlignText(),a<n.length-1){const o=e.addStack();o.layoutHorizontally(),o.setPadding(0,0,0,0),o.size=new Size("small"===t?126:306,1),o.borderWidth=1,o.borderColor=Color.dynamic(new Color("#E5E5E5"),new Color("#333333")),o.cornerRadius=1}}),config.runsInWidget)Script.setWidget(e);else switch(args.widgetParameter){case"large":e.presentLarge();break;case"medium":e.presentMedium();break;default:e.presentSmall()}Script.complete();
|
package/package.json
CHANGED
package/scriptable.d.ts
CHANGED
|
@@ -7,36 +7,9 @@ declare global {
|
|
|
7
7
|
* 字体类
|
|
8
8
|
*/
|
|
9
9
|
class Font {
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
static italicSystemFont(size: number): Font;
|
|
14
|
-
/** 细体系统字体 */
|
|
15
|
-
static lightSystemFont(size: number): Font;
|
|
16
|
-
/** 中等系统字体 */
|
|
17
|
-
static mediumSystemFont(size: number): Font;
|
|
18
|
-
/** 常规系统字体 */
|
|
19
|
-
static regularSystemFont(size: number): Font;
|
|
20
|
-
/** 半粗体系统字体 */
|
|
21
|
-
static semiboldSystemFont(size: number): Font;
|
|
22
|
-
/** 系统字体 */
|
|
23
|
-
static systemFont(size: number): Font;
|
|
24
|
-
/** 超细系统字体 */
|
|
25
|
-
static ultraLightSystemFont(size: number): Font;
|
|
26
|
-
/** 极细系统字体 */
|
|
27
|
-
static thinSystemFont(size: number): Font;
|
|
28
|
-
/** 重磅系统字体 */
|
|
29
|
-
static heavySystemFont(size: number): Font;
|
|
30
|
-
/** 黑色系统字体 */
|
|
31
|
-
static blackSystemFont(size: number): Font;
|
|
32
|
-
/** 等宽系统字体 */
|
|
33
|
-
static monospacedSystemFont(size: number, weight: number): Font;
|
|
34
|
-
/** 等宽数字系统字体 */
|
|
35
|
-
static monospacedDigitSystemFont(size: number, weight: number): Font;
|
|
36
|
-
/** 圆角系统字体 */
|
|
37
|
-
static roundedSystemFont(size: number, weight: number): Font;
|
|
38
|
-
/** 自定义字体 */
|
|
39
|
-
static custom(name: string, size: number): Font;
|
|
10
|
+
/** 构造函数,创建自定义字体 */
|
|
11
|
+
constructor(name: string, size: number);
|
|
12
|
+
|
|
40
13
|
/** 大标题字体 */
|
|
41
14
|
static largeTitle(): Font;
|
|
42
15
|
/** 标题 1 字体 */
|
|
@@ -59,6 +32,67 @@ declare global {
|
|
|
59
32
|
static caption1(): Font;
|
|
60
33
|
/** 说明 2 字体 */
|
|
61
34
|
static caption2(): Font;
|
|
35
|
+
|
|
36
|
+
/** 系统字体 */
|
|
37
|
+
static systemFont(size: number): Font;
|
|
38
|
+
/** 超细系统字体 */
|
|
39
|
+
static ultraLightSystemFont(size: number): Font;
|
|
40
|
+
/** 极细系统字体 */
|
|
41
|
+
static thinSystemFont(size: number): Font;
|
|
42
|
+
/** 细体系统字体 */
|
|
43
|
+
static lightSystemFont(size: number): Font;
|
|
44
|
+
/** 常规系统字体 */
|
|
45
|
+
static regularSystemFont(size: number): Font;
|
|
46
|
+
/** 中等系统字体 */
|
|
47
|
+
static mediumSystemFont(size: number): Font;
|
|
48
|
+
/** 半粗体系统字体 */
|
|
49
|
+
static semiboldSystemFont(size: number): Font;
|
|
50
|
+
/** 粗体系统字体 */
|
|
51
|
+
static boldSystemFont(size: number): Font;
|
|
52
|
+
/** 重磅系统字体 */
|
|
53
|
+
static heavySystemFont(size: number): Font;
|
|
54
|
+
/** 黑色系统字体 */
|
|
55
|
+
static blackSystemFont(size: number): Font;
|
|
56
|
+
/** 斜体系统字体 */
|
|
57
|
+
static italicSystemFont(size: number): Font;
|
|
58
|
+
|
|
59
|
+
/** 超细等宽系统字体 */
|
|
60
|
+
static ultraLightMonospacedSystemFont(size: number): Font;
|
|
61
|
+
/** 极细等宽系统字体 */
|
|
62
|
+
static thinMonospacedSystemFont(size: number): Font;
|
|
63
|
+
/** 细体等宽系统字体 */
|
|
64
|
+
static lightMonospacedSystemFont(size: number): Font;
|
|
65
|
+
/** 常规等宽系统字体 */
|
|
66
|
+
static regularMonospacedSystemFont(size: number): Font;
|
|
67
|
+
/** 中等等宽系统字体 */
|
|
68
|
+
static mediumMonospacedSystemFont(size: number): Font;
|
|
69
|
+
/** 半粗体等宽系统字体 */
|
|
70
|
+
static semiboldMonospacedSystemFont(size: number): Font;
|
|
71
|
+
/** 粗体等宽系统字体 */
|
|
72
|
+
static boldMonospacedSystemFont(size: number): Font;
|
|
73
|
+
/** 重磅等宽系统字体 */
|
|
74
|
+
static heavyMonospacedSystemFont(size: number): Font;
|
|
75
|
+
/** 黑色等宽系统字体 */
|
|
76
|
+
static blackMonospacedSystemFont(size: number): Font;
|
|
77
|
+
|
|
78
|
+
/** 超细圆角系统字体 */
|
|
79
|
+
static ultraLightRoundedSystemFont(size: number): Font;
|
|
80
|
+
/** 极细圆角系统字体 */
|
|
81
|
+
static thinRoundedSystemFont(size: number): Font;
|
|
82
|
+
/** 细体圆角系统字体 */
|
|
83
|
+
static lightRoundedSystemFont(size: number): Font;
|
|
84
|
+
/** 常规圆角系统字体 */
|
|
85
|
+
static regularRoundedSystemFont(size: number): Font;
|
|
86
|
+
/** 中等圆角系统字体 */
|
|
87
|
+
static mediumRoundedSystemFont(size: number): Font;
|
|
88
|
+
/** 半粗体圆角系统字体 */
|
|
89
|
+
static semiboldRoundedSystemFont(size: number): Font;
|
|
90
|
+
/** 粗体圆角系统字体 */
|
|
91
|
+
static boldRoundedSystemFont(size: number): Font;
|
|
92
|
+
/** 重磅圆角系统字体 */
|
|
93
|
+
static heavyRoundedSystemFont(size: number): Font;
|
|
94
|
+
/** 黑色圆角系统字体 */
|
|
95
|
+
static blackRoundedSystemFont(size: number): Font;
|
|
62
96
|
}
|
|
63
97
|
|
|
64
98
|
/**
|