@vnejs/contracts.controllers.screens.gallery 0.0.0-stage → 0.2.14
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/events.d.ts +22 -0
- package/dist/events.js +21 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.js +6 -0
- package/dist/params.d.ts +125 -0
- package/dist/params.js +40 -0
- package/dist/payloads.d.ts +45 -0
- package/dist/payloads.js +1 -0
- package/package.json +33 -4
- package/src/events.ts +24 -0
- package/src/index.ts +88 -0
- package/src/params.ts +76 -0
- package/src/payloads.ts +56 -0
- package/tsconfig.json +9 -0
- package/README.md +0 -3
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const SUBSCRIBE_EVENTS: {
|
|
2
|
+
readonly OPEN: "vne:gallery:open";
|
|
3
|
+
readonly CHECK: "vne:gallery:check";
|
|
4
|
+
readonly CLEAR: "vne:gallery:clear";
|
|
5
|
+
readonly SHOW: "vne:gallery:show";
|
|
6
|
+
readonly HIDE: "vne:gallery:hide";
|
|
7
|
+
readonly PAGE_SET: "vne:gallery:page_set";
|
|
8
|
+
readonly TAB_SET: "vne:gallery:tab_set";
|
|
9
|
+
readonly UPDATE: "vne:gallery:update";
|
|
10
|
+
readonly UPDATE_FAST: "vne:gallery:update_fast";
|
|
11
|
+
readonly UPDATE_FORCE: "vne:gallery:update_force";
|
|
12
|
+
readonly PRELOAD: "vne:gallery:preload";
|
|
13
|
+
readonly CHOOSE: "vne:gallery:choose";
|
|
14
|
+
readonly ACCEPT: "vne:gallery:accept";
|
|
15
|
+
readonly UPDATE_STATE: "vne:gallery:update_state";
|
|
16
|
+
readonly GRID_NEXT: "vne:gallery:grid_next";
|
|
17
|
+
readonly GRID_PREV: "vne:gallery:grid_prev";
|
|
18
|
+
readonly GRID_CLEAR: "vne:gallery:grid_clear";
|
|
19
|
+
readonly GRID_UPDATE_ITEMS: "vne:gallery:grid_update_items";
|
|
20
|
+
readonly PAGE_ITEMS_GET: "vne:gallery:page_items_get";
|
|
21
|
+
};
|
|
22
|
+
export type SubscribeEvents = typeof SUBSCRIBE_EVENTS;
|
package/dist/events.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const SUBSCRIBE_EVENTS = {
|
|
2
|
+
OPEN: "vne:gallery:open",
|
|
3
|
+
CHECK: "vne:gallery:check",
|
|
4
|
+
CLEAR: "vne:gallery:clear",
|
|
5
|
+
SHOW: "vne:gallery:show",
|
|
6
|
+
HIDE: "vne:gallery:hide",
|
|
7
|
+
PAGE_SET: "vne:gallery:page_set",
|
|
8
|
+
TAB_SET: "vne:gallery:tab_set",
|
|
9
|
+
UPDATE: "vne:gallery:update",
|
|
10
|
+
UPDATE_FAST: "vne:gallery:update_fast",
|
|
11
|
+
UPDATE_FORCE: "vne:gallery:update_force",
|
|
12
|
+
PRELOAD: "vne:gallery:preload",
|
|
13
|
+
CHOOSE: "vne:gallery:choose",
|
|
14
|
+
ACCEPT: "vne:gallery:accept",
|
|
15
|
+
UPDATE_STATE: "vne:gallery:update_state",
|
|
16
|
+
GRID_NEXT: "vne:gallery:grid_next",
|
|
17
|
+
GRID_PREV: "vne:gallery:grid_prev",
|
|
18
|
+
GRID_CLEAR: "vne:gallery:grid_clear",
|
|
19
|
+
GRID_UPDATE_ITEMS: "vne:gallery:grid_update_items",
|
|
20
|
+
PAGE_ITEMS_GET: "vne:gallery:page_items_get",
|
|
21
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import "@vnejs/registry";
|
|
2
|
+
import { SUBSCRIBE_EVENTS } from "./events.js";
|
|
3
|
+
import { PARAMS } from "./params.js";
|
|
4
|
+
import type { GalleryCheckPayload, GalleryChoosePayload, GalleryForcePayload, GalleryMapTabContentPayload, GalleryOpenPayload, GalleryPageItemsGetResult, GalleryPageSetPayload, GalleryStateUpdatePayload, GalleryTabSetPayload, GalleryUpdatePayload } from "./payloads.js";
|
|
5
|
+
export declare const PLUGIN_NAME: "GALLERY";
|
|
6
|
+
export type PluginName = typeof PLUGIN_NAME;
|
|
7
|
+
export { SUBSCRIBE_EVENTS };
|
|
8
|
+
export type { SubscribeEvents } from "./events.js";
|
|
9
|
+
export { PARAMS };
|
|
10
|
+
export type { GalleryTab, GalleryTabContent, GalleryTabContentVariation, GalleryTabs, Params, ViewProps } from "./params.js";
|
|
11
|
+
export type { GalleryOpenPayload, GalleryCheckPayload, GalleryPageSetPayload, GalleryTabSetPayload, GalleryCurrentVariant, GalleryChoosePayload, GalleryMapTabContentPayload, GalleryPageItemsGetResult, GalleryForcePayload, GalleryUpdatePayload, GalleryStateUpdatePayload, } from "./payloads.js";
|
|
12
|
+
declare module "@vnejs/registry" {
|
|
13
|
+
interface VnePluginEventsMap extends Record<typeof PLUGIN_NAME, typeof SUBSCRIBE_EVENTS> {
|
|
14
|
+
}
|
|
15
|
+
interface VnePluginParamsMap extends Record<typeof PLUGIN_NAME, typeof PARAMS> {
|
|
16
|
+
}
|
|
17
|
+
interface VneEventPayloadMap {
|
|
18
|
+
[SUBSCRIBE_EVENTS.OPEN]: GalleryOpenPayload;
|
|
19
|
+
[SUBSCRIBE_EVENTS.CHECK]: GalleryCheckPayload;
|
|
20
|
+
[SUBSCRIBE_EVENTS.CLEAR]: void;
|
|
21
|
+
[SUBSCRIBE_EVENTS.SHOW]: GalleryForcePayload;
|
|
22
|
+
[SUBSCRIBE_EVENTS.HIDE]: GalleryForcePayload;
|
|
23
|
+
[SUBSCRIBE_EVENTS.PAGE_SET]: GalleryPageSetPayload;
|
|
24
|
+
[SUBSCRIBE_EVENTS.TAB_SET]: GalleryTabSetPayload;
|
|
25
|
+
[SUBSCRIBE_EVENTS.UPDATE]: GalleryUpdatePayload;
|
|
26
|
+
[SUBSCRIBE_EVENTS.UPDATE_FAST]: GalleryUpdatePayload;
|
|
27
|
+
[SUBSCRIBE_EVENTS.UPDATE_FORCE]: GalleryUpdatePayload;
|
|
28
|
+
[SUBSCRIBE_EVENTS.PRELOAD]: void;
|
|
29
|
+
[SUBSCRIBE_EVENTS.CHOOSE]: GalleryChoosePayload;
|
|
30
|
+
[SUBSCRIBE_EVENTS.ACCEPT]: void;
|
|
31
|
+
[SUBSCRIBE_EVENTS.UPDATE_STATE]: GalleryStateUpdatePayload;
|
|
32
|
+
[SUBSCRIBE_EVENTS.GRID_NEXT]: void;
|
|
33
|
+
[SUBSCRIBE_EVENTS.GRID_PREV]: void;
|
|
34
|
+
[SUBSCRIBE_EVENTS.GRID_CLEAR]: void;
|
|
35
|
+
[SUBSCRIBE_EVENTS.GRID_UPDATE_ITEMS]: void;
|
|
36
|
+
[SUBSCRIBE_EVENTS.PAGE_ITEMS_GET]: GalleryMapTabContentPayload;
|
|
37
|
+
}
|
|
38
|
+
interface VneEventResultMap {
|
|
39
|
+
[SUBSCRIBE_EVENTS.OPEN]: void;
|
|
40
|
+
[SUBSCRIBE_EVENTS.CHECK]: boolean;
|
|
41
|
+
[SUBSCRIBE_EVENTS.CLEAR]: void;
|
|
42
|
+
[SUBSCRIBE_EVENTS.SHOW]: void;
|
|
43
|
+
[SUBSCRIBE_EVENTS.HIDE]: void;
|
|
44
|
+
[SUBSCRIBE_EVENTS.PAGE_SET]: void;
|
|
45
|
+
[SUBSCRIBE_EVENTS.TAB_SET]: void;
|
|
46
|
+
[SUBSCRIBE_EVENTS.UPDATE]: void;
|
|
47
|
+
[SUBSCRIBE_EVENTS.UPDATE_FAST]: void;
|
|
48
|
+
[SUBSCRIBE_EVENTS.UPDATE_FORCE]: void;
|
|
49
|
+
[SUBSCRIBE_EVENTS.PRELOAD]: void;
|
|
50
|
+
[SUBSCRIBE_EVENTS.CHOOSE]: void;
|
|
51
|
+
[SUBSCRIBE_EVENTS.ACCEPT]: void;
|
|
52
|
+
[SUBSCRIBE_EVENTS.UPDATE_STATE]: void;
|
|
53
|
+
[SUBSCRIBE_EVENTS.GRID_NEXT]: void;
|
|
54
|
+
[SUBSCRIBE_EVENTS.GRID_PREV]: void;
|
|
55
|
+
[SUBSCRIBE_EVENTS.GRID_CLEAR]: void;
|
|
56
|
+
[SUBSCRIBE_EVENTS.GRID_UPDATE_ITEMS]: void;
|
|
57
|
+
[SUBSCRIBE_EVENTS.PAGE_ITEMS_GET]: GalleryPageItemsGetResult;
|
|
58
|
+
}
|
|
59
|
+
}
|
package/dist/index.js
ADDED
package/dist/params.d.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { PositionBoxProps, WidenViewProps } from "@vnejs/uis.react.position-box";
|
|
2
|
+
export type GalleryTabContentVariation = {
|
|
3
|
+
layerChildType: string;
|
|
4
|
+
name: string;
|
|
5
|
+
overlays: Record<string, string | number>;
|
|
6
|
+
check?: string;
|
|
7
|
+
};
|
|
8
|
+
export type GalleryTabContent = {
|
|
9
|
+
check: string;
|
|
10
|
+
mediaType: string;
|
|
11
|
+
layerChildType?: string;
|
|
12
|
+
name: string;
|
|
13
|
+
fullName: string;
|
|
14
|
+
variations?: GalleryTabContentVariation[];
|
|
15
|
+
};
|
|
16
|
+
export type GalleryTab = {
|
|
17
|
+
locKey: string;
|
|
18
|
+
content: GalleryTabContent[];
|
|
19
|
+
};
|
|
20
|
+
export type GalleryTabs = Record<string, GalleryTab>;
|
|
21
|
+
export declare const TABS: GalleryTabs;
|
|
22
|
+
export declare const BACKGROUND: "save";
|
|
23
|
+
export declare const TRANSITION: number;
|
|
24
|
+
export declare const ZINDEX: number;
|
|
25
|
+
export declare const LOC_LABEL: string;
|
|
26
|
+
declare const VIEW_PROPS_DEFAULT: {
|
|
27
|
+
readonly screen: {
|
|
28
|
+
readonly withBackgroundDark: true;
|
|
29
|
+
readonly zIndex: number;
|
|
30
|
+
readonly transition: number;
|
|
31
|
+
};
|
|
32
|
+
readonly close: {
|
|
33
|
+
readonly position: PositionBoxProps;
|
|
34
|
+
readonly svg: {
|
|
35
|
+
readonly size: 60;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
readonly controls: {
|
|
39
|
+
readonly position: PositionBoxProps;
|
|
40
|
+
readonly controls: {
|
|
41
|
+
readonly flexDirection: "column";
|
|
42
|
+
readonly flexGap: 60;
|
|
43
|
+
readonly textSize: 96;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
readonly items: {
|
|
47
|
+
readonly position: PositionBoxProps;
|
|
48
|
+
readonly flex: {
|
|
49
|
+
readonly gap: number;
|
|
50
|
+
readonly withWrap: true;
|
|
51
|
+
readonly width: number;
|
|
52
|
+
};
|
|
53
|
+
readonly stub: {
|
|
54
|
+
readonly width: number;
|
|
55
|
+
readonly height: number;
|
|
56
|
+
};
|
|
57
|
+
readonly item: {
|
|
58
|
+
readonly width: number;
|
|
59
|
+
readonly height: number;
|
|
60
|
+
readonly withHover: true;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
readonly pages: {
|
|
64
|
+
readonly position: PositionBoxProps;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export type ViewProps = WidenViewProps<typeof VIEW_PROPS_DEFAULT>;
|
|
68
|
+
export declare const VIEW_PROPS: ViewProps;
|
|
69
|
+
export declare const ROWS: number;
|
|
70
|
+
export declare const COLUMNS: number;
|
|
71
|
+
export declare const AUDIO_NAME: string;
|
|
72
|
+
declare const PARAMS_DEFAULT: {
|
|
73
|
+
TABS: GalleryTabs;
|
|
74
|
+
BACKGROUND: "save";
|
|
75
|
+
TRANSITION: number;
|
|
76
|
+
ZINDEX: number;
|
|
77
|
+
LOC_LABEL: string;
|
|
78
|
+
VIEW_PROPS: {
|
|
79
|
+
screen: {
|
|
80
|
+
withBackgroundDark: boolean;
|
|
81
|
+
zIndex: number;
|
|
82
|
+
transition: number;
|
|
83
|
+
};
|
|
84
|
+
close: {
|
|
85
|
+
position: PositionBoxProps<unknown>;
|
|
86
|
+
svg: {
|
|
87
|
+
size: number;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
controls: {
|
|
91
|
+
position: PositionBoxProps<unknown>;
|
|
92
|
+
controls: {
|
|
93
|
+
flexDirection: "column";
|
|
94
|
+
flexGap: number;
|
|
95
|
+
textSize: number;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
items: {
|
|
99
|
+
position: PositionBoxProps<unknown>;
|
|
100
|
+
flex: {
|
|
101
|
+
gap: number;
|
|
102
|
+
withWrap: boolean;
|
|
103
|
+
width: number;
|
|
104
|
+
};
|
|
105
|
+
stub: {
|
|
106
|
+
readonly width: number;
|
|
107
|
+
readonly height: number;
|
|
108
|
+
};
|
|
109
|
+
item: {
|
|
110
|
+
width: number;
|
|
111
|
+
height: number;
|
|
112
|
+
withHover: boolean;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
pages: {
|
|
116
|
+
position: PositionBoxProps<unknown>;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
ROWS: number;
|
|
120
|
+
COLUMNS: number;
|
|
121
|
+
AUDIO_NAME: string;
|
|
122
|
+
};
|
|
123
|
+
export type Params = WidenViewProps<typeof PARAMS_DEFAULT>;
|
|
124
|
+
export declare const PARAMS: Params;
|
|
125
|
+
export {};
|
package/dist/params.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export const TABS = {};
|
|
2
|
+
export const BACKGROUND = "save";
|
|
3
|
+
export const TRANSITION = 300;
|
|
4
|
+
export const ZINDEX = 4000;
|
|
5
|
+
export const LOC_LABEL = "gallery";
|
|
6
|
+
const [ITEM_WIDTH, ITEM_HEIGHT, ITEM_GAP] = [800, 450, 120];
|
|
7
|
+
const VIEW_PROPS_DEFAULT = {
|
|
8
|
+
screen: { withBackgroundDark: true, zIndex: ZINDEX, transition: TRANSITION },
|
|
9
|
+
close: {
|
|
10
|
+
position: { right: 120, top: 90 },
|
|
11
|
+
svg: { size: 60 },
|
|
12
|
+
},
|
|
13
|
+
controls: {
|
|
14
|
+
position: { top: 240, left: 120 },
|
|
15
|
+
controls: { flexDirection: "column", flexGap: 60, textSize: 96 },
|
|
16
|
+
},
|
|
17
|
+
items: {
|
|
18
|
+
position: { top: 240, right: 120 },
|
|
19
|
+
flex: { gap: ITEM_GAP, withWrap: true, width: 2 * ITEM_GAP + 3 * ITEM_WIDTH },
|
|
20
|
+
stub: { width: ITEM_WIDTH, height: ITEM_HEIGHT },
|
|
21
|
+
item: { width: ITEM_WIDTH, height: ITEM_HEIGHT, withHover: true },
|
|
22
|
+
},
|
|
23
|
+
pages: { position: { bottom: 120, right: 120 } },
|
|
24
|
+
};
|
|
25
|
+
export const VIEW_PROPS = VIEW_PROPS_DEFAULT;
|
|
26
|
+
export const ROWS = 3;
|
|
27
|
+
export const COLUMNS = 3;
|
|
28
|
+
export const AUDIO_NAME = "";
|
|
29
|
+
const PARAMS_DEFAULT = {
|
|
30
|
+
TABS,
|
|
31
|
+
BACKGROUND,
|
|
32
|
+
TRANSITION,
|
|
33
|
+
ZINDEX,
|
|
34
|
+
LOC_LABEL,
|
|
35
|
+
VIEW_PROPS,
|
|
36
|
+
ROWS,
|
|
37
|
+
COLUMNS,
|
|
38
|
+
AUDIO_NAME,
|
|
39
|
+
};
|
|
40
|
+
export const PARAMS = PARAMS_DEFAULT;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { GalleryTabContent } from "./params.js";
|
|
2
|
+
export type GalleryOpenPayload = {
|
|
3
|
+
key?: string;
|
|
4
|
+
};
|
|
5
|
+
export type GalleryCheckPayload = {
|
|
6
|
+
key?: string;
|
|
7
|
+
};
|
|
8
|
+
export type GalleryPageSetPayload = {
|
|
9
|
+
pageIndex?: number;
|
|
10
|
+
};
|
|
11
|
+
export type GalleryTabSetPayload = {
|
|
12
|
+
tab?: string;
|
|
13
|
+
isForce?: boolean;
|
|
14
|
+
isUpdateView?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type GalleryCurrentVariant = {
|
|
17
|
+
isOpened: boolean;
|
|
18
|
+
layerChildType?: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
overlays?: Record<string, string>;
|
|
21
|
+
};
|
|
22
|
+
export type GalleryChoosePayload = {
|
|
23
|
+
index?: number;
|
|
24
|
+
fullName?: string;
|
|
25
|
+
mediaType?: string;
|
|
26
|
+
layerChildType?: string;
|
|
27
|
+
isOpened?: boolean;
|
|
28
|
+
variants?: GalleryCurrentVariant[];
|
|
29
|
+
};
|
|
30
|
+
export type GalleryMapTabContentPayload = GalleryTabContent;
|
|
31
|
+
export type GalleryPageItemsGetResult = {
|
|
32
|
+
isStub?: boolean;
|
|
33
|
+
isOpened?: boolean;
|
|
34
|
+
layerChildType?: string;
|
|
35
|
+
fullName?: string;
|
|
36
|
+
src?: string;
|
|
37
|
+
mediaType?: string;
|
|
38
|
+
variants?: GalleryCurrentVariant[];
|
|
39
|
+
};
|
|
40
|
+
export type GalleryForcePayload = {
|
|
41
|
+
isForce?: boolean;
|
|
42
|
+
onClose?: () => void;
|
|
43
|
+
};
|
|
44
|
+
export type GalleryUpdatePayload = Record<string, unknown>;
|
|
45
|
+
export type GalleryStateUpdatePayload = Record<string, unknown>;
|
package/dist/payloads.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vnejs/contracts.controllers.screens.gallery",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.14",
|
|
4
|
+
"description": "Contracts for @vnejs/plugins.controllers.screens.gallery",
|
|
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
|
+
"build": "npx @vnejs/monorepo package",
|
|
22
|
+
"publish:major": "npx @vnejs/monorepo publish major --access public",
|
|
23
|
+
"publish:minor": "npx @vnejs/monorepo publish minor --access public",
|
|
24
|
+
"publish:patch": "npx @vnejs/monorepo publish patch --access public"
|
|
25
|
+
},
|
|
26
|
+
"author": "",
|
|
27
|
+
"license": "ISC",
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"@vnejs/registry": "~0.2.0",
|
|
30
|
+
"@vnejs/uis.react.position-box": "~0.2.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@vnejs/configs.ts-common": "~0.2.0"
|
|
34
|
+
}
|
|
35
|
+
}
|
package/src/events.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const SUBSCRIBE_EVENTS = {
|
|
2
|
+
OPEN: "vne:gallery:open",
|
|
3
|
+
CHECK: "vne:gallery:check",
|
|
4
|
+
CLEAR: "vne:gallery:clear",
|
|
5
|
+
|
|
6
|
+
SHOW: "vne:gallery:show",
|
|
7
|
+
HIDE: "vne:gallery:hide",
|
|
8
|
+
PAGE_SET: "vne:gallery:page_set",
|
|
9
|
+
TAB_SET: "vne:gallery:tab_set",
|
|
10
|
+
UPDATE: "vne:gallery:update",
|
|
11
|
+
UPDATE_FAST: "vne:gallery:update_fast",
|
|
12
|
+
UPDATE_FORCE: "vne:gallery:update_force",
|
|
13
|
+
PRELOAD: "vne:gallery:preload",
|
|
14
|
+
CHOOSE: "vne:gallery:choose",
|
|
15
|
+
ACCEPT: "vne:gallery:accept",
|
|
16
|
+
UPDATE_STATE: "vne:gallery:update_state",
|
|
17
|
+
GRID_NEXT: "vne:gallery:grid_next",
|
|
18
|
+
GRID_PREV: "vne:gallery:grid_prev",
|
|
19
|
+
GRID_CLEAR: "vne:gallery:grid_clear",
|
|
20
|
+
GRID_UPDATE_ITEMS: "vne:gallery:grid_update_items",
|
|
21
|
+
PAGE_ITEMS_GET: "vne:gallery:page_items_get",
|
|
22
|
+
} as const;
|
|
23
|
+
|
|
24
|
+
export type SubscribeEvents = typeof SUBSCRIBE_EVENTS;
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import "@vnejs/registry";
|
|
2
|
+
|
|
3
|
+
import { SUBSCRIBE_EVENTS } from "./events.js";
|
|
4
|
+
import { PARAMS } from "./params.js";
|
|
5
|
+
import type {
|
|
6
|
+
GalleryCheckPayload,
|
|
7
|
+
GalleryChoosePayload,
|
|
8
|
+
GalleryForcePayload,
|
|
9
|
+
GalleryMapTabContentPayload,
|
|
10
|
+
GalleryOpenPayload,
|
|
11
|
+
GalleryPageItemsGetResult,
|
|
12
|
+
GalleryPageSetPayload,
|
|
13
|
+
GalleryStateUpdatePayload,
|
|
14
|
+
GalleryTabSetPayload,
|
|
15
|
+
GalleryUpdatePayload,
|
|
16
|
+
} from "./payloads.js";
|
|
17
|
+
|
|
18
|
+
export const PLUGIN_NAME = "GALLERY" as const;
|
|
19
|
+
export type PluginName = typeof PLUGIN_NAME;
|
|
20
|
+
|
|
21
|
+
export { SUBSCRIBE_EVENTS };
|
|
22
|
+
export type { SubscribeEvents } from "./events.js";
|
|
23
|
+
export { PARAMS };
|
|
24
|
+
export type { GalleryTab, GalleryTabContent, GalleryTabContentVariation, GalleryTabs, Params, ViewProps } from "./params.js";
|
|
25
|
+
|
|
26
|
+
export type {
|
|
27
|
+
GalleryOpenPayload,
|
|
28
|
+
GalleryCheckPayload,
|
|
29
|
+
GalleryPageSetPayload,
|
|
30
|
+
GalleryTabSetPayload,
|
|
31
|
+
GalleryCurrentVariant,
|
|
32
|
+
GalleryChoosePayload,
|
|
33
|
+
GalleryMapTabContentPayload,
|
|
34
|
+
GalleryPageItemsGetResult,
|
|
35
|
+
GalleryForcePayload,
|
|
36
|
+
GalleryUpdatePayload,
|
|
37
|
+
GalleryStateUpdatePayload,
|
|
38
|
+
} from "./payloads.js";
|
|
39
|
+
|
|
40
|
+
declare module "@vnejs/registry" {
|
|
41
|
+
interface VnePluginEventsMap extends Record<typeof PLUGIN_NAME, typeof SUBSCRIBE_EVENTS> {}
|
|
42
|
+
|
|
43
|
+
interface VnePluginParamsMap extends Record<typeof PLUGIN_NAME, typeof PARAMS> {}
|
|
44
|
+
|
|
45
|
+
interface VneEventPayloadMap {
|
|
46
|
+
[SUBSCRIBE_EVENTS.OPEN]: GalleryOpenPayload;
|
|
47
|
+
[SUBSCRIBE_EVENTS.CHECK]: GalleryCheckPayload;
|
|
48
|
+
[SUBSCRIBE_EVENTS.CLEAR]: void;
|
|
49
|
+
[SUBSCRIBE_EVENTS.SHOW]: GalleryForcePayload;
|
|
50
|
+
[SUBSCRIBE_EVENTS.HIDE]: GalleryForcePayload;
|
|
51
|
+
[SUBSCRIBE_EVENTS.PAGE_SET]: GalleryPageSetPayload;
|
|
52
|
+
[SUBSCRIBE_EVENTS.TAB_SET]: GalleryTabSetPayload;
|
|
53
|
+
[SUBSCRIBE_EVENTS.UPDATE]: GalleryUpdatePayload;
|
|
54
|
+
[SUBSCRIBE_EVENTS.UPDATE_FAST]: GalleryUpdatePayload;
|
|
55
|
+
[SUBSCRIBE_EVENTS.UPDATE_FORCE]: GalleryUpdatePayload;
|
|
56
|
+
[SUBSCRIBE_EVENTS.PRELOAD]: void;
|
|
57
|
+
[SUBSCRIBE_EVENTS.CHOOSE]: GalleryChoosePayload;
|
|
58
|
+
[SUBSCRIBE_EVENTS.ACCEPT]: void;
|
|
59
|
+
[SUBSCRIBE_EVENTS.UPDATE_STATE]: GalleryStateUpdatePayload;
|
|
60
|
+
[SUBSCRIBE_EVENTS.GRID_NEXT]: void;
|
|
61
|
+
[SUBSCRIBE_EVENTS.GRID_PREV]: void;
|
|
62
|
+
[SUBSCRIBE_EVENTS.GRID_CLEAR]: void;
|
|
63
|
+
[SUBSCRIBE_EVENTS.GRID_UPDATE_ITEMS]: void;
|
|
64
|
+
[SUBSCRIBE_EVENTS.PAGE_ITEMS_GET]: GalleryMapTabContentPayload;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
interface VneEventResultMap {
|
|
68
|
+
[SUBSCRIBE_EVENTS.OPEN]: void;
|
|
69
|
+
[SUBSCRIBE_EVENTS.CHECK]: boolean;
|
|
70
|
+
[SUBSCRIBE_EVENTS.CLEAR]: void;
|
|
71
|
+
[SUBSCRIBE_EVENTS.SHOW]: void;
|
|
72
|
+
[SUBSCRIBE_EVENTS.HIDE]: void;
|
|
73
|
+
[SUBSCRIBE_EVENTS.PAGE_SET]: void;
|
|
74
|
+
[SUBSCRIBE_EVENTS.TAB_SET]: void;
|
|
75
|
+
[SUBSCRIBE_EVENTS.UPDATE]: void;
|
|
76
|
+
[SUBSCRIBE_EVENTS.UPDATE_FAST]: void;
|
|
77
|
+
[SUBSCRIBE_EVENTS.UPDATE_FORCE]: void;
|
|
78
|
+
[SUBSCRIBE_EVENTS.PRELOAD]: void;
|
|
79
|
+
[SUBSCRIBE_EVENTS.CHOOSE]: void;
|
|
80
|
+
[SUBSCRIBE_EVENTS.ACCEPT]: void;
|
|
81
|
+
[SUBSCRIBE_EVENTS.UPDATE_STATE]: void;
|
|
82
|
+
[SUBSCRIBE_EVENTS.GRID_NEXT]: void;
|
|
83
|
+
[SUBSCRIBE_EVENTS.GRID_PREV]: void;
|
|
84
|
+
[SUBSCRIBE_EVENTS.GRID_CLEAR]: void;
|
|
85
|
+
[SUBSCRIBE_EVENTS.GRID_UPDATE_ITEMS]: void;
|
|
86
|
+
[SUBSCRIBE_EVENTS.PAGE_ITEMS_GET]: GalleryPageItemsGetResult;
|
|
87
|
+
}
|
|
88
|
+
}
|
package/src/params.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { PositionBoxProps, WidenViewProps } from "@vnejs/uis.react.position-box";
|
|
2
|
+
|
|
3
|
+
export type GalleryTabContentVariation = {
|
|
4
|
+
layerChildType: string;
|
|
5
|
+
name: string;
|
|
6
|
+
overlays: Record<string, string | number>;
|
|
7
|
+
check?: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type GalleryTabContent = {
|
|
11
|
+
check: string;
|
|
12
|
+
mediaType: string;
|
|
13
|
+
layerChildType?: string;
|
|
14
|
+
name: string;
|
|
15
|
+
fullName: string;
|
|
16
|
+
variations?: GalleryTabContentVariation[];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type GalleryTab = {
|
|
20
|
+
locKey: string;
|
|
21
|
+
content: GalleryTabContent[];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type GalleryTabs = Record<string, GalleryTab>;
|
|
25
|
+
|
|
26
|
+
export const TABS: GalleryTabs = {};
|
|
27
|
+
|
|
28
|
+
export const BACKGROUND = "save" as const;
|
|
29
|
+
|
|
30
|
+
export const TRANSITION: number = 300;
|
|
31
|
+
export const ZINDEX: number = 4000;
|
|
32
|
+
|
|
33
|
+
export const LOC_LABEL: string = "gallery";
|
|
34
|
+
|
|
35
|
+
const [ITEM_WIDTH, ITEM_HEIGHT, ITEM_GAP] = [800, 450, 120];
|
|
36
|
+
|
|
37
|
+
const VIEW_PROPS_DEFAULT = {
|
|
38
|
+
screen: { withBackgroundDark: true, zIndex: ZINDEX, transition: TRANSITION },
|
|
39
|
+
close: {
|
|
40
|
+
position: { right: 120, top: 90 } as PositionBoxProps,
|
|
41
|
+
svg: { size: 60 },
|
|
42
|
+
},
|
|
43
|
+
controls: {
|
|
44
|
+
position: { top: 240, left: 120 } as PositionBoxProps,
|
|
45
|
+
controls: { flexDirection: "column" as const, flexGap: 60, textSize: 96 },
|
|
46
|
+
},
|
|
47
|
+
items: {
|
|
48
|
+
position: { top: 240, right: 120 } as PositionBoxProps,
|
|
49
|
+
flex: { gap: ITEM_GAP, withWrap: true, width: 2 * ITEM_GAP + 3 * ITEM_WIDTH },
|
|
50
|
+
stub: { width: ITEM_WIDTH, height: ITEM_HEIGHT },
|
|
51
|
+
item: { width: ITEM_WIDTH, height: ITEM_HEIGHT, withHover: true },
|
|
52
|
+
},
|
|
53
|
+
pages: { position: { bottom: 120, right: 120 } as PositionBoxProps },
|
|
54
|
+
} as const;
|
|
55
|
+
|
|
56
|
+
export type ViewProps = WidenViewProps<typeof VIEW_PROPS_DEFAULT>;
|
|
57
|
+
export const VIEW_PROPS: ViewProps = VIEW_PROPS_DEFAULT;
|
|
58
|
+
|
|
59
|
+
export const ROWS: number = 3;
|
|
60
|
+
export const COLUMNS: number = 3;
|
|
61
|
+
export const AUDIO_NAME: string = "";
|
|
62
|
+
|
|
63
|
+
const PARAMS_DEFAULT = {
|
|
64
|
+
TABS,
|
|
65
|
+
BACKGROUND,
|
|
66
|
+
TRANSITION,
|
|
67
|
+
ZINDEX,
|
|
68
|
+
LOC_LABEL,
|
|
69
|
+
VIEW_PROPS,
|
|
70
|
+
ROWS,
|
|
71
|
+
COLUMNS,
|
|
72
|
+
AUDIO_NAME,
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export type Params = WidenViewProps<typeof PARAMS_DEFAULT>;
|
|
76
|
+
export const PARAMS: Params = PARAMS_DEFAULT;
|
package/src/payloads.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { GalleryTabContent } from "./params.js";
|
|
2
|
+
|
|
3
|
+
export type GalleryOpenPayload = {
|
|
4
|
+
key?: string;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export type GalleryCheckPayload = {
|
|
8
|
+
key?: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type GalleryPageSetPayload = {
|
|
12
|
+
pageIndex?: number;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type GalleryTabSetPayload = {
|
|
16
|
+
tab?: string;
|
|
17
|
+
isForce?: boolean;
|
|
18
|
+
isUpdateView?: boolean;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type GalleryCurrentVariant = {
|
|
22
|
+
isOpened: boolean;
|
|
23
|
+
layerChildType?: string;
|
|
24
|
+
name?: string;
|
|
25
|
+
overlays?: Record<string, string>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type GalleryChoosePayload = {
|
|
29
|
+
index?: number;
|
|
30
|
+
fullName?: string;
|
|
31
|
+
mediaType?: string;
|
|
32
|
+
layerChildType?: string;
|
|
33
|
+
isOpened?: boolean;
|
|
34
|
+
variants?: GalleryCurrentVariant[];
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type GalleryMapTabContentPayload = GalleryTabContent;
|
|
38
|
+
|
|
39
|
+
export type GalleryPageItemsGetResult = {
|
|
40
|
+
isStub?: boolean;
|
|
41
|
+
isOpened?: boolean;
|
|
42
|
+
layerChildType?: string;
|
|
43
|
+
fullName?: string;
|
|
44
|
+
src?: string;
|
|
45
|
+
mediaType?: string;
|
|
46
|
+
variants?: GalleryCurrentVariant[];
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export type GalleryForcePayload = {
|
|
50
|
+
isForce?: boolean;
|
|
51
|
+
onClose?: () => void;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export type GalleryUpdatePayload = Record<string, unknown>;
|
|
55
|
+
|
|
56
|
+
export type GalleryStateUpdatePayload = Record<string, unknown>;
|
package/tsconfig.json
ADDED
package/README.md
DELETED