@gandalan/weblibs 2.0.11 → 2.0.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 CHANGED
@@ -17,9 +17,10 @@
17
17
  ### NeherApp3-Hosttypen
18
18
  `api/neherApp3Types.js` ist die Master-Referenz fuer die Vertraege der
19
19
  NeherApp3-Rahmen-App: `NeherApp3` (Host-API), `NeherApp3Module` (Modul-Einstieg),
20
- `NeherApp3Messages` (In-Realm-Nachrichtenbus) und `NeherApp3I18n`
20
+ `NeherApp3Messages` (In-Realm-Nachrichtenbus), `NeherApp3I18n`
21
21
  (Lokalisierung: `localize` als Funktion *und* Svelte-Action, Modul-Kataloge,
22
- sprachrichtige Sortierung). Die Datei enthaelt nur Typen und wird von Hand
22
+ sprachrichtige Sortierung) und `NeherApp3Theme` (Hell-/Dunkel-Modus; Module im
23
+ Shadow DOM liefern beide Themes mit, das `data-theme` setzt die Rahmen-App). Die Datei enthaelt nur Typen und wird von Hand
23
24
  gepflegt; die Leitfaeden liegen im NeherApp3-Repository
24
25
  (`docs/MODULE.md`, `docs/MESSAGING.md`, `docs/I18N.md`).
25
26
 
@@ -113,6 +113,7 @@
113
113
  * @property {string} BelegPositionGuid
114
114
  * @property {string} RawDataFileContent
115
115
  * @property {ProduktionsDatenDTO} ProduktionsDaten
116
+ * @property {string} Meldung
116
117
  */
117
118
 
118
119
  /**
@@ -85,7 +85,7 @@
85
85
  * @property {(node: HTMLElement, props: NeherApp3SetupContext) => void | function} [mount] - Must return an optional unmount function
86
86
  * @property {string} [embedUrl]
87
87
  * @property {string[]} [extraCSS]
88
- * @property {boolean} [useShadowDom] - If true, the app will be embedded in a shadow DOM. This is required for CSS isolation.
88
+ * @property {boolean} [useShadowDom] - If true, the app will be embedded in a shadow DOM. This is required for CSS isolation. The module then ships all of its styles itself — including **both** themes (`neher`, `neher-dark`), because the shell mirrors `data-theme` onto the module's root inside the shadow root (see `NeherApp3Theme`).
89
89
  */
90
90
 
91
91
  /**
@@ -355,6 +355,43 @@
355
355
  * @property {() => void} clearCache - Discard the cached profiles, so the next lookup asks again.
356
356
  */
357
357
 
