@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 CHANGED
@@ -38,6 +38,9 @@ __export(src_exports, {
38
38
  ArrowLeft: () => ArrowLeft,
39
39
  ArrowRight: () => ArrowRight,
40
40
  ArrowUp: () => ArrowUp,
41
+ DEFAULT_DENSITY: () => DEFAULT_DENSITY,
42
+ DEFAULT_THEME: () => DEFAULT_THEME,
43
+ DEFAULT_THEME_MODE: () => DEFAULT_THEME_MODE,
41
44
  DOWN1: () => DOWN1,
42
45
  DOWN2: () => DOWN2,
43
46
  DataWindow: () => DataWindow,
@@ -49,12 +52,16 @@ __export(src_exports, {
49
52
  KeySet: () => KeySet,
50
53
  MEASURES: () => MEASURES,
51
54
  NULL_RANGE: () => NULL_RANGE,
55
+ NoFilter: () => NoFilter,
56
+ NoSort: () => NoSort,
52
57
  PageDown: () => PageDown,
53
58
  PageUp: () => PageUp,
54
59
  RangeMonitor: () => RangeMonitor,
55
60
  RowSelected: () => RowSelected,
56
61
  Space: () => Space2,
57
62
  Tab: () => Tab,
63
+ ThemeContext: () => ThemeContext,
64
+ ThemeProvider: () => ThemeProvider,
58
65
  UP1: () => UP1,
59
66
  UP2: () => UP2,
60
67
  WindowRange: () => WindowRange,
@@ -69,8 +76,11 @@ __export(src_exports, {
69
76
  applySortToColumns: () => applySortToColumns,
70
77
  boxContainsPoint: () => boxContainsPoint,
71
78
  buildColumnMap: () => buildColumnMap,
79
+ columnsChanged: () => columnsChanged,
80
+ configChanged: () => configChanged,
72
81
  createEl: () => createEl,
73
82
  debounce: () => debounce,
83
+ defaultPatternsByType: () => defaultPatternsByType,
74
84
  defaultValueFormatter: () => defaultValueFormatter,
75
85
  deselectItem: () => deselectItem,
76
86
  dispatchCustomEvent: () => dispatchCustomEvent,
@@ -78,7 +88,9 @@ __export(src_exports, {
78
88
  expandSelection: () => expandSelection,
79
89
  extractFilterForColumn: () => extractFilterForColumn,
80
90
  extractGroupColumn: () => extractGroupColumn,
91
+ fallbackDateTimePattern: () => fallbackDateTimePattern,
81
92
  filterAsQuery: () => filterAsQuery,
93
+ filterChanged: () => filterChanged,
82
94
  filterValue: () => filterValue,
83
95
  findColumn: () => findColumn,
84
96
  flattenColumnGroup: () => flattenColumnGroup,
@@ -95,6 +107,8 @@ __export(src_exports, {
95
107
  getCellRendererOptions: () => getCellRendererOptions,
96
108
  getClosest: () => getClosest,
97
109
  getClosestIndexItem: () => getClosestIndexItem,
110
+ getColumnHeaderContentRenderer: () => getColumnHeaderContentRenderer,
111
+ getColumnHeaderLabelRenderer: () => getColumnHeaderLabelRenderer,
98
112
  getColumnLabel: () => getColumnLabel,
99
113
  getColumnName: () => getColumnName,
100
114
  getColumnStyle: () => getColumnStyle,
@@ -121,7 +135,12 @@ __export(src_exports, {
121
135
  getUniqueId: () => getUniqueId,
122
136
  getUrlParameter: () => getUrlParameter,
123
137
  getValueFormatter: () => getValueFormatter,
138
+ groupByChanged: () => groupByChanged,
139
+ hasAction: () => hasAction,
140
+ hasFilter: () => hasFilter,
141
+ hasGroupBy: () => hasGroupBy,
124
142
  hasHeadings: () => hasHeadings,
143
+ hasSort: () => hasSort,
125
144
  hasUrlParameter: () => hasUrlParameter,
126
145
  hasValidationRules: () => hasValidationRules,
127
146
  invariant: () => invariant,
@@ -130,10 +149,12 @@ __export(src_exports, {
130
149
  isCharacterKey: () => isCharacterKey,
131
150
  isColumnTypeRenderer: () => isColumnTypeRenderer,
132
151
  isCompleteFilter: () => isCompleteFilter,
152
+ isConnectionQualityMetrics: () => isConnectionQualityMetrics,
153
+ isConnectionStatusMessage: () => isConnectionStatusMessage,
133
154
  isDataLoading: () => isDataLoading,
134
- isDateColumn: () => isDateColumn,
135
155
  isDateTimeColumn: () => isDateTimeColumn,
136
156
  isDateTimePattern: () => isDateTimePattern,
157
+ isErrorResponse: () => isErrorResponse,
137
158
  isFilterClause: () => isFilterClause,
138
159
  isFilteredColumn: () => isFilteredColumn,
139
160
  isGroupColumn: () => isGroupColumn,
@@ -149,6 +170,7 @@ __export(src_exports, {
149
170
  isMultiValueFilter: () => isMultiValueFilter,
150
171
  isNamedFilter: () => isNamedFilter,
151
172
  isNotHidden: () => isNotHidden,
173
+ isNotNullOrUndefined: () => isNotNullOrUndefined,
152
174
  isNumericColumn: () => isNumericColumn,
153
175
  isOrFilter: () => isOrFilter,
154
176
  isPinned: () => isPinned,
@@ -158,16 +180,22 @@ __export(src_exports, {
158
180
  isRowSelectedLast: () => isRowSelectedLast,
159
181
  isSelectableElement: () => isSelectableElement,
160
182
  isSelected: () => isSelected,
161
- isSimpleColumnType: () => isSimpleColumnType,
162
183
  isSingleValueFilter: () => isSingleValueFilter,
184
+ isTableSchema: () => isTableSchema,
163
185
  isTextColumn: () => isTextColumn,
164
- isTimeColumn: () => isTimeColumn,
165
186
  isTypeDescriptor: () => isTypeDescriptor,
187
+ isTypeaheadSuggestionProvider: () => isTypeaheadSuggestionProvider,
166
188
  isValidColumnAlignment: () => isValidColumnAlignment,
167
189
  isValidFilterClauseOp: () => isValidFilterClauseOp,
168
190
  isValidNumber: () => isValidNumber,
169
191
  isValidPinLocation: () => isValidPinLocation,
170
192
  isValueListRenderer: () => isValueListRenderer,
193
+ isViewportMenusAction: () => isViewportMenusAction,
194
+ isViewporttMessage: () => isViewporttMessage,
195
+ isVisualLinkCreatedAction: () => isVisualLinkCreatedAction,
196
+ isVisualLinkRemovedAction: () => isVisualLinkRemovedAction,
197
+ isVisualLinksAction: () => isVisualLinksAction,
198
+ isVuuFeatureAction: () => isVuuFeatureAction,
171
199
  itemToString: () => itemToString,
172
200
  itemsChanged: () => itemsChanged,
173
201
  itemsOrOrderChanged: () => itemsOrOrderChanged,
@@ -175,6 +203,7 @@ __export(src_exports, {
175
203
  lastWord: () => lastWord,
176
204
  logger: () => logger,
177
205
  mapSortCriteria: () => mapSortCriteria,
206
+ messageHasResult: () => messageHasResult,
178
207
  metadataKeys: () => metadataKeys,
179
208
  moveColumnTo: () => moveColumnTo,
180
209
  moveItem: () => moveItem,
@@ -200,16 +229,22 @@ __export(src_exports, {
200
229
  sortPinnedColumns: () => sortPinnedColumns,
201
230
  stripFilterFromColumns: () => stripFilterFromColumns,
202
231
  subscribedOnly: () => subscribedOnly,
203
- takeScreenshot: () => takeScreenshot,
232
+ supportedDateTimePatterns: () => supportedDateTimePatterns,
204
233
  throttle: () => throttle,
205
234
  toColumnDescriptor: () => toColumnDescriptor,
206
235
  toDataSourceColumns: () => toDataSourceColumns,
207
236
  updateColumn: () => updateColumn,
237
+ updateColumnFormatting: () => updateColumnFormatting,
208
238
  updateColumnRenderProps: () => updateColumnRenderProps,
209
239
  updateColumnType: () => updateColumnType,
240
+ useId: () => useId,
241
+ useLayoutEffectSkipFirst: () => useLayoutEffectSkipFirst,
242
+ useThemeAttributes: () => useThemeAttributes,
210
243
  uuid: () => uuid,
244
+ vanillaConfig: () => vanillaConfig,
211
245
  virtualRowPositioning: () => virtualRowPositioning,
212
246
  visibleColumnAtIndex: () => visibleColumnAtIndex,
247
+ withConfigDefaults: () => withConfigDefaults,
213
248
  withinRange: () => withinRange,
214
249
  wordify: () => wordify
215
250
  });
@@ -401,9 +436,7 @@ var isNumericColumn = ({ serverDataType, type }) => {
401
436
  }
402
437
  return false;
403
438
  };
404
- var isDateColumn = ({ type }) => (isTypeDescriptor(type) ? type.name : type) === "date";
405
- var isTimeColumn = ({ type }) => (isTypeDescriptor(type) ? type.name : type) === "time";
406
- var isDateTimeColumn = (column) => isDateColumn(column) || isTimeColumn(column);
439
+ var isDateTimeColumn = (column) => (isTypeDescriptor(column.type) ? column.type.name : column.type) === "date/time";
407
440
  var isPinned = (column) => typeof column.pin === "string";
408
441
  var hasHeadings = (column) => Array.isArray(column.heading) && column.heading.length > 0;
409
442
  var isResizing = (column) => column.resizing;
@@ -411,9 +444,6 @@ var isTextColumn = ({ serverDataType }) => serverDataType === void 0 ? false : s
411
444
  var toColumnDescriptor = (name) => ({
412
445
  name
413
446
  });
414
- var isSimpleColumnType = (value) => typeof value === "string" && ["string", "number", "boolean", "json", "date", "time", "checkbox"].includes(
415
- value
416
- );
417
447
  var isTypeDescriptor = (type) => typeof type !== "undefined" && typeof type !== "string";
418
448
  var EMPTY_COLUMN_MAP = {};
419
449
  var isColumnTypeRenderer = (renderer) => typeof (renderer == null ? void 0 : renderer.name) !== "undefined";
@@ -495,14 +525,14 @@ function extractGroupColumn(columns, groupBy, confirmed = true) {
495
525
  const flattenedColumns = flattenColumnGroup(columns);
496
526
  const [groupedColumns, rest] = flattenedColumns.reduce(
497
527
  (result, column, i) => {
498
- const [g, r] = result;
528
+ const [g, r2] = result;
499
529
  if (groupBy.includes(column.name)) {
500
530
  g.push({
501
531
  ...column,
502
532
  originalIdx: i
503
533
  });
504
534
  } else {
505
- r.push(column);
535
+ r2.push(column);
506
536
  }
507
537
  return result;
508
538
  },
@@ -841,45 +871,20 @@ var getDefaultColumnType = (serverDataType) => {
841
871
  return "string";
842
872
  }
843
873
  };
844
- var updateColumnType = (column, formatting) => {
874
+ var updateColumnFormatting = (column, formatting) => {
845
875
  const { serverDataType, type = getDefaultColumnType(serverDataType) } = column;
846
- if (typeof type === "string" || type === void 0) {
847
- return {
848
- ...column,
849
- type: {
850
- name: type,
851
- formatting
852
- }
853
- };
876
+ if (isTypeDescriptor(type)) {
877
+ return { ...column, type: { ...type, formatting } };
854
878
  } else {
855
- return {
856
- ...column,
857
- type: {
858
- ...type,
859
- formatting
860
- }
861
- };
879
+ return { ...column, type: { name: type, formatting } };
862
880
  }
863
881
  };
882
+ function updateColumnType(column, type) {
883
+ return isTypeDescriptor(column.type) ? { ...column, type: { ...column.type, name: type } } : { ...column, type };
884
+ }
864
885
  var updateColumnRenderProps = (column, renderer) => {
865
- const { serverDataType, type } = column;
866
- if (type === void 0) {
867
- return {
868
- ...column,
869
- type: {
870
- name: getDefaultColumnType(serverDataType),
871
- renderer
872
- }
873
- };
874
- } else if (isSimpleColumnType(type)) {
875
- return {
876
- ...column,
877
- type: {
878
- name: type,
879
- renderer
880
- }
881
- };
882
- } else {
886
+ const { serverDataType, type = getDefaultColumnType(serverDataType) } = column;
887
+ if (isTypeDescriptor(type)) {
883
888
  return {
884
889
  ...column,
885
890
  type: {
@@ -888,6 +893,8 @@ var updateColumnRenderProps = (column, renderer) => {
888
893
  renderer
889
894
  }
890
895
  };
896
+ } else {
897
+ return { ...column, type: { name: type, renderer } };
891
898
  }
892
899
  };
893
900
  var NO_TYPE_SETTINGS = {};
@@ -1008,6 +1015,7 @@ var getCookieValue = (name) => {
1008
1015
 
1009
1016
  // src/component-registry.ts
1010
1017
  var cellRenderersMap = /* @__PURE__ */ new Map();
1018
+ var columnHeaderRenderersMap = /* @__PURE__ */ new Map();
1011
1019
  var configEditorsMap = /* @__PURE__ */ new Map();
1012
1020
  var cellConfigPanelsMap = /* @__PURE__ */ new Map();
1013
1021
  var editRuleValidatorsMap = /* @__PURE__ */ new Map();
@@ -1022,11 +1030,17 @@ var isTypeCompatible = (rendererType, serverDataType) => {
1022
1030
  }
1023
1031
  };
1024
1032
  var isCellRenderer = (type, component) => type === "cell-renderer";
1033
+ var isColumnHeaderContentRenderer = (type, component) => type === "column-header-content-renderer";
1034
+ var isColumnHeaderLabelRenderer = (type, component) => type === "column-header-label-renderer";
1025
1035
  var isCellConfigPanel = (type, component) => type === "cell-config-panel";
1026
1036
  var isEditRuleValidator = (type, component) => type === "data-edit-validator";
1027
1037
  function registerComponent(componentName, component, type = "cell-renderer", options) {
1028
1038
  if (isCellRenderer(type, component)) {
1029
1039
  cellRenderersMap.set(componentName, component);
1040
+ } else if (isColumnHeaderContentRenderer(type, component)) {
1041
+ columnHeaderRenderersMap.set(componentName, component);
1042
+ } else if (isColumnHeaderLabelRenderer(type, component)) {
1043
+ columnHeaderRenderersMap.set(componentName, component);
1030
1044
  } else if (isCellConfigPanel(type, component)) {
1031
1045
  cellConfigPanelsMap.set(componentName, component);
1032
1046
  } else if (isEditRuleValidator(type, component)) {
@@ -1054,13 +1068,17 @@ var getRegisteredCellRenderers = (serverDataType) => {
1054
1068
  }
1055
1069
  };
1056
1070
  var getCellRendererOptions = (renderName) => optionsMap.get(renderName);
1057
- function getCellRenderer(column, cellType = "cell") {
1058
- if (cellType === "cell") {
1059
- return dataCellRenderer(column);
1060
- } else if (cellType === "col-label" && column.colHeaderLabelRenderer) {
1061
- return cellRenderersMap.get(column.colHeaderLabelRenderer);
1062
- } else if (cellType === "col-content" && column.colHeaderContentRenderer) {
1063
- return cellRenderersMap.get(column.colHeaderContentRenderer);
1071
+ function getCellRenderer(column) {
1072
+ return dataCellRenderer(column);
1073
+ }
1074
+ function getColumnHeaderContentRenderer(column) {
1075
+ if (column.colHeaderContentRenderer) {
1076
+ return columnHeaderRenderersMap.get(column.colHeaderContentRenderer);
1077
+ }
1078
+ }
1079
+ function getColumnHeaderLabelRenderer(column) {
1080
+ if (column.colHeaderLabelRenderer) {
1081
+ return columnHeaderRenderersMap.get(column.colHeaderLabelRenderer);
1064
1082
  }
1065
1083
  }
1066
1084
  function dataCellRenderer(column) {
@@ -1130,7 +1148,7 @@ var rangeNewItems = ({ from: from1, to: to1 }, newRange) => {
1130
1148
  const newFullySubsumesOld = from2 < from1 && to2 > to1;
1131
1149
  return noOverlap || newFullySubsumesOld ? newRange : to2 > to1 ? { from: to1, to: to2 } : { from: from2, to: from1 };
1132
1150
  };
1133
- var WindowRange = class {
1151
+ var WindowRange = class _WindowRange {
1134
1152
  constructor(from, to) {
1135
1153
  this.from = from;
1136
1154
  this.to = to;
@@ -1143,7 +1161,7 @@ var WindowRange = class {
1143
1161
  return from >= this.to || to < this.from ? [0, 0] : [Math.max(from, this.from), Math.min(to, this.to)];
1144
1162
  }
1145
1163
  copy() {
1146
- return new WindowRange(this.from, this.to);
1164
+ return new _WindowRange(this.from, this.to);
1147
1165
  }
1148
1166
  };
1149
1167
 
@@ -1274,6 +1292,151 @@ function getMovingValueDirection(newValue, direction, prevValue, decimalPlaces)
1274
1292
  }
1275
1293
  }
1276
1294
 
1295
+ // src/datasource-action-utils.ts
1296
+ var isVisualLinksAction = (action) => action.type === "vuu-links";
1297
+ var isVisualLinkCreatedAction = (action) => action.type === "vuu-link-created";
1298
+ var isVisualLinkRemovedAction = (action) => action.type === "vuu-link-removed";
1299
+ var isViewportMenusAction = (action) => action.type === "vuu-menu";
1300
+ var isVuuFeatureAction = (action) => isViewportMenusAction(action) || isVisualLinksAction(action);
1301
+
1302
+ // src/datasource-utils.ts
1303
+ var NoFilter = { filter: "" };
1304
+ var NoSort = { sortDefs: [] };
1305
+ var vanillaConfig = {
1306
+ aggregations: [],
1307
+ columns: [],
1308
+ filter: NoFilter,
1309
+ groupBy: [],
1310
+ sort: NoSort
1311
+ };
1312
+ 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;
1313
+ 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;
1314
+ var equivalentFilter = ({ filter: f1 }, { filter: f2 }) => f1 === void 0 && (f2 == null ? void 0 : f2.filter) === "" || f2 === void 0 && (f1 == null ? void 0 : f1.filter) === "";
1315
+ 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;
1316
+ 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;
1317
+ var exactlyTheSame = (a, b) => {
1318
+ if (a === b) {
1319
+ return true;
1320
+ } else if (a === void 0 && b === void 0) {
1321
+ return true;
1322
+ } else {
1323
+ return false;
1324
+ }
1325
+ };
1326
+ var aggregationsChanged = (config, newConfig) => {
1327
+ const { aggregations: agg1 } = config;
1328
+ const { aggregations: agg2 } = newConfig;
1329
+ if (exactlyTheSame(agg1, agg2) || equivalentAggregations(config, newConfig)) {
1330
+ return false;
1331
+ } else if (agg1 === void 0 || agg2 === void 0) {
1332
+ return true;
1333
+ } else if (agg1.length !== agg2.length) {
1334
+ return true;
1335
+ }
1336
+ return agg1.some(
1337
+ ({ column, aggType }, i) => column !== agg2[i].column || aggType !== agg2[i].aggType
1338
+ );
1339
+ };
1340
+ var columnsChanged = (config, newConfig) => {
1341
+ const { columns: cols1 } = config;
1342
+ const { columns: cols2 } = newConfig;
1343
+ if (exactlyTheSame(cols1, cols2) || equivalentColumns(config, newConfig)) {
1344
+ return false;
1345
+ } else if (cols1 === void 0 || cols2 === void 0) {
1346
+ return true;
1347
+ } else if ((cols1 == null ? void 0 : cols1.length) !== (cols2 == null ? void 0 : cols2.length)) {
1348
+ return true;
1349
+ }
1350
+ return cols1.some((column, i) => column !== (cols2 == null ? void 0 : cols2[i]));
1351
+ };
1352
+ var filterChanged = (c1, c2) => {
1353
+ var _a, _b;
1354
+ if (equivalentFilter(c1, c2)) {
1355
+ return false;
1356
+ } else {
1357
+ return ((_a = c1.filter) == null ? void 0 : _a.filter) !== ((_b = c2.filter) == null ? void 0 : _b.filter);
1358
+ }
1359
+ };
1360
+ var groupByChanged = (config, newConfig) => {
1361
+ const { groupBy: g1 } = config;
1362
+ const { groupBy: g2 } = newConfig;
1363
+ if (exactlyTheSame(g1, g2) || equivalentGroupBy(config, newConfig)) {
1364
+ return false;
1365
+ } else if (g1 === void 0 || g2 === void 0) {
1366
+ return true;
1367
+ } else if ((g1 == null ? void 0 : g1.length) !== (g2 == null ? void 0 : g2.length)) {
1368
+ return true;
1369
+ }
1370
+ return g1.some((column, i) => column !== (g2 == null ? void 0 : g2[i]));
1371
+ };
1372
+ var sortChanged = (config, newConfig) => {
1373
+ const { sort: s1 } = config;
1374
+ const { sort: s2 } = newConfig;
1375
+ if (exactlyTheSame(s1, s2) || equivalentSort(config, newConfig)) {
1376
+ return false;
1377
+ } else if (s1 === void 0 || s2 === void 0) {
1378
+ return true;
1379
+ } else if ((s1 == null ? void 0 : s1.sortDefs.length) !== (s2 == null ? void 0 : s2.sortDefs.length)) {
1380
+ return true;
1381
+ }
1382
+ return s1.sortDefs.some(
1383
+ ({ column, sortType }, i) => column !== s2.sortDefs[i].column || sortType !== s2.sortDefs[i].sortType
1384
+ );
1385
+ };
1386
+ var visualLinkChanged = () => {
1387
+ return false;
1388
+ };
1389
+ var configChanged = (config, newConfig) => {
1390
+ if (exactlyTheSame(config, newConfig)) {
1391
+ return false;
1392
+ }
1393
+ if (config === void 0 || newConfig === void 0) {
1394
+ return true;
1395
+ }
1396
+ return aggregationsChanged(config, newConfig) || columnsChanged(config, newConfig) || filterChanged(config, newConfig) || groupByChanged(config, newConfig) || sortChanged(config, newConfig) || visualLinkChanged(config, newConfig);
1397
+ };
1398
+ var hasGroupBy = (config) => config !== void 0 && config.groupBy !== void 0 && config.groupBy.length > 0;
1399
+ var hasFilter = (config) => (config == null ? void 0 : config.filter) !== void 0 && config.filter.filter.length > 0;
1400
+ var hasSort = (config) => {
1401
+ var _a;
1402
+ return (config == null ? void 0 : config.sort) !== void 0 && Array.isArray((_a = config.sort) == null ? void 0 : _a.sortDefs) && config.sort.sortDefs.length > 0;
1403
+ };
1404
+ var isTypeaheadSuggestionProvider = (source) => typeof source["getTypeaheadSuggestions"] === "function";
1405
+ var isTableSchema = (message) => message.type === "TABLE_META_RESP";
1406
+ var isConnectionStatusMessage = (msg) => msg.type === "connection-status";
1407
+ var isConnectionQualityMetrics = (msg) => msg.type === "connection-metrics";
1408
+ var messageHasResult = (msg) => typeof msg.result !== "undefined";
1409
+ var isErrorResponse = (response) => response !== void 0 && "error" in response;
1410
+ var hasAction = (response) => response != void 0 && "action" in response;
1411
+ var isViewporttMessage = (msg) => "viewport" in msg;
1412
+ var withConfigDefaults = (config) => {
1413
+ if (config.aggregations && config.columns && config.filter && config.groupBy && config.sort) {
1414
+ return config;
1415
+ } else {
1416
+ const {
1417
+ aggregations = [],
1418
+ columns = [],
1419
+ filter = { filter: "" },
1420
+ groupBy = [],
1421
+ sort = { sortDefs: [] },
1422
+ visualLink
1423
+ } = config;
1424
+ return {
1425
+ aggregations,
1426
+ columns,
1427
+ filter,
1428
+ groupBy,
1429
+ sort,
1430
+ visualLink
1431
+ };
1432
+ }
1433
+ };
1434
+
1435
+ // src/ts-utils.ts
1436
+ function isNotNullOrUndefined(value) {
1437
+ return value !== void 0 && value !== null;
1438
+ }
1439
+
1277
1440
  // src/date/formatter.ts
1278
1441
  var baseTimeFormatOptions = {
1279
1442
  hour: "2-digit",
@@ -1297,9 +1460,8 @@ var baseDateFormatOptions = {
1297
1460
  };
1298
1461
  var formatConfigByDatePatterns = {
1299
1462
  "dd.mm.yyyy": {
1300
- locale: "en-GB",
1301
- options: { ...baseDateFormatOptions },
1302
- postProcessor: (s) => s.replaceAll("/", ".")
1463
+ locale: "de-De",
1464
+ options: { ...baseDateFormatOptions }
1303
1465
  },
1304
1466
  "dd/mm/yyyy": { locale: "en-GB", options: { ...baseDateFormatOptions } },
1305
1467
  "dd MMM yyyy": {
@@ -1320,15 +1482,15 @@ var formatConfigByDatePatterns = {
1320
1482
  options: { ...baseDateFormatOptions, month: "long" }
1321
1483
  }
1322
1484
  };
1323
- var formatConfigByDateTimePatterns = { ...formatConfigByDatePatterns, ...formatConfigByTimePatterns };
1485
+ function getFormatConfigs(pattern) {
1486
+ return [
1487
+ pattern.date ? formatConfigByDatePatterns[pattern.date] : null,
1488
+ pattern.time ? formatConfigByTimePatterns[pattern.time] : null
1489
+ ];
1490
+ }
1324
1491
  function formatDate(pattern) {
1325
- const { locale, options, postProcessor } = formatConfigByDateTimePatterns[pattern];
1326
- const dateTimeFormat = Intl.DateTimeFormat(locale, options);
1327
- return (d) => {
1328
- const dateStr = dateTimeFormat.format(d);
1329
- console.log({ dateStr });
1330
- return postProcessor ? postProcessor(dateStr) : dateStr;
1331
- };
1492
+ const dateTimeFormats = getFormatConfigs(pattern).filter(isNotNullOrUndefined).map((c) => Intl.DateTimeFormat(c.locale, c.options));
1493
+ return (d) => dateTimeFormats.map((dtf) => dtf.format(d)).join(" ");
1332
1494
  }
1333
1495
 
1334
1496
  // src/date/types.ts
@@ -1342,9 +1504,30 @@ var supportedDatePatterns = [
1342
1504
  "MMMM dd, yyyy"
1343
1505
  ];
1344
1506
  var supportedTimePatterns = ["hh:mm:ss", "hh:mm:ss a"];
1507
+ var supportedDateTimePatterns = {
1508
+ date: supportedDatePatterns,
1509
+ time: supportedTimePatterns
1510
+ };
1345
1511
  var isDatePattern = (pattern) => supportedDatePatterns.includes(pattern);
1346
1512
  var isTimePattern = (pattern) => supportedTimePatterns.includes(pattern);
1347
- var isDateTimePattern = (pattern) => pattern !== void 0 && (isDatePattern(pattern) || isTimePattern(pattern));
1513
+ var isDateTimePattern = (pattern) => isDatePattern(pattern == null ? void 0 : pattern.date) || isTimePattern(pattern == null ? void 0 : pattern.time);
1514
+
1515
+ // src/date/helpers.ts
1516
+ var defaultPatternsByType = {
1517
+ time: "hh:mm:ss",
1518
+ date: "dd.mm.yyyy"
1519
+ };
1520
+ var fallbackDateTimePattern = {
1521
+ date: defaultPatternsByType["date"]
1522
+ };
1523
+ function dateTimePattern(type) {
1524
+ if (isTypeDescriptor(type)) {
1525
+ if (type.formatting && isDateTimePattern(type.formatting.pattern)) {
1526
+ return type.formatting.pattern;
1527
+ }
1528
+ }
1529
+ return fallbackDateTimePattern;
1530
+ }
1348
1531
 
1349
1532
  // src/logging-utils.ts
1350
1533
  var logLevels = ["error", "warn", "info", "debug"];
@@ -1722,19 +1905,6 @@ function roundDecimal(value, align = Align.Right, decimals = 4, zeroPad, alignOn
1722
1905
  return integral + (fraction ? "." + fraction : "");
1723
1906
  }
1724
1907
 
1725
- // src/date/helpers.ts
1726
- var defaultPatternByTypes = { time: "hh:mm:ss", date: "dd.mm.yyyy" };
1727
- function dateTimePattern(type) {
1728
- if (isTypeDescriptor(type)) {
1729
- if (type.formatting && isDateTimePattern(type.formatting.pattern)) {
1730
- return type.formatting.pattern;
1731
- }
1732
- return defaultPatternByTypes[type.name];
1733
- } else {
1734
- return defaultPatternByTypes[type];
1735
- }
1736
- }
1737
-
1738
1908
  // src/formatting-utils.ts
1739
1909
  var DEFAULT_NUMERIC_FORMAT = {};
1740
1910
  var defaultValueFormatter = (value) => value == null ? "" : typeof value === "string" ? value : value.toString();
@@ -1999,9 +2169,9 @@ var isGroupMenuItemDescriptor = (menuItem) => menuItem !== void 0 && "children"
1999
2169
  // src/nanoid/index.ts
2000
2170
  var uuid = (size2 = 21) => {
2001
2171
  let id = "";
2002
- let bytes = crypto.getRandomValues(new Uint8Array(size2));
2172
+ const bytes = crypto.getRandomValues(new Uint8Array(size2));
2003
2173
  while (size2--) {
2004
- let byte = bytes[size2] & 63;
2174
+ const byte = bytes[size2] & 63;
2005
2175
  if (byte < 36) {
2006
2176
  id += byte.toString(36);
2007
2177
  } else if (byte < 62) {
@@ -2349,777 +2519,128 @@ var wordify = (text) => {
2349
2519
  return `${capitalize(firstWord)} ${rest.join(" ")}`;
2350
2520
  };
2351
2521
 
2352
- // src/url-utils.ts
2353
- var getUrlParameter = (paramName, defaultValue) => {
2354
- var _a;
2355
- return (_a = new URL(document.location.href).searchParams.get(paramName)) != null ? _a : defaultValue;
2356
- };
2357
- var hasUrlParameter = (paramName) => new URL(document.location.href).searchParams.has(paramName);
2358
-
2359
- // ../../node_modules/html-to-image/es/util.js
2360
- function resolveUrl(url, baseUrl) {
2361
- if (url.match(/^[a-z]+:\/\//i)) {
2362
- return url;
2363
- }
2364
- if (url.match(/^\/\//)) {
2365
- return window.location.protocol + url;
2366
- }
2367
- if (url.match(/^[a-z]+:/i)) {
2368
- return url;
2369
- }
2370
- const doc = document.implementation.createHTMLDocument();
2371
- const base = doc.createElement("base");
2372
- const a = doc.createElement("a");
2373
- doc.head.appendChild(base);
2374
- doc.body.appendChild(a);
2375
- if (baseUrl) {
2376
- base.href = baseUrl;
2377
- }
2378
- a.href = url;
2379
- return a.href;
2380
- }
2381
- var uuid2 = (() => {
2382
- let counter = 0;
2383
- const random = () => (
2384
- // eslint-disable-next-line no-bitwise
2385
- `0000${(Math.random() * 36 ** 4 << 0).toString(36)}`.slice(-4)
2386
- );
2387
- return () => {
2388
- counter += 1;
2389
- return `u${random()}${counter}`;
2390
- };
2391
- })();
2392
- function toArray(arrayLike) {
2393
- const arr = [];
2394
- for (let i = 0, l = arrayLike.length; i < l; i++) {
2395
- arr.push(arrayLike[i]);
2396
- }
2397
- return arr;
2398
- }
2399
- function px(node, styleProperty) {
2400
- const win = node.ownerDocument.defaultView || window;
2401
- const val = win.getComputedStyle(node).getPropertyValue(styleProperty);
2402
- return val ? parseFloat(val.replace("px", "")) : 0;
2403
- }
2404
- function getNodeWidth(node) {
2405
- const leftBorder = px(node, "border-left-width");
2406
- const rightBorder = px(node, "border-right-width");
2407
- return node.clientWidth + leftBorder + rightBorder;
2408
- }
2409
- function getNodeHeight(node) {
2410
- const topBorder = px(node, "border-top-width");
2411
- const bottomBorder = px(node, "border-bottom-width");
2412
- return node.clientHeight + topBorder + bottomBorder;
2413
- }
2414
- function getImageSize(targetNode, options = {}) {
2415
- const width = options.width || getNodeWidth(targetNode);
2416
- const height = options.height || getNodeHeight(targetNode);
2417
- return { width, height };
2418
- }
2419
- function getPixelRatio() {
2420
- let ratio;
2421
- let FINAL_PROCESS;
2422
- try {
2423
- FINAL_PROCESS = process;
2424
- } catch (e) {
2425
- }
2426
- const val = FINAL_PROCESS && FINAL_PROCESS.env ? FINAL_PROCESS.env.devicePixelRatio : null;
2427
- if (val) {
2428
- ratio = parseInt(val, 10);
2429
- if (Number.isNaN(ratio)) {
2430
- ratio = 1;
2431
- }
2432
- }
2433
- return ratio || window.devicePixelRatio || 1;
2434
- }
2435
- var canvasDimensionLimit = 16384;
2436
- function checkCanvasDimensions(canvas) {
2437
- if (canvas.width > canvasDimensionLimit || canvas.height > canvasDimensionLimit) {
2438
- if (canvas.width > canvasDimensionLimit && canvas.height > canvasDimensionLimit) {
2439
- if (canvas.width > canvas.height) {
2440
- canvas.height *= canvasDimensionLimit / canvas.width;
2441
- canvas.width = canvasDimensionLimit;
2442
- } else {
2443
- canvas.width *= canvasDimensionLimit / canvas.height;
2444
- canvas.height = canvasDimensionLimit;
2445
- }
2446
- } else if (canvas.width > canvasDimensionLimit) {
2447
- canvas.height *= canvasDimensionLimit / canvas.width;
2448
- canvas.width = canvasDimensionLimit;
2449
- } else {
2450
- canvas.width *= canvasDimensionLimit / canvas.height;
2451
- canvas.height = canvasDimensionLimit;
2452
- }
2453
- }
2454
- }
2455
- function createImage(url) {
2456
- return new Promise((resolve, reject) => {
2457
- const img = new Image();
2458
- img.decode = () => resolve(img);
2459
- img.onload = () => resolve(img);
2460
- img.onerror = reject;
2461
- img.crossOrigin = "anonymous";
2462
- img.decoding = "async";
2463
- img.src = url;
2464
- });
2465
- }
2466
- async function svgToDataURL(svg) {
2467
- return Promise.resolve().then(() => new XMLSerializer().serializeToString(svg)).then(encodeURIComponent).then((html) => `data:image/svg+xml;charset=utf-8,${html}`);
2468
- }
2469
- async function nodeToDataURL(node, width, height) {
2470
- const xmlns = "http://www.w3.org/2000/svg";
2471
- const svg = document.createElementNS(xmlns, "svg");
2472
- const foreignObject = document.createElementNS(xmlns, "foreignObject");
2473
- svg.setAttribute("width", `${width}`);
2474
- svg.setAttribute("height", `${height}`);
2475
- svg.setAttribute("viewBox", `0 0 ${width} ${height}`);
2476
- foreignObject.setAttribute("width", "100%");
2477
- foreignObject.setAttribute("height", "100%");
2478
- foreignObject.setAttribute("x", "0");
2479
- foreignObject.setAttribute("y", "0");
2480
- foreignObject.setAttribute("externalResourcesRequired", "true");
2481
- svg.appendChild(foreignObject);
2482
- foreignObject.appendChild(node);
2483
- return svgToDataURL(svg);
2484
- }
2485
- var isInstanceOfElement = (node, instance) => {
2486
- if (node instanceof instance)
2487
- return true;
2488
- const nodePrototype = Object.getPrototypeOf(node);
2489
- if (nodePrototype === null)
2490
- return false;
2491
- return nodePrototype.constructor.name === instance.name || isInstanceOfElement(nodePrototype, instance);
2492
- };
2493
-
2494
- // ../../node_modules/html-to-image/es/clone-pseudos.js
2495
- function formatCSSText(style) {
2496
- const content = style.getPropertyValue("content");
2497
- return `${style.cssText} content: '${content.replace(/'|"/g, "")}';`;
2498
- }
2499
- function formatCSSProperties(style) {
2500
- return toArray(style).map((name) => {
2501
- const value = style.getPropertyValue(name);
2502
- const priority = style.getPropertyPriority(name);
2503
- return `${name}: ${value}${priority ? " !important" : ""};`;
2504
- }).join(" ");
2505
- }
2506
- function getPseudoElementStyle(className, pseudo, style) {
2507
- const selector = `.${className}:${pseudo}`;
2508
- const cssText = style.cssText ? formatCSSText(style) : formatCSSProperties(style);
2509
- return document.createTextNode(`${selector}{${cssText}}`);
2510
- }
2511
- function clonePseudoElement(nativeNode, clonedNode, pseudo) {
2512
- const style = window.getComputedStyle(nativeNode, pseudo);
2513
- const content = style.getPropertyValue("content");
2514
- if (content === "" || content === "none") {
2515
- return;
2516
- }
2517
- const className = uuid2();
2518
- try {
2519
- clonedNode.className = `${clonedNode.className} ${className}`;
2520
- } catch (err) {
2521
- return;
2522
- }
2523
- const styleElement = document.createElement("style");
2524
- styleElement.appendChild(getPseudoElementStyle(className, pseudo, style));
2525
- clonedNode.appendChild(styleElement);
2526
- }
2527
- function clonePseudoElements(nativeNode, clonedNode) {
2528
- clonePseudoElement(nativeNode, clonedNode, ":before");
2529
- clonePseudoElement(nativeNode, clonedNode, ":after");
2530
- }
2531
-
2532
- // ../../node_modules/html-to-image/es/mimes.js
2533
- var WOFF = "application/font-woff";
2534
- var JPEG = "image/jpeg";
2535
- var mimes = {
2536
- woff: WOFF,
2537
- woff2: WOFF,
2538
- ttf: "application/font-truetype",
2539
- eot: "application/vnd.ms-fontobject",
2540
- png: "image/png",
2541
- jpg: JPEG,
2542
- jpeg: JPEG,
2543
- gif: "image/gif",
2544
- tiff: "image/tiff",
2545
- svg: "image/svg+xml",
2546
- webp: "image/webp"
2547
- };
2548
- function getExtension(url) {
2549
- const match = /\.([^./]*?)$/g.exec(url);
2550
- return match ? match[1] : "";
2551
- }
2552
- function getMimeType(url) {
2553
- const extension = getExtension(url).toLowerCase();
2554
- return mimes[extension] || "";
2555
- }
2522
+ // src/ThemeProvider.tsx
2523
+ var import_react = require("react");
2556
2524
 
2557
- // ../../node_modules/html-to-image/es/dataurl.js
2558
- function getContentFromDataUrl(dataURL) {
2559
- return dataURL.split(/,/)[1];
2560
- }
2561
- function isDataUrl(url) {
2562
- return url.search(/^(data:)/) !== -1;
2563
- }
2564
- function makeDataUrl(content, mimeType) {
2565
- return `data:${mimeType};base64,${content}`;
2566
- }
2567
- async function fetchAsDataURL(url, init, process2) {
2568
- const res = await fetch(url, init);
2569
- if (res.status === 404) {
2570
- throw new Error(`Resource "${res.url}" not found`);
2571
- }
2572
- const blob = await res.blob();
2573
- return new Promise((resolve, reject) => {
2574
- const reader = new FileReader();
2575
- reader.onerror = reject;
2576
- reader.onloadend = () => {
2577
- try {
2578
- resolve(process2({ res, result: reader.result }));
2579
- } catch (error) {
2580
- reject(error);
2581
- }
2582
- };
2583
- reader.readAsDataURL(blob);
2584
- });
2585
- }
2586
- var cache = {};
2587
- function getCacheKey(url, contentType, includeQueryParams) {
2588
- let key = url.replace(/\?.*/, "");
2589
- if (includeQueryParams) {
2590
- key = url;
2591
- }
2592
- if (/ttf|otf|eot|woff2?/i.test(key)) {
2593
- key = key.replace(/.*\//, "");
2594
- }
2595
- return contentType ? `[${contentType}]${key}` : key;
2525
+ // ../../node_modules/clsx/dist/clsx.mjs
2526
+ function r(e) {
2527
+ var t, f, n = "";
2528
+ if ("string" == typeof e || "number" == typeof e)
2529
+ n += e;
2530
+ else if ("object" == typeof e)
2531
+ if (Array.isArray(e))
2532
+ for (t = 0; t < e.length; t++)
2533
+ e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
2534
+ else
2535
+ for (t in e)
2536
+ e[t] && (n && (n += " "), n += t);
2537
+ return n;
2596
2538
  }
2597
- async function resourceToDataURL(resourceUrl, contentType, options) {
2598
- const cacheKey = getCacheKey(resourceUrl, contentType, options.includeQueryParams);
2599
- if (cache[cacheKey] != null) {
2600
- return cache[cacheKey];
2601
- }
2602
- if (options.cacheBust) {
2603
- resourceUrl += (/\?/.test(resourceUrl) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime();
2604
- }
2605
- let dataURL;
2606
- try {
2607
- const content = await fetchAsDataURL(resourceUrl, options.fetchRequestInit, ({ res, result }) => {
2608
- if (!contentType) {
2609
- contentType = res.headers.get("Content-Type") || "";
2610
- }
2611
- return getContentFromDataUrl(result);
2612
- });
2613
- dataURL = makeDataUrl(content, contentType);
2614
- } catch (error) {
2615
- dataURL = options.imagePlaceholder || "";
2616
- let msg = `Failed to fetch resource: ${resourceUrl}`;
2617
- if (error) {
2618
- msg = typeof error === "string" ? error : error.message;
2619
- }
2620
- if (msg) {
2621
- console.warn(msg);
2622
- }
2623
- }
2624
- cache[cacheKey] = dataURL;
2625
- return dataURL;
2539
+ function clsx() {
2540
+ for (var e, t, f = 0, n = ""; f < arguments.length; )
2541
+ (e = arguments[f++]) && (t = r(e)) && (n && (n += " "), n += t);
2542
+ return n;
2626
2543
  }
2544
+ var clsx_default = clsx;
2627
2545
 
2628
- // ../../node_modules/html-to-image/es/clone-node.js
2629
- async function cloneCanvasElement(canvas) {
2630
- const dataURL = canvas.toDataURL();
2631
- if (dataURL === "data:,") {
2632
- return canvas.cloneNode(false);
2546
+ // src/ThemeProvider.tsx
2547
+ var import_jsx_runtime = require("react/jsx-runtime");
2548
+ var DEFAULT_DENSITY = "medium";
2549
+ var DEFAULT_THEME = "salt-theme";
2550
+ var DEFAULT_THEME_MODE = "light";
2551
+ var ThemeContext = (0, import_react.createContext)({
2552
+ density: "high",
2553
+ theme: "vuu",
2554
+ themeMode: "light"
2555
+ });
2556
+ var DEFAULT_THEME_ATTRIBUTES = [
2557
+ "vuu",
2558
+ "vuu-density-high",
2559
+ "light"
2560
+ ];
2561
+ var useThemeAttributes = (themeAttributes) => {
2562
+ const context = (0, import_react.useContext)(ThemeContext);
2563
+ if (themeAttributes) {
2564
+ return [
2565
+ themeAttributes.themeClass,
2566
+ themeAttributes.densityClass,
2567
+ themeAttributes.dataMode
2568
+ ];
2569
+ } else if (context) {
2570
+ return [
2571
+ `${context.theme}-theme`,
2572
+ `${context.theme}-density-${context.density}`,
2573
+ context.themeMode
2574
+ ];
2633
2575
  }
2634
- return createImage(dataURL);
2635
- }
2636
- async function cloneVideoElement(video, options) {
2637
- if (video.currentSrc) {
2638
- const canvas = document.createElement("canvas");
2639
- const ctx = canvas.getContext("2d");
2640
- canvas.width = video.clientWidth;
2641
- canvas.height = video.clientHeight;
2642
- ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
2643
- const dataURL2 = canvas.toDataURL();
2644
- return createImage(dataURL2);
2645
- }
2646
- const poster = video.poster;
2647
- const contentType = getMimeType(poster);
2648
- const dataURL = await resourceToDataURL(poster, contentType, options);
2649
- return createImage(dataURL);
2650
- }
2651
- async function cloneIFrameElement(iframe) {
2576
+ return DEFAULT_THEME_ATTRIBUTES;
2577
+ };
2578
+ var createThemedChildren = (children, theme, themeMode, density) => {
2652
2579
  var _a;
2653
- try {
2654
- if ((_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentDocument) === null || _a === void 0 ? void 0 : _a.body) {
2655
- return await cloneNode(iframe.contentDocument.body, {}, true);
2656
- }
2657
- } catch (_b) {
2658
- }
2659
- return iframe.cloneNode(false);
2660
- }
2661
- async function cloneSingleNode(node, options) {
2662
- if (isInstanceOfElement(node, HTMLCanvasElement)) {
2663
- return cloneCanvasElement(node);
2664
- }
2665
- if (isInstanceOfElement(node, HTMLVideoElement)) {
2666
- return cloneVideoElement(node, options);
2667
- }
2668
- if (isInstanceOfElement(node, HTMLIFrameElement)) {
2669
- return cloneIFrameElement(node);
2670
- }
2671
- return node.cloneNode(false);
2672
- }
2673
- var isSlotElement = (node) => node.tagName != null && node.tagName.toUpperCase() === "SLOT";
2674
- async function cloneChildren(nativeNode, clonedNode, options) {
2675
- var _a, _b;
2676
- let children = [];
2677
- if (isSlotElement(nativeNode) && nativeNode.assignedNodes) {
2678
- children = toArray(nativeNode.assignedNodes());
2679
- } else if (isInstanceOfElement(nativeNode, HTMLIFrameElement) && ((_a = nativeNode.contentDocument) === null || _a === void 0 ? void 0 : _a.body)) {
2680
- children = toArray(nativeNode.contentDocument.body.childNodes);
2681
- } else {
2682
- children = toArray(((_b = nativeNode.shadowRoot) !== null && _b !== void 0 ? _b : nativeNode).childNodes);
2683
- }
2684
- if (children.length === 0 || isInstanceOfElement(nativeNode, HTMLVideoElement)) {
2685
- return clonedNode;
2686
- }
2687
- await children.reduce((deferred, child) => deferred.then(() => cloneNode(child, options)).then((clonedChild) => {
2688
- if (clonedChild) {
2689
- clonedNode.appendChild(clonedChild);
2690
- }
2691
- }), Promise.resolve());
2692
- return clonedNode;
2693
- }
2694
- function cloneCSSStyle(nativeNode, clonedNode) {
2695
- const targetStyle = clonedNode.style;
2696
- if (!targetStyle) {
2697
- return;
2698
- }
2699
- const sourceStyle = window.getComputedStyle(nativeNode);
2700
- if (sourceStyle.cssText) {
2701
- targetStyle.cssText = sourceStyle.cssText;
2702
- targetStyle.transformOrigin = sourceStyle.transformOrigin;
2703
- } else {
2704
- toArray(sourceStyle).forEach((name) => {
2705
- let value = sourceStyle.getPropertyValue(name);
2706
- if (name === "font-size" && value.endsWith("px")) {
2707
- const reducedFont = Math.floor(parseFloat(value.substring(0, value.length - 2))) - 0.1;
2708
- value = `${reducedFont}px`;
2709
- }
2710
- if (isInstanceOfElement(nativeNode, HTMLIFrameElement) && name === "display" && value === "inline") {
2711
- value = "block";
2712
- }
2713
- if (name === "d" && clonedNode.getAttribute("d")) {
2714
- value = `path(${clonedNode.getAttribute("d")})`;
2715
- }
2716
- targetStyle.setProperty(name, value, sourceStyle.getPropertyPriority(name));
2580
+ if ((0, import_react.isValidElement)(children)) {
2581
+ return (0, import_react.cloneElement)(children, {
2582
+ className: clsx_default(
2583
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
2584
+ (_a = children.props) == null ? void 0 : _a.className,
2585
+ `${theme}-theme`,
2586
+ `${theme}-density-${density}`
2587
+ ),
2588
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2589
+ // @ts-expect-error
2590
+ "data-mode": themeMode
2717
2591
  });
2592
+ } else {
2593
+ console.warn(
2594
+ `
2595
+ ThemeProvider can only apply CSS classes for theming to a single nested child element of the ThemeProvider.
2596
+ Wrap elements with a single container`
2597
+ );
2598
+ return children;
2718
2599
  }
2719
- }
2720
- function cloneInputValue(nativeNode, clonedNode) {
2721
- if (isInstanceOfElement(nativeNode, HTMLTextAreaElement)) {
2722
- clonedNode.innerHTML = nativeNode.value;
2723
- }
2724
- if (isInstanceOfElement(nativeNode, HTMLInputElement)) {
2725
- clonedNode.setAttribute("value", nativeNode.value);
2726
- }
2727
- }
2728
- function cloneSelectValue(nativeNode, clonedNode) {
2729
- if (isInstanceOfElement(nativeNode, HTMLSelectElement)) {
2730
- const clonedSelect = clonedNode;
2731
- const selectedOption = Array.from(clonedSelect.children).find((child) => nativeNode.value === child.getAttribute("value"));
2732
- if (selectedOption) {
2733
- selectedOption.setAttribute("selected", "");
2734
- }
2735
- }
2736
- }
2737
- function decorate(nativeNode, clonedNode) {
2738
- if (isInstanceOfElement(clonedNode, Element)) {
2739
- cloneCSSStyle(nativeNode, clonedNode);
2740
- clonePseudoElements(nativeNode, clonedNode);
2741
- cloneInputValue(nativeNode, clonedNode);
2742
- cloneSelectValue(nativeNode, clonedNode);
2743
- }
2744
- return clonedNode;
2745
- }
2746
- async function ensureSVGSymbols(clone, options) {
2747
- const uses = clone.querySelectorAll ? clone.querySelectorAll("use") : [];
2748
- if (uses.length === 0) {
2749
- return clone;
2750
- }
2751
- const processedDefs = {};
2752
- for (let i = 0; i < uses.length; i++) {
2753
- const use = uses[i];
2754
- const id = use.getAttribute("xlink:href");
2755
- if (id) {
2756
- const exist = clone.querySelector(id);
2757
- const definition = document.querySelector(id);
2758
- if (!exist && definition && !processedDefs[id]) {
2759
- processedDefs[id] = await cloneNode(definition, options, true);
2760
- }
2761
- }
2762
- }
2763
- const nodes = Object.values(processedDefs);
2764
- if (nodes.length) {
2765
- const ns = "http://www.w3.org/1999/xhtml";
2766
- const svg = document.createElementNS(ns, "svg");
2767
- svg.setAttribute("xmlns", ns);
2768
- svg.style.position = "absolute";
2769
- svg.style.width = "0";
2770
- svg.style.height = "0";
2771
- svg.style.overflow = "hidden";
2772
- svg.style.display = "none";
2773
- const defs = document.createElementNS(ns, "defs");
2774
- svg.appendChild(defs);
2775
- for (let i = 0; i < nodes.length; i++) {
2776
- defs.appendChild(nodes[i]);
2777
- }
2778
- clone.appendChild(svg);
2779
- }
2780
- return clone;
2781
- }
2782
- async function cloneNode(node, options, isRoot) {
2783
- if (!isRoot && options.filter && !options.filter(node)) {
2784
- return null;
2785
- }
2786
- 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));
2787
- }
2788
-
2789
- // ../../node_modules/html-to-image/es/embed-resources.js
2790
- var URL_REGEX = /url\((['"]?)([^'"]+?)\1\)/g;
2791
- var URL_WITH_FORMAT_REGEX = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g;
2792
- var FONT_SRC_REGEX = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
2793
- function toRegex(url) {
2794
- const escaped = url.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
2795
- return new RegExp(`(url\\(['"]?)(${escaped})(['"]?\\))`, "g");
2796
- }
2797
- function parseURLs(cssText) {
2798
- const urls = [];
2799
- cssText.replace(URL_REGEX, (raw, quotation, url) => {
2800
- urls.push(url);
2801
- return raw;
2802
- });
2803
- return urls.filter((url) => !isDataUrl(url));
2804
- }
2805
- async function embed(cssText, resourceURL, baseURL, options, getContentFromUrl) {
2806
- try {
2807
- const resolvedURL = baseURL ? resolveUrl(resourceURL, baseURL) : resourceURL;
2808
- const contentType = getMimeType(resourceURL);
2809
- let dataURL;
2810
- if (getContentFromUrl) {
2811
- const content = await getContentFromUrl(resolvedURL);
2812
- dataURL = makeDataUrl(content, contentType);
2813
- } else {
2814
- dataURL = await resourceToDataURL(resolvedURL, contentType, options);
2815
- }
2816
- return cssText.replace(toRegex(resourceURL), `$1${dataURL}$3`);
2817
- } catch (error) {
2818
- }
2819
- return cssText;
2820
- }
2821
- function filterPreferredFontFormat(str, { preferredFontFormat }) {
2822
- return !preferredFontFormat ? str : str.replace(FONT_SRC_REGEX, (match) => {
2823
- while (true) {
2824
- const [src, , format] = URL_WITH_FORMAT_REGEX.exec(match) || [];
2825
- if (!format) {
2826
- return "";
2827
- }
2828
- if (format === preferredFontFormat) {
2829
- return `src: ${src};`;
2830
- }
2831
- }
2832
- });
2833
- }
2834
- function shouldEmbed(url) {
2835
- return url.search(URL_REGEX) !== -1;
2836
- }
2837
- async function embedResources(cssText, baseUrl, options) {
2838
- if (!shouldEmbed(cssText)) {
2839
- return cssText;
2840
- }
2841
- const filteredCSSText = filterPreferredFontFormat(cssText, options);
2842
- const urls = parseURLs(filteredCSSText);
2843
- return urls.reduce((deferred, url) => deferred.then((css) => embed(css, url, baseUrl, options)), Promise.resolve(filteredCSSText));
2844
- }
2600
+ };
2601
+ var ThemeProvider = ({
2602
+ applyThemeClasses = false,
2603
+ children,
2604
+ theme: themeProp,
2605
+ themeMode: themeModeProp,
2606
+ density: densityProp
2607
+ }) => {
2608
+ var _a, _b, _c;
2609
+ const {
2610
+ density: inheritedDensity,
2611
+ themeMode: inheritedThemeMode,
2612
+ theme: inheritedTheme
2613
+ } = (0, import_react.useContext)(ThemeContext);
2614
+ const density = (_a = densityProp != null ? densityProp : inheritedDensity) != null ? _a : DEFAULT_DENSITY;
2615
+ const themeMode = (_b = themeModeProp != null ? themeModeProp : inheritedThemeMode) != null ? _b : DEFAULT_THEME_MODE;
2616
+ const theme = (_c = themeProp != null ? themeProp : inheritedTheme) != null ? _c : DEFAULT_THEME;
2617
+ const themedChildren = applyThemeClasses ? createThemedChildren(children, theme, themeMode, density) : children;
2618
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeContext.Provider, { value: { themeMode, density, theme }, children: themedChildren });
2619
+ };
2620
+ ThemeProvider.displayName = "ThemeProvider";
2845
2621
 
2846
- // ../../node_modules/html-to-image/es/embed-images.js
2847
- async function embedProp(propName, node, options) {
2622
+ // src/url-utils.ts
2623
+ var getUrlParameter = (paramName, defaultValue) => {
2848
2624
  var _a;
2849
- const propValue = (_a = node.style) === null || _a === void 0 ? void 0 : _a.getPropertyValue(propName);
2850
- if (propValue) {
2851
- const cssString = await embedResources(propValue, null, options);
2852
- node.style.setProperty(propName, cssString, node.style.getPropertyPriority(propName));
2853
- return true;
2854
- }
2855
- return false;
2856
- }
2857
- async function embedBackground(clonedNode, options) {
2858
- if (!await embedProp("background", clonedNode, options)) {
2859
- await embedProp("background-image", clonedNode, options);
2860
- }
2861
- if (!await embedProp("mask", clonedNode, options)) {
2862
- await embedProp("mask-image", clonedNode, options);
2863
- }
2864
- }
2865
- async function embedImageNode(clonedNode, options) {
2866
- const isImageElement = isInstanceOfElement(clonedNode, HTMLImageElement);
2867
- if (!(isImageElement && !isDataUrl(clonedNode.src)) && !(isInstanceOfElement(clonedNode, SVGImageElement) && !isDataUrl(clonedNode.href.baseVal))) {
2868
- return;
2869
- }
2870
- const url = isImageElement ? clonedNode.src : clonedNode.href.baseVal;
2871
- const dataURL = await resourceToDataURL(url, getMimeType(url), options);
2872
- await new Promise((resolve, reject) => {
2873
- clonedNode.onload = resolve;
2874
- clonedNode.onerror = reject;
2875
- const image = clonedNode;
2876
- if (image.decode) {
2877
- image.decode = resolve;
2878
- }
2879
- if (image.loading === "lazy") {
2880
- image.loading = "eager";
2881
- }
2882
- if (isImageElement) {
2883
- clonedNode.srcset = "";
2884
- clonedNode.src = dataURL;
2885
- } else {
2886
- clonedNode.href.baseVal = dataURL;
2887
- }
2888
- });
2889
- }
2890
- async function embedChildren(clonedNode, options) {
2891
- const children = toArray(clonedNode.childNodes);
2892
- const deferreds = children.map((child) => embedImages(child, options));
2893
- await Promise.all(deferreds).then(() => clonedNode);
2894
- }
2895
- async function embedImages(clonedNode, options) {
2896
- if (isInstanceOfElement(clonedNode, Element)) {
2897
- await embedBackground(clonedNode, options);
2898
- await embedImageNode(clonedNode, options);
2899
- await embedChildren(clonedNode, options);
2900
- }
2901
- }
2625
+ return (_a = new URL(document.location.href).searchParams.get(paramName)) != null ? _a : defaultValue;
2626
+ };
2627
+ var hasUrlParameter = (paramName) => new URL(document.location.href).searchParams.has(paramName);
2902
2628
 
2903
- // ../../node_modules/html-to-image/es/apply-style.js
2904
- function applyStyle(node, options) {
2905
- const { style } = node;
2906
- if (options.backgroundColor) {
2907
- style.backgroundColor = options.backgroundColor;
2908
- }
2909
- if (options.width) {
2910
- style.width = `${options.width}px`;
2911
- }
2912
- if (options.height) {
2913
- style.height = `${options.height}px`;
2914
- }
2915
- const manual = options.style;
2916
- if (manual != null) {
2917
- Object.keys(manual).forEach((key) => {
2918
- style[key] = manual[key];
2919
- });
2920
- }
2921
- return node;
2922
- }
2629
+ // src/useId.ts
2630
+ var import_react2 = require("react");
2631
+ var vuuComponentIdCount = 0;
2632
+ var useId = (id) => (0, import_react2.useMemo)(() => id != null ? id : `vuu-${++vuuComponentIdCount}`, [id]);
2923
2633
 
2924
- // ../../node_modules/html-to-image/es/embed-webfonts.js
2925
- var cssFetchCache = {};
2926
- async function fetchCSS(url) {
2927
- let cache2 = cssFetchCache[url];
2928
- if (cache2 != null) {
2929
- return cache2;
2930
- }
2931
- const res = await fetch(url);
2932
- const cssText = await res.text();
2933
- cache2 = { url, cssText };
2934
- cssFetchCache[url] = cache2;
2935
- return cache2;
2936
- }
2937
- async function embedFonts(data, options) {
2938
- let cssText = data.cssText;
2939
- const regexUrl = /url\(["']?([^"')]+)["']?\)/g;
2940
- const fontLocs = cssText.match(/url\([^)]+\)/g) || [];
2941
- const loadFonts = fontLocs.map(async (loc) => {
2942
- let url = loc.replace(regexUrl, "$1");
2943
- if (!url.startsWith("https://")) {
2944
- url = new URL(url, data.url).href;
2945
- }
2946
- return fetchAsDataURL(url, options.fetchRequestInit, ({ result }) => {
2947
- cssText = cssText.replace(loc, `url(${result})`);
2948
- return [loc, result];
2949
- });
2950
- });
2951
- return Promise.all(loadFonts).then(() => cssText);
2952
- }
2953
- function parseCSS(source) {
2954
- if (source == null) {
2955
- return [];
2956
- }
2957
- const result = [];
2958
- const commentsRegex = /(\/\*[\s\S]*?\*\/)/gi;
2959
- let cssText = source.replace(commentsRegex, "");
2960
- const keyframesRegex = new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi");
2961
- while (true) {
2962
- const matches = keyframesRegex.exec(cssText);
2963
- if (matches === null) {
2964
- break;
2965
- }
2966
- result.push(matches[0]);
2967
- }
2968
- cssText = cssText.replace(keyframesRegex, "");
2969
- const importRegex = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi;
2970
- const combinedCSSRegex = "((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})";
2971
- const unifiedRegex = new RegExp(combinedCSSRegex, "gi");
2972
- while (true) {
2973
- let matches = importRegex.exec(cssText);
2974
- if (matches === null) {
2975
- matches = unifiedRegex.exec(cssText);
2976
- if (matches === null) {
2977
- break;
2978
- } else {
2979
- importRegex.lastIndex = unifiedRegex.lastIndex;
2980
- }
2634
+ // src/useLayoutEffectSkipFirst.ts
2635
+ var import_react3 = require("react");
2636
+ var useLayoutEffectSkipFirst = (func, deps) => {
2637
+ const goodToGo = (0, import_react3.useRef)(false);
2638
+ (0, import_react3.useLayoutEffect)(() => {
2639
+ if (goodToGo.current) {
2640
+ func();
2981
2641
  } else {
2982
- unifiedRegex.lastIndex = importRegex.lastIndex;
2983
- }
2984
- result.push(matches[0]);
2985
- }
2986
- return result;
2987
- }
2988
- async function getCSSRules(styleSheets, options) {
2989
- const ret = [];
2990
- const deferreds = [];
2991
- styleSheets.forEach((sheet) => {
2992
- if ("cssRules" in sheet) {
2993
- try {
2994
- toArray(sheet.cssRules || []).forEach((item, index) => {
2995
- if (item.type === CSSRule.IMPORT_RULE) {
2996
- let importIndex = index + 1;
2997
- const url = item.href;
2998
- const deferred = fetchCSS(url).then((metadata) => embedFonts(metadata, options)).then((cssText) => parseCSS(cssText).forEach((rule) => {
2999
- try {
3000
- sheet.insertRule(rule, rule.startsWith("@import") ? importIndex += 1 : sheet.cssRules.length);
3001
- } catch (error) {
3002
- console.error("Error inserting rule from remote css", {
3003
- rule,
3004
- error
3005
- });
3006
- }
3007
- })).catch((e) => {
3008
- console.error("Error loading remote css", e.toString());
3009
- });
3010
- deferreds.push(deferred);
3011
- }
3012
- });
3013
- } catch (e) {
3014
- const inline = styleSheets.find((a) => a.href == null) || document.styleSheets[0];
3015
- if (sheet.href != null) {
3016
- deferreds.push(fetchCSS(sheet.href).then((metadata) => embedFonts(metadata, options)).then((cssText) => parseCSS(cssText).forEach((rule) => {
3017
- inline.insertRule(rule, sheet.cssRules.length);
3018
- })).catch((err) => {
3019
- console.error("Error loading remote stylesheet", err);
3020
- }));
3021
- }
3022
- console.error("Error inlining remote css file", e);
3023
- }
2642
+ goodToGo.current = true;
3024
2643
  }
3025
- });
3026
- return Promise.all(deferreds).then(() => {
3027
- styleSheets.forEach((sheet) => {
3028
- if ("cssRules" in sheet) {
3029
- try {
3030
- toArray(sheet.cssRules || []).forEach((item) => {
3031
- ret.push(item);
3032
- });
3033
- } catch (e) {
3034
- console.error(`Error while reading CSS rules from ${sheet.href}`, e);
3035
- }
3036
- }
3037
- });
3038
- return ret;
3039
- });
3040
- }
3041
- function getWebFontRules(cssRules) {
3042
- return cssRules.filter((rule) => rule.type === CSSRule.FONT_FACE_RULE).filter((rule) => shouldEmbed(rule.style.getPropertyValue("src")));
3043
- }
3044
- async function parseWebFontRules(node, options) {
3045
- if (node.ownerDocument == null) {
3046
- throw new Error("Provided element is not within a Document");
3047
- }
3048
- const styleSheets = toArray(node.ownerDocument.styleSheets);
3049
- const cssRules = await getCSSRules(styleSheets, options);
3050
- return getWebFontRules(cssRules);
3051
- }
3052
- async function getWebFontCSS(node, options) {
3053
- const rules = await parseWebFontRules(node, options);
3054
- const cssTexts = await Promise.all(rules.map((rule) => {
3055
- const baseUrl = rule.parentStyleSheet ? rule.parentStyleSheet.href : null;
3056
- return embedResources(rule.cssText, baseUrl, options);
3057
- }));
3058
- return cssTexts.join("\n");
3059
- }
3060
- async function embedWebFonts(clonedNode, options) {
3061
- const cssText = options.fontEmbedCSS != null ? options.fontEmbedCSS : options.skipFonts ? null : await getWebFontCSS(clonedNode, options);
3062
- if (cssText) {
3063
- const styleNode = document.createElement("style");
3064
- const sytleContent = document.createTextNode(cssText);
3065
- styleNode.appendChild(sytleContent);
3066
- if (clonedNode.firstChild) {
3067
- clonedNode.insertBefore(styleNode, clonedNode.firstChild);
3068
- } else {
3069
- clonedNode.appendChild(styleNode);
3070
- }
3071
- }
3072
- }
3073
-
3074
- // ../../node_modules/html-to-image/es/index.js
3075
- async function toSvg(node, options = {}) {
3076
- const { width, height } = getImageSize(node, options);
3077
- const clonedNode = await cloneNode(node, options, true);
3078
- await embedWebFonts(clonedNode, options);
3079
- await embedImages(clonedNode, options);
3080
- applyStyle(clonedNode, options);
3081
- const datauri = await nodeToDataURL(clonedNode, width, height);
3082
- return datauri;
3083
- }
3084
- async function toCanvas(node, options = {}) {
3085
- const { width, height } = getImageSize(node, options);
3086
- const svg = await toSvg(node, options);
3087
- const img = await createImage(svg);
3088
- const canvas = document.createElement("canvas");
3089
- const context = canvas.getContext("2d");
3090
- const ratio = options.pixelRatio || getPixelRatio();
3091
- const canvasWidth = options.canvasWidth || width;
3092
- const canvasHeight = options.canvasHeight || height;
3093
- canvas.width = canvasWidth * ratio;
3094
- canvas.height = canvasHeight * ratio;
3095
- if (!options.skipAutoScale) {
3096
- checkCanvasDimensions(canvas);
3097
- }
3098
- canvas.style.width = `${canvasWidth}`;
3099
- canvas.style.height = `${canvasHeight}`;
3100
- if (options.backgroundColor) {
3101
- context.fillStyle = options.backgroundColor;
3102
- context.fillRect(0, 0, canvas.width, canvas.height);
3103
- }
3104
- context.drawImage(img, 0, 0, canvas.width, canvas.height);
3105
- return canvas;
3106
- }
3107
- async function toPng(node, options = {}) {
3108
- const canvas = await toCanvas(node, options);
3109
- return canvas.toDataURL();
3110
- }
3111
-
3112
- // src/screenshot-utils.ts
3113
- async function takeScreenshot(node) {
3114
- const screenshot = await toPng(node, { cacheBust: true }).then((dataUrl) => {
3115
- return dataUrl;
3116
- }).catch((err) => {
3117
- console.error("Error taking screenshot", err);
3118
- return void 0;
3119
- });
3120
- if (!screenshot) {
3121
- return void 0;
3122
- }
3123
- return screenshot;
3124
- }
2644
+ }, deps);
2645
+ };
3125
2646
  //# sourceMappingURL=index.js.map