@kopynator/angular 1.0.4 → 1.0.5

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.
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "node_modules/ng-packagr/ng-package.schema.json",
3
+ "lib": {
4
+ "entryFile": "src/public-api.ts"
5
+ },
6
+ "dest": "../../dist/packages/angular"
7
+ }
package/package.json CHANGED
@@ -1,28 +1,15 @@
1
1
  {
2
2
  "name": "@kopynator/angular",
3
- "version": "1.0.4",
4
- "main": "./dist/public-api.js",
5
- "module": "./dist/public-api.mjs",
6
- "types": "./dist/public-api.d.ts",
7
- "exports": {
8
- ".": {
9
- "types": "./dist/public-api.d.ts",
10
- "import": "./dist/public-api.mjs",
11
- "require": "./dist/public-api.js"
12
- }
13
- },
14
- "files": [
15
- "dist"
16
- ],
3
+ "version": "1.0.5",
17
4
  "publishConfig": {
18
5
  "access": "public"
19
6
  },
20
7
  "peerDependencies": {
21
8
  "@angular/common": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0",
22
- "@angular/core": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0"
9
+ "@angular/core": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0",
10
+ "@kopynator/core": "^1.0.1"
23
11
  },
24
12
  "dependencies": {
25
- "@kopynator/core": "^1.0.1",
26
13
  "tslib": "^2.3.0"
27
14
  },
28
15
  "devDependencies": {
@@ -30,11 +17,12 @@
30
17
  "@angular/core": "^21.0.6",
31
18
  "@angular/platform-browser": "^21.0.6",
32
19
  "@swc/core": "^1.15.7",
20
+ "ng-packagr": "^21.0.1",
33
21
  "tsup": "^8.0.0",
34
22
  "typescript": "^5.0.0"
35
23
  },
36
24
  "scripts": {
37
- "build": "tsup src/public-api.ts --format cjs,esm --dts --clean --external @angular/core,@angular/common,@kopynator/core",
25
+ "build": "ng-packagr -p ng-package.json",
38
26
  "release:patch": "npm version patch",
39
27
  "release:minor": "npm version minor",
40
28
  "release:major": "npm version major"
@@ -0,0 +1,32 @@
1
+ import { Directive, ElementRef, Input, OnChanges, SimpleChanges, effect } from '@angular/core';
2
+ import { KopyService } from './kopy.service';
3
+
4
+ @Directive({
5
+ selector: '[kopy]',
6
+ standalone: true
7
+ })
8
+ export class KopyDirective implements OnChanges {
9
+ @Input('kopy') key!: string;
10
+ @Input() kopyParams: Record<string, any> = {};
11
+
12
+ constructor(
13
+ private el: ElementRef,
14
+ private kopyService: KopyService
15
+ ) {
16
+ // React to signal changes in KopyService
17
+ effect(() => {
18
+ this.kopyService.currentLocale();
19
+ this.kopyService.isReady();
20
+ this.render();
21
+ });
22
+ }
23
+
24
+ ngOnChanges(changes: SimpleChanges): void {
25
+ this.render();
26
+ }
27
+
28
+ private render() {
29
+ if (!this.key) return;
30
+ this.el.nativeElement.textContent = this.kopyService.translate(this.key, this.kopyParams);
31
+ }
32
+ }
@@ -0,0 +1,23 @@
1
+ import { Pipe, PipeTransform } from '@angular/core';
2
+ import { KopyService } from './kopy.service';
3
+
4
+ @Pipe({
5
+ name: 'kopy',
6
+ pure: false, // Must be false to react to signal changes inside transform
7
+ standalone: true
8
+ })
9
+ export class KopyPipe implements PipeTransform {
10
+ constructor(
11
+ private kopyService: KopyService
12
+ ) {}
13
+
14
+ transform(key: string, params: Record<string, any> = {}): string {
15
+ // Establishing reactive dependencies on signals
16
+ const ready = this.kopyService.isReady();
17
+ const locale = this.kopyService.currentLocale();
18
+
19
+ if (!ready) return key;
20
+
21
+ return this.kopyService.translate(key, params);
22
+ }
23
+ }
@@ -0,0 +1,164 @@
1
+ import { Component, inject, signal } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { KopyService } from './kopy.service';
4
+
5
+ @Component({
6
+ selector: 'kopy-selector',
7
+ standalone: true,
8
+ imports: [CommonModule],
9
+ template: `
10
+ <div class="kopy-selector-container" [class.open]="isOpen()">
11
+ <button class="kopy-selected-btn" (click)="toggleDropdown()">
12
+ <span class="flag">{{ getFlag(currentLocale()) }}</span>
13
+ <span class="label uppercase">{{ currentLocale() }}</span>
14
+ <svg class="chevron" [class.rotate]="isOpen()" viewBox="0 0 20 20" fill="currentColor">
15
+ <path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
16
+ </svg>
17
+ </button>
18
+
19
+ <div class="kopy-dropdown" *ngIf="isOpen()">
20
+ <button
21
+ *ngFor="let lang of languages()"
22
+ class="kopy-dropdown-item"
23
+ [class.active]="lang === currentLocale()"
24
+ (click)="selectLanguage(lang)"
25
+ >
26
+ <span class="flag">{{ getFlag(lang) }}</span>
27
+ <span class="label">{{ getNativeName(lang) }}</span>
28
+ </button>
29
+ </div>
30
+ </div>
31
+ `,
32
+ styles: [`
33
+ .kopy-selector-container {
34
+ position: relative;
35
+ display: inline-block;
36
+ font-family: inherit;
37
+ }
38
+ .kopy-selected-btn {
39
+ display: flex;
40
+ align-items: center;
41
+ gap: 6px;
42
+ padding: 4px 10px;
43
+ background: rgba(255, 255, 255, 0.05);
44
+ border: 1px solid rgba(255, 255, 255, 0.1);
45
+ border-radius: 99px;
46
+ color: white;
47
+ cursor: pointer;
48
+ transition: all 0.2s;
49
+ font-size: 11px;
50
+ font-weight: 700;
51
+ min-width: 70px;
52
+ justify-content: center;
53
+ }
54
+ .kopy-selected-btn:hover {
55
+ background: rgba(255, 255, 255, 0.1);
56
+ border-color: rgba(255, 255, 255, 0.2);
57
+ }
58
+ .chevron {
59
+ width: 10px;
60
+ height: 10px;
61
+ opacity: 0.5;
62
+ transition: transform 0.2s;
63
+ }
64
+ .chevron.rotate {
65
+ transform: rotate(180deg);
66
+ }
67
+ .kopy-dropdown {
68
+ position: absolute;
69
+ top: 100%;
70
+ right: 0;
71
+ margin-top: 8px;
72
+ background: #1e293b;
73
+ border: 1px solid rgba(255, 255, 255, 0.1);
74
+ border-radius: 12px;
75
+ box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
76
+ overflow: hidden;
77
+ min-width: 140px;
78
+ z-index: 100;
79
+ animation: slideIn 0.2s ease-out;
80
+ }
81
+ .kopy-dropdown-item {
82
+ width: 100%;
83
+ display: flex;
84
+ align-items: center;
85
+ gap: 12px;
86
+ padding: 10px 16px;
87
+ background: transparent;
88
+ border: none;
89
+ color: #94a3b8;
90
+ cursor: pointer;
91
+ text-align: left;
92
+ transition: all 0.2s;
93
+ font-size: 14px;
94
+ }
95
+ .kopy-dropdown-item:hover {
96
+ background: rgba(255, 255, 255, 0.05);
97
+ color: white;
98
+ }
99
+ .kopy-dropdown-item.active {
100
+ color: #38bdf8;
101
+ background: rgba(56, 189, 248, 0.05);
102
+ }
103
+ .label {
104
+ flex: 1;
105
+ }
106
+ .flag {
107
+ font-size: 16px;
108
+ }
109
+ @keyframes slideIn {
110
+ from { opacity: 0; transform: translateY(-10px); }
111
+ to { opacity: 1; transform: translateY(0); }
112
+ }
113
+ `]
114
+ })
115
+ export class KopySelectorComponent {
116
+ private kopyService = inject(KopyService);
117
+
118
+ public isOpen = signal(false);
119
+ public languages = this.kopyService.availableLanguages;
120
+ public currentLocale = this.kopyService.currentLocale;
121
+
122
+ private flagMap: Record<string, string> = {
123
+ 'en': '🇺🇸',
124
+ 'es': '🇪🇸',
125
+ 'fr': '🇫🇷',
126
+ 'de': '🇩🇪',
127
+ 'it': '🇮🇹',
128
+ 'pt': '🇵🇹',
129
+ 'ja': '🇯🇵',
130
+ 'zh': '🇨🇳',
131
+ 'ru': '🇷🇺'
132
+ };
133
+
134
+ private nameMap: Record<string, string> = {
135
+ 'en': 'English',
136
+ 'es': 'Español',
137
+ 'fr': 'Français',
138
+ 'de': 'Deutsch',
139
+ 'it': 'Italiano',
140
+ 'pt': 'Português',
141
+ 'ja': '日本語',
142
+ 'zh': '中文',
143
+ 'ru': 'Русский',
144
+ 'en-us': 'English (US)'
145
+ };
146
+
147
+ toggleDropdown() {
148
+ this.isOpen.set(!this.isOpen());
149
+ }
150
+
151
+ selectLanguage(lang: string) {
152
+ this.kopyService.setLocale(lang);
153
+ this.isOpen.set(false);
154
+ }
155
+
156
+ getFlag(lang: string): string {
157
+ const code = lang.split('-')[0].toLowerCase();
158
+ return this.flagMap[code] || '🌐';
159
+ }
160
+
161
+ getNativeName(lang: string): string {
162
+ return this.nameMap[lang.toLowerCase()] || lang.toUpperCase();
163
+ }
164
+ }
@@ -0,0 +1,57 @@
1
+ import { Injectable, Inject, InjectionToken, signal, NgZone } from '@angular/core';
2
+ import { Kopynator, KopyConfig } from '@kopynator/core';
3
+
4
+ export const KOPY_CONFIG = new InjectionToken<KopyConfig>('KOPY_CONFIG');
5
+
6
+ @Injectable({
7
+ providedIn: 'root'
8
+ })
9
+ export class KopyService {
10
+ private kopy: Kopynator;
11
+
12
+ // Signals for reactivity
13
+ public isReady = signal(false);
14
+ public availableLanguages = signal<string[]>([]);
15
+ public currentLocale = signal<string>('en');
16
+
17
+ constructor(
18
+ @Inject(KOPY_CONFIG) private config: KopyConfig,
19
+ private zone: NgZone
20
+ ) {
21
+ const savedLocale = typeof localStorage !== 'undefined' ? localStorage.getItem('kopy_locale') : null;
22
+ const initialLocale = savedLocale || config.defaultLocale || 'en';
23
+
24
+ // Initialize core with the restored or default locale
25
+ this.kopy = new Kopynator({ ...config, defaultLocale: initialLocale });
26
+ this.currentLocale.set(initialLocale);
27
+ }
28
+
29
+ public async init(): Promise<void> {
30
+ await this.kopy.init();
31
+
32
+ this.zone.run(() => {
33
+ this.availableLanguages.set(this.kopy.getLanguages());
34
+ this.isReady.set(true);
35
+ });
36
+ }
37
+
38
+ async setLocale(locale: string) {
39
+ await this.kopy.setLocale(locale);
40
+
41
+ if (typeof localStorage !== 'undefined') {
42
+ localStorage.setItem('kopy_locale', locale);
43
+ }
44
+
45
+ this.zone.run(() => {
46
+ this.currentLocale.set(locale);
47
+ });
48
+ }
49
+
50
+ translate(key: string, params: Record<string, any> = {}): string {
51
+ return this.kopy.translate(key, params);
52
+ }
53
+
54
+ getKopynator(): Kopynator {
55
+ return this.kopy;
56
+ }
57
+ }
@@ -0,0 +1,25 @@
1
+ import { Provider, provideAppInitializer, inject, EnvironmentProviders } from '@angular/core';
2
+ import { KopyConfig } from '@kopynator/core';
3
+ import { KOPY_CONFIG, KopyService } from './lib/kopy.service';
4
+
5
+ export * from './lib/kopy.service';
6
+ export * from './lib/kopy.pipe';
7
+ export * from './lib/kopy.directive';
8
+ export * from './lib/kopy.selector.component';
9
+
10
+ /**
11
+ * Provides the Kopynator SDK configuration to the application.
12
+ */
13
+ export function provideKopynator(config: KopyConfig): (Provider | EnvironmentProviders)[] {
14
+ return [
15
+ {
16
+ provide: KOPY_CONFIG,
17
+ useValue: config
18
+ },
19
+ KopyService,
20
+ provideAppInitializer(() => {
21
+ const kopyService = inject(KopyService);
22
+ return kopyService.init();
23
+ })
24
+ ];
25
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ES2022",
5
+ "moduleResolution": "node",
6
+ "lib": ["ES2022", "DOM"],
7
+ "declaration": true,
8
+ "declarationMap": true,
9
+ "sourceMap": true,
10
+ "outDir": "dist",
11
+ "strict": true,
12
+ "esModuleInterop": true,
13
+ "skipLibCheck": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "experimentalDecorators": true,
16
+ "emitDecoratorMetadata": true,
17
+ "useDefineForClassFields": false
18
+ },
19
+ "include": ["src/**/*"],
20
+ "exclude": ["node_modules", "dist"]
21
+ }
@@ -1,54 +0,0 @@
1
- import * as _angular_core from '@angular/core';
2
- import { InjectionToken, NgZone, PipeTransform, OnChanges, ElementRef, SimpleChanges, Provider, EnvironmentProviders } from '@angular/core';
3
- import { KopyConfig, Kopynator } from '@kopynator/core';
4
-
5
- declare const KOPY_CONFIG: InjectionToken<KopyConfig>;
6
- declare class KopyService {
7
- private config;
8
- private zone;
9
- private kopy;
10
- isReady: _angular_core.WritableSignal<boolean>;
11
- availableLanguages: _angular_core.WritableSignal<string[]>;
12
- currentLocale: _angular_core.WritableSignal<string>;
13
- constructor(config: KopyConfig, zone: NgZone);
14
- init(): Promise<void>;
15
- setLocale(locale: string): Promise<void>;
16
- translate(key: string, params?: Record<string, any>): string;
17
- getKopynator(): Kopynator;
18
- }
19
-
20
- declare class KopyPipe implements PipeTransform {
21
- private kopyService;
22
- constructor(kopyService: KopyService);
23
- transform(key: string, params?: Record<string, any>): string;
24
- }
25
-
26
- declare class KopyDirective implements OnChanges {
27
- private el;
28
- private kopyService;
29
- key: string;
30
- kopyParams: Record<string, any>;
31
- constructor(el: ElementRef, kopyService: KopyService);
32
- ngOnChanges(changes: SimpleChanges): void;
33
- private render;
34
- }
35
-
36
- declare class KopySelectorComponent {
37
- private kopyService;
38
- isOpen: _angular_core.WritableSignal<boolean>;
39
- languages: _angular_core.WritableSignal<string[]>;
40
- currentLocale: _angular_core.WritableSignal<string>;
41
- private flagMap;
42
- private nameMap;
43
- toggleDropdown(): void;
44
- selectLanguage(lang: string): void;
45
- getFlag(lang: string): string;
46
- getNativeName(lang: string): string;
47
- }
48
-
49
- /**
50
- * Provides the Kopynator SDK configuration to the application.
51
- */
52
- declare function provideKopynator(config: KopyConfig): (Provider | EnvironmentProviders)[];
53
-
54
- export { KOPY_CONFIG, KopyDirective, KopyPipe, KopySelectorComponent, KopyService, provideKopynator };
@@ -1,54 +0,0 @@
1
- import * as _angular_core from '@angular/core';
2
- import { InjectionToken, NgZone, PipeTransform, OnChanges, ElementRef, SimpleChanges, Provider, EnvironmentProviders } from '@angular/core';
3
- import { KopyConfig, Kopynator } from '@kopynator/core';
4
-
5
- declare const KOPY_CONFIG: InjectionToken<KopyConfig>;
6
- declare class KopyService {
7
- private config;
8
- private zone;
9
- private kopy;
10
- isReady: _angular_core.WritableSignal<boolean>;
11
- availableLanguages: _angular_core.WritableSignal<string[]>;
12
- currentLocale: _angular_core.WritableSignal<string>;
13
- constructor(config: KopyConfig, zone: NgZone);
14
- init(): Promise<void>;
15
- setLocale(locale: string): Promise<void>;
16
- translate(key: string, params?: Record<string, any>): string;
17
- getKopynator(): Kopynator;
18
- }
19
-
20
- declare class KopyPipe implements PipeTransform {
21
- private kopyService;
22
- constructor(kopyService: KopyService);
23
- transform(key: string, params?: Record<string, any>): string;
24
- }
25
-
26
- declare class KopyDirective implements OnChanges {
27
- private el;
28
- private kopyService;
29
- key: string;
30
- kopyParams: Record<string, any>;
31
- constructor(el: ElementRef, kopyService: KopyService);
32
- ngOnChanges(changes: SimpleChanges): void;
33
- private render;
34
- }
35
-
36
- declare class KopySelectorComponent {
37
- private kopyService;
38
- isOpen: _angular_core.WritableSignal<boolean>;
39
- languages: _angular_core.WritableSignal<string[]>;
40
- currentLocale: _angular_core.WritableSignal<string>;
41
- private flagMap;
42
- private nameMap;
43
- toggleDropdown(): void;
44
- selectLanguage(lang: string): void;
45
- getFlag(lang: string): string;
46
- getNativeName(lang: string): string;
47
- }
48
-
49
- /**
50
- * Provides the Kopynator SDK configuration to the application.
51
- */
52
- declare function provideKopynator(config: KopyConfig): (Provider | EnvironmentProviders)[];
53
-
54
- export { KOPY_CONFIG, KopyDirective, KopyPipe, KopySelectorComponent, KopyService, provideKopynator };
@@ -1,406 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/public-api.ts
22
- var public_api_exports = {};
23
- __export(public_api_exports, {
24
- KOPY_CONFIG: () => KOPY_CONFIG,
25
- KopyDirective: () => KopyDirective,
26
- KopyPipe: () => KopyPipe,
27
- KopySelectorComponent: () => KopySelectorComponent,
28
- KopyService: () => KopyService,
29
- provideKopynator: () => provideKopynator
30
- });
31
- module.exports = __toCommonJS(public_api_exports);
32
- var import_core6 = require("@angular/core");
33
-
34
- // src/lib/kopy.service.ts
35
- var import_core = require("@angular/core");
36
- var import_core2 = require("@kopynator/core");
37
- function _ts_decorate(decorators, target, key, desc) {
38
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
39
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
40
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
41
- return c > 3 && r && Object.defineProperty(target, key, r), r;
42
- }
43
- __name(_ts_decorate, "_ts_decorate");
44
- function _ts_metadata(k, v) {
45
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
46
- }
47
- __name(_ts_metadata, "_ts_metadata");
48
- function _ts_param(paramIndex, decorator) {
49
- return function(target, key) {
50
- decorator(target, key, paramIndex);
51
- };
52
- }
53
- __name(_ts_param, "_ts_param");
54
- var KOPY_CONFIG = new import_core.InjectionToken("KOPY_CONFIG");
55
- var KopyService = class {
56
- static {
57
- __name(this, "KopyService");
58
- }
59
- config;
60
- zone;
61
- kopy;
62
- // Signals for reactivity
63
- isReady = (0, import_core.signal)(false);
64
- availableLanguages = (0, import_core.signal)([]);
65
- currentLocale = (0, import_core.signal)("en");
66
- constructor(config, zone) {
67
- this.config = config;
68
- this.zone = zone;
69
- const savedLocale = typeof localStorage !== "undefined" ? localStorage.getItem("kopy_locale") : null;
70
- const initialLocale = savedLocale || config.defaultLocale || "en";
71
- this.kopy = new import_core2.Kopynator({
72
- ...config,
73
- defaultLocale: initialLocale
74
- });
75
- this.currentLocale.set(initialLocale);
76
- }
77
- async init() {
78
- await this.kopy.init();
79
- this.zone.run(() => {
80
- this.availableLanguages.set(this.kopy.getLanguages());
81
- this.isReady.set(true);
82
- });
83
- }
84
- async setLocale(locale) {
85
- await this.kopy.setLocale(locale);
86
- if (typeof localStorage !== "undefined") {
87
- localStorage.setItem("kopy_locale", locale);
88
- }
89
- this.zone.run(() => {
90
- this.currentLocale.set(locale);
91
- });
92
- }
93
- translate(key, params = {}) {
94
- return this.kopy.translate(key, params);
95
- }
96
- getKopynator() {
97
- return this.kopy;
98
- }
99
- };
100
- KopyService = _ts_decorate([
101
- (0, import_core.Injectable)({
102
- providedIn: "root"
103
- }),
104
- _ts_param(0, (0, import_core.Inject)(KOPY_CONFIG)),
105
- _ts_metadata("design:type", Function),
106
- _ts_metadata("design:paramtypes", [
107
- typeof import_core2.KopyConfig === "undefined" ? Object : import_core2.KopyConfig,
108
- typeof import_core.NgZone === "undefined" ? Object : import_core.NgZone
109
- ])
110
- ], KopyService);
111
-
112
- // src/lib/kopy.pipe.ts
113
- var import_core3 = require("@angular/core");
114
- function _ts_decorate2(decorators, target, key, desc) {
115
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
116
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
117
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
118
- return c > 3 && r && Object.defineProperty(target, key, r), r;
119
- }
120
- __name(_ts_decorate2, "_ts_decorate");
121
- function _ts_metadata2(k, v) {
122
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
123
- }
124
- __name(_ts_metadata2, "_ts_metadata");
125
- var KopyPipe = class {
126
- static {
127
- __name(this, "KopyPipe");
128
- }
129
- kopyService;
130
- constructor(kopyService) {
131
- this.kopyService = kopyService;
132
- }
133
- transform(key, params = {}) {
134
- const ready = this.kopyService.isReady();
135
- const locale = this.kopyService.currentLocale();
136
- if (!ready) return key;
137
- return this.kopyService.translate(key, params);
138
- }
139
- };
140
- KopyPipe = _ts_decorate2([
141
- (0, import_core3.Pipe)({
142
- name: "kopy",
143
- pure: false,
144
- standalone: true
145
- }),
146
- _ts_metadata2("design:type", Function),
147
- _ts_metadata2("design:paramtypes", [
148
- typeof KopyService === "undefined" ? Object : KopyService
149
- ])
150
- ], KopyPipe);
151
-
152
- // src/lib/kopy.directive.ts
153
- var import_core4 = require("@angular/core");
154
- function _ts_decorate3(decorators, target, key, desc) {
155
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
156
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
157
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
158
- return c > 3 && r && Object.defineProperty(target, key, r), r;
159
- }
160
- __name(_ts_decorate3, "_ts_decorate");
161
- function _ts_metadata3(k, v) {
162
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
163
- }
164
- __name(_ts_metadata3, "_ts_metadata");
165
- var KopyDirective = class {
166
- static {
167
- __name(this, "KopyDirective");
168
- }
169
- el;
170
- kopyService;
171
- key;
172
- kopyParams = {};
173
- constructor(el, kopyService) {
174
- this.el = el;
175
- this.kopyService = kopyService;
176
- (0, import_core4.effect)(() => {
177
- this.kopyService.currentLocale();
178
- this.kopyService.isReady();
179
- this.render();
180
- });
181
- }
182
- ngOnChanges(changes) {
183
- this.render();
184
- }
185
- render() {
186
- if (!this.key) return;
187
- this.el.nativeElement.textContent = this.kopyService.translate(this.key, this.kopyParams);
188
- }
189
- };
190
- _ts_decorate3([
191
- (0, import_core4.Input)("kopy"),
192
- _ts_metadata3("design:type", String)
193
- ], KopyDirective.prototype, "key", void 0);
194
- _ts_decorate3([
195
- (0, import_core4.Input)(),
196
- _ts_metadata3("design:type", typeof Record === "undefined" ? Object : Record)
197
- ], KopyDirective.prototype, "kopyParams", void 0);
198
- KopyDirective = _ts_decorate3([
199
- (0, import_core4.Directive)({
200
- selector: "[kopy]",
201
- standalone: true
202
- }),
203
- _ts_metadata3("design:type", Function),
204
- _ts_metadata3("design:paramtypes", [
205
- typeof import_core4.ElementRef === "undefined" ? Object : import_core4.ElementRef,
206
- typeof KopyService === "undefined" ? Object : KopyService
207
- ])
208
- ], KopyDirective);
209
-
210
- // src/lib/kopy.selector.component.ts
211
- var import_core5 = require("@angular/core");
212
- var import_common = require("@angular/common");
213
- function _ts_decorate4(decorators, target, key, desc) {
214
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
215
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
216
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
217
- return c > 3 && r && Object.defineProperty(target, key, r), r;
218
- }
219
- __name(_ts_decorate4, "_ts_decorate");
220
- var KopySelectorComponent = class {
221
- static {
222
- __name(this, "KopySelectorComponent");
223
- }
224
- kopyService = (0, import_core5.inject)(KopyService);
225
- isOpen = (0, import_core5.signal)(false);
226
- languages = this.kopyService.availableLanguages;
227
- currentLocale = this.kopyService.currentLocale;
228
- flagMap = {
229
- "en": "\u{1F1FA}\u{1F1F8}",
230
- "es": "\u{1F1EA}\u{1F1F8}",
231
- "fr": "\u{1F1EB}\u{1F1F7}",
232
- "de": "\u{1F1E9}\u{1F1EA}",
233
- "it": "\u{1F1EE}\u{1F1F9}",
234
- "pt": "\u{1F1F5}\u{1F1F9}",
235
- "ja": "\u{1F1EF}\u{1F1F5}",
236
- "zh": "\u{1F1E8}\u{1F1F3}",
237
- "ru": "\u{1F1F7}\u{1F1FA}"
238
- };
239
- nameMap = {
240
- "en": "English",
241
- "es": "Espa\xF1ol",
242
- "fr": "Fran\xE7ais",
243
- "de": "Deutsch",
244
- "it": "Italiano",
245
- "pt": "Portugu\xEAs",
246
- "ja": "\u65E5\u672C\u8A9E",
247
- "zh": "\u4E2D\u6587",
248
- "ru": "\u0420\u0443\u0441\u0441\u043A\u0438\u0439",
249
- "en-us": "English (US)"
250
- };
251
- toggleDropdown() {
252
- this.isOpen.set(!this.isOpen());
253
- }
254
- selectLanguage(lang) {
255
- this.kopyService.setLocale(lang);
256
- this.isOpen.set(false);
257
- }
258
- getFlag(lang) {
259
- const code = lang.split("-")[0].toLowerCase();
260
- return this.flagMap[code] || "\u{1F310}";
261
- }
262
- getNativeName(lang) {
263
- return this.nameMap[lang.toLowerCase()] || lang.toUpperCase();
264
- }
265
- };
266
- KopySelectorComponent = _ts_decorate4([
267
- (0, import_core5.Component)({
268
- selector: "kopy-selector",
269
- standalone: true,
270
- imports: [
271
- import_common.CommonModule
272
- ],
273
- template: `
274
- <div class="kopy-selector-container" [class.open]="isOpen()">
275
- <button class="kopy-selected-btn" (click)="toggleDropdown()">
276
- <span class="flag">{{ getFlag(currentLocale()) }}</span>
277
- <span class="label uppercase">{{ currentLocale() }}</span>
278
- <svg class="chevron" [class.rotate]="isOpen()" viewBox="0 0 20 20" fill="currentColor">
279
- <path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
280
- </svg>
281
- </button>
282
-
283
- <div class="kopy-dropdown" *ngIf="isOpen()">
284
- <button
285
- *ngFor="let lang of languages()"
286
- class="kopy-dropdown-item"
287
- [class.active]="lang === currentLocale()"
288
- (click)="selectLanguage(lang)"
289
- >
290
- <span class="flag">{{ getFlag(lang) }}</span>
291
- <span class="label">{{ getNativeName(lang) }}</span>
292
- </button>
293
- </div>
294
- </div>
295
- `,
296
- styles: [
297
- `
298
- .kopy-selector-container {
299
- position: relative;
300
- display: inline-block;
301
- font-family: inherit;
302
- }
303
- .kopy-selected-btn {
304
- display: flex;
305
- align-items: center;
306
- gap: 6px;
307
- padding: 4px 10px;
308
- background: rgba(255, 255, 255, 0.05);
309
- border: 1px solid rgba(255, 255, 255, 0.1);
310
- border-radius: 99px;
311
- color: white;
312
- cursor: pointer;
313
- transition: all 0.2s;
314
- font-size: 11px;
315
- font-weight: 700;
316
- min-width: 70px;
317
- justify-content: center;
318
- }
319
- .kopy-selected-btn:hover {
320
- background: rgba(255, 255, 255, 0.1);
321
- border-color: rgba(255, 255, 255, 0.2);
322
- }
323
- .chevron {
324
- width: 10px;
325
- height: 10px;
326
- opacity: 0.5;
327
- transition: transform 0.2s;
328
- }
329
- .chevron.rotate {
330
- transform: rotate(180deg);
331
- }
332
- .kopy-dropdown {
333
- position: absolute;
334
- top: 100%;
335
- right: 0;
336
- margin-top: 8px;
337
- background: #1e293b;
338
- border: 1px solid rgba(255, 255, 255, 0.1);
339
- border-radius: 12px;
340
- box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
341
- overflow: hidden;
342
- min-width: 140px;
343
- z-index: 100;
344
- animation: slideIn 0.2s ease-out;
345
- }
346
- .kopy-dropdown-item {
347
- width: 100%;
348
- display: flex;
349
- align-items: center;
350
- gap: 12px;
351
- padding: 10px 16px;
352
- background: transparent;
353
- border: none;
354
- color: #94a3b8;
355
- cursor: pointer;
356
- text-align: left;
357
- transition: all 0.2s;
358
- font-size: 14px;
359
- }
360
- .kopy-dropdown-item:hover {
361
- background: rgba(255, 255, 255, 0.05);
362
- color: white;
363
- }
364
- .kopy-dropdown-item.active {
365
- color: #38bdf8;
366
- background: rgba(56, 189, 248, 0.05);
367
- }
368
- .label {
369
- flex: 1;
370
- }
371
- .flag {
372
- font-size: 16px;
373
- }
374
- @keyframes slideIn {
375
- from { opacity: 0; transform: translateY(-10px); }
376
- to { opacity: 1; transform: translateY(0); }
377
- }
378
- `
379
- ]
380
- })
381
- ], KopySelectorComponent);
382
-
383
- // src/public-api.ts
384
- function provideKopynator(config) {
385
- return [
386
- {
387
- provide: KOPY_CONFIG,
388
- useValue: config
389
- },
390
- KopyService,
391
- (0, import_core6.provideAppInitializer)(() => {
392
- const kopyService = (0, import_core6.inject)(KopyService);
393
- return kopyService.init();
394
- })
395
- ];
396
- }
397
- __name(provideKopynator, "provideKopynator");
398
- // Annotate the CommonJS export names for ESM import in node:
399
- 0 && (module.exports = {
400
- KOPY_CONFIG,
401
- KopyDirective,
402
- KopyPipe,
403
- KopySelectorComponent,
404
- KopyService,
405
- provideKopynator
406
- });
@@ -1,378 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
- // src/public-api.ts
5
- import { provideAppInitializer, inject as inject2 } from "@angular/core";
6
-
7
- // src/lib/kopy.service.ts
8
- import { Injectable, Inject, InjectionToken, signal, NgZone } from "@angular/core";
9
- import { Kopynator, KopyConfig } from "@kopynator/core";
10
- function _ts_decorate(decorators, target, key, desc) {
11
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
14
- return c > 3 && r && Object.defineProperty(target, key, r), r;
15
- }
16
- __name(_ts_decorate, "_ts_decorate");
17
- function _ts_metadata(k, v) {
18
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
19
- }
20
- __name(_ts_metadata, "_ts_metadata");
21
- function _ts_param(paramIndex, decorator) {
22
- return function(target, key) {
23
- decorator(target, key, paramIndex);
24
- };
25
- }
26
- __name(_ts_param, "_ts_param");
27
- var KOPY_CONFIG = new InjectionToken("KOPY_CONFIG");
28
- var KopyService = class {
29
- static {
30
- __name(this, "KopyService");
31
- }
32
- config;
33
- zone;
34
- kopy;
35
- // Signals for reactivity
36
- isReady = signal(false);
37
- availableLanguages = signal([]);
38
- currentLocale = signal("en");
39
- constructor(config, zone) {
40
- this.config = config;
41
- this.zone = zone;
42
- const savedLocale = typeof localStorage !== "undefined" ? localStorage.getItem("kopy_locale") : null;
43
- const initialLocale = savedLocale || config.defaultLocale || "en";
44
- this.kopy = new Kopynator({
45
- ...config,
46
- defaultLocale: initialLocale
47
- });
48
- this.currentLocale.set(initialLocale);
49
- }
50
- async init() {
51
- await this.kopy.init();
52
- this.zone.run(() => {
53
- this.availableLanguages.set(this.kopy.getLanguages());
54
- this.isReady.set(true);
55
- });
56
- }
57
- async setLocale(locale) {
58
- await this.kopy.setLocale(locale);
59
- if (typeof localStorage !== "undefined") {
60
- localStorage.setItem("kopy_locale", locale);
61
- }
62
- this.zone.run(() => {
63
- this.currentLocale.set(locale);
64
- });
65
- }
66
- translate(key, params = {}) {
67
- return this.kopy.translate(key, params);
68
- }
69
- getKopynator() {
70
- return this.kopy;
71
- }
72
- };
73
- KopyService = _ts_decorate([
74
- Injectable({
75
- providedIn: "root"
76
- }),
77
- _ts_param(0, Inject(KOPY_CONFIG)),
78
- _ts_metadata("design:type", Function),
79
- _ts_metadata("design:paramtypes", [
80
- typeof KopyConfig === "undefined" ? Object : KopyConfig,
81
- typeof NgZone === "undefined" ? Object : NgZone
82
- ])
83
- ], KopyService);
84
-
85
- // src/lib/kopy.pipe.ts
86
- import { Pipe } from "@angular/core";
87
- function _ts_decorate2(decorators, target, key, desc) {
88
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
89
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
90
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
91
- return c > 3 && r && Object.defineProperty(target, key, r), r;
92
- }
93
- __name(_ts_decorate2, "_ts_decorate");
94
- function _ts_metadata2(k, v) {
95
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
96
- }
97
- __name(_ts_metadata2, "_ts_metadata");
98
- var KopyPipe = class {
99
- static {
100
- __name(this, "KopyPipe");
101
- }
102
- kopyService;
103
- constructor(kopyService) {
104
- this.kopyService = kopyService;
105
- }
106
- transform(key, params = {}) {
107
- const ready = this.kopyService.isReady();
108
- const locale = this.kopyService.currentLocale();
109
- if (!ready) return key;
110
- return this.kopyService.translate(key, params);
111
- }
112
- };
113
- KopyPipe = _ts_decorate2([
114
- Pipe({
115
- name: "kopy",
116
- pure: false,
117
- standalone: true
118
- }),
119
- _ts_metadata2("design:type", Function),
120
- _ts_metadata2("design:paramtypes", [
121
- typeof KopyService === "undefined" ? Object : KopyService
122
- ])
123
- ], KopyPipe);
124
-
125
- // src/lib/kopy.directive.ts
126
- import { Directive, ElementRef, Input, effect } from "@angular/core";
127
- function _ts_decorate3(decorators, target, key, desc) {
128
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
129
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
130
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
131
- return c > 3 && r && Object.defineProperty(target, key, r), r;
132
- }
133
- __name(_ts_decorate3, "_ts_decorate");
134
- function _ts_metadata3(k, v) {
135
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
136
- }
137
- __name(_ts_metadata3, "_ts_metadata");
138
- var KopyDirective = class {
139
- static {
140
- __name(this, "KopyDirective");
141
- }
142
- el;
143
- kopyService;
144
- key;
145
- kopyParams = {};
146
- constructor(el, kopyService) {
147
- this.el = el;
148
- this.kopyService = kopyService;
149
- effect(() => {
150
- this.kopyService.currentLocale();
151
- this.kopyService.isReady();
152
- this.render();
153
- });
154
- }
155
- ngOnChanges(changes) {
156
- this.render();
157
- }
158
- render() {
159
- if (!this.key) return;
160
- this.el.nativeElement.textContent = this.kopyService.translate(this.key, this.kopyParams);
161
- }
162
- };
163
- _ts_decorate3([
164
- Input("kopy"),
165
- _ts_metadata3("design:type", String)
166
- ], KopyDirective.prototype, "key", void 0);
167
- _ts_decorate3([
168
- Input(),
169
- _ts_metadata3("design:type", typeof Record === "undefined" ? Object : Record)
170
- ], KopyDirective.prototype, "kopyParams", void 0);
171
- KopyDirective = _ts_decorate3([
172
- Directive({
173
- selector: "[kopy]",
174
- standalone: true
175
- }),
176
- _ts_metadata3("design:type", Function),
177
- _ts_metadata3("design:paramtypes", [
178
- typeof ElementRef === "undefined" ? Object : ElementRef,
179
- typeof KopyService === "undefined" ? Object : KopyService
180
- ])
181
- ], KopyDirective);
182
-
183
- // src/lib/kopy.selector.component.ts
184
- import { Component, inject, signal as signal2 } from "@angular/core";
185
- import { CommonModule } from "@angular/common";
186
- function _ts_decorate4(decorators, target, key, desc) {
187
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
188
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
189
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
190
- return c > 3 && r && Object.defineProperty(target, key, r), r;
191
- }
192
- __name(_ts_decorate4, "_ts_decorate");
193
- var KopySelectorComponent = class {
194
- static {
195
- __name(this, "KopySelectorComponent");
196
- }
197
- kopyService = inject(KopyService);
198
- isOpen = signal2(false);
199
- languages = this.kopyService.availableLanguages;
200
- currentLocale = this.kopyService.currentLocale;
201
- flagMap = {
202
- "en": "\u{1F1FA}\u{1F1F8}",
203
- "es": "\u{1F1EA}\u{1F1F8}",
204
- "fr": "\u{1F1EB}\u{1F1F7}",
205
- "de": "\u{1F1E9}\u{1F1EA}",
206
- "it": "\u{1F1EE}\u{1F1F9}",
207
- "pt": "\u{1F1F5}\u{1F1F9}",
208
- "ja": "\u{1F1EF}\u{1F1F5}",
209
- "zh": "\u{1F1E8}\u{1F1F3}",
210
- "ru": "\u{1F1F7}\u{1F1FA}"
211
- };
212
- nameMap = {
213
- "en": "English",
214
- "es": "Espa\xF1ol",
215
- "fr": "Fran\xE7ais",
216
- "de": "Deutsch",
217
- "it": "Italiano",
218
- "pt": "Portugu\xEAs",
219
- "ja": "\u65E5\u672C\u8A9E",
220
- "zh": "\u4E2D\u6587",
221
- "ru": "\u0420\u0443\u0441\u0441\u043A\u0438\u0439",
222
- "en-us": "English (US)"
223
- };
224
- toggleDropdown() {
225
- this.isOpen.set(!this.isOpen());
226
- }
227
- selectLanguage(lang) {
228
- this.kopyService.setLocale(lang);
229
- this.isOpen.set(false);
230
- }
231
- getFlag(lang) {
232
- const code = lang.split("-")[0].toLowerCase();
233
- return this.flagMap[code] || "\u{1F310}";
234
- }
235
- getNativeName(lang) {
236
- return this.nameMap[lang.toLowerCase()] || lang.toUpperCase();
237
- }
238
- };
239
- KopySelectorComponent = _ts_decorate4([
240
- Component({
241
- selector: "kopy-selector",
242
- standalone: true,
243
- imports: [
244
- CommonModule
245
- ],
246
- template: `
247
- <div class="kopy-selector-container" [class.open]="isOpen()">
248
- <button class="kopy-selected-btn" (click)="toggleDropdown()">
249
- <span class="flag">{{ getFlag(currentLocale()) }}</span>
250
- <span class="label uppercase">{{ currentLocale() }}</span>
251
- <svg class="chevron" [class.rotate]="isOpen()" viewBox="0 0 20 20" fill="currentColor">
252
- <path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
253
- </svg>
254
- </button>
255
-
256
- <div class="kopy-dropdown" *ngIf="isOpen()">
257
- <button
258
- *ngFor="let lang of languages()"
259
- class="kopy-dropdown-item"
260
- [class.active]="lang === currentLocale()"
261
- (click)="selectLanguage(lang)"
262
- >
263
- <span class="flag">{{ getFlag(lang) }}</span>
264
- <span class="label">{{ getNativeName(lang) }}</span>
265
- </button>
266
- </div>
267
- </div>
268
- `,
269
- styles: [
270
- `
271
- .kopy-selector-container {
272
- position: relative;
273
- display: inline-block;
274
- font-family: inherit;
275
- }
276
- .kopy-selected-btn {
277
- display: flex;
278
- align-items: center;
279
- gap: 6px;
280
- padding: 4px 10px;
281
- background: rgba(255, 255, 255, 0.05);
282
- border: 1px solid rgba(255, 255, 255, 0.1);
283
- border-radius: 99px;
284
- color: white;
285
- cursor: pointer;
286
- transition: all 0.2s;
287
- font-size: 11px;
288
- font-weight: 700;
289
- min-width: 70px;
290
- justify-content: center;
291
- }
292
- .kopy-selected-btn:hover {
293
- background: rgba(255, 255, 255, 0.1);
294
- border-color: rgba(255, 255, 255, 0.2);
295
- }
296
- .chevron {
297
- width: 10px;
298
- height: 10px;
299
- opacity: 0.5;
300
- transition: transform 0.2s;
301
- }
302
- .chevron.rotate {
303
- transform: rotate(180deg);
304
- }
305
- .kopy-dropdown {
306
- position: absolute;
307
- top: 100%;
308
- right: 0;
309
- margin-top: 8px;
310
- background: #1e293b;
311
- border: 1px solid rgba(255, 255, 255, 0.1);
312
- border-radius: 12px;
313
- box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
314
- overflow: hidden;
315
- min-width: 140px;
316
- z-index: 100;
317
- animation: slideIn 0.2s ease-out;
318
- }
319
- .kopy-dropdown-item {
320
- width: 100%;
321
- display: flex;
322
- align-items: center;
323
- gap: 12px;
324
- padding: 10px 16px;
325
- background: transparent;
326
- border: none;
327
- color: #94a3b8;
328
- cursor: pointer;
329
- text-align: left;
330
- transition: all 0.2s;
331
- font-size: 14px;
332
- }
333
- .kopy-dropdown-item:hover {
334
- background: rgba(255, 255, 255, 0.05);
335
- color: white;
336
- }
337
- .kopy-dropdown-item.active {
338
- color: #38bdf8;
339
- background: rgba(56, 189, 248, 0.05);
340
- }
341
- .label {
342
- flex: 1;
343
- }
344
- .flag {
345
- font-size: 16px;
346
- }
347
- @keyframes slideIn {
348
- from { opacity: 0; transform: translateY(-10px); }
349
- to { opacity: 1; transform: translateY(0); }
350
- }
351
- `
352
- ]
353
- })
354
- ], KopySelectorComponent);
355
-
356
- // src/public-api.ts
357
- function provideKopynator(config) {
358
- return [
359
- {
360
- provide: KOPY_CONFIG,
361
- useValue: config
362
- },
363
- KopyService,
364
- provideAppInitializer(() => {
365
- const kopyService = inject2(KopyService);
366
- return kopyService.init();
367
- })
368
- ];
369
- }
370
- __name(provideKopynator, "provideKopynator");
371
- export {
372
- KOPY_CONFIG,
373
- KopyDirective,
374
- KopyPipe,
375
- KopySelectorComponent,
376
- KopyService,
377
- provideKopynator
378
- };