UNPKG

@alitajs/umi-presets-alita

Version:
121 lines (110 loc) 4.12 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } // h5,cordova,pc,micro var _default = api => { api.describe({ key: 'appType', config: { schema(joi) { return joi.string().valid('h5', 'pc', 'cordova', 'micro', 'native'); }, default: 'h5' } }); if (api.userConfig.appType !== 'pc') { api.modifyDefaultConfig(memo => { return _objectSpread(_objectSpread({}, memo), {}, { hd: {} }); }); api.addHTMLMetas(() => { const addItem = { content: 'telephone=no', name: 'format-detection' }; return [addItem]; }); api.addHTMLStyles(() => { const addItem = { content: `* { box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; } html { width: 100%; height: 100vh !important; text-size-adjust: 100%; --alita-safe-area-top: constant(safe-area-inset-top); --alita-safe-area-top: env(safe-area-inset-top); --alita-safe-area-bottom: constant(safe-area-inset-bottom); --alita-safe-area-bottom: env(safe-area-inset-bottom); --alita-safe-area-left: constant(safe-area-inset-left); --alita-safe-area-left: env(safe-area-inset-left); --alita-safe-area-right: constant(safe-area-inset-right); --alita-safe-area-right: env(safe-area-inset-right); } body { -moz-osx-font-smoothing: grayscale; -webkit-font-smoothing: antialiased; margin-left: 0; margin-right: 0; margin-top: 0; margin-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0; padding-bottom: 0; position: fixed; top: 0; right: 0; bottom: 0; left: 0; width: 100%; max-width: 100%; height: 100% !important; max-height: 100% !important; text-rendering: optimizeLegibility; overflow: hidden; touch-action: manipulation; -webkit-user-drag: none; -ms-content-zooming: none; word-wrap: break-word; overscroll-behavior-y: none; text-size-adjust: none; } .alita-page { left: 0; right: 0; top: 0; bottom: 0; display: flex; position: absolute; flex-direction: column; justify-content: space-between; contain: layout size style; overflow: hidden; z-index: 0; } input { border: none; outline: none; } textarea:disabled, input:disabled { background-color: transparent; } ` }; return [addItem]; }); } }; exports.default = _default;