gulp-mu-gulp-api 0.3.11 → 0.3.12

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.
Files changed (3) hide show
  1. package/README.md +60 -2
  2. package/package.json +1 -1
  3. package/src/index.mjs +52 -0
package/README.md CHANGED
@@ -37,6 +37,13 @@ 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.12
41
+
42
+ - **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.
43
+ - **Added** `GetRegisteredDashboardFonts()` / `ClearRegisteredDashboardFonts()` — snapshot / test helpers.
44
+ - 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.
45
+ - Outside µGulp the helpers are no-ops (fonts are a dashboard/host concern).
46
+
40
47
  ### 0.3.11
41
48
 
42
49
  - **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 +96,7 @@ npm install gulp-mu-gulp-api
89
96
  ## Usage
90
97
 
91
98
  ```javascript
92
- import { ReportProgress, CreateProgress, PlaySignal, PlaySound, StopSound, Speak, RequestTextInput, RequestColorInput, RequestFontInput, RequestSelectInput, RequestMultiSelectInput, RequestForm, IsMicroGulp, IsµGulp, InstallStringExtensions } from 'gulp-mu-gulp-api';
99
+ import { ReportProgress, CreateProgress, PlaySignal, PlaySound, StopSound, Speak, RequestTextInput, RequestColorInput, RequestFontInput, RequestSelectInput, RequestMultiSelectInput, RequestForm, RegisterDashboardFont, IsMicroGulp, IsµGulp, InstallStringExtensions } from 'gulp-mu-gulp-api';
93
100
 
94
101
  // Enables "phrase<context=\"…\"/>".i18xRegister()/.i18xTrans() on strings.
95
102
  InstallStringExtensions();
@@ -161,6 +168,9 @@ let values = await RequestForm({
161
168
  | `PlaySignal(signal?)` | Preset acoustic signal: `'success'` \| `'error'` \| `'attention'` (default) |
162
169
  | `PlaySound(sample, options?)` | Named sample from the dashboard sound atlas; `options.loop` repeats until `StopSound` |
163
170
  | `StopSound(sample)` | Stops a looping sample started with `PlaySound(sample, { loop: true })` |
171
+ | `RegisterDashboardFont(spec)` | Registers a workspace font for dashboard task icons / run-log (`id`, `file`, optional `family` / `usage`: `task-icons`\|`log`\|`all`) |
172
+ | `GetRegisteredDashboardFonts()` | Snapshot of fonts registered in this process (scan worker / tests) |
173
+ | `ClearRegisteredDashboardFonts()` | Clears the in-process registry (tests) |
164
174
  | `Speak(text, options?)` | Speech output in the dashboard; `options`: `{ rate?, pitch?, volume? }` per-call overrides |
165
175
  | `RequestForm(form)` | Request a complete form; resolves with `{ fieldId: value, … }` |
166
176
  | `ShowModalMessage(spec)` | Blocking modal (`info`/`warning`/`error`); `presentation`: `webview` \| `ide` \| `auto` |
@@ -194,6 +204,25 @@ MAKE_BUILDS.µDisplayName = 'Make Build V<version/><context="µDisplayName"/>'.i
194
204
  // => "Make Build V1.13" in the dashboard (translatable per language)
195
205
  ```
196
206
 
207
+ ### Dashboard fonts (task icons & run log)
208
+
209
+ Project fonts are independent of the dashboard skin. Register them at gulpfile load time:
210
+
211
+ ```javascript
212
+ import { RegisterDashboardFont } from 'gulp-mu-gulp-api';
213
+
214
+ RegisterDashboardFont({
215
+ id: 'ProjectIcons',
216
+ file: 'assets/task-icons.woff2', // relative to the gulpfile directory
217
+ usage: 'task-icons', // or 'log' / 'all'
218
+ });
219
+
220
+ BUILD.µIcon = '\uE101';
221
+ BUILD.µIconFont = 'ProjectIcons'; // optional when only one task-icons font is registered
222
+ ```
223
+
224
+ 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.
225
+
197
226
  ### Field types (for `RequestForm`)
