@spartan-ng/cli 0.0.1-alpha.677 → 0.0.1-alpha.679

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 (23) hide show
  1. package/package.json +1 -1
  2. package/src/generators/ui/libs/button-group/files/lib/hlm-button-group-separator.ts.template +5 -4
  3. package/src/generators/ui/libs/button-group/files/lib/hlm-button-group-text.ts.template +4 -4
  4. package/src/generators/ui/libs/button-group/files/lib/hlm-button-group.ts.template +4 -4
  5. package/src/generators/ui/libs/card/files/lib/hlm-card.token.ts.template +19 -0
  6. package/src/generators/ui/libs/card/files/lib/hlm-card.ts.template +3 -1
  7. package/src/generators/ui/libs/dropdown-menu/files/lib/hlm-dropdown-menu-item.ts.template +1 -1
  8. package/src/generators/ui/libs/item/files/lib/hlm-item-actions.ts.template +2 -4
  9. package/src/generators/ui/libs/item/files/lib/hlm-item-content.ts.template +2 -4
  10. package/src/generators/ui/libs/item/files/lib/hlm-item-description.ts.template +6 -8
  11. package/src/generators/ui/libs/item/files/lib/hlm-item-footer.ts.template +2 -4
  12. package/src/generators/ui/libs/item/files/lib/hlm-item-group.ts.template +1 -1
  13. package/src/generators/ui/libs/item/files/lib/hlm-item-header.ts.template +2 -4
  14. package/src/generators/ui/libs/item/files/lib/hlm-item-media.ts.template +4 -4
  15. package/src/generators/ui/libs/item/files/lib/hlm-item-separator.ts.template +3 -2
  16. package/src/generators/ui/libs/item/files/lib/hlm-item-title.ts.template +2 -4
  17. package/src/generators/ui/libs/item/files/lib/hlm-item.ts.template +8 -7
  18. package/src/generators/ui/libs/kbd/files/lib/hlm-kbd-group.ts.template +1 -1
  19. package/src/generators/ui/libs/kbd/files/lib/hlm-kbd.ts.template +1 -5
  20. package/src/generators/ui/libs/separator/files/lib/hlm-separator.ts.template +4 -1
  21. package/src/generators/ui/libs/spinner/files/lib/hlm-spinner.ts.template +1 -1
  22. package/src/generators/ui/style-vega.css +327 -327
  23. package/src/generators/ui/supported-ui-libraries.json +41 -41
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spartan-ng/cli",
3
- "version": "0.0.1-alpha.677",
3
+ "version": "0.0.1-alpha.679",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/spartan-ng/spartan"
@@ -12,9 +12,10 @@ import { classes } from '<%- importAlias %>/utils';
12
12
  })
13
13
  export class HlmButtonGroupSeparator {
14
14
  constructor() {
15
- classes(
16
- () =>
17
- 'bg-input relative inline-flex shrink-0 self-stretch data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-auto data-[orientation=vertical]:w-px',
18
- );
15
+ classes(() => [
16
+ 'spartan-button-group-separator relative self-stretch data-horizontal:mx-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto',
17
+ // separator classes
18
+ 'shrink-0 data-horizontal:h-px data-vertical:w-px data-vertical:self-stretch',
19
+ ]);
19
20
  }
20
21
  }
@@ -3,12 +3,12 @@ import { classes } from '<%- importAlias %>/utils';
3
3
 
4
4
  @Directive({
5
5
  selector: '[hlmButtonGroupText],hlm-button-group-text',
6
+ host: {
7
+ 'data-slot': 'button-group-text',
8
+ },
6
9
  })
7
10
  export class HlmButtonGroupText {
8
11
  constructor() {
9
- classes(
10
- () =>
11
- "bg-muted flex items-center gap-2 rounded-md border px-4 text-sm font-medium shadow-xs [&_ng-icon]:pointer-events-none [&_ng-icon:not([class*='text-'])]:text-base",
12
- );
12
+ classes(() => 'spartan-button-group-text flex items-center [&_ng-icon]:pointer-events-none');
13
13
  }
14
14
  }
@@ -2,15 +2,15 @@ import { Directive, input } from '@angular/core';
2
2
  import { classes } from '<%- importAlias %>/utils';
3
3
  import { cva } from 'class-variance-authority';
4
4
 
