@ngx-smz/layout 21.1.4 → 21.1.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngx-smz/layout",
3
- "version": "21.1.4",
3
+ "version": "21.1.20",
4
4
  "peerDependencies": {},
5
5
  "dependencies": {
6
6
  "tslib": "^2.3.0"
@@ -197,17 +197,25 @@ interface Footer {
197
197
  copyright?: string;
198
198
  }
199
199
 
200
- type SmzUILayoutConfigType = {
200
+ interface SmzUILayoutConfigType {
201
201
  sidebar: WritableSignal<MenuItem[]>;
202
202
  footer: WritableSignal<Footer>;
203
203
  topbar: WritableSignal<Topbar>;
204
204
  layout: WritableSignal<LayoutConfig>;
205
205
  state: WritableSignal<LayoutState>;
206
206
  hasClaim?: (claims: string[]) => boolean;
207
- };
207
+ }
208
208
  declare class SmzUILayout {
209
- hasClaim: (claims: string[]) => boolean;
210
- sidebar: WritableSignal<MenuItem[]>;
209
+ /**
210
+ * Writable menu graph from the host (`SMZ_UI_LAYOUT_CONFIG.sidebar`). Mutations here trigger {@link sidebar}.
211
+ */
212
+ sidebarWritable: WritableSignal<MenuItem[]>;
213
+ /**
214
+ * Menu prepared for shells such as Hephaestus: entries denied by {@link SmzUILayoutConfigType.hasClaim}
215
+ * use `visible: false` so templates only need visibility rules.
216
+ */
217
+ readonly sidebar: i0.Signal<MenuItem[]>;
218
+ private layoutFeature;
211
219
  footer: WritableSignal<Footer>;
212
220
  topbar: WritableSignal<Topbar>;
213
221
  layout: WritableSignal<LayoutConfig>;
@@ -218,7 +226,68 @@ declare class SmzUILayout {
218
226
  }
219
227
 
220
228
  declare const SMZ_UI_LAYOUT_CONFIG: InjectionToken<SmzUILayoutConfigType>;
221
- declare function provideSmzUILayout(initializers: (() => SmzUILayoutConfigType[])): EnvironmentProviders;
229
+ /**
230
+ * Fluent configuration for layout provisioning.
231
+ *
232
+ * Prefer granular `.withSidebar()`, `.withFooter()`, … for readability, or `.withFeatures()`
233
+ * when you already expose an assembled {@link SmzUILayoutConfigType} (including multi-feature arrays).
234
+ *
235
+ * @example
236
+ * ```ts
237
+ * configureSmzUILayout()
238
+ * .withSidebar(appSidebar)
239
+ * .withFooter(appFooter)
240
+ * .withTopbar(appTopbar)
241
+ * .withLayout(appLayout)
242
+ * .withLayoutState(appLayoutState)
243
+ * .withMenuAuthorization(() => {
244
+ * const access = inject(AccessControlService);
245
+ * return (claims) => access.hasClaim(claims);
246
+ * })
247
+ * .build()
248
+ * ```
249
+ */
250
+ declare class SmzUILayoutProvisionBuilder {
251
+ private featuresFactory?;
252
+ private menuAuthorizationFactory?;
253
+ private sidebarSignal?;
254
+ private footerSignal?;
255
+ private topbarSignal?;
256
+ private layoutSignal?;
257
+ private layoutStateSignal?;
258
+ private hasGranularSlots;
259
+ private assertNotUsingFeaturesFactory;
260
+ /**
261
+ * Sync factory returning one or more assembled layout feature objects (advanced / legacy).
262
+ * Cannot use `inject()` here — only plain values and module-scope signals.
263
+ * Do not combine with `.withSidebar()` / `.withFooter()` / …
264
+ */
265
+ withFeatures(factory: () => SmzUILayoutConfigType[]): this;
266
+ withSidebar(sidebar: WritableSignal<MenuItem[]>): this;
267
+ withFooter(footer: WritableSignal<Footer>): this;
268
+ withTopbar(topbar: WritableSignal<Topbar>): this;
269
+ /** Writable layout chrome config (preset, theme flags, menu mode, …). */
270
+ withLayout(layout: WritableSignal<LayoutConfig>): this;
271
+ /** Writable overlay / sidebar UI state for the Prime layout shell. */
272
+ withLayoutState(state: WritableSignal<LayoutState>): this;
273
+ /**
274
+ * Runs during app bootstrap (injection context). Use `inject()` to resolve services,
275
+ * then return the predicate assigned to `SMZ_UI_LAYOUT_CONFIG.hasClaim`.
276
+ */
277
+ withMenuAuthorization(factory: () => (claims: string[]) => boolean): this;
278
+ build(): EnvironmentProviders;
279
+ }
280
+ /** Starts a fluent {@link SmzUILayoutProvisionBuilder}; finish with `.build()`. */
281
+ declare function configureSmzUILayout(): SmzUILayoutProvisionBuilder;
282
+ /**
283
+ * Registers layout feature objects and applies them on bootstrap.
284
+ *
285
+ * Prefer {@link configureSmzUILayout} with granular `.withSidebar()` / … for readability.
286
+ *
287
+ * @param resolveHasClaim Optional factory run **during app initialization** (injection context).
288
+ */
289
+ declare function provideSmzUILayout(initializers: () => SmzUILayoutConfigType[]): EnvironmentProviders;
290
+ declare function provideSmzUILayout(initializers: () => SmzUILayoutConfigType[], resolveHasClaim: () => (claims: string[]) => boolean): EnvironmentProviders;
222
291
 
223
292
  declare class AppFloatingConfigurator {
224
293
  LayoutService: LayoutService;
@@ -349,5 +418,5 @@ declare class LoggingService {
349
418
  static ɵprov: i0.ɵɵInjectableDeclaration<LoggingService>;
350
419
  }
351
420
 
352
- export { AccessPageComponent, AppFloatingConfigurator, AppLayout, ErrorPageComponent, ErrorPagesConfigService, ErrorsRoutes, LayoutService, LoggingScope, LoggingService, NotfoundPageComponent, SMZ_LAYOUT_LOGGING_CONFIG, SMZ_UI_LAYOUT_CONFIG, SmzLayoutLogging, SmzUILayout, provideSmzLayoutLogging, provideSmzUILayout };
421
+ export { AccessPageComponent, AppFloatingConfigurator, AppLayout, ErrorPageComponent, ErrorPagesConfigService, ErrorsRoutes, LayoutService, LoggingScope, LoggingService, NotfoundPageComponent, SMZ_LAYOUT_LOGGING_CONFIG, SMZ_UI_LAYOUT_CONFIG, SmzLayoutLogging, SmzUILayout, SmzUILayoutProvisionBuilder, configureSmzUILayout, provideSmzLayoutLogging, provideSmzUILayout };
353
422
  export type { Footer, LayoutConfig, LayoutState, LoggingConfig, ScopedLogger, SmzLayoutLoggingConfigType, SmzUILayoutConfigType, Topbar };