@filip.mazev/blocks 1.2.10 → 1.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@filip.mazev/blocks",
3
- "version": "1.2.10",
3
+ "version": "1.2.12",
4
4
  "license": "MIT",
5
5
  "schematics": "./schematics/collection.json",
6
6
  "exports": {
@@ -35,6 +35,10 @@
35
35
  "types": "./types/filip.mazev-blocks-modal.d.ts",
36
36
  "default": "./fesm2022/filip.mazev-blocks-modal.mjs"
37
37
  },
38
+ "./navigation": {
39
+ "types": "./types/filip.mazev-blocks-navigation.d.ts",
40
+ "default": "./fesm2022/filip.mazev-blocks-navigation.mjs"
41
+ },
38
42
  "./toastr": {
39
43
  "types": "./types/filip.mazev-blocks-toastr.d.ts",
40
44
  "default": "./fesm2022/filip.mazev-blocks-toastr.mjs"
@@ -0,0 +1,5 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ export interface NgAddOptions {
3
+ theme: 'purple' | 'orange' | 'red' | 'green';
4
+ }
5
+ export declare function ngAdd(options: NgAddOptions): Rule;
@@ -1,15 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ngAdd = ngAdd;
4
- const tasks_1 = require("@angular-devkit/schematics/tasks");
5
4
  function ngAdd(options) {
6
5
  return (tree, context) => {
7
6
  injectStyles(tree, context, options);
8
- context.addTask(new tasks_1.NodePackageInstallTask());
9
7
  return tree;
10
8
  };
11
9
  }
12
10
  function injectStyles(tree, context, options) {
11
+ var _a, _b;
13
12
  const workspaceConfigPath = '/angular.json';
14
13
  if (!tree.exists(workspaceConfigPath)) {
15
14
  context.logger.warn('Could not find angular.json. Please configure the Blocks theme manually.');
@@ -25,7 +24,7 @@ function injectStyles(tree, context, options) {
25
24
  context.logger.warn('Could not find a valid project in angular.json.');
26
25
  return;
27
26
  }
28
- const buildOptions = project.architect?.build?.options;
27
+ const buildOptions = (_b = (_a = project.architect) === null || _a === void 0 ? void 0 : _a.build) === null || _b === void 0 ? void 0 : _b.options;
29
28
  if (!buildOptions || !buildOptions.styles) {
30
29
  context.logger.warn(`Could not find styles configuration for project "${projectName}".`);
31
30
  return;
@@ -43,6 +42,7 @@ function injectStyles(tree, context, options) {
43
42
  return;
44
43
  }
45
44
  const content = tree.read(targetStylePath).toString('utf-8');
45
+ // Update the check to look for the new package namespace
46
46
  if (content.includes('@filip.mazev/blocks')) {
47
47
  context.logger.info('Blocks SCSS configuration already exists. Skipping style injection.');
48
48
  return;
@@ -0,0 +1,104 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Signal, InjectionToken } from '@angular/core';
3
+ import { IconData } from '@filip.mazev/blocks/icons';
4
+ import { ActivatedRouteSnapshot, Route } from '@angular/router';
5
+ import { INavMeta as INavMeta$1 } from '@navigation/interfaces/inav-meta.interface';
6
+
7
+ interface IBreadcrumbItem {
8
+ label: string;
9
+ route: string;
10
+ }
11
+
12
+ interface INavContext {
13
+ snapshot: ActivatedRouteSnapshot;
14
+ }
15
+
16
+ interface INavMeta {
17
+ label?: string | ((ctx: INavContext) => string);
18
+ breadcrumb?: string | ((ctx: INavContext) => string);
19
+ labelKey?: string;
20
+ breadcrumbKey?: string;
21
+ icon?: IconData;
22
+ section?: string;
23
+ menu?: boolean;
24
+ hidden?: boolean;
25
+ order?: number;
26
+ root?: boolean;
27
+ visible?: () => boolean;
28
+ }
29
+
30
+ interface INavigationItem {
31
+ id: string;
32
+ route: string;
33
+ label: string;
34
+ icon?: IconData;
35
+ section?: string;
36
+ visible: boolean;
37
+ children?: INavigationItem[];
38
+ data?: INavMeta;
39
+ }
40
+
41
+ interface IResolvedNavigation {
42
+ current?: INavigationItem;
43
+ breadcrumbs: IBreadcrumbItem[];
44
+ }
45
+
46
+ declare class NavigationService {
47
+ private readonly router;
48
+ private readonly config;
49
+ private readonly i18n;
50
+ private readonly _current;
51
+ readonly current: Signal<IResolvedNavigation>;
52
+ readonly routes: Signal<INavigationItem[]>;
53
+ readonly menu: Signal<INavigationItem[]>;
54
+ readonly sections: Signal<{
55
+ items: INavigationItem[];
56
+ id: string;
57
+ title?: string;
58
+ order?: number;
59
+ }[]>;
60
+ constructor();
61
+ private updateCurrent;
62
+ private extractRoutes;
63
+ private resolveCurrent;
64
+ private buildMenu;
65
+ private sortNavigationItems;
66
+ private resolveNavText;
67
+ private urlFromSnapshot;
68
+ static ɵfac: i0.ɵɵFactoryDeclaration<NavigationService, never>;
69
+ static ɵprov: i0.ɵɵInjectableDeclaration<NavigationService>;
70
+ }
71
+
72
+ interface INavRouteData {
73
+ nav?: INavMeta;
74
+ }
75
+
76
+ interface INavigationSectionConfig {
77
+ id: string;
78
+ title?: string;
79
+ order?: number;
80
+ }
81
+
82
+ interface INavigationConfig {
83
+ sections?: INavigationSectionConfig[];
84
+ includeHiddenInBreadcrumbs?: boolean;
85
+ sortItems?: (a: INavigationItem, b: INavigationItem) => number;
86
+ }
87
+
88
+ interface INavigationI18nAdapter {
89
+ translate(key: string, params?: Record<string, unknown>): string;
90
+ version?: Signal<number>;
91
+ }
92
+
93
+ declare const NAVIGATION_CONFIG: InjectionToken<INavigationConfig>;
94
+
95
+ declare const NAVIGATION_I18N: InjectionToken<INavigationI18nAdapter>;
96
+
97
+ declare function provideNavigation(config: INavigationConfig): {
98
+ provide: i0.InjectionToken<INavigationConfig>;
99
+ useValue: INavigationConfig;
100
+ }[];
101
+ declare function withNav(route: Route, nav: INavMeta$1): Route;
102
+
103
+ export { NAVIGATION_CONFIG, NAVIGATION_I18N, NavigationService, provideNavigation, withNav };
104
+ export type { IBreadcrumbItem, INavContext, INavMeta, INavRouteData, INavigationConfig, INavigationI18nAdapter, INavigationItem, INavigationSectionConfig, IResolvedNavigation };
@@ -1,11 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "commonjs",
4
- "target": "es2019",
5
- "outDir": "../dist/blocks/schematics",
6
- "rootDir": "./",
7
- "esModuleInterop": true,
8
- "strict": true
9
- },
10
- "include": ["**/*.ts"]
11
- }