@jdpo2008/ngx-ds 0.0.0-stage → 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,52 @@
1
1
  {
2
2
  "name": "@jdpo2008/ngx-ds",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.0",
4
+ "description": "Angular 21 component library: standalone signal-based components with design tokens and an opt-in dark theme.",
5
+ "license": "MIT",
6
+ "keywords": [
7
+ "angular",
8
+ "components",
9
+ "design-system",
10
+ "ui",
11
+ "signals"
12
+ ],
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/jdpo2008/ngx-ds.git",
16
+ "directory": "projects/ngx-ds"
17
+ },
18
+ "homepage": "https://github.com/jdpo2008/ngx-ds#readme",
19
+ "bugs": {
20
+ "url": "https://github.com/jdpo2008/ngx-ds/issues"
21
+ },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "peerDependencies": {
26
+ "@angular/common": "^21.0.0",
27
+ "@angular/core": "^21.0.0",
28
+ "@angular/forms": "^21.0.0",
29
+ "@angular/platform-browser": "^21.0.0",
30
+ "lucide-angular": "^1.0.0"
31
+ },
32
+ "dependencies": {
33
+ "tslib": "^2.3.0"
34
+ },
35
+ "sideEffects": false,
36
+ "schematics": "./schematics/collection.json",
37
+ "ng-add": {
38
+ "save": "dependencies"
39
+ },
40
+ "module": "fesm2022/jdpo2008-ngx-ds.mjs",
41
+ "typings": "types/jdpo2008-ngx-ds.d.ts",
42
+ "exports": {
43
+ "./package.json": {
44
+ "default": "./package.json"
45
+ },
46
+ ".": {
47
+ "types": "./types/jdpo2008-ngx-ds.d.ts",
48
+ "default": "./fesm2022/jdpo2008-ngx-ds.mjs"
49
+ }
50
+ },
51
+ "type": "module"
6
52
  }
