@perses-dev/static-list-variable-plugin 0.9.0 → 0.10.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.
Files changed (45) hide show
  1. package/__mf/js/{StaticListVariable.fa80fdd0.js → StaticListVariable.8ee5c4e4.js} +3 -3
  2. package/__mf/js/async/121.2bf56849.js +2 -0
  3. package/__mf/js/async/2.dfcdaddd.js +1 -0
  4. package/__mf/js/async/235.8403ebe9.js +1 -0
  5. package/__mf/js/async/274.a8977f92.js +2 -0
  6. package/__mf/js/async/470.f9c6f2a1.js +2 -0
  7. package/__mf/js/async/616.11e3f731.js +1 -0
  8. package/__mf/js/async/{797.57af7fe4.js → 797.22e8d64a.js} +6 -6
  9. package/__mf/js/async/941.e8f074b2.js +2 -0
  10. package/__mf/js/async/__federation_expose_StaticListVariable.f499ba97.js +1 -0
  11. package/__mf/js/{main.c3b0d5b7.js → main.ee98f153.js} +3 -3
  12. package/lib/StaticListVariable.d.ts +1 -1
  13. package/lib/StaticListVariable.d.ts.map +1 -1
  14. package/lib/StaticListVariable.js +4 -4
  15. package/lib/StaticListVariable.js.map +1 -1
  16. package/lib/bootstrap.js +2 -2
  17. package/lib/getPluginModule.d.ts +1 -1
  18. package/lib/getPluginModule.d.ts.map +1 -1
  19. package/lib/getPluginModule.js +3 -1
  20. package/lib/getPluginModule.js.map +1 -1
  21. package/lib/index-federation.js +1 -1
  22. package/lib/index.js +2 -2
  23. package/lib/index.js.map +1 -1
  24. package/mf-manifest.json +11 -11
  25. package/mf-stats.json +11 -11
  26. package/package.json +9 -9
  27. package/__mf/js/async/121.64329ef3.js +0 -2
  28. package/__mf/js/async/2.0a2a2f8f.js +0 -1
  29. package/__mf/js/async/235.36a0c19a.js +0 -1
  30. package/__mf/js/async/274.6872dfa8.js +0 -2
  31. package/__mf/js/async/470.c267538a.js +0 -2
  32. package/__mf/js/async/616.b39f8e87.js +0 -1
  33. package/__mf/js/async/941.314aa63f.js +0 -2
  34. package/__mf/js/async/__federation_expose_StaticListVariable.5246197f.js +0 -1
  35. package/lib/cjs/StaticListVariable.js +0 -278
  36. package/lib/cjs/bootstrap.js +0 -26
  37. package/lib/cjs/env.d.js +0 -14
  38. package/lib/cjs/getPluginModule.js +0 -39
  39. package/lib/cjs/index-federation.js +0 -55
  40. package/lib/cjs/index.js +0 -37
  41. /package/__mf/js/async/{121.64329ef3.js.LICENSE.txt → 121.2bf56849.js.LICENSE.txt} +0 -0
  42. /package/__mf/js/async/{274.6872dfa8.js.LICENSE.txt → 274.a8977f92.js.LICENSE.txt} +0 -0
  43. /package/__mf/js/async/{470.c267538a.js.LICENSE.txt → 470.f9c6f2a1.js.LICENSE.txt} +0 -0
  44. /package/__mf/js/async/{797.57af7fe4.js.LICENSE.txt → 797.22e8d64a.js.LICENSE.txt} +0 -0
  45. /package/__mf/js/async/{941.314aa63f.js.LICENSE.txt → 941.e8f074b2.js.LICENSE.txt} +0 -0