198
227
 
199
228
  A field descriptor is `{ id, type, label, default?, options?, validate?, min?, max?, step?, rows?, placeholder? }`.
@@ -281,6 +310,13 @@ Das Modul ist bewusst **abhängigkeitsfrei** und kennt keine µGulp™-Interna:
281
310
  npm install gulp-mu-gulp-api
282
311
  ```
283
312
 
313
+ ### 0.3.12
314
+
315
+ - **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.
316
+ - **Neu** `GetRegisteredDashboardFonts()` / `ClearRegisteredDashboardFonts()` — Snapshot- bzw. Test-Helfer.
317
+ - Zusammen mit Metadaten `µIcon` (Glyph) und optional `µIconFont = '<id>'`, oder deklarativ `export const µDashboardFonts = […]`. Alternative: `dashboardFonts` in Config/Setting.
318
+ - Außerhalb von µGulp sind die Helfer No-ops (Fonts sind Sache von Dashboard/Host).
319
+
284
320
  ### 0.3.11
285
321
 
286
322
  - **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 +369,7 @@ npm install gulp-mu-gulp-api
333
369
  ## Verwendung
334
370
 
335
371
  ```javascript
336
- import { ReportProgress, CreateProgress, PlaySignal, PlaySound, StopSound, Speak, RequestTextInput, RequestColorInput, RequestFontInput, RequestSelectInput, RequestMultiSelectInput, RequestForm, IsMicroGulp, IsµGulp, InstallStringExtensions } from 'gulp-mu-gulp-api';
372
+ import { ReportProgress, CreateProgress, PlaySignal, PlaySound, StopSound, Speak, RequestTextInput, RequestColorInput, RequestFontInput, RequestSelectInput, RequestMultiSelectInput, RequestForm, RegisterDashboardFont, IsMicroGulp, IsµGulp, InstallStringExtensions } from 'gulp-mu-gulp-api';
337
373
 
338
374
  // Enables "phrase<context=\"…\"/>".i18xRegister()/.i18xTrans() on strings.
339
375
  InstallStringExtensions();
