@infinite-table/infinite-react 3.0.13 → 3.0.15
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/index.d.ts +17 -2
- package/index.dev.js +162 -52
- package/index.dev.mjs +162 -52
- package/index.js +2 -2
- package/index.mjs +2 -2
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -511,7 +511,7 @@ declare type InfiniteTableComputedColumn<T> = InfiniteTableColumn<T> & InfiniteT
|
|
|
511
511
|
declare type InfiniteTableComputedPivotFinalColumn<T> = InfiniteTableComputedColumn<T> & InfiniteTablePivotFinalColumn<T>;
|
|
512
512
|
|
|
513
513
|
interface LogFn {
|
|
514
|
-
(...args: any[]):
|
|
514
|
+
(...args: any[]): void;
|
|
515
515
|
extend: (channelName: string) => LogFn;
|
|
516
516
|
}
|
|
517
517
|
declare class Logger {
|
|
@@ -3007,7 +3007,22 @@ declare type InterceptedMapFns<K, V> = {
|
|
|
3007
3007
|
*/
|
|
3008
3008
|
declare function interceptMap<K, V>(map: Map<K, V>, fns: InterceptedMapFns<K, V>): () => void;
|
|
3009
3009
|
|
|
3010
|
-
declare
|
|
3010
|
+
declare type DebugLogger = {
|
|
3011
|
+
(...args: any[]): void;
|
|
3012
|
+
extend: (channelName: string) => DebugLogger;
|
|
3013
|
+
color: (colorName: string, ...message: string[]) => [string, string];
|
|
3014
|
+
enabled: boolean;
|
|
3015
|
+
channel: string;
|
|
3016
|
+
destroy: () => void;
|
|
3017
|
+
logFn: undefined | ((...args: any[]) => void);
|
|
3018
|
+
};
|
|
3019
|
+
declare const debug: {
|
|
3020
|
+
(channelName: string): DebugLogger;
|
|
3021
|
+
colors: string[];
|
|
3022
|
+
enable: string;
|
|
3023
|
+
diffenable: string | boolean;
|
|
3024
|
+
logFn: DebugLogger['logFn'];
|
|
3025
|
+
};
|
|
3011
3026
|
|
|
3012
3027
|
declare function useEffectWithChanges<T>(fn: (changes: Record<keyof T, any>, prevValues: Record<string, any>) => void | (() => void), deps: Record<keyof T, any>): void;
|
|
3013
3028
|
|
package/index.dev.js
CHANGED
|
@@ -631,7 +631,7 @@ function getGlobal() {
|
|
|
631
631
|
}
|
|
632
632
|
|
|
633
633
|
// src/utils/debugPackage.ts
|
|
634
|
-
var
|
|
634
|
+
var COLORS = [
|
|
635
635
|
"#0000CC",
|
|
636
636
|
"#0000FF",
|
|
637
637
|
"#0033CC",
|
|
@@ -709,92 +709,184 @@ var colors = [
|
|
|
709
709
|
"#FFCC00",
|
|
710
710
|
"#FFCC33"
|
|
711
711
|
];
|
|
712
|
-
var
|
|
713
|
-
var
|
|
712
|
+
var COLOR_SYMBOL = Symbol("color");
|
|
713
|
+
var USED_COLORS_MAP = /* @__PURE__ */ new WeakMap();
|
|
714
|
+
USED_COLORS_MAP.set(
|
|
715
|
+
COLORS,
|
|
716
|
+
COLORS.map((_) => 0)
|
|
717
|
+
);
|
|
718
|
+
var getNextColor = (colors = COLORS) => {
|
|
719
|
+
var _a, _b;
|
|
720
|
+
let usedColors = [];
|
|
721
|
+
if (USED_COLORS_MAP.has(colors)) {
|
|
722
|
+
usedColors = USED_COLORS_MAP.get(colors);
|
|
723
|
+
} else {
|
|
724
|
+
usedColors = colors.map((_) => 0);
|
|
725
|
+
USED_COLORS_MAP.set(colors, usedColors);
|
|
726
|
+
}
|
|
714
727
|
const index = usedColors.reduce(
|
|
715
728
|
(iMin, x, i, arr) => x < arr[iMin] ? i : iMin,
|
|
716
729
|
0
|
|
717
730
|
);
|
|
718
|
-
usedColors[index]
|
|
719
|
-
|
|
731
|
+
if (usedColors[index] != void 0) {
|
|
732
|
+
usedColors[index]++;
|
|
733
|
+
}
|
|
734
|
+
return (_b = (_a = colors[index]) != null ? _a : colors[0]) != null ? _b : COLORS[0];
|
|
720
735
|
};
|
|
721
736
|
var CHANNEL_SEPARATOR = ":";
|
|
722
737
|
var CHANNEL_WILDCARD = "*";
|
|
738
|
+
var CHANNEL_NEGATION_CHAR = "-";
|
|
723
739
|
var STORAGE_SEPARATOR = ",";
|
|
724
740
|
var STORAGE_KEY = "debug";
|
|
725
741
|
var STORAGE_DIFF_KEY = "diffdebug";
|
|
726
742
|
var DEFAULT_LOG_DIFF = false;
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
const
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
const
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
743
|
+
var loggers = new DeepMap();
|
|
744
|
+
var enabledChannelsCache = /* @__PURE__ */ new Map();
|
|
745
|
+
function isChannelTargeted(channel, permissionToken) {
|
|
746
|
+
const parts = channel.split(CHANNEL_SEPARATOR);
|
|
747
|
+
const partsMap = new DeepMap();
|
|
748
|
+
partsMap.set(parts, true);
|
|
749
|
+
const tokenParts = permissionToken.split(CHANNEL_SEPARATOR);
|
|
750
|
+
const hasWildcard = new Set(tokenParts).has(CHANNEL_WILDCARD);
|
|
751
|
+
const storagePartsWithoutWildcard = hasWildcard ? tokenParts.slice(0, tokenParts.indexOf(CHANNEL_WILDCARD)) : tokenParts;
|
|
752
|
+
if (partsMap.getKeysStartingWith(storagePartsWithoutWildcard, hasWildcard).length > 0) {
|
|
753
|
+
return true;
|
|
754
|
+
}
|
|
755
|
+
return void 0;
|
|
756
|
+
}
|
|
757
|
+
function isLoggingEnabled(channel, permissions) {
|
|
758
|
+
const cacheKey = `channel=${channel}_permissions=${permissions}`;
|
|
759
|
+
if (enabledChannelsCache.has(cacheKey)) {
|
|
760
|
+
return enabledChannelsCache.get(cacheKey);
|
|
761
|
+
}
|
|
762
|
+
const permissionTokens = permissions.split(STORAGE_SEPARATOR);
|
|
763
|
+
function done(result) {
|
|
764
|
+
enabledChannelsCache.set(cacheKey, result);
|
|
765
|
+
return result;
|
|
766
|
+
}
|
|
767
|
+
const exactTokens = [];
|
|
768
|
+
const wildcardTokens = [];
|
|
769
|
+
permissionTokens.forEach((permissionToken) => {
|
|
770
|
+
if (permissionToken.includes(CHANNEL_WILDCARD)) {
|
|
771
|
+
wildcardTokens.push(permissionToken);
|
|
772
|
+
} else {
|
|
773
|
+
exactTokens.push(permissionToken);
|
|
774
|
+
}
|
|
775
|
+
});
|
|
776
|
+
for (let i = 0; i < exactTokens.length; i++) {
|
|
777
|
+
let exactToken = exactTokens[i];
|
|
778
|
+
const negative = exactToken.startsWith(CHANNEL_NEGATION_CHAR);
|
|
779
|
+
if (negative) {
|
|
780
|
+
exactToken = exactToken.substring(CHANNEL_NEGATION_CHAR.length);
|
|
781
|
+
}
|
|
782
|
+
if (isChannelTargeted(channel, exactToken)) {
|
|
783
|
+
return done(negative ? false : true);
|
|
744
784
|
}
|
|
745
|
-
storageKeyValue = value;
|
|
746
785
|
}
|
|
786
|
+
for (let i = 0; i < wildcardTokens.length; i++) {
|
|
787
|
+
let permissionToken = wildcardTokens[i];
|
|
788
|
+
const negated = permissionToken.startsWith("-");
|
|
789
|
+
if (negated) {
|
|
790
|
+
permissionToken = permissionToken.substring(1);
|
|
791
|
+
}
|
|
792
|
+
if (isChannelTargeted(channel, permissionToken)) {
|
|
793
|
+
return done(negated ? false : true);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
return done(false);
|
|
797
|
+
}
|
|
798
|
+
var getStorageKeyValue = () => {
|
|
799
|
+
var _a, _b, _c;
|
|
800
|
+
return (_c = (_b = debug.enable) != null ? _b : getGlobal() && ((_a = getGlobal().localStorage) == null ? void 0 : _a.getItem(STORAGE_KEY))) != null ? _c : "";
|
|
801
|
+
};
|
|
802
|
+
var getDiffStorageKeyValue = () => {
|
|
803
|
+
var _a, _b, _c;
|
|
804
|
+
return (_c = (_b = debug.diffenable) != null ? _b : getGlobal() && ((_a = getGlobal().localStorage) == null ? void 0 : _a.getItem(STORAGE_DIFF_KEY))) != null ? _c : `${DEFAULT_LOG_DIFF}`;
|
|
805
|
+
};
|
|
806
|
+
var storageKeyValue = "";
|
|
807
|
+
var logDiffs = DEFAULT_LOG_DIFF;
|
|
808
|
+
function updateStorageKeyValue(value) {
|
|
809
|
+
logDiffs = `${getDiffStorageKeyValue()}` == "true";
|
|
810
|
+
if (storageKeyValue === value) {
|
|
811
|
+
return;
|
|
812
|
+
}
|
|
813
|
+
storageKeyValue = value;
|
|
814
|
+
enabledChannelsCache.clear();
|
|
815
|
+
}
|
|
816
|
+
function debugPackage(channelName) {
|
|
747
817
|
updateStorageKeyValue(getStorageKeyValue());
|
|
748
818
|
typeof getGlobal() !== "undefined" && getGlobal().addEventListener && getGlobal().addEventListener("storage", function() {
|
|
749
819
|
updateStorageKeyValue(getStorageKeyValue());
|
|
750
820
|
});
|
|
751
|
-
function isLoggingEnabled(channel) {
|
|
752
|
-
const parts = channel.split(CHANNEL_SEPARATOR);
|
|
753
|
-
const partsMap = new DeepMap();
|
|
754
|
-
partsMap.set(parts, true);
|
|
755
|
-
const multipleStorageValues = storageKeyValue.split(STORAGE_SEPARATOR);
|
|
756
|
-
for (let i = 0; i < multipleStorageValues.length; i++) {
|
|
757
|
-
const storageValue = multipleStorageValues[i];
|
|
758
|
-
const storageValueParts = storageValue.split(CHANNEL_SEPARATOR);
|
|
759
|
-
const hasWildcard = new Set(storageValueParts).has(CHANNEL_WILDCARD);
|
|
760
|
-
const storagePartsWithoutWildcard = hasWildcard ? storageValueParts.slice(
|
|
761
|
-
0,
|
|
762
|
-
storageValueParts.indexOf(CHANNEL_WILDCARD)
|
|
763
|
-
) : storageValueParts;
|
|
764
|
-
if (partsMap.getKeysStartingWith(storagePartsWithoutWildcard, hasWildcard).length > 0) {
|
|
765
|
-
return true;
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
return false;
|
|
769
|
-
}
|
|
770
821
|
function debugFactory(channelName2, parentChannel) {
|
|
822
|
+
var _a;
|
|
771
823
|
const channel = parentChannel ? `${parentChannel}${CHANNEL_SEPARATOR}${channelName2}` : channelName2;
|
|
772
824
|
const channelParts = channel.split(CHANNEL_SEPARATOR);
|
|
773
825
|
if (loggers.has(channelParts)) {
|
|
774
826
|
return loggers.get(channelParts);
|
|
775
827
|
}
|
|
776
828
|
const parentLogger = loggers.get(channelParts.slice(0, -1));
|
|
777
|
-
|
|
829
|
+
const defaultLogFn = (_a = parentLogger ? parentLogger.logFn : debug.logFn) != null ? _a : defaultLogger;
|
|
830
|
+
let logFn = defaultLogFn;
|
|
778
831
|
let enabled;
|
|
779
832
|
let lastMessageTimestamp = 0;
|
|
780
|
-
const isEnabled = () => enabled != null ? enabled : isLoggingEnabled(channel);
|
|
781
|
-
const color = getNextColor();
|
|
833
|
+
const isEnabled = () => enabled != null ? enabled : isLoggingEnabled(channel, storageKeyValue);
|
|
834
|
+
const color = getNextColor(debug.colors);
|
|
782
835
|
const logger = Object.defineProperties(
|
|
783
836
|
(...args) => {
|
|
784
|
-
if (isLoggingEnabled(channel)) {
|
|
837
|
+
if (isLoggingEnabled(channel, storageKeyValue)) {
|
|
785
838
|
const now = Date.now();
|
|
786
839
|
if (lastMessageTimestamp && logDiffs) {
|
|
787
840
|
const diff = now - lastMessageTimestamp;
|
|
788
841
|
logFn(`%c[${channel}]`, `color: ${color}`, `+${diff}ms:`);
|
|
789
842
|
}
|
|
790
843
|
lastMessageTimestamp = now;
|
|
791
|
-
|
|
844
|
+
const argsToLog = [];
|
|
845
|
+
let textWithColors = void 0;
|
|
846
|
+
args.forEach((arg) => {
|
|
847
|
+
if (arg[COLOR_SYMBOL]) {
|
|
848
|
+
if (textWithColors === void 0) {
|
|
849
|
+
textWithColors = true;
|
|
850
|
+
}
|
|
851
|
+
argsToLog.push(...arg);
|
|
852
|
+
} else {
|
|
853
|
+
if (typeof arg !== "string" && typeof arg !== "number") {
|
|
854
|
+
textWithColors = false;
|
|
855
|
+
return;
|
|
856
|
+
}
|
|
857
|
+
argsToLog.push(`${arg}%s`);
|
|
858
|
+
}
|
|
859
|
+
});
|
|
860
|
+
if (textWithColors) {
|
|
861
|
+
const theArgs = [
|
|
862
|
+
`%c[${channel}]%c %s`,
|
|
863
|
+
`color: ${color}`,
|
|
864
|
+
"",
|
|
865
|
+
...argsToLog,
|
|
866
|
+
""
|
|
867
|
+
];
|
|
868
|
+
logFn(...theArgs);
|
|
869
|
+
} else {
|
|
870
|
+
logFn(`%c[${channel}]`, `color: ${color}`, ...args);
|
|
871
|
+
}
|
|
792
872
|
}
|
|
793
873
|
},
|
|
794
874
|
{
|
|
795
875
|
channel: {
|
|
796
876
|
value: channel
|
|
797
877
|
},
|
|
878
|
+
color: {
|
|
879
|
+
value: (colorName, ...args) => {
|
|
880
|
+
const result = [
|
|
881
|
+
`%c${args.join(" ")}%c%s`,
|
|
882
|
+
`color: ${colorName}`,
|
|
883
|
+
""
|
|
884
|
+
];
|
|
885
|
+
result.toString = () => args.join(" ");
|
|
886
|
+
result[COLOR_SYMBOL] = true;
|
|
887
|
+
return result;
|
|
888
|
+
}
|
|
889
|
+
},
|
|
798
890
|
extend: {
|
|
799
891
|
value: (nextChannel) => {
|
|
800
892
|
return debugFactory(nextChannel, channel);
|
|
@@ -803,10 +895,16 @@ function debug(channelName) {
|
|
|
803
895
|
enabled: {
|
|
804
896
|
get: () => isEnabled()
|
|
805
897
|
},
|
|
806
|
-
|
|
898
|
+
logFn: {
|
|
899
|
+
configurable: false,
|
|
807
900
|
get: () => logFn,
|
|
808
901
|
set: (fn) => {
|
|
809
|
-
logFn = fn;
|
|
902
|
+
logFn = fn != null ? fn : defaultLogFn;
|
|
903
|
+
}
|
|
904
|
+
},
|
|
905
|
+
destroy: {
|
|
906
|
+
value: () => {
|
|
907
|
+
loggers.delete(channelParts);
|
|
810
908
|
}
|
|
811
909
|
}
|
|
812
910
|
}
|
|
@@ -816,17 +914,29 @@ function debug(channelName) {
|
|
|
816
914
|
}
|
|
817
915
|
return debugFactory(channelName);
|
|
818
916
|
}
|
|
917
|
+
var defaultLogger = console.log.bind(console);
|
|
918
|
+
var GLOBAL_ENABLE = void 0;
|
|
919
|
+
Object.defineProperty(debugPackage, "enable", {
|
|
920
|
+
get: () => GLOBAL_ENABLE,
|
|
921
|
+
set: (value) => {
|
|
922
|
+
GLOBAL_ENABLE = value;
|
|
923
|
+
updateStorageKeyValue(getStorageKeyValue());
|
|
924
|
+
}
|
|
925
|
+
});
|
|
926
|
+
var debug = debugPackage;
|
|
927
|
+
debug.colors = COLORS;
|
|
928
|
+
debug.logFn = defaultLogger;
|
|
819
929
|
|
|
820
930
|
// src/utils/debug.ts
|
|
821
931
|
var debugTable = debug(`InfiniteTable`);
|
|
822
932
|
var dbg = (channelName) => {
|
|
823
933
|
const result = debugTable.extend(channelName);
|
|
824
|
-
result.
|
|
934
|
+
result.logFn = console.log.bind(console);
|
|
825
935
|
return result;
|
|
826
936
|
};
|
|
827
937
|
var err = (channelName) => {
|
|
828
938
|
const result = debugTable.extend(`${channelName}:error`);
|
|
829
|
-
result.
|
|
939
|
+
result.logFn = console.error.bind(console);
|
|
830
940
|
return result;
|
|
831
941
|
};
|
|
832
942
|
var emptyLogFn = () => emptyLogFn;
|
|
@@ -17150,7 +17260,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
17150
17260
|
const valid = (0, import_react50.useMemo)(() => {
|
|
17151
17261
|
let valid2 = isValidLicense(licenseKey, {
|
|
17152
17262
|
publishedAt: 1624970570587,
|
|
17153
|
-
version: "3.0.
|
|
17263
|
+
version: "3.0.15"
|
|
17154
17264
|
});
|
|
17155
17265
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
17156
17266
|
return true;
|
package/index.dev.mjs
CHANGED
|
@@ -589,7 +589,7 @@ function getGlobal() {
|
|
|
589
589
|
}
|
|
590
590
|
|
|
591
591
|
// src/utils/debugPackage.ts
|
|
592
|
-
var
|
|
592
|
+
var COLORS = [
|
|
593
593
|
"#0000CC",
|
|
594
594
|
"#0000FF",
|
|
595
595
|
"#0033CC",
|
|
@@ -667,92 +667,184 @@ var colors = [
|
|
|
667
667
|
"#FFCC00",
|
|
668
668
|
"#FFCC33"
|
|
669
669
|
];
|
|
670
|
-
var
|
|
671
|
-
var
|
|
670
|
+
var COLOR_SYMBOL = Symbol("color");
|
|
671
|
+
var USED_COLORS_MAP = /* @__PURE__ */ new WeakMap();
|
|
672
|
+
USED_COLORS_MAP.set(
|
|
673
|
+
COLORS,
|
|
674
|
+
COLORS.map((_) => 0)
|
|
675
|
+
);
|
|
676
|
+
var getNextColor = (colors = COLORS) => {
|
|
677
|
+
var _a, _b;
|
|
678
|
+
let usedColors = [];
|
|
679
|
+
if (USED_COLORS_MAP.has(colors)) {
|
|
680
|
+
usedColors = USED_COLORS_MAP.get(colors);
|
|
681
|
+
} else {
|
|
682
|
+
usedColors = colors.map((_) => 0);
|
|
683
|
+
USED_COLORS_MAP.set(colors, usedColors);
|
|
684
|
+
}
|
|
672
685
|
const index = usedColors.reduce(
|
|
673
686
|
(iMin, x, i, arr) => x < arr[iMin] ? i : iMin,
|
|
674
687
|
0
|
|
675
688
|
);
|
|
676
|
-
usedColors[index]
|
|
677
|
-
|
|
689
|
+
if (usedColors[index] != void 0) {
|
|
690
|
+
usedColors[index]++;
|
|
691
|
+
}
|
|
692
|
+
return (_b = (_a = colors[index]) != null ? _a : colors[0]) != null ? _b : COLORS[0];
|
|
678
693
|
};
|
|
679
694
|
var CHANNEL_SEPARATOR = ":";
|
|
680
695
|
var CHANNEL_WILDCARD = "*";
|
|
696
|
+
var CHANNEL_NEGATION_CHAR = "-";
|
|
681
697
|
var STORAGE_SEPARATOR = ",";
|
|
682
698
|
var STORAGE_KEY = "debug";
|
|
683
699
|
var STORAGE_DIFF_KEY = "diffdebug";
|
|
684
700
|
var DEFAULT_LOG_DIFF = false;
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
const
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
const
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
701
|
+
var loggers = new DeepMap();
|
|
702
|
+
var enabledChannelsCache = /* @__PURE__ */ new Map();
|
|
703
|
+
function isChannelTargeted(channel, permissionToken) {
|
|
704
|
+
const parts = channel.split(CHANNEL_SEPARATOR);
|
|
705
|
+
const partsMap = new DeepMap();
|
|
706
|
+
partsMap.set(parts, true);
|
|
707
|
+
const tokenParts = permissionToken.split(CHANNEL_SEPARATOR);
|
|
708
|
+
const hasWildcard = new Set(tokenParts).has(CHANNEL_WILDCARD);
|
|
709
|
+
const storagePartsWithoutWildcard = hasWildcard ? tokenParts.slice(0, tokenParts.indexOf(CHANNEL_WILDCARD)) : tokenParts;
|
|
710
|
+
if (partsMap.getKeysStartingWith(storagePartsWithoutWildcard, hasWildcard).length > 0) {
|
|
711
|
+
return true;
|
|
712
|
+
}
|
|
713
|
+
return void 0;
|
|
714
|
+
}
|
|
715
|
+
function isLoggingEnabled(channel, permissions) {
|
|
716
|
+
const cacheKey = `channel=${channel}_permissions=${permissions}`;
|
|
717
|
+
if (enabledChannelsCache.has(cacheKey)) {
|
|
718
|
+
return enabledChannelsCache.get(cacheKey);
|
|
719
|
+
}
|
|
720
|
+
const permissionTokens = permissions.split(STORAGE_SEPARATOR);
|
|
721
|
+
function done(result) {
|
|
722
|
+
enabledChannelsCache.set(cacheKey, result);
|
|
723
|
+
return result;
|
|
724
|
+
}
|
|
725
|
+
const exactTokens = [];
|
|
726
|
+
const wildcardTokens = [];
|
|
727
|
+
permissionTokens.forEach((permissionToken) => {
|
|
728
|
+
if (permissionToken.includes(CHANNEL_WILDCARD)) {
|
|
729
|
+
wildcardTokens.push(permissionToken);
|
|
730
|
+
} else {
|
|
731
|
+
exactTokens.push(permissionToken);
|
|
732
|
+
}
|
|
733
|
+
});
|
|
734
|
+
for (let i = 0; i < exactTokens.length; i++) {
|
|
735
|
+
let exactToken = exactTokens[i];
|
|
736
|
+
const negative = exactToken.startsWith(CHANNEL_NEGATION_CHAR);
|
|
737
|
+
if (negative) {
|
|
738
|
+
exactToken = exactToken.substring(CHANNEL_NEGATION_CHAR.length);
|
|
739
|
+
}
|
|
740
|
+
if (isChannelTargeted(channel, exactToken)) {
|
|
741
|
+
return done(negative ? false : true);
|
|
702
742
|
}
|
|
703
|
-
storageKeyValue = value;
|
|
704
743
|
}
|
|
744
|
+
for (let i = 0; i < wildcardTokens.length; i++) {
|
|
745
|
+
let permissionToken = wildcardTokens[i];
|
|
746
|
+
const negated = permissionToken.startsWith("-");
|
|
747
|
+
if (negated) {
|
|
748
|
+
permissionToken = permissionToken.substring(1);
|
|
749
|
+
}
|
|
750
|
+
if (isChannelTargeted(channel, permissionToken)) {
|
|
751
|
+
return done(negated ? false : true);
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
return done(false);
|
|
755
|
+
}
|
|
756
|
+
var getStorageKeyValue = () => {
|
|
757
|
+
var _a, _b, _c;
|
|
758
|
+
return (_c = (_b = debug.enable) != null ? _b : getGlobal() && ((_a = getGlobal().localStorage) == null ? void 0 : _a.getItem(STORAGE_KEY))) != null ? _c : "";
|
|
759
|
+
};
|
|
760
|
+
var getDiffStorageKeyValue = () => {
|
|
761
|
+
var _a, _b, _c;
|
|
762
|
+
return (_c = (_b = debug.diffenable) != null ? _b : getGlobal() && ((_a = getGlobal().localStorage) == null ? void 0 : _a.getItem(STORAGE_DIFF_KEY))) != null ? _c : `${DEFAULT_LOG_DIFF}`;
|
|
763
|
+
};
|
|
764
|
+
var storageKeyValue = "";
|
|
765
|
+
var logDiffs = DEFAULT_LOG_DIFF;
|
|
766
|
+
function updateStorageKeyValue(value) {
|
|
767
|
+
logDiffs = `${getDiffStorageKeyValue()}` == "true";
|
|
768
|
+
if (storageKeyValue === value) {
|
|
769
|
+
return;
|
|
770
|
+
}
|
|
771
|
+
storageKeyValue = value;
|
|
772
|
+
enabledChannelsCache.clear();
|
|
773
|
+
}
|
|
774
|
+
function debugPackage(channelName) {
|
|
705
775
|
updateStorageKeyValue(getStorageKeyValue());
|
|
706
776
|
typeof getGlobal() !== "undefined" && getGlobal().addEventListener && getGlobal().addEventListener("storage", function() {
|
|
707
777
|
updateStorageKeyValue(getStorageKeyValue());
|
|
708
778
|
});
|
|
709
|
-
function isLoggingEnabled(channel) {
|
|
710
|
-
const parts = channel.split(CHANNEL_SEPARATOR);
|
|
711
|
-
const partsMap = new DeepMap();
|
|
712
|
-
partsMap.set(parts, true);
|
|
713
|
-
const multipleStorageValues = storageKeyValue.split(STORAGE_SEPARATOR);
|
|
714
|
-
for (let i = 0; i < multipleStorageValues.length; i++) {
|
|
715
|
-
const storageValue = multipleStorageValues[i];
|
|
716
|
-
const storageValueParts = storageValue.split(CHANNEL_SEPARATOR);
|
|
717
|
-
const hasWildcard = new Set(storageValueParts).has(CHANNEL_WILDCARD);
|
|
718
|
-
const storagePartsWithoutWildcard = hasWildcard ? storageValueParts.slice(
|
|
719
|
-
0,
|
|
720
|
-
storageValueParts.indexOf(CHANNEL_WILDCARD)
|
|
721
|
-
) : storageValueParts;
|
|
722
|
-
if (partsMap.getKeysStartingWith(storagePartsWithoutWildcard, hasWildcard).length > 0) {
|
|
723
|
-
return true;
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
return false;
|
|
727
|
-
}
|
|
728
779
|
function debugFactory(channelName2, parentChannel) {
|
|
780
|
+
var _a;
|
|
729
781
|
const channel = parentChannel ? `${parentChannel}${CHANNEL_SEPARATOR}${channelName2}` : channelName2;
|
|
730
782
|
const channelParts = channel.split(CHANNEL_SEPARATOR);
|
|
731
783
|
if (loggers.has(channelParts)) {
|
|
732
784
|
return loggers.get(channelParts);
|
|
733
785
|
}
|
|
734
786
|
const parentLogger = loggers.get(channelParts.slice(0, -1));
|
|
735
|
-
|
|
787
|
+
const defaultLogFn = (_a = parentLogger ? parentLogger.logFn : debug.logFn) != null ? _a : defaultLogger;
|
|
788
|
+
let logFn = defaultLogFn;
|
|
736
789
|
let enabled;
|
|
737
790
|
let lastMessageTimestamp = 0;
|
|
738
|
-
const isEnabled = () => enabled != null ? enabled : isLoggingEnabled(channel);
|
|
739
|
-
const color = getNextColor();
|
|
791
|
+
const isEnabled = () => enabled != null ? enabled : isLoggingEnabled(channel, storageKeyValue);
|
|
792
|
+
const color = getNextColor(debug.colors);
|
|
740
793
|
const logger = Object.defineProperties(
|
|
741
794
|
(...args) => {
|
|
742
|
-
if (isLoggingEnabled(channel)) {
|
|
795
|
+
if (isLoggingEnabled(channel, storageKeyValue)) {
|
|
743
796
|
const now = Date.now();
|
|
744
797
|
if (lastMessageTimestamp && logDiffs) {
|
|
745
798
|
const diff = now - lastMessageTimestamp;
|
|
746
799
|
logFn(`%c[${channel}]`, `color: ${color}`, `+${diff}ms:`);
|
|
747
800
|
}
|
|
748
801
|
lastMessageTimestamp = now;
|
|
749
|
-
|
|
802
|
+
const argsToLog = [];
|
|
803
|
+
let textWithColors = void 0;
|
|
804
|
+
args.forEach((arg) => {
|
|
805
|
+
if (arg[COLOR_SYMBOL]) {
|
|
806
|
+
if (textWithColors === void 0) {
|
|
807
|
+
textWithColors = true;
|
|
808
|
+
}
|
|
809
|
+
argsToLog.push(...arg);
|
|
810
|
+
} else {
|
|
811
|
+
if (typeof arg !== "string" && typeof arg !== "number") {
|
|
812
|
+
textWithColors = false;
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
argsToLog.push(`${arg}%s`);
|
|
816
|
+
}
|
|
817
|
+
});
|
|
818
|
+
if (textWithColors) {
|
|
819
|
+
const theArgs = [
|
|
820
|
+
`%c[${channel}]%c %s`,
|
|
821
|
+
`color: ${color}`,
|
|
822
|
+
"",
|
|
823
|
+
...argsToLog,
|
|
824
|
+
""
|
|
825
|
+
];
|
|
826
|
+
logFn(...theArgs);
|
|
827
|
+
} else {
|
|
828
|
+
logFn(`%c[${channel}]`, `color: ${color}`, ...args);
|
|
829
|
+
}
|
|
750
830
|
}
|
|
751
831
|
},
|
|
752
832
|
{
|
|
753
833
|
channel: {
|
|
754
834
|
value: channel
|
|
755
835
|
},
|
|
836
|
+
color: {
|
|
837
|
+
value: (colorName, ...args) => {
|
|
838
|
+
const result = [
|
|
839
|
+
`%c${args.join(" ")}%c%s`,
|
|
840
|
+
`color: ${colorName}`,
|
|
841
|
+
""
|
|
842
|
+
];
|
|
843
|
+
result.toString = () => args.join(" ");
|
|
844
|
+
result[COLOR_SYMBOL] = true;
|
|
845
|
+
return result;
|
|
846
|
+
}
|
|
847
|
+
},
|
|
756
848
|
extend: {
|
|
757
849
|
value: (nextChannel) => {
|
|
758
850
|
return debugFactory(nextChannel, channel);
|
|
@@ -761,10 +853,16 @@ function debug(channelName) {
|
|
|
761
853
|
enabled: {
|
|
762
854
|
get: () => isEnabled()
|
|
763
855
|
},
|
|
764
|
-
|
|
856
|
+
logFn: {
|
|
857
|
+
configurable: false,
|
|
765
858
|
get: () => logFn,
|
|
766
859
|
set: (fn) => {
|
|
767
|
-
logFn = fn;
|
|
860
|
+
logFn = fn != null ? fn : defaultLogFn;
|
|
861
|
+
}
|
|
862
|
+
},
|
|
863
|
+
destroy: {
|
|
864
|
+
value: () => {
|
|
865
|
+
loggers.delete(channelParts);
|
|
768
866
|
}
|
|
769
867
|
}
|
|
770
868
|
}
|
|
@@ -774,17 +872,29 @@ function debug(channelName) {
|
|
|
774
872
|
}
|
|
775
873
|
return debugFactory(channelName);
|
|
776
874
|
}
|
|
875
|
+
var defaultLogger = console.log.bind(console);
|
|
876
|
+
var GLOBAL_ENABLE = void 0;
|
|
877
|
+
Object.defineProperty(debugPackage, "enable", {
|
|
878
|
+
get: () => GLOBAL_ENABLE,
|
|
879
|
+
set: (value) => {
|
|
880
|
+
GLOBAL_ENABLE = value;
|
|
881
|
+
updateStorageKeyValue(getStorageKeyValue());
|
|
882
|
+
}
|
|
883
|
+
});
|
|
884
|
+
var debug = debugPackage;
|
|
885
|
+
debug.colors = COLORS;
|
|
886
|
+
debug.logFn = defaultLogger;
|
|
777
887
|
|
|
778
888
|
// src/utils/debug.ts
|
|
779
889
|
var debugTable = debug(`InfiniteTable`);
|
|
780
890
|
var dbg = (channelName) => {
|
|
781
891
|
const result = debugTable.extend(channelName);
|
|
782
|
-
result.
|
|
892
|
+
result.logFn = console.log.bind(console);
|
|
783
893
|
return result;
|
|
784
894
|
};
|
|
785
895
|
var err = (channelName) => {
|
|
786
896
|
const result = debugTable.extend(`${channelName}:error`);
|
|
787
|
-
result.
|
|
897
|
+
result.logFn = console.error.bind(console);
|
|
788
898
|
return result;
|
|
789
899
|
};
|
|
790
900
|
var emptyLogFn = () => emptyLogFn;
|
|
@@ -17131,7 +17241,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
17131
17241
|
const valid = useMemo11(() => {
|
|
17132
17242
|
let valid2 = isValidLicense(licenseKey, {
|
|
17133
17243
|
publishedAt: 1624970570587,
|
|
17134
|
-
version: "3.0.
|
|
17244
|
+
version: "3.0.15"
|
|
17135
17245
|
});
|
|
17136
17246
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
17137
17247
|
return true;
|