@jdpo2008/ngx-ds 0.1.0 → 0.2.0

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": "@jdpo2008/ngx-ds",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Angular 21 component library: standalone signal-based components with design tokens and an opt-in dark theme.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -33,6 +33,10 @@
33
33
  "tslib": "^2.3.0"
34
34
  },
35
35
  "sideEffects": false,
36
+ "schematics": "./schematics/collection.json",
37
+ "ng-add": {
38
+ "save": "dependencies"
39
+ },
36
40
  "module": "fesm2022/jdpo2008-ngx-ds.mjs",
37
41
  "typings": "types/jdpo2008-ngx-ds.d.ts",
38
42
  "exports": {
@@ -0,0 +1,9 @@
1
+ {
2
+ "schematics": {
3
+ "ng-add": {
4
+ "description": "Sets up @jdpo2008/ngx-ds: adds the design tokens stylesheet and lucide-angular.",
5
+ "factory": "./ng-add/index.cjs#ngAdd",
6
+ "schema": "./ng-add/schema.json"
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.STYLESHEET = void 0;
4
+ exports.ngAdd = ngAdd;
5
+ const node_fs_1 = require("node:fs");
6
+ const node_path_1 = require("node:path");
7
+ const schematics_1 = require("@angular-devkit/schematics");
8
+ const utility_1 = require("@schematics/angular/utility");
9
+ /** Global stylesheet with the design tokens and the dark theme (no Tailwind). */
10
+ exports.STYLESHEET = 'node_modules/@jdpo2008/ngx-ds/styles/ngx-ds.scss';
11
+ function ngAdd(options) {
12
+ return async (tree) => {
13
+ const workspace = await (0, utility_1.readWorkspace)(tree);
14
+ const projectName = options.project ?? onlyApplication(workspace);
15
+ const project = workspace.projects.get(projectName);
16
+ if (!project) {
17
+ throw new schematics_1.SchematicsException(`Project "${projectName}" does not exist in angular.json.`);
18
+ }
19
+ if (project.extensions['projectType'] !== 'application') {
20
+ throw new schematics_1.SchematicsException(`"${projectName}" is a library. Run ng add in an application, or pass --project.`);
21
+ }
22
+ if (!project.targets.get('build')) {
23
+ throw new schematics_1.SchematicsException(`Project "${projectName}" has no build target.`);
24
+ }
25
+ return (0, schematics_1.chain)([
26
+ (0, utility_1.addDependency)('lucide-angular', peerVersion('lucide-angular'), {
27
+ existing: utility_1.ExistingBehavior.Skip,
28
+ }),
29
+ addStylesheet(projectName),
30
+ logNextSteps(),
31
+ ]);
32
+ };
33
+ }
34
+ /** The single application in the workspace, used when no project is given. */
35
+ function onlyApplication(workspace) {
36
+ const apps = [...workspace.projects]
37
+ .filter(([, project]) => project.extensions['projectType'] === 'application')
38
+ .map(([name]) => name);
39
+ if (apps.length !== 1) {
40
+ throw new schematics_1.SchematicsException('Could not tell which application to set up. Pass it with --project.');
41
+ }
42
+ return apps[0];
43
+ }
44
+ /** Version range this release declares for a peer dependency. */
45
+ function peerVersion(name) {
46
+ const pkg = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(__dirname, '../../package.json'), 'utf-8'));
47
+ const version = pkg.peerDependencies?.[name];
48
+ if (!version) {
49
+ throw new schematics_1.SchematicsException(`Missing peer dependency "${name}" in ngx-ds package.json.`);
50
+ }
51
+ return version;
52
+ }
53
+ /** Prepends the stylesheet to the build target's styles (and to test, when it has styles). */
54
+ function addStylesheet(projectName) {
55
+ return (0, utility_1.updateWorkspace)((workspace) => {
56
+ const project = workspace.projects.get(projectName);
57
+ if (!project)
58
+ return;
59
+ for (const [name, target] of project.targets) {
60
+ const required = name === 'build';
61
+ if (!required && !Array.isArray(target.options?.['styles']))
62
+ continue;
63
+ target.options ??= {};
64
+ const styles = (target.options['styles'] ?? []);
65
+ const present = styles.some((entry) => (typeof entry === 'string' ? entry : entry.input) === exports.STYLESHEET);
66
+ if (!present) {
67
+ target.options['styles'] = [exports.STYLESHEET, ...styles];
68
+ }
69
+ }
70
+ });
71
+ }
72
+ function logNextSteps() {
73
+ return (_tree, context) => {
74
+ context.logger.info(`ngx-ds: added ${exports.STYLESHEET} to the styles in angular.json.`);
75
+ context.logger.info('ngx-ds: components use the Poppins font family but do not load it. ' +
76
+ 'Load it in index.html, or set --ngx-primary-font-family to another font.');
77
+ context.logger.info('ngx-ds: labels default to Spanish and dates to es-ES. For English, add ' +
78
+ "provideNgxDs({ locale: 'en-US' }) to your providers.");
79
+ };
80
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "NgxDsNgAdd",
4
+ "title": "ngx-ds ng-add",
5
+ "type": "object",
6
+ "properties": {
7
+ "project": {
8
+ "type": "string",
9
+ "description": "The application to set up.",
10
+ "$default": {
11
+ "$source": "projectName"
12
+ }
13
+ }
14
+ }
15
+ }
@@ -1,5 +1,5 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { InjectionToken, Provider, AfterViewInit, OnDestroy, ElementRef, TemplateRef } from '@angular/core';
2
+ import { InjectionToken, Provider, EnvironmentProviders, AfterViewInit, OnDestroy, ElementRef, TemplateRef } from '@angular/core';
3
3
  import * as lucide_angular from 'lucide-angular';
4
4
  import { LucideIconData } from 'lucide-angular';
5
5
  export { LucideIconData } from 'lucide-angular';
@@ -192,6 +192,30 @@ declare const NGX_DS_LABELS: InjectionToken<NgxDsLabels>;
192
192
  */
193
193
  declare function provideNgxDsLabels(labels: Partial<NgxDsLabels>, base?: NgxDsLabels): Provider;
194
194
 
195
+ /** `'system'` follows the OS setting (`prefers-color-scheme`) and updates when it changes. */
196
+ type NgxDsTheme = 'light' | 'dark' | 'system';
197
+ interface NgxDsConfig {
198
+ /** BCP 47 locale for dates and numbers. Default `'es-ES'`. */
199
+ locale?: string;
200
+ /**
201
+ * Label overrides. Keys you omit come from the English set when `locale` starts
202
+ * with `en`, and from the Spanish set otherwise.
203
+ */
204
+ labels?: Partial<NgxDsLabels>;
205
+ /** Sets `data-theme` on `<html>`. Omit it to manage the theme yourself. */
206
+ theme?: NgxDsTheme;
207
+ }
208
+ /**
209
+ * Configures ngx-ds in one call:
210
+ *
211
+ * ```ts
212
+ * bootstrapApplication(AppComponent, {
213
+ * providers: [provideNgxDs({ locale: 'en-US', theme: 'system' })],
214
+ * });
215
+ * ```
216
+ */
217
+ declare function provideNgxDs(config?: NgxDsConfig): EnvironmentProviders;
218
+
195
219
  /**
196
220
  * Atrapa el foco dentro del elemento host mientras esté en el DOM.
197
221
  * Al inicializarse enfoca `[autofocus]`, el primer focusable o el propio host
@@ -1012,8 +1036,8 @@ declare class RangeSliderComponent implements ControlValueAccessor {
1012
1036
  #private;
1013
1037
  readonly id: string;
1014
1038
  readonly value: _angular_core.ModelSignal<number>;
1015
- readonly min: _angular_core.InputSignal<number>;
1016
- readonly max: _angular_core.InputSignal<number>;
1039
+ readonly min: _angular_core.InputSignalWithTransform<number, number | undefined>;
1040
+ readonly max: _angular_core.InputSignalWithTransform<number, number | undefined>;
1017
1041
  readonly step: _angular_core.InputSignal<number>;
1018
1042
  readonly disabled: _angular_core.InputSignal<boolean>;
1019
1043
  readonly label: _angular_core.InputSignal<string>;
@@ -1133,8 +1157,8 @@ declare class NumberInputComponent implements ControlValueAccessor {
1133
1157
  #private;
1134
1158
  readonly i18n: _jdpo2008_ngx_ds.NgxDsLabels;
1135
1159
  readonly value: _angular_core.ModelSignal<number>;
1136
- readonly min: _angular_core.InputSignal<number | null>;
1137
- readonly max: _angular_core.InputSignal<number | null>;
1160
+ readonly min: _angular_core.InputSignalWithTransform<number | null, number | null | undefined>;
1161
+ readonly max: _angular_core.InputSignalWithTransform<number | null, number | null | undefined>;
1138
1162
  readonly step: _angular_core.InputSignal<number>;
1139
1163
  readonly size: _angular_core.InputSignal<Size>;
1140
1164
  readonly label: _angular_core.InputSignal<string>;
@@ -1214,7 +1238,7 @@ declare class RatingComponent implements ControlValueAccessor {
1214
1238
  #private;
1215
1239
  readonly i18n: _jdpo2008_ngx_ds.NgxDsLabels;
1216
1240
  readonly value: _angular_core.ModelSignal<number>;
1217
- readonly max: _angular_core.InputSignal<number>;
1241
+ readonly max: _angular_core.InputSignalWithTransform<number, number | undefined>;
1218
1242
  readonly size: _angular_core.InputSignal<Size>;
1219
1243
  readonly readonly: _angular_core.InputSignal<boolean>;
1220
1244
  readonly disabled: _angular_core.InputSignal<boolean>;
@@ -2126,5 +2150,5 @@ declare class SidebarComponent {
2126
2150
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<SidebarComponent, "ngx-ds-sidebar", never, { "sections": { "alias": "sections"; "required": true; "isSignal": true; }; "activeId": { "alias": "activeId"; "required": false; "isSignal": true; }; "collapsible": { "alias": "collapsible"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "collapsed": { "alias": "collapsed"; "required": false; "isSignal": true; }; }, { "collapsed": "collapsedChange"; "itemClick": "itemClick"; }, never, ["[sidebar-header]", "[sidebar-footer]"], true, never>;
2127
2151
  }
2128
2152
 
2129
- export { ACCORDION_CONTROLLER, AccordionComponent, AccordionItemComponent, AlertComponent, AutocompleteComponent, AvatarComponent, AvatarGroupComponent, BadgeComponent, BreadcrumbComponent, ButtonComponent, ButtonGroupComponent, CalendarComponent, CardComponent, CheckboxComponent, ChipGroupComponent, ColorPickerComponent, CommandPaletteComponent, ConfirmationComponent, ConfirmationService, ContextMenuComponent, DateRangePickerComponent, DatepickerComponent, DividerComponent, DrawerComponent, DropdownComponent, EmptyStateComponent, FileUploadComponent, FocusTrapDirective, FormFieldComponent, IconButtonComponent, IconComponent, InputComponent, KbdComponent, MenuButtonComponent, MenuComponent, ModalComponent, MultiSelectComponent, NGX_DS_LABELS, NGX_DS_LABELS_EN, NGX_DS_LABELS_ES, NGX_DS_LOCALE, NotificationCenterComponent, NotificationItemComponent, NumberInputComponent, OtpInputComponent, PaginationComponent, PasswordStrengthComponent, PopoverComponent, ProgressBarComponent, RadioComponent, RangeSliderComponent, RatingComponent, SearchInputComponent, SegmentedControlComponent, SelectComponent, SidebarComponent, SkeletonComponent, SpinnerComponent, StepComponent, StepperComponent, SwitchComponent, TabComponent, TabContentDirective, TableComponent, TabsComponent, TagComponent, TextareaComponent, TimelineComponent, TimelineItemComponent, ToastComponent, ToastrService, TooltipDirective, TreeNodeComponent, TreeViewComponent, UserMenuComponent, formatDayLabel, monthNames, provideNgxDsLabels, provideNgxDsLocale, weekdayNames };
2130
- export type { AccordionController, AccordionSize, AccordionVariant, ActionColor, AlertType, AlertVariant, AutocompleteOption, AutocompleteSize, AutocompleteValue, AvatarColor, AvatarShape, AvatarSize, AvatarStatus, BadgeColor, BadgeSize, BadgeVariant, BreadcrumbItem, BreadcrumbSize, ButtonColor, ButtonSize, ButtonVariant, CalendarDayCell, CardPadding, CardShadow, CheckboxColor, CheckboxSize, ChipGroupSize, ChipGroupVariant, ChipItem, ColumnAlign, ColumnType, CommandItem, ConfirmationOptions, ConfirmationState, DateRange, DateRangePickerSize, DatepickerSize, DayCell, DayCellBase, DividerAlign, DividerOrientation, DividerVariant, DrawerSide, DrawerSize, DropdownOption, DropdownSize, DropdownValue, EmptyStateSize, FileUploadState, FileUploadStatus, InputSize, InputType, KbdSize, MenuButtonColor, MenuButtonSize, MenuItem, MenuSize, ModalSize, MultiSelectOption, MultiSelectSize, NgxDsLabels, NgxNotification, NotificationFilter, NotificationType, NumberInputSize, OtpSize, OtpType, PasswordCriterion, PasswordStrengthLevel, PopoverPlacement, ProgressBarColor, ProgressBarSize, RadioColor, RadioSize, RadioValue, RatingSize, SearchSize, SegmentOption, SegmentedControlSize, SelectMode, SelectOption, SelectSize, SelectValue, SidebarItem, SidebarSection, SkeletonVariant, SliderColor, SortDirection, SpinnerColor, SpinnerSize, StepperOrientation, SwitchColor, SwitchSize, TableAction, TableColumn, TablePageEvent, TableSort, TabsSize, TabsVariant, TagColor, TagSize, TagVariant, TextareaResize, TextareaSize, TimelineItemStatus, TimelineVariant, Toast, ToastOptions, ToastPosition, ToastType, TooltipPlacement, TreeNode, UploadedFile, UserMenuAction, UserMenuUser };
2153
+ export { ACCORDION_CONTROLLER, AccordionComponent, AccordionItemComponent, AlertComponent, AutocompleteComponent, AvatarComponent, AvatarGroupComponent, BadgeComponent, BreadcrumbComponent, ButtonComponent, ButtonGroupComponent, CalendarComponent, CardComponent, CheckboxComponent, ChipGroupComponent, ColorPickerComponent, CommandPaletteComponent, ConfirmationComponent, ConfirmationService, ContextMenuComponent, DateRangePickerComponent, DatepickerComponent, DividerComponent, DrawerComponent, DropdownComponent, EmptyStateComponent, FileUploadComponent, FocusTrapDirective, FormFieldComponent, IconButtonComponent, IconComponent, InputComponent, KbdComponent, MenuButtonComponent, MenuComponent, ModalComponent, MultiSelectComponent, NGX_DS_LABELS, NGX_DS_LABELS_EN, NGX_DS_LABELS_ES, NGX_DS_LOCALE, NotificationCenterComponent, NotificationItemComponent, NumberInputComponent, OtpInputComponent, PaginationComponent, PasswordStrengthComponent, PopoverComponent, ProgressBarComponent, RadioComponent, RangeSliderComponent, RatingComponent, SearchInputComponent, SegmentedControlComponent, SelectComponent, SidebarComponent, SkeletonComponent, SpinnerComponent, StepComponent, StepperComponent, SwitchComponent, TabComponent, TabContentDirective, TableComponent, TabsComponent, TagComponent, TextareaComponent, TimelineComponent, TimelineItemComponent, ToastComponent, ToastrService, TooltipDirective, TreeNodeComponent, TreeViewComponent, UserMenuComponent, formatDayLabel, monthNames, provideNgxDs, provideNgxDsLabels, provideNgxDsLocale, weekdayNames };
2154
+ export type { AccordionController, AccordionSize, AccordionVariant, ActionColor, AlertType, AlertVariant, AutocompleteOption, AutocompleteSize, AutocompleteValue, AvatarColor, AvatarShape, AvatarSize, AvatarStatus, BadgeColor, BadgeSize, BadgeVariant, BreadcrumbItem, BreadcrumbSize, ButtonColor, ButtonSize, ButtonVariant, CalendarDayCell, CardPadding, CardShadow, CheckboxColor, CheckboxSize, ChipGroupSize, ChipGroupVariant, ChipItem, ColumnAlign, ColumnType, CommandItem, ConfirmationOptions, ConfirmationState, DateRange, DateRangePickerSize, DatepickerSize, DayCell, DayCellBase, DividerAlign, DividerOrientation, DividerVariant, DrawerSide, DrawerSize, DropdownOption, DropdownSize, DropdownValue, EmptyStateSize, FileUploadState, FileUploadStatus, InputSize, InputType, KbdSize, MenuButtonColor, MenuButtonSize, MenuItem, MenuSize, ModalSize, MultiSelectOption, MultiSelectSize, NgxDsConfig, NgxDsLabels, NgxDsTheme, NgxNotification, NotificationFilter, NotificationType, NumberInputSize, OtpSize, OtpType, PasswordCriterion, PasswordStrengthLevel, PopoverPlacement, ProgressBarColor, ProgressBarSize, RadioColor, RadioSize, RadioValue, RatingSize, SearchSize, SegmentOption, SegmentedControlSize, SelectMode, SelectOption, SelectSize, SelectValue, SidebarItem, SidebarSection, SkeletonVariant, SliderColor, SortDirection, SpinnerColor, SpinnerSize, StepperOrientation, SwitchColor, SwitchSize, TableAction, TableColumn, TablePageEvent, TableSort, TabsSize, TabsVariant, TagColor, TagSize, TagVariant, TextareaResize, TextareaSize, TimelineItemStatus, TimelineVariant, Toast, ToastOptions, ToastPosition, ToastType, TooltipPlacement, TreeNode, UploadedFile, UserMenuAction, UserMenuUser };