@vnejs/plugins.bridges.plugins.canvas.child.bg.plugins.controllers.screens.gallery 0.0.0-stage → 0.2.13

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.
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import { regPlugin } from "@vnejs/registry";
2
+ import { PLUGIN_NAME } from "@vnejs/contracts.bridges.plugins.canvas.child.bg.plugins.controllers.screens.gallery";
3
+ import { BridgePluginLayerBgPluginGallery } from "./modules/bridge_plugin_layer_bg_plugin_gallery.js";
4
+ regPlugin(PLUGIN_NAME, {}, [BridgePluginLayerBgPluginGallery]);
@@ -0,0 +1,14 @@
1
+ import { ModuleCore } from "@vnejs/module.core";
2
+ import type { BgArgs } from "@vnejs/contracts.canvas.child.bg";
3
+ import type { PluginConstants, PluginEvents, PluginParams, PluginSettings } from "../types.js";
4
+ type BgUnlockPayload = {
5
+ name?: string;
6
+ args?: BgArgs;
7
+ };
8
+ export declare class BridgePluginLayerBgPluginGallery extends ModuleCore<PluginEvents, PluginConstants, PluginSettings, PluginParams> {
9
+ name: string;
10
+ subscribe: () => void;
11
+ onBgUnlock: ({ name, args }?: BgUnlockPayload) => Promise<(import("@vnejs/registry").EmitResults<"vne:gallery:open"> | undefined)[]> | undefined;
12
+ emitGalleryOpen: (key: string) => Promise<import("@vnejs/registry").EmitResults<"vne:gallery:open">> | undefined;
13
+ }
14
+ export {};
@@ -0,0 +1,17 @@
1
+ import { ModuleCore } from "@vnejs/module.core";
2
+ export class BridgePluginLayerBgPluginGallery extends ModuleCore {
3
+ name = "bridge_plugin_layer_bg_plugin_gallery";
4
+ subscribe = () => {
5
+ this.on(this.EVENTS.LAYER_BG.SHOW, this.onBgUnlock);
6
+ this.on(this.EVENTS.LAYER_BG.CHANGE, this.onBgUnlock);
7
+ };
8
+ onBgUnlock = ({ name = "", args = {} } = {}) => {
9
+ if (!name)
10
+ return;
11
+ const promises = [this.emitGalleryOpen(`${this.CONST.LAYER_BG.LAYER_CHILD_TYPE}/${name}`)];
12
+ if (args.overlays)
13
+ Object.entries(args.overlays).forEach(([key, value]) => promises.push(this.emitGalleryOpen(`${this.CONST.LAYER_BG.LAYER_CHILD_TYPE}/${name}/${key}/${value}`)));
14
+ return Promise.all(promises);
15
+ };
16
+ emitGalleryOpen = (key) => this.emit(this.EVENTS.GALLERY.OPEN, { key });
17
+ }
@@ -0,0 +1,8 @@
1
+ import "@vnejs/contracts.controllers.screens.gallery";
2
+ import type { ModuleCoreConstants, ModuleCoreEvents, ModuleCoreParams, ModuleCoreSettings } from "@vnejs/module.core";
3
+ import type { PluginName as LayerBgPluginName, Constants as LayerBgConstants, SubscribeEvents as LayerBgSubscribeEvents } from "@vnejs/contracts.canvas.child.bg";
4
+ import type { PluginName as GalleryPluginName, SubscribeEvents as GallerySubscribeEvents } from "@vnejs/contracts.controllers.screens.gallery";
5
+ export type PluginEvents = ModuleCoreEvents & Record<LayerBgPluginName, LayerBgSubscribeEvents> & Record<GalleryPluginName, GallerySubscribeEvents>;
6
+ export type PluginConstants = ModuleCoreConstants & Record<LayerBgPluginName, LayerBgConstants>;
7
+ export type PluginSettings = ModuleCoreSettings;
8
+ export type PluginParams = ModuleCoreParams;
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ import "@vnejs/contracts.controllers.screens.gallery";
package/package.json CHANGED
@@ -1,6 +1,45 @@
1
1
  {
2
2
  "name": "@vnejs/plugins.bridges.plugins.canvas.child.bg.plugins.controllers.screens.gallery",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.13",
4
+ "description": "",
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:plugin": "npm run publish:major",
24
+ "publish:minor:plugin": "npm run publish:minor",
25
+ "publish:patch:plugin": "npm run publish:patch",
26
+ "publish:major": "npx @vnejs/monorepo publish major --access public",
27
+ "publish:minor": "npx @vnejs/monorepo publish minor --access public",
28
+ "publish:patch": "npx @vnejs/monorepo publish patch --access public"
29
+ },
30
+ "author": "",
31
+ "license": "ISC",
32
+ "peerDependencies": {
33
+ "@vnejs/module.core": "~0.2.0",
34
+ "@vnejs/contracts.canvas.child.bg": "~0.2.0",
35
+ "@vnejs/contracts.controllers.screens.gallery": "~0.2.0",
36
+ "@vnejs/registry": "~0.2.0",
37
+ "@vnejs/contracts.bridges.plugins.canvas.child.bg.plugins.controllers.screens.gallery": "~0.2.0"
38
+ },
39
+ "devDependencies": {
40
+ "@vnejs/configs.ts-common": "~0.2.0",
41
+ "@vnejs/configs.vitest": "~0.2.0",
42
+ "@vnejs/test-utils": "~0.2.0",
43
+ "@vnejs/contracts.bridges.plugins.canvas.child.bg.plugins.controllers.screens.gallery": "~0.2.0"
44
+ }
45
+ }
package/src/index.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { regPlugin } from "@vnejs/registry";
2
+
3
+ import { PLUGIN_NAME } from "@vnejs/contracts.bridges.plugins.canvas.child.bg.plugins.controllers.screens.gallery";
4
+
5
+ import { BridgePluginLayerBgPluginGallery } from "./modules/bridge_plugin_layer_bg_plugin_gallery.js";
6
+
7
+ regPlugin(PLUGIN_NAME, {}, [BridgePluginLayerBgPluginGallery]);
@@ -0,0 +1,34 @@
1
+ import { ModuleCore } from "@vnejs/module.core";
2
+
3
+ import type { BgArgs } from "@vnejs/contracts.canvas.child.bg";
4
+
5
+ import type { PluginConstants, PluginEvents, PluginParams, PluginSettings } from "../types.js";
6
+
7
+ type BgUnlockPayload = {
8
+ name?: string;
9
+ args?: BgArgs;
10
+ };
11
+
12
+ export class BridgePluginLayerBgPluginGallery extends ModuleCore<PluginEvents, PluginConstants, PluginSettings, PluginParams> {
13
+ name = "bridge_plugin_layer_bg_plugin_gallery";
14
+
15
+ subscribe = () => {
16
+ this.on(this.EVENTS.LAYER_BG.SHOW, this.onBgUnlock);
17
+ this.on(this.EVENTS.LAYER_BG.CHANGE, this.onBgUnlock);
18
+ };
19
+
20
+ onBgUnlock = ({ name = "", args = {} }: BgUnlockPayload = {}) => {
21
+ if (!name) return;
22
+
23
+ const promises = [this.emitGalleryOpen(`${this.CONST.LAYER_BG.LAYER_CHILD_TYPE}/${name}`)];
24
+
25
+ if (args.overlays)
26
+ Object.entries(args.overlays).forEach(([key, value]) =>
27
+ promises.push(this.emitGalleryOpen(`${this.CONST.LAYER_BG.LAYER_CHILD_TYPE}/${name}/${key}/${value}`)),
28
+ );
29
+
30
+ return Promise.all(promises);
31
+ };
32
+
33
+ emitGalleryOpen = (key: string) => this.emit(this.EVENTS.GALLERY.OPEN, { key });
34
+ }
@@ -0,0 +1,41 @@
1
+ import { beforeEach, describe, expect, it } from "vitest";
2
+
3
+ import { spyEvent } from "@vnejs/test-utils";
4
+
5
+ import { BridgePluginLayerBgPluginGallery } from "../modules/bridge_plugin_layer_bg_plugin_gallery.js";
6
+
7
+ import { createCompatibilityTestModule, GALLERY_EVENTS, LAYER_BG_EVENTS, registerCompatibilityVne } from "./setup.js";
8
+
9
+ describe("BridgePluginLayerBgPluginGallery", () => {
10
+ beforeEach(() => registerCompatibilityVne());
11
+
12
+ it("LAYER_BG.SHOW with name opens gallery", async () => {
13
+ const { observer } = createCompatibilityTestModule(BridgePluginLayerBgPluginGallery);
14
+ const open = spyEvent(observer, GALLERY_EVENTS.OPEN);
15
+
16
+ await observer.emit(LAYER_BG_EVENTS.SHOW, { name: "photo" });
17
+
18
+ expect(open).toHaveBeenCalledOnce();
19
+ expect(open).toHaveBeenCalledWith({ key: "bg/photo" });
20
+ });
21
+
22
+ it("LAYER_BG.SHOW without name does not open gallery", async () => {
23
+ const { observer } = createCompatibilityTestModule(BridgePluginLayerBgPluginGallery);
24
+ const open = spyEvent(observer, GALLERY_EVENTS.OPEN);
25
+
26
+ await observer.emit(LAYER_BG_EVENTS.SHOW, {});
27
+
28
+ expect(open).not.toHaveBeenCalled();
29
+ });
30
+
31
+ it("LAYER_BG.CHANGE with overlays opens gallery keys for name and overlays", async () => {
32
+ const { observer } = createCompatibilityTestModule(BridgePluginLayerBgPluginGallery);
33
+ const open = spyEvent(observer, GALLERY_EVENTS.OPEN);
34
+
35
+ await observer.emit(LAYER_BG_EVENTS.CHANGE, { name: "photo", args: { overlays: { weather: "rain" } } });
36
+
37
+ expect(open).toHaveBeenCalledTimes(2);
38
+ expect(open).toHaveBeenCalledWith({ key: "bg/photo" });
39
+ expect(open).toHaveBeenCalledWith({ key: "bg/photo/weather/rain" });
40
+ });
41
+ });
@@ -0,0 +1,17 @@
1
+ import { createTestModule as baseCreateTestModule, registerCoreVne, registerVnePlugin } from "@vnejs/test-utils";
2
+
3
+ import { CONSTANTS as LAYER_BG_CONST, PLUGIN_NAME as LAYER_BG, SUBSCRIBE_EVENTS as LAYER_BG_EVENTS } from "@vnejs/contracts.canvas.child.bg";
4
+ import { SUBSCRIBE_EVENTS as GALLERY_EVENTS, PLUGIN_NAME as GALLERY } from "@vnejs/contracts.controllers.screens.gallery";
5
+
6
+ export const registerCompatibilityVne = () => {
7
+ registerCoreVne();
8
+ registerVnePlugin(LAYER_BG, { constants: LAYER_BG_CONST, events: LAYER_BG_EVENTS });
9
+ registerVnePlugin(GALLERY, { events: GALLERY_EVENTS });
10
+ };
11
+
12
+ export const createCompatibilityTestModule = <T extends Parameters<typeof baseCreateTestModule>[0]>(
13
+ ModuleClass: T,
14
+ options: Parameters<typeof baseCreateTestModule>[1] = {},
15
+ ) => baseCreateTestModule(ModuleClass, options);
16
+
17
+ export { GALLERY_EVENTS, LAYER_BG_CONST, LAYER_BG_EVENTS };
package/src/types.ts ADDED
@@ -0,0 +1,18 @@
1
+ import "@vnejs/contracts.controllers.screens.gallery";
2
+
3
+ import type { ModuleCoreConstants, ModuleCoreEvents, ModuleCoreParams, ModuleCoreSettings } from "@vnejs/module.core";
4
+
5
+ import type {
6
+ PluginName as LayerBgPluginName,
7
+ Constants as LayerBgConstants,
8
+ SubscribeEvents as LayerBgSubscribeEvents,
9
+ } from "@vnejs/contracts.canvas.child.bg";
10
+ import type { PluginName as GalleryPluginName, SubscribeEvents as GallerySubscribeEvents } from "@vnejs/contracts.controllers.screens.gallery";
11
+
12
+ export type PluginEvents = ModuleCoreEvents & Record<LayerBgPluginName, LayerBgSubscribeEvents> & Record<GalleryPluginName, GallerySubscribeEvents>;
13
+
14
+ export type PluginConstants = ModuleCoreConstants & Record<LayerBgPluginName, LayerBgConstants>;
15
+
16
+ export type PluginSettings = ModuleCoreSettings;
17
+
18
+ export type PluginParams = ModuleCoreParams;
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "@vnejs/configs.ts-common/tsconfig.json",
3
+ "compilerOptions": {
4
+ "rootDir": "src",
5
+ "outDir": "dist"
6
+ },
7
+ "include": ["src/**/*.ts"],
8
+ "exclude": ["dist", "node_modules", "src/tests"]
9
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.