@spartan-ng/cli 1.6.3 → 1.8.0-beta.1

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.
Files changed (48) hide show
  1. package/package.json +1 -1
  2. package/src/generators/healthcheck/healthchecks/brn-collapsible.js +3 -4
  3. package/src/generators/healthcheck/healthchecks/brn-collapsible.js.map +1 -1
  4. package/src/generators/migrate-collapsible/generator.js +3 -4
  5. package/src/generators/migrate-collapsible/generator.js.map +1 -1
  6. package/src/generators/migrate-collapsible/helm-collapsible-files.d.ts +6 -0
  7. package/src/generators/migrate-collapsible/helm-collapsible-files.js +17 -0
  8. package/src/generators/migrate-collapsible/helm-collapsible-files.js.map +1 -0
  9. package/src/generators/ui/libs/code-block/files/index.ts.template +28 -0
  10. package/src/generators/ui/libs/code-block/files/lib/hlm-code-block-actions.ts.template +16 -0
  11. package/src/generators/ui/libs/code-block/files/lib/hlm-code-block-content.ts.template +85 -0
  12. package/src/generators/ui/libs/code-block/files/lib/hlm-code-block-copy-button.ts.template +62 -0
  13. package/src/generators/ui/libs/code-block/files/lib/hlm-code-block-footer.ts.template +13 -0
  14. package/src/generators/ui/libs/code-block/files/lib/hlm-code-block-header.ts.template +16 -0
  15. package/src/generators/ui/libs/code-block/files/lib/hlm-code-block-line.ts.template +42 -0
  16. package/src/generators/ui/libs/code-block/files/lib/hlm-code-block-title.ts.template +16 -0
  17. package/src/generators/ui/libs/code-block/files/lib/hlm-code-block.ts.template +34 -0
  18. package/src/generators/ui/libs/code-block/generator.d.ts +3 -0
  19. package/src/generators/ui/libs/code-block/generator.js +9 -0
  20. package/src/generators/ui/libs/code-block/generator.js.map +1 -0
  21. package/src/generators/ui/libs/pagination/files/index.ts.template +1 -0
  22. package/src/generators/ui/libs/pagination/files/lib/hlm-numbered-pagination-query-params.ts.template +46 -3
  23. package/src/generators/ui/libs/pagination/files/lib/hlm-numbered-pagination.ts.template +44 -5
  24. package/src/generators/ui/libs/pagination/files/lib/hlm-pagination-next.ts.template +5 -2
  25. package/src/generators/ui/libs/pagination/files/lib/hlm-pagination-previous.ts.template +5 -2
  26. package/src/generators/ui/libs/pagination/files/lib/hlm-pagination.token.ts.template +29 -0
  27. package/src/generators/ui/libs/trace/files/index.ts.template +28 -0
  28. package/src/generators/ui/libs/trace/files/lib/hlm-trace-collapsible-content.ts.template +34 -0
  29. package/src/generators/ui/libs/trace/files/lib/hlm-trace-collapsible-trigger.ts.template +31 -0
  30. package/src/generators/ui/libs/trace/files/lib/hlm-trace-collapsible.ts.template +21 -0
  31. package/src/generators/ui/libs/trace/files/lib/hlm-trace-description.ts.template +13 -0
  32. package/src/generators/ui/libs/trace/files/lib/hlm-trace-icon.ts.template +13 -0
  33. package/src/generators/ui/libs/trace/files/lib/hlm-trace-line.ts.template +18 -0
  34. package/src/generators/ui/libs/trace/files/lib/hlm-trace-title.ts.template +13 -0
  35. package/src/generators/ui/libs/trace/files/lib/hlm-trace.ts.template +16 -0
  36. package/src/generators/ui/libs/trace/generator.d.ts +3 -0
  37. package/src/generators/ui/libs/trace/generator.js +9 -0
  38. package/src/generators/ui/libs/trace/generator.js.map +1 -0
  39. package/src/generators/ui/primitive-deps.js +2 -0
  40. package/src/generators/ui/primitive-deps.js.map +1 -1
  41. package/src/generators/ui/primitives.d.ts +1 -1
  42. package/src/generators/ui/style-luma.css +78 -0
  43. package/src/generators/ui/style-lyra.css +74 -0
  44. package/src/generators/ui/style-maia.css +74 -0
  45. package/src/generators/ui/style-mira.css +73 -0
  46. package/src/generators/ui/style-nova.css +74 -0
  47. package/src/generators/ui/style-vega.css +74 -0
  48. package/src/generators/ui/supported-ui-libraries.json +63 -43
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spartan-ng/cli",
3
- "version": "1.6.3",
3
+ "version": "1.8.0-beta.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/spartan-ng/spartan.git"
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.brainCollapsibleHealthcheck = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const generator_1 = require("../../migrate-collapsible/generator");
6
+ const helm_collapsible_files_1 = require("../../migrate-collapsible/helm-collapsible-files");
6
7
  const healthchecks_1 = require("../healthchecks");