358
+ /**
359
+ * Theme handle, exposed at `neherapp3.theme`.
360
+ *
361
+ * The shell writes the resolved theme name to `data-theme` on `<html>`, so
362
+ * anything in the light DOM follows it by inheritance. **Inside a Shadow DOM
363
+ * module it does not**: an attribute selector never crosses the shadow
364
+ * boundary, and the module's own `:host` rules override the inherited custom
365
+ * properties — a module built with the shell's daisyUI setup would stay light
366
+ * forever. The shell therefore mirrors `data-theme` onto the module's root
367
+ * element inside the shadow root and keeps it in sync; a module only needs to
368
+ * ship both themes (`neher`, `neher-dark`) in its stylesheet.
369
+ *
370
+ * `subscribe` is for consumers without Svelte reactivity (and for reacting to
371
+ * a switch, e.g. to repaint a canvas or reload a themed asset).
372
+ * @typedef {Object} NeherApp3Theme
373
+ * @property {NeherApp3ThemeName} current - Active, resolved theme name (reactive).
374
+ * @property {NeherApp3ThemePreference} preference - Stored choice, including `"system"` (reactive).
375
+ * @property {boolean} isDark - Shorthand for `current === "neher-dark"` (reactive).
376
+ * @property {(preference: NeherApp3ThemePreference) => void} set - Store a preference and apply it.
377
+ * @property {() => void} toggle - Switch light/dark as an explicit choice (replaces `"system"`).
378
+ * @property {(listener: (theme: NeherApp3ThemeName) => void) => (() => void)} subscribe - Listen for theme changes; called immediately with the current theme, returns an unsubscribe function.
379
+ * @property {"neher"} LIGHT - Theme name of the light mode.
380
+ * @property {"neher-dark"} DARK - Theme name of the dark mode.
381
+ * @property {"system"} SYSTEM - Preference "follow the operating system".
382
+ */
383
+
384
+ /**
385
+ * Resolved theme name — the value of the `data-theme` attribute.
386
+ * @typedef {"neher" | "neher-dark"} NeherApp3ThemeName
387
+ */
388
+
389
+ /**
390
+ * Stored theme choice: a theme name, or `"system"` to follow
391
+ * `prefers-color-scheme` live.
392
+ * @typedef {NeherApp3ThemeName | "system"} NeherApp3ThemePreference
393
+ */
394
+
358
395
  /**
359
396
  * @typedef {Object} NeherApp3
360
397
  * @property {(menuItem: NeherApp3MenuItem) => void} addMenuItem - Adds a menu item. If an item with the same `id` already exists it is replaced.
@@ -369,6 +406,7 @@
369
406
  * @property {Localize} localize - Shorthand for `i18n.localize` (namespace `shell`): a function for strings, a `use:` action for elements.
370
407
  * @property {NeherApp3Settings} settings - Per-user settings, stored in the database (not `localStorage`).
371
408
  * @property {NeherApp3Profile} profile - The signed-in user: identity from the IDAS token plus the platform's own profile fields (avatar, job title, …).
409
+ * @property {NeherApp3Theme} theme - Light/dark mode: the active theme, the stored preference, and a subscription for theme changes.
372
410
  * @property {boolean} isEmbedded - Indicates if the app is embedded inside i3
373
411
  */
374
412
 
package/index.d.ts CHANGED
@@ -834,6 +834,7 @@ export type BerechnungResultDTO = {
834
834
  BelegPositionGuid: string;
835
835
  RawDataFileContent: string;
836
836
  ProduktionsDaten: ProduktionsDatenDTO;
837
+ Meldung: string;
837
838
  };
838
839
 
839
840
  export type BerechtigungDTO = {
@@ -2079,6 +2080,7 @@ export type NeherApp3 = {
2079
2080
  localize: Localize;
2080
2081
  settings: NeherApp3Settings;
2081
2082
  profile: NeherApp3Profile;
2083
+ theme: NeherApp3Theme;
2082
2084
  isEmbedded: boolean;
2083
2085
  };
2084
2086
 
@@ -2232,6 +2234,22 @@ export type NeherApp3SettingsHandle = {
2232
2234
 
2233
2235
  export type NeherApp3SetupContext = NeherApp3Props & { neherapp3: NeherApp3 };
2234
2236
 
2237
+ export type NeherApp3Theme = {
2238
+ current: NeherApp3ThemeName;
2239
+ preference: NeherApp3ThemePreference;
2240
+ isDark: boolean;
2241
+ set: (preference: NeherApp3ThemePreference) => void;
2242
+ toggle: () => void;
2243
+ subscribe: (listener: (theme: NeherApp3ThemeName) => void) => (() => void);
2244
+ LIGHT: "neher";
2245
+ DARK: "neher-dark";
2246
+ SYSTEM: "system";
2247
+ };
2248
+
2249
+ export type NeherApp3ThemeName = "neher" | "neher-dark";
2250
+
2251
+ export type NeherApp3ThemePreference = NeherApp3ThemeName | "system";
2252
+
2235
2253
  export type NeherMessage = {
2236
2254
  id: string;
2237
2255
  type: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gandalan/weblibs",
3
- "version": "2.0.11",
3
+ "version": "2.0.13",
4
4
  "description": "WebLibs for Gandalan JS/TS projects",
5
5
  "keywords": [
6
6
  "gandalan"