@oinone/kunlun-environment 6.2.7 → 6.3.0
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Manager as e,ObjectUtils as t}from"@oinone/kunlun-shared";import{SPIOperator as n}from"@oinone/kunlun-spi";const r="oio-click-activated",o="__null__";function i(e,t){return new Proxy({handle:e,el:t},{get(e,t,n){var r,o,i,c,l,a;switch(t){case"w":return(null===(r=e.el)||void 0===r?void 0:r.getBoundingClientRect().width)||0;case"h":return(null===(o=e.el)||void 0===o?void 0:o.getBoundingClientRect().height)||0;case"x":return(null===(i=e.el)||void 0===i?void 0:i.getBoundingClientRect().x)||0;case"y":return(null===(c=e.el)||void 0===c?void 0:c.getBoundingClientRect().y)||0;case"ex":{const t=null===(l=e.el)||void 0===l?void 0:l.getBoundingClientRect();return t?t.x+t.width:0}case"ey":{const t=null===(a=e.el)||void 0===a?void 0:a.getBoundingClientRect();return t?t.y+t.height:0}case"el":{const r=Reflect.get(e,t,n);return"function"==typeof r?r():r}}return Reflect.get(e,t,n)}})}const c={getContentHTMLElement:function(){const{contentSelector:e}=this,t=document.querySelector(e);if(t)return t}};class l{static getGlobalEnvironment(){return l.manager.get(l.ROOT_HANDLE)}static getCurrentEnvironment(){const e=l.currentHandle,t=l.manager.get(e);if(!t)throw new Error(`Invalid current environment. handle: ${e}`);return t}static get(e){return l.manager.get(e)}static createOrReplace(e,t){return l.manager.createOrReplace(e,t)}static delete(e,t=!0){l.manager.delete(e,t)}static select(e){if(!l.manager.get(e))throw new Error(`Invalid environment. ${e}`);this.currentHandle=e}}function a(){return l.getGlobalEnvironment()}function u(){return l.getCurrentEnvironment()}l.manager=new class extends e{constructor(){super()}generator(e){const n={contentSelector:o,mcx:0,mcy:0,st:0,sl:0,visibleArea:new Map,clickVisibleArea:[]},r=["contentVisibleArea","visibleArea"];for(const[e,t]of Object.entries(c))r.push(e),n[e]=t.bind(n);return n.contentVisibleArea=i(e,(
|
|
1
|
+
import{Manager as e,ObjectUtils as t}from"@oinone/kunlun-shared";import{SPIOperator as n}from"@oinone/kunlun-spi";const r="oio-click-activated",o="__null__";function i(e,t){return new Proxy({handle:e,el:t},{get(e,t,n){var r,o,i,c,l,a;switch(t){case"w":return(null===(r=e.el)||void 0===r?void 0:r.getBoundingClientRect().width)||0;case"h":return(null===(o=e.el)||void 0===o?void 0:o.getBoundingClientRect().height)||0;case"x":return(null===(i=e.el)||void 0===i?void 0:i.getBoundingClientRect().x)||0;case"y":return(null===(c=e.el)||void 0===c?void 0:c.getBoundingClientRect().y)||0;case"ex":{const t=null===(l=e.el)||void 0===l?void 0:l.getBoundingClientRect();return t?t.x+t.width:0}case"ey":{const t=null===(a=e.el)||void 0===a?void 0:a.getBoundingClientRect();return t?t.y+t.height:0}case"el":{const r=Reflect.get(e,t,n);return"function"==typeof r?r():r}}return Reflect.get(e,t,n)}})}const c={getContentHTMLElement:function(){const{contentSelector:e}=this,t=document.querySelector(e);if(t)return t}};class l{static getGlobalEnvironment(){return l.manager.get(l.ROOT_HANDLE)}static getCurrentEnvironment(){const e=l.currentHandle,t=l.manager.get(e);if(!t)throw new Error(`Invalid current environment. handle: ${e}`);return t}static get(e){return l.manager.get(e)}static createOrReplace(e,t){return l.manager.createOrReplace(e,t)}static delete(e,t=!0){l.manager.delete(e,t)}static select(e){if(!l.manager.get(e))throw new Error(`Invalid environment. ${e}`);this.currentHandle=e}}function a(){return l.getGlobalEnvironment()}function u(){return l.getCurrentEnvironment()}l.manager=new class extends e{constructor(){super()}generator(e){const n={contentSelector:o,mcx:0,mcy:0,st:0,sl:0,visibleArea:new Map,clickVisibleArea:[]},r=["contentVisibleArea","visibleArea"];for(const[e,t]of Object.entries(c))r.push(e),n[e]=t.bind(n);return n.contentVisibleArea=i(e,()=>n.getContentHTMLElement()),t.readonly(n,r)}},l.ROOT_HANDLE="__ROOT_HANDLE__",l.currentHandle=l.ROOT_HANDLE,l.manager.createOrReplace(l.ROOT_HANDLE);const s=Symbol("__current_instance_getter");function g(e,t){return n.register(s,e,t)}function d(e){return n.selector(s,e)}function m(){return d({framework:"vue"})()}n.createStorage({key:s,matchKeys:["framework","isMobile"]});export{r as CLICK_ACTIVATED_CLASS,o as CONTENT_NULL_SELECTOR,l as RuntimeEnvironmentManager,i as createVisibleArea,g as registerCurrentInstanceGetter,d as selectorCurrentInstanceGetter,m as useCurrentInstance,u as useEnv,a as useGlobalEnv};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oinone/kunlun-environment",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.0",
|
|
4
4
|
"main": "index.ts",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prebuild": "rimraf dist",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"x-postpublish": "node ../../scripts/postpublish.js"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@oinone/kunlun-shared": "6.
|
|
15
|
-
"@oinone/kunlun-spi": "6.
|
|
14
|
+
"@oinone/kunlun-shared": "6.3.0",
|
|
15
|
+
"@oinone/kunlun-spi": "6.3.0"
|
|
16
16
|
},
|
|
17
17
|
"gitHead": "2b4c0c7911626c105ca71c2d41e54af470e2e079"
|
|
18
18
|
}
|