7
8
  exports.brainCollapsibleHealthcheck = {
8
9
  name: 'Brain Collapsible',
@@ -12,10 +13,8 @@ exports.brainCollapsibleHealthcheck = {
12
13
  if (!file.endsWith('.ts') && !file.endsWith('.html')) {
13
14
  return;
14
15
  }
15
- // skip HlmCollapsible itself
16
- if (file.endsWith('hlm-collapsible.ts') ||
17
- file.endsWith('hlm-collapsible-trigger.ts') ||
18
- file.endsWith('hlm-collapsible-content.ts')) {
16
+ // skip the Helm Collapsible and Trace implementations
17
+ if (helm_collapsible_files_1.HELM_COLLAPSIBLE_FILES.some((name) => file.endsWith(name))) {
19
18
  return;
20
19
  }
21
20
  const contents = tree.read(file, 'utf-8');
@@ -1 +1 @@
1
- {"version":3,"file":"brn-collapsible.js","sourceRoot":"","sources":["../../../../../../../libs/cli/src/generators/healthcheck/healthchecks/brn-collapsible.ts"],"names":[],"mappings":";;;AAAA,uCAAkD;AAClD,mEAAkF;AAClF,kDAAwE;AAE3D,QAAA,2BAA2B,GAAgB;IACvD,IAAI,EAAE,mBAAmB;IACzB,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO;QACzB,IAAA,6BAAoB,EAAC,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE;YACxC,2DAA2D;YAC3D,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;gBACtD,OAAO;YACR,CAAC;YAED,6BAA6B;YAC7B,IACC,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC;gBACnC,IAAI,CAAC,QAAQ,CAAC,4BAA4B,CAAC;gBAC3C,IAAI,CAAC,QAAQ,CAAC,4BAA4B,CAAC,EAC1C,CAAC;gBACF,OAAO;YACR,CAAC;YAED,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAE1C,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACf,OAAO;YACR,CAAC;YAED,IAAI,QAAQ,CAAC,QAAQ,CAAC,iCAAiC,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC;gBAClG,OAAO,CACN,0FAA0F,EAC1F,kCAAmB,CAAC,KAAK,EACzB,IAAI,CACJ,CAAC;YACH,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;IACD,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACnB,MAAM,IAAA,uCAA2B,EAAC,IAAI,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9D,OAAO,IAAI,CAAC;IACb,CAAC;IACD,MAAM,EAAE,+DAA+D;CACvE,CAAC"}
1
+ {"version":3,"file":"brn-collapsible.js","sourceRoot":"","sources":["../../../../../../../libs/cli/src/generators/healthcheck/healthchecks/brn-collapsible.ts"],"names":[],"mappings":";;;AAAA,uCAAkD;AAClD,mEAAkF;AAClF,6FAA0F;AAC1F,kDAAwE;AAE3D,QAAA,2BAA2B,GAAgB;IACvD,IAAI,EAAE,mBAAmB;IACzB,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO;QACzB,IAAA,6BAAoB,EAAC,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE;YACxC,2DAA2D;YAC3D,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;gBACtD,OAAO;YACR,CAAC;YAED,sDAAsD;YACtD,IAAI,+CAAsB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;gBAChE,OAAO;YACR,CAAC;YAED,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAE1C,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACf,OAAO;YACR,CAAC;YAED,IAAI,QAAQ,CAAC,QAAQ,CAAC,iCAAiC,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC;gBAClG,OAAO,CACN,0FAA0F,EAC1F,kCAAmB,CAAC,KAAK,EACzB,IAAI,CACJ,CAAC;YACH,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;IACD,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACnB,MAAM,IAAA,uCAA2B,EAAC,IAAI,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9D,OAAO,IAAI,CAAC;IACb,CAAC;IACD,MAAM,EAAE,+DAA+D;CACvE,CAAC"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.migrateCollapsibleGenerator = migrateCollapsibleGenerator;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const visit_files_1 = require("../../utils/visit-files");
6
+ const helm_collapsible_files_1 = require("./helm-collapsible-files");
6
7
  async function migrateCollapsibleGenerator(tree, { skipFormat }) {
7
8
  updateImports(tree);
8
9
  replaceSelector(tree);
@@ -15,10 +16,8 @@ async function migrateCollapsibleGenerator(tree, { skipFormat }) {
15
16
  */
16
17
  function updateImports(tree) {
17
18
  (0, visit_files_1.visitFiles)(tree, '/', (path) => {
18
- // skip HlmCollapsible itself
19
- if (path.endsWith('hlm-collapsible.ts') ||
20
- path.endsWith('hlm-collapsible-trigger.ts') ||
21
- path.endsWith('hlm-collapsible-content.ts')) {
19
+ // skip the Helm Collapsible and Trace implementations
20
+ if (helm_collapsible_files_1.HELM_COLLAPSIBLE_FILES.some((name) => path.endsWith(name))) {
22
21
  return;
23
22
  }
24
23
  const content = tree.read(path, 'utf-8');
@@ -1 +1 @@
1
- {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../libs/cli/src/generators/migrate-collapsible/generator.ts"],"names":[],"mappings":";;AAIA,kEAOC;AAXD,uCAAoD;AACpD,yDAAqD;AAG9C,KAAK,UAAU,2BAA2B,CAAC,IAAU,EAAE,EAAE,UAAU,EAAqC;IAC9G,aAAa,CAAC,IAAI,CAAC,CAAC;IACpB,eAAe,CAAC,IAAI,CAAC,CAAC;IAEtB,IAAI,CAAC,UAAU,EAAE,CAAC;QACjB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IACzB,CAAC;AACF,CAAC;AAED;;GAEG;AACH,SAAS,aAAa,CAAC,IAAU;IAChC,IAAA,wBAAU,EAAC,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE;QAC9B,6BAA6B;QAC7B,IACC,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC;YACnC,IAAI,CAAC,QAAQ,CAAC,4BAA4B,CAAC;YAC3C,IAAI,CAAC,QAAQ,CAAC,4BAA4B,CAAC,EAC1C,CAAC;YACF,OAAO;QACR,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEzC,IAAI,CAAC,OAAO,EAAE,CAAC;YACd,OAAO;QACR,CAAC;QAED,IAAI,OAAO,CAAC,QAAQ,CAAC,kCAAkC,CAAC,EAAE,CAAC;YAC1D,MAAM,cAAc,GAAG,OAAO;gBAC7B,2FAA2F;iBAC1F,OAAO,CACP,uEAAuE,EACvE,uEAAuE,CACvE;gBACD,qEAAqE;iBACpE,OAAO,CAAC,uBAAuB,EAAE,uBAAuB,CAAC;gBAC1D,8DAA8D;iBAC7D,OAAO,CAAC,gBAAgB,EAAE,uBAAuB,CAAC;gBACnD,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ACF,mEAAmE;aAClE,OAAO,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;aAC/C,OAAO,CAAC,wBAAwB,EAAE,wBAAwB,CAAC;YAC5D,mEAAmE;aAClE,OAAO,CAAC,qBAAqB,EAAE,mBAAmB,CAAC,CACrD,CAAC;IACH,CAAC,CAAC;SACD,IAAI,CAAC,EAAE,CAAC,CAAC;AACZ,CAAC;AAED,kBAAe,2BAA2B,CAAC"}
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../libs/cli/src/generators/migrate-collapsible/generator.ts"],"names":[],"mappings":";;AAKA,kEAOC;AAZD,uCAAoD;AACpD,yDAAqD;AACrD,qEAAkE;AAG3D,KAAK,UAAU,2BAA2B,CAAC,IAAU,EAAE,EAAE,UAAU,EAAqC;IAC9G,aAAa,CAAC,IAAI,CAAC,CAAC;IACpB,eAAe,CAAC,IAAI,CAAC,CAAC;IAEtB,IAAI,CAAC,UAAU,EAAE,CAAC;QACjB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IACzB,CAAC;AACF,CAAC;AAED;;GAEG;AACH,SAAS,aAAa,CAAC,IAAU;IAChC,IAAA,wBAAU,EAAC,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE;QAC9B,sDAAsD;QACtD,IAAI,+CAAsB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;YAChE,OAAO;QACR,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEzC,IAAI,CAAC,OAAO,EAAE,CAAC;YACd,OAAO;QACR,CAAC;QAED,IAAI,OAAO,CAAC,QAAQ,CAAC,kCAAkC,CAAC,EAAE,CAAC;YAC1D,MAAM,cAAc,GAAG,OAAO;gBAC7B,2FAA2F;iBAC1F,OAAO,CACP,uEAAuE,EACvE,uEA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,GAAG,EAAE,EAAE;QACZ,gEAAgE;QAChE,8BAA8B;QAC9B,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAE/B,OAAO,CACN,GAAG;YACF,mEAAmE;aAClE,OAAO,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;aAC/C,OAAO,CAAC,wBAAwB,EAAE,wBAAwB,CAAC;YAC5D,mEAAmE;aAClE,OAAO,CAAC,qBAAqB,EAAE,mBAAmB,CAAC,CACrD,CAAC;IACH,CAAC,CAAC;SACD,IAAI,CAAC,EAAE,CAAC,CAAC;AACZ,CAAC;AAED,kBAAe,2BAA2B,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Helm components that intentionally wrap the brain collapsible directives as host directives (to
3
+ * expose their inputs). They are not consumers of the deprecated `<brn-collapsible>` component, so
4
+ * both the healthcheck and the migration must skip them.
5
+ */
6
+ export declare const HELM_COLLAPSIBLE_FILES: string[];
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HELM_COLLAPSIBLE_FILES = void 0;
4
+ /**
5
+ * Helm components that intentionally wrap the brain collapsible directives as host directives (to
6
+ * expose their inputs). They are not consumers of the deprecated `<brn-collapsible>` component, so
7
+ * both the healthcheck and the migration must skip them.
8
+ */
9
+ exports.HELM_COLLAPSIBLE_FILES = [
10
+ 'hlm-collapsible.ts',
11
+ 'hlm-collapsible-trigger.ts',
12
+ 'hlm-collapsible-content.ts',
13
+ 'hlm-trace-collapsible.ts',
14
+ 'hlm-trace-collapsible-trigger.ts',
15
+ 'hlm-trace-collapsible-content.ts',
16
+ ];
17
+ //# sourceMappingURL=helm-collapsible-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helm-collapsible-files.js","sourceRoot":"","sources":["../../../../../../libs/cli/src/generators/migrate-collapsible/helm-collapsible-files.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACU,QAAA,sBAAsB,GAAG;IACrC,oBAAoB;IACpB,4BAA4B;IAC5B,4BAA4B;IAC5B,0BAA0B;IAC1B,kCAAkC;IAClC,kCAAkC;CAClC,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { HlmCodeBlock } from './lib/hlm-code-block';
2
+ import { HlmCodeBlockActions } from './lib/hlm-code-block-actions';
3
+ import { HlmCodeBlockContent } from './lib/hlm-code-block-content';
4
+ import { HlmCodeBlockCopyButton } from './lib/hlm-code-block-copy-button';
5
+ import { HlmCodeBlockFooter } from './lib/hlm-code-block-footer';
6
+ import { HlmCodeBlockHeader } from './lib/hlm-code-block-header';
7
+ import { HlmCodeBlockLine } from './lib/hlm-code-block-line';
8
+ import { HlmCodeBlockTitle } from './lib/hlm-code-block-title';
9
+
10
+ export * from './lib/hlm-code-block';
11
+ export * from './lib/hlm-code-block-actions';
12
+ export * from './lib/hlm-code-block-content';
13
+ export * from './lib/hlm-code-block-copy-button';
14
+ export * from './lib/hlm-code-block-footer';
15
+ export * from './lib/hlm-code-block-header';
16
+ export * from './lib/hlm-code-block-line';
17
+ export * from './lib/hlm-code-block-title';
18
+
19
+ export const HlmCodeBlockImports = [
20
+ HlmCodeBlock,
21
+ HlmCodeBlockActions,
22
+ HlmCodeBlockContent,
23
+ HlmCodeBlockCopyButton,
24
+ HlmCodeBlockFooter,
25
+ HlmCodeBlockHeader,
26
+ HlmCodeBlockLine,
27
+ HlmCodeBlockTitle,
28
+ ] as const;
@@ -0,0 +1,16 @@
1
+ import { Directive } from '@angular/core';
2
+ import { classes } from '<%- importAlias %>/utils';
3
+
4
+ @Directive({
5
+ selector: '[hlmCodeBlockActions],hlm-code-block-actions',
6
+ exportAs: 'hlmCodeBlockActions',
7
+ host: { 'data-slot': 'code-block-actions' },
8
+ })
9
+ export class HlmCodeBlockActions {
10
+ constructor() {
11
+ classes(
12
+ () =>
13
+ 'spartan-code-block-actions ms-auto flex shrink-0 items-center [[data-slot=code-block]>&]:absolute [[data-slot=code-block]>&]:z-10 [[data-slot=code-block]>&]:opacity-0 [[data-slot=code-block]>&]:transition-opacity [[data-slot=code-block]>&]:group-focus-within/code-block:opacity-100 [[data-slot=code-block]>&]:group-hover/code-block:opacity-100 [[data-slot=code-block]>&]:pointer-coarse:opacity-100',
14
+ );
15
+ }
16
+ }
@@ -0,0 +1,85 @@
1
+ import { Directionality } from '@angular/cdk/bidi';
2
+ import { BooleanInput, NumberInput } from '@angular/cdk/coercion';
3
+ import {
4
+ booleanAttribute,
5
+ ChangeDetectionStrategy,
6
+ Component,
7
+ computed,
8
+ inject,
9
+ input,
10
+ numberAttribute,
11
+ } from '@angular/core';
12
+ import { classes } from '<%- importAlias %>/utils';
13
+ import { HlmCodeBlockLine } from './hlm-code-block-line';
14
+
15
+ @Component({
16
+ // eslint-disable-next-line @angular-eslint/component-selector
17
+ selector: 'pre[hlmCodeBlockContent]',
18
+ exportAs: 'hlmCodeBlockContent',
19
+ imports: [HlmCodeBlockLine],
20
+ changeDetection: ChangeDetectionStrategy.OnPush,
21
+ host: {
22
+ 'data-slot': 'code-block-content',
23
+ '[attr.data-wrap]': 'wrap() || null',
24
+ '[attr.data-numbered]': 'lineNumbers() || null',
25
+ '[attr.dir]': '_direction()',
26
+ '[style.counter-reset]': '_style()',
27
+ tabindex: '0',
28
+ },
29
+ template: `
30
+ <code
31
+ data-slot="code-block-code"
32
+ class="spartan-code-block-code grid min-h-lh min-w-max content-start in-data-numbered:grid-cols-[auto_1fr] in-data-wrap:min-w-0"
33
+ >
34
+ @if (_lines(); as lines) {
35
+ @for (line of lines; track $index) {
36
+ <span hlmCodeBlockLine>{{ line }}</span>
37
+ }
38
+ } @else if (_hasCode()) {
39
+ <span [textContent]="_code()"></span>
40
+ } @else {
41
+ <ng-content />
42
+ }
43
+ </code>
44
+ `,
45
+ })
46
+ export class HlmCodeBlockContent {
47
+ private readonly _dir = inject(Directionality);
48
+
49
+ protected readonly _direction = this._dir.valueSignal;
50
+
51
+ public readonly wrap = input<boolean, BooleanInput>(false, { transform: booleanAttribute });
52
+ public readonly lineNumbers = input<boolean, BooleanInput>(false, { transform: booleanAttribute });
53
+
54
+ public readonly startLine = input<number, NumberInput>(1, { transform: numberAttribute });
55
+
56
+ /** When set, the code is rendered line by line instead of projecting `<ng-content />`. */
57
+ public readonly code = input<string>();
58
+
59
+ protected readonly _code = computed(() => {
60
+ const code = this.code();
61
+ return typeof code === 'string' ? code : null;
62
+ });
63
+
64
+ protected readonly _hasCode = computed(() => this._code() !== null);
65
+
66
+ protected readonly _lines = computed(() => {
67
+ const code = this._code();
68
+ if (!this.lineNumbers() || code === null) return null;
69
+
70
+ // An empty line renders a newline so copying a selection keeps blank lines.
71
+ return code
72
+ .replace(/\n$/, '')
73
+ .split('\n')
74
+ .map((line) => (line === '' ? '\n' : line));
75
+ });
76
+
77
+ protected readonly _style = computed(() => `line ${this.startLine() - 1}`);
78
+
79
+ constructor() {
80
+ classes(
81
+ () =>
82
+ 'spartan-code-block-content scroll-fade-x data-wrap:scroll-fade-y min-h-0 min-w-0 scrollbar-thin overflow-auto text-start font-mono outline-none data-wrap:wrap-break-word data-wrap:whitespace-pre-wrap',
83
+ );
84
+ }
85
+ }
@@ -0,0 +1,62 @@
1
+ import { ChangeDetectionStrategy, Component, computed, effect, input, signal } from '@angular/core';
2
+ import { NgIcon, provideIcons } from '@ng-icons/core';
3
+ import { lucideCheck, lucideCopy } from '@ng-icons/lucide';
4
+ import { HlmButton, provideBrnButtonConfig } from '<%- importAlias %>/button';
5
+ import { classes } from '<%- importAlias %>/utils';
6
+
7
+ @Component({
8
+ // eslint-disable-next-line @angular-eslint/component-selector
9
+ selector: 'button[hlmCodeBlockCopyButton]',
10
+ exportAs: 'hlmCodeBlockCopyButton',
11
+ imports: [NgIcon],
12
+ providers: [provideIcons({ lucideCopy, lucideCheck }), provideBrnButtonConfig({ variant: 'ghost', size: 'icon-xs' })],
13
+ changeDetection: ChangeDetectionStrategy.OnPush,
14
+ hostDirectives: [{ directive: HlmButton, inputs: ['variant', 'size'] }],
15
+ host: {
16
+ type: 'button',
17
+ 'data-slot': 'code-block-copy-button',
18
+ '[attr.data-copied]': '_copied() || null',
19
+ '[attr.aria-label]': '_ariaLabel()',
20
+ '(click)': '_copy()',
21
+ },
22
+ template: `
23
+ <ng-icon [name]="_icon()" />
24
+
25
+ @if (_copied()) {
26
+ <span aria-live="polite" class="sr-only">
27
+ {{ copiedText() }}
28
+ </span>
29
+ }
30
+ `,
31
+ })
32
+ export class HlmCodeBlockCopyButton {
33
+ protected readonly _copied = signal(false);
34
+
35
+ protected readonly _icon = computed(() => (this._copied() ? 'lucideCheck' : 'lucideCopy'));
36
+
37
+ public readonly value = input<string>('');
38
+ public readonly copyText = input<string>('Copy');
39
+ public readonly copiedText = input<string>('Copied');
40
+
41
+ protected readonly _ariaLabel = computed(() => (this._copied() ? this.copiedText() : this.copyText()));
42
+
43
+ constructor() {
44
+ classes(() => 'spartan-code-block-copy-button');
45
+
46
+ effect((onCleanup) => {
47
+ if (!this._copied()) return;
48
+
49
+ const timeout = setTimeout(() => this._copied.set(false), 2000);
50
+ onCleanup(() => clearTimeout(timeout));
51
+ });
52
+ }
53
+
54
+ protected async _copy(): Promise<void> {
55
+ try {
56
+ await navigator.clipboard.writeText(this.value());
57
+ this._copied.set(true);
58
+ } catch {
59
+ // ignore clipboard errors
60
+ }
61
+ }
62
+ }
@@ -0,0 +1,13 @@
1
+ import { Directive } from '@angular/core';
2
+ import { classes } from '<%- importAlias %>/utils';
3
+
4
+ @Directive({
5
+ selector: '[hlmCodeBlockFooter],hlm-code-block-footer',
6
+ exportAs: 'hlmCodeBlockFooter',
7
+ host: { 'data-slot': 'code-block-footer' },
8
+ })
9
+ export class HlmCodeBlockFooter {
10
+ constructor() {
11
+ classes(() => 'spartan-code-block-footer flex min-w-0 shrink-0 items-center');
12
+ }
13
+ }
@@ -0,0 +1,16 @@
1
+ import { Directive } from '@angular/core';
2
+ import { classes } from '<%- importAlias %>/utils';
3
+
4
+ @Directive({
5
+ selector: '[hlmCodeBlockHeader],hlm-code-block-header',
6
+ exportAs: 'hlmCodeBlockHeader',
7
+ host: { 'data-slot': 'code-block-header' },
8
+ })
9
+ export class HlmCodeBlockHeader {
10
+ constructor() {
11
+ classes(
12
+ () =>
13
+ 'spartan-code-block-header flex min-w-0 shrink-0 items-center *:has-[>[data-slot=code-block-title]]:min-w-0',
14
+ );
15
+ }
16
+ }
@@ -0,0 +1,42 @@
1
+ import { ChangeDetectionStrategy, Component, input } from '@angular/core';
2
+ import { classes } from '<%- importAlias %>/utils';
3
+ import { cva, VariantProps } from 'class-variance-authority';
4
+
5
+ const codeBlockLineVariants = cva(
6
+ "spartan-code-block-line relative block min-h-lh after:absolute after:top-0 after:select-none in-data-numbered:col-span-2 in-data-numbered:grid in-data-numbered:grid-cols-subgrid in-data-numbered:[counter-increment:line] in-data-numbered:before:content-[counter(line)] in-data-numbered:before:select-none in-data-numbered:supports-[content:counter(line)_/_'']:before:content-[counter(line)_/_'']",
7
+ {
8
+ variants: {
9
+ variant: {
10
+ default: 'spartan-code-block-line-variant-default',
11
+ added: 'spartan-code-block-line-variant-added',
12
+ removed: 'spartan-code-block-line-variant-removed',
13
+ highlighted: 'spartan-code-block-line-variant-highlighted',
14
+ },
15
+ },
16
+ defaultVariants: {
17
+ variant: 'default',
18
+ },
19
+ },
20
+ );
21
+
22
+ type CodeBlockLineVariants = VariantProps<typeof codeBlockLineVariants>;
23
+
24
+ @Component({
25
+ // eslint-disable-next-line @angular-eslint/component-selector
26
+ selector: 'span[hlmCodeBlockLine]',
27
+ exportAs: 'hlmCodeBlockLine',
28
+ changeDetection: ChangeDetectionStrategy.OnPush,
29
+ host: { 'data-slot': 'code-block-line', '[attr.data-variant]': 'variant()' },
30
+ template: `
31
+ <span data-slot="code-block-line-content" class="min-w-0">
32
+ <ng-content />
33
+ </span>
34
+ `,
35
+ })
36
+ export class HlmCodeBlockLine {
37
+ public readonly variant = input<CodeBlockLineVariants['variant']>('default');
38
+
39
+ constructor() {
40
+ classes(() => codeBlockLineVariants({ variant: this.variant() }));
41
+ }
42
+ }
@@ -0,0 +1,16 @@
1
+ import { Directive } from '@angular/core';
2
+ import { classes } from '<%- importAlias %>/utils';
3
+
4
+ @Directive({
5
+ selector: '[hlmCodeBlockTitle],hlm-code-block-title',
6
+ exportAs: 'hlmCodeBlockTitle',
7
+ host: { 'data-slot': 'code-block-title' },
8
+ })
9
+ export class HlmCodeBlockTitle {
10
+ constructor() {
11
+ classes(
12
+ () =>
13
+ 'spartan-code-block-title min-w-0 truncate [&_ng-icon]:pointer-events-none [&_ng-icon]:inline-block [&_ng-icon]:align-middle',
14
+ );
15
+ }
16
+ }
@@ -0,0 +1,34 @@
1
+ import { Directive, input } from '@angular/core';
2
+ import { classes } from '<%- importAlias %>/utils';
3
+ import { cva, type VariantProps } from 'class-variance-authority';
4
+
5
+ const codeBlockVariants = cva(
6
+ 'spartan-code-block group/code-block relative flex w-full min-w-0 flex-col overflow-hidden',
7
+ {
8
+ variants: {
9
+ variant: {
10
+ default: 'spartan-code-block-variant-default',
11
+ destructive: 'spartan-code-block-variant-destructive',
12
+ },
13
+ },
14
+ defaultVariants: {
15
+ variant: 'default',
16
+ },
17
+ },
18
+ );
19
+
20
+ type CodeBlockVariants = VariantProps<typeof codeBlockVariants>;
21
+
22
+ @Directive({
23
+ selector: '[hlmCodeBlock],hlm-code-block',
24
+ exportAs: 'hlmCodeBlock',
25
+ host: { 'data-slot': 'code-block', '[attr.data-variant]': 'variant()', '[attr.data-size]': 'size()' },
26
+ })
27
+ export class HlmCodeBlock {
28
+ public readonly variant = input<CodeBlockVariants['variant']>('default');
29
+ public readonly size = input<'default' | 'sm'>('default');
30
+
31
+ constructor() {
32
+ classes(() => codeBlockVariants({ variant: this.variant() }));
33
+ }
34
+ }
@@ -0,0 +1,3 @@
1
+ import type { Tree } from '@nx/devkit';
2
+ import type { HlmBaseGeneratorSchema } from '../../../base/schema';
3
+ export declare function generator(tree: Tree, options: HlmBaseGeneratorSchema): Promise<import("@nx/devkit").GeneratorCallback>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generator = generator;
4
+ const tslib_1 = require("tslib");
5
+ const generator_1 = tslib_1.__importDefault(require("../../../base/generator"));
6
+ async function generator(tree, options) {
7
+ return await (0, generator_1.default)(tree, { ...options, name: 'code-block' });
8
+ }
9
+ //# sourceMappingURL=generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../../libs/cli/src/generators/ui/libs/code-block/generator.ts"],"names":[],"mappings":";;AAIA,8BAEC;;AALD,gFAAuD;AAGhD,KAAK,UAAU,SAAS,CAAC,IAAU,EAAE,OAA+B;IAC1E,OAAO,MAAM,IAAA,mBAAgB,EAAC,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;AACzE,CAAC"}
@@ -17,6 +17,7 @@ export * from './lib/hlm-pagination-item';
17
17
  export * from './lib/hlm-pagination-link';
18
18
  export * from './lib/hlm-pagination-next';
19
19
  export * from './lib/hlm-pagination-previous';
20
+ export * from './lib/hlm-pagination.token';
20
21
 
21
22
  export const HlmPaginationImports = [
22
23
  HlmPagination,
@@ -19,6 +19,7 @@ import { HlmPaginationItem } from './hlm-pagination-item';
19
19
  import { HlmPaginationLink } from './hlm-pagination-link';
20
20
  import { HlmPaginationNext } from './hlm-pagination-next';
21
21
  import { HlmPaginationPrevious } from './hlm-pagination-previous';
22
+ import { injectHlmPaginationConfig } from './hlm-pagination.token';
22
23
 
23
24
  @Component({
24
25
  selector: 'hlm-numbered-pagination-query-params',
@@ -34,11 +35,11 @@ import { HlmPaginationPrevious } from './hlm-pagination-previous';
34
35
  ],
35
36
  changeDetection: ChangeDetectionStrategy.OnPush,
36
37
  template: `
37
- <div class="flex items-center gap-1 text-sm text-nowrap text-gray-600">
38
+ <div class="text-muted-foreground flex items-center gap-1 text-sm text-nowrap">
38
39
  <b>{{ totalItems() }}</b>
39
- total items |
40
+ {{ totalItemsLabel() }} |
40
41
  <b>{{ _lastPageNumber() }}</b>
41
- pages
42
+ {{ pagesLabel() }}
42
43
  </div>
43
44
 
44
45
  <nav hlmPagination>
@@ -49,6 +50,8 @@ import { HlmPaginationPrevious } from './hlm-pagination-previous';
49
50
  [link]="link()"
50
51
  [queryParams]="{ page: currentPage() - 1 }"
51
52
  queryParamsHandling="merge"
53
+ [text]="previousLabel()"
54
+ [aria-label]="previousAriaLabel()"
52
55
  />
53
56
  </li>
54
57
  }
@@ -77,6 +80,8 @@ import { HlmPaginationPrevious } from './hlm-pagination-previous';
77
80
  [link]="link()"
78
81
  [queryParams]="{ page: currentPage() + 1 }"
79
82
  queryParamsHandling="merge"
83
+ [text]="nextLabel()"
84
+ [aria-label]="nextAriaLabel()"
80
85
  />
81
86
  </li>
82
87
  }
@@ -99,6 +104,8 @@ import { HlmPaginationPrevious } from './hlm-pagination-previous';
99
104
  `,
100
105
  })
101
106
  export class HlmNumberedPaginationQueryParams {
107
+ private readonly _config = injectHlmPaginationConfig();
108
+
102
109
  /**
103
110
  * The current (active) page.
104
111
  */
@@ -144,6 +151,42 @@ export class HlmNumberedPaginationQueryParams {
144
151
  */
145
152
  public readonly pageSizes = input<number[]>([10, 20, 50, 100]);
146
153
 
154
+ /**
155
+ * The label for total items or pages to show
156
+ * Defaults to config's totalItemsLabel
157
+ */
158
+ public readonly totalItemsLabel = input<string>(this._config.totalItemsLabel);
159
+
160
+ /**
161
+ * The label for pages to show
162
+ * Defaults to config's pagesLabel
163
+ */
164
+ public readonly pagesLabel = input<string>(this._config.pagesLabel);
165
+
166
+ /**
167
+ * The label to show on the next button
168
+ * Defaults to config's nextLabel
169
+ */
170
+ public readonly nextLabel = input<string>(this._config.nextLabel);
171
+
172
+ /**
173
+ * The aria-label to show on the next button
174
+ * Defaults to config's nextAriaLabel
175
+ */
176
+ public readonly nextAriaLabel = input<string>(this._config.nextAriaLabel);
177
+
178
+ /**
179
+ * The label to show on the previous button
180
+ * Defaults to config's previousLabel
181
+ */
182
+ public readonly previousLabel = input<string>(this._config.previousLabel);
183
+
184
+ /**
185
+ * The aria-label to show on the previous button
186
+ * Defaults to config's previousAriaLabel
187
+ */
188
+ public readonly previousAriaLabel = input<string>(this._config.previousAriaLabel);
189
+
147
190
  protected readonly _pageSizesWithCurrent = computed(() => {
148
191
  const pageSizes = this.pageSizes();
149
192
  return pageSizes.includes(this.itemsPerPage())
@@ -17,6 +17,7 @@ import { HlmPaginationItem } from './hlm-pagination-item';
17
17
  import { HlmPaginationLink } from './hlm-pagination-link';
18
18
  import { HlmPaginationNext } from './hlm-pagination-next';
19
19
  import { HlmPaginationPrevious } from './hlm-pagination-previous';
20
+ import { injectHlmPaginationConfig } from './hlm-pagination.token';
20
21
 
21
22
  @Component({
22
23
  selector: 'hlm-numbered-pagination',
@@ -33,18 +34,18 @@ import { HlmPaginationPrevious } from './hlm-pagination-previous';
33
34
  changeDetection: ChangeDetectionStrategy.OnPush,
34
35
  template: `
35
36
  <div class="flex items-center justify-between gap-2 px-4 py-2">
36
- <div class="flex items-center gap-1 text-sm text-nowrap text-gray-600">
37
+ <div class="text-muted-foreground flex items-center gap-1 text-sm text-nowrap">
37
38
  <b>{{ totalItems() }}</b>
38
- total items |
39
+ {{ totalItemsLabel() }} |
39
40
  <b>{{ _lastPageNumber() }}</b>
40
- pages
41
+ {{ pagesLabel() }}
41
42
  </div>
42
43
 
43
44
  <nav hlmPagination>
44
45
  <ul hlmPaginationContent>
45
46
  @if (showEdges() && !_isFirstPageActive()) {
46
47
  <li hlmPaginationItem (click)="goToPrevious()">
47
- <hlm-pagination-previous />
48
+ <hlm-pagination-previous [aria-label]="previousAriaLabel()" [text]="previousLabel()" />
48
49
  </li>
49
50
  }
50
51
 
@@ -62,7 +63,7 @@ import { HlmPaginationPrevious } from './hlm-pagination-previous';
62
63
 
63
64
  @if (showEdges() && !_isLastPageActive()) {
64
65
  <li hlmPaginationItem (click)="goToNext()">
65
- <hlm-pagination-next />
66
+ <hlm-pagination-next [aria-label]="nextAriaLabel()" [text]="nextLabel()" />
66
67
  </li>
67
68
  }
68
69
  </ul>
@@ -85,6 +86,8 @@ import { HlmPaginationPrevious } from './hlm-pagination-previous';
85
86
  `,
86
87
  })
87
88
  export class HlmNumberedPagination {
89
+ private readonly _config = injectHlmPaginationConfig();
90
+
88
91
  /**
89
92
  * The current (active) page.
90
93
  */
@@ -124,6 +127,42 @@ export class HlmNumberedPagination {
124
127
  */
125
128
  public readonly pageSizes = input<number[]>([10, 20, 50, 100]);
126
129
 
130
+ /**
131
+ * The label for total items or pages to show
132
+ * Defaults to config's totalItemsLabel
133
+ */
134
+ public readonly totalItemsLabel = input<string>(this._config.totalItemsLabel);
135
+
136
+ /**
137
+ * The label for pages to show
138
+ * Defaults to config's pagesLabel
139
+ */
140
+ public readonly pagesLabel = input<string>(this._config.pagesLabel);
141
+
142
+ /**
143
+ * The label to show on the next button
144
+ * Defaults to config's nextLabel
145
+ */
146
+ public readonly nextLabel = input<string>(this._config.nextLabel);
147
+
148
+ /**
149
+ * The aria-label to show on the next button
150
+ * Defaults to config's nextAriaLabel
151
+ */
152
+ public readonly nextAriaLabel = input<string>(this._config.nextAriaLabel);
153
+
154
+ /**
155
+ * The label to show on the previous button
156
+ * Defaults to config's previousLabel
157
+ */
158
+ public readonly previousLabel = input<string>(this._config.previousLabel);
159
+
160
+ /**
161
+ * The aria-label to show on the previous button
162
+ * Defaults to config's previousAriaLabel
163
+ */
164
+ public readonly previousAriaLabel = input<string>(this._config.previousAriaLabel);
165
+
127
166
  protected readonly _pageSizesWithCurrent = computed(() => {
128
167
  const pageSizes = this.pageSizes();
129
168
  return pageSizes.includes(this.itemsPerPage())