gulp-mu-gulp-api 0.3.11 → 0.3.13
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 +76 -10
- package/package.json +1 -1
- package/src/index.mjs +65 -7
package/README.md
CHANGED
|
@@ -37,6 +37,17 @@ The module is deliberately **dependency-free** and knows nothing about µGulp™
|
|
|
37
37
|
npm install gulp-mu-gulp-api
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
+
### 0.3.13
|
|
41
|
+
|
|
42
|
+
- **Updated** `PlaySignal` / `PlaySound` docs and CLI fallbacks for the µGulp sound schema (`taskSuccess`, `taskFailed`, `requestAlert`, …). Legacy presets `success` / `error` / `attention` remain valid.
|
|
43
|
+
|
|
44
|
+
### 0.3.12
|
|
45
|
+
|
|
46
|
+
- **Added** `RegisterDashboardFont({ id, file, family?, usage? })` — registers a workspace font for µGulp dashboard **task icons** and/or **run-log** typography. `usage`: `'task-icons'` (default), `'log'`, or `'all'`. Call at gulpfile load time; the scan worker forwards the registry to the engine.
|
|
47
|
+
- **Added** `GetRegisteredDashboardFonts()` / `ClearRegisteredDashboardFonts()` — snapshot / test helpers.
|
|
48
|
+
- Pair with gulpfile metadata `µIcon` (glyph) and optional `µIconFont = '<id>'`, or declarative `export const µDashboardFonts = […]`. Config/setting `dashboardFonts` is an alternative when not using the API.
|
|
49
|
+
- Outside µGulp the helpers are no-ops (fonts are a dashboard/host concern).
|
|
50
|
+
|
|
40
51
|
### 0.3.11
|
|
41
52
|
|
|
42
53
|
- **Added** `ShowModalMessage({ variant?, title?, message?, buttons?, presentation? })` — blocking modal (info/warning/error) in the µGulp dashboard glass panel, or native VS Code/Cursor dialogs when `presentation` is `ide`/`auto` (host setting `microgulp.modalPresentation`).
|
|
@@ -89,7 +100,7 @@ npm install gulp-mu-gulp-api
|
|
|
89
100
|
## Usage
|
|
90
101
|
|
|
91
102
|
```javascript
|
|
92
|
-
import { ReportProgress, CreateProgress, PlaySignal, PlaySound, StopSound, Speak, RequestTextInput, RequestColorInput, RequestFontInput, RequestSelectInput, RequestMultiSelectInput, RequestForm, IsMicroGulp, IsµGulp, InstallStringExtensions } from 'gulp-mu-gulp-api';
|
|
103
|
+
import { ReportProgress, CreateProgress, PlaySignal, PlaySound, StopSound, Speak, RequestTextInput, RequestColorInput, RequestFontInput, RequestSelectInput, RequestMultiSelectInput, RequestForm, RegisterDashboardFont, IsMicroGulp, IsµGulp, InstallStringExtensions } from 'gulp-mu-gulp-api';
|
|
93
104
|
|
|
94
105
|
// Enables "phrase<context=\"…\"/>".i18xRegister()/.i18xTrans() on strings.
|
|
95
106
|
InstallStringExtensions();
|
|
@@ -116,8 +127,8 @@ export async function BUILD_THEME() {
|
|
|
116
127
|
progress.Done();
|
|
117
128
|
|
|
118
129
|
// sound + speech (rendered by the dashboard, configured in its settings)
|
|
119
|
-
PlaySignal('success'); // preset
|
|
120
|
-
PlaySound('
|
|
130
|
+
PlaySignal('success'); // preset → taskSuccess (also error→taskFailed, attention→requestAlert)
|
|
131
|
+
PlaySound('taskSuccess'); // named atlas sample (see MicroGulpSoundSchema.md)
|
|
121
132
|
PlaySound('engine', { loop: true }); // loop until StopSound('engine')
|
|
122
133
|
StopSound('engine');
|
|
123
134
|
Speak('Theme build finished.');
|
|
@@ -158,9 +169,12 @@ let values = await RequestForm({
|
|
|
158
169
|
| `GetLid()` / `SetLid(lid?)` | Active language id; `SetLid` clears to automatic when omitted |
|
|
159
170
|
| `ReportProgress(value, label?)` | Report progress `0..1` to the task progress bar |
|
|
160
171
|
| `CreateProgress(label?)` | Reporter object with `Update(value, stepLabel?)` and `Done()` |
|
|
161
|
-
| `PlaySignal(signal?)` | Preset
|
|
162
|
-
| `PlaySound(sample, options?)` | Named sample from the dashboard sound atlas; `options.loop` repeats until `StopSound` |
|
|
172
|
+
| `PlaySignal(signal?)` | Preset or schema name; presets: `'success'`→`taskSuccess`, `'error'`→`taskFailed`, `'attention'`→`requestAlert` |
|
|
173
|
+
| `PlaySound(sample, options?)` | Named sample from the dashboard sound atlas (e.g. `taskStart`, `requestInfo`); `options.loop` repeats until `StopSound` |
|
|
163
174
|
| `StopSound(sample)` | Stops a looping sample started with `PlaySound(sample, { loop: true })` |
|
|
175
|
+
| `RegisterDashboardFont(spec)` | Registers a workspace font for dashboard task icons / run-log (`id`, `file`, optional `family` / `usage`: `task-icons`\|`log`\|`all`) |
|
|
176
|
+
| `GetRegisteredDashboardFonts()` | Snapshot of fonts registered in this process (scan worker / tests) |
|
|
177
|
+
| `ClearRegisteredDashboardFonts()` | Clears the in-process registry (tests) |
|
|
164
178
|
| `Speak(text, options?)` | Speech output in the dashboard; `options`: `{ rate?, pitch?, volume? }` per-call overrides |
|
|
165
179
|
| `RequestForm(form)` | Request a complete form; resolves with `{ fieldId: value, … }` |
|
|
166
180
|
| `ShowModalMessage(spec)` | Blocking modal (`info`/`warning`/`error`); `presentation`: `webview` \| `ide` \| `auto` |
|
|
@@ -194,6 +208,25 @@ MAKE_BUILDS.µDisplayName = 'Make Build V<version/><context="µDisplayName"/>'.i
|
|
|
194
208
|
// => "Make Build V1.13" in the dashboard (translatable per language)
|
|
195
209
|
```
|
|
196
210
|
|
|
211
|
+
### Dashboard fonts (task icons & run log)
|
|
212
|
+
|
|
213
|
+
Project fonts are independent of the dashboard skin. Register them at gulpfile load time:
|
|
214
|
+
|
|
215
|
+
```javascript
|
|
216
|
+
import { RegisterDashboardFont } from 'gulp-mu-gulp-api';
|
|
217
|
+
|
|
218
|
+
RegisterDashboardFont({
|
|
219
|
+
id: 'ProjectIcons',
|
|
220
|
+
file: 'assets/task-icons.woff2', // relative to the gulpfile directory
|
|
221
|
+
usage: 'task-icons', // or 'log' / 'all'
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
BUILD.µIcon = '\uE101';
|
|
225
|
+
BUILD.µIconFont = 'ProjectIcons'; // optional when only one task-icons font is registered
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Alternatively export `µDashboardFonts` from the gulpfile, or set `dashboardFonts` in `microgulp.config.json` / the `microgulp.dashboardFonts` extension setting. Files must stay under the workspace (`woff2` / `woff` / `ttf` / `otf`). The first `task-icons` font becomes the default for glyph `µIcon` entries; `usage: 'log'` restyles the run-sector log.
|
|
229
|
+
|
|
197
230
|
### Field types (for `RequestForm`)
|
|
198
231
|
|
|
199
232
|
A field descriptor is `{ id, type, label, default?, options?, validate?, min?, max?, step?, rows?, placeholder? }`.
|
|
@@ -281,6 +314,17 @@ Das Modul ist bewusst **abhängigkeitsfrei** und kennt keine µGulp™-Interna:
|
|
|
281
314
|
npm install gulp-mu-gulp-api
|
|
282
315
|
```
|
|
283
316
|
|
|
317
|
+
### 0.3.13
|
|
318
|
+
|
|
319
|
+
- **Aktualisiert** `PlaySignal` / `PlaySound` für das µGulp-Sound-Schema (`taskSuccess`, `taskFailed`, `requestAlert`, …). Legacy-Presets `success` / `error` / `attention` bleiben gültig.
|
|
320
|
+
|
|
321
|
+
### 0.3.12
|
|
322
|
+
|
|
323
|
+
- **Neu** `RegisterDashboardFont({ id, file, family?, usage? })` — registriert einen Workspace-Font für **Task-Icons** und/oder die **Run-Log**-Typografie im µGulp-Dashboard. `usage`: `'task-icons'` (Default), `'log'` oder `'all'`. Aufruf beim Laden des Gulpfiles; der Scan-Worker reicht die Registry an die Engine weiter.
|
|
324
|
+
- **Neu** `GetRegisteredDashboardFonts()` / `ClearRegisteredDashboardFonts()` — Snapshot- bzw. Test-Helfer.
|
|
325
|
+
- Zusammen mit Metadaten `µIcon` (Glyph) und optional `µIconFont = '<id>'`, oder deklarativ `export const µDashboardFonts = […]`. Alternative: `dashboardFonts` in Config/Setting.
|
|
326
|
+
- Außerhalb von µGulp sind die Helfer No-ops (Fonts sind Sache von Dashboard/Host).
|
|
327
|
+
|
|
284
328
|
### 0.3.11
|
|
285
329
|
|
|
286
330
|
- **Neu** `ShowModalMessage({ variant?, title?, message?, buttons?, presentation? })` — blockierendes Modal (info/warning/error) als Dashboard-Glaspanel oder natives VS-Code-/Cursor-Dialogfenster bei `presentation` `ide`/`auto` (Host-Setting `microgulp.modalPresentation`).
|
|
@@ -333,7 +377,7 @@ npm install gulp-mu-gulp-api
|
|
|
333
377
|
## Verwendung
|
|
334
378
|
|
|
335
379
|
```javascript
|
|
336
|
-
import { ReportProgress, CreateProgress, PlaySignal, PlaySound, StopSound, Speak, RequestTextInput, RequestColorInput, RequestFontInput, RequestSelectInput, RequestMultiSelectInput, RequestForm, IsMicroGulp, IsµGulp, InstallStringExtensions } from 'gulp-mu-gulp-api';
|
|
380
|
+
import { ReportProgress, CreateProgress, PlaySignal, PlaySound, StopSound, Speak, RequestTextInput, RequestColorInput, RequestFontInput, RequestSelectInput, RequestMultiSelectInput, RequestForm, RegisterDashboardFont, IsMicroGulp, IsµGulp, InstallStringExtensions } from 'gulp-mu-gulp-api';
|
|
337
381
|
|
|
338
382
|
// Enables "phrase<context=\"…\"/>".i18xRegister()/.i18xTrans() on strings.
|
|
339
383
|
InstallStringExtensions();
|
|
@@ -360,8 +404,8 @@ export async function BUILD_THEME() {
|
|
|
360
404
|
progress.Done();
|
|
361
405
|
|
|
362
406
|
// sound + speech (rendered by the dashboard, configured in its settings)
|
|
363
|
-
PlaySignal('success'); // preset
|
|
364
|
-
PlaySound('
|
|
407
|
+
PlaySignal('success'); // preset → taskSuccess (also error→taskFailed, attention→requestAlert)
|
|
408
|
+
PlaySound('taskSuccess'); // named atlas sample (see MicroGulpSoundSchema.md)
|
|
365
409
|
PlaySound('engine', { loop: true }); // loop until StopSound('engine')
|
|
366
410
|
StopSound('engine');
|
|
367
411
|
Speak('Theme build finished.');
|
|
@@ -402,9 +446,12 @@ let values = await RequestForm({
|
|
|
402
446
|
| `GetLid()` / `SetLid(lid?)` | Aktive Sprach-ID; `SetLid` ohne Argument = automatische Auflösung |
|
|
403
447
|
| `ReportProgress(value, label?)` | Fortschritt `0..1` an die Task-Progressbar melden |
|
|
404
448
|
| `CreateProgress(label?)` | Reporter-Objekt mit `Update(value, stepLabel?)` und `Done()` |
|
|
405
|
-
| `PlaySignal(signal?)` | Vorgabe-
|
|
406
|
-
| `PlaySound(sample, options?)` | Benanntes Sample aus dem Sound-Atlas; `options.loop` wiederholt bis `StopSound` |
|
|
449
|
+
| `PlaySignal(signal?)` | Vorgabe oder Schema-Name; Presets: `'success'`→`taskSuccess`, `'error'`→`taskFailed`, `'attention'`→`requestAlert` |
|
|
450
|
+
| `PlaySound(sample, options?)` | Benanntes Sample aus dem Sound-Atlas (z. B. `taskStart`, `requestInfo`); `options.loop` wiederholt bis `StopSound` |
|
|
407
451
|
| `StopSound(sample)` | Stoppt eine Schleife von `PlaySound(sample, { loop: true })` |
|
|
452
|
+
| `RegisterDashboardFont(spec)` | Registriert einen Workspace-Font für Dashboard-Task-Icons / Run-Log (`id`, `file`, optional `family` / `usage`: `task-icons`\|`log`\|`all`) |
|
|
453
|
+
| `GetRegisteredDashboardFonts()` | Snapshot der in diesem Prozess registrierten Fonts (Scan-Worker / Tests) |
|
|
454
|
+
| `ClearRegisteredDashboardFonts()` | Leert die In-Process-Registry (Tests) |
|
|
408
455
|
| `Speak(text, options?)` | Sprachausgabe im Dashboard; `options`: `{ rate?, pitch?, volume? }` je Aufruf |
|
|
409
456
|
| `RequestForm(form)` | Komplettes Formular anfordern; löst mit `{ fieldId: value, … }` auf |
|
|
410
457
|
| `ShowModalMessage(spec)` | Blockierendes Modal (`info`/`warning`/`error`); `presentation`: `webview` \| `ide` \| `auto` |
|
|
@@ -438,6 +485,25 @@ MAKE_BUILDS.µDisplayName = 'Make Build V<version/><context="µDisplayName"/>'.i
|
|
|
438
485
|
// => „Make Build V1.13“ im Dashboard (pro Sprache übersetzbar)
|
|
439
486
|
```
|
|
440
487
|
|
|
488
|
+
### Dashboard-Fonts (Task-Icons & Run-Log)
|
|
489
|
+
|
|
490
|
+
Projekt-Fonts sind unabhängig vom Dashboard-Skin. Beim Laden des Gulpfiles registrieren:
|
|
491
|
+
|
|
492
|
+
```javascript
|
|
493
|
+
import { RegisterDashboardFont } from 'gulp-mu-gulp-api';
|
|
494
|
+
|
|
495
|
+
RegisterDashboardFont({
|
|
496
|
+
id: 'ProjectIcons',
|
|
497
|
+
file: 'assets/task-icons.woff2', // relativ zum Gulpfile-Ordner
|
|
498
|
+
usage: 'task-icons', // oder 'log' / 'all'
|
|
499
|
+
});
|
|
500
|
+
|
|
501
|
+
BUILD.µIcon = '\uE101';
|
|
502
|
+
BUILD.µIconFont = 'ProjectIcons'; // optional, wenn nur ein task-icons-Font registriert ist
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
Alternativ `µDashboardFonts` aus dem Gulpfile exportieren oder `dashboardFonts` in `microgulp.config.json` / Setting `microgulp.dashboardFonts`. Dateien müssen unter dem Workspace liegen (`woff2` / `woff` / `ttf` / `otf`). Der erste `task-icons`-Font ist Default für Glyph-`µIcon`; `usage: 'log'` setzt die Run-Log-Schrift.
|
|
506
|
+
|
|
441
507
|
### Feldtypen (für `RequestForm`)
|
|
442
508
|
|
|
443
509
|
Ein Feld-Deskriptor ist `{ id, type, label, default?, options?, validate?, min?, max?, step?, rows?, placeholder? }`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gulp-mu-gulp-api",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.13",
|
|
4
4
|
"description": "Public task API for the µGulp orchestrator: progress reporting, sound signals, speech output, localized console output (i18x) and interactive UI inputs (text, password, number, textarea, color, font, select, radio, multi-select checkbox, range slider, date/time, file) from within gulp tasks — with graceful CLI fallbacks when running without µGulp.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.mjs",
|
package/src/index.mjs
CHANGED
|
@@ -287,29 +287,35 @@ export function LogChart(_spec) {
|
|
|
287
287
|
/**
|
|
288
288
|
* Plays an acoustic signal in the µGulp dashboard (WebAudio, respects the
|
|
289
289
|
* dashboard audio settings: mute/volume). CLI fallback: terminal bell for
|
|
290
|
-
* 'attention'
|
|
290
|
+
* 'attention' / 'error' (and their schema aliases) on a TTY, silent otherwise.
|
|
291
291
|
*
|
|
292
|
-
*
|
|
292
|
+
* Presets map to atlas samples: `success`→`taskSuccess`, `error`→`taskFailed`,
|
|
293
|
+
* `attention`→`requestAlert`. New schema names (`taskStart`, `requestInfo`, …)
|
|
294
|
+
* are also accepted.
|
|
295
|
+
*
|
|
296
|
+
* @param {string} [_signal]
|
|
293
297
|
*/
|
|
294
298
|
export function PlaySignal(_signal = 'attention') {
|
|
295
299
|
if (IsMicroGulp()) {
|
|
296
300
|
process.send({ type: 'sound', signal: _signal });
|
|
297
301
|
return;
|
|
298
302
|
}
|
|
299
|
-
|
|
303
|
+
let key = String(_signal ?? '').trim();
|
|
304
|
+
if (process.stdout.isTTY && (key === 'attention' || key === 'error' || key === 'requestAlert' || key === 'taskFailed')) {
|
|
300
305
|
process.stdout.write('\u0007');
|
|
301
306
|
}
|
|
302
307
|
}
|
|
303
308
|
|
|
304
309
|
/**
|
|
305
310
|
* Plays a named sample from the dashboard sound atlas (µAU). Sample names match
|
|
306
|
-
* the files bundled with µGulp (
|
|
307
|
-
*
|
|
308
|
-
*
|
|
311
|
+
* the files bundled with µGulp (see `dev/docs/MicroGulpSoundSchema.md`), e.g.
|
|
312
|
+
* `taskSuccess`, `taskFailed`, `requestAlert`, or custom atlas entries in a
|
|
313
|
+
* consumer theme pack. When `loop` is true the sample repeats until
|
|
314
|
+
* `StopSound(sample)` is called.
|
|
309
315
|
*
|
|
310
316
|
* CLI fallback: logs `[sound] <name>` on a TTY, silent otherwise.
|
|
311
317
|
*
|
|
312
|
-
* @param {string} _sample atlas sample name (e.g. `'
|
|
318
|
+
* @param {string} _sample atlas sample name (e.g. `'taskSuccess'`)
|
|
313
319
|
* @param {object} [_options]
|
|
314
320
|
* @param {boolean} [_options.loop] repeat until stopped (default `false`)
|
|
315
321
|
*/
|
|
@@ -800,10 +806,62 @@ export function NotifyTasksChanged() {
|
|
|
800
806
|
}
|
|
801
807
|
}
|
|
802
808
|
|
|
809
|
+
// -------------------------------------------------
|
|
810
|
+
// dashboard fonts (task icons / run log)
|
|
811
|
+
// -------------------------------------------------
|
|
812
|
+
|
|
813
|
+
/** @type {Map<string, { id: string, file: string, family?: string, usage?: string|string[] }>} */
|
|
814
|
+
const registeredDashboardFonts = new Map();
|
|
815
|
+
|
|
816
|
+
/**
|
|
817
|
+
* Registers a project font for the µGulp dashboard. Call at gulpfile load
|
|
818
|
+
* time (top-level). The scan worker forwards the registry to the engine;
|
|
819
|
+
* the host serves the file into the webview / HTTP dashboard.
|
|
820
|
+
*
|
|
821
|
+
* @param {object} _spec
|
|
822
|
+
* @param {string} _spec.id stable id (also default CSS `font-family`)
|
|
823
|
+
* @param {string} _spec.file path relative to the gulpfile directory (or absolute under the workspace)
|
|
824
|
+
* @param {string} [_spec.family] CSS font-family name (default: id)
|
|
825
|
+
* @param {string|string[]} [_spec.usage] `'task-icons'`, `'log'`, or `'all'` (default: task-icons)
|
|
826
|
+
*
|
|
827
|
+
* @example
|
|
828
|
+
* RegisterDashboardFont({ id: 'ProjectIcons', file: 'assets/icons.woff2', usage: 'task-icons' });
|
|
829
|
+
* BUILD.µIcon = '\uE001';
|
|
830
|
+
* BUILD.µIconFont = 'ProjectIcons'; // optional when only one task-icons font is registered
|
|
831
|
+
*/
|
|
832
|
+
export function RegisterDashboardFont(_spec) {
|
|
833
|
+
if (_spec == null || typeof _spec !== 'object') return;
|
|
834
|
+
let id = String(_spec.id ?? '').trim();
|
|
835
|
+
if (!id) return;
|
|
836
|
+
let file = String(_spec.file ?? _spec.path ?? '').trim();
|
|
837
|
+
if (!file) return;
|
|
838
|
+
let entry = { id, file };
|
|
839
|
+
if (_spec.family != null) entry.family = String(_spec.family);
|
|
840
|
+
if (_spec.usage != null) entry.usage = _spec.usage;
|
|
841
|
+
registeredDashboardFonts.set(id, entry);
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* Snapshot of fonts registered via {@link RegisterDashboardFont} in this
|
|
846
|
+
* process (used by the µGulp scan worker). Safe to call outside µGulp.
|
|
847
|
+
* @returns {object[]}
|
|
848
|
+
*/
|
|
849
|
+
export function GetRegisteredDashboardFonts() {
|
|
850
|
+
return [...registeredDashboardFonts.values()].map((_entry) => ({ ..._entry }));
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
/** Clears the in-process registry (tests). */
|
|
854
|
+
export function ClearRegisteredDashboardFonts() {
|
|
855
|
+
registeredDashboardFonts.clear();
|
|
856
|
+
}
|
|
857
|
+
|
|
803
858
|
export default {
|
|
804
859
|
IsMicroGulp,
|
|
805
860
|
IsµGulp,
|
|
806
861
|
NotifyTasksChanged,
|
|
862
|
+
RegisterDashboardFont,
|
|
863
|
+
GetRegisteredDashboardFonts,
|
|
864
|
+
ClearRegisteredDashboardFonts,
|
|
807
865
|
ReportProgress,
|
|
808
866
|
CreateProgress,
|
|
809
867
|
PlaySignal,
|