拿掉 build files

This commit is contained in:
2022-07-18 16:33:23 +08:00
parent 41e2287bcb
commit 3707f158a3
31953 changed files with 0 additions and 4411796 deletions
-327
View File
@@ -1,327 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Theme = void 0;
var _service = require("../service");
var ThemeUtils = _interopRequireWildcard(require("./utils"));
var _helpers = require("../../util/helpers");
var _vue = _interopRequireDefault(require("vue"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Theme =
/*#__PURE__*/
function (_Service) {
_inherits(Theme, _Service);
function Theme(preset) {
var _this;
_classCallCheck(this, Theme);
_this = _possibleConstructorReturn(this, _getPrototypeOf(Theme).call(this));
_this.disabled = false;
_this.isDark = null;
_this.vueInstance = null;
_this.vueMeta = null;
var _preset$Theme$propert = preset[Theme.property],
dark = _preset$Theme$propert.dark,
disable = _preset$Theme$propert.disable,
options = _preset$Theme$propert.options,
themes = _preset$Theme$propert.themes;
_this.dark = Boolean(dark);
_this.defaults = _this.themes = themes;
_this.options = options;
if (disable) {
_this.disabled = true;
return _possibleConstructorReturn(_this);
}
_this.themes = {
dark: _this.fillVariant(themes.dark, true),
light: _this.fillVariant(themes.light, false)
};
return _this;
} // When setting css, check for element
// and apply new values
_createClass(Theme, [{
key: "applyTheme",
// Apply current theme default
// only called on client side
value: function applyTheme() {
if (this.disabled) return this.clearCss();
this.css = this.generatedStyles;
}
}, {
key: "clearCss",
value: function clearCss() {
this.css = '';
} // Initialize theme for SSR and SPA
// Attach to ssrContext head or
// apply new theme to document
}, {
key: "init",
value: function init(root, ssrContext) {
if (this.disabled) return;
/* istanbul ignore else */
if (root.$meta) {
this.initVueMeta(root);
} else if (ssrContext) {
this.initSSR(ssrContext);
}
this.initTheme();
} // Allows for you to set target theme
}, {
key: "setTheme",
value: function setTheme(theme, value) {
this.themes[theme] = Object.assign(this.themes[theme], value);
this.applyTheme();
} // Reset theme defaults
}, {
key: "resetThemes",
value: function resetThemes() {
this.themes.light = Object.assign({}, this.defaults.light);
this.themes.dark = Object.assign({}, this.defaults.dark);
this.applyTheme();
} // Check for existence of style element
}, {
key: "checkOrCreateStyleElement",
value: function checkOrCreateStyleElement() {
this.styleEl = document.getElementById('vuetify-theme-stylesheet');
/* istanbul ignore next */
if (this.styleEl) return true;
this.genStyleElement(); // If doesn't have it, create it
return Boolean(this.styleEl);
}
}, {
key: "fillVariant",
value: function fillVariant() {
var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var dark = arguments.length > 1 ? arguments[1] : undefined;
var defaultTheme = this.themes[dark ? 'dark' : 'light'];
return Object.assign({}, defaultTheme, theme);
} // Generate the style element
// if applicable
}, {
key: "genStyleElement",
value: function genStyleElement() {
/* istanbul ignore if */
if (typeof document === 'undefined') return;
/* istanbul ignore next */
this.styleEl = document.createElement('style');
this.styleEl.type = 'text/css';
this.styleEl.id = 'vuetify-theme-stylesheet';
if (this.options.cspNonce) {
this.styleEl.setAttribute('nonce', this.options.cspNonce);
}
document.head.appendChild(this.styleEl);
}
}, {
key: "initVueMeta",
value: function initVueMeta(root) {
var _this2 = this;
this.vueMeta = root.$meta();
if (this.isVueMeta23) {
// vue-meta needs to apply after mounted()
root.$nextTick(function () {
_this2.applyVueMeta23();
});
return;
}
var metaKeyName = typeof this.vueMeta.getOptions === 'function' ? this.vueMeta.getOptions().keyName : 'metaInfo';
var metaInfo = root.$options[metaKeyName] || {};
root.$options[metaKeyName] = function () {
metaInfo.style = metaInfo.style || [];
var vuetifyStylesheet = metaInfo.style.find(function (s) {
return s.id === 'vuetify-theme-stylesheet';
});
if (!vuetifyStylesheet) {
metaInfo.style.push({
cssText: _this2.generatedStyles,
type: 'text/css',
id: 'vuetify-theme-stylesheet',
nonce: (_this2.options || {}).cspNonce
});
} else {
vuetifyStylesheet.cssText = _this2.generatedStyles;
}
return metaInfo;
};
}
}, {
key: "applyVueMeta23",
value: function applyVueMeta23() {
var _this$vueMeta$addApp = this.vueMeta.addApp('vuetify'),
set = _this$vueMeta$addApp.set;
set({
style: [{
cssText: this.generatedStyles,
type: 'text/css',
id: 'vuetify-theme-stylesheet',
nonce: this.options.cspNonce
}]
});
}
}, {
key: "initSSR",
value: function initSSR(ssrContext) {
// SSR
var nonce = this.options.cspNonce ? " nonce=\"".concat(this.options.cspNonce, "\"") : '';
ssrContext.head = ssrContext.head || '';
ssrContext.head += "<style type=\"text/css\" id=\"vuetify-theme-stylesheet\"".concat(nonce, ">").concat(this.generatedStyles, "</style>");
}
}, {
key: "initTheme",
value: function initTheme() {
var _this3 = this;
// Only watch for reactivity on client side
if (typeof document === 'undefined') return; // If we get here somehow, ensure
// existing instance is removed
if (this.vueInstance) this.vueInstance.$destroy(); // Use Vue instance to track reactivity
// TODO: Update to use RFC if merged
// https://github.com/vuejs/rfcs/blob/advanced-reactivity-api/active-rfcs/0000-advanced-reactivity-api.md
this.vueInstance = new _vue.default({
data: {
themes: this.themes
},
watch: {
themes: {
immediate: true,
deep: true,
handler: function handler() {
return _this3.applyTheme();
}
}
}
});
}
}, {
key: "css",
set: function set(val) {
if (this.vueMeta) {
if (this.isVueMeta23) {
this.applyVueMeta23();
}
return;
}
this.checkOrCreateStyleElement() && (this.styleEl.innerHTML = val);
}
}, {
key: "dark",
set: function set(val) {
var oldDark = this.isDark;
this.isDark = val; // Only apply theme after dark
// has already been set before
oldDark != null && this.applyTheme();
},
get: function get() {
return Boolean(this.isDark);
}
}, {
key: "currentTheme",
get: function get() {
var target = this.dark ? 'dark' : 'light';
return this.themes[target];
}
}, {
key: "generatedStyles",
get: function get() {
var theme = this.parsedTheme;
/* istanbul ignore next */
var options = this.options || {};
var css;
if (options.themeCache != null) {
css = options.themeCache.get(theme);
/* istanbul ignore if */
if (css != null) return css;
}
css = ThemeUtils.genStyles(theme, options.customProperties);
if (options.minifyTheme != null) {
css = options.minifyTheme(css);
}
if (options.themeCache != null) {
options.themeCache.set(theme, css);
}
return css;
}
}, {
key: "parsedTheme",
get: function get() {
return ThemeUtils.parse(this.currentTheme || {}, undefined, (0, _helpers.getNestedValue)(this.options, ['variations'], true));
} // Is using v2.3 of vue-meta
// https://github.com/nuxt/vue-meta/releases/tag/v2.3.0
}, {
key: "isVueMeta23",
get: function get() {
return typeof this.vueMeta.addApp === 'function';
}
}]);
return Theme;
}(_service.Service);
exports.Theme = Theme;
Theme.property = 'theme';
//# sourceMappingURL=index.js.map
File diff suppressed because one or more lines are too long
-167
View File
@@ -1,167 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.parse = parse;
exports.genStyles = genStyles;
exports.genVariations = genVariations;
exports.lighten = lighten;
exports.darken = darken;
var _colorUtils = require("../../util/colorUtils");
var sRGB = _interopRequireWildcard(require("../../util/color/transformSRGB"));
var LAB = _interopRequireWildcard(require("../../util/color/transformCIELAB"));
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function parse(theme) {
var isItem = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var variations = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
var anchor = theme.anchor,
variant = _objectWithoutProperties(theme, ["anchor"]);
var colors = Object.keys(variant);
var parsedTheme = {};
for (var _i = 0; _i < colors.length; ++_i) {
var name = colors[_i];
var value = theme[name];
if (value == null) continue;
if (!variations) {
parsedTheme[name] = {
base: (0, _colorUtils.intToHex)((0, _colorUtils.colorToInt)(value))
};
} else if (isItem) {
/* istanbul ignore else */
if (name === 'base' || name.startsWith('lighten') || name.startsWith('darken')) {
parsedTheme[name] = (0, _colorUtils.colorToHex)(value);
}
} else if (_typeof(value) === 'object') {
parsedTheme[name] = parse(value, true, variations);
} else {
parsedTheme[name] = genVariations(name, (0, _colorUtils.colorToInt)(value));
}
}
if (!isItem) {
parsedTheme.anchor = anchor || parsedTheme.base || parsedTheme.primary.base;
}
return parsedTheme;
}
/**
* Generate the CSS for a base color (.primary)
*/
var genBaseColor = function genBaseColor(name, value) {
return "\n.v-application .".concat(name, " {\n background-color: ").concat(value, " !important;\n border-color: ").concat(value, " !important;\n}\n.v-application .").concat(name, "--text {\n color: ").concat(value, " !important;\n caret-color: ").concat(value, " !important;\n}");
};
/**
* Generate the CSS for a variant color (.primary.darken-2)
*/
var genVariantColor = function genVariantColor(name, variant, value) {
var _variant$split = variant.split(/(\d)/, 2),
_variant$split2 = _slicedToArray(_variant$split, 2),
type = _variant$split2[0],
n = _variant$split2[1];
return "\n.v-application .".concat(name, ".").concat(type, "-").concat(n, " {\n background-color: ").concat(value, " !important;\n border-color: ").concat(value, " !important;\n}\n.v-application .").concat(name, "--text.text--").concat(type, "-").concat(n, " {\n color: ").concat(value, " !important;\n caret-color: ").concat(value, " !important;\n}");
};
var genColorVariableName = function genColorVariableName(name) {
var variant = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'base';
return "--v-".concat(name, "-").concat(variant);
};
var genColorVariable = function genColorVariable(name) {
var variant = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'base';
return "var(".concat(genColorVariableName(name, variant), ")");
};
function genStyles(theme) {
var cssVar = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var anchor = theme.anchor,
variant = _objectWithoutProperties(theme, ["anchor"]);
var colors = Object.keys(variant);
if (!colors.length) return '';
var variablesCss = '';
var css = '';
var aColor = cssVar ? genColorVariable('anchor') : anchor;
css += ".v-application a { color: ".concat(aColor, "; }");
cssVar && (variablesCss += " ".concat(genColorVariableName('anchor'), ": ").concat(anchor, ";\n"));
for (var _i2 = 0; _i2 < colors.length; ++_i2) {
var name = colors[_i2];
var value = theme[name];
css += genBaseColor(name, cssVar ? genColorVariable(name) : value.base);
cssVar && (variablesCss += " ".concat(genColorVariableName(name), ": ").concat(value.base, ";\n"));
var variants = Object.keys(value);
for (var _i3 = 0; _i3 < variants.length; ++_i3) {
var _variant = variants[_i3];
var variantValue = value[_variant];
if (_variant === 'base') continue;
css += genVariantColor(name, _variant, cssVar ? genColorVariable(name, _variant) : variantValue);
cssVar && (variablesCss += " ".concat(genColorVariableName(name, _variant), ": ").concat(variantValue, ";\n"));
}
}
if (cssVar) {
variablesCss = ":root {\n".concat(variablesCss, "}\n\n");
}
return variablesCss + css;
}
function genVariations(name, value) {
var values = {
base: (0, _colorUtils.intToHex)(value)
};
for (var _i4 = 5; _i4 > 0; --_i4) {
values["lighten".concat(_i4)] = (0, _colorUtils.intToHex)(lighten(value, _i4));
}
for (var _i5 = 1; _i5 <= 4; ++_i5) {
values["darken".concat(_i5)] = (0, _colorUtils.intToHex)(darken(value, _i5));
}
return values;
}
function lighten(value, amount) {
var lab = LAB.fromXYZ(sRGB.toXYZ(value));
lab[0] = lab[0] + amount * 10;
return sRGB.fromXYZ(LAB.toXYZ(lab));
}
function darken(value, amount) {
var lab = LAB.fromXYZ(sRGB.toXYZ(value));
lab[0] = lab[0] - amount * 10;
return sRGB.fromXYZ(LAB.toXYZ(lab));
}
//# sourceMappingURL=utils.js.map
File diff suppressed because one or more lines are too long