wally-ui 1.2.1 → 1.4.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 +1 -1
- package/playground/showcase/package-lock.json +18 -0
- package/playground/showcase/package.json +2 -0
- package/playground/showcase/public/_headers +7 -0
- package/playground/showcase/public/robots.txt +14 -0
- package/playground/showcase/src/app/app.routes.server.ts +14 -2
- package/playground/showcase/src/app/app.routes.ts +5 -1
- package/playground/showcase/src/app/components/breadcrumb/breadcrumb.ts +1 -0
- package/playground/showcase/src/app/components/input/input.html +70 -0
- package/playground/showcase/src/app/{pages/components/button-docs/button-docs.spec.ts → components/input/input.spec.ts} +6 -6
- package/playground/showcase/src/app/components/input/input.ts +98 -0
- package/playground/showcase/src/app/core/services/ai-prompt.service.ts +2 -2
- package/playground/showcase/src/app/core/utils/prism.ts +14 -0
- package/playground/showcase/src/app/pages/documentation/components/breadcrumb-docs/breadcrumb-docs.examples.ts +71 -0
- package/playground/showcase/src/app/pages/{components → documentation/components}/breadcrumb-docs/breadcrumb-docs.html +13 -43
- package/playground/showcase/src/app/pages/documentation/components/breadcrumb-docs/breadcrumb-docs.ts +63 -0
- package/playground/showcase/src/app/pages/documentation/components/button-docs/button-docs.examples.ts +55 -0
- package/playground/showcase/src/app/pages/{components → documentation/components}/button-docs/button-docs.html +26 -101
- package/playground/showcase/src/app/pages/documentation/components/button-docs/button-docs.ts +64 -0
- package/playground/showcase/src/app/pages/documentation/components/components.html +73 -0
- package/playground/showcase/src/app/pages/{components → documentation/components}/components.routes.ts +4 -0
- package/playground/showcase/src/app/pages/{components → documentation/components}/components.ts +3 -1
- package/playground/showcase/src/app/pages/documentation/components/input-docs/input-docs.css +13 -0
- package/playground/showcase/src/app/pages/documentation/components/input-docs/input-docs.examples.ts +88 -0
- package/playground/showcase/src/app/pages/documentation/components/input-docs/input-docs.html +357 -0
- package/playground/showcase/src/app/pages/documentation/components/input-docs/input-docs.ts +105 -0
- package/playground/showcase/src/app/pages/documentation/documentation.css +0 -0
- package/playground/showcase/src/app/pages/{components/components.html → documentation/documentation.html} +70 -43
- package/playground/showcase/src/app/pages/documentation/documentation.routes.ts +12 -0
- package/playground/showcase/src/app/pages/documentation/documentation.ts +16 -0
- package/playground/showcase/src/app/pages/home/home.html +9 -4
- package/playground/showcase/src/app/pages/home/home.ts +1 -3
- package/playground/showcase/src/app/pages/mcp/mcp.html +1 -1
- package/playground/showcase/src/index.html +7 -1
- package/playground/showcase/src/styles.css +547 -1
- package/playground/showcase/src/app/pages/components/breadcrumb-docs/breadcrumb-docs.ts +0 -43
- package/playground/showcase/src/app/pages/components/button-docs/button-docs.ts +0 -41
- package/playground/showcase/src/app/pages/components/components.spec.ts +0 -23
- /package/playground/showcase/src/app/pages/{components → documentation/components}/breadcrumb-docs/breadcrumb-docs.css +0 -0
- /package/playground/showcase/src/app/pages/{components → documentation/components}/button-docs/button-docs.css +0 -0
- /package/playground/showcase/src/app/pages/{components → documentation/components}/components.css +0 -0
package/package.json
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"@tailwindcss/postcss": "^4.1.13",
|
|
20
20
|
"express": "^5.1.0",
|
|
21
21
|
"postcss": "^8.5.6",
|
|
22
|
+
"prismjs": "^1.30.0",
|
|
22
23
|
"rxjs": "~7.8.0",
|
|
23
24
|
"tailwindcss": "^4.1.13",
|
|
24
25
|
"tslib": "^2.3.0",
|
|
@@ -31,6 +32,7 @@
|
|
|
31
32
|
"@types/express": "^5.0.1",
|
|
32
33
|
"@types/jasmine": "~5.1.0",
|
|
33
34
|
"@types/node": "^20.17.19",
|
|
35
|
+
"@types/prismjs": "^1.26.5",
|
|
34
36
|
"jasmine-core": "~5.7.0",
|
|
35
37
|
"karma": "~6.4.0",
|
|
36
38
|
"karma-chrome-launcher": "~3.2.0",
|
|
@@ -4252,6 +4254,13 @@
|
|
|
4252
4254
|
"undici-types": "~6.21.0"
|
|
4253
4255
|
}
|
|
4254
4256
|
},
|
|
4257
|
+
"node_modules/@types/prismjs": {
|
|
4258
|
+
"version": "1.26.5",
|
|
4259
|
+
"resolved": "https://registry.npmjs.org/@types/prismjs/-/prismjs-1.26.5.tgz",
|
|
4260
|
+
"integrity": "sha512-AUZTa7hQ2KY5L7AmtSiqxlhWxb4ina0yd8hNbl4TWuqnv/pFP0nDMb3YrfSBf4hJVGLh2YEIBfKaBW/9UEl6IQ==",
|
|
4261
|
+
"dev": true,
|
|
4262
|
+
"license": "MIT"
|
|
4263
|
+
},
|
|
4255
4264
|
"node_modules/@types/qs": {
|
|
4256
4265
|
"version": "6.14.0",
|
|
4257
4266
|
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.14.0.tgz",
|
|
@@ -8815,6 +8824,15 @@
|
|
|
8815
8824
|
"dev": true,
|
|
8816
8825
|
"license": "MIT"
|
|
8817
8826
|
},
|
|
8827
|
+
"node_modules/prismjs": {
|
|
8828
|
+
"version": "1.30.0",
|
|
8829
|
+
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.30.0.tgz",
|
|
8830
|
+
"integrity": "sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw==",
|
|
8831
|
+
"license": "MIT",
|
|
8832
|
+
"engines": {
|
|
8833
|
+
"node": ">=6"
|
|
8834
|
+
}
|
|
8835
|
+
},
|
|
8818
8836
|
"node_modules/proc-log": {
|
|
8819
8837
|
"version": "5.0.0",
|
|
8820
8838
|
"resolved": "https://registry.npmjs.org/proc-log/-/proc-log-5.0.0.tgz",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"@tailwindcss/postcss": "^4.1.13",
|
|
33
33
|
"express": "^5.1.0",
|
|
34
34
|
"postcss": "^8.5.6",
|
|
35
|
+
"prismjs": "^1.30.0",
|
|
35
36
|
"rxjs": "~7.8.0",
|
|
36
37
|
"tailwindcss": "^4.1.13",
|
|
37
38
|
"tslib": "^2.3.0",
|
|
@@ -44,6 +45,7 @@
|
|
|
44
45
|
"@types/express": "^5.0.1",
|
|
45
46
|
"@types/jasmine": "~5.1.0",
|
|
46
47
|
"@types/node": "^20.17.19",
|
|
48
|
+
"@types/prismjs": "^1.26.5",
|
|
47
49
|
"jasmine-core": "~5.7.0",
|
|
48
50
|
"karma": "~6.4.0",
|
|
49
51
|
"karma-chrome-launcher": "~3.2.0",
|
|
@@ -6,11 +6,23 @@ export const serverRoutes: ServerRoute[] = [
|
|
|
6
6
|
renderMode: RenderMode.Prerender
|
|
7
7
|
},
|
|
8
8
|
{
|
|
9
|
-
path: '
|
|
9
|
+
path: 'documentation',
|
|
10
|
+
renderMode: RenderMode.Prerender,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
path: 'documentation/components',
|
|
10
14
|
renderMode: RenderMode.Prerender,
|
|
11
15
|
},
|
|
12
16
|
{
|
|
13
|
-
path: 'components/button',
|
|
17
|
+
path: 'documentation/components/button',
|
|
18
|
+
renderMode: RenderMode.Prerender,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
path: 'documentation/components/breadcrumb',
|
|
22
|
+
renderMode: RenderMode.Prerender,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
path: 'components',
|
|
14
26
|
renderMode: RenderMode.Prerender,
|
|
15
27
|
},
|
|
16
28
|
{
|
|
@@ -5,9 +5,13 @@ export const routes: Routes = [
|
|
|
5
5
|
path: '',
|
|
6
6
|
loadComponent: () => import('./pages/home/home').then(m => m.Home)
|
|
7
7
|
},
|
|
8
|
+
{
|
|
9
|
+
path: 'documentation',
|
|
10
|
+
loadChildren: () => import('./pages/documentation/documentation.routes').then(m => m.documentationRoutes)
|
|
11
|
+
},
|
|
8
12
|
{
|
|
9
13
|
path: 'components',
|
|
10
|
-
|
|
14
|
+
redirectTo: '/documentation/components'
|
|
11
15
|
},
|
|
12
16
|
{
|
|
13
17
|
path: 'mcp',
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
@if (label()) {
|
|
2
|
+
<div class="py-1">
|
|
3
|
+
<label [for]="inputId" class="block text-sm font-medium text-[#0a0a0a] dark:text-white">
|
|
4
|
+
{{ label() }}
|
|
5
|
+
</label>
|
|
6
|
+
</div>
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
<div class="relative">
|
|
10
|
+
<input [id]="inputId" [type]="currentInputType()" [value]="value()" [disabled]="disabled || loading()"
|
|
11
|
+
[placeholder]="placeholder()" [autocomplete]="autocomplete() || (type() === 'password' ? 'new-password' : '')" class="
|
|
12
|
+
font-semibold
|
|
13
|
+
block
|
|
14
|
+
w-full
|
|
15
|
+
rounded-lg
|
|
16
|
+
border-2 border-transparent
|
|
17
|
+
text-[#0a0a0a] text-base md:text-sm placeholder:text-neutral-400
|
|
18
|
+
focus:outline-none focus:ring-2 focus:ring-neutral-300
|
|
19
|
+
bg-gray-100
|
|
20
|
+
dark:bg-[#1b1b1b] dark:text-white dark:placeholder:text-neutral-500 dark:focus:ring-neutral-700
|
|
21
|
+
disabled:opacity-80 disabled:pointer-events-none
|
|
22
|
+
transition duration-200 ease-in-out
|
|
23
|
+
py-4 px-4" [ngClass]="{
|
|
24
|
+
'pe-12': type() === 'password',
|
|
25
|
+
'ps-12': loading(),
|
|
26
|
+
'!bg-green-100 focus:!ring-green-500/50 placeholder:!text-green-600/70 !text-green-600 focus:!border-green-500 dark:!bg-[#1b1b1b] dark:!border-green-600 dark:!text-green-500 dark:placeholder:!text-green-400/40 dark:focus:!ring-green-500/50': valid() && !errorMessage(),
|
|
27
|
+
'!border-red-300 bg-red-100 !text-red-500 placeholder:text-red-300 focus:ring-red-300 dark:!text-red-500 dark:placeholder:!text-red-500 dark:!border-red-500 dark:focus:!ring-red-500': errorMessage() && !valid()
|
|
28
|
+
}">
|
|
29
|
+
|
|
30
|
+
<!-- Loading spinner -->
|
|
31
|
+
@if (loading()) {
|
|
32
|
+
<div class="absolute inset-y-0 start-0 flex items-center ps-4">
|
|
33
|
+
<svg class="size-4 animate-spin text-neutral-500 dark:text-neutral-400" xmlns="http://www.w3.org/2000/svg"
|
|
34
|
+
fill="none" viewBox="0 0 24 24">
|
|
35
|
+
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
|
36
|
+
<path class="opacity-75" fill="currentColor"
|
|
37
|
+
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
|
|
38
|
+
</path>
|
|
39
|
+
</svg>
|
|
40
|
+
</div>
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@if (type() === 'password' && !loading()) {
|
|
44
|
+
<button type="button" (click)="togglePasswordVisibility()"
|
|
45
|
+
class="absolute inset-y-0 end-0 flex items-center pe-4 cursor-pointer focus:outline-none transition duration-200 ease-in-out">
|
|
46
|
+
@if (showPassword()) {
|
|
47
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"
|
|
48
|
+
class="size-5 text-neutral-500 hover:text-neutral-700 dark:text-neutral-500 dark:hover:text-neutral-200">
|
|
49
|
+
<path stroke-linecap="round" stroke-linejoin="round"
|
|
50
|
+
d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z" />
|
|
51
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" />
|
|
52
|
+
</svg>
|
|
53
|
+
} @else {
|
|
54
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"
|
|
55
|
+
class="size-5 text-neutral-500 hover:text-neutral-700 dark:text-neutral-500 dark:hover:text-neutral-200">
|
|
56
|
+
<path stroke-linecap="round" stroke-linejoin="round"
|
|
57
|
+
d="M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88" />
|
|
58
|
+
</svg>
|
|
59
|
+
}
|
|
60
|
+
</button>
|
|
61
|
+
}
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
@if (errorMessage()) {
|
|
65
|
+
<div class="py-1">
|
|
66
|
+
<span class="text-sm text-red-500 font-medium">
|
|
67
|
+
{{ errorMessage() }}
|
|
68
|
+
</span>
|
|
69
|
+
</div>
|
|
70
|
+
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Input } from './input';
|
|
4
4
|
|
|
5
|
-
describe('
|
|
6
|
-
let component:
|
|
7
|
-
let fixture: ComponentFixture<
|
|
5
|
+
describe('Input', () => {
|
|
6
|
+
let component: Input;
|
|
7
|
+
let fixture: ComponentFixture<Input>;
|
|
8
8
|
|
|
9
9
|
beforeEach(async () => {
|
|
10
10
|
await TestBed.configureTestingModule({
|
|
11
|
-
imports: [
|
|
11
|
+
imports: [Input]
|
|
12
12
|
})
|
|
13
13
|
.compileComponents();
|
|
14
14
|
|
|
15
|
-
fixture = TestBed.createComponent(
|
|
15
|
+
fixture = TestBed.createComponent(Input);
|
|
16
16
|
component = fixture.componentInstance;
|
|
17
17
|
fixture.detectChanges();
|
|
18
18
|
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import {
|
|
3
|
+
Component, computed, HostListener, input, InputSignal, signal, untracked, WritableSignal
|
|
4
|
+
} from '@angular/core';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
ControlValueAccessor,
|
|
8
|
+
NG_VALUE_ACCESSOR
|
|
9
|
+
} from '@angular/forms';
|
|
10
|
+
|
|
11
|
+
@Component({
|
|
12
|
+
selector: 'wally-input',
|
|
13
|
+
imports: [
|
|
14
|
+
CommonModule
|
|
15
|
+
],
|
|
16
|
+
// standalone: true, (If your application is lower than Angular 19, uncomment this line)
|
|
17
|
+
templateUrl: './input.html',
|
|
18
|
+
providers: [
|
|
19
|
+
{
|
|
20
|
+
provide: NG_VALUE_ACCESSOR,
|
|
21
|
+
useExisting: Input,
|
|
22
|
+
multi: true
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
})
|
|
26
|
+
export class Input implements ControlValueAccessor {
|
|
27
|
+
placeholder: InputSignal<string> = input<string>('');
|
|
28
|
+
type: InputSignal<string> = input<string>('text');
|
|
29
|
+
label: InputSignal<string> = input<string>('');
|
|
30
|
+
autocomplete: InputSignal<string> = input<string>('');
|
|
31
|
+
|
|
32
|
+
valid: InputSignal<boolean> = input<boolean>(false);
|
|
33
|
+
errorMessage: InputSignal<string> = input<string>('');
|
|
34
|
+
loading: InputSignal<boolean> = input<boolean>(false);
|
|
35
|
+
|
|
36
|
+
protected readonly showPassword = signal<boolean>(false);
|
|
37
|
+
protected readonly inputId = `wally-input-${Math.random().toString(36).substring(2, 11)}`;
|
|
38
|
+
|
|
39
|
+
private touched: WritableSignal<boolean> = signal<boolean>(false);
|
|
40
|
+
value: WritableSignal<string> = signal<string>('');
|
|
41
|
+
|
|
42
|
+
protected readonly currentInputType = computed(() => {
|
|
43
|
+
const currentType = this.type();
|
|
44
|
+
|
|
45
|
+
if (currentType !== 'password') {
|
|
46
|
+
return currentType;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (this.showPassword()) {
|
|
50
|
+
return 'text';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return 'password';
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
disabled: boolean = false;
|
|
57
|
+
|
|
58
|
+
private onChange = (value: any) => { };
|
|
59
|
+
private onTouched = () => { };
|
|
60
|
+
|
|
61
|
+
writeValue(obj: any): void {
|
|
62
|
+
untracked(() => {
|
|
63
|
+
this.value.set(obj || '');
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
registerOnChange(fn: any): void {
|
|
68
|
+
this.onChange = fn;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
registerOnTouched(fn: any): void {
|
|
72
|
+
this.onTouched = fn;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
setDisabledState?(isDisabled: boolean): void {
|
|
76
|
+
this.disabled = isDisabled;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
togglePasswordVisibility(): void {
|
|
80
|
+
this.showPassword.set(!this.showPassword());
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@HostListener('input', ['$event'])
|
|
84
|
+
onInputChange(event: Event): void {
|
|
85
|
+
const target = event.target as HTMLInputElement;
|
|
86
|
+
const newValue = target.value;
|
|
87
|
+
this.value.set(newValue);
|
|
88
|
+
this.onChange(newValue);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@HostListener('blur')
|
|
92
|
+
onInputBlur(): void {
|
|
93
|
+
if (!this.touched()) {
|
|
94
|
+
this.touched.set(true);
|
|
95
|
+
this.onTouched();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -26,8 +26,8 @@ export class AiPromptService {
|
|
|
26
26
|
if (isPlatformBrowser(this.platformId)) {
|
|
27
27
|
return window.location.href;
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
return 'https://wally-ui.com/components/button';
|
|
29
|
+
|
|
30
|
+
return 'https://wally-ui.com/documentation/components/button';
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
generateCustomPromptUrl(aiService: 'claude' | 'chatgpt', customPrompt: string, pageUrl?: string): string {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as Prism from 'prismjs';
|
|
2
|
+
import 'prismjs/components/prism-typescript';
|
|
3
|
+
import 'prismjs/components/prism-javascript';
|
|
4
|
+
import 'prismjs/components/prism-bash';
|
|
5
|
+
import 'prismjs/components/prism-markup';
|
|
6
|
+
|
|
7
|
+
export function highlightCode(code: string, language: string = 'typescript'): string {
|
|
8
|
+
return Prism.highlight(code, Prism.languages[language], language);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function getFormattedCode(code: string, language: string = 'html'): string {
|
|
12
|
+
const cleanCode = code.trim();
|
|
13
|
+
return highlightCode(cleanCode, language);
|
|
14
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// Breadcrumb documentation code examples
|
|
2
|
+
export const BreadcrumbCodeExamples = {
|
|
3
|
+
// Installation
|
|
4
|
+
installation: `npx wally-ui add breadcrumb`,
|
|
5
|
+
|
|
6
|
+
// Import examples
|
|
7
|
+
import: `import { Breadcrumb, BreadcrumbItem } from './components/wally-ui/breadcrumb/breadcrumb';`,
|
|
8
|
+
componentImport: `@Component({
|
|
9
|
+
selector: 'app-example',
|
|
10
|
+
imports: [Breadcrumb],
|
|
11
|
+
templateUrl: './example.html',
|
|
12
|
+
styleUrl: './example.css'
|
|
13
|
+
})`,
|
|
14
|
+
|
|
15
|
+
// Basic usage
|
|
16
|
+
basicUsage: `<wally-breadcrumb [items]="breadcrumbItems"></wally-breadcrumb>`,
|
|
17
|
+
|
|
18
|
+
// Component setup
|
|
19
|
+
componentSetup: `export class ExampleComponent {
|
|
20
|
+
breadcrumbItems: BreadcrumbItem[] = [
|
|
21
|
+
{ label: 'Home', url: '/' },
|
|
22
|
+
{ label: 'Products', url: '/products' },
|
|
23
|
+
{ label: 'Category' }
|
|
24
|
+
];
|
|
25
|
+
}`,
|
|
26
|
+
|
|
27
|
+
// Basic setup for simple example
|
|
28
|
+
basicSetup: `breadcrumbItems: BreadcrumbItem[] = [
|
|
29
|
+
{ label: 'Components' }
|
|
30
|
+
];`,
|
|
31
|
+
|
|
32
|
+
// Specific examples
|
|
33
|
+
multiLevelSetup: `breadcrumbItems: BreadcrumbItem[] = [
|
|
34
|
+
{ label: 'Home', url: '/' },
|
|
35
|
+
{ label: 'Documentation', url: '/documentation' },
|
|
36
|
+
{ label: 'Components', url: '/documentation/components' },
|
|
37
|
+
{ label: 'Breadcrumb' }
|
|
38
|
+
];`,
|
|
39
|
+
|
|
40
|
+
singleItemSetup: `breadcrumbItems: BreadcrumbItem[] = [
|
|
41
|
+
{ label: 'Components' }
|
|
42
|
+
];`,
|
|
43
|
+
|
|
44
|
+
// Interface
|
|
45
|
+
interface: `interface BreadcrumbItem {
|
|
46
|
+
label: string;
|
|
47
|
+
url?: string;
|
|
48
|
+
}`,
|
|
49
|
+
|
|
50
|
+
// Advanced examples
|
|
51
|
+
withIcons: `<wally-breadcrumb [items]="breadcrumbItemsWithIcons"></wally-breadcrumb>`,
|
|
52
|
+
|
|
53
|
+
withIconsSetup: `breadcrumbItemsWithIcons: BreadcrumbItem[] = [
|
|
54
|
+
{
|
|
55
|
+
label: 'Home',
|
|
56
|
+
url: '/',
|
|
57
|
+
icon: '<svg>...</svg>'
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
label: 'Settings',
|
|
61
|
+
url: '/settings',
|
|
62
|
+
icon: '<svg>...</svg>'
|
|
63
|
+
},
|
|
64
|
+
{ label: 'Profile' }
|
|
65
|
+
];`,
|
|
66
|
+
|
|
67
|
+
// Properties
|
|
68
|
+
propertyItems: `items: BreadcrumbItem[] = [];`,
|
|
69
|
+
propertySeparator: `separator?: string = '/';`,
|
|
70
|
+
propertyMaxItems: `maxItems?: number;`
|
|
71
|
+
};
|
|
@@ -47,9 +47,7 @@
|
|
|
47
47
|
<section class="mb-8">
|
|
48
48
|
<h2 class="text-lg font-semibold mb-4 text-[#0a0a0a] dark:text-white">Installation</h2>
|
|
49
49
|
<div class="bg-gray-200 dark:bg-[#121212] p-4 rounded-lg">
|
|
50
|
-
<code class="text-sm text-[#0a0a0a] dark:text-white">
|
|
51
|
-
npx wally-ui add breadcrumb
|
|
52
|
-
</code>
|
|
50
|
+
<pre><code [innerHTML]="installationCode" class="text-sm text-[#0a0a0a] dark:text-white"></code></pre>
|
|
53
51
|
</div>
|
|
54
52
|
</section>
|
|
55
53
|
|
|
@@ -70,20 +68,11 @@
|
|
|
70
68
|
<h2 class="text-lg font-semibold mb-4 text-[#0a0a0a] dark:text-white">Import</h2>
|
|
71
69
|
<div class="space-y-4">
|
|
72
70
|
<div class="bg-gray-200 dark:bg-[#121212] p-4 rounded-lg">
|
|
73
|
-
<code class="text-sm text-[#0a0a0a] dark:text-white">
|
|
74
|
-
import {{ '{' }} Breadcrumb, BreadcrumbItem {{ '}' }} from './components/wally-ui/breadcrumb/breadcrumb';
|
|
75
|
-
</code>
|
|
71
|
+
<pre><code [innerHTML]="importCode" class="text-sm text-[#0a0a0a] dark:text-white"></code></pre>
|
|
76
72
|
</div>
|
|
77
73
|
|
|
78
74
|
<div class="bg-gray-200 dark:bg-[#121212] p-4 rounded-lg">
|
|
79
|
-
<code class="text-sm text-[#0a0a0a] dark:text-white">
|
|
80
|
-
@Component({{ '{' }}<br>
|
|
81
|
-
selector: 'app-example',<br>
|
|
82
|
-
imports: [Breadcrumb],<br>
|
|
83
|
-
templateUrl: './example.html',<br>
|
|
84
|
-
styleUrl: './example.css'<br>
|
|
85
|
-
{{ '}' }})
|
|
86
|
-
</code>
|
|
75
|
+
<pre><code [innerHTML]="componentImportCode" class="text-sm text-[#0a0a0a] dark:text-white"></code></pre>
|
|
87
76
|
</div>
|
|
88
77
|
</div>
|
|
89
78
|
</section>
|
|
@@ -95,9 +84,10 @@
|
|
|
95
84
|
<div class="space-y-8">
|
|
96
85
|
<div>
|
|
97
86
|
<div class="bg-gray-200 dark:bg-[#121212] p-4 rounded-lg mb-4">
|
|
98
|
-
<code class="text-sm text-[#0a0a0a] dark:text-white">
|
|
99
|
-
|
|
100
|
-
|
|
87
|
+
<pre><code [innerHTML]="basicSetupCode" class="text-sm text-[#0a0a0a] dark:text-white"></code></pre>
|
|
88
|
+
</div>
|
|
89
|
+
<div class="bg-gray-200 dark:bg-[#121212] p-4 rounded-lg mb-4">
|
|
90
|
+
<pre><code [innerHTML]="basicUsageCode" class="text-sm text-[#0a0a0a] dark:text-white"></code></pre>
|
|
101
91
|
</div>
|
|
102
92
|
<div class="p-6 border rounded-lg bg-white dark:bg-[#121212]">
|
|
103
93
|
<wally-breadcrumb [items]="simpleBreadcrumbs"></wally-breadcrumb>
|
|
@@ -115,13 +105,7 @@
|
|
|
115
105
|
<div>
|
|
116
106
|
<h3 class="text-md font-medium mb-3 text-[#0a0a0a] dark:text-white">Multi-level Navigation</h3>
|
|
117
107
|
<div class="bg-gray-200 dark:bg-[#121212] p-4 rounded-lg mb-4">
|
|
118
|
-
<code class="text-sm text-[#0a0a0a] dark:text-white">
|
|
119
|
-
breadcrumbItems: BreadcrumbItem[] = [<br>
|
|
120
|
-
{{ '{' }} label: 'Home', url: '/' {{ '}' }},<br>
|
|
121
|
-
{{ '{' }} label: 'Components', url: '/components' {{ '}' }},<br>
|
|
122
|
-
{{ '{' }} label: 'Button' {{ '}' }}<br>
|
|
123
|
-
];
|
|
124
|
-
</code>
|
|
108
|
+
<pre><code [innerHTML]="multiLevelSetupCode" class="text-sm text-[#0a0a0a] dark:text-white"></code></pre>
|
|
125
109
|
</div>
|
|
126
110
|
<div class="p-6 border rounded-lg bg-white dark:bg-[#121212]">
|
|
127
111
|
<wally-breadcrumb [items]="exampleBreadcrumbs"></wally-breadcrumb>
|
|
@@ -132,11 +116,7 @@
|
|
|
132
116
|
<div>
|
|
133
117
|
<h3 class="text-md font-medium mb-3 text-[#0a0a0a] dark:text-white">Single Item</h3>
|
|
134
118
|
<div class="bg-gray-200 dark:bg-[#121212] p-4 rounded-lg mb-4">
|
|
135
|
-
<code class="text-sm text-[#0a0a0a] dark:text-white">
|
|
136
|
-
breadcrumbItems: BreadcrumbItem[] = [<br>
|
|
137
|
-
{{ '{' }} label: 'Components' {{ '}' }}<br>
|
|
138
|
-
];
|
|
139
|
-
</code>
|
|
119
|
+
<pre><code [innerHTML]="singleItemSetupCode" class="text-sm text-[#0a0a0a] dark:text-white"></code></pre>
|
|
140
120
|
</div>
|
|
141
121
|
<div class="p-6 border rounded-lg bg-white dark:bg-[#121212]">
|
|
142
122
|
<wally-breadcrumb [items]="simpleBreadcrumbs"></wally-breadcrumb>
|
|
@@ -150,14 +130,9 @@
|
|
|
150
130
|
<h2 class="text-lg font-semibold mb-4 text-[#0a0a0a] dark:text-white">Properties</h2>
|
|
151
131
|
|
|
152
132
|
<div class="space-y-4">
|
|
153
|
-
<div class="
|
|
154
|
-
<div class="
|
|
155
|
-
<
|
|
156
|
-
</span>
|
|
157
|
-
<span class="text-purple-600 dark:text-purple-400">BreadcrumbItem[]</span> <span
|
|
158
|
-
class="text-[#0a0a0a] dark:text-white"> = </span>
|
|
159
|
-
<span class="text-green-600 dark:text-green-400">[]</span>
|
|
160
|
-
<span class="text-[#0a0a0a] dark:text-white">;</span>
|
|
133
|
+
<div class="space-y-2">
|
|
134
|
+
<div class="bg-gray-200 dark:bg-[#121212] p-4 rounded-lg">
|
|
135
|
+
<pre><code [innerHTML]="propertyItemsCode" class="text-sm text-[#0a0a0a] dark:text-white"></code></pre>
|
|
161
136
|
</div>
|
|
162
137
|
<p class="text-sm text-gray-700 dark:text-gray-400">Array of breadcrumb items to display</p>
|
|
163
138
|
</div>
|
|
@@ -169,12 +144,7 @@
|
|
|
169
144
|
<h2 class="text-lg font-semibold mb-4 text-[#0a0a0a] dark:text-white">Interface</h2>
|
|
170
145
|
|
|
171
146
|
<div class="bg-gray-200 dark:bg-[#121212] p-4 rounded-lg">
|
|
172
|
-
<code class="text-sm text-[#0a0a0a] dark:text-white">
|
|
173
|
-
interface BreadcrumbItem {{ '{' }}<br>
|
|
174
|
-
label: string;<br>
|
|
175
|
-
url?: string;<br>
|
|
176
|
-
{{ '}' }}
|
|
177
|
-
</code>
|
|
147
|
+
<pre><code [innerHTML]="interfaceCode" class="text-sm text-[#0a0a0a] dark:text-white"></code></pre>
|
|
178
148
|
</div>
|
|
179
149
|
</section>
|
|
180
150
|
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
import { Breadcrumb, BreadcrumbItem } from '../../../../components/breadcrumb/breadcrumb';
|
|
4
|
+
|
|
5
|
+
import { AiPromptService } from '../../../../core/services/ai-prompt.service';
|
|
6
|
+
import { getFormattedCode } from '../../../../core/utils/prism';
|
|
7
|
+
|
|
8
|
+
import { BreadcrumbCodeExamples } from './breadcrumb-docs.examples';
|
|
9
|
+
|
|
10
|
+
@Component({
|
|
11
|
+
selector: 'app-breadcrumb-docs',
|
|
12
|
+
imports: [
|
|
13
|
+
Breadcrumb
|
|
14
|
+
],
|
|
15
|
+
templateUrl: './breadcrumb-docs.html',
|
|
16
|
+
styleUrl: './breadcrumb-docs.css'
|
|
17
|
+
})
|
|
18
|
+
export class BreadcrumbDocs {
|
|
19
|
+
breadcrumbItems: BreadcrumbItem[] = [
|
|
20
|
+
{ label: 'Home', url: '/' },
|
|
21
|
+
{ label: 'Documentation', url: '/documentation' },
|
|
22
|
+
{ label: 'Components', url: '/documentation/components' },
|
|
23
|
+
{ label: 'Breadcrumb' }
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
exampleBreadcrumbs: BreadcrumbItem[] = [
|
|
27
|
+
{ label: 'Home', url: '/' },
|
|
28
|
+
{ label: 'Documentation', url: '/documentation' },
|
|
29
|
+
{ label: 'Components', url: '/documentation/components' },
|
|
30
|
+
{ label: 'Breadcrumb' }
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
simpleBreadcrumbs: BreadcrumbItem[] = [
|
|
34
|
+
{ label: 'Components' }
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
installationCode = getFormattedCode(BreadcrumbCodeExamples.installation, 'bash');
|
|
38
|
+
importCode = getFormattedCode(BreadcrumbCodeExamples.import, 'typescript');
|
|
39
|
+
componentImportCode = getFormattedCode(BreadcrumbCodeExamples.componentImport, 'typescript');
|
|
40
|
+
basicUsageCode = getFormattedCode(BreadcrumbCodeExamples.basicUsage, 'html');
|
|
41
|
+
componentSetupCode = getFormattedCode(BreadcrumbCodeExamples.componentSetup, 'typescript');
|
|
42
|
+
basicSetupCode = getFormattedCode(BreadcrumbCodeExamples.basicSetup, 'typescript');
|
|
43
|
+
multiLevelSetupCode = getFormattedCode(BreadcrumbCodeExamples.multiLevelSetup, 'typescript');
|
|
44
|
+
singleItemSetupCode = getFormattedCode(BreadcrumbCodeExamples.singleItemSetup, 'typescript');
|
|
45
|
+
interfaceCode = getFormattedCode(BreadcrumbCodeExamples.interface, 'typescript');
|
|
46
|
+
withIconsCode = getFormattedCode(BreadcrumbCodeExamples.withIcons, 'html');
|
|
47
|
+
withIconsSetupCode = getFormattedCode(BreadcrumbCodeExamples.withIconsSetup, 'typescript');
|
|
48
|
+
propertyItemsCode = getFormattedCode(BreadcrumbCodeExamples.propertyItems, 'typescript');
|
|
49
|
+
propertySeparatorCode = getFormattedCode(BreadcrumbCodeExamples.propertySeparator, 'typescript');
|
|
50
|
+
propertyMaxItemsCode = getFormattedCode(BreadcrumbCodeExamples.propertyMaxItems, 'typescript');
|
|
51
|
+
|
|
52
|
+
constructor(
|
|
53
|
+
private aiPromptService: AiPromptService
|
|
54
|
+
) { }
|
|
55
|
+
|
|
56
|
+
get claudeUrl(): string {
|
|
57
|
+
return this.aiPromptService.generateClaudeUrl();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
get chatGptUrl(): string {
|
|
61
|
+
return this.aiPromptService.generateChatGptUrl();
|
|
62
|
+
}
|
|
63
|
+
}
|