@vuu-ui/vuu-utils 0.8.17-debug → 0.8.18-debug
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/cjs/index.js +362 -841
- package/cjs/index.js.map +4 -4
- package/esm/index.js +367 -841
- package/esm/index.js.map +4 -4
- package/package.json +6 -4
- package/types/ThemeProvider.d.ts +32 -0
- package/types/column-utils.d.ts +6 -18
- package/types/component-registry.d.ts +5 -4
- package/types/datasource-action-utils.d.ts +7 -0
- package/types/datasource-utils.d.ts +25 -0
- package/types/date/helpers.d.ts +6 -3
- package/types/date/index.d.ts +2 -1
- package/types/date/types.d.ts +13 -2
- package/types/event-emitter.d.ts +8 -1
- package/types/index.d.ts +6 -1
- package/types/selection-utils.d.ts +2 -2
- package/types/ts-utils.d.ts +1 -0
- package/types/useId.d.ts +1 -0
- package/types/useLayoutEffectSkipFirst.d.ts +2 -0
- package/types/screenshot-utils.d.ts +0 -6
package/esm/index.js
CHANGED
|
@@ -198,9 +198,7 @@ var isNumericColumn = ({ serverDataType, type }) => {
|
|
|
198
198
|
}
|
|
199
199
|
return false;
|
|
200
200
|
};
|
|
201
|
-
var
|
|
202
|
-
var isTimeColumn = ({ type }) => (isTypeDescriptor(type) ? type.name : type) === "time";
|
|
203
|
-
var isDateTimeColumn = (column) => isDateColumn(column) || isTimeColumn(column);
|
|
201
|
+
var isDateTimeColumn = (column) => (isTypeDescriptor(column.type) ? column.type.name : column.type) === "date/time";
|
|
204
202
|
var isPinned = (column) => typeof column.pin === "string";
|
|
205
203
|
var hasHeadings = (column) => Array.isArray(column.heading) && column.heading.length > 0;
|
|
206
204
|
var isResizing = (column) => column.resizing;
|
|
@@ -208,9 +206,6 @@ var isTextColumn = ({ serverDataType }) => serverDataType === void 0 ? false : s
|
|
|
208
206
|
var toColumnDescriptor = (name) => ({
|
|
209
207
|
name
|
|
210
208
|
});
|
|
211
|
-
var isSimpleColumnType = (value) => typeof value === "string" && ["string", "number", "boolean", "json", "date", "time", "checkbox"].includes(
|
|
212
|
-
value
|
|
213
|
-
);
|
|
214
209
|
var isTypeDescriptor = (type) => typeof type !== "undefined" && typeof type !== "string";
|
|
215
210
|
var EMPTY_COLUMN_MAP = {};
|
|
216
211
|
var isColumnTypeRenderer = (renderer) => typeof (renderer == null ? void 0 : renderer.name) !== "undefined";
|
|
@@ -292,14 +287,14 @@ function extractGroupColumn(columns, groupBy, confirmed = true) {
|
|
|
292
287
|
const flattenedColumns = flattenColumnGroup(columns);
|
|
293
288
|
const [groupedColumns, rest] = flattenedColumns.reduce(
|
|
294
289
|
(result, column, i) => {
|
|
295
|
-
const [g,
|
|
290
|
+
const [g, r2] = result;
|
|
296
291
|
if (groupBy.includes(column.name)) {
|
|
297
292
|
g.push({
|
|
298
293
|
...column,
|
|
299
294
|
originalIdx: i
|
|
300
295
|
});
|
|
301
296
|
} else {
|
|
302
|
-
|
|
297
|
+
r2.push(column);
|
|
303
298
|
}
|
|
304
299
|
return result;
|
|
305
300
|
},
|
|
@@ -638,45 +633,20 @@ var getDefaultColumnType = (serverDataType) => {
|
|
|
638
633
|
return "string";
|
|
639
634
|
}
|
|
640
635
|
};
|
|
641
|
-
var
|
|
636
|
+
var updateColumnFormatting = (column, formatting) => {
|
|
642
637
|
const { serverDataType, type = getDefaultColumnType(serverDataType) } = column;
|
|
643
|
-
if (
|
|
644
|
-
return {
|
|
645
|
-
...column,
|
|
646
|
-
type: {
|
|
647
|
-
name: type,
|
|
648
|
-
formatting
|
|
649
|
-
}
|
|
650
|
-
};
|
|
638
|
+
if (isTypeDescriptor(type)) {
|
|
639
|
+
return { ...column, type: { ...type, formatting } };
|
|
651
640
|
} else {
|
|
652
|
-
return {
|
|
653
|
-
...column,
|
|
654
|
-
type: {
|
|
655
|
-
...type,
|
|
656
|
-
formatting
|
|
657
|
-
}
|
|
658
|
-
};
|
|
641
|
+
return { ...column, type: { name: type, formatting } };
|
|
659
642
|
}
|
|
660
643
|
};
|
|
644
|
+
function updateColumnType(column, type) {
|
|
645
|
+
return isTypeDescriptor(column.type) ? { ...column, type: { ...column.type, name: type } } : { ...column, type };
|
|
646
|
+
}
|
|
661
647
|
var updateColumnRenderProps = (column, renderer) => {
|
|
662
|
-
const { serverDataType, type } = column;
|
|
663
|
-
if (type
|
|
664
|
-
return {
|
|
665
|
-
...column,
|
|
666
|
-
type: {
|
|
667
|
-
name: getDefaultColumnType(serverDataType),
|
|
668
|
-
renderer
|
|
669
|
-
}
|
|
670
|
-
};
|
|
671
|
-
} else if (isSimpleColumnType(type)) {
|
|
672
|
-
return {
|
|
673
|
-
...column,
|
|
674
|
-
type: {
|
|
675
|
-
name: type,
|
|
676
|
-
renderer
|
|
677
|
-
}
|
|
678
|
-
};
|
|
679
|
-
} else {
|
|
648
|
+
const { serverDataType, type = getDefaultColumnType(serverDataType) } = column;
|
|
649
|
+
if (isTypeDescriptor(type)) {
|
|
680
650
|
return {
|
|
681
651
|
...column,
|
|
682
652
|
type: {
|
|
@@ -685,6 +655,8 @@ var updateColumnRenderProps = (column, renderer) => {
|
|
|
685
655
|
renderer
|
|
686
656
|
}
|
|
687
657
|
};
|
|
658
|
+
} else {
|
|
659
|
+
return { ...column, type: { name: type, renderer } };
|
|
688
660
|
}
|
|
689
661
|
};
|
|
690
662
|
var NO_TYPE_SETTINGS = {};
|
|
@@ -805,6 +777,7 @@ var getCookieValue = (name) => {
|
|
|
805
777
|
|
|
806
778
|
// src/component-registry.ts
|
|
807
779
|
var cellRenderersMap = /* @__PURE__ */ new Map();
|
|
780
|
+
var columnHeaderRenderersMap = /* @__PURE__ */ new Map();
|
|
808
781
|
var configEditorsMap = /* @__PURE__ */ new Map();
|
|
809
782
|
var cellConfigPanelsMap = /* @__PURE__ */ new Map();
|
|
810
783
|
var editRuleValidatorsMap = /* @__PURE__ */ new Map();
|
|
@@ -819,11 +792,17 @@ var isTypeCompatible = (rendererType, serverDataType) => {
|
|
|
819
792
|
}
|
|
820
793
|
};
|
|
821
794
|
var isCellRenderer = (type, component) => type === "cell-renderer";
|
|
795
|
+
var isColumnHeaderContentRenderer = (type, component) => type === "column-header-content-renderer";
|
|
796
|
+
var isColumnHeaderLabelRenderer = (type, component) => type === "column-header-label-renderer";
|
|
822
797
|
var isCellConfigPanel = (type, component) => type === "cell-config-panel";
|
|
823
798
|
var isEditRuleValidator = (type, component) => type === "data-edit-validator";
|
|
824
799
|
function registerComponent(componentName, component, type = "cell-renderer", options) {
|
|
825
800
|
if (isCellRenderer(type, component)) {
|
|
826
801
|
cellRenderersMap.set(componentName, component);
|
|
802
|
+
} else if (isColumnHeaderContentRenderer(type, component)) {
|
|
803
|
+
columnHeaderRenderersMap.set(componentName, component);
|
|
804
|
+
} else if (isColumnHeaderLabelRenderer(type, component)) {
|
|
805
|
+
columnHeaderRenderersMap.set(componentName, component);
|
|
827
806
|
} else if (isCellConfigPanel(type, component)) {
|
|
828
807
|
cellConfigPanelsMap.set(componentName, component);
|
|
829
808
|
} else if (isEditRuleValidator(type, component)) {
|
|
@@ -851,13 +830,17 @@ var getRegisteredCellRenderers = (serverDataType) => {
|
|
|
851
830
|
}
|
|
852
831
|
};
|
|
853
832
|
var getCellRendererOptions = (renderName) => optionsMap.get(renderName);
|
|
854
|
-
function getCellRenderer(column
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
833
|
+
function getCellRenderer(column) {
|
|
834
|
+
return dataCellRenderer(column);
|
|
835
|
+
}
|
|
836
|
+
function getColumnHeaderContentRenderer(column) {
|
|
837
|
+
if (column.colHeaderContentRenderer) {
|
|
838
|
+
return columnHeaderRenderersMap.get(column.colHeaderContentRenderer);
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
function getColumnHeaderLabelRenderer(column) {
|
|
842
|
+
if (column.colHeaderLabelRenderer) {
|
|
843
|
+
return columnHeaderRenderersMap.get(column.colHeaderLabelRenderer);
|
|
861
844
|
}
|
|
862
845
|
}
|
|
863
846
|
function dataCellRenderer(column) {
|
|
@@ -927,7 +910,7 @@ var rangeNewItems = ({ from: from1, to: to1 }, newRange) => {
|
|
|
927
910
|
const newFullySubsumesOld = from2 < from1 && to2 > to1;
|
|
928
911
|
return noOverlap || newFullySubsumesOld ? newRange : to2 > to1 ? { from: to1, to: to2 } : { from: from2, to: from1 };
|
|
929
912
|
};
|
|
930
|
-
var WindowRange = class {
|
|
913
|
+
var WindowRange = class _WindowRange {
|
|
931
914
|
constructor(from, to) {
|
|
932
915
|
this.from = from;
|
|
933
916
|
this.to = to;
|
|
@@ -940,7 +923,7 @@ var WindowRange = class {
|
|
|
940
923
|
return from >= this.to || to < this.from ? [0, 0] : [Math.max(from, this.from), Math.min(to, this.to)];
|
|
941
924
|
}
|
|
942
925
|
copy() {
|
|
943
|
-
return new
|
|
926
|
+
return new _WindowRange(this.from, this.to);
|
|
944
927
|
}
|
|
945
928
|
};
|
|
946
929
|
|
|
@@ -1071,6 +1054,151 @@ function getMovingValueDirection(newValue, direction, prevValue, decimalPlaces)
|
|
|
1071
1054
|
}
|
|
1072
1055
|
}
|
|
1073
1056
|
|
|
1057
|
+
// src/datasource-action-utils.ts
|
|
1058
|
+
var isVisualLinksAction = (action) => action.type === "vuu-links";
|
|
1059
|
+
var isVisualLinkCreatedAction = (action) => action.type === "vuu-link-created";
|
|
1060
|
+
var isVisualLinkRemovedAction = (action) => action.type === "vuu-link-removed";
|
|
1061
|
+
var isViewportMenusAction = (action) => action.type === "vuu-menu";
|
|
1062
|
+
var isVuuFeatureAction = (action) => isViewportMenusAction(action) || isVisualLinksAction(action);
|
|
1063
|
+
|
|
1064
|
+
// src/datasource-utils.ts
|
|
1065
|
+
var NoFilter = { filter: "" };
|
|
1066
|
+
var NoSort = { sortDefs: [] };
|
|
1067
|
+
var vanillaConfig = {
|
|
1068
|
+
aggregations: [],
|
|
1069
|
+
columns: [],
|
|
1070
|
+
filter: NoFilter,
|
|
1071
|
+
groupBy: [],
|
|
1072
|
+
sort: NoSort
|
|
1073
|
+
};
|
|
1074
|
+
var equivalentAggregations = ({ aggregations: agg1 }, { aggregations: agg2 }) => agg1 === void 0 && (agg2 == null ? void 0 : agg2.length) === 0 || agg2 === void 0 && (agg1 == null ? void 0 : agg1.length) === 0;
|
|
1075
|
+
var equivalentColumns = ({ columns: cols1 }, { columns: cols2 }) => cols1 === void 0 && (cols2 == null ? void 0 : cols2.length) === 0 || cols2 === void 0 && (cols1 == null ? void 0 : cols1.length) === 0;
|
|
1076
|
+
var equivalentFilter = ({ filter: f1 }, { filter: f2 }) => f1 === void 0 && (f2 == null ? void 0 : f2.filter) === "" || f2 === void 0 && (f1 == null ? void 0 : f1.filter) === "";
|
|
1077
|
+
var equivalentGroupBy = ({ groupBy: val1 }, { groupBy: val2 }) => val1 === void 0 && (val2 == null ? void 0 : val2.length) === 0 || val2 === void 0 && (val1 == null ? void 0 : val1.length) === 0;
|
|
1078
|
+
var equivalentSort = ({ sort: s1 }, { sort: s2 }) => s1 === void 0 && (s2 == null ? void 0 : s2.sortDefs.length) === 0 || s2 === void 0 && (s1 == null ? void 0 : s1.sortDefs.length) === 0;
|
|
1079
|
+
var exactlyTheSame = (a, b) => {
|
|
1080
|
+
if (a === b) {
|
|
1081
|
+
return true;
|
|
1082
|
+
} else if (a === void 0 && b === void 0) {
|
|
1083
|
+
return true;
|
|
1084
|
+
} else {
|
|
1085
|
+
return false;
|
|
1086
|
+
}
|
|
1087
|
+
};
|
|
1088
|
+
var aggregationsChanged = (config, newConfig) => {
|
|
1089
|
+
const { aggregations: agg1 } = config;
|
|
1090
|
+
const { aggregations: agg2 } = newConfig;
|
|
1091
|
+
if (exactlyTheSame(agg1, agg2) || equivalentAggregations(config, newConfig)) {
|
|
1092
|
+
return false;
|
|
1093
|
+
} else if (agg1 === void 0 || agg2 === void 0) {
|
|
1094
|
+
return true;
|
|
1095
|
+
} else if (agg1.length !== agg2.length) {
|
|
1096
|
+
return true;
|
|
1097
|
+
}
|
|
1098
|
+
return agg1.some(
|
|
1099
|
+
({ column, aggType }, i) => column !== agg2[i].column || aggType !== agg2[i].aggType
|
|
1100
|
+
);
|
|
1101
|
+
};
|
|
1102
|
+
var columnsChanged = (config, newConfig) => {
|
|
1103
|
+
const { columns: cols1 } = config;
|
|
1104
|
+
const { columns: cols2 } = newConfig;
|
|
1105
|
+
if (exactlyTheSame(cols1, cols2) || equivalentColumns(config, newConfig)) {
|
|
1106
|
+
return false;
|
|
1107
|
+
} else if (cols1 === void 0 || cols2 === void 0) {
|
|
1108
|
+
return true;
|
|
1109
|
+
} else if ((cols1 == null ? void 0 : cols1.length) !== (cols2 == null ? void 0 : cols2.length)) {
|
|
1110
|
+
return true;
|
|
1111
|
+
}
|
|
1112
|
+
return cols1.some((column, i) => column !== (cols2 == null ? void 0 : cols2[i]));
|
|
1113
|
+
};
|
|
1114
|
+
var filterChanged = (c1, c2) => {
|
|
1115
|
+
var _a, _b;
|
|
1116
|
+
if (equivalentFilter(c1, c2)) {
|
|
1117
|
+
return false;
|
|
1118
|
+
} else {
|
|
1119
|
+
return ((_a = c1.filter) == null ? void 0 : _a.filter) !== ((_b = c2.filter) == null ? void 0 : _b.filter);
|
|
1120
|
+
}
|
|
1121
|
+
};
|
|
1122
|
+
var groupByChanged = (config, newConfig) => {
|
|
1123
|
+
const { groupBy: g1 } = config;
|
|
1124
|
+
const { groupBy: g2 } = newConfig;
|
|
1125
|
+
if (exactlyTheSame(g1, g2) || equivalentGroupBy(config, newConfig)) {
|
|
1126
|
+
return false;
|
|
1127
|
+
} else if (g1 === void 0 || g2 === void 0) {
|
|
1128
|
+
return true;
|
|
1129
|
+
} else if ((g1 == null ? void 0 : g1.length) !== (g2 == null ? void 0 : g2.length)) {
|
|
1130
|
+
return true;
|
|
1131
|
+
}
|
|
1132
|
+
return g1.some((column, i) => column !== (g2 == null ? void 0 : g2[i]));
|
|
1133
|
+
};
|
|
1134
|
+
var sortChanged = (config, newConfig) => {
|
|
1135
|
+
const { sort: s1 } = config;
|
|
1136
|
+
const { sort: s2 } = newConfig;
|
|
1137
|
+
if (exactlyTheSame(s1, s2) || equivalentSort(config, newConfig)) {
|
|
1138
|
+
return false;
|
|
1139
|
+
} else if (s1 === void 0 || s2 === void 0) {
|
|
1140
|
+
return true;
|
|
1141
|
+
} else if ((s1 == null ? void 0 : s1.sortDefs.length) !== (s2 == null ? void 0 : s2.sortDefs.length)) {
|
|
1142
|
+
return true;
|
|
1143
|
+
}
|
|
1144
|
+
return s1.sortDefs.some(
|
|
1145
|
+
({ column, sortType }, i) => column !== s2.sortDefs[i].column || sortType !== s2.sortDefs[i].sortType
|
|
1146
|
+
);
|
|
1147
|
+
};
|
|
1148
|
+
var visualLinkChanged = () => {
|
|
1149
|
+
return false;
|
|
1150
|
+
};
|
|
1151
|
+
var configChanged = (config, newConfig) => {
|
|
1152
|
+
if (exactlyTheSame(config, newConfig)) {
|
|
1153
|
+
return false;
|
|
1154
|
+
}
|
|
1155
|
+
if (config === void 0 || newConfig === void 0) {
|
|
1156
|
+
return true;
|
|
1157
|
+
}
|
|
1158
|
+
return aggregationsChanged(config, newConfig) || columnsChanged(config, newConfig) || filterChanged(config, newConfig) || groupByChanged(config, newConfig) || sortChanged(config, newConfig) || visualLinkChanged(config, newConfig);
|
|
1159
|
+
};
|
|
1160
|
+
var hasGroupBy = (config) => config !== void 0 && config.groupBy !== void 0 && config.groupBy.length > 0;
|
|
1161
|
+
var hasFilter = (config) => (config == null ? void 0 : config.filter) !== void 0 && config.filter.filter.length > 0;
|
|
1162
|
+
var hasSort = (config) => {
|
|
1163
|
+
var _a;
|
|
1164
|
+
return (config == null ? void 0 : config.sort) !== void 0 && Array.isArray((_a = config.sort) == null ? void 0 : _a.sortDefs) && config.sort.sortDefs.length > 0;
|
|
1165
|
+
};
|
|
1166
|
+
var isTypeaheadSuggestionProvider = (source) => typeof source["getTypeaheadSuggestions"] === "function";
|
|
1167
|
+
var isTableSchema = (message) => message.type === "TABLE_META_RESP";
|
|
1168
|
+
var isConnectionStatusMessage = (msg) => msg.type === "connection-status";
|
|
1169
|
+
var isConnectionQualityMetrics = (msg) => msg.type === "connection-metrics";
|
|
1170
|
+
var messageHasResult = (msg) => typeof msg.result !== "undefined";
|
|
1171
|
+
var isErrorResponse = (response) => response !== void 0 && "error" in response;
|
|
1172
|
+
var hasAction = (response) => response != void 0 && "action" in response;
|
|
1173
|
+
var isViewporttMessage = (msg) => "viewport" in msg;
|
|
1174
|
+
var withConfigDefaults = (config) => {
|
|
1175
|
+
if (config.aggregations && config.columns && config.filter && config.groupBy && config.sort) {
|
|
1176
|
+
return config;
|
|
1177
|
+
} else {
|
|
1178
|
+
const {
|
|
1179
|
+
aggregations = [],
|
|
1180
|
+
columns = [],
|
|
1181
|
+
filter = { filter: "" },
|
|
1182
|
+
groupBy = [],
|
|
1183
|
+
sort = { sortDefs: [] },
|
|
1184
|
+
visualLink
|
|
1185
|
+
} = config;
|
|
1186
|
+
return {
|
|
1187
|
+
aggregations,
|
|
1188
|
+
columns,
|
|
1189
|
+
filter,
|
|
1190
|
+
groupBy,
|
|
1191
|
+
sort,
|
|
1192
|
+
visualLink
|
|
1193
|
+
};
|
|
1194
|
+
}
|
|
1195
|
+
};
|
|
1196
|
+
|
|
1197
|
+
// src/ts-utils.ts
|
|
1198
|
+
function isNotNullOrUndefined(value) {
|
|
1199
|
+
return value !== void 0 && value !== null;
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1074
1202
|
// src/date/formatter.ts
|
|
1075
1203
|
var baseTimeFormatOptions = {
|
|
1076
1204
|
hour: "2-digit",
|
|
@@ -1094,9 +1222,8 @@ var baseDateFormatOptions = {
|
|
|
1094
1222
|
};
|
|
1095
1223
|
var formatConfigByDatePatterns = {
|
|
1096
1224
|
"dd.mm.yyyy": {
|
|
1097
|
-
locale: "
|
|
1098
|
-
options: { ...baseDateFormatOptions }
|
|
1099
|
-
postProcessor: (s) => s.replaceAll("/", ".")
|
|
1225
|
+
locale: "de-De",
|
|
1226
|
+
options: { ...baseDateFormatOptions }
|
|
1100
1227
|
},
|
|
1101
1228
|
"dd/mm/yyyy": { locale: "en-GB", options: { ...baseDateFormatOptions } },
|
|
1102
1229
|
"dd MMM yyyy": {
|
|
@@ -1117,15 +1244,15 @@ var formatConfigByDatePatterns = {
|
|
|
1117
1244
|
options: { ...baseDateFormatOptions, month: "long" }
|
|
1118
1245
|
}
|
|
1119
1246
|
};
|
|
1120
|
-
|
|
1247
|
+
function getFormatConfigs(pattern) {
|
|
1248
|
+
return [
|
|
1249
|
+
pattern.date ? formatConfigByDatePatterns[pattern.date] : null,
|
|
1250
|
+
pattern.time ? formatConfigByTimePatterns[pattern.time] : null
|
|
1251
|
+
];
|
|
1252
|
+
}
|
|
1121
1253
|
function formatDate(pattern) {
|
|
1122
|
-
const
|
|
1123
|
-
|
|
1124
|
-
return (d) => {
|
|
1125
|
-
const dateStr = dateTimeFormat.format(d);
|
|
1126
|
-
console.log({ dateStr });
|
|
1127
|
-
return postProcessor ? postProcessor(dateStr) : dateStr;
|
|
1128
|
-
};
|
|
1254
|
+
const dateTimeFormats = getFormatConfigs(pattern).filter(isNotNullOrUndefined).map((c) => Intl.DateTimeFormat(c.locale, c.options));
|
|
1255
|
+
return (d) => dateTimeFormats.map((dtf) => dtf.format(d)).join(" ");
|
|
1129
1256
|
}
|
|
1130
1257
|
|
|
1131
1258
|
// src/date/types.ts
|
|
@@ -1139,9 +1266,30 @@ var supportedDatePatterns = [
|
|
|
1139
1266
|
"MMMM dd, yyyy"
|
|
1140
1267
|
];
|
|
1141
1268
|
var supportedTimePatterns = ["hh:mm:ss", "hh:mm:ss a"];
|
|
1269
|
+
var supportedDateTimePatterns = {
|
|
1270
|
+
date: supportedDatePatterns,
|
|
1271
|
+
time: supportedTimePatterns
|
|
1272
|
+
};
|
|
1142
1273
|
var isDatePattern = (pattern) => supportedDatePatterns.includes(pattern);
|
|
1143
1274
|
var isTimePattern = (pattern) => supportedTimePatterns.includes(pattern);
|
|
1144
|
-
var isDateTimePattern = (pattern) => pattern
|
|
1275
|
+
var isDateTimePattern = (pattern) => isDatePattern(pattern == null ? void 0 : pattern.date) || isTimePattern(pattern == null ? void 0 : pattern.time);
|
|
1276
|
+
|
|
1277
|
+
// src/date/helpers.ts
|
|
1278
|
+
var defaultPatternsByType = {
|
|
1279
|
+
time: "hh:mm:ss",
|
|
1280
|
+
date: "dd.mm.yyyy"
|
|
1281
|
+
};
|
|
1282
|
+
var fallbackDateTimePattern = {
|
|
1283
|
+
date: defaultPatternsByType["date"]
|
|
1284
|
+
};
|
|
1285
|
+
function dateTimePattern(type) {
|
|
1286
|
+
if (isTypeDescriptor(type)) {
|
|
1287
|
+
if (type.formatting && isDateTimePattern(type.formatting.pattern)) {
|
|
1288
|
+
return type.formatting.pattern;
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
return fallbackDateTimePattern;
|
|
1292
|
+
}
|
|
1145
1293
|
|
|
1146
1294
|
// src/logging-utils.ts
|
|
1147
1295
|
var logLevels = ["error", "warn", "info", "debug"];
|
|
@@ -1519,19 +1667,6 @@ function roundDecimal(value, align = Align.Right, decimals = 4, zeroPad, alignOn
|
|
|
1519
1667
|
return integral + (fraction ? "." + fraction : "");
|
|
1520
1668
|
}
|
|
1521
1669
|
|
|
1522
|
-
// src/date/helpers.ts
|
|
1523
|
-
var defaultPatternByTypes = { time: "hh:mm:ss", date: "dd.mm.yyyy" };
|
|
1524
|
-
function dateTimePattern(type) {
|
|
1525
|
-
if (isTypeDescriptor(type)) {
|
|
1526
|
-
if (type.formatting && isDateTimePattern(type.formatting.pattern)) {
|
|
1527
|
-
return type.formatting.pattern;
|
|
1528
|
-
}
|
|
1529
|
-
return defaultPatternByTypes[type.name];
|
|
1530
|
-
} else {
|
|
1531
|
-
return defaultPatternByTypes[type];
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
1534
|
-
|
|
1535
1670
|
// src/formatting-utils.ts
|
|
1536
1671
|
var DEFAULT_NUMERIC_FORMAT = {};
|
|
1537
1672
|
var defaultValueFormatter = (value) => value == null ? "" : typeof value === "string" ? value : value.toString();
|
|
@@ -1796,9 +1931,9 @@ var isGroupMenuItemDescriptor = (menuItem) => menuItem !== void 0 && "children"
|
|
|
1796
1931
|
// src/nanoid/index.ts
|
|
1797
1932
|
var uuid = (size2 = 21) => {
|
|
1798
1933
|
let id = "";
|
|
1799
|
-
|
|
1934
|
+
const bytes = crypto.getRandomValues(new Uint8Array(size2));
|
|
1800
1935
|
while (size2--) {
|
|
1801
|
-
|
|
1936
|
+
const byte = bytes[size2] & 63;
|
|
1802
1937
|
if (byte < 36) {
|
|
1803
1938
|
id += byte.toString(36);
|
|
1804
1939
|
} else if (byte < 62) {
|
|
@@ -2146,785 +2281,144 @@ var wordify = (text) => {
|
|
|
2146
2281
|
return `${capitalize(firstWord)} ${rest.join(" ")}`;
|
|
2147
2282
|
};
|
|
2148
2283
|
|
|
2149
|
-
// src/
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
// ../../node_modules/html-to-image/es/util.js
|
|
2157
|
-
function resolveUrl(url, baseUrl) {
|
|
2158
|
-
if (url.match(/^[a-z]+:\/\//i)) {
|
|
2159
|
-
return url;
|
|
2160
|
-
}
|
|
2161
|
-
if (url.match(/^\/\//)) {
|
|
2162
|
-
return window.location.protocol + url;
|
|
2163
|
-
}
|
|
2164
|
-
if (url.match(/^[a-z]+:/i)) {
|
|
2165
|
-
return url;
|
|
2166
|
-
}
|
|
2167
|
-
const doc = document.implementation.createHTMLDocument();
|
|
2168
|
-
const base = doc.createElement("base");
|
|
2169
|
-
const a = doc.createElement("a");
|
|
2170
|
-
doc.head.appendChild(base);
|
|
2171
|
-
doc.body.appendChild(a);
|
|
2172
|
-
if (baseUrl) {
|
|
2173
|
-
base.href = baseUrl;
|
|
2174
|
-
}
|
|
2175
|
-
a.href = url;
|
|
2176
|
-
return a.href;
|
|
2177
|
-
}
|
|
2178
|
-
var uuid2 = (() => {
|
|
2179
|
-
let counter = 0;
|
|
2180
|
-
const random = () => (
|
|
2181
|
-
// eslint-disable-next-line no-bitwise
|
|
2182
|
-
`0000${(Math.random() * 36 ** 4 << 0).toString(36)}`.slice(-4)
|
|
2183
|
-
);
|
|
2184
|
-
return () => {
|
|
2185
|
-
counter += 1;
|
|
2186
|
-
return `u${random()}${counter}`;
|
|
2187
|
-
};
|
|
2188
|
-
})();
|
|
2189
|
-
function toArray(arrayLike) {
|
|
2190
|
-
const arr = [];
|
|
2191
|
-
for (let i = 0, l = arrayLike.length; i < l; i++) {
|
|
2192
|
-
arr.push(arrayLike[i]);
|
|
2193
|
-
}
|
|
2194
|
-
return arr;
|
|
2195
|
-
}
|
|
2196
|
-
function px(node, styleProperty) {
|
|
2197
|
-
const win = node.ownerDocument.defaultView || window;
|
|
2198
|
-
const val = win.getComputedStyle(node).getPropertyValue(styleProperty);
|
|
2199
|
-
return val ? parseFloat(val.replace("px", "")) : 0;
|
|
2200
|
-
}
|
|
2201
|
-
function getNodeWidth(node) {
|
|
2202
|
-
const leftBorder = px(node, "border-left-width");
|
|
2203
|
-
const rightBorder = px(node, "border-right-width");
|
|
2204
|
-
return node.clientWidth + leftBorder + rightBorder;
|
|
2205
|
-
}
|
|
2206
|
-
function getNodeHeight(node) {
|
|
2207
|
-
const topBorder = px(node, "border-top-width");
|
|
2208
|
-
const bottomBorder = px(node, "border-bottom-width");
|
|
2209
|
-
return node.clientHeight + topBorder + bottomBorder;
|
|
2210
|
-
}
|
|
2211
|
-
function getImageSize(targetNode, options = {}) {
|
|
2212
|
-
const width = options.width || getNodeWidth(targetNode);
|
|
2213
|
-
const height = options.height || getNodeHeight(targetNode);
|
|
2214
|
-
return { width, height };
|
|
2215
|
-
}
|
|
2216
|
-
function getPixelRatio() {
|
|
2217
|
-
let ratio;
|
|
2218
|
-
let FINAL_PROCESS;
|
|
2219
|
-
try {
|
|
2220
|
-
FINAL_PROCESS = process;
|
|
2221
|
-
} catch (e) {
|
|
2222
|
-
}
|
|
2223
|
-
const val = FINAL_PROCESS && FINAL_PROCESS.env ? FINAL_PROCESS.env.devicePixelRatio : null;
|
|
2224
|
-
if (val) {
|
|
2225
|
-
ratio = parseInt(val, 10);
|
|
2226
|
-
if (Number.isNaN(ratio)) {
|
|
2227
|
-
ratio = 1;
|
|
2228
|
-
}
|
|
2229
|
-
}
|
|
2230
|
-
return ratio || window.devicePixelRatio || 1;
|
|
2231
|
-
}
|
|
2232
|
-
var canvasDimensionLimit = 16384;
|
|
2233
|
-
function checkCanvasDimensions(canvas) {
|
|
2234
|
-
if (canvas.width > canvasDimensionLimit || canvas.height > canvasDimensionLimit) {
|
|
2235
|
-
if (canvas.width > canvasDimensionLimit && canvas.height > canvasDimensionLimit) {
|
|
2236
|
-
if (canvas.width > canvas.height) {
|
|
2237
|
-
canvas.height *= canvasDimensionLimit / canvas.width;
|
|
2238
|
-
canvas.width = canvasDimensionLimit;
|
|
2239
|
-
} else {
|
|
2240
|
-
canvas.width *= canvasDimensionLimit / canvas.height;
|
|
2241
|
-
canvas.height = canvasDimensionLimit;
|
|
2242
|
-
}
|
|
2243
|
-
} else if (canvas.width > canvasDimensionLimit) {
|
|
2244
|
-
canvas.height *= canvasDimensionLimit / canvas.width;
|
|
2245
|
-
canvas.width = canvasDimensionLimit;
|
|
2246
|
-
} else {
|
|
2247
|
-
canvas.width *= canvasDimensionLimit / canvas.height;
|
|
2248
|
-
canvas.height = canvasDimensionLimit;
|
|
2249
|
-
}
|
|
2250
|
-
}
|
|
2251
|
-
}
|
|
2252
|
-
function createImage(url) {
|
|
2253
|
-
return new Promise((resolve, reject) => {
|
|
2254
|
-
const img = new Image();
|
|
2255
|
-
img.decode = () => resolve(img);
|
|
2256
|
-
img.onload = () => resolve(img);
|
|
2257
|
-
img.onerror = reject;
|
|
2258
|
-
img.crossOrigin = "anonymous";
|
|
2259
|
-
img.decoding = "async";
|
|
2260
|
-
img.src = url;
|
|
2261
|
-
});
|
|
2262
|
-
}
|
|
2263
|
-
async function svgToDataURL(svg) {
|
|
2264
|
-
return Promise.resolve().then(() => new XMLSerializer().serializeToString(svg)).then(encodeURIComponent).then((html) => `data:image/svg+xml;charset=utf-8,${html}`);
|
|
2265
|
-
}
|
|
2266
|
-
async function nodeToDataURL(node, width, height) {
|
|
2267
|
-
const xmlns = "http://www.w3.org/2000/svg";
|
|
2268
|
-
const svg = document.createElementNS(xmlns, "svg");
|
|
2269
|
-
const foreignObject = document.createElementNS(xmlns, "foreignObject");
|
|
2270
|
-
svg.setAttribute("width", `${width}`);
|
|
2271
|
-
svg.setAttribute("height", `${height}`);
|
|
2272
|
-
svg.setAttribute("viewBox", `0 0 ${width} ${height}`);
|
|
2273
|
-
foreignObject.setAttribute("width", "100%");
|
|
2274
|
-
foreignObject.setAttribute("height", "100%");
|
|
2275
|
-
foreignObject.setAttribute("x", "0");
|
|
2276
|
-
foreignObject.setAttribute("y", "0");
|
|
2277
|
-
foreignObject.setAttribute("externalResourcesRequired", "true");
|
|
2278
|
-
svg.appendChild(foreignObject);
|
|
2279
|
-
foreignObject.appendChild(node);
|
|
2280
|
-
return svgToDataURL(svg);
|
|
2281
|
-
}
|
|
2282
|
-
var isInstanceOfElement = (node, instance) => {
|
|
2283
|
-
if (node instanceof instance)
|
|
2284
|
-
return true;
|
|
2285
|
-
const nodePrototype = Object.getPrototypeOf(node);
|
|
2286
|
-
if (nodePrototype === null)
|
|
2287
|
-
return false;
|
|
2288
|
-
return nodePrototype.constructor.name === instance.name || isInstanceOfElement(nodePrototype, instance);
|
|
2289
|
-
};
|
|
2290
|
-
|
|
2291
|
-
// ../../node_modules/html-to-image/es/clone-pseudos.js
|
|
2292
|
-
function formatCSSText(style) {
|
|
2293
|
-
const content = style.getPropertyValue("content");
|
|
2294
|
-
return `${style.cssText} content: '${content.replace(/'|"/g, "")}';`;
|
|
2295
|
-
}
|
|
2296
|
-
function formatCSSProperties(style) {
|
|
2297
|
-
return toArray(style).map((name) => {
|
|
2298
|
-
const value = style.getPropertyValue(name);
|
|
2299
|
-
const priority = style.getPropertyPriority(name);
|
|
2300
|
-
return `${name}: ${value}${priority ? " !important" : ""};`;
|
|
2301
|
-
}).join(" ");
|
|
2302
|
-
}
|
|
2303
|
-
function getPseudoElementStyle(className, pseudo, style) {
|
|
2304
|
-
const selector = `.${className}:${pseudo}`;
|
|
2305
|
-
const cssText = style.cssText ? formatCSSText(style) : formatCSSProperties(style);
|
|
2306
|
-
return document.createTextNode(`${selector}{${cssText}}`);
|
|
2307
|
-
}
|
|
2308
|
-
function clonePseudoElement(nativeNode, clonedNode, pseudo) {
|
|
2309
|
-
const style = window.getComputedStyle(nativeNode, pseudo);
|
|
2310
|
-
const content = style.getPropertyValue("content");
|
|
2311
|
-
if (content === "" || content === "none") {
|
|
2312
|
-
return;
|
|
2313
|
-
}
|
|
2314
|
-
const className = uuid2();
|
|
2315
|
-
try {
|
|
2316
|
-
clonedNode.className = `${clonedNode.className} ${className}`;
|
|
2317
|
-
} catch (err) {
|
|
2318
|
-
return;
|
|
2319
|
-
}
|
|
2320
|
-
const styleElement = document.createElement("style");
|
|
2321
|
-
styleElement.appendChild(getPseudoElementStyle(className, pseudo, style));
|
|
2322
|
-
clonedNode.appendChild(styleElement);
|
|
2323
|
-
}
|
|
2324
|
-
function clonePseudoElements(nativeNode, clonedNode) {
|
|
2325
|
-
clonePseudoElement(nativeNode, clonedNode, ":before");
|
|
2326
|
-
clonePseudoElement(nativeNode, clonedNode, ":after");
|
|
2327
|
-
}
|
|
2328
|
-
|
|
2329
|
-
// ../../node_modules/html-to-image/es/mimes.js
|
|
2330
|
-
var WOFF = "application/font-woff";
|
|
2331
|
-
var JPEG = "image/jpeg";
|
|
2332
|
-
var mimes = {
|
|
2333
|
-
woff: WOFF,
|
|
2334
|
-
woff2: WOFF,
|
|
2335
|
-
ttf: "application/font-truetype",
|
|
2336
|
-
eot: "application/vnd.ms-fontobject",
|
|
2337
|
-
png: "image/png",
|
|
2338
|
-
jpg: JPEG,
|
|
2339
|
-
jpeg: JPEG,
|
|
2340
|
-
gif: "image/gif",
|
|
2341
|
-
tiff: "image/tiff",
|
|
2342
|
-
svg: "image/svg+xml",
|
|
2343
|
-
webp: "image/webp"
|
|
2344
|
-
};
|
|
2345
|
-
function getExtension(url) {
|
|
2346
|
-
const match = /\.([^./]*?)$/g.exec(url);
|
|
2347
|
-
return match ? match[1] : "";
|
|
2348
|
-
}
|
|
2349
|
-
function getMimeType(url) {
|
|
2350
|
-
const extension = getExtension(url).toLowerCase();
|
|
2351
|
-
return mimes[extension] || "";
|
|
2352
|
-
}
|
|
2284
|
+
// src/ThemeProvider.tsx
|
|
2285
|
+
import {
|
|
2286
|
+
createContext,
|
|
2287
|
+
isValidElement,
|
|
2288
|
+
cloneElement,
|
|
2289
|
+
useContext
|
|
2290
|
+
} from "react";
|
|
2353
2291
|
|
|
2354
|
-
// ../../node_modules/
|
|
2355
|
-
function
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
throw new Error(`Resource "${res.url}" not found`);
|
|
2368
|
-
}
|
|
2369
|
-
const blob = await res.blob();
|
|
2370
|
-
return new Promise((resolve, reject) => {
|
|
2371
|
-
const reader = new FileReader();
|
|
2372
|
-
reader.onerror = reject;
|
|
2373
|
-
reader.onloadend = () => {
|
|
2374
|
-
try {
|
|
2375
|
-
resolve(process2({ res, result: reader.result }));
|
|
2376
|
-
} catch (error) {
|
|
2377
|
-
reject(error);
|
|
2378
|
-
}
|
|
2379
|
-
};
|
|
2380
|
-
reader.readAsDataURL(blob);
|
|
2381
|
-
});
|
|
2382
|
-
}
|
|
2383
|
-
var cache = {};
|
|
2384
|
-
function getCacheKey(url, contentType, includeQueryParams) {
|
|
2385
|
-
let key = url.replace(/\?.*/, "");
|
|
2386
|
-
if (includeQueryParams) {
|
|
2387
|
-
key = url;
|
|
2388
|
-
}
|
|
2389
|
-
if (/ttf|otf|eot|woff2?/i.test(key)) {
|
|
2390
|
-
key = key.replace(/.*\//, "");
|
|
2391
|
-
}
|
|
2392
|
-
return contentType ? `[${contentType}]${key}` : key;
|
|
2292
|
+
// ../../node_modules/clsx/dist/clsx.mjs
|
|
2293
|
+
function r(e) {
|
|
2294
|
+
var t, f, n = "";
|
|
2295
|
+
if ("string" == typeof e || "number" == typeof e)
|
|
2296
|
+
n += e;
|
|
2297
|
+
else if ("object" == typeof e)
|
|
2298
|
+
if (Array.isArray(e))
|
|
2299
|
+
for (t = 0; t < e.length; t++)
|
|
2300
|
+
e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
2301
|
+
else
|
|
2302
|
+
for (t in e)
|
|
2303
|
+
e[t] && (n && (n += " "), n += t);
|
|
2304
|
+
return n;
|
|
2393
2305
|
}
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
}
|
|
2399
|
-
if (options.cacheBust) {
|
|
2400
|
-
resourceUrl += (/\?/.test(resourceUrl) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime();
|
|
2401
|
-
}
|
|
2402
|
-
let dataURL;
|
|
2403
|
-
try {
|
|
2404
|
-
const content = await fetchAsDataURL(resourceUrl, options.fetchRequestInit, ({ res, result }) => {
|
|
2405
|
-
if (!contentType) {
|
|
2406
|
-
contentType = res.headers.get("Content-Type") || "";
|
|
2407
|
-
}
|
|
2408
|
-
return getContentFromDataUrl(result);
|
|
2409
|
-
});
|
|
2410
|
-
dataURL = makeDataUrl(content, contentType);
|
|
2411
|
-
} catch (error) {
|
|
2412
|
-
dataURL = options.imagePlaceholder || "";
|
|
2413
|
-
let msg = `Failed to fetch resource: ${resourceUrl}`;
|
|
2414
|
-
if (error) {
|
|
2415
|
-
msg = typeof error === "string" ? error : error.message;
|
|
2416
|
-
}
|
|
2417
|
-
if (msg) {
|
|
2418
|
-
console.warn(msg);
|
|
2419
|
-
}
|
|
2420
|
-
}
|
|
2421
|
-
cache[cacheKey] = dataURL;
|
|
2422
|
-
return dataURL;
|
|
2306
|
+
function clsx() {
|
|
2307
|
+
for (var e, t, f = 0, n = ""; f < arguments.length; )
|
|
2308
|
+
(e = arguments[f++]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
2309
|
+
return n;
|
|
2423
2310
|
}
|
|
2311
|
+
var clsx_default = clsx;
|
|
2424
2312
|
|
|
2425
|
-
//
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2313
|
+
// src/ThemeProvider.tsx
|
|
2314
|
+
import { jsx } from "react/jsx-runtime";
|
|
2315
|
+
var DEFAULT_DENSITY = "medium";
|
|
2316
|
+
var DEFAULT_THEME = "salt-theme";
|
|
2317
|
+
var DEFAULT_THEME_MODE = "light";
|
|
2318
|
+
var ThemeContext = createContext({
|
|
2319
|
+
density: "high",
|
|
2320
|
+
theme: "vuu",
|
|
2321
|
+
themeMode: "light"
|
|
2322
|
+
});
|
|
2323
|
+
var DEFAULT_THEME_ATTRIBUTES = [
|
|
2324
|
+
"vuu",
|
|
2325
|
+
"vuu-density-high",
|
|
2326
|
+
"light"
|
|
2327
|
+
];
|
|
2328
|
+
var useThemeAttributes = (themeAttributes) => {
|
|
2329
|
+
const context = useContext(ThemeContext);
|
|
2330
|
+
if (themeAttributes) {
|
|
2331
|
+
return [
|
|
2332
|
+
themeAttributes.themeClass,
|
|
2333
|
+
themeAttributes.densityClass,
|
|
2334
|
+
themeAttributes.dataMode
|
|
2335
|
+
];
|
|
2336
|
+
} else if (context) {
|
|
2337
|
+
return [
|
|
2338
|
+
`${context.theme}-theme`,
|
|
2339
|
+
`${context.theme}-density-${context.density}`,
|
|
2340
|
+
context.themeMode
|
|
2341
|
+
];
|
|
2430
2342
|
}
|
|
2431
|
-
return
|
|
2432
|
-
}
|
|
2433
|
-
|
|
2434
|
-
if (video.currentSrc) {
|
|
2435
|
-
const canvas = document.createElement("canvas");
|
|
2436
|
-
const ctx = canvas.getContext("2d");
|
|
2437
|
-
canvas.width = video.clientWidth;
|
|
2438
|
-
canvas.height = video.clientHeight;
|
|
2439
|
-
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
2440
|
-
const dataURL2 = canvas.toDataURL();
|
|
2441
|
-
return createImage(dataURL2);
|
|
2442
|
-
}
|
|
2443
|
-
const poster = video.poster;
|
|
2444
|
-
const contentType = getMimeType(poster);
|
|
2445
|
-
const dataURL = await resourceToDataURL(poster, contentType, options);
|
|
2446
|
-
return createImage(dataURL);
|
|
2447
|
-
}
|
|
2448
|
-
async function cloneIFrameElement(iframe) {
|
|
2343
|
+
return DEFAULT_THEME_ATTRIBUTES;
|
|
2344
|
+
};
|
|
2345
|
+
var createThemedChildren = (children, theme, themeMode, density) => {
|
|
2449
2346
|
var _a;
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
}
|
|
2462
|
-
if (isInstanceOfElement(node, HTMLVideoElement)) {
|
|
2463
|
-
return cloneVideoElement(node, options);
|
|
2464
|
-
}
|
|
2465
|
-
if (isInstanceOfElement(node, HTMLIFrameElement)) {
|
|
2466
|
-
return cloneIFrameElement(node);
|
|
2467
|
-
}
|
|
2468
|
-
return node.cloneNode(false);
|
|
2469
|
-
}
|
|
2470
|
-
var isSlotElement = (node) => node.tagName != null && node.tagName.toUpperCase() === "SLOT";
|
|
2471
|
-
async function cloneChildren(nativeNode, clonedNode, options) {
|
|
2472
|
-
var _a, _b;
|
|
2473
|
-
let children = [];
|
|
2474
|
-
if (isSlotElement(nativeNode) && nativeNode.assignedNodes) {
|
|
2475
|
-
children = toArray(nativeNode.assignedNodes());
|
|
2476
|
-
} else if (isInstanceOfElement(nativeNode, HTMLIFrameElement) && ((_a = nativeNode.contentDocument) === null || _a === void 0 ? void 0 : _a.body)) {
|
|
2477
|
-
children = toArray(nativeNode.contentDocument.body.childNodes);
|
|
2478
|
-
} else {
|
|
2479
|
-
children = toArray(((_b = nativeNode.shadowRoot) !== null && _b !== void 0 ? _b : nativeNode).childNodes);
|
|
2480
|
-
}
|
|
2481
|
-
if (children.length === 0 || isInstanceOfElement(nativeNode, HTMLVideoElement)) {
|
|
2482
|
-
return clonedNode;
|
|
2483
|
-
}
|
|
2484
|
-
await children.reduce((deferred, child) => deferred.then(() => cloneNode(child, options)).then((clonedChild) => {
|
|
2485
|
-
if (clonedChild) {
|
|
2486
|
-
clonedNode.appendChild(clonedChild);
|
|
2487
|
-
}
|
|
2488
|
-
}), Promise.resolve());
|
|
2489
|
-
return clonedNode;
|
|
2490
|
-
}
|
|
2491
|
-
function cloneCSSStyle(nativeNode, clonedNode) {
|
|
2492
|
-
const targetStyle = clonedNode.style;
|
|
2493
|
-
if (!targetStyle) {
|
|
2494
|
-
return;
|
|
2495
|
-
}
|
|
2496
|
-
const sourceStyle = window.getComputedStyle(nativeNode);
|
|
2497
|
-
if (sourceStyle.cssText) {
|
|
2498
|
-
targetStyle.cssText = sourceStyle.cssText;
|
|
2499
|
-
targetStyle.transformOrigin = sourceStyle.transformOrigin;
|
|
2500
|
-
} else {
|
|
2501
|
-
toArray(sourceStyle).forEach((name) => {
|
|
2502
|
-
let value = sourceStyle.getPropertyValue(name);
|
|
2503
|
-
if (name === "font-size" && value.endsWith("px")) {
|
|
2504
|
-
const reducedFont = Math.floor(parseFloat(value.substring(0, value.length - 2))) - 0.1;
|
|
2505
|
-
value = `${reducedFont}px`;
|
|
2506
|
-
}
|
|
2507
|
-
if (isInstanceOfElement(nativeNode, HTMLIFrameElement) && name === "display" && value === "inline") {
|
|
2508
|
-
value = "block";
|
|
2509
|
-
}
|
|
2510
|
-
if (name === "d" && clonedNode.getAttribute("d")) {
|
|
2511
|
-
value = `path(${clonedNode.getAttribute("d")})`;
|
|
2512
|
-
}
|
|
2513
|
-
targetStyle.setProperty(name, value, sourceStyle.getPropertyPriority(name));
|
|
2347
|
+
if (isValidElement(children)) {
|
|
2348
|
+
return cloneElement(children, {
|
|
2349
|
+
className: clsx_default(
|
|
2350
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
2351
|
+
(_a = children.props) == null ? void 0 : _a.className,
|
|
2352
|
+
`${theme}-theme`,
|
|
2353
|
+
`${theme}-density-${density}`
|
|
2354
|
+
),
|
|
2355
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2356
|
+
// @ts-expect-error
|
|
2357
|
+
"data-mode": themeMode
|
|
2514
2358
|
});
|
|
2359
|
+
} else {
|
|
2360
|
+
console.warn(
|
|
2361
|
+
`
|
|
2362
|
+
ThemeProvider can only apply CSS classes for theming to a single nested child element of the ThemeProvider.
|
|
2363
|
+
Wrap elements with a single container`
|
|
2364
|
+
);
|
|
2365
|
+
return children;
|
|
2515
2366
|
}
|
|
2516
|
-
}
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
clonePseudoElements(nativeNode, clonedNode);
|
|
2538
|
-
cloneInputValue(nativeNode, clonedNode);
|
|
2539
|
-
cloneSelectValue(nativeNode, clonedNode);
|
|
2540
|
-
}
|
|
2541
|
-
return clonedNode;
|
|
2542
|
-
}
|
|
2543
|
-
async function ensureSVGSymbols(clone, options) {
|
|
2544
|
-
const uses = clone.querySelectorAll ? clone.querySelectorAll("use") : [];
|
|
2545
|
-
if (uses.length === 0) {
|
|
2546
|
-
return clone;
|
|
2547
|
-
}
|
|
2548
|
-
const processedDefs = {};
|
|
2549
|
-
for (let i = 0; i < uses.length; i++) {
|
|
2550
|
-
const use = uses[i];
|
|
2551
|
-
const id = use.getAttribute("xlink:href");
|
|
2552
|
-
if (id) {
|
|
2553
|
-
const exist = clone.querySelector(id);
|
|
2554
|
-
const definition = document.querySelector(id);
|
|
2555
|
-
if (!exist && definition && !processedDefs[id]) {
|
|
2556
|
-
processedDefs[id] = await cloneNode(definition, options, true);
|
|
2557
|
-
}
|
|
2558
|
-
}
|
|
2559
|
-
}
|
|
2560
|
-
const nodes = Object.values(processedDefs);
|
|
2561
|
-
if (nodes.length) {
|
|
2562
|
-
const ns = "http://www.w3.org/1999/xhtml";
|
|
2563
|
-
const svg = document.createElementNS(ns, "svg");
|
|
2564
|
-
svg.setAttribute("xmlns", ns);
|
|
2565
|
-
svg.style.position = "absolute";
|
|
2566
|
-
svg.style.width = "0";
|
|
2567
|
-
svg.style.height = "0";
|
|
2568
|
-
svg.style.overflow = "hidden";
|
|
2569
|
-
svg.style.display = "none";
|
|
2570
|
-
const defs = document.createElementNS(ns, "defs");
|
|
2571
|
-
svg.appendChild(defs);
|
|
2572
|
-
for (let i = 0; i < nodes.length; i++) {
|
|
2573
|
-
defs.appendChild(nodes[i]);
|
|
2574
|
-
}
|
|
2575
|
-
clone.appendChild(svg);
|
|
2576
|
-
}
|
|
2577
|
-
return clone;
|
|
2578
|
-
}
|
|
2579
|
-
async function cloneNode(node, options, isRoot) {
|
|
2580
|
-
if (!isRoot && options.filter && !options.filter(node)) {
|
|
2581
|
-
return null;
|
|
2582
|
-
}
|
|
2583
|
-
return Promise.resolve(node).then((clonedNode) => cloneSingleNode(clonedNode, options)).then((clonedNode) => cloneChildren(node, clonedNode, options)).then((clonedNode) => decorate(node, clonedNode)).then((clonedNode) => ensureSVGSymbols(clonedNode, options));
|
|
2584
|
-
}
|
|
2585
|
-
|
|
2586
|
-
// ../../node_modules/html-to-image/es/embed-resources.js
|
|
2587
|
-
var URL_REGEX = /url\((['"]?)([^'"]+?)\1\)/g;
|
|
2588
|
-
var URL_WITH_FORMAT_REGEX = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g;
|
|
2589
|
-
var FONT_SRC_REGEX = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
2590
|
-
function toRegex(url) {
|
|
2591
|
-
const escaped = url.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
|
|
2592
|
-
return new RegExp(`(url\\(['"]?)(${escaped})(['"]?\\))`, "g");
|
|
2593
|
-
}
|
|
2594
|
-
function parseURLs(cssText) {
|
|
2595
|
-
const urls = [];
|
|
2596
|
-
cssText.replace(URL_REGEX, (raw, quotation, url) => {
|
|
2597
|
-
urls.push(url);
|
|
2598
|
-
return raw;
|
|
2599
|
-
});
|
|
2600
|
-
return urls.filter((url) => !isDataUrl(url));
|
|
2601
|
-
}
|
|
2602
|
-
async function embed(cssText, resourceURL, baseURL, options, getContentFromUrl) {
|
|
2603
|
-
try {
|
|
2604
|
-
const resolvedURL = baseURL ? resolveUrl(resourceURL, baseURL) : resourceURL;
|
|
2605
|
-
const contentType = getMimeType(resourceURL);
|
|
2606
|
-
let dataURL;
|
|
2607
|
-
if (getContentFromUrl) {
|
|
2608
|
-
const content = await getContentFromUrl(resolvedURL);
|
|
2609
|
-
dataURL = makeDataUrl(content, contentType);
|
|
2610
|
-
} else {
|
|
2611
|
-
dataURL = await resourceToDataURL(resolvedURL, contentType, options);
|
|
2612
|
-
}
|
|
2613
|
-
return cssText.replace(toRegex(resourceURL), `$1${dataURL}$3`);
|
|
2614
|
-
} catch (error) {
|
|
2615
|
-
}
|
|
2616
|
-
return cssText;
|
|
2617
|
-
}
|
|
2618
|
-
function filterPreferredFontFormat(str, { preferredFontFormat }) {
|
|
2619
|
-
return !preferredFontFormat ? str : str.replace(FONT_SRC_REGEX, (match) => {
|
|
2620
|
-
while (true) {
|
|
2621
|
-
const [src, , format] = URL_WITH_FORMAT_REGEX.exec(match) || [];
|
|
2622
|
-
if (!format) {
|
|
2623
|
-
return "";
|
|
2624
|
-
}
|
|
2625
|
-
if (format === preferredFontFormat) {
|
|
2626
|
-
return `src: ${src};`;
|
|
2627
|
-
}
|
|
2628
|
-
}
|
|
2629
|
-
});
|
|
2630
|
-
}
|
|
2631
|
-
function shouldEmbed(url) {
|
|
2632
|
-
return url.search(URL_REGEX) !== -1;
|
|
2633
|
-
}
|
|
2634
|
-
async function embedResources(cssText, baseUrl, options) {
|
|
2635
|
-
if (!shouldEmbed(cssText)) {
|
|
2636
|
-
return cssText;
|
|
2637
|
-
}
|
|
2638
|
-
const filteredCSSText = filterPreferredFontFormat(cssText, options);
|
|
2639
|
-
const urls = parseURLs(filteredCSSText);
|
|
2640
|
-
return urls.reduce((deferred, url) => deferred.then((css) => embed(css, url, baseUrl, options)), Promise.resolve(filteredCSSText));
|
|
2641
|
-
}
|
|
2367
|
+
};
|
|
2368
|
+
var ThemeProvider = ({
|
|
2369
|
+
applyThemeClasses = false,
|
|
2370
|
+
children,
|
|
2371
|
+
theme: themeProp,
|
|
2372
|
+
themeMode: themeModeProp,
|
|
2373
|
+
density: densityProp
|
|
2374
|
+
}) => {
|
|
2375
|
+
var _a, _b, _c;
|
|
2376
|
+
const {
|
|
2377
|
+
density: inheritedDensity,
|
|
2378
|
+
themeMode: inheritedThemeMode,
|
|
2379
|
+
theme: inheritedTheme
|
|
2380
|
+
} = useContext(ThemeContext);
|
|
2381
|
+
const density = (_a = densityProp != null ? densityProp : inheritedDensity) != null ? _a : DEFAULT_DENSITY;
|
|
2382
|
+
const themeMode = (_b = themeModeProp != null ? themeModeProp : inheritedThemeMode) != null ? _b : DEFAULT_THEME_MODE;
|
|
2383
|
+
const theme = (_c = themeProp != null ? themeProp : inheritedTheme) != null ? _c : DEFAULT_THEME;
|
|
2384
|
+
const themedChildren = applyThemeClasses ? createThemedChildren(children, theme, themeMode, density) : children;
|
|
2385
|
+
return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: { themeMode, density, theme }, children: themedChildren });
|
|
2386
|
+
};
|
|
2387
|
+
ThemeProvider.displayName = "ThemeProvider";
|
|
2642
2388
|
|
|
2643
|
-
//
|
|
2644
|
-
|
|
2389
|
+
// src/url-utils.ts
|
|
2390
|
+
var getUrlParameter = (paramName, defaultValue) => {
|
|
2645
2391
|
var _a;
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
node.style.setProperty(propName, cssString, node.style.getPropertyPriority(propName));
|
|
2650
|
-
return true;
|
|
2651
|
-
}
|
|
2652
|
-
return false;
|
|
2653
|
-
}
|
|
2654
|
-
async function embedBackground(clonedNode, options) {
|
|
2655
|
-
if (!await embedProp("background", clonedNode, options)) {
|
|
2656
|
-
await embedProp("background-image", clonedNode, options);
|
|
2657
|
-
}
|
|
2658
|
-
if (!await embedProp("mask", clonedNode, options)) {
|
|
2659
|
-
await embedProp("mask-image", clonedNode, options);
|
|
2660
|
-
}
|
|
2661
|
-
}
|
|
2662
|
-
async function embedImageNode(clonedNode, options) {
|
|
2663
|
-
const isImageElement = isInstanceOfElement(clonedNode, HTMLImageElement);
|
|
2664
|
-
if (!(isImageElement && !isDataUrl(clonedNode.src)) && !(isInstanceOfElement(clonedNode, SVGImageElement) && !isDataUrl(clonedNode.href.baseVal))) {
|
|
2665
|
-
return;
|
|
2666
|
-
}
|
|
2667
|
-
const url = isImageElement ? clonedNode.src : clonedNode.href.baseVal;
|
|
2668
|
-
const dataURL = await resourceToDataURL(url, getMimeType(url), options);
|
|
2669
|
-
await new Promise((resolve, reject) => {
|
|
2670
|
-
clonedNode.onload = resolve;
|
|
2671
|
-
clonedNode.onerror = reject;
|
|
2672
|
-
const image = clonedNode;
|
|
2673
|
-
if (image.decode) {
|
|
2674
|
-
image.decode = resolve;
|
|
2675
|
-
}
|
|
2676
|
-
if (image.loading === "lazy") {
|
|
2677
|
-
image.loading = "eager";
|
|
2678
|
-
}
|
|
2679
|
-
if (isImageElement) {
|
|
2680
|
-
clonedNode.srcset = "";
|
|
2681
|
-
clonedNode.src = dataURL;
|
|
2682
|
-
} else {
|
|
2683
|
-
clonedNode.href.baseVal = dataURL;
|
|
2684
|
-
}
|
|
2685
|
-
});
|
|
2686
|
-
}
|
|
2687
|
-
async function embedChildren(clonedNode, options) {
|
|
2688
|
-
const children = toArray(clonedNode.childNodes);
|
|
2689
|
-
const deferreds = children.map((child) => embedImages(child, options));
|
|
2690
|
-
await Promise.all(deferreds).then(() => clonedNode);
|
|
2691
|
-
}
|
|
2692
|
-
async function embedImages(clonedNode, options) {
|
|
2693
|
-
if (isInstanceOfElement(clonedNode, Element)) {
|
|
2694
|
-
await embedBackground(clonedNode, options);
|
|
2695
|
-
await embedImageNode(clonedNode, options);
|
|
2696
|
-
await embedChildren(clonedNode, options);
|
|
2697
|
-
}
|
|
2698
|
-
}
|
|
2392
|
+
return (_a = new URL(document.location.href).searchParams.get(paramName)) != null ? _a : defaultValue;
|
|
2393
|
+
};
|
|
2394
|
+
var hasUrlParameter = (paramName) => new URL(document.location.href).searchParams.has(paramName);
|
|
2699
2395
|
|
|
2700
|
-
//
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
style.backgroundColor = options.backgroundColor;
|
|
2705
|
-
}
|
|
2706
|
-
if (options.width) {
|
|
2707
|
-
style.width = `${options.width}px`;
|
|
2708
|
-
}
|
|
2709
|
-
if (options.height) {
|
|
2710
|
-
style.height = `${options.height}px`;
|
|
2711
|
-
}
|
|
2712
|
-
const manual = options.style;
|
|
2713
|
-
if (manual != null) {
|
|
2714
|
-
Object.keys(manual).forEach((key) => {
|
|
2715
|
-
style[key] = manual[key];
|
|
2716
|
-
});
|
|
2717
|
-
}
|
|
2718
|
-
return node;
|
|
2719
|
-
}
|
|
2396
|
+
// src/useId.ts
|
|
2397
|
+
import { useMemo } from "react";
|
|
2398
|
+
var vuuComponentIdCount = 0;
|
|
2399
|
+
var useId = (id) => useMemo(() => id != null ? id : `vuu-${++vuuComponentIdCount}`, [id]);
|
|
2720
2400
|
|
|
2721
|
-
//
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
const res = await fetch(url);
|
|
2729
|
-
const cssText = await res.text();
|
|
2730
|
-
cache2 = { url, cssText };
|
|
2731
|
-
cssFetchCache[url] = cache2;
|
|
2732
|
-
return cache2;
|
|
2733
|
-
}
|
|
2734
|
-
async function embedFonts(data, options) {
|
|
2735
|
-
let cssText = data.cssText;
|
|
2736
|
-
const regexUrl = /url\(["']?([^"')]+)["']?\)/g;
|
|
2737
|
-
const fontLocs = cssText.match(/url\([^)]+\)/g) || [];
|
|
2738
|
-
const loadFonts = fontLocs.map(async (loc) => {
|
|
2739
|
-
let url = loc.replace(regexUrl, "$1");
|
|
2740
|
-
if (!url.startsWith("https://")) {
|
|
2741
|
-
url = new URL(url, data.url).href;
|
|
2742
|
-
}
|
|
2743
|
-
return fetchAsDataURL(url, options.fetchRequestInit, ({ result }) => {
|
|
2744
|
-
cssText = cssText.replace(loc, `url(${result})`);
|
|
2745
|
-
return [loc, result];
|
|
2746
|
-
});
|
|
2747
|
-
});
|
|
2748
|
-
return Promise.all(loadFonts).then(() => cssText);
|
|
2749
|
-
}
|
|
2750
|
-
function parseCSS(source) {
|
|
2751
|
-
if (source == null) {
|
|
2752
|
-
return [];
|
|
2753
|
-
}
|
|
2754
|
-
const result = [];
|
|
2755
|
-
const commentsRegex = /(\/\*[\s\S]*?\*\/)/gi;
|
|
2756
|
-
let cssText = source.replace(commentsRegex, "");
|
|
2757
|
-
const keyframesRegex = new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi");
|
|
2758
|
-
while (true) {
|
|
2759
|
-
const matches = keyframesRegex.exec(cssText);
|
|
2760
|
-
if (matches === null) {
|
|
2761
|
-
break;
|
|
2762
|
-
}
|
|
2763
|
-
result.push(matches[0]);
|
|
2764
|
-
}
|
|
2765
|
-
cssText = cssText.replace(keyframesRegex, "");
|
|
2766
|
-
const importRegex = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi;
|
|
2767
|
-
const combinedCSSRegex = "((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})";
|
|
2768
|
-
const unifiedRegex = new RegExp(combinedCSSRegex, "gi");
|
|
2769
|
-
while (true) {
|
|
2770
|
-
let matches = importRegex.exec(cssText);
|
|
2771
|
-
if (matches === null) {
|
|
2772
|
-
matches = unifiedRegex.exec(cssText);
|
|
2773
|
-
if (matches === null) {
|
|
2774
|
-
break;
|
|
2775
|
-
} else {
|
|
2776
|
-
importRegex.lastIndex = unifiedRegex.lastIndex;
|
|
2777
|
-
}
|
|
2401
|
+
// src/useLayoutEffectSkipFirst.ts
|
|
2402
|
+
import { useLayoutEffect, useRef } from "react";
|
|
2403
|
+
var useLayoutEffectSkipFirst = (func, deps) => {
|
|
2404
|
+
const goodToGo = useRef(false);
|
|
2405
|
+
useLayoutEffect(() => {
|
|
2406
|
+
if (goodToGo.current) {
|
|
2407
|
+
func();
|
|
2778
2408
|
} else {
|
|
2779
|
-
|
|
2780
|
-
}
|
|
2781
|
-
result.push(matches[0]);
|
|
2782
|
-
}
|
|
2783
|
-
return result;
|
|
2784
|
-
}
|
|
2785
|
-
async function getCSSRules(styleSheets, options) {
|
|
2786
|
-
const ret = [];
|
|
2787
|
-
const deferreds = [];
|
|
2788
|
-
styleSheets.forEach((sheet) => {
|
|
2789
|
-
if ("cssRules" in sheet) {
|
|
2790
|
-
try {
|
|
2791
|
-
toArray(sheet.cssRules || []).forEach((item, index) => {
|
|
2792
|
-
if (item.type === CSSRule.IMPORT_RULE) {
|
|
2793
|
-
let importIndex = index + 1;
|
|
2794
|
-
const url = item.href;
|
|
2795
|
-
const deferred = fetchCSS(url).then((metadata) => embedFonts(metadata, options)).then((cssText) => parseCSS(cssText).forEach((rule) => {
|
|
2796
|
-
try {
|
|
2797
|
-
sheet.insertRule(rule, rule.startsWith("@import") ? importIndex += 1 : sheet.cssRules.length);
|
|
2798
|
-
} catch (error) {
|
|
2799
|
-
console.error("Error inserting rule from remote css", {
|
|
2800
|
-
rule,
|
|
2801
|
-
error
|
|
2802
|
-
});
|
|
2803
|
-
}
|
|
2804
|
-
})).catch((e) => {
|
|
2805
|
-
console.error("Error loading remote css", e.toString());
|
|
2806
|
-
});
|
|
2807
|
-
deferreds.push(deferred);
|
|
2808
|
-
}
|
|
2809
|
-
});
|
|
2810
|
-
} catch (e) {
|
|
2811
|
-
const inline = styleSheets.find((a) => a.href == null) || document.styleSheets[0];
|
|
2812
|
-
if (sheet.href != null) {
|
|
2813
|
-
deferreds.push(fetchCSS(sheet.href).then((metadata) => embedFonts(metadata, options)).then((cssText) => parseCSS(cssText).forEach((rule) => {
|
|
2814
|
-
inline.insertRule(rule, sheet.cssRules.length);
|
|
2815
|
-
})).catch((err) => {
|
|
2816
|
-
console.error("Error loading remote stylesheet", err);
|
|
2817
|
-
}));
|
|
2818
|
-
}
|
|
2819
|
-
console.error("Error inlining remote css file", e);
|
|
2820
|
-
}
|
|
2409
|
+
goodToGo.current = true;
|
|
2821
2410
|
}
|
|
2822
|
-
});
|
|
2823
|
-
|
|
2824
|
-
styleSheets.forEach((sheet) => {
|
|
2825
|
-
if ("cssRules" in sheet) {
|
|
2826
|
-
try {
|
|
2827
|
-
toArray(sheet.cssRules || []).forEach((item) => {
|
|
2828
|
-
ret.push(item);
|
|
2829
|
-
});
|
|
2830
|
-
} catch (e) {
|
|
2831
|
-
console.error(`Error while reading CSS rules from ${sheet.href}`, e);
|
|
2832
|
-
}
|
|
2833
|
-
}
|
|
2834
|
-
});
|
|
2835
|
-
return ret;
|
|
2836
|
-
});
|
|
2837
|
-
}
|
|
2838
|
-
function getWebFontRules(cssRules) {
|
|
2839
|
-
return cssRules.filter((rule) => rule.type === CSSRule.FONT_FACE_RULE).filter((rule) => shouldEmbed(rule.style.getPropertyValue("src")));
|
|
2840
|
-
}
|
|
2841
|
-
async function parseWebFontRules(node, options) {
|
|
2842
|
-
if (node.ownerDocument == null) {
|
|
2843
|
-
throw new Error("Provided element is not within a Document");
|
|
2844
|
-
}
|
|
2845
|
-
const styleSheets = toArray(node.ownerDocument.styleSheets);
|
|
2846
|
-
const cssRules = await getCSSRules(styleSheets, options);
|
|
2847
|
-
return getWebFontRules(cssRules);
|
|
2848
|
-
}
|
|
2849
|
-
async function getWebFontCSS(node, options) {
|
|
2850
|
-
const rules = await parseWebFontRules(node, options);
|
|
2851
|
-
const cssTexts = await Promise.all(rules.map((rule) => {
|
|
2852
|
-
const baseUrl = rule.parentStyleSheet ? rule.parentStyleSheet.href : null;
|
|
2853
|
-
return embedResources(rule.cssText, baseUrl, options);
|
|
2854
|
-
}));
|
|
2855
|
-
return cssTexts.join("\n");
|
|
2856
|
-
}
|
|
2857
|
-
async function embedWebFonts(clonedNode, options) {
|
|
2858
|
-
const cssText = options.fontEmbedCSS != null ? options.fontEmbedCSS : options.skipFonts ? null : await getWebFontCSS(clonedNode, options);
|
|
2859
|
-
if (cssText) {
|
|
2860
|
-
const styleNode = document.createElement("style");
|
|
2861
|
-
const sytleContent = document.createTextNode(cssText);
|
|
2862
|
-
styleNode.appendChild(sytleContent);
|
|
2863
|
-
if (clonedNode.firstChild) {
|
|
2864
|
-
clonedNode.insertBefore(styleNode, clonedNode.firstChild);
|
|
2865
|
-
} else {
|
|
2866
|
-
clonedNode.appendChild(styleNode);
|
|
2867
|
-
}
|
|
2868
|
-
}
|
|
2869
|
-
}
|
|
2870
|
-
|
|
2871
|
-
// ../../node_modules/html-to-image/es/index.js
|
|
2872
|
-
async function toSvg(node, options = {}) {
|
|
2873
|
-
const { width, height } = getImageSize(node, options);
|
|
2874
|
-
const clonedNode = await cloneNode(node, options, true);
|
|
2875
|
-
await embedWebFonts(clonedNode, options);
|
|
2876
|
-
await embedImages(clonedNode, options);
|
|
2877
|
-
applyStyle(clonedNode, options);
|
|
2878
|
-
const datauri = await nodeToDataURL(clonedNode, width, height);
|
|
2879
|
-
return datauri;
|
|
2880
|
-
}
|
|
2881
|
-
async function toCanvas(node, options = {}) {
|
|
2882
|
-
const { width, height } = getImageSize(node, options);
|
|
2883
|
-
const svg = await toSvg(node, options);
|
|
2884
|
-
const img = await createImage(svg);
|
|
2885
|
-
const canvas = document.createElement("canvas");
|
|
2886
|
-
const context = canvas.getContext("2d");
|
|
2887
|
-
const ratio = options.pixelRatio || getPixelRatio();
|
|
2888
|
-
const canvasWidth = options.canvasWidth || width;
|
|
2889
|
-
const canvasHeight = options.canvasHeight || height;
|
|
2890
|
-
canvas.width = canvasWidth * ratio;
|
|
2891
|
-
canvas.height = canvasHeight * ratio;
|
|
2892
|
-
if (!options.skipAutoScale) {
|
|
2893
|
-
checkCanvasDimensions(canvas);
|
|
2894
|
-
}
|
|
2895
|
-
canvas.style.width = `${canvasWidth}`;
|
|
2896
|
-
canvas.style.height = `${canvasHeight}`;
|
|
2897
|
-
if (options.backgroundColor) {
|
|
2898
|
-
context.fillStyle = options.backgroundColor;
|
|
2899
|
-
context.fillRect(0, 0, canvas.width, canvas.height);
|
|
2900
|
-
}
|
|
2901
|
-
context.drawImage(img, 0, 0, canvas.width, canvas.height);
|
|
2902
|
-
return canvas;
|
|
2903
|
-
}
|
|
2904
|
-
async function toPng(node, options = {}) {
|
|
2905
|
-
const canvas = await toCanvas(node, options);
|
|
2906
|
-
return canvas.toDataURL();
|
|
2907
|
-
}
|
|
2908
|
-
|
|
2909
|
-
// src/screenshot-utils.ts
|
|
2910
|
-
async function takeScreenshot(node) {
|
|
2911
|
-
const screenshot = await toPng(node, { cacheBust: true }).then((dataUrl) => {
|
|
2912
|
-
return dataUrl;
|
|
2913
|
-
}).catch((err) => {
|
|
2914
|
-
console.error("Error taking screenshot", err);
|
|
2915
|
-
return void 0;
|
|
2916
|
-
});
|
|
2917
|
-
if (!screenshot) {
|
|
2918
|
-
return void 0;
|
|
2919
|
-
}
|
|
2920
|
-
return screenshot;
|
|
2921
|
-
}
|
|
2411
|
+
}, deps);
|
|
2412
|
+
};
|
|
2922
2413
|
export {
|
|
2923
2414
|
AggregationType,
|
|
2924
2415
|
ArrowDown,
|
|
2925
2416
|
ArrowLeft,
|
|
2926
2417
|
ArrowRight,
|
|
2927
2418
|
ArrowUp,
|
|
2419
|
+
DEFAULT_DENSITY,
|
|
2420
|
+
DEFAULT_THEME,
|
|
2421
|
+
DEFAULT_THEME_MODE,
|
|
2928
2422
|
DOWN1,
|
|
2929
2423
|
DOWN2,
|
|
2930
2424
|
DataWindow,
|
|
@@ -2936,12 +2430,16 @@ export {
|
|
|
2936
2430
|
KeySet,
|
|
2937
2431
|
MEASURES,
|
|
2938
2432
|
NULL_RANGE,
|
|
2433
|
+
NoFilter,
|
|
2434
|
+
NoSort,
|
|
2939
2435
|
PageDown,
|
|
2940
2436
|
PageUp,
|
|
2941
2437
|
RangeMonitor,
|
|
2942
2438
|
RowSelected,
|
|
2943
2439
|
Space2 as Space,
|
|
2944
2440
|
Tab,
|
|
2441
|
+
ThemeContext,
|
|
2442
|
+
ThemeProvider,
|
|
2945
2443
|
UP1,
|
|
2946
2444
|
UP2,
|
|
2947
2445
|
WindowRange,
|
|
@@ -2956,8 +2454,11 @@ export {
|
|
|
2956
2454
|
applySortToColumns,
|
|
2957
2455
|
boxContainsPoint,
|
|
2958
2456
|
buildColumnMap,
|
|
2457
|
+
columnsChanged,
|
|
2458
|
+
configChanged,
|
|
2959
2459
|
createEl,
|
|
2960
2460
|
debounce,
|
|
2461
|
+
defaultPatternsByType,
|
|
2961
2462
|
defaultValueFormatter,
|
|
2962
2463
|
deselectItem,
|
|
2963
2464
|
dispatchCustomEvent,
|
|
@@ -2965,7 +2466,9 @@ export {
|
|
|
2965
2466
|
expandSelection,
|
|
2966
2467
|
extractFilterForColumn,
|
|
2967
2468
|
extractGroupColumn,
|
|
2469
|
+
fallbackDateTimePattern,
|
|
2968
2470
|
filterAsQuery,
|
|
2471
|
+
filterChanged,
|
|
2969
2472
|
filterValue,
|
|
2970
2473
|
findColumn,
|
|
2971
2474
|
flattenColumnGroup,
|
|
@@ -2982,6 +2485,8 @@ export {
|
|
|
2982
2485
|
getCellRendererOptions,
|
|
2983
2486
|
getClosest,
|
|
2984
2487
|
getClosestIndexItem,
|
|
2488
|
+
getColumnHeaderContentRenderer,
|
|
2489
|
+
getColumnHeaderLabelRenderer,
|
|
2985
2490
|
getColumnLabel,
|
|
2986
2491
|
getColumnName,
|
|
2987
2492
|
getColumnStyle,
|
|
@@ -3008,7 +2513,12 @@ export {
|
|
|
3008
2513
|
getUniqueId,
|
|
3009
2514
|
getUrlParameter,
|
|
3010
2515
|
getValueFormatter,
|
|
2516
|
+
groupByChanged,
|
|
2517
|
+
hasAction,
|
|
2518
|
+
hasFilter,
|
|
2519
|
+
hasGroupBy,
|
|
3011
2520
|
hasHeadings,
|
|
2521
|
+
hasSort,
|
|
3012
2522
|
hasUrlParameter,
|
|
3013
2523
|
hasValidationRules,
|
|
3014
2524
|
invariant,
|
|
@@ -3017,10 +2527,12 @@ export {
|
|
|
3017
2527
|
isCharacterKey,
|
|
3018
2528
|
isColumnTypeRenderer,
|
|
3019
2529
|
isCompleteFilter,
|
|
2530
|
+
isConnectionQualityMetrics,
|
|
2531
|
+
isConnectionStatusMessage,
|
|
3020
2532
|
isDataLoading,
|
|
3021
|
-
isDateColumn,
|
|
3022
2533
|
isDateTimeColumn,
|
|
3023
2534
|
isDateTimePattern,
|
|
2535
|
+
isErrorResponse,
|
|
3024
2536
|
isFilterClause,
|
|
3025
2537
|
isFilteredColumn,
|
|
3026
2538
|
isGroupColumn,
|
|
@@ -3036,6 +2548,7 @@ export {
|
|
|
3036
2548
|
isMultiValueFilter,
|
|
3037
2549
|
isNamedFilter,
|
|
3038
2550
|
isNotHidden,
|
|
2551
|
+
isNotNullOrUndefined,
|
|
3039
2552
|
isNumericColumn,
|
|
3040
2553
|
isOrFilter,
|
|
3041
2554
|
isPinned,
|
|
@@ -3045,16 +2558,22 @@ export {
|
|
|
3045
2558
|
isRowSelectedLast,
|
|
3046
2559
|
isSelectableElement,
|
|
3047
2560
|
isSelected,
|
|
3048
|
-
isSimpleColumnType,
|
|
3049
2561
|
isSingleValueFilter,
|
|
2562
|
+
isTableSchema,
|
|
3050
2563
|
isTextColumn,
|
|
3051
|
-
isTimeColumn,
|
|
3052
2564
|
isTypeDescriptor,
|
|
2565
|
+
isTypeaheadSuggestionProvider,
|
|
3053
2566
|
isValidColumnAlignment,
|
|
3054
2567
|
isValidFilterClauseOp,
|
|
3055
2568
|
isValidNumber,
|
|
3056
2569
|
isValidPinLocation,
|
|
3057
2570
|
isValueListRenderer,
|
|
2571
|
+
isViewportMenusAction,
|
|
2572
|
+
isViewporttMessage,
|
|
2573
|
+
isVisualLinkCreatedAction,
|
|
2574
|
+
isVisualLinkRemovedAction,
|
|
2575
|
+
isVisualLinksAction,
|
|
2576
|
+
isVuuFeatureAction,
|
|
3058
2577
|
itemToString,
|
|
3059
2578
|
itemsChanged,
|
|
3060
2579
|
itemsOrOrderChanged,
|
|
@@ -3062,6 +2581,7 @@ export {
|
|
|
3062
2581
|
lastWord,
|
|
3063
2582
|
logger,
|
|
3064
2583
|
mapSortCriteria,
|
|
2584
|
+
messageHasResult,
|
|
3065
2585
|
metadataKeys,
|
|
3066
2586
|
moveColumnTo,
|
|
3067
2587
|
moveItem,
|
|
@@ -3087,16 +2607,22 @@ export {
|
|
|
3087
2607
|
sortPinnedColumns,
|
|
3088
2608
|
stripFilterFromColumns,
|
|
3089
2609
|
subscribedOnly,
|
|
3090
|
-
|
|
2610
|
+
supportedDateTimePatterns,
|
|
3091
2611
|
throttle,
|
|
3092
2612
|
toColumnDescriptor,
|
|
3093
2613
|
toDataSourceColumns,
|
|
3094
2614
|
updateColumn,
|
|
2615
|
+
updateColumnFormatting,
|
|
3095
2616
|
updateColumnRenderProps,
|
|
3096
2617
|
updateColumnType,
|
|
2618
|
+
useId,
|
|
2619
|
+
useLayoutEffectSkipFirst,
|
|
2620
|
+
useThemeAttributes,
|
|
3097
2621
|
uuid,
|
|
2622
|
+
vanillaConfig,
|
|
3098
2623
|
virtualRowPositioning,
|
|
3099
2624
|
visibleColumnAtIndex,
|
|
2625
|
+
withConfigDefaults,
|
|
3100
2626
|
withinRange,
|
|
3101
2627
|
wordify
|
|
3102
2628
|
};
|