busybar-kit 2.1.0 → 2.3.0
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/LICENSE +21 -21
- package/README.md +148 -148
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/preview/raster.js +10 -2
- package/dist/preview/raster.js.map +1 -1
- package/dist/profile.d.ts +12 -0
- package/dist/profile.d.ts.map +1 -1
- package/dist/profile.js +44 -2
- package/dist/profile.js.map +1 -1
- package/dist/screen.d.ts +35 -0
- package/dist/screen.d.ts.map +1 -0
- package/dist/screen.js +51 -0
- package/dist/screen.js.map +1 -0
- package/package.json +3 -1
- package/scripts/fix-esm-extensions.mjs +32 -32
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 viirtualp1
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 viirtualp1
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,148 +1,148 @@
|
|
|
1
|
-
# busybar-kit
|
|
2
|
-
|
|
3
|
-
> [!IMPORTANT]
|
|
4
|
-
> **Unofficial community project.** Built and maintained by [@viirtualp1](https://github.com/viirtualp1), **not** an official Flipper Devices / BUSY product, and not affiliated with, endorsed by, or supported by them. "BUSY Bar" remains their trademark. For the real hardware and official apps, visit **[busy.app](https://busy.app/)**.
|
|
5
|
-
|
|
6
|
-
Shared building blocks for [BUSY Bar](https://busy.bar) apps. Everything here is
|
|
7
|
-
app-agnostic: screen geometry, the palette neutrals, formatters, ticker text,
|
|
8
|
-
the Bar's error taxonomy, the connection half of a config, and an offline PNG
|
|
9
|
-
renderer that draws the same elements the device does.
|
|
10
|
-
|
|
11
|
-
It is the common half of [busybar-dota](https://github.com/viirtualp1/busybar-dota),
|
|
12
|
-
[busybar-mydota](https://github.com/viirtualp1/busybar-mydota) and
|
|
13
|
-
[busybar-livesplit](https://github.com/viirtualp1/busybar-livesplit).
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm install busybar-kit
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
`@busy-app/busy-lib` is a peer dependency — the app owns that version.
|
|
20
|
-
|
|
21
|
-
## What is in it
|
|
22
|
-
|
|
23
|
-
| Import | What it gives you |
|
|
24
|
-
| ------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
|
|
25
|
-
| `busybar-kit/device` | `FRONT` / `BACK` screen sizes, `FONT_WIDTH`, `textWidth`, `clipToWidth`, `fittingChars`, `rowY`, `backRowGrid` |
|
|
26
|
-
| `busybar-kit/colors` | `BASE_COLORS` — neutrals, chrome, and the transparent value that hides an element |
|
|
27
|
-
| `busybar-kit/format` | `formatClock`, `formatGold`, `formatCountdown`, `formatStartTime`, `formatKda`, `formatPercent`, … |
|
|
28
|
-
| `busybar-kit/elements` | `AnyElement`, `band()`, `fillWidth()` |
|
|
29
|
-
| `busybar-kit/ticker` | `paginate` / `pageAt` / `scrollAt` / `tickerLine`, and `EventTicker` |
|
|
30
|
-
| `busybar-kit/errors` | `BarApiError`, `toBarError`, `isLowPriority`, `isClientError`, `isForbidden` |
|
|
31
|
-
| `busybar-kit/config` | `loadEnvFile`, `envReader`, `loadBarConfig` |
|
|
32
|
-
| `busybar-kit/image` | `ditherToPanel` — a picture, in the back panel's 16 greys |
|
|
33
|
-
| `busybar-kit/preview` | `renderFront` / `renderBack` / `Bitmap` — device-accurate PNGs with no hardware |
|
|
34
|
-
| `busybar-kit/tsconfig.json`, `busybar-kit/eslint`, `busybar-kit/prettier` | the shared toolchain |
|
|
35
|
-
| `busybar-fix-esm` (bin) | rewrites relative imports in `dist/` to carry `.js`, for Node ESM |
|
|
36
|
-
|
|
37
|
-
## Geometry is hardware, not layout
|
|
38
|
-
|
|
39
|
-
`FRONT` (72×16) and `BACK` (160×80, with its header rows and 12px grid) are
|
|
40
|
-
facts about the device. An app spreads its own named slots on top:
|
|
41
|
-
|
|
42
|
-
```ts
|
|
43
|
-
import { FRONT as DEVICE, BACK as DEVICE_BACK } from 'busybar-kit/device';
|
|
44
|
-
|
|
45
|
-
export const FRONT = {
|
|
46
|
-
...DEVICE,
|
|
47
|
-
topY: 0,
|
|
48
|
-
bottomY: 11,
|
|
49
|
-
clockWidth: 24,
|
|
50
|
-
} as const;
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
An app whose header is a different height lays out its own row grid, and reads
|
|
54
|
-
rows off that instead of the default:
|
|
55
|
-
|
|
56
|
-
```ts
|
|
57
|
-
import { backRowGrid, rowY as gridRowY } from 'busybar-kit/device';
|
|
58
|
-
|
|
59
|
-
export const BACK = { ...DEVICE_BACK, ...backRowGrid(16), nameX: 8 } as const;
|
|
60
|
-
|
|
61
|
-
export const rowY = (index: number) => gridRowY(index, BACK);
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
`clipToWidth` takes the truncation mark as a fourth argument (`'.'` by
|
|
65
|
-
default, `'..'` where names are cut often enough to want the emphasis).
|
|
66
|
-
|
|
67
|
-
Colours work the same way — `BASE_COLORS` holds what every app needs, and the
|
|
68
|
-
app adds its own semantics:
|
|
69
|
-
|
|
70
|
-
```ts
|
|
71
|
-
import { BASE_COLORS } from 'busybar-kit/colors';
|
|
72
|
-
|
|
73
|
-
export const COLORS = {
|
|
74
|
-
...BASE_COLORS,
|
|
75
|
-
radiant: '#3FBF5FFF',
|
|
76
|
-
dire: '#E14B3AFF',
|
|
77
|
-
} as const;
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
## Config
|
|
81
|
-
|
|
82
|
-
`loadBarConfig` resolves which Bar to talk to and over which transport, and
|
|
83
|
-
warns about credentials that transport will ignore. That is all it covers —
|
|
84
|
-
render cadence and request timeouts are the app's own tempo (a speedrun timer
|
|
85
|
-
wants 60ms frames where a match ticker is happy at 200), so they stay in the
|
|
86
|
-
app's config with `DEFAULTS` / `LIMITS` as the values worth starting from.
|
|
87
|
-
|
|
88
|
-
It hands back the same env reader, so an app's own settings collect their
|
|
89
|
-
warnings into one list:
|
|
90
|
-
|
|
91
|
-
```ts
|
|
92
|
-
import { loadBarConfig, loadEnvFile } from 'busybar-kit/config';
|
|
93
|
-
|
|
94
|
-
loadEnvFile();
|
|
95
|
-
|
|
96
|
-
export function loadConfig(env = process.env) {
|
|
97
|
-
const warnings: string[] = [];
|
|
98
|
-
const { bar, env: read } = loadBarConfig(env, warnings);
|
|
99
|
-
|
|
100
|
-
return {
|
|
101
|
-
warnings,
|
|
102
|
-
config: {
|
|
103
|
-
...bar,
|
|
104
|
-
gsiPort: read.number('GSI_PORT', 3080, { min: 1024, max: 65_535 }),
|
|
105
|
-
},
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
## Pictures
|
|
111
|
-
|
|
112
|
-
The back panel has 16 greys and quantises whatever you upload to them, so a
|
|
113
|
-
photo sent as-is comes back in bands. `ditherToPanel` does the quantising here,
|
|
114
|
-
with error diffusion, which leaves every pixel already sitting on a level:
|
|
115
|
-
|
|
116
|
-
```ts
|
|
117
|
-
import { ditherToPanel } from 'busybar-kit/image';
|
|
118
|
-
|
|
119
|
-
const cover = ditherToPanel(decodedRgba); // 80x80 Bitmap, panel-ready
|
|
120
|
-
await bar.AssetsUpload({ application_name: 'app', file: 'art.png', data: cover.toPng() });
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
It takes pixels, not files. Which image decoder to pay for is the app's
|
|
124
|
-
choice — the kit stays dependency-free.
|
|
125
|
-
|
|
126
|
-
`Bitmap.fromRgba` wraps pixels from anywhere, and `bitmap.blit(other, x, y)`
|
|
127
|
-
draws one into another: the raster below cannot follow an image element's path,
|
|
128
|
-
so a preview composites the picture itself.
|
|
129
|
-
|
|
130
|
-
## Preview
|
|
131
|
-
|
|
132
|
-
`renderFront` / `renderBack` rasterise the very element list you send to the
|
|
133
|
-
device — a 3×5 pixel font, the same anchoring rules, and the back panel
|
|
134
|
-
flattened to the 16 greys the real OLED shows. Useful for screenshots in a
|
|
135
|
-
README and for asserting a layout in tests without a Bar on the desk.
|
|
136
|
-
|
|
137
|
-
```ts
|
|
138
|
-
import { renderFront } from 'busybar-kit/preview';
|
|
139
|
-
|
|
140
|
-
writeFileSync('front.png', renderFront(frontElements(frame)).scale(8).toPng());
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
## Scripts
|
|
144
|
-
|
|
145
|
-
```bash
|
|
146
|
-
npm run check # lint + typecheck + test
|
|
147
|
-
npm run build # tsc + .js extension fixup
|
|
148
|
-
```
|
|
1
|
+
# busybar-kit
|
|
2
|
+
|
|
3
|
+
> [!IMPORTANT]
|
|
4
|
+
> **Unofficial community project.** Built and maintained by [@viirtualp1](https://github.com/viirtualp1), **not** an official Flipper Devices / BUSY product, and not affiliated with, endorsed by, or supported by them. "BUSY Bar" remains their trademark. For the real hardware and official apps, visit **[busy.app](https://busy.app/)**.
|
|
5
|
+
|
|
6
|
+
Shared building blocks for [BUSY Bar](https://busy.bar) apps. Everything here is
|
|
7
|
+
app-agnostic: screen geometry, the palette neutrals, formatters, ticker text,
|
|
8
|
+
the Bar's error taxonomy, the connection half of a config, and an offline PNG
|
|
9
|
+
renderer that draws the same elements the device does.
|
|
10
|
+
|
|
11
|
+
It is the common half of [busybar-dota](https://github.com/viirtualp1/busybar-dota),
|
|
12
|
+
[busybar-mydota](https://github.com/viirtualp1/busybar-mydota) and
|
|
13
|
+
[busybar-livesplit](https://github.com/viirtualp1/busybar-livesplit).
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install busybar-kit
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`@busy-app/busy-lib` is a peer dependency — the app owns that version.
|
|
20
|
+
|
|
21
|
+
## What is in it
|
|
22
|
+
|
|
23
|
+
| Import | What it gives you |
|
|
24
|
+
| ------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
|
|
25
|
+
| `busybar-kit/device` | `FRONT` / `BACK` screen sizes, `FONT_WIDTH`, `textWidth`, `clipToWidth`, `fittingChars`, `rowY`, `backRowGrid` |
|
|
26
|
+
| `busybar-kit/colors` | `BASE_COLORS` — neutrals, chrome, and the transparent value that hides an element |
|
|
27
|
+
| `busybar-kit/format` | `formatClock`, `formatGold`, `formatCountdown`, `formatStartTime`, `formatKda`, `formatPercent`, … |
|
|
28
|
+
| `busybar-kit/elements` | `AnyElement`, `band()`, `fillWidth()` |
|
|
29
|
+
| `busybar-kit/ticker` | `paginate` / `pageAt` / `scrollAt` / `tickerLine`, and `EventTicker` |
|
|
30
|
+
| `busybar-kit/errors` | `BarApiError`, `toBarError`, `isLowPriority`, `isClientError`, `isForbidden` |
|
|
31
|
+
| `busybar-kit/config` | `loadEnvFile`, `envReader`, `loadBarConfig` |
|
|
32
|
+
| `busybar-kit/image` | `ditherToPanel` — a picture, in the back panel's 16 greys |
|
|
33
|
+
| `busybar-kit/preview` | `renderFront` / `renderBack` / `Bitmap` — device-accurate PNGs with no hardware |
|
|
34
|
+
| `busybar-kit/tsconfig.json`, `busybar-kit/eslint`, `busybar-kit/prettier` | the shared toolchain |
|
|
35
|
+
| `busybar-fix-esm` (bin) | rewrites relative imports in `dist/` to carry `.js`, for Node ESM |
|
|
36
|
+
|
|
37
|
+
## Geometry is hardware, not layout
|
|
38
|
+
|
|
39
|
+
`FRONT` (72×16) and `BACK` (160×80, with its header rows and 12px grid) are
|
|
40
|
+
facts about the device. An app spreads its own named slots on top:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { FRONT as DEVICE, BACK as DEVICE_BACK } from 'busybar-kit/device';
|
|
44
|
+
|
|
45
|
+
export const FRONT = {
|
|
46
|
+
...DEVICE,
|
|
47
|
+
topY: 0,
|
|
48
|
+
bottomY: 11,
|
|
49
|
+
clockWidth: 24,
|
|
50
|
+
} as const;
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
An app whose header is a different height lays out its own row grid, and reads
|
|
54
|
+
rows off that instead of the default:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import { backRowGrid, rowY as gridRowY } from 'busybar-kit/device';
|
|
58
|
+
|
|
59
|
+
export const BACK = { ...DEVICE_BACK, ...backRowGrid(16), nameX: 8 } as const;
|
|
60
|
+
|
|
61
|
+
export const rowY = (index: number) => gridRowY(index, BACK);
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
`clipToWidth` takes the truncation mark as a fourth argument (`'.'` by
|
|
65
|
+
default, `'..'` where names are cut often enough to want the emphasis).
|
|
66
|
+
|
|
67
|
+
Colours work the same way — `BASE_COLORS` holds what every app needs, and the
|
|
68
|
+
app adds its own semantics:
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
import { BASE_COLORS } from 'busybar-kit/colors';
|
|
72
|
+
|
|
73
|
+
export const COLORS = {
|
|
74
|
+
...BASE_COLORS,
|
|
75
|
+
radiant: '#3FBF5FFF',
|
|
76
|
+
dire: '#E14B3AFF',
|
|
77
|
+
} as const;
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Config
|
|
81
|
+
|
|
82
|
+
`loadBarConfig` resolves which Bar to talk to and over which transport, and
|
|
83
|
+
warns about credentials that transport will ignore. That is all it covers —
|
|
84
|
+
render cadence and request timeouts are the app's own tempo (a speedrun timer
|
|
85
|
+
wants 60ms frames where a match ticker is happy at 200), so they stay in the
|
|
86
|
+
app's config with `DEFAULTS` / `LIMITS` as the values worth starting from.
|
|
87
|
+
|
|
88
|
+
It hands back the same env reader, so an app's own settings collect their
|
|
89
|
+
warnings into one list:
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
import { loadBarConfig, loadEnvFile } from 'busybar-kit/config';
|
|
93
|
+
|
|
94
|
+
loadEnvFile();
|
|
95
|
+
|
|
96
|
+
export function loadConfig(env = process.env) {
|
|
97
|
+
const warnings: string[] = [];
|
|
98
|
+
const { bar, env: read } = loadBarConfig(env, warnings);
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
warnings,
|
|
102
|
+
config: {
|
|
103
|
+
...bar,
|
|
104
|
+
gsiPort: read.number('GSI_PORT', 3080, { min: 1024, max: 65_535 }),
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Pictures
|
|
111
|
+
|
|
112
|
+
The back panel has 16 greys and quantises whatever you upload to them, so a
|
|
113
|
+
photo sent as-is comes back in bands. `ditherToPanel` does the quantising here,
|
|
114
|
+
with error diffusion, which leaves every pixel already sitting on a level:
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
import { ditherToPanel } from 'busybar-kit/image';
|
|
118
|
+
|
|
119
|
+
const cover = ditherToPanel(decodedRgba); // 80x80 Bitmap, panel-ready
|
|
120
|
+
await bar.AssetsUpload({ application_name: 'app', file: 'art.png', data: cover.toPng() });
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
It takes pixels, not files. Which image decoder to pay for is the app's
|
|
124
|
+
choice — the kit stays dependency-free.
|
|
125
|
+
|
|
126
|
+
`Bitmap.fromRgba` wraps pixels from anywhere, and `bitmap.blit(other, x, y)`
|
|
127
|
+
draws one into another: the raster below cannot follow an image element's path,
|
|
128
|
+
so a preview composites the picture itself.
|
|
129
|
+
|
|
130
|
+
## Preview
|
|
131
|
+
|
|
132
|
+
`renderFront` / `renderBack` rasterise the very element list you send to the
|
|
133
|
+
device — a 3×5 pixel font, the same anchoring rules, and the back panel
|
|
134
|
+
flattened to the 16 greys the real OLED shows. Useful for screenshots in a
|
|
135
|
+
README and for asserting a layout in tests without a Bar on the desk.
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
import { renderFront } from 'busybar-kit/preview';
|
|
139
|
+
|
|
140
|
+
writeFileSync('front.png', renderFront(frontElements(frame)).scale(8).toPng());
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Scripts
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
npm run check # lint + typecheck + test
|
|
147
|
+
npm run build # tsc + .js extension fixup
|
|
148
|
+
```
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
|
package/dist/preview/raster.js
CHANGED
|
@@ -95,8 +95,16 @@ function within(column, row, width, height, radius) {
|
|
|
95
95
|
return true;
|
|
96
96
|
}
|
|
97
97
|
// Only the four corner squares are curved; everything else is a rectangle.
|
|
98
|
-
const dx = column < radius
|
|
99
|
-
|
|
98
|
+
const dx = column < radius
|
|
99
|
+
? radius - column
|
|
100
|
+
: column >= width - radius
|
|
101
|
+
? column - (width - radius) + 1
|
|
102
|
+
: 0;
|
|
103
|
+
const dy = row < radius
|
|
104
|
+
? radius - row
|
|
105
|
+
: row >= height - radius
|
|
106
|
+
? row - (height - radius) + 1
|
|
107
|
+
: 0;
|
|
100
108
|
if (dx === 0 || dy === 0) {
|
|
101
109
|
return true;
|
|
102
110
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"raster.js","sourceRoot":"","sources":["../../src/preview/raster.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,UAAU,EAAa,MAAM,OAAO,CAAC;AAItD,MAAM,SAAS,GAAS,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;AAExD,MAAM,UAAU,WAAW,CAAC,QAAsB;IAChD,OAAO,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACrE,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,QAAsB;IAC/C,OAAO,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACjE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CACxB,MAAc,EACd,QAAsB,EACtB,OAAyB;IAEzB,OAAO,QAAQ,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,EAAE,CAAC,GAAG,GAAG,GAAG,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,MAAM,CACb,KAAyB,EACzB,CAAqB,EACrB,CAAqB,EACrB,KAAa,EACb,MAAc;IAEd,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;IACpB,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;IACnB,IAAI,KAAK,KAAK,WAAW,EAAE,CAAC;QAC1B,OAAO,EAAE,CAAC,EAAE,IAAI,GAAG,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;IACrC,CAAC;IAED,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,EAAE,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;IACrD,CAAC;IAED,IAAI,KAAK,KAAK,UAAU,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC;IACtD,CAAC;IAED,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;AAC7B,CAAC"}
|
package/dist/profile.d.ts
CHANGED
|
@@ -22,11 +22,23 @@ export type ProfileResolver = {
|
|
|
22
22
|
cwdFor: (name: string) => string;
|
|
23
23
|
/** The bin an app package installed into this profile, if it is there. */
|
|
24
24
|
binFor: (name: string) => string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* The script that bin runs, so the app can be started with node directly.
|
|
27
|
+
*
|
|
28
|
+
* On Windows the bin is a .cmd shim, which only runs through a shell, and a
|
|
29
|
+
* shell in between means the pid a supervisor holds is cmd.exe rather than
|
|
30
|
+
* the app. Stopping that does not reliably reach the app beneath it — which
|
|
31
|
+
* is how a stopped daemon leaves mydota holding its port. The script is what
|
|
32
|
+
* the shim runs anyway; running it directly leaves nothing in between.
|
|
33
|
+
*/
|
|
34
|
+
entryFor: (name: string) => string | undefined;
|
|
25
35
|
};
|
|
26
36
|
export type ProfileOptions = {
|
|
27
37
|
/** Injected by the tests, which have no profile on disk. */
|
|
28
38
|
exists?: (path: string) => boolean;
|
|
29
39
|
platform?: NodeJS.Platform;
|
|
40
|
+
/** Injected by the tests, which have no packages on disk. */
|
|
41
|
+
readJson?: (path: string) => unknown;
|
|
30
42
|
};
|
|
31
43
|
export declare function profileAt(dir: string, options?: ProfileOptions): ProfileResolver;
|
|
32
44
|
/**
|
package/dist/profile.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../src/profile.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,4BAA4B;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,oDAAoD;IACpD,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACjC,0EAA0E;IAC1E,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../src/profile.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,4BAA4B;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,oDAAoD;IACpD,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACjC,0EAA0E;IAC1E,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC7C;;;;;;;;OAQG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,4DAA4D;IAC5D,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC3B,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CACtC,CAAC;AAEF,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,eAAe,CAyCpF;AAWD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,YAW/E"}
|
package/dist/profile.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { existsSync, mkdirSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { isAbsolute, join, relative, resolve } from 'node:path';
|
|
3
3
|
export function profileAt(dir, options = {}) {
|
|
4
4
|
const exists = options.exists ?? existsSync;
|
|
5
5
|
const platform = options.platform ?? process.platform;
|
|
6
|
+
const readJson = options.readJson ?? readJsonFile;
|
|
6
7
|
// npm writes a `.cmd` shim on Windows; the supervisor already knows to run
|
|
7
8
|
// those through a shell, which is why the extension is kept here.
|
|
8
9
|
const suffix = platform === 'win32' ? '.cmd' : '';
|
|
@@ -18,6 +19,23 @@ export function profileAt(dir, options = {}) {
|
|
|
18
19
|
}
|
|
19
20
|
return undefined;
|
|
20
21
|
},
|
|
22
|
+
entryFor: (name) => {
|
|
23
|
+
for (const candidate of binNames(name)) {
|
|
24
|
+
const pkgDir = join(dir, 'node_modules', candidate);
|
|
25
|
+
const script = binScript(readJson(join(pkgDir, 'package.json')), candidate);
|
|
26
|
+
if (!script) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
const path = resolve(pkgDir, script);
|
|
30
|
+
const inside = relative(pkgDir, path);
|
|
31
|
+
// A bin that climbs out of its own package is not one to run.
|
|
32
|
+
if (inside.startsWith('..') || isAbsolute(inside)) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
return path;
|
|
36
|
+
}
|
|
37
|
+
return undefined;
|
|
38
|
+
},
|
|
21
39
|
};
|
|
22
40
|
}
|
|
23
41
|
/**
|
|
@@ -44,4 +62,28 @@ export function ensureAppDirs(profile, names) {
|
|
|
44
62
|
}
|
|
45
63
|
return created;
|
|
46
64
|
}
|
|
65
|
+
function readJsonFile(path) {
|
|
66
|
+
try {
|
|
67
|
+
return JSON.parse(readFileSync(path, 'utf8'));
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The script a package's bin runs. npm allows the bin field to be a single
|
|
75
|
+
* path, which is then named after the package, or a map of names to paths.
|
|
76
|
+
*/
|
|
77
|
+
function binScript(manifest, binName) {
|
|
78
|
+
if (typeof manifest !== 'object' || manifest === null) {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
const bin = manifest.bin;
|
|
82
|
+
const script = typeof bin === 'string'
|
|
83
|
+
? bin
|
|
84
|
+
: typeof bin === 'object' && bin !== null
|
|
85
|
+
? bin[binName]
|
|
86
|
+
: undefined;
|
|
87
|
+
return typeof script === 'string' && script.trim() ? script : undefined;
|
|
88
|
+
}
|
|
47
89
|
//# sourceMappingURL=profile.js.map
|
package/dist/profile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../src/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"profile.js","sourceRoot":"","sources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AAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAS,SAAS,CAAC,QAAiB,EAAE,OAAe;IACnD,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,GAAG,GAAI,QAA8B,CAAC,GAAG,CAAC;IAChD,MAAM,MAAM,GACV,OAAO,GAAG,KAAK,QAAQ;QACrB,CAAC,CAAC,GAAG;QACL,CAAC,CAAC,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI;YACvC,CAAC,CAAE,GAA+B,CAAC,OAAO,CAAC;YAC3C,CAAC,CAAC,SAAS,CAAC;IAElB,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AAC1E,CAAC"}
|
package/dist/screen.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Bitmap } from './preview/png.js';
|
|
2
|
+
/**
|
|
3
|
+
* A photograph of a panel, as the device actually sends it.
|
|
4
|
+
*
|
|
5
|
+
* `GET /screen?display=0|1` is documented as `image/bmp`, and it is not: the
|
|
6
|
+
* body is base64 text, and what it decodes to is raw pixels with no header of
|
|
7
|
+
* any kind. Handing that to an `<img>` gets you a broken image icon, which is
|
|
8
|
+
* how this came to be written down.
|
|
9
|
+
*
|
|
10
|
+
* The two panels are not the same picture, either:
|
|
11
|
+
*
|
|
12
|
+
* - **front**, 72×16, three bytes a pixel — **BGR**, no alpha and no padding.
|
|
13
|
+
* Read as RGB it looks almost right, which is the trap: only reds and blues
|
|
14
|
+
* swap, so a photograph passes and a red progress bar comes out blue.
|
|
15
|
+
* - **back**, 160×80, half a byte a pixel — four bits of grey, **low nibble
|
|
16
|
+
* first**, which is the sixteen levels the panel actually has.
|
|
17
|
+
*
|
|
18
|
+
* Both orders are the ones busy-lib converts from in `bgrToRgba` and
|
|
19
|
+
* `convertL4toRGBA`; they are not guesses.
|
|
20
|
+
*/
|
|
21
|
+
export type Display = 0 | 1;
|
|
22
|
+
export declare const SCREEN: {
|
|
23
|
+
readonly 0: {
|
|
24
|
+
readonly width: 72;
|
|
25
|
+
readonly height: 16;
|
|
26
|
+
readonly bytes: number;
|
|
27
|
+
};
|
|
28
|
+
readonly 1: {
|
|
29
|
+
readonly width: 160;
|
|
30
|
+
readonly height: 80;
|
|
31
|
+
readonly bytes: number;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export declare function decodeScreenFrame(payload: string | Buffer, display: Display): Bitmap;
|
|
35
|
+
//# sourceMappingURL=screen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screen.d.ts","sourceRoot":"","sources":["../src/screen.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;AAE5B,eAAO,MAAM,MAAM;;;;;;;;;;;CAGmE,CAAC;AAMvF,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAWpF"}
|
package/dist/screen.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { BACK, FRONT } from './device.js';
|
|
2
|
+
import { Bitmap } from './preview/png.js';
|
|
3
|
+
export const SCREEN = {
|
|
4
|
+
0: { width: FRONT.width, height: FRONT.height, bytes: FRONT.width * FRONT.height * 3 },
|
|
5
|
+
1: { width: BACK.width, height: BACK.height, bytes: (BACK.width * BACK.height) / 2 },
|
|
6
|
+
};
|
|
7
|
+
/** Grey levels the back panel has, and the step between them at eight bits. */
|
|
8
|
+
const BACK_LEVELS = 16;
|
|
9
|
+
const BACK_STEP = 255 / (BACK_LEVELS - 1);
|
|
10
|
+
export function decodeScreenFrame(payload, display) {
|
|
11
|
+
const bytes = typeof payload === 'string' ? Buffer.from(payload, 'base64') : payload;
|
|
12
|
+
const panel = SCREEN[display];
|
|
13
|
+
if (bytes.length < panel.bytes) {
|
|
14
|
+
throw new Error(`screen ${display} came back ${bytes.length} bytes short of the ${panel.bytes} a ${panel.width}×${panel.height} frame needs`);
|
|
15
|
+
}
|
|
16
|
+
return display === 0 ? front(bytes) : back(bytes);
|
|
17
|
+
}
|
|
18
|
+
function front(bytes) {
|
|
19
|
+
const { width, height } = SCREEN[0];
|
|
20
|
+
const bitmap = new Bitmap(width, height);
|
|
21
|
+
for (let pixel = 0; pixel < width * height; pixel += 1) {
|
|
22
|
+
const offset = pixel * 3;
|
|
23
|
+
bitmap.set(pixel % width, Math.floor(pixel / width), {
|
|
24
|
+
r: bytes[offset + 2] ?? 0,
|
|
25
|
+
g: bytes[offset + 1] ?? 0,
|
|
26
|
+
b: bytes[offset] ?? 0,
|
|
27
|
+
a: 255,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return bitmap;
|
|
31
|
+
}
|
|
32
|
+
function back(bytes) {
|
|
33
|
+
const { width, height } = SCREEN[1];
|
|
34
|
+
const bitmap = new Bitmap(width, height);
|
|
35
|
+
for (let pixel = 0; pixel < width * height; pixel += 1) {
|
|
36
|
+
const byte = bytes[pixel >> 1] ?? 0;
|
|
37
|
+
// Two pixels to a byte, the left-hand one in the LOW nibble. The other way
|
|
38
|
+
// round swaps every neighbouring pair, which leaves photographs looking
|
|
39
|
+
// fine and text looking shredded.
|
|
40
|
+
const level = pixel % 2 === 0 ? byte & 0xf : (byte >> 4) & 0xf;
|
|
41
|
+
const value = Math.round(level * BACK_STEP);
|
|
42
|
+
bitmap.set(pixel % width, Math.floor(pixel / width), {
|
|
43
|
+
r: value,
|
|
44
|
+
g: value,
|
|
45
|
+
b: value,
|
|
46
|
+
a: 255,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return bitmap;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=screen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screen.js","sourceRoot":"","sources":["../src/screen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAuBvC,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;IACtF,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;CACA,CAAC;AAEvF,+EAA+E;AAC/E,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,SAAS,GAAG,GAAG,GAAG,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC;AAE1C,MAAM,UAAU,iBAAiB,CAAC,OAAwB,EAAE,OAAgB;IAC1E,MAAM,KAAK,GAAG,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IACrF,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAE9B,IAAI,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,K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IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACvD,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QACpC,2EAA2E;QAC3E,wEAAwE;QACxE,kCAAkC;QAClC,MAAM,KAAK,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;QAC/D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;QAC5C,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,EAAE;YACnD,CAAC,EAAE,KAAK;YACR,CAAC,EAAE,KAAK;YACR,CAAC,EAAE,KAAK;YACR,CAAC,EAAE,GAAG;SACP,CAAC,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "busybar-kit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Shared building blocks for BUSY Bar apps: device geometry, colours, formatters, ticker text, error taxonomy and an offline PNG preview renderer",
|
|
5
5
|
"author": "viirtualp1",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"./input": "./dist/input/index.js",
|
|
31
31
|
"./preview": "./dist/preview/index.js",
|
|
32
32
|
"./profile": "./dist/profile.js",
|
|
33
|
+
"./screen": "./dist/screen.js",
|
|
33
34
|
"./ticker": "./dist/ticker/index.js",
|
|
34
35
|
"./tsconfig.json": "./configs/tsconfig.base.json",
|
|
35
36
|
"./eslint": "./configs/eslint.config.js",
|
|
@@ -60,6 +61,7 @@
|
|
|
60
61
|
"scripts": {
|
|
61
62
|
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
62
63
|
"build": "npm run clean && tsc -p tsconfig.build.json && node scripts/fix-esm-extensions.mjs",
|
|
64
|
+
"prepack": "npm run build",
|
|
63
65
|
"typecheck": "tsc -p tsconfig.json",
|
|
64
66
|
"lint": "eslint .",
|
|
65
67
|
"lint:fix": "eslint . --fix",
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
|
|
3
|
-
import { isAbsolute, join, resolve } from 'node:path';
|
|
4
|
-
|
|
5
|
-
// Node's ESM loader wants a real file name; tsc leaves extensionless specifiers.
|
|
6
|
-
const argument = process.argv[2] ?? 'dist';
|
|
7
|
-
const dist = isAbsolute(argument) ? argument : resolve(process.cwd(), argument);
|
|
8
|
-
const EXTENSIONS = /\.(?:js|json|mjs|cjs|node)$/;
|
|
9
|
-
|
|
10
|
-
function walk(dir) {
|
|
11
|
-
for (const name of readdirSync(dir)) {
|
|
12
|
-
const path = join(dir, name);
|
|
13
|
-
if (statSync(path).isDirectory()) {
|
|
14
|
-
walk(path);
|
|
15
|
-
continue;
|
|
16
|
-
}
|
|
17
|
-
if (!/\.(?:js|d\.ts)$/.test(name)) {
|
|
18
|
-
continue;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const source = readFileSync(path, 'utf8');
|
|
22
|
-
const next = source.replace(
|
|
23
|
-
/(from\s+|import\s*\()(['"])(\.[^'"]+)\2/g,
|
|
24
|
-
(match, prefix, quote, spec) =>
|
|
25
|
-
EXTENSIONS.test(spec) ? match : `${prefix}${quote}${spec}.js${quote}`,
|
|
26
|
-
);
|
|
27
|
-
if (next !== source) {
|
|
28
|
-
writeFileSync(path, next);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
walk(dist);
|
|
2
|
+
import { readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { isAbsolute, join, resolve } from 'node:path';
|
|
4
|
+
|
|
5
|
+
// Node's ESM loader wants a real file name; tsc leaves extensionless specifiers.
|
|
6
|
+
const argument = process.argv[2] ?? 'dist';
|
|
7
|
+
const dist = isAbsolute(argument) ? argument : resolve(process.cwd(), argument);
|
|
8
|
+
const EXTENSIONS = /\.(?:js|json|mjs|cjs|node)$/;
|
|
9
|
+
|
|
10
|
+
function walk(dir) {
|
|
11
|
+
for (const name of readdirSync(dir)) {
|
|
12
|
+
const path = join(dir, name);
|
|
13
|
+
if (statSync(path).isDirectory()) {
|
|
14
|
+
walk(path);
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
if (!/\.(?:js|d\.ts)$/.test(name)) {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const source = readFileSync(path, 'utf8');
|
|
22
|
+
const next = source.replace(
|
|
23
|
+
/(from\s+|import\s*\()(['"])(\.[^'"]+)\2/g,
|
|
24
|
+
(match, prefix, quote, spec) =>
|
|
25
|
+
EXTENSIONS.test(spec) ? match : `${prefix}${quote}${spec}.js${quote}`,
|
|
26
|
+
);
|
|
27
|
+
if (next !== source) {
|
|
28
|
+
writeFileSync(path, next);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
walk(dist);
|