UNPKG

bytev-charts

Version:

基于echarts和JavaScript及ES6封装的一个可以直接调用的图表组件库,内置主题设计,简单快捷,且支持用户自定义配置; npm 安装方式: npm install bytev-charts 若启动提示还需额外install插件,则运行 npm install @babel/runtime-corejs2 即可;

170 lines (140 loc) 7.17 kB
import "core-js/modules/es.array.slice.js"; import "core-js/modules/es.regexp.exec.js"; import _Reflect$construct from "@babel/runtime-corejs2/core-js/reflect/construct"; import _Array$from from "@babel/runtime-corejs2/core-js/array/from"; import _Symbol from "@babel/runtime-corejs2/core-js/symbol"; import _Symbol$iterator from "@babel/runtime-corejs2/core-js/symbol/iterator"; import _Array$isArray from "@babel/runtime-corejs2/core-js/array/is-array"; import _toConsumableArray from "@babel/runtime-corejs2/helpers/toConsumableArray"; import _classCallCheck from "@babel/runtime-corejs2/helpers/classCallCheck"; import _createClass from "@babel/runtime-corejs2/helpers/createClass"; import _assertThisInitialized from "@babel/runtime-corejs2/helpers/assertThisInitialized"; import _inherits from "@babel/runtime-corejs2/helpers/inherits"; import _possibleConstructorReturn from "@babel/runtime-corejs2/helpers/possibleConstructorReturn"; import _getPrototypeOf from "@babel/runtime-corejs2/helpers/getPrototypeOf"; function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && o[_Symbol$iterator] || o["@@iterator"]; if (!it) { if (_Array$isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } import _Map from "@babel/runtime-corejs2/core-js/map"; import _Object$defineProperty from "@babel/runtime-corejs2/core-js/object/define-property"; import "core-js/modules/es.function.name.js"; import "core-js/modules/es.array.iterator.js"; import "core-js/modules/es.object.to-string.js"; import "core-js/modules/web.dom-collections.iterator.js"; function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } import WebGPUBinding from './WebGPUBinding.js'; var WebGPUUniformsGroup = /*#__PURE__*/function (_WebGPUBinding) { _inherits(WebGPUUniformsGroup, _WebGPUBinding); var _super = _createSuper(WebGPUUniformsGroup); function WebGPUUniformsGroup() { var _this; _classCallCheck(this, WebGPUUniformsGroup); _this = _super.call(this); _this.name = ''; _this.uniforms = new _Map(); _this.update = function () {}; _this.type = 'uniform-buffer'; _this.visibility = GPUShaderStage.VERTEX; _this.usage = GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST; _this.array = null; // set by the renderer _this.bufferGPU = null; // set by the renderer _Object$defineProperty(_assertThisInitialized(_this), 'isUniformsGroup', { value: true }); return _this; } _createClass(WebGPUUniformsGroup, [{ key: "setName", value: function setName(name) { this.name = name; } }, { key: "setUniform", value: function setUniform(name, uniform) { this.uniforms.set(name, uniform); return this; } }, { key: "removeUniform", value: function removeUniform(name) { this.uniforms["delete"](name); return this; } }, { key: "setUpdateCallback", value: function setUpdateCallback(callback) { this.update = callback; return this; } }, { key: "copy", value: function copy(source) { this.name = source.name; var uniformsSource = source.uniforms; this.uniforms.clear(); var _iterator = _createForOfIteratorHelper(uniformsSource), _step; try { for (_iterator.s(); !(_step = _iterator.n()).done;) { var _this$uniforms; var entry = _step.value; (_this$uniforms = this.uniforms).set.apply(_this$uniforms, _toConsumableArray(entry)); } } catch (err) { _iterator.e(err); } finally { _iterator.f(); } return this; } }, { key: "clone", value: function clone() { return new this.constructor().copy(this); } }, { key: "getByteLength", value: function getByteLength() { var size = 0; var _iterator2 = _createForOfIteratorHelper(this.uniforms.values()), _step2; try { for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { var uniform = _step2.value; size += this.getUniformByteLength(uniform); } } catch (err) { _iterator2.e(err); } finally { _iterator2.f(); } return size; } }, { key: "getUniformByteLength", value: function getUniformByteLength(uniform) { var size; if (typeof uniform === 'number') { size = 4; } else if (uniform.isVector2) { size = 8; } else if (uniform.isVector3 || uniform.isColor) { size = 12; } else if (uniform.isVector4) { size = 16; } else if (uniform.isMatrix3) { size = 36; } else if (uniform.isMatrix4) { size = 64; } else if (uniform.isTexture) { console.error('THREE.UniformsGroup: Texture samplers can not be part of an uniforms group.'); } else { console.error('THREE.UniformsGroup: Unsupported uniform value type.', uniform); } return size; } }]); return WebGPUUniformsGroup; }(WebGPUBinding); export default WebGPUUniformsGroup;