@eva/inspector-decorator
Advanced tools
Comparing version 0.1.0-alpha.1 to 0.1.0-alpha.2
@@ -11,2 +11,4 @@ declare type AnyOptions = Record<string, any>; | ||
export declare const ExecuteInEditMode: ClassDecorator; | ||
export declare function Field(): PropertyDecorator; | ||
@@ -60,2 +62,4 @@ | ||
export declare const shouldExecuteInEditMode: (target: ClassType) => boolean; | ||
export declare type StaticGetProperties<T extends ClassType<any>> = () => DynamicGetProperties<T> | FieldMetadata<InstanceType<T>>; | ||
@@ -62,0 +66,0 @@ |
@@ -29,2 +29,3 @@ 'use strict'; | ||
var IDE_PROPERTY_METADATA = 'IDE_PROPERTY_METADATA'; | ||
var COMPONENT_EXECUTE_MODE_METADATA = 'COMPONENT_EXECUTE_MODE_METADATA'; | ||
@@ -109,4 +110,19 @@ function isFunction(val) { | ||
} | ||
var ExecuteMode; | ||
(function (ExecuteMode) { | ||
ExecuteMode[ExecuteMode["Edit"] = 2] = "Edit"; | ||
ExecuteMode[ExecuteMode["Game"] = 4] = "Game"; | ||
ExecuteMode[ExecuteMode["All"] = 6] = "All"; | ||
})(ExecuteMode || (ExecuteMode = {})); | ||
var ExecuteInEditMode = function (target) { | ||
Reflect.defineMetadata(COMPONENT_EXECUTE_MODE_METADATA, ExecuteMode.Edit, target); | ||
}; | ||
var shouldExecuteInEditMode = function (target) { | ||
var mode = Reflect.getMetadata(COMPONENT_EXECUTE_MODE_METADATA, target); | ||
return !!(mode & ExecuteMode.Edit); | ||
}; | ||
exports.ExecuteInEditMode = ExecuteInEditMode; | ||
exports.Field = Field; | ||
exports.getPropertiesOf = getPropertiesOf; | ||
exports.shouldExecuteInEditMode = shouldExecuteInEditMode; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),e=function(e){function r(){var t=this.constructor,r=e.call(this,"Symbol keys are not supported yet!")||this;return Object.setPrototypeOf(r,t.prototype),r}return t.__extends(r,e),r}(Error),r=function(e){function r(){var t=this.constructor,r=e.call(this,"getProperties is not a function!")||this;return Object.setPrototypeOf(r,t.prototype),r}return t.__extends(r,e),r}(Error);function n(t){return t===String?"string":t===Number?"number":t===Boolean?"boolean":"unknown"}exports.Field=function(r,o){return function(i,u){if("symbol"==typeof u)throw new e;var s=function(t,e){return"function"==typeof t?{returnTypeFunc:t,options:e||{}}:{options:t||{}}}(r,o);!function(e,r,o,i){var u=Reflect.getMetadata("design:type",e,r),s=u===Array,c=n(u);if("unknown"!==c&&(u=c),i){var a=i();Array.isArray(a)?(s=!0,u=a[0]):u=a}var f=Reflect.getMetadata("IDE_PROPERTY_METADATA",e.constructor)||{};f[r]=t.__assign({type:u,isArray:s},o),Reflect.defineMetadata("IDE_PROPERTY_METADATA",f,e.constructor)}(i,u,s.options,s.returnTypeFunc)}},exports.getPropertiesOf=function t(e){if("getProperties"in e){if("function"!=typeof e.getProperties)throw new r;return e.getProperties()}var o=Reflect.getMetadata("IDE_PROPERTY_METADATA",e)||{};return Object.keys(o).forEach((function(e){if("function"==typeof o[e].type){var r=n(o[e].type);o[e].type="unknown"!==r?r:t(o[e].type)}})),o}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("tslib"),r=function(t){function r(){var e=this.constructor,r=t.call(this,"Symbol keys are not supported yet!")||this;return Object.setPrototypeOf(r,e.prototype),r}return e.__extends(r,t),r}(Error),n=function(t){function r(){var e=this.constructor,r=t.call(this,"getProperties is not a function!")||this;return Object.setPrototypeOf(r,e.prototype),r}return e.__extends(r,t),r}(Error);function o(t){return t===String?"string":t===Number?"number":t===Boolean?"boolean":"unknown"}!function(t){t[t.Edit=2]="Edit",t[t.Game=4]="Game",t[t.All=6]="All"}(t||(t={}));exports.ExecuteInEditMode=function(e){Reflect.defineMetadata("COMPONENT_EXECUTE_MODE_METADATA",t.Edit,e)},exports.Field=function(t,n){return function(i,u){if("symbol"==typeof u)throw new r;var c=function(t,e){return"function"==typeof t?{returnTypeFunc:t,options:e||{}}:{options:t||{}}}(t,n);!function(t,r,n,i){var u=Reflect.getMetadata("design:type",t,r),c=u===Array,s=o(u);if("unknown"!==s&&(u=s),i){var a=i();Array.isArray(a)?(c=!0,u=a[0]):u=a}var f=Reflect.getMetadata("IDE_PROPERTY_METADATA",t.constructor)||{};f[r]=e.__assign({type:u,isArray:c},n),Reflect.defineMetadata("IDE_PROPERTY_METADATA",f,t.constructor)}(i,u,c.options,c.returnTypeFunc)}},exports.getPropertiesOf=function t(e){if("getProperties"in e){if("function"!=typeof e.getProperties)throw new n;return e.getProperties()}var r=Reflect.getMetadata("IDE_PROPERTY_METADATA",e)||{};return Object.keys(r).forEach((function(e){if("function"==typeof r[e].type){var n=o(r[e].type);r[e].type="unknown"!==n?n:t(r[e].type)}})),r},exports.shouldExecuteInEditMode=function(e){return!!(Reflect.getMetadata("COMPONENT_EXECUTE_MODE_METADATA",e)&t.Edit)}; |
@@ -25,2 +25,3 @@ import { __extends, __assign } from 'tslib'; | ||
var IDE_PROPERTY_METADATA = 'IDE_PROPERTY_METADATA'; | ||
var COMPONENT_EXECUTE_MODE_METADATA = 'COMPONENT_EXECUTE_MODE_METADATA'; | ||
@@ -105,3 +106,16 @@ function isFunction(val) { | ||
} | ||
var ExecuteMode; | ||
(function (ExecuteMode) { | ||
ExecuteMode[ExecuteMode["Edit"] = 2] = "Edit"; | ||
ExecuteMode[ExecuteMode["Game"] = 4] = "Game"; | ||
ExecuteMode[ExecuteMode["All"] = 6] = "All"; | ||
})(ExecuteMode || (ExecuteMode = {})); | ||
var ExecuteInEditMode = function (target) { | ||
Reflect.defineMetadata(COMPONENT_EXECUTE_MODE_METADATA, ExecuteMode.Edit, target); | ||
}; | ||
var shouldExecuteInEditMode = function (target) { | ||
var mode = Reflect.getMetadata(COMPONENT_EXECUTE_MODE_METADATA, target); | ||
return !!(mode & ExecuteMode.Edit); | ||
}; | ||
export { Field, getPropertiesOf }; | ||
export { ExecuteInEditMode, Field, getPropertiesOf, shouldExecuteInEditMode }; |
{ | ||
"name": "@eva/inspector-decorator", | ||
"version": "0.1.0-alpha.1", | ||
"version": "0.1.0-alpha.2", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "build": "node ./scripts/build.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20986
21
408
1