@histoire/controls 0.2.2 → 0.2.3
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.
- package/dist/components/HstCopyIcon.vue.d.ts +15 -0
- package/dist/components/design-tokens/HstColorShades.story.vue.d.ts +2 -0
- package/dist/components/design-tokens/HstColorShades.vue.d.ts +19 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.es.js +2315 -86
- package/dist/style.css +91 -0
- package/package.json +17 -12
- package/src/components/HstCopyIcon.vue +34 -0
- package/src/components/design-tokens/HstColorShades.story.vue +381 -0
- package/src/components/design-tokens/HstColorShades.vue +80 -0
- package/src/index.ts +4 -0
package/dist/index.es.js
CHANGED
|
@@ -29,7 +29,7 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
}
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
|
-
import { pushScopeId, popScopeId, defineComponent, nextTick, openBlock, createBlock, withScopeId, resolveComponent, createElementBlock, normalizeClass, normalizeStyle, withKeys, createElementVNode, Fragment, renderSlot, createCommentVNode, mergeProps, withCtx, createVNode, ref, createApp, h, toDisplayString, withDirectives, createTextVNode, unref, computed, watch, withModifiers, onUnmounted, isRef, vModelText } from "vue";
|
|
32
|
+
import { pushScopeId, popScopeId, defineComponent, nextTick, openBlock, createBlock, withScopeId, resolveComponent, createElementBlock, normalizeClass, normalizeStyle, withKeys, createElementVNode, Fragment, renderSlot, createCommentVNode, mergeProps, withCtx, createVNode, ref, createApp, h, toDisplayString, withDirectives, createTextVNode, unref, computed, watch, withModifiers, onUnmounted, isRef, vModelText, getCurrentScope, onScopeDispose, renderList } from "vue";
|
|
33
33
|
function getBasePlacement(placement) {
|
|
34
34
|
return placement.split("-")[0];
|
|
35
35
|
}
|
|
@@ -355,11 +355,11 @@ const autoPlacement = function(options) {
|
|
|
355
355
|
middlewareData,
|
|
356
356
|
placement
|
|
357
357
|
} = middlewareArguments;
|
|
358
|
-
const
|
|
358
|
+
const _a2 = options, {
|
|
359
359
|
alignment = null,
|
|
360
360
|
allowedPlacements = allPlacements,
|
|
361
361
|
autoAlignment = true
|
|
362
|
-
} =
|
|
362
|
+
} = _a2, detectOverflowOptions = __objRest(_a2, [
|
|
363
363
|
"alignment",
|
|
364
364
|
"allowedPlacements",
|
|
365
365
|
"autoAlignment"
|
|
@@ -441,13 +441,13 @@ const flip = function(options) {
|
|
|
441
441
|
if ((_middlewareData$flip = middlewareData.flip) != null && _middlewareData$flip.skip) {
|
|
442
442
|
return {};
|
|
443
443
|
}
|
|
444
|
-
const
|
|
444
|
+
const _a2 = options, {
|
|
445
445
|
mainAxis: checkMainAxis = true,
|
|
446
446
|
crossAxis: checkCrossAxis = true,
|
|
447
447
|
fallbackPlacements: specifiedFallbackPlacements,
|
|
448
448
|
fallbackStrategy = "bestFit",
|
|
449
449
|
flipAlignment = true
|
|
450
|
-
} =
|
|
450
|
+
} = _a2, detectOverflowOptions = __objRest(_a2, [
|
|
451
451
|
"mainAxis",
|
|
452
452
|
"crossAxis",
|
|
453
453
|
"fallbackPlacements",
|
|
@@ -589,7 +589,7 @@ const shift = function(options) {
|
|
|
589
589
|
y,
|
|
590
590
|
placement
|
|
591
591
|
} = middlewareArguments;
|
|
592
|
-
const
|
|
592
|
+
const _a2 = options, {
|
|
593
593
|
mainAxis: checkMainAxis = true,
|
|
594
594
|
crossAxis: checkCrossAxis = false,
|
|
595
595
|
limiter = {
|
|
@@ -604,7 +604,7 @@ const shift = function(options) {
|
|
|
604
604
|
};
|
|
605
605
|
}
|
|
606
606
|
}
|
|
607
|
-
} =
|
|
607
|
+
} = _a2, detectOverflowOptions = __objRest(_a2, [
|
|
608
608
|
"mainAxis",
|
|
609
609
|
"crossAxis",
|
|
610
610
|
"limiter"
|
|
@@ -659,9 +659,9 @@ const size = function(options) {
|
|
|
659
659
|
rects,
|
|
660
660
|
middlewareData
|
|
661
661
|
} = middlewareArguments;
|
|
662
|
-
const
|
|
662
|
+
const _a2 = options, {
|
|
663
663
|
apply
|
|
664
|
-
} =
|
|
664
|
+
} = _a2, detectOverflowOptions = __objRest(_a2, [
|
|
665
665
|
"apply"
|
|
666
666
|
]);
|
|
667
667
|
if ((_middlewareData$size = middlewareData.size) != null && _middlewareData$size.skip) {
|
|
@@ -1098,7 +1098,7 @@ var __spreadValues2 = (a, b) => {
|
|
|
1098
1098
|
return a;
|
|
1099
1099
|
};
|
|
1100
1100
|
var __spreadProps2 = (a, b) => __defProps2(a, __getOwnPropDescs2(b));
|
|
1101
|
-
const config = {
|
|
1101
|
+
const config$1 = {
|
|
1102
1102
|
disabled: false,
|
|
1103
1103
|
distance: 5,
|
|
1104
1104
|
skidding: 0,
|
|
@@ -1146,16 +1146,16 @@ const config = {
|
|
|
1146
1146
|
}
|
|
1147
1147
|
};
|
|
1148
1148
|
function getDefaultConfig(theme, key) {
|
|
1149
|
-
let themeConfig = config.themes[theme] || {};
|
|
1149
|
+
let themeConfig = config$1.themes[theme] || {};
|
|
1150
1150
|
let value;
|
|
1151
1151
|
do {
|
|
1152
1152
|
value = themeConfig[key];
|
|
1153
1153
|
if (typeof value === "undefined") {
|
|
1154
1154
|
if (themeConfig.$extend) {
|
|
1155
|
-
themeConfig = config.themes[themeConfig.$extend] || {};
|
|
1155
|
+
themeConfig = config$1.themes[themeConfig.$extend] || {};
|
|
1156
1156
|
} else {
|
|
1157
1157
|
themeConfig = null;
|
|
1158
|
-
value = config[key];
|
|
1158
|
+
value = config$1[key];
|
|
1159
1159
|
}
|
|
1160
1160
|
} else {
|
|
1161
1161
|
themeConfig = null;
|
|
@@ -1165,17 +1165,30 @@ function getDefaultConfig(theme, key) {
|
|
|
1165
1165
|
}
|
|
1166
1166
|
function getThemeClasses(theme) {
|
|
1167
1167
|
const result = [theme];
|
|
1168
|
-
let themeConfig = config.themes[theme] || {};
|
|
1168
|
+
let themeConfig = config$1.themes[theme] || {};
|
|
1169
1169
|
do {
|
|
1170
1170
|
if (themeConfig.$extend && !themeConfig.$resetCss) {
|
|
1171
1171
|
result.push(themeConfig.$extend);
|
|
1172
|
-
themeConfig = config.themes[themeConfig.$extend] || {};
|
|
1172
|
+
themeConfig = config$1.themes[themeConfig.$extend] || {};
|
|
1173
1173
|
} else {
|
|
1174
1174
|
themeConfig = null;
|
|
1175
1175
|
}
|
|
1176
1176
|
} while (themeConfig);
|
|
1177
1177
|
return result.map((c) => `v-popper--theme-${c}`);
|
|
1178
1178
|
}
|
|
1179
|
+
function getAllParentThemes(theme) {
|
|
1180
|
+
const result = [theme];
|
|
1181
|
+
let themeConfig = config$1.themes[theme] || {};
|
|
1182
|
+
do {
|
|
1183
|
+
if (themeConfig.$extend) {
|
|
1184
|
+
result.push(themeConfig.$extend);
|
|
1185
|
+
themeConfig = config$1.themes[themeConfig.$extend] || {};
|
|
1186
|
+
} else {
|
|
1187
|
+
themeConfig = null;
|
|
1188
|
+
}
|
|
1189
|
+
} while (themeConfig);
|
|
1190
|
+
return result;
|
|
1191
|
+
}
|
|
1179
1192
|
let supportsPassive = false;
|
|
1180
1193
|
if (typeof window !== "undefined") {
|
|
1181
1194
|
supportsPassive = false;
|
|
@@ -1223,6 +1236,14 @@ function nextFrame() {
|
|
|
1223
1236
|
}
|
|
1224
1237
|
const shownPoppers = [];
|
|
1225
1238
|
let hidingPopper = null;
|
|
1239
|
+
const shownPoppersByTheme = {};
|
|
1240
|
+
function getShownPoppersByTheme(theme) {
|
|
1241
|
+
let list = shownPoppersByTheme[theme];
|
|
1242
|
+
if (!list) {
|
|
1243
|
+
list = shownPoppersByTheme[theme] = [];
|
|
1244
|
+
}
|
|
1245
|
+
return list;
|
|
1246
|
+
}
|
|
1226
1247
|
let Element = function() {
|
|
1227
1248
|
};
|
|
1228
1249
|
if (typeof window !== "undefined") {
|
|
@@ -1233,8 +1254,19 @@ function defaultPropFactory(prop) {
|
|
|
1233
1254
|
return getDefaultConfig(props.theme, prop);
|
|
1234
1255
|
};
|
|
1235
1256
|
}
|
|
1257
|
+
const PROVIDE_KEY = "__floating-vue__popper";
|
|
1236
1258
|
var PrivatePopper = () => defineComponent({
|
|
1237
1259
|
name: "VPopper",
|
|
1260
|
+
provide() {
|
|
1261
|
+
return {
|
|
1262
|
+
[PROVIDE_KEY]: {
|
|
1263
|
+
parentPopper: this
|
|
1264
|
+
}
|
|
1265
|
+
};
|
|
1266
|
+
},
|
|
1267
|
+
inject: {
|
|
1268
|
+
[PROVIDE_KEY]: { default: null }
|
|
1269
|
+
},
|
|
1238
1270
|
props: {
|
|
1239
1271
|
theme: {
|
|
1240
1272
|
type: String,
|
|
@@ -1428,7 +1460,8 @@ var PrivatePopper = () => defineComponent({
|
|
|
1428
1460
|
centerOffset: 0
|
|
1429
1461
|
},
|
|
1430
1462
|
transformOrigin: null
|
|
1431
|
-
}
|
|
1463
|
+
},
|
|
1464
|
+
shownChildren: /* @__PURE__ */ new Set()
|
|
1432
1465
|
};
|
|
1433
1466
|
},
|
|
1434
1467
|
computed: {
|
|
@@ -1454,6 +1487,14 @@ var PrivatePopper = () => defineComponent({
|
|
|
1454
1487
|
}),
|
|
1455
1488
|
result: this.positioningDisabled ? null : this.result
|
|
1456
1489
|
};
|
|
1490
|
+
},
|
|
1491
|
+
parentPopper() {
|
|
1492
|
+
var _a2;
|
|
1493
|
+
return (_a2 = this[PROVIDE_KEY]) == null ? void 0 : _a2.parentPopper;
|
|
1494
|
+
},
|
|
1495
|
+
hasPopperShowTriggerHover() {
|
|
1496
|
+
var _a2, _b2;
|
|
1497
|
+
return ((_a2 = this.popperTriggers) == null ? void 0 : _a2.includes("hover")) || ((_b2 = this.popperShowTriggers) == null ? void 0 : _b2.includes("hover"));
|
|
1457
1498
|
}
|
|
1458
1499
|
},
|
|
1459
1500
|
watch: __spreadValues2(__spreadValues2({
|
|
@@ -1518,7 +1559,14 @@ var PrivatePopper = () => defineComponent({
|
|
|
1518
1559
|
},
|
|
1519
1560
|
methods: {
|
|
1520
1561
|
show({ event = null, skipDelay = false, force = false } = {}) {
|
|
1562
|
+
var _a2, _b2;
|
|
1563
|
+
if (((_a2 = this.parentPopper) == null ? void 0 : _a2.lockedChild) && this.parentPopper.lockedChild !== this)
|
|
1564
|
+
return;
|
|
1565
|
+
this.$_pendingHide = false;
|
|
1521
1566
|
if (force || !this.disabled) {
|
|
1567
|
+
if (((_b2 = this.parentPopper) == null ? void 0 : _b2.lockedChild) === this) {
|
|
1568
|
+
this.parentPopper.lockedChild = null;
|
|
1569
|
+
}
|
|
1522
1570
|
this.$_scheduleShow(event, skipDelay);
|
|
1523
1571
|
this.$emit("show");
|
|
1524
1572
|
this.$_showFrameLocked = true;
|
|
@@ -1529,8 +1577,30 @@ var PrivatePopper = () => defineComponent({
|
|
|
1529
1577
|
this.$emit("update:shown", true);
|
|
1530
1578
|
},
|
|
1531
1579
|
hide({ event = null, skipDelay = false } = {}) {
|
|
1580
|
+
var _a2;
|
|
1532
1581
|
if (this.$_hideInProgress)
|
|
1533
1582
|
return;
|
|
1583
|
+
if (this.shownChildren.size > 0) {
|
|
1584
|
+
this.$_pendingHide = true;
|
|
1585
|
+
return;
|
|
1586
|
+
}
|
|
1587
|
+
if (this.hasPopperShowTriggerHover && this.$_isAimingPopper()) {
|
|
1588
|
+
if (this.parentPopper) {
|
|
1589
|
+
this.parentPopper.lockedChild = this;
|
|
1590
|
+
clearTimeout(this.parentPopper.lockedChildTimer);
|
|
1591
|
+
this.parentPopper.lockedChildTimer = setTimeout(() => {
|
|
1592
|
+
if (this.parentPopper.lockedChild === this) {
|
|
1593
|
+
this.parentPopper.lockedChild.hide({ skipDelay });
|
|
1594
|
+
this.parentPopper.lockedChild = null;
|
|
1595
|
+
}
|
|
1596
|
+
}, 1e3);
|
|
1597
|
+
}
|
|
1598
|
+
return;
|
|
1599
|
+
}
|
|
1600
|
+
if (((_a2 = this.parentPopper) == null ? void 0 : _a2.lockedChild) === this) {
|
|
1601
|
+
this.parentPopper.lockedChild = null;
|
|
1602
|
+
}
|
|
1603
|
+
this.$_pendingHide = false;
|
|
1534
1604
|
this.$_scheduleHide(event, skipDelay);
|
|
1535
1605
|
this.$emit("hide");
|
|
1536
1606
|
this.$emit("update:shown", false);
|
|
@@ -1565,6 +1635,7 @@ var PrivatePopper = () => defineComponent({
|
|
|
1565
1635
|
this.$_detachPopperNode();
|
|
1566
1636
|
this.isMounted = false;
|
|
1567
1637
|
this.isShown = false;
|
|
1638
|
+
this.$_updateParentShownChildren(false);
|
|
1568
1639
|
this.$_swapTargetAttrs("data-original-title", "title");
|
|
1569
1640
|
this.$emit("dispose");
|
|
1570
1641
|
},
|
|
@@ -1575,7 +1646,7 @@ var PrivatePopper = () => defineComponent({
|
|
|
1575
1646
|
}
|
|
1576
1647
|
},
|
|
1577
1648
|
async $_computePosition() {
|
|
1578
|
-
var
|
|
1649
|
+
var _a2;
|
|
1579
1650
|
if (this.$_isDisposed || this.positioningDisabled)
|
|
1580
1651
|
return;
|
|
1581
1652
|
const options2 = {
|
|
@@ -1591,7 +1662,7 @@ var PrivatePopper = () => defineComponent({
|
|
|
1591
1662
|
const isPlacementAuto = this.placement.startsWith("auto");
|
|
1592
1663
|
if (isPlacementAuto) {
|
|
1593
1664
|
options2.middleware.push(autoPlacement({
|
|
1594
|
-
alignment: (
|
|
1665
|
+
alignment: (_a2 = this.placement.split("-")[1]) != null ? _a2 : ""
|
|
1595
1666
|
}));
|
|
1596
1667
|
} else {
|
|
1597
1668
|
options2.placement = this.placement;
|
|
@@ -1639,8 +1710,8 @@ var PrivatePopper = () => defineComponent({
|
|
|
1639
1710
|
options2.middleware.push({
|
|
1640
1711
|
name: "autoSize",
|
|
1641
1712
|
fn: ({ rects, placement, middlewareData }) => {
|
|
1642
|
-
var
|
|
1643
|
-
if ((
|
|
1713
|
+
var _a22;
|
|
1714
|
+
if ((_a22 = middlewareData.autoSize) == null ? void 0 : _a22.skip) {
|
|
1644
1715
|
return {};
|
|
1645
1716
|
}
|
|
1646
1717
|
let width;
|
|
@@ -1685,9 +1756,10 @@ var PrivatePopper = () => defineComponent({
|
|
|
1685
1756
|
});
|
|
1686
1757
|
},
|
|
1687
1758
|
$_scheduleShow(event = null, skipDelay = false) {
|
|
1759
|
+
this.$_updateParentShownChildren(true);
|
|
1688
1760
|
this.$_hideInProgress = false;
|
|
1689
1761
|
clearTimeout(this.$_scheduleTimer);
|
|
1690
|
-
if (hidingPopper && this.instantMove && hidingPopper.instantMove) {
|
|
1762
|
+
if (hidingPopper && this.instantMove && hidingPopper.instantMove && hidingPopper !== this.parentPopper) {
|
|
1691
1763
|
hidingPopper.$_applyHide(true);
|
|
1692
1764
|
this.$_applyShow(true);
|
|
1693
1765
|
return;
|
|
@@ -1699,6 +1771,11 @@ var PrivatePopper = () => defineComponent({
|
|
|
1699
1771
|
}
|
|
1700
1772
|
},
|
|
1701
1773
|
$_scheduleHide(event = null, skipDelay = false) {
|
|
1774
|
+
if (this.shownChildren.size > 0) {
|
|
1775
|
+
this.$_pendingHide = true;
|
|
1776
|
+
return;
|
|
1777
|
+
}
|
|
1778
|
+
this.$_updateParentShownChildren(false);
|
|
1702
1779
|
this.$_hideInProgress = true;
|
|
1703
1780
|
clearTimeout(this.$_scheduleTimer);
|
|
1704
1781
|
if (this.isShown) {
|
|
@@ -1762,6 +1839,11 @@ var PrivatePopper = () => defineComponent({
|
|
|
1762
1839
|
}
|
|
1763
1840
|
}
|
|
1764
1841
|
shownPoppers.push(this);
|
|
1842
|
+
document.body.classList.add("v-popper--some-open");
|
|
1843
|
+
for (const theme of getAllParentThemes(this.theme)) {
|
|
1844
|
+
getShownPoppersByTheme(theme).push(this);
|
|
1845
|
+
document.body.classList.add(`v-popper--some-open--${theme}`);
|
|
1846
|
+
}
|
|
1765
1847
|
this.$emit("apply-show");
|
|
1766
1848
|
this.classes.showFrom = true;
|
|
1767
1849
|
this.classes.showTo = false;
|
|
@@ -1770,14 +1852,30 @@ var PrivatePopper = () => defineComponent({
|
|
|
1770
1852
|
await nextFrame();
|
|
1771
1853
|
this.classes.showFrom = false;
|
|
1772
1854
|
this.classes.showTo = true;
|
|
1855
|
+
this.$_popperNode.focus();
|
|
1773
1856
|
},
|
|
1774
1857
|
async $_applyHide(skipTransition = false) {
|
|
1858
|
+
if (this.shownChildren.size > 0) {
|
|
1859
|
+
this.$_pendingHide = true;
|
|
1860
|
+
this.$_hideInProgress = false;
|
|
1861
|
+
return;
|
|
1862
|
+
}
|
|
1775
1863
|
clearTimeout(this.$_scheduleTimer);
|
|
1776
1864
|
if (!this.isShown) {
|
|
1777
1865
|
return;
|
|
1778
1866
|
}
|
|
1779
1867
|
this.skipTransition = skipTransition;
|
|
1780
1868
|
removeFromArray(shownPoppers, this);
|
|
1869
|
+
if (shownPoppers.length === 0) {
|
|
1870
|
+
document.body.classList.remove("v-popper--some-open");
|
|
1871
|
+
}
|
|
1872
|
+
for (const theme of getAllParentThemes(this.theme)) {
|
|
1873
|
+
const list = getShownPoppersByTheme(theme);
|
|
1874
|
+
removeFromArray(list, this);
|
|
1875
|
+
if (list.length === 0) {
|
|
1876
|
+
document.body.classList.remove(`v-popper--some-open--${theme}`);
|
|
1877
|
+
}
|
|
1878
|
+
}
|
|
1781
1879
|
if (hidingPopper === this) {
|
|
1782
1880
|
hidingPopper = null;
|
|
1783
1881
|
}
|
|
@@ -1922,6 +2020,34 @@ var PrivatePopper = () => defineComponent({
|
|
|
1922
2020
|
}
|
|
1923
2021
|
}
|
|
1924
2022
|
}
|
|
2023
|
+
},
|
|
2024
|
+
$_updateParentShownChildren(value) {
|
|
2025
|
+
let parent = this.parentPopper;
|
|
2026
|
+
while (parent) {
|
|
2027
|
+
if (value) {
|
|
2028
|
+
parent.shownChildren.add(this.randomId);
|
|
2029
|
+
} else {
|
|
2030
|
+
parent.shownChildren.delete(this.randomId);
|
|
2031
|
+
if (parent.$_pendingHide) {
|
|
2032
|
+
parent.hide();
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
parent = parent.parentPopper;
|
|
2036
|
+
}
|
|
2037
|
+
},
|
|
2038
|
+
$_isAimingPopper() {
|
|
2039
|
+
const referenceBounds = this.$_referenceNode.getBoundingClientRect();
|
|
2040
|
+
if (mouseX >= referenceBounds.left && mouseX <= referenceBounds.right && mouseY >= referenceBounds.top && mouseY <= referenceBounds.bottom) {
|
|
2041
|
+
const popperBounds = this.$_popperNode.getBoundingClientRect();
|
|
2042
|
+
const vectorX = mouseX - mousePreviousX;
|
|
2043
|
+
const vectorY = mouseY - mousePreviousY;
|
|
2044
|
+
const distance = popperBounds.left + popperBounds.width / 2 - mousePreviousX + (popperBounds.top + popperBounds.height / 2) - mousePreviousY;
|
|
2045
|
+
const newVectorLength = distance + popperBounds.width + popperBounds.height;
|
|
2046
|
+
const edgeX = mousePreviousX + vectorX * newVectorLength;
|
|
2047
|
+
const edgeY = mousePreviousY + vectorY * newVectorLength;
|
|
2048
|
+
return lineIntersectsLine(mousePreviousX, mousePreviousY, edgeX, edgeY, popperBounds.left, popperBounds.top, popperBounds.left, popperBounds.bottom) || lineIntersectsLine(mousePreviousX, mousePreviousY, edgeX, edgeY, popperBounds.left, popperBounds.top, popperBounds.right, popperBounds.top) || lineIntersectsLine(mousePreviousX, mousePreviousY, edgeX, edgeY, popperBounds.right, popperBounds.top, popperBounds.right, popperBounds.bottom) || lineIntersectsLine(mousePreviousX, mousePreviousY, edgeX, edgeY, popperBounds.left, popperBounds.bottom, popperBounds.right, popperBounds.bottom);
|
|
2049
|
+
}
|
|
2050
|
+
return false;
|
|
1925
2051
|
}
|
|
1926
2052
|
},
|
|
1927
2053
|
render() {
|
|
@@ -1961,26 +2087,73 @@ function handleGlobalTouchend(event) {
|
|
|
1961
2087
|
handleGlobalClose(event, true);
|
|
1962
2088
|
}
|
|
1963
2089
|
function handleGlobalClose(event, touch = false) {
|
|
1964
|
-
|
|
2090
|
+
const preventClose = {};
|
|
2091
|
+
for (let i = shownPoppers.length - 1; i >= 0; i--) {
|
|
1965
2092
|
const popper = shownPoppers[i];
|
|
1966
2093
|
try {
|
|
1967
|
-
const
|
|
1968
|
-
|
|
2094
|
+
const contains2 = popper.$_containsGlobalTarget = isContainingEventTarget(popper, event);
|
|
2095
|
+
popper.$_pendingHide = false;
|
|
1969
2096
|
requestAnimationFrame(() => {
|
|
1970
|
-
|
|
2097
|
+
popper.$_pendingHide = false;
|
|
2098
|
+
if (preventClose[popper.randomId])
|
|
2099
|
+
return;
|
|
2100
|
+
if (shouldAutoHide(popper, contains2, event)) {
|
|
1971
2101
|
popper.$_handleGlobalClose(event, touch);
|
|
2102
|
+
if (!event.closeAllPopover && event.closePopover && contains2) {
|
|
2103
|
+
let parent2 = popper.parentPopper;
|
|
2104
|
+
while (parent2) {
|
|
2105
|
+
preventClose[parent2.randomId] = true;
|
|
2106
|
+
parent2 = parent2.parentPopper;
|
|
2107
|
+
}
|
|
2108
|
+
return;
|
|
2109
|
+
}
|
|
2110
|
+
let parent = popper.parentPopper;
|
|
2111
|
+
while (parent) {
|
|
2112
|
+
if (shouldAutoHide(parent, parent.$_containsGlobalTarget, event)) {
|
|
2113
|
+
parent.$_handleGlobalClose(event, touch);
|
|
2114
|
+
} else {
|
|
2115
|
+
break;
|
|
2116
|
+
}
|
|
2117
|
+
parent = parent.parentPopper;
|
|
2118
|
+
}
|
|
1972
2119
|
}
|
|
1973
2120
|
});
|
|
1974
2121
|
} catch (e) {
|
|
1975
2122
|
}
|
|
1976
2123
|
}
|
|
1977
2124
|
}
|
|
2125
|
+
function isContainingEventTarget(popper, event) {
|
|
2126
|
+
const popperContent = popper.popperNode();
|
|
2127
|
+
return popper.$_mouseDownContains || popperContent.contains(event.target);
|
|
2128
|
+
}
|
|
2129
|
+
function shouldAutoHide(popper, contains2, event) {
|
|
2130
|
+
return event.closeAllPopover || event.closePopover && contains2 || popper.autoHide && !contains2;
|
|
2131
|
+
}
|
|
1978
2132
|
function computePositionAllShownPoppers(event) {
|
|
1979
2133
|
for (let i = 0; i < shownPoppers.length; i++) {
|
|
1980
2134
|
const popper = shownPoppers[i];
|
|
1981
2135
|
popper.$_computePosition(event);
|
|
1982
2136
|
}
|
|
1983
2137
|
}
|
|
2138
|
+
let mousePreviousX = 0;
|
|
2139
|
+
let mousePreviousY = 0;
|
|
2140
|
+
let mouseX = 0;
|
|
2141
|
+
let mouseY = 0;
|
|
2142
|
+
if (typeof window !== "undefined") {
|
|
2143
|
+
window.addEventListener("mousemove", (event) => {
|
|
2144
|
+
mousePreviousX = mouseX;
|
|
2145
|
+
mousePreviousY = mouseY;
|
|
2146
|
+
mouseX = event.clientX;
|
|
2147
|
+
mouseY = event.clientY;
|
|
2148
|
+
}, supportsPassive ? {
|
|
2149
|
+
passive: true
|
|
2150
|
+
} : void 0);
|
|
2151
|
+
}
|
|
2152
|
+
function lineIntersectsLine(x1, y1, x2, y2, x3, y3, x4, y4) {
|
|
2153
|
+
const uA = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / ((y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1));
|
|
2154
|
+
const uB = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / ((y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1));
|
|
2155
|
+
return uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1;
|
|
2156
|
+
}
|
|
1984
2157
|
function getInternetExplorerVersion() {
|
|
1985
2158
|
var ua = window.navigator.userAgent;
|
|
1986
2159
|
var msie = ua.indexOf("MSIE ");
|
|
@@ -2087,10 +2260,10 @@ const _hoisted_1$2$1 = {
|
|
|
2087
2260
|
tabindex: "-1"
|
|
2088
2261
|
};
|
|
2089
2262
|
popScopeId();
|
|
2090
|
-
const render = /* @__PURE__ */ _withId((_ctx, _cache, $props, $setup, $data, $options) => {
|
|
2263
|
+
const render$1 = /* @__PURE__ */ _withId((_ctx, _cache, $props, $setup, $data, $options) => {
|
|
2091
2264
|
return openBlock(), createBlock("div", _hoisted_1$2$1);
|
|
2092
2265
|
});
|
|
2093
|
-
script.render = render;
|
|
2266
|
+
script.render = render$1;
|
|
2094
2267
|
script.__scopeId = "data-v-b329ee4c";
|
|
2095
2268
|
script.__file = "src/components/ResizeObserver.vue";
|
|
2096
2269
|
var PrivateThemeClass = (prop = "theme") => ({
|
|
@@ -2107,7 +2280,7 @@ var _export_sfc = (sfc, props) => {
|
|
|
2107
2280
|
}
|
|
2108
2281
|
return target;
|
|
2109
2282
|
};
|
|
2110
|
-
const _sfc_main$5 = defineComponent({
|
|
2283
|
+
const _sfc_main$5$1 = defineComponent({
|
|
2111
2284
|
name: "VPopperContent",
|
|
2112
2285
|
components: {
|
|
2113
2286
|
ResizeObserver: script
|
|
@@ -2144,11 +2317,11 @@ const _hoisted_2$1$1 = {
|
|
|
2144
2317
|
ref: "inner",
|
|
2145
2318
|
class: "v-popper__inner"
|
|
2146
2319
|
};
|
|
2147
|
-
const _hoisted_3$
|
|
2148
|
-
const _hoisted_4 = /* @__PURE__ */ createElementVNode("div", { class: "v-popper__arrow-inner" }, null, -1);
|
|
2149
|
-
const _hoisted_5 = [
|
|
2150
|
-
_hoisted_3$
|
|
2151
|
-
_hoisted_4
|
|
2320
|
+
const _hoisted_3$3 = /* @__PURE__ */ createElementVNode("div", { class: "v-popper__arrow-outer" }, null, -1);
|
|
2321
|
+
const _hoisted_4$1 = /* @__PURE__ */ createElementVNode("div", { class: "v-popper__arrow-inner" }, null, -1);
|
|
2322
|
+
const _hoisted_5$1 = [
|
|
2323
|
+
_hoisted_3$3,
|
|
2324
|
+
_hoisted_4$1
|
|
2152
2325
|
];
|
|
2153
2326
|
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2154
2327
|
const _component_ResizeObserver = resolveComponent("ResizeObserver");
|
|
@@ -2207,11 +2380,11 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2207
2380
|
left: _ctx.toPx(_ctx.result.arrow.x),
|
|
2208
2381
|
top: _ctx.toPx(_ctx.result.arrow.y)
|
|
2209
2382
|
} : void 0)
|
|
2210
|
-
}, _hoisted_5, 4)
|
|
2383
|
+
}, _hoisted_5$1, 4)
|
|
2211
2384
|
], 4)
|
|
2212
2385
|
], 46, _hoisted_1$1$1);
|
|
2213
2386
|
}
|
|
2214
|
-
var PrivatePopperContent = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$2]]);
|
|
2387
|
+
var PrivatePopperContent = /* @__PURE__ */ _export_sfc(_sfc_main$5$1, [["render", _sfc_render$2]]);
|
|
2215
2388
|
var PrivatePopperMethods = {
|
|
2216
2389
|
methods: {
|
|
2217
2390
|
show(...args) {
|
|
@@ -2247,8 +2420,8 @@ const _sfc_main$4$1 = defineComponent({
|
|
|
2247
2420
|
},
|
|
2248
2421
|
computed: {
|
|
2249
2422
|
finalTheme() {
|
|
2250
|
-
var
|
|
2251
|
-
return (
|
|
2423
|
+
var _a2;
|
|
2424
|
+
return (_a2 = this.theme) != null ? _a2 : this.$options.vPopperTheme;
|
|
2252
2425
|
},
|
|
2253
2426
|
popperAttrs() {
|
|
2254
2427
|
const result = __spreadValues2({}, this.$attrs);
|
|
@@ -2341,7 +2514,7 @@ defineComponent(__spreadProps2(__spreadValues2({}, PrivatePopperWrapper), {
|
|
|
2341
2514
|
name: "VTooltip",
|
|
2342
2515
|
vPopperTheme: "tooltip"
|
|
2343
2516
|
}));
|
|
2344
|
-
const _sfc_main$
|
|
2517
|
+
const _sfc_main$7 = defineComponent({
|
|
2345
2518
|
name: "VTooltipDirective",
|
|
2346
2519
|
components: {
|
|
2347
2520
|
Popper: PrivatePopper(),
|
|
@@ -2432,8 +2605,8 @@ const _sfc_main$6 = defineComponent({
|
|
|
2432
2605
|
}
|
|
2433
2606
|
}
|
|
2434
2607
|
});
|
|
2435
|
-
const _hoisted_1$
|
|
2436
|
-
const _hoisted_2$
|
|
2608
|
+
const _hoisted_1$5 = ["innerHTML"];
|
|
2609
|
+
const _hoisted_2$3 = ["textContent"];
|
|
2437
2610
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2438
2611
|
const _component_PopperContent = resolveComponent("PopperContent");
|
|
2439
2612
|
const _component_Popper = resolveComponent("Popper");
|
|
@@ -2476,10 +2649,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2476
2649
|
_ctx.html ? (openBlock(), createElementBlock("div", {
|
|
2477
2650
|
key: 0,
|
|
2478
2651
|
innerHTML: _ctx.finalContent
|
|
2479
|
-
}, null, 8, _hoisted_1$
|
|
2652
|
+
}, null, 8, _hoisted_1$5)) : (openBlock(), createElementBlock("div", {
|
|
2480
2653
|
key: 1,
|
|
2481
2654
|
textContent: toDisplayString(_ctx.finalContent)
|
|
2482
|
-
}, null, 8, _hoisted_2$
|
|
2655
|
+
}, null, 8, _hoisted_2$3))
|
|
2483
2656
|
]),
|
|
2484
2657
|
_: 2
|
|
2485
2658
|
}, 1032, ["class", "popper-id", "theme", "shown", "mounted", "skip-transition", "auto-hide", "handle-resize", "classes", "result", "onHide", "onResize"])
|
|
@@ -2487,7 +2660,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2487
2660
|
_: 1
|
|
2488
2661
|
}, 16, ["theme", "popper-node", "onApplyShow", "onApplyHide"]);
|
|
2489
2662
|
}
|
|
2490
|
-
var PrivateTooltipDirective = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
2663
|
+
var PrivateTooltipDirective = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render]]);
|
|
2491
2664
|
const TARGET_CLASS = "v-popper--has-tooltip";
|
|
2492
2665
|
function getPlacement(options2, modifiers) {
|
|
2493
2666
|
let result = options2.placement;
|
|
@@ -2535,7 +2708,7 @@ function ensureDirectiveApp() {
|
|
|
2535
2708
|
render() {
|
|
2536
2709
|
return this.directives.map((directive) => {
|
|
2537
2710
|
return h(PrivateTooltipDirective, __spreadProps2(__spreadValues2({}, directive.options), {
|
|
2538
|
-
shown: directive.shown
|
|
2711
|
+
shown: directive.shown || directive.options.shown,
|
|
2539
2712
|
key: directive.id
|
|
2540
2713
|
}));
|
|
2541
2714
|
});
|
|
@@ -2586,7 +2759,7 @@ function destroyTooltip(el) {
|
|
|
2586
2759
|
el.classList.remove(TARGET_CLASS);
|
|
2587
2760
|
}
|
|
2588
2761
|
}
|
|
2589
|
-
function bind(el, { value,
|
|
2762
|
+
function bind(el, { value, modifiers }) {
|
|
2590
2763
|
const options2 = getOptions(el, value, modifiers);
|
|
2591
2764
|
if (!options2.content || getDefaultConfig(options2.theme || "tooltip", "disabled")) {
|
|
2592
2765
|
destroyTooltip(el);
|
|
@@ -2612,20 +2785,20 @@ var PrivateVTooltip = {
|
|
|
2612
2785
|
}
|
|
2613
2786
|
};
|
|
2614
2787
|
const VTooltip = PrivateVTooltip;
|
|
2615
|
-
const _hoisted_1$
|
|
2616
|
-
const _hoisted_2$
|
|
2617
|
-
const _hoisted_3$
|
|
2618
|
-
const __default__$
|
|
2788
|
+
const _hoisted_1$4 = { class: "htw-p-2 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-800 htw-flex htw-gap-2 htw-flex-wrap" };
|
|
2789
|
+
const _hoisted_2$2 = { class: "htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0" };
|
|
2790
|
+
const _hoisted_3$2 = { class: "htw-block htw-grow" };
|
|
2791
|
+
const __default__$6 = {
|
|
2619
2792
|
name: "HstWrapper"
|
|
2620
2793
|
};
|
|
2621
|
-
const _sfc_main$
|
|
2794
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$6), {
|
|
2622
2795
|
props: {
|
|
2623
2796
|
title: null
|
|
2624
2797
|
},
|
|
2625
2798
|
setup(__props) {
|
|
2626
2799
|
return (_ctx, _cache) => {
|
|
2627
|
-
return openBlock(), createElementBlock("label", _hoisted_1$
|
|
2628
|
-
withDirectives((openBlock(), createElementBlock("span", _hoisted_2$
|
|
2800
|
+
return openBlock(), createElementBlock("label", _hoisted_1$4, [
|
|
2801
|
+
withDirectives((openBlock(), createElementBlock("span", _hoisted_2$2, [
|
|
2629
2802
|
createTextVNode(toDisplayString(__props.title), 1)
|
|
2630
2803
|
])), [
|
|
2631
2804
|
[unref(VTooltip), {
|
|
@@ -2634,25 +2807,25 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
2634
2807
|
distance: 12
|
|
2635
2808
|
}]
|
|
2636
2809
|
]),
|
|
2637
|
-
createElementVNode("span", _hoisted_3$
|
|
2810
|
+
createElementVNode("span", _hoisted_3$2, [
|
|
2638
2811
|
renderSlot(_ctx.$slots, "default")
|
|
2639
2812
|
])
|
|
2640
2813
|
]);
|
|
2641
2814
|
};
|
|
2642
2815
|
}
|
|
2643
2816
|
}));
|
|
2644
|
-
const _hoisted_1$
|
|
2645
|
-
const _hoisted_2 = {
|
|
2817
|
+
const _hoisted_1$3 = { class: "htw-text-white htw-w-[16px] htw-h-[16px] htw-relative" };
|
|
2818
|
+
const _hoisted_2$1 = {
|
|
2646
2819
|
width: "16",
|
|
2647
2820
|
height: "16",
|
|
2648
2821
|
viewBox: "0 0 24 24",
|
|
2649
2822
|
class: "htw-relative htw-z-10"
|
|
2650
2823
|
};
|
|
2651
|
-
const _hoisted_3 = ["stroke-dasharray", "stroke-dashoffset"];
|
|
2652
|
-
const __default__$
|
|
2824
|
+
const _hoisted_3$1 = ["stroke-dasharray", "stroke-dashoffset"];
|
|
2825
|
+
const __default__$5 = {
|
|
2653
2826
|
name: "HstCheckbox"
|
|
2654
2827
|
};
|
|
2655
|
-
const _sfc_main$
|
|
2828
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$5), {
|
|
2656
2829
|
props: {
|
|
2657
2830
|
modelValue: { type: Boolean },
|
|
2658
2831
|
title: null
|
|
@@ -2672,11 +2845,11 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
2672
2845
|
const dashoffset = computed(() => (1 - progress.value) * dasharray.value);
|
|
2673
2846
|
const animationEnabled = ref(false);
|
|
2674
2847
|
watch(path, (value) => {
|
|
2675
|
-
var
|
|
2676
|
-
dasharray.value = (_c = (
|
|
2848
|
+
var _a2, _b2, _c;
|
|
2849
|
+
dasharray.value = (_c = (_b2 = (_a2 = path.value).getTotalLength) == null ? void 0 : _b2.call(_a2)) != null ? _c : 21.21;
|
|
2677
2850
|
});
|
|
2678
2851
|
return (_ctx, _cache) => {
|
|
2679
|
-
return openBlock(), createBlock(_sfc_main$
|
|
2852
|
+
return openBlock(), createBlock(_sfc_main$6, {
|
|
2680
2853
|
role: "checkbox",
|
|
2681
2854
|
tabindex: "0",
|
|
2682
2855
|
class: "htw-cursor-pointer htw-items-center",
|
|
@@ -2688,13 +2861,13 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
2688
2861
|
]
|
|
2689
2862
|
}, {
|
|
2690
2863
|
default: withCtx(() => [
|
|
2691
|
-
createElementVNode("div", _hoisted_1$
|
|
2864
|
+
createElementVNode("div", _hoisted_1$3, [
|
|
2692
2865
|
createElementVNode("div", {
|
|
2693
2866
|
class: normalizeClass(["htw-border htw-border-solid group-active:htw-bg-gray-500/20 htw-rounded-sm htw-box-border htw-absolute htw-inset-0 htw-transition-border htw-duration-150 htw-ease-out", [
|
|
2694
2867
|
__props.modelValue ? "htw-border-primary-500 htw-border-8" : "htw-border-black/25 dark:htw-border-white/25 htw-delay-150"
|
|
2695
2868
|
]])
|
|
2696
2869
|
}, null, 2),
|
|
2697
|
-
(openBlock(), createElementBlock("svg", _hoisted_2, [
|
|
2870
|
+
(openBlock(), createElementBlock("svg", _hoisted_2$1, [
|
|
2698
2871
|
createElementVNode("path", {
|
|
2699
2872
|
ref_key: "path",
|
|
2700
2873
|
ref: path,
|
|
@@ -2708,7 +2881,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
2708
2881
|
]]),
|
|
2709
2882
|
"stroke-dasharray": dasharray.value,
|
|
2710
2883
|
"stroke-dashoffset": unref(dashoffset)
|
|
2711
|
-
}, null, 10, _hoisted_3)
|
|
2884
|
+
}, null, 10, _hoisted_3$1)
|
|
2712
2885
|
]))
|
|
2713
2886
|
])
|
|
2714
2887
|
]),
|
|
@@ -2717,11 +2890,11 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
2717
2890
|
};
|
|
2718
2891
|
}
|
|
2719
2892
|
}));
|
|
2720
|
-
const _hoisted_1$
|
|
2721
|
-
const __default__$
|
|
2893
|
+
const _hoisted_1$2 = ["value"];
|
|
2894
|
+
const __default__$4 = {
|
|
2722
2895
|
name: "HstText"
|
|
2723
2896
|
};
|
|
2724
|
-
const _sfc_main$
|
|
2897
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$4), {
|
|
2725
2898
|
props: {
|
|
2726
2899
|
title: null,
|
|
2727
2900
|
modelValue: null
|
|
@@ -2732,7 +2905,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
2732
2905
|
setup(__props, { emit }) {
|
|
2733
2906
|
const input = ref();
|
|
2734
2907
|
return (_ctx, _cache) => {
|
|
2735
|
-
return openBlock(), createBlock(_sfc_main$
|
|
2908
|
+
return openBlock(), createBlock(_sfc_main$6, {
|
|
2736
2909
|
title: __props.title,
|
|
2737
2910
|
class: normalizeClass(["htw-cursor-text htw-items-center", _ctx.$attrs.class]),
|
|
2738
2911
|
style: normalizeStyle(_ctx.$attrs.style),
|
|
@@ -2747,18 +2920,18 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
2747
2920
|
value: __props.modelValue,
|
|
2748
2921
|
class: "htw-text-inherit htw-bg-transparent htw-w-full htw-outline-none htw-px-2 htw-py-1 -htw-my-1 htw-border htw-border-solid htw-border-black/25 dark:htw-border-white/25 focus:htw-border-primary-500 dark:focus:htw-border-primary-500 htw-rounded-sm",
|
|
2749
2922
|
onInput: _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event.target.value))
|
|
2750
|
-
}), null, 16, _hoisted_1$
|
|
2923
|
+
}), null, 16, _hoisted_1$2)
|
|
2751
2924
|
]),
|
|
2752
2925
|
_: 1
|
|
2753
2926
|
}, 8, ["title", "class", "style"]);
|
|
2754
2927
|
};
|
|
2755
2928
|
}
|
|
2756
2929
|
}));
|
|
2757
|
-
const __default__$
|
|
2930
|
+
const __default__$3 = {
|
|
2758
2931
|
name: "HstNumber",
|
|
2759
2932
|
inheritAttrs: false
|
|
2760
2933
|
};
|
|
2761
|
-
const _sfc_main$
|
|
2934
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$3), {
|
|
2762
2935
|
props: {
|
|
2763
2936
|
title: null,
|
|
2764
2937
|
modelValue: null
|
|
@@ -2805,7 +2978,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
2805
2978
|
stopDragging();
|
|
2806
2979
|
});
|
|
2807
2980
|
return (_ctx, _cache) => {
|
|
2808
|
-
return openBlock(), createBlock(_sfc_main$
|
|
2981
|
+
return openBlock(), createBlock(_sfc_main$6, {
|
|
2809
2982
|
class: normalizeClass(["htw-cursor-ew-resize htw-items-center", [
|
|
2810
2983
|
_ctx.$attrs.class,
|
|
2811
2984
|
{ "htw-select-none": isDragging.value }
|
|
@@ -2839,12 +3012,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
2839
3012
|
};
|
|
2840
3013
|
}
|
|
2841
3014
|
}));
|
|
2842
|
-
const _hoisted_1 = ["value"];
|
|
2843
|
-
const __default__ = {
|
|
3015
|
+
const _hoisted_1$1 = ["value"];
|
|
3016
|
+
const __default__$2 = {
|
|
2844
3017
|
name: "HstTextarea",
|
|
2845
3018
|
inheritAttrs: false
|
|
2846
3019
|
};
|
|
2847
|
-
const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__), {
|
|
3020
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$2), {
|
|
2848
3021
|
props: {
|
|
2849
3022
|
title: null,
|
|
2850
3023
|
modelValue: null
|
|
@@ -2855,7 +3028,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
2855
3028
|
setup(__props, { emit }) {
|
|
2856
3029
|
const input = ref();
|
|
2857
3030
|
return (_ctx, _cache) => {
|
|
2858
|
-
return openBlock(), createBlock(_sfc_main$
|
|
3031
|
+
return openBlock(), createBlock(_sfc_main$6, {
|
|
2859
3032
|
title: __props.title,
|
|
2860
3033
|
class: normalizeClass(["htw-cursor-text", _ctx.$attrs.class]),
|
|
2861
3034
|
style: normalizeStyle(_ctx.$attrs.style),
|
|
@@ -2869,21 +3042,2077 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
2869
3042
|
value: __props.modelValue,
|
|
2870
3043
|
class: "htw-text-inherit htw-bg-transparent htw-w-full htw-outline-none htw-px-2 htw-py-1 -htw-my-1 htw-border htw-border-solid htw-border-black/25 dark:htw-border-white/25 focus:htw-border-primary-500 dark:focus:htw-border-primary-500 htw-rounded-sm htw-box-border htw-resize-y htw-min-h-[26px]",
|
|
2871
3044
|
onInput: _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event.target.value))
|
|
2872
|
-
}), null, 16, _hoisted_1)
|
|
3045
|
+
}), null, 16, _hoisted_1$1)
|
|
2873
3046
|
]),
|
|
2874
3047
|
_: 1
|
|
2875
3048
|
}, 8, ["title", "class", "style"]);
|
|
2876
3049
|
};
|
|
2877
3050
|
}
|
|
2878
3051
|
}));
|
|
2879
|
-
const
|
|
2880
|
-
const
|
|
2881
|
-
|
|
2882
|
-
|
|
3052
|
+
const matchName = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
3053
|
+
const iconDefaults = Object.freeze({
|
|
3054
|
+
left: 0,
|
|
3055
|
+
top: 0,
|
|
3056
|
+
width: 16,
|
|
3057
|
+
height: 16,
|
|
3058
|
+
rotate: 0,
|
|
3059
|
+
vFlip: false,
|
|
3060
|
+
hFlip: false
|
|
3061
|
+
});
|
|
3062
|
+
function fullIcon(data) {
|
|
3063
|
+
return __spreadValues(__spreadValues({}, iconDefaults), data);
|
|
3064
|
+
}
|
|
3065
|
+
const stringToIcon = (value, validate, allowSimpleName, provider = "") => {
|
|
3066
|
+
const colonSeparated = value.split(":");
|
|
3067
|
+
if (value.slice(0, 1) === "@") {
|
|
3068
|
+
if (colonSeparated.length < 2 || colonSeparated.length > 3) {
|
|
3069
|
+
return null;
|
|
3070
|
+
}
|
|
3071
|
+
provider = colonSeparated.shift().slice(1);
|
|
3072
|
+
}
|
|
3073
|
+
if (colonSeparated.length > 3 || !colonSeparated.length) {
|
|
3074
|
+
return null;
|
|
3075
|
+
}
|
|
3076
|
+
if (colonSeparated.length > 1) {
|
|
3077
|
+
const name2 = colonSeparated.pop();
|
|
3078
|
+
const prefix = colonSeparated.pop();
|
|
3079
|
+
const result = {
|
|
3080
|
+
provider: colonSeparated.length > 0 ? colonSeparated[0] : provider,
|
|
3081
|
+
prefix,
|
|
3082
|
+
name: name2
|
|
3083
|
+
};
|
|
3084
|
+
return validate && !validateIcon(result) ? null : result;
|
|
3085
|
+
}
|
|
3086
|
+
const name = colonSeparated[0];
|
|
3087
|
+
const dashSeparated = name.split("-");
|
|
3088
|
+
if (dashSeparated.length > 1) {
|
|
3089
|
+
const result = {
|
|
3090
|
+
provider,
|
|
3091
|
+
prefix: dashSeparated.shift(),
|
|
3092
|
+
name: dashSeparated.join("-")
|
|
3093
|
+
};
|
|
3094
|
+
return validate && !validateIcon(result) ? null : result;
|
|
3095
|
+
}
|
|
3096
|
+
if (allowSimpleName && provider === "") {
|
|
3097
|
+
const result = {
|
|
3098
|
+
provider,
|
|
3099
|
+
prefix: "",
|
|
3100
|
+
name
|
|
3101
|
+
};
|
|
3102
|
+
return validate && !validateIcon(result, allowSimpleName) ? null : result;
|
|
3103
|
+
}
|
|
3104
|
+
return null;
|
|
3105
|
+
};
|
|
3106
|
+
const validateIcon = (icon, allowSimpleName) => {
|
|
3107
|
+
if (!icon) {
|
|
3108
|
+
return false;
|
|
3109
|
+
}
|
|
3110
|
+
return !!((icon.provider === "" || icon.provider.match(matchName)) && (allowSimpleName && icon.prefix === "" || icon.prefix.match(matchName)) && icon.name.match(matchName));
|
|
3111
|
+
};
|
|
3112
|
+
function mergeIconData(icon, alias) {
|
|
3113
|
+
const result = __spreadValues({}, icon);
|
|
3114
|
+
for (const key in iconDefaults) {
|
|
3115
|
+
const prop = key;
|
|
3116
|
+
if (alias[prop] !== void 0) {
|
|
3117
|
+
const value = alias[prop];
|
|
3118
|
+
if (result[prop] === void 0) {
|
|
3119
|
+
result[prop] = value;
|
|
3120
|
+
continue;
|
|
3121
|
+
}
|
|
3122
|
+
switch (prop) {
|
|
3123
|
+
case "rotate":
|
|
3124
|
+
result[prop] = (result[prop] + value) % 4;
|
|
3125
|
+
break;
|
|
3126
|
+
case "hFlip":
|
|
3127
|
+
case "vFlip":
|
|
3128
|
+
result[prop] = value !== result[prop];
|
|
3129
|
+
break;
|
|
3130
|
+
default:
|
|
3131
|
+
result[prop] = value;
|
|
3132
|
+
}
|
|
3133
|
+
}
|
|
3134
|
+
}
|
|
3135
|
+
return result;
|
|
3136
|
+
}
|
|
3137
|
+
function getIconData$1(data, name, full = false) {
|
|
3138
|
+
function getIcon(name2, iteration) {
|
|
3139
|
+
if (data.icons[name2] !== void 0) {
|
|
3140
|
+
return Object.assign({}, data.icons[name2]);
|
|
3141
|
+
}
|
|
3142
|
+
if (iteration > 5) {
|
|
3143
|
+
return null;
|
|
3144
|
+
}
|
|
3145
|
+
const aliases = data.aliases;
|
|
3146
|
+
if (aliases && aliases[name2] !== void 0) {
|
|
3147
|
+
const item = aliases[name2];
|
|
3148
|
+
const result2 = getIcon(item.parent, iteration + 1);
|
|
3149
|
+
if (result2) {
|
|
3150
|
+
return mergeIconData(result2, item);
|
|
3151
|
+
}
|
|
3152
|
+
return result2;
|
|
3153
|
+
}
|
|
3154
|
+
const chars = data.chars;
|
|
3155
|
+
if (!iteration && chars && chars[name2] !== void 0) {
|
|
3156
|
+
return getIcon(chars[name2], iteration + 1);
|
|
3157
|
+
}
|
|
3158
|
+
return null;
|
|
3159
|
+
}
|
|
3160
|
+
const result = getIcon(name, 0);
|
|
3161
|
+
if (result) {
|
|
3162
|
+
for (const key in iconDefaults) {
|
|
3163
|
+
if (result[key] === void 0 && data[key] !== void 0) {
|
|
3164
|
+
result[key] = data[key];
|
|
3165
|
+
}
|
|
3166
|
+
}
|
|
3167
|
+
}
|
|
3168
|
+
return result && full ? fullIcon(result) : result;
|
|
3169
|
+
}
|
|
3170
|
+
function isVariation(item) {
|
|
3171
|
+
for (const key in iconDefaults) {
|
|
3172
|
+
if (item[key] !== void 0) {
|
|
3173
|
+
return true;
|
|
3174
|
+
}
|
|
3175
|
+
}
|
|
3176
|
+
return false;
|
|
3177
|
+
}
|
|
3178
|
+
function parseIconSet(data, callback, options) {
|
|
3179
|
+
options = options || {};
|
|
3180
|
+
const names = [];
|
|
3181
|
+
if (typeof data !== "object" || typeof data.icons !== "object") {
|
|
3182
|
+
return names;
|
|
3183
|
+
}
|
|
3184
|
+
if (data.not_found instanceof Array) {
|
|
3185
|
+
data.not_found.forEach((name) => {
|
|
3186
|
+
callback(name, null);
|
|
3187
|
+
names.push(name);
|
|
3188
|
+
});
|
|
3189
|
+
}
|
|
3190
|
+
const icons = data.icons;
|
|
3191
|
+
Object.keys(icons).forEach((name) => {
|
|
3192
|
+
const iconData = getIconData$1(data, name, true);
|
|
3193
|
+
if (iconData) {
|
|
3194
|
+
callback(name, iconData);
|
|
3195
|
+
names.push(name);
|
|
3196
|
+
}
|
|
3197
|
+
});
|
|
3198
|
+
const parseAliases = options.aliases || "all";
|
|
3199
|
+
if (parseAliases !== "none" && typeof data.aliases === "object") {
|
|
3200
|
+
const aliases = data.aliases;
|
|
3201
|
+
Object.keys(aliases).forEach((name) => {
|
|
3202
|
+
if (parseAliases === "variations" && isVariation(aliases[name])) {
|
|
3203
|
+
return;
|
|
3204
|
+
}
|
|
3205
|
+
const iconData = getIconData$1(data, name, true);
|
|
3206
|
+
if (iconData) {
|
|
3207
|
+
callback(name, iconData);
|
|
3208
|
+
names.push(name);
|
|
3209
|
+
}
|
|
3210
|
+
});
|
|
3211
|
+
}
|
|
3212
|
+
return names;
|
|
3213
|
+
}
|
|
3214
|
+
const optionalProperties = {
|
|
3215
|
+
provider: "string",
|
|
3216
|
+
aliases: "object",
|
|
3217
|
+
not_found: "object"
|
|
3218
|
+
};
|
|
3219
|
+
for (const prop in iconDefaults) {
|
|
3220
|
+
optionalProperties[prop] = typeof iconDefaults[prop];
|
|
3221
|
+
}
|
|
3222
|
+
function quicklyValidateIconSet(obj) {
|
|
3223
|
+
if (typeof obj !== "object" || obj === null) {
|
|
3224
|
+
return null;
|
|
3225
|
+
}
|
|
3226
|
+
const data = obj;
|
|
3227
|
+
if (typeof data.prefix !== "string" || !obj.icons || typeof obj.icons !== "object") {
|
|
3228
|
+
return null;
|
|
3229
|
+
}
|
|
3230
|
+
for (const prop in optionalProperties) {
|
|
3231
|
+
if (obj[prop] !== void 0 && typeof obj[prop] !== optionalProperties[prop]) {
|
|
3232
|
+
return null;
|
|
3233
|
+
}
|
|
3234
|
+
}
|
|
3235
|
+
const icons = data.icons;
|
|
3236
|
+
for (const name in icons) {
|
|
3237
|
+
const icon = icons[name];
|
|
3238
|
+
if (!name.match(matchName) || typeof icon.body !== "string") {
|
|
3239
|
+
return null;
|
|
3240
|
+
}
|
|
3241
|
+
for (const prop in iconDefaults) {
|
|
3242
|
+
if (icon[prop] !== void 0 && typeof icon[prop] !== typeof iconDefaults[prop]) {
|
|
3243
|
+
return null;
|
|
3244
|
+
}
|
|
3245
|
+
}
|
|
3246
|
+
}
|
|
3247
|
+
const aliases = data.aliases;
|
|
3248
|
+
if (aliases) {
|
|
3249
|
+
for (const name in aliases) {
|
|
3250
|
+
const icon = aliases[name];
|
|
3251
|
+
const parent = icon.parent;
|
|
3252
|
+
if (!name.match(matchName) || typeof parent !== "string" || !icons[parent] && !aliases[parent]) {
|
|
3253
|
+
return null;
|
|
3254
|
+
}
|
|
3255
|
+
for (const prop in iconDefaults) {
|
|
3256
|
+
if (icon[prop] !== void 0 && typeof icon[prop] !== typeof iconDefaults[prop]) {
|
|
3257
|
+
return null;
|
|
3258
|
+
}
|
|
3259
|
+
}
|
|
3260
|
+
}
|
|
3261
|
+
}
|
|
3262
|
+
return data;
|
|
3263
|
+
}
|
|
3264
|
+
const storageVersion = 1;
|
|
3265
|
+
let storage$1 = /* @__PURE__ */ Object.create(null);
|
|
3266
|
+
try {
|
|
3267
|
+
const w = window || self;
|
|
3268
|
+
if (w && w._iconifyStorage.version === storageVersion) {
|
|
3269
|
+
storage$1 = w._iconifyStorage.storage;
|
|
3270
|
+
}
|
|
3271
|
+
} catch (err) {
|
|
3272
|
+
}
|
|
3273
|
+
function newStorage(provider, prefix) {
|
|
3274
|
+
return {
|
|
3275
|
+
provider,
|
|
3276
|
+
prefix,
|
|
3277
|
+
icons: /* @__PURE__ */ Object.create(null),
|
|
3278
|
+
missing: /* @__PURE__ */ Object.create(null)
|
|
3279
|
+
};
|
|
3280
|
+
}
|
|
3281
|
+
function getStorage(provider, prefix) {
|
|
3282
|
+
if (storage$1[provider] === void 0) {
|
|
3283
|
+
storage$1[provider] = /* @__PURE__ */ Object.create(null);
|
|
3284
|
+
}
|
|
3285
|
+
const providerStorage = storage$1[provider];
|
|
3286
|
+
if (providerStorage[prefix] === void 0) {
|
|
3287
|
+
providerStorage[prefix] = newStorage(provider, prefix);
|
|
3288
|
+
}
|
|
3289
|
+
return providerStorage[prefix];
|
|
3290
|
+
}
|
|
3291
|
+
function addIconSet(storage2, data) {
|
|
3292
|
+
if (!quicklyValidateIconSet(data)) {
|
|
3293
|
+
return [];
|
|
3294
|
+
}
|
|
3295
|
+
const t = Date.now();
|
|
3296
|
+
return parseIconSet(data, (name, icon) => {
|
|
3297
|
+
if (icon) {
|
|
3298
|
+
storage2.icons[name] = icon;
|
|
3299
|
+
} else {
|
|
3300
|
+
storage2.missing[name] = t;
|
|
3301
|
+
}
|
|
3302
|
+
});
|
|
3303
|
+
}
|
|
3304
|
+
function addIconToStorage(storage2, name, icon) {
|
|
3305
|
+
try {
|
|
3306
|
+
if (typeof icon.body === "string") {
|
|
3307
|
+
storage2.icons[name] = Object.freeze(fullIcon(icon));
|
|
3308
|
+
return true;
|
|
3309
|
+
}
|
|
3310
|
+
} catch (err) {
|
|
3311
|
+
}
|
|
3312
|
+
return false;
|
|
3313
|
+
}
|
|
3314
|
+
function getIconFromStorage(storage2, name) {
|
|
3315
|
+
const value = storage2.icons[name];
|
|
3316
|
+
return value === void 0 ? null : value;
|
|
3317
|
+
}
|
|
3318
|
+
let simpleNames = false;
|
|
3319
|
+
function allowSimpleNames(allow) {
|
|
3320
|
+
if (typeof allow === "boolean") {
|
|
3321
|
+
simpleNames = allow;
|
|
3322
|
+
}
|
|
3323
|
+
return simpleNames;
|
|
3324
|
+
}
|
|
3325
|
+
function getIconData(name) {
|
|
3326
|
+
const icon = typeof name === "string" ? stringToIcon(name, true, simpleNames) : name;
|
|
3327
|
+
return icon ? getIconFromStorage(getStorage(icon.provider, icon.prefix), icon.name) : null;
|
|
3328
|
+
}
|
|
3329
|
+
function addIcon(name, data) {
|
|
3330
|
+
const icon = stringToIcon(name, true, simpleNames);
|
|
3331
|
+
if (!icon) {
|
|
3332
|
+
return false;
|
|
3333
|
+
}
|
|
3334
|
+
const storage2 = getStorage(icon.provider, icon.prefix);
|
|
3335
|
+
return addIconToStorage(storage2, icon.name, data);
|
|
3336
|
+
}
|
|
3337
|
+
function addCollection(data, provider) {
|
|
3338
|
+
if (typeof data !== "object") {
|
|
3339
|
+
return false;
|
|
3340
|
+
}
|
|
3341
|
+
if (typeof provider !== "string") {
|
|
3342
|
+
provider = typeof data.provider === "string" ? data.provider : "";
|
|
3343
|
+
}
|
|
3344
|
+
if (simpleNames && provider === "" && (typeof data.prefix !== "string" || data.prefix === "")) {
|
|
3345
|
+
let added = false;
|
|
3346
|
+
if (quicklyValidateIconSet(data)) {
|
|
3347
|
+
data.prefix = "";
|
|
3348
|
+
parseIconSet(data, (name, icon) => {
|
|
3349
|
+
if (icon && addIcon(name, icon)) {
|
|
3350
|
+
added = true;
|
|
3351
|
+
}
|
|
3352
|
+
});
|
|
3353
|
+
}
|
|
3354
|
+
return added;
|
|
3355
|
+
}
|
|
3356
|
+
if (typeof data.prefix !== "string" || !validateIcon({
|
|
3357
|
+
provider,
|
|
3358
|
+
prefix: data.prefix,
|
|
3359
|
+
name: "a"
|
|
3360
|
+
})) {
|
|
3361
|
+
return false;
|
|
3362
|
+
}
|
|
3363
|
+
const storage2 = getStorage(provider, data.prefix);
|
|
3364
|
+
return !!addIconSet(storage2, data);
|
|
3365
|
+
}
|
|
3366
|
+
const defaults = Object.freeze({
|
|
3367
|
+
inline: false,
|
|
3368
|
+
width: null,
|
|
3369
|
+
height: null,
|
|
3370
|
+
hAlign: "center",
|
|
3371
|
+
vAlign: "middle",
|
|
3372
|
+
slice: false,
|
|
3373
|
+
hFlip: false,
|
|
3374
|
+
vFlip: false,
|
|
3375
|
+
rotate: 0
|
|
3376
|
+
});
|
|
3377
|
+
function mergeCustomisations(defaults2, item) {
|
|
3378
|
+
const result = {};
|
|
3379
|
+
for (const key in defaults2) {
|
|
3380
|
+
const attr = key;
|
|
3381
|
+
result[attr] = defaults2[attr];
|
|
3382
|
+
if (item[attr] === void 0) {
|
|
3383
|
+
continue;
|
|
3384
|
+
}
|
|
3385
|
+
const value = item[attr];
|
|
3386
|
+
switch (attr) {
|
|
3387
|
+
case "inline":
|
|
3388
|
+
case "slice":
|
|
3389
|
+
if (typeof value === "boolean") {
|
|
3390
|
+
result[attr] = value;
|
|
3391
|
+
}
|
|
3392
|
+
break;
|
|
3393
|
+
case "hFlip":
|
|
3394
|
+
case "vFlip":
|
|
3395
|
+
if (value === true) {
|
|
3396
|
+
result[attr] = !result[attr];
|
|
3397
|
+
}
|
|
3398
|
+
break;
|
|
3399
|
+
case "hAlign":
|
|
3400
|
+
case "vAlign":
|
|
3401
|
+
if (typeof value === "string" && value !== "") {
|
|
3402
|
+
result[attr] = value;
|
|
3403
|
+
}
|
|
3404
|
+
break;
|
|
3405
|
+
case "width":
|
|
3406
|
+
case "height":
|
|
3407
|
+
if (typeof value === "string" && value !== "" || typeof value === "number" && value || value === null) {
|
|
3408
|
+
result[attr] = value;
|
|
3409
|
+
}
|
|
3410
|
+
break;
|
|
3411
|
+
case "rotate":
|
|
3412
|
+
if (typeof value === "number") {
|
|
3413
|
+
result[attr] += value;
|
|
3414
|
+
}
|
|
3415
|
+
break;
|
|
3416
|
+
}
|
|
3417
|
+
}
|
|
3418
|
+
return result;
|
|
3419
|
+
}
|
|
3420
|
+
const unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g;
|
|
3421
|
+
const unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
|
|
3422
|
+
function calculateSize(size2, ratio, precision) {
|
|
3423
|
+
if (ratio === 1) {
|
|
3424
|
+
return size2;
|
|
3425
|
+
}
|
|
3426
|
+
precision = precision === void 0 ? 100 : precision;
|
|
3427
|
+
if (typeof size2 === "number") {
|
|
3428
|
+
return Math.ceil(size2 * ratio * precision) / precision;
|
|
3429
|
+
}
|
|
3430
|
+
if (typeof size2 !== "string") {
|
|
3431
|
+
return size2;
|
|
3432
|
+
}
|
|
3433
|
+
const oldParts = size2.split(unitsSplit);
|
|
3434
|
+
if (oldParts === null || !oldParts.length) {
|
|
3435
|
+
return size2;
|
|
3436
|
+
}
|
|
3437
|
+
const newParts = [];
|
|
3438
|
+
let code = oldParts.shift();
|
|
3439
|
+
let isNumber = unitsTest.test(code);
|
|
3440
|
+
while (true) {
|
|
3441
|
+
if (isNumber) {
|
|
3442
|
+
const num = parseFloat(code);
|
|
3443
|
+
if (isNaN(num)) {
|
|
3444
|
+
newParts.push(code);
|
|
3445
|
+
} else {
|
|
3446
|
+
newParts.push(Math.ceil(num * ratio * precision) / precision);
|
|
3447
|
+
}
|
|
3448
|
+
} else {
|
|
3449
|
+
newParts.push(code);
|
|
3450
|
+
}
|
|
3451
|
+
code = oldParts.shift();
|
|
3452
|
+
if (code === void 0) {
|
|
3453
|
+
return newParts.join("");
|
|
3454
|
+
}
|
|
3455
|
+
isNumber = !isNumber;
|
|
3456
|
+
}
|
|
3457
|
+
}
|
|
3458
|
+
function preserveAspectRatio(props) {
|
|
3459
|
+
let result = "";
|
|
3460
|
+
switch (props.hAlign) {
|
|
3461
|
+
case "left":
|
|
3462
|
+
result += "xMin";
|
|
3463
|
+
break;
|
|
3464
|
+
case "right":
|
|
3465
|
+
result += "xMax";
|
|
3466
|
+
break;
|
|
3467
|
+
default:
|
|
3468
|
+
result += "xMid";
|
|
3469
|
+
}
|
|
3470
|
+
switch (props.vAlign) {
|
|
3471
|
+
case "top":
|
|
3472
|
+
result += "YMin";
|
|
3473
|
+
break;
|
|
3474
|
+
case "bottom":
|
|
3475
|
+
result += "YMax";
|
|
3476
|
+
break;
|
|
3477
|
+
default:
|
|
3478
|
+
result += "YMid";
|
|
3479
|
+
}
|
|
3480
|
+
result += props.slice ? " slice" : " meet";
|
|
3481
|
+
return result;
|
|
3482
|
+
}
|
|
3483
|
+
function iconToSVG(icon, customisations) {
|
|
3484
|
+
const box = {
|
|
3485
|
+
left: icon.left,
|
|
3486
|
+
top: icon.top,
|
|
3487
|
+
width: icon.width,
|
|
3488
|
+
height: icon.height
|
|
3489
|
+
};
|
|
3490
|
+
let body = icon.body;
|
|
3491
|
+
[icon, customisations].forEach((props) => {
|
|
3492
|
+
const transformations = [];
|
|
3493
|
+
const hFlip = props.hFlip;
|
|
3494
|
+
const vFlip = props.vFlip;
|
|
3495
|
+
let rotation = props.rotate;
|
|
3496
|
+
if (hFlip) {
|
|
3497
|
+
if (vFlip) {
|
|
3498
|
+
rotation += 2;
|
|
3499
|
+
} else {
|
|
3500
|
+
transformations.push("translate(" + (box.width + box.left).toString() + " " + (0 - box.top).toString() + ")");
|
|
3501
|
+
transformations.push("scale(-1 1)");
|
|
3502
|
+
box.top = box.left = 0;
|
|
3503
|
+
}
|
|
3504
|
+
} else if (vFlip) {
|
|
3505
|
+
transformations.push("translate(" + (0 - box.left).toString() + " " + (box.height + box.top).toString() + ")");
|
|
3506
|
+
transformations.push("scale(1 -1)");
|
|
3507
|
+
box.top = box.left = 0;
|
|
3508
|
+
}
|
|
3509
|
+
let tempValue;
|
|
3510
|
+
if (rotation < 0) {
|
|
3511
|
+
rotation -= Math.floor(rotation / 4) * 4;
|
|
3512
|
+
}
|
|
3513
|
+
rotation = rotation % 4;
|
|
3514
|
+
switch (rotation) {
|
|
3515
|
+
case 1:
|
|
3516
|
+
tempValue = box.height / 2 + box.top;
|
|
3517
|
+
transformations.unshift("rotate(90 " + tempValue.toString() + " " + tempValue.toString() + ")");
|
|
3518
|
+
break;
|
|
3519
|
+
case 2:
|
|
3520
|
+
transformations.unshift("rotate(180 " + (box.width / 2 + box.left).toString() + " " + (box.height / 2 + box.top).toString() + ")");
|
|
3521
|
+
break;
|
|
3522
|
+
case 3:
|
|
3523
|
+
tempValue = box.width / 2 + box.left;
|
|
3524
|
+
transformations.unshift("rotate(-90 " + tempValue.toString() + " " + tempValue.toString() + ")");
|
|
3525
|
+
break;
|
|
3526
|
+
}
|
|
3527
|
+
if (rotation % 2 === 1) {
|
|
3528
|
+
if (box.left !== 0 || box.top !== 0) {
|
|
3529
|
+
tempValue = box.left;
|
|
3530
|
+
box.left = box.top;
|
|
3531
|
+
box.top = tempValue;
|
|
3532
|
+
}
|
|
3533
|
+
if (box.width !== box.height) {
|
|
3534
|
+
tempValue = box.width;
|
|
3535
|
+
box.width = box.height;
|
|
3536
|
+
box.height = tempValue;
|
|
3537
|
+
}
|
|
3538
|
+
}
|
|
3539
|
+
if (transformations.length) {
|
|
3540
|
+
body = '<g transform="' + transformations.join(" ") + '">' + body + "</g>";
|
|
3541
|
+
}
|
|
3542
|
+
});
|
|
3543
|
+
let width, height;
|
|
3544
|
+
if (customisations.width === null && customisations.height === null) {
|
|
3545
|
+
height = "1em";
|
|
3546
|
+
width = calculateSize(height, box.width / box.height);
|
|
3547
|
+
} else if (customisations.width !== null && customisations.height !== null) {
|
|
3548
|
+
width = customisations.width;
|
|
3549
|
+
height = customisations.height;
|
|
3550
|
+
} else if (customisations.height !== null) {
|
|
3551
|
+
height = customisations.height;
|
|
3552
|
+
width = calculateSize(height, box.width / box.height);
|
|
3553
|
+
} else {
|
|
3554
|
+
width = customisations.width;
|
|
3555
|
+
height = calculateSize(width, box.height / box.width);
|
|
3556
|
+
}
|
|
3557
|
+
if (width === "auto") {
|
|
3558
|
+
width = box.width;
|
|
3559
|
+
}
|
|
3560
|
+
if (height === "auto") {
|
|
3561
|
+
height = box.height;
|
|
3562
|
+
}
|
|
3563
|
+
width = typeof width === "string" ? width : width.toString() + "";
|
|
3564
|
+
height = typeof height === "string" ? height : height.toString() + "";
|
|
3565
|
+
const result = {
|
|
3566
|
+
attributes: {
|
|
3567
|
+
width,
|
|
3568
|
+
height,
|
|
3569
|
+
preserveAspectRatio: preserveAspectRatio(customisations),
|
|
3570
|
+
viewBox: box.left.toString() + " " + box.top.toString() + " " + box.width.toString() + " " + box.height.toString()
|
|
3571
|
+
},
|
|
3572
|
+
body
|
|
3573
|
+
};
|
|
3574
|
+
if (customisations.inline) {
|
|
3575
|
+
result.inline = true;
|
|
3576
|
+
}
|
|
3577
|
+
return result;
|
|
3578
|
+
}
|
|
3579
|
+
const regex = /\sid="(\S+)"/g;
|
|
3580
|
+
const randomPrefix = "IconifyId" + Date.now().toString(16) + (Math.random() * 16777216 | 0).toString(16);
|
|
3581
|
+
let counter = 0;
|
|
3582
|
+
function replaceIDs(body, prefix = randomPrefix) {
|
|
3583
|
+
const ids = [];
|
|
3584
|
+
let match;
|
|
3585
|
+
while (match = regex.exec(body)) {
|
|
3586
|
+
ids.push(match[1]);
|
|
3587
|
+
}
|
|
3588
|
+
if (!ids.length) {
|
|
3589
|
+
return body;
|
|
3590
|
+
}
|
|
3591
|
+
ids.forEach((id) => {
|
|
3592
|
+
const newID = typeof prefix === "function" ? prefix(id) : prefix + (counter++).toString();
|
|
3593
|
+
const escapedID = id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3594
|
+
body = body.replace(new RegExp('([#;"])(' + escapedID + ')([")]|\\.[a-z])', "g"), "$1" + newID + "$3");
|
|
3595
|
+
});
|
|
3596
|
+
return body;
|
|
3597
|
+
}
|
|
3598
|
+
const storage = /* @__PURE__ */ Object.create(null);
|
|
3599
|
+
function setAPIModule(provider, item) {
|
|
3600
|
+
storage[provider] = item;
|
|
3601
|
+
}
|
|
3602
|
+
function getAPIModule(provider) {
|
|
3603
|
+
return storage[provider] || storage[""];
|
|
3604
|
+
}
|
|
3605
|
+
function createAPIConfig(source) {
|
|
3606
|
+
let resources;
|
|
3607
|
+
if (typeof source.resources === "string") {
|
|
3608
|
+
resources = [source.resources];
|
|
3609
|
+
} else {
|
|
3610
|
+
resources = source.resources;
|
|
3611
|
+
if (!(resources instanceof Array) || !resources.length) {
|
|
3612
|
+
return null;
|
|
3613
|
+
}
|
|
3614
|
+
}
|
|
3615
|
+
const result = {
|
|
3616
|
+
resources,
|
|
3617
|
+
path: source.path === void 0 ? "/" : source.path,
|
|
3618
|
+
maxURL: source.maxURL ? source.maxURL : 500,
|
|
3619
|
+
rotate: source.rotate ? source.rotate : 750,
|
|
3620
|
+
timeout: source.timeout ? source.timeout : 5e3,
|
|
3621
|
+
random: source.random === true,
|
|
3622
|
+
index: source.index ? source.index : 0,
|
|
3623
|
+
dataAfterTimeout: source.dataAfterTimeout !== false
|
|
3624
|
+
};
|
|
3625
|
+
return result;
|
|
3626
|
+
}
|
|
3627
|
+
const configStorage = /* @__PURE__ */ Object.create(null);
|
|
3628
|
+
const fallBackAPISources = [
|
|
3629
|
+
"https://api.simplesvg.com",
|
|
3630
|
+
"https://api.unisvg.com"
|
|
3631
|
+
];
|
|
3632
|
+
const fallBackAPI = [];
|
|
3633
|
+
while (fallBackAPISources.length > 0) {
|
|
3634
|
+
if (fallBackAPISources.length === 1) {
|
|
3635
|
+
fallBackAPI.push(fallBackAPISources.shift());
|
|
3636
|
+
} else {
|
|
3637
|
+
if (Math.random() > 0.5) {
|
|
3638
|
+
fallBackAPI.push(fallBackAPISources.shift());
|
|
3639
|
+
} else {
|
|
3640
|
+
fallBackAPI.push(fallBackAPISources.pop());
|
|
3641
|
+
}
|
|
3642
|
+
}
|
|
3643
|
+
}
|
|
3644
|
+
configStorage[""] = createAPIConfig({
|
|
3645
|
+
resources: ["https://api.iconify.design"].concat(fallBackAPI)
|
|
3646
|
+
});
|
|
3647
|
+
function addAPIProvider(provider, customConfig) {
|
|
3648
|
+
const config2 = createAPIConfig(customConfig);
|
|
3649
|
+
if (config2 === null) {
|
|
3650
|
+
return false;
|
|
3651
|
+
}
|
|
3652
|
+
configStorage[provider] = config2;
|
|
3653
|
+
return true;
|
|
3654
|
+
}
|
|
3655
|
+
function getAPIConfig(provider) {
|
|
3656
|
+
return configStorage[provider];
|
|
3657
|
+
}
|
|
3658
|
+
const mergeParams = (base, params) => {
|
|
3659
|
+
let result = base, hasParams = result.indexOf("?") !== -1;
|
|
3660
|
+
function paramToString(value) {
|
|
3661
|
+
switch (typeof value) {
|
|
3662
|
+
case "boolean":
|
|
3663
|
+
return value ? "true" : "false";
|
|
3664
|
+
case "number":
|
|
3665
|
+
return encodeURIComponent(value);
|
|
3666
|
+
case "string":
|
|
3667
|
+
return encodeURIComponent(value);
|
|
3668
|
+
default:
|
|
3669
|
+
throw new Error("Invalid parameter");
|
|
3670
|
+
}
|
|
3671
|
+
}
|
|
3672
|
+
Object.keys(params).forEach((key) => {
|
|
3673
|
+
let value;
|
|
3674
|
+
try {
|
|
3675
|
+
value = paramToString(params[key]);
|
|
3676
|
+
} catch (err) {
|
|
3677
|
+
return;
|
|
3678
|
+
}
|
|
3679
|
+
result += (hasParams ? "&" : "?") + encodeURIComponent(key) + "=" + value;
|
|
3680
|
+
hasParams = true;
|
|
3681
|
+
});
|
|
3682
|
+
return result;
|
|
3683
|
+
};
|
|
3684
|
+
const maxLengthCache = {};
|
|
3685
|
+
const pathCache = {};
|
|
3686
|
+
const detectFetch = () => {
|
|
3687
|
+
let callback;
|
|
3688
|
+
try {
|
|
3689
|
+
callback = fetch;
|
|
3690
|
+
if (typeof callback === "function") {
|
|
3691
|
+
return callback;
|
|
3692
|
+
}
|
|
3693
|
+
} catch (err) {
|
|
3694
|
+
}
|
|
3695
|
+
return null;
|
|
3696
|
+
};
|
|
3697
|
+
let fetchModule = detectFetch();
|
|
3698
|
+
function calculateMaxLength(provider, prefix) {
|
|
3699
|
+
const config2 = getAPIConfig(provider);
|
|
3700
|
+
if (!config2) {
|
|
3701
|
+
return 0;
|
|
3702
|
+
}
|
|
3703
|
+
let result;
|
|
3704
|
+
if (!config2.maxURL) {
|
|
3705
|
+
result = 0;
|
|
3706
|
+
} else {
|
|
3707
|
+
let maxHostLength = 0;
|
|
3708
|
+
config2.resources.forEach((item) => {
|
|
3709
|
+
const host = item;
|
|
3710
|
+
maxHostLength = Math.max(maxHostLength, host.length);
|
|
3711
|
+
});
|
|
3712
|
+
const url = mergeParams(prefix + ".json", {
|
|
3713
|
+
icons: ""
|
|
3714
|
+
});
|
|
3715
|
+
result = config2.maxURL - maxHostLength - config2.path.length - url.length;
|
|
3716
|
+
}
|
|
3717
|
+
const cacheKey = provider + ":" + prefix;
|
|
3718
|
+
pathCache[provider] = config2.path;
|
|
3719
|
+
maxLengthCache[cacheKey] = result;
|
|
3720
|
+
return result;
|
|
3721
|
+
}
|
|
3722
|
+
function shouldAbort(status) {
|
|
3723
|
+
return status === 404;
|
|
3724
|
+
}
|
|
3725
|
+
const prepare = (provider, prefix, icons) => {
|
|
3726
|
+
const results = [];
|
|
3727
|
+
let maxLength = maxLengthCache[prefix];
|
|
3728
|
+
if (maxLength === void 0) {
|
|
3729
|
+
maxLength = calculateMaxLength(provider, prefix);
|
|
3730
|
+
}
|
|
3731
|
+
const type = "icons";
|
|
3732
|
+
let item = {
|
|
3733
|
+
type,
|
|
3734
|
+
provider,
|
|
3735
|
+
prefix,
|
|
3736
|
+
icons: []
|
|
3737
|
+
};
|
|
3738
|
+
let length = 0;
|
|
3739
|
+
icons.forEach((name, index) => {
|
|
3740
|
+
length += name.length + 1;
|
|
3741
|
+
if (length >= maxLength && index > 0) {
|
|
3742
|
+
results.push(item);
|
|
3743
|
+
item = {
|
|
3744
|
+
type,
|
|
3745
|
+
provider,
|
|
3746
|
+
prefix,
|
|
3747
|
+
icons: []
|
|
3748
|
+
};
|
|
3749
|
+
length = name.length;
|
|
3750
|
+
}
|
|
3751
|
+
item.icons.push(name);
|
|
3752
|
+
});
|
|
3753
|
+
results.push(item);
|
|
3754
|
+
return results;
|
|
3755
|
+
};
|
|
3756
|
+
function getPath(provider) {
|
|
3757
|
+
if (typeof provider === "string") {
|
|
3758
|
+
if (pathCache[provider] === void 0) {
|
|
3759
|
+
const config2 = getAPIConfig(provider);
|
|
3760
|
+
if (!config2) {
|
|
3761
|
+
return "/";
|
|
3762
|
+
}
|
|
3763
|
+
pathCache[provider] = config2.path;
|
|
3764
|
+
}
|
|
3765
|
+
return pathCache[provider];
|
|
3766
|
+
}
|
|
3767
|
+
return "/";
|
|
3768
|
+
}
|
|
3769
|
+
const send = (host, params, callback) => {
|
|
3770
|
+
if (!fetchModule) {
|
|
3771
|
+
callback("abort", 424);
|
|
3772
|
+
return;
|
|
3773
|
+
}
|
|
3774
|
+
let path = getPath(params.provider);
|
|
3775
|
+
switch (params.type) {
|
|
3776
|
+
case "icons": {
|
|
3777
|
+
const prefix = params.prefix;
|
|
3778
|
+
const icons = params.icons;
|
|
3779
|
+
const iconsList = icons.join(",");
|
|
3780
|
+
path += mergeParams(prefix + ".json", {
|
|
3781
|
+
icons: iconsList
|
|
3782
|
+
});
|
|
3783
|
+
break;
|
|
3784
|
+
}
|
|
3785
|
+
case "custom": {
|
|
3786
|
+
const uri = params.uri;
|
|
3787
|
+
path += uri.slice(0, 1) === "/" ? uri.slice(1) : uri;
|
|
3788
|
+
break;
|
|
3789
|
+
}
|
|
3790
|
+
default:
|
|
3791
|
+
callback("abort", 400);
|
|
3792
|
+
return;
|
|
3793
|
+
}
|
|
3794
|
+
let defaultError = 503;
|
|
3795
|
+
fetchModule(host + path).then((response) => {
|
|
3796
|
+
const status = response.status;
|
|
3797
|
+
if (status !== 200) {
|
|
3798
|
+
setTimeout(() => {
|
|
3799
|
+
callback(shouldAbort(status) ? "abort" : "next", status);
|
|
3800
|
+
});
|
|
3801
|
+
return;
|
|
3802
|
+
}
|
|
3803
|
+
defaultError = 501;
|
|
3804
|
+
return response.json();
|
|
3805
|
+
}).then((data) => {
|
|
3806
|
+
if (typeof data !== "object" || data === null) {
|
|
3807
|
+
setTimeout(() => {
|
|
3808
|
+
callback("next", defaultError);
|
|
3809
|
+
});
|
|
3810
|
+
return;
|
|
3811
|
+
}
|
|
3812
|
+
setTimeout(() => {
|
|
3813
|
+
callback("success", data);
|
|
3814
|
+
});
|
|
3815
|
+
}).catch(() => {
|
|
3816
|
+
callback("next", defaultError);
|
|
3817
|
+
});
|
|
3818
|
+
};
|
|
3819
|
+
const fetchAPIModule = {
|
|
3820
|
+
prepare,
|
|
3821
|
+
send
|
|
3822
|
+
};
|
|
3823
|
+
function sortIcons(icons) {
|
|
3824
|
+
const result = {
|
|
3825
|
+
loaded: [],
|
|
3826
|
+
missing: [],
|
|
3827
|
+
pending: []
|
|
3828
|
+
};
|
|
3829
|
+
const storage2 = /* @__PURE__ */ Object.create(null);
|
|
3830
|
+
icons.sort((a, b) => {
|
|
3831
|
+
if (a.provider !== b.provider) {
|
|
3832
|
+
return a.provider.localeCompare(b.provider);
|
|
3833
|
+
}
|
|
3834
|
+
if (a.prefix !== b.prefix) {
|
|
3835
|
+
return a.prefix.localeCompare(b.prefix);
|
|
3836
|
+
}
|
|
3837
|
+
return a.name.localeCompare(b.name);
|
|
3838
|
+
});
|
|
3839
|
+
let lastIcon = {
|
|
3840
|
+
provider: "",
|
|
3841
|
+
prefix: "",
|
|
3842
|
+
name: ""
|
|
3843
|
+
};
|
|
3844
|
+
icons.forEach((icon) => {
|
|
3845
|
+
if (lastIcon.name === icon.name && lastIcon.prefix === icon.prefix && lastIcon.provider === icon.provider) {
|
|
3846
|
+
return;
|
|
3847
|
+
}
|
|
3848
|
+
lastIcon = icon;
|
|
3849
|
+
const provider = icon.provider;
|
|
3850
|
+
const prefix = icon.prefix;
|
|
3851
|
+
const name = icon.name;
|
|
3852
|
+
if (storage2[provider] === void 0) {
|
|
3853
|
+
storage2[provider] = /* @__PURE__ */ Object.create(null);
|
|
3854
|
+
}
|
|
3855
|
+
const providerStorage = storage2[provider];
|
|
3856
|
+
if (providerStorage[prefix] === void 0) {
|
|
3857
|
+
providerStorage[prefix] = getStorage(provider, prefix);
|
|
3858
|
+
}
|
|
3859
|
+
const localStorage = providerStorage[prefix];
|
|
3860
|
+
let list;
|
|
3861
|
+
if (localStorage.icons[name] !== void 0) {
|
|
3862
|
+
list = result.loaded;
|
|
3863
|
+
} else if (prefix === "" || localStorage.missing[name] !== void 0) {
|
|
3864
|
+
list = result.missing;
|
|
3865
|
+
} else {
|
|
3866
|
+
list = result.pending;
|
|
3867
|
+
}
|
|
3868
|
+
const item = {
|
|
3869
|
+
provider,
|
|
3870
|
+
prefix,
|
|
3871
|
+
name
|
|
3872
|
+
};
|
|
3873
|
+
list.push(item);
|
|
3874
|
+
});
|
|
3875
|
+
return result;
|
|
3876
|
+
}
|
|
3877
|
+
const callbacks = /* @__PURE__ */ Object.create(null);
|
|
3878
|
+
const pendingUpdates = /* @__PURE__ */ Object.create(null);
|
|
3879
|
+
function removeCallback(sources, id) {
|
|
3880
|
+
sources.forEach((source) => {
|
|
3881
|
+
const provider = source.provider;
|
|
3882
|
+
if (callbacks[provider] === void 0) {
|
|
3883
|
+
return;
|
|
3884
|
+
}
|
|
3885
|
+
const providerCallbacks = callbacks[provider];
|
|
3886
|
+
const prefix = source.prefix;
|
|
3887
|
+
const items = providerCallbacks[prefix];
|
|
3888
|
+
if (items) {
|
|
3889
|
+
providerCallbacks[prefix] = items.filter((row) => row.id !== id);
|
|
3890
|
+
}
|
|
3891
|
+
});
|
|
3892
|
+
}
|
|
3893
|
+
function updateCallbacks(provider, prefix) {
|
|
3894
|
+
if (pendingUpdates[provider] === void 0) {
|
|
3895
|
+
pendingUpdates[provider] = /* @__PURE__ */ Object.create(null);
|
|
3896
|
+
}
|
|
3897
|
+
const providerPendingUpdates = pendingUpdates[provider];
|
|
3898
|
+
if (!providerPendingUpdates[prefix]) {
|
|
3899
|
+
providerPendingUpdates[prefix] = true;
|
|
3900
|
+
setTimeout(() => {
|
|
3901
|
+
providerPendingUpdates[prefix] = false;
|
|
3902
|
+
if (callbacks[provider] === void 0 || callbacks[provider][prefix] === void 0) {
|
|
3903
|
+
return;
|
|
3904
|
+
}
|
|
3905
|
+
const items = callbacks[provider][prefix].slice(0);
|
|
3906
|
+
if (!items.length) {
|
|
3907
|
+
return;
|
|
3908
|
+
}
|
|
3909
|
+
const storage2 = getStorage(provider, prefix);
|
|
3910
|
+
let hasPending = false;
|
|
3911
|
+
items.forEach((item) => {
|
|
3912
|
+
const icons = item.icons;
|
|
3913
|
+
const oldLength = icons.pending.length;
|
|
3914
|
+
icons.pending = icons.pending.filter((icon) => {
|
|
3915
|
+
if (icon.prefix !== prefix) {
|
|
3916
|
+
return true;
|
|
3917
|
+
}
|
|
3918
|
+
const name = icon.name;
|
|
3919
|
+
if (storage2.icons[name] !== void 0) {
|
|
3920
|
+
icons.loaded.push({
|
|
3921
|
+
provider,
|
|
3922
|
+
prefix,
|
|
3923
|
+
name
|
|
3924
|
+
});
|
|
3925
|
+
} else if (storage2.missing[name] !== void 0) {
|
|
3926
|
+
icons.missing.push({
|
|
3927
|
+
provider,
|
|
3928
|
+
prefix,
|
|
3929
|
+
name
|
|
3930
|
+
});
|
|
3931
|
+
} else {
|
|
3932
|
+
hasPending = true;
|
|
3933
|
+
return true;
|
|
3934
|
+
}
|
|
3935
|
+
return false;
|
|
3936
|
+
});
|
|
3937
|
+
if (icons.pending.length !== oldLength) {
|
|
3938
|
+
if (!hasPending) {
|
|
3939
|
+
removeCallback([
|
|
3940
|
+
{
|
|
3941
|
+
provider,
|
|
3942
|
+
prefix
|
|
3943
|
+
}
|
|
3944
|
+
], item.id);
|
|
3945
|
+
}
|
|
3946
|
+
item.callback(icons.loaded.slice(0), icons.missing.slice(0), icons.pending.slice(0), item.abort);
|
|
3947
|
+
}
|
|
3948
|
+
});
|
|
3949
|
+
});
|
|
3950
|
+
}
|
|
3951
|
+
}
|
|
3952
|
+
let idCounter = 0;
|
|
3953
|
+
function storeCallback(callback, icons, pendingSources) {
|
|
3954
|
+
const id = idCounter++;
|
|
3955
|
+
const abort = removeCallback.bind(null, pendingSources, id);
|
|
3956
|
+
if (!icons.pending.length) {
|
|
3957
|
+
return abort;
|
|
3958
|
+
}
|
|
3959
|
+
const item = {
|
|
3960
|
+
id,
|
|
3961
|
+
icons,
|
|
3962
|
+
callback,
|
|
3963
|
+
abort
|
|
3964
|
+
};
|
|
3965
|
+
pendingSources.forEach((source) => {
|
|
3966
|
+
const provider = source.provider;
|
|
3967
|
+
const prefix = source.prefix;
|
|
3968
|
+
if (callbacks[provider] === void 0) {
|
|
3969
|
+
callbacks[provider] = /* @__PURE__ */ Object.create(null);
|
|
3970
|
+
}
|
|
3971
|
+
const providerCallbacks = callbacks[provider];
|
|
3972
|
+
if (providerCallbacks[prefix] === void 0) {
|
|
3973
|
+
providerCallbacks[prefix] = [];
|
|
3974
|
+
}
|
|
3975
|
+
providerCallbacks[prefix].push(item);
|
|
3976
|
+
});
|
|
3977
|
+
return abort;
|
|
3978
|
+
}
|
|
3979
|
+
function listToIcons(list, validate = true, simpleNames2 = false) {
|
|
3980
|
+
const result = [];
|
|
3981
|
+
list.forEach((item) => {
|
|
3982
|
+
const icon = typeof item === "string" ? stringToIcon(item, false, simpleNames2) : item;
|
|
3983
|
+
if (!validate || validateIcon(icon, simpleNames2)) {
|
|
3984
|
+
result.push({
|
|
3985
|
+
provider: icon.provider,
|
|
3986
|
+
prefix: icon.prefix,
|
|
3987
|
+
name: icon.name
|
|
3988
|
+
});
|
|
3989
|
+
}
|
|
3990
|
+
});
|
|
3991
|
+
return result;
|
|
3992
|
+
}
|
|
3993
|
+
var defaultConfig = {
|
|
3994
|
+
resources: [],
|
|
3995
|
+
index: 0,
|
|
3996
|
+
timeout: 2e3,
|
|
3997
|
+
rotate: 750,
|
|
3998
|
+
random: false,
|
|
3999
|
+
dataAfterTimeout: false
|
|
4000
|
+
};
|
|
4001
|
+
function sendQuery(config2, payload, query, done) {
|
|
4002
|
+
const resourcesCount = config2.resources.length;
|
|
4003
|
+
const startIndex = config2.random ? Math.floor(Math.random() * resourcesCount) : config2.index;
|
|
4004
|
+
let resources;
|
|
4005
|
+
if (config2.random) {
|
|
4006
|
+
let list = config2.resources.slice(0);
|
|
4007
|
+
resources = [];
|
|
4008
|
+
while (list.length > 1) {
|
|
4009
|
+
const nextIndex = Math.floor(Math.random() * list.length);
|
|
4010
|
+
resources.push(list[nextIndex]);
|
|
4011
|
+
list = list.slice(0, nextIndex).concat(list.slice(nextIndex + 1));
|
|
4012
|
+
}
|
|
4013
|
+
resources = resources.concat(list);
|
|
4014
|
+
} else {
|
|
4015
|
+
resources = config2.resources.slice(startIndex).concat(config2.resources.slice(0, startIndex));
|
|
4016
|
+
}
|
|
4017
|
+
const startTime = Date.now();
|
|
4018
|
+
let status = "pending";
|
|
4019
|
+
let queriesSent = 0;
|
|
4020
|
+
let lastError;
|
|
4021
|
+
let timer = null;
|
|
4022
|
+
let queue = [];
|
|
4023
|
+
let doneCallbacks = [];
|
|
4024
|
+
if (typeof done === "function") {
|
|
4025
|
+
doneCallbacks.push(done);
|
|
4026
|
+
}
|
|
4027
|
+
function resetTimer() {
|
|
4028
|
+
if (timer) {
|
|
4029
|
+
clearTimeout(timer);
|
|
4030
|
+
timer = null;
|
|
4031
|
+
}
|
|
4032
|
+
}
|
|
4033
|
+
function abort() {
|
|
4034
|
+
if (status === "pending") {
|
|
4035
|
+
status = "aborted";
|
|
4036
|
+
}
|
|
4037
|
+
resetTimer();
|
|
4038
|
+
queue.forEach((item) => {
|
|
4039
|
+
if (item.status === "pending") {
|
|
4040
|
+
item.status = "aborted";
|
|
4041
|
+
}
|
|
4042
|
+
});
|
|
4043
|
+
queue = [];
|
|
4044
|
+
}
|
|
4045
|
+
function subscribe(callback, overwrite) {
|
|
4046
|
+
if (overwrite) {
|
|
4047
|
+
doneCallbacks = [];
|
|
4048
|
+
}
|
|
4049
|
+
if (typeof callback === "function") {
|
|
4050
|
+
doneCallbacks.push(callback);
|
|
4051
|
+
}
|
|
4052
|
+
}
|
|
4053
|
+
function getQueryStatus() {
|
|
4054
|
+
return {
|
|
4055
|
+
startTime,
|
|
4056
|
+
payload,
|
|
4057
|
+
status,
|
|
4058
|
+
queriesSent,
|
|
4059
|
+
queriesPending: queue.length,
|
|
4060
|
+
subscribe,
|
|
4061
|
+
abort
|
|
4062
|
+
};
|
|
4063
|
+
}
|
|
4064
|
+
function failQuery() {
|
|
4065
|
+
status = "failed";
|
|
4066
|
+
doneCallbacks.forEach((callback) => {
|
|
4067
|
+
callback(void 0, lastError);
|
|
4068
|
+
});
|
|
4069
|
+
}
|
|
4070
|
+
function clearQueue() {
|
|
4071
|
+
queue.forEach((item) => {
|
|
4072
|
+
if (item.status === "pending") {
|
|
4073
|
+
item.status = "aborted";
|
|
4074
|
+
}
|
|
4075
|
+
});
|
|
4076
|
+
queue = [];
|
|
4077
|
+
}
|
|
4078
|
+
function moduleResponse(item, response, data) {
|
|
4079
|
+
const isError = response !== "success";
|
|
4080
|
+
queue = queue.filter((queued) => queued !== item);
|
|
4081
|
+
switch (status) {
|
|
4082
|
+
case "pending":
|
|
4083
|
+
break;
|
|
4084
|
+
case "failed":
|
|
4085
|
+
if (isError || !config2.dataAfterTimeout) {
|
|
4086
|
+
return;
|
|
4087
|
+
}
|
|
4088
|
+
break;
|
|
4089
|
+
default:
|
|
4090
|
+
return;
|
|
4091
|
+
}
|
|
4092
|
+
if (response === "abort") {
|
|
4093
|
+
lastError = data;
|
|
4094
|
+
failQuery();
|
|
4095
|
+
return;
|
|
4096
|
+
}
|
|
4097
|
+
if (isError) {
|
|
4098
|
+
lastError = data;
|
|
4099
|
+
if (!queue.length) {
|
|
4100
|
+
if (!resources.length) {
|
|
4101
|
+
failQuery();
|
|
4102
|
+
} else {
|
|
4103
|
+
execNext();
|
|
4104
|
+
}
|
|
4105
|
+
}
|
|
4106
|
+
return;
|
|
4107
|
+
}
|
|
4108
|
+
resetTimer();
|
|
4109
|
+
clearQueue();
|
|
4110
|
+
if (!config2.random) {
|
|
4111
|
+
const index = config2.resources.indexOf(item.resource);
|
|
4112
|
+
if (index !== -1 && index !== config2.index) {
|
|
4113
|
+
config2.index = index;
|
|
4114
|
+
}
|
|
4115
|
+
}
|
|
4116
|
+
status = "completed";
|
|
4117
|
+
doneCallbacks.forEach((callback) => {
|
|
4118
|
+
callback(data);
|
|
4119
|
+
});
|
|
4120
|
+
}
|
|
4121
|
+
function execNext() {
|
|
4122
|
+
if (status !== "pending") {
|
|
4123
|
+
return;
|
|
4124
|
+
}
|
|
4125
|
+
resetTimer();
|
|
4126
|
+
const resource = resources.shift();
|
|
4127
|
+
if (resource === void 0) {
|
|
4128
|
+
if (queue.length) {
|
|
4129
|
+
timer = setTimeout(() => {
|
|
4130
|
+
resetTimer();
|
|
4131
|
+
if (status === "pending") {
|
|
4132
|
+
clearQueue();
|
|
4133
|
+
failQuery();
|
|
4134
|
+
}
|
|
4135
|
+
}, config2.timeout);
|
|
4136
|
+
return;
|
|
4137
|
+
}
|
|
4138
|
+
failQuery();
|
|
4139
|
+
return;
|
|
4140
|
+
}
|
|
4141
|
+
const item = {
|
|
4142
|
+
status: "pending",
|
|
4143
|
+
resource,
|
|
4144
|
+
callback: (status2, data) => {
|
|
4145
|
+
moduleResponse(item, status2, data);
|
|
4146
|
+
}
|
|
4147
|
+
};
|
|
4148
|
+
queue.push(item);
|
|
4149
|
+
queriesSent++;
|
|
4150
|
+
timer = setTimeout(execNext, config2.rotate);
|
|
4151
|
+
query(resource, payload, item.callback);
|
|
4152
|
+
}
|
|
4153
|
+
setTimeout(execNext);
|
|
4154
|
+
return getQueryStatus;
|
|
4155
|
+
}
|
|
4156
|
+
function setConfig(config2) {
|
|
4157
|
+
if (typeof config2 !== "object" || typeof config2.resources !== "object" || !(config2.resources instanceof Array) || !config2.resources.length) {
|
|
4158
|
+
throw new Error("Invalid Reduncancy configuration");
|
|
4159
|
+
}
|
|
4160
|
+
const newConfig = /* @__PURE__ */ Object.create(null);
|
|
4161
|
+
let key;
|
|
4162
|
+
for (key in defaultConfig) {
|
|
4163
|
+
if (config2[key] !== void 0) {
|
|
4164
|
+
newConfig[key] = config2[key];
|
|
4165
|
+
} else {
|
|
4166
|
+
newConfig[key] = defaultConfig[key];
|
|
4167
|
+
}
|
|
4168
|
+
}
|
|
4169
|
+
return newConfig;
|
|
4170
|
+
}
|
|
4171
|
+
function initRedundancy(cfg) {
|
|
4172
|
+
const config2 = setConfig(cfg);
|
|
4173
|
+
let queries = [];
|
|
4174
|
+
function cleanup() {
|
|
4175
|
+
queries = queries.filter((item) => item().status === "pending");
|
|
4176
|
+
}
|
|
4177
|
+
function query(payload, queryCallback, doneCallback) {
|
|
4178
|
+
const query2 = sendQuery(config2, payload, queryCallback, (data, error) => {
|
|
4179
|
+
cleanup();
|
|
4180
|
+
if (doneCallback) {
|
|
4181
|
+
doneCallback(data, error);
|
|
4182
|
+
}
|
|
4183
|
+
});
|
|
4184
|
+
queries.push(query2);
|
|
4185
|
+
return query2;
|
|
4186
|
+
}
|
|
4187
|
+
function find(callback) {
|
|
4188
|
+
const result = queries.find((value) => {
|
|
4189
|
+
return callback(value);
|
|
4190
|
+
});
|
|
4191
|
+
return result !== void 0 ? result : null;
|
|
4192
|
+
}
|
|
4193
|
+
const instance = {
|
|
4194
|
+
query,
|
|
4195
|
+
find,
|
|
4196
|
+
setIndex: (index) => {
|
|
4197
|
+
config2.index = index;
|
|
4198
|
+
},
|
|
4199
|
+
getIndex: () => config2.index,
|
|
4200
|
+
cleanup
|
|
4201
|
+
};
|
|
4202
|
+
return instance;
|
|
4203
|
+
}
|
|
4204
|
+
function emptyCallback$1() {
|
|
4205
|
+
}
|
|
4206
|
+
const redundancyCache = /* @__PURE__ */ Object.create(null);
|
|
4207
|
+
function getRedundancyCache(provider) {
|
|
4208
|
+
if (redundancyCache[provider] === void 0) {
|
|
4209
|
+
const config2 = getAPIConfig(provider);
|
|
4210
|
+
if (!config2) {
|
|
4211
|
+
return;
|
|
4212
|
+
}
|
|
4213
|
+
const redundancy = initRedundancy(config2);
|
|
4214
|
+
const cachedReundancy = {
|
|
4215
|
+
config: config2,
|
|
4216
|
+
redundancy
|
|
4217
|
+
};
|
|
4218
|
+
redundancyCache[provider] = cachedReundancy;
|
|
4219
|
+
}
|
|
4220
|
+
return redundancyCache[provider];
|
|
4221
|
+
}
|
|
4222
|
+
function sendAPIQuery(target, query, callback) {
|
|
4223
|
+
let redundancy;
|
|
4224
|
+
let send2;
|
|
4225
|
+
if (typeof target === "string") {
|
|
4226
|
+
const api = getAPIModule(target);
|
|
4227
|
+
if (!api) {
|
|
4228
|
+
callback(void 0, 424);
|
|
4229
|
+
return emptyCallback$1;
|
|
4230
|
+
}
|
|
4231
|
+
send2 = api.send;
|
|
4232
|
+
const cached = getRedundancyCache(target);
|
|
4233
|
+
if (cached) {
|
|
4234
|
+
redundancy = cached.redundancy;
|
|
4235
|
+
}
|
|
4236
|
+
} else {
|
|
4237
|
+
const config2 = createAPIConfig(target);
|
|
4238
|
+
if (config2) {
|
|
4239
|
+
redundancy = initRedundancy(config2);
|
|
4240
|
+
const moduleKey = target.resources ? target.resources[0] : "";
|
|
4241
|
+
const api = getAPIModule(moduleKey);
|
|
4242
|
+
if (api) {
|
|
4243
|
+
send2 = api.send;
|
|
4244
|
+
}
|
|
4245
|
+
}
|
|
4246
|
+
}
|
|
4247
|
+
if (!redundancy || !send2) {
|
|
4248
|
+
callback(void 0, 424);
|
|
4249
|
+
return emptyCallback$1;
|
|
4250
|
+
}
|
|
4251
|
+
return redundancy.query(query, send2, callback)().abort;
|
|
4252
|
+
}
|
|
4253
|
+
const cache = {};
|
|
4254
|
+
function emptyCallback() {
|
|
4255
|
+
}
|
|
4256
|
+
const pendingIcons = /* @__PURE__ */ Object.create(null);
|
|
4257
|
+
const iconsToLoad = /* @__PURE__ */ Object.create(null);
|
|
4258
|
+
const loaderFlags = /* @__PURE__ */ Object.create(null);
|
|
4259
|
+
const queueFlags = /* @__PURE__ */ Object.create(null);
|
|
4260
|
+
function loadedNewIcons(provider, prefix) {
|
|
4261
|
+
if (loaderFlags[provider] === void 0) {
|
|
4262
|
+
loaderFlags[provider] = /* @__PURE__ */ Object.create(null);
|
|
4263
|
+
}
|
|
4264
|
+
const providerLoaderFlags = loaderFlags[provider];
|
|
4265
|
+
if (!providerLoaderFlags[prefix]) {
|
|
4266
|
+
providerLoaderFlags[prefix] = true;
|
|
4267
|
+
setTimeout(() => {
|
|
4268
|
+
providerLoaderFlags[prefix] = false;
|
|
4269
|
+
updateCallbacks(provider, prefix);
|
|
4270
|
+
});
|
|
4271
|
+
}
|
|
4272
|
+
}
|
|
4273
|
+
const errorsCache = /* @__PURE__ */ Object.create(null);
|
|
4274
|
+
function loadNewIcons(provider, prefix, icons) {
|
|
4275
|
+
function err() {
|
|
4276
|
+
const key = (provider === "" ? "" : "@" + provider + ":") + prefix;
|
|
4277
|
+
const time = Math.floor(Date.now() / 6e4);
|
|
4278
|
+
if (errorsCache[key] < time) {
|
|
4279
|
+
errorsCache[key] = time;
|
|
4280
|
+
console.error('Unable to retrieve icons for "' + key + '" because API is not configured properly.');
|
|
4281
|
+
}
|
|
4282
|
+
}
|
|
4283
|
+
if (iconsToLoad[provider] === void 0) {
|
|
4284
|
+
iconsToLoad[provider] = /* @__PURE__ */ Object.create(null);
|
|
4285
|
+
}
|
|
4286
|
+
const providerIconsToLoad = iconsToLoad[provider];
|
|
4287
|
+
if (queueFlags[provider] === void 0) {
|
|
4288
|
+
queueFlags[provider] = /* @__PURE__ */ Object.create(null);
|
|
4289
|
+
}
|
|
4290
|
+
const providerQueueFlags = queueFlags[provider];
|
|
4291
|
+
if (pendingIcons[provider] === void 0) {
|
|
4292
|
+
pendingIcons[provider] = /* @__PURE__ */ Object.create(null);
|
|
4293
|
+
}
|
|
4294
|
+
const providerPendingIcons = pendingIcons[provider];
|
|
4295
|
+
if (providerIconsToLoad[prefix] === void 0) {
|
|
4296
|
+
providerIconsToLoad[prefix] = icons;
|
|
4297
|
+
} else {
|
|
4298
|
+
providerIconsToLoad[prefix] = providerIconsToLoad[prefix].concat(icons).sort();
|
|
4299
|
+
}
|
|
4300
|
+
if (!providerQueueFlags[prefix]) {
|
|
4301
|
+
providerQueueFlags[prefix] = true;
|
|
4302
|
+
setTimeout(() => {
|
|
4303
|
+
providerQueueFlags[prefix] = false;
|
|
4304
|
+
const icons2 = providerIconsToLoad[prefix];
|
|
4305
|
+
delete providerIconsToLoad[prefix];
|
|
4306
|
+
const api = getAPIModule(provider);
|
|
4307
|
+
if (!api) {
|
|
4308
|
+
err();
|
|
4309
|
+
return;
|
|
4310
|
+
}
|
|
4311
|
+
const params = api.prepare(provider, prefix, icons2);
|
|
4312
|
+
params.forEach((item) => {
|
|
4313
|
+
sendAPIQuery(provider, item, (data, error) => {
|
|
4314
|
+
const storage2 = getStorage(provider, prefix);
|
|
4315
|
+
if (typeof data !== "object") {
|
|
4316
|
+
if (error !== 404) {
|
|
4317
|
+
return;
|
|
4318
|
+
}
|
|
4319
|
+
const t = Date.now();
|
|
4320
|
+
item.icons.forEach((name) => {
|
|
4321
|
+
storage2.missing[name] = t;
|
|
4322
|
+
});
|
|
4323
|
+
} else {
|
|
4324
|
+
try {
|
|
4325
|
+
const parsed = addIconSet(storage2, data);
|
|
4326
|
+
if (!parsed.length) {
|
|
4327
|
+
return;
|
|
4328
|
+
}
|
|
4329
|
+
const pending = providerPendingIcons[prefix];
|
|
4330
|
+
parsed.forEach((name) => {
|
|
4331
|
+
delete pending[name];
|
|
4332
|
+
});
|
|
4333
|
+
if (cache.store) {
|
|
4334
|
+
cache.store(provider, data);
|
|
4335
|
+
}
|
|
4336
|
+
} catch (err2) {
|
|
4337
|
+
console.error(err2);
|
|
4338
|
+
}
|
|
4339
|
+
}
|
|
4340
|
+
loadedNewIcons(provider, prefix);
|
|
4341
|
+
});
|
|
4342
|
+
});
|
|
4343
|
+
});
|
|
4344
|
+
}
|
|
4345
|
+
}
|
|
4346
|
+
const loadIcons = (icons, callback) => {
|
|
4347
|
+
const cleanedIcons = listToIcons(icons, true, allowSimpleNames());
|
|
4348
|
+
const sortedIcons = sortIcons(cleanedIcons);
|
|
4349
|
+
if (!sortedIcons.pending.length) {
|
|
4350
|
+
let callCallback = true;
|
|
4351
|
+
if (callback) {
|
|
4352
|
+
setTimeout(() => {
|
|
4353
|
+
if (callCallback) {
|
|
4354
|
+
callback(sortedIcons.loaded, sortedIcons.missing, sortedIcons.pending, emptyCallback);
|
|
4355
|
+
}
|
|
4356
|
+
});
|
|
4357
|
+
}
|
|
4358
|
+
return () => {
|
|
4359
|
+
callCallback = false;
|
|
4360
|
+
};
|
|
4361
|
+
}
|
|
4362
|
+
const newIcons = /* @__PURE__ */ Object.create(null);
|
|
4363
|
+
const sources = [];
|
|
4364
|
+
let lastProvider, lastPrefix;
|
|
4365
|
+
sortedIcons.pending.forEach((icon) => {
|
|
4366
|
+
const provider = icon.provider;
|
|
4367
|
+
const prefix = icon.prefix;
|
|
4368
|
+
if (prefix === lastPrefix && provider === lastProvider) {
|
|
4369
|
+
return;
|
|
4370
|
+
}
|
|
4371
|
+
lastProvider = provider;
|
|
4372
|
+
lastPrefix = prefix;
|
|
4373
|
+
sources.push({
|
|
4374
|
+
provider,
|
|
4375
|
+
prefix
|
|
4376
|
+
});
|
|
4377
|
+
if (pendingIcons[provider] === void 0) {
|
|
4378
|
+
pendingIcons[provider] = /* @__PURE__ */ Object.create(null);
|
|
4379
|
+
}
|
|
4380
|
+
const providerPendingIcons = pendingIcons[provider];
|
|
4381
|
+
if (providerPendingIcons[prefix] === void 0) {
|
|
4382
|
+
providerPendingIcons[prefix] = /* @__PURE__ */ Object.create(null);
|
|
4383
|
+
}
|
|
4384
|
+
if (newIcons[provider] === void 0) {
|
|
4385
|
+
newIcons[provider] = /* @__PURE__ */ Object.create(null);
|
|
4386
|
+
}
|
|
4387
|
+
const providerNewIcons = newIcons[provider];
|
|
4388
|
+
if (providerNewIcons[prefix] === void 0) {
|
|
4389
|
+
providerNewIcons[prefix] = [];
|
|
4390
|
+
}
|
|
4391
|
+
});
|
|
4392
|
+
const time = Date.now();
|
|
4393
|
+
sortedIcons.pending.forEach((icon) => {
|
|
4394
|
+
const provider = icon.provider;
|
|
4395
|
+
const prefix = icon.prefix;
|
|
4396
|
+
const name = icon.name;
|
|
4397
|
+
const pendingQueue = pendingIcons[provider][prefix];
|
|
4398
|
+
if (pendingQueue[name] === void 0) {
|
|
4399
|
+
pendingQueue[name] = time;
|
|
4400
|
+
newIcons[provider][prefix].push(name);
|
|
4401
|
+
}
|
|
4402
|
+
});
|
|
4403
|
+
sources.forEach((source) => {
|
|
4404
|
+
const provider = source.provider;
|
|
4405
|
+
const prefix = source.prefix;
|
|
4406
|
+
if (newIcons[provider][prefix].length) {
|
|
4407
|
+
loadNewIcons(provider, prefix, newIcons[provider][prefix]);
|
|
4408
|
+
}
|
|
4409
|
+
});
|
|
4410
|
+
return callback ? storeCallback(callback, sortedIcons, sources) : emptyCallback;
|
|
4411
|
+
};
|
|
4412
|
+
const cacheVersion = "iconify2";
|
|
4413
|
+
const cachePrefix = "iconify";
|
|
4414
|
+
const countKey = cachePrefix + "-count";
|
|
4415
|
+
const versionKey = cachePrefix + "-version";
|
|
4416
|
+
const hour = 36e5;
|
|
4417
|
+
const cacheExpiration = 168;
|
|
4418
|
+
const config = {
|
|
4419
|
+
local: true,
|
|
4420
|
+
session: true
|
|
4421
|
+
};
|
|
4422
|
+
let loaded = false;
|
|
4423
|
+
const count = {
|
|
4424
|
+
local: 0,
|
|
4425
|
+
session: 0
|
|
4426
|
+
};
|
|
4427
|
+
const emptyList = {
|
|
4428
|
+
local: [],
|
|
4429
|
+
session: []
|
|
4430
|
+
};
|
|
4431
|
+
let _window = typeof window === "undefined" ? {} : window;
|
|
4432
|
+
function getGlobal(key) {
|
|
4433
|
+
const attr = key + "Storage";
|
|
4434
|
+
try {
|
|
4435
|
+
if (_window && _window[attr] && typeof _window[attr].length === "number") {
|
|
4436
|
+
return _window[attr];
|
|
4437
|
+
}
|
|
4438
|
+
} catch (err) {
|
|
4439
|
+
}
|
|
4440
|
+
config[key] = false;
|
|
4441
|
+
return null;
|
|
4442
|
+
}
|
|
4443
|
+
function setCount(storage2, key, value) {
|
|
4444
|
+
try {
|
|
4445
|
+
storage2.setItem(countKey, value.toString());
|
|
4446
|
+
count[key] = value;
|
|
4447
|
+
return true;
|
|
4448
|
+
} catch (err) {
|
|
4449
|
+
return false;
|
|
4450
|
+
}
|
|
4451
|
+
}
|
|
4452
|
+
function getCount(storage2) {
|
|
4453
|
+
const count2 = storage2.getItem(countKey);
|
|
4454
|
+
if (count2) {
|
|
4455
|
+
const total = parseInt(count2);
|
|
4456
|
+
return total ? total : 0;
|
|
4457
|
+
}
|
|
4458
|
+
return 0;
|
|
4459
|
+
}
|
|
4460
|
+
function initCache(storage2, key) {
|
|
4461
|
+
try {
|
|
4462
|
+
storage2.setItem(versionKey, cacheVersion);
|
|
4463
|
+
} catch (err) {
|
|
4464
|
+
}
|
|
4465
|
+
setCount(storage2, key, 0);
|
|
4466
|
+
}
|
|
4467
|
+
function destroyCache(storage2) {
|
|
4468
|
+
try {
|
|
4469
|
+
const total = getCount(storage2);
|
|
4470
|
+
for (let i = 0; i < total; i++) {
|
|
4471
|
+
storage2.removeItem(cachePrefix + i.toString());
|
|
4472
|
+
}
|
|
4473
|
+
} catch (err) {
|
|
4474
|
+
}
|
|
4475
|
+
}
|
|
4476
|
+
const loadCache = () => {
|
|
4477
|
+
if (loaded) {
|
|
4478
|
+
return;
|
|
4479
|
+
}
|
|
4480
|
+
loaded = true;
|
|
4481
|
+
const minTime = Math.floor(Date.now() / hour) - cacheExpiration;
|
|
4482
|
+
function load(key) {
|
|
4483
|
+
const func = getGlobal(key);
|
|
4484
|
+
if (!func) {
|
|
4485
|
+
return;
|
|
4486
|
+
}
|
|
4487
|
+
const getItem = (index) => {
|
|
4488
|
+
const name = cachePrefix + index.toString();
|
|
4489
|
+
const item = func.getItem(name);
|
|
4490
|
+
if (typeof item !== "string") {
|
|
4491
|
+
return false;
|
|
4492
|
+
}
|
|
4493
|
+
let valid = true;
|
|
4494
|
+
try {
|
|
4495
|
+
const data = JSON.parse(item);
|
|
4496
|
+
if (typeof data !== "object" || typeof data.cached !== "number" || data.cached < minTime || typeof data.provider !== "string" || typeof data.data !== "object" || typeof data.data.prefix !== "string") {
|
|
4497
|
+
valid = false;
|
|
4498
|
+
} else {
|
|
4499
|
+
const provider = data.provider;
|
|
4500
|
+
const prefix = data.data.prefix;
|
|
4501
|
+
const storage2 = getStorage(provider, prefix);
|
|
4502
|
+
valid = addIconSet(storage2, data.data).length > 0;
|
|
4503
|
+
}
|
|
4504
|
+
} catch (err) {
|
|
4505
|
+
valid = false;
|
|
4506
|
+
}
|
|
4507
|
+
if (!valid) {
|
|
4508
|
+
func.removeItem(name);
|
|
4509
|
+
}
|
|
4510
|
+
return valid;
|
|
4511
|
+
};
|
|
4512
|
+
try {
|
|
4513
|
+
const version = func.getItem(versionKey);
|
|
4514
|
+
if (version !== cacheVersion) {
|
|
4515
|
+
if (version) {
|
|
4516
|
+
destroyCache(func);
|
|
4517
|
+
}
|
|
4518
|
+
initCache(func, key);
|
|
4519
|
+
return;
|
|
4520
|
+
}
|
|
4521
|
+
let total = getCount(func);
|
|
4522
|
+
for (let i = total - 1; i >= 0; i--) {
|
|
4523
|
+
if (!getItem(i)) {
|
|
4524
|
+
if (i === total - 1) {
|
|
4525
|
+
total--;
|
|
4526
|
+
} else {
|
|
4527
|
+
emptyList[key].push(i);
|
|
4528
|
+
}
|
|
4529
|
+
}
|
|
4530
|
+
}
|
|
4531
|
+
setCount(func, key, total);
|
|
4532
|
+
} catch (err) {
|
|
4533
|
+
}
|
|
4534
|
+
}
|
|
4535
|
+
for (const key in config) {
|
|
4536
|
+
load(key);
|
|
4537
|
+
}
|
|
4538
|
+
};
|
|
4539
|
+
const storeCache = (provider, data) => {
|
|
4540
|
+
if (!loaded) {
|
|
4541
|
+
loadCache();
|
|
4542
|
+
}
|
|
4543
|
+
function store(key) {
|
|
4544
|
+
if (!config[key]) {
|
|
4545
|
+
return false;
|
|
4546
|
+
}
|
|
4547
|
+
const func = getGlobal(key);
|
|
4548
|
+
if (!func) {
|
|
4549
|
+
return false;
|
|
4550
|
+
}
|
|
4551
|
+
let index = emptyList[key].shift();
|
|
4552
|
+
if (index === void 0) {
|
|
4553
|
+
index = count[key];
|
|
4554
|
+
if (!setCount(func, key, index + 1)) {
|
|
4555
|
+
return false;
|
|
4556
|
+
}
|
|
4557
|
+
}
|
|
4558
|
+
try {
|
|
4559
|
+
const item = {
|
|
4560
|
+
cached: Math.floor(Date.now() / hour),
|
|
4561
|
+
provider,
|
|
4562
|
+
data
|
|
4563
|
+
};
|
|
4564
|
+
func.setItem(cachePrefix + index.toString(), JSON.stringify(item));
|
|
4565
|
+
} catch (err) {
|
|
4566
|
+
return false;
|
|
4567
|
+
}
|
|
4568
|
+
return true;
|
|
4569
|
+
}
|
|
4570
|
+
if (!Object.keys(data.icons).length) {
|
|
4571
|
+
return;
|
|
4572
|
+
}
|
|
4573
|
+
if (data.not_found) {
|
|
4574
|
+
data = Object.assign({}, data);
|
|
4575
|
+
delete data.not_found;
|
|
4576
|
+
}
|
|
4577
|
+
if (!store("local")) {
|
|
4578
|
+
store("session");
|
|
4579
|
+
}
|
|
4580
|
+
};
|
|
4581
|
+
const separator = /[\s,]+/;
|
|
4582
|
+
function flipFromString(custom, flip2) {
|
|
4583
|
+
flip2.split(separator).forEach((str) => {
|
|
4584
|
+
const value = str.trim();
|
|
4585
|
+
switch (value) {
|
|
4586
|
+
case "horizontal":
|
|
4587
|
+
custom.hFlip = true;
|
|
4588
|
+
break;
|
|
4589
|
+
case "vertical":
|
|
4590
|
+
custom.vFlip = true;
|
|
4591
|
+
break;
|
|
4592
|
+
}
|
|
4593
|
+
});
|
|
4594
|
+
}
|
|
4595
|
+
function alignmentFromString(custom, align) {
|
|
4596
|
+
align.split(separator).forEach((str) => {
|
|
4597
|
+
const value = str.trim();
|
|
4598
|
+
switch (value) {
|
|
4599
|
+
case "left":
|
|
4600
|
+
case "center":
|
|
4601
|
+
case "right":
|
|
4602
|
+
custom.hAlign = value;
|
|
4603
|
+
break;
|
|
4604
|
+
case "top":
|
|
4605
|
+
case "middle":
|
|
4606
|
+
case "bottom":
|
|
4607
|
+
custom.vAlign = value;
|
|
4608
|
+
break;
|
|
4609
|
+
case "slice":
|
|
4610
|
+
case "crop":
|
|
4611
|
+
custom.slice = true;
|
|
4612
|
+
break;
|
|
4613
|
+
case "meet":
|
|
4614
|
+
custom.slice = false;
|
|
4615
|
+
}
|
|
4616
|
+
});
|
|
4617
|
+
}
|
|
4618
|
+
function rotateFromString(value, defaultValue = 0) {
|
|
4619
|
+
const units = value.replace(/^-?[0-9.]*/, "");
|
|
4620
|
+
function cleanup(value2) {
|
|
4621
|
+
while (value2 < 0) {
|
|
4622
|
+
value2 += 4;
|
|
4623
|
+
}
|
|
4624
|
+
return value2 % 4;
|
|
4625
|
+
}
|
|
4626
|
+
if (units === "") {
|
|
4627
|
+
const num = parseInt(value);
|
|
4628
|
+
return isNaN(num) ? 0 : cleanup(num);
|
|
4629
|
+
} else if (units !== value) {
|
|
4630
|
+
let split = 0;
|
|
4631
|
+
switch (units) {
|
|
4632
|
+
case "%":
|
|
4633
|
+
split = 25;
|
|
4634
|
+
break;
|
|
4635
|
+
case "deg":
|
|
4636
|
+
split = 90;
|
|
4637
|
+
}
|
|
4638
|
+
if (split) {
|
|
4639
|
+
let num = parseFloat(value.slice(0, value.length - units.length));
|
|
4640
|
+
if (isNaN(num)) {
|
|
4641
|
+
return 0;
|
|
4642
|
+
}
|
|
4643
|
+
num = num / split;
|
|
4644
|
+
return num % 1 === 0 ? cleanup(num) : 0;
|
|
4645
|
+
}
|
|
4646
|
+
}
|
|
4647
|
+
return defaultValue;
|
|
4648
|
+
}
|
|
4649
|
+
const svgDefaults = {
|
|
4650
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
4651
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
4652
|
+
"aria-hidden": true,
|
|
4653
|
+
"role": "img"
|
|
4654
|
+
};
|
|
4655
|
+
let customisationAliases = {};
|
|
4656
|
+
["horizontal", "vertical"].forEach((prefix) => {
|
|
4657
|
+
["Align", "Flip"].forEach((suffix) => {
|
|
4658
|
+
const attr = prefix.slice(0, 1) + suffix;
|
|
4659
|
+
const value = {
|
|
4660
|
+
attr,
|
|
4661
|
+
boolean: suffix === "Flip"
|
|
4662
|
+
};
|
|
4663
|
+
customisationAliases[prefix + "-" + suffix.toLowerCase()] = value;
|
|
4664
|
+
customisationAliases[prefix.slice(0, 1) + "-" + suffix.toLowerCase()] = value;
|
|
4665
|
+
customisationAliases[prefix + suffix] = value;
|
|
4666
|
+
});
|
|
4667
|
+
});
|
|
4668
|
+
const render = (icon, props) => {
|
|
4669
|
+
const customisations = mergeCustomisations(defaults, props);
|
|
4670
|
+
const componentProps = __spreadValues({}, svgDefaults);
|
|
4671
|
+
let style = typeof props.style === "object" && !(props.style instanceof Array) ? __spreadValues({}, props.style) : {};
|
|
4672
|
+
for (let key in props) {
|
|
4673
|
+
const value = props[key];
|
|
4674
|
+
if (value === void 0) {
|
|
4675
|
+
continue;
|
|
4676
|
+
}
|
|
4677
|
+
switch (key) {
|
|
4678
|
+
case "icon":
|
|
4679
|
+
case "style":
|
|
4680
|
+
case "onLoad":
|
|
4681
|
+
break;
|
|
4682
|
+
case "inline":
|
|
4683
|
+
case "hFlip":
|
|
4684
|
+
case "vFlip":
|
|
4685
|
+
customisations[key] = value === true || value === "true" || value === 1;
|
|
4686
|
+
break;
|
|
4687
|
+
case "flip":
|
|
4688
|
+
if (typeof value === "string") {
|
|
4689
|
+
flipFromString(customisations, value);
|
|
4690
|
+
}
|
|
4691
|
+
break;
|
|
4692
|
+
case "align":
|
|
4693
|
+
if (typeof value === "string") {
|
|
4694
|
+
alignmentFromString(customisations, value);
|
|
4695
|
+
}
|
|
4696
|
+
break;
|
|
4697
|
+
case "color":
|
|
4698
|
+
style.color = value;
|
|
4699
|
+
break;
|
|
4700
|
+
case "rotate":
|
|
4701
|
+
if (typeof value === "string") {
|
|
4702
|
+
customisations[key] = rotateFromString(value);
|
|
4703
|
+
} else if (typeof value === "number") {
|
|
4704
|
+
customisations[key] = value;
|
|
4705
|
+
}
|
|
4706
|
+
break;
|
|
4707
|
+
case "ariaHidden":
|
|
4708
|
+
case "aria-hidden":
|
|
4709
|
+
if (value !== true && value !== "true") {
|
|
4710
|
+
delete componentProps["aria-hidden"];
|
|
4711
|
+
}
|
|
4712
|
+
break;
|
|
4713
|
+
default:
|
|
4714
|
+
if (customisationAliases[key] !== void 0) {
|
|
4715
|
+
if (customisationAliases[key].boolean && (value === true || value === "true" || value === 1)) {
|
|
4716
|
+
customisations[customisationAliases[key].attr] = true;
|
|
4717
|
+
} else if (!customisationAliases[key].boolean && typeof value === "string" && value !== "") {
|
|
4718
|
+
customisations[customisationAliases[key].attr] = value;
|
|
4719
|
+
}
|
|
4720
|
+
} else if (defaults[key] === void 0) {
|
|
4721
|
+
componentProps[key] = value;
|
|
4722
|
+
}
|
|
4723
|
+
}
|
|
4724
|
+
}
|
|
4725
|
+
const item = iconToSVG(icon, customisations);
|
|
4726
|
+
for (let key in item.attributes) {
|
|
4727
|
+
componentProps[key] = item.attributes[key];
|
|
4728
|
+
}
|
|
4729
|
+
if (item.inline && style.verticalAlign === void 0 && style["vertical-align"] === void 0) {
|
|
4730
|
+
style.verticalAlign = "-0.125em";
|
|
4731
|
+
}
|
|
4732
|
+
let localCounter = 0;
|
|
4733
|
+
let id = props.id;
|
|
4734
|
+
if (typeof id === "string") {
|
|
4735
|
+
id = id.replace(/-/g, "_");
|
|
4736
|
+
}
|
|
4737
|
+
componentProps["innerHTML"] = replaceIDs(item.body, id ? () => id + "ID" + localCounter++ : "iconifyVue");
|
|
4738
|
+
if (Object.keys(style).length > 0) {
|
|
4739
|
+
componentProps["style"] = style;
|
|
4740
|
+
}
|
|
4741
|
+
return h("svg", componentProps);
|
|
4742
|
+
};
|
|
4743
|
+
allowSimpleNames(true);
|
|
4744
|
+
setAPIModule("", fetchAPIModule);
|
|
4745
|
+
if (typeof document !== "undefined" && typeof window !== "undefined") {
|
|
4746
|
+
cache.store = storeCache;
|
|
4747
|
+
loadCache();
|
|
4748
|
+
const _window2 = window;
|
|
4749
|
+
if (_window2.IconifyPreload !== void 0) {
|
|
4750
|
+
const preload = _window2.IconifyPreload;
|
|
4751
|
+
const err = "Invalid IconifyPreload syntax.";
|
|
4752
|
+
if (typeof preload === "object" && preload !== null) {
|
|
4753
|
+
(preload instanceof Array ? preload : [preload]).forEach((item) => {
|
|
4754
|
+
try {
|
|
4755
|
+
if (typeof item !== "object" || item === null || item instanceof Array || typeof item.icons !== "object" || typeof item.prefix !== "string" || !addCollection(item)) {
|
|
4756
|
+
console.error(err);
|
|
4757
|
+
}
|
|
4758
|
+
} catch (e) {
|
|
4759
|
+
console.error(err);
|
|
4760
|
+
}
|
|
4761
|
+
});
|
|
4762
|
+
}
|
|
4763
|
+
}
|
|
4764
|
+
if (_window2.IconifyProviders !== void 0) {
|
|
4765
|
+
const providers = _window2.IconifyProviders;
|
|
4766
|
+
if (typeof providers === "object" && providers !== null) {
|
|
4767
|
+
for (let key in providers) {
|
|
4768
|
+
const err = "IconifyProviders[" + key + "] is invalid.";
|
|
4769
|
+
try {
|
|
4770
|
+
const value = providers[key];
|
|
4771
|
+
if (typeof value !== "object" || !value || value.resources === void 0) {
|
|
4772
|
+
continue;
|
|
4773
|
+
}
|
|
4774
|
+
if (!addAPIProvider(key, value)) {
|
|
4775
|
+
console.error(err);
|
|
4776
|
+
}
|
|
4777
|
+
} catch (e) {
|
|
4778
|
+
console.error(err);
|
|
4779
|
+
}
|
|
4780
|
+
}
|
|
4781
|
+
}
|
|
4782
|
+
}
|
|
4783
|
+
}
|
|
4784
|
+
const emptyIcon = fullIcon({
|
|
4785
|
+
body: ""
|
|
4786
|
+
});
|
|
4787
|
+
const Icon = defineComponent({
|
|
4788
|
+
inheritAttrs: false,
|
|
4789
|
+
data() {
|
|
4790
|
+
return {
|
|
4791
|
+
iconMounted: false,
|
|
4792
|
+
counter: 0
|
|
4793
|
+
};
|
|
4794
|
+
},
|
|
4795
|
+
mounted() {
|
|
4796
|
+
this._name = "";
|
|
4797
|
+
this._loadingIcon = null;
|
|
4798
|
+
this.iconMounted = true;
|
|
4799
|
+
},
|
|
4800
|
+
unmounted() {
|
|
4801
|
+
this.abortLoading();
|
|
4802
|
+
},
|
|
4803
|
+
methods: {
|
|
4804
|
+
abortLoading() {
|
|
4805
|
+
if (this._loadingIcon) {
|
|
4806
|
+
this._loadingIcon.abort();
|
|
4807
|
+
this._loadingIcon = null;
|
|
4808
|
+
}
|
|
4809
|
+
},
|
|
4810
|
+
getIcon(icon, onload) {
|
|
4811
|
+
if (typeof icon === "object" && icon !== null && typeof icon.body === "string") {
|
|
4812
|
+
this._name = "";
|
|
4813
|
+
this.abortLoading();
|
|
4814
|
+
return {
|
|
4815
|
+
data: fullIcon(icon)
|
|
4816
|
+
};
|
|
4817
|
+
}
|
|
4818
|
+
let iconName;
|
|
4819
|
+
if (typeof icon !== "string" || (iconName = stringToIcon(icon, false, true)) === null) {
|
|
4820
|
+
this.abortLoading();
|
|
4821
|
+
return null;
|
|
4822
|
+
}
|
|
4823
|
+
const data = getIconData(iconName);
|
|
4824
|
+
if (data === null) {
|
|
4825
|
+
if (!this._loadingIcon || this._loadingIcon.name !== icon) {
|
|
4826
|
+
this.abortLoading();
|
|
4827
|
+
this._name = "";
|
|
4828
|
+
this._loadingIcon = {
|
|
4829
|
+
name: icon,
|
|
4830
|
+
abort: loadIcons([iconName], () => {
|
|
4831
|
+
this.counter++;
|
|
4832
|
+
})
|
|
4833
|
+
};
|
|
4834
|
+
}
|
|
4835
|
+
return null;
|
|
4836
|
+
}
|
|
4837
|
+
this.abortLoading();
|
|
4838
|
+
if (this._name !== icon) {
|
|
4839
|
+
this._name = icon;
|
|
4840
|
+
if (onload) {
|
|
4841
|
+
onload(icon);
|
|
4842
|
+
}
|
|
4843
|
+
}
|
|
4844
|
+
const classes = ["iconify"];
|
|
4845
|
+
if (iconName.prefix !== "") {
|
|
4846
|
+
classes.push("iconify--" + iconName.prefix);
|
|
4847
|
+
}
|
|
4848
|
+
if (iconName.provider !== "") {
|
|
4849
|
+
classes.push("iconify--" + iconName.provider);
|
|
4850
|
+
}
|
|
4851
|
+
return { data, classes };
|
|
4852
|
+
}
|
|
4853
|
+
},
|
|
4854
|
+
render() {
|
|
4855
|
+
this.counter;
|
|
4856
|
+
const props = this.$attrs;
|
|
4857
|
+
const icon = this.iconMounted ? this.getIcon(props.icon, props.onLoad) : null;
|
|
4858
|
+
if (!icon) {
|
|
4859
|
+
return render(emptyIcon, props);
|
|
4860
|
+
}
|
|
4861
|
+
let newProps = props;
|
|
4862
|
+
if (icon.classes) {
|
|
4863
|
+
newProps = __spreadProps(__spreadValues({}, props), {
|
|
4864
|
+
class: (typeof props["class"] === "string" ? props["class"] + " " : "") + icon.classes.join(" ")
|
|
4865
|
+
});
|
|
4866
|
+
}
|
|
4867
|
+
return render(icon.data, newProps);
|
|
4868
|
+
}
|
|
4869
|
+
});
|
|
4870
|
+
function tryOnScopeDispose(fn) {
|
|
4871
|
+
if (getCurrentScope()) {
|
|
4872
|
+
onScopeDispose(fn);
|
|
4873
|
+
return true;
|
|
4874
|
+
}
|
|
4875
|
+
return false;
|
|
4876
|
+
}
|
|
4877
|
+
const isClient = typeof window !== "undefined";
|
|
4878
|
+
const isString = (val) => typeof val === "string";
|
|
4879
|
+
const noop = () => {
|
|
4880
|
+
};
|
|
4881
|
+
function useTimeoutFn(cb, interval, options = {}) {
|
|
4882
|
+
const {
|
|
4883
|
+
immediate = true
|
|
4884
|
+
} = options;
|
|
4885
|
+
const isPending = ref(false);
|
|
4886
|
+
let timer = null;
|
|
4887
|
+
function clear() {
|
|
4888
|
+
if (timer) {
|
|
4889
|
+
clearTimeout(timer);
|
|
4890
|
+
timer = null;
|
|
4891
|
+
}
|
|
4892
|
+
}
|
|
4893
|
+
function stop() {
|
|
4894
|
+
isPending.value = false;
|
|
4895
|
+
clear();
|
|
4896
|
+
}
|
|
4897
|
+
function start(...args) {
|
|
4898
|
+
clear();
|
|
4899
|
+
isPending.value = true;
|
|
4900
|
+
timer = setTimeout(() => {
|
|
4901
|
+
isPending.value = false;
|
|
4902
|
+
timer = null;
|
|
4903
|
+
cb(...args);
|
|
4904
|
+
}, unref(interval));
|
|
4905
|
+
}
|
|
4906
|
+
if (immediate) {
|
|
4907
|
+
isPending.value = true;
|
|
4908
|
+
if (isClient)
|
|
4909
|
+
start();
|
|
4910
|
+
}
|
|
4911
|
+
tryOnScopeDispose(stop);
|
|
4912
|
+
return {
|
|
4913
|
+
isPending,
|
|
4914
|
+
start,
|
|
4915
|
+
stop
|
|
4916
|
+
};
|
|
4917
|
+
}
|
|
4918
|
+
function unrefElement(elRef) {
|
|
4919
|
+
var _a2;
|
|
4920
|
+
const plain = unref(elRef);
|
|
4921
|
+
return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
|
|
4922
|
+
}
|
|
4923
|
+
const defaultWindow = isClient ? window : void 0;
|
|
4924
|
+
isClient ? window.document : void 0;
|
|
4925
|
+
const defaultNavigator = isClient ? window.navigator : void 0;
|
|
4926
|
+
isClient ? window.location : void 0;
|
|
4927
|
+
function useEventListener(...args) {
|
|
4928
|
+
let target;
|
|
4929
|
+
let event;
|
|
4930
|
+
let listener;
|
|
4931
|
+
let options;
|
|
4932
|
+
if (isString(args[0])) {
|
|
4933
|
+
[event, listener, options] = args;
|
|
4934
|
+
target = defaultWindow;
|
|
4935
|
+
} else {
|
|
4936
|
+
[target, event, listener, options] = args;
|
|
4937
|
+
}
|
|
4938
|
+
if (!target)
|
|
4939
|
+
return noop;
|
|
4940
|
+
let cleanup = noop;
|
|
4941
|
+
const stopWatch = watch(() => unrefElement(target), (el) => {
|
|
4942
|
+
cleanup();
|
|
4943
|
+
if (!el)
|
|
4944
|
+
return;
|
|
4945
|
+
el.addEventListener(event, listener, options);
|
|
4946
|
+
cleanup = () => {
|
|
4947
|
+
el.removeEventListener(event, listener, options);
|
|
4948
|
+
cleanup = noop;
|
|
4949
|
+
};
|
|
4950
|
+
}, { immediate: true, flush: "post" });
|
|
4951
|
+
const stop = () => {
|
|
4952
|
+
stopWatch();
|
|
4953
|
+
cleanup();
|
|
4954
|
+
};
|
|
4955
|
+
tryOnScopeDispose(stop);
|
|
4956
|
+
return stop;
|
|
4957
|
+
}
|
|
4958
|
+
function useClipboard(options = {}) {
|
|
4959
|
+
const {
|
|
4960
|
+
navigator: navigator2 = defaultNavigator,
|
|
4961
|
+
read = false,
|
|
4962
|
+
source,
|
|
4963
|
+
copiedDuring = 1500
|
|
4964
|
+
} = options;
|
|
4965
|
+
const events = ["copy", "cut"];
|
|
4966
|
+
const isSupported = Boolean(navigator2 && "clipboard" in navigator2);
|
|
4967
|
+
const text = ref("");
|
|
4968
|
+
const copied = ref(false);
|
|
4969
|
+
const timeout = useTimeoutFn(() => copied.value = false, copiedDuring);
|
|
4970
|
+
function updateText() {
|
|
4971
|
+
navigator2.clipboard.readText().then((value) => {
|
|
4972
|
+
text.value = value;
|
|
4973
|
+
});
|
|
4974
|
+
}
|
|
4975
|
+
if (isSupported && read) {
|
|
4976
|
+
for (const event of events)
|
|
4977
|
+
useEventListener(event, updateText);
|
|
4978
|
+
}
|
|
4979
|
+
async function copy(value = unref(source)) {
|
|
4980
|
+
if (isSupported && value != null) {
|
|
4981
|
+
await navigator2.clipboard.writeText(value);
|
|
4982
|
+
text.value = value;
|
|
4983
|
+
copied.value = true;
|
|
4984
|
+
timeout.start();
|
|
4985
|
+
}
|
|
4986
|
+
}
|
|
4987
|
+
return {
|
|
4988
|
+
isSupported,
|
|
4989
|
+
text,
|
|
4990
|
+
copied,
|
|
4991
|
+
copy
|
|
4992
|
+
};
|
|
4993
|
+
}
|
|
4994
|
+
const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
4995
|
+
const globalKey = "__vueuse_ssr_handlers__";
|
|
4996
|
+
_global[globalKey] = _global[globalKey] || {};
|
|
4997
|
+
_global[globalKey];
|
|
4998
|
+
var _a, _b;
|
|
4999
|
+
isClient && (window == null ? void 0 : window.navigator) && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.platform) && /iP(ad|hone|od)/.test((_b = window == null ? void 0 : window.navigator) == null ? void 0 : _b.platform);
|
|
5000
|
+
const __default__$1 = {
|
|
5001
|
+
name: "HstCopyIcon"
|
|
5002
|
+
};
|
|
5003
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$1), {
|
|
5004
|
+
props: {
|
|
5005
|
+
content: null
|
|
5006
|
+
},
|
|
5007
|
+
setup(__props) {
|
|
5008
|
+
const props = __props;
|
|
5009
|
+
const { copy, copied } = useClipboard();
|
|
5010
|
+
const action = () => copy(props.content);
|
|
5011
|
+
return (_ctx, _cache) => {
|
|
5012
|
+
return withDirectives((openBlock(), createBlock(unref(Icon), {
|
|
5013
|
+
icon: "carbon:copy-file",
|
|
5014
|
+
class: "htw-w-4 htw-h-4 htw-opacity-50 hover:htw-opacity-100 hover:htw-text-primary-500 htw-cursor-pointer",
|
|
5015
|
+
onClick: _cache[0] || (_cache[0] = ($event) => action())
|
|
5016
|
+
}, null, 512)), [
|
|
5017
|
+
[unref(VTooltip), {
|
|
5018
|
+
content: "Copied!",
|
|
5019
|
+
triggers: [],
|
|
5020
|
+
shown: unref(copied),
|
|
5021
|
+
distance: 12,
|
|
5022
|
+
delay: 0
|
|
5023
|
+
}]
|
|
5024
|
+
]);
|
|
5025
|
+
};
|
|
5026
|
+
}
|
|
5027
|
+
}));
|
|
5028
|
+
const _hoisted_1 = {
|
|
5029
|
+
key: 0,
|
|
5030
|
+
class: "htw-grid htw-gap-4 htw-grid-cols-[repeat(auto-fill,minmax(100px,1fr))] htw-m-4"
|
|
5031
|
+
};
|
|
5032
|
+
const _hoisted_2 = { class: "htw-flex htw-gap-1" };
|
|
5033
|
+
const _hoisted_3 = { class: "htw-my-0" };
|
|
5034
|
+
const _hoisted_4 = { class: "htw-flex htw-gap-1" };
|
|
5035
|
+
const _hoisted_5 = { class: "htw-my-0 htw-opacity-50" };
|
|
5036
|
+
const __default__ = {
|
|
5037
|
+
name: "HstColorShades"
|
|
5038
|
+
};
|
|
5039
|
+
const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__), {
|
|
5040
|
+
props: {
|
|
5041
|
+
shades: null,
|
|
5042
|
+
getName: null,
|
|
5043
|
+
search: null
|
|
5044
|
+
},
|
|
5045
|
+
setup(__props) {
|
|
5046
|
+
const props = __props;
|
|
5047
|
+
const shadesWithName = computed(() => {
|
|
5048
|
+
const shades = props.shades;
|
|
5049
|
+
const getName = props.getName;
|
|
5050
|
+
return Object.entries(shades).map(([key, color]) => {
|
|
5051
|
+
const name = getName ? getName(key, color) : key;
|
|
5052
|
+
return {
|
|
5053
|
+
key,
|
|
5054
|
+
color,
|
|
5055
|
+
name
|
|
5056
|
+
};
|
|
5057
|
+
});
|
|
5058
|
+
});
|
|
5059
|
+
const displayedShades = computed(() => {
|
|
5060
|
+
let list = shadesWithName.value;
|
|
5061
|
+
if (props.search) {
|
|
5062
|
+
const reg = new RegExp(props.search, "i");
|
|
5063
|
+
list = list.filter(({ name }) => reg.test(name));
|
|
5064
|
+
}
|
|
5065
|
+
return list;
|
|
5066
|
+
});
|
|
5067
|
+
return (_ctx, _cache) => {
|
|
5068
|
+
return unref(displayedShades).length ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
5069
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(displayedShades), (shade) => {
|
|
5070
|
+
return openBlock(), createElementBlock("div", {
|
|
5071
|
+
key: shade.key,
|
|
5072
|
+
class: "htw-flex htw-flex-col htw-gap-2 htw-group"
|
|
5073
|
+
}, [
|
|
5074
|
+
renderSlot(_ctx.$slots, "default", {
|
|
5075
|
+
color: shade.color
|
|
5076
|
+
}, () => [
|
|
5077
|
+
createElementVNode("div", {
|
|
5078
|
+
class: "htw-rounded-full htw-w-16 htw-h-16",
|
|
5079
|
+
style: normalizeStyle({
|
|
5080
|
+
backgroundColor: shade.color
|
|
5081
|
+
})
|
|
5082
|
+
}, null, 4)
|
|
5083
|
+
]),
|
|
5084
|
+
createElementVNode("div", null, [
|
|
5085
|
+
createElementVNode("div", _hoisted_2, [
|
|
5086
|
+
createElementVNode("pre", _hoisted_3, toDisplayString(shade.name), 1),
|
|
5087
|
+
createVNode(_sfc_main$1, {
|
|
5088
|
+
content: shade.name,
|
|
5089
|
+
class: "htw-hidden group-hover:htw-block"
|
|
5090
|
+
}, null, 8, ["content"])
|
|
5091
|
+
]),
|
|
5092
|
+
createElementVNode("div", _hoisted_4, [
|
|
5093
|
+
createElementVNode("pre", _hoisted_5, toDisplayString(shade.color), 1),
|
|
5094
|
+
createVNode(_sfc_main$1, {
|
|
5095
|
+
content: shade.color,
|
|
5096
|
+
class: "htw-hidden group-hover:htw-block"
|
|
5097
|
+
}, null, 8, ["content"])
|
|
5098
|
+
])
|
|
5099
|
+
])
|
|
5100
|
+
]);
|
|
5101
|
+
}), 128))
|
|
5102
|
+
])) : createCommentVNode("", true);
|
|
5103
|
+
};
|
|
5104
|
+
}
|
|
5105
|
+
}));
|
|
5106
|
+
const HstCheckbox = _sfc_main$5;
|
|
5107
|
+
const HstText = _sfc_main$4;
|
|
5108
|
+
const HstNumber = _sfc_main$3;
|
|
5109
|
+
const HstTextarea = _sfc_main$2;
|
|
5110
|
+
const HstColorShades = _sfc_main;
|
|
5111
|
+
const HstCopyIcon = _sfc_main$1;
|
|
2883
5112
|
function registerVueComponents(app) {
|
|
2884
|
-
app.component("HstCheckbox", _sfc_main$
|
|
2885
|
-
app.component("HstText", _sfc_main$
|
|
2886
|
-
app.component("HstNumber", _sfc_main$
|
|
2887
|
-
app.component("HstTextarea", _sfc_main);
|
|
5113
|
+
app.component("HstCheckbox", _sfc_main$5);
|
|
5114
|
+
app.component("HstText", _sfc_main$4);
|
|
5115
|
+
app.component("HstNumber", _sfc_main$3);
|
|
5116
|
+
app.component("HstTextarea", _sfc_main$2);
|
|
2888
5117
|
}
|
|
2889
|
-
export { HstCheckbox, HstNumber, HstText, HstTextarea, registerVueComponents };
|
|
5118
|
+
export { HstCheckbox, HstColorShades, HstCopyIcon, HstNumber, HstText, HstTextarea, registerVueComponents };
|