@finsweet/webflow-apps-utils 1.0.1 → 1.0.3
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/README.md +162 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/providers/GlobalProvider.mdx +322 -0
- package/dist/providers/GlobalProvider.svelte +58 -0
- package/dist/providers/GlobalProvider.svelte.d.ts +4 -0
- package/dist/providers/configuratorUtils.d.ts +37 -0
- package/dist/providers/configuratorUtils.js +219 -0
- package/dist/providers/globalContext.svelte.d.ts +18 -0
- package/dist/providers/globalContext.svelte.js +439 -0
- package/dist/providers/index.d.ts +5 -0
- package/dist/providers/index.js +7 -0
- package/dist/providers/types.d.ts +103 -0
- package/dist/providers/types.js +6 -0
- package/dist/router/README.md +2 -2
- package/dist/stores/index.d.ts +0 -1
- package/dist/stores/index.js +0 -1
- package/dist/types/webflow.d.ts +31 -47
- package/dist/ui/components/LoadingScreen.svelte +2 -1
- package/dist/ui/components/button/Button.svelte +4 -1
- package/dist/ui/components/button-group/ButtonGroup.stories.js +112 -0
- package/dist/ui/components/{ButtonGroup.svelte → button-group/ButtonGroup.svelte} +20 -33
- package/dist/ui/components/button-group/ButtonGroup.svelte.d.ts +13 -0
- package/dist/ui/components/button-group/index.d.ts +2 -0
- package/dist/ui/components/button-group/index.js +1 -0
- package/dist/ui/components/button-group/types.d.ts +32 -0
- package/dist/ui/components/checkbox/Checkbox.stories.d.ts +55 -0
- package/dist/ui/components/checkbox/Checkbox.stories.js +162 -0
- package/dist/ui/components/checkbox/Checkbox.svelte +141 -0
- package/dist/ui/components/checkbox/Checkbox.svelte.d.ts +4 -0
- package/dist/ui/components/checkbox/index.d.ts +2 -0
- package/dist/ui/components/checkbox/index.js +1 -0
- package/dist/ui/components/checkbox/types.d.ts +32 -0
- package/dist/ui/components/controlled-buttons/ControlledButtons.stories.d.ts +32 -0
- package/dist/ui/components/controlled-buttons/ControlledButtons.stories.js +152 -0
- package/dist/ui/components/{buttons/FooterButton.svelte → controlled-buttons/ControlledButtons.svelte} +18 -67
- package/dist/ui/components/controlled-buttons/ControlledButtons.svelte.d.ts +4 -0
- package/dist/ui/components/controlled-buttons/index.d.ts +2 -0
- package/dist/ui/components/controlled-buttons/index.js +1 -0
- package/dist/ui/components/{buttons → controlled-buttons}/types.d.ts +11 -4
- package/dist/ui/components/divider/Divider.stories.svelte +134 -0
- package/dist/ui/components/{clickable/Clickable.stories.svelte.d.ts → divider/Divider.stories.svelte.d.ts} +4 -4
- package/dist/ui/components/divider/Divider.svelte +30 -0
- package/dist/ui/components/divider/Divider.svelte.d.ts +4 -0
- package/dist/ui/components/divider/index.d.ts +2 -0
- package/dist/ui/components/divider/index.js +1 -0
- package/dist/ui/components/divider/types.d.ts +23 -0
- package/dist/ui/components/divider/types.js +1 -0
- package/dist/ui/components/iframe/Iframe.stories.svelte +122 -0
- package/dist/ui/components/{ToggleItem.svelte.d.ts → iframe/Iframe.stories.svelte.d.ts} +7 -8
- package/dist/ui/components/iframe/Iframe.svelte +75 -0
- package/dist/ui/components/iframe/Iframe.svelte.d.ts +4 -0
- package/dist/ui/components/iframe/index.d.ts +2 -0
- package/dist/ui/components/iframe/index.js +1 -0
- package/dist/ui/components/iframe/types.d.ts +38 -0
- package/dist/ui/components/iframe/types.js +1 -0
- package/dist/ui/components/index.d.ts +12 -39
- package/dist/ui/components/index.js +12 -39
- package/dist/ui/components/input/Input.stories.d.ts +24 -0
- package/dist/ui/components/input/Input.stories.js +98 -0
- package/dist/ui/components/input/Input.svelte +321 -80
- package/dist/ui/components/input/types.d.ts +27 -1
- package/dist/ui/components/layout/Layout.stories.svelte +3 -3
- package/dist/ui/components/layout/Layout.svelte +3 -5
- package/dist/ui/components/layout/common/EditModeMessage.svelte +24 -12
- package/dist/ui/components/layout/{ExampleLayout.svelte → examples/ExampleLayout.svelte} +34 -22
- package/dist/ui/components/layout/examples/Wrapper.svelte +9 -0
- package/dist/ui/components/{NoSettingsNeeded.svelte.d.ts → layout/examples/Wrapper.svelte.d.ts} +3 -3
- package/dist/ui/components/layout/examples/index.d.ts +2 -0
- package/dist/ui/components/layout/examples/index.js +2 -0
- package/dist/ui/components/layout/index.d.ts +2 -1
- package/dist/ui/components/layout/index.js +2 -1
- package/dist/ui/components/modal/Example.svelte +320 -0
- package/dist/ui/components/modal/Example.svelte.d.ts +3 -0
- package/dist/ui/components/modal/Modal.stories.svelte +18 -0
- package/dist/ui/components/modal/Modal.stories.svelte.d.ts +26 -0
- package/dist/ui/components/modal/Modal.svelte +490 -0
- package/dist/ui/components/modal/Modal.svelte.d.ts +130 -0
- package/dist/ui/components/modal/index.d.ts +2 -0
- package/dist/ui/components/modal/index.js +1 -0
- package/dist/ui/components/modal/types.d.ts +75 -0
- package/dist/ui/components/modal/types.js +1 -0
- package/dist/ui/components/notification/Notification.stories.svelte +228 -0
- package/dist/ui/components/{ToggleList.svelte.d.ts → notification/Notification.stories.svelte.d.ts} +9 -21
- package/dist/ui/components/notification/Notification.svelte +289 -0
- package/dist/ui/components/notification/Notification.svelte.d.ts +67 -0
- package/dist/ui/components/notification/index.d.ts +2 -0
- package/dist/ui/components/notification/index.js +1 -0
- package/dist/ui/components/notification/types.d.ts +68 -0
- package/dist/ui/components/notification/types.js +1 -0
- package/dist/ui/components/section/Section.stories.svelte +263 -0
- package/dist/ui/components/section/Section.stories.svelte.d.ts +27 -0
- package/dist/ui/components/section/Section.svelte +324 -0
- package/dist/ui/components/section/Section.svelte.d.ts +5 -0
- package/dist/ui/components/section/index.d.ts +2 -0
- package/dist/ui/components/section/index.js +1 -0
- package/dist/ui/components/section/types.d.ts +106 -0
- package/dist/ui/components/section/types.js +1 -0
- package/dist/ui/components/{ImageUpload.svelte → shared/ImageUpload.svelte} +3 -3
- package/dist/ui/components/{SelectBodyOrDivBlock.svelte → shared/SelectBodyOrDivBlock.svelte} +1 -1
- package/dist/ui/components/shared/index.d.ts +2 -0
- package/dist/ui/components/shared/index.js +2 -0
- package/dist/ui/icons/LineChartIcon.svelte +8 -0
- package/dist/ui/icons/LineChartIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/index.d.ts +2 -1
- package/dist/ui/icons/index.js +2 -1
- package/dist/ui/index.css +33 -5
- package/dist/utils/api/checkIfAppModeIsDesign.d.ts +1 -2
- package/dist/utils/api/checkIfAppModeIsDesign.js +1 -2
- package/dist/utils/api/clipboard/handlePaste.d.ts +6 -37
- package/dist/utils/api/clipboard/handlePaste.js +2 -6
- package/dist/utils/api/getAllAssets.d.ts +1 -2
- package/dist/utils/api/getAllAssets.js +1 -2
- package/dist/utils/api/getFinsweetComponentsEnvironment.d.ts +1 -2
- package/dist/utils/api/getFinsweetComponentsEnvironment.js +3 -6
- package/dist/utils/api/index.d.ts +0 -1
- package/dist/utils/api/index.js +0 -1
- package/dist/utils/api/insertWithXSCP.d.ts +1 -2
- package/dist/utils/api/insertWithXSCP.js +1 -2
- package/dist/utils/auth/crossWindowLogin.d.ts +3 -0
- package/dist/utils/auth/crossWindowLogin.js +3 -0
- package/dist/utils/auth/index.d.ts +9 -25
- package/dist/utils/auth/index.js +9 -25
- package/dist/utils/browser-storage/localStorage.d.ts +4 -12
- package/dist/utils/browser-storage/localStorage.js +4 -12
- package/dist/utils/browser-storage/sessionStorage.d.ts +4 -12
- package/dist/utils/browser-storage/sessionStorage.js +4 -12
- package/dist/utils/custom-code/api.d.ts +3 -7
- package/dist/utils/custom-code/api.js +3 -7
- package/dist/utils/helpers/cleanupTooltipMessage.d.ts +1 -2
- package/dist/utils/helpers/cleanupTooltipMessage.js +1 -2
- package/dist/utils/helpers/goto.d.ts +1 -4
- package/dist/utils/helpers/goto.js +2 -7
- package/dist/utils/helpers/index.d.ts +1 -0
- package/dist/utils/helpers/index.js +1 -0
- package/dist/utils/helpers/noop.d.ts +1 -1
- package/dist/utils/helpers/noop.js +1 -1
- package/dist/utils/helpers/numbers.d.ts +4 -14
- package/dist/utils/helpers/numbers.js +4 -14
- package/dist/utils/helpers/objectsToModuleExports.d.ts +1 -3
- package/dist/utils/helpers/objectsToModuleExports.js +1 -3
- package/dist/utils/helpers/trimText.d.ts +1 -8
- package/dist/utils/helpers/trimText.js +1 -8
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/logger/index.d.ts +0 -2
- package/dist/utils/logger/index.js +0 -2
- package/dist/utils/webflow-canvas/attributes/getAllWebflowElementAttributes.d.ts +1 -3
- package/dist/utils/webflow-canvas/attributes/getAllWebflowElementAttributes.js +1 -3
- package/dist/utils/webflow-canvas/attributes/getInstanceNamesFromObject.d.ts +1 -5
- package/dist/utils/webflow-canvas/attributes/getInstanceNamesFromObject.js +1 -5
- package/dist/utils/webflow-canvas/attributes/getWebflowElementAttribute.d.ts +1 -4
- package/dist/utils/webflow-canvas/attributes/getWebflowElementAttribute.js +1 -4
- package/dist/utils/webflow-canvas/attributes/getWebflowElementTextContent.d.ts +1 -3
- package/dist/utils/webflow-canvas/attributes/getWebflowElementTextContent.js +1 -3
- package/dist/utils/webflow-canvas/attributes/removeWebflowElementAttribute.d.ts +1 -4
- package/dist/utils/webflow-canvas/attributes/removeWebflowElementAttribute.js +1 -4
- package/dist/utils/webflow-canvas/attributes/setStyles.d.ts +1 -3
- package/dist/utils/webflow-canvas/attributes/setStyles.js +1 -3
- package/dist/utils/webflow-canvas/attributes/setWebflowElementAttribute.d.ts +1 -8
- package/dist/utils/webflow-canvas/attributes/setWebflowElementAttribute.js +1 -13
- package/dist/utils/webflow-canvas/findInstanceElement.d.ts +0 -6
- package/dist/utils/webflow-canvas/findInstanceElement.js +1 -7
- package/dist/utils/webflow-canvas/getAllPages.d.ts +3 -10
- package/dist/utils/webflow-canvas/getAllPages.js +3 -10
- package/dist/utils/webflow-canvas/getSiteStagingUrl.d.ts +1 -4
- package/dist/utils/webflow-canvas/getSiteStagingUrl.js +1 -4
- package/dist/utils/webflow-canvas/index.d.ts +1 -0
- package/dist/utils/webflow-canvas/index.js +1 -0
- package/package.json +9 -2
- package/dist/stores/globalStore.d.ts +0 -10
- package/dist/stores/globalStore.js +0 -10
- package/dist/ui/components/ButtonGroup.svelte.d.ts +0 -28
- package/dist/ui/components/Checkbox.svelte +0 -94
- package/dist/ui/components/Checkbox.svelte.d.ts +0 -36
- package/dist/ui/components/Copy.svelte +0 -329
- package/dist/ui/components/Copy.svelte.d.ts +0 -35
- package/dist/ui/components/CustomModal.svelte +0 -192
- package/dist/ui/components/CustomModal.svelte.d.ts +0 -45
- package/dist/ui/components/DisableInEditMode.svelte +0 -66
- package/dist/ui/components/DisableInEditMode.svelte.d.ts +0 -33
- package/dist/ui/components/Divider.svelte +0 -31
- package/dist/ui/components/Divider.svelte.d.ts +0 -31
- package/dist/ui/components/Header.svelte +0 -30
- package/dist/ui/components/Header.svelte.d.ts +0 -20
- package/dist/ui/components/Iframe.svelte +0 -89
- package/dist/ui/components/Iframe.svelte.d.ts +0 -40
- package/dist/ui/components/InjectComponent.svelte +0 -297
- package/dist/ui/components/InjectComponent.svelte.d.ts +0 -27
- package/dist/ui/components/Modal.svelte +0 -139
- package/dist/ui/components/Modal.svelte.d.ts +0 -42
- package/dist/ui/components/Navbar.svelte +0 -132
- package/dist/ui/components/Navbar.svelte.d.ts +0 -29
- package/dist/ui/components/NoSettingsNeeded.svelte +0 -31
- package/dist/ui/components/Notification.svelte +0 -193
- package/dist/ui/components/Notification.svelte.d.ts +0 -64
- package/dist/ui/components/PlusMinusButton.svelte +0 -91
- package/dist/ui/components/PlusMinusButton.svelte.d.ts +0 -22
- package/dist/ui/components/PreviewBar.svelte +0 -40
- package/dist/ui/components/PreviewBar.svelte.d.ts +0 -20
- package/dist/ui/components/ScrollableContent.svelte +0 -18
- package/dist/ui/components/ScrollableContent.svelte.d.ts +0 -31
- package/dist/ui/components/Section.svelte +0 -97
- package/dist/ui/components/Section.svelte.d.ts +0 -50
- package/dist/ui/components/Spacer.svelte +0 -9
- package/dist/ui/components/Spacer.svelte.d.ts +0 -22
- package/dist/ui/components/SpinnerPlusMinus.svelte +0 -75
- package/dist/ui/components/SpinnerPlusMinus.svelte.d.ts +0 -23
- package/dist/ui/components/SpinnerUpDown.svelte +0 -194
- package/dist/ui/components/SpinnerUpDown.svelte.d.ts +0 -31
- package/dist/ui/components/Tabs.svelte +0 -71
- package/dist/ui/components/Tabs.svelte.d.ts +0 -26
- package/dist/ui/components/ToggleItem.svelte +0 -29
- package/dist/ui/components/ToggleList.svelte +0 -57
- package/dist/ui/components/buttons/FooterButton.svelte.d.ts +0 -10
- package/dist/ui/components/buttons/index.d.ts +0 -5
- package/dist/ui/components/buttons/index.js +0 -5
- package/dist/ui/components/clickable/Clickable.stories.svelte +0 -213
- package/dist/ui/components/clickable/Clickable.svelte +0 -93
- package/dist/ui/components/clickable/Clickable.svelte.d.ts +0 -4
- package/dist/ui/components/clickable/index.d.ts +0 -2
- package/dist/ui/components/clickable/index.js +0 -1
- package/dist/ui/components/clickable/types.d.ts +0 -17
- package/dist/utils/api/copyPaste/index.d.ts +0 -18
- /package/dist/ui/components/{buttons → button-group}/types.js +0 -0
- /package/dist/ui/components/{clickable → checkbox}/types.js +0 -0
- /package/dist/{utils/api/copyPaste/index.js → ui/components/controlled-buttons/types.js} +0 -0
- /package/dist/ui/components/layout/{ExampleLayout.svelte.d.ts → examples/ExampleLayout.svelte.d.ts} +0 -0
- /package/dist/ui/components/{ImageUpload.svelte.d.ts → shared/ImageUpload.svelte.d.ts} +0 -0
- /package/dist/ui/components/{SelectBodyOrDivBlock.svelte.d.ts → shared/SelectBodyOrDivBlock.svelte.d.ts} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { useAppContext } from '../../../providers';
|
|
6
6
|
import {
|
|
7
7
|
CheckCircleOutlinedIcon,
|
|
8
8
|
WarningCircleIcon,
|
|
@@ -198,7 +198,7 @@
|
|
|
198
198
|
|
|
199
199
|
<!-- Sidebar -->
|
|
200
200
|
{#if showSidebar}
|
|
201
|
-
<div class="sidebar" data-area="sidebar"
|
|
201
|
+
<div class="sidebar" data-area="sidebar">
|
|
202
202
|
{#if sidebar}
|
|
203
203
|
{@render sidebar()}
|
|
204
204
|
{:else}
|
|
@@ -217,9 +217,7 @@
|
|
|
217
217
|
<div class="main-content" data-area="main">
|
|
218
218
|
{#if main}
|
|
219
219
|
<div class="main-content-container">
|
|
220
|
-
|
|
221
|
-
<EditModeMessage />
|
|
222
|
-
{/if}
|
|
220
|
+
<EditModeMessage />
|
|
223
221
|
{@render main()}
|
|
224
222
|
</div>
|
|
225
223
|
{:else}
|
|
@@ -1,24 +1,36 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { useAppContext } from '../../../../providers';
|
|
3
3
|
import { Pencil, WarningTriangleOutlineIcon } from '../../../icons';
|
|
4
4
|
import { BRAND } from '../../../../utils';
|
|
5
5
|
|
|
6
|
-
import Notification from '../../
|
|
6
|
+
import { Notification } from '../../notification';
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const appContext = useAppContext();
|
|
9
|
+
let appData = $state(appContext.get());
|
|
10
|
+
|
|
11
|
+
// Subscribe to context changes
|
|
12
|
+
appContext.subscribe((data) => {
|
|
13
|
+
appData = data;
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const isEditMode = $derived(appData?.editMode);
|
|
17
|
+
const isRepairMode = $derived(appData?.repairMode);
|
|
18
|
+
const title = $derived(appData?.title);
|
|
19
|
+
|
|
20
|
+
$effect(() => {
|
|
21
|
+
console.log('appData', { appData, editMode: appData?.editMode });
|
|
22
|
+
});
|
|
11
23
|
</script>
|
|
12
24
|
|
|
13
25
|
{#if isEditMode && !isRepairMode}
|
|
14
26
|
<div class="edit-mode">
|
|
15
27
|
<Notification
|
|
16
|
-
|
|
28
|
+
variant="warning"
|
|
17
29
|
title="You are in edit mode for {title} {BRAND.COMPONENT}."
|
|
18
30
|
message={`Make your edits and click on the "Update ${title}" button. You can review and confirm all changes before we proceed with the updates.`}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
31
|
+
richTextMessage={true}
|
|
32
|
+
icon={Pencil}
|
|
33
|
+
showCloseButton={false}
|
|
22
34
|
/>
|
|
23
35
|
</div>
|
|
24
36
|
{/if}
|
|
@@ -26,11 +38,11 @@
|
|
|
26
38
|
{#if isRepairMode}
|
|
27
39
|
<div class="edit-mode">
|
|
28
40
|
<Notification
|
|
29
|
-
|
|
41
|
+
variant="warning"
|
|
30
42
|
title="Component instance not found"
|
|
31
43
|
message="We have detected {BRAND.COMPONENT} as valid, but we couldn't find the associated configurations. This may be a {BRAND.COMPONENT} from another project. Click the 'Repair' button to fix it."
|
|
32
|
-
|
|
33
|
-
|
|
44
|
+
icon={WarningTriangleOutlineIcon}
|
|
45
|
+
showCloseButton={false}
|
|
34
46
|
/>
|
|
35
47
|
</div>
|
|
36
48
|
{/if}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { onMount } from 'svelte';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { useAppContext } from '../../../../providers';
|
|
5
5
|
|
|
6
|
-
import { CheckCircleIcon, CodeIcon, InfoIcon, SettingsIcon } from '
|
|
7
|
-
import { Button } from '
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { Switch } from '
|
|
11
|
-
import Text from '
|
|
12
|
-
import Layout from '
|
|
13
|
-
import type { LayoutNotification, LayoutTab } from '
|
|
6
|
+
import { CheckCircleIcon, CodeIcon, InfoIcon, SettingsIcon } from '../../../icons';
|
|
7
|
+
import { Button } from '../../button';
|
|
8
|
+
import { Input } from '../../input';
|
|
9
|
+
import { Section } from '../../section';
|
|
10
|
+
import { Switch } from '../../switch';
|
|
11
|
+
import Text from '../../text/Text.svelte';
|
|
12
|
+
import Layout from '../Layout.svelte';
|
|
13
|
+
import type { LayoutNotification, LayoutTab } from '../types';
|
|
14
14
|
|
|
15
15
|
// Internal state for configuration
|
|
16
16
|
let activeTab = $state('settings');
|
|
@@ -25,6 +25,16 @@
|
|
|
25
25
|
let notificationSuccess = $state(true);
|
|
26
26
|
let inputValue = $state('');
|
|
27
27
|
|
|
28
|
+
// Get app context and keep editMode in sync
|
|
29
|
+
const appContext = useAppContext();
|
|
30
|
+
|
|
31
|
+
// Subscribe to context changes to keep local editMode in sync
|
|
32
|
+
appContext.subscribe((data) => {
|
|
33
|
+
if (data?.editMode !== undefined && data.editMode !== editMode) {
|
|
34
|
+
editMode = data.editMode;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
28
38
|
// Dummy data for 2 tabs: settings and code
|
|
29
39
|
const dummyTabs: LayoutTab[] = [
|
|
30
40
|
{ path: 'settings', name: 'Settings', icon: SettingsIcon, isActive: false },
|
|
@@ -79,17 +89,19 @@
|
|
|
79
89
|
}
|
|
80
90
|
|
|
81
91
|
onMount(() => {
|
|
82
|
-
|
|
92
|
+
appContext.set({
|
|
83
93
|
editMode: true,
|
|
84
|
-
componentKey: 'dummy-layout',
|
|
85
94
|
repairMode: false,
|
|
86
|
-
formKey: 'dummy-layout',
|
|
87
|
-
formUpdateKey: 'dummy-layout-update',
|
|
88
95
|
title: 'Example',
|
|
89
|
-
|
|
90
|
-
|
|
96
|
+
configurator: {
|
|
97
|
+
configurator: null,
|
|
98
|
+
configuratorCache: null,
|
|
99
|
+
hasChanged: false,
|
|
100
|
+
watchOptions: { watchAll: true, debounceMs: 50 }
|
|
91
101
|
}
|
|
92
102
|
});
|
|
103
|
+
// Initialize local editMode state
|
|
104
|
+
editMode = true;
|
|
93
105
|
});
|
|
94
106
|
</script>
|
|
95
107
|
|
|
@@ -181,9 +193,9 @@
|
|
|
181
193
|
bind:checked={editMode}
|
|
182
194
|
id="edit-mode"
|
|
183
195
|
class="checkbox-input"
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
196
|
+
onchange={() => {
|
|
197
|
+
const current = appContext.get();
|
|
198
|
+
appContext.set({ ...current, editMode });
|
|
187
199
|
}}
|
|
188
200
|
/>
|
|
189
201
|
<label for="edit-mode" class="checkbox-label">Edit Mode</label>
|
|
@@ -306,12 +318,12 @@
|
|
|
306
318
|
width="130px"
|
|
307
319
|
/>
|
|
308
320
|
</div>
|
|
309
|
-
<
|
|
321
|
+
<Section clickable disabled>
|
|
310
322
|
<Text fontSize="md" fontWeight="normal">Clickable disabled</Text>
|
|
311
|
-
</
|
|
312
|
-
<
|
|
323
|
+
</Section>
|
|
324
|
+
<Section clickable>
|
|
313
325
|
<Text fontSize="md" fontWeight="normal">Clickable enabled</Text>
|
|
314
|
-
</
|
|
326
|
+
</Section>
|
|
315
327
|
{:else if activeTab === 'code'}
|
|
316
328
|
<Text fontSize="xl" fontWeight="normal">Code Editor Tab content</Text>
|
|
317
329
|
{/if}
|
package/dist/ui/components/{NoSettingsNeeded.svelte.d.ts → layout/examples/Wrapper.svelte.d.ts}
RENAMED
|
@@ -11,8 +11,8 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
11
11
|
};
|
|
12
12
|
z_$$bindings?: Bindings;
|
|
13
13
|
}
|
|
14
|
-
declare const
|
|
14
|
+
declare const Wrapper: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
15
|
[evt: string]: CustomEvent<any>;
|
|
16
16
|
}, {}, {}, string>;
|
|
17
|
-
type
|
|
18
|
-
export default
|
|
17
|
+
type Wrapper = InstanceType<typeof Wrapper>;
|
|
18
|
+
export default Wrapper;
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { InfoIcon, SaveIcon, WarningTriangleIcon } from '../../icons';
|
|
3
|
+
import { Button } from '../button';
|
|
4
|
+
import Modal from './Modal.svelte';
|
|
5
|
+
|
|
6
|
+
// Modal states
|
|
7
|
+
let basicModalOpen = $state(false);
|
|
8
|
+
let loadingModalOpen = $state(false);
|
|
9
|
+
let noHeaderModalOpen = $state(false);
|
|
10
|
+
let preventCloseModalOpen = $state(false);
|
|
11
|
+
let customStyledModalOpen = $state(false);
|
|
12
|
+
let longContentModalOpen = $state(false);
|
|
13
|
+
let customFooterModalOpen = $state(false);
|
|
14
|
+
|
|
15
|
+
// Loading simulation
|
|
16
|
+
let isLoading = $state(false);
|
|
17
|
+
|
|
18
|
+
// Handle loading modal
|
|
19
|
+
async function handleShowLoading() {
|
|
20
|
+
loadingModalOpen = true;
|
|
21
|
+
isLoading = true;
|
|
22
|
+
|
|
23
|
+
// Simulate async operation
|
|
24
|
+
setTimeout(() => {
|
|
25
|
+
isLoading = false;
|
|
26
|
+
}, 3000);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Handle prevent close modal
|
|
30
|
+
function handleForceClose() {
|
|
31
|
+
preventCloseModalOpen = false;
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<div class="modal-examples">
|
|
36
|
+
<h2>Modal Component Examples</h2>
|
|
37
|
+
<p>Interactive examples demonstrating different modal configurations and behaviors.</p>
|
|
38
|
+
|
|
39
|
+
<div class="example-section">
|
|
40
|
+
<h3>Basic Examples</h3>
|
|
41
|
+
<div class="button-grid">
|
|
42
|
+
<Button variant="primary" onclick={() => (basicModalOpen = true)}>Basic Modal</Button>
|
|
43
|
+
<Button variant="primary" onclick={handleShowLoading}>Loading Modal</Button>
|
|
44
|
+
<Button variant="primary" onclick={() => (noHeaderModalOpen = true)}
|
|
45
|
+
>No Header/Footer Modal</Button
|
|
46
|
+
>
|
|
47
|
+
<Button variant="primary" onclick={() => (preventCloseModalOpen = true)}>
|
|
48
|
+
Prevent Close Modal
|
|
49
|
+
</Button>
|
|
50
|
+
<Button variant="primary" onclick={() => (customStyledModalOpen = true)}>
|
|
51
|
+
Custom Styled Modal
|
|
52
|
+
</Button>
|
|
53
|
+
<Button variant="primary" onclick={() => (longContentModalOpen = true)}>
|
|
54
|
+
Long Content Modal
|
|
55
|
+
</Button>
|
|
56
|
+
<Button variant="primary" onclick={() => (customFooterModalOpen = true)}>
|
|
57
|
+
Custom Footer Modal
|
|
58
|
+
</Button>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<!-- Basic Modal -->
|
|
63
|
+
<Modal
|
|
64
|
+
open={basicModalOpen}
|
|
65
|
+
width="400px"
|
|
66
|
+
height="300px"
|
|
67
|
+
padding="8px 12px"
|
|
68
|
+
title="Basic Modal"
|
|
69
|
+
actionText="Confirm"
|
|
70
|
+
cancelText="Cancel"
|
|
71
|
+
onOpenChange={(open) => (basicModalOpen = open)}
|
|
72
|
+
onAction={() => {
|
|
73
|
+
console.log('Action clicked');
|
|
74
|
+
basicModalOpen = false;
|
|
75
|
+
}}
|
|
76
|
+
onCancel={() => {
|
|
77
|
+
console.log('Cancel clicked');
|
|
78
|
+
basicModalOpen = false;
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
<div>
|
|
82
|
+
<p>
|
|
83
|
+
This is a basic modal with default header and footer. The header shows the title and close
|
|
84
|
+
button, while the footer shows action and cancel buttons.
|
|
85
|
+
</p>
|
|
86
|
+
<p>The footer is properly positioned at the bottom using flexbox layout.</p>
|
|
87
|
+
<p>Even with multiple paragraphs of content, the footer stays at the bottom of the modal.</p>
|
|
88
|
+
<p>This ensures a consistent and predictable layout regardless of content length.</p>
|
|
89
|
+
</div>
|
|
90
|
+
</Modal>
|
|
91
|
+
|
|
92
|
+
<!-- Loading Modal -->
|
|
93
|
+
<Modal
|
|
94
|
+
open={loadingModalOpen}
|
|
95
|
+
width="400px"
|
|
96
|
+
height="300px"
|
|
97
|
+
headerPadding="12px 16px"
|
|
98
|
+
contentPadding="16px"
|
|
99
|
+
loading={isLoading}
|
|
100
|
+
loadingMessage="Processing your request..."
|
|
101
|
+
onOpenChange={(open) => (loadingModalOpen = open)}
|
|
102
|
+
>
|
|
103
|
+
{#snippet header()}
|
|
104
|
+
<div style="display: flex; align-items: center; gap: 8px;">
|
|
105
|
+
<SaveIcon />
|
|
106
|
+
<h3>Processing</h3>
|
|
107
|
+
</div>
|
|
108
|
+
{/snippet}
|
|
109
|
+
|
|
110
|
+
<p>
|
|
111
|
+
This modal demonstrates the loading state. The loading overlay will disappear after 3 seconds.
|
|
112
|
+
</p>
|
|
113
|
+
</Modal>
|
|
114
|
+
|
|
115
|
+
<!-- No Header Modal -->
|
|
116
|
+
<Modal
|
|
117
|
+
open={noHeaderModalOpen}
|
|
118
|
+
width="400px"
|
|
119
|
+
height="300px"
|
|
120
|
+
contentPadding="32px"
|
|
121
|
+
showHeader={false}
|
|
122
|
+
showFooter={false}
|
|
123
|
+
onOpenChange={(open) => (noHeaderModalOpen = open)}
|
|
124
|
+
>
|
|
125
|
+
<div style="text-align: center;">
|
|
126
|
+
<div style="margin-bottom: 12px; display: flex; justify-content: center;">
|
|
127
|
+
<InfoIcon />
|
|
128
|
+
</div>
|
|
129
|
+
<h3 style="margin-bottom: 8px;">Welcome!</h3>
|
|
130
|
+
<p>This modal has no header or footer. Close it by clicking outside or pressing Escape.</p>
|
|
131
|
+
</div>
|
|
132
|
+
</Modal>
|
|
133
|
+
|
|
134
|
+
<!-- Prevent Close Modal -->
|
|
135
|
+
<Modal
|
|
136
|
+
open={preventCloseModalOpen}
|
|
137
|
+
width="400px"
|
|
138
|
+
height="300px"
|
|
139
|
+
headerPadding="12px"
|
|
140
|
+
contentPadding="12px"
|
|
141
|
+
footerPadding="12px"
|
|
142
|
+
closeOnOverlayClick={false}
|
|
143
|
+
closeOnEscape={false}
|
|
144
|
+
showCloseButton={false}
|
|
145
|
+
title="⚠️ Important Notice"
|
|
146
|
+
actionText="I Understand"
|
|
147
|
+
cancelText="Dismiss"
|
|
148
|
+
onOpenChange={(open) => (preventCloseModalOpen = open)}
|
|
149
|
+
onAction={handleForceClose}
|
|
150
|
+
onCancel={() => (preventCloseModalOpen = false)}
|
|
151
|
+
>
|
|
152
|
+
{#snippet header()}
|
|
153
|
+
<div style="display: flex; align-items: center; gap: 8px;">
|
|
154
|
+
<WarningTriangleIcon />
|
|
155
|
+
<h3>⚠️ Important Notice</h3>
|
|
156
|
+
</div>
|
|
157
|
+
{/snippet}
|
|
158
|
+
|
|
159
|
+
<p>
|
|
160
|
+
This modal cannot be closed by clicking outside or pressing Escape. You must use the footer
|
|
161
|
+
buttons below to close it.
|
|
162
|
+
</p>
|
|
163
|
+
</Modal>
|
|
164
|
+
|
|
165
|
+
<!-- Custom Styled Modal -->
|
|
166
|
+
<Modal
|
|
167
|
+
open={customStyledModalOpen}
|
|
168
|
+
width="400px"
|
|
169
|
+
height="300px"
|
|
170
|
+
headerPadding="24px"
|
|
171
|
+
contentPadding="24px"
|
|
172
|
+
overlayColor="rgba(255, 0, 100, 0.3)"
|
|
173
|
+
style="border: 3px solid #ff6b6b; box-shadow: 0 0 30px rgba(255, 107, 107, 0.5);"
|
|
174
|
+
onOpenChange={(open) => (customStyledModalOpen = open)}
|
|
175
|
+
>
|
|
176
|
+
{#snippet header()}
|
|
177
|
+
<h3 style="color: #ff6b6b;">🎨 Custom Styled Modal</h3>
|
|
178
|
+
{/snippet}
|
|
179
|
+
|
|
180
|
+
<div>
|
|
181
|
+
<p>This modal demonstrates custom styling with:</p>
|
|
182
|
+
<ul style="margin: 16px 0; padding-left: 20px;">
|
|
183
|
+
<li>Individual section padding</li>
|
|
184
|
+
<li>Pink overlay background</li>
|
|
185
|
+
<li>Custom border and shadow</li>
|
|
186
|
+
<li>Colorful header text</li>
|
|
187
|
+
</ul>
|
|
188
|
+
</div>
|
|
189
|
+
</Modal>
|
|
190
|
+
|
|
191
|
+
<!-- Long Content Modal -->
|
|
192
|
+
<Modal
|
|
193
|
+
open={longContentModalOpen}
|
|
194
|
+
width="400px"
|
|
195
|
+
height="300px"
|
|
196
|
+
title="Layout Demo"
|
|
197
|
+
actionText="Confirm"
|
|
198
|
+
cancelText="Cancel"
|
|
199
|
+
onOpenChange={(open) => (longContentModalOpen = open)}
|
|
200
|
+
onAction={() => (longContentModalOpen = false)}
|
|
201
|
+
onCancel={() => (longContentModalOpen = false)}
|
|
202
|
+
>
|
|
203
|
+
<div>
|
|
204
|
+
<h4>Flexbox Layout Demonstration</h4>
|
|
205
|
+
<p>This modal demonstrates how the flexbox layout keeps the footer at the bottom.</p>
|
|
206
|
+
<p>
|
|
207
|
+
Even when the content is long and exceeds the modal height, the footer remains positioned
|
|
208
|
+
correctly at the bottom.
|
|
209
|
+
</p>
|
|
210
|
+
<p>The content area becomes scrollable while the header and footer stay in place.</p>
|
|
211
|
+
<p>This provides a consistent user experience regardless of content length.</p>
|
|
212
|
+
<p>Here's some additional content to show the scrolling behavior:</p>
|
|
213
|
+
<ul>
|
|
214
|
+
<li>Item 1: Flexbox provides excellent layout control</li>
|
|
215
|
+
<li>Item 2: The footer stays anchored at the bottom</li>
|
|
216
|
+
<li>Item 3: Content area scrolls independently</li>
|
|
217
|
+
<li>Item 4: Header remains fixed at the top</li>
|
|
218
|
+
<li>Item 5: This creates a professional modal layout</li>
|
|
219
|
+
</ul>
|
|
220
|
+
<p>You can scroll through this content while the footer remains visible and accessible.</p>
|
|
221
|
+
<p>This is especially important for forms or detailed content that needs action buttons.</p>
|
|
222
|
+
</div>
|
|
223
|
+
</Modal>
|
|
224
|
+
|
|
225
|
+
<!-- Custom Footer Modal -->
|
|
226
|
+
<Modal
|
|
227
|
+
open={customFooterModalOpen}
|
|
228
|
+
width="400px"
|
|
229
|
+
height="300px"
|
|
230
|
+
title="Custom Footer Example"
|
|
231
|
+
actionText="Save Changes"
|
|
232
|
+
cancelText="Cancel"
|
|
233
|
+
onOpenChange={(open) => (customFooterModalOpen = open)}
|
|
234
|
+
onAction={() => {
|
|
235
|
+
console.log('Save action triggered');
|
|
236
|
+
customFooterModalOpen = false;
|
|
237
|
+
}}
|
|
238
|
+
onCancel={() => {
|
|
239
|
+
console.log('Cancel action triggered');
|
|
240
|
+
customFooterModalOpen = false;
|
|
241
|
+
}}
|
|
242
|
+
>
|
|
243
|
+
<div>
|
|
244
|
+
<p>This modal demonstrates custom footer styling while maintaining proper functionality.</p>
|
|
245
|
+
<p>
|
|
246
|
+
Both the "Save Changes" and "Cancel" buttons will close the modal and trigger their
|
|
247
|
+
respective callbacks.
|
|
248
|
+
</p>
|
|
249
|
+
</div>
|
|
250
|
+
|
|
251
|
+
{#snippet footer()}
|
|
252
|
+
<div style="display: flex; justify-content: space-between; width: 100%;">
|
|
253
|
+
<div style="display: flex; gap: 8px; width: 100%; justify-content: space-between;">
|
|
254
|
+
<Button
|
|
255
|
+
variant="secondary"
|
|
256
|
+
onclick={() => {
|
|
257
|
+
console.log('Custom cancel clicked');
|
|
258
|
+
customFooterModalOpen = false;
|
|
259
|
+
}}
|
|
260
|
+
>
|
|
261
|
+
✕ Cancel
|
|
262
|
+
</Button>
|
|
263
|
+
<Button
|
|
264
|
+
variant="primary"
|
|
265
|
+
onclick={() => {
|
|
266
|
+
console.log('Custom save clicked');
|
|
267
|
+
customFooterModalOpen = false;
|
|
268
|
+
}}
|
|
269
|
+
>
|
|
270
|
+
✓ Save & Close
|
|
271
|
+
</Button>
|
|
272
|
+
</div>
|
|
273
|
+
</div>
|
|
274
|
+
{/snippet}
|
|
275
|
+
</Modal>
|
|
276
|
+
</div>
|
|
277
|
+
|
|
278
|
+
<style>
|
|
279
|
+
.modal-examples {
|
|
280
|
+
padding: 24px;
|
|
281
|
+
width: 800px;
|
|
282
|
+
height: 600px;
|
|
283
|
+
margin: 0 auto;
|
|
284
|
+
position: relative;
|
|
285
|
+
overflow: hidden;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.modal-examples :global(.modal-overlay) {
|
|
289
|
+
height: 100%;
|
|
290
|
+
width: 100%;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.example-section {
|
|
294
|
+
margin-bottom: 32px;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.example-section h3 {
|
|
298
|
+
margin-bottom: 16px;
|
|
299
|
+
color: var(--text1, #ffffff);
|
|
300
|
+
font-size: 18px;
|
|
301
|
+
font-weight: 600;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.button-grid {
|
|
305
|
+
display: grid;
|
|
306
|
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
307
|
+
gap: 12px;
|
|
308
|
+
margin-bottom: 16px;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
h2 {
|
|
312
|
+
color: var(--text1, #ffffff);
|
|
313
|
+
margin-bottom: 8px;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
p {
|
|
317
|
+
color: var(--text2, rgba(255, 255, 255, 0.8));
|
|
318
|
+
margin-bottom: 24px;
|
|
319
|
+
}
|
|
320
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!-- eslint-disable svelte/no-useless-children-snippet -->
|
|
2
|
+
<script module>
|
|
3
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
4
|
+
|
|
5
|
+
import Example from './Example.svelte';
|
|
6
|
+
|
|
7
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
8
|
+
const { Story } = defineMeta({
|
|
9
|
+
title: 'UI/Modal',
|
|
10
|
+
component: Example,
|
|
11
|
+
tags: ['autodocs']
|
|
12
|
+
});
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<!-- Interactive Examples -->
|
|
16
|
+
<Story name="Examples">
|
|
17
|
+
<Example />
|
|
18
|
+
</Story>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default Modal;
|
|
2
|
+
type Modal = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Modal: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|