@perses-dev/core 0.52.0 → 0.53.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/model/datasource-api.js +16 -0
- package/dist/cjs/model/external-variable.js +16 -0
- package/dist/cjs/model/index.js +4 -1
- package/dist/cjs/{utils/event.js → model/panel-group.js} +5 -10
- package/dist/cjs/model/units/bytes.js +19 -7
- package/dist/cjs/model/units/throughput.js +14 -2
- package/dist/cjs/utils/fetch.js +2 -2
- package/dist/cjs/utils/index.js +0 -2
- package/dist/cjs/utils/transform-data.js +0 -10
- package/dist/model/datasource-api.d.ts +41 -0
- package/dist/model/datasource-api.d.ts.map +1 -0
- package/dist/model/datasource-api.js +19 -0
- package/dist/model/datasource-api.js.map +1 -0
- package/dist/model/external-variable.d.ts +29 -0
- package/dist/model/external-variable.d.ts.map +1 -0
- package/dist/model/external-variable.js +20 -0
- package/dist/model/external-variable.js.map +1 -0
- package/dist/model/index.d.ts +3 -0
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +4 -1
- package/dist/model/index.js.map +1 -1
- package/dist/model/otlp/common/v1/common.d.ts +3 -1
- package/dist/model/otlp/common/v1/common.d.ts.map +1 -1
- package/dist/model/otlp/common/v1/common.js.map +1 -1
- package/dist/model/panel-group.d.ts +63 -0
- package/dist/model/panel-group.d.ts.map +1 -0
- package/dist/model/panel-group.js +19 -0
- package/dist/model/panel-group.js.map +1 -0
- package/dist/model/units/bytes.d.ts +2 -2
- package/dist/model/units/bytes.d.ts.map +1 -1
- package/dist/model/units/bytes.js +19 -7
- package/dist/model/units/bytes.js.map +1 -1
- package/dist/model/units/throughput.d.ts +1 -1
- package/dist/model/units/throughput.d.ts.map +1 -1
- package/dist/model/units/throughput.js +14 -2
- package/dist/model/units/throughput.js.map +1 -1
- package/dist/model/units/units.d.ts +2 -0
- package/dist/model/units/units.d.ts.map +1 -1
- package/dist/utils/fetch.d.ts +4 -4
- package/dist/utils/fetch.d.ts.map +1 -1
- package/dist/utils/fetch.js +3 -3
- package/dist/utils/fetch.js.map +1 -1
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +0 -2
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/transform-data.d.ts +0 -1
- package/dist/utils/transform-data.d.ts.map +1 -1
- package/dist/utils/transform-data.js +0 -7
- package/dist/utils/transform-data.js.map +1 -1
- package/package.json +1 -5
- package/dist/cjs/utils/memo.js +0 -64
- package/dist/utils/event.d.ts +0 -8
- package/dist/utils/event.d.ts.map +0 -1
- package/dist/utils/event.js +0 -27
- package/dist/utils/event.js.map +0 -1
- package/dist/utils/memo.d.ts +0 -13
- package/dist/utils/memo.d.ts.map +0 -1
- package/dist/utils/memo.js +0 -50
- package/dist/utils/memo.js.map +0 -1
package/dist/utils/memo.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
import { useRef } from 'react';
|
|
14
|
-
import isEqual from 'lodash/isEqual';
|
|
15
|
-
/**
|
|
16
|
-
* Like React's useMemo, but guarantees the value will only be recalulated if
|
|
17
|
-
* a dependency changes. Uses strict equality (===) for comparison. (React's
|
|
18
|
-
* useMemo does not offer this guarantee, it's only a performance optimization).
|
|
19
|
-
*/ export function useMemoized(factory, deps) {
|
|
20
|
-
const ref = useRef();
|
|
21
|
-
let areEqual = true;
|
|
22
|
-
for(let i = 0; i < deps.length; i++){
|
|
23
|
-
if (ref.current?.deps[i] !== deps[i]) {
|
|
24
|
-
areEqual = false;
|
|
25
|
-
break;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
if (ref.current === undefined || areEqual === false) {
|
|
29
|
-
ref.current = {
|
|
30
|
-
value: factory(),
|
|
31
|
-
deps: deps
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
return ref.current.value;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Like React's useMemo, except it does a deep equality comparison with lodash's
|
|
38
|
-
* isEqual on the dependency list.
|
|
39
|
-
*/ export function useDeepMemo(factory, deps) {
|
|
40
|
-
const ref = useRef();
|
|
41
|
-
if (ref.current === undefined || isEqual(deps, ref.current.deps) === false) {
|
|
42
|
-
ref.current = {
|
|
43
|
-
value: factory(),
|
|
44
|
-
deps
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
return ref.current.value;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
//# sourceMappingURL=memo.js.map
|
package/dist/utils/memo.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/memo.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useRef, DependencyList } from 'react';\nimport isEqual from 'lodash/isEqual';\n\ntype MemoRef<T> = {\n value: T;\n deps: DependencyList;\n};\n\n/**\n * Like React's useMemo, but guarantees the value will only be recalulated if\n * a dependency changes. Uses strict equality (===) for comparison. (React's\n * useMemo does not offer this guarantee, it's only a performance optimization).\n */\nexport function useMemoized<T>(factory: () => T, deps: DependencyList): T {\n const ref = useRef<MemoRef<T>>();\n\n let areEqual = true;\n for (let i = 0; i < deps.length; i++) {\n if (ref.current?.deps[i] !== deps[i]) {\n areEqual = false;\n break;\n }\n }\n\n if (ref.current === undefined || areEqual === false) {\n ref.current = { value: factory(), deps: deps };\n }\n\n return ref.current.value;\n}\n\n/**\n * Like React's useMemo, except it does a deep equality comparison with lodash's\n * isEqual on the dependency list.\n */\nexport function useDeepMemo<T>(factory: () => T, deps: DependencyList): T {\n const ref = useRef<MemoRef<T>>();\n if (ref.current === undefined || isEqual(deps, ref.current.deps) === false) {\n ref.current = { value: factory(), deps };\n }\n return ref.current.value;\n}\n"],"names":["useRef","isEqual","useMemoized","factory","deps","ref","areEqual","i","length","current","undefined","value","useDeepMemo"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,MAAM,QAAwB,QAAQ;AAC/C,OAAOC,aAAa,iBAAiB;AAOrC;;;;CAIC,GACD,OAAO,SAASC,YAAeC,OAAgB,EAAEC,IAAoB;IACnE,MAAMC,MAAML;IAEZ,IAAIM,WAAW;IACf,IAAK,IAAIC,IAAI,GAAGA,IAAIH,KAAKI,MAAM,EAAED,IAAK;QACpC,IAAIF,IAAII,OAAO,EAAEL,IAAI,CAACG,EAAE,KAAKH,IAAI,CAACG,EAAE,EAAE;YACpCD,WAAW;YACX;QACF;IACF;IAEA,IAAID,IAAII,OAAO,KAAKC,aAAaJ,aAAa,OAAO;QACnDD,IAAII,OAAO,GAAG;YAAEE,OAAOR;YAAWC,MAAMA;QAAK;IAC/C;IAEA,OAAOC,IAAII,OAAO,CAACE,KAAK;AAC1B;AAEA;;;CAGC,GACD,OAAO,SAASC,YAAeT,OAAgB,EAAEC,IAAoB;IACnE,MAAMC,MAAML;IACZ,IAAIK,IAAII,OAAO,KAAKC,aAAaT,QAAQG,MAAMC,IAAII,OAAO,CAACL,IAAI,MAAM,OAAO;QAC1EC,IAAII,OAAO,GAAG;YAAEE,OAAOR;YAAWC;QAAK;IACzC;IACA,OAAOC,IAAII,OAAO,CAACE,KAAK;AAC1B"}
|