sun-card-design 1.1.3 → 1.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/mobile/sun-card-design-mobile.es49.js +1 -1
  2. package/dist/mobile/sun-card-design-mobile.es72.js +4 -4
  3. package/dist/mobile/sun-card-design-mobile.es73.js +11 -30
  4. package/dist/mobile/sun-card-design-mobile.es75.js +10 -10
  5. package/dist/mobile/sun-card-design-mobile.es84.js +2 -4
  6. package/dist/mobile/sun-card-design-mobile.es85.js +42 -10
  7. package/dist/mobile/sun-card-design-mobile.es86.js +133 -94
  8. package/dist/mobile/sun-card-design-mobile.es87.js +110 -12
  9. package/dist/mobile/sun-card-design-mobile.es88.js +150 -145
  10. package/dist/mobile/sun-card-design-mobile.es89.js +36 -99
  11. package/dist/pc/sun-card-design-pc.es32.js +2 -2
  12. package/dist/pc/sun-card-design-pc.es33.js +2 -2
  13. package/dist/pc/sun-card-design-pc.es34.js +2 -2
  14. package/dist/pc/sun-card-design-pc.es35.js +2 -2
  15. package/dist/pc/sun-card-design-pc.es36.js +2 -2
  16. package/dist/pc/sun-card-design-pc.es37.js +2 -2
  17. package/dist/pc/sun-card-design-pc.es38.js +2 -2
  18. package/dist/pc/sun-card-design-pc.es68.js +2 -2
  19. package/dist/pc/sun-card-design-pc.es70.js +2 -2
  20. package/dist/pc/sun-card-design-pc.es72.js +4 -4
  21. package/dist/pc/sun-card-design-pc.es73.js +12 -31
  22. package/dist/pc/sun-card-design-pc.es74.js +2 -175
  23. package/dist/pc/sun-card-design-pc.es75.js +145 -9
  24. package/dist/pc/sun-card-design-pc.es76.js +2 -107
  25. package/dist/pc/sun-card-design-pc.es77.js +2 -2
  26. package/dist/pc/sun-card-design-pc.es78.js +2 -146
  27. package/dist/pc/sun-card-design-pc.es79.js +2 -2
  28. package/dist/pc/sun-card-design-pc.es80.js +2 -2
  29. package/dist/pc/sun-card-design-pc.es81.js +2 -2
  30. package/dist/pc/sun-card-design-pc.es82.js +2 -2
  31. package/dist/pc/sun-card-design-pc.es83.js +2 -2
  32. package/dist/pc/sun-card-design-pc.es84.js +173 -2
  33. package/dist/pc/sun-card-design-pc.es85.js +42 -2
  34. package/dist/pc/sun-card-design-pc.es86.js +146 -2
  35. package/dist/pc/sun-card-design-pc.es87.js +110 -12
  36. package/dist/pc/sun-card-design-pc.es88.js +150 -145
  37. package/dist/pc/sun-card-design-pc.es89.js +36 -99
  38. package/package.json +2 -1
@@ -4,7 +4,7 @@ import { OrbitControls } from "./sun-card-design-mobile.es58.js";
4
4
  import TWEEN from "@tweenjs/tween.js";
5
5
  /* empty css */
6
6
  import _export_sfc from "./sun-card-design-mobile.es28.js";
