@perses-dev/core 0.53.0-beta.0 → 0.53.0-beta.2
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/date.js +297 -0
- package/dist/cjs/model/units/temperature.js +64 -0
- package/dist/cjs/model/units/time.js +16 -2
- package/dist/cjs/model/units/units.js +27 -3
- 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/date.d.ts +28 -0
- package/dist/model/units/date.d.ts.map +1 -0
- package/dist/model/units/date.js +278 -0
- package/dist/model/units/date.js.map +1 -0
- package/dist/model/units/temperature.d.ts +11 -0
- package/dist/model/units/temperature.d.ts.map +1 -0
- package/dist/model/units/temperature.js +45 -0
- package/dist/model/units/temperature.js.map +1 -0
- package/dist/model/units/time.d.ts +3 -1
- package/dist/model/units/time.d.ts.map +1 -1
- package/dist/model/units/time.js +16 -2
- package/dist/model/units/time.js.map +1 -1
- package/dist/model/units/types.d.ts +1 -1
- package/dist/model/units/types.d.ts.map +1 -1
- package/dist/model/units/types.js.map +1 -1
- package/dist/model/units/units.d.ts +21 -1
- package/dist/model/units/units.d.ts.map +1 -1
- package/dist/model/units/units.js +21 -3
- package/dist/model/units/units.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/cjs/utils/memo.js
DELETED
|
@@ -1,64 +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
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
function _export(target, all) {
|
|
18
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: all[name]
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
_export(exports, {
|
|
24
|
-
useDeepMemo: function() {
|
|
25
|
-
return useDeepMemo;
|
|
26
|
-
},
|
|
27
|
-
useMemoized: function() {
|
|
28
|
-
return useMemoized;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
const _react = require("react");
|
|
32
|
-
const _isEqual = /*#__PURE__*/ _interop_require_default(require("lodash/isEqual"));
|
|
33
|
-
function _interop_require_default(obj) {
|
|
34
|
-
return obj && obj.__esModule ? obj : {
|
|
35
|
-
default: obj
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
function useMemoized(factory, deps) {
|
|
39
|
-
const ref = (0, _react.useRef)();
|
|
40
|
-
let areEqual = true;
|
|
41
|
-
for(let i = 0; i < deps.length; i++){
|
|
42
|
-
if (ref.current?.deps[i] !== deps[i]) {
|
|
43
|
-
areEqual = false;
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
if (ref.current === undefined || areEqual === false) {
|
|
48
|
-
ref.current = {
|
|
49
|
-
value: factory(),
|
|
50
|
-
deps: deps
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
return ref.current.value;
|
|
54
|
-
}
|
|
55
|
-
function useDeepMemo(factory, deps) {
|
|
56
|
-
const ref = (0, _react.useRef)();
|
|
57
|
-
if (ref.current === undefined || (0, _isEqual.default)(deps, ref.current.deps) === false) {
|
|
58
|
-
ref.current = {
|
|
59
|
-
value: factory(),
|
|
60
|
-
deps
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
return ref.current.value;
|
|
64
|
-
}
|
package/dist/utils/event.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A (temporary) userland implementation of `useEvent` from this React RFC: https://github.com/reactjs/rfcs/pull/220.
|
|
3
|
-
*
|
|
4
|
-
* Typically useful for getting a stable reference to an "event" function (i.e. one that isn't called during render
|
|
5
|
-
* but is called later in a useEffect or event handler) that accesses state or props.
|
|
6
|
-
*/
|
|
7
|
-
export declare function useEvent<T extends unknown[], U>(handler: (...args: T) => U): (...args: T) => U;
|
|
8
|
-
//# sourceMappingURL=event.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../src/utils/event.ts"],"names":[],"mappings":"AAeA;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,CAO9F"}
|
package/dist/utils/event.js
DELETED
|
@@ -1,27 +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, useLayoutEffect, useCallback } from 'react';
|
|
14
|
-
/**
|
|
15
|
-
* A (temporary) userland implementation of `useEvent` from this React RFC: https://github.com/reactjs/rfcs/pull/220.
|
|
16
|
-
*
|
|
17
|
-
* Typically useful for getting a stable reference to an "event" function (i.e. one that isn't called during render
|
|
18
|
-
* but is called later in a useEffect or event handler) that accesses state or props.
|
|
19
|
-
*/ export function useEvent(handler) {
|
|
20
|
-
const handlerRef = useRef(handler);
|
|
21
|
-
useLayoutEffect(()=>{
|
|
22
|
-
handlerRef.current = handler;
|
|
23
|
-
});
|
|
24
|
-
return useCallback((...args)=>handlerRef.current(...args), []);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
//# sourceMappingURL=event.js.map
|
package/dist/utils/event.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/event.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, useLayoutEffect, useCallback } from 'react';\n\n/**\n * A (temporary) userland implementation of `useEvent` from this React RFC: https://github.com/reactjs/rfcs/pull/220.\n *\n * Typically useful for getting a stable reference to an \"event\" function (i.e. one that isn't called during render\n * but is called later in a useEffect or event handler) that accesses state or props.\n */\nexport function useEvent<T extends unknown[], U>(handler: (...args: T) => U): (...args: T) => U {\n const handlerRef = useRef(handler);\n useLayoutEffect(() => {\n handlerRef.current = handler;\n });\n\n return useCallback((...args) => handlerRef.current(...args), []);\n}\n"],"names":["useRef","useLayoutEffect","useCallback","useEvent","handler","handlerRef","current","args"],"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,EAAEC,eAAe,EAAEC,WAAW,QAAQ,QAAQ;AAE7D;;;;;CAKC,GACD,OAAO,SAASC,SAAiCC,OAA0B;IACzE,MAAMC,aAAaL,OAAOI;IAC1BH,gBAAgB;QACdI,WAAWC,OAAO,GAAGF;IACvB;IAEA,OAAOF,YAAY,CAAC,GAAGK,OAASF,WAAWC,OAAO,IAAIC,OAAO,EAAE;AACjE"}
|
package/dist/utils/memo.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { DependencyList } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Like React's useMemo, but guarantees the value will only be recalulated if
|
|
4
|
-
* a dependency changes. Uses strict equality (===) for comparison. (React's
|
|
5
|
-
* useMemo does not offer this guarantee, it's only a performance optimization).
|
|
6
|
-
*/
|
|
7
|
-
export declare function useMemoized<T>(factory: () => T, deps: DependencyList): T;
|
|
8
|
-
/**
|
|
9
|
-
* Like React's useMemo, except it does a deep equality comparison with lodash's
|
|
10
|
-
* isEqual on the dependency list.
|
|
11
|
-
*/
|
|
12
|
-
export declare function useDeepMemo<T>(factory: () => T, deps: DependencyList): T;
|
|
13
|
-
//# sourceMappingURL=memo.d.ts.map
|
package/dist/utils/memo.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memo.d.ts","sourceRoot":"","sources":["../../src/utils/memo.ts"],"names":[],"mappings":"AAaA,OAAO,EAAU,cAAc,EAAE,MAAM,OAAO,CAAC;AAQ/C;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,cAAc,GAAG,CAAC,CAgBxE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,cAAc,GAAG,CAAC,CAMxE"}
|
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"}
|