@halo-dev/ui-shared 2.23.0 → 2.25.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/dist/index.d.ts CHANGED
@@ -1,10 +1,8 @@
1
1
  /// <reference path="./locale/index.d.ts" />
2
2
  import { Attachment, Backup, DetailedUser, Extension, GetThumbnailByUriSizeEnum, ListedComment, ListedPost, ListedReply, ListedSinglePage, Plugin, Theme } from "@halo-dev/api-client";
3
- import * as pinia from "pinia";
4
- import * as vue from "vue";
5
3
  import { Component, Raw, Ref } from "vue";
6
4
  import { RouteLocationRaw, RouteRecordName, RouteRecordRaw } from "vue-router";
7
- import { AnyExtension } from "@halo-dev/richtext-editor";
5
+ import { AnyExtension } from "@tiptap/core";
8
6
 
9
7
  //#region ../../node_modules/.pnpm/mitt@3.0.1/node_modules/mitt/index.d.ts
10
8
  declare type EventType = string | symbol;
@@ -876,6 +874,1807 @@ interface ThemeListTab {
876
874
  priority: number;
877
875
  }
878
876
  //#endregion
877
+ //#region ../../node_modules/.pnpm/@formkit+core@2.1.0/node_modules/@formkit/core/dist/index.d.mts
878
+ /**
879
+ * All FormKitMiddleware conform to the pattern of accepting a payload and a
880
+ * `next()` function. They can either pass the payload to the next middleware
881
+ * explicitly (as an argument of next), or implicitly (no argument for next).
882
+ *
883
+ * @public
884
+ */
885
+ type FormKitMiddleware<T = unknown> = (payload: T, next: (payload: T) => T) => T;
886
+ /**
887
+ * The FormKitDispatcher interface is responsible creating/running "hooks".
888
+ *
889
+ * @public
890
+ */
891
+ interface FormKitDispatcher<T> {
892
+ (dispatchable: FormKitMiddleware<T>): number;
893
+ unshift: (dispatchable: FormKitMiddleware<T>) => number;
894
+ remove: (dispatchable: FormKitMiddleware<T>) => void;
895
+ dispatch: (payload: T) => T;
896
+ }
897
+ /**
898
+ * Event listener functions definition.
899
+ *
900
+ * @public
901
+ */
902
+ interface FormKitEventListener {
903
+ (event: FormKitEvent): void;
904
+ receipt?: string;
905
+ }
906
+ /**
907
+ * The internal structure of a FormKitEvent.
908
+ *
909
+ * @public
910
+ */
911
+ interface FormKitEvent {
912
+ payload: any;
913
+ name: string;
914
+ bubble: boolean;
915
+ origin: FormKitNode;
916
+ meta?: Record<string, unknown>;
917
+ }
918
+ /**
919
+ * The FormKitEventEmitter definition.
920
+ *
921
+ * @public
922
+ */
923
+ interface FormKitEventEmitter {
924
+ (node: FormKitNode, event: FormKitEvent): void;
925
+ on: (eventName: string, listener: FormKitEventListener, pos?: 'push' | 'unshift') => string;
926
+ off: (receipt: string) => void;
927
+ pause: (node?: FormKitNode) => void;
928
+ play: (node?: FormKitNode) => void;
929
+ flush: () => void;
930
+ }
931
+ /**
932
+ * The structure of a core FormKitMessage. These messages are used to store
933
+ * information about the state of a node.
934
+ *
935
+ * @public
936
+ */
937
+ interface FormKitMessageProps {
938
+ blocking: boolean;
939
+ key: string;
940
+ meta: FormKitMessageMeta;
941
+ type: string;
942
+ value?: string | number | boolean;
943
+ visible: boolean;
944
+ }
945
+ /**
946
+ * A FormKit message is immutable, so all properties should be readonly.
947
+ *
948
+ * @public
949
+ */
950
+ type FormKitMessage = Readonly<FormKitMessageProps>;
951
+ /**
952
+ * A registry of input messages that should be applied to children of the node
953
+ * they are passed to — where the string key of the object is the address of
954
+ * the node to apply the messages on and the value is the message itself.
955
+ *
956
+ * @public
957
+ */
958
+ interface FormKitInputMessages {
959
+ [address: string]: FormKitMessage[];
960
+ }
961
+ /**
962
+ * Child messages that were not immediately applied due to the child not existing.
963
+ *
964
+ * @public
965
+ */
966
+ type ChildMessageBuffer = Map<string, Array<[FormKitMessage[], MessageClearer | undefined]>>;
967
+ /**
968
+ * A string or function that allows clearing messages.
969
+ *
970
+ * @public
971
+ */
972
+ type MessageClearer = string | ((message: FormKitMessage) => boolean);
973
+ /**
974
+ * Messages have can have any arbitrary meta data attached to them.
975
+ *
976
+ * @public
977
+ */
978
+ interface FormKitMessageMeta {
979
+ [index: string]: any;
980
+ /**
981
+ * If this property is set, then message producers (like formkit/i18n) should
982
+ * use this key instead of the message key as the lookup for the proper
983
+ * message to produce.
984
+ */
985
+ messageKey?: string;
986
+ /**
987
+ * If this property is set on a message then only the values in this property
988
+ * will be passed as arguments to an i18n message localization function.
989
+ */
990
+ i18nArgs?: any[];
991
+ }
992
+ /**
993
+ * Defines the actual store of messages.
994
+ *
995
+ * @public
996
+ */
997
+ interface FormKitMessageStore {
998
+ [index: string]: FormKitMessage;
999
+ }
1000
+ /**
1001
+ * The message store contains all of the messages that pertain to a given node.
1002
+ *
1003
+ * @public
1004
+ */
1005
+ type FormKitStore = FormKitMessageStore & {
1006
+ _n: FormKitNode;
1007
+ _b: Array<[messages: FormKitMessage[], clear?: MessageClearer]>;
1008
+ _m: ChildMessageBuffer;
1009
+ _r?: string;
1010
+ buffer: boolean;
1011
+ } & FormKitStoreTraps;
1012
+ /**
1013
+ * The available traps on the FormKit store.
1014
+ *
1015
+ * @public
1016
+ */
1017
+ interface FormKitStoreTraps {
1018
+ apply: (messages: Array<FormKitMessage> | FormKitInputMessages, clear?: MessageClearer) => void;
1019
+ set: (message: FormKitMessageProps) => FormKitStore;
1020
+ remove: (key: string) => FormKitStore;
1021
+ filter: (callback: (message: FormKitMessage) => boolean, type?: string) => FormKitStore;
1022
+ reduce: <T>(reducer: (accumulator: T, message: FormKitMessage) => T, accumulator: T) => T;
1023
+ release: () => void;
1024
+ touch: () => void;
1025
+ }
1026
+ /**
1027
+ * Creates a new FormKitMessage object.
1028
+ *
1029
+ * ```ts
1030
+ * // default:
1031
+ * {
1032
+ * blocking: false,
1033
+ * key: token(),
1034
+ * meta: {},
1035
+ * type: 'state',
1036
+ * visible: true,
1037
+ * }
1038
+ * ```
1039
+ *
1040
+ * @param conf - An object of optional properties of {@link FormKitMessage | FormKitMessage}.
1041
+ * @param node - A {@link @formkit/node#FormKitNode | FormKitNode}.
1042
+ * @returns A {@link FormKitMessageProps | FormKitMessageProps}.
1043
+ *
1044
+ * @public
1045
+ */
1046
+ /**
1047
+ * Error messages.
1048
+ *
1049
+ * @public
1050
+ */
1051
+ type ErrorMessages = string | string[] | Record<string, string | string[]>;
1052
+ /**
1053
+ * The FormKit ledger, a general-purpose message counting service provided by
1054
+ * FormKit core for counting messages throughout a tree.
1055
+ *
1056
+ * @public
1057
+ */
1058
+ interface FormKitLedger {
1059
+ count: (name: string, condition?: FormKitCounterCondition, increment?: number) => Promise<void>;
1060
+ init: (node: FormKitNode) => void;
1061
+ merge: (child: FormKitNode) => void;
1062
+ settled: (name: string) => Promise<void>;
1063
+ unmerge: (child: FormKitNode) => void;
1064
+ value: (name: string) => number;
1065
+ }
1066
+ /**
1067
+ * Ledger counters require a condition function that determines if a given
1068
+ * message applies to it or not.
1069
+ *
1070
+ * @public
1071
+ */
1072
+ interface FormKitCounterCondition {
1073
+ (message: FormKitMessage): boolean;
1074
+ }
1075
+ /**
1076
+ * The counter object used to perform instance counting within
1077
+ * a tree.
1078
+ *
1079
+ * @public
1080
+ */
1081
+ /**
1082
+ * The value being listed out. Can be an array, an object, or a number.
1083
+ *
1084
+ * @public
1085
+ */
1086
+ type FormKitListValue = string | Record<string, any> | Array<string | number | Record<string, any>> | number;
1087
+ /**
1088
+ * A full loop statement in tuple syntax. Can be read like "foreach value, key? in list".
1089
+ *
1090
+ * @public
1091
+ */
1092
+ type FormKitListStatement = [value: any, key: number | string, list: FormKitListValue] | [value: any, list: FormKitListValue];
1093
+ /**
1094
+ * Meta attributes are not used when parsing the schema, but can be used to
1095
+ * create tooling.
1096
+ *
1097
+ * @public
1098
+ */
1099
+ type FormKitSchemaMeta = {
1100
+ [key: string]: string | number | boolean | undefined | null | CallableFunction | FormKitSchemaMeta;
1101
+ };
1102
+ /**
1103
+ * Properties available in all schema nodes.
1104
+ *
1105
+ * @public
1106
+ */
1107
+ interface FormKitSchemaProps {
1108
+ children?: string | FormKitSchemaNode[] | FormKitSchemaCondition;
1109
+ key?: string;
1110
+ if?: string;
1111
+ for?: FormKitListStatement;
1112
+ bind?: string;
1113
+ meta?: FormKitSchemaMeta;
1114
+ }
1115
+ /**
1116
+ * Properties available when using a DOM node.
1117
+ *
1118
+ * @public
1119
+ */
1120
+ type FormKitSchemaDOMNode = {
1121
+ $el: string | null;
1122
+ attrs?: FormKitSchemaAttributes;
1123
+ } & FormKitSchemaProps;
1124
+ /**
1125
+ * A simple text node.
1126
+ *
1127
+ * @public
1128
+ */
1129
+ type FormKitSchemaTextNode = string;
1130
+ /**
1131
+ * The possible value types of attributes (in the schema).
1132
+ *
1133
+ * @public
1134
+ */
1135
+ type FormKitAttributeValue = string | number | boolean | undefined | FormKitSchemaAttributes | FormKitSchemaAttributesCondition;
1136
+ /**
1137
+ * Conditions nested inside attribute declarations.
1138
+ *
1139
+ * @public
1140
+ */
1141
+ interface FormKitSchemaAttributesCondition {
1142
+ if: string;
1143
+ then: FormKitAttributeValue;
1144
+ else?: FormKitAttributeValue;
1145
+ }
1146
+ /**
1147
+ * DOM attributes are simple string dictionaries.
1148
+ *
1149
+ * @public
1150
+ */
1151
+ type FormKitSchemaAttributes = {
1152
+ [index: string]: FormKitAttributeValue;
1153
+ } | null | FormKitSchemaAttributesCondition;
1154
+ /**
1155
+ * Properties available when defining a generic non-FormKit component.
1156
+ *
1157
+ * @public
1158
+ */
1159
+ type FormKitSchemaComponent = {
1160
+ $cmp: string;
1161
+ props?: Record<string, any>;
1162
+ } & FormKitSchemaProps;
1163
+ /**
1164
+ * Syntactic sugar for a FormKitSchemaComponent node that uses FormKit.
1165
+ *
1166
+ * @public
1167
+ */
1168
+ type FormKitSchemaFormKit = {
1169
+ $formkit: string;
1170
+ } & Record<string, any> & FormKitSchemaProps;
1171
+ /**
1172
+ * A schema node that determines _which_ content to render.
1173
+ *
1174
+ * @public
1175
+ */
1176
+ type FormKitSchemaCondition = {
1177
+ if: string;
1178
+ then: FormKitSchemaNode | FormKitSchemaNode[];
1179
+ else?: FormKitSchemaNode | FormKitSchemaNode[];
1180
+ };
1181
+ /**
1182
+ * The context that is passed from one schema render to the next.
1183
+ *
1184
+ * @public
1185
+ */
1186
+ /**
1187
+ * Properties available then defining a schema node.
1188
+ *
1189
+ * @public
1190
+ */
1191
+ type FormKitSchemaNode = FormKitSchemaDOMNode | FormKitSchemaComponent | FormKitSchemaTextNode | FormKitSchemaCondition | FormKitSchemaFormKit;
1192
+ /**
1193
+ * A partial schema node used to extend or unset section schema properties.
1194
+ *
1195
+ * @public
1196
+ */
1197
+ type FormKitSchemaNodeExtension = FormKitSchemaTextNode | (Omit<Partial<FormKitSchemaDOMNode>, '$el'> & {
1198
+ $el?: FormKitSchemaDOMNode['$el'] | undefined;
1199
+ $cmp?: undefined;
1200
+ $formkit?: undefined;
1201
+ }) | (Omit<Partial<FormKitSchemaComponent>, '$cmp'> & {
1202
+ $cmp?: FormKitSchemaComponent['$cmp'] | undefined;
1203
+ $el?: undefined;
1204
+ $formkit?: undefined;
1205
+ }) | (Partial<FormKitSchemaFormKit> & {
1206
+ $el?: undefined;
1207
+ $cmp?: undefined;
1208
+ });
1209
+ /**
1210
+ * An entire schema object or subtree from any entry point. Can be a single
1211
+ * node, an array of nodes, or a conditional. This is the type that is passed to
1212
+ * the FormKitSchema constructor.
1213
+ *
1214
+ * @public
1215
+ */
1216
+ type FormKitSchemaDefinition = FormKitSchemaNode | FormKitSchemaNode[] | FormKitSchemaCondition;
1217
+ /**
1218
+ * Definition for a function that can extend a given schema node.
1219
+ *
1220
+ * @public
1221
+ */
1222
+ /**
1223
+ * The shape of the schema definition overrides/extensions.
1224
+ * @public
1225
+ */
1226
+ type FormKitSectionsSchema = Record<string, FormKitSchemaNodeExtension | FormKitSchemaCondition | null>;
1227
+ /**
1228
+ * Defines a function that allows selectively overriding a given schema.
1229
+ *
1230
+ * @public
1231
+ */
1232
+ interface FormKitExtendableSchemaRoot {
1233
+ (extensions: FormKitSectionsSchema): FormKitSchemaDefinition;
1234
+ memoKey?: string;
1235
+ }
1236
+ /**
1237
+ * Type narrow that a node is a DOM node.
1238
+ *
1239
+ * @param node - A schema node to check
1240
+ *
1241
+ * @returns `boolean`
1242
+ *
1243
+ * @public
1244
+ */
1245
+ /**
1246
+ * Definition for a function that produces CSS classes.
1247
+ *
1248
+ * @public
1249
+ */
1250
+ interface FormKitClasses {
1251
+ (node: FormKitNode, sectionKey: string): string | Record<string, boolean>;
1252
+ }
1253
+ /**
1254
+ * Function that produces a standardized object representation of CSS classes.
1255
+ *
1256
+ * @param propertyKey - the section key.
1257
+ * @param node - A {@link FormKitNode | FormKitNode}.
1258
+ * @param sectionClassList - A `string | Record<string, boolean>` or a {@link FormKitClasses | FormKitClasses}.
1259
+ *
1260
+ * @returns `Record<string, boolean>`
1261
+ *
1262
+ * @public
1263
+ */
1264
+ /**
1265
+ * Global configuration options.
1266
+ *
1267
+ * @public
1268
+ */
1269
+ type FormKitRootConfig = Partial<FormKitConfig> & {
1270
+ _add: (node: FormKitNode) => void;
1271
+ _rm: (node: FormKitNode) => void;
1272
+ };
1273
+ /**
1274
+ * Creates a new instance of a global configuration option. This object is
1275
+ * essentially just a FormKitOption object, but it can be used as the root for
1276
+ * FormKitConfig's proxy and retain event "emitting".
1277
+ *
1278
+ * @param options - An object of optional properties of {@link FormKitConfig | FormKitConfig}.
1279
+ *
1280
+ * @returns A {@link FormKitRootConfig | FormKitRootConfig}.
1281
+ *
1282
+ * @public
1283
+ */
1284
+ /**
1285
+ * Definition of a library item — when registering a new library item, these
1286
+ * are the required and available properties.
1287
+ *
1288
+ * @public
1289
+ */
1290
+ type FormKitTypeDefinition<V = unknown> = {
1291
+ /**
1292
+ * The FormKit core node type. Can only be input | list | group.
1293
+ */
1294
+ type: FormKitNodeType;
1295
+ /**
1296
+ * Groups the input into a given family of inputs, generally for styling
1297
+ * purposes only. For example the "text" family would apply to all text-like
1298
+ * inputs.
1299
+ */
1300
+ family?: string;
1301
+ /**
1302
+ * An optional name for the input’s type (e.g. "select" for a select input).
1303
+ * If used, this value takes precedence over the "type" prop string.
1304
+ */
1305
+ forceTypeProp?: string;
1306
+ /**
1307
+ * Custom props that should be added to the input.
1308
+ */
1309
+ props?: FormKitPseudoProps;
1310
+ /**
1311
+ * The schema used to create the input. Either this or the component is
1312
+ * required.
1313
+ */
1314
+ schema?: FormKitExtendableSchemaRoot | FormKitSchemaNode[] | FormKitSchemaCondition;
1315
+ /**
1316
+ * A component to use to render the input. Either this or the schema is
1317
+ * required.
1318
+ */
1319
+ component?: unknown;
1320
+ /**
1321
+ * A library of components to provide to the internal input schema.
1322
+ */
1323
+ library?: Record<string, unknown>;
1324
+ /**
1325
+ * An array of additional feature functions to load when booting the input.
1326
+ */
1327
+ features?: Array<(node: FormKitNode<V>) => void>;
1328
+ /**
1329
+ * An optional string to use as a comparison key for memoizing the schema.
1330
+ */
1331
+ schemaMemoKey?: string;
1332
+ };
1333
+ /**
1334
+ * A library of inputs, keyed by the name of the type.
1335
+ *
1336
+ * @public
1337
+ */
1338
+ /**
1339
+ * The base interface definition for a FormKitPlugin. It's just a function that
1340
+ * accepts a node argument.
1341
+ *
1342
+ * @public
1343
+ */
1344
+ interface FormKitPlugin {
1345
+ (node: FormKitNode): false | any | void;
1346
+ library?: (node: FormKitNode) => void;
1347
+ }
1348
+ /**
1349
+ * Text fragments are small pieces of text used for things like interface
1350
+ * validation messages, or errors that may be exposed for modification or
1351
+ * even translation.
1352
+ *
1353
+ * @public
1354
+ */
1355
+ type FormKitTextFragment = Partial<FormKitMessageProps> & {
1356
+ key: string;
1357
+ value: string;
1358
+ type: string;
1359
+ };
1360
+ /**
1361
+ * The available hooks for middleware.
1362
+ *
1363
+ * @public
1364
+ */
1365
+ interface FormKitHooks {
1366
+ classes: FormKitDispatcher<{
1367
+ property: string;
1368
+ classes: Record<string, boolean>;
1369
+ }>;
1370
+ commit: FormKitDispatcher<any>;
1371
+ error: FormKitDispatcher<string>;
1372
+ setErrors: FormKitDispatcher<{
1373
+ localErrors: ErrorMessages;
1374
+ childErrors?: ErrorMessages;
1375
+ }>;
1376
+ init: FormKitDispatcher<FormKitNode>;
1377
+ input: FormKitDispatcher<any>;
1378
+ submit: FormKitDispatcher<Record<string, any>>;
1379
+ message: FormKitDispatcher<FormKitMessage>;
1380
+ prop: FormKitDispatcher<{
1381
+ prop: string | symbol;
1382
+ value: any;
1383
+ }>;
1384
+ text: FormKitDispatcher<FormKitTextFragment>;
1385
+ schema: FormKitDispatcher<FormKitSchemaNode[] | FormKitSchemaCondition>;
1386
+ }
1387
+ /**
1388
+ * The definition of a FormKitTrap. These are somewhat like methods on each
1389
+ * FormKitNode. They are always symmetrical (get/set) — although it's acceptable
1390
+ * for either to throw an Exception.
1391
+ *
1392
+ * @public
1393
+ */
1394
+ interface FormKitTrap {
1395
+ get: TrapGetter;
1396
+ set: TrapSetter;
1397
+ }
1398
+ /**
1399
+ * Describes the path to a particular node from the top of the tree.
1400
+ *
1401
+ * @public
1402
+ */
1403
+ type FormKitAddress = Array<string | number>;
1404
+ /**
1405
+ * These are the types of nodes that can be created. These are different from
1406
+ * the type of inputs available and rather describe their purpose in the tree.
1407
+ *
1408
+ * @public
1409
+ */
1410
+ type FormKitNodeType = 'input' | 'list' | 'group';
1411
+ /**
1412
+ * FormKit inputs of type 'group' must have keyed values by default.
1413
+ *
1414
+ * @public
1415
+ */
1416
+ /**
1417
+ * Signature for any of the node's getter traps. Keep in mind that because these
1418
+ * are traps and not class methods, their response types are declared explicitly
1419
+ * in the FormKitNode interface.
1420
+ *
1421
+ * @public
1422
+ */
1423
+ type TrapGetter = ((node: FormKitNode, context: FormKitContext, ...args: any[]) => unknown) | false;
1424
+ /**
1425
+ * The signature for a node's trap setter — these are more rare than getter
1426
+ * traps, but can be useful for blocking access to certain context properties
1427
+ * or modifying the behavior of an assignment (ex. see setParent).
1428
+ *
1429
+ * @public
1430
+ */
1431
+ type TrapSetter = ((node: FormKitNode, context: FormKitContext, property: string | number | symbol, value: any) => boolean | never) | false;
1432
+ /**
1433
+ * The map signature for a node's traps Map.
1434
+ *
1435
+ * @public
1436
+ */
1437
+ type FormKitTraps = Map<string | symbol, FormKitTrap>;
1438
+ /**
1439
+ * General "app" like configuration options, these are automatically inherited
1440
+ * by all children — they are not reactive.
1441
+ *
1442
+ * @public
1443
+ */
1444
+ interface FormKitConfig {
1445
+ /**
1446
+ * The delimiter character to use for a node’s tree address. By default this
1447
+ * is a dot `.`, but if you use dots in your input names you may want to
1448
+ * change this to something else.
1449
+ */
1450
+ delimiter: string;
1451
+ /**
1452
+ * Classes to apply on the various sections. These classes are applied after
1453
+ * rootClasses has already run.
1454
+ */
1455
+ classes?: Record<string, FormKitClasses | string | Record<string, boolean>>;
1456
+ /**
1457
+ * The rootClasses function is called to allocate the base layer of classes
1458
+ * for each section. These classes can be further extended or modified by the
1459
+ * classes config, classes prop, and section-class props.
1460
+ */
1461
+ rootClasses: ((sectionKey: string, node: FormKitNode) => Record<string, boolean>) | false;
1462
+ /**
1463
+ * A root config object. This object is usually the globally defined options.
1464
+ */
1465
+ rootConfig?: FormKitRootConfig;
1466
+ /**
1467
+ * The merge strategy is a map of names to merge strategies. The merge
1468
+ * strategy is used to determine how a node’s value should be merged if there
1469
+ * are 2 nodes with the same name.
1470
+ */
1471
+ mergeStrategy?: Record<string | symbol, 'synced'>;
1472
+ [index: string]: any;
1473
+ }
1474
+ /**
1475
+ * The user-land per-instance "props", which are generally akin to the props
1476
+ * passed into components on the front end.
1477
+ *
1478
+ * @public
1479
+ */
1480
+ type FormKitProps<V = unknown> = {
1481
+ /**
1482
+ * An instance of the current document’s root. When inside the context of a
1483
+ * custom element, this will be the ShadowRoot. In most other instances this
1484
+ * will be the Document. During SSR and other server-side contexts this will
1485
+ * be undefined.
1486
+ */
1487
+ __root?: Document | ShadowRoot;
1488
+ /**
1489
+ * An object or array of "props" that should be applied to the input. When
1490
+ * using Vue, these are pulled from the attrs and placed into the node.props
1491
+ * according to the definition provided here.
1492
+ */
1493
+ readonly __propDefs: FormKitPseudoProps;
1494
+ /**
1495
+ * The total amount of time in milliseconds to debounce the input before the
1496
+ * committing the value to the form tree.
1497
+ */
1498
+ delay: number;
1499
+ /**
1500
+ * The unique id of the input. These should *always* be globally unique.
1501
+ */
1502
+ id: string;
1503
+ /**
1504
+ * A function that defines how the validationLabel should be provided. By
1505
+ * default this is the validation-label, label, then name in decreasing
1506
+ * specificity.
1507
+ */
1508
+ validationLabelStrategy?: (node?: FormKitNode) => string;
1509
+ /**
1510
+ * An object of validation rules.
1511
+ */
1512
+ validationRules?: Record<string, (node: FormKitNode, ...args: any[]) => boolean | Promise<boolean>>;
1513
+ /**
1514
+ * An object of validation messages.
1515
+ */
1516
+ validationMessages?: Record<string, ((ctx: {
1517
+ name: string;
1518
+ args: any[];
1519
+ node: FormKitNode;
1520
+ }) => string) | string>;
1521
+ /**
1522
+ * The definition of the node’s input type (if it has one).
1523
+ */
1524
+ definition?: FormKitTypeDefinition<V>;
1525
+ /**
1526
+ * The framework’s context object. This is how FormKit’s core interacts with
1527
+ * the front end framework (Vue/React/etc). This object is created by the
1528
+ * component and is responsible for providing all the data to the framework
1529
+ * for rendering and interaction.
1530
+ */
1531
+ context?: FormKitFrameworkContext;
1532
+ /**
1533
+ * The merge strategy that is applied to this specific node. It can only be
1534
+ * inherited by a parent by using the mergeStrategy config option.
1535
+ */
1536
+ readonly mergeStrategy?: 'synced';
1537
+ [index: string]: any;
1538
+ } & FormKitConfig;
1539
+ /**
1540
+ * The interface of a FormKit node's context object. A FormKit node is a
1541
+ * proxy of this object.
1542
+ *
1543
+ * @public
1544
+ */
1545
+ interface FormKitContext {
1546
+ /**
1547
+ * A node’s internal disturbance counter.
1548
+ */
1549
+ _d: number;
1550
+ /**
1551
+ * A node’s internal event emitter.
1552
+ */
1553
+ _e: FormKitEventEmitter;
1554
+ /**
1555
+ * A unique identifier for a node.
1556
+ */
1557
+ uid: symbol;
1558
+ /**
1559
+ * A node’s internal disturbance counter promise.
1560
+ */
1561
+ _resolve: ((value: unknown) => void) | false;
1562
+ /**
1563
+ * A node’s internal input timeout.
1564
+ */
1565
+ _tmo: number | false;
1566
+ /**
1567
+ * A node’s internal pre-commit value.
1568
+ */
1569
+ _value: unknown;
1570
+ /**
1571
+ * An array of child nodes (groups and lists)
1572
+ */
1573
+ children: Array<FormKitNode | FormKitPlaceholderNode>;
1574
+ /**
1575
+ * Configuration state for a given tree.
1576
+ */
1577
+ config: FormKitConfig;
1578
+ /**
1579
+ * The context object of the current front end framework being used.
1580
+ */
1581
+ context?: FormKitFrameworkContext;
1582
+ /**
1583
+ * Set of hooks
1584
+ */
1585
+ hook: FormKitHooks;
1586
+ /**
1587
+ * Begins as false, set to true when the node is finished being created.
1588
+ */
1589
+ isCreated: boolean;
1590
+ /**
1591
+ * Boolean determines if the node is in a settled state or not.
1592
+ */
1593
+ isSettled: boolean;
1594
+ /**
1595
+ * A counting ledger for arbitrary message counters.
1596
+ */
1597
+ ledger: FormKitLedger;
1598
+ /**
1599
+ * The name of the input — should be treated as readonly.
1600
+ */
1601
+ name: string | symbol;
1602
+ /**
1603
+ * The parent of a node.
1604
+ */
1605
+ parent: FormKitNode | null;
1606
+ /**
1607
+ * A Set of plugins registered on this node that can be inherited by children.
1608
+ */
1609
+ plugins: Set<FormKitPlugin>;
1610
+ /**
1611
+ * An proxied object of props. These are typically provided by the adapter
1612
+ * of choice.
1613
+ */
1614
+ props: Partial<FormKitProps>;
1615
+ /**
1616
+ * A promise that resolves when an input is in a settled state.
1617
+ */
1618
+ settled: Promise<unknown>;
1619
+ /**
1620
+ * The internal node store.
1621
+ */
1622
+ store: FormKitStore;
1623
+ /**
1624
+ * The traps available to a node.
1625
+ */
1626
+ traps: FormKitTraps;
1627
+ /**
1628
+ * The type of node, should only be 'input', 'list', or 'group'.
1629
+ */
1630
+ type: FormKitNodeType;
1631
+ /**
1632
+ * Only used on list nodes, this flag determines whether or not the list
1633
+ * should sync its values with the underlying node children.
1634
+ */
1635
+ sync: boolean;
1636
+ /**
1637
+ * The actual value of the node.
1638
+ */
1639
+ value: unknown;
1640
+ }
1641
+ /**
1642
+ * Context object to be created by and used by each respective UI framework. No
1643
+ * values are created or output by FormKitCore, but this interface
1644
+ * should be followed by each respective plugin.
1645
+ *
1646
+ * @public
1647
+ */
1648
+ interface FormKitFrameworkContext<T = any> {
1649
+ [index: string]: unknown;
1650
+ /**
1651
+ * The current "live" value of the input. Not debounced.
1652
+ */
1653
+ _value: T;
1654
+ /**
1655
+ * The root document or shadow root the input is inside. This can be set by
1656
+ * using a higher-order `<FormKitRoot>` component.
1657
+ */
1658
+ __root?: Document | ShadowRoot;
1659
+ /**
1660
+ * An object of attributes that (generally) should be applied to the root
1661
+ * <input> element.
1662
+ */
1663
+ attrs: Record<string, any>;
1664
+ /**
1665
+ * Classes to apply on the various sections.
1666
+ */
1667
+ classes: Record<string, string>;
1668
+ /**
1669
+ * Event handlers.
1670
+ */
1671
+ handlers: {
1672
+ blur: (e?: FocusEvent) => void;
1673
+ touch: () => void;
1674
+ DOMInput: (e: Event) => void;
1675
+ } & Record<string, (...args: any[]) => void>;
1676
+ /**
1677
+ * Utility functions, generally for use in the input’s schema.
1678
+ */
1679
+ fns: Record<string, (...args: any[]) => any>;
1680
+ /**
1681
+ * The help text of the input.
1682
+ */
1683
+ help?: string;
1684
+ /**
1685
+ * The unique id of the input. Should also be applied as the id attribute.
1686
+ * This is generally required for accessibility reasons.
1687
+ */
1688
+ id: string;
1689
+ /**
1690
+ * An array of stable render keys for child nodes. Framework integrations use
1691
+ * these to iterate over children without relying on array position.
1692
+ */
1693
+ items: Array<string | symbol>;
1694
+ /**
1695
+ * The label of the input.
1696
+ */
1697
+ label?: string;
1698
+ /**
1699
+ * A list of messages to be displayed on the input. Often these are validation
1700
+ * messages and error messages, but other `visible` core node messages do also
1701
+ * apply here. This object is only populated when the validation should be
1702
+ * actually displayed.
1703
+ */
1704
+ messages: Record<string, FormKitMessage>;
1705
+ /**
1706
+ * The core node of this input.
1707
+ */
1708
+ node: FormKitNode;
1709
+ /**
1710
+ * If this input type accepts options (like select lists and checkboxes) then
1711
+ * this will be populated with a properly structured list of options.
1712
+ */
1713
+ options?: Array<Record<string, any> & {
1714
+ label: string;
1715
+ value: any;
1716
+ }>;
1717
+ /**
1718
+ * Whether or not to render messages in the standard location.
1719
+ */
1720
+ defaultMessagePlacement: boolean;
1721
+ /**
1722
+ * A record of slots that have been passed into the top level component
1723
+ * responsible for creating the node.
1724
+ */
1725
+ slots: Record<string, CallableFunction>;
1726
+ /**
1727
+ * A collection of state trackers/details about the input.
1728
+ */
1729
+ state: FormKitFrameworkContextState;
1730
+ /**
1731
+ * The type of input "text" or "select" (retrieved from node.props.type). This
1732
+ * is not the core node type (input, group, or list).
1733
+ */
1734
+ type: string;
1735
+ /**
1736
+ * Translated ui messages that are not validation related. These are generally
1737
+ * used for interface messages like "loading" or "saving".
1738
+ */
1739
+ ui: Record<string, FormKitMessage>;
1740
+ /**
1741
+ * The current committed value of the input. This is the value that should be
1742
+ * used for most use cases.
1743
+ */
1744
+ value: T;
1745
+ }
1746
+ /**
1747
+ * The state inside a node’s framework context. Usually used to track things
1748
+ * like blurred and validity states.
1749
+ *
1750
+ * @public
1751
+ */
1752
+ interface FormKitFrameworkContextState {
1753
+ /**
1754
+ * If the input has been blurred.
1755
+ */
1756
+ blurred: boolean;
1757
+ /**
1758
+ * True when these conditions are met:
1759
+ *
1760
+ * Either:
1761
+ * - The input has validation rules
1762
+ * - The validation rules are all passing
1763
+ * - There are no errors on the input
1764
+ * Or:
1765
+ * - The input has no validation rules
1766
+ * - The input has no errors
1767
+ * - The input is dirty and has a value
1768
+ *
1769
+ * This is not intended to be used on forms/groups/lists but instead on
1770
+ * individual inputs. Imagine placing a green checkbox next to each input
1771
+ * when the user filled it out correctly — thats what these are for.
1772
+ */
1773
+ complete: boolean;
1774
+ /**
1775
+ * If the input has had a value typed into it or a change made to it.
1776
+ */
1777
+ dirty: boolean;
1778
+ /**
1779
+ * If the input has explicit errors placed on it, or in the case of a group,
1780
+ * list, or form, this is true if any children have errors on them.
1781
+ */
1782
+ errors: boolean;
1783
+ /**
1784
+ * Determines if the input should be considered "invalid" — note that this
1785
+ * is not the opposite of the valid state. A valid input is one where the
1786
+ * input is not loading, not pending validation, not unsettled, and
1787
+ * passes all validation rules. An invalid input is one whose validation
1788
+ * rules are not explicitly not passing, and those rules are visible to the user.
1789
+ */
1790
+ invalid: boolean;
1791
+ /**
1792
+ * Whether or not the input includes the "required" validation rule. This rule
1793
+ * is uniquely called out for accessibility reasons and should be used to
1794
+ * power the `aria-required` attribute.
1795
+ */
1796
+ required: boolean;
1797
+ /**
1798
+ * True when the input has validation rules. Has nothing to do with the
1799
+ * state of those validation rules.
1800
+ */
1801
+ rules: boolean;
1802
+ /**
1803
+ * True when the input has completed its internal debounce cycle and the
1804
+ * value was committed to the form.
1805
+ */
1806
+ settled: boolean;
1807
+ /**
1808
+ * If the form has been submitted.
1809
+ */
1810
+ submitted: boolean;
1811
+ /**
1812
+ * If the input (or group/form/list) is passing all validation rules. In
1813
+ * the case of groups, forms, and lists this includes the validation state
1814
+ * of all its children.
1815
+ */
1816
+ valid: boolean;
1817
+ /**
1818
+ * If the validation-visibility has been satisfied and any validation
1819
+ * messages should be displayed.
1820
+ */
1821
+ validationVisible: boolean;
1822
+ /**
1823
+ * Allow users to add their own arbitrary states.
1824
+ */
1825
+ [index: string]: boolean;
1826
+ }
1827
+ /**
1828
+ * Options that can be used to instantiate a new node via `createNode()`.
1829
+ *
1830
+ * @public
1831
+ */
1832
+ /**
1833
+ * The callback type for node.each().
1834
+ *
1835
+ * @public
1836
+ */
1837
+ interface FormKitChildCallback {
1838
+ (child: FormKitNode): any;
1839
+ }
1840
+ /**
1841
+ * A descriptor of a child value, generally passed up a node tree.
1842
+ *
1843
+ * @public
1844
+ */
1845
+ interface FormKitChildValue {
1846
+ name: string | number | symbol;
1847
+ value: any;
1848
+ from?: number | symbol;
1849
+ }
1850
+ /**
1851
+ * An empty interface for adding FormKit node extensions.
1852
+ * @public
1853
+ */
1854
+ interface FormKitNodeExtensions {}
1855
+ /**
1856
+ * FormKit's Node object produced by createNode(). Every `<FormKit />` input has
1857
+ * 1 FormKitNode ("core node") associated with it. All inputs, forms, and groups
1858
+ * are instances of nodes. Read more about core nodes in the
1859
+ * {@link https://formkit.com/essentials/architecture#node | architecture
1860
+ * documentation.}
1861
+ *
1862
+ * @param add -
1863
+ * Add a child to a node. The node must be a group or list.
1864
+ *
1865
+ * #### Signature
1866
+ *
1867
+ * ```typescript
1868
+ * add: (node: FormKitNode, index?: number) => FormKitNode
1869
+ * ```
1870
+ *
1871
+ * #### Parameters
1872
+ *
1873
+ * - node — A {@link FormKitNode | FormKitNode}.
1874
+ * - index *optional* — A index to where it will added to.
1875
+ *
1876
+ * #### Returns
1877
+ *
1878
+ * The added {@link FormKitNode | FormKitNode}.
1879
+ *
1880
+ * @param address -
1881
+ * The address of the current node from the root of the tree.
1882
+ *
1883
+ * #### Signature
1884
+ *
1885
+ * ```typescript
1886
+ * address: FormKitAddress
1887
+ * ```
1888
+ *
1889
+ * #### Returns
1890
+ *
1891
+ * A {@link FormKitAddress | FormKitAddress}.
1892
+ *
1893
+ * @param addProps -
1894
+ * Adds props to the given node by removing them from node.props.attrs and
1895
+ * moving them to the top-level node.props object.
1896
+ *
1897
+ * #### Signature
1898
+ *
1899
+ * ```typescript
1900
+ * addProps: (props: string[]) => FormKitNode
1901
+ * ```
1902
+ *
1903
+ * #### Parameters
1904
+ *
1905
+ * - `props` — An array of strings to be added as keys for props.
1906
+ *
1907
+ * #### Returns
1908
+ *
1909
+ * The {@link FormKitNode | FormKitNode}.
1910
+ *
1911
+ * @param at -
1912
+ * Gets a node at another address. Addresses are dot-syntax paths (or arrays) of node names.
1913
+ * For example: `form.users.0.first_name`. There are a few "special" traversal tokens as well:
1914
+ *
1915
+ * - `$root` — Selects the root node.
1916
+ * - `$parent` — Selects the parent node.
1917
+ * - `$self` — Selects the current node.
1918
+ *
1919
+ * #### Signature
1920
+ *
1921
+ * ```typescript
1922
+ * at: (address: FormKitAddress | '$root' | '$parent' | '$self' | (string & {})) => FormKitNode | undefined
1923
+ * ```
1924
+ *
1925
+ * #### Parameters
1926
+ *
1927
+ * - `address` — An valid string or {@link FormKitAddress | FormKitAddress}.
1928
+ *
1929
+ * #### Returns
1930
+ *
1931
+ * The found {@link FormKitNode | FormKitNode} or `undefined`.
1932
+ *
1933
+ * @param children -
1934
+ * An array of child nodes (groups and lists).
1935
+ *
1936
+ * #### Signature
1937
+ *
1938
+ * ```typescript
1939
+ * children: Array<FormKitNode>
1940
+ * ```
1941
+ *
1942
+ * #### Returns
1943
+ *
1944
+ * An array of {@link FormKitNode | FormKitNode}.
1945
+ *
1946
+ * @param clearErrors -
1947
+ * Clears the errors of the node, and optionally all the children.
1948
+ *
1949
+ * #### Signature
1950
+ *
1951
+ * ```typescript
1952
+ * clearErrors: (clearChildren?: boolean, sourceKey?: string) => FormKitNode
1953
+ * ```
1954
+ *
1955
+ * #### Parameters
1956
+ *
1957
+ * - `clearChildren` *optional* — If it should clear the children.
1958
+ * - `sourceKey` *optional* — A source key to use for reset.
1959
+ *
1960
+ * #### Returns
1961
+ *
1962
+ * The {@link FormKitNode | FormKitNode}.
1963
+ *
1964
+ * @param config -
1965
+ * An object of {@link FormKitConfig | FormKitConfig} that is shared tree-wide
1966
+ * with various configuration options that should be applied to the entire tree.
1967
+ *
1968
+ * #### Signature
1969
+ *
1970
+ * ```typescript
1971
+ * config: FormKitConfig
1972
+ * ```
1973
+ *
1974
+ * #### Returns
1975
+ *
1976
+ * A {@link FormKitConfig | FormKitConfig}.
1977
+ *
1978
+ * @param define -
1979
+ * Defines the current input's library type definition including node type,
1980
+ * schema, and props.
1981
+ *
1982
+ * #### Signature
1983
+ *
1984
+ * ```typescript
1985
+ * define: (definition: FormKitTypeDefinition) => void
1986
+ * ```
1987
+ *
1988
+ * #### Parameters
1989
+ *
1990
+ * - `definition` — A {@link FormKitTypeDefinition | FormKitTypeDefinition}.
1991
+ *
1992
+ * @param destroy -
1993
+ * Removes the node from the global registry, its parent, and emits the
1994
+ * 'destroying' event.
1995
+ *
1996
+ * #### Signature
1997
+ *
1998
+ * ```typescript
1999
+ * destroy: () => void
2000
+ * ```
2001
+ *
2002
+ * @param each -
2003
+ * Perform given callback on each of the given node's children.
2004
+ *
2005
+ * #### Signature
2006
+ *
2007
+ * ```typescript
2008
+ * each: (callback: FormKitChildCallback) => void
2009
+ * ```
2010
+ *
2011
+ * #### Parameters
2012
+ *
2013
+ * - `callback` — A {@link FormKitChildCallback | FormKitChildCallback} to be called for each child.
2014
+ *
2015
+ * @param emit -
2016
+ * Emit an event from the node so it can be listened by {@link FormKitNode | on}.
2017
+ *
2018
+ * #### Signature
2019
+ *
2020
+ * ```typescript
2021
+ * emit: (event: string, payload?: any, bubble?: boolean, meta: Record<string, unknown>) => FormKitNode
2022
+ * ```
2023
+ *
2024
+ * #### Parameters
2025
+ *
2026
+ * - `event` — The event name to be emitted.
2027
+ * - `payload` *optional* — A value to be passed together with the event.
2028
+ * - `bubble` *optional* — If the event should bubble to the parent.
2029
+ *
2030
+ * #### Returns
2031
+ *
2032
+ * The {@link FormKitNode | FormKitNode}.
2033
+ *
2034
+ * @param extend -
2035
+ * Extend a {@link FormKitNode | FormKitNode} by adding arbitrary properties
2036
+ * that are accessible via `node.{property}()`.
2037
+ *
2038
+ * #### Signature
2039
+ *
2040
+ * ```typescript
2041
+ * extend: (property: string, trap: FormKitTrap) => FormKitNode
2042
+ * ```
2043
+ *
2044
+ * #### Parameters
2045
+ *
2046
+ * - `property` — The property to add the core node (`node.{property}`).
2047
+ * - `trap` — An object with a get and set property.
2048
+ *
2049
+ * #### Returns
2050
+ *
2051
+ * The {@link FormKitNode | FormKitNode}.
2052
+ *
2053
+ * @param find -
2054
+ * Within a given tree, find a node matching a given selector. Selectors can be simple strings or a function.
2055
+ *
2056
+ * #### Signature
2057
+ *
2058
+ * ```typescript
2059
+ * find: (
2060
+ * selector: string,
2061
+ * searcher?: keyof FormKitNode | FormKitSearchFunction
2062
+ * ) => FormKitNode | undefined
2063
+ * ```
2064
+ *
2065
+ * #### Parameters
2066
+ *
2067
+ * - `selector` — A selector string.
2068
+ * - `searcher` *optional* — A keyof {@link FormKitNode | FormKitNode} or {@link FormKitSearchFunction | FormKitSearchFunction}.
2069
+ *
2070
+ * #### Returns
2071
+ *
2072
+ * The found {@link FormKitNode | FormKitNode} or `undefined`.
2073
+ *
2074
+ * @param hook -
2075
+ * Set of hooks.
2076
+ *
2077
+ * #### Signature
2078
+ *
2079
+ * ```typescript
2080
+ * hook: FormKitHooks
2081
+ * ```
2082
+ *
2083
+ * #### Returns
2084
+ *
2085
+ * The {@link FormKitHooks | FormKitHooks}.
2086
+ *
2087
+ * @param index -
2088
+ * The index of a node compared to its siblings. This is only applicable in cases where a node is a child of a list.
2089
+ *
2090
+ * #### Signature
2091
+ *
2092
+ * ```typescript
2093
+ * index: number
2094
+ * ```
2095
+ *
2096
+ * #### Returns
2097
+ *
2098
+ * A `number`.
2099
+ *
2100
+ * @param input -
2101
+ * The function used to set the value of a node. All changes to a node's value
2102
+ * should use this function as it ensures the tree's state is always fully tracked.
2103
+ *
2104
+ * #### Signature
2105
+ *
2106
+ * ```typescript
2107
+ * input: (value: unknown, async?: boolean) => Promise<unknown>
2108
+ * ```
2109
+ *
2110
+ * #### Parameters
2111
+ *
2112
+ * - `value` — Any value to used for the node.
2113
+ * - `async` *optional* — If the input should happen asynchronously.
2114
+ *
2115
+ * #### Returns
2116
+ *
2117
+ * A `Promise<unknown>`.
2118
+ *
2119
+ * @param isCreated -
2120
+ * Begins as false, set to true when the node is finished being created.
2121
+ *
2122
+ * #### Signature
2123
+ *
2124
+ * ```typescript
2125
+ * isCreated: boolean
2126
+ * ```
2127
+ *
2128
+ * #### Returns
2129
+ *
2130
+ * A `boolean`.
2131
+ *
2132
+ * @param isSettled -
2133
+ * Boolean reflecting the settlement state of the node and its subtree.
2134
+ *
2135
+ * #### Signature
2136
+ *
2137
+ * ```typescript
2138
+ * isSettled: boolean
2139
+ * ```
2140
+ *
2141
+ * #### Returns
2142
+ *
2143
+ * A `boolean`.
2144
+ *
2145
+ * @param ledger -
2146
+ * A counting ledger for arbitrary message counters.
2147
+ *
2148
+ * #### Signature
2149
+ *
2150
+ * ```typescript
2151
+ * ledger: FormKitLedger
2152
+ * ```
2153
+ *
2154
+ * #### Returns
2155
+ *
2156
+ * A {@link FormKitLedger | FormKitLedger}.
2157
+ *
2158
+ * @param name -
2159
+ * The name of the input in the node tree. When a node is a child of a list,
2160
+ * this automatically becomes its index.
2161
+ *
2162
+ * #### Signature
2163
+ *
2164
+ * ```typescript
2165
+ * name: string
2166
+ * ```
2167
+ *
2168
+ * #### Returns
2169
+ *
2170
+ * A `string`.
2171
+ *
2172
+ * @param off -
2173
+ * Removes an event listener by its token.
2174
+ * Receipts can be shared among many event listeners by explicitly declaring the "receipt" property of the listener function.
2175
+ *
2176
+ * #### Signature
2177
+ *
2178
+ * ```typescript
2179
+ * off: (receipt: string) => FormKitNode
2180
+ * ```
2181
+ *
2182
+ * #### Parameters
2183
+ *
2184
+ * - `receipt` — A receipt generated by the `on` function.
2185
+ *
2186
+ * #### Returns
2187
+ *
2188
+ * A receipt `string`.
2189
+ *
2190
+ * @param on -
2191
+ * Adds an event listener for a given event, and returns a "receipt" which is a random string token.
2192
+ * This token should be used to remove the listener in the future.
2193
+ * Alternatively you can assign a "receipt" property to the listener function and that receipt will be used instead.
2194
+ * This allows multiple listeners to all be de-registered with a single off() call if they share the same receipt.
2195
+ *
2196
+ * #### Signature
2197
+ *
2198
+ * ```typescript
2199
+ * on: (eventName: string, listener: FormKitEventListener, pos: 'push' | 'unshift') => string
2200
+ * ```
2201
+ *
2202
+ * #### Parameters
2203
+ *
2204
+ * - `eventName` — The event name to listen to.
2205
+ * - `listener` — A {@link FormKitEventListener | FormKitEventListener} to run when the event happens.
2206
+ *
2207
+ * #### Returns
2208
+ *
2209
+ * A receipt `string`.
2210
+ *
2211
+ * @param parent -
2212
+ * The parent of a node.
2213
+ *
2214
+ * #### Signature
2215
+ *
2216
+ * ```typescript
2217
+ * parent: FormKitNode | null
2218
+ * ```
2219
+ *
2220
+ * #### Returns
2221
+ *
2222
+ * If found a {@link FormKitNode | FormKitNode} or `null`.
2223
+ *
2224
+ * @param props -
2225
+ * An proxied object of props. These are typically provided by the adapter
2226
+ * of choice.
2227
+ *
2228
+ * #### Signature
2229
+ *
2230
+ * ```typescript
2231
+ * props: Partial<FormKitProps>
2232
+ * ```
2233
+ *
2234
+ * #### Returns
2235
+ *
2236
+ * An optional list of {@link FormKitProps | FormKitProps}.
2237
+ *
2238
+ * @param remove -
2239
+ * Removes a child from the node.
2240
+ *
2241
+ * #### Signature
2242
+ *
2243
+ * ```typescript
2244
+ * remove: (node: FormKitNode) => FormKitNode
2245
+ * ```
2246
+ *
2247
+ * #### Parameters
2248
+ *
2249
+ * - `node` — A {@link FormKitNode | FormKitNode} to be removed.
2250
+ *
2251
+ * #### Returns
2252
+ *
2253
+ * The {@link FormKitNode | FormKitNode}.
2254
+ *
2255
+ * @param reset -
2256
+ * Resets the node’s value back to its original value.
2257
+ *
2258
+ * #### Signature
2259
+ *
2260
+ * ```typescript
2261
+ * reset: () => FormKitNode
2262
+ * ```
2263
+ *
2264
+ * #### Returns
2265
+ *
2266
+ * The {@link FormKitNode | FormKitNode}.
2267
+ *
2268
+ * @param root -
2269
+ * Retrieves the root node of a tree. This is accomplished via tree-traversal
2270
+ * on-request, and as such should not be used in frequently called functions.
2271
+ *
2272
+ * #### Signature
2273
+ *
2274
+ * ```typescript
2275
+ * root: FormKitNode
2276
+ * ```
2277
+ *
2278
+ * #### Returns
2279
+ *
2280
+ * The {@link FormKitNode | FormKitNode}.
2281
+ *
2282
+ * @param setErrors -
2283
+ * Sets errors on the input, and optionally to child inputs.
2284
+ *
2285
+ * #### Signature
2286
+ *
2287
+ * ```typescript
2288
+ * setErrors: (localErrors: ErrorMessages, childErrors?: ErrorMessages) => void
2289
+ * ```
2290
+ *
2291
+ * #### Parameters
2292
+ *
2293
+ * - `localErrors` — A {@link ErrorMessages | ErrorMessages} to be used.
2294
+ * - `childErrors` *optional* — A {@link ErrorMessages | ErrorMessages} to be used for children.
2295
+ *
2296
+ * @param settled -
2297
+ * A promise that resolves when a node and its entire subtree is settled.
2298
+ * In other words — all the inputs are done committing their values.
2299
+ *
2300
+ * #### Signature
2301
+ *
2302
+ * ```typescript
2303
+ * settled: Promise<unknown>
2304
+ * ```
2305
+ *
2306
+ * #### Returns
2307
+ *
2308
+ * A `Promise<unknown>`.
2309
+ *
2310
+ * @param store -
2311
+ * The internal node store.
2312
+ *
2313
+ * #### Signature
2314
+ *
2315
+ * ```typescript
2316
+ * store: FormKitStore
2317
+ * ```
2318
+ *
2319
+ * #### Returns
2320
+ *
2321
+ * A {@link FormKitStore | FormKitStore}.
2322
+ *
2323
+ * @param submit -
2324
+ * Triggers a submit event on the nearest form.
2325
+ *
2326
+ * #### Signature
2327
+ *
2328
+ * ```typescript
2329
+ * submit: () => void
2330
+ * ```
2331
+ *
2332
+ * @param t -
2333
+ * A text or translation function that exposes a given string to the "text"
2334
+ * hook. All text shown to users should be passed through this function
2335
+ * before being displayed — especially for core and plugin authors.
2336
+ *
2337
+ * #### Signature
2338
+ *
2339
+ * ```typescript
2340
+ * t: (key: string | FormKitTextFragment) => string
2341
+ * ```
2342
+ *
2343
+ * #### Parameters
2344
+ *
2345
+ * - `key` — A key or a {@link FormKitTextFragment | FormKitTextFragment} to find the translation for.
2346
+ *
2347
+ * #### Returns
2348
+ *
2349
+ * The translated `string`.
2350
+ *
2351
+ * @param type -
2352
+ * The type of node, should only be 'input', 'list', or 'group'.
2353
+ *
2354
+ * #### Signature
2355
+ *
2356
+ * ```typescript
2357
+ * type: FormKitNodeType
2358
+ * ```
2359
+ *
2360
+ * #### Returns
2361
+ *
2362
+ * A {@link FormKitNodeType | FormKitNodeType}.
2363
+ *
2364
+ * @param use -
2365
+ * Registers a new plugin on the node and its subtree.
2366
+ *
2367
+ * #### Signature
2368
+ *
2369
+ * ```typescript
2370
+ * use: (
2371
+ * plugin: FormKitPlugin | FormKitPlugin[] | Set<FormKitPlugin>,
2372
+ * run?: boolean,
2373
+ * library?: boolean
2374
+ * ) => FormKitNode
2375
+ * ```
2376
+ *
2377
+ * #### Parameters
2378
+ *
2379
+ * - `plugin` — A {@link FormKitPlugin | FormKitPlugin} or an Array or Set of {@link FormKitPlugin | FormKitPlugin}.
2380
+ * - `run` *optional* — Should the plugin be executed on creation.
2381
+ * - `library` *optional* — Should the plugin's library function be executed on creation.
2382
+ *
2383
+ * #### Returns
2384
+ *
2385
+ * The {@link FormKitNode | FormKitNode}.
2386
+ *
2387
+ * @param value -
2388
+ * The value of the input. This should never be directly modified. Any
2389
+ * desired mutations should be made through {@link FormKitNode | input}.
2390
+ *
2391
+ * #### Signature
2392
+ *
2393
+ * ```typescript
2394
+ * readonly value: unknown
2395
+ * ```
2396
+ *
2397
+ * @param walk -
2398
+ * Performs a function on every node in its subtree (but not the node itself).
2399
+ * This is an expensive operation so it should be done very rarely and only lifecycle events that are relatively rare like boot up and shut down.
2400
+ *
2401
+ * #### Signature
2402
+ *
2403
+ * ```typescript
2404
+ * walk: (callback: FormKitChildCallback, stopOnFalse?: boolean, recurseOnFalse?: boolean) => void
2405
+ * ```
2406
+ *
2407
+ * #### Parameters
2408
+ *
2409
+ * - `callback` — A {@link FormKitChildCallback | FormKitChildCallback} to be executed for each child.
2410
+ * - `stopOnFalse` *optional* — If it should stop when the return is false.
2411
+ *
2412
+ * @public
2413
+ */
2414
+ type FormKitNode<V = unknown> = {
2415
+ /**
2416
+ * Boolean true indicating this object is a valid FormKitNode
2417
+ */
2418
+ readonly __FKNode__: true;
2419
+ /**
2420
+ * The value of the input. This should never be directly modified. Any
2421
+ * desired mutations should be made through node.input()
2422
+ */
2423
+ readonly value: V;
2424
+ /**
2425
+ * The internal FormKitContext object — this is not a public API and should
2426
+ * never be used outside of the core package itself. It is only here for
2427
+ * internal use and as an escape hatch.
2428
+ */
2429
+ _c: FormKitContext;
2430
+ /**
2431
+ * Add a child to a node, the node must be a group or list.
2432
+ */
2433
+ add: (node: FormKitNode, index?: number) => FormKitNode;
2434
+ /**
2435
+ * Adds props to the given node by removing them from node.props.attrs and
2436
+ * moving them to the top-level node.props object.
2437
+ */
2438
+ addProps: (props: FormKitPseudoProps) => FormKitNode;
2439
+ /**
2440
+ * Gets a node at another address. Addresses are dot-syntax paths (or arrays)
2441
+ * of node names. For example: form.users.0.first_name. There are a few
2442
+ * "special" traversal tokens as well:
2443
+ * - $root - Selects the root node
2444
+ * - $parent - Selects the parent node
2445
+ * - $self — Selects the current node
2446
+ */
2447
+ at: (address: FormKitAddress | '$root' | '$parent' | '$self' | (string & {})) => FormKitNode | undefined;
2448
+ /**
2449
+ * The address of the current node from the root of the tree.
2450
+ */
2451
+ address: FormKitAddress;
2452
+ /**
2453
+ * An internal function used to bubble an event from a child to a parent.
2454
+ */
2455
+ bubble: (event: FormKitEvent) => FormKitNode;
2456
+ /**
2457
+ * An internal mechanism for calming a disturbance — which is a mechanism
2458
+ * used to know the state of input settlement in the tree.
2459
+ */
2460
+ calm: (childValue?: FormKitChildValue) => FormKitNode;
2461
+ /**
2462
+ * Clears the errors of the node, and optionally all the children.
2463
+ */
2464
+ clearErrors: (clearChildren?: boolean, sourceKey?: string) => FormKitNode;
2465
+ /**
2466
+ * An object that is shared tree-wide with various configuration options that
2467
+ * should be applied to the entire tree.
2468
+ */
2469
+ config: FormKitConfig;
2470
+ /**
2471
+ * Defines the current input's library type definition — including node type,
2472
+ * schema, and props.
2473
+ */
2474
+ define: (definition: FormKitTypeDefinition<V>) => void;
2475
+ /**
2476
+ * Increments a disturbance. A disturbance is a record that the input or a
2477
+ * member of its subtree is no longer "settled". Disturbed nodes are ones
2478
+ * that have had their value modified, but have not yet committed that value
2479
+ * to the rest of the tree.
2480
+ */
2481
+ disturb: () => FormKitNode;
2482
+ /**
2483
+ * Removes the node from the global registry, its parent, and emits the
2484
+ * 'destroying' event.
2485
+ */
2486
+ destroy: () => void;
2487
+ /**
2488
+ * Perform given callback on each of the given node's children.
2489
+ */
2490
+ each: (callback: FormKitChildCallback) => void;
2491
+ /**
2492
+ * Emit an event from the node.
2493
+ */
2494
+ emit: (event: string, payload?: any, bubble?: boolean, meta?: Record<string, unknown>) => FormKitNode;
2495
+ /**
2496
+ * Extend the core node by giving it a key and a trap.
2497
+ */
2498
+ extend: (key: string, trap: FormKitTrap) => FormKitNode;
2499
+ /**
2500
+ * Within a given tree, find a node matching a given selector. Selectors
2501
+ * can be simple strings or a function.
2502
+ */
2503
+ find: (selector: string, searcher?: keyof FormKitNode | FormKitSearchFunction) => FormKitNode | undefined;
2504
+ /**
2505
+ * An internal mechanism to hydrate values down a node tree.
2506
+ */
2507
+ hydrate: () => FormKitNode;
2508
+ /**
2509
+ * The index of a node compared to its siblings. This is only applicable in
2510
+ * cases where a node is a child of a list.
2511
+ */
2512
+ index: number;
2513
+ /**
2514
+ * The function used to set the value of a node. All changes to a node's value
2515
+ * should use this function as it ensures the tree's state is always fully
2516
+ * tracked.
2517
+ */
2518
+ input: (value: unknown, async?: boolean) => Promise<unknown>;
2519
+ /**
2520
+ * The name of the input in the node tree. When a node is a child of a list,
2521
+ * this automatically becomes its index.
2522
+ */
2523
+ name: string;
2524
+ /**
2525
+ * Adds an event listener for a given event, and returns a "receipt" which is
2526
+ * a random string token. This token should be used to remove the listener
2527
+ * in the future. Alternatively you can assign a "receipt" property to the
2528
+ * listener function and that receipt will be used instead — this allows
2529
+ * multiple listeners to all be de-registered with a single off() call if they
2530
+ * share the same receipt.
2531
+ */
2532
+ on: (eventName: string, listener: FormKitEventListener, pos?: 'push' | 'unshift') => string;
2533
+ /**
2534
+ * Removes an event listener by its token. Receipts can be shared among many
2535
+ * event listeners by explicitly declaring the "receipt" property of the
2536
+ * listener function.
2537
+ */
2538
+ off: (receipt: string) => FormKitNode;
2539
+ /**
2540
+ * Remove a child from a node.
2541
+ */
2542
+ remove: (node: FormKitNode | FormKitPlaceholderNode) => FormKitNode;
2543
+ /**
2544
+ * Retrieves the root node of a tree. This is accomplished via tree-traversal
2545
+ * on-request, and as such should not be used in frequently called functions.
2546
+ */
2547
+ root: FormKitNode;
2548
+ /**
2549
+ * Resets the configuration of a node.
2550
+ */
2551
+ resetConfig: () => void;
2552
+ /**
2553
+ * Reset a node’s value back to its original value.
2554
+ */
2555
+ reset: (value?: unknown) => FormKitNode;
2556
+ /**
2557
+ * Sets errors on the input, and optionally to child inputs.
2558
+ */
2559
+ setErrors: (localErrors: ErrorMessages, childErrors?: ErrorMessages) => void;
2560
+ /**
2561
+ * A promise that resolves when a node and its entire subtree is settled.
2562
+ * In other words — all the inputs are done committing their values.
2563
+ */
2564
+ settled: Promise<unknown>;
2565
+ /**
2566
+ * Triggers a submit event on the nearest form.
2567
+ */
2568
+ submit: () => void;
2569
+ /**
2570
+ * A text or translation function that exposes a given string to the "text"
2571
+ * hook. All text shown to users should be passed through this function
2572
+ * before being displayed — especially for core and plugin authors.
2573
+ */
2574
+ t: (key: string | FormKitTextFragment) => string;
2575
+ /**
2576
+ * Boolean reflecting the settlement state of the node and its subtree.
2577
+ */
2578
+ isSettled: boolean;
2579
+ /**
2580
+ * A unique identifier for the node.
2581
+ */
2582
+ uid: symbol;
2583
+ /**
2584
+ * Registers a new plugin on the node and its subtree.
2585
+ * run = should the plugin be executed or not
2586
+ * library = should the plugin's library function be executed (if there)
2587
+ */
2588
+ use: (plugin: FormKitPlugin | FormKitPlugin[] | Set<FormKitPlugin>, run?: boolean, library?: boolean) => FormKitNode;
2589
+ /**
2590
+ * Performs a function on every node in the subtree (not itself). This is an
2591
+ * expensive operation so it should be done very rarely and only lifecycle
2592
+ * events that are relatively rare like boot up and shut down.
2593
+ */
2594
+ walk: (callback: FormKitChildCallback, stopOnFalse?: boolean, skipSubtreeOnFalse?: boolean) => void;
2595
+ } & Omit<FormKitContext, 'value' | 'name' | 'config'> & FormKitNodeExtensions;
2596
+ /**
2597
+ * A faux node that is used as a placeholder in the children node array during
2598
+ * various node manipulations.
2599
+ * @public
2600
+ */
2601
+ interface FormKitPlaceholderNode<V = unknown> {
2602
+ /**
2603
+ * Flag indicating this is a placeholder.
2604
+ */
2605
+ __FKP: true;
2606
+ /**
2607
+ * A unique symbol identifying this placeholder.
2608
+ */
2609
+ uid: symbol;
2610
+ /**
2611
+ * The type of placeholder node, if relevant.
2612
+ */
2613
+ type: FormKitNodeType;
2614
+ /**
2615
+ * A value at the placeholder location.
2616
+ */
2617
+ value: V;
2618
+ /**
2619
+ * The uncommitted value, in a placeholder will always be the same
2620
+ * as the value.
2621
+ */
2622
+ _value: V;
2623
+ /**
2624
+ * Artificially use a plugin (performs no-op)
2625
+ */
2626
+ use: (...args: any[]) => void;
2627
+ /**
2628
+ * Artificial props
2629
+ */
2630
+ props: Record<string, any>;
2631
+ /**
2632
+ * A name to use.
2633
+ */
2634
+ name: string;
2635
+ /**
2636
+ * Sets the value of the placeholder.
2637
+ */
2638
+ input: (value: unknown, async?: boolean) => Promise<unknown>;
2639
+ /**
2640
+ * A placeholder is always settled.
2641
+ */
2642
+ isSettled: boolean;
2643
+ }
2644
+ /**
2645
+ * A prop definition for a pseudo prop that defines a type and a default value.
2646
+ * @public
2647
+ */
2648
+ type FormKitPseudoProp = {
2649
+ boolean?: true;
2650
+ default?: boolean;
2651
+ setter?: undefined;
2652
+ getter?: undefined;
2653
+ } | {
2654
+ boolean?: undefined;
2655
+ default?: unknown;
2656
+ setter?: (value: unknown, node: FormKitNode) => unknown;
2657
+ getter?: (value: unknown, node: FormKitNode) => unknown;
2658
+ };
2659
+ /**
2660
+ * Pseudo props are "non-runtime" props. Props that are not initially declared
2661
+ * as props, and are fetch out of the attrs object (in the context of VueJS).
2662
+ * @public
2663
+ */
2664
+ type FormKitPseudoProps = string[] | Record<PropertyKey, FormKitPseudoProp>;
2665
+ /**
2666
+ * Breadth and depth-first searches can use a callback of this notation.
2667
+ *
2668
+ * @public
2669
+ */
2670
+ type FormKitSearchFunction = (node: FormKitNode, searchTerm?: string | number) => boolean;
2671
+ /**
2672
+ * If a node’s name is set to useIndex, it replaces the node’s name with the
2673
+ * index of the node relative to its parent’s children.
2674
+ *
2675
+ * @internal
2676
+ */
2677
+ //#endregion
879
2678
  //#region src/plugin/types/user-tab.d.ts
