kirby-types 1.4.7 → 1.4.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.
- package/package.json +8 -8
- package/src/panel/api.d.ts +42 -38
- package/src/panel/base.d.ts +42 -54
- package/src/panel/features.d.ts +139 -114
- package/src/panel/helpers.d.ts +90 -68
- package/src/panel/index.d.ts +131 -23
- package/src/panel/libraries.d.ts +45 -66
- package/src/panel/textarea.d.ts +18 -50
- package/src/panel/writer.d.ts +66 -35
package/src/panel/helpers.d.ts
CHANGED
|
@@ -11,9 +11,7 @@
|
|
|
11
11
|
// Array Helpers
|
|
12
12
|
// -----------------------------------------------------------------------------
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
* Search options for array filtering.
|
|
16
|
-
*/
|
|
14
|
+
/** Search options for array filtering. */
|
|
17
15
|
export interface PanelArraySearchOptions {
|
|
18
16
|
/** Minimum query length (default: 0) */
|
|
19
17
|
min?: number;
|
|
@@ -27,6 +25,7 @@ export interface PanelArraySearchOptions {
|
|
|
27
25
|
* Array helper utilities.
|
|
28
26
|
*
|
|
29
27
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/helpers/array.js
|
|
28
|
+
* @source panel/src/helpers/array.js
|
|
30
29
|
*/
|
|
31
30
|
export interface PanelHelpersArray {
|
|
32
31
|
/**
|
|
@@ -82,9 +81,7 @@ export interface PanelHelpersArray {
|
|
|
82
81
|
// String Helpers
|
|
83
82
|
// -----------------------------------------------------------------------------
|
|
84
83
|
|
|
85
|
-
/**
|
|
86
|
-
* Slug conversion rules.
|
|
87
|
-
*/
|
|
84
|
+
/** Slug conversion rules. */
|
|
88
85
|
export type PanelSlugRules = Record<string, string>[];
|
|
89
86
|
|
|
90
87
|
/**
|
|
@@ -193,8 +190,7 @@ export interface PanelHelpersString {
|
|
|
193
190
|
stripHTML: (string: string) => string;
|
|
194
191
|
|
|
195
192
|
/**
|
|
196
|
-
* Replaces
|
|
197
|
-
* Supports `{{name}}` and `{{nested.prop}}` syntax.
|
|
193
|
+
* Replaces `{name}`, `{{name}}`, and dotted-path placeholders (e.g. `{nested.prop}`) with values from the lookup object.
|
|
198
194
|
*
|
|
199
195
|
* @param string - Template string
|
|
200
196
|
* @param values - Replacement values
|
|
@@ -242,10 +238,11 @@ export interface PanelHelpersString {
|
|
|
242
238
|
* Object helper utilities.
|
|
243
239
|
*
|
|
244
240
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/helpers/object.js
|
|
241
|
+
* @source panel/src/helpers/object.js
|
|
245
242
|
*/
|
|
246
243
|
export interface PanelHelpersObject {
|
|
247
244
|
/**
|
|
248
|
-
* Deep clones
|
|
245
|
+
* Deep clones a value via `structuredClone`. Returns `undefined` unchanged.
|
|
249
246
|
*
|
|
250
247
|
* @param value - Value to clone
|
|
251
248
|
* @returns Cloned value
|
|
@@ -417,16 +414,19 @@ export interface PanelHelpersClipboard {
|
|
|
417
414
|
*
|
|
418
415
|
* @param event - ClipboardEvent or string
|
|
419
416
|
* @param plain - Read as plain text only
|
|
420
|
-
* @returns Clipboard content or null if
|
|
417
|
+
* @returns Clipboard content, or null if no event/string was provided
|
|
421
418
|
*/
|
|
422
|
-
read: (
|
|
419
|
+
read: (
|
|
420
|
+
event?: ClipboardEvent | string | null,
|
|
421
|
+
plain?: boolean,
|
|
422
|
+
) => string | null;
|
|
423
423
|
|
|
424
424
|
/**
|
|
425
425
|
* Writes to clipboard. Objects are auto-JSONified.
|
|
426
426
|
*
|
|
427
427
|
* @param value - Value to write
|
|
428
428
|
* @param event - ClipboardEvent for event-based writing
|
|
429
|
-
* @returns
|
|
429
|
+
* @returns Always `true` (no failure detection)
|
|
430
430
|
*/
|
|
431
431
|
write: (value: any, event?: ClipboardEvent) => boolean;
|
|
432
432
|
}
|
|
@@ -439,6 +439,7 @@ export interface PanelHelpersClipboard {
|
|
|
439
439
|
* Embed helper utilities for video providers.
|
|
440
440
|
*
|
|
441
441
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/helpers/embed.js
|
|
442
|
+
* @source panel/src/helpers/embed.js
|
|
442
443
|
*/
|
|
443
444
|
export interface PanelHelpersEmbed {
|
|
444
445
|
/**
|
|
@@ -473,9 +474,7 @@ export interface PanelHelpersEmbed {
|
|
|
473
474
|
// Field Helpers
|
|
474
475
|
// -----------------------------------------------------------------------------
|
|
475
476
|
|
|
476
|
-
/**
|
|
477
|
-
* Field definition object.
|
|
478
|
-
*/
|
|
477
|
+
/** Field definition object. */
|
|
479
478
|
export interface PanelFieldDefinition {
|
|
480
479
|
/** Field type */
|
|
481
480
|
type?: string;
|
|
@@ -497,6 +496,7 @@ export interface PanelFieldDefinition {
|
|
|
497
496
|
* Field helper utilities.
|
|
498
497
|
*
|
|
499
498
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/helpers/field.js
|
|
499
|
+
* @source panel/src/helpers/field.js
|
|
500
500
|
*/
|
|
501
501
|
export interface PanelHelpersField {
|
|
502
502
|
/**
|
|
@@ -516,7 +516,7 @@ export interface PanelHelpersField {
|
|
|
516
516
|
form: (fields: Record<string, PanelFieldDefinition>) => Record<string, any>;
|
|
517
517
|
|
|
518
518
|
/**
|
|
519
|
-
* Checks if field is visible
|
|
519
|
+
* Checks if a field or section is visible. Returns false for hidden fields, otherwise evaluates `when` conditions against current form values.
|
|
520
520
|
*
|
|
521
521
|
* @param field - Field definition
|
|
522
522
|
* @param values - Current form values
|
|
@@ -528,7 +528,7 @@ export interface PanelHelpersField {
|
|
|
528
528
|
) => boolean;
|
|
529
529
|
|
|
530
530
|
/**
|
|
531
|
-
*
|
|
531
|
+
* Annotates subfields with the parent's section name and, when present, its API endpoints (suffixing the field endpoint with the subfield name).
|
|
532
532
|
*
|
|
533
533
|
* @param field - Parent field
|
|
534
534
|
* @param fields - Subfield definitions
|
|
@@ -548,6 +548,7 @@ export interface PanelHelpersField {
|
|
|
548
548
|
* File helper utilities.
|
|
549
549
|
*
|
|
550
550
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/helpers/file.js
|
|
551
|
+
* @source panel/src/helpers/file.js
|
|
551
552
|
*/
|
|
552
553
|
export interface PanelHelpersFile {
|
|
553
554
|
/**
|
|
@@ -597,9 +598,7 @@ export interface PanelHelpersKeyboard {
|
|
|
597
598
|
// Link Helpers
|
|
598
599
|
// -----------------------------------------------------------------------------
|
|
599
600
|
|
|
600
|
-
/**
|
|
601
|
-
* Link type definition.
|
|
602
|
-
*/
|
|
601
|
+
/** Link type definition. */
|
|
603
602
|
export interface PanelLinkType {
|
|
604
603
|
/** Detection function */
|
|
605
604
|
detect: (value: string) => boolean;
|
|
@@ -621,9 +620,7 @@ export interface PanelLinkType {
|
|
|
621
620
|
value: (value: string) => string;
|
|
622
621
|
}
|
|
623
622
|
|
|
624
|
-
/**
|
|
625
|
-
* Detected link result.
|
|
626
|
-
*/
|
|
623
|
+
/** Detected link result. */
|
|
627
624
|
export interface PanelLinkDetection {
|
|
628
625
|
/** Detected type */
|
|
629
626
|
type: string;
|
|
@@ -631,9 +628,7 @@ export interface PanelLinkDetection {
|
|
|
631
628
|
link: string;
|
|
632
629
|
}
|
|
633
630
|
|
|
634
|
-
/**
|
|
635
|
-
* Link preview data.
|
|
636
|
-
*/
|
|
631
|
+
/** Link preview data. */
|
|
637
632
|
export interface PanelLinkPreview {
|
|
638
633
|
/** Display label */
|
|
639
634
|
label: string;
|
|
@@ -684,7 +679,7 @@ export interface PanelHelpersLink {
|
|
|
684
679
|
isFileUUID: (value: string) => boolean;
|
|
685
680
|
|
|
686
681
|
/**
|
|
687
|
-
* Checks if value is a page UUID or permalink.
|
|
682
|
+
* Checks if value is `site://`, a `page://` UUID, or a page permalink.
|
|
688
683
|
*
|
|
689
684
|
* @param value - Value to check
|
|
690
685
|
* @returns True if page reference
|
|
@@ -716,16 +711,14 @@ export interface PanelHelpersLink {
|
|
|
716
711
|
// Page Helpers
|
|
717
712
|
// -----------------------------------------------------------------------------
|
|
718
713
|
|
|
719
|
-
/**
|
|
720
|
-
* Page status button props.
|
|
721
|
-
*/
|
|
714
|
+
/** Page status button props. */
|
|
722
715
|
export interface PanelPageStatusProps {
|
|
723
716
|
/** Status title */
|
|
724
717
|
title: string;
|
|
725
718
|
/** Status icon */
|
|
726
719
|
icon: string;
|
|
727
720
|
/** Status color */
|
|
728
|
-
theme
|
|
721
|
+
theme: "negative-icon" | "info-icon" | "positive-icon";
|
|
729
722
|
/** Whether disabled */
|
|
730
723
|
disabled?: boolean;
|
|
731
724
|
/** Button size */
|
|
@@ -738,6 +731,7 @@ export interface PanelPageStatusProps {
|
|
|
738
731
|
* Page helper utilities.
|
|
739
732
|
*
|
|
740
733
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/helpers/page.js
|
|
734
|
+
* @source panel/src/helpers/page.js
|
|
741
735
|
*/
|
|
742
736
|
export interface PanelHelpersPage {
|
|
743
737
|
/**
|
|
@@ -754,18 +748,14 @@ export interface PanelHelpersPage {
|
|
|
754
748
|
// Upload Helpers
|
|
755
749
|
// -----------------------------------------------------------------------------
|
|
756
750
|
|
|
757
|
-
/**
|
|
758
|
-
* Upload progress callback.
|
|
759
|
-
*/
|
|
751
|
+
/** Upload progress callback. */
|
|
760
752
|
export type PanelUploadProgressCallback = (
|
|
761
753
|
xhr: XMLHttpRequest,
|
|
762
754
|
file: File,
|
|
763
755
|
percent: number,
|
|
764
756
|
) => void;
|
|
765
757
|
|
|
766
|
-
/**
|
|
767
|
-
* Upload complete callback.
|
|
768
|
-
*/
|
|
758
|
+
/** Upload complete callback. */
|
|
769
759
|
export type PanelUploadCompleteCallback = (
|
|
770
760
|
xhr: XMLHttpRequest,
|
|
771
761
|
file: File,
|
|
@@ -806,9 +796,7 @@ export interface PanelUploadParams {
|
|
|
806
796
|
// Debounce/Throttle Helpers
|
|
807
797
|
// -----------------------------------------------------------------------------
|
|
808
798
|
|
|
809
|
-
/**
|
|
810
|
-
* Debounce options.
|
|
811
|
-
*/
|
|
799
|
+
/** Debounce options. */
|
|
812
800
|
export interface PanelDebounceOptions {
|
|
813
801
|
/** Call on leading edge (default: false) */
|
|
814
802
|
leading?: boolean;
|
|
@@ -816,9 +804,7 @@ export interface PanelDebounceOptions {
|
|
|
816
804
|
trailing?: boolean;
|
|
817
805
|
}
|
|
818
806
|
|
|
819
|
-
/**
|
|
820
|
-
* Throttle options.
|
|
821
|
-
*/
|
|
807
|
+
/** Throttle options. */
|
|
822
808
|
export interface PanelThrottleOptions {
|
|
823
809
|
/** Call on leading edge (default: true) */
|
|
824
810
|
leading?: boolean;
|
|
@@ -826,16 +812,12 @@ export interface PanelThrottleOptions {
|
|
|
826
812
|
trailing?: boolean;
|
|
827
813
|
}
|
|
828
814
|
|
|
829
|
-
/**
|
|
830
|
-
* Debounced function (without cancel method).
|
|
831
|
-
*/
|
|
815
|
+
/** Debounced function (without cancel method). */
|
|
832
816
|
export interface PanelDebouncedFunction<T extends (...args: any[]) => any> {
|
|
833
817
|
(...args: Parameters<T>): ReturnType<T> | undefined;
|
|
834
818
|
}
|
|
835
819
|
|
|
836
|
-
/**
|
|
837
|
-
* Throttled function with cancel method.
|
|
838
|
-
*/
|
|
820
|
+
/** Throttled function with cancel method. */
|
|
839
821
|
export interface PanelThrottledFunction<T extends (...args: any[]) => any> {
|
|
840
822
|
(...args: Parameters<T>): ReturnType<T> | undefined;
|
|
841
823
|
/** Cancels pending invocation */
|
|
@@ -846,9 +828,7 @@ export interface PanelThrottledFunction<T extends (...args: any[]) => any> {
|
|
|
846
828
|
// Sort Helper
|
|
847
829
|
// -----------------------------------------------------------------------------
|
|
848
830
|
|
|
849
|
-
/**
|
|
850
|
-
* Sort options.
|
|
851
|
-
*/
|
|
831
|
+
/** Sort options. */
|
|
852
832
|
export interface PanelSortOptions {
|
|
853
833
|
/** Sort descending (default: false) */
|
|
854
834
|
desc?: boolean;
|
|
@@ -856,9 +836,7 @@ export interface PanelSortOptions {
|
|
|
856
836
|
insensitive?: boolean;
|
|
857
837
|
}
|
|
858
838
|
|
|
859
|
-
/**
|
|
860
|
-
* Comparator function for sorting.
|
|
861
|
-
*/
|
|
839
|
+
/** Comparator function for sorting. */
|
|
862
840
|
export type PanelComparator = (a: string, b: string) => number;
|
|
863
841
|
|
|
864
842
|
// -----------------------------------------------------------------------------
|
|
@@ -881,15 +859,21 @@ export type PanelComparator = (a: string, b: string) => number;
|
|
|
881
859
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/helpers/index.js
|
|
882
860
|
*/
|
|
883
861
|
export interface PanelHelpers {
|
|
884
|
-
/**
|
|
862
|
+
/**
|
|
863
|
+
* @source panel/src/helpers/array.js
|
|
864
|
+
*/
|
|
885
865
|
array: PanelHelpersArray;
|
|
886
866
|
|
|
887
|
-
/**
|
|
867
|
+
/**
|
|
868
|
+
* @source panel/src/helpers/clipboard.js
|
|
869
|
+
*/
|
|
888
870
|
clipboard: PanelHelpersClipboard;
|
|
889
871
|
|
|
890
872
|
/**
|
|
891
873
|
* Deep clones a value.
|
|
892
874
|
* Shortcut for `object.clone()`.
|
|
875
|
+
* @source panel/src/helpers/object.js
|
|
876
|
+
* @source panel/src/helpers/index.js
|
|
893
877
|
*/
|
|
894
878
|
clone: <T>(value: T) => T;
|
|
895
879
|
|
|
@@ -898,6 +882,7 @@ export interface PanelHelpers {
|
|
|
898
882
|
*
|
|
899
883
|
* @param value - Color name or value
|
|
900
884
|
* @returns CSS variable or original value, undefined if not a string
|
|
885
|
+
* @source panel/src/helpers/color.js
|
|
901
886
|
*/
|
|
902
887
|
color: (value: string) => string | undefined;
|
|
903
888
|
|
|
@@ -907,7 +892,9 @@ export interface PanelHelpers {
|
|
|
907
892
|
* @param fn - Function to debounce
|
|
908
893
|
* @param delay - Delay in milliseconds
|
|
909
894
|
* @param options - Debounce options
|
|
910
|
-
* @returns Debounced function
|
|
895
|
+
* @returns Debounced function
|
|
896
|
+
* @source panel/src/helpers/debounce.js
|
|
897
|
+
* @source panel/src/helpers/index.js
|
|
911
898
|
*/
|
|
912
899
|
debounce: <T extends (...args: any[]) => any>(
|
|
913
900
|
fn: T,
|
|
@@ -915,13 +902,19 @@ export interface PanelHelpers {
|
|
|
915
902
|
options?: PanelDebounceOptions,
|
|
916
903
|
) => PanelDebouncedFunction<T>;
|
|
917
904
|
|
|
918
|
-
/**
|
|
905
|
+
/**
|
|
906
|
+
* @source panel/src/helpers/embed.js
|
|
907
|
+
*/
|
|
919
908
|
embed: PanelHelpersEmbed;
|
|
920
909
|
|
|
921
|
-
/**
|
|
910
|
+
/**
|
|
911
|
+
* @source panel/src/helpers/field.js
|
|
912
|
+
*/
|
|
922
913
|
field: PanelHelpersField;
|
|
923
914
|
|
|
924
|
-
/**
|
|
915
|
+
/**
|
|
916
|
+
* @source panel/src/helpers/file.js
|
|
917
|
+
*/
|
|
925
918
|
file: PanelHelpersFile;
|
|
926
919
|
|
|
927
920
|
/**
|
|
@@ -930,6 +923,7 @@ export interface PanelHelpers {
|
|
|
930
923
|
* @param element - Selector or element
|
|
931
924
|
* @param field - Specific input name to focus
|
|
932
925
|
* @returns The focused element, or false if nothing could be focused
|
|
926
|
+
* @source panel/src/helpers/focus.js
|
|
933
927
|
*/
|
|
934
928
|
focus: (element: string | HTMLElement, field?: string) => HTMLElement | false;
|
|
935
929
|
|
|
@@ -938,6 +932,8 @@ export interface PanelHelpers {
|
|
|
938
932
|
*
|
|
939
933
|
* @param name - Component name
|
|
940
934
|
* @returns True if registered
|
|
935
|
+
* @source panel/src/helpers/isComponent.js
|
|
936
|
+
* @source panel/src/helpers/index.js
|
|
941
937
|
*/
|
|
942
938
|
isComponent: (name: string) => boolean;
|
|
943
939
|
|
|
@@ -946,25 +942,37 @@ export interface PanelHelpers {
|
|
|
946
942
|
*
|
|
947
943
|
* @param event - Event to check
|
|
948
944
|
* @returns True if file upload event
|
|
945
|
+
* @source panel/src/helpers/isUploadEvent.js
|
|
946
|
+
* @source panel/src/helpers/index.js
|
|
949
947
|
*/
|
|
950
|
-
isUploadEvent: (event:
|
|
948
|
+
isUploadEvent: (event: DragEvent) => boolean;
|
|
951
949
|
|
|
952
|
-
/**
|
|
950
|
+
/**
|
|
951
|
+
* @source panel/src/helpers/keyboard.js
|
|
952
|
+
*/
|
|
953
953
|
keyboard: PanelHelpersKeyboard;
|
|
954
954
|
|
|
955
|
-
/**
|
|
955
|
+
/**
|
|
956
|
+
* @source panel/src/helpers/link.js
|
|
957
|
+
*/
|
|
956
958
|
link: PanelHelpersLink;
|
|
957
959
|
|
|
958
|
-
/**
|
|
960
|
+
/**
|
|
961
|
+
* @source panel/src/helpers/object.js
|
|
962
|
+
*/
|
|
959
963
|
object: PanelHelpersObject;
|
|
960
964
|
|
|
961
965
|
/**
|
|
962
966
|
* Left-pads value with zeros.
|
|
963
967
|
* Shortcut for `string.pad()`.
|
|
968
|
+
* @source panel/src/helpers/index.js
|
|
969
|
+
* @source panel/src/helpers/string.js
|
|
964
970
|
*/
|
|
965
971
|
pad: (value: string | number, length?: number) => string;
|
|
966
972
|
|
|
967
|
-
/**
|
|
973
|
+
/**
|
|
974
|
+
* @source panel/src/helpers/page.js
|
|
975
|
+
*/
|
|
968
976
|
page: PanelHelpersPage;
|
|
969
977
|
|
|
970
978
|
/**
|
|
@@ -974,12 +982,15 @@ export interface PanelHelpers {
|
|
|
974
982
|
* @param fallback - Fallback value (default: `"100%"`)
|
|
975
983
|
* @param vertical - Calculate for vertical orientation
|
|
976
984
|
* @returns Percentage string
|
|
985
|
+
* @source panel/src/helpers/ratio.js
|
|
977
986
|
*/
|
|
978
987
|
ratio: (fraction?: string, fallback?: string, vertical?: boolean) => string;
|
|
979
988
|
|
|
980
989
|
/**
|
|
981
990
|
* Converts string to slug.
|
|
982
991
|
* Shortcut for `string.slug()`.
|
|
992
|
+
* @source panel/src/helpers/index.js
|
|
993
|
+
* @source panel/src/helpers/string.js
|
|
983
994
|
*/
|
|
984
995
|
slug: (
|
|
985
996
|
string: string,
|
|
@@ -993,10 +1004,13 @@ export interface PanelHelpers {
|
|
|
993
1004
|
*
|
|
994
1005
|
* @param options - Sort options
|
|
995
1006
|
* @returns Comparator function
|
|
1007
|
+
* @source panel/src/helpers/sort.js
|
|
996
1008
|
*/
|
|
997
1009
|
sort: (options?: PanelSortOptions) => PanelComparator;
|
|
998
1010
|
|
|
999
|
-
/**
|
|
1011
|
+
/**
|
|
1012
|
+
* @source panel/src/helpers/string.js
|
|
1013
|
+
*/
|
|
1000
1014
|
string: PanelHelpersString;
|
|
1001
1015
|
|
|
1002
1016
|
/**
|
|
@@ -1006,6 +1020,8 @@ export interface PanelHelpers {
|
|
|
1006
1020
|
* @param delay - Delay in milliseconds
|
|
1007
1021
|
* @param options - Throttle options
|
|
1008
1022
|
* @returns Throttled function with cancel method
|
|
1023
|
+
* @source panel/src/helpers/throttle.js
|
|
1024
|
+
* @source panel/src/helpers/index.js
|
|
1009
1025
|
*/
|
|
1010
1026
|
throttle: <T extends (...args: any[]) => any>(
|
|
1011
1027
|
fn: T,
|
|
@@ -1019,15 +1035,21 @@ export interface PanelHelpers {
|
|
|
1019
1035
|
* @param file - File to upload
|
|
1020
1036
|
* @param params - Upload parameters
|
|
1021
1037
|
* @returns Promise resolving to response
|
|
1038
|
+
* @source panel/src/helpers/upload.js
|
|
1039
|
+
* @source panel/src/helpers/index.js
|
|
1022
1040
|
*/
|
|
1023
1041
|
upload: (file: File, params: PanelUploadParams) => Promise<any>;
|
|
1024
1042
|
|
|
1025
|
-
/**
|
|
1043
|
+
/**
|
|
1044
|
+
* @source panel/src/helpers/url.js
|
|
1045
|
+
*/
|
|
1026
1046
|
url: PanelHelpersUrl;
|
|
1027
1047
|
|
|
1028
1048
|
/**
|
|
1029
1049
|
* Generates UUID v4 string.
|
|
1030
1050
|
* Shortcut for `string.uuid()`.
|
|
1051
|
+
* @source panel/src/helpers/index.js
|
|
1052
|
+
* @source panel/src/helpers/string.js
|
|
1031
1053
|
*/
|
|
1032
1054
|
uuid: () => string;
|
|
1033
1055
|
}
|