7
- import CloseCircleFilled from "./sun-card-design-mobile.es67.js";
7
+ import CloseCircleFilled from "./sun-card-design-mobile.es68.js";
8
8
  const _hoisted_1 = {
9
9
  key: 0,
10
10
  class: "canvas"
@@ -1,5 +1,4 @@
1
- import { getSecondaryColor, warning, isIconDefinition, generate } from "./sun-card-design-mobile.es73.js";
2
- import { reactive } from "vue";
1
+ import { getSecondaryColor, useInsertStyles, warning, isIconDefinition, generate } from "./sun-card-design-mobile.es73.js";
3
2
  var _excluded = ["icon", "primaryColor", "secondaryColor"];
4
3
  function _objectWithoutProperties(source, excluded) {
5
4
  if (source == null) return {};
@@ -51,11 +50,11 @@ function _defineProperty(obj, key, value) {
51
50
  }
52
51
  return obj;
53
52
  }
54
- var twoToneColorPalette = reactive({
53
+ var twoToneColorPalette = {
55
54
  primaryColor: "#333",
56
55
  secondaryColor: "#E6E6E6",
57
56
  calculated: false
58
- });
57
+ };
59
58
  function setTwoToneColors(_ref) {
60
59
  var primaryColor = _ref.primaryColor, secondaryColor = _ref.secondaryColor;
61
60
  twoToneColorPalette.primaryColor = primaryColor;
@@ -74,6 +73,7 @@ var IconBase = function IconBase2(props, context) {
74
73
  secondaryColor: secondaryColor || getSecondaryColor(primaryColor)
75
74
  };
76
75
  }
76
+ useInsertStyles();
77
77
  warning(isIconDefinition(icon), "icon should be icon definiton, but got ".concat(icon));
78
78
  if (!isIconDefinition(icon)) {
79
79
  return null;
@@ -1,7 +1,6 @@
1
- import { h, getCurrentInstance, nextTick } from "vue";
1
+ import { nextTick, h } from "vue";
2
2
  import { generate as generate$1 } from "./sun-card-design-mobile.es84.js";
3
- import { useInjectIconContext } from "./sun-card-design-mobile.es85.js";
4
- import { canUseDom, updateCSS } from "./sun-card-design-mobile.es86.js";
3
+ import insertCss from "./sun-card-design-mobile.es85.js";
5
4
  function _objectSpread(target) {
6
5
  for (var i = 1; i < arguments.length; i++) {
7
6
  var source = arguments[i] != null ? Object(arguments[i]) : {};
@@ -60,36 +59,18 @@ function normalizeTwoToneColors(twoToneColor) {
60
59
  return Array.isArray(twoToneColor) ? twoToneColor : [twoToneColor];
61
60
  }
62
61
  var iconStyles = "\n.anticon {\n display: inline-block;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.anticon > * {\n line-height: 1;\n}\n\n.anticon svg {\n display: inline-block;\n}\n\n.anticon::before {\n display: none;\n}\n\n.anticon .anticon-icon {\n display: block;\n}\n\n.anticon[tabindex] {\n cursor: pointer;\n}\n\n.anticon-spin::before,\n.anticon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n";
63
- function getRoot(ele) {
64
- return ele && ele.getRootNode && ele.getRootNode();
65
- }
66
- function inShadow(ele) {
67
- if (!canUseDom()) {
68
- return false;
69
- }
70
- return getRoot(ele) instanceof ShadowRoot;
71
- }
72
- function getShadowRoot(ele) {
73
- return inShadow(ele) ? getRoot(ele) : null;
74
- }
62
+ var cssInjectedFlag = false;
75
63
  var useInsertStyles = function useInsertStyles2() {
76
- var _useInjectIconContext = useInjectIconContext(), prefixCls = _useInjectIconContext.prefixCls, csp = _useInjectIconContext.csp;
77
- var instance = getCurrentInstance();
78
- var mergedStyleStr = iconStyles;
79
- if (prefixCls) {
80
- mergedStyleStr = mergedStyleStr.replace(/anticon/g, prefixCls.value);
81
- }
64
+ var styleStr = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : iconStyles;
82
65
  nextTick(function() {
83
- if (!canUseDom()) {
84
- return;
66
+ if (!cssInjectedFlag) {
67
+ if (typeof window !== "undefined" && window.document && window.document.documentElement) {
68
+ insertCss(styleStr, {
69
+ prepend: true
70
+ });
71
+ }
72
+ cssInjectedFlag = true;
85
73
  }
86
- var ele = instance.vnode.el;
87
- var shadowRoot = getShadowRoot(ele);
88
- updateCSS(mergedStyleStr, "@ant-design-vue-icons", {
89
- prepend: true,
90
- csp: csp.value,
91
- attachTo: shadowRoot
92
- });
93
74
  });
94
75
  };
95
76
  export {
@@ -2,9 +2,6 @@ import { createVNode } from "vue";
2
2
  import IconBase from "./sun-card-design-mobile.es72.js";
3
3
  import { setTwoToneColor, getTwoToneColor } from "./sun-card-design-mobile.es71.js";
4
4
  import { normalizeTwoToneColors } from "./sun-card-design-mobile.es73.js";
5
- import { blue } from "./sun-card-design-mobile.es84.js";
6
- import { useInjectIconContext } from "./sun-card-design-mobile.es85.js";
7
- import { InsertStyles } from "./sun-card-design-mobile.es87.js";
8
5
  var _excluded = ["class", "icon", "spin", "rotate", "tabindex", "twoToneColor", "onClick"];
9
6
  function _slicedToArray(arr, i) {
10
7
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
@@ -104,15 +101,18 @@ function _objectWithoutPropertiesLoose(source, excluded) {
104
101
  }
105
102
  return target;
106
103
  }
107
- setTwoToneColor(blue.primary);
104
+ setTwoToneColor("#1890ff");
108
105
  var Icon = function Icon2(props, context) {
109
106
  var _classObj;
110
107
  var _props$context$attrs = _objectSpread({}, props, context.attrs), cls = _props$context$attrs["class"], icon = _props$context$attrs.icon, spin = _props$context$attrs.spin, rotate = _props$context$attrs.rotate, tabindex = _props$context$attrs.tabindex, twoToneColor = _props$context$attrs.twoToneColor, onClick = _props$context$attrs.onClick, restProps = _objectWithoutProperties(_props$context$attrs, _excluded);
111
- var _useInjectIconContext = useInjectIconContext(), prefixCls = _useInjectIconContext.prefixCls, rootClassName = _useInjectIconContext.rootClassName;
112
- var classObj = (_classObj = {}, _defineProperty(_classObj, rootClassName.value, !!rootClassName.value), _defineProperty(_classObj, prefixCls.value, true), _defineProperty(_classObj, "".concat(prefixCls.value, "-").concat(icon.name), Boolean(icon.name)), _defineProperty(_classObj, "".concat(prefixCls.value, "-spin"), !!spin || icon.name === "loading"), _classObj);
108
+ var classObj = (_classObj = {
109
+ anticon: true
110
+ }, _defineProperty(_classObj, "anticon-".concat(icon.name), Boolean(icon.name)), _defineProperty(_classObj, cls, cls), _classObj);
111
+ var svgClassString = spin === "" || !!spin || icon.name === "loading" ? "anticon-spin" : "";
113
112
  var iconTabIndex = tabindex;
114
113
  if (iconTabIndex === void 0 && onClick) {
115
114
  iconTabIndex = -1;
115
+ restProps.tabindex = iconTabIndex;
116
116
  }
117
117
  var svgStyle = rotate ? {
118
118
  msTransform: "rotate(".concat(rotate, "deg)"),
@@ -124,20 +124,20 @@ var Icon = function Icon2(props, context) {
124
124
  "aria-label": icon.name
125
125
  }, restProps, {
126
126
  "onClick": onClick,
127
- "class": [classObj, cls],
128
- "tabindex": iconTabIndex
127
+ "class": classObj
129
128
  }), [createVNode(IconBase, {
129
+ "class": svgClassString,
130
130
  "icon": icon,
131
131
  "primaryColor": primaryColor,
132
132
  "secondaryColor": secondaryColor,
133
133
  "style": svgStyle
134
- }, null), createVNode(InsertStyles, null, null)]);
134
+ }, null)]);
135
135
  };
136
136
  Icon.props = {
137
137
  spin: Boolean,
138
138
  rotate: Number,
139
139
  icon: Object,
140
- twoToneColor: [String, Array]
140
+ twoToneColor: String
141
141
  };
142
142
  Icon.displayName = "AntdIcon";
143
143
  Icon.inheritAttrs = false;
@@ -1,5 +1,5 @@
1
- import { inputToRGB } from "./sun-card-design-mobile.es88.js";
2
- import { rgbToHsv, rgbToHex } from "./sun-card-design-mobile.es89.js";
1
+ import { inputToRGB } from "./sun-card-design-mobile.es86.js";
2
+ import { rgbToHsv, rgbToHex } from "./sun-card-design-mobile.es87.js";
3
3
  var hueStep = 2;
4
4
  var saturationStep = 0.16;
5
5
  var saturationStep2 = 0.05;
@@ -167,9 +167,7 @@ Object.keys(presetPrimaryColors).forEach(function(key) {
167
167
  });
168
168
  presetDarkPalettes[key].primary = presetDarkPalettes[key][5];
169
169
  });
