UNPKG

@zeppos/zml

Version:

A Mini Library of ZeppOS MiniApp

2 lines (1 loc) 924 B
function t(){return i()&&n()}function e(){return i()&&o()}function n(){return"undefined"!=typeof hmApp}function o(){return"undefined"!=typeof __$$R$$__}function i(){return n()||o()}let p=null;p="undefined"!=typeof __$$R$$__?__$$R$$__:()=>({}),t()?hmApp.getPackageInfo:e()&&p("@zos/app").getPackageInfo;let u=null;t()?u=hmUI:e()&&(u=p("@zos/ui"));let r=null;t()?r=hmSetting:e()&&(r=p("@zos/settings")),t()?px:p("@zos/utils").px,t()?hmSetting.getDeviceInfo:e()&&p("@zos/device").getDeviceInfo,t()?"undefined"!=typeof __$$app$$__&&__$$app$$__:e()&&p("@zos/i18n").getText,t()?hmApp.gotoPage:e()&&p("@zos/router").push,t()?hmApp:e()&&p("@zos/app");const $=u.sp??(t=>t);function f(t){return{[Symbol.toPrimitive]:e=>"string"===e?`${t.toFixed(0)}sp`:$(t)}}const _=(r.getFontSizeInfo??(()=>({DPIFactor:1})))();function s(t){return{[Symbol.toPrimitive]:e=>"string"===e?`swdpi(${t.toFixed(0)})`:t*_.DPIFactor}}export{s as dp,f as sp};