windmill-components 1.79.0 → 1.82.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/components/ArgInput.svelte +3 -0
- package/components/ArgInput.svelte.d.ts +1 -0
- package/components/DisplayResult.svelte +18 -15
- package/components/Multiselect.svelte.d.ts +2 -2
- package/components/SchemaEditor.svelte +15 -10
- package/components/SettingSection.svelte +1 -1
- package/components/Toggle.svelte +5 -2
- package/components/Toggle.svelte.d.ts +1 -0
- package/components/apps/components/buttons/AppButton.svelte +35 -56
- package/components/apps/components/buttons/AppButton.svelte.d.ts +2 -1
- package/components/apps/components/buttons/AppForm.svelte +24 -24
- package/components/apps/components/buttons/AppForm.svelte.d.ts +1 -1
- package/components/apps/components/buttons/AppFormButton.svelte +79 -94
- package/components/apps/components/buttons/AppFormButton.svelte.d.ts +1 -3
- package/components/apps/components/display/AppBarChart.svelte +2 -2
- package/components/apps/components/display/AppBarChart.svelte.d.ts +1 -1
- package/components/apps/components/display/AppDisplayComponent.svelte +2 -2
- package/components/apps/components/display/AppDisplayComponent.svelte.d.ts +1 -1
- package/components/apps/components/display/AppHtml.svelte +10 -2
- package/components/apps/components/display/AppHtml.svelte.d.ts +1 -1
- package/components/apps/components/display/AppIcon.svelte +4 -1
- package/components/apps/components/display/AppIcon.svelte.d.ts +1 -1
- package/components/apps/components/display/AppImage.svelte +28 -15
- package/components/apps/components/display/AppImage.svelte.d.ts +1 -1
- package/components/apps/components/display/AppMap.svelte.d.ts +1 -1
- package/components/apps/components/display/AppPdf.svelte +3 -2
- package/components/apps/components/display/AppPdf.svelte.d.ts +1 -1
- package/components/apps/components/display/AppPieChart.svelte +2 -2
- package/components/apps/components/display/AppPieChart.svelte.d.ts +1 -1
- package/components/apps/components/display/AppScatterChart.svelte +2 -2
- package/components/apps/components/display/AppScatterChart.svelte.d.ts +1 -1
- package/components/apps/components/display/AppText.svelte +35 -22
- package/components/apps/components/display/AppText.svelte.d.ts +1 -1
- package/components/apps/components/display/AppTimeseries.svelte +2 -2
- package/components/apps/components/display/AppTimeseries.svelte.d.ts +1 -1
- package/components/apps/components/display/PlotlyHtml.svelte +3 -3
- package/components/apps/components/display/VegaLiteHtml.svelte +2 -2
- package/components/apps/components/display/table/AppAggridTable.svelte +1 -1
- package/components/apps/components/display/table/AppTable.svelte +40 -17
- package/components/apps/components/display/table/AppTable.svelte.d.ts +1 -1
- package/components/apps/components/helpers/HiddenComponent.svelte +6 -3
- package/components/apps/components/helpers/HiddenComponent.svelte.d.ts +1 -1
- package/components/apps/components/helpers/InputValue.svelte +9 -9
- package/components/apps/components/helpers/Loader.svelte +18 -0
- package/components/apps/components/helpers/Loader.svelte.d.ts +18 -0
- package/components/apps/components/helpers/NonRunnableComponent.svelte +1 -12
- package/components/apps/components/helpers/ResolveConfig.svelte +29 -0
- package/components/apps/components/helpers/ResolveConfig.svelte.d.ts +21 -0
- package/components/apps/components/helpers/RunnableComponent.svelte +117 -89
- package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +14 -3
- package/components/apps/components/helpers/RunnableWrapper.svelte +50 -9
- package/components/apps/components/helpers/RunnableWrapper.svelte.d.ts +27 -2
- package/components/apps/components/inputs/AppCheckbox.svelte +1 -1
- package/components/apps/components/inputs/AppCheckbox.svelte.d.ts +1 -1
- package/components/apps/components/inputs/AppDateInput.svelte.d.ts +1 -1
- package/components/apps/components/inputs/AppFileInput.svelte.d.ts +1 -1
- package/components/apps/components/inputs/AppMultiSelect.svelte +0 -1
- package/components/apps/components/inputs/AppMultiSelect.svelte.d.ts +1 -1
- package/components/apps/components/inputs/AppNumberInput.svelte +1 -1
- package/components/apps/components/inputs/AppNumberInput.svelte.d.ts +1 -3
- package/components/apps/components/inputs/AppRangeInput.svelte +7 -1
- package/components/apps/components/inputs/AppRangeInput.svelte.d.ts +2 -1
- package/components/apps/components/inputs/AppSelect.svelte +8 -3
- package/components/apps/components/inputs/AppSelect.svelte.d.ts +1 -1
- package/components/apps/components/inputs/AppSliderInputs.svelte +7 -1
- package/components/apps/components/inputs/AppSliderInputs.svelte.d.ts +2 -1
- package/components/apps/components/inputs/AppTextInput.svelte +4 -4
- package/components/apps/components/inputs/AppTextInput.svelte.d.ts +1 -3
- package/components/apps/components/inputs/currency/AppCurrencyInput.svelte +17 -19
- package/components/apps/components/inputs/currency/AppCurrencyInput.svelte.d.ts +1 -1
- package/components/apps/components/layout/AppContainer.svelte +7 -4
- package/components/apps/components/layout/AppContainer.svelte.d.ts +1 -1
- package/components/apps/components/layout/AppDivider.svelte +4 -1
- package/components/apps/components/layout/AppDivider.svelte.d.ts +1 -1
- package/components/apps/components/layout/AppDrawer.svelte +7 -4
- package/components/apps/components/layout/AppDrawer.svelte.d.ts +1 -1
- package/components/apps/components/layout/AppSplitpanes.svelte +34 -21
- package/components/apps/components/layout/AppSplitpanes.svelte.d.ts +1 -3
- package/components/apps/components/layout/AppTabs.svelte +17 -34
- package/components/apps/components/layout/AppTabs.svelte.d.ts +1 -2
- package/components/apps/editor/AppEditor.svelte +17 -13
- package/components/apps/editor/AppEditorHeader.svelte +2 -3
- package/components/apps/editor/AppPreview.svelte +11 -17
- package/components/apps/editor/ComponentHeader.svelte +10 -8
- package/components/apps/editor/ComponentHeader.svelte.d.ts +0 -1
- package/components/apps/editor/GridEditor.svelte +21 -50
- package/components/apps/editor/GridEditor.svelte.d.ts +0 -2
- package/components/apps/editor/RecomputeAllComponents.svelte +13 -2
- package/components/apps/editor/SettingsPanel.svelte +103 -40
- package/components/apps/editor/SubGridEditor.svelte +32 -41
- package/components/apps/editor/SubGridEditor.svelte.d.ts +1 -2
- package/components/apps/editor/appUtils.d.ts +49 -7
- package/components/apps/editor/appUtils.js +133 -37
- package/components/apps/editor/component/Component.svelte +22 -11
- package/components/apps/editor/component/Component.svelte.d.ts +1 -2
- package/components/apps/editor/component/ComponentNavigation.svelte +19 -12
- package/components/apps/editor/component/README.md +4 -0
- package/components/apps/editor/component/components.d.ts +1550 -17
- package/components/apps/editor/component/components.js +295 -325
- package/components/apps/editor/component/default-codes.d.ts +1 -1
- package/components/apps/editor/component/default-codes.js +25 -25
- package/components/apps/editor/componentsPanel/ComponentList.svelte +18 -3
- package/components/apps/editor/componentsPanel/CssProperty.svelte +92 -50
- package/components/apps/editor/componentsPanel/CssProperty.svelte.d.ts +8 -3
- package/components/apps/editor/componentsPanel/CssSettings.svelte +48 -90
- package/components/apps/editor/componentsPanel/ListItem.svelte +3 -0
- package/components/apps/editor/componentsPanel/ListItem.svelte.d.ts +2 -0
- package/components/apps/editor/componentsPanel/QuickStyleMenu.svelte +167 -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 +595 -0
- package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte +1 -1
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +146 -130
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte.d.ts +2 -1
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte +31 -3
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte.d.ts +1 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte +42 -76
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte +67 -17
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte.d.ts +1 -3
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelWithTable.svelte +27 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelWithTable.svelte.d.ts +17 -0
- package/components/apps/editor/inlineScriptsPanel/utils.d.ts +2 -0
- package/components/apps/editor/inlineScriptsPanel/utils.js +6 -5
- package/components/apps/editor/settingsPanel/AlignmentEditor.svelte +10 -2
- package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte +37 -31
- package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte.d.ts +4 -104
- package/components/apps/editor/settingsPanel/ComponentPanel.svelte +113 -67
- package/components/apps/editor/settingsPanel/ComponentPanel.svelte.d.ts +5 -3
- package/components/apps/editor/settingsPanel/GridTab.svelte +0 -1
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +99 -80
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte.d.ts +8 -0
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +25 -2
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte.d.ts +1 -0
- package/components/apps/editor/settingsPanel/OneOfInputSpecsEditor.svelte +52 -0
- package/components/apps/editor/settingsPanel/OneOfInputSpecsEditor.svelte.d.ts +28 -0
- package/components/apps/editor/settingsPanel/SelectedRunnable.svelte +70 -26
- package/components/apps/editor/settingsPanel/SelectedRunnable.svelte.d.ts +2 -0
- package/components/apps/editor/settingsPanel/StylePanel.svelte +23 -0
- package/components/apps/editor/settingsPanel/StylePanel.svelte.d.ts +17 -0
- package/components/apps/editor/settingsPanel/SubTypeEditor.svelte +7 -5
- package/components/apps/editor/settingsPanel/SubTypeEditor.svelte.d.ts +3 -2
- package/components/apps/editor/settingsPanel/TableActions.svelte +8 -63
- package/components/apps/editor/settingsPanel/inputEditor/ColorInput.svelte +12 -12
- package/components/apps/editor/settingsPanel/inputEditor/ColorInput.svelte.d.ts +3 -4
- package/components/apps/editor/settingsPanel/inputEditor/ConnectedInputEditor.svelte +3 -1
- package/components/apps/editor/settingsPanel/inputEditor/IconSelectInput.svelte.d.ts +2 -4
- package/components/apps/editor/settingsPanel/inputEditor/RunnableInputEditor.svelte +5 -5
- package/components/apps/editor/settingsPanel/inputEditor/RunnableInputEditor.svelte.d.ts +2 -0
- package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte +48 -32
- package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte.d.ts +8 -2
- package/components/apps/editor/settingsPanel/inputEditor/TabSelectInput.svelte +46 -0
- package/components/apps/editor/settingsPanel/inputEditor/TabSelectInput.svelte.d.ts +20 -0
- package/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte +7 -0
- package/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte.d.ts +1 -0
- 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/BackgroundScriptTriggerList.svelte +20 -70
- package/components/apps/editor/settingsPanel/triggerLists/BackgroundScriptTriggerList.svelte.d.ts +1 -0
- package/components/apps/editor/settingsPanel/triggerLists/ComponentTriggerList.svelte +14 -8
- package/components/apps/editor/settingsPanel/triggerLists/ComponentTriggerList.svelte.d.ts +5 -1
- package/components/apps/editor/settingsPanel/triggerLists/TriggerBadgesList.svelte +85 -27
- package/components/apps/editor/settingsPanel/triggerLists/TriggerBadgesList.svelte.d.ts +4 -6
- package/components/apps/gridUtils.js +1 -1
- package/components/apps/inputType.d.ts +12 -16
- package/components/apps/rx.d.ts +2 -0
- package/components/apps/rx.js +8 -2
- package/components/apps/svelte-grid/Grid.svelte +0 -4
- package/components/apps/svelte-grid/Grid.svelte.d.ts +1 -1
- package/components/apps/svelte-grid/MoveResize.svelte +24 -30
- package/components/apps/svelte-grid/MoveResize.svelte.d.ts +0 -4
- package/components/apps/svelte-grid/types.d.ts +1 -7
- package/components/apps/svelte-grid/utils/helper.js +6 -10
- package/components/apps/types.d.ts +22 -22
- package/components/apps/utils.d.ts +2 -2
- package/components/apps/utils.js +13 -11
- 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/common/skeleton/Skeleton.svelte +1 -1
- package/components/flows/flowStateUtils.js +8 -1
- package/package.json +672 -659
- package/utils.d.ts +1 -0
- package/utils.js +3 -0
- package/components/apps/editor/GridPanel.svelte +0 -31
- package/components/apps/editor/GridPanel.svelte.d.ts +0 -18
- package/components/apps/editor/componentsPanel/componentStaticValues.d.ts +0 -12
- package/components/apps/editor/componentsPanel/componentStaticValues.js +0 -25
package/components/apps/rx.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export type World = {
|
|
|
19
19
|
connect: <T>(inputSpec: AppInput, next: (x: T) => void, id?: string) => Input<T>;
|
|
20
20
|
stateId: Writable<number>;
|
|
21
21
|
newOutput: <T>(id: string, name: string, previousValue: T) => Output<T>;
|
|
22
|
+
initializedOutputs: number;
|
|
23
|
+
initialized: boolean;
|
|
22
24
|
};
|
|
23
25
|
export declare function buildWorld(context: Record<string, any>): Writable<World>;
|
|
24
26
|
export declare function buildObservableWorld(): {
|
package/components/apps/rx.js
CHANGED
|
@@ -24,7 +24,14 @@ export function buildWorld(context) {
|
|
|
24
24
|
return o;
|
|
25
25
|
}
|
|
26
26
|
stateId.update((x) => x + 1);
|
|
27
|
-
writableWorld = writable({
|
|
27
|
+
writableWorld = writable({
|
|
28
|
+
outputsById,
|
|
29
|
+
connect: newWorld.connect,
|
|
30
|
+
stateId,
|
|
31
|
+
newOutput,
|
|
32
|
+
initializedOutputs: 0,
|
|
33
|
+
initialized: false
|
|
34
|
+
});
|
|
28
35
|
return writableWorld;
|
|
29
36
|
}
|
|
30
37
|
export function buildObservableWorld() {
|
|
@@ -47,7 +54,6 @@ export function buildObservableWorld() {
|
|
|
47
54
|
};
|
|
48
55
|
}
|
|
49
56
|
const { componentId, path } = connection;
|
|
50
|
-
console.log('connection', connection);
|
|
51
57
|
const input = cachedInput(next, `${componentId}-${path}-${id}`);
|
|
52
58
|
const [p] = path ? path.split('.')[0].split('[') : [undefined];
|
|
53
59
|
let obs = observables[`${componentId}.${p}`];
|
|
@@ -125,8 +125,6 @@ const handleRepaint = ({ detail }) => {
|
|
|
125
125
|
on:pointerup={pointerup}
|
|
126
126
|
onTop={item.id == onTopId}
|
|
127
127
|
id={item.id}
|
|
128
|
-
resizable={item[getComputedCols] && item[getComputedCols].resizable}
|
|
129
|
-
draggable={item[getComputedCols] && item[getComputedCols].draggable}
|
|
130
128
|
{xPerPx}
|
|
131
129
|
{yPerPx}
|
|
132
130
|
width={Math.min(getComputedCols, item[getComputedCols] && item[getComputedCols].w) *
|
|
@@ -136,8 +134,6 @@ const handleRepaint = ({ detail }) => {
|
|
|
136
134
|
top={(item[getComputedCols] && item[getComputedCols].y) * yPerPx + gapY}
|
|
137
135
|
left={(item[getComputedCols] && item[getComputedCols].x) * xPerPx + gapX}
|
|
138
136
|
item={item[getComputedCols]}
|
|
139
|
-
min={item[getComputedCols] && item[getComputedCols].min}
|
|
140
|
-
max={item[getComputedCols] && item[getComputedCols].max}
|
|
141
137
|
cols={getComputedCols}
|
|
142
138
|
{gapX}
|
|
143
139
|
{gapY}
|
|
@@ -11,7 +11,7 @@ declare class __sveltets_Render<T> {
|
|
|
11
11
|
throttleResize?: number | undefined;
|
|
12
12
|
onTopId?: string | undefined;
|
|
13
13
|
containerWidth?: number | undefined;
|
|
14
|
-
scroller?: undefined;
|
|
14
|
+
scroller?: HTMLElement | undefined;
|
|
15
15
|
sensor?: number | undefined;
|
|
16
16
|
parentWidth?: number | undefined;
|
|
17
17
|
};
|
|
@@ -5,8 +5,6 @@ export let width;
|
|
|
5
5
|
export let height;
|
|
6
6
|
export let left;
|
|
7
7
|
export let top;
|
|
8
|
-
export let resizable;
|
|
9
|
-
export let draggable;
|
|
10
8
|
export let id;
|
|
11
9
|
export let container;
|
|
12
10
|
export let xPerPx;
|
|
@@ -14,8 +12,6 @@ export let yPerPx;
|
|
|
14
12
|
export let gapX;
|
|
15
13
|
export let gapY;
|
|
16
14
|
export let item;
|
|
17
|
-
export let max;
|
|
18
|
-
export let min;
|
|
19
15
|
export let cols;
|
|
20
16
|
export let nativeContainer;
|
|
21
17
|
export let onTop;
|
|
@@ -112,19 +108,23 @@ function computeRect(target) {
|
|
|
112
108
|
rect = irect;
|
|
113
109
|
}
|
|
114
110
|
}
|
|
111
|
+
let dragClosure = undefined;
|
|
115
112
|
const pointerdown = ({ clientX, clientY, target }) => {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
113
|
+
dragClosure = () => {
|
|
114
|
+
dragClosure = undefined;
|
|
115
|
+
initX = clientX;
|
|
116
|
+
initY = clientY;
|
|
117
|
+
capturePos = { x: left, y: top };
|
|
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;
|
|
127
|
+
};
|
|
128
128
|
window.addEventListener('pointermove', pointermove);
|
|
129
129
|
window.addEventListener('pointerup', pointerup);
|
|
130
130
|
};
|
|
@@ -146,13 +146,11 @@ const update = () => {
|
|
|
146
146
|
if (shadow) {
|
|
147
147
|
shadow.x = Math.max(Math.min(gridX, cols - shadow.w), 0);
|
|
148
148
|
shadow.y = Math.max(gridY, 0);
|
|
149
|
-
if (max.y) {
|
|
150
|
-
shadow.y = Math.min(shadow.y, max.y);
|
|
151
|
-
}
|
|
152
149
|
}
|
|
153
150
|
repaint(undefined, false);
|
|
154
151
|
};
|
|
155
152
|
const pointermove = (event) => {
|
|
153
|
+
dragClosure && dragClosure();
|
|
156
154
|
event.preventDefault();
|
|
157
155
|
event.stopPropagation();
|
|
158
156
|
event.stopImmediatePropagation();
|
|
@@ -183,6 +181,7 @@ const pointermove = (event) => {
|
|
|
183
181
|
}
|
|
184
182
|
};
|
|
185
183
|
const pointerup = (e) => {
|
|
184
|
+
dragClosure = undefined;
|
|
186
185
|
stopAutoscroll();
|
|
187
186
|
window.removeEventListener('pointerdown', pointerdown);
|
|
188
187
|
window.removeEventListener('pointermove', pointermove);
|
|
@@ -214,13 +213,9 @@ const resizePointerMove = ({ pageX, pageY }) => {
|
|
|
214
213
|
newSize.height = initSize.height + pageY - resizeInitPos.y;
|
|
215
214
|
// Get max col number
|
|
216
215
|
let maxWidth = cols - shadow.x;
|
|
217
|
-
maxWidth =
|
|
216
|
+
maxWidth = maxWidth;
|
|
218
217
|
// Limit bound
|
|
219
|
-
newSize.width = Math.
|
|
220
|
-
newSize.height = Math.max(newSize.height, min.h * yPerPx - gapY * 2);
|
|
221
|
-
if (max.h) {
|
|
222
|
-
newSize.height = Math.min(newSize.height, max.h * yPerPx - gapY * 2);
|
|
223
|
-
}
|
|
218
|
+
newSize.width = Math.min(newSize.width, maxWidth * xPerPx - gapX * 2);
|
|
224
219
|
// Limit col & row
|
|
225
220
|
shadow.w = Math.round((newSize.width + gapX * 2) / xPerPx);
|
|
226
221
|
shadow.h = Math.round((newSize.height + gapY * 2) / yPerPx);
|
|
@@ -235,9 +230,10 @@ const resizePointerUp = (e) => {
|
|
|
235
230
|
};
|
|
236
231
|
</script>
|
|
237
232
|
|
|
233
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
238
234
|
<div
|
|
239
|
-
draggable=
|
|
240
|
-
on:pointerdown={
|
|
235
|
+
draggable="false"
|
|
236
|
+
on:pointerdown|stopPropagation|preventDefault={pointerdown}
|
|
241
237
|
class="svlt-grid-item"
|
|
242
238
|
class:svlt-grid-active={active || (trans && rect)}
|
|
243
239
|
style="width: {active ? newSize.width : width}px; height:{active
|
|
@@ -250,9 +246,7 @@ const resizePointerUp = (e) => {
|
|
|
250
246
|
: `transition: transform 0.1s, opacity 0.1s; transform: translate(${left}px, ${top}px); `} "
|
|
251
247
|
>
|
|
252
248
|
<slot movePointerDown={pointerdown} {resizePointerDown} />
|
|
253
|
-
|
|
254
|
-
<div class="svlt-grid-resizer" on:pointerdown={resizePointerDown} />
|
|
255
|
-
{/if}
|
|
249
|
+
<div class="svlt-grid-resizer" on:pointerdown={resizePointerDown} />
|
|
256
250
|
</div>
|
|
257
251
|
|
|
258
252
|
{#if (active || trans) && shadow}
|
|
@@ -6,8 +6,6 @@ declare const __propDef: {
|
|
|
6
6
|
height: any;
|
|
7
7
|
left: any;
|
|
8
8
|
top: any;
|
|
9
|
-
resizable: any;
|
|
10
|
-
draggable: any;
|
|
11
9
|
id: any;
|
|
12
10
|
container: any;
|
|
13
11
|
xPerPx: any;
|
|
@@ -15,8 +13,6 @@ declare const __propDef: {
|
|
|
15
13
|
gapX: any;
|
|
16
14
|
gapY: any;
|
|
17
15
|
item: any;
|
|
18
|
-
max: any;
|
|
19
|
-
min: any;
|
|
20
16
|
cols: any;
|
|
21
17
|
nativeContainer: any;
|
|
22
18
|
onTop: any;
|
|
@@ -9,13 +9,7 @@ export interface Positon {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
interface ItemLayout extends Size, Positon {
|
|
12
|
-
fixed
|
|
13
|
-
resizable?: boolean
|
|
14
|
-
draggable?: boolean
|
|
15
|
-
customDragger?: boolean
|
|
16
|
-
customResizer?: boolean
|
|
17
|
-
min?: Size
|
|
18
|
-
max?: Size
|
|
12
|
+
fixed: boolean
|
|
19
13
|
}
|
|
20
14
|
|
|
21
15
|
export type FilledItem<T> = { [width: number]: Required<ItemLayout>; data: T; id: string }
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
import { makeMatrixFromItems } from
|
|
2
|
-
import { findFreeSpaceForItem, normalize, adjust } from
|
|
3
|
-
import { getRowsCount } from
|
|
1
|
+
import { makeMatrixFromItems } from './matrix';
|
|
2
|
+
import { findFreeSpaceForItem, normalize, adjust } from './item';
|
|
3
|
+
import { getRowsCount } from './other';
|
|
4
4
|
function makeItem(item) {
|
|
5
5
|
const { min = { w: 1, h: 1 }, max } = item;
|
|
6
6
|
return {
|
|
7
7
|
fixed: false,
|
|
8
|
-
resizable: !item.fixed,
|
|
9
|
-
draggable: !item.fixed,
|
|
10
|
-
customDragger: false,
|
|
11
|
-
customResizer: false,
|
|
12
8
|
min: {
|
|
13
9
|
w: Math.max(1, min.w),
|
|
14
|
-
h: Math.max(1, min.h)
|
|
10
|
+
h: Math.max(1, min.h)
|
|
15
11
|
},
|
|
16
12
|
max: { ...max },
|
|
17
|
-
...item
|
|
13
|
+
...item
|
|
18
14
|
};
|
|
19
15
|
}
|
|
20
16
|
const gridHelp = {
|
|
@@ -31,6 +27,6 @@ const gridHelp = {
|
|
|
31
27
|
let matrix = makeMatrixFromItems(items, getRowsCount(items, cols), cols);
|
|
32
28
|
let position = findFreeSpaceForItem(matrix, item[cols]);
|
|
33
29
|
return position;
|
|
34
|
-
}
|
|
30
|
+
}
|
|
35
31
|
};
|
|
36
32
|
export default gridHelp;
|
|
@@ -2,8 +2,8 @@ import type { Schema } from '../../common';
|
|
|
2
2
|
import type { Preview } from '../../gen';
|
|
3
3
|
import type { History } from '../../history';
|
|
4
4
|
import type { Writable } from 'svelte/store';
|
|
5
|
-
import type { AppComponent } from './editor/component/components';
|
|
6
|
-
import type { AppInput, ConnectedAppInput, ConnectedInput, EvalAppInput, RowAppInput, StaticAppInput, UploadAppInput, UserAppInput } from './inputType';
|
|
5
|
+
import type { AppComponent, components } from './editor/component/components';
|
|
6
|
+
import type { AppInput, ConnectedAppInput, ConnectedInput, EvalAppInput, ResultAppInput, RowAppInput, StaticAppInput, UploadAppInput, UserAppInput } from './inputType';
|
|
7
7
|
import type { World } from './rx';
|
|
8
8
|
import type { FilledItem } from './svelte-grid/types';
|
|
9
9
|
export type HorizontalAlignment = 'left' | 'center' | 'right';
|
|
@@ -14,38 +14,33 @@ export type Aligned = {
|
|
|
14
14
|
};
|
|
15
15
|
export interface GeneralAppInput {
|
|
16
16
|
onlyStatic?: boolean;
|
|
17
|
-
evaluatedValue?: boolean;
|
|
18
17
|
tooltip?: string;
|
|
18
|
+
placeholder?: string;
|
|
19
19
|
}
|
|
20
20
|
export type ComponentCssProperty = {
|
|
21
21
|
class?: string;
|
|
22
22
|
style?: string;
|
|
23
23
|
};
|
|
24
|
-
export type ComponentCustomCSS<T extends
|
|
25
|
-
export type Configuration =
|
|
26
|
-
export type
|
|
27
|
-
|
|
24
|
+
export type ComponentCustomCSS<T extends keyof typeof components> = Partial<(typeof components)[T]['customCss']>;
|
|
25
|
+
export type Configuration = StaticAppInput | ConnectedAppInput | UserAppInput | RowAppInput | EvalAppInput | UploadAppInput | ResultAppInput;
|
|
26
|
+
export type StaticConfiguration = GeneralAppInput & StaticAppInput;
|
|
27
|
+
export type RichConfigurationT<T> = (T & {
|
|
28
|
+
type: AppInput['type'];
|
|
28
29
|
}) | {
|
|
29
|
-
|
|
30
|
+
type: 'oneOf';
|
|
30
31
|
selected: string;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
title: string;
|
|
35
|
-
configuration: Record<string, Configuration>;
|
|
32
|
+
tooltip?: string;
|
|
33
|
+
labels?: Record<string, string>;
|
|
34
|
+
configuration: Record<string, Record<string, T>>;
|
|
36
35
|
};
|
|
36
|
+
export type RichConfiguration = RichConfigurationT<Configuration>;
|
|
37
37
|
export type RichConfigurations = Record<string, RichConfiguration>;
|
|
38
|
+
export type StaticRichConfigurations = Record<string, RichConfigurationT<GeneralAppInput & (StaticAppInput | EvalAppInput)>>;
|
|
38
39
|
export interface BaseAppComponent extends Partial<Aligned> {
|
|
39
40
|
id: ComponentID;
|
|
40
41
|
componentInput: AppInput | undefined;
|
|
41
42
|
configuration: RichConfigurations;
|
|
42
|
-
customCss?:
|
|
43
|
-
/**
|
|
44
|
-
* If `true` then the wrapper will allow items to flow outside of it's borders.
|
|
45
|
-
*
|
|
46
|
-
* *For example when the component has a popup like `Select`*
|
|
47
|
-
*/
|
|
48
|
-
softWrap?: boolean;
|
|
43
|
+
customCss?: Record<string, ComponentCssProperty>;
|
|
49
44
|
numberOfSubgrids?: number;
|
|
50
45
|
}
|
|
51
46
|
export type ComponentSet = {
|
|
@@ -68,9 +63,11 @@ export type InlineScript = {
|
|
|
68
63
|
key: string;
|
|
69
64
|
}[];
|
|
70
65
|
};
|
|
66
|
+
export type AppCssItemName = 'viewer' | 'grid' | AppComponent['type'];
|
|
71
67
|
export type App = {
|
|
72
68
|
grid: GridItem[];
|
|
73
69
|
fullscreen: boolean;
|
|
70
|
+
norefreshbar?: boolean;
|
|
74
71
|
unusedInlineScripts: Array<{
|
|
75
72
|
name: string;
|
|
76
73
|
inlineScript: InlineScript;
|
|
@@ -80,8 +77,9 @@ export type App = {
|
|
|
80
77
|
inlineScript: InlineScript | undefined;
|
|
81
78
|
fields: Record<string, StaticAppInput | ConnectedAppInput | RowAppInput | UserAppInput>;
|
|
82
79
|
autoRefresh?: boolean;
|
|
80
|
+
doNotRecomputeOnInputChanged?: boolean;
|
|
83
81
|
}>;
|
|
84
|
-
css?: Record<
|
|
82
|
+
css?: Partial<Record<AppCssItemName, Record<string, ComponentCssProperty>>>;
|
|
85
83
|
subgrids?: Record<string, GridItem[]>;
|
|
86
84
|
};
|
|
87
85
|
export type ConnectingInput = {
|
|
@@ -98,7 +96,7 @@ export type AppViewerContext = {
|
|
|
98
96
|
mode: Writable<EditorMode>;
|
|
99
97
|
connectingInput: Writable<ConnectingInput>;
|
|
100
98
|
breakpoint: Writable<EditorBreakpoint>;
|
|
101
|
-
runnableComponents: Writable<Record<string, () => Promise<void>>>;
|
|
99
|
+
runnableComponents: Writable<Record<string, (inlineScript?: InlineScript) => Promise<void>>>;
|
|
102
100
|
staticExporter: Writable<Record<string, () => any>>;
|
|
103
101
|
appPath: string;
|
|
104
102
|
workspace: string;
|
|
@@ -129,6 +127,8 @@ export type AppEditorContext = {
|
|
|
129
127
|
history: History<App> | undefined;
|
|
130
128
|
pickVariableCallback: Writable<((path: string) => void) | undefined>;
|
|
131
129
|
ontextfocus: Writable<(() => void) | undefined>;
|
|
130
|
+
selectedComponentInEditor: Writable<string | undefined>;
|
|
131
|
+
movingcomponent: Writable<string | undefined>;
|
|
132
132
|
};
|
|
133
133
|
export type FocusedGrid = {
|
|
134
134
|
parentComponentId: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Schema } from '../../common';
|
|
2
|
-
import type { App, ComponentCssProperty,
|
|
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
5
|
export declare function allItems(grid: GridItem[], subgrids: Record<string, GridItem[]> | undefined): GridItem[];
|
|
@@ -18,4 +18,4 @@ export declare function buildExtraLib(components: Record<string, Record<string,
|
|
|
18
18
|
export declare function getAllScriptNames(app: App): string[];
|
|
19
19
|
export declare function toPascalCase(text: string): string;
|
|
20
20
|
export declare function toKebabCase(text: string): string;
|
|
21
|
-
export declare function concatCustomCss<T extends string
|
|
21
|
+
export declare function concatCustomCss<T extends Record<string, ComponentCssProperty>>(appCss?: Record<string, ComponentCssProperty>, componentCss?: T): T | undefined;
|
package/components/apps/utils.js
CHANGED
|
@@ -81,6 +81,8 @@ export function fieldTypeToTsType(inputType) {
|
|
|
81
81
|
return 'array';
|
|
82
82
|
case 'any':
|
|
83
83
|
return 'any';
|
|
84
|
+
case 'tab-select':
|
|
85
|
+
return 'Tab';
|
|
84
86
|
default:
|
|
85
87
|
return 'string';
|
|
86
88
|
}
|
|
@@ -171,19 +173,19 @@ export function toKebabCase(text) {
|
|
|
171
173
|
export function concatCustomCss(appCss, componentCss) {
|
|
172
174
|
if (!componentCss)
|
|
173
175
|
return undefined;
|
|
174
|
-
|
|
175
|
-
Object.keys(componentCss).forEach((key) => {
|
|
176
|
-
const k = key;
|
|
176
|
+
return Object.fromEntries(Object.entries(componentCss).map(([key, v]) => {
|
|
177
177
|
// This is the general style of the component type
|
|
178
|
-
const appStyle = appCss?.[
|
|
178
|
+
const appStyle = appCss?.[key]?.style?.trim() || '';
|
|
179
179
|
const appEnding = appStyle?.endsWith(';') || !appStyle ? ' ' : '; ';
|
|
180
180
|
// This is the custom style of the component instance
|
|
181
|
-
const compStyle =
|
|
181
|
+
const compStyle = v?.style?.trim() || '';
|
|
182
182
|
const compEnding = compStyle?.endsWith(';') || !compStyle ? ' ' : ';';
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
183
|
+
return [
|
|
184
|
+
key,
|
|
185
|
+
{
|
|
186
|
+
style: (appStyle + appEnding + compStyle + compEnding).trim(),
|
|
187
|
+
class: twMerge(appCss?.[key]?.class, v?.class)
|
|
188
|
+
}
|
|
189
|
+
];
|
|
190
|
+
}));
|
|
189
191
|
}
|
|
@@ -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 {};
|
|
@@ -4,8 +4,12 @@ let current = undefined;
|
|
|
4
4
|
|
|
5
5
|
<script>import { classNames } from '../../../utils';
|
|
6
6
|
import { onMount } from 'svelte';
|
|
7
|
+
import { fade } from 'svelte/transition';
|
|
7
8
|
export let noMinW = false;
|
|
8
9
|
export let show = false;
|
|
10
|
+
export let wrapperClasses = '';
|
|
11
|
+
export let popupClasses = '';
|
|
12
|
+
export let transitionDuration = 100;
|
|
9
13
|
let menu;
|
|
10
14
|
export let placement = 'bottom-start';
|
|
11
15
|
function handleOutsideClick(event) {
|
|
@@ -40,7 +44,7 @@ const placementsClasses = {
|
|
|
40
44
|
};
|
|
41
45
|
</script>
|
|
42
46
|
|
|
43
|
-
<div class="relative" bind:this={menu}>
|
|
47
|
+
<div class="relative {wrapperClasses}" bind:this={menu}>
|
|
44
48
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
45
49
|
<div
|
|
46
50
|
on:click|stopPropagation={() => {
|
|
@@ -56,10 +60,12 @@ const placementsClasses = {
|
|
|
56
60
|
</div>
|
|
57
61
|
{#if show}
|
|
58
62
|
<div
|
|
63
|
+
transition:fade|local={{ duration: transitionDuration }}
|
|
59
64
|
class={classNames(
|
|
60
65
|
'z-50 absolute mt-2 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none',
|
|
61
66
|
placementsClasses[placement],
|
|
62
|
-
noMinW ? 'min-w-0' : 'w-60'
|
|
67
|
+
noMinW ? 'min-w-0' : 'w-60',
|
|
68
|
+
popupClasses
|
|
63
69
|
)}
|
|
64
70
|
role="menu"
|
|
65
71
|
tabindex="-1"
|