@@ -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
+ }
@@ -0,0 +1,53 @@
1
+ // ngx-ds — Legacy tokens (deprecated)
2
+ // No component reads these any more. They are kept as aliases so consumer
3
+ // stylesheets that still reference them keep working; they will be removed in
4
+ // the next major. Use the primitive/semantic tokens from _tokens.scss instead.
5
+ //
6
+ // Note: overriding a deprecated alias no longer re-themes the components —
7
+ // override the canonical token (e.g. `--primary-500`) instead.
8
+ //
9
+ // `--ngx-color-*` predates the token system in _tokens.scss.
10
+ // The old brand green (#1fdd5e) is not part of the theme: the primary color is
11
+ // the indigo --primary-* scale. Its aliases stay literal until the next major.
12
+
13
+ @layer base {
14
+ :root {
15
+ // ── Gen-2.5 aliases (deprecated) ────────────────────────────────────────
16
+ --color-primary: var(--primary-500);
17
+ --color-primary-50: var(--primary-50);
18
+ --color-danger: var(--danger-500);
19
+ --color-success: var(--success-500);
20
+ --color-warning: var(--warning-500);
21
+ --color-secondary: var(--gray-500);
22
+ --border-color: var(--border-base);
23
+ --text-primary: var(--text-base);
24
+ --surface-secondary: var(--surface-subtle);
25
+
26
+ // ── --ngx-color-* (deprecated) ──────────────────────────────────────────
27
+ // Primary (brand green — literal, no equivalent)
28
+ --ngx-color-primary: #1fdd5e;
29
+ --ngx-color-primary-dark: #1bbf52;
30
+ --ngx-color-primary-success: var(--success-500);
31
+ --ngx-color-primary-error: var(--danger-500);
32
+ --ngx-color-primary-warning: var(--warning-500);
33
+ --ngx-color-primary-info: var(--info-500);
34
+
35
+ // Neutral
36
+ --ngx-color-primary-background: var(--surface-subtle);
37
+
38
+ // Text
39
+ --ngx-color-primary-title: var(--text-base);
40
+ --ngx-color-primary-text: var(--text-muted);
41
+ --ngx-color-primary-text-hover: var(--text-muted);
42
+ --ngx-color-primary-text-dark: #fff;
43
+ --ngx-color-primary-text-dark-hover: #fff;
44
+ --ngx-color-primary-text-dark-active: #fff;
45
+ --ngx-color-primary-text-dark-focus: #fff;
46
+ --ngx-color-primary-text-dark-hover-active: #fff;
47
+ --ngx-color-primary-text-dark-hover-focus: #fff;
48
+ --ngx-color-primary-text-dark-active-focus: #fff;
49
+
50
+ // Border
51
+ --ngx-color-primary-border: var(--border-base);
52
+ }
53
+ }
@@ -0,0 +1,73 @@
1
+ // ngx-ds — Dark theme
2
+ // Opt-in only: consumers activate it with <html data-theme="dark"> or by
3
+ // adding the `dark` class (compatible with Tailwind darkMode: 'class').
4
+ // No automatic `prefers-color-scheme` — enabling it is the consumer's call.
5
+
6
+ @layer base {
7
+ :root[data-theme='dark'],
8
+ .dark {
9
+ // Primary lightened for dark surfaces
10
+ --primary-50: #1e1b4b;
11
+ --primary-100: #312e81;
12
+ --primary-200: #3730a3;
13
+ --primary-500: #818cf8;
14
+ --primary-600: #6366f1;
15
+ --primary-700: #a5b4fc;
16
+
17
+ // State soft backgrounds darkened
18
+ --danger-50: #450a0a;
19
+ --danger-100: #7f1d1d;
20
+ --danger-200: #991b1b;
21
+ --success-50: #022c22;
22
+ --success-100: #064e3b;
23
+ --success-200: #065f46;
24
+ --warning-50: #451a03;
25
+ --warning-100: #78350f;
26
+ --warning-200: #92400e;
27
+ --info-50: #172554;
28
+ --info-100: #1e3a8a;
29
+ --info-200: #1e40af;
30
+
31
+ // State accents lightened for contrast on dark surfaces
32
+ --danger-500: #f87171;
33
+ --danger-600: #ef4444;
34
+ --danger-700: #fca5a5;
35
+ --danger-800: #fecaca;
36
+ --success-500: #34d399;
37
+ --success-600: #10b981;
38
+ --success-700: #6ee7b7;
39
+ --success-800: #a7f3d0;
40
+ --warning-400: #fcd34d;
41
+ --warning-500: #fbbf24;
42
+ --warning-600: #fcd34d;
43
+ --warning-700: #fcd34d;
44
+ --warning-800: #fde68a;
45
+ --info-500: #60a5fa;
46
+ --info-600: #3b82f6;
47
+ --info-700: #93c5fd;
48
+ --info-800: #bfdbfe;
49
+
50
+ // Text
51
+ --text-base: #f9fafb;
52
+ --text-secondary: #d1d5db;
53
+ --text-muted: #9ca3af;
54
+ --text-placeholder: #8b93a1; // ≥ 4.5:1 on the dark surfaces
55
+ --text-disabled: #4b5563;
56
+ --text-inverse: #111827;
57
+ --text-on-color: #111827; // dark fills are lighter here, so text goes dark
58
+
59
+ // Surfaces
60
+ --surface-base: #111827;
61
+ --surface-subtle: #1f2937;
62
+ --surface-muted: #374151;
63
+ --surface-hover: #1f2937;
64
+ --surface-active: #374151;
65
+ --fill-neutral: #9ca3af; // lighter so dark --text-on-color stays readable
66
+
67
+ // Borders
68
+ --border-subtle: #1f2937;
69
+ --border-base: #374151;
70
+ --border-input: #4b5563;
71
+ --border-strong: #6b7280;
72
+ }
73
+ }
@@ -0,0 +1,92 @@
1
+ // ngx-ds — Design tokens (light theme, canonical source)
2
+ // Values mirror the historical `var(--x, #hex)` fallbacks so defining them
3
+ // in :root produces zero visual change.
4
+
5
+ @layer base {
6
+ :root {
7
+ // ── Primitives ──────────────────────────────────────────────────────────
8
+ // Gray (Tailwind gray)
9
+ --gray-50: #f9fafb;
10
+ --gray-100: #f3f4f6;
11
+ --gray-200: #e5e7eb;
12
+ --gray-300: #d1d5db;
13
+ --gray-400: #9ca3af;
14
+ --gray-500: #6b7280;
15
+ --gray-600: #4b5563;
16
+ --gray-700: #374151;
17
+ --gray-800: #1f2937;
18
+ --gray-900: #111827;
19
+
20
+ // Primary (indigo)
21
+ --primary-50: #eef2ff;
22
+ --primary-100: #e0e7ff;
23
+ --primary-200: #c7d2fe;
24
+ --primary-300: #a5b4fc;
25
+ --primary-400: #818cf8;
26
+ --primary-500: #6366f1;
27
+ --primary-600: #4f46e5;
28
+ --primary-700: #4338ca;
29
+
30
+ // Danger (red)
31
+ --danger-50: #fef2f2;
32
+ --danger-100: #fee2e2;
33
+ --danger-200: #fecaca;
34
+ --danger-500: #ef4444;
35
+ --danger-600: #dc2626;
36
+ --danger-700: #b91c1c;
37
+ --danger-800: #991b1b;
38
+
39
+ // Success (green)
40
+ --success-50: #ecfdf5;
41
+ --success-100: #d1fae5;
42
+ --success-200: #a7f3d0;
43
+ --success-500: #10b981;
44
+ --success-600: #059669;
45
+ --success-700: #047857;
46
+ --success-800: #065f46;
47
+
48
+ // Warning (amber)
49
+ --warning-50: #fffbeb;
50
+ --warning-100: #fef3c7;
51
+ --warning-200: #fde68a;
52
+ --warning-400: #fbbf24;
53
+ --warning-500: #f59e0b;
54
+ --warning-600: #d97706;
55
+ --warning-700: #b45309;
56
+ --warning-800: #92400e;
57
+
58
+ // Info (blue)
59
+ --info-50: #eff6ff;
60
+ --info-100: #dbeafe;
61
+ --info-200: #bfdbfe;
62
+ --info-500: #3b82f6;
63
+ --info-600: #2563eb;
64
+ --info-700: #1d4ed8;
65
+ --info-800: #1e40af;
66
+
67
+ // ── Semantic ────────────────────────────────────────────────────────────
68
+ // Text
69
+ --text-base: var(--gray-900);
70
+ --text-secondary: var(--gray-700);
71
+ --text-muted: var(--gray-500);
72
+ --text-placeholder: var(--gray-400);
73
+ --text-disabled: var(--gray-300);
74
+ --text-inverse: #ffffff;
75
+ --text-on-color: #ffffff; // text/marks on solid colored fills
76
+
77
+ // Surfaces
78
+ --surface-base: #ffffff;
79
+ --surface-subtle: var(--gray-50);
80
+ --surface-muted: var(--gray-100);
81
+ --surface-hover: var(--gray-100);
82
+ --surface-active: var(--gray-200);
83
+ --surface-thumb: #ffffff; // switch / slider thumbs; same in dark
84
+ --fill-neutral: var(--gray-500); // solid neutral fills (secondary variants)
85
+
86
+ // Borders
87
+ --border-subtle: var(--gray-100);
88
+ --border-base: var(--gray-200);
89
+ --border-input: var(--gray-300);
90
+ --border-strong: var(--gray-400);
91
+ }
92
+ }
@@ -0,0 +1,11 @@
1
+ // ngx-ds — Storybook / workspace global styles
2
+ // Consumer apps should load `ngx-ds.scss` instead: it carries the same
3
+ // tokens without the Tailwind directives used by the Storybook wrappers.
4
+
5
+ // Sass requires @use before any other rule; Tailwind relocates the
6
+ // `@layer base` content into the @tailwind base insertion point below.
7
+ @use './ngx-ds';
8
+
9
+ @tailwind base;
10
+ @tailwind components;
11
+ @tailwind utilities;
@@ -0,0 +1,23 @@
1
+ // ngx-ds — consumer stylesheet (no Tailwind required)
2
+ // Add it to the "styles" array in angular.json:
3
+ // "node_modules/@jdpo2008/ngx-ds/styles/ngx-ds.scss"
4
+ // or load it from your global styles.scss:
5
+ // @use '@jdpo2008/ngx-ds/styles/ngx-ds';
6
+ //
7
+ // Design tokens (primitives + semantic), opt-in dark theme and deprecated
8
+ // aliases. Everything lives in `@layer base`, so your own unlayered
9
+ // :root overrides always win.
10
+ @use './tokens';
11
+ @use './themes';
12
+ @use './legacy';
13
+
14
+ @layer base {
15
+ :root {
16
+ // Font family (the library does not load the font files themselves)
17
+ --ngx-primary-font-family: 'Poppins', sans-serif;
18
+ --ngx-secondary-font-family: 'Roboto', sans-serif;
19
+ --ngx-font-size-base: 1rem;
20
+ --ngx-font-size-sm: 0.875rem;
21
+ --ngx-font-size-lg: 1.125rem;
22
+ }
23
+ }