170
- var blue = presetPalettes.blue;
171
170
  export {
172
- blue,
173
171
  generate,
174
172
  presetDarkPalettes,
175
173
  presetPalettes,
@@ -1,12 +1,44 @@
1
- import { inject, ref } from "vue";
2
- var contextKey = Symbol("iconContext");
3
- var useInjectIconContext = function useInjectIconContext2() {
4
- return inject(contextKey, {
5
- prefixCls: ref("anticon"),
6
- rootClassName: ref(""),
7
- csp: ref()
8
- });
9
- };
1
+ var containers = [];
2
+ var styleElements = [];
3
+ var usage = "insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).";
4
+ function createStyleElement() {
5
+ var styleElement = document.createElement("style");
6
+ styleElement.setAttribute("type", "text/css");
7
+ return styleElement;
8
+ }
9
+ function insertCss(css, options) {
10
+ options = options || {};
11
+ if (css === void 0) {
12
+ throw new Error(usage);
13
+ }
14
+ var position = options.prepend === true ? "prepend" : "append";
15
+ var container = options.container !== void 0 ? options.container : document.querySelector("head");
16
+ var containerId = containers.indexOf(container);
17
+ if (containerId === -1) {
18
+ containerId = containers.push(container) - 1;
19
+ styleElements[containerId] = {};
20
+ }
21
+ var styleElement;
22
+ if (styleElements[containerId] !== void 0 && styleElements[containerId][position] !== void 0) {
23
+ styleElement = styleElements[containerId][position];
24
+ } else {
25
+ styleElement = styleElements[containerId][position] = createStyleElement();
26
+ if (position === "prepend") {
27
+ container.insertBefore(styleElement, container.childNodes[0]);
28
+ } else {
29
+ container.appendChild(styleElement);
30
+ }
31
+ }
32
+ if (css.charCodeAt(0) === 65279) {
33
+ css = css.substr(1, css.length);
34
+ }
35
+ if (styleElement.styleSheet) {
36
+ styleElement.styleSheet.cssText += css;
37
+ } else {
38
+ styleElement.textContent += css;
39
+ }
40
+ return styleElement;
41
+ }
10
42
  export {
11
- useInjectIconContext
43
+ insertCss as default
12
44
  };
@@ -1,109 +1,148 @@
1
- function canUseDom() {
2
- return !!(typeof window !== "undefined" && window.document && window.document.createElement);
1
+ import { rgbToRgb, hsvToRgb, hslToRgb, convertHexToDecimal, parseIntFromHex } from "./sun-card-design-mobile.es87.js";
2
+ import { names } from "./sun-card-design-mobile.es88.js";
3
+ import { convertToPercentage, boundAlpha } from "./sun-card-design-mobile.es89.js";
4
+ function inputToRGB(color) {
5
+ var rgb = { r: 0, g: 0, b: 0 };
6
+ var a = 1;
7
+ var s = null;
8
+ var v = null;
9
+ var l = null;
10
+ var ok = false;
11
+ var format = false;
12
+ if (typeof color === "string") {
13
+ color = stringInputToObject(color);
14
+ }
15
+ if (typeof color === "object") {
16
+ if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
17
+ rgb = rgbToRgb(color.r, color.g, color.b);
18
+ ok = true;
19
+ format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
20
+ } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
21
+ s = convertToPercentage(color.s);
22
+ v = convertToPercentage(color.v);
23
+ rgb = hsvToRgb(color.h, s, v);
24
+ ok = true;
25
+ format = "hsv";
26
+ } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
27
+ s = convertToPercentage(color.s);
28
+ l = convertToPercentage(color.l);
29
+ rgb = hslToRgb(color.h, s, l);
30
+ ok = true;
31
+ format = "hsl";
32
+ }
33
+ if (Object.prototype.hasOwnProperty.call(color, "a")) {
34
+ a = color.a;
35
+ }
36
+ }
37
+ a = boundAlpha(a);
38
+ return {
39
+ ok,
40
+ format: color.format || format,
41
+ r: Math.min(255, Math.max(rgb.r, 0)),
42
+ g: Math.min(255, Math.max(rgb.g, 0)),
43
+ b: Math.min(255, Math.max(rgb.b, 0)),
44
+ a
45
+ };
3
46
  }
