@perses-dev/core 0.0.0-snapshot-time-range-height-80d08fc → 0.0.0-snapshot-embed-import-errors-8906900
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/utils/memo.js
CHANGED
|
@@ -25,7 +25,12 @@ _export(exports, {
|
|
|
25
25
|
useDeepMemo: ()=>useDeepMemo
|
|
26
26
|
});
|
|
27
27
|
const _react = require("react");
|
|
28
|
-
const
|
|
28
|
+
const _isEqual = /*#__PURE__*/ _interopRequireDefault(require("lodash/isEqual"));
|
|
29
|
+
function _interopRequireDefault(obj) {
|
|
30
|
+
return obj && obj.__esModule ? obj : {
|
|
31
|
+
default: obj
|
|
32
|
+
};
|
|
33
|
+
}
|
|
29
34
|
function useMemoized(factory, deps) {
|
|
30
35
|
const ref = (0, _react.useRef)();
|
|
31
36
|
let areEqual = true;
|
|
@@ -46,7 +51,7 @@ function useMemoized(factory, deps) {
|
|
|
46
51
|
}
|
|
47
52
|
function useDeepMemo(factory, deps) {
|
|
48
53
|
const ref = (0, _react.useRef)();
|
|
49
|
-
if (ref.current === undefined || (0,
|
|
54
|
+
if (ref.current === undefined || (0, _isEqual.default)(deps, ref.current.deps) === false) {
|
|
50
55
|
ref.current = {
|
|
51
56
|
value: factory(),
|
|
52
57
|
deps
|
|
@@ -7,7 +7,6 @@ interface VariableSpec {
|
|
|
7
7
|
display?: Display & {
|
|
8
8
|
hidden?: boolean;
|
|
9
9
|
};
|
|
10
|
-
default_value?: VariableValue;
|
|
11
10
|
}
|
|
12
11
|
export interface TextVariableDefinition extends Definition<TextVariableSpec> {
|
|
13
12
|
kind: 'TextVariable';
|
|
@@ -19,6 +18,7 @@ export interface ListVariableDefinition<PluginSpec = UnknownSpec> extends Defini
|
|
|
19
18
|
kind: 'ListVariable';
|
|
20
19
|
}
|
|
21
20
|
export interface ListVariableSpec<PluginSpec> extends VariableSpec {
|
|
21
|
+
default_value?: VariableValue;
|
|
22
22
|
allow_multiple?: boolean;
|
|
23
23
|
allow_all_value?: boolean;
|
|
24
24
|
custom_all_value?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../src/model/variables.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,oBAAY,YAAY,GAAG,MAAM,CAAC;AAElC,oBAAY,aAAa,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;AAErD,UAAU,YAAY;IACpB,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,GAAG;QAClB,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;
|
|
1
|
+
{"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../src/model/variables.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,oBAAY,YAAY,GAAG,MAAM,CAAC;AAElC,oBAAY,aAAa,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;AAErD,UAAU,YAAY;IACpB,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,GAAG;QAClB,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;CACH;AAED,MAAM,WAAW,sBAAuB,SAAQ,UAAU,CAAC,gBAAgB,CAAC;IAC1E,IAAI,EAAE,cAAc,CAAC;CACtB;AAED,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,sBAAsB,CAAC,UAAU,GAAG,WAAW,CAAE,SAAQ,UAAU,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAChH,IAAI,EAAE,cAAc,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB,CAAC,UAAU,CAAE,SAAQ,YAAY;IAChE,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;CAChC;AAED,oBAAY,kBAAkB,GAAG,sBAAsB,GAAG,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/variables.ts"],"sourcesContent":["// Copyright 2022 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 { Definition, UnknownSpec } from './definitions';\nimport { Display } from './display';\n\nexport type VariableName = string;\n\nexport type VariableValue = string | string[] | null;\n\ninterface VariableSpec {\n name: VariableName;\n display?: Display & {\n hidden?: boolean;\n };\n
|
|
1
|
+
{"version":3,"sources":["../../src/model/variables.ts"],"sourcesContent":["// Copyright 2022 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 { Definition, UnknownSpec } from './definitions';\nimport { Display } from './display';\n\nexport type VariableName = string;\n\nexport type VariableValue = string | string[] | null;\n\ninterface VariableSpec {\n name: VariableName;\n display?: Display & {\n hidden?: boolean;\n };\n}\n\nexport interface TextVariableDefinition extends Definition<TextVariableSpec> {\n kind: 'TextVariable';\n}\n\nexport interface TextVariableSpec extends VariableSpec {\n value: string;\n}\n\nexport interface ListVariableDefinition<PluginSpec = UnknownSpec> extends Definition<ListVariableSpec<PluginSpec>> {\n kind: 'ListVariable';\n}\n\nexport interface ListVariableSpec<PluginSpec> extends VariableSpec {\n default_value?: VariableValue;\n allow_multiple?: boolean;\n allow_all_value?: boolean;\n custom_all_value?: string;\n capturing_regexp?: string;\n plugin: Definition<PluginSpec>;\n}\n\nexport type VariableDefinition = TextVariableDefinition | ListVariableDefinition;\n"],"names":[],"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,WAmCiF"}
|
package/dist/utils/memo.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { useRef } from 'react';
|
|
14
|
-
import
|
|
14
|
+
import isEqual from 'lodash/isEqual';
|
|
15
15
|
/**
|
|
16
16
|
* Like React's useMemo, but guarantees the value will only be recalulated if
|
|
17
17
|
* a dependency changes. Uses strict equality (===) for comparison. (React's
|
package/dist/utils/memo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/memo.ts"],"sourcesContent":["// Copyright 2022 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
|
|
1
|
+
{"version":3,"sources":["../../src/utils/memo.ts"],"sourcesContent":["// Copyright 2022 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) {\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,0CA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ACI,OAAO,GAAG;YAAEE,KAAK,EAAER,OAAO,EAAE;YAAEC,IAAI;SAAE,CAAC;IAC3C,CAAC;IACD,OAAOC,GAAG,CAACI,OAAO,CAACE,KAAK,CAAC;AAC3B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perses-dev/core",
|
|
3
|
-
"version": "0.0.0-snapshot-
|
|
3
|
+
"version": "0.0.0-snapshot-embed-import-errors-8906900",
|
|
4
4
|
"description": "Core functionality consumed by both the Perses UI and plugins",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/perses/perses/blob/main/README.md",
|