@mk-kit/ui 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +115 -0
- package/block-editor/README.md +254 -0
- package/fesm2022/mk-kit-ui-block-editor.mjs +2158 -0
- package/fesm2022/mk-kit-ui-block-editor.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-button.mjs +81 -0
- package/fesm2022/mk-kit-ui-button.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-checkbox.mjs +136 -0
- package/fesm2022/mk-kit-ui-checkbox.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-chip.mjs +122 -0
- package/fesm2022/mk-kit-ui-chip.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-context-menu.mjs +144 -0
- package/fesm2022/mk-kit-ui-context-menu.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-core.mjs +1576 -0
- package/fesm2022/mk-kit-ui-core.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-data.mjs +6055 -0
- package/fesm2022/mk-kit-ui-data.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-datetime.mjs +3409 -0
- package/fesm2022/mk-kit-ui-datetime.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-directives.mjs +1779 -0
- package/fesm2022/mk-kit-ui-directives.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-dnd.mjs +1073 -0
- package/fesm2022/mk-kit-ui-dnd.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-feedback.mjs +2426 -0
- package/fesm2022/mk-kit-ui-feedback.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-forms.mjs +9208 -0
- package/fesm2022/mk-kit-ui-forms.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-icon.mjs +470 -0
- package/fesm2022/mk-kit-ui-icon.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-media.mjs +896 -0
- package/fesm2022/mk-kit-ui-media.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-navigation.mjs +2542 -0
- package/fesm2022/mk-kit-ui-navigation.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-rich-text.mjs +565 -0
- package/fesm2022/mk-kit-ui-rich-text.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-table.mjs +1378 -0
- package/fesm2022/mk-kit-ui-table.mjs.map +1 -0
- package/fesm2022/mk-kit-ui.mjs +32 -0
- package/fesm2022/mk-kit-ui.mjs.map +1 -0
- package/package.json +130 -0
- package/schematics/collection.json +10 -0
- package/schematics/ng-add/index.js +113 -0
- package/schematics/ng-add/schema.json +22 -0
- package/schematics/package.json +3 -0
- package/styles/mk-kit.css +750 -0
- package/types/mk-kit-ui-block-editor.d.ts +292 -0
- package/types/mk-kit-ui-button.d.ts +40 -0
- package/types/mk-kit-ui-checkbox.d.ts +62 -0
- package/types/mk-kit-ui-chip.d.ts +59 -0
- package/types/mk-kit-ui-context-menu.d.ts +57 -0
- package/types/mk-kit-ui-core.d.ts +1105 -0
- package/types/mk-kit-ui-data.d.ts +2580 -0
- package/types/mk-kit-ui-datetime.d.ts +1171 -0
- package/types/mk-kit-ui-directives.d.ts +807 -0
- package/types/mk-kit-ui-dnd.d.ts +423 -0
- package/types/mk-kit-ui-feedback.d.ts +1270 -0
- package/types/mk-kit-ui-forms.d.ts +3586 -0
- package/types/mk-kit-ui-icon.d.ts +108 -0
- package/types/mk-kit-ui-media.d.ts +549 -0
- package/types/mk-kit-ui-navigation.d.ts +1169 -0
- package/types/mk-kit-ui-rich-text.d.ts +187 -0
- package/types/mk-kit-ui-table.d.ts +739 -0
- package/types/mk-kit-ui.d.ts +17 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import * as _angular_platform_browser from '@angular/platform-browser';
|
|
2
|
+
import { SafeHtml } from '@angular/platform-browser';
|
|
3
|
+
import * as _angular_core from '@angular/core';
|
|
4
|
+
import { EnvironmentProviders } from '@angular/core';
|
|
5
|
+
import { MkSize } from '@mk-kit/ui/core';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Icon — renders a registered SVG by `name`, or your own projected `<svg>`.
|
|
9
|
+
* The glyph inherits the current text colour (`currentColor`) and scales to the
|
|
10
|
+
* `size` box, so it composes cleanly inside buttons, inputs and menus.
|
|
11
|
+
*
|
|
12
|
+
* Decorative by default (`aria-hidden`); pass `label` to expose it as an image
|
|
13
|
+
* to assistive tech.
|
|
14
|
+
*
|
|
15
|
+
* ```html
|
|
16
|
+
* <mk-icon name="search" />
|
|
17
|
+
* <mk-icon name="trash" size="lg" label="Delete" />
|
|
18
|
+
* <button mkButton iconOnly aria-label="Menu"><mk-icon name="menu" /></button>
|
|
19
|
+
* <mk-icon><svg viewBox="0 0 24 24">…custom…</svg></mk-icon>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
declare class MkIcon {
|
|
23
|
+
private readonly registry;
|
|
24
|
+
/** Name of a registered icon (see {@link MkIconRegistry}). */
|
|
25
|
+
readonly name: _angular_core.InputSignal<string>;
|
|
26
|
+
/** Size: `sm`/`md`/`lg`, or a pixel number for a custom dimension. */
|
|
27
|
+
readonly size: _angular_core.InputSignal<number | MkSize>;
|
|
28
|
+
/** Accessible name. When set the icon becomes `role="img"`; otherwise hidden. */
|
|
29
|
+
readonly label: _angular_core.InputSignal<string>;
|
|
30
|
+
/** CSS length for the icon box (width = height = font-size). */
|
|
31
|
+
protected readonly dimension: _angular_core.Signal<string>;
|
|
32
|
+
/** Sanitized SVG for the named icon, or `null` (falls back to projection). */
|
|
33
|
+
protected readonly svg: _angular_core.Signal<_angular_platform_browser.SafeHtml | null>;
|
|
34
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkIcon, never>;
|
|
35
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkIcon, "mk-icon", never, { "name": { "alias": "name"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* IconRegistry — the name → SVG store behind `<mk-icon name="…">`. The built-in
|
|
40
|
+
* {@link MK_DEFAULT_ICONS} set is registered on construction; add your own SVGs
|
|
41
|
+
* (from a sprite, a design export, anything) with {@link register} /
|
|
42
|
+
* {@link registerIcons}.
|
|
43
|
+
*
|
|
44
|
+
* SVG markup is trusted verbatim (bypassed through `DomSanitizer`), so only
|
|
45
|
+
* register icons from sources you control — never user input.
|
|
46
|
+
*
|
|
47
|
+
* ```ts
|
|
48
|
+
* const reg = inject(MkIconRegistry);
|
|
49
|
+
* reg.register('logo', '<svg viewBox="0 0 24 24">…</svg>');
|
|
50
|
+
* reg.registerIcons({ save: '<svg…>', share: '<svg…>' });
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
declare class MkIconRegistry {
|
|
54
|
+
private readonly sanitizer;
|
|
55
|
+
private readonly icons;
|
|
56
|
+
private readonly aliases;
|
|
57
|
+
constructor();
|
|
58
|
+
/** Register (or overwrite) a single named icon from raw SVG markup. */
|
|
59
|
+
register(name: string, svg: string): this;
|
|
60
|
+
/** Register many icons at once from a `{ name: svg }` map. */
|
|
61
|
+
registerIcons(icons: Readonly<Record<string, string>>): this;
|
|
62
|
+
/**
|
|
63
|
+
* Register alternative names that resolve to existing icons — e.g. map
|
|
64
|
+
* Material Symbols ligature names onto the built-in set
|
|
65
|
+
* (`{ delete: 'trash', expand_more: 'chevron-down' }`). A real icon
|
|
66
|
+
* registered under an alias name always wins over the alias.
|
|
67
|
+
*/
|
|
68
|
+
registerAliases(aliases: Readonly<Record<string, string>>): this;
|
|
69
|
+
/** Sanitized SVG for a name (aliases resolved), or `null` when unknown. */
|
|
70
|
+
get(name: string): SafeHtml | null;
|
|
71
|
+
/** Whether an icon with this name (or alias) is registered. */
|
|
72
|
+
has(name: string): boolean;
|
|
73
|
+
/** All registered icon names (useful for a picker / catalogue). */
|
|
74
|
+
names(): string[];
|
|
75
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkIconRegistry, never>;
|
|
76
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<MkIconRegistry>;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** Name → SVG markup map of the default icons. */
|
|
80
|
+
declare const MK_DEFAULT_ICONS: Readonly<Record<string, string>>;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Material Symbols ligature names → built-in mk icon names. Lets templates
|
|
84
|
+
* written against `<mat-icon>delete</mat-icon>` conventions keep their icon
|
|
85
|
+
* names when migrating: `<mk-icon name="delete" />` renders the `trash`
|
|
86
|
+
* glyph once {@link provideMkMaterialIcons} is installed.
|
|
87
|
+
*
|
|
88
|
+
* Several Material names intentionally collapse onto one mk glyph (all the
|
|
89
|
+
* calendar variants → `calendar`, the delete variants → `trash`, …). Names
|
|
90
|
+
* not listed here have no sensible built-in equivalent — register your own
|
|
91
|
+
* SVG under the Material name via `MkIconRegistry.register`.
|
|
92
|
+
*/
|
|
93
|
+
declare const MK_MATERIAL_ICON_ALIASES: Readonly<Record<string, string>>;
|
|
94
|
+
/**
|
|
95
|
+
* Installs the Material Symbols name aliases into the {@link MkIconRegistry},
|
|
96
|
+
* so `<mk-icon name="delete" />`, `name="expand_more"`, `name="visibility"`
|
|
97
|
+
* etc. resolve to the built-in set. Add it to your bootstrap providers when
|
|
98
|
+
* migrating an app off `<mat-icon>` ligatures:
|
|
99
|
+
*
|
|
100
|
+
* ```ts
|
|
101
|
+
* bootstrapApplication(App, {
|
|
102
|
+
* providers: [provideMkMaterialIcons()],
|
|
103
|
+
* });
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
declare function provideMkMaterialIcons(): EnvironmentProviders;
|
|
107
|
+
|
|
108
|
+
export { MK_DEFAULT_ICONS, MK_MATERIAL_ICON_ALIASES, MkIcon, MkIconRegistry, provideMkMaterialIcons };
|
|
@@ -0,0 +1,549 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { OnDestroy, TemplateRef } from '@angular/core';
|
|
3
|
+
import * as _mk_kit_ui_core from '@mk-kit/ui/core';
|
|
4
|
+
import { MkDropEvent } from '@mk-kit/ui/dnd';
|
|
5
|
+
|
|
6
|
+
/** How the picture is scaled inside its frame (`object-fit`). */
|
|
7
|
+
type MkImageFit = 'cover' | 'contain';
|
|
8
|
+
/** Corner rounding applied to the frame of an {@link MkImage}. */
|
|
9
|
+
type MkImageRounded = 'none' | 'md' | 'lg' | 'circle';
|
|
10
|
+
/** Load lifecycle of an {@link MkImage}. */
|
|
11
|
+
type MkImageState = 'loading' | 'loaded' | 'error';
|
|
12
|
+
/**
|
|
13
|
+
* Image — an enhanced image block. While the picture loads it shows a skeleton
|
|
14
|
+
* shimmer, and when loading fails it swaps to a localised fallback panel
|
|
15
|
+
* (icon + text, never colour alone). The picture is wrapped in a `<figure>`
|
|
16
|
+
* with an optional `<figcaption>`, and changing `src` restarts the whole load
|
|
17
|
+
* cycle.
|
|
18
|
+
*
|
|
19
|
+
* ```html
|
|
20
|
+
* <mk-image
|
|
21
|
+
* src="/photos/harbour.jpg"
|
|
22
|
+
* alt="Harbour at dawn"
|
|
23
|
+
* aspectRatio="16 / 9"
|
|
24
|
+
* caption="The old harbour, photographed at dawn"
|
|
25
|
+
* (loaded)="onLoaded()"
|
|
26
|
+
* (errored)="onErrored()"
|
|
27
|
+
* />
|
|
28
|
+
*
|
|
29
|
+
* <!-- The hero: eager, high priority, and sized per breakpoint so a phone
|
|
30
|
+
* does not download the desktop file. -->
|
|
31
|
+
* <mk-image
|
|
32
|
+
* src="/photos/hero-1600.jpg"
|
|
33
|
+
* srcset="/photos/hero-800.jpg 800w, /photos/hero-1600.jpg 1600w"
|
|
34
|
+
* sizes="100vw"
|
|
35
|
+
* alt=""
|
|
36
|
+
* aspectRatio="16 / 9"
|
|
37
|
+
* priority
|
|
38
|
+
* />
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* `aspectRatio` is what keeps this from shifting layout: the frame reserves
|
|
42
|
+
* its box before the picture arrives, so nothing below it moves.
|
|
43
|
+
*/
|
|
44
|
+
declare class MkImage {
|
|
45
|
+
/** Localised strings (override globally via `provideMkI18n`). */
|
|
46
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
47
|
+
/** Image URL. Changing it resets the block to its loading state. */
|
|
48
|
+
readonly src: _angular_core.InputSignal<string>;
|
|
49
|
+
/** Alt text, always reflected onto the `<img>`. Keep `''` for decorative images. */
|
|
50
|
+
readonly alt: _angular_core.InputSignal<string>;
|
|
51
|
+
/** Any CSS `aspect-ratio` value for the frame, e.g. `'1 / 1'` or `'16 / 9'`. */
|
|
52
|
+
readonly aspectRatio: _angular_core.InputSignal<string>;
|
|
53
|
+
/** How the picture fills the frame. */
|
|
54
|
+
readonly fit: _angular_core.InputSignal<MkImageFit>;
|
|
55
|
+
/** Corner rounding of the frame. */
|
|
56
|
+
readonly rounded: _angular_core.InputSignal<MkImageRounded>;
|
|
57
|
+
/** Caption rendered in a `<figcaption>` below the picture. */
|
|
58
|
+
readonly caption: _angular_core.InputSignal<string>;
|
|
59
|
+
/** Defer fetching until near the viewport (`loading="lazy"` vs `"eager"`). */
|
|
60
|
+
readonly lazy: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
61
|
+
/**
|
|
62
|
+
* Mark this as the page's LCP image: fetched eagerly at high priority and
|
|
63
|
+
* decoded synchronously, and `lazy` is ignored. Use it on exactly ONE image
|
|
64
|
+
* per page — the hero. Marking several is worse than marking none, because
|
|
65
|
+
* they then compete for the same bandwidth the real LCP image needs.
|
|
66
|
+
*
|
|
67
|
+
* This does NOT emit a `<link rel=preload>`; the tag has to be in the HTML
|
|
68
|
+
* the server sends to beat the preload scanner, which a component rendered
|
|
69
|
+
* later cannot guarantee. Pair it with a preload hint for a background or
|
|
70
|
+
* late-rendered hero.
|
|
71
|
+
*/
|
|
72
|
+
readonly priority: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
73
|
+
/**
|
|
74
|
+
* Responsive candidates, passed through verbatim to the `<img>`. Serving a
|
|
75
|
+
* 2048px file into a 600px slot is one of the most common LCP mistakes, and
|
|
76
|
+
* this is the fix; pair with {@link sizes}.
|
|
77
|
+
*/
|
|
78
|
+
readonly srcset: _angular_core.InputSignal<string>;
|
|
79
|
+
/** `sizes` attribute — how wide the image renders at each breakpoint. */
|
|
80
|
+
readonly sizes: _angular_core.InputSignal<string>;
|
|
81
|
+
/** Emits once the picture has finished loading. */
|
|
82
|
+
readonly loaded: _angular_core.OutputEmitterRef<void>;
|
|
83
|
+
/** Emits when the picture fails to load and the fallback panel is shown. */
|
|
84
|
+
readonly errored: _angular_core.OutputEmitterRef<void>;
|
|
85
|
+
/** `loading` attribute: priority always wins over `lazy`. */
|
|
86
|
+
protected readonly loadingAttr: _angular_core.Signal<"eager" | "lazy">;
|
|
87
|
+
/** Load lifecycle; snaps back to `'loading'` whenever `src` changes. */
|
|
88
|
+
protected readonly state: _angular_core.WritableSignal<MkImageState>;
|
|
89
|
+
protected onLoad(): void;
|
|
90
|
+
protected onError(): void;
|
|
91
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkImage, never>;
|
|
92
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkImage, "mk-image", ["mkImage"], { "src": { "alias": "src"; "required": true; "isSignal": true; }; "alt": { "alias": "alt"; "required": false; "isSignal": true; }; "aspectRatio": { "alias": "aspectRatio"; "required": false; "isSignal": true; }; "fit": { "alias": "fit"; "required": false; "isSignal": true; }; "rounded": { "alias": "rounded"; "required": false; "isSignal": true; }; "caption": { "alias": "caption"; "required": false; "isSignal": true; }; "lazy": { "alias": "lazy"; "required": false; "isSignal": true; }; "priority": { "alias": "priority"; "required": false; "isSignal": true; }; "srcset": { "alias": "srcset"; "required": false; "isSignal": true; }; "sizes": { "alias": "sizes"; "required": false; "isSignal": true; }; }, { "loaded": "loaded"; "errored": "errored"; }, never, never, true, never>;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** A single image shown by {@link MkLightboxService}. */
|
|
96
|
+
interface MkLightboxItem {
|
|
97
|
+
/** Image URL. */
|
|
98
|
+
src: string;
|
|
99
|
+
/** Alternative text for the image. */
|
|
100
|
+
alt?: string;
|
|
101
|
+
/** Optional caption rendered below the image. */
|
|
102
|
+
caption?: string;
|
|
103
|
+
}
|
|
104
|
+
/** Data injected into {@link MkLightbox} via `MK_OVERLAY_DATA`. */
|
|
105
|
+
interface MkLightboxData {
|
|
106
|
+
/** The images to page through. */
|
|
107
|
+
items: readonly MkLightboxItem[];
|
|
108
|
+
/** Index of the image shown first (already clamped into range). */
|
|
109
|
+
startIndex: number;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Fullscreen image lightbox — opens a set of images in a modal overlay with
|
|
113
|
+
* looping previous/next navigation, captions, a counter, keyboard support
|
|
114
|
+
* (Arrow keys, Home/End, Escape) and focus trapping, all powered by
|
|
115
|
+
* {@link MkOverlayService}.
|
|
116
|
+
*
|
|
117
|
+
* ```ts
|
|
118
|
+
* private readonly lightbox = inject(MkLightboxService);
|
|
119
|
+
*
|
|
120
|
+
* viewPhoto(index: number): void {
|
|
121
|
+
* this.lightbox.open(
|
|
122
|
+
* [
|
|
123
|
+
* { src: '/photos/1.jpg', alt: 'Harbour at dawn', caption: 'Dawn' },
|
|
124
|
+
* { src: '/photos/2.jpg', alt: 'Old town square' },
|
|
125
|
+
* ],
|
|
126
|
+
* index,
|
|
127
|
+
* );
|
|
128
|
+
* }
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
declare class MkLightboxService {
|
|
132
|
+
private readonly overlay;
|
|
133
|
+
private readonly i18n;
|
|
134
|
+
/**
|
|
135
|
+
* Open the lightbox over the page. Does nothing when `items` is empty.
|
|
136
|
+
* `startIndex` is clamped into `[0, items.length - 1]`.
|
|
137
|
+
*/
|
|
138
|
+
open(items: readonly MkLightboxItem[], startIndex?: number): void;
|
|
139
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkLightboxService, never>;
|
|
140
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<MkLightboxService>;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Internal overlay component backing {@link MkLightboxService}. Renders the
|
|
145
|
+
* current image near-fullscreen over the overlay scrim with a caption bar,
|
|
146
|
+
* an `imageOf` counter, a close button and looping previous/next navigation.
|
|
147
|
+
*
|
|
148
|
+
* Keyboard: `ArrowLeft`/`ArrowRight` navigate, `Home`/`End` jump to the first
|
|
149
|
+
* or last image. `Escape` and backdrop clicks are handled by the overlay
|
|
150
|
+
* itself (`closeOnEscape` / `closeOnBackdropClick`), so they are deliberately
|
|
151
|
+
* not re-handled here.
|
|
152
|
+
*
|
|
153
|
+
* Open it via the service — not by placing `<mk-lightbox>` in a template:
|
|
154
|
+
*
|
|
155
|
+
* ```ts
|
|
156
|
+
* inject(MkLightboxService).open(items, 2);
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
declare class MkLightbox {
|
|
160
|
+
private readonly ref;
|
|
161
|
+
private readonly data;
|
|
162
|
+
/** Localised strings (override globally via `provideMkI18n`). */
|
|
163
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
164
|
+
/** The images being paged through. */
|
|
165
|
+
protected readonly items: readonly MkLightboxItem[];
|
|
166
|
+
/** Total number of images. */
|
|
167
|
+
protected readonly total: number;
|
|
168
|
+
/** Index of the currently displayed image. */
|
|
169
|
+
protected readonly index: _angular_core.WritableSignal<number>;
|
|
170
|
+
/** The currently displayed item. */
|
|
171
|
+
protected readonly current: _angular_core.Signal<MkLightboxItem>;
|
|
172
|
+
/** Localised "Image i of n" counter text. */
|
|
173
|
+
protected readonly counter: _angular_core.Signal<string>;
|
|
174
|
+
/** `true` while the current image is still loading. */
|
|
175
|
+
protected readonly loading: _angular_core.WritableSignal<boolean>;
|
|
176
|
+
/** `true` when the current image failed to load. */
|
|
177
|
+
protected readonly failed: _angular_core.WritableSignal<boolean>;
|
|
178
|
+
/** Show the previous image, wrapping from the first to the last. */
|
|
179
|
+
protected previous(): void;
|
|
180
|
+
/** Show the next image, wrapping from the last back to the first. */
|
|
181
|
+
protected next(): void;
|
|
182
|
+
/** Jump to `index`, resetting the loading/error state. */
|
|
183
|
+
protected goTo(index: number): void;
|
|
184
|
+
/** Close the surrounding overlay. */
|
|
185
|
+
protected close(): void;
|
|
186
|
+
/** Current image finished loading — hide the spinner. */
|
|
187
|
+
protected onLoad(): void;
|
|
188
|
+
/** Current image failed — show the localised failure message instead. */
|
|
189
|
+
protected onError(): void;
|
|
190
|
+
/**
|
|
191
|
+
* Host keydown handler. Escape is intentionally not handled here — the
|
|
192
|
+
* overlay's `closeOnEscape` already closes the lightbox.
|
|
193
|
+
*/
|
|
194
|
+
protected onKeydown(event: Event): void;
|
|
195
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkLightbox, never>;
|
|
196
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkLightbox, "mk-lightbox", never, {}, {}, never, never, true, never>;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/** A single picture inside an {@link MkImageGallery}. */
|
|
200
|
+
interface MkGalleryItem {
|
|
201
|
+
/** Full-size image URL (what the lightbox opens). */
|
|
202
|
+
src: string;
|
|
203
|
+
/** Optional smaller thumbnail URL for the tile; falls back to `src`. */
|
|
204
|
+
thumb?: string;
|
|
205
|
+
/** Alt text; also drives the tile's accessible label. */
|
|
206
|
+
alt?: string;
|
|
207
|
+
/** Optional caption forwarded to the lightbox. */
|
|
208
|
+
caption?: string;
|
|
209
|
+
}
|
|
210
|
+
/** Tile arrangement of an {@link MkImageGallery}. */
|
|
211
|
+
type MkImageGalleryLayout = 'grid' | 'masonry' | 'strip';
|
|
212
|
+
/** Payload of the {@link MkImageGallery.itemClick} output. */
|
|
213
|
+
interface MkGalleryItemClick {
|
|
214
|
+
/** The clicked picture. */
|
|
215
|
+
item: MkGalleryItem;
|
|
216
|
+
/** Its index within `items`. */
|
|
217
|
+
index: number;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Image gallery — a wall of clickable picture tiles built on {@link MkImage}.
|
|
221
|
+
* Choose a uniform `grid`, a natural-ratio `masonry` flow, or a snap-scrolling
|
|
222
|
+
* horizontal `strip`. Clicking a tile opens the shared {@link MkLightboxService}
|
|
223
|
+
* at that picture (full-size `src`, not the thumb) and always emits
|
|
224
|
+
* `itemClick`. With `max` set, only the first `max` tiles render and the last
|
|
225
|
+
* one carries a "+N" overflow scrim that opens the rest in the lightbox.
|
|
226
|
+
*
|
|
227
|
+
* ```html
|
|
228
|
+
* <mk-image-gallery
|
|
229
|
+
* [items]="[
|
|
230
|
+
* { src: '/photos/1.jpg', thumb: '/thumbs/1.jpg', alt: 'Harbour at dawn' },
|
|
231
|
+
* { src: '/photos/2.jpg', alt: 'Old town square', caption: 'Kraków' },
|
|
232
|
+
* ]"
|
|
233
|
+
* [columns]="4"
|
|
234
|
+
* [max]="8"
|
|
235
|
+
* aspectRatio="4 / 3"
|
|
236
|
+
* (itemClick)="onItemClick($event)"
|
|
237
|
+
* />
|
|
238
|
+
* ```
|
|
239
|
+
*/
|
|
240
|
+
declare class MkImageGallery {
|
|
241
|
+
private readonly lightboxService;
|
|
242
|
+
/** Localised strings (override globally via `provideMkI18n`). */
|
|
243
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
244
|
+
/** Pictures to show. */
|
|
245
|
+
readonly items: _angular_core.InputSignal<readonly MkGalleryItem[]>;
|
|
246
|
+
/** Tile arrangement. */
|
|
247
|
+
readonly layout: _angular_core.InputSignal<MkImageGalleryLayout>;
|
|
248
|
+
/** Grid/masonry column count; also sets the visible tile count of a strip. */
|
|
249
|
+
readonly columns: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
250
|
+
/** When set, show only the first `max` tiles plus a "+N" overflow tile. */
|
|
251
|
+
readonly max: _angular_core.InputSignal<number | null>;
|
|
252
|
+
/** Open the shared lightbox on tile click. */
|
|
253
|
+
readonly lightbox: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
254
|
+
/** CSS aspect-ratio of grid/strip tiles (masonry keeps natural ratios). */
|
|
255
|
+
readonly aspectRatio: _angular_core.InputSignal<string>;
|
|
256
|
+
/** Corner rounding of the tiles. */
|
|
257
|
+
readonly rounded: _angular_core.InputSignal<MkImageRounded>;
|
|
258
|
+
/** Emits on every tile click (also when the lightbox opens). */
|
|
259
|
+
readonly itemClick: _angular_core.OutputEmitterRef<MkGalleryItemClick>;
|
|
260
|
+
/** Tiles actually rendered — the first `max` when `max` is set. */
|
|
261
|
+
protected readonly visibleItems: _angular_core.Signal<readonly MkGalleryItem[]>;
|
|
262
|
+
/** How many pictures the trailing "+N" tile stands for (0 = no overflow). */
|
|
263
|
+
protected readonly overflowCount: _angular_core.Signal<number>;
|
|
264
|
+
/** Frame ratio forwarded to the tiles (`'auto'` in masonry). */
|
|
265
|
+
protected readonly tileAspectRatio: _angular_core.Signal<string>;
|
|
266
|
+
/**
|
|
267
|
+
* Accessible label of tile `index`: `viewImage(alt)` when the picture has
|
|
268
|
+
* alt text, else positional `imageOf(...)`; the overflow tile appends "+N".
|
|
269
|
+
*/
|
|
270
|
+
protected tileLabel(index: number): string;
|
|
271
|
+
protected onTileClick(index: number): void;
|
|
272
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkImageGallery, never>;
|
|
273
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkImageGallery, "mk-image-gallery", ["mkImageGallery"], { "items": { "alias": "items"; "required": true; "isSignal": true; }; "layout": { "alias": "layout"; "required": false; "isSignal": true; }; "columns": { "alias": "columns"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "lightbox": { "alias": "lightbox"; "required": false; "isSignal": true; }; "aspectRatio": { "alias": "aspectRatio"; "required": false; "isSignal": true; }; "rounded": { "alias": "rounded"; "required": false; "isSignal": true; }; }, { "itemClick": "itemClick"; }, never, never, true, never>;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Base cover scale for an image in a viewport — the smallest scale at which
|
|
278
|
+
* `imgW × imgH` fully covers `vpW × vpH` (object-fit: cover). Returns `1`
|
|
279
|
+
* for degenerate (non-positive) dimensions.
|
|
280
|
+
*/
|
|
281
|
+
declare function mkCoverScale(imgW: number, imgH: number, vpW: number, vpH: number): number;
|
|
282
|
+
/**
|
|
283
|
+
* Clamp a pan offset (CSS px, measured from the viewport centre to the image
|
|
284
|
+
* centre) so the image scaled by `scale` still covers the viewport — no empty
|
|
285
|
+
* edges. When the scaled image is not larger than the viewport on an axis the
|
|
286
|
+
* offset collapses to `0` (centred).
|
|
287
|
+
*/
|
|
288
|
+
declare function mkClampPan(x: number, y: number, imgW: number, imgH: number, vpW: number, vpH: number, scale: number): {
|
|
289
|
+
x: number;
|
|
290
|
+
y: number;
|
|
291
|
+
};
|
|
292
|
+
/**
|
|
293
|
+
* Source rect (in natural image pixels) of the crop region visible through
|
|
294
|
+
* the viewport. `scale` maps natural pixels to CSS pixels (cover scale ×
|
|
295
|
+
* zoom); `panX`/`panY` are the CSS-px offsets of the image centre from the
|
|
296
|
+
* viewport centre. The rect is clamped inside the image bounds.
|
|
297
|
+
*/
|
|
298
|
+
declare function mkCropRect(imgNaturalW: number, imgNaturalH: number, vpW: number, vpH: number, scale: number, panX: number, panY: number): {
|
|
299
|
+
sx: number;
|
|
300
|
+
sy: number;
|
|
301
|
+
sw: number;
|
|
302
|
+
sh: number;
|
|
303
|
+
};
|
|
304
|
+
type CropStatus = 'loading' | 'loaded' | 'error';
|
|
305
|
+
/**
|
|
306
|
+
* ImageCropper — pan-and-zoom crop control for avatars, covers and media uploads.
|
|
307
|
+
* The image covers a fixed-aspect viewport (object-fit-cover style); the user
|
|
308
|
+
* drags to pan, scrolls / pinch-zooms via the slider or `+`/`−` controls, and
|
|
309
|
+
* `crop()` renders the visible region to a data-URL on an offscreen canvas.
|
|
310
|
+
*
|
|
311
|
+
* Pan is always clamped so the image keeps covering the viewport, a
|
|
312
|
+
* rule-of-thirds grid appears while dragging, and `round` overlays a circular
|
|
313
|
+
* scrim for avatar crops (the exported bitmap stays rectangular). The crop
|
|
314
|
+
* area is keyboard operable: Arrow keys pan by 10px (1px with Shift), `+`/`-`
|
|
315
|
+
* zoom.
|
|
316
|
+
*
|
|
317
|
+
* ```html
|
|
318
|
+
* <mk-image-cropper #cropper src="/assets/photo.jpg" [aspect]="1" round />
|
|
319
|
+
* <button mkButton (click)="avatar = cropper.crop({ size: 512 })">Save</button>
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
322
|
+
declare class MkImageCropper implements OnDestroy {
|
|
323
|
+
private readonly isBrowser;
|
|
324
|
+
/** Localised strings (override globally via `provideMkI18n`). */
|
|
325
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
326
|
+
private readonly viewportRef;
|
|
327
|
+
private readonly imageRef;
|
|
328
|
+
/** Image URL or data-URL to crop. */
|
|
329
|
+
readonly src: _angular_core.InputSignal<string>;
|
|
330
|
+
/**
|
|
331
|
+
* Aspect ratio (width / height) of the crop viewport, e.g. `1` for a
|
|
332
|
+
* square or `16 / 9`. `null` makes the viewport fill its container.
|
|
333
|
+
*/
|
|
334
|
+
readonly aspect: _angular_core.InputSignal<number | null>;
|
|
335
|
+
/**
|
|
336
|
+
* Circular mask overlay for avatar crops. Purely visual — the exported
|
|
337
|
+
* bitmap from `crop()` stays rectangular.
|
|
338
|
+
*/
|
|
339
|
+
readonly round: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
340
|
+
/** Lowest allowed zoom factor. */
|
|
341
|
+
readonly minZoom: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
342
|
+
/** Highest allowed zoom factor. */
|
|
343
|
+
readonly maxZoom: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
344
|
+
/** Disable panning and zooming. */
|
|
345
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
346
|
+
/**
|
|
347
|
+
* `crossorigin` for the internal `<img>`. Set to `'anonymous'` when
|
|
348
|
+
* cropping CORS-enabled remote images — without it the canvas is tainted
|
|
349
|
+
* and `crop()` returns `null`. Same-origin and data-URL sources don't
|
|
350
|
+
* need it.
|
|
351
|
+
*/
|
|
352
|
+
readonly crossOrigin: _angular_core.InputSignal<"anonymous" | "use-credentials" | null>;
|
|
353
|
+
/** Accessible name for the crop area (defaults to the i18n `zoom` label). */
|
|
354
|
+
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
355
|
+
/** Emits on any pan or zoom change. */
|
|
356
|
+
readonly changed: _angular_core.OutputEmitterRef<void>;
|
|
357
|
+
/** Emits when the image fails to load. */
|
|
358
|
+
readonly imageError: _angular_core.OutputEmitterRef<void>;
|
|
359
|
+
/** Two-way zoom factor, clamped to `[minZoom, maxZoom]`. */
|
|
360
|
+
readonly zoom: _angular_core.ModelSignal<number>;
|
|
361
|
+
private readonly natW;
|
|
362
|
+
private readonly natH;
|
|
363
|
+
private readonly vpW;
|
|
364
|
+
private readonly vpH;
|
|
365
|
+
private readonly panX;
|
|
366
|
+
private readonly panY;
|
|
367
|
+
protected readonly status: _angular_core.WritableSignal<CropStatus>;
|
|
368
|
+
protected readonly dragging: _angular_core.WritableSignal<boolean>;
|
|
369
|
+
private dragStart;
|
|
370
|
+
private resizeObserver?;
|
|
371
|
+
private readonly coverScale;
|
|
372
|
+
private readonly totalScale;
|
|
373
|
+
/** CSS transform applied to the image element. */
|
|
374
|
+
protected readonly imageTransform: _angular_core.Signal<string>;
|
|
375
|
+
constructor();
|
|
376
|
+
ngOnDestroy(): void;
|
|
377
|
+
/** Centre the image and reset zoom to 1 (clamped to `minZoom`). */
|
|
378
|
+
reset(): void;
|
|
379
|
+
/**
|
|
380
|
+
* Draw the visible crop region to an offscreen canvas and return it as a
|
|
381
|
+
* data-URL (longest edge capped at `options.size ?? 1024`). Returns `null`
|
|
382
|
+
* when the image is not loaded or the canvas is unavailable (SSR, jsdom).
|
|
383
|
+
*/
|
|
384
|
+
/**
|
|
385
|
+
* The visible crop region in natural image pixels — what `crop()` would
|
|
386
|
+
* rasterise, without touching a canvas. Use it when the backend performs
|
|
387
|
+
* the actual crop from the master image (no client-side quality loss).
|
|
388
|
+
* Returns `null` until the image has loaded and the viewport is measured.
|
|
389
|
+
*/
|
|
390
|
+
cropRect(): {
|
|
391
|
+
sx: number;
|
|
392
|
+
sy: number;
|
|
393
|
+
sw: number;
|
|
394
|
+
sh: number;
|
|
395
|
+
} | null;
|
|
396
|
+
crop(options?: {
|
|
397
|
+
type?: string;
|
|
398
|
+
quality?: number;
|
|
399
|
+
size?: number;
|
|
400
|
+
}): string | null;
|
|
401
|
+
protected onImageLoad(event: Event): void;
|
|
402
|
+
protected onImageError(): void;
|
|
403
|
+
protected onPointerDown(event: PointerEvent): void;
|
|
404
|
+
protected onPointerMove(event: PointerEvent): void;
|
|
405
|
+
protected onPointerUp(): void;
|
|
406
|
+
private readonly onWheel;
|
|
407
|
+
protected onRangeInput(event: Event): void;
|
|
408
|
+
protected stepZoom(direction: 1 | -1): void;
|
|
409
|
+
/**
|
|
410
|
+
* Zoom towards the viewport centre: the pan offset scales with the zoom
|
|
411
|
+
* ratio so the image point at the centre stays put, then re-clamps.
|
|
412
|
+
*/
|
|
413
|
+
protected zoomTo(next: number): void;
|
|
414
|
+
protected onKeydown(event: KeyboardEvent): void;
|
|
415
|
+
private clampZoom;
|
|
416
|
+
private panTo;
|
|
417
|
+
/** Capture the viewport's CSS size (initial render + every resize). */
|
|
418
|
+
private measure;
|
|
419
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkImageCropper, never>;
|
|
420
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkImageCropper, "mk-image-cropper", ["mkImageCropper"], { "src": { "alias": "src"; "required": true; "isSignal": true; }; "aspect": { "alias": "aspect"; "required": false; "isSignal": true; }; "round": { "alias": "round"; "required": false; "isSignal": true; }; "minZoom": { "alias": "minZoom"; "required": false; "isSignal": true; }; "maxZoom": { "alias": "maxZoom"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "crossOrigin": { "alias": "crossOrigin"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "zoom": { "alias": "zoom"; "required": false; "isSignal": true; }; }, { "changed": "changed"; "imageError": "imageError"; "zoom": "zoomChange"; }, never, never, true, never>;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/** A single asset displayed as a tile in {@link MkMediaGallery}. */
|
|
424
|
+
interface MkMediaItem {
|
|
425
|
+
/** Stable identity used for tracking, selection and reorder events. */
|
|
426
|
+
id: string;
|
|
427
|
+
/** Full-size image URL (used for the thumbnail when `thumb` is omitted). */
|
|
428
|
+
src: string;
|
|
429
|
+
/** Optional dedicated thumbnail URL shown in the grid. */
|
|
430
|
+
thumb?: string;
|
|
431
|
+
/** Display name shown under the thumbnail; also names the selection checkbox. */
|
|
432
|
+
name: string;
|
|
433
|
+
/** Alternative text describing the image; falls back to `name` for labels. */
|
|
434
|
+
alt?: string;
|
|
435
|
+
/** Optional caption/meta line shown under the name (e.g. "1.2 MB · JPG"). */
|
|
436
|
+
meta?: string;
|
|
437
|
+
}
|
|
438
|
+
/** Emitted by {@link MkMediaGallery} after a tile has been reordered. */
|
|
439
|
+
interface MkMediaReorderEvent {
|
|
440
|
+
/** Index the item was dragged from. */
|
|
441
|
+
from: number;
|
|
442
|
+
/** Index the item was dropped at. */
|
|
443
|
+
to: number;
|
|
444
|
+
/** The full item array after the move (same reference as the updated model). */
|
|
445
|
+
items: MkMediaItem[];
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Marks an `<ng-template>` as the per-tile action bar for {@link MkMediaGallery}.
|
|
449
|
+
* The template's implicit context is the {@link MkMediaItem}, so consumers can
|
|
450
|
+
* destructure it with `let-item`. The gallery renders it into each tile's
|
|
451
|
+
* top-right action bar (revealed on hover / focus-within, always visible on
|
|
452
|
+
* touch devices); the consumer supplies the buttons and their handlers.
|
|
453
|
+
*
|
|
454
|
+
* ```html
|
|
455
|
+
* <mk-media-gallery [items]="assets()">
|
|
456
|
+
* <ng-template mkMediaActions let-item>
|
|
457
|
+
* <button mkButton size="sm" variant="ghost" (click)="edit(item)">Edit</button>
|
|
458
|
+
* </ng-template>
|
|
459
|
+
* </mk-media-gallery>
|
|
460
|
+
* ```
|
|
461
|
+
*/
|
|
462
|
+
declare class MkMediaActions {
|
|
463
|
+
/** The projected action-bar template, rendered once per tile. */
|
|
464
|
+
readonly template: TemplateRef<{
|
|
465
|
+
$implicit: MkMediaItem;
|
|
466
|
+
}>;
|
|
467
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkMediaActions, never>;
|
|
468
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MkMediaActions, "[mkMediaActions]", never, {}, {}, never, never, true, never>;
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Media gallery — a management grid of image tiles for admin media libraries.
|
|
472
|
+
* Each tile shows a square thumbnail (a labelled preview button emitting
|
|
473
|
+
* {@link itemClick}), the item's name and optional meta line, an optional
|
|
474
|
+
* selection checkbox (two-way `selection` model of selected ids) and an
|
|
475
|
+
* optional consumer-projected action bar ({@link MkMediaActions}).
|
|
476
|
+
*
|
|
477
|
+
* With `reorderable`, tiles become draggable via the dnd group's
|
|
478
|
+
* `[mkDropList]` / `[mkDrag]` directives — pointer and keyboard dragging
|
|
479
|
+
* (WCAG 2.1.1) both included. Each drop immutably updates the two-way `items`
|
|
480
|
+
* model and emits {@link reordered}.
|
|
481
|
+
*
|
|
482
|
+
* Clicking a tile always means "open/preview" — selection only toggles through
|
|
483
|
+
* the checkbox, never on tile click.
|
|
484
|
+
*
|
|
485
|
+
* ```html
|
|
486
|
+
* <mk-media-gallery
|
|
487
|
+
* [(items)]="assets"
|
|
488
|
+
* [(selection)]="selectedIds"
|
|
489
|
+
* selectable
|
|
490
|
+
* reorderable
|
|
491
|
+
* [columns]="5"
|
|
492
|
+
* (itemClick)="openPreview($event)"
|
|
493
|
+
* (reordered)="persistOrder($event)"
|
|
494
|
+
* >
|
|
495
|
+
* <ng-template mkMediaActions let-item>
|
|
496
|
+
* <button mkButton size="sm" variant="ghost" (click)="edit(item)">Edit</button>
|
|
497
|
+
* <button mkButton size="sm" variant="ghost" tone="danger" (click)="remove(item)">
|
|
498
|
+
* Delete
|
|
499
|
+
* </button>
|
|
500
|
+
* </ng-template>
|
|
501
|
+
* </mk-media-gallery>
|
|
502
|
+
* ```
|
|
503
|
+
*/
|
|
504
|
+
declare class MkMediaGallery {
|
|
505
|
+
/** Localized strings (region label, checkbox/preview labels, empty state). */
|
|
506
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
507
|
+
/** The gallery's items (two-way). Replaced immutably on every reorder drop. */
|
|
508
|
+
readonly items: _angular_core.ModelSignal<MkMediaItem[]>;
|
|
509
|
+
/** Ids of the currently selected items (two-way). */
|
|
510
|
+
readonly selection: _angular_core.ModelSignal<string[]>;
|
|
511
|
+
/** Show a selection checkbox on every tile. */
|
|
512
|
+
readonly selectable: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
513
|
+
/** Allow drag-and-drop (pointer + keyboard) reordering of the tiles. */
|
|
514
|
+
readonly reorderable: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
515
|
+
/** Number of grid columns. */
|
|
516
|
+
readonly columns: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
517
|
+
/** Accessible name of the gallery region. Defaults to `i18n.mediaLibrary`. */
|
|
518
|
+
readonly ariaLabel: _angular_core.InputSignal<string>;
|
|
519
|
+
/** Emitted when a tile's preview button is activated (click/Enter/Space). */
|
|
520
|
+
readonly itemClick: _angular_core.OutputEmitterRef<MkMediaItem>;
|
|
521
|
+
/** Emitted after a drop has updated the `items` model. */
|
|
522
|
+
readonly reordered: _angular_core.OutputEmitterRef<MkMediaReorderEvent>;
|
|
523
|
+
/** Optional consumer-projected per-tile action bar (`$implicit` = item). */
|
|
524
|
+
protected readonly actions: _angular_core.Signal<MkMediaActions | undefined>;
|
|
525
|
+
/** Whether the item with `id` is currently selected. */
|
|
526
|
+
protected isSelected(id: string): boolean;
|
|
527
|
+
/** Sync the two-way `selection` model with the checkbox's native state. */
|
|
528
|
+
protected onCheckboxChange(item: MkMediaItem, event: Event): void;
|
|
529
|
+
/** Emit {@link itemClick} for the tile's preview button. */
|
|
530
|
+
protected onPreviewClick(item: MkMediaItem): void;
|
|
531
|
+
/**
|
|
532
|
+
* Apply a drop from the dnd module: move the item on a copy of `items`,
|
|
533
|
+
* write the copy back to the two-way model and emit {@link reordered}.
|
|
534
|
+
*/
|
|
535
|
+
protected onDrop(event: MkDropEvent<MkMediaItem>): void;
|
|
536
|
+
/**
|
|
537
|
+
* Keep events from the tile's nested controls (checkbox, action buttons)
|
|
538
|
+
* inside those controls: without this, Space/Enter on the checkbox or an
|
|
539
|
+
* action button would bubble to the surrounding `[mkDrag]` host and pick the
|
|
540
|
+
* tile up instead, and a pointer press would start a drag session. Native
|
|
541
|
+
* behavior is untouched — only propagation stops.
|
|
542
|
+
*/
|
|
543
|
+
protected stopEvent(event: Event): void;
|
|
544
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkMediaGallery, never>;
|
|
545
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkMediaGallery, "mk-media-gallery", ["mkMediaGallery"], { "items": { "alias": "items"; "required": false; "isSignal": true; }; "selection": { "alias": "selection"; "required": false; "isSignal": true; }; "selectable": { "alias": "selectable"; "required": false; "isSignal": true; }; "reorderable": { "alias": "reorderable"; "required": false; "isSignal": true; }; "columns": { "alias": "columns"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; }, { "items": "itemsChange"; "selection": "selectionChange"; "itemClick": "itemClick"; "reordered": "reordered"; }, ["actions"], never, true, never>;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
export { MkImage, MkImageCropper, MkImageGallery, MkLightbox, MkLightboxService, MkMediaActions, MkMediaGallery, mkClampPan, mkCoverScale, mkCropRect };
|
|
549
|
+
export type { MkGalleryItem, MkGalleryItemClick, MkImageFit, MkImageGalleryLayout, MkImageRounded, MkImageState, MkLightboxData, MkLightboxItem, MkMediaItem, MkMediaReorderEvent };
|