4
- function contains(root, n) {
5
- if (!root) {
47
+ var CSS_INTEGER = "[-\\+]?\\d+%?";
48
+ var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
49
+ var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
50
+ var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
51
+ var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
52
+ var matchers = {
53
+ CSS_UNIT: new RegExp(CSS_UNIT),
54
+ rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
55
+ rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
56
+ hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
57
+ hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
58
+ hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
59
+ hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
60
+ hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
61
+ hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
62
+ hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
63
+ hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
64
+ };
65
+ function stringInputToObject(color) {
66
+ color = color.trim().toLowerCase();
67
+ if (color.length === 0) {
6
68
  return false;
7
69
  }
8
- if (root.contains) {
9
- return root.contains(n);
70
+ var named = false;
71
+ if (names[color]) {
72
+ color = names[color];
73
+ named = true;
74
+ } else if (color === "transparent") {
75
+ return { r: 0, g: 0, b: 0, a: 0, format: "name" };
10
76
  }
11
- return false;
12
- }
13
- var APPEND_ORDER = "data-vc-order";
14
- var MARK_KEY = "vc-icon-key";
15
- var containerCache = /* @__PURE__ */ new Map();
16
- function getMark() {
17
- var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, mark = _ref.mark;
18
- if (mark) {
19
- return mark.startsWith("data-") ? mark : "data-".concat(mark);
77
+ var match = matchers.rgb.exec(color);
78
+ if (match) {
79
+ return { r: match[1], g: match[2], b: match[3] };
20
80
  }
21
- return MARK_KEY;
22
- }
23
- function getContainer(option) {
24
- if (option.attachTo) {
25
- return option.attachTo;
81
+ match = matchers.rgba.exec(color);
82
+ if (match) {
83
+ return { r: match[1], g: match[2], b: match[3], a: match[4] };
26
84
  }
27
- var head = document.querySelector("head");
28
- return head || document.body;
29
- }
30
- function getOrder(prepend) {
31
- if (prepend === "queue") {
32
- return "prependQueue";
85
+ match = matchers.hsl.exec(color);
86
+ if (match) {
87
+ return { h: match[1], s: match[2], l: match[3] };
33
88
  }
34
- return prepend ? "prepend" : "append";
35
- }
36
- function findStyles(container) {
37
- return Array.from((containerCache.get(container) || container).children).filter(function(node) {
38
- return node.tagName === "STYLE";
39
- });
40
- }
41
- function injectCSS(css) {
42
- var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
43
- if (!canUseDom()) {
44
- return null;
89
+ match = matchers.hsla.exec(color);
90
+ if (match) {
91
+ return { h: match[1], s: match[2], l: match[3], a: match[4] };
45
92
  }
46
- var csp = option.csp, prepend = option.prepend;
47
- var styleNode = document.createElement("style");
48
- styleNode.setAttribute(APPEND_ORDER, getOrder(prepend));
49
- if (csp && csp.nonce) {
50
- styleNode.nonce = csp.nonce;
93
+ match = matchers.hsv.exec(color);
94
+ if (match) {
95
+ return { h: match[1], s: match[2], v: match[3] };
51
96
  }
52
- styleNode.innerHTML = css;
53
- var container = getContainer(option);
54
- var firstChild = container.firstChild;
55
- if (prepend) {
56
- if (prepend === "queue") {
57
- var existStyle = findStyles(container).filter(function(node) {
58
- return ["prepend", "prependQueue"].includes(node.getAttribute(APPEND_ORDER));
59
- });
60
- if (existStyle.length) {
61
- container.insertBefore(styleNode, existStyle[existStyle.length - 1].nextSibling);
62
- return styleNode;
63
- }
64
- }
65
- container.insertBefore(styleNode, firstChild);
66
- } else {
67
- container.appendChild(styleNode);
97
+ match = matchers.hsva.exec(color);
98
+ if (match) {
99
+ return { h: match[1], s: match[2], v: match[3], a: match[4] };
68
100
  }
69
- return styleNode;
70
- }
71
- function findExistNode(key) {
72
- var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
73
- var container = getContainer(option);
74
- return findStyles(container).find(function(node) {
75
- return node.getAttribute(getMark(option)) === key;
76
- });
77
- }
78
- function syncRealContainer(container, option) {
79
- var cachedRealContainer = containerCache.get(container);
80
- if (!cachedRealContainer || !contains(document, cachedRealContainer)) {
81
- var placeholderStyle = injectCSS("", option);
82
- var parentNode = placeholderStyle.parentNode;
83
- containerCache.set(container, parentNode);
84
- container.removeChild(placeholderStyle);
101
+ match = matchers.hex8.exec(color);
102
+ if (match) {
103
+ return {
104
+ r: parseIntFromHex(match[1]),
105
+ g: parseIntFromHex(match[2]),
106
+ b: parseIntFromHex(match[3]),
107
+ a: convertHexToDecimal(match[4]),
108
+ format: named ? "name" : "hex8"
109
+ };
85
110
  }
86
- }
87
- function updateCSS(css, key) {
88
- var option = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
89
- var container = getContainer(option);
90
- syncRealContainer(container, option);
91
- var existNode = findExistNode(key, option);
92
- if (existNode) {
93
- if (option.csp && option.csp.nonce && existNode.nonce !== option.csp.nonce) {
94
- existNode.nonce = option.csp.nonce;
95
- }
96
- if (existNode.innerHTML !== css) {
97
- existNode.innerHTML = css;
98
- }
99
- return existNode;
111
+ match = matchers.hex6.exec(color);
112
+ if (match) {
113
+ return {
114
+ r: parseIntFromHex(match[1]),
115
+ g: parseIntFromHex(match[2]),
116
+ b: parseIntFromHex(match[3]),
117
+ format: named ? "name" : "hex"
118
+ };
119
+ }
120
+ match = matchers.hex4.exec(color);
121
+ if (match) {
122
+ return {
123
+ r: parseIntFromHex(match[1] + match[1]),
124
+ g: parseIntFromHex(match[2] + match[2]),
125
+ b: parseIntFromHex(match[3] + match[3]),
126
+ a: convertHexToDecimal(match[4] + match[4]),
127
+ format: named ? "name" : "hex8"
128
+ };
129
+ }
130
+ match = matchers.hex3.exec(color);
131
+ if (match) {
132
+ return {
133
+ r: parseIntFromHex(match[1] + match[1]),
134
+ g: parseIntFromHex(match[2] + match[2]),
135
+ b: parseIntFromHex(match[3] + match[3]),
136
+ format: named ? "name" : "hex"
137
+ };
100
138
  }
101
- var newNode = injectCSS(css, option);
102
- newNode.setAttribute(getMark(option), key);
103
- return newNode;
139
+ return false;
140
+ }
141
+ function isValidCSSUnit(color) {
142
+ return Boolean(matchers.CSS_UNIT.exec(String(color)));
104
143
  }
105
144
  export {
106
- canUseDom,
107
- injectCSS,
108
- updateCSS
145
+ inputToRGB,
146
+ isValidCSSUnit,
147
+ stringInputToObject
109
148
  };
@@ -1,14 +1,112 @@
1
- import { defineComponent } from "vue";
2
- import { useInsertStyles } from "./sun-card-design-mobile.es73.js";
3
- var InsertStyles = defineComponent({
4
- name: "InsertStyles",
5
- setup: function setup() {
6
- useInsertStyles();
7
- return function() {
8
- return null;
9
- };
10
- }
11
- });
1
+ import { bound01, pad2 } from "./sun-card-design-mobile.es89.js";
2
+ function rgbToRgb(r, g, b) {
3
+ return {
4
+ r: bound01(r, 255) * 255,
5
+ g: bound01(g, 255) * 255,
6
+ b: bound01(b, 255) * 255
7
+ };
8
+ }
9
+ function hue2rgb(p, q, t) {
10
+ if (t < 0) {
11
+ t += 1;
12
+ }
13
+ if (t > 1) {
14
+ t -= 1;
15
+ }
16
+ if (t < 1 / 6) {
17
+ return p + (q - p) * (6 * t);
18
+ }
19
+ if (t < 1 / 2) {
20
+ return q;
21
+ }
22
+ if (t < 2 / 3) {
23
+ return p + (q - p) * (2 / 3 - t) * 6;
24
+ }
25
+ return p;
26
+ }
27
+ function hslToRgb(h, s, l) {
28
+ var r;
29
+ var g;
30
+ var b;
31
+ h = bound01(h, 360);
32
+ s = bound01(s, 100);
33
+ l = bound01(l, 100);
34
+ if (s === 0) {
35
+ g = l;
36
+ b = l;
37
+ r = l;
38
+ } else {
39
+ var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
40
+ var p = 2 * l - q;
41
+ r = hue2rgb(p, q, h + 1 / 3);
42
+ g = hue2rgb(p, q, h);
43
+ b = hue2rgb(p, q, h - 1 / 3);
44
+ }
45
+ return { r: r * 255, g: g * 255, b: b * 255 };
46
+ }
47
+ function rgbToHsv(r, g, b) {
48
+ r = bound01(r, 255);
49
+ g = bound01(g, 255);
50
+ b = bound01(b, 255);
51
+ var max = Math.max(r, g, b);
52
+ var min = Math.min(r, g, b);
53
+ var h = 0;
54
+ var v = max;
55
+ var d = max - min;
56
+ var s = max === 0 ? 0 : d / max;
57
+ if (max === min) {
58
+ h = 0;
59
+ } else {
60
+ switch (max) {
61
+ case r:
62
+ h = (g - b) / d + (g < b ? 6 : 0);
63
+ break;
64
+ case g:
65
+ h = (b - r) / d + 2;
66
+ break;
67
+ case b:
68
+ h = (r - g) / d + 4;
69
+ break;
70
+ }
71
+ h /= 6;
72
+ }
73
+ return { h, s, v };
74
+ }
75
+ function hsvToRgb(h, s, v) {
76
+ h = bound01(h, 360) * 6;
77
+ s = bound01(s, 100);
78
+ v = bound01(v, 100);
79
+ var i = Math.floor(h);
80
+ var f = h - i;
81
+ var p = v * (1 - s);
82
+ var q = v * (1 - f * s);
83
+ var t = v * (1 - (1 - f) * s);
84
+ var mod = i % 6;
85
+ var r = [v, q, p, p, t, v][mod];
86
+ var g = [t, v, v, q, p, p][mod];
87
+ var b = [p, p, t, v, v, q][mod];
88
+ return { r: r * 255, g: g * 255, b: b * 255 };
89
+ }
90
+ function rgbToHex(r, g, b, allow3Char) {
91
+ var hex = [
92
+ pad2(Math.round(r).toString(16)),
93
+ pad2(Math.round(g).toString(16)),
94
+ pad2(Math.round(b).toString(16))
95
+ ];
96
+ return hex.join("");
97
+ }
98
+ function convertHexToDecimal(h) {
99
+ return parseIntFromHex(h) / 255;
100
+ }
101
+ function parseIntFromHex(val) {
102
+ return parseInt(val, 16);
103
+ }
12
104
  export {
13
- InsertStyles
105
+ convertHexToDecimal,
106
+ hslToRgb,
107
+ hsvToRgb,
108
+ parseIntFromHex,
109
+ rgbToHex,
110
+ rgbToHsv,
111
+ rgbToRgb
14
112
  };