880
2679
  /**
881
2680
  * Defines a custom tab for the user detail page in the console.
@@ -992,6 +2791,18 @@ interface RouteRecordAppend {
992
2791
  */
993
2792
  route: RouteRecordRaw;
994
2793
  }
2794
+ /**
2795
+ * FormKit-related extensions provided by a UI plugin.
2796
+ */
2797
+ interface PluginFormKit {
2798
+ /**
2799
+ * Custom FormKit input definitions registered when the plugin is activated.
2800
+ *
2801
+ * @remarks
2802
+ * The key is the FormKit input type used by `$formkit` in schemas.
2803
+ */
2804
+ inputs?: Record<string, FormKitTypeDefinition>;
2805
+ }
995
2806
  /**
996
2807
  * Defines extension points that plugins can hook into to extend Halo's functionality.
997
2808
  * Extension points follow a naming convention: `<feature>:<action>:<operation>`.
@@ -1217,6 +3028,10 @@ interface ExtensionPoint {
1217
3028
  * @see https://docs.halo.run/developer-guide/plugin/basics/ui/entry
1218
3029
  */
1219
3030
  interface PluginModule {
3031
+ /**
3032
+ * FormKit integrations provided by the plugin.
3033
+ */
3034
+ formkit?: PluginFormKit;
1220
3035
  /**
1221
3036
  * Components that will be globally registered when the plugin is activated.
1222
3037
  * These components can be used throughout the Halo console without explicit imports.
@@ -1385,7 +3200,7 @@ interface StartupStep {
1385
3200
  tags: Tag[];
1386
3201
  parentId?: number;
1387
3202
  }
1388
- interface Event {
3203
+ interface Event$1 {
1389
3204
  endTime: Date;
1390
3205
  duration: string;
1391
3206
  startTime: Date;
@@ -1393,7 +3208,7 @@ interface Event {
1393
3208
  }
1394
3209
  interface Timeline {
1395
3210
  startTime: Date;
1396
- events: Event[];
3211
+ events: Event$1[];
1397
3212
  }
1398
3213
  interface Startup {
1399
3214
  springBootVersion: string;
@@ -1430,17 +3245,17 @@ declare const stores: {
1430
3245
  * console.log(userStore.isAnonymous); // Check if user is anonymous
1431
3246
  * ```
1432
3247
  */
1433
- currentUser: pinia.StoreDefinition<"currentUser", Pick<{
1434
- currentUser: vue.Ref<DetailedUser | undefined, DetailedUser | undefined>;
1435
- isAnonymous: vue.Ref<boolean, boolean>;
3248
+ currentUser: import("pinia").StoreDefinition<"currentUser", Pick<{
3249
+ currentUser: import("vue").Ref<DetailedUser | undefined, DetailedUser | undefined>;
3250
+ isAnonymous: import("vue").Ref<boolean, boolean>;
1436
3251
  fetchCurrentUser: () => Promise<void>;
1437
3252
  }, "currentUser" | "isAnonymous">, Pick<{
1438
- currentUser: vue.Ref<DetailedUser | undefined, DetailedUser | undefined>;
1439
- isAnonymous: vue.Ref<boolean, boolean>;
3253
+ currentUser: import("vue").Ref<DetailedUser | undefined, DetailedUser | undefined>;
3254
+ isAnonymous: import("vue").Ref<boolean, boolean>;
1440
3255
  fetchCurrentUser: () => Promise<void>;
1441
3256
  }, never>, Pick<{
1442
- currentUser: vue.Ref<DetailedUser | undefined, DetailedUser | undefined>;
1443
- isAnonymous: vue.Ref<boolean, boolean>;
3257
+ currentUser: import("vue").Ref<DetailedUser | undefined, DetailedUser | undefined>;
3258
+ isAnonymous: import("vue").Ref<boolean, boolean>;
1444
3259
  fetchCurrentUser: () => Promise<void>;
1445
3260
  }, "fetchCurrentUser">>;
1446
3261
  /**
@@ -1465,14 +3280,14 @@ declare const stores: {
1465
3280
  * console.log(globalInfoStore.globalInfo?.allowRegistration);
1466
3281
  * ```
1467
3282
  */
1468
- globalInfo: pinia.StoreDefinition<"global-info", Pick<{
1469
- globalInfo: vue.Ref<GlobalInfo | undefined, GlobalInfo | undefined>;
3283
+ globalInfo: import("pinia").StoreDefinition<"global-info", Pick<{
3284
+ globalInfo: import("vue").Ref<GlobalInfo | undefined, GlobalInfo | undefined>;
1470
3285
  fetchGlobalInfo: () => Promise<void>;
1471
3286
  }, "globalInfo">, Pick<{
1472
- globalInfo: vue.Ref<GlobalInfo | undefined, GlobalInfo | undefined>;
3287
+ globalInfo: import("vue").Ref<GlobalInfo | undefined, GlobalInfo | undefined>;
1473
3288
  fetchGlobalInfo: () => Promise<void>;
1474
3289
  }, never>, Pick<{
1475
- globalInfo: vue.Ref<GlobalInfo | undefined, GlobalInfo | undefined>;
3290
+ globalInfo: import("vue").Ref<GlobalInfo | undefined, GlobalInfo | undefined>;
1476
3291
  fetchGlobalInfo: () => Promise<void>;
1477
3292
  }, "fetchGlobalInfo">>;
1478
3293
  };
@@ -2210,4 +4025,4 @@ declare const utils: {
2210
4025
  id: IdUtils;
2211
4026
  };
2212
4027
  //#endregion
2213
- export { AttachmentLike, AttachmentSelectProvider, AttachmentSimple, BackupTab, Build, CommentContentProvider, CommentEditorProvider, CommentSubjectRefProvider, CommentSubjectRefResult, Commit, CoreMenuGroupId, DashboardResponsiveLayout, DashboardWidget, DashboardWidgetDefinition, DashboardWidgetQuickActionItem, Database, EditorProvider, EntityFieldItem, Event, ExtensionPoint, FormType, Git, GlobalInfo, Info, Java, Jvm, MenuGroupType, MenuItemType, ModeType, OperationItem, Os, PluginInstallationTab, PluginModule, PluginTab, RouteRecordAppend, Runtime, Startup, StartupStep, THUMBNAIL_WIDTH_MAP, Tag, ThemeListTab, Timeline, UserProfileTab, UserTab, Vendor, definePlugin, events, stores, utils };
4028
+ export { AttachmentLike, AttachmentSelectProvider, AttachmentSimple, BackupTab, Build, CommentContentProvider, CommentEditorProvider, CommentSubjectRefProvider, CommentSubjectRefResult, Commit, CoreMenuGroupId, DashboardResponsiveLayout, DashboardWidget, DashboardWidgetDefinition, DashboardWidgetQuickActionItem, Database, EditorProvider, EntityFieldItem, Event$1 as Event, ExtensionPoint, FormType, Git, GlobalInfo, Info, Java, Jvm, MenuGroupType, MenuItemType, ModeType, OperationItem, Os, PluginFormKit, PluginInstallationTab, PluginModule, PluginTab, RouteRecordAppend, Runtime, Startup, StartupStep, THUMBNAIL_WIDTH_MAP, Tag, ThemeListTab, Timeline, UserProfileTab, UserTab, Vendor, definePlugin, events, stores, utils };