windmill-components 1.82.6 → 1.82.7
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/common.d.ts +2 -2
- package/components/ArgInput.svelte +52 -72
- package/components/ArgInput.svelte.d.ts +1 -3
- package/components/DisplayResult.svelte +17 -17
- package/components/Editor.svelte +0 -3
- package/components/Editor.svelte.d.ts +0 -1
- package/components/FieldHeader.svelte +0 -1
- package/components/FieldHeader.svelte.d.ts +0 -4
- package/components/FlowBuilder.svelte +5 -0
- package/components/FlowViewer.svelte +0 -1
- package/components/InputTransformForm.svelte +0 -1
- package/components/LightweightArgInput.svelte +1 -14
- package/components/LightweightArgInput.svelte.d.ts +1 -3
- package/components/Multiselect.svelte.d.ts +2 -2
- package/components/SimpleEditor.svelte +0 -1
- package/components/SimpleEditor.svelte.d.ts +0 -1
- package/components/TemplateEditor.svelte +0 -1
- package/components/Toggle.svelte +1 -1
- package/components/Toggle.svelte.d.ts +0 -1
- package/components/apps/components/buttons/AppButton.svelte +3 -17
- package/components/apps/components/buttons/AppForm.svelte +2 -10
- package/components/apps/components/buttons/AppFormButton.svelte +58 -82
- package/components/apps/components/display/AppDisplayComponent.svelte +23 -17
- package/components/apps/components/display/AppHtml.svelte +7 -1
- package/components/apps/components/display/AppHtml.svelte.d.ts +2 -0
- package/components/apps/components/display/AppMap.svelte +1 -1
- package/components/apps/components/display/AppPdf.svelte +1 -1
- package/components/apps/components/display/PlotlyHtml.svelte +20 -3
- package/components/apps/components/display/PlotlyHtml.svelte.d.ts +2 -0
- package/components/apps/components/display/table/AppAggridTable.svelte +1 -1
- package/components/apps/components/display/table/AppTable.svelte +21 -14
- package/components/apps/components/helpers/HiddenComponent.svelte +3 -2
- package/components/apps/components/helpers/HiddenComponent.svelte.d.ts +2 -1
- package/components/apps/components/helpers/InputValue.svelte +3 -3
- package/components/apps/components/helpers/RefreshButton.svelte +3 -10
- package/components/apps/components/helpers/RefreshButton.svelte.d.ts +1 -0
- package/components/apps/components/helpers/RunnableComponent.svelte +19 -15
- package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +2 -1
- package/components/apps/components/helpers/RunnableWrapper.svelte +3 -1
- package/components/apps/components/helpers/RunnableWrapper.svelte.d.ts +1 -0
- package/components/apps/components/helpers/eval.d.ts +3 -1
- package/components/apps/components/helpers/eval.js +4 -2
- package/components/apps/components/inputs/AppCheckbox.svelte +0 -4
- package/components/apps/components/inputs/AppDateInput.svelte +2 -2
- package/components/apps/components/inputs/AppMultiSelect.svelte +13 -5
- package/components/apps/components/inputs/AppMultiSelect.svelte.d.ts +0 -2
- package/components/apps/components/inputs/AppNumberInput.svelte +3 -3
- package/components/apps/components/inputs/AppSelect.svelte +11 -4
- package/components/apps/components/inputs/AppSelect.svelte.d.ts +0 -2
- package/components/apps/components/inputs/AppSliderInputs.svelte +1 -1
- package/components/apps/components/inputs/AppTextInput.svelte +53 -43
- package/components/apps/components/inputs/AppTextInput.svelte.d.ts +1 -1
- package/components/apps/components/inputs/currency/AppCurrencyInput.svelte +1 -1
- package/components/apps/components/layout/AppContainer.svelte +2 -2
- package/components/apps/components/layout/AppDrawer.svelte +1 -2
- package/components/apps/components/layout/AppSplitpanes.svelte +3 -3
- package/components/apps/components/layout/AppTabs.svelte +1 -1
- package/components/apps/editor/AppEditor.svelte +49 -21
- package/components/apps/editor/AppEditorHeader.svelte +5 -0
- package/components/apps/editor/AppPreview.svelte +18 -7
- package/components/apps/editor/ComponentHeader.svelte +1 -0
- package/components/apps/editor/ComponentHeader.svelte.d.ts +1 -1
- package/components/apps/editor/GridEditor.svelte +22 -12
- package/components/apps/editor/GridViewer.svelte +2 -2
- package/components/apps/editor/GridViewer.svelte.d.ts +1 -1
- package/components/apps/editor/RecomputeAllComponents.svelte +5 -7
- package/components/apps/editor/SettingsPanel.svelte +4 -4
- package/components/apps/editor/SubGridEditor.svelte +13 -12
- package/components/apps/editor/appUtils.d.ts +1 -0
- package/components/apps/editor/appUtils.js +19 -0
- package/components/apps/editor/component/Component.svelte +19 -8
- package/components/apps/editor/component/Component.svelte.d.ts +1 -1
- package/components/apps/editor/component/ComponentNavigation.svelte +57 -47
- package/components/apps/editor/component/README.md +4 -0
- package/components/apps/editor/component/components.d.ts +38 -28
- package/components/apps/editor/component/components.js +34 -27
- package/components/apps/editor/component/sets.js +2 -1
- package/components/apps/editor/componentsPanel/ComponentList.svelte +1 -1
- package/components/apps/editor/componentsPanel/CssProperty.svelte +62 -48
- package/components/apps/editor/componentsPanel/CssProperty.svelte.d.ts +3 -2
- package/components/apps/editor/componentsPanel/CssSettings.svelte +1 -0
- package/components/apps/editor/componentsPanel/QuickStyleMenu.svelte +170 -0
- package/components/apps/editor/componentsPanel/QuickStyleMenu.svelte.d.ts +18 -0
- package/components/apps/editor/componentsPanel/QuickStyleProperty.svelte +130 -0
- package/components/apps/editor/componentsPanel/QuickStyleProperty.svelte.d.ts +21 -0
- package/components/apps/editor/componentsPanel/quickStyleProperties.d.ts +535 -0
- package/components/apps/editor/componentsPanel/quickStyleProperties.js +598 -0
- package/components/apps/editor/componentsPanel/store.js +4 -4
- package/components/apps/editor/contextPanel/ComponentOutput.svelte +2 -26
- package/components/apps/editor/contextPanel/ComponentOutput.svelte.d.ts +0 -1
- package/components/apps/editor/contextPanel/ComponentOutputViewer.svelte +8 -6
- package/components/apps/editor/contextPanel/ContextPanel.svelte +7 -14
- package/components/apps/editor/contextPanel/components/BackgroundScriptOutput.svelte +2 -25
- package/components/apps/editor/contextPanel/components/OutputHeader.svelte +29 -40
- package/components/apps/editor/contextPanel/components/OutputHeader.svelte.d.ts +1 -2
- package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte +2 -7
- package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte.d.ts +1 -1
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +10 -11
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte +4 -3
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte.d.ts +1 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte +0 -1
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte +2 -2
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelWithTable.svelte +2 -0
- package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte +22 -19
- package/components/apps/editor/settingsPanel/ComponentPanel.svelte +42 -13
- package/components/apps/editor/settingsPanel/GridTab.svelte +1 -2
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +2 -1
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte.d.ts +4 -0
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +1 -0
- package/components/apps/editor/settingsPanel/SelectedRunnable.svelte +1 -2
- package/components/apps/editor/settingsPanel/StylePanel.svelte +61 -0
- package/components/apps/editor/settingsPanel/StylePanel.svelte.d.ts +17 -0
- package/components/apps/editor/settingsPanel/TableActions.svelte +3 -3
- package/components/apps/editor/settingsPanel/inputEditor/ColorInput.svelte +12 -12
- package/components/apps/editor/settingsPanel/inputEditor/ColorInput.svelte.d.ts +3 -2
- package/components/apps/editor/settingsPanel/inputEditor/EvalInputEditor.svelte +5 -1
- package/components/apps/editor/settingsPanel/inputEditor/IconSelectInput.svelte +3 -3
- package/components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte +3 -2
- package/components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte.d.ts +4 -1
- package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte +2 -2
- package/components/apps/editor/settingsPanel/secondaryMenu/SecondaryMenu.svelte +47 -0
- package/components/apps/editor/settingsPanel/secondaryMenu/SecondaryMenu.svelte.d.ts +14 -0
- package/components/apps/editor/settingsPanel/secondaryMenu/index.d.ts +2 -0
- package/components/apps/editor/settingsPanel/secondaryMenu/index.js +2 -0
- package/components/apps/editor/settingsPanel/secondaryMenu/menuStore.d.ts +12 -0
- package/components/apps/editor/settingsPanel/secondaryMenu/menuStore.js +10 -0
- package/components/apps/editor/settingsPanel/triggerLists/ComponentTriggerList.svelte +1 -1
- package/components/apps/inputType.d.ts +2 -2
- package/components/apps/rx.d.ts +2 -2
- package/components/apps/svelte-grid/Grid.svelte +50 -34
- package/components/apps/svelte-grid/Grid.svelte.d.ts +14 -9
- package/components/apps/svelte-grid/MoveResize.svelte +76 -55
- package/components/apps/svelte-grid/MoveResize.svelte.d.ts +15 -9
- package/components/apps/svelte-grid/utils/helper.d.ts +0 -1
- package/components/apps/svelte-grid/utils/helper.js +0 -3
- package/components/apps/types.d.ts +9 -5
- package/components/apps/utils.d.ts +2 -0
- package/components/apps/utils.js +31 -1
- package/components/common/button/ButtonPopup.svelte +5 -2
- package/components/common/button/ButtonPopup.svelte.d.ts +5 -1
- package/components/common/button/ButtonPopupItem.svelte +2 -1
- package/components/common/button/ButtonPopupItem.svelte.d.ts +1 -0
- package/components/common/clearableInput/ClearableInput.svelte +56 -0
- package/components/common/clearableInput/ClearableInput.svelte.d.ts +28 -0
- package/components/common/index.d.ts +1 -0
- package/components/common/index.js +1 -0
- package/components/common/kbd/Kbd.svelte +4 -1
- package/components/common/kbd/Kbd.svelte.d.ts +6 -14
- package/components/common/menu/Menu.svelte +8 -2
- package/components/common/menu/Menu.svelte.d.ts +4 -1
- package/components/common/modal/AlwaysMountedModal.svelte +109 -0
- package/components/common/modal/AlwaysMountedModal.svelte.d.ts +22 -0
- package/components/flows/map/MapItem.svelte +3 -3
- package/components/scriptEditor/LogPanel.svelte +3 -3
- package/infer.js +6 -1
- package/package.json +11 -2
- package/utils.d.ts +1 -0
- package/utils.js +3 -0
- package/components/apps/editor/contextPanel/components/MinMaxButton.svelte +0 -25
- package/components/apps/editor/contextPanel/components/MinMaxButton.svelte.d.ts +0 -16
|
@@ -15,8 +15,9 @@ export let item;
|
|
|
15
15
|
export let cols;
|
|
16
16
|
export let nativeContainer;
|
|
17
17
|
export let onTop;
|
|
18
|
+
export let shadow = undefined;
|
|
19
|
+
const divId = `component-${id}`;
|
|
18
20
|
let shadowElement;
|
|
19
|
-
let shadow = undefined;
|
|
20
21
|
let active = false;
|
|
21
22
|
let initX, initY;
|
|
22
23
|
let capturePos = {
|
|
@@ -27,7 +28,7 @@ let cordDiff = { x: 0, y: 0 };
|
|
|
27
28
|
let newSize = { width, height };
|
|
28
29
|
let trans = false;
|
|
29
30
|
let anima;
|
|
30
|
-
|
|
31
|
+
export function inActivate() {
|
|
31
32
|
if (shadowElement && shadow != undefined) {
|
|
32
33
|
let subgrid = shadowElement.closest('.subgrid');
|
|
33
34
|
let irect = shadowElement.getBoundingClientRect();
|
|
@@ -57,18 +58,14 @@ const inActivate = () => {
|
|
|
57
58
|
clearTimeout(anima);
|
|
58
59
|
anima = setTimeout(() => {
|
|
59
60
|
trans = false;
|
|
60
|
-
},
|
|
61
|
-
dispatch('pointerup', {
|
|
62
|
-
id
|
|
63
|
-
});
|
|
61
|
+
}, 50);
|
|
64
62
|
}
|
|
65
|
-
}
|
|
66
|
-
let repaint = (
|
|
63
|
+
}
|
|
64
|
+
let repaint = (activate, isPointerUp) => {
|
|
67
65
|
dispatch('repaint', {
|
|
68
66
|
id,
|
|
69
|
-
shadow,
|
|
70
67
|
isPointerUp,
|
|
71
|
-
|
|
68
|
+
activate
|
|
72
69
|
});
|
|
73
70
|
};
|
|
74
71
|
// Autoscroll
|
|
@@ -78,7 +75,7 @@ let rect;
|
|
|
78
75
|
let scrollElement;
|
|
79
76
|
const getContainerFrame = (element) => {
|
|
80
77
|
if (element === document.documentElement || !element) {
|
|
81
|
-
const {
|
|
78
|
+
const { top, bottom } = nativeContainer.getBoundingClientRect();
|
|
82
79
|
return {
|
|
83
80
|
top: Math.max(0, top),
|
|
84
81
|
bottom: Math.min(window.innerHeight, bottom)
|
|
@@ -87,11 +84,13 @@ const getContainerFrame = (element) => {
|
|
|
87
84
|
return element.getBoundingClientRect();
|
|
88
85
|
};
|
|
89
86
|
const getScroller = (element) => (!element ? document.documentElement : element);
|
|
90
|
-
function computeRect(
|
|
91
|
-
let gridItem =
|
|
87
|
+
function computeRect() {
|
|
88
|
+
let gridItem = document.getElementById(divId);
|
|
89
|
+
if (!gridItem)
|
|
90
|
+
return;
|
|
92
91
|
let subgrid = gridItem.closest('.subgrid');
|
|
93
92
|
let irect = gridItem.getBoundingClientRect();
|
|
94
|
-
if (subgrid) {
|
|
93
|
+
if (subgrid && subgrid.parentElement) {
|
|
95
94
|
let subGridParent = subgrid.parentElement;
|
|
96
95
|
let subGridParentRect = subGridParent.getBoundingClientRect();
|
|
97
96
|
let prect = subgrid.getBoundingClientRect();
|
|
@@ -109,25 +108,28 @@ function computeRect(target) {
|
|
|
109
108
|
}
|
|
110
109
|
}
|
|
111
110
|
let dragClosure = undefined;
|
|
112
|
-
const pointerdown = ({ clientX, clientY
|
|
111
|
+
const pointerdown = ({ clientX, clientY }) => {
|
|
113
112
|
dragClosure = () => {
|
|
114
113
|
dragClosure = undefined;
|
|
115
114
|
initX = clientX;
|
|
116
115
|
initY = clientY;
|
|
117
|
-
|
|
118
|
-
shadow = { x: item.x, y: item.y, w: item.w, h: item.h };
|
|
119
|
-
newSize = { width, height };
|
|
120
|
-
containerFrame = getContainerFrame(container);
|
|
121
|
-
scrollElement = getScroller(container);
|
|
122
|
-
cordDiff = { x: 0, y: 0 };
|
|
123
|
-
active = true;
|
|
124
|
-
trans = false;
|
|
125
|
-
computeRect(target);
|
|
126
|
-
_scrollTop = scrollElement.scrollTop;
|
|
116
|
+
dispatch('initmove');
|
|
127
117
|
};
|
|
128
118
|
window.addEventListener('pointermove', pointermove);
|
|
129
119
|
window.addEventListener('pointerup', pointerup);
|
|
130
120
|
};
|
|
121
|
+
export function initmove() {
|
|
122
|
+
computeRect();
|
|
123
|
+
newSize = { width, height };
|
|
124
|
+
capturePos = { x: left, y: top };
|
|
125
|
+
shadow = { x: item.x, y: item.y, w: item.w, h: item.h };
|
|
126
|
+
cordDiff = { x: 0, y: 0 };
|
|
127
|
+
active = true;
|
|
128
|
+
trans = false;
|
|
129
|
+
containerFrame = getContainerFrame(container);
|
|
130
|
+
scrollElement = getScroller(container);
|
|
131
|
+
_scrollTop = scrollElement.scrollTop;
|
|
132
|
+
}
|
|
131
133
|
let sign = { x: 0, y: 0 };
|
|
132
134
|
let vel = { x: 0, y: 0 };
|
|
133
135
|
let intervalId = undefined;
|
|
@@ -138,8 +140,8 @@ const stopAutoscroll = () => {
|
|
|
138
140
|
vel = { x: 0, y: 0 };
|
|
139
141
|
};
|
|
140
142
|
const update = () => {
|
|
141
|
-
const _newScrollTop = scrollElement.scrollTop - _scrollTop;
|
|
142
143
|
const boundX = capturePos.x + cordDiff.x;
|
|
144
|
+
const _newScrollTop = (scrollElement?.scrollTop ?? 0) - (_scrollTop ?? 0);
|
|
143
145
|
const boundY = capturePos.y + (cordDiff.y + _newScrollTop);
|
|
144
146
|
let gridX = Math.round(boundX / xPerPx);
|
|
145
147
|
let gridY = Math.round(boundY / yPerPx);
|
|
@@ -147,7 +149,6 @@ const update = () => {
|
|
|
147
149
|
shadow.x = Math.max(Math.min(gridX, cols - shadow.w), 0);
|
|
148
150
|
shadow.y = Math.max(gridY, 0);
|
|
149
151
|
}
|
|
150
|
-
repaint(undefined, false);
|
|
151
152
|
};
|
|
152
153
|
const pointermove = (event) => {
|
|
153
154
|
dragClosure && dragClosure();
|
|
@@ -155,49 +156,68 @@ const pointermove = (event) => {
|
|
|
155
156
|
event.stopPropagation();
|
|
156
157
|
event.stopImmediatePropagation();
|
|
157
158
|
const { clientX, clientY } = event;
|
|
158
|
-
cordDiff = { x: clientX - initX, y: clientY - initY };
|
|
159
|
+
const cordDiff = { x: clientX - initX, y: clientY - initY };
|
|
160
|
+
dispatch('move', { cordDiff, clientY });
|
|
161
|
+
};
|
|
162
|
+
export function updateMove(newCoordDiff, clientY) {
|
|
163
|
+
if (!active) {
|
|
164
|
+
active = true;
|
|
165
|
+
}
|
|
166
|
+
if (trans) {
|
|
167
|
+
trans = false;
|
|
168
|
+
}
|
|
169
|
+
cordDiff = newCoordDiff;
|
|
170
|
+
// console.log(cordDiff, id, 'B')
|
|
159
171
|
const Y_SENSOR = sensor;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
if (
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
if (containerFrame) {
|
|
173
|
+
let velocityTop = Math.max(0, (containerFrame.top + Y_SENSOR - clientY) / Y_SENSOR);
|
|
174
|
+
let velocityBottom = Math.max(0, (clientY - (containerFrame.bottom - Y_SENSOR)) / Y_SENSOR);
|
|
175
|
+
const topSensor = velocityTop > 0 && velocityBottom === 0;
|
|
176
|
+
const bottomSensor = velocityBottom > 0 && velocityTop === 0;
|
|
177
|
+
sign.y = topSensor ? -1 : bottomSensor ? 1 : 0;
|
|
178
|
+
vel.y = sign.y === -1 ? velocityTop : velocityBottom;
|
|
179
|
+
if (vel.y > 0) {
|
|
180
|
+
if (!intervalId) {
|
|
181
|
+
// Start scrolling
|
|
182
|
+
// TODO Use requestAnimationFrame
|
|
183
|
+
intervalId = setInterval(() => {
|
|
184
|
+
scrollElement.scrollTop += 2 * (vel.y + Math.sign(vel.y)) * sign.y;
|
|
185
|
+
update();
|
|
186
|
+
}, 10);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
else if (intervalId) {
|
|
190
|
+
stopAutoscroll();
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
update();
|
|
174
194
|
}
|
|
175
|
-
}
|
|
176
|
-
else if (intervalId) {
|
|
177
|
-
stopAutoscroll();
|
|
178
195
|
}
|
|
179
196
|
else {
|
|
180
197
|
update();
|
|
181
198
|
}
|
|
182
|
-
}
|
|
199
|
+
}
|
|
183
200
|
const pointerup = (e) => {
|
|
184
|
-
dragClosure = undefined;
|
|
185
201
|
stopAutoscroll();
|
|
186
202
|
window.removeEventListener('pointerdown', pointerdown);
|
|
187
203
|
window.removeEventListener('pointermove', pointermove);
|
|
188
204
|
window.removeEventListener('pointerup', pointerup);
|
|
189
|
-
|
|
205
|
+
if (!dragClosure) {
|
|
206
|
+
repaint(true, true);
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
dragClosure = undefined;
|
|
210
|
+
}
|
|
190
211
|
};
|
|
191
|
-
// Resize
|
|
192
212
|
let resizeInitPos = { x: 0, y: 0 };
|
|
193
213
|
let initSize = { width: 0, height: 0 };
|
|
194
214
|
const resizePointerDown = (e) => {
|
|
195
215
|
e.stopPropagation();
|
|
196
|
-
const { pageX, pageY
|
|
216
|
+
const { pageX, pageY } = e;
|
|
197
217
|
resizeInitPos = { x: pageX, y: pageY };
|
|
198
218
|
initSize = { width, height };
|
|
199
219
|
cordDiff = { x: 0, y: 0 };
|
|
200
|
-
computeRect(
|
|
220
|
+
computeRect();
|
|
201
221
|
newSize = { width, height };
|
|
202
222
|
active = true;
|
|
203
223
|
trans = false;
|
|
@@ -219,12 +239,12 @@ const resizePointerMove = ({ pageX, pageY }) => {
|
|
|
219
239
|
// Limit col & row
|
|
220
240
|
shadow.w = Math.round((newSize.width + gapX * 2) / xPerPx);
|
|
221
241
|
shadow.h = Math.round((newSize.height + gapY * 2) / yPerPx);
|
|
222
|
-
repaint(
|
|
242
|
+
repaint(false, false);
|
|
223
243
|
}
|
|
224
244
|
};
|
|
225
245
|
const resizePointerUp = (e) => {
|
|
226
246
|
e.stopPropagation();
|
|
227
|
-
repaint(
|
|
247
|
+
repaint(true, true);
|
|
228
248
|
window.removeEventListener('pointermove', resizePointerMove);
|
|
229
249
|
window.removeEventListener('pointerup', resizePointerUp);
|
|
230
250
|
};
|
|
@@ -234,18 +254,19 @@ const resizePointerUp = (e) => {
|
|
|
234
254
|
<div
|
|
235
255
|
draggable="false"
|
|
236
256
|
on:pointerdown|stopPropagation|preventDefault={pointerdown}
|
|
257
|
+
id={divId}
|
|
237
258
|
class="svlt-grid-item"
|
|
238
259
|
class:svlt-grid-active={active || (trans && rect)}
|
|
239
260
|
style="width: {active ? newSize.width : width}px; height:{active
|
|
240
261
|
? newSize.height
|
|
241
262
|
: height}px; {onTop ? 'z-index: 1000;' : ''}
|
|
242
|
-
{active
|
|
263
|
+
{active && rect
|
|
243
264
|
? `transform: translate(${cordDiff.x}px, ${cordDiff.y}px);top:${rect.top}px;left:${rect.left}px;`
|
|
244
265
|
: trans
|
|
245
266
|
? `transform: translate(${cordDiff.x}px, ${cordDiff.y}px); position:absolute; transition: width 0.2s, height 0.2s;`
|
|
246
267
|
: `transition: transform 0.1s, opacity 0.1s; transform: translate(${left}px, ${top}px); `} "
|
|
247
268
|
>
|
|
248
|
-
<slot
|
|
269
|
+
<slot />
|
|
249
270
|
<div class="svlt-grid-resizer" on:pointerdown={resizePointerDown} />
|
|
250
271
|
</div>
|
|
251
272
|
|
|
@@ -16,27 +16,33 @@ declare const __propDef: {
|
|
|
16
16
|
cols: any;
|
|
17
17
|
nativeContainer: any;
|
|
18
18
|
onTop: any;
|
|
19
|
+
shadow?: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
w: number;
|
|
23
|
+
h: number;
|
|
24
|
+
} | undefined;
|
|
25
|
+
inActivate?: (() => void) | undefined;
|
|
26
|
+
initmove?: (() => void) | undefined;
|
|
27
|
+
updateMove?: ((newCoordDiff: any, clientY: any) => void) | undefined;
|
|
19
28
|
};
|
|
20
29
|
events: {
|
|
21
|
-
pointerup: CustomEvent<any>;
|
|
22
30
|
repaint: CustomEvent<any>;
|
|
31
|
+
initmove: CustomEvent<any>;
|
|
32
|
+
move: CustomEvent<any>;
|
|
23
33
|
} & {
|
|
24
34
|
[evt: string]: CustomEvent<any>;
|
|
25
35
|
};
|
|
26
36
|
slots: {
|
|
27
|
-
default: {
|
|
28
|
-
movePointerDown: ({ clientX, clientY, target }: {
|
|
29
|
-
clientX: any;
|
|
30
|
-
clientY: any;
|
|
31
|
-
target: any;
|
|
32
|
-
}) => void;
|
|
33
|
-
resizePointerDown: (e: any) => void;
|
|
34
|
-
};
|
|
37
|
+
default: {};
|
|
35
38
|
};
|
|
36
39
|
};
|
|
37
40
|
export type MoveResizeProps = typeof __propDef.props;
|
|
38
41
|
export type MoveResizeEvents = typeof __propDef.events;
|
|
39
42
|
export type MoveResizeSlots = typeof __propDef.slots;
|
|
40
43
|
export default class MoveResize extends SvelteComponentTyped<MoveResizeProps, MoveResizeEvents, MoveResizeSlots> {
|
|
44
|
+
get inActivate(): () => void;
|
|
45
|
+
get initmove(): () => void;
|
|
46
|
+
get updateMove(): (newCoordDiff: any, clientY: any) => void;
|
|
41
47
|
}
|
|
42
48
|
export {};
|
|
@@ -63,6 +63,7 @@ export type InlineScript = {
|
|
|
63
63
|
key: string;
|
|
64
64
|
}[];
|
|
65
65
|
};
|
|
66
|
+
export type AppCssItemName = 'viewer' | 'grid' | AppComponent['type'];
|
|
66
67
|
export type App = {
|
|
67
68
|
grid: GridItem[];
|
|
68
69
|
fullscreen: boolean;
|
|
@@ -78,7 +79,7 @@ export type App = {
|
|
|
78
79
|
autoRefresh?: boolean;
|
|
79
80
|
doNotRecomputeOnInputChanged?: boolean;
|
|
80
81
|
}>;
|
|
81
|
-
css?: Partial<Record<
|
|
82
|
+
css?: Partial<Record<AppCssItemName, Record<string, ComponentCssProperty>>>;
|
|
82
83
|
subgrids?: Record<string, GridItem[]>;
|
|
83
84
|
};
|
|
84
85
|
export type ConnectingInput = {
|
|
@@ -91,11 +92,14 @@ export type AppViewerContext = {
|
|
|
91
92
|
worldStore: Writable<World>;
|
|
92
93
|
app: Writable<App>;
|
|
93
94
|
summary: Writable<string>;
|
|
94
|
-
selectedComponent: Writable<string | undefined>;
|
|
95
|
+
selectedComponent: Writable<string[] | undefined>;
|
|
95
96
|
mode: Writable<EditorMode>;
|
|
96
97
|
connectingInput: Writable<ConnectingInput>;
|
|
97
98
|
breakpoint: Writable<EditorBreakpoint>;
|
|
98
|
-
runnableComponents: Writable<Record<string,
|
|
99
|
+
runnableComponents: Writable<Record<string, {
|
|
100
|
+
autoRefresh: boolean;
|
|
101
|
+
cb: (inlineScript?: InlineScript) => Promise<void>;
|
|
102
|
+
}>>;
|
|
99
103
|
staticExporter: Writable<Record<string, () => any>>;
|
|
100
104
|
appPath: string;
|
|
101
105
|
workspace: string;
|
|
@@ -121,13 +125,14 @@ export type AppViewerContext = {
|
|
|
121
125
|
setTab?: (index: number) => void;
|
|
122
126
|
}>>;
|
|
123
127
|
hoverStore: Writable<string | undefined>;
|
|
128
|
+
allIdsInPath: Writable<string[]>;
|
|
124
129
|
};
|
|
125
130
|
export type AppEditorContext = {
|
|
126
131
|
history: History<App> | undefined;
|
|
127
132
|
pickVariableCallback: Writable<((path: string) => void) | undefined>;
|
|
128
133
|
ontextfocus: Writable<(() => void) | undefined>;
|
|
129
134
|
selectedComponentInEditor: Writable<string | undefined>;
|
|
130
|
-
|
|
135
|
+
movingcomponents: Writable<string[] | undefined>;
|
|
131
136
|
};
|
|
132
137
|
export type FocusedGrid = {
|
|
133
138
|
parentComponentId: string;
|
|
@@ -140,7 +145,6 @@ type ComponentID = string;
|
|
|
140
145
|
export type ContextPanelContext = {
|
|
141
146
|
search: Writable<string>;
|
|
142
147
|
manuallyOpened: Writable<Record<string, boolean>>;
|
|
143
|
-
expanded: Writable<boolean>;
|
|
144
148
|
hasResult: Writable<Record<string, boolean>>;
|
|
145
149
|
};
|
|
146
150
|
export {};
|
|
@@ -2,6 +2,8 @@ import type { Schema } from '../../common';
|
|
|
2
2
|
import type { App, ComponentCssProperty, GridItem } from './types';
|
|
3
3
|
import type { AppInput, InputType, ResultAppInput, StaticAppInput } from './inputType';
|
|
4
4
|
import type { Output } from './rx';
|
|
5
|
+
import { type Writable } from 'svelte/store';
|
|
6
|
+
export declare function selectId(e: PointerEvent, id: string, selectedComponent: Writable<string[] | undefined>, app: App): void;
|
|
5
7
|
export declare function allItems(grid: GridItem[], subgrids: Record<string, GridItem[]> | undefined): GridItem[];
|
|
6
8
|
export declare function loadSchema(workspace: string, path: string, runType: 'script' | 'flow' | 'hubscript'): Promise<Schema>;
|
|
7
9
|
export declare function schemaToInputsSpec(schema: Schema, defaultUserInput: boolean): Record<string, StaticAppInput>;
|
package/components/apps/utils.js
CHANGED
|
@@ -1,7 +1,36 @@
|
|
|
1
1
|
import { FlowService, ScriptService } from '../../gen';
|
|
2
2
|
import { inferArgs } from '../../infer';
|
|
3
|
-
import { emptySchema } from '../../utils';
|
|
3
|
+
import { emptySchema, sendUserToast } from '../../utils';
|
|
4
4
|
import { twMerge } from 'tailwind-merge';
|
|
5
|
+
import { get } from 'svelte/store';
|
|
6
|
+
import { findGridItemParentGrid } from './editor/appUtils';
|
|
7
|
+
export function selectId(e, id, selectedComponent, app) {
|
|
8
|
+
if (e.shiftKey) {
|
|
9
|
+
selectedComponent.update((old) => {
|
|
10
|
+
if (old && old?.[0]) {
|
|
11
|
+
if (findGridItemParentGrid(app, old[0]) != findGridItemParentGrid(app, id)) {
|
|
12
|
+
sendUserToast('Cannot multi select items from different grids', true);
|
|
13
|
+
return old;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
if (old == undefined) {
|
|
17
|
+
return [id];
|
|
18
|
+
}
|
|
19
|
+
if (old.includes(id)) {
|
|
20
|
+
return old;
|
|
21
|
+
}
|
|
22
|
+
return [...old, id];
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
if (get(selectedComponent)?.includes(id)) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
selectedComponent.set([id]);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
5
34
|
export function allItems(grid, subgrids) {
|
|
6
35
|
if (subgrids == undefined) {
|
|
7
36
|
return grid;
|
|
@@ -134,6 +163,7 @@ ${hasRows ? 'declare const row: Record<string, any>;' : ''}
|
|
|
134
163
|
${goto
|
|
135
164
|
? `declare async function goto(path: string, newTab?: boolean): Promise<void>;
|
|
136
165
|
declare function setTab(id: string, index: string): void;
|
|
166
|
+
declare function recompute(id: string): void;
|
|
137
167
|
`
|
|
138
168
|
: ''}
|
|
139
169
|
declare const state: ${JSON.stringify(state)};
|
|
@@ -7,6 +7,7 @@ export let color = 'blue';
|
|
|
7
7
|
export let variant = 'contained';
|
|
8
8
|
export let mainClasses = '';
|
|
9
9
|
export let toggleClasses = '';
|
|
10
|
+
export let listClasses = '';
|
|
10
11
|
export let disabled = false;
|
|
11
12
|
export let href = undefined;
|
|
12
13
|
export let target = '_self';
|
|
@@ -59,14 +60,16 @@ $: commonProps = {
|
|
|
59
60
|
{#if ref}
|
|
60
61
|
<Popup
|
|
61
62
|
{ref}
|
|
63
|
+
let:open
|
|
64
|
+
let:close
|
|
62
65
|
options={{
|
|
63
66
|
placement: $$slots.main ? 'bottom-end' : 'bottom',
|
|
64
67
|
strategy: 'absolute',
|
|
65
68
|
modifiers: [{ name: 'offset', options: { offset: [0, 0] } }]
|
|
66
69
|
}}
|
|
67
70
|
>
|
|
68
|
-
<ul class="bg-white rounded-t border pt-1 pb-2 max-h-40 overflow-auto">
|
|
69
|
-
<slot />
|
|
71
|
+
<ul class="bg-white rounded-t border pt-1 pb-2 max-h-40 overflow-auto {listClasses}">
|
|
72
|
+
<slot {open} {close} />
|
|
70
73
|
</ul>
|
|
71
74
|
</Popup>
|
|
72
75
|
{/if}
|
|
@@ -8,6 +8,7 @@ declare const __propDef: {
|
|
|
8
8
|
variant?: ButtonType.Variant | undefined;
|
|
9
9
|
mainClasses?: string | undefined;
|
|
10
10
|
toggleClasses?: string | undefined;
|
|
11
|
+
listClasses?: string | undefined;
|
|
11
12
|
disabled?: boolean | undefined;
|
|
12
13
|
href?: string | undefined;
|
|
13
14
|
target?: ButtonType.Target | undefined;
|
|
@@ -24,7 +25,10 @@ declare const __propDef: {
|
|
|
24
25
|
slots: {
|
|
25
26
|
main: {};
|
|
26
27
|
toggle: {};
|
|
27
|
-
default: {
|
|
28
|
+
default: {
|
|
29
|
+
open: () => void;
|
|
30
|
+
close: () => void;
|
|
31
|
+
};
|
|
28
32
|
};
|
|
29
33
|
};
|
|
30
34
|
export type ButtonPopupProps = typeof __propDef.props;
|
|
@@ -8,6 +8,7 @@ export let target = '_self';
|
|
|
8
8
|
export let iconOnly = false;
|
|
9
9
|
export let startIcon = undefined;
|
|
10
10
|
export let endIcon = undefined;
|
|
11
|
+
export let wrapperClasses = '';
|
|
11
12
|
const props = getContext(ButtonType.ItemContextKey);
|
|
12
13
|
const iconWidthClass = {
|
|
13
14
|
xs: '!w-[12px]',
|
|
@@ -40,7 +41,7 @@ $: buttonProps = {
|
|
|
40
41
|
};
|
|
41
42
|
</script>
|
|
42
43
|
|
|
43
|
-
<li class="mt-1">
|
|
44
|
+
<li class="mt-1 {wrapperClasses}">
|
|
44
45
|
<Button {...buttonProps} on:click>
|
|
45
46
|
<slot />
|
|
46
47
|
</Button>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script>import { createEventDispatcher } from 'svelte';
|
|
2
|
+
import { fade } from 'svelte/transition';
|
|
3
|
+
import { X } from 'lucide-svelte';
|
|
4
|
+
export let value = '';
|
|
5
|
+
export let placeholder = '';
|
|
6
|
+
export let type = 'text';
|
|
7
|
+
export let inputClass = '';
|
|
8
|
+
export let wrapperClass = '';
|
|
9
|
+
export let buttonClass = '';
|
|
10
|
+
const dispatch = createEventDispatcher();
|
|
11
|
+
$: isNumeric = ['number', 'range'].includes(type);
|
|
12
|
+
$: dispatch('change', value);
|
|
13
|
+
function handleInput(e) {
|
|
14
|
+
value = isNumeric ? +e.target.value : e.target.value;
|
|
15
|
+
}
|
|
16
|
+
function clear() {
|
|
17
|
+
value = '';
|
|
18
|
+
}
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<div class="relative grow {wrapperClass}">
|
|
22
|
+
{#if type === 'textarea'}
|
|
23
|
+
<textarea
|
|
24
|
+
{value}
|
|
25
|
+
{placeholder}
|
|
26
|
+
rows="1"
|
|
27
|
+
class="resize-y duration-200 {inputClass}"
|
|
28
|
+
{...$$restProps}
|
|
29
|
+
on:input={handleInput}
|
|
30
|
+
on:focus
|
|
31
|
+
on:blur
|
|
32
|
+
/>
|
|
33
|
+
{:else}
|
|
34
|
+
<input
|
|
35
|
+
{type}
|
|
36
|
+
{value}
|
|
37
|
+
{placeholder}
|
|
38
|
+
class="duration-200 {(type === 'number' && value ? '!pr-[26px] ' : '') + inputClass}"
|
|
39
|
+
{...$$restProps}
|
|
40
|
+
on:input={handleInput}
|
|
41
|
+
on:focus
|
|
42
|
+
on:blur
|
|
43
|
+
/>
|
|
44
|
+
{/if}
|
|
45
|
+
{#if value}
|
|
46
|
+
<button
|
|
47
|
+
transition:fade|local={{ duration: 100 }}
|
|
48
|
+
class="absolute z-10 top-1.5 right-1 rounded-full p-1 bg-white/60 duration-200 hover:bg-gray-200 {buttonClass}"
|
|
49
|
+
aria-label="Clear"
|
|
50
|
+
on:click|preventDefault|stopPropagation={clear}
|
|
51
|
+
>
|
|
52
|
+
<X size={14} />
|
|
53
|
+
</button>
|
|
54
|
+
{/if}
|
|
55
|
+
<slot />
|
|
56
|
+
</div>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
value?: any;
|
|
6
|
+
placeholder?: string | undefined;
|
|
7
|
+
type?: "number" | "text" | "textarea" | undefined;
|
|
8
|
+
inputClass?: string | undefined;
|
|
9
|
+
wrapperClass?: string | undefined;
|
|
10
|
+
buttonClass?: string | undefined;
|
|
11
|
+
};
|
|
12
|
+
events: {
|
|
13
|
+
focus: FocusEvent;
|
|
14
|
+
blur: FocusEvent;
|
|
15
|
+
change: CustomEvent<any>;
|
|
16
|
+
} & {
|
|
17
|
+
[evt: string]: CustomEvent<any>;
|
|
18
|
+
};
|
|
19
|
+
slots: {
|
|
20
|
+
default: {};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export type ClearableInputProps = typeof __propDef.props;
|
|
24
|
+
export type ClearableInputEvents = typeof __propDef.events;
|
|
25
|
+
export type ClearableInputSlots = typeof __propDef.slots;
|
|
26
|
+
export default class ClearableInput extends SvelteComponentTyped<ClearableInputProps, ClearableInputEvents, ClearableInputSlots> {
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -5,6 +5,7 @@ export { default as Button } from './button/Button.svelte';
|
|
|
5
5
|
export { default as ButtonPopup } from './button/ButtonPopup.svelte';
|
|
6
6
|
export { default as ButtonPopupItem } from './button/ButtonPopupItem.svelte';
|
|
7
7
|
export { default as UndoRedo } from './button/UndoRedo.svelte';
|
|
8
|
+
export { default as ClearableInput } from './clearableInput/ClearableInput.svelte';
|
|
8
9
|
export { default as Drawer } from './drawer/Drawer.svelte';
|
|
9
10
|
export { default as DrawerContent } from './drawer/DrawerContent.svelte';
|
|
10
11
|
export { default as Kbd } from './kbd/Kbd.svelte';
|
|
@@ -5,6 +5,7 @@ export { default as Button } from './button/Button.svelte';
|
|
|
5
5
|
export { default as ButtonPopup } from './button/ButtonPopup.svelte';
|
|
6
6
|
export { default as ButtonPopupItem } from './button/ButtonPopupItem.svelte';
|
|
7
7
|
export { default as UndoRedo } from './button/UndoRedo.svelte';
|
|
8
|
+
export { default as ClearableInput } from './clearableInput/ClearableInput.svelte';
|
|
8
9
|
export { default as Drawer } from './drawer/Drawer.svelte';
|
|
9
10
|
export { default as DrawerContent } from './drawer/DrawerContent.svelte';
|
|
10
11
|
export { default as Kbd } from './kbd/Kbd.svelte';
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
<script>export let kbdClass = '';
|
|
2
|
+
</script>
|
|
3
|
+
|
|
1
4
|
<span
|
|
2
5
|
class="{$$props.class} rounded border bg-white/70 px-1.5 !text-xs text-gray-600 shadow-sm font-light transition-all group-hover:border-primary-500 group-hover:text-primary-500"
|
|
3
6
|
>
|
|
4
|
-
<kbd>
|
|
7
|
+
<kbd class={kbdClass}>
|
|
5
8
|
<slot />
|
|
6
9
|
</kbd>
|
|
7
10
|
</span>
|
|
@@ -1,21 +1,8 @@
|
|
|
1
|
-
/** @typedef {typeof __propDef.props} KbdProps */
|
|
2
|
-
/** @typedef {typeof __propDef.events} KbdEvents */
|
|
3
|
-
/** @typedef {typeof __propDef.slots} KbdSlots */
|
|
4
|
-
export default class Kbd extends SvelteComponentTyped<{
|
|
5
|
-
[x: string]: any;
|
|
6
|
-
}, {
|
|
7
|
-
[evt: string]: CustomEvent<any>;
|
|
8
|
-
}, {
|
|
9
|
-
default: {};
|
|
10
|
-
}> {
|
|
11
|
-
}
|
|
12
|
-
export type KbdProps = typeof __propDef.props;
|
|
13
|
-
export type KbdEvents = typeof __propDef.events;
|
|
14
|
-
export type KbdSlots = typeof __propDef.slots;
|
|
15
1
|
import { SvelteComponentTyped } from "svelte";
|
|
16
2
|
declare const __propDef: {
|
|
17
3
|
props: {
|
|
18
4
|
[x: string]: any;
|
|
5
|
+
kbdClass?: string | undefined;
|
|
19
6
|
};
|
|
20
7
|
events: {
|
|
21
8
|
[evt: string]: CustomEvent<any>;
|
|
@@ -24,4 +11,9 @@ declare const __propDef: {
|
|
|
24
11
|
default: {};
|
|
25
12
|
};
|
|
26
13
|
};
|
|
14
|
+
export type KbdProps = typeof __propDef.props;
|
|
15
|
+
export type KbdEvents = typeof __propDef.events;
|
|
16
|
+
export type KbdSlots = typeof __propDef.slots;
|
|
17
|
+
export default class Kbd extends SvelteComponentTyped<KbdProps, KbdEvents, KbdSlots> {
|
|
18
|
+
}
|
|
27
19
|
export {};
|