@@ -405,6 +441,9 @@ let values = await RequestForm({
405
441
  | `PlaySignal(signal?)` | Vorgabe-Signal: `'success'` \| `'error'` \| `'attention'` (Default) |
406
442
  | `PlaySound(sample, options?)` | Benanntes Sample aus dem Sound-Atlas; `options.loop` wiederholt bis `StopSound` |
407
443
  | `StopSound(sample)` | Stoppt eine Schleife von `PlaySound(sample, { loop: true })` |
444
+ | `RegisterDashboardFont(spec)` | Registriert einen Workspace-Font für Dashboard-Task-Icons / Run-Log (`id`, `file`, optional `family` / `usage`: `task-icons`\|`log`\|`all`) |
445
+ | `GetRegisteredDashboardFonts()` | Snapshot der in diesem Prozess registrierten Fonts (Scan-Worker / Tests) |
446
+ | `ClearRegisteredDashboardFonts()` | Leert die In-Process-Registry (Tests) |
408
447
  | `Speak(text, options?)` | Sprachausgabe im Dashboard; `options`: `{ rate?, pitch?, volume? }` je Aufruf |
409
448
  | `RequestForm(form)` | Komplettes Formular anfordern; löst mit `{ fieldId: value, … }` auf |
410
449
  | `ShowModalMessage(spec)` | Blockierendes Modal (`info`/`warning`/`error`); `presentation`: `webview` \| `ide` \| `auto` |
@@ -438,6 +477,25 @@ MAKE_BUILDS.µDisplayName = 'Make Build V<version/><context="µDisplayName"/>'.i
438
477
  // => „Make Build V1.13“ im Dashboard (pro Sprache übersetzbar)
439
478
  ```
440
479
 
480
+ ### Dashboard-Fonts (Task-Icons & Run-Log)
481
+
482
+ Projekt-Fonts sind unabhängig vom Dashboard-Skin. Beim Laden des Gulpfiles registrieren:
483
+
484
+ ```javascript
485
+ import { RegisterDashboardFont } from 'gulp-mu-gulp-api';
486
+
487
+ RegisterDashboardFont({
488
+ id: 'ProjectIcons',
489
+ file: 'assets/task-icons.woff2', // relativ zum Gulpfile-Ordner
490
+ usage: 'task-icons', // oder 'log' / 'all'
491
+ });
492
+
493
+ BUILD.µIcon = '\uE101';
494
+ BUILD.µIconFont = 'ProjectIcons'; // optional, wenn nur ein task-icons-Font registriert ist
495
+ ```
496
+
497
+ 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.
498
+
441
499
  ### Feldtypen (für `RequestForm`)
442
500
 
443
501
  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.11",
3
+ "version": "0.3.12",
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
@@ -800,10 +800,62 @@ export function NotifyTasksChanged() {
800
800
  }
801
801
  }
802
802
 
803
+ // -------------------------------------------------
804
+ // dashboard fonts (task icons / run log)
805
+ // -------------------------------------------------
806
+
807
+ /** @type {Map<string, { id: string, file: string, family?: string, usage?: string|string[] }>} */
808
+ const registeredDashboardFonts = new Map();
809
+
810
+ /**
811
+ * Registers a project font for the µGulp dashboard. Call at gulpfile load
812
+ * time (top-level). The scan worker forwards the registry to the engine;
813
+ * the host serves the file into the webview / HTTP dashboard.
814
+ *
815
+ * @param {object} _spec
816
+ * @param {string} _spec.id stable id (also default CSS `font-family`)
817
+ * @param {string} _spec.file path relative to the gulpfile directory (or absolute under the workspace)
818
+ * @param {string} [_spec.family] CSS font-family name (default: id)
819
+ * @param {string|string[]} [_spec.usage] `'task-icons'`, `'log'`, or `'all'` (default: task-icons)
820
+ *
821
+ * @example
822
+ * RegisterDashboardFont({ id: 'ProjectIcons', file: 'assets/icons.woff2', usage: 'task-icons' });
823
+ * BUILD.µIcon = '\uE001';
824
+ * BUILD.µIconFont = 'ProjectIcons'; // optional when only one task-icons font is registered
825
+ */
826
+ export function RegisterDashboardFont(_spec) {
827
+ if (_spec == null || typeof _spec !== 'object') return;
828
+ let id = String(_spec.id ?? '').trim();
829
+ if (!id) return;
830
+ let file = String(_spec.file ?? _spec.path ?? '').trim();
831
+ if (!file) return;
832
+ let entry = { id, file };
833
+ if (_spec.family != null) entry.family = String(_spec.family);
834
+ if (_spec.usage != null) entry.usage = _spec.usage;
835
+ registeredDashboardFonts.set(id, entry);
836
+ }
837
+
838
+ /**
839
+ * Snapshot of fonts registered via {@link RegisterDashboardFont} in this
840
+ * process (used by the µGulp scan worker). Safe to call outside µGulp.
841
+ * @returns {object[]}
842
+ */
843
+ export function GetRegisteredDashboardFonts() {
844
+ return [...registeredDashboardFonts.values()].map((_entry) => ({ ..._entry }));
845
+ }
846
+
847
+ /** Clears the in-process registry (tests). */
848
+ export function ClearRegisteredDashboardFonts() {
849
+ registeredDashboardFonts.clear();
850
+ }
851
+
803
852
  export default {
804
853
  IsMicroGulp,
805
854
  IsµGulp,
806
855
  NotifyTasksChanged,
856
+ RegisterDashboardFont,
857
+ GetRegisteredDashboardFonts,
858
+ ClearRegisteredDashboardFonts,
807
859
  ReportProgress,
808
860
  CreateProgress,
809
861
  PlaySignal,