mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-05 19:41:40 +08:00
1 line
47 KiB
Plaintext
1 line
47 KiB
Plaintext
{"version":3,"file":"resetcss.e39ac995.js","sources":["../../vite/modulepreload-polyfill","../../../../node_modules/events/events.js","../../../../packages/core/src/Env.ts","../../../../packages/core/src/events.ts","../../../../packages/core/src/Node.ts","../../../../packages/core/src/Page.ts","../../../../packages/core/src/utils.ts","../../../../packages/core/src/App.ts"],"sourcesContent":["const p = function polyfill() {\n const relList = document.createElement('link').relList;\n if (relList && relList.supports && relList.supports('modulepreload')) {\n return;\n }\n for (const link of document.querySelectorAll('link[rel=\"modulepreload\"]')) {\n processPreload(link);\n }\n new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (mutation.type !== 'childList') {\n continue;\n }\n for (const node of mutation.addedNodes) {\n if (node.tagName === 'LINK' && node.rel === 'modulepreload')\n processPreload(node);\n }\n }\n }).observe(document, { childList: true, subtree: true });\n function getFetchOpts(script) {\n const fetchOpts = {};\n if (script.integrity)\n fetchOpts.integrity = script.integrity;\n if (script.referrerpolicy)\n fetchOpts.referrerPolicy = script.referrerpolicy;\n if (script.crossorigin === 'use-credentials')\n fetchOpts.credentials = 'include';\n else if (script.crossorigin === 'anonymous')\n fetchOpts.credentials = 'omit';\n else\n fetchOpts.credentials = 'same-origin';\n return fetchOpts;\n }\n function processPreload(link) {\n if (link.ep)\n // ep marker = processed\n return;\n link.ep = true;\n // prepopulate the load record\n const fetchOpts = getFetchOpts(link);\n fetch(link.href, fetchOpts);\n }\n};__VITE_IS_MODERN__&&p();","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar R = typeof Reflect === 'object' ? Reflect : null\nvar ReflectApply = R && typeof R.apply === 'function'\n ? R.apply\n : function ReflectApply(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n }\n\nvar ReflectOwnKeys\nif (R && typeof R.ownKeys === 'function') {\n ReflectOwnKeys = R.ownKeys\n} else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target)\n .concat(Object.getOwnPropertySymbols(target));\n };\n} else {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target);\n };\n}\n\nfunction ProcessEmitWarning(warning) {\n if (console && console.warn) console.warn(warning);\n}\n\nvar NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {\n return value !== value;\n}\n\nfunction EventEmitter() {\n EventEmitter.init.call(this);\n}\nmodule.exports = EventEmitter;\nmodule.exports.once = once;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._eventsCount = 0;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nvar defaultMaxListeners = 10;\n\nfunction checkListener(listener) {\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n}\n\nObject.defineProperty(EventEmitter, 'defaultMaxListeners', {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received ' + arg + '.');\n }\n defaultMaxListeners = arg;\n }\n});\n\nEventEmitter.init = function() {\n\n if (this._events === undefined ||\n this._events === Object.getPrototypeOf(this)._events) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n }\n\n this._maxListeners = this._maxListeners || undefined;\n};\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {\n throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received ' + n + '.');\n }\n this._maxListeners = n;\n return this;\n};\n\nfunction _getMaxListeners(that) {\n if (that._maxListeners === undefined)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n}\n\nEventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n};\n\nEventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);\n var doError = (type === 'error');\n\n var events = this._events;\n if (events !== undefined)\n doError = (doError && events.error === undefined);\n else if (!doError)\n return false;\n\n // If there is no 'error' event listener then throw.\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n // Note: The comments on the `throw` lines are intentional, they show\n // up in Node's output if this results in an unhandled exception.\n throw er; // Unhandled 'error' event\n }\n // At least give some kind of context to the user\n var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));\n err.context = er;\n throw err; // Unhandled 'error' event\n }\n\n var handler = events[type];\n\n if (handler === undefined)\n return false;\n\n if (typeof handler === 'function') {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n\n return true;\n};\n\nfunction _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n\n checkListener(listener);\n\n events = target._events;\n if (events === undefined) {\n events = target._events = Object.create(null);\n target._eventsCount = 0;\n } else {\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (events.newListener !== undefined) {\n target.emit('newListener', type,\n listener.listener ? listener.listener : listener);\n\n // Re-assign `events` because a newListener handler could have caused the\n // this._events to be assigned to a new object\n events = target._events;\n }\n existing = events[type];\n }\n\n if (existing === undefined) {\n // Optimize the case of one listener. Don't need the extra array object.\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === 'function') {\n // Adding the second element, need to change to array.\n existing = events[type] =\n prepend ? [listener, existing] : [existing, listener];\n // If we've already got an array, just append.\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n\n // Check for listener leak\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n // No error code for this since it is a Warning\n // eslint-disable-next-line no-restricted-syntax\n var w = new Error('Possible EventEmitter memory leak detected. ' +\n existing.length + ' ' + String(type) + ' listeners ' +\n 'added. Use emitter.setMaxListeners() to ' +\n 'increase limit');\n w.name = 'MaxListenersExceededWarning';\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n\n return target;\n}\n\nEventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.prependListener =\n function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n\nfunction onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n if (arguments.length === 0)\n return this.listener.call(this.target);\n return this.listener.apply(this.target, arguments);\n }\n}\n\nfunction _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n}\n\nEventEmitter.prototype.once = function once(type, listener) {\n checkListener(listener);\n this.on(type, _onceWrap(this, type, listener));\n return this;\n};\n\nEventEmitter.prototype.prependOnceListener =\n function prependOnceListener(type, listener) {\n checkListener(listener);\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n\n// Emits a 'removeListener' event if and only if the listener was removed.\nEventEmitter.prototype.removeListener =\n function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n\n checkListener(listener);\n\n events = this._events;\n if (events === undefined)\n return this;\n\n list = events[type];\n if (list === undefined)\n return this;\n\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit('removeListener', type, list.listener || listener);\n }\n } else if (typeof list !== 'function') {\n position = -1;\n\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n\n if (list.length === 1)\n events[type] = list[0];\n\n if (events.removeListener !== undefined)\n this.emit('removeListener', type, originalListener || listener);\n }\n\n return this;\n };\n\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\nEventEmitter.prototype.removeAllListeners =\n function removeAllListeners(type) {\n var listeners, events, i;\n\n events = this._events;\n if (events === undefined)\n return this;\n\n // not listening for removeListener, no need to emit\n if (events.removeListener === undefined) {\n if (arguments.length === 0) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== undefined) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key;\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n\n listeners = events[type];\n\n if (typeof listeners === 'function') {\n this.removeListener(type, listeners);\n } else if (listeners !== undefined) {\n // LIFO order\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n\n return this;\n };\n\nfunction _listeners(target, type, unwrap) {\n var events = target._events;\n\n if (events === undefined)\n return [];\n\n var evlistener = events[type];\n if (evlistener === undefined)\n return [];\n\n if (typeof evlistener === 'function')\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n\n return unwrap ?\n unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n}\n\nEventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n};\n\nEventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === 'function') {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n};\n\nEventEmitter.prototype.listenerCount = listenerCount;\nfunction listenerCount(type) {\n var events = this._events;\n\n if (events !== undefined) {\n var evlistener = events[type];\n\n if (typeof evlistener === 'function') {\n return 1;\n } else if (evlistener !== undefined) {\n return evlistener.length;\n }\n }\n\n return 0;\n}\n\nEventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n};\n\nfunction arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n}\n\nfunction spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n}\n\nfunction unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n}\n\nfunction once(emitter, name) {\n return new Promise(function (resolve, reject) {\n function errorListener(err) {\n emitter.removeListener(name, resolver);\n reject(err);\n }\n\n function resolver() {\n if (typeof emitter.removeListener === 'function') {\n emitter.removeListener('error', errorListener);\n }\n resolve([].slice.call(arguments));\n };\n\n eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });\n if (name !== 'error') {\n addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });\n }\n });\n}\n\nfunction addErrorHandlerIfEventEmitter(emitter, handler, flags) {\n if (typeof emitter.on === 'function') {\n eventTargetAgnosticAddListener(emitter, 'error', handler, flags);\n }\n}\n\nfunction eventTargetAgnosticAddListener(emitter, name, listener, flags) {\n if (typeof emitter.on === 'function') {\n if (flags.once) {\n emitter.once(name, listener);\n } else {\n emitter.on(name, listener);\n }\n } else if (typeof emitter.addEventListener === 'function') {\n // EventTarget does not have `error` event semantics like Node\n // EventEmitters, we do not listen for `error` events here.\n emitter.addEventListener(name, function wrapListener(arg) {\n // IE does not have builtin `{ once: true }` support so we\n // have to do it manually.\n if (flags.once) {\n emitter.removeEventListener(name, wrapListener);\n }\n listener(arg);\n });\n } else {\n throw new TypeError('The \"emitter\" argument must be of type EventEmitter. Received type ' + typeof emitter);\n }\n}\n","/*\n * Tencent is pleased to support the open source community by making TMagicEditor available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nclass Env {\n isIos = false;\n isIphone = false;\n isIpad = false;\n isAndroid = false;\n isAnroidPad = false;\n isMac = false;\n isWin = false;\n isMqq = false;\n isWechat = false;\n isWeb = false;\n\n constructor(ua = globalThis.navigator.userAgent, options: Record<string, boolean | string> = {}) {\n this.isIphone = ua.indexOf('iPhone') >= 0;\n\n this.isIpad = /(iPad).*OS\\s([\\d_]+)/.test(ua);\n\n this.isIos = this.isIphone || this.isIpad;\n\n this.isAndroid = ua.indexOf('Android') >= 0;\n\n this.isAnroidPad = this.isAndroid && ua.indexOf('Mobile') < 0;\n\n this.isMac = ua.indexOf('Macintosh') >= 0;\n\n this.isWin = ua.indexOf('Windows') >= 0;\n\n this.isMqq = /QQ\\/([\\d.]+)/.test(ua);\n\n this.isWechat = ua.indexOf('MicroMessenger') >= 0 && ua.indexOf('wxwork') < 0;\n\n this.isWeb = !this.isIos && !this.isAndroid && !/(WebOS|BlackBerry)/.test(ua);\n\n Object.entries(options).forEach(([key, value]) => {\n (this as any)[key] = value;\n });\n }\n}\n\nexport default Env;\n","/*\n * Tencent is pleased to support the open source community by making TMagicEditor available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * 通用的事件处理\n */\n\nimport App from './App';\nimport Node from './Node';\n\nexport interface EventOption {\n label: string;\n value: string;\n}\n\nconst COMMON_EVENT_PREFIX = 'magic:common:events:';\nconst COMMON_METHOD_PREFIX = 'magic:common:actions:';\nconst CommonMethod = {\n SHOW: 'show',\n HIDE: 'hide',\n SCROLL_TO_VIEW: 'scrollIntoView',\n SCROLL_TO_TOP: 'scrollToTop',\n};\n\nexport const DEFAULT_EVENTS: EventOption[] = [{ label: '点击', value: `${COMMON_EVENT_PREFIX}click` }];\n\nexport const DEFAULT_METHODS: EventOption[] = [\n { label: '显示', value: `${COMMON_METHOD_PREFIX}${CommonMethod.SHOW}` },\n { label: '隐藏', value: `${COMMON_METHOD_PREFIX}${CommonMethod.HIDE}` },\n { label: '滚动到该组件', value: `${COMMON_METHOD_PREFIX}${CommonMethod.SCROLL_TO_VIEW}` },\n { label: '回到顶部', value: `${COMMON_METHOD_PREFIX}${CommonMethod.SCROLL_TO_TOP}` },\n];\n\nexport const getCommonEventName = (commonEventName: string, nodeId: string | number) => {\n const returnName = `${commonEventName}:${nodeId}`;\n\n if (commonEventName.startsWith(COMMON_EVENT_PREFIX)) return returnName;\n\n return `${COMMON_EVENT_PREFIX}${returnName}`;\n};\n\nexport const isCommonMethod = (methodName: string) => methodName.startsWith(COMMON_METHOD_PREFIX);\n\n// 点击在组件内的某个元素上,需要向上寻找到当前组件\nconst getDirectComponent = (element: HTMLElement | null, app: App): Node | Boolean => {\n if (!element) {\n return false;\n }\n\n if (!element.id) {\n return getDirectComponent(element.parentElement, app);\n }\n\n const node = app.page?.getNode(element.id);\n if (!node) {\n return false;\n }\n\n return node;\n};\n\nconst commonClickEventHandler = (app: App, eventName: string, e: any) => {\n const node = getDirectComponent(e.target, app);\n\n if (node) {\n const { instance, data } = node as Node;\n app.emit(getCommonEventName(eventName, data.id), instance);\n }\n};\n\nexport const bindCommonEventListener = (app: App) => {\n window.document.body.addEventListener('click', (e: any) => {\n commonClickEventHandler(app, 'click', e);\n });\n\n window.document.body.addEventListener(\n 'click',\n (e: any) => {\n commonClickEventHandler(app, 'click:capture', e);\n },\n true,\n );\n};\n\nexport const triggerCommonMethod = (methodName: string, node: Node) => {\n const { instance } = node;\n\n switch (methodName.replace(COMMON_METHOD_PREFIX, '')) {\n case CommonMethod.SHOW:\n instance.show();\n break;\n\n case CommonMethod.HIDE:\n instance.hide();\n break;\n\n case CommonMethod.SCROLL_TO_VIEW:\n instance.$el.scrollIntoView({ behavior: 'smooth' });\n break;\n\n case CommonMethod.SCROLL_TO_TOP:\n window.scrollTo({ top: 0, behavior: 'smooth' });\n break;\n\n default:\n break;\n }\n};\n","/*\n * Tencent is pleased to support the open source community by making TMagicEditor available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { EventEmitter } from 'events';\n\nimport { EventItemConfig, MComponent, MContainer, MPage } from '@tmagic/schema';\n\nclass Node extends EventEmitter {\n data: MComponent | MContainer | MPage;\n style?: {\n [key: string]: any;\n };\n events?: EventItemConfig[];\n instance?: any;\n\n constructor(config: MComponent | MContainer) {\n super();\n\n const { events } = config;\n this.data = config;\n this.events = events;\n\n this.listenLifeSafe();\n\n this.once('destroy', () => {\n this.instance = null;\n if (typeof this.data.destroy === 'function') {\n this.data.destroy(this);\n }\n\n this.listenLifeSafe();\n });\n }\n\n listenLifeSafe() {\n this.once('created', (instance: any) => {\n this.instance = instance;\n if (typeof this.data.created === 'function') {\n this.data.created(this);\n }\n });\n\n this.once('mounted', (instance: any) => {\n this.instance = instance;\n if (typeof this.data.mounted === 'function') {\n this.data.mounted(this);\n }\n });\n }\n}\n\nexport default Node;\n","/*\n * Tencent is pleased to support the open source community by making TMagicEditor available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Id, MComponent, MContainer, MPage } from '@tmagic/schema';\n\nimport Node from './Node';\ninterface ConfigOptions {\n config: MPage;\n}\n\nclass Page extends Node {\n nodes = new Map<Id, Node>();\n\n constructor(options: ConfigOptions) {\n super(options.config);\n\n this.setNode(options.config.id, this);\n this.initNode(options.config);\n }\n\n initNode(config: MComponent | MContainer) {\n this.setNode(config.id, new Node(config));\n\n config.items?.forEach((element: MComponent | MContainer) => {\n this.initNode(element);\n });\n }\n\n getNode(id: Id) {\n return this.nodes.get(id);\n }\n\n setNode(id: Id, node: Node) {\n this.nodes.set(id, node);\n }\n\n deleteNode(id: Id) {\n this.nodes.delete(id);\n }\n}\n\nexport default Page;\n","/*\n * Tencent is pleased to support the open source community by making TMagicEditor available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const style2Obj = (style: string) => {\n if (typeof style !== 'string') {\n return style;\n }\n\n const obj: Record<string, any> = {};\n style.split(';').forEach((element) => {\n if (!element) {\n return;\n }\n\n const items = element.split(':');\n\n let key = items.shift();\n let value = items.join(':');\n\n if (!key) return;\n\n key = key.replace(/^\\s*/, '').replace(/\\s*$/, '');\n value = value.replace(/^\\s*/, '').replace(/\\s*$/, '');\n\n key = key\n .split('-')\n .map((v, i) => (i > 0 ? `${v[0].toUpperCase()}${v.substr(1)}` : v))\n .join('');\n\n obj[key] = value;\n });\n return obj;\n};\n\nexport const fillBackgroundImage = (value: string) => {\n if (value && !/^url/.test(value) && !/^linear-gradient/.test(value)) {\n return `url(${value})`;\n }\n return value;\n};\n","/*\n * Tencent is pleased to support the open source community by making TMagicEditor available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { EventEmitter } from 'events';\n\nimport { Id, MApp } from '@tmagic/schema';\n\nimport Env from './Env';\nimport {\n bindCommonEventListener,\n DEFAULT_EVENTS,\n getCommonEventName,\n isCommonMethod,\n triggerCommonMethod,\n} from './events';\nimport Page from './Page';\nimport { fillBackgroundImage, style2Obj } from './utils';\n\ninterface AppOptionsConfig {\n ua?: string;\n config?: MApp;\n platform?: 'editor' | 'mobile' | 'tv' | 'pc';\n jsEngine?: 'browser' | 'hippy';\n curPage?: Id;\n transformStyle?: (style: Record<string, any>) => Record<string, any>;\n}\n\nclass App extends EventEmitter {\n env;\n\n pages = new Map<Id, Page>();\n\n page: Page | undefined;\n\n platform = 'mobile';\n jsEngine = 'browser';\n\n components = new Map();\n\n constructor(options: AppOptionsConfig) {\n super();\n\n this.env = new Env(options.ua);\n options.platform && (this.platform = options.platform);\n options.jsEngine && (this.jsEngine = options.jsEngine);\n\n // 根据屏幕大小计算出跟节点的font-size,用于rem样式的适配\n if (this.platform === 'mobile' || this.platform === 'editor') {\n const calcFontsize = () => {\n let { width } = document.documentElement.getBoundingClientRect();\n width = Math.min(800, width);\n const fontSize = width / 3.75;\n document.documentElement.style.fontSize = `${fontSize}px`;\n };\n\n calcFontsize();\n\n document.body.style.fontSize = '14px';\n\n globalThis.addEventListener('resize', calcFontsize);\n }\n\n if (options.transformStyle) {\n this.transformStyle = options.transformStyle;\n }\n\n options.config && this.setConfig(options.config, options.curPage);\n\n bindCommonEventListener(this);\n }\n\n /**\n * 将dsl中的style配置转换成css,主要是将数子转成rem为单位的样式值,例如100将被转换成1rem\n * @param style Object\n * @returns Object\n */\n transformStyle(style: Record<string, any> | string) {\n if (!style) {\n return {};\n }\n\n let styleObj: Record<string, any> = {};\n const results: Record<string, any> = {};\n\n if (typeof style === 'string') {\n styleObj = style2Obj(style);\n } else {\n styleObj = { ...style };\n }\n\n const whiteList = ['zIndex', 'opacity', 'fontWeight'];\n Object.entries(styleObj).forEach(([key, value]) => {\n if (key === 'backgroundImage') {\n value && (results[key] = fillBackgroundImage(value));\n } else if (!whiteList.includes(key) && value && /^[-]?[0-9]*[.]?[0-9]*$/.test(value)) {\n results[key] = `${value / 100}rem`;\n } else {\n results[key] = value;\n }\n });\n\n return results;\n }\n\n /**\n * 设置dsl\n * @param config dsl跟节点\n * @param curPage 当前页面id\n */\n setConfig(config: MApp, curPage?: Id) {\n this.pages = new Map();\n\n config.items?.forEach((page) => {\n this.pages.set(\n page.id,\n new Page({\n config: page,\n }),\n );\n });\n\n this.setPage(curPage || this.page?.data?.id);\n }\n\n setPage(id?: Id) {\n let page;\n\n if (id) {\n page = this.pages.get(id);\n }\n\n if (!page) {\n page = this.pages.get(this.pages.keys().next().value);\n }\n\n this.page = page;\n\n if (this.platform !== 'magic') {\n this.bindEvents();\n }\n }\n\n registerComponent(type: string, Component: any) {\n this.components.set(type, Component);\n }\n\n unregisterComponent(type: string) {\n this.components.delete(type);\n }\n\n resolveComponent(type: string) {\n return this.components.get(type);\n }\n\n bindEvents() {\n if (!this.page) return;\n\n this.removeAllListeners();\n\n for (const [, value] of this.page.nodes) {\n value.events?.forEach((event) => {\n let { name: eventName } = event;\n if (DEFAULT_EVENTS.findIndex((defaultEvent) => defaultEvent.value === eventName) > -1) {\n // common 事件名通过 node id 避免重复触发\n eventName = getCommonEventName(eventName, `${value.data.id}`);\n }\n\n this.on(eventName, (fromCpt, ...args) => {\n if (!this.page) throw new Error('当前没有页面');\n\n const toNode = this.page.getNode(event.to);\n if (!toNode) throw `ID为${event.to}的组件不存在`;\n\n const { method: methodName } = event;\n if (isCommonMethod(methodName)) {\n return triggerCommonMethod(methodName, toNode);\n }\n\n if (typeof toNode.instance?.[methodName] === 'function') {\n toNode.instance[methodName](fromCpt, ...args);\n }\n });\n });\n }\n }\n\n destroy() {\n this.removeAllListeners();\n this.pages.clear();\n }\n}\n\nexport default App;\n"],"names":["eventsModule","events","EventEmitter"],"mappings":";;;;;;;;;;;;;;;;AAAA,MAAM,IAAI,oBAAoB;AAC1B,QAAM,UAAU,SAAS,cAAc,MAAM,EAAE;AAC/C,MAAI,WAAW,QAAQ,YAAY,QAAQ,SAAS,eAAe,GAAG;AAClE;AAAA,EACH;AACD,aAAW,QAAQ,SAAS,iBAAiB,2BAA2B,GAAG;AACvE,mBAAe,IAAI;AAAA,EACtB;AACD,MAAI,iBAAiB,CAAC,cAAc;AAChC,eAAW,YAAY,WAAW;AAC9B,UAAI,SAAS,SAAS,aAAa;AAC/B;AAAA,MACH;AACD,iBAAW,QAAQ,SAAS,YAAY;AACpC,YAAI,KAAK,YAAY,UAAU,KAAK,QAAQ;AACxC,yBAAe,IAAI;AAAA,MAC1B;AAAA,IACJ;AAAA,EACT,CAAK,EAAE,QAAQ,UAAU,EAAE,WAAW,MAAM,SAAS,KAAI,CAAE;AACvD,wBAAsB,QAAQ;AAC1B,UAAM,YAAY,CAAA;AAClB,QAAI,OAAO;AACP,gBAAU,YAAY,OAAO;AACjC,QAAI,OAAO;AACP,gBAAU,iBAAiB,OAAO;AACtC,QAAI,OAAO,gBAAgB;AACvB,gBAAU,cAAc;AAAA,aACnB,OAAO,gBAAgB;AAC5B,gBAAU,cAAc;AAAA;AAExB,gBAAU,cAAc;AAC5B,WAAO;AAAA,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