@vnejs/plugins.compatibility.gallery.layer 0.1.1 → 0.1.2

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,15 @@
1
+ import { Module } from "@vnejs/module";
2
+ import type { PluginConstants, PluginEvents, PluginParams, PluginSettings } from "./types.js";
3
+ type LayerChildAddPayload = {
4
+ layer?: string;
5
+ child?: {
6
+ name?: string;
7
+ type?: string;
8
+ };
9
+ };
10
+ export declare class CompatibilityGalleryLayer extends Module<PluginEvents, PluginConstants, PluginSettings, PluginParams> {
11
+ name: string;
12
+ subscribe: () => void;
13
+ onChildAdd: ({ layer, child: { name, type } }?: LayerChildAddPayload) => false | "" | Promise<unknown[]> | undefined;
14
+ }
15
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ import { Module } from "@vnejs/module";
2
+ import { regModule } from "@vnejs/shared";
3
+ export class CompatibilityGalleryLayer extends Module {
4
+ name = "compatibility.gallery.layer";
5
+ subscribe = () => {
6
+ this.on(this.EVENTS.LAYER.CHILD_ADD, this.onChildAdd);
7
+ };
8
+ onChildAdd = ({ layer = "", child: { name = "", type = "" } = {} } = {}) => type === this.CONST.LAYER_IMAGE.LAYER_CHILD_TYPE && name && this.emit(this.EVENTS.GALLERY.OPEN, { key: `${layer}/${name}` });
9
+ }
10
+ regModule(CompatibilityGalleryLayer);
@@ -0,0 +1,11 @@
1
+ import type { VnePluginConstantsMapRegistry, VnePluginEventsMapRegistry, VnePluginParamsMapRegistry, VnePluginSettingsMapRegistry } from "@vnejs/shared";
2
+ import type { PluginName as LayerImagePluginName, Constants as LayerImageConstants } from "@vnejs/plugins.canvas.image.contract";
3
+ import type { PluginName as LayerPluginName, SubscribeEvents as LayerSubscribeEvents } from "@vnejs/plugins.canvas.layer.contract";
4
+ declare const GALLERY_EVENTS: {
5
+ readonly OPEN: "vne:gallery:open";
6
+ };
7
+ export type PluginEvents = VnePluginEventsMapRegistry & Record<LayerPluginName, LayerSubscribeEvents> & Record<"GALLERY", typeof GALLERY_EVENTS>;
8
+ export type PluginConstants = VnePluginConstantsMapRegistry & Record<LayerImagePluginName, LayerImageConstants>;
9
+ export type PluginSettings = VnePluginSettingsMapRegistry;
10
+ export type PluginParams = VnePluginParamsMapRegistry;
11
+ export {};
package/dist/types.js ADDED
@@ -0,0 +1,4 @@
1
+ const GALLERY_EVENTS = {
2
+ OPEN: "vne:gallery:open",
3
+ };
4
+ export {};
package/package.json CHANGED
@@ -1,17 +1,41 @@
1
1
  {
2
2
  "name": "@vnejs/plugins.compatibility.gallery.layer",
3
- "version": "0.1.1",
4
- "main": "index.js",
3
+ "version": "0.1.2",
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
+ ],
5
20
  "scripts": {
6
21
  "test": "echo \"Error: no test specified\" && exit 1",
22
+ "build": "npx @vnejs/monorepo package",
7
23
  "publish:major:plugin": "npm run publish:major",
8
24
  "publish:minor:plugin": "npm run publish:minor",
9
25
  "publish:patch:plugin": "npm run publish:patch",
10
- "publish:major": "npm version major && npm publish --access public",
11
- "publish:minor": "npm version minor && npm publish --access public",
12
- "publish:patch": "npm version patch && npm publish --access public"
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"
13
29
  },
14
30
  "author": "",
15
31
  "license": "ISC",
16
- "description": ""
32
+ "peerDependencies": {
33
+ "@vnejs/module": "~0.0.1",
34
+ "@vnejs/plugins.canvas.image.contract": "~0.0.1",
35
+ "@vnejs/plugins.canvas.layer.contract": "~0.0.1",
36
+ "@vnejs/shared": "~0.0.9"
37
+ },
38
+ "devDependencies": {
39
+ "@vnejs/configs.ts-common": "~0.0.1"
40
+ }
17
41
  }
@@ -1,14 +1,24 @@
1
1
  import { Module } from "@vnejs/module";
2
2
  import { regModule } from "@vnejs/shared";
3
3
 
4
- export class CompatibilityGalleryLayer extends Module {
4
+ import type { PluginConstants, PluginEvents, PluginParams, PluginSettings } from "./types.js";
5
+
6
+ type LayerChildAddPayload = {
7
+ layer?: string;
8
+ child?: {
9
+ name?: string;
10
+ type?: string;
11
+ };
12
+ };
13
+
14
+ export class CompatibilityGalleryLayer extends Module<PluginEvents, PluginConstants, PluginSettings, PluginParams> {
5
15
  name = "compatibility.gallery.layer";
6
16
 
7
17
  subscribe = () => {
8
18
  this.on(this.EVENTS.LAYER.CHILD_ADD, this.onChildAdd);
9
19
  };
10
20
 
11
- onChildAdd = ({ layer = "", child: { name = "", type = "" } = {} } = {}) =>
21
+ onChildAdd = ({ layer = "", child: { name = "", type = "" } = {} }: LayerChildAddPayload = {}) =>
12
22
  type === this.CONST.LAYER_IMAGE.LAYER_CHILD_TYPE && name && this.emit(this.EVENTS.GALLERY.OPEN, { key: `${layer}/${name}` });
13
23
  }
14
24
 
package/src/types.ts ADDED
@@ -0,0 +1,17 @@
1
+ import type { VnePluginConstantsMapRegistry, VnePluginEventsMapRegistry, VnePluginParamsMapRegistry, VnePluginSettingsMapRegistry } from "@vnejs/shared";
2
+ import type { PluginName as LayerImagePluginName, Constants as LayerImageConstants } from "@vnejs/plugins.canvas.image.contract";
3
+ import type { PluginName as LayerPluginName, SubscribeEvents as LayerSubscribeEvents } from "@vnejs/plugins.canvas.layer.contract";
4
+
5
+ const GALLERY_EVENTS = {
6
+ OPEN: "vne:gallery:open",
7
+ } as const;
8
+
9
+ export type PluginEvents = VnePluginEventsMapRegistry &
10
+ Record<LayerPluginName, LayerSubscribeEvents> &
11
+ Record<"GALLERY", typeof GALLERY_EVENTS>;
12
+
13
+ export type PluginConstants = VnePluginConstantsMapRegistry & Record<LayerImagePluginName, LayerImageConstants>;
14
+
15
+ export type PluginSettings = VnePluginSettingsMapRegistry;
16
+
17
+ export type PluginParams = VnePluginParamsMapRegistry;
package/tsconfig.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "@vnejs/configs.ts-common/tsconfig.json",
3
+ "compilerOptions": { "rootDir": "src", "outDir": "dist" },
4
+ "include": ["src/**/*.ts"],
5
+ "exclude": ["dist", "node_modules"]
6
+ }