@spartan-ng/cli 0.0.1-alpha.650 → 0.0.1-alpha.652
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 +4 -1
- package/src/generators/base/generator.js +37 -1
- package/src/generators/base/generator.js.map +1 -1
- package/src/generators/base/lib/styles/create-style-map.d.ts +4 -0
- package/src/generators/base/lib/styles/create-style-map.js +72 -0
- package/src/generators/base/lib/styles/create-style-map.js.map +1 -0
- package/src/generators/base/lib/styles/transform-style-map.d.ts +3 -0
- package/src/generators/base/lib/styles/transform-style-map.js +255 -0
- package/src/generators/base/lib/styles/transform-style-map.js.map +1 -0
- package/src/generators/base/lib/styles/transform.d.ts +10 -0
- package/src/generators/base/lib/styles/transform.js +19 -0
- package/src/generators/base/lib/styles/transform.js.map +1 -0
- package/src/generators/healthcheck/generator.js +2 -0
- package/src/generators/healthcheck/generator.js.map +1 -1
- package/src/generators/healthcheck/healthchecks/sonner.d.ts +2 -0
- package/src/generators/healthcheck/healthchecks/sonner.js +35 -0
- package/src/generators/healthcheck/healthchecks/sonner.js.map +1 -0
- package/src/generators/migrate-sonner/compat.d.ts +2 -0
- package/src/generators/migrate-sonner/compat.js +6 -0
- package/src/generators/migrate-sonner/compat.js.map +1 -0
- package/src/generators/migrate-sonner/generator.d.ts +4 -0
- package/src/generators/migrate-sonner/generator.js +36 -0
- package/src/generators/migrate-sonner/generator.js.map +1 -0
- package/src/generators/migrate-sonner/schema.d.ts +3 -0
- package/src/generators/migrate-sonner/schema.json +14 -0
- package/src/generators/ui/libs/button/files/lib/hlm-button.ts.template +16 -18
- package/src/generators/ui/libs/sonner/files/lib/hlm-toaster.ts.template +23 -6
- package/src/generators/ui/libs/tooltip/files/lib/hlm-tooltip.ts.template +2 -2
- package/src/generators/ui/libs/utils/files/lib/hlm.ts.template +52 -2
- package/src/generators/ui/style-lyra.css +1335 -0
- package/src/generators/ui/style-maia.css +1360 -0
- package/src/generators/ui/style-mira.css +1362 -0
- package/src/generators/ui/style-nova.css +1360 -0
- package/src/generators/ui/style-vega.css +1356 -0
- package/src/generators/ui/supported-ui-libraries.json +44 -42
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/index.js.map +1 -1
- package/src/registry/index.d.ts +1 -0
- package/src/registry/index.js +5 -0
- package/src/registry/index.js.map +1 -0
- package/src/registry/schema.d.ts +2207 -0
- package/src/registry/schema.js +184 -0
- package/src/registry/schema.js.map +1 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "MigrateSonner",
|
|
4
|
+
"title": "",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"skipFormat": {
|
|
8
|
+
"type": "boolean",
|
|
9
|
+
"default": false,
|
|
10
|
+
"description": "Skip formatting files"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"required": []
|
|
14
|
+
}
|
|
@@ -1,33 +1,31 @@
|
|
|
1
1
|
import { Directive, input, signal } from '@angular/core';
|
|
2
2
|
import { BrnButton } from '@spartan-ng/brain/button';
|
|
3
3
|
import { classes } from '<%- importAlias %>/utils';
|
|
4
|
-
import { type VariantProps
|
|
4
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
5
5
|
import type { ClassValue } from 'clsx';
|
|
6
6
|
import { injectBrnButtonConfig } from './hlm-button.token';
|
|
7
7
|
|
|
8
8
|
export const buttonVariants = cva(
|
|
9
|
-
|
|
9
|
+
'spartan-button group/button inline-flex shrink-0 items-center justify-center whitespace-nowrap transition-all outline-none select-none disabled:pointer-events-none disabled:opacity-50 [&_ng-icon]:pointer-events-none [&_ng-icon]:shrink-0',
|
|
10
10
|
{
|
|
11
11
|
variants: {
|
|
12
12
|
variant: {
|
|
13
|
-
default: '
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
ghost: 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',
|
|
20
|
-
link: 'text-primary underline-offset-4 hover:underline',
|
|
13
|
+
default: 'spartan-button-variant-default',
|
|
14
|
+
outline: 'spartan-button-variant-outline',
|
|
15
|
+
secondary: 'spartan-button-variant-secondary',
|
|
16
|
+
ghost: 'spartan-button-variant-ghost',
|
|
17
|
+
destructive: 'spartan-button-variant-destructive',
|
|
18
|
+
link: 'spartan-button-variant-link',
|
|
21
19
|
},
|
|
22
20
|
size: {
|
|
23
|
-
default: '
|
|
24
|
-
xs:
|
|
25
|
-
sm: '
|
|
26
|
-
lg: '
|
|
27
|
-
icon: 'size-
|
|
28
|
-
'icon-xs':
|
|
29
|
-
'icon-sm': 'size-
|
|
30
|
-
'icon-lg': 'size-
|
|
21
|
+
default: 'spartan-button-size-default',
|
|
22
|
+
xs: 'spartan-button-size-xs',
|
|
23
|
+
sm: 'spartan-button-size-sm',
|
|
24
|
+
lg: 'spartan-button-size-lg',
|
|
25
|
+
icon: 'spartan-button-size-icon',
|
|
26
|
+
'icon-xs': 'spartan-button-size-icon-xs',
|
|
27
|
+
'icon-sm': 'spartan-button-size-icon-sm',
|
|
28
|
+
'icon-lg': 'spartan-button-size-icon-lg',
|
|
31
29
|
},
|
|
32
30
|
},
|
|
33
31
|
defaultVariants: {
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import type { BooleanInput, NumberInput } from '@angular/cdk/coercion';
|
|
2
2
|
import { ChangeDetectionStrategy, Component, booleanAttribute, computed, input, numberAttribute } from '@angular/core';
|
|
3
|
+
import { NgIcon, provideIcons } from '@ng-icons/core';
|
|
4
|
+
import { lucideCircleCheck, lucideInfo, lucideLoader2, lucideOctagonX, lucideTriangleAlert } from '@ng-icons/lucide';
|
|
5
|
+
import { BrnSonnerImports, type ToasterProps } from '@spartan-ng/brain/sonner';
|
|
3
6
|
import { hlm } from '<%- importAlias %>/utils';
|
|
4
7
|
import type { ClassValue } from 'clsx';
|
|
5
|
-
import { NgxSonnerToaster, type ToasterProps } from 'ngx-sonner';
|
|
6
8
|
|
|
7
9
|
@Component({
|
|
8
10
|
selector: 'hlm-toaster',
|
|
9
|
-
imports: [
|
|
11
|
+
imports: [BrnSonnerImports, NgIcon],
|
|
12
|
+
providers: [provideIcons({ lucideCircleCheck, lucideInfo, lucideTriangleAlert, lucideOctagonX, lucideLoader2 })],
|
|
10
13
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
11
14
|
template: `
|
|
12
|
-
<
|
|
15
|
+
<brn-sonner-toaster
|
|
13
16
|
[class]="_computedClass()"
|
|
14
17
|
[invert]="invert()"
|
|
15
18
|
[theme]="theme()"
|
|
@@ -22,9 +25,24 @@ import { NgxSonnerToaster, type ToasterProps } from 'ngx-sonner';
|
|
|
22
25
|
[closeButton]="closeButton()"
|
|
23
26
|
[toastOptions]="toastOptions()"
|
|
24
27
|
[offset]="offset()"
|
|
25
|
-
[dir]="dir()"
|
|
26
28
|
[style]="userStyle()"
|
|
27
|
-
|
|
29
|
+
>
|
|
30
|
+
<ng-template #loadingIcon>
|
|
31
|
+
<ng-icon name="lucideLoader2" class="overflow-visible! text-base [&>svg]:motion-safe:animate-spin" />
|
|
32
|
+
</ng-template>
|
|
33
|
+
<ng-template #successIcon>
|
|
34
|
+
<ng-icon name="lucideCircleCheck" class="overflow-visible! text-base" />
|
|
35
|
+
</ng-template>
|
|
36
|
+
<ng-template #errorIcon>
|
|
37
|
+
<ng-icon name="lucideOctagonX" class="overflow-visible! text-base" />
|
|
38
|
+
</ng-template>
|
|
39
|
+
<ng-template #infoIcon>
|
|
40
|
+
<ng-icon name="lucideInfo" class="overflow-visible! text-base" />
|
|
41
|
+
</ng-template>
|
|
42
|
+
<ng-template #warningIcon>
|
|
43
|
+
<ng-icon name="lucideTriangleAlert" class="overflow-visible! text-base" />
|
|
44
|
+
</ng-template>
|
|
45
|
+
</brn-sonner-toaster>
|
|
28
46
|
`,
|
|
29
47
|
})
|
|
30
48
|
export class HlmToaster {
|
|
@@ -51,7 +69,6 @@ export class HlmToaster {
|
|
|
51
69
|
});
|
|
52
70
|
public readonly toastOptions = input<ToasterProps['toastOptions']>({});
|
|
53
71
|
public readonly offset = input<ToasterProps['offset']>(null);
|
|
54
|
-
public readonly dir = input<ToasterProps['dir']>('auto');
|
|
55
72
|
public readonly userClass = input<ClassValue>('', { alias: 'class' });
|
|
56
73
|
public readonly userStyle = input<Record<string, string>>(
|
|
57
74
|
{
|
|
@@ -14,8 +14,8 @@ export const tooltipPositionVariants = cva('absolute', {
|
|
|
14
14
|
position: {
|
|
15
15
|
top: 'bottom-0 left-[calc(50%-5px)] translate-y-full',
|
|
16
16
|
bottom: '-top-2.5 left-[calc(50%-5px)] translate-y-0 rotate-180',
|
|
17
|
-
left: 'top-[calc(50%-5px)]
|
|
18
|
-
right: 'top-[calc(50%-5px)]
|
|
17
|
+
left: '-end-2.5 top-[calc(50%-5px)] translate-y-0 rotate-270 rtl:-rotate-270',
|
|
18
|
+
right: '-start-2.5 top-[calc(50%-5px)] translate-y-0 rotate-90 rtl:-rotate-90',
|
|
19
19
|
},
|
|
20
20
|
},
|
|
21
21
|
});
|
|
@@ -18,7 +18,6 @@ export function hlm(...inputs: ClassValue[]) {
|
|
|
18
18
|
|
|
19
19
|
// Global map to track class managers per element
|
|
20
20
|
const elementClassManagers = new WeakMap<HTMLElement, ElementClassManager>();
|
|
21
|
-
|
|
22
21
|
// Global mutation observer for all elements
|
|
23
22
|
let globalObserver: MutationObserver | null = null;
|
|
24
23
|
const observedElements = new Set<HTMLElement>();
|
|
@@ -30,6 +29,13 @@ interface ElementClassManager {
|
|
|
30
29
|
isUpdating: boolean;
|
|
31
30
|
nextOrder: number;
|
|
32
31
|
hasInitialized: boolean;
|
|
32
|
+
restoreRafId: number | null;
|
|
33
|
+
/** Transitions are suppressed until the first effect writes correct classes */
|
|
34
|
+
transitionsSuppressed: boolean;
|
|
35
|
+
/** Original inline transition value to restore after suppression (empty string = none was set) */
|
|
36
|
+
previousTransition: string;
|
|
37
|
+
/** Original inline transition priority to preserve !important when restoring */
|
|
38
|
+
previousTransitionPriority: string;
|
|
33
39
|
}
|
|
34
40
|
|
|
35
41
|
let sourceCounter = 0;
|
|
@@ -72,12 +78,26 @@ export function classes(computed: () => ClassValue[] | string, options: ClassesO
|
|
|
72
78
|
isUpdating: false,
|
|
73
79
|
nextOrder: 0,
|
|
74
80
|
hasInitialized: false,
|
|
81
|
+
restoreRafId: null,
|
|
82
|
+
transitionsSuppressed: false,
|
|
83
|
+
previousTransition: '',
|
|
84
|
+
previousTransitionPriority: '',
|
|
75
85
|
};
|
|
76
86
|
elementClassManagers.set(element, manager);
|
|
77
87
|
|
|
78
88
|
// Setup global observer if needed and register this element
|
|
79
89
|
setupGlobalObserver(platformId);
|
|
80
90
|
observedElements.add(element);
|
|
91
|
+
|
|
92
|
+
// Suppress transitions until the first effect writes correct classes and
|
|
93
|
+
// the browser has painted them. This prevents CSS transition animations
|
|
94
|
+
// during hydration when classes change from SSR state to client state.
|
|
95
|
+
if (isPlatformBrowser(platformId)) {
|
|
96
|
+
manager.previousTransition = element.style.getPropertyValue('transition');
|
|
97
|
+
manager.previousTransitionPriority = element.style.getPropertyPriority('transition');
|
|
98
|
+
element.style.setProperty('transition', 'none', 'important');
|
|
99
|
+
manager.transitionsSuppressed = true;
|
|
100
|
+
}
|
|
81
101
|
}
|
|
82
102
|
|
|
83
103
|
// Assign order once at registration time
|
|
@@ -95,10 +115,31 @@ export function classes(computed: () => ClassValue[] | string, options: ClassesO
|
|
|
95
115
|
|
|
96
116
|
// Update the element
|
|
97
117
|
updateElement(manager!);
|
|
118
|
+
|
|
119
|
+
// Re-enable transitions after the first effect writes correct classes.
|
|
120
|
+
// Deferred to next animation frame so the browser paints the class change
|
|
121
|
+
// with transitions disabled first, then re-enables them.
|
|
122
|
+
if (manager!.transitionsSuppressed) {
|
|
123
|
+
manager!.transitionsSuppressed = false;
|
|
124
|
+
manager!.restoreRafId = requestAnimationFrame(() => {
|
|
125
|
+
manager!.restoreRafId = null;
|
|
126
|
+
restoreTransitionSuppression(manager!);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
98
129
|
}
|
|
99
130
|
|
|
100
131
|
// Register cleanup with DestroyRef
|
|
101
132
|
destroyRef.onDestroy(() => {
|
|
133
|
+
if (manager!.restoreRafId !== null) {
|
|
134
|
+
cancelAnimationFrame(manager!.restoreRafId);
|
|
135
|
+
manager!.restoreRafId = null;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (manager!.transitionsSuppressed) {
|
|
139
|
+
manager!.transitionsSuppressed = false;
|
|
140
|
+
restoreTransitionSuppression(manager!);
|
|
141
|
+
}
|
|
142
|
+
|
|
102
143
|
// Remove this source from the manager
|
|
103
144
|
manager!.sources.delete(sourceId);
|
|
104
145
|
|
|
@@ -120,6 +161,15 @@ export function classes(computed: () => ClassValue[] | string, options: ClassesO
|
|
|
120
161
|
});
|
|
121
162
|
}
|
|
122
163
|
|
|
164
|
+
function restoreTransitionSuppression(manager: ElementClassManager): void {
|
|
165
|
+
const prev = manager.previousTransition;
|
|
166
|
+
if (prev) {
|
|
167
|
+
manager.element.style.setProperty('transition', prev, manager.previousTransitionPriority || undefined);
|
|
168
|
+
} else {
|
|
169
|
+
manager.element.style.removeProperty('transition');
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
123
173
|
// eslint-disable-next-line @typescript-eslint/no-wrapper-object-types
|
|
124
174
|
function setupGlobalObserver(platformId: Object): void {
|
|
125
175
|
if (isPlatformBrowser(platformId) && !globalObserver) {
|
|
@@ -207,7 +257,7 @@ function updateElement(manager: ElementClassManager): void {
|
|
|
207
257
|
// Combine base classes with all source classes, ensuring base classes take precedence
|
|
208
258
|
const classesToApply =
|
|
209
259
|
allSourceClasses.length > 0 || manager.baseClasses.size > 0
|
|
210
|
-
?
|
|
260
|
+
? hlm([...allSourceClasses, ...manager.baseClasses])
|
|
211
261
|
: '';
|
|
212
262
|
|
|
213
263
|
// Apply the classes to the element
|