iqc-maker 0.0.0-stage → 1.0.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/CHANGELOG.md +48 -0
- package/LICENSE +25 -0
- package/README.md +641 -2
- package/index.d.ts +222 -0
- package/index.mjs +21 -0
- package/package.json +68 -4
- package/src/assets.js +179 -0
- package/src/constants.js +109 -0
- package/src/icons.js +79 -0
- package/src/index.js +130 -0
- package/src/render.js +787 -0
- package/src/themes.js +292 -0
- package/src/utils.js +60 -0
package/README.md
CHANGED
|
@@ -1,3 +1,642 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<img src="https://raw.githubusercontent.com/its-dinda/image/main/1796010343636.jpeg" alt="iqc-maker" width="100%" style="aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px;" />
|
|
4
|
+
|
|
5
|
+
# iqc-maker
|
|
6
|
+
|
|
7
|
+
**Generator fake chat WhatsApp gaya iPhone (iQC)**
|
|
8
|
+
lengkap dengan bubble reply, font SF Pro, emoji Apple, dan **88 tema warna** yang bisa diatur sampai detail terkecil.
|
|
9
|
+
|
|
10
|
+
[](https://www.npmjs.com/package/iqc-maker)
|
|
11
|
+
[](https://nodejs.org)
|
|
12
|
+
[](./LICENSE)
|
|
13
|
+
|
|
14
|
+
[Instalasi](#instalasi) • [Mulai Cepat](#mulai-cepat) • [Tema](#tema) • [API](#api) • [Contoh Bot](#contoh-plugin-bot-whatsapp-baileys)
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Daftar Isi
|
|
21
|
+
|
|
22
|
+
- [Fitur](#fitur)
|
|
23
|
+
- [Instalasi](#instalasi)
|
|
24
|
+
- [Mulai Cepat](#mulai-cepat)
|
|
25
|
+
- [Reply Chat](#reply-chat)
|
|
26
|
+
- [Tema](#tema)
|
|
27
|
+
- [Daftar tema bawaan](#daftar-tema-bawaan)
|
|
28
|
+
- [Alias Bahasa Indonesia](#alias-bahasa-indonesia)
|
|
29
|
+
- [Override warna](#override-warna)
|
|
30
|
+
- [Bikin tema sendiri](#bikin-tema-sendiri)
|
|
31
|
+
- [Wallpaper sendiri](#wallpaper-sendiri)
|
|
32
|
+
- [Struktur objek tema](#struktur-objek-tema)
|
|
33
|
+
- [Opsi `render()`](#opsi-render)
|
|
34
|
+
- [API](#api)
|
|
35
|
+
- [Bahasa menu](#bahasa-menu)
|
|
36
|
+
- [Font, emoji & cache](#font-emoji--cache)
|
|
37
|
+
- [Contoh plugin bot WhatsApp (Baileys)](#contoh-plugin-bot-whatsapp-baileys)
|
|
38
|
+
- [TypeScript](#typescript)
|
|
39
|
+
- [FAQ & troubleshooting](#faq--troubleshooting)
|
|
40
|
+
- [Kontributor](#kontributor)
|
|
41
|
+
- [Lisensi](#lisensi)
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Fitur
|
|
46
|
+
|
|
47
|
+
- 🍏 **Mirip iOS asli**: status bar, emoji reaction bar, bubble, dan menu glass (Balas, Teruskan, Salin, ...).
|
|
48
|
+
- 💬 **Reply chat**: nama pengirim + kutipan 2 baris, warna bar bisa diatur per pesan.
|
|
49
|
+
- 🔤 **Font SF Pro Text asli**: Regular, Semibold, Bold. Jarak antarbaris dan jarak teks ke jam sudah dirapikan.
|
|
50
|
+
- 😀 **Emoji Apple** di teks, nama, reply, dan reaction bar.
|
|
51
|
+
- 📱 **Tema bawaan `whatsapp`** yang mirip menu WhatsApp iOS asli: ikon di kanan, garis pemisah, kotak "Lainnya..." terpisah, background chat blur, dan status bar operator.
|
|
52
|
+
- 🎨 **88 tema**: tema WhatsApp iOS, warna dasar, versi dark tiap warna, hitam/AMOLED, sampai tema alam (laut, hutan, aurora, galaksi, gunung berapi, ...).
|
|
53
|
+
- 🛠️ **Kustom penuh**: tiap warna bisa di-override, bisa bikin tema sendiri, bisa pakai wallpaper sendiri.
|
|
54
|
+
- 🖼️ **Gambar** di dalam bubble (dengan atau tanpa caption).
|
|
55
|
+
- 🌐 Label menu dalam **9 bahasa**, atau tulis sendiri.
|
|
56
|
+
- 📦 Bisa dipakai lewat **ESM dan CommonJS**, ada **typing TypeScript**.
|
|
57
|
+
- ⚡ Output `png` / `jpeg` / `webp` / `avif`, bisa di-`scale` sampai 4× untuk hasil HD.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Instalasi
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npm install iqc-maker
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
yarn add iqc-maker
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pnpm add iqc-maker
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
> Butuh **Node.js 18+**. Satu-satunya dependency adalah [`@napi-rs/canvas`](https://www.npmjs.com/package/@napi-rs/canvas) (prebuilt, nggak perlu compile). Jalan di Linux, Windows, macOS, dan Android/Termux (arm64).
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Mulai Cepat
|
|
80
|
+
|
|
81
|
+
### ESM
|
|
82
|
+
|
|
83
|
+
```js
|
|
84
|
+
import { writeFile } from 'fs/promises'
|
|
85
|
+
import { render } from 'iqc-maker'
|
|
86
|
+
|
|
87
|
+
const buffer = await render({
|
|
88
|
+
text: 'jangan ganggu pacarku jangan ganggu pacar ku',
|
|
89
|
+
theme: 'black',
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
await writeFile('iqc.png', buffer)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### CommonJS
|
|
96
|
+
|
|
97
|
+
```js
|
|
98
|
+
const { render } = require('iqc-maker')
|
|
99
|
+
|
|
100
|
+
render({ text: 'halo dunia 👋', theme: 'pink' }).then(buf => {
|
|
101
|
+
require('fs').writeFileSync('iqc.png', buf)
|
|
102
|
+
})
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Langsung string
|
|
106
|
+
|
|
107
|
+
```js
|
|
108
|
+
const buffer = await render('halo semua')
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Instance dengan setelan default sendiri
|
|
112
|
+
|
|
113
|
+
```js
|
|
114
|
+
import { IQC } from 'iqc-maker'
|
|
115
|
+
|
|
116
|
+
const iqc = new IQC({ theme: 'dark-blue', locale: 'id', timeZone: 'Asia/Makassar' })
|
|
117
|
+
|
|
118
|
+
await iqc.preload()
|
|
119
|
+
const a = await iqc.render({ text: 'pesan pertama' })
|
|
120
|
+
const b = await iqc.render({ text: 'pesan kedua', theme: 'sakura' })
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Reply Chat
|
|
126
|
+
|
|
127
|
+
```js
|
|
128
|
+
await render({
|
|
129
|
+
text: 'jangan ganggu pacarku jangan ganggu pacar ku',
|
|
130
|
+
reply: {
|
|
131
|
+
name: 'Lynx decode - acc 1',
|
|
132
|
+
text: 'jangan ganggu pacarku jangan ganggu pacar ku nanti aku jadi cemburuuuuuu',
|
|
133
|
+
},
|
|
134
|
+
theme: 'blue',
|
|
135
|
+
})
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
| Field | Tipe | Keterangan |
|
|
139
|
+
|---------|----------|------------|
|
|
140
|
+
| `name` | `string` | Nama pengirim pesan yang dibalas. Dipotong `…` kalau kepanjangan. |
|
|
141
|
+
| `text` | `string` | Isi pesan yang dibalas. Maksimal 2 baris, sisanya dipotong `…`. |
|
|
142
|
+
| `color` | `string` | *(opsional)* Warna bar & nama khusus pesan ini, misalnya `'#ff9500'`. |
|
|
143
|
+
|
|
144
|
+
> Lebar bubble otomatis menyesuaikan teks utama atau reply, mana yang lebih panjang. Reply nggak tampil kalau `image` diisi.
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Tema
|
|
149
|
+
|
|
150
|
+
Pakai nama tema:
|
|
151
|
+
|
|
152
|
+
```js
|
|
153
|
+
await render({ text: 'halo', theme: 'aurora' })
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Tema bawaan: `whatsapp`
|
|
157
|
+
|
|
158
|
+
Kalau `theme` nggak diisi, yang dipakai adalah **`whatsapp`**, tampilan menu WhatsApp iOS dark mode versi terbaru:
|
|
159
|
+
|
|
160
|
+
- Background chat WhatsApp yang di-blur.
|
|
161
|
+
- Status bar gaya lama: sinyal + operator di kiri, jam di tengah, Wi-Fi + persen baterai di kanan.
|
|
162
|
+
- Reaction bar gelap dengan tombol **+**.
|
|
163
|
+
- Bubble tanpa ekor.
|
|
164
|
+
- Menu dalam kartu, teks di kiri, ikon outline di kanan, garis pemisah di tiap baris, dan **Lainnya...** di kartu terpisah.
|
|
165
|
+
|
|
166
|
+
```js
|
|
167
|
+
await render({ text: 'anjay kamu bohong' }) // otomatis tema whatsapp
|
|
168
|
+
await render({ text: 'versi terang', theme: 'whatsapp-light' })
|
|
169
|
+
await render({ text: 'halo', carrier: 'TELKOMSEL', network: 'LTE', battery: 88 })
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
#### Gaya menu: `native` vs `glass`
|
|
173
|
+
|
|
174
|
+
Ada dua gaya tampilan:
|
|
175
|
+
|
|
176
|
+
| Gaya | Dipakai oleh | Ciri |
|
|
177
|
+
|------|--------------|------|
|
|
178
|
+
| `native` | `whatsapp`, `whatsapp-light` | Kartu menu ala WhatsApp iOS, ikon di kanan, ada garis pemisah. |
|
|
179
|
+
| `glass` | Semua tema lain & tema custom | Panel kaca melengkung, ikon di kiri (gaya iQC klasik). |
|
|
180
|
+
|
|
181
|
+
Gaya bisa dipaksa untuk tema apa pun:
|
|
182
|
+
|
|
183
|
+
```js
|
|
184
|
+
await render({ text: 'pink tapi gaya WA', theme: 'pink', style: 'native' })
|
|
185
|
+
await render({ text: 'WA tapi gaya kaca', theme: 'whatsapp', style: 'glass' })
|
|
186
|
+
await render({ text: 'status bar notch', theme: 'whatsapp', statusBarStyle: 'notch' })
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Daftar tema bawaan
|
|
190
|
+
|
|
191
|
+
Lihat semuanya lewat kode:
|
|
192
|
+
|
|
193
|
+
```js
|
|
194
|
+
import { listThemes } from 'iqc-maker'
|
|
195
|
+
|
|
196
|
+
listThemes() // semua tema
|
|
197
|
+
listThemes('dark') // semua tema mode gelap (sesuai mode)
|
|
198
|
+
listThemes('earth') // tema alam
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
#### 📱 WhatsApp iOS (`whatsapp`): 2
|
|
202
|
+
|
|
203
|
+
`whatsapp` (default) · `whatsapp-light`
|
|
204
|
+
|
|
205
|
+
#### 🎨 Warna dasar (`colors`): 22
|
|
206
|
+
|
|
207
|
+
`blue` · `pink` · `red` · `orange` · `yellow` · `lime` · `green` · `mint` · `teal` · `cyan` · `navy` · `indigo` · `purple` · `lavender` · `magenta` · `peach` · `brown` · `gray` · `white` · `gold` · `silver` · `rosegold`
|
|
208
|
+
|
|
209
|
+
#### 🌑 Versi gelap tiap warna (`colors-dark`): 19
|
|
210
|
+
|
|
211
|
+
`dark-blue` · `dark-pink` · `dark-red` · `dark-orange` · `dark-yellow` · `dark-lime` · `dark-green` · `dark-mint` · `dark-teal` · `dark-cyan` · `dark-navy` · `dark-indigo` · `dark-purple` · `dark-lavender` · `dark-magenta` · `dark-peach` · `dark-brown` · `dark-gold` · `dark-rosegold`
|
|
212
|
+
|
|
213
|
+
#### ⚫ Hitam (`dark`): 5
|
|
214
|
+
|
|
215
|
+
| Tema | Keterangan |
|
|
216
|
+
|------------|------------|
|
|
217
|
+
| `black` | Hitam pekat dengan aksen abu, cocok buat yang mau "item". |
|
|
218
|
+
| `dark` | Dark mode iOS asli, aksen biru sistem. |
|
|
219
|
+
| `amoled` | Hitam murni `#000`, tanpa blob, hemat baterai. |
|
|
220
|
+
| `graphite` | Abu tua kebiruan. |
|
|
221
|
+
| `onyx` | Hitam kilap dengan aksen perak. |
|
|
222
|
+
|
|
223
|
+
#### 🌍 Alam (`earth`): 40
|
|
224
|
+
|
|
225
|
+
| Terang | Gelap |
|
|
226
|
+
|--------|-------|
|
|
227
|
+
| `ocean` · `sky` · `sunrise` · `sunset` · `beach` · `coral` · `lagoon` · `glacier` · `arctic` · `forest` · `jungle` · `moss` · `matcha` · `meadow` · `spring` · `sakura` · `lavenderfield` · `sunflower` · `autumn` · `desert` · `savanna` · `canyon` · `earth` · `clay` · `stone` · `mocha` · `cherry` · `grape` · `lemon` · `rainbow` | `aurora` · `galaxy` · `midnight` · `twilight` · `volcano` · `deepsea` · `nightforest` · `storm` · `eclipse` · `nebula` |
|
|
228
|
+
|
|
229
|
+
> Mau lihat preview semua tema? Clone repo-nya, lalu jalankan `npm run preview`. Hasilnya masuk ke `./iqc-themes/`.
|
|
230
|
+
|
|
231
|
+
### Alias Bahasa Indonesia
|
|
232
|
+
|
|
233
|
+
Nama tema nggak case-sensitive, dan spasi/underscore otomatis jadi `-`.
|
|
234
|
+
|
|
235
|
+
| Alias | Tema |
|
|
236
|
+
|-------|------|
|
|
237
|
+
| `hitam`, `item` | `black` |
|
|
238
|
+
| `gelap`, `ios` | `dark` |
|
|
239
|
+
| `putih`, `light` | `white` |
|
|
240
|
+
| `default`, `bawaan`, `wa`, `wa-dark` | `whatsapp` |
|
|
241
|
+
| `wa-light`, `wa-terang` | `whatsapp-light` |
|
|
242
|
+
| `biru` | `blue` |
|
|
243
|
+
| `biru-tua` / `biru-muda` | `navy` / `sky` |
|
|
244
|
+
| `merah` · `merah-muda` | `red` · `pink` |
|
|
245
|
+
| `oren`, `oranye`, `jingga` | `orange` |
|
|
246
|
+
| `kuning` · `hijau` · `hijau-muda` | `yellow` · `green` · `mint` |
|
|
247
|
+
| `tosca`, `toska` | `teal` |
|
|
248
|
+
| `ungu`, `violet` · `lembayung` | `purple` · `lavender` |
|
|
249
|
+
| `coklat`, `cokelat` | `brown` |
|
|
250
|
+
| `abu`, `abu-abu`, `grey` | `gray` |
|
|
251
|
+
| `emas` · `perak` · `rose` | `gold` · `silver` · `rosegold` |
|
|
252
|
+
| `laut` · `langit` · `pantai` | `ocean` · `sky` · `beach` |
|
|
253
|
+
| `hutan` · `gurun` · `gunung` | `forest` · `desert` · `volcano` |
|
|
254
|
+
| `senja` · `fajar` · `malam` · `galaksi` | `sunset` · `sunrise` · `midnight` · `galaxy` |
|
|
255
|
+
|
|
256
|
+
Varian gelap juga bisa pakai alias:
|
|
257
|
+
|
|
258
|
+
```js
|
|
259
|
+
render({ text: 'halo', theme: 'biru dark' }) // → dark-blue
|
|
260
|
+
render({ text: 'halo', theme: 'gelap-merah' }) // → dark-red
|
|
261
|
+
render({ text: 'halo', theme: 'ungu-gelap' }) // → dark-purple
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### Override warna
|
|
265
|
+
|
|
266
|
+
Ganti sebagian warna tanpa bikin tema baru, lewat `colors`:
|
|
267
|
+
|
|
268
|
+
```js
|
|
269
|
+
await render({
|
|
270
|
+
text: 'override warna doang',
|
|
271
|
+
theme: 'black',
|
|
272
|
+
colors: {
|
|
273
|
+
bubble: { bg: '#1a1a1a', text: '#00ff9c', time: '#4d7f68' },
|
|
274
|
+
reply: { bar: '#00ff9c', name: '#00ff9c' },
|
|
275
|
+
menu: { danger: '#ff2d55' },
|
|
276
|
+
},
|
|
277
|
+
})
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Bikin tema sendiri
|
|
281
|
+
|
|
282
|
+
#### 1. Dari palet singkat (`buildTheme` / `registerTheme`)
|
|
283
|
+
|
|
284
|
+
Cukup isi 3 warna gradasi background, 4 warna blob, dan 1 warna aksen. Warna lainnya (reply, menu glass, status bar, baterai, dan seterusnya) dihitung otomatis supaya tetap serasi.
|
|
285
|
+
|
|
286
|
+
```js
|
|
287
|
+
import { registerTheme, render } from 'iqc-maker'
|
|
288
|
+
|
|
289
|
+
registerTheme('lynx', {
|
|
290
|
+
mode: 'dark', // 'light' | 'dark'
|
|
291
|
+
background: ['#05010a', '#0e0418', '#170726'], // gradasi atas → bawah
|
|
292
|
+
blobs: ['#ff2d55', '#bf5af2', '#5e5ce6', '#ff375f'],
|
|
293
|
+
accent: '#ff2d55', // bar reply, nama, tint menu
|
|
294
|
+
})
|
|
295
|
+
|
|
296
|
+
await render({ text: 'tema lynx', theme: 'lynx' })
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
Field tambahan opsional untuk palet:
|
|
300
|
+
|
|
301
|
+
| Field | Keterangan |
|
|
302
|
+
|-------------|------------|
|
|
303
|
+
| `underlay` | Warna lapisan bawah reaction bar. |
|
|
304
|
+
| `highlight` | Warna blob sorotan pertama (default putih transparan). |
|
|
305
|
+
| `surface` | Warna bubble. |
|
|
306
|
+
| `danger` | Warna menu "Hapus". |
|
|
307
|
+
| `overrides` | Objek tema parsial yang di-merge paling akhir. |
|
|
308
|
+
|
|
309
|
+
#### 2. Turunan dari tema yang sudah ada
|
|
310
|
+
|
|
311
|
+
```js
|
|
312
|
+
registerTheme('erine', {
|
|
313
|
+
extends: 'pink',
|
|
314
|
+
bubble: { bg: '#fff5fa' },
|
|
315
|
+
reply: { bar: '#ff4f9a', name: '#ff4f9a' },
|
|
316
|
+
})
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
#### 3. Langsung objek tanpa didaftarkan
|
|
320
|
+
|
|
321
|
+
```js
|
|
322
|
+
import { buildTheme, render } from 'iqc-maker'
|
|
323
|
+
|
|
324
|
+
const neon = buildTheme({
|
|
325
|
+
mode: 'dark',
|
|
326
|
+
background: ['#000000', '#000000', '#001a12'],
|
|
327
|
+
blobs: ['#00ff9c', '#00e1ff', '#00ff9c', '#00b3ff'],
|
|
328
|
+
accent: '#00ff9c',
|
|
329
|
+
})
|
|
330
|
+
|
|
331
|
+
await render({ text: 'neon', theme: neon })
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### Wallpaper sendiri
|
|
335
|
+
|
|
336
|
+
```js
|
|
337
|
+
await render({
|
|
338
|
+
text: 'pakai wallpaper',
|
|
339
|
+
theme: 'dark',
|
|
340
|
+
background: { image: './wallpaper.jpg', dim: 0.25 },
|
|
341
|
+
})
|
|
342
|
+
|
|
343
|
+
await render({ text: 'dari URL', background: 'https://example.com/bg.jpg' })
|
|
344
|
+
await render({ text: 'dari buffer', background: someBuffer })
|
|
345
|
+
await render({ text: 'warna polos', background: { solid: '#101010' } })
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
`image` bisa berupa path, URL, atau `Buffer`, dan otomatis di-*cover* ke ukuran canvas. `dim` (`0`–`1` atau string warna) menggelapkan wallpaper supaya teks tetap kebaca. Menu glass ikut memantulkan wallpaper ini.
|
|
349
|
+
|
|
350
|
+
### Struktur objek tema
|
|
351
|
+
|
|
352
|
+
Semua key di bawah ini bisa di-override lewat `colors`, `registerTheme`, atau `createTheme`.
|
|
353
|
+
|
|
354
|
+
```js
|
|
355
|
+
{
|
|
356
|
+
name: 'blue', label: 'Blue', mode: 'light', category: 'colors',
|
|
357
|
+
style: 'glass', // 'glass' | 'native'
|
|
358
|
+
background: {
|
|
359
|
+
image: null, // path | url | Buffer
|
|
360
|
+
gradient: ['#e8f4fa', '#d4ebf8', '#bfe0f6'],
|
|
361
|
+
blobs: ['rgba(255,255,255,0.9)', '#5dade2', '#85c1e9', '#3498db', '#2e86c1'],
|
|
362
|
+
solid: undefined, // isi untuk warna polos
|
|
363
|
+
dim: undefined, // penggelap wallpaper
|
|
364
|
+
chat: null, // background chat blur (tema whatsapp)
|
|
365
|
+
// chat: { header, avatar, accent, incoming, outgoing, blur: 16, overlay }
|
|
366
|
+
},
|
|
367
|
+
statusBar: {
|
|
368
|
+
style: 'notch', // 'notch' | 'classic'
|
|
369
|
+
text: '#000000', // jam, sinyal, 4G
|
|
370
|
+
inactive: 'rgba(0,0,0,0.3)', // bar sinyal kosong
|
|
371
|
+
battery: { body, border, cap, fill, low, charging, bolt, boltStroke },
|
|
372
|
+
},
|
|
373
|
+
pill: { // reaction bar
|
|
374
|
+
bg: '#ffffff', underlay: '#b6dff4', shadow: 'rgba(...)',
|
|
375
|
+
plusBg: '#e7e7e9', plusIcon: '#7b7b80',
|
|
376
|
+
border: null, // garis tepi reaction bar
|
|
377
|
+
},
|
|
378
|
+
bubble: {
|
|
379
|
+
bg: '#ffffff', text: '#000000', time: '#7d7d82', shadow: 'rgba(0,0,0,0.08)',
|
|
380
|
+
mediaTimeBg: 'rgba(0,0,0,0.38)', mediaTimeText: '#ffffff',
|
|
381
|
+
tail: true, // ekor bubble
|
|
382
|
+
},
|
|
383
|
+
reply: { bg: '#e8f3fc', bar: '#3a8ee6', name: '#2b7fd8', text: '#5b5b60' },
|
|
384
|
+
menu: {
|
|
385
|
+
shadow, overlay, // overlay = penggelap glass (dark mode)
|
|
386
|
+
tintTop, tintBottom, sheen, glow, spec, rimTop, rimBottom,
|
|
387
|
+
text: '#000000', icon: '#000000', danger: '#c10b27', divider: 'rgba(0,0,0,0.15)',
|
|
388
|
+
card, cardBorder, separator, // dipakai gaya native
|
|
389
|
+
},
|
|
390
|
+
}
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
Format warna yang didukung: `#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`, `rgb()`, `rgba()`.
|
|
394
|
+
|
|
395
|
+
---
|
|
396
|
+
|
|
397
|
+
## Opsi `render()`
|
|
398
|
+
|
|
399
|
+
| Opsi | Tipe | Default | Keterangan |
|
|
400
|
+
|---------------|------|---------|------------|
|
|
401
|
+
| `text` | `string` | — | Isi pesan. Mendukung `\n` dan emoji. Wajib diisi kalau `image` kosong. |
|
|
402
|
+
| `image` | `Buffer \| string` | `null` | Gambar di dalam bubble (path / URL / Buffer). |
|
|
403
|
+
| `reply` | `{ name, text, color? }` | `null` | Bubble reply. |
|
|
404
|
+
| `theme` | `string \| object` | `'whatsapp'` | Nama tema, alias, atau objek tema. |
|
|
405
|
+
| `style` | `'native' \| 'glass'` | ikut tema | Paksa gaya menu. |
|
|
406
|
+
| `statusBarStyle` | `'classic' \| 'notch'` | ikut tema | Paksa gaya status bar. |
|
|
407
|
+
| `carrier` | `string` | `'INDOSAT'` | Nama operator (status bar `classic`). `''` untuk menyembunyikan. |
|
|
408
|
+
| `wifi` | `boolean` | `true` | Ikon Wi-Fi di status bar `classic`. |
|
|
409
|
+
| `batteryPercent` | `boolean` | `true` | Persen baterai di status bar `classic`. |
|
|
410
|
+
| `colors` | `object` | — | Override sebagian warna tema. |
|
|
411
|
+
| `background` | `string \| Buffer \| object` | — | Wallpaper / warna polos / override background. |
|
|
412
|
+
| `time` | `string` | jam sekarang | Jam di status bar, misalnya `'00.56'`. |
|
|
413
|
+
| `bubbleTime` | `string` | `= time` | Jam di dalam bubble. |
|
|
414
|
+
| `timeZone` | `string` | `'Asia/Jakarta'` | Zona waktu kalau `time` dikosongkan. |
|
|
415
|
+
| `network` | `string` | `'4G'` | `'4G'`, `'5G'`, `'LTE'`, `'wifi'`, atau `''` untuk disembunyikan. |
|
|
416
|
+
| `signal` | `0–4` | `4` | Jumlah bar sinyal. |
|
|
417
|
+
| `battery` | `0–100` | `90` | Persen baterai. ≤ 20 jadi merah kalau nggak dicas. |
|
|
418
|
+
| `charging` | `boolean` | `true` | Baterai hijau + ikon petir. |
|
|
419
|
+
| `reactions` | `string[]` | `😈 🥱 ⚡ 🔥 😒 😹 🤭` | Maksimal 7 emoji di reaction bar. |
|
|
420
|
+
| `locale` | `string` | `'id'` | Bahasa label menu. |
|
|
421
|
+
| `labels` | `object` | — | Label menu custom (`reply`, `forward`, `copy`, `star`, `delete`, `more`). |
|
|
422
|
+
| `statusBar` | `boolean` | `true` | `false` untuk menyembunyikan status bar. |
|
|
423
|
+
| `reactionBar` | `boolean` | `true` | `false` untuk menyembunyikan reaction bar. |
|
|
424
|
+
| `menu` | `boolean` | `true` | `false` untuk menyembunyikan menu. |
|
|
425
|
+
| `format` | `string` | `'png'` | `png`, `jpeg`/`jpg`, `webp`, `avif`. |
|
|
426
|
+
| `quality` | `1–100` | `92` | Kualitas untuk jpeg/webp/avif. |
|
|
427
|
+
| `scale` | `0.25–4` | `1` | Resolusi output. Ukuran dasar 590×1280. |
|
|
428
|
+
| `output` | `'buffer' \| 'canvas'` | `'buffer'` | `'canvas'` mengembalikan objek `Canvas` mentah. |
|
|
429
|
+
| `cacheDir` | `string` | `~/.cache/iqc-maker` | Lokasi cache font & emoji. |
|
|
430
|
+
| `fonts` | `object` | SF Pro | Font sendiri: `{ regular, semibold, bold }` (path / URL / Buffer). |
|
|
431
|
+
| `emoji` | `string \| Buffer \| object \| false` | emoji Apple | Sumber emoji map, atau `false` untuk emoji sistem. |
|
|
432
|
+
| `offline` | `boolean` | `false` | Jangan download apa-apa, cuma pakai cache/file lokal. |
|
|
433
|
+
| `timeout` | `number` | `60000` | Timeout download (ms). |
|
|
434
|
+
| `logger` | `function \| false` | `process.emitWarning` | Penampung pesan peringatan. |
|
|
435
|
+
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
## API
|
|
439
|
+
|
|
440
|
+
```ts
|
|
441
|
+
render(options | text): Promise<Buffer>
|
|
442
|
+
preload(assetOptions?): Promise<{ fonts, emoji, cacheDir }>
|
|
443
|
+
configure(options): IQC // ubah default instance bersama
|
|
444
|
+
|
|
445
|
+
new IQC(defaults?)
|
|
446
|
+
.render(options | text): Promise<Buffer | Canvas>
|
|
447
|
+
.preload(assetOptions?)
|
|
448
|
+
.options
|
|
449
|
+
.version
|
|
450
|
+
|
|
451
|
+
getTheme(nameOrObject?, overrides?): Theme // ambil salinan tema (aman diubah)
|
|
452
|
+
createTheme(base, overrides?): Theme // alias getTheme
|
|
453
|
+
buildTheme(definition): Theme // tema dari palet singkat
|
|
454
|
+
registerTheme(name, definitionOrPartial): Theme
|
|
455
|
+
listThemes(filter?): { name, label, mode, category }[]
|
|
456
|
+
resolveTheme(nameOrAlias): string | null
|
|
457
|
+
clearCache(cacheDir?): Promise<void>
|
|
458
|
+
|
|
459
|
+
locales // label menu bawaan
|
|
460
|
+
defaultReactions // emoji default
|
|
461
|
+
layout // konstanta ukuran & posisi
|
|
462
|
+
version // '1.0.0'
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
### `configure()`: setelan global sekali di awal
|
|
466
|
+
|
|
467
|
+
```js
|
|
468
|
+
import { configure, render } from 'iqc-maker'
|
|
469
|
+
|
|
470
|
+
configure({ theme: 'hitam', timeZone: 'Asia/Makassar', cacheDir: './tmp/iqc' })
|
|
471
|
+
|
|
472
|
+
await render('semua render sekarang otomatis tema hitam')
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
### `preload()`: panaskan cache di awal bot
|
|
476
|
+
|
|
477
|
+
```js
|
|
478
|
+
import { preload } from 'iqc-maker'
|
|
479
|
+
|
|
480
|
+
const info = await preload()
|
|
481
|
+
console.log(info) // { fonts: { regular: true, semibold: true, bold: true, fallback: false }, emoji: 3600, cacheDir: '...' }
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
---
|
|
485
|
+
|
|
486
|
+
## Bahasa menu
|
|
487
|
+
|
|
488
|
+
| Kode | Bahasa | Contoh |
|
|
489
|
+
|------|--------|--------|
|
|
490
|
+
| `id` | Indonesia (default) | Balas · Teruskan · Salin · Beri bintang · Hapus · Lainnya... |
|
|
491
|
+
| `en` | English | Reply · Forward · Copy · Star · Delete · More... |
|
|
492
|
+
| `ms` | Melayu | Balas · Majukan · Salin · Bintangkan · Padam · Lagi... |
|
|
493
|
+
| `jv` | Jawa | Bales · Terusna · Salin · Wenehi lintang · Busak · Liyane... |
|
|
494
|
+
| `su` | Sunda | Bales · Teraskeun · Salin · Béntangan · Pupus · Lianna... |
|
|
495
|
+
| `es` | Español | Responder · Reenviar · Copiar · Destacar · Eliminar · Más... |
|
|
496
|
+
| `pt` | Português | Responder · Encaminhar · Copiar · Favoritar · Apagar · Mais... |
|
|
497
|
+
| `ar` | العربية | رد · إعادة توجيه · نسخ · تمييز بنجمة · حذف · المزيد... |
|
|
498
|
+
| `ja` | 日本語 | 返信 · 転送 · コピー · スター · 削除 · その他... |
|
|
499
|
+
|
|
500
|
+
Label custom:
|
|
501
|
+
|
|
502
|
+
```js
|
|
503
|
+
render({ text: 'halo', labels: { reply: 'Bales cuy', delete: 'Buang' } })
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
---
|
|
507
|
+
|
|
508
|
+
## Font, emoji & cache
|
|
509
|
+
|
|
510
|
+
- **Font**: saat pertama kali dipakai, SF Pro Text (Regular/Semibold/Bold) diunduh lalu disimpan di `cacheDir/fonts`. Kalau gagal, otomatis pakai Inter, lalu font sistem. Kalau weight Semibold/Bold nggak ada, tebal huruf disimulasikan.
|
|
511
|
+
- **Emoji**: emoji map Apple (filenya cukup besar, cuma sekali unduh) disimpan di `cacheDir/emoji`. Kalau gagal, dipakai emoji sistem.
|
|
512
|
+
- **Lokasi cache**: default `~/.cache/iqc-maker`. Bisa diganti lewat opsi `cacheDir` atau env `IQC_MAKER_CACHE`.
|
|
513
|
+
- **Server tanpa internet**: salin folder cache dari mesin lain atau isi `fonts` / `emoji` dengan file lokal, lalu set `offline: true`.
|
|
514
|
+
|
|
515
|
+
```js
|
|
516
|
+
new IQC({
|
|
517
|
+
fonts: {
|
|
518
|
+
regular: './fonts/SF-Pro-Text-Regular.otf',
|
|
519
|
+
semibold: './fonts/SF-Pro-Text-Semibold.otf',
|
|
520
|
+
bold: './fonts/SF-Pro-Text-Bold.otf',
|
|
521
|
+
},
|
|
522
|
+
emoji: './assets/emoji-apple.json',
|
|
523
|
+
offline: true,
|
|
524
|
+
})
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
> ⚠️ **Lisensi aset**: SF Pro dan desain emoji Apple adalah milik Apple Inc. dan **nggak dibundel** di package ini. Aset itu diunduh saat runtime dari repo publik pihak ketiga. Kalau mau dipakai untuk komersial, pastikan kamu punya hak pakainya, atau ganti dengan font/emoji lain lewat opsi `fonts` dan `emoji`.
|
|
528
|
+
|
|
529
|
+
---
|
|
530
|
+
|
|
531
|
+
## Contoh plugin bot WhatsApp (Baileys)
|
|
532
|
+
|
|
533
|
+
Contoh untuk struktur plugin `handler` ala bot MD (ESM):
|
|
534
|
+
|
|
535
|
+
```js
|
|
536
|
+
import { render, resolveTheme, listThemes } from 'iqc-maker'
|
|
537
|
+
|
|
538
|
+
let handler = async (m, { conn, args, usedPrefix, command }) => {
|
|
539
|
+
let theme = 'whatsapp'
|
|
540
|
+
if (args[0] && args[0].startsWith('-')) theme = resolveTheme(args.shift().slice(1)) || 'whatsapp'
|
|
541
|
+
|
|
542
|
+
const q = m.quoted ? m.quoted : m
|
|
543
|
+
const mime = (q.msg || q).mimetype || ''
|
|
544
|
+
const isImage = /image\/(jpe?g|png|webp)/.test(mime)
|
|
545
|
+
|
|
546
|
+
let text = args.join(' ').trim()
|
|
547
|
+
let reply = null
|
|
548
|
+
const parts = text.split('|').map(s => s.trim())
|
|
549
|
+
|
|
550
|
+
if (parts.length >= 3 && parts[0]) {
|
|
551
|
+
text = parts[0]
|
|
552
|
+
reply = { name: parts[1], text: parts.slice(2).join(' | ') }
|
|
553
|
+
} else if (m.quoted && text && !isImage) {
|
|
554
|
+
reply = { name: m.quoted.name || await conn.getName(m.quoted.sender), text: m.quoted.text || 'Pesan' }
|
|
555
|
+
} else if (!text) {
|
|
556
|
+
text = m.quoted?.text || ''
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
if (!text && !isImage) return m.reply(`Contoh:\n${usedPrefix + command} halo\n${usedPrefix + command} -hitam halo\n${usedPrefix + command} teks | nama | pesan`)
|
|
560
|
+
|
|
561
|
+
const buffer = await render({
|
|
562
|
+
text,
|
|
563
|
+
reply,
|
|
564
|
+
theme,
|
|
565
|
+
image: isImage ? await q.download() : null,
|
|
566
|
+
})
|
|
567
|
+
await conn.sendMessage(m.chat, { image: buffer }, { quoted: m })
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
handler.help = ['iqc <teks>']
|
|
571
|
+
handler.tags = ['maker']
|
|
572
|
+
handler.command = /^iqc$/i
|
|
573
|
+
|
|
574
|
+
export default handler
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
Cara pakai di WhatsApp:
|
|
578
|
+
|
|
579
|
+
```
|
|
580
|
+
.iqc halo semua
|
|
581
|
+
.iqc -hitam halo semua
|
|
582
|
+
.iqc -biru-dark halo semua
|
|
583
|
+
.iqc -aurora halo semua
|
|
584
|
+
(balas sebuah chat) .iqc jangan ganggu pacarku
|
|
585
|
+
.iqc jangan ganggu | Lynx decode | pesan yang dibalas
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
Versi lengkap (dengan list tema dan label media 📷/🎥/🏷️) ada di [`examples/baileys-plugin.js`](./examples/baileys-plugin.js).
|
|
589
|
+
|
|
590
|
+
---
|
|
591
|
+
|
|
592
|
+
## TypeScript
|
|
593
|
+
|
|
594
|
+
Typing sudah termasuk, nggak perlu `@types`.
|
|
595
|
+
|
|
596
|
+
```ts
|
|
597
|
+
import { render, type RenderOptions, type Theme } from 'iqc-maker'
|
|
598
|
+
|
|
599
|
+
const opts: RenderOptions = { text: 'halo', theme: 'dark-purple', scale: 2 }
|
|
600
|
+
const png: Buffer = await render(opts)
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
---
|
|
604
|
+
|
|
605
|
+
## FAQ & troubleshooting
|
|
606
|
+
|
|
607
|
+
**Render pertama lama?**
|
|
608
|
+
Wajar, karena font dan emoji diunduh dulu. Panggil `await preload()` saat bot start supaya pesan pertama langsung cepat.
|
|
609
|
+
|
|
610
|
+
**Emoji jadi kotak / beda gaya?**
|
|
611
|
+
Emoji map gagal diunduh (misalnya diblokir jaringan). Cek folder `cacheDir/emoji`, atau isi opsi `emoji` dengan path file lokal.
|
|
612
|
+
|
|
613
|
+
**`Error: Cannot find module '@napi-rs/canvas'` di Termux / Alpine.**
|
|
614
|
+
Jalankan ulang `npm install`. `@napi-rs/canvas` punya build untuk `linux-arm64` (Termux) dan `musl` (Alpine).
|
|
615
|
+
|
|
616
|
+
**Loader plugin bot error `Unexpected token`.**
|
|
617
|
+
Package ini sudah nggak pakai `||=`. Kalau loader-mu ikut mem-parse `node_modules`, update loader atau kecualikan folder `node_modules`.
|
|
618
|
+
|
|
619
|
+
**Bisa pakai di Next.js / Vercel?**
|
|
620
|
+
Bisa di route server (Node runtime, bukan Edge). Set `cacheDir: '/tmp/iqc-maker'` karena filesystem lain di Vercel read-only.
|
|
621
|
+
|
|
622
|
+
**Mau ukuran lebih tajam untuk stiker / HD?**
|
|
623
|
+
Pakai `scale: 2` (1180×2560) atau `format: 'webp'`.
|
|
624
|
+
|
|
625
|
+
---
|
|
626
|
+
|
|
627
|
+
## Kontributor
|
|
628
|
+
|
|
629
|
+
| Kontributor | Peran |
|
|
630
|
+
|---|---|
|
|
631
|
+
| **[Lynx Decode](https://github.com/Lynxcode-id)** | Maintainer: reply chat, font SF Pro, perbaikan spacing, sistem tema, tema WhatsApp iOS, versi npm |
|
|
632
|
+
| **[Ditzzx](https://github.com/Ditzzx-vibecoder)** | Pembuat pertama iQC canvas & penyedia emoji map Apple |
|
|
633
|
+
|
|
634
|
+
Ikon menu gaya `native` diadaptasi dari [Lucide](https://lucide.dev) (lisensi ISC).
|
|
635
|
+
|
|
636
|
+
Kalau memakai atau memodifikasi package ini, tolong tetap cantumkan nama para kontributor di atas. 🙏
|
|
637
|
+
|
|
638
|
+
---
|
|
639
|
+
|
|
640
|
+
## Lisensi
|
|
641
|
+
|
|
642
|
+
[MIT](./LICENSE) © 2026 Ditzzx & Lynx Decode
|