ngx-kit 7.4.0 → 8.0.1

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.
@@ -1,5 +1,5 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { TemplateRef, EventEmitter, InjectionToken, OnInit, OnDestroy, ElementRef, Renderer2 } from '@angular/core';
2
+ import { TemplateRef, ApplicationRef, EventEmitter, InjectionToken, OnInit, OnDestroy, Renderer2, ElementRef, AfterContentInit } from '@angular/core';
3
3
 
4
4
  interface IPosition {
5
5
  x: number;
@@ -19,20 +19,49 @@ declare class DropListGroupRef {
19
19
  }
20
20
 
21
21
  declare class PlaceHolderRef {
22
+ /**
23
+ * Custom placeholder content, from `*ngxPlaceholder` inside the `ngxDropList`. When unset,
24
+ * `attach()` falls back to a shallow clone of the dragged element (previous behaviour).
25
+ *
26
+ * Example:
27
+ *
28
+ * <div ngxDropList>
29
+ * <span class="my-placeholder" *ngxPlaceholder></span>
30
+ * ...
31
+ * </div>
32
+ */
22
33
  tpl?: TemplateRef<unknown>;
34
+ /** Set by `NgxPlaceholder` so the embedded view can join Angular's change-detection tree. */
35
+ appRef?: ApplicationRef;
23
36
  dropList?: DropListRef;
24
37
  element?: HTMLElement;
25
38
  private _visible;
39
+ private _view?;
40
+ /** True once `this.element` was built from `tpl` (as opposed to the fallback clone). */
41
+ private isCustom;
26
42
  attach(container: HTMLElement, source: HTMLElement, reference?: Node | null): HTMLElement;
43
+ /** True while the currently attached element came from a custom `*ngxPlaceholder` template. */
44
+ get custom(): boolean;
27
45
  detach(): void;
28
46
  get visible(): boolean;
29
47
  }
30
48
 
49
+ interface Point {
50
+ x: number;
51
+ y: number;
52
+ }
53
+
31
54
  /**
32
- * DropListRef is intentionally generic, while the positional sorting strategy
33
- * works on DragRef<any>. The public DropList/DragRef relationship is invariant
34
- * because IDropEvent<T> contains T in a callback position. Keep the strongly
35
- * typed Set here, and narrow only at the DOM-local bridge / strategy boundary.
55
+ * A drop list.
56
+ *
57
+ * Membership (`_draggables`) only ever reflects which draggables *belong* to this list in the
58
+ * template. It is never changed by dragging. Everything that is transient during a drag lives
59
+ * in a single `SortSession` (see sorting/sort-session.ts) that is created when a drag enters
60
+ * the list and disposed when it leaves or the drag ends:
61
+ *
62
+ * - the list the drag started in keeps its session for the whole drag (its placeholder holds
63
+ * the item's original slot, so leaving and re-entering is stable);
64
+ * - any other list gets a fresh session on every entry and drops it on every exit.
36
65
  */
37
66
  declare class DropListRef<T = any> {
38
67
  data?: T;
@@ -40,34 +69,182 @@ declare class DropListRef<T = any> {
40
69
  disableSort: boolean;
41
70
  connectedTo: HTMLElement[];
42
71
  dropListGroup?: DropListGroupRef | null;
72
+ /** Duration (ms) of the sibling slide animation. `0` disables animation. */
73
+ sortAnimationDuration: number;
43
74
  readonly _draggables: Set<DragRef<T>>;
44
75
  readonly onDrop: EventEmitter<IDropEvent<T>>;
45
- private strategy;
46
- private active;
47
- private previousIndex;
76
+ /**
77
+ * Nesting: the nearest ENCLOSING drop list (null for a top-level list), and this list's own
78
+ * direct nested lists — i.e. lists whose nearest enclosing list is this one, not a list at any
79
+ * depth. Set by `NgxDropList` at init from a `skipSelf` DI lookup. Used for two things: (1)
80
+ * `depth` for "innermost wins" in `DragRef`'s target resolution, without any DOM `.contains()`
81
+ * calls on the hot path, and (2) cascading `_setAncestorOffset` (below) to every list nested
82
+ * inside an item that gets displaced by sorting, at any depth.
83
+ */
84
+ parentList: DropListRef<any> | null;
85
+ readonly childLists: Set<DropListRef<any>>;
86
+ private session;
48
87
  private placeholder?;
88
+ customPlaceholder?: PlaceHolderRef;
89
+ private activeDrag;
90
+ private isOrigin;
91
+ private hovered;
92
+ private hit;
93
+ /** Pre-insertion geometry of a foreign list, restored when the drag leaves it. */
94
+ private naturalHit;
95
+ private hitCached;
96
+ /**
97
+ * Screen-space offset contributed by displaced ANCESTOR item(s) (see `parentList` above).
98
+ * `{0,0}` outside of that (the overwhelmingly common case). Kept as a SUM of independent
99
+ * per-source contributions, not a single overwritten value: while the pointer hovers a
100
+ * FOREIGN (non-origin) list nested inside the origin's own displaced item, up to two ancestor
101
+ * sessions can be displacing this list at once — the origin's (frozen, still active further
102
+ * up) and that foreign list's own — and one clearing its contribution on release must not
103
+ * wipe out the other's, still-active, contribution.
104
+ */
105
+ private readonly ancestorContributions;
106
+ private ancestorOffset;
107
+ /** Entries this list itself pushed via a one-time placeholder-insertion reflow (see below). */
108
+ private readonly reflowContributions;
109
+ /** How many enclosing drop lists this one is nested inside. Root lists are depth 0. */
110
+ get depth(): number;
111
+ _registerChild(child: DropListRef<any>): void;
112
+ _unregisterChild(child: DropListRef<any>): void;
113
+ /**
114
+ * One ancestor SESSION's contribution to this list's total displacement just changed (or
115
+ * cleared, `{0,0}`). `source` identifies WHICH session — the list whose own item is doing the
116
+ * displacing — so that this list's own recomputed total is a SUM across every currently-active
117
+ * source, and cascades the SAME (source, offset) pair on to every nested list at any depth
118
+ * unchanged, so a list several levels down stays hit-testable at its true on-screen position
119
+ * regardless of which ancestor(s) are currently sorting.
120
+ */
121
+ _setAncestorOffset(source: DropListRef<any>, offset: Point): void;
122
+ /** Which of this list's DIRECT nested lists live inside `el`, notified of its new offset. */
123
+ private propagateOffset;
124
+ /** Rects, right now, of every `other` entry that contains one of this list's nested lists. */
125
+ private trackedEntryRects;
126
+ /** Turns the real reflow a fresh placeholder insertion just caused into ordinary offsets. */
127
+ private propagateReflow;
49
128
  addItem(item: DragRef<T>): void;
50
129
  removeItem(item: DragRef<T>): void;
51
130
  isConnectedTo(other: DropListRef<any>): boolean;
131
+ /**
132
+ * Measure the list and its clipping ancestors once, at drag start (or the moment a nested
133
+ * list becomes a candidate mid-drag). `measureHit` reads live `getBoundingClientRect()`s,
134
+ * which already include any `translate3d` an ancestor item's displacement has applied — so if
135
+ * this list is currently offset (nested inside a sibling that sorting is displacing right
136
+ * now), the measurement is normalized back to the zero-offset frame `_containsPoint` expects,
137
+ * by subtracting that offset straight back out. Without this, entering a nested list while
138
+ * its ancestor is mid-displacement would double-count the offset on every check afterwards.
139
+ */
140
+ _cacheGeometry(): void;
141
+ /**
142
+ * Is the point over the *visible* part of this list? Scroll-aware without re-measuring.
143
+ *
144
+ * The list box and every clipping ancestor are tracked separately because they react to scroll
145
+ * differently: scrolling a container moves the list but not the container's own clip window.
146
+ */
147
+ _containsPoint(x: number, y: number): boolean;
148
+ /** Approximate area, used to break ties between overlapping, unrelated lists. */
149
+ _area(): number;
150
+ _onScroll(): void;
151
+ /** Re-measure after a viewport resize. */
152
+ _refresh(): void;
153
+ /** Backwards-compatible entry point: makes this list the drag's target. */
52
154
  createPlaceholder(drag: DragRef<T>): PlaceHolderRef;
155
+ /** The drag pointer entered this list (or the drag started inside it). */
53
156
  enter(drag: DragRef<T>, x?: number, y?: number): void;
157
+ /** Re-evaluate the insertion index for the pointer. Returns the new index, or null if unchanged. */
54
158
  sortItem(drag: DragRef<T>, position: IPosition): number | null;
159
+ /** The pointer left this list. */
160
+ /**
161
+ * The pointer truly left this list (as opposed to moving deeper into one of its own nested
162
+ * lists — see `DragRef`'s chain tracking, which never calls `exit()` for a list that remains
163
+ * an ancestor of the new target, so this always means "left this list's territory").
164
+ */
165
+ exit(drag: DragRef<T>): void;
166
+ /**
167
+ * The pointer dove into one of this list's own nested lists: this list is no longer the
168
+ * innermost target, but it isn't being left either — its placeholder and sibling displacement
169
+ * stay exactly as they are (avoids a snap-back-then-forward flicker), only the "currently
170
+ * hovered" bookkeeping (and its visual highlight) is cleared. `DragRef`'s chain tracking calls
171
+ * this instead of `exit()` for every list that remains an ancestor of the new target.
172
+ */
173
+ _freeze(): void;
174
+ /**
175
+ * Ends the drag for this list. Returns the drop event when the pointer was released over this
176
+ * list, `null` otherwise (nothing to emit). All transient state is disposed either way.
177
+ */
178
+ _finish(drag: DragRef<T>, commit: boolean): IDropEvent<T> | null;
179
+ /** Compatibility wrapper: finish + emit. */
55
180
  finishDrag(drag: DragRef<T>): void;
56
- exit(_drag: DragRef<T>): void;
57
181
  resetSortTransforms(): void;
58
182
  getFinalIndex(): number;
59
183
  getItemIndex(item: DragRef<T>): number;
184
+ /** End of the drag: dispose EVERYTHING this list holds, including cached geometry. Idempotent. */
185
+ _release(drag?: DragRef<T>): void;
186
+ /** Dispose the sort session, placeholder and drag ownership. */
187
+ private releaseSession;
188
+ private begin;
189
+ /**
190
+ * First placement into a list that does not contain the item yet: the node the placeholder
191
+ * must be inserted before (null = append). Same pure resolver as sorting, no hysteresis.
192
+ */
193
+ private foreignInsertionReference;
194
+ private otherSlots;
60
195
  private indexOf;
61
- private reset;
62
- private copyPlaceholderGeometry;
196
+ private lockPlaceholderGeometry;
197
+ }
198
+
199
+ declare class DragDropService {
200
+ readonly drags: _angular_core.WritableSignal<readonly DragRef<unknown>[]>;
201
+ readonly dropLists: _angular_core.WritableSignal<readonly DropListRef<any>[]>;
202
+ readonly activeDrag: _angular_core.WritableSignal<DragRef<unknown> | null>;
203
+ /**
204
+ * DOM-position registries, used to find the nearest enclosing list/group by walking real
205
+ * ancestor elements instead of Angular's element-injector tree.
206
+ *
207
+ * This matters for `ngTemplateOutlet`-based recursive trees (a list of items whose own
208
+ * children are rendered by re-invoking the SAME `<ng-template>`, as in a tree/outliner UI):
209
+ * each invocation gets a FRESH embedded view whose injector context is wherever the outlet
210
+ * was written in the template, not wherever its content ends up in the DOM. So `inject(TOKEN,
211
+ * {skipSelf})` from one recursion level can never see a provider from another level — the
212
+ * only fix within Angular's own DI is to manually thread `ngTemplateOutletInjector` through
213
+ * every recursive call, which isn't reasonable to require of every consumer of this library.
214
+ * A plain DOM walk has no such limitation: it only cares where elements actually ended up.
215
+ */
216
+ private readonly listsByEl;
217
+ private readonly groupsByEl;
218
+ registerDragItem(ref: DragRef<any>): void;
219
+ removeDragItem(ref: DragRef<any>): void;
220
+ registerDropList(ref: DropListRef): void;
221
+ removeDropList(ref: DropListRef<any>): void;
222
+ registerGroup(el: HTMLElement, ref: DropListGroupRef): void;
223
+ removeGroup(el: HTMLElement): void;
224
+ /** Nearest registered drop list starting at (and including) `start`, walking up the DOM. */
225
+ findAncestorDropList(start: HTMLElement | null): DropListRef | null;
226
+ /** Nearest registered drop-list group starting at (and including) `start`, walking up the DOM. */
227
+ findAncestorGroup(start: HTMLElement | null): DropListGroupRef | null;
228
+ begin(ref: DragRef<any>): void;
229
+ end(ref: DragRef<any>): void;
230
+ cancelActive(): void;
63
231
  /**
64
- * The sorting strategy only needs a read-only collection of draggable refs.
65
- * Using DragRef<any> at this internal boundary avoids the invariant generic
66
- * relationship between DragRef<T> and DragRef<unknown>.
232
+ * Which drop list is under `point`?
233
+ *
234
+ * - Only lists connected to the drag's ORIGIN list qualify (connectivity is not transitive, so
235
+ * A→B→C never lets an item hop A→C). Without an origin (a free-drag element) nothing
236
+ * qualifies: free dragging is never captured by a list.
237
+ * - Only the visible (clip-aware) part of a list counts.
238
+ * - A list inside the dragged element itself is never a target.
239
+ * - Nested lists: the innermost qualifying list wins. Among unrelated overlapping lists the
240
+ * current one is kept (no flicker), otherwise the smallest.
67
241
  */
68
- private getStrategyItems;
69
- private asStrategyDrag;
70
- private publishDragItems;
242
+ findDropList(point: {
243
+ x: number;
244
+ y: number;
245
+ }, current?: DropListRef | null, origin?: DropListRef | null, dragEl?: HTMLElement | null): DropListRef | null;
246
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<DragDropService, never>;
247
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<DragDropService>;
71
248
  }
72
249
 
73
250
  type DragAxis = 'x' | 'y' | undefined;
@@ -76,8 +253,16 @@ declare class DragRef<T = unknown> {
76
253
  el: HTMLElement;
77
254
  boundary?: HTMLElement;
78
255
  lockAxis?: DragAxis;
256
+ /**
257
+ * The list this draggable BELONGS to (set by the template). Dragging never changes it.
258
+ * The list the pointer is currently over is `activeDropList`.
259
+ */
79
260
  dropList: DropListRef<T> | null;
80
261
  dropListGroup?: DropListGroupRef | null;
262
+ /** Used to find the drop list under the pointer. Set by the directive; optional. */
263
+ service?: DragDropService;
264
+ /** Drop list currently under the pointer during a drop-list drag (null = outside every list). */
265
+ activeDropList: DropListRef<T> | null;
81
266
  placeholder?: PlaceHolderRef;
82
267
  originDropList: DropListRef<T> | null;
83
268
  originIndex: number;
@@ -97,6 +282,21 @@ declare class DragRef<T = unknown> {
97
282
  private sourceVisibility;
98
283
  private sourceDisplay;
99
284
  private sourcePointerEvents;
285
+ private sourceTransition;
286
+ /** True while a drop-list drag (body preview + placeholder) is in progress. Free drag: always false. */
287
+ private listDrag;
288
+ private cachedLists;
289
+ /**
290
+ * Candidate lists for hit-testing, filtered (connected to the origin; not inside the dragged
291
+ * element) and sorted deepest-first — both computed ONCE, not on every pointer move, since
292
+ * neither ever changes mid-drag. Kept in sync with the live registry (see `dropListsSnapshot`)
293
+ * so a list that appears or disappears mid-drag (e.g. behind an `@if`) is still picked up.
294
+ */
295
+ private dropCandidates;
296
+ private dropListsSnapshot;
297
+ private lastEffective;
298
+ private scrollListener?;
299
+ private resizeListener?;
100
300
  init(): void;
101
301
  withDropList(list: DropListRef<T> | null): this;
102
302
  clearDropList(): void;
@@ -106,6 +306,12 @@ declare class DragRef<T = unknown> {
106
306
  nudge(dx: number, dy: number): void;
107
307
  endDrag(): void;
108
308
  cancelDrag(): void;
309
+ /** Abort without emitting anything (the directive was destroyed mid-drag). Idempotent. */
310
+ dispose(): void;
311
+ /** True while a drop-list drag is running. */
312
+ get isListDrag(): boolean;
313
+ /** Inline `display` the source element had before it was hidden for the drag. */
314
+ get originalDisplay(): string;
109
315
  get x(): number;
110
316
  get y(): number;
111
317
  get pointer(): IPosition;
@@ -118,6 +324,42 @@ declare class DragRef<T = unknown> {
118
324
  */
119
325
  notifyScroll(dx: number, dy: number): void;
120
326
  private applyTransform;
327
+ private beginListDrag;
328
+ /**
329
+ * Recomputes which registered lists are valid targets for this drag — connected to the
330
+ * origin, and not nested inside the element being dragged — plus each one's nesting depth.
331
+ *
332
+ * `DragDropService.dropLists()` is an Angular signal: its array is a NEW reference only when a
333
+ * list actually registers or unregisters, so the check below is a single reference comparison
334
+ * on every pointer move and the (heavier) connectivity/containment/depth work below it only
335
+ * runs on the rare event a list appears or disappears mid-drag — never on every pointer move.
336
+ */
337
+ private refreshDropCandidates;
338
+ /**
339
+ * Decide which list is under the pointer, switch if needed, then re-sort in the active one.
340
+ *
341
+ * The origin list is the one exception to "exiting a list resets/releases it": while the
342
+ * pointer dives into one of the origin's OWN nested lists (at any depth), the origin's
343
+ * placeholder and sibling displacement are left exactly as they are — frozen, not reset —
344
+ * so returning to the origin's own level doesn't snap items back and then forward again.
345
+ * Every OTHER (foreign) list still fully releases the moment the pointer leaves it, exactly
346
+ * as before; nesting multiple foreign sessions alive at once would let their own internal
347
+ * sibling displacement compound in ways a single flat `ancestorOffset` cannot represent.
348
+ */
349
+ private updateDropTarget;
350
+ /**
351
+ * Innermost connected list under the pointer, from the precomputed candidates: deeper always
352
+ * beats shallower; among lists at the same depth (unrelated, visually overlapping lists) the
353
+ * currently active one is kept to avoid flicker, otherwise the smaller one wins. No DOM
354
+ * reads and no `.contains()` calls happen here — everything needed was precomputed above.
355
+ */
356
+ private resolveDropList;
357
+ /**
358
+ * Single teardown path for every way a drop-list drag can end (drop on a list, drop outside,
359
+ * Escape, pointercancel, destroy). Everything transient is removed here, so nothing can leak
360
+ * regardless of how the drag ended. Only then is the drop event emitted.
361
+ */
362
+ private finishListDrag;
121
363
  private updatePreview;
122
364
  }
123
365
 
@@ -148,29 +390,9 @@ interface IResizableOutput {
148
390
  direction: ResizeDirection;
149
391
  }
150
392
 
151
- declare class DragDropService {
152
- readonly drags: _angular_core.WritableSignal<readonly DragRef<unknown>[]>;
153
- readonly dropLists: _angular_core.WritableSignal<readonly DropListRef<any>[]>;
154
- readonly activeDrag: _angular_core.WritableSignal<DragRef<unknown> | null>;
155
- registerDragItem(ref: DragRef<any>): void;
156
- removeDragItem(ref: DragRef<any>): void;
157
- registerDropList(ref: DropListRef): void;
158
- removeDropList(ref: DropListRef<any>): void;
159
- begin(ref: DragRef<any>): void;
160
- end(ref: DragRef<any>): void;
161
- cancelActive(): void;
162
- findDropList(point: {
163
- x: number;
164
- y: number;
165
- }, current?: DropListRef | null): DropListRef | null;
166
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<DragDropService, never>;
167
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<DragDropService>;
168
- }
169
-
170
393
  declare const NGX_DRAGGABLE: InjectionToken<NgxDraggable<unknown>>;
171
394
  declare class NgxDraggable<T = unknown> implements OnInit, OnDestroy {
172
395
  private readonly host;
173
- private readonly renderer;
174
396
  readonly disabled: _angular_core.ModelSignal<boolean>;
175
397
  /** Element whose rect constrains the drag. Now actually enforced. */
176
398
  readonly boundary: _angular_core.InputSignal<HTMLElement | undefined>;
@@ -193,8 +415,6 @@ declare class NgxDraggable<T = unknown> implements OnInit, OnDestroy {
193
415
  readonly dragging: _angular_core.WritableSignal<boolean>;
194
416
  private readonly doc;
195
417
  private readonly service;
196
- private readonly list;
197
- private readonly group;
198
418
  private readonly scroller;
199
419
  private down;
200
420
  private start;
@@ -205,12 +425,15 @@ declare class NgxDraggable<T = unknown> implements OnInit, OnDestroy {
205
425
  private removeUp?;
206
426
  private removeKeydown?;
207
427
  private removeEscape?;
428
+ private removeCancel?;
429
+ private removeLostCapture?;
208
430
  private scrollTarget;
209
431
  private lastScroll;
210
432
  private lastWindowScroll;
211
433
  private removeContainerScroll?;
212
434
  private removeWindowScroll?;
213
- constructor(host: ElementRef<HTMLElement>, renderer: Renderer2);
435
+ protected readonly renderer: Renderer2;
436
+ constructor(host: ElementRef<HTMLElement>);
214
437
  ngOnInit(): void;
215
438
  ngOnDestroy(): void;
216
439
  private pointerDown;
@@ -222,6 +445,8 @@ declare class NgxDraggable<T = unknown> implements OnInit, OnDestroy {
222
445
  private stopScrollTracking;
223
446
  private pointerMove;
224
447
  private pointerUp;
448
+ /** Browser cancelled the pointer (touch takeover, lost capture...). */
449
+ private pointerCancel;
225
450
  private cancel;
226
451
  private finish;
227
452
  /** Arrow-key movement for keyboard/assistive-tech users. Shift multiplies the step by 4. */
@@ -277,26 +502,31 @@ declare class NgxResizable {
277
502
  }
278
503
 
279
504
  declare const NGX_DROPLIST: InjectionToken<NgxDropList<any>>;
280
- declare class NgxDropList<T = any> implements OnInit, OnDestroy {
505
+ declare class NgxDropList<T = any> implements OnInit, OnDestroy, AfterContentInit {
281
506
  private readonly el;
282
507
  readonly _ref: DropListRef<T>;
283
508
  set data(value: T);
284
509
  set connectedTo(value: HTMLElement[] | null | undefined);
285
510
  set disableSort(value: boolean);
286
511
  readonly drop: EventEmitter<IDropEvent<T>>;
512
+ private readonly customPlaceholder?;
513
+ private sub?;
287
514
  private readonly service;
288
- private readonly group;
289
515
  constructor(el: ElementRef<HTMLElement>);
290
516
  ngOnInit(): void;
517
+ ngAfterContentInit(): void;
291
518
  ngOnDestroy(): void;
292
519
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgxDropList<any>, never>;
293
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgxDropList<any>, "[NgxDropList],[ngxDropList]", never, { "data": { "alias": "data"; "required": false; }; "connectedTo": { "alias": "connectedTo"; "required": false; }; "disableSort": { "alias": "disableSort"; "required": false; }; }, { "drop": "drop"; }, never, never, true, never>;
520
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgxDropList<any>, "[NgxDropList],[ngxDropList]", never, { "data": { "alias": "data"; "required": false; }; "connectedTo": { "alias": "connectedTo"; "required": false; }; "disableSort": { "alias": "disableSort"; "required": false; }; }, { "drop": "drop"; }, ["customPlaceholder"], never, true, never>;
294
521
  }
295
522
 
296
523
  declare const NGX_DROPLIST_GROUP: InjectionToken<NgxDropListGroup>;
297
524
  /** Wrap several `ngxDropList`s to let items move freely between them. */
298
- declare class NgxDropListGroup implements OnDestroy {
525
+ declare class NgxDropListGroup implements OnInit, OnDestroy {
299
526
  readonly _ref: DropListGroupRef;
527
+ private readonly el;
528
+ private readonly service;
529
+ ngOnInit(): void;
300
530
  ngOnDestroy(): void;
301
531
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgxDropListGroup, never>;
302
532
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgxDropListGroup, "[NgxDropListGroup],[ngxDropListGroup]", never, {}, {}, never, never, true, never>;
@@ -4,13 +4,8 @@ interface NgxImageViewerItem {
4
4
  src: string;
5
5
  alt?: string;
6
6
  caption?: string;
7
- /** نام فایل هنگام دانلود؛ نبود یعنی از روی src حدس زده می‌شه */
8
7
  downloadFileName?: string;
9
8
  }
10
- /**
11
- * هر دکمه‌ی نوار ابزار جدا فعال/غیرفعال می‌شه — دقیقاً طبق خواسته: «این
12
- * دکمه‌های کانفیگی باشه که هر کدوم خواست فعال کنه».
13
- */
14
9
  interface NgxImageViewerToolbarConfig {
15
10
  prevNext?: boolean;
16
11
  counter?: boolean;
@@ -47,7 +42,7 @@ declare const NGX_IMAGE_VIEWER_DEFAULT_TOOLBAR: Required<NgxImageViewerToolbarCo
47
42
  * ngx-kit/dialog (یا هر overlay دیگه) قرار بگیره — خودش به هیچ‌کدوم وابسته
48
43
  * نیست، فقط با closed خروجی به بیرون خبر می‌ده که «ببندم».
49
44
  */
50
- declare class NgxImageViewerComponent {
45
+ declare class NgxImageViewer {
51
46
  images: _angular_core.InputSignal<NgxImageViewerItem[]>;
52
47
  startIndex: _angular_core.InputSignal<number>;
53
48
  toolbar: _angular_core.InputSignal<NgxImageViewerToolbarConfig>;
@@ -103,37 +98,8 @@ declare class NgxImageViewerComponent {
103
98
  private applyZoomAt;
104
99
  private clientXOf;
105
100
  private clientYOf;
106
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgxImageViewerComponent, never>;
107
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgxImageViewerComponent, "ngx-image-viewer", never, { "images": { "alias": "images"; "required": true; "isSignal": true; }; "startIndex": { "alias": "startIndex"; "required": false; "isSignal": true; }; "toolbar": { "alias": "toolbar"; "required": false; "isSignal": true; }; "minZoom": { "alias": "minZoom"; "required": false; "isSignal": true; }; "maxZoom": { "alias": "maxZoom"; "required": false; "isSignal": true; }; "zoomStep": { "alias": "zoomStep"; "required": false; "isSignal": true; }; }, { "indexChange": "indexChange"; "closed": "closed"; }, never, never, true, never>;
108
- }
109
-
110
- interface NgxImageViewerOpenOptions {
111
- startIndex?: number;
112
- toolbar?: NgxImageViewerToolbarConfig;
113
- minZoom?: number;
114
- maxZoom?: number;
115
- zoomStep?: number;
116
- }
117
- /**
118
- * راه میان‌بر برای وقتی که کاربر می‌خواد ویوئر رو داخل یه دیالوگِ تمام‌صفحه
119
- * باز کنه، بدون این‌که خودش دستی wire کنه. اگه کسی می‌خواد داخل دیالوگِ
120
- * خودش (مثلاً ngx-kit/dialog) بذارتش، کافیه مستقیم از NgxImageViewerComponent
121
- * استفاده کنه — این سرویس صرفاً یه میان‌بَره، وابستگی اجباری نیست.
122
- *
123
- * دقیقاً همون الگوی امن‌شده‌ی NgxMessageService: با Map<id, ComponentRef> و
124
- * detachView قبل از destroy، تا اون نشتی حافظه‌ای که قبلاً توی message
125
- * service پیدا و رفع شد، اینجا از اول تکرار نشه.
126
- */
127
- declare class NgxImageViewerService {
128
- private readonly appRef;
129
- private readonly envInjector;
130
- private nextId;
131
- private readonly openInstances;
132
- open(images: NgxImageViewerItem[], options?: NgxImageViewerOpenOptions): {
133
- close: () => void;
134
- };
135
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgxImageViewerService, never>;
136
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<NgxImageViewerService>;
101
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgxImageViewer, never>;
102
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgxImageViewer, "ngx-image-viewer", never, { "images": { "alias": "images"; "required": true; "isSignal": true; }; "startIndex": { "alias": "startIndex"; "required": false; "isSignal": true; }; "toolbar": { "alias": "toolbar"; "required": false; "isSignal": true; }; "minZoom": { "alias": "minZoom"; "required": false; "isSignal": true; }; "maxZoom": { "alias": "maxZoom"; "required": false; "isSignal": true; }; "zoomStep": { "alias": "zoomStep"; "required": false; "isSignal": true; }; }, { "indexChange": "indexChange"; "closed": "closed"; }, never, never, true, never>;
137
103
  }
138
104
 
139
105
  interface PanZoomState {
@@ -164,5 +130,5 @@ declare function downloadImage(src: string, filename?: string): Promise<void>;
164
130
  /** یه پنجره‌ی جدید فقط با همون تصویر باز می‌کنه و بعد از لود، print می‌زنه؛ با DOM API (نه innerHTML) پس در برابر src مخرب امنه */
165
131
  declare function printImage(src: string): void;
166
132
 
167
- export { NGX_IMAGE_VIEWER_DEFAULT_TOOLBAR, NgxImageViewerComponent, NgxImageViewerService, clamp, distanceBetweenTouches, downloadImage, midpointOfTouches, printImage, zoomAroundPoint };
168
- export type { NgxImageViewerItem, NgxImageViewerOpenOptions, NgxImageViewerToolbarConfig, PanZoomState };
133
+ export { NGX_IMAGE_VIEWER_DEFAULT_TOOLBAR, NgxImageViewer, clamp, distanceBetweenTouches, downloadImage, midpointOfTouches, printImage, zoomAroundPoint };
134
+ export type { NgxImageViewerItem, NgxImageViewerToolbarConfig, PanZoomState };
@@ -0,0 +1,53 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, OnInit, OnDestroy } from '@angular/core';
3
+ import * as ngx_kit_side_nav from 'ngx-kit/side-nav';
4
+
5
+ declare class NgxDrawerMenu {
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxDrawerMenu, never>;
7
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgxDrawerMenu, "[ngxDrawerMenu]", never, {}, {}, never, never, true, never>;
8
+ }
9
+
10
+ declare class NgxDrawerMenuToggle {
11
+ readonly hideOnBreakPoint: i0.InputSignal<boolean>;
12
+ protected readonly sideNav: ngx_kit_side_nav.NgxSideNav;
13
+ hide: i0.WritableSignal<boolean>;
14
+ constructor();
15
+ protected onClick(): void;
16
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxDrawerMenuToggle, never>;
17
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgxDrawerMenuToggle, "[ngxDrawerMenuToggle]", never, { "hideOnBreakPoint": { "alias": "hideOnBreakPoint"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
18
+ }
19
+
20
+ type NgxSideNavMode = 'push' | 'overlay';
21
+
22
+ declare const NGX_SIDE_NAV: InjectionToken<NgxSideNav>;
23
+ declare class NgxSideNav implements OnInit, OnDestroy {
24
+ readonly open: i0.ModelSignal<boolean>;
25
+ readonly width: i0.InputSignal<number>;
26
+ readonly breakpoint: i0.InputSignal<number | null>;
27
+ readonly mode: i0.InputSignal<NgxSideNavMode>;
28
+ shouldShowOverlay: i0.WritableSignal<boolean>;
29
+ private mediaQuery?;
30
+ readonly isMatchMediaQuery: i0.WritableSignal<boolean>;
31
+ private removeMediaQueryListener?;
32
+ protected readonly win: Window | null;
33
+ constructor();
34
+ ngOnInit(): void;
35
+ ngOnDestroy(): void;
36
+ initialize(): void;
37
+ setupMediaQuery(): void;
38
+ onResize(): void;
39
+ toggleMenu(): void;
40
+ closeMenu(): void;
41
+ openMenu(): void;
42
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxSideNav, never>;
43
+ static ɵcmp: i0.ɵɵComponentDeclaration<NgxSideNav, "ngx-side-nav", never, { "open": { "alias": "open"; "required": false; "isSignal": true; }; "width": { "alias": "width"; "required": false; "isSignal": true; }; "breakpoint": { "alias": "breakpoint"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; }, { "open": "openChange"; }, never, ["[ngxDrawerMenu]", "*"], true, never>;
44
+ }
45
+
46
+ declare class NgxSideNavModule {
47
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxSideNavModule, never>;
48
+ static ɵmod: i0.ɵɵNgModuleDeclaration<NgxSideNavModule, never, [typeof NgxDrawerMenu, typeof NgxDrawerMenuToggle, typeof NgxSideNav], [typeof NgxDrawerMenu, typeof NgxDrawerMenuToggle, typeof NgxSideNav]>;
49
+ static ɵinj: i0.ɵɵInjectorDeclaration<NgxSideNavModule>;
50
+ }
51
+
52
+ export { NGX_SIDE_NAV, NgxDrawerMenu, NgxDrawerMenuToggle, NgxSideNav, NgxSideNavModule };
53
+ export type { NgxSideNavMode };