last update before handover
This commit is contained in:
429
sample_interface/node_modules/style-to-js/umd/style-to-js.js
generated
vendored
Normal file
429
sample_interface/node_modules/style-to-js/umd/style-to-js.js
generated
vendored
Normal file
@@ -0,0 +1,429 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.StyleToJS = factory());
|
||||
})(this, (function () { 'use strict';
|
||||
|
||||
function getDefaultExportFromCjs (x) {
|
||||
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
||||
}
|
||||
|
||||
var cjs$2 = {};
|
||||
|
||||
var cjs$1;
|
||||
var hasRequiredCjs$2;
|
||||
|
||||
function requireCjs$2 () {
|
||||
if (hasRequiredCjs$2) return cjs$1;
|
||||
hasRequiredCjs$2 = 1;
|
||||
|
||||
// http://www.w3.org/TR/CSS21/grammar.html
|
||||
// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027
|
||||
var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
|
||||
|
||||
var NEWLINE_REGEX = /\n/g;
|
||||
var WHITESPACE_REGEX = /^\s*/;
|
||||
|
||||
// declaration
|
||||
var PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/;
|
||||
var COLON_REGEX = /^:\s*/;
|
||||
var VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/;
|
||||
var SEMICOLON_REGEX = /^[;\s]*/;
|
||||
|
||||
// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill
|
||||
var TRIM_REGEX = /^\s+|\s+$/g;
|
||||
|
||||
// strings
|
||||
var NEWLINE = '\n';
|
||||
var FORWARD_SLASH = '/';
|
||||
var ASTERISK = '*';
|
||||
var EMPTY_STRING = '';
|
||||
|
||||
// types
|
||||
var TYPE_COMMENT = 'comment';
|
||||
var TYPE_DECLARATION = 'declaration';
|
||||
|
||||
/**
|
||||
* @param {String} style
|
||||
* @param {Object} [options]
|
||||
* @return {Object[]}
|
||||
* @throws {TypeError}
|
||||
* @throws {Error}
|
||||
*/
|
||||
function index (style, options) {
|
||||
if (typeof style !== 'string') {
|
||||
throw new TypeError('First argument must be a string');
|
||||
}
|
||||
|
||||
if (!style) return [];
|
||||
|
||||
options = options || {};
|
||||
|
||||
/**
|
||||
* Positional.
|
||||
*/
|
||||
var lineno = 1;
|
||||
var column = 1;
|
||||
|
||||
/**
|
||||
* Update lineno and column based on `str`.
|
||||
*
|
||||
* @param {String} str
|
||||
*/
|
||||
function updatePosition(str) {
|
||||
var lines = str.match(NEWLINE_REGEX);
|
||||
if (lines) lineno += lines.length;
|
||||
var i = str.lastIndexOf(NEWLINE);
|
||||
column = ~i ? str.length - i : column + str.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark position and patch `node.position`.
|
||||
*
|
||||
* @return {Function}
|
||||
*/
|
||||
function position() {
|
||||
var start = { line: lineno, column: column };
|
||||
return function (node) {
|
||||
node.position = new Position(start);
|
||||
whitespace();
|
||||
return node;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Store position information for a node.
|
||||
*
|
||||
* @constructor
|
||||
* @property {Object} start
|
||||
* @property {Object} end
|
||||
* @property {undefined|String} source
|
||||
*/
|
||||
function Position(start) {
|
||||
this.start = start;
|
||||
this.end = { line: lineno, column: column };
|
||||
this.source = options.source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Non-enumerable source string.
|
||||
*/
|
||||
Position.prototype.content = style;
|
||||
|
||||
/**
|
||||
* Error `msg`.
|
||||
*
|
||||
* @param {String} msg
|
||||
* @throws {Error}
|
||||
*/
|
||||
function error(msg) {
|
||||
var err = new Error(
|
||||
options.source + ':' + lineno + ':' + column + ': ' + msg
|
||||
);
|
||||
err.reason = msg;
|
||||
err.filename = options.source;
|
||||
err.line = lineno;
|
||||
err.column = column;
|
||||
err.source = style;
|
||||
|
||||
if (options.silent) ; else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Match `re` and return captures.
|
||||
*
|
||||
* @param {RegExp} re
|
||||
* @return {undefined|Array}
|
||||
*/
|
||||
function match(re) {
|
||||
var m = re.exec(style);
|
||||
if (!m) return;
|
||||
var str = m[0];
|
||||
updatePosition(str);
|
||||
style = style.slice(str.length);
|
||||
return m;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse whitespace.
|
||||
*/
|
||||
function whitespace() {
|
||||
match(WHITESPACE_REGEX);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse comments.
|
||||
*
|
||||
* @param {Object[]} [rules]
|
||||
* @return {Object[]}
|
||||
*/
|
||||
function comments(rules) {
|
||||
var c;
|
||||
rules = rules || [];
|
||||
while ((c = comment())) {
|
||||
if (c !== false) {
|
||||
rules.push(c);
|
||||
}
|
||||
}
|
||||
return rules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse comment.
|
||||
*
|
||||
* @return {Object}
|
||||
* @throws {Error}
|
||||
*/
|
||||
function comment() {
|
||||
var pos = position();
|
||||
if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;
|
||||
|
||||
var i = 2;
|
||||
while (
|
||||
EMPTY_STRING != style.charAt(i) &&
|
||||
(ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))
|
||||
) {
|
||||
++i;
|
||||
}
|
||||
i += 2;
|
||||
|
||||
if (EMPTY_STRING === style.charAt(i - 1)) {
|
||||
return error('End of comment missing');
|
||||
}
|
||||
|
||||
var str = style.slice(2, i - 2);
|
||||
column += 2;
|
||||
updatePosition(str);
|
||||
style = style.slice(i);
|
||||
column += 2;
|
||||
|
||||
return pos({
|
||||
type: TYPE_COMMENT,
|
||||
comment: str
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse declaration.
|
||||
*
|
||||
* @return {Object}
|
||||
* @throws {Error}
|
||||
*/
|
||||
function declaration() {
|
||||
var pos = position();
|
||||
|
||||
// prop
|
||||
var prop = match(PROPERTY_REGEX);
|
||||
if (!prop) return;
|
||||
comment();
|
||||
|
||||
// :
|
||||
if (!match(COLON_REGEX)) return error("property missing ':'");
|
||||
|
||||
// val
|
||||
var val = match(VALUE_REGEX);
|
||||
|
||||
var ret = pos({
|
||||
type: TYPE_DECLARATION,
|
||||
property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),
|
||||
value: val
|
||||
? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING))
|
||||
: EMPTY_STRING
|
||||
});
|
||||
|
||||
// ;
|
||||
match(SEMICOLON_REGEX);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse declarations.
|
||||
*
|
||||
* @return {Object[]}
|
||||
*/
|
||||
function declarations() {
|
||||
var decls = [];
|
||||
|
||||
comments(decls);
|
||||
|
||||
// declarations
|
||||
var decl;
|
||||
while ((decl = declaration())) {
|
||||
if (decl !== false) {
|
||||
decls.push(decl);
|
||||
comments(decls);
|
||||
}
|
||||
}
|
||||
|
||||
return decls;
|
||||
}
|
||||
|
||||
whitespace();
|
||||
return declarations();
|
||||
}
|
||||
|
||||
/**
|
||||
* Trim `str`.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {String}
|
||||
*/
|
||||
function trim(str) {
|
||||
return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;
|
||||
}
|
||||
|
||||
cjs$1 = index;
|
||||
|
||||
return cjs$1;
|
||||
}
|
||||
|
||||
var hasRequiredCjs$1;
|
||||
|
||||
function requireCjs$1 () {
|
||||
if (hasRequiredCjs$1) return cjs$2;
|
||||
hasRequiredCjs$1 = 1;
|
||||
var __importDefault = (cjs$2 && cjs$2.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(cjs$2, "__esModule", { value: true });
|
||||
cjs$2.default = StyleToObject;
|
||||
const inline_style_parser_1 = __importDefault(requireCjs$2());
|
||||
/**
|
||||
* Parses inline style to object.
|
||||
*
|
||||
* @param style - Inline style.
|
||||
* @param iterator - Iterator.
|
||||
* @returns - Style object or null.
|
||||
*
|
||||
* @example Parsing inline style to object:
|
||||
*
|
||||
* ```js
|
||||
* import parse from 'style-to-object';
|
||||
* parse('line-height: 42;'); // { 'line-height': '42' }
|
||||
* ```
|
||||
*/
|
||||
function StyleToObject(style, iterator) {
|
||||
let styleObject = null;
|
||||
if (!style || typeof style !== 'string') {
|
||||
return styleObject;
|
||||
}
|
||||
const declarations = (0, inline_style_parser_1.default)(style);
|
||||
const hasIterator = typeof iterator === 'function';
|
||||
declarations.forEach((declaration) => {
|
||||
if (declaration.type !== 'declaration') {
|
||||
return;
|
||||
}
|
||||
const { property, value } = declaration;
|
||||
if (hasIterator) {
|
||||
iterator(property, value, declaration);
|
||||
}
|
||||
else if (value) {
|
||||
styleObject = styleObject || {};
|
||||
styleObject[property] = value;
|
||||
}
|
||||
});
|
||||
return styleObject;
|
||||
}
|
||||
|
||||
return cjs$2;
|
||||
}
|
||||
|
||||
var utilities = {};
|
||||
|
||||
var hasRequiredUtilities;
|
||||
|
||||
function requireUtilities () {
|
||||
if (hasRequiredUtilities) return utilities;
|
||||
hasRequiredUtilities = 1;
|
||||
Object.defineProperty(utilities, "__esModule", { value: true });
|
||||
utilities.camelCase = void 0;
|
||||
var CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9_-]+$/;
|
||||
var HYPHEN_REGEX = /-([a-z])/g;
|
||||
var NO_HYPHEN_REGEX = /^[^-]+$/;
|
||||
var VENDOR_PREFIX_REGEX = /^-(webkit|moz|ms|o|khtml)-/;
|
||||
var MS_VENDOR_PREFIX_REGEX = /^-(ms)-/;
|
||||
/**
|
||||
* Checks whether to skip camelCase.
|
||||
*/
|
||||
var skipCamelCase = function (property) {
|
||||
return !property ||
|
||||
NO_HYPHEN_REGEX.test(property) ||
|
||||
CUSTOM_PROPERTY_REGEX.test(property);
|
||||
};
|
||||
/**
|
||||
* Replacer that capitalizes first character.
|
||||
*/
|
||||
var capitalize = function (match, character) {
|
||||
return character.toUpperCase();
|
||||
};
|
||||
/**
|
||||
* Replacer that removes beginning hyphen of vendor prefix property.
|
||||
*/
|
||||
var trimHyphen = function (match, prefix) { return "".concat(prefix, "-"); };
|
||||
/**
|
||||
* CamelCases a CSS property.
|
||||
*/
|
||||
var camelCase = function (property, options) {
|
||||
if (options === void 0) { options = {}; }
|
||||
if (skipCamelCase(property)) {
|
||||
return property;
|
||||
}
|
||||
property = property.toLowerCase();
|
||||
if (options.reactCompat) {
|
||||
// `-ms` vendor prefix should not be capitalized
|
||||
property = property.replace(MS_VENDOR_PREFIX_REGEX, trimHyphen);
|
||||
}
|
||||
else {
|
||||
// for non-React, remove first hyphen so vendor prefix is not capitalized
|
||||
property = property.replace(VENDOR_PREFIX_REGEX, trimHyphen);
|
||||
}
|
||||
return property.replace(HYPHEN_REGEX, capitalize);
|
||||
};
|
||||
utilities.camelCase = camelCase;
|
||||
|
||||
return utilities;
|
||||
}
|
||||
|
||||
var cjs;
|
||||
var hasRequiredCjs;
|
||||
|
||||
function requireCjs () {
|
||||
if (hasRequiredCjs) return cjs;
|
||||
hasRequiredCjs = 1;
|
||||
var __importDefault = (cjs && cjs.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
var style_to_object_1 = __importDefault(requireCjs$1());
|
||||
var utilities_1 = requireUtilities();
|
||||
/**
|
||||
* Parses CSS inline style to JavaScript object (camelCased).
|
||||
*/
|
||||
function StyleToJS(style, options) {
|
||||
var output = {};
|
||||
if (!style || typeof style !== 'string') {
|
||||
return output;
|
||||
}
|
||||
(0, style_to_object_1.default)(style, function (property, value) {
|
||||
// skip CSS comment
|
||||
if (property && value) {
|
||||
output[(0, utilities_1.camelCase)(property, options)] = value;
|
||||
}
|
||||
});
|
||||
return output;
|
||||
}
|
||||
StyleToJS.default = StyleToJS;
|
||||
cjs = StyleToJS;
|
||||
|
||||
return cjs;
|
||||
}
|
||||
|
||||
var cjsExports = requireCjs();
|
||||
var index = /*@__PURE__*/getDefaultExportFromCjs(cjsExports);
|
||||
|
||||
return index;
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=style-to-js.js.map
|
||||
1
sample_interface/node_modules/style-to-js/umd/style-to-js.js.map
generated
vendored
Normal file
1
sample_interface/node_modules/style-to-js/umd/style-to-js.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
sample_interface/node_modules/style-to-js/umd/style-to-js.min.js
generated
vendored
Normal file
2
sample_interface/node_modules/style-to-js/umd/style-to-js.min.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).StyleToJS=t()}(this,(function(){"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t,r,n,o={};function u(){if(n)return o;n=1;var e=o&&o.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){let r=null;if(!e||"string"!=typeof e)return r;const n=(0,u.default)(e),o="function"==typeof t;return n.forEach((e=>{if("declaration"!==e.type)return;const{property:n,value:u}=e;o?t(n,u,e):u&&(r=r||{},r[n]=u)})),r};const u=e(function(){if(r)return t;r=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,o=/^\s*/,u=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,l="";function s(e){return e?e.replace(f,l):l}return t=function(t,r){if("string"!=typeof t)throw new TypeError("First argument must be a string");if(!t)return[];r=r||{};var f=1,p=1;function d(e){var t=e.match(n);t&&(f+=t.length);var r=e.lastIndexOf("\n");p=~r?e.length-r:p+e.length}function m(){var e={line:f,column:p};return function(t){return t.position=new v(e),g(),t}}function v(e){this.start=e,this.end={line:f,column:p},this.source=r.source}function h(e){var n=new Error(r.source+":"+f+":"+p+": "+e);if(n.reason=e,n.filename=r.source,n.line=f,n.column=p,n.source=t,!r.silent)throw n}function y(e){var r=e.exec(t);if(r){var n=r[0];return d(n),t=t.slice(n.length),r}}function g(){y(o)}function _(e){var t;for(e=e||[];t=w();)!1!==t&&e.push(t);return e}function w(){var e=m();if("/"==t.charAt(0)&&"*"==t.charAt(1)){for(var r=2;l!=t.charAt(r)&&("*"!=t.charAt(r)||"/"!=t.charAt(r+1));)++r;if(r+=2,l===t.charAt(r-1))return h("End of comment missing");var n=t.slice(2,r-2);return p+=2,d(n),t=t.slice(r),p+=2,e({type:"comment",comment:n})}}function b(){var t=m(),r=y(u);if(r){if(w(),!y(i))return h("property missing ':'");var n=y(a),o=t({type:"declaration",property:s(r[0].replace(e,l)),value:n?s(n[0].replace(e,l)):l});return y(c),o}}return v.prototype.content=t,g(),function(){var e,t=[];for(_(t);e=b();)!1!==e&&(t.push(e),_(t));return t}()}}());return o}var i,a,c,f={};function l(){if(i)return f;i=1,Object.defineProperty(f,"__esModule",{value:!0}),f.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,r=/^[^-]+$/,n=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,u=function(e,t){return t.toUpperCase()},a=function(e,t){return"".concat(t,"-")};return f.camelCase=function(i,c){return void 0===c&&(c={}),function(t){return!t||r.test(t)||e.test(t)}(i)?i:(i=i.toLowerCase(),(i=c.reactCompat?i.replace(o,a):i.replace(n,a)).replace(t,u))},f}return e(function(){if(c)return a;c=1;var e=(a&&a.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(u()),t=l();function r(r,n){var o={};return r&&"string"==typeof r?((0,e.default)(r,(function(e,r){e&&r&&(o[(0,t.camelCase)(e,n)]=r)})),o):o}return r.default=r,a=r}())}));
|
||||
//# sourceMappingURL=style-to-js.min.js.map
|
||||
1
sample_interface/node_modules/style-to-js/umd/style-to-js.min.js.map
generated
vendored
Normal file
1
sample_interface/node_modules/style-to-js/umd/style-to-js.min.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user