5
- export const buttonGroupVariants = cva(
6
- "flex w-fit items-stretch has-[>[data-slot=button-group]]:gap-2 [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1",
5
+ const buttonGroupVariants = cva(
6
+ "spartan-button-group flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1",
7
7
  {
8
8
  variants: {
9
9
  orientation: {
10
10
  horizontal:
11
- '[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none',
11
+ 'spartan-button-group-orientation-horizontal [&>*:not(:first-child)]:rounded-s-none [&>*:not(:first-child)]:border-s-0 [&>*:not(:last-child)]:rounded-e-none',
12
12
  vertical:
13
- 'flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none',
13
+ 'spartan-button-group-orientation-vertical flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none',
14
14
  },
15
15
  },
16
16
  defaultVariants: {
@@ -0,0 +1,19 @@
1
+ import { inject, InjectionToken, type ValueProvider } from '@angular/core';
2
+
3
+ export type HlmCardConfig = {
4
+ size: 'sm' | 'default';
5
+ };
6
+
7
+ const defaultConfig: HlmCardConfig = {
8
+ size: 'default',
9
+ };
10
+
11
+ const HlmCardConfigToken = new InjectionToken<HlmCardConfig>('HlmCardConfig');
12
+
13
+ export function provideHlmCardConfig(config: Partial<HlmCardConfig>): ValueProvider {
14
+ return { provide: HlmCardConfigToken, useValue: { ...defaultConfig, ...config } };
15
+ }
16
+
17
+ export function injectHlmCardConfig(): HlmCardConfig {
18
+ return inject(HlmCardConfigToken, { optional: true }) ?? defaultConfig;
19
+ }
@@ -1,5 +1,6 @@
1
1
  import { Directive, input } from '@angular/core';
2
2
  import { classes } from '<%- importAlias %>/utils';
3
+ import { HlmCardConfig, injectHlmCardConfig } from './hlm-card.token';
3
4
 
4
5
  @Directive({
5
6
  selector: '[hlmCard],hlm-card',
@@ -9,7 +10,8 @@ import { classes } from '<%- importAlias %>/utils';
9
10
  },
10
11
  })
11
12
  export class HlmCard {
12
- public readonly size = input<'sm' | 'default'>('default');
13
+ private readonly _defaultConfig = injectHlmCardConfig();
14
+ public readonly size = input<HlmCardConfig['size']>(this._defaultConfig.size);
13
15
 
14
16
  constructor() {
15
17
  classes(() => 'spartan-card group/card flex flex-col');
@@ -4,7 +4,7 @@ import { booleanAttribute, Directive, HOST_TAG_NAME, inject, input } from '@angu
4
4
  import { classes } from '<%- importAlias %>/utils';
5
5
 
6
6
  @Directive({
7
- selector: '[hlmDropdownMenuItem]',
7
+ selector: '[hlmDropdownMenuItem],hlm-dropdown-menu-item',
8
8
  hostDirectives: [
9
9
  {
10
10
  directive: CdkMenuItem,
@@ -3,12 +3,10 @@ import { classes } from '<%- importAlias %>/utils';
3
3
 
4
4
  @Directive({
5
5
  selector: '[hlmItemActions],hlm-item-actions',
6
- host: {
7
- 'data-slot': 'item-actions',
8
- },
6
+ host: { 'data-slot': 'item-actions' },
9
7
  })
10
8
  export class HlmItemActions {
11
9
  constructor() {
12
- classes(() => 'flex items-center gap-2');
10
+ classes(() => 'spartan-item-actions flex items-center');
13
11
  }
14
12
  }
@@ -3,12 +3,10 @@ import { classes } from '<%- importAlias %>/utils';
3
3
 
4
4
  @Directive({
5
5
  selector: '[hlmItemContent],hlm-item-content',
6
- host: {
7
- 'data-slot': 'item-content',
8
- },
6
+ host: { 'data-slot': 'item-content' },
9
7
  })
10
8
  export class HlmItemContent {
11
9
  constructor() {
12
- classes(() => 'flex flex-1 flex-col gap-1 [&+[data-slot=item-content]]:flex-none');
10
+ classes(() => 'spartan-item-content flex flex-1 flex-col [&+[data-slot=item-content]]:flex-none');
13
11
  }
14
12
  }
@@ -2,16 +2,14 @@ import { Directive } from '@angular/core';
2
2
  import { classes } from '<%- importAlias %>/utils';
3
3
 
4
4
  @Directive({
5
- selector: 'p[hlmItemDescription]',
6
- host: {
7
- 'data-slot': 'item-description',
8
- },
5
+ selector: '[hlmItemDescription],hlm-item-description',
6
+ host: { 'data-slot': 'item-description' },
9
7
  })
10
8
  export class HlmItemDescription {
11
9
  constructor() {
12
- classes(() => [
13
- 'text-muted-foreground line-clamp-2 text-sm leading-normal font-normal text-balance',
14
- '[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',
15
- ]);
10
+ classes(
11
+ () =>
12
+ 'spartan-item-description [&>a:hover]:text-primary line-clamp-2 flex font-normal [&>a]:underline [&>a]:underline-offset-4',
13
+ );
16
14
  }
17
15
  }
@@ -3,12 +3,10 @@ import { classes } from '<%- importAlias %>/utils';
3
3
 
4
4
  @Directive({
5
5
  selector: '[hlmItemFooter],hlm-item-footer',
6
- host: {
7
- 'data-slot': 'item-footer',
8
- },
6
+ host: { 'data-slot': 'item-footer' },
9
7
  })
10
8
  export class HlmItemFooter {
11
9
  constructor() {
12
- classes(() => 'flex basis-full items-center justify-between gap-2');
10
+ classes(() => 'spartan-item-footer flex basis-full items-center justify-between');
13
11
  }
14
12
  }
@@ -7,6 +7,6 @@ import { classes } from '<%- importAlias %>/utils';
7
7
  })
8
8
  export class HlmItemGroup {
9
9
  constructor() {
10
- classes(() => 'group/item-group flex flex-col');
10
+ classes(() => 'spartan-item-group group/item-group flex w-full flex-col');
11
11
  }
12
12
  }
@@ -3,12 +3,10 @@ import { classes } from '<%- importAlias %>/utils';
3
3
 
4
4
  @Directive({
5
5
  selector: '[hlmItemHeader],hlm-item-header',
6
- host: {
7
- 'data-slot': 'item-header',
8
- },
6
+ host: { 'data-slot': 'item-header' },
9
7
  })
10
8
  export class HlmItemHeader {
11
9
  constructor() {
12
- classes(() => 'flex basis-full items-center justify-between gap-2');
10
+ classes(() => 'spartan-item-header flex basis-full items-center justify-between');
13
11
  }
14
12
  }
@@ -4,13 +4,13 @@ import { cva, type VariantProps } from 'class-variance-authority';
4
4
  import { injectHlmItemMediaConfig } from './hlm-item-token';
5
5
 
6
6
  const itemMediaVariants = cva(
7
- 'flex shrink-0 items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:translate-y-0.5 group-has-[[data-slot=item-description]]/item:self-start [&_ng-icon]:pointer-events-none',
7
+ 'spartan-item-media flex shrink-0 items-center justify-center [&_ng-icon]:pointer-events-none',
8
8
  {
9
9
  variants: {
10
10
  variant: {
11
- default: 'bg-transparent',
12
- icon: "bg-muted size-8 rounded-sm border [&_ng-icon:not([class*='text-'])]:text-base",
13
- image: 'size-10 overflow-hidden rounded-sm [&_img]:size-full [&_img]:object-cover',
11
+ default: 'spartan-item-media-variant-default',
12
+ icon: 'spartan-item-media-variant-icon',
13
+ image: 'spartan-item-media-variant-image',
14
14
  },
15
15
  },
16
16
  defaultVariants: {
@@ -2,13 +2,14 @@ import { Directive } from '@angular/core';
2
2
  import { BrnSeparator } from '@spartan-ng/brain/separator';
3
3
  import { hlmSeparatorClass } from '<%- importAlias %>/separator';
4
4
  import { classes } from '<%- importAlias %>/utils';
5
+
5
6
  @Directive({
6
- selector: 'div[hlmItemSeparator]',
7
+ selector: '[hlmItemSeparator],hlm-item-separator',
7
8
  hostDirectives: [{ directive: BrnSeparator, inputs: ['orientation'] }],
8
9
  host: { 'data-slot': 'item-separator' },
9
10
  })
10
11
  export class HlmItemSeparator {
11
12
  constructor() {
12
- classes(() => [hlmSeparatorClass, 'my-0']);
13
+ classes(() => [hlmSeparatorClass, 'spartan-item-separator']);
13
14
  }
14
15
  }
@@ -3,12 +3,10 @@ import { classes } from '<%- importAlias %>/utils';
3
3
 
4
4
  @Directive({
5
5
  selector: '[hlmItemTitle],hlm-item-title',
6
- host: {
7
- 'data-slot': 'item-title',
8
- },
6
+ host: { 'data-slot': 'item-title' },
9
7
  })
10
8
  export class HlmItemTitle {
11
9
  constructor() {
12
- classes(() => 'flex w-fit items-center gap-2 text-sm leading-snug font-medium');
10
+ classes(() => 'spartan-item-title line-clamp-1 flex w-fit items-center');
13
11
  }
14
12
  }
@@ -4,17 +4,18 @@ import { cva, type VariantProps } from 'class-variance-authority';
4
4
  import { injectHlmItemConfig } from './hlm-item-token';
5
5
 
6
6
  const itemVariants = cva(
7
- 'group/item [a]:hover:bg-accent/50 focus-visible:border-ring focus-visible:ring-ring/50 flex flex-wrap items-center rounded-md border border-transparent text-sm transition-colors duration-100 outline-none focus-visible:ring-[3px] [a]:transition-colors',
7
+ 'spartan-item group/item focus-visible:border-ring focus-visible:ring-ring/50 flex w-full flex-wrap items-center transition-colors duration-100 outline-none focus-visible:ring-[3px] [a]:transition-colors',
8
8
  {
9
9
  variants: {
10
10
  variant: {
11
- default: 'bg-transparent',
12
- outline: 'border-border',
13
- muted: 'bg-muted/50',
11
+ default: 'spartan-item-variant-default',
12
+ outline: 'spartan-item-variant-outline',
13
+ muted: 'spartan-item-variant-muted',
14
14
  },
15
15
  size: {
16
- default: 'gap-4 p-4',
17
- sm: 'gap-2.5 px-4 py-3',
16
+ default: 'spartan-item-size-default',
17
+ sm: 'spartan-item-size-sm',
18
+ xs: 'spartan-item-size-xs',
18
19
  },
19
20
  },
20
21
  defaultVariants: {
@@ -27,7 +28,7 @@ const itemVariants = cva(
27
28
  export type ItemVariants = VariantProps<typeof itemVariants>;
28
29
 
29
30
  @Directive({
30
- selector: 'div[hlmItem], a[hlmItem]',
31
+ selector: '[hlmItem],hlm-item',
31
32
  host: {
32
33
  'data-slot': 'item',
33
34
  '[attr.data-variant]': 'variant()',
@@ -9,6 +9,6 @@ import { classes } from '<%- importAlias %>/utils';
9
9
  })
10
10
  export class HlmKbdGroup {
11
11
  constructor() {
12
- classes(() => 'inline-flex items-center gap-1');
12
+ classes(() => 'spartan-kbd-group inline-flex items-center');
13
13
  }
14
14
  }
@@ -9,10 +9,6 @@ import { classes } from '<%- importAlias %>/utils';
9
9
  })
10
10
  export class HlmKbd {
11
11
  constructor() {
12
- classes(() => [
13
- 'bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none',
14
- "[&_ng-icon:not([class*='text-'])]:text-xs",
15
- '[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10',
16
- ]);
12
+ classes(() => 'spartan-kbd pointer-events-none inline-flex items-center justify-center select-none');
17
13
  }
18
14
  }
@@ -3,11 +3,14 @@ import { BrnSeparator } from '@spartan-ng/brain/separator';
3
3
  import { classes } from '<%- importAlias %>/utils';
4
4
 
5
5
  export const hlmSeparatorClass =
6
- 'bg-border inline-flex shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px';
6
+ 'inline-flex shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch';
7
7
 
8
8
  @Directive({
9
9
  selector: '[hlmSeparator],hlm-separator',
10
10
  hostDirectives: [{ directive: BrnSeparator, inputs: ['orientation', 'decorative'] }],
11
+ host: {
12
+ 'data-slot': 'separator',
13
+ },
11
14
  })
12
15
  export class HlmSeparator {
13
16
  constructor() {
@@ -27,6 +27,6 @@ export class HlmSpinner {
27
27
  public readonly ariaLabel = input<string>('Loading', { alias: 'aria-label' });
28
28
 
29
29
  constructor() {
30
- classes(() => 'inline-flex size-fit text-base motion-safe:animate-spin');
30
+ classes(() => 'inline-flex text-[calc(var(--spacing)*4)] motion-safe:animate-spin');
31
31
  }
32
32
  }