@wirekyt/angular 0.0.7 → 0.0.9

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,57 @@
1
+ import { NgTemplateOutlet } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { input, signal, afterNextRender, ChangeDetectionStrategy, Component } from '@angular/core';
4
+
5
+ class ClientOnly {
6
+ fallback = input(null, /* @ts-ignore */
7
+ ...(ngDevMode ? [{ debugName: "fallback" }] : /* istanbul ignore next */ []));
8
+ clientTemplate = input(null, /* @ts-ignore */
9
+ ...(ngDevMode ? [{ debugName: "clientTemplate" }] : /* istanbul ignore next */ []));
10
+ isClient = signal(false, /* @ts-ignore */
11
+ ...(ngDevMode ? [{ debugName: "isClient" }] : /* istanbul ignore next */ []));
12
+ constructor() {
13
+ afterNextRender(() => {
14
+ this.isClient.set(true);
15
+ });
16
+ }
17
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: ClientOnly, deps: [], target: i0.ɵɵFactoryTarget.Component });
18
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: ClientOnly, isStandalone: true, selector: "client-only", inputs: { fallback: { classPropertyName: "fallback", publicName: "fallback", isSignal: true, isRequired: false, transformFunction: null }, clientTemplate: { classPropertyName: "clientTemplate", publicName: "clientTemplate", isSignal: true, isRequired: false, transformFunction: null } }, host: { styleAttribute: "display: contents" }, ngImport: i0, template: `
19
+ @if (isClient()) {
20
+ @if (clientTemplate(); as tpl) {
21
+ <ng-container [ngTemplateOutlet]="tpl"></ng-container>
22
+ } @else {
23
+ <ng-content />
24
+ }
25
+ } @else if (fallback(); as fb) {
26
+ <ng-container [ngTemplateOutlet]="fb"></ng-container>
27
+ }
28
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
29
+ }
30
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: ClientOnly, decorators: [{
31
+ type: Component,
32
+ args: [{
33
+ selector: "client-only",
34
+ standalone: true,
35
+ imports: [NgTemplateOutlet],
36
+ changeDetection: ChangeDetectionStrategy.OnPush,
37
+ host: { style: "display: contents" },
38
+ template: `
39
+ @if (isClient()) {
40
+ @if (clientTemplate(); as tpl) {
41
+ <ng-container [ngTemplateOutlet]="tpl"></ng-container>
42
+ } @else {
43
+ <ng-content />
44
+ }
45
+ } @else if (fallback(); as fb) {
46
+ <ng-container [ngTemplateOutlet]="fb"></ng-container>
47
+ }
48
+ `,
49
+ }]
50
+ }], ctorParameters: () => [], propDecorators: { fallback: [{ type: i0.Input, args: [{ isSignal: true, alias: "fallback", required: false }] }], clientTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "clientTemplate", required: false }] }] } });
51
+
52
+ /**
53
+ * Generated bundle index. Do not edit.
54
+ */
55
+
56
+ export { ClientOnly };
57
+ //# sourceMappingURL=wirekyt-angular-client-only.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wirekyt-angular-client-only.mjs","sources":["../../src/components/client-only/client-only.ts","../../src/components/client-only/wirekyt-angular-client-only.ts"],"sourcesContent":["import { NgTemplateOutlet } from \"@angular/common\";\nimport {\n ChangeDetectionStrategy,\n Component,\n type TemplateRef,\n afterNextRender,\n input,\n signal,\n} from \"@angular/core\";\n\n@Component({\n selector: \"client-only\",\n standalone: true,\n imports: [NgTemplateOutlet],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { style: \"display: contents\" },\n template: `\n @if (isClient()) {\n @if (clientTemplate(); as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\"></ng-container>\n } @else {\n <ng-content />\n }\n } @else if (fallback(); as fb) {\n <ng-container [ngTemplateOutlet]=\"fb\"></ng-container>\n }\n `,\n})\nexport class ClientOnly {\n readonly fallback = input<TemplateRef<unknown> | null>(null);\n readonly clientTemplate = input<TemplateRef<unknown> | null>(null);\n protected readonly isClient = signal(false);\n\n constructor() {\n afterNextRender(() => {\n this.isClient.set(true);\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MA4Ba,UAAU,CAAA;IACZ,QAAQ,GAAG,KAAK,CAA8B,IAAI;iFAAC;IACnD,cAAc,GAAG,KAAK,CAA8B,IAAI;uFAAC;IAC/C,QAAQ,GAAG,MAAM,CAAC,KAAK;iFAAC;AAE3C,IAAA,WAAA,GAAA;QACE,eAAe,CAAC,MAAK;AACnB,YAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC;AACzB,QAAA,CAAC,CAAC;IACJ;uGATW,UAAU,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAV,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAU,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,aAAA,EAAA,MAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,UAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,cAAA,EAAA,EAAA,iBAAA,EAAA,gBAAA,EAAA,UAAA,EAAA,gBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,cAAA,EAAA,mBAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAZX;;;;;;;;;;AAUT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAbS,gBAAgB,EAAA,QAAA,EAAA,oBAAA,EAAA,MAAA,EAAA,CAAA,yBAAA,EAAA,kBAAA,EAAA,0BAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAef,UAAU,EAAA,UAAA,EAAA,CAAA;kBAlBtB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,UAAU,EAAE,IAAI;oBAChB,OAAO,EAAE,CAAC,gBAAgB,CAAC;oBAC3B,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAC/C,oBAAA,IAAI,EAAE,EAAE,KAAK,EAAE,mBAAmB,EAAE;AACpC,oBAAA,QAAQ,EAAE;;;;;;;;;;AAUT,EAAA,CAAA;AACF,iBAAA;;;AC3BD;;AAEG;;;;"}
@@ -0,0 +1,301 @@
1
+ import * as clipboard from '@wirekyt/dom/machines/clipboard';
2
+ export { anatomy as clipboardAnatomy } from '@wirekyt/dom/machines/clipboard';
3
+ import * as i0 from '@angular/core';
4
+ import { InjectionToken, inject, input, model, output, computed, DestroyRef, Renderer2, ElementRef, forwardRef, Directive, TemplateRef, ViewContainerRef, effect } from '@angular/core';
5
+ import { injectEnvironment, createId, useMachine, bindProps } from '@wirekyt/angular';
6
+
7
+ const CLIPBOARD_CONTEXT = new InjectionToken("WIREKYT.CLIPBOARD_CONTEXT");
8
+ function injectClipboardContext() {
9
+ return inject(CLIPBOARD_CONTEXT);
10
+ }
11
+
12
+ function useClipboard(options = { context: () => ({}) }) {
13
+ const environment = injectEnvironment();
14
+ const fallbackId = createId();
15
+ return useMachine({
16
+ machine: clipboard.machine,
17
+ context: () => {
18
+ const props = options.context();
19
+ return {
20
+ ...props,
21
+ getRootNode: environment.getRootNode,
22
+ id: props.id ?? fallbackId,
23
+ };
24
+ },
25
+ connect: (service, normalize) => clipboard.connect(service, normalize),
26
+ });
27
+ }
28
+
29
+ class ClipboardRoot {
30
+ id = input(undefined, /* @ts-ignore */
31
+ ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
32
+ ids = input(undefined, /* @ts-ignore */
33
+ ...(ngDevMode ? [{ debugName: "ids" }] : /* istanbul ignore next */ []));
34
+ translations = input(undefined, /* @ts-ignore */
35
+ ...(ngDevMode ? [{ debugName: "translations" }] : /* istanbul ignore next */ []));
36
+ value = model(undefined, /* @ts-ignore */
37
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
38
+ defaultValue = input(undefined, /* @ts-ignore */
39
+ ...(ngDevMode ? [{ debugName: "defaultValue" }] : /* istanbul ignore next */ []));
40
+ timeout = input(undefined, /* @ts-ignore */
41
+ ...(ngDevMode ? [{ debugName: "timeout" }] : /* istanbul ignore next */ []));
42
+ statusChange = output();
43
+ stableIds = computed(() => this.stabilizeIds(this.ids()), /* @ts-ignore */
44
+ ...(ngDevMode ? [{ debugName: "stableIds" }] : /* istanbul ignore next */ []));
45
+ prevIds = undefined;
46
+ machine = useClipboard({
47
+ context: () => ({
48
+ id: this.id(),
49
+ ids: this.stableIds(),
50
+ translations: this.translations(),
51
+ value: this.value(),
52
+ defaultValue: this.defaultValue(),
53
+ timeout: this.timeout(),
54
+ onValueChange: (details) => this.value.set(details.value),
55
+ onStatusChange: (details) => this.statusChange.emit(details),
56
+ }),
57
+ });
58
+ state = this.machine.state;
59
+ api = this.machine.api;
60
+ service = this.machine.service;
61
+ send = this.machine.send;
62
+ stabilizeIds(next) {
63
+ if (next === this.prevIds)
64
+ return this.prevIds;
65
+ if (next === undefined || this.prevIds === undefined) {
66
+ this.prevIds = next;
67
+ return this.prevIds;
68
+ }
69
+ const keys = new Set([...Object.keys(next), ...Object.keys(this.prevIds)]);
70
+ const hasEqualEntries = [...keys].every((key) => Object.is(next[key], this.prevIds?.[key]));
71
+ if (hasEqualEntries) {
72
+ return this.prevIds;
73
+ }
74
+ this.prevIds = next;
75
+ return this.prevIds;
76
+ }
77
+ constructor() {
78
+ bindProps({
79
+ elementRef: inject(ElementRef),
80
+ renderer: inject(Renderer2),
81
+ destroyRef: inject(DestroyRef),
82
+ props: () => this.api().getRootProps(),
83
+ });
84
+ }
85
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: ClipboardRoot, deps: [], target: i0.ɵɵFactoryTarget.Directive });
86
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.0", type: ClipboardRoot, isStandalone: true, selector: "[clipboardRoot]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, ids: { classPropertyName: "ids", publicName: "ids", isSignal: true, isRequired: false, transformFunction: null }, translations: { classPropertyName: "translations", publicName: "translations", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, defaultValue: { classPropertyName: "defaultValue", publicName: "defaultValue", isSignal: true, isRequired: false, transformFunction: null }, timeout: { classPropertyName: "timeout", publicName: "timeout", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", statusChange: "statusChange" }, providers: [{ provide: CLIPBOARD_CONTEXT, useExisting: forwardRef(() => ClipboardRoot) }], exportAs: ["clipboardRoot"], ngImport: i0 });
87
+ }
88
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: ClipboardRoot, decorators: [{
89
+ type: Directive,
90
+ args: [{
91
+ selector: "[clipboardRoot]",
92
+ standalone: true,
93
+ exportAs: "clipboardRoot",
94
+ providers: [{ provide: CLIPBOARD_CONTEXT, useExisting: forwardRef(() => ClipboardRoot) }],
95
+ }]
96
+ }], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], ids: [{ type: i0.Input, args: [{ isSignal: true, alias: "ids", required: false }] }], translations: [{ type: i0.Input, args: [{ isSignal: true, alias: "translations", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], defaultValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultValue", required: false }] }], timeout: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeout", required: false }] }], statusChange: [{ type: i0.Output, args: ["statusChange"] }] } });
97
+
98
+ class ClipboardRootProvider {
99
+ value = input.required(/* @ts-ignore */
100
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
101
+ state = computed(() => this.value().state(), /* @ts-ignore */
102
+ ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
103
+ api = computed(() => this.value().api(), /* @ts-ignore */
104
+ ...(ngDevMode ? [{ debugName: "api" }] : /* istanbul ignore next */ []));
105
+ send = (event) => this.value().send(event);
106
+ get service() {
107
+ return this.value().service;
108
+ }
109
+ resolveValue() {
110
+ return this.value();
111
+ }
112
+ constructor() {
113
+ bindProps({
114
+ elementRef: inject(ElementRef),
115
+ renderer: inject(Renderer2),
116
+ destroyRef: inject(DestroyRef),
117
+ props: () => this.api().getRootProps(),
118
+ });
119
+ }
120
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: ClipboardRootProvider, deps: [], target: i0.ɵɵFactoryTarget.Directive });
121
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.0", type: ClipboardRootProvider, isStandalone: true, selector: "[clipboardRootProvider]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, providers: [{ provide: CLIPBOARD_CONTEXT, useExisting: forwardRef(() => ClipboardRootProvider) }], exportAs: ["clipboardRootProvider"], ngImport: i0 });
122
+ }
123
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: ClipboardRootProvider, decorators: [{
124
+ type: Directive,
125
+ args: [{
126
+ selector: "[clipboardRootProvider]",
127
+ standalone: true,
128
+ exportAs: "clipboardRootProvider",
129
+ providers: [{ provide: CLIPBOARD_CONTEXT, useExisting: forwardRef(() => ClipboardRootProvider) }],
130
+ }]
131
+ }], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }] } });
132
+
133
+ class ClipboardLabel {
134
+ constructor() {
135
+ const context = injectClipboardContext();
136
+ bindProps({
137
+ elementRef: inject(ElementRef),
138
+ renderer: inject(Renderer2),
139
+ destroyRef: inject(DestroyRef),
140
+ props: () => context.api().getLabelProps(),
141
+ });
142
+ }
143
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: ClipboardLabel, deps: [], target: i0.ɵɵFactoryTarget.Directive });
144
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.0", type: ClipboardLabel, isStandalone: true, selector: "[clipboardLabel]", exportAs: ["clipboardLabel"], ngImport: i0 });
145
+ }
146
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: ClipboardLabel, decorators: [{
147
+ type: Directive,
148
+ args: [{
149
+ selector: "[clipboardLabel]",
150
+ standalone: true,
151
+ exportAs: "clipboardLabel",
152
+ }]
153
+ }], ctorParameters: () => [] });
154
+
155
+ class ClipboardControl {
156
+ constructor() {
157
+ const context = injectClipboardContext();
158
+ bindProps({
159
+ elementRef: inject(ElementRef),
160
+ renderer: inject(Renderer2),
161
+ destroyRef: inject(DestroyRef),
162
+ props: () => context.api().getControlProps(),
163
+ });
164
+ }
165
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: ClipboardControl, deps: [], target: i0.ɵɵFactoryTarget.Directive });
166
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.0", type: ClipboardControl, isStandalone: true, selector: "[clipboardControl]", exportAs: ["clipboardControl"], ngImport: i0 });
167
+ }
168
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: ClipboardControl, decorators: [{
169
+ type: Directive,
170
+ args: [{
171
+ selector: "[clipboardControl]",
172
+ standalone: true,
173
+ exportAs: "clipboardControl",
174
+ }]
175
+ }], ctorParameters: () => [] });
176
+
177
+ class ClipboardContext {
178
+ static ngTemplateContextGuard(_directive, context) {
179
+ void context;
180
+ return true;
181
+ }
182
+ clipboard = injectClipboardContext();
183
+ templateRef = inject(TemplateRef);
184
+ viewContainer = inject(ViewContainerRef);
185
+ constructor() {
186
+ const view = this.viewContainer.createEmbeddedView(this.templateRef, {
187
+ $implicit: this.clipboard.api,
188
+ api: this.clipboard.api,
189
+ });
190
+ effect(() => {
191
+ this.clipboard.api();
192
+ view.detectChanges();
193
+ });
194
+ inject(DestroyRef).onDestroy(() => view.destroy());
195
+ }
196
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: ClipboardContext, deps: [], target: i0.ɵɵFactoryTarget.Directive });
197
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.0", type: ClipboardContext, isStandalone: true, selector: "[clipboardContext]", exportAs: ["clipboardContext"], ngImport: i0 });
198
+ }
199
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: ClipboardContext, decorators: [{
200
+ type: Directive,
201
+ args: [{
202
+ selector: "[clipboardContext]",
203
+ standalone: true,
204
+ exportAs: "clipboardContext",
205
+ }]
206
+ }], ctorParameters: () => [] });
207
+
208
+ class ClipboardInput {
209
+ constructor() {
210
+ const context = injectClipboardContext();
211
+ bindProps({
212
+ elementRef: inject(ElementRef),
213
+ renderer: inject(Renderer2),
214
+ destroyRef: inject(DestroyRef),
215
+ props: () => context.api().getInputProps(),
216
+ });
217
+ }
218
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: ClipboardInput, deps: [], target: i0.ɵɵFactoryTarget.Directive });
219
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.0", type: ClipboardInput, isStandalone: true, selector: "input[clipboardInput]", exportAs: ["clipboardInput"], ngImport: i0 });
220
+ }
221
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: ClipboardInput, decorators: [{
222
+ type: Directive,
223
+ args: [{
224
+ selector: "input[clipboardInput]",
225
+ standalone: true,
226
+ exportAs: "clipboardInput",
227
+ }]
228
+ }], ctorParameters: () => [] });
229
+
230
+ class ClipboardTrigger {
231
+ constructor() {
232
+ const context = injectClipboardContext();
233
+ bindProps({
234
+ elementRef: inject(ElementRef),
235
+ renderer: inject(Renderer2),
236
+ destroyRef: inject(DestroyRef),
237
+ props: () => context.api().getTriggerProps(),
238
+ });
239
+ }
240
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: ClipboardTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
241
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.0", type: ClipboardTrigger, isStandalone: true, selector: "[clipboardTrigger]", exportAs: ["clipboardTrigger"], ngImport: i0 });
242
+ }
243
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: ClipboardTrigger, decorators: [{
244
+ type: Directive,
245
+ args: [{
246
+ selector: "[clipboardTrigger]",
247
+ standalone: true,
248
+ exportAs: "clipboardTrigger",
249
+ }]
250
+ }], ctorParameters: () => [] });
251
+
252
+ class ClipboardIndicator {
253
+ copied;
254
+ constructor() {
255
+ const context = injectClipboardContext();
256
+ this.copied = computed(() => context.api().copied, /* @ts-ignore */
257
+ ...(ngDevMode ? [{ debugName: "copied" }] : /* istanbul ignore next */ []));
258
+ bindProps({
259
+ elementRef: inject(ElementRef),
260
+ renderer: inject(Renderer2),
261
+ destroyRef: inject(DestroyRef),
262
+ props: () => {
263
+ const api = context.api();
264
+ return api.getIndicatorProps({ copied: this.copied() });
265
+ },
266
+ });
267
+ }
268
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: ClipboardIndicator, deps: [], target: i0.ɵɵFactoryTarget.Directive });
269
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.0", type: ClipboardIndicator, isStandalone: true, selector: "[clipboardIndicator]", exportAs: ["clipboardIndicator"], ngImport: i0 });
270
+ }
271
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: ClipboardIndicator, decorators: [{
272
+ type: Directive,
273
+ args: [{
274
+ selector: "[clipboardIndicator]",
275
+ standalone: true,
276
+ exportAs: "clipboardIndicator",
277
+ }]
278
+ }], ctorParameters: () => [] });
279
+
280
+ class ClipboardValueText {
281
+ context = injectClipboardContext();
282
+ value = computed(() => this.context.api().value, /* @ts-ignore */
283
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
284
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: ClipboardValueText, deps: [], target: i0.ɵɵFactoryTarget.Directive });
285
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.0", type: ClipboardValueText, isStandalone: true, selector: "[clipboardValueText]", exportAs: ["clipboardValueText"], ngImport: i0 });
286
+ }
287
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: ClipboardValueText, decorators: [{
288
+ type: Directive,
289
+ args: [{
290
+ selector: "[clipboardValueText]",
291
+ standalone: true,
292
+ exportAs: "clipboardValueText",
293
+ }]
294
+ }] });
295
+
296
+ /**
297
+ * Generated bundle index. Do not edit.
298
+ */
299
+
300
+ export { CLIPBOARD_CONTEXT, ClipboardContext, ClipboardControl, ClipboardIndicator, ClipboardInput, ClipboardLabel, ClipboardRoot, ClipboardRootProvider, ClipboardTrigger, ClipboardValueText, injectClipboardContext, useClipboard };
301
+ //# sourceMappingURL=wirekyt-angular-clipboard.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wirekyt-angular-clipboard.mjs","sources":["../../src/components/clipboard/use-context.ts","../../src/components/clipboard/use.ts","../../src/components/clipboard/root.ts","../../src/components/clipboard/root-provider.ts","../../src/components/clipboard/label.ts","../../src/components/clipboard/control.ts","../../src/components/clipboard/context.ts","../../src/components/clipboard/input.ts","../../src/components/clipboard/trigger.ts","../../src/components/clipboard/indicator.ts","../../src/components/clipboard/value-text.ts","../../src/components/clipboard/wirekyt-angular-clipboard.ts"],"sourcesContent":["import { InjectionToken, inject } from \"@angular/core\";\n\nimport type { UseClipboardReturn } from \"./use\";\n\nexport const CLIPBOARD_CONTEXT = new InjectionToken<UseClipboardReturn>(\n \"WIREKYT.CLIPBOARD_CONTEXT\",\n);\n\nexport function injectClipboardContext(): UseClipboardReturn {\n return inject(CLIPBOARD_CONTEXT);\n}\n","import type { Machine } from \"@wirekyt/dom\";\n\nimport { createId, injectEnvironment, useMachine, UseMachineReturn } from \"@wirekyt/angular\";\nimport * as clipboard from \"@wirekyt/dom/machines/clipboard\";\n\nimport type { ClipboardMachineProps } from \"./types\";\n\ntype OptionalId<T extends { id: string }> = Omit<T, \"id\"> & { id?: string };\n\nexport interface UseClipboardProps extends OptionalId<Omit<ClipboardMachineProps, \"getRootNode\">> {}\n\nexport type UseClipboardReturn = UseMachineReturn<\n clipboard.Service[\"state\"],\n clipboard.Api,\n clipboard.Service\n>;\n\nexport interface UseClipboardOptions {\n context: () => UseClipboardProps;\n}\n\ntype ClipboardContext = Record<string, unknown>;\ntype ClipboardSchema = clipboard.Machine extends Machine<infer TSchema> ? TSchema : never;\n\nexport function useClipboard(\n options: UseClipboardOptions = { context: () => ({}) },\n): UseClipboardReturn {\n const environment = injectEnvironment();\n const fallbackId = createId();\n\n return useMachine<ClipboardSchema, clipboard.Api>({\n machine: clipboard.machine,\n context: () => {\n const props = options.context();\n return {\n ...props,\n getRootNode: environment.getRootNode,\n id: props.id ?? fallbackId,\n } as ClipboardContext;\n },\n connect: (service, normalize) => clipboard.connect(service, normalize),\n });\n}\n","import type * as clipboard from \"@wirekyt/dom/machines/clipboard\";\n\nimport {\n DestroyRef,\n Directive,\n ElementRef,\n Renderer2,\n type InputSignal,\n type ModelSignal,\n type OutputEmitterRef,\n type Signal,\n computed,\n forwardRef,\n inject,\n input,\n model,\n output,\n} from \"@angular/core\";\nimport { bindProps } from \"@wirekyt/angular\";\n\nimport type {\n ClipboardCopyStatusDetails,\n ClipboardElementIds,\n ClipboardIntlTranslations,\n} from \"./types\";\n\nimport { useClipboard, type UseClipboardReturn } from \"./use\";\nimport { CLIPBOARD_CONTEXT } from \"./use-context\";\n\n@Directive({\n selector: \"[clipboardRoot]\",\n standalone: true,\n exportAs: \"clipboardRoot\",\n providers: [{ provide: CLIPBOARD_CONTEXT, useExisting: forwardRef(() => ClipboardRoot) }],\n})\nexport class ClipboardRoot implements UseClipboardReturn {\n readonly id: InputSignal<string | undefined> = input<string | undefined>(undefined);\n readonly ids: InputSignal<Partial<ClipboardElementIds> | undefined> = input<\n Partial<ClipboardElementIds> | undefined\n >(undefined);\n readonly translations: InputSignal<ClipboardIntlTranslations | undefined> = input<\n ClipboardIntlTranslations | undefined\n >(undefined);\n readonly value: ModelSignal<string | undefined> = model<string | undefined>(undefined);\n readonly defaultValue: InputSignal<string | undefined> = input<string | undefined>(undefined);\n readonly timeout: InputSignal<number | undefined> = input<number | undefined>(undefined);\n readonly statusChange: OutputEmitterRef<ClipboardCopyStatusDetails> =\n output<ClipboardCopyStatusDetails>();\n private readonly stableIds = computed(() => this.stabilizeIds(this.ids()));\n private prevIds: Partial<ClipboardElementIds> | undefined = undefined;\n\n private readonly machine = useClipboard({\n context: () => ({\n id: this.id(),\n ids: this.stableIds(),\n translations: this.translations(),\n value: this.value(),\n defaultValue: this.defaultValue(),\n timeout: this.timeout(),\n onValueChange: (details) => this.value.set(details.value),\n onStatusChange: (details) => this.statusChange.emit(details),\n }),\n });\n\n readonly state: Signal<clipboard.Service[\"state\"]> = this.machine.state;\n readonly api: Signal<clipboard.Api> = this.machine.api;\n readonly service: clipboard.Service = this.machine.service;\n readonly send: clipboard.Service[\"send\"] = this.machine.send;\n\n private stabilizeIds(\n next: Partial<ClipboardElementIds> | undefined,\n ): Partial<ClipboardElementIds> | undefined {\n if (next === this.prevIds) return this.prevIds;\n if (next === undefined || this.prevIds === undefined) {\n this.prevIds = next;\n return this.prevIds;\n }\n const keys = new Set([...Object.keys(next), ...Object.keys(this.prevIds)]);\n const hasEqualEntries = [...keys].every((key) =>\n Object.is(\n next[key as keyof ClipboardElementIds],\n this.prevIds?.[key as keyof ClipboardElementIds],\n ),\n );\n if (hasEqualEntries) {\n return this.prevIds;\n }\n this.prevIds = next;\n return this.prevIds;\n }\n\n constructor() {\n bindProps({\n elementRef: inject(ElementRef),\n renderer: inject(Renderer2),\n destroyRef: inject(DestroyRef),\n props: () => this.api().getRootProps(),\n });\n }\n}\n","import type * as clipboard from \"@wirekyt/dom/machines/clipboard\";\n\nimport {\n DestroyRef,\n Directive,\n ElementRef,\n Renderer2,\n type InputSignal,\n type Signal,\n computed,\n forwardRef,\n inject,\n input,\n} from \"@angular/core\";\nimport { bindProps } from \"@wirekyt/angular\";\n\nimport type { UseClipboardReturn } from \"./use\";\n\nimport { CLIPBOARD_CONTEXT } from \"./use-context\";\n\n@Directive({\n selector: \"[clipboardRootProvider]\",\n standalone: true,\n exportAs: \"clipboardRootProvider\",\n providers: [{ provide: CLIPBOARD_CONTEXT, useExisting: forwardRef(() => ClipboardRootProvider) }],\n})\nexport class ClipboardRootProvider implements UseClipboardReturn {\n readonly value: InputSignal<UseClipboardReturn> = input.required<UseClipboardReturn>();\n readonly state: Signal<clipboard.Service[\"state\"]> = computed(() => this.value().state());\n readonly api: Signal<clipboard.Api> = computed(() => this.value().api());\n readonly send: clipboard.Service[\"send\"] = (event) => this.value().send(event);\n\n get service(): clipboard.Service {\n return this.value().service;\n }\n\n resolveValue(): UseClipboardReturn {\n return this.value();\n }\n\n constructor() {\n bindProps({\n elementRef: inject(ElementRef),\n renderer: inject(Renderer2),\n destroyRef: inject(DestroyRef),\n props: () => this.api().getRootProps(),\n });\n }\n}\n","import { DestroyRef, Directive, ElementRef, Renderer2, inject } from \"@angular/core\";\nimport { bindProps } from \"@wirekyt/angular\";\n\nimport { injectClipboardContext } from \"./use-context\";\n\n@Directive({\n selector: \"[clipboardLabel]\",\n standalone: true,\n exportAs: \"clipboardLabel\",\n})\nexport class ClipboardLabel {\n constructor() {\n const context = injectClipboardContext();\n bindProps({\n elementRef: inject(ElementRef),\n renderer: inject(Renderer2),\n destroyRef: inject(DestroyRef),\n props: () => context.api().getLabelProps(),\n });\n }\n}\n","import { DestroyRef, Directive, ElementRef, Renderer2, inject } from \"@angular/core\";\nimport { bindProps } from \"@wirekyt/angular\";\n\nimport { injectClipboardContext } from \"./use-context\";\n\n@Directive({\n selector: \"[clipboardControl]\",\n standalone: true,\n exportAs: \"clipboardControl\",\n})\nexport class ClipboardControl {\n constructor() {\n const context = injectClipboardContext();\n bindProps({\n elementRef: inject(ElementRef),\n renderer: inject(Renderer2),\n destroyRef: inject(DestroyRef),\n props: () => context.api().getControlProps(),\n });\n }\n}\n","import {\n DestroyRef,\n Directive,\n TemplateRef,\n ViewContainerRef,\n effect,\n inject,\n} from \"@angular/core\";\n\nimport type { UseClipboardReturn } from \"./use\";\n\nimport { injectClipboardContext } from \"./use-context\";\n\nexport interface ClipboardContextTemplate {\n $implicit: UseClipboardReturn[\"api\"];\n api: UseClipboardReturn[\"api\"];\n}\n\n@Directive({\n selector: \"[clipboardContext]\",\n standalone: true,\n exportAs: \"clipboardContext\",\n})\nexport class ClipboardContext {\n static ngTemplateContextGuard(\n _directive: ClipboardContext,\n context: unknown,\n ): context is ClipboardContextTemplate {\n void context;\n return true;\n }\n\n private readonly clipboard = injectClipboardContext();\n private readonly templateRef = inject<TemplateRef<ClipboardContextTemplate>>(TemplateRef);\n private readonly viewContainer = inject(ViewContainerRef);\n\n constructor() {\n const view = this.viewContainer.createEmbeddedView(this.templateRef, {\n $implicit: this.clipboard.api,\n api: this.clipboard.api,\n });\n\n effect(() => {\n this.clipboard.api();\n view.detectChanges();\n });\n\n inject(DestroyRef).onDestroy(() => view.destroy());\n }\n}\n","import { DestroyRef, Directive, ElementRef, Renderer2, inject } from \"@angular/core\";\nimport { bindProps } from \"@wirekyt/angular\";\n\nimport { injectClipboardContext } from \"./use-context\";\n\n@Directive({\n selector: \"input[clipboardInput]\",\n standalone: true,\n exportAs: \"clipboardInput\",\n})\nexport class ClipboardInput {\n constructor() {\n const context = injectClipboardContext();\n bindProps({\n elementRef: inject(ElementRef),\n renderer: inject(Renderer2),\n destroyRef: inject(DestroyRef),\n props: () => context.api().getInputProps(),\n });\n }\n}\n","import { DestroyRef, Directive, ElementRef, Renderer2, inject } from \"@angular/core\";\nimport { bindProps } from \"@wirekyt/angular\";\n\nimport { injectClipboardContext } from \"./use-context\";\n\n@Directive({\n selector: \"[clipboardTrigger]\",\n standalone: true,\n exportAs: \"clipboardTrigger\",\n})\nexport class ClipboardTrigger {\n constructor() {\n const context = injectClipboardContext();\n bindProps({\n elementRef: inject(ElementRef),\n renderer: inject(Renderer2),\n destroyRef: inject(DestroyRef),\n props: () => context.api().getTriggerProps(),\n });\n }\n}\n","import {\n DestroyRef,\n Directive,\n ElementRef,\n Renderer2,\n type Signal,\n computed,\n inject,\n} from \"@angular/core\";\nimport { bindProps } from \"@wirekyt/angular\";\n\nimport { injectClipboardContext } from \"./use-context\";\n\n@Directive({\n selector: \"[clipboardIndicator]\",\n standalone: true,\n exportAs: \"clipboardIndicator\",\n})\nexport class ClipboardIndicator {\n readonly copied: Signal<boolean>;\n\n constructor() {\n const context = injectClipboardContext();\n this.copied = computed(() => context.api().copied);\n bindProps({\n elementRef: inject(ElementRef),\n renderer: inject(Renderer2),\n destroyRef: inject(DestroyRef),\n props: () => {\n const api = context.api();\n return api.getIndicatorProps({ copied: this.copied() });\n },\n });\n }\n}\n","import { Directive, type Signal, computed } from \"@angular/core\";\n\nimport { injectClipboardContext } from \"./use-context\";\n\n@Directive({\n selector: \"[clipboardValueText]\",\n standalone: true,\n exportAs: \"clipboardValueText\",\n})\nexport class ClipboardValueText {\n private readonly context = injectClipboardContext();\n readonly value: Signal<string> = computed(() => this.context.api().value);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAIa,iBAAiB,GAAG,IAAI,cAAc,CACjD,2BAA2B;SAGb,sBAAsB,GAAA;AACpC,IAAA,OAAO,MAAM,CAAC,iBAAiB,CAAC;AAClC;;ACcM,SAAU,YAAY,CAC1B,OAAA,GAA+B,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,EAAA;AAEtD,IAAA,MAAM,WAAW,GAAG,iBAAiB,EAAE;AACvC,IAAA,MAAM,UAAU,GAAG,QAAQ,EAAE;AAE7B,IAAA,OAAO,UAAU,CAAiC;QAChD,OAAO,EAAE,SAAS,CAAC,OAAO;QAC1B,OAAO,EAAE,MAAK;AACZ,YAAA,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,EAAE;YAC/B,OAAO;AACL,gBAAA,GAAG,KAAK;gBACR,WAAW,EAAE,WAAW,CAAC,WAAW;AACpC,gBAAA,EAAE,EAAE,KAAK,CAAC,EAAE,IAAI,UAAU;aACP;QACvB,CAAC;AACD,QAAA,OAAO,EAAE,CAAC,OAAO,EAAE,SAAS,KAAK,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CA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AU,EAAE,IAAI;AAChB,oBAAA,QAAQ,EAAE,oBAAoB;AAC/B,iBAAA;;;MCRY,kBAAkB,CAAA;IACZ,OAAO,GAAG,sBAAsB,EAAE;AAC1C,IAAA,KAAK,GAAmB,QAAQ,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,KAAK;8EAAC;uGAF9D,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAlB,kBAAkB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,sBAAA,EAAA,QAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAL9B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,sBAAsB;AAChC,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,QAAQ,EAAE,oBAAoB;AAC/B,iBAAA;;;ACRD;;AAEG;;;;"}
@@ -0,0 +1,122 @@
1
+ import { GridCollection, ListCollection, TreeCollection, filePathToTree, Selection } from '@wirekyt/dom/collection';
2
+ import { useMachine } from '@wirekyt/angular';
3
+ import * as asyncList from '@wirekyt/dom/machines/async-list';
4
+ import { computed, signal, effect, untracked } from '@angular/core';
5
+
6
+ const createGridCollection = (options) => new GridCollection(options);
7
+
8
+ const createListCollection = (options) => new ListCollection(options);
9
+
10
+ const createTreeCollection = (options) => new TreeCollection(options);
11
+ const createFileTreeCollection = (paths) => filePathToTree(paths);
12
+
13
+ function useAsyncList(options) {
14
+ return useMachine({
15
+ machine: asyncList.machine,
16
+ context: options.context,
17
+ connect: (service) => asyncList.connect(service),
18
+ });
19
+ }
20
+
21
+ function useListCollection(options) {
22
+ const props = computed(() => options.context(), /* @ts-ignore */
23
+ ...(ngDevMode ? [{ debugName: "props" }] : /* istanbul ignore next */ []));
24
+ const items = signal(props().initialItems ?? [], /* @ts-ignore */
25
+ ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
26
+ const filterText = signal("", /* @ts-ignore */
27
+ ...(ngDevMode ? [{ debugName: "filterText" }] : /* istanbul ignore next */ []));
28
+ const setItems = (value) => {
29
+ items.set(value);
30
+ filterText.set("");
31
+ };
32
+ const create = (value) => {
33
+ const { initialItems: _initialItems, filter: _filter, limit: _limit, ...collectionOptions } = props();
34
+ return createListCollection({ ...collectionOptions, items: value });
35
+ };
36
+ const collection = computed(() => {
37
+ const { filter, limit } = props();
38
+ let activeItems = items();
39
+ if (filterText() && filter) {
40
+ activeItems = create(activeItems).filter((itemText, _index, item) => filter(itemText, filterText(), item)).items;
41
+ }
42
+ const limitedItems = limit == null ? activeItems : activeItems.slice(0, limit);
43
+ return create(limitedItems);
44
+ }, /* @ts-ignore */
45
+ ...(ngDevMode ? [{ debugName: "collection" }] : /* istanbul ignore next */ []));
46
+ return {
47
+ collection,
48
+ filter: (value = "") => filterText.set(value),
49
+ set: setItems,
50
+ reset: () => setItems(props().initialItems),
51
+ clear: () => setItems([]),
52
+ insert: (index, ...values) => setItems(create(items()).insert(index, ...values).items),
53
+ insertBefore: (value, ...values) => setItems(create(items()).insertBefore(value, ...values).items),
54
+ insertAfter: (value, ...values) => setItems(create(items()).insertAfter(value, ...values).items),
55
+ remove: (...values) => setItems(create(items()).remove(...values).items),
56
+ move: (value, to) => setItems(create(items()).move(value, to).items),
57
+ moveBefore: (value, ...values) => setItems(create(items()).moveBefore(value, ...values).items),
58
+ moveAfter: (value, ...values) => setItems(create(items()).moveAfter(value, ...values).items),
59
+ reorder: (from, to) => setItems(create(items()).reorder(from, to).items),
60
+ append: (...values) => setItems(create(items()).append(...values).items),
61
+ upsert: (value, item, mode = "append") => setItems(create(items()).upsert(value, item, mode).items),
62
+ prepend: (...values) => setItems(create(items()).prepend(...values).items),
63
+ update: (value, item) => setItems(create(items()).update(value, item).items),
64
+ };
65
+ }
66
+
67
+ function useListSelection(options) {
68
+ const props = computed(() => options.context(), /* @ts-ignore */
69
+ ...(ngDevMode ? [{ debugName: "props" }] : /* istanbul ignore next */ []));
70
+ const createSelection = (values = []) => {
71
+ const selection = new Selection(values);
72
+ selection.selectionMode = props().selectionMode ?? "single";
73
+ selection.deselectable = props().deselectable ?? true;
74
+ return selection;
75
+ };
76
+ const selection = signal(createSelection(props().initialSelectedValues), /* @ts-ignore */
77
+ ...(ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []));
78
+ effect(() => {
79
+ const { collection, resetOnCollectionChange } = props();
80
+ collection.getValues();
81
+ if (resetOnCollectionChange)
82
+ untracked(() => selection.set(createSelection()));
83
+ });
84
+ const selectedValues = computed(() => Array.from(selection()), /* @ts-ignore */
85
+ ...(ngDevMode ? [{ debugName: "selectedValues" }] : /* istanbul ignore next */ []));
86
+ const isEmpty = computed(() => selection().isEmpty(), /* @ts-ignore */
87
+ ...(ngDevMode ? [{ debugName: "isEmpty" }] : /* istanbul ignore next */ []));
88
+ const firstSelectedValue = computed(() => selection().firstSelectedValue(props().collection), /* @ts-ignore */
89
+ ...(ngDevMode ? [{ debugName: "firstSelectedValue" }] : /* istanbul ignore next */ []));
90
+ const lastSelectedValue = computed(() => selection().lastSelectedValue(props().collection), /* @ts-ignore */
91
+ ...(ngDevMode ? [{ debugName: "lastSelectedValue" }] : /* istanbul ignore next */ []));
92
+ return {
93
+ selectedValues,
94
+ isEmpty,
95
+ firstSelectedValue,
96
+ lastSelectedValue,
97
+ isSelected: (value) => selection().isSelected(value),
98
+ isAllSelected: () => {
99
+ const values = props().collection.getValues();
100
+ return values.length > 0 && values.every((value) => selection().isSelected(value));
101
+ },
102
+ isSomeSelected: () => props()
103
+ .collection.getValues()
104
+ .some((value) => selection().isSelected(value)),
105
+ canSelect: (value) => selection().canSelect(props().collection, value),
106
+ select: (value, forceToggle) => selection.set(selection().select(props().collection, value, forceToggle)),
107
+ deselect: (value) => selection.set(selection().deselect(value)),
108
+ toggle: (value) => selection.set(selection().toggleSelection(props().collection, value)),
109
+ replace: (value) => selection.set(selection().replaceSelection(props().collection, value)),
110
+ extend: (anchorValue, targetValue) => selection.set(selection().extendSelection(props().collection, anchorValue, targetValue)),
111
+ setSelectedValues: (values) => selection.set(selection().setSelection(values)),
112
+ clear: () => selection.set(selection().clearSelection()),
113
+ resetSelection: () => selection.set(createSelection()),
114
+ };
115
+ }
116
+
117
+ /**
118
+ * Generated bundle index. Do not edit.
119
+ */
120
+
121
+ export { createFileTreeCollection, createGridCollection, createListCollection, createTreeCollection, useAsyncList, useListCollection, useListSelection };
122
+ //# sourceMappingURL=wirekyt-angular-collection.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wirekyt-angular-collection.mjs","sources":["../../src/components/collection/grid.ts","../../src/components/collection/list.ts","../../src/components/collection/tree.ts","../../src/components/collection/use-async-list.ts","../../src/components/collection/use-list.ts","../../src/components/collection/use-list-selection.ts","../../src/components/collection/wirekyt-angular-collection.ts"],"sourcesContent":["import {\n type CollectionItem,\n type GridCollectionOptions,\n GridCollection,\n} from \"@wirekyt/dom/collection\";\n\nexport const createGridCollection = <T extends CollectionItem>(\n options: GridCollectionOptions<T>,\n): GridCollection<T> => new GridCollection(options);\n\nexport type { GridCollection, GridCollectionOptions };\n","import {\n type CollectionItem,\n type CollectionOptions,\n ListCollection,\n} from \"@wirekyt/dom/collection\";\n\nexport const createListCollection = <T extends CollectionItem>(\n options: CollectionOptions<T>,\n): ListCollection<T> => new ListCollection(options);\n\nexport type { CollectionItem, CollectionOptions, ListCollection };\n","import {\n type FilePathTreeNode,\n type FlatTreeNode,\n type TreeCollectionOptions,\n type TreeNode,\n TreeCollection,\n filePathToTree,\n} from \"@wirekyt/dom/collection\";\n\nexport const createTreeCollection = <T extends TreeNode>(\n options: TreeCollectionOptions<T>,\n): TreeCollection<T> => new TreeCollection(options);\n\nexport const createFileTreeCollection = (paths: string[]): TreeCollection<FilePathTreeNode> =>\n filePathToTree(paths);\n\nexport type { FilePathTreeNode, FlatTreeNode, TreeCollection, TreeCollectionOptions, TreeNode };\n","import type { Machine } from \"@wirekyt/dom\";\n\nimport { useMachine, type UseMachineReturn } from \"@wirekyt/angular\";\nimport * as asyncList from \"@wirekyt/dom/machines/async-list\";\n\nexport interface UseAsyncListOptions<T, C = string> {\n context: () => asyncList.Props<T, C>;\n}\n\nexport type UseAsyncListReturn<T, C = string> = UseMachineReturn<\n asyncList.Service<T, C>[\"state\"],\n asyncList.Api<T, C>,\n asyncList.Service<T, C>\n>;\n\ntype AsyncListSchema<T, C> =\n asyncList.Machine<T, C> extends Machine<infer TSchema> ? TSchema : never;\n\nexport function useAsyncList<T, C = string>(\n options: UseAsyncListOptions<T, C>,\n): UseAsyncListReturn<T, C> {\n return useMachine<AsyncListSchema<T, C>, asyncList.Api<T, C>>({\n machine: asyncList.machine as asyncList.Machine<T, C>,\n context: options.context,\n connect: (service) => asyncList.connect(service),\n });\n}\n","import { type Signal, computed, signal } from \"@angular/core\";\n\nimport { type CollectionOptions, type ListCollection, createListCollection } from \"./list\";\n\nexport interface UseListCollectionProps<T> extends Omit<CollectionOptions<T>, \"items\"> {\n initialItems: T[] | readonly T[];\n filter?: (itemText: string, filterText: string, item: T) => boolean;\n limit?: number;\n}\n\nexport interface UseListCollectionOptions<T> {\n context: () => UseListCollectionProps<T>;\n}\n\nexport function useListCollection<T>(\n options: UseListCollectionOptions<T>,\n): UseListCollectionReturn<T> {\n const props = computed(() => options.context());\n const items = signal<T[] | readonly T[]>(props().initialItems ?? []);\n const filterText = signal(\"\");\n\n const setItems = (value: T[] | readonly T[]) => {\n items.set(value);\n filterText.set(\"\");\n };\n\n const create = (value: T[] | readonly T[]) => {\n const {\n initialItems: _initialItems,\n filter: _filter,\n limit: _limit,\n ...collectionOptions\n } = props();\n return createListCollection({ ...collectionOptions, items: value });\n };\n\n const collection = computed(() => {\n const { filter, limit } = props();\n let activeItems = items();\n\n if (filterText() && filter) {\n activeItems = create(activeItems).filter((itemText, _index, item) =>\n filter(itemText, filterText(), item),\n ).items;\n }\n\n const limitedItems = limit == null ? activeItems : activeItems.slice(0, limit);\n return create(limitedItems);\n });\n\n return {\n collection,\n filter: (value = \"\") => filterText.set(value),\n set: setItems,\n reset: () => setItems(props().initialItems),\n clear: () => setItems([]),\n insert: (index, ...values) => setItems(create(items()).insert(index, ...values).items),\n insertBefore: (value, ...values) =>\n setItems(create(items()).insertBefore(value, ...values).items),\n insertAfter: (value, ...values) =>\n setItems(create(items()).insertAfter(value, ...values).items),\n remove: (...values) => setItems(create(items()).remove(...values).items),\n move: (value, to) => setItems(create(items()).move(value, to).items),\n moveBefore: (value, ...values) => setItems(create(items()).moveBefore(value, ...values).items),\n moveAfter: (value, ...values) => setItems(create(items()).moveAfter(value, ...values).items),\n reorder: (from, to) => setItems(create(items()).reorder(from, to).items),\n append: (...values) => setItems(create(items()).append(...values).items),\n upsert: (value, item, mode = \"append\") =>\n setItems(create(items()).upsert(value, item, mode).items),\n prepend: (...values) => setItems(create(items()).prepend(...values).items),\n update: (value, item) => setItems(create(items()).update(value, item).items),\n };\n}\n\nexport interface UseListCollectionReturn<T> {\n collection: Signal<ListCollection<T>>;\n filter(inputValue: string): void;\n set(items: T[] | readonly T[]): void;\n reset(): void;\n clear(): void;\n insert(index: number, ...items: T[]): void;\n insertBefore(value: string, ...items: T[]): void;\n insertAfter(value: string, ...items: T[]): void;\n remove(...itemOrValues: Array<T | string>): void;\n move(value: string, to: number): void;\n moveBefore(value: string, ...values: string[]): void;\n moveAfter(value: string, ...values: string[]): void;\n reorder(from: number, to: number): void;\n append(...items: T[]): void;\n upsert(value: string, item: T, mode?: \"append\" | \"prepend\"): void;\n prepend(...items: T[]): void;\n update(value: string, item: T): void;\n}\n","import { type Signal, computed, effect, signal, untracked } from \"@angular/core\";\nimport { Selection, type SelectionMode } from \"@wirekyt/dom/collection\";\n\nimport type { CollectionItem, ListCollection } from \"./list\";\n\nexport interface UseListSelectionProps<T extends CollectionItem> {\n selectionMode?: SelectionMode;\n deselectable?: boolean;\n initialSelectedValues?: string[];\n resetOnCollectionChange?: boolean;\n collection: ListCollection<T>;\n}\n\nexport interface UseListSelectionOptions<T extends CollectionItem> {\n context: () => UseListSelectionProps<T>;\n}\n\nexport function useListSelection<T extends CollectionItem>(\n options: UseListSelectionOptions<T>,\n): UseListSelectionReturn {\n const props = computed(() => options.context());\n const createSelection = (values: string[] = []) => {\n const selection = new Selection(values);\n selection.selectionMode = props().selectionMode ?? \"single\";\n selection.deselectable = props().deselectable ?? true;\n return selection;\n };\n const selection = signal(createSelection(props().initialSelectedValues));\n\n effect(() => {\n const { collection, resetOnCollectionChange } = props();\n collection.getValues();\n if (resetOnCollectionChange) untracked(() => selection.set(createSelection()));\n });\n\n const selectedValues = computed(() => Array.from(selection()));\n const isEmpty = computed(() => selection().isEmpty());\n const firstSelectedValue = computed(() => selection().firstSelectedValue(props().collection));\n const lastSelectedValue = computed(() => selection().lastSelectedValue(props().collection));\n\n return {\n selectedValues,\n isEmpty,\n firstSelectedValue,\n lastSelectedValue,\n isSelected: (value) => selection().isSelected(value),\n isAllSelected: () => {\n const values = props().collection.getValues();\n return values.length > 0 && values.every((value) => selection().isSelected(value));\n },\n isSomeSelected: () =>\n props()\n .collection.getValues()\n .some((value) => selection().isSelected(value)),\n canSelect: (value) => selection().canSelect(props().collection, value),\n select: (value, forceToggle) =>\n selection.set(selection().select(props().collection, value, forceToggle)),\n deselect: (value) => selection.set(selection().deselect(value)),\n toggle: (value) => selection.set(selection().toggleSelection(props().collection, value)),\n replace: (value) => selection.set(selection().replaceSelection(props().collection, value)),\n extend: (anchorValue, targetValue) =>\n selection.set(selection().extendSelection(props().collection, anchorValue, targetValue)),\n setSelectedValues: (values) => selection.set(selection().setSelection(values)),\n clear: () => selection.set(selection().clearSelection()),\n resetSelection: () => selection.set(createSelection()),\n };\n}\n\nexport interface UseListSelectionReturn {\n selectedValues: Signal<string[]>;\n isEmpty: Signal<boolean>;\n firstSelectedValue: Signal<string | null>;\n lastSelectedValue: Signal<string | null>;\n isSelected(value: string | null): boolean;\n canSelect(value: string): boolean;\n select(value: string, forceToggle?: boolean): void;\n deselect(value: string): void;\n toggle(value: string): void;\n replace(value: string | null): void;\n extend(anchorValue: string, targetValue: string): void;\n setSelectedValues(values: string[]): void;\n clear(): void;\n resetSelection(): void;\n isAllSelected(): boolean;\n isSomeSelected(): boolean;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAMO,MAAM,oBAAoB,GAAG,CAClC,OAAiC,KACX,IAAI,cAAc,CAAC,OAAO;;ACF3C,MAAM,oBAAoB,GAAG,CAClC,OAA6B,KACP,IAAI,cAAc,CAAC,OAAO;;ACC3C,MAAM,oBAAoB,GAAG,CAClC,OAAiC,KACX,IAAI,cAAc,CAAC,OAAO;AAE3C,MAAM,wBAAwB,GAAG,CAAC,KAAe,KACtD,cAAc,CAAC,KAAK;;ACIhB,SAAU,YAAY,CAC1B,OAAkC,EAAA;AAElC,IAAA,OAAO,UAAU,CAA6C;QAC5D,OAAO,EAAE,SAAS,CAAC,OAAkC;QACrD,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,OAAO,EAAE,CAAC,OAAO,KAAK,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC;AACjD,KAAA,CAAC;AACJ;;ACZM,SAAU,iBAAiB,CAC/B,OAAoC,EAAA;IAEpC,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,OAAO,CAAC,OAAO,EAAE;8EAAC;IAC/C,MAAM,KAAK,GAAG,MAAM,CAAqB,KAAK,EAAE,CAAC,YAAY,IAAI,EAAE;8EAAC;AACpE,IAAA,MAAM,UAAU,GAAG,MAAM,CAAC,EAAE;mFAAC;AAE7B,IAAA,MAAM,QAAQ,GAAG,CAAC,KAAyB,KAAI;AAC7C,QAAA,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC;AAChB,QAAA,UAAU,CAAC,GAAG,C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AAS,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,UAAU,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;AAC3E,QAAA,QAAQ,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC/D,MAAM,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QACxF,OAAO,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QAC1F,MAAM,EAAE,CAAC,WAAW,EAAE,WAAW,KAC/B,SAAS,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;AAC1F,QAAA,iBAAiB,EAAE,CAAC,MAAM,KAAK,SAAS,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;AAC9E,QAAA,KAAK,EAAE,MAAM,SAAS,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,cAAc,EAAE,CAAC;QACxD,cAAc,EAAE,MAAM,SAAS,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC;KACvD;AACH;;AClEA;;AAEG;;;;"}
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wirekyt/angular",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "Angular adapter for Wirekyt",
5
5
  "files": [
6
6
  "dist"
@@ -34,10 +34,22 @@
34
34
  "types": "./types/wirekyt-angular-checkbox.d.ts",
35
35
  "default": "./fesm2022/wirekyt-angular-checkbox.mjs"
36
36
  },
37
+ "./clipboard": {
38
+ "types": "./types/wirekyt-angular-clipboard.d.ts",
39
+ "default": "./fesm2022/wirekyt-angular-clipboard.mjs"
40
+ },
41
+ "./client-only": {
42
+ "types": "./types/wirekyt-angular-client-only.d.ts",
43
+ "default": "./fesm2022/wirekyt-angular-client-only.mjs"
44
+ },
37
45
  "./collapsible": {
38
46
  "types": "./types/wirekyt-angular-collapsible.d.ts",
39
47
  "default": "./fesm2022/wirekyt-angular-collapsible.mjs"
40
48
  },
49
+ "./collection": {
50
+ "types": "./types/wirekyt-angular-collection.d.ts",
51
+ "default": "./fesm2022/wirekyt-angular-collection.mjs"
52
+ },
41
53
  "./field": {
42
54
  "types": "./types/wirekyt-angular-field.d.ts",
43
55
  "default": "./fesm2022/wirekyt-angular-field.mjs"
@@ -7,7 +7,7 @@ import * as i0 from '@angular/core';
7
7
  import { Signal, InputSignal, ModelSignal, InputSignalWithTransform, OutputEmitterRef, InjectionToken } from '@angular/core';
8
8
  import { ControlValueAccessor } from '@angular/forms';
9
9
 
10
- declare const checkboxAnatomy: _wirekyt_dom_anatomy.AnatomyInstance<"root" | "indicator" | "label" | "control" | "group">;
10
+ declare const checkboxAnatomy: _wirekyt_dom_anatomy.AnatomyInstance<"root" | "label" | "control" | "indicator" | "group">;
11
11
 
12
12
  type OptionalId<T extends {
13
13
  id: string;
@@ -0,0 +1,14 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { TemplateRef } from '@angular/core';
3
+
4
+ declare class ClientOnly {
5
+ readonly fallback: _angular_core.InputSignal<TemplateRef<unknown> | null>;
6
+ readonly clientTemplate: _angular_core.InputSignal<TemplateRef<unknown> | null>;
7
+ protected readonly isClient: _angular_core.WritableSignal<boolean>;
8
+ constructor();
9
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ClientOnly, never>;
10
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ClientOnly, "client-only", never, { "fallback": { "alias": "fallback"; "required": false; "isSignal": true; }; "clientTemplate": { "alias": "clientTemplate"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
11
+ }
12
+
13
+ export { ClientOnly };
14
+ //# sourceMappingURL=wirekyt-angular-client-only.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wirekyt-angular-client-only.d.ts","sources":["../../src/components/client-only/client-only.ts"],"mappings":";;;AAUA,cAkBa,UAAU;uBACJ,aAAA,CAAA,WAAA,CAAA,WAAA;6BACM,aAAA,CAAA,WAAA,CAAA,WAAA;AACvB,iCAA2B,aAAA,CAAA,cAAA;;oDAHhB,UAAU;sDAAV,UAAU;AAUtB;;;;","names":[]}
@@ -0,0 +1,111 @@
1
+ import * as clipboard from '@wirekyt/dom/machines/clipboard';
2
+ import { Props, ElementIds, IntlTranslations, CopyStatusDetails } from '@wirekyt/dom/machines/clipboard';
3
+ export { Api as ClipboardApi, CopyStatusDetails as ClipboardCopyStatusDetails, ElementIds as ClipboardElementIds, IndicatorProps as ClipboardIndicatorProps, IntlTranslations as ClipboardIntlTranslations, Machine as ClipboardMachine, Props as ClipboardMachineProps, Service as ClipboardService, ValueChangeDetails as ClipboardValueChangeDetails, anatomy as clipboardAnatomy } from '@wirekyt/dom/machines/clipboard';
4
+ import * as i0 from '@angular/core';
5
+ import { InjectionToken, InputSignal, ModelSignal, OutputEmitterRef, Signal } from '@angular/core';
6
+ import { UseMachineReturn } from '@wirekyt/angular';
7
+
8
+ type OptionalId<T extends {
9
+ id: string;
10
+ }> = Omit<T, "id"> & {
11
+ id?: string;
12
+ };
13
+ interface UseClipboardProps extends OptionalId<Omit<Props, "getRootNode">> {
14
+ }
15
+ type UseClipboardReturn = UseMachineReturn<clipboard.Service["state"], clipboard.Api, clipboard.Service>;
16
+ interface UseClipboardOptions {
17
+ context: () => UseClipboardProps;
18
+ }
19
+ declare function useClipboard(options?: UseClipboardOptions): UseClipboardReturn;
20
+
21
+ declare const CLIPBOARD_CONTEXT: InjectionToken<UseClipboardReturn>;
22
+ declare function injectClipboardContext(): UseClipboardReturn;
23
+
24
+ declare class ClipboardRoot implements UseClipboardReturn {
25
+ readonly id: InputSignal<string | undefined>;
26
+ readonly ids: InputSignal<Partial<ElementIds> | undefined>;
27
+ readonly translations: InputSignal<IntlTranslations | undefined>;
28
+ readonly value: ModelSignal<string | undefined>;
29
+ readonly defaultValue: InputSignal<string | undefined>;
30
+ readonly timeout: InputSignal<number | undefined>;
31
+ readonly statusChange: OutputEmitterRef<CopyStatusDetails>;
32
+ private readonly stableIds;
33
+ private prevIds;
34
+ private readonly machine;
35
+ readonly state: Signal<clipboard.Service["state"]>;
36
+ readonly api: Signal<clipboard.Api>;
37
+ readonly service: clipboard.Service;
38
+ readonly send: clipboard.Service["send"];
39
+ private stabilizeIds;
40
+ constructor();
41
+ static ɵfac: i0.ɵɵFactoryDeclaration<ClipboardRoot, never>;
42
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ClipboardRoot, "[clipboardRoot]", ["clipboardRoot"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "ids": { "alias": "ids"; "required": false; "isSignal": true; }; "translations": { "alias": "translations"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "defaultValue": { "alias": "defaultValue"; "required": false; "isSignal": true; }; "timeout": { "alias": "timeout"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "statusChange": "statusChange"; }, never, never, true, never>;
43
+ }
44
+
45
+ declare class ClipboardRootProvider implements UseClipboardReturn {
46
+ readonly value: InputSignal<UseClipboardReturn>;
47
+ readonly state: Signal<clipboard.Service["state"]>;
48
+ readonly api: Signal<clipboard.Api>;
49
+ readonly send: clipboard.Service["send"];
50
+ get service(): clipboard.Service;
51
+ resolveValue(): UseClipboardReturn;
52
+ constructor();
53
+ static ɵfac: i0.ɵɵFactoryDeclaration<ClipboardRootProvider, never>;
54
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ClipboardRootProvider, "[clipboardRootProvider]", ["clipboardRootProvider"], { "value": { "alias": "value"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
55
+ }
56
+
57
+ declare class ClipboardLabel {
58
+ constructor();
59
+ static ɵfac: i0.ɵɵFactoryDeclaration<ClipboardLabel, never>;
60
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ClipboardLabel, "[clipboardLabel]", ["clipboardLabel"], {}, {}, never, never, true, never>;
61
+ }
62
+
63
+ declare class ClipboardControl {
64
+ constructor();
65
+ static ɵfac: i0.ɵɵFactoryDeclaration<ClipboardControl, never>;
66
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ClipboardControl, "[clipboardControl]", ["clipboardControl"], {}, {}, never, never, true, never>;
67
+ }
68
+
69
+ interface ClipboardContextTemplate {
70
+ $implicit: UseClipboardReturn["api"];
71
+ api: UseClipboardReturn["api"];
72
+ }
73
+ declare class ClipboardContext {
74
+ static ngTemplateContextGuard(_directive: ClipboardContext, context: unknown): context is ClipboardContextTemplate;
75
+ private readonly clipboard;
76
+ private readonly templateRef;
77
+ private readonly viewContainer;
78
+ constructor();
79
+ static ɵfac: i0.ɵɵFactoryDeclaration<ClipboardContext, never>;
80
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ClipboardContext, "[clipboardContext]", ["clipboardContext"], {}, {}, never, never, true, never>;
81
+ }
82
+
83
+ declare class ClipboardInput {
84
+ constructor();
85
+ static ɵfac: i0.ɵɵFactoryDeclaration<ClipboardInput, never>;
86
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ClipboardInput, "input[clipboardInput]", ["clipboardInput"], {}, {}, never, never, true, never>;
87
+ }
88
+
89
+ declare class ClipboardTrigger {
90
+ constructor();
91
+ static ɵfac: i0.ɵɵFactoryDeclaration<ClipboardTrigger, never>;
92
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ClipboardTrigger, "[clipboardTrigger]", ["clipboardTrigger"], {}, {}, never, never, true, never>;
93
+ }
94
+
95
+ declare class ClipboardIndicator {
96
+ readonly copied: Signal<boolean>;
97
+ constructor();
98
+ static ɵfac: i0.ɵɵFactoryDeclaration<ClipboardIndicator, never>;
99
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ClipboardIndicator, "[clipboardIndicator]", ["clipboardIndicator"], {}, {}, never, never, true, never>;
100
+ }
101
+
102
+ declare class ClipboardValueText {
103
+ private readonly context;
104
+ readonly value: Signal<string>;
105
+ static ɵfac: i0.ɵɵFactoryDeclaration<ClipboardValueText, never>;
106
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ClipboardValueText, "[clipboardValueText]", ["clipboardValueText"], {}, {}, never, never, true, never>;
107
+ }
108
+
109
+ export { CLIPBOARD_CONTEXT, ClipboardContext, ClipboardControl, ClipboardIndicator, ClipboardInput, ClipboardLabel, ClipboardRoot, ClipboardRootProvider, ClipboardTrigger, ClipboardValueText, injectClipboardContext, useClipboard };
110
+ export type { ClipboardContextTemplate, UseClipboardOptions, UseClipboardProps, UseClipboardReturn };
111
+ //# sourceMappingURL=wirekyt-angular-clipboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wirekyt-angular-clipboard.d.ts","sources":["../../src/components/clipboard/use.ts","../../src/components/clipboard/use-context.ts","../../src/components/clipboard/root.ts","../../src/components/clipboard/root-provider.ts","../../src/components/clipboard/label.ts","../../src/components/clipboard/control.ts","../../src/components/clipboard/context.ts","../../src/components/clipboard/input.ts","../../src/components/clipboard/trigger.ts","../../src/components/clipboard/indicator.ts","../../src/components/clipboard/value-text.ts"],"mappings":";;;;;;;AAOA,KAAK,UAAU;;AAAyB,KAAI,IAAI;;;AAE1C,UAAW,iBAAkB,SAAQ,UAAU,CAAC,IAAI,CAACA,KAAqB;AAAoB;AAE9F,KAAM,kBAAkB,GAAG,gBAAgB,CAC/C,SAAS,CAAC,OAAO,WACjB,SAAS,CAAC,GAAG,EACb,SAAS,CAAC,OAAO;UAGF,mBAAmB;mBACnB,iBAAiB;AACjC;AAKD,iBAAgB,YAAY,WACjB,mBAA6C,GACrD,kBAAkB;;ACtBrB,cAAa,iBAAi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AlB,kBAAkB;AAgB9B;;AC9BD,cAKa,kBAAkB;AAC7B;AACA,oBAAgB,MAAM;yCAFX,kBAAkB;2CAAlB,kBAAkB;AAG9B;;;;","names":["ClipboardMachineProps","ClipboardElementIds","ClipboardIntlTranslations","ClipboardCopyStatusDetails"]}
@@ -0,0 +1,81 @@
1
+ import { CollectionItem, GridCollectionOptions, GridCollection, CollectionOptions, ListCollection, TreeCollection, FilePathTreeNode, TreeNode, TreeCollectionOptions, SelectionMode } from '@wirekyt/dom/collection';
2
+ export { CollectionItem, CollectionOptions, FilePathTreeNode, FlatTreeNode, GridCollection, GridCollectionOptions, ListCollection, TreeCollection, TreeCollectionOptions, TreeNode } from '@wirekyt/dom/collection';
3
+ import { UseMachineReturn } from '@wirekyt/angular';
4
+ import * as asyncList from '@wirekyt/dom/machines/async-list';
5
+ import { Signal } from '@angular/core';
6
+
7
+ declare const createGridCollection: <T extends CollectionItem>(options: GridCollectionOptions<T>) => GridCollection<T>;
8
+
9
+ declare const createListCollection: <T extends CollectionItem>(options: CollectionOptions<T>) => ListCollection<T>;
10
+
11
+ declare const createTreeCollection: <T extends TreeNode>(options: TreeCollectionOptions<T>) => TreeCollection<T>;
12
+ declare const createFileTreeCollection: (paths: string[]) => TreeCollection<FilePathTreeNode>;
13
+
14
+ interface UseAsyncListOptions<T, C = string> {
15
+ context: () => asyncList.Props<T, C>;
16
+ }
17
+ type UseAsyncListReturn<T, C = string> = UseMachineReturn<asyncList.Service<T, C>["state"], asyncList.Api<T, C>, asyncList.Service<T, C>>;
18
+ declare function useAsyncList<T, C = string>(options: UseAsyncListOptions<T, C>): UseAsyncListReturn<T, C>;
19
+
20
+ interface UseListCollectionProps<T> extends Omit<CollectionOptions<T>, "items"> {
21
+ initialItems: T[] | readonly T[];
22
+ filter?: (itemText: string, filterText: string, item: T) => boolean;
23
+ limit?: number;
24
+ }
25
+ interface UseListCollectionOptions<T> {
26
+ context: () => UseListCollectionProps<T>;
27
+ }
28
+ declare function useListCollection<T>(options: UseListCollectionOptions<T>): UseListCollectionReturn<T>;
29
+ interface UseListCollectionReturn<T> {
30
+ collection: Signal<ListCollection<T>>;
31
+ filter(inputValue: string): void;
32
+ set(items: T[] | readonly T[]): void;
33
+ reset(): void;
34
+ clear(): void;
35
+ insert(index: number, ...items: T[]): void;
36
+ insertBefore(value: string, ...items: T[]): void;
37
+ insertAfter(value: string, ...items: T[]): void;
38
+ remove(...itemOrValues: Array<T | string>): void;
39
+ move(value: string, to: number): void;
40
+ moveBefore(value: string, ...values: string[]): void;
41
+ moveAfter(value: string, ...values: string[]): void;
42
+ reorder(from: number, to: number): void;
43
+ append(...items: T[]): void;
44
+ upsert(value: string, item: T, mode?: "append" | "prepend"): void;
45
+ prepend(...items: T[]): void;
46
+ update(value: string, item: T): void;
47
+ }
48
+
49
+ interface UseListSelectionProps<T extends CollectionItem> {
50
+ selectionMode?: SelectionMode;
51
+ deselectable?: boolean;
52
+ initialSelectedValues?: string[];
53
+ resetOnCollectionChange?: boolean;
54
+ collection: ListCollection<T>;
55
+ }
56
+ interface UseListSelectionOptions<T extends CollectionItem> {
57
+ context: () => UseListSelectionProps<T>;
58
+ }
59
+ declare function useListSelection<T extends CollectionItem>(options: UseListSelectionOptions<T>): UseListSelectionReturn;
60
+ interface UseListSelectionReturn {
61
+ selectedValues: Signal<string[]>;
62
+ isEmpty: Signal<boolean>;
63
+ firstSelectedValue: Signal<string | null>;
64
+ lastSelectedValue: Signal<string | null>;
65
+ isSelected(value: string | null): boolean;
66
+ canSelect(value: string): boolean;
67
+ select(value: string, forceToggle?: boolean): void;
68
+ deselect(value: string): void;
69
+ toggle(value: string): void;
70
+ replace(value: string | null): void;
71
+ extend(anchorValue: string, targetValue: string): void;
72
+ setSelectedValues(values: string[]): void;
73
+ clear(): void;
74
+ resetSelection(): void;
75
+ isAllSelected(): boolean;
76
+ isSomeSelected(): boolean;
77
+ }
78
+
79
+ export { createFileTreeCollection, createGridCollection, createListCollection, createTreeCollection, useAsyncList, useListCollection, useListSelection };
80
+ export type { UseAsyncListOptions, UseAsyncListReturn, UseListCollectionOptions, UseListCollectionProps, UseListCollectionReturn, UseListSelectionOptions, UseListSelectionProps, UseListSelectionReturn };
81
+ //# sourceMappingURL=wirekyt-angular-collection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wirekyt-angular-collection.d.ts","sources":["../../src/components/collection/grid.ts","../../src/components/collection/list.ts","../../src/components/collection/tree.ts","../../src/components/collection/use-async-list.ts","../../src/components/collection/use-list.ts","../../src/components/collection/use-list-selection.ts"],"mappings":";;;;;;AAMA,cAAa,oBAAoB,aAAc,cAAc,WAClD,qBAAqB,QAC7B,cAAc;;ACFjB,cAAa,oBAAoB,aAAc,cAAc,WAClD,iBAAiB,QACzB,cAAc;;ACCjB,cAAa,oBAAoB,aAAc,QAAQ,WAC5C,qBAAqB,QAC7B,cAAc;AAEjB,cAAa,wBAAwB,uBAAsB,cAAc,CAAC,gBAAgB;;UCRzE,mBAAmB;mBACnB,SAAS,CAAC,KAAK;AAC/B;KAEW,kBAAkB,kBAAkB,gBAAgB,CAC9D,SAAS,CAAC,OAAO,iBACjB,SAAS,CAAC,GAAG,QACb,SAAS,CAAC,OAAO;AAMnB,iBAAgB,YAAY,yBACjB,mBAAmB,SAC3B,kBAAkB;;AChBf,UAAW,sBAAsB,YAAY,IAAI,CAAC,iBAAiB;AACvE;AACA;;AAED;AAEK,UAAW,wBAAwB;AACvC,mBAAe,sBAAsB;AACtC;AAED,iBAAgB,iBAAiB,aACtB,wBAAwB,MAChC,uBAAuB;AA0DpB,UAAW,uBAAuB;gBAC1B,MAAM,CAAC,cAAc;AACjC;;;;AAIA;AACA;AACA;AACA,4BAAwB,KAAK;;AAE7B;AACA;;;AAGA;;;AAGD;;ACvFK,UAAW,qBAAqB,WAAW,cAAc;oBAC7C,aAAa;;AAE7B;;AAEA,gBAAY,cAAc;AAC3B;AAEK,UAAW,uBAAuB,WAAW,cAAc;AAC/D,mBAAe,qBAAqB;AACrC;AAED,iBAAgB,gBAAgB,WAAW,cAAc,WAC9C,uBAAuB,MAC/B,sBAAsB;UAiDR,sBAAsB;AACrC,oBAAgB,MAAM;AACtB,aAAS,MAAM;AACf,wBAAoB,MAAM;AAC1B,uBAAmB,MAAM;;AAEzB;;AAEA;AACA;;;AAGA;;;;;AAKD;;;;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wirekyt/angular",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "Angular adapter for Wirekyt",
5
5
  "files": [
6
6
  "dist"
@@ -34,10 +34,22 @@
34
34
  "types": "./dist/types/wirekyt-angular-checkbox.d.ts",
35
35
  "default": "./dist/fesm2022/wirekyt-angular-checkbox.mjs"
36
36
  },
37
+ "./clipboard": {
38
+ "types": "./dist/types/wirekyt-angular-clipboard.d.ts",
39
+ "default": "./dist/fesm2022/wirekyt-angular-clipboard.mjs"
40
+ },
41
+ "./client-only": {
42
+ "types": "./dist/types/wirekyt-angular-client-only.d.ts",
43
+ "default": "./dist/fesm2022/wirekyt-angular-client-only.mjs"
44
+ },
37
45
  "./collapsible": {
38
46
  "types": "./dist/types/wirekyt-angular-collapsible.d.ts",
39
47
  "default": "./dist/fesm2022/wirekyt-angular-collapsible.mjs"
40
48
  },
49
+ "./collection": {
50
+ "types": "./dist/types/wirekyt-angular-collection.d.ts",
51
+ "default": "./dist/fesm2022/wirekyt-angular-collection.mjs"
52
+ },
41
53
  "./field": {
42
54
  "types": "./dist/types/wirekyt-angular-field.d.ts",
43
55
  "default": "./dist/fesm2022/wirekyt-angular-field.mjs"
@@ -56,7 +68,7 @@
56
68
  "@internationalized/date": "^3.12.3",
57
69
  "@internationalized/number": "^3.6.7",
58
70
  "tslib": "^2.8.1",
59
- "@wirekyt/dom": "0.0.7"
71
+ "@wirekyt/dom": "0.0.9"
60
72
  },
61
73
  "peerDependencies": {
62
74
  "@angular/common": ">=22.0.0",