@@ -1,278 +0,0 @@
1
- // Copyright 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
- /* eslint-disable jsx-a11y/no-autofocus */ "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- Object.defineProperty(exports, "StaticListVariable", {
18
- enumerable: true,
19
- get: function() {
20
- return StaticListVariable;
21
- }
22
- });
23
- const _jsxruntime = require("react/jsx-runtime");
24
- const _material = require("@mui/material");
25
- const _react = require("react");
26
- const _PlusCircle = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/PlusCircle"));
27
- function _interop_require_default(obj) {
28
- return obj && obj.__esModule ? obj : {
29
- default: obj
30
- };
31
- }
32
- function StaticListVariableOptionEditor(props) {
33
- const { value: { values: variables = [] }, onChange } = props;
34
- const [editModeOption, setEditModeOption] = (0, _react.useState)('');
35
- const onChangeHandler = (0, _react.useCallback)((_, value)=>{
36
- const newVariable = value.pop();
37
- const valueExists = variables.map((v)=>{
38
- return typeof v === 'string' ? v : v?.value || '';
39
- }).some((v)=>v === newVariable);
40
- if (valueExists) return;
41
- onChange({
42
- values: [
43
- ...variables,
44
- {
45
- value: String(newVariable),
46
- label: String(newVariable)
47
- }
48
- ]
49
- });
50
- }, [
51
- onChange,
52
- variables
53
- ]);
54
- const onPasteHandler = (0, _react.useCallback)((e)=>{
55
- const v = e.clipboardData.getData('text/plain');
56
- if (v) {
57
- const items = v.split(',').filter((i)=>{
58
- const exists = variables.map((v)=>{
59
- return v?.value || String(v);
60
- }).some((v)=>v === i);
61
- return !exists;
62
- }).map((item)=>({
63
- value: item.trim(),
64
- label: ''
65
- }));
66
- onChange({
67
- values: [
68
- ...variables,
69
- ...items
70
- ]
71
- });
72
- e.preventDefault();
73
- }
74
- }, [
75
- onChange,
76
- variables
77
- ]);
78
- const tagDeleteHandler = (0, _react.useCallback)((option)=>{
79
- const filteredVariables = variables.filter((v)=>!(v === option || v?.value === option));
80
- onChange({
81
- values: [
82
- ...filteredVariables
83
- ]
84
- });
85
- setEditModeOption('');
86
- }, [
87
- variables,
88
- onChange
89
- ]);
90
- const renderTagsHandler = (0, _react.useCallback)((tagValue)=>{
91
- const updateVariableWithLabel = (optionKey, label)=>{
92
- if (!optionKey || !label) return variables;
93
- /* Prevent duplicate label */ const labelAlreadyExists = variables.filter((v)=>typeof v !== 'string').some((v)=>v?.label === label);
94
- if (labelAlreadyExists) return variables;
95
- return variables.map((v)=>{
96
- if (typeof v === 'string') return v;
97
- const variableOption = v;
98
- if (variableOption.value !== optionKey) return variableOption;
99
- const updatedVariableOption = {
100
- label,
101
- value: variableOption.value
102
- };
103
- return updatedVariableOption;
104
- });
105
- };
106
- return tagValue.map((_, index)=>{
107
- const foundVariable = variables[index];
108
- if (!foundVariable) return null;
109
- const labelObject = {
110
- value: '',
111
- label: ''
112
- };
113
- if (typeof foundVariable === 'string') {
114
- /* value and label are identical */ labelObject.value = foundVariable;
115
- labelObject.label = foundVariable;
116
- } else {
117
- labelObject.value = foundVariable.value;
118
- labelObject.label = foundVariable.label || foundVariable.value;
119
- }
120
- /* The value and key are the same thing, they can be used interchangeably */ const optionKey = foundVariable?.value || foundVariable;
121
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Chip, {
122
- sx: {
123
- margin: '4px'
124
- },
125
- label: editModeOption !== optionKey ? /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
126
- style: {
127
- display: 'flex',
128
- alignItems: 'center',
129
- gap: '8px'
130
- },
131
- children: [
132
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
133
- variant: "body2",
134
- children: labelObject.value
135
- }),
136
- labelObject?.value !== labelObject?.label && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
137
- variant: "body2",
138
- sx: {
139
- backgroundColor: (theme)=>theme.palette.grey[200],
140
- color: (theme)=>theme.palette.text.primary,
141
- padding: '4px 8px',
142
- borderRadius: '4px',
143
- fontWeight: 500
144
- },
145
- children: labelObject.label
146
- }),
147
- typeof foundVariable !== 'string' && labelObject.value === labelObject.label && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
148
- size: "small",
149
- onClick: (e)=>{
150
- e.stopPropagation();
151
- setEditModeOption(optionKey);
152
- },
153
- sx: {
154
- color: (theme)=>theme.palette.action.disabled
155
- },
156
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_PlusCircle.default, {
157
- fontSize: "small"
158
- })
159
- })
160
- ]
161
- }) : /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
162
- style: {
163
- display: 'flex',
164
- alignItems: 'center',
165
- gap: '8px'
166
- },
167
- children: [
168
- /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
169
- children: optionKey
170
- }),
171
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
172
- defaultValue: labelObject.label,
173
- onBlur: (e)=>{
174
- const { target: { value: input } } = e;
175
- if (input) {
176
- const updatedVariables = updateVariableWithLabel(optionKey, input);
177
- onChange({
178
- values: updatedVariables
179
- });
180
- }
181
- setEditModeOption('');
182
- },
183
- onKeyDown: (e)=>{
184
- if (e.key === 'Enter') {
185
- const { value: input } = e.target;
186
- const updatedVariables = updateVariableWithLabel(optionKey, input);
187
- onChange({
188
- values: updatedVariables
189
- });
190
- setEditModeOption('');
191
- } else if (e.key === 'Escape') {
192
- setEditModeOption('');
193
- }
194
- },
195
- size: "small",
196
- autoFocus: true,
197
- sx: {
198
- width: '100%',
199
- padding: 0,
200
- margin: 0,
201
- backgroundColor: (theme)=>theme.palette.background.default,
202
- '& .MuiInputBase-root': {
203
- fontSize: '0.875rem',
204
- padding: 0
205
- },
206
- '& .MuiOutlinedInput-notchedOutline': {
207
- border: 'none'
208
- }
209
- },
210
- inputProps: {
211
- style: {
212
- padding: 0
213
- }
214
- }
215
- })
216
- ]
217
- }),
218
- onDelete: ()=>{
219
- tagDeleteHandler(optionKey);
220
- }
221
- }, optionKey);
222
- });
223
- }, [
224
- variables,
225
- tagDeleteHandler,
226
- editModeOption,
227
- onChange
228
- ]);
229
- return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
230
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Autocomplete, {
231
- onPaste: onPasteHandler,
232
- multiple: true,
233
- value: variables.map((vr)=>typeof vr === 'string' ? vr : vr.label || vr.value),
234
- onChange: onChangeHandler,
235
- options: [],
236
- freeSolo: true,
237
- clearOnBlur: true,
238
- readOnly: props.isReadonly,
239
- renderTags: renderTagsHandler,
240
- renderInput: (params)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
241
- ...params,
242
- label: "Values",
243
- placeholder: "Values",
244
- helperText: 'Type new value then press "Enter" to add. Optionally define a label by clicking on the "+" button.',
245
- onKeyDown: (e)=>{
246
- if (e.key === 'Backspace' && !params.inputProps.value) {
247
- e.stopPropagation();
248
- }
249
- }
250
- })
251
- })
252
- });
253
- }
254
- const StaticListVariable = {
255
- getVariableOptions: async (spec)=>{
256
- const values = spec.values?.map((v)=>{
257
- if (typeof v === 'string') {
258
- return {
259
- label: v,
260
- value: v
261
- };
262
- }
263
- return v;
264
- });
265
- return {
266
- data: values
267
- };
268
- },
269
- dependsOn: ()=>{
270
- return {
271
- variables: []
272
- };
273
- },
274
- OptionsEditorComponent: StaticListVariableOptionEditor,
275
- createInitialOptions: ()=>({
276
- values: []
277
- })
278
- };
@@ -1,26 +0,0 @@
1
- // Copyright 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
- const _jsxruntime = require("react/jsx-runtime");
18
- const _react = /*#__PURE__*/ _interop_require_default(require("react"));
19
- const _client = /*#__PURE__*/ _interop_require_default(require("react-dom/client"));
20
- function _interop_require_default(obj) {
21
- return obj && obj.__esModule ? obj : {
22
- default: obj
23
- };
24
- }
25
- const root = _client.default.createRoot(document.getElementById('root'));
26
- root.render(/*#__PURE__*/ (0, _jsxruntime.jsx)(_react.default.StrictMode, {}));
package/lib/cjs/env.d.js DELETED
@@ -1,14 +0,0 @@
1
- // Copyright 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
- /// <reference types="@rsbuild/core/types" />
14
- "use strict";
@@ -1,39 +0,0 @@
1
- // Copyright 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
- Object.defineProperty(exports, "getPluginModule", {
18
- enumerable: true,
19
- get: function() {
20
- return getPluginModule;
21
- }
22
- });
23
- const _packagejson = /*#__PURE__*/ _interop_require_default(require("../package.json"));
24
- function _interop_require_default(obj) {
25
- return obj && obj.__esModule ? obj : {
26
- default: obj
27
- };
28
- }
29
- function getPluginModule() {
30
- const { name, version, perses } = _packagejson.default;
31
- return {
32
- kind: 'PluginModule',
33
- metadata: {
34
- name,
35
- version
36
- },
37
- spec: perses
38
- };
39
- }
@@ -1,55 +0,0 @@
1
- "use strict";
2
- function _getRequireWildcardCache(nodeInterop) {
3
- if (typeof WeakMap !== "function") return null;
4
- var cacheBabelInterop = new WeakMap();
5
- var cacheNodeInterop = new WeakMap();
6
- return (_getRequireWildcardCache = function(nodeInterop) {
7
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
8
- })(nodeInterop);
9
- }
10
- function _interop_require_wildcard(obj, nodeInterop) {
11
- if (!nodeInterop && obj && obj.__esModule) {
12
- return obj;
13
- }
14
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
15
- return {
16
- default: obj
17
- };
18
- }
19
- var cache = _getRequireWildcardCache(nodeInterop);
20
- if (cache && cache.has(obj)) {
21
- return cache.get(obj);
22
- }
23
- var newObj = {
24
- __proto__: null
25
- };
26
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
27
- for(var key in obj){
28
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
29
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
30
- if (desc && (desc.get || desc.set)) {
31
- Object.defineProperty(newObj, key, desc);
32
- } else {
33
- newObj[key] = obj[key];
34
- }
35
- }
36
- }
37
- newObj.default = obj;
38
- if (cache) {
39
- cache.set(obj, newObj);
40
- }
41
- return newObj;
42
- }
43
- // Copyright The Perses Authors
44
- // Licensed under the Apache License, Version 2.0 (the "License");
45
- // you may not use this file except in compliance with the License.
46
- // You may obtain a copy of the License at
47
- //
48
- // http://www.apache.org/licenses/LICENSE-2.0
49
- //
50
- // Unless required by applicable law or agreed to in writing, software
51
- // distributed under the License is distributed on an "AS IS" BASIS,
52
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
53
- // See the License for the specific language governing permissions and
54
- // limitations under the License.
55
- Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("./bootstrap")));
package/lib/cjs/index.js DELETED
@@ -1,37 +0,0 @@
1
- // Copyright 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
- Object.defineProperty(exports, "getPluginModule", {
18
- enumerable: true,
19
- get: function() {
20
- return _getPluginModule.getPluginModule;
21
- }
22
- });
23
- const _getPluginModule = require("./getPluginModule");
24
- _export_star(require("./StaticListVariable"), exports);
25
- function _export_star(from, to) {
26
- Object.keys(from).forEach(function(k) {
27
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
28
- Object.defineProperty(to, k, {
29
- enumerable: true,
30
- get: function() {
31
- return from[k];
32
- }
33
- });
34
- }
35
- });
36
- return from;
37
- }