@vnejs/shared.views.settings 0.0.0-stage → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions.d.ts +21 -0
- package/dist/actions.js +62 -0
- package/dist/fields.d.ts +44 -0
- package/dist/fields.js +79 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2 -0
- package/package.json +50 -4
- package/src/actions.ts +90 -0
- package/src/fields.ts +141 -0
- package/src/index.ts +31 -0
- package/src/tests/actions.test.ts +73 -0
- package/src/tests/fields.test.ts +177 -0
- package/tsconfig.json +9 -0
- package/README.md +0 -3
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import "@vnejs/contracts.core.logs";
|
|
2
|
+
import "@vnejs/contracts.core.storage";
|
|
3
|
+
import "@vnejs/contracts.save";
|
|
4
|
+
import "@vnejs/contracts.scenario.fastforward";
|
|
5
|
+
import "@vnejs/contracts.views.screens.confirm";
|
|
6
|
+
import "@vnejs/contracts.views.screens.gallery";
|
|
7
|
+
import "@vnejs/contracts.views.settings";
|
|
8
|
+
import type { SettingsAction } from "@vnejs/contracts.views.settings";
|
|
9
|
+
export type SettingsConfirmActionOptions = {
|
|
10
|
+
locKey: string;
|
|
11
|
+
locKeyAccept: string;
|
|
12
|
+
locKeyDecline: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const createActionStateClear: ({ locKey, locKeyAccept, locKeyDecline }: SettingsConfirmActionOptions) => SettingsAction;
|
|
15
|
+
export declare const createActionResetText: ({ locKey, locKeyAccept, locKeyDecline }: SettingsConfirmActionOptions) => SettingsAction;
|
|
16
|
+
export declare const createActionResetSave: ({ locKey, locKeyAccept, locKeyDecline }: SettingsConfirmActionOptions) => SettingsAction;
|
|
17
|
+
export declare const createActionResetGallery: ({ locKey, locKeyAccept, locKeyDecline }: SettingsConfirmActionOptions) => SettingsAction;
|
|
18
|
+
export declare const createActionStateExport: () => SettingsAction;
|
|
19
|
+
export declare const createActionStateImport: () => SettingsAction;
|
|
20
|
+
export declare const createActionLogsClear: () => SettingsAction;
|
|
21
|
+
export declare const createActionLogsLoad: () => SettingsAction;
|
package/dist/actions.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import "@vnejs/contracts.core.logs";
|
|
2
|
+
import "@vnejs/contracts.core.storage";
|
|
3
|
+
import "@vnejs/contracts.save";
|
|
4
|
+
import "@vnejs/contracts.scenario.fastforward";
|
|
5
|
+
import "@vnejs/contracts.views.screens.confirm";
|
|
6
|
+
import "@vnejs/contracts.views.screens.gallery";
|
|
7
|
+
import "@vnejs/contracts.views.settings";
|
|
8
|
+
import { requireNamespaceDefined } from "@vnejs/helpers.require-namespace-defined";
|
|
9
|
+
import { VNE } from "@vnejs/registry";
|
|
10
|
+
const createConfirmAction = (readAcceptEvent) => ({ locKey, locKeyAccept, locKeyDecline }) => ({ emit }, locs) => {
|
|
11
|
+
requireNamespaceDefined(VNE.EVENTS.CONFIRM, "CONFIRM");
|
|
12
|
+
const event = readAcceptEvent();
|
|
13
|
+
emit(VNE.EVENTS.CONFIRM.EMIT, {
|
|
14
|
+
text: locs[locKey],
|
|
15
|
+
textAccept: locs[locKeyAccept],
|
|
16
|
+
textDecline: locs[locKeyDecline],
|
|
17
|
+
onAccept: () => emit(event),
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
const createEmitAction = (readEvent) => () => ({ emit }) => {
|
|
21
|
+
emit(readEvent());
|
|
22
|
+
};
|
|
23
|
+
const readStorageClear = () => {
|
|
24
|
+
requireNamespaceDefined(VNE.EVENTS.STORAGE, "STORAGE");
|
|
25
|
+
return VNE.EVENTS.STORAGE.CLEAR;
|
|
26
|
+
};
|
|
27
|
+
const readStorageExport = () => {
|
|
28
|
+
requireNamespaceDefined(VNE.EVENTS.STORAGE, "STORAGE");
|
|
29
|
+
return VNE.EVENTS.STORAGE.EXPORT;
|
|
30
|
+
};
|
|
31
|
+
const readStorageImport = () => {
|
|
32
|
+
requireNamespaceDefined(VNE.EVENTS.STORAGE, "STORAGE");
|
|
33
|
+
return VNE.EVENTS.STORAGE.IMPORT;
|
|
34
|
+
};
|
|
35
|
+
const readFastforwardClear = () => {
|
|
36
|
+
requireNamespaceDefined(VNE.EVENTS.FASTFORWARD, "FASTFORWARD");
|
|
37
|
+
return VNE.EVENTS.FASTFORWARD.CLEAR;
|
|
38
|
+
};
|
|
39
|
+
const readSaveClear = () => {
|
|
40
|
+
requireNamespaceDefined(VNE.EVENTS.SAVE, "SAVE");
|
|
41
|
+
return VNE.EVENTS.SAVE.CLEAR;
|
|
42
|
+
};
|
|
43
|
+
const readGalleryClear = () => {
|
|
44
|
+
requireNamespaceDefined(VNE.EVENTS.GALLERY, "GALLERY");
|
|
45
|
+
return VNE.EVENTS.GALLERY.CLEAR;
|
|
46
|
+
};
|
|
47
|
+
const readLogsClear = () => {
|
|
48
|
+
requireNamespaceDefined(VNE.EVENTS.LOGS, "LOGS");
|
|
49
|
+
return VNE.EVENTS.LOGS.CLEAR;
|
|
50
|
+
};
|
|
51
|
+
const readLogsLoad = () => {
|
|
52
|
+
requireNamespaceDefined(VNE.EVENTS.LOGS, "LOGS");
|
|
53
|
+
return VNE.EVENTS.LOGS.LOAD;
|
|
54
|
+
};
|
|
55
|
+
export const createActionStateClear = createConfirmAction(readStorageClear);
|
|
56
|
+
export const createActionResetText = createConfirmAction(readFastforwardClear);
|
|
57
|
+
export const createActionResetSave = createConfirmAction(readSaveClear);
|
|
58
|
+
export const createActionResetGallery = createConfirmAction(readGalleryClear);
|
|
59
|
+
export const createActionStateExport = createEmitAction(readStorageExport);
|
|
60
|
+
export const createActionStateImport = createEmitAction(readStorageImport);
|
|
61
|
+
export const createActionLogsClear = createEmitAction(readLogsClear);
|
|
62
|
+
export const createActionLogsLoad = createEmitAction(readLogsLoad);
|
package/dist/fields.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { QUALITIES } from "@vnejs/contracts.canvas.layer";
|
|
2
|
+
import "@vnejs/contracts.settings.filter";
|
|
3
|
+
import "@vnejs/contracts.text.locs";
|
|
4
|
+
import type { SettingsField } from "@vnejs/contracts.views.settings";
|
|
5
|
+
export type SettingsToggleFieldOptions = {
|
|
6
|
+
locKey: string;
|
|
7
|
+
settingKey: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const createFieldToggle: ({ locKey, settingKey }: SettingsToggleFieldOptions) => SettingsField;
|
|
10
|
+
export type SettingsVolumeFieldOptions = SettingsToggleFieldOptions;
|
|
11
|
+
export declare const createFieldVolume: ({ locKey, settingKey }: SettingsVolumeFieldOptions) => SettingsField;
|
|
12
|
+
export type SettingsRangeFieldOptions = {
|
|
13
|
+
locKey: string;
|
|
14
|
+
settingKey: string;
|
|
15
|
+
min: number;
|
|
16
|
+
max: number;
|
|
17
|
+
step: number;
|
|
18
|
+
valueMap?: string;
|
|
19
|
+
};
|
|
20
|
+
export declare const createFieldRangeX: ({ locKey, settingKey, min, max, step, valueMap }: SettingsRangeFieldOptions) => SettingsField;
|
|
21
|
+
export declare const createFieldRangeS: ({ locKey, settingKey, min, max, step, valueMap }: SettingsRangeFieldOptions) => SettingsField;
|
|
22
|
+
export type SettingsQualityFlags = Record<keyof typeof QUALITIES, boolean>;
|
|
23
|
+
export type SettingsQualityFieldOptions = {
|
|
24
|
+
locKey: string;
|
|
25
|
+
qualities: SettingsQualityFlags;
|
|
26
|
+
optionsWidthModifier?: number;
|
|
27
|
+
};
|
|
28
|
+
export declare const createFieldQuality: ({ locKey, qualities, optionsWidthModifier }: SettingsQualityFieldOptions) => SettingsField;
|
|
29
|
+
export type SettingsFilterFieldOptions = {
|
|
30
|
+
locKey: string;
|
|
31
|
+
optionsWidthModifier: number;
|
|
32
|
+
values: readonly string[];
|
|
33
|
+
};
|
|
34
|
+
export declare const createFieldFilter: ({ locKey, optionsWidthModifier, values }: SettingsFilterFieldOptions) => SettingsField;
|
|
35
|
+
export type SettingsLangFieldOptions = {
|
|
36
|
+
locKey: string;
|
|
37
|
+
values: readonly string[];
|
|
38
|
+
};
|
|
39
|
+
export declare const createFieldLang: ({ locKey, values }: SettingsLangFieldOptions) => SettingsField;
|
|
40
|
+
export type SettingsActionsFieldOptions = {
|
|
41
|
+
locKey: string;
|
|
42
|
+
values: readonly string[];
|
|
43
|
+
};
|
|
44
|
+
export declare const createFieldActions: ({ locKey, values }: SettingsActionsFieldOptions) => SettingsField;
|
package/dist/fields.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { QUALITIES, SCREEN_SIZES } from "@vnejs/contracts.canvas.layer";
|
|
2
|
+
import "@vnejs/contracts.settings.filter";
|
|
3
|
+
import "@vnejs/contracts.text.locs";
|
|
4
|
+
import { requireNamespaceDefined } from "@vnejs/helpers.require-namespace-defined";
|
|
5
|
+
import { VNE } from "@vnejs/registry";
|
|
6
|
+
export const createFieldToggle = ({ locKey, settingKey }) => ({
|
|
7
|
+
locKey,
|
|
8
|
+
settingKey,
|
|
9
|
+
type: "toggle",
|
|
10
|
+
titleToggledLocKey: `${locKey}.on`,
|
|
11
|
+
titleUntoggledLocKey: `${locKey}.off`,
|
|
12
|
+
});
|
|
13
|
+
export const createFieldVolume = ({ locKey, settingKey }) => ({
|
|
14
|
+
locKey,
|
|
15
|
+
settingKey,
|
|
16
|
+
min: 0,
|
|
17
|
+
max: 100,
|
|
18
|
+
step: 1,
|
|
19
|
+
type: "range",
|
|
20
|
+
valuePostfix: "%",
|
|
21
|
+
});
|
|
22
|
+
const createFieldRange = (valuePostfix) => ({ locKey, settingKey, min, max, step, valueMap }) => ({
|
|
23
|
+
locKey,
|
|
24
|
+
settingKey,
|
|
25
|
+
min,
|
|
26
|
+
max,
|
|
27
|
+
step,
|
|
28
|
+
type: "range",
|
|
29
|
+
valuePostfix,
|
|
30
|
+
...(valueMap !== undefined && { valueMap }),
|
|
31
|
+
});
|
|
32
|
+
export const createFieldRangeX = createFieldRange("x");
|
|
33
|
+
export const createFieldRangeS = createFieldRange("s");
|
|
34
|
+
const qualityKeys = Object.keys(QUALITIES).sort((left, right) => SCREEN_SIZES[QUALITIES[left]].width - SCREEN_SIZES[QUALITIES[right]].width);
|
|
35
|
+
export const createFieldQuality = ({ locKey, qualities, optionsWidthModifier }) => {
|
|
36
|
+
const layerConst = VNE.CONST.LAYER;
|
|
37
|
+
const layerSettings = VNE.SETTINGS.LAYER;
|
|
38
|
+
requireNamespaceDefined(layerConst, "LAYER");
|
|
39
|
+
requireNamespaceDefined(layerSettings, "LAYER");
|
|
40
|
+
const options = qualityKeys.flatMap((key) => {
|
|
41
|
+
if (!qualities[key])
|
|
42
|
+
return [];
|
|
43
|
+
const value = layerConst.QUALITIES[key];
|
|
44
|
+
return [{ text: value, value }];
|
|
45
|
+
});
|
|
46
|
+
return {
|
|
47
|
+
locKey,
|
|
48
|
+
type: "selector_texts",
|
|
49
|
+
settingKey: layerSettings.QUALITY,
|
|
50
|
+
...(optionsWidthModifier !== undefined && { optionsWidthModifier }),
|
|
51
|
+
options,
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export const createFieldFilter = ({ locKey, optionsWidthModifier, values }) => {
|
|
55
|
+
const filterSettings = VNE.SETTINGS.FILTER;
|
|
56
|
+
requireNamespaceDefined(filterSettings, "FILTER");
|
|
57
|
+
return {
|
|
58
|
+
locKey,
|
|
59
|
+
type: "selector_texts",
|
|
60
|
+
settingKey: filterSettings.VALUE,
|
|
61
|
+
optionsWidthModifier,
|
|
62
|
+
options: [{ locKey: `${locKey}.off`, value: "" }, ...values.map((value) => ({ locKey: `${locKey}.${value}`, value }))],
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
export const createFieldLang = ({ locKey, values }) => {
|
|
66
|
+
const locsSettings = VNE.SETTINGS.LOCS;
|
|
67
|
+
requireNamespaceDefined(locsSettings, "LOCS");
|
|
68
|
+
return {
|
|
69
|
+
locKey,
|
|
70
|
+
type: "selector_texts",
|
|
71
|
+
settingKey: locsSettings.LANG,
|
|
72
|
+
options: values.map((value) => ({ locKey: `${locKey}.${value}`, value })),
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
export const createFieldActions = ({ locKey, values }) => ({
|
|
76
|
+
locKey,
|
|
77
|
+
type: "actions",
|
|
78
|
+
options: values.map((value) => ({ locKey: `${locKey}.${value}`, action: value })),
|
|
79
|
+
});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { createActionLogsClear, createActionLogsLoad, createActionResetGallery, createActionResetSave, createActionResetText, createActionStateClear, createActionStateExport, createActionStateImport, } from "./actions.js";
|
|
2
|
+
export type { SettingsConfirmActionOptions } from "./actions.js";
|
|
3
|
+
export { createFieldActions, createFieldFilter, createFieldLang, createFieldQuality, createFieldRangeS, createFieldRangeX, createFieldToggle, createFieldVolume, } from "./fields.js";
|
|
4
|
+
export type { SettingsActionsFieldOptions, SettingsFilterFieldOptions, SettingsLangFieldOptions, SettingsQualityFieldOptions, SettingsQualityFlags, SettingsRangeFieldOptions, SettingsToggleFieldOptions, SettingsVolumeFieldOptions, } from "./fields.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { createActionLogsClear, createActionLogsLoad, createActionResetGallery, createActionResetSave, createActionResetText, createActionStateClear, createActionStateExport, createActionStateImport, } from "./actions.js";
|
|
2
|
+
export { createFieldActions, createFieldFilter, createFieldLang, createFieldQuality, createFieldRangeS, createFieldRangeX, createFieldToggle, createFieldVolume, } from "./fields.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vnejs/shared.views.settings",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "Settings action factories for @vnejs/plugins.views.settings",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"require": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"src",
|
|
18
|
+
"tsconfig.json"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"test": "npx @vnejs/monorepo test",
|
|
22
|
+
"build": "npx @vnejs/monorepo package",
|
|
23
|
+
"publish:major": "npx @vnejs/monorepo publish major --access public",
|
|
24
|
+
"publish:minor": "npx @vnejs/monorepo publish minor --access public",
|
|
25
|
+
"publish:patch": "npx @vnejs/monorepo publish patch --access public"
|
|
26
|
+
},
|
|
27
|
+
"author": "",
|
|
28
|
+
"license": "ISC",
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@vnejs/helpers.require-namespace-defined": "~0.2.0",
|
|
31
|
+
"@vnejs/contracts.canvas.layer": "~0.2.0",
|
|
32
|
+
"@vnejs/contracts.core.logs": "~0.2.0",
|
|
33
|
+
"@vnejs/contracts.core.storage": "~0.2.0",
|
|
34
|
+
"@vnejs/contracts.save": "~0.2.0",
|
|
35
|
+
"@vnejs/contracts.scenario.fastforward": "~0.2.0",
|
|
36
|
+
"@vnejs/contracts.settings.filter": "~0.2.0",
|
|
37
|
+
"@vnejs/contracts.text.locs": "~0.2.0",
|
|
38
|
+
"@vnejs/contracts.views.screens.confirm": "~0.2.0",
|
|
39
|
+
"@vnejs/contracts.views.screens.gallery": "~0.2.0",
|
|
40
|
+
"@vnejs/contracts.views.settings": "~0.2.0"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"@vnejs/module": "~0.2.0",
|
|
44
|
+
"@vnejs/registry": "~0.2.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@vnejs/configs.ts-common": "~0.2.0",
|
|
48
|
+
"@vnejs/configs.vitest": "~0.2.0",
|
|
49
|
+
"@vnejs/module": "~0.2.0",
|
|
50
|
+
"@vnejs/registry": "~0.2.0"
|
|
51
|
+
}
|
|
52
|
+
}
|
package/src/actions.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import "@vnejs/contracts.core.logs";
|
|
2
|
+
import "@vnejs/contracts.core.storage";
|
|
3
|
+
import "@vnejs/contracts.save";
|
|
4
|
+
import "@vnejs/contracts.scenario.fastforward";
|
|
5
|
+
import "@vnejs/contracts.views.screens.confirm";
|
|
6
|
+
import "@vnejs/contracts.views.screens.gallery";
|
|
7
|
+
import "@vnejs/contracts.views.settings";
|
|
8
|
+
|
|
9
|
+
import type { SettingsAction } from "@vnejs/contracts.views.settings";
|
|
10
|
+
import { requireNamespaceDefined } from "@vnejs/helpers.require-namespace-defined";
|
|
11
|
+
import { VNE } from "@vnejs/registry";
|
|
12
|
+
|
|
13
|
+
export type SettingsConfirmActionOptions = {
|
|
14
|
+
locKey: string;
|
|
15
|
+
locKeyAccept: string;
|
|
16
|
+
locKeyDecline: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const createConfirmAction =
|
|
20
|
+
(readAcceptEvent: () => string) =>
|
|
21
|
+
({ locKey, locKeyAccept, locKeyDecline }: SettingsConfirmActionOptions): SettingsAction =>
|
|
22
|
+
({ emit }, locs) => {
|
|
23
|
+
requireNamespaceDefined(VNE.EVENTS.CONFIRM, "CONFIRM");
|
|
24
|
+
|
|
25
|
+
const event = readAcceptEvent();
|
|
26
|
+
|
|
27
|
+
emit(VNE.EVENTS.CONFIRM.EMIT, {
|
|
28
|
+
text: locs[locKey],
|
|
29
|
+
textAccept: locs[locKeyAccept],
|
|
30
|
+
textDecline: locs[locKeyDecline],
|
|
31
|
+
onAccept: () => emit(event),
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const createEmitAction =
|
|
36
|
+
(readEvent: () => string) =>
|
|
37
|
+
(): SettingsAction =>
|
|
38
|
+
({ emit }) => {
|
|
39
|
+
emit(readEvent());
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const readStorageClear = () => {
|
|
43
|
+
requireNamespaceDefined(VNE.EVENTS.STORAGE, "STORAGE");
|
|
44
|
+
return VNE.EVENTS.STORAGE.CLEAR;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const readStorageExport = () => {
|
|
48
|
+
requireNamespaceDefined(VNE.EVENTS.STORAGE, "STORAGE");
|
|
49
|
+
return VNE.EVENTS.STORAGE.EXPORT;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const readStorageImport = () => {
|
|
53
|
+
requireNamespaceDefined(VNE.EVENTS.STORAGE, "STORAGE");
|
|
54
|
+
return VNE.EVENTS.STORAGE.IMPORT;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const readFastforwardClear = () => {
|
|
58
|
+
requireNamespaceDefined(VNE.EVENTS.FASTFORWARD, "FASTFORWARD");
|
|
59
|
+
return VNE.EVENTS.FASTFORWARD.CLEAR;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const readSaveClear = () => {
|
|
63
|
+
requireNamespaceDefined(VNE.EVENTS.SAVE, "SAVE");
|
|
64
|
+
return VNE.EVENTS.SAVE.CLEAR;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const readGalleryClear = () => {
|
|
68
|
+
requireNamespaceDefined(VNE.EVENTS.GALLERY, "GALLERY");
|
|
69
|
+
return VNE.EVENTS.GALLERY.CLEAR;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const readLogsClear = () => {
|
|
73
|
+
requireNamespaceDefined(VNE.EVENTS.LOGS, "LOGS");
|
|
74
|
+
return VNE.EVENTS.LOGS.CLEAR;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const readLogsLoad = () => {
|
|
78
|
+
requireNamespaceDefined(VNE.EVENTS.LOGS, "LOGS");
|
|
79
|
+
return VNE.EVENTS.LOGS.LOAD;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const createActionStateClear = createConfirmAction(readStorageClear);
|
|
83
|
+
export const createActionResetText = createConfirmAction(readFastforwardClear);
|
|
84
|
+
export const createActionResetSave = createConfirmAction(readSaveClear);
|
|
85
|
+
export const createActionResetGallery = createConfirmAction(readGalleryClear);
|
|
86
|
+
|
|
87
|
+
export const createActionStateExport = createEmitAction(readStorageExport);
|
|
88
|
+
export const createActionStateImport = createEmitAction(readStorageImport);
|
|
89
|
+
export const createActionLogsClear = createEmitAction(readLogsClear);
|
|
90
|
+
export const createActionLogsLoad = createEmitAction(readLogsLoad);
|
package/src/fields.ts
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { QUALITIES, SCREEN_SIZES } from "@vnejs/contracts.canvas.layer";
|
|
2
|
+
import "@vnejs/contracts.settings.filter";
|
|
3
|
+
import "@vnejs/contracts.text.locs";
|
|
4
|
+
import type { SettingsField, SettingsFieldOption } from "@vnejs/contracts.views.settings";
|
|
5
|
+
import { requireNamespaceDefined } from "@vnejs/helpers.require-namespace-defined";
|
|
6
|
+
import { VNE } from "@vnejs/registry";
|
|
7
|
+
|
|
8
|
+
export type SettingsToggleFieldOptions = {
|
|
9
|
+
locKey: string;
|
|
10
|
+
settingKey: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const createFieldToggle = ({ locKey, settingKey }: SettingsToggleFieldOptions): SettingsField => ({
|
|
14
|
+
locKey,
|
|
15
|
+
settingKey,
|
|
16
|
+
type: "toggle",
|
|
17
|
+
titleToggledLocKey: `${locKey}.on`,
|
|
18
|
+
titleUntoggledLocKey: `${locKey}.off`,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export type SettingsVolumeFieldOptions = SettingsToggleFieldOptions;
|
|
22
|
+
|
|
23
|
+
export const createFieldVolume = ({ locKey, settingKey }: SettingsVolumeFieldOptions): SettingsField => ({
|
|
24
|
+
locKey,
|
|
25
|
+
settingKey,
|
|
26
|
+
min: 0,
|
|
27
|
+
max: 100,
|
|
28
|
+
step: 1,
|
|
29
|
+
type: "range",
|
|
30
|
+
valuePostfix: "%",
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export type SettingsRangeFieldOptions = {
|
|
34
|
+
locKey: string;
|
|
35
|
+
settingKey: string;
|
|
36
|
+
min: number;
|
|
37
|
+
max: number;
|
|
38
|
+
step: number;
|
|
39
|
+
valueMap?: string;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const createFieldRange =
|
|
43
|
+
(valuePostfix: string) =>
|
|
44
|
+
({ locKey, settingKey, min, max, step, valueMap }: SettingsRangeFieldOptions): SettingsField => ({
|
|
45
|
+
locKey,
|
|
46
|
+
settingKey,
|
|
47
|
+
min,
|
|
48
|
+
max,
|
|
49
|
+
step,
|
|
50
|
+
type: "range",
|
|
51
|
+
valuePostfix,
|
|
52
|
+
...(valueMap !== undefined && { valueMap }),
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export const createFieldRangeX = createFieldRange("x");
|
|
56
|
+
export const createFieldRangeS = createFieldRange("s");
|
|
57
|
+
|
|
58
|
+
export type SettingsQualityFlags = Record<keyof typeof QUALITIES, boolean>;
|
|
59
|
+
|
|
60
|
+
export type SettingsQualityFieldOptions = {
|
|
61
|
+
locKey: string;
|
|
62
|
+
qualities: SettingsQualityFlags;
|
|
63
|
+
optionsWidthModifier?: number;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const qualityKeys = (Object.keys(QUALITIES) as (keyof typeof QUALITIES)[]).sort(
|
|
67
|
+
(left, right) => SCREEN_SIZES[QUALITIES[left]].width - SCREEN_SIZES[QUALITIES[right]].width,
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
export const createFieldQuality = ({ locKey, qualities, optionsWidthModifier }: SettingsQualityFieldOptions): SettingsField => {
|
|
71
|
+
const layerConst = VNE.CONST.LAYER;
|
|
72
|
+
const layerSettings = VNE.SETTINGS.LAYER;
|
|
73
|
+
|
|
74
|
+
requireNamespaceDefined(layerConst, "LAYER");
|
|
75
|
+
requireNamespaceDefined(layerSettings, "LAYER");
|
|
76
|
+
|
|
77
|
+
const options: SettingsFieldOption[] = qualityKeys.flatMap((key) => {
|
|
78
|
+
if (!qualities[key]) return [];
|
|
79
|
+
|
|
80
|
+
const value = layerConst.QUALITIES[key];
|
|
81
|
+
|
|
82
|
+
return [{ text: value, value }];
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
locKey,
|
|
87
|
+
type: "selector_texts",
|
|
88
|
+
settingKey: layerSettings.QUALITY,
|
|
89
|
+
...(optionsWidthModifier !== undefined && { optionsWidthModifier }),
|
|
90
|
+
options,
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export type SettingsFilterFieldOptions = {
|
|
95
|
+
locKey: string;
|
|
96
|
+
optionsWidthModifier: number;
|
|
97
|
+
values: readonly string[];
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export const createFieldFilter = ({ locKey, optionsWidthModifier, values }: SettingsFilterFieldOptions): SettingsField => {
|
|
101
|
+
const filterSettings = VNE.SETTINGS.FILTER;
|
|
102
|
+
|
|
103
|
+
requireNamespaceDefined(filterSettings, "FILTER");
|
|
104
|
+
|
|
105
|
+
return {
|
|
106
|
+
locKey,
|
|
107
|
+
type: "selector_texts",
|
|
108
|
+
settingKey: filterSettings.VALUE,
|
|
109
|
+
optionsWidthModifier,
|
|
110
|
+
options: [{ locKey: `${locKey}.off`, value: "" }, ...values.map((value) => ({ locKey: `${locKey}.${value}`, value }))],
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export type SettingsLangFieldOptions = {
|
|
115
|
+
locKey: string;
|
|
116
|
+
values: readonly string[];
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export const createFieldLang = ({ locKey, values }: SettingsLangFieldOptions): SettingsField => {
|
|
120
|
+
const locsSettings = VNE.SETTINGS.LOCS;
|
|
121
|
+
|
|
122
|
+
requireNamespaceDefined(locsSettings, "LOCS");
|
|
123
|
+
|
|
124
|
+
return {
|
|
125
|
+
locKey,
|
|
126
|
+
type: "selector_texts",
|
|
127
|
+
settingKey: locsSettings.LANG,
|
|
128
|
+
options: values.map((value) => ({ locKey: `${locKey}.${value}`, value })),
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export type SettingsActionsFieldOptions = {
|
|
133
|
+
locKey: string;
|
|
134
|
+
values: readonly string[];
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export const createFieldActions = ({ locKey, values }: SettingsActionsFieldOptions): SettingsField => ({
|
|
138
|
+
locKey,
|
|
139
|
+
type: "actions",
|
|
140
|
+
options: values.map((value) => ({ locKey: `${locKey}.${value}`, action: value })),
|
|
141
|
+
});
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export {
|
|
2
|
+
createActionLogsClear,
|
|
3
|
+
createActionLogsLoad,
|
|
4
|
+
createActionResetGallery,
|
|
5
|
+
createActionResetSave,
|
|
6
|
+
createActionResetText,
|
|
7
|
+
createActionStateClear,
|
|
8
|
+
createActionStateExport,
|
|
9
|
+
createActionStateImport,
|
|
10
|
+
} from "./actions.js";
|
|
11
|
+
export type { SettingsConfirmActionOptions } from "./actions.js";
|
|
12
|
+
export {
|
|
13
|
+
createFieldActions,
|
|
14
|
+
createFieldFilter,
|
|
15
|
+
createFieldLang,
|
|
16
|
+
createFieldQuality,
|
|
17
|
+
createFieldRangeS,
|
|
18
|
+
createFieldRangeX,
|
|
19
|
+
createFieldToggle,
|
|
20
|
+
createFieldVolume,
|
|
21
|
+
} from "./fields.js";
|
|
22
|
+
export type {
|
|
23
|
+
SettingsActionsFieldOptions,
|
|
24
|
+
SettingsFilterFieldOptions,
|
|
25
|
+
SettingsLangFieldOptions,
|
|
26
|
+
SettingsQualityFieldOptions,
|
|
27
|
+
SettingsQualityFlags,
|
|
28
|
+
SettingsRangeFieldOptions,
|
|
29
|
+
SettingsToggleFieldOptions,
|
|
30
|
+
SettingsVolumeFieldOptions,
|
|
31
|
+
} from "./fields.js";
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { PLUGIN_NAME as LOGS, SUBSCRIBE_EVENTS as LOGS_EVENTS } from "@vnejs/contracts.core.logs";
|
|
2
|
+
import { PLUGIN_NAME as STORAGE, SUBSCRIBE_EVENTS as STORAGE_EVENTS } from "@vnejs/contracts.core.storage";
|
|
3
|
+
import { PLUGIN_NAME as SAVE, SUBSCRIBE_EVENTS as SAVE_EVENTS } from "@vnejs/contracts.save";
|
|
4
|
+
import { PLUGIN_NAME as FASTFORWARD, SUBSCRIBE_EVENTS as FASTFORWARD_EVENTS } from "@vnejs/contracts.scenario.fastforward";
|
|
5
|
+
import { PLUGIN_NAME as CONFIRM, SUBSCRIBE_EVENTS as CONFIRM_EVENTS } from "@vnejs/contracts.views.screens.confirm";
|
|
6
|
+
import { PLUGIN_NAME as GALLERY, SUBSCRIBE_EVENTS as GALLERY_EVENTS } from "@vnejs/contracts.views.screens.gallery";
|
|
7
|
+
import type { SettingsActionContext } from "@vnejs/contracts.views.settings";
|
|
8
|
+
import { regPlugin, VNE } from "@vnejs/registry";
|
|
9
|
+
import { beforeAll, describe, expect, it, vi } from "vitest";
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
createActionLogsClear,
|
|
13
|
+
createActionLogsLoad,
|
|
14
|
+
createActionResetGallery,
|
|
15
|
+
createActionResetSave,
|
|
16
|
+
createActionResetText,
|
|
17
|
+
createActionStateClear,
|
|
18
|
+
createActionStateExport,
|
|
19
|
+
createActionStateImport,
|
|
20
|
+
} from "../index.js";
|
|
21
|
+
|
|
22
|
+
const emit = vi.fn();
|
|
23
|
+
const context = { emit, emitOne: emit, emitReal: emit } as unknown as SettingsActionContext;
|
|
24
|
+
const confirmOptions = { locKey: "confirm", locKeyAccept: "yes", locKeyDecline: "no" };
|
|
25
|
+
const locs = { confirm: "Sure?", yes: "Yes", no: "No" };
|
|
26
|
+
|
|
27
|
+
describe("settings action factories", () => {
|
|
28
|
+
beforeAll(() => {
|
|
29
|
+
regPlugin(CONFIRM, { events: CONFIRM_EVENTS });
|
|
30
|
+
regPlugin(STORAGE, { events: STORAGE_EVENTS });
|
|
31
|
+
regPlugin(FASTFORWARD, { events: FASTFORWARD_EVENTS });
|
|
32
|
+
regPlugin(SAVE, { events: SAVE_EVENTS });
|
|
33
|
+
regPlugin(GALLERY, { events: GALLERY_EVENTS });
|
|
34
|
+
regPlugin(LOGS, { events: LOGS_EVENTS });
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it.each([
|
|
38
|
+
["state clear", createActionStateClear, () => VNE.EVENTS.STORAGE.CLEAR],
|
|
39
|
+
["reset text", createActionResetText, () => VNE.EVENTS.FASTFORWARD.CLEAR],
|
|
40
|
+
["reset save", createActionResetSave, () => VNE.EVENTS.SAVE.CLEAR],
|
|
41
|
+
["reset gallery", createActionResetGallery, () => VNE.EVENTS.GALLERY.CLEAR],
|
|
42
|
+
] as const)("%s asks for confirm and then emits the clear event", (_name, create, readEvent) => {
|
|
43
|
+
emit.mockClear();
|
|
44
|
+
|
|
45
|
+
create(confirmOptions)(context, locs);
|
|
46
|
+
|
|
47
|
+
expect(emit).toHaveBeenCalledTimes(1);
|
|
48
|
+
expect(emit).toHaveBeenCalledWith(VNE.EVENTS.CONFIRM.EMIT, {
|
|
49
|
+
text: "Sure?",
|
|
50
|
+
textAccept: "Yes",
|
|
51
|
+
textDecline: "No",
|
|
52
|
+
onAccept: expect.any(Function),
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
emit.mock.calls[0]?.[1].onAccept();
|
|
56
|
+
|
|
57
|
+
expect(emit).toHaveBeenCalledWith(readEvent());
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it.each([
|
|
61
|
+
["state export", createActionStateExport, () => VNE.EVENTS.STORAGE.EXPORT],
|
|
62
|
+
["state import", createActionStateImport, () => VNE.EVENTS.STORAGE.IMPORT],
|
|
63
|
+
["logs clear", createActionLogsClear, () => VNE.EVENTS.LOGS.CLEAR],
|
|
64
|
+
["logs load", createActionLogsLoad, () => VNE.EVENTS.LOGS.LOAD],
|
|
65
|
+
] as const)("%s emits its event", (_name, create, readEvent) => {
|
|
66
|
+
emit.mockClear();
|
|
67
|
+
|
|
68
|
+
create()(context, locs);
|
|
69
|
+
|
|
70
|
+
expect(emit).toHaveBeenCalledTimes(1);
|
|
71
|
+
expect(emit).toHaveBeenCalledWith(readEvent());
|
|
72
|
+
});
|
|
73
|
+
});
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { CONSTANTS, PLUGIN_NAME as LAYER, SETTINGS_KEYS } from "@vnejs/contracts.canvas.layer";
|
|
2
|
+
import { PLUGIN_NAME as FILTER, SETTINGS_KEYS as FILTER_SETTINGS } from "@vnejs/contracts.settings.filter";
|
|
3
|
+
import { PLUGIN_NAME as LOCS, SETTINGS_KEYS as LOCS_SETTINGS } from "@vnejs/contracts.text.locs";
|
|
4
|
+
import { describe, expect, it, beforeAll } from "vitest";
|
|
5
|
+
import { regPlugin, VNE } from "@vnejs/registry";
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
createFieldActions,
|
|
9
|
+
createFieldFilter,
|
|
10
|
+
createFieldLang,
|
|
11
|
+
createFieldQuality,
|
|
12
|
+
createFieldRangeS,
|
|
13
|
+
createFieldRangeX,
|
|
14
|
+
createFieldToggle,
|
|
15
|
+
createFieldVolume,
|
|
16
|
+
} from "../index.js";
|
|
17
|
+
|
|
18
|
+
describe("createFieldToggle", () => {
|
|
19
|
+
it("builds the toggle titles from locKey", () => {
|
|
20
|
+
expect(createFieldToggle({ locKey: "fields.text.process", settingKey: "text.process" })).toEqual({
|
|
21
|
+
locKey: "fields.text.process",
|
|
22
|
+
settingKey: "text.process",
|
|
23
|
+
type: "toggle",
|
|
24
|
+
titleToggledLocKey: "fields.text.process.on",
|
|
25
|
+
titleUntoggledLocKey: "fields.text.process.off",
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe("createFieldVolume", () => {
|
|
31
|
+
it("builds a percent range from 0 to 100", () => {
|
|
32
|
+
expect(createFieldVolume({ locKey: "fields.volume.common", settingKey: "volume.common" })).toEqual({
|
|
33
|
+
locKey: "fields.volume.common",
|
|
34
|
+
settingKey: "volume.common",
|
|
35
|
+
min: 0,
|
|
36
|
+
max: 100,
|
|
37
|
+
step: 1,
|
|
38
|
+
type: "range",
|
|
39
|
+
valuePostfix: "%",
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
describe("createFieldRangeX", () => {
|
|
45
|
+
it("builds a range field with postfix x", () => {
|
|
46
|
+
expect(createFieldRangeX({ locKey: "fields.text.speed", settingKey: "text.speed", min: 0.125, max: 5, step: 0.125 })).toEqual({
|
|
47
|
+
locKey: "fields.text.speed",
|
|
48
|
+
settingKey: "text.speed",
|
|
49
|
+
min: 0.125,
|
|
50
|
+
max: 5,
|
|
51
|
+
step: 0.125,
|
|
52
|
+
type: "range",
|
|
53
|
+
valuePostfix: "x",
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
describe("createFieldRangeS", () => {
|
|
59
|
+
it("builds a range field with postfix s", () => {
|
|
60
|
+
expect(createFieldRangeS({ locKey: "fields.extra.autosave_interval", settingKey: "save.interval", min: 0, max: 300, step: 5 })).toEqual({
|
|
61
|
+
locKey: "fields.extra.autosave_interval",
|
|
62
|
+
settingKey: "save.interval",
|
|
63
|
+
min: 0,
|
|
64
|
+
max: 300,
|
|
65
|
+
step: 5,
|
|
66
|
+
type: "range",
|
|
67
|
+
valuePostfix: "s",
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("keeps valueMap when it is passed", () => {
|
|
72
|
+
expect(
|
|
73
|
+
createFieldRangeS({
|
|
74
|
+
locKey: "fields.fastforward.delay",
|
|
75
|
+
settingKey: "fastforward.delay",
|
|
76
|
+
min: 0,
|
|
77
|
+
max: 2000,
|
|
78
|
+
step: 50,
|
|
79
|
+
valueMap: "ms_to_seconds",
|
|
80
|
+
}).valueMap,
|
|
81
|
+
).toBe("ms_to_seconds");
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
describe("createFieldQuality", () => {
|
|
86
|
+
const qualities = {
|
|
87
|
+
nnHD: true,
|
|
88
|
+
nHD: false,
|
|
89
|
+
qHD: false,
|
|
90
|
+
HD: true,
|
|
91
|
+
HDp: false,
|
|
92
|
+
FHD: true,
|
|
93
|
+
QHD: false,
|
|
94
|
+
UHD: true,
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
beforeAll(() => {
|
|
98
|
+
regPlugin(LAYER, { constants: CONSTANTS, settings: SETTINGS_KEYS });
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it("keeps the enabled qualities in resolution order", () => {
|
|
102
|
+
expect(createFieldQuality({ locKey: "fields.screen.quality", qualities, optionsWidthModifier: 3 })).toEqual({
|
|
103
|
+
locKey: "fields.screen.quality",
|
|
104
|
+
type: "selector_texts",
|
|
105
|
+
settingKey: VNE.SETTINGS.LAYER.QUALITY,
|
|
106
|
+
optionsWidthModifier: 3,
|
|
107
|
+
options: [
|
|
108
|
+
{ text: "90p", value: "90p" },
|
|
109
|
+
{ text: "720p", value: "720p" },
|
|
110
|
+
{ text: "1080p", value: "1080p" },
|
|
111
|
+
{ text: "2160p", value: "2160p" },
|
|
112
|
+
],
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it("omits optionsWidthModifier when it is not passed", () => {
|
|
117
|
+
expect(createFieldQuality({ locKey: "fields.screen.quality", qualities }).optionsWidthModifier).toBeUndefined();
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
describe("createFieldFilter", () => {
|
|
122
|
+
beforeAll(() => {
|
|
123
|
+
regPlugin(FILTER, { settings: FILTER_SETTINGS });
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it("puts an empty option first and builds loc keys from locKey", () => {
|
|
127
|
+
expect(
|
|
128
|
+
createFieldFilter({
|
|
129
|
+
locKey: "fields.screen.filter",
|
|
130
|
+
optionsWidthModifier: 2,
|
|
131
|
+
values: ["grayscale", "contrast_1", "contrast_2"],
|
|
132
|
+
}),
|
|
133
|
+
).toEqual({
|
|
134
|
+
locKey: "fields.screen.filter",
|
|
135
|
+
type: "selector_texts",
|
|
136
|
+
settingKey: VNE.SETTINGS.FILTER.VALUE,
|
|
137
|
+
optionsWidthModifier: 2,
|
|
138
|
+
options: [
|
|
139
|
+
{ locKey: "fields.screen.filter.off", value: "" },
|
|
140
|
+
{ locKey: "fields.screen.filter.grayscale", value: "grayscale" },
|
|
141
|
+
{ locKey: "fields.screen.filter.contrast_1", value: "contrast_1" },
|
|
142
|
+
{ locKey: "fields.screen.filter.contrast_2", value: "contrast_2" },
|
|
143
|
+
],
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
describe("createFieldLang", () => {
|
|
149
|
+
beforeAll(() => {
|
|
150
|
+
regPlugin(LOCS, { settings: LOCS_SETTINGS });
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it("builds option loc keys from locKey and values", () => {
|
|
154
|
+
expect(createFieldLang({ locKey: "fields.text.lang", values: ["ru", "en"] })).toEqual({
|
|
155
|
+
locKey: "fields.text.lang",
|
|
156
|
+
type: "selector_texts",
|
|
157
|
+
settingKey: VNE.SETTINGS.LOCS.LANG,
|
|
158
|
+
options: [
|
|
159
|
+
{ locKey: "fields.text.lang.ru", value: "ru" },
|
|
160
|
+
{ locKey: "fields.text.lang.en", value: "en" },
|
|
161
|
+
],
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
describe("createFieldActions", () => {
|
|
167
|
+
it("builds action options from locKey and values", () => {
|
|
168
|
+
expect(createFieldActions({ locKey: "fields.progress.reset", values: ["reset_save", "reset_text"] })).toEqual({
|
|
169
|
+
locKey: "fields.progress.reset",
|
|
170
|
+
type: "actions",
|
|
171
|
+
options: [
|
|
172
|
+
{ locKey: "fields.progress.reset.reset_save", action: "reset_save" },
|
|
173
|
+
{ locKey: "fields.progress.reset.reset_text", action: "reset_text" },
|
|
174
|
+
],
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
});
|
package/tsconfig.json
ADDED
package/README.md
DELETED