diff --git a/miniprogram_dist/index.js b/miniprogram_dist/index.js
index 8d561da5a80c402e64acfcbfe54da02f35a9fae3..6a8de767bcc06cd265d8b5899c2968163ae84f21 100644
--- a/miniprogram_dist/index.js
+++ b/miniprogram_dist/index.js
@@ -1,338 +1,115 @@
-module.exports =
-/******/ (function(modules) { // webpackBootstrap
-/******/ // The module cache
-/******/ var installedModules = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/
-/******/ // Check if module is in cache
-/******/ if(installedModules[moduleId]) {
-/******/ return installedModules[moduleId].exports;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = installedModules[moduleId] = {
-/******/ i: moduleId,
-/******/ l: false,
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-/******/
-/******/ // Flag the module as loaded
-/******/ module.l = true;
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/******/
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = modules;
-/******/
-/******/ // expose the module cache
-/******/ __webpack_require__.c = installedModules;
-/******/
-/******/ // define getter function for harmony exports
-/******/ __webpack_require__.d = function(exports, name, getter) {
-/******/ if(!__webpack_require__.o(exports, name)) {
-/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
-/******/ }
-/******/ };
-/******/
-/******/ // define __esModule on exports
-/******/ __webpack_require__.r = function(exports) {
-/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
-/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
-/******/ }
-/******/ Object.defineProperty(exports, '__esModule', { value: true });
-/******/ };
-/******/
-/******/ // create a fake namespace object
-/******/ // mode & 1: value is a module id, require it
-/******/ // mode & 2: merge all properties of value into the ns
-/******/ // mode & 4: return value when already ns object
-/******/ // mode & 8|1: behave like require
-/******/ __webpack_require__.t = function(value, mode) {
-/******/ if(mode & 1) value = __webpack_require__(value);
-/******/ if(mode & 8) return value;
-/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
-/******/ var ns = Object.create(null);
-/******/ __webpack_require__.r(ns);
-/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
-/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
-/******/ return ns;
-/******/ };
-/******/
-/******/ // getDefaultExport function for compatibility with non-harmony modules
-/******/ __webpack_require__.n = function(module) {
-/******/ var getter = module && module.__esModule ?
-/******/ function getDefault() { return module['default']; } :
-/******/ function getModuleExports() { return module; };
-/******/ __webpack_require__.d(getter, 'a', getter);
-/******/ return getter;
-/******/ };
-/******/
-/******/ // Object.prototype.hasOwnProperty.call
-/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
-/******/
-/******/ // __webpack_public_path__
-/******/ __webpack_require__.p = "";
-/******/
-/******/
-/******/ // Load entry module and return exports
-/******/ return __webpack_require__(__webpack_require__.s = 0);
-/******/ })
-/************************************************************************/
-/******/ ([
-/* 0 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var _svgIcon = __webpack_require__(1);
-
-Component({
- /**
- * 组件的属性列表
- */
- properties: {
- name: {
- type: String,
- value: ''
- },
- color: {
- type: String,
- value: ''
- },
- size: {
- type: String
- }
- },
- /**
- * 组件的初始数据
- */
- data: {
- width: '1em',
- height: '1em',
- iconUrl: '',
- class: ''
- },
- lifetimes: {
- attached: function attached() {
- this.getDataUri(this.data.name, this.data.color);
- if (this.data.size) {
- this.setData({
- width: this.data.size,
- height: this.data.size
- });
- }
- }
- },
- /**
- * 组件的方法列表
- */
- methods: {
- getDataUri: function getDataUri(name, color) {
- var that = this;
- var url = (0, _svgIcon.getLocalSVG)(name);
- if (url) {
- this.setData({
- iconUrl: url,
- class: color ? 'icon' : 'default-icon'
- });
- } else {
- (0, _svgIcon.getIconifySVG)(name).then(function (res) {
- that.setData({
- iconUrl: res,
- class: color ? 'icon' : 'default-icon'
- });
- }).catch(function (e) {
- console.log(e);
- });
- }
- }
- }
-}); // components/svg-icon/index.js
-// svg-icon
-
-/***/ }),
-/* 1 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-exports.__esModule = true;
-exports.getLocalSVG = getLocalSVG;
-exports.getIconifySVG = getIconifySVG;
-exports.iconifySetup = iconifySetup;
-
-var _mdiLight = __webpack_require__(2);
-
-var _mdiLight2 = _interopRequireDefault(_mdiLight);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-var ICONIFY_API = ''; // https://github.com/LarchLiu/weapp-svg-icon/blob/main/miniprogram/utils/svgIcon.ts
-// svg-icon
-
-var iconifyPresets = {
- MdiLight: _mdiLight2.default
-};
-var customerSvg = {
- EmojioneMonotoneMotorcycle: '',
- EmojioneMonotoneSportsMedal: ''
-};
-var iconifyPreload = ['carbon:portfolio'];
-function svgNameSwtich(id) {
- return id.split(/:|-|_/).filter(Boolean).map(function (s) {
- return s[0].toUpperCase() + s.slice(1).toLowerCase();
- }).join('');
+// Generated by scripts/generate-svg-icons.mjs — DO NOT EDIT.
+// Minimal iconify data extracted from @iconify-json/ph + @iconify-json/solar.
+var iconifyPresets = {"Ph":{"prefix":"ph","width":256,"height":256,"icons":{"arrow-right":{"body":""},"arrow-right-bold":{"body":""},"books-duotone":{"body":""},"building-duotone":{"body":""},"caret-left-bold":{"body":""},"caret-right-bold":{"body":""},"columns-duotone":{"body":""},"compass-duotone":{"body":""},"compass-fill":{"body":""},"hand-heart-duotone":{"body":""},"hand-heart-fill":{"body":""},"heart":{"body":""},"heart-fill":{"body":""},"house-duotone":{"body":""},"house-fill":{"body":""},"house-line-duotone":{"body":""},"info":{"body":""},"magnifying-glass":{"body":""},"magnifying-glass-duotone":{"body":""},"map-trifold-duotone":{"body":""},"map-trifold-fill":{"body":""},"mask-happy-duotone":{"body":""},"music-notes-duotone":{"body":""},"newspaper-clipping-duotone":{"body":""},"scissors-duotone":{"body":""},"shield-check-duotone":{"body":""},"storefront-duotone":{"body":""},"trophy-duotone":{"body":""},"user-circle-duotone":{"body":""},"user-circle-fill":{"body":""},"user-fill":{"body":""},"user-focus-duotone":{"body":""}}},"Solar":{"prefix":"solar","width":24,"height":24,"icons":{"alt-arrow-left-linear":{"body":""},"alt-arrow-right-linear":{"body":""}}}}
+
+function svgNameSwitch(id) {
+ return id
+ .split(/:|-|_/)
+ .filter(Boolean)
+ .map(function (s) {
+ return s[0].toUpperCase() + s.slice(1).toLowerCase()
+ })
+ .join('')
}
+
function encodeSvg(svg) {
- return svg.replace('/g, '%3E');
+ return svg
+ .replace('/g, '%3E')
}
+
function getDataUri(data) {
- return 'url("data:image/svg+xml;utf8,' + data + '")';
+ return 'url("data:image/svg+xml;utf8,' + data + '")'
}
+
function presetsIconify(id) {
- var parts = id.split(':');
- var prefix = '';
- var icon = '';
- if (parts.length === 2) {
- // prefix:icon.svg
- prefix = svgNameSwtich(parts[0]);
- icon = parts[1];
- }
- if (parts.length === 1) {
- parts = parts[0].split('-');
- if (parts.length > 1) {
- // prefix-icon.svg
- prefix = svgNameSwtich(parts.shift());
- icon = parts.join('-');
- }
+ var parts = id.split(':')
+ var prefix = ''
+ var icon = ''
+ if (parts.length === 2) {
+ prefix = svgNameSwitch(parts[0])
+ icon = parts[1]
+ } else if (parts.length === 1) {
+ parts = parts[0].split('-')
+ if (parts.length > 1) {
+ prefix = svgNameSwitch(parts.shift())
+ icon = parts.join('-')
}
- var setData = iconifyPresets[prefix] ? iconifyPresets[prefix].icons : null;
- var width = setData && setData.width ? setData.width : 32;
- var height = setData && setData.height ? setData.height : 32;
- var iconData = setData && setData.icons && setData.icons[icon] ? setData.icons[icon] : null;
- if (!iconData) {
- return '';
- }
- var renderData = {
- attributes: {
- width: '1em',
- height: '1em',
- preserveAspectRatio: 'xMidYMid meet',
- viewBox: '0 0 ' + width + ' ' + height
- },
- body: iconData.body
- };
- var svgAttributes = Object.assign({ xmlns: 'http://www.w3.org/2000/svg', 'xmlns:xlink': 'http://www.w3.org/1999/xlink' }, renderData.attributes);
- var svgAttributesStr = Object.keys(svgAttributes).map(function (attr) {
- return attr + '="' + svgAttributes[attr] + '"';
- }).join(' ');
- // Generate SVG
- return '';
+ }
+ var setData = iconifyPresets[prefix] || null
+ var width = setData && setData.width ? setData.width : 32
+ var height = setData && setData.height ? setData.height : 32
+ var iconData = setData && setData.icons && setData.icons[icon] ? setData.icons[icon] : null
+ if (!iconData) {
+ return ''
+ }
+ var svgAttributes = {
+ xmlns: 'http://www.w3.org/2000/svg',
+ 'xmlns:xlink': 'http://www.w3.org/1999/xlink',
+ width: '1em',
+ height: '1em',
+ preserveAspectRatio: 'xMidYMid meet',
+ viewBox: '0 0 ' + width + ' ' + height
+ }
+ var svgAttributesStr = Object.keys(svgAttributes)
+ .map(function (attr) {
+ return attr + '="' + svgAttributes[attr] + '"'
+ })
+ .join(' ')
+ return ''
}
+
function getLocalSVG(id) {
- var name = svgNameSwtich(id);
- var data = customerSvg[name];
- if (data) {
- return getDataUri(encodeSvg(data));
- } else {
- data = presetsIconify(id);
- if (data) {
- return getDataUri(encodeSvg(data));
- } else {
- data = wx.getStorageSync(name);
- if (data) {
- return getDataUri(data);
- }
- return '';
- }
- }
-}
-function iconifyApi(id) {
- return new Promise(function (resolve, reject) {
- if (ICONIFY_API) {
- wx.request({
- url: ICONIFY_API + '/' + id + '.svg',
- success: function success(res) {
- if (res.statusCode === 200) resolve(res.data);else reject(res.errMsg);
- },
- fail: function fail(err) {
- reject(err);
- }
- });
- } else {
- reject('no ICONIFY_API');
- }
- });
+ var name = svgNameSwitch(id)
+ var data = presetsIconify(id)
+ if (data) {
+ return getDataUri(encodeSvg(data))
+ }
+ data = wx.getStorageSync(name)
+ if (data) {
+ return getDataUri(data)
+ }
+ return ''
}
-function getIconifySVG(id) {
- return new Promise(function (resolve, reject) {
- var name = svgNameSwtich(id);
- iconifyApi(id).then(function (r) {
- var data = encodeSvg(r);
- wx.setStorage({
- key: name,
- data: data,
- success: function success(_) {
- resolve(getDataUri(data));
- },
- fail: function fail(err) {
- reject(err);
- }
- });
- }).catch(function (e) {
- reject(e);
- });
- });
-}
-function iconifySetup(api) {
- if (api) {
- ICONIFY_API = api;
- for (var _iterator = iconifyPreload, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
- var _ref;
-
- if (_isArray) {
- if (_i >= _iterator.length) break;
- _ref = _iterator[_i++];
- } else {
- _i = _iterator.next();
- if (_i.done) break;
- _ref = _i.value;
- }
- var id = _ref;
-
- var name = svgNameSwtich(id);
- console.log(name);
- var data = wx.getStorageSync(name);
- if (!data) {
- getIconifySVG(id).catch(function (e) {
- console.error(e);
- });
- }
- }
+Component({
+ properties: {
+ name: {
+ type: String,
+ value: ''
+ },
+ color: {
+ type: String,
+ value: ''
+ },
+ size: {
+ type: String
}
-}
-exports.default = {
- getLocalSVG: getLocalSVG,
- getIconifySVG: getIconifySVG,
- iconifySetup: iconifySetup
-};
-
-/***/ }),
-/* 2 */
-/***/ (function(module, exports) {
-
-module.exports = require("@iconify-json/mdi-light");
-
-/***/ })
-/******/ ]);
-//# sourceMappingURL=index.js.map
\ No newline at end of file
+ },
+ data: {
+ width: '1em',
+ height: '1em',
+ iconUrl: '',
+ class: ''
+ },
+ lifetimes: {
+ attached: function attached() {
+ this.setData({
+ iconUrl: getLocalSVG(this.data.name),
+ class: this.data.color ? 'icon' : 'default-icon'
+ })
+ if (this.data.size) {
+ this.setData({
+ width: this.data.size,
+ height: this.data.size
+ })
+ }
+ }
+ }
+})
diff --git a/miniprogram_dist/index.js.map b/miniprogram_dist/index.js.map
deleted file mode 100644
index efc117b0e59c1c0429b5d343164a4983bb2c2c05..0000000000000